From: Andrea Bianco Date: Wed, 28 Jul 2021 19:19:45 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.6.0 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=refs%2Fheads%2Fpro;p=motion2.git Built motion from commit (unavailable).|2.6.0 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 4ea2d9b..1de9792 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-07-27T21:13:16.645Z", + "time": "2021-07-28T19:12:47.871Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e5c316c..6407c57 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-07-27T21:13:16.645Z", + "time": "2021-07-28T19:12:47.871Z", "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 d6e9bb3..1a9a9bc 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 _0x2b86=['integration','motionbar','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','motionbar[NULL,NULL,WinAppArguments]','TEXT','VIRTUAL','getDataValue','action'];(function(_0xb6df02,_0x22c938){var _0x44ea85=function(_0x222f23){while(--_0x222f23){_0xb6df02['push'](_0xb6df02['shift']());}};_0x44ea85(++_0x22c938);}(_0x2b86,0xa5));var _0x62b8=function(_0x10d84d,_0x505dd9){_0x10d84d=_0x10d84d-0x0;var _0x4401e3=_0x2b86[_0x10d84d];return _0x4401e3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x62b8('0x0')],'get':function(_0x51bf48){return this[_0x62b8('0x1')](_0x62b8('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x62b8('0x3'),_0x62b8('0x4'),'jscripty',_0x62b8('0x5'),_0x62b8('0x6'),_0x62b8('0x7'),'script']],'msg':_0x62b8('0x8')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x62b8('0x9')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x62b8('0x9')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x62b8('0x9')](0x1000),'comment':_0x62b8('0xa')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x62b8('0x9')](0x1000)},'data6':{'type':Sequelize[_0x62b8('0x9')]},'data7':{'type':Sequelize[_0x62b8('0xb')]}}; \ No newline at end of file +var _0xf2b1=['TEXT','exports','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf2b1,0x177));var _0x1f2b=function(_0xe56790,_0x5f304d){_0xe56790=_0xe56790-0x0;var _0x145cf7=_0xf2b1[_0xe56790];return _0x145cf7;};'use strict';var Sequelize=require('sequelize');module[_0x1f2b('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x13d713){return this[_0x1f2b('0x1')](_0x1f2b('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x1f2b('0x3'),_0x1f2b('0x4'),_0x1f2b('0x5'),_0x1f2b('0x6'),_0x1f2b('0x7'),_0x1f2b('0x8'),_0x1f2b('0x9'),_0x1f2b('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x1f2b('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x1f2b('0xc')},'data2':{'type':Sequelize[_0x1f2b('0xd')](0x1000),'comment':_0x1f2b('0xe')},'data3':{'type':Sequelize[_0x1f2b('0xd')](0x1000),'comment':_0x1f2b('0xf')},'data4':{'type':Sequelize[_0x1f2b('0xd')](0x1000)},'data5':{'type':Sequelize[_0x1f2b('0xd')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x1f2b('0x10')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 7ec7f2a..6a9f87a 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 _0x0384=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','body','Action','find','params','catch','eml-format','fast-json-patch','request-promise','moment','util','path'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0x0384,0xb2));var _0x4038=function(_0x171fe2,_0x1826f1){_0x171fe2=_0x171fe2-0x0;var _0x46418b=_0x0384[_0x171fe2];return _0x46418b;};'use strict';var emlformat=require(_0x4038('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4038('0x1'));var rp=require(_0x4038('0x2'));var moment=require(_0x4038('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4038('0x4'));var path=require(_0x4038('0x5'));var sox=require(_0x4038('0x6'));var csv=require(_0x4038('0x7'));var ejs=require(_0x4038('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4038('0x9'));var squel=require(_0x4038('0xa'));var crypto=require('crypto');var jsforce=require(_0x4038('0xb'));var deskjs=require(_0x4038('0xc'));var toCsv=require(_0x4038('0x7'));var querystring=require(_0x4038('0xd'));var Papa=require(_0x4038('0xe'));var Redis=require(_0x4038('0xf'));var authService=require(_0x4038('0x10'));var qs=require(_0x4038('0x11'));var as=require(_0x4038('0x12'));var hardwareService=require(_0x4038('0x13'));var logger=require(_0x4038('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4038('0x15'));var licenseUtil=require(_0x4038('0x16'));var db=require(_0x4038('0x17'))['db'];function respondWithStatusCode(_0x597661,_0x1b0466){_0x1b0466=_0x1b0466||0xcc;return function(_0x5d3e80){if(_0x5d3e80){return _0x597661['sendStatus'](_0x1b0466);}return _0x597661[_0x4038('0x18')](_0x1b0466)[_0x4038('0x19')]();};}function respondWithResult(_0xfac31a,_0x5a8c13){_0x5a8c13=_0x5a8c13||0xc8;return function(_0x91377a){if(_0x91377a){return _0xfac31a[_0x4038('0x18')](_0x5a8c13)[_0x4038('0x1a')](_0x91377a);}};}function respondWithFilteredResult(_0x28082f,_0x343bf8){return function(_0x4360cf){if(_0x4360cf){var _0x11f9c2=typeof _0x343bf8[_0x4038('0x1b')]===_0x4038('0x1c')&&typeof _0x343bf8[_0x4038('0x1d')]===_0x4038('0x1c');var _0x4b5a2b=_0x4360cf[_0x4038('0x1e')];var _0x593546=_0x11f9c2?0x0:_0x343bf8['offset'];var _0x453388=_0x11f9c2?_0x4360cf['count']:_0x343bf8[_0x4038('0x1b')]+_0x343bf8[_0x4038('0x1d')];var _0x223bcf;if(_0x453388>=_0x4b5a2b){_0x453388=_0x4b5a2b;_0x223bcf=0xc8;}else{_0x223bcf=0xce;}_0x28082f['status'](_0x223bcf);return _0x28082f[_0x4038('0x1f')](_0x4038('0x20'),_0x593546+'-'+_0x453388+'/'+_0x4b5a2b)[_0x4038('0x1a')](_0x4360cf);}return null;};}function patchUpdates(_0x49665d){return function(_0x5c602b){try{jsonpatch[_0x4038('0x21')](_0x5c602b,_0x49665d,!![]);}catch(_0x57b491){return BPromise['reject'](_0x57b491);}return _0x5c602b[_0x4038('0x22')]();};}function saveUpdates(_0x541980,_0x3a1911){return function(_0x442e95){if(_0x442e95){return _0x442e95[_0x4038('0x23')](_0x541980)[_0x4038('0x24')](function(_0x7a4ddd){return _0x7a4ddd;});}return null;};}function removeEntity(_0x2cd748,_0x296248){return function(_0x4867d2){if(_0x4867d2){return _0x4867d2[_0x4038('0x25')]()['then'](function(){_0x2cd748[_0x4038('0x18')](0xcc)[_0x4038('0x19')]();});}};}function handleEntityNotFound(_0x1391d6,_0x4e9469){return function(_0x4639f4){if(!_0x4639f4){_0x1391d6[_0x4038('0x26')](0x194);}return _0x4639f4;};}function handleError(_0x12de77,_0x1308a6){_0x1308a6=_0x1308a6||0x1f4;return function(_0xc01fdd){logger['error'](_0xc01fdd[_0x4038('0x27')]);if(_0xc01fdd[_0x4038('0x28')]){delete _0xc01fdd[_0x4038('0x28')];}_0x12de77[_0x4038('0x18')](_0x1308a6)['send'](_0xc01fdd);};}exports[_0x4038('0x23')]=function(_0xbc00f4,_0x5e9c2a){if(_0xbc00f4[_0x4038('0x29')]['id']){delete _0xbc00f4[_0x4038('0x29')]['id'];}return db[_0x4038('0x2a')][_0x4038('0x2b')]({'where':{'id':_0xbc00f4[_0x4038('0x2c')]['id']}})[_0x4038('0x24')](handleEntityNotFound(_0x5e9c2a,null))[_0x4038('0x24')](saveUpdates(_0xbc00f4[_0x4038('0x29')],null))[_0x4038('0x24')](respondWithResult(_0x5e9c2a,null))[_0x4038('0x2d')](handleError(_0x5e9c2a,null));};exports['destroy']=function(_0x2de880,_0x2068d2){return db[_0x4038('0x2a')]['find']({'where':{'id':_0x2de880[_0x4038('0x2c')]['id']}})[_0x4038('0x24')](handleEntityNotFound(_0x2068d2,null))[_0x4038('0x24')](removeEntity(_0x2068d2,null))[_0x4038('0x2d')](handleError(_0x2068d2,null));}; \ No newline at end of file +var _0x3fb1=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','body','Action','find','params','catch','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x42236e,_0x2e6b94){var _0x216eac=function(_0x53378b){while(--_0x53378b){_0x42236e['push'](_0x42236e['shift']());}};_0x216eac(++_0x2e6b94);}(_0x3fb1,0x15a));var _0x13fb=function(_0xb8111f,_0x2b0a3b){_0xb8111f=_0xb8111f-0x0;var _0x233d1b=_0x3fb1[_0xb8111f];return _0x233d1b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13fb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13fb('0x1'));var rp=require(_0x13fb('0x2'));var moment=require('moment');var BPromise=require(_0x13fb('0x3'));var Mustache=require(_0x13fb('0x4'));var util=require('util');var path=require('path');var sox=require(_0x13fb('0x5'));var csv=require(_0x13fb('0x6'));var ejs=require(_0x13fb('0x7'));var fs=require('fs');var fs_extra=require(_0x13fb('0x8'));var _=require(_0x13fb('0x9'));var squel=require(_0x13fb('0xa'));var crypto=require(_0x13fb('0xb'));var jsforce=require(_0x13fb('0xc'));var deskjs=require(_0x13fb('0xd'));var toCsv=require(_0x13fb('0x6'));var querystring=require(_0x13fb('0xe'));var Papa=require(_0x13fb('0xf'));var Redis=require('ioredis');var authService=require(_0x13fb('0x10'));var qs=require(_0x13fb('0x11'));var as=require(_0x13fb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x13fb('0x13'));var utils=require(_0x13fb('0x14'));var config=require(_0x13fb('0x15'));var licenseUtil=require(_0x13fb('0x16'));var db=require(_0x13fb('0x17'))['db'];function respondWithStatusCode(_0x304378,_0x55edf5){_0x55edf5=_0x55edf5||0xcc;return function(_0x58934e){if(_0x58934e){return _0x304378['sendStatus'](_0x55edf5);}return _0x304378[_0x13fb('0x18')](_0x55edf5)[_0x13fb('0x19')]();};}function respondWithResult(_0x1bd34a,_0x22ba93){_0x22ba93=_0x22ba93||0xc8;return function(_0x5e38c5){if(_0x5e38c5){return _0x1bd34a[_0x13fb('0x18')](_0x22ba93)[_0x13fb('0x1a')](_0x5e38c5);}};}function respondWithFilteredResult(_0x35fae6,_0x583f6b){return function(_0x12ee74){if(_0x12ee74){var _0x7afd0b=typeof _0x583f6b[_0x13fb('0x1b')]===_0x13fb('0x1c')&&typeof _0x583f6b[_0x13fb('0x1d')]==='undefined';var _0x29ed0c=_0x12ee74[_0x13fb('0x1e')];var _0x346a76=_0x7afd0b?0x0:_0x583f6b[_0x13fb('0x1b')];var _0x111e65=_0x7afd0b?_0x12ee74[_0x13fb('0x1e')]:_0x583f6b[_0x13fb('0x1b')]+_0x583f6b['limit'];var _0x39e460;if(_0x111e65>=_0x29ed0c){_0x111e65=_0x29ed0c;_0x39e460=0xc8;}else{_0x39e460=0xce;}_0x35fae6[_0x13fb('0x18')](_0x39e460);return _0x35fae6[_0x13fb('0x1f')](_0x13fb('0x20'),_0x346a76+'-'+_0x111e65+'/'+_0x29ed0c)[_0x13fb('0x1a')](_0x12ee74);}return null;};}function patchUpdates(_0x3d2f06){return function(_0xe5ba2d){try{jsonpatch['apply'](_0xe5ba2d,_0x3d2f06,!![]);}catch(_0xb64166){return BPromise[_0x13fb('0x21')](_0xb64166);}return _0xe5ba2d[_0x13fb('0x22')]();};}function saveUpdates(_0x4f2160,_0x125e3c){return function(_0x228212){if(_0x228212){return _0x228212[_0x13fb('0x23')](_0x4f2160)[_0x13fb('0x24')](function(_0xe9461f){return _0xe9461f;});}return null;};}function removeEntity(_0x2be630,_0xb08cd1){return function(_0x6ea729){if(_0x6ea729){return _0x6ea729['destroy']()[_0x13fb('0x24')](function(){_0x2be630[_0x13fb('0x18')](0xcc)[_0x13fb('0x19')]();});}};}function handleEntityNotFound(_0x23bfb8,_0x4ca606){return function(_0x4e9fdf){if(!_0x4e9fdf){_0x23bfb8['sendStatus'](0x194);}return _0x4e9fdf;};}function handleError(_0x483d39,_0x30193b){_0x30193b=_0x30193b||0x1f4;return function(_0x41fba0){logger[_0x13fb('0x25')](_0x41fba0[_0x13fb('0x26')]);if(_0x41fba0[_0x13fb('0x27')]){delete _0x41fba0[_0x13fb('0x27')];}_0x483d39[_0x13fb('0x18')](_0x30193b)['send'](_0x41fba0);};}exports[_0x13fb('0x23')]=function(_0x30c715,_0x81db89){if(_0x30c715[_0x13fb('0x28')]['id']){delete _0x30c715[_0x13fb('0x28')]['id'];}return db[_0x13fb('0x29')][_0x13fb('0x2a')]({'where':{'id':_0x30c715[_0x13fb('0x2b')]['id']}})[_0x13fb('0x24')](handleEntityNotFound(_0x81db89,null))[_0x13fb('0x24')](saveUpdates(_0x30c715[_0x13fb('0x28')],null))[_0x13fb('0x24')](respondWithResult(_0x81db89,null))[_0x13fb('0x2c')](handleError(_0x81db89,null));};exports['destroy']=function(_0x19f490,_0x25ec83){return db['Action'][_0x13fb('0x2a')]({'where':{'id':_0x19f490['params']['id']}})['then'](handleEntityNotFound(_0x25ec83,null))['then'](removeEntity(_0x25ec83,null))[_0x13fb('0x2c')](handleError(_0x25ec83,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 3efcdaf..8f306f8 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 _0xb108=['moment','bluebird','path','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','../../config/logger','api'];(function(_0x16f72d,_0x41601f){var _0x1af131=function(_0x551355){while(--_0x551355){_0x16f72d['push'](_0x16f72d['shift']());}};_0x1af131(++_0x41601f);}(_0xb108,0x69));var _0x8b10=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xb108[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x8b10('0x0'));var util=require('util');var logger=require(_0x8b10('0x1'))(_0x8b10('0x2'));var moment=require(_0x8b10('0x3'));var BPromise=require(_0x8b10('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b10('0x5'));var rimraf=require('rimraf');var config=require(_0x8b10('0x6'));var attributes=require(_0x8b10('0x7'));module[_0x8b10('0x8')]=function(_0x4921b9,_0x27db15){return _0x4921b9[_0x8b10('0x9')](_0x8b10('0xa'),attributes,{'tableName':_0x8b10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0435=['request-promise','rimraf','../../config/environment','./action.attributes','exports','define','tools_actions','lodash','util','api','moment','bluebird'];(function(_0x4076c8,_0x4cd402){var _0x10ad43=function(_0xb8aca5){while(--_0xb8aca5){_0x4076c8['push'](_0x4076c8['shift']());}};_0x10ad43(++_0x4cd402);}(_0x0435,0x13f));var _0x5043=function(_0x343f5b,_0x5c5f5f){_0x343f5b=_0x343f5b-0x0;var _0x14d9cc=_0x0435[_0x343f5b];return _0x14d9cc;};'use strict';var _=require(_0x5043('0x0'));var util=require(_0x5043('0x1'));var logger=require('../../config/logger')(_0x5043('0x2'));var moment=require(_0x5043('0x3'));var BPromise=require(_0x5043('0x4'));var rp=require(_0x5043('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5043('0x6'));var config=require(_0x5043('0x7'));var attributes=require(_0x5043('0x8'));module[_0x5043('0x9')]=function(_0x2d2d3b,_0x1c61aa){return _0x2d2d3b[_0x5043('0xa')]('Action',attributes,{'tableName':_0x5043('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 79ff166..f50704f 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 _0x0713=['Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x299916,_0x589521){var _0x40f2f3=function(_0x4a3681){while(--_0x4a3681){_0x299916['push'](_0x299916['shift']());}};_0x40f2f3(++_0x589521);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x52cb1d,_0x430c10){var _0x395061=function(_0x4565c6){while(--_0x4565c6){_0x52cb1d['push'](_0x52cb1d['shift']());}};_0x395061(++_0x430c10);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xb7e7[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 083bcb4..7858056 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 _0x2c64=['fs-extra','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x5438e9,_0x3cfcfd){var _0x4c8a29=function(_0x2ea9b4){while(--_0x2ea9b4){_0x5438e9['push'](_0x5438e9['shift']());}};_0x4c8a29(++_0x3cfcfd);}(_0x2c64,0xbf));var _0x42c6=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x2c64[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0x42c6('0x0'));var util=require('util');var path=require(_0x42c6('0x1'));var timeout=require(_0x42c6('0x2'));var express=require(_0x42c6('0x3'));var router=express[_0x42c6('0x4')]();var fs_extra=require(_0x42c6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x42c6('0x6'));var config=require(_0x42c6('0x7'));var controller=require('./action.controller');router[_0x42c6('0x8')](_0x42c6('0x9'),auth[_0x42c6('0xa')](),controller['update']);router[_0x42c6('0xb')](_0x42c6('0x9'),auth['isAuthenticated'](),controller[_0x42c6('0xc')]);module[_0x42c6('0xd')]=router; \ No newline at end of file +var _0x8962=['./action.controller','put','isAuthenticated','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3d16c3,_0x17e1d1){var _0x1d41d5=function(_0x56bb92){while(--_0x56bb92){_0x3d16c3['push'](_0x3d16c3['shift']());}};_0x1d41d5(++_0x17e1d1);}(_0x8962,0x1e2));var _0x2896=function(_0x504ab1,_0x1967ff){_0x504ab1=_0x504ab1-0x0;var _0x22ebb3=_0x8962[_0x504ab1];return _0x22ebb3;};'use strict';var multer=require('multer');var util=require(_0x2896('0x0'));var path=require(_0x2896('0x1'));var timeout=require(_0x2896('0x2'));var express=require(_0x2896('0x3'));var router=express['Router']();var fs_extra=require(_0x2896('0x4'));var auth=require(_0x2896('0x5'));var interaction=require(_0x2896('0x6'));var config=require(_0x2896('0x7'));var controller=require(_0x2896('0x8'));router[_0x2896('0x9')]('/:id',auth[_0x2896('0xa')](),controller[_0x2896('0xb')]);router['delete']('/:id',auth[_0x2896('0xa')](),controller[_0x2896('0xc')]);module[_0x2896('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index a290bfe..bde8779 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 _0x49d0=['TEXT','exports','STRING'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x49d0,0x1ed));var _0x049d=function(_0x4097b9,_0x54f89d){_0x4097b9=_0x4097b9-0x0;var _0x48d820=_0x49d0[_0x4097b9];return _0x48d820;};'use strict';var Sequelize=require('sequelize');module[_0x049d('0x0')]={'name':{'type':Sequelize[_0x049d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x049d('0x1')]},'parent':{'type':Sequelize[_0x049d('0x1')]},'table':{'type':Sequelize[_0x049d('0x1')]},'conditions':{'type':Sequelize[_0x049d('0x2')]},'joins':{'type':Sequelize[_0x049d('0x2')]}}; \ No newline at end of file +var _0x0ca2=['exports','STRING','TEXT','sequelize'];(function(_0x2f1172,_0x5f5b26){var _0x58e374=function(_0x1a61fa){while(--_0x1a61fa){_0x2f1172['push'](_0x2f1172['shift']());}};_0x58e374(++_0x5f5b26);}(_0x0ca2,0x1f3));var _0x20ca=function(_0x14ab01,_0x34fd2a){_0x14ab01=_0x14ab01-0x0;var _0x5ee177=_0x0ca2[_0x14ab01];return _0x5ee177;};'use strict';var Sequelize=require(_0x20ca('0x0'));module[_0x20ca('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x20ca('0x2')]},'parent':{'type':Sequelize[_0x20ca('0x2')]},'table':{'type':Sequelize[_0x20ca('0x2')]},'conditions':{'type':Sequelize[_0x20ca('0x3')]},'joins':{'type':Sequelize[_0x20ca('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index bdfef7b..71b11c6 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 _0xa9e0=['then','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','rules','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','MAX(%s)','SEC_TO_TIME(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','value','orderBy','output','web','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','runReport','IS\x20NOT\x20EMPTY','operator','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','dbH','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','destroy'];(function(_0x2a2bf4,_0x1d0acf){var _0x2708b3=function(_0x311681){while(--_0x311681){_0x2a2bf4['push'](_0x2a2bf4['shift']());}};_0x2708b3(++_0x1d0acf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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'];var dbH=require(_0x0a9e('0x14'))[_0x0a9e('0x15')];function respondWithStatusCode(_0x32d742,_0x69aeb7){_0x69aeb7=_0x69aeb7||0xcc;return function(_0x5db4b0){if(_0x5db4b0){return _0x32d742[_0x0a9e('0x16')](_0x69aeb7);}return _0x32d742[_0x0a9e('0x17')](_0x69aeb7)[_0x0a9e('0x18')]();};}function respondWithResult(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xc8;return function(_0x4d5611){if(_0x4d5611){return _0x281129['status'](_0x44dcfd)[_0x0a9e('0x19')](_0x4d5611);}};}function respondWithFilteredResult(_0x5d0880,_0x1985b6){return function(_0x519dfd){if(_0x519dfd){var _0x16033c=typeof _0x1985b6[_0x0a9e('0x1a')]==='undefined'&&typeof _0x1985b6[_0x0a9e('0x1b')]==='undefined';var _0x459eb1=_0x519dfd[_0x0a9e('0x1c')];var _0x106033=_0x16033c?0x0:_0x1985b6[_0x0a9e('0x1a')];var _0x31b1ca=_0x16033c?_0x519dfd[_0x0a9e('0x1c')]:_0x1985b6[_0x0a9e('0x1a')]+_0x1985b6[_0x0a9e('0x1b')];var _0x1314ae;if(_0x31b1ca>=_0x459eb1){_0x31b1ca=_0x459eb1;_0x1314ae=0xc8;}else{_0x1314ae=0xce;}_0x5d0880[_0x0a9e('0x17')](_0x1314ae);return _0x5d0880[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x106033+'-'+_0x31b1ca+'/'+_0x459eb1)['json'](_0x519dfd);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x1f')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x20')]()[_0x0a9e('0x21')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x22');return db[_0x0a9e('0x23')][_0x0a9e('0x20')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x21')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x16')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x24')](_0x140511[_0x0a9e('0x25')]);if(_0x140511[_0x0a9e('0x26')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x17')](_0x14433c)[_0x0a9e('0x27')](_0x140511);};}exports[_0x0a9e('0x28')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2c')],'type':_0x2e8759['type'][_0x0a9e('0x2d')]};});_0x40e7a3['model']=_[_0x0a9e('0x29')](_0x824a4f,_0x0a9e('0x26'));_0x40e7a3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x2ec755[_0x0a9e('0x2e')]);_0x40e7a3['filters']=_[_0x0a9e('0x30')](_0x40e7a3[_0x0a9e('0x31')],_0x40e7a3[_0x0a9e('0x2e')]);_0x15b200[_0x0a9e('0x32')]=_[_0x0a9e('0x30')](_0x40e7a3[_0x0a9e('0x31')],qs[_0x0a9e('0x33')](_0x2ec755[_0x0a9e('0x2e')]['fields']));_0x15b200[_0x0a9e('0x32')]=_0x15b200['attributes'][_0x0a9e('0x34')]?_0x15b200[_0x0a9e('0x32')]:_0x40e7a3[_0x0a9e('0x31')];if(!_0x2ec755[_0x0a9e('0x2e')]['hasOwnProperty'](_0x0a9e('0x35'))){_0x15b200[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2ec755[_0x0a9e('0x2e')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1a')](_0x2ec755['query'][_0x0a9e('0x1a')]);}_0x15b200[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x2ec755[_0x0a9e('0x2e')]['sort']);_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x3a')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x39')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x2e')][_0x0a9e('0x3b')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x38')],{'$or':_[_0x0a9e('0x29')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x26')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x3e')]({},_0x15b200,_0x2ec755[_0x0a9e('0x3f')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x38')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x1c')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1c')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x2e')][_0x0a9e('0x40')]){_0x15b200[_0x0a9e('0x41')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x42')](_0x15b200);})[_0x0a9e('0x21')](function(_0x23b089){_0x1843b2[_0x0a9e('0x43')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x21')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x44')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x45')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x46')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x52628e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x11ca30[_0x0a9e('0x2e')]);_0x52628e[_0x0a9e('0x39')]=_[_0x0a9e('0x30')](_0x52628e[_0x0a9e('0x31')],_0x52628e[_0x0a9e('0x2e')]);_0x4d04c8['attributes']=_[_0x0a9e('0x30')](_0x52628e[_0x0a9e('0x31')],qs[_0x0a9e('0x33')](_0x11ca30[_0x0a9e('0x2e')][_0x0a9e('0x33')]));_0x4d04c8[_0x0a9e('0x32')]=_0x4d04c8[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x31')];if(_0x11ca30['query'][_0x0a9e('0x40')]){_0x4d04c8[_0x0a9e('0x41')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x3e')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x4d04c8)[_0x0a9e('0x21')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x21')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x44')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x48')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')](_0x45bf7f[_0x0a9e('0x49')],{})[_0x0a9e('0x21')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4a')][_0x0a9e('0x4b')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4c'));if(_0x992c77['role']===_0x0a9e('0x4a')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Reports';return db[_0x0a9e('0x4d')][_0x0a9e('0x47')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x4e')]},'raw':!![]})[_0x0a9e('0x21')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x4f')]===0x0){return db[_0x0a9e('0x23')][_0x0a9e('0x48')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':'CustomReports','sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x44')](function(_0x204173){logger[_0x0a9e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x21')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x44')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x49')]['id'];}return db['AnalyticCustomReport'][_0x0a9e('0x47')]({'where':{'id':_0x5a88da[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x49')],null))[_0x0a9e('0x21')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['AnalyticCustomReport'][_0x0a9e('0x47')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x44')](handleError(_0x3aedd0,null));};exports['preview']=function(_0x5da27d,_0x5df0ad){var _0x2da03c=0xa;var _0x47de4c=[_0x0a9e('0x50'),_0x0a9e('0x51'),_0x0a9e('0x52'),_0x0a9e('0x53')];var _0x232830={'SUM':_0x0a9e('0x54'),'COUNT':_0x0a9e('0x55'),'COUNT DISTINCT':_0x0a9e('0x56'),'MAX':'MAX(%s)','MIN':_0x0a9e('0x57'),'AVG':_0x0a9e('0x58'),'GROUP_CONCAT':_0x0a9e('0x59'),'GROUP_CONCAT ASC':_0x0a9e('0x5a'),'GROUP_CONCAT DESC':_0x0a9e('0x5b')};var _0x156662={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0a9e('0x5c'),'HOUR':_0x0a9e('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0a9e('0x5e')};var _0x5cc8fb=function(_0x20c668){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0x0a9e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x20c668);};var _0x2244d6=function(_0x1fc70e){if(!_0x1fc70e||!_0x1fc70e[_0x0a9e('0x60')][_0x0a9e('0x34')]){return'';}for(var _0x1cca9f='(',_0x26d7db=0x0;_0x26d7db<_0x1fc70e['rules'][_0x0a9e('0x34')];_0x26d7db+=0x1){_0x26d7db>0x0&&(_0x1cca9f+='\x20'+_0x1fc70e['operator']+'\x20');_0x1cca9f+=_0x1fc70e[_0x0a9e('0x60')][_0x26d7db][_0x0a9e('0x61')]?_0x2244d6(_0x1fc70e[_0x0a9e('0x60')][_0x26d7db]['group']):_0x1fc70e[_0x0a9e('0x60')][_0x26d7db][_0x0a9e('0x62')]+'\x20'+_0x1fc70e[_0x0a9e('0x60')][_0x26d7db][_0x0a9e('0x63')]+(_0x5cc8fb(_0x1fc70e['rules'][_0x26d7db][_0x0a9e('0x63')])?'\x20'+_0x1fc70e[_0x0a9e('0x60')][_0x26d7db]['value']:'');}return _0x1cca9f+')';};var _0x797b45={'where':{'id':_0x5da27d[_0x0a9e('0x46')]['id']}},_0x17e88c,_0x88dcbf,_0x409b29,_0x401837,_0x4d4a35;_0x797b45=_[_0x0a9e('0x3e')]({},_0x797b45,_0x5da27d[_0x0a9e('0x3f')]);return db['AnalyticCustomReport'][_0x0a9e('0x47')](_0x797b45)['then'](function(_0x5211e3){if(_0x5211e3){_0x17e88c=_0x5211e3;return _0x5211e3[_0x0a9e('0x64')]();}return null;})[_0x0a9e('0x21')](function(_0x9375fb){if(_0x9375fb){if(!_0x9375fb[_0x0a9e('0x34')]){throw new db[(_0x0a9e('0x65'))][(_0x0a9e('0x66'))](_0x0a9e('0x67'),0x193);}_0x88dcbf=_0x9375fb;return db[_0x0a9e('0x68')][_0x0a9e('0x42')]({'raw':!![]});}return null;})[_0x0a9e('0x21')](function(_0x2e89b7){if(_0x2e89b7){_0x409b29=_[_0x0a9e('0x69')](_0x2e89b7,'id');var _0x2bbb86;var _0x2b8192=squel[_0x0a9e('0x6a')]();_0x2b8192[_0x0a9e('0x6b')](_0x17e88c[_0x0a9e('0x6c')]);for(var _0x4257c9=0x0;_0x4257c9<_0x88dcbf['length'];_0x4257c9+=0x1){_0x2bbb86=_0x88dcbf[_0x4257c9][_0x0a9e('0x6d')]?_0x409b29[_0x88dcbf[_0x4257c9][_0x0a9e('0x6d')]][_0x0a9e('0x6e')]:_0x88dcbf[_0x4257c9]['field'];_0x2bbb86=_0x88dcbf[_0x4257c9][_0x0a9e('0x6f')]?_[_0x0a9e('0x70')](_0x232830[_0x88dcbf[_0x4257c9]['function']],'%s',_0x2bbb86):_0x2bbb86;_0x2bbb86=_0x88dcbf[_0x4257c9][_0x0a9e('0x71')]?_[_0x0a9e('0x70')](_0x156662[_0x88dcbf[_0x4257c9][_0x0a9e('0x71')]],'%s',_0x2bbb86):_0x2bbb86;if(_0x88dcbf[_0x4257c9][_0x0a9e('0x72')]){_0x2b8192[_0x0a9e('0x61')](_0x2bbb86);}_0x88dcbf[_0x4257c9]['orderBy']&&_0x2b8192['order'](_0x2bbb86,_0x88dcbf[_0x4257c9]['orderBy']===_0x0a9e('0x73')?![]:!![]);_0x2b8192[_0x0a9e('0x62')](_0x2bbb86,_0x88dcbf[_0x4257c9][_0x0a9e('0x74')]||_0x2bbb86);}if(_0x17e88c[_0x0a9e('0x75')]){_0x17e88c[_0x0a9e('0x75')]=JSON[_0x0a9e('0x76')](_0x17e88c[_0x0a9e('0x75')]);for(var _0x1a0677=0x0;_0x1a0677<_0x17e88c['joins'][_0x0a9e('0x34')];_0x1a0677+=0x1){if(_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x3c')]&&_['includes'](_0x47de4c,_0x17e88c[_0x0a9e('0x75')][_0x1a0677]['type'])&&_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x77')]&&_0x17e88c['joins'][_0x1a0677][_0x0a9e('0x78')]&&_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x79')]){_0x2b8192[_0x17e88c[_0x0a9e('0x75')][_0x1a0677]['type']](_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x78')],null,util[_0x0a9e('0x71')](_0x0a9e('0x7a'),_0x17e88c['table'],_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x77')],_0x17e88c[_0x0a9e('0x75')][_0x1a0677][_0x0a9e('0x78')],_0x17e88c['joins'][_0x1a0677][_0x0a9e('0x79')]));}}}if(_0x17e88c[_0x0a9e('0x7b')]){_0x17e88c[_0x0a9e('0x7b')]=JSON[_0x0a9e('0x76')](_0x17e88c[_0x0a9e('0x7b')]);_0x2b8192[_0x0a9e('0x38')](_0x2244d6(_0x17e88c[_0x0a9e('0x7b')][_0x0a9e('0x61')]));}_0x4d4a35=_0x2b8192[_0x0a9e('0x7c')]();_0x2b8192[_0x0a9e('0x1b')](_0x2da03c);_0x2b8192[_0x0a9e('0x1a')](0x0);logger[_0x0a9e('0x7d')](_0x0a9e('0x7e'),_0x2b8192[_0x0a9e('0x7f')]());return dbH['sequelize'][_0x0a9e('0x2e')](_0x2b8192[_0x0a9e('0x7f')](),{'type':dbH[_0x0a9e('0x80')]['QueryTypes'][_0x0a9e('0x81')]});}})[_0x0a9e('0x21')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x44')](handleError(_0x5df0ad,null));};function runReport(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8=_0x56d650[_0x0a9e('0x26')];var _0x4c54fa=0xa;var _0x45108c=['join',_0x0a9e('0x51'),_0x0a9e('0x52'),'cross_join'];var _0x28a942={'SUM':_0x0a9e('0x54'),'COUNT':_0x0a9e('0x55'),'COUNT DISTINCT':_0x0a9e('0x56'),'MAX':_0x0a9e('0x82'),'MIN':_0x0a9e('0x57'),'AVG':_0x0a9e('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x0a9e('0x5a'),'GROUP_CONCAT DESC':_0x0a9e('0x5b')};var _0x45c109={'SEC_TO_TIME':_0x0a9e('0x83'),'DATE':'DATE(%s)','HOUR':_0x0a9e('0x5d'),'ROUND':_0x0a9e('0x84'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1d6834=function(_0x5b7940){return!_[_0x0a9e('0x85')]([_0x0a9e('0x86'),_0x0a9e('0x87'),_0x0a9e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x5b7940);};var _0x51ccd7=function(_0x353384){if(!_0x353384||!_0x353384[_0x0a9e('0x60')][_0x0a9e('0x34')]){return'';}for(var _0x5ac73d='(',_0x3b4a9f=0x0;_0x3b4a9f<_0x353384[_0x0a9e('0x60')]['length'];_0x3b4a9f+=0x1){_0x3b4a9f>0x0&&(_0x5ac73d+='\x20'+_0x353384['operator']+'\x20');_0x5ac73d+=_0x353384[_0x0a9e('0x60')][_0x3b4a9f]['group']?_0x51ccd7(_0x353384['rules'][_0x3b4a9f]['group']):_0x353384[_0x0a9e('0x60')][_0x3b4a9f][_0x0a9e('0x62')]+'\x20'+_0x353384[_0x0a9e('0x60')][_0x3b4a9f][_0x0a9e('0x63')]+(_0x1d6834(_0x353384[_0x0a9e('0x60')][_0x3b4a9f][_0x0a9e('0x63')])?'\x20'+_0x353384['rules'][_0x3b4a9f][_0x0a9e('0x88')]:'');}return _0x5ac73d+')';};var _0x5955f1={'where':{'id':_0x2b9463['id']}},_0x2871c1,_0x2aabab,_0x18ad56,_0x4566b0,_0x50f8d7;_0x5955f1=_[_0x0a9e('0x3e')]({},_0x5955f1,_0x541e80);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x5955f1)['then'](function(_0xb6e411){if(_0xb6e411){_0x2871c1=_0xb6e411;return _0xb6e411[_0x0a9e('0x64')]();}return null;})[_0x0a9e('0x21')](function(_0x22063c){if(_0x22063c){if(!_0x22063c[_0x0a9e('0x34')]){throw new db[(_0x0a9e('0x65'))][(_0x0a9e('0x66'))](_0x0a9e('0x67'),0x193);}_0x2aabab=_0x22063c;return db['AnalyticMetric'][_0x0a9e('0x42')]({'raw':!![]});}return null;})[_0x0a9e('0x21')](function(_0x589ff3){if(_0x589ff3){_0x18ad56=_[_0x0a9e('0x69')](_0x589ff3,'id');var _0x982340;var _0x3a1974=squel['select']();_0x3a1974[_0x0a9e('0x6b')](_0x2871c1['table']);for(var _0x8c8fbe=0x0;_0x8c8fbe<_0x2aabab[_0x0a9e('0x34')];_0x8c8fbe+=0x1){_0x982340=_0x2aabab[_0x8c8fbe][_0x0a9e('0x6d')]?_0x18ad56[_0x2aabab[_0x8c8fbe][_0x0a9e('0x6d')]][_0x0a9e('0x6e')]:_0x2aabab[_0x8c8fbe][_0x0a9e('0x62')];_0x982340=_0x2aabab[_0x8c8fbe][_0x0a9e('0x6f')]?_[_0x0a9e('0x70')](_0x28a942[_0x2aabab[_0x8c8fbe]['function']],'%s',_0x982340):_0x982340;_0x982340=_0x2aabab[_0x8c8fbe][_0x0a9e('0x71')]?_[_0x0a9e('0x70')](_0x45c109[_0x2aabab[_0x8c8fbe][_0x0a9e('0x71')]],'%s',_0x982340):_0x982340;if(_0x2aabab[_0x8c8fbe][_0x0a9e('0x72')]){_0x3a1974[_0x0a9e('0x61')](_0x982340);}_0x2aabab[_0x8c8fbe][_0x0a9e('0x89')]&&_0x3a1974[_0x0a9e('0x36')](_0x982340,_0x2aabab[_0x8c8fbe][_0x0a9e('0x89')]===_0x0a9e('0x73')?![]:!![]);_0x3a1974[_0x0a9e('0x62')](_0x982340,_0x2aabab[_0x8c8fbe][_0x0a9e('0x74')]||_0x982340);}if(_0x2871c1[_0x0a9e('0x75')]){_0x2871c1[_0x0a9e('0x75')]=JSON['parse'](_0x2871c1[_0x0a9e('0x75')]);for(var _0x23e2bd=0x0;_0x23e2bd<_0x2871c1[_0x0a9e('0x75')][_0x0a9e('0x34')];_0x23e2bd+=0x1){if(_0x2871c1[_0x0a9e('0x75')][_0x23e2bd]['type']&&_[_0x0a9e('0x85')](_0x45108c,_0x2871c1[_0x0a9e('0x75')][_0x23e2bd]['type'])&&_0x2871c1[_0x0a9e('0x75')][_0x23e2bd]['parentKey']&&_0x2871c1[_0x0a9e('0x75')][_0x23e2bd][_0x0a9e('0x78')]&&_0x2871c1[_0x0a9e('0x75')][_0x23e2bd][_0x0a9e('0x79')]){_0x3a1974[_0x2871c1['joins'][_0x23e2bd][_0x0a9e('0x3c')]](_0x2871c1['joins'][_0x23e2bd][_0x0a9e('0x78')],null,util[_0x0a9e('0x71')]('%s.%s\x20=\x20%s.%s',_0x2871c1[_0x0a9e('0x6c')],_0x2871c1[_0x0a9e('0x75')][_0x23e2bd][_0x0a9e('0x77')],_0x2871c1['joins'][_0x23e2bd]['foreignTable'],_0x2871c1[_0x0a9e('0x75')][_0x23e2bd][_0x0a9e('0x79')]));}}}if(_0x2871c1[_0x0a9e('0x7b')]){_0x2871c1[_0x0a9e('0x7b')]=JSON[_0x0a9e('0x76')](_0x2871c1[_0x0a9e('0x7b')]);_0x3a1974[_0x0a9e('0x38')](_0x51ccd7(_0x2871c1[_0x0a9e('0x7b')][_0x0a9e('0x61')]));}_0x50f8d7=_0x3a1974['clone']();_0x3a1974[_0x0a9e('0x1b')](_0x4c54fa);_0x3a1974['offset'](0x0);return;}})[_0x0a9e('0x21')](function(){if(_0x56d650[_0x0a9e('0x8a')]===_0x0a9e('0x8b')){return null;}var _0x28ce92=_[_0x0a9e('0x3e')](_0x56d650,{'name':_0x56d650['fullPath']||_0x56d650[_0x0a9e('0x26')]||_0x2871c1[_0x0a9e('0x26')],'basename':_0x7ebea8,'savename':util[_0x0a9e('0x71')](_0x0a9e('0x8c'),_0x56d650[_0x0a9e('0x26')]||_0x2871c1['name'],require('randomstring')[_0x0a9e('0x8d')](0x4),_0x56d650['output']||_0x0a9e('0x8e')),'reportId':_0x2871c1['id'],'reportType':_0x0a9e('0x8f')});return db[_0x0a9e('0x90')][_0x0a9e('0x48')](_0x28ce92,{'raw':!![]});})[_0x0a9e('0x21')](function(_0x213e5d){if(_0x2871c1['table']==='cdr'){_0x50f8d7[_0x0a9e('0x38')](_0x2871c1['table']+_0x0a9e('0x91'),_0x56d650['startDate'],_0x56d650[_0x0a9e('0x92')]);}else{_0x50f8d7['where'](_0x2871c1['table']+_0x0a9e('0x93'),_0x56d650[_0x0a9e('0x94')],_0x56d650['endDate']);}if(_0x213e5d){logger[_0x0a9e('0x95')](_0x0a9e('0x96'),_0x50f8d7[_0x0a9e('0x7f')]());require(_0x0a9e('0x97'))[_0x0a9e('0x98')](path['join'](__dirname,'../../components/export/',_0x213e5d[_0x0a9e('0x8a')]),[_0x213e5d['id'],_0x50f8d7[_0x0a9e('0x7f')](),path[_0x0a9e('0x50')](__dirname,_0x0a9e('0x99'),_0x213e5d[_0x0a9e('0x9a')]),_0x7ebea8]);return _0x213e5d;}else{var _0x576d3b=squel[_0x0a9e('0x6a')]();_0x576d3b[_0x0a9e('0x6b')]('('+_0x50f8d7['toString']()+')',_0x0a9e('0x9b'));_0x576d3b[_0x0a9e('0x62')](_0x0a9e('0x9c'),_0x0a9e('0x1c'));_0x50f8d7[_0x0a9e('0x1b')](_0x56d650[_0x0a9e('0x1b')]||_0x4c54fa);_0x50f8d7[_0x0a9e('0x1a')](_0x56d650[_0x0a9e('0x1a')]||0x0);return dbH[_0x0a9e('0x80')][_0x0a9e('0x2e')](_0x576d3b['toString'](),{'type':dbH[_0x0a9e('0x80')][_0x0a9e('0x9d')][_0x0a9e('0x81')]})[_0x0a9e('0x21')](function(_0x1d0b02){if(!_0x1d0b02['length']){_0x4566b0=0x0;}else{_0x4566b0=_0x1d0b02[0x0]['count']||0x0;}return dbH[_0x0a9e('0x80')][_0x0a9e('0x2e')](_0x50f8d7[_0x0a9e('0x7f')](),{'type':dbH[_0x0a9e('0x80')][_0x0a9e('0x9d')]['SELECT']});})[_0x0a9e('0x21')](function(_0x3c775a){return{'rows':_0x3c775a||[],'count':_0x4566b0};});}});}exports[_0x0a9e('0x9e')]=function(_0x52b661,_0x318fc3){return runReport(_0x52b661['params'],_0x52b661[_0x0a9e('0x2e')],_0x52b661['options'])[_0x0a9e('0x21')](respondWithResult(_0x318fc3,null))[_0x0a9e('0x44')](handleError(_0x318fc3,null));};exports[_0x0a9e('0x9f')]=runReport;exports['query']=function(_0xc9529d,_0x5ed560){var _0x4383da=0xa;var _0x2b1824=[_0x0a9e('0x50'),_0x0a9e('0x51'),_0x0a9e('0x52'),_0x0a9e('0x53')];var _0x4014c7={'SUM':_0x0a9e('0x54'),'COUNT':_0x0a9e('0x55'),'COUNT DISTINCT':_0x0a9e('0x56'),'MAX':_0x0a9e('0x82'),'MIN':_0x0a9e('0x57'),'AVG':_0x0a9e('0x58'),'GROUP_CONCAT':_0x0a9e('0x59'),'GROUP_CONCAT ASC':_0x0a9e('0x5a'),'GROUP_CONCAT DESC':_0x0a9e('0x5b')};var _0x5b93dd={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0a9e('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x0a9e('0x84'),'UNIX_TIMESTAMP':_0x0a9e('0x5e')};var _0x5d6b69=function(_0x1a3754){return!_[_0x0a9e('0x85')]([_0x0a9e('0x86'),_0x0a9e('0x87'),'IS\x20EMPTY',_0x0a9e('0xa0')],_0x1a3754);};var _0x26cb76=function(_0x374f0b){if(!_0x374f0b||!_0x374f0b[_0x0a9e('0x60')]['length']){return'';}for(var _0x19e9ed='(',_0x1a0b08=0x0;_0x1a0b08<_0x374f0b[_0x0a9e('0x60')]['length'];_0x1a0b08+=0x1){_0x1a0b08>0x0&&(_0x19e9ed+='\x20'+_0x374f0b[_0x0a9e('0xa1')]+'\x20');_0x19e9ed+=_0x374f0b[_0x0a9e('0x60')][_0x1a0b08][_0x0a9e('0x61')]?_0x26cb76(_0x374f0b['rules'][_0x1a0b08][_0x0a9e('0x61')]):_0x374f0b[_0x0a9e('0x60')][_0x1a0b08][_0x0a9e('0x62')]+'\x20'+_0x374f0b[_0x0a9e('0x60')][_0x1a0b08][_0x0a9e('0x63')]+(_0x5d6b69(_0x374f0b['rules'][_0x1a0b08][_0x0a9e('0x63')])?'\x20'+_0x374f0b[_0x0a9e('0x60')][_0x1a0b08]['value']:'');}return _0x19e9ed+')';};var _0x3bab3e={'where':{'id':_0xc9529d[_0x0a9e('0x46')]['id']}},_0x1fcfe6,_0x1f6f1c,_0x5822a7,_0x5c3b6f,_0x523d08;_0x3bab3e=_[_0x0a9e('0x3e')]({},_0x3bab3e,_0xc9529d['options']);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x3bab3e)[_0x0a9e('0x21')](function(_0x54ce11){if(_0x54ce11){_0x1fcfe6=_0x54ce11;return _0x54ce11[_0x0a9e('0x64')]();}return null;})[_0x0a9e('0x21')](function(_0x213d4e){if(_0x213d4e){if(!_0x213d4e[_0x0a9e('0x34')]){throw new db[(_0x0a9e('0x65'))][(_0x0a9e('0x66'))](_0x0a9e('0x67'),0x193);}_0x1f6f1c=_0x213d4e;return db[_0x0a9e('0x68')][_0x0a9e('0x42')]({'raw':!![]});}return null;})['then'](function(_0x43c397){if(_0x43c397){_0x5822a7=_['keyBy'](_0x43c397,'id');var _0x138cf5;var _0x4093e6=squel[_0x0a9e('0x6a')]();_0x4093e6[_0x0a9e('0x6b')](_0x1fcfe6[_0x0a9e('0x6c')]);for(var _0x344cd4=0x0;_0x344cd4<_0x1f6f1c['length'];_0x344cd4+=0x1){_0x138cf5=_0x1f6f1c[_0x344cd4][_0x0a9e('0x6d')]?_0x5822a7[_0x1f6f1c[_0x344cd4][_0x0a9e('0x6d')]][_0x0a9e('0x6e')]:_0x1f6f1c[_0x344cd4][_0x0a9e('0x62')];_0x138cf5=_0x1f6f1c[_0x344cd4]['function']?_[_0x0a9e('0x70')](_0x4014c7[_0x1f6f1c[_0x344cd4][_0x0a9e('0x6f')]],'%s',_0x138cf5):_0x138cf5;_0x138cf5=_0x1f6f1c[_0x344cd4][_0x0a9e('0x71')]?_[_0x0a9e('0x70')](_0x5b93dd[_0x1f6f1c[_0x344cd4][_0x0a9e('0x71')]],'%s',_0x138cf5):_0x138cf5;if(_0x1f6f1c[_0x344cd4][_0x0a9e('0x72')]){_0x4093e6[_0x0a9e('0x61')](_0x138cf5);}_0x1f6f1c[_0x344cd4][_0x0a9e('0x89')]&&_0x4093e6[_0x0a9e('0x36')](_0x138cf5,_0x1f6f1c[_0x344cd4][_0x0a9e('0x89')]==='DESC'?![]:!![]);_0x4093e6[_0x0a9e('0x62')](_0x138cf5,_0x1f6f1c[_0x344cd4][_0x0a9e('0x74')]||_0x138cf5);}if(_0x1fcfe6[_0x0a9e('0x75')]){_0x1fcfe6[_0x0a9e('0x75')]=JSON[_0x0a9e('0x76')](_0x1fcfe6[_0x0a9e('0x75')]);for(var _0x2895c5=0x0;_0x2895c5<_0x1fcfe6[_0x0a9e('0x75')]['length'];_0x2895c5+=0x1){if(_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x3c')]&&_[_0x0a9e('0x85')](_0x2b1824,_0x1fcfe6['joins'][_0x2895c5][_0x0a9e('0x3c')])&&_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x77')]&&_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x78')]&&_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x79')]){_0x4093e6[_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x3c')]](_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5]['foreignTable'],null,util[_0x0a9e('0x71')](_0x0a9e('0x7a'),_0x1fcfe6[_0x0a9e('0x6c')],_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5][_0x0a9e('0x77')],_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5]['foreignTable'],_0x1fcfe6[_0x0a9e('0x75')][_0x2895c5]['foreignKey']));}}}if(_0x1fcfe6['conditions']){_0x1fcfe6['conditions']=JSON[_0x0a9e('0x76')](_0x1fcfe6[_0x0a9e('0x7b')]);_0x4093e6[_0x0a9e('0x38')](_0x26cb76(_0x1fcfe6[_0x0a9e('0x7b')]['group']));}_0x523d08=_0x4093e6[_0x0a9e('0x7c')]();_0x4093e6[_0x0a9e('0x1b')](_0x4383da);_0x4093e6[_0x0a9e('0x1a')](0x0);logger[_0x0a9e('0x7d')](_0x0a9e('0x7e'),_0x4093e6['toString']());return dbH['sequelize'][_0x0a9e('0x2e')](_0x4093e6[_0x0a9e('0x7f')](),{'type':dbH[_0x0a9e('0x80')]['QueryTypes'][_0x0a9e('0x81')]});}})[_0x0a9e('0x21')](function(){return{'sql':_0x523d08[_0x0a9e('0x7f')]()};})['then'](respondWithResult(_0x5ed560,null))[_0x0a9e('0x44')](handleError(_0x5ed560,null));}; \ No newline at end of file +var _0xb10b=['offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','catch','params','keys','find','create','body','user','role','get','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','table','MetricId','metric','function','replace','format','orderBy','order','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','AVG(%s)','GROUP_CONCAT(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','value','getFields','from','groupBy','fullPath','%s-%s.%s','generate','output','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','select','findAll','debug','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','dbH','status','end','json'];(function(_0x16ff72,_0x3d7db1){var _0x2bc069=function(_0x4f1fed){while(--_0x4f1fed){_0x16ff72['push'](_0x16ff72['shift']());}};_0x2bc069(++_0x3d7db1);}(_0xb10b,0x12a));var _0xbb10=function(_0x74895e,_0x298c35){_0x74895e=_0x74895e-0x0;var _0x40bc2a=_0xb10b[_0x74895e];return _0x40bc2a;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];var dbH=require(_0xbb10('0x17'))[_0xbb10('0x18')];function respondWithStatusCode(_0x193a27,_0x442548){_0x442548=_0x442548||0xcc;return function(_0x147230){if(_0x147230){return _0x193a27['sendStatus'](_0x442548);}return _0x193a27[_0xbb10('0x19')](_0x442548)[_0xbb10('0x1a')]();};}function respondWithResult(_0x45b9d6,_0x17fd46){_0x17fd46=_0x17fd46||0xc8;return function(_0x3df17b){if(_0x3df17b){return _0x45b9d6[_0xbb10('0x19')](_0x17fd46)[_0xbb10('0x1b')](_0x3df17b);}};}function respondWithFilteredResult(_0x36b5e8,_0x3e26f4){return function(_0x2b184e){if(_0x2b184e){var _0x4a2bfc=typeof _0x3e26f4[_0xbb10('0x1c')]===_0xbb10('0x1d')&&typeof _0x3e26f4[_0xbb10('0x1e')]===_0xbb10('0x1d');var _0x378da8=_0x2b184e[_0xbb10('0x1f')];var _0x575cca=_0x4a2bfc?0x0:_0x3e26f4[_0xbb10('0x1c')];var _0xbf2906=_0x4a2bfc?_0x2b184e[_0xbb10('0x1f')]:_0x3e26f4['offset']+_0x3e26f4[_0xbb10('0x1e')];var _0x19f48d;if(_0xbf2906>=_0x378da8){_0xbf2906=_0x378da8;_0x19f48d=0xc8;}else{_0x19f48d=0xce;}_0x36b5e8[_0xbb10('0x19')](_0x19f48d);return _0x36b5e8[_0xbb10('0x20')](_0xbb10('0x21'),_0x575cca+'-'+_0xbf2906+'/'+_0x378da8)[_0xbb10('0x1b')](_0x2b184e);}return null;};}function patchUpdates(_0x4deb49){return function(_0x12f888){try{jsonpatch[_0xbb10('0x22')](_0x12f888,_0x4deb49,!![]);}catch(_0x50aea1){return BPromise['reject'](_0x50aea1);}return _0x12f888[_0xbb10('0x23')]();};}function saveUpdates(_0x311abe,_0x2e911d){return function(_0x317da4){if(_0x317da4){return _0x317da4[_0xbb10('0x24')](_0x311abe)[_0xbb10('0x25')](function(_0x407cb4){return _0x407cb4;});}return null;};}function removeEntity(_0x436104,_0x7f2377){return function(_0x395404){if(_0x395404){return _0x395404[_0xbb10('0x26')]()[_0xbb10('0x25')](function(){var _0x537898=_0x395404['get']({'plain':!![]});var _0x4fb5e0=_0xbb10('0x27');return db[_0xbb10('0x28')][_0xbb10('0x26')]({'where':{'type':_0x4fb5e0,'resourceId':_0x537898['id']}})['then'](function(){return _0x395404;});})[_0xbb10('0x25')](function(){_0x436104[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1d5e95,_0x1acce9){return function(_0x20d946){if(!_0x20d946){_0x1d5e95[_0xbb10('0x29')](0x194);}return _0x20d946;};}function handleError(_0x4aabb9,_0x3796c7){_0x3796c7=_0x3796c7||0x1f4;return function(_0x21ac54){logger[_0xbb10('0x2a')](_0x21ac54[_0xbb10('0x2b')]);if(_0x21ac54[_0xbb10('0x2c')]){delete _0x21ac54[_0xbb10('0x2c')];}_0x4aabb9['status'](_0x3796c7)[_0xbb10('0x2d')](_0x21ac54);};}exports['index']=function(_0x448d5c,_0x56f2da){var _0x16ad2a={},_0x1dcc9c={},_0x1b59f9={'count':0x0,'rows':[]};var _0x491db4=_['map'](db[_0xbb10('0x2e')][_0xbb10('0x2f')],function(_0x4f590d){return{'name':_0x4f590d[_0xbb10('0x30')],'type':_0x4f590d[_0xbb10('0x31')][_0xbb10('0x32')]};});_0x1dcc9c[_0xbb10('0x33')]=_[_0xbb10('0x34')](_0x491db4,_0xbb10('0x2c'));_0x1dcc9c[_0xbb10('0x35')]=_['keys'](_0x448d5c[_0xbb10('0x35')]);_0x1dcc9c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x1dcc9c[_0xbb10('0x33')],_0x1dcc9c[_0xbb10('0x35')]);_0x16ad2a[_0xbb10('0x38')]=_[_0xbb10('0x37')](_0x1dcc9c[_0xbb10('0x33')],qs[_0xbb10('0x39')](_0x448d5c['query'][_0xbb10('0x39')]));_0x16ad2a[_0xbb10('0x38')]=_0x16ad2a[_0xbb10('0x38')][_0xbb10('0x3a')]?_0x16ad2a['attributes']:_0x1dcc9c[_0xbb10('0x33')];if(!_0x448d5c['query']['hasOwnProperty'](_0xbb10('0x3b'))){_0x16ad2a[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x448d5c[_0xbb10('0x35')][_0xbb10('0x1e')]);_0x16ad2a[_0xbb10('0x1c')]=qs['offset'](_0x448d5c[_0xbb10('0x35')][_0xbb10('0x1c')]);}_0x16ad2a['order']=qs['sort'](_0x448d5c['query'][_0xbb10('0x3c')]);_0x16ad2a[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x448d5c[_0xbb10('0x35')],_0x1dcc9c[_0xbb10('0x36')]),_0x491db4);if(_0x448d5c[_0xbb10('0x35')]['filter']){_0x16ad2a[_0xbb10('0x3d')]=_[_0xbb10('0x3e')](_0x16ad2a[_0xbb10('0x3d')],{'$or':_[_0xbb10('0x34')](_0x491db4,function(_0x4f1cdd){if(_0x4f1cdd[_0xbb10('0x31')]!==_0xbb10('0x3f')){var _0x5835fd={};_0x5835fd[_0x4f1cdd[_0xbb10('0x2c')]]={'$like':'%'+_0x448d5c[_0xbb10('0x35')][_0xbb10('0x40')]+'%'};return _0x5835fd;}})});}_0x16ad2a=_[_0xbb10('0x3e')]({},_0x16ad2a,_0x448d5c[_0xbb10('0x41')]);var _0x185a52={'where':_0x16ad2a['where']};return db[_0xbb10('0x2e')][_0xbb10('0x1f')](_0x185a52)[_0xbb10('0x25')](function(_0x3d3c41){_0x1b59f9['count']=_0x3d3c41;if(_0x448d5c[_0xbb10('0x35')][_0xbb10('0x42')]){_0x16ad2a[_0xbb10('0x43')]=[{'all':!![]}];}return db[_0xbb10('0x2e')]['findAll'](_0x16ad2a);})[_0xbb10('0x25')](function(_0x202c60){_0x1b59f9['rows']=_0x202c60;return _0x1b59f9;})['then'](respondWithFilteredResult(_0x56f2da,_0x16ad2a))[_0xbb10('0x44')](handleError(_0x56f2da,null));};exports['show']=function(_0x318984,_0x180933){var _0x4c66d8={'raw':![],'where':{'id':_0x318984[_0xbb10('0x45')]['id']}},_0x366608={};_0x366608[_0xbb10('0x33')]=_['keys'](db[_0xbb10('0x2e')][_0xbb10('0x2f')]);_0x366608[_0xbb10('0x35')]=_[_0xbb10('0x46')](_0x318984[_0xbb10('0x35')]);_0x366608[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x366608[_0xbb10('0x33')],_0x366608[_0xbb10('0x35')]);_0x4c66d8[_0xbb10('0x38')]=_[_0xbb10('0x37')](_0x366608[_0xbb10('0x33')],qs['fields'](_0x318984[_0xbb10('0x35')][_0xbb10('0x39')]));_0x4c66d8['attributes']=_0x4c66d8[_0xbb10('0x38')][_0xbb10('0x3a')]?_0x4c66d8[_0xbb10('0x38')]:_0x366608[_0xbb10('0x33')];if(_0x318984[_0xbb10('0x35')][_0xbb10('0x42')]){_0x4c66d8[_0xbb10('0x43')]=[{'all':!![]}];}_0x4c66d8=_['merge']({},_0x4c66d8,_0x318984['options']);return db[_0xbb10('0x2e')][_0xbb10('0x47')](_0x4c66d8)[_0xbb10('0x25')](handleEntityNotFound(_0x180933,null))['then'](respondWithResult(_0x180933,null))['catch'](handleError(_0x180933,null));};exports[_0xbb10('0x48')]=function(_0x34cf4e,_0x1bd054){return db[_0xbb10('0x2e')][_0xbb10('0x48')](_0x34cf4e[_0xbb10('0x49')],{})[_0xbb10('0x25')](function(_0x460788){var _0x2626d8=_0x34cf4e[_0xbb10('0x4a')]['get']({'plain':!![]});if(!_0x2626d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2626d8[_0xbb10('0x4b')]===_0xbb10('0x4a')){var _0x36ab7d=_0x460788[_0xbb10('0x4c')]({'plain':!![]});var _0x36aa7d=_0xbb10('0x4d');return db[_0xbb10('0x4e')][_0xbb10('0x47')]({'where':{'name':_0x36aa7d,'userProfileId':_0x2626d8[_0xbb10('0x4f')]},'raw':!![]})[_0xbb10('0x25')](function(_0x19ca3e){if(_0x19ca3e&&_0x19ca3e[_0xbb10('0x50')]===0x0){return db[_0xbb10('0x28')][_0xbb10('0x48')]({'name':_0x36ab7d[_0xbb10('0x2c')],'resourceId':_0x36ab7d['id'],'type':'CustomReports','sectionId':_0x19ca3e['id']},{})[_0xbb10('0x25')](function(){return _0x460788;});}else{return _0x460788;}})['catch'](function(_0x33d60a){logger[_0xbb10('0x2a')](_0xbb10('0x51'),_0x33d60a);throw _0x33d60a;});}return _0x460788;})[_0xbb10('0x25')](respondWithResult(_0x1bd054,0xc9))[_0xbb10('0x44')](handleError(_0x1bd054,null));};exports[_0xbb10('0x24')]=function(_0x2e3326,_0x44eec1){if(_0x2e3326[_0xbb10('0x49')]['id']){delete _0x2e3326[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2e')][_0xbb10('0x47')]({'where':{'id':_0x2e3326[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x44eec1,null))[_0xbb10('0x25')](saveUpdates(_0x2e3326['body'],null))[_0xbb10('0x25')](respondWithResult(_0x44eec1,null))[_0xbb10('0x44')](handleError(_0x44eec1,null));};exports[_0xbb10('0x26')]=function(_0x4ce8e7,_0xbffa3c){return db[_0xbb10('0x2e')]['find']({'where':{'id':_0x4ce8e7[_0xbb10('0x45')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0xbffa3c,null))[_0xbb10('0x25')](removeEntity(_0xbffa3c,null))[_0xbb10('0x44')](handleError(_0xbffa3c,null));};exports[_0xbb10('0x52')]=function(_0x22de7f,_0x175872){var _0x12ec18=0xa;var _0x205e01=[_0xbb10('0x53'),_0xbb10('0x54'),_0xbb10('0x55'),_0xbb10('0x56')];var _0x4e7fac={'SUM':'SUM(%s)','COUNT':_0xbb10('0x57'),'COUNT DISTINCT':_0xbb10('0x58'),'MAX':_0xbb10('0x59'),'MIN':_0xbb10('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbb10('0x5b'),'GROUP_CONCAT DESC':_0xbb10('0x5c')};var _0x410bef={'SEC_TO_TIME':_0xbb10('0x5d'),'DATE':_0xbb10('0x5e'),'HOUR':_0xbb10('0x5f'),'ROUND':_0xbb10('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x117e84=function(_0x216cff){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xbb10('0x61'),_0xbb10('0x62')],_0x216cff);};var _0x155dc5=function(_0x5bd1c0){if(!_0x5bd1c0||!_0x5bd1c0['rules']['length']){return'';}for(var _0x3ebc5f='(',_0x249b33=0x0;_0x249b33<_0x5bd1c0[_0xbb10('0x63')]['length'];_0x249b33+=0x1){_0x249b33>0x0&&(_0x3ebc5f+='\x20'+_0x5bd1c0[_0xbb10('0x64')]+'\x20');_0x3ebc5f+=_0x5bd1c0[_0xbb10('0x63')][_0x249b33]['group']?_0x155dc5(_0x5bd1c0['rules'][_0x249b33][_0xbb10('0x65')]):_0x5bd1c0[_0xbb10('0x63')][_0x249b33][_0xbb10('0x66')]+'\x20'+_0x5bd1c0[_0xbb10('0x63')][_0x249b33]['condition']+(_0x117e84(_0x5bd1c0[_0xbb10('0x63')][_0x249b33][_0xbb10('0x67')])?'\x20'+_0x5bd1c0[_0xbb10('0x63')][_0x249b33]['value']:'');}return _0x3ebc5f+')';};var _0x402a01={'where':{'id':_0x22de7f[_0xbb10('0x45')]['id']}},_0x2f05bc,_0x3e3617,_0x5b2bd4,_0x2ca491,_0x31e85e;_0x402a01=_[_0xbb10('0x3e')]({},_0x402a01,_0x22de7f['options']);return db[_0xbb10('0x2e')][_0xbb10('0x47')](_0x402a01)[_0xbb10('0x25')](function(_0x2d0f4b){if(_0x2d0f4b){_0x2f05bc=_0x2d0f4b;return _0x2d0f4b['getFields']();}return null;})[_0xbb10('0x25')](function(_0x277fe7){if(_0x277fe7){if(!_0x277fe7[_0xbb10('0x3a')]){throw new db[(_0xbb10('0x68'))][(_0xbb10('0x69'))](_0xbb10('0x6a'),0x193);}_0x3e3617=_0x277fe7;return db[_0xbb10('0x6b')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x5acd5e){if(_0x5acd5e){_0x5b2bd4=_[_0xbb10('0x6c')](_0x5acd5e,'id');var _0x9c672d;var _0x3eda96=squel['select']();_0x3eda96['from'](_0x2f05bc[_0xbb10('0x6d')]);for(var _0x1b11c0=0x0;_0x1b11c0<_0x3e3617[_0xbb10('0x3a')];_0x1b11c0+=0x1){_0x9c672d=_0x3e3617[_0x1b11c0][_0xbb10('0x6e')]?_0x5b2bd4[_0x3e3617[_0x1b11c0][_0xbb10('0x6e')]][_0xbb10('0x6f')]:_0x3e3617[_0x1b11c0]['field'];_0x9c672d=_0x3e3617[_0x1b11c0][_0xbb10('0x70')]?_[_0xbb10('0x71')](_0x4e7fac[_0x3e3617[_0x1b11c0][_0xbb10('0x70')]],'%s',_0x9c672d):_0x9c672d;_0x9c672d=_0x3e3617[_0x1b11c0][_0xbb10('0x72')]?_[_0xbb10('0x71')](_0x410bef[_0x3e3617[_0x1b11c0]['format']],'%s',_0x9c672d):_0x9c672d;if(_0x3e3617[_0x1b11c0]['groupBy']){_0x3eda96['group'](_0x9c672d);}_0x3e3617[_0x1b11c0][_0xbb10('0x73')]&&_0x3eda96[_0xbb10('0x74')](_0x9c672d,_0x3e3617[_0x1b11c0][_0xbb10('0x73')]===_0xbb10('0x75')?![]:!![]);_0x3eda96[_0xbb10('0x66')](_0x9c672d,_0x3e3617[_0x1b11c0][_0xbb10('0x76')]||_0x9c672d);}if(_0x2f05bc['joins']){_0x2f05bc[_0xbb10('0x77')]=JSON['parse'](_0x2f05bc['joins']);for(var _0x519a54=0x0;_0x519a54<_0x2f05bc[_0xbb10('0x77')][_0xbb10('0x3a')];_0x519a54+=0x1){if(_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x31')]&&_['includes'](_0x205e01,_0x2f05bc[_0xbb10('0x77')][_0x519a54]['type'])&&_0x2f05bc['joins'][_0x519a54][_0xbb10('0x78')]&&_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x79')]&&_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x7a')]){_0x3eda96[_0x2f05bc['joins'][_0x519a54][_0xbb10('0x31')]](_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x79')],null,util[_0xbb10('0x72')](_0xbb10('0x7b'),_0x2f05bc[_0xbb10('0x6d')],_0x2f05bc[_0xbb10('0x77')][_0x519a54]['parentKey'],_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x79')],_0x2f05bc[_0xbb10('0x77')][_0x519a54][_0xbb10('0x7a')]));}}}if(_0x2f05bc[_0xbb10('0x7c')]){_0x2f05bc[_0xbb10('0x7c')]=JSON[_0xbb10('0x7d')](_0x2f05bc[_0xbb10('0x7c')]);_0x3eda96['where'](_0x155dc5(_0x2f05bc[_0xbb10('0x7c')][_0xbb10('0x65')]));}_0x31e85e=_0x3eda96[_0xbb10('0x7e')]();_0x3eda96['limit'](_0x12ec18);_0x3eda96['offset'](0x0);logger['debug'](_0xbb10('0x7f'),_0x3eda96['toString']());return dbH['sequelize'][_0xbb10('0x35')](_0x3eda96[_0xbb10('0x80')](),{'type':dbH[_0xbb10('0x81')][_0xbb10('0x82')][_0xbb10('0x83')]});}})[_0xbb10('0x25')](respondWithResult(_0x175872,null))[_0xbb10('0x44')](handleError(_0x175872,null));};function runReport(_0x417304,_0x188b97,_0x5206e1){var _0x318a14=_0x188b97[_0xbb10('0x2c')];var _0x46b6d2=0xa;var _0x35b811=['join','left_join',_0xbb10('0x55'),_0xbb10('0x56')];var _0x30f0a4={'SUM':_0xbb10('0x84'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbb10('0x58'),'MAX':_0xbb10('0x59'),'MIN':_0xbb10('0x5a'),'AVG':_0xbb10('0x85'),'GROUP_CONCAT':_0xbb10('0x86'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x372636={'SEC_TO_TIME':_0xbb10('0x5d'),'DATE':_0xbb10('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0xbb10('0x60'),'UNIX_TIMESTAMP':_0xbb10('0x87')};var _0x50bcc9=function(_0x5caa06){return!_[_0xbb10('0x88')]([_0xbb10('0x89'),_0xbb10('0x8a'),'IS\x20EMPTY',_0xbb10('0x62')],_0x5caa06);};var _0x3a17fc=function(_0xfbb365){if(!_0xfbb365||!_0xfbb365[_0xbb10('0x63')][_0xbb10('0x3a')]){return'';}for(var _0x5de006='(',_0x45bd4e=0x0;_0x45bd4e<_0xfbb365[_0xbb10('0x63')][_0xbb10('0x3a')];_0x45bd4e+=0x1){_0x45bd4e>0x0&&(_0x5de006+='\x20'+_0xfbb365['operator']+'\x20');_0x5de006+=_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x65')]?_0x3a17fc(_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x65')]):_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x66')]+'\x20'+_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x67')]+(_0x50bcc9(_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x67')])?'\x20'+_0xfbb365[_0xbb10('0x63')][_0x45bd4e][_0xbb10('0x8b')]:'');}return _0x5de006+')';};var _0x59e985={'where':{'id':_0x417304['id']}},_0x51f106,_0xe1fc51,_0x3fa344,_0x458615,_0x3fd367;_0x59e985=_[_0xbb10('0x3e')]({},_0x59e985,_0x5206e1);return db['AnalyticCustomReport'][_0xbb10('0x47')](_0x59e985)[_0xbb10('0x25')](function(_0x3b4d0b){if(_0x3b4d0b){_0x51f106=_0x3b4d0b;return _0x3b4d0b[_0xbb10('0x8c')]();}return null;})[_0xbb10('0x25')](function(_0x379d49){if(_0x379d49){if(!_0x379d49['length']){throw new db[(_0xbb10('0x68'))][(_0xbb10('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xe1fc51=_0x379d49;return db[_0xbb10('0x6b')]['findAll']({'raw':!![]});}return null;})[_0xbb10('0x25')](function(_0x28bd76){if(_0x28bd76){_0x3fa344=_[_0xbb10('0x6c')](_0x28bd76,'id');var _0xa99bf5;var _0x3a4a6e=squel['select']();_0x3a4a6e[_0xbb10('0x8d')](_0x51f106['table']);for(var _0x3fcc55=0x0;_0x3fcc55<_0xe1fc51[_0xbb10('0x3a')];_0x3fcc55+=0x1){_0xa99bf5=_0xe1fc51[_0x3fcc55]['MetricId']?_0x3fa344[_0xe1fc51[_0x3fcc55]['MetricId']][_0xbb10('0x6f')]:_0xe1fc51[_0x3fcc55][_0xbb10('0x66')];_0xa99bf5=_0xe1fc51[_0x3fcc55][_0xbb10('0x70')]?_[_0xbb10('0x71')](_0x30f0a4[_0xe1fc51[_0x3fcc55][_0xbb10('0x70')]],'%s',_0xa99bf5):_0xa99bf5;_0xa99bf5=_0xe1fc51[_0x3fcc55][_0xbb10('0x72')]?_[_0xbb10('0x71')](_0x372636[_0xe1fc51[_0x3fcc55][_0xbb10('0x72')]],'%s',_0xa99bf5):_0xa99bf5;if(_0xe1fc51[_0x3fcc55][_0xbb10('0x8e')]){_0x3a4a6e[_0xbb10('0x65')](_0xa99bf5);}_0xe1fc51[_0x3fcc55][_0xbb10('0x73')]&&_0x3a4a6e['order'](_0xa99bf5,_0xe1fc51[_0x3fcc55][_0xbb10('0x73')]===_0xbb10('0x75')?![]:!![]);_0x3a4a6e[_0xbb10('0x66')](_0xa99bf5,_0xe1fc51[_0x3fcc55][_0xbb10('0x76')]||_0xa99bf5);}if(_0x51f106[_0xbb10('0x77')]){_0x51f106[_0xbb10('0x77')]=JSON[_0xbb10('0x7d')](_0x51f106[_0xbb10('0x77')]);for(var _0x3e6fe2=0x0;_0x3e6fe2<_0x51f106[_0xbb10('0x77')][_0xbb10('0x3a')];_0x3e6fe2+=0x1){if(_0x51f106[_0xbb10('0x77')][_0x3e6fe2]['type']&&_[_0xbb10('0x88')](_0x35b811,_0x51f106['joins'][_0x3e6fe2][_0xbb10('0x31')])&&_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x78')]&&_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x79')]&&_0x51f106['joins'][_0x3e6fe2][_0xbb10('0x7a')]){_0x3a4a6e[_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x31')]](_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x79')],null,util[_0xbb10('0x72')]('%s.%s\x20=\x20%s.%s',_0x51f106['table'],_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x78')],_0x51f106[_0xbb10('0x77')][_0x3e6fe2]['foreignTable'],_0x51f106[_0xbb10('0x77')][_0x3e6fe2][_0xbb10('0x7a')]));}}}if(_0x51f106['conditions']){_0x51f106[_0xbb10('0x7c')]=JSON[_0xbb10('0x7d')](_0x51f106['conditions']);_0x3a4a6e[_0xbb10('0x3d')](_0x3a17fc(_0x51f106['conditions'][_0xbb10('0x65')]));}_0x3fd367=_0x3a4a6e[_0xbb10('0x7e')]();_0x3a4a6e['limit'](_0x46b6d2);_0x3a4a6e[_0xbb10('0x1c')](0x0);return;}})[_0xbb10('0x25')](function(){if(_0x188b97['output']==='web'){return null;}var _0xea6bf2=_[_0xbb10('0x3e')](_0x188b97,{'name':_0x188b97[_0xbb10('0x8f')]||_0x188b97[_0xbb10('0x2c')]||_0x51f106[_0xbb10('0x2c')],'basename':_0x318a14,'savename':util['format'](_0xbb10('0x90'),_0x188b97[_0xbb10('0x2c')]||_0x51f106[_0xbb10('0x2c')],require('randomstring')[_0xbb10('0x91')](0x4),_0x188b97[_0xbb10('0x92')]||_0xbb10('0x93')),'reportId':_0x51f106['id'],'reportType':_0xbb10('0x94')});return db[_0xbb10('0x95')][_0xbb10('0x48')](_0xea6bf2,{'raw':!![]});})[_0xbb10('0x25')](function(_0x189f07){if(_0x51f106[_0xbb10('0x6d')]==='cdr'){_0x3fd367['where'](_0x51f106[_0xbb10('0x6d')]+_0xbb10('0x96'),_0x188b97[_0xbb10('0x97')],_0x188b97[_0xbb10('0x98')]);}else{_0x3fd367[_0xbb10('0x3d')](_0x51f106[_0xbb10('0x6d')]+_0xbb10('0x99'),_0x188b97[_0xbb10('0x97')],_0x188b97[_0xbb10('0x98')]);}if(_0x189f07){logger[_0xbb10('0x9a')](_0xbb10('0x9b'),_0x3fd367[_0xbb10('0x80')]());require(_0xbb10('0x9c'))['fork'](path[_0xbb10('0x53')](__dirname,_0xbb10('0x9d'),_0x189f07[_0xbb10('0x92')]),[_0x189f07['id'],_0x3fd367[_0xbb10('0x80')](),path[_0xbb10('0x53')](__dirname,_0xbb10('0x9e'),_0x189f07[_0xbb10('0x9f')]),_0x318a14]);return _0x189f07;}else{var _0x1421e2=squel[_0xbb10('0xa0')]();_0x1421e2[_0xbb10('0x8d')]('('+_0x3fd367[_0xbb10('0x80')]()+')','countTable');_0x1421e2[_0xbb10('0x66')]('COUNT(*)',_0xbb10('0x1f'));_0x3fd367[_0xbb10('0x1e')](_0x188b97[_0xbb10('0x1e')]||_0x46b6d2);_0x3fd367[_0xbb10('0x1c')](_0x188b97[_0xbb10('0x1c')]||0x0);return dbH[_0xbb10('0x81')]['query'](_0x1421e2[_0xbb10('0x80')](),{'type':dbH['sequelize'][_0xbb10('0x82')][_0xbb10('0x83')]})[_0xbb10('0x25')](function(_0x576bb6){if(!_0x576bb6[_0xbb10('0x3a')]){_0x458615=0x0;}else{_0x458615=_0x576bb6[0x0][_0xbb10('0x1f')]||0x0;}return dbH[_0xbb10('0x81')][_0xbb10('0x35')](_0x3fd367[_0xbb10('0x80')](),{'type':dbH[_0xbb10('0x81')][_0xbb10('0x82')][_0xbb10('0x83')]});})['then'](function(_0x3696b3){return{'rows':_0x3696b3||[],'count':_0x458615};});}});}exports['run']=function(_0xe70161,_0x36e9b0){return runReport(_0xe70161[_0xbb10('0x45')],_0xe70161[_0xbb10('0x35')],_0xe70161[_0xbb10('0x41')])[_0xbb10('0x25')](respondWithResult(_0x36e9b0,null))[_0xbb10('0x44')](handleError(_0x36e9b0,null));};exports['runReport']=runReport;exports[_0xbb10('0x35')]=function(_0x5ca9a0,_0x51063a){var _0x1513e0=0xa;var _0x35cbb9=[_0xbb10('0x53'),_0xbb10('0x54'),_0xbb10('0x55'),_0xbb10('0x56')];var _0x5d1077={'SUM':_0xbb10('0x84'),'COUNT':_0xbb10('0x57'),'COUNT DISTINCT':_0xbb10('0x58'),'MAX':_0xbb10('0x59'),'MIN':_0xbb10('0x5a'),'AVG':_0xbb10('0x85'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbb10('0x5b'),'GROUP_CONCAT DESC':_0xbb10('0x5c')};var _0xb7c454={'SEC_TO_TIME':_0xbb10('0x5d'),'DATE':_0xbb10('0x5e'),'HOUR':_0xbb10('0x5f'),'ROUND':_0xbb10('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x33a43e=function(_0x5e4ae9){return!_[_0xbb10('0x88')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xbb10('0x61'),_0xbb10('0x62')],_0x5e4ae9);};var _0x24edcb=function(_0x3b7552){if(!_0x3b7552||!_0x3b7552[_0xbb10('0x63')]['length']){return'';}for(var _0xa42b80='(',_0x565ddf=0x0;_0x565ddf<_0x3b7552['rules']['length'];_0x565ddf+=0x1){_0x565ddf>0x0&&(_0xa42b80+='\x20'+_0x3b7552[_0xbb10('0x64')]+'\x20');_0xa42b80+=_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x65')]?_0x24edcb(_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x65')]):_0x3b7552['rules'][_0x565ddf][_0xbb10('0x66')]+'\x20'+_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x67')]+(_0x33a43e(_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x67')])?'\x20'+_0x3b7552[_0xbb10('0x63')][_0x565ddf][_0xbb10('0x8b')]:'');}return _0xa42b80+')';};var _0x485c1a={'where':{'id':_0x5ca9a0[_0xbb10('0x45')]['id']}},_0x4c95c2,_0x584a62,_0x386eac,_0x1581ef,_0x2ae3c6;_0x485c1a=_[_0xbb10('0x3e')]({},_0x485c1a,_0x5ca9a0[_0xbb10('0x41')]);return db[_0xbb10('0x2e')][_0xbb10('0x47')](_0x485c1a)[_0xbb10('0x25')](function(_0x3b1131){if(_0x3b1131){_0x4c95c2=_0x3b1131;return _0x3b1131['getFields']();}return null;})['then'](function(_0x4dce53){if(_0x4dce53){if(!_0x4dce53[_0xbb10('0x3a')]){throw new db[(_0xbb10('0x68'))][(_0xbb10('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x584a62=_0x4dce53;return db[_0xbb10('0x6b')][_0xbb10('0xa1')]({'raw':!![]});}return null;})[_0xbb10('0x25')](function(_0x290280){if(_0x290280){_0x386eac=_[_0xbb10('0x6c')](_0x290280,'id');var _0x11279d;var _0x485f46=squel['select']();_0x485f46[_0xbb10('0x8d')](_0x4c95c2['table']);for(var _0x370215=0x0;_0x370215<_0x584a62[_0xbb10('0x3a')];_0x370215+=0x1){_0x11279d=_0x584a62[_0x370215][_0xbb10('0x6e')]?_0x386eac[_0x584a62[_0x370215][_0xbb10('0x6e')]][_0xbb10('0x6f')]:_0x584a62[_0x370215][_0xbb10('0x66')];_0x11279d=_0x584a62[_0x370215][_0xbb10('0x70')]?_[_0xbb10('0x71')](_0x5d1077[_0x584a62[_0x370215][_0xbb10('0x70')]],'%s',_0x11279d):_0x11279d;_0x11279d=_0x584a62[_0x370215][_0xbb10('0x72')]?_['replace'](_0xb7c454[_0x584a62[_0x370215][_0xbb10('0x72')]],'%s',_0x11279d):_0x11279d;if(_0x584a62[_0x370215]['groupBy']){_0x485f46[_0xbb10('0x65')](_0x11279d);}_0x584a62[_0x370215]['orderBy']&&_0x485f46[_0xbb10('0x74')](_0x11279d,_0x584a62[_0x370215][_0xbb10('0x73')]===_0xbb10('0x75')?![]:!![]);_0x485f46[_0xbb10('0x66')](_0x11279d,_0x584a62[_0x370215]['alias']||_0x11279d);}if(_0x4c95c2[_0xbb10('0x77')]){_0x4c95c2['joins']=JSON[_0xbb10('0x7d')](_0x4c95c2[_0xbb10('0x77')]);for(var _0xcdaf04=0x0;_0xcdaf04<_0x4c95c2['joins'][_0xbb10('0x3a')];_0xcdaf04+=0x1){if(_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x31')]&&_[_0xbb10('0x88')](_0x35cbb9,_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x31')])&&_0x4c95c2['joins'][_0xcdaf04]['parentKey']&&_0x4c95c2['joins'][_0xcdaf04][_0xbb10('0x79')]&&_0x4c95c2['joins'][_0xcdaf04][_0xbb10('0x7a')]){_0x485f46[_0x4c95c2['joins'][_0xcdaf04][_0xbb10('0x31')]](_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x79')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x4c95c2[_0xbb10('0x6d')],_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x78')],_0x4c95c2['joins'][_0xcdaf04][_0xbb10('0x79')],_0x4c95c2[_0xbb10('0x77')][_0xcdaf04][_0xbb10('0x7a')]));}}}if(_0x4c95c2['conditions']){_0x4c95c2['conditions']=JSON['parse'](_0x4c95c2[_0xbb10('0x7c')]);_0x485f46['where'](_0x24edcb(_0x4c95c2[_0xbb10('0x7c')][_0xbb10('0x65')]));}_0x2ae3c6=_0x485f46[_0xbb10('0x7e')]();_0x485f46[_0xbb10('0x1e')](_0x1513e0);_0x485f46[_0xbb10('0x1c')](0x0);logger[_0xbb10('0xa2')](_0xbb10('0x7f'),_0x485f46[_0xbb10('0x80')]());return dbH[_0xbb10('0x81')][_0xbb10('0x35')](_0x485f46[_0xbb10('0x80')](),{'type':dbH['sequelize'][_0xbb10('0x82')][_0xbb10('0x83')]});}})['then'](function(){return{'sql':_0x2ae3c6[_0xbb10('0x80')]()};})['then'](respondWithResult(_0x51063a,null))['catch'](handleError(_0x51063a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 3a0819b..5e94700 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 _0xf111=['analytics_custom_reports','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport'];(function(_0x1eb786,_0x1b5f72){var _0x460cad=function(_0x3ec7a6){while(--_0x3ec7a6){_0x1eb786['push'](_0x1eb786['shift']());}};_0x460cad(++_0x1b5f72);}(_0xf111,0x198));var _0x1f11=function(_0x4884a7,_0x18e38a){_0x4884a7=_0x4884a7-0x0;var _0x56b60e=_0xf111[_0x4884a7];return _0x56b60e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1f11('0x0'));var moment=require(_0x1f11('0x1'));var BPromise=require(_0x1f11('0x2'));var rp=require(_0x1f11('0x3'));var fs=require('fs');var path=require(_0x1f11('0x4'));var rimraf=require(_0x1f11('0x5'));var config=require(_0x1f11('0x6'));var attributes=require(_0x1f11('0x7'));module['exports']=function(_0x3ed26b,_0x3a1906){return _0x3ed26b[_0x1f11('0x8')](_0x1f11('0x9'),attributes,{'tableName':_0x1f11('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4e6=['request-promise','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','../../config/logger','bluebird'];(function(_0x3feab5,_0x1849cb){var _0x4fb9e9=function(_0x3eab6b){while(--_0x3eab6b){_0x3feab5['push'](_0x3feab5['shift']());}};_0x4fb9e9(++_0x1849cb);}(_0xe4e6,0x198));var _0x6e4e=function(_0x46c774,_0x449646){_0x46c774=_0x46c774-0x0;var _0x5d913f=_0xe4e6[_0x46c774];return _0x5d913f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6e4e('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6e4e('0x1'));var rp=require(_0x6e4e('0x2'));var fs=require('fs');var path=require(_0x6e4e('0x3'));var rimraf=require(_0x6e4e('0x4'));var config=require('../../config/environment');var attributes=require(_0x6e4e('0x5'));module[_0x6e4e('0x6')]=function(_0x42a943,_0x58e0ba){return _0x42a943[_0x6e4e('0x7')](_0x6e4e('0x8'),attributes,{'tableName':_0x6e4e('0x9'),'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 b63ca7b..c80aca0 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 _0xd195=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','lodash','util','moment','bluebird'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xd195,0xba));var _0x5d19=function(_0x31f04c,_0x3790be){_0x31f04c=_0x31f04c-0x0;var _0x119088=_0xd195[_0x31f04c];return _0x119088;};'use strict';var _=require(_0x5d19('0x0'));var util=require(_0x5d19('0x1'));var moment=require(_0x5d19('0x2'));var BPromise=require(_0x5d19('0x3'));var rs=require(_0x5d19('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d19('0x5'))['db'];var utils=require(_0x5d19('0x6'));var logger=require('../../config/logger')(_0x5d19('0x7'));var config=require(_0x5d19('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5d19('0x9')][_0x5d19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5da5e6,_0x2ef3c1,_0x544693){return new BPromise(function(_0x381628,_0xe75ed5){return client['request'](_0x5da5e6,_0x544693)[_0x5d19('0xb')](function(_0x2581d7){logger[_0x5d19('0xc')](_0x5d19('0xd'),_0x2ef3c1,'request\x20sent');logger[_0x5d19('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x2ef3c1,_0x5d19('0xf'),JSON['stringify'](_0x2581d7));if(_0x2581d7['error']){if(_0x2581d7[_0x5d19('0x10')][_0x5d19('0x11')]===0x1f4){logger[_0x5d19('0x10')](_0x5d19('0xd'),_0x2ef3c1,_0x2581d7['error'][_0x5d19('0x12')]);return _0xe75ed5(_0x2581d7['error'][_0x5d19('0x12')]);}logger[_0x5d19('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2ef3c1,_0x2581d7[_0x5d19('0x10')]['message']);return _0x381628(_0x2581d7[_0x5d19('0x10')][_0x5d19('0x12')]);}else{logger[_0x5d19('0xc')](_0x5d19('0xd'),_0x2ef3c1,_0x5d19('0xf'));_0x381628(_0x2581d7['result'][_0x5d19('0x12')]);}})['catch'](function(_0x2ce4d7){logger['error'](_0x5d19('0xd'),_0x2ef3c1,_0x2ce4d7);_0xe75ed5(_0x2ce4d7);});});} \ No newline at end of file +var _0x3691=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x44a4ae,_0x358f4c){var _0x5f0c1e=function(_0x2a5749){while(--_0x2a5749){_0x44a4ae['push'](_0x44a4ae['shift']());}};_0x5f0c1e(++_0x358f4c);}(_0x3691,0x112));var _0x1369=function(_0x444174,_0x1d59c9){_0x444174=_0x444174-0x0;var _0x31459c=_0x3691[_0x444174];return _0x31459c;};'use strict';var _=require(_0x1369('0x0'));var util=require(_0x1369('0x1'));var moment=require(_0x1369('0x2'));var BPromise=require(_0x1369('0x3'));var rs=require(_0x1369('0x4'));var fs=require('fs');var Redis=require(_0x1369('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1369('0x6'));var logger=require('../../config/logger')(_0x1369('0x7'));var config=require(_0x1369('0x8'));var jayson=require(_0x1369('0x9'));var client=jayson[_0x1369('0xa')][_0x1369('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x105651,_0x5b4917,_0x5aea5a){return new BPromise(function(_0x18c101,_0x3c417e){return client['request'](_0x105651,_0x5aea5a)[_0x1369('0xc')](function(_0x232e71){logger['info'](_0x1369('0xd'),_0x5b4917,_0x1369('0xe'));logger[_0x1369('0xf')](_0x1369('0x10'),_0x5b4917,_0x1369('0xe'),JSON['stringify'](_0x232e71));if(_0x232e71[_0x1369('0x11')]){if(_0x232e71[_0x1369('0x11')][_0x1369('0x12')]===0x1f4){logger[_0x1369('0x11')](_0x1369('0xd'),_0x5b4917,_0x232e71['error'][_0x1369('0x13')]);return _0x3c417e(_0x232e71[_0x1369('0x11')][_0x1369('0x13')]);}logger[_0x1369('0x11')](_0x1369('0xd'),_0x5b4917,_0x232e71['error'][_0x1369('0x13')]);return _0x18c101(_0x232e71[_0x1369('0x11')][_0x1369('0x13')]);}else{logger['info'](_0x1369('0xd'),_0x5b4917,_0x1369('0xe'));_0x18c101(_0x232e71[_0x1369('0x14')]['message']);}})['catch'](function(_0x276188){logger[_0x1369('0x11')](_0x1369('0xd'),_0x5b4917,_0x276188);_0x3c417e(_0x276188);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 10f8b1f..7d3084d 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 _0xda16=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','post','create','put','update','exports','multer','util'];(function(_0x3cfdd9,_0x49c46f){var _0x53704c=function(_0x5e41a4){while(--_0x5e41a4){_0x3cfdd9['push'](_0x3cfdd9['shift']());}};_0x53704c(++_0x49c46f);}(_0xda16,0x17e));var _0x6da1=function(_0x3b57d2,_0x440aa9){_0x3b57d2=_0x3b57d2-0x0;var _0x5a133f=_0xda16[_0x3b57d2];return _0x5a133f;};'use strict';var multer=require(_0x6da1('0x0'));var util=require(_0x6da1('0x1'));var path=require(_0x6da1('0x2'));var timeout=require(_0x6da1('0x3'));var express=require('express');var router=express[_0x6da1('0x4')]();var fs_extra=require(_0x6da1('0x5'));var auth=require(_0x6da1('0x6'));var interaction=require(_0x6da1('0x7'));var config=require(_0x6da1('0x8'));var controller=require(_0x6da1('0x9'));router[_0x6da1('0xa')]('/',auth[_0x6da1('0xb')](),controller[_0x6da1('0xc')]);router[_0x6da1('0xa')](_0x6da1('0xd'),auth['isAuthenticated'](),controller[_0x6da1('0xe')]);router['get']('/:id/preview',auth[_0x6da1('0xb')](),controller[_0x6da1('0xf')]);router[_0x6da1('0xa')](_0x6da1('0x10'),auth[_0x6da1('0xb')](),controller[_0x6da1('0x11')]);router[_0x6da1('0xa')](_0x6da1('0x12'),auth[_0x6da1('0xb')](),controller['query']);router[_0x6da1('0x13')]('/',auth[_0x6da1('0xb')](),controller[_0x6da1('0x14')]);router[_0x6da1('0x15')]('/:id',auth[_0x6da1('0xb')](),controller[_0x6da1('0x16')]);router['delete'](_0x6da1('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x6da1('0x17')]=router; \ No newline at end of file +var _0xbcf8=['get','/:id','/:id/preview','isAuthenticated','preview','/:id/run','/:id/query','query','post','put','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x271e26,_0xeaa798){var _0x4c3771=function(_0x594c71){while(--_0x594c71){_0x271e26['push'](_0x271e26['shift']());}};_0x4c3771(++_0xeaa798);}(_0xbcf8,0x15d));var _0x8bcf=function(_0x945fcc,_0x1ac49e){_0x945fcc=_0x945fcc-0x0;var _0x424229=_0xbcf8[_0x945fcc];return _0x424229;};'use strict';var multer=require(_0x8bcf('0x0'));var util=require('util');var path=require(_0x8bcf('0x1'));var timeout=require('connect-timeout');var express=require(_0x8bcf('0x2'));var router=express[_0x8bcf('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8bcf('0x4'));var interaction=require(_0x8bcf('0x5'));var config=require(_0x8bcf('0x6'));var controller=require(_0x8bcf('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8bcf('0x8')](_0x8bcf('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x8bcf('0x8')](_0x8bcf('0xa'),auth[_0x8bcf('0xb')](),controller[_0x8bcf('0xc')]);router[_0x8bcf('0x8')](_0x8bcf('0xd'),auth[_0x8bcf('0xb')](),controller['run']);router['get'](_0x8bcf('0xe'),auth[_0x8bcf('0xb')](),controller[_0x8bcf('0xf')]);router[_0x8bcf('0x10')]('/',auth[_0x8bcf('0xb')](),controller['create']);router[_0x8bcf('0x11')](_0x8bcf('0x9'),auth[_0x8bcf('0xb')](),controller[_0x8bcf('0x12')]);router['delete']('/:id',auth[_0x8bcf('0xb')](),controller[_0x8bcf('0x13')]);module[_0x8bcf('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index f4f4246..4d470f6 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 _0x9446=['STRING','TEXT','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9446,0x14a));var _0x6944=function(_0x18490f,_0x39ebd6){_0x18490f=_0x18490f-0x0;var _0x313e21=_0x9446[_0x18490f];return _0x313e21;};'use strict';var Sequelize=require(_0x6944('0x0'));module[_0x6944('0x1')]={'name':{'type':Sequelize[_0x6944('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x6944('0x2')]},'table':{'type':Sequelize[_0x6944('0x2')]},'conditions':{'type':Sequelize[_0x6944('0x3')]},'joins':{'type':Sequelize[_0x6944('0x3')]}}; \ No newline at end of file +var _0x3d58=['exports','STRING','TEXT'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3d58,0x102));var _0x83d5=function(_0x16de01,_0x3fd09a){_0x16de01=_0x16de01-0x0;var _0x35d238=_0x3d58[_0x16de01];return _0x35d238;};'use strict';var Sequelize=require('sequelize');module[_0x83d5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x83d5('0x1')]},'parent':{'type':Sequelize[_0x83d5('0x1')]},'table':{'type':Sequelize[_0x83d5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x83d5('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index c068b26..e554ce4 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 _0x34ae=['error','stack','name','map','AnalyticDefaultReport','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','field','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parse','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','SEC_TO_TIME(%s)','DATE(%s)','IS\x20NOT\x20NULL','getFields','Sequelize','findAll','select','from','parentKey','output','web','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','runReport','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','status','end','json','limit','undefined','offset','set','apply','update','then','get','DefaultReports','destroy','sendStatus'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x34ae,0x1c6));var _0xe34a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34ae[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe34a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe34a('0x1'));var rp=require('request-promise');var moment=require(_0xe34a('0x2'));var BPromise=require(_0xe34a('0x3'));var Mustache=require(_0xe34a('0x4'));var util=require(_0xe34a('0x5'));var path=require(_0xe34a('0x6'));var sox=require(_0xe34a('0x7'));var csv=require(_0xe34a('0x8'));var ejs=require(_0xe34a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe34a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe34a('0xb'));var deskjs=require(_0xe34a('0xc'));var toCsv=require(_0xe34a('0x8'));var querystring=require(_0xe34a('0xd'));var Papa=require(_0xe34a('0xe'));var Redis=require(_0xe34a('0xf'));var authService=require(_0xe34a('0x10'));var qs=require(_0xe34a('0x11'));var as=require(_0xe34a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe34a('0x13'))(_0xe34a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe34a('0x15'));var db=require(_0xe34a('0x16'))['db'];var dbH=require(_0xe34a('0x16'))[_0xe34a('0x17')];function respondWithStatusCode(_0xbc5964,_0x77b1fb){_0x77b1fb=_0x77b1fb||0xcc;return function(_0x5d9e4b){if(_0x5d9e4b){return _0xbc5964['sendStatus'](_0x77b1fb);}return _0xbc5964[_0xe34a('0x18')](_0x77b1fb)[_0xe34a('0x19')]();};}function respondWithResult(_0x1f6a16,_0x203098){_0x203098=_0x203098||0xc8;return function(_0x561a73){if(_0x561a73){return _0x1f6a16[_0xe34a('0x18')](_0x203098)[_0xe34a('0x1a')](_0x561a73);}};}function respondWithFilteredResult(_0x5b8c47,_0x130495){return function(_0x32de7d){if(_0x32de7d){var _0x1c7bed=typeof _0x130495['offset']==='undefined'&&typeof _0x130495[_0xe34a('0x1b')]===_0xe34a('0x1c');var _0x2c2096=_0x32de7d['count'];var _0x4d3e38=_0x1c7bed?0x0:_0x130495[_0xe34a('0x1d')];var _0x5616cf=_0x1c7bed?_0x32de7d['count']:_0x130495['offset']+_0x130495[_0xe34a('0x1b')];var _0x102364;if(_0x5616cf>=_0x2c2096){_0x5616cf=_0x2c2096;_0x102364=0xc8;}else{_0x102364=0xce;}_0x5b8c47['status'](_0x102364);return _0x5b8c47[_0xe34a('0x1e')]('Content-Range',_0x4d3e38+'-'+_0x5616cf+'/'+_0x2c2096)[_0xe34a('0x1a')](_0x32de7d);}return null;};}function patchUpdates(_0x1c062d){return function(_0x50d326){try{jsonpatch[_0xe34a('0x1f')](_0x50d326,_0x1c062d,!![]);}catch(_0x31d452){return BPromise['reject'](_0x31d452);}return _0x50d326['save']();};}function saveUpdates(_0x241793,_0x53b586){return function(_0x3c0e24){if(_0x3c0e24){return _0x3c0e24[_0xe34a('0x20')](_0x241793)[_0xe34a('0x21')](function(_0x48b7ac){return _0x48b7ac;});}return null;};}function removeEntity(_0x14bbae,_0x33cb9f){return function(_0x24464f){if(_0x24464f){return _0x24464f['destroy']()['then'](function(){var _0x288ef5=_0x24464f[_0xe34a('0x22')]({'plain':!![]});var _0x4caf53=_0xe34a('0x23');return db['UserProfileResource'][_0xe34a('0x24')]({'where':{'type':_0x4caf53,'resourceId':_0x288ef5['id']}})[_0xe34a('0x21')](function(){return _0x24464f;});})[_0xe34a('0x21')](function(){_0x14bbae['status'](0xcc)[_0xe34a('0x19')]();});}};}function handleEntityNotFound(_0x167ec4,_0x4e71a6){return function(_0xea3320){if(!_0xea3320){_0x167ec4[_0xe34a('0x25')](0x194);}return _0xea3320;};}function handleError(_0x35fd92,_0x426289){_0x426289=_0x426289||0x1f4;return function(_0x285e67){logger[_0xe34a('0x26')](_0x285e67[_0xe34a('0x27')]);if(_0x285e67[_0xe34a('0x28')]){delete _0x285e67['name'];}_0x35fd92[_0xe34a('0x18')](_0x426289)['send'](_0x285e67);};}exports['index']=function(_0x3f4896,_0xb00bc5){var _0x53fe9a={},_0x290fed={},_0x2fff8b={'count':0x0,'rows':[]};var _0x5cb345=_[_0xe34a('0x29')](db[_0xe34a('0x2a')]['rawAttributes'],function(_0x24bf20){return{'name':_0x24bf20['fieldName'],'type':_0x24bf20['type']['key']};});_0x290fed['model']=_['map'](_0x5cb345,_0xe34a('0x28'));_0x290fed[_0xe34a('0x2b')]=_['keys'](_0x3f4896['query']);_0x290fed[_0xe34a('0x2c')]=_['intersection'](_0x290fed[_0xe34a('0x2d')],_0x290fed[_0xe34a('0x2b')]);_0x53fe9a[_0xe34a('0x2e')]=_[_0xe34a('0x2f')](_0x290fed[_0xe34a('0x2d')],qs[_0xe34a('0x30')](_0x3f4896[_0xe34a('0x2b')][_0xe34a('0x30')]));_0x53fe9a['attributes']=_0x53fe9a[_0xe34a('0x2e')][_0xe34a('0x31')]?_0x53fe9a[_0xe34a('0x2e')]:_0x290fed[_0xe34a('0x2d')];if(!_0x3f4896[_0xe34a('0x2b')][_0xe34a('0x32')](_0xe34a('0x33'))){_0x53fe9a[_0xe34a('0x1b')]=qs[_0xe34a('0x1b')](_0x3f4896[_0xe34a('0x2b')][_0xe34a('0x1b')]);_0x53fe9a[_0xe34a('0x1d')]=qs[_0xe34a('0x1d')](_0x3f4896[_0xe34a('0x2b')][_0xe34a('0x1d')]);}_0x53fe9a[_0xe34a('0x34')]=qs[_0xe34a('0x35')](_0x3f4896[_0xe34a('0x2b')][_0xe34a('0x35')]);_0x53fe9a['where']=qs['filters'](_[_0xe34a('0x36')](_0x3f4896[_0xe34a('0x2b')],_0x290fed['filters']),_0x5cb345);if(_0x3f4896['query'][_0xe34a('0x37')]){_0x53fe9a['where']=_[_0xe34a('0x38')](_0x53fe9a[_0xe34a('0x39')],{'$or':_[_0xe34a('0x29')](_0x5cb345,function(_0x3e8ffe){if(_0x3e8ffe[_0xe34a('0x3a')]!==_0xe34a('0x3b')){var _0x3271da={};_0x3271da[_0x3e8ffe[_0xe34a('0x28')]]={'$like':'%'+_0x3f4896[_0xe34a('0x2b')][_0xe34a('0x37')]+'%'};return _0x3271da;}})});}_0x53fe9a=_[_0xe34a('0x38')]({},_0x53fe9a,_0x3f4896[_0xe34a('0x3c')]);var _0x423383={'where':_0x53fe9a[_0xe34a('0x39')]};return db['AnalyticDefaultReport'][_0xe34a('0x3d')](_0x423383)[_0xe34a('0x21')](function(_0x34fd6d){_0x2fff8b[_0xe34a('0x3d')]=_0x34fd6d;if(_0x3f4896[_0xe34a('0x2b')][_0xe34a('0x3e')]){_0x53fe9a['include']=[{'all':!![]}];}return db[_0xe34a('0x2a')]['findAll'](_0x53fe9a);})['then'](function(_0x18897f){_0x2fff8b[_0xe34a('0x3f')]=_0x18897f;return _0x2fff8b;})[_0xe34a('0x21')](respondWithFilteredResult(_0xb00bc5,_0x53fe9a))[_0xe34a('0x40')](handleError(_0xb00bc5,null));};exports[_0xe34a('0x41')]=function(_0x9406c1,_0x51b733){var _0x1d3487={'raw':!![],'where':{'id':_0x9406c1[_0xe34a('0x42')]['id']}},_0x71dbcc={};_0x71dbcc[_0xe34a('0x2d')]=_[_0xe34a('0x43')](db[_0xe34a('0x2a')][_0xe34a('0x44')]);_0x71dbcc[_0xe34a('0x2b')]=_['keys'](_0x9406c1['query']);_0x71dbcc[_0xe34a('0x2c')]=_[_0xe34a('0x2f')](_0x71dbcc[_0xe34a('0x2d')],_0x71dbcc['query']);_0x1d3487[_0xe34a('0x2e')]=_[_0xe34a('0x2f')](_0x71dbcc[_0xe34a('0x2d')],qs[_0xe34a('0x30')](_0x9406c1[_0xe34a('0x2b')][_0xe34a('0x30')]));_0x1d3487[_0xe34a('0x2e')]=_0x1d3487[_0xe34a('0x2e')][_0xe34a('0x31')]?_0x1d3487[_0xe34a('0x2e')]:_0x71dbcc[_0xe34a('0x2d')];if(_0x9406c1[_0xe34a('0x2b')][_0xe34a('0x3e')]){_0x1d3487[_0xe34a('0x45')]=[{'all':!![]}];}_0x1d3487=_[_0xe34a('0x38')]({},_0x1d3487,_0x9406c1[_0xe34a('0x3c')]);return db[_0xe34a('0x2a')][_0xe34a('0x46')](_0x1d3487)['then'](handleEntityNotFound(_0x51b733,null))[_0xe34a('0x21')](respondWithResult(_0x51b733,null))['catch'](handleError(_0x51b733,null));};exports[_0xe34a('0x47')]=function(_0x16ea3c,_0x543a65){return db[_0xe34a('0x2a')][_0xe34a('0x47')](_0x16ea3c[_0xe34a('0x48')],{})[_0xe34a('0x21')](function(_0x3db074){var _0x203971=_0x16ea3c[_0xe34a('0x49')][_0xe34a('0x22')]({'plain':!![]});if(!_0x203971)throw new Error(_0xe34a('0x4a'));if(_0x203971[_0xe34a('0x4b')]===_0xe34a('0x49')){var _0x59026d=_0x3db074[_0xe34a('0x22')]({'plain':!![]});var _0x5a469f=_0xe34a('0x4c');return db[_0xe34a('0x4d')]['find']({'where':{'name':_0x5a469f,'userProfileId':_0x203971[_0xe34a('0x4e')]},'raw':!![]})[_0xe34a('0x21')](function(_0x575c71){if(_0x575c71&&_0x575c71['autoAssociation']===0x0){return db[_0xe34a('0x4f')][_0xe34a('0x47')]({'name':_0x59026d['name'],'resourceId':_0x59026d['id'],'type':'DefaultReports','sectionId':_0x575c71['id']},{})[_0xe34a('0x21')](function(){return _0x3db074;});}else{return _0x3db074;}})[_0xe34a('0x40')](function(_0x4035c7){logger[_0xe34a('0x26')](_0xe34a('0x50'),_0x4035c7);throw _0x4035c7;});}return _0x3db074;})[_0xe34a('0x21')](respondWithResult(_0x543a65,0xc9))['catch'](handleError(_0x543a65,null));};exports[_0xe34a('0x20')]=function(_0x28f53e,_0x138d17){if(_0x28f53e[_0xe34a('0x48')]['id']){delete _0x28f53e[_0xe34a('0x48')]['id'];}return db[_0xe34a('0x2a')][_0xe34a('0x46')]({'where':{'id':_0x28f53e[_0xe34a('0x42')]['id']}})[_0xe34a('0x21')](handleEntityNotFound(_0x138d17,null))[_0xe34a('0x21')](saveUpdates(_0x28f53e[_0xe34a('0x48')],null))[_0xe34a('0x21')](respondWithResult(_0x138d17,null))[_0xe34a('0x40')](handleError(_0x138d17,null));};exports[_0xe34a('0x24')]=function(_0x1a6764,_0x58f3a5){return db[_0xe34a('0x2a')]['find']({'where':{'id':_0x1a6764['params']['id']}})[_0xe34a('0x21')](handleEntityNotFound(_0x58f3a5,null))[_0xe34a('0x21')](removeEntity(_0x58f3a5,null))['catch'](handleError(_0x58f3a5,null));};exports[_0xe34a('0x51')]=function(_0x1606c1,_0x349a33){var _0x2c01dd=0xa;var _0x5d4d9f=[_0xe34a('0x52'),_0xe34a('0x53'),_0xe34a('0x54'),'cross_join'];var _0x1e61da={'SUM':_0xe34a('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe34a('0x56'),'MIN':_0xe34a('0x57'),'AVG':_0xe34a('0x58'),'GROUP_CONCAT':_0xe34a('0x59'),'GROUP_CONCAT ASC':_0xe34a('0x5a'),'GROUP_CONCAT DESC':_0xe34a('0x5b')};var _0x4231ee={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xe34a('0x5c'),'ROUND':_0xe34a('0x5d'),'UNIX_TIMESTAMP':_0xe34a('0x5e')};var _0x491126=function(_0x49d7ba){return!_[_0xe34a('0x5f')]([_0xe34a('0x60'),'IS\x20NOT\x20NULL',_0xe34a('0x61'),_0xe34a('0x62')],_0x49d7ba);};var _0x54ce5d=function(_0x42cfba){if(!_0x42cfba||!_0x42cfba[_0xe34a('0x63')]['length']){return'';}for(var _0x417ac8='(',_0x3b4295=0x0;_0x3b4295<_0x42cfba[_0xe34a('0x63')][_0xe34a('0x31')];_0x3b4295+=0x1){_0x3b4295>0x0&&(_0x417ac8+='\x20'+_0x42cfba[_0xe34a('0x64')]+'\x20');_0x417ac8+=_0x42cfba['rules'][_0x3b4295][_0xe34a('0x65')]?_0x54ce5d(_0x42cfba['rules'][_0x3b4295][_0xe34a('0x65')]):_0x42cfba[_0xe34a('0x63')][_0x3b4295]['field']+'\x20'+_0x42cfba[_0xe34a('0x63')][_0x3b4295][_0xe34a('0x66')]+(_0x491126(_0x42cfba[_0xe34a('0x63')][_0x3b4295][_0xe34a('0x66')])?'\x20'+_0x42cfba[_0xe34a('0x63')][_0x3b4295][_0xe34a('0x67')]:'');}return _0x417ac8+')';};var _0x876764={'where':{'id':_0x1606c1[_0xe34a('0x42')]['id']}},_0x1b7397,_0x3567f6,_0x2b6a84,_0x870ec6,_0x38f9d2;_0x876764=_[_0xe34a('0x38')]({},_0x876764,_0x1606c1['options']);return db[_0xe34a('0x2a')][_0xe34a('0x46')](_0x876764)[_0xe34a('0x21')](function(_0x28d200){if(_0x28d200){_0x1b7397=_0x28d200;return _0x28d200['getFields']();}return null;})[_0xe34a('0x21')](function(_0x1efd91){if(_0x1efd91){if(!_0x1efd91['length']){throw new db['Sequelize'][(_0xe34a('0x68'))](_0xe34a('0x69'),0x193);}_0x3567f6=_0x1efd91;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xe34a('0x21')](function(_0x4e1b22){if(_0x4e1b22){_0x2b6a84=_[_0xe34a('0x6a')](_0x4e1b22,'id');var _0x41cd89;var _0x458a44=squel['select']();_0x458a44['from'](_0x1b7397[_0xe34a('0x6b')]);for(var _0xc3d11b=0x0;_0xc3d11b<_0x3567f6['length'];_0xc3d11b+=0x1){_0x41cd89=_0x3567f6[_0xc3d11b][_0xe34a('0x6c')]?_0x2b6a84[_0x3567f6[_0xc3d11b][_0xe34a('0x6c')]][_0xe34a('0x6d')]:_0x3567f6[_0xc3d11b]['field'];_0x41cd89=_0x3567f6[_0xc3d11b][_0xe34a('0x6e')]?_[_0xe34a('0x6f')](_0x1e61da[_0x3567f6[_0xc3d11b][_0xe34a('0x6e')]],'%s',_0x41cd89):_0x41cd89;_0x41cd89=_0x3567f6[_0xc3d11b][_0xe34a('0x70')]?_['replace'](_0x4231ee[_0x3567f6[_0xc3d11b][_0xe34a('0x70')]],'%s',_0x41cd89):_0x41cd89;if(_0x3567f6[_0xc3d11b][_0xe34a('0x71')]){_0x458a44[_0xe34a('0x65')](_0x41cd89);}_0x3567f6[_0xc3d11b][_0xe34a('0x72')]&&_0x458a44[_0xe34a('0x34')](_0x41cd89,_0x3567f6[_0xc3d11b][_0xe34a('0x72')]===_0xe34a('0x73')?![]:!![]);_0x458a44[_0xe34a('0x74')](_0x41cd89,_0x3567f6[_0xc3d11b][_0xe34a('0x75')]||_0x41cd89);}if(_0x1b7397[_0xe34a('0x76')]){_0x1b7397[_0xe34a('0x76')]=JSON['parse'](_0x1b7397['joins']);for(var _0x454683=0x0;_0x454683<_0x1b7397[_0xe34a('0x76')][_0xe34a('0x31')];_0x454683+=0x1){if(_0x1b7397[_0xe34a('0x76')][_0x454683][_0xe34a('0x3a')]&&_[_0xe34a('0x5f')](_0x5d4d9f,_0x1b7397[_0xe34a('0x76')][_0x454683][_0xe34a('0x3a')])&&_0x1b7397[_0xe34a('0x76')][_0x454683]['parentKey']&&_0x1b7397[_0xe34a('0x76')][_0x454683][_0xe34a('0x77')]&&_0x1b7397[_0xe34a('0x76')][_0x454683][_0xe34a('0x78')]){_0x458a44[_0x1b7397[_0xe34a('0x76')][_0x454683]['type']](_0x1b7397[_0xe34a('0x76')][_0x454683][_0xe34a('0x77')],null,util[_0xe34a('0x70')](_0xe34a('0x79'),_0x1b7397[_0xe34a('0x6b')],_0x1b7397[_0xe34a('0x76')][_0x454683]['parentKey'],_0x1b7397[_0xe34a('0x76')][_0x454683][_0xe34a('0x77')],_0x1b7397[_0xe34a('0x76')][_0x454683]['foreignKey']));}}}if(_0x1b7397['conditions']){_0x1b7397['conditions']=JSON[_0xe34a('0x7a')](_0x1b7397[_0xe34a('0x7b')]);_0x458a44[_0xe34a('0x39')](_0x54ce5d(_0x1b7397[_0xe34a('0x7b')]['group']));}_0x38f9d2=_0x458a44[_0xe34a('0x7c')]();_0x458a44[_0xe34a('0x1b')](_0x2c01dd);_0x458a44[_0xe34a('0x1d')](0x0);logger[_0xe34a('0x7d')](_0xe34a('0x7e'),_0x458a44[_0xe34a('0x7f')]());return dbH['sequelize'][_0xe34a('0x2b')](_0x458a44[_0xe34a('0x7f')](),{'type':dbH[_0xe34a('0x80')][_0xe34a('0x81')][_0xe34a('0x82')]});}})['then'](respondWithResult(_0x349a33,null))['catch'](handleError(_0x349a33,null));};function runReport(_0x11e5c7,_0x44344a,_0x1c9d60){var _0x119f91=_0x44344a[_0xe34a('0x28')];var _0x1ab1b0=0xa;var _0x168d96=['join','left_join',_0xe34a('0x54'),_0xe34a('0x83')];var _0x2dad0f={'SUM':_0xe34a('0x55'),'COUNT':_0xe34a('0x84'),'COUNT DISTINCT':_0xe34a('0x85'),'MAX':_0xe34a('0x56'),'MIN':'MIN(%s)','AVG':_0xe34a('0x58'),'GROUP_CONCAT':_0xe34a('0x59'),'GROUP_CONCAT ASC':_0xe34a('0x5a'),'GROUP_CONCAT DESC':_0xe34a('0x5b')};var _0x12e4c4={'SEC_TO_TIME':_0xe34a('0x86'),'DATE':_0xe34a('0x87'),'HOUR':_0xe34a('0x5c'),'ROUND':_0xe34a('0x5d'),'UNIX_TIMESTAMP':_0xe34a('0x5e')};var _0x1a67a5=function(_0x4a267f){return!_[_0xe34a('0x5f')]([_0xe34a('0x60'),_0xe34a('0x88'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x4a267f);};var _0x553e7e=function(_0x3dd08a){if(!_0x3dd08a||!_0x3dd08a[_0xe34a('0x63')][_0xe34a('0x31')]){return'';}for(var _0x1aec7e='(',_0x3f861=0x0;_0x3f861<_0x3dd08a[_0xe34a('0x63')][_0xe34a('0x31')];_0x3f861+=0x1){_0x3f861>0x0&&(_0x1aec7e+='\x20'+_0x3dd08a['operator']+'\x20');_0x1aec7e+=_0x3dd08a[_0xe34a('0x63')][_0x3f861][_0xe34a('0x65')]?_0x553e7e(_0x3dd08a[_0xe34a('0x63')][_0x3f861]['group']):_0x3dd08a['rules'][_0x3f861][_0xe34a('0x74')]+'\x20'+_0x3dd08a['rules'][_0x3f861][_0xe34a('0x66')]+(_0x1a67a5(_0x3dd08a['rules'][_0x3f861][_0xe34a('0x66')])?'\x20'+_0x3dd08a[_0xe34a('0x63')][_0x3f861][_0xe34a('0x67')]:'');}return _0x1aec7e+')';};var _0x5917e9={'where':{'id':_0x11e5c7['id']}},_0x15bcf4,_0x521b20,_0x13e3d3,_0x2d58c7,_0x77c7ab;_0x5917e9=_[_0xe34a('0x38')]({},_0x5917e9,_0x1c9d60);return db['AnalyticDefaultReport'][_0xe34a('0x46')](_0x5917e9)[_0xe34a('0x21')](function(_0x13ca5c){if(_0x13ca5c){_0x15bcf4=_0x13ca5c;return _0x13ca5c[_0xe34a('0x89')]();}return null;})[_0xe34a('0x21')](function(_0x26aa06){if(_0x26aa06){if(!_0x26aa06['length']){throw new db[(_0xe34a('0x8a'))]['ValidationErrorItem'](_0xe34a('0x69'),0x193);}_0x521b20=_0x26aa06;return db['AnalyticMetric'][_0xe34a('0x8b')]({'raw':!![]});}return null;})[_0xe34a('0x21')](function(_0x50e54c){if(_0x50e54c){_0x13e3d3=_[_0xe34a('0x6a')](_0x50e54c,'id');var _0x4e0804;var _0x44594f=squel[_0xe34a('0x8c')]();_0x44594f[_0xe34a('0x8d')](_0x15bcf4['table']);for(var _0x28a4f0=0x0;_0x28a4f0<_0x521b20['length'];_0x28a4f0+=0x1){_0x4e0804=_0x521b20[_0x28a4f0][_0xe34a('0x6c')]?_0x13e3d3[_0x521b20[_0x28a4f0]['MetricId']][_0xe34a('0x6d')]:_0x521b20[_0x28a4f0]['field'];_0x4e0804=_0x521b20[_0x28a4f0]['function']?_[_0xe34a('0x6f')](_0x2dad0f[_0x521b20[_0x28a4f0][_0xe34a('0x6e')]],'%s',_0x4e0804):_0x4e0804;_0x4e0804=_0x521b20[_0x28a4f0]['format']?_['replace'](_0x12e4c4[_0x521b20[_0x28a4f0][_0xe34a('0x70')]],'%s',_0x4e0804):_0x4e0804;if(_0x521b20[_0x28a4f0][_0xe34a('0x71')]){_0x44594f[_0xe34a('0x65')](_0x4e0804);}_0x521b20[_0x28a4f0]['orderBy']&&_0x44594f[_0xe34a('0x34')](_0x4e0804,_0x521b20[_0x28a4f0][_0xe34a('0x72')]==='DESC'?![]:!![]);_0x44594f[_0xe34a('0x74')](_0x4e0804,_0x521b20[_0x28a4f0]['alias']||_0x4e0804);}if(_0x15bcf4[_0xe34a('0x76')]){_0x15bcf4[_0xe34a('0x76')]=JSON[_0xe34a('0x7a')](_0x15bcf4[_0xe34a('0x76')]);for(var _0x38bfa9=0x0;_0x38bfa9<_0x15bcf4['joins'][_0xe34a('0x31')];_0x38bfa9+=0x1){if(_0x15bcf4[_0xe34a('0x76')][_0x38bfa9][_0xe34a('0x3a')]&&_[_0xe34a('0x5f')](_0x168d96,_0x15bcf4[_0xe34a('0x76')][_0x38bfa9][_0xe34a('0x3a')])&&_0x15bcf4[_0xe34a('0x76')][_0x38bfa9]['parentKey']&&_0x15bcf4['joins'][_0x38bfa9][_0xe34a('0x77')]&&_0x15bcf4[_0xe34a('0x76')][_0x38bfa9][_0xe34a('0x78')]){_0x44594f[_0x15bcf4[_0xe34a('0x76')][_0x38bfa9]['type']](_0x15bcf4[_0xe34a('0x76')][_0x38bfa9][_0xe34a('0x77')],null,util['format'](_0xe34a('0x79'),_0x15bcf4[_0xe34a('0x6b')],_0x15bcf4[_0xe34a('0x76')][_0x38bfa9][_0xe34a('0x8e')],_0x15bcf4[_0xe34a('0x76')][_0x38bfa9]['foreignTable'],_0x15bcf4[_0xe34a('0x76')][_0x38bfa9]['foreignKey']));}}}if(_0x15bcf4[_0xe34a('0x7b')]){_0x15bcf4[_0xe34a('0x7b')]=JSON[_0xe34a('0x7a')](_0x15bcf4[_0xe34a('0x7b')]);_0x44594f[_0xe34a('0x39')](_0x553e7e(_0x15bcf4[_0xe34a('0x7b')][_0xe34a('0x65')]));}_0x77c7ab=_0x44594f['clone']();_0x44594f[_0xe34a('0x1b')](_0x1ab1b0);_0x44594f[_0xe34a('0x1d')](0x0);return;}})[_0xe34a('0x21')](function(){if(_0x44344a[_0xe34a('0x8f')]===_0xe34a('0x90')){return null;}var _0x29df12=_[_0xe34a('0x38')](_0x44344a,{'name':_0x44344a['fullPath']||_0x44344a[_0xe34a('0x28')]||_0x15bcf4['name'],'basename':_0x119f91,'savename':util['format'](_0xe34a('0x91'),_0x44344a[_0xe34a('0x28')]||_0x15bcf4[_0xe34a('0x28')],require('randomstring')[_0xe34a('0x92')](0x4),_0x44344a[_0xe34a('0x8f')]||_0xe34a('0x93')),'reportId':_0x15bcf4['id'],'reportType':_0xe34a('0x94')});return db[_0xe34a('0x95')][_0xe34a('0x47')](_0x29df12,{'raw':!![]});})['then'](function(_0x1497f9){if(_0x15bcf4[_0xe34a('0x6b')]==='cdr'){_0x77c7ab[_0xe34a('0x39')](_0x15bcf4[_0xe34a('0x6b')]+_0xe34a('0x96'),_0x44344a['startDate'],_0x44344a[_0xe34a('0x97')]);}else{_0x77c7ab['where'](_0x15bcf4['table']+_0xe34a('0x98'),_0x44344a[_0xe34a('0x99')],_0x44344a[_0xe34a('0x97')]);}if(_0x1497f9){logger[_0xe34a('0x9a')](_0xe34a('0x9b'),_0x77c7ab[_0xe34a('0x7f')]());require(_0xe34a('0x9c'))[_0xe34a('0x9d')](path[_0xe34a('0x52')](__dirname,_0xe34a('0x9e'),_0x1497f9['output']),[_0x1497f9['id'],_0x77c7ab[_0xe34a('0x7f')](),path[_0xe34a('0x52')](__dirname,_0xe34a('0x9f'),_0x1497f9[_0xe34a('0xa0')]),_0x119f91]);return _0x1497f9;}else{var _0x467d01=squel[_0xe34a('0x8c')]();_0x467d01[_0xe34a('0x8d')]('('+_0x77c7ab['toString']()+')',_0xe34a('0xa1'));_0x467d01[_0xe34a('0x74')]('COUNT(*)',_0xe34a('0x3d'));_0x77c7ab[_0xe34a('0x1b')](_0x44344a[_0xe34a('0x1b')]||_0x1ab1b0);_0x77c7ab[_0xe34a('0x1d')](_0x44344a[_0xe34a('0x1d')]||0x0);return dbH['sequelize'][_0xe34a('0x2b')](_0x467d01[_0xe34a('0x7f')](),{'type':dbH[_0xe34a('0x80')][_0xe34a('0x81')]['SELECT']})[_0xe34a('0x21')](function(_0x24e9ba){if(!_0x24e9ba['length']){_0x2d58c7=0x0;}else{_0x2d58c7=_0x24e9ba[0x0][_0xe34a('0x3d')]||0x0;}return dbH[_0xe34a('0x80')][_0xe34a('0x2b')](_0x77c7ab['toString'](),{'type':dbH[_0xe34a('0x80')][_0xe34a('0x81')][_0xe34a('0x82')]});})['then'](function(_0x59c480){return{'rows':_0x59c480||[],'count':_0x2d58c7};});}});}exports[_0xe34a('0xa2')]=function(_0x49cb55,_0x1735d4){return runReport(_0x49cb55[_0xe34a('0x42')],_0x49cb55[_0xe34a('0x2b')],_0x49cb55[_0xe34a('0x3c')])[_0xe34a('0x21')](respondWithResult(_0x1735d4,null))['catch'](handleError(_0x1735d4,null));};exports[_0xe34a('0xa3')]=runReport;exports['query']=function(_0x3e9720,_0x3331e6){var _0x880c92=0xa;var _0x30ecd5=[_0xe34a('0x52'),_0xe34a('0x53'),'right_join',_0xe34a('0x83')];var _0x3a9a70={'SUM':_0xe34a('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe34a('0x85'),'MAX':_0xe34a('0x56'),'MIN':_0xe34a('0x57'),'AVG':_0xe34a('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe34a('0x5a'),'GROUP_CONCAT DESC':_0xe34a('0x5b')};var _0x1d8bfc={'SEC_TO_TIME':_0xe34a('0x86'),'DATE':_0xe34a('0x87'),'HOUR':_0xe34a('0x5c'),'ROUND':_0xe34a('0x5d'),'UNIX_TIMESTAMP':_0xe34a('0x5e')};var _0xf71477=function(_0xc692a6){return!_[_0xe34a('0x5f')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xe34a('0x61'),_0xe34a('0x62')],_0xc692a6);};var _0x3a0cb6=function(_0x258f16){if(!_0x258f16||!_0x258f16[_0xe34a('0x63')][_0xe34a('0x31')]){return'';}for(var _0x3bc25c='(',_0x331f3e=0x0;_0x331f3e<_0x258f16[_0xe34a('0x63')][_0xe34a('0x31')];_0x331f3e+=0x1){_0x331f3e>0x0&&(_0x3bc25c+='\x20'+_0x258f16[_0xe34a('0x64')]+'\x20');_0x3bc25c+=_0x258f16[_0xe34a('0x63')][_0x331f3e][_0xe34a('0x65')]?_0x3a0cb6(_0x258f16[_0xe34a('0x63')][_0x331f3e][_0xe34a('0x65')]):_0x258f16['rules'][_0x331f3e][_0xe34a('0x74')]+'\x20'+_0x258f16[_0xe34a('0x63')][_0x331f3e][_0xe34a('0x66')]+(_0xf71477(_0x258f16[_0xe34a('0x63')][_0x331f3e]['condition'])?'\x20'+_0x258f16[_0xe34a('0x63')][_0x331f3e][_0xe34a('0x67')]:'');}return _0x3bc25c+')';};var _0x3081cf={'where':{'id':_0x3e9720['params']['id']}},_0x77cda8,_0x584a56,_0xcfe05b,_0x23b4ca,_0x1eb507;_0x3081cf=_[_0xe34a('0x38')]({},_0x3081cf,_0x3e9720['options']);return db[_0xe34a('0x2a')]['find'](_0x3081cf)['then'](function(_0x312d2f){if(_0x312d2f){_0x77cda8=_0x312d2f;return _0x312d2f[_0xe34a('0x89')]();}return null;})[_0xe34a('0x21')](function(_0x1ce8ef){if(_0x1ce8ef){if(!_0x1ce8ef['length']){throw new db[(_0xe34a('0x8a'))]['ValidationErrorItem'](_0xe34a('0x69'),0x193);}_0x584a56=_0x1ce8ef;return db['AnalyticMetric'][_0xe34a('0x8b')]({'raw':!![]});}return null;})[_0xe34a('0x21')](function(_0x2732e2){if(_0x2732e2){_0xcfe05b=_[_0xe34a('0x6a')](_0x2732e2,'id');var _0x3bdaa2;var _0x3c38b7=squel[_0xe34a('0x8c')]();_0x3c38b7['from'](_0x77cda8[_0xe34a('0x6b')]);for(var _0x2a144e=0x0;_0x2a144e<_0x584a56[_0xe34a('0x31')];_0x2a144e+=0x1){_0x3bdaa2=_0x584a56[_0x2a144e][_0xe34a('0x6c')]?_0xcfe05b[_0x584a56[_0x2a144e][_0xe34a('0x6c')]]['metric']:_0x584a56[_0x2a144e][_0xe34a('0x74')];_0x3bdaa2=_0x584a56[_0x2a144e][_0xe34a('0x6e')]?_['replace'](_0x3a9a70[_0x584a56[_0x2a144e][_0xe34a('0x6e')]],'%s',_0x3bdaa2):_0x3bdaa2;_0x3bdaa2=_0x584a56[_0x2a144e][_0xe34a('0x70')]?_[_0xe34a('0x6f')](_0x1d8bfc[_0x584a56[_0x2a144e][_0xe34a('0x70')]],'%s',_0x3bdaa2):_0x3bdaa2;if(_0x584a56[_0x2a144e][_0xe34a('0x71')]){_0x3c38b7[_0xe34a('0x65')](_0x3bdaa2);}_0x584a56[_0x2a144e][_0xe34a('0x72')]&&_0x3c38b7[_0xe34a('0x34')](_0x3bdaa2,_0x584a56[_0x2a144e][_0xe34a('0x72')]===_0xe34a('0x73')?![]:!![]);_0x3c38b7[_0xe34a('0x74')](_0x3bdaa2,_0x584a56[_0x2a144e][_0xe34a('0x75')]||_0x3bdaa2);}if(_0x77cda8['joins']){_0x77cda8[_0xe34a('0x76')]=JSON[_0xe34a('0x7a')](_0x77cda8[_0xe34a('0x76')]);for(var _0x33f69b=0x0;_0x33f69b<_0x77cda8[_0xe34a('0x76')][_0xe34a('0x31')];_0x33f69b+=0x1){if(_0x77cda8[_0xe34a('0x76')][_0x33f69b][_0xe34a('0x3a')]&&_[_0xe34a('0x5f')](_0x30ecd5,_0x77cda8[_0xe34a('0x76')][_0x33f69b][_0xe34a('0x3a')])&&_0x77cda8[_0xe34a('0x76')][_0x33f69b][_0xe34a('0x8e')]&&_0x77cda8[_0xe34a('0x76')][_0x33f69b][_0xe34a('0x77')]&&_0x77cda8['joins'][_0x33f69b][_0xe34a('0x78')]){_0x3c38b7[_0x77cda8[_0xe34a('0x76')][_0x33f69b][_0xe34a('0x3a')]](_0x77cda8[_0xe34a('0x76')][_0x33f69b]['foreignTable'],null,util[_0xe34a('0x70')]('%s.%s\x20=\x20%s.%s',_0x77cda8['table'],_0x77cda8[_0xe34a('0x76')][_0x33f69b][_0xe34a('0x8e')],_0x77cda8[_0xe34a('0x76')][_0x33f69b][_0xe34a('0x77')],_0x77cda8[_0xe34a('0x76')][_0x33f69b][_0xe34a('0x78')]));}}}if(_0x77cda8[_0xe34a('0x7b')]){_0x77cda8[_0xe34a('0x7b')]=JSON['parse'](_0x77cda8[_0xe34a('0x7b')]);_0x3c38b7[_0xe34a('0x39')](_0x3a0cb6(_0x77cda8['conditions'][_0xe34a('0x65')]));}_0x1eb507=_0x3c38b7[_0xe34a('0x7c')]();_0x3c38b7[_0xe34a('0x1b')](_0x880c92);_0x3c38b7[_0xe34a('0x1d')](0x0);logger[_0xe34a('0x7d')]('Limited\x20Query:',_0x3c38b7[_0xe34a('0x7f')]());return dbH[_0xe34a('0x80')][_0xe34a('0x2b')](_0x3c38b7[_0xe34a('0x7f')](),{'type':dbH[_0xe34a('0x80')][_0xe34a('0x81')]['SELECT']});}})[_0xe34a('0x21')](function(){return{'sql':_0x1eb507['toString']()};})[_0xe34a('0x21')](respondWithResult(_0x3331e6,null))['catch'](handleError(_0x3331e6,null));}; \ No newline at end of file +var _0xe337=['order','sort','pick','filter','where','merge','VIRTUAL','AnalyticDefaultReport','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','IS\x20EMPTY','getFields','keyBy','web','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','from','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','offset','undefined','count','Content-Range','json','apply','save','update','destroy','get','DefaultReports','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x15ab2f,_0x4f4cca){var _0x1c2103=function(_0x589ee6){while(--_0x589ee6){_0x15ab2f['push'](_0x15ab2f['shift']());}};_0x1c2103(++_0x4f4cca);}(_0xe337,0x6a));var _0x7e33=function(_0xa3fa3,_0x328285){_0xa3fa3=_0xa3fa3-0x0;var _0x488dd4=_0xe337[_0xa3fa3];return _0x488dd4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7e33('0x0'));var jsonpatch=require(_0x7e33('0x1'));var rp=require(_0x7e33('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7e33('0x3'));var util=require(_0x7e33('0x4'));var path=require('path');var sox=require(_0x7e33('0x5'));var csv=require('to-csv');var ejs=require(_0x7e33('0x6'));var fs=require('fs');var fs_extra=require(_0x7e33('0x7'));var _=require(_0x7e33('0x8'));var squel=require(_0x7e33('0x9'));var crypto=require(_0x7e33('0xa'));var jsforce=require(_0x7e33('0xb'));var deskjs=require(_0x7e33('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7e33('0xd'));var Papa=require(_0x7e33('0xe'));var Redis=require(_0x7e33('0xf'));var authService=require(_0x7e33('0x10'));var qs=require(_0x7e33('0x11'));var as=require(_0x7e33('0x12'));var hardwareService=require(_0x7e33('0x13'));var logger=require(_0x7e33('0x14'))(_0x7e33('0x15'));var utils=require(_0x7e33('0x16'));var config=require(_0x7e33('0x17'));var licenseUtil=require(_0x7e33('0x18'));var db=require(_0x7e33('0x19'))['db'];var dbH=require(_0x7e33('0x19'))[_0x7e33('0x1a')];function respondWithStatusCode(_0x199f07,_0x1740f1){_0x1740f1=_0x1740f1||0xcc;return function(_0x57244a){if(_0x57244a){return _0x199f07[_0x7e33('0x1b')](_0x1740f1);}return _0x199f07['status'](_0x1740f1)[_0x7e33('0x1c')]();};}function respondWithResult(_0x5eb755,_0x2dfbfc){_0x2dfbfc=_0x2dfbfc||0xc8;return function(_0x148ca4){if(_0x148ca4){return _0x5eb755[_0x7e33('0x1d')](_0x2dfbfc)['json'](_0x148ca4);}};}function respondWithFilteredResult(_0x5ba4a5,_0x16e9b6){return function(_0x5ecc63){if(_0x5ecc63){var _0x32cf01=typeof _0x16e9b6[_0x7e33('0x1e')]===_0x7e33('0x1f')&&typeof _0x16e9b6['limit']===_0x7e33('0x1f');var _0x5567ee=_0x5ecc63[_0x7e33('0x20')];var _0x470bf6=_0x32cf01?0x0:_0x16e9b6[_0x7e33('0x1e')];var _0x4c85cc=_0x32cf01?_0x5ecc63[_0x7e33('0x20')]:_0x16e9b6[_0x7e33('0x1e')]+_0x16e9b6['limit'];var _0x25443e;if(_0x4c85cc>=_0x5567ee){_0x4c85cc=_0x5567ee;_0x25443e=0xc8;}else{_0x25443e=0xce;}_0x5ba4a5[_0x7e33('0x1d')](_0x25443e);return _0x5ba4a5['set'](_0x7e33('0x21'),_0x470bf6+'-'+_0x4c85cc+'/'+_0x5567ee)[_0x7e33('0x22')](_0x5ecc63);}return null;};}function patchUpdates(_0x23643f){return function(_0x42afb5){try{jsonpatch[_0x7e33('0x23')](_0x42afb5,_0x23643f,!![]);}catch(_0x34288d){return BPromise['reject'](_0x34288d);}return _0x42afb5[_0x7e33('0x24')]();};}function saveUpdates(_0x177330,_0x463f8a){return function(_0x514fac){if(_0x514fac){return _0x514fac[_0x7e33('0x25')](_0x177330)['then'](function(_0x36cae8){return _0x36cae8;});}return null;};}function removeEntity(_0x238426,_0x1b3530){return function(_0x1a7a0f){if(_0x1a7a0f){return _0x1a7a0f[_0x7e33('0x26')]()['then'](function(){var _0xd2b3f1=_0x1a7a0f[_0x7e33('0x27')]({'plain':!![]});var _0x48451f=_0x7e33('0x28');return db[_0x7e33('0x29')][_0x7e33('0x26')]({'where':{'type':_0x48451f,'resourceId':_0xd2b3f1['id']}})[_0x7e33('0x2a')](function(){return _0x1a7a0f;});})[_0x7e33('0x2a')](function(){_0x238426[_0x7e33('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x227f14,_0xee104f){return function(_0x563b66){if(!_0x563b66){_0x227f14[_0x7e33('0x1b')](0x194);}return _0x563b66;};}function handleError(_0x3e3771,_0x19b938){_0x19b938=_0x19b938||0x1f4;return function(_0x131605){logger[_0x7e33('0x2b')](_0x131605[_0x7e33('0x2c')]);if(_0x131605[_0x7e33('0x2d')]){delete _0x131605[_0x7e33('0x2d')];}_0x3e3771[_0x7e33('0x1d')](_0x19b938)[_0x7e33('0x2e')](_0x131605);};}exports[_0x7e33('0x2f')]=function(_0x58af87,_0x5ab517){var _0x1d631a={},_0x47fee7={},_0x79007={'count':0x0,'rows':[]};var _0x32ba99=_[_0x7e33('0x30')](db['AnalyticDefaultReport'][_0x7e33('0x31')],function(_0x2d8d27){return{'name':_0x2d8d27[_0x7e33('0x32')],'type':_0x2d8d27[_0x7e33('0x33')][_0x7e33('0x34')]};});_0x47fee7[_0x7e33('0x35')]=_[_0x7e33('0x30')](_0x32ba99,_0x7e33('0x2d'));_0x47fee7[_0x7e33('0x36')]=_[_0x7e33('0x37')](_0x58af87['query']);_0x47fee7[_0x7e33('0x38')]=_['intersection'](_0x47fee7['model'],_0x47fee7[_0x7e33('0x36')]);_0x1d631a[_0x7e33('0x39')]=_[_0x7e33('0x3a')](_0x47fee7[_0x7e33('0x35')],qs['fields'](_0x58af87['query'][_0x7e33('0x3b')]));_0x1d631a[_0x7e33('0x39')]=_0x1d631a[_0x7e33('0x39')][_0x7e33('0x3c')]?_0x1d631a[_0x7e33('0x39')]:_0x47fee7[_0x7e33('0x35')];if(!_0x58af87['query'][_0x7e33('0x3d')](_0x7e33('0x3e'))){_0x1d631a[_0x7e33('0x3f')]=qs[_0x7e33('0x3f')](_0x58af87[_0x7e33('0x36')][_0x7e33('0x3f')]);_0x1d631a['offset']=qs['offset'](_0x58af87[_0x7e33('0x36')][_0x7e33('0x1e')]);}_0x1d631a[_0x7e33('0x40')]=qs[_0x7e33('0x41')](_0x58af87[_0x7e33('0x36')][_0x7e33('0x41')]);_0x1d631a['where']=qs[_0x7e33('0x38')](_[_0x7e33('0x42')](_0x58af87[_0x7e33('0x36')],_0x47fee7['filters']),_0x32ba99);if(_0x58af87['query'][_0x7e33('0x43')]){_0x1d631a[_0x7e33('0x44')]=_[_0x7e33('0x45')](_0x1d631a['where'],{'$or':_['map'](_0x32ba99,function(_0x32df50){if(_0x32df50['type']!==_0x7e33('0x46')){var _0x34135b={};_0x34135b[_0x32df50[_0x7e33('0x2d')]]={'$like':'%'+_0x58af87[_0x7e33('0x36')][_0x7e33('0x43')]+'%'};return _0x34135b;}})});}_0x1d631a=_['merge']({},_0x1d631a,_0x58af87['options']);var _0x3784cf={'where':_0x1d631a[_0x7e33('0x44')]};return db[_0x7e33('0x47')]['count'](_0x3784cf)[_0x7e33('0x2a')](function(_0x545863){_0x79007['count']=_0x545863;if(_0x58af87[_0x7e33('0x36')][_0x7e33('0x48')]){_0x1d631a['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x7e33('0x49')](_0x1d631a);})[_0x7e33('0x2a')](function(_0x2deeaa){_0x79007[_0x7e33('0x4a')]=_0x2deeaa;return _0x79007;})[_0x7e33('0x2a')](respondWithFilteredResult(_0x5ab517,_0x1d631a))['catch'](handleError(_0x5ab517,null));};exports[_0x7e33('0x4b')]=function(_0x7c9c38,_0x37c3c8){var _0x4682b2={'raw':!![],'where':{'id':_0x7c9c38[_0x7e33('0x4c')]['id']}},_0x538a14={};_0x538a14[_0x7e33('0x35')]=_[_0x7e33('0x37')](db[_0x7e33('0x47')][_0x7e33('0x31')]);_0x538a14['query']=_['keys'](_0x7c9c38['query']);_0x538a14[_0x7e33('0x38')]=_[_0x7e33('0x3a')](_0x538a14[_0x7e33('0x35')],_0x538a14['query']);_0x4682b2[_0x7e33('0x39')]=_[_0x7e33('0x3a')](_0x538a14[_0x7e33('0x35')],qs[_0x7e33('0x3b')](_0x7c9c38[_0x7e33('0x36')][_0x7e33('0x3b')]));_0x4682b2[_0x7e33('0x39')]=_0x4682b2['attributes'][_0x7e33('0x3c')]?_0x4682b2[_0x7e33('0x39')]:_0x538a14['model'];if(_0x7c9c38[_0x7e33('0x36')][_0x7e33('0x48')]){_0x4682b2[_0x7e33('0x4d')]=[{'all':!![]}];}_0x4682b2=_[_0x7e33('0x45')]({},_0x4682b2,_0x7c9c38[_0x7e33('0x4e')]);return db[_0x7e33('0x47')][_0x7e33('0x4f')](_0x4682b2)[_0x7e33('0x2a')](handleEntityNotFound(_0x37c3c8,null))[_0x7e33('0x2a')](respondWithResult(_0x37c3c8,null))[_0x7e33('0x50')](handleError(_0x37c3c8,null));};exports[_0x7e33('0x51')]=function(_0x44534b,_0x11c49a){return db[_0x7e33('0x47')][_0x7e33('0x51')](_0x44534b[_0x7e33('0x52')],{})['then'](function(_0xfa2754){var _0xb0c91d=_0x44534b[_0x7e33('0x53')]['get']({'plain':!![]});if(!_0xb0c91d)throw new Error(_0x7e33('0x54'));if(_0xb0c91d[_0x7e33('0x55')]===_0x7e33('0x53')){var _0x5874da=_0xfa2754[_0x7e33('0x27')]({'plain':!![]});var _0x16520f='Reports';return db[_0x7e33('0x56')][_0x7e33('0x4f')]({'where':{'name':_0x16520f,'userProfileId':_0xb0c91d[_0x7e33('0x57')]},'raw':!![]})[_0x7e33('0x2a')](function(_0x322400){if(_0x322400&&_0x322400[_0x7e33('0x58')]===0x0){return db[_0x7e33('0x29')]['create']({'name':_0x5874da[_0x7e33('0x2d')],'resourceId':_0x5874da['id'],'type':_0x7e33('0x28'),'sectionId':_0x322400['id']},{})['then'](function(){return _0xfa2754;});}else{return _0xfa2754;}})[_0x7e33('0x50')](function(_0x2246aa){logger[_0x7e33('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2246aa);throw _0x2246aa;});}return _0xfa2754;})[_0x7e33('0x2a')](respondWithResult(_0x11c49a,0xc9))[_0x7e33('0x50')](handleError(_0x11c49a,null));};exports['update']=function(_0x452eb0,_0x1a262a){if(_0x452eb0['body']['id']){delete _0x452eb0[_0x7e33('0x52')]['id'];}return db[_0x7e33('0x47')][_0x7e33('0x4f')]({'where':{'id':_0x452eb0[_0x7e33('0x4c')]['id']}})[_0x7e33('0x2a')](handleEntityNotFound(_0x1a262a,null))[_0x7e33('0x2a')](saveUpdates(_0x452eb0[_0x7e33('0x52')],null))[_0x7e33('0x2a')](respondWithResult(_0x1a262a,null))[_0x7e33('0x50')](handleError(_0x1a262a,null));};exports[_0x7e33('0x26')]=function(_0x144d36,_0x3f5e8b){return db['AnalyticDefaultReport'][_0x7e33('0x4f')]({'where':{'id':_0x144d36[_0x7e33('0x4c')]['id']}})[_0x7e33('0x2a')](handleEntityNotFound(_0x3f5e8b,null))[_0x7e33('0x2a')](removeEntity(_0x3f5e8b,null))[_0x7e33('0x50')](handleError(_0x3f5e8b,null));};exports[_0x7e33('0x59')]=function(_0xbb9085,_0x20e656){var _0x7022dc=0xa;var _0x1f967c=[_0x7e33('0x5a'),_0x7e33('0x5b'),_0x7e33('0x5c'),_0x7e33('0x5d')];var _0x1ced0a={'SUM':'SUM(%s)','COUNT':_0x7e33('0x5e'),'COUNT DISTINCT':_0x7e33('0x5f'),'MAX':_0x7e33('0x60'),'MIN':_0x7e33('0x61'),'AVG':_0x7e33('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7e33('0x63')};var _0x1900a5={'SEC_TO_TIME':_0x7e33('0x64'),'DATE':'DATE(%s)','HOUR':_0x7e33('0x65'),'ROUND':_0x7e33('0x66'),'UNIX_TIMESTAMP':_0x7e33('0x67')};var _0x338861=function(_0x2eb980){return!_[_0x7e33('0x68')]([_0x7e33('0x69'),_0x7e33('0x6a'),'IS\x20EMPTY',_0x7e33('0x6b')],_0x2eb980);};var _0x2c0e7b=function(_0x52b55e){if(!_0x52b55e||!_0x52b55e[_0x7e33('0x6c')][_0x7e33('0x3c')]){return'';}for(var _0x1f088d='(',_0x1a4ec4=0x0;_0x1a4ec4<_0x52b55e['rules'][_0x7e33('0x3c')];_0x1a4ec4+=0x1){_0x1a4ec4>0x0&&(_0x1f088d+='\x20'+_0x52b55e[_0x7e33('0x6d')]+'\x20');_0x1f088d+=_0x52b55e[_0x7e33('0x6c')][_0x1a4ec4]['group']?_0x2c0e7b(_0x52b55e['rules'][_0x1a4ec4][_0x7e33('0x6e')]):_0x52b55e[_0x7e33('0x6c')][_0x1a4ec4]['field']+'\x20'+_0x52b55e[_0x7e33('0x6c')][_0x1a4ec4][_0x7e33('0x6f')]+(_0x338861(_0x52b55e['rules'][_0x1a4ec4]['condition'])?'\x20'+_0x52b55e[_0x7e33('0x6c')][_0x1a4ec4][_0x7e33('0x70')]:'');}return _0x1f088d+')';};var _0x438f9e={'where':{'id':_0xbb9085[_0x7e33('0x4c')]['id']}},_0x1f556c,_0x2ecedb,_0x5d7af1,_0x41e71d,_0x458a5a;_0x438f9e=_[_0x7e33('0x45')]({},_0x438f9e,_0xbb9085[_0x7e33('0x4e')]);return db['AnalyticDefaultReport']['find'](_0x438f9e)[_0x7e33('0x2a')](function(_0x2c810a){if(_0x2c810a){_0x1f556c=_0x2c810a;return _0x2c810a['getFields']();}return null;})['then'](function(_0xfd781e){if(_0xfd781e){if(!_0xfd781e[_0x7e33('0x3c')]){throw new db[(_0x7e33('0x71'))][(_0x7e33('0x72'))](_0x7e33('0x73'),0x193);}_0x2ecedb=_0xfd781e;return db[_0x7e33('0x74')][_0x7e33('0x49')]({'raw':!![]});}return null;})[_0x7e33('0x2a')](function(_0x1c70c2){if(_0x1c70c2){_0x5d7af1=_['keyBy'](_0x1c70c2,'id');var _0x41ba1b;var _0x47bcaa=squel[_0x7e33('0x75')]();_0x47bcaa['from'](_0x1f556c[_0x7e33('0x76')]);for(var _0x1de71e=0x0;_0x1de71e<_0x2ecedb[_0x7e33('0x3c')];_0x1de71e+=0x1){_0x41ba1b=_0x2ecedb[_0x1de71e][_0x7e33('0x77')]?_0x5d7af1[_0x2ecedb[_0x1de71e]['MetricId']][_0x7e33('0x78')]:_0x2ecedb[_0x1de71e][_0x7e33('0x79')];_0x41ba1b=_0x2ecedb[_0x1de71e][_0x7e33('0x7a')]?_[_0x7e33('0x7b')](_0x1ced0a[_0x2ecedb[_0x1de71e][_0x7e33('0x7a')]],'%s',_0x41ba1b):_0x41ba1b;_0x41ba1b=_0x2ecedb[_0x1de71e][_0x7e33('0x7c')]?_[_0x7e33('0x7b')](_0x1900a5[_0x2ecedb[_0x1de71e][_0x7e33('0x7c')]],'%s',_0x41ba1b):_0x41ba1b;if(_0x2ecedb[_0x1de71e][_0x7e33('0x7d')]){_0x47bcaa['group'](_0x41ba1b);}_0x2ecedb[_0x1de71e][_0x7e33('0x7e')]&&_0x47bcaa[_0x7e33('0x40')](_0x41ba1b,_0x2ecedb[_0x1de71e][_0x7e33('0x7e')]===_0x7e33('0x7f')?![]:!![]);_0x47bcaa[_0x7e33('0x79')](_0x41ba1b,_0x2ecedb[_0x1de71e][_0x7e33('0x80')]||_0x41ba1b);}if(_0x1f556c[_0x7e33('0x81')]){_0x1f556c[_0x7e33('0x81')]=JSON[_0x7e33('0x82')](_0x1f556c[_0x7e33('0x81')]);for(var _0x3284c3=0x0;_0x3284c3<_0x1f556c[_0x7e33('0x81')][_0x7e33('0x3c')];_0x3284c3+=0x1){if(_0x1f556c['joins'][_0x3284c3][_0x7e33('0x33')]&&_[_0x7e33('0x68')](_0x1f967c,_0x1f556c[_0x7e33('0x81')][_0x3284c3]['type'])&&_0x1f556c[_0x7e33('0x81')][_0x3284c3]['parentKey']&&_0x1f556c[_0x7e33('0x81')][_0x3284c3][_0x7e33('0x83')]&&_0x1f556c[_0x7e33('0x81')][_0x3284c3][_0x7e33('0x84')]){_0x47bcaa[_0x1f556c[_0x7e33('0x81')][_0x3284c3][_0x7e33('0x33')]](_0x1f556c[_0x7e33('0x81')][_0x3284c3][_0x7e33('0x83')],null,util[_0x7e33('0x7c')](_0x7e33('0x85'),_0x1f556c[_0x7e33('0x76')],_0x1f556c[_0x7e33('0x81')][_0x3284c3][_0x7e33('0x86')],_0x1f556c['joins'][_0x3284c3]['foreignTable'],_0x1f556c[_0x7e33('0x81')][_0x3284c3][_0x7e33('0x84')]));}}}if(_0x1f556c[_0x7e33('0x87')]){_0x1f556c[_0x7e33('0x87')]=JSON[_0x7e33('0x82')](_0x1f556c[_0x7e33('0x87')]);_0x47bcaa[_0x7e33('0x44')](_0x2c0e7b(_0x1f556c[_0x7e33('0x87')][_0x7e33('0x6e')]));}_0x458a5a=_0x47bcaa[_0x7e33('0x88')]();_0x47bcaa['limit'](_0x7022dc);_0x47bcaa['offset'](0x0);logger[_0x7e33('0x89')](_0x7e33('0x8a'),_0x47bcaa[_0x7e33('0x8b')]());return dbH[_0x7e33('0x8c')][_0x7e33('0x36')](_0x47bcaa[_0x7e33('0x8b')](),{'type':dbH[_0x7e33('0x8c')][_0x7e33('0x8d')][_0x7e33('0x8e')]});}})[_0x7e33('0x2a')](respondWithResult(_0x20e656,null))[_0x7e33('0x50')](handleError(_0x20e656,null));};function runReport(_0xf17750,_0x2ac4da,_0x418dae){var _0x8b00b1=_0x2ac4da[_0x7e33('0x2d')];var _0x46af53=0xa;var _0x2de7e0=['join',_0x7e33('0x5b'),_0x7e33('0x5c'),_0x7e33('0x5d')];var _0x3745ab={'SUM':_0x7e33('0x8f'),'COUNT':_0x7e33('0x5e'),'COUNT DISTINCT':_0x7e33('0x5f'),'MAX':'MAX(%s)','MIN':_0x7e33('0x61'),'AVG':_0x7e33('0x62'),'GROUP_CONCAT':_0x7e33('0x90'),'GROUP_CONCAT ASC':_0x7e33('0x91'),'GROUP_CONCAT DESC':_0x7e33('0x63')};var _0x7557ad={'SEC_TO_TIME':_0x7e33('0x64'),'DATE':_0x7e33('0x92'),'HOUR':_0x7e33('0x65'),'ROUND':_0x7e33('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4756e0=function(_0x130706){return!_[_0x7e33('0x68')]([_0x7e33('0x69'),'IS\x20NOT\x20NULL',_0x7e33('0x93'),_0x7e33('0x6b')],_0x130706);};var _0x13334b=function(_0x59f91e){if(!_0x59f91e||!_0x59f91e['rules']['length']){return'';}for(var _0x4b940e='(',_0x27b131=0x0;_0x27b131<_0x59f91e[_0x7e33('0x6c')][_0x7e33('0x3c')];_0x27b131+=0x1){_0x27b131>0x0&&(_0x4b940e+='\x20'+_0x59f91e[_0x7e33('0x6d')]+'\x20');_0x4b940e+=_0x59f91e[_0x7e33('0x6c')][_0x27b131]['group']?_0x13334b(_0x59f91e[_0x7e33('0x6c')][_0x27b131][_0x7e33('0x6e')]):_0x59f91e[_0x7e33('0x6c')][_0x27b131]['field']+'\x20'+_0x59f91e['rules'][_0x27b131][_0x7e33('0x6f')]+(_0x4756e0(_0x59f91e[_0x7e33('0x6c')][_0x27b131][_0x7e33('0x6f')])?'\x20'+_0x59f91e[_0x7e33('0x6c')][_0x27b131]['value']:'');}return _0x4b940e+')';};var _0x2a3176={'where':{'id':_0xf17750['id']}},_0x553326,_0x3727d9,_0x38a03d,_0x190b95,_0x14dac8;_0x2a3176=_['merge']({},_0x2a3176,_0x418dae);return db[_0x7e33('0x47')][_0x7e33('0x4f')](_0x2a3176)[_0x7e33('0x2a')](function(_0x6b089d){if(_0x6b089d){_0x553326=_0x6b089d;return _0x6b089d[_0x7e33('0x94')]();}return null;})[_0x7e33('0x2a')](function(_0x21169d){if(_0x21169d){if(!_0x21169d[_0x7e33('0x3c')]){throw new db[(_0x7e33('0x71'))][(_0x7e33('0x72'))](_0x7e33('0x73'),0x193);}_0x3727d9=_0x21169d;return db[_0x7e33('0x74')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x4809d1){if(_0x4809d1){_0x38a03d=_[_0x7e33('0x95')](_0x4809d1,'id');var _0x1bbd92;var _0x36906e=squel[_0x7e33('0x75')]();_0x36906e['from'](_0x553326['table']);for(var _0x3dd3ca=0x0;_0x3dd3ca<_0x3727d9[_0x7e33('0x3c')];_0x3dd3ca+=0x1){_0x1bbd92=_0x3727d9[_0x3dd3ca][_0x7e33('0x77')]?_0x38a03d[_0x3727d9[_0x3dd3ca][_0x7e33('0x77')]][_0x7e33('0x78')]:_0x3727d9[_0x3dd3ca][_0x7e33('0x79')];_0x1bbd92=_0x3727d9[_0x3dd3ca][_0x7e33('0x7a')]?_[_0x7e33('0x7b')](_0x3745ab[_0x3727d9[_0x3dd3ca][_0x7e33('0x7a')]],'%s',_0x1bbd92):_0x1bbd92;_0x1bbd92=_0x3727d9[_0x3dd3ca][_0x7e33('0x7c')]?_['replace'](_0x7557ad[_0x3727d9[_0x3dd3ca][_0x7e33('0x7c')]],'%s',_0x1bbd92):_0x1bbd92;if(_0x3727d9[_0x3dd3ca][_0x7e33('0x7d')]){_0x36906e[_0x7e33('0x6e')](_0x1bbd92);}_0x3727d9[_0x3dd3ca][_0x7e33('0x7e')]&&_0x36906e[_0x7e33('0x40')](_0x1bbd92,_0x3727d9[_0x3dd3ca]['orderBy']===_0x7e33('0x7f')?![]:!![]);_0x36906e[_0x7e33('0x79')](_0x1bbd92,_0x3727d9[_0x3dd3ca]['alias']||_0x1bbd92);}if(_0x553326[_0x7e33('0x81')]){_0x553326[_0x7e33('0x81')]=JSON['parse'](_0x553326[_0x7e33('0x81')]);for(var _0x3f4113=0x0;_0x3f4113<_0x553326[_0x7e33('0x81')][_0x7e33('0x3c')];_0x3f4113+=0x1){if(_0x553326[_0x7e33('0x81')][_0x3f4113]['type']&&_['includes'](_0x2de7e0,_0x553326['joins'][_0x3f4113][_0x7e33('0x33')])&&_0x553326[_0x7e33('0x81')][_0x3f4113]['parentKey']&&_0x553326['joins'][_0x3f4113][_0x7e33('0x83')]&&_0x553326[_0x7e33('0x81')][_0x3f4113][_0x7e33('0x84')]){_0x36906e[_0x553326[_0x7e33('0x81')][_0x3f4113][_0x7e33('0x33')]](_0x553326[_0x7e33('0x81')][_0x3f4113][_0x7e33('0x83')],null,util[_0x7e33('0x7c')]('%s.%s\x20=\x20%s.%s',_0x553326['table'],_0x553326['joins'][_0x3f4113][_0x7e33('0x86')],_0x553326[_0x7e33('0x81')][_0x3f4113][_0x7e33('0x83')],_0x553326[_0x7e33('0x81')][_0x3f4113][_0x7e33('0x84')]));}}}if(_0x553326[_0x7e33('0x87')]){_0x553326[_0x7e33('0x87')]=JSON[_0x7e33('0x82')](_0x553326[_0x7e33('0x87')]);_0x36906e[_0x7e33('0x44')](_0x13334b(_0x553326['conditions']['group']));}_0x14dac8=_0x36906e[_0x7e33('0x88')]();_0x36906e[_0x7e33('0x3f')](_0x46af53);_0x36906e[_0x7e33('0x1e')](0x0);return;}})[_0x7e33('0x2a')](function(){if(_0x2ac4da['output']===_0x7e33('0x96')){return null;}var _0x450ff3=_['merge'](_0x2ac4da,{'name':_0x2ac4da[_0x7e33('0x97')]||_0x2ac4da[_0x7e33('0x2d')]||_0x553326['name'],'basename':_0x8b00b1,'savename':util[_0x7e33('0x7c')](_0x7e33('0x98'),_0x2ac4da[_0x7e33('0x2d')]||_0x553326[_0x7e33('0x2d')],require('randomstring')[_0x7e33('0x99')](0x4),_0x2ac4da[_0x7e33('0x9a')]||_0x7e33('0x9b')),'reportId':_0x553326['id'],'reportType':'default'});return db[_0x7e33('0x9c')][_0x7e33('0x51')](_0x450ff3,{'raw':!![]});})[_0x7e33('0x2a')](function(_0x49ac72){if(_0x553326['table']===_0x7e33('0x9d')){_0x14dac8[_0x7e33('0x44')](_0x553326['table']+_0x7e33('0x9e'),_0x2ac4da[_0x7e33('0x9f')],_0x2ac4da[_0x7e33('0xa0')]);}else{_0x14dac8['where'](_0x553326[_0x7e33('0x76')]+_0x7e33('0xa1'),_0x2ac4da[_0x7e33('0x9f')],_0x2ac4da[_0x7e33('0xa0')]);}if(_0x49ac72){logger['info'](_0x7e33('0xa2'),_0x14dac8[_0x7e33('0x8b')]());require('child_process')[_0x7e33('0xa3')](path[_0x7e33('0x5a')](__dirname,_0x7e33('0xa4'),_0x49ac72[_0x7e33('0x9a')]),[_0x49ac72['id'],_0x14dac8['toString'](),path[_0x7e33('0x5a')](__dirname,_0x7e33('0xa5'),_0x49ac72[_0x7e33('0xa6')]),_0x8b00b1]);return _0x49ac72;}else{var _0x4c993c=squel['select']();_0x4c993c['from']('('+_0x14dac8['toString']()+')',_0x7e33('0xa7'));_0x4c993c[_0x7e33('0x79')](_0x7e33('0xa8'),'count');_0x14dac8['limit'](_0x2ac4da[_0x7e33('0x3f')]||_0x46af53);_0x14dac8[_0x7e33('0x1e')](_0x2ac4da[_0x7e33('0x1e')]||0x0);return dbH[_0x7e33('0x8c')][_0x7e33('0x36')](_0x4c993c[_0x7e33('0x8b')](),{'type':dbH[_0x7e33('0x8c')][_0x7e33('0x8d')]['SELECT']})[_0x7e33('0x2a')](function(_0x1b4013){if(!_0x1b4013[_0x7e33('0x3c')]){_0x190b95=0x0;}else{_0x190b95=_0x1b4013[0x0][_0x7e33('0x20')]||0x0;}return dbH[_0x7e33('0x8c')][_0x7e33('0x36')](_0x14dac8['toString'](),{'type':dbH['sequelize'][_0x7e33('0x8d')]['SELECT']});})[_0x7e33('0x2a')](function(_0x31090b){return{'rows':_0x31090b||[],'count':_0x190b95};});}});}exports['run']=function(_0x23c6a5,_0x1e40d7){return runReport(_0x23c6a5['params'],_0x23c6a5['query'],_0x23c6a5[_0x7e33('0x4e')])[_0x7e33('0x2a')](respondWithResult(_0x1e40d7,null))[_0x7e33('0x50')](handleError(_0x1e40d7,null));};exports['runReport']=runReport;exports['query']=function(_0x5971d2,_0xef7632){var _0x448d60=0xa;var _0x22c8e5=[_0x7e33('0x5a'),'left_join',_0x7e33('0x5c'),_0x7e33('0x5d')];var _0x5c65ca={'SUM':'SUM(%s)','COUNT':_0x7e33('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x7e33('0x61'),'AVG':_0x7e33('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7e33('0x91'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2bb77d={'SEC_TO_TIME':_0x7e33('0x64'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x7e33('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5e6a5e=function(_0x554d25){return!_[_0x7e33('0x68')](['IS\x20NULL',_0x7e33('0x6a'),_0x7e33('0x93'),_0x7e33('0x6b')],_0x554d25);};var _0x15067d=function(_0x3f1cb5){if(!_0x3f1cb5||!_0x3f1cb5['rules'][_0x7e33('0x3c')]){return'';}for(var _0x1d8385='(',_0xbf99aa=0x0;_0xbf99aa<_0x3f1cb5[_0x7e33('0x6c')]['length'];_0xbf99aa+=0x1){_0xbf99aa>0x0&&(_0x1d8385+='\x20'+_0x3f1cb5['operator']+'\x20');_0x1d8385+=_0x3f1cb5[_0x7e33('0x6c')][_0xbf99aa][_0x7e33('0x6e')]?_0x15067d(_0x3f1cb5[_0x7e33('0x6c')][_0xbf99aa]['group']):_0x3f1cb5[_0x7e33('0x6c')][_0xbf99aa][_0x7e33('0x79')]+'\x20'+_0x3f1cb5['rules'][_0xbf99aa][_0x7e33('0x6f')]+(_0x5e6a5e(_0x3f1cb5[_0x7e33('0x6c')][_0xbf99aa][_0x7e33('0x6f')])?'\x20'+_0x3f1cb5['rules'][_0xbf99aa][_0x7e33('0x70')]:'');}return _0x1d8385+')';};var _0x2453fe={'where':{'id':_0x5971d2[_0x7e33('0x4c')]['id']}},_0x8304d3,_0x55cb31,_0x3b1d21,_0xfb1601,_0x3d4964;_0x2453fe=_[_0x7e33('0x45')]({},_0x2453fe,_0x5971d2[_0x7e33('0x4e')]);return db[_0x7e33('0x47')]['find'](_0x2453fe)[_0x7e33('0x2a')](function(_0x3ed03d){if(_0x3ed03d){_0x8304d3=_0x3ed03d;return _0x3ed03d[_0x7e33('0x94')]();}return null;})['then'](function(_0x3a7169){if(_0x3a7169){if(!_0x3a7169[_0x7e33('0x3c')]){throw new db[(_0x7e33('0x71'))][(_0x7e33('0x72'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x55cb31=_0x3a7169;return db[_0x7e33('0x74')][_0x7e33('0x49')]({'raw':!![]});}return null;})[_0x7e33('0x2a')](function(_0x591901){if(_0x591901){_0x3b1d21=_['keyBy'](_0x591901,'id');var _0x1d75ab;var _0x3d7cc5=squel[_0x7e33('0x75')]();_0x3d7cc5[_0x7e33('0xa9')](_0x8304d3[_0x7e33('0x76')]);for(var _0x35b16b=0x0;_0x35b16b<_0x55cb31[_0x7e33('0x3c')];_0x35b16b+=0x1){_0x1d75ab=_0x55cb31[_0x35b16b][_0x7e33('0x77')]?_0x3b1d21[_0x55cb31[_0x35b16b][_0x7e33('0x77')]][_0x7e33('0x78')]:_0x55cb31[_0x35b16b][_0x7e33('0x79')];_0x1d75ab=_0x55cb31[_0x35b16b][_0x7e33('0x7a')]?_[_0x7e33('0x7b')](_0x5c65ca[_0x55cb31[_0x35b16b][_0x7e33('0x7a')]],'%s',_0x1d75ab):_0x1d75ab;_0x1d75ab=_0x55cb31[_0x35b16b][_0x7e33('0x7c')]?_[_0x7e33('0x7b')](_0x2bb77d[_0x55cb31[_0x35b16b][_0x7e33('0x7c')]],'%s',_0x1d75ab):_0x1d75ab;if(_0x55cb31[_0x35b16b][_0x7e33('0x7d')]){_0x3d7cc5['group'](_0x1d75ab);}_0x55cb31[_0x35b16b][_0x7e33('0x7e')]&&_0x3d7cc5[_0x7e33('0x40')](_0x1d75ab,_0x55cb31[_0x35b16b][_0x7e33('0x7e')]===_0x7e33('0x7f')?![]:!![]);_0x3d7cc5['field'](_0x1d75ab,_0x55cb31[_0x35b16b]['alias']||_0x1d75ab);}if(_0x8304d3[_0x7e33('0x81')]){_0x8304d3[_0x7e33('0x81')]=JSON['parse'](_0x8304d3[_0x7e33('0x81')]);for(var _0xfed2c4=0x0;_0xfed2c4<_0x8304d3[_0x7e33('0x81')][_0x7e33('0x3c')];_0xfed2c4+=0x1){if(_0x8304d3['joins'][_0xfed2c4][_0x7e33('0x33')]&&_[_0x7e33('0x68')](_0x22c8e5,_0x8304d3['joins'][_0xfed2c4][_0x7e33('0x33')])&&_0x8304d3[_0x7e33('0x81')][_0xfed2c4][_0x7e33('0x86')]&&_0x8304d3[_0x7e33('0x81')][_0xfed2c4][_0x7e33('0x83')]&&_0x8304d3[_0x7e33('0x81')][_0xfed2c4]['foreignKey']){_0x3d7cc5[_0x8304d3[_0x7e33('0x81')][_0xfed2c4][_0x7e33('0x33')]](_0x8304d3[_0x7e33('0x81')][_0xfed2c4][_0x7e33('0x83')],null,util['format'](_0x7e33('0x85'),_0x8304d3[_0x7e33('0x76')],_0x8304d3[_0x7e33('0x81')][_0xfed2c4][_0x7e33('0x86')],_0x8304d3[_0x7e33('0x81')][_0xfed2c4]['foreignTable'],_0x8304d3[_0x7e33('0x81')][_0xfed2c4][_0x7e33('0x84')]));}}}if(_0x8304d3[_0x7e33('0x87')]){_0x8304d3['conditions']=JSON[_0x7e33('0x82')](_0x8304d3[_0x7e33('0x87')]);_0x3d7cc5[_0x7e33('0x44')](_0x15067d(_0x8304d3[_0x7e33('0x87')][_0x7e33('0x6e')]));}_0x3d4964=_0x3d7cc5[_0x7e33('0x88')]();_0x3d7cc5[_0x7e33('0x3f')](_0x448d60);_0x3d7cc5['offset'](0x0);logger['debug'](_0x7e33('0x8a'),_0x3d7cc5['toString']());return dbH[_0x7e33('0x8c')]['query'](_0x3d7cc5[_0x7e33('0x8b')](),{'type':dbH['sequelize'][_0x7e33('0x8d')][_0x7e33('0x8e')]});}})['then'](function(){return{'sql':_0x3d4964['toString']()};})[_0x7e33('0x2a')](respondWithResult(_0xef7632,null))['catch'](handleError(_0xef7632,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 0575da7..b0c83cc 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 _0x573a=['api','moment','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','../../config/logger'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x573a,0x82));var _0xa573=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x573a[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xa573('0x0'));var util=require('util');var logger=require(_0xa573('0x1'))(_0xa573('0x2'));var moment=require(_0xa573('0x3'));var BPromise=require(_0xa573('0x4'));var rp=require(_0xa573('0x5'));var fs=require('fs');var path=require(_0xa573('0x6'));var rimraf=require(_0xa573('0x7'));var config=require('../../config/environment');var attributes=require(_0xa573('0x8'));module[_0xa573('0x9')]=function(_0x281922,_0x110d77){return _0x281922[_0xa573('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0xa573('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7290=['../../config/environment','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4755a3,_0x39d17d){var _0x2183b4=function(_0x2b657f){while(--_0x2b657f){_0x4755a3['push'](_0x4755a3['shift']());}};_0x2183b4(++_0x39d17d);}(_0x7290,0x184));var _0x0729=function(_0xf7c208,_0x5cbc84){_0xf7c208=_0xf7c208-0x0;var _0x16992d=_0x7290[_0xf7c208];return _0x16992d;};'use strict';var _=require(_0x0729('0x0'));var util=require(_0x0729('0x1'));var logger=require(_0x0729('0x2'))(_0x0729('0x3'));var moment=require(_0x0729('0x4'));var BPromise=require(_0x0729('0x5'));var rp=require(_0x0729('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0729('0x7'));var config=require(_0x0729('0x8'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x452cdc,_0x1cdf1f){return _0x452cdc[_0x0729('0x9')](_0x0729('0xa'),attributes,{'tableName':_0x0729('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index a69fdb6..44f05a3 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 _0x2a41=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x491c38,_0x2ab353){var _0x8cddde=function(_0x32cb2d){while(--_0x32cb2d){_0x491c38['push'](_0x491c38['shift']());}};_0x8cddde(++_0x2ab353);}(_0x2a41,0x126));var _0x12a4=function(_0x96093f,_0x21ff01){_0x96093f=_0x96093f-0x0;var _0x9cdcb4=_0x2a41[_0x96093f];return _0x9cdcb4;};'use strict';var _=require(_0x12a4('0x0'));var util=require('util');var moment=require(_0x12a4('0x1'));var BPromise=require(_0x12a4('0x2'));var rs=require(_0x12a4('0x3'));var fs=require('fs');var Redis=require(_0x12a4('0x4'));var db=require(_0x12a4('0x5'))['db'];var utils=require(_0x12a4('0x6'));var logger=require(_0x12a4('0x7'))(_0x12a4('0x8'));var config=require(_0x12a4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x12a4('0xa')][_0x12a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58fffc,_0x5d2353,_0x2042cc){return new BPromise(function(_0x5ae867,_0x23bb59){return client[_0x12a4('0xc')](_0x58fffc,_0x2042cc)[_0x12a4('0xd')](function(_0x38d894){logger[_0x12a4('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5d2353,_0x12a4('0xf'));logger[_0x12a4('0x10')](_0x12a4('0x11'),_0x5d2353,_0x12a4('0xf'),JSON[_0x12a4('0x12')](_0x38d894));if(_0x38d894[_0x12a4('0x13')]){if(_0x38d894[_0x12a4('0x13')][_0x12a4('0x14')]===0x1f4){logger[_0x12a4('0x13')](_0x12a4('0x15'),_0x5d2353,_0x38d894[_0x12a4('0x13')][_0x12a4('0x16')]);return _0x23bb59(_0x38d894['error'][_0x12a4('0x16')]);}logger[_0x12a4('0x13')](_0x12a4('0x15'),_0x5d2353,_0x38d894[_0x12a4('0x13')][_0x12a4('0x16')]);return _0x5ae867(_0x38d894['error']['message']);}else{logger[_0x12a4('0xe')](_0x12a4('0x15'),_0x5d2353,_0x12a4('0xf'));_0x5ae867(_0x38d894[_0x12a4('0x17')]['message']);}})[_0x12a4('0x18')](function(_0x28d311){logger[_0x12a4('0x13')](_0x12a4('0x15'),_0x5d2353,_0x28d311);_0x23bb59(_0x28d311);});});} \ No newline at end of file +var _0x5ec6=['AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','debug'];(function(_0x570850,_0x1d763e){var _0x4819b3=function(_0x36617d){while(--_0x36617d){_0x570850['push'](_0x570850['shift']());}};_0x4819b3(++_0x1d763e);}(_0x5ec6,0x7f));var _0x65ec=function(_0x32506d,_0x5434b9){_0x32506d=_0x32506d-0x0;var _0x19c0a4=_0x5ec6[_0x32506d];return _0x19c0a4;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 3c9a075..482a49c 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 _0x5cd0=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','post','create','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5cd0,0xd9));var _0x05cd=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x5cd0[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x05cd('0x0'));var util=require('util');var path=require(_0x05cd('0x1'));var timeout=require(_0x05cd('0x2'));var express=require(_0x05cd('0x3'));var router=express['Router']();var fs_extra=require(_0x05cd('0x4'));var auth=require(_0x05cd('0x5'));var interaction=require(_0x05cd('0x6'));var config=require(_0x05cd('0x7'));var controller=require(_0x05cd('0x8'));router[_0x05cd('0x9')]('/',auth['isAuthenticated'](),controller[_0x05cd('0xa')]);router[_0x05cd('0x9')](_0x05cd('0xb'),auth[_0x05cd('0xc')](),controller[_0x05cd('0xd')]);router[_0x05cd('0x9')](_0x05cd('0xe'),auth[_0x05cd('0xc')](),controller[_0x05cd('0xf')]);router[_0x05cd('0x9')](_0x05cd('0x10'),auth[_0x05cd('0xc')](),controller['run']);router[_0x05cd('0x9')]('/:id/query',auth[_0x05cd('0xc')](),controller['query']);router[_0x05cd('0x11')]('/',auth[_0x05cd('0xc')](),controller[_0x05cd('0x12')]);router['put']('/:id',auth[_0x05cd('0xc')](),controller['update']);router[_0x05cd('0x13')](_0x05cd('0xb'),auth['isAuthenticated'](),controller[_0x05cd('0x14')]);module[_0x05cd('0x15')]=router; \ No newline at end of file +var _0x0cf4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x46bfdd,_0x342b59){var _0x5e42c5=function(_0x4fe725){while(--_0x4fe725){_0x46bfdd['push'](_0x46bfdd['shift']());}};_0x5e42c5(++_0x342b59);}(_0x0cf4,0x97));var _0x40cf=function(_0x47c5bd,_0x7605da){_0x47c5bd=_0x47c5bd-0x0;var _0x2447dc=_0x0cf4[_0x47c5bd];return _0x2447dc;};'use strict';var multer=require(_0x40cf('0x0'));var util=require(_0x40cf('0x1'));var path=require(_0x40cf('0x2'));var timeout=require(_0x40cf('0x3'));var express=require('express');var router=express[_0x40cf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x40cf('0x5'));var interaction=require(_0x40cf('0x6'));var config=require(_0x40cf('0x7'));var controller=require(_0x40cf('0x8'));router['get']('/',auth[_0x40cf('0x9')](),controller[_0x40cf('0xa')]);router[_0x40cf('0xb')](_0x40cf('0xc'),auth[_0x40cf('0x9')](),controller[_0x40cf('0xd')]);router[_0x40cf('0xb')](_0x40cf('0xe'),auth[_0x40cf('0x9')](),controller[_0x40cf('0xf')]);router[_0x40cf('0xb')](_0x40cf('0x10'),auth[_0x40cf('0x9')](),controller[_0x40cf('0x11')]);router[_0x40cf('0xb')](_0x40cf('0x12'),auth[_0x40cf('0x9')](),controller[_0x40cf('0x13')]);router[_0x40cf('0x14')]('/',auth[_0x40cf('0x9')](),controller[_0x40cf('0x15')]);router[_0x40cf('0x16')](_0x40cf('0xc'),auth[_0x40cf('0x9')](),controller['update']);router[_0x40cf('0x17')]('/:id',auth[_0x40cf('0x9')](),controller[_0x40cf('0x18')]);module[_0x40cf('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 255d8bf..b10bdfd 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 _0x30b6=['STRING','ENUM','csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0x30b6,0x165));var _0x630b=function(_0x5e8c98,_0xf42c9c){_0x5e8c98=_0x5e8c98-0x0;var _0x487a2a=_0x30b6[_0x5e8c98];return _0x487a2a;};'use strict';var Sequelize=require(_0x630b('0x0'));var moment=require(_0x630b('0x1'));module[_0x630b('0x2')]={'name':{'type':Sequelize[_0x630b('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x630b('0x4')](_0x630b('0x5'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x630b('0x5')},'savename':{'type':Sequelize[_0x630b('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x630b('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x630b('0x3')],'defaultValue':_0x630b('0x7')},'type':{'type':Sequelize[_0x630b('0x4')](_0x630b('0x8'),_0x630b('0x9')),'allowNull':![],'defaultValue':_0x630b('0x8')},'reportId':{'type':Sequelize[_0x630b('0xa')](0xb)[_0x630b('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf6bb=['INTEGER','sequelize','moment','exports','STRING','ENUM','xlsx','csv','DATE','Loading','manual','scheduled'];(function(_0x494a38,_0x1a7af2){var _0x17144f=function(_0x5df7e5){while(--_0x5df7e5){_0x494a38['push'](_0x494a38['shift']());}};_0x17144f(++_0x1a7af2);}(_0xf6bb,0x85));var _0xbf6b=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0xf6bb[_0x18d631];return _0x50d708;};'use strict';var Sequelize=require(_0xbf6b('0x0'));var moment=require(_0xbf6b('0x1'));module[_0xbf6b('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xbf6b('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xbf6b('0x4')]('csv','pdf',_0xbf6b('0x5')),'allowNull':![],'defaultValue':_0xbf6b('0x6')},'savename':{'type':Sequelize[_0xbf6b('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xbf6b('0x7')]},'endDate':{'type':Sequelize[_0xbf6b('0x7')]},'status':{'type':Sequelize[_0xbf6b('0x3')],'defaultValue':_0xbf6b('0x8')},'type':{'type':Sequelize[_0xbf6b('0x4')](_0xbf6b('0x9'),_0xbf6b('0xa')),'allowNull':![],'defaultValue':_0xbf6b('0x9')},'reportId':{'type':Sequelize[_0xbf6b('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xbf6b('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 5d62509..87eb419 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 _0xae60=['UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','join','root','server/files/reports','savename','Report\x20not\x20found\x20or\x20empty','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','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/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','get','ExtractedReports'];(function(_0x28c1e5,_0x454fd5){var _0x5698f8=function(_0x38646b){while(--_0x38646b){_0x28c1e5['push'](_0x28c1e5['shift']());}};_0x5698f8(++_0x454fd5);}(_0xae60,0x1c7));var _0x0ae6=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xae60[_0x1da527];return _0x40fc7c;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];function respondWithStatusCode(_0x3b05a4,_0x30f8f9){_0x30f8f9=_0x30f8f9||0xcc;return function(_0x1aefd5){if(_0x1aefd5){return _0x3b05a4[_0x0ae6('0x1c')](_0x30f8f9);}return _0x3b05a4[_0x0ae6('0x1d')](_0x30f8f9)[_0x0ae6('0x1e')]();};}function respondWithResult(_0x4d2da8,_0x3809c6){_0x3809c6=_0x3809c6||0xc8;return function(_0x10c3bc){if(_0x10c3bc){return _0x4d2da8[_0x0ae6('0x1d')](_0x3809c6)[_0x0ae6('0x1f')](_0x10c3bc);}};}function respondWithFilteredResult(_0xce3e23,_0x3a1e26){return function(_0x151144){if(_0x151144){var _0x3b64ac=typeof _0x3a1e26[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x3a1e26[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xa97151=_0x151144[_0x0ae6('0x23')];var _0xda4f01=_0x3b64ac?0x0:_0x3a1e26[_0x0ae6('0x20')];var _0x2fdf25=_0x3b64ac?_0x151144[_0x0ae6('0x23')]:_0x3a1e26[_0x0ae6('0x20')]+_0x3a1e26[_0x0ae6('0x22')];var _0x26b369;if(_0x2fdf25>=_0xa97151){_0x2fdf25=_0xa97151;_0x26b369=0xc8;}else{_0x26b369=0xce;}_0xce3e23[_0x0ae6('0x1d')](_0x26b369);return _0xce3e23['set'](_0x0ae6('0x24'),_0xda4f01+'-'+_0x2fdf25+'/'+_0xa97151)[_0x0ae6('0x1f')](_0x151144);}return null;};}function patchUpdates(_0x140a3b){return function(_0x1027c2){try{jsonpatch[_0x0ae6('0x25')](_0x1027c2,_0x140a3b,!![]);}catch(_0xb4e6af){return BPromise[_0x0ae6('0x26')](_0xb4e6af);}return _0x1027c2[_0x0ae6('0x27')]();};}function saveUpdates(_0x515f3d,_0x39b22e){return function(_0x2a6484){if(_0x2a6484){return _0x2a6484[_0x0ae6('0x28')](_0x515f3d)[_0x0ae6('0x29')](function(_0x31ad85){return _0x31ad85;});}return null;};}function removeEntity(_0x4eba72,_0x296a9d){return function(_0x4e1242){if(_0x4e1242){return _0x4e1242[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){var _0x3c43d8=_0x4e1242[_0x0ae6('0x2b')]({'plain':!![]});var _0x5b86fe=_0x0ae6('0x2c');return db[_0x0ae6('0x2d')]['destroy']({'where':{'type':_0x5b86fe,'resourceId':_0x3c43d8['id']}})['then'](function(){return _0x4e1242;});})[_0x0ae6('0x29')](function(){_0x4eba72[_0x0ae6('0x1d')](0xcc)[_0x0ae6('0x1e')]();});}};}function handleEntityNotFound(_0x4fe77b,_0x3b5f8f){return function(_0xb68cbe){if(!_0xb68cbe){_0x4fe77b[_0x0ae6('0x1c')](0x194);}return _0xb68cbe;};}function handleError(_0x4df796,_0x2428b2){_0x2428b2=_0x2428b2||0x1f4;return function(_0x29fef3){logger[_0x0ae6('0x2e')](_0x29fef3[_0x0ae6('0x2f')]);if(_0x29fef3[_0x0ae6('0x30')]){delete _0x29fef3[_0x0ae6('0x30')];}_0x4df796['status'](_0x2428b2)['send'](_0x29fef3);};}exports[_0x0ae6('0x31')]=function(_0x419384,_0x4e6df8){var _0x4a06f1={},_0x1ca059={},_0x278577={'count':0x0,'rows':[]};var _0x714c6d=_[_0x0ae6('0x32')](db['AnalyticExtractedReport'][_0x0ae6('0x33')],function(_0x429f06){return{'name':_0x429f06[_0x0ae6('0x34')],'type':_0x429f06['type'][_0x0ae6('0x35')]};});_0x1ca059[_0x0ae6('0x36')]=_[_0x0ae6('0x32')](_0x714c6d,_0x0ae6('0x30'));_0x1ca059[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x419384[_0x0ae6('0x37')]);_0x1ca059[_0x0ae6('0x39')]=_[_0x0ae6('0x3a')](_0x1ca059[_0x0ae6('0x36')],_0x1ca059['query']);_0x4a06f1[_0x0ae6('0x3b')]=_[_0x0ae6('0x3a')](_0x1ca059['model'],qs[_0x0ae6('0x3c')](_0x419384[_0x0ae6('0x37')][_0x0ae6('0x3c')]));_0x4a06f1['attributes']=_0x4a06f1[_0x0ae6('0x3b')]['length']?_0x4a06f1['attributes']:_0x1ca059[_0x0ae6('0x36')];if(!_0x419384[_0x0ae6('0x37')][_0x0ae6('0x3d')](_0x0ae6('0x3e'))){_0x4a06f1[_0x0ae6('0x22')]=qs['limit'](_0x419384['query'][_0x0ae6('0x22')]);_0x4a06f1['offset']=qs[_0x0ae6('0x20')](_0x419384['query'][_0x0ae6('0x20')]);}_0x4a06f1['order']=qs[_0x0ae6('0x3f')](_0x419384[_0x0ae6('0x37')][_0x0ae6('0x3f')]);_0x4a06f1[_0x0ae6('0x40')]=qs['filters'](_['pick'](_0x419384[_0x0ae6('0x37')],_0x1ca059[_0x0ae6('0x39')]),_0x714c6d);if(_0x419384[_0x0ae6('0x37')]['filter']){_0x4a06f1[_0x0ae6('0x40')]=_['merge'](_0x4a06f1[_0x0ae6('0x40')],{'$or':_[_0x0ae6('0x32')](_0x714c6d,function(_0x460e3f){if(_0x460e3f[_0x0ae6('0x41')]!==_0x0ae6('0x42')){var _0x1f8258={};_0x1f8258[_0x460e3f['name']]={'$like':'%'+_0x419384[_0x0ae6('0x37')][_0x0ae6('0x43')]+'%'};return _0x1f8258;}})});}_0x4a06f1=_[_0x0ae6('0x44')]({},_0x4a06f1,_0x419384[_0x0ae6('0x45')]);var _0x1ad562={'where':_0x4a06f1[_0x0ae6('0x40')]};return db[_0x0ae6('0x46')][_0x0ae6('0x23')](_0x1ad562)['then'](function(_0x38faeb){_0x278577[_0x0ae6('0x23')]=_0x38faeb;if(_0x419384[_0x0ae6('0x37')][_0x0ae6('0x47')]){_0x4a06f1[_0x0ae6('0x48')]=[{'all':!![]}];}return db[_0x0ae6('0x46')][_0x0ae6('0x49')](_0x4a06f1);})[_0x0ae6('0x29')](function(_0xb38cbb){_0x278577[_0x0ae6('0x4a')]=_0xb38cbb;return _0x278577;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x4e6df8,_0x4a06f1))[_0x0ae6('0x4b')](handleError(_0x4e6df8,null));};exports[_0x0ae6('0x4c')]=function(_0x85d9ce,_0x201e95){var _0x16d225={'raw':!![],'where':{'id':_0x85d9ce[_0x0ae6('0x4d')]['id']}},_0x4235de={};_0x4235de['model']=_[_0x0ae6('0x38')](db[_0x0ae6('0x46')][_0x0ae6('0x33')]);_0x4235de[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x85d9ce[_0x0ae6('0x37')]);_0x4235de['filters']=_[_0x0ae6('0x3a')](_0x4235de[_0x0ae6('0x36')],_0x4235de[_0x0ae6('0x37')]);_0x16d225[_0x0ae6('0x3b')]=_['intersection'](_0x4235de['model'],qs['fields'](_0x85d9ce[_0x0ae6('0x37')][_0x0ae6('0x3c')]));_0x16d225[_0x0ae6('0x3b')]=_0x16d225['attributes'][_0x0ae6('0x4e')]?_0x16d225[_0x0ae6('0x3b')]:_0x4235de['model'];if(_0x85d9ce[_0x0ae6('0x37')][_0x0ae6('0x47')]){_0x16d225['include']=[{'all':!![]}];}_0x16d225=_[_0x0ae6('0x44')]({},_0x16d225,_0x85d9ce[_0x0ae6('0x45')]);return db['AnalyticExtractedReport'][_0x0ae6('0x4f')](_0x16d225)[_0x0ae6('0x29')](handleEntityNotFound(_0x201e95,null))[_0x0ae6('0x29')](respondWithResult(_0x201e95,null))['catch'](handleError(_0x201e95,null));};exports[_0x0ae6('0x50')]=function(_0x21de54,_0x46075a){return db[_0x0ae6('0x46')][_0x0ae6('0x50')](_0x21de54[_0x0ae6('0x51')],{})[_0x0ae6('0x29')](function(_0x5ababa){var _0x5afd3b=_0x21de54[_0x0ae6('0x52')][_0x0ae6('0x2b')]({'plain':!![]});if(!_0x5afd3b)throw new Error(_0x0ae6('0x53'));if(_0x5afd3b['role']===_0x0ae6('0x52')){var _0x51df5c=_0x5ababa['get']({'plain':!![]});var _0x23454a=_0x0ae6('0x2c');return db[_0x0ae6('0x54')]['find']({'where':{'name':_0x23454a,'userProfileId':_0x5afd3b[_0x0ae6('0x55')]},'raw':!![]})[_0x0ae6('0x29')](function(_0x31a4db){if(_0x31a4db&&_0x31a4db[_0x0ae6('0x56')]===0x0){return db[_0x0ae6('0x2d')][_0x0ae6('0x50')]({'name':_0x51df5c[_0x0ae6('0x30')],'resourceId':_0x51df5c['id'],'type':_0x31a4db[_0x0ae6('0x30')],'sectionId':_0x31a4db['id']},{})[_0x0ae6('0x29')](function(){return _0x5ababa;});}else{return _0x5ababa;}})[_0x0ae6('0x4b')](function(_0x1cc515){logger[_0x0ae6('0x2e')](_0x0ae6('0x57'),_0x1cc515);throw _0x1cc515;});}return _0x5ababa;})[_0x0ae6('0x29')](respondWithResult(_0x46075a,0xc9))[_0x0ae6('0x4b')](handleError(_0x46075a,null));};exports['update']=function(_0x4cbe19,_0x30a9f1){if(_0x4cbe19[_0x0ae6('0x51')]['id']){delete _0x4cbe19[_0x0ae6('0x51')]['id'];}return db[_0x0ae6('0x46')][_0x0ae6('0x4f')]({'where':{'id':_0x4cbe19[_0x0ae6('0x4d')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x30a9f1,null))[_0x0ae6('0x29')](saveUpdates(_0x4cbe19[_0x0ae6('0x51')],null))[_0x0ae6('0x29')](respondWithResult(_0x30a9f1,null))[_0x0ae6('0x4b')](handleError(_0x30a9f1,null));};exports[_0x0ae6('0x2a')]=function(_0x16a311,_0x2babcc){return db[_0x0ae6('0x46')][_0x0ae6('0x4f')]({'where':{'id':_0x16a311[_0x0ae6('0x4d')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x2babcc,null))['then'](removeEntity(_0x2babcc,null))[_0x0ae6('0x4b')](handleError(_0x2babcc,null));};exports[_0x0ae6('0x58')]=function(_0x15191e,_0x578125,_0x2648de){return db[_0x0ae6('0x46')][_0x0ae6('0x4f')]({'where':{'id':_0x15191e[_0x0ae6('0x4d')]['id']},'attributes':[_0x0ae6('0x30'),_0x0ae6('0x59'),'savename',_0x0ae6('0x5a')],'raw':!![]})[_0x0ae6('0x29')](handleEntityNotFound(_0x578125,null))[_0x0ae6('0x29')](function(_0xd2cec5){if(_0xd2cec5){if(!fs[_0x0ae6('0x5b')](path[_0x0ae6('0x5c')](config[_0x0ae6('0x5d')],_0x0ae6('0x5e'),_0xd2cec5[_0x0ae6('0x5f')]))){throw new db['Sequelize']['ValidationError'](_0x0ae6('0x60'));}if(_0x15191e[_0x0ae6('0x37')]['exists']){return _0x578125['sendStatus'](0xc8);}return _0x578125[_0x0ae6('0x58')](path[_0x0ae6('0x5c')](config[_0x0ae6('0x5d')],_0x0ae6('0x5e'),_0xd2cec5[_0x0ae6('0x5f')]),util[_0x0ae6('0x61')](_0x0ae6('0x62'),_0xd2cec5['basename']||_0xd2cec5[_0x0ae6('0x30')],_0xd2cec5['output'][_0x0ae6('0x63')]()));}})[_0x0ae6('0x4b')](handleError(_0x578125,null));}; \ No newline at end of file +var _0x9354=['get','ExtractedReports','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','map','VIRTUAL','filter','merge','options','AnalyticExtractedReport','include','findAll','catch','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','format','%s.%s','toLowerCase','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','update','then','destroy'];(function(_0x2365fa,_0x53b99d){var _0x61e010=function(_0x17009f){while(--_0x17009f){_0x2365fa['push'](_0x2365fa['shift']());}};_0x61e010(++_0x53b99d);}(_0x9354,0x96));var _0x4935=function(_0x26d26f,_0x302cce){_0x26d26f=_0x26d26f-0x0;var _0x5c8c0e=_0x9354[_0x26d26f];return _0x5c8c0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4935('0x0'));var zipdir=require(_0x4935('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4935('0x2'));var moment=require(_0x4935('0x3'));var BPromise=require(_0x4935('0x4'));var Mustache=require(_0x4935('0x5'));var util=require('util');var path=require(_0x4935('0x6'));var sox=require(_0x4935('0x7'));var csv=require(_0x4935('0x8'));var ejs=require(_0x4935('0x9'));var fs=require('fs');var fs_extra=require(_0x4935('0xa'));var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x8'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4935('0x16'))['db'];function respondWithStatusCode(_0x32916f,_0x3bb388){_0x3bb388=_0x3bb388||0xcc;return function(_0x1c6c22){if(_0x1c6c22){return _0x32916f[_0x4935('0x17')](_0x3bb388);}return _0x32916f[_0x4935('0x18')](_0x3bb388)[_0x4935('0x19')]();};}function respondWithResult(_0x3a7c30,_0x57549f){_0x57549f=_0x57549f||0xc8;return function(_0x237e28){if(_0x237e28){return _0x3a7c30[_0x4935('0x18')](_0x57549f)[_0x4935('0x1a')](_0x237e28);}};}function respondWithFilteredResult(_0xa41961,_0x3652c4){return function(_0x24cc99){if(_0x24cc99){var _0x395a43=typeof _0x3652c4['offset']===_0x4935('0x1b')&&typeof _0x3652c4[_0x4935('0x1c')]===_0x4935('0x1b');var _0x123300=_0x24cc99[_0x4935('0x1d')];var _0x429ef3=_0x395a43?0x0:_0x3652c4['offset'];var _0xd70eff=_0x395a43?_0x24cc99[_0x4935('0x1d')]:_0x3652c4['offset']+_0x3652c4[_0x4935('0x1c')];var _0x10407f;if(_0xd70eff>=_0x123300){_0xd70eff=_0x123300;_0x10407f=0xc8;}else{_0x10407f=0xce;}_0xa41961[_0x4935('0x18')](_0x10407f);return _0xa41961['set']('Content-Range',_0x429ef3+'-'+_0xd70eff+'/'+_0x123300)[_0x4935('0x1a')](_0x24cc99);}return null;};}function patchUpdates(_0x6b849f){return function(_0x1ae059){try{jsonpatch[_0x4935('0x1e')](_0x1ae059,_0x6b849f,!![]);}catch(_0x41d76e){return BPromise[_0x4935('0x1f')](_0x41d76e);}return _0x1ae059[_0x4935('0x20')]();};}function saveUpdates(_0xe482a5,_0x58b2f3){return function(_0x2f520a){if(_0x2f520a){return _0x2f520a[_0x4935('0x21')](_0xe482a5)[_0x4935('0x22')](function(_0x2c701f){return _0x2c701f;});}return null;};}function removeEntity(_0x52c65a,_0x53530f){return function(_0x4dc1f5){if(_0x4dc1f5){return _0x4dc1f5[_0x4935('0x23')]()[_0x4935('0x22')](function(){var _0x3786ff=_0x4dc1f5[_0x4935('0x24')]({'plain':!![]});var _0x344e51=_0x4935('0x25');return db[_0x4935('0x26')][_0x4935('0x23')]({'where':{'type':_0x344e51,'resourceId':_0x3786ff['id']}})[_0x4935('0x22')](function(){return _0x4dc1f5;});})[_0x4935('0x22')](function(){_0x52c65a[_0x4935('0x18')](0xcc)[_0x4935('0x19')]();});}};}function handleEntityNotFound(_0x2c47ab,_0xbb00d6){return function(_0x359522){if(!_0x359522){_0x2c47ab['sendStatus'](0x194);}return _0x359522;};}function handleError(_0x5c3aaa,_0x5cec4d){_0x5cec4d=_0x5cec4d||0x1f4;return function(_0x1fc218){logger[_0x4935('0x27')](_0x1fc218['stack']);if(_0x1fc218[_0x4935('0x28')]){delete _0x1fc218[_0x4935('0x28')];}_0x5c3aaa[_0x4935('0x18')](_0x5cec4d)[_0x4935('0x29')](_0x1fc218);};}exports[_0x4935('0x2a')]=function(_0x24262e,_0x28afc2){var _0x2fe6da={},_0x5b3c8e={},_0xb7fe2a={'count':0x0,'rows':[]};var _0x2dcb0b=_['map'](db['AnalyticExtractedReport'][_0x4935('0x2b')],function(_0x479d28){return{'name':_0x479d28[_0x4935('0x2c')],'type':_0x479d28[_0x4935('0x2d')][_0x4935('0x2e')]};});_0x5b3c8e['model']=_['map'](_0x2dcb0b,_0x4935('0x28'));_0x5b3c8e[_0x4935('0x2f')]=_['keys'](_0x24262e[_0x4935('0x2f')]);_0x5b3c8e[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5b3c8e[_0x4935('0x32')],_0x5b3c8e[_0x4935('0x2f')]);_0x2fe6da['attributes']=_['intersection'](_0x5b3c8e[_0x4935('0x32')],qs[_0x4935('0x33')](_0x24262e['query']['fields']));_0x2fe6da[_0x4935('0x34')]=_0x2fe6da['attributes'][_0x4935('0x35')]?_0x2fe6da[_0x4935('0x34')]:_0x5b3c8e[_0x4935('0x32')];if(!_0x24262e[_0x4935('0x2f')][_0x4935('0x36')](_0x4935('0x37'))){_0x2fe6da['limit']=qs[_0x4935('0x1c')](_0x24262e['query'][_0x4935('0x1c')]);_0x2fe6da['offset']=qs[_0x4935('0x38')](_0x24262e['query'][_0x4935('0x38')]);}_0x2fe6da[_0x4935('0x39')]=qs[_0x4935('0x3a')](_0x24262e[_0x4935('0x2f')][_0x4935('0x3a')]);_0x2fe6da[_0x4935('0x3b')]=qs[_0x4935('0x30')](_['pick'](_0x24262e['query'],_0x5b3c8e[_0x4935('0x30')]),_0x2dcb0b);if(_0x24262e['query']['filter']){_0x2fe6da[_0x4935('0x3b')]=_['merge'](_0x2fe6da[_0x4935('0x3b')],{'$or':_[_0x4935('0x3c')](_0x2dcb0b,function(_0x2d67e3){if(_0x2d67e3[_0x4935('0x2d')]!==_0x4935('0x3d')){var _0x53aac5={};_0x53aac5[_0x2d67e3['name']]={'$like':'%'+_0x24262e[_0x4935('0x2f')][_0x4935('0x3e')]+'%'};return _0x53aac5;}})});}_0x2fe6da=_[_0x4935('0x3f')]({},_0x2fe6da,_0x24262e[_0x4935('0x40')]);var _0x4d9436={'where':_0x2fe6da[_0x4935('0x3b')]};return db[_0x4935('0x41')][_0x4935('0x1d')](_0x4d9436)['then'](function(_0x4e94f6){_0xb7fe2a[_0x4935('0x1d')]=_0x4e94f6;if(_0x24262e[_0x4935('0x2f')]['includeAll']){_0x2fe6da[_0x4935('0x42')]=[{'all':!![]}];}return db[_0x4935('0x41')][_0x4935('0x43')](_0x2fe6da);})[_0x4935('0x22')](function(_0x52ab0c){_0xb7fe2a['rows']=_0x52ab0c;return _0xb7fe2a;})[_0x4935('0x22')](respondWithFilteredResult(_0x28afc2,_0x2fe6da))[_0x4935('0x44')](handleError(_0x28afc2,null));};exports['show']=function(_0x1eaa47,_0x40f5ff){var _0x2195da={'raw':!![],'where':{'id':_0x1eaa47[_0x4935('0x45')]['id']}},_0x5135fd={};_0x5135fd[_0x4935('0x32')]=_[_0x4935('0x46')](db[_0x4935('0x41')][_0x4935('0x2b')]);_0x5135fd[_0x4935('0x2f')]=_[_0x4935('0x46')](_0x1eaa47[_0x4935('0x2f')]);_0x5135fd[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],_0x5135fd[_0x4935('0x2f')]);_0x2195da[_0x4935('0x34')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],qs[_0x4935('0x33')](_0x1eaa47[_0x4935('0x2f')][_0x4935('0x33')]));_0x2195da['attributes']=_0x2195da[_0x4935('0x34')]['length']?_0x2195da[_0x4935('0x34')]:_0x5135fd[_0x4935('0x32')];if(_0x1eaa47[_0x4935('0x2f')][_0x4935('0x47')]){_0x2195da['include']=[{'all':!![]}];}_0x2195da=_[_0x4935('0x3f')]({},_0x2195da,_0x1eaa47[_0x4935('0x40')]);return db[_0x4935('0x41')][_0x4935('0x48')](_0x2195da)[_0x4935('0x22')](handleEntityNotFound(_0x40f5ff,null))[_0x4935('0x22')](respondWithResult(_0x40f5ff,null))[_0x4935('0x44')](handleError(_0x40f5ff,null));};exports[_0x4935('0x49')]=function(_0x29b932,_0x392cba){return db['AnalyticExtractedReport'][_0x4935('0x49')](_0x29b932[_0x4935('0x4a')],{})['then'](function(_0x447a64){var _0x2636f4=_0x29b932[_0x4935('0x4b')][_0x4935('0x24')]({'plain':!![]});if(!_0x2636f4)throw new Error(_0x4935('0x4c'));if(_0x2636f4[_0x4935('0x4d')]===_0x4935('0x4b')){var _0x471fb1=_0x447a64['get']({'plain':!![]});var _0x57d0d9='ExtractedReports';return db['UserProfileSection'][_0x4935('0x48')]({'where':{'name':_0x57d0d9,'userProfileId':_0x2636f4[_0x4935('0x4e')]},'raw':!![]})[_0x4935('0x22')](function(_0x2072df){if(_0x2072df&&_0x2072df[_0x4935('0x4f')]===0x0){return db['UserProfileResource'][_0x4935('0x49')]({'name':_0x471fb1[_0x4935('0x28')],'resourceId':_0x471fb1['id'],'type':_0x2072df[_0x4935('0x28')],'sectionId':_0x2072df['id']},{})[_0x4935('0x22')](function(){return _0x447a64;});}else{return _0x447a64;}})[_0x4935('0x44')](function(_0x8196b4){logger[_0x4935('0x27')](_0x4935('0x50'),_0x8196b4);throw _0x8196b4;});}return _0x447a64;})[_0x4935('0x22')](respondWithResult(_0x392cba,0xc9))[_0x4935('0x44')](handleError(_0x392cba,null));};exports['update']=function(_0x24b83b,_0x4e99bb){if(_0x24b83b[_0x4935('0x4a')]['id']){delete _0x24b83b[_0x4935('0x4a')]['id'];}return db['AnalyticExtractedReport'][_0x4935('0x48')]({'where':{'id':_0x24b83b['params']['id']}})['then'](handleEntityNotFound(_0x4e99bb,null))['then'](saveUpdates(_0x24b83b[_0x4935('0x4a')],null))[_0x4935('0x22')](respondWithResult(_0x4e99bb,null))[_0x4935('0x44')](handleError(_0x4e99bb,null));};exports[_0x4935('0x23')]=function(_0xd5a489,_0x56db7f){return db['AnalyticExtractedReport'][_0x4935('0x48')]({'where':{'id':_0xd5a489[_0x4935('0x45')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x56db7f,null))['then'](removeEntity(_0x56db7f,null))[_0x4935('0x44')](handleError(_0x56db7f,null));};exports[_0x4935('0x51')]=function(_0x24141a,_0xc92288,_0x5009c9){return db[_0x4935('0x41')]['find']({'where':{'id':_0x24141a['params']['id']},'attributes':['name',_0x4935('0x52'),_0x4935('0x53'),'output'],'raw':!![]})[_0x4935('0x22')](handleEntityNotFound(_0xc92288,null))[_0x4935('0x22')](function(_0x57b448){if(_0x57b448){if(!fs[_0x4935('0x54')](path[_0x4935('0x55')](config[_0x4935('0x56')],_0x4935('0x57'),_0x57b448[_0x4935('0x53')]))){throw new db[(_0x4935('0x58'))][(_0x4935('0x59'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x24141a[_0x4935('0x2f')]['exists']){return _0xc92288['sendStatus'](0xc8);}return _0xc92288[_0x4935('0x51')](path[_0x4935('0x55')](config['root'],'server/files/reports',_0x57b448[_0x4935('0x53')]),util[_0x4935('0x5a')](_0x4935('0x5b'),_0x57b448['basename']||_0x57b448[_0x4935('0x28')],_0x57b448['output'][_0x4935('0x5c')]()));}})[_0x4935('0x44')](handleError(_0xc92288,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index c55aa60..9479d21 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 _0xe3c0=['request-promise','path','rimraf','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','bluebird'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xe3c0,0x1b5));var _0x0e3c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe3c0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0e3c('0x0'));var util=require(_0x0e3c('0x1'));var logger=require(_0x0e3c('0x2'))(_0x0e3c('0x3'));var moment=require('moment');var BPromise=require(_0x0e3c('0x4'));var rp=require(_0x0e3c('0x5'));var fs=require('fs');var path=require(_0x0e3c('0x6'));var rimraf=require(_0x0e3c('0x7'));var config=require(_0x0e3c('0x8'));var attributes=require('./analyticExtractedReport.attributes');module[_0x0e3c('0x9')]=function(_0xda741b,_0x16befc){return _0xda741b[_0x0e3c('0xa')](_0x0e3c('0xb'),attributes,{'tableName':_0x0e3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12d3=['../../config/logger','api','moment','request-promise','path','rimraf','exports','lodash','util'];(function(_0x663bc9,_0x4c17dd){var _0x1e89f9=function(_0x581637){while(--_0x581637){_0x663bc9['push'](_0x663bc9['shift']());}};_0x1e89f9(++_0x4c17dd);}(_0x12d3,0x181));var _0x312d=function(_0x4ca69a,_0x591e2d){_0x4ca69a=_0x4ca69a-0x0;var _0x5b3431=_0x12d3[_0x4ca69a];return _0x5b3431;};'use strict';var _=require(_0x312d('0x0'));var util=require(_0x312d('0x1'));var logger=require(_0x312d('0x2'))(_0x312d('0x3'));var moment=require(_0x312d('0x4'));var BPromise=require('bluebird');var rp=require(_0x312d('0x5'));var fs=require('fs');var path=require(_0x312d('0x6'));var rimraf=require(_0x312d('0x7'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x312d('0x8')]=function(_0x298aca,_0x3f1d9c){return _0x298aca['define']('AnalyticExtractedReport',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 9315d37..8c348ec 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 _0x8ae9=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','request\x20sent','code','message','error','result','lodash','util'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0x8ae9,0x19c));var _0x98ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ae9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x98ae('0x0'));var util=require(_0x98ae('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98ae('0x2'));var db=require(_0x98ae('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x98ae('0x4'));var config=require(_0x98ae('0x5'));var jayson=require(_0x98ae('0x6'));var client=jayson[_0x98ae('0x7')][_0x98ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6c2a51,_0x4fcc94,_0x106f50){return new BPromise(function(_0x5b01d8,_0x5d3288){return client['request'](_0x6c2a51,_0x106f50)[_0x98ae('0x9')](function(_0x2e9257){logger[_0x98ae('0xa')](_0x98ae('0xb'),_0x4fcc94,'request\x20sent');logger[_0x98ae('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x4fcc94,_0x98ae('0xd'),JSON['stringify'](_0x2e9257));if(_0x2e9257['error']){if(_0x2e9257['error'][_0x98ae('0xe')]===0x1f4){logger['error'](_0x98ae('0xb'),_0x4fcc94,_0x2e9257['error'][_0x98ae('0xf')]);return _0x5d3288(_0x2e9257['error']['message']);}logger['error'](_0x98ae('0xb'),_0x4fcc94,_0x2e9257[_0x98ae('0x10')][_0x98ae('0xf')]);return _0x5b01d8(_0x2e9257[_0x98ae('0x10')][_0x98ae('0xf')]);}else{logger[_0x98ae('0xa')](_0x98ae('0xb'),_0x4fcc94,_0x98ae('0xd'));_0x5b01d8(_0x2e9257[_0x98ae('0x11')][_0x98ae('0xf')]);}})['catch'](function(_0x328416){logger[_0x98ae('0x10')](_0x98ae('0xb'),_0x4fcc94,_0x328416);_0x5d3288(_0x328416);});});} \ No newline at end of file +var _0x4d0d=['AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x15fe68,_0xddc145){var _0x1d144c=function(_0x408370){while(--_0x408370){_0x15fe68['push'](_0x15fe68['shift']());}};_0x1d144c(++_0xddc145);}(_0x4d0d,0xfb));var _0xd4d0=function(_0x340e56,_0x214e33){_0x340e56=_0x340e56-0x0;var _0x395db4=_0x4d0d[_0x340e56];return _0x395db4;};'use strict';var _=require(_0xd4d0('0x0'));var util=require(_0xd4d0('0x1'));var moment=require(_0xd4d0('0x2'));var BPromise=require(_0xd4d0('0x3'));var rs=require(_0xd4d0('0x4'));var fs=require('fs');var Redis=require(_0xd4d0('0x5'));var db=require(_0xd4d0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd4d0('0x7'));var config=require(_0xd4d0('0x8'));var jayson=require(_0xd4d0('0x9'));var client=jayson[_0xd4d0('0xa')][_0xd4d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51a815,_0x51325f,_0x35e2be){return new BPromise(function(_0x4e2c9f,_0x3d137d){return client['request'](_0x51a815,_0x35e2be)[_0xd4d0('0xc')](function(_0x507033){logger['info'](_0xd4d0('0xd'),_0x51325f,'request\x20sent');logger[_0xd4d0('0xe')](_0xd4d0('0xf'),_0x51325f,'request\x20sent',JSON[_0xd4d0('0x10')](_0x507033));if(_0x507033[_0xd4d0('0x11')]){if(_0x507033[_0xd4d0('0x11')][_0xd4d0('0x12')]===0x1f4){logger[_0xd4d0('0x11')](_0xd4d0('0xd'),_0x51325f,_0x507033[_0xd4d0('0x11')]['message']);return _0x3d137d(_0x507033[_0xd4d0('0x11')][_0xd4d0('0x13')]);}logger[_0xd4d0('0x11')](_0xd4d0('0xd'),_0x51325f,_0x507033[_0xd4d0('0x11')][_0xd4d0('0x13')]);return _0x4e2c9f(_0x507033[_0xd4d0('0x11')][_0xd4d0('0x13')]);}else{logger['info'](_0xd4d0('0xd'),_0x51325f,_0xd4d0('0x14'));_0x4e2c9f(_0x507033['result'][_0xd4d0('0x13')]);}})[_0xd4d0('0x15')](function(_0x268051){logger[_0xd4d0('0x11')](_0xd4d0('0xd'),_0x51325f,_0x268051);_0x3d137d(_0x268051);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index b9965db..7a7f006 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 _0x4417=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','update'];(function(_0x5a88f4,_0x9af41f){var _0x8b43c8=function(_0x5be85a){while(--_0x5be85a){_0x5a88f4['push'](_0x5a88f4['shift']());}};_0x8b43c8(++_0x9af41f);}(_0x4417,0xf5));var _0x7441=function(_0x51e068,_0xa3f10a){_0x51e068=_0x51e068-0x0;var _0x22c5f2=_0x4417[_0x51e068];return _0x22c5f2;};'use strict';var multer=require(_0x7441('0x0'));var util=require(_0x7441('0x1'));var path=require(_0x7441('0x2'));var timeout=require(_0x7441('0x3'));var express=require(_0x7441('0x4'));var router=express[_0x7441('0x5')]();var fs_extra=require(_0x7441('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7441('0x7'));var config=require(_0x7441('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x7441('0x9')]('/',auth['isAuthenticated'](),controller[_0x7441('0xa')]);router[_0x7441('0x9')](_0x7441('0xb'),auth[_0x7441('0xc')](),controller[_0x7441('0xd')]);router['get'](_0x7441('0xe'),auth['isAuthenticated'](),controller[_0x7441('0xf')]);router[_0x7441('0x10')]('/',auth['isAuthenticated'](),controller[_0x7441('0x11')]);router['put'](_0x7441('0xb'),auth[_0x7441('0xc')](),controller[_0x7441('0x12')]);router[_0x7441('0x13')](_0x7441('0xb'),auth[_0x7441('0xc')](),controller[_0x7441('0x14')]);module[_0x7441('0x15')]=router; \ No newline at end of file +var _0xc701=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','post','create','put','/:id','delete'];(function(_0x4eeb77,_0x544fe7){var _0x48ca01=function(_0x13655a){while(--_0x13655a){_0x4eeb77['push'](_0x4eeb77['shift']());}};_0x48ca01(++_0x544fe7);}(_0xc701,0xd4));var _0x1c70=function(_0x34ea22,_0x1270b3){_0x34ea22=_0x34ea22-0x0;var _0x1ca470=_0xc701[_0x34ea22];return _0x1ca470;};'use strict';var multer=require(_0x1c70('0x0'));var util=require(_0x1c70('0x1'));var path=require(_0x1c70('0x2'));var timeout=require(_0x1c70('0x3'));var express=require('express');var router=express[_0x1c70('0x4')]();var fs_extra=require(_0x1c70('0x5'));var auth=require(_0x1c70('0x6'));var interaction=require(_0x1c70('0x7'));var config=require('../../config/environment');var controller=require(_0x1c70('0x8'));router[_0x1c70('0x9')]('/',auth[_0x1c70('0xa')](),controller[_0x1c70('0xb')]);router[_0x1c70('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1c70('0xc')]);router['get'](_0x1c70('0xd'),auth[_0x1c70('0xa')](),controller['download']);router[_0x1c70('0xe')]('/',auth[_0x1c70('0xa')](),controller[_0x1c70('0xf')]);router[_0x1c70('0x10')](_0x1c70('0x11'),auth[_0x1c70('0xa')](),controller['update']);router[_0x1c70('0x12')](_0x1c70('0x11'),auth[_0x1c70('0xa')](),controller[_0x1c70('0x13')]);module[_0x1c70('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 94ad682..08fbbbc 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 _0xe14b=['sequelize','exports','STRING'];(function(_0x26e4ea,_0x2906dd){var _0x4117c5=function(_0x102143){while(--_0x102143){_0x26e4ea['push'](_0x26e4ea['shift']());}};_0x4117c5(++_0x2906dd);}(_0xe14b,0x93));var _0xbe14=function(_0x335dfc,_0x3db2e8){_0x335dfc=_0x335dfc-0x0;var _0x10602f=_0xe14b[_0x335dfc];return _0x10602f;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x23a363,_0x3a6f90){var _0x3daf23=function(_0x446d1a){while(--_0x446d1a){_0x23a363['push'](_0x23a363['shift']());}};_0x3daf23(++_0x3a6f90);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x5fc3[_0x5b7788];return _0x573871;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'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 2bb5b1e..7c942c4 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 _0xa9e0=['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','AnalyticFieldReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','show','params','find','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','eml-format','rimraf','zip-dir','moment','mustache'];(function(_0xb0ed0c,_0x1a1fb1){var _0x5d5356=function(_0x562be0){while(--_0x562be0){_0xb0ed0c['push'](_0xb0ed0c['shift']());}};_0x5d5356(++_0x1a1fb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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['AnalyticFieldReport'][_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('0x45')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x28')]['bulkCreate'](_0x45c845[_0x0a9e('0x44')],{'raw':![],'individualHooks':!![]})[_0x0a9e('0x22')](respondWithResult(_0x37be73,0xc9))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x21')]=function(_0x409789,_0x992c77){if(_0x409789[_0x0a9e('0x44')]['id']){delete _0x409789[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x409789[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x992c77,null))['then'](saveUpdates(_0x409789['body'],null))['then'](respondWithResult(_0x992c77,null))[_0x0a9e('0x40')](handleError(_0x992c77,null));};exports[_0x0a9e('0x23')]=function(_0x37edaa,_0x11545a){return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x37edaa[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x11545a,null))['then'](removeEntity(_0x11545a,null))['catch'](handleError(_0x11545a,null));};exports['bulkDestroy']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x28')]['destroy']({'where':{'id':_0x39d77d[_0x0a9e('0x2e')][_0x0a9e('0x46')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x204173,0xcc))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x47')]=function(_0x59c6ff,_0x443e72,_0x4c3845){return db[_0x0a9e('0x48')][_0x0a9e('0x49')]({'where':{'id':_0x59c6ff[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x443e72,null))[_0x0a9e('0x22')](function(_0x1bf38a){if(_0x1bf38a){return db['sequelize']['transaction'](function(_0x128aa6){return db[_0x0a9e('0x28')]['destroy']({'where':{'CustomReportId':_0x59c6ff[_0x0a9e('0x42')]['id']},'transaction':_0x128aa6})['then'](function(_0x211ef9){var _0x523cd2=_[_0x0a9e('0x2d')](_0x59c6ff['body'],function(_0x5da27d){delete _0x5da27d['id'];_0x5da27d['CustomReportId']=_0x59c6ff[_0x0a9e('0x42')]['id'];return _0x5da27d;});return db['AnalyticFieldReport'][_0x0a9e('0x45')](_0x523cd2,{'transaction':_0x128aa6});});})[_0x0a9e('0x22')](function(){return db[_0x0a9e('0x28')][_0x0a9e('0x3f')]({'where':{'CustomReportId':_0x59c6ff[_0x0a9e('0x42')]['id']}});});}})[_0x0a9e('0x22')](respondWithResult(_0x443e72,null))[_0x0a9e('0x40')](handleError(_0x443e72,null));}; \ No newline at end of file +var _0xa9e0=['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','AnalyticFieldReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','show','params','find','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','eml-format','rimraf','zip-dir','moment','mustache'];(function(_0x3e7bb8,_0x11f26c){var _0x160bf4=function(_0xbc65a5){while(--_0xbc65a5){_0x3e7bb8['push'](_0x3e7bb8['shift']());}};_0x160bf4(++_0x11f26c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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['AnalyticFieldReport'][_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('0x45')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x28')]['bulkCreate'](_0x45c845[_0x0a9e('0x44')],{'raw':![],'individualHooks':!![]})[_0x0a9e('0x22')](respondWithResult(_0x37be73,0xc9))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x21')]=function(_0x409789,_0x992c77){if(_0x409789[_0x0a9e('0x44')]['id']){delete _0x409789[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x409789[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x992c77,null))['then'](saveUpdates(_0x409789['body'],null))['then'](respondWithResult(_0x992c77,null))[_0x0a9e('0x40')](handleError(_0x992c77,null));};exports[_0x0a9e('0x23')]=function(_0x37edaa,_0x11545a){return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x37edaa[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x11545a,null))['then'](removeEntity(_0x11545a,null))['catch'](handleError(_0x11545a,null));};exports['bulkDestroy']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x28')]['destroy']({'where':{'id':_0x39d77d[_0x0a9e('0x2e')][_0x0a9e('0x46')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x204173,0xcc))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x47')]=function(_0x59c6ff,_0x443e72,_0x4c3845){return db[_0x0a9e('0x48')][_0x0a9e('0x49')]({'where':{'id':_0x59c6ff[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x443e72,null))[_0x0a9e('0x22')](function(_0x1bf38a){if(_0x1bf38a){return db['sequelize']['transaction'](function(_0x128aa6){return db[_0x0a9e('0x28')]['destroy']({'where':{'CustomReportId':_0x59c6ff[_0x0a9e('0x42')]['id']},'transaction':_0x128aa6})['then'](function(_0x211ef9){var _0x523cd2=_[_0x0a9e('0x2d')](_0x59c6ff['body'],function(_0x5da27d){delete _0x5da27d['id'];_0x5da27d['CustomReportId']=_0x59c6ff[_0x0a9e('0x42')]['id'];return _0x5da27d;});return db['AnalyticFieldReport'][_0x0a9e('0x45')](_0x523cd2,{'transaction':_0x128aa6});});})[_0x0a9e('0x22')](function(){return db[_0x0a9e('0x28')][_0x0a9e('0x3f')]({'where':{'CustomReportId':_0x59c6ff[_0x0a9e('0x42')]['id']}});});}})[_0x0a9e('0x22')](respondWithResult(_0x443e72,null))[_0x0a9e('0x40')](handleError(_0x443e72,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 55fb4a8..a07bce9 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 _0x9043=['AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define'];(function(_0x924693,_0x2e3fb8){var _0xd1a0b1=function(_0x288d35){while(--_0x288d35){_0x924693['push'](_0x924693['shift']());}};_0xd1a0b1(++_0x2e3fb8);}(_0x9043,0x17b));var _0x3904=function(_0x7c7490,_0x45f70b){_0x7c7490=_0x7c7490-0x0;var _0x1a93a5=_0x9043[_0x7c7490];return _0x1a93a5;};'use strict';var _=require(_0x3904('0x0'));var util=require('util');var logger=require(_0x3904('0x1'))(_0x3904('0x2'));var moment=require(_0x3904('0x3'));var BPromise=require('bluebird');var rp=require(_0x3904('0x4'));var fs=require('fs');var path=require(_0x3904('0x5'));var rimraf=require(_0x3904('0x6'));var config=require(_0x3904('0x7'));var attributes=require(_0x3904('0x8'));module[_0x3904('0x9')]=function(_0x5ec160,_0x5e1e5f){return _0x5ec160[_0x3904('0xa')](_0x3904('0xb'),attributes,{'tableName':_0x3904('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd71a=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd71a,0xb5));var _0xad71=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd71a[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xad71('0x0'));var util=require(_0xad71('0x1'));var logger=require(_0xad71('0x2'))(_0xad71('0x3'));var moment=require(_0xad71('0x4'));var BPromise=require('bluebird');var rp=require(_0xad71('0x5'));var fs=require('fs');var path=require(_0xad71('0x6'));var rimraf=require('rimraf');var config=require(_0xad71('0x7'));var attributes=require(_0xad71('0x8'));module[_0xad71('0x9')]=function(_0x2cbb1a,_0x19ad37){return _0x2cbb1a[_0xad71('0xa')](_0xad71('0xb'),attributes,{'tableName':_0xad71('0xc'),'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 cd5331f..8c5f5eb 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 _0x81f3=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','AnalyticFieldReport,\x20%s,\x20%s','message','info'];(function(_0x52c119,_0x3e0ea6){var _0x7a003d=function(_0x48f099){while(--_0x48f099){_0x52c119['push'](_0x52c119['shift']());}};_0x7a003d(++_0x3e0ea6);}(_0x81f3,0x120));var _0x381f=function(_0x59ee12,_0x54422c){_0x59ee12=_0x59ee12-0x0;var _0x38bb3c=_0x81f3[_0x59ee12];return _0x38bb3c;};'use strict';var _=require('lodash');var util=require(_0x381f('0x0'));var moment=require(_0x381f('0x1'));var BPromise=require(_0x381f('0x2'));var rs=require(_0x381f('0x3'));var fs=require('fs');var Redis=require(_0x381f('0x4'));var db=require(_0x381f('0x5'))['db'];var utils=require(_0x381f('0x6'));var logger=require(_0x381f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x381f('0x8'));var client=jayson[_0x381f('0x9')][_0x381f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1752d1,_0xec051,_0x18d826){return new BPromise(function(_0x46057a,_0x2683ee){return client[_0x381f('0xb')](_0x1752d1,_0x18d826)[_0x381f('0xc')](function(_0x573b27){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0xec051,_0x381f('0xd'));logger[_0x381f('0xe')](_0x381f('0xf'),_0xec051,_0x381f('0xd'),JSON['stringify'](_0x573b27));if(_0x573b27['error']){if(_0x573b27[_0x381f('0x10')]['code']===0x1f4){logger[_0x381f('0x10')](_0x381f('0x11'),_0xec051,_0x573b27[_0x381f('0x10')][_0x381f('0x12')]);return _0x2683ee(_0x573b27[_0x381f('0x10')][_0x381f('0x12')]);}logger[_0x381f('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0xec051,_0x573b27[_0x381f('0x10')][_0x381f('0x12')]);return _0x46057a(_0x573b27[_0x381f('0x10')][_0x381f('0x12')]);}else{logger[_0x381f('0x13')](_0x381f('0x11'),_0xec051,_0x381f('0xd'));_0x46057a(_0x573b27[_0x381f('0x14')][_0x381f('0x12')]);}})[_0x381f('0x15')](function(_0x1b0f39){logger[_0x381f('0x10')](_0x381f('0x11'),_0xec051,_0x1b0f39);_0x2683ee(_0x1b0f39);});});} \ No newline at end of file +var _0x3804=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x3804,0xfc));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4380('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4380('0x1'));var rs=require(_0x4380('0x2'));var fs=require('fs');var Redis=require(_0x4380('0x3'));var db=require(_0x4380('0x4'))['db'];var utils=require(_0x4380('0x5'));var logger=require('../../config/logger')(_0x4380('0x6'));var config=require(_0x4380('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4380('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49ba8d,_0x19c72a,_0x23375d){return new BPromise(function(_0x5ddd40,_0x2227e1){return client[_0x4380('0x9')](_0x49ba8d,_0x23375d)[_0x4380('0xa')](function(_0x51c05a){logger[_0x4380('0xb')](_0x4380('0xc'),_0x19c72a,'request\x20sent');logger[_0x4380('0xd')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x19c72a,_0x4380('0xe'),JSON[_0x4380('0xf')](_0x51c05a));if(_0x51c05a[_0x4380('0x10')]){if(_0x51c05a[_0x4380('0x10')][_0x4380('0x11')]===0x1f4){logger['error'](_0x4380('0xc'),_0x19c72a,_0x51c05a['error'][_0x4380('0x12')]);return _0x2227e1(_0x51c05a[_0x4380('0x10')][_0x4380('0x12')]);}logger[_0x4380('0x10')](_0x4380('0xc'),_0x19c72a,_0x51c05a[_0x4380('0x10')][_0x4380('0x12')]);return _0x5ddd40(_0x51c05a[_0x4380('0x10')][_0x4380('0x12')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x19c72a,_0x4380('0xe'));_0x5ddd40(_0x51c05a[_0x4380('0x13')][_0x4380('0x12')]);}})[_0x4380('0x14')](function(_0x203b17){logger[_0x4380('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x19c72a,_0x203b17);_0x2227e1(_0x203b17);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index a1206ac..17a82e6 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 _0x8923=['create','/create_many','bulkCreate','/:id/create_many','addFields','put','update','/destroy_many','bulkDestroy','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','/:id','show','post'];(function(_0x6aad74,_0x32ecf4){var _0x5b1c38=function(_0x567477){while(--_0x567477){_0x6aad74['push'](_0x6aad74['shift']());}};_0x5b1c38(++_0x32ecf4);}(_0x8923,0x1e6));var _0x3892=function(_0x160f79,_0x5e5b73){_0x160f79=_0x160f79-0x0;var _0x353a9d=_0x8923[_0x160f79];return _0x353a9d;};'use strict';var multer=require(_0x3892('0x0'));var util=require(_0x3892('0x1'));var path=require('path');var timeout=require(_0x3892('0x2'));var express=require(_0x3892('0x3'));var router=express[_0x3892('0x4')]();var fs_extra=require(_0x3892('0x5'));var auth=require(_0x3892('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3892('0x7'));var controller=require(_0x3892('0x8'));router[_0x3892('0x9')]('/',auth[_0x3892('0xa')](),controller['index']);router[_0x3892('0x9')](_0x3892('0xb'),auth['isAuthenticated'](),controller[_0x3892('0xc')]);router[_0x3892('0xd')]('/',auth[_0x3892('0xa')](),controller[_0x3892('0xe')]);router['post'](_0x3892('0xf'),auth[_0x3892('0xa')](),controller[_0x3892('0x10')]);router[_0x3892('0xd')](_0x3892('0x11'),auth[_0x3892('0xa')](),controller[_0x3892('0x12')]);router[_0x3892('0x13')](_0x3892('0xb'),auth[_0x3892('0xa')](),controller[_0x3892('0x14')]);router['delete'](_0x3892('0x15'),auth[_0x3892('0xa')](),controller[_0x3892('0x16')]);router[_0x3892('0x17')](_0x3892('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x3892('0x18')]=router; \ No newline at end of file +var _0xd915=['addFields','put','update','/destroy_many','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','index','/:id','isAuthenticated','post','create','bulkCreate'];(function(_0x4e5167,_0x387992){var _0x1b8cf8=function(_0x423b96){while(--_0x423b96){_0x4e5167['push'](_0x4e5167['shift']());}};_0x1b8cf8(++_0x387992);}(_0xd915,0x157));var _0x5d91=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xd915[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x5d91('0x0'));var util=require(_0x5d91('0x1'));var path=require(_0x5d91('0x2'));var timeout=require(_0x5d91('0x3'));var express=require(_0x5d91('0x4'));var router=express[_0x5d91('0x5')]();var fs_extra=require(_0x5d91('0x6'));var auth=require(_0x5d91('0x7'));var interaction=require(_0x5d91('0x8'));var config=require(_0x5d91('0x9'));var controller=require(_0x5d91('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x5d91('0xb')]);router['get'](_0x5d91('0xc'),auth[_0x5d91('0xd')](),controller['show']);router[_0x5d91('0xe')]('/',auth[_0x5d91('0xd')](),controller[_0x5d91('0xf')]);router[_0x5d91('0xe')]('/create_many',auth[_0x5d91('0xd')](),controller[_0x5d91('0x10')]);router[_0x5d91('0xe')]('/:id/create_many',auth[_0x5d91('0xd')](),controller[_0x5d91('0x11')]);router[_0x5d91('0x12')]('/:id',auth[_0x5d91('0xd')](),controller[_0x5d91('0x13')]);router['delete'](_0x5d91('0x14'),auth[_0x5d91('0xd')](),controller['bulkDestroy']);router[_0x5d91('0x15')](_0x5d91('0xc'),auth[_0x5d91('0xd')](),controller[_0x5d91('0x16')]);module[_0x5d91('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index baecd87..8376c98 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 _0xd813=['TEXT','STRING','name'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd813,0x19c));var _0x3d81=function(_0x5206fc,_0x2eec61){_0x5206fc=_0x5206fc-0x0;var _0x12acf6=_0xd813[_0x5206fc];return _0x12acf6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3d81('0x0')],'allowNull':![],'unique':_0x3d81('0x1')},'table':{'type':Sequelize[_0x3d81('0x0')]},'metric':{'type':Sequelize[_0x3d81('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x285b=['TEXT','sequelize','STRING','name'];(function(_0x12c47e,_0x9ca93d){var _0xf62834=function(_0x28bbdb){while(--_0x28bbdb){_0x12c47e['push'](_0x12c47e['shift']());}};_0xf62834(++_0x9ca93d);}(_0x285b,0x171));var _0xb285=function(_0x4c344d,_0x356caa){_0x4c344d=_0x4c344d-0x0;var _0x168874=_0x285b[_0x4c344d];return _0x168874;};'use strict';var Sequelize=require(_0xb285('0x0'));module['exports']={'name':{'type':Sequelize[_0xb285('0x1')],'allowNull':![],'unique':_0xb285('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xb285('0x3')]},'description':{'type':Sequelize[_0xb285('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 0471988..b050326 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 _0xc888=['AnalyticMetric','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','keys','length','includeAll','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map'];(function(_0xfd7bf3,_0xe195ee){var _0x5e2969=function(_0x316290){while(--_0x316290){_0xfd7bf3['push'](_0xfd7bf3['shift']());}};_0x5e2969(++_0xe195ee);}(_0xc888,0xd2));var _0x8c88=function(_0x20e40d,_0x2a9f0f){_0x20e40d=_0x20e40d-0x0;var _0x558350=_0xc888[_0x20e40d];return _0x558350;};'use strict';var emlformat=require(_0x8c88('0x0'));var rimraf=require(_0x8c88('0x1'));var zipdir=require(_0x8c88('0x2'));var jsonpatch=require(_0x8c88('0x3'));var rp=require(_0x8c88('0x4'));var moment=require(_0x8c88('0x5'));var BPromise=require(_0x8c88('0x6'));var Mustache=require(_0x8c88('0x7'));var util=require(_0x8c88('0x8'));var path=require('path');var sox=require(_0x8c88('0x9'));var csv=require(_0x8c88('0xa'));var ejs=require(_0x8c88('0xb'));var fs=require('fs');var fs_extra=require(_0x8c88('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8c88('0xd'));var jsforce=require(_0x8c88('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8c88('0xa'));var querystring=require(_0x8c88('0xf'));var Papa=require(_0x8c88('0x10'));var Redis=require('ioredis');var authService=require(_0x8c88('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8c88('0x12'));var hardwareService=require(_0x8c88('0x13'));var logger=require('../../config/logger')(_0x8c88('0x14'));var utils=require('../../config/utils');var config=require(_0x8c88('0x15'));var licenseUtil=require(_0x8c88('0x16'));var db=require(_0x8c88('0x17'))['db'];function respondWithStatusCode(_0x4f15b5,_0x376f4d){_0x376f4d=_0x376f4d||0xcc;return function(_0x3e351c){if(_0x3e351c){return _0x4f15b5[_0x8c88('0x18')](_0x376f4d);}return _0x4f15b5[_0x8c88('0x19')](_0x376f4d)[_0x8c88('0x1a')]();};}function respondWithResult(_0x3c12f0,_0x38bba1){_0x38bba1=_0x38bba1||0xc8;return function(_0x217f99){if(_0x217f99){return _0x3c12f0[_0x8c88('0x19')](_0x38bba1)[_0x8c88('0x1b')](_0x217f99);}};}function respondWithFilteredResult(_0x2ae057,_0x442e68){return function(_0x2261ea){if(_0x2261ea){var _0x5c1ca2=typeof _0x442e68[_0x8c88('0x1c')]===_0x8c88('0x1d')&&typeof _0x442e68['limit']==='undefined';var _0x144c35=_0x2261ea[_0x8c88('0x1e')];var _0x452078=_0x5c1ca2?0x0:_0x442e68[_0x8c88('0x1c')];var _0xce88f3=_0x5c1ca2?_0x2261ea['count']:_0x442e68[_0x8c88('0x1c')]+_0x442e68[_0x8c88('0x1f')];var _0x12b4aa;if(_0xce88f3>=_0x144c35){_0xce88f3=_0x144c35;_0x12b4aa=0xc8;}else{_0x12b4aa=0xce;}_0x2ae057[_0x8c88('0x19')](_0x12b4aa);return _0x2ae057[_0x8c88('0x20')](_0x8c88('0x21'),_0x452078+'-'+_0xce88f3+'/'+_0x144c35)[_0x8c88('0x1b')](_0x2261ea);}return null;};}function patchUpdates(_0x424c9a){return function(_0x5650ed){try{jsonpatch[_0x8c88('0x22')](_0x5650ed,_0x424c9a,!![]);}catch(_0x48b4fd){return BPromise[_0x8c88('0x23')](_0x48b4fd);}return _0x5650ed[_0x8c88('0x24')]();};}function saveUpdates(_0x3eca7a,_0x5e5e80){return function(_0x4f4b9b){if(_0x4f4b9b){return _0x4f4b9b[_0x8c88('0x25')](_0x3eca7a)[_0x8c88('0x26')](function(_0x3a3bea){return _0x3a3bea;});}return null;};}function removeEntity(_0x5d5102,_0xe0e2c9){return function(_0x14d6b0){if(_0x14d6b0){return _0x14d6b0[_0x8c88('0x27')]()[_0x8c88('0x26')](function(){var _0x100285=_0x14d6b0[_0x8c88('0x28')]({'plain':!![]});var _0x412e61=_0x8c88('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x412e61,'resourceId':_0x100285['id']}})['then'](function(){return _0x14d6b0;});})[_0x8c88('0x26')](function(){_0x5d5102['status'](0xcc)[_0x8c88('0x1a')]();});}};}function handleEntityNotFound(_0x7af501,_0xd431b9){return function(_0x531b38){if(!_0x531b38){_0x7af501[_0x8c88('0x18')](0x194);}return _0x531b38;};}function handleError(_0x50aced,_0x55c13a){_0x55c13a=_0x55c13a||0x1f4;return function(_0x2f5597){logger[_0x8c88('0x2a')](_0x2f5597[_0x8c88('0x2b')]);if(_0x2f5597[_0x8c88('0x2c')]){delete _0x2f5597[_0x8c88('0x2c')];}_0x50aced['status'](_0x55c13a)[_0x8c88('0x2d')](_0x2f5597);};}exports[_0x8c88('0x2e')]=function(_0x4bc504,_0x794c54){var _0x3b8c60={},_0x2e86af={},_0x30583f={'count':0x0,'rows':[]};var _0x5e270a=_[_0x8c88('0x2f')](db[_0x8c88('0x30')]['rawAttributes'],function(_0x4a6130){return{'name':_0x4a6130[_0x8c88('0x31')],'type':_0x4a6130[_0x8c88('0x32')][_0x8c88('0x33')]};});_0x2e86af[_0x8c88('0x34')]=_[_0x8c88('0x2f')](_0x5e270a,_0x8c88('0x2c'));_0x2e86af['query']=_['keys'](_0x4bc504[_0x8c88('0x35')]);_0x2e86af[_0x8c88('0x36')]=_['intersection'](_0x2e86af[_0x8c88('0x34')],_0x2e86af['query']);_0x3b8c60[_0x8c88('0x37')]=_[_0x8c88('0x38')](_0x2e86af[_0x8c88('0x34')],qs[_0x8c88('0x39')](_0x4bc504[_0x8c88('0x35')]['fields']));_0x3b8c60[_0x8c88('0x37')]=_0x3b8c60['attributes']['length']?_0x3b8c60[_0x8c88('0x37')]:_0x2e86af[_0x8c88('0x34')];if(!_0x4bc504['query'][_0x8c88('0x3a')](_0x8c88('0x3b'))){_0x3b8c60[_0x8c88('0x1f')]=qs[_0x8c88('0x1f')](_0x4bc504[_0x8c88('0x35')][_0x8c88('0x1f')]);_0x3b8c60['offset']=qs['offset'](_0x4bc504[_0x8c88('0x35')][_0x8c88('0x1c')]);}_0x3b8c60[_0x8c88('0x3c')]=qs[_0x8c88('0x3d')](_0x4bc504[_0x8c88('0x35')][_0x8c88('0x3d')]);_0x3b8c60[_0x8c88('0x3e')]=qs['filters'](_['pick'](_0x4bc504[_0x8c88('0x35')],_0x2e86af[_0x8c88('0x36')]),_0x5e270a);if(_0x4bc504['query'][_0x8c88('0x3f')]){_0x3b8c60[_0x8c88('0x3e')]=_[_0x8c88('0x40')](_0x3b8c60['where'],{'$or':_[_0x8c88('0x2f')](_0x5e270a,function(_0x473396){if(_0x473396[_0x8c88('0x32')]!==_0x8c88('0x41')){var _0x1e9b78={};_0x1e9b78[_0x473396[_0x8c88('0x2c')]]={'$like':'%'+_0x4bc504[_0x8c88('0x35')]['filter']+'%'};return _0x1e9b78;}})});}_0x3b8c60=_[_0x8c88('0x40')]({},_0x3b8c60,_0x4bc504[_0x8c88('0x42')]);var _0x1560b8={'where':_0x3b8c60[_0x8c88('0x3e')]};return db['AnalyticMetric'][_0x8c88('0x1e')](_0x1560b8)[_0x8c88('0x26')](function(_0x317ee6){_0x30583f['count']=_0x317ee6;if(_0x4bc504[_0x8c88('0x35')]['includeAll']){_0x3b8c60[_0x8c88('0x43')]=[{'all':!![]}];}return db[_0x8c88('0x30')][_0x8c88('0x44')](_0x3b8c60);})[_0x8c88('0x26')](function(_0x48b466){_0x30583f[_0x8c88('0x45')]=_0x48b466;return _0x30583f;})['then'](respondWithFilteredResult(_0x794c54,_0x3b8c60))[_0x8c88('0x46')](handleError(_0x794c54,null));};exports[_0x8c88('0x47')]=function(_0x3da186,_0x459f79){var _0x1fd214={'raw':!![],'where':{'id':_0x3da186['params']['id']}},_0x1a46cd={};_0x1a46cd[_0x8c88('0x34')]=_['keys'](db[_0x8c88('0x30')][_0x8c88('0x48')]);_0x1a46cd[_0x8c88('0x35')]=_[_0x8c88('0x49')](_0x3da186[_0x8c88('0x35')]);_0x1a46cd[_0x8c88('0x36')]=_[_0x8c88('0x38')](_0x1a46cd['model'],_0x1a46cd[_0x8c88('0x35')]);_0x1fd214[_0x8c88('0x37')]=_[_0x8c88('0x38')](_0x1a46cd[_0x8c88('0x34')],qs[_0x8c88('0x39')](_0x3da186[_0x8c88('0x35')][_0x8c88('0x39')]));_0x1fd214[_0x8c88('0x37')]=_0x1fd214[_0x8c88('0x37')][_0x8c88('0x4a')]?_0x1fd214[_0x8c88('0x37')]:_0x1a46cd[_0x8c88('0x34')];if(_0x3da186[_0x8c88('0x35')][_0x8c88('0x4b')]){_0x1fd214[_0x8c88('0x43')]=[{'all':!![]}];}_0x1fd214=_[_0x8c88('0x40')]({},_0x1fd214,_0x3da186['options']);return db[_0x8c88('0x30')][_0x8c88('0x4c')](_0x1fd214)[_0x8c88('0x26')](handleEntityNotFound(_0x459f79,null))[_0x8c88('0x26')](respondWithResult(_0x459f79,null))[_0x8c88('0x46')](handleError(_0x459f79,null));};exports[_0x8c88('0x4d')]=function(_0x2d8f80,_0x292747){return db[_0x8c88('0x30')][_0x8c88('0x4d')](_0x2d8f80['body'],{})['then'](function(_0x19b004){var _0x115db5=_0x2d8f80[_0x8c88('0x4e')]['get']({'plain':!![]});if(!_0x115db5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x115db5[_0x8c88('0x4f')]===_0x8c88('0x4e')){var _0x4cd7ad=_0x19b004[_0x8c88('0x28')]({'plain':!![]});var _0x5584b9=_0x8c88('0x29');return db[_0x8c88('0x50')][_0x8c88('0x4c')]({'where':{'name':_0x5584b9,'userProfileId':_0x115db5[_0x8c88('0x51')]},'raw':!![]})[_0x8c88('0x26')](function(_0x2bd76c){if(_0x2bd76c&&_0x2bd76c[_0x8c88('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x4cd7ad['name'],'resourceId':_0x4cd7ad['id'],'type':_0x2bd76c[_0x8c88('0x2c')],'sectionId':_0x2bd76c['id']},{})[_0x8c88('0x26')](function(){return _0x19b004;});}else{return _0x19b004;}})[_0x8c88('0x46')](function(_0x4a220c){logger[_0x8c88('0x2a')](_0x8c88('0x53'),_0x4a220c);throw _0x4a220c;});}return _0x19b004;})[_0x8c88('0x26')](respondWithResult(_0x292747,0xc9))[_0x8c88('0x46')](handleError(_0x292747,null));};exports[_0x8c88('0x25')]=function(_0x32823d,_0x822ca7){if(_0x32823d['body']['id']){delete _0x32823d[_0x8c88('0x54')]['id'];}return db[_0x8c88('0x30')][_0x8c88('0x4c')]({'where':{'id':_0x32823d['params']['id']}})[_0x8c88('0x26')](handleEntityNotFound(_0x822ca7,null))[_0x8c88('0x26')](saveUpdates(_0x32823d[_0x8c88('0x54')],null))[_0x8c88('0x26')](respondWithResult(_0x822ca7,null))['catch'](handleError(_0x822ca7,null));};exports[_0x8c88('0x27')]=function(_0x300a56,_0x13cab6){return db['AnalyticMetric']['find']({'where':{'id':_0x300a56[_0x8c88('0x55')]['id']}})[_0x8c88('0x26')](handleEntityNotFound(_0x13cab6,null))[_0x8c88('0x26')](removeEntity(_0x13cab6,null))[_0x8c88('0x46')](handleError(_0x13cab6,null));}; \ No newline at end of file +var _0xdd85=['apply','reject','then','destroy','Metrics','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','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','update','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x494030,_0x54ae1c){var _0x91ba2d=function(_0x5445e9){while(--_0x5445e9){_0x494030['push'](_0x494030['shift']());}};_0x91ba2d(++_0x54ae1c);}(_0xdd85,0x89));var _0x5dd8=function(_0x268d1f,_0x56182d){_0x268d1f=_0x268d1f-0x0;var _0x33cba7=_0xdd85[_0x268d1f];return _0x33cba7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dd8('0x0'));var zipdir=require(_0x5dd8('0x1'));var jsonpatch=require(_0x5dd8('0x2'));var rp=require(_0x5dd8('0x3'));var moment=require(_0x5dd8('0x4'));var BPromise=require(_0x5dd8('0x5'));var Mustache=require(_0x5dd8('0x6'));var util=require(_0x5dd8('0x7'));var path=require('path');var sox=require(_0x5dd8('0x8'));var csv=require(_0x5dd8('0x9'));var ejs=require(_0x5dd8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5dd8('0xb'));var squel=require(_0x5dd8('0xc'));var crypto=require(_0x5dd8('0xd'));var jsforce=require(_0x5dd8('0xe'));var deskjs=require(_0x5dd8('0xf'));var toCsv=require(_0x5dd8('0x9'));var querystring=require(_0x5dd8('0x10'));var Papa=require(_0x5dd8('0x11'));var Redis=require(_0x5dd8('0x12'));var authService=require(_0x5dd8('0x13'));var qs=require(_0x5dd8('0x14'));var as=require(_0x5dd8('0x15'));var hardwareService=require(_0x5dd8('0x16'));var logger=require(_0x5dd8('0x17'))(_0x5dd8('0x18'));var utils=require(_0x5dd8('0x19'));var config=require(_0x5dd8('0x1a'));var licenseUtil=require(_0x5dd8('0x1b'));var db=require(_0x5dd8('0x1c'))['db'];function respondWithStatusCode(_0x534c34,_0x11a263){_0x11a263=_0x11a263||0xcc;return function(_0x48a5e9){if(_0x48a5e9){return _0x534c34[_0x5dd8('0x1d')](_0x11a263);}return _0x534c34[_0x5dd8('0x1e')](_0x11a263)[_0x5dd8('0x1f')]();};}function respondWithResult(_0x217971,_0x1288e4){_0x1288e4=_0x1288e4||0xc8;return function(_0xfd9951){if(_0xfd9951){return _0x217971['status'](_0x1288e4)[_0x5dd8('0x20')](_0xfd9951);}};}function respondWithFilteredResult(_0x423be8,_0x54097c){return function(_0x2e87ec){if(_0x2e87ec){var _0x1cbac5=typeof _0x54097c[_0x5dd8('0x21')]===_0x5dd8('0x22')&&typeof _0x54097c['limit']===_0x5dd8('0x22');var _0x331c20=_0x2e87ec[_0x5dd8('0x23')];var _0x263067=_0x1cbac5?0x0:_0x54097c['offset'];var _0x196e28=_0x1cbac5?_0x2e87ec[_0x5dd8('0x23')]:_0x54097c[_0x5dd8('0x21')]+_0x54097c[_0x5dd8('0x24')];var _0x277b50;if(_0x196e28>=_0x331c20){_0x196e28=_0x331c20;_0x277b50=0xc8;}else{_0x277b50=0xce;}_0x423be8[_0x5dd8('0x1e')](_0x277b50);return _0x423be8[_0x5dd8('0x25')](_0x5dd8('0x26'),_0x263067+'-'+_0x196e28+'/'+_0x331c20)['json'](_0x2e87ec);}return null;};}function patchUpdates(_0x2828b0){return function(_0x524fd5){try{jsonpatch[_0x5dd8('0x27')](_0x524fd5,_0x2828b0,!![]);}catch(_0x2ab385){return BPromise[_0x5dd8('0x28')](_0x2ab385);}return _0x524fd5['save']();};}function saveUpdates(_0x543e84,_0x39adb0){return function(_0x1a3f33){if(_0x1a3f33){return _0x1a3f33['update'](_0x543e84)[_0x5dd8('0x29')](function(_0x294151){return _0x294151;});}return null;};}function removeEntity(_0xd42e9,_0x1f2084){return function(_0x35da46){if(_0x35da46){return _0x35da46[_0x5dd8('0x2a')]()['then'](function(){var _0x1cef92=_0x35da46['get']({'plain':!![]});var _0x4124d8=_0x5dd8('0x2b');return db['UserProfileResource'][_0x5dd8('0x2a')]({'where':{'type':_0x4124d8,'resourceId':_0x1cef92['id']}})[_0x5dd8('0x29')](function(){return _0x35da46;});})[_0x5dd8('0x29')](function(){_0xd42e9['status'](0xcc)[_0x5dd8('0x1f')]();});}};}function handleEntityNotFound(_0x2ec8b4,_0x22be6a){return function(_0x1415b9){if(!_0x1415b9){_0x2ec8b4[_0x5dd8('0x1d')](0x194);}return _0x1415b9;};}function handleError(_0x427fdf,_0x6a11b6){_0x6a11b6=_0x6a11b6||0x1f4;return function(_0x54a8a0){logger[_0x5dd8('0x2c')](_0x54a8a0[_0x5dd8('0x2d')]);if(_0x54a8a0[_0x5dd8('0x2e')]){delete _0x54a8a0[_0x5dd8('0x2e')];}_0x427fdf[_0x5dd8('0x1e')](_0x6a11b6)[_0x5dd8('0x2f')](_0x54a8a0);};}exports['index']=function(_0x5c0c74,_0x561df5){var _0x36dd99={},_0x56177a={},_0x76215f={'count':0x0,'rows':[]};var _0x17c2f5=_['map'](db[_0x5dd8('0x30')][_0x5dd8('0x31')],function(_0x2b48ac){return{'name':_0x2b48ac[_0x5dd8('0x32')],'type':_0x2b48ac[_0x5dd8('0x33')][_0x5dd8('0x34')]};});_0x56177a[_0x5dd8('0x35')]=_[_0x5dd8('0x36')](_0x17c2f5,'name');_0x56177a['query']=_[_0x5dd8('0x37')](_0x5c0c74[_0x5dd8('0x38')]);_0x56177a[_0x5dd8('0x39')]=_[_0x5dd8('0x3a')](_0x56177a['model'],_0x56177a[_0x5dd8('0x38')]);_0x36dd99['attributes']=_[_0x5dd8('0x3a')](_0x56177a[_0x5dd8('0x35')],qs[_0x5dd8('0x3b')](_0x5c0c74[_0x5dd8('0x38')]['fields']));_0x36dd99[_0x5dd8('0x3c')]=_0x36dd99['attributes']['length']?_0x36dd99[_0x5dd8('0x3c')]:_0x56177a[_0x5dd8('0x35')];if(!_0x5c0c74[_0x5dd8('0x38')]['hasOwnProperty'](_0x5dd8('0x3d'))){_0x36dd99[_0x5dd8('0x24')]=qs[_0x5dd8('0x24')](_0x5c0c74[_0x5dd8('0x38')]['limit']);_0x36dd99[_0x5dd8('0x21')]=qs[_0x5dd8('0x21')](_0x5c0c74[_0x5dd8('0x38')][_0x5dd8('0x21')]);}_0x36dd99[_0x5dd8('0x3e')]=qs['sort'](_0x5c0c74[_0x5dd8('0x38')][_0x5dd8('0x3f')]);_0x36dd99[_0x5dd8('0x40')]=qs[_0x5dd8('0x39')](_[_0x5dd8('0x41')](_0x5c0c74[_0x5dd8('0x38')],_0x56177a[_0x5dd8('0x39')]),_0x17c2f5);if(_0x5c0c74[_0x5dd8('0x38')][_0x5dd8('0x42')]){_0x36dd99[_0x5dd8('0x40')]=_[_0x5dd8('0x43')](_0x36dd99['where'],{'$or':_['map'](_0x17c2f5,function(_0xf8beb6){if(_0xf8beb6[_0x5dd8('0x33')]!==_0x5dd8('0x44')){var _0x2a4097={};_0x2a4097[_0xf8beb6['name']]={'$like':'%'+_0x5c0c74[_0x5dd8('0x38')][_0x5dd8('0x42')]+'%'};return _0x2a4097;}})});}_0x36dd99=_['merge']({},_0x36dd99,_0x5c0c74['options']);var _0x78657a={'where':_0x36dd99['where']};return db[_0x5dd8('0x30')][_0x5dd8('0x23')](_0x78657a)[_0x5dd8('0x29')](function(_0x15f7be){_0x76215f[_0x5dd8('0x23')]=_0x15f7be;if(_0x5c0c74[_0x5dd8('0x38')][_0x5dd8('0x45')]){_0x36dd99[_0x5dd8('0x46')]=[{'all':!![]}];}return db[_0x5dd8('0x30')][_0x5dd8('0x47')](_0x36dd99);})['then'](function(_0x3ebe5b){_0x76215f[_0x5dd8('0x48')]=_0x3ebe5b;return _0x76215f;})[_0x5dd8('0x29')](respondWithFilteredResult(_0x561df5,_0x36dd99))[_0x5dd8('0x49')](handleError(_0x561df5,null));};exports[_0x5dd8('0x4a')]=function(_0x5edcdd,_0x4cbed7){var _0x66fa8e={'raw':!![],'where':{'id':_0x5edcdd['params']['id']}},_0x59903={};_0x59903[_0x5dd8('0x35')]=_[_0x5dd8('0x37')](db['AnalyticMetric'][_0x5dd8('0x31')]);_0x59903[_0x5dd8('0x38')]=_[_0x5dd8('0x37')](_0x5edcdd['query']);_0x59903[_0x5dd8('0x39')]=_[_0x5dd8('0x3a')](_0x59903['model'],_0x59903[_0x5dd8('0x38')]);_0x66fa8e[_0x5dd8('0x3c')]=_[_0x5dd8('0x3a')](_0x59903['model'],qs[_0x5dd8('0x3b')](_0x5edcdd[_0x5dd8('0x38')][_0x5dd8('0x3b')]));_0x66fa8e[_0x5dd8('0x3c')]=_0x66fa8e[_0x5dd8('0x3c')][_0x5dd8('0x4b')]?_0x66fa8e[_0x5dd8('0x3c')]:_0x59903[_0x5dd8('0x35')];if(_0x5edcdd[_0x5dd8('0x38')][_0x5dd8('0x45')]){_0x66fa8e[_0x5dd8('0x46')]=[{'all':!![]}];}_0x66fa8e=_[_0x5dd8('0x43')]({},_0x66fa8e,_0x5edcdd['options']);return db[_0x5dd8('0x30')][_0x5dd8('0x4c')](_0x66fa8e)[_0x5dd8('0x29')](handleEntityNotFound(_0x4cbed7,null))[_0x5dd8('0x29')](respondWithResult(_0x4cbed7,null))[_0x5dd8('0x49')](handleError(_0x4cbed7,null));};exports[_0x5dd8('0x4d')]=function(_0x5c0ab9,_0x781c1f){return db[_0x5dd8('0x30')]['create'](_0x5c0ab9[_0x5dd8('0x4e')],{})[_0x5dd8('0x29')](function(_0x1862ac){var _0x187ff3=_0x5c0ab9[_0x5dd8('0x4f')]['get']({'plain':!![]});if(!_0x187ff3)throw new Error(_0x5dd8('0x50'));if(_0x187ff3[_0x5dd8('0x51')]===_0x5dd8('0x4f')){var _0x7411dc=_0x1862ac['get']({'plain':!![]});var _0x2c859c=_0x5dd8('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x2c859c,'userProfileId':_0x187ff3[_0x5dd8('0x52')]},'raw':!![]})[_0x5dd8('0x29')](function(_0x2301e7){if(_0x2301e7&&_0x2301e7[_0x5dd8('0x53')]===0x0){return db[_0x5dd8('0x54')][_0x5dd8('0x4d')]({'name':_0x7411dc[_0x5dd8('0x2e')],'resourceId':_0x7411dc['id'],'type':_0x2301e7['name'],'sectionId':_0x2301e7['id']},{})[_0x5dd8('0x29')](function(){return _0x1862ac;});}else{return _0x1862ac;}})[_0x5dd8('0x49')](function(_0x3dcea9){logger['error'](_0x5dd8('0x55'),_0x3dcea9);throw _0x3dcea9;});}return _0x1862ac;})[_0x5dd8('0x29')](respondWithResult(_0x781c1f,0xc9))['catch'](handleError(_0x781c1f,null));};exports[_0x5dd8('0x56')]=function(_0x49ce77,_0x11e44e){if(_0x49ce77[_0x5dd8('0x4e')]['id']){delete _0x49ce77[_0x5dd8('0x4e')]['id'];}return db[_0x5dd8('0x30')][_0x5dd8('0x4c')]({'where':{'id':_0x49ce77[_0x5dd8('0x57')]['id']}})['then'](handleEntityNotFound(_0x11e44e,null))['then'](saveUpdates(_0x49ce77['body'],null))[_0x5dd8('0x29')](respondWithResult(_0x11e44e,null))[_0x5dd8('0x49')](handleError(_0x11e44e,null));};exports[_0x5dd8('0x2a')]=function(_0x5ffe1e,_0x11cbbc){return db['AnalyticMetric'][_0x5dd8('0x4c')]({'where':{'id':_0x5ffe1e[_0x5dd8('0x57')]['id']}})[_0x5dd8('0x29')](handleEntityNotFound(_0x11cbbc,null))[_0x5dd8('0x29')](removeEntity(_0x11cbbc,null))['catch'](handleError(_0x11cbbc,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 05e8b72..6fd6d66 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 _0x5e77=['path','rimraf','../../config/environment','exports','define','AnalyticMetric','lodash','util','api','moment','bluebird'];(function(_0x125c44,_0x5a3d0d){var _0x4757e3=function(_0x16318f){while(--_0x16318f){_0x125c44['push'](_0x125c44['shift']());}};_0x4757e3(++_0x5a3d0d);}(_0x5e77,0x15b));var _0x75e7=function(_0x4beb42,_0x3066df){_0x4beb42=_0x4beb42-0x0;var _0x198c48=_0x5e77[_0x4beb42];return _0x198c48;};'use strict';var _=require(_0x75e7('0x0'));var util=require(_0x75e7('0x1'));var logger=require('../../config/logger')(_0x75e7('0x2'));var moment=require(_0x75e7('0x3'));var BPromise=require(_0x75e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75e7('0x5'));var rimraf=require(_0x75e7('0x6'));var config=require(_0x75e7('0x7'));var attributes=require('./analyticMetric.attributes');module[_0x75e7('0x8')]=function(_0x3d54f4,_0x1bd3b1){return _0x3d54f4[_0x75e7('0x9')](_0x75e7('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8646=['../../config/logger','api','request-promise','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','util'];(function(_0x4f1676,_0x37289e){var _0x25d0a1=function(_0x1fdd6d){while(--_0x1fdd6d){_0x4f1676['push'](_0x4f1676['shift']());}};_0x25d0a1(++_0x37289e);}(_0x8646,0x18f));var _0x6864=function(_0x4c60a1,_0x2a7864){_0x4c60a1=_0x4c60a1-0x0;var _0x24a9cc=_0x8646[_0x4c60a1];return _0x24a9cc;};'use strict';var _=require('lodash');var util=require(_0x6864('0x0'));var logger=require(_0x6864('0x1'))(_0x6864('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6864('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6864('0x4'));var attributes=require(_0x6864('0x5'));module[_0x6864('0x6')]=function(_0xc44894,_0xcbfcc5){return _0xc44894[_0x6864('0x7')](_0x6864('0x8'),attributes,{'tableName':_0x6864('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 952d5e3..9d5690c 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 _0xa212=['then','info','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x59e547,_0x155cee){var _0x4d1745=function(_0x558a19){while(--_0x558a19){_0x59e547['push'](_0x59e547['shift']());}};_0x4d1745(++_0x155cee);}(_0xa212,0x11e));var _0x2a21=function(_0x17bb3c,_0x21f327){_0x17bb3c=_0x17bb3c-0x0;var _0x4f81d7=_0xa212[_0x17bb3c];return _0x4f81d7;};'use strict';var _=require(_0x2a21('0x0'));var util=require(_0x2a21('0x1'));var moment=require(_0x2a21('0x2'));var BPromise=require(_0x2a21('0x3'));var rs=require(_0x2a21('0x4'));var fs=require('fs');var Redis=require(_0x2a21('0x5'));var db=require(_0x2a21('0x6'))['db'];var utils=require(_0x2a21('0x7'));var logger=require(_0x2a21('0x8'))(_0x2a21('0x9'));var config=require(_0x2a21('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2a21('0xb')][_0x2a21('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f587b,_0x211446,_0x51cc1c){return new BPromise(function(_0xd04625,_0x18d3ec){return client['request'](_0x1f587b,_0x51cc1c)[_0x2a21('0xd')](function(_0x22e029){logger[_0x2a21('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x211446,'request\x20sent');logger[_0x2a21('0xf')](_0x2a21('0x10'),_0x211446,_0x2a21('0x11'),JSON['stringify'](_0x22e029));if(_0x22e029['error']){if(_0x22e029['error'][_0x2a21('0x12')]===0x1f4){logger[_0x2a21('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x211446,_0x22e029[_0x2a21('0x13')][_0x2a21('0x14')]);return _0x18d3ec(_0x22e029[_0x2a21('0x13')][_0x2a21('0x14')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x211446,_0x22e029[_0x2a21('0x13')]['message']);return _0xd04625(_0x22e029[_0x2a21('0x13')][_0x2a21('0x14')]);}else{logger[_0x2a21('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x211446,_0x2a21('0x11'));_0xd04625(_0x22e029[_0x2a21('0x15')]['message']);}})[_0x2a21('0x16')](function(_0x29fbec){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x211446,_0x29fbec);_0x18d3ec(_0x29fbec);});});} \ No newline at end of file +var _0x1c20=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x1bb08b,_0xb5449e){var _0x239d8d=function(_0x1b4db2){while(--_0x1b4db2){_0x1bb08b['push'](_0x1bb08b['shift']());}};_0x239d8d(++_0xb5449e);}(_0x1c20,0x18c));var _0x01c2=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x1c20[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x01c2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x01c2('0x1'));var rs=require(_0x01c2('0x2'));var fs=require('fs');var Redis=require(_0x01c2('0x3'));var db=require(_0x01c2('0x4'))['db'];var utils=require(_0x01c2('0x5'));var logger=require(_0x01c2('0x6'))(_0x01c2('0x7'));var config=require('../../config/environment');var jayson=require(_0x01c2('0x8'));var client=jayson['client'][_0x01c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fd2e0,_0x1706af,_0x45888b){return new BPromise(function(_0x5b4e82,_0x3fdcb2){return client[_0x01c2('0xa')](_0x3fd2e0,_0x45888b)[_0x01c2('0xb')](function(_0x5ecac6){logger[_0x01c2('0xc')](_0x01c2('0xd'),_0x1706af,'request\x20sent');logger[_0x01c2('0xe')](_0x01c2('0xf'),_0x1706af,_0x01c2('0x10'),JSON[_0x01c2('0x11')](_0x5ecac6));if(_0x5ecac6[_0x01c2('0x12')]){if(_0x5ecac6[_0x01c2('0x12')][_0x01c2('0x13')]===0x1f4){logger[_0x01c2('0x12')](_0x01c2('0xd'),_0x1706af,_0x5ecac6[_0x01c2('0x12')][_0x01c2('0x14')]);return _0x3fdcb2(_0x5ecac6[_0x01c2('0x12')][_0x01c2('0x14')]);}logger[_0x01c2('0x12')](_0x01c2('0xd'),_0x1706af,_0x5ecac6['error'][_0x01c2('0x14')]);return _0x5b4e82(_0x5ecac6['error'][_0x01c2('0x14')]);}else{logger[_0x01c2('0xc')](_0x01c2('0xd'),_0x1706af,'request\x20sent');_0x5b4e82(_0x5ecac6['result'][_0x01c2('0x14')]);}})[_0x01c2('0x15')](function(_0x526bbf){logger[_0x01c2('0x12')](_0x01c2('0xd'),_0x1706af,_0x526bbf);_0x3fdcb2(_0x526bbf);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index dadd62f..814bfd5 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 _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x44ec17,_0x5290ea){var _0x33cea9=function(_0x1126bb){while(--_0x1126bb){_0x44ec17['push'](_0x44ec17['shift']());}};_0x33cea9(++_0x5290ea);}(_0xa571,0x107));var _0x1a57=function(_0x2b7d31,_0x10e1c7){_0x2b7d31=_0x2b7d31-0x0;var _0x5b15ac=_0xa571[_0x2b7d31];return _0x5b15ac;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./analyticMetric.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('0x10')]=router; \ No newline at end of file +var _0x0abf=['isAuthenticated','index','show','post','put','/:id','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0abf[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0xb')]('/',auth[_0xf0ab('0x8')](),controller['create']);router[_0xf0ab('0xc')](_0xf0ab('0xd'),auth[_0xf0ab('0x8')](),controller['update']);router['delete'](_0xf0ab('0xd'),auth['isAuthenticated'](),controller[_0xf0ab('0xe')]);module[_0xf0ab('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 9e64afb..6158ebd 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x7711=['TEXT','sequelize'];(function(_0x12f7f4,_0x4ecdba){var _0x2643ab=function(_0x1f2e5c){while(--_0x1f2e5c){_0x12f7f4['push'](_0x12f7f4['shift']());}};_0x2643ab(++_0x4ecdba);}(_0x7711,0x1cb));var _0x1771=function(_0x2dab57,_0xa3c225){_0x2dab57=_0x2dab57-0x0;var _0x2bbd44=_0x7711[_0x2dab57];return _0x2bbd44;};'use strict';var Sequelize=require(_0x1771('0x0'));module['exports']={'tree':{'type':Sequelize[_0x1771('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index dbfb92b..615fb46 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 _0x0fb7=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../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','reject','then','destroy','name','send','index','map','fieldName','type','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','model','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x40dfda,_0x4cc1b5){var _0x4e6be7=function(_0x1ef909){while(--_0x1ef909){_0x40dfda['push'](_0x40dfda['shift']());}};_0x4e6be7(++_0x4cc1b5);}(_0x0fb7,0x1b4));var _0x70fb=function(_0x42e013,_0x4e1584){_0x42e013=_0x42e013-0x0;var _0x3e951b=_0x0fb7[_0x42e013];return _0x3e951b;};'use strict';var emlformat=require(_0x70fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x70fb('0x1'));var jsonpatch=require(_0x70fb('0x2'));var rp=require(_0x70fb('0x3'));var moment=require(_0x70fb('0x4'));var BPromise=require(_0x70fb('0x5'));var Mustache=require('mustache');var util=require(_0x70fb('0x6'));var path=require(_0x70fb('0x7'));var sox=require(_0x70fb('0x8'));var csv=require(_0x70fb('0x9'));var ejs=require(_0x70fb('0xa'));var fs=require('fs');var fs_extra=require(_0x70fb('0xb'));var _=require(_0x70fb('0xc'));var squel=require(_0x70fb('0xd'));var crypto=require('crypto');var jsforce=require(_0x70fb('0xe'));var deskjs=require(_0x70fb('0xf'));var toCsv=require(_0x70fb('0x9'));var querystring=require(_0x70fb('0x10'));var Papa=require(_0x70fb('0x11'));var Redis=require(_0x70fb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x70fb('0x13'));var as=require(_0x70fb('0x14'));var hardwareService=require(_0x70fb('0x15'));var logger=require(_0x70fb('0x16'))(_0x70fb('0x17'));var utils=require(_0x70fb('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x70fb('0x19'));var db=require(_0x70fb('0x1a'))['db'];function respondWithStatusCode(_0xc8aabb,_0x1b1a74){_0x1b1a74=_0x1b1a74||0xcc;return function(_0x16a978){if(_0x16a978){return _0xc8aabb[_0x70fb('0x1b')](_0x1b1a74);}return _0xc8aabb[_0x70fb('0x1c')](_0x1b1a74)[_0x70fb('0x1d')]();};}function respondWithResult(_0x2bc701,_0x30f95e){_0x30f95e=_0x30f95e||0xc8;return function(_0xe747f1){if(_0xe747f1){return _0x2bc701[_0x70fb('0x1c')](_0x30f95e)[_0x70fb('0x1e')](_0xe747f1);}};}function respondWithFilteredResult(_0x2219d9,_0x3a528b){return function(_0x1535f5){if(_0x1535f5){var _0x499081=typeof _0x3a528b[_0x70fb('0x1f')]===_0x70fb('0x20')&&typeof _0x3a528b[_0x70fb('0x21')]===_0x70fb('0x20');var _0x3e1ca0=_0x1535f5[_0x70fb('0x22')];var _0x14f8bd=_0x499081?0x0:_0x3a528b[_0x70fb('0x1f')];var _0x4efb8c=_0x499081?_0x1535f5[_0x70fb('0x22')]:_0x3a528b[_0x70fb('0x1f')]+_0x3a528b[_0x70fb('0x21')];var _0x30d2a4;if(_0x4efb8c>=_0x3e1ca0){_0x4efb8c=_0x3e1ca0;_0x30d2a4=0xc8;}else{_0x30d2a4=0xce;}_0x2219d9['status'](_0x30d2a4);return _0x2219d9[_0x70fb('0x23')](_0x70fb('0x24'),_0x14f8bd+'-'+_0x4efb8c+'/'+_0x3e1ca0)[_0x70fb('0x1e')](_0x1535f5);}return null;};}function patchUpdates(_0x17ece7){return function(_0x656ac3){try{jsonpatch['apply'](_0x656ac3,_0x17ece7,!![]);}catch(_0x26dcc8){return BPromise[_0x70fb('0x25')](_0x26dcc8);}return _0x656ac3['save']();};}function saveUpdates(_0x387fd8,_0x4a6cea){return function(_0x54925b){if(_0x54925b){return _0x54925b['update'](_0x387fd8)[_0x70fb('0x26')](function(_0x556831){return _0x556831;});}return null;};}function removeEntity(_0x52e939,_0xbb7ab){return function(_0x1cbe0d){if(_0x1cbe0d){return _0x1cbe0d[_0x70fb('0x27')]()[_0x70fb('0x26')](function(){_0x52e939['status'](0xcc)[_0x70fb('0x1d')]();});}};}function handleEntityNotFound(_0x41c36c,_0x31af60){return function(_0x5b287f){if(!_0x5b287f){_0x41c36c['sendStatus'](0x194);}return _0x5b287f;};}function handleError(_0x4107e1,_0xb39e11){_0xb39e11=_0xb39e11||0x1f4;return function(_0x51a49f){logger['error'](_0x51a49f['stack']);if(_0x51a49f['name']){delete _0x51a49f[_0x70fb('0x28')];}_0x4107e1[_0x70fb('0x1c')](_0xb39e11)[_0x70fb('0x29')](_0x51a49f);};}exports[_0x70fb('0x2a')]=function(_0x5b6a69,_0x837396){var _0x4e080d={},_0xbcdc7f={},_0x15d3ce={'count':0x0,'rows':[]};var _0x2381be=_[_0x70fb('0x2b')](db['AnalyticTreeReport']['rawAttributes'],function(_0x543be4){return{'name':_0x543be4[_0x70fb('0x2c')],'type':_0x543be4[_0x70fb('0x2d')]['key']};});_0xbcdc7f['model']=_[_0x70fb('0x2b')](_0x2381be,_0x70fb('0x28'));_0xbcdc7f[_0x70fb('0x2e')]=_[_0x70fb('0x2f')](_0x5b6a69[_0x70fb('0x2e')]);_0xbcdc7f[_0x70fb('0x30')]=_['intersection'](_0xbcdc7f['model'],_0xbcdc7f[_0x70fb('0x2e')]);_0x4e080d['attributes']=_[_0x70fb('0x31')](_0xbcdc7f['model'],qs['fields'](_0x5b6a69[_0x70fb('0x2e')]['fields']));_0x4e080d['attributes']=_0x4e080d[_0x70fb('0x32')][_0x70fb('0x33')]?_0x4e080d[_0x70fb('0x32')]:_0xbcdc7f['model'];if(!_0x5b6a69[_0x70fb('0x2e')][_0x70fb('0x34')](_0x70fb('0x35'))){_0x4e080d[_0x70fb('0x21')]=qs[_0x70fb('0x21')](_0x5b6a69[_0x70fb('0x2e')]['limit']);_0x4e080d['offset']=qs[_0x70fb('0x1f')](_0x5b6a69[_0x70fb('0x2e')][_0x70fb('0x1f')]);}_0x4e080d[_0x70fb('0x36')]=qs[_0x70fb('0x37')](_0x5b6a69[_0x70fb('0x2e')]['sort']);_0x4e080d[_0x70fb('0x38')]=qs[_0x70fb('0x30')](_[_0x70fb('0x39')](_0x5b6a69[_0x70fb('0x2e')],_0xbcdc7f[_0x70fb('0x30')]),_0x2381be);if(_0x5b6a69[_0x70fb('0x2e')][_0x70fb('0x3a')]){_0x4e080d[_0x70fb('0x38')]=_['merge'](_0x4e080d[_0x70fb('0x38')],{'$or':_[_0x70fb('0x2b')](_0x2381be,function(_0x2ad93b){if(_0x2ad93b['type']!=='VIRTUAL'){var _0x22ba61={};_0x22ba61[_0x2ad93b['name']]={'$like':'%'+_0x5b6a69['query']['filter']+'%'};return _0x22ba61;}})});}_0x4e080d=_[_0x70fb('0x3b')]({},_0x4e080d,_0x5b6a69[_0x70fb('0x3c')]);var _0x3c71ef={'where':_0x4e080d[_0x70fb('0x38')]};return db[_0x70fb('0x3d')]['count'](_0x3c71ef)['then'](function(_0x5a7a5c){_0x15d3ce[_0x70fb('0x22')]=_0x5a7a5c;if(_0x5b6a69['query'][_0x70fb('0x3e')]){_0x4e080d[_0x70fb('0x3f')]=[{'all':!![]}];}return db[_0x70fb('0x3d')][_0x70fb('0x40')](_0x4e080d);})[_0x70fb('0x26')](function(_0xa3f20d){_0x15d3ce[_0x70fb('0x41')]=_0xa3f20d;return _0x15d3ce;})[_0x70fb('0x26')](respondWithFilteredResult(_0x837396,_0x4e080d))[_0x70fb('0x42')](handleError(_0x837396,null));};exports[_0x70fb('0x43')]=function(_0x2f4cd5,_0x25ae7a){var _0x35652c={'raw':!![],'where':{'id':_0x2f4cd5[_0x70fb('0x44')]['id']}},_0x21ce9c={};_0x21ce9c['model']=_['keys'](db[_0x70fb('0x3d')][_0x70fb('0x45')]);_0x21ce9c[_0x70fb('0x2e')]=_[_0x70fb('0x2f')](_0x2f4cd5[_0x70fb('0x2e')]);_0x21ce9c[_0x70fb('0x30')]=_[_0x70fb('0x31')](_0x21ce9c[_0x70fb('0x46')],_0x21ce9c[_0x70fb('0x2e')]);_0x35652c['attributes']=_['intersection'](_0x21ce9c[_0x70fb('0x46')],qs['fields'](_0x2f4cd5[_0x70fb('0x2e')]['fields']));_0x35652c[_0x70fb('0x32')]=_0x35652c['attributes'][_0x70fb('0x33')]?_0x35652c['attributes']:_0x21ce9c[_0x70fb('0x46')];if(_0x2f4cd5[_0x70fb('0x2e')][_0x70fb('0x3e')]){_0x35652c[_0x70fb('0x3f')]=[{'all':!![]}];}_0x35652c=_[_0x70fb('0x3b')]({},_0x35652c,_0x2f4cd5[_0x70fb('0x3c')]);return db[_0x70fb('0x3d')][_0x70fb('0x47')](_0x35652c)['then'](handleEntityNotFound(_0x25ae7a,null))[_0x70fb('0x26')](respondWithResult(_0x25ae7a,null))[_0x70fb('0x42')](handleError(_0x25ae7a,null));};exports['create']=function(_0xe13e51,_0x5b5b93){return db[_0x70fb('0x3d')][_0x70fb('0x48')](_0xe13e51[_0x70fb('0x49')],{})[_0x70fb('0x26')](respondWithResult(_0x5b5b93,0xc9))['catch'](handleError(_0x5b5b93,null));};exports['update']=function(_0x569e41,_0x30cd92){if(_0x569e41['body']['id']){delete _0x569e41[_0x70fb('0x49')]['id'];}return db[_0x70fb('0x3d')][_0x70fb('0x47')]({'where':{'id':_0x569e41[_0x70fb('0x44')]['id']}})['then'](handleEntityNotFound(_0x30cd92,null))['then'](saveUpdates(_0x569e41['body'],null))[_0x70fb('0x26')](respondWithResult(_0x30cd92,null))[_0x70fb('0x42')](handleError(_0x30cd92,null));};exports['destroy']=function(_0x4ee739,_0x45770f){return db[_0x70fb('0x3d')][_0x70fb('0x47')]({'where':{'id':_0x4ee739['params']['id']}})[_0x70fb('0x26')](handleEntityNotFound(_0x45770f,null))[_0x70fb('0x26')](removeEntity(_0x45770f,null))['catch'](handleError(_0x45770f,null));}; \ No newline at end of file +var _0xe995=['name','send','index','map','AnalyticTreeReport','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','create','update','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','stack'];(function(_0x455b35,_0x5c70c1){var _0x223787=function(_0x556b26){while(--_0x556b26){_0x455b35['push'](_0x455b35['shift']());}};_0x223787(++_0x5c70c1);}(_0xe995,0xba));var _0x5e99=function(_0x597c92,_0x3c013e){_0x597c92=_0x597c92-0x0;var _0x5c4b0d=_0xe995[_0x597c92];return _0x5c4b0d;};'use strict';var emlformat=require(_0x5e99('0x0'));var rimraf=require(_0x5e99('0x1'));var zipdir=require(_0x5e99('0x2'));var jsonpatch=require(_0x5e99('0x3'));var rp=require(_0x5e99('0x4'));var moment=require(_0x5e99('0x5'));var BPromise=require(_0x5e99('0x6'));var Mustache=require(_0x5e99('0x7'));var util=require(_0x5e99('0x8'));var path=require(_0x5e99('0x9'));var sox=require(_0x5e99('0xa'));var csv=require(_0x5e99('0xb'));var ejs=require(_0x5e99('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5e99('0xd'));var crypto=require('crypto');var jsforce=require(_0x5e99('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5e99('0xb'));var querystring=require('querystring');var Papa=require(_0x5e99('0xf'));var Redis=require(_0x5e99('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5e99('0x11'));var as=require(_0x5e99('0x12'));var hardwareService=require(_0x5e99('0x13'));var logger=require('../../config/logger')(_0x5e99('0x14'));var utils=require(_0x5e99('0x15'));var config=require(_0x5e99('0x16'));var licenseUtil=require(_0x5e99('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12334a,_0x25bf35){_0x25bf35=_0x25bf35||0xcc;return function(_0x32d596){if(_0x32d596){return _0x12334a[_0x5e99('0x18')](_0x25bf35);}return _0x12334a[_0x5e99('0x19')](_0x25bf35)[_0x5e99('0x1a')]();};}function respondWithResult(_0x48a1ec,_0x3aedd4){_0x3aedd4=_0x3aedd4||0xc8;return function(_0x78e955){if(_0x78e955){return _0x48a1ec[_0x5e99('0x19')](_0x3aedd4)[_0x5e99('0x1b')](_0x78e955);}};}function respondWithFilteredResult(_0x331edc,_0x2808a6){return function(_0x39bb77){if(_0x39bb77){var _0x1b9bd9=typeof _0x2808a6['offset']===_0x5e99('0x1c')&&typeof _0x2808a6[_0x5e99('0x1d')]==='undefined';var _0x3705f8=_0x39bb77[_0x5e99('0x1e')];var _0x42507e=_0x1b9bd9?0x0:_0x2808a6['offset'];var _0x58784c=_0x1b9bd9?_0x39bb77[_0x5e99('0x1e')]:_0x2808a6[_0x5e99('0x1f')]+_0x2808a6['limit'];var _0x3cc1fd;if(_0x58784c>=_0x3705f8){_0x58784c=_0x3705f8;_0x3cc1fd=0xc8;}else{_0x3cc1fd=0xce;}_0x331edc[_0x5e99('0x19')](_0x3cc1fd);return _0x331edc[_0x5e99('0x20')](_0x5e99('0x21'),_0x42507e+'-'+_0x58784c+'/'+_0x3705f8)[_0x5e99('0x1b')](_0x39bb77);}return null;};}function patchUpdates(_0x3e0aab){return function(_0x833e52){try{jsonpatch[_0x5e99('0x22')](_0x833e52,_0x3e0aab,!![]);}catch(_0xa817b2){return BPromise[_0x5e99('0x23')](_0xa817b2);}return _0x833e52[_0x5e99('0x24')]();};}function saveUpdates(_0x5837bc,_0x2dc38c){return function(_0x11ac4c){if(_0x11ac4c){return _0x11ac4c['update'](_0x5837bc)[_0x5e99('0x25')](function(_0xfc807){return _0xfc807;});}return null;};}function removeEntity(_0x2eb418,_0x3b8539){return function(_0x4c6f0a){if(_0x4c6f0a){return _0x4c6f0a['destroy']()[_0x5e99('0x25')](function(){_0x2eb418['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49e7c1,_0x560381){return function(_0x1fa049){if(!_0x1fa049){_0x49e7c1[_0x5e99('0x18')](0x194);}return _0x1fa049;};}function handleError(_0x3e92af,_0x33986c){_0x33986c=_0x33986c||0x1f4;return function(_0x209193){logger['error'](_0x209193[_0x5e99('0x26')]);if(_0x209193[_0x5e99('0x27')]){delete _0x209193[_0x5e99('0x27')];}_0x3e92af[_0x5e99('0x19')](_0x33986c)[_0x5e99('0x28')](_0x209193);};}exports[_0x5e99('0x29')]=function(_0x39ffd8,_0x1dd4e6){var _0xdda99e={},_0x42a986={},_0x5b8a74={'count':0x0,'rows':[]};var _0x5d3800=_[_0x5e99('0x2a')](db[_0x5e99('0x2b')]['rawAttributes'],function(_0x215270){return{'name':_0x215270['fieldName'],'type':_0x215270['type'][_0x5e99('0x2c')]};});_0x42a986[_0x5e99('0x2d')]=_[_0x5e99('0x2a')](_0x5d3800,_0x5e99('0x27'));_0x42a986[_0x5e99('0x2e')]=_['keys'](_0x39ffd8[_0x5e99('0x2e')]);_0x42a986[_0x5e99('0x2f')]=_[_0x5e99('0x30')](_0x42a986[_0x5e99('0x2d')],_0x42a986[_0x5e99('0x2e')]);_0xdda99e['attributes']=_['intersection'](_0x42a986[_0x5e99('0x2d')],qs[_0x5e99('0x31')](_0x39ffd8[_0x5e99('0x2e')]['fields']));_0xdda99e[_0x5e99('0x32')]=_0xdda99e[_0x5e99('0x32')][_0x5e99('0x33')]?_0xdda99e[_0x5e99('0x32')]:_0x42a986[_0x5e99('0x2d')];if(!_0x39ffd8[_0x5e99('0x2e')][_0x5e99('0x34')]('nolimit')){_0xdda99e[_0x5e99('0x1d')]=qs[_0x5e99('0x1d')](_0x39ffd8[_0x5e99('0x2e')][_0x5e99('0x1d')]);_0xdda99e['offset']=qs[_0x5e99('0x1f')](_0x39ffd8[_0x5e99('0x2e')][_0x5e99('0x1f')]);}_0xdda99e[_0x5e99('0x35')]=qs[_0x5e99('0x36')](_0x39ffd8[_0x5e99('0x2e')][_0x5e99('0x36')]);_0xdda99e[_0x5e99('0x37')]=qs[_0x5e99('0x2f')](_[_0x5e99('0x38')](_0x39ffd8['query'],_0x42a986[_0x5e99('0x2f')]),_0x5d3800);if(_0x39ffd8['query'][_0x5e99('0x39')]){_0xdda99e[_0x5e99('0x37')]=_[_0x5e99('0x3a')](_0xdda99e[_0x5e99('0x37')],{'$or':_[_0x5e99('0x2a')](_0x5d3800,function(_0x373ea4){if(_0x373ea4[_0x5e99('0x3b')]!==_0x5e99('0x3c')){var _0x5c1d7f={};_0x5c1d7f[_0x373ea4[_0x5e99('0x27')]]={'$like':'%'+_0x39ffd8[_0x5e99('0x2e')][_0x5e99('0x39')]+'%'};return _0x5c1d7f;}})});}_0xdda99e=_[_0x5e99('0x3a')]({},_0xdda99e,_0x39ffd8[_0x5e99('0x3d')]);var _0x42700a={'where':_0xdda99e[_0x5e99('0x37')]};return db[_0x5e99('0x2b')]['count'](_0x42700a)['then'](function(_0x567195){_0x5b8a74['count']=_0x567195;if(_0x39ffd8['query']['includeAll']){_0xdda99e[_0x5e99('0x3e')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x5e99('0x3f')](_0xdda99e);})['then'](function(_0x5c5d4b){_0x5b8a74[_0x5e99('0x40')]=_0x5c5d4b;return _0x5b8a74;})[_0x5e99('0x25')](respondWithFilteredResult(_0x1dd4e6,_0xdda99e))[_0x5e99('0x41')](handleError(_0x1dd4e6,null));};exports[_0x5e99('0x42')]=function(_0x3fdf63,_0x117b2e){var _0x4c6a80={'raw':!![],'where':{'id':_0x3fdf63[_0x5e99('0x43')]['id']}},_0x3dbce6={};_0x3dbce6[_0x5e99('0x2d')]=_['keys'](db[_0x5e99('0x2b')]['rawAttributes']);_0x3dbce6['query']=_[_0x5e99('0x44')](_0x3fdf63['query']);_0x3dbce6[_0x5e99('0x2f')]=_['intersection'](_0x3dbce6[_0x5e99('0x2d')],_0x3dbce6['query']);_0x4c6a80['attributes']=_[_0x5e99('0x30')](_0x3dbce6[_0x5e99('0x2d')],qs[_0x5e99('0x31')](_0x3fdf63[_0x5e99('0x2e')][_0x5e99('0x31')]));_0x4c6a80[_0x5e99('0x32')]=_0x4c6a80[_0x5e99('0x32')]['length']?_0x4c6a80[_0x5e99('0x32')]:_0x3dbce6[_0x5e99('0x2d')];if(_0x3fdf63[_0x5e99('0x2e')][_0x5e99('0x45')]){_0x4c6a80[_0x5e99('0x3e')]=[{'all':!![]}];}_0x4c6a80=_[_0x5e99('0x3a')]({},_0x4c6a80,_0x3fdf63[_0x5e99('0x3d')]);return db[_0x5e99('0x2b')]['find'](_0x4c6a80)[_0x5e99('0x25')](handleEntityNotFound(_0x117b2e,null))[_0x5e99('0x25')](respondWithResult(_0x117b2e,null))['catch'](handleError(_0x117b2e,null));};exports[_0x5e99('0x46')]=function(_0x328015,_0x494b52){return db[_0x5e99('0x2b')][_0x5e99('0x46')](_0x328015['body'],{})[_0x5e99('0x25')](respondWithResult(_0x494b52,0xc9))[_0x5e99('0x41')](handleError(_0x494b52,null));};exports[_0x5e99('0x47')]=function(_0x2718dc,_0x4f0209){if(_0x2718dc[_0x5e99('0x48')]['id']){delete _0x2718dc[_0x5e99('0x48')]['id'];}return db[_0x5e99('0x2b')][_0x5e99('0x49')]({'where':{'id':_0x2718dc[_0x5e99('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f0209,null))[_0x5e99('0x25')](saveUpdates(_0x2718dc[_0x5e99('0x48')],null))['then'](respondWithResult(_0x4f0209,null))[_0x5e99('0x41')](handleError(_0x4f0209,null));};exports[_0x5e99('0x4a')]=function(_0xef5dce,_0x5de660){return db['AnalyticTreeReport']['find']({'where':{'id':_0xef5dce[_0x5e99('0x43')]['id']}})['then'](handleEntityNotFound(_0x5de660,null))[_0x5e99('0x25')](removeEntity(_0x5de660,null))[_0x5e99('0x41')](handleError(_0x5de660,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 143cec1..e8a273d 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 _0xcfcb=['AnalyticTreeReport','analytics_report_trees','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x184b45,_0x264d2f){var _0x488cd0=function(_0x398044){while(--_0x398044){_0x184b45['push'](_0x184b45['shift']());}};_0x488cd0(++_0x264d2f);}(_0xcfcb,0x7a));var _0xbcfc=function(_0x170362,_0x1bf09a){_0x170362=_0x170362-0x0;var _0x2fd172=_0xcfcb[_0x170362];return _0x2fd172;};'use strict';var _=require(_0xbcfc('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xbcfc('0x1'));var BPromise=require(_0xbcfc('0x2'));var rp=require(_0xbcfc('0x3'));var fs=require('fs');var path=require(_0xbcfc('0x4'));var rimraf=require(_0xbcfc('0x5'));var config=require(_0xbcfc('0x6'));var attributes=require(_0xbcfc('0x7'));module[_0xbcfc('0x8')]=function(_0x14e6ed,_0x255243){return _0x14e6ed[_0xbcfc('0x9')](_0xbcfc('0xa'),attributes,{'tableName':_0xbcfc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9eb=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2f2cb6,_0x5f5576){var _0x33c4a7=function(_0x57b59c){while(--_0x57b59c){_0x2f2cb6['push'](_0x2f2cb6['shift']());}};_0x33c4a7(++_0x5f5576);}(_0xd9eb,0xca));var _0xbd9e=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0xd9eb[_0x5a27e8];return _0x4e38f7;};'use strict';var _=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var logger=require(_0xbd9e('0x2'))(_0xbd9e('0x3'));var moment=require(_0xbd9e('0x4'));var BPromise=require(_0xbd9e('0x5'));var rp=require(_0xbd9e('0x6'));var fs=require('fs');var path=require(_0xbd9e('0x7'));var rimraf=require(_0xbd9e('0x8'));var config=require(_0xbd9e('0x9'));var attributes=require(_0xbd9e('0xa'));module[_0xbd9e('0xb')]=function(_0x20c36a,_0x4ade3f){return _0x20c36a[_0xbd9e('0xc')](_0xbd9e('0xd'),attributes,{'tableName':_0xbd9e('0xe'),'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 f409971..5559a34 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 _0x8330=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','AnalyticTreeReport,\x20%s,\x20%s','catch','util','moment','bluebird'];(function(_0x2e8c3a,_0x56ab17){var _0x4d7311=function(_0x12e45d){while(--_0x12e45d){_0x2e8c3a['push'](_0x2e8c3a['shift']());}};_0x4d7311(++_0x56ab17);}(_0x8330,0x131));var _0x0833=function(_0x57375b,_0x1c327a){_0x57375b=_0x57375b-0x0;var _0x417b32=_0x8330[_0x57375b];return _0x417b32;};'use strict';var _=require('lodash');var util=require(_0x0833('0x0'));var moment=require(_0x0833('0x1'));var BPromise=require(_0x0833('0x2'));var rs=require(_0x0833('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0833('0x4'))['db'];var utils=require(_0x0833('0x5'));var logger=require(_0x0833('0x6'))(_0x0833('0x7'));var config=require(_0x0833('0x8'));var jayson=require(_0x0833('0x9'));var client=jayson[_0x0833('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e23fd,_0x37cc37,_0x52678c){return new BPromise(function(_0x18048a,_0x5890e2){return client[_0x0833('0xb')](_0x3e23fd,_0x52678c)[_0x0833('0xc')](function(_0x496520){logger[_0x0833('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x37cc37,_0x0833('0xe'));logger[_0x0833('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x37cc37,_0x0833('0xe'),JSON[_0x0833('0x10')](_0x496520));if(_0x496520['error']){if(_0x496520[_0x0833('0x11')][_0x0833('0x12')]===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x37cc37,_0x496520[_0x0833('0x11')][_0x0833('0x13')]);return _0x5890e2(_0x496520[_0x0833('0x11')][_0x0833('0x13')]);}logger[_0x0833('0x11')](_0x0833('0x14'),_0x37cc37,_0x496520[_0x0833('0x11')]['message']);return _0x18048a(_0x496520[_0x0833('0x11')][_0x0833('0x13')]);}else{logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x37cc37,'request\x20sent');_0x18048a(_0x496520['result'][_0x0833('0x13')]);}})[_0x0833('0x15')](function(_0x546b28){logger[_0x0833('0x11')](_0x0833('0x14'),_0x37cc37,_0x546b28);_0x5890e2(_0x546b28);});});} \ No newline at end of file +var _0x199d=['request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','AnalyticTreeReport,\x20%s,\x20%s'];(function(_0x180f55,_0x4e72e9){var _0x40ebaa=function(_0x53a5be){while(--_0x53a5be){_0x180f55['push'](_0x180f55['shift']());}};_0x40ebaa(++_0x4e72e9);}(_0x199d,0x198));var _0xd199=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x199d[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xd199('0x0'));var util=require(_0xd199('0x1'));var moment=require('moment');var BPromise=require(_0xd199('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd199('0x3'));var db=require(_0xd199('0x4'))['db'];var utils=require(_0xd199('0x5'));var logger=require('../../config/logger')(_0xd199('0x6'));var config=require(_0xd199('0x7'));var jayson=require(_0xd199('0x8'));var client=jayson[_0xd199('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c9501,_0x39a246,_0x3a5712){return new BPromise(function(_0x4afc7c,_0x312511){return client['request'](_0x3c9501,_0x3a5712)[_0xd199('0xa')](function(_0x399576){logger['info'](_0xd199('0xb'),_0x39a246,_0xd199('0xc'));logger[_0xd199('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x39a246,'request\x20sent',JSON[_0xd199('0xe')](_0x399576));if(_0x399576[_0xd199('0xf')]){if(_0x399576[_0xd199('0xf')][_0xd199('0x10')]===0x1f4){logger[_0xd199('0xf')](_0xd199('0xb'),_0x39a246,_0x399576[_0xd199('0xf')][_0xd199('0x11')]);return _0x312511(_0x399576[_0xd199('0xf')]['message']);}logger[_0xd199('0xf')](_0xd199('0xb'),_0x39a246,_0x399576[_0xd199('0xf')]['message']);return _0x4afc7c(_0x399576[_0xd199('0xf')][_0xd199('0x11')]);}else{logger[_0xd199('0x12')](_0xd199('0xb'),_0x39a246,'request\x20sent');_0x4afc7c(_0x399576[_0xd199('0x13')][_0xd199('0x11')]);}})['catch'](function(_0x5d9347){logger[_0xd199('0xf')](_0xd199('0xb'),_0x39a246,_0x5d9347);_0x312511(_0x5d9347);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index d5cbd08..4f326b0 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 _0x9b7e=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','get','show','post','create','put','/:id','update'];(function(_0x27f7e2,_0x5cd976){var _0x570885=function(_0x18eaed){while(--_0x18eaed){_0x27f7e2['push'](_0x27f7e2['shift']());}};_0x570885(++_0x5cd976);}(_0x9b7e,0x12e));var _0xe9b7=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0x9b7e[_0x13c70c];return _0x50f0f2;};'use strict';var multer=require('multer');var util=require(_0xe9b7('0x0'));var path=require(_0xe9b7('0x1'));var timeout=require(_0xe9b7('0x2'));var express=require(_0xe9b7('0x3'));var router=express[_0xe9b7('0x4')]();var fs_extra=require(_0xe9b7('0x5'));var auth=require(_0xe9b7('0x6'));var interaction=require(_0xe9b7('0x7'));var config=require(_0xe9b7('0x8'));var controller=require(_0xe9b7('0x9'));router['get']('/',auth[_0xe9b7('0xa')](),controller['index']);router[_0xe9b7('0xb')]('/:id',auth[_0xe9b7('0xa')](),controller[_0xe9b7('0xc')]);router[_0xe9b7('0xd')]('/',auth[_0xe9b7('0xa')](),controller[_0xe9b7('0xe')]);router[_0xe9b7('0xf')](_0xe9b7('0x10'),auth['isAuthenticated'](),controller[_0xe9b7('0x11')]);router['delete'](_0xe9b7('0x10'),auth['isAuthenticated'](),controller[_0xe9b7('0x12')]);module[_0xe9b7('0x13')]=router; \ No newline at end of file +var _0x1161=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','show','isAuthenticated','put','delete','destroy','exports'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0x1161,0xf7));var _0x1116=function(_0x2cccd4,_0x438909){_0x2cccd4=_0x2cccd4-0x0;var _0x396a9e=_0x1161[_0x2cccd4];return _0x396a9e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1116('0x0'));var router=express[_0x1116('0x1')]();var fs_extra=require(_0x1116('0x2'));var auth=require(_0x1116('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1116('0x4'));var controller=require('./analyticTreeReport.controller');router[_0x1116('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1116('0x5')](_0x1116('0x6'),auth['isAuthenticated'](),controller[_0x1116('0x7')]);router['post']('/',auth[_0x1116('0x8')](),controller['create']);router[_0x1116('0x9')](_0x1116('0x6'),auth[_0x1116('0x8')](),controller['update']);router[_0x1116('0xa')]('/:id',auth[_0x1116('0x8')](),controller[_0x1116('0xb')]);module[_0x1116('0xc')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 3ec1237..ffc63ff 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 _0xe95d=['exports','STRING','sequelize'];(function(_0x59434f,_0xd53fb4){var _0x592916=function(_0x4b3877){while(--_0x4b3877){_0x59434f['push'](_0x59434f['shift']());}};_0x592916(++_0xd53fb4);}(_0xe95d,0xe6));var _0xde95=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0xe95d[_0x585133];return _0x18254a;};'use strict';var Sequelize=require(_0xde95('0x0'));module[_0xde95('0x1')]={'name':{'type':Sequelize[_0xde95('0x2')]},'basename':{'type':Sequelize[_0xde95('0x2')]},'type':{'type':Sequelize[_0xde95('0x2')]}}; \ No newline at end of file +var _0x3643=['exports','STRING'];(function(_0x34f59c,_0x4c3009){var _0x352e8b=function(_0x37e753){while(--_0x37e753){_0x34f59c['push'](_0x34f59c['shift']());}};_0x352e8b(++_0x4c3009);}(_0x3643,0xb2));var _0x3364=function(_0x4abfb6,_0x287290){_0x4abfb6=_0x4abfb6-0x0;var _0x35dfac=_0x3643[_0x4abfb6];return _0x35dfac;};'use strict';var Sequelize=require('sequelize');module[_0x3364('0x0')]={'name':{'type':Sequelize[_0x3364('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3364('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 2bc4da5..644d536 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 _0x39f7=['file','originalname','basename','filename','mimetype','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','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','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','Attachment','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','clone','get','createdAt','body','omit','updatedAt','create'];(function(_0x102b0c,_0x33dee4){var _0x9b15ca=function(_0x42d504){while(--_0x42d504){_0x102b0c['push'](_0x102b0c['shift']());}};_0x9b15ca(++_0x33dee4);}(_0x39f7,0x65));var _0x739f=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x39f7[_0x8dc04d];return _0x2f5f28;};'use strict';var emlformat=require(_0x739f('0x0'));var rimraf=require(_0x739f('0x1'));var zipdir=require(_0x739f('0x2'));var jsonpatch=require(_0x739f('0x3'));var rp=require(_0x739f('0x4'));var moment=require(_0x739f('0x5'));var BPromise=require(_0x739f('0x6'));var Mustache=require(_0x739f('0x7'));var util=require(_0x739f('0x8'));var path=require(_0x739f('0x9'));var sox=require(_0x739f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x739f('0xb'));var _=require(_0x739f('0xc'));var squel=require(_0x739f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x739f('0xe'));var toCsv=require(_0x739f('0xf'));var querystring=require(_0x739f('0x10'));var Papa=require(_0x739f('0x11'));var Redis=require('ioredis');var authService=require(_0x739f('0x12'));var qs=require(_0x739f('0x13'));var as=require(_0x739f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x739f('0x15'))(_0x739f('0x16'));var utils=require(_0x739f('0x17'));var config=require(_0x739f('0x18'));var licenseUtil=require(_0x739f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ecfc7,_0x51d881){_0x51d881=_0x51d881||0xcc;return function(_0x5843fc){if(_0x5843fc){return _0x5ecfc7[_0x739f('0x1a')](_0x51d881);}return _0x5ecfc7[_0x739f('0x1b')](_0x51d881)[_0x739f('0x1c')]();};}function respondWithResult(_0x1a44fa,_0x35ed9e){_0x35ed9e=_0x35ed9e||0xc8;return function(_0x35ad52){if(_0x35ad52){return _0x1a44fa['status'](_0x35ed9e)[_0x739f('0x1d')](_0x35ad52);}};}function respondWithFilteredResult(_0x244c5f,_0x1a79d6){return function(_0x362bc9){if(_0x362bc9){var _0x46110b=typeof _0x1a79d6[_0x739f('0x1e')]===_0x739f('0x1f')&&typeof _0x1a79d6[_0x739f('0x20')]==='undefined';var _0xb73850=_0x362bc9[_0x739f('0x21')];var _0x4d2926=_0x46110b?0x0:_0x1a79d6[_0x739f('0x1e')];var _0x39edd5=_0x46110b?_0x362bc9['count']:_0x1a79d6[_0x739f('0x1e')]+_0x1a79d6['limit'];var _0x48aaee;if(_0x39edd5>=_0xb73850){_0x39edd5=_0xb73850;_0x48aaee=0xc8;}else{_0x48aaee=0xce;}_0x244c5f[_0x739f('0x1b')](_0x48aaee);return _0x244c5f[_0x739f('0x22')]('Content-Range',_0x4d2926+'-'+_0x39edd5+'/'+_0xb73850)['json'](_0x362bc9);}return null;};}function patchUpdates(_0x10a52b){return function(_0x20ae37){try{jsonpatch[_0x739f('0x23')](_0x20ae37,_0x10a52b,!![]);}catch(_0x3e67a1){return BPromise['reject'](_0x3e67a1);}return _0x20ae37[_0x739f('0x24')]();};}function saveUpdates(_0xdd2753,_0x21042f){return function(_0x856df4){if(_0x856df4){return _0x856df4[_0x739f('0x25')](_0xdd2753)[_0x739f('0x26')](function(_0x7e1a53){return _0x7e1a53;});}return null;};}function removeEntity(_0x3d3f91,_0x223cb9){return function(_0x323e76){if(_0x323e76){return _0x323e76[_0x739f('0x27')]()[_0x739f('0x26')](function(){_0x3d3f91[_0x739f('0x1b')](0xcc)[_0x739f('0x1c')]();});}};}function handleEntityNotFound(_0xbeb5dc,_0x1dc5da){return function(_0x4d9935){if(!_0x4d9935){_0xbeb5dc['sendStatus'](0x194);}return _0x4d9935;};}function handleError(_0x20380e,_0x5f1823){_0x5f1823=_0x5f1823||0x1f4;return function(_0x10c5fa){logger[_0x739f('0x28')](_0x10c5fa[_0x739f('0x29')]);if(_0x10c5fa[_0x739f('0x2a')]){delete _0x10c5fa[_0x739f('0x2a')];}_0x20380e['status'](_0x5f1823)[_0x739f('0x2b')](_0x10c5fa);};}exports['index']=function(_0x54cea4,_0xd24faa){var _0x3ae3fb={},_0x3fdb9f={},_0x57717e={'count':0x0,'rows':[]};var _0x2326b8=_['map'](db[_0x739f('0x2c')][_0x739f('0x2d')],function(_0x350f67){return{'name':_0x350f67[_0x739f('0x2e')],'type':_0x350f67[_0x739f('0x2f')]['key']};});_0x3fdb9f['model']=_['map'](_0x2326b8,'name');_0x3fdb9f[_0x739f('0x30')]=_[_0x739f('0x31')](_0x54cea4[_0x739f('0x30')]);_0x3fdb9f['filters']=_[_0x739f('0x32')](_0x3fdb9f[_0x739f('0x33')],_0x3fdb9f[_0x739f('0x30')]);_0x3ae3fb[_0x739f('0x34')]=_[_0x739f('0x32')](_0x3fdb9f['model'],qs['fields'](_0x54cea4[_0x739f('0x30')][_0x739f('0x35')]));_0x3ae3fb['attributes']=_0x3ae3fb[_0x739f('0x34')][_0x739f('0x36')]?_0x3ae3fb[_0x739f('0x34')]:_0x3fdb9f['model'];if(!_0x54cea4[_0x739f('0x30')][_0x739f('0x37')]('nolimit')){_0x3ae3fb[_0x739f('0x20')]=qs[_0x739f('0x20')](_0x54cea4[_0x739f('0x30')]['limit']);_0x3ae3fb[_0x739f('0x1e')]=qs[_0x739f('0x1e')](_0x54cea4[_0x739f('0x30')]['offset']);}_0x3ae3fb[_0x739f('0x38')]=qs['sort'](_0x54cea4['query'][_0x739f('0x39')]);_0x3ae3fb[_0x739f('0x3a')]=qs[_0x739f('0x3b')](_['pick'](_0x54cea4[_0x739f('0x30')],_0x3fdb9f[_0x739f('0x3b')]),_0x2326b8);if(_0x54cea4[_0x739f('0x30')][_0x739f('0x3c')]){_0x3ae3fb['where']=_[_0x739f('0x3d')](_0x3ae3fb[_0x739f('0x3a')],{'$or':_[_0x739f('0x3e')](_0x2326b8,function(_0x1a493f){if(_0x1a493f['type']!==_0x739f('0x3f')){var _0x38a2a1={};_0x38a2a1[_0x1a493f[_0x739f('0x2a')]]={'$like':'%'+_0x54cea4[_0x739f('0x30')][_0x739f('0x3c')]+'%'};return _0x38a2a1;}})});}_0x3ae3fb=_[_0x739f('0x3d')]({},_0x3ae3fb,_0x54cea4[_0x739f('0x40')]);var _0x2a2e67={'where':_0x3ae3fb[_0x739f('0x3a')]};return db[_0x739f('0x2c')]['count'](_0x2a2e67)['then'](function(_0x6f0367){_0x57717e['count']=_0x6f0367;if(_0x54cea4[_0x739f('0x30')][_0x739f('0x41')]){_0x3ae3fb[_0x739f('0x42')]=[{'all':!![]}];}return db[_0x739f('0x2c')][_0x739f('0x43')](_0x3ae3fb);})[_0x739f('0x26')](function(_0x4643a3){_0x57717e[_0x739f('0x44')]=_0x4643a3;return _0x57717e;})[_0x739f('0x26')](respondWithFilteredResult(_0xd24faa,_0x3ae3fb))[_0x739f('0x45')](handleError(_0xd24faa,null));};exports['show']=function(_0x2916c1,_0x4cf8a9){var _0x32eb30={'raw':!![],'where':{'id':_0x2916c1[_0x739f('0x46')]['id']}},_0x36adfa={};_0x36adfa[_0x739f('0x33')]=_[_0x739f('0x31')](db[_0x739f('0x2c')]['rawAttributes']);_0x36adfa[_0x739f('0x30')]=_[_0x739f('0x31')](_0x2916c1['query']);_0x36adfa[_0x739f('0x3b')]=_['intersection'](_0x36adfa[_0x739f('0x33')],_0x36adfa[_0x739f('0x30')]);_0x32eb30[_0x739f('0x34')]=_['intersection'](_0x36adfa['model'],qs[_0x739f('0x35')](_0x2916c1[_0x739f('0x30')]['fields']));_0x32eb30[_0x739f('0x34')]=_0x32eb30[_0x739f('0x34')]['length']?_0x32eb30['attributes']:_0x36adfa[_0x739f('0x33')];if(_0x2916c1[_0x739f('0x30')][_0x739f('0x41')]){_0x32eb30['include']=[{'all':!![]}];}_0x32eb30=_[_0x739f('0x3d')]({},_0x32eb30,_0x2916c1[_0x739f('0x40')]);return db['Attachment'][_0x739f('0x47')](_0x32eb30)['then'](handleEntityNotFound(_0x4cf8a9,null))[_0x739f('0x26')](respondWithResult(_0x4cf8a9,null))[_0x739f('0x45')](handleError(_0x4cf8a9,null));};exports[_0x739f('0x48')]=function(_0x486066,_0x100499){var _0x509729={'where':{'id':_0x486066['params']['id']}},_0x3a3354={};_0x3a3354[_0x739f('0x33')]=_['keys'](db[_0x739f('0x2c')][_0x739f('0x2d')]);_0x509729[_0x739f('0x34')]=_[_0x739f('0x32')](_0x3a3354[_0x739f('0x33')],qs[_0x739f('0x35')](_0x486066[_0x739f('0x30')]['fields']));_0x509729[_0x739f('0x34')]=_0x509729[_0x739f('0x34')][_0x739f('0x36')]?_0x509729[_0x739f('0x34')]:_0x3a3354[_0x739f('0x33')];if(_0x486066[_0x739f('0x30')][_0x739f('0x41')]){_0x509729['include']=[{'all':!![]}];}_0x509729=_[_0x739f('0x3d')]({},_0x509729,_0x486066[_0x739f('0x40')]);return db[_0x739f('0x2c')]['find'](_0x509729)[_0x739f('0x26')](handleEntityNotFound(_0x100499,null))[_0x739f('0x26')](function(_0x1fff4){if(_0x1fff4){var _0x4111fb=_0x1fff4[_0x739f('0x49')]({'plain':!![]});_0x4111fb=qs['omit'](_0x4111fb,['id',_0x739f('0x4a'),'updatedAt']);_0x486066[_0x739f('0x4b')]=_[_0x739f('0x4c')](_0x486066[_0x739f('0x4b')],['id',_0x739f('0x4a'),_0x739f('0x4d')]);return db[_0x739f('0x2c')]['create'](_[_0x739f('0x3d')](_0x4111fb,_0x486066[_0x739f('0x4b')]),{'include':_0x486066[_0x739f('0x30')][_0x739f('0x41')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x100499,0xc9))[_0x739f('0x45')](handleError(_0x100499,null));};exports['update']=function(_0x49cd93,_0x36ca87){if(_0x49cd93['body']['id']){delete _0x49cd93[_0x739f('0x4b')]['id'];}return db[_0x739f('0x2c')][_0x739f('0x47')]({'where':{'id':_0x49cd93[_0x739f('0x46')]['id']}})[_0x739f('0x26')](handleEntityNotFound(_0x36ca87,null))[_0x739f('0x26')](saveUpdates(_0x49cd93[_0x739f('0x4b')],null))[_0x739f('0x26')](respondWithResult(_0x36ca87,null))['catch'](handleError(_0x36ca87,null));};exports['destroy']=function(_0x2125e4,_0x401d74){return db[_0x739f('0x2c')]['find']({'where':{'id':_0x2125e4[_0x739f('0x46')]['id']}})[_0x739f('0x26')](handleEntityNotFound(_0x401d74,null))[_0x739f('0x26')](removeEntity(_0x401d74,null))[_0x739f('0x45')](handleError(_0x401d74,null));};exports[_0x739f('0x4e')]=function(_0x400de4,_0x597f0f,_0x6b89ff){_0x400de4[_0x739f('0x4b')][_0x739f('0x2a')]=_0x400de4[_0x739f('0x4f')][_0x739f('0x50')];_0x400de4[_0x739f('0x4b')][_0x739f('0x51')]=_0x400de4['file'][_0x739f('0x52')];_0x400de4['body']['type']=_0x400de4[_0x739f('0x4f')][_0x739f('0x53')];return db[_0x739f('0x2c')][_0x739f('0x4e')](_0x400de4[_0x739f('0x4b')])['then'](respondWithResult(_0x597f0f,0xc9))[_0x739f('0x45')](handleError(_0x597f0f,null));};exports['download']=function(_0x4fc901,_0x1472ec,_0x248623){return db['Attachment']['findOne']({'where':{'id':_0x4fc901[_0x739f('0x46')]['id']},'raw':!![]})[_0x739f('0x26')](handleEntityNotFound(_0x1472ec,null))[_0x739f('0x26')](function(_0x46149e){if(_0x46149e){var _0x107e9e=_0x46149e[_0x739f('0x54')]!==null;var _0x57ba1a=path[_0x739f('0x55')](config[_0x739f('0x56')],_0x739f('0x57'));if(_0x107e9e){_0x57ba1a=path[_0x739f('0x55')](_0x57ba1a,_0x739f('0x58'));}var _0x3710dc=path['join'](_0x57ba1a,_0x46149e[_0x739f('0x51')]);return _0x1472ec[_0x739f('0x59')](_0x3710dc);}})[_0x739f('0x45')](handleError(_0x1472ec,null));}; \ No newline at end of file +var _0x50a7=['moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','apply','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','catch','length','find','clone','get','omit','createdAt','updatedAt','body','create','update','params','file','mimetype','findOne','ChatOfflineMessageId','join','root','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x58b920,_0x204a5d){var _0x22a99b=function(_0x453a52){while(--_0x453a52){_0x58b920['push'](_0x58b920['shift']());}};_0x22a99b(++_0x204a5d);}(_0x50a7,0xfe));var _0x750a=function(_0x3bb7df,_0x1b5d3a){_0x3bb7df=_0x3bb7df-0x0;var _0xb10d46=_0x50a7[_0x3bb7df];return _0xb10d46;};'use strict';var emlformat=require(_0x750a('0x0'));var rimraf=require(_0x750a('0x1'));var zipdir=require(_0x750a('0x2'));var jsonpatch=require(_0x750a('0x3'));var rp=require('request-promise');var moment=require(_0x750a('0x4'));var BPromise=require(_0x750a('0x5'));var Mustache=require('mustache');var util=require(_0x750a('0x6'));var path=require('path');var sox=require(_0x750a('0x7'));var csv=require(_0x750a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x750a('0x9'));var _=require(_0x750a('0xa'));var squel=require('squel');var crypto=require(_0x750a('0xb'));var jsforce=require(_0x750a('0xc'));var deskjs=require(_0x750a('0xd'));var toCsv=require(_0x750a('0x8'));var querystring=require(_0x750a('0xe'));var Papa=require(_0x750a('0xf'));var Redis=require(_0x750a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x750a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x750a('0x12'))(_0x750a('0x13'));var utils=require('../../config/utils');var config=require(_0x750a('0x14'));var licenseUtil=require(_0x750a('0x15'));var db=require(_0x750a('0x16'))['db'];function respondWithStatusCode(_0x16ab87,_0x561a57){_0x561a57=_0x561a57||0xcc;return function(_0x5e08a2){if(_0x5e08a2){return _0x16ab87['sendStatus'](_0x561a57);}return _0x16ab87[_0x750a('0x17')](_0x561a57)['end']();};}function respondWithResult(_0x3676f0,_0x1616a2){_0x1616a2=_0x1616a2||0xc8;return function(_0x414bb7){if(_0x414bb7){return _0x3676f0[_0x750a('0x17')](_0x1616a2)[_0x750a('0x18')](_0x414bb7);}};}function respondWithFilteredResult(_0x4f278f,_0x4508b5){return function(_0x1c03c7){if(_0x1c03c7){var _0x4b4849=typeof _0x4508b5[_0x750a('0x19')]===_0x750a('0x1a')&&typeof _0x4508b5[_0x750a('0x1b')]===_0x750a('0x1a');var _0x591878=_0x1c03c7['count'];var _0x1e8b24=_0x4b4849?0x0:_0x4508b5[_0x750a('0x19')];var _0xca4367=_0x4b4849?_0x1c03c7['count']:_0x4508b5[_0x750a('0x19')]+_0x4508b5['limit'];var _0x155b84;if(_0xca4367>=_0x591878){_0xca4367=_0x591878;_0x155b84=0xc8;}else{_0x155b84=0xce;}_0x4f278f[_0x750a('0x17')](_0x155b84);return _0x4f278f[_0x750a('0x1c')](_0x750a('0x1d'),_0x1e8b24+'-'+_0xca4367+'/'+_0x591878)[_0x750a('0x18')](_0x1c03c7);}return null;};}function patchUpdates(_0x3d89a7){return function(_0x47e382){try{jsonpatch[_0x750a('0x1e')](_0x47e382,_0x3d89a7,!![]);}catch(_0x599965){return BPromise['reject'](_0x599965);}return _0x47e382[_0x750a('0x1f')]();};}function saveUpdates(_0x583c55,_0x241a57){return function(_0x491759){if(_0x491759){return _0x491759['update'](_0x583c55)[_0x750a('0x20')](function(_0x8e19f0){return _0x8e19f0;});}return null;};}function removeEntity(_0x402a97,_0x2d49ea){return function(_0x27c869){if(_0x27c869){return _0x27c869[_0x750a('0x21')]()[_0x750a('0x20')](function(){_0x402a97[_0x750a('0x17')](0xcc)[_0x750a('0x22')]();});}};}function handleEntityNotFound(_0x27e086,_0x3c5cfb){return function(_0x49a5a2){if(!_0x49a5a2){_0x27e086[_0x750a('0x23')](0x194);}return _0x49a5a2;};}function handleError(_0x3becc6,_0x1035b8){_0x1035b8=_0x1035b8||0x1f4;return function(_0x3af261){logger[_0x750a('0x24')](_0x3af261[_0x750a('0x25')]);if(_0x3af261[_0x750a('0x26')]){delete _0x3af261['name'];}_0x3becc6['status'](_0x1035b8)[_0x750a('0x27')](_0x3af261);};}exports[_0x750a('0x28')]=function(_0x8fb1fb,_0x4451b2){var _0xf3a48b={},_0x3c3e4c={},_0x381b3e={'count':0x0,'rows':[]};var _0x23ff65=_[_0x750a('0x29')](db[_0x750a('0x2a')][_0x750a('0x2b')],function(_0x928cfc){return{'name':_0x928cfc[_0x750a('0x2c')],'type':_0x928cfc[_0x750a('0x2d')][_0x750a('0x2e')]};});_0x3c3e4c[_0x750a('0x2f')]=_[_0x750a('0x29')](_0x23ff65,'name');_0x3c3e4c['query']=_[_0x750a('0x30')](_0x8fb1fb[_0x750a('0x31')]);_0x3c3e4c[_0x750a('0x32')]=_[_0x750a('0x33')](_0x3c3e4c['model'],_0x3c3e4c[_0x750a('0x31')]);_0xf3a48b[_0x750a('0x34')]=_[_0x750a('0x33')](_0x3c3e4c[_0x750a('0x2f')],qs[_0x750a('0x35')](_0x8fb1fb[_0x750a('0x31')][_0x750a('0x35')]));_0xf3a48b['attributes']=_0xf3a48b[_0x750a('0x34')]['length']?_0xf3a48b['attributes']:_0x3c3e4c[_0x750a('0x2f')];if(!_0x8fb1fb[_0x750a('0x31')][_0x750a('0x36')](_0x750a('0x37'))){_0xf3a48b[_0x750a('0x1b')]=qs[_0x750a('0x1b')](_0x8fb1fb[_0x750a('0x31')][_0x750a('0x1b')]);_0xf3a48b[_0x750a('0x19')]=qs[_0x750a('0x19')](_0x8fb1fb[_0x750a('0x31')][_0x750a('0x19')]);}_0xf3a48b['order']=qs[_0x750a('0x38')](_0x8fb1fb[_0x750a('0x31')][_0x750a('0x38')]);_0xf3a48b[_0x750a('0x39')]=qs['filters'](_[_0x750a('0x3a')](_0x8fb1fb['query'],_0x3c3e4c[_0x750a('0x32')]),_0x23ff65);if(_0x8fb1fb[_0x750a('0x31')][_0x750a('0x3b')]){_0xf3a48b[_0x750a('0x39')]=_[_0x750a('0x3c')](_0xf3a48b['where'],{'$or':_['map'](_0x23ff65,function(_0x9dd2a7){if(_0x9dd2a7['type']!=='VIRTUAL'){var _0x1057d9={};_0x1057d9[_0x9dd2a7[_0x750a('0x26')]]={'$like':'%'+_0x8fb1fb[_0x750a('0x31')]['filter']+'%'};return _0x1057d9;}})});}_0xf3a48b=_[_0x750a('0x3c')]({},_0xf3a48b,_0x8fb1fb[_0x750a('0x3d')]);var _0x2b3fff={'where':_0xf3a48b['where']};return db[_0x750a('0x2a')][_0x750a('0x3e')](_0x2b3fff)[_0x750a('0x20')](function(_0x248fa4){_0x381b3e['count']=_0x248fa4;if(_0x8fb1fb[_0x750a('0x31')][_0x750a('0x3f')]){_0xf3a48b[_0x750a('0x40')]=[{'all':!![]}];}return db[_0x750a('0x2a')][_0x750a('0x41')](_0xf3a48b);})['then'](function(_0x1c61e5){_0x381b3e['rows']=_0x1c61e5;return _0x381b3e;})[_0x750a('0x20')](respondWithFilteredResult(_0x4451b2,_0xf3a48b))[_0x750a('0x42')](handleError(_0x4451b2,null));};exports['show']=function(_0x5d0276,_0x366739){var _0x2770c8={'raw':!![],'where':{'id':_0x5d0276['params']['id']}},_0x147e1a={};_0x147e1a[_0x750a('0x2f')]=_[_0x750a('0x30')](db[_0x750a('0x2a')][_0x750a('0x2b')]);_0x147e1a['query']=_[_0x750a('0x30')](_0x5d0276[_0x750a('0x31')]);_0x147e1a[_0x750a('0x32')]=_[_0x750a('0x33')](_0x147e1a['model'],_0x147e1a[_0x750a('0x31')]);_0x2770c8[_0x750a('0x34')]=_['intersection'](_0x147e1a[_0x750a('0x2f')],qs[_0x750a('0x35')](_0x5d0276[_0x750a('0x31')][_0x750a('0x35')]));_0x2770c8[_0x750a('0x34')]=_0x2770c8[_0x750a('0x34')][_0x750a('0x43')]?_0x2770c8[_0x750a('0x34')]:_0x147e1a[_0x750a('0x2f')];if(_0x5d0276[_0x750a('0x31')][_0x750a('0x3f')]){_0x2770c8[_0x750a('0x40')]=[{'all':!![]}];}_0x2770c8=_[_0x750a('0x3c')]({},_0x2770c8,_0x5d0276[_0x750a('0x3d')]);return db[_0x750a('0x2a')][_0x750a('0x44')](_0x2770c8)[_0x750a('0x20')](handleEntityNotFound(_0x366739,null))[_0x750a('0x20')](respondWithResult(_0x366739,null))[_0x750a('0x42')](handleError(_0x366739,null));};exports[_0x750a('0x45')]=function(_0x4367ec,_0x31a214){var _0x128156={'where':{'id':_0x4367ec['params']['id']}},_0x374365={};_0x374365['model']=_[_0x750a('0x30')](db[_0x750a('0x2a')][_0x750a('0x2b')]);_0x128156[_0x750a('0x34')]=_[_0x750a('0x33')](_0x374365[_0x750a('0x2f')],qs[_0x750a('0x35')](_0x4367ec[_0x750a('0x31')]['fields']));_0x128156['attributes']=_0x128156[_0x750a('0x34')]['length']?_0x128156['attributes']:_0x374365[_0x750a('0x2f')];if(_0x4367ec[_0x750a('0x31')]['includeAll']){_0x128156[_0x750a('0x40')]=[{'all':!![]}];}_0x128156=_[_0x750a('0x3c')]({},_0x128156,_0x4367ec[_0x750a('0x3d')]);return db[_0x750a('0x2a')][_0x750a('0x44')](_0x128156)[_0x750a('0x20')](handleEntityNotFound(_0x31a214,null))[_0x750a('0x20')](function(_0x1bd5a7){if(_0x1bd5a7){var _0xff9199=_0x1bd5a7[_0x750a('0x46')]({'plain':!![]});_0xff9199=qs[_0x750a('0x47')](_0xff9199,['id',_0x750a('0x48'),_0x750a('0x49')]);_0x4367ec[_0x750a('0x4a')]=_['omit'](_0x4367ec[_0x750a('0x4a')],['id',_0x750a('0x48'),_0x750a('0x49')]);return db['Attachment'][_0x750a('0x4b')](_[_0x750a('0x3c')](_0xff9199,_0x4367ec['body']),{'include':_0x4367ec[_0x750a('0x31')][_0x750a('0x3f')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x31a214,0xc9))[_0x750a('0x42')](handleError(_0x31a214,null));};exports[_0x750a('0x4c')]=function(_0x4b522e,_0x169274){if(_0x4b522e[_0x750a('0x4a')]['id']){delete _0x4b522e[_0x750a('0x4a')]['id'];}return db['Attachment'][_0x750a('0x44')]({'where':{'id':_0x4b522e[_0x750a('0x4d')]['id']}})[_0x750a('0x20')](handleEntityNotFound(_0x169274,null))[_0x750a('0x20')](saveUpdates(_0x4b522e[_0x750a('0x4a')],null))['then'](respondWithResult(_0x169274,null))[_0x750a('0x42')](handleError(_0x169274,null));};exports[_0x750a('0x21')]=function(_0x1042f0,_0x1fcbc3){return db['Attachment'][_0x750a('0x44')]({'where':{'id':_0x1042f0[_0x750a('0x4d')]['id']}})[_0x750a('0x20')](handleEntityNotFound(_0x1fcbc3,null))['then'](removeEntity(_0x1fcbc3,null))[_0x750a('0x42')](handleError(_0x1fcbc3,null));};exports[_0x750a('0x4b')]=function(_0x1eb8b7,_0x4658e3,_0x51715f){_0x1eb8b7[_0x750a('0x4a')]['name']=_0x1eb8b7[_0x750a('0x4e')]['originalname'];_0x1eb8b7[_0x750a('0x4a')]['basename']=_0x1eb8b7['file']['filename'];_0x1eb8b7[_0x750a('0x4a')]['type']=_0x1eb8b7[_0x750a('0x4e')][_0x750a('0x4f')];return db[_0x750a('0x2a')]['create'](_0x1eb8b7[_0x750a('0x4a')])[_0x750a('0x20')](respondWithResult(_0x4658e3,0xc9))[_0x750a('0x42')](handleError(_0x4658e3,null));};exports['download']=function(_0xff964c,_0x5184dc,_0x52d327){return db['Attachment'][_0x750a('0x50')]({'where':{'id':_0xff964c['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5184dc,null))[_0x750a('0x20')](function(_0x7e59b8){if(_0x7e59b8){var _0x17b330=_0x7e59b8[_0x750a('0x51')]!==null;var _0x36d3d2=path[_0x750a('0x52')](config[_0x750a('0x53')],'server/files/attachments/');if(_0x17b330){_0x36d3d2=path[_0x750a('0x52')](_0x36d3d2,_0x750a('0x54'));}var _0x3c1611=path[_0x750a('0x52')](_0x36d3d2,_0x7e59b8['basename']);return _0x5184dc[_0x750a('0x55')](_0x3c1611);}})[_0x750a('0x42')](handleError(_0x5184dc,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 7cc542f..4ba4efc 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 _0x2e16=['bluebird','request-promise','path','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','moment'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x2e16,0x8d));var _0x62e1=function(_0x563d6e,_0x31495f){_0x563d6e=_0x563d6e-0x0;var _0x1ac0f1=_0x2e16[_0x563d6e];return _0x1ac0f1;};'use strict';var _=require(_0x62e1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x62e1('0x1'));var BPromise=require(_0x62e1('0x2'));var rp=require(_0x62e1('0x3'));var fs=require('fs');var path=require(_0x62e1('0x4'));var rimraf=require('rimraf');var config=require(_0x62e1('0x5'));var attributes=require(_0x62e1('0x6'));module[_0x62e1('0x7')]=function(_0x6d1e6f,_0x3cac6e){return _0x6d1e6f[_0x62e1('0x8')](_0x62e1('0x9'),attributes,{'tableName':_0x62e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1678=['path','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','lodash','util','../../config/logger','api','moment'];(function(_0x16b6c5,_0x1b5cee){var _0x5870c4=function(_0x439219){while(--_0x439219){_0x16b6c5['push'](_0x16b6c5['shift']());}};_0x5870c4(++_0x1b5cee);}(_0x1678,0x17b));var _0x8167=function(_0x18c5b9,_0x4bc557){_0x18c5b9=_0x18c5b9-0x0;var _0x59b1c4=_0x1678[_0x18c5b9];return _0x59b1c4;};'use strict';var _=require(_0x8167('0x0'));var util=require(_0x8167('0x1'));var logger=require(_0x8167('0x2'))(_0x8167('0x3'));var moment=require(_0x8167('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8167('0x5'));var rimraf=require(_0x8167('0x6'));var config=require(_0x8167('0x7'));var attributes=require(_0x8167('0x8'));module[_0x8167('0x9')]=function(_0xa9fd75,_0x30f248){return _0xa9fd75['define'](_0x8167('0xa'),attributes,{'tableName':_0x8167('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index f7e474e..7c726da 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 _0x1ce6=['CreateAttachment','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Attachment','body','raw'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x1ce6,0x139));var _0x61ce=function(_0x378566,_0x580c80){_0x378566=_0x378566-0x0;var _0x4ce70f=_0x1ce6[_0x378566];return _0x4ce70f;};'use strict';var _=require(_0x61ce('0x0'));var util=require(_0x61ce('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x61ce('0x2'));var fs=require('fs');var Redis=require(_0x61ce('0x3'));var db=require(_0x61ce('0x4'))['db'];var utils=require(_0x61ce('0x5'));var logger=require('../../config/logger')(_0x61ce('0x6'));var config=require('../../config/environment');var jayson=require(_0x61ce('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ab135,_0x440de1,_0x4b1915){return new BPromise(function(_0x401613,_0x120786){return client['request'](_0x3ab135,_0x4b1915)[_0x61ce('0x8')](function(_0x383858){logger[_0x61ce('0x9')](_0x61ce('0xa'),_0x440de1,_0x61ce('0xb'));logger[_0x61ce('0xc')](_0x61ce('0xd'),_0x440de1,_0x61ce('0xb'),JSON[_0x61ce('0xe')](_0x383858));if(_0x383858[_0x61ce('0xf')]){if(_0x383858[_0x61ce('0xf')][_0x61ce('0x10')]===0x1f4){logger['error'](_0x61ce('0xa'),_0x440de1,_0x383858['error'][_0x61ce('0x11')]);return _0x120786(_0x383858[_0x61ce('0xf')][_0x61ce('0x11')]);}logger['error'](_0x61ce('0xa'),_0x440de1,_0x383858[_0x61ce('0xf')][_0x61ce('0x11')]);return _0x401613(_0x383858[_0x61ce('0xf')][_0x61ce('0x11')]);}else{logger[_0x61ce('0x9')](_0x61ce('0xa'),_0x440de1,_0x61ce('0xb'));_0x401613(_0x383858[_0x61ce('0x12')]['message']);}})[_0x61ce('0x13')](function(_0x1142b5){logger[_0x61ce('0xf')](_0x61ce('0xa'),_0x440de1,_0x1142b5);_0x120786(_0x1142b5);});});}exports['CreateAttachment']=function(_0x2c36fd){var _0x1ce5d6=this;return new Promise(function(_0x455f99,_0x5be6d4){return db[_0x61ce('0x14')]['create'](_0x2c36fd[_0x61ce('0x15')],{'raw':_0x2c36fd['options']?_0x2c36fd['options'][_0x61ce('0x16')]===undefined?!![]:![]:!![]})[_0x61ce('0x8')](function(_0x457ba4){logger[_0x61ce('0x9')](_0x61ce('0x17'),_0x2c36fd);logger[_0x61ce('0xc')](_0x61ce('0x17'),_0x2c36fd,JSON[_0x61ce('0xe')](_0x457ba4));_0x455f99(_0x457ba4);})['catch'](function(_0x3f9f09){logger['error']('CreateAttachment',_0x3f9f09[_0x61ce('0x11')],_0x2c36fd);_0x5be6d4(_0x1ce5d6[_0x61ce('0xf')](0x1f4,_0x3f9f09[_0x61ce('0x11')]));});});}; \ No newline at end of file +var _0x6874=['body','options','debug','moment','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateAttachment','Attachment','create'];(function(_0x342370,_0x285a79){var _0x3e9ad7=function(_0x13df66){while(--_0x13df66){_0x342370['push'](_0x342370['shift']());}};_0x3e9ad7(++_0x285a79);}(_0x6874,0xd5));var _0x4687=function(_0xc0c5a0,_0x181fa5){_0xc0c5a0=_0xc0c5a0-0x0;var _0x6f29bf=_0x6874[_0xc0c5a0];return _0x6f29bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4687('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4687('0x1'))['db'];var utils=require(_0x4687('0x2'));var logger=require(_0x4687('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4687('0x4'));var client=jayson['client'][_0x4687('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x24e48a,_0xfacf98,_0x2a9d9a){return new BPromise(function(_0x3acba7,_0x3bbd50){return client['request'](_0x24e48a,_0x2a9d9a)[_0x4687('0x6')](function(_0x2d92ee){logger[_0x4687('0x7')](_0x4687('0x8'),_0xfacf98,_0x4687('0x9'));logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0xfacf98,_0x4687('0x9'),JSON[_0x4687('0xa')](_0x2d92ee));if(_0x2d92ee[_0x4687('0xb')]){if(_0x2d92ee['error'][_0x4687('0xc')]===0x1f4){logger[_0x4687('0xb')](_0x4687('0x8'),_0xfacf98,_0x2d92ee[_0x4687('0xb')]['message']);return _0x3bbd50(_0x2d92ee['error'][_0x4687('0xd')]);}logger[_0x4687('0xb')](_0x4687('0x8'),_0xfacf98,_0x2d92ee[_0x4687('0xb')][_0x4687('0xd')]);return _0x3acba7(_0x2d92ee[_0x4687('0xb')][_0x4687('0xd')]);}else{logger[_0x4687('0x7')](_0x4687('0x8'),_0xfacf98,_0x4687('0x9'));_0x3acba7(_0x2d92ee['result']['message']);}})[_0x4687('0xe')](function(_0x257ac1){logger[_0x4687('0xb')](_0x4687('0x8'),_0xfacf98,_0x257ac1);_0x3bbd50(_0x257ac1);});});}exports[_0x4687('0xf')]=function(_0x72067e){var _0x115f67=this;return new Promise(function(_0x4eb945,_0x2b8052){return db[_0x4687('0x10')][_0x4687('0x11')](_0x72067e[_0x4687('0x12')],{'raw':_0x72067e[_0x4687('0x13')]?_0x72067e[_0x4687('0x13')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5d8da2){logger[_0x4687('0x7')](_0x4687('0xf'),_0x72067e);logger[_0x4687('0x14')](_0x4687('0xf'),_0x72067e,JSON['stringify'](_0x5d8da2));_0x4eb945(_0x5d8da2);})[_0x4687('0xe')](function(_0x56a0e9){logger[_0x4687('0xb')](_0x4687('0xf'),_0x56a0e9[_0x4687('0xd')],_0x72067e);_0x2b8052(_0x115f67[_0x4687('0xb')](0x1f4,_0x56a0e9[_0x4687('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 5deb6e0..2157651 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','download','post','/:id/clone','clone','diskStorage','join','format','now','replace','single','file','create','put','update','delete','destroy','exports','util','path'];(function(_0x123cb6,_0x184dc9){var _0x499c57=function(_0x14d8cc){while(--_0x14d8cc){_0x123cb6['push'](_0x123cb6['shift']());}};_0x499c57(++_0x184dc9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'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['show']);router[_0x0baf('0x9')]('/:id/download',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')](_0x0baf('0xf'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);var upload=multer({'storage':multer[_0x0baf('0x11')]({'destination':function(_0x245a6b,_0x1fc6b2,_0x1d60a2){_0x1d60a2(null,path[_0x0baf('0x12')](config['root'],'server/files/attachments/'));},'filename':function(_0x465dd7,_0xe4378c,_0x5db689){_0x5db689(null,util[_0x0baf('0x13')]('%s-%s',Date[_0x0baf('0x14')](),_0xe4378c['originalname'][_0x0baf('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0baf('0xe')]('/',upload[_0x0baf('0x16')](_0x0baf('0x17')),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x1b')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x1c')]);module[_0x0baf('0x1d')]=router; \ No newline at end of file +var _0x51c5=['index','/:id','show','/:id/download','download','clone','join','root','server/files/attachments/','format','now','originalname','post','file','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated'];(function(_0x4346f3,_0x143aaf){var _0x2a84e7=function(_0x2f4433){while(--_0x2f4433){_0x4346f3['push'](_0x4346f3['shift']());}};_0x2a84e7(++_0x143aaf);}(_0x51c5,0x8f));var _0x551c=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x51c5[_0x36884e];return _0x1cc367;};'use strict';var multer=require(_0x551c('0x0'));var util=require(_0x551c('0x1'));var path=require(_0x551c('0x2'));var timeout=require(_0x551c('0x3'));var express=require(_0x551c('0x4'));var router=express[_0x551c('0x5')]();var fs_extra=require(_0x551c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x551c('0x7'));var config=require(_0x551c('0x8'));var controller=require(_0x551c('0x9'));router[_0x551c('0xa')]('/',auth[_0x551c('0xb')](),controller[_0x551c('0xc')]);router[_0x551c('0xa')](_0x551c('0xd'),auth['isAuthenticated'](),controller[_0x551c('0xe')]);router[_0x551c('0xa')](_0x551c('0xf'),auth['isAuthenticated'](),controller[_0x551c('0x10')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x551c('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x28c40a,_0x320636,_0xe61359){_0xe61359(null,path[_0x551c('0x12')](config[_0x551c('0x13')],_0x551c('0x14')));},'filename':function(_0x57aa1b,_0x1fbcfd,_0x42740a){_0x42740a(null,util[_0x551c('0x15')]('%s-%s',Date[_0x551c('0x16')](),_0x1fbcfd[_0x551c('0x17')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x551c('0x18')]('/',upload['single'](_0x551c('0x19')),controller[_0x551c('0x1a')]);router[_0x551c('0x1b')](_0x551c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x551c('0x1c')](_0x551c('0xd'),auth['isAuthenticated'](),controller[_0x551c('0x1d')]);module[_0x551c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 9feb97a..af1e573 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 _0x998b=['google','clientSecret','secret','callbackURL','Setting','findOne','User','find','emails','value','admin','user','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','lodash','passport','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','/login','profile','email','callback','use'];(function(_0x38d25e,_0x36187e){var _0x29f334=function(_0x4d42ad){while(--_0x4d42ad){_0x38d25e['push'](_0x38d25e['shift']());}};_0x29f334(++_0x36187e);}(_0x998b,0x14f));var _0xb998=function(_0x58aca8,_0x25e7a5){_0x58aca8=_0x58aca8-0x0;var _0x52e81e=_0x998b[_0x58aca8];return _0x52e81e;};'use strict';var _=require(_0xb998('0x0'));var passport=require(_0xb998('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0xb998('0x2')];var moment=require(_0xb998('0x3'));var db=require(_0xb998('0x4'))['db'];var config=require(_0xb998('0x5'));var signToken=require(_0xb998('0x6'))[_0xb998('0x7')];var utils=require(_0xb998('0x8'));exports[_0xb998('0x9')]=passport[_0xb998('0xa')]('google',{'failureRedirect':_0xb998('0xb'),'scope':[_0xb998('0xc'),_0xb998('0xd')],'session':![]});exports[_0xb998('0xe')]=passport[_0xb998('0xa')]('google',{'failureRedirect':_0xb998('0xb'),'session':![]});passport[_0xb998('0xf')](new GoogleStrategy({'clientID':config[_0xb998('0x10')]?config[_0xb998('0x10')]['clientID']:'id','clientSecret':config[_0xb998('0x10')]?config[_0xb998('0x10')][_0xb998('0x11')]:_0xb998('0x12'),'callbackURL':config[_0xb998('0x10')]?config[_0xb998('0x10')][_0xb998('0x13')]:''},function(_0x38ae35,_0x4a2c80,_0xc580f,_0x373af5){var _0xa2ebe4,_0x4a664a;return db[_0xb998('0x14')][_0xb998('0x15')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x5dd6a6){_0xa2ebe4=_0x5dd6a6;return db[_0xb998('0x16')][_0xb998('0x17')]({'where':{'email':_['map'](_0xc580f[_0xb998('0x18')],_0xb998('0x19')),'role':{'$or':[_0xb998('0x1a'),_0xb998('0x1b'),_0xb998('0x1c')]}}});})[_0xb998('0x1d')](function(_0x1fd29a){_0x4a664a=_0x1fd29a;if(_0x4a664a){if(_0x4a664a[_0xb998('0x1e')]){return _0x373af5(_0xb998('0x1f'));}else if(_0xa2ebe4[_0xb998('0x20')]>0x0){if(_0x4a664a[_0xb998('0x21')]){if(moment(_0x4a664a[_0xb998('0x22')])[_0xb998('0x23')](_0xa2ebe4['blockDuration'],_0xb998('0x24'))>moment()){return _0x373af5(_0xb998('0x1f'));}else{return utils[_0xb998('0x25')](_0x4a664a,0x0,![],null)[_0xb998('0x1d')](function(){return utils[_0xb998('0x26')](_0x4a664a);})[_0xb998('0x1d')](function(){return _0x373af5(null,_0x4a664a);});}}else{return utils[_0xb998('0x26')](_0x4a664a)[_0xb998('0x1d')](function(){return _0x373af5(null,_0x4a664a);});}}else{return utils['getLicense'](_0x4a664a)['then'](function(){return _0x373af5(null,_0x4a664a);});}}return _0x373af5(_0xb998('0x1f'));})['catch'](function(_0x113b22){_0x373af5(_0x113b22);});})); \ No newline at end of file +var _0x2381=['passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','authenticate','google','/login','profile','callback','use','clientID','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','emails','value','admin','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','lodash','passport'];(function(_0x5d49aa,_0x33ade3){var _0x4fb3f5=function(_0x43c393){while(--_0x43c393){_0x5d49aa['push'](_0x5d49aa['shift']());}};_0x4fb3f5(++_0x33ade3);}(_0x2381,0x14b));var _0x1238=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x2381[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x1238('0x0'));var passport=require(_0x1238('0x1'));var GoogleStrategy=require(_0x1238('0x2'))[_0x1238('0x3')];var moment=require(_0x1238('0x4'));var db=require(_0x1238('0x5'))['db'];var config=require(_0x1238('0x6'));var signToken=require(_0x1238('0x7'))[_0x1238('0x8')];var utils=require(_0x1238('0x9'));exports['login']=passport[_0x1238('0xa')](_0x1238('0xb'),{'failureRedirect':_0x1238('0xc'),'scope':[_0x1238('0xd'),'email'],'session':![]});exports[_0x1238('0xe')]=passport[_0x1238('0xa')]('google',{'failureRedirect':'/login','session':![]});passport[_0x1238('0xf')](new GoogleStrategy({'clientID':config[_0x1238('0xb')]?config[_0x1238('0xb')][_0x1238('0x10')]:'id','clientSecret':config[_0x1238('0xb')]?config[_0x1238('0xb')]['clientSecret']:_0x1238('0x11'),'callbackURL':config[_0x1238('0xb')]?config[_0x1238('0xb')][_0x1238('0x12')]:''},function(_0x3a0107,_0x1d79ab,_0x24062c,_0x13d3b0){var _0x1230e8,_0x2ccdc7;return db[_0x1238('0x13')][_0x1238('0x14')]({'where':{'id':0x1},'attributes':[_0x1238('0x15'),_0x1238('0x16')],'raw':!![]})[_0x1238('0x17')](function(_0x44a008){_0x1230e8=_0x44a008;return db[_0x1238('0x18')][_0x1238('0x19')]({'where':{'email':_['map'](_0x24062c[_0x1238('0x1a')],_0x1238('0x1b')),'role':{'$or':[_0x1238('0x1c'),'user','agent']}}});})['then'](function(_0x23ca26){_0x2ccdc7=_0x23ca26;if(_0x2ccdc7){if(_0x2ccdc7[_0x1238('0x1d')]){return _0x13d3b0(_0x1238('0x1e'));}else if(_0x1230e8['blockDuration']>0x0){if(_0x2ccdc7[_0x1238('0x1f')]){if(moment(_0x2ccdc7[_0x1238('0x20')])[_0x1238('0x21')](_0x1230e8[_0x1238('0x16')],_0x1238('0x22'))>moment()){return _0x13d3b0('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x1238('0x23')](_0x2ccdc7,0x0,![],null)['then'](function(){return utils[_0x1238('0x24')](_0x2ccdc7);})[_0x1238('0x17')](function(){return _0x13d3b0(null,_0x2ccdc7);});}}else{return utils['getLicense'](_0x2ccdc7)[_0x1238('0x17')](function(){return _0x13d3b0(null,_0x2ccdc7);});}}else{return utils[_0x1238('0x24')](_0x2ccdc7)[_0x1238('0x17')](function(){return _0x13d3b0(null,_0x2ccdc7);});}}return _0x13d3b0('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})['catch'](function(_0x4ec252){_0x13d3b0(_0x4ec252);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index f8a4db2..fd2bd98 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 _0x330c=['express','passport','Router','./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','exports'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x330c,0x186));var _0xc330=function(_0x5f5a7d,_0x4d0d53){_0x5f5a7d=_0x5f5a7d-0x0;var _0x43efb8=_0x330c[_0x5f5a7d];return _0x43efb8;};'use strict';var express=require(_0xc330('0x0'));var passport=require(_0xc330('0x1'));var router=express[_0xc330('0x2')]();var controller=require(_0xc330('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xc330('0x4'));router[_0xc330('0x5')]('/',controller[_0xc330('0x6')]);router[_0xc330('0x5')](_0xc330('0x7'),controller[_0xc330('0x8')],authService['isMiddleware'],userController['login'],authService['setTokenCookie']);module[_0xc330('0x9')]=router; \ No newline at end of file +var _0xf0ba=['/callback','isMiddleware','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','get','login'];(function(_0x1b1bca,_0x582efb){var _0x4b2dae=function(_0x5e9976){while(--_0x5e9976){_0x1b1bca['push'](_0x1b1bca['shift']());}};_0x4b2dae(++_0x582efb);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0xaf0b('0x0'));var passport=require(_0xaf0b('0x1'));var router=express[_0xaf0b('0x2')]();var controller=require(_0xaf0b('0x3'));var userController=require(_0xaf0b('0x4'));var authService=require('../../components/auth/service');router[_0xaf0b('0x5')]('/',controller[_0xaf0b('0x6')]);router['get'](_0xaf0b('0x7'),controller['callback'],authService[_0xaf0b('0x8')],userController['login'],authService['setTokenCookie']);module[_0xaf0b('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 abb1a56..4fbc6ba 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 _0x81c6=['name','password','salt','blocked','blockedAt','loginAttempts','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','allowedLoginAttempts','blockDuration','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','service','host','port','secure','auth','pass','format','request','SendMail','error','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','resetPasswordToken','Password\x20reset!','passport','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','then'];(function(_0x3b96fd,_0x2fcff1){var _0x3f97ce=function(_0x388532){while(--_0x388532){_0x3b96fd['push'](_0x3b96fd['shift']());}};_0x3f97ce(++_0x2fcff1);}(_0x81c6,0x1d5));var _0x681c=function(_0x193109,_0x50a9ca){_0x193109=_0x193109-0x0;var _0x4af109=_0x81c6[_0x193109];return _0x4af109;};'use strict';var util=require('util');var passport=require(_0x681c('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require('jayson/promise');var _=require(_0x681c('0x1'));var rs=require(_0x681c('0x2'));var moment=require(_0x681c('0x3'));var db=require('../../mysqldb')['db'];var authService=require(_0x681c('0x4'));var utils=require(_0x681c('0x5'));var client=jayson[_0x681c('0x6')][_0x681c('0x7')]({'port':0x232b});function localAuthenticate(_0x4ea522,_0x45331,_0xdc57a5,_0x5624d7){var _0x5b5f22,_0x1750e2;return db[_0x681c('0x8')][_0x681c('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x681c('0xa')](function(_0x4ff60b){_0x5b5f22=_0x4ff60b;return _0x4ea522[_0x681c('0x9')]({'attributes':['id',_0x681c('0xb'),_0x681c('0xc'),_0x681c('0xd'),'role','disabled',_0x681c('0xe'),_0x681c('0xf'),_0x681c('0x10')],'where':{'name':_0x45331,'role':{'$or':['admin',_0x681c('0x11'),'agent']}}});})[_0x681c('0xa')](function(_0x4c3a91){if(!_0x4c3a91||_0x4c3a91&&_0x4c3a91[_0x681c('0xb')]!==_0x45331){throw new Error(_0x681c('0x12'));}else{_0x1750e2=_0x4c3a91;return _0x1750e2;}})[_0x681c('0xa')](function(){_0x1750e2[_0x681c('0x13')](_0xdc57a5,function(_0x402aa2,_0x2bc3fb){var _0x50a4ec=_0x1750e2[_0x681c('0x10')]+0x1;if(_0x402aa2){return _0x5624d7(_0x402aa2);}else if(!_0x2bc3fb){if(_0x1750e2[_0x681c('0x14')]){return _0x5624d7(null,![],{'message':_0x681c('0x12')});}else if(_0x5b5f22[_0x681c('0x15')]>0x0){if(_0x1750e2[_0x681c('0xe')]){if(_0x5b5f22[_0x681c('0x16')]>0x0){if(moment(_0x1750e2['blockedAt'])[_0x681c('0x17')](_0x5b5f22[_0x681c('0x16')],_0x681c('0x18'))>moment()){return _0x5624d7(null,![],{'message':_0x681c('0x12')});}else{return utils['clearBlockUser'](_0x1750e2,_0x50a4ec,![],null)[_0x681c('0xa')](function(){return _0x5624d7(null,![],{'message':_0x681c('0x12')});});}}else{return _0x5624d7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x50a4ec>=_0x5b5f22[_0x681c('0x15')]){return utils['clearBlockUser'](_0x1750e2,0x0,!![],moment())[_0x681c('0xa')](function(){return _0x5624d7(null,![],{'message':_0x681c('0x12')});});}else{return utils[_0x681c('0x19')](_0x1750e2,_0x50a4ec,![],null)[_0x681c('0xa')](function(){return _0x5624d7(null,![],{'message':_0x681c('0x12')});});}}}else{return _0x5624d7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1750e2['disabled']){return _0x5624d7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5b5f22[_0x681c('0x15')]>0x0){if(_0x1750e2[_0x681c('0xe')]){if(_0x5b5f22[_0x681c('0x16')]>0x0){if(moment(_0x1750e2[_0x681c('0xf')])[_0x681c('0x17')](_0x5b5f22[_0x681c('0x16')],_0x681c('0x18'))>moment()){return _0x5624d7(null,![],{'message':_0x681c('0x12')});}else{return utils[_0x681c('0x19')](_0x1750e2,0x0,![],null)[_0x681c('0xa')](function(){return utils[_0x681c('0x1a')](_0x1750e2);})[_0x681c('0xa')](function(){return _0x5624d7(null,_0x1750e2);});}}else{return _0x5624d7(null,![],{'message':_0x681c('0x12')});}}else{return utils[_0x681c('0x19')](_0x1750e2,0x0,![],null)[_0x681c('0xa')](function(){return utils[_0x681c('0x1a')](_0x1750e2);})['then'](function(){return _0x5624d7(null,_0x1750e2);})[_0x681c('0x1b')](function(_0x5705a7){return _0x5624d7(null,![],_0x5705a7);});}}else{if(_0x1750e2[_0x681c('0xe')]){return _0x5624d7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x1750e2)[_0x681c('0xa')](function(){return _0x5624d7(null,_0x1750e2);});}}}});})[_0x681c('0x1b')](function(_0x17e8f3){return _0x5624d7(null,![],_0x17e8f3);});}function sendServiceMail(_0x2f7772){return db['MailAccount'][_0x681c('0x1c')]({'where':{'service':!![]},'attributes':['id',_0x681c('0xb'),_0x681c('0x1d')],'include':[{'model':db[_0x681c('0x1e')],'as':_0x681c('0x1f')}]})[_0x681c('0xa')](function(_0x2c619f){if(!_0x2c619f){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3727e6={'tls':{'rejectUnauthorized':![]}};if(_0x2c619f[_0x681c('0x1f')][_0x681c('0x20')]){_0x3727e6['service']=_0x2c619f[_0x681c('0x1f')][_0x681c('0x20')];}else{_0x3727e6[_0x681c('0x21')]=_0x2c619f['Smtp'][_0x681c('0x21')];_0x3727e6['port']=_0x2c619f['Smtp'][_0x681c('0x22')];_0x3727e6[_0x681c('0x23')]=_0x2c619f[_0x681c('0x1f')]['secure'];}if(_0x2c619f[_0x681c('0x1f')]['authentication']){_0x3727e6[_0x681c('0x24')]={'user':_0x2c619f['Smtp']['user'],'pass':_0x2c619f['Smtp'][_0x681c('0x25')]};}var _0x210464={'account':_0x3727e6,'message':_['merge']({'from':util[_0x681c('0x26')]('\x22%s\x22\x20<%s>',_0x2c619f['name'],_0x2c619f[_0x681c('0x1d')]||_0x2c619f['Smtp'][_0x681c('0x11')])},_0x2f7772)};return client[_0x681c('0x27')](_0x681c('0x28'),_0x210464);})['then'](function(_0x53adfd){if(_0x53adfd[_0x681c('0x29')]){throw new Error(util[_0x681c('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x53adfd[_0x681c('0x29')][_0x681c('0x2a')]||JSON[_0x681c('0x2b')](_0x53adfd['error'])));}return!![];});}function handleError(_0xd3929e,_0x147729,_0x5ef8a7){return _0xd3929e[_0x681c('0x2c')](_0x147729||0x1f4)[_0x681c('0x2d')]({'message':_0x5ef8a7?_0x5ef8a7[_0x681c('0x2a')]||_0x5ef8a7:''});}exports[_0x681c('0x2e')]=function(_0xb0f28f,_0x5c4d94,_0x5cdd91){passport[_0x681c('0x13')](_0x681c('0x2f'),function(_0x5604dd,_0x3f8618,_0x183f13){var _0x580d5f=_0x5604dd||_0x183f13;if(_0x580d5f){return handleError(_0x5c4d94,0x191,_0x580d5f);}if(!_0x3f8618){return handleError(_0x5c4d94,0x194,{'message':_0x681c('0x30')});}else{var _0x4538c6={'payload':{'id':_0x3f8618['id'],'role':_0x3f8618[_0x681c('0x31')]},'options':{'expiresIn':0x15180}};return authService[_0x681c('0x32')](_0x4538c6)[_0x681c('0xa')](function(_0x42c6bf){_0x5c4d94[_0x681c('0x33')]({'id':_0x3f8618['id'],'token':_0x42c6bf,'statusCall':'','isAlreadyLogged':_0x3f8618[_0x681c('0x34')]});});}})(_0xb0f28f,_0x5c4d94,_0x5cdd91);};exports[_0x681c('0x35')]=function(_0x1ece6f,_0x49fb6e,_0x1d8f5e){if(!_0x1ece6f[_0x681c('0x36')][_0x681c('0x1d')]){return handleError(_0x49fb6e,0x1f4,{'message':_0x681c('0x37')});}var _0x174f86=rs[_0x681c('0x38')]();_0x1ece6f[_0x681c('0x36')][_0x681c('0x1d')]=_0x1ece6f[_0x681c('0x36')][_0x681c('0x1d')][_0x681c('0x39')]()[_0x681c('0x3a')]();var _0x5dd2f4;return db[_0x681c('0x8')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x681c('0x16')],'raw':!![]})[_0x681c('0xa')](function(_0x23be3f){_0x5dd2f4=_0x23be3f;return db[_0x681c('0x3b')]['find']({'where':{'email':_0x1ece6f[_0x681c('0x36')]['email']}});})['then'](function(_0x33614b){if(!_0x33614b){throw new Error(_0x681c('0x3c'));}if(_0x33614b[_0x681c('0x14')]){throw new Error(_0x681c('0x3d'));}if(_0x33614b[_0x681c('0xe')]){if(moment(_0x33614b[_0x681c('0xf')])['add'](_0x5dd2f4[_0x681c('0x16')],_0x681c('0x18'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x33614b['blocked']=![];_0x33614b[_0x681c('0xf')]=null;}}_0x33614b['resetPasswordToken']=_0x174f86;_0x33614b[_0x681c('0x3e')]=Date['now']()+0x36ee80;return _0x33614b['save']();})['then'](function(){return sendServiceMail({'to':_0x1ece6f[_0x681c('0x36')][_0x681c('0x1d')],'subject':_0x681c('0x3f'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x681c('0x40')+_0x681c('0x41')+_0x1ece6f['headers'][_0x681c('0x21')]+_0x681c('0x42')+_0x174f86+'\x0a\x0a'+_0x681c('0x43')});})[_0x681c('0xa')](function(){_0x49fb6e['status'](0xc8)[_0x681c('0x2d')]({'message':'Reset\x20Email\x20sent!'});})[_0x681c('0x1b')](function(_0x29141d){return handleError(_0x49fb6e,0x1f4,_0x29141d);});};exports[_0x681c('0x44')]=function(_0x5731f0,_0x3168de,_0x1b1937){return db[_0x681c('0x3b')][_0x681c('0x1c')]({'where':{'resetPasswordToken':_0x5731f0[_0x681c('0x45')][_0x681c('0x46')],'resetPasswordExpires':{'$gt':Date[_0x681c('0x47')]()}}})[_0x681c('0xa')](function(_0x3c928f){if(!_0x3c928f){throw new Error(_0x681c('0x48'));}return db[_0x681c('0x8')][_0x681c('0x9')]({'attributes':['id',_0x681c('0x49'),_0x681c('0x4a'),_0x681c('0x4b')]})['then'](function(_0xd301be){if(_0xd301be[_0x681c('0x49')])authService['validatePasswordPattern'](_0x5731f0[_0x681c('0x36')]['password']);if(!_0xd301be[_0x681c('0x4a')]||!_0x3c928f[_0x681c('0x4c')])return _0x3c928f;authService[_0x681c('0x4d')](_0x5731f0['body'][_0x681c('0xc')],_0x3c928f[_0x681c('0x4c')],_0xd301be['passwordHistoryLimit']);return _0x3c928f;})[_0x681c('0xa')](function(){_0x3c928f['password']=_0x5731f0[_0x681c('0x36')]['password'];_0x3c928f[_0x681c('0x4e')]=null;_0x3c928f[_0x681c('0x3e')]=null;return _0x3c928f['save']();});})[_0x681c('0xa')](function(){_0x3168de['status'](0xc8)['send']({'message':_0x681c('0x4f')});})[_0x681c('0x1b')](function(_0x283cf2){return handleError(_0x3168de,0x1f4,_0x283cf2);});};passport['use'](new LocalStrategy({'usernameField':_0x681c('0xb'),'passwordField':'password'},function(_0x26363a,_0x520cb5,_0x563b65){return localAuthenticate(db[_0x681c('0x3b')],_0x26363a,_0x520cb5,_0x563b65);})); \ No newline at end of file +var _0x0a6b=['admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','findOne','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordExpires','status','use','util','jayson/promise','randomstring','moment','../../mysqldb','../../config/utils','http','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blocked','blockedAt','loginAttempts'];(function(_0xd908ed,_0x17a7a5){var _0x4bc94c=function(_0x337b40){while(--_0x337b40){_0xd908ed['push'](_0xd908ed['shift']());}};_0x4bc94c(++_0x17a7a5);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x1ad93b,_0x56bee2){_0x1ad93b=_0x1ad93b-0x0;var _0x5c83a3=_0x0a6b[_0x1ad93b];return _0x5c83a3;};'use strict';var util=require(_0xb0a6('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0xb0a6('0x1'));var _=require('lodash');var rs=require(_0xb0a6('0x2'));var moment=require(_0xb0a6('0x3'));var db=require(_0xb0a6('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xb0a6('0x5'));var client=jayson['client'][_0xb0a6('0x6')]({'port':0x232b});function localAuthenticate(_0x415e9e,_0x5e2d2d,_0x11cd5b,_0x24515c){var _0x2a8516,_0x530c05;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xb0a6('0x7'),_0xb0a6('0x8')],'raw':!![]})[_0xb0a6('0x9')](function(_0xda225c){_0x2a8516=_0xda225c;return _0x415e9e['findOne']({'attributes':['id',_0xb0a6('0xa'),_0xb0a6('0xb'),'salt',_0xb0a6('0xc'),_0xb0a6('0xd'),_0xb0a6('0xe'),_0xb0a6('0xf'),_0xb0a6('0x10')],'where':{'name':_0x5e2d2d,'role':{'$or':[_0xb0a6('0x11'),_0xb0a6('0x12'),_0xb0a6('0x13')]}}});})[_0xb0a6('0x9')](function(_0x151387){if(!_0x151387||_0x151387&&_0x151387['name']!==_0x5e2d2d){throw new Error(_0xb0a6('0x14'));}else{_0x530c05=_0x151387;return _0x530c05;}})['then'](function(){_0x530c05[_0xb0a6('0x15')](_0x11cd5b,function(_0x5351ed,_0x25582f){var _0x59730e=_0x530c05[_0xb0a6('0x10')]+0x1;if(_0x5351ed){return _0x24515c(_0x5351ed);}else if(!_0x25582f){if(_0x530c05[_0xb0a6('0xd')]){return _0x24515c(null,![],{'message':_0xb0a6('0x14')});}else if(_0x2a8516['allowedLoginAttempts']>0x0){if(_0x530c05['blocked']){if(_0x2a8516[_0xb0a6('0x8')]>0x0){if(moment(_0x530c05[_0xb0a6('0xf')])[_0xb0a6('0x16')](_0x2a8516[_0xb0a6('0x8')],_0xb0a6('0x17'))>moment()){return _0x24515c(null,![],{'message':_0xb0a6('0x14')});}else{return utils['clearBlockUser'](_0x530c05,_0x59730e,![],null)[_0xb0a6('0x9')](function(){return _0x24515c(null,![],{'message':_0xb0a6('0x14')});});}}else{return _0x24515c(null,![],{'message':_0xb0a6('0x14')});}}else{if(_0x59730e>=_0x2a8516[_0xb0a6('0x7')]){return utils[_0xb0a6('0x18')](_0x530c05,0x0,!![],moment())[_0xb0a6('0x9')](function(){return _0x24515c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xb0a6('0x18')](_0x530c05,_0x59730e,![],null)[_0xb0a6('0x9')](function(){return _0x24515c(null,![],{'message':_0xb0a6('0x14')});});}}}else{return _0x24515c(null,![],{'message':_0xb0a6('0x14')});}}else{if(_0x530c05[_0xb0a6('0xd')]){return _0x24515c(null,![],{'message':_0xb0a6('0x14')});}else if(_0x2a8516[_0xb0a6('0x7')]>0x0){if(_0x530c05[_0xb0a6('0xe')]){if(_0x2a8516['blockDuration']>0x0){if(moment(_0x530c05[_0xb0a6('0xf')])['add'](_0x2a8516[_0xb0a6('0x8')],_0xb0a6('0x17'))>moment()){return _0x24515c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x530c05,0x0,![],null)[_0xb0a6('0x9')](function(){return utils[_0xb0a6('0x19')](_0x530c05);})['then'](function(){return _0x24515c(null,_0x530c05);});}}else{return _0x24515c(null,![],{'message':_0xb0a6('0x14')});}}else{return utils[_0xb0a6('0x18')](_0x530c05,0x0,![],null)[_0xb0a6('0x9')](function(){return utils[_0xb0a6('0x19')](_0x530c05);})['then'](function(){return _0x24515c(null,_0x530c05);})['catch'](function(_0x43adfa){return _0x24515c(null,![],_0x43adfa);});}}else{if(_0x530c05[_0xb0a6('0xe')]){return _0x24515c(null,![],{'message':_0xb0a6('0x14')});}else{return utils['getLicense'](_0x530c05)[_0xb0a6('0x9')](function(){return _0x24515c(null,_0x530c05);});}}}});})[_0xb0a6('0x1a')](function(_0x3edd9a){return _0x24515c(null,![],_0x3edd9a);});}function sendServiceMail(_0xc1c647){return db[_0xb0a6('0x1b')][_0xb0a6('0x1c')]({'where':{'service':!![]},'attributes':['id',_0xb0a6('0xa'),_0xb0a6('0x1d')],'include':[{'model':db[_0xb0a6('0x1e')],'as':'Smtp'}]})[_0xb0a6('0x9')](function(_0x26eb41){if(!_0x26eb41){throw new Error(_0xb0a6('0x1f'));}var _0x5b4c65={'tls':{'rejectUnauthorized':![]}};if(_0x26eb41[_0xb0a6('0x20')]['service']){_0x5b4c65[_0xb0a6('0x21')]=_0x26eb41[_0xb0a6('0x20')][_0xb0a6('0x21')];}else{_0x5b4c65[_0xb0a6('0x22')]=_0x26eb41[_0xb0a6('0x20')][_0xb0a6('0x22')];_0x5b4c65[_0xb0a6('0x23')]=_0x26eb41[_0xb0a6('0x20')][_0xb0a6('0x23')];_0x5b4c65[_0xb0a6('0x24')]=_0x26eb41['Smtp']['secure'];}if(_0x26eb41[_0xb0a6('0x20')][_0xb0a6('0x25')]){_0x5b4c65[_0xb0a6('0x26')]={'user':_0x26eb41[_0xb0a6('0x20')][_0xb0a6('0x12')],'pass':_0x26eb41[_0xb0a6('0x20')][_0xb0a6('0x27')]};}var _0x41704d={'account':_0x5b4c65,'message':_['merge']({'from':util[_0xb0a6('0x28')](_0xb0a6('0x29'),_0x26eb41['name'],_0x26eb41[_0xb0a6('0x1d')]||_0x26eb41[_0xb0a6('0x20')]['user'])},_0xc1c647)};return client['request'](_0xb0a6('0x2a'),_0x41704d);})[_0xb0a6('0x9')](function(_0x472799){if(_0x472799[_0xb0a6('0x2b')]){throw new Error(util[_0xb0a6('0x28')](_0xb0a6('0x2c'),_0x472799['error'][_0xb0a6('0x2d')]||JSON['stringify'](_0x472799[_0xb0a6('0x2b')])));}return!![];});}function handleError(_0x29b609,_0x52e20d,_0x5db672){return _0x29b609['status'](_0x52e20d||0x1f4)[_0xb0a6('0x2e')]({'message':_0x5db672?_0x5db672[_0xb0a6('0x2d')]||_0x5db672:''});}exports[_0xb0a6('0x2f')]=function(_0x236cc4,_0x1d09f7,_0x5acbb0){passport[_0xb0a6('0x15')](_0xb0a6('0x30'),function(_0x2b3fe0,_0x362752,_0x4ab405){var _0x26ac9d=_0x2b3fe0||_0x4ab405;if(_0x26ac9d){return handleError(_0x1d09f7,0x191,_0x26ac9d);}if(!_0x362752){return handleError(_0x1d09f7,0x194,{'message':_0xb0a6('0x31')});}else{var _0x410e50={'payload':{'id':_0x362752['id'],'role':_0x362752[_0xb0a6('0xc')]},'options':{'expiresIn':0x15180}};return authService[_0xb0a6('0x32')](_0x410e50)['then'](function(_0x53cdfa){_0x1d09f7[_0xb0a6('0x33')]({'id':_0x362752['id'],'token':_0x53cdfa,'statusCall':'','isAlreadyLogged':_0x362752[_0xb0a6('0x34')]});});}})(_0x236cc4,_0x1d09f7,_0x5acbb0);};exports[_0xb0a6('0x35')]=function(_0x253488,_0x323ea6,_0x5f4cef){if(!_0x253488[_0xb0a6('0x36')][_0xb0a6('0x1d')]){return handleError(_0x323ea6,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x1fe910=rs[_0xb0a6('0x37')]();_0x253488[_0xb0a6('0x36')][_0xb0a6('0x1d')]=_0x253488[_0xb0a6('0x36')]['email'][_0xb0a6('0x38')]()['toLowerCase']();var _0xaf5ef8;return db['Setting'][_0xb0a6('0x39')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xb0a6('0x8')],'raw':!![]})[_0xb0a6('0x9')](function(_0x2de0d7){_0xaf5ef8=_0x2de0d7;return db[_0xb0a6('0x3a')][_0xb0a6('0x1c')]({'where':{'email':_0x253488[_0xb0a6('0x36')][_0xb0a6('0x1d')]}});})[_0xb0a6('0x9')](function(_0x3016bd){if(!_0x3016bd){throw new Error(_0xb0a6('0x3b'));}if(_0x3016bd[_0xb0a6('0xd')]){throw new Error(_0xb0a6('0x3c'));}if(_0x3016bd['blocked']){if(moment(_0x3016bd[_0xb0a6('0xf')])[_0xb0a6('0x16')](_0xaf5ef8['blockDuration'],_0xb0a6('0x17'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x3016bd[_0xb0a6('0xe')]=![];_0x3016bd[_0xb0a6('0xf')]=null;}}_0x3016bd[_0xb0a6('0x3d')]=_0x1fe910;_0x3016bd['resetPasswordExpires']=Date[_0xb0a6('0x3e')]()+0x36ee80;return _0x3016bd[_0xb0a6('0x3f')]();})[_0xb0a6('0x9')](function(){return sendServiceMail({'to':_0x253488[_0xb0a6('0x36')][_0xb0a6('0x1d')],'subject':_0xb0a6('0x40'),'text':_0xb0a6('0x41')+_0xb0a6('0x42')+'https://'+_0x253488[_0xb0a6('0x43')][_0xb0a6('0x22')]+_0xb0a6('0x44')+_0x1fe910+'\x0a\x0a'+_0xb0a6('0x45')});})['then'](function(){_0x323ea6['status'](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x5dd778){return handleError(_0x323ea6,0x1f4,_0x5dd778);});};exports['reset']=function(_0xafbe9d,_0x34136c,_0x2d0ac5){return db[_0xb0a6('0x3a')][_0xb0a6('0x1c')]({'where':{'resetPasswordToken':_0xafbe9d[_0xb0a6('0x46')][_0xb0a6('0x47')],'resetPasswordExpires':{'$gt':Date[_0xb0a6('0x3e')]()}}})[_0xb0a6('0x9')](function(_0x204543){if(!_0x204543){throw new Error(_0xb0a6('0x48'));}return db[_0xb0a6('0x49')][_0xb0a6('0x39')]({'attributes':['id',_0xb0a6('0x4a'),_0xb0a6('0x4b'),_0xb0a6('0x4c')]})['then'](function(_0x3d6b45){if(_0x3d6b45[_0xb0a6('0x4a')])authService[_0xb0a6('0x4d')](_0xafbe9d[_0xb0a6('0x36')][_0xb0a6('0xb')]);if(!_0x3d6b45[_0xb0a6('0x4b')]||!_0x204543[_0xb0a6('0x4e')])return _0x204543;authService[_0xb0a6('0x4f')](_0xafbe9d[_0xb0a6('0x36')]['password'],_0x204543['previousPasswords'],_0x3d6b45[_0xb0a6('0x4c')]);return _0x204543;})[_0xb0a6('0x9')](function(){_0x204543[_0xb0a6('0xb')]=_0xafbe9d['body'][_0xb0a6('0xb')];_0x204543['resetPasswordToken']=null;_0x204543[_0xb0a6('0x50')]=null;return _0x204543[_0xb0a6('0x3f')]();});})['then'](function(){_0x34136c[_0xb0a6('0x51')](0xc8)[_0xb0a6('0x2e')]({'message':'Password\x20reset!'});})[_0xb0a6('0x1a')](function(_0x49b678){return handleError(_0x34136c,0x1f4,_0x49b678);});};passport[_0xb0a6('0x52')](new LocalStrategy({'usernameField':'name','passwordField':_0xb0a6('0xb')},function(_0x3cc957,_0x5c36bf,_0x329524){return localAuthenticate(db[_0xb0a6('0x3a')],_0x3cc957,_0x5c36bf,_0x329524);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index b1206f6..3cbe347 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 _0xbd95=['post','/forgot','forgot','/reset/:token','reset','exports','express','./authLocal.controller'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xbd95,0x146));var _0x5bd9=function(_0x2f5294,_0x5aa3d6){_0x2f5294=_0x2f5294-0x0;var _0x48e288=_0xbd95[_0x2f5294];return _0x48e288;};'use strict';var express=require(_0x5bd9('0x0'));var router=express['Router']();var controller=require(_0x5bd9('0x1'));router['post']('/',controller['login']);router[_0x5bd9('0x2')](_0x5bd9('0x3'),controller[_0x5bd9('0x4')]);router[_0x5bd9('0x2')](_0x5bd9('0x5'),controller[_0x5bd9('0x6')]);module[_0x5bd9('0x7')]=router; \ No newline at end of file +var _0x22ad=['forgot','exports','express','Router','post','login'];(function(_0x21da34,_0x4b35b7){var _0x2b2f06=function(_0x14b7bf){while(--_0x14b7bf){_0x21da34['push'](_0x21da34['shift']());}};_0x2b2f06(++_0x4b35b7);}(_0x22ad,0x194));var _0xd22a=function(_0x3fbf82,_0x4c67ed){_0x3fbf82=_0x3fbf82-0x0;var _0x44be32=_0x22ad[_0x3fbf82];return _0x44be32;};'use strict';var express=require(_0xd22a('0x0'));var router=express[_0xd22a('0x1')]();var controller=require('./authLocal.controller');router[_0xd22a('0x2')]('/',controller[_0xd22a('0x3')]);router[_0xd22a('0x2')]('/forgot',controller[_0xd22a('0x4')]);router[_0xd22a('0x2')]('/reset/:token',controller['reset']);module[_0xd22a('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index d076059..5781fe1 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 _0x74a3=['BOOLEAN','INTEGER','sequelize','STRING'];(function(_0x38f712,_0x2f1bf7){var _0x4766e1=function(_0x2ba8b8){while(--_0x2ba8b8){_0x38f712['push'](_0x38f712['shift']());}};_0x4766e1(++_0x2f1bf7);}(_0x74a3,0xf2));var _0x374a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x74a3[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x374a('0x0'));module['exports']={'name':{'type':Sequelize[_0x374a('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x374a('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x374a('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x374a('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x0343=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x3d9057,_0x3ca692){var _0x51cd3e=function(_0x1d8e46){while(--_0x1d8e46){_0x3d9057['push'](_0x3d9057['shift']());}};_0x51cd3e(++_0x3ca692);}(_0x0343,0xa4));var _0x3034=function(_0x1e03e4,_0x362f76){_0x1e03e4=_0x1e03e4-0x0;var _0x4a887e=_0x0343[_0x1e03e4];return _0x4a887e;};'use strict';var Sequelize=require('sequelize');module[_0x3034('0x0')]={'name':{'type':Sequelize[_0x3034('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x3034('0x1')]},'description':{'type':Sequelize[_0x3034('0x1')]},'status':{'type':Sequelize[_0x3034('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3034('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 08208bc..3029eaf 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 _0xf940=['order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','keys','options','body','find','params','addConditions','omit','ids','getConditions','findOne','Condition','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','end','error','name','map','Automation','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x2d49c9,_0x4c201e){var _0x54d491=function(_0x51400a){while(--_0x51400a){_0x2d49c9['push'](_0x2d49c9['shift']());}};_0x54d491(++_0x4c201e);}(_0xf940,0x164));var _0x0f94=function(_0x5844c3,_0x13fc8c){_0x5844c3=_0x5844c3-0x0;var _0x3a4d56=_0xf940[_0x5844c3];return _0x3a4d56;};'use strict';var emlformat=require(_0x0f94('0x0'));var rimraf=require(_0x0f94('0x1'));var zipdir=require(_0x0f94('0x2'));var jsonpatch=require(_0x0f94('0x3'));var rp=require(_0x0f94('0x4'));var moment=require(_0x0f94('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0f94('0x6'));var util=require('util');var path=require(_0x0f94('0x7'));var sox=require(_0x0f94('0x8'));var csv=require('to-csv');var ejs=require(_0x0f94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f94('0xa'));var squel=require(_0x0f94('0xb'));var crypto=require(_0x0f94('0xc'));var jsforce=require(_0x0f94('0xd'));var deskjs=require(_0x0f94('0xe'));var toCsv=require(_0x0f94('0xf'));var querystring=require(_0x0f94('0x10'));var Papa=require(_0x0f94('0x11'));var Redis=require(_0x0f94('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f94('0x13'));var hardwareService=require(_0x0f94('0x14'));var logger=require(_0x0f94('0x15'))(_0x0f94('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0f94('0x17'));var db=require(_0x0f94('0x18'))['db'];function respondWithStatusCode(_0xa33db1,_0x44b69d){_0x44b69d=_0x44b69d||0xcc;return function(_0x4d708c){if(_0x4d708c){return _0xa33db1[_0x0f94('0x19')](_0x44b69d);}return _0xa33db1[_0x0f94('0x1a')](_0x44b69d)['end']();};}function respondWithResult(_0x95211e,_0x120e4f){_0x120e4f=_0x120e4f||0xc8;return function(_0x2fb433){if(_0x2fb433){return _0x95211e[_0x0f94('0x1a')](_0x120e4f)[_0x0f94('0x1b')](_0x2fb433);}};}function respondWithFilteredResult(_0x344e72,_0x3fc703){return function(_0x46148b){if(_0x46148b){var _0x1b8c0c=typeof _0x3fc703['offset']===_0x0f94('0x1c')&&typeof _0x3fc703[_0x0f94('0x1d')]===_0x0f94('0x1c');var _0xbed65a=_0x46148b[_0x0f94('0x1e')];var _0x2d7444=_0x1b8c0c?0x0:_0x3fc703[_0x0f94('0x1f')];var _0x56cd81=_0x1b8c0c?_0x46148b[_0x0f94('0x1e')]:_0x3fc703[_0x0f94('0x1f')]+_0x3fc703['limit'];var _0x70f393;if(_0x56cd81>=_0xbed65a){_0x56cd81=_0xbed65a;_0x70f393=0xc8;}else{_0x70f393=0xce;}_0x344e72[_0x0f94('0x1a')](_0x70f393);return _0x344e72['set']('Content-Range',_0x2d7444+'-'+_0x56cd81+'/'+_0xbed65a)['json'](_0x46148b);}return null;};}function patchUpdates(_0x59fa2b){return function(_0x169db5){try{jsonpatch[_0x0f94('0x20')](_0x169db5,_0x59fa2b,!![]);}catch(_0x1fc12e){return BPromise[_0x0f94('0x21')](_0x1fc12e);}return _0x169db5[_0x0f94('0x22')]();};}function saveUpdates(_0x203212,_0x5d65d7){return function(_0x2ac090){if(_0x2ac090){return _0x2ac090[_0x0f94('0x23')](_0x203212)[_0x0f94('0x24')](function(_0x38a008){return _0x38a008;});}return null;};}function removeEntity(_0x5bbd44,_0x48f0fe){return function(_0x246ebf){if(_0x246ebf){return _0x246ebf[_0x0f94('0x25')]()['then'](function(){_0x5bbd44['status'](0xcc)[_0x0f94('0x26')]();});}};}function handleEntityNotFound(_0x2b818e,_0x874c42){return function(_0x25307a){if(!_0x25307a){_0x2b818e[_0x0f94('0x19')](0x194);}return _0x25307a;};}function handleError(_0x12f48d,_0xfb661a){_0xfb661a=_0xfb661a||0x1f4;return function(_0x4c5df3){logger[_0x0f94('0x27')](_0x4c5df3['stack']);if(_0x4c5df3[_0x0f94('0x28')]){delete _0x4c5df3[_0x0f94('0x28')];}_0x12f48d[_0x0f94('0x1a')](_0xfb661a)['send'](_0x4c5df3);};}exports['index']=function(_0x4cd257,_0x27618){var _0x29ad26={},_0x3c58ab={},_0x3cb892={'count':0x0,'rows':[]};var _0x52be28=_[_0x0f94('0x29')](db[_0x0f94('0x2a')][_0x0f94('0x2b')],function(_0x40f987){return{'name':_0x40f987['fieldName'],'type':_0x40f987['type'][_0x0f94('0x2c')]};});_0x3c58ab[_0x0f94('0x2d')]=_[_0x0f94('0x29')](_0x52be28,_0x0f94('0x28'));_0x3c58ab[_0x0f94('0x2e')]=_['keys'](_0x4cd257[_0x0f94('0x2e')]);_0x3c58ab[_0x0f94('0x2f')]=_['intersection'](_0x3c58ab[_0x0f94('0x2d')],_0x3c58ab['query']);_0x29ad26[_0x0f94('0x30')]=_[_0x0f94('0x31')](_0x3c58ab[_0x0f94('0x2d')],qs[_0x0f94('0x32')](_0x4cd257[_0x0f94('0x2e')][_0x0f94('0x32')]));_0x29ad26[_0x0f94('0x30')]=_0x29ad26[_0x0f94('0x30')][_0x0f94('0x33')]?_0x29ad26[_0x0f94('0x30')]:_0x3c58ab[_0x0f94('0x2d')];if(!_0x4cd257[_0x0f94('0x2e')][_0x0f94('0x34')](_0x0f94('0x35'))){_0x29ad26['limit']=qs[_0x0f94('0x1d')](_0x4cd257[_0x0f94('0x2e')][_0x0f94('0x1d')]);_0x29ad26['offset']=qs[_0x0f94('0x1f')](_0x4cd257[_0x0f94('0x2e')][_0x0f94('0x1f')]);}_0x29ad26[_0x0f94('0x36')]=qs[_0x0f94('0x37')](_0x4cd257[_0x0f94('0x2e')][_0x0f94('0x37')]);_0x29ad26[_0x0f94('0x38')]=qs[_0x0f94('0x2f')](_[_0x0f94('0x39')](_0x4cd257[_0x0f94('0x2e')],_0x3c58ab['filters']),_0x52be28);if(_0x4cd257[_0x0f94('0x2e')]['filter']){_0x29ad26['where']=_[_0x0f94('0x3a')](_0x29ad26[_0x0f94('0x38')],{'$or':_['map'](_0x52be28,function(_0x28d728){if(_0x28d728[_0x0f94('0x3b')]!==_0x0f94('0x3c')){var _0x4013ca={};_0x4013ca[_0x28d728[_0x0f94('0x28')]]={'$like':'%'+_0x4cd257[_0x0f94('0x2e')][_0x0f94('0x3d')]+'%'};return _0x4013ca;}})});}_0x29ad26=_[_0x0f94('0x3a')]({},_0x29ad26,_0x4cd257['options']);var _0x38175b={'where':_0x29ad26[_0x0f94('0x38')]};return db[_0x0f94('0x2a')]['count'](_0x38175b)['then'](function(_0x7a6e67){_0x3cb892[_0x0f94('0x1e')]=_0x7a6e67;if(_0x4cd257[_0x0f94('0x2e')][_0x0f94('0x3e')]){_0x29ad26[_0x0f94('0x3f')]=[{'all':!![]}];}return db['Automation'][_0x0f94('0x40')](_0x29ad26);})['then'](function(_0x4f4634){_0x3cb892[_0x0f94('0x41')]=_0x4f4634;return _0x3cb892;})[_0x0f94('0x24')](respondWithFilteredResult(_0x27618,_0x29ad26))[_0x0f94('0x42')](handleError(_0x27618,null));};exports[_0x0f94('0x43')]=function(_0x54a4fa,_0x308074){var _0x10075a={'raw':![],'where':{'id':_0x54a4fa['params']['id']}},_0x3ea493={};_0x3ea493[_0x0f94('0x2d')]=_[_0x0f94('0x44')](db[_0x0f94('0x2a')][_0x0f94('0x2b')]);_0x3ea493['query']=_[_0x0f94('0x44')](_0x54a4fa[_0x0f94('0x2e')]);_0x3ea493['filters']=_[_0x0f94('0x31')](_0x3ea493[_0x0f94('0x2d')],_0x3ea493['query']);_0x10075a[_0x0f94('0x30')]=_[_0x0f94('0x31')](_0x3ea493[_0x0f94('0x2d')],qs[_0x0f94('0x32')](_0x54a4fa[_0x0f94('0x2e')][_0x0f94('0x32')]));_0x10075a[_0x0f94('0x30')]=_0x10075a['attributes'][_0x0f94('0x33')]?_0x10075a['attributes']:_0x3ea493[_0x0f94('0x2d')];if(_0x54a4fa[_0x0f94('0x2e')][_0x0f94('0x3e')]){_0x10075a[_0x0f94('0x3f')]=[{'all':!![]}];}_0x10075a=_['merge']({},_0x10075a,_0x54a4fa[_0x0f94('0x45')]);return db[_0x0f94('0x2a')]['find'](_0x10075a)['then'](handleEntityNotFound(_0x308074,null))[_0x0f94('0x24')](respondWithResult(_0x308074,null))['catch'](handleError(_0x308074,null));};exports['create']=function(_0x2f311c,_0x1f2416){return db[_0x0f94('0x2a')]['create'](_0x2f311c[_0x0f94('0x46')],{})[_0x0f94('0x24')](respondWithResult(_0x1f2416,0xc9))[_0x0f94('0x42')](handleError(_0x1f2416,null));};exports['update']=function(_0x4f1fcb,_0x176b0f){if(_0x4f1fcb[_0x0f94('0x46')]['id']){delete _0x4f1fcb['body']['id'];}return db[_0x0f94('0x2a')][_0x0f94('0x47')]({'where':{'id':_0x4f1fcb['params']['id']}})[_0x0f94('0x24')](handleEntityNotFound(_0x176b0f,null))[_0x0f94('0x24')](saveUpdates(_0x4f1fcb[_0x0f94('0x46')],null))[_0x0f94('0x24')](respondWithResult(_0x176b0f,null))[_0x0f94('0x42')](handleError(_0x176b0f,null));};exports[_0x0f94('0x25')]=function(_0x3ca33e,_0xda276c){return db[_0x0f94('0x2a')][_0x0f94('0x47')]({'where':{'id':_0x3ca33e[_0x0f94('0x48')]['id']}})['then'](handleEntityNotFound(_0xda276c,null))['then'](removeEntity(_0xda276c,null))[_0x0f94('0x42')](handleError(_0xda276c,null));};exports[_0x0f94('0x49')]=function(_0xdb4892,_0x153945,_0x55c949){return db['Condition'][_0x0f94('0x47')]({'where':{'id':_0xdb4892['params']['id']}})[_0x0f94('0x24')](handleEntityNotFound(_0x153945,null))['then'](function(_0x2c26e4){if(_0x2c26e4){return _0x2c26e4[_0x0f94('0x49')](_0xdb4892[_0x0f94('0x46')]['ids'],_[_0x0f94('0x4a')](_0xdb4892['body'],[_0x0f94('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x153945,null))[_0x0f94('0x42')](handleError(_0x153945,null));};exports[_0x0f94('0x4c')]=function(_0x3dbc3e,_0x3c29aa,_0x1b8537){var _0x3b7ea6={};var _0x4a888d={};var _0x39e346;var _0x2a278d;return db['Automation'][_0x0f94('0x4d')]({'where':{'id':_0x3dbc3e['params']['id']}})[_0x0f94('0x24')](handleEntityNotFound(_0x3c29aa,null))[_0x0f94('0x24')](function(_0x143cd7){if(_0x143cd7){_0x39e346=_0x143cd7;_0x4a888d[_0x0f94('0x2d')]=_['keys'](db[_0x0f94('0x4e')][_0x0f94('0x2b')]);_0x4a888d[_0x0f94('0x2e')]=_[_0x0f94('0x44')](_0x3dbc3e[_0x0f94('0x2e')]);_0x4a888d['filters']=_[_0x0f94('0x31')](_0x4a888d[_0x0f94('0x2d')],_0x4a888d['query']);_0x3b7ea6[_0x0f94('0x30')]=_[_0x0f94('0x31')](_0x4a888d[_0x0f94('0x2d')],qs[_0x0f94('0x32')](_0x3dbc3e[_0x0f94('0x2e')]['fields']));_0x3b7ea6['attributes']=_0x3b7ea6['attributes'][_0x0f94('0x33')]?_0x3b7ea6['attributes']:_0x4a888d[_0x0f94('0x2d')];_0x3b7ea6[_0x0f94('0x36')]=qs[_0x0f94('0x37')](_0x3dbc3e['query'][_0x0f94('0x37')]);_0x3b7ea6[_0x0f94('0x38')]=qs['filters'](_['pick'](_0x3dbc3e[_0x0f94('0x2e')],_0x4a888d[_0x0f94('0x2f')]));if(_0x3dbc3e['query'][_0x0f94('0x3d')]){_0x3b7ea6[_0x0f94('0x38')]=_[_0x0f94('0x3a')](_0x3b7ea6[_0x0f94('0x38')],{'$or':_[_0x0f94('0x29')](_0x3b7ea6[_0x0f94('0x30')],function(_0x4a762b){var _0xdf8345={};_0xdf8345[_0x4a762b]={'$like':'%'+_0x3dbc3e[_0x0f94('0x2e')][_0x0f94('0x3d')]+'%'};return _0xdf8345;})});}_0x3b7ea6=_[_0x0f94('0x3a')]({},_0x3b7ea6,_0x3dbc3e[_0x0f94('0x45')]);return _0x39e346[_0x0f94('0x4c')](_0x3b7ea6);}})[_0x0f94('0x24')](function(_0x141a8f){if(_0x141a8f){_0x2a278d=_0x141a8f['length'];if(!_0x3dbc3e[_0x0f94('0x2e')]['hasOwnProperty'](_0x0f94('0x35'))){_0x3b7ea6[_0x0f94('0x1d')]=qs[_0x0f94('0x1d')](_0x3dbc3e['query'][_0x0f94('0x1d')]);_0x3b7ea6['offset']=qs[_0x0f94('0x1f')](_0x3dbc3e['query'][_0x0f94('0x1f')]);}return _0x39e346[_0x0f94('0x4c')](_0x3b7ea6);}})[_0x0f94('0x24')](function(_0x2cc75c){if(_0x2cc75c){return _0x2cc75c?{'count':_0x2a278d,'rows':_0x2cc75c}:null;}})[_0x0f94('0x24')](respondWithResult(_0x3c29aa,null))[_0x0f94('0x42')](handleError(_0x3c29aa,null));};exports[_0x0f94('0x4f')]=function(_0x146299,_0x1ff135,_0x24cb7e){return db[_0x0f94('0x50')][_0x0f94('0x47')]({'where':{'id':_0x146299[_0x0f94('0x48')]['id']}})[_0x0f94('0x24')](handleEntityNotFound(_0x1ff135,null))[_0x0f94('0x24')](function(_0x1c8553){if(_0x1c8553){return _0x1c8553['addActions'](_0x146299[_0x0f94('0x46')]['ids'],_['omit'](_0x146299[_0x0f94('0x46')],['ids','id'])||{});}})[_0x0f94('0x24')](respondWithResult(_0x1ff135,null))['catch'](handleError(_0x1ff135,null));};exports[_0x0f94('0x51')]=function(_0x1a8364,_0x5df69a,_0x14a2dd){var _0x5f54e6={};var _0x328661={};var _0x313bf6;var _0x5959a1;return db[_0x0f94('0x2a')][_0x0f94('0x4d')]({'where':{'id':_0x1a8364[_0x0f94('0x48')]['id']}})['then'](handleEntityNotFound(_0x5df69a,null))['then'](function(_0x28ca7a){if(_0x28ca7a){_0x313bf6=_0x28ca7a;_0x328661[_0x0f94('0x2d')]=_[_0x0f94('0x44')](db['Action'][_0x0f94('0x2b')]);_0x328661[_0x0f94('0x2e')]=_['keys'](_0x1a8364[_0x0f94('0x2e')]);_0x328661[_0x0f94('0x2f')]=_[_0x0f94('0x31')](_0x328661[_0x0f94('0x2d')],_0x328661['query']);_0x5f54e6[_0x0f94('0x30')]=_['intersection'](_0x328661[_0x0f94('0x2d')],qs[_0x0f94('0x32')](_0x1a8364[_0x0f94('0x2e')][_0x0f94('0x32')]));_0x5f54e6[_0x0f94('0x30')]=_0x5f54e6[_0x0f94('0x30')][_0x0f94('0x33')]?_0x5f54e6['attributes']:_0x328661[_0x0f94('0x2d')];_0x5f54e6[_0x0f94('0x36')]=qs['sort'](_0x1a8364[_0x0f94('0x2e')][_0x0f94('0x37')]);_0x5f54e6[_0x0f94('0x38')]=qs['filters'](_[_0x0f94('0x39')](_0x1a8364[_0x0f94('0x2e')],_0x328661['filters']));if(_0x1a8364[_0x0f94('0x2e')][_0x0f94('0x3d')]){_0x5f54e6[_0x0f94('0x38')]=_[_0x0f94('0x3a')](_0x5f54e6[_0x0f94('0x38')],{'$or':_[_0x0f94('0x29')](_0x5f54e6[_0x0f94('0x30')],function(_0x53c638){var _0x152821={};_0x152821[_0x53c638]={'$like':'%'+_0x1a8364[_0x0f94('0x2e')][_0x0f94('0x3d')]+'%'};return _0x152821;})});}_0x5f54e6=_[_0x0f94('0x3a')]({},_0x5f54e6,_0x1a8364[_0x0f94('0x45')]);return _0x313bf6[_0x0f94('0x51')](_0x5f54e6);}})[_0x0f94('0x24')](function(_0x25d0ff){if(_0x25d0ff){_0x5959a1=_0x25d0ff['length'];if(!_0x1a8364[_0x0f94('0x2e')]['hasOwnProperty']('nolimit')){_0x5f54e6[_0x0f94('0x1d')]=qs['limit'](_0x1a8364[_0x0f94('0x2e')][_0x0f94('0x1d')]);_0x5f54e6[_0x0f94('0x1f')]=qs[_0x0f94('0x1f')](_0x1a8364[_0x0f94('0x2e')]['offset']);}return _0x313bf6[_0x0f94('0x51')](_0x5f54e6);}})['then'](function(_0x27310b){if(_0x27310b){return _0x27310b?{'count':_0x5959a1,'rows':_0x27310b}:null;}})[_0x0f94('0x24')](respondWithResult(_0x5df69a,null))[_0x0f94('0x42')](handleError(_0x5df69a,null));}; \ No newline at end of file +var _0x4de3=['bluebird','mustache','util','path','ejs','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','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','map','type','VIRTUAL','merge','options','Automation','includeAll','include','findAll','rows','catch','show','params','find','create','body','Condition','addConditions','ids','omit','getConditions','findOne','Action','addActions','pick','getActions','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4de3,0x10a));var _0x34de=function(_0x3c9f54,_0x77db6){_0x3c9f54=_0x3c9f54-0x0;var _0xcfefbe=_0x4de3[_0x3c9f54];return _0xcfefbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x34de('0x0'));var zipdir=require(_0x34de('0x1'));var jsonpatch=require(_0x34de('0x2'));var rp=require('request-promise');var moment=require(_0x34de('0x3'));var BPromise=require(_0x34de('0x4'));var Mustache=require(_0x34de('0x5'));var util=require(_0x34de('0x6'));var path=require(_0x34de('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x34de('0x8'));var fs=require('fs');var fs_extra=require(_0x34de('0x9'));var _=require(_0x34de('0xa'));var squel=require('squel');var crypto=require(_0x34de('0xb'));var jsforce=require(_0x34de('0xc'));var deskjs=require(_0x34de('0xd'));var toCsv=require(_0x34de('0xe'));var querystring=require(_0x34de('0xf'));var Papa=require('papaparse');var Redis=require(_0x34de('0x10'));var authService=require(_0x34de('0x11'));var qs=require(_0x34de('0x12'));var as=require(_0x34de('0x13'));var hardwareService=require(_0x34de('0x14'));var logger=require(_0x34de('0x15'))(_0x34de('0x16'));var utils=require(_0x34de('0x17'));var config=require(_0x34de('0x18'));var licenseUtil=require(_0x34de('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1731c6,_0x434cc8){_0x434cc8=_0x434cc8||0xcc;return function(_0x5eb32c){if(_0x5eb32c){return _0x1731c6['sendStatus'](_0x434cc8);}return _0x1731c6[_0x34de('0x1a')](_0x434cc8)[_0x34de('0x1b')]();};}function respondWithResult(_0x27a911,_0x17e847){_0x17e847=_0x17e847||0xc8;return function(_0x2b3243){if(_0x2b3243){return _0x27a911[_0x34de('0x1a')](_0x17e847)[_0x34de('0x1c')](_0x2b3243);}};}function respondWithFilteredResult(_0x39c6a8,_0x2cd5e){return function(_0xf748a5){if(_0xf748a5){var _0x1f00ce=typeof _0x2cd5e[_0x34de('0x1d')]===_0x34de('0x1e')&&typeof _0x2cd5e[_0x34de('0x1f')]==='undefined';var _0x2a6d78=_0xf748a5[_0x34de('0x20')];var _0x3195a6=_0x1f00ce?0x0:_0x2cd5e['offset'];var _0x516808=_0x1f00ce?_0xf748a5[_0x34de('0x20')]:_0x2cd5e[_0x34de('0x1d')]+_0x2cd5e[_0x34de('0x1f')];var _0x2f7d48;if(_0x516808>=_0x2a6d78){_0x516808=_0x2a6d78;_0x2f7d48=0xc8;}else{_0x2f7d48=0xce;}_0x39c6a8['status'](_0x2f7d48);return _0x39c6a8[_0x34de('0x21')](_0x34de('0x22'),_0x3195a6+'-'+_0x516808+'/'+_0x2a6d78)[_0x34de('0x1c')](_0xf748a5);}return null;};}function patchUpdates(_0x1c2655){return function(_0x54bca9){try{jsonpatch[_0x34de('0x23')](_0x54bca9,_0x1c2655,!![]);}catch(_0x39d3b6){return BPromise[_0x34de('0x24')](_0x39d3b6);}return _0x54bca9[_0x34de('0x25')]();};}function saveUpdates(_0x3a416e,_0x240ee9){return function(_0x29c05a){if(_0x29c05a){return _0x29c05a[_0x34de('0x26')](_0x3a416e)[_0x34de('0x27')](function(_0x5041e0){return _0x5041e0;});}return null;};}function removeEntity(_0x2ceea4,_0x134228){return function(_0x50f8e6){if(_0x50f8e6){return _0x50f8e6[_0x34de('0x28')]()[_0x34de('0x27')](function(){_0x2ceea4['status'](0xcc)[_0x34de('0x1b')]();});}};}function handleEntityNotFound(_0x16addc,_0x2926e4){return function(_0x41ad52){if(!_0x41ad52){_0x16addc[_0x34de('0x29')](0x194);}return _0x41ad52;};}function handleError(_0x5600db,_0x564788){_0x564788=_0x564788||0x1f4;return function(_0xd8ec55){logger[_0x34de('0x2a')](_0xd8ec55[_0x34de('0x2b')]);if(_0xd8ec55[_0x34de('0x2c')]){delete _0xd8ec55[_0x34de('0x2c')];}_0x5600db['status'](_0x564788)[_0x34de('0x2d')](_0xd8ec55);};}exports[_0x34de('0x2e')]=function(_0x2d72d3,_0x3ed0f0){var _0x33588f={},_0x496b91={},_0xff4371={'count':0x0,'rows':[]};var _0x5a7b2b=_['map'](db['Automation'][_0x34de('0x2f')],function(_0x391916){return{'name':_0x391916[_0x34de('0x30')],'type':_0x391916['type'][_0x34de('0x31')]};});_0x496b91[_0x34de('0x32')]=_['map'](_0x5a7b2b,_0x34de('0x2c'));_0x496b91[_0x34de('0x33')]=_[_0x34de('0x34')](_0x2d72d3[_0x34de('0x33')]);_0x496b91[_0x34de('0x35')]=_[_0x34de('0x36')](_0x496b91[_0x34de('0x32')],_0x496b91[_0x34de('0x33')]);_0x33588f['attributes']=_[_0x34de('0x36')](_0x496b91['model'],qs[_0x34de('0x37')](_0x2d72d3[_0x34de('0x33')]['fields']));_0x33588f[_0x34de('0x38')]=_0x33588f[_0x34de('0x38')][_0x34de('0x39')]?_0x33588f['attributes']:_0x496b91[_0x34de('0x32')];if(!_0x2d72d3[_0x34de('0x33')][_0x34de('0x3a')](_0x34de('0x3b'))){_0x33588f[_0x34de('0x1f')]=qs[_0x34de('0x1f')](_0x2d72d3[_0x34de('0x33')]['limit']);_0x33588f[_0x34de('0x1d')]=qs['offset'](_0x2d72d3['query'][_0x34de('0x1d')]);}_0x33588f[_0x34de('0x3c')]=qs[_0x34de('0x3d')](_0x2d72d3[_0x34de('0x33')]['sort']);_0x33588f['where']=qs[_0x34de('0x35')](_['pick'](_0x2d72d3[_0x34de('0x33')],_0x496b91[_0x34de('0x35')]),_0x5a7b2b);if(_0x2d72d3['query'][_0x34de('0x3e')]){_0x33588f[_0x34de('0x3f')]=_['merge'](_0x33588f[_0x34de('0x3f')],{'$or':_[_0x34de('0x40')](_0x5a7b2b,function(_0x543158){if(_0x543158[_0x34de('0x41')]!==_0x34de('0x42')){var _0x409745={};_0x409745[_0x543158[_0x34de('0x2c')]]={'$like':'%'+_0x2d72d3[_0x34de('0x33')]['filter']+'%'};return _0x409745;}})});}_0x33588f=_[_0x34de('0x43')]({},_0x33588f,_0x2d72d3[_0x34de('0x44')]);var _0xb4b514={'where':_0x33588f[_0x34de('0x3f')]};return db[_0x34de('0x45')][_0x34de('0x20')](_0xb4b514)[_0x34de('0x27')](function(_0x5095e4){_0xff4371['count']=_0x5095e4;if(_0x2d72d3[_0x34de('0x33')][_0x34de('0x46')]){_0x33588f[_0x34de('0x47')]=[{'all':!![]}];}return db[_0x34de('0x45')][_0x34de('0x48')](_0x33588f);})[_0x34de('0x27')](function(_0x4d4836){_0xff4371[_0x34de('0x49')]=_0x4d4836;return _0xff4371;})[_0x34de('0x27')](respondWithFilteredResult(_0x3ed0f0,_0x33588f))[_0x34de('0x4a')](handleError(_0x3ed0f0,null));};exports[_0x34de('0x4b')]=function(_0x570e92,_0x1457d7){var _0x49e50c={'raw':![],'where':{'id':_0x570e92[_0x34de('0x4c')]['id']}},_0x5557f0={};_0x5557f0['model']=_['keys'](db[_0x34de('0x45')][_0x34de('0x2f')]);_0x5557f0[_0x34de('0x33')]=_[_0x34de('0x34')](_0x570e92[_0x34de('0x33')]);_0x5557f0[_0x34de('0x35')]=_[_0x34de('0x36')](_0x5557f0[_0x34de('0x32')],_0x5557f0['query']);_0x49e50c[_0x34de('0x38')]=_['intersection'](_0x5557f0[_0x34de('0x32')],qs[_0x34de('0x37')](_0x570e92[_0x34de('0x33')][_0x34de('0x37')]));_0x49e50c[_0x34de('0x38')]=_0x49e50c[_0x34de('0x38')][_0x34de('0x39')]?_0x49e50c[_0x34de('0x38')]:_0x5557f0[_0x34de('0x32')];if(_0x570e92[_0x34de('0x33')][_0x34de('0x46')]){_0x49e50c[_0x34de('0x47')]=[{'all':!![]}];}_0x49e50c=_[_0x34de('0x43')]({},_0x49e50c,_0x570e92[_0x34de('0x44')]);return db[_0x34de('0x45')][_0x34de('0x4d')](_0x49e50c)['then'](handleEntityNotFound(_0x1457d7,null))['then'](respondWithResult(_0x1457d7,null))[_0x34de('0x4a')](handleError(_0x1457d7,null));};exports['create']=function(_0x2a0e00,_0x56fb07){return db['Automation'][_0x34de('0x4e')](_0x2a0e00[_0x34de('0x4f')],{})['then'](respondWithResult(_0x56fb07,0xc9))[_0x34de('0x4a')](handleError(_0x56fb07,null));};exports[_0x34de('0x26')]=function(_0xa3da3e,_0x2dabe3){if(_0xa3da3e[_0x34de('0x4f')]['id']){delete _0xa3da3e[_0x34de('0x4f')]['id'];}return db['Automation'][_0x34de('0x4d')]({'where':{'id':_0xa3da3e[_0x34de('0x4c')]['id']}})[_0x34de('0x27')](handleEntityNotFound(_0x2dabe3,null))[_0x34de('0x27')](saveUpdates(_0xa3da3e['body'],null))[_0x34de('0x27')](respondWithResult(_0x2dabe3,null))[_0x34de('0x4a')](handleError(_0x2dabe3,null));};exports[_0x34de('0x28')]=function(_0x470d99,_0x3c25e4){return db['Automation'][_0x34de('0x4d')]({'where':{'id':_0x470d99[_0x34de('0x4c')]['id']}})[_0x34de('0x27')](handleEntityNotFound(_0x3c25e4,null))[_0x34de('0x27')](removeEntity(_0x3c25e4,null))[_0x34de('0x4a')](handleError(_0x3c25e4,null));};exports['addConditions']=function(_0x10bec7,_0x25b14d,_0x2f3adf){return db[_0x34de('0x50')][_0x34de('0x4d')]({'where':{'id':_0x10bec7[_0x34de('0x4c')]['id']}})[_0x34de('0x27')](handleEntityNotFound(_0x25b14d,null))[_0x34de('0x27')](function(_0x50bddf){if(_0x50bddf){return _0x50bddf[_0x34de('0x51')](_0x10bec7[_0x34de('0x4f')][_0x34de('0x52')],_[_0x34de('0x53')](_0x10bec7[_0x34de('0x4f')],['ids','id'])||{});}})[_0x34de('0x27')](respondWithResult(_0x25b14d,null))[_0x34de('0x4a')](handleError(_0x25b14d,null));};exports[_0x34de('0x54')]=function(_0x1298e3,_0x2dc08f,_0x1c39a7){var _0x48b48a={};var _0xaf2aa9={};var _0x4ea1d0;var _0x4cf187;return db['Automation'][_0x34de('0x55')]({'where':{'id':_0x1298e3[_0x34de('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2dc08f,null))[_0x34de('0x27')](function(_0x44c531){if(_0x44c531){_0x4ea1d0=_0x44c531;_0xaf2aa9[_0x34de('0x32')]=_['keys'](db[_0x34de('0x50')]['rawAttributes']);_0xaf2aa9[_0x34de('0x33')]=_[_0x34de('0x34')](_0x1298e3[_0x34de('0x33')]);_0xaf2aa9['filters']=_[_0x34de('0x36')](_0xaf2aa9[_0x34de('0x32')],_0xaf2aa9[_0x34de('0x33')]);_0x48b48a[_0x34de('0x38')]=_[_0x34de('0x36')](_0xaf2aa9[_0x34de('0x32')],qs['fields'](_0x1298e3[_0x34de('0x33')][_0x34de('0x37')]));_0x48b48a[_0x34de('0x38')]=_0x48b48a[_0x34de('0x38')][_0x34de('0x39')]?_0x48b48a[_0x34de('0x38')]:_0xaf2aa9['model'];_0x48b48a[_0x34de('0x3c')]=qs[_0x34de('0x3d')](_0x1298e3[_0x34de('0x33')]['sort']);_0x48b48a[_0x34de('0x3f')]=qs['filters'](_['pick'](_0x1298e3['query'],_0xaf2aa9[_0x34de('0x35')]));if(_0x1298e3[_0x34de('0x33')][_0x34de('0x3e')]){_0x48b48a[_0x34de('0x3f')]=_[_0x34de('0x43')](_0x48b48a[_0x34de('0x3f')],{'$or':_[_0x34de('0x40')](_0x48b48a[_0x34de('0x38')],function(_0x3dbd86){var _0x4100ef={};_0x4100ef[_0x3dbd86]={'$like':'%'+_0x1298e3[_0x34de('0x33')]['filter']+'%'};return _0x4100ef;})});}_0x48b48a=_[_0x34de('0x43')]({},_0x48b48a,_0x1298e3[_0x34de('0x44')]);return _0x4ea1d0[_0x34de('0x54')](_0x48b48a);}})[_0x34de('0x27')](function(_0x11c83b){if(_0x11c83b){_0x4cf187=_0x11c83b[_0x34de('0x39')];if(!_0x1298e3['query'][_0x34de('0x3a')]('nolimit')){_0x48b48a[_0x34de('0x1f')]=qs[_0x34de('0x1f')](_0x1298e3['query']['limit']);_0x48b48a['offset']=qs['offset'](_0x1298e3[_0x34de('0x33')][_0x34de('0x1d')]);}return _0x4ea1d0[_0x34de('0x54')](_0x48b48a);}})[_0x34de('0x27')](function(_0xe4d91f){if(_0xe4d91f){return _0xe4d91f?{'count':_0x4cf187,'rows':_0xe4d91f}:null;}})[_0x34de('0x27')](respondWithResult(_0x2dc08f,null))[_0x34de('0x4a')](handleError(_0x2dc08f,null));};exports['addActions']=function(_0x28f92e,_0x1fc712,_0xf9564e){return db[_0x34de('0x56')][_0x34de('0x4d')]({'where':{'id':_0x28f92e[_0x34de('0x4c')]['id']}})[_0x34de('0x27')](handleEntityNotFound(_0x1fc712,null))[_0x34de('0x27')](function(_0x4b106b){if(_0x4b106b){return _0x4b106b[_0x34de('0x57')](_0x28f92e['body']['ids'],_[_0x34de('0x53')](_0x28f92e[_0x34de('0x4f')],[_0x34de('0x52'),'id'])||{});}})[_0x34de('0x27')](respondWithResult(_0x1fc712,null))[_0x34de('0x4a')](handleError(_0x1fc712,null));};exports['getActions']=function(_0x226401,_0x55ddfb,_0x364454){var _0x415f9e={};var _0x5d9003={};var _0x16b27a;var _0x434966;return db['Automation'][_0x34de('0x55')]({'where':{'id':_0x226401['params']['id']}})['then'](handleEntityNotFound(_0x55ddfb,null))['then'](function(_0x5e7f0f){if(_0x5e7f0f){_0x16b27a=_0x5e7f0f;_0x5d9003[_0x34de('0x32')]=_[_0x34de('0x34')](db[_0x34de('0x56')][_0x34de('0x2f')]);_0x5d9003[_0x34de('0x33')]=_[_0x34de('0x34')](_0x226401[_0x34de('0x33')]);_0x5d9003[_0x34de('0x35')]=_[_0x34de('0x36')](_0x5d9003['model'],_0x5d9003[_0x34de('0x33')]);_0x415f9e['attributes']=_['intersection'](_0x5d9003[_0x34de('0x32')],qs[_0x34de('0x37')](_0x226401[_0x34de('0x33')]['fields']));_0x415f9e[_0x34de('0x38')]=_0x415f9e[_0x34de('0x38')][_0x34de('0x39')]?_0x415f9e[_0x34de('0x38')]:_0x5d9003[_0x34de('0x32')];_0x415f9e['order']=qs[_0x34de('0x3d')](_0x226401[_0x34de('0x33')][_0x34de('0x3d')]);_0x415f9e[_0x34de('0x3f')]=qs['filters'](_[_0x34de('0x58')](_0x226401[_0x34de('0x33')],_0x5d9003[_0x34de('0x35')]));if(_0x226401[_0x34de('0x33')][_0x34de('0x3e')]){_0x415f9e[_0x34de('0x3f')]=_[_0x34de('0x43')](_0x415f9e[_0x34de('0x3f')],{'$or':_[_0x34de('0x40')](_0x415f9e[_0x34de('0x38')],function(_0x10e5ba){var _0x15570b={};_0x15570b[_0x10e5ba]={'$like':'%'+_0x226401[_0x34de('0x33')][_0x34de('0x3e')]+'%'};return _0x15570b;})});}_0x415f9e=_['merge']({},_0x415f9e,_0x226401[_0x34de('0x44')]);return _0x16b27a[_0x34de('0x59')](_0x415f9e);}})[_0x34de('0x27')](function(_0xae0219){if(_0xae0219){_0x434966=_0xae0219[_0x34de('0x39')];if(!_0x226401[_0x34de('0x33')][_0x34de('0x3a')](_0x34de('0x3b'))){_0x415f9e[_0x34de('0x1f')]=qs[_0x34de('0x1f')](_0x226401['query'][_0x34de('0x1f')]);_0x415f9e[_0x34de('0x1d')]=qs[_0x34de('0x1d')](_0x226401[_0x34de('0x33')]['offset']);}return _0x16b27a['getActions'](_0x415f9e);}})[_0x34de('0x27')](function(_0x2c2abc){if(_0x2c2abc){return _0x2c2abc?{'count':_0x434966,'rows':_0x2c2abc}:null;}})[_0x34de('0x27')](respondWithResult(_0x55ddfb,null))[_0x34de('0x4a')](handleError(_0x55ddfb,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index ae2860f..2aba70d 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 _0x867f=['exports','define','Automation','tools_automations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./automation.attributes'];(function(_0x27b0c4,_0xaf6d02){var _0xcb87b2=function(_0x2bd20f){while(--_0x2bd20f){_0x27b0c4['push'](_0x27b0c4['shift']());}};_0xcb87b2(++_0xaf6d02);}(_0x867f,0xdc));var _0xf867=function(_0x13d878,_0x3ac33){_0x13d878=_0x13d878-0x0;var _0x4f9280=_0x867f[_0x13d878];return _0x4f9280;};'use strict';var _=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var logger=require(_0xf867('0x2'))('api');var moment=require(_0xf867('0x3'));var BPromise=require(_0xf867('0x4'));var rp=require(_0xf867('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf867('0x6'));var config=require('../../config/environment');var attributes=require(_0xf867('0x7'));module[_0xf867('0x8')]=function(_0x2708d5,_0x287b67){return _0x2708d5[_0xf867('0x9')](_0xf867('0xa'),attributes,{'tableName':_0xf867('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58c8=['./automation.attributes','exports','define','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2a649b,_0x2f022d){var _0x30c979=function(_0x1c33c8){while(--_0x1c33c8){_0x2a649b['push'](_0x2a649b['shift']());}};_0x30c979(++_0x2f022d);}(_0x58c8,0x1d9));var _0x858c=function(_0x7044ee,_0x402f0c){_0x7044ee=_0x7044ee-0x0;var _0x1a927f=_0x58c8[_0x7044ee];return _0x1a927f;};'use strict';var _=require('lodash');var util=require(_0x858c('0x0'));var logger=require('../../config/logger')(_0x858c('0x1'));var moment=require('moment');var BPromise=require(_0x858c('0x2'));var rp=require(_0x858c('0x3'));var fs=require('fs');var path=require(_0x858c('0x4'));var rimraf=require(_0x858c('0x5'));var config=require(_0x858c('0x6'));var attributes=require(_0x858c('0x7'));module[_0x858c('0x8')]=function(_0xe7d1f,_0x159b6d){return _0xe7d1f[_0x858c('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 dd75803..75ba8c0 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 _0x4a28=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x1a1dc2,_0x36032a){var _0x2fd91c=function(_0x311e15){while(--_0x311e15){_0x1a1dc2['push'](_0x1a1dc2['shift']());}};_0x2fd91c(++_0x36032a);}(_0x4a28,0x19f));var _0x84a2=function(_0x31b53b,_0x4d06b8){_0x31b53b=_0x31b53b-0x0;var _0x53e213=_0x4a28[_0x31b53b];return _0x53e213;};'use strict';var _=require(_0x84a2('0x0'));var util=require('util');var moment=require(_0x84a2('0x1'));var BPromise=require(_0x84a2('0x2'));var rs=require(_0x84a2('0x3'));var fs=require('fs');var Redis=require(_0x84a2('0x4'));var db=require(_0x84a2('0x5'))['db'];var utils=require(_0x84a2('0x6'));var logger=require(_0x84a2('0x7'))(_0x84a2('0x8'));var config=require(_0x84a2('0x9'));var jayson=require(_0x84a2('0xa'));var client=jayson[_0x84a2('0xb')][_0x84a2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15718d,_0x2adca3,_0x553126){return new BPromise(function(_0x2d333a,_0x238af1){return client[_0x84a2('0xd')](_0x15718d,_0x553126)[_0x84a2('0xe')](function(_0x4e9f5d){logger[_0x84a2('0xf')](_0x84a2('0x10'),_0x2adca3,'request\x20sent');logger[_0x84a2('0x11')](_0x84a2('0x12'),_0x2adca3,_0x84a2('0x13'),JSON[_0x84a2('0x14')](_0x4e9f5d));if(_0x4e9f5d[_0x84a2('0x15')]){if(_0x4e9f5d[_0x84a2('0x15')][_0x84a2('0x16')]===0x1f4){logger[_0x84a2('0x15')]('Automation,\x20%s,\x20%s',_0x2adca3,_0x4e9f5d[_0x84a2('0x15')]['message']);return _0x238af1(_0x4e9f5d[_0x84a2('0x15')][_0x84a2('0x17')]);}logger[_0x84a2('0x15')]('Automation,\x20%s,\x20%s',_0x2adca3,_0x4e9f5d[_0x84a2('0x15')]['message']);return _0x2d333a(_0x4e9f5d[_0x84a2('0x15')][_0x84a2('0x17')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x2adca3,_0x84a2('0x13'));_0x2d333a(_0x4e9f5d[_0x84a2('0x18')][_0x84a2('0x17')]);}})[_0x84a2('0x19')](function(_0x4b4dfd){logger[_0x84a2('0x15')](_0x84a2('0x10'),_0x2adca3,_0x4b4dfd);_0x238af1(_0x4b4dfd);});});} \ No newline at end of file +var _0x8460=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Automation,\x20%s,\x20%s','error','code','message','request\x20sent','result'];(function(_0x543fb4,_0x24b026){var _0x356714=function(_0x3a8ac9){while(--_0x3a8ac9){_0x543fb4['push'](_0x543fb4['shift']());}};_0x356714(++_0x24b026);}(_0x8460,0xfd));var _0x0846=function(_0x1c2e6a,_0x3973d9){_0x1c2e6a=_0x1c2e6a-0x0;var _0x121218=_0x8460[_0x1c2e6a];return _0x121218;};'use strict';var _=require(_0x0846('0x0'));var util=require(_0x0846('0x1'));var moment=require(_0x0846('0x2'));var BPromise=require(_0x0846('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0846('0x4'));var db=require(_0x0846('0x5'))['db'];var utils=require(_0x0846('0x6'));var logger=require(_0x0846('0x7'))(_0x0846('0x8'));var config=require(_0x0846('0x9'));var jayson=require(_0x0846('0xa'));var client=jayson[_0x0846('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x504867,_0x27165b,_0x59860b){return new BPromise(function(_0x486f3d,_0x219cc6){return client[_0x0846('0xc')](_0x504867,_0x59860b)['then'](function(_0x2ed318){logger[_0x0846('0xd')](_0x0846('0xe'),_0x27165b,'request\x20sent');logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x27165b,'request\x20sent',JSON['stringify'](_0x2ed318));if(_0x2ed318[_0x0846('0xf')]){if(_0x2ed318[_0x0846('0xf')][_0x0846('0x10')]===0x1f4){logger[_0x0846('0xf')](_0x0846('0xe'),_0x27165b,_0x2ed318['error'][_0x0846('0x11')]);return _0x219cc6(_0x2ed318[_0x0846('0xf')][_0x0846('0x11')]);}logger[_0x0846('0xf')](_0x0846('0xe'),_0x27165b,_0x2ed318[_0x0846('0xf')][_0x0846('0x11')]);return _0x486f3d(_0x2ed318['error']['message']);}else{logger[_0x0846('0xd')](_0x0846('0xe'),_0x27165b,_0x0846('0x12'));_0x486f3d(_0x2ed318[_0x0846('0x13')][_0x0846('0x11')]);}})[_0x0846('0x14')](function(_0x3f70c7){logger[_0x0846('0xf')](_0x0846('0xe'),_0x27165b,_0x3f70c7);_0x219cc6(_0x3f70c7);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 5202209..3006f79 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 _0xd840=['fs-extra','../../components/interaction/service','get','index','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','update','/:id','exports','multer','util','path','express','Router'];(function(_0x11d129,_0x5611d0){var _0x4e566f=function(_0x17b04f){while(--_0x17b04f){_0x11d129['push'](_0x11d129['shift']());}};_0x4e566f(++_0x5611d0);}(_0xd840,0xd7));var _0x0d84=function(_0x7d7d29,_0x35f696){_0x7d7d29=_0x7d7d29-0x0;var _0x141c62=_0xd840[_0x7d7d29];return _0x141c62;};'use strict';var multer=require(_0x0d84('0x0'));var util=require(_0x0d84('0x1'));var path=require(_0x0d84('0x2'));var timeout=require('connect-timeout');var express=require(_0x0d84('0x3'));var router=express[_0x0d84('0x4')]();var fs_extra=require(_0x0d84('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0d84('0x6'));var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x0d84('0x7')]('/',auth['isAuthenticated'](),controller[_0x0d84('0x8')]);router['get']('/:id',auth[_0x0d84('0x9')](),controller[_0x0d84('0xa')]);router['get'](_0x0d84('0xb'),auth[_0x0d84('0x9')](),controller[_0x0d84('0xc')]);router['get'](_0x0d84('0xd'),auth[_0x0d84('0x9')](),controller[_0x0d84('0xe')]);router[_0x0d84('0xf')]('/',auth['isAuthenticated'](),controller[_0x0d84('0x10')]);router[_0x0d84('0xf')]('/:id/conditions',auth[_0x0d84('0x9')](),controller['addConditions']);router[_0x0d84('0xf')](_0x0d84('0xd'),auth['isAuthenticated'](),controller[_0x0d84('0x11')]);router[_0x0d84('0x12')]('/:id',auth[_0x0d84('0x9')](),controller[_0x0d84('0x13')]);router['delete'](_0x0d84('0x14'),auth[_0x0d84('0x9')](),controller['destroy']);module[_0x0d84('0x15')]=router; \ No newline at end of file +var _0xb71a=['../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','/:id','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions','addActions','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x444e1e,_0x59ef49){var _0x5a9d6a=function(_0x546673){while(--_0x546673){_0x444e1e['push'](_0x444e1e['shift']());}};_0x5a9d6a(++_0x59ef49);}(_0xb71a,0x102));var _0xab71=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb71a[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require(_0xab71('0x0'));var path=require(_0xab71('0x1'));var timeout=require(_0xab71('0x2'));var express=require(_0xab71('0x3'));var router=express[_0xab71('0x4')]();var fs_extra=require(_0xab71('0x5'));var auth=require(_0xab71('0x6'));var interaction=require(_0xab71('0x7'));var config=require('../../config/environment');var controller=require(_0xab71('0x8'));router[_0xab71('0x9')]('/',auth[_0xab71('0xa')](),controller['index']);router[_0xab71('0x9')](_0xab71('0xb'),auth[_0xab71('0xa')](),controller['show']);router['get'](_0xab71('0xc'),auth[_0xab71('0xa')](),controller[_0xab71('0xd')]);router[_0xab71('0x9')](_0xab71('0xe'),auth[_0xab71('0xa')](),controller[_0xab71('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xab71('0x10')]);router[_0xab71('0x11')]('/:id/conditions',auth['isAuthenticated'](),controller[_0xab71('0x12')]);router[_0xab71('0x11')](_0xab71('0xe'),auth['isAuthenticated'](),controller[_0xab71('0x13')]);router[_0xab71('0x14')](_0xab71('0xb'),auth[_0xab71('0xa')](),controller[_0xab71('0x15')]);router['delete'](_0xab71('0xb'),auth[_0xab71('0xa')](),controller[_0xab71('0x16')]);module[_0xab71('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 721c7a6..de11902 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 _0x31da=['#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x31da,0xe3));var _0xa31d=function(_0x4d60b3,_0x25fb7d){_0x4d60b3=_0x4d60b3-0x0;var _0x309b28=_0x31da[_0x4d60b3];return _0x309b28;};'use strict';var Sequelize=require(_0xa31d('0x0'));module['exports']={'name':{'type':Sequelize[_0xa31d('0x1')],'unique':_0xa31d('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xa31d('0x3')](_0xa31d('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xa31d('0x1')]},'active':{'type':Sequelize[_0xa31d('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xa31d('0x6')](0x4)[_0xa31d('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa31d('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa31d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa31d('0x6')](0x5)[_0xa31d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa31d('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0xa31d('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xa31d('0x6')](0x5)[_0xa31d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa31d('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa31d('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xa31d('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa31d('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa31d('0x6')](0x3)[_0xa31d('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xa31d('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa31d('0x1')],'defaultValue':_0xa31d('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xa31d('0x3')]('always',_0xa31d('0xe'),_0xa31d('0xf')),'defaultValue':_0xa31d('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa31d('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa31d('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xa31d('0x6')](0x9)[_0xa31d('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa31d('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa31d('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa31d('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa31d('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa31d('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0xa31d('0x6')](0x9)[_0xa31d('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa31d('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa31d('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa31d('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa31d('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa31d('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa31d('0x6')](0x5)[_0xa31d('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa31d('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa31d('0x6')](0x9)[_0xa31d('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa31d('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa31d('0x3')](_0xa31d('0x1a'),'ASC'),'defaultValue':_0xa31d('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xa31d('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa31d('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xa31d('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa31d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa31d('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa31d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa31d('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0xa31d('0x6')](0x3)[_0xa31d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa31d('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xa31d('0x6')](0x5)[_0xa31d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa31d('0x6')](0x3)[_0xa31d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa31d('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa31d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa31d('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xa31d('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa31d('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa31d('0x6')](0x5)[_0xa31d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa31d('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa31d('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa31d('0x6')](0x5)[_0xa31d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa31d('0x23')}}; \ No newline at end of file +var _0xdc84=['name','ENUM','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING'];(function(_0x4fe823,_0x16dbde){var _0x3693c9=function(_0xb17e01){while(--_0xb17e01){_0x4fe823['push'](_0x4fe823['shift']());}};_0x3693c9(++_0x16dbde);}(_0xdc84,0x135));var _0x4dc8=function(_0xcd26a9,_0x512e77){_0xcd26a9=_0xcd26a9-0x0;var _0x3afcbc=_0xdc84[_0xcd26a9];return _0x3afcbc;};'use strict';var Sequelize=require(_0x4dc8('0x0'));module[_0x4dc8('0x1')]={'name':{'type':Sequelize[_0x4dc8('0x2')],'unique':_0x4dc8('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x4dc8('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x4dc8('0x5')},'description':{'type':Sequelize[_0x4dc8('0x2')]},'active':{'type':Sequelize[_0x4dc8('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x4dc8('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4dc8('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4dc8('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x4dc8('0x9')](0x3)[_0x4dc8('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x4dc8('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4dc8('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4dc8('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4dc8('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x4dc8('0x9')](0x3)[_0x4dc8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4dc8('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4dc8('0x9')](0x5)[_0x4dc8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4dc8('0x9')](0x3)[_0x4dc8('0x7')],'defaultValue':0x3,'comment':_0x4dc8('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4dc8('0x9')](0x5)[_0x4dc8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4dc8('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4dc8('0x9')](0x3)[_0x4dc8('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4dc8('0x2')],'defaultValue':_0x4dc8('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x4dc8('0x4')](_0x4dc8('0x10'),_0x4dc8('0x11'),'onlyIfOpen'),'defaultValue':_0x4dc8('0x10')},'dialAMDActive':{'type':Sequelize[_0x4dc8('0x6')],'defaultValue':0x0,'comment':_0x4dc8('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x4dc8('0x9')](0x9)[_0x4dc8('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4dc8('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x4dc8('0x9')](0x9)[_0x4dc8('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4dc8('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4dc8('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4dc8('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4dc8('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4dc8('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x4dc8('0x9')](0x9)[_0x4dc8('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4dc8('0x9')](0x9)[_0x4dc8('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4dc8('0x9')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4dc8('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x4dc8('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4dc8('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4dc8('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4dc8('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4dc8('0x4')](_0x4dc8('0x1a'),_0x4dc8('0x1b')),'defaultValue':_0x4dc8('0x1a')},'dialPrefix':{'type':Sequelize[_0x4dc8('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4dc8('0x9')](0x3)[_0x4dc8('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4dc8('0x1c')},'dialCutDigit':{'type':Sequelize[_0x4dc8('0x9')](0x3)[_0x4dc8('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4dc8('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4dc8('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4dc8('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4dc8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4dc8('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x4dc8('0x9')](0x3)[_0x4dc8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4dc8('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x4dc8('0x9')](0x5)[_0x4dc8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4dc8('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4dc8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4dc8('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4dc8('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x4dc8('0x9')](0x3)[_0x4dc8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4dc8('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4dc8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4dc8('0x9')](0x3)[_0x4dc8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4dc8('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4dc8('0x9')](0x5)[_0x4dc8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4dc8('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3e58020..fe4878a 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 _0x18f3=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','destroy','then','get','IvrCampaigns','UserProfileResource','error','name','send','index','map','Campaign','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','body','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','order','sort','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','fromQuery','ContactId','ListId','phone','field','NOW()','CmListId','toString','from','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','cm_hopper','scheduledAt','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cmHopperId','OrderBy','ci.item','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce'];(function(_0x26867f,_0x140858){var _0x2be8e2=function(_0x5b4d19){while(--_0x5b4d19){_0x26867f['push'](_0x26867f['shift']());}};_0x2be8e2(++_0x140858);}(_0x18f3,0x19f));var _0x318f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x18f3[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x318f('0x0'));var zipdir=require(_0x318f('0x1'));var jsonpatch=require(_0x318f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x318f('0x3'));var Mustache=require('mustache');var util=require(_0x318f('0x4'));var path=require(_0x318f('0x5'));var sox=require(_0x318f('0x6'));var csv=require(_0x318f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x318f('0x8'));var _=require(_0x318f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x318f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x318f('0x7'));var querystring=require(_0x318f('0xb'));var Papa=require(_0x318f('0xc'));var Redis=require(_0x318f('0xd'));var authService=require(_0x318f('0xe'));var qs=require(_0x318f('0xf'));var as=require(_0x318f('0x10'));var hardwareService=require(_0x318f('0x11'));var logger=require(_0x318f('0x12'))(_0x318f('0x13'));var utils=require(_0x318f('0x14'));var config=require(_0x318f('0x15'));var licenseUtil=require(_0x318f('0x16'));var db=require(_0x318f('0x17'))['db'];function respondWithStatusCode(_0x20b5c0,_0x4f740a){_0x4f740a=_0x4f740a||0xcc;return function(_0x531876){if(_0x531876){return _0x20b5c0[_0x318f('0x18')](_0x4f740a);}return _0x20b5c0[_0x318f('0x19')](_0x4f740a)[_0x318f('0x1a')]();};}function respondWithResult(_0x419cc4,_0x25d749){_0x25d749=_0x25d749||0xc8;return function(_0x3dc225){if(_0x3dc225){return _0x419cc4[_0x318f('0x19')](_0x25d749)['json'](_0x3dc225);}};}function respondWithFilteredResult(_0x210758,_0x4dbaf4){return function(_0x47cfdb){if(_0x47cfdb){var _0x2651ec=typeof _0x4dbaf4[_0x318f('0x1b')]==='undefined'&&typeof _0x4dbaf4['limit']===_0x318f('0x1c');var _0x56b0ed=_0x47cfdb[_0x318f('0x1d')];var _0x1b67e4=_0x2651ec?0x0:_0x4dbaf4[_0x318f('0x1b')];var _0x386b33=_0x2651ec?_0x47cfdb[_0x318f('0x1d')]:_0x4dbaf4['offset']+_0x4dbaf4[_0x318f('0x1e')];var _0x1e4ca5;if(_0x386b33>=_0x56b0ed){_0x386b33=_0x56b0ed;_0x1e4ca5=0xc8;}else{_0x1e4ca5=0xce;}_0x210758[_0x318f('0x19')](_0x1e4ca5);return _0x210758[_0x318f('0x1f')](_0x318f('0x20'),_0x1b67e4+'-'+_0x386b33+'/'+_0x56b0ed)[_0x318f('0x21')](_0x47cfdb);}return null;};}function patchUpdates(_0x27dcd1){return function(_0x2b0b06){try{jsonpatch[_0x318f('0x22')](_0x2b0b06,_0x27dcd1,!![]);}catch(_0x5b09a5){return BPromise['reject'](_0x5b09a5);}return _0x2b0b06[_0x318f('0x23')]();};}function saveUpdates(_0x21f42b,_0x39e131){return function(_0x5617f4){if(_0x5617f4){return _0x5617f4[_0x318f('0x24')](_0x21f42b)['then'](function(_0x414236){return _0x414236;});}return null;};}function removeEntity(_0x5237b6,_0x47087a){return function(_0x3c9aaa){if(_0x3c9aaa){return _0x3c9aaa[_0x318f('0x25')]()[_0x318f('0x26')](function(){var _0x1df501=_0x3c9aaa[_0x318f('0x27')]({'plain':!![]});var _0x1a86fb=_0x318f('0x28');return db[_0x318f('0x29')][_0x318f('0x25')]({'where':{'type':_0x1a86fb,'resourceId':_0x1df501['id']}})[_0x318f('0x26')](function(){return _0x3c9aaa;});})[_0x318f('0x26')](function(){_0x5237b6[_0x318f('0x19')](0xcc)[_0x318f('0x1a')]();});}};}function handleEntityNotFound(_0xf2374f,_0x236766){return function(_0x2cab68){if(!_0x2cab68){_0xf2374f[_0x318f('0x18')](0x194);}return _0x2cab68;};}function handleError(_0x2f326b,_0x3e82aa){_0x3e82aa=_0x3e82aa||0x1f4;return function(_0x1628de){logger[_0x318f('0x2a')](_0x1628de['stack']);if(_0x1628de[_0x318f('0x2b')]){delete _0x1628de['name'];}_0x2f326b[_0x318f('0x19')](_0x3e82aa)[_0x318f('0x2c')](_0x1628de);};}exports[_0x318f('0x2d')]=function(_0x3fe614,_0x17fcf1){var _0x1547f4={},_0x44cb65={},_0x253e2e={'count':0x0,'rows':[]};var _0x3a2103=_[_0x318f('0x2e')](db[_0x318f('0x2f')][_0x318f('0x30')],function(_0x396a00){return{'name':_0x396a00['fieldName'],'type':_0x396a00[_0x318f('0x31')]['key']};});_0x44cb65[_0x318f('0x32')]=_['map'](_0x3a2103,_0x318f('0x2b'));_0x44cb65[_0x318f('0x33')]=_[_0x318f('0x34')](_0x3fe614['query']);_0x44cb65[_0x318f('0x35')]=_[_0x318f('0x36')](_0x44cb65[_0x318f('0x32')],_0x44cb65['query']);_0x1547f4[_0x318f('0x37')]=_['intersection'](_0x44cb65[_0x318f('0x32')],qs[_0x318f('0x38')](_0x3fe614['query']['fields']));_0x1547f4[_0x318f('0x37')]=_0x1547f4['attributes'][_0x318f('0x39')]?_0x1547f4[_0x318f('0x37')]:_0x44cb65[_0x318f('0x32')];if(!_0x3fe614[_0x318f('0x33')][_0x318f('0x3a')](_0x318f('0x3b'))){_0x1547f4[_0x318f('0x1e')]=qs[_0x318f('0x1e')](_0x3fe614[_0x318f('0x33')][_0x318f('0x1e')]);_0x1547f4[_0x318f('0x1b')]=qs[_0x318f('0x1b')](_0x3fe614[_0x318f('0x33')]['offset']);}_0x1547f4['order']=qs['sort'](_0x3fe614[_0x318f('0x33')]['sort']);_0x1547f4[_0x318f('0x3c')]=qs['filters'](_[_0x318f('0x3d')](_0x3fe614['query'],_0x44cb65[_0x318f('0x35')]),_0x3a2103);if(_0x3fe614['query']['filter']){_0x1547f4[_0x318f('0x3c')]=_['merge'](_0x1547f4[_0x318f('0x3c')],{'$or':_['map'](_0x3a2103,function(_0x6e4d61){if(_0x6e4d61[_0x318f('0x31')]!==_0x318f('0x3e')){var _0x42987d={};_0x42987d[_0x6e4d61['name']]={'$like':'%'+_0x3fe614[_0x318f('0x33')][_0x318f('0x3f')]+'%'};return _0x42987d;}})});}_0x1547f4=_[_0x318f('0x40')]({},_0x1547f4,_0x3fe614[_0x318f('0x41')]);var _0x99fdfe={'where':_0x1547f4[_0x318f('0x3c')]};return db[_0x318f('0x2f')][_0x318f('0x1d')](_0x99fdfe)[_0x318f('0x26')](function(_0x370929){_0x253e2e[_0x318f('0x1d')]=_0x370929;if(_0x3fe614[_0x318f('0x33')]['includeAll']){_0x1547f4[_0x318f('0x42')]=[{'all':!![]}];}return db[_0x318f('0x2f')][_0x318f('0x43')](_0x1547f4);})[_0x318f('0x26')](function(_0x6a4876){_0x253e2e['rows']=_0x6a4876;return _0x253e2e;})['then'](respondWithFilteredResult(_0x17fcf1,_0x1547f4))[_0x318f('0x44')](handleError(_0x17fcf1,null));};exports[_0x318f('0x45')]=function(_0xc17409,_0x47fcbc){var _0x221d80={'raw':![],'where':{'id':_0xc17409[_0x318f('0x46')]['id']}},_0x41c1fe={};_0x41c1fe['model']=_['keys'](db[_0x318f('0x2f')][_0x318f('0x30')]);_0x41c1fe[_0x318f('0x33')]=_[_0x318f('0x34')](_0xc17409[_0x318f('0x33')]);_0x41c1fe[_0x318f('0x35')]=_[_0x318f('0x36')](_0x41c1fe[_0x318f('0x32')],_0x41c1fe[_0x318f('0x33')]);_0x221d80[_0x318f('0x37')]=_['intersection'](_0x41c1fe[_0x318f('0x32')],qs[_0x318f('0x38')](_0xc17409[_0x318f('0x33')][_0x318f('0x38')]));_0x221d80[_0x318f('0x37')]=_0x221d80[_0x318f('0x37')]['length']?_0x221d80[_0x318f('0x37')]:_0x41c1fe[_0x318f('0x32')];if(_0xc17409[_0x318f('0x33')][_0x318f('0x47')]){_0x221d80[_0x318f('0x42')]=[{'all':!![]}];}_0x221d80=_['merge']({},_0x221d80,_0xc17409[_0x318f('0x41')]);return db[_0x318f('0x2f')][_0x318f('0x48')](_0x221d80)['then'](handleEntityNotFound(_0x47fcbc,null))['then'](respondWithResult(_0x47fcbc,null))['catch'](handleError(_0x47fcbc,null));};exports[_0x318f('0x49')]=function(_0x5c4d3e,_0x572fb1){return db[_0x318f('0x2f')][_0x318f('0x49')](_0x5c4d3e['body'],{})[_0x318f('0x26')](function(_0x24308e){var _0x597c5a=_0x5c4d3e[_0x318f('0x4a')][_0x318f('0x27')]({'plain':!![]});if(!_0x597c5a)throw new Error(_0x318f('0x4b'));if(_0x597c5a[_0x318f('0x4c')]===_0x318f('0x4a')){var _0x2cee3b=_0x24308e['get']({'plain':!![]});var _0x51df05='IvrCampaigns';return db[_0x318f('0x4d')][_0x318f('0x48')]({'where':{'name':_0x51df05,'userProfileId':_0x597c5a[_0x318f('0x4e')]},'raw':!![]})['then'](function(_0x42b443){if(_0x42b443&&_0x42b443[_0x318f('0x4f')]===0x0){return db[_0x318f('0x29')]['create']({'name':_0x2cee3b['name'],'resourceId':_0x2cee3b['id'],'type':_0x42b443[_0x318f('0x2b')],'sectionId':_0x42b443['id']},{})[_0x318f('0x26')](function(){return _0x24308e;});}else{return _0x24308e;}})[_0x318f('0x44')](function(_0x391475){logger[_0x318f('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x391475);throw _0x391475;});}return _0x24308e;})[_0x318f('0x26')](respondWithResult(_0x572fb1,0xc9))[_0x318f('0x44')](handleError(_0x572fb1,null));};exports[_0x318f('0x50')]=function(_0x3891fd,_0x45220b){var _0x571cc6={'where':{'id':_0x3891fd[_0x318f('0x46')]['id']}},_0x5a59de={};_0x5a59de[_0x318f('0x32')]=_[_0x318f('0x34')](db[_0x318f('0x2f')][_0x318f('0x30')]);_0x571cc6[_0x318f('0x37')]=_[_0x318f('0x36')](_0x5a59de[_0x318f('0x32')],qs[_0x318f('0x38')](_0x3891fd[_0x318f('0x33')][_0x318f('0x38')]));_0x571cc6['attributes']=_0x571cc6['attributes']['length']?_0x571cc6[_0x318f('0x37')]:_0x5a59de[_0x318f('0x32')];if(_0x3891fd[_0x318f('0x33')][_0x318f('0x47')]){_0x571cc6[_0x318f('0x42')]=[{'all':!![]}];}_0x571cc6=_['merge']({},_0x571cc6,_0x3891fd[_0x318f('0x41')]);return db['Campaign'][_0x318f('0x48')](_0x571cc6)[_0x318f('0x26')](handleEntityNotFound(_0x45220b,null))[_0x318f('0x26')](function(_0x80227f){if(_0x80227f){var _0x273c93=_0x80227f[_0x318f('0x27')]({'plain':!![]});_0x273c93=qs[_0x318f('0x51')](_0x273c93,['id',_0x318f('0x52'),'updatedAt']);_0x3891fd[_0x318f('0x53')]=_[_0x318f('0x51')](_0x3891fd['body'],['id','createdAt',_0x318f('0x54')]);return db['Campaign'][_0x318f('0x49')](_[_0x318f('0x40')](_0x273c93,_0x3891fd[_0x318f('0x53')]),{'include':_0x3891fd[_0x318f('0x33')][_0x318f('0x47')]?[{'all':!![]}]:undefined})[_0x318f('0x26')](function(_0x1bd580){var _0xd85d28=_0x3891fd['user'][_0x318f('0x27')]({'plain':!![]});if(!_0xd85d28)throw new Error(_0x318f('0x4b'));if(_0xd85d28[_0x318f('0x4c')]===_0x318f('0x4a')){var _0x5cf084=_0x1bd580[_0x318f('0x27')]({'plain':!![]});var _0x32a08d=_0x318f('0x28');return db['UserProfileSection'][_0x318f('0x48')]({'where':{'name':_0x32a08d,'userProfileId':_0xd85d28[_0x318f('0x4e')]},'raw':!![]})[_0x318f('0x26')](function(_0x46b28f){if(_0x46b28f&&_0x46b28f[_0x318f('0x4f')]===0x0){return db[_0x318f('0x29')][_0x318f('0x49')]({'name':_0x5cf084[_0x318f('0x2b')],'resourceId':_0x5cf084['id'],'type':_0x46b28f[_0x318f('0x2b')],'sectionId':_0x46b28f['id']},{})[_0x318f('0x26')](function(){return _0x1bd580;});}else{return _0x1bd580;}})[_0x318f('0x44')](function(_0x57ecab){logger[_0x318f('0x2a')](_0x318f('0x55'),_0x57ecab);throw _0x57ecab;});}return _0x1bd580;});}})[_0x318f('0x26')](respondWithResult(_0x45220b,0xc9))['catch'](handleError(_0x45220b,null));};exports[_0x318f('0x24')]=function(_0xb20b2b,_0x3301f9){if(_0xb20b2b[_0x318f('0x53')]['id']){delete _0xb20b2b[_0x318f('0x53')]['id'];}return db[_0x318f('0x2f')][_0x318f('0x48')]({'where':{'id':_0xb20b2b['params']['id']}})[_0x318f('0x26')](handleEntityNotFound(_0x3301f9,null))[_0x318f('0x26')](saveUpdates(_0xb20b2b['body'],null))[_0x318f('0x26')](respondWithResult(_0x3301f9,null))[_0x318f('0x44')](handleError(_0x3301f9,null));};exports[_0x318f('0x25')]=function(_0x597360,_0x33ccb4){return db[_0x318f('0x2f')]['find']({'where':{'id':_0x597360['params']['id']}})[_0x318f('0x26')](handleEntityNotFound(_0x33ccb4,null))[_0x318f('0x26')](removeEntity(_0x33ccb4,null))[_0x318f('0x44')](handleError(_0x33ccb4,null));};exports[_0x318f('0x56')]=function(_0x52d322,_0x2ab13a,_0x51e547){var _0x46a434={'raw':!![],'where':{}};var _0xc2147a={};var _0x3c8be0={'count':0x0,'rows':[]};return db[_0x318f('0x2f')][_0x318f('0x57')]({'where':{'id':_0x52d322[_0x318f('0x46')]['id']}})[_0x318f('0x26')](handleEntityNotFound(_0x2ab13a,null))['then'](function(_0x481686){if(_0x481686){_0xc2147a[_0x318f('0x32')]=_[_0x318f('0x34')](db[_0x318f('0x58')][_0x318f('0x30')]);_0xc2147a[_0x318f('0x33')]=_[_0x318f('0x34')](_0x52d322[_0x318f('0x33')]);_0xc2147a['filters']=_[_0x318f('0x36')](_0xc2147a['model'],_0xc2147a[_0x318f('0x33')]);_0x46a434[_0x318f('0x37')]=_[_0x318f('0x36')](_0xc2147a[_0x318f('0x32')],qs[_0x318f('0x38')](_0x52d322[_0x318f('0x33')][_0x318f('0x38')]));_0x46a434[_0x318f('0x37')]=_0x46a434[_0x318f('0x37')]['length']?_0x46a434[_0x318f('0x37')]:_0xc2147a[_0x318f('0x32')];if(!_0x52d322[_0x318f('0x33')][_0x318f('0x3a')](_0x318f('0x3b'))){_0x46a434[_0x318f('0x1e')]=qs[_0x318f('0x1e')](_0x52d322[_0x318f('0x33')][_0x318f('0x1e')]);_0x46a434['offset']=qs[_0x318f('0x1b')](_0x52d322[_0x318f('0x33')][_0x318f('0x1b')]);}_0x46a434[_0x318f('0x59')]=qs['sort'](_0x52d322[_0x318f('0x33')][_0x318f('0x5a')]);_0x46a434[_0x318f('0x3c')]=qs[_0x318f('0x35')](_['pick'](_0x52d322[_0x318f('0x33')],_0xc2147a[_0x318f('0x35')]));_0x46a434[_0x318f('0x3c')][_0x318f('0x5b')]=_0x481686['id'];if(_0x52d322[_0x318f('0x33')][_0x318f('0x3f')]){_0x46a434['where']=_[_0x318f('0x40')](_0x46a434[_0x318f('0x3c')],{'$or':_[_0x318f('0x2e')](_0x46a434[_0x318f('0x37')],function(_0xf35b84){var _0x2d012a={};_0x2d012a[_0xf35b84]={'$like':'%'+_0x52d322[_0x318f('0x33')][_0x318f('0x3f')]+'%'};return _0x2d012a;})});}_0x46a434=_[_0x318f('0x40')]({},_0x46a434,_0x52d322[_0x318f('0x41')]);return db[_0x318f('0x58')]['count']({'where':_0x46a434['where']})[_0x318f('0x26')](function(_0x1de118){_0x3c8be0[_0x318f('0x1d')]=_0x1de118;if(_0x52d322[_0x318f('0x33')]['includeAll']){_0x46a434['include']=[{'all':!![]}];}return db[_0x318f('0x58')][_0x318f('0x43')](_0x46a434);})[_0x318f('0x26')](function(_0x3b14cf){_0x3c8be0[_0x318f('0x5c')]=_0x3b14cf;return _0x3c8be0;});}})[_0x318f('0x26')](respondWithFilteredResult(_0x2ab13a,_0x46a434))[_0x318f('0x44')](handleError(_0x2ab13a,null));};exports[_0x318f('0x5d')]=function(_0x17126f,_0x2e9826,_0x1aecad){var _0x3fcc05={'raw':!![],'where':{}};var _0x1a34b4={};var _0x46f36f={'count':0x0,'rows':[]};return db['Campaign'][_0x318f('0x57')]({'where':{'id':_0x17126f[_0x318f('0x46')]['id']}})[_0x318f('0x26')](handleEntityNotFound(_0x2e9826,null))[_0x318f('0x26')](function(_0x170197){if(_0x170197){_0x1a34b4[_0x318f('0x32')]=_['keys'](db['CmHopperHistory'][_0x318f('0x30')]);_0x1a34b4[_0x318f('0x33')]=_['keys'](_0x17126f[_0x318f('0x33')]);_0x1a34b4['filters']=_['intersection'](_0x1a34b4[_0x318f('0x32')],_0x1a34b4[_0x318f('0x33')]);_0x3fcc05['attributes']=_[_0x318f('0x36')](_0x1a34b4[_0x318f('0x32')],qs['fields'](_0x17126f[_0x318f('0x33')]['fields']));_0x3fcc05[_0x318f('0x37')]=_0x3fcc05['attributes'][_0x318f('0x39')]?_0x3fcc05[_0x318f('0x37')]:_0x1a34b4[_0x318f('0x32')];if(!_0x17126f[_0x318f('0x33')][_0x318f('0x3a')](_0x318f('0x3b'))){_0x3fcc05[_0x318f('0x1e')]=qs[_0x318f('0x1e')](_0x17126f['query'][_0x318f('0x1e')]);_0x3fcc05[_0x318f('0x1b')]=qs['offset'](_0x17126f[_0x318f('0x33')]['offset']);}_0x3fcc05[_0x318f('0x59')]=qs['sort'](_0x17126f[_0x318f('0x33')]['sort']);_0x3fcc05[_0x318f('0x3c')]=qs[_0x318f('0x35')](_[_0x318f('0x3d')](_0x17126f[_0x318f('0x33')],_0x1a34b4[_0x318f('0x35')]));_0x3fcc05[_0x318f('0x3c')]['CampaignId']=_0x170197['id'];if(_0x17126f[_0x318f('0x33')][_0x318f('0x3f')]){_0x3fcc05['where']=_['merge'](_0x3fcc05[_0x318f('0x3c')],{'$or':_[_0x318f('0x2e')](_0x3fcc05['attributes'],function(_0xec11d3){var _0xd91147={};_0xd91147[_0xec11d3]={'$like':'%'+_0x17126f[_0x318f('0x33')][_0x318f('0x3f')]+'%'};return _0xd91147;})});}_0x3fcc05=_[_0x318f('0x40')]({},_0x3fcc05,_0x17126f[_0x318f('0x41')]);return db['CmHopperHistory']['count']({'where':_0x3fcc05[_0x318f('0x3c')]})[_0x318f('0x26')](function(_0x370e27){_0x46f36f[_0x318f('0x1d')]=_0x370e27;if(_0x17126f[_0x318f('0x33')][_0x318f('0x47')]){_0x3fcc05[_0x318f('0x42')]=[{'all':!![]}];}return db[_0x318f('0x5e')][_0x318f('0x43')](_0x3fcc05);})['then'](function(_0x4851c2){_0x46f36f[_0x318f('0x5c')]=_0x4851c2;return _0x46f36f;});}})[_0x318f('0x26')](respondWithFilteredResult(_0x2e9826,_0x3fcc05))['catch'](handleError(_0x2e9826,null));};exports[_0x318f('0x5f')]=function(_0x27b57b,_0x20b065,_0x571410){var _0x35f950={'raw':!![],'where':{}};var _0x2007df={};var _0x513482={'count':0x0,'rows':[]};return db['Campaign'][_0x318f('0x57')]({'where':{'id':_0x27b57b[_0x318f('0x46')]['id']}})[_0x318f('0x26')](handleEntityNotFound(_0x20b065,null))[_0x318f('0x26')](function(_0x1db979){if(_0x1db979){_0x2007df[_0x318f('0x32')]=_[_0x318f('0x34')](db[_0x318f('0x60')]['rawAttributes']);_0x2007df['query']=_['keys'](_0x27b57b[_0x318f('0x33')]);_0x2007df['filters']=_[_0x318f('0x36')](_0x2007df[_0x318f('0x32')],_0x2007df[_0x318f('0x33')]);_0x35f950[_0x318f('0x37')]=_['intersection'](_0x2007df[_0x318f('0x32')],qs[_0x318f('0x38')](_0x27b57b[_0x318f('0x33')][_0x318f('0x38')]));_0x35f950['attributes']=_0x35f950[_0x318f('0x37')][_0x318f('0x39')]?_0x35f950['attributes']:_0x2007df['model'];if(!_0x27b57b['query'][_0x318f('0x3a')](_0x318f('0x3b'))){_0x35f950[_0x318f('0x1e')]=qs[_0x318f('0x1e')](_0x27b57b[_0x318f('0x33')][_0x318f('0x1e')]);_0x35f950[_0x318f('0x1b')]=qs[_0x318f('0x1b')](_0x27b57b[_0x318f('0x33')]['offset']);}_0x35f950[_0x318f('0x59')]=qs[_0x318f('0x5a')](_0x27b57b[_0x318f('0x33')][_0x318f('0x5a')]);_0x35f950[_0x318f('0x3c')]=qs[_0x318f('0x35')](_['pick'](_0x27b57b['query'],_0x2007df[_0x318f('0x35')]));_0x35f950[_0x318f('0x3c')][_0x318f('0x5b')]=_0x1db979['id'];if(_0x27b57b[_0x318f('0x33')][_0x318f('0x3f')]){_0x35f950[_0x318f('0x3c')]=_[_0x318f('0x40')](_0x35f950[_0x318f('0x3c')],{'$or':_['map'](_0x35f950[_0x318f('0x37')],function(_0xf69b3a){var _0x319efa={};_0x319efa[_0xf69b3a]={'$like':'%'+_0x27b57b[_0x318f('0x33')]['filter']+'%'};return _0x319efa;})});}_0x35f950=_[_0x318f('0x40')]({},_0x35f950,_0x27b57b[_0x318f('0x41')]);return db[_0x318f('0x60')]['count']({'where':_0x35f950[_0x318f('0x3c')]})[_0x318f('0x26')](function(_0x3894dc){_0x513482[_0x318f('0x1d')]=_0x3894dc;if(_0x27b57b[_0x318f('0x33')][_0x318f('0x47')]){_0x35f950['include']=[{'all':!![]}];}return db[_0x318f('0x60')][_0x318f('0x43')](_0x35f950);})[_0x318f('0x26')](function(_0x1026c2){_0x513482[_0x318f('0x5c')]=_0x1026c2;return _0x513482;});}})[_0x318f('0x26')](respondWithFilteredResult(_0x20b065,_0x35f950))[_0x318f('0x44')](handleError(_0x20b065,null));};exports[_0x318f('0x61')]=function(_0x6cecfc,_0x3f4968,_0x479f4a){var _0x2f94ae={'raw':!![],'where':{}};var _0x377a15={};var _0x1a8222={'count':0x0,'rows':[]};return db['Campaign'][_0x318f('0x57')]({'where':{'id':_0x6cecfc[_0x318f('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f4968,null))['then'](function(_0x2a9193){if(_0x2a9193){_0x377a15[_0x318f('0x32')]=_[_0x318f('0x34')](db['CmHopperBlack'][_0x318f('0x30')]);_0x377a15['query']=_['keys'](_0x6cecfc['query']);_0x377a15[_0x318f('0x35')]=_['intersection'](_0x377a15[_0x318f('0x32')],_0x377a15['query']);_0x2f94ae[_0x318f('0x37')]=_[_0x318f('0x36')](_0x377a15[_0x318f('0x32')],qs['fields'](_0x6cecfc[_0x318f('0x33')]['fields']));_0x2f94ae[_0x318f('0x37')]=_0x2f94ae[_0x318f('0x37')]['length']?_0x2f94ae[_0x318f('0x37')]:_0x377a15[_0x318f('0x32')];if(!_0x6cecfc[_0x318f('0x33')][_0x318f('0x3a')]('nolimit')){_0x2f94ae[_0x318f('0x1e')]=qs['limit'](_0x6cecfc[_0x318f('0x33')][_0x318f('0x1e')]);_0x2f94ae[_0x318f('0x1b')]=qs[_0x318f('0x1b')](_0x6cecfc[_0x318f('0x33')][_0x318f('0x1b')]);}_0x2f94ae[_0x318f('0x59')]=qs[_0x318f('0x5a')](_0x6cecfc[_0x318f('0x33')]['sort']);_0x2f94ae[_0x318f('0x3c')]=qs[_0x318f('0x35')](_[_0x318f('0x3d')](_0x6cecfc[_0x318f('0x33')],_0x377a15[_0x318f('0x35')]));_0x2f94ae[_0x318f('0x3c')][_0x318f('0x5b')]=_0x2a9193['id'];if(_0x6cecfc[_0x318f('0x33')][_0x318f('0x3f')]){_0x2f94ae[_0x318f('0x3c')]=_[_0x318f('0x40')](_0x2f94ae[_0x318f('0x3c')],{'$or':_['map'](_0x2f94ae['attributes'],function(_0x1050f9){var _0x51f552={};_0x51f552[_0x1050f9]={'$like':'%'+_0x6cecfc['query'][_0x318f('0x3f')]+'%'};return _0x51f552;})});}_0x2f94ae=_['merge']({},_0x2f94ae,_0x6cecfc['options']);return db[_0x318f('0x62')][_0x318f('0x1d')]({'where':_0x2f94ae[_0x318f('0x3c')]})[_0x318f('0x26')](function(_0x1aa277){_0x1a8222['count']=_0x1aa277;if(_0x6cecfc['query'][_0x318f('0x47')]){_0x2f94ae['include']=[{'all':!![]}];}return db[_0x318f('0x62')][_0x318f('0x43')](_0x2f94ae);})[_0x318f('0x26')](function(_0x55bdf8){_0x1a8222[_0x318f('0x5c')]=_0x55bdf8;return _0x1a8222;});}})[_0x318f('0x26')](respondWithFilteredResult(_0x3f4968,_0x2f94ae))['catch'](handleError(_0x3f4968,null));};exports[_0x318f('0x63')]=function(_0x557a5f,_0x452f68,_0x196695){var _0x330089={};var _0x1186c3={};var _0x359abb;var _0x377e2a;return db[_0x318f('0x2f')][_0x318f('0x57')]({'where':{'id':_0x557a5f['params']['id']}})[_0x318f('0x26')](handleEntityNotFound(_0x452f68,null))[_0x318f('0x26')](function(_0x2b893c){if(_0x2b893c){_0x359abb=_0x2b893c;_0x1186c3[_0x318f('0x32')]=_[_0x318f('0x34')](db['CmList'][_0x318f('0x30')]);_0x1186c3[_0x318f('0x33')]=_[_0x318f('0x34')](_0x557a5f[_0x318f('0x33')]);_0x1186c3[_0x318f('0x35')]=_[_0x318f('0x36')](_0x1186c3[_0x318f('0x32')],_0x1186c3[_0x318f('0x33')]);_0x330089[_0x318f('0x37')]=_[_0x318f('0x36')](_0x1186c3[_0x318f('0x32')],qs[_0x318f('0x38')](_0x557a5f['query']['fields']));_0x330089[_0x318f('0x37')]=_0x330089[_0x318f('0x37')][_0x318f('0x39')]?_0x330089[_0x318f('0x37')]:_0x1186c3[_0x318f('0x32')];_0x330089[_0x318f('0x59')]=qs[_0x318f('0x5a')](_0x557a5f[_0x318f('0x33')][_0x318f('0x5a')]);_0x330089[_0x318f('0x3c')]=qs['filters'](_['pick'](_0x557a5f[_0x318f('0x33')],_0x1186c3[_0x318f('0x35')]));if(_0x557a5f[_0x318f('0x33')][_0x318f('0x3f')]){_0x330089['where']=_['merge'](_0x330089[_0x318f('0x3c')],{'$or':_[_0x318f('0x2e')](_0x330089[_0x318f('0x37')],function(_0x437559){var _0x49bb3e={};_0x49bb3e[_0x437559]={'$like':'%'+_0x557a5f[_0x318f('0x33')][_0x318f('0x3f')]+'%'};return _0x49bb3e;})});}_0x330089=_[_0x318f('0x40')]({},_0x330089,_0x557a5f[_0x318f('0x41')]);return _0x359abb[_0x318f('0x63')](_0x330089);}})[_0x318f('0x26')](function(_0x4b388d){if(_0x4b388d){_0x377e2a=_0x4b388d['length'];if(!_0x557a5f[_0x318f('0x33')][_0x318f('0x3a')](_0x318f('0x3b'))){_0x330089[_0x318f('0x1e')]=qs[_0x318f('0x1e')](_0x557a5f[_0x318f('0x33')][_0x318f('0x1e')]);_0x330089['offset']=qs[_0x318f('0x1b')](_0x557a5f[_0x318f('0x33')][_0x318f('0x1b')]);}return _0x359abb[_0x318f('0x63')](_0x330089);}})['then'](function(_0x3883cd){if(_0x3883cd){return _0x3883cd?{'count':_0x377e2a,'rows':_0x3883cd}:null;}})[_0x318f('0x26')](respondWithResult(_0x452f68,null))[_0x318f('0x44')](handleError(_0x452f68,null));};exports['addLists']=function(_0x260dfa,_0x1d5a8a,_0x5c3f76){var _0x20d792,_0x399a4c;var _0x410938=[];var _0x4f6bc7=moment()['format'](_0x318f('0x64'));return db[_0x318f('0x2f')][_0x318f('0x48')]({'where':{'id':_0x260dfa[_0x318f('0x46')]['id']}})[_0x318f('0x26')](handleEntityNotFound(_0x1d5a8a,null))[_0x318f('0x26')](function(_0x1317e8){if(_0x1317e8){_0x399a4c=_0x1317e8;return _0x1317e8['addLists'](_0x260dfa[_0x318f('0x53')][_0x318f('0x65')],_[_0x318f('0x51')](_0x260dfa['body'],[_0x318f('0x65'),'id'])||{});}return null;})['spread'](function(_0x446ee1){var _0x5b5075;var _0x4ad918;_0x20d792=_0x446ee1||[];var _0x1b6a18=[];if(_0x446ee1){for(var _0x54f8a3=0x0;_0x54f8a3<_0x446ee1[_0x318f('0x39')];_0x54f8a3+=0x1){var _0x324cad=_0x446ee1[_0x54f8a3]['get']({'plain':!![]});_0x399a4c['dialCheckDuplicateType']=_0x260dfa[_0x318f('0x53')]['dialCheckDuplicateType']?_0x260dfa['body']['dialCheckDuplicateType']:_0x399a4c[_0x318f('0x66')];switch(_0x399a4c[_0x318f('0x66')]){case _0x318f('0x67'):_0x5b5075=squel['insert']()['into']('cm_hopper')[_0x318f('0x68')](['phone','scheduledAt',_0x318f('0x69'),_0x318f('0x6a'),_0x318f('0x5b'),_0x318f('0x52'),'updatedAt'],squel['select']()['field'](_0x318f('0x6b'),'phone')[_0x318f('0x6c')](_0x318f('0x6d'),'scheduledAt')[_0x318f('0x6c')]('id',_0x318f('0x69'))[_0x318f('0x6c')](_0x324cad[_0x318f('0x6e')][_0x318f('0x6f')](),_0x318f('0x6a'))[_0x318f('0x6c')](_0x260dfa[_0x318f('0x46')]['id']['toString'](),_0x318f('0x5b'))[_0x318f('0x6c')]('\x27'+_0x4f6bc7+'\x27','createdAt')[_0x318f('0x6c')]('\x27'+_0x4f6bc7+'\x27','updatedAt')[_0x318f('0x70')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x318f('0x3c')](_0x318f('0x71'),_0x324cad[_0x318f('0x6e')][_0x318f('0x6f')]())[_0x318f('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x318f('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x318f('0x6c')](_0x318f('0x72'))[_0x318f('0x70')](_0x318f('0x73'))['where'](_0x318f('0x74'),_0x260dfa['params']['id'][_0x318f('0x6f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x318f('0x75')]()[_0x318f('0x6c')](_0x318f('0x76'))['from']('cm_hopper')[_0x318f('0x3c')](_0x318f('0x74'),_0x260dfa[_0x318f('0x46')]['id']['toString']())))[_0x318f('0x6f')]();break;case _0x318f('0x77'):_0x5b5075=squel[_0x318f('0x78')]()[_0x318f('0x79')](_0x318f('0x7a'))[_0x318f('0x68')]([_0x318f('0x6b'),_0x318f('0x7b'),'ContactId',_0x318f('0x6a'),'CampaignId',_0x318f('0x52'),_0x318f('0x54')],squel[_0x318f('0x75')]()[_0x318f('0x6c')]('phone',_0x318f('0x6b'))[_0x318f('0x6c')](_0x318f('0x6d'),_0x318f('0x7b'))[_0x318f('0x6c')]('id','ContactId')['field'](_0x324cad[_0x318f('0x6e')]['toString'](),_0x318f('0x6a'))['field'](_0x260dfa[_0x318f('0x46')]['id'][_0x318f('0x6f')](),_0x318f('0x5b'))[_0x318f('0x6c')]('\x27'+_0x4f6bc7+'\x27',_0x318f('0x52'))[_0x318f('0x6c')]('\x27'+_0x4f6bc7+'\x27',_0x318f('0x54'))[_0x318f('0x70')](_0x318f('0x7c'))[_0x318f('0x3c')](_0x318f('0x7d'))[_0x318f('0x3c')]('ListId\x20=\x20?',_0x324cad['CmListId'][_0x318f('0x6f')]())['where'](_0x318f('0x7e'))[_0x318f('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x318f('0x75')]()[_0x318f('0x6c')]('COALESCE(phone,\x27\x27)')[_0x318f('0x70')]('cm_hopper')[_0x318f('0x3c')](_0x318f('0x74'),_0x260dfa[_0x318f('0x46')]['id'][_0x318f('0x6f')]())))[_0x318f('0x6f')]();break;default:_0x5b5075=squel[_0x318f('0x78')]()['into'](_0x318f('0x7a'))[_0x318f('0x68')]([_0x318f('0x6b'),_0x318f('0x7b'),_0x318f('0x69'),_0x318f('0x6a'),_0x318f('0x5b'),_0x318f('0x52'),'updatedAt'],squel[_0x318f('0x75')]()[_0x318f('0x6c')](_0x318f('0x6b'),_0x318f('0x6b'))[_0x318f('0x6c')](_0x318f('0x6d'),_0x318f('0x7b'))['field']('id',_0x318f('0x69'))[_0x318f('0x6c')](_0x324cad[_0x318f('0x6e')]['toString'](),'ListId')[_0x318f('0x6c')](_0x260dfa[_0x318f('0x46')]['id'][_0x318f('0x6f')](),_0x318f('0x5b'))['field']('\x27'+_0x4f6bc7+'\x27','createdAt')[_0x318f('0x6c')]('\x27'+_0x4f6bc7+'\x27',_0x318f('0x54'))[_0x318f('0x70')](_0x318f('0x7c'))['where'](_0x318f('0x7d'))[_0x318f('0x3c')]('ListId\x20=\x20?',_0x324cad[_0x318f('0x6e')]['toString']())[_0x318f('0x3c')](_0x318f('0x7e')))['toString']();}_0x4ad918=squel[_0x318f('0x78')]()[_0x318f('0x79')]('cm_hopper_additional_phones')[_0x318f('0x68')]([_0x318f('0x7f'),'scheduledAt',_0x318f('0x6b'),_0x318f('0x80'),'createdAt',_0x318f('0x54')],squel[_0x318f('0x75')]()['field']('h.id','id')[_0x318f('0x6c')](_0x318f('0x6d'),_0x318f('0x7b'))[_0x318f('0x6c')](_0x318f('0x81'),_0x318f('0x6b'))['field']('ci.OrderBY',_0x318f('0x80'))[_0x318f('0x6c')]('\x27'+_0x4f6bc7+'\x27',_0x318f('0x52'))[_0x318f('0x6c')]('\x27'+_0x4f6bc7+'\x27',_0x318f('0x54'))[_0x318f('0x70')](_0x318f('0x82'),'ci')[_0x318f('0x83')](_0x318f('0x7a'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x318f('0x3c')](_0x318f('0x84'),_0x324cad['CmListId'][_0x318f('0x6f')]())[_0x318f('0x3c')](_0x318f('0x85'),_0x260dfa[_0x318f('0x46')]['id'][_0x318f('0x6f')]())['where']('h.createdAt\x20=\x20?',_0x4f6bc7))[_0x318f('0x6f')]();_0x1b6a18['push'](db[_0x318f('0x86')][_0x318f('0x33')](_0x5b5075));_0x410938[_0x318f('0x87')](db[_0x318f('0x86')][_0x318f('0x33')](_0x4ad918));}return BPromise[_0x318f('0x88')](_0x1b6a18);}})['then'](function(){return BPromise['all'](_0x410938);})[_0x318f('0x26')](function(){return _0x20d792;})[_0x318f('0x26')](respondWithResult(_0x1d5a8a,null))[_0x318f('0x44')](handleError(_0x1d5a8a,null));};exports[_0x318f('0x89')]=function(_0x54fd28,_0x160c44,_0x2a8041){return db[_0x318f('0x2f')]['find']({'where':{'id':_0x54fd28[_0x318f('0x46')]['id']}})[_0x318f('0x26')](handleEntityNotFound(_0x160c44,null))['then'](function(_0x456f2c){if(_0x456f2c){return _0x456f2c['removeLists'](_0x54fd28[_0x318f('0x33')][_0x318f('0x65')]);}})[_0x318f('0x26')](function(_0x94a09d){if(_0x94a09d){return db['CmHopper']['destroy']({'where':{'ListId':_0x54fd28['query'][_0x318f('0x65')],'CampaignId':_0x54fd28[_0x318f('0x46')]['id']}})['then'](function(){return _0x94a09d;});}})[_0x318f('0x26')](respondWithStatusCode(_0x160c44,null))[_0x318f('0x44')](handleError(_0x160c44,null));};exports[_0x318f('0x8a')]=function(_0x36e9b3,_0x1195e6,_0x4922db){var _0x42b7c9={};var _0x2e5d7e={};var _0xc47b47;var _0x2b9ef8;return db[_0x318f('0x2f')][_0x318f('0x57')]({'where':{'id':_0x36e9b3[_0x318f('0x46')]['id']}})[_0x318f('0x26')](handleEntityNotFound(_0x1195e6,null))[_0x318f('0x26')](function(_0x34ddca){if(_0x34ddca){_0xc47b47=_0x34ddca;_0x2e5d7e[_0x318f('0x32')]=_['keys'](db['CmList'][_0x318f('0x30')]);_0x2e5d7e['query']=_[_0x318f('0x34')](_0x36e9b3[_0x318f('0x33')]);_0x2e5d7e[_0x318f('0x35')]=_['intersection'](_0x2e5d7e['model'],_0x2e5d7e[_0x318f('0x33')]);_0x42b7c9[_0x318f('0x37')]=_['intersection'](_0x2e5d7e[_0x318f('0x32')],qs[_0x318f('0x38')](_0x36e9b3['query']['fields']));_0x42b7c9['attributes']=_0x42b7c9['attributes'][_0x318f('0x39')]?_0x42b7c9[_0x318f('0x37')]:_0x2e5d7e[_0x318f('0x32')];_0x42b7c9[_0x318f('0x59')]=qs[_0x318f('0x5a')](_0x36e9b3[_0x318f('0x33')][_0x318f('0x5a')]);_0x42b7c9['where']=qs[_0x318f('0x35')](_['pick'](_0x36e9b3[_0x318f('0x33')],_0x2e5d7e[_0x318f('0x35')]));if(_0x36e9b3[_0x318f('0x33')]['filter']){_0x42b7c9[_0x318f('0x3c')]=_['merge'](_0x42b7c9[_0x318f('0x3c')],{'$or':_[_0x318f('0x2e')](_0x42b7c9[_0x318f('0x37')],function(_0x47daf2){var _0x565144={};_0x565144[_0x47daf2]={'$like':'%'+_0x36e9b3['query']['filter']+'%'};return _0x565144;})});}_0x42b7c9=_[_0x318f('0x40')]({},_0x42b7c9,_0x36e9b3[_0x318f('0x41')]);return _0xc47b47[_0x318f('0x8a')](_0x42b7c9);}})['then'](function(_0x428d81){if(_0x428d81){_0x2b9ef8=_0x428d81[_0x318f('0x39')];if(!_0x36e9b3[_0x318f('0x33')]['hasOwnProperty'](_0x318f('0x3b'))){_0x42b7c9[_0x318f('0x1e')]=qs[_0x318f('0x1e')](_0x36e9b3[_0x318f('0x33')][_0x318f('0x1e')]);_0x42b7c9[_0x318f('0x1b')]=qs[_0x318f('0x1b')](_0x36e9b3[_0x318f('0x33')][_0x318f('0x1b')]);}return _0xc47b47[_0x318f('0x8a')](_0x42b7c9);}})['then'](function(_0x4ffa87){if(_0x4ffa87){return _0x4ffa87?{'count':_0x2b9ef8,'rows':_0x4ffa87}:null;}})[_0x318f('0x26')](respondWithResult(_0x1195e6,null))[_0x318f('0x44')](handleError(_0x1195e6,null));};exports[_0x318f('0x8b')]=function(_0x93a593,_0x25b6ea,_0x56e823){var _0x90222a,_0x3705bd;var _0x4d34f5=[];var _0x44ca6e=moment()['format'](_0x318f('0x64'));return db[_0x318f('0x2f')]['find']({'where':{'id':_0x93a593[_0x318f('0x46')]['id']}})[_0x318f('0x26')](handleEntityNotFound(_0x25b6ea,null))[_0x318f('0x26')](function(_0xd2f4b6){if(_0xd2f4b6){_0x3705bd=_0xd2f4b6;return _0xd2f4b6['addBlackLists'](_0x93a593[_0x318f('0x53')][_0x318f('0x65')],_[_0x318f('0x51')](_0x93a593[_0x318f('0x53')],[_0x318f('0x65'),'id'])||{});}return null;})['spread'](function(_0x3e53b8){var _0x3f4c5f;var _0x49686e;_0x90222a=_0x3e53b8||[];var _0xad3eb9=[];if(_0x3e53b8){for(var _0xb15108=0x0;_0xb15108<_0x3e53b8[_0x318f('0x39')];_0xb15108+=0x1){var _0x11fb5f=_0x3e53b8[_0xb15108][_0x318f('0x27')]({'plain':!![]});_0x3f4c5f=squel[_0x318f('0x78')]()[_0x318f('0x79')](_0x318f('0x8c'))[_0x318f('0x68')]([_0x318f('0x6b'),_0x318f('0x69'),'ListId',_0x318f('0x5b'),_0x318f('0x52'),_0x318f('0x54')],squel[_0x318f('0x75')]()[_0x318f('0x6c')](_0x318f('0x6b'),_0x318f('0x6b'))[_0x318f('0x6c')]('id',_0x318f('0x69'))['field'](_0x11fb5f[_0x318f('0x6e')][_0x318f('0x6f')](),_0x318f('0x6a'))[_0x318f('0x6c')](_0x93a593[_0x318f('0x46')]['id']['toString'](),_0x318f('0x5b'))[_0x318f('0x6c')](_0x318f('0x6d'),_0x318f('0x52'))['field']('NOW()',_0x318f('0x54'))['from'](_0x318f('0x7c'))['where']('deletedAt\x20IS\x20NULL')[_0x318f('0x3c')](_0x318f('0x71'),_0x11fb5f[_0x318f('0x6e')][_0x318f('0x6f')]())[_0x318f('0x3c')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0xad3eb9[_0x318f('0x87')](db[_0x318f('0x86')][_0x318f('0x33')](_0x3f4c5f));}return BPromise['all'](_0xad3eb9);}})[_0x318f('0x26')](function(){return _0x90222a;})[_0x318f('0x26')](respondWithResult(_0x25b6ea,null))[_0x318f('0x44')](handleError(_0x25b6ea,null));};exports[_0x318f('0x8d')]=function(_0x2e37b2,_0x21b226,_0xde31a5){return db[_0x318f('0x2f')][_0x318f('0x48')]({'where':{'id':_0x2e37b2['params']['id']}})[_0x318f('0x26')](handleEntityNotFound(_0x21b226,null))[_0x318f('0x26')](function(_0x3577f1){if(_0x3577f1){return _0x3577f1[_0x318f('0x8d')](_0x2e37b2['query'][_0x318f('0x65')]);}})[_0x318f('0x26')](function(_0x1e2891){if(_0x1e2891){return db[_0x318f('0x62')][_0x318f('0x25')]({'where':{'ListId':_0x2e37b2['query'][_0x318f('0x65')],'CampaignId':_0x2e37b2['params']['id']}})[_0x318f('0x26')](function(){return _0x1e2891;});}})[_0x318f('0x26')](respondWithStatusCode(_0x21b226,null))['catch'](handleError(_0x21b226,null));}; \ No newline at end of file +var _0xfd6f=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','get','IvrCampaigns','destroy','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','clone','omit','createdAt','body','updatedAt','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','CmHopper','CampaignId','CmHopperHistory','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','field','phone','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','into','select','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x33aefe,_0x371ccd){var _0x471d19=function(_0x566c26){while(--_0x566c26){_0x33aefe['push'](_0x33aefe['shift']());}};_0x471d19(++_0x371ccd);}(_0xfd6f,0x19d));var _0xffd6=function(_0x1a7698,_0x40398f){_0x1a7698=_0x1a7698-0x0;var _0x22bda9=_0xfd6f[_0x1a7698];return _0x22bda9;};'use strict';var emlformat=require(_0xffd6('0x0'));var rimraf=require(_0xffd6('0x1'));var zipdir=require(_0xffd6('0x2'));var jsonpatch=require(_0xffd6('0x3'));var rp=require(_0xffd6('0x4'));var moment=require('moment');var BPromise=require(_0xffd6('0x5'));var Mustache=require(_0xffd6('0x6'));var util=require(_0xffd6('0x7'));var path=require(_0xffd6('0x8'));var sox=require('sox');var csv=require(_0xffd6('0x9'));var ejs=require(_0xffd6('0xa'));var fs=require('fs');var fs_extra=require(_0xffd6('0xb'));var _=require(_0xffd6('0xc'));var squel=require('squel');var crypto=require(_0xffd6('0xd'));var jsforce=require(_0xffd6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xffd6('0xf'));var Papa=require(_0xffd6('0x10'));var Redis=require(_0xffd6('0x11'));var authService=require(_0xffd6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xffd6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xffd6('0x14'));var utils=require(_0xffd6('0x15'));var config=require(_0xffd6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xffd6('0x17'))['db'];function respondWithStatusCode(_0x8c86c6,_0x59d2d8){_0x59d2d8=_0x59d2d8||0xcc;return function(_0x12cbe9){if(_0x12cbe9){return _0x8c86c6[_0xffd6('0x18')](_0x59d2d8);}return _0x8c86c6[_0xffd6('0x19')](_0x59d2d8)[_0xffd6('0x1a')]();};}function respondWithResult(_0x5f15f6,_0x5f4765){_0x5f4765=_0x5f4765||0xc8;return function(_0x26ef4){if(_0x26ef4){return _0x5f15f6[_0xffd6('0x19')](_0x5f4765)[_0xffd6('0x1b')](_0x26ef4);}};}function respondWithFilteredResult(_0x575120,_0x17114f){return function(_0x131661){if(_0x131661){var _0x57e34e=typeof _0x17114f[_0xffd6('0x1c')]==='undefined'&&typeof _0x17114f[_0xffd6('0x1d')]===_0xffd6('0x1e');var _0x2271c4=_0x131661[_0xffd6('0x1f')];var _0x1c96dc=_0x57e34e?0x0:_0x17114f['offset'];var _0xe2f572=_0x57e34e?_0x131661[_0xffd6('0x1f')]:_0x17114f[_0xffd6('0x1c')]+_0x17114f[_0xffd6('0x1d')];var _0x56dd04;if(_0xe2f572>=_0x2271c4){_0xe2f572=_0x2271c4;_0x56dd04=0xc8;}else{_0x56dd04=0xce;}_0x575120['status'](_0x56dd04);return _0x575120[_0xffd6('0x20')]('Content-Range',_0x1c96dc+'-'+_0xe2f572+'/'+_0x2271c4)['json'](_0x131661);}return null;};}function patchUpdates(_0x453e4e){return function(_0x1a7102){try{jsonpatch[_0xffd6('0x21')](_0x1a7102,_0x453e4e,!![]);}catch(_0x352974){return BPromise[_0xffd6('0x22')](_0x352974);}return _0x1a7102[_0xffd6('0x23')]();};}function saveUpdates(_0x528a4d,_0x44e5f5){return function(_0x26daf2){if(_0x26daf2){return _0x26daf2['update'](_0x528a4d)[_0xffd6('0x24')](function(_0x49f7d5){return _0x49f7d5;});}return null;};}function removeEntity(_0x270704,_0x207f18){return function(_0x18fd0f){if(_0x18fd0f){return _0x18fd0f['destroy']()['then'](function(){var _0x4b75c6=_0x18fd0f[_0xffd6('0x25')]({'plain':!![]});var _0x16f8bf=_0xffd6('0x26');return db['UserProfileResource'][_0xffd6('0x27')]({'where':{'type':_0x16f8bf,'resourceId':_0x4b75c6['id']}})[_0xffd6('0x24')](function(){return _0x18fd0f;});})[_0xffd6('0x24')](function(){_0x270704[_0xffd6('0x19')](0xcc)[_0xffd6('0x1a')]();});}};}function handleEntityNotFound(_0x499eae,_0x129b9f){return function(_0x216009){if(!_0x216009){_0x499eae[_0xffd6('0x18')](0x194);}return _0x216009;};}function handleError(_0xb11654,_0x1f6ce7){_0x1f6ce7=_0x1f6ce7||0x1f4;return function(_0x434ee0){logger[_0xffd6('0x28')](_0x434ee0[_0xffd6('0x29')]);if(_0x434ee0[_0xffd6('0x2a')]){delete _0x434ee0[_0xffd6('0x2a')];}_0xb11654[_0xffd6('0x19')](_0x1f6ce7)['send'](_0x434ee0);};}exports[_0xffd6('0x2b')]=function(_0x3eb1b3,_0x261266){var _0x35328a={},_0x428ae9={},_0x101291={'count':0x0,'rows':[]};var _0x4b2d96=_[_0xffd6('0x2c')](db[_0xffd6('0x2d')][_0xffd6('0x2e')],function(_0x38998e){return{'name':_0x38998e[_0xffd6('0x2f')],'type':_0x38998e[_0xffd6('0x30')][_0xffd6('0x31')]};});_0x428ae9[_0xffd6('0x32')]=_[_0xffd6('0x2c')](_0x4b2d96,_0xffd6('0x2a'));_0x428ae9[_0xffd6('0x33')]=_[_0xffd6('0x34')](_0x3eb1b3['query']);_0x428ae9[_0xffd6('0x35')]=_[_0xffd6('0x36')](_0x428ae9[_0xffd6('0x32')],_0x428ae9['query']);_0x35328a['attributes']=_['intersection'](_0x428ae9[_0xffd6('0x32')],qs[_0xffd6('0x37')](_0x3eb1b3[_0xffd6('0x33')][_0xffd6('0x37')]));_0x35328a[_0xffd6('0x38')]=_0x35328a[_0xffd6('0x38')][_0xffd6('0x39')]?_0x35328a['attributes']:_0x428ae9[_0xffd6('0x32')];if(!_0x3eb1b3['query'][_0xffd6('0x3a')](_0xffd6('0x3b'))){_0x35328a[_0xffd6('0x1d')]=qs['limit'](_0x3eb1b3[_0xffd6('0x33')][_0xffd6('0x1d')]);_0x35328a['offset']=qs[_0xffd6('0x1c')](_0x3eb1b3['query'][_0xffd6('0x1c')]);}_0x35328a[_0xffd6('0x3c')]=qs[_0xffd6('0x3d')](_0x3eb1b3[_0xffd6('0x33')][_0xffd6('0x3d')]);_0x35328a[_0xffd6('0x3e')]=qs[_0xffd6('0x35')](_[_0xffd6('0x3f')](_0x3eb1b3[_0xffd6('0x33')],_0x428ae9['filters']),_0x4b2d96);if(_0x3eb1b3[_0xffd6('0x33')][_0xffd6('0x40')]){_0x35328a[_0xffd6('0x3e')]=_[_0xffd6('0x41')](_0x35328a[_0xffd6('0x3e')],{'$or':_[_0xffd6('0x2c')](_0x4b2d96,function(_0x90c982){if(_0x90c982[_0xffd6('0x30')]!==_0xffd6('0x42')){var _0x691334={};_0x691334[_0x90c982[_0xffd6('0x2a')]]={'$like':'%'+_0x3eb1b3['query']['filter']+'%'};return _0x691334;}})});}_0x35328a=_[_0xffd6('0x41')]({},_0x35328a,_0x3eb1b3[_0xffd6('0x43')]);var _0x4c8d26={'where':_0x35328a[_0xffd6('0x3e')]};return db[_0xffd6('0x2d')][_0xffd6('0x1f')](_0x4c8d26)[_0xffd6('0x24')](function(_0xef60c0){_0x101291[_0xffd6('0x1f')]=_0xef60c0;if(_0x3eb1b3[_0xffd6('0x33')][_0xffd6('0x44')]){_0x35328a[_0xffd6('0x45')]=[{'all':!![]}];}return db[_0xffd6('0x2d')][_0xffd6('0x46')](_0x35328a);})[_0xffd6('0x24')](function(_0x1b680a){_0x101291[_0xffd6('0x47')]=_0x1b680a;return _0x101291;})[_0xffd6('0x24')](respondWithFilteredResult(_0x261266,_0x35328a))[_0xffd6('0x48')](handleError(_0x261266,null));};exports['show']=function(_0x50b2cf,_0x5745b3){var _0x1f7205={'raw':![],'where':{'id':_0x50b2cf[_0xffd6('0x49')]['id']}},_0x5629ed={};_0x5629ed['model']=_['keys'](db['Campaign']['rawAttributes']);_0x5629ed[_0xffd6('0x33')]=_[_0xffd6('0x34')](_0x50b2cf[_0xffd6('0x33')]);_0x5629ed[_0xffd6('0x35')]=_[_0xffd6('0x36')](_0x5629ed[_0xffd6('0x32')],_0x5629ed[_0xffd6('0x33')]);_0x1f7205[_0xffd6('0x38')]=_[_0xffd6('0x36')](_0x5629ed[_0xffd6('0x32')],qs[_0xffd6('0x37')](_0x50b2cf[_0xffd6('0x33')][_0xffd6('0x37')]));_0x1f7205[_0xffd6('0x38')]=_0x1f7205['attributes'][_0xffd6('0x39')]?_0x1f7205[_0xffd6('0x38')]:_0x5629ed[_0xffd6('0x32')];if(_0x50b2cf[_0xffd6('0x33')][_0xffd6('0x44')]){_0x1f7205['include']=[{'all':!![]}];}_0x1f7205=_[_0xffd6('0x41')]({},_0x1f7205,_0x50b2cf[_0xffd6('0x43')]);return db['Campaign'][_0xffd6('0x4a')](_0x1f7205)[_0xffd6('0x24')](handleEntityNotFound(_0x5745b3,null))[_0xffd6('0x24')](respondWithResult(_0x5745b3,null))[_0xffd6('0x48')](handleError(_0x5745b3,null));};exports[_0xffd6('0x4b')]=function(_0x2cc194,_0x17e609){return db[_0xffd6('0x2d')][_0xffd6('0x4b')](_0x2cc194['body'],{})[_0xffd6('0x24')](function(_0x2fd1bb){var _0x5811d4=_0x2cc194[_0xffd6('0x4c')][_0xffd6('0x25')]({'plain':!![]});if(!_0x5811d4)throw new Error(_0xffd6('0x4d'));if(_0x5811d4['role']===_0xffd6('0x4c')){var _0x59f9e9=_0x2fd1bb['get']({'plain':!![]});var _0x5ebed3=_0xffd6('0x26');return db['UserProfileSection'][_0xffd6('0x4a')]({'where':{'name':_0x5ebed3,'userProfileId':_0x5811d4[_0xffd6('0x4e')]},'raw':!![]})[_0xffd6('0x24')](function(_0x4c05fa){if(_0x4c05fa&&_0x4c05fa[_0xffd6('0x4f')]===0x0){return db['UserProfileResource'][_0xffd6('0x4b')]({'name':_0x59f9e9[_0xffd6('0x2a')],'resourceId':_0x59f9e9['id'],'type':_0x4c05fa[_0xffd6('0x2a')],'sectionId':_0x4c05fa['id']},{})[_0xffd6('0x24')](function(){return _0x2fd1bb;});}else{return _0x2fd1bb;}})[_0xffd6('0x48')](function(_0x2a27d9){logger[_0xffd6('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a27d9);throw _0x2a27d9;});}return _0x2fd1bb;})[_0xffd6('0x24')](respondWithResult(_0x17e609,0xc9))[_0xffd6('0x48')](handleError(_0x17e609,null));};exports[_0xffd6('0x50')]=function(_0xa788ab,_0x459cbe){var _0x2c3544={'where':{'id':_0xa788ab['params']['id']}},_0x18e097={};_0x18e097[_0xffd6('0x32')]=_[_0xffd6('0x34')](db[_0xffd6('0x2d')][_0xffd6('0x2e')]);_0x2c3544['attributes']=_[_0xffd6('0x36')](_0x18e097[_0xffd6('0x32')],qs[_0xffd6('0x37')](_0xa788ab[_0xffd6('0x33')][_0xffd6('0x37')]));_0x2c3544[_0xffd6('0x38')]=_0x2c3544[_0xffd6('0x38')][_0xffd6('0x39')]?_0x2c3544[_0xffd6('0x38')]:_0x18e097['model'];if(_0xa788ab[_0xffd6('0x33')][_0xffd6('0x44')]){_0x2c3544[_0xffd6('0x45')]=[{'all':!![]}];}_0x2c3544=_[_0xffd6('0x41')]({},_0x2c3544,_0xa788ab[_0xffd6('0x43')]);return db[_0xffd6('0x2d')][_0xffd6('0x4a')](_0x2c3544)['then'](handleEntityNotFound(_0x459cbe,null))[_0xffd6('0x24')](function(_0x3c1f8c){if(_0x3c1f8c){var _0xa65d14=_0x3c1f8c[_0xffd6('0x25')]({'plain':!![]});_0xa65d14=qs[_0xffd6('0x51')](_0xa65d14,['id',_0xffd6('0x52'),'updatedAt']);_0xa788ab[_0xffd6('0x53')]=_[_0xffd6('0x51')](_0xa788ab[_0xffd6('0x53')],['id',_0xffd6('0x52'),_0xffd6('0x54')]);return db[_0xffd6('0x2d')][_0xffd6('0x4b')](_[_0xffd6('0x41')](_0xa65d14,_0xa788ab[_0xffd6('0x53')]),{'include':_0xa788ab[_0xffd6('0x33')][_0xffd6('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x461771){var _0x490439=_0xa788ab['user'][_0xffd6('0x25')]({'plain':!![]});if(!_0x490439)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x490439[_0xffd6('0x55')]==='user'){var _0x783db4=_0x461771['get']({'plain':!![]});var _0xe483d2='IvrCampaigns';return db[_0xffd6('0x56')][_0xffd6('0x4a')]({'where':{'name':_0xe483d2,'userProfileId':_0x490439[_0xffd6('0x4e')]},'raw':!![]})[_0xffd6('0x24')](function(_0x4f0db0){if(_0x4f0db0&&_0x4f0db0[_0xffd6('0x4f')]===0x0){return db[_0xffd6('0x57')]['create']({'name':_0x783db4[_0xffd6('0x2a')],'resourceId':_0x783db4['id'],'type':_0x4f0db0[_0xffd6('0x2a')],'sectionId':_0x4f0db0['id']},{})[_0xffd6('0x24')](function(){return _0x461771;});}else{return _0x461771;}})['catch'](function(_0x4eba62){logger['error'](_0xffd6('0x58'),_0x4eba62);throw _0x4eba62;});}return _0x461771;});}})['then'](respondWithResult(_0x459cbe,0xc9))['catch'](handleError(_0x459cbe,null));};exports[_0xffd6('0x59')]=function(_0x8d5a9,_0x462e1a){if(_0x8d5a9[_0xffd6('0x53')]['id']){delete _0x8d5a9['body']['id'];}return db[_0xffd6('0x2d')][_0xffd6('0x4a')]({'where':{'id':_0x8d5a9['params']['id']}})[_0xffd6('0x24')](handleEntityNotFound(_0x462e1a,null))[_0xffd6('0x24')](saveUpdates(_0x8d5a9['body'],null))[_0xffd6('0x24')](respondWithResult(_0x462e1a,null))[_0xffd6('0x48')](handleError(_0x462e1a,null));};exports[_0xffd6('0x27')]=function(_0x218389,_0x4494c5){return db[_0xffd6('0x2d')]['find']({'where':{'id':_0x218389[_0xffd6('0x49')]['id']}})['then'](handleEntityNotFound(_0x4494c5,null))[_0xffd6('0x24')](removeEntity(_0x4494c5,null))[_0xffd6('0x48')](handleError(_0x4494c5,null));};exports['getHoppers']=function(_0x4358bf,_0x3d2de9,_0x310256){var _0x3695bd={'raw':!![],'where':{}};var _0x1a8cf1={};var _0x3e9b21={'count':0x0,'rows':[]};return db[_0xffd6('0x2d')]['findOne']({'where':{'id':_0x4358bf['params']['id']}})['then'](handleEntityNotFound(_0x3d2de9,null))[_0xffd6('0x24')](function(_0x19f954){if(_0x19f954){_0x1a8cf1[_0xffd6('0x32')]=_[_0xffd6('0x34')](db[_0xffd6('0x5a')][_0xffd6('0x2e')]);_0x1a8cf1[_0xffd6('0x33')]=_[_0xffd6('0x34')](_0x4358bf[_0xffd6('0x33')]);_0x1a8cf1[_0xffd6('0x35')]=_[_0xffd6('0x36')](_0x1a8cf1[_0xffd6('0x32')],_0x1a8cf1[_0xffd6('0x33')]);_0x3695bd[_0xffd6('0x38')]=_[_0xffd6('0x36')](_0x1a8cf1[_0xffd6('0x32')],qs[_0xffd6('0x37')](_0x4358bf[_0xffd6('0x33')][_0xffd6('0x37')]));_0x3695bd['attributes']=_0x3695bd[_0xffd6('0x38')][_0xffd6('0x39')]?_0x3695bd['attributes']:_0x1a8cf1[_0xffd6('0x32')];if(!_0x4358bf[_0xffd6('0x33')]['hasOwnProperty'](_0xffd6('0x3b'))){_0x3695bd[_0xffd6('0x1d')]=qs['limit'](_0x4358bf[_0xffd6('0x33')]['limit']);_0x3695bd[_0xffd6('0x1c')]=qs[_0xffd6('0x1c')](_0x4358bf[_0xffd6('0x33')][_0xffd6('0x1c')]);}_0x3695bd[_0xffd6('0x3c')]=qs[_0xffd6('0x3d')](_0x4358bf['query'][_0xffd6('0x3d')]);_0x3695bd[_0xffd6('0x3e')]=qs[_0xffd6('0x35')](_['pick'](_0x4358bf['query'],_0x1a8cf1[_0xffd6('0x35')]));_0x3695bd[_0xffd6('0x3e')][_0xffd6('0x5b')]=_0x19f954['id'];if(_0x4358bf[_0xffd6('0x33')]['filter']){_0x3695bd[_0xffd6('0x3e')]=_[_0xffd6('0x41')](_0x3695bd[_0xffd6('0x3e')],{'$or':_[_0xffd6('0x2c')](_0x3695bd[_0xffd6('0x38')],function(_0x121ec5){var _0x42758e={};_0x42758e[_0x121ec5]={'$like':'%'+_0x4358bf[_0xffd6('0x33')][_0xffd6('0x40')]+'%'};return _0x42758e;})});}_0x3695bd=_[_0xffd6('0x41')]({},_0x3695bd,_0x4358bf[_0xffd6('0x43')]);return db['CmHopper'][_0xffd6('0x1f')]({'where':_0x3695bd[_0xffd6('0x3e')]})[_0xffd6('0x24')](function(_0x1287d1){_0x3e9b21['count']=_0x1287d1;if(_0x4358bf['query'][_0xffd6('0x44')]){_0x3695bd[_0xffd6('0x45')]=[{'all':!![]}];}return db['CmHopper'][_0xffd6('0x46')](_0x3695bd);})[_0xffd6('0x24')](function(_0x2d094a){_0x3e9b21[_0xffd6('0x47')]=_0x2d094a;return _0x3e9b21;});}})[_0xffd6('0x24')](respondWithFilteredResult(_0x3d2de9,_0x3695bd))[_0xffd6('0x48')](handleError(_0x3d2de9,null));};exports['getHopperHistories']=function(_0x3e30bf,_0x22e3cf,_0x44b83b){var _0xf85516={'raw':!![],'where':{}};var _0xda9ba7={};var _0x1ecdac={'count':0x0,'rows':[]};return db[_0xffd6('0x2d')]['findOne']({'where':{'id':_0x3e30bf[_0xffd6('0x49')]['id']}})[_0xffd6('0x24')](handleEntityNotFound(_0x22e3cf,null))[_0xffd6('0x24')](function(_0x4856e5){if(_0x4856e5){_0xda9ba7[_0xffd6('0x32')]=_[_0xffd6('0x34')](db[_0xffd6('0x5c')]['rawAttributes']);_0xda9ba7[_0xffd6('0x33')]=_['keys'](_0x3e30bf[_0xffd6('0x33')]);_0xda9ba7[_0xffd6('0x35')]=_[_0xffd6('0x36')](_0xda9ba7[_0xffd6('0x32')],_0xda9ba7[_0xffd6('0x33')]);_0xf85516[_0xffd6('0x38')]=_[_0xffd6('0x36')](_0xda9ba7['model'],qs[_0xffd6('0x37')](_0x3e30bf[_0xffd6('0x33')][_0xffd6('0x37')]));_0xf85516[_0xffd6('0x38')]=_0xf85516[_0xffd6('0x38')][_0xffd6('0x39')]?_0xf85516[_0xffd6('0x38')]:_0xda9ba7[_0xffd6('0x32')];if(!_0x3e30bf[_0xffd6('0x33')][_0xffd6('0x3a')](_0xffd6('0x3b'))){_0xf85516['limit']=qs[_0xffd6('0x1d')](_0x3e30bf[_0xffd6('0x33')][_0xffd6('0x1d')]);_0xf85516[_0xffd6('0x1c')]=qs[_0xffd6('0x1c')](_0x3e30bf['query'][_0xffd6('0x1c')]);}_0xf85516[_0xffd6('0x3c')]=qs[_0xffd6('0x3d')](_0x3e30bf[_0xffd6('0x33')][_0xffd6('0x3d')]);_0xf85516['where']=qs[_0xffd6('0x35')](_[_0xffd6('0x3f')](_0x3e30bf['query'],_0xda9ba7[_0xffd6('0x35')]));_0xf85516[_0xffd6('0x3e')][_0xffd6('0x5b')]=_0x4856e5['id'];if(_0x3e30bf['query'][_0xffd6('0x40')]){_0xf85516[_0xffd6('0x3e')]=_[_0xffd6('0x41')](_0xf85516['where'],{'$or':_[_0xffd6('0x2c')](_0xf85516['attributes'],function(_0x29a129){var _0x4f7459={};_0x4f7459[_0x29a129]={'$like':'%'+_0x3e30bf[_0xffd6('0x33')]['filter']+'%'};return _0x4f7459;})});}_0xf85516=_[_0xffd6('0x41')]({},_0xf85516,_0x3e30bf['options']);return db['CmHopperHistory']['count']({'where':_0xf85516[_0xffd6('0x3e')]})[_0xffd6('0x24')](function(_0x4f00b5){_0x1ecdac['count']=_0x4f00b5;if(_0x3e30bf[_0xffd6('0x33')][_0xffd6('0x44')]){_0xf85516[_0xffd6('0x45')]=[{'all':!![]}];}return db[_0xffd6('0x5c')][_0xffd6('0x46')](_0xf85516);})['then'](function(_0x11d206){_0x1ecdac['rows']=_0x11d206;return _0x1ecdac;});}})['then'](respondWithFilteredResult(_0x22e3cf,_0xf85516))[_0xffd6('0x48')](handleError(_0x22e3cf,null));};exports['getHopperFinals']=function(_0x4e635e,_0x59908b,_0x5d656b){var _0x323439={'raw':!![],'where':{}};var _0x206bab={};var _0x5bddd1={'count':0x0,'rows':[]};return db[_0xffd6('0x2d')][_0xffd6('0x5d')]({'where':{'id':_0x4e635e[_0xffd6('0x49')]['id']}})[_0xffd6('0x24')](handleEntityNotFound(_0x59908b,null))[_0xffd6('0x24')](function(_0x501419){if(_0x501419){_0x206bab[_0xffd6('0x32')]=_[_0xffd6('0x34')](db[_0xffd6('0x5e')][_0xffd6('0x2e')]);_0x206bab['query']=_[_0xffd6('0x34')](_0x4e635e[_0xffd6('0x33')]);_0x206bab[_0xffd6('0x35')]=_[_0xffd6('0x36')](_0x206bab[_0xffd6('0x32')],_0x206bab[_0xffd6('0x33')]);_0x323439['attributes']=_[_0xffd6('0x36')](_0x206bab[_0xffd6('0x32')],qs['fields'](_0x4e635e[_0xffd6('0x33')]['fields']));_0x323439[_0xffd6('0x38')]=_0x323439['attributes'][_0xffd6('0x39')]?_0x323439[_0xffd6('0x38')]:_0x206bab['model'];if(!_0x4e635e[_0xffd6('0x33')]['hasOwnProperty'](_0xffd6('0x3b'))){_0x323439['limit']=qs[_0xffd6('0x1d')](_0x4e635e[_0xffd6('0x33')][_0xffd6('0x1d')]);_0x323439[_0xffd6('0x1c')]=qs[_0xffd6('0x1c')](_0x4e635e['query'][_0xffd6('0x1c')]);}_0x323439[_0xffd6('0x3c')]=qs[_0xffd6('0x3d')](_0x4e635e[_0xffd6('0x33')][_0xffd6('0x3d')]);_0x323439[_0xffd6('0x3e')]=qs[_0xffd6('0x35')](_[_0xffd6('0x3f')](_0x4e635e[_0xffd6('0x33')],_0x206bab[_0xffd6('0x35')]));_0x323439['where']['CampaignId']=_0x501419['id'];if(_0x4e635e[_0xffd6('0x33')][_0xffd6('0x40')]){_0x323439[_0xffd6('0x3e')]=_[_0xffd6('0x41')](_0x323439[_0xffd6('0x3e')],{'$or':_[_0xffd6('0x2c')](_0x323439['attributes'],function(_0x42ea19){var _0x5dfcc1={};_0x5dfcc1[_0x42ea19]={'$like':'%'+_0x4e635e[_0xffd6('0x33')][_0xffd6('0x40')]+'%'};return _0x5dfcc1;})});}_0x323439=_['merge']({},_0x323439,_0x4e635e['options']);return db[_0xffd6('0x5e')][_0xffd6('0x1f')]({'where':_0x323439[_0xffd6('0x3e')]})[_0xffd6('0x24')](function(_0x16ba74){_0x5bddd1[_0xffd6('0x1f')]=_0x16ba74;if(_0x4e635e[_0xffd6('0x33')][_0xffd6('0x44')]){_0x323439[_0xffd6('0x45')]=[{'all':!![]}];}return db[_0xffd6('0x5e')][_0xffd6('0x46')](_0x323439);})[_0xffd6('0x24')](function(_0x170740){_0x5bddd1[_0xffd6('0x47')]=_0x170740;return _0x5bddd1;});}})['then'](respondWithFilteredResult(_0x59908b,_0x323439))[_0xffd6('0x48')](handleError(_0x59908b,null));};exports[_0xffd6('0x5f')]=function(_0x341976,_0x2e98b0,_0x4bc31b){var _0x35f666={'raw':!![],'where':{}};var _0x277e4e={};var _0x15f752={'count':0x0,'rows':[]};return db[_0xffd6('0x2d')]['findOne']({'where':{'id':_0x341976[_0xffd6('0x49')]['id']}})[_0xffd6('0x24')](handleEntityNotFound(_0x2e98b0,null))[_0xffd6('0x24')](function(_0x2db262){if(_0x2db262){_0x277e4e[_0xffd6('0x32')]=_[_0xffd6('0x34')](db[_0xffd6('0x60')]['rawAttributes']);_0x277e4e[_0xffd6('0x33')]=_[_0xffd6('0x34')](_0x341976[_0xffd6('0x33')]);_0x277e4e[_0xffd6('0x35')]=_[_0xffd6('0x36')](_0x277e4e[_0xffd6('0x32')],_0x277e4e[_0xffd6('0x33')]);_0x35f666[_0xffd6('0x38')]=_[_0xffd6('0x36')](_0x277e4e['model'],qs[_0xffd6('0x37')](_0x341976['query'][_0xffd6('0x37')]));_0x35f666[_0xffd6('0x38')]=_0x35f666['attributes'][_0xffd6('0x39')]?_0x35f666['attributes']:_0x277e4e[_0xffd6('0x32')];if(!_0x341976[_0xffd6('0x33')][_0xffd6('0x3a')](_0xffd6('0x3b'))){_0x35f666[_0xffd6('0x1d')]=qs[_0xffd6('0x1d')](_0x341976['query']['limit']);_0x35f666[_0xffd6('0x1c')]=qs[_0xffd6('0x1c')](_0x341976[_0xffd6('0x33')]['offset']);}_0x35f666[_0xffd6('0x3c')]=qs[_0xffd6('0x3d')](_0x341976[_0xffd6('0x33')][_0xffd6('0x3d')]);_0x35f666[_0xffd6('0x3e')]=qs[_0xffd6('0x35')](_['pick'](_0x341976[_0xffd6('0x33')],_0x277e4e['filters']));_0x35f666[_0xffd6('0x3e')][_0xffd6('0x5b')]=_0x2db262['id'];if(_0x341976[_0xffd6('0x33')][_0xffd6('0x40')]){_0x35f666[_0xffd6('0x3e')]=_['merge'](_0x35f666[_0xffd6('0x3e')],{'$or':_[_0xffd6('0x2c')](_0x35f666[_0xffd6('0x38')],function(_0x57c1be){var _0x4d0ec5={};_0x4d0ec5[_0x57c1be]={'$like':'%'+_0x341976[_0xffd6('0x33')]['filter']+'%'};return _0x4d0ec5;})});}_0x35f666=_['merge']({},_0x35f666,_0x341976[_0xffd6('0x43')]);return db['CmHopperBlack'][_0xffd6('0x1f')]({'where':_0x35f666[_0xffd6('0x3e')]})['then'](function(_0x8bf101){_0x15f752['count']=_0x8bf101;if(_0x341976['query'][_0xffd6('0x44')]){_0x35f666['include']=[{'all':!![]}];}return db[_0xffd6('0x60')][_0xffd6('0x46')](_0x35f666);})['then'](function(_0x289d38){_0x15f752[_0xffd6('0x47')]=_0x289d38;return _0x15f752;});}})[_0xffd6('0x24')](respondWithFilteredResult(_0x2e98b0,_0x35f666))[_0xffd6('0x48')](handleError(_0x2e98b0,null));};exports[_0xffd6('0x61')]=function(_0x23a5d1,_0x391f5d,_0x2e3ce2){var _0x2d6564={};var _0x3b403c={};var _0x957307;var _0x3b02d5;return db[_0xffd6('0x2d')][_0xffd6('0x5d')]({'where':{'id':_0x23a5d1[_0xffd6('0x49')]['id']}})[_0xffd6('0x24')](handleEntityNotFound(_0x391f5d,null))[_0xffd6('0x24')](function(_0x2ed64c){if(_0x2ed64c){_0x957307=_0x2ed64c;_0x3b403c[_0xffd6('0x32')]=_['keys'](db[_0xffd6('0x62')][_0xffd6('0x2e')]);_0x3b403c[_0xffd6('0x33')]=_[_0xffd6('0x34')](_0x23a5d1[_0xffd6('0x33')]);_0x3b403c[_0xffd6('0x35')]=_[_0xffd6('0x36')](_0x3b403c['model'],_0x3b403c[_0xffd6('0x33')]);_0x2d6564[_0xffd6('0x38')]=_[_0xffd6('0x36')](_0x3b403c[_0xffd6('0x32')],qs['fields'](_0x23a5d1[_0xffd6('0x33')][_0xffd6('0x37')]));_0x2d6564[_0xffd6('0x38')]=_0x2d6564[_0xffd6('0x38')][_0xffd6('0x39')]?_0x2d6564['attributes']:_0x3b403c[_0xffd6('0x32')];_0x2d6564[_0xffd6('0x3c')]=qs['sort'](_0x23a5d1[_0xffd6('0x33')]['sort']);_0x2d6564['where']=qs[_0xffd6('0x35')](_[_0xffd6('0x3f')](_0x23a5d1[_0xffd6('0x33')],_0x3b403c['filters']));if(_0x23a5d1[_0xffd6('0x33')][_0xffd6('0x40')]){_0x2d6564[_0xffd6('0x3e')]=_[_0xffd6('0x41')](_0x2d6564[_0xffd6('0x3e')],{'$or':_[_0xffd6('0x2c')](_0x2d6564[_0xffd6('0x38')],function(_0x58c5c9){var _0x440ee9={};_0x440ee9[_0x58c5c9]={'$like':'%'+_0x23a5d1['query']['filter']+'%'};return _0x440ee9;})});}_0x2d6564=_[_0xffd6('0x41')]({},_0x2d6564,_0x23a5d1[_0xffd6('0x43')]);return _0x957307[_0xffd6('0x61')](_0x2d6564);}})[_0xffd6('0x24')](function(_0x667380){if(_0x667380){_0x3b02d5=_0x667380[_0xffd6('0x39')];if(!_0x23a5d1[_0xffd6('0x33')]['hasOwnProperty'](_0xffd6('0x3b'))){_0x2d6564[_0xffd6('0x1d')]=qs[_0xffd6('0x1d')](_0x23a5d1[_0xffd6('0x33')][_0xffd6('0x1d')]);_0x2d6564[_0xffd6('0x1c')]=qs[_0xffd6('0x1c')](_0x23a5d1[_0xffd6('0x33')][_0xffd6('0x1c')]);}return _0x957307[_0xffd6('0x61')](_0x2d6564);}})[_0xffd6('0x24')](function(_0x18a0a2){if(_0x18a0a2){return _0x18a0a2?{'count':_0x3b02d5,'rows':_0x18a0a2}:null;}})[_0xffd6('0x24')](respondWithResult(_0x391f5d,null))[_0xffd6('0x48')](handleError(_0x391f5d,null));};exports[_0xffd6('0x63')]=function(_0x3fd72b,_0x7911a9,_0x689a6d){var _0x18a397,_0x411204;var _0x48416b=[];var _0x42e1e9=moment()['format'](_0xffd6('0x64'));return db['Campaign'][_0xffd6('0x4a')]({'where':{'id':_0x3fd72b[_0xffd6('0x49')]['id']}})['then'](handleEntityNotFound(_0x7911a9,null))[_0xffd6('0x24')](function(_0x5a5999){if(_0x5a5999){_0x411204=_0x5a5999;return _0x5a5999['addLists'](_0x3fd72b[_0xffd6('0x53')][_0xffd6('0x65')],_['omit'](_0x3fd72b[_0xffd6('0x53')],[_0xffd6('0x65'),'id'])||{});}return null;})[_0xffd6('0x66')](function(_0x49407e){var _0x7ca3c2;var _0x42192b;_0x18a397=_0x49407e||[];var _0x192f74=[];if(_0x49407e){for(var _0x38da5f=0x0;_0x38da5f<_0x49407e['length'];_0x38da5f+=0x1){var _0x2c8640=_0x49407e[_0x38da5f][_0xffd6('0x25')]({'plain':!![]});_0x411204['dialCheckDuplicateType']=_0x3fd72b[_0xffd6('0x53')][_0xffd6('0x67')]?_0x3fd72b[_0xffd6('0x53')][_0xffd6('0x67')]:_0x411204[_0xffd6('0x67')];switch(_0x411204['dialCheckDuplicateType']){case _0xffd6('0x68'):_0x7ca3c2=squel[_0xffd6('0x69')]()['into'](_0xffd6('0x6a'))[_0xffd6('0x6b')](['phone',_0xffd6('0x6c'),_0xffd6('0x6d'),_0xffd6('0x6e'),'CampaignId',_0xffd6('0x52'),'updatedAt'],squel['select']()[_0xffd6('0x6f')](_0xffd6('0x70'),'phone')[_0xffd6('0x6f')](_0xffd6('0x71'),_0xffd6('0x6c'))[_0xffd6('0x6f')]('id',_0xffd6('0x6d'))['field'](_0x2c8640[_0xffd6('0x72')][_0xffd6('0x73')](),_0xffd6('0x6e'))[_0xffd6('0x6f')](_0x3fd72b[_0xffd6('0x49')]['id']['toString'](),'CampaignId')[_0xffd6('0x6f')]('\x27'+_0x42e1e9+'\x27',_0xffd6('0x52'))['field']('\x27'+_0x42e1e9+'\x27',_0xffd6('0x54'))[_0xffd6('0x74')](_0xffd6('0x75'))[_0xffd6('0x3e')]('deletedAt\x20IS\x20NULL')[_0xffd6('0x3e')](_0xffd6('0x76'),_0x2c8640[_0xffd6('0x72')][_0xffd6('0x73')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xffd6('0x3e')](_0xffd6('0x77'),squel['select']()[_0xffd6('0x6f')](_0xffd6('0x78'))[_0xffd6('0x74')](_0xffd6('0x79'))[_0xffd6('0x3e')](_0xffd6('0x7a'),_0x3fd72b['params']['id'][_0xffd6('0x73')]()))[_0xffd6('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xffd6('0x7b'))['from'](_0xffd6('0x6a'))[_0xffd6('0x3e')](_0xffd6('0x7a'),_0x3fd72b['params']['id'][_0xffd6('0x73')]())))[_0xffd6('0x73')]();break;case'onlyIfOpen':_0x7ca3c2=squel[_0xffd6('0x69')]()[_0xffd6('0x7c')]('cm_hopper')[_0xffd6('0x6b')](['phone',_0xffd6('0x6c'),_0xffd6('0x6d'),'ListId',_0xffd6('0x5b'),'createdAt',_0xffd6('0x54')],squel[_0xffd6('0x7d')]()[_0xffd6('0x6f')](_0xffd6('0x70'),'phone')['field'](_0xffd6('0x71'),'scheduledAt')['field']('id',_0xffd6('0x6d'))['field'](_0x2c8640[_0xffd6('0x72')][_0xffd6('0x73')](),_0xffd6('0x6e'))[_0xffd6('0x6f')](_0x3fd72b[_0xffd6('0x49')]['id']['toString'](),_0xffd6('0x5b'))[_0xffd6('0x6f')]('\x27'+_0x42e1e9+'\x27',_0xffd6('0x52'))['field']('\x27'+_0x42e1e9+'\x27',_0xffd6('0x54'))[_0xffd6('0x74')](_0xffd6('0x75'))[_0xffd6('0x3e')](_0xffd6('0x7e'))[_0xffd6('0x3e')](_0xffd6('0x76'),_0x2c8640[_0xffd6('0x72')][_0xffd6('0x73')]())[_0xffd6('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xffd6('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xffd6('0x7d')]()[_0xffd6('0x6f')](_0xffd6('0x7b'))[_0xffd6('0x74')](_0xffd6('0x6a'))['where'](_0xffd6('0x7a'),_0x3fd72b[_0xffd6('0x49')]['id'][_0xffd6('0x73')]())))[_0xffd6('0x73')]();break;default:_0x7ca3c2=squel['insert']()[_0xffd6('0x7c')](_0xffd6('0x6a'))['fromQuery']([_0xffd6('0x70'),_0xffd6('0x6c'),_0xffd6('0x6d'),'ListId','CampaignId','createdAt',_0xffd6('0x54')],squel[_0xffd6('0x7d')]()[_0xffd6('0x6f')](_0xffd6('0x70'),'phone')[_0xffd6('0x6f')](_0xffd6('0x71'),_0xffd6('0x6c'))['field']('id',_0xffd6('0x6d'))[_0xffd6('0x6f')](_0x2c8640['CmListId'][_0xffd6('0x73')](),_0xffd6('0x6e'))['field'](_0x3fd72b['params']['id']['toString'](),_0xffd6('0x5b'))[_0xffd6('0x6f')]('\x27'+_0x42e1e9+'\x27',_0xffd6('0x52'))['field']('\x27'+_0x42e1e9+'\x27',_0xffd6('0x54'))[_0xffd6('0x74')]('cm_contacts')[_0xffd6('0x3e')]('deletedAt\x20IS\x20NULL')['where'](_0xffd6('0x76'),_0x2c8640[_0xffd6('0x72')][_0xffd6('0x73')]())[_0xffd6('0x3e')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x42192b=squel[_0xffd6('0x69')]()[_0xffd6('0x7c')](_0xffd6('0x7f'))[_0xffd6('0x6b')]([_0xffd6('0x80'),_0xffd6('0x6c'),_0xffd6('0x70'),_0xffd6('0x81'),_0xffd6('0x52'),'updatedAt'],squel['select']()[_0xffd6('0x6f')](_0xffd6('0x82'),'id')[_0xffd6('0x6f')](_0xffd6('0x71'),_0xffd6('0x6c'))['field'](_0xffd6('0x83'),_0xffd6('0x70'))['field']('ci.OrderBY',_0xffd6('0x81'))[_0xffd6('0x6f')]('\x27'+_0x42e1e9+'\x27',_0xffd6('0x52'))['field']('\x27'+_0x42e1e9+'\x27',_0xffd6('0x54'))[_0xffd6('0x74')](_0xffd6('0x84'),'ci')[_0xffd6('0x85')](_0xffd6('0x6a'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xffd6('0x3e')](_0xffd6('0x86'),_0x2c8640[_0xffd6('0x72')][_0xffd6('0x73')]())[_0xffd6('0x3e')]('h.CampaignId=?',_0x3fd72b['params']['id'][_0xffd6('0x73')]())[_0xffd6('0x3e')](_0xffd6('0x87'),_0x42e1e9))[_0xffd6('0x73')]();_0x192f74[_0xffd6('0x88')](db[_0xffd6('0x89')][_0xffd6('0x33')](_0x7ca3c2));_0x48416b['push'](db[_0xffd6('0x89')][_0xffd6('0x33')](_0x42192b));}return BPromise['all'](_0x192f74);}})[_0xffd6('0x24')](function(){return BPromise[_0xffd6('0x8a')](_0x48416b);})[_0xffd6('0x24')](function(){return _0x18a397;})[_0xffd6('0x24')](respondWithResult(_0x7911a9,null))[_0xffd6('0x48')](handleError(_0x7911a9,null));};exports[_0xffd6('0x8b')]=function(_0x5c2ada,_0x23faad,_0x40a685){return db[_0xffd6('0x2d')][_0xffd6('0x4a')]({'where':{'id':_0x5c2ada['params']['id']}})[_0xffd6('0x24')](handleEntityNotFound(_0x23faad,null))[_0xffd6('0x24')](function(_0x361721){if(_0x361721){return _0x361721[_0xffd6('0x8b')](_0x5c2ada[_0xffd6('0x33')]['ids']);}})[_0xffd6('0x24')](function(_0x2e8c0f){if(_0x2e8c0f){return db[_0xffd6('0x5a')]['destroy']({'where':{'ListId':_0x5c2ada[_0xffd6('0x33')][_0xffd6('0x65')],'CampaignId':_0x5c2ada['params']['id']}})[_0xffd6('0x24')](function(){return _0x2e8c0f;});}})[_0xffd6('0x24')](respondWithStatusCode(_0x23faad,null))[_0xffd6('0x48')](handleError(_0x23faad,null));};exports['getBlackLists']=function(_0x359a6e,_0x3b50bc,_0x54f110){var _0x383497={};var _0x1b9ef7={};var _0x5b470b;var _0x27cef8;return db[_0xffd6('0x2d')][_0xffd6('0x5d')]({'where':{'id':_0x359a6e[_0xffd6('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b50bc,null))['then'](function(_0x452976){if(_0x452976){_0x5b470b=_0x452976;_0x1b9ef7[_0xffd6('0x32')]=_[_0xffd6('0x34')](db[_0xffd6('0x62')][_0xffd6('0x2e')]);_0x1b9ef7['query']=_['keys'](_0x359a6e[_0xffd6('0x33')]);_0x1b9ef7[_0xffd6('0x35')]=_[_0xffd6('0x36')](_0x1b9ef7['model'],_0x1b9ef7[_0xffd6('0x33')]);_0x383497[_0xffd6('0x38')]=_['intersection'](_0x1b9ef7['model'],qs[_0xffd6('0x37')](_0x359a6e['query'][_0xffd6('0x37')]));_0x383497['attributes']=_0x383497['attributes'][_0xffd6('0x39')]?_0x383497[_0xffd6('0x38')]:_0x1b9ef7[_0xffd6('0x32')];_0x383497[_0xffd6('0x3c')]=qs[_0xffd6('0x3d')](_0x359a6e[_0xffd6('0x33')][_0xffd6('0x3d')]);_0x383497[_0xffd6('0x3e')]=qs[_0xffd6('0x35')](_[_0xffd6('0x3f')](_0x359a6e[_0xffd6('0x33')],_0x1b9ef7[_0xffd6('0x35')]));if(_0x359a6e['query'][_0xffd6('0x40')]){_0x383497[_0xffd6('0x3e')]=_[_0xffd6('0x41')](_0x383497[_0xffd6('0x3e')],{'$or':_[_0xffd6('0x2c')](_0x383497[_0xffd6('0x38')],function(_0x5385ee){var _0x5e3f2c={};_0x5e3f2c[_0x5385ee]={'$like':'%'+_0x359a6e['query']['filter']+'%'};return _0x5e3f2c;})});}_0x383497=_[_0xffd6('0x41')]({},_0x383497,_0x359a6e[_0xffd6('0x43')]);return _0x5b470b[_0xffd6('0x8c')](_0x383497);}})[_0xffd6('0x24')](function(_0x4d1f4f){if(_0x4d1f4f){_0x27cef8=_0x4d1f4f['length'];if(!_0x359a6e[_0xffd6('0x33')][_0xffd6('0x3a')]('nolimit')){_0x383497[_0xffd6('0x1d')]=qs[_0xffd6('0x1d')](_0x359a6e[_0xffd6('0x33')][_0xffd6('0x1d')]);_0x383497[_0xffd6('0x1c')]=qs[_0xffd6('0x1c')](_0x359a6e[_0xffd6('0x33')][_0xffd6('0x1c')]);}return _0x5b470b['getBlackLists'](_0x383497);}})['then'](function(_0x2a8989){if(_0x2a8989){return _0x2a8989?{'count':_0x27cef8,'rows':_0x2a8989}:null;}})[_0xffd6('0x24')](respondWithResult(_0x3b50bc,null))[_0xffd6('0x48')](handleError(_0x3b50bc,null));};exports[_0xffd6('0x8d')]=function(_0x4f01c6,_0x1e742e,_0x2bd9e8){var _0x384400,_0x33421c;var _0x48dd16=[];var _0x20063b=moment()[_0xffd6('0x8e')](_0xffd6('0x64'));return db[_0xffd6('0x2d')][_0xffd6('0x4a')]({'where':{'id':_0x4f01c6[_0xffd6('0x49')]['id']}})[_0xffd6('0x24')](handleEntityNotFound(_0x1e742e,null))[_0xffd6('0x24')](function(_0x2a2d34){if(_0x2a2d34){_0x33421c=_0x2a2d34;return _0x2a2d34[_0xffd6('0x8d')](_0x4f01c6[_0xffd6('0x53')][_0xffd6('0x65')],_[_0xffd6('0x51')](_0x4f01c6['body'],[_0xffd6('0x65'),'id'])||{});}return null;})['spread'](function(_0x246fc8){var _0x4c2e37;var _0x4783f8;_0x384400=_0x246fc8||[];var _0x34ceed=[];if(_0x246fc8){for(var _0x6e9d16=0x0;_0x6e9d16<_0x246fc8[_0xffd6('0x39')];_0x6e9d16+=0x1){var _0x4a807f=_0x246fc8[_0x6e9d16][_0xffd6('0x25')]({'plain':!![]});_0x4c2e37=squel[_0xffd6('0x69')]()['into'](_0xffd6('0x8f'))[_0xffd6('0x6b')]([_0xffd6('0x70'),'ContactId','ListId','CampaignId',_0xffd6('0x52'),_0xffd6('0x54')],squel['select']()[_0xffd6('0x6f')](_0xffd6('0x70'),'phone')['field']('id',_0xffd6('0x6d'))[_0xffd6('0x6f')](_0x4a807f[_0xffd6('0x72')][_0xffd6('0x73')](),_0xffd6('0x6e'))[_0xffd6('0x6f')](_0x4f01c6['params']['id']['toString'](),_0xffd6('0x5b'))[_0xffd6('0x6f')](_0xffd6('0x71'),_0xffd6('0x52'))['field'](_0xffd6('0x71'),_0xffd6('0x54'))[_0xffd6('0x74')](_0xffd6('0x75'))[_0xffd6('0x3e')](_0xffd6('0x7e'))[_0xffd6('0x3e')]('ListId\x20=\x20?',_0x4a807f['CmListId'][_0xffd6('0x73')]())[_0xffd6('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0xffd6('0x73')]();_0x34ceed[_0xffd6('0x88')](db[_0xffd6('0x89')]['query'](_0x4c2e37));}return BPromise[_0xffd6('0x8a')](_0x34ceed);}})[_0xffd6('0x24')](function(){return _0x384400;})[_0xffd6('0x24')](respondWithResult(_0x1e742e,null))[_0xffd6('0x48')](handleError(_0x1e742e,null));};exports[_0xffd6('0x90')]=function(_0x52785f,_0x2ed341,_0x146072){return db[_0xffd6('0x2d')][_0xffd6('0x4a')]({'where':{'id':_0x52785f[_0xffd6('0x49')]['id']}})[_0xffd6('0x24')](handleEntityNotFound(_0x2ed341,null))[_0xffd6('0x24')](function(_0x5928dd){if(_0x5928dd){return _0x5928dd[_0xffd6('0x90')](_0x52785f['query'][_0xffd6('0x65')]);}})[_0xffd6('0x24')](function(_0x3247ca){if(_0x3247ca){return db['CmHopperBlack'][_0xffd6('0x27')]({'where':{'ListId':_0x52785f[_0xffd6('0x33')][_0xffd6('0x65')],'CampaignId':_0x52785f[_0xffd6('0x49')]['id']}})[_0xffd6('0x24')](function(){return _0x3247ca;});}})[_0xffd6('0x24')](respondWithStatusCode(_0x2ed341,null))['catch'](handleError(_0x2ed341,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index b7bffa7..c7e67ee 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 _0xcdba=['../../config/logger','api','rimraf','../../config/environment','./campaign.attributes','exports','define','Campaign','util'];(function(_0x2ee9fb,_0x268552){var _0x39177b=function(_0x82876b){while(--_0x82876b){_0x2ee9fb['push'](_0x2ee9fb['shift']());}};_0x39177b(++_0x268552);}(_0xcdba,0xbc));var _0xacdb=function(_0x2c6b47,_0x2b9a0a){_0x2c6b47=_0x2c6b47-0x0;var _0x1e5354=_0xcdba[_0x2c6b47];return _0x1e5354;};'use strict';var _=require('lodash');var util=require(_0xacdb('0x0'));var logger=require(_0xacdb('0x1'))(_0xacdb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xacdb('0x3'));var config=require(_0xacdb('0x4'));var attributes=require(_0xacdb('0x5'));module[_0xacdb('0x6')]=function(_0xeef3e6,_0x2c6859){return _0xeef3e6[_0xacdb('0x7')](_0xacdb('0x8'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf56=['request-promise','path','rimraf','../../config/environment','./campaign.attributes','define','Campaign','campaigns','../../config/logger','moment','bluebird'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xcf56,0x15d));var _0x6cf5=function(_0x43de10,_0x8e52d5){_0x43de10=_0x43de10-0x0;var _0x2e713d=_0xcf56[_0x43de10];return _0x2e713d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6cf5('0x0'))('api');var moment=require(_0x6cf5('0x1'));var BPromise=require(_0x6cf5('0x2'));var rp=require(_0x6cf5('0x3'));var fs=require('fs');var path=require(_0x6cf5('0x4'));var rimraf=require(_0x6cf5('0x5'));var config=require(_0x6cf5('0x6'));var attributes=require(_0x6cf5('0x7'));module['exports']=function(_0x2bd85e,_0x4c27a7){return _0x2bd85e[_0x6cf5('0x8')](_0x6cf5('0x9'),attributes,{'tableName':_0x6cf5('0xa'),'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 68ec8bc..46a9ad9 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 _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x49372d,_0x21e0bf){var _0x4cccf9=function(_0x2084c0){while(--_0x2084c0){_0x49372d['push'](_0x49372d['shift']());}};_0x4cccf9(++_0x21e0bf);}(_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']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0xede908,_0x2f6817){var _0x5fa37=function(_0x52be26){while(--_0x52be26){_0xede908['push'](_0xede908['shift']());}};_0x5fa37(++_0x2f6817);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 68125ff..45d55ce 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 _0x0199=['getLists','post','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put','update','delete','destroy','/:id/blacklists','removeBlackLists','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks'];(function(_0x9568cd,_0x1640fe){var _0x13c849=function(_0x2dcf22){while(--_0x2dcf22){_0x9568cd['push'](_0x9568cd['shift']());}};_0x13c849(++_0x1640fe);}(_0x0199,0x1dd));var _0x9019=function(_0x4a6fdd,_0x15b3e8){_0x4a6fdd=_0x4a6fdd-0x0;var _0x31d448=_0x0199[_0x4a6fdd];return _0x31d448;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9019('0x0'));var express=require(_0x9019('0x1'));var router=express['Router']();var fs_extra=require(_0x9019('0x2'));var auth=require(_0x9019('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9019('0x4'));var controller=require(_0x9019('0x5'));router[_0x9019('0x6')]('/',auth[_0x9019('0x7')](),controller[_0x9019('0x8')]);router['get'](_0x9019('0x9'),auth[_0x9019('0x7')](),controller[_0x9019('0xa')]);router[_0x9019('0x6')](_0x9019('0xb'),auth['isAuthenticated'](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0x9019('0x7')](),controller[_0x9019('0xc')]);router[_0x9019('0x6')](_0x9019('0xd'),auth[_0x9019('0x7')](),controller['getHopperFinals']);router[_0x9019('0x6')](_0x9019('0xe'),auth['isAuthenticated'](),controller[_0x9019('0xf')]);router[_0x9019('0x6')]('/:id/lists',auth[_0x9019('0x7')](),controller[_0x9019('0x10')]);router['get']('/:id/blacklists',auth[_0x9019('0x7')](),controller['getBlackLists']);router[_0x9019('0x11')]('/',auth[_0x9019('0x7')](),controller['create']);router[_0x9019('0x11')](_0x9019('0x12'),auth[_0x9019('0x7')](),controller[_0x9019('0x13')]);router[_0x9019('0x11')](_0x9019('0x14'),auth[_0x9019('0x7')](),controller[_0x9019('0x15')]);router[_0x9019('0x11')]('/:id/blacklists',auth[_0x9019('0x7')](),controller[_0x9019('0x16')]);router[_0x9019('0x17')](_0x9019('0x9'),auth[_0x9019('0x7')](),controller[_0x9019('0x18')]);router[_0x9019('0x19')](_0x9019('0x9'),auth[_0x9019('0x7')](),controller[_0x9019('0x1a')]);router[_0x9019('0x19')](_0x9019('0x14'),auth[_0x9019('0x7')](),controller['removeLists']);router[_0x9019('0x19')](_0x9019('0x1b'),auth[_0x9019('0x7')](),controller[_0x9019('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x7397=['removeLists','removeBlackLists','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','put','update','delete','destroy'];(function(_0x56379d,_0x31c951){var _0x5cf6c5=function(_0x42677b){while(--_0x42677b){_0x56379d['push'](_0x56379d['shift']());}};_0x5cf6c5(++_0x31c951);}(_0x7397,0x183));var _0x7739=function(_0x37f057,_0x225033){_0x37f057=_0x37f057-0x0;var _0x25d898=_0x7397[_0x37f057];return _0x25d898;};'use strict';var multer=require(_0x7739('0x0'));var util=require(_0x7739('0x1'));var path=require(_0x7739('0x2'));var timeout=require('connect-timeout');var express=require(_0x7739('0x3'));var router=express[_0x7739('0x4')]();var fs_extra=require(_0x7739('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7739('0x6'));var controller=require(_0x7739('0x7'));router[_0x7739('0x8')]('/',auth[_0x7739('0x9')](),controller['index']);router[_0x7739('0x8')](_0x7739('0xa'),auth[_0x7739('0x9')](),controller[_0x7739('0xb')]);router[_0x7739('0x8')](_0x7739('0xc'),auth['isAuthenticated'](),controller[_0x7739('0xd')]);router[_0x7739('0x8')](_0x7739('0xe'),auth[_0x7739('0x9')](),controller['getHopperHistories']);router[_0x7739('0x8')]('/:id/hopper_finals',auth[_0x7739('0x9')](),controller[_0x7739('0xf')]);router['get'](_0x7739('0x10'),auth['isAuthenticated'](),controller[_0x7739('0x11')]);router[_0x7739('0x8')](_0x7739('0x12'),auth[_0x7739('0x9')](),controller[_0x7739('0x13')]);router[_0x7739('0x8')](_0x7739('0x14'),auth[_0x7739('0x9')](),controller[_0x7739('0x15')]);router[_0x7739('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7739('0x16')](_0x7739('0x17'),auth[_0x7739('0x9')](),controller[_0x7739('0x18')]);router[_0x7739('0x16')](_0x7739('0x12'),auth['isAuthenticated'](),controller['addLists']);router[_0x7739('0x16')](_0x7739('0x14'),auth[_0x7739('0x9')](),controller['addBlackLists']);router[_0x7739('0x19')](_0x7739('0xa'),auth[_0x7739('0x9')](),controller[_0x7739('0x1a')]);router[_0x7739('0x1b')]('/:id',auth[_0x7739('0x9')](),controller[_0x7739('0x1c')]);router['delete']('/:id/lists',auth[_0x7739('0x9')](),controller[_0x7739('0x1d')]);router[_0x7739('0x1b')](_0x7739('0x14'),auth['isAuthenticated'](),controller[_0x7739('0x1e')]);module[_0x7739('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 285d69a..f033438 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 _0x6c01=['exports','TEXT','STRING','getDataValue','key'];(function(_0x3de28d,_0x1164db){var _0xf5937e=function(_0x213920){while(--_0x213920){_0x3de28d['push'](_0x3de28d['shift']());}};_0xf5937e(++_0x1164db);}(_0x6c01,0x113));var _0x16c0=function(_0x1c4993,_0x1d9d96){_0x1c4993=_0x1c4993-0x0;var _0xa0c0e5=_0x6c01[_0x1c4993];return _0xa0c0e5;};'use strict';var Sequelize=require('sequelize');module[_0x16c0('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x16c0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x16c0('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x16c0('0x3')](_0x16c0('0x4'));}}}; \ No newline at end of file +var _0x3b04=['STRING','TEXT','VIRTUAL','getDataValue','key','sequelize'];(function(_0x2615b0,_0x59339e){var _0x478178=function(_0x51a79e){while(--_0x51a79e){_0x2615b0['push'](_0x2615b0['shift']());}};_0x478178(++_0x59339e);}(_0x3b04,0xb3));var _0x43b0=function(_0xbb1767,_0x29b682){_0xbb1767=_0xbb1767-0x0;var _0x143104=_0x3b04[_0xbb1767];return _0x143104;};'use strict';var Sequelize=require(_0x43b0('0x0'));module['exports']={'key':{'type':Sequelize[_0x43b0('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x43b0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x43b0('0x1')]},'name':{'type':Sequelize[_0x43b0('0x3')],'get':function(){return this[_0x43b0('0x4')](_0x43b0('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index b521392..ed145cf 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 _0xcf90=['fields','length','hasOwnProperty','nolimit','order','where','filter','merge','includeAll','include','findAll','catch','params','rawAttributes','intersection','find','update','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','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','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','count','limit','set','apply','reject','save','then','destroy','get','error','stack','name','send','index','map','CannedAnswer','fieldName','model','query','keys','filters','attributes'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0xcf90,0x175));var _0x0cf9=function(_0x2e6580,_0x4ab032){_0x2e6580=_0x2e6580-0x0;var _0x421fc4=_0xcf90[_0x2e6580];return _0x421fc4;};'use strict';var emlformat=require(_0x0cf9('0x0'));var rimraf=require(_0x0cf9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0cf9('0x2'));var rp=require('request-promise');var moment=require(_0x0cf9('0x3'));var BPromise=require(_0x0cf9('0x4'));var Mustache=require(_0x0cf9('0x5'));var util=require(_0x0cf9('0x6'));var path=require(_0x0cf9('0x7'));var sox=require('sox');var csv=require(_0x0cf9('0x8'));var ejs=require(_0x0cf9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0cf9('0xa'));var squel=require(_0x0cf9('0xb'));var crypto=require(_0x0cf9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0cf9('0xd'));var toCsv=require(_0x0cf9('0x8'));var querystring=require(_0x0cf9('0xe'));var Papa=require(_0x0cf9('0xf'));var Redis=require(_0x0cf9('0x10'));var authService=require(_0x0cf9('0x11'));var qs=require(_0x0cf9('0x12'));var as=require(_0x0cf9('0x13'));var hardwareService=require(_0x0cf9('0x14'));var logger=require(_0x0cf9('0x15'))(_0x0cf9('0x16'));var utils=require('../../config/utils');var config=require(_0x0cf9('0x17'));var licenseUtil=require(_0x0cf9('0x18'));var db=require(_0x0cf9('0x19'))['db'];function respondWithStatusCode(_0x2f1be6,_0x50b8f5){_0x50b8f5=_0x50b8f5||0xcc;return function(_0x7d06f8){if(_0x7d06f8){return _0x2f1be6['sendStatus'](_0x50b8f5);}return _0x2f1be6[_0x0cf9('0x1a')](_0x50b8f5)[_0x0cf9('0x1b')]();};}function respondWithResult(_0x5308d3,_0xcc18dd){_0xcc18dd=_0xcc18dd||0xc8;return function(_0x398ec3){if(_0x398ec3){return _0x5308d3[_0x0cf9('0x1a')](_0xcc18dd)[_0x0cf9('0x1c')](_0x398ec3);}};}function respondWithFilteredResult(_0x440382,_0x1c5bf7){return function(_0x20b7b0){if(_0x20b7b0){var _0x467747=typeof _0x1c5bf7[_0x0cf9('0x1d')]==='undefined'&&typeof _0x1c5bf7['limit']==='undefined';var _0x207030=_0x20b7b0[_0x0cf9('0x1e')];var _0x2253c8=_0x467747?0x0:_0x1c5bf7[_0x0cf9('0x1d')];var _0x294b77=_0x467747?_0x20b7b0[_0x0cf9('0x1e')]:_0x1c5bf7[_0x0cf9('0x1d')]+_0x1c5bf7[_0x0cf9('0x1f')];var _0x5855e7;if(_0x294b77>=_0x207030){_0x294b77=_0x207030;_0x5855e7=0xc8;}else{_0x5855e7=0xce;}_0x440382[_0x0cf9('0x1a')](_0x5855e7);return _0x440382[_0x0cf9('0x20')]('Content-Range',_0x2253c8+'-'+_0x294b77+'/'+_0x207030)[_0x0cf9('0x1c')](_0x20b7b0);}return null;};}function patchUpdates(_0x193b57){return function(_0x2bf7a4){try{jsonpatch[_0x0cf9('0x21')](_0x2bf7a4,_0x193b57,!![]);}catch(_0xdfead9){return BPromise[_0x0cf9('0x22')](_0xdfead9);}return _0x2bf7a4[_0x0cf9('0x23')]();};}function saveUpdates(_0x305faa,_0x257255){return function(_0x18a3ae){if(_0x18a3ae){return _0x18a3ae['update'](_0x305faa)[_0x0cf9('0x24')](function(_0x3e4614){return _0x3e4614;});}return null;};}function removeEntity(_0x40cf10,_0x4a5061){return function(_0x1f1b45){if(_0x1f1b45){return _0x1f1b45[_0x0cf9('0x25')]()[_0x0cf9('0x24')](function(){var _0x34a495=_0x1f1b45[_0x0cf9('0x26')]({'plain':!![]});var _0x2f8c8f='CannedAnswers';return db['UserProfileResource'][_0x0cf9('0x25')]({'where':{'type':_0x2f8c8f,'resourceId':_0x34a495['id']}})[_0x0cf9('0x24')](function(){return _0x1f1b45;});})[_0x0cf9('0x24')](function(){_0x40cf10[_0x0cf9('0x1a')](0xcc)[_0x0cf9('0x1b')]();});}};}function handleEntityNotFound(_0x7eadd6,_0x52cab4){return function(_0x158f3a){if(!_0x158f3a){_0x7eadd6['sendStatus'](0x194);}return _0x158f3a;};}function handleError(_0x5bf1d4,_0x395b83){_0x395b83=_0x395b83||0x1f4;return function(_0x33ed5b){logger[_0x0cf9('0x27')](_0x33ed5b[_0x0cf9('0x28')]);if(_0x33ed5b[_0x0cf9('0x29')]){delete _0x33ed5b[_0x0cf9('0x29')];}_0x5bf1d4[_0x0cf9('0x1a')](_0x395b83)[_0x0cf9('0x2a')](_0x33ed5b);};}exports[_0x0cf9('0x2b')]=function(_0x52ea57,_0x5efc13){var _0x4cb5f8={},_0x4b5d78={},_0x4c1e5b={'count':0x0,'rows':[]};var _0x283431=_[_0x0cf9('0x2c')](db[_0x0cf9('0x2d')]['rawAttributes'],function(_0x5eca56){return{'name':_0x5eca56[_0x0cf9('0x2e')],'type':_0x5eca56['type']['key']};});_0x4b5d78[_0x0cf9('0x2f')]=_[_0x0cf9('0x2c')](_0x283431,_0x0cf9('0x29'));_0x4b5d78[_0x0cf9('0x30')]=_[_0x0cf9('0x31')](_0x52ea57[_0x0cf9('0x30')]);_0x4b5d78[_0x0cf9('0x32')]=_['intersection'](_0x4b5d78[_0x0cf9('0x2f')],_0x4b5d78[_0x0cf9('0x30')]);_0x4cb5f8[_0x0cf9('0x33')]=_['intersection'](_0x4b5d78[_0x0cf9('0x2f')],qs[_0x0cf9('0x34')](_0x52ea57['query'][_0x0cf9('0x34')]));_0x4cb5f8[_0x0cf9('0x33')]=_0x4cb5f8['attributes'][_0x0cf9('0x35')]?_0x4cb5f8[_0x0cf9('0x33')]:_0x4b5d78[_0x0cf9('0x2f')];if(!_0x52ea57[_0x0cf9('0x30')][_0x0cf9('0x36')](_0x0cf9('0x37'))){_0x4cb5f8['limit']=qs[_0x0cf9('0x1f')](_0x52ea57['query'][_0x0cf9('0x1f')]);_0x4cb5f8[_0x0cf9('0x1d')]=qs[_0x0cf9('0x1d')](_0x52ea57[_0x0cf9('0x30')][_0x0cf9('0x1d')]);}_0x4cb5f8[_0x0cf9('0x38')]=qs['sort'](_0x52ea57[_0x0cf9('0x30')]['sort']);_0x4cb5f8[_0x0cf9('0x39')]=qs[_0x0cf9('0x32')](_['pick'](_0x52ea57[_0x0cf9('0x30')],_0x4b5d78[_0x0cf9('0x32')]),_0x283431);if(_0x52ea57[_0x0cf9('0x30')][_0x0cf9('0x3a')]){_0x4cb5f8[_0x0cf9('0x39')]=_[_0x0cf9('0x3b')](_0x4cb5f8[_0x0cf9('0x39')],{'$or':[{'key':{'$like':'%'+_0x52ea57[_0x0cf9('0x30')][_0x0cf9('0x3a')]+'%'}},{'value':{'$like':'%'+_0x52ea57[_0x0cf9('0x30')][_0x0cf9('0x3a')]+'%'}}]});}_0x4cb5f8=_[_0x0cf9('0x3b')]({},_0x4cb5f8,_0x52ea57['options']);var _0x434238={'where':_0x4cb5f8[_0x0cf9('0x39')]};return db['CannedAnswer'][_0x0cf9('0x1e')](_0x434238)[_0x0cf9('0x24')](function(_0x5bcfb3){_0x4c1e5b[_0x0cf9('0x1e')]=_0x5bcfb3;if(_0x52ea57[_0x0cf9('0x30')][_0x0cf9('0x3c')]){_0x4cb5f8[_0x0cf9('0x3d')]=[{'all':!![]}];}return db[_0x0cf9('0x2d')][_0x0cf9('0x3e')](_0x4cb5f8);})[_0x0cf9('0x24')](function(_0x2c6e0c){_0x4c1e5b['rows']=_0x2c6e0c;return _0x4c1e5b;})[_0x0cf9('0x24')](respondWithFilteredResult(_0x5efc13,_0x4cb5f8))[_0x0cf9('0x3f')](handleError(_0x5efc13,null));};exports['show']=function(_0x20ddc2,_0x29fa67){var _0x145ac9={'raw':!![],'where':{'id':_0x20ddc2[_0x0cf9('0x40')]['id']}},_0x5ab6ab={};_0x5ab6ab[_0x0cf9('0x2f')]=_[_0x0cf9('0x31')](db[_0x0cf9('0x2d')][_0x0cf9('0x41')]);_0x5ab6ab[_0x0cf9('0x30')]=_[_0x0cf9('0x31')](_0x20ddc2[_0x0cf9('0x30')]);_0x5ab6ab[_0x0cf9('0x32')]=_[_0x0cf9('0x42')](_0x5ab6ab['model'],_0x5ab6ab[_0x0cf9('0x30')]);_0x145ac9['attributes']=_[_0x0cf9('0x42')](_0x5ab6ab[_0x0cf9('0x2f')],qs[_0x0cf9('0x34')](_0x20ddc2['query'][_0x0cf9('0x34')]));_0x145ac9[_0x0cf9('0x33')]=_0x145ac9[_0x0cf9('0x33')]['length']?_0x145ac9[_0x0cf9('0x33')]:_0x5ab6ab[_0x0cf9('0x2f')];if(_0x20ddc2[_0x0cf9('0x30')][_0x0cf9('0x3c')]){_0x145ac9['include']=[{'all':!![]}];}_0x145ac9=_[_0x0cf9('0x3b')]({},_0x145ac9,_0x20ddc2['options']);return db[_0x0cf9('0x2d')][_0x0cf9('0x43')](_0x145ac9)[_0x0cf9('0x24')](handleEntityNotFound(_0x29fa67,null))[_0x0cf9('0x24')](respondWithResult(_0x29fa67,null))[_0x0cf9('0x3f')](handleError(_0x29fa67,null));};exports[_0x0cf9('0x44')]=function(_0x570345,_0xd64afa){if(_0x570345[_0x0cf9('0x45')]['id']){delete _0x570345[_0x0cf9('0x45')]['id'];}return db[_0x0cf9('0x2d')][_0x0cf9('0x43')]({'where':{'id':_0x570345['params']['id']}})[_0x0cf9('0x24')](handleEntityNotFound(_0xd64afa,null))[_0x0cf9('0x24')](saveUpdates(_0x570345[_0x0cf9('0x45')],null))[_0x0cf9('0x24')](respondWithResult(_0xd64afa,null))[_0x0cf9('0x3f')](handleError(_0xd64afa,null));};exports[_0x0cf9('0x25')]=function(_0x2bf6a4,_0x36537e){return db[_0x0cf9('0x2d')][_0x0cf9('0x43')]({'where':{'id':_0x2bf6a4[_0x0cf9('0x40')]['id']}})['then'](handleEntityNotFound(_0x36537e,null))[_0x0cf9('0x24')](removeEntity(_0x36537e,null))[_0x0cf9('0x3f')](handleError(_0x36537e,null));};exports[_0x0cf9('0x46')]=function(_0x29279d,_0x195418){var _0x29347a={'key':_0x29279d['body'][_0x0cf9('0x47')]};if(_0x29279d[_0x0cf9('0x45')][_0x0cf9('0x48')]){_0x29347a[_0x0cf9('0x48')]=_0x29279d['body']['MailAccountId'];}else if(_0x29279d[_0x0cf9('0x45')][_0x0cf9('0x49')]){_0x29347a['SmsAccountId']=_0x29279d[_0x0cf9('0x45')][_0x0cf9('0x49')];}else if(_0x29279d[_0x0cf9('0x45')]['OpenchannelAccountId']){_0x29347a['OpenchannelAccountId']=_0x29279d['body'][_0x0cf9('0x4a')];}else if(_0x29279d['body']['ChatWebsiteId']){_0x29347a[_0x0cf9('0x4b')]=_0x29279d['body'][_0x0cf9('0x4b')];}return db[_0x0cf9('0x2d')]['find']({'where':_0x29347a})['then'](function(_0x37ec2a){if(_0x37ec2a){throw new db[(_0x0cf9('0x4c'))][(_0x0cf9('0x4d'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0x0cf9('0x46')](_0x29279d[_0x0cf9('0x45')]);})[_0x0cf9('0x24')](function(_0x39daba){var _0x1aae49=_0x29279d[_0x0cf9('0x4e')][_0x0cf9('0x26')]({'plain':!![]});if(!_0x1aae49)throw new Error(_0x0cf9('0x4f'));if(_0x1aae49[_0x0cf9('0x50')]===_0x0cf9('0x4e')){var _0x19aa0d=_0x39daba[_0x0cf9('0x26')]({'plain':!![]});return db[_0x0cf9('0x51')][_0x0cf9('0x43')]({'where':{'name':_0x0cf9('0x52'),'userProfileId':_0x1aae49['userProfileId']},'raw':!![]})[_0x0cf9('0x24')](function(_0x4a9fe9){if(_0x4a9fe9&&_0x4a9fe9[_0x0cf9('0x53')]===0x0){return db['UserProfileResource'][_0x0cf9('0x46')]({'name':_0x19aa0d[_0x0cf9('0x29')],'resourceId':_0x19aa0d['id'],'type':_0x4a9fe9[_0x0cf9('0x29')],'sectionId':_0x4a9fe9['id']},{})[_0x0cf9('0x24')](function(){return _0x39daba;});}else{return _0x39daba;}})[_0x0cf9('0x3f')](function(_0x344464){logger[_0x0cf9('0x27')](_0x0cf9('0x54'),_0x344464);throw _0x344464;});}return _0x39daba;})['then'](respondWithResult(_0x195418,0xc9))[_0x0cf9('0x3f')](handleError(_0x195418,null));}; \ No newline at end of file +var _0x515a=['catch','body','destroy','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','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','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','CannedAnswers','end','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','keys','query','filters','intersection','attributes','model','fields','length','sort','where','filter','merge','options','includeAll','include','findAll','show','params','find'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x515a,0xbb));var _0xa515=function(_0x583d05,_0x5036cb){_0x583d05=_0x583d05-0x0;var _0x5acd89=_0x515a[_0x583d05];return _0x5acd89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa515('0x0'));var zipdir=require(_0xa515('0x1'));var jsonpatch=require(_0xa515('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa515('0x3'));var Mustache=require(_0xa515('0x4'));var util=require('util');var path=require(_0xa515('0x5'));var sox=require(_0xa515('0x6'));var csv=require(_0xa515('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa515('0x8'));var _=require(_0xa515('0x9'));var squel=require(_0xa515('0xa'));var crypto=require(_0xa515('0xb'));var jsforce=require(_0xa515('0xc'));var deskjs=require(_0xa515('0xd'));var toCsv=require(_0xa515('0x7'));var querystring=require(_0xa515('0xe'));var Papa=require(_0xa515('0xf'));var Redis=require(_0xa515('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa515('0x11'));var as=require(_0xa515('0x12'));var hardwareService=require(_0xa515('0x13'));var logger=require(_0xa515('0x14'))(_0xa515('0x15'));var utils=require(_0xa515('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa515('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd5f704,_0x15cc96){_0x15cc96=_0x15cc96||0xcc;return function(_0x14a71){if(_0x14a71){return _0xd5f704[_0xa515('0x18')](_0x15cc96);}return _0xd5f704[_0xa515('0x19')](_0x15cc96)['end']();};}function respondWithResult(_0x1ad41a,_0xddc98){_0xddc98=_0xddc98||0xc8;return function(_0x72f3d9){if(_0x72f3d9){return _0x1ad41a[_0xa515('0x19')](_0xddc98)[_0xa515('0x1a')](_0x72f3d9);}};}function respondWithFilteredResult(_0x435fe8,_0x61bf56){return function(_0x52141e){if(_0x52141e){var _0x32e0aa=typeof _0x61bf56[_0xa515('0x1b')]===_0xa515('0x1c')&&typeof _0x61bf56[_0xa515('0x1d')]===_0xa515('0x1c');var _0x55fecd=_0x52141e[_0xa515('0x1e')];var _0x2c9e56=_0x32e0aa?0x0:_0x61bf56[_0xa515('0x1b')];var _0x22c633=_0x32e0aa?_0x52141e[_0xa515('0x1e')]:_0x61bf56[_0xa515('0x1b')]+_0x61bf56[_0xa515('0x1d')];var _0x3cab7b;if(_0x22c633>=_0x55fecd){_0x22c633=_0x55fecd;_0x3cab7b=0xc8;}else{_0x3cab7b=0xce;}_0x435fe8[_0xa515('0x19')](_0x3cab7b);return _0x435fe8[_0xa515('0x1f')]('Content-Range',_0x2c9e56+'-'+_0x22c633+'/'+_0x55fecd)['json'](_0x52141e);}return null;};}function patchUpdates(_0x32443d){return function(_0x56162c){try{jsonpatch[_0xa515('0x20')](_0x56162c,_0x32443d,!![]);}catch(_0x27c386){return BPromise[_0xa515('0x21')](_0x27c386);}return _0x56162c[_0xa515('0x22')]();};}function saveUpdates(_0x42d44b,_0x50d3ee){return function(_0x45128b){if(_0x45128b){return _0x45128b[_0xa515('0x23')](_0x42d44b)[_0xa515('0x24')](function(_0x597be1){return _0x597be1;});}return null;};}function removeEntity(_0x5b3c89,_0x2a2a6c){return function(_0x1aa8a7){if(_0x1aa8a7){return _0x1aa8a7['destroy']()[_0xa515('0x24')](function(){var _0x18a2ce=_0x1aa8a7[_0xa515('0x25')]({'plain':!![]});var _0x2e75fd=_0xa515('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e75fd,'resourceId':_0x18a2ce['id']}})[_0xa515('0x24')](function(){return _0x1aa8a7;});})[_0xa515('0x24')](function(){_0x5b3c89[_0xa515('0x19')](0xcc)[_0xa515('0x27')]();});}};}function handleEntityNotFound(_0xf14fe4,_0x2fbef8){return function(_0x7fddcf){if(!_0x7fddcf){_0xf14fe4['sendStatus'](0x194);}return _0x7fddcf;};}function handleError(_0x19bb55,_0xcf220a){_0xcf220a=_0xcf220a||0x1f4;return function(_0x367b00){logger[_0xa515('0x28')](_0x367b00[_0xa515('0x29')]);if(_0x367b00['name']){delete _0x367b00[_0xa515('0x2a')];}_0x19bb55[_0xa515('0x19')](_0xcf220a)[_0xa515('0x2b')](_0x367b00);};}exports[_0xa515('0x2c')]=function(_0x4b98fe,_0x470c39){var _0x87dd46={},_0x17c6e4={},_0x53de72={'count':0x0,'rows':[]};var _0x1c350e=_[_0xa515('0x2d')](db[_0xa515('0x2e')][_0xa515('0x2f')],function(_0x2edca0){return{'name':_0x2edca0[_0xa515('0x30')],'type':_0x2edca0['type']['key']};});_0x17c6e4['model']=_[_0xa515('0x2d')](_0x1c350e,_0xa515('0x2a'));_0x17c6e4['query']=_[_0xa515('0x31')](_0x4b98fe[_0xa515('0x32')]);_0x17c6e4[_0xa515('0x33')]=_[_0xa515('0x34')](_0x17c6e4['model'],_0x17c6e4[_0xa515('0x32')]);_0x87dd46[_0xa515('0x35')]=_['intersection'](_0x17c6e4[_0xa515('0x36')],qs[_0xa515('0x37')](_0x4b98fe[_0xa515('0x32')][_0xa515('0x37')]));_0x87dd46['attributes']=_0x87dd46[_0xa515('0x35')][_0xa515('0x38')]?_0x87dd46[_0xa515('0x35')]:_0x17c6e4[_0xa515('0x36')];if(!_0x4b98fe[_0xa515('0x32')]['hasOwnProperty']('nolimit')){_0x87dd46[_0xa515('0x1d')]=qs[_0xa515('0x1d')](_0x4b98fe['query'][_0xa515('0x1d')]);_0x87dd46['offset']=qs[_0xa515('0x1b')](_0x4b98fe[_0xa515('0x32')]['offset']);}_0x87dd46['order']=qs[_0xa515('0x39')](_0x4b98fe[_0xa515('0x32')][_0xa515('0x39')]);_0x87dd46[_0xa515('0x3a')]=qs[_0xa515('0x33')](_['pick'](_0x4b98fe[_0xa515('0x32')],_0x17c6e4[_0xa515('0x33')]),_0x1c350e);if(_0x4b98fe[_0xa515('0x32')][_0xa515('0x3b')]){_0x87dd46['where']=_[_0xa515('0x3c')](_0x87dd46['where'],{'$or':[{'key':{'$like':'%'+_0x4b98fe[_0xa515('0x32')][_0xa515('0x3b')]+'%'}},{'value':{'$like':'%'+_0x4b98fe['query'][_0xa515('0x3b')]+'%'}}]});}_0x87dd46=_[_0xa515('0x3c')]({},_0x87dd46,_0x4b98fe[_0xa515('0x3d')]);var _0x2c6aab={'where':_0x87dd46[_0xa515('0x3a')]};return db['CannedAnswer'][_0xa515('0x1e')](_0x2c6aab)[_0xa515('0x24')](function(_0xf44042){_0x53de72[_0xa515('0x1e')]=_0xf44042;if(_0x4b98fe[_0xa515('0x32')][_0xa515('0x3e')]){_0x87dd46[_0xa515('0x3f')]=[{'all':!![]}];}return db[_0xa515('0x2e')][_0xa515('0x40')](_0x87dd46);})[_0xa515('0x24')](function(_0x587642){_0x53de72['rows']=_0x587642;return _0x53de72;})[_0xa515('0x24')](respondWithFilteredResult(_0x470c39,_0x87dd46))['catch'](handleError(_0x470c39,null));};exports[_0xa515('0x41')]=function(_0x5a78df,_0x3f9f2b){var _0x482f07={'raw':!![],'where':{'id':_0x5a78df[_0xa515('0x42')]['id']}},_0x2c5d26={};_0x2c5d26[_0xa515('0x36')]=_[_0xa515('0x31')](db['CannedAnswer'][_0xa515('0x2f')]);_0x2c5d26[_0xa515('0x32')]=_[_0xa515('0x31')](_0x5a78df['query']);_0x2c5d26['filters']=_['intersection'](_0x2c5d26['model'],_0x2c5d26[_0xa515('0x32')]);_0x482f07['attributes']=_['intersection'](_0x2c5d26[_0xa515('0x36')],qs['fields'](_0x5a78df[_0xa515('0x32')][_0xa515('0x37')]));_0x482f07[_0xa515('0x35')]=_0x482f07[_0xa515('0x35')][_0xa515('0x38')]?_0x482f07[_0xa515('0x35')]:_0x2c5d26['model'];if(_0x5a78df[_0xa515('0x32')][_0xa515('0x3e')]){_0x482f07[_0xa515('0x3f')]=[{'all':!![]}];}_0x482f07=_[_0xa515('0x3c')]({},_0x482f07,_0x5a78df['options']);return db['CannedAnswer'][_0xa515('0x43')](_0x482f07)[_0xa515('0x24')](handleEntityNotFound(_0x3f9f2b,null))['then'](respondWithResult(_0x3f9f2b,null))[_0xa515('0x44')](handleError(_0x3f9f2b,null));};exports['update']=function(_0x2c2d96,_0x54de82){if(_0x2c2d96['body']['id']){delete _0x2c2d96[_0xa515('0x45')]['id'];}return db[_0xa515('0x2e')]['find']({'where':{'id':_0x2c2d96[_0xa515('0x42')]['id']}})[_0xa515('0x24')](handleEntityNotFound(_0x54de82,null))[_0xa515('0x24')](saveUpdates(_0x2c2d96[_0xa515('0x45')],null))[_0xa515('0x24')](respondWithResult(_0x54de82,null))[_0xa515('0x44')](handleError(_0x54de82,null));};exports[_0xa515('0x46')]=function(_0xbb5f60,_0x5a96bc){return db[_0xa515('0x2e')][_0xa515('0x43')]({'where':{'id':_0xbb5f60[_0xa515('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a96bc,null))[_0xa515('0x24')](removeEntity(_0x5a96bc,null))[_0xa515('0x44')](handleError(_0x5a96bc,null));};exports['create']=function(_0x24576d,_0x276d87){var _0x16ee62={'key':_0x24576d['body'][_0xa515('0x47')]};if(_0x24576d['body'][_0xa515('0x48')]){_0x16ee62[_0xa515('0x48')]=_0x24576d[_0xa515('0x45')][_0xa515('0x48')];}else if(_0x24576d[_0xa515('0x45')][_0xa515('0x49')]){_0x16ee62[_0xa515('0x49')]=_0x24576d[_0xa515('0x45')][_0xa515('0x49')];}else if(_0x24576d['body'][_0xa515('0x4a')]){_0x16ee62[_0xa515('0x4a')]=_0x24576d[_0xa515('0x45')][_0xa515('0x4a')];}else if(_0x24576d[_0xa515('0x45')]['ChatWebsiteId']){_0x16ee62['ChatWebsiteId']=_0x24576d[_0xa515('0x45')][_0xa515('0x4b')];}return db[_0xa515('0x2e')][_0xa515('0x43')]({'where':_0x16ee62})[_0xa515('0x24')](function(_0x252a50){if(_0x252a50){throw new db[(_0xa515('0x4c'))][(_0xa515('0x4d'))](_0xa515('0x4e'));}return db[_0xa515('0x2e')][_0xa515('0x4f')](_0x24576d['body']);})['then'](function(_0x25ea69){var _0x1d3efe=_0x24576d['user']['get']({'plain':!![]});if(!_0x1d3efe)throw new Error(_0xa515('0x50'));if(_0x1d3efe['role']===_0xa515('0x51')){var _0x127c18=_0x25ea69[_0xa515('0x25')]({'plain':!![]});return db[_0xa515('0x52')][_0xa515('0x43')]({'where':{'name':_0xa515('0x26'),'userProfileId':_0x1d3efe['userProfileId']},'raw':!![]})['then'](function(_0x2f685d){if(_0x2f685d&&_0x2f685d[_0xa515('0x53')]===0x0){return db[_0xa515('0x54')][_0xa515('0x4f')]({'name':_0x127c18[_0xa515('0x2a')],'resourceId':_0x127c18['id'],'type':_0x2f685d['name'],'sectionId':_0x2f685d['id']},{})[_0xa515('0x24')](function(){return _0x25ea69;});}else{return _0x25ea69;}})['catch'](function(_0x2dd6e5){logger[_0xa515('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2dd6e5);throw _0x2dd6e5;});}return _0x25ea69;})[_0xa515('0x24')](respondWithResult(_0x276d87,0xc9))[_0xa515('0x44')](handleError(_0x276d87,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 9702846..1fd6913 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 _0xe13e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','../../config/logger','api'];(function(_0x5819b8,_0x402d55){var _0x40211c=function(_0x56f8e1){while(--_0x56f8e1){_0x5819b8['push'](_0x5819b8['shift']());}};_0x40211c(++_0x402d55);}(_0xe13e,0xde));var _0xee13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe13e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee13('0x0'))(_0xee13('0x1'));var moment=require(_0xee13('0x2'));var BPromise=require(_0xee13('0x3'));var rp=require(_0xee13('0x4'));var fs=require('fs');var path=require(_0xee13('0x5'));var rimraf=require(_0xee13('0x6'));var config=require(_0xee13('0x7'));var attributes=require(_0xee13('0x8'));module[_0xee13('0x9')]=function(_0x43cfb0,_0x48e7b0){return _0x43cfb0[_0xee13('0xa')](_0xee13('0xb'),attributes,{'tableName':_0xee13('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xee13('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xca5a=['moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','util','api'];(function(_0x4e662a,_0x921a4b){var _0x19a1bf=function(_0x38713c){while(--_0x38713c){_0x4e662a['push'](_0x4e662a['shift']());}};_0x19a1bf(++_0x921a4b);}(_0xca5a,0x82));var _0xaca5=function(_0x59dc86,_0x34812a){_0x59dc86=_0x59dc86-0x0;var _0x37c79c=_0xca5a[_0x59dc86];return _0x37c79c;};'use strict';var _=require('lodash');var util=require(_0xaca5('0x0'));var logger=require('../../config/logger')(_0xaca5('0x1'));var moment=require(_0xaca5('0x2'));var BPromise=require(_0xaca5('0x3'));var rp=require(_0xaca5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaca5('0x5'));var config=require(_0xaca5('0x6'));var attributes=require(_0xaca5('0x7'));module['exports']=function(_0x46904a,_0x273091){return _0x46904a[_0xaca5('0x8')](_0xaca5('0x9'),attributes,{'tableName':_0xaca5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaca5('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index fb19dcf..6f988d4 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 _0x823f=['../../config/environment','jayson/promise','client','request','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x38e447,_0x2c399f){var _0x32b8f7=function(_0x59601f){while(--_0x59601f){_0x38e447['push'](_0x38e447['shift']());}};_0x32b8f7(++_0x2c399f);}(_0x823f,0x9f));var _0xf823=function(_0x19ef2b,_0x354f66){_0x19ef2b=_0x19ef2b-0x0;var _0x4df537=_0x823f[_0x19ef2b];return _0x4df537;};'use strict';var _=require(_0xf823('0x0'));var util=require(_0xf823('0x1'));var moment=require(_0xf823('0x2'));var BPromise=require(_0xf823('0x3'));var rs=require(_0xf823('0x4'));var fs=require('fs');var Redis=require(_0xf823('0x5'));var db=require(_0xf823('0x6'))['db'];var utils=require(_0xf823('0x7'));var logger=require(_0xf823('0x8'))('rpc');var config=require(_0xf823('0x9'));var jayson=require(_0xf823('0xa'));var client=jayson[_0xf823('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5507cd,_0x574348,_0x138856){return new BPromise(function(_0x3750a3,_0x5ce626){return client[_0xf823('0xc')](_0x5507cd,_0x138856)['then'](function(_0x33bef0){logger['info'](_0xf823('0xd'),_0x574348,'request\x20sent');logger['debug'](_0xf823('0xe'),_0x574348,_0xf823('0xf'),JSON['stringify'](_0x33bef0));if(_0x33bef0[_0xf823('0x10')]){if(_0x33bef0['error']['code']===0x1f4){logger[_0xf823('0x10')](_0xf823('0xd'),_0x574348,_0x33bef0[_0xf823('0x10')][_0xf823('0x11')]);return _0x5ce626(_0x33bef0[_0xf823('0x10')]['message']);}logger[_0xf823('0x10')](_0xf823('0xd'),_0x574348,_0x33bef0[_0xf823('0x10')][_0xf823('0x11')]);return _0x3750a3(_0x33bef0['error']['message']);}else{logger[_0xf823('0x12')](_0xf823('0xd'),_0x574348,_0xf823('0xf'));_0x3750a3(_0x33bef0[_0xf823('0x13')][_0xf823('0x11')]);}})[_0xf823('0x14')](function(_0x543f39){logger[_0xf823('0x10')](_0xf823('0xd'),_0x574348,_0x543f39);_0x5ce626(_0x543f39);});});} \ No newline at end of file +var _0xf5b4=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util'];(function(_0x5732bc,_0x317fb6){var _0x178740=function(_0x1ae234){while(--_0x1ae234){_0x5732bc['push'](_0x5732bc['shift']());}};_0x178740(++_0x317fb6);}(_0xf5b4,0x179));var _0x4f5b=function(_0x1878db,_0x18d9f6){_0x1878db=_0x1878db-0x0;var _0x1ae242=_0xf5b4[_0x1878db];return _0x1ae242;};'use strict';var _=require('lodash');var util=require(_0x4f5b('0x0'));var moment=require('moment');var BPromise=require(_0x4f5b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f5b('0x2'));var db=require(_0x4f5b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f5b('0x4'))(_0x4f5b('0x5'));var config=require('../../config/environment');var jayson=require(_0x4f5b('0x6'));var client=jayson[_0x4f5b('0x7')][_0x4f5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x190edb,_0x4c0f54,_0x41112a){return new BPromise(function(_0x4ad9d3,_0x445f80){return client['request'](_0x190edb,_0x41112a)[_0x4f5b('0x9')](function(_0x3d4183){logger[_0x4f5b('0xa')](_0x4f5b('0xb'),_0x4c0f54,'request\x20sent');logger['debug'](_0x4f5b('0xc'),_0x4c0f54,_0x4f5b('0xd'),JSON[_0x4f5b('0xe')](_0x3d4183));if(_0x3d4183[_0x4f5b('0xf')]){if(_0x3d4183[_0x4f5b('0xf')]['code']===0x1f4){logger[_0x4f5b('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x4c0f54,_0x3d4183[_0x4f5b('0xf')][_0x4f5b('0x10')]);return _0x445f80(_0x3d4183[_0x4f5b('0xf')]['message']);}logger[_0x4f5b('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x4c0f54,_0x3d4183['error'][_0x4f5b('0x10')]);return _0x4ad9d3(_0x3d4183[_0x4f5b('0xf')][_0x4f5b('0x10')]);}else{logger[_0x4f5b('0xa')](_0x4f5b('0xb'),_0x4c0f54,'request\x20sent');_0x4ad9d3(_0x3d4183[_0x4f5b('0x11')][_0x4f5b('0x10')]);}})['catch'](function(_0x500ca3){logger[_0x4f5b('0xf')](_0x4f5b('0xb'),_0x4c0f54,_0x500ca3);_0x445f80(_0x500ca3);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index e7c05f2..d625782 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 _0x8f63=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x1fed04,_0xd60161){var _0x26b0b7=function(_0x25a525){while(--_0x25a525){_0x1fed04['push'](_0x1fed04['shift']());}};_0x26b0b7(++_0xd60161);}(_0x8f63,0x18a));var _0x38f6=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x8f63[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x38f6('0x0'));var util=require(_0x38f6('0x1'));var path=require('path');var timeout=require(_0x38f6('0x2'));var express=require('express');var router=express[_0x38f6('0x3')]();var fs_extra=require(_0x38f6('0x4'));var auth=require(_0x38f6('0x5'));var interaction=require(_0x38f6('0x6'));var config=require(_0x38f6('0x7'));var controller=require('./cannedAnswer.controller');router[_0x38f6('0x8')]('/',auth[_0x38f6('0x9')](),controller[_0x38f6('0xa')]);router[_0x38f6('0x8')](_0x38f6('0xb'),auth['isAuthenticated'](),controller[_0x38f6('0xc')]);router[_0x38f6('0xd')]('/',auth[_0x38f6('0x9')](),controller[_0x38f6('0xe')]);router[_0x38f6('0xf')](_0x38f6('0xb'),auth['isAuthenticated'](),controller[_0x38f6('0x10')]);router['delete'](_0x38f6('0xb'),auth['isAuthenticated'](),controller[_0x38f6('0x11')]);module[_0x38f6('0x12')]=router; \ No newline at end of file +var _0xee8a=['create','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xee8a,0x100));var _0xaee8=function(_0x5e2152,_0x172f3d){_0x5e2152=_0x5e2152-0x0;var _0x5ddcf6=_0xee8a[_0x5e2152];return _0x5ddcf6;};'use strict';var multer=require('multer');var util=require(_0xaee8('0x0'));var path=require('path');var timeout=require(_0xaee8('0x1'));var express=require('express');var router=express[_0xaee8('0x2')]();var fs_extra=require(_0xaee8('0x3'));var auth=require(_0xaee8('0x4'));var interaction=require(_0xaee8('0x5'));var config=require(_0xaee8('0x6'));var controller=require(_0xaee8('0x7'));router[_0xaee8('0x8')]('/',auth['isAuthenticated'](),controller[_0xaee8('0x9')]);router[_0xaee8('0x8')](_0xaee8('0xa'),auth[_0xaee8('0xb')](),controller[_0xaee8('0xc')]);router[_0xaee8('0xd')]('/',auth[_0xaee8('0xb')](),controller[_0xaee8('0xe')]);router['put'](_0xaee8('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xaee8('0xf')](_0xaee8('0xa'),auth[_0xaee8('0xb')](),controller[_0xaee8('0x10')]);module[_0xaee8('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 510de74..24657f5 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 _0xc9a6=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x31ee6c,_0x3c4217){var _0x8fae3a=function(_0x569129){while(--_0x569129){_0x31ee6c['push'](_0x31ee6c['shift']());}};_0x8fae3a(++_0x3c4217);}(_0xc9a6,0x8a));var _0x6c9a=function(_0x3e341d,_0x382ff0){_0x3e341d=_0x3e341d-0x0;var _0x5edc1f=_0xc9a6[_0x3e341d];return _0x5edc1f;};'use strict';var Sequelize=require(_0x6c9a('0x0'));module[_0x6c9a('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x6c9a('0x2')},'clid':{'type':Sequelize[_0x6c9a('0x3')]},'src':{'type':Sequelize[_0x6c9a('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x6c9a('0x3')]},'channel':{'type':Sequelize[_0x6c9a('0x3')]},'dstchannel':{'type':Sequelize[_0x6c9a('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x6c9a('0x3')]},'duration':{'type':Sequelize[_0x6c9a('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x6c9a('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6c9a('0x3')]},'amaflags':{'type':Sequelize[_0x6c9a('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6c9a('0x3')]},'userfield':{'type':Sequelize[_0x6c9a('0x3')]},'uniqueid':{'type':Sequelize[_0x6c9a('0x3')]},'linkedid':{'type':Sequelize[_0x6c9a('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x6c9a('0x3')]},'type':{'type':Sequelize[_0x6c9a('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2d32=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x235e2b,_0x232235){var _0x4e9f0a=function(_0x2f5bf2){while(--_0x2f5bf2){_0x235e2b['push'](_0x235e2b['shift']());}};_0x4e9f0a(++_0x232235);}(_0x2d32,0x1de));var _0x22d3=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x2d32[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0x22d3('0x0'));module[_0x22d3('0x1')]={'calldate':{'type':Sequelize[_0x22d3('0x2')],'allowNull':![],'defaultValue':_0x22d3('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x22d3('0x4')]},'dcontext':{'type':Sequelize[_0x22d3('0x4')]},'channel':{'type':Sequelize[_0x22d3('0x4')]},'dstchannel':{'type':Sequelize[_0x22d3('0x4')]},'lastapp':{'type':Sequelize[_0x22d3('0x4')]},'lastdata':{'type':Sequelize[_0x22d3('0x4')]},'duration':{'type':Sequelize[_0x22d3('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x22d3('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x22d3('0x4')]},'amaflags':{'type':Sequelize[_0x22d3('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x22d3('0x4')]},'userfield':{'type':Sequelize[_0x22d3('0x4')]},'uniqueid':{'type':Sequelize[_0x22d3('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x22d3('0x4')]},'type':{'type':Sequelize[_0x22d3('0x4')]},'tag':{'type':Sequelize[_0x22d3('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 7e64deb..339f4e9 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 _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','Cdr','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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['Cdr'][_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','Cdr','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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['Cdr'][_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/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 7a3af0d..273cede 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 _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','uniqueid','util','api','moment'];(function(_0x51b04b,_0x1502cd){var _0x1f3d1c=function(_0x415a2f){while(--_0x415a2f){_0x51b04b['push'](_0x51b04b['shift']());}};_0x1f3d1c(++_0x1502cd);}(_0xadb5,0xad));var _0x5adb=function(_0x1b921e,_0x242f04){_0x1b921e=_0x1b921e-0x0;var _0x9d12ca=_0xadb5[_0x1b921e];return _0x9d12ca;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./cdr.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[{'name':_0x5adb('0xb'),'fields':[_0x5adb('0xb')]},{'name':_0x5adb('0xc'),'fields':[_0x5adb('0xc')]},{'name':_0x5adb('0xd'),'fields':[_0x5adb('0xd')]},{'name':_0x5adb('0xe'),'fields':[_0x5adb('0xe')]},{'name':'src','fields':['src']},{'name':_0x5adb('0xf'),'fields':[_0x5adb('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','uniqueid','util','api','moment'];(function(_0xb0c159,_0x48a1a4){var _0xdcfb28=function(_0x317960){while(--_0x317960){_0xb0c159['push'](_0xb0c159['shift']());}};_0xdcfb28(++_0x48a1a4);}(_0xadb5,0xad));var _0x5adb=function(_0x5f367a,_0x36ad0f){_0x5f367a=_0x5f367a-0x0;var _0x45d8b3=_0xadb5[_0x5f367a];return _0x45d8b3;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./cdr.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[{'name':_0x5adb('0xb'),'fields':[_0x5adb('0xb')]},{'name':_0x5adb('0xc'),'fields':[_0x5adb('0xc')]},{'name':_0x5adb('0xd'),'fields':[_0x5adb('0xd')]},{'name':_0x5adb('0xe'),'fields':[_0x5adb('0xe')]},{'name':'src','fields':['src']},{'name':_0x5adb('0xf'),'fields':[_0x5adb('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 0ff1b14..c617d47 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 _0xe0b1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring'];(function(_0x2e6fbe,_0x5c96ba){var _0x1f68e6=function(_0x50ac08){while(--_0x50ac08){_0x2e6fbe['push'](_0x2e6fbe['shift']());}};_0x1f68e6(++_0x5c96ba);}(_0xe0b1,0xe4));var _0x1e0b=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0xe0b1[_0x510b98];return _0x45e775;};'use strict';var _=require(_0x1e0b('0x0'));var util=require('util');var moment=require(_0x1e0b('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e0b('0x2'));var fs=require('fs');var Redis=require(_0x1e0b('0x3'));var db=require(_0x1e0b('0x4'))['db'];var utils=require(_0x1e0b('0x5'));var logger=require(_0x1e0b('0x6'))(_0x1e0b('0x7'));var config=require('../../config/environment');var jayson=require(_0x1e0b('0x8'));var client=jayson[_0x1e0b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a30b6,_0x1db2a3,_0x2ef804){return new BPromise(function(_0x3885a9,_0x54ef1d){return client[_0x1e0b('0xa')](_0x3a30b6,_0x2ef804)[_0x1e0b('0xb')](function(_0x3274b8){logger[_0x1e0b('0xc')](_0x1e0b('0xd'),_0x1db2a3,_0x1e0b('0xe'));logger['debug'](_0x1e0b('0xf'),_0x1db2a3,'request\x20sent',JSON['stringify'](_0x3274b8));if(_0x3274b8['error']){if(_0x3274b8[_0x1e0b('0x10')][_0x1e0b('0x11')]===0x1f4){logger[_0x1e0b('0x10')](_0x1e0b('0xd'),_0x1db2a3,_0x3274b8[_0x1e0b('0x10')][_0x1e0b('0x12')]);return _0x54ef1d(_0x3274b8[_0x1e0b('0x10')]['message']);}logger[_0x1e0b('0x10')](_0x1e0b('0xd'),_0x1db2a3,_0x3274b8['error'][_0x1e0b('0x12')]);return _0x3885a9(_0x3274b8['error']['message']);}else{logger['info'](_0x1e0b('0xd'),_0x1db2a3,'request\x20sent');_0x3885a9(_0x3274b8[_0x1e0b('0x13')]['message']);}})[_0x1e0b('0x14')](function(_0x5985ef){logger[_0x1e0b('0x10')]('Cdr,\x20%s,\x20%s',_0x1db2a3,_0x5985ef);_0x54ef1d(_0x5985ef);});});} \ No newline at end of file +var _0xa72f=['Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa72f,0x167));var _0xfa72=function(_0x1ca93c,_0x3271ab){_0x1ca93c=_0x1ca93c-0x0;var _0x185169=_0xa72f[_0x1ca93c];return _0x185169;};'use strict';var _=require(_0xfa72('0x0'));var util=require('util');var moment=require(_0xfa72('0x1'));var BPromise=require(_0xfa72('0x2'));var rs=require(_0xfa72('0x3'));var fs=require('fs');var Redis=require(_0xfa72('0x4'));var db=require(_0xfa72('0x5'))['db'];var utils=require(_0xfa72('0x6'));var logger=require(_0xfa72('0x7'))(_0xfa72('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfa72('0x9')][_0xfa72('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8d9fdb,_0x198fd2,_0x50a726){return new BPromise(function(_0x13f9ac,_0xb5f641){return client['request'](_0x8d9fdb,_0x50a726)[_0xfa72('0xb')](function(_0x23837c){logger['info'](_0xfa72('0xc'),_0x198fd2,_0xfa72('0xd'));logger[_0xfa72('0xe')](_0xfa72('0xf'),_0x198fd2,'request\x20sent',JSON[_0xfa72('0x10')](_0x23837c));if(_0x23837c['error']){if(_0x23837c['error']['code']===0x1f4){logger[_0xfa72('0x11')](_0xfa72('0xc'),_0x198fd2,_0x23837c[_0xfa72('0x11')][_0xfa72('0x12')]);return _0xb5f641(_0x23837c[_0xfa72('0x11')][_0xfa72('0x12')]);}logger[_0xfa72('0x11')](_0xfa72('0xc'),_0x198fd2,_0x23837c[_0xfa72('0x11')]['message']);return _0x13f9ac(_0x23837c['error'][_0xfa72('0x12')]);}else{logger[_0xfa72('0x13')](_0xfa72('0xc'),_0x198fd2,_0xfa72('0xd'));_0x13f9ac(_0x23837c[_0xfa72('0x14')]['message']);}})[_0xfa72('0x15')](function(_0x385510){logger[_0xfa72('0x11')](_0xfa72('0xc'),_0x198fd2,_0x385510);_0xb5f641(_0x385510);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 263786a..318fcf6 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 _0x6766=['isAuthenticated','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./cdr.controller','get','index'];(function(_0x2a9051,_0x43dc8a){var _0x5311ed=function(_0x4841a4){while(--_0x4841a4){_0x2a9051['push'](_0x2a9051['shift']());}};_0x5311ed(++_0x43dc8a);}(_0x6766,0x16d));var _0x6676=function(_0x254081,_0x20731a){_0x254081=_0x254081-0x0;var _0x5d1e2a=_0x6766[_0x254081];return _0x5d1e2a;};'use strict';var multer=require(_0x6676('0x0'));var util=require(_0x6676('0x1'));var path=require('path');var timeout=require(_0x6676('0x2'));var express=require('express');var router=express[_0x6676('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6676('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6676('0x5'));var controller=require(_0x6676('0x6'));router[_0x6676('0x7')]('/',auth['isAuthenticated'](),controller[_0x6676('0x8')]);router[_0x6676('0x7')]('/describe',auth[_0x6676('0x9')](),controller['describe']);router['get'](_0x6676('0xa'),auth[_0x6676('0x9')](),controller[_0x6676('0xb')]);router[_0x6676('0xc')]('/',auth[_0x6676('0x9')](),controller[_0x6676('0xd')]);router['put'](_0x6676('0xa'),auth[_0x6676('0x9')](),controller[_0x6676('0xe')]);router[_0x6676('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6676('0x10')]);module['exports']=router; \ No newline at end of file +var _0xfa47=['isAuthenticated','index','/describe','/:id','show','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cdr.controller','get'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0xfa47,0xa9));var _0x7fa4=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0xfa47[_0x1e91eb];return _0x2af75a;};'use strict';var multer=require(_0x7fa4('0x0'));var util=require(_0x7fa4('0x1'));var path=require(_0x7fa4('0x2'));var timeout=require(_0x7fa4('0x3'));var express=require(_0x7fa4('0x4'));var router=express[_0x7fa4('0x5')]();var fs_extra=require(_0x7fa4('0x6'));var auth=require(_0x7fa4('0x7'));var interaction=require(_0x7fa4('0x8'));var config=require('../../config/environment');var controller=require(_0x7fa4('0x9'));router[_0x7fa4('0xa')]('/',auth[_0x7fa4('0xb')](),controller[_0x7fa4('0xc')]);router['get'](_0x7fa4('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x7fa4('0xa')](_0x7fa4('0xe'),auth['isAuthenticated'](),controller[_0x7fa4('0xf')]);router['post']('/',auth[_0x7fa4('0xb')](),controller[_0x7fa4('0x10')]);router[_0x7fa4('0x11')]('/:id',auth[_0x7fa4('0xb')](),controller[_0x7fa4('0x12')]);router[_0x7fa4('0x13')](_0x7fa4('0xe'),auth[_0x7fa4('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 3bca093..c9c2fdc 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 _0xc1e6=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xc1e6,0x1a4));var _0x6c1e=function(_0x2f2344,_0x4afc58){_0x2f2344=_0x2f2344-0x0;var _0xaa79ff=_0xc1e6[_0x2f2344];return _0xaa79ff;};'use strict';var Sequelize=require('sequelize');module[_0x6c1e('0x0')]={'priority':{'type':Sequelize[_0x6c1e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6c1e('0x2')],'allowNull':![],'defaultValue':_0x6c1e('0x3')},'appdata':{'type':Sequelize[_0x6c1e('0x4')]()},'description':{'type':Sequelize[_0x6c1e('0x2')]},'interval':{'type':Sequelize[_0x6c1e('0x2')],'defaultValue':_0x6c1e('0x5')}}; \ No newline at end of file +var _0xf59d=['TEXT','*,*,*,*','sequelize'];(function(_0x143d71,_0x25c7ed){var _0x598996=function(_0x138139){while(--_0x138139){_0x143d71['push'](_0x143d71['shift']());}};_0x598996(++_0x25c7ed);}(_0xf59d,0xe6));var _0xdf59=function(_0x304a13,_0x24fe84){_0x304a13=_0x304a13-0x0;var _0x37684f=_0xf59d[_0x304a13];return _0x37684f;};'use strict';var Sequelize=require(_0xdf59('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdf59('0x1')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xdf59('0x2')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 20efb0d..e755701 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 _0xa7cb=['moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','length','include','merge','options','find','catch','body','zip-dir','fast-json-patch'];(function(_0x150712,_0x2e817e){var _0x5d3a2f=function(_0x27be60){while(--_0x27be60){_0x150712['push'](_0x150712['shift']());}};_0x5d3a2f(++_0x2e817e);}(_0xa7cb,0x14e));var _0xba7c=function(_0x4bbd93,_0x205605){_0x4bbd93=_0x4bbd93-0x0;var _0x669c4=_0xa7cb[_0x4bbd93];return _0x669c4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xba7c('0x0'));var jsonpatch=require(_0xba7c('0x1'));var rp=require('request-promise');var moment=require(_0xba7c('0x2'));var BPromise=require(_0xba7c('0x3'));var Mustache=require('mustache');var util=require(_0xba7c('0x4'));var path=require('path');var sox=require(_0xba7c('0x5'));var csv=require('to-csv');var ejs=require(_0xba7c('0x6'));var fs=require('fs');var fs_extra=require(_0xba7c('0x7'));var _=require(_0xba7c('0x8'));var squel=require('squel');var crypto=require(_0xba7c('0x9'));var jsforce=require(_0xba7c('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xba7c('0xb'));var Papa=require(_0xba7c('0xc'));var Redis=require('ioredis');var authService=require(_0xba7c('0xd'));var qs=require(_0xba7c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xba7c('0xf'))(_0xba7c('0x10'));var utils=require(_0xba7c('0x11'));var config=require(_0xba7c('0x12'));var licenseUtil=require(_0xba7c('0x13'));var db=require(_0xba7c('0x14'))['db'];function respondWithStatusCode(_0x3526b4,_0x5d26db){_0x5d26db=_0x5d26db||0xcc;return function(_0x17c837){if(_0x17c837){return _0x3526b4['sendStatus'](_0x5d26db);}return _0x3526b4[_0xba7c('0x15')](_0x5d26db)[_0xba7c('0x16')]();};}function respondWithResult(_0x13d468,_0x2c4569){_0x2c4569=_0x2c4569||0xc8;return function(_0x56e19c){if(_0x56e19c){return _0x13d468[_0xba7c('0x15')](_0x2c4569)[_0xba7c('0x17')](_0x56e19c);}};}function respondWithFilteredResult(_0x3380e6,_0x3b25dc){return function(_0x4f3dec){if(_0x4f3dec){var _0x5017e0=typeof _0x3b25dc['offset']==='undefined'&&typeof _0x3b25dc['limit']===_0xba7c('0x18');var _0x10e0e1=_0x4f3dec[_0xba7c('0x19')];var _0x48eef1=_0x5017e0?0x0:_0x3b25dc[_0xba7c('0x1a')];var _0xb8bcec=_0x5017e0?_0x4f3dec[_0xba7c('0x19')]:_0x3b25dc[_0xba7c('0x1a')]+_0x3b25dc[_0xba7c('0x1b')];var _0x27852d;if(_0xb8bcec>=_0x10e0e1){_0xb8bcec=_0x10e0e1;_0x27852d=0xc8;}else{_0x27852d=0xce;}_0x3380e6[_0xba7c('0x15')](_0x27852d);return _0x3380e6[_0xba7c('0x1c')](_0xba7c('0x1d'),_0x48eef1+'-'+_0xb8bcec+'/'+_0x10e0e1)['json'](_0x4f3dec);}return null;};}function patchUpdates(_0x24fdf7){return function(_0xa9561a){try{jsonpatch[_0xba7c('0x1e')](_0xa9561a,_0x24fdf7,!![]);}catch(_0x15cd86){return BPromise[_0xba7c('0x1f')](_0x15cd86);}return _0xa9561a['save']();};}function saveUpdates(_0x3d73f7,_0x4afe9e){return function(_0x403973){if(_0x403973){return _0x403973['update'](_0x3d73f7)[_0xba7c('0x20')](function(_0x348dc2){return _0x348dc2;});}return null;};}function removeEntity(_0x5734c2,_0x56909a){return function(_0x1dfe47){if(_0x1dfe47){return _0x1dfe47[_0xba7c('0x21')]()[_0xba7c('0x20')](function(){_0x5734c2[_0xba7c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c9cd6,_0x20eea9){return function(_0x16f597){if(!_0x16f597){_0x1c9cd6[_0xba7c('0x22')](0x194);}return _0x16f597;};}function handleError(_0x3fc270,_0x280ea9){_0x280ea9=_0x280ea9||0x1f4;return function(_0x58034b){logger[_0xba7c('0x23')](_0x58034b[_0xba7c('0x24')]);if(_0x58034b[_0xba7c('0x25')]){delete _0x58034b[_0xba7c('0x25')];}_0x3fc270[_0xba7c('0x15')](_0x280ea9)[_0xba7c('0x26')](_0x58034b);};}exports[_0xba7c('0x27')]=function(_0x32d675,_0x2134bd){var _0x49920a={'raw':!![],'where':{'id':_0x32d675[_0xba7c('0x28')]['id']}},_0x41c89b={};_0x41c89b[_0xba7c('0x29')]=_[_0xba7c('0x2a')](db[_0xba7c('0x2b')][_0xba7c('0x2c')]);_0x41c89b[_0xba7c('0x2d')]=_[_0xba7c('0x2a')](_0x32d675[_0xba7c('0x2d')]);_0x41c89b[_0xba7c('0x2e')]=_['intersection'](_0x41c89b[_0xba7c('0x29')],_0x41c89b[_0xba7c('0x2d')]);_0x49920a['attributes']=_[_0xba7c('0x2f')](_0x41c89b[_0xba7c('0x29')],qs['fields'](_0x32d675[_0xba7c('0x2d')]['fields']));_0x49920a[_0xba7c('0x30')]=_0x49920a[_0xba7c('0x30')][_0xba7c('0x31')]?_0x49920a[_0xba7c('0x30')]:_0x41c89b[_0xba7c('0x29')];if(_0x32d675[_0xba7c('0x2d')]['includeAll']){_0x49920a[_0xba7c('0x32')]=[{'all':!![]}];}_0x49920a=_[_0xba7c('0x33')]({},_0x49920a,_0x32d675[_0xba7c('0x34')]);return db[_0xba7c('0x2b')][_0xba7c('0x35')](_0x49920a)['then'](handleEntityNotFound(_0x2134bd,null))[_0xba7c('0x20')](respondWithResult(_0x2134bd,null))[_0xba7c('0x36')](handleError(_0x2134bd,null));};exports['update']=function(_0x144556,_0x1d10b5){if(_0x144556['body']['id']){delete _0x144556[_0xba7c('0x37')]['id'];}return db[_0xba7c('0x2b')][_0xba7c('0x35')]({'where':{'id':_0x144556['params']['id']}})[_0xba7c('0x20')](handleEntityNotFound(_0x1d10b5,null))[_0xba7c('0x20')](saveUpdates(_0x144556[_0xba7c('0x37')],null))[_0xba7c('0x20')](respondWithResult(_0x1d10b5,null))[_0xba7c('0x36')](handleError(_0x1d10b5,null));};exports[_0xba7c('0x21')]=function(_0xce03fa,_0x20f273){return db[_0xba7c('0x2b')][_0xba7c('0x35')]({'where':{'id':_0xce03fa['params']['id']}})['then'](handleEntityNotFound(_0x20f273,null))['then'](removeEntity(_0x20f273,null))['catch'](handleError(_0x20f273,null));}; \ No newline at end of file +var _0x4a22=['rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','send','show','params','model','keys','ChatApplication','rawAttributes','intersection','query','attributes','fields','length','includeAll','include','options','find','catch','body','eml-format'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0x4a22,0x155));var _0x24a2=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x4a22[_0x4b73a2];return _0x383c66;};'use strict';var emlformat=require(_0x24a2('0x0'));var rimraf=require(_0x24a2('0x1'));var zipdir=require(_0x24a2('0x2'));var jsonpatch=require(_0x24a2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x24a2('0x4'));var Mustache=require(_0x24a2('0x5'));var util=require(_0x24a2('0x6'));var path=require(_0x24a2('0x7'));var sox=require(_0x24a2('0x8'));var csv=require('to-csv');var ejs=require(_0x24a2('0x9'));var fs=require('fs');var fs_extra=require(_0x24a2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x24a2('0xb'));var jsforce=require(_0x24a2('0xc'));var deskjs=require(_0x24a2('0xd'));var toCsv=require(_0x24a2('0xe'));var querystring=require(_0x24a2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x24a2('0x10'));var as=require(_0x24a2('0x11'));var hardwareService=require(_0x24a2('0x12'));var logger=require(_0x24a2('0x13'))(_0x24a2('0x14'));var utils=require('../../config/utils');var config=require(_0x24a2('0x15'));var licenseUtil=require(_0x24a2('0x16'));var db=require(_0x24a2('0x17'))['db'];function respondWithStatusCode(_0x5a1ab3,_0x5ce0ec){_0x5ce0ec=_0x5ce0ec||0xcc;return function(_0x4c8479){if(_0x4c8479){return _0x5a1ab3[_0x24a2('0x18')](_0x5ce0ec);}return _0x5a1ab3['status'](_0x5ce0ec)[_0x24a2('0x19')]();};}function respondWithResult(_0x438219,_0x4dcde0){_0x4dcde0=_0x4dcde0||0xc8;return function(_0x43abc5){if(_0x43abc5){return _0x438219[_0x24a2('0x1a')](_0x4dcde0)[_0x24a2('0x1b')](_0x43abc5);}};}function respondWithFilteredResult(_0x1abeba,_0x4ba437){return function(_0x43faae){if(_0x43faae){var _0x3f9fb5=typeof _0x4ba437[_0x24a2('0x1c')]===_0x24a2('0x1d')&&typeof _0x4ba437[_0x24a2('0x1e')]===_0x24a2('0x1d');var _0xdda611=_0x43faae[_0x24a2('0x1f')];var _0x108fe8=_0x3f9fb5?0x0:_0x4ba437[_0x24a2('0x1c')];var _0x49dd1a=_0x3f9fb5?_0x43faae[_0x24a2('0x1f')]:_0x4ba437[_0x24a2('0x1c')]+_0x4ba437[_0x24a2('0x1e')];var _0x6e5712;if(_0x49dd1a>=_0xdda611){_0x49dd1a=_0xdda611;_0x6e5712=0xc8;}else{_0x6e5712=0xce;}_0x1abeba[_0x24a2('0x1a')](_0x6e5712);return _0x1abeba[_0x24a2('0x20')](_0x24a2('0x21'),_0x108fe8+'-'+_0x49dd1a+'/'+_0xdda611)[_0x24a2('0x1b')](_0x43faae);}return null;};}function patchUpdates(_0x3fc85a){return function(_0x1bc4b1){try{jsonpatch[_0x24a2('0x22')](_0x1bc4b1,_0x3fc85a,!![]);}catch(_0x17410e){return BPromise[_0x24a2('0x23')](_0x17410e);}return _0x1bc4b1['save']();};}function saveUpdates(_0x2203df,_0x25dd9e){return function(_0xde19cb){if(_0xde19cb){return _0xde19cb[_0x24a2('0x24')](_0x2203df)[_0x24a2('0x25')](function(_0x558c9b){return _0x558c9b;});}return null;};}function removeEntity(_0x4a4cc4,_0x291bc5){return function(_0x493e96){if(_0x493e96){return _0x493e96[_0x24a2('0x26')]()[_0x24a2('0x25')](function(){_0x4a4cc4[_0x24a2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x373c49,_0x1c2126){return function(_0x585d66){if(!_0x585d66){_0x373c49[_0x24a2('0x18')](0x194);}return _0x585d66;};}function handleError(_0x3eabf7,_0xff2757){_0xff2757=_0xff2757||0x1f4;return function(_0xd5bf0e){logger['error'](_0xd5bf0e['stack']);if(_0xd5bf0e['name']){delete _0xd5bf0e['name'];}_0x3eabf7[_0x24a2('0x1a')](_0xff2757)[_0x24a2('0x27')](_0xd5bf0e);};}exports[_0x24a2('0x28')]=function(_0xf82d6f,_0x4e8bfb){var _0x225579={'raw':!![],'where':{'id':_0xf82d6f[_0x24a2('0x29')]['id']}},_0x757d45={};_0x757d45[_0x24a2('0x2a')]=_[_0x24a2('0x2b')](db[_0x24a2('0x2c')][_0x24a2('0x2d')]);_0x757d45['query']=_[_0x24a2('0x2b')](_0xf82d6f['query']);_0x757d45['filters']=_[_0x24a2('0x2e')](_0x757d45[_0x24a2('0x2a')],_0x757d45[_0x24a2('0x2f')]);_0x225579[_0x24a2('0x30')]=_[_0x24a2('0x2e')](_0x757d45['model'],qs[_0x24a2('0x31')](_0xf82d6f[_0x24a2('0x2f')][_0x24a2('0x31')]));_0x225579[_0x24a2('0x30')]=_0x225579['attributes'][_0x24a2('0x32')]?_0x225579[_0x24a2('0x30')]:_0x757d45[_0x24a2('0x2a')];if(_0xf82d6f[_0x24a2('0x2f')][_0x24a2('0x33')]){_0x225579[_0x24a2('0x34')]=[{'all':!![]}];}_0x225579=_['merge']({},_0x225579,_0xf82d6f[_0x24a2('0x35')]);return db['ChatApplication'][_0x24a2('0x36')](_0x225579)['then'](handleEntityNotFound(_0x4e8bfb,null))['then'](respondWithResult(_0x4e8bfb,null))[_0x24a2('0x37')](handleError(_0x4e8bfb,null));};exports[_0x24a2('0x24')]=function(_0x3f785f,_0x2e7bd3){if(_0x3f785f[_0x24a2('0x38')]['id']){delete _0x3f785f[_0x24a2('0x38')]['id'];}return db[_0x24a2('0x2c')][_0x24a2('0x36')]({'where':{'id':_0x3f785f['params']['id']}})[_0x24a2('0x25')](handleEntityNotFound(_0x2e7bd3,null))[_0x24a2('0x25')](saveUpdates(_0x3f785f[_0x24a2('0x38')],null))[_0x24a2('0x25')](respondWithResult(_0x2e7bd3,null))[_0x24a2('0x37')](handleError(_0x2e7bd3,null));};exports[_0x24a2('0x26')]=function(_0x3f71ba,_0x1f637d){return db['ChatApplication'][_0x24a2('0x36')]({'where':{'id':_0x3f71ba[_0x24a2('0x29')]['id']}})[_0x24a2('0x25')](handleEntityNotFound(_0x1f637d,null))[_0x24a2('0x25')](removeEntity(_0x1f637d,null))['catch'](handleError(_0x1f637d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index bd6f488..52053d4 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 _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index b9eed71..a7ebb83 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 _0x4257=['request\x20sent','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x4257,0x10c));var _0x7425=function(_0x578013,_0x2551dc){_0x578013=_0x578013-0x0;var _0x4092c6=_0x4257[_0x578013];return _0x4092c6;};'use strict';var _=require('lodash');var util=require(_0x7425('0x0'));var moment=require(_0x7425('0x1'));var BPromise=require(_0x7425('0x2'));var rs=require(_0x7425('0x3'));var fs=require('fs');var Redis=require(_0x7425('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7425('0x5'));var logger=require(_0x7425('0x6'))(_0x7425('0x7'));var config=require(_0x7425('0x8'));var jayson=require(_0x7425('0x9'));var client=jayson[_0x7425('0xa')][_0x7425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x274ead,_0x31474a,_0x1aa8c9){return new BPromise(function(_0x6c18cc,_0x1cf76f){return client[_0x7425('0xc')](_0x274ead,_0x1aa8c9)[_0x7425('0xd')](function(_0x398061){logger[_0x7425('0xe')](_0x7425('0xf'),_0x31474a,'request\x20sent');logger[_0x7425('0x10')](_0x7425('0x11'),_0x31474a,_0x7425('0x12'),JSON['stringify'](_0x398061));if(_0x398061[_0x7425('0x13')]){if(_0x398061[_0x7425('0x13')]['code']===0x1f4){logger[_0x7425('0x13')](_0x7425('0xf'),_0x31474a,_0x398061[_0x7425('0x13')][_0x7425('0x14')]);return _0x1cf76f(_0x398061['error'][_0x7425('0x14')]);}logger[_0x7425('0x13')](_0x7425('0xf'),_0x31474a,_0x398061[_0x7425('0x13')]['message']);return _0x6c18cc(_0x398061[_0x7425('0x13')][_0x7425('0x14')]);}else{logger[_0x7425('0xe')](_0x7425('0xf'),_0x31474a,_0x7425('0x12'));_0x6c18cc(_0x398061['result'][_0x7425('0x14')]);}})[_0x7425('0x15')](function(_0x4aed7c){logger['error'](_0x7425('0xf'),_0x31474a,_0x4aed7c);_0x1cf76f(_0x4aed7c);});});} \ No newline at end of file +var _0x7cf8=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','ChatApplication,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4cc45e,_0x162064){var _0x5498ee=function(_0x31670b){while(--_0x31670b){_0x4cc45e['push'](_0x4cc45e['shift']());}};_0x5498ee(++_0x162064);}(_0x7cf8,0x85));var _0x87cf=function(_0x2ad5c2,_0x586e76){_0x2ad5c2=_0x2ad5c2-0x0;var _0x2f7db6=_0x7cf8[_0x2ad5c2];return _0x2f7db6;};'use strict';var _=require('lodash');var util=require(_0x87cf('0x0'));var moment=require('moment');var BPromise=require(_0x87cf('0x1'));var rs=require(_0x87cf('0x2'));var fs=require('fs');var Redis=require(_0x87cf('0x3'));var db=require(_0x87cf('0x4'))['db'];var utils=require(_0x87cf('0x5'));var logger=require(_0x87cf('0x6'))(_0x87cf('0x7'));var config=require(_0x87cf('0x8'));var jayson=require(_0x87cf('0x9'));var client=jayson[_0x87cf('0xa')][_0x87cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7e483a,_0x2d54d7,_0x5e7255){return new BPromise(function(_0x1491e9,_0xc4b06c){return client[_0x87cf('0xc')](_0x7e483a,_0x5e7255)[_0x87cf('0xd')](function(_0x51f6ec){logger[_0x87cf('0xe')]('ChatApplication,\x20%s,\x20%s',_0x2d54d7,'request\x20sent');logger[_0x87cf('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x2d54d7,_0x87cf('0x10'),JSON[_0x87cf('0x11')](_0x51f6ec));if(_0x51f6ec[_0x87cf('0x12')]){if(_0x51f6ec[_0x87cf('0x12')]['code']===0x1f4){logger[_0x87cf('0x12')](_0x87cf('0x13'),_0x2d54d7,_0x51f6ec[_0x87cf('0x12')]['message']);return _0xc4b06c(_0x51f6ec[_0x87cf('0x12')]['message']);}logger[_0x87cf('0x12')](_0x87cf('0x13'),_0x2d54d7,_0x51f6ec[_0x87cf('0x12')]['message']);return _0x1491e9(_0x51f6ec[_0x87cf('0x12')][_0x87cf('0x14')]);}else{logger[_0x87cf('0xe')](_0x87cf('0x13'),_0x2d54d7,_0x87cf('0x10'));_0x1491e9(_0x51f6ec[_0x87cf('0x15')][_0x87cf('0x14')]);}})[_0x87cf('0x16')](function(_0x4eb4c4){logger[_0x87cf('0x12')]('ChatApplication,\x20%s,\x20%s',_0x2d54d7,_0x4eb4c4);_0xc4b06c(_0x4eb4c4);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 1169ff7..ad66ebd 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 _0x367e=['/:id','isAuthenticated','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','show','put'];(function(_0x30eb53,_0x26dbbe){var _0xf4e08c=function(_0x47e7d8){while(--_0x47e7d8){_0x30eb53['push'](_0x30eb53['shift']());}};_0xf4e08c(++_0x26dbbe);}(_0x367e,0xd1));var _0xe367=function(_0x44d1d7,_0x2bbc3b){_0x44d1d7=_0x44d1d7-0x0;var _0x4951c8=_0x367e[_0x44d1d7];return _0x4951c8;};'use strict';var multer=require(_0xe367('0x0'));var util=require(_0xe367('0x1'));var path=require('path');var timeout=require(_0xe367('0x2'));var express=require('express');var router=express[_0xe367('0x3')]();var fs_extra=require(_0xe367('0x4'));var auth=require(_0xe367('0x5'));var interaction=require(_0xe367('0x6'));var config=require(_0xe367('0x7'));var controller=require(_0xe367('0x8'));router[_0xe367('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe367('0xa')]);router[_0xe367('0xb')](_0xe367('0xc'),auth[_0xe367('0xd')](),controller[_0xe367('0xe')]);router['delete'](_0xe367('0xc'),auth[_0xe367('0xd')](),controller[_0xe367('0xf')]);module[_0xe367('0x10')]=router; \ No newline at end of file +var _0x83bf=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','update'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x83bf,0x163));var _0xf83b=function(_0x50a333,_0x399fb5){_0x50a333=_0x50a333-0x0;var _0x21156f=_0x83bf[_0x50a333];return _0x21156f;};'use strict';var multer=require(_0xf83b('0x0'));var util=require('util');var path=require(_0xf83b('0x1'));var timeout=require(_0xf83b('0x2'));var express=require(_0xf83b('0x3'));var router=express[_0xf83b('0x4')]();var fs_extra=require(_0xf83b('0x5'));var auth=require(_0xf83b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf83b('0x7'));var controller=require('./chatApplication.controller');router[_0xf83b('0x8')](_0xf83b('0x9'),auth[_0xf83b('0xa')](),controller[_0xf83b('0xb')]);router['put'](_0xf83b('0x9'),auth['isAuthenticated'](),controller[_0xf83b('0xc')]);router[_0xf83b('0xd')](_0xf83b('0x9'),auth['isAuthenticated'](),controller[_0xf83b('0xe')]);module[_0xf83b('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index e84ec28..b6976eb 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 _0x56ba=['sequelize','exports','STRING','BOOLEAN'];(function(_0x142cb4,_0x2a9134){var _0x34d463=function(_0x31d2e1){while(--_0x31d2e1){_0x142cb4['push'](_0x142cb4['shift']());}};_0x34d463(++_0x2a9134);}(_0x56ba,0x84));var _0xa56b=function(_0x31104e,_0x18e6d6){_0x31104e=_0x31104e-0x0;var _0x5ca9d4=_0x56ba[_0x31104e];return _0x5ca9d4;};'use strict';var Sequelize=require(_0xa56b('0x0'));module[_0xa56b('0x1')]={'name':{'type':Sequelize[_0xa56b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa56b('0x2')]},'write':{'type':Sequelize[_0xa56b('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7e92=['exports','BOOLEAN'];(function(_0x5dc062,_0x253dde){var _0x579a5f=function(_0x5098fb){while(--_0x5098fb){_0x5dc062['push'](_0x5dc062['shift']());}};_0x579a5f(++_0x253dde);}(_0x7e92,0x68));var _0x27e9=function(_0x48d487,_0x4f3929){_0x48d487=_0x48d487-0x0;var _0x4f5559=_0x7e92[_0x48d487];return _0x4f5559;};'use strict';var Sequelize=require('sequelize');module[_0x27e9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x27e9('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index a72a49b..4b329ab 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 _0xb3fa=['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','defaults','redis','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','include','findAll','rows','show','create','body','find','destroy','params','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','filter','options','removeMembers','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb3fa,0x1ad));var _0xab3f=function(_0x42acf0,_0x10c701){_0x42acf0=_0x42acf0-0x0;var _0x1676c9=_0xb3fa[_0x42acf0];return _0x1676c9;};'use strict';var emlformat=require(_0xab3f('0x0'));var rimraf=require(_0xab3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xab3f('0x2'));var moment=require(_0xab3f('0x3'));var BPromise=require(_0xab3f('0x4'));var Mustache=require(_0xab3f('0x5'));var util=require(_0xab3f('0x6'));var path=require(_0xab3f('0x7'));var sox=require(_0xab3f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab3f('0x9'));var _=require(_0xab3f('0xa'));var squel=require(_0xab3f('0xb'));var crypto=require(_0xab3f('0xc'));var jsforce=require(_0xab3f('0xd'));var deskjs=require(_0xab3f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xab3f('0xf'));var Papa=require(_0xab3f('0x10'));var Redis=require(_0xab3f('0x11'));var authService=require(_0xab3f('0x12'));var qs=require(_0xab3f('0x13'));var as=require(_0xab3f('0x14'));var hardwareService=require(_0xab3f('0x15'));var logger=require(_0xab3f('0x16'))('api');var utils=require(_0xab3f('0x17'));var config=require(_0xab3f('0x18'));var licenseUtil=require(_0xab3f('0x19'));var db=require(_0xab3f('0x1a'))['db'];config['redis']=_[_0xab3f('0x1b')](config[_0xab3f('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xab3f('0x1d'))(new Redis(config[_0xab3f('0x1c')]));require(_0xab3f('0x1e'))[_0xab3f('0x1f')](socket);var jayson=require(_0xab3f('0x20'));var client=jayson[_0xab3f('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48a09a,_0x47fe73,_0x36f121,_0x447424){return new BPromise(function(_0x26336e,_0x4502af){var _0x1287ad=_0x447424||client;return _0x1287ad[_0xab3f('0x22')](_0x48a09a,_0x36f121)[_0xab3f('0x23')](function(_0x516873){logger[_0xab3f('0x24')](_0xab3f('0x25'),_0x47fe73,_0xab3f('0x26'));logger[_0xab3f('0x27')](_0xab3f('0x28'),_0x47fe73,_0xab3f('0x26'),JSON[_0xab3f('0x29')](_0x516873));if(_0x516873[_0xab3f('0x2a')]){if(_0x516873[_0xab3f('0x2a')][_0xab3f('0x2b')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x47fe73,_0x516873[_0xab3f('0x2a')][_0xab3f('0x2c')]);return _0x4502af(_0x516873['error'][_0xab3f('0x2c')]);}logger[_0xab3f('0x2a')](_0xab3f('0x25'),_0x47fe73,_0x516873[_0xab3f('0x2a')][_0xab3f('0x2c')]);return _0x26336e(_0x516873[_0xab3f('0x2a')][_0xab3f('0x2c')]);}else{logger[_0xab3f('0x24')](_0xab3f('0x25'),_0x47fe73,_0xab3f('0x26'));_0x26336e(_0x516873[_0xab3f('0x2d')]['message']);}})[_0xab3f('0x2e')](function(_0x431fe0){logger['error'](_0xab3f('0x25'),_0x47fe73,_0x431fe0);_0x4502af(_0x431fe0);});});}function respondWithStatusCode(_0x515342,_0x295fe4){_0x295fe4=_0x295fe4||0xcc;return function(_0x26daad){if(_0x26daad){return _0x515342[_0xab3f('0x2f')](_0x295fe4);}return _0x515342[_0xab3f('0x30')](_0x295fe4)[_0xab3f('0x31')]();};}function respondWithResult(_0x2b7fed,_0x2db274){_0x2db274=_0x2db274||0xc8;return function(_0x32c44a){if(_0x32c44a){return _0x2b7fed[_0xab3f('0x30')](_0x2db274)[_0xab3f('0x32')](_0x32c44a);}};}function respondWithFilteredResult(_0x384b82,_0x377d79){return function(_0x33beb2){if(_0x33beb2){var _0x39e7de=typeof _0x377d79[_0xab3f('0x33')]===_0xab3f('0x34')&&typeof _0x377d79[_0xab3f('0x35')]==='undefined';var _0x5c5d66=_0x33beb2[_0xab3f('0x36')];var _0x7f5354=_0x39e7de?0x0:_0x377d79[_0xab3f('0x33')];var _0x40db99=_0x39e7de?_0x33beb2[_0xab3f('0x36')]:_0x377d79[_0xab3f('0x33')]+_0x377d79['limit'];var _0x25f61f;if(_0x40db99>=_0x5c5d66){_0x40db99=_0x5c5d66;_0x25f61f=0xc8;}else{_0x25f61f=0xce;}_0x384b82[_0xab3f('0x30')](_0x25f61f);return _0x384b82[_0xab3f('0x37')](_0xab3f('0x38'),_0x7f5354+'-'+_0x40db99+'/'+_0x5c5d66)[_0xab3f('0x32')](_0x33beb2);}return null;};}function patchUpdates(_0x591944){return function(_0x504968){try{jsonpatch[_0xab3f('0x39')](_0x504968,_0x591944,!![]);}catch(_0x13f993){return BPromise[_0xab3f('0x3a')](_0x13f993);}return _0x504968['save']();};}function saveUpdates(_0x46c8e0,_0x263c3b){return function(_0x22a790){if(_0x22a790){return _0x22a790[_0xab3f('0x3b')](_0x46c8e0)[_0xab3f('0x23')](function(_0x277336){return _0x277336;});}return null;};}function removeEntity(_0x591a2f,_0x2f9c59){return function(_0x4cc598){if(_0x4cc598){return _0x4cc598['destroy']()[_0xab3f('0x23')](function(){_0x591a2f[_0xab3f('0x30')](0xcc)[_0xab3f('0x31')]();});}};}function handleEntityNotFound(_0x58ac3f,_0x3607df){return function(_0x2c44b7){if(!_0x2c44b7){_0x58ac3f[_0xab3f('0x2f')](0x194);}return _0x2c44b7;};}function handleError(_0x89da1a,_0x3a2ea3){_0x3a2ea3=_0x3a2ea3||0x1f4;return function(_0x104991){logger[_0xab3f('0x2a')](_0x104991['stack']);if(_0x104991[_0xab3f('0x3c')]){delete _0x104991[_0xab3f('0x3c')];}_0x89da1a[_0xab3f('0x30')](_0x3a2ea3)[_0xab3f('0x3d')](_0x104991);};}exports[_0xab3f('0x3e')]=function(_0x29432f,_0x2b0c15){var _0x5c6008={},_0x35e902={},_0x3ac6f0={'count':0x0,'rows':[]};var _0x1ff1dd=_[_0xab3f('0x3f')](db[_0xab3f('0x40')][_0xab3f('0x41')],function(_0x17ec92){return{'name':_0x17ec92[_0xab3f('0x42')],'type':_0x17ec92[_0xab3f('0x43')][_0xab3f('0x44')]};});_0x35e902[_0xab3f('0x45')]=_[_0xab3f('0x3f')](_0x1ff1dd,_0xab3f('0x3c'));_0x35e902[_0xab3f('0x46')]=_[_0xab3f('0x47')](_0x29432f[_0xab3f('0x46')]);_0x35e902[_0xab3f('0x48')]=_[_0xab3f('0x49')](_0x35e902[_0xab3f('0x45')],_0x35e902[_0xab3f('0x46')]);_0x5c6008['attributes']=_[_0xab3f('0x49')](_0x35e902[_0xab3f('0x45')],qs[_0xab3f('0x4a')](_0x29432f[_0xab3f('0x46')]['fields']));_0x5c6008[_0xab3f('0x4b')]=_0x5c6008[_0xab3f('0x4b')][_0xab3f('0x4c')]?_0x5c6008[_0xab3f('0x4b')]:_0x35e902[_0xab3f('0x45')];if(!_0x29432f[_0xab3f('0x46')][_0xab3f('0x4d')](_0xab3f('0x4e'))){_0x5c6008[_0xab3f('0x35')]=qs['limit'](_0x29432f[_0xab3f('0x46')][_0xab3f('0x35')]);_0x5c6008['offset']=qs[_0xab3f('0x33')](_0x29432f[_0xab3f('0x46')]['offset']);}_0x5c6008[_0xab3f('0x4f')]=qs[_0xab3f('0x50')](_0x29432f['query'][_0xab3f('0x50')]);_0x5c6008[_0xab3f('0x51')]=qs[_0xab3f('0x48')](_[_0xab3f('0x52')](_0x29432f[_0xab3f('0x46')],_0x35e902[_0xab3f('0x48')]),_0x1ff1dd);if(_0x29432f[_0xab3f('0x46')]['filter']){_0x5c6008[_0xab3f('0x51')]=_[_0xab3f('0x53')](_0x5c6008[_0xab3f('0x51')],{'$or':_[_0xab3f('0x3f')](_0x1ff1dd,function(_0x5f4ad0){if(_0x5f4ad0[_0xab3f('0x43')]!=='VIRTUAL'){var _0x174828={};_0x174828[_0x5f4ad0[_0xab3f('0x3c')]]={'$like':'%'+_0x29432f[_0xab3f('0x46')]['filter']+'%'};return _0x174828;}})});}_0x5c6008=_[_0xab3f('0x53')]({},_0x5c6008,_0x29432f['options']);var _0x49b1e6={'where':_0x5c6008[_0xab3f('0x51')]};return db[_0xab3f('0x40')][_0xab3f('0x36')](_0x49b1e6)[_0xab3f('0x23')](function(_0x49487b){_0x3ac6f0['count']=_0x49487b;if(_0x29432f[_0xab3f('0x46')][_0xab3f('0x54')]){_0x5c6008[_0xab3f('0x55')]=[{'all':!![]}];}return db[_0xab3f('0x40')][_0xab3f('0x56')](_0x5c6008);})[_0xab3f('0x23')](function(_0x424c89){_0x3ac6f0[_0xab3f('0x57')]=_0x424c89;return _0x3ac6f0;})[_0xab3f('0x23')](respondWithFilteredResult(_0x2b0c15,_0x5c6008))['catch'](handleError(_0x2b0c15,null));};exports[_0xab3f('0x58')]=function(_0x1ce675,_0x2d9314){var _0x2e8e47={'raw':!![],'where':{'id':_0x1ce675['params']['id']}},_0x2a60db={};_0x2a60db['model']=_[_0xab3f('0x47')](db[_0xab3f('0x40')][_0xab3f('0x41')]);_0x2a60db[_0xab3f('0x46')]=_['keys'](_0x1ce675[_0xab3f('0x46')]);_0x2a60db[_0xab3f('0x48')]=_[_0xab3f('0x49')](_0x2a60db['model'],_0x2a60db[_0xab3f('0x46')]);_0x2e8e47[_0xab3f('0x4b')]=_['intersection'](_0x2a60db['model'],qs['fields'](_0x1ce675[_0xab3f('0x46')]['fields']));_0x2e8e47['attributes']=_0x2e8e47[_0xab3f('0x4b')]['length']?_0x2e8e47[_0xab3f('0x4b')]:_0x2a60db[_0xab3f('0x45')];if(_0x1ce675['query'][_0xab3f('0x54')]){_0x2e8e47['include']=[{'all':!![]}];}_0x2e8e47=_['merge']({},_0x2e8e47,_0x1ce675['options']);return db[_0xab3f('0x40')]['find'](_0x2e8e47)[_0xab3f('0x23')](handleEntityNotFound(_0x2d9314,null))[_0xab3f('0x23')](respondWithResult(_0x2d9314,null))[_0xab3f('0x2e')](handleError(_0x2d9314,null));};exports[_0xab3f('0x59')]=function(_0x108875,_0x6514ae){return db[_0xab3f('0x40')][_0xab3f('0x59')](_0x108875[_0xab3f('0x5a')],{})[_0xab3f('0x23')](respondWithResult(_0x6514ae,0xc9))[_0xab3f('0x2e')](handleError(_0x6514ae,null));};exports['update']=function(_0xaa42aa,_0x548eef){if(_0xaa42aa[_0xab3f('0x5a')]['id']){delete _0xaa42aa['body']['id'];}return db['ChatGroup'][_0xab3f('0x5b')]({'where':{'id':_0xaa42aa['params']['id']}})['then'](handleEntityNotFound(_0x548eef,null))[_0xab3f('0x23')](saveUpdates(_0xaa42aa['body'],null))[_0xab3f('0x23')](respondWithResult(_0x548eef,null))['catch'](handleError(_0x548eef,null));};exports[_0xab3f('0x5c')]=function(_0x17cb3c,_0x3f2e83){return db['ChatGroup'][_0xab3f('0x5b')]({'where':{'id':_0x17cb3c[_0xab3f('0x5d')]['id']}})[_0xab3f('0x23')](handleEntityNotFound(_0x3f2e83,null))[_0xab3f('0x23')](removeEntity(_0x3f2e83,null))[_0xab3f('0x2e')](handleError(_0x3f2e83,null));};exports[_0xab3f('0x5e')]=function(_0xe7090f,_0x89e74c){return db[_0xab3f('0x40')][_0xab3f('0x5e')]()[_0xab3f('0x23')](respondWithResult(_0x89e74c,null))[_0xab3f('0x2e')](handleError(_0x89e74c,null));};exports['getUnread']=function(_0x1bcc52,_0x3a494f,_0x26a7f6){return db[_0xab3f('0x5f')][_0xab3f('0x36')]({'where':{'ChatGroupId':_0x1bcc52[_0xab3f('0x5d')]['id'],'ToId':_0x1bcc52[_0xab3f('0x60')]['id'],'read':![]}})[_0xab3f('0x23')](function(_0x30ebb4){return{'id':_[_0xab3f('0x61')](_0x1bcc52[_0xab3f('0x5d')]['id']),'count':_0x30ebb4};})[_0xab3f('0x23')](respondWithResult(_0x3a494f,null))[_0xab3f('0x2e')](handleError(_0x3a494f,null));};exports[_0xab3f('0x62')]=function(_0x2b3d9c,_0x45b218,_0x2434f2){return db[_0xab3f('0x40')][_0xab3f('0x5b')]({'where':{'id':_0x2b3d9c['params']['id']}})[_0xab3f('0x23')](handleEntityNotFound(_0x45b218,null))['then'](function(_0x1974a7){if(_0x1974a7){return _0x1974a7[_0xab3f('0x62')](_0x2b3d9c['body'][_0xab3f('0x63')],_[_0xab3f('0x64')](_0x2b3d9c[_0xab3f('0x5a')],[_0xab3f('0x63'),'id'])||{});}})[_0xab3f('0x23')](respondWithResult(_0x45b218,null))[_0xab3f('0x2e')](handleError(_0x45b218,null));};exports[_0xab3f('0x65')]=function(_0x337802,_0x1d1669,_0x936f26){var _0x5d44e9={};var _0x6f546={};var _0x38661e;var _0x11b800;return db[_0xab3f('0x40')]['findOne']({'where':{'id':_0x337802[_0xab3f('0x5d')]['id']}})[_0xab3f('0x23')](handleEntityNotFound(_0x1d1669,null))[_0xab3f('0x23')](function(_0x5ba514){if(_0x5ba514){_0x38661e=_0x5ba514;_0x6f546['model']=_['keys'](db['User'][_0xab3f('0x41')]);_0x6f546['query']=_[_0xab3f('0x47')](_0x337802[_0xab3f('0x46')]);_0x6f546[_0xab3f('0x48')]=_[_0xab3f('0x49')](_0x6f546[_0xab3f('0x45')],_0x6f546['query']);_0x5d44e9[_0xab3f('0x4b')]=_['intersection'](_0x6f546[_0xab3f('0x45')],qs[_0xab3f('0x4a')](_0x337802[_0xab3f('0x46')]['fields']));_0x5d44e9['attributes']=_0x5d44e9[_0xab3f('0x4b')]['length']?_0x5d44e9['attributes']:_0x6f546[_0xab3f('0x45')];_0x5d44e9['order']=qs[_0xab3f('0x50')](_0x337802[_0xab3f('0x46')][_0xab3f('0x50')]);_0x5d44e9[_0xab3f('0x51')]=qs['filters'](_[_0xab3f('0x52')](_0x337802[_0xab3f('0x46')],_0x6f546[_0xab3f('0x48')]));if(_0x337802[_0xab3f('0x46')]['filter']){_0x5d44e9[_0xab3f('0x51')]=_[_0xab3f('0x53')](_0x5d44e9['where'],{'$or':_[_0xab3f('0x3f')](_0x5d44e9[_0xab3f('0x4b')],function(_0x346459){var _0x5c4b62={};_0x5c4b62[_0x346459]={'$like':'%'+_0x337802[_0xab3f('0x46')][_0xab3f('0x66')]+'%'};return _0x5c4b62;})});}_0x5d44e9=_[_0xab3f('0x53')]({},_0x5d44e9,_0x337802[_0xab3f('0x67')]);return _0x38661e['getMembers'](_0x5d44e9);}})[_0xab3f('0x23')](function(_0x915765){if(_0x915765){_0x11b800=_0x915765[_0xab3f('0x4c')];if(!_0x337802[_0xab3f('0x46')]['hasOwnProperty'](_0xab3f('0x4e'))){_0x5d44e9[_0xab3f('0x35')]=qs[_0xab3f('0x35')](_0x337802[_0xab3f('0x46')][_0xab3f('0x35')]);_0x5d44e9[_0xab3f('0x33')]=qs[_0xab3f('0x33')](_0x337802['query']['offset']);}return _0x38661e[_0xab3f('0x65')](_0x5d44e9);}})[_0xab3f('0x23')](function(_0x15abe8){if(_0x15abe8){return _0x15abe8?{'count':_0x11b800,'rows':_0x15abe8}:null;}})[_0xab3f('0x23')](respondWithResult(_0x1d1669,null))[_0xab3f('0x2e')](handleError(_0x1d1669,null));};exports[_0xab3f('0x68')]=function(_0x9a6b99,_0x1083be,_0x4dcba3){return db['ChatGroup'][_0xab3f('0x5b')]({'where':{'id':_0x9a6b99[_0xab3f('0x5d')]['id']}})[_0xab3f('0x23')](handleEntityNotFound(_0x1083be,null))[_0xab3f('0x23')](function(_0x4a7400){if(_0x4a7400){return _0x4a7400[_0xab3f('0x68')](_0x9a6b99[_0xab3f('0x46')][_0xab3f('0x63')]);}})[_0xab3f('0x23')](respondWithStatusCode(_0x1083be,null))['catch'](handleError(_0x1083be,null));};exports['addMessage']=function(_0x383950,_0xc87238,_0x109cbf){if(_0x383950[_0xab3f('0x5a')]['id']){delete _0x383950[_0xab3f('0x5a')]['id'];}return db[_0xab3f('0x40')]['find']({'where':{'id':_0x383950[_0xab3f('0x5d')]['id']}})['then'](handleEntityNotFound(_0xc87238,null))['then'](function(_0x147f30){if(_0x147f30){_0x383950['body']['ChatGroupId']=_0x147f30['id'];return db['ChatInternalMessage'][_0xab3f('0x59')](_0x383950['body']);}})[_0xab3f('0x23')](respondWithResult(_0xc87238,null))[_0xab3f('0x2e')](handleError(_0xc87238,null));};exports[_0xab3f('0x69')]=function(_0x6acbf7,_0x5898b6,_0x1ceec8){var _0x342294={};var _0x3799a2={};var _0x387947;var _0x41b2e7;return db['ChatGroup'][_0xab3f('0x6a')]({'where':{'id':_0x6acbf7['params']['id']}})[_0xab3f('0x23')](handleEntityNotFound(_0x5898b6,null))['then'](function(_0x3b6cf7){if(_0x3b6cf7){_0x387947=_0x3b6cf7;_0x3799a2[_0xab3f('0x45')]=_[_0xab3f('0x47')](db['ChatInternalMessage'][_0xab3f('0x41')]);_0x3799a2[_0xab3f('0x46')]=_['keys'](_0x6acbf7['query']);_0x3799a2[_0xab3f('0x48')]=_[_0xab3f('0x49')](_0x3799a2[_0xab3f('0x45')],_0x3799a2[_0xab3f('0x46')]);_0x342294[_0xab3f('0x4b')]=_['intersection'](_0x3799a2[_0xab3f('0x45')],qs['fields'](_0x6acbf7['query'][_0xab3f('0x4a')]));_0x342294[_0xab3f('0x4b')]=_0x342294[_0xab3f('0x4b')][_0xab3f('0x4c')]?_0x342294['attributes']:_0x3799a2[_0xab3f('0x45')];_0x342294[_0xab3f('0x4f')]=qs[_0xab3f('0x50')](_0x6acbf7[_0xab3f('0x46')][_0xab3f('0x50')]);_0x342294[_0xab3f('0x51')]=qs[_0xab3f('0x48')](_[_0xab3f('0x52')](_0x6acbf7[_0xab3f('0x46')],_0x3799a2[_0xab3f('0x48')]));if(_0x6acbf7[_0xab3f('0x46')][_0xab3f('0x66')]){_0x342294[_0xab3f('0x51')]=_[_0xab3f('0x53')](_0x342294[_0xab3f('0x51')],{'$or':_['map'](_0x342294[_0xab3f('0x4b')],function(_0x5cd8d8){var _0x225602={};_0x225602[_0x5cd8d8]={'$like':'%'+_0x6acbf7['query'][_0xab3f('0x66')]+'%'};return _0x225602;})});}if(_0x6acbf7['query'][_0xab3f('0x6b')]){var _0x96a01e=_0x6acbf7[_0xab3f('0x46')][_0xab3f('0x6b')][_0xab3f('0x6c')](',');var _0x3e7d94={};_0x3e7d94[_0x96a01e[0x0]]={'$gte':moment(_0x96a01e[0x1])[_0xab3f('0x6d')](_0xab3f('0x6e'))};_0x342294['where']=_[_0xab3f('0x53')](_0x342294['where'],_0x3e7d94);}_0x342294=_['merge']({},_0x342294,_0x6acbf7[_0xab3f('0x67')]);return _0x387947[_0xab3f('0x69')](_0x342294);}})[_0xab3f('0x23')](function(_0xde150e){if(_0xde150e){_0x41b2e7=_0xde150e[_0xab3f('0x4c')];if(!_0x6acbf7[_0xab3f('0x46')]['hasOwnProperty']('nolimit')){_0x342294[_0xab3f('0x35')]=qs[_0xab3f('0x35')](_0x6acbf7[_0xab3f('0x46')][_0xab3f('0x35')]);_0x342294['offset']=qs[_0xab3f('0x33')](_0x6acbf7[_0xab3f('0x46')]['offset']);}return _0x387947[_0xab3f('0x69')](_0x342294);}})[_0xab3f('0x23')](function(_0x259607){if(_0x259607){return _0x259607?{'count':_0x41b2e7,'rows':_0x259607}:null;}})[_0xab3f('0x23')](respondWithResult(_0x5898b6,null))[_0xab3f('0x2e')](handleError(_0x5898b6,null));}; \ No newline at end of file +var _0xe6b0=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','http','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','undefined','limit','offset','Content-Range','json','reject','save','update','then','destroy','end','name','send','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','show','find','create','body','params','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','nolimit','removeMembers','ChatGroupId','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x40026f,_0xd5ffd2){var _0x13520a=function(_0x190da4){while(--_0x190da4){_0x40026f['push'](_0x40026f['shift']());}};_0x13520a(++_0xd5ffd2);}(_0xe6b0,0x196));var _0x0e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0e6b('0x0'));var rimraf=require(_0x0e6b('0x1'));var zipdir=require(_0x0e6b('0x2'));var jsonpatch=require(_0x0e6b('0x3'));var rp=require(_0x0e6b('0x4'));var moment=require('moment');var BPromise=require(_0x0e6b('0x5'));var Mustache=require(_0x0e6b('0x6'));var util=require(_0x0e6b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0e6b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e6b('0x9'));var _=require(_0x0e6b('0xa'));var squel=require(_0x0e6b('0xb'));var crypto=require(_0x0e6b('0xc'));var jsforce=require(_0x0e6b('0xd'));var deskjs=require(_0x0e6b('0xe'));var toCsv=require(_0x0e6b('0x8'));var querystring=require(_0x0e6b('0xf'));var Papa=require(_0x0e6b('0x10'));var Redis=require(_0x0e6b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0e6b('0x12'));var as=require(_0x0e6b('0x13'));var hardwareService=require(_0x0e6b('0x14'));var logger=require(_0x0e6b('0x15'))('api');var utils=require(_0x0e6b('0x16'));var config=require(_0x0e6b('0x17'));var licenseUtil=require(_0x0e6b('0x18'));var db=require(_0x0e6b('0x19'))['db'];config['redis']=_[_0x0e6b('0x1a')](config[_0x0e6b('0x1b')],{'host':_0x0e6b('0x1c'),'port':0x18eb});var socket=require(_0x0e6b('0x1d'))(new Redis(config[_0x0e6b('0x1b')]));require(_0x0e6b('0x1e'))[_0x0e6b('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x0e6b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3dd1ce,_0x17da21,_0x6e43c6,_0x27b1ab){return new BPromise(function(_0x69df7b,_0x49046c){var _0x3c032a=_0x27b1ab||client;return _0x3c032a[_0x0e6b('0x21')](_0x3dd1ce,_0x6e43c6)['then'](function(_0x271a13){logger[_0x0e6b('0x22')](_0x0e6b('0x23'),_0x17da21,_0x0e6b('0x24'));logger[_0x0e6b('0x25')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x17da21,_0x0e6b('0x24'),JSON[_0x0e6b('0x26')](_0x271a13));if(_0x271a13['error']){if(_0x271a13[_0x0e6b('0x27')][_0x0e6b('0x28')]===0x1f4){logger['error'](_0x0e6b('0x23'),_0x17da21,_0x271a13[_0x0e6b('0x27')]['message']);return _0x49046c(_0x271a13[_0x0e6b('0x27')][_0x0e6b('0x29')]);}logger[_0x0e6b('0x27')](_0x0e6b('0x23'),_0x17da21,_0x271a13[_0x0e6b('0x27')]['message']);return _0x69df7b(_0x271a13[_0x0e6b('0x27')][_0x0e6b('0x29')]);}else{logger['info'](_0x0e6b('0x23'),_0x17da21,'request\x20sent');_0x69df7b(_0x271a13[_0x0e6b('0x2a')][_0x0e6b('0x29')]);}})[_0x0e6b('0x2b')](function(_0x52c012){logger[_0x0e6b('0x27')](_0x0e6b('0x23'),_0x17da21,_0x52c012);_0x49046c(_0x52c012);});});}function respondWithStatusCode(_0x699280,_0xd21b55){_0xd21b55=_0xd21b55||0xcc;return function(_0x26efd9){if(_0x26efd9){return _0x699280[_0x0e6b('0x2c')](_0xd21b55);}return _0x699280[_0x0e6b('0x2d')](_0xd21b55)['end']();};}function respondWithResult(_0x4bc58b,_0x4f5e59){_0x4f5e59=_0x4f5e59||0xc8;return function(_0x272fc4){if(_0x272fc4){return _0x4bc58b['status'](_0x4f5e59)['json'](_0x272fc4);}};}function respondWithFilteredResult(_0x40777d,_0x5daed9){return function(_0x4dcbda){if(_0x4dcbda){var _0x24a254=typeof _0x5daed9['offset']===_0x0e6b('0x2e')&&typeof _0x5daed9[_0x0e6b('0x2f')]===_0x0e6b('0x2e');var _0x2b19c0=_0x4dcbda['count'];var _0x14eff1=_0x24a254?0x0:_0x5daed9[_0x0e6b('0x30')];var _0x45ae4c=_0x24a254?_0x4dcbda['count']:_0x5daed9['offset']+_0x5daed9[_0x0e6b('0x2f')];var _0x40309e;if(_0x45ae4c>=_0x2b19c0){_0x45ae4c=_0x2b19c0;_0x40309e=0xc8;}else{_0x40309e=0xce;}_0x40777d[_0x0e6b('0x2d')](_0x40309e);return _0x40777d['set'](_0x0e6b('0x31'),_0x14eff1+'-'+_0x45ae4c+'/'+_0x2b19c0)[_0x0e6b('0x32')](_0x4dcbda);}return null;};}function patchUpdates(_0x32c47f){return function(_0x45f08e){try{jsonpatch['apply'](_0x45f08e,_0x32c47f,!![]);}catch(_0x49c4e9){return BPromise[_0x0e6b('0x33')](_0x49c4e9);}return _0x45f08e[_0x0e6b('0x34')]();};}function saveUpdates(_0x619531,_0x34cf99){return function(_0x424966){if(_0x424966){return _0x424966[_0x0e6b('0x35')](_0x619531)[_0x0e6b('0x36')](function(_0x32ab19){return _0x32ab19;});}return null;};}function removeEntity(_0x4580fb,_0x2e5eaa){return function(_0x3ab61d){if(_0x3ab61d){return _0x3ab61d[_0x0e6b('0x37')]()[_0x0e6b('0x36')](function(){_0x4580fb['status'](0xcc)[_0x0e6b('0x38')]();});}};}function handleEntityNotFound(_0x17c6c9,_0x2c5b7d){return function(_0x1dc5a3){if(!_0x1dc5a3){_0x17c6c9[_0x0e6b('0x2c')](0x194);}return _0x1dc5a3;};}function handleError(_0x5ada0c,_0x44c1da){_0x44c1da=_0x44c1da||0x1f4;return function(_0x37437e){logger['error'](_0x37437e['stack']);if(_0x37437e[_0x0e6b('0x39')]){delete _0x37437e['name'];}_0x5ada0c[_0x0e6b('0x2d')](_0x44c1da)[_0x0e6b('0x3a')](_0x37437e);};}exports['index']=function(_0x4d6f0d,_0x77e34f){var _0x4b2011={},_0x147f21={},_0xfb7495={'count':0x0,'rows':[]};var _0x49c108=_[_0x0e6b('0x3b')](db[_0x0e6b('0x3c')][_0x0e6b('0x3d')],function(_0x574df7){return{'name':_0x574df7['fieldName'],'type':_0x574df7[_0x0e6b('0x3e')][_0x0e6b('0x3f')]};});_0x147f21[_0x0e6b('0x40')]=_['map'](_0x49c108,_0x0e6b('0x39'));_0x147f21[_0x0e6b('0x41')]=_[_0x0e6b('0x42')](_0x4d6f0d[_0x0e6b('0x41')]);_0x147f21[_0x0e6b('0x43')]=_[_0x0e6b('0x44')](_0x147f21['model'],_0x147f21[_0x0e6b('0x41')]);_0x4b2011[_0x0e6b('0x45')]=_[_0x0e6b('0x44')](_0x147f21[_0x0e6b('0x40')],qs[_0x0e6b('0x46')](_0x4d6f0d[_0x0e6b('0x41')]['fields']));_0x4b2011['attributes']=_0x4b2011[_0x0e6b('0x45')][_0x0e6b('0x47')]?_0x4b2011['attributes']:_0x147f21['model'];if(!_0x4d6f0d[_0x0e6b('0x41')][_0x0e6b('0x48')]('nolimit')){_0x4b2011['limit']=qs[_0x0e6b('0x2f')](_0x4d6f0d[_0x0e6b('0x41')][_0x0e6b('0x2f')]);_0x4b2011[_0x0e6b('0x30')]=qs[_0x0e6b('0x30')](_0x4d6f0d[_0x0e6b('0x41')][_0x0e6b('0x30')]);}_0x4b2011[_0x0e6b('0x49')]=qs[_0x0e6b('0x4a')](_0x4d6f0d[_0x0e6b('0x41')][_0x0e6b('0x4a')]);_0x4b2011[_0x0e6b('0x4b')]=qs[_0x0e6b('0x43')](_[_0x0e6b('0x4c')](_0x4d6f0d[_0x0e6b('0x41')],_0x147f21[_0x0e6b('0x43')]),_0x49c108);if(_0x4d6f0d[_0x0e6b('0x41')][_0x0e6b('0x4d')]){_0x4b2011[_0x0e6b('0x4b')]=_['merge'](_0x4b2011['where'],{'$or':_[_0x0e6b('0x3b')](_0x49c108,function(_0x341e4f){if(_0x341e4f[_0x0e6b('0x3e')]!==_0x0e6b('0x4e')){var _0x391bf3={};_0x391bf3[_0x341e4f['name']]={'$like':'%'+_0x4d6f0d['query'][_0x0e6b('0x4d')]+'%'};return _0x391bf3;}})});}_0x4b2011=_[_0x0e6b('0x4f')]({},_0x4b2011,_0x4d6f0d[_0x0e6b('0x50')]);var _0x3a97cb={'where':_0x4b2011['where']};return db[_0x0e6b('0x3c')][_0x0e6b('0x51')](_0x3a97cb)[_0x0e6b('0x36')](function(_0x353454){_0xfb7495['count']=_0x353454;if(_0x4d6f0d[_0x0e6b('0x41')][_0x0e6b('0x52')]){_0x4b2011[_0x0e6b('0x53')]=[{'all':!![]}];}return db[_0x0e6b('0x3c')]['findAll'](_0x4b2011);})[_0x0e6b('0x36')](function(_0x179b20){_0xfb7495[_0x0e6b('0x54')]=_0x179b20;return _0xfb7495;})[_0x0e6b('0x36')](respondWithFilteredResult(_0x77e34f,_0x4b2011))[_0x0e6b('0x2b')](handleError(_0x77e34f,null));};exports[_0x0e6b('0x55')]=function(_0x40c96e,_0x10d8b7){var _0x364c25={'raw':!![],'where':{'id':_0x40c96e['params']['id']}},_0x340941={};_0x340941[_0x0e6b('0x40')]=_['keys'](db[_0x0e6b('0x3c')][_0x0e6b('0x3d')]);_0x340941[_0x0e6b('0x41')]=_[_0x0e6b('0x42')](_0x40c96e[_0x0e6b('0x41')]);_0x340941[_0x0e6b('0x43')]=_['intersection'](_0x340941[_0x0e6b('0x40')],_0x340941['query']);_0x364c25['attributes']=_[_0x0e6b('0x44')](_0x340941[_0x0e6b('0x40')],qs['fields'](_0x40c96e[_0x0e6b('0x41')]['fields']));_0x364c25[_0x0e6b('0x45')]=_0x364c25['attributes']['length']?_0x364c25[_0x0e6b('0x45')]:_0x340941[_0x0e6b('0x40')];if(_0x40c96e[_0x0e6b('0x41')][_0x0e6b('0x52')]){_0x364c25[_0x0e6b('0x53')]=[{'all':!![]}];}_0x364c25=_['merge']({},_0x364c25,_0x40c96e[_0x0e6b('0x50')]);return db[_0x0e6b('0x3c')][_0x0e6b('0x56')](_0x364c25)['then'](handleEntityNotFound(_0x10d8b7,null))[_0x0e6b('0x36')](respondWithResult(_0x10d8b7,null))['catch'](handleError(_0x10d8b7,null));};exports[_0x0e6b('0x57')]=function(_0x4b33d8,_0x5cb4e5){return db[_0x0e6b('0x3c')][_0x0e6b('0x57')](_0x4b33d8[_0x0e6b('0x58')],{})[_0x0e6b('0x36')](respondWithResult(_0x5cb4e5,0xc9))[_0x0e6b('0x2b')](handleError(_0x5cb4e5,null));};exports['update']=function(_0x2fd5b8,_0x3e24ef){if(_0x2fd5b8['body']['id']){delete _0x2fd5b8[_0x0e6b('0x58')]['id'];}return db[_0x0e6b('0x3c')][_0x0e6b('0x56')]({'where':{'id':_0x2fd5b8[_0x0e6b('0x59')]['id']}})[_0x0e6b('0x36')](handleEntityNotFound(_0x3e24ef,null))['then'](saveUpdates(_0x2fd5b8[_0x0e6b('0x58')],null))[_0x0e6b('0x36')](respondWithResult(_0x3e24ef,null))[_0x0e6b('0x2b')](handleError(_0x3e24ef,null));};exports['destroy']=function(_0xe1dc8c,_0x3539a8){return db['ChatGroup'][_0x0e6b('0x56')]({'where':{'id':_0xe1dc8c[_0x0e6b('0x59')]['id']}})[_0x0e6b('0x36')](handleEntityNotFound(_0x3539a8,null))[_0x0e6b('0x36')](removeEntity(_0x3539a8,null))['catch'](handleError(_0x3539a8,null));};exports['describe']=function(_0xd70c73,_0x53840f){return db[_0x0e6b('0x3c')]['describe']()['then'](respondWithResult(_0x53840f,null))[_0x0e6b('0x2b')](handleError(_0x53840f,null));};exports[_0x0e6b('0x5a')]=function(_0x2c6fe0,_0x3aca72,_0x2b9b52){return db[_0x0e6b('0x5b')][_0x0e6b('0x51')]({'where':{'ChatGroupId':_0x2c6fe0[_0x0e6b('0x59')]['id'],'ToId':_0x2c6fe0[_0x0e6b('0x5c')]['id'],'read':![]}})[_0x0e6b('0x36')](function(_0x4264be){return{'id':_[_0x0e6b('0x5d')](_0x2c6fe0[_0x0e6b('0x59')]['id']),'count':_0x4264be};})['then'](respondWithResult(_0x3aca72,null))[_0x0e6b('0x2b')](handleError(_0x3aca72,null));};exports[_0x0e6b('0x5e')]=function(_0x1d3307,_0x4179d2,_0x3f3390){return db[_0x0e6b('0x3c')]['find']({'where':{'id':_0x1d3307[_0x0e6b('0x59')]['id']}})['then'](handleEntityNotFound(_0x4179d2,null))[_0x0e6b('0x36')](function(_0x3576bf){if(_0x3576bf){return _0x3576bf[_0x0e6b('0x5e')](_0x1d3307[_0x0e6b('0x58')][_0x0e6b('0x5f')],_['omit'](_0x1d3307[_0x0e6b('0x58')],[_0x0e6b('0x5f'),'id'])||{});}})[_0x0e6b('0x36')](respondWithResult(_0x4179d2,null))[_0x0e6b('0x2b')](handleError(_0x4179d2,null));};exports['getMembers']=function(_0x71945,_0x942679,_0x5696ed){var _0xef8968={};var _0x491d77={};var _0x4b7b8e;var _0x1d8416;return db[_0x0e6b('0x3c')]['findOne']({'where':{'id':_0x71945['params']['id']}})['then'](handleEntityNotFound(_0x942679,null))[_0x0e6b('0x36')](function(_0x382e4b){if(_0x382e4b){_0x4b7b8e=_0x382e4b;_0x491d77[_0x0e6b('0x40')]=_[_0x0e6b('0x42')](db['User'][_0x0e6b('0x3d')]);_0x491d77[_0x0e6b('0x41')]=_[_0x0e6b('0x42')](_0x71945[_0x0e6b('0x41')]);_0x491d77[_0x0e6b('0x43')]=_[_0x0e6b('0x44')](_0x491d77[_0x0e6b('0x40')],_0x491d77[_0x0e6b('0x41')]);_0xef8968['attributes']=_['intersection'](_0x491d77[_0x0e6b('0x40')],qs[_0x0e6b('0x46')](_0x71945[_0x0e6b('0x41')][_0x0e6b('0x46')]));_0xef8968[_0x0e6b('0x45')]=_0xef8968[_0x0e6b('0x45')][_0x0e6b('0x47')]?_0xef8968[_0x0e6b('0x45')]:_0x491d77[_0x0e6b('0x40')];_0xef8968[_0x0e6b('0x49')]=qs[_0x0e6b('0x4a')](_0x71945[_0x0e6b('0x41')][_0x0e6b('0x4a')]);_0xef8968[_0x0e6b('0x4b')]=qs[_0x0e6b('0x43')](_[_0x0e6b('0x4c')](_0x71945[_0x0e6b('0x41')],_0x491d77[_0x0e6b('0x43')]));if(_0x71945[_0x0e6b('0x41')][_0x0e6b('0x4d')]){_0xef8968['where']=_['merge'](_0xef8968[_0x0e6b('0x4b')],{'$or':_[_0x0e6b('0x3b')](_0xef8968['attributes'],function(_0x515a88){var _0x392780={};_0x392780[_0x515a88]={'$like':'%'+_0x71945[_0x0e6b('0x41')][_0x0e6b('0x4d')]+'%'};return _0x392780;})});}_0xef8968=_['merge']({},_0xef8968,_0x71945['options']);return _0x4b7b8e[_0x0e6b('0x60')](_0xef8968);}})['then'](function(_0x38843d){if(_0x38843d){_0x1d8416=_0x38843d['length'];if(!_0x71945[_0x0e6b('0x41')][_0x0e6b('0x48')](_0x0e6b('0x61'))){_0xef8968[_0x0e6b('0x2f')]=qs[_0x0e6b('0x2f')](_0x71945[_0x0e6b('0x41')]['limit']);_0xef8968['offset']=qs[_0x0e6b('0x30')](_0x71945[_0x0e6b('0x41')][_0x0e6b('0x30')]);}return _0x4b7b8e[_0x0e6b('0x60')](_0xef8968);}})[_0x0e6b('0x36')](function(_0x11696f){if(_0x11696f){return _0x11696f?{'count':_0x1d8416,'rows':_0x11696f}:null;}})[_0x0e6b('0x36')](respondWithResult(_0x942679,null))['catch'](handleError(_0x942679,null));};exports[_0x0e6b('0x62')]=function(_0x9bf3c5,_0x5dd41c,_0x6de5e2){return db[_0x0e6b('0x3c')][_0x0e6b('0x56')]({'where':{'id':_0x9bf3c5[_0x0e6b('0x59')]['id']}})[_0x0e6b('0x36')](handleEntityNotFound(_0x5dd41c,null))[_0x0e6b('0x36')](function(_0x13c6e7){if(_0x13c6e7){return _0x13c6e7[_0x0e6b('0x62')](_0x9bf3c5[_0x0e6b('0x41')][_0x0e6b('0x5f')]);}})[_0x0e6b('0x36')](respondWithStatusCode(_0x5dd41c,null))['catch'](handleError(_0x5dd41c,null));};exports['addMessage']=function(_0x173f5e,_0xc075c0,_0x1beacc){if(_0x173f5e['body']['id']){delete _0x173f5e[_0x0e6b('0x58')]['id'];}return db['ChatGroup'][_0x0e6b('0x56')]({'where':{'id':_0x173f5e[_0x0e6b('0x59')]['id']}})[_0x0e6b('0x36')](handleEntityNotFound(_0xc075c0,null))[_0x0e6b('0x36')](function(_0x24d517){if(_0x24d517){_0x173f5e[_0x0e6b('0x58')][_0x0e6b('0x63')]=_0x24d517['id'];return db[_0x0e6b('0x5b')][_0x0e6b('0x57')](_0x173f5e['body']);}})[_0x0e6b('0x36')](respondWithResult(_0xc075c0,null))[_0x0e6b('0x2b')](handleError(_0xc075c0,null));};exports['getMessages']=function(_0x2496a4,_0x568a73,_0xeebd1d){var _0x1bf963={};var _0x29cc7c={};var _0x4222a6;var _0x3d5e81;return db[_0x0e6b('0x3c')][_0x0e6b('0x64')]({'where':{'id':_0x2496a4['params']['id']}})[_0x0e6b('0x36')](handleEntityNotFound(_0x568a73,null))[_0x0e6b('0x36')](function(_0x4eff9f){if(_0x4eff9f){_0x4222a6=_0x4eff9f;_0x29cc7c['model']=_[_0x0e6b('0x42')](db[_0x0e6b('0x5b')][_0x0e6b('0x3d')]);_0x29cc7c[_0x0e6b('0x41')]=_[_0x0e6b('0x42')](_0x2496a4['query']);_0x29cc7c[_0x0e6b('0x43')]=_[_0x0e6b('0x44')](_0x29cc7c[_0x0e6b('0x40')],_0x29cc7c[_0x0e6b('0x41')]);_0x1bf963[_0x0e6b('0x45')]=_[_0x0e6b('0x44')](_0x29cc7c['model'],qs[_0x0e6b('0x46')](_0x2496a4['query'][_0x0e6b('0x46')]));_0x1bf963[_0x0e6b('0x45')]=_0x1bf963[_0x0e6b('0x45')]['length']?_0x1bf963[_0x0e6b('0x45')]:_0x29cc7c[_0x0e6b('0x40')];_0x1bf963['order']=qs['sort'](_0x2496a4['query']['sort']);_0x1bf963['where']=qs['filters'](_[_0x0e6b('0x4c')](_0x2496a4[_0x0e6b('0x41')],_0x29cc7c[_0x0e6b('0x43')]));if(_0x2496a4[_0x0e6b('0x41')][_0x0e6b('0x4d')]){_0x1bf963['where']=_[_0x0e6b('0x4f')](_0x1bf963['where'],{'$or':_[_0x0e6b('0x3b')](_0x1bf963[_0x0e6b('0x45')],function(_0x5e0672){var _0x5412b8={};_0x5412b8[_0x5e0672]={'$like':'%'+_0x2496a4[_0x0e6b('0x41')]['filter']+'%'};return _0x5412b8;})});}if(_0x2496a4['query'][_0x0e6b('0x65')]){var _0x2d32c4=_0x2496a4[_0x0e6b('0x41')][_0x0e6b('0x65')][_0x0e6b('0x66')](',');var _0x324cc6={};_0x324cc6[_0x2d32c4[0x0]]={'$gte':moment(_0x2d32c4[0x1])[_0x0e6b('0x67')](_0x0e6b('0x68'))};_0x1bf963[_0x0e6b('0x4b')]=_[_0x0e6b('0x4f')](_0x1bf963[_0x0e6b('0x4b')],_0x324cc6);}_0x1bf963=_[_0x0e6b('0x4f')]({},_0x1bf963,_0x2496a4[_0x0e6b('0x50')]);return _0x4222a6[_0x0e6b('0x69')](_0x1bf963);}})[_0x0e6b('0x36')](function(_0x126698){if(_0x126698){_0x3d5e81=_0x126698[_0x0e6b('0x47')];if(!_0x2496a4[_0x0e6b('0x41')]['hasOwnProperty'](_0x0e6b('0x61'))){_0x1bf963[_0x0e6b('0x2f')]=qs[_0x0e6b('0x2f')](_0x2496a4['query']['limit']);_0x1bf963[_0x0e6b('0x30')]=qs[_0x0e6b('0x30')](_0x2496a4[_0x0e6b('0x41')][_0x0e6b('0x30')]);}return _0x4222a6[_0x0e6b('0x69')](_0x1bf963);}})[_0x0e6b('0x36')](function(_0x35c3c3){if(_0x35c3c3){return _0x35c3c3?{'count':_0x3d5e81,'rows':_0x35c3c3}:null;}})[_0x0e6b('0x36')](respondWithResult(_0x568a73,null))[_0x0e6b('0x2b')](handleError(_0x568a73,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index dfabf2a..0239c72 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x270de2,_0x51cb31){var _0x5bce28=function(_0x1e2e9e){while(--_0x1e2e9e){_0x270de2['push'](_0x270de2['shift']());}};_0x5bce28(++_0x51cb31);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1b11b5,_0x3bf1a0){_0x1b11b5=_0x1b11b5-0x0;var _0x22dc6e=_0x5f2f[_0x1b11b5];return _0x22dc6e;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatGroup=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatGroupEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatGroupEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatGroup[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0xadb5,0xad));var _0x5adb=function(_0x236cb1,_0x226155){_0x236cb1=_0x236cb1-0x0;var _0x5ac93b=_0xadb5[_0x236cb1];return _0x5ac93b;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index aca7cdc..b654505 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 _0x8c32=['exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes'];(function(_0x55d911,_0x2b768c){var _0x3104c2=function(_0x1b4386){while(--_0x1b4386){_0x55d911['push'](_0x55d911['shift']());}};_0x3104c2(++_0x2b768c);}(_0x8c32,0x130));var _0x28c3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8c32[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x28c3('0x0'));var util=require(_0x28c3('0x1'));var logger=require(_0x28c3('0x2'))(_0x28c3('0x3'));var moment=require(_0x28c3('0x4'));var BPromise=require(_0x28c3('0x5'));var rp=require(_0x28c3('0x6'));var fs=require('fs');var path=require(_0x28c3('0x7'));var rimraf=require(_0x28c3('0x8'));var config=require(_0x28c3('0x9'));var attributes=require(_0x28c3('0xa'));module[_0x28c3('0xb')]=function(_0x537b4f,_0x2861c9){return _0x537b4f[_0x28c3('0xc')](_0x28c3('0xd'),attributes,{'tableName':_0x28c3('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea31=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define','chat_groups','lodash'];(function(_0x47381c,_0x3204f4){var _0x17da30=function(_0x296406){while(--_0x296406){_0x47381c['push'](_0x47381c['shift']());}};_0x17da30(++_0x3204f4);}(_0xea31,0x6b));var _0x1ea3=function(_0x5c2a14,_0x26f95e){_0x5c2a14=_0x5c2a14-0x0;var _0xe23ecb=_0xea31[_0x5c2a14];return _0xe23ecb;};'use strict';var _=require(_0x1ea3('0x0'));var util=require('util');var logger=require(_0x1ea3('0x1'))(_0x1ea3('0x2'));var moment=require(_0x1ea3('0x3'));var BPromise=require(_0x1ea3('0x4'));var rp=require(_0x1ea3('0x5'));var fs=require('fs');var path=require(_0x1ea3('0x6'));var rimraf=require(_0x1ea3('0x7'));var config=require('../../config/environment');var attributes=require(_0x1ea3('0x8'));module[_0x1ea3('0x9')]=function(_0x6810da,_0x27c695){return _0x6810da[_0x1ea3('0xa')]('ChatGroup',attributes,{'tableName':_0x1ea3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index a4be213..c7f74f8 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 _0x43bb=['then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x18ba7f,_0x33f579){var _0x589151=function(_0x3ac5bd){while(--_0x3ac5bd){_0x18ba7f['push'](_0x18ba7f['shift']());}};_0x589151(++_0x33f579);}(_0x43bb,0x16a));var _0xb43b=function(_0x4779bd,_0x474d7d){_0x4779bd=_0x4779bd-0x0;var _0x211a24=_0x43bb[_0x4779bd];return _0x211a24;};'use strict';var _=require(_0xb43b('0x0'));var util=require('util');var moment=require(_0xb43b('0x1'));var BPromise=require('bluebird');var rs=require(_0xb43b('0x2'));var fs=require('fs');var Redis=require(_0xb43b('0x3'));var db=require(_0xb43b('0x4'))['db'];var utils=require(_0xb43b('0x5'));var logger=require(_0xb43b('0x6'))(_0xb43b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb43b('0x8')][_0xb43b('0x9')]({'port':0x232a});config[_0xb43b('0xa')]=_[_0xb43b('0xb')](config[_0xb43b('0xa')],{'host':_0xb43b('0xc'),'port':0x18eb});var socket=require(_0xb43b('0xd'))(new Redis(config[_0xb43b('0xa')]));require('./chatGroup.socket')[_0xb43b('0xe')](socket);function respondWithRpcPromise(_0x37c40b,_0x1c1ac1,_0x34815e){return new BPromise(function(_0x3291fe,_0x36bdfd){return client[_0xb43b('0xf')](_0x37c40b,_0x34815e)[_0xb43b('0x10')](function(_0x5b1fe9){logger[_0xb43b('0x11')](_0xb43b('0x12'),_0x1c1ac1,'request\x20sent');logger[_0xb43b('0x13')](_0xb43b('0x14'),_0x1c1ac1,_0xb43b('0x15'),JSON[_0xb43b('0x16')](_0x5b1fe9));if(_0x5b1fe9[_0xb43b('0x17')]){if(_0x5b1fe9['error']['code']===0x1f4){logger[_0xb43b('0x17')](_0xb43b('0x12'),_0x1c1ac1,_0x5b1fe9['error'][_0xb43b('0x18')]);return _0x36bdfd(_0x5b1fe9[_0xb43b('0x17')][_0xb43b('0x18')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x1c1ac1,_0x5b1fe9[_0xb43b('0x17')][_0xb43b('0x18')]);return _0x3291fe(_0x5b1fe9[_0xb43b('0x17')][_0xb43b('0x18')]);}else{logger[_0xb43b('0x11')](_0xb43b('0x12'),_0x1c1ac1,_0xb43b('0x15'));_0x3291fe(_0x5b1fe9[_0xb43b('0x19')][_0xb43b('0x18')]);}})[_0xb43b('0x1a')](function(_0x4fef33){logger[_0xb43b('0x17')](_0xb43b('0x12'),_0x1c1ac1,_0x4fef33);_0x36bdfd(_0x4fef33);});});} \ No newline at end of file +var _0xddab=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash'];(function(_0x12c240,_0x42aae0){var _0x5cd164=function(_0x597213){while(--_0x597213){_0x12c240['push'](_0x12c240['shift']());}};_0x5cd164(++_0x42aae0);}(_0xddab,0xf7));var _0xbdda=function(_0x3331a2,_0x4d4e9b){_0x3331a2=_0x3331a2-0x0;var _0x4b9dc3=_0xddab[_0x3331a2];return _0x4b9dc3;};'use strict';var _=require(_0xbdda('0x0'));var util=require(_0xbdda('0x1'));var moment=require(_0xbdda('0x2'));var BPromise=require(_0xbdda('0x3'));var rs=require(_0xbdda('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdda('0x5'))['db'];var utils=require(_0xbdda('0x6'));var logger=require(_0xbdda('0x7'))(_0xbdda('0x8'));var config=require(_0xbdda('0x9'));var jayson=require(_0xbdda('0xa'));var client=jayson[_0xbdda('0xb')][_0xbdda('0xc')]({'port':0x232a});config[_0xbdda('0xd')]=_[_0xbdda('0xe')](config[_0xbdda('0xd')],{'host':_0xbdda('0xf'),'port':0x18eb});var socket=require(_0xbdda('0x10'))(new Redis(config['redis']));require(_0xbdda('0x11'))[_0xbdda('0x12')](socket);function respondWithRpcPromise(_0xcef296,_0x308655,_0x1cf157){return new BPromise(function(_0x21a820,_0x5b938d){return client[_0xbdda('0x13')](_0xcef296,_0x1cf157)['then'](function(_0x35c215){logger[_0xbdda('0x14')](_0xbdda('0x15'),_0x308655,'request\x20sent');logger[_0xbdda('0x16')](_0xbdda('0x17'),_0x308655,'request\x20sent',JSON[_0xbdda('0x18')](_0x35c215));if(_0x35c215[_0xbdda('0x19')]){if(_0x35c215[_0xbdda('0x19')][_0xbdda('0x1a')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x308655,_0x35c215[_0xbdda('0x19')][_0xbdda('0x1b')]);return _0x5b938d(_0x35c215['error']['message']);}logger[_0xbdda('0x19')](_0xbdda('0x15'),_0x308655,_0x35c215['error'][_0xbdda('0x1b')]);return _0x21a820(_0x35c215[_0xbdda('0x19')]['message']);}else{logger[_0xbdda('0x14')](_0xbdda('0x15'),_0x308655,_0xbdda('0x1c'));_0x21a820(_0x35c215[_0xbdda('0x1d')][_0xbdda('0x1b')]);}})[_0xbdda('0x1e')](function(_0x2f7405){logger[_0xbdda('0x19')](_0xbdda('0x15'),_0x308655,_0x2f7405);_0x5b938d(_0x2f7405);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 89c9c23..c7b20ba 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 _0x3fcb=['removeListener','register','length','./chatGroup.events','save','remove'];(function(_0x287cc1,_0x8a4b18){var _0x14bbc1=function(_0x4ff6f2){while(--_0x4ff6f2){_0x287cc1['push'](_0x287cc1['shift']());}};_0x14bbc1(++_0x8a4b18);}(_0x3fcb,0x1e3));var _0xb3fc=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x3fcb[_0x6131cd];return _0x47e916;};'use strict';var ChatGroupEvents=require(_0xb3fc('0x0'));var events=[_0xb3fc('0x1'),_0xb3fc('0x2'),'update'];function createListener(_0x376d8a,_0x5d9e20){return function(_0x355ee0){_0x5d9e20['emit'](_0x376d8a,_0x355ee0);};}function removeListener(_0x487727,_0x28d047){return function(){ChatGroupEvents[_0xb3fc('0x3')](_0x487727,_0x28d047);};}exports[_0xb3fc('0x4')]=function(_0x45457b){for(var _0x21ea24=0x0,_0x4cd9e9=events[_0xb3fc('0x5')];_0x21ea24<_0x4cd9e9;_0x21ea24++){var _0xb94fe2=events[_0x21ea24];var _0x3d2d25=createListener('chatGroup:'+_0xb94fe2,_0x45457b);ChatGroupEvents['on'](_0xb94fe2,_0x3d2d25);}}; \ No newline at end of file +var _0x0769=['removeListener','register','length','save','remove','emit'];(function(_0x438fda,_0x229abf){var _0x445087=function(_0x2bd41d){while(--_0x2bd41d){_0x438fda['push'](_0x438fda['shift']());}};_0x445087(++_0x229abf);}(_0x0769,0xe7));var _0x9076=function(_0x20bcf9,_0x81f10a){_0x20bcf9=_0x20bcf9-0x0;var _0x5eddb3=_0x0769[_0x20bcf9];return _0x5eddb3;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x9076('0x0'),_0x9076('0x1'),'update'];function createListener(_0x2d5558,_0x65352){return function(_0x5c3592){_0x65352[_0x9076('0x2')](_0x2d5558,_0x5c3592);};}function removeListener(_0x3a1669,_0x354da8){return function(){ChatGroupEvents[_0x9076('0x3')](_0x3a1669,_0x354da8);};}exports[_0x9076('0x4')]=function(_0x24349){for(var _0x13cf43=0x0,_0x2a29d6=events[_0x9076('0x5')];_0x13cf43<_0x2a29d6;_0x13cf43++){var _0x2f9289=events[_0x13cf43];var _0x372737=createListener('chatGroup:'+_0x2f9289,_0x24349);ChatGroupEvents['on'](_0x2f9289,_0x372737);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 84b3b39..9b1f359 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 _0x8cde=['describe','/:id','/:id/members','/:id/messages','post','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x457d21,_0x4956f2){var _0x4cab70=function(_0x7a52e0){while(--_0x7a52e0){_0x457d21['push'](_0x457d21['shift']());}};_0x4cab70(++_0x4956f2);}(_0x8cde,0x1d5));var _0xe8cd=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x8cde[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xe8cd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe8cd('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe8cd('0x2'));var interaction=require(_0xe8cd('0x3'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0xe8cd('0x4')]('/',auth[_0xe8cd('0x5')](),controller['index']);router[_0xe8cd('0x4')]('/describe',auth['isAuthenticated'](),controller[_0xe8cd('0x6')]);router[_0xe8cd('0x4')](_0xe8cd('0x7'),auth[_0xe8cd('0x5')](),controller['show']);router['get']('/:id/unread',auth['isAuthenticated'](),controller['getUnread']);router['get'](_0xe8cd('0x8'),auth[_0xe8cd('0x5')](),controller['getMembers']);router['get'](_0xe8cd('0x9'),auth['isAuthenticated'](),controller['getMessages']);router['post']('/',auth[_0xe8cd('0x5')](),controller['create']);router[_0xe8cd('0xa')](_0xe8cd('0x8'),auth[_0xe8cd('0x5')](),controller[_0xe8cd('0xb')]);router['post'](_0xe8cd('0x9'),auth[_0xe8cd('0x5')](),controller[_0xe8cd('0xc')]);router[_0xe8cd('0xd')](_0xe8cd('0x7'),auth[_0xe8cd('0x5')](),controller[_0xe8cd('0xe')]);router[_0xe8cd('0xf')]('/:id',auth[_0xe8cd('0x5')](),controller[_0xe8cd('0x10')]);router[_0xe8cd('0xf')](_0xe8cd('0x8'),auth[_0xe8cd('0x5')](),controller[_0xe8cd('0x11')]);module[_0xe8cd('0x12')]=router; \ No newline at end of file +var _0xf7e5=['getMembers','getMessages','post','create','/:id/messages','addMessage','put','update','delete','/:id','destroy','removeMembers','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','describe','show','getUnread','/:id/members'];(function(_0x2d08d2,_0x22d0c1){var _0x5b91e9=function(_0x4c93b2){while(--_0x4c93b2){_0x2d08d2['push'](_0x2d08d2['shift']());}};_0x5b91e9(++_0x22d0c1);}(_0xf7e5,0x7d));var _0x5f7e=function(_0x511f0d,_0x2ebfdd){_0x511f0d=_0x511f0d-0x0;var _0x110ece=_0xf7e5[_0x511f0d];return _0x110ece;};'use strict';var multer=require('multer');var util=require(_0x5f7e('0x0'));var path=require(_0x5f7e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5f7e('0x2')]();var fs_extra=require(_0x5f7e('0x3'));var auth=require(_0x5f7e('0x4'));var interaction=require(_0x5f7e('0x5'));var config=require(_0x5f7e('0x6'));var controller=require(_0x5f7e('0x7'));router[_0x5f7e('0x8')]('/',auth[_0x5f7e('0x9')](),controller[_0x5f7e('0xa')]);router['get']('/describe',auth[_0x5f7e('0x9')](),controller[_0x5f7e('0xb')]);router['get']('/:id',auth[_0x5f7e('0x9')](),controller[_0x5f7e('0xc')]);router[_0x5f7e('0x8')]('/:id/unread',auth[_0x5f7e('0x9')](),controller[_0x5f7e('0xd')]);router[_0x5f7e('0x8')](_0x5f7e('0xe'),auth[_0x5f7e('0x9')](),controller[_0x5f7e('0xf')]);router[_0x5f7e('0x8')]('/:id/messages',auth[_0x5f7e('0x9')](),controller[_0x5f7e('0x10')]);router[_0x5f7e('0x11')]('/',auth[_0x5f7e('0x9')](),controller[_0x5f7e('0x12')]);router['post'](_0x5f7e('0xe'),auth['isAuthenticated'](),controller['addMembers']);router['post'](_0x5f7e('0x13'),auth[_0x5f7e('0x9')](),controller[_0x5f7e('0x14')]);router[_0x5f7e('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x5f7e('0x16')]);router[_0x5f7e('0x17')](_0x5f7e('0x18'),auth[_0x5f7e('0x9')](),controller[_0x5f7e('0x19')]);router[_0x5f7e('0x17')]('/:id/members',auth[_0x5f7e('0x9')](),controller[_0x5f7e('0x1a')]);module[_0x5f7e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 48561c5..d869a0f 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 _0xcd1c=['sequelize','BOOLEAN','star','TEXT','STRING','DATE','long','ENUM'];(function(_0x3b9331,_0x1faff0){var _0x3eaab2=function(_0x11a4fb){while(--_0x11a4fb){_0x3b9331['push'](_0x3b9331['shift']());}};_0x3eaab2(++_0x1faff0);}(_0xcd1c,0x68));var _0xccd1=function(_0x46060a,_0x4ed109){_0x46060a=_0x46060a-0x0;var _0x119e5e=_0xcd1c[_0x46060a];return _0x119e5e;};'use strict';var Sequelize=require(_0xccd1('0x0'));module['exports']={'closed':{'type':Sequelize[_0xccd1('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0xccd1('0x2'),'thumb'),'defaultValue':_0xccd1('0x2')},'ratingMessage':{'type':Sequelize[_0xccd1('0x3')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xccd1('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xccd1('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xccd1('0x4')]},'thirdDisposition':{'type':Sequelize[_0xccd1('0x4')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xccd1('0x4')]},'osName':{'type':Sequelize[_0xccd1('0x4')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xccd1('0x4')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xccd1('0x3')]},'customerIp':{'type':Sequelize[_0xccd1('0x4')]},'formData':{'type':Sequelize[_0xccd1('0x3')](_0xccd1('0x6'))},'read1stAt':{'type':Sequelize[_0xccd1('0x5')]},'lastMsgAt':{'type':Sequelize[_0xccd1('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xccd1('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xccd1('0x4')]},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xbf7e=['sequelize','exports','BOOLEAN','star','thumb','TEXT','STRING','DATE','out'];(function(_0x203ee,_0x30ed8c){var _0x1fe133=function(_0x12783b){while(--_0x12783b){_0x203ee['push'](_0x203ee['shift']());}};_0x1fe133(++_0x30ed8c);}(_0xbf7e,0x129));var _0xebf7=function(_0x47960b,_0x38f6cc){_0x47960b=_0x47960b-0x0;var _0x112bfe=_0xbf7e[_0x47960b];return _0x112bfe;};'use strict';var Sequelize=require(_0xebf7('0x0'));module[_0xebf7('0x1')]={'closed':{'type':Sequelize[_0xebf7('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0xebf7('0x3'),_0xebf7('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xebf7('0x5')]},'pathTranscript':{'type':Sequelize[_0xebf7('0x5')]},'mailTranscript':{'type':Sequelize[_0xebf7('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xebf7('0x7')]},'disposition':{'type':Sequelize[_0xebf7('0x6')]},'secondDisposition':{'type':Sequelize[_0xebf7('0x6')]},'thirdDisposition':{'type':Sequelize[_0xebf7('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xebf7('0x6')]},'osName':{'type':Sequelize[_0xebf7('0x6')]},'osVersion':{'type':Sequelize[_0xebf7('0x6')]},'deviceModel':{'type':Sequelize[_0xebf7('0x6')]},'deviceVendor':{'type':Sequelize[_0xebf7('0x6')]},'deviceType':{'type':Sequelize[_0xebf7('0x6')]},'referer':{'type':Sequelize[_0xebf7('0x5')]},'customerIp':{'type':Sequelize[_0xebf7('0x6')]},'formData':{'type':Sequelize[_0xebf7('0x5')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xebf7('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xebf7('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xebf7('0x6')]},'customerPort':{'type':Sequelize[_0xebf7('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xebf7('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index fe35c1c..e239aa6 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 _0xbbb5=['Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','params','includeAll','include','options','create','update','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','filename','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','server/files/attachments/','join','offline-chat/','basename','download','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','secret','includeAgent','alias','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','files','tmp','server','attachments','direction','get','Owner','N.A.','closedAt','browserName','osName','referer','customerPort','existsSync','createReadStream','pipe','createWriteStream','lastName','renderFile','views','downloadInteraction.ejs','transcript-','Chat','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','end','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','send','render','merge','body','contact','interaction','account','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','keys','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','contactName','i.*','Contact.firstName','c.lastName'];(function(_0x2ee329,_0x1c2a4f){var _0x4ac806=function(_0x2e8ca4){while(--_0x2e8ca4){_0x2ee329['push'](_0x2ee329['shift']());}};_0x4ac806(++_0x1c2a4f);}(_0xbbb5,0x8d));var _0x5bbb=function(_0xb7c535,_0x273535){_0xb7c535=_0xb7c535-0x0;var _0x5d9d8d=_0xbbb5[_0xb7c535];return _0x5d9d8d;};'use strict';var emlformat=require(_0x5bbb('0x0'));var rimraf=require(_0x5bbb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bbb('0x2'));var rp=require('request-promise');var moment=require(_0x5bbb('0x3'));var BPromise=require(_0x5bbb('0x4'));var Mustache=require(_0x5bbb('0x5'));var util=require(_0x5bbb('0x6'));var path=require(_0x5bbb('0x7'));var sox=require(_0x5bbb('0x8'));var csv=require(_0x5bbb('0x9'));var ejs=require(_0x5bbb('0xa'));var fs=require('fs');var fs_extra=require(_0x5bbb('0xb'));var _=require('lodash');var squel=require(_0x5bbb('0xc'));var crypto=require(_0x5bbb('0xd'));var jsforce=require(_0x5bbb('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5bbb('0xf'));var Papa=require('papaparse');var Redis=require(_0x5bbb('0x10'));var authService=require(_0x5bbb('0x11'));var qs=require(_0x5bbb('0x12'));var as=require(_0x5bbb('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x5bbb('0x14'));var logger=require(_0x5bbb('0x15'))('api');var utils=require(_0x5bbb('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5bbb('0x17'))['db'];config[_0x5bbb('0x18')]=_[_0x5bbb('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5bbb('0x1a'))(new Redis(config[_0x5bbb('0x18')]));require(_0x5bbb('0x1b'))[_0x5bbb('0x1c')](socket);var jayson=require(_0x5bbb('0x1d'));var client=jayson[_0x5bbb('0x1e')][_0x5bbb('0x1f')]({'port':0x232b});var client9004=jayson[_0x5bbb('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x432bea,_0x32b7e2,_0x3860ab,_0x2e029f){return new BPromise(function(_0x13e037,_0x4fb2b8){var _0x15b755=_0x2e029f||client;return _0x15b755['request'](_0x432bea,_0x3860ab)['then'](function(_0x3f8877){logger[_0x5bbb('0x20')](_0x5bbb('0x21'),_0x32b7e2,'request\x20sent');logger['debug'](_0x5bbb('0x22'),_0x32b7e2,_0x5bbb('0x23'),JSON['stringify'](_0x3f8877));if(_0x3f8877[_0x5bbb('0x24')]){if(_0x3f8877[_0x5bbb('0x24')][_0x5bbb('0x25')]===0x1f4){logger[_0x5bbb('0x24')](_0x5bbb('0x21'),_0x32b7e2,_0x3f8877[_0x5bbb('0x24')]['message']);return _0x4fb2b8(_0x3f8877['error'][_0x5bbb('0x26')]);}logger[_0x5bbb('0x24')](_0x5bbb('0x21'),_0x32b7e2,_0x3f8877['error'][_0x5bbb('0x26')]);return _0x13e037(_0x3f8877['error'][_0x5bbb('0x26')]);}else{logger[_0x5bbb('0x20')](_0x5bbb('0x21'),_0x32b7e2,'request\x20sent');_0x13e037(_0x3f8877['result'][_0x5bbb('0x26')]);}})['catch'](function(_0x445b49){logger[_0x5bbb('0x24')](_0x5bbb('0x21'),_0x32b7e2,_0x445b49);_0x4fb2b8(_0x445b49);});});}function respondWithStatusCode(_0x37a46b,_0x2bf362){_0x2bf362=_0x2bf362||0xcc;return function(_0x4cd1ca){if(_0x4cd1ca){return _0x37a46b['sendStatus'](_0x2bf362);}return _0x37a46b['status'](_0x2bf362)[_0x5bbb('0x27')]();};}function respondWithResult(_0x1c3ea3,_0x18d53f){_0x18d53f=_0x18d53f||0xc8;return function(_0x40f63f){if(_0x40f63f){return _0x1c3ea3[_0x5bbb('0x28')](_0x18d53f)[_0x5bbb('0x29')](_0x40f63f);}};}function respondWithFilteredResult(_0x18519f,_0x357b37){return function(_0x46f67e){if(_0x46f67e){var _0x56d63b=typeof _0x357b37['offset']===_0x5bbb('0x2a')&&typeof _0x357b37['limit']==='undefined';var _0x78248e=_0x46f67e[_0x5bbb('0x2b')];var _0xb4e2e6=_0x56d63b?0x0:_0x357b37[_0x5bbb('0x2c')];var _0x3fb700=_0x56d63b?_0x46f67e[_0x5bbb('0x2b')]:_0x357b37[_0x5bbb('0x2c')]+_0x357b37['limit'];var _0x3297a5;if(_0x3fb700>=_0x78248e){_0x3fb700=_0x78248e;_0x3297a5=0xc8;}else{_0x3297a5=0xce;}_0x18519f[_0x5bbb('0x28')](_0x3297a5);return _0x18519f[_0x5bbb('0x2d')](_0x5bbb('0x2e'),_0xb4e2e6+'-'+_0x3fb700+'/'+_0x78248e)[_0x5bbb('0x29')](_0x46f67e);}return null;};}function patchUpdates(_0x5646ff){return function(_0x397638){try{jsonpatch[_0x5bbb('0x2f')](_0x397638,_0x5646ff,!![]);}catch(_0x3c2729){return BPromise[_0x5bbb('0x30')](_0x3c2729);}return _0x397638[_0x5bbb('0x31')]();};}function saveUpdates(_0x52ae4f,_0x5b8a1d){return function(_0x9500b1){if(_0x9500b1){return _0x9500b1['update'](_0x52ae4f)[_0x5bbb('0x32')](function(_0x1aa667){return _0x1aa667;});}return null;};}function removeEntity(_0x283496,_0x3c971b){return function(_0x7b5942){if(_0x7b5942){return _0x7b5942[_0x5bbb('0x33')]()[_0x5bbb('0x32')](function(){_0x283496[_0x5bbb('0x28')](0xcc)[_0x5bbb('0x27')]();});}};}function handleEntityNotFound(_0x2f8fb8,_0x31a283){return function(_0x5d0a7c){if(!_0x5d0a7c){_0x2f8fb8[_0x5bbb('0x34')](0x194);}return _0x5d0a7c;};}function handleError(_0x3ada85,_0x41075f){_0x41075f=_0x41075f||0x1f4;return function(_0x280d69){logger[_0x5bbb('0x24')](_0x280d69['stack']);if(_0x280d69[_0x5bbb('0x35')]){delete _0x280d69[_0x5bbb('0x35')];}_0x3ada85[_0x5bbb('0x28')](_0x41075f)[_0x5bbb('0x36')](_0x280d69);};}function getMustacheRender(_0x1be37f,_0x4ea071){return Mustache[_0x5bbb('0x37')](_0x1be37f,_[_0x5bbb('0x38')](_0x4ea071[_0x5bbb('0x39')],{'contact':_0x4ea071[_0x5bbb('0x3a')],'message':_0x4ea071['message'],'agent':_0x4ea071['agent'],'interaction':_0x4ea071[_0x5bbb('0x3b')],'account':_0x4ea071[_0x5bbb('0x3c')]}))||'';}function getInteractionUsers(_0x22574b,_0x14b77e){return new BPromise(function(_0x41d925,_0x73c3ea){try{if(_0x14b77e[_0x22574b['id']]){_0x22574b[_0x5bbb('0x3d')]=_[_0x5bbb('0x3e')](_0x14b77e[_0x22574b['id']],function(_0x2a7c65){return{'id':_0x2a7c65['id'],'fullname':_0x2a7c65[_0x5bbb('0x3f')]};});}}catch(_0xba57ae){_0x73c3ea(_0xba57ae);}_0x41d925(_0x22574b);});}function getInteractionTags(_0x493151,_0x503b65){return new BPromise(function(_0x1a17b2,_0x428efc){try{if(_0x493151[_0x5bbb('0x40')]){_0x493151['Tags']=[];_0x493151[_0x5bbb('0x40')][_0x5bbb('0x41')](',')[_0x5bbb('0x42')](function(_0x295c56){_0x493151[_0x5bbb('0x43')][_0x5bbb('0x44')](_0x503b65[_0x295c56]);});}delete _0x493151[_0x5bbb('0x40')];}catch(_0xf4ccb8){_0x428efc(_0xf4ccb8);}_0x1a17b2(_0x493151);});}function updateChatInteraction(_0x5ab42b,_0x494f8d,_0x37fe22){return new BPromise(function(_0x48a2ef,_0x13879f){return getInteractionUsers(_0x5ab42b,_0x37fe22)[_0x5bbb('0x32')](function(_0x11b72a){return getInteractionTags(_0x11b72a,_0x494f8d);})[_0x5bbb('0x32')](function(_0x3d841c){_0x48a2ef(_0x3d841c);})[_0x5bbb('0x45')](function(_0x2f9a41){_0x13879f(_0x2f9a41);});});}exports['index']=function(_0x4958ea,_0x1390da){var _0xb41fe1={},_0x513104={},_0x2c1a37={'count':0x0,'rows':[]};var _0x12ee04=_['map'](db[_0x5bbb('0x46')][_0x5bbb('0x47')],function(_0x21df4){return{'name':_0x21df4[_0x5bbb('0x48')],'type':_0x21df4[_0x5bbb('0x49')][_0x5bbb('0x4a')]};});_0x513104[_0x5bbb('0x4b')]=_['map'](_0x12ee04,_0x5bbb('0x35'));_0x513104[_0x5bbb('0x4c')]=_['keys'](_0x4958ea[_0x5bbb('0x4c')]);_0x513104[_0x5bbb('0x4d')]=_[_0x5bbb('0x4e')](_0x513104['model'],_0x513104['query']);_0xb41fe1[_0x5bbb('0x4f')]=_[_0x5bbb('0x4e')](_0x513104[_0x5bbb('0x4b')],qs[_0x5bbb('0x50')](_0x4958ea[_0x5bbb('0x4c')][_0x5bbb('0x50')]));_0xb41fe1[_0x5bbb('0x4f')]=_0xb41fe1[_0x5bbb('0x4f')][_0x5bbb('0x51')]?_0xb41fe1['attributes']:_0x513104['model'];if(!_0x4958ea[_0x5bbb('0x4c')][_0x5bbb('0x52')](_0x5bbb('0x53'))){_0xb41fe1['limit']=qs['limit'](_0x4958ea[_0x5bbb('0x4c')]['limit']);_0xb41fe1['offset']=qs[_0x5bbb('0x2c')](_0x4958ea[_0x5bbb('0x4c')][_0x5bbb('0x2c')]);}_0xb41fe1[_0x5bbb('0x54')]=qs[_0x5bbb('0x55')](_0x4958ea[_0x5bbb('0x4c')]['sort']);_0xb41fe1[_0x5bbb('0x56')]=qs[_0x5bbb('0x4d')](_[_0x5bbb('0x57')](_0x4958ea[_0x5bbb('0x4c')],_0x513104[_0x5bbb('0x4d')]),_0x12ee04);var _0x58de49=[];var _0x3ca2eb=squel[_0x5bbb('0x58')]()['field']('id')[_0x5bbb('0x59')](_0x5bbb('0x35'))[_0x5bbb('0x59')](_0x5bbb('0x5a'))['from'](_0x5bbb('0x5b'));var _0x696d9=squel[_0x5bbb('0x58')]()[_0x5bbb('0x59')]('u.id')[_0x5bbb('0x59')](_0x5bbb('0x5c'))[_0x5bbb('0x59')](_0x5bbb('0x5d'))[_0x5bbb('0x5e')](_0x5bbb('0x5f'),'ui')[_0x5bbb('0x60')]('users','u',_0x5bbb('0x61'));var _0x288a13=squel['select']()[_0x5bbb('0x5e')](_0x5bbb('0x62'),'i')[_0x5bbb('0x60')]('cm_contacts','c',_0x5bbb('0x63'))[_0x5bbb('0x60')]('users','o',_0x5bbb('0x64'))[_0x5bbb('0x60')]('chat_websites','a',_0x5bbb('0x65'))[_0x5bbb('0x60')](_0x5bbb('0x66'),'me','me.ChatInteractionId\x20=\x20i.id')['left_join'](_0x5bbb('0x67'),'it','it.ChatInteractionId\x20=\x20i.id')['left_join'](_0x5bbb('0x5b'),'t',_0x5bbb('0x68'));var _0x34e173=squel[_0x5bbb('0x69')]();var _0x3c0d48=[];var _0x3ccac8=squel['expr']();var _0x42bd2c;if(_0x4958ea['query']['search']){_0x42bd2c=as[_0x5bbb('0x6a')](_0x4958ea[_0x5bbb('0x4c')][_0x5bbb('0x6b')]);var _0x36a1f3=_0x42bd2c[_0x5bbb('0x6c')];for(var _0xfbec53=0x0;_0xfbec53<_0x42bd2c[_0x5bbb('0x6d')]['length'];_0xfbec53++){var _0x313efe=_0x42bd2c[_0x5bbb('0x6d')][_0xfbec53];var _0x212888='i';var _0xa18e3b=_['find'](_0x12ee04,[_0x5bbb('0x35'),_0x313efe['field']]);if(!_0xa18e3b){switch(_0x313efe['field']){case _0x5bbb('0x6e'):if(_0x313efe[_0x5bbb('0x6f')]==0x1){_0x288a13[_0x5bbb('0x70')]('`'+_0x313efe[_0x5bbb('0x59')]+_0x5bbb('0x71'));}else{_0x288a13['having']('`'+_0x313efe['field']+_0x5bbb('0x72'));}break;case'Contact':if(_0x313efe[_0x5bbb('0x73')]===_0x5bbb('0x74')){if(_0x313efe[_0x5bbb('0x6f')][_0x5bbb('0x41')]('\x20')[_0x5bbb('0x51')]>0x1){_0x34e173[_0x36a1f3](_0x5bbb('0x75'),qs[_0x5bbb('0x76')](_0x313efe[_0x5bbb('0x6f')]),null);}else{var _0x467389='%'+_0x313efe['value']+'%';_0x34e173[_0x36a1f3](_0x5bbb('0x77'),_0x467389,_0x467389,_0x467389);}}else{_0xa18e3b=_['find'](_0x12ee04,['name',_0x5bbb('0x78')]);_0x313efe[_0x5bbb('0x59')]=_0x5bbb('0x78');_0x252942=as[_0x5bbb('0x79')](_0x212888,_0xa18e3b[_0x5bbb('0x49')],_0x313efe);_0x34e173[_0x36a1f3](_0x252942[_0x5bbb('0x7a')],_0x252942['value'][_0x5bbb('0x7b')],_0x252942[_0x5bbb('0x6f')]['end']);}break;case _0x5bbb('0x7c'):var _0x530fa4=_0x313efe[_0x5bbb('0x6f')]['split'](',')['map'](function(_0x84db0f){return Number(_0x84db0f);});_0x530fa4[_0x5bbb('0x42')](function(_0x46caa5){_0x3ccac8['or'](_0x5bbb('0x7d'),'%,'+_0x46caa5+',%');});_0x3c0d48=_[_0x5bbb('0x7e')](_0x3c0d48,_0x530fa4);break;case _0x5bbb('0x7f'):if(_0x313efe['operator']===_0x5bbb('0x74')){_0x34e173[_0x36a1f3](_0x5bbb('0x80'),'%'+_0x313efe[_0x5bbb('0x6f')]+'%',null);}else{_0xa18e3b=_[_0x5bbb('0x81')](_0x12ee04,[_0x5bbb('0x35'),_0x5bbb('0x82')]);_0x313efe[_0x5bbb('0x59')]='UserId';_0x252942=as[_0x5bbb('0x79')](_0x212888,_0xa18e3b[_0x5bbb('0x49')],_0x313efe);_0x34e173[_0x36a1f3](_0x252942[_0x5bbb('0x7a')],_0x252942[_0x5bbb('0x6f')]['start'],_0x252942[_0x5bbb('0x6f')][_0x5bbb('0x27')]);}break;case'body':_0x252942=as[_0x5bbb('0x79')]('me',null,_0x313efe);_0x34e173[_0x36a1f3](_0x252942['text'],_0x252942[_0x5bbb('0x6f')][_0x5bbb('0x7b')],_0x252942[_0x5bbb('0x6f')][_0x5bbb('0x27')]);break;}}else{var _0x252942=as[_0x5bbb('0x79')](_0x212888,_0xa18e3b[_0x5bbb('0x49')],_0x313efe);_0x34e173[_0x36a1f3](_0x252942[_0x5bbb('0x7a')],_0x252942['value'][_0x5bbb('0x7b')],_0x252942[_0x5bbb('0x6f')]['end']);}}}else{var _0x54c9d5=_(_0x4958ea['query'])[_0x5bbb('0x83')]()['map'](function(_0x252ba7){return _[_0x5bbb('0x84')](_0x12ee04,[_0x5bbb('0x35'),_0x252ba7])?_0x252ba7:undefined;})[_0x5bbb('0x85')]()['value']();if(!_[_0x5bbb('0x86')](_0x54c9d5)){_0x54c9d5[_0x5bbb('0x42')](function(_0x15bc72){if(_0x15bc72===_0x5bbb('0x87')){_0x288a13[_0x5bbb('0x56')](_0x5bbb('0x88'),[]['concat'](_0x4958ea['query'][_0x15bc72]));}else if(_0x15bc72===_0x5bbb('0x89')){var _0x36f792=JSON[_0x5bbb('0x8a')](_0x4958ea[_0x5bbb('0x4c')][_0x15bc72])[_0x5bbb('0x8b')];var _0x6ea91b=JSON[_0x5bbb('0x8a')](_0x4958ea['query'][_0x15bc72])['$lte'];_0x288a13[_0x5bbb('0x56')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x36f792,_0x6ea91b);}else{if(_0x4958ea['query'][_0x15bc72]===_0x5bbb('0x8c')){_0x288a13[_0x5bbb('0x56')]('i.'+_0x15bc72+_0x5bbb('0x8d'));}else{_0x288a13[_0x5bbb('0x56')]('i.'+_0x15bc72+_0x5bbb('0x8e'),_0x4958ea[_0x5bbb('0x4c')][_0x15bc72]);}}});}if(_0x4958ea[_0x5bbb('0x4c')][_0x5bbb('0x8f')]){if(_0x4958ea[_0x5bbb('0x4c')][_0x5bbb('0x8f')]==0x1){_0x288a13[_0x5bbb('0x70')](_0x5bbb('0x90'));}else{_0x288a13[_0x5bbb('0x70')](_0x5bbb('0x91'));}}if(_0x4958ea[_0x5bbb('0x4c')][_0x5bbb('0x92')]){_0x3c0d48=_[_0x5bbb('0x93')](_0x4958ea[_0x5bbb('0x4c')][_0x5bbb('0x92')])?_0x4958ea[_0x5bbb('0x4c')]['tag']:new Array(_0x4958ea[_0x5bbb('0x4c')][_0x5bbb('0x92')]);_0x3c0d48[_0x5bbb('0x42')](function(_0x56e8c7){_0x3ccac8['or'](_0x5bbb('0x7d'),'%,'+_0x56e8c7+',%');});}if(_0x4958ea[_0x5bbb('0x4c')][_0x5bbb('0x94')]){var _0xff4136=_0x4958ea['query'][_0x5bbb('0x94')][_0x5bbb('0x95')]('\x5c','\x5c\x5c')[_0x5bbb('0x95')](/'/g,'\x27\x27');if(qs[_0x5bbb('0x96')](_0xff4136)){_0x34e173['or'](_0x5bbb('0x97'),_0xff4136+'%');}else{_0x34e173['or'](_0x5bbb('0x98'),qs[_0x5bbb('0x76')](_0xff4136))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xff4136+'%');}}}_0x288a13[_0x5bbb('0x56')](_0x34e173);_0x288a13[_0x5bbb('0x99')](_0x5bbb('0x9a'));var _0x1effda={'type':db[_0x5bbb('0x9b')]['QueryTypes'][_0x5bbb('0x9c')],'raw':!![]};var _0x1e1143=_0x288a13[_0x5bbb('0x9d')]();_0x1e1143[_0x5bbb('0x59')](_0x5bbb('0x9a'));_0x1e1143[_0x5bbb('0x59')](_0x5bbb('0x9e'),_0x5bbb('0x6e'));if(_0xb41fe1[_0x5bbb('0x54')]){_0xb41fe1[_0x5bbb('0x54')][_0x5bbb('0x42')](function(_0x2083f4){var _0x3be162=_0x2083f4[0x0]==='contactName'?_0x2083f4[0x0]:'i.'+_0x2083f4[0x0];_0x288a13['order'](_0x3be162,_0x2083f4[0x1]===_0x5bbb('0x9f')?![]:!![]);});}if(!_[_0x5bbb('0x86')](_0x3c0d48)){_0x288a13[_0x5bbb('0x70')](_0x3ccac8);_0x1e1143[_0x5bbb('0x56')](_0x5bbb('0xa0'),_0x3c0d48);}BPromise[_0x5bbb('0xa1')]()[_0x5bbb('0x32')](function(){if(!_0x42bd2c){if(_0x4958ea[_0x5bbb('0x4c')][_0x5bbb('0x87')])return;_0x1e1143['where'](_0x5bbb('0xa2'));_0x288a13[_0x5bbb('0x56')](_0x5bbb('0xa2'));return;}if(_0x4958ea[_0x5bbb('0xa3')][_0x5bbb('0xa4')]!==_0x5bbb('0xa5'))return;return _0x4958ea[_0x5bbb('0xa3')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x5bbb('0x32')](function(_0x57aa6f){if(_[_0x5bbb('0x86')](_0x57aa6f)){_0x1e1143[_0x5bbb('0x56')]('i.ChatWebsiteId\x20IS\x20NULL');_0x288a13['where'](_0x5bbb('0xa6'));}else{_0x1e1143[_0x5bbb('0x56')]('i.ChatWebsiteId\x20IN\x20?',_[_0x5bbb('0x3e')](_0x57aa6f,'id'));_0x288a13[_0x5bbb('0x56')](_0x5bbb('0x88'),_['map'](_0x57aa6f,'id'));}});})['then'](function(){if(_0x4958ea[_0x5bbb('0xa3')][_0x5bbb('0xa4')]==='agent'&&!_0x42bd2c&&!_0x4958ea[_0x5bbb('0x4c')][_0x5bbb('0x87')])return[];return db[_0x5bbb('0xa7')][_0x5bbb('0x4c')](_0x1e1143[_0x5bbb('0xa8')](),_0x1effda);})['then'](function(_0x53aeaa){_0x2c1a37[_0x5bbb('0x2b')]=_0x53aeaa[_0x5bbb('0x51')];if(_0x2c1a37['count']===0x0)return[];return db[_0x5bbb('0xa7')][_0x5bbb('0x4c')](_0x3ca2eb[_0x5bbb('0xa8')](),_0x1effda)[_0x5bbb('0x32')](function(_0x5c9f10){_0x58de49=_[_0x5bbb('0xa9')](_0x5c9f10,'id');_0x1effda=_[_0x5bbb('0x38')](_0x1effda,{'model':db[_0x5bbb('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4958ea['query'][_0x5bbb('0x50')]){_0xb41fe1[_0x5bbb('0x4f')][_0x5bbb('0x42')](function(_0x39c31f){_0x288a13[_0x5bbb('0x59')]('i.'+_0x39c31f);});}else{_0x288a13[_0x5bbb('0x59')](_0x5bbb('0x9e'),'unreadMessages');_0x288a13[_0x5bbb('0x59')](_0x5bbb('0xaa'),'Account.key');_0x288a13[_0x5bbb('0x59')](_0x5bbb('0xab'),'Account.mandatoryDisposition');_0x288a13[_0x5bbb('0x59')]('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',_0x5bbb('0xac'));_0x288a13[_0x5bbb('0x59')](_0x5bbb('0xad'));_0x288a13[_0x5bbb('0x59')]('c.firstName',_0x5bbb('0xae'));_0x288a13[_0x5bbb('0x59')](_0x5bbb('0xaf'),_0x5bbb('0xb0'));_0x288a13['field'](_0x5bbb('0xb1'),_0x5bbb('0xb2'));_0x288a13[_0x5bbb('0x59')](_0x5bbb('0xb3'),_0x5bbb('0xb4'));_0x288a13['field'](_0x5bbb('0xb5'),'Contact.mobile');_0x288a13[_0x5bbb('0x59')](_0x5bbb('0xb6'),_0x5bbb('0xb7'));_0x288a13[_0x5bbb('0x59')](_0x5bbb('0xb8'),_0x5bbb('0xb9'));_0x288a13['field'](_0x5bbb('0xba'),_0x5bbb('0xbb'));_0x288a13[_0x5bbb('0x59')](_0x5bbb('0xbc'),_0x5bbb('0x40'));}if(_0xb41fe1[_0x5bbb('0xbd')])_0x288a13[_0x5bbb('0xbd')](_0xb41fe1[_0x5bbb('0xbd')]);if(_0xb41fe1[_0x5bbb('0x2c')])_0x288a13['offset'](_0xb41fe1[_0x5bbb('0x2c')]);return db[_0x5bbb('0xa7')][_0x5bbb('0x4c')](_0x288a13[_0x5bbb('0xa8')](),_0x1effda);})[_0x5bbb('0x32')](function(_0x261995){if(_0x261995['length']>0x0)_0x696d9['where'](_0x5bbb('0xbe'),_[_0x5bbb('0x3e')](_0x261995,'id'));return db[_0x5bbb('0xa7')][_0x5bbb('0x4c')](_0x696d9[_0x5bbb('0xa8')](),_0x1effda)[_0x5bbb('0x32')](function(_0x197ddd){var _0x334ae0=_['groupBy'](_0x197ddd,_0x5bbb('0xbf'));var _0x2d25f6=[];_0x261995['forEach'](function(_0x560513){_0x2d25f6[_0x5bbb('0x44')](updateChatInteraction(_0x560513,_0x58de49,_0x334ae0));});return BPromise[_0x5bbb('0xc0')](_0x2d25f6);});});})[_0x5bbb('0x32')](function(_0x1ce9fd){_0x2c1a37[_0x5bbb('0xc1')]=_0x1ce9fd;return _0x2c1a37;})[_0x5bbb('0x32')](respondWithFilteredResult(_0x1390da,_0xb41fe1))[_0x5bbb('0x45')](handleError(_0x1390da,null));};exports['show']=function(_0x5873a7,_0x301cb3){var _0x1d8872={'raw':![],'where':{'id':_0x5873a7[_0x5bbb('0xc2')]['id']}},_0x92447={};_0x92447[_0x5bbb('0x4b')]=_[_0x5bbb('0x83')](db[_0x5bbb('0x46')]['rawAttributes']);_0x92447[_0x5bbb('0x4c')]=_['keys'](_0x5873a7['query']);_0x92447[_0x5bbb('0x4d')]=_[_0x5bbb('0x4e')](_0x92447[_0x5bbb('0x4b')],_0x92447[_0x5bbb('0x4c')]);_0x1d8872['attributes']=_[_0x5bbb('0x4e')](_0x92447[_0x5bbb('0x4b')],qs[_0x5bbb('0x50')](_0x5873a7[_0x5bbb('0x4c')][_0x5bbb('0x50')]));_0x1d8872[_0x5bbb('0x4f')]=_0x1d8872[_0x5bbb('0x4f')]['length']?_0x1d8872[_0x5bbb('0x4f')]:_0x92447['model'];if(_0x5873a7['query'][_0x5bbb('0xc3')]){_0x1d8872[_0x5bbb('0xc4')]=[{'all':!![]}];}_0x1d8872=_[_0x5bbb('0x38')]({},_0x1d8872,_0x5873a7[_0x5bbb('0xc5')]);return db[_0x5bbb('0x46')][_0x5bbb('0x81')](_0x1d8872)['then'](handleEntityNotFound(_0x301cb3,null))[_0x5bbb('0x32')](respondWithResult(_0x301cb3,null))['catch'](handleError(_0x301cb3,null));};exports[_0x5bbb('0xc6')]=function(_0x1efab6,_0x50b76a){return db['ChatInteraction'][_0x5bbb('0xc6')](_0x1efab6[_0x5bbb('0x39')],{})[_0x5bbb('0x32')](respondWithResult(_0x50b76a,0xc9))['catch'](handleError(_0x50b76a,null));};exports[_0x5bbb('0xc7')]=function(_0xdc4cc6,_0x5a4beb){if(_0xdc4cc6['body']['id']){delete _0xdc4cc6[_0x5bbb('0x39')]['id'];}return db[_0x5bbb('0x46')]['find']({'where':{'id':_0xdc4cc6[_0x5bbb('0xc2')]['id']}})[_0x5bbb('0x32')](handleEntityNotFound(_0x5a4beb,null))[_0x5bbb('0x32')](saveUpdates(_0xdc4cc6[_0x5bbb('0x39')],null))[_0x5bbb('0x32')](respondWithResult(_0x5a4beb,null))[_0x5bbb('0x45')](handleError(_0x5a4beb,null));};exports['destroy']=function(_0x3e260e,_0x1bc749){return db[_0x5bbb('0x46')][_0x5bbb('0x81')]({'where':{'id':_0x3e260e[_0x5bbb('0xc2')]['id']}})['then'](handleEntityNotFound(_0x1bc749,null))[_0x5bbb('0x32')](removeEntity(_0x1bc749,null))['catch'](handleError(_0x1bc749,null));};exports[_0x5bbb('0xc8')]=function(_0x1a7f7a,_0x571b70){return db[_0x5bbb('0x46')][_0x5bbb('0xc8')]()[_0x5bbb('0x32')](respondWithResult(_0x571b70,null))[_0x5bbb('0x45')](handleError(_0x571b70,null));};exports['createVidaooSession']=function(_0x582ca9,_0x5c0e4b){var _0x354882=_0x582ca9['params']['id'];var _0x90bc04;var _0x160138;var _0x50ff36;return db[_0x5bbb('0x46')][_0x5bbb('0xc9')]({'where':{'id':_0x354882}})[_0x5bbb('0x32')](function(_0x3db551){_0x90bc04=_0x3db551;return db[_0x5bbb('0xca')]['findOne']({'where':{'id':_0x3db551['ChatWebsiteId']},'attributes':['id',_0x5bbb('0xcb'),_0x5bbb('0xcc'),_0x5bbb('0xcd'),_0x5bbb('0xce'),_0x5bbb('0xcf')],'raw':!![]});})[_0x5bbb('0x32')](function(_0x58d7ab){if(_0x58d7ab&&_0x58d7ab[_0x5bbb('0xcb')]&&_0x58d7ab['vidaooEscalation']){_0x160138=_0x58d7ab;var _0x1a2ea5={'interaction':{'id':_0x354882},'agent':{'id':_0x582ca9[_0x5bbb('0xa3')]['id'],'name':_0x582ca9[_0x5bbb('0xa3')][_0x5bbb('0x35')],'fullname':_0x582ca9[_0x5bbb('0xa3')]['fullname'],'email':_0x582ca9['user']['email']},'contact':_0x582ca9[_0x5bbb('0x39')][_0x5bbb('0x3a')],'account':_0x582ca9['body'][_0x5bbb('0x3c')]};var _0x10e8b6={'rejectUnauthorized':![],'method':_0x5bbb('0xd0'),'url':_0x5bbb('0xd1'),'headers':{'X-APIKEY':_0x58d7ab[_0x5bbb('0xcb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x582ca9[_0x5bbb('0xa3')][_0x5bbb('0xd2')]],'buttons':null,'topic':_0x160138[_0x5bbb('0xcd')],'note':_[_0x5bbb('0xd3')](_0x160138[_0x5bbb('0xce')])?null:getMustacheRender(_0x160138[_0x5bbb('0xce')],_0x1a2ea5),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x5bbb('0xd3')](_0x160138['vidaooMetadata'])){var _0x241c3f=getMustacheRender(_0x160138['vidaooMetadata'],_0x1a2ea5);var _0x813be6=JSON[_0x5bbb('0x8a')](_0x241c3f);_0x10e8b6['body']['metadata']=_0x813be6;}}catch(_0x3f4972){throw new db[(_0x5bbb('0x9b'))][(_0x5bbb('0xd4'))](_0x5bbb('0xd5'));}return rp(_0x10e8b6);}else{throw new db[(_0x5bbb('0x9b'))][(_0x5bbb('0xd4'))](_0x5bbb('0xd6'));}})[_0x5bbb('0x32')](function(_0x207e4c){_0x50ff36=_0x207e4c;if(_0x50ff36['id']){var _0x4ac03f={'body':_0x50ff36['join_url'],'ChatWebsiteId':_0x160138['id'],'ChatInteractionId':_0x90bc04['id'],'direction':_0x5bbb('0xd7'),'UserId':_0x582ca9['user']['id']};return db[_0x5bbb('0xd8')][_0x5bbb('0xc6')](_0x4ac03f,{});}else{throw new db[(_0x5bbb('0x9b'))][(_0x5bbb('0xd4'))](_0x5bbb('0xd9'));}})[_0x5bbb('0x32')](function(){return _0x90bc04['updateAttributes']({'vidaooSessionId':_0x50ff36['id']});})[_0x5bbb('0x32')](respondWithResult(_0x5c0e4b,null))[_0x5bbb('0x45')](handleError(_0x5c0e4b,null));};exports[_0x5bbb('0xda')]=function(_0xbe82bf,_0x1d9f79){if(_0xbe82bf[_0x5bbb('0x39')]['id']){delete _0xbe82bf['body']['id'];}return db['ChatInteraction'][_0x5bbb('0x81')]({'where':{'id':_0xbe82bf[_0x5bbb('0xc2')]['id']},'include':[{'model':db[_0x5bbb('0xdb')],'as':_0x5bbb('0xdc')}]})[_0x5bbb('0x32')](handleEntityNotFound(_0x1d9f79,null))['then'](saveUpdates(_0xbe82bf[_0x5bbb('0x39')],null))[_0x5bbb('0x32')](respondWithResult(_0x1d9f79,null))[_0x5bbb('0x45')](handleError(_0x1d9f79,null));};exports[_0x5bbb('0xdd')]=function(_0x15de5c,_0x1c8e54,_0x9d6c77){if(_0x15de5c[_0x5bbb('0x39')]['id']){delete _0x15de5c[_0x5bbb('0x39')]['id'];}return db[_0x5bbb('0x46')][_0x5bbb('0x81')]({'where':{'id':_0x15de5c[_0x5bbb('0xc2')]['id']}})[_0x5bbb('0x32')](function(_0x527aba){if(!_0x527aba){logger[_0x5bbb('0x24')](_0x5bbb('0xde'),_0x5bbb('0xdd'),0x194,_0x5bbb('0xdf'));_0x1c8e54['sendStatus'](0x194);}else{if(_0x527aba[_0x5bbb('0x82')]){throw new db[(_0x5bbb('0x9b'))][(_0x5bbb('0xd4'))](_0x5bbb('0xe0'));}}return _0x527aba;})[_0x5bbb('0x32')](function(_0x701c4d){if(_0x701c4d){return _0x701c4d[_0x5bbb('0xc7')]({'closed':_0x15de5c[_0x5bbb('0x39')][_0x5bbb('0xe1')],'disposition':_0x15de5c[_0x5bbb('0x39')][_0x5bbb('0xe2')]})[_0x5bbb('0x32')](function(_0x129c42){return _0x129c42;});}})[_0x5bbb('0x32')](function(_0x5b0c3f){return respondWithRpcPromise(_0x5bbb('0xe3'),_0x5bbb('0xdd'),_0x15de5c[_0x5bbb('0x39')],client9004);})['then'](respondWithResult(_0x1c8e54,null))[_0x5bbb('0x45')](handleError(_0x1c8e54,null));};exports[_0x5bbb('0xe4')]=function(_0x1ea408,_0x559490,_0x29fc56){_0x1ea408[_0x5bbb('0x39')][_0x5bbb('0x35')]=_0x1ea408[_0x5bbb('0xe5')][_0x5bbb('0xe6')];_0x1ea408['body']['basename']=_0x1ea408[_0x5bbb('0xe5')][_0x5bbb('0xe7')];_0x1ea408[_0x5bbb('0x39')][_0x5bbb('0x49')]=_0x1ea408[_0x5bbb('0xe5')]['mimetype'];return db[_0x5bbb('0xe8')]['create'](_0x1ea408[_0x5bbb('0x39')])[_0x5bbb('0x32')](respondWithResult(_0x559490,0xc9))[_0x5bbb('0x45')](handleError(_0x559490,null));};exports[_0x5bbb('0xe9')]=function(_0x17f3a3,_0x488faf,_0x3cc329){return db[_0x5bbb('0x46')][_0x5bbb('0xc9')]({'where':{'id':_0x17f3a3[_0x5bbb('0xc2')]['id']},'raw':!![]})[_0x5bbb('0x32')](handleEntityNotFound(_0x488faf,null))[_0x5bbb('0x32')](function(_0x271b20){if(_0x271b20){if(_0x271b20[_0x5bbb('0xe1')]){return _0x488faf[_0x5bbb('0x28')](0x193)[_0x5bbb('0x29')]({'status':0x193,'message':_0x5bbb('0xea')});}return db[_0x5bbb('0xe8')][_0x5bbb('0xc9')]({'where':{'id':_0x17f3a3['query']['attachId']},'raw':!![]})[_0x5bbb('0x32')](handleEntityNotFound(_0x488faf,null));}})[_0x5bbb('0x32')](function(_0x5688b6){if(_0x5688b6){var _0x55f0f0=_0x5688b6[_0x5bbb('0xeb')]!==null;var _0x9dc935=path['join'](config['root'],_0x5bbb('0xec'));if(_0x55f0f0){_0x9dc935=path[_0x5bbb('0xed')](_0x9dc935,_0x5bbb('0xee'));}var _0x502c7f=path[_0x5bbb('0xed')](_0x9dc935,_0x5688b6[_0x5bbb('0xef')]);return _0x488faf[_0x5bbb('0xf0')](_0x502c7f);}})[_0x5bbb('0x45')](handleError(_0x488faf,null));};exports['close']=function(_0x15e533,_0x24c750){var _0xdbe4ec=null;var _0x37a955=null;var _0x168abc=null;var _0x5b8a3d=null;if(_0x15e533[_0x5bbb('0x39')]['id']){delete _0x15e533[_0x5bbb('0x39')]['id'];}if(_0x15e533[_0x5bbb('0x39')][_0x5bbb('0xf1')]){_0x5b8a3d=path['join'](config[_0x5bbb('0xf2')],_0x5bbb('0xf3'),util[_0x5bbb('0xf4')](_0x5bbb('0xf5'),Date[_0x5bbb('0xf6')]()));_0x15e533[_0x5bbb('0x39')][_0x5bbb('0xf7')]=_0x5b8a3d;}return db[_0x5bbb('0x46')][_0x5bbb('0x81')]({'where':{'id':_0x15e533[_0x5bbb('0xc2')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x5bbb('0xf8'),'include':[{'model':db[_0x5bbb('0x7f')],'as':_0x5bbb('0x7f')}]}]})[_0x5bbb('0x32')](handleEntityNotFound(_0x24c750,null))[_0x5bbb('0x32')](saveUpdates(_0x15e533[_0x5bbb('0x39')],null))['then'](function(_0x5b906e){if(_0x5b906e){_0xdbe4ec=_0x5b906e;return db[_0x5bbb('0xca')][_0x5bbb('0x81')]({'where':{'id':_0xdbe4ec[_0x5bbb('0x87')]}});}})[_0x5bbb('0x32')](function(_0xa31ef6){if(_0xa31ef6){_0x168abc=_0xa31ef6;return db['CmContact'][_0x5bbb('0x81')]({'where':{'id':_0xdbe4ec['ContactId']}});}})[_0x5bbb('0x32')](function(_0xff02c5){if(_0xff02c5){_0x37a955=_0xff02c5;if(_0x5b8a3d){var _0x5fd278=null;for(var _0x3c3991=0x1;_0x3c3991<_0xdbe4ec[_0x5bbb('0xf8')][_0x5bbb('0x51')];++_0x3c3991){_0x5fd278=_0xdbe4ec[_0x5bbb('0xf8')][_0x3c3991];var _0x53bc06=_0x5fd278[_0x5bbb('0x82')]?util['format'](_0x5bbb('0xf9'),_0x168abc[_0x5bbb('0xfa')],_0x5fd278[_0x5bbb('0x82')]):_0x5bbb('0xfb');var _0x174628=_0x15e533[_0x5bbb('0x39')][_0x5bbb('0xfc')]||util[_0x5bbb('0xf4')]('%s%d',_0x5bbb('0xfd'),_0x5fd278[_0x5bbb('0x78')]);switch(_0x168abc[_0x5bbb('0xfe')]){case _0x5bbb('0xff'):_0x53bc06=_0x5fd278['UserId']?util[_0x5bbb('0xf4')](_0x5bbb('0xf9'),_0x168abc[_0x5bbb('0xfa')],_0x5fd278['UserId']):_0x5bbb('0xfb');break;case _0x5bbb('0x100'):_0x53bc06=_0x5fd278[_0x5bbb('0x82')]?_0x5fd278[_0x5bbb('0x7f')]['alias']||_0x5fd278[_0x5bbb('0x7f')]['fullname']:_0x5bbb('0xfb');break;case _0x5bbb('0x101'):_0x53bc06=_0x5fd278[_0x5bbb('0x82')]?_0x5fd278['User'][_0x5bbb('0x3f')]:_0x5bbb('0xfb');break;default:_0x53bc06=_0x5fd278[_0x5bbb('0x82')]?util['format'](_0x5bbb('0xf9'),_0x168abc[_0x5bbb('0xfa')],_0x5fd278[_0x5bbb('0x82')]):_0x5bbb('0xfb');}var _0x199356=util[_0x5bbb('0xf4')](_0x5bbb('0x102'),moment(_0x5fd278[_0x5bbb('0x89')])[_0x5bbb('0xf4')](_0x5bbb('0x103')),_0x5fd278['direction']==='in'?_0x174628:_0x53bc06,_0x5fd278[_0x5bbb('0x39')]);if(!_0x5fd278['secret']){fs[_0x5bbb('0x104')](_0x5b8a3d,_0x199356);}}return db[_0x5bbb('0x105')][_0x5bbb('0xc9')]({'where':{'service':!![]},'include':[{'model':db[_0x5bbb('0x106')],'as':_0x5bbb('0x107'),'raw':!![]}]});}}})[_0x5bbb('0x32')](function(_0x5307fe){if(_0x5307fe&&_0x5307fe[_0x5bbb('0x107')]&&_0x15e533[_0x5bbb('0x39')]){var _0x4f944c={'tls':{'rejectUnauthorized':![]}};if(_0x5307fe[_0x5bbb('0x107')][_0x5bbb('0x108')]){_0x4f944c[_0x5bbb('0x108')]=_0x5307fe[_0x5bbb('0x107')][_0x5bbb('0x108')];}else{_0x4f944c['host']=_0x5307fe[_0x5bbb('0x107')][_0x5bbb('0x109')];_0x4f944c[_0x5bbb('0x10a')]=_0x5307fe['Smtp'][_0x5bbb('0x10a')];_0x4f944c['secure']=_0x5307fe[_0x5bbb('0x107')][_0x5bbb('0x10b')];}if(_0x5307fe['Smtp']['authentication']){_0x4f944c[_0x5bbb('0x10c')]={'user':_0x5307fe['Smtp'][_0x5bbb('0xa3')],'pass':_0x5307fe[_0x5bbb('0x107')][_0x5bbb('0x10d')]};}return respondWithRpcPromise('SendMail',_0x5bbb('0x10e'),{'account':_0x4f944c,'message':{'from':util[_0x5bbb('0xf4')](_0x5bbb('0x10f'),_0x5307fe[_0x5bbb('0x35')],_0x5307fe[_0x5bbb('0xd2')]||_0x5307fe[_0x5bbb('0x107')][_0x5bbb('0xa3')]),'to':_0x15e533[_0x5bbb('0x39')][_0x5bbb('0xf1')],'subject':_0x5bbb('0x110'),'text':util[_0x5bbb('0xf4')](_0x5bbb('0x111'),_0x15e533[_0x5bbb('0x39')][_0x5bbb('0xf1')]),'attachments':[{'path':_0x5b8a3d}]}})[_0x5bbb('0x32')](function(){return _0xdbe4ec;})[_0x5bbb('0x45')](function(_0x5b9496){console[_0x5bbb('0x24')](_0x5b9496);});}else{return _0xdbe4ec;}})[_0x5bbb('0x32')](respondWithStatusCode(_0x24c750,0xc8))['catch'](handleError(_0x24c750,null));};exports[_0x5bbb('0x112')]=function(_0x47f567,_0xdb70c4,_0x429ad2){return db[_0x5bbb('0xd8')][_0x5bbb('0x81')]({'where':{'id':_0x47f567[_0x5bbb('0xc2')]['id']}})[_0x5bbb('0x32')](handleEntityNotFound(_0xdb70c4,null))[_0x5bbb('0x32')](function(_0x3d3d35){if(_0x3d3d35){return _0x3d3d35[_0x5bbb('0x112')](_0x47f567[_0x5bbb('0x39')]['ids'],_[_0x5bbb('0x113')](_0x47f567[_0x5bbb('0x39')],[_0x5bbb('0x114'),'id'])||{});}})[_0x5bbb('0x32')](respondWithResult(_0xdb70c4,null))[_0x5bbb('0x45')](handleError(_0xdb70c4,null));};exports[_0x5bbb('0x115')]=function(_0x587cb9,_0x5cbf39,_0x337d08){var _0x337578={'raw':![],'where':{}};var _0x1ffad5={};var _0x5eb7c7={'count':0x0,'rows':[]};return db[_0x5bbb('0x46')][_0x5bbb('0xc9')]({'where':{'id':_0x587cb9['params']['id']}})[_0x5bbb('0x32')](handleEntityNotFound(_0x5cbf39,null))[_0x5bbb('0x32')](function(_0x218877){if(_0x218877){_0x1ffad5[_0x5bbb('0x4b')]=_[_0x5bbb('0x83')](db[_0x5bbb('0xd8')][_0x5bbb('0x47')]);_0x1ffad5[_0x5bbb('0x4c')]=_['keys'](_0x587cb9[_0x5bbb('0x4c')]);_0x1ffad5[_0x5bbb('0x4d')]=_['intersection'](_0x1ffad5[_0x5bbb('0x4b')],_0x1ffad5['query']);_0x337578[_0x5bbb('0x4f')]=_[_0x5bbb('0x4e')](_0x1ffad5[_0x5bbb('0x4b')],qs[_0x5bbb('0x50')](_0x587cb9[_0x5bbb('0x4c')][_0x5bbb('0x50')]));_0x337578['attributes']=_0x337578[_0x5bbb('0x4f')][_0x5bbb('0x51')]?_0x337578[_0x5bbb('0x4f')]:_0x1ffad5[_0x5bbb('0x4b')];if(!_0x587cb9['query']['hasOwnProperty'](_0x5bbb('0x53'))){_0x337578[_0x5bbb('0xbd')]=qs['limit'](_0x587cb9[_0x5bbb('0x4c')][_0x5bbb('0xbd')]);_0x337578['offset']=qs[_0x5bbb('0x2c')](_0x587cb9[_0x5bbb('0x4c')][_0x5bbb('0x2c')]);}_0x337578[_0x5bbb('0x54')]=qs[_0x5bbb('0x55')](_0x587cb9['query'][_0x5bbb('0x55')]);_0x337578[_0x5bbb('0x56')]=qs[_0x5bbb('0x4d')](_[_0x5bbb('0x57')](_0x587cb9[_0x5bbb('0x4c')],_0x1ffad5[_0x5bbb('0x4d')]));_0x337578[_0x5bbb('0x56')]['ChatInteractionId']=_0x218877['id'];if(_0x587cb9[_0x5bbb('0x4c')]['filter']){_0x337578[_0x5bbb('0x56')]=_['merge'](_0x337578[_0x5bbb('0x56')],{'$or':_[_0x5bbb('0x3e')](_0x337578[_0x5bbb('0x4f')],function(_0x44a1b8){var _0x2f5779={};_0x2f5779[_0x44a1b8]={'$like':'%'+_0x587cb9['query']['filter']+'%'};return _0x2f5779;})});}if(_0x587cb9['query'][_0x5bbb('0x8b')]){var _0x3f70b9=_0x587cb9['query'][_0x5bbb('0x8b')][_0x5bbb('0x41')](',');var _0x8e1e86={};_0x8e1e86[_0x3f70b9[0x0]]={'$gte':moment(_0x3f70b9[0x1])['format'](_0x5bbb('0x116'))};_0x337578[_0x5bbb('0x56')]=_[_0x5bbb('0x38')](_0x337578[_0x5bbb('0x56')],_0x8e1e86);}_0x337578=_[_0x5bbb('0x38')]({},_0x337578,_0x587cb9['options']);return db[_0x5bbb('0xd8')][_0x5bbb('0x2b')]({'where':_0x337578[_0x5bbb('0x56')]})[_0x5bbb('0x32')](function(_0x327147){_0x5eb7c7[_0x5bbb('0x2b')]=_0x327147;if(_0x587cb9[_0x5bbb('0x4c')]['includeAll']){_0x337578[_0x5bbb('0xc4')]=[{'all':!![]}];}return db[_0x5bbb('0xd8')][_0x5bbb('0x117')](_0x337578);})[_0x5bbb('0x32')](function(_0x19087f){_0x5eb7c7[_0x5bbb('0xc1')]=_0x19087f;return _0x5eb7c7;});}})[_0x5bbb('0x32')](respondWithFilteredResult(_0x5cbf39,_0x337578))['catch'](handleError(_0x5cbf39,null));};exports[_0x5bbb('0x118')]=function(_0x12ea3f,_0x31c440,_0x131665){var _0x8ff7ef={'where':{}},_0x3cc0d7={},_0xa36705={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x5bbb('0xc9')]({'where':{'id':_0x12ea3f[_0x5bbb('0xc2')]['id']}})['then'](handleEntityNotFound(_0x31c440,null))[_0x5bbb('0x32')](function(_0x196307){if(_0x196307){_0x3cc0d7['model']=_[_0x5bbb('0x83')](db[_0x5bbb('0xd8')]['rawAttributes']);_0x3cc0d7[_0x5bbb('0x4c')]=_[_0x5bbb('0x83')](_0x12ea3f['query']);_0x3cc0d7[_0x5bbb('0x4d')]=_[_0x5bbb('0x4e')](_0x3cc0d7['model'],_0x3cc0d7['query']);_0x8ff7ef['attributes']=_[_0x5bbb('0x4e')](_0x3cc0d7[_0x5bbb('0x4b')],qs['fields'](_0x12ea3f[_0x5bbb('0x4c')]['fields']));_0x8ff7ef['attributes']=_0x8ff7ef[_0x5bbb('0x4f')][_0x5bbb('0x51')]?_0x8ff7ef['attributes']:_0x3cc0d7['model'];if(!_0x12ea3f[_0x5bbb('0x4c')]['hasOwnProperty'](_0x5bbb('0x53'))){_0x8ff7ef[_0x5bbb('0xbd')]=qs['limit'](_0x12ea3f[_0x5bbb('0x4c')][_0x5bbb('0xbd')]);_0x8ff7ef[_0x5bbb('0x2c')]=qs[_0x5bbb('0x2c')](_0x12ea3f[_0x5bbb('0x4c')][_0x5bbb('0x2c')]);}_0x8ff7ef[_0x5bbb('0x54')]=qs[_0x5bbb('0x55')](_0x12ea3f['query'][_0x5bbb('0x55')]);_0x8ff7ef[_0x5bbb('0x56')]=qs[_0x5bbb('0x4d')](_['pick'](_0x12ea3f['query'],_0x3cc0d7[_0x5bbb('0x4d')]));_0x8ff7ef['where'][_0x5bbb('0xbf')]=_0x196307['id'];if(_0x12ea3f[_0x5bbb('0x4c')][_0x5bbb('0x94')]){_0x8ff7ef['where']=_['merge'](_0x8ff7ef[_0x5bbb('0x56')],{'$or':_['map'](_0x8ff7ef[_0x5bbb('0x4f')],function(_0x6e3503){var _0x1958ab={};_0x1958ab[_0x6e3503]={'$like':'%'+_0x12ea3f[_0x5bbb('0x4c')]['filter']+'%'};return _0x1958ab;})});}_0x8ff7ef[_0x5bbb('0x56')][_0x5bbb('0x119')]=![];if(_0x12ea3f[_0x5bbb('0x4c')]['id']){_0x8ff7ef[_0x5bbb('0x56')]['id']={'$gt':_0x12ea3f[_0x5bbb('0x4c')]['id']};}_0x8ff7ef=_['merge']({},_0x8ff7ef,_0x12ea3f[_0x5bbb('0xc5')]);return db[_0x5bbb('0xd8')][_0x5bbb('0x2b')]({'where':_0x8ff7ef[_0x5bbb('0x56')]})[_0x5bbb('0x32')](function(_0x298a7a){_0xa36705['count']=_0x298a7a;_0x8ff7ef['include']=[];if(_0x12ea3f[_0x5bbb('0x4c')][_0x5bbb('0x11a')]){_0x8ff7ef[_0x5bbb('0xc4')][_0x5bbb('0x44')]({'model':db[_0x5bbb('0x7f')],'as':_0x5bbb('0x7f'),'attributes':['id',_0x5bbb('0x3f'),_0x5bbb('0x11b')]});}if(_0x12ea3f[_0x5bbb('0x4c')][_0x5bbb('0xc3')]){_0x8ff7ef['include']=[{'all':!![]}];}return db[_0x5bbb('0xd8')][_0x5bbb('0x117')](_0x8ff7ef);})[_0x5bbb('0x32')](function(_0x24f122){_0xa36705['rows']=_0x24f122;return _0xa36705;});}})[_0x5bbb('0x32')](respondWithFilteredResult(_0x31c440,_0x8ff7ef))['catch'](handleError(_0x31c440,null));};exports[_0x5bbb('0x11c')]=function(_0x36f276,_0x45e94d,_0x1f0d73){return db[_0x5bbb('0x46')][_0x5bbb('0x81')]({'where':{'id':_0x36f276[_0x5bbb('0xc2')]['id']}})['then'](handleEntityNotFound(_0x45e94d,null))[_0x5bbb('0x32')](function(_0x5a61fc){if(_0x5a61fc){return _0x5a61fc[_0x5bbb('0x11d')](_0x36f276[_0x5bbb('0x39')]['ids'],_[_0x5bbb('0x113')](_0x36f276[_0x5bbb('0x39')],[_0x5bbb('0x114'),'id'])||{})[_0x5bbb('0x11e')](function(){return db['Tag'][_0x5bbb('0x117')]({'attributes':['id',_0x5bbb('0x35'),'color'],'where':{'id':_0x36f276[_0x5bbb('0x39')]['ids']}});})[_0x5bbb('0x32')](function(_0x256863){socket[_0x5bbb('0x11f')](_0x5bbb('0x120'),{'id':Number(_0x36f276[_0x5bbb('0xc2')]['id']),'tags':_0x256863||[]});return{'id':Number(_0x36f276['params']['id']),'tags':_0x256863||[]};});}})['then'](respondWithResult(_0x45e94d,null))[_0x5bbb('0x45')](handleError(_0x45e94d,null));};exports[_0x5bbb('0x121')]=function(_0x3ccabd,_0x4731b5,_0x1835e6){return db[_0x5bbb('0x46')][_0x5bbb('0x81')]({'where':{'id':_0x3ccabd[_0x5bbb('0xc2')]['id']}})[_0x5bbb('0x32')](handleEntityNotFound(_0x4731b5,null))[_0x5bbb('0x32')](function(_0x762b9b){if(_0x762b9b){return _0x762b9b['removeTags'](_0x3ccabd[_0x5bbb('0x4c')]['ids']);}})[_0x5bbb('0x32')](respondWithStatusCode(_0x4731b5,null))[_0x5bbb('0x45')](handleError(_0x4731b5,null));};exports[_0x5bbb('0xf0')]=function(_0x3a62b5,_0x4a2fd6){var _0x4395ab=moment()[_0x5bbb('0x122')]()['toString']();var _0x4f05fc=path['join'](config[_0x5bbb('0xf2')],'server',_0x5bbb('0x123'),_0x5bbb('0x124'));var _0x22561a=path['join'](config[_0x5bbb('0xf2')],_0x5bbb('0x125'),_0x5bbb('0x123'),_0x5bbb('0x126'));var _0x1523db=path[_0x5bbb('0xed')](_0x4f05fc,_0x4395ab);var _0x25651b=util[_0x5bbb('0xf4')]('transcript-%d-%s.zip',_0x3a62b5[_0x5bbb('0xc2')]['id'],_0x4395ab);var _0x5af8d4=path[_0x5bbb('0xed')](_0x4f05fc,_0x25651b);var _0x193f19=[];_0x193f19[_0x5bbb('0x44')]({'model':db[_0x5bbb('0x7f')],'as':_0x5bbb('0x7f'),'attributes':['id',_0x5bbb('0x3f')],'raw':!![]});_0x193f19['push']({'model':db[_0x5bbb('0xdb')],'as':_0x5bbb('0xdc'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x3a62b5[_0x5bbb('0x4c')][_0x5bbb('0x126')]){_0x193f19[_0x5bbb('0x44')]({'model':db[_0x5bbb('0xe8')],'as':_0x5bbb('0xe8'),'raw':!![]});}var _0x3fafa0=[{'model':db['ChatMessage'],'as':_0x5bbb('0xf8'),'attributes':['id',_0x5bbb('0x39'),_0x5bbb('0x89'),_0x5bbb('0x127'),_0x5bbb('0x119'),_0x5bbb('0x8f')],'include':_0x193f19}];_0x3fafa0[_0x5bbb('0x44')]({'model':db[_0x5bbb('0xca')],'as':'Account','attributes':['id','name']});_0x3fafa0[_0x5bbb('0x44')]({'model':db['User'],'as':'Owner','attributes':['id',_0x5bbb('0x3f')]});return db[_0x5bbb('0x46')][_0x5bbb('0x81')]({'where':{'id':_0x3a62b5[_0x5bbb('0xc2')]['id']},'include':_0x3fafa0})[_0x5bbb('0x32')](handleEntityNotFound(_0x4a2fd6,null))[_0x5bbb('0x32')](function(_0x5f52e7){if(_0x5f52e7){var _0x321452=_0x5f52e7[_0x5bbb('0x128')]({'plain':!![]});fs['mkdirSync'](_0x1523db);var _0x4f5d4b={'channel':'Chat','account':_0x321452['Account']['name'],'agent':_0x321452[_0x5bbb('0x129')]?_0x321452['Owner']['fullname']:_0x5bbb('0x12a'),'createdAt':moment(_0x321452[_0x5bbb('0x89')])[_0x5bbb('0xf4')](_0x5bbb('0x116'))[_0x5bbb('0xa8')](),'closedAt':_0x321452['closed']?moment(_0x321452[_0x5bbb('0x12b')])[_0x5bbb('0xf4')](_0x5bbb('0x116'))['toString']():'','disposition':_0x321452['disposition'],'chatInfo':{'browser':_0x321452[_0x5bbb('0x12c')],'os':_0x321452[_0x5bbb('0x12d')],'referer':_0x321452[_0x5bbb('0x12e')],'customerIp':_0x321452['customerIp'],'customerPort':_0x321452['customerPort']?_0x321452[_0x5bbb('0x12f')]:_0x5bbb('0x12a')},'messages':_(_0x321452[_0x5bbb('0xf8')])['tail']()[_0x5bbb('0x94')]({'secret':![]})[_0x5bbb('0x3e')](function(_0x39cc09){if(_0x39cc09['Attachment']){var _0x53fcaf=path[_0x5bbb('0xed')](_0x22561a,_0x39cc09[_0x5bbb('0xe8')][_0x5bbb('0xef')]);if(fs[_0x5bbb('0x130')](_0x53fcaf)){fs[_0x5bbb('0x131')](_0x53fcaf)[_0x5bbb('0x132')](fs[_0x5bbb('0x133')](path[_0x5bbb('0xed')](_0x1523db,_0x39cc09[_0x5bbb('0xe8')][_0x5bbb('0xef')])));}}return{'date':moment(_0x39cc09[_0x5bbb('0x89')])[_0x5bbb('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x39cc09['direction']===_0x5bbb('0xd7')?_0x39cc09[_0x5bbb('0x7f')]?_0x39cc09['User']['fullname']:_0x5bbb('0xfb'):_0x39cc09[_0x5bbb('0xdc')]['firstName']+(_0x39cc09['Contact']['lastName']?'\x20'+_0x39cc09[_0x5bbb('0xdc')][_0x5bbb('0x134')]:''),'body':_0x39cc09['Attachment']?_0x39cc09['Attachment']['basename']:_0x39cc09[_0x5bbb('0x39')],'direction':_0x39cc09[_0x5bbb('0x127')]==='out'?'A':'C','secret':_0x39cc09['secret'],'read':_0x39cc09['read'],'attachment':_0x39cc09['Attachment']};})[_0x5bbb('0x6f')]()};return ejs[_0x5bbb('0x135')](path[_0x5bbb('0xed')](config[_0x5bbb('0xf2')],_0x5bbb('0x125'),_0x5bbb('0x136'),_0x5bbb('0x137')),{'interaction':_0x4f5d4b})[_0x5bbb('0x32')](function(_0xa4d7f6){var _0x28c5b3=path['join'](_0x1523db,_0x5bbb('0x138')+_0x321452['id']+'-'+_0x4395ab+'.pdf');var _0x36f685={'path':_0x28c5b3,'channel':_0x5bbb('0x139'),'interactionId':_0x321452['id']};return pdf['createPdfFromHTML'](_0xa4d7f6,_0x36f685);})['then'](function(){return new BPromise(function(_0x2ca83e,_0x2cc04c){zipdir(_0x1523db,{'saveTo':_0x5af8d4},function(_0x370548,_0x396c86){if(_0x370548)return _0x2cc04c(_0x370548);return _0x2ca83e(_0x396c86);});})['then'](function(){return new BPromise(function(_0x17abc7,_0x32e66f){rimraf(_0x1523db,function(_0x5c99a7){if(_0x5c99a7)_0x32e66f(_0x5c99a7);return _0x17abc7();});});})[_0x5bbb('0x32')](function(){return _0x4a2fd6[_0x5bbb('0xf0')](_0x5af8d4,_0x25651b,function(_0x2364b1){if(_0x2364b1){console[_0x5bbb('0x13a')](_0x5bbb('0x13b'),_0x2364b1);}else{fs[_0x5bbb('0x13c')](_0x5af8d4);}});});});}else{return _0x4a2fd6[_0x5bbb('0x34')](0xc8);}})['catch'](handleError(_0x4a2fd6,null));}; \ No newline at end of file +var _0x7b5b=['tmp','server','attachments','transcript-%d-%s.zip','lastName','Attachment','Account','Owner','get','mkdirSync','closedAt','disposition','browserName','referer','customerPort','N.A.','tail','createReadStream','pipe','createWriteStream','out','firstName','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','then','sendStatus','stack','name','send','merge','body','contact','agent','interaction','account','Users','map','TagIds','Tags','split','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','conditions','length','find','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','buildExpression','text','keys','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','rows','show','params','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','user','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','update','closed','AbandonInteraction','abandon','attachmentUpload','file','mimetype','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','basename','download','close','mailTranscript','root','server/files/chat/upload/','format','now','pathTranscript','Messages','%s%d','agentAlias','System','Visitor','agentIdentifier','alias','fullname','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','Smtp','service','port','secure','authentication','pass','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','nolimit','pick','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','omit','spread','emit','chatInteractionTags:save','removeTags'];(function(_0x18f3c5,_0x56090a){var _0x408960=function(_0xa926c9){while(--_0xa926c9){_0x18f3c5['push'](_0x18f3c5['shift']());}};_0x408960(++_0x56090a);}(_0x7b5b,0x153));var _0xb7b5=function(_0x1f023e,_0x234646){_0x1f023e=_0x1f023e-0x0;var _0x20c7c2=_0x7b5b[_0x1f023e];return _0x20c7c2;};'use strict';var emlformat=require(_0xb7b5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb7b5('0x1'));var rp=require('request-promise');var moment=require(_0xb7b5('0x2'));var BPromise=require(_0xb7b5('0x3'));var Mustache=require(_0xb7b5('0x4'));var util=require(_0xb7b5('0x5'));var path=require(_0xb7b5('0x6'));var sox=require(_0xb7b5('0x7'));var csv=require(_0xb7b5('0x8'));var ejs=require(_0xb7b5('0x9'));var fs=require('fs');var fs_extra=require(_0xb7b5('0xa'));var _=require(_0xb7b5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb7b5('0xc'));var deskjs=require(_0xb7b5('0xd'));var toCsv=require(_0xb7b5('0x8'));var querystring=require('querystring');var Papa=require(_0xb7b5('0xe'));var Redis=require(_0xb7b5('0xf'));var authService=require(_0xb7b5('0x10'));var qs=require(_0xb7b5('0x11'));var as=require(_0xb7b5('0x12'));var pdf=require(_0xb7b5('0x13'));var hardwareService=require(_0xb7b5('0x14'));var logger=require('../../config/logger')(_0xb7b5('0x15'));var utils=require(_0xb7b5('0x16'));var config=require(_0xb7b5('0x17'));var licenseUtil=require(_0xb7b5('0x18'));var db=require(_0xb7b5('0x19'))['db'];config[_0xb7b5('0x1a')]=_[_0xb7b5('0x1b')](config[_0xb7b5('0x1a')],{'host':_0xb7b5('0x1c'),'port':0x18eb});var socket=require(_0xb7b5('0x1d'))(new Redis(config[_0xb7b5('0x1a')]));require(_0xb7b5('0x1e'))['register'](socket);var jayson=require(_0xb7b5('0x1f'));var client=jayson[_0xb7b5('0x20')]['http']({'port':0x232b});var client9004=jayson['client'][_0xb7b5('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x2ccd34,_0x350c29,_0x2327e3,_0x344ead){return new BPromise(function(_0x42c487,_0x849c3d){var _0x457e2f=_0x344ead||client;return _0x457e2f[_0xb7b5('0x22')](_0x2ccd34,_0x2327e3)['then'](function(_0x217196){logger[_0xb7b5('0x23')](_0xb7b5('0x24'),_0x350c29,_0xb7b5('0x25'));logger[_0xb7b5('0x26')](_0xb7b5('0x27'),_0x350c29,_0xb7b5('0x25'),JSON[_0xb7b5('0x28')](_0x217196));if(_0x217196[_0xb7b5('0x29')]){if(_0x217196['error']['code']===0x1f4){logger['error'](_0xb7b5('0x24'),_0x350c29,_0x217196[_0xb7b5('0x29')]['message']);return _0x849c3d(_0x217196['error'][_0xb7b5('0x2a')]);}logger[_0xb7b5('0x29')](_0xb7b5('0x24'),_0x350c29,_0x217196['error'][_0xb7b5('0x2a')]);return _0x42c487(_0x217196[_0xb7b5('0x29')][_0xb7b5('0x2a')]);}else{logger[_0xb7b5('0x23')](_0xb7b5('0x24'),_0x350c29,'request\x20sent');_0x42c487(_0x217196[_0xb7b5('0x2b')][_0xb7b5('0x2a')]);}})[_0xb7b5('0x2c')](function(_0x3c25de){logger['error'](_0xb7b5('0x24'),_0x350c29,_0x3c25de);_0x849c3d(_0x3c25de);});});}function respondWithStatusCode(_0x5211f6,_0x2ecf13){_0x2ecf13=_0x2ecf13||0xcc;return function(_0x516ba9){if(_0x516ba9){return _0x5211f6['sendStatus'](_0x2ecf13);}return _0x5211f6[_0xb7b5('0x2d')](_0x2ecf13)[_0xb7b5('0x2e')]();};}function respondWithResult(_0x279d29,_0x44595d){_0x44595d=_0x44595d||0xc8;return function(_0xc9ea7f){if(_0xc9ea7f){return _0x279d29[_0xb7b5('0x2d')](_0x44595d)[_0xb7b5('0x2f')](_0xc9ea7f);}};}function respondWithFilteredResult(_0x223e73,_0x3b1feb){return function(_0x46fef3){if(_0x46fef3){var _0x3f3fe7=typeof _0x3b1feb[_0xb7b5('0x30')]==='undefined'&&typeof _0x3b1feb[_0xb7b5('0x31')]===_0xb7b5('0x32');var _0x9338e4=_0x46fef3[_0xb7b5('0x33')];var _0x2d52c9=_0x3f3fe7?0x0:_0x3b1feb[_0xb7b5('0x30')];var _0x1795d0=_0x3f3fe7?_0x46fef3[_0xb7b5('0x33')]:_0x3b1feb['offset']+_0x3b1feb[_0xb7b5('0x31')];var _0x131fad;if(_0x1795d0>=_0x9338e4){_0x1795d0=_0x9338e4;_0x131fad=0xc8;}else{_0x131fad=0xce;}_0x223e73[_0xb7b5('0x2d')](_0x131fad);return _0x223e73[_0xb7b5('0x34')](_0xb7b5('0x35'),_0x2d52c9+'-'+_0x1795d0+'/'+_0x9338e4)[_0xb7b5('0x2f')](_0x46fef3);}return null;};}function patchUpdates(_0xfe1374){return function(_0x2b6a28){try{jsonpatch[_0xb7b5('0x36')](_0x2b6a28,_0xfe1374,!![]);}catch(_0x34048e){return BPromise['reject'](_0x34048e);}return _0x2b6a28[_0xb7b5('0x37')]();};}function saveUpdates(_0x5ec419,_0x578ab2){return function(_0x431d67){if(_0x431d67){return _0x431d67['update'](_0x5ec419)['then'](function(_0x10b5e1){return _0x10b5e1;});}return null;};}function removeEntity(_0xbecac0,_0xb0d627){return function(_0x132e56){if(_0x132e56){return _0x132e56[_0xb7b5('0x38')]()[_0xb7b5('0x39')](function(){_0xbecac0[_0xb7b5('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c67d2,_0xd22209){return function(_0x203c1e){if(!_0x203c1e){_0x1c67d2[_0xb7b5('0x3a')](0x194);}return _0x203c1e;};}function handleError(_0xfe7165,_0x1c3563){_0x1c3563=_0x1c3563||0x1f4;return function(_0x261a00){logger['error'](_0x261a00[_0xb7b5('0x3b')]);if(_0x261a00[_0xb7b5('0x3c')]){delete _0x261a00[_0xb7b5('0x3c')];}_0xfe7165[_0xb7b5('0x2d')](_0x1c3563)[_0xb7b5('0x3d')](_0x261a00);};}function getMustacheRender(_0x4b09d9,_0x352919){return Mustache['render'](_0x4b09d9,_[_0xb7b5('0x3e')](_0x352919[_0xb7b5('0x3f')],{'contact':_0x352919[_0xb7b5('0x40')],'message':_0x352919['message'],'agent':_0x352919[_0xb7b5('0x41')],'interaction':_0x352919[_0xb7b5('0x42')],'account':_0x352919[_0xb7b5('0x43')]}))||'';}function getInteractionUsers(_0x2389e0,_0x488585){return new BPromise(function(_0x3a35f5,_0x2d2ba8){try{if(_0x488585[_0x2389e0['id']]){_0x2389e0[_0xb7b5('0x44')]=_[_0xb7b5('0x45')](_0x488585[_0x2389e0['id']],function(_0x1676fd){return{'id':_0x1676fd['id'],'fullname':_0x1676fd['fullname']};});}}catch(_0x2afeab){_0x2d2ba8(_0x2afeab);}_0x3a35f5(_0x2389e0);});}function getInteractionTags(_0x5e0ee9,_0x42f189){return new BPromise(function(_0x42502c,_0x360fe1){try{if(_0x5e0ee9[_0xb7b5('0x46')]){_0x5e0ee9[_0xb7b5('0x47')]=[];_0x5e0ee9[_0xb7b5('0x46')][_0xb7b5('0x48')](',')['forEach'](function(_0x247f7c){_0x5e0ee9['Tags'][_0xb7b5('0x49')](_0x42f189[_0x247f7c]);});}delete _0x5e0ee9['TagIds'];}catch(_0x3d66c3){_0x360fe1(_0x3d66c3);}_0x42502c(_0x5e0ee9);});}function updateChatInteraction(_0x5c8755,_0x124bdf,_0x213fcd){return new BPromise(function(_0x47030d,_0x17451c){return getInteractionUsers(_0x5c8755,_0x213fcd)[_0xb7b5('0x39')](function(_0xd2708){return getInteractionTags(_0xd2708,_0x124bdf);})[_0xb7b5('0x39')](function(_0x3476cf){_0x47030d(_0x3476cf);})[_0xb7b5('0x2c')](function(_0x47e5e5){_0x17451c(_0x47e5e5);});});}exports[_0xb7b5('0x4a')]=function(_0x2f1aed,_0x27fc97){var _0x20c33a={},_0x5635a6={},_0x308a2f={'count':0x0,'rows':[]};var _0x4e23da=_[_0xb7b5('0x45')](db[_0xb7b5('0x4b')][_0xb7b5('0x4c')],function(_0x303eaf){return{'name':_0x303eaf[_0xb7b5('0x4d')],'type':_0x303eaf[_0xb7b5('0x4e')][_0xb7b5('0x4f')]};});_0x5635a6[_0xb7b5('0x50')]=_[_0xb7b5('0x45')](_0x4e23da,_0xb7b5('0x3c'));_0x5635a6['query']=_['keys'](_0x2f1aed[_0xb7b5('0x51')]);_0x5635a6[_0xb7b5('0x52')]=_[_0xb7b5('0x53')](_0x5635a6[_0xb7b5('0x50')],_0x5635a6['query']);_0x20c33a[_0xb7b5('0x54')]=_[_0xb7b5('0x53')](_0x5635a6[_0xb7b5('0x50')],qs[_0xb7b5('0x55')](_0x2f1aed[_0xb7b5('0x51')][_0xb7b5('0x55')]));_0x20c33a[_0xb7b5('0x54')]=_0x20c33a[_0xb7b5('0x54')]['length']?_0x20c33a[_0xb7b5('0x54')]:_0x5635a6[_0xb7b5('0x50')];if(!_0x2f1aed[_0xb7b5('0x51')][_0xb7b5('0x56')]('nolimit')){_0x20c33a[_0xb7b5('0x31')]=qs[_0xb7b5('0x31')](_0x2f1aed['query']['limit']);_0x20c33a[_0xb7b5('0x30')]=qs[_0xb7b5('0x30')](_0x2f1aed['query'][_0xb7b5('0x30')]);}_0x20c33a[_0xb7b5('0x57')]=qs[_0xb7b5('0x58')](_0x2f1aed['query'][_0xb7b5('0x58')]);_0x20c33a[_0xb7b5('0x59')]=qs[_0xb7b5('0x52')](_['pick'](_0x2f1aed['query'],_0x5635a6[_0xb7b5('0x52')]),_0x4e23da);var _0xd14a7f=[];var _0x73a6d0=squel['select']()[_0xb7b5('0x5a')]('id')[_0xb7b5('0x5a')](_0xb7b5('0x3c'))['field'](_0xb7b5('0x5b'))[_0xb7b5('0x5c')](_0xb7b5('0x5d'));var _0x50f1a4=squel['select']()[_0xb7b5('0x5a')](_0xb7b5('0x5e'))['field'](_0xb7b5('0x5f'))[_0xb7b5('0x5a')](_0xb7b5('0x60'))[_0xb7b5('0x5c')](_0xb7b5('0x61'),'ui')[_0xb7b5('0x62')](_0xb7b5('0x63'),'u',_0xb7b5('0x64'));var _0xec93a2=squel[_0xb7b5('0x65')]()[_0xb7b5('0x5c')]('chat_interactions','i')[_0xb7b5('0x62')](_0xb7b5('0x66'),'c',_0xb7b5('0x67'))[_0xb7b5('0x62')](_0xb7b5('0x63'),'o','o.id\x20=\x20i.UserId')[_0xb7b5('0x62')](_0xb7b5('0x68'),'a',_0xb7b5('0x69'))[_0xb7b5('0x62')](_0xb7b5('0x6a'),'me',_0xb7b5('0x6b'))[_0xb7b5('0x62')](_0xb7b5('0x6c'),'it',_0xb7b5('0x6d'))[_0xb7b5('0x62')](_0xb7b5('0x5d'),'t',_0xb7b5('0x6e'));var _0x57acd9=squel[_0xb7b5('0x6f')]();var _0x181519=[];var _0x17748f=squel[_0xb7b5('0x6f')]();var _0x41f412;if(_0x2f1aed[_0xb7b5('0x51')]['search']){_0x41f412=as['parseSearch'](_0x2f1aed[_0xb7b5('0x51')]['search']);var _0x327af8=_0x41f412['sqlOperator'];for(var _0x2e5cf9=0x0;_0x2e5cf9<_0x41f412[_0xb7b5('0x70')][_0xb7b5('0x71')];_0x2e5cf9++){var _0x2b4f64=_0x41f412[_0xb7b5('0x70')][_0x2e5cf9];var _0x48dbc2='i';var _0x11d112=_[_0xb7b5('0x72')](_0x4e23da,[_0xb7b5('0x3c'),_0x2b4f64[_0xb7b5('0x5a')]]);if(!_0x11d112){switch(_0x2b4f64[_0xb7b5('0x5a')]){case _0xb7b5('0x73'):if(_0x2b4f64['value']==0x1){_0xec93a2[_0xb7b5('0x74')]('`'+_0x2b4f64['field']+_0xb7b5('0x75'));}else{_0xec93a2['having']('`'+_0x2b4f64[_0xb7b5('0x5a')]+'`\x20>\x200');}break;case _0xb7b5('0x76'):if(_0x2b4f64[_0xb7b5('0x77')]===_0xb7b5('0x78')){if(_0x2b4f64[_0xb7b5('0x79')][_0xb7b5('0x48')]('\x20')[_0xb7b5('0x71')]>0x1){_0x57acd9[_0x327af8](_0xb7b5('0x7a'),qs['getFullTextValue'](_0x2b4f64[_0xb7b5('0x79')]),null);}else{var _0x331ae0='%'+_0x2b4f64[_0xb7b5('0x79')]+'%';_0x57acd9[_0x327af8](_0xb7b5('0x7b'),_0x331ae0,_0x331ae0,_0x331ae0);}}else{_0x11d112=_[_0xb7b5('0x72')](_0x4e23da,[_0xb7b5('0x3c'),_0xb7b5('0x7c')]);_0x2b4f64[_0xb7b5('0x5a')]=_0xb7b5('0x7c');_0x4953ee=as['buildExpression'](_0x48dbc2,_0x11d112[_0xb7b5('0x4e')],_0x2b4f64);_0x57acd9[_0x327af8](_0x4953ee['text'],_0x4953ee[_0xb7b5('0x79')][_0xb7b5('0x7d')],_0x4953ee['value'][_0xb7b5('0x2e')]);}break;case _0xb7b5('0x7e'):var _0x56c922=_0x2b4f64['value'][_0xb7b5('0x48')](',')[_0xb7b5('0x45')](function(_0x10f674){return Number(_0x10f674);});_0x56c922[_0xb7b5('0x7f')](function(_0x5ccc19){_0x17748f['or'](_0xb7b5('0x80'),'%,'+_0x5ccc19+',%');});_0x181519=_['union'](_0x181519,_0x56c922);break;case _0xb7b5('0x81'):if(_0x2b4f64[_0xb7b5('0x77')]===_0xb7b5('0x78')){_0x57acd9[_0x327af8]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2b4f64[_0xb7b5('0x79')]+'%',null);}else{_0x11d112=_[_0xb7b5('0x72')](_0x4e23da,['name','UserId']);_0x2b4f64['field']='UserId';_0x4953ee=as[_0xb7b5('0x82')](_0x48dbc2,_0x11d112[_0xb7b5('0x4e')],_0x2b4f64);_0x57acd9[_0x327af8](_0x4953ee[_0xb7b5('0x83')],_0x4953ee[_0xb7b5('0x79')][_0xb7b5('0x7d')],_0x4953ee[_0xb7b5('0x79')][_0xb7b5('0x2e')]);}break;case _0xb7b5('0x3f'):_0x4953ee=as['buildExpression']('me',null,_0x2b4f64);_0x57acd9[_0x327af8](_0x4953ee[_0xb7b5('0x83')],_0x4953ee[_0xb7b5('0x79')][_0xb7b5('0x7d')],_0x4953ee[_0xb7b5('0x79')][_0xb7b5('0x2e')]);break;}}else{var _0x4953ee=as[_0xb7b5('0x82')](_0x48dbc2,_0x11d112[_0xb7b5('0x4e')],_0x2b4f64);_0x57acd9[_0x327af8](_0x4953ee[_0xb7b5('0x83')],_0x4953ee[_0xb7b5('0x79')][_0xb7b5('0x7d')],_0x4953ee[_0xb7b5('0x79')][_0xb7b5('0x2e')]);}}}else{var _0x1c0d13=_(_0x2f1aed[_0xb7b5('0x51')])[_0xb7b5('0x84')]()[_0xb7b5('0x45')](function(_0x592f0e){return _[_0xb7b5('0x85')](_0x4e23da,['name',_0x592f0e])?_0x592f0e:undefined;})[_0xb7b5('0x86')]()[_0xb7b5('0x79')]();if(!_[_0xb7b5('0x87')](_0x1c0d13)){_0x1c0d13[_0xb7b5('0x7f')](function(_0x1d6797){if(_0x1d6797===_0xb7b5('0x88')){_0xec93a2[_0xb7b5('0x59')](_0xb7b5('0x89'),[]['concat'](_0x2f1aed[_0xb7b5('0x51')][_0x1d6797]));}else if(_0x1d6797===_0xb7b5('0x8a')){var _0x170b3d=JSON[_0xb7b5('0x8b')](_0x2f1aed[_0xb7b5('0x51')][_0x1d6797])[_0xb7b5('0x8c')];var _0x247cf5=JSON[_0xb7b5('0x8b')](_0x2f1aed['query'][_0x1d6797])['$lte'];_0xec93a2[_0xb7b5('0x59')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x170b3d,_0x247cf5);}else{if(_0x2f1aed['query'][_0x1d6797]==='null'){_0xec93a2[_0xb7b5('0x59')]('i.'+_0x1d6797+_0xb7b5('0x8d'));}else{_0xec93a2[_0xb7b5('0x59')]('i.'+_0x1d6797+_0xb7b5('0x8e'),_0x2f1aed[_0xb7b5('0x51')][_0x1d6797]);}}});}if(_0x2f1aed[_0xb7b5('0x51')][_0xb7b5('0x8f')]){if(_0x2f1aed['query']['read']==0x1){_0xec93a2['having']('`unreadMessages`\x20=\x200');}else{_0xec93a2['having'](_0xb7b5('0x90'));}}if(_0x2f1aed['query']['tag']){_0x181519=_[_0xb7b5('0x91')](_0x2f1aed['query'][_0xb7b5('0x92')])?_0x2f1aed['query']['tag']:new Array(_0x2f1aed[_0xb7b5('0x51')][_0xb7b5('0x92')]);_0x181519['forEach'](function(_0x1b7ce8){_0x17748f['or'](_0xb7b5('0x80'),'%,'+_0x1b7ce8+',%');});}if(_0x2f1aed[_0xb7b5('0x51')][_0xb7b5('0x93')]){var _0x15eadb=_0x2f1aed['query']['filter'][_0xb7b5('0x94')]('\x5c','\x5c\x5c')[_0xb7b5('0x94')](/'/g,'\x27\x27');if(qs[_0xb7b5('0x95')](_0x15eadb)){_0x57acd9['or'](_0xb7b5('0x96'),_0x15eadb+'%');}else{_0x57acd9['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb7b5('0x97')](_0x15eadb))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x15eadb+'%');}}}_0xec93a2[_0xb7b5('0x59')](_0x57acd9);_0xec93a2['group'](_0xb7b5('0x98'));var _0x17e1d2={'type':db[_0xb7b5('0x99')][_0xb7b5('0x9a')]['SELECT'],'raw':!![]};var _0x233383=_0xec93a2[_0xb7b5('0x9b')]();_0x233383[_0xb7b5('0x5a')](_0xb7b5('0x98'));_0x233383[_0xb7b5('0x5a')](_0xb7b5('0x9c'),_0xb7b5('0x73'));if(_0x20c33a[_0xb7b5('0x57')]){_0x20c33a[_0xb7b5('0x57')][_0xb7b5('0x7f')](function(_0x1fdde8){var _0xcf9d0c=_0x1fdde8[0x0]===_0xb7b5('0x9d')?_0x1fdde8[0x0]:'i.'+_0x1fdde8[0x0];_0xec93a2['order'](_0xcf9d0c,_0x1fdde8[0x1]===_0xb7b5('0x9e')?![]:!![]);});}if(!_[_0xb7b5('0x87')](_0x181519)){_0xec93a2[_0xb7b5('0x74')](_0x17748f);_0x233383['where'](_0xb7b5('0x9f'),_0x181519);}BPromise['resolve']()['then'](function(){if(!_0x41f412){if(_0x2f1aed['query']['ChatWebsiteId'])return;_0x233383[_0xb7b5('0x59')](_0xb7b5('0xa0'));_0xec93a2['where'](_0xb7b5('0xa0'));return;}if(_0x2f1aed['user']['role']!==_0xb7b5('0x41'))return;return _0x2f1aed['user'][_0xb7b5('0xa1')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2f0a9b){if(_[_0xb7b5('0x87')](_0x2f0a9b)){_0x233383[_0xb7b5('0x59')](_0xb7b5('0xa2'));_0xec93a2['where'](_0xb7b5('0xa2'));}else{_0x233383[_0xb7b5('0x59')]('i.ChatWebsiteId\x20IN\x20?',_[_0xb7b5('0x45')](_0x2f0a9b,'id'));_0xec93a2[_0xb7b5('0x59')](_0xb7b5('0x89'),_[_0xb7b5('0x45')](_0x2f0a9b,'id'));}});})[_0xb7b5('0x39')](function(){if(_0x2f1aed['user'][_0xb7b5('0xa3')]===_0xb7b5('0x41')&&!_0x41f412&&!_0x2f1aed[_0xb7b5('0x51')][_0xb7b5('0x88')])return[];return db[_0xb7b5('0xa4')][_0xb7b5('0x51')](_0x233383[_0xb7b5('0xa5')](),_0x17e1d2);})[_0xb7b5('0x39')](function(_0x4b17db){_0x308a2f[_0xb7b5('0x33')]=_0x4b17db[_0xb7b5('0x71')];if(_0x308a2f[_0xb7b5('0x33')]===0x0)return[];return db[_0xb7b5('0xa4')]['query'](_0x73a6d0[_0xb7b5('0xa5')](),_0x17e1d2)[_0xb7b5('0x39')](function(_0x4d2558){_0xd14a7f=_[_0xb7b5('0xa6')](_0x4d2558,'id');_0x17e1d2=_['merge'](_0x17e1d2,{'model':db[_0xb7b5('0x4b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f1aed['query']['fields']){_0x20c33a['attributes'][_0xb7b5('0x7f')](function(_0x4e8b4b){_0xec93a2['field']('i.'+_0x4e8b4b);});}else{_0xec93a2['field'](_0xb7b5('0x9c'),_0xb7b5('0x73'));_0xec93a2[_0xb7b5('0x5a')](_0xb7b5('0xa7'),_0xb7b5('0xa8'));_0xec93a2['field'](_0xb7b5('0xa9'),_0xb7b5('0xaa'));_0xec93a2[_0xb7b5('0x5a')](_0xb7b5('0xab'),_0xb7b5('0x9d'));_0xec93a2[_0xb7b5('0x5a')](_0xb7b5('0xac'));_0xec93a2['field'](_0xb7b5('0xad'),_0xb7b5('0xae'));_0xec93a2[_0xb7b5('0x5a')]('c.lastName',_0xb7b5('0xaf'));_0xec93a2[_0xb7b5('0x5a')](_0xb7b5('0xb0'),_0xb7b5('0xb1'));_0xec93a2['field'](_0xb7b5('0xb2'),_0xb7b5('0xb3'));_0xec93a2[_0xb7b5('0x5a')](_0xb7b5('0xb4'),_0xb7b5('0xb5'));_0xec93a2[_0xb7b5('0x5a')]('c.fax',_0xb7b5('0xb6'));_0xec93a2[_0xb7b5('0x5a')]('o.fullname',_0xb7b5('0xb7'));_0xec93a2[_0xb7b5('0x5a')](_0xb7b5('0xb8'),_0xb7b5('0xb9'));_0xec93a2['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb7b5('0x46'));}if(_0x20c33a['limit'])_0xec93a2[_0xb7b5('0x31')](_0x20c33a['limit']);if(_0x20c33a[_0xb7b5('0x30')])_0xec93a2[_0xb7b5('0x30')](_0x20c33a[_0xb7b5('0x30')]);return db[_0xb7b5('0xa4')][_0xb7b5('0x51')](_0xec93a2['toString'](),_0x17e1d2);})[_0xb7b5('0x39')](function(_0x3cdd2c){if(_0x3cdd2c['length']>0x0)_0x50f1a4[_0xb7b5('0x59')](_0xb7b5('0xba'),_[_0xb7b5('0x45')](_0x3cdd2c,'id'));return db['sequelize'][_0xb7b5('0x51')](_0x50f1a4[_0xb7b5('0xa5')](),_0x17e1d2)[_0xb7b5('0x39')](function(_0x3b8e96){var _0x3a6798=_[_0xb7b5('0xbb')](_0x3b8e96,'ChatInteractionId');var _0x2e719f=[];_0x3cdd2c[_0xb7b5('0x7f')](function(_0x5e792e){_0x2e719f[_0xb7b5('0x49')](updateChatInteraction(_0x5e792e,_0xd14a7f,_0x3a6798));});return BPromise['all'](_0x2e719f);});});})[_0xb7b5('0x39')](function(_0x278836){_0x308a2f[_0xb7b5('0xbc')]=_0x278836;return _0x308a2f;})[_0xb7b5('0x39')](respondWithFilteredResult(_0x27fc97,_0x20c33a))['catch'](handleError(_0x27fc97,null));};exports[_0xb7b5('0xbd')]=function(_0x1794d8,_0x35c261){var _0x536254={'raw':![],'where':{'id':_0x1794d8[_0xb7b5('0xbe')]['id']}},_0x522f0c={};_0x522f0c[_0xb7b5('0x50')]=_[_0xb7b5('0x84')](db['ChatInteraction'][_0xb7b5('0x4c')]);_0x522f0c[_0xb7b5('0x51')]=_[_0xb7b5('0x84')](_0x1794d8['query']);_0x522f0c[_0xb7b5('0x52')]=_[_0xb7b5('0x53')](_0x522f0c['model'],_0x522f0c[_0xb7b5('0x51')]);_0x536254['attributes']=_['intersection'](_0x522f0c[_0xb7b5('0x50')],qs[_0xb7b5('0x55')](_0x1794d8['query']['fields']));_0x536254[_0xb7b5('0x54')]=_0x536254[_0xb7b5('0x54')][_0xb7b5('0x71')]?_0x536254[_0xb7b5('0x54')]:_0x522f0c[_0xb7b5('0x50')];if(_0x1794d8[_0xb7b5('0x51')][_0xb7b5('0xbf')]){_0x536254[_0xb7b5('0xc0')]=[{'all':!![]}];}_0x536254=_[_0xb7b5('0x3e')]({},_0x536254,_0x1794d8[_0xb7b5('0xc1')]);return db[_0xb7b5('0x4b')]['find'](_0x536254)['then'](handleEntityNotFound(_0x35c261,null))['then'](respondWithResult(_0x35c261,null))[_0xb7b5('0x2c')](handleError(_0x35c261,null));};exports[_0xb7b5('0xc2')]=function(_0x194d99,_0x315a32){return db[_0xb7b5('0x4b')][_0xb7b5('0xc2')](_0x194d99[_0xb7b5('0x3f')],{})[_0xb7b5('0x39')](respondWithResult(_0x315a32,0xc9))[_0xb7b5('0x2c')](handleError(_0x315a32,null));};exports['update']=function(_0x5c3caf,_0x3ed27d){if(_0x5c3caf[_0xb7b5('0x3f')]['id']){delete _0x5c3caf['body']['id'];}return db[_0xb7b5('0x4b')][_0xb7b5('0x72')]({'where':{'id':_0x5c3caf[_0xb7b5('0xbe')]['id']}})['then'](handleEntityNotFound(_0x3ed27d,null))[_0xb7b5('0x39')](saveUpdates(_0x5c3caf['body'],null))[_0xb7b5('0x39')](respondWithResult(_0x3ed27d,null))[_0xb7b5('0x2c')](handleError(_0x3ed27d,null));};exports['destroy']=function(_0x55b0dd,_0x28323f){return db['ChatInteraction'][_0xb7b5('0x72')]({'where':{'id':_0x55b0dd[_0xb7b5('0xbe')]['id']}})[_0xb7b5('0x39')](handleEntityNotFound(_0x28323f,null))[_0xb7b5('0x39')](removeEntity(_0x28323f,null))[_0xb7b5('0x2c')](handleError(_0x28323f,null));};exports[_0xb7b5('0xc3')]=function(_0x20f36d,_0x1e8002){return db[_0xb7b5('0x4b')][_0xb7b5('0xc3')]()[_0xb7b5('0x39')](respondWithResult(_0x1e8002,null))[_0xb7b5('0x2c')](handleError(_0x1e8002,null));};exports[_0xb7b5('0xc4')]=function(_0x1ef285,_0x145b28){var _0x35e4df=_0x1ef285[_0xb7b5('0xbe')]['id'];var _0xfce38b;var _0x5249e8;var _0x10d62c;return db[_0xb7b5('0x4b')][_0xb7b5('0xc5')]({'where':{'id':_0x35e4df}})[_0xb7b5('0x39')](function(_0x5ed879){_0xfce38b=_0x5ed879;return db[_0xb7b5('0xc6')][_0xb7b5('0xc5')]({'where':{'id':_0x5ed879[_0xb7b5('0x88')]},'attributes':['id',_0xb7b5('0xc7'),_0xb7b5('0xc8'),'vidaooTopic',_0xb7b5('0xc9'),_0xb7b5('0xca')],'raw':!![]});})['then'](function(_0x20a6a0){if(_0x20a6a0&&_0x20a6a0[_0xb7b5('0xc7')]&&_0x20a6a0[_0xb7b5('0xc8')]){_0x5249e8=_0x20a6a0;var _0x10d4f5={'interaction':{'id':_0x35e4df},'agent':{'id':_0x1ef285[_0xb7b5('0xcb')]['id'],'name':_0x1ef285[_0xb7b5('0xcb')][_0xb7b5('0x3c')],'fullname':_0x1ef285[_0xb7b5('0xcb')]['fullname'],'email':_0x1ef285[_0xb7b5('0xcb')][_0xb7b5('0xcc')]},'contact':_0x1ef285[_0xb7b5('0x3f')][_0xb7b5('0x40')],'account':_0x1ef285['body'][_0xb7b5('0x43')]};var _0x46ecb0={'rejectUnauthorized':![],'method':_0xb7b5('0xcd'),'url':_0xb7b5('0xce'),'headers':{'X-APIKEY':_0x20a6a0[_0xb7b5('0xc7')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1ef285[_0xb7b5('0xcb')][_0xb7b5('0xcc')]],'buttons':null,'topic':_0x5249e8[_0xb7b5('0xcf')],'note':_[_0xb7b5('0xd0')](_0x5249e8[_0xb7b5('0xc9')])?null:getMustacheRender(_0x5249e8[_0xb7b5('0xc9')],_0x10d4f5),'metadata':null},'redirect':_0xb7b5('0xd1'),'json':!![]};try{if(!_[_0xb7b5('0xd0')](_0x5249e8[_0xb7b5('0xca')])){var _0x4f81e5=getMustacheRender(_0x5249e8[_0xb7b5('0xca')],_0x10d4f5);var _0x24a2b4=JSON['parse'](_0x4f81e5);_0x46ecb0['body']['metadata']=_0x24a2b4;}}catch(_0x4b2be4){throw new db[(_0xb7b5('0x99'))][(_0xb7b5('0xd2'))](_0xb7b5('0xd3'));}return rp(_0x46ecb0);}else{throw new db[(_0xb7b5('0x99'))][(_0xb7b5('0xd2'))](_0xb7b5('0xd4'));}})['then'](function(_0x275401){_0x10d62c=_0x275401;if(_0x10d62c['id']){var _0x1ad0a9={'body':_0x10d62c[_0xb7b5('0xd5')],'ChatWebsiteId':_0x5249e8['id'],'ChatInteractionId':_0xfce38b['id'],'direction':'out','UserId':_0x1ef285[_0xb7b5('0xcb')]['id']};return db[_0xb7b5('0xd6')][_0xb7b5('0xc2')](_0x1ad0a9,{});}else{throw new db[(_0xb7b5('0x99'))]['ValidationError'](_0xb7b5('0xd7'));}})['then'](function(){return _0xfce38b[_0xb7b5('0xd8')]({'vidaooSessionId':_0x10d62c['id']});})['then'](respondWithResult(_0x145b28,null))[_0xb7b5('0x2c')](handleError(_0x145b28,null));};exports[_0xb7b5('0xd9')]=function(_0xef6723,_0x18f6d9){if(_0xef6723[_0xb7b5('0x3f')]['id']){delete _0xef6723['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0xef6723[_0xb7b5('0xbe')]['id']},'include':[{'model':db[_0xb7b5('0xda')],'as':_0xb7b5('0x76')}]})[_0xb7b5('0x39')](handleEntityNotFound(_0x18f6d9,null))['then'](saveUpdates(_0xef6723[_0xb7b5('0x3f')],null))[_0xb7b5('0x39')](respondWithResult(_0x18f6d9,null))[_0xb7b5('0x2c')](handleError(_0x18f6d9,null));};exports['abandon']=function(_0x2825d0,_0x3eb492,_0x4e4a47){if(_0x2825d0[_0xb7b5('0x3f')]['id']){delete _0x2825d0[_0xb7b5('0x3f')]['id'];}return db[_0xb7b5('0x4b')][_0xb7b5('0x72')]({'where':{'id':_0x2825d0[_0xb7b5('0xbe')]['id']}})[_0xb7b5('0x39')](function(_0x5e8874){if(!_0x5e8874){logger[_0xb7b5('0x29')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0xb7b5('0xdb'));_0x3eb492[_0xb7b5('0x3a')](0x194);}else{if(_0x5e8874[_0xb7b5('0xdc')]){throw new db[(_0xb7b5('0x99'))]['ValidationError'](_0xb7b5('0xdd'));}}return _0x5e8874;})['then'](function(_0x5e6861){if(_0x5e6861){return _0x5e6861[_0xb7b5('0xde')]({'closed':_0x2825d0[_0xb7b5('0x3f')][_0xb7b5('0xdf')],'disposition':_0x2825d0[_0xb7b5('0x3f')]['disposition']})['then'](function(_0x2bf347){return _0x2bf347;});}})['then'](function(_0x502240){return respondWithRpcPromise(_0xb7b5('0xe0'),_0xb7b5('0xe1'),_0x2825d0[_0xb7b5('0x3f')],client9004);})[_0xb7b5('0x39')](respondWithResult(_0x3eb492,null))['catch'](handleError(_0x3eb492,null));};exports[_0xb7b5('0xe2')]=function(_0x34f569,_0x37607a,_0x156409){_0x34f569['body'][_0xb7b5('0x3c')]=_0x34f569['file']['originalname'];_0x34f569[_0xb7b5('0x3f')]['basename']=_0x34f569['file']['filename'];_0x34f569[_0xb7b5('0x3f')]['type']=_0x34f569[_0xb7b5('0xe3')][_0xb7b5('0xe4')];return db['Attachment'][_0xb7b5('0xc2')](_0x34f569[_0xb7b5('0x3f')])['then'](respondWithResult(_0x37607a,0xc9))[_0xb7b5('0x2c')](handleError(_0x37607a,null));};exports[_0xb7b5('0xe5')]=function(_0x40514b,_0x3db09d,_0x473a1d){return db[_0xb7b5('0x4b')][_0xb7b5('0xc5')]({'where':{'id':_0x40514b[_0xb7b5('0xbe')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3db09d,null))['then'](function(_0xe586c1){if(_0xe586c1){if(_0xe586c1[_0xb7b5('0xdf')]){return _0x3db09d['status'](0x193)['json']({'status':0x193,'message':_0xb7b5('0xe6')});}return db['Attachment'][_0xb7b5('0xc5')]({'where':{'id':_0x40514b[_0xb7b5('0x51')][_0xb7b5('0xe7')]},'raw':!![]})[_0xb7b5('0x39')](handleEntityNotFound(_0x3db09d,null));}})[_0xb7b5('0x39')](function(_0x3d9b9a){if(_0x3d9b9a){var _0x2383a7=_0x3d9b9a[_0xb7b5('0xe8')]!==null;var _0x118b54=path[_0xb7b5('0xe9')](config['root'],'server/files/attachments/');if(_0x2383a7){_0x118b54=path['join'](_0x118b54,'offline-chat/');}var _0x21454a=path[_0xb7b5('0xe9')](_0x118b54,_0x3d9b9a[_0xb7b5('0xea')]);return _0x3db09d[_0xb7b5('0xeb')](_0x21454a);}})[_0xb7b5('0x2c')](handleError(_0x3db09d,null));};exports[_0xb7b5('0xec')]=function(_0x2629cc,_0x28f1fd){var _0x119b6c=null;var _0x5c62ce=null;var _0x1085f2=null;var _0x592886=null;if(_0x2629cc[_0xb7b5('0x3f')]['id']){delete _0x2629cc[_0xb7b5('0x3f')]['id'];}if(_0x2629cc[_0xb7b5('0x3f')][_0xb7b5('0xed')]){_0x592886=path[_0xb7b5('0xe9')](config[_0xb7b5('0xee')],_0xb7b5('0xef'),util[_0xb7b5('0xf0')]('transcript-%s.txt',Date[_0xb7b5('0xf1')]()));_0x2629cc[_0xb7b5('0x3f')][_0xb7b5('0xf2')]=_0x592886;}return db[_0xb7b5('0x4b')][_0xb7b5('0x72')]({'where':{'id':_0x2629cc['params']['id']},'include':[{'model':db[_0xb7b5('0xd6')],'as':'Messages','include':[{'model':db[_0xb7b5('0x81')],'as':_0xb7b5('0x81')}]}]})['then'](handleEntityNotFound(_0x28f1fd,null))[_0xb7b5('0x39')](saveUpdates(_0x2629cc[_0xb7b5('0x3f')],null))[_0xb7b5('0x39')](function(_0x3fbff5){if(_0x3fbff5){_0x119b6c=_0x3fbff5;return db[_0xb7b5('0xc6')]['find']({'where':{'id':_0x119b6c[_0xb7b5('0x88')]}});}})[_0xb7b5('0x39')](function(_0xf1ad16){if(_0xf1ad16){_0x1085f2=_0xf1ad16;return db[_0xb7b5('0xda')][_0xb7b5('0x72')]({'where':{'id':_0x119b6c[_0xb7b5('0x7c')]}});}})[_0xb7b5('0x39')](function(_0x247ce4){if(_0x247ce4){_0x5c62ce=_0x247ce4;if(_0x592886){var _0x27d5cb=null;for(var _0x1afad5=0x1;_0x1afad5<_0x119b6c['Messages'][_0xb7b5('0x71')];++_0x1afad5){_0x27d5cb=_0x119b6c[_0xb7b5('0xf3')][_0x1afad5];var _0x202d12=_0x27d5cb[_0xb7b5('0xdc')]?util[_0xb7b5('0xf0')](_0xb7b5('0xf4'),_0x1085f2[_0xb7b5('0xf5')],_0x27d5cb[_0xb7b5('0xdc')]):_0xb7b5('0xf6');var _0x44fda7=_0x2629cc[_0xb7b5('0x3f')]['customer']||util[_0xb7b5('0xf0')](_0xb7b5('0xf4'),_0xb7b5('0xf7'),_0x27d5cb[_0xb7b5('0x7c')]);switch(_0x1085f2[_0xb7b5('0xf8')]){case'website_alias':_0x202d12=_0x27d5cb[_0xb7b5('0xdc')]?util[_0xb7b5('0xf0')](_0xb7b5('0xf4'),_0x1085f2[_0xb7b5('0xf5')],_0x27d5cb[_0xb7b5('0xdc')]):_0xb7b5('0xf6');break;case'agent_alias':_0x202d12=_0x27d5cb['UserId']?_0x27d5cb[_0xb7b5('0x81')][_0xb7b5('0xf9')]||_0x27d5cb[_0xb7b5('0x81')][_0xb7b5('0xfa')]:_0xb7b5('0xf6');break;case _0xb7b5('0xfb'):_0x202d12=_0x27d5cb[_0xb7b5('0xdc')]?_0x27d5cb[_0xb7b5('0x81')][_0xb7b5('0xfa')]:_0xb7b5('0xf6');break;default:_0x202d12=_0x27d5cb[_0xb7b5('0xdc')]?util[_0xb7b5('0xf0')]('%s%d',_0x1085f2[_0xb7b5('0xf5')],_0x27d5cb[_0xb7b5('0xdc')]):_0xb7b5('0xf6');}var _0x572f12=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x27d5cb[_0xb7b5('0x8a')])[_0xb7b5('0xf0')](_0xb7b5('0xfc')),_0x27d5cb[_0xb7b5('0xfd')]==='in'?_0x44fda7:_0x202d12,_0x27d5cb['body']);if(!_0x27d5cb[_0xb7b5('0xfe')]){fs['appendFileSync'](_0x592886,_0x572f12);}}return db[_0xb7b5('0xff')][_0xb7b5('0xc5')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb7b5('0x100'),'raw':!![]}]});}}})[_0xb7b5('0x39')](function(_0xa4b54d){if(_0xa4b54d&&_0xa4b54d['Smtp']&&_0x2629cc['body']){var _0x3adc98={'tls':{'rejectUnauthorized':![]}};if(_0xa4b54d[_0xb7b5('0x100')][_0xb7b5('0x101')]){_0x3adc98[_0xb7b5('0x101')]=_0xa4b54d[_0xb7b5('0x100')][_0xb7b5('0x101')];}else{_0x3adc98['host']=_0xa4b54d[_0xb7b5('0x100')]['host'];_0x3adc98[_0xb7b5('0x102')]=_0xa4b54d[_0xb7b5('0x100')][_0xb7b5('0x102')];_0x3adc98[_0xb7b5('0x103')]=_0xa4b54d[_0xb7b5('0x100')][_0xb7b5('0x103')];}if(_0xa4b54d['Smtp'][_0xb7b5('0x104')]){_0x3adc98['auth']={'user':_0xa4b54d[_0xb7b5('0x100')][_0xb7b5('0xcb')],'pass':_0xa4b54d['Smtp'][_0xb7b5('0x105')]};}return respondWithRpcPromise(_0xb7b5('0x106'),'sendMail',{'account':_0x3adc98,'message':{'from':util[_0xb7b5('0xf0')]('\x22%s\x22\x20<%s>',_0xa4b54d[_0xb7b5('0x3c')],_0xa4b54d[_0xb7b5('0xcc')]||_0xa4b54d[_0xb7b5('0x100')][_0xb7b5('0xcb')]),'to':_0x2629cc[_0xb7b5('0x3f')]['mailTranscript'],'subject':_0xb7b5('0x107'),'text':util[_0xb7b5('0xf0')](_0xb7b5('0x108'),_0x2629cc[_0xb7b5('0x3f')][_0xb7b5('0xed')]),'attachments':[{'path':_0x592886}]}})[_0xb7b5('0x39')](function(){return _0x119b6c;})['catch'](function(_0x106807){console[_0xb7b5('0x29')](_0x106807);});}else{return _0x119b6c;}})['then'](respondWithStatusCode(_0x28f1fd,0xc8))[_0xb7b5('0x2c')](handleError(_0x28f1fd,null));};exports[_0xb7b5('0x109')]=function(_0x3303fe,_0xd6d7a0,_0x36763f){return db['ChatMessage'][_0xb7b5('0x72')]({'where':{'id':_0x3303fe[_0xb7b5('0xbe')]['id']}})[_0xb7b5('0x39')](handleEntityNotFound(_0xd6d7a0,null))[_0xb7b5('0x39')](function(_0x3528ad){if(_0x3528ad){return _0x3528ad[_0xb7b5('0x109')](_0x3303fe['body']['ids'],_['omit'](_0x3303fe[_0xb7b5('0x3f')],[_0xb7b5('0x10a'),'id'])||{});}})[_0xb7b5('0x39')](respondWithResult(_0xd6d7a0,null))['catch'](handleError(_0xd6d7a0,null));};exports[_0xb7b5('0x10b')]=function(_0x2c54dc,_0x29161e,_0x4d7026){var _0x3d3aa8={'raw':![],'where':{}};var _0x354444={};var _0x541e93={'count':0x0,'rows':[]};return db[_0xb7b5('0x4b')][_0xb7b5('0xc5')]({'where':{'id':_0x2c54dc[_0xb7b5('0xbe')]['id']}})[_0xb7b5('0x39')](handleEntityNotFound(_0x29161e,null))[_0xb7b5('0x39')](function(_0x5f4f83){if(_0x5f4f83){_0x354444[_0xb7b5('0x50')]=_['keys'](db[_0xb7b5('0xd6')][_0xb7b5('0x4c')]);_0x354444[_0xb7b5('0x51')]=_[_0xb7b5('0x84')](_0x2c54dc[_0xb7b5('0x51')]);_0x354444[_0xb7b5('0x52')]=_[_0xb7b5('0x53')](_0x354444[_0xb7b5('0x50')],_0x354444['query']);_0x3d3aa8[_0xb7b5('0x54')]=_[_0xb7b5('0x53')](_0x354444[_0xb7b5('0x50')],qs['fields'](_0x2c54dc[_0xb7b5('0x51')][_0xb7b5('0x55')]));_0x3d3aa8[_0xb7b5('0x54')]=_0x3d3aa8[_0xb7b5('0x54')][_0xb7b5('0x71')]?_0x3d3aa8[_0xb7b5('0x54')]:_0x354444[_0xb7b5('0x50')];if(!_0x2c54dc['query'][_0xb7b5('0x56')](_0xb7b5('0x10c'))){_0x3d3aa8['limit']=qs['limit'](_0x2c54dc['query'][_0xb7b5('0x31')]);_0x3d3aa8[_0xb7b5('0x30')]=qs[_0xb7b5('0x30')](_0x2c54dc[_0xb7b5('0x51')]['offset']);}_0x3d3aa8[_0xb7b5('0x57')]=qs['sort'](_0x2c54dc[_0xb7b5('0x51')][_0xb7b5('0x58')]);_0x3d3aa8['where']=qs['filters'](_[_0xb7b5('0x10d')](_0x2c54dc[_0xb7b5('0x51')],_0x354444[_0xb7b5('0x52')]));_0x3d3aa8['where'][_0xb7b5('0x10e')]=_0x5f4f83['id'];if(_0x2c54dc[_0xb7b5('0x51')][_0xb7b5('0x93')]){_0x3d3aa8[_0xb7b5('0x59')]=_[_0xb7b5('0x3e')](_0x3d3aa8[_0xb7b5('0x59')],{'$or':_[_0xb7b5('0x45')](_0x3d3aa8[_0xb7b5('0x54')],function(_0x4a5c5a){var _0x37217f={};_0x37217f[_0x4a5c5a]={'$like':'%'+_0x2c54dc[_0xb7b5('0x51')][_0xb7b5('0x93')]+'%'};return _0x37217f;})});}if(_0x2c54dc[_0xb7b5('0x51')][_0xb7b5('0x8c')]){var _0x1c718d=_0x2c54dc[_0xb7b5('0x51')]['$gte'][_0xb7b5('0x48')](',');var _0x45730a={};_0x45730a[_0x1c718d[0x0]]={'$gte':moment(_0x1c718d[0x1])['format'](_0xb7b5('0x10f'))};_0x3d3aa8[_0xb7b5('0x59')]=_[_0xb7b5('0x3e')](_0x3d3aa8[_0xb7b5('0x59')],_0x45730a);}_0x3d3aa8=_[_0xb7b5('0x3e')]({},_0x3d3aa8,_0x2c54dc['options']);return db[_0xb7b5('0xd6')]['count']({'where':_0x3d3aa8[_0xb7b5('0x59')]})[_0xb7b5('0x39')](function(_0x1d56e8){_0x541e93[_0xb7b5('0x33')]=_0x1d56e8;if(_0x2c54dc[_0xb7b5('0x51')][_0xb7b5('0xbf')]){_0x3d3aa8['include']=[{'all':!![]}];}return db[_0xb7b5('0xd6')][_0xb7b5('0x110')](_0x3d3aa8);})['then'](function(_0x4c5ec1){_0x541e93['rows']=_0x4c5ec1;return _0x541e93;});}})[_0xb7b5('0x39')](respondWithFilteredResult(_0x29161e,_0x3d3aa8))[_0xb7b5('0x2c')](handleError(_0x29161e,null));};exports[_0xb7b5('0x111')]=function(_0x5688ee,_0x21bfb9,_0x11a235){var _0x4d5097={'where':{}},_0x1c5087={},_0x51a34={'count':0x0,'rows':[]};return db[_0xb7b5('0x4b')][_0xb7b5('0xc5')]({'where':{'id':_0x5688ee[_0xb7b5('0xbe')]['id']}})[_0xb7b5('0x39')](handleEntityNotFound(_0x21bfb9,null))[_0xb7b5('0x39')](function(_0x3ff36e){if(_0x3ff36e){_0x1c5087['model']=_['keys'](db[_0xb7b5('0xd6')][_0xb7b5('0x4c')]);_0x1c5087[_0xb7b5('0x51')]=_[_0xb7b5('0x84')](_0x5688ee[_0xb7b5('0x51')]);_0x1c5087['filters']=_['intersection'](_0x1c5087[_0xb7b5('0x50')],_0x1c5087['query']);_0x4d5097[_0xb7b5('0x54')]=_[_0xb7b5('0x53')](_0x1c5087['model'],qs['fields'](_0x5688ee[_0xb7b5('0x51')][_0xb7b5('0x55')]));_0x4d5097[_0xb7b5('0x54')]=_0x4d5097['attributes']['length']?_0x4d5097[_0xb7b5('0x54')]:_0x1c5087['model'];if(!_0x5688ee[_0xb7b5('0x51')][_0xb7b5('0x56')](_0xb7b5('0x10c'))){_0x4d5097[_0xb7b5('0x31')]=qs[_0xb7b5('0x31')](_0x5688ee[_0xb7b5('0x51')][_0xb7b5('0x31')]);_0x4d5097[_0xb7b5('0x30')]=qs[_0xb7b5('0x30')](_0x5688ee[_0xb7b5('0x51')]['offset']);}_0x4d5097['order']=qs['sort'](_0x5688ee['query']['sort']);_0x4d5097[_0xb7b5('0x59')]=qs['filters'](_[_0xb7b5('0x10d')](_0x5688ee[_0xb7b5('0x51')],_0x1c5087[_0xb7b5('0x52')]));_0x4d5097[_0xb7b5('0x59')][_0xb7b5('0x10e')]=_0x3ff36e['id'];if(_0x5688ee[_0xb7b5('0x51')][_0xb7b5('0x93')]){_0x4d5097[_0xb7b5('0x59')]=_['merge'](_0x4d5097[_0xb7b5('0x59')],{'$or':_[_0xb7b5('0x45')](_0x4d5097[_0xb7b5('0x54')],function(_0x3e38a0){var _0x326f26={};_0x326f26[_0x3e38a0]={'$like':'%'+_0x5688ee[_0xb7b5('0x51')][_0xb7b5('0x93')]+'%'};return _0x326f26;})});}_0x4d5097['where'][_0xb7b5('0xfe')]=![];if(_0x5688ee[_0xb7b5('0x51')]['id']){_0x4d5097['where']['id']={'$gt':_0x5688ee[_0xb7b5('0x51')]['id']};}_0x4d5097=_[_0xb7b5('0x3e')]({},_0x4d5097,_0x5688ee[_0xb7b5('0xc1')]);return db['ChatMessage'][_0xb7b5('0x33')]({'where':_0x4d5097[_0xb7b5('0x59')]})[_0xb7b5('0x39')](function(_0x423fc1){_0x51a34['count']=_0x423fc1;_0x4d5097[_0xb7b5('0xc0')]=[];if(_0x5688ee[_0xb7b5('0x51')][_0xb7b5('0x112')]){_0x4d5097[_0xb7b5('0xc0')][_0xb7b5('0x49')]({'model':db[_0xb7b5('0x81')],'as':'User','attributes':['id','fullname',_0xb7b5('0xf9')]});}if(_0x5688ee['query'][_0xb7b5('0xbf')]){_0x4d5097['include']=[{'all':!![]}];}return db[_0xb7b5('0xd6')][_0xb7b5('0x110')](_0x4d5097);})[_0xb7b5('0x39')](function(_0x593bb3){_0x51a34[_0xb7b5('0xbc')]=_0x593bb3;return _0x51a34;});}})[_0xb7b5('0x39')](respondWithFilteredResult(_0x21bfb9,_0x4d5097))[_0xb7b5('0x2c')](handleError(_0x21bfb9,null));};exports['addTags']=function(_0x50765f,_0x20f08a,_0x51e82a){return db[_0xb7b5('0x4b')][_0xb7b5('0x72')]({'where':{'id':_0x50765f[_0xb7b5('0xbe')]['id']}})[_0xb7b5('0x39')](handleEntityNotFound(_0x20f08a,null))[_0xb7b5('0x39')](function(_0x1b92ea){if(_0x1b92ea){return _0x1b92ea[_0xb7b5('0x113')](_0x50765f[_0xb7b5('0x3f')][_0xb7b5('0x10a')],_[_0xb7b5('0x114')](_0x50765f[_0xb7b5('0x3f')],[_0xb7b5('0x10a'),'id'])||{})[_0xb7b5('0x115')](function(){return db[_0xb7b5('0x7e')][_0xb7b5('0x110')]({'attributes':['id',_0xb7b5('0x3c'),_0xb7b5('0x5b')],'where':{'id':_0x50765f['body'][_0xb7b5('0x10a')]}});})[_0xb7b5('0x39')](function(_0x4f3793){socket[_0xb7b5('0x116')](_0xb7b5('0x117'),{'id':Number(_0x50765f[_0xb7b5('0xbe')]['id']),'tags':_0x4f3793||[]});return{'id':Number(_0x50765f['params']['id']),'tags':_0x4f3793||[]};});}})[_0xb7b5('0x39')](respondWithResult(_0x20f08a,null))['catch'](handleError(_0x20f08a,null));};exports[_0xb7b5('0x118')]=function(_0x2dadf3,_0x4be3e9,_0x5cc374){return db['ChatInteraction']['find']({'where':{'id':_0x2dadf3[_0xb7b5('0xbe')]['id']}})[_0xb7b5('0x39')](handleEntityNotFound(_0x4be3e9,null))[_0xb7b5('0x39')](function(_0x516402){if(_0x516402){return _0x516402['removeTags'](_0x2dadf3['query'][_0xb7b5('0x10a')]);}})[_0xb7b5('0x39')](respondWithStatusCode(_0x4be3e9,null))[_0xb7b5('0x2c')](handleError(_0x4be3e9,null));};exports[_0xb7b5('0xeb')]=function(_0x467af0,_0x5b4e51){var _0x1e4bda=moment()['unix']()[_0xb7b5('0xa5')]();var _0x2a7f50=path[_0xb7b5('0xe9')](config[_0xb7b5('0xee')],'server','files',_0xb7b5('0x119'));var _0x4b7116=path[_0xb7b5('0xe9')](config['root'],_0xb7b5('0x11a'),'files',_0xb7b5('0x11b'));var _0x4c5292=path[_0xb7b5('0xe9')](_0x2a7f50,_0x1e4bda);var _0x336b77=util['format'](_0xb7b5('0x11c'),_0x467af0['params']['id'],_0x1e4bda);var _0x58a819=path[_0xb7b5('0xe9')](_0x2a7f50,_0x336b77);var _0x45066c=[];_0x45066c[_0xb7b5('0x49')]({'model':db[_0xb7b5('0x81')],'as':_0xb7b5('0x81'),'attributes':['id','fullname'],'raw':!![]});_0x45066c['push']({'model':db['CmContact'],'as':_0xb7b5('0x76'),'attributes':['id','firstName',_0xb7b5('0x11d')],'raw':!![]});if(_0x467af0[_0xb7b5('0x51')][_0xb7b5('0x11b')]){_0x45066c[_0xb7b5('0x49')]({'model':db[_0xb7b5('0x11e')],'as':_0xb7b5('0x11e'),'raw':!![]});}var _0xc25d78=[{'model':db[_0xb7b5('0xd6')],'as':'Messages','attributes':['id',_0xb7b5('0x3f'),'createdAt',_0xb7b5('0xfd'),_0xb7b5('0xfe'),_0xb7b5('0x8f')],'include':_0x45066c}];_0xc25d78[_0xb7b5('0x49')]({'model':db[_0xb7b5('0xc6')],'as':_0xb7b5('0x11f'),'attributes':['id',_0xb7b5('0x3c')]});_0xc25d78[_0xb7b5('0x49')]({'model':db[_0xb7b5('0x81')],'as':_0xb7b5('0x120'),'attributes':['id',_0xb7b5('0xfa')]});return db['ChatInteraction'][_0xb7b5('0x72')]({'where':{'id':_0x467af0[_0xb7b5('0xbe')]['id']},'include':_0xc25d78})[_0xb7b5('0x39')](handleEntityNotFound(_0x5b4e51,null))[_0xb7b5('0x39')](function(_0x54bdba){if(_0x54bdba){var _0x2da69a=_0x54bdba[_0xb7b5('0x121')]({'plain':!![]});fs[_0xb7b5('0x122')](_0x4c5292);var _0x3de5e3={'channel':'Chat','account':_0x2da69a[_0xb7b5('0x11f')][_0xb7b5('0x3c')],'agent':_0x2da69a[_0xb7b5('0x120')]?_0x2da69a[_0xb7b5('0x120')][_0xb7b5('0xfa')]:'N.A.','createdAt':moment(_0x2da69a[_0xb7b5('0x8a')])['format'](_0xb7b5('0x10f'))[_0xb7b5('0xa5')](),'closedAt':_0x2da69a[_0xb7b5('0xdf')]?moment(_0x2da69a[_0xb7b5('0x123')])[_0xb7b5('0xf0')](_0xb7b5('0x10f'))[_0xb7b5('0xa5')]():'','disposition':_0x2da69a[_0xb7b5('0x124')],'chatInfo':{'browser':_0x2da69a[_0xb7b5('0x125')],'os':_0x2da69a['osName'],'referer':_0x2da69a[_0xb7b5('0x126')],'customerIp':_0x2da69a['customerIp'],'customerPort':_0x2da69a[_0xb7b5('0x127')]?_0x2da69a[_0xb7b5('0x127')]:_0xb7b5('0x128')},'messages':_(_0x2da69a[_0xb7b5('0xf3')])[_0xb7b5('0x129')]()['filter']({'secret':![]})['map'](function(_0x18aac4){if(_0x18aac4['Attachment']){var _0x33fc8c=path[_0xb7b5('0xe9')](_0x4b7116,_0x18aac4[_0xb7b5('0x11e')][_0xb7b5('0xea')]);if(fs['existsSync'](_0x33fc8c)){fs[_0xb7b5('0x12a')](_0x33fc8c)[_0xb7b5('0x12b')](fs[_0xb7b5('0x12c')](path[_0xb7b5('0xe9')](_0x4c5292,_0x18aac4[_0xb7b5('0x11e')]['basename'])));}}return{'date':moment(_0x18aac4[_0xb7b5('0x8a')])['format'](_0xb7b5('0x10f'))[_0xb7b5('0xa5')](),'sender':_0x18aac4['direction']===_0xb7b5('0x12d')?_0x18aac4[_0xb7b5('0x81')]?_0x18aac4['User']['fullname']:_0xb7b5('0xf6'):_0x18aac4['Contact'][_0xb7b5('0x12e')]+(_0x18aac4[_0xb7b5('0x76')][_0xb7b5('0x11d')]?'\x20'+_0x18aac4[_0xb7b5('0x76')][_0xb7b5('0x11d')]:''),'body':_0x18aac4[_0xb7b5('0x11e')]?_0x18aac4[_0xb7b5('0x11e')][_0xb7b5('0xea')]:_0x18aac4['body'],'direction':_0x18aac4['direction']===_0xb7b5('0x12d')?'A':'C','secret':_0x18aac4[_0xb7b5('0xfe')],'read':_0x18aac4['read'],'attachment':_0x18aac4[_0xb7b5('0x11e')]};})[_0xb7b5('0x79')]()};return ejs[_0xb7b5('0x12f')](path[_0xb7b5('0xe9')](config['root'],_0xb7b5('0x11a'),'views',_0xb7b5('0x130')),{'interaction':_0x3de5e3})[_0xb7b5('0x39')](function(_0x70e961){var _0x4cb9b6=path[_0xb7b5('0xe9')](_0x4c5292,_0xb7b5('0x131')+_0x2da69a['id']+'-'+_0x1e4bda+_0xb7b5('0x132'));var _0x9d418c={'path':_0x4cb9b6,'channel':'Chat','interactionId':_0x2da69a['id']};return pdf[_0xb7b5('0x133')](_0x70e961,_0x9d418c);})[_0xb7b5('0x39')](function(){return new BPromise(function(_0x2e300f,_0x18fc5c){zipdir(_0x4c5292,{'saveTo':_0x58a819},function(_0xa51100,_0x40cb6a){if(_0xa51100)return _0x18fc5c(_0xa51100);return _0x2e300f(_0x40cb6a);});})[_0xb7b5('0x39')](function(){return new BPromise(function(_0xb63205,_0xfb8851){rimraf(_0x4c5292,function(_0x4ceaf8){if(_0x4ceaf8)_0xfb8851(_0x4ceaf8);return _0xb63205();});});})[_0xb7b5('0x39')](function(){return _0x5b4e51['download'](_0x58a819,_0x336b77,function(_0x527b97){if(_0x527b97){console['log'](_0xb7b5('0x134'),_0x527b97);}else{fs[_0xb7b5('0x135')](_0x58a819);}});});});}else{return _0x5b4e51['sendStatus'](0xc8);}})['catch'](handleError(_0x5b4e51,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index af18b3a..f353c31 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 _0x0979=['save','remove','then','setDataValue','Users','map','unreadMessages','length','catch','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x167fd1,_0x49df6a){var _0x5714d9=function(_0x2b212a){while(--_0x2b212a){_0x167fd1['push'](_0x167fd1['shift']());}};_0x5714d9(++_0x49df6a);}(_0x0979,0x1a1));var _0x9097=function(_0x485f53,_0x104081){_0x485f53=_0x485f53-0x0;var _0x480f1e=_0x0979[_0x485f53];return _0x480f1e;};'use strict';var EventEmitter=require(_0x9097('0x0'));var ChatInteraction=require(_0x9097('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x9097('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9097('0x2')](0x0);var events={'afterCreate':_0x9097('0x3'),'afterUpdate':'update','afterDestroy':_0x9097('0x4')};function emitEvent(_0x71e7f5){return function(_0x3f36a3,_0x19f508,_0x1aba69){_0x3f36a3['getUsers']({'attributes':['id'],'raw':!![]})[_0x9097('0x5')](function(_0x5bd0f0){_0x3f36a3[_0x9097('0x6')](_0x9097('0x7'),_0x5bd0f0[_0x9097('0x8')](function(_0x1735fc){return{'id':_0x1735fc['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x3f36a3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9097('0x5')](function(_0xbae04e){_0x3f36a3[_0x9097('0x6')](_0x9097('0x9'),_0xbae04e[_0x9097('0xa')]);ChatInteractionEvents['emit'](_0x71e7f5+':'+_0x3f36a3['id'],_0x3f36a3);ChatInteractionEvents['emit'](_0x71e7f5,_0x3f36a3);_0x1aba69(null);})[_0x9097('0xb')](_0x1aba69(null));};}for(var e in events){if(events[_0x9097('0xc')](e)){var event=events[e];ChatInteraction[_0x9097('0xd')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x3c2b=['Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','save','remove','getUsers','then','setDataValue'];(function(_0x54a1bd,_0x286a39){var _0x32a413=function(_0x2456eb){while(--_0x2456eb){_0x54a1bd['push'](_0x54a1bd['shift']());}};_0x32a413(++_0x286a39);}(_0x3c2b,0x91));var _0xb3c2=function(_0x45caad,_0x5aba12){_0x45caad=_0x45caad-0x0;var _0x9f0888=_0x3c2b[_0x45caad];return _0x9f0888;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xb3c2('0x0'))['db'][_0xb3c2('0x1')];var ChatMessage=require(_0xb3c2('0x0'))['db'][_0xb3c2('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb3c2('0x3'),'afterUpdate':'update','afterDestroy':_0xb3c2('0x4')};function emitEvent(_0x55ee00){return function(_0x539c09,_0x30ca1b,_0x544f97){_0x539c09[_0xb3c2('0x5')]({'attributes':['id'],'raw':!![]})[_0xb3c2('0x6')](function(_0x1a07fc){_0x539c09[_0xb3c2('0x7')](_0xb3c2('0x8'),_0x1a07fc['map'](function(_0x75aa3c){return{'id':_0x75aa3c['id']};}));return ChatMessage[_0xb3c2('0x9')]({'where':{'ChatInteractionId':_0x539c09['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x7d8cf1){_0x539c09['setDataValue'](_0xb3c2('0xa'),_0x7d8cf1[_0xb3c2('0xb')]);ChatInteractionEvents[_0xb3c2('0xc')](_0x55ee00+':'+_0x539c09['id'],_0x539c09);ChatInteractionEvents['emit'](_0x55ee00,_0x539c09);_0x544f97(null);})[_0xb3c2('0xd')](_0x544f97(null));};}for(var e in events){if(events[_0xb3c2('0xe')](e)){var event=events[e];ChatInteraction[_0xb3c2('0xf')](e,emitEvent(event));}}module[_0xb3c2('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 3c3de2a..74dc946 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 _0x4533=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','utf8mb4'];(function(_0x3c1ea0,_0x3896aa){var _0x1211d0=function(_0x532fa6){while(--_0x532fa6){_0x3c1ea0['push'](_0x3c1ea0['shift']());}};_0x1211d0(++_0x3896aa);}(_0x4533,0x131));var _0x3453=function(_0xbaead4,_0x2a0d58){_0xbaead4=_0xbaead4-0x0;var _0x36251b=_0x4533[_0xbaead4];return _0x36251b;};'use strict';var _=require(_0x3453('0x0'));var util=require('util');var logger=require(_0x3453('0x1'))(_0x3453('0x2'));var moment=require(_0x3453('0x3'));var BPromise=require(_0x3453('0x4'));var rp=require(_0x3453('0x5'));var fs=require('fs');var path=require(_0x3453('0x6'));var rimraf=require(_0x3453('0x7'));var config=require(_0x3453('0x8'));var attributes=require(_0x3453('0x9'));module[_0x3453('0xa')]=function(_0x233f52,_0x453ca1){return _0x233f52[_0x3453('0xb')](_0x3453('0xc'),attributes,{'tableName':_0x3453('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5ea88e,_0x2e2b9d,_0x4d543a){if(_0x5ea88e[_0x3453('0xe')](_0x3453('0xf'))){_0x5ea88e[_0x3453('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4d543a(null,_0x5ea88e);}},'charset':_0x3453('0x11'),'collate':_0x3453('0x12')});}; \ No newline at end of file +var _0x7ac9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x2dffbd,_0x46c255){var _0x168554=function(_0x54440c){while(--_0x54440c){_0x2dffbd['push'](_0x2dffbd['shift']());}};_0x168554(++_0x46c255);}(_0x7ac9,0x75));var _0x97ac=function(_0xc1a047,_0x4c8382){_0xc1a047=_0xc1a047-0x0;var _0x16292d=_0x7ac9[_0xc1a047];return _0x16292d;};'use strict';var _=require(_0x97ac('0x0'));var util=require(_0x97ac('0x1'));var logger=require('../../config/logger')(_0x97ac('0x2'));var moment=require(_0x97ac('0x3'));var BPromise=require(_0x97ac('0x4'));var rp=require(_0x97ac('0x5'));var fs=require('fs');var path=require(_0x97ac('0x6'));var rimraf=require(_0x97ac('0x7'));var config=require(_0x97ac('0x8'));var attributes=require(_0x97ac('0x9'));module[_0x97ac('0xa')]=function(_0x11159a,_0x2eeb90){return _0x11159a[_0x97ac('0xb')](_0x97ac('0xc'),attributes,{'tableName':_0x97ac('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x449d0f,_0x1957a1,_0x4578e1){if(_0x449d0f[_0x97ac('0xe')](_0x97ac('0xf'))){_0x449d0f[_0x97ac('0x10')]=moment()['format'](_0x97ac('0x11'));}_0x4578e1(null,_0x449d0f);}},'charset':_0x97ac('0x12'),'collate':_0x97ac('0x13')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 5da8441..8c04060 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 _0x24ca=['../../config/logger','rpc','../../config/environment','jayson/promise','http','localhost','redis','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','options','raw','where','attributes','limit','AddTagsToChatInteraction','addTags','ids','omit','body','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x414c43,_0x1f7f4b){var _0x5f3b3d=function(_0x6be31e){while(--_0x6be31e){_0x414c43['push'](_0x414c43['shift']());}};_0x5f3b3d(++_0x1f7f4b);}(_0x24ca,0x125));var _0xa24c=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x24ca[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0xa24c('0x0'));var util=require(_0xa24c('0x1'));var moment=require(_0xa24c('0x2'));var BPromise=require(_0xa24c('0x3'));var rs=require(_0xa24c('0x4'));var fs=require('fs');var Redis=require(_0xa24c('0x5'));var db=require(_0xa24c('0x6'))['db'];var utils=require(_0xa24c('0x7'));var logger=require(_0xa24c('0x8'))(_0xa24c('0x9'));var config=require(_0xa24c('0xa'));var jayson=require(_0xa24c('0xb'));var client=jayson['client'][_0xa24c('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xa24c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa24c('0xe')]));require(_0xa24c('0xf'))[_0xa24c('0x10')](socket);function respondWithRpcPromise(_0x338e8e,_0x544815,_0x1785fc){return new BPromise(function(_0x36cf27,_0xb4de92){return client[_0xa24c('0x11')](_0x338e8e,_0x1785fc)[_0xa24c('0x12')](function(_0x3bec14){logger[_0xa24c('0x13')](_0xa24c('0x14'),_0x544815,_0xa24c('0x15'));logger[_0xa24c('0x16')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x544815,_0xa24c('0x15'),JSON[_0xa24c('0x17')](_0x3bec14));if(_0x3bec14[_0xa24c('0x18')]){if(_0x3bec14[_0xa24c('0x18')][_0xa24c('0x19')]===0x1f4){logger[_0xa24c('0x18')](_0xa24c('0x14'),_0x544815,_0x3bec14[_0xa24c('0x18')][_0xa24c('0x1a')]);return _0xb4de92(_0x3bec14[_0xa24c('0x18')][_0xa24c('0x1a')]);}logger['error'](_0xa24c('0x14'),_0x544815,_0x3bec14[_0xa24c('0x18')][_0xa24c('0x1a')]);return _0x36cf27(_0x3bec14[_0xa24c('0x18')][_0xa24c('0x1a')]);}else{logger[_0xa24c('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x544815,'request\x20sent');_0x36cf27(_0x3bec14[_0xa24c('0x1b')][_0xa24c('0x1a')]);}})[_0xa24c('0x1c')](function(_0x31d12a){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x544815,_0x31d12a);_0xb4de92(_0x31d12a);});});}exports[_0xa24c('0x1d')]=function(_0x2defe5){var _0x5f031f=this;return new Promise(function(_0x4f9670,_0xd71520){return db[_0xa24c('0x1e')]['update'](_0x2defe5['body'],{'raw':_0x2defe5[_0xa24c('0x1f')]?_0x2defe5['options'][_0xa24c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2defe5[_0xa24c('0x1f')]?_0x2defe5['options'][_0xa24c('0x21')]||null:null,'attributes':_0x2defe5[_0xa24c('0x1f')]?_0x2defe5[_0xa24c('0x1f')][_0xa24c('0x22')]||null:null,'limit':_0x2defe5[_0xa24c('0x1f')]?_0x2defe5[_0xa24c('0x1f')][_0xa24c('0x23')]||null:null})['then'](function(_0x292a16){logger[_0xa24c('0x13')](_0xa24c('0x1d'),_0x2defe5);logger[_0xa24c('0x16')](_0xa24c('0x1d'),_0x2defe5,JSON[_0xa24c('0x17')](_0x292a16));_0x4f9670(_0x292a16);})['catch'](function(_0x598220){logger[_0xa24c('0x18')](_0xa24c('0x1d'),_0x598220['message'],_0x2defe5);_0xd71520(_0x5f031f['error'](0x1f4,_0x598220[_0xa24c('0x1a')]));});});};exports[_0xa24c('0x24')]=function(_0x1faae8){return new Promise(function(_0x3ad2b1,_0x253d53){return db['ChatInteraction']['find']({'where':_0x1faae8[_0xa24c('0x1f')]?_0x1faae8['options']['where']||null:null})['then'](function(_0x21cdbf){if(_0x21cdbf){return _0x21cdbf[_0xa24c('0x25')](_0x1faae8['body'][_0xa24c('0x26')],_[_0xa24c('0x27')](_0x1faae8[_0xa24c('0x28')],[_0xa24c('0x26'),'id'])||{});}})[_0xa24c('0x29')](function(_0x194ba6){logger[_0xa24c('0x13')](_0xa24c('0x2a'),_0x1faae8);logger[_0xa24c('0x16')](_0xa24c('0x2a'),_0x1faae8,JSON[_0xa24c('0x17')](_0x194ba6));_0x3ad2b1(_0x194ba6);})[_0xa24c('0x1c')](function(_0x4b397d){logger[_0xa24c('0x18')](_0xa24c('0x2a'),_0x4b397d[_0xa24c('0x1a')],_0x1faae8);_0x253d53(_this['error'](0x1f4,_0x4b397d[_0xa24c('0x1a')]));});});}; \ No newline at end of file +var _0x5dad=['request\x20sent','debug','stringify','error','code','message','result','catch','ChatInteraction','update','body','options','raw','where','attributes','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','then','info','ChatInteraction,\x20%s,\x20%s'];(function(_0x1139c5,_0x4b83dd){var _0x385a93=function(_0x13ad36){while(--_0x13ad36){_0x1139c5['push'](_0x1139c5['shift']());}};_0x385a93(++_0x4b83dd);}(_0x5dad,0x107));var _0xd5da=function(_0x280b01,_0x39f6bb){_0x280b01=_0x280b01-0x0;var _0x39414b=_0x5dad[_0x280b01];return _0x39414b;};'use strict';var _=require(_0xd5da('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd5da('0x1'));var rs=require(_0xd5da('0x2'));var fs=require('fs');var Redis=require(_0xd5da('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5da('0x4'));var logger=require(_0xd5da('0x5'))(_0xd5da('0x6'));var config=require(_0xd5da('0x7'));var jayson=require(_0xd5da('0x8'));var client=jayson[_0xd5da('0x9')]['http']({'port':0x232a});config[_0xd5da('0xa')]=_[_0xd5da('0xb')](config['redis'],{'host':_0xd5da('0xc'),'port':0x18eb});var socket=require(_0xd5da('0xd'))(new Redis(config[_0xd5da('0xa')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x29e0c6,_0x1a289b,_0x5a1775){return new BPromise(function(_0xdb958d,_0x2d0f56){return client['request'](_0x29e0c6,_0x5a1775)[_0xd5da('0xe')](function(_0x4540cf){logger[_0xd5da('0xf')](_0xd5da('0x10'),_0x1a289b,_0xd5da('0x11'));logger[_0xd5da('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1a289b,'request\x20sent',JSON[_0xd5da('0x13')](_0x4540cf));if(_0x4540cf['error']){if(_0x4540cf[_0xd5da('0x14')][_0xd5da('0x15')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x1a289b,_0x4540cf[_0xd5da('0x14')][_0xd5da('0x16')]);return _0x2d0f56(_0x4540cf['error'][_0xd5da('0x16')]);}logger[_0xd5da('0x14')](_0xd5da('0x10'),_0x1a289b,_0x4540cf[_0xd5da('0x14')]['message']);return _0xdb958d(_0x4540cf[_0xd5da('0x14')][_0xd5da('0x16')]);}else{logger[_0xd5da('0xf')](_0xd5da('0x10'),_0x1a289b,_0xd5da('0x11'));_0xdb958d(_0x4540cf[_0xd5da('0x17')]['message']);}})[_0xd5da('0x18')](function(_0x25d369){logger[_0xd5da('0x14')](_0xd5da('0x10'),_0x1a289b,_0x25d369);_0x2d0f56(_0x25d369);});});}exports['UpdateChatInteraction']=function(_0x1b5f2d){var _0x171ca2=this;return new Promise(function(_0x26c962,_0x4104b1){return db[_0xd5da('0x19')][_0xd5da('0x1a')](_0x1b5f2d[_0xd5da('0x1b')],{'raw':_0x1b5f2d[_0xd5da('0x1c')]?_0x1b5f2d[_0xd5da('0x1c')][_0xd5da('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b5f2d[_0xd5da('0x1c')]?_0x1b5f2d['options'][_0xd5da('0x1e')]||null:null,'attributes':_0x1b5f2d[_0xd5da('0x1c')]?_0x1b5f2d[_0xd5da('0x1c')][_0xd5da('0x1f')]||null:null,'limit':_0x1b5f2d[_0xd5da('0x1c')]?_0x1b5f2d['options']['limit']||null:null})['then'](function(_0x2e5116){logger[_0xd5da('0xf')](_0xd5da('0x20'),_0x1b5f2d);logger[_0xd5da('0x12')](_0xd5da('0x20'),_0x1b5f2d,JSON[_0xd5da('0x13')](_0x2e5116));_0x26c962(_0x2e5116);})[_0xd5da('0x18')](function(_0x468f48){logger['error'](_0xd5da('0x20'),_0x468f48['message'],_0x1b5f2d);_0x4104b1(_0x171ca2['error'](0x1f4,_0x468f48[_0xd5da('0x16')]));});});};exports[_0xd5da('0x21')]=function(_0x33e1e2){return new Promise(function(_0x5cd3b0,_0x217b3c){return db[_0xd5da('0x19')][_0xd5da('0x22')]({'where':_0x33e1e2[_0xd5da('0x1c')]?_0x33e1e2[_0xd5da('0x1c')][_0xd5da('0x1e')]||null:null})[_0xd5da('0xe')](function(_0xe39c0c){if(_0xe39c0c){return _0xe39c0c[_0xd5da('0x23')](_0x33e1e2[_0xd5da('0x1b')][_0xd5da('0x24')],_[_0xd5da('0x25')](_0x33e1e2[_0xd5da('0x1b')],[_0xd5da('0x24'),'id'])||{});}})[_0xd5da('0x26')](function(_0x584956){logger[_0xd5da('0xf')](_0xd5da('0x27'),_0x33e1e2);logger[_0xd5da('0x12')](_0xd5da('0x27'),_0x33e1e2,JSON['stringify'](_0x584956));_0x5cd3b0(_0x584956);})[_0xd5da('0x18')](function(_0x103113){logger[_0xd5da('0x14')]('AddTags',_0x103113[_0xd5da('0x16')],_0x33e1e2);_0x217b3c(_this[_0xd5da('0x14')](0x1f4,_0x103113['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 2bd9cf1..215b2ad 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 _0x670d=['length','chatInteraction:','./chatInteraction.events','save','remove','emit','register'];(function(_0x378f95,_0x55adde){var _0xd489aa=function(_0x1b76a4){while(--_0x1b76a4){_0x378f95['push'](_0x378f95['shift']());}};_0xd489aa(++_0x55adde);}(_0x670d,0x152));var _0xd670=function(_0x47b2e8,_0x4c95ec){_0x47b2e8=_0x47b2e8-0x0;var _0x5073e9=_0x670d[_0x47b2e8];return _0x5073e9;};'use strict';var ChatInteractionEvents=require(_0xd670('0x0'));var events=[_0xd670('0x1'),_0xd670('0x2'),'update'];function createListener(_0x5d8ea8,_0x11c22a){return function(_0x51c71e){_0x11c22a[_0xd670('0x3')](_0x5d8ea8,_0x51c71e);};}function removeListener(_0x271228,_0x11a951){return function(){ChatInteractionEvents['removeListener'](_0x271228,_0x11a951);};}exports[_0xd670('0x4')]=function(_0xd7996a){for(var _0x460c71=0x0,_0x38d67b=events[_0xd670('0x5')];_0x460c71<_0x38d67b;_0x460c71++){var _0x10376c=events[_0x460c71];var _0xd26092=createListener(_0xd670('0x6')+_0x10376c,_0xd7996a);ChatInteractionEvents['on'](_0x10376c,_0xd26092);}}; \ No newline at end of file +var _0x92ed=['register','length','chatInteraction:','./chatInteraction.events','save','remove','update','removeListener'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x92ed,0x1c3));var _0xd92e=function(_0xec8068,_0x24d09f){_0xec8068=_0xec8068-0x0;var _0x2e3716=_0x92ed[_0xec8068];return _0x2e3716;};'use strict';var ChatInteractionEvents=require(_0xd92e('0x0'));var events=[_0xd92e('0x1'),_0xd92e('0x2'),_0xd92e('0x3')];function createListener(_0x5dabe1,_0x39a62b){return function(_0x1a5329){_0x39a62b['emit'](_0x5dabe1,_0x1a5329);};}function removeListener(_0xd1fc4e,_0x5df2ca){return function(){ChatInteractionEvents[_0xd92e('0x4')](_0xd1fc4e,_0x5df2ca);};}exports[_0xd92e('0x5')]=function(_0x572a1b){for(var _0x4b7ebf=0x0,_0x1ba0ae=events[_0xd92e('0x6')];_0x4b7ebf<_0x1ba0ae;_0x4b7ebf++){var _0x2c88ef=events[_0x4b7ebf];var _0x3690a0=createListener(_0xd92e('0x7')+_0x2c88ef,_0x572a1b);ChatInteractionEvents['on'](_0x2c88ef,_0x3690a0);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 51347a1..2c2c687 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 _0x4740=['connect-timeout','Router','fs-extra','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','/describe','get','/:id','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages','getMyMessages','/:id/download','download','create','/:id/vidaoo','createVidaooSession','join','root','format','%s-%s','now','originalname','post','/:id/attachment_upload','file','attachmentUpload','addMessage','chat','chatinteraction:addtags','tracked','chatinteraction:update','update','put','/:id/custom_update','customUpdate','abandon','/:id/close','destroy','delete','/:id/tags','removeTags','exports','util','path'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x4740,0xee));var _0x0474=function(_0x4a35f6,_0x2bcff3){_0x4a35f6=_0x4a35f6-0x0;var _0x57b1f9=_0x4740[_0x4a35f6];return _0x57b1f9;};'use strict';var multer=require('multer');var util=require(_0x0474('0x0'));var path=require(_0x0474('0x1'));var timeout=require(_0x0474('0x2'));var express=require('express');var router=express[_0x0474('0x3')]();var fs_extra=require(_0x0474('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0474('0x5'));var config=require('../../config/environment');var controller=require(_0x0474('0x6'));router['get']('/',auth[_0x0474('0x7')](),controller[_0x0474('0x8')]);router['get'](_0x0474('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x0474('0xa')](_0x0474('0xb'),auth[_0x0474('0xc')](),controller['show']);router[_0x0474('0xa')](_0x0474('0xd'),auth[_0x0474('0xc')](),controller['attachmentDownload']);router['get'](_0x0474('0xe'),auth['isAuthenticated'](),controller[_0x0474('0xf')]);router[_0x0474('0xa')]('/:id/my_messages',auth[_0x0474('0xc')](),controller[_0x0474('0x10')]);router['get'](_0x0474('0x11'),auth['isAuthenticated'](),controller[_0x0474('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0474('0x13')]);router['post'](_0x0474('0x14'),auth[_0x0474('0x7')](),controller[_0x0474('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1bcd26,_0x5d8a1f,_0x2a6ffe){_0x2a6ffe(null,path[_0x0474('0x16')](config[_0x0474('0x17')],'server/files/attachments/'));},'filename':function(_0x508b1d,_0x1bf913,_0xceed2c){_0xceed2c(null,util[_0x0474('0x18')](_0x0474('0x19'),Date[_0x0474('0x1a')](),_0x1bf913[_0x0474('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0474('0x1c')](_0x0474('0x1d'),upload['single'](_0x0474('0x1e')),controller[_0x0474('0x1f')]);router[_0x0474('0x1c')](_0x0474('0xe'),auth[_0x0474('0xc')](),controller[_0x0474('0x20')]);router[_0x0474('0x1c')]('/:id/tags',auth[_0x0474('0x7')](),interaction['tracked'](_0x0474('0x21'),_0x0474('0x22')),controller['addTags']);router['put'](_0x0474('0xb'),auth[_0x0474('0x7')](),interaction[_0x0474('0x23')]('chat',_0x0474('0x24')),controller[_0x0474('0x25')]);router[_0x0474('0x26')](_0x0474('0x27'),controller[_0x0474('0x28')]);router['put']('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x0474('0x29')]);router[_0x0474('0x26')](_0x0474('0x2a'),controller['close']);router['delete'](_0x0474('0xb'),auth[_0x0474('0x7')](),interaction['tracked'](_0x0474('0x21'),'chatinteraction:destroy'),controller[_0x0474('0x2b')]);router[_0x0474('0x2c')](_0x0474('0x2d'),auth[_0x0474('0x7')](),controller[_0x0474('0x2e')]);module[_0x0474('0x2f')]=router; \ No newline at end of file +var _0xc1f6=['/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','replace','single','file','/:id/messages','addMessage','/:id/tags','chat','chatinteraction:addtags','put','tracked','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','delete','/:id','chatinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages'];(function(_0xe3a4a8,_0xb236ed){var _0x569f8b=function(_0x33bf93){while(--_0x33bf93){_0xe3a4a8['push'](_0xe3a4a8['shift']());}};_0x569f8b(++_0xb236ed);}(_0xc1f6,0xb9));var _0x6c1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1f6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6c1f('0x0'));var util=require(_0x6c1f('0x1'));var path=require(_0x6c1f('0x2'));var timeout=require(_0x6c1f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6c1f('0x4'));var auth=require(_0x6c1f('0x5'));var interaction=require(_0x6c1f('0x6'));var config=require(_0x6c1f('0x7'));var controller=require(_0x6c1f('0x8'));router[_0x6c1f('0x9')]('/',auth[_0x6c1f('0xa')](),controller[_0x6c1f('0xb')]);router[_0x6c1f('0x9')]('/describe',auth[_0x6c1f('0xa')](),controller[_0x6c1f('0xc')]);router[_0x6c1f('0x9')]('/:id',auth[_0x6c1f('0xd')](),controller['show']);router[_0x6c1f('0x9')](_0x6c1f('0xe'),auth[_0x6c1f('0xd')](),controller[_0x6c1f('0xf')]);router[_0x6c1f('0x9')]('/:id/messages',auth[_0x6c1f('0xa')](),controller[_0x6c1f('0x10')]);router['get'](_0x6c1f('0x11'),auth[_0x6c1f('0xd')](),controller[_0x6c1f('0x12')]);router[_0x6c1f('0x9')](_0x6c1f('0x13'),auth[_0x6c1f('0xa')](),controller[_0x6c1f('0x14')]);router['post']('/',auth[_0x6c1f('0xa')](),controller['create']);router[_0x6c1f('0x15')](_0x6c1f('0x16'),auth[_0x6c1f('0xa')](),controller[_0x6c1f('0x17')]);var upload=multer({'storage':multer[_0x6c1f('0x18')]({'destination':function(_0x42e541,_0x4f0632,_0x569bb5){_0x569bb5(null,path[_0x6c1f('0x19')](config[_0x6c1f('0x1a')],_0x6c1f('0x1b')));},'filename':function(_0x296b2a,_0xd3ae0f,_0x15e224){_0x15e224(null,util['format'](_0x6c1f('0x1c'),Date[_0x6c1f('0x1d')](),_0xd3ae0f['originalname'][_0x6c1f('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x6c1f('0x1f')](_0x6c1f('0x20')),controller['attachmentUpload']);router[_0x6c1f('0x15')](_0x6c1f('0x21'),auth[_0x6c1f('0xd')](),controller[_0x6c1f('0x22')]);router['post'](_0x6c1f('0x23'),auth[_0x6c1f('0xa')](),interaction['tracked'](_0x6c1f('0x24'),_0x6c1f('0x25')),controller['addTags']);router[_0x6c1f('0x26')]('/:id',auth['isAuthenticated'](),interaction[_0x6c1f('0x27')]('chat','chatinteraction:update'),controller[_0x6c1f('0x28')]);router[_0x6c1f('0x26')](_0x6c1f('0x29'),controller['customUpdate']);router[_0x6c1f('0x26')](_0x6c1f('0x2a'),auth[_0x6c1f('0xd')](),controller[_0x6c1f('0x2b')]);router[_0x6c1f('0x26')](_0x6c1f('0x2c'),controller[_0x6c1f('0x2d')]);router[_0x6c1f('0x2e')](_0x6c1f('0x2f'),auth[_0x6c1f('0xa')](),interaction['tracked'](_0x6c1f('0x24'),_0x6c1f('0x30')),controller[_0x6c1f('0x31')]);router[_0x6c1f('0x2e')]('/:id/tags',auth[_0x6c1f('0xa')](),controller[_0x6c1f('0x32')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index b09bc84..4dd546a 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 _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x4cba20,_0x94c913){var _0x453719=function(_0xcbe58e){while(--_0xcbe58e){_0x4cba20['push'](_0x4cba20['shift']());}};_0x453719(++_0x94c913);}(_0xdb28,0x106));var _0x8db2=function(_0x99c0c4,_0x502db4){_0x99c0c4=_0x99c0c4-0x0;var _0x4707ed=_0xdb28[_0x99c0c4];return _0x4707ed;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8db2('0x4')]}}; \ No newline at end of file +var _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x44676f,_0x263a91){var _0xbff777=function(_0x1c8f6e){while(--_0x1c8f6e){_0x44676f['push'](_0x44676f['shift']());}};_0xbff777(++_0x263a91);}(_0xdb28,0x106));var _0x8db2=function(_0x3ab70e,_0x4a2dda){_0x3ab70e=_0x3ab70e-0x0;var _0x3afb79=_0xdb28[_0x3ab70e];return _0x3afb79;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8db2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8f0a407..cdf9526 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 _0x3a6e=['offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','params','includeAll','find','catch','create','body','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','resourceId','push','FromId','ToId','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','end','status','json','undefined','limit'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x3a6e,0x12a));var _0xe3a6=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x3a6e[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0xe3a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe3a6('0x1'));var jsonpatch=require(_0xe3a6('0x2'));var rp=require(_0xe3a6('0x3'));var moment=require('moment');var BPromise=require(_0xe3a6('0x4'));var Mustache=require(_0xe3a6('0x5'));var util=require(_0xe3a6('0x6'));var path=require(_0xe3a6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe3a6('0x8'));var fs=require('fs');var fs_extra=require(_0xe3a6('0x9'));var _=require('lodash');var squel=require(_0xe3a6('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe3a6('0xb'));var toCsv=require(_0xe3a6('0xc'));var querystring=require(_0xe3a6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe3a6('0xe'));var hardwareService=require(_0xe3a6('0xf'));var logger=require(_0xe3a6('0x10'))(_0xe3a6('0x11'));var utils=require(_0xe3a6('0x12'));var config=require(_0xe3a6('0x13'));var licenseUtil=require(_0xe3a6('0x14'));var db=require(_0xe3a6('0x15'))['db'];config[_0xe3a6('0x16')]=_[_0xe3a6('0x17')](config['redis'],{'host':_0xe3a6('0x18'),'port':0x18eb});var socket=require(_0xe3a6('0x19'))(new Redis(config[_0xe3a6('0x16')]));require(_0xe3a6('0x1a'))['register'](socket);function respondWithStatusCode(_0x3de1b5,_0x198350){_0x198350=_0x198350||0xcc;return function(_0x368182){if(_0x368182){return _0x3de1b5['sendStatus'](_0x198350);}return _0x3de1b5['status'](_0x198350)[_0xe3a6('0x1b')]();};}function respondWithResult(_0x3f97b9,_0xfa7427){_0xfa7427=_0xfa7427||0xc8;return function(_0x562164){if(_0x562164){return _0x3f97b9[_0xe3a6('0x1c')](_0xfa7427)[_0xe3a6('0x1d')](_0x562164);}};}function respondWithFilteredResult(_0xe4d8b2,_0x540853){return function(_0x5b52e7){if(_0x5b52e7){var _0x4d8e83=typeof _0x540853['offset']===_0xe3a6('0x1e')&&typeof _0x540853[_0xe3a6('0x1f')]===_0xe3a6('0x1e');var _0xe7e3f9=_0x5b52e7['count'];var _0x163bde=_0x4d8e83?0x0:_0x540853['offset'];var _0x479885=_0x4d8e83?_0x5b52e7['count']:_0x540853[_0xe3a6('0x20')]+_0x540853[_0xe3a6('0x1f')];var _0x54c750;if(_0x479885>=_0xe7e3f9){_0x479885=_0xe7e3f9;_0x54c750=0xc8;}else{_0x54c750=0xce;}_0xe4d8b2[_0xe3a6('0x1c')](_0x54c750);return _0xe4d8b2[_0xe3a6('0x21')](_0xe3a6('0x22'),_0x163bde+'-'+_0x479885+'/'+_0xe7e3f9)[_0xe3a6('0x1d')](_0x5b52e7);}return null;};}function patchUpdates(_0x468dbd){return function(_0x1b37f7){try{jsonpatch[_0xe3a6('0x23')](_0x1b37f7,_0x468dbd,!![]);}catch(_0x483314){return BPromise[_0xe3a6('0x24')](_0x483314);}return _0x1b37f7[_0xe3a6('0x25')]();};}function saveUpdates(_0x553d3c,_0x171bdb){return function(_0x10a1f2){if(_0x10a1f2){return _0x10a1f2[_0xe3a6('0x26')](_0x553d3c)[_0xe3a6('0x27')](function(_0x3f7ec0){return _0x3f7ec0;});}return null;};}function removeEntity(_0x4652b4,_0x5a8f31){return function(_0x76be46){if(_0x76be46){return _0x76be46[_0xe3a6('0x28')]()[_0xe3a6('0x27')](function(){_0x4652b4['status'](0xcc)[_0xe3a6('0x1b')]();});}};}function handleEntityNotFound(_0x2df90e,_0x55cc5a){return function(_0x3655bf){if(!_0x3655bf){_0x2df90e[_0xe3a6('0x29')](0x194);}return _0x3655bf;};}function handleError(_0x496371,_0x19d53c){_0x19d53c=_0x19d53c||0x1f4;return function(_0x1905e0){logger[_0xe3a6('0x2a')](_0x1905e0['stack']);if(_0x1905e0[_0xe3a6('0x2b')]){delete _0x1905e0[_0xe3a6('0x2b')];}_0x496371[_0xe3a6('0x1c')](_0x19d53c)[_0xe3a6('0x2c')](_0x1905e0);};}exports[_0xe3a6('0x2d')]=function(_0x2e2c9d,_0x304a3e){var _0x213a75={},_0xc4106={},_0x46b997={'count':0x0,'rows':[]};var _0x5e714b=_[_0xe3a6('0x2e')](db[_0xe3a6('0x2f')][_0xe3a6('0x30')],function(_0x3488ad){return{'name':_0x3488ad['fieldName'],'type':_0x3488ad[_0xe3a6('0x31')][_0xe3a6('0x32')]};});_0xc4106['model']=_['map'](_0x5e714b,'name');_0xc4106['query']=_[_0xe3a6('0x33')](_0x2e2c9d[_0xe3a6('0x34')]);_0xc4106[_0xe3a6('0x35')]=_[_0xe3a6('0x36')](_0xc4106[_0xe3a6('0x37')],_0xc4106[_0xe3a6('0x34')]);_0x213a75[_0xe3a6('0x38')]=_[_0xe3a6('0x36')](_0xc4106[_0xe3a6('0x37')],qs[_0xe3a6('0x39')](_0x2e2c9d[_0xe3a6('0x34')][_0xe3a6('0x39')]));_0x213a75['attributes']=_0x213a75['attributes'][_0xe3a6('0x3a')]?_0x213a75[_0xe3a6('0x38')]:_0xc4106[_0xe3a6('0x37')];if(!_0x2e2c9d[_0xe3a6('0x34')][_0xe3a6('0x3b')](_0xe3a6('0x3c'))){_0x213a75['limit']=qs['limit'](_0x2e2c9d[_0xe3a6('0x34')][_0xe3a6('0x1f')]);_0x213a75[_0xe3a6('0x20')]=qs[_0xe3a6('0x20')](_0x2e2c9d[_0xe3a6('0x34')][_0xe3a6('0x20')]);}_0x213a75[_0xe3a6('0x3d')]=qs[_0xe3a6('0x3e')](_0x2e2c9d[_0xe3a6('0x34')][_0xe3a6('0x3e')]);_0x213a75['where']=qs[_0xe3a6('0x35')](_['pick'](_0x2e2c9d[_0xe3a6('0x34')],_0xc4106['filters']),_0x5e714b);if(_0x2e2c9d[_0xe3a6('0x34')][_0xe3a6('0x3f')]){_0x213a75[_0xe3a6('0x40')]=_[_0xe3a6('0x41')](_0x213a75['where'],{'$or':_[_0xe3a6('0x2e')](_0x5e714b,function(_0x2dc4fe){if(_0x2dc4fe[_0xe3a6('0x31')]!==_0xe3a6('0x42')){var _0x126c04={};_0x126c04[_0x2dc4fe[_0xe3a6('0x2b')]]={'$like':'%'+_0x2e2c9d[_0xe3a6('0x34')][_0xe3a6('0x3f')]+'%'};return _0x126c04;}})});}_0x213a75=_[_0xe3a6('0x41')]({},_0x213a75,_0x2e2c9d[_0xe3a6('0x43')]);var _0x510c70={'where':_0x213a75[_0xe3a6('0x40')]};return db[_0xe3a6('0x2f')][_0xe3a6('0x44')](_0x510c70)[_0xe3a6('0x27')](function(_0x5b8a78){_0x46b997['count']=_0x5b8a78;if(_0x2e2c9d['query']['includeAll']){_0x213a75[_0xe3a6('0x45')]=[{'all':!![]}];}return db[_0xe3a6('0x2f')][_0xe3a6('0x46')](_0x213a75);})['then'](function(_0x3fe4d9){_0x46b997[_0xe3a6('0x47')]=_0x3fe4d9;return _0x46b997;})[_0xe3a6('0x27')](respondWithFilteredResult(_0x304a3e,_0x213a75))['catch'](handleError(_0x304a3e,null));};exports['show']=function(_0x5e47e2,_0xd31e5c){var _0x4549f5={'raw':!![],'where':{'id':_0x5e47e2[_0xe3a6('0x48')]['id']}},_0x5619d0={};_0x5619d0[_0xe3a6('0x37')]=_[_0xe3a6('0x33')](db[_0xe3a6('0x2f')][_0xe3a6('0x30')]);_0x5619d0[_0xe3a6('0x34')]=_['keys'](_0x5e47e2[_0xe3a6('0x34')]);_0x5619d0[_0xe3a6('0x35')]=_['intersection'](_0x5619d0[_0xe3a6('0x37')],_0x5619d0[_0xe3a6('0x34')]);_0x4549f5['attributes']=_['intersection'](_0x5619d0['model'],qs['fields'](_0x5e47e2[_0xe3a6('0x34')][_0xe3a6('0x39')]));_0x4549f5['attributes']=_0x4549f5[_0xe3a6('0x38')][_0xe3a6('0x3a')]?_0x4549f5[_0xe3a6('0x38')]:_0x5619d0[_0xe3a6('0x37')];if(_0x5e47e2['query'][_0xe3a6('0x49')]){_0x4549f5[_0xe3a6('0x45')]=[{'all':!![]}];}_0x4549f5=_[_0xe3a6('0x41')]({},_0x4549f5,_0x5e47e2[_0xe3a6('0x43')]);return db[_0xe3a6('0x2f')][_0xe3a6('0x4a')](_0x4549f5)[_0xe3a6('0x27')](handleEntityNotFound(_0xd31e5c,null))[_0xe3a6('0x27')](respondWithResult(_0xd31e5c,null))[_0xe3a6('0x4b')](handleError(_0xd31e5c,null));};exports[_0xe3a6('0x4c')]=function(_0x3fb523,_0xe19843){return db[_0xe3a6('0x2f')]['create'](_0x3fb523[_0xe3a6('0x4d')],{})[_0xe3a6('0x27')](respondWithResult(_0xe19843,0xc9))[_0xe3a6('0x4b')](handleError(_0xe19843,null));};exports[_0xe3a6('0x26')]=function(_0x576d5e,_0x1eda53){if(_0x576d5e[_0xe3a6('0x4d')]['id']){delete _0x576d5e[_0xe3a6('0x4d')]['id'];}return db[_0xe3a6('0x2f')][_0xe3a6('0x4a')]({'where':{'id':_0x576d5e[_0xe3a6('0x48')]['id']}})[_0xe3a6('0x27')](handleEntityNotFound(_0x1eda53,null))[_0xe3a6('0x27')](saveUpdates(_0x576d5e[_0xe3a6('0x4d')],null))['then'](respondWithResult(_0x1eda53,null))['catch'](handleError(_0x1eda53,null));};exports[_0xe3a6('0x28')]=function(_0x1daf93,_0x36147b){return db[_0xe3a6('0x2f')][_0xe3a6('0x4a')]({'where':{'id':_0x1daf93[_0xe3a6('0x48')]['id']}})[_0xe3a6('0x27')](handleEntityNotFound(_0x36147b,null))[_0xe3a6('0x27')](removeEntity(_0x36147b,null))[_0xe3a6('0x4b')](handleError(_0x36147b,null));};exports[_0xe3a6('0x4e')]=function(_0x148e6e,_0x44ab93){return db[_0xe3a6('0x2f')][_0xe3a6('0x4e')]()[_0xe3a6('0x27')](respondWithResult(_0x44ab93,null))['catch'](handleError(_0x44ab93,null));};function wrapUser(_0x10f6ed){return function(_0x57fa96){var _0x57065b=_0x10f6ed[_0xe3a6('0x4f')]({'plain':!![]});_0x57065b[_0xe3a6('0x50')]=[];if(_0x57fa96){_0x57065b['lastMessageAt']=_0x57fa96[_0xe3a6('0x51')];_0x57065b[_0xe3a6('0x52')]=_0x57fa96;}else{_0x57065b[_0xe3a6('0x53')]=moment(0x0)[_0xe3a6('0x54')](_0xe3a6('0x55'));_0x57065b[_0xe3a6('0x52')]={};}return _0x57065b;};}exports[_0xe3a6('0x56')]=function(_0x12b940,_0x3db3c9,_0x26d587){var _0x48be35=[];return db[_0xe3a6('0x57')]['findAll']({'where':{'role':[_0xe3a6('0x58'),_0xe3a6('0x59'),'user']},'attributes':['id',_0xe3a6('0x5a'),'name',_0xe3a6('0x5b'),_0xe3a6('0x5c'),_0xe3a6('0x5d'),_0xe3a6('0x5e'),_0xe3a6('0x5f'),_0xe3a6('0x60'),'showWebBar'],'order':qs[_0xe3a6('0x3e')](_0xe3a6('0x61')),'include':[{'model':db[_0xe3a6('0x62')],'as':'VoiceQueues','attributes':['id',_0xe3a6('0x2b'),_0xe3a6('0x31')],'through':{'attributes':[]}}]})[_0xe3a6('0x27')](function(_0x6cff87){if(_0x6cff87){var _0x3e1023=_0x12b940[_0xe3a6('0x63')]['get']({'plain':!![]});if(!_0x3e1023)throw new Error(_0xe3a6('0x64'));if(_0x3e1023['role']===_0xe3a6('0x63')){return db[_0xe3a6('0x65')][_0xe3a6('0x4a')]({'where':{'name':'Agents','userProfileId':_0x3e1023[_0xe3a6('0x66')]},'raw':!![]})[_0xe3a6('0x27')](function(_0x113d6e){if(_0x113d6e){if(_0x113d6e[_0xe3a6('0x67')]===0x0){return db['UserProfileResource'][_0xe3a6('0x46')]({'where':{'sectionId':_0x113d6e['id']},'raw':!![]})[_0xe3a6('0x27')](function(_0x105bd8){var _0x44c2d6=[];if(_['isEmpty'](_0x105bd8)){_0x44c2d6=_[_0xe3a6('0x3f')](_0x6cff87,function(_0x2be4f0){if(_0x2be4f0['role']!==_0xe3a6('0x58')){return _0x2be4f0;}});return _0x44c2d6;}else{for(var _0xf6a45d=0x0;_0xf6a45d<_0x6cff87[_0xe3a6('0x3a')];_0xf6a45d++){var _0x488dd6=_0x6cff87[_0xf6a45d];if(_0x488dd6['role']==='agent'){var _0xb5e448=_['find'](_0x105bd8,function(_0x578a59){return _0x578a59[_0xe3a6('0x68')]===_0x488dd6['id'];});if(_0xb5e448)_0x44c2d6[_0xe3a6('0x69')](_0x488dd6);}else{_0x44c2d6[_0xe3a6('0x69')](_0x488dd6);}}return _0x44c2d6;}});}else{return _0x6cff87;}}else{var _0x2f47be=_[_0xe3a6('0x3f')](_0x6cff87,function(_0x487f7c){if(_0x487f7c[_0xe3a6('0x5b')]!==_0xe3a6('0x58')){return _0x487f7c;}});return _0x2f47be;}});}else{return _0x6cff87;}}})[_0xe3a6('0x27')](function(_0x3c95a2){var _0x47b705=[];if(_0x3c95a2){_0x48be35=_0x3c95a2;for(var _0x143296=0x0;_0x143296<_0x3c95a2[_0xe3a6('0x3a')];_0x143296+=0x1){_0x48be35[_0x143296][_0xe3a6('0x50')]=[];_0x47b705['push'](db[_0xe3a6('0x2f')]['find']({'where':{'FromId':[_0x12b940['user']['id'],_0x3c95a2[_0x143296]['id']],'ToId':[_0x12b940['user']['id'],_0x3c95a2[_0x143296]['id']],'ChatGroupId':null},'attributes':['id',_0xe3a6('0x51'),_0xe3a6('0x6a'),_0xe3a6('0x6b'),'read',_0xe3a6('0x4d')],'order':qs['sort'](_0xe3a6('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe3a6('0x27')](wrapUser(_0x3c95a2[_0x143296])));}return BPromise[_0xe3a6('0x6d')](_0x47b705);}return[];})[_0xe3a6('0x27')](function(_0x30a33a){return{'rows':_0x30a33a,'count':_0x30a33a['length']};})[_0xe3a6('0x27')](respondWithResult(_0x3db3c9,null))['catch'](handleError(_0x3db3c9,null));}; \ No newline at end of file +var _0x99b4=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','keys','includeAll','options','create','body','update','find','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','sort','-online','VoiceQueue','VoiceQueues','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x99b4,0x139));var _0x499b=function(_0x314c1f,_0x53f85d){_0x314c1f=_0x314c1f-0x0;var _0x49bcca=_0x99b4[_0x314c1f];return _0x49bcca;};'use strict';var emlformat=require(_0x499b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x499b('0x1'));var rp=require('request-promise');var moment=require(_0x499b('0x2'));var BPromise=require(_0x499b('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x499b('0x4'));var csv=require(_0x499b('0x5'));var ejs=require(_0x499b('0x6'));var fs=require('fs');var fs_extra=require(_0x499b('0x7'));var _=require(_0x499b('0x8'));var squel=require(_0x499b('0x9'));var crypto=require(_0x499b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x499b('0xb'));var toCsv=require(_0x499b('0x5'));var querystring=require(_0x499b('0xc'));var Papa=require('papaparse');var Redis=require(_0x499b('0xd'));var authService=require(_0x499b('0xe'));var qs=require(_0x499b('0xf'));var as=require(_0x499b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x499b('0x11'))(_0x499b('0x12'));var utils=require(_0x499b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x499b('0x14'));var db=require(_0x499b('0x15'))['db'];config[_0x499b('0x16')]=_[_0x499b('0x17')](config[_0x499b('0x16')],{'host':_0x499b('0x18'),'port':0x18eb});var socket=require(_0x499b('0x19'))(new Redis(config['redis']));require(_0x499b('0x1a'))['register'](socket);function respondWithStatusCode(_0x534609,_0x271827){_0x271827=_0x271827||0xcc;return function(_0x97f704){if(_0x97f704){return _0x534609[_0x499b('0x1b')](_0x271827);}return _0x534609[_0x499b('0x1c')](_0x271827)[_0x499b('0x1d')]();};}function respondWithResult(_0x399f69,_0x911f6f){_0x911f6f=_0x911f6f||0xc8;return function(_0x5b2387){if(_0x5b2387){return _0x399f69[_0x499b('0x1c')](_0x911f6f)[_0x499b('0x1e')](_0x5b2387);}};}function respondWithFilteredResult(_0x186c7a,_0x2888ce){return function(_0x4f6663){if(_0x4f6663){var _0x80e748=typeof _0x2888ce[_0x499b('0x1f')]==='undefined'&&typeof _0x2888ce['limit']===_0x499b('0x20');var _0x3c01d6=_0x4f6663[_0x499b('0x21')];var _0x1d810f=_0x80e748?0x0:_0x2888ce[_0x499b('0x1f')];var _0x17a5aa=_0x80e748?_0x4f6663['count']:_0x2888ce['offset']+_0x2888ce[_0x499b('0x22')];var _0x1849ed;if(_0x17a5aa>=_0x3c01d6){_0x17a5aa=_0x3c01d6;_0x1849ed=0xc8;}else{_0x1849ed=0xce;}_0x186c7a[_0x499b('0x1c')](_0x1849ed);return _0x186c7a[_0x499b('0x23')](_0x499b('0x24'),_0x1d810f+'-'+_0x17a5aa+'/'+_0x3c01d6)['json'](_0x4f6663);}return null;};}function patchUpdates(_0x4895f0){return function(_0x50be4b){try{jsonpatch[_0x499b('0x25')](_0x50be4b,_0x4895f0,!![]);}catch(_0x51205f){return BPromise['reject'](_0x51205f);}return _0x50be4b[_0x499b('0x26')]();};}function saveUpdates(_0x28d649,_0x5d1d99){return function(_0x16f092){if(_0x16f092){return _0x16f092['update'](_0x28d649)[_0x499b('0x27')](function(_0x393319){return _0x393319;});}return null;};}function removeEntity(_0x127c05,_0x25c2c8){return function(_0x3ad9c0){if(_0x3ad9c0){return _0x3ad9c0[_0x499b('0x28')]()[_0x499b('0x27')](function(){_0x127c05[_0x499b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ad4e0,_0xe1f74e){return function(_0x5426ef){if(!_0x5426ef){_0x4ad4e0['sendStatus'](0x194);}return _0x5426ef;};}function handleError(_0xdb3a71,_0x42bfde){_0x42bfde=_0x42bfde||0x1f4;return function(_0x3e0eb0){logger[_0x499b('0x29')](_0x3e0eb0[_0x499b('0x2a')]);if(_0x3e0eb0[_0x499b('0x2b')]){delete _0x3e0eb0[_0x499b('0x2b')];}_0xdb3a71[_0x499b('0x1c')](_0x42bfde)[_0x499b('0x2c')](_0x3e0eb0);};}exports[_0x499b('0x2d')]=function(_0x57da47,_0x589d01){var _0x4092a5={},_0x2179bc={},_0x250fd8={'count':0x0,'rows':[]};var _0x53bf2b=_[_0x499b('0x2e')](db[_0x499b('0x2f')][_0x499b('0x30')],function(_0x32c7b5){return{'name':_0x32c7b5[_0x499b('0x31')],'type':_0x32c7b5['type'][_0x499b('0x32')]};});_0x2179bc['model']=_['map'](_0x53bf2b,_0x499b('0x2b'));_0x2179bc[_0x499b('0x33')]=_['keys'](_0x57da47[_0x499b('0x33')]);_0x2179bc[_0x499b('0x34')]=_['intersection'](_0x2179bc[_0x499b('0x35')],_0x2179bc[_0x499b('0x33')]);_0x4092a5['attributes']=_[_0x499b('0x36')](_0x2179bc['model'],qs[_0x499b('0x37')](_0x57da47[_0x499b('0x33')][_0x499b('0x37')]));_0x4092a5[_0x499b('0x38')]=_0x4092a5[_0x499b('0x38')][_0x499b('0x39')]?_0x4092a5['attributes']:_0x2179bc[_0x499b('0x35')];if(!_0x57da47[_0x499b('0x33')][_0x499b('0x3a')]('nolimit')){_0x4092a5[_0x499b('0x22')]=qs[_0x499b('0x22')](_0x57da47[_0x499b('0x33')][_0x499b('0x22')]);_0x4092a5[_0x499b('0x1f')]=qs['offset'](_0x57da47[_0x499b('0x33')][_0x499b('0x1f')]);}_0x4092a5[_0x499b('0x3b')]=qs['sort'](_0x57da47[_0x499b('0x33')]['sort']);_0x4092a5['where']=qs[_0x499b('0x34')](_['pick'](_0x57da47[_0x499b('0x33')],_0x2179bc[_0x499b('0x34')]),_0x53bf2b);if(_0x57da47[_0x499b('0x33')][_0x499b('0x3c')]){_0x4092a5['where']=_[_0x499b('0x3d')](_0x4092a5[_0x499b('0x3e')],{'$or':_[_0x499b('0x2e')](_0x53bf2b,function(_0x597cd1){if(_0x597cd1['type']!==_0x499b('0x3f')){var _0x4d04c2={};_0x4d04c2[_0x597cd1[_0x499b('0x2b')]]={'$like':'%'+_0x57da47[_0x499b('0x33')][_0x499b('0x3c')]+'%'};return _0x4d04c2;}})});}_0x4092a5=_[_0x499b('0x3d')]({},_0x4092a5,_0x57da47['options']);var _0x3dfa2c={'where':_0x4092a5['where']};return db[_0x499b('0x2f')][_0x499b('0x21')](_0x3dfa2c)[_0x499b('0x27')](function(_0x361441){_0x250fd8['count']=_0x361441;if(_0x57da47['query']['includeAll']){_0x4092a5[_0x499b('0x40')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x499b('0x41')](_0x4092a5);})['then'](function(_0x49c85b){_0x250fd8[_0x499b('0x42')]=_0x49c85b;return _0x250fd8;})[_0x499b('0x27')](respondWithFilteredResult(_0x589d01,_0x4092a5))[_0x499b('0x43')](handleError(_0x589d01,null));};exports[_0x499b('0x44')]=function(_0x5402a1,_0x40e87c){var _0x72cdbd={'raw':!![],'where':{'id':_0x5402a1['params']['id']}},_0x2aafdc={};_0x2aafdc[_0x499b('0x35')]=_[_0x499b('0x45')](db[_0x499b('0x2f')][_0x499b('0x30')]);_0x2aafdc[_0x499b('0x33')]=_[_0x499b('0x45')](_0x5402a1[_0x499b('0x33')]);_0x2aafdc[_0x499b('0x34')]=_['intersection'](_0x2aafdc[_0x499b('0x35')],_0x2aafdc[_0x499b('0x33')]);_0x72cdbd[_0x499b('0x38')]=_['intersection'](_0x2aafdc[_0x499b('0x35')],qs['fields'](_0x5402a1[_0x499b('0x33')]['fields']));_0x72cdbd[_0x499b('0x38')]=_0x72cdbd[_0x499b('0x38')][_0x499b('0x39')]?_0x72cdbd[_0x499b('0x38')]:_0x2aafdc[_0x499b('0x35')];if(_0x5402a1[_0x499b('0x33')][_0x499b('0x46')]){_0x72cdbd[_0x499b('0x40')]=[{'all':!![]}];}_0x72cdbd=_[_0x499b('0x3d')]({},_0x72cdbd,_0x5402a1[_0x499b('0x47')]);return db[_0x499b('0x2f')]['find'](_0x72cdbd)[_0x499b('0x27')](handleEntityNotFound(_0x40e87c,null))[_0x499b('0x27')](respondWithResult(_0x40e87c,null))[_0x499b('0x43')](handleError(_0x40e87c,null));};exports[_0x499b('0x48')]=function(_0x37f724,_0x525a40){return db[_0x499b('0x2f')][_0x499b('0x48')](_0x37f724[_0x499b('0x49')],{})[_0x499b('0x27')](respondWithResult(_0x525a40,0xc9))[_0x499b('0x43')](handleError(_0x525a40,null));};exports[_0x499b('0x4a')]=function(_0x3862ef,_0x54b046){if(_0x3862ef[_0x499b('0x49')]['id']){delete _0x3862ef['body']['id'];}return db[_0x499b('0x2f')][_0x499b('0x4b')]({'where':{'id':_0x3862ef['params']['id']}})[_0x499b('0x27')](handleEntityNotFound(_0x54b046,null))[_0x499b('0x27')](saveUpdates(_0x3862ef[_0x499b('0x49')],null))['then'](respondWithResult(_0x54b046,null))['catch'](handleError(_0x54b046,null));};exports[_0x499b('0x28')]=function(_0x158827,_0x24e94d){return db[_0x499b('0x2f')][_0x499b('0x4b')]({'where':{'id':_0x158827['params']['id']}})[_0x499b('0x27')](handleEntityNotFound(_0x24e94d,null))[_0x499b('0x27')](removeEntity(_0x24e94d,null))[_0x499b('0x43')](handleError(_0x24e94d,null));};exports[_0x499b('0x4c')]=function(_0x1f6a76,_0x444567){return db[_0x499b('0x2f')][_0x499b('0x4c')]()[_0x499b('0x27')](respondWithResult(_0x444567,null))[_0x499b('0x43')](handleError(_0x444567,null));};function wrapUser(_0x266e42){return function(_0x22eb0e){var _0x2482e8=_0x266e42[_0x499b('0x4d')]({'plain':!![]});_0x2482e8[_0x499b('0x4e')]=[];if(_0x22eb0e){_0x2482e8[_0x499b('0x4f')]=_0x22eb0e['createdAt'];_0x2482e8[_0x499b('0x50')]=_0x22eb0e;}else{_0x2482e8[_0x499b('0x4f')]=moment(0x0)[_0x499b('0x51')](_0x499b('0x52'));_0x2482e8[_0x499b('0x50')]={};}return _0x2482e8;};}exports['getUsers']=function(_0xdb5a75,_0x859de0,_0x2ea8ae){var _0x4f269f=[];return db[_0x499b('0x53')]['findAll']({'where':{'role':[_0x499b('0x54'),_0x499b('0x55'),_0x499b('0x56')]},'attributes':['id',_0x499b('0x57'),_0x499b('0x2b'),_0x499b('0x58'),_0x499b('0x59'),_0x499b('0x5a'),_0x499b('0x5b'),_0x499b('0x5c'),_0x499b('0x5d'),_0x499b('0x5e')],'order':qs[_0x499b('0x5f')](_0x499b('0x60')),'include':[{'model':db[_0x499b('0x61')],'as':_0x499b('0x62'),'attributes':['id',_0x499b('0x2b'),_0x499b('0x63')],'through':{'attributes':[]}}]})[_0x499b('0x27')](function(_0x88f88e){if(_0x88f88e){var _0x564c1d=_0xdb5a75[_0x499b('0x56')][_0x499b('0x4d')]({'plain':!![]});if(!_0x564c1d)throw new Error(_0x499b('0x64'));if(_0x564c1d[_0x499b('0x58')]===_0x499b('0x56')){return db[_0x499b('0x65')][_0x499b('0x4b')]({'where':{'name':_0x499b('0x66'),'userProfileId':_0x564c1d['userProfileId']},'raw':!![]})[_0x499b('0x27')](function(_0x33b7ed){if(_0x33b7ed){if(_0x33b7ed['autoAssociation']===0x0){return db['UserProfileResource'][_0x499b('0x41')]({'where':{'sectionId':_0x33b7ed['id']},'raw':!![]})['then'](function(_0x5ad65e){var _0x5b43ac=[];if(_['isEmpty'](_0x5ad65e)){_0x5b43ac=_[_0x499b('0x3c')](_0x88f88e,function(_0x39b541){if(_0x39b541[_0x499b('0x58')]!==_0x499b('0x54')){return _0x39b541;}});return _0x5b43ac;}else{for(var _0x2821f2=0x0;_0x2821f2<_0x88f88e['length'];_0x2821f2++){var _0x3387be=_0x88f88e[_0x2821f2];if(_0x3387be[_0x499b('0x58')]===_0x499b('0x54')){var _0x7daabc=_[_0x499b('0x4b')](_0x5ad65e,function(_0x1547c0){return _0x1547c0[_0x499b('0x67')]===_0x3387be['id'];});if(_0x7daabc)_0x5b43ac[_0x499b('0x68')](_0x3387be);}else{_0x5b43ac[_0x499b('0x68')](_0x3387be);}}return _0x5b43ac;}});}else{return _0x88f88e;}}else{var _0x4d1fba=_['filter'](_0x88f88e,function(_0x5c5d31){if(_0x5c5d31[_0x499b('0x58')]!==_0x499b('0x54')){return _0x5c5d31;}});return _0x4d1fba;}});}else{return _0x88f88e;}}})['then'](function(_0x4a27f5){var _0x137b9f=[];if(_0x4a27f5){_0x4f269f=_0x4a27f5;for(var _0x2c3c75=0x0;_0x2c3c75<_0x4a27f5[_0x499b('0x39')];_0x2c3c75+=0x1){_0x4f269f[_0x2c3c75][_0x499b('0x4e')]=[];_0x137b9f[_0x499b('0x68')](db[_0x499b('0x2f')][_0x499b('0x4b')]({'where':{'FromId':[_0xdb5a75[_0x499b('0x56')]['id'],_0x4a27f5[_0x2c3c75]['id']],'ToId':[_0xdb5a75[_0x499b('0x56')]['id'],_0x4a27f5[_0x2c3c75]['id']],'ChatGroupId':null},'attributes':['id',_0x499b('0x69'),_0x499b('0x6a'),_0x499b('0x6b'),_0x499b('0x6c'),_0x499b('0x49')],'order':qs[_0x499b('0x5f')](_0x499b('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x499b('0x27')](wrapUser(_0x4a27f5[_0x2c3c75])));}return BPromise[_0x499b('0x6e')](_0x137b9f);}return[];})[_0x499b('0x27')](function(_0xfdd162){return{'rows':_0xfdd162,'count':_0xfdd162[_0x499b('0x39')]};})['then'](respondWithResult(_0x859de0,null))[_0x499b('0x43')](handleError(_0x859de0,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index d046aa7..7c0272d 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 _0x4986=['ChatInternalMessage','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x15ff05,_0x511cd1){var _0x122d05=function(_0x3f7228){while(--_0x3f7228){_0x15ff05['push'](_0x15ff05['shift']());}};_0x122d05(++_0x511cd1);}(_0x4986,0x6e));var _0x6498=function(_0x4efd98,_0x58803e){_0x4efd98=_0x4efd98-0x0;var _0x316929=_0x4986[_0x4efd98];return _0x316929;};'use strict';var EventEmitter=require(_0x6498('0x0'));var ChatInternalMessage=require(_0x6498('0x1'))['db'][_0x6498('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6498('0x3'),'afterDestroy':_0x6498('0x4')};function emitEvent(_0x5d24c6){return function(_0x15e8d3,_0x12a6fb,_0x2c54ee){ChatInternalMessageEvents[_0x6498('0x5')](_0x5d24c6+':'+_0x15e8d3['id'],_0x15e8d3);ChatInternalMessageEvents[_0x6498('0x5')](_0x5d24c6,_0x15e8d3);_0x2c54ee(null);};}for(var e in events){if(events[_0x6498('0x6')](e)){var event=events[e];ChatInternalMessage[_0x6498('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x7dfd=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd7df('0x0'));var ChatInternalMessage=require(_0xd7df('0x1'))['db'][_0xd7df('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd7df('0x3')](0x0);var events={'afterCreate':_0xd7df('0x4'),'afterUpdate':_0xd7df('0x5'),'afterDestroy':_0xd7df('0x6')};function emitEvent(_0x38eee7){return function(_0x3ef231,_0x3d8c5a,_0x65a0b6){ChatInternalMessageEvents[_0xd7df('0x7')](_0x38eee7+':'+_0x3ef231['id'],_0x3ef231);ChatInternalMessageEvents[_0xd7df('0x7')](_0x38eee7,_0x3ef231);_0x65a0b6(null);};}for(var e in events){if(events[_0xd7df('0x8')](e)){var event=events[e];ChatInternalMessage[_0xd7df('0x9')](e,emitEvent(event));}}module[_0xd7df('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 632a080..e106500 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 _0xd8b0=['define','chat_internal_messages','utf8mb4','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa99b40,_0x54bfe9){var _0x375b72=function(_0x5958e7){while(--_0x5958e7){_0xa99b40['push'](_0xa99b40['shift']());}};_0x375b72(++_0x54bfe9);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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('./chatInternalMessage.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d8b('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa9e0=['define','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index c20d266..b58093c 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 _0x8852=['request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x37d61c,_0x42b68b){var _0x303976=function(_0x56d73a){while(--_0x56d73a){_0x37d61c['push'](_0x37d61c['shift']());}};_0x303976(++_0x42b68b);}(_0x8852,0x1ec));var _0x2885=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x8852[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require(_0x2885('0x0'));var moment=require(_0x2885('0x1'));var BPromise=require(_0x2885('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2885('0x3'));var db=require(_0x2885('0x4'))['db'];var utils=require(_0x2885('0x5'));var logger=require('../../config/logger')(_0x2885('0x6'));var config=require(_0x2885('0x7'));var jayson=require(_0x2885('0x8'));var client=jayson[_0x2885('0x9')][_0x2885('0xa')]({'port':0x232a});config[_0x2885('0xb')]=_['defaults'](config['redis'],{'host':_0x2885('0xc'),'port':0x18eb});var socket=require(_0x2885('0xd'))(new Redis(config['redis']));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4e3501,_0xef085f,_0x445ade){return new BPromise(function(_0x3fb755,_0x31dda3){return client[_0x2885('0xe')](_0x4e3501,_0x445ade)['then'](function(_0x5a10fa){logger['info'](_0x2885('0xf'),_0xef085f,_0x2885('0x10'));logger[_0x2885('0x11')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xef085f,_0x2885('0x10'),JSON['stringify'](_0x5a10fa));if(_0x5a10fa[_0x2885('0x12')]){if(_0x5a10fa[_0x2885('0x12')]['code']===0x1f4){logger['error'](_0x2885('0xf'),_0xef085f,_0x5a10fa[_0x2885('0x12')]['message']);return _0x31dda3(_0x5a10fa[_0x2885('0x12')][_0x2885('0x13')]);}logger[_0x2885('0x12')](_0x2885('0xf'),_0xef085f,_0x5a10fa[_0x2885('0x12')]['message']);return _0x3fb755(_0x5a10fa[_0x2885('0x12')][_0x2885('0x13')]);}else{logger[_0x2885('0x14')](_0x2885('0xf'),_0xef085f,_0x2885('0x10'));_0x3fb755(_0x5a10fa[_0x2885('0x15')][_0x2885('0x13')]);}})['catch'](function(_0x3cc72c){logger[_0x2885('0x12')](_0x2885('0xf'),_0xef085f,_0x3cc72c);_0x31dda3(_0x3cc72c);});});} \ No newline at end of file +var _0xdb6a=['client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4d0a90,_0x45ae29){var _0x12680c=function(_0x31d9b2){while(--_0x31d9b2){_0x4d0a90['push'](_0x4d0a90['shift']());}};_0x12680c(++_0x45ae29);}(_0xdb6a,0x117));var _0xadb6=function(_0x43fa5f,_0x57aca7){_0x43fa5f=_0x43fa5f-0x0;var _0x3a6607=_0xdb6a[_0x43fa5f];return _0x3a6607;};'use strict';var _=require(_0xadb6('0x0'));var util=require(_0xadb6('0x1'));var moment=require('moment');var BPromise=require(_0xadb6('0x2'));var rs=require(_0xadb6('0x3'));var fs=require('fs');var Redis=require(_0xadb6('0x4'));var db=require(_0xadb6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xadb6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xadb6('0x7')][_0xadb6('0x8')]({'port':0x232a});config[_0xadb6('0x9')]=_[_0xadb6('0xa')](config[_0xadb6('0x9')],{'host':_0xadb6('0xb'),'port':0x18eb});var socket=require(_0xadb6('0xc'))(new Redis(config[_0xadb6('0x9')]));require(_0xadb6('0xd'))[_0xadb6('0xe')](socket);function respondWithRpcPromise(_0x51cce6,_0xadd202,_0x4ca9be){return new BPromise(function(_0x410404,_0x323e8a){return client[_0xadb6('0xf')](_0x51cce6,_0x4ca9be)['then'](function(_0x50973e){logger[_0xadb6('0x10')](_0xadb6('0x11'),_0xadd202,_0xadb6('0x12'));logger[_0xadb6('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xadd202,_0xadb6('0x12'),JSON[_0xadb6('0x14')](_0x50973e));if(_0x50973e[_0xadb6('0x15')]){if(_0x50973e[_0xadb6('0x15')][_0xadb6('0x16')]===0x1f4){logger[_0xadb6('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0xadd202,_0x50973e[_0xadb6('0x15')][_0xadb6('0x17')]);return _0x323e8a(_0x50973e[_0xadb6('0x15')]['message']);}logger[_0xadb6('0x15')](_0xadb6('0x11'),_0xadd202,_0x50973e[_0xadb6('0x15')][_0xadb6('0x17')]);return _0x410404(_0x50973e[_0xadb6('0x15')][_0xadb6('0x17')]);}else{logger[_0xadb6('0x10')](_0xadb6('0x11'),_0xadd202,_0xadb6('0x12'));_0x410404(_0x50973e[_0xadb6('0x18')][_0xadb6('0x17')]);}})[_0xadb6('0x19')](function(_0x49ce07){logger[_0xadb6('0x15')](_0xadb6('0x11'),_0xadd202,_0x49ce07);_0x323e8a(_0x49ce07);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 7325014..e935921 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 _0x495e=['chatInternalMessage:','./chatInternalMessage.events','update','removeListener','register'];(function(_0x42ebba,_0x4cbf87){var _0x3fd2af=function(_0x26d999){while(--_0x26d999){_0x42ebba['push'](_0x42ebba['shift']());}};_0x3fd2af(++_0x4cbf87);}(_0x495e,0xfb));var _0xe495=function(_0xcceb4e,_0x16b9cd){_0xcceb4e=_0xcceb4e-0x0;var _0x458bda=_0x495e[_0xcceb4e];return _0x458bda;};'use strict';var ChatInternalMessageEvents=require(_0xe495('0x0'));var events=['save','remove',_0xe495('0x1')];function createListener(_0x37c8ad,_0x3fe3a3){return function(_0x2c85b8){_0x3fe3a3['emit'](_0x37c8ad,_0x2c85b8);};}function removeListener(_0x3f119c,_0x442101){return function(){ChatInternalMessageEvents[_0xe495('0x2')](_0x3f119c,_0x442101);};}exports[_0xe495('0x3')]=function(_0x130db3){for(var _0x467a69=0x0,_0x101a7e=events['length'];_0x467a69<_0x101a7e;_0x467a69++){var _0x599ab4=events[_0x467a69];var _0x5c17d0=createListener(_0xe495('0x4')+_0x599ab4,_0x130db3);ChatInternalMessageEvents['on'](_0x599ab4,_0x5c17d0);}}; \ No newline at end of file +var _0x9224=['update','removeListener','length','save','remove'];(function(_0x574ce3,_0x59eef4){var _0x3447a0=function(_0x27f8cb){while(--_0x27f8cb){_0x574ce3['push'](_0x574ce3['shift']());}};_0x3447a0(++_0x59eef4);}(_0x9224,0xa3));var _0x4922=function(_0x1423c1,_0x47b7a5){_0x1423c1=_0x1423c1-0x0;var _0x383ee2=_0x9224[_0x1423c1];return _0x383ee2;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x4922('0x0'),_0x4922('0x1'),_0x4922('0x2')];function createListener(_0x472129,_0x3517a1){return function(_0x3c8757){_0x3517a1['emit'](_0x472129,_0x3c8757);};}function removeListener(_0x582640,_0x572f8f){return function(){ChatInternalMessageEvents[_0x4922('0x3')](_0x582640,_0x572f8f);};}exports['register']=function(_0x12601a){for(var _0x1b7fc7=0x0,_0x4216c0=events[_0x4922('0x4')];_0x1b7fc7<_0x4216c0;_0x1b7fc7++){var _0x7a8bd1=events[_0x1b7fc7];var _0x245562=createListener('chatInternalMessage:'+_0x7a8bd1,_0x12601a);ChatInternalMessageEvents['on'](_0x7a8bd1,_0x245562);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index f30872f..1d0278a 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 _0x62ad=['/users','getUsers','/:id','post','create','put','update','destroy','multer','util','express','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3b3ebc,_0x5a07e3){var _0x35140f=function(_0x1b1a01){while(--_0x1b1a01){_0x3b3ebc['push'](_0x3b3ebc['shift']());}};_0x35140f(++_0x5a07e3);}(_0x62ad,0x134));var _0xd62a=function(_0x3da8af,_0x86b4a0){_0x3da8af=_0x3da8af-0x0;var _0x30ee41=_0x62ad[_0x3da8af];return _0x30ee41;};'use strict';var multer=require(_0xd62a('0x0'));var util=require(_0xd62a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd62a('0x2'));var router=express[_0xd62a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd62a('0x4'));var config=require(_0xd62a('0x5'));var controller=require(_0xd62a('0x6'));router[_0xd62a('0x7')]('/',auth[_0xd62a('0x8')](),controller[_0xd62a('0x9')]);router['get'](_0xd62a('0xa'),auth[_0xd62a('0x8')](),controller[_0xd62a('0xb')]);router['get'](_0xd62a('0xc'),auth[_0xd62a('0x8')](),controller[_0xd62a('0xd')]);router['get'](_0xd62a('0xe'),auth[_0xd62a('0x8')](),controller['show']);router[_0xd62a('0xf')]('/',auth['isAuthenticated'](),controller[_0xd62a('0x10')]);router[_0xd62a('0x11')](_0xd62a('0xe'),controller[_0xd62a('0x12')]);router['delete'](_0xd62a('0xe'),auth['isAuthenticated'](),controller[_0xd62a('0x13')]);module['exports']=router; \ No newline at end of file +var _0xdbce=['get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','put','update','delete','multer','path','express','Router','fs-extra','../../components/auth/service','./chatInternalMessage.controller'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdbce,0x1f1));var _0xedbc=function(_0x185d0b,_0x168fee){_0x185d0b=_0x185d0b-0x0;var _0x5d0950=_0xdbce[_0x185d0b];return _0x5d0950;};'use strict';var multer=require(_0xedbc('0x0'));var util=require('util');var path=require(_0xedbc('0x1'));var timeout=require('connect-timeout');var express=require(_0xedbc('0x2'));var router=express[_0xedbc('0x3')]();var fs_extra=require(_0xedbc('0x4'));var auth=require(_0xedbc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xedbc('0x6'));router[_0xedbc('0x7')]('/',auth[_0xedbc('0x8')](),controller[_0xedbc('0x9')]);router[_0xedbc('0x7')](_0xedbc('0xa'),auth[_0xedbc('0x8')](),controller[_0xedbc('0xb')]);router['get'](_0xedbc('0xc'),auth[_0xedbc('0x8')](),controller[_0xedbc('0xd')]);router[_0xedbc('0x7')](_0xedbc('0xe'),auth[_0xedbc('0x8')](),controller[_0xedbc('0xf')]);router[_0xedbc('0x10')]('/',auth[_0xedbc('0x8')](),controller[_0xedbc('0x11')]);router[_0xedbc('0x12')](_0xedbc('0xe'),controller[_0xedbc('0x13')]);router[_0xedbc('0x14')](_0xedbc('0xe'),auth[_0xedbc('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index e4d8940..2941272 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 _0xd162=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x5f0be2,_0x469143){var _0x468a21=function(_0x1d29c9){while(--_0x1d29c9){_0x5f0be2['push'](_0x5f0be2['shift']());}};_0x468a21(++_0x469143);}(_0xd162,0x19d));var _0x2d16=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0xd162[_0x3be7ff];return _0x186721;};'use strict';var Sequelize=require(_0x2d16('0x0'));module[_0x2d16('0x1')]={'body':{'type':Sequelize[_0x2d16('0x2')](_0x2d16('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2d16('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x2d16('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2d16('0x5')]('in',_0x2d16('0x6')),'defaultValue':_0x2d16('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2d16('0x7')]},'providerName':{'type':Sequelize[_0x2d16('0x8')]},'providerResponse':{'type':Sequelize[_0x2d16('0x2')]}}; \ No newline at end of file +var _0x64b9=['medium','DATE','TEXT','exports'];(function(_0x2e5bac,_0x4c523f){var _0x4b06b4=function(_0x14b763){while(--_0x14b763){_0x2e5bac['push'](_0x2e5bac['shift']());}};_0x4b06b4(++_0x4c523f);}(_0x64b9,0x103));var _0x964b=function(_0xc79f79,_0x5ecfbf){_0xc79f79=_0xc79f79-0x0;var _0x4c4134=_0x64b9[_0xc79f79];return _0x4c4134;};'use strict';var Sequelize=require('sequelize');module[_0x964b('0x0')]={'body':{'type':Sequelize['TEXT'](_0x964b('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x964b('0x2')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x964b('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 026ea86..7837696 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 _0x947a=['agent','CmContact','Contact','get','ChatInteraction','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','cf_','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','manual','interface','format','SIP/%s','channel','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','startsWith','push','event','rejectmessage','eml-format','rimraf','moment','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','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','includeAll','options','find','create','body','params','destroy','describe','chat-interactions','accept','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user'];(function(_0x1f89e9,_0x1d6560){var _0x4a3de0=function(_0x19ff26){while(--_0x19ff26){_0x1f89e9['push'](_0x1f89e9['shift']());}};_0x4a3de0(++_0x1d6560);}(_0x947a,0xa8));var _0xa947=function(_0x156696,_0x3a9a2e){_0x156696=_0x156696-0x0;var _0x5ab7c4=_0x947a[_0x156696];return _0x5ab7c4;};'use strict';var emlformat=require(_0xa947('0x0'));var rimraf=require(_0xa947('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa947('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa947('0x3'));var sox=require(_0xa947('0x4'));var csv=require(_0xa947('0x5'));var ejs=require(_0xa947('0x6'));var fs=require('fs');var fs_extra=require(_0xa947('0x7'));var _=require(_0xa947('0x8'));var squel=require(_0xa947('0x9'));var crypto=require(_0xa947('0xa'));var jsforce=require(_0xa947('0xb'));var deskjs=require(_0xa947('0xc'));var toCsv=require(_0xa947('0x5'));var querystring=require(_0xa947('0xd'));var Papa=require(_0xa947('0xe'));var Redis=require(_0xa947('0xf'));var authService=require(_0xa947('0x10'));var qs=require(_0xa947('0x11'));var as=require(_0xa947('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa947('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa947('0x14'));var db=require(_0xa947('0x15'))['db'];config['redis']=_['defaults'](config[_0xa947('0x16')],{'host':_0xa947('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa947('0x16')]));require('./chatMessage.socket')[_0xa947('0x18')](socket);var jayson=require(_0xa947('0x19'));var client=jayson[_0xa947('0x1a')][_0xa947('0x1b')]({'port':0x232c});var client9002=jayson[_0xa947('0x1a')][_0xa947('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2727df,_0x2f0b24,_0x2c3b7f,_0x22a2a6){return new BPromise(function(_0x26b518,_0x2184ed){var _0x24b541=_0x22a2a6||client;return _0x24b541[_0xa947('0x1c')](_0x2727df,_0x2c3b7f)['then'](function(_0x2f9b38){logger[_0xa947('0x1d')](_0xa947('0x1e'),_0x2f0b24,'request\x20sent');logger['debug'](_0xa947('0x1f'),_0x2f0b24,'request\x20sent',JSON[_0xa947('0x20')](_0x2f9b38));if(_0x2f9b38[_0xa947('0x21')]){if(_0x2f9b38[_0xa947('0x21')][_0xa947('0x22')]===0x1f4){logger[_0xa947('0x21')](_0xa947('0x1e'),_0x2f0b24,_0x2f9b38[_0xa947('0x21')][_0xa947('0x23')]);return _0x2184ed(_0x2f9b38[_0xa947('0x21')][_0xa947('0x23')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x2f0b24,_0x2f9b38[_0xa947('0x21')]['message']);return _0x26b518(_0x2f9b38[_0xa947('0x21')][_0xa947('0x23')]);}else{logger['info'](_0xa947('0x1e'),_0x2f0b24,'request\x20sent');_0x26b518(_0x2f9b38[_0xa947('0x24')]['message']);}})[_0xa947('0x25')](function(_0x4ac443){logger[_0xa947('0x21')](_0xa947('0x1e'),_0x2f0b24,_0x4ac443);_0x2184ed(_0x4ac443);});});}function respondWithStatusCode(_0x1dab53,_0x1a11ec){_0x1a11ec=_0x1a11ec||0xcc;return function(_0x1187f4){if(_0x1187f4){return _0x1dab53[_0xa947('0x26')](_0x1a11ec);}return _0x1dab53[_0xa947('0x27')](_0x1a11ec)[_0xa947('0x28')]();};}function respondWithResult(_0x56de7b,_0x6cb4c){_0x6cb4c=_0x6cb4c||0xc8;return function(_0x6fc1be){if(_0x6fc1be){return _0x56de7b[_0xa947('0x27')](_0x6cb4c)[_0xa947('0x29')](_0x6fc1be);}};}function respondWithFilteredResult(_0x3ded23,_0x3066b1){return function(_0x193a02){if(_0x193a02){var _0x1c99a0=typeof _0x3066b1['offset']===_0xa947('0x2a')&&typeof _0x3066b1[_0xa947('0x2b')]===_0xa947('0x2a');var _0x3ab3c8=_0x193a02[_0xa947('0x2c')];var _0xdd201f=_0x1c99a0?0x0:_0x3066b1[_0xa947('0x2d')];var _0x40b74f=_0x1c99a0?_0x193a02[_0xa947('0x2c')]:_0x3066b1['offset']+_0x3066b1[_0xa947('0x2b')];var _0x354c80;if(_0x40b74f>=_0x3ab3c8){_0x40b74f=_0x3ab3c8;_0x354c80=0xc8;}else{_0x354c80=0xce;}_0x3ded23[_0xa947('0x27')](_0x354c80);return _0x3ded23[_0xa947('0x2e')](_0xa947('0x2f'),_0xdd201f+'-'+_0x40b74f+'/'+_0x3ab3c8)['json'](_0x193a02);}return null;};}function patchUpdates(_0x43bfb3){return function(_0x51d70d){try{jsonpatch[_0xa947('0x30')](_0x51d70d,_0x43bfb3,!![]);}catch(_0x40fc16){return BPromise[_0xa947('0x31')](_0x40fc16);}return _0x51d70d[_0xa947('0x32')]();};}function saveUpdates(_0x285d28,_0x579081){return function(_0x4d716e){if(_0x4d716e){return _0x4d716e[_0xa947('0x33')](_0x285d28)[_0xa947('0x34')](function(_0x1d9294){return _0x1d9294;});}return null;};}function removeEntity(_0x448b42,_0x52888d){return function(_0x61206e){if(_0x61206e){return _0x61206e['destroy']()[_0xa947('0x34')](function(){_0x448b42['status'](0xcc)[_0xa947('0x28')]();});}};}function handleEntityNotFound(_0x3f0f92,_0x1c24ce){return function(_0x514fab){if(!_0x514fab){_0x3f0f92['sendStatus'](0x194);}return _0x514fab;};}function handleError(_0x2ac683,_0xb91ce2){_0xb91ce2=_0xb91ce2||0x1f4;return function(_0x1dec03){logger['error'](_0x1dec03[_0xa947('0x35')]);if(_0x1dec03[_0xa947('0x36')]){delete _0x1dec03['name'];}_0x2ac683[_0xa947('0x27')](_0xb91ce2)[_0xa947('0x37')](_0x1dec03);};}exports['index']=function(_0x5e803f,_0x4c3316){var _0x367e22={},_0x20662a={},_0x5bf744={'count':0x0,'rows':[]};var _0x1ac069=_[_0xa947('0x38')](db[_0xa947('0x39')][_0xa947('0x3a')],function(_0x3ca29c){return{'name':_0x3ca29c[_0xa947('0x3b')],'type':_0x3ca29c[_0xa947('0x3c')][_0xa947('0x3d')]};});_0x20662a['model']=_[_0xa947('0x38')](_0x1ac069,_0xa947('0x36'));_0x20662a[_0xa947('0x3e')]=_[_0xa947('0x3f')](_0x5e803f[_0xa947('0x3e')]);_0x20662a[_0xa947('0x40')]=_[_0xa947('0x41')](_0x20662a[_0xa947('0x42')],_0x20662a[_0xa947('0x3e')]);_0x367e22[_0xa947('0x43')]=_[_0xa947('0x41')](_0x20662a[_0xa947('0x42')],qs[_0xa947('0x44')](_0x5e803f[_0xa947('0x3e')][_0xa947('0x44')]));_0x367e22[_0xa947('0x43')]=_0x367e22[_0xa947('0x43')][_0xa947('0x45')]?_0x367e22['attributes']:_0x20662a[_0xa947('0x42')];if(!_0x5e803f['query']['hasOwnProperty'](_0xa947('0x46'))){_0x367e22[_0xa947('0x2b')]=qs[_0xa947('0x2b')](_0x5e803f[_0xa947('0x3e')][_0xa947('0x2b')]);_0x367e22[_0xa947('0x2d')]=qs['offset'](_0x5e803f[_0xa947('0x3e')][_0xa947('0x2d')]);}_0x367e22[_0xa947('0x47')]=qs[_0xa947('0x48')](_0x5e803f[_0xa947('0x3e')][_0xa947('0x48')]);_0x367e22[_0xa947('0x49')]=qs[_0xa947('0x40')](_[_0xa947('0x4a')](_0x5e803f['query'],_0x20662a[_0xa947('0x40')]),_0x1ac069);if(_0x5e803f[_0xa947('0x3e')]['filter']){_0x367e22[_0xa947('0x49')]=_[_0xa947('0x4b')](_0x367e22[_0xa947('0x49')],{'$or':_[_0xa947('0x38')](_0x1ac069,function(_0x2bdb4c){if(_0x2bdb4c[_0xa947('0x3c')]!==_0xa947('0x4c')){var _0x5234f9={};_0x5234f9[_0x2bdb4c['name']]={'$like':'%'+_0x5e803f['query'][_0xa947('0x4d')]+'%'};return _0x5234f9;}})});}_0x367e22=_[_0xa947('0x4b')]({},_0x367e22,_0x5e803f['options']);var _0x1b9cd7={'where':_0x367e22[_0xa947('0x49')]};return db['ChatMessage'][_0xa947('0x2c')](_0x1b9cd7)[_0xa947('0x34')](function(_0x48b7c8){_0x5bf744[_0xa947('0x2c')]=_0x48b7c8;if(_0x5e803f[_0xa947('0x3e')]['includeAll']){_0x367e22[_0xa947('0x4e')]=[{'all':!![]}];}return db[_0xa947('0x39')][_0xa947('0x4f')](_0x367e22);})[_0xa947('0x34')](function(_0x3feb8a){_0x5bf744[_0xa947('0x50')]=_0x3feb8a;return _0x5bf744;})[_0xa947('0x34')](respondWithFilteredResult(_0x4c3316,_0x367e22))[_0xa947('0x25')](handleError(_0x4c3316,null));};exports['show']=function(_0x1387ac,_0x42d5ce){var _0x3c2203={'raw':!![],'where':{'id':_0x1387ac['params']['id']}},_0x541c9d={};_0x541c9d[_0xa947('0x42')]=_[_0xa947('0x3f')](db[_0xa947('0x39')][_0xa947('0x3a')]);_0x541c9d['query']=_[_0xa947('0x3f')](_0x1387ac[_0xa947('0x3e')]);_0x541c9d[_0xa947('0x40')]=_[_0xa947('0x41')](_0x541c9d[_0xa947('0x42')],_0x541c9d[_0xa947('0x3e')]);_0x3c2203[_0xa947('0x43')]=_[_0xa947('0x41')](_0x541c9d[_0xa947('0x42')],qs[_0xa947('0x44')](_0x1387ac[_0xa947('0x3e')][_0xa947('0x44')]));_0x3c2203[_0xa947('0x43')]=_0x3c2203['attributes'][_0xa947('0x45')]?_0x3c2203[_0xa947('0x43')]:_0x541c9d[_0xa947('0x42')];if(_0x1387ac['query'][_0xa947('0x51')]){_0x3c2203[_0xa947('0x4e')]=[{'all':!![]}];}_0x3c2203=_[_0xa947('0x4b')]({},_0x3c2203,_0x1387ac[_0xa947('0x52')]);return db[_0xa947('0x39')][_0xa947('0x53')](_0x3c2203)[_0xa947('0x34')](handleEntityNotFound(_0x42d5ce,null))['then'](respondWithResult(_0x42d5ce,null))[_0xa947('0x25')](handleError(_0x42d5ce,null));};exports[_0xa947('0x54')]=function(_0x1f842a,_0x5a6086){return db[_0xa947('0x39')]['create'](_0x1f842a[_0xa947('0x55')],{})[_0xa947('0x34')](respondWithResult(_0x5a6086,0xc9))['catch'](handleError(_0x5a6086,null));};exports[_0xa947('0x33')]=function(_0x51dce4,_0x29cc56){if(_0x51dce4['body']['id']){delete _0x51dce4[_0xa947('0x55')]['id'];}return db['ChatMessage'][_0xa947('0x53')]({'where':{'id':_0x51dce4[_0xa947('0x56')]['id']}})['then'](handleEntityNotFound(_0x29cc56,null))[_0xa947('0x34')](saveUpdates(_0x51dce4[_0xa947('0x55')],null))[_0xa947('0x34')](respondWithResult(_0x29cc56,null))['catch'](handleError(_0x29cc56,null));};exports[_0xa947('0x57')]=function(_0x559deb,_0x4e101c){return db[_0xa947('0x39')]['find']({'where':{'id':_0x559deb['params']['id']}})['then'](handleEntityNotFound(_0x4e101c,null))[_0xa947('0x34')](removeEntity(_0x4e101c,null))['catch'](handleError(_0x4e101c,null));};exports['describe']=function(_0x3e8246,_0x256c9d){return db['ChatMessage'][_0xa947('0x58')]()[_0xa947('0x34')](respondWithResult(_0x256c9d,null))[_0xa947('0x25')](handleError(_0x256c9d,null));};var interaction_log=require(_0xa947('0x13'))(_0xa947('0x59'));exports[_0xa947('0x5a')]=function(_0x20e2c3,_0x168166,_0xcbe30c){var _0x552877={'agent':{},'channel':_0xa947('0x5b')};if(_0x20e2c3[_0xa947('0x55')]['id']){delete _0x20e2c3[_0xa947('0x55')]['id'];}_0x20e2c3[_0xa947('0x55')]['read']=!![];_0x20e2c3['body'][_0xa947('0x5c')]=moment()['format'](_0xa947('0x5d'));_0x20e2c3[_0xa947('0x55')][_0xa947('0x5e')]=_0x20e2c3[_0xa947('0x55')][_0xa947('0x5e')]||_0x20e2c3[_0xa947('0x5f')]['id'];_0x552877[_0xa947('0x60')]['id']=_0x20e2c3[_0xa947('0x55')][_0xa947('0x5e')];return db[_0xa947('0x39')][_0xa947('0x53')]({'where':{'id':_0x20e2c3[_0xa947('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xa947('0x61')],'as':_0xa947('0x62')}]})['then'](handleEntityNotFound(_0x168166,null))[_0xa947('0x34')](saveUpdates(_0x20e2c3[_0xa947('0x55')],null))[_0xa947('0x34')](function(_0x3cae97){if(_0x3cae97){_0x552877[_0xa947('0x23')]=_0x3cae97[_0xa947('0x63')]({'plain':!![]});return db[_0xa947('0x64')][_0xa947('0x53')]({'where':{'id':_0x3cae97['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x168166,null))[_0xa947('0x34')](function(_0x1fcdcd){if(_0x1fcdcd){return _0x1fcdcd['update']({'UserId':_0x20e2c3[_0xa947('0x55')][_0xa947('0x5e')],'read1stAt':_[_0xa947('0x65')](_0x1fcdcd[_0xa947('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x2caa19){if(_0x2caa19){_0x552877[_0xa947('0x67')]=_0x2caa19[_0xa947('0x63')]({'plain':!![]});interaction_log['info'](_0xa947('0x68'),_0x20e2c3[_0xa947('0x5f')]['id'],_0x20e2c3[_0xa947('0x5f')][_0xa947('0x36')],_0x20e2c3[_0xa947('0x5f')][_0xa947('0x69')],_0x552877['interaction']['id'],_0x20e2c3['body']?JSON[_0xa947('0x20')](_0x20e2c3[_0xa947('0x55')]):_0xa947('0x6a'));return respondWithRpcPromise(_0xa947('0x6b'),_0xa947('0x6c'),_0x552877);}return null;})[_0xa947('0x34')](function(_0x238e29){return db['CmContact'][_0xa947('0x58')]()['then'](function(_0x176974){var _0x3562a0=[];for(var _0x2db4f8=0x0;_0x2db4f8=_0x21a23a){_0x1814e4=_0x21a23a;_0x4751d4=0xc8;}else{_0x4751d4=0xce;}_0x38e7a4[_0xa73d('0x2c')](_0x4751d4);return _0x38e7a4[_0xa73d('0x33')](_0xa73d('0x34'),_0xaf457b+'-'+_0x1814e4+'/'+_0x21a23a)['json'](_0x543d1e);}return null;};}function patchUpdates(_0x5b70c6){return function(_0x19d090){try{jsonpatch[_0xa73d('0x35')](_0x19d090,_0x5b70c6,!![]);}catch(_0x9bc8bd){return BPromise[_0xa73d('0x36')](_0x9bc8bd);}return _0x19d090[_0xa73d('0x37')]();};}function saveUpdates(_0x221757,_0x50508f){return function(_0x2b8833){if(_0x2b8833){return _0x2b8833['update'](_0x221757)[_0xa73d('0x21')](function(_0x550087){return _0x550087;});}return null;};}function removeEntity(_0x4e324a,_0x56307e){return function(_0x2d060c){if(_0x2d060c){return _0x2d060c['destroy']()[_0xa73d('0x21')](function(){_0x4e324a[_0xa73d('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbc8151,_0x203e8f){return function(_0x72a0c8){if(!_0x72a0c8){_0xbc8151['sendStatus'](0x194);}return _0x72a0c8;};}function handleError(_0x225b7e,_0x14cca3){_0x14cca3=_0x14cca3||0x1f4;return function(_0x228a88){logger[_0xa73d('0x26')](_0x228a88[_0xa73d('0x38')]);if(_0x228a88[_0xa73d('0x39')]){delete _0x228a88['name'];}_0x225b7e[_0xa73d('0x2c')](_0x14cca3)[_0xa73d('0x3a')](_0x228a88);};}exports[_0xa73d('0x3b')]=function(_0x3c55c0,_0x42be1f){var _0x255b8e={},_0x15ebfe={},_0x3bdf00={'count':0x0,'rows':[]};var _0x132d00=_[_0xa73d('0x3c')](db['ChatMessage'][_0xa73d('0x3d')],function(_0xf85e7c){return{'name':_0xf85e7c[_0xa73d('0x3e')],'type':_0xf85e7c[_0xa73d('0x3f')][_0xa73d('0x40')]};});_0x15ebfe[_0xa73d('0x41')]=_[_0xa73d('0x3c')](_0x132d00,_0xa73d('0x39'));_0x15ebfe[_0xa73d('0x42')]=_[_0xa73d('0x43')](_0x3c55c0['query']);_0x15ebfe[_0xa73d('0x44')]=_[_0xa73d('0x45')](_0x15ebfe[_0xa73d('0x41')],_0x15ebfe[_0xa73d('0x42')]);_0x255b8e[_0xa73d('0x46')]=_['intersection'](_0x15ebfe[_0xa73d('0x41')],qs[_0xa73d('0x47')](_0x3c55c0[_0xa73d('0x42')]['fields']));_0x255b8e['attributes']=_0x255b8e['attributes'][_0xa73d('0x48')]?_0x255b8e['attributes']:_0x15ebfe[_0xa73d('0x41')];if(!_0x3c55c0[_0xa73d('0x42')]['hasOwnProperty'](_0xa73d('0x49'))){_0x255b8e[_0xa73d('0x31')]=qs['limit'](_0x3c55c0['query'][_0xa73d('0x31')]);_0x255b8e[_0xa73d('0x2f')]=qs[_0xa73d('0x2f')](_0x3c55c0[_0xa73d('0x42')][_0xa73d('0x2f')]);}_0x255b8e['order']=qs['sort'](_0x3c55c0[_0xa73d('0x42')][_0xa73d('0x4a')]);_0x255b8e['where']=qs[_0xa73d('0x44')](_[_0xa73d('0x4b')](_0x3c55c0[_0xa73d('0x42')],_0x15ebfe[_0xa73d('0x44')]),_0x132d00);if(_0x3c55c0[_0xa73d('0x42')][_0xa73d('0x4c')]){_0x255b8e[_0xa73d('0x4d')]=_[_0xa73d('0x4e')](_0x255b8e['where'],{'$or':_[_0xa73d('0x3c')](_0x132d00,function(_0x1f22f6){if(_0x1f22f6[_0xa73d('0x3f')]!==_0xa73d('0x4f')){var _0x3c3212={};_0x3c3212[_0x1f22f6[_0xa73d('0x39')]]={'$like':'%'+_0x3c55c0['query']['filter']+'%'};return _0x3c3212;}})});}_0x255b8e=_[_0xa73d('0x4e')]({},_0x255b8e,_0x3c55c0[_0xa73d('0x50')]);var _0x40d6c4={'where':_0x255b8e[_0xa73d('0x4d')]};return db['ChatMessage'][_0xa73d('0x32')](_0x40d6c4)[_0xa73d('0x21')](function(_0x549777){_0x3bdf00[_0xa73d('0x32')]=_0x549777;if(_0x3c55c0[_0xa73d('0x42')][_0xa73d('0x51')]){_0x255b8e['include']=[{'all':!![]}];}return db[_0xa73d('0x52')]['findAll'](_0x255b8e);})['then'](function(_0x5ef34c){_0x3bdf00[_0xa73d('0x53')]=_0x5ef34c;return _0x3bdf00;})[_0xa73d('0x21')](respondWithFilteredResult(_0x42be1f,_0x255b8e))[_0xa73d('0x54')](handleError(_0x42be1f,null));};exports['show']=function(_0x4b80db,_0x26bfbf){var _0xe30ca7={'raw':!![],'where':{'id':_0x4b80db[_0xa73d('0x55')]['id']}},_0x14cdb8={};_0x14cdb8[_0xa73d('0x41')]=_[_0xa73d('0x43')](db[_0xa73d('0x52')][_0xa73d('0x3d')]);_0x14cdb8[_0xa73d('0x42')]=_[_0xa73d('0x43')](_0x4b80db[_0xa73d('0x42')]);_0x14cdb8[_0xa73d('0x44')]=_[_0xa73d('0x45')](_0x14cdb8[_0xa73d('0x41')],_0x14cdb8[_0xa73d('0x42')]);_0xe30ca7['attributes']=_[_0xa73d('0x45')](_0x14cdb8[_0xa73d('0x41')],qs[_0xa73d('0x47')](_0x4b80db['query'][_0xa73d('0x47')]));_0xe30ca7[_0xa73d('0x46')]=_0xe30ca7['attributes'][_0xa73d('0x48')]?_0xe30ca7[_0xa73d('0x46')]:_0x14cdb8['model'];if(_0x4b80db[_0xa73d('0x42')][_0xa73d('0x51')]){_0xe30ca7['include']=[{'all':!![]}];}_0xe30ca7=_[_0xa73d('0x4e')]({},_0xe30ca7,_0x4b80db['options']);return db['ChatMessage'][_0xa73d('0x56')](_0xe30ca7)[_0xa73d('0x21')](handleEntityNotFound(_0x26bfbf,null))[_0xa73d('0x21')](respondWithResult(_0x26bfbf,null))[_0xa73d('0x54')](handleError(_0x26bfbf,null));};exports['create']=function(_0x3b42e0,_0xfc30a5){return db[_0xa73d('0x52')][_0xa73d('0x57')](_0x3b42e0[_0xa73d('0x58')],{})[_0xa73d('0x21')](respondWithResult(_0xfc30a5,0xc9))[_0xa73d('0x54')](handleError(_0xfc30a5,null));};exports[_0xa73d('0x59')]=function(_0x71175b,_0x501c88){if(_0x71175b[_0xa73d('0x58')]['id']){delete _0x71175b[_0xa73d('0x58')]['id'];}return db[_0xa73d('0x52')]['find']({'where':{'id':_0x71175b['params']['id']}})[_0xa73d('0x21')](handleEntityNotFound(_0x501c88,null))['then'](saveUpdates(_0x71175b[_0xa73d('0x58')],null))[_0xa73d('0x21')](respondWithResult(_0x501c88,null))[_0xa73d('0x54')](handleError(_0x501c88,null));};exports[_0xa73d('0x5a')]=function(_0x10fd7f,_0x3a355a){return db[_0xa73d('0x52')][_0xa73d('0x56')]({'where':{'id':_0x10fd7f['params']['id']}})[_0xa73d('0x21')](handleEntityNotFound(_0x3a355a,null))['then'](removeEntity(_0x3a355a,null))[_0xa73d('0x54')](handleError(_0x3a355a,null));};exports[_0xa73d('0x5b')]=function(_0x33a25b,_0x39166a){return db[_0xa73d('0x52')]['describe']()[_0xa73d('0x21')](respondWithResult(_0x39166a,null))[_0xa73d('0x54')](handleError(_0x39166a,null));};var interaction_log=require(_0xa73d('0x16'))(_0xa73d('0x5c'));exports[_0xa73d('0x5d')]=function(_0x10b5e9,_0x37ad35,_0x1a0b35){var _0x69c384={'agent':{},'channel':'chat'};if(_0x10b5e9[_0xa73d('0x58')]['id']){delete _0x10b5e9[_0xa73d('0x58')]['id'];}_0x10b5e9[_0xa73d('0x58')][_0xa73d('0x5e')]=!![];_0x10b5e9[_0xa73d('0x58')][_0xa73d('0x5f')]=moment()[_0xa73d('0x60')](_0xa73d('0x61'));_0x10b5e9[_0xa73d('0x58')][_0xa73d('0x62')]=_0x10b5e9[_0xa73d('0x58')][_0xa73d('0x62')]||_0x10b5e9[_0xa73d('0x63')]['id'];_0x69c384[_0xa73d('0x64')]['id']=_0x10b5e9[_0xa73d('0x58')]['UserId'];return db[_0xa73d('0x52')]['find']({'where':{'id':_0x10b5e9[_0xa73d('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xa73d('0x65')],'as':_0xa73d('0x66')}]})[_0xa73d('0x21')](handleEntityNotFound(_0x37ad35,null))['then'](saveUpdates(_0x10b5e9[_0xa73d('0x58')],null))[_0xa73d('0x21')](function(_0x2a3052){if(_0x2a3052){_0x69c384[_0xa73d('0x29')]=_0x2a3052[_0xa73d('0x67')]({'plain':!![]});return db['ChatInteraction'][_0xa73d('0x56')]({'where':{'id':_0x2a3052[_0xa73d('0x68')]}});}return null;})[_0xa73d('0x21')](handleEntityNotFound(_0x37ad35,null))[_0xa73d('0x21')](function(_0x370343){if(_0x370343){return _0x370343[_0xa73d('0x59')]({'UserId':_0x10b5e9[_0xa73d('0x58')][_0xa73d('0x62')],'read1stAt':_[_0xa73d('0x69')](_0x370343[_0xa73d('0x6a')])?moment()['format'](_0xa73d('0x61')):undefined});}return null;})[_0xa73d('0x21')](function(_0x3e4083){if(_0x3e4083){_0x69c384[_0xa73d('0x6b')]=_0x3e4083[_0xa73d('0x67')]({'plain':!![]});interaction_log[_0xa73d('0x22')](_0xa73d('0x6c'),_0x10b5e9[_0xa73d('0x63')]['id'],_0x10b5e9[_0xa73d('0x63')][_0xa73d('0x39')],_0x10b5e9[_0xa73d('0x63')]['role'],_0x69c384[_0xa73d('0x6b')]['id'],_0x10b5e9['body']?JSON[_0xa73d('0x25')](_0x10b5e9[_0xa73d('0x58')]):_0xa73d('0x6d'));return respondWithRpcPromise(_0xa73d('0x6e'),_0xa73d('0x6f'),_0x69c384);}return null;})[_0xa73d('0x21')](function(_0x549e4d){return db[_0xa73d('0x65')][_0xa73d('0x5b')]()[_0xa73d('0x21')](function(_0x2d6544){var _0xd462bc=[];for(var _0x3eb5cf=0x0;_0x3eb5cf=_0x3fffac){_0x22d058=_0x3fffac;_0x5555cd=0xc8;}else{_0x5555cd=0xce;}_0x369f3f[_0x11b2('0x1c')](_0x5555cd);return _0x369f3f[_0x11b2('0x23')]('Content-Range',_0x5c1d68+'-'+_0x22d058+'/'+_0x3fffac)[_0x11b2('0x1e')](_0x42771f);}return null;};}function patchUpdates(_0x20f8b0){return function(_0x3c1070){try{jsonpatch[_0x11b2('0x24')](_0x3c1070,_0x20f8b0,!![]);}catch(_0x25a4af){return BPromise[_0x11b2('0x25')](_0x25a4af);}return _0x3c1070['save']();};}function saveUpdates(_0xfbc3c,_0x212316){return function(_0x1c22f0){if(_0x1c22f0){return _0x1c22f0[_0x11b2('0x26')](_0xfbc3c)[_0x11b2('0x27')](function(_0x2502bf){return _0x2502bf;});}return null;};}function removeEntity(_0x844c6f,_0x41c01e){return function(_0x5d5055){if(_0x5d5055){return _0x5d5055[_0x11b2('0x28')]()[_0x11b2('0x27')](function(){_0x844c6f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29dfab,_0x563a02){return function(_0x103828){if(!_0x103828){_0x29dfab[_0x11b2('0x1b')](0x194);}return _0x103828;};}function handleError(_0x37c71b,_0x209c46){_0x209c46=_0x209c46||0x1f4;return function(_0x54ef4f){logger['error'](_0x54ef4f[_0x11b2('0x29')]);if(_0x54ef4f['name']){delete _0x54ef4f[_0x11b2('0x2a')];}_0x37c71b['status'](_0x209c46)['send'](_0x54ef4f);};}exports['index']=function(_0x446227,_0x4330d9){var _0x3d8f7e={},_0x571926={},_0x234a6f={'count':0x0,'rows':[]};var _0x7edf4d=_[_0x11b2('0x2b')](db[_0x11b2('0x2c')][_0x11b2('0x2d')],function(_0x1cc17e){return{'name':_0x1cc17e[_0x11b2('0x2e')],'type':_0x1cc17e[_0x11b2('0x2f')][_0x11b2('0x30')]};});_0x571926['model']=_[_0x11b2('0x2b')](_0x7edf4d,_0x11b2('0x2a'));_0x571926[_0x11b2('0x31')]=_[_0x11b2('0x32')](_0x446227[_0x11b2('0x31')]);_0x571926[_0x11b2('0x33')]=_[_0x11b2('0x34')](_0x571926[_0x11b2('0x35')],_0x571926['query']);_0x3d8f7e['attributes']=_[_0x11b2('0x34')](_0x571926[_0x11b2('0x35')],qs[_0x11b2('0x36')](_0x446227[_0x11b2('0x31')][_0x11b2('0x36')]));_0x3d8f7e[_0x11b2('0x37')]=_0x3d8f7e[_0x11b2('0x37')]['length']?_0x3d8f7e[_0x11b2('0x37')]:_0x571926[_0x11b2('0x35')];if(!_0x446227[_0x11b2('0x31')][_0x11b2('0x38')]('nolimit')){_0x3d8f7e[_0x11b2('0x20')]=qs[_0x11b2('0x20')](_0x446227[_0x11b2('0x31')]['limit']);_0x3d8f7e['offset']=qs['offset'](_0x446227[_0x11b2('0x31')]['offset']);}_0x3d8f7e['order']=qs[_0x11b2('0x39')](_0x446227[_0x11b2('0x31')]['sort']);_0x3d8f7e['where']=qs[_0x11b2('0x33')](_['pick'](_0x446227[_0x11b2('0x31')],_0x571926['filters']),_0x7edf4d);if(_0x446227[_0x11b2('0x31')][_0x11b2('0x3a')]){_0x3d8f7e[_0x11b2('0x3b')]=_[_0x11b2('0x3c')](_0x3d8f7e['where'],{'$or':_[_0x11b2('0x2b')](_0x7edf4d,function(_0x4789be){if(_0x4789be['type']!==_0x11b2('0x3d')){var _0x3c161c={};_0x3c161c[_0x4789be[_0x11b2('0x2a')]]={'$like':'%'+_0x446227[_0x11b2('0x31')][_0x11b2('0x3a')]+'%'};return _0x3c161c;}})});}_0x3d8f7e=_['merge']({},_0x3d8f7e,_0x446227[_0x11b2('0x3e')]);var _0x4e68cb={'where':_0x3d8f7e[_0x11b2('0x3b')]};return db[_0x11b2('0x2c')]['count'](_0x4e68cb)['then'](function(_0x297822){_0x234a6f[_0x11b2('0x22')]=_0x297822;if(_0x446227[_0x11b2('0x31')][_0x11b2('0x3f')]){_0x3d8f7e[_0x11b2('0x40')]=[{'all':!![]}];}return db[_0x11b2('0x2c')][_0x11b2('0x41')](_0x3d8f7e);})[_0x11b2('0x27')](function(_0x20429b){_0x234a6f['rows']=_0x20429b;return _0x234a6f;})[_0x11b2('0x27')](respondWithFilteredResult(_0x4330d9,_0x3d8f7e))['catch'](handleError(_0x4330d9,null));};exports[_0x11b2('0x42')]=function(_0x5caaa4,_0x2282ac){var _0x44eea0={'raw':!![],'where':{'id':_0x5caaa4[_0x11b2('0x43')]['id']}},_0x5eaaaa={};_0x5eaaaa[_0x11b2('0x35')]=_[_0x11b2('0x32')](db['ChatOfflineMessage']['rawAttributes']);_0x5eaaaa['query']=_[_0x11b2('0x32')](_0x5caaa4[_0x11b2('0x31')]);_0x5eaaaa[_0x11b2('0x33')]=_[_0x11b2('0x34')](_0x5eaaaa[_0x11b2('0x35')],_0x5eaaaa[_0x11b2('0x31')]);_0x44eea0[_0x11b2('0x37')]=_[_0x11b2('0x34')](_0x5eaaaa[_0x11b2('0x35')],qs[_0x11b2('0x36')](_0x5caaa4[_0x11b2('0x31')][_0x11b2('0x36')]));_0x44eea0[_0x11b2('0x37')]=_0x44eea0[_0x11b2('0x37')][_0x11b2('0x44')]?_0x44eea0['attributes']:_0x5eaaaa[_0x11b2('0x35')];if(_0x5caaa4['query'][_0x11b2('0x3f')]){_0x44eea0['include']=[{'all':!![]}];}_0x44eea0=_[_0x11b2('0x3c')]({},_0x44eea0,_0x5caaa4[_0x11b2('0x3e')]);return db[_0x11b2('0x2c')][_0x11b2('0x45')](_0x44eea0)[_0x11b2('0x27')](handleEntityNotFound(_0x2282ac,null))[_0x11b2('0x27')](respondWithResult(_0x2282ac,null))[_0x11b2('0x46')](handleError(_0x2282ac,null));};exports['create']=function(_0x459be1,_0x25025a){return db[_0x11b2('0x2c')][_0x11b2('0x47')](_0x459be1['body'],{})[_0x11b2('0x27')](respondWithResult(_0x25025a,0xc9))['catch'](handleError(_0x25025a,null));};exports[_0x11b2('0x26')]=function(_0x53335c,_0x49aaa0){if(_0x53335c[_0x11b2('0x48')]['id']){delete _0x53335c[_0x11b2('0x48')]['id'];}return db['ChatOfflineMessage'][_0x11b2('0x45')]({'where':{'id':_0x53335c[_0x11b2('0x43')]['id']}})[_0x11b2('0x27')](handleEntityNotFound(_0x49aaa0,null))['then'](saveUpdates(_0x53335c[_0x11b2('0x48')],null))[_0x11b2('0x27')](respondWithResult(_0x49aaa0,null))[_0x11b2('0x46')](handleError(_0x49aaa0,null));};exports[_0x11b2('0x28')]=function(_0x155ccb,_0x2e8e20){return db[_0x11b2('0x49')][_0x11b2('0x41')]({'where':{'ChatOfflineMessageId':_0x155ccb['params']['id']},'raw':!![]})[_0x11b2('0x27')](function(_0x441512){_0x441512['forEach'](function(_0x593836){var _0x75c007=path['join'](config['root'],_0x11b2('0x4a'),_0x11b2('0x4b'),_0x11b2('0x4c'),_0x11b2('0x4d'),_0x593836['basename']);var _0xa6dacc=fs['existsSync'](_0x75c007);if(_0xa6dacc)fs_extra[_0x11b2('0x4e')](_0x75c007);});})['then'](function(){return db[_0x11b2('0x2c')][_0x11b2('0x45')]({'where':{'id':_0x155ccb[_0x11b2('0x43')]['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x2e8e20,null))[_0x11b2('0x27')](removeEntity(_0x2e8e20,null))[_0x11b2('0x46')](handleError(_0x2e8e20,null));};exports['describe']=function(_0x235a93,_0x5ac5f7){return db[_0x11b2('0x2c')][_0x11b2('0x4f')]()['then'](respondWithResult(_0x5ac5f7,null))['catch'](handleError(_0x5ac5f7,null));}; \ No newline at end of file +var _0xe7aa=['request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','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','limit','undefined','count','offset','Content-Range','reject','update','destroy','then','stack','name','send','index','ChatOfflineMessage','rawAttributes','fieldName','key','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','Attachment','forEach','join','root','server','offline-chat','existsSync','remove','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x9fb389,_0x95dc6){var _0x4ccdf4=function(_0x39e638){while(--_0x39e638){_0x9fb389['push'](_0x9fb389['shift']());}};_0x4ccdf4(++_0x95dc6);}(_0xe7aa,0xf5));var _0xae7a=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xe7aa[_0x363ef8];return _0x148822;};'use strict';var emlformat=require(_0xae7a('0x0'));var rimraf=require(_0xae7a('0x1'));var zipdir=require(_0xae7a('0x2'));var jsonpatch=require(_0xae7a('0x3'));var rp=require(_0xae7a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xae7a('0x5'));var util=require(_0xae7a('0x6'));var path=require(_0xae7a('0x7'));var sox=require(_0xae7a('0x8'));var csv=require('to-csv');var ejs=require(_0xae7a('0x9'));var fs=require('fs');var fs_extra=require(_0xae7a('0xa'));var _=require(_0xae7a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xae7a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xae7a('0xd'));var Papa=require(_0xae7a('0xe'));var Redis=require(_0xae7a('0xf'));var authService=require(_0xae7a('0x10'));var qs=require(_0xae7a('0x11'));var as=require(_0xae7a('0x12'));var hardwareService=require(_0xae7a('0x13'));var logger=require(_0xae7a('0x14'))(_0xae7a('0x15'));var utils=require(_0xae7a('0x16'));var config=require(_0xae7a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xae7a('0x18'))['db'];function respondWithStatusCode(_0x50a7d0,_0x1db2e0){_0x1db2e0=_0x1db2e0||0xcc;return function(_0x50a215){if(_0x50a215){return _0x50a7d0[_0xae7a('0x19')](_0x1db2e0);}return _0x50a7d0[_0xae7a('0x1a')](_0x1db2e0)[_0xae7a('0x1b')]();};}function respondWithResult(_0x4e27af,_0x37c1d5){_0x37c1d5=_0x37c1d5||0xc8;return function(_0x136e7d){if(_0x136e7d){return _0x4e27af['status'](_0x37c1d5)[_0xae7a('0x1c')](_0x136e7d);}};}function respondWithFilteredResult(_0x5ae337,_0x8d57a2){return function(_0x50cd6e){if(_0x50cd6e){var _0x409563=typeof _0x8d57a2['offset']==='undefined'&&typeof _0x8d57a2[_0xae7a('0x1d')]===_0xae7a('0x1e');var _0x2a5586=_0x50cd6e[_0xae7a('0x1f')];var _0x1e4181=_0x409563?0x0:_0x8d57a2[_0xae7a('0x20')];var _0x1a5b3c=_0x409563?_0x50cd6e[_0xae7a('0x1f')]:_0x8d57a2[_0xae7a('0x20')]+_0x8d57a2[_0xae7a('0x1d')];var _0x2081e9;if(_0x1a5b3c>=_0x2a5586){_0x1a5b3c=_0x2a5586;_0x2081e9=0xc8;}else{_0x2081e9=0xce;}_0x5ae337[_0xae7a('0x1a')](_0x2081e9);return _0x5ae337['set'](_0xae7a('0x21'),_0x1e4181+'-'+_0x1a5b3c+'/'+_0x2a5586)[_0xae7a('0x1c')](_0x50cd6e);}return null;};}function patchUpdates(_0x1358f1){return function(_0x53c87e){try{jsonpatch['apply'](_0x53c87e,_0x1358f1,!![]);}catch(_0x4e4646){return BPromise[_0xae7a('0x22')](_0x4e4646);}return _0x53c87e['save']();};}function saveUpdates(_0x2d433c,_0x35f6a2){return function(_0x4d9983){if(_0x4d9983){return _0x4d9983[_0xae7a('0x23')](_0x2d433c)['then'](function(_0x2ea87b){return _0x2ea87b;});}return null;};}function removeEntity(_0x33c408,_0x29b431){return function(_0x3a3cb0){if(_0x3a3cb0){return _0x3a3cb0[_0xae7a('0x24')]()[_0xae7a('0x25')](function(){_0x33c408[_0xae7a('0x1a')](0xcc)[_0xae7a('0x1b')]();});}};}function handleEntityNotFound(_0x4031c0,_0x56a76b){return function(_0x14400b){if(!_0x14400b){_0x4031c0[_0xae7a('0x19')](0x194);}return _0x14400b;};}function handleError(_0x377aae,_0x1799a4){_0x1799a4=_0x1799a4||0x1f4;return function(_0x34a558){logger['error'](_0x34a558[_0xae7a('0x26')]);if(_0x34a558[_0xae7a('0x27')]){delete _0x34a558['name'];}_0x377aae[_0xae7a('0x1a')](_0x1799a4)[_0xae7a('0x28')](_0x34a558);};}exports[_0xae7a('0x29')]=function(_0x90c6aa,_0x525d19){var _0x17492f={},_0x23213b={},_0x342bd8={'count':0x0,'rows':[]};var _0x3065c3=_['map'](db[_0xae7a('0x2a')][_0xae7a('0x2b')],function(_0x1127aa){return{'name':_0x1127aa[_0xae7a('0x2c')],'type':_0x1127aa['type'][_0xae7a('0x2d')]};});_0x23213b['model']=_['map'](_0x3065c3,_0xae7a('0x27'));_0x23213b[_0xae7a('0x2e')]=_['keys'](_0x90c6aa[_0xae7a('0x2e')]);_0x23213b['filters']=_['intersection'](_0x23213b[_0xae7a('0x2f')],_0x23213b['query']);_0x17492f['attributes']=_[_0xae7a('0x30')](_0x23213b[_0xae7a('0x2f')],qs[_0xae7a('0x31')](_0x90c6aa[_0xae7a('0x2e')]['fields']));_0x17492f['attributes']=_0x17492f[_0xae7a('0x32')][_0xae7a('0x33')]?_0x17492f['attributes']:_0x23213b[_0xae7a('0x2f')];if(!_0x90c6aa[_0xae7a('0x2e')][_0xae7a('0x34')](_0xae7a('0x35'))){_0x17492f[_0xae7a('0x1d')]=qs[_0xae7a('0x1d')](_0x90c6aa['query'][_0xae7a('0x1d')]);_0x17492f[_0xae7a('0x20')]=qs['offset'](_0x90c6aa['query'][_0xae7a('0x20')]);}_0x17492f[_0xae7a('0x36')]=qs['sort'](_0x90c6aa['query'][_0xae7a('0x37')]);_0x17492f[_0xae7a('0x38')]=qs[_0xae7a('0x39')](_[_0xae7a('0x3a')](_0x90c6aa[_0xae7a('0x2e')],_0x23213b[_0xae7a('0x39')]),_0x3065c3);if(_0x90c6aa[_0xae7a('0x2e')][_0xae7a('0x3b')]){_0x17492f[_0xae7a('0x38')]=_[_0xae7a('0x3c')](_0x17492f[_0xae7a('0x38')],{'$or':_[_0xae7a('0x3d')](_0x3065c3,function(_0x244b3b){if(_0x244b3b['type']!==_0xae7a('0x3e')){var _0x167379={};_0x167379[_0x244b3b[_0xae7a('0x27')]]={'$like':'%'+_0x90c6aa[_0xae7a('0x2e')][_0xae7a('0x3b')]+'%'};return _0x167379;}})});}_0x17492f=_[_0xae7a('0x3c')]({},_0x17492f,_0x90c6aa[_0xae7a('0x3f')]);var _0x2a12c8={'where':_0x17492f[_0xae7a('0x38')]};return db['ChatOfflineMessage'][_0xae7a('0x1f')](_0x2a12c8)['then'](function(_0x2ab79c){_0x342bd8[_0xae7a('0x1f')]=_0x2ab79c;if(_0x90c6aa[_0xae7a('0x2e')]['includeAll']){_0x17492f[_0xae7a('0x40')]=[{'all':!![]}];}return db[_0xae7a('0x2a')][_0xae7a('0x41')](_0x17492f);})[_0xae7a('0x25')](function(_0x17d950){_0x342bd8[_0xae7a('0x42')]=_0x17d950;return _0x342bd8;})['then'](respondWithFilteredResult(_0x525d19,_0x17492f))[_0xae7a('0x43')](handleError(_0x525d19,null));};exports[_0xae7a('0x44')]=function(_0x31fe07,_0x3dde23){var _0x3720aa={'raw':!![],'where':{'id':_0x31fe07['params']['id']}},_0x57b109={};_0x57b109[_0xae7a('0x2f')]=_[_0xae7a('0x45')](db[_0xae7a('0x2a')]['rawAttributes']);_0x57b109[_0xae7a('0x2e')]=_['keys'](_0x31fe07[_0xae7a('0x2e')]);_0x57b109['filters']=_['intersection'](_0x57b109[_0xae7a('0x2f')],_0x57b109['query']);_0x3720aa[_0xae7a('0x32')]=_[_0xae7a('0x30')](_0x57b109[_0xae7a('0x2f')],qs[_0xae7a('0x31')](_0x31fe07['query']['fields']));_0x3720aa['attributes']=_0x3720aa[_0xae7a('0x32')][_0xae7a('0x33')]?_0x3720aa[_0xae7a('0x32')]:_0x57b109['model'];if(_0x31fe07[_0xae7a('0x2e')][_0xae7a('0x46')]){_0x3720aa[_0xae7a('0x40')]=[{'all':!![]}];}_0x3720aa=_[_0xae7a('0x3c')]({},_0x3720aa,_0x31fe07[_0xae7a('0x3f')]);return db[_0xae7a('0x2a')][_0xae7a('0x47')](_0x3720aa)[_0xae7a('0x25')](handleEntityNotFound(_0x3dde23,null))['then'](respondWithResult(_0x3dde23,null))[_0xae7a('0x43')](handleError(_0x3dde23,null));};exports[_0xae7a('0x48')]=function(_0x3ca4cb,_0x2d7c81){return db[_0xae7a('0x2a')][_0xae7a('0x48')](_0x3ca4cb[_0xae7a('0x49')],{})['then'](respondWithResult(_0x2d7c81,0xc9))[_0xae7a('0x43')](handleError(_0x2d7c81,null));};exports['update']=function(_0x24833a,_0x2d5f0a){if(_0x24833a[_0xae7a('0x49')]['id']){delete _0x24833a[_0xae7a('0x49')]['id'];}return db['ChatOfflineMessage'][_0xae7a('0x47')]({'where':{'id':_0x24833a[_0xae7a('0x4a')]['id']}})[_0xae7a('0x25')](handleEntityNotFound(_0x2d5f0a,null))[_0xae7a('0x25')](saveUpdates(_0x24833a['body'],null))[_0xae7a('0x25')](respondWithResult(_0x2d5f0a,null))[_0xae7a('0x43')](handleError(_0x2d5f0a,null));};exports[_0xae7a('0x24')]=function(_0x32b189,_0x293378){return db[_0xae7a('0x4b')]['findAll']({'where':{'ChatOfflineMessageId':_0x32b189[_0xae7a('0x4a')]['id']},'raw':!![]})[_0xae7a('0x25')](function(_0x26d48a){_0x26d48a[_0xae7a('0x4c')](function(_0x2c6cf2){var _0x520fd5=path[_0xae7a('0x4d')](config[_0xae7a('0x4e')],_0xae7a('0x4f'),'files','attachments',_0xae7a('0x50'),_0x2c6cf2['basename']);var _0x462741=fs[_0xae7a('0x51')](_0x520fd5);if(_0x462741)fs_extra[_0xae7a('0x52')](_0x520fd5);});})[_0xae7a('0x25')](function(){return db[_0xae7a('0x2a')]['find']({'where':{'id':_0x32b189[_0xae7a('0x4a')]['id']},'individualHooks':!![]});})[_0xae7a('0x25')](handleEntityNotFound(_0x293378,null))[_0xae7a('0x25')](removeEntity(_0x293378,null))[_0xae7a('0x43')](handleError(_0x293378,null));};exports['describe']=function(_0x508e1c,_0x57b16f){return db[_0xae7a('0x2a')]['describe']()[_0xae7a('0x25')](respondWithResult(_0x57b16f,null))['catch'](handleError(_0x57b16f,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index fc860dc..5059562 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 _0x8ce3=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x5bf419,_0x214f6a){var _0x3e41a3=function(_0x1f7c0d){while(--_0x1f7c0d){_0x5bf419['push'](_0x5bf419['shift']());}};_0x3e41a3(++_0x214f6a);}(_0x8ce3,0xc3));var _0x38ce=function(_0x1a6c7f,_0x5aee3f){_0x1a6c7f=_0x1a6c7f-0x0;var _0x1d378d=_0x8ce3[_0x1a6c7f];return _0x1d378d;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var moment=require(_0x38ce('0x3'));var BPromise=require(_0x38ce('0x4'));var rp=require(_0x38ce('0x5'));var fs=require('fs');var path=require(_0x38ce('0x6'));var rimraf=require(_0x38ce('0x7'));var config=require(_0x38ce('0x8'));var attributes=require(_0x38ce('0x9'));module['exports']=function(_0x372f86,_0xb24f4c){return _0x372f86['define'](_0x38ce('0xa'),attributes,{'tableName':_0x38ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x38ce('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0fda=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x838d6b,_0x2f2eac){_0x838d6b=_0x838d6b-0x0;var _0x64c112=_0x0fda[_0x838d6b];return _0x64c112;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var logger=require(_0xa0fd('0x1'))(_0xa0fd('0x2'));var moment=require(_0xa0fd('0x3'));var BPromise=require(_0xa0fd('0x4'));var rp=require(_0xa0fd('0x5'));var fs=require('fs');var path=require(_0xa0fd('0x6'));var rimraf=require(_0xa0fd('0x7'));var config=require('../../config/environment');var attributes=require('./chatOfflineMessage.attributes');module[_0xa0fd('0x8')]=function(_0x4aec58,_0x49b3c1){return _0x4aec58[_0xa0fd('0x9')](_0xa0fd('0xa'),attributes,{'tableName':_0xa0fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa0fd('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 386edc5..8655c5d 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 _0x9521=['error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x442644,_0x576921){var _0x1f607b=function(_0x3c3590){while(--_0x3c3590){_0x442644['push'](_0x442644['shift']());}};_0x1f607b(++_0x576921);}(_0x9521,0x68));var _0x1952=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0x9521[_0xf80b3];return _0x10c489;};'use strict';var _=require(_0x1952('0x0'));var util=require(_0x1952('0x1'));var moment=require(_0x1952('0x2'));var BPromise=require(_0x1952('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1952('0x4'));var db=require(_0x1952('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1952('0x6'))(_0x1952('0x7'));var config=require('../../config/environment');var jayson=require(_0x1952('0x8'));var client=jayson['client'][_0x1952('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x342693,_0x1895cc,_0x434d2c){return new BPromise(function(_0x1cbcb0,_0x1bfc79){return client[_0x1952('0xa')](_0x342693,_0x434d2c)[_0x1952('0xb')](function(_0x260c24){logger[_0x1952('0xc')](_0x1952('0xd'),_0x1895cc,_0x1952('0xe'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1895cc,'request\x20sent',JSON[_0x1952('0xf')](_0x260c24));if(_0x260c24['error']){if(_0x260c24[_0x1952('0x10')][_0x1952('0x11')]===0x1f4){logger['error'](_0x1952('0xd'),_0x1895cc,_0x260c24[_0x1952('0x10')][_0x1952('0x12')]);return _0x1bfc79(_0x260c24['error'][_0x1952('0x12')]);}logger[_0x1952('0x10')](_0x1952('0xd'),_0x1895cc,_0x260c24[_0x1952('0x10')][_0x1952('0x12')]);return _0x1cbcb0(_0x260c24[_0x1952('0x10')][_0x1952('0x12')]);}else{logger[_0x1952('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1895cc,_0x1952('0xe'));_0x1cbcb0(_0x260c24[_0x1952('0x13')][_0x1952('0x12')]);}})['catch'](function(_0x2cf5a3){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x1895cc,_0x2cf5a3);_0x1bfc79(_0x2cf5a3);});});} \ No newline at end of file +var _0x91e6=['ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x523e68,_0x301247){var _0x52ae11=function(_0x599991){while(--_0x599991){_0x523e68['push'](_0x523e68['shift']());}};_0x52ae11(++_0x301247);}(_0x91e6,0xe5));var _0x691e=function(_0x491e47,_0x2b1b34){_0x491e47=_0x491e47-0x0;var _0x285e69=_0x91e6[_0x491e47];return _0x285e69;};'use strict';var _=require(_0x691e('0x0'));var util=require('util');var moment=require(_0x691e('0x1'));var BPromise=require(_0x691e('0x2'));var rs=require(_0x691e('0x3'));var fs=require('fs');var Redis=require(_0x691e('0x4'));var db=require(_0x691e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x691e('0x6'))(_0x691e('0x7'));var config=require('../../config/environment');var jayson=require(_0x691e('0x8'));var client=jayson[_0x691e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2909ad,_0x98b0bf,_0x1232da){return new BPromise(function(_0x1aea5a,_0x1a65b6){return client[_0x691e('0xa')](_0x2909ad,_0x1232da)[_0x691e('0xb')](function(_0x3ab8c8){logger[_0x691e('0xc')](_0x691e('0xd'),_0x98b0bf,'request\x20sent');logger[_0x691e('0xe')](_0x691e('0xf'),_0x98b0bf,_0x691e('0x10'),JSON[_0x691e('0x11')](_0x3ab8c8));if(_0x3ab8c8[_0x691e('0x12')]){if(_0x3ab8c8[_0x691e('0x12')]['code']===0x1f4){logger[_0x691e('0x12')](_0x691e('0xd'),_0x98b0bf,_0x3ab8c8[_0x691e('0x12')][_0x691e('0x13')]);return _0x1a65b6(_0x3ab8c8[_0x691e('0x12')]['message']);}logger[_0x691e('0x12')](_0x691e('0xd'),_0x98b0bf,_0x3ab8c8['error'][_0x691e('0x13')]);return _0x1aea5a(_0x3ab8c8[_0x691e('0x12')][_0x691e('0x13')]);}else{logger[_0x691e('0xc')](_0x691e('0xd'),_0x98b0bf,_0x691e('0x10'));_0x1aea5a(_0x3ab8c8[_0x691e('0x14')][_0x691e('0x13')]);}})[_0x691e('0x15')](function(_0x4c12e8){logger[_0x691e('0x12')](_0x691e('0xd'),_0x98b0bf,_0x4c12e8);_0x1a65b6(_0x4c12e8);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 579dfa8..61f1770 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 _0x0860=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','util','path','connect-timeout','express','fs-extra'];(function(_0x2e1058,_0x535e8c){var _0x3b9d5b=function(_0x4a0a92){while(--_0x4a0a92){_0x2e1058['push'](_0x2e1058['shift']());}};_0x3b9d5b(++_0x535e8c);}(_0x0860,0xcc));var _0x0086=function(_0x16bcf6,_0x5dd7ce){_0x16bcf6=_0x16bcf6-0x0;var _0x657e99=_0x0860[_0x16bcf6];return _0x657e99;};'use strict';var multer=require('multer');var util=require(_0x0086('0x0'));var path=require(_0x0086('0x1'));var timeout=require(_0x0086('0x2'));var express=require(_0x0086('0x3'));var router=express['Router']();var fs_extra=require(_0x0086('0x4'));var auth=require(_0x0086('0x5'));var interaction=require(_0x0086('0x6'));var config=require(_0x0086('0x7'));var controller=require(_0x0086('0x8'));router[_0x0086('0x9')]('/',auth[_0x0086('0xa')](),controller[_0x0086('0xb')]);router[_0x0086('0x9')](_0x0086('0xc'),auth[_0x0086('0xa')](),controller[_0x0086('0xd')]);router['get'](_0x0086('0xe'),auth[_0x0086('0xa')](),controller[_0x0086('0xf')]);router['post']('/',auth[_0x0086('0xa')](),controller['create']);router[_0x0086('0x10')](_0x0086('0xe'),auth[_0x0086('0xa')](),controller[_0x0086('0x11')]);router[_0x0086('0x12')](_0x0086('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3479=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x500aeb,_0x29fdba){var _0x5f3052=function(_0x415fc8){while(--_0x415fc8){_0x500aeb['push'](_0x500aeb['shift']());}};_0x5f3052(++_0x29fdba);}(_0x3479,0x107));var _0x9347=function(_0x476f49,_0x105660){_0x476f49=_0x476f49-0x0;var _0x48addd=_0x3479[_0x476f49];return _0x48addd;};'use strict';var multer=require(_0x9347('0x0'));var util=require(_0x9347('0x1'));var path=require(_0x9347('0x2'));var timeout=require(_0x9347('0x3'));var express=require(_0x9347('0x4'));var router=express[_0x9347('0x5')]();var fs_extra=require(_0x9347('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9347('0x7'));var controller=require(_0x9347('0x8'));router[_0x9347('0x9')]('/',auth['isAuthenticated'](),controller[_0x9347('0xa')]);router[_0x9347('0x9')](_0x9347('0xb'),auth[_0x9347('0xc')](),controller[_0x9347('0xd')]);router['get'](_0x9347('0xe'),auth[_0x9347('0xc')](),controller[_0x9347('0xf')]);router[_0x9347('0x10')]('/',auth['isAuthenticated'](),controller[_0x9347('0x11')]);router[_0x9347('0x12')](_0x9347('0xe'),auth[_0x9347('0xc')](),controller[_0x9347('0x13')]);router[_0x9347('0x14')](_0x9347('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x9347('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 d046c0c..6070321 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 _0x6965=['exports','STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0x569b87,_0x2e2d3d){var _0x5c9988=function(_0x174941){while(--_0x174941){_0x569b87['push'](_0x569b87['shift']());}};_0x5c9988(++_0x2e2d3d);}(_0x6965,0x13a));var _0x5696=function(_0x11d40e,_0x4869db){_0x11d40e=_0x11d40e-0x0;var _0x2d4552=_0x6965[_0x11d40e];return _0x2d4552;};'use strict';var Sequelize=require(_0x5696('0x0'));module[_0x5696('0x1')]={'name':{'type':Sequelize[_0x5696('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5696('0x3')](_0x5696('0x4'),_0x5696('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x5696('0x2')]},'timeout':{'type':Sequelize[_0x5696('0x6')]}}; \ No newline at end of file +var _0x7d3e=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0xe32e95,_0x324493){var _0x2a6b02=function(_0x51c9a0){while(--_0x51c9a0){_0xe32e95['push'](_0xe32e95['shift']());}};_0x2a6b02(++_0x324493);}(_0x7d3e,0x11f));var _0xe7d3=function(_0x2532a6,_0x25e8e9){_0x2532a6=_0x2532a6-0x0;var _0x1d6b92=_0x7d3e[_0x2532a6];return _0x1d6b92;};'use strict';var Sequelize=require(_0xe7d3('0x0'));module['exports']={'name':{'type':Sequelize[_0xe7d3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe7d3('0x2')](_0xe7d3('0x3'),_0xe7d3('0x4')),'defaultValue':_0xe7d3('0x3')},'selector':{'type':Sequelize[_0xe7d3('0x1')]},'timeout':{'type':Sequelize[_0xe7d3('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index c5a644f..654a394 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 _0xd8b0=['find','catch','create','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','ChatProactiveAction','query','keys','intersection','fields','attributes','length','include','merge'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x35')]=function(_0x206157,_0x31ceba){return db[_0x0d8b('0x2a')]['create'](_0x206157[_0x0d8b('0x36')],{})[_0x0d8b('0x24')](respondWithResult(_0x31ceba,0xc9))['catch'](handleError(_0x31ceba,null));};exports[_0x0d8b('0x23')]=function(_0x3cc3ee,_0x188af2){if(_0x3cc3ee[_0x0d8b('0x36')]['id']){delete _0x3cc3ee[_0x0d8b('0x36')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x3cc3ee[_0x0d8b('0x37')]['id']}})['then'](handleEntityNotFound(_0x188af2,null))['then'](saveUpdates(_0x3cc3ee[_0x0d8b('0x36')],null))[_0x0d8b('0x24')](respondWithResult(_0x188af2,null))[_0x0d8b('0x34')](handleError(_0x188af2,null));};exports[_0x0d8b('0x25')]=function(_0xc1ac4a,_0x24c789){return db['ChatProactiveAction'][_0x0d8b('0x33')]({'where':{'id':_0xc1ac4a[_0x0d8b('0x37')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x24c789,null))[_0x0d8b('0x24')](removeEntity(_0x24c789,null))[_0x0d8b('0x34')](handleError(_0x24c789,null));}; \ No newline at end of file +var _0xb10b=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','show','params','model','keys','rawAttributes','filters','intersection','query','fields','attributes','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x443a96,_0x286dfb){var _0x42ab5d=function(_0x2ea31a){while(--_0x2ea31a){_0x443a96['push'](_0x443a96['shift']());}};_0x42ab5d(++_0x286dfb);}(_0xb10b,0x12a));var _0xbb10=function(_0x18fd21,_0x4af3d1){_0x18fd21=_0x18fd21-0x0;var _0x113f67=_0xb10b[_0x18fd21];return _0x113f67;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={'raw':!![],'where':{'id':_0x4aabb9[_0xbb10('0x2b')]['id']}},_0xfc3595={};_0xfc3595[_0xbb10('0x2c')]=_[_0xbb10('0x2d')](db['ChatProactiveAction'][_0xbb10('0x2e')]);_0xfc3595['query']=_[_0xbb10('0x2d')](_0x4aabb9['query']);_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0xfc3595[_0xbb10('0x2c')],_0xfc3595['query']);_0x21ac54['attributes']=_[_0xbb10('0x30')](_0xfc3595[_0xbb10('0x2c')],qs['fields'](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x32')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x34')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2c')];if(_0x4aabb9['query'][_0xbb10('0x35')]){_0x21ac54[_0xbb10('0x36')]=[{'all':!![]}];}_0x21ac54=_[_0xbb10('0x37')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x38')]);return db[_0xbb10('0x39')][_0xbb10('0x3a')](_0x21ac54)[_0xbb10('0x23')](handleEntityNotFound(_0x3796c7,null))[_0xbb10('0x23')](respondWithResult(_0x3796c7,null))[_0xbb10('0x3b')](handleError(_0x3796c7,null));};exports['create']=function(_0x2b5352,_0x150107){return db[_0xbb10('0x39')][_0xbb10('0x3c')](_0x2b5352['body'],{})[_0xbb10('0x23')](respondWithResult(_0x150107,0xc9))['catch'](handleError(_0x150107,null));};exports['update']=function(_0x3eb3cc,_0x40c164){if(_0x3eb3cc[_0xbb10('0x3d')]['id']){delete _0x3eb3cc[_0xbb10('0x3d')]['id'];}return db[_0xbb10('0x39')][_0xbb10('0x3a')]({'where':{'id':_0x3eb3cc['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x40c164,null))[_0xbb10('0x23')](saveUpdates(_0x3eb3cc['body'],null))['then'](respondWithResult(_0x40c164,null))['catch'](handleError(_0x40c164,null));};exports[_0xbb10('0x24')]=function(_0x2b0b45,_0x2b658a){return db['ChatProactiveAction'][_0xbb10('0x3a')]({'where':{'id':_0x2b0b45[_0xbb10('0x2b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x2b658a,null))['then'](removeEntity(_0x2b658a,null))[_0xbb10('0x3b')](handleError(_0x2b658a,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index ac94dde..adc11dd 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 _0xbbc5=['util','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x2fcbae,_0x22ecaf){var _0x511b33=function(_0x5b262d){while(--_0x5b262d){_0x2fcbae['push'](_0x2fcbae['shift']());}};_0x511b33(++_0x22ecaf);}(_0xbbc5,0x180));var _0x5bbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbc5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5bbc('0x0'));var util=require(_0x5bbc('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5bbc('0x2'));var rp=require(_0x5bbc('0x3'));var fs=require('fs');var path=require(_0x5bbc('0x4'));var rimraf=require(_0x5bbc('0x5'));var config=require('../../config/environment');var attributes=require(_0x5bbc('0x6'));module[_0x5bbc('0x7')]=function(_0x1f814f,_0x3be295){return _0x1f814f[_0x5bbc('0x8')](_0x5bbc('0x9'),attributes,{'tableName':_0x5bbc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8288=['moment','bluebird','path','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api'];(function(_0x8949e4,_0x39e768){var _0x400a3b=function(_0x554ed8){while(--_0x554ed8){_0x8949e4['push'](_0x8949e4['shift']());}};_0x400a3b(++_0x39e768);}(_0x8288,0xa4));var _0x8828=function(_0x169ebc,_0x13913a){_0x169ebc=_0x169ebc-0x0;var _0x21eb71=_0x8288[_0x169ebc];return _0x21eb71;};'use strict';var _=require(_0x8828('0x0'));var util=require(_0x8828('0x1'));var logger=require(_0x8828('0x2'))(_0x8828('0x3'));var moment=require(_0x8828('0x4'));var BPromise=require(_0x8828('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8828('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8828('0x7'));module[_0x8828('0x8')]=function(_0x3da4f1,_0x4a36c7){return _0x3da4f1[_0x8828('0x9')](_0x8828('0xa'),attributes,{'tableName':_0x8828('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 582bc2e..a17f7c8 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 _0x45d7=['error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x45b71c,_0x3f113e){var _0xe336a4=function(_0xfb0a64){while(--_0xfb0a64){_0x45b71c['push'](_0x45b71c['shift']());}};_0xe336a4(++_0x3f113e);}(_0x45d7,0x1a8));var _0x745d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x45d7[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x745d('0x0'));var util=require(_0x745d('0x1'));var moment=require('moment');var BPromise=require(_0x745d('0x2'));var rs=require(_0x745d('0x3'));var fs=require('fs');var Redis=require(_0x745d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x745d('0x5'));var logger=require('../../config/logger')(_0x745d('0x6'));var config=require('../../config/environment');var jayson=require(_0x745d('0x7'));var client=jayson[_0x745d('0x8')][_0x745d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b2e2f,_0x34a7ce,_0x2b3cbb){return new BPromise(function(_0xb7aeff,_0x4f112e){return client[_0x745d('0xa')](_0x4b2e2f,_0x2b3cbb)[_0x745d('0xb')](function(_0x973b0c){logger[_0x745d('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x34a7ce,_0x745d('0xd'));logger[_0x745d('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x34a7ce,_0x745d('0xd'),JSON[_0x745d('0xf')](_0x973b0c));if(_0x973b0c[_0x745d('0x10')]){if(_0x973b0c['error'][_0x745d('0x11')]===0x1f4){logger[_0x745d('0x10')](_0x745d('0x12'),_0x34a7ce,_0x973b0c[_0x745d('0x10')][_0x745d('0x13')]);return _0x4f112e(_0x973b0c['error'][_0x745d('0x13')]);}logger[_0x745d('0x10')](_0x745d('0x12'),_0x34a7ce,_0x973b0c[_0x745d('0x10')][_0x745d('0x13')]);return _0xb7aeff(_0x973b0c[_0x745d('0x10')][_0x745d('0x13')]);}else{logger[_0x745d('0xc')](_0x745d('0x12'),_0x34a7ce,_0x745d('0xd'));_0xb7aeff(_0x973b0c[_0x745d('0x14')][_0x745d('0x13')]);}})[_0x745d('0x15')](function(_0x35875b){logger[_0x745d('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x34a7ce,_0x35875b);_0x4f112e(_0x35875b);});});} \ No newline at end of file +var _0x87cf=['../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x59b0af,_0x25942d){var _0x26f45b=function(_0x2fbc8a){while(--_0x2fbc8a){_0x59b0af['push'](_0x59b0af['shift']());}};_0x26f45b(++_0x25942d);}(_0x87cf,0xf6));var _0xf87c=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x87cf[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xf87c('0x0'));var util=require(_0xf87c('0x1'));var moment=require(_0xf87c('0x2'));var BPromise=require(_0xf87c('0x3'));var rs=require(_0xf87c('0x4'));var fs=require('fs');var Redis=require(_0xf87c('0x5'));var db=require(_0xf87c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf87c('0x7'));var jayson=require(_0xf87c('0x8'));var client=jayson[_0xf87c('0x9')][_0xf87c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15a5c4,_0x2c07a4,_0x1e493b){return new BPromise(function(_0x3a260d,_0x5837d0){return client[_0xf87c('0xb')](_0x15a5c4,_0x1e493b)[_0xf87c('0xc')](function(_0x3d04ab){logger[_0xf87c('0xd')](_0xf87c('0xe'),_0x2c07a4,'request\x20sent');logger[_0xf87c('0xf')](_0xf87c('0x10'),_0x2c07a4,'request\x20sent',JSON[_0xf87c('0x11')](_0x3d04ab));if(_0x3d04ab[_0xf87c('0x12')]){if(_0x3d04ab['error']['code']===0x1f4){logger[_0xf87c('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x2c07a4,_0x3d04ab[_0xf87c('0x12')][_0xf87c('0x13')]);return _0x5837d0(_0x3d04ab[_0xf87c('0x12')]['message']);}logger[_0xf87c('0x12')](_0xf87c('0xe'),_0x2c07a4,_0x3d04ab[_0xf87c('0x12')][_0xf87c('0x13')]);return _0x3a260d(_0x3d04ab[_0xf87c('0x12')]['message']);}else{logger[_0xf87c('0xd')](_0xf87c('0xe'),_0x2c07a4,_0xf87c('0x14'));_0x3a260d(_0x3d04ab['result'][_0xf87c('0x13')]);}})['catch'](function(_0x2993b6){logger[_0xf87c('0x12')](_0xf87c('0xe'),_0x2c07a4,_0x2993b6);_0x5837d0(_0x2993b6);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 95f7e72..ed24749 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 _0x9ad5=['show','post','isAuthenticated','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9ad5,0x8e));var _0x59ad=function(_0x54a5aa,_0x1b295a){_0x54a5aa=_0x54a5aa-0x0;var _0x2da149=_0x9ad5[_0x54a5aa];return _0x2da149;};'use strict';var multer=require(_0x59ad('0x0'));var util=require(_0x59ad('0x1'));var path=require(_0x59ad('0x2'));var timeout=require(_0x59ad('0x3'));var express=require(_0x59ad('0x4'));var router=express['Router']();var fs_extra=require(_0x59ad('0x5'));var auth=require(_0x59ad('0x6'));var interaction=require(_0x59ad('0x7'));var config=require(_0x59ad('0x8'));var controller=require(_0x59ad('0x9'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x59ad('0xa')]);router[_0x59ad('0xb')]('/',auth[_0x59ad('0xc')](),controller[_0x59ad('0xd')]);router['put'](_0x59ad('0xe'),auth['isAuthenticated'](),controller[_0x59ad('0xf')]);router[_0x59ad('0x10')](_0x59ad('0xe'),auth[_0x59ad('0xc')](),controller[_0x59ad('0x11')]);module[_0x59ad('0x12')]=router; \ No newline at end of file +var _0x8d18=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x214d54,_0x133c72){var _0x44ca46=function(_0xe42b02){while(--_0xe42b02){_0x214d54['push'](_0x214d54['shift']());}};_0x44ca46(++_0x133c72);}(_0x8d18,0x1c7));var _0x88d1=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0x8d18[_0x6dd5c];return _0x5a87fa;};'use strict';var multer=require(_0x88d1('0x0'));var util=require(_0x88d1('0x1'));var path=require('path');var timeout=require(_0x88d1('0x2'));var express=require(_0x88d1('0x3'));var router=express['Router']();var fs_extra=require(_0x88d1('0x4'));var auth=require(_0x88d1('0x5'));var interaction=require(_0x88d1('0x6'));var config=require(_0x88d1('0x7'));var controller=require(_0x88d1('0x8'));router[_0x88d1('0x9')](_0x88d1('0xa'),auth[_0x88d1('0xb')](),controller[_0x88d1('0xc')]);router[_0x88d1('0xd')]('/',auth[_0x88d1('0xb')](),controller[_0x88d1('0xe')]);router[_0x88d1('0xf')](_0x88d1('0xa'),auth[_0x88d1('0xb')](),controller[_0x88d1('0x10')]);router[_0x88d1('0x11')](_0x88d1('0xa'),auth[_0x88d1('0xb')](),controller[_0x88d1('0x12')]);module[_0x88d1('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 5299c0d..7723869 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 _0x039b=['sequelize','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2cba09,_0x23ee85){var _0x10d084=function(_0x11d2e4){while(--_0x11d2e4){_0x2cba09['push'](_0x2cba09['shift']());}};_0x10d084(++_0x23ee85);}(_0x039b,0x11a));var _0xb039=function(_0x13e60c,_0x1d7510){_0x13e60c=_0x13e60c-0x0;var _0x51d294=_0x039b[_0x13e60c];return _0x51d294;};'use strict';var Sequelize=require(_0xb039('0x0'));module['exports']={'name':{'type':Sequelize[_0xb039('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb039('0x1')]},'timeout':{'type':Sequelize[_0xb039('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb039('0x3')](_0xb039('0x4'),_0xb039('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x72c5=['roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x3b5e77,_0x44bac9){var _0x4facf9=function(_0x3f6634){while(--_0x3f6634){_0x3b5e77['push'](_0x3b5e77['shift']());}};_0x4facf9(++_0x44bac9);}(_0x72c5,0x1bd));var _0x572c=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0x72c5[_0x398294];return _0x2a872d;};'use strict';var Sequelize=require(_0x572c('0x0'));module[_0x572c('0x1')]={'name':{'type':Sequelize[_0x572c('0x2')],'unique':_0x572c('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x572c('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x572c('0x4')]('rrmemory','beepall',_0x572c('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index a199304..0716cfc 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 _0x1ae7=['flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','select','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','all','union','value','removeTeams','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','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','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ChatQueue','findAll','rows','show','params','rawAttributes','length','create','body','user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','ids','Agents','online','voicePause','interface'];(function(_0x14ea69,_0x713c2f){var _0x34e64d=function(_0x377681){while(--_0x377681){_0x14ea69['push'](_0x14ea69['shift']());}};_0x34e64d(++_0x713c2f);}(_0x1ae7,0x150));var _0x71ae=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x1ae7[_0xc6be3a];return _0x56a310;};'use strict';var emlformat=require(_0x71ae('0x0'));var rimraf=require(_0x71ae('0x1'));var zipdir=require(_0x71ae('0x2'));var jsonpatch=require(_0x71ae('0x3'));var rp=require('request-promise');var moment=require(_0x71ae('0x4'));var BPromise=require(_0x71ae('0x5'));var Mustache=require(_0x71ae('0x6'));var util=require(_0x71ae('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x71ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71ae('0x9'));var _=require(_0x71ae('0xa'));var squel=require(_0x71ae('0xb'));var crypto=require(_0x71ae('0xc'));var jsforce=require(_0x71ae('0xd'));var deskjs=require(_0x71ae('0xe'));var toCsv=require(_0x71ae('0x8'));var querystring=require(_0x71ae('0xf'));var Papa=require(_0x71ae('0x10'));var Redis=require(_0x71ae('0x11'));var authService=require(_0x71ae('0x12'));var qs=require(_0x71ae('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x71ae('0x14'));var logger=require(_0x71ae('0x15'))(_0x71ae('0x16'));var utils=require(_0x71ae('0x17'));var config=require(_0x71ae('0x18'));var licenseUtil=require(_0x71ae('0x19'));var db=require(_0x71ae('0x1a'))['db'];config[_0x71ae('0x1b')]=_[_0x71ae('0x1c')](config[_0x71ae('0x1b')],{'host':_0x71ae('0x1d'),'port':0x18eb});var socket=require(_0x71ae('0x1e'))(new Redis(config[_0x71ae('0x1b')]));require(_0x71ae('0x1f'))['register'](socket);var jayson=require(_0x71ae('0x20'));var client=jayson[_0x71ae('0x21')][_0x71ae('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x5bebee,_0x506dda,_0x5aa49d,_0x2a21df){return new BPromise(function(_0x234765,_0x12f13f){var _0x1b1005=_0x2a21df||client;return _0x1b1005['request'](_0x5bebee,_0x5aa49d)[_0x71ae('0x23')](function(_0x2614fa){logger[_0x71ae('0x24')](_0x71ae('0x25'),_0x506dda,_0x71ae('0x26'));logger[_0x71ae('0x27')](_0x71ae('0x28'),_0x506dda,_0x71ae('0x26'),JSON[_0x71ae('0x29')](_0x2614fa));if(_0x2614fa[_0x71ae('0x2a')]){if(_0x2614fa[_0x71ae('0x2a')][_0x71ae('0x2b')]===0x1f4){logger[_0x71ae('0x2a')](_0x71ae('0x25'),_0x506dda,_0x2614fa[_0x71ae('0x2a')][_0x71ae('0x2c')]);return _0x12f13f(_0x2614fa[_0x71ae('0x2a')]['message']);}logger[_0x71ae('0x2a')](_0x71ae('0x25'),_0x506dda,_0x2614fa[_0x71ae('0x2a')]['message']);return _0x234765(_0x2614fa[_0x71ae('0x2a')]['message']);}else{logger[_0x71ae('0x24')](_0x71ae('0x25'),_0x506dda,_0x71ae('0x26'));_0x234765(_0x2614fa['result'][_0x71ae('0x2c')]);}})[_0x71ae('0x2d')](function(_0x599be1){logger[_0x71ae('0x2a')](_0x71ae('0x25'),_0x506dda,_0x599be1);_0x12f13f(_0x599be1);});});}function respondWithStatusCode(_0x3eac79,_0x2db8c0){_0x2db8c0=_0x2db8c0||0xcc;return function(_0x1f3613){if(_0x1f3613){return _0x3eac79[_0x71ae('0x2e')](_0x2db8c0);}return _0x3eac79[_0x71ae('0x2f')](_0x2db8c0)[_0x71ae('0x30')]();};}function respondWithResult(_0x3ef7d2,_0x22061d){_0x22061d=_0x22061d||0xc8;return function(_0x4c0192){if(_0x4c0192){return _0x3ef7d2['status'](_0x22061d)[_0x71ae('0x31')](_0x4c0192);}};}function respondWithFilteredResult(_0x5b58bd,_0x41306a){return function(_0x451736){if(_0x451736){var _0x2c92ec=typeof _0x41306a[_0x71ae('0x32')]==='undefined'&&typeof _0x41306a[_0x71ae('0x33')]===_0x71ae('0x34');var _0x5eeca4=_0x451736['count'];var _0x1cbcff=_0x2c92ec?0x0:_0x41306a[_0x71ae('0x32')];var _0x5423f4=_0x2c92ec?_0x451736[_0x71ae('0x35')]:_0x41306a[_0x71ae('0x32')]+_0x41306a[_0x71ae('0x33')];var _0x5e5220;if(_0x5423f4>=_0x5eeca4){_0x5423f4=_0x5eeca4;_0x5e5220=0xc8;}else{_0x5e5220=0xce;}_0x5b58bd[_0x71ae('0x2f')](_0x5e5220);return _0x5b58bd[_0x71ae('0x36')]('Content-Range',_0x1cbcff+'-'+_0x5423f4+'/'+_0x5eeca4)[_0x71ae('0x31')](_0x451736);}return null;};}function patchUpdates(_0x12b7aa){return function(_0x31988f){try{jsonpatch['apply'](_0x31988f,_0x12b7aa,!![]);}catch(_0x211042){return BPromise[_0x71ae('0x37')](_0x211042);}return _0x31988f[_0x71ae('0x38')]();};}function saveUpdates(_0x3b30a8,_0x405bd6){return function(_0x8b276f){if(_0x8b276f){return _0x8b276f[_0x71ae('0x39')](_0x3b30a8)[_0x71ae('0x23')](function(_0x4278f8){return _0x4278f8;});}return null;};}function removeEntity(_0x3117e5,_0x4605f4){return function(_0x30b5bc){if(_0x30b5bc){return _0x30b5bc[_0x71ae('0x3a')]()[_0x71ae('0x23')](function(){var _0x2ccf7a=_0x30b5bc[_0x71ae('0x3b')]({'plain':!![]});var _0x4b2dd1=_0x71ae('0x3c');return db[_0x71ae('0x3d')][_0x71ae('0x3a')]({'where':{'type':_0x4b2dd1,'resourceId':_0x2ccf7a['id']}})[_0x71ae('0x23')](function(){return _0x30b5bc;});})[_0x71ae('0x23')](function(){_0x3117e5[_0x71ae('0x2f')](0xcc)[_0x71ae('0x30')]();});}};}function handleEntityNotFound(_0x28563c,_0x3fc95b){return function(_0x3c0e1d){if(!_0x3c0e1d){_0x28563c[_0x71ae('0x2e')](0x194);}return _0x3c0e1d;};}function handleError(_0x2d273a,_0x31ce90){_0x31ce90=_0x31ce90||0x1f4;return function(_0x5eff0c){logger[_0x71ae('0x2a')](_0x5eff0c[_0x71ae('0x3e')]);if(_0x5eff0c[_0x71ae('0x3f')]){delete _0x5eff0c[_0x71ae('0x3f')];}_0x2d273a[_0x71ae('0x2f')](_0x31ce90)[_0x71ae('0x40')](_0x5eff0c);};}exports[_0x71ae('0x41')]=function(_0x3a97e7,_0x4ffd83){var _0xc0ab9d={},_0xb3d83d={},_0x10deba={'count':0x0,'rows':[]};var _0x3f9f1b=_[_0x71ae('0x42')](db['ChatQueue']['rawAttributes'],function(_0x30f903){return{'name':_0x30f903['fieldName'],'type':_0x30f903[_0x71ae('0x43')][_0x71ae('0x44')]};});_0xb3d83d[_0x71ae('0x45')]=_['map'](_0x3f9f1b,_0x71ae('0x3f'));_0xb3d83d['query']=_[_0x71ae('0x46')](_0x3a97e7[_0x71ae('0x47')]);_0xb3d83d[_0x71ae('0x48')]=_[_0x71ae('0x49')](_0xb3d83d[_0x71ae('0x45')],_0xb3d83d['query']);_0xc0ab9d[_0x71ae('0x4a')]=_[_0x71ae('0x49')](_0xb3d83d['model'],qs[_0x71ae('0x4b')](_0x3a97e7[_0x71ae('0x47')][_0x71ae('0x4b')]));_0xc0ab9d[_0x71ae('0x4a')]=_0xc0ab9d[_0x71ae('0x4a')]['length']?_0xc0ab9d[_0x71ae('0x4a')]:_0xb3d83d[_0x71ae('0x45')];if(!_0x3a97e7[_0x71ae('0x47')][_0x71ae('0x4c')](_0x71ae('0x4d'))){_0xc0ab9d[_0x71ae('0x33')]=qs[_0x71ae('0x33')](_0x3a97e7[_0x71ae('0x47')][_0x71ae('0x33')]);_0xc0ab9d[_0x71ae('0x32')]=qs[_0x71ae('0x32')](_0x3a97e7[_0x71ae('0x47')][_0x71ae('0x32')]);}_0xc0ab9d[_0x71ae('0x4e')]=qs[_0x71ae('0x4f')](_0x3a97e7[_0x71ae('0x47')][_0x71ae('0x4f')]);_0xc0ab9d[_0x71ae('0x50')]=qs['filters'](_[_0x71ae('0x51')](_0x3a97e7['query'],_0xb3d83d['filters']),_0x3f9f1b);if(_0x3a97e7[_0x71ae('0x47')][_0x71ae('0x52')]){_0xc0ab9d[_0x71ae('0x50')]=_[_0x71ae('0x53')](_0xc0ab9d[_0x71ae('0x50')],{'$or':_[_0x71ae('0x42')](_0x3f9f1b,function(_0x58f65b){if(_0x58f65b['type']!==_0x71ae('0x54')){var _0x5abb21={};_0x5abb21[_0x58f65b['name']]={'$like':'%'+_0x3a97e7['query'][_0x71ae('0x52')]+'%'};return _0x5abb21;}})});}_0xc0ab9d=_['merge']({},_0xc0ab9d,_0x3a97e7[_0x71ae('0x55')]);var _0x95dab7={'where':_0xc0ab9d[_0x71ae('0x50')]};return db['ChatQueue'][_0x71ae('0x35')](_0x95dab7)[_0x71ae('0x23')](function(_0x419395){_0x10deba['count']=_0x419395;if(_0x3a97e7[_0x71ae('0x47')][_0x71ae('0x56')]){_0xc0ab9d[_0x71ae('0x57')]=[{'all':!![]}];}return db[_0x71ae('0x58')][_0x71ae('0x59')](_0xc0ab9d);})[_0x71ae('0x23')](function(_0x375cfa){_0x10deba[_0x71ae('0x5a')]=_0x375cfa;return _0x10deba;})[_0x71ae('0x23')](respondWithFilteredResult(_0x4ffd83,_0xc0ab9d))[_0x71ae('0x2d')](handleError(_0x4ffd83,null));};exports[_0x71ae('0x5b')]=function(_0x3fd4ca,_0x44d2b0){var _0xaceb09={'raw':!![],'where':{'id':_0x3fd4ca[_0x71ae('0x5c')]['id']}},_0x387e8e={};_0x387e8e[_0x71ae('0x45')]=_[_0x71ae('0x46')](db['ChatQueue'][_0x71ae('0x5d')]);_0x387e8e[_0x71ae('0x47')]=_['keys'](_0x3fd4ca['query']);_0x387e8e[_0x71ae('0x48')]=_['intersection'](_0x387e8e[_0x71ae('0x45')],_0x387e8e['query']);_0xaceb09[_0x71ae('0x4a')]=_[_0x71ae('0x49')](_0x387e8e[_0x71ae('0x45')],qs['fields'](_0x3fd4ca['query']['fields']));_0xaceb09[_0x71ae('0x4a')]=_0xaceb09[_0x71ae('0x4a')][_0x71ae('0x5e')]?_0xaceb09['attributes']:_0x387e8e[_0x71ae('0x45')];if(_0x3fd4ca['query'][_0x71ae('0x56')]){_0xaceb09[_0x71ae('0x57')]=[{'all':!![]}];}_0xaceb09=_[_0x71ae('0x53')]({},_0xaceb09,_0x3fd4ca[_0x71ae('0x55')]);return db[_0x71ae('0x58')]['find'](_0xaceb09)[_0x71ae('0x23')](handleEntityNotFound(_0x44d2b0,null))['then'](respondWithResult(_0x44d2b0,null))[_0x71ae('0x2d')](handleError(_0x44d2b0,null));};exports[_0x71ae('0x5f')]=function(_0x2e8589,_0x29869a){return db[_0x71ae('0x58')][_0x71ae('0x5f')](_0x2e8589[_0x71ae('0x60')],{})[_0x71ae('0x23')](function(_0x46c9da){var _0x59d0e4=_0x2e8589[_0x71ae('0x61')][_0x71ae('0x3b')]({'plain':!![]});if(!_0x59d0e4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59d0e4[_0x71ae('0x62')]===_0x71ae('0x61')){var _0xc57a6a=_0x46c9da[_0x71ae('0x3b')]({'plain':!![]});var _0x3cd6a8=_0x71ae('0x3c');return db[_0x71ae('0x63')][_0x71ae('0x64')]({'where':{'name':_0x3cd6a8,'userProfileId':_0x59d0e4[_0x71ae('0x65')]},'raw':!![]})['then'](function(_0x253d2b){if(_0x253d2b&&_0x253d2b['autoAssociation']===0x0){return db[_0x71ae('0x3d')][_0x71ae('0x5f')]({'name':_0xc57a6a[_0x71ae('0x3f')],'resourceId':_0xc57a6a['id'],'type':_0x253d2b['name'],'sectionId':_0x253d2b['id']},{})[_0x71ae('0x23')](function(){return _0x46c9da;});}else{return _0x46c9da;}})[_0x71ae('0x2d')](function(_0x174af8){logger[_0x71ae('0x2a')](_0x71ae('0x66'),_0x174af8);throw _0x174af8;});}return _0x46c9da;})[_0x71ae('0x23')](respondWithResult(_0x29869a,0xc9))['catch'](handleError(_0x29869a,null));};exports[_0x71ae('0x39')]=function(_0x43f879,_0x529f8c){if(_0x43f879[_0x71ae('0x60')]['id']){delete _0x43f879[_0x71ae('0x60')]['id'];}return db[_0x71ae('0x58')][_0x71ae('0x64')]({'where':{'id':_0x43f879[_0x71ae('0x5c')]['id']}})['then'](handleEntityNotFound(_0x529f8c,null))[_0x71ae('0x23')](saveUpdates(_0x43f879['body'],null))[_0x71ae('0x23')](respondWithResult(_0x529f8c,null))[_0x71ae('0x2d')](handleError(_0x529f8c,null));};exports[_0x71ae('0x3a')]=function(_0x2b4706,_0x5c1e7d){return db['ChatQueue'][_0x71ae('0x64')]({'where':{'id':_0x2b4706[_0x71ae('0x5c')]['id']}})[_0x71ae('0x23')](handleEntityNotFound(_0x5c1e7d,null))[_0x71ae('0x23')](removeEntity(_0x5c1e7d,null))['catch'](handleError(_0x5c1e7d,null));};exports[_0x71ae('0x67')]=function(_0xbfb725,_0x2f7299){return db[_0x71ae('0x58')]['describe']()[_0x71ae('0x23')](respondWithResult(_0x2f7299,null))[_0x71ae('0x2d')](handleError(_0x2f7299,null));};exports[_0x71ae('0x68')]=function(_0x26bb70,_0x47012c,_0x385300){var _0x328ef6={'raw':!![],'where':{}},_0x29fa38={},_0x2fb151;return db[_0x71ae('0x58')][_0x71ae('0x69')]({'where':{'id':_0x26bb70['params']['id']}})['then'](handleEntityNotFound(_0x47012c,null))[_0x71ae('0x23')](function(_0x17d12a){if(_0x17d12a){_0x2fb151=_0x17d12a[_0x71ae('0x3b')]({'plain':!![]});_0x29fa38[_0x71ae('0x45')]=_[_0x71ae('0x46')](db[_0x71ae('0x6a')]['rawAttributes']);_0x29fa38[_0x71ae('0x47')]=_[_0x71ae('0x46')](_0x26bb70['query']);_0x29fa38[_0x71ae('0x48')]=_[_0x71ae('0x49')](_0x29fa38[_0x71ae('0x45')],_0x29fa38[_0x71ae('0x47')]);_0x328ef6[_0x71ae('0x4a')]=_[_0x71ae('0x49')](_0x29fa38[_0x71ae('0x45')],qs[_0x71ae('0x4b')](_0x26bb70[_0x71ae('0x47')][_0x71ae('0x4b')]));_0x328ef6[_0x71ae('0x4a')]=_0x328ef6[_0x71ae('0x4a')]['length']?_0x328ef6[_0x71ae('0x4a')]:_0x29fa38['model'];if(!_0x26bb70[_0x71ae('0x47')][_0x71ae('0x4c')](_0x71ae('0x4d'))){_0x328ef6[_0x71ae('0x33')]=qs[_0x71ae('0x33')](_0x26bb70[_0x71ae('0x47')][_0x71ae('0x33')]);_0x328ef6[_0x71ae('0x32')]=qs[_0x71ae('0x32')](_0x26bb70[_0x71ae('0x47')][_0x71ae('0x32')]);}_0x328ef6['order']=qs['sort'](_0x26bb70['query'][_0x71ae('0x4f')]);_0x328ef6[_0x71ae('0x50')]=qs[_0x71ae('0x48')](_['pick'](_0x26bb70[_0x71ae('0x47')],_0x29fa38[_0x71ae('0x48')]));_0x328ef6['where'][_0x71ae('0x6b')]=_0x17d12a['id'];if(_0x26bb70[_0x71ae('0x47')][_0x71ae('0x52')]){_0x328ef6[_0x71ae('0x50')]=_['merge'](_0x328ef6[_0x71ae('0x50')],{'$or':_[_0x71ae('0x42')](_0x328ef6[_0x71ae('0x4a')],function(_0x4122f8){var _0x49ed23={};_0x49ed23[_0x4122f8]={'$like':'%'+_0x26bb70[_0x71ae('0x47')]['filter']+'%'};return _0x49ed23;})});}_0x328ef6=_[_0x71ae('0x53')]({},_0x328ef6,_0x26bb70[_0x71ae('0x55')]);return db[_0x71ae('0x6a')]['findAll'](_0x328ef6);}})[_0x71ae('0x23')](function(_0x40aed0){if(_0x40aed0){return db[_0x71ae('0x6c')][_0x71ae('0x6d')]({'where':{'id':_[_0x71ae('0x42')](_0x40aed0,_0x71ae('0x6e')),'role':'agent'},'attributes':['id',_0x71ae('0x3f'),_0x71ae('0x6f'),_0x71ae('0x70'),_0x71ae('0x71')]});}})[_0x71ae('0x23')](function(_0x22ab88){if(_0x22ab88){return{'count':_0x22ab88[_0x71ae('0x35')],'rows':_[_0x71ae('0x42')](_0x22ab88[_0x71ae('0x5a')],function(_0x317b9f){return{'membername':_0x317b9f['name'],'UserId':_0x317b9f['id'],'queue_name':_0x2fb151[_0x71ae('0x3f')],'ChatQueueId':_0x2fb151['id'],'interface':util[_0x71ae('0x72')](_0x71ae('0x73'),'SIP',_0x317b9f['name']),'penalty':0x0,'paused':_0x317b9f['chatPause'],'createdAt':_0x317b9f['createdAt'],'updatedAt':_0x317b9f[_0x71ae('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x71ae('0x23')](respondWithFilteredResult(_0x47012c,_0x328ef6))[_0x71ae('0x2d')](handleError(_0x47012c,null));};exports[_0x71ae('0x74')]=function(_0x41090f,_0x4f94b0,_0x536ddc){var _0x5bc875={};var _0x123b30={};var _0x95fb83;var _0x20032b;return db[_0x71ae('0x58')][_0x71ae('0x69')]({'where':{'id':_0x41090f[_0x71ae('0x5c')]['id']}})[_0x71ae('0x23')](handleEntityNotFound(_0x4f94b0,null))['then'](function(_0x326b2e){if(_0x326b2e){_0x95fb83=_0x326b2e;_0x123b30['model']=_[_0x71ae('0x46')](db[_0x71ae('0x75')][_0x71ae('0x5d')]);_0x123b30[_0x71ae('0x47')]=_[_0x71ae('0x46')](_0x41090f[_0x71ae('0x47')]);_0x123b30[_0x71ae('0x48')]=_['intersection'](_0x123b30[_0x71ae('0x45')],_0x123b30['query']);_0x5bc875[_0x71ae('0x4a')]=_['intersection'](_0x123b30[_0x71ae('0x45')],qs[_0x71ae('0x4b')](_0x41090f['query'][_0x71ae('0x4b')]));_0x5bc875[_0x71ae('0x4a')]=_0x5bc875['attributes'][_0x71ae('0x5e')]?_0x5bc875['attributes']:_0x123b30[_0x71ae('0x45')];_0x5bc875[_0x71ae('0x4e')]=qs[_0x71ae('0x4f')](_0x41090f[_0x71ae('0x47')]['sort']);_0x5bc875[_0x71ae('0x50')]=qs['filters'](_['pick'](_0x41090f[_0x71ae('0x47')],_0x123b30['filters']));if(_0x41090f[_0x71ae('0x47')][_0x71ae('0x52')]){_0x5bc875[_0x71ae('0x50')]=_[_0x71ae('0x53')](_0x5bc875['where'],{'$or':_[_0x71ae('0x42')](_0x5bc875[_0x71ae('0x4a')],function(_0x214762){var _0x3a08e1={};_0x3a08e1[_0x214762]={'$like':'%'+_0x41090f['query'][_0x71ae('0x52')]+'%'};return _0x3a08e1;})});}_0x5bc875=_[_0x71ae('0x53')]({},_0x5bc875,_0x41090f[_0x71ae('0x55')]);return _0x95fb83[_0x71ae('0x74')](_0x5bc875);}})[_0x71ae('0x23')](function(_0x599b4b){if(_0x599b4b){_0x20032b=_0x599b4b['length'];if(!_0x41090f[_0x71ae('0x47')][_0x71ae('0x4c')]('nolimit')){_0x5bc875[_0x71ae('0x33')]=qs[_0x71ae('0x33')](_0x41090f[_0x71ae('0x47')][_0x71ae('0x33')]);_0x5bc875['offset']=qs['offset'](_0x41090f['query']['offset']);}return _0x95fb83[_0x71ae('0x74')](_0x5bc875);}})[_0x71ae('0x23')](function(_0x28cfba){if(_0x28cfba){return _0x28cfba?{'count':_0x20032b,'rows':_0x28cfba}:null;}})['then'](respondWithResult(_0x4f94b0,null))['catch'](handleError(_0x4f94b0,null));};exports['addTeams']=function(_0xa59df7,_0x249283,_0x2b1b17){var _0x2bf17b=_0xa59df7[_0x71ae('0x60')][_0x71ae('0x76')];return db['Team'][_0x71ae('0x59')]({'where':{'id':_0x2bf17b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x71ae('0x77'),'attributes':['id',_0x71ae('0x3f'),_0x71ae('0x78'),_0x71ae('0x79'),_0x71ae('0x7a')],'raw':!![]}]})[_0x71ae('0x23')](function(_0x4b8cfa){if(_0x4b8cfa){var _0x428348=_[_0x71ae('0x7b')](_0x4b8cfa,function(_0x19053e){var _0x370678=_0x19053e['get']({'plain':!![]});return _0x370678[_0x71ae('0x77')];});return db['ChatQueue'][_0x71ae('0x64')]({'where':{'id':_0xa59df7[_0x71ae('0x5c')]['id']}})[_0x71ae('0x23')](function(_0x598019){return db[_0x71ae('0x7c')][_0x71ae('0x7d')](function(_0x13d9b6){return _0x598019[_0x71ae('0x7e')](_0x2bf17b,{'transaction':_0x13d9b6})[_0x71ae('0x23')](function(){return BPromise[_0x71ae('0x7f')](_0x428348,function(_0xff652d){return db[_0x71ae('0x6a')][_0x71ae('0x80')]({'where':{'UserId':_0xff652d['id'],'ChatQueueId':_0xa59df7[_0x71ae('0x5c')]['id']},'transaction':_0x13d9b6});});})['then'](function(){_0x428348[_0x71ae('0x81')](function(_0x99bfca){socket[_0x71ae('0x82')](_0x71ae('0x83'),{'UserId':_0x99bfca['id'],'ChatQueueId':_0x598019['id']});});});});});}})[_0x71ae('0x23')](respondWithStatusCode(_0x249283,null))[_0x71ae('0x2d')](handleError(_0x249283,null));};exports['removeTeams']=function(_0xaa6204,_0x32210f,_0x402bbe){return db['Team'][_0x71ae('0x59')]({'where':{'id':_0xaa6204[_0x71ae('0x47')][_0x71ae('0x76')]},'attributes':['id'],'include':[{'model':db[_0x71ae('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x71ae('0x23')](handleEntityNotFound(_0x32210f,null))[_0x71ae('0x23')](function(_0xb7828f){var _0x4f1cd5=_[_0x71ae('0x42')](_0xb7828f,'id');var _0x256422=[];var _0x38ba2d=[];var _0x3c5120=squel[_0x71ae('0x84')]();_0x3c5120['field'](_0x71ae('0x85'))[_0x71ae('0x86')](_0x71ae('0x87'),'tq')[_0x71ae('0x88')]('user_has_teams','ut',_0x71ae('0x89'))[_0x71ae('0x50')]('ChatQueueId\x20=\x20?',_0xaa6204[_0x71ae('0x5c')]['id']);for(var _0x4f2ee9=0x0;_0x4f2ee9<_0xb7828f[_0x71ae('0x5e')];_0x4f2ee9+=0x1){let _0x3bac7a=_0xb7828f[_0x4f2ee9];for(var _0x150d77=0x0;_0x150d77<_0x3bac7a['Agents'][_0x71ae('0x5e')];_0x150d77+=0x1){let _0x5d6146=_0x3bac7a[_0x71ae('0x77')][_0x150d77];var _0x50332a=_0x3c5120['clone']();_0x50332a[_0x71ae('0x50')](_0x71ae('0x8a'),_0x5d6146['id']);_0x38ba2d['push'](db[_0x71ae('0x7c')][_0x71ae('0x47')](_0x50332a[_0x71ae('0x8b')](),{'type':db[_0x71ae('0x7c')]['QueryTypes'][_0x71ae('0x8c')]})['then'](function(_0x4a2a52){if(_0x4a2a52[_0x71ae('0x5e')]===0x1){return _0x5d6146['id'];}else{var _0x1d4a4d=_[_0x71ae('0x8d')](_['map'](_0x4a2a52,'TeamId'),function(_0x1e137a){return _['includes'](_0x4f1cd5,_0x1e137a);});if(_0x1d4a4d){return _0x5d6146['id'];}}}));}}return BPromise[_0x71ae('0x8e')](_0x38ba2d)[_0x71ae('0x23')](function(_0x5ebf2e){_0x256422=_(_0x256422)[_0x71ae('0x8f')](_0x5ebf2e)['compact']()[_0x71ae('0x90')]();return db[_0x71ae('0x58')][_0x71ae('0x64')]({'where':{'id':_0xaa6204[_0x71ae('0x5c')]['id']}})['then'](function(_0x31e314){return db[_0x71ae('0x7c')][_0x71ae('0x7d')](function(_0x4c5f0b){return _0x31e314[_0x71ae('0x91')](_0xaa6204[_0x71ae('0x47')][_0x71ae('0x76')],{'transaction':_0x4c5f0b})[_0x71ae('0x23')](function(){if(!_['isEmpty'](_0x256422)){return _0x31e314[_0x71ae('0x92')](_0x256422,{'transaction':_0x4c5f0b});}})[_0x71ae('0x23')](function(){_0x256422[_0x71ae('0x81')](function(_0x8ccdbb){socket['emit']('userChatQueue:remove',{'UserId':_0x8ccdbb,'ChatQueueId':_0x31e314['id']});});});});});});})[_0x71ae('0x23')](respondWithStatusCode(_0x32210f,null))[_0x71ae('0x2d')](handleError(_0x32210f,null));};exports[_0x71ae('0x93')]=function(_0x1a1368,_0x17e915,_0x3e47a3){return db['ChatQueue']['find']({'where':{'id':_0x1a1368[_0x71ae('0x5c')]['id']}})['then'](handleEntityNotFound(_0x17e915,null))[_0x71ae('0x23')](function(_0x124759){if(_0x124759){return _0x124759[_0x71ae('0x93')](_0x1a1368[_0x71ae('0x60')][_0x71ae('0x76')],_[_0x71ae('0x94')](_0x1a1368['body'],['ids','id'])||{})[_0x71ae('0x95')](function(_0x3d1df8){for(var _0x3aeab6=0x0;_0x3aeab6<_0x1a1368[_0x71ae('0x60')]['ids'][_0x71ae('0x5e')];_0x3aeab6+=0x1){socket[_0x71ae('0x82')](_0x71ae('0x83'),{'UserId':_0x1a1368[_0x71ae('0x60')]['ids'][_0x3aeab6],'ChatQueueId':_0x1a1368['params']['id']});}return _0x3d1df8;});}})[_0x71ae('0x23')](respondWithResult(_0x17e915,null))[_0x71ae('0x2d')](handleError(_0x17e915,null));};exports[_0x71ae('0x92')]=function(_0x252312,_0x12003a,_0x7aac1b){return db['ChatQueue'][_0x71ae('0x64')]({'where':{'id':_0x252312[_0x71ae('0x5c')]['id']}})[_0x71ae('0x23')](handleEntityNotFound(_0x12003a,null))[_0x71ae('0x23')](function(_0x225668){if(_0x225668){return _0x225668[_0x71ae('0x92')](_0x252312[_0x71ae('0x47')]['ids'])['then'](function(){if(_[_0x71ae('0x96')](_0x252312[_0x71ae('0x47')][_0x71ae('0x76')])){for(var _0x2bf061=0x0;_0x2bf061<_0x252312[_0x71ae('0x47')][_0x71ae('0x76')][_0x71ae('0x5e')];_0x2bf061+=0x1){socket[_0x71ae('0x82')](_0x71ae('0x97'),{'UserId':Number(_0x252312[_0x71ae('0x47')][_0x71ae('0x76')][_0x2bf061]),'ChatQueueId':Number(_0x252312[_0x71ae('0x5c')]['id'])});}}else{socket[_0x71ae('0x82')]('userChatQueue:remove',{'UserId':Number(_0x252312['query'][_0x71ae('0x76')]),'ChatQueueId':Number(_0x252312['params']['id'])});}});}})['then'](respondWithStatusCode(_0x12003a,null))['catch'](handleError(_0x12003a,null));};exports[_0x71ae('0x98')]=function(_0x35a94a,_0x35034b,_0x255ba1){var _0x466875={};var _0x297c84={};var _0x54b0de;var _0x518fdf;return db[_0x71ae('0x58')][_0x71ae('0x69')]({'where':{'id':_0x35a94a[_0x71ae('0x5c')]['id']}})['then'](handleEntityNotFound(_0x35034b,null))[_0x71ae('0x23')](function(_0x3aa3ca){if(_0x3aa3ca){_0x54b0de=_0x3aa3ca;_0x297c84['model']=_[_0x71ae('0x46')](db[_0x71ae('0x6c')][_0x71ae('0x5d')]);_0x297c84[_0x71ae('0x47')]=_[_0x71ae('0x46')](_0x35a94a['query']);_0x297c84[_0x71ae('0x48')]=_[_0x71ae('0x49')](_0x297c84['model'],_0x297c84[_0x71ae('0x47')]);_0x466875['attributes']=_[_0x71ae('0x49')](_0x297c84[_0x71ae('0x45')],qs[_0x71ae('0x4b')](_0x35a94a['query'][_0x71ae('0x4b')]));_0x466875[_0x71ae('0x4a')]=_0x466875[_0x71ae('0x4a')][_0x71ae('0x5e')]?_0x466875[_0x71ae('0x4a')]:_0x297c84['model'];_0x466875[_0x71ae('0x4e')]=qs[_0x71ae('0x4f')](_0x35a94a['query'][_0x71ae('0x4f')]);_0x466875[_0x71ae('0x50')]=qs['filters'](_[_0x71ae('0x51')](_0x35a94a['query'],_0x297c84[_0x71ae('0x48')]));if(_0x35a94a[_0x71ae('0x47')]['filter']){_0x466875[_0x71ae('0x50')]=_[_0x71ae('0x53')](_0x466875[_0x71ae('0x50')],{'$or':_[_0x71ae('0x42')](_0x466875[_0x71ae('0x4a')],function(_0x5a6972){var _0x49f6f8={};_0x49f6f8[_0x5a6972]={'$like':'%'+_0x35a94a[_0x71ae('0x47')]['filter']+'%'};return _0x49f6f8;})});}_0x466875=_['merge']({},_0x466875,_0x35a94a['options']);return _0x54b0de[_0x71ae('0x98')](_0x466875);}})[_0x71ae('0x23')](function(_0x53ade8){if(_0x53ade8){_0x518fdf=_0x53ade8[_0x71ae('0x5e')];if(!_0x35a94a['query'][_0x71ae('0x4c')](_0x71ae('0x4d'))){_0x466875[_0x71ae('0x33')]=qs[_0x71ae('0x33')](_0x35a94a[_0x71ae('0x47')]['limit']);_0x466875['offset']=qs[_0x71ae('0x32')](_0x35a94a['query'][_0x71ae('0x32')]);}return _0x54b0de[_0x71ae('0x98')](_0x466875);}})['then'](function(_0x314742){if(_0x314742){return _0x314742?{'count':_0x518fdf,'rows':_0x314742}:null;}})[_0x71ae('0x23')](respondWithResult(_0x35034b,null))[_0x71ae('0x2d')](handleError(_0x35034b,null));}; \ No newline at end of file +var _0x2563=['./chatQueue.socket','register','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','limit','undefined','count','offset','apply','reject','save','update','destroy','ChatQueues','UserProfileResource','name','index','map','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','ChatQueue','includeAll','include','findAll','show','params','keys','rawAttributes','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','getTeams','Team','length','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','ids','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','value','removeAgents','forEach','userChatQueue:remove','omit','spread','isArray','getAgents','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x2a223d,_0x44440f){var _0x321b4f=function(_0x26173a){while(--_0x26173a){_0x2a223d['push'](_0x2a223d['shift']());}};_0x321b4f(++_0x44440f);}(_0x2563,0x75));var _0x3256=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2563[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3256('0x0'));var rimraf=require(_0x3256('0x1'));var zipdir=require(_0x3256('0x2'));var jsonpatch=require(_0x3256('0x3'));var rp=require(_0x3256('0x4'));var moment=require(_0x3256('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3256('0x6'));var util=require(_0x3256('0x7'));var path=require('path');var sox=require(_0x3256('0x8'));var csv=require(_0x3256('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3256('0xa'));var _=require(_0x3256('0xb'));var squel=require(_0x3256('0xc'));var crypto=require(_0x3256('0xd'));var jsforce=require(_0x3256('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3256('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3256('0x10'));var hardwareService=require(_0x3256('0x11'));var logger=require(_0x3256('0x12'))(_0x3256('0x13'));var utils=require(_0x3256('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3256('0x15'));var db=require(_0x3256('0x16'))['db'];config[_0x3256('0x17')]=_['defaults'](config[_0x3256('0x17')],{'host':_0x3256('0x18'),'port':0x18eb});var socket=require(_0x3256('0x19'))(new Redis(config['redis']));require(_0x3256('0x1a'))[_0x3256('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3256('0x1c')][_0x3256('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3e2b42,_0x5082df,_0x3ab7b9,_0x41ec6f){return new BPromise(function(_0x4dbe7c,_0x422b3d){var _0x160fb4=_0x41ec6f||client;return _0x160fb4[_0x3256('0x1e')](_0x3e2b42,_0x3ab7b9)[_0x3256('0x1f')](function(_0x4bf7b3){logger[_0x3256('0x20')](_0x3256('0x21'),_0x5082df,_0x3256('0x22'));logger['debug'](_0x3256('0x23'),_0x5082df,'request\x20sent',JSON['stringify'](_0x4bf7b3));if(_0x4bf7b3[_0x3256('0x24')]){if(_0x4bf7b3['error']['code']===0x1f4){logger[_0x3256('0x24')](_0x3256('0x21'),_0x5082df,_0x4bf7b3[_0x3256('0x24')][_0x3256('0x25')]);return _0x422b3d(_0x4bf7b3[_0x3256('0x24')][_0x3256('0x25')]);}logger[_0x3256('0x24')](_0x3256('0x21'),_0x5082df,_0x4bf7b3['error']['message']);return _0x4dbe7c(_0x4bf7b3[_0x3256('0x24')][_0x3256('0x25')]);}else{logger[_0x3256('0x20')]('ChatQueue,\x20%s,\x20%s',_0x5082df,_0x3256('0x22'));_0x4dbe7c(_0x4bf7b3[_0x3256('0x26')][_0x3256('0x25')]);}})[_0x3256('0x27')](function(_0x25eeaa){logger[_0x3256('0x24')](_0x3256('0x21'),_0x5082df,_0x25eeaa);_0x422b3d(_0x25eeaa);});});}function respondWithStatusCode(_0x370377,_0x3eeaea){_0x3eeaea=_0x3eeaea||0xcc;return function(_0x49bc14){if(_0x49bc14){return _0x370377['sendStatus'](_0x3eeaea);}return _0x370377[_0x3256('0x28')](_0x3eeaea)[_0x3256('0x29')]();};}function respondWithResult(_0x14f78c,_0x25f742){_0x25f742=_0x25f742||0xc8;return function(_0x2328fe){if(_0x2328fe){return _0x14f78c[_0x3256('0x28')](_0x25f742)[_0x3256('0x2a')](_0x2328fe);}};}function respondWithFilteredResult(_0x3b5d4d,_0x38bd8d){return function(_0x337e47){if(_0x337e47){var _0x2978cd=typeof _0x38bd8d['offset']==='undefined'&&typeof _0x38bd8d[_0x3256('0x2b')]===_0x3256('0x2c');var _0x43c6b7=_0x337e47[_0x3256('0x2d')];var _0xe604ed=_0x2978cd?0x0:_0x38bd8d[_0x3256('0x2e')];var _0x2409f3=_0x2978cd?_0x337e47['count']:_0x38bd8d[_0x3256('0x2e')]+_0x38bd8d[_0x3256('0x2b')];var _0x411084;if(_0x2409f3>=_0x43c6b7){_0x2409f3=_0x43c6b7;_0x411084=0xc8;}else{_0x411084=0xce;}_0x3b5d4d['status'](_0x411084);return _0x3b5d4d['set']('Content-Range',_0xe604ed+'-'+_0x2409f3+'/'+_0x43c6b7)[_0x3256('0x2a')](_0x337e47);}return null;};}function patchUpdates(_0x516e4b){return function(_0x1ef1a7){try{jsonpatch[_0x3256('0x2f')](_0x1ef1a7,_0x516e4b,!![]);}catch(_0x159a1e){return BPromise[_0x3256('0x30')](_0x159a1e);}return _0x1ef1a7[_0x3256('0x31')]();};}function saveUpdates(_0x12f2ba,_0xd35dea){return function(_0x2c1b5b){if(_0x2c1b5b){return _0x2c1b5b[_0x3256('0x32')](_0x12f2ba)['then'](function(_0x2b673e){return _0x2b673e;});}return null;};}function removeEntity(_0x12b6dd,_0x25af81){return function(_0x478c6b){if(_0x478c6b){return _0x478c6b[_0x3256('0x33')]()['then'](function(){var _0x6ed4e0=_0x478c6b['get']({'plain':!![]});var _0x451419=_0x3256('0x34');return db[_0x3256('0x35')][_0x3256('0x33')]({'where':{'type':_0x451419,'resourceId':_0x6ed4e0['id']}})[_0x3256('0x1f')](function(){return _0x478c6b;});})['then'](function(){_0x12b6dd[_0x3256('0x28')](0xcc)[_0x3256('0x29')]();});}};}function handleEntityNotFound(_0x50ed84,_0x43b7d2){return function(_0x4be8a7){if(!_0x4be8a7){_0x50ed84['sendStatus'](0x194);}return _0x4be8a7;};}function handleError(_0x5c6c3a,_0x4b9baf){_0x4b9baf=_0x4b9baf||0x1f4;return function(_0x3bd27c){logger[_0x3256('0x24')](_0x3bd27c['stack']);if(_0x3bd27c[_0x3256('0x36')]){delete _0x3bd27c[_0x3256('0x36')];}_0x5c6c3a[_0x3256('0x28')](_0x4b9baf)['send'](_0x3bd27c);};}exports[_0x3256('0x37')]=function(_0x2fec16,_0xe33442){var _0x32972b={},_0x504226={},_0x469a27={'count':0x0,'rows':[]};var _0x253e90=_[_0x3256('0x38')](db['ChatQueue']['rawAttributes'],function(_0x45ee0c){return{'name':_0x45ee0c[_0x3256('0x39')],'type':_0x45ee0c[_0x3256('0x3a')]['key']};});_0x504226[_0x3256('0x3b')]=_[_0x3256('0x38')](_0x253e90,'name');_0x504226[_0x3256('0x3c')]=_['keys'](_0x2fec16[_0x3256('0x3c')]);_0x504226[_0x3256('0x3d')]=_[_0x3256('0x3e')](_0x504226[_0x3256('0x3b')],_0x504226[_0x3256('0x3c')]);_0x32972b['attributes']=_[_0x3256('0x3e')](_0x504226[_0x3256('0x3b')],qs[_0x3256('0x3f')](_0x2fec16[_0x3256('0x3c')]['fields']));_0x32972b['attributes']=_0x32972b[_0x3256('0x40')]['length']?_0x32972b[_0x3256('0x40')]:_0x504226[_0x3256('0x3b')];if(!_0x2fec16['query'][_0x3256('0x41')](_0x3256('0x42'))){_0x32972b[_0x3256('0x2b')]=qs['limit'](_0x2fec16[_0x3256('0x3c')]['limit']);_0x32972b[_0x3256('0x2e')]=qs[_0x3256('0x2e')](_0x2fec16['query']['offset']);}_0x32972b['order']=qs[_0x3256('0x43')](_0x2fec16[_0x3256('0x3c')][_0x3256('0x43')]);_0x32972b[_0x3256('0x44')]=qs['filters'](_['pick'](_0x2fec16[_0x3256('0x3c')],_0x504226[_0x3256('0x3d')]),_0x253e90);if(_0x2fec16[_0x3256('0x3c')][_0x3256('0x45')]){_0x32972b[_0x3256('0x44')]=_['merge'](_0x32972b[_0x3256('0x44')],{'$or':_[_0x3256('0x38')](_0x253e90,function(_0x38aa26){if(_0x38aa26[_0x3256('0x3a')]!==_0x3256('0x46')){var _0x2af416={};_0x2af416[_0x38aa26[_0x3256('0x36')]]={'$like':'%'+_0x2fec16[_0x3256('0x3c')][_0x3256('0x45')]+'%'};return _0x2af416;}})});}_0x32972b=_[_0x3256('0x47')]({},_0x32972b,_0x2fec16[_0x3256('0x48')]);var _0xbd1b3c={'where':_0x32972b['where']};return db[_0x3256('0x49')][_0x3256('0x2d')](_0xbd1b3c)[_0x3256('0x1f')](function(_0x5a398f){_0x469a27['count']=_0x5a398f;if(_0x2fec16[_0x3256('0x3c')][_0x3256('0x4a')]){_0x32972b[_0x3256('0x4b')]=[{'all':!![]}];}return db['ChatQueue'][_0x3256('0x4c')](_0x32972b);})[_0x3256('0x1f')](function(_0xe73d00){_0x469a27['rows']=_0xe73d00;return _0x469a27;})['then'](respondWithFilteredResult(_0xe33442,_0x32972b))['catch'](handleError(_0xe33442,null));};exports[_0x3256('0x4d')]=function(_0x5e4681,_0x1e9196){var _0x158327={'raw':!![],'where':{'id':_0x5e4681[_0x3256('0x4e')]['id']}},_0x2cd1a1={};_0x2cd1a1[_0x3256('0x3b')]=_[_0x3256('0x4f')](db[_0x3256('0x49')][_0x3256('0x50')]);_0x2cd1a1[_0x3256('0x3c')]=_[_0x3256('0x4f')](_0x5e4681[_0x3256('0x3c')]);_0x2cd1a1[_0x3256('0x3d')]=_[_0x3256('0x3e')](_0x2cd1a1[_0x3256('0x3b')],_0x2cd1a1['query']);_0x158327[_0x3256('0x40')]=_['intersection'](_0x2cd1a1[_0x3256('0x3b')],qs[_0x3256('0x3f')](_0x5e4681[_0x3256('0x3c')][_0x3256('0x3f')]));_0x158327[_0x3256('0x40')]=_0x158327[_0x3256('0x40')]['length']?_0x158327[_0x3256('0x40')]:_0x2cd1a1[_0x3256('0x3b')];if(_0x5e4681[_0x3256('0x3c')][_0x3256('0x4a')]){_0x158327[_0x3256('0x4b')]=[{'all':!![]}];}_0x158327=_['merge']({},_0x158327,_0x5e4681['options']);return db[_0x3256('0x49')][_0x3256('0x51')](_0x158327)[_0x3256('0x1f')](handleEntityNotFound(_0x1e9196,null))['then'](respondWithResult(_0x1e9196,null))['catch'](handleError(_0x1e9196,null));};exports['create']=function(_0x16df6a,_0x49ca99){return db[_0x3256('0x49')]['create'](_0x16df6a[_0x3256('0x52')],{})[_0x3256('0x1f')](function(_0x101ec2){var _0x3f0c58=_0x16df6a[_0x3256('0x53')][_0x3256('0x54')]({'plain':!![]});if(!_0x3f0c58)throw new Error(_0x3256('0x55'));if(_0x3f0c58[_0x3256('0x56')]===_0x3256('0x53')){var _0x3eac7=_0x101ec2[_0x3256('0x54')]({'plain':!![]});var _0x5b395f=_0x3256('0x34');return db[_0x3256('0x57')]['find']({'where':{'name':_0x5b395f,'userProfileId':_0x3f0c58['userProfileId']},'raw':!![]})['then'](function(_0x455ec7){if(_0x455ec7&&_0x455ec7[_0x3256('0x58')]===0x0){return db[_0x3256('0x35')][_0x3256('0x59')]({'name':_0x3eac7['name'],'resourceId':_0x3eac7['id'],'type':_0x455ec7[_0x3256('0x36')],'sectionId':_0x455ec7['id']},{})[_0x3256('0x1f')](function(){return _0x101ec2;});}else{return _0x101ec2;}})[_0x3256('0x27')](function(_0x12653d){logger[_0x3256('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12653d);throw _0x12653d;});}return _0x101ec2;})[_0x3256('0x1f')](respondWithResult(_0x49ca99,0xc9))[_0x3256('0x27')](handleError(_0x49ca99,null));};exports[_0x3256('0x32')]=function(_0x59d391,_0x3837b0){if(_0x59d391['body']['id']){delete _0x59d391[_0x3256('0x52')]['id'];}return db['ChatQueue'][_0x3256('0x51')]({'where':{'id':_0x59d391[_0x3256('0x4e')]['id']}})[_0x3256('0x1f')](handleEntityNotFound(_0x3837b0,null))[_0x3256('0x1f')](saveUpdates(_0x59d391[_0x3256('0x52')],null))[_0x3256('0x1f')](respondWithResult(_0x3837b0,null))[_0x3256('0x27')](handleError(_0x3837b0,null));};exports[_0x3256('0x33')]=function(_0x5f527e,_0x28a363){return db[_0x3256('0x49')][_0x3256('0x51')]({'where':{'id':_0x5f527e[_0x3256('0x4e')]['id']}})['then'](handleEntityNotFound(_0x28a363,null))[_0x3256('0x1f')](removeEntity(_0x28a363,null))[_0x3256('0x27')](handleError(_0x28a363,null));};exports['describe']=function(_0x14b015,_0x3734db){return db[_0x3256('0x49')][_0x3256('0x5a')]()['then'](respondWithResult(_0x3734db,null))[_0x3256('0x27')](handleError(_0x3734db,null));};exports[_0x3256('0x5b')]=function(_0xf656f5,_0x18cab4,_0x40d6ed){var _0x5a8063={'raw':!![],'where':{}},_0x22651f={},_0x571208;return db[_0x3256('0x49')][_0x3256('0x5c')]({'where':{'id':_0xf656f5[_0x3256('0x4e')]['id']}})[_0x3256('0x1f')](handleEntityNotFound(_0x18cab4,null))[_0x3256('0x1f')](function(_0x4031da){if(_0x4031da){_0x571208=_0x4031da['get']({'plain':!![]});_0x22651f[_0x3256('0x3b')]=_[_0x3256('0x4f')](db[_0x3256('0x5d')][_0x3256('0x50')]);_0x22651f[_0x3256('0x3c')]=_[_0x3256('0x4f')](_0xf656f5[_0x3256('0x3c')]);_0x22651f['filters']=_[_0x3256('0x3e')](_0x22651f[_0x3256('0x3b')],_0x22651f[_0x3256('0x3c')]);_0x5a8063[_0x3256('0x40')]=_[_0x3256('0x3e')](_0x22651f[_0x3256('0x3b')],qs[_0x3256('0x3f')](_0xf656f5['query']['fields']));_0x5a8063[_0x3256('0x40')]=_0x5a8063[_0x3256('0x40')]['length']?_0x5a8063['attributes']:_0x22651f[_0x3256('0x3b')];if(!_0xf656f5[_0x3256('0x3c')][_0x3256('0x41')](_0x3256('0x42'))){_0x5a8063[_0x3256('0x2b')]=qs['limit'](_0xf656f5[_0x3256('0x3c')]['limit']);_0x5a8063[_0x3256('0x2e')]=qs['offset'](_0xf656f5[_0x3256('0x3c')][_0x3256('0x2e')]);}_0x5a8063[_0x3256('0x5e')]=qs[_0x3256('0x43')](_0xf656f5[_0x3256('0x3c')]['sort']);_0x5a8063[_0x3256('0x44')]=qs[_0x3256('0x3d')](_['pick'](_0xf656f5[_0x3256('0x3c')],_0x22651f[_0x3256('0x3d')]));_0x5a8063['where'][_0x3256('0x5f')]=_0x4031da['id'];if(_0xf656f5[_0x3256('0x3c')][_0x3256('0x45')]){_0x5a8063[_0x3256('0x44')]=_[_0x3256('0x47')](_0x5a8063[_0x3256('0x44')],{'$or':_[_0x3256('0x38')](_0x5a8063['attributes'],function(_0x3c67f7){var _0x5d9acf={};_0x5d9acf[_0x3c67f7]={'$like':'%'+_0xf656f5[_0x3256('0x3c')][_0x3256('0x45')]+'%'};return _0x5d9acf;})});}_0x5a8063=_[_0x3256('0x47')]({},_0x5a8063,_0xf656f5[_0x3256('0x48')]);return db['UserChatQueue'][_0x3256('0x4c')](_0x5a8063);}})[_0x3256('0x1f')](function(_0x1ab796){if(_0x1ab796){return db[_0x3256('0x60')][_0x3256('0x61')]({'where':{'id':_[_0x3256('0x38')](_0x1ab796,_0x3256('0x62')),'role':_0x3256('0x63')},'attributes':['id',_0x3256('0x36'),_0x3256('0x64'),_0x3256('0x65'),_0x3256('0x66')]});}})[_0x3256('0x1f')](function(_0x1127a1){if(_0x1127a1){return{'count':_0x1127a1[_0x3256('0x2d')],'rows':_[_0x3256('0x38')](_0x1127a1['rows'],function(_0x4862d7){return{'membername':_0x4862d7[_0x3256('0x36')],'UserId':_0x4862d7['id'],'queue_name':_0x571208[_0x3256('0x36')],'ChatQueueId':_0x571208['id'],'interface':util[_0x3256('0x67')]('%s/%s','SIP',_0x4862d7[_0x3256('0x36')]),'penalty':0x0,'paused':_0x4862d7[_0x3256('0x64')],'createdAt':_0x4862d7[_0x3256('0x66')],'updatedAt':_0x4862d7[_0x3256('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3256('0x1f')](respondWithFilteredResult(_0x18cab4,_0x5a8063))[_0x3256('0x27')](handleError(_0x18cab4,null));};exports[_0x3256('0x68')]=function(_0x41f4ed,_0x4a973d,_0x267ab1){var _0x4275ee={};var _0x223ae5={};var _0x43ef62;var _0xa0e9af;return db[_0x3256('0x49')]['findOne']({'where':{'id':_0x41f4ed[_0x3256('0x4e')]['id']}})[_0x3256('0x1f')](handleEntityNotFound(_0x4a973d,null))[_0x3256('0x1f')](function(_0x19c4f3){if(_0x19c4f3){_0x43ef62=_0x19c4f3;_0x223ae5[_0x3256('0x3b')]=_[_0x3256('0x4f')](db[_0x3256('0x69')][_0x3256('0x50')]);_0x223ae5[_0x3256('0x3c')]=_['keys'](_0x41f4ed[_0x3256('0x3c')]);_0x223ae5[_0x3256('0x3d')]=_[_0x3256('0x3e')](_0x223ae5[_0x3256('0x3b')],_0x223ae5[_0x3256('0x3c')]);_0x4275ee[_0x3256('0x40')]=_[_0x3256('0x3e')](_0x223ae5['model'],qs[_0x3256('0x3f')](_0x41f4ed[_0x3256('0x3c')][_0x3256('0x3f')]));_0x4275ee[_0x3256('0x40')]=_0x4275ee[_0x3256('0x40')][_0x3256('0x6a')]?_0x4275ee['attributes']:_0x223ae5[_0x3256('0x3b')];_0x4275ee[_0x3256('0x5e')]=qs[_0x3256('0x43')](_0x41f4ed[_0x3256('0x3c')][_0x3256('0x43')]);_0x4275ee[_0x3256('0x44')]=qs[_0x3256('0x3d')](_['pick'](_0x41f4ed[_0x3256('0x3c')],_0x223ae5[_0x3256('0x3d')]));if(_0x41f4ed[_0x3256('0x3c')][_0x3256('0x45')]){_0x4275ee[_0x3256('0x44')]=_[_0x3256('0x47')](_0x4275ee['where'],{'$or':_[_0x3256('0x38')](_0x4275ee[_0x3256('0x40')],function(_0x2bc27d){var _0x47509b={};_0x47509b[_0x2bc27d]={'$like':'%'+_0x41f4ed[_0x3256('0x3c')][_0x3256('0x45')]+'%'};return _0x47509b;})});}_0x4275ee=_['merge']({},_0x4275ee,_0x41f4ed[_0x3256('0x48')]);return _0x43ef62[_0x3256('0x68')](_0x4275ee);}})[_0x3256('0x1f')](function(_0xafcba9){if(_0xafcba9){_0xa0e9af=_0xafcba9['length'];if(!_0x41f4ed['query'][_0x3256('0x41')]('nolimit')){_0x4275ee['limit']=qs['limit'](_0x41f4ed[_0x3256('0x3c')][_0x3256('0x2b')]);_0x4275ee[_0x3256('0x2e')]=qs[_0x3256('0x2e')](_0x41f4ed[_0x3256('0x3c')][_0x3256('0x2e')]);}return _0x43ef62[_0x3256('0x68')](_0x4275ee);}})[_0x3256('0x1f')](function(_0x2ef77d){if(_0x2ef77d){return _0x2ef77d?{'count':_0xa0e9af,'rows':_0x2ef77d}:null;}})[_0x3256('0x1f')](respondWithResult(_0x4a973d,null))[_0x3256('0x27')](handleError(_0x4a973d,null));};exports['addTeams']=function(_0x3dce92,_0x543be7,_0x5ce4f8){var _0x3f3f89=_0x3dce92[_0x3256('0x52')]['ids'];return db[_0x3256('0x69')][_0x3256('0x4c')]({'where':{'id':_0x3f3f89},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3256('0x6b'),'attributes':['id',_0x3256('0x36'),_0x3256('0x6c'),_0x3256('0x6d'),_0x3256('0x6e')],'raw':!![]}]})[_0x3256('0x1f')](function(_0x5b12d3){if(_0x5b12d3){var _0x1a1dc9=_[_0x3256('0x6f')](_0x5b12d3,function(_0x301ec1){var _0x203063=_0x301ec1['get']({'plain':!![]});return _0x203063[_0x3256('0x6b')];});return db['ChatQueue'][_0x3256('0x51')]({'where':{'id':_0x3dce92[_0x3256('0x4e')]['id']}})['then'](function(_0x5674c0){return db[_0x3256('0x70')][_0x3256('0x71')](function(_0x47fc53){return _0x5674c0['addTeams'](_0x3f3f89,{'transaction':_0x47fc53})[_0x3256('0x1f')](function(){return BPromise[_0x3256('0x72')](_0x1a1dc9,function(_0x510a2a){return db[_0x3256('0x5d')][_0x3256('0x73')]({'where':{'UserId':_0x510a2a['id'],'ChatQueueId':_0x3dce92[_0x3256('0x4e')]['id']},'transaction':_0x47fc53});});})[_0x3256('0x1f')](function(){_0x1a1dc9['forEach'](function(_0x1805e7){socket[_0x3256('0x74')]('userChatQueue:save',{'UserId':_0x1805e7['id'],'ChatQueueId':_0x5674c0['id']});});});});});}})['then'](respondWithStatusCode(_0x543be7,null))[_0x3256('0x27')](handleError(_0x543be7,null));};exports[_0x3256('0x75')]=function(_0x3f4dbc,_0x201de2,_0xc242aa){return db[_0x3256('0x69')][_0x3256('0x4c')]({'where':{'id':_0x3f4dbc['query'][_0x3256('0x76')]},'attributes':['id'],'include':[{'model':db[_0x3256('0x60')],'as':_0x3256('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x3256('0x1f')](handleEntityNotFound(_0x201de2,null))[_0x3256('0x1f')](function(_0x467089){var _0x4e7cc5=_['map'](_0x467089,'id');var _0x50485b=[];var _0x5c76bc=[];var _0x5eea79=squel[_0x3256('0x77')]();_0x5eea79[_0x3256('0x78')](_0x3256('0x79'))[_0x3256('0x7a')]('team_has_chat_queues','tq')[_0x3256('0x7b')]('user_has_teams','ut',_0x3256('0x7c'))[_0x3256('0x44')]('ChatQueueId\x20=\x20?',_0x3f4dbc['params']['id']);for(var _0x45ca22=0x0;_0x45ca22<_0x467089[_0x3256('0x6a')];_0x45ca22+=0x1){let _0x2152bd=_0x467089[_0x45ca22];for(var _0x33b64c=0x0;_0x33b64c<_0x2152bd[_0x3256('0x6b')][_0x3256('0x6a')];_0x33b64c+=0x1){let _0x54bc79=_0x2152bd[_0x3256('0x6b')][_0x33b64c];var _0x4c2e31=_0x5eea79['clone']();_0x4c2e31['where'](_0x3256('0x7d'),_0x54bc79['id']);_0x5c76bc[_0x3256('0x7e')](db[_0x3256('0x70')][_0x3256('0x3c')](_0x4c2e31[_0x3256('0x7f')](),{'type':db[_0x3256('0x70')]['QueryTypes'][_0x3256('0x80')]})[_0x3256('0x1f')](function(_0x229ac8){if(_0x229ac8[_0x3256('0x6a')]===0x1){return _0x54bc79['id'];}else{var _0x1032f9=_[_0x3256('0x81')](_[_0x3256('0x38')](_0x229ac8,_0x3256('0x82')),function(_0x5334e8){return _[_0x3256('0x83')](_0x4e7cc5,_0x5334e8);});if(_0x1032f9){return _0x54bc79['id'];}}}));}}return BPromise[_0x3256('0x84')](_0x5c76bc)[_0x3256('0x1f')](function(_0x1ba44d){_0x50485b=_(_0x50485b)['union'](_0x1ba44d)[_0x3256('0x85')]()[_0x3256('0x86')]();return db[_0x3256('0x49')][_0x3256('0x51')]({'where':{'id':_0x3f4dbc[_0x3256('0x4e')]['id']}})[_0x3256('0x1f')](function(_0x1d6341){return db[_0x3256('0x70')][_0x3256('0x71')](function(_0x87ef7d){return _0x1d6341[_0x3256('0x75')](_0x3f4dbc[_0x3256('0x3c')][_0x3256('0x76')],{'transaction':_0x87ef7d})[_0x3256('0x1f')](function(){if(!_['isEmpty'](_0x50485b)){return _0x1d6341[_0x3256('0x87')](_0x50485b,{'transaction':_0x87ef7d});}})['then'](function(){_0x50485b[_0x3256('0x88')](function(_0x385448){socket[_0x3256('0x74')](_0x3256('0x89'),{'UserId':_0x385448,'ChatQueueId':_0x1d6341['id']});});});});});});})[_0x3256('0x1f')](respondWithStatusCode(_0x201de2,null))[_0x3256('0x27')](handleError(_0x201de2,null));};exports['addAgents']=function(_0x32adf2,_0x5ca76d,_0x45f7bb){return db[_0x3256('0x49')][_0x3256('0x51')]({'where':{'id':_0x32adf2[_0x3256('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5ca76d,null))[_0x3256('0x1f')](function(_0x52db55){if(_0x52db55){return _0x52db55['addAgents'](_0x32adf2['body']['ids'],_[_0x3256('0x8a')](_0x32adf2[_0x3256('0x52')],[_0x3256('0x76'),'id'])||{})[_0x3256('0x8b')](function(_0x464f3c){for(var _0x22611d=0x0;_0x22611d<_0x32adf2[_0x3256('0x52')]['ids'][_0x3256('0x6a')];_0x22611d+=0x1){socket[_0x3256('0x74')]('userChatQueue:save',{'UserId':_0x32adf2[_0x3256('0x52')][_0x3256('0x76')][_0x22611d],'ChatQueueId':_0x32adf2[_0x3256('0x4e')]['id']});}return _0x464f3c;});}})['then'](respondWithResult(_0x5ca76d,null))[_0x3256('0x27')](handleError(_0x5ca76d,null));};exports[_0x3256('0x87')]=function(_0x364459,_0x2681f1,_0xb46f5e){return db[_0x3256('0x49')][_0x3256('0x51')]({'where':{'id':_0x364459[_0x3256('0x4e')]['id']}})[_0x3256('0x1f')](handleEntityNotFound(_0x2681f1,null))[_0x3256('0x1f')](function(_0x1c15ff){if(_0x1c15ff){return _0x1c15ff[_0x3256('0x87')](_0x364459[_0x3256('0x3c')]['ids'])[_0x3256('0x1f')](function(){if(_[_0x3256('0x8c')](_0x364459[_0x3256('0x3c')][_0x3256('0x76')])){for(var _0x6704ed=0x0;_0x6704ed<_0x364459[_0x3256('0x3c')][_0x3256('0x76')][_0x3256('0x6a')];_0x6704ed+=0x1){socket[_0x3256('0x74')](_0x3256('0x89'),{'UserId':Number(_0x364459[_0x3256('0x3c')][_0x3256('0x76')][_0x6704ed]),'ChatQueueId':Number(_0x364459[_0x3256('0x4e')]['id'])});}}else{socket['emit'](_0x3256('0x89'),{'UserId':Number(_0x364459['query'][_0x3256('0x76')]),'ChatQueueId':Number(_0x364459[_0x3256('0x4e')]['id'])});}});}})[_0x3256('0x1f')](respondWithStatusCode(_0x2681f1,null))['catch'](handleError(_0x2681f1,null));};exports[_0x3256('0x8d')]=function(_0x2eccc2,_0x1668d1,_0x2c59c0){var _0x4d1897={};var _0x26f89b={};var _0x2de0dd;var _0x4c91a3;return db[_0x3256('0x49')][_0x3256('0x5c')]({'where':{'id':_0x2eccc2[_0x3256('0x4e')]['id']}})[_0x3256('0x1f')](handleEntityNotFound(_0x1668d1,null))[_0x3256('0x1f')](function(_0x2923d4){if(_0x2923d4){_0x2de0dd=_0x2923d4;_0x26f89b['model']=_[_0x3256('0x4f')](db[_0x3256('0x60')][_0x3256('0x50')]);_0x26f89b[_0x3256('0x3c')]=_['keys'](_0x2eccc2[_0x3256('0x3c')]);_0x26f89b[_0x3256('0x3d')]=_['intersection'](_0x26f89b[_0x3256('0x3b')],_0x26f89b[_0x3256('0x3c')]);_0x4d1897[_0x3256('0x40')]=_[_0x3256('0x3e')](_0x26f89b[_0x3256('0x3b')],qs['fields'](_0x2eccc2['query'][_0x3256('0x3f')]));_0x4d1897[_0x3256('0x40')]=_0x4d1897[_0x3256('0x40')][_0x3256('0x6a')]?_0x4d1897[_0x3256('0x40')]:_0x26f89b[_0x3256('0x3b')];_0x4d1897['order']=qs['sort'](_0x2eccc2[_0x3256('0x3c')][_0x3256('0x43')]);_0x4d1897[_0x3256('0x44')]=qs[_0x3256('0x3d')](_[_0x3256('0x8e')](_0x2eccc2['query'],_0x26f89b['filters']));if(_0x2eccc2[_0x3256('0x3c')]['filter']){_0x4d1897[_0x3256('0x44')]=_['merge'](_0x4d1897[_0x3256('0x44')],{'$or':_[_0x3256('0x38')](_0x4d1897['attributes'],function(_0x3474bf){var _0x5843d1={};_0x5843d1[_0x3474bf]={'$like':'%'+_0x2eccc2[_0x3256('0x3c')][_0x3256('0x45')]+'%'};return _0x5843d1;})});}_0x4d1897=_['merge']({},_0x4d1897,_0x2eccc2[_0x3256('0x48')]);return _0x2de0dd[_0x3256('0x8d')](_0x4d1897);}})[_0x3256('0x1f')](function(_0x4473f6){if(_0x4473f6){_0x4c91a3=_0x4473f6[_0x3256('0x6a')];if(!_0x2eccc2[_0x3256('0x3c')][_0x3256('0x41')](_0x3256('0x42'))){_0x4d1897[_0x3256('0x2b')]=qs['limit'](_0x2eccc2[_0x3256('0x3c')][_0x3256('0x2b')]);_0x4d1897[_0x3256('0x2e')]=qs[_0x3256('0x2e')](_0x2eccc2[_0x3256('0x3c')]['offset']);}return _0x2de0dd[_0x3256('0x8d')](_0x4d1897);}})[_0x3256('0x1f')](function(_0x1deffd){if(_0x1deffd){return _0x1deffd?{'count':_0x4c91a3,'rows':_0x1deffd}:null;}})[_0x3256('0x1f')](respondWithResult(_0x1668d1,null))[_0x3256('0x27')](handleError(_0x1668d1,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index db6c60b..070d885 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 _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x357cef,_0x385062){var _0x48a0ab=function(_0x946673){while(--_0x946673){_0x357cef['push'](_0x357cef['shift']());}};_0x48a0ab(++_0x385062);}(_0xb10b,0x12a));var _0xbb10=function(_0x3dd23c,_0x18c32f){_0x3dd23c=_0x3dd23c-0x0;var _0x520bf8=_0xb10b[_0x3dd23c];return _0x520bf8;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x16b07b,_0x4bdc36){var _0x5d5adf=function(_0x2be2fc){while(--_0x2be2fc){_0x16b07b['push'](_0x16b07b['shift']());}};_0x5d5adf(++_0x4bdc36);}(_0x5f2f,0x73));var _0xf5f2=function(_0x570845,_0x4935ca){_0x570845=_0x570845-0x0;var _0x393e6c=_0x5f2f[_0x570845];return _0x393e6c;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 22cff66..ec6bb29 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 _0x7831=['api','bluebird','request-promise','path','rimraf','./chatQueue.attributes','define','ChatQueue','chat_queues','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7831,0x1c1));var _0x1783=function(_0x414bed,_0xd903a4){_0x414bed=_0x414bed-0x0;var _0x5943ab=_0x7831[_0x414bed];return _0x5943ab;};'use strict';var _=require('lodash');var util=require(_0x1783('0x0'));var logger=require('../../config/logger')(_0x1783('0x1'));var moment=require('moment');var BPromise=require(_0x1783('0x2'));var rp=require(_0x1783('0x3'));var fs=require('fs');var path=require(_0x1783('0x4'));var rimraf=require(_0x1783('0x5'));var config=require('../../config/environment');var attributes=require(_0x1783('0x6'));module['exports']=function(_0x5b3001,_0x403fea){return _0x5b3001[_0x1783('0x7')](_0x1783('0x8'),attributes,{'tableName':_0x1783('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e9f=['moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api'];(function(_0x1d350b,_0x90ff7b){var _0x20a3af=function(_0x7ef833){while(--_0x7ef833){_0x1d350b['push'](_0x1d350b['shift']());}};_0x20a3af(++_0x90ff7b);}(_0x0e9f,0xea));var _0xf0e9=function(_0x387bcf,_0x1c741b){_0x387bcf=_0x387bcf-0x0;var _0x335615=_0x0e9f[_0x387bcf];return _0x335615;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var logger=require(_0xf0e9('0x2'))(_0xf0e9('0x3'));var moment=require(_0xf0e9('0x4'));var BPromise=require(_0xf0e9('0x5'));var rp=require(_0xf0e9('0x6'));var fs=require('fs');var path=require(_0xf0e9('0x7'));var rimraf=require(_0xf0e9('0x8'));var config=require('../../config/environment');var attributes=require(_0xf0e9('0x9'));module[_0xf0e9('0xa')]=function(_0xdaa425,_0x197200){return _0xdaa425[_0xf0e9('0xb')](_0xf0e9('0xc'),attributes,{'tableName':_0xf0e9('0xd'),'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 6a28735..2eec914 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 _0x88f8=['http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetChatQueue','ChatQueue','options','raw','where','attributes','include','model','map','stringify','ShowChatQueue','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x88f8,0xd4));var _0x888f=function(_0x5c03cf,_0x6c84a6){_0x5c03cf=_0x5c03cf-0x0;var _0x18a103=_0x88f8[_0x5c03cf];return _0x18a103;};'use strict';var _=require('lodash');var util=require(_0x888f('0x0'));var moment=require('moment');var BPromise=require(_0x888f('0x1'));var rs=require(_0x888f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x888f('0x3'))['db'];var utils=require(_0x888f('0x4'));var logger=require(_0x888f('0x5'))(_0x888f('0x6'));var config=require(_0x888f('0x7'));var jayson=require(_0x888f('0x8'));var client=jayson[_0x888f('0x9')][_0x888f('0xa')]({'port':0x232a});config[_0x888f('0xb')]=_['defaults'](config[_0x888f('0xb')],{'host':_0x888f('0xc'),'port':0x18eb});var socket=require(_0x888f('0xd'))(new Redis(config[_0x888f('0xb')]));require(_0x888f('0xe'))[_0x888f('0xf')](socket);function respondWithRpcPromise(_0x4ecc64,_0x1d4f47,_0x53a2c3){return new BPromise(function(_0x4b0490,_0x39937f){return client['request'](_0x4ecc64,_0x53a2c3)[_0x888f('0x10')](function(_0xe21f56){logger[_0x888f('0x11')](_0x888f('0x12'),_0x1d4f47,_0x888f('0x13'));logger[_0x888f('0x14')](_0x888f('0x15'),_0x1d4f47,_0x888f('0x13'),JSON['stringify'](_0xe21f56));if(_0xe21f56[_0x888f('0x16')]){if(_0xe21f56[_0x888f('0x16')][_0x888f('0x17')]===0x1f4){logger[_0x888f('0x16')](_0x888f('0x12'),_0x1d4f47,_0xe21f56['error'][_0x888f('0x18')]);return _0x39937f(_0xe21f56['error'][_0x888f('0x18')]);}logger[_0x888f('0x16')](_0x888f('0x12'),_0x1d4f47,_0xe21f56[_0x888f('0x16')]['message']);return _0x4b0490(_0xe21f56['error'][_0x888f('0x18')]);}else{logger[_0x888f('0x11')](_0x888f('0x12'),_0x1d4f47,_0x888f('0x13'));_0x4b0490(_0xe21f56[_0x888f('0x19')][_0x888f('0x18')]);}})['catch'](function(_0x3378fd){logger[_0x888f('0x16')](_0x888f('0x12'),_0x1d4f47,_0x3378fd);_0x39937f(_0x3378fd);});});}exports[_0x888f('0x1a')]=function(_0x4d6ccd){var _0x51dcb5=this;return new Promise(function(_0x39e3e5,_0x106566){return db[_0x888f('0x1b')]['findAll']({'raw':_0x4d6ccd['options']?_0x4d6ccd[_0x888f('0x1c')][_0x888f('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d6ccd['options']?_0x4d6ccd[_0x888f('0x1c')][_0x888f('0x1e')]||null:null,'attributes':_0x4d6ccd[_0x888f('0x1c')]?_0x4d6ccd['options'][_0x888f('0x1f')]||null:null,'limit':_0x4d6ccd['options']?_0x4d6ccd[_0x888f('0x1c')]['limit']||null:null,'include':_0x4d6ccd[_0x888f('0x1c')]?_0x4d6ccd[_0x888f('0x1c')][_0x888f('0x20')]?_['map'](_0x4d6ccd[_0x888f('0x1c')]['include'],function(_0x3d9886){return{'model':db[_0x3d9886[_0x888f('0x21')]],'as':_0x3d9886['as'],'attributes':_0x3d9886['attributes'],'include':_0x3d9886[_0x888f('0x20')]?_[_0x888f('0x22')](_0x3d9886[_0x888f('0x20')],function(_0x4c415e){return{'model':db[_0x4c415e[_0x888f('0x21')]],'as':_0x4c415e['as'],'attributes':_0x4c415e[_0x888f('0x1f')],'include':_0x4c415e[_0x888f('0x20')]?_['map'](_0x4c415e[_0x888f('0x20')],function(_0x12eb87){return{'model':db[_0x12eb87['model']],'as':_0x12eb87['as'],'attributes':_0x12eb87[_0x888f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x888f('0x10')](function(_0x3d1e15){logger[_0x888f('0x11')](_0x888f('0x1a'),_0x4d6ccd);logger[_0x888f('0x14')](_0x888f('0x1a'),_0x4d6ccd,JSON[_0x888f('0x23')](_0x3d1e15));_0x39e3e5(_0x3d1e15);})['catch'](function(_0x2f13ac){logger[_0x888f('0x16')](_0x888f('0x1a'),_0x2f13ac[_0x888f('0x18')],_0x4d6ccd);_0x106566(_0x51dcb5[_0x888f('0x16')](0x1f4,_0x2f13ac[_0x888f('0x18')]));});});};exports[_0x888f('0x24')]=function(_0x189425){var _0x4d76a7=this;return new Promise(function(_0xfdb56e,_0x1105d4){return db[_0x888f('0x1b')]['find']({'raw':_0x189425[_0x888f('0x1c')]?_0x189425['options']['raw']===undefined?!![]:![]:!![],'where':_0x189425[_0x888f('0x1c')]?_0x189425[_0x888f('0x1c')][_0x888f('0x1e')]||null:null,'attributes':_0x189425[_0x888f('0x1c')]?_0x189425[_0x888f('0x1c')][_0x888f('0x1f')]||null:null,'include':_0x189425[_0x888f('0x1c')]?_0x189425[_0x888f('0x1c')][_0x888f('0x20')]?_['map'](_0x189425[_0x888f('0x1c')][_0x888f('0x20')],function(_0x493e21){return{'model':db[_0x493e21['model']],'as':_0x493e21['as'],'attributes':_0x493e21[_0x888f('0x1f')],'include':_0x493e21[_0x888f('0x20')]?_[_0x888f('0x22')](_0x493e21[_0x888f('0x20')],function(_0x5978c1){return{'model':db[_0x5978c1[_0x888f('0x21')]],'as':_0x5978c1['as'],'attributes':_0x5978c1['attributes'],'include':_0x5978c1[_0x888f('0x20')]?_['map'](_0x5978c1[_0x888f('0x20')],function(_0x28f12c){return{'model':db[_0x28f12c[_0x888f('0x21')]],'as':_0x28f12c['as'],'attributes':_0x28f12c[_0x888f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x888f('0x10')](function(_0x1840d6){logger[_0x888f('0x11')](_0x888f('0x24'),_0x189425);logger[_0x888f('0x14')](_0x888f('0x24'),_0x189425,JSON[_0x888f('0x23')](_0x1840d6));_0xfdb56e(_0x1840d6);})['catch'](function(_0x30dfab){logger[_0x888f('0x16')](_0x888f('0x24'),_0x30dfab[_0x888f('0x18')],_0x189425);_0x1105d4(_0x4d76a7[_0x888f('0x16')](0x1f4,_0x30dfab[_0x888f('0x18')]));});});}; \ No newline at end of file +var _0xbbaf=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','model','include','debug','find','map','ShowChatQueue'];(function(_0x301583,_0x48e684){var _0x43add0=function(_0x3efc38){while(--_0x3efc38){_0x301583['push'](_0x301583['shift']());}};_0x43add0(++_0x48e684);}(_0xbbaf,0x158));var _0xfbba=function(_0x1f459f,_0x21ac07){_0x1f459f=_0x1f459f-0x0;var _0x4a555b=_0xbbaf[_0x1f459f];return _0x4a555b;};'use strict';var _=require(_0xfbba('0x0'));var util=require(_0xfbba('0x1'));var moment=require(_0xfbba('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfbba('0x3'));var db=require(_0xfbba('0x4'))['db'];var utils=require(_0xfbba('0x5'));var logger=require(_0xfbba('0x6'))(_0xfbba('0x7'));var config=require(_0xfbba('0x8'));var jayson=require(_0xfbba('0x9'));var client=jayson[_0xfbba('0xa')][_0xfbba('0xb')]({'port':0x232a});config[_0xfbba('0xc')]=_[_0xfbba('0xd')](config[_0xfbba('0xc')],{'host':_0xfbba('0xe'),'port':0x18eb});var socket=require(_0xfbba('0xf'))(new Redis(config[_0xfbba('0xc')]));require(_0xfbba('0x10'))[_0xfbba('0x11')](socket);function respondWithRpcPromise(_0x294ecc,_0x320523,_0x1e7080){return new BPromise(function(_0x2d416b,_0x509a14){return client['request'](_0x294ecc,_0x1e7080)[_0xfbba('0x12')](function(_0x27df1c){logger['info'](_0xfbba('0x13'),_0x320523,_0xfbba('0x14'));logger['debug'](_0xfbba('0x15'),_0x320523,'request\x20sent',JSON[_0xfbba('0x16')](_0x27df1c));if(_0x27df1c[_0xfbba('0x17')]){if(_0x27df1c[_0xfbba('0x17')][_0xfbba('0x18')]===0x1f4){logger['error'](_0xfbba('0x13'),_0x320523,_0x27df1c[_0xfbba('0x17')]['message']);return _0x509a14(_0x27df1c[_0xfbba('0x17')][_0xfbba('0x19')]);}logger[_0xfbba('0x17')](_0xfbba('0x13'),_0x320523,_0x27df1c[_0xfbba('0x17')][_0xfbba('0x19')]);return _0x2d416b(_0x27df1c['error'][_0xfbba('0x19')]);}else{logger[_0xfbba('0x1a')]('ChatQueue,\x20%s,\x20%s',_0x320523,_0xfbba('0x14'));_0x2d416b(_0x27df1c[_0xfbba('0x1b')][_0xfbba('0x19')]);}})[_0xfbba('0x1c')](function(_0x1e8464){logger['error']('ChatQueue,\x20%s,\x20%s',_0x320523,_0x1e8464);_0x509a14(_0x1e8464);});});}exports[_0xfbba('0x1d')]=function(_0x3e6e29){var _0x19419e=this;return new Promise(function(_0x5a3cdf,_0x1af2a6){return db[_0xfbba('0x1e')][_0xfbba('0x1f')]({'raw':_0x3e6e29[_0xfbba('0x20')]?_0x3e6e29[_0xfbba('0x20')][_0xfbba('0x21')]===undefined?!![]:![]:!![],'where':_0x3e6e29[_0xfbba('0x20')]?_0x3e6e29['options'][_0xfbba('0x22')]||null:null,'attributes':_0x3e6e29[_0xfbba('0x20')]?_0x3e6e29[_0xfbba('0x20')][_0xfbba('0x23')]||null:null,'limit':_0x3e6e29['options']?_0x3e6e29[_0xfbba('0x20')][_0xfbba('0x24')]||null:null,'include':_0x3e6e29[_0xfbba('0x20')]?_0x3e6e29['options']['include']?_['map'](_0x3e6e29[_0xfbba('0x20')]['include'],function(_0x2f9829){return{'model':db[_0x2f9829[_0xfbba('0x25')]],'as':_0x2f9829['as'],'attributes':_0x2f9829[_0xfbba('0x23')],'include':_0x2f9829[_0xfbba('0x26')]?_['map'](_0x2f9829[_0xfbba('0x26')],function(_0x2fd203){return{'model':db[_0x2fd203[_0xfbba('0x25')]],'as':_0x2fd203['as'],'attributes':_0x2fd203[_0xfbba('0x23')],'include':_0x2fd203[_0xfbba('0x26')]?_['map'](_0x2fd203[_0xfbba('0x26')],function(_0x3a5af2){return{'model':db[_0x3a5af2['model']],'as':_0x3a5af2['as'],'attributes':_0x3a5af2[_0xfbba('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18bf76){logger[_0xfbba('0x1a')]('GetChatQueue',_0x3e6e29);logger[_0xfbba('0x27')]('GetChatQueue',_0x3e6e29,JSON[_0xfbba('0x16')](_0x18bf76));_0x5a3cdf(_0x18bf76);})[_0xfbba('0x1c')](function(_0xa0a64){logger[_0xfbba('0x17')](_0xfbba('0x1d'),_0xa0a64[_0xfbba('0x19')],_0x3e6e29);_0x1af2a6(_0x19419e[_0xfbba('0x17')](0x1f4,_0xa0a64[_0xfbba('0x19')]));});});};exports['ShowChatQueue']=function(_0x296f6b){var _0x158edc=this;return new Promise(function(_0x3fb7a2,_0x219824){return db[_0xfbba('0x1e')][_0xfbba('0x28')]({'raw':_0x296f6b[_0xfbba('0x20')]?_0x296f6b[_0xfbba('0x20')][_0xfbba('0x21')]===undefined?!![]:![]:!![],'where':_0x296f6b['options']?_0x296f6b[_0xfbba('0x20')][_0xfbba('0x22')]||null:null,'attributes':_0x296f6b[_0xfbba('0x20')]?_0x296f6b[_0xfbba('0x20')]['attributes']||null:null,'include':_0x296f6b[_0xfbba('0x20')]?_0x296f6b[_0xfbba('0x20')][_0xfbba('0x26')]?_['map'](_0x296f6b['options'][_0xfbba('0x26')],function(_0x2f8ef4){return{'model':db[_0x2f8ef4[_0xfbba('0x25')]],'as':_0x2f8ef4['as'],'attributes':_0x2f8ef4[_0xfbba('0x23')],'include':_0x2f8ef4['include']?_[_0xfbba('0x29')](_0x2f8ef4[_0xfbba('0x26')],function(_0x1a2f09){return{'model':db[_0x1a2f09['model']],'as':_0x1a2f09['as'],'attributes':_0x1a2f09[_0xfbba('0x23')],'include':_0x1a2f09['include']?_['map'](_0x1a2f09[_0xfbba('0x26')],function(_0xc408e4){return{'model':db[_0xc408e4[_0xfbba('0x25')]],'as':_0xc408e4['as'],'attributes':_0xc408e4[_0xfbba('0x23')]};}):[]};}):[]};}):[]:[]})[_0xfbba('0x12')](function(_0x5da984){logger[_0xfbba('0x1a')](_0xfbba('0x2a'),_0x296f6b);logger['debug']('ShowChatQueue',_0x296f6b,JSON[_0xfbba('0x16')](_0x5da984));_0x3fb7a2(_0x5da984);})[_0xfbba('0x1c')](function(_0x33ef07){logger[_0xfbba('0x17')]('ShowChatQueue',_0x33ef07[_0xfbba('0x19')],_0x296f6b);_0x219824(_0x158edc['error'](0x1f4,_0x33ef07[_0xfbba('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 2a93e3b..f18c274 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 _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x370ec8,_0x1b0d6b){var _0x40c474=function(_0x30acfa){while(--_0x30acfa){_0x370ec8['push'](_0x370ec8['shift']());}};_0x40c474(++_0x1b0d6b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x1bc9b8,_0x379fc7){var _0x1a9a13=function(_0x3a73ea){while(--_0x3a73ea){_0x1bc9b8['push'](_0x1bc9b8['shift']());}};_0x1a9a13(++_0x379fc7);}(_0x5f2f,0x73));var _0xf5f2=function(_0xaa370f,_0x3112a8){_0xaa370f=_0xaa370f-0x0;var _0x4e1d8c=_0x5f2f[_0xaa370f];return _0x4e1d8c;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index cffd376..00632cf 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 _0x2baf=['destroy','delete','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','put'];(function(_0x185ea3,_0x4a0056){var _0x4389f6=function(_0x1e7f48){while(--_0x1e7f48){_0x185ea3['push'](_0x185ea3['shift']());}};_0x4389f6(++_0x4a0056);}(_0x2baf,0xc8));var _0xf2ba=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x2baf[_0x547456];return _0xc1fd7b;};'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')]('/describe',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['get']('/:id/users',auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x11')]);router['post']('/',auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x12')]);router[_0xf2ba('0x13')]('/:id/teams',auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x14')]);router[_0xf2ba('0x13')](_0xf2ba('0x15'),auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x16')]);router[_0xf2ba('0x17')](_0xf2ba('0xb'),auth[_0xf2ba('0x8')](),controller['update']);router['delete']('/:id',auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x18')]);router[_0xf2ba('0x19')](_0xf2ba('0xf'),auth[_0xf2ba('0x8')](),controller['removeTeams']);router[_0xf2ba('0x19')](_0xf2ba('0x15'),auth['isAuthenticated'](),controller[_0xf2ba('0x1a')]);module[_0xf2ba('0x1b')]=router; \ No newline at end of file +var _0xd9dd=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id'];(function(_0x21bf49,_0x326824){var _0x41e987=function(_0x11c6f4){while(--_0x11c6f4){_0x21bf49['push'](_0x21bf49['shift']());}};_0x41e987(++_0x326824);}(_0xd9dd,0x9b));var _0xdd9d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd9dd[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xdd9d('0x0'));var util=require(_0xdd9d('0x1'));var path=require('path');var timeout=require(_0xdd9d('0x2'));var express=require(_0xdd9d('0x3'));var router=express[_0xdd9d('0x4')]();var fs_extra=require(_0xdd9d('0x5'));var auth=require(_0xdd9d('0x6'));var interaction=require(_0xdd9d('0x7'));var config=require('../../config/environment');var controller=require('./chatQueue.controller');router[_0xdd9d('0x8')]('/',auth[_0xdd9d('0x9')](),controller[_0xdd9d('0xa')]);router[_0xdd9d('0x8')]('/describe',auth[_0xdd9d('0x9')](),controller[_0xdd9d('0xb')]);router[_0xdd9d('0x8')](_0xdd9d('0xc'),auth['isAuthenticated'](),controller[_0xdd9d('0xd')]);router['get'](_0xdd9d('0xe'),auth[_0xdd9d('0x9')](),controller[_0xdd9d('0xf')]);router[_0xdd9d('0x8')](_0xdd9d('0x10'),auth['isAuthenticated'](),controller[_0xdd9d('0x11')]);router[_0xdd9d('0x8')](_0xdd9d('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0xdd9d('0x13')]('/',auth[_0xdd9d('0x9')](),controller['create']);router['post'](_0xdd9d('0x10'),auth['isAuthenticated'](),controller[_0xdd9d('0x14')]);router[_0xdd9d('0x13')](_0xdd9d('0x12'),auth[_0xdd9d('0x9')](),controller[_0xdd9d('0x15')]);router['put'](_0xdd9d('0xc'),auth[_0xdd9d('0x9')](),controller[_0xdd9d('0x16')]);router[_0xdd9d('0x17')]('/:id',auth[_0xdd9d('0x9')](),controller[_0xdd9d('0x18')]);router['delete'](_0xdd9d('0x10'),auth[_0xdd9d('0x9')](),controller[_0xdd9d('0x19')]);router[_0xdd9d('0x17')](_0xdd9d('0x12'),auth['isAuthenticated'](),controller[_0xdd9d('0x1a')]);module[_0xdd9d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index b9a8c2b..12b3be8 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 _0x3a40=['moment','sequelize','exports','STRING','DATE'];(function(_0x52405a,_0x2b3071){var _0x443b9c=function(_0x5f268b){while(--_0x5f268b){_0x52405a['push'](_0x52405a['shift']());}};_0x443b9c(++_0x2b3071);}(_0x3a40,0xaa));var _0x03a4=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x3a40[_0x465028];return _0xb783d4;};'use strict';var moment=require(_0x03a4('0x0'));var Sequelize=require(_0x03a4('0x1'));module[_0x03a4('0x2')]={'uniqueid':{'type':Sequelize[_0x03a4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x03a4('0x3')]},'joinAt':{'type':Sequelize[_0x03a4('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x03a4('0x4')]},'exitAt':{'type':Sequelize[_0x03a4('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x53b3=['STRING','DATE','sequelize','exports'];(function(_0x1b346a,_0x3474da){var _0x2f5c0e=function(_0x32c463){while(--_0x32c463){_0x1b346a['push'](_0x1b346a['shift']());}};_0x2f5c0e(++_0x3474da);}(_0x53b3,0x1b6));var _0x353b=function(_0x2f5fb5,_0x3bec82){_0x2f5fb5=_0x2f5fb5-0x0;var _0x5c7957=_0x53b3[_0x2f5fb5];return _0x5c7957;};'use strict';var moment=require('moment');var Sequelize=require(_0x353b('0x0'));module[_0x353b('0x1')]={'uniqueid':{'type':Sequelize[_0x353b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x353b('0x3')]},'reason':{'type':Sequelize[_0x353b('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f56d835..2bf0a24 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 _0x9308=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','index','map','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','VIRTUAL','merge','options','ChatQueueReport','includeAll','include','rows','catch','show','params','rawAttributes','find','body','destroy','describe','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis'];(function(_0x3df239,_0x5ca310){var _0x23bf47=function(_0x498b5d){while(--_0x498b5d){_0x3df239['push'](_0x3df239['shift']());}};_0x23bf47(++_0x5ca310);}(_0x9308,0xcd));var _0x8930=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9308[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x8930('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8930('0x1'));var moment=require(_0x8930('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8930('0x3'));var util=require(_0x8930('0x4'));var path=require(_0x8930('0x5'));var sox=require('sox');var csv=require(_0x8930('0x6'));var ejs=require(_0x8930('0x7'));var fs=require('fs');var fs_extra=require(_0x8930('0x8'));var _=require(_0x8930('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8930('0xa'));var deskjs=require(_0x8930('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8930('0xc'));var Redis=require(_0x8930('0xd'));var authService=require(_0x8930('0xe'));var qs=require(_0x8930('0xf'));var as=require(_0x8930('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8930('0x11'))(_0x8930('0x12'));var utils=require('../../config/utils');var config=require(_0x8930('0x13'));var licenseUtil=require(_0x8930('0x14'));var db=require(_0x8930('0x15'))['db'];function respondWithStatusCode(_0x22adfb,_0x32b700){_0x32b700=_0x32b700||0xcc;return function(_0x19c007){if(_0x19c007){return _0x22adfb[_0x8930('0x16')](_0x32b700);}return _0x22adfb['status'](_0x32b700)[_0x8930('0x17')]();};}function respondWithResult(_0xbd5e07,_0xb0ba70){_0xb0ba70=_0xb0ba70||0xc8;return function(_0x4fd288){if(_0x4fd288){return _0xbd5e07[_0x8930('0x18')](_0xb0ba70)[_0x8930('0x19')](_0x4fd288);}};}function respondWithFilteredResult(_0x529b19,_0x579d04){return function(_0x2e6fa2){if(_0x2e6fa2){var _0x3a06ed=typeof _0x579d04[_0x8930('0x1a')]===_0x8930('0x1b')&&typeof _0x579d04[_0x8930('0x1c')]===_0x8930('0x1b');var _0x191f87=_0x2e6fa2['count'];var _0xe2336a=_0x3a06ed?0x0:_0x579d04[_0x8930('0x1a')];var _0x30ddfb=_0x3a06ed?_0x2e6fa2[_0x8930('0x1d')]:_0x579d04['offset']+_0x579d04[_0x8930('0x1c')];var _0xb46fb9;if(_0x30ddfb>=_0x191f87){_0x30ddfb=_0x191f87;_0xb46fb9=0xc8;}else{_0xb46fb9=0xce;}_0x529b19[_0x8930('0x18')](_0xb46fb9);return _0x529b19[_0x8930('0x1e')](_0x8930('0x1f'),_0xe2336a+'-'+_0x30ddfb+'/'+_0x191f87)[_0x8930('0x19')](_0x2e6fa2);}return null;};}function patchUpdates(_0x439fd5){return function(_0x31edf8){try{jsonpatch[_0x8930('0x20')](_0x31edf8,_0x439fd5,!![]);}catch(_0x58f487){return BPromise[_0x8930('0x21')](_0x58f487);}return _0x31edf8[_0x8930('0x22')]();};}function saveUpdates(_0x50476e,_0x110249){return function(_0x3aa3a7){if(_0x3aa3a7){return _0x3aa3a7[_0x8930('0x23')](_0x50476e)['then'](function(_0x5bba95){return _0x5bba95;});}return null;};}function removeEntity(_0x4b8a13,_0x281240){return function(_0x26927c){if(_0x26927c){return _0x26927c['destroy']()[_0x8930('0x24')](function(){_0x4b8a13[_0x8930('0x18')](0xcc)[_0x8930('0x17')]();});}};}function handleEntityNotFound(_0x4de37d,_0xb2f828){return function(_0x435eac){if(!_0x435eac){_0x4de37d['sendStatus'](0x194);}return _0x435eac;};}function handleError(_0x5bcfbc,_0x550062){_0x550062=_0x550062||0x1f4;return function(_0x339fb5){logger[_0x8930('0x25')](_0x339fb5[_0x8930('0x26')]);if(_0x339fb5['name']){delete _0x339fb5['name'];}_0x5bcfbc[_0x8930('0x18')](_0x550062)['send'](_0x339fb5);};}exports[_0x8930('0x27')]=function(_0x40133a,_0x1caba9){var _0x377613={},_0x2de2ac={},_0x38ac1e={'count':0x0,'rows':[]};var _0x508681=_[_0x8930('0x28')](db['ChatQueueReport']['rawAttributes'],function(_0x359e8c){return{'name':_0x359e8c[_0x8930('0x29')],'type':_0x359e8c[_0x8930('0x2a')][_0x8930('0x2b')]};});_0x2de2ac[_0x8930('0x2c')]=_[_0x8930('0x28')](_0x508681,_0x8930('0x2d'));_0x2de2ac['query']=_[_0x8930('0x2e')](_0x40133a['query']);_0x2de2ac[_0x8930('0x2f')]=_[_0x8930('0x30')](_0x2de2ac[_0x8930('0x2c')],_0x2de2ac[_0x8930('0x31')]);_0x377613[_0x8930('0x32')]=_[_0x8930('0x30')](_0x2de2ac['model'],qs[_0x8930('0x33')](_0x40133a[_0x8930('0x31')][_0x8930('0x33')]));_0x377613[_0x8930('0x32')]=_0x377613['attributes'][_0x8930('0x34')]?_0x377613[_0x8930('0x32')]:_0x2de2ac[_0x8930('0x2c')];if(!_0x40133a[_0x8930('0x31')][_0x8930('0x35')](_0x8930('0x36'))){_0x377613[_0x8930('0x1c')]=qs['limit'](_0x40133a[_0x8930('0x31')][_0x8930('0x1c')]);_0x377613[_0x8930('0x1a')]=qs[_0x8930('0x1a')](_0x40133a[_0x8930('0x31')][_0x8930('0x1a')]);}_0x377613['order']=qs['sort'](_0x40133a[_0x8930('0x31')]['sort']);_0x377613['where']=qs[_0x8930('0x2f')](_[_0x8930('0x37')](_0x40133a[_0x8930('0x31')],_0x2de2ac[_0x8930('0x2f')]),_0x508681);if(_0x40133a[_0x8930('0x31')][_0x8930('0x38')]){_0x377613[_0x8930('0x39')]=_['merge'](_0x377613[_0x8930('0x39')],{'$or':_['map'](_0x508681,function(_0x32eac4){if(_0x32eac4[_0x8930('0x2a')]!==_0x8930('0x3a')){var _0x1b23d4={};_0x1b23d4[_0x32eac4[_0x8930('0x2d')]]={'$like':'%'+_0x40133a['query'][_0x8930('0x38')]+'%'};return _0x1b23d4;}})});}_0x377613=_[_0x8930('0x3b')]({},_0x377613,_0x40133a[_0x8930('0x3c')]);var _0x196f22={'where':_0x377613[_0x8930('0x39')]};return db[_0x8930('0x3d')]['count'](_0x196f22)[_0x8930('0x24')](function(_0x5e4173){_0x38ac1e[_0x8930('0x1d')]=_0x5e4173;if(_0x40133a['query'][_0x8930('0x3e')]){_0x377613[_0x8930('0x3f')]=[{'all':!![]}];}return db[_0x8930('0x3d')]['findAll'](_0x377613);})['then'](function(_0x272772){_0x38ac1e[_0x8930('0x40')]=_0x272772;return _0x38ac1e;})['then'](respondWithFilteredResult(_0x1caba9,_0x377613))[_0x8930('0x41')](handleError(_0x1caba9,null));};exports[_0x8930('0x42')]=function(_0x532815,_0x57b987){var _0x149dae={'raw':!![],'where':{'id':_0x532815[_0x8930('0x43')]['id']}},_0x540b24={};_0x540b24[_0x8930('0x2c')]=_[_0x8930('0x2e')](db['ChatQueueReport'][_0x8930('0x44')]);_0x540b24[_0x8930('0x31')]=_['keys'](_0x532815[_0x8930('0x31')]);_0x540b24['filters']=_[_0x8930('0x30')](_0x540b24[_0x8930('0x2c')],_0x540b24[_0x8930('0x31')]);_0x149dae[_0x8930('0x32')]=_[_0x8930('0x30')](_0x540b24[_0x8930('0x2c')],qs[_0x8930('0x33')](_0x532815['query'][_0x8930('0x33')]));_0x149dae[_0x8930('0x32')]=_0x149dae[_0x8930('0x32')][_0x8930('0x34')]?_0x149dae[_0x8930('0x32')]:_0x540b24[_0x8930('0x2c')];if(_0x532815[_0x8930('0x31')][_0x8930('0x3e')]){_0x149dae['include']=[{'all':!![]}];}_0x149dae=_[_0x8930('0x3b')]({},_0x149dae,_0x532815[_0x8930('0x3c')]);return db[_0x8930('0x3d')][_0x8930('0x45')](_0x149dae)['then'](handleEntityNotFound(_0x57b987,null))[_0x8930('0x24')](respondWithResult(_0x57b987,null))[_0x8930('0x41')](handleError(_0x57b987,null));};exports['create']=function(_0x4c79b7,_0x3513be){return db[_0x8930('0x3d')]['create'](_0x4c79b7[_0x8930('0x46')],{})[_0x8930('0x24')](respondWithResult(_0x3513be,0xc9))['catch'](handleError(_0x3513be,null));};exports['update']=function(_0xb8b2b0,_0x1f0792){if(_0xb8b2b0[_0x8930('0x46')]['id']){delete _0xb8b2b0['body']['id'];}return db[_0x8930('0x3d')][_0x8930('0x45')]({'where':{'id':_0xb8b2b0[_0x8930('0x43')]['id']}})[_0x8930('0x24')](handleEntityNotFound(_0x1f0792,null))[_0x8930('0x24')](saveUpdates(_0xb8b2b0['body'],null))[_0x8930('0x24')](respondWithResult(_0x1f0792,null))[_0x8930('0x41')](handleError(_0x1f0792,null));};exports[_0x8930('0x47')]=function(_0x53d00c,_0x4f0459){return db[_0x8930('0x3d')][_0x8930('0x45')]({'where':{'id':_0x53d00c['params']['id']}})[_0x8930('0x24')](handleEntityNotFound(_0x4f0459,null))[_0x8930('0x24')](removeEntity(_0x4f0459,null))[_0x8930('0x41')](handleError(_0x4f0459,null));};exports[_0x8930('0x48')]=function(_0x528c5f,_0x3a352a){return db['ChatQueueReport'][_0x8930('0x48')]()[_0x8930('0x24')](respondWithResult(_0x3a352a,null))[_0x8930('0x41')](handleError(_0x3a352a,null));}; \ No newline at end of file +var _0x5d76=['../../config/environment','../../mysqldb','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5d76,0x1f1));var _0x65d7=function(_0x54201a,_0x4738a6){_0x54201a=_0x54201a-0x0;var _0x345c68=_0x5d76[_0x54201a];return _0x345c68;};'use strict';var emlformat=require(_0x65d7('0x0'));var rimraf=require(_0x65d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65d7('0x2'));var rp=require('request-promise');var moment=require(_0x65d7('0x3'));var BPromise=require(_0x65d7('0x4'));var Mustache=require(_0x65d7('0x5'));var util=require(_0x65d7('0x6'));var path=require(_0x65d7('0x7'));var sox=require(_0x65d7('0x8'));var csv=require(_0x65d7('0x9'));var ejs=require(_0x65d7('0xa'));var fs=require('fs');var fs_extra=require(_0x65d7('0xb'));var _=require('lodash');var squel=require(_0x65d7('0xc'));var crypto=require(_0x65d7('0xd'));var jsforce=require(_0x65d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x65d7('0x9'));var querystring=require('querystring');var Papa=require(_0x65d7('0xf'));var Redis=require(_0x65d7('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x65d7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65d7('0x12'))(_0x65d7('0x13'));var utils=require(_0x65d7('0x14'));var config=require(_0x65d7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x65d7('0x16'))['db'];function respondWithStatusCode(_0x4c3e73,_0x2f7dbb){_0x2f7dbb=_0x2f7dbb||0xcc;return function(_0x22b1e7){if(_0x22b1e7){return _0x4c3e73['sendStatus'](_0x2f7dbb);}return _0x4c3e73['status'](_0x2f7dbb)[_0x65d7('0x17')]();};}function respondWithResult(_0x3410bd,_0xf919ec){_0xf919ec=_0xf919ec||0xc8;return function(_0x25ebc6){if(_0x25ebc6){return _0x3410bd[_0x65d7('0x18')](_0xf919ec)[_0x65d7('0x19')](_0x25ebc6);}};}function respondWithFilteredResult(_0x3d29a8,_0x27f018){return function(_0x4b7177){if(_0x4b7177){var _0x4a1ea6=typeof _0x27f018['offset']==='undefined'&&typeof _0x27f018[_0x65d7('0x1a')]===_0x65d7('0x1b');var _0x1cead0=_0x4b7177[_0x65d7('0x1c')];var _0xaf2237=_0x4a1ea6?0x0:_0x27f018['offset'];var _0x366f3b=_0x4a1ea6?_0x4b7177[_0x65d7('0x1c')]:_0x27f018[_0x65d7('0x1d')]+_0x27f018[_0x65d7('0x1a')];var _0x164700;if(_0x366f3b>=_0x1cead0){_0x366f3b=_0x1cead0;_0x164700=0xc8;}else{_0x164700=0xce;}_0x3d29a8['status'](_0x164700);return _0x3d29a8['set'](_0x65d7('0x1e'),_0xaf2237+'-'+_0x366f3b+'/'+_0x1cead0)[_0x65d7('0x19')](_0x4b7177);}return null;};}function patchUpdates(_0xa1e66e){return function(_0x46ca4a){try{jsonpatch[_0x65d7('0x1f')](_0x46ca4a,_0xa1e66e,!![]);}catch(_0x302879){return BPromise[_0x65d7('0x20')](_0x302879);}return _0x46ca4a[_0x65d7('0x21')]();};}function saveUpdates(_0x58345d,_0x11a93f){return function(_0x2482a5){if(_0x2482a5){return _0x2482a5[_0x65d7('0x22')](_0x58345d)[_0x65d7('0x23')](function(_0x51a5e4){return _0x51a5e4;});}return null;};}function removeEntity(_0x47dd2d,_0x120d3a){return function(_0x14a8d0){if(_0x14a8d0){return _0x14a8d0['destroy']()['then'](function(){_0x47dd2d['status'](0xcc)[_0x65d7('0x17')]();});}};}function handleEntityNotFound(_0x6ca6b4,_0x12778d){return function(_0x33705d){if(!_0x33705d){_0x6ca6b4[_0x65d7('0x24')](0x194);}return _0x33705d;};}function handleError(_0x510c93,_0xe9d2ad){_0xe9d2ad=_0xe9d2ad||0x1f4;return function(_0x21f80d){logger[_0x65d7('0x25')](_0x21f80d[_0x65d7('0x26')]);if(_0x21f80d[_0x65d7('0x27')]){delete _0x21f80d[_0x65d7('0x27')];}_0x510c93[_0x65d7('0x18')](_0xe9d2ad)[_0x65d7('0x28')](_0x21f80d);};}exports[_0x65d7('0x29')]=function(_0x3ceb96,_0x2440ba){var _0x51be90={},_0x2330ce={},_0x40beb8={'count':0x0,'rows':[]};var _0x1b5b52=_[_0x65d7('0x2a')](db[_0x65d7('0x2b')][_0x65d7('0x2c')],function(_0x31fa28){return{'name':_0x31fa28[_0x65d7('0x2d')],'type':_0x31fa28[_0x65d7('0x2e')][_0x65d7('0x2f')]};});_0x2330ce[_0x65d7('0x30')]=_[_0x65d7('0x2a')](_0x1b5b52,_0x65d7('0x27'));_0x2330ce[_0x65d7('0x31')]=_[_0x65d7('0x32')](_0x3ceb96['query']);_0x2330ce[_0x65d7('0x33')]=_[_0x65d7('0x34')](_0x2330ce['model'],_0x2330ce[_0x65d7('0x31')]);_0x51be90[_0x65d7('0x35')]=_[_0x65d7('0x34')](_0x2330ce[_0x65d7('0x30')],qs[_0x65d7('0x36')](_0x3ceb96[_0x65d7('0x31')][_0x65d7('0x36')]));_0x51be90[_0x65d7('0x35')]=_0x51be90['attributes'][_0x65d7('0x37')]?_0x51be90[_0x65d7('0x35')]:_0x2330ce['model'];if(!_0x3ceb96[_0x65d7('0x31')][_0x65d7('0x38')]('nolimit')){_0x51be90[_0x65d7('0x1a')]=qs[_0x65d7('0x1a')](_0x3ceb96[_0x65d7('0x31')][_0x65d7('0x1a')]);_0x51be90['offset']=qs['offset'](_0x3ceb96[_0x65d7('0x31')][_0x65d7('0x1d')]);}_0x51be90[_0x65d7('0x39')]=qs['sort'](_0x3ceb96[_0x65d7('0x31')][_0x65d7('0x3a')]);_0x51be90[_0x65d7('0x3b')]=qs[_0x65d7('0x33')](_['pick'](_0x3ceb96[_0x65d7('0x31')],_0x2330ce[_0x65d7('0x33')]),_0x1b5b52);if(_0x3ceb96['query'][_0x65d7('0x3c')]){_0x51be90[_0x65d7('0x3b')]=_['merge'](_0x51be90[_0x65d7('0x3b')],{'$or':_['map'](_0x1b5b52,function(_0x16222b){if(_0x16222b[_0x65d7('0x2e')]!=='VIRTUAL'){var _0xa61091={};_0xa61091[_0x16222b[_0x65d7('0x27')]]={'$like':'%'+_0x3ceb96[_0x65d7('0x31')][_0x65d7('0x3c')]+'%'};return _0xa61091;}})});}_0x51be90=_[_0x65d7('0x3d')]({},_0x51be90,_0x3ceb96[_0x65d7('0x3e')]);var _0x2080bf={'where':_0x51be90[_0x65d7('0x3b')]};return db[_0x65d7('0x2b')]['count'](_0x2080bf)[_0x65d7('0x23')](function(_0x2280b6){_0x40beb8[_0x65d7('0x1c')]=_0x2280b6;if(_0x3ceb96['query'][_0x65d7('0x3f')]){_0x51be90[_0x65d7('0x40')]=[{'all':!![]}];}return db[_0x65d7('0x2b')][_0x65d7('0x41')](_0x51be90);})[_0x65d7('0x23')](function(_0xbb49b0){_0x40beb8[_0x65d7('0x42')]=_0xbb49b0;return _0x40beb8;})[_0x65d7('0x23')](respondWithFilteredResult(_0x2440ba,_0x51be90))[_0x65d7('0x43')](handleError(_0x2440ba,null));};exports['show']=function(_0xdd5850,_0x33d126){var _0x305c5a={'raw':!![],'where':{'id':_0xdd5850[_0x65d7('0x44')]['id']}},_0x17d968={};_0x17d968[_0x65d7('0x30')]=_[_0x65d7('0x32')](db[_0x65d7('0x2b')][_0x65d7('0x2c')]);_0x17d968[_0x65d7('0x31')]=_['keys'](_0xdd5850[_0x65d7('0x31')]);_0x17d968[_0x65d7('0x33')]=_['intersection'](_0x17d968[_0x65d7('0x30')],_0x17d968[_0x65d7('0x31')]);_0x305c5a[_0x65d7('0x35')]=_['intersection'](_0x17d968[_0x65d7('0x30')],qs[_0x65d7('0x36')](_0xdd5850[_0x65d7('0x31')][_0x65d7('0x36')]));_0x305c5a['attributes']=_0x305c5a[_0x65d7('0x35')][_0x65d7('0x37')]?_0x305c5a[_0x65d7('0x35')]:_0x17d968[_0x65d7('0x30')];if(_0xdd5850[_0x65d7('0x31')]['includeAll']){_0x305c5a[_0x65d7('0x40')]=[{'all':!![]}];}_0x305c5a=_[_0x65d7('0x3d')]({},_0x305c5a,_0xdd5850[_0x65d7('0x3e')]);return db['ChatQueueReport']['find'](_0x305c5a)[_0x65d7('0x23')](handleEntityNotFound(_0x33d126,null))[_0x65d7('0x23')](respondWithResult(_0x33d126,null))[_0x65d7('0x43')](handleError(_0x33d126,null));};exports[_0x65d7('0x45')]=function(_0x486bb1,_0x209dac){return db[_0x65d7('0x2b')][_0x65d7('0x45')](_0x486bb1[_0x65d7('0x46')],{})[_0x65d7('0x23')](respondWithResult(_0x209dac,0xc9))['catch'](handleError(_0x209dac,null));};exports[_0x65d7('0x22')]=function(_0x1f3f07,_0xced285){if(_0x1f3f07['body']['id']){delete _0x1f3f07[_0x65d7('0x46')]['id'];}return db['ChatQueueReport'][_0x65d7('0x47')]({'where':{'id':_0x1f3f07[_0x65d7('0x44')]['id']}})[_0x65d7('0x23')](handleEntityNotFound(_0xced285,null))[_0x65d7('0x23')](saveUpdates(_0x1f3f07[_0x65d7('0x46')],null))[_0x65d7('0x23')](respondWithResult(_0xced285,null))[_0x65d7('0x43')](handleError(_0xced285,null));};exports[_0x65d7('0x48')]=function(_0x364f15,_0x53c2a8){return db[_0x65d7('0x2b')][_0x65d7('0x47')]({'where':{'id':_0x364f15[_0x65d7('0x44')]['id']}})[_0x65d7('0x23')](handleEntityNotFound(_0x53c2a8,null))[_0x65d7('0x23')](removeEntity(_0x53c2a8,null))[_0x65d7('0x43')](handleError(_0x53c2a8,null));};exports[_0x65d7('0x49')]=function(_0x217627,_0x1cc832){return db['ChatQueueReport']['describe']()['then'](respondWithResult(_0x1cc832,null))[_0x65d7('0x43')](handleError(_0x1cc832,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 586a93a..598ef6b 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 _0x59d2=['uniqueid','lodash','api','bluebird','request-promise','path','../../config/environment','exports','define','ChatQueueReport','report_chat_queue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x59d2,0x12a));var _0x259d=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x59d2[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x259d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x259d('0x1'));var moment=require('moment');var BPromise=require(_0x259d('0x2'));var rp=require(_0x259d('0x3'));var fs=require('fs');var path=require(_0x259d('0x4'));var rimraf=require('rimraf');var config=require(_0x259d('0x5'));var attributes=require('./chatQueueReport.attributes');module[_0x259d('0x6')]=function(_0xb9efd8,_0x305585){return _0xb9efd8[_0x259d('0x7')](_0x259d('0x8'),attributes,{'tableName':_0x259d('0x9'),'paranoid':![],'indexes':[{'name':_0x259d('0xa'),'fields':[_0x259d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x082c=['ChatQueueReport','uniqueid','lodash','api','moment','bluebird','rimraf','../../config/environment','./chatQueueReport.attributes','define'];(function(_0x433ae5,_0x383ada){var _0x31b585=function(_0x59d3e8){while(--_0x59d3e8){_0x433ae5['push'](_0x433ae5['shift']());}};_0x31b585(++_0x383ada);}(_0x082c,0xfc));var _0xc082=function(_0x3d2bd0,_0x368ef1){_0x3d2bd0=_0x3d2bd0-0x0;var _0x33508a=_0x082c[_0x3d2bd0];return _0x33508a;};'use strict';var _=require(_0xc082('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc082('0x1'));var moment=require(_0xc082('0x2'));var BPromise=require(_0xc082('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc082('0x4'));var config=require(_0xc082('0x5'));var attributes=require(_0xc082('0x6'));module['exports']=function(_0xc66bb,_0x18773e){return _0xc66bb[_0xc082('0x7')](_0xc082('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0xc082('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 0313cec..0e6c721 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 _0x6d79=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','update','where','attributes','limit','lodash','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x2348b2,_0x342afa){var _0x5c875c=function(_0x279040){while(--_0x279040){_0x2348b2['push'](_0x2348b2['shift']());}};_0x5c875c(++_0x342afa);}(_0x6d79,0x103));var _0x96d7=function(_0x33abdf,_0x35826e){_0x33abdf=_0x33abdf-0x0;var _0x4c32b4=_0x6d79[_0x33abdf];return _0x4c32b4;};'use strict';var _=require(_0x96d7('0x0'));var util=require('util');var moment=require(_0x96d7('0x1'));var BPromise=require(_0x96d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96d7('0x3'))['db'];var utils=require(_0x96d7('0x4'));var logger=require(_0x96d7('0x5'))('rpc');var config=require(_0x96d7('0x6'));var jayson=require(_0x96d7('0x7'));var client=jayson[_0x96d7('0x8')][_0x96d7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x435da4,_0xd02ba1,_0x565aed){return new BPromise(function(_0x30eb49,_0x117195){return client[_0x96d7('0xa')](_0x435da4,_0x565aed)[_0x96d7('0xb')](function(_0x550b63){logger[_0x96d7('0xc')](_0x96d7('0xd'),_0xd02ba1,_0x96d7('0xe'));logger[_0x96d7('0xf')](_0x96d7('0x10'),_0xd02ba1,_0x96d7('0xe'),JSON[_0x96d7('0x11')](_0x550b63));if(_0x550b63['error']){if(_0x550b63['error'][_0x96d7('0x12')]===0x1f4){logger[_0x96d7('0x13')](_0x96d7('0xd'),_0xd02ba1,_0x550b63[_0x96d7('0x13')][_0x96d7('0x14')]);return _0x117195(_0x550b63[_0x96d7('0x13')]['message']);}logger['error'](_0x96d7('0xd'),_0xd02ba1,_0x550b63[_0x96d7('0x13')]['message']);return _0x30eb49(_0x550b63['error'][_0x96d7('0x14')]);}else{logger['info'](_0x96d7('0xd'),_0xd02ba1,'request\x20sent');_0x30eb49(_0x550b63['result']['message']);}})[_0x96d7('0x15')](function(_0xd57a1f){logger['error'](_0x96d7('0xd'),_0xd02ba1,_0xd57a1f);_0x117195(_0xd57a1f);});});}exports['CreateChatQueueReport']=function(_0x3b1514){var _0x3bfb72=this;return new Promise(function(_0x55a958,_0x397b50){return db[_0x96d7('0x16')][_0x96d7('0x17')](_0x3b1514[_0x96d7('0x18')],{'raw':_0x3b1514['options']?_0x3b1514[_0x96d7('0x19')][_0x96d7('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x383816){logger[_0x96d7('0xc')](_0x96d7('0x1b'),_0x3b1514);logger[_0x96d7('0xf')]('CreateChatQueueReport',_0x3b1514,JSON['stringify'](_0x383816));_0x55a958(_0x383816);})[_0x96d7('0x15')](function(_0x4d500d){logger[_0x96d7('0x13')](_0x96d7('0x1b'),_0x4d500d[_0x96d7('0x14')],_0x3b1514);_0x397b50(_0x3bfb72[_0x96d7('0x13')](0x1f4,_0x4d500d[_0x96d7('0x14')]));});});};exports[_0x96d7('0x1c')]=function(_0x5f323f){var _0x27db8d=this;return new Promise(function(_0x1329f6,_0x3e9753){return db[_0x96d7('0x16')][_0x96d7('0x1d')](_0x5f323f[_0x96d7('0x18')],{'raw':_0x5f323f[_0x96d7('0x19')]?_0x5f323f[_0x96d7('0x19')][_0x96d7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f323f['options']?_0x5f323f[_0x96d7('0x19')][_0x96d7('0x1e')]||null:null,'attributes':_0x5f323f[_0x96d7('0x19')]?_0x5f323f[_0x96d7('0x19')][_0x96d7('0x1f')]||null:null,'limit':_0x5f323f[_0x96d7('0x19')]?_0x5f323f[_0x96d7('0x19')][_0x96d7('0x20')]||null:null})[_0x96d7('0xb')](function(_0x6c2746){logger[_0x96d7('0xc')](_0x96d7('0x1c'),_0x5f323f);logger['debug'](_0x96d7('0x1c'),_0x5f323f,JSON[_0x96d7('0x11')](_0x6c2746));_0x1329f6(_0x6c2746);})[_0x96d7('0x15')](function(_0x544093){logger[_0x96d7('0x13')](_0x96d7('0x1c'),_0x544093[_0x96d7('0x14')],_0x5f323f);_0x3e9753(_0x27db8d[_0x96d7('0x13')](0x1f4,_0x544093[_0x96d7('0x14')]));});});}; \ No newline at end of file +var _0xf205=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','catch','UpdateChatQueueReport','where','limit','util','moment'];(function(_0x4bce40,_0x148995){var _0x281d9e=function(_0x7ed4bd){while(--_0x7ed4bd){_0x4bce40['push'](_0x4bce40['shift']());}};_0x281d9e(++_0x148995);}(_0xf205,0xb2));var _0x5f20=function(_0xb071f8,_0x31ee90){_0xb071f8=_0xb071f8-0x0;var _0x40baee=_0xf205[_0xb071f8];return _0x40baee;};'use strict';var _=require('lodash');var util=require(_0x5f20('0x0'));var moment=require(_0x5f20('0x1'));var BPromise=require(_0x5f20('0x2'));var rs=require(_0x5f20('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5f20('0x4'));var logger=require(_0x5f20('0x5'))(_0x5f20('0x6'));var config=require(_0x5f20('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5f20('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32530a,_0x24707f,_0x1d812e){return new BPromise(function(_0x20bd73,_0x4bc6d3){return client[_0x5f20('0x9')](_0x32530a,_0x1d812e)[_0x5f20('0xa')](function(_0xa04d64){logger[_0x5f20('0xb')](_0x5f20('0xc'),_0x24707f,_0x5f20('0xd'));logger[_0x5f20('0xe')](_0x5f20('0xf'),_0x24707f,'request\x20sent',JSON[_0x5f20('0x10')](_0xa04d64));if(_0xa04d64[_0x5f20('0x11')]){if(_0xa04d64[_0x5f20('0x11')]['code']===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x24707f,_0xa04d64[_0x5f20('0x11')][_0x5f20('0x12')]);return _0x4bc6d3(_0xa04d64[_0x5f20('0x11')][_0x5f20('0x12')]);}logger['error'](_0x5f20('0xc'),_0x24707f,_0xa04d64[_0x5f20('0x11')][_0x5f20('0x12')]);return _0x20bd73(_0xa04d64['error'][_0x5f20('0x12')]);}else{logger[_0x5f20('0xb')](_0x5f20('0xc'),_0x24707f,_0x5f20('0xd'));_0x20bd73(_0xa04d64[_0x5f20('0x13')][_0x5f20('0x12')]);}})['catch'](function(_0xdbecbf){logger[_0x5f20('0x11')](_0x5f20('0xc'),_0x24707f,_0xdbecbf);_0x4bc6d3(_0xdbecbf);});});}exports['CreateChatQueueReport']=function(_0x57d041){var _0x14e86a=this;return new Promise(function(_0x2d04a9,_0x20fd64){return db[_0x5f20('0x14')][_0x5f20('0x15')](_0x57d041[_0x5f20('0x16')],{'raw':_0x57d041[_0x5f20('0x17')]?_0x57d041['options'][_0x5f20('0x18')]===undefined?!![]:![]:!![]})[_0x5f20('0xa')](function(_0x4686a5){logger[_0x5f20('0xb')](_0x5f20('0x19'),_0x57d041);logger[_0x5f20('0xe')](_0x5f20('0x19'),_0x57d041,JSON[_0x5f20('0x10')](_0x4686a5));_0x2d04a9(_0x4686a5);})[_0x5f20('0x1a')](function(_0x113596){logger[_0x5f20('0x11')](_0x5f20('0x19'),_0x113596[_0x5f20('0x12')],_0x57d041);_0x20fd64(_0x14e86a[_0x5f20('0x11')](0x1f4,_0x113596['message']));});});};exports[_0x5f20('0x1b')]=function(_0x442f6b){var _0x17260c=this;return new Promise(function(_0xb63705,_0x2a1c9b){return db[_0x5f20('0x14')]['update'](_0x442f6b[_0x5f20('0x16')],{'raw':_0x442f6b[_0x5f20('0x17')]?_0x442f6b[_0x5f20('0x17')][_0x5f20('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x442f6b['options']?_0x442f6b[_0x5f20('0x17')][_0x5f20('0x1c')]||null:null,'attributes':_0x442f6b[_0x5f20('0x17')]?_0x442f6b[_0x5f20('0x17')]['attributes']||null:null,'limit':_0x442f6b[_0x5f20('0x17')]?_0x442f6b[_0x5f20('0x17')][_0x5f20('0x1d')]||null:null})[_0x5f20('0xa')](function(_0x1a1078){logger[_0x5f20('0xb')](_0x5f20('0x1b'),_0x442f6b);logger[_0x5f20('0xe')]('UpdateChatQueueReport',_0x442f6b,JSON[_0x5f20('0x10')](_0x1a1078));_0xb63705(_0x1a1078);})['catch'](function(_0xc19d8b){logger[_0x5f20('0x11')](_0x5f20('0x1b'),_0xc19d8b['message'],_0x442f6b);_0x2a1c9b(_0x17260c[_0x5f20('0x11')](0x1f4,_0xc19d8b[_0x5f20('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index f46333f..4d6c03d 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','delete'];(function(_0x23d82d,_0x377cf9){var _0x4593a8=function(_0x662ded){while(--_0x662ded){_0x23d82d['push'](_0x23d82d['shift']());}};_0x4593a8(++_0x377cf9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xc4aa[_0x2064e5];return _0x21a233;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xdb28,0x106));var _0x8db2=function(_0x4ff8cf,_0x1eaf41){_0x4ff8cf=_0x4ff8cf-0x0;var _0x33523b=_0xdb28[_0x4ff8cf];return _0x33523b;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./chatQueueReport.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index c3e9ff1..4ed5b09 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 _0x527b=['STRING','ENUM','account','agent','queue','NOW','sequelize','exports'];(function(_0x1c9863,_0xe952b2){var _0x104660=function(_0x102bc6){while(--_0x102bc6){_0x1c9863['push'](_0x1c9863['shift']());}};_0x104660(++_0xe952b2);}(_0x527b,0x1de));var _0xb527=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0x527b[_0x3ba924];return _0x4cc1df;};'use strict';var moment=require('moment');var Sequelize=require(_0xb527('0x0'));module[_0xb527('0x1')]={'uniqueid':{'type':Sequelize[_0xb527('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb527('0x3')](_0xb527('0x4'),_0xb527('0x5'),_0xb527('0x6')),'allowNull':![],'defaultValue':_0xb527('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xb527('0x7')]}}; \ No newline at end of file +var _0xe7ad=['ENUM','account','agent','moment','STRING'];(function(_0x14fd07,_0xa72d3d){var _0x585f68=function(_0x1f2004){while(--_0x1f2004){_0x14fd07['push'](_0x14fd07['shift']());}};_0x585f68(++_0xa72d3d);}(_0xe7ad,0x198));var _0xde7a=function(_0x4f953f,_0x293a9e){_0x4f953f=_0x4f953f-0x0;var _0x5e8713=_0xe7ad[_0x4f953f];return _0x5e8713;};'use strict';var moment=require(_0xde7a('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xde7a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xde7a('0x2')](_0xde7a('0x3'),_0xde7a('0x4'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 867cb82..3600206 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 _0x08d8=['count','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','filters','intersection','query','fields','attributes','nolimit','order','sort','where','pick','merge','options','include','ChatTransferReport','findAll','rows','catch','show','params','keys','length','includeAll','create','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x44514f,_0x48b4e3){var _0x3b5882=function(_0x1b6b9b){while(--_0x1b6b9b){_0x44514f['push'](_0x44514f['shift']());}};_0x3b5882(++_0x48b4e3);}(_0x08d8,0x1e1));var _0x808d=function(_0xf8e45b,_0x336e08){_0xf8e45b=_0xf8e45b-0x0;var _0xb38c41=_0x08d8[_0xf8e45b];return _0xb38c41;};'use strict';var emlformat=require(_0x808d('0x0'));var rimraf=require(_0x808d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x808d('0x2'));var rp=require('request-promise');var moment=require(_0x808d('0x3'));var BPromise=require(_0x808d('0x4'));var Mustache=require(_0x808d('0x5'));var util=require(_0x808d('0x6'));var path=require(_0x808d('0x7'));var sox=require(_0x808d('0x8'));var csv=require(_0x808d('0x9'));var ejs=require(_0x808d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x808d('0xb'));var squel=require(_0x808d('0xc'));var crypto=require('crypto');var jsforce=require(_0x808d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x808d('0xe'));var Papa=require('papaparse');var Redis=require(_0x808d('0xf'));var authService=require(_0x808d('0x10'));var qs=require(_0x808d('0x11'));var as=require(_0x808d('0x12'));var hardwareService=require(_0x808d('0x13'));var logger=require(_0x808d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x808d('0x15'));var licenseUtil=require(_0x808d('0x16'));var db=require(_0x808d('0x17'))['db'];function respondWithStatusCode(_0x2a5a3b,_0x5c2fb9){_0x5c2fb9=_0x5c2fb9||0xcc;return function(_0x4a0b9a){if(_0x4a0b9a){return _0x2a5a3b['sendStatus'](_0x5c2fb9);}return _0x2a5a3b[_0x808d('0x18')](_0x5c2fb9)[_0x808d('0x19')]();};}function respondWithResult(_0x5f92d4,_0x46640f){_0x46640f=_0x46640f||0xc8;return function(_0x4dbfd8){if(_0x4dbfd8){return _0x5f92d4['status'](_0x46640f)[_0x808d('0x1a')](_0x4dbfd8);}};}function respondWithFilteredResult(_0x2ae009,_0x459bc1){return function(_0x36846c){if(_0x36846c){var _0xc51941=typeof _0x459bc1[_0x808d('0x1b')]===_0x808d('0x1c')&&typeof _0x459bc1[_0x808d('0x1d')]===_0x808d('0x1c');var _0x237c62=_0x36846c[_0x808d('0x1e')];var _0x523430=_0xc51941?0x0:_0x459bc1[_0x808d('0x1b')];var _0x18cb14=_0xc51941?_0x36846c['count']:_0x459bc1[_0x808d('0x1b')]+_0x459bc1[_0x808d('0x1d')];var _0x33283a;if(_0x18cb14>=_0x237c62){_0x18cb14=_0x237c62;_0x33283a=0xc8;}else{_0x33283a=0xce;}_0x2ae009['status'](_0x33283a);return _0x2ae009['set'](_0x808d('0x1f'),_0x523430+'-'+_0x18cb14+'/'+_0x237c62)[_0x808d('0x1a')](_0x36846c);}return null;};}function patchUpdates(_0x458bc9){return function(_0x1cd7a5){try{jsonpatch[_0x808d('0x20')](_0x1cd7a5,_0x458bc9,!![]);}catch(_0x19bf0d){return BPromise['reject'](_0x19bf0d);}return _0x1cd7a5[_0x808d('0x21')]();};}function saveUpdates(_0x4169c5,_0x7f305c){return function(_0x1ae83f){if(_0x1ae83f){return _0x1ae83f[_0x808d('0x22')](_0x4169c5)[_0x808d('0x23')](function(_0x1d5fbf){return _0x1d5fbf;});}return null;};}function removeEntity(_0x140fad,_0x42e20f){return function(_0x336843){if(_0x336843){return _0x336843[_0x808d('0x24')]()[_0x808d('0x23')](function(){_0x140fad[_0x808d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d4f73,_0x294e1a){return function(_0x29996a){if(!_0x29996a){_0x3d4f73[_0x808d('0x25')](0x194);}return _0x29996a;};}function handleError(_0x3a942e,_0xe9aabc){_0xe9aabc=_0xe9aabc||0x1f4;return function(_0x4344ae){logger[_0x808d('0x26')](_0x4344ae[_0x808d('0x27')]);if(_0x4344ae[_0x808d('0x28')]){delete _0x4344ae[_0x808d('0x28')];}_0x3a942e[_0x808d('0x18')](_0xe9aabc)[_0x808d('0x29')](_0x4344ae);};}exports[_0x808d('0x2a')]=function(_0x198ac0,_0x3d6d5f){var _0xca2cf={},_0x228d50={},_0x1fb2e7={'count':0x0,'rows':[]};var _0x4fe485=_[_0x808d('0x2b')](db['ChatTransferReport'][_0x808d('0x2c')],function(_0x1de064){return{'name':_0x1de064[_0x808d('0x2d')],'type':_0x1de064[_0x808d('0x2e')]['key']};});_0x228d50[_0x808d('0x2f')]=_['map'](_0x4fe485,_0x808d('0x28'));_0x228d50['query']=_['keys'](_0x198ac0['query']);_0x228d50[_0x808d('0x30')]=_[_0x808d('0x31')](_0x228d50[_0x808d('0x2f')],_0x228d50[_0x808d('0x32')]);_0xca2cf['attributes']=_[_0x808d('0x31')](_0x228d50[_0x808d('0x2f')],qs[_0x808d('0x33')](_0x198ac0[_0x808d('0x32')][_0x808d('0x33')]));_0xca2cf[_0x808d('0x34')]=_0xca2cf[_0x808d('0x34')]['length']?_0xca2cf[_0x808d('0x34')]:_0x228d50['model'];if(!_0x198ac0[_0x808d('0x32')]['hasOwnProperty'](_0x808d('0x35'))){_0xca2cf['limit']=qs[_0x808d('0x1d')](_0x198ac0['query'][_0x808d('0x1d')]);_0xca2cf['offset']=qs[_0x808d('0x1b')](_0x198ac0[_0x808d('0x32')]['offset']);}_0xca2cf[_0x808d('0x36')]=qs[_0x808d('0x37')](_0x198ac0[_0x808d('0x32')][_0x808d('0x37')]);_0xca2cf[_0x808d('0x38')]=qs[_0x808d('0x30')](_[_0x808d('0x39')](_0x198ac0[_0x808d('0x32')],_0x228d50[_0x808d('0x30')]),_0x4fe485);if(_0x198ac0[_0x808d('0x32')]['filter']){_0xca2cf['where']=_[_0x808d('0x3a')](_0xca2cf['where'],{'$or':_['map'](_0x4fe485,function(_0x588f66){if(_0x588f66['type']!=='VIRTUAL'){var _0x51b099={};_0x51b099[_0x588f66['name']]={'$like':'%'+_0x198ac0[_0x808d('0x32')]['filter']+'%'};return _0x51b099;}})});}_0xca2cf=_[_0x808d('0x3a')]({},_0xca2cf,_0x198ac0[_0x808d('0x3b')]);var _0x514d24={'where':_0xca2cf[_0x808d('0x38')]};return db['ChatTransferReport'][_0x808d('0x1e')](_0x514d24)[_0x808d('0x23')](function(_0x2a5891){_0x1fb2e7[_0x808d('0x1e')]=_0x2a5891;if(_0x198ac0[_0x808d('0x32')]['includeAll']){_0xca2cf[_0x808d('0x3c')]=[{'all':!![]}];}return db[_0x808d('0x3d')][_0x808d('0x3e')](_0xca2cf);})[_0x808d('0x23')](function(_0x843776){_0x1fb2e7[_0x808d('0x3f')]=_0x843776;return _0x1fb2e7;})[_0x808d('0x23')](respondWithFilteredResult(_0x3d6d5f,_0xca2cf))[_0x808d('0x40')](handleError(_0x3d6d5f,null));};exports[_0x808d('0x41')]=function(_0x51535f,_0x3aa069){var _0x5ad8ed={'raw':!![],'where':{'id':_0x51535f[_0x808d('0x42')]['id']}},_0x593f6a={};_0x593f6a[_0x808d('0x2f')]=_[_0x808d('0x43')](db[_0x808d('0x3d')][_0x808d('0x2c')]);_0x593f6a[_0x808d('0x32')]=_[_0x808d('0x43')](_0x51535f[_0x808d('0x32')]);_0x593f6a[_0x808d('0x30')]=_['intersection'](_0x593f6a['model'],_0x593f6a[_0x808d('0x32')]);_0x5ad8ed[_0x808d('0x34')]=_[_0x808d('0x31')](_0x593f6a[_0x808d('0x2f')],qs[_0x808d('0x33')](_0x51535f[_0x808d('0x32')][_0x808d('0x33')]));_0x5ad8ed['attributes']=_0x5ad8ed[_0x808d('0x34')][_0x808d('0x44')]?_0x5ad8ed[_0x808d('0x34')]:_0x593f6a[_0x808d('0x2f')];if(_0x51535f[_0x808d('0x32')][_0x808d('0x45')]){_0x5ad8ed[_0x808d('0x3c')]=[{'all':!![]}];}_0x5ad8ed=_['merge']({},_0x5ad8ed,_0x51535f[_0x808d('0x3b')]);return db[_0x808d('0x3d')]['find'](_0x5ad8ed)['then'](handleEntityNotFound(_0x3aa069,null))[_0x808d('0x23')](respondWithResult(_0x3aa069,null))[_0x808d('0x40')](handleError(_0x3aa069,null));};exports['create']=function(_0x492152,_0xce6e9d){return db[_0x808d('0x3d')][_0x808d('0x46')](_0x492152[_0x808d('0x47')],{})['then'](respondWithResult(_0xce6e9d,0xc9))[_0x808d('0x40')](handleError(_0xce6e9d,null));};exports[_0x808d('0x22')]=function(_0x4b304c,_0x157d7e){if(_0x4b304c['body']['id']){delete _0x4b304c['body']['id'];}return db[_0x808d('0x3d')][_0x808d('0x48')]({'where':{'id':_0x4b304c['params']['id']}})[_0x808d('0x23')](handleEntityNotFound(_0x157d7e,null))[_0x808d('0x23')](saveUpdates(_0x4b304c[_0x808d('0x47')],null))[_0x808d('0x23')](respondWithResult(_0x157d7e,null))[_0x808d('0x40')](handleError(_0x157d7e,null));};exports[_0x808d('0x24')]=function(_0x4b4922,_0x449dbd){return db[_0x808d('0x3d')]['find']({'where':{'id':_0x4b4922[_0x808d('0x42')]['id']}})['then'](handleEntityNotFound(_0x449dbd,null))[_0x808d('0x23')](removeEntity(_0x449dbd,null))['catch'](handleError(_0x449dbd,null));};exports['describe']=function(_0x1bf101,_0x54412e){return db['ChatTransferReport']['describe']()['then'](respondWithResult(_0x54412e,null))['catch'](handleError(_0x54412e,null));}; \ No newline at end of file +var _0x5c60=['limit','order','where','pick','filter','VIRTUAL','merge','options','ChatTransferReport','includeAll','include','rows','catch','show','keys','rawAttributes','find','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','reject','save','update','then','end','name','send','index','map','type','key','model','query','filters','intersection','fields','attributes','length'];(function(_0x506335,_0x3c2210){var _0x3f69e1=function(_0x3a9067){while(--_0x3a9067){_0x506335['push'](_0x506335['shift']());}};_0x3f69e1(++_0x3c2210);}(_0x5c60,0xe4));var _0x05c6=function(_0x1a0afa,_0x38342b){_0x1a0afa=_0x1a0afa-0x0;var _0x2807e7=_0x5c60[_0x1a0afa];return _0x2807e7;};'use strict';var emlformat=require(_0x05c6('0x0'));var rimraf=require(_0x05c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05c6('0x2'));var rp=require(_0x05c6('0x3'));var moment=require(_0x05c6('0x4'));var BPromise=require(_0x05c6('0x5'));var Mustache=require('mustache');var util=require(_0x05c6('0x6'));var path=require(_0x05c6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x05c6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05c6('0x9'));var squel=require(_0x05c6('0xa'));var crypto=require('crypto');var jsforce=require(_0x05c6('0xb'));var deskjs=require(_0x05c6('0xc'));var toCsv=require(_0x05c6('0xd'));var querystring=require(_0x05c6('0xe'));var Papa=require(_0x05c6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x05c6('0x10'));var as=require(_0x05c6('0x11'));var hardwareService=require(_0x05c6('0x12'));var logger=require(_0x05c6('0x13'))(_0x05c6('0x14'));var utils=require(_0x05c6('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x05c6('0x16'))['db'];function respondWithStatusCode(_0x2bb02d,_0x5990d6){_0x5990d6=_0x5990d6||0xcc;return function(_0x4f5dbb){if(_0x4f5dbb){return _0x2bb02d[_0x05c6('0x17')](_0x5990d6);}return _0x2bb02d[_0x05c6('0x18')](_0x5990d6)['end']();};}function respondWithResult(_0x56a0f5,_0x5973e8){_0x5973e8=_0x5973e8||0xc8;return function(_0x188402){if(_0x188402){return _0x56a0f5['status'](_0x5973e8)[_0x05c6('0x19')](_0x188402);}};}function respondWithFilteredResult(_0x115f75,_0x4318d7){return function(_0x24717e){if(_0x24717e){var _0x4cd02f=typeof _0x4318d7[_0x05c6('0x1a')]===_0x05c6('0x1b')&&typeof _0x4318d7['limit']===_0x05c6('0x1b');var _0x180b1f=_0x24717e['count'];var _0x2db364=_0x4cd02f?0x0:_0x4318d7[_0x05c6('0x1a')];var _0x1547f7=_0x4cd02f?_0x24717e[_0x05c6('0x1c')]:_0x4318d7[_0x05c6('0x1a')]+_0x4318d7['limit'];var _0x42d365;if(_0x1547f7>=_0x180b1f){_0x1547f7=_0x180b1f;_0x42d365=0xc8;}else{_0x42d365=0xce;}_0x115f75[_0x05c6('0x18')](_0x42d365);return _0x115f75['set'](_0x05c6('0x1d'),_0x2db364+'-'+_0x1547f7+'/'+_0x180b1f)[_0x05c6('0x19')](_0x24717e);}return null;};}function patchUpdates(_0x54f79f){return function(_0x20d85d){try{jsonpatch['apply'](_0x20d85d,_0x54f79f,!![]);}catch(_0x2c5611){return BPromise[_0x05c6('0x1e')](_0x2c5611);}return _0x20d85d[_0x05c6('0x1f')]();};}function saveUpdates(_0x437a89,_0x400c9a){return function(_0xd68067){if(_0xd68067){return _0xd68067[_0x05c6('0x20')](_0x437a89)[_0x05c6('0x21')](function(_0x80a1b5){return _0x80a1b5;});}return null;};}function removeEntity(_0x8babff,_0x161229){return function(_0x10138b){if(_0x10138b){return _0x10138b['destroy']()[_0x05c6('0x21')](function(){_0x8babff['status'](0xcc)[_0x05c6('0x22')]();});}};}function handleEntityNotFound(_0x4f0054,_0x177679){return function(_0x1b5ca8){if(!_0x1b5ca8){_0x4f0054[_0x05c6('0x17')](0x194);}return _0x1b5ca8;};}function handleError(_0x35daa0,_0x5031a1){_0x5031a1=_0x5031a1||0x1f4;return function(_0x516aa){logger['error'](_0x516aa['stack']);if(_0x516aa[_0x05c6('0x23')]){delete _0x516aa[_0x05c6('0x23')];}_0x35daa0[_0x05c6('0x18')](_0x5031a1)[_0x05c6('0x24')](_0x516aa);};}exports[_0x05c6('0x25')]=function(_0x227e96,_0x344b64){var _0x454321={},_0xe98c2d={},_0x429937={'count':0x0,'rows':[]};var _0x35f43d=_[_0x05c6('0x26')](db['ChatTransferReport']['rawAttributes'],function(_0x5957b4){return{'name':_0x5957b4['fieldName'],'type':_0x5957b4[_0x05c6('0x27')][_0x05c6('0x28')]};});_0xe98c2d[_0x05c6('0x29')]=_['map'](_0x35f43d,'name');_0xe98c2d[_0x05c6('0x2a')]=_['keys'](_0x227e96[_0x05c6('0x2a')]);_0xe98c2d[_0x05c6('0x2b')]=_[_0x05c6('0x2c')](_0xe98c2d[_0x05c6('0x29')],_0xe98c2d[_0x05c6('0x2a')]);_0x454321['attributes']=_['intersection'](_0xe98c2d[_0x05c6('0x29')],qs[_0x05c6('0x2d')](_0x227e96[_0x05c6('0x2a')]['fields']));_0x454321['attributes']=_0x454321[_0x05c6('0x2e')][_0x05c6('0x2f')]?_0x454321['attributes']:_0xe98c2d[_0x05c6('0x29')];if(!_0x227e96['query']['hasOwnProperty']('nolimit')){_0x454321[_0x05c6('0x30')]=qs[_0x05c6('0x30')](_0x227e96[_0x05c6('0x2a')]['limit']);_0x454321['offset']=qs[_0x05c6('0x1a')](_0x227e96[_0x05c6('0x2a')][_0x05c6('0x1a')]);}_0x454321[_0x05c6('0x31')]=qs['sort'](_0x227e96[_0x05c6('0x2a')]['sort']);_0x454321[_0x05c6('0x32')]=qs[_0x05c6('0x2b')](_[_0x05c6('0x33')](_0x227e96['query'],_0xe98c2d[_0x05c6('0x2b')]),_0x35f43d);if(_0x227e96[_0x05c6('0x2a')][_0x05c6('0x34')]){_0x454321[_0x05c6('0x32')]=_['merge'](_0x454321[_0x05c6('0x32')],{'$or':_['map'](_0x35f43d,function(_0x31953c){if(_0x31953c[_0x05c6('0x27')]!==_0x05c6('0x35')){var _0x46c060={};_0x46c060[_0x31953c[_0x05c6('0x23')]]={'$like':'%'+_0x227e96[_0x05c6('0x2a')][_0x05c6('0x34')]+'%'};return _0x46c060;}})});}_0x454321=_[_0x05c6('0x36')]({},_0x454321,_0x227e96[_0x05c6('0x37')]);var _0x34be54={'where':_0x454321[_0x05c6('0x32')]};return db[_0x05c6('0x38')]['count'](_0x34be54)['then'](function(_0x40d16f){_0x429937[_0x05c6('0x1c')]=_0x40d16f;if(_0x227e96['query'][_0x05c6('0x39')]){_0x454321[_0x05c6('0x3a')]=[{'all':!![]}];}return db[_0x05c6('0x38')]['findAll'](_0x454321);})[_0x05c6('0x21')](function(_0x54e947){_0x429937[_0x05c6('0x3b')]=_0x54e947;return _0x429937;})[_0x05c6('0x21')](respondWithFilteredResult(_0x344b64,_0x454321))[_0x05c6('0x3c')](handleError(_0x344b64,null));};exports[_0x05c6('0x3d')]=function(_0x1e061b,_0x47db5d){var _0x3194a8={'raw':!![],'where':{'id':_0x1e061b['params']['id']}},_0x54a5cf={};_0x54a5cf[_0x05c6('0x29')]=_[_0x05c6('0x3e')](db[_0x05c6('0x38')][_0x05c6('0x3f')]);_0x54a5cf[_0x05c6('0x2a')]=_[_0x05c6('0x3e')](_0x1e061b[_0x05c6('0x2a')]);_0x54a5cf[_0x05c6('0x2b')]=_['intersection'](_0x54a5cf[_0x05c6('0x29')],_0x54a5cf['query']);_0x3194a8[_0x05c6('0x2e')]=_[_0x05c6('0x2c')](_0x54a5cf[_0x05c6('0x29')],qs[_0x05c6('0x2d')](_0x1e061b['query'][_0x05c6('0x2d')]));_0x3194a8[_0x05c6('0x2e')]=_0x3194a8[_0x05c6('0x2e')]['length']?_0x3194a8[_0x05c6('0x2e')]:_0x54a5cf[_0x05c6('0x29')];if(_0x1e061b['query'][_0x05c6('0x39')]){_0x3194a8[_0x05c6('0x3a')]=[{'all':!![]}];}_0x3194a8=_[_0x05c6('0x36')]({},_0x3194a8,_0x1e061b[_0x05c6('0x37')]);return db['ChatTransferReport'][_0x05c6('0x40')](_0x3194a8)[_0x05c6('0x21')](handleEntityNotFound(_0x47db5d,null))['then'](respondWithResult(_0x47db5d,null))[_0x05c6('0x3c')](handleError(_0x47db5d,null));};exports['create']=function(_0xd46d9b,_0xcde47d){return db['ChatTransferReport']['create'](_0xd46d9b['body'],{})[_0x05c6('0x21')](respondWithResult(_0xcde47d,0xc9))['catch'](handleError(_0xcde47d,null));};exports[_0x05c6('0x20')]=function(_0x2ca0e0,_0x458da2){if(_0x2ca0e0['body']['id']){delete _0x2ca0e0[_0x05c6('0x41')]['id'];}return db[_0x05c6('0x38')][_0x05c6('0x40')]({'where':{'id':_0x2ca0e0[_0x05c6('0x42')]['id']}})['then'](handleEntityNotFound(_0x458da2,null))[_0x05c6('0x21')](saveUpdates(_0x2ca0e0[_0x05c6('0x41')],null))[_0x05c6('0x21')](respondWithResult(_0x458da2,null))['catch'](handleError(_0x458da2,null));};exports[_0x05c6('0x43')]=function(_0x3c6d51,_0x4c7b9e){return db['ChatTransferReport']['find']({'where':{'id':_0x3c6d51[_0x05c6('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c7b9e,null))[_0x05c6('0x21')](removeEntity(_0x4c7b9e,null))[_0x05c6('0x3c')](handleError(_0x4c7b9e,null));};exports[_0x05c6('0x44')]=function(_0x4f1773,_0x59d694){return db['ChatTransferReport'][_0x05c6('0x44')]()[_0x05c6('0x21')](respondWithResult(_0x59d694,null))[_0x05c6('0x3c')](handleError(_0x59d694,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 5cad8de..5a1d23d 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 _0x43a1=['ChatTransferReport','report_chat_transfer','uniqueid','util','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x4d045c,_0x515ada){var _0x1f4d12=function(_0x17cb11){while(--_0x17cb11){_0x4d045c['push'](_0x4d045c['shift']());}};_0x1f4d12(++_0x515ada);}(_0x43a1,0x1ed));var _0x143a=function(_0x17d044,_0x3fc5f9){_0x17d044=_0x17d044-0x0;var _0x3f7ed6=_0x43a1[_0x17d044];return _0x3f7ed6;};'use strict';var _=require('lodash');var util=require(_0x143a('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x143a('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x143a('0x2'));var rimraf=require(_0x143a('0x3'));var config=require(_0x143a('0x4'));var attributes=require('./chatTransferReport.attributes');module[_0x143a('0x5')]=function(_0x6d874,_0xbed653){return _0x6d874[_0x143a('0x6')](_0x143a('0x7'),attributes,{'tableName':_0x143a('0x8'),'paranoid':![],'indexes':[{'name':_0x143a('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c7f=['ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./chatTransferReport.attributes','define'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x8c7f,0xb2));var _0xf8c7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x8c7f[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xf8c7('0x0'));var util=require(_0xf8c7('0x1'));var logger=require(_0xf8c7('0x2'))(_0xf8c7('0x3'));var moment=require('moment');var BPromise=require(_0xf8c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8c7('0x5'));var rimraf=require('rimraf');var config=require(_0xf8c7('0x6'));var attributes=require(_0xf8c7('0x7'));module['exports']=function(_0x280e0e,_0x5b436c){return _0x280e0e[_0xf8c7('0x8')](_0xf8c7('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xf8c7('0xa'),'fields':[_0xf8c7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index be8e5b7..79e0a88 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 _0xc67b=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','ChatTransferReport,\x20%s,\x20%s'];(function(_0x3e97ab,_0xa74f3f){var _0x125a53=function(_0x297184){while(--_0x297184){_0x3e97ab['push'](_0x3e97ab['shift']());}};_0x125a53(++_0xa74f3f);}(_0xc67b,0x104));var _0xbc67=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xc67b[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xbc67('0x0'));var util=require(_0xbc67('0x1'));var moment=require(_0xbc67('0x2'));var BPromise=require(_0xbc67('0x3'));var rs=require(_0xbc67('0x4'));var fs=require('fs');var Redis=require(_0xbc67('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc67('0x6'));var logger=require(_0xbc67('0x7'))(_0xbc67('0x8'));var config=require('../../config/environment');var jayson=require(_0xbc67('0x9'));var client=jayson[_0xbc67('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cb4f5,_0x4aa5f1,_0x364339){return new BPromise(function(_0x50aa69,_0x18efd3){return client['request'](_0x5cb4f5,_0x364339)['then'](function(_0x156d81){logger[_0xbc67('0xb')](_0xbc67('0xc'),_0x4aa5f1,'request\x20sent');logger[_0xbc67('0xd')](_0xbc67('0xe'),_0x4aa5f1,'request\x20sent',JSON[_0xbc67('0xf')](_0x156d81));if(_0x156d81[_0xbc67('0x10')]){if(_0x156d81['error']['code']===0x1f4){logger[_0xbc67('0x10')](_0xbc67('0xc'),_0x4aa5f1,_0x156d81[_0xbc67('0x10')][_0xbc67('0x11')]);return _0x18efd3(_0x156d81[_0xbc67('0x10')][_0xbc67('0x11')]);}logger[_0xbc67('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x4aa5f1,_0x156d81[_0xbc67('0x10')][_0xbc67('0x11')]);return _0x50aa69(_0x156d81[_0xbc67('0x10')]['message']);}else{logger['info'](_0xbc67('0xc'),_0x4aa5f1,_0xbc67('0x12'));_0x50aa69(_0x156d81[_0xbc67('0x13')][_0xbc67('0x11')]);}})[_0xbc67('0x14')](function(_0x3be0ce){logger[_0xbc67('0x10')](_0xbc67('0xc'),_0x4aa5f1,_0x3be0ce);_0x18efd3(_0x3be0ce);});});} \ No newline at end of file +var _0x134d=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x48baf9,_0x5be383){var _0xa5d083=function(_0x2d567a){while(--_0x2d567a){_0x48baf9['push'](_0x48baf9['shift']());}};_0xa5d083(++_0x5be383);}(_0x134d,0x1d1));var _0xd134=function(_0x5604dc,_0x4dad01){_0x5604dc=_0x5604dc-0x0;var _0x2541dd=_0x134d[_0x5604dc];return _0x2541dd;};'use strict';var _=require(_0xd134('0x0'));var util=require(_0xd134('0x1'));var moment=require(_0xd134('0x2'));var BPromise=require(_0xd134('0x3'));var rs=require(_0xd134('0x4'));var fs=require('fs');var Redis=require(_0xd134('0x5'));var db=require(_0xd134('0x6'))['db'];var utils=require(_0xd134('0x7'));var logger=require(_0xd134('0x8'))('rpc');var config=require(_0xd134('0x9'));var jayson=require(_0xd134('0xa'));var client=jayson[_0xd134('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13149b,_0x597cdd,_0x2c343a){return new BPromise(function(_0x1c95d7,_0x1d2ccb){return client[_0xd134('0xc')](_0x13149b,_0x2c343a)[_0xd134('0xd')](function(_0x26d1b7){logger[_0xd134('0xe')](_0xd134('0xf'),_0x597cdd,_0xd134('0x10'));logger[_0xd134('0x11')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x597cdd,'request\x20sent',JSON['stringify'](_0x26d1b7));if(_0x26d1b7[_0xd134('0x12')]){if(_0x26d1b7[_0xd134('0x12')]['code']===0x1f4){logger[_0xd134('0x12')](_0xd134('0xf'),_0x597cdd,_0x26d1b7[_0xd134('0x12')][_0xd134('0x13')]);return _0x1d2ccb(_0x26d1b7['error'][_0xd134('0x13')]);}logger['error'](_0xd134('0xf'),_0x597cdd,_0x26d1b7[_0xd134('0x12')][_0xd134('0x13')]);return _0x1c95d7(_0x26d1b7[_0xd134('0x12')][_0xd134('0x13')]);}else{logger[_0xd134('0xe')](_0xd134('0xf'),_0x597cdd,_0xd134('0x10'));_0x1c95d7(_0x26d1b7['result'][_0xd134('0x13')]);}})[_0xd134('0x14')](function(_0x356a77){logger[_0xd134('0x12')](_0xd134('0xf'),_0x597cdd,_0x356a77);_0x1d2ccb(_0x356a77);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 3d90777..a5a0f55 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 _0x856c=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','index','get','/describe','isAuthenticated'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x856c,0x1a7));var _0xc856=function(_0x9ecf29,_0x10426f){_0x9ecf29=_0x9ecf29-0x0;var _0x362ba6=_0x856c[_0x9ecf29];return _0x362ba6;};'use strict';var multer=require(_0xc856('0x0'));var util=require(_0xc856('0x1'));var path=require(_0xc856('0x2'));var timeout=require(_0xc856('0x3'));var express=require(_0xc856('0x4'));var router=express[_0xc856('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc856('0x6'));var interaction=require(_0xc856('0x7'));var config=require(_0xc856('0x8'));var controller=require(_0xc856('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc856('0xa')]);router[_0xc856('0xb')](_0xc856('0xc'),auth[_0xc856('0xd')](),controller[_0xc856('0xe')]);router[_0xc856('0xb')](_0xc856('0xf'),auth[_0xc856('0xd')](),controller['show']);router[_0xc856('0x10')]('/',auth[_0xc856('0xd')](),controller[_0xc856('0x11')]);router[_0xc856('0x12')](_0xc856('0xf'),auth[_0xc856('0xd')](),controller[_0xc856('0x13')]);router[_0xc856('0x14')]('/:id',auth[_0xc856('0xd')](),controller[_0xc856('0x15')]);module[_0xc856('0x16')]=router; \ No newline at end of file +var _0x53cb=['isAuthenticated','update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','post','create'];(function(_0xf136bc,_0x4cb677){var _0x447aa6=function(_0x5c6f9b){while(--_0x5c6f9b){_0xf136bc['push'](_0xf136bc['shift']());}};_0x447aa6(++_0x4cb677);}(_0x53cb,0x93));var _0xb53c=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x53cb[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0xb53c('0x0'));var util=require(_0xb53c('0x1'));var path=require(_0xb53c('0x2'));var timeout=require('connect-timeout');var express=require(_0xb53c('0x3'));var router=express[_0xb53c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb53c('0x5'));var interaction=require(_0xb53c('0x6'));var config=require(_0xb53c('0x7'));var controller=require('./chatTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb53c('0x8')]);router[_0xb53c('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xb53c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xb53c('0xb')]('/',auth['isAuthenticated'](),controller[_0xb53c('0xc')]);router['put'](_0xb53c('0xa'),auth[_0xb53c('0xd')](),controller[_0xb53c('0xe')]);router[_0xb53c('0xf')](_0xb53c('0xa'),auth[_0xb53c('0xd')](),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 8975818..6231a6c 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 _0xcb2d=['Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','stringify','input','name','getDataValue','onlineForm','setDataValue','textarea','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','bottom_right','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Contact\x20us','INTEGER','TEXT'];(function(_0x482212,_0x5d8351){var _0x5c2b24=function(_0x1127ba){while(--_0x1127ba){_0x482212['push'](_0x482212['shift']());}};_0x5c2b24(++_0x5d8351);}(_0xcb2d,0x87));var _0xdcb2=function(_0x3a31be,_0x29d716){_0x3a31be=_0x3a31be-0x0;var _0x1145d5=_0xcb2d[_0x3a31be];return _0x1145d5;};'use strict';var Sequelize=require(_0xdcb2('0x0'));var rs=require(_0xdcb2('0x1'));module[_0xdcb2('0x2')]={'name':{'type':Sequelize[_0xdcb2('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0x4')},'mapKeyOffline':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xdcb2('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xdcb2('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xdcb2('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xdcb2('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xdcb2('0x3')]},'animation':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xdcb2('0x7')]('rounded',_0xdcb2('0x8')),'defaultValue':_0xdcb2('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xdcb2('0xa')},'start_chat_button':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0xb')},'offline_chat_button':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0xc')},'download_transcript':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xdcb2('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xdcb2('0xe')]},'closingQuestion':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xdcb2('0x11')},'noteTitle':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0x12')},'placeholderMessage':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0x13')},'closingMessage':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xdcb2('0x15')},'skipMessageButton':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0x16')},'conditionAgreement':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0x17')},'ratingType':{'type':Sequelize[_0xdcb2('0x7')](_0xdcb2('0x18'),_0xdcb2('0x19')),'defaultValue':_0xdcb2('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xdcb2('0xe')],'defaultValue':function(){return JSON[_0xdcb2('0x1a')]({'items':[{'type':_0xdcb2('0x1b'),'variable':null,'config':{'placeholder':_0xdcb2('0x1c'),'type':'text','required':!![]},'props':{'title':_0xdcb2('0x1c'),'helpText':''}},{'type':_0xdcb2('0x1b'),'props':{'title':_0xdcb2('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xdcb2('0x4'),'type':_0xdcb2('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xdcb2('0x1d')]('onlineForm')?JSON['parse'](this[_0xdcb2('0x1d')](_0xdcb2('0x1e'))):{};},'set':function(_0x1f119){return this[_0xdcb2('0x1f')](_0xdcb2('0x1e'),JSON['stringify'](_0x1f119));}},'offlineForm':{'type':Sequelize[_0xdcb2('0xe')],'defaultValue':function(){return JSON[_0xdcb2('0x1a')]({'items':[{'type':_0xdcb2('0x1b'),'props':{'title':_0xdcb2('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0xdcb2('0x20'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xdcb2('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xdcb2('0x1d')](_0xdcb2('0x22'))?JSON['parse'](this[_0xdcb2('0x1d')]('offlineForm')):{};},'set':function(_0x5eb774){return this['setDataValue'](_0xdcb2('0x22'),JSON[_0xdcb2('0x1a')](_0x5eb774));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xdcb2('0x23')]();}},'autoclose':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xdcb2('0x3')]},'forwardOffline':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xdcb2('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xdcb2('0x26')},'offlineMessageBody':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0x28')},'skipUnmanaged':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0x16')},'sendUnmanaged':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xdcb2('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xdcb2('0x3')]},'notificationTemplate':{'type':Sequelize[_0xdcb2('0xe')],'defaultValue':function(){return _0xdcb2('0x29');}},'notificationSound':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':_0xdcb2('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xdcb2('0x2b')},'verticalAlignment':{'type':Sequelize[_0xdcb2('0xd')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xdcb2('0x3')]},'customerAvatar':{'type':Sequelize[_0xdcb2('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xdcb2('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xdcb2('0x3')],'allowNull':![],'defaultValue':_0xdcb2('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdcb2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdcb2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xdcb2('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdcb2('0xd')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![],'comment':_0xdcb2('0x2e'),'set':function(_0x4e169e){if(!_0x4e169e)this[_0xdcb2('0x1f')](_0xdcb2('0x2f'),null);this[_0xdcb2('0x1f')]('mandatoryDisposition',_0x4e169e);}},'vidaooEscalation':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xdcb2('0x3')]},'vidaooTopic':{'type':Sequelize[_0xdcb2('0x3')],'allowNull':![],'defaultValue':_0xdcb2('0x30')},'vidaooNote':{'type':Sequelize[_0xdcb2('0x3')],'defaultValue':function(){return _0xdcb2('0x31');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xdcb2('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xdcb2('0xe')]}}; \ No newline at end of file +var _0x77ef=['ENUM','star','thumb','stringify','name','text','input','getDataValue','onlineForm','textarea','Comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback'];(function(_0x10ba03,_0xc7f9e5){var _0x59f126=function(_0xc7fa31){while(--_0xc7fa31){_0x10ba03['push'](_0x10ba03['shift']());}};_0x59f126(++_0xc7f9e5);}(_0x77ef,0xa6));var _0xf77e=function(_0x5b518d,_0x171953){_0x5b518d=_0x5b518d-0x0;var _0x26b985=_0x77ef[_0x5b518d];return _0x26b985;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xf77e('0x0')]={'name':{'type':Sequelize[_0xf77e('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf77e('0x2')},'description':{'type':Sequelize[_0xf77e('0x1')]},'mapKey':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xf77e('0x3')},'key':{'type':Sequelize[_0xf77e('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf77e('0x1')],'allowNull':![],'defaultValue':_0xf77e('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf77e('0x1')],'allowNull':![],'defaultValue':_0xf77e('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf77e('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf77e('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf77e('0x1')]},'animation':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xf77e('0x8'),_0xf77e('0x9')),'defaultValue':_0xf77e('0x8')},'header_online':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0xa')},'start_chat_button':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xf77e('0xc')},'download_transcript':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf77e('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xf77e('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf77e('0xe')]},'closingQuestion':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf77e('0x10')},'noteTitle':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf77e('0x12')},'closingMessage':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0x13')},'closingMessageButton':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0x14')},'conditionAgreement':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf77e('0x15')},'ratingType':{'type':Sequelize[_0xf77e('0x16')](_0xf77e('0x17'),_0xf77e('0x18')),'defaultValue':_0xf77e('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xf77e('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf77e('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xf77e('0x1a'),'type':_0xf77e('0x1b'),'required':!![]},'props':{'title':_0xf77e('0x1a'),'helpText':''}},{'type':_0xf77e('0x1c'),'props':{'title':_0xf77e('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf77e('0x3'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf77e('0x1d')]('onlineForm')?JSON['parse'](this['getDataValue'](_0xf77e('0x1e'))):{};},'set':function(_0x505d6b){return this['setDataValue']('onlineForm',JSON[_0xf77e('0x19')](_0x505d6b));}},'offlineForm':{'type':Sequelize[_0xf77e('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xf77e('0x1c'),'props':{'title':_0xf77e('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xf77e('0x3')},'variable':null},{'type':_0xf77e('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0xf77e('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xf77e('0x1d')](_0xf77e('0x21'))?JSON['parse'](this[_0xf77e('0x1d')](_0xf77e('0x21'))):{};},'set':function(_0x44eb54){return this[_0xf77e('0x22')]('offlineForm',JSON[_0xf77e('0x19')](_0x44eb54));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf77e('0x23')]();}},'autoclose':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0x24')},'waitingMessage':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xf77e('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xf77e('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xf77e('0x14')},'sendUnmanaged':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0xb')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf77e('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf77e('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf77e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xf77e('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf77e('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf77e('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf77e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf77e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':_0xf77e('0x2c')},'systemAvatar':{'type':Sequelize[_0xf77e('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf77e('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf77e('0x2d'),'set':function(_0x29914c){if(!_0x29914c)this[_0xf77e('0x22')](_0xf77e('0x2e'),null);this['setDataValue']('mandatoryDisposition',_0x29914c);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf77e('0x1')]},'vidaooTopic':{'type':Sequelize[_0xf77e('0x1')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xf77e('0x1')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf77e('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 490488e..1a72a4e 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 _0x345a=['server/files/images/avatars/','getSystemAvatar','notify','setUA','headers','getResult','chat','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','Sequelize','from\x20is\x20mandatory','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','Contacts','Applications','applications','list','orderBy','priority','asc','account','contact','customerIp','cf-connecting-ip','x-forwarded-for','firstName','x-real-port','referer','version','%s\x20%s','browser','unknown','format','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','ContactId','interaction','spread','lastName','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','offlineMessageBody','ChatOfflineMessage','mimetype','server','attachments','offline-chat','basename','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','SendMail','sendMail','offlineMessageSubject','openNewInteraction','MailAccountId','originalname','toPairsIn','mapValues','subjectOffline','email','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','indexOf','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','custom','increment','chatLicenseExceeded','some','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','color_button','backgroundColor','addApplications','transaction','ChatApplication','findAndCountAll','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./chatWebsite.socket','register','jayson/promise','client','http','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','ChatWebsites','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','findAll','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','../../config/license/util','getLicense','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar'];(function(_0x1f8932,_0x2749c1){var _0x398122=function(_0x4d1f69){while(--_0x4d1f69){_0x1f8932['push'](_0x1f8932['shift']());}};_0x398122(++_0x2749c1);}(_0x345a,0x1e4));var _0xa345=function(_0x5bdcb9,_0x4b8c25){_0x5bdcb9=_0x5bdcb9-0x0;var _0x404fc5=_0x345a[_0x5bdcb9];return _0x404fc5;};'use strict';var emlformat=require(_0xa345('0x0'));var rimraf=require(_0xa345('0x1'));var zipdir=require(_0xa345('0x2'));var jsonpatch=require(_0xa345('0x3'));var rp=require(_0xa345('0x4'));var moment=require(_0xa345('0x5'));var BPromise=require(_0xa345('0x6'));var Mustache=require(_0xa345('0x7'));var util=require(_0xa345('0x8'));var path=require(_0xa345('0x9'));var sox=require(_0xa345('0xa'));var csv=require(_0xa345('0xb'));var ejs=require(_0xa345('0xc'));var fs=require('fs');var fs_extra=require(_0xa345('0xd'));var _=require(_0xa345('0xe'));var squel=require(_0xa345('0xf'));var crypto=require(_0xa345('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xa345('0x11'));var toCsv=require('to-csv');var querystring=require(_0xa345('0x12'));var Papa=require(_0xa345('0x13'));var Redis=require('ioredis');var authService=require(_0xa345('0x14'));var qs=require(_0xa345('0x15'));var as=require(_0xa345('0x16'));var hardwareService=require(_0xa345('0x17'));var logger=require(_0xa345('0x18'))(_0xa345('0x19'));var utils=require(_0xa345('0x1a'));var config=require(_0xa345('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xa345('0x1c'))['db'];config[_0xa345('0x1d')]=_[_0xa345('0x1e')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa345('0x1d')]));require(_0xa345('0x1f'))[_0xa345('0x20')](socket);var jayson=require(_0xa345('0x21'));var client=jayson[_0xa345('0x22')][_0xa345('0x23')]({'port':0x232c});var client9002=jayson[_0xa345('0x22')]['http']({'port':0x232a});var client9003=jayson[_0xa345('0x22')]['http']({'port':0x232b});var client9001=jayson[_0xa345('0x22')][_0xa345('0x23')]({'port':0x2329});function respondWithRpcPromise(_0x4a77cb,_0x165983,_0x29cc23,_0xeeecc3){return new BPromise(function(_0x7a07ac,_0x4d4e29){var _0x3a2368=_0xeeecc3||client;return _0x3a2368['request'](_0x4a77cb,_0x29cc23)[_0xa345('0x24')](function(_0x2062da){logger['info'](_0xa345('0x25'),_0x165983,_0xa345('0x26'));logger[_0xa345('0x27')](_0xa345('0x28'),_0x165983,_0xa345('0x26'),JSON[_0xa345('0x29')](_0x2062da));if(_0x2062da[_0xa345('0x2a')]){if(_0x2062da[_0xa345('0x2a')][_0xa345('0x2b')]===0x1f4){logger[_0xa345('0x2a')]('ChatWebsite,\x20%s,\x20%s',_0x165983,_0x2062da[_0xa345('0x2a')][_0xa345('0x2c')]);return _0x4d4e29(_0x2062da['error'][_0xa345('0x2c')]);}logger[_0xa345('0x2a')]('ChatWebsite,\x20%s,\x20%s',_0x165983,_0x2062da[_0xa345('0x2a')]['message']);return _0x7a07ac(_0x2062da['error'][_0xa345('0x2c')]);}else{logger['info'](_0xa345('0x25'),_0x165983,_0xa345('0x26'));_0x7a07ac(_0x2062da[_0xa345('0x2d')][_0xa345('0x2c')]);}})[_0xa345('0x2e')](function(_0x2d66ab){logger[_0xa345('0x2a')](_0xa345('0x25'),_0x165983,_0x2d66ab);_0x4d4e29(_0x2d66ab);});});}function respondWithStatusCode(_0x44309e,_0x321ea1){_0x321ea1=_0x321ea1||0xcc;return function(_0x1d48a4){if(_0x1d48a4){return _0x44309e[_0xa345('0x2f')](_0x321ea1);}return _0x44309e[_0xa345('0x30')](_0x321ea1)[_0xa345('0x31')]();};}function respondWithResult(_0x5a7d1e,_0x5d9ba1){_0x5d9ba1=_0x5d9ba1||0xc8;return function(_0x2ac30f){if(_0x2ac30f){return _0x5a7d1e[_0xa345('0x30')](_0x5d9ba1)[_0xa345('0x32')](_0x2ac30f);}};}function respondWithFilteredResult(_0x333248,_0x32ed49){return function(_0x3081cb){if(_0x3081cb){var _0x5ace4a=typeof _0x32ed49[_0xa345('0x33')]===_0xa345('0x34')&&typeof _0x32ed49[_0xa345('0x35')]===_0xa345('0x34');var _0x59d3bf=_0x3081cb[_0xa345('0x36')];var _0x6a85e6=_0x5ace4a?0x0:_0x32ed49[_0xa345('0x33')];var _0x14a695=_0x5ace4a?_0x3081cb['count']:_0x32ed49[_0xa345('0x33')]+_0x32ed49[_0xa345('0x35')];var _0x46099a;if(_0x14a695>=_0x59d3bf){_0x14a695=_0x59d3bf;_0x46099a=0xc8;}else{_0x46099a=0xce;}_0x333248[_0xa345('0x30')](_0x46099a);return _0x333248[_0xa345('0x37')]('Content-Range',_0x6a85e6+'-'+_0x14a695+'/'+_0x59d3bf)[_0xa345('0x32')](_0x3081cb);}return null;};}function patchUpdates(_0x74ceed){return function(_0x29d84d){try{jsonpatch[_0xa345('0x38')](_0x29d84d,_0x74ceed,!![]);}catch(_0x57bcdb){return BPromise['reject'](_0x57bcdb);}return _0x29d84d[_0xa345('0x39')]();};}function saveUpdates(_0x50ef5e,_0x499921){return function(_0x1258a9){if(_0x1258a9){return _0x1258a9[_0xa345('0x3a')](_0x50ef5e)['then'](function(_0x3af647){return _0x3af647;});}return null;};}function removeEntity(_0x215381,_0x16cec1){return function(_0x3f7333){if(_0x3f7333){return _0x3f7333[_0xa345('0x3b')]()[_0xa345('0x24')](function(){var _0x23acdf=_0x3f7333['get']({'plain':!![]});var _0x1e2569=_0xa345('0x3c');return db['UserProfileResource'][_0xa345('0x3b')]({'where':{'type':_0x1e2569,'resourceId':_0x23acdf['id']}})['then'](function(){return _0x3f7333;});})[_0xa345('0x24')](function(){_0x215381[_0xa345('0x30')](0xcc)[_0xa345('0x31')]();});}};}function handleEntityNotFound(_0x4bb096,_0x4d54c4){return function(_0x343a9e){if(!_0x343a9e){_0x4bb096[_0xa345('0x2f')](0x194);}return _0x343a9e;};}function handleError(_0x57e51a,_0x238446){_0x238446=_0x238446||0x1f4;return function(_0x44679f){logger['error'](_0x44679f[_0xa345('0x3d')]);if(_0x44679f[_0xa345('0x3e')]){delete _0x44679f[_0xa345('0x3e')];}_0x57e51a[_0xa345('0x30')](_0x238446)[_0xa345('0x3f')](_0x44679f);};}exports[_0xa345('0x40')]=function(_0x17682c,_0x4f864d){var _0xea1609={'include':[{'model':db[_0xa345('0x41')],'as':_0xa345('0x42')}]},_0x29d71c={},_0x2c9fdb={'count':0x0,'rows':[]};var _0x3b047a=_[_0xa345('0x43')](db[_0xa345('0x44')][_0xa345('0x45')],function(_0x4d050f){return{'name':_0x4d050f[_0xa345('0x46')],'type':_0x4d050f['type']['key']};});_0x29d71c[_0xa345('0x47')]=_[_0xa345('0x43')](_0x3b047a,'name');_0x29d71c[_0xa345('0x48')]=_[_0xa345('0x49')](_0x17682c[_0xa345('0x48')]);_0x29d71c[_0xa345('0x4a')]=_[_0xa345('0x4b')](_0x29d71c[_0xa345('0x47')],_0x29d71c[_0xa345('0x48')]);_0xea1609[_0xa345('0x4c')]=_[_0xa345('0x4b')](_0x29d71c[_0xa345('0x47')],qs['fields'](_0x17682c['query'][_0xa345('0x4d')]));_0xea1609['attributes']=_0xea1609['attributes'][_0xa345('0x4e')]?_0xea1609[_0xa345('0x4c')]:_0x29d71c['model'];if(!_0x17682c[_0xa345('0x48')]['hasOwnProperty'](_0xa345('0x4f'))){_0xea1609[_0xa345('0x35')]=qs[_0xa345('0x35')](_0x17682c[_0xa345('0x48')][_0xa345('0x35')]);_0xea1609[_0xa345('0x33')]=qs[_0xa345('0x33')](_0x17682c[_0xa345('0x48')][_0xa345('0x33')]);}_0xea1609[_0xa345('0x50')]=qs[_0xa345('0x51')](_0x17682c[_0xa345('0x48')][_0xa345('0x51')]);_0xea1609[_0xa345('0x52')]=qs[_0xa345('0x4a')](_[_0xa345('0x53')](_0x17682c[_0xa345('0x48')],_0x29d71c[_0xa345('0x4a')]),_0x3b047a);if(_0x17682c['query']['filter']){_0xea1609[_0xa345('0x52')]=_[_0xa345('0x54')](_0xea1609[_0xa345('0x52')],{'$or':_[_0xa345('0x43')](_0x3b047a,function(_0x197b09){if(_0x197b09[_0xa345('0x55')]!==_0xa345('0x56')){var _0x698d16={};_0x698d16[_0x197b09[_0xa345('0x3e')]]={'$like':'%'+_0x17682c[_0xa345('0x48')][_0xa345('0x57')]+'%'};return _0x698d16;}})});}_0xea1609=_[_0xa345('0x54')]({},_0xea1609,_0x17682c[_0xa345('0x58')]);var _0x3f755f={'where':_0xea1609[_0xa345('0x52')]};return db['ChatWebsite'][_0xa345('0x36')](_0x3f755f)[_0xa345('0x24')](function(_0x885179){_0x2c9fdb[_0xa345('0x36')]=_0x885179;if(_0x17682c[_0xa345('0x48')][_0xa345('0x59')]){_0xea1609[_0xa345('0x5a')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0xea1609);})[_0xa345('0x24')](function(_0x267aca){_0x2c9fdb[_0xa345('0x5b')]=_0x267aca;return _0x2c9fdb;})[_0xa345('0x24')](respondWithFilteredResult(_0x4f864d,_0xea1609))[_0xa345('0x2e')](handleError(_0x4f864d,null));};exports['show']=function(_0x30b252,_0x4b82f0){var _0x5760a6={'raw':![],'where':{'id':_0x30b252[_0xa345('0x5c')]['id']},'include':[{'model':db[_0xa345('0x41')],'as':_0xa345('0x42')}]},_0x2cade2={};_0x2cade2[_0xa345('0x47')]=_[_0xa345('0x49')](db['ChatWebsite'][_0xa345('0x45')]);_0x2cade2[_0xa345('0x48')]=_[_0xa345('0x49')](_0x30b252[_0xa345('0x48')]);_0x2cade2[_0xa345('0x4a')]=_[_0xa345('0x4b')](_0x2cade2[_0xa345('0x47')],_0x2cade2[_0xa345('0x48')]);_0x5760a6[_0xa345('0x4c')]=_[_0xa345('0x4b')](_0x2cade2['model'],qs[_0xa345('0x4d')](_0x30b252['query'][_0xa345('0x4d')]));_0x5760a6[_0xa345('0x4c')]=_0x5760a6[_0xa345('0x4c')][_0xa345('0x4e')]?_0x5760a6[_0xa345('0x4c')]:_0x2cade2['model'];if(_0x30b252[_0xa345('0x48')][_0xa345('0x59')]){_0x5760a6['include']=[{'all':!![]}];}_0x5760a6=_[_0xa345('0x54')]({},_0x5760a6,_0x30b252[_0xa345('0x58')]);return db[_0xa345('0x44')][_0xa345('0x5d')](_0x5760a6)[_0xa345('0x24')](handleEntityNotFound(_0x4b82f0,null))[_0xa345('0x24')](respondWithResult(_0x4b82f0,null))['catch'](handleError(_0x4b82f0,null));};exports[_0xa345('0x5e')]=function(_0x3b56b4,_0x2e0a38){return db['ChatWebsite'][_0xa345('0x5e')](_0x3b56b4[_0xa345('0x5f')],{})[_0xa345('0x24')](function(_0x101e6f){var _0x27a9bb=_0x3b56b4['user'][_0xa345('0x60')]({'plain':!![]});if(!_0x27a9bb)throw new Error(_0xa345('0x61'));if(_0x27a9bb[_0xa345('0x62')]===_0xa345('0x63')){var _0x7d79be=_0x101e6f[_0xa345('0x60')]({'plain':!![]});var _0x4be2c0=_0xa345('0x3c');return db[_0xa345('0x64')][_0xa345('0x5d')]({'where':{'name':_0x4be2c0,'userProfileId':_0x27a9bb['userProfileId']},'raw':!![]})[_0xa345('0x24')](function(_0x113b4a){if(_0x113b4a&&_0x113b4a[_0xa345('0x65')]===0x0){return db[_0xa345('0x66')][_0xa345('0x5e')]({'name':_0x7d79be[_0xa345('0x3e')],'resourceId':_0x7d79be['id'],'type':_0x113b4a[_0xa345('0x3e')],'sectionId':_0x113b4a['id']},{})[_0xa345('0x24')](function(){return _0x101e6f;});}else{return _0x101e6f;}})[_0xa345('0x2e')](function(_0x1bf293){logger[_0xa345('0x2a')](_0xa345('0x67'),_0x1bf293);throw _0x1bf293;});}return _0x101e6f;})['then'](respondWithResult(_0x2e0a38,0xc9))[_0xa345('0x2e')](handleError(_0x2e0a38,null));};exports['update']=function(_0x12b274,_0x1e2e00){if(_0x12b274['body']['id']){delete _0x12b274[_0xa345('0x5f')]['id'];}return db[_0xa345('0x44')][_0xa345('0x5d')]({'where':{'id':_0x12b274[_0xa345('0x5c')]['id']},'include':[{'model':db[_0xa345('0x41')],'as':'mandatoryDispositionPause'}]})[_0xa345('0x24')](handleEntityNotFound(_0x1e2e00,null))[_0xa345('0x24')](saveUpdates(_0x12b274[_0xa345('0x5f')],null))[_0xa345('0x24')](respondWithResult(_0x1e2e00,null))['catch'](handleError(_0x1e2e00,null));};exports[_0xa345('0x3b')]=function(_0x11e928,_0x53eb4c){return db['ChatWebsite']['find']({'where':{'id':_0x11e928[_0xa345('0x5c')]['id']}})['then'](handleEntityNotFound(_0x53eb4c,null))[_0xa345('0x24')](removeEntity(_0x53eb4c,null))[_0xa345('0x2e')](handleError(_0x53eb4c,null));};exports[_0xa345('0x68')]=function(_0x51fb43,_0x2707da){return db[_0xa345('0x44')][_0xa345('0x68')]()[_0xa345('0x24')](respondWithResult(_0x2707da,null))[_0xa345('0x2e')](handleError(_0x2707da,null));};exports[_0xa345('0x69')]=function(_0x355c4b,_0x15c0f9,_0x42b5cd){if(_0x355c4b['body']['id']){delete _0x355c4b[_0xa345('0x5f')]['id'];}return db['ChatWebsite'][_0xa345('0x5d')]({'where':{'id':_0x355c4b[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x15c0f9,null))[_0xa345('0x24')](function(_0x22d0f0){if(_0x22d0f0){_0x355c4b[_0xa345('0x5f')][_0xa345('0x6a')]=_0x22d0f0['id'];return db['Disposition']['create'](_0x355c4b[_0xa345('0x5f')]);}})[_0xa345('0x24')](respondWithResult(_0x15c0f9,null))[_0xa345('0x2e')](handleError(_0x15c0f9,null));};exports[_0xa345('0x6b')]=function(_0x429010,_0x2a23a5,_0x5dd6b2){var _0x35b295={'raw':![],'where':{}};var _0x4b803f={};var _0x481522={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa345('0x6c')]({'where':{'id':_0x429010[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x2a23a5,null))[_0xa345('0x24')](function(_0x5134f1){if(_0x5134f1){_0x4b803f['model']=_['keys'](db['Disposition'][_0xa345('0x45')]);_0x4b803f[_0xa345('0x48')]=_[_0xa345('0x49')](_0x429010[_0xa345('0x48')]);_0x4b803f[_0xa345('0x4a')]=_[_0xa345('0x4b')](_0x4b803f['model'],_0x4b803f[_0xa345('0x48')]);_0x35b295[_0xa345('0x4c')]=_['intersection'](_0x4b803f[_0xa345('0x47')],qs[_0xa345('0x4d')](_0x429010['query'][_0xa345('0x4d')]));_0x35b295[_0xa345('0x4c')]=_0x35b295[_0xa345('0x4c')][_0xa345('0x4e')]?_0x35b295[_0xa345('0x4c')]:_0x4b803f['model'];if(!_0x429010[_0xa345('0x48')]['hasOwnProperty'](_0xa345('0x4f'))){_0x35b295[_0xa345('0x35')]=qs[_0xa345('0x35')](_0x429010[_0xa345('0x48')]['limit']);_0x35b295[_0xa345('0x33')]=qs[_0xa345('0x33')](_0x429010[_0xa345('0x48')][_0xa345('0x33')]);}_0x35b295[_0xa345('0x50')]=qs[_0xa345('0x51')](_0x429010[_0xa345('0x48')][_0xa345('0x51')]);_0x35b295[_0xa345('0x52')]=qs[_0xa345('0x4a')](_[_0xa345('0x53')](_0x429010['query'],_0x4b803f[_0xa345('0x4a')]));_0x35b295[_0xa345('0x52')][_0xa345('0x6a')]=_0x5134f1['id'];if(_0x429010[_0xa345('0x48')][_0xa345('0x57')]){_0x35b295[_0xa345('0x52')]=_[_0xa345('0x54')](_0x35b295[_0xa345('0x52')],{'$or':_[_0xa345('0x43')](_0x35b295[_0xa345('0x4c')],function(_0x38452b){var _0x4ef635={};_0x4ef635[_0x38452b]={'$like':'%'+_0x429010['query']['filter']+'%'};return _0x4ef635;})});}_0x35b295=_[_0xa345('0x54')]({},_0x35b295,_0x429010[_0xa345('0x58')]);return db[_0xa345('0x6d')][_0xa345('0x36')]({'where':_0x35b295[_0xa345('0x52')]})['then'](function(_0x271336){_0x481522[_0xa345('0x36')]=_0x271336;if(_0x429010['query'][_0xa345('0x59')]){_0x35b295[_0xa345('0x5a')]=[{'all':!![]}];}return db[_0xa345('0x6d')]['findAll'](_0x35b295);})[_0xa345('0x24')](function(_0x56ecca){_0x481522['rows']=_0x56ecca;return _0x481522;});}})[_0xa345('0x24')](respondWithFilteredResult(_0x2a23a5,_0x35b295))[_0xa345('0x2e')](handleError(_0x2a23a5,null));};exports[_0xa345('0x6e')]=function(_0xd62a0f,_0x14c2ce,_0x46a588){return db[_0xa345('0x44')][_0xa345('0x5d')]({'where':{'id':_0xd62a0f[_0xa345('0x5c')]['id']}})['then'](handleEntityNotFound(_0x14c2ce,null))[_0xa345('0x24')](function(_0x29b64c){if(_0x29b64c){return _0x29b64c['removeDispositions'](_0xd62a0f['query'][_0xa345('0x6f')]);}})['then'](respondWithStatusCode(_0x14c2ce,null))[_0xa345('0x2e')](handleError(_0x14c2ce,null));};exports[_0xa345('0x70')]=function(_0x312324,_0x300435,_0xdae872){if(_0x312324['body']['id']){delete _0x312324[_0xa345('0x5f')]['id'];}return db['ChatWebsite'][_0xa345('0x5d')]({'where':{'id':_0x312324['params']['id']}})['then'](handleEntityNotFound(_0x300435,null))['then'](function(_0x157e01){if(_0x157e01){_0x312324[_0xa345('0x5f')][_0xa345('0x6a')]=_0x157e01['id'];return db[_0xa345('0x71')][_0xa345('0x5e')](_0x312324[_0xa345('0x5f')]);}})[_0xa345('0x24')](respondWithResult(_0x300435,null))[_0xa345('0x2e')](handleError(_0x300435,null));};exports[_0xa345('0x72')]=function(_0x1d0176,_0x58a950,_0x5d6fd8){var _0x4a4084={'raw':![],'where':{}};var _0x4d428c={};var _0x4c5454={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa345('0x6c')]({'where':{'id':_0x1d0176['params']['id']}})['then'](handleEntityNotFound(_0x58a950,null))[_0xa345('0x24')](function(_0x2bc8da){if(_0x2bc8da){_0x4d428c[_0xa345('0x47')]=_[_0xa345('0x49')](db[_0xa345('0x71')][_0xa345('0x45')]);_0x4d428c['query']=_[_0xa345('0x49')](_0x1d0176[_0xa345('0x48')]);_0x4d428c['filters']=_[_0xa345('0x4b')](_0x4d428c[_0xa345('0x47')],_0x4d428c['query']);_0x4a4084['attributes']=_['intersection'](_0x4d428c[_0xa345('0x47')],qs[_0xa345('0x4d')](_0x1d0176[_0xa345('0x48')]['fields']));_0x4a4084[_0xa345('0x4c')]=_0x4a4084[_0xa345('0x4c')]['length']?_0x4a4084['attributes']:_0x4d428c[_0xa345('0x47')];if(!_0x1d0176[_0xa345('0x48')][_0xa345('0x73')](_0xa345('0x4f'))){_0x4a4084[_0xa345('0x35')]=qs[_0xa345('0x35')](_0x1d0176['query'][_0xa345('0x35')]);_0x4a4084[_0xa345('0x33')]=qs['offset'](_0x1d0176[_0xa345('0x48')][_0xa345('0x33')]);}_0x4a4084[_0xa345('0x50')]=qs[_0xa345('0x51')](_0x1d0176[_0xa345('0x48')][_0xa345('0x51')]);_0x4a4084[_0xa345('0x52')]=qs[_0xa345('0x4a')](_[_0xa345('0x53')](_0x1d0176['query'],_0x4d428c[_0xa345('0x4a')]));_0x4a4084[_0xa345('0x52')]['ChatWebsiteId']=_0x2bc8da['id'];if(_0x1d0176[_0xa345('0x48')][_0xa345('0x57')]){_0x4a4084[_0xa345('0x52')]=_[_0xa345('0x54')](_0x4a4084[_0xa345('0x52')],{'$or':_['map'](_0x4a4084['attributes'],function(_0x214368){var _0x5efbdb={};_0x5efbdb[_0x214368]={'$like':'%'+_0x1d0176['query']['filter']+'%'};return _0x5efbdb;})});}_0x4a4084=_['merge']({},_0x4a4084,_0x1d0176[_0xa345('0x58')]);return db[_0xa345('0x71')][_0xa345('0x36')]({'where':_0x4a4084[_0xa345('0x52')]})['then'](function(_0x27d77c){_0x4c5454[_0xa345('0x36')]=_0x27d77c;if(_0x1d0176['query']['includeAll']){_0x4a4084[_0xa345('0x5a')]=[{'all':!![]}];}return db[_0xa345('0x71')][_0xa345('0x74')](_0x4a4084);})['then'](function(_0x2f3ac3){_0x4c5454[_0xa345('0x5b')]=_0x2f3ac3;return _0x4c5454;});}})[_0xa345('0x24')](respondWithFilteredResult(_0x58a950,_0x4a4084))[_0xa345('0x2e')](handleError(_0x58a950,null));};exports[_0xa345('0x75')]=function(_0x514bcd,_0x54ed3c,_0x2e9ef9){return db['ChatWebsite'][_0xa345('0x5d')]({'where':{'id':_0x514bcd[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x54ed3c,null))['then'](function(_0x12f2e6){if(_0x12f2e6){return _0x12f2e6[_0xa345('0x75')](_0x514bcd[_0xa345('0x48')][_0xa345('0x6f')]);}})[_0xa345('0x24')](respondWithStatusCode(_0x54ed3c,null))[_0xa345('0x2e')](handleError(_0x54ed3c,null));};exports[_0xa345('0x76')]=function(_0x3c7393,_0x5b348a,_0x48deab){_0x3c7393[_0xa345('0x5f')][_0xa345('0x77')]=_0x3c7393['file'][_0xa345('0x78')];return db[_0xa345('0x44')][_0xa345('0x5d')]({'where':{'id':_0x3c7393[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x5b348a,null))[_0xa345('0x24')](saveUpdates(_0x3c7393['body'],null))[_0xa345('0x24')](respondWithResult(_0x5b348a,null))[_0xa345('0x2e')](handleError(_0x5b348a,null));};exports[_0xa345('0x79')]=function(_0x2c8c47,_0x3c1694,_0x14fed4){_0x2c8c47[_0xa345('0x5f')][_0xa345('0x7a')]=_0x2c8c47[_0xa345('0x7b')][_0xa345('0x78')];return db[_0xa345('0x44')][_0xa345('0x5d')]({'where':{'id':_0x2c8c47[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x3c1694,null))[_0xa345('0x24')](saveUpdates(_0x2c8c47['body'],null))[_0xa345('0x24')](respondWithResult(_0x3c1694,null))[_0xa345('0x2e')](handleError(_0x3c1694,null));};exports[_0xa345('0x7c')]=function(_0x4bd23e,_0x1a7d0b,_0x5b5871){_0x4bd23e[_0xa345('0x5f')][_0xa345('0x7d')]=_0x4bd23e[_0xa345('0x7b')][_0xa345('0x78')];return db['ChatWebsite'][_0xa345('0x5d')]({'where':{'id':_0x4bd23e[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x1a7d0b,null))[_0xa345('0x24')](saveUpdates(_0x4bd23e[_0xa345('0x5f')],null))[_0xa345('0x24')](respondWithResult(_0x1a7d0b,null))[_0xa345('0x2e')](handleError(_0x1a7d0b,null));};exports[_0xa345('0x7e')]=function(_0x3a1201,_0x2e8e89,_0x265827){_0x3a1201[_0xa345('0x5f')][_0xa345('0x7f')]=_0x3a1201[_0xa345('0x7b')][_0xa345('0x78')];return db['ChatWebsite'][_0xa345('0x5d')]({'where':{'id':_0x3a1201[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x2e8e89,null))['then'](saveUpdates(_0x3a1201['body'],null))[_0xa345('0x24')](respondWithResult(_0x2e8e89,null))[_0xa345('0x2e')](handleError(_0x2e8e89,null));};exports[_0xa345('0x80')]=function(_0x21f1c0,_0x181836,_0x1ce49b){var _0x5e349e=path['join'](config[_0xa345('0x81')],'server/files/images/logos/default_logo.svg');var _0x5c8cff={'where':{'id':_0x21f1c0[_0xa345('0x5c')]['id']},'attributes':['id',_0xa345('0x77')],'raw':!![]};var _0x2d7241=![];return require(_0xa345('0x82'))[_0xa345('0x83')]()[_0xa345('0x24')](function(_0x1ee305){if(_0x1ee305){_0x2d7241=_0x1ee305['custom'];}})[_0xa345('0x24')](function(){return db[_0xa345('0x44')][_0xa345('0x5d')](_0x5c8cff);})[_0xa345('0x24')](handleEntityNotFound(_0x181836,null))['then'](function(_0x10f971){if(_0x10f971){if(!_[_0xa345('0x84')](_0x10f971['sitepic'])){if(fs[_0xa345('0x85')](path[_0xa345('0x86')](config[_0xa345('0x81')],_0xa345('0x87'),_0x10f971['sitepic']))&&_0x2d7241){_0x5e349e=path[_0xa345('0x86')](config[_0xa345('0x81')],_0xa345('0x87'),_0x10f971['sitepic']);}}return _0x181836[_0xa345('0x88')](_0x5e349e);}})[_0xa345('0x2e')](handleError(_0x181836,null));};exports[_0xa345('0x89')]=function(_0x3bdea3,_0x533b0a,_0x5ac1cf){var _0xc3986f=path[_0xa345('0x86')](config['root'],_0xa345('0x8a'));var _0x2eb737={'where':{'id':_0x3bdea3['params']['id']},'attributes':['id',_0xa345('0x7a')],'raw':!![]};return db[_0xa345('0x44')]['find'](_0x2eb737)[_0xa345('0x24')](handleEntityNotFound(_0x533b0a,null))[_0xa345('0x24')](function(_0x2b10c4){if(_0x2b10c4){if(!_[_0xa345('0x84')](_0x2b10c4[_0xa345('0x7a')])){if(fs[_0xa345('0x85')](path[_0xa345('0x86')](config[_0xa345('0x81')],'server/files/images/avatars/',_0x2b10c4[_0xa345('0x7a')]))){_0xc3986f=path[_0xa345('0x86')](config[_0xa345('0x81')],'server/files/images/avatars/',_0x2b10c4[_0xa345('0x7a')]);}}return _0x533b0a['download'](_0xc3986f);}})[_0xa345('0x2e')](handleError(_0x533b0a,null));};exports[_0xa345('0x8b')]=function(_0x25e524,_0x13d9a2,_0x1fac23){var _0x284e0e=path['join'](config['root'],_0xa345('0x8c'));var _0x170126={'where':{'id':_0x25e524[_0xa345('0x5c')]['id']},'attributes':['id',_0xa345('0x7d'),_0xa345('0x8d')],'raw':!![]};return db[_0xa345('0x44')][_0xa345('0x5d')](_0x170126)[_0xa345('0x24')](handleEntityNotFound(_0x13d9a2,null))['then'](function(_0x2477f1){if(_0x2477f1){if(!_[_0xa345('0x84')](_0x2477f1[_0xa345('0x7d')])){if(fs[_0xa345('0x85')](path[_0xa345('0x86')](config[_0xa345('0x81')],_0xa345('0x8e'),_0x2477f1[_0xa345('0x7d')]))&&_0x2477f1[_0xa345('0x8d')]){_0x284e0e=path[_0xa345('0x86')](config[_0xa345('0x81')],_0xa345('0x8e'),_0x2477f1[_0xa345('0x7d')]);}}return _0x13d9a2[_0xa345('0x88')](_0x284e0e);}})[_0xa345('0x2e')](handleError(_0x13d9a2,null));};exports[_0xa345('0x8f')]=function(_0x1fe452,_0x13c105,_0x4f7b60){var _0xac93e7=path[_0xa345('0x86')](config[_0xa345('0x81')],'server/files/images/avatars/system_avatar.png');var _0x163c3b={'where':{'id':_0x1fe452[_0xa345('0x5c')]['id']},'attributes':['id',_0xa345('0x7f')],'raw':!![]};return db[_0xa345('0x44')][_0xa345('0x5d')](_0x163c3b)[_0xa345('0x24')](handleEntityNotFound(_0x13c105,null))[_0xa345('0x24')](function(_0x51df7a){if(_0x51df7a){if(!_[_0xa345('0x84')](_0x51df7a['systemAvatar'])){if(fs[_0xa345('0x85')](path[_0xa345('0x86')](config[_0xa345('0x81')],'server/files/images/avatars/',_0x51df7a['systemAvatar']))){_0xac93e7=path[_0xa345('0x86')](config[_0xa345('0x81')],'server/files/images/avatars/',_0x51df7a[_0xa345('0x7f')]);}}return _0x13c105[_0xa345('0x88')](_0xac93e7);}})['catch'](handleError(_0x13c105,null));};exports[_0xa345('0x90')]=function(_0x4db8f0,_0x2c226a,_0x2e9804){var _0x2dfb29=require('user-agent-parser');var _0x769b55=new _0x2dfb29();var _0x55928e=_0x769b55[_0xa345('0x91')](_0x4db8f0[_0xa345('0x92')]['user-agent'])[_0xa345('0x93')]();var _0x53f72d={'body':_0x4db8f0[_0xa345('0x5f')],'channel':_0xa345('0x94')};var _0x587174=[];var _0x313cc1=[];var _0x4e3847={};var _0x12117d=![];return db[_0xa345('0x95')]['describe']()[_0xa345('0x24')](function(_0x4563dc){if(!_0x4563dc){throw new db['Sequelize']['ValidationError'](_0xa345('0x96'));}_0x587174=_['difference'](_['keys'](_0x4563dc),[_0xa345('0x97'),_0xa345('0x98')]);_0x313cc1=_[_0xa345('0x99')](_[_0xa345('0x49')](_0x4563dc),['createdAt',_0xa345('0x98'),'CompanyId',_0xa345('0x9a')]);if(_0x4db8f0[_0xa345('0x5f')]['id']){delete _0x4db8f0[_0xa345('0x5f')]['id'];}if(_['isNil'](_0x4db8f0[_0xa345('0x5f')]['from'])){throw new db[(_0xa345('0x9b'))]['ValidationError'](_0xa345('0x9c'));}if(_[_0xa345('0x84')](_0x4db8f0[_0xa345('0x5f')][_0xa345('0x5f')])||_0x4db8f0[_0xa345('0x5f')][_0xa345('0x5f')]===''){throw new db[(_0xa345('0x9b'))][(_0xa345('0x9d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa345('0x84')](_0x4db8f0[_0xa345('0x5f')][_0xa345('0x9e')])){throw new db[(_0xa345('0x9b'))]['ValidationError'](_0xa345('0x9f')+_0x313cc1);}if(!_[_0xa345('0xa0')](_0x313cc1,_0x4db8f0[_0xa345('0x5f')][_0xa345('0x9e')])){throw new db['Sequelize'][(_0xa345('0x9d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x313cc1);}_0x4e3847[_0x4db8f0[_0xa345('0x5f')][_0xa345('0x9e')]]=_0x4db8f0[_0xa345('0x5f')][_0xa345('0xa1')];})[_0xa345('0x24')](function(){return db[_0xa345('0x44')][_0xa345('0x5d')]({'where':{'id':_0x4db8f0['params']['id']},'include':[{'model':db[_0xa345('0xa2')],'as':_0xa345('0xa3'),'include':[{'model':db[_0xa345('0x95')],'as':_0xa345('0xa4'),'where':_0x4e3847,'limit':0x1,'order':[[_0xa345('0x98'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xa345('0xa5')}]});})['then'](handleEntityNotFound(_0x2c226a,null))['then'](function(_0x3713d3){if(_0x3713d3&&_0x3713d3[_0xa345('0xa3')]){_0x53f72d['account']=_0x3713d3;_0x53f72d[_0xa345('0xa6')]=_0x3713d3[_0xa345('0xa5')];_0x53f72d[_0xa345('0xa7')]=_0x3713d3['List'];_0x53f72d[_0xa345('0xa6')]=_[_0xa345('0xa8')](_0x53f72d[_0xa345('0xa6')],[_0xa345('0xa9')],[_0xa345('0xaa')]);if(_0x53f72d[_0xa345('0xab')][_0xa345('0xa5')]){delete _0x53f72d[_0xa345('0xab')][_0xa345('0xa5')];}if(_0x53f72d[_0xa345('0xab')][_0xa345('0xa3')]&&_0x53f72d[_0xa345('0xab')][_0xa345('0xa3')][_0xa345('0xa4')][_0xa345('0x4e')]){return _0x53f72d[_0xa345('0xab')]['List'][_0xa345('0xa4')][0x0];}var _0xa3fbd3=_[_0xa345('0x1e')](_0x4db8f0[_0xa345('0x5f')],{'firstName':_0x4db8f0[_0xa345('0x5f')][_0xa345('0xa1')],'ListId':_0x3713d3[_0xa345('0x9a')]});_0xa3fbd3[_0x4db8f0[_0xa345('0x5f')][_0xa345('0x9e')]]=_0x4db8f0['body'][_0xa345('0xa1')];return db[_0xa345('0x95')]['create'](_0xa3fbd3,{'fields':_0x587174,'raw':!![]});}})[_0xa345('0x24')](handleEntityNotFound(_0x2c226a,null))[_0xa345('0x24')](function(_0x4bffa6){_0x53f72d[_0xa345('0xac')]=_0x4bffa6;var _0x3a1dae=_0x4db8f0['body'][_0xa345('0xad')];if(_0x4db8f0[_0xa345('0x92')]['cf-connecting-ip']){_0x3a1dae=_0x4db8f0[_0xa345('0x92')][_0xa345('0xae')];}else if(_0x4db8f0[_0xa345('0x92')][_0xa345('0xaf')]){_0x3a1dae=_['first'](_0x4db8f0[_0xa345('0x92')][_0xa345('0xaf')]['split'](','));}if(_0x4bffa6){var _0x2a2ec4={'ContactId':_0x4bffa6['id'],'ChatWebsiteId':_0x4db8f0[_0xa345('0x5c')]['id'],'from':(_0x4bffa6[_0xa345('0xb0')]||'')+'\x20'+(_0x4bffa6['lastName']||''),'customerIp':_0x3a1dae,'customerPort':_0x4db8f0['headers'][_0xa345('0xb1')]?_0x4db8f0[_0xa345('0x92')][_0xa345('0xb1')]:null,'referer':_0x4db8f0[_0xa345('0x5f')][_0xa345('0xb2')],'browserName':_0x55928e['browser'][_0xa345('0x3e')]&&_0x55928e['browser'][_0xa345('0xb3')]?util['format'](_0xa345('0xb4'),_0x55928e[_0xa345('0xb5')]['name'],_0x55928e[_0xa345('0xb5')][_0xa345('0xb3')]):'unknown','browserVersion':_0x55928e['browser'][_0xa345('0xb3')]||_0xa345('0xb6'),'osName':util[_0xa345('0xb7')](_0xa345('0xb4'),_0x55928e['os'][_0xa345('0x3e')],_0x55928e['os'][_0xa345('0xb3')]),'osVersion':_0x55928e['os']['version'],'deviceModel':_0x55928e[_0xa345('0xb8')]['model']&&_0x55928e['device']['vendor']?util[_0xa345('0xb7')](_0xa345('0xb9'),_0x55928e['device'][_0xa345('0x47')],_0x55928e['device']['vendor'],_0x55928e[_0xa345('0xb8')][_0xa345('0x55')]):null,'deviceVendor':_0x55928e[_0xa345('0xb8')][_0xa345('0xba')],'deviceType':_0x55928e[_0xa345('0xb8')][_0xa345('0x55')],'formData':JSON[_0xa345('0x29')](_0x4db8f0[_0xa345('0x5f')])};var _0x115b9c={'ChatWebsiteId':_0x4db8f0[_0xa345('0x5c')]['id'],'closed':![]};if(_0x4db8f0[_0xa345('0x5f')][_0xa345('0xbb')]){_0x115b9c[_0xa345('0xbb')]=_0x4db8f0['body']['threadId'];return db[_0xa345('0xbc')][_0xa345('0x5d')]({'where':_0x115b9c})['then'](function(_0x3e7642){if(_0x3e7642){return[_0x3e7642,![]];}_0x2a2ec4['threadId']=_0x4db8f0[_0xa345('0x5f')][_0xa345('0xbb')];_0x2a2ec4['externalUrl']=_0x4db8f0['body']['externalUrl'];return db[_0xa345('0xbc')][_0xa345('0x5e')](_0x2a2ec4)[_0xa345('0x24')](function(_0x4aee10){return[_0x4aee10,!![]];});});}_0x115b9c[_0xa345('0xbd')]=_0x4bffa6['id'];if(_0x4db8f0[_0xa345('0x5f')][_0xa345('0xbe')]&&_0x4db8f0[_0xa345('0x5f')][_0xa345('0xbe')]['id']){_0x115b9c['id']=_0x4db8f0[_0xa345('0x5f')]['interaction']['id'];return db[_0xa345('0xbc')][_0xa345('0x5d')]({'where':_0x115b9c})[_0xa345('0x24')](function(_0x285343){if(_0x285343){return[_0x285343,![]];}return db[_0xa345('0xbc')][_0xa345('0x5e')](_0x2a2ec4)[_0xa345('0x24')](function(_0x560be8){return[_0x560be8,!![]];});});}return db[_0xa345('0xbc')][_0xa345('0x5e')](_0x2a2ec4)[_0xa345('0x24')](function(_0x17713a){return[_0x17713a,!![]];});}})[_0xa345('0xbf')](function(_0x65036d,_0x526923){if(_0x65036d){_0x12117d=_0x526923;if(!_0x526923){var _0xd21421={'from':(_0x53f72d[_0xa345('0xac')][_0xa345('0xb0')]||'')+'\x20'+(_0x53f72d[_0xa345('0xac')][_0xa345('0xc0')]||'')};if(_0x4db8f0[_0xa345('0x5f')]['threadId']&&_0x4db8f0[_0xa345('0x5f')]['messageId']&&_0x4db8f0[_0xa345('0x5f')][_0xa345('0xbb')]!=_0x4db8f0[_0xa345('0x5f')][_0xa345('0xc1')]){_0xd21421[_0xa345('0xbb')]=_0x4db8f0[_0xa345('0x5f')]['messageId'];}return _0x65036d[_0xa345('0x3a')](_0xd21421);}else{return _0x65036d;}}})[_0xa345('0x24')](function(_0x248746){_0x53f72d[_0xa345('0xbe')]=_0x248746[_0xa345('0x60')]({'plain':!![]});_0x53f72d[_0xa345('0xbe')][_0xa345('0xc2')]=_0x12117d;if(_0x53f72d['interaction']['created']){if(_0x53f72d['account'][_0xa345('0xc3')]){_0x53f72d[_0xa345('0xa6')]['push']({'id':0x0,'priority':_0x53f72d[_0xa345('0xa6')][_0xa345('0x4e')]+0x1,'app':_0xa345('0xc4'),'appdata':_0xa345('0xc5'),'interval':_0xa345('0xc6')});}}return db[_0xa345('0xc7')][_0xa345('0x5e')]({'body':_0x4db8f0[_0xa345('0x5f')]['body'],'ChatWebsiteId':_0x4db8f0['params']['id'],'ChatInteractionId':_0x248746['id'],'direction':'in','ContactId':_0x53f72d[_0xa345('0xac')]['id'],'AttachmentId':_0x4db8f0['body'][_0xa345('0xc8')]});})[_0xa345('0x24')](function(_0x14ef33){_0x53f72d['message']=_0x14ef33;if(_0x53f72d['interaction'][_0xa345('0xc9')]){return db[_0xa345('0xca')][_0xa345('0x5d')]({'attributes':['id',_0xa345('0x3e')],'where':{'id':_0x53f72d[_0xa345('0xbe')]['UserId']}})[_0xa345('0x24')](function(_0x1e5ca1){if(_0x1e5ca1){_0x53f72d['applications'][_0xa345('0xcb')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1e5ca1[_0xa345('0x3e')]+','+(_0x53f72d['account'][_0xa345('0xcc')]||0xa),'interval':_0xa345('0xc6')});_0x53f72d[_0xa345('0xcd')]=!![];}return respondWithRpcPromise(_0xa345('0xce'),_0xa345('0xcf'),_0x53f72d);});}return respondWithRpcPromise(_0xa345('0xce'),_0xa345('0xcf'),_0x53f72d);})[_0xa345('0x24')](function(_0x409016){respondWithRpcPromise(_0xa345('0xd0'),_0xa345('0xd0'),{'event':_0xa345('0x90'),'message':_0x409016},client9002);return _0x409016;})[_0xa345('0x24')](respondWithResult(_0x2c226a,null))[_0xa345('0x2e')](handleError(_0x2c226a,null));};exports[_0xa345('0xd1')]=function(_0x394d4e,_0x50521e,_0x58b079){var _0x5c6da5,_0x582bd8,_0x74d0f5;var _0x4a8dc6=[];var _0x3ccc02=[];var _0x1a9ae5={};var _0x3eaa3d=_0x394d4e[_0xa345('0xd2')]||[];var _0x28fe03=[];var _0x5a80c3;return db['CmContact'][_0xa345('0x68')]()[_0xa345('0x24')](function(_0x35c670){if(!_0x35c670){throw new db[(_0xa345('0x9b'))][(_0xa345('0x9d'))](_0xa345('0x96'));}_0x3ccc02=_[_0xa345('0x99')](_[_0xa345('0x49')](_0x35c670),['createdAt',_0xa345('0x98')]);_0x4a8dc6=_[_0xa345('0x99')](_[_0xa345('0x49')](_0x35c670),[_0xa345('0x97'),_0xa345('0x98'),_0xa345('0xd3'),_0xa345('0x9a')]);if(_0x394d4e[_0xa345('0x5f')]['id']){delete _0x394d4e[_0xa345('0x5f')]['id'];}if(_[_0xa345('0x84')](_0x394d4e[_0xa345('0x5f')]['from'])){throw _0x50521e[_0xa345('0x30')](0x1f4)['send'](new db[(_0xa345('0x9b'))]['ValidationError'](_0xa345('0x9c')));}if(_[_0xa345('0x84')](_0x394d4e[_0xa345('0x5f')][_0xa345('0x5f')])||_0x394d4e[_0xa345('0x5f')][_0xa345('0x5f')]===''){throw _0x50521e[_0xa345('0x30')](0x1f4)['send'](new db['Sequelize'][(_0xa345('0x9d'))](_0xa345('0xd4')));}if(_[_0xa345('0x84')](_0x394d4e[_0xa345('0x5f')][_0xa345('0xd5')])){throw _0x50521e['status'](0x1f4)[_0xa345('0x3f')](new db[(_0xa345('0x9b'))]['ValidationError'](_0xa345('0xd6')+_0x4a8dc6));}if(!_[_0xa345('0xa0')](_0x4a8dc6,_0x394d4e[_0xa345('0x5f')][_0xa345('0xd5')])){throw _0x50521e['status'](0x1f4)[_0xa345('0x3f')](new db[(_0xa345('0x9b'))][(_0xa345('0x9d'))](_0xa345('0xd7')+_0x4a8dc6));}_0x1a9ae5[_0x394d4e[_0xa345('0x5f')][_0xa345('0xd5')]]=_0x394d4e[_0xa345('0x5f')]['from'];})[_0xa345('0x24')](function(){return db[_0xa345('0x44')][_0xa345('0x5d')]({'where':{'id':_0x394d4e[_0xa345('0x5c')]['id']},'include':[{'model':db[_0xa345('0xa2')],'as':_0xa345('0xa3')},{'model':db['MailAccount'],'as':_0xa345('0xd8')}]});})[_0xa345('0x24')](handleEntityNotFound(_0x50521e,null))[_0xa345('0x24')](function(_0x5bbba8){if(_0x5bbba8&&_0x5bbba8['List']){_0x582bd8=_0x5bbba8;var _0x33a2f2=_['defaults'](_0x394d4e[_0xa345('0x5f')],{'firstName':_0x394d4e[_0xa345('0x5f')][_0xa345('0xa1')],'phone':_0x394d4e[_0xa345('0x5f')][_0xa345('0xa1')],'ListId':_0x5bbba8[_0xa345('0x9a')]});_0x33a2f2[_0x394d4e['body'][_0xa345('0xd5')]]=_0x394d4e['body'][_0xa345('0xa1')];return db['CmContact'][_0xa345('0xd9')]({'where':_0x1a9ae5,'defaults':_0x33a2f2});}})[_0xa345('0xbf')](function(_0x1bc369){if(_0x1bc369){_0x74d0f5=_0x1bc369;var _0x22680a=fs[_0xa345('0xda')](path['join'](config[_0xa345('0x81')],_0xa345('0xdb')),'utf8');var _0x5843d3=ejs[_0xa345('0xdc')](_0x22680a,{'body':_['toPairs'](_0x394d4e[_0xa345('0x5f')][_0xa345('0x5f')]),'bodyTitle':_0x582bd8[_0xa345('0xdd')]});return db[_0xa345('0xde')]['create']({'body':_0x5843d3,'ContactId':_0x1bc369['id'],'ChatWebsiteId':_0x582bd8['id']});}})[_0xa345('0x24')](function(_0x1d62fb){_0x5a80c3=_0x1d62fb;if(_0x3eaa3d[_0xa345('0x4e')]){var _0x5bd812=_0x3eaa3d[_0xa345('0x43')](function(_0x48fbc7){return{'name':_0x48fbc7['originalname'],'basename':_0x48fbc7[_0xa345('0x78')],'type':_0x48fbc7[_0xa345('0xdf')],'ChatOfflineMessageId':_0x1d62fb['id']};});_0x28fe03=_0x5bd812[_0xa345('0x43')](_0x7710a7=>{var _0x4f2e0c={'filename':_0x7710a7[_0xa345('0x3e')],'path':path[_0xa345('0x86')](config[_0xa345('0x81')],_0xa345('0xe0'),_0xa345('0xd2'),_0xa345('0xe1'),_0xa345('0xe2'),_0x7710a7[_0xa345('0xe3')])};return _0x4f2e0c;});if(!_0x582bd8['openNewInteraction']){return db[_0xa345('0xe4')]['transaction'](function(_0x5677e5){return db[_0xa345('0xe5')][_0xa345('0xe6')](_0x5bd812,{'transaction':_0x5677e5});});}}})[_0xa345('0x24')](function(){if(_0x5a80c3){_0x5c6da5=_0x5a80c3;return db[_0xa345('0xd8')][_0xa345('0x6c')]({'where':{'active':!![]},'include':[{'model':db[_0xa345('0xe7')],'as':_0xa345('0xe8'),'raw':!![]}]});}})[_0xa345('0x24')](function(_0x3c5c4c){if(_0x3c5c4c&&_0x3c5c4c[_0xa345('0xe8')]&&_0x582bd8['forwardOffline']&&_0x582bd8[_0xa345('0xe9')]){var _0x37d7ee={'tls':{'rejectUnauthorized':![]}};if(_0x3c5c4c[_0xa345('0xe8')][_0xa345('0xea')]){_0x37d7ee[_0xa345('0xea')]=_0x3c5c4c[_0xa345('0xe8')][_0xa345('0xea')];}else{_0x37d7ee['host']=_0x3c5c4c[_0xa345('0xe8')][_0xa345('0xeb')];_0x37d7ee[_0xa345('0xec')]=_0x3c5c4c[_0xa345('0xe8')][_0xa345('0xec')];_0x37d7ee[_0xa345('0xed')]=_0x3c5c4c[_0xa345('0xe8')][_0xa345('0xed')];}if(_0x3c5c4c[_0xa345('0xe8')][_0xa345('0xee')]){_0x37d7ee['auth']={'user':_0x3c5c4c[_0xa345('0xe8')][_0xa345('0x63')],'pass':_0x3c5c4c[_0xa345('0xe8')]['pass']};}return respondWithRpcPromise(_0xa345('0xef'),_0xa345('0xf0'),{'account':_0x37d7ee,'message':{'from':util[_0xa345('0xb7')]('\x22%s\x22\x20<%s>',_0x3c5c4c['name'],_0x3c5c4c['email']||_0x3c5c4c[_0xa345('0xe8')][_0xa345('0x63')]),'to':_0x582bd8[_0xa345('0xe9')],'subject':_0x582bd8[_0xa345('0xf1')],'html':_0x5c6da5[_0xa345('0x5f')],'attachments':_0x28fe03}},client9003)['then'](function(){return _0x5c6da5;})['catch'](function(_0xb8948e){console[_0xa345('0x2a')](_0xb8948e);});}})[_0xa345('0x24')](function(){if(_0x582bd8&&_0x582bd8[_0xa345('0xf2')]&&_0x582bd8[_0xa345('0xf3')]){var _0x596bd1=[];if(_0x3eaa3d[_0xa345('0x4e')]){_0x596bd1=_0x3eaa3d['map'](function(_0x3e7f1b){return{'name':_0x3e7f1b[_0xa345('0xf4')],'basename':_0x3e7f1b[_0xa345('0x78')],'type':_0x3e7f1b[_0xa345('0xdf')],'ChatOfflineMessageId':_0x5a80c3['id']};});}var _0x240196;if(!_['isNil'](_0x582bd8['subjectOffline'])){var _0x558135=_[_0xa345('0x43')](_0x394d4e[_0xa345('0x5f')],function(_0x1cc8b2){return _0x1cc8b2;});var _0x536bd4=_[_0xa345('0xf5')](_0x558135)[0x0];var _0x389ca2=_[_0xa345('0xf6')](_0x536bd4,function(_0x38be6e){return _0x38be6e;});_0x240196=_0x389ca2[0x1][_0x582bd8[_0xa345('0xf7')]];}var _0x2812b8={'from':_0x74d0f5[_0xa345('0xf8')],'firstName':_0x74d0f5[_0xa345('0xb0')],'lastName':_0x74d0f5[_0xa345('0xc0')],'mapKey':_0xa345('0xf8'),'message':{'from':_0x74d0f5[_0xa345('0xf8')],'to':_0x582bd8['MailAccount'][_0xa345('0xf8')],'cc':'','subject':_[_0xa345('0x84')](_0x240196)?_0x582bd8['offlineMessageSubject']:_0x240196,'messageId':'','sentAt':new Date(),'attach':_0x596bd1['length'],'attachments':_0x596bd1,'originChannel':_0xa345('0xf9'),'ChatWebsiteId':_0x582bd8['id'],'ChatOfflineMessageId':_0x5c6da5['id'],'originTo':_0x582bd8['MailAccount']['email']},'body':_0x5c6da5[_0xa345('0x5f')]};var _0x15217b={'account':{'id':_0x582bd8[_0xa345('0xf3')]},'body':_0x2812b8,'log':_0xa345('0xfa')};return respondWithRpcPromise(_0xa345('0xfa'),_0xa345('0xfb'),_0x15217b,client9001)[_0xa345('0x24')](function(){return _0x5c6da5;})[_0xa345('0x2e')](function(_0x4e9069){console[_0xa345('0x2a')](_0x4e9069);});}return;})['then'](function(){if(_0x5c6da5){return _0x5c6da5;}})[_0xa345('0x24')](respondWithResult(_0x50521e,null))[_0xa345('0x2e')](function(_0x54112a){console['error']('catch',_0x54112a);for(var _0x80af99 of _0x3eaa3d){var _0xa8f7f2=path['join'](config['root'],_0xa345('0xe0'),_0xa345('0xd2'),_0xa345('0xe1'),_0xa345('0xe2'),_0x80af99[_0xa345('0x78')]);fs_extra[_0xa345('0xfc')](_0xa8f7f2)[_0xa345('0x2e')](function(_0x4cfdc3){console[_0xa345('0x2a')](_0xa345('0xfd'),_0xa8f7f2,_0x4cfdc3);});}});};exports[_0xa345('0xfe')]=function(_0x328d4a,_0x44232e,_0x4b2e67){return db[_0xa345('0xbc')][_0xa345('0x5d')]({'where':{'id':_0x328d4a[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x44232e,null))['then'](function(_0x518897){if(_0x518897){return _0x518897[_0xa345('0xfe')](_0x328d4a[_0xa345('0x5f')][_0xa345('0x6f')],_[_0xa345('0xff')](_0x328d4a['body'],[_0xa345('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x44232e,null))[_0xa345('0x2e')](handleError(_0x44232e,null));};exports['getInteractions']=function(_0x23ab06,_0x87ad57,_0x535655){var _0x462e02={'raw':![],'where':{}};var _0x130f68={};var _0x1535f7={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa345('0x6c')]({'where':{'id':_0x23ab06[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x87ad57,null))['then'](function(_0x500406){if(_0x500406){_0x130f68['model']=_[_0xa345('0x49')](db[_0xa345('0xbc')][_0xa345('0x45')]);_0x130f68[_0xa345('0x48')]=_[_0xa345('0x49')](_0x23ab06[_0xa345('0x48')]);_0x130f68[_0xa345('0x4a')]=_[_0xa345('0x4b')](_0x130f68[_0xa345('0x47')],_0x130f68[_0xa345('0x48')]);_0x462e02[_0xa345('0x4c')]=_[_0xa345('0x4b')](_0x130f68[_0xa345('0x47')],qs[_0xa345('0x4d')](_0x23ab06[_0xa345('0x48')][_0xa345('0x4d')]));_0x462e02[_0xa345('0x4c')]=_0x462e02[_0xa345('0x4c')][_0xa345('0x4e')]?_0x462e02[_0xa345('0x4c')]:_0x130f68[_0xa345('0x47')];if(!_0x23ab06[_0xa345('0x48')][_0xa345('0x73')](_0xa345('0x4f'))){_0x462e02[_0xa345('0x35')]=qs[_0xa345('0x35')](_0x23ab06[_0xa345('0x48')][_0xa345('0x35')]);_0x462e02[_0xa345('0x33')]=qs[_0xa345('0x33')](_0x23ab06[_0xa345('0x48')]['offset']);}_0x462e02[_0xa345('0x50')]=qs[_0xa345('0x51')](_0x23ab06['query'][_0xa345('0x51')]);_0x462e02['where']=qs[_0xa345('0x4a')](_[_0xa345('0x53')](_0x23ab06['query'],_0x130f68[_0xa345('0x4a')]));_0x462e02['where'][_0xa345('0x6a')]=_0x500406['id'];if(_0x23ab06[_0xa345('0x48')][_0xa345('0x57')]){_0x462e02[_0xa345('0x52')]=_['merge'](_0x462e02['where'],{'$or':_[_0xa345('0x43')](_0x462e02['attributes'],function(_0x263ed7){var _0x944eb={};_0x944eb[_0x263ed7]={'$like':'%'+_0x23ab06['query']['filter']+'%'};return _0x944eb;})});}_0x462e02=_[_0xa345('0x54')]({},_0x462e02,_0x23ab06[_0xa345('0x58')]);return db[_0xa345('0xbc')][_0xa345('0x36')]({'where':_0x462e02[_0xa345('0x52')]})[_0xa345('0x24')](function(_0x2701d7){_0x1535f7[_0xa345('0x36')]=_0x2701d7;if(_0x23ab06[_0xa345('0x48')]['includeAll']){_0x462e02['include']=[{'model':db[_0xa345('0x95')],'as':_0xa345('0x100'),'required':![]},{'model':db[_0xa345('0xca')],'as':_0xa345('0x101'),'attributes':[_0xa345('0x3e'),_0xa345('0x102'),_0xa345('0x103')],'required':![]},{'model':db[_0xa345('0x104')],'as':_0xa345('0x105'),'attributes':['id',_0xa345('0x3e'),_0xa345('0x106')],'where':_0x23ab06[_0xa345('0x48')][_0xa345('0x107')]?{'id':_0x23ab06[_0xa345('0x48')][_0xa345('0x107')]}:undefined,'required':_0x23ab06[_0xa345('0x48')][_0xa345('0x107')]?!![]:![]}];}return db[_0xa345('0xbc')][_0xa345('0x74')](_0x462e02);})[_0xa345('0x24')](function(_0x33f907){_0x1535f7[_0xa345('0x5b')]=_0x33f907;return _0x1535f7;});}})[_0xa345('0x24')](respondWithFilteredResult(_0x87ad57,_0x462e02))[_0xa345('0x2e')](handleError(_0x87ad57,null));};function iftimePromise(_0x52fc52,_0x309a86){return respondWithRpcPromise(_0xa345('0x108'),'getSnippet',{'command':_0x309a86[_0xa345('0x109')]?util[_0xa345('0xb7')](_0xa345('0x10a'),_0x52fc52[_0xa345('0x10b')],_0x309a86[_0xa345('0x109')]):util[_0xa345('0xb7')]('iftime\x20%s',_0x52fc52[_0xa345('0x10b')])},client9002)[_0xa345('0x24')](function(_0x150184){var _0x372834=_0x150184&&_0x150184[_0xa345('0x10c')](_0xa345('0x10d'))>=0x0?!![]:![];logger[_0xa345('0x10e')](_0xa345('0x10f'),_0x309a86['id'],_0x52fc52['id'],_0x52fc52[_0xa345('0x10b')],_0x372834?_0xa345('0x110'):_0xa345('0x111'),_0x309a86[_0xa345('0x109')]?_0x309a86[_0xa345('0x109')]:'No\x20timezone');return _0x372834;})[_0xa345('0x2e')](function(_0x2497ce){logger[_0xa345('0x2a')](_0xa345('0x10f'),_0x309a86['id'],_0x52fc52['id'],_0x52fc52['interval'],util[_0xa345('0x112')](_0x2497ce,{'showHidden':![],'depth':null}),_0x309a86['timezone']?_0x309a86[_0xa345('0x109')]:_0xa345('0x113'));return![];});}exports['getSnippet']=function(_0x394f12,_0x29f8f2,_0x37c8d0){var _0x4cbe48=0x0;var _0x1af8cc=0x0;var _0x547055=![];var _0x2bd749;var _0x298adb;return db[_0xa345('0x44')][_0xa345('0x5d')]({'where':{'id':_0x394f12[_0xa345('0x5c')]['id']},'include':[{'model':db[_0xa345('0x114')],'as':_0xa345('0x114'),'include':[{'model':db[_0xa345('0x114')],'as':_0xa345('0x115'),'attributes':['id',_0xa345('0x10b')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x29f8f2,null))['then'](function(_0x51ced2){if(_0x51ced2){_0x2bd749=_0x51ced2;return _0x51ced2['getProactiveActions']({'raw':!![]});}})[_0xa345('0x24')](function(_0x2af348){if(_0x2bd749){if(_0x2af348){_0x298adb=_0x2af348;}}return require('../../config/license/util')[_0xa345('0x83')]();})[_0xa345('0x24')](function(_0xf84187){if(_0xf84187){_0x1af8cc=_0xf84187['virtual'];_0x547055=_0xf84187[_0xa345('0x116')];}})['then'](function(){return db[_0xa345('0xbc')][_0xa345('0x36')]({'where':{'closed':![]}});})[_0xa345('0x24')](function(_0x1168dd){_0x4cbe48=_0x1168dd;if(_0x1af8cc&&_0x1168dd>_0x1af8cc){return db['License'][_0xa345('0x6c')]({'where':{'id':0x1}})[_0xa345('0x24')](function(_0x4685de){if(_0x4685de){_0x4685de[_0xa345('0x117')](_0xa345('0x118'));}});}})[_0xa345('0x24')](function(){if(_0x2bd749[_0xa345('0x114')]&&_0x2bd749['Interval'][_0xa345('0x115')]){var _0x5f0215=[];for(var _0x429079=0x0;_0x429079<_0x2bd749[_0xa345('0x114')][_0xa345('0x115')][_0xa345('0x4e')];_0x429079++){var _0x4a6f9c=_0x2bd749[_0xa345('0x114')][_0xa345('0x115')][_0x429079][_0xa345('0x60')]({'plain':!![]});_0x5f0215['push'](iftimePromise(_0x4a6f9c,_0x2bd749));}return BPromise['all'](_0x5f0215)['then'](function(_0x1e7095){return _[_0xa345('0x119')](_0x1e7095);});}else{return!![];}})[_0xa345('0x24')](function(_0x167107){var _0x44a0c4=fs[_0xa345('0xda')](path[_0xa345('0x86')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x25e72e={'remote':_0x2bd749[_0xa345('0x11a')],'query':querystring[_0xa345('0x29')](_[_0xa345('0x54')](_0x2bd749[_0xa345('0x60')]({'plain':!![]}),{'customerIp':_0x394f12[_0xa345('0x92')][_0xa345('0xaf')]||_0x394f12[_0xa345('0x92')][_0xa345('0x11b')]||_0x394f12[_0xa345('0x11c')][_0xa345('0x11d')]||_0x394f12['ip'],'referer':_0x394f12[_0xa345('0x92')]['referer'],'openedInteractions':_0x4cbe48,'maxInteractions':_0x1af8cc,'virtual':_0x547055['virtual'],'online':_0x167107,'custom':_0x547055}))[_0xa345('0x11e')](/'/g,'\x5c\x27')};_0x29f8f2['send'](ejs[_0xa345('0xdc')](Mustache[_0xa345('0xdc')](_0x44a0c4,_0x25e72e),{'proactiveActions':_0x298adb,'alignment':_0x2bd749[_0xa345('0x11f')],'verticalAlignment':_0x2bd749[_0xa345('0x120')],'div_color':_0x2bd749[_0xa345('0x106')],'text_color':_0x2bd749['textColor'],'button_color':_0x2bd749[_0xa345('0x121')],'background_color':_0x2bd749[_0xa345('0x122')]}));})[_0xa345('0x2e')](handleError(_0x29f8f2,null));};exports[_0xa345('0x123')]=function(_0xd07f81,_0x103f08,_0x4ed246){return db[_0xa345('0x44')][_0xa345('0x6c')]({'where':{'id':_0xd07f81[_0xa345('0x5c')]['id']}})['then'](handleEntityNotFound(_0x103f08,null))[_0xa345('0x24')](function(_0x317b56){if(_0x317b56){return db[_0xa345('0xe4')][_0xa345('0x124')](function(_0x146ed7){return db[_0xa345('0x125')]['destroy']({'where':{'ChatWebsiteId':_0xd07f81['params']['id']},'transaction':_0x146ed7})[_0xa345('0x24')](function(_0x2894d0){var _0x35842a=_['map'](_0xd07f81[_0xa345('0x5f')],function(_0x3d15ce){_0x3d15ce[_0xa345('0x6a')]=_0xd07f81['params']['id'];return _0x3d15ce;});return db[_0xa345('0x125')]['bulkCreate'](_0x35842a,{'transaction':_0x146ed7});});})[_0xa345('0x24')](function(){return db[_0xa345('0x125')][_0xa345('0x126')]({'where':{'ChatWebsiteId':_0xd07f81[_0xa345('0x5c')]['id']},'order':_0xa345('0xa9')});});}})[_0xa345('0x24')](respondWithResult(_0x103f08,null))['catch'](handleError(_0x103f08,null));};exports[_0xa345('0x127')]=function(_0x105f7d,_0x2ce9dc,_0x5a1f9b){var _0x56bde8={};var _0xcafaa4={};var _0x135b84;var _0x25d622;return db[_0xa345('0x44')][_0xa345('0x6c')]({'where':{'id':_0x105f7d[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x2ce9dc,null))[_0xa345('0x24')](function(_0x3b67a7){if(_0x3b67a7){_0x135b84=_0x3b67a7;_0xcafaa4[_0xa345('0x47')]=_[_0xa345('0x49')](db[_0xa345('0x125')][_0xa345('0x45')]);_0xcafaa4[_0xa345('0x48')]=_['keys'](_0x105f7d[_0xa345('0x48')]);_0xcafaa4[_0xa345('0x4a')]=_[_0xa345('0x4b')](_0xcafaa4[_0xa345('0x47')],_0xcafaa4['query']);_0x56bde8[_0xa345('0x4c')]=_['intersection'](_0xcafaa4['model'],qs[_0xa345('0x4d')](_0x105f7d[_0xa345('0x48')][_0xa345('0x4d')]));_0x56bde8['attributes']=_0x56bde8['attributes'][_0xa345('0x4e')]?_0x56bde8[_0xa345('0x4c')]:_0xcafaa4['model'];_0x56bde8[_0xa345('0x50')]=qs[_0xa345('0x51')](_0x105f7d[_0xa345('0x48')][_0xa345('0x51')]);_0x56bde8[_0xa345('0x52')]=qs[_0xa345('0x4a')](_[_0xa345('0x53')](_0x105f7d[_0xa345('0x48')],_0xcafaa4[_0xa345('0x4a')]));if(_0x105f7d['query']['filter']){_0x56bde8[_0xa345('0x52')]=_[_0xa345('0x54')](_0x56bde8['where'],{'$or':_[_0xa345('0x43')](_0x56bde8['attributes'],function(_0x114028){var _0x295450={};_0x295450[_0x114028]={'$like':'%'+_0x105f7d['query']['filter']+'%'};return _0x295450;})});}_0x56bde8=_[_0xa345('0x54')]({},_0x56bde8,_0x105f7d['options']);return _0x135b84[_0xa345('0x127')](_0x56bde8);}})[_0xa345('0x24')](function(_0x3b1b43){if(_0x3b1b43){_0x25d622=_0x3b1b43['length'];if(!_0x105f7d[_0xa345('0x48')][_0xa345('0x73')](_0xa345('0x4f'))){_0x56bde8['limit']=qs[_0xa345('0x35')](_0x105f7d[_0xa345('0x48')][_0xa345('0x35')]);_0x56bde8[_0xa345('0x33')]=qs['offset'](_0x105f7d[_0xa345('0x48')][_0xa345('0x33')]);}return _0x135b84[_0xa345('0x127')](_0x56bde8);}})['then'](function(_0x36fc8d){if(_0x36fc8d){return _0x36fc8d?{'count':_0x25d622,'rows':_0x36fc8d}:null;}})[_0xa345('0x24')](respondWithResult(_0x2ce9dc,null))[_0xa345('0x2e')](handleError(_0x2ce9dc,null));};exports[_0xa345('0x128')]=function(_0x339274,_0x37c523,_0xd0db6b){return db['chatProactiveAction'][_0xa345('0x5d')]({'where':{'id':_0x339274[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x37c523,null))[_0xa345('0x24')](function(_0x97a0c4){if(_0x97a0c4){return _0x97a0c4[_0xa345('0x128')](_0x339274['body'][_0xa345('0x6f')],_[_0xa345('0xff')](_0x339274[_0xa345('0x5f')],[_0xa345('0x6f'),'id'])||{});}})[_0xa345('0x24')](respondWithResult(_0x37c523,null))[_0xa345('0x2e')](handleError(_0x37c523,null));};exports[_0xa345('0x129')]=function(_0x445eaa,_0x50e7ae,_0x12233f){var _0x45baf8={};var _0x170daa={};var _0x569a5;var _0x494230;return db['ChatWebsite'][_0xa345('0x6c')]({'where':{'id':_0x445eaa[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x50e7ae,null))[_0xa345('0x24')](function(_0x4ba9b6){if(_0x4ba9b6){_0x569a5=_0x4ba9b6;_0x170daa[_0xa345('0x47')]=_[_0xa345('0x49')](db[_0xa345('0x12a')][_0xa345('0x45')]);_0x170daa[_0xa345('0x48')]=_[_0xa345('0x49')](_0x445eaa['query']);_0x170daa[_0xa345('0x4a')]=_[_0xa345('0x4b')](_0x170daa[_0xa345('0x47')],_0x170daa[_0xa345('0x48')]);_0x45baf8[_0xa345('0x4c')]=_['intersection'](_0x170daa[_0xa345('0x47')],qs[_0xa345('0x4d')](_0x445eaa[_0xa345('0x48')]['fields']));_0x45baf8['attributes']=_0x45baf8[_0xa345('0x4c')]['length']?_0x45baf8[_0xa345('0x4c')]:_0x170daa['model'];_0x45baf8[_0xa345('0x50')]=qs[_0xa345('0x51')](_0x445eaa[_0xa345('0x48')][_0xa345('0x51')]);_0x45baf8[_0xa345('0x52')]=qs['filters'](_[_0xa345('0x53')](_0x445eaa[_0xa345('0x48')],_0x170daa[_0xa345('0x4a')]));if(_0x445eaa['query'][_0xa345('0x57')]){_0x45baf8[_0xa345('0x52')]=_[_0xa345('0x54')](_0x45baf8[_0xa345('0x52')],{'$or':_[_0xa345('0x43')](_0x45baf8[_0xa345('0x4c')],function(_0x269e32){var _0x3cb7b1={};_0x3cb7b1[_0x269e32]={'$like':'%'+_0x445eaa['query'][_0xa345('0x57')]+'%'};return _0x3cb7b1;})});}_0x45baf8=_[_0xa345('0x54')]({},_0x45baf8,_0x445eaa['options']);return _0x569a5[_0xa345('0x129')](_0x45baf8);}})[_0xa345('0x24')](function(_0x14c952){if(_0x14c952){_0x494230=_0x14c952[_0xa345('0x4e')];if(!_0x445eaa[_0xa345('0x48')]['hasOwnProperty'](_0xa345('0x4f'))){_0x45baf8[_0xa345('0x35')]=qs[_0xa345('0x35')](_0x445eaa[_0xa345('0x48')][_0xa345('0x35')]);_0x45baf8['offset']=qs['offset'](_0x445eaa['query'][_0xa345('0x33')]);}return _0x569a5[_0xa345('0x129')](_0x45baf8);}})['then'](function(_0x242373){if(_0x242373){return _0x242373?{'count':_0x494230,'rows':_0x242373}:null;}})[_0xa345('0x24')](respondWithResult(_0x50e7ae,null))[_0xa345('0x2e')](handleError(_0x50e7ae,null));};exports[_0xa345('0x12b')]=function(_0x56ec28,_0x23ed8f,_0x5db66b){var _0x4a1a65=_0x56ec28[_0xa345('0x48')]['online']===_0xa345('0x12c')?_0xa345('0x12d'):_0xa345('0x12e');return db[_0xa345('0x44')]['find']({'attributes':['id',_0x4a1a65],'where':{'id':_0x56ec28[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x23ed8f,null))[_0xa345('0x24')](function(_0x18127a){if(_0x18127a){var _0x380ce3=_0x18127a[_0x4a1a65];var _0x2b2c22=_0x380ce3&&_0x380ce3[_0xa345('0x12f')]?_0x380ce3[_0xa345('0x12f')]:[];_0x23ed8f[_0xa345('0x3f')]({'fromKey':_[_0xa345('0x84')](_0x380ce3[_0xa345('0x130')])?undefined:_0x380ce3[_0xa345('0x130')],'count':_0x2b2c22[_0xa345('0x4e')],'rows':_0x2b2c22});}})['catch'](handleError(_0x23ed8f,null));};exports[_0xa345('0x131')]=function(_0x5894a0,_0x48884f,_0xc2f424){var _0x4af854={'raw':![],'where':{}};var _0x427b93={};var _0x56da63={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa345('0x6c')]({'where':{'id':_0x5894a0['params']['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x48884f,null))[_0xa345('0x24')](function(_0x328ac1){if(_0x328ac1){_0x427b93[_0xa345('0x47')]=_[_0xa345('0x49')](db[_0xa345('0xde')][_0xa345('0x45')]);_0x427b93[_0xa345('0x48')]=_[_0xa345('0x49')](_0x5894a0[_0xa345('0x48')]);_0x427b93[_0xa345('0x4a')]=_[_0xa345('0x4b')](_0x427b93[_0xa345('0x47')],_0x427b93[_0xa345('0x48')]);_0x4af854[_0xa345('0x4c')]=_[_0xa345('0x4b')](_0x427b93[_0xa345('0x47')],qs['fields'](_0x5894a0['query']['fields']));_0x4af854['attributes']=_0x4af854[_0xa345('0x4c')][_0xa345('0x4e')]?_0x4af854[_0xa345('0x4c')]:_0x427b93['model'];if(!_0x5894a0[_0xa345('0x48')][_0xa345('0x73')](_0xa345('0x4f'))){_0x4af854[_0xa345('0x35')]=qs['limit'](_0x5894a0[_0xa345('0x48')]['limit']);_0x4af854['offset']=qs['offset'](_0x5894a0['query']['offset']);}_0x4af854[_0xa345('0x50')]=qs['sort'](_0x5894a0[_0xa345('0x48')][_0xa345('0x51')]);_0x4af854['where']=qs['filters'](_[_0xa345('0x53')](_0x5894a0[_0xa345('0x48')],_0x427b93[_0xa345('0x4a')]));_0x4af854[_0xa345('0x52')][_0xa345('0x6a')]=_0x328ac1['id'];if(_0x5894a0[_0xa345('0x48')]['filter']){_0x4af854[_0xa345('0x52')]=_['merge'](_0x4af854['where'],{'$or':_[_0xa345('0x43')](_0x4af854['attributes'],function(_0x9fe130){var _0x15166e={};_0x15166e[_0x9fe130]={'$like':'%'+_0x5894a0[_0xa345('0x48')][_0xa345('0x57')]+'%'};return _0x15166e;})});}_0x4af854=_[_0xa345('0x54')]({},_0x4af854,_0x5894a0[_0xa345('0x58')]);return db[_0xa345('0xde')][_0xa345('0x36')]({'where':_0x4af854[_0xa345('0x52')]})[_0xa345('0x24')](function(_0x3f9a8){_0x56da63[_0xa345('0x36')]=_0x3f9a8;if(_0x5894a0[_0xa345('0x48')][_0xa345('0x59')]){_0x4af854[_0xa345('0x5a')]=[{'all':!![]}];}else{_0x4af854[_0xa345('0x5a')]=[{'model':db[_0xa345('0x95')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0xa345('0x132'),'required':![]}];}return db[_0xa345('0xde')][_0xa345('0x74')](_0x4af854);})['then'](function(_0x18cd11){_0x56da63[_0xa345('0x5b')]=_0x18cd11;return _0x56da63;});}})[_0xa345('0x24')](respondWithFilteredResult(_0x48884f,_0x4af854))[_0xa345('0x2e')](handleError(_0x48884f,null));};exports[_0xa345('0x133')]=function(_0x5c46fd,_0x5a2585,_0x336789){return db[_0xa345('0x44')][_0xa345('0x5d')]({'where':{'id':_0x5c46fd[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x5a2585,null))['then'](function(_0x490752){if(_0x490752){return _0x490752[_0xa345('0x133')](_0x5c46fd['body']['ids'],_[_0xa345('0xff')](_0x5c46fd[_0xa345('0x5f')],[_0xa345('0x6f'),'id'])||{})[_0xa345('0xbf')](function(_0x430b84){for(var _0x446cf0=0x0;_0x446cf0<_0x5c46fd[_0xa345('0x5f')]['ids'][_0xa345('0x4e')];_0x446cf0+=0x1){socket[_0xa345('0x134')]('userChatWebsite:save',{'UserId':_0x5c46fd[_0xa345('0x5f')][_0xa345('0x6f')][_0x446cf0],'ChatWebsiteId':_0x5c46fd[_0xa345('0x5c')]['id']});}return _0x430b84;});}})[_0xa345('0x24')](respondWithResult(_0x5a2585,null))[_0xa345('0x2e')](handleError(_0x5a2585,null));};exports['removeAgents']=function(_0x6c790b,_0x51e6ff,_0x14b3ac){return db[_0xa345('0x44')][_0xa345('0x5d')]({'where':{'id':_0x6c790b[_0xa345('0x5c')]['id']}})[_0xa345('0x24')](handleEntityNotFound(_0x51e6ff,null))[_0xa345('0x24')](function(_0x4528de){if(_0x4528de){return _0x4528de[_0xa345('0x135')](_0x6c790b['query'][_0xa345('0x6f')])['then'](function(){if(_[_0xa345('0x136')](_0x6c790b[_0xa345('0x48')][_0xa345('0x6f')])){for(var _0x13106e=0x0;_0x13106e<_0x6c790b[_0xa345('0x48')]['ids'][_0xa345('0x4e')];_0x13106e+=0x1){socket[_0xa345('0x134')](_0xa345('0x137'),{'UserId':Number(_0x6c790b[_0xa345('0x48')]['ids'][_0x13106e]),'ChatWebsiteId':Number(_0x6c790b[_0xa345('0x5c')]['id'])});}}else{socket[_0xa345('0x134')](_0xa345('0x137'),{'UserId':Number(_0x6c790b[_0xa345('0x48')][_0xa345('0x6f')]),'ChatWebsiteId':Number(_0x6c790b[_0xa345('0x5c')]['id'])});}});}})[_0xa345('0x24')](respondWithStatusCode(_0x51e6ff,null))[_0xa345('0x2e')](handleError(_0x51e6ff,null));};exports[_0xa345('0x138')]=function(_0x4ddda2,_0x539a37,_0x16d5a4){var _0x269664={};var _0x494980={};var _0x456ce8;var _0x489446;return db[_0xa345('0x44')][_0xa345('0x6c')]({'where':{'id':_0x4ddda2[_0xa345('0x5c')]['id']}})['then'](handleEntityNotFound(_0x539a37,null))[_0xa345('0x24')](function(_0x7caef0){if(_0x7caef0){_0x456ce8=_0x7caef0;_0x494980[_0xa345('0x47')]=_[_0xa345('0x49')](db['User'][_0xa345('0x45')]);_0x494980[_0xa345('0x48')]=_['keys'](_0x4ddda2[_0xa345('0x48')]);_0x494980[_0xa345('0x4a')]=_['intersection'](_0x494980['model'],_0x494980[_0xa345('0x48')]);_0x269664[_0xa345('0x4c')]=_[_0xa345('0x4b')](_0x494980[_0xa345('0x47')],qs[_0xa345('0x4d')](_0x4ddda2[_0xa345('0x48')][_0xa345('0x4d')]));_0x269664[_0xa345('0x4c')]=_0x269664[_0xa345('0x4c')]['length']?_0x269664['attributes']:_0x494980[_0xa345('0x47')];_0x269664[_0xa345('0x50')]=qs[_0xa345('0x51')](_0x4ddda2[_0xa345('0x48')][_0xa345('0x51')]);_0x269664['where']=qs[_0xa345('0x4a')](_['pick'](_0x4ddda2[_0xa345('0x48')],_0x494980[_0xa345('0x4a')]));if(_0x4ddda2['query'][_0xa345('0x57')]){_0x269664[_0xa345('0x52')]=_['merge'](_0x269664[_0xa345('0x52')],{'$or':_[_0xa345('0x43')](_0x269664['attributes'],function(_0x1dccb0){var _0x1e03b3={};_0x1e03b3[_0x1dccb0]={'$like':'%'+_0x4ddda2['query'][_0xa345('0x57')]+'%'};return _0x1e03b3;})});}_0x269664=_[_0xa345('0x54')]({},_0x269664,_0x4ddda2[_0xa345('0x58')]);return _0x456ce8[_0xa345('0x138')](_0x269664);}})[_0xa345('0x24')](function(_0x25c6a8){if(_0x25c6a8){_0x489446=_0x25c6a8[_0xa345('0x4e')];if(!_0x4ddda2[_0xa345('0x48')][_0xa345('0x73')](_0xa345('0x4f'))){_0x269664[_0xa345('0x35')]=qs[_0xa345('0x35')](_0x4ddda2[_0xa345('0x48')][_0xa345('0x35')]);_0x269664[_0xa345('0x33')]=qs[_0xa345('0x33')](_0x4ddda2[_0xa345('0x48')]['offset']);}return _0x456ce8[_0xa345('0x138')](_0x269664);}})[_0xa345('0x24')](function(_0x222cc2){if(_0x222cc2){return _0x222cc2?{'count':_0x489446,'rows':_0x222cc2}:null;}})[_0xa345('0x24')](respondWithResult(_0x539a37,null))[_0xa345('0x2e')](handleError(_0x539a37,null));}; \ No newline at end of file +var _0x33c6=['transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','toPairsIn','mapValues','subjectOffline','Chat','MailAccountId','NotifyMailAccount','remove','addInteraction','ids','getInteractions','Contact','fullname','Tags','color','tag','getSnippet','timezone','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','virtual','License','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','connection','remoteAddress','verticalAlignment','textColor','color_button','backgroundColor','addApplications','findAndCountAll','getApplications','addProactiveActions','omit','getProactiveActions','getFields','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','end','status','json','undefined','count','offset','Content-Range','apply','reject','save','get','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','params','length','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','server/files/images/logos/default_logo.svg','getLicense','existsSync','root','server/files/images/logos/','join','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','isNil','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','setUA','headers','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','account','applications','orderBy','priority','asc','Applications','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','firstName','messageId','created','push','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0x33c6,0x177));var _0x633c=function(_0x3cb9d5,_0x190b8d){_0x3cb9d5=_0x3cb9d5-0x0;var _0x47133e=_0x33c6[_0x3cb9d5];return _0x47133e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x633c('0x0'));var zipdir=require(_0x633c('0x1'));var jsonpatch=require(_0x633c('0x2'));var rp=require('request-promise');var moment=require(_0x633c('0x3'));var BPromise=require(_0x633c('0x4'));var Mustache=require(_0x633c('0x5'));var util=require(_0x633c('0x6'));var path=require(_0x633c('0x7'));var sox=require(_0x633c('0x8'));var csv=require(_0x633c('0x9'));var ejs=require(_0x633c('0xa'));var fs=require('fs');var fs_extra=require(_0x633c('0xb'));var _=require(_0x633c('0xc'));var squel=require('squel');var crypto=require(_0x633c('0xd'));var jsforce=require(_0x633c('0xe'));var deskjs=require(_0x633c('0xf'));var toCsv=require(_0x633c('0x9'));var querystring=require(_0x633c('0x10'));var Papa=require(_0x633c('0x11'));var Redis=require('ioredis');var authService=require(_0x633c('0x12'));var qs=require(_0x633c('0x13'));var as=require(_0x633c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x633c('0x15'))(_0x633c('0x16'));var utils=require(_0x633c('0x17'));var config=require(_0x633c('0x18'));var licenseUtil=require(_0x633c('0x19'));var db=require(_0x633c('0x1a'))['db'];config['redis']=_[_0x633c('0x1b')](config['redis'],{'host':_0x633c('0x1c'),'port':0x18eb});var socket=require(_0x633c('0x1d'))(new Redis(config['redis']));require(_0x633c('0x1e'))[_0x633c('0x1f')](socket);var jayson=require(_0x633c('0x20'));var client=jayson[_0x633c('0x21')][_0x633c('0x22')]({'port':0x232c});var client9002=jayson[_0x633c('0x21')]['http']({'port':0x232a});var client9003=jayson[_0x633c('0x21')][_0x633c('0x22')]({'port':0x232b});var client9001=jayson[_0x633c('0x21')][_0x633c('0x22')]({'port':0x2329});function respondWithRpcPromise(_0x14f073,_0x11c711,_0x34ea5e,_0x32fdd7){return new BPromise(function(_0x45ad78,_0x452670){var _0x593d8c=_0x32fdd7||client;return _0x593d8c[_0x633c('0x23')](_0x14f073,_0x34ea5e)[_0x633c('0x24')](function(_0x2ebd1d){logger['info'](_0x633c('0x25'),_0x11c711,_0x633c('0x26'));logger[_0x633c('0x27')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x11c711,'request\x20sent',JSON[_0x633c('0x28')](_0x2ebd1d));if(_0x2ebd1d['error']){if(_0x2ebd1d[_0x633c('0x29')]['code']===0x1f4){logger[_0x633c('0x29')](_0x633c('0x25'),_0x11c711,_0x2ebd1d[_0x633c('0x29')][_0x633c('0x2a')]);return _0x452670(_0x2ebd1d[_0x633c('0x29')][_0x633c('0x2a')]);}logger[_0x633c('0x29')]('ChatWebsite,\x20%s,\x20%s',_0x11c711,_0x2ebd1d[_0x633c('0x29')][_0x633c('0x2a')]);return _0x45ad78(_0x2ebd1d[_0x633c('0x29')][_0x633c('0x2a')]);}else{logger[_0x633c('0x2b')](_0x633c('0x25'),_0x11c711,_0x633c('0x26'));_0x45ad78(_0x2ebd1d[_0x633c('0x2c')][_0x633c('0x2a')]);}})[_0x633c('0x2d')](function(_0x3976c9){logger[_0x633c('0x29')](_0x633c('0x25'),_0x11c711,_0x3976c9);_0x452670(_0x3976c9);});});}function respondWithStatusCode(_0x120453,_0x1b5d06){_0x1b5d06=_0x1b5d06||0xcc;return function(_0x513bba){if(_0x513bba){return _0x120453['sendStatus'](_0x1b5d06);}return _0x120453['status'](_0x1b5d06)[_0x633c('0x2e')]();};}function respondWithResult(_0x4fb3d4,_0x1d74f9){_0x1d74f9=_0x1d74f9||0xc8;return function(_0x25c7fe){if(_0x25c7fe){return _0x4fb3d4[_0x633c('0x2f')](_0x1d74f9)[_0x633c('0x30')](_0x25c7fe);}};}function respondWithFilteredResult(_0x1ad2bb,_0x453f74){return function(_0x37ecd3){if(_0x37ecd3){var _0x13fb11=typeof _0x453f74['offset']===_0x633c('0x31')&&typeof _0x453f74['limit']===_0x633c('0x31');var _0x40c09c=_0x37ecd3[_0x633c('0x32')];var _0x3b12b7=_0x13fb11?0x0:_0x453f74[_0x633c('0x33')];var _0x4b70ec=_0x13fb11?_0x37ecd3['count']:_0x453f74['offset']+_0x453f74['limit'];var _0x1b1b29;if(_0x4b70ec>=_0x40c09c){_0x4b70ec=_0x40c09c;_0x1b1b29=0xc8;}else{_0x1b1b29=0xce;}_0x1ad2bb[_0x633c('0x2f')](_0x1b1b29);return _0x1ad2bb['set'](_0x633c('0x34'),_0x3b12b7+'-'+_0x4b70ec+'/'+_0x40c09c)[_0x633c('0x30')](_0x37ecd3);}return null;};}function patchUpdates(_0x137c1d){return function(_0x203d46){try{jsonpatch[_0x633c('0x35')](_0x203d46,_0x137c1d,!![]);}catch(_0x1649ee){return BPromise[_0x633c('0x36')](_0x1649ee);}return _0x203d46[_0x633c('0x37')]();};}function saveUpdates(_0x49041a,_0x564383){return function(_0x2fc3cc){if(_0x2fc3cc){return _0x2fc3cc['update'](_0x49041a)[_0x633c('0x24')](function(_0x5009ab){return _0x5009ab;});}return null;};}function removeEntity(_0x50c672,_0x1d6985){return function(_0xf8b436){if(_0xf8b436){return _0xf8b436['destroy']()[_0x633c('0x24')](function(){var _0x4be4a6=_0xf8b436[_0x633c('0x38')]({'plain':!![]});var _0x3232e9=_0x633c('0x39');return db[_0x633c('0x3a')][_0x633c('0x3b')]({'where':{'type':_0x3232e9,'resourceId':_0x4be4a6['id']}})[_0x633c('0x24')](function(){return _0xf8b436;});})['then'](function(){_0x50c672[_0x633c('0x2f')](0xcc)[_0x633c('0x2e')]();});}};}function handleEntityNotFound(_0x29da1b,_0x1b9731){return function(_0x487cb9){if(!_0x487cb9){_0x29da1b[_0x633c('0x3c')](0x194);}return _0x487cb9;};}function handleError(_0x43fd82,_0x116fdb){_0x116fdb=_0x116fdb||0x1f4;return function(_0x10c3d6){logger[_0x633c('0x29')](_0x10c3d6[_0x633c('0x3d')]);if(_0x10c3d6[_0x633c('0x3e')]){delete _0x10c3d6[_0x633c('0x3e')];}_0x43fd82[_0x633c('0x2f')](_0x116fdb)[_0x633c('0x3f')](_0x10c3d6);};}exports[_0x633c('0x40')]=function(_0x4dd8d7,_0x519568){var _0x2932cd={'include':[{'model':db[_0x633c('0x41')],'as':_0x633c('0x42')}]},_0x1772fc={},_0x46b515={'count':0x0,'rows':[]};var _0x43255a=_[_0x633c('0x43')](db[_0x633c('0x44')][_0x633c('0x45')],function(_0x5327c9){return{'name':_0x5327c9[_0x633c('0x46')],'type':_0x5327c9[_0x633c('0x47')][_0x633c('0x48')]};});_0x1772fc[_0x633c('0x49')]=_[_0x633c('0x43')](_0x43255a,_0x633c('0x3e'));_0x1772fc['query']=_[_0x633c('0x4a')](_0x4dd8d7['query']);_0x1772fc[_0x633c('0x4b')]=_[_0x633c('0x4c')](_0x1772fc[_0x633c('0x49')],_0x1772fc['query']);_0x2932cd[_0x633c('0x4d')]=_[_0x633c('0x4c')](_0x1772fc['model'],qs[_0x633c('0x4e')](_0x4dd8d7[_0x633c('0x4f')][_0x633c('0x4e')]));_0x2932cd[_0x633c('0x4d')]=_0x2932cd[_0x633c('0x4d')]['length']?_0x2932cd[_0x633c('0x4d')]:_0x1772fc[_0x633c('0x49')];if(!_0x4dd8d7[_0x633c('0x4f')][_0x633c('0x50')](_0x633c('0x51'))){_0x2932cd[_0x633c('0x52')]=qs[_0x633c('0x52')](_0x4dd8d7['query'][_0x633c('0x52')]);_0x2932cd['offset']=qs['offset'](_0x4dd8d7[_0x633c('0x4f')][_0x633c('0x33')]);}_0x2932cd[_0x633c('0x53')]=qs['sort'](_0x4dd8d7[_0x633c('0x4f')][_0x633c('0x54')]);_0x2932cd[_0x633c('0x55')]=qs[_0x633c('0x4b')](_[_0x633c('0x56')](_0x4dd8d7[_0x633c('0x4f')],_0x1772fc['filters']),_0x43255a);if(_0x4dd8d7[_0x633c('0x4f')]['filter']){_0x2932cd[_0x633c('0x55')]=_[_0x633c('0x57')](_0x2932cd[_0x633c('0x55')],{'$or':_[_0x633c('0x43')](_0x43255a,function(_0x1b1d12){if(_0x1b1d12[_0x633c('0x47')]!=='VIRTUAL'){var _0x54ded9={};_0x54ded9[_0x1b1d12[_0x633c('0x3e')]]={'$like':'%'+_0x4dd8d7[_0x633c('0x4f')][_0x633c('0x58')]+'%'};return _0x54ded9;}})});}_0x2932cd=_[_0x633c('0x57')]({},_0x2932cd,_0x4dd8d7['options']);var _0x426a40={'where':_0x2932cd[_0x633c('0x55')]};return db[_0x633c('0x44')][_0x633c('0x32')](_0x426a40)[_0x633c('0x24')](function(_0x3d346f){_0x46b515[_0x633c('0x32')]=_0x3d346f;if(_0x4dd8d7[_0x633c('0x4f')][_0x633c('0x59')]){_0x2932cd[_0x633c('0x5a')]=[{'all':!![]}];}return db['ChatWebsite'][_0x633c('0x5b')](_0x2932cd);})['then'](function(_0x44ed8a){_0x46b515[_0x633c('0x5c')]=_0x44ed8a;return _0x46b515;})['then'](respondWithFilteredResult(_0x519568,_0x2932cd))[_0x633c('0x2d')](handleError(_0x519568,null));};exports['show']=function(_0x1b48cf,_0x546a84){var _0xb831cd={'raw':![],'where':{'id':_0x1b48cf[_0x633c('0x5d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xc6d1bf={};_0xc6d1bf['model']=_['keys'](db[_0x633c('0x44')]['rawAttributes']);_0xc6d1bf[_0x633c('0x4f')]=_['keys'](_0x1b48cf[_0x633c('0x4f')]);_0xc6d1bf[_0x633c('0x4b')]=_[_0x633c('0x4c')](_0xc6d1bf[_0x633c('0x49')],_0xc6d1bf[_0x633c('0x4f')]);_0xb831cd[_0x633c('0x4d')]=_[_0x633c('0x4c')](_0xc6d1bf[_0x633c('0x49')],qs[_0x633c('0x4e')](_0x1b48cf[_0x633c('0x4f')]['fields']));_0xb831cd[_0x633c('0x4d')]=_0xb831cd[_0x633c('0x4d')][_0x633c('0x5e')]?_0xb831cd[_0x633c('0x4d')]:_0xc6d1bf[_0x633c('0x49')];if(_0x1b48cf[_0x633c('0x4f')][_0x633c('0x59')]){_0xb831cd[_0x633c('0x5a')]=[{'all':!![]}];}_0xb831cd=_[_0x633c('0x57')]({},_0xb831cd,_0x1b48cf[_0x633c('0x5f')]);return db[_0x633c('0x44')][_0x633c('0x60')](_0xb831cd)[_0x633c('0x24')](handleEntityNotFound(_0x546a84,null))['then'](respondWithResult(_0x546a84,null))['catch'](handleError(_0x546a84,null));};exports[_0x633c('0x61')]=function(_0x557144,_0x833200){return db[_0x633c('0x44')]['create'](_0x557144[_0x633c('0x62')],{})['then'](function(_0x57895f){var _0x20cb23=_0x557144[_0x633c('0x63')][_0x633c('0x38')]({'plain':!![]});if(!_0x20cb23)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20cb23['role']===_0x633c('0x63')){var _0x27c311=_0x57895f[_0x633c('0x38')]({'plain':!![]});var _0x433c10=_0x633c('0x39');return db[_0x633c('0x64')]['find']({'where':{'name':_0x433c10,'userProfileId':_0x20cb23[_0x633c('0x65')]},'raw':!![]})[_0x633c('0x24')](function(_0xd50ae1){if(_0xd50ae1&&_0xd50ae1[_0x633c('0x66')]===0x0){return db[_0x633c('0x3a')][_0x633c('0x61')]({'name':_0x27c311[_0x633c('0x3e')],'resourceId':_0x27c311['id'],'type':_0xd50ae1[_0x633c('0x3e')],'sectionId':_0xd50ae1['id']},{})['then'](function(){return _0x57895f;});}else{return _0x57895f;}})[_0x633c('0x2d')](function(_0x43fa54){logger[_0x633c('0x29')](_0x633c('0x67'),_0x43fa54);throw _0x43fa54;});}return _0x57895f;})[_0x633c('0x24')](respondWithResult(_0x833200,0xc9))[_0x633c('0x2d')](handleError(_0x833200,null));};exports['update']=function(_0x47695e,_0x37fca1){if(_0x47695e[_0x633c('0x62')]['id']){delete _0x47695e[_0x633c('0x62')]['id'];}return db[_0x633c('0x44')][_0x633c('0x60')]({'where':{'id':_0x47695e['params']['id']},'include':[{'model':db['Pause'],'as':_0x633c('0x42')}]})[_0x633c('0x24')](handleEntityNotFound(_0x37fca1,null))['then'](saveUpdates(_0x47695e[_0x633c('0x62')],null))[_0x633c('0x24')](respondWithResult(_0x37fca1,null))[_0x633c('0x2d')](handleError(_0x37fca1,null));};exports[_0x633c('0x3b')]=function(_0x4a140a,_0x475306){return db[_0x633c('0x44')][_0x633c('0x60')]({'where':{'id':_0x4a140a[_0x633c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x475306,null))['then'](removeEntity(_0x475306,null))[_0x633c('0x2d')](handleError(_0x475306,null));};exports[_0x633c('0x68')]=function(_0x36cabd,_0x29f0da){return db[_0x633c('0x44')]['describe']()[_0x633c('0x24')](respondWithResult(_0x29f0da,null))[_0x633c('0x2d')](handleError(_0x29f0da,null));};exports['addDisposition']=function(_0x5f45cc,_0x35f0fe,_0x58627f){if(_0x5f45cc[_0x633c('0x62')]['id']){delete _0x5f45cc[_0x633c('0x62')]['id'];}return db['ChatWebsite'][_0x633c('0x60')]({'where':{'id':_0x5f45cc[_0x633c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x35f0fe,null))[_0x633c('0x24')](function(_0x563c64){if(_0x563c64){_0x5f45cc['body'][_0x633c('0x69')]=_0x563c64['id'];return db[_0x633c('0x6a')]['create'](_0x5f45cc['body']);}})[_0x633c('0x24')](respondWithResult(_0x35f0fe,null))['catch'](handleError(_0x35f0fe,null));};exports[_0x633c('0x6b')]=function(_0x51e855,_0x53e76f,_0x5dc958){var _0x252cf9={'raw':![],'where':{}};var _0x16b159={};var _0x488673={'count':0x0,'rows':[]};return db[_0x633c('0x44')][_0x633c('0x6c')]({'where':{'id':_0x51e855['params']['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x53e76f,null))['then'](function(_0x25de87){if(_0x25de87){_0x16b159[_0x633c('0x49')]=_['keys'](db[_0x633c('0x6a')]['rawAttributes']);_0x16b159[_0x633c('0x4f')]=_[_0x633c('0x4a')](_0x51e855['query']);_0x16b159['filters']=_[_0x633c('0x4c')](_0x16b159[_0x633c('0x49')],_0x16b159[_0x633c('0x4f')]);_0x252cf9[_0x633c('0x4d')]=_['intersection'](_0x16b159['model'],qs[_0x633c('0x4e')](_0x51e855[_0x633c('0x4f')][_0x633c('0x4e')]));_0x252cf9[_0x633c('0x4d')]=_0x252cf9[_0x633c('0x4d')][_0x633c('0x5e')]?_0x252cf9[_0x633c('0x4d')]:_0x16b159[_0x633c('0x49')];if(!_0x51e855['query']['hasOwnProperty']('nolimit')){_0x252cf9['limit']=qs['limit'](_0x51e855[_0x633c('0x4f')][_0x633c('0x52')]);_0x252cf9[_0x633c('0x33')]=qs['offset'](_0x51e855[_0x633c('0x4f')][_0x633c('0x33')]);}_0x252cf9['order']=qs[_0x633c('0x54')](_0x51e855[_0x633c('0x4f')][_0x633c('0x54')]);_0x252cf9[_0x633c('0x55')]=qs[_0x633c('0x4b')](_[_0x633c('0x56')](_0x51e855['query'],_0x16b159['filters']));_0x252cf9[_0x633c('0x55')][_0x633c('0x69')]=_0x25de87['id'];if(_0x51e855[_0x633c('0x4f')][_0x633c('0x58')]){_0x252cf9[_0x633c('0x55')]=_[_0x633c('0x57')](_0x252cf9[_0x633c('0x55')],{'$or':_['map'](_0x252cf9['attributes'],function(_0x3e3b40){var _0x4f9be1={};_0x4f9be1[_0x3e3b40]={'$like':'%'+_0x51e855[_0x633c('0x4f')]['filter']+'%'};return _0x4f9be1;})});}_0x252cf9=_[_0x633c('0x57')]({},_0x252cf9,_0x51e855[_0x633c('0x5f')]);return db[_0x633c('0x6a')][_0x633c('0x32')]({'where':_0x252cf9[_0x633c('0x55')]})[_0x633c('0x24')](function(_0x44d122){_0x488673[_0x633c('0x32')]=_0x44d122;if(_0x51e855[_0x633c('0x4f')][_0x633c('0x59')]){_0x252cf9[_0x633c('0x5a')]=[{'all':!![]}];}return db[_0x633c('0x6a')][_0x633c('0x5b')](_0x252cf9);})[_0x633c('0x24')](function(_0x52a6e9){_0x488673[_0x633c('0x5c')]=_0x52a6e9;return _0x488673;});}})[_0x633c('0x24')](respondWithFilteredResult(_0x53e76f,_0x252cf9))[_0x633c('0x2d')](handleError(_0x53e76f,null));};exports[_0x633c('0x6d')]=function(_0x1a0f82,_0x370fbe,_0x1a9616){return db[_0x633c('0x44')][_0x633c('0x60')]({'where':{'id':_0x1a0f82[_0x633c('0x5d')]['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x370fbe,null))[_0x633c('0x24')](function(_0x5b27e9){if(_0x5b27e9){return _0x5b27e9[_0x633c('0x6d')](_0x1a0f82['query']['ids']);}})[_0x633c('0x24')](respondWithStatusCode(_0x370fbe,null))[_0x633c('0x2d')](handleError(_0x370fbe,null));};exports[_0x633c('0x6e')]=function(_0x52c7d2,_0x395be6,_0x556545){if(_0x52c7d2[_0x633c('0x62')]['id']){delete _0x52c7d2[_0x633c('0x62')]['id'];}return db[_0x633c('0x44')][_0x633c('0x60')]({'where':{'id':_0x52c7d2[_0x633c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x395be6,null))[_0x633c('0x24')](function(_0x891e19){if(_0x891e19){_0x52c7d2[_0x633c('0x62')][_0x633c('0x69')]=_0x891e19['id'];return db[_0x633c('0x6f')][_0x633c('0x61')](_0x52c7d2[_0x633c('0x62')]);}})['then'](respondWithResult(_0x395be6,null))[_0x633c('0x2d')](handleError(_0x395be6,null));};exports[_0x633c('0x70')]=function(_0x5aeb48,_0x5e1ec3,_0x5d2ea8){var _0x4c321f={'raw':![],'where':{}};var _0x23a8e6={};var _0x476095={'count':0x0,'rows':[]};return db[_0x633c('0x44')][_0x633c('0x6c')]({'where':{'id':_0x5aeb48['params']['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x5e1ec3,null))['then'](function(_0x46398e){if(_0x46398e){_0x23a8e6[_0x633c('0x49')]=_[_0x633c('0x4a')](db[_0x633c('0x6f')][_0x633c('0x45')]);_0x23a8e6['query']=_[_0x633c('0x4a')](_0x5aeb48['query']);_0x23a8e6[_0x633c('0x4b')]=_[_0x633c('0x4c')](_0x23a8e6[_0x633c('0x49')],_0x23a8e6[_0x633c('0x4f')]);_0x4c321f[_0x633c('0x4d')]=_[_0x633c('0x4c')](_0x23a8e6[_0x633c('0x49')],qs[_0x633c('0x4e')](_0x5aeb48[_0x633c('0x4f')][_0x633c('0x4e')]));_0x4c321f[_0x633c('0x4d')]=_0x4c321f['attributes'][_0x633c('0x5e')]?_0x4c321f[_0x633c('0x4d')]:_0x23a8e6[_0x633c('0x49')];if(!_0x5aeb48[_0x633c('0x4f')][_0x633c('0x50')](_0x633c('0x51'))){_0x4c321f[_0x633c('0x52')]=qs['limit'](_0x5aeb48[_0x633c('0x4f')][_0x633c('0x52')]);_0x4c321f[_0x633c('0x33')]=qs[_0x633c('0x33')](_0x5aeb48['query'][_0x633c('0x33')]);}_0x4c321f[_0x633c('0x53')]=qs[_0x633c('0x54')](_0x5aeb48['query'][_0x633c('0x54')]);_0x4c321f[_0x633c('0x55')]=qs['filters'](_[_0x633c('0x56')](_0x5aeb48[_0x633c('0x4f')],_0x23a8e6[_0x633c('0x4b')]));_0x4c321f[_0x633c('0x55')][_0x633c('0x69')]=_0x46398e['id'];if(_0x5aeb48['query'][_0x633c('0x58')]){_0x4c321f['where']=_[_0x633c('0x57')](_0x4c321f['where'],{'$or':_['map'](_0x4c321f[_0x633c('0x4d')],function(_0x3c6422){var _0x4037ce={};_0x4037ce[_0x3c6422]={'$like':'%'+_0x5aeb48['query'][_0x633c('0x58')]+'%'};return _0x4037ce;})});}_0x4c321f=_[_0x633c('0x57')]({},_0x4c321f,_0x5aeb48[_0x633c('0x5f')]);return db['CannedAnswer']['count']({'where':_0x4c321f['where']})[_0x633c('0x24')](function(_0x568a24){_0x476095['count']=_0x568a24;if(_0x5aeb48[_0x633c('0x4f')][_0x633c('0x59')]){_0x4c321f[_0x633c('0x5a')]=[{'all':!![]}];}return db[_0x633c('0x6f')][_0x633c('0x5b')](_0x4c321f);})[_0x633c('0x24')](function(_0xad02c2){_0x476095[_0x633c('0x5c')]=_0xad02c2;return _0x476095;});}})[_0x633c('0x24')](respondWithFilteredResult(_0x5e1ec3,_0x4c321f))[_0x633c('0x2d')](handleError(_0x5e1ec3,null));};exports[_0x633c('0x71')]=function(_0x425e6b,_0x51cb56,_0x1309a2){return db['ChatWebsite']['find']({'where':{'id':_0x425e6b['params']['id']}})['then'](handleEntityNotFound(_0x51cb56,null))[_0x633c('0x24')](function(_0x175abe){if(_0x175abe){return _0x175abe[_0x633c('0x71')](_0x425e6b[_0x633c('0x4f')]['ids']);}})[_0x633c('0x24')](respondWithStatusCode(_0x51cb56,null))[_0x633c('0x2d')](handleError(_0x51cb56,null));};exports[_0x633c('0x72')]=function(_0x13d731,_0x44b5d5,_0x506564){_0x13d731['body'][_0x633c('0x73')]=_0x13d731[_0x633c('0x74')]['filename'];return db[_0x633c('0x44')][_0x633c('0x60')]({'where':{'id':_0x13d731['params']['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x44b5d5,null))[_0x633c('0x24')](saveUpdates(_0x13d731[_0x633c('0x62')],null))[_0x633c('0x24')](respondWithResult(_0x44b5d5,null))['catch'](handleError(_0x44b5d5,null));};exports['addAvatar']=function(_0x167a66,_0x517a95,_0x5c8a6a){_0x167a66[_0x633c('0x62')]['agentAvatar']=_0x167a66[_0x633c('0x74')][_0x633c('0x75')];return db[_0x633c('0x44')][_0x633c('0x60')]({'where':{'id':_0x167a66[_0x633c('0x5d')]['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x517a95,null))['then'](saveUpdates(_0x167a66[_0x633c('0x62')],null))[_0x633c('0x24')](respondWithResult(_0x517a95,null))['catch'](handleError(_0x517a95,null));};exports[_0x633c('0x76')]=function(_0x1d4179,_0x5912f6,_0x302559){_0x1d4179[_0x633c('0x62')][_0x633c('0x77')]=_0x1d4179[_0x633c('0x74')][_0x633c('0x75')];return db[_0x633c('0x44')][_0x633c('0x60')]({'where':{'id':_0x1d4179['params']['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x5912f6,null))[_0x633c('0x24')](saveUpdates(_0x1d4179[_0x633c('0x62')],null))[_0x633c('0x24')](respondWithResult(_0x5912f6,null))[_0x633c('0x2d')](handleError(_0x5912f6,null));};exports[_0x633c('0x78')]=function(_0x1dc2d8,_0x595921,_0x2ef881){_0x1dc2d8[_0x633c('0x62')]['systemAvatar']=_0x1dc2d8[_0x633c('0x74')][_0x633c('0x75')];return db[_0x633c('0x44')][_0x633c('0x60')]({'where':{'id':_0x1dc2d8[_0x633c('0x5d')]['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x595921,null))[_0x633c('0x24')](saveUpdates(_0x1dc2d8[_0x633c('0x62')],null))[_0x633c('0x24')](respondWithResult(_0x595921,null))[_0x633c('0x2d')](handleError(_0x595921,null));};exports[_0x633c('0x79')]=function(_0x1bb6a9,_0x4be82f,_0x1d8983){var _0x4492be=path['join'](config['root'],_0x633c('0x7a'));var _0x213f28={'where':{'id':_0x1bb6a9[_0x633c('0x5d')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x21e222=![];return require(_0x633c('0x19'))[_0x633c('0x7b')]()[_0x633c('0x24')](function(_0x4fd200){if(_0x4fd200){_0x21e222=_0x4fd200['custom'];}})['then'](function(){return db[_0x633c('0x44')]['find'](_0x213f28);})['then'](handleEntityNotFound(_0x4be82f,null))[_0x633c('0x24')](function(_0x5de997){if(_0x5de997){if(!_['isNil'](_0x5de997[_0x633c('0x73')])){if(fs[_0x633c('0x7c')](path['join'](config[_0x633c('0x7d')],_0x633c('0x7e'),_0x5de997[_0x633c('0x73')]))&&_0x21e222){_0x4492be=path[_0x633c('0x7f')](config[_0x633c('0x7d')],_0x633c('0x7e'),_0x5de997[_0x633c('0x73')]);}}return _0x4be82f[_0x633c('0x80')](_0x4492be);}})[_0x633c('0x2d')](handleError(_0x4be82f,null));};exports[_0x633c('0x81')]=function(_0x40ab41,_0x572630,_0x1988be){var _0x452a9b=path[_0x633c('0x7f')](config[_0x633c('0x7d')],_0x633c('0x82'));var _0x5b1e97={'where':{'id':_0x40ab41[_0x633c('0x5d')]['id']},'attributes':['id',_0x633c('0x83')],'raw':!![]};return db['ChatWebsite'][_0x633c('0x60')](_0x5b1e97)[_0x633c('0x24')](handleEntityNotFound(_0x572630,null))[_0x633c('0x24')](function(_0xd40b65){if(_0xd40b65){if(!_[_0x633c('0x84')](_0xd40b65[_0x633c('0x83')])){if(fs['existsSync'](path['join'](config[_0x633c('0x7d')],'server/files/images/avatars/',_0xd40b65[_0x633c('0x83')]))){_0x452a9b=path[_0x633c('0x7f')](config[_0x633c('0x7d')],_0x633c('0x85'),_0xd40b65['agentAvatar']);}}return _0x572630['download'](_0x452a9b);}})[_0x633c('0x2d')](handleError(_0x572630,null));};exports[_0x633c('0x86')]=function(_0xc0cc2c,_0x420a37,_0x45d56b){var _0x125cfd=path['join'](config[_0x633c('0x7d')],'server/files/images/avatars/customer_avatar.png');var _0x22bf8a={'where':{'id':_0xc0cc2c['params']['id']},'attributes':['id','customerAvatar',_0x633c('0x87')],'raw':!![]};return db[_0x633c('0x44')][_0x633c('0x60')](_0x22bf8a)[_0x633c('0x24')](handleEntityNotFound(_0x420a37,null))[_0x633c('0x24')](function(_0x440d11){if(_0x440d11){if(!_[_0x633c('0x84')](_0x440d11['customerAvatar'])){if(fs[_0x633c('0x7c')](path[_0x633c('0x7f')](config['root'],_0x633c('0x85'),_0x440d11[_0x633c('0x77')]))&&_0x440d11['showCustomerAvatar']){_0x125cfd=path[_0x633c('0x7f')](config['root'],_0x633c('0x85'),_0x440d11['customerAvatar']);}}return _0x420a37[_0x633c('0x80')](_0x125cfd);}})['catch'](handleError(_0x420a37,null));};exports[_0x633c('0x88')]=function(_0x110981,_0x54ff62,_0x39fc7d){var _0x5c826b=path[_0x633c('0x7f')](config[_0x633c('0x7d')],_0x633c('0x89'));var _0x2ecf73={'where':{'id':_0x110981[_0x633c('0x5d')]['id']},'attributes':['id',_0x633c('0x8a')],'raw':!![]};return db[_0x633c('0x44')]['find'](_0x2ecf73)['then'](handleEntityNotFound(_0x54ff62,null))[_0x633c('0x24')](function(_0x421723){if(_0x421723){if(!_['isNil'](_0x421723[_0x633c('0x8a')])){if(fs[_0x633c('0x7c')](path[_0x633c('0x7f')](config[_0x633c('0x7d')],_0x633c('0x85'),_0x421723['systemAvatar']))){_0x5c826b=path['join'](config[_0x633c('0x7d')],'server/files/images/avatars/',_0x421723['systemAvatar']);}}return _0x54ff62[_0x633c('0x80')](_0x5c826b);}})[_0x633c('0x2d')](handleError(_0x54ff62,null));};exports[_0x633c('0x8b')]=function(_0x55d3e4,_0x1024a2,_0x1ec0b8){var _0x5f1c59=require('user-agent-parser');var _0x591458=new _0x5f1c59();var _0x39660c=_0x591458[_0x633c('0x8c')](_0x55d3e4[_0x633c('0x8d')]['user-agent'])[_0x633c('0x8e')]();var _0x467762={'body':_0x55d3e4[_0x633c('0x62')],'channel':'chat'};var _0x4c1ef5=[];var _0x2f2c40=[];var _0xa81178={};var _0x3f7ded=![];return db[_0x633c('0x8f')]['describe']()['then'](function(_0x42b9f8){if(!_0x42b9f8){throw new db[(_0x633c('0x90'))][(_0x633c('0x91'))](_0x633c('0x92'));}_0x4c1ef5=_[_0x633c('0x93')](_[_0x633c('0x4a')](_0x42b9f8),[_0x633c('0x94'),_0x633c('0x95')]);_0x2f2c40=_[_0x633c('0x93')](_[_0x633c('0x4a')](_0x42b9f8),[_0x633c('0x94'),'updatedAt',_0x633c('0x96'),_0x633c('0x97')]);if(_0x55d3e4['body']['id']){delete _0x55d3e4[_0x633c('0x62')]['id'];}if(_[_0x633c('0x84')](_0x55d3e4[_0x633c('0x62')][_0x633c('0x98')])){throw new db['Sequelize'][(_0x633c('0x91'))](_0x633c('0x99'));}if(_[_0x633c('0x84')](_0x55d3e4['body'][_0x633c('0x62')])||_0x55d3e4[_0x633c('0x62')]['body']===''){throw new db[(_0x633c('0x90'))][(_0x633c('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x633c('0x84')](_0x55d3e4[_0x633c('0x62')][_0x633c('0x9a')])){throw new db['Sequelize'][(_0x633c('0x91'))](_0x633c('0x9b')+_0x2f2c40);}if(!_[_0x633c('0x9c')](_0x2f2c40,_0x55d3e4['body'][_0x633c('0x9a')])){throw new db[(_0x633c('0x90'))]['ValidationError'](_0x633c('0x9d')+_0x2f2c40);}_0xa81178[_0x55d3e4['body']['mapKey']]=_0x55d3e4[_0x633c('0x62')]['from'];})[_0x633c('0x24')](function(){return db[_0x633c('0x44')][_0x633c('0x60')]({'where':{'id':_0x55d3e4['params']['id']},'include':[{'model':db[_0x633c('0x9e')],'as':_0x633c('0x9f'),'include':[{'model':db[_0x633c('0x8f')],'as':'Contacts','where':_0xa81178,'limit':0x1,'order':[[_0x633c('0x95'),_0x633c('0xa0')]]}]},{'model':db[_0x633c('0xa1')],'as':'Applications'}]});})[_0x633c('0x24')](handleEntityNotFound(_0x1024a2,null))['then'](function(_0x53cad0){if(_0x53cad0&&_0x53cad0[_0x633c('0x9f')]){_0x467762[_0x633c('0xa2')]=_0x53cad0;_0x467762[_0x633c('0xa3')]=_0x53cad0['Applications'];_0x467762['list']=_0x53cad0[_0x633c('0x9f')];_0x467762[_0x633c('0xa3')]=_[_0x633c('0xa4')](_0x467762[_0x633c('0xa3')],[_0x633c('0xa5')],[_0x633c('0xa6')]);if(_0x467762[_0x633c('0xa2')]['Applications']){delete _0x467762['account'][_0x633c('0xa7')];}if(_0x467762['account'][_0x633c('0x9f')]&&_0x467762[_0x633c('0xa2')]['List'][_0x633c('0xa8')][_0x633c('0x5e')]){return _0x467762[_0x633c('0xa2')][_0x633c('0x9f')][_0x633c('0xa8')][0x0];}var _0x1b9e29=_[_0x633c('0x1b')](_0x55d3e4[_0x633c('0x62')],{'firstName':_0x55d3e4[_0x633c('0x62')]['from'],'ListId':_0x53cad0[_0x633c('0x97')]});_0x1b9e29[_0x55d3e4[_0x633c('0x62')][_0x633c('0x9a')]]=_0x55d3e4[_0x633c('0x62')][_0x633c('0x98')];return db[_0x633c('0x8f')]['create'](_0x1b9e29,{'fields':_0x4c1ef5,'raw':!![]});}})['then'](handleEntityNotFound(_0x1024a2,null))['then'](function(_0x3abb42){_0x467762[_0x633c('0xa9')]=_0x3abb42;var _0x59ead8=_0x55d3e4[_0x633c('0x62')][_0x633c('0xaa')];if(_0x55d3e4[_0x633c('0x8d')][_0x633c('0xab')]){_0x59ead8=_0x55d3e4[_0x633c('0x8d')]['cf-connecting-ip'];}else if(_0x55d3e4['headers'][_0x633c('0xac')]){_0x59ead8=_[_0x633c('0xad')](_0x55d3e4[_0x633c('0x8d')][_0x633c('0xac')]['split'](','));}if(_0x3abb42){var _0x39e50d={'ContactId':_0x3abb42['id'],'ChatWebsiteId':_0x55d3e4[_0x633c('0x5d')]['id'],'from':(_0x3abb42['firstName']||'')+'\x20'+(_0x3abb42[_0x633c('0xae')]||''),'customerIp':_0x59ead8,'customerPort':_0x55d3e4['headers'][_0x633c('0xaf')]?_0x55d3e4['headers'][_0x633c('0xaf')]:null,'referer':_0x55d3e4['body'][_0x633c('0xb0')],'browserName':_0x39660c[_0x633c('0xb1')][_0x633c('0x3e')]&&_0x39660c[_0x633c('0xb1')][_0x633c('0xb2')]?util['format'](_0x633c('0xb3'),_0x39660c[_0x633c('0xb1')][_0x633c('0x3e')],_0x39660c[_0x633c('0xb1')][_0x633c('0xb2')]):'unknown','browserVersion':_0x39660c['browser'][_0x633c('0xb2')]||_0x633c('0xb4'),'osName':util[_0x633c('0xb5')](_0x633c('0xb3'),_0x39660c['os'][_0x633c('0x3e')],_0x39660c['os'][_0x633c('0xb2')]),'osVersion':_0x39660c['os']['version'],'deviceModel':_0x39660c[_0x633c('0xb6')][_0x633c('0x49')]&&_0x39660c[_0x633c('0xb6')][_0x633c('0xb7')]?util['format']('%s\x20%s\x20%s',_0x39660c[_0x633c('0xb6')][_0x633c('0x49')],_0x39660c[_0x633c('0xb6')]['vendor'],_0x39660c[_0x633c('0xb6')]['type']):null,'deviceVendor':_0x39660c[_0x633c('0xb6')]['vendor'],'deviceType':_0x39660c[_0x633c('0xb6')][_0x633c('0x47')],'formData':JSON[_0x633c('0x28')](_0x55d3e4[_0x633c('0x62')])};var _0x3a85fb={'ChatWebsiteId':_0x55d3e4['params']['id'],'closed':![]};if(_0x55d3e4['body']['threadId']){_0x3a85fb['threadId']=_0x55d3e4['body'][_0x633c('0xb8')];return db[_0x633c('0xb9')]['find']({'where':_0x3a85fb})[_0x633c('0x24')](function(_0x422174){if(_0x422174){return[_0x422174,![]];}_0x39e50d[_0x633c('0xb8')]=_0x55d3e4[_0x633c('0x62')][_0x633c('0xb8')];_0x39e50d['externalUrl']=_0x55d3e4[_0x633c('0x62')][_0x633c('0xba')];return db[_0x633c('0xb9')][_0x633c('0x61')](_0x39e50d)['then'](function(_0x33c2f1){return[_0x33c2f1,!![]];});});}_0x3a85fb['ContactId']=_0x3abb42['id'];if(_0x55d3e4[_0x633c('0x62')][_0x633c('0xbb')]&&_0x55d3e4[_0x633c('0x62')][_0x633c('0xbb')]['id']){_0x3a85fb['id']=_0x55d3e4[_0x633c('0x62')][_0x633c('0xbb')]['id'];return db[_0x633c('0xb9')][_0x633c('0x60')]({'where':_0x3a85fb})[_0x633c('0x24')](function(_0x3b4421){if(_0x3b4421){return[_0x3b4421,![]];}return db['ChatInteraction'][_0x633c('0x61')](_0x39e50d)[_0x633c('0x24')](function(_0x3870ad){return[_0x3870ad,!![]];});});}return db['ChatInteraction']['create'](_0x39e50d)[_0x633c('0x24')](function(_0xee94fc){return[_0xee94fc,!![]];});}})[_0x633c('0xbc')](function(_0xcb4e26,_0x1bb955){if(_0xcb4e26){_0x3f7ded=_0x1bb955;if(!_0x1bb955){var _0x29a0bd={'from':(_0x467762[_0x633c('0xa9')][_0x633c('0xbd')]||'')+'\x20'+(_0x467762['contact']['lastName']||'')};if(_0x55d3e4['body']['threadId']&&_0x55d3e4[_0x633c('0x62')]['messageId']&&_0x55d3e4['body'][_0x633c('0xb8')]!=_0x55d3e4[_0x633c('0x62')][_0x633c('0xbe')]){_0x29a0bd[_0x633c('0xb8')]=_0x55d3e4[_0x633c('0x62')][_0x633c('0xbe')];}return _0xcb4e26['update'](_0x29a0bd);}else{return _0xcb4e26;}}})[_0x633c('0x24')](function(_0x2c66a){_0x467762[_0x633c('0xbb')]=_0x2c66a[_0x633c('0x38')]({'plain':!![]});_0x467762[_0x633c('0xbb')][_0x633c('0xbf')]=_0x3f7ded;if(_0x467762['interaction'][_0x633c('0xbf')]){if(_0x467762[_0x633c('0xa2')]['autoclose']){_0x467762[_0x633c('0xa3')][_0x633c('0xc0')]({'id':0x0,'priority':_0x467762['applications'][_0x633c('0x5e')]+0x1,'app':'close','appdata':_0x633c('0xc1'),'interval':_0x633c('0xc2')});}}return db['ChatMessage'][_0x633c('0x61')]({'body':_0x55d3e4[_0x633c('0x62')][_0x633c('0x62')],'ChatWebsiteId':_0x55d3e4[_0x633c('0x5d')]['id'],'ChatInteractionId':_0x2c66a['id'],'direction':'in','ContactId':_0x467762[_0x633c('0xa9')]['id'],'AttachmentId':_0x55d3e4[_0x633c('0x62')][_0x633c('0xc3')]});})['then'](function(_0x51030e){_0x467762[_0x633c('0x2a')]=_0x51030e;if(_0x467762[_0x633c('0xbb')][_0x633c('0xc4')]){return db[_0x633c('0xc5')]['find']({'attributes':['id',_0x633c('0x3e')],'where':{'id':_0x467762[_0x633c('0xbb')][_0x633c('0xc4')]}})[_0x633c('0x24')](function(_0x584f02){if(_0x584f02){_0x467762[_0x633c('0xa3')][_0x633c('0xc6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x584f02[_0x633c('0x3e')]+','+(_0x467762[_0x633c('0xa2')][_0x633c('0xc7')]||0xa),'interval':_0x633c('0xc2')});_0x467762[_0x633c('0xc8')]=!![];}return respondWithRpcPromise('Start',_0x633c('0xc9'),_0x467762);});}return respondWithRpcPromise(_0x633c('0xca'),'startRouting',_0x467762);})['then'](function(_0x45c1b7){respondWithRpcPromise(_0x633c('0xcb'),_0x633c('0xcb'),{'event':'notify','message':_0x45c1b7},client9002);return _0x45c1b7;})[_0x633c('0x24')](respondWithResult(_0x1024a2,null))['catch'](handleError(_0x1024a2,null));};exports[_0x633c('0xcc')]=function(_0x173be2,_0x2f26b4,_0xecf41e){var _0x23c0a9,_0x3bbc34,_0x191e7c;var _0x109225=[];var _0x28a8c6=[];var _0x57a34b={};var _0x1e5f66=_0x173be2[_0x633c('0xcd')]||[];var _0x493cf8=[];var _0x4487c7;return db[_0x633c('0x8f')][_0x633c('0x68')]()[_0x633c('0x24')](function(_0x58ff13){if(!_0x58ff13){throw new db['Sequelize'][(_0x633c('0x91'))](_0x633c('0x92'));}_0x28a8c6=_[_0x633c('0x93')](_[_0x633c('0x4a')](_0x58ff13),[_0x633c('0x94'),_0x633c('0x95')]);_0x109225=_[_0x633c('0x93')](_['keys'](_0x58ff13),['createdAt',_0x633c('0x95'),_0x633c('0x96'),_0x633c('0x97')]);if(_0x173be2[_0x633c('0x62')]['id']){delete _0x173be2[_0x633c('0x62')]['id'];}if(_['isNil'](_0x173be2[_0x633c('0x62')]['from'])){throw _0x2f26b4[_0x633c('0x2f')](0x1f4)[_0x633c('0x3f')](new db[(_0x633c('0x90'))][(_0x633c('0x91'))](_0x633c('0x99')));}if(_[_0x633c('0x84')](_0x173be2[_0x633c('0x62')][_0x633c('0x62')])||_0x173be2[_0x633c('0x62')][_0x633c('0x62')]===''){throw _0x2f26b4[_0x633c('0x2f')](0x1f4)[_0x633c('0x3f')](new db[(_0x633c('0x90'))][(_0x633c('0x91'))](_0x633c('0xce')));}if(_['isNil'](_0x173be2[_0x633c('0x62')][_0x633c('0xcf')])){throw _0x2f26b4[_0x633c('0x2f')](0x1f4)['send'](new db[(_0x633c('0x90'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x109225));}if(!_['includes'](_0x109225,_0x173be2[_0x633c('0x62')][_0x633c('0xcf')])){throw _0x2f26b4[_0x633c('0x2f')](0x1f4)[_0x633c('0x3f')](new db[(_0x633c('0x90'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x109225));}_0x57a34b[_0x173be2[_0x633c('0x62')]['mapKeyOffline']]=_0x173be2[_0x633c('0x62')][_0x633c('0x98')];})['then'](function(){return db['ChatWebsite'][_0x633c('0x60')]({'where':{'id':_0x173be2[_0x633c('0x5d')]['id']},'include':[{'model':db[_0x633c('0x9e')],'as':_0x633c('0x9f')},{'model':db['MailAccount'],'as':_0x633c('0xd0')}]});})['then'](handleEntityNotFound(_0x2f26b4,null))[_0x633c('0x24')](function(_0x3f97ef){if(_0x3f97ef&&_0x3f97ef['List']){_0x3bbc34=_0x3f97ef;var _0x14eb42=_[_0x633c('0x1b')](_0x173be2[_0x633c('0x62')],{'firstName':_0x173be2[_0x633c('0x62')][_0x633c('0x98')],'phone':_0x173be2[_0x633c('0x62')][_0x633c('0x98')],'ListId':_0x3f97ef[_0x633c('0x97')]});_0x14eb42[_0x173be2['body'][_0x633c('0xcf')]]=_0x173be2[_0x633c('0x62')][_0x633c('0x98')];return db[_0x633c('0x8f')][_0x633c('0xd1')]({'where':_0x57a34b,'defaults':_0x14eb42});}})[_0x633c('0xbc')](function(_0x7f9b23){if(_0x7f9b23){_0x191e7c=_0x7f9b23;var _0x190d2c=fs[_0x633c('0xd2')](path['join'](config['root'],_0x633c('0xd3')),_0x633c('0xd4'));var _0x2fbe63=ejs[_0x633c('0xd5')](_0x190d2c,{'body':_['toPairs'](_0x173be2[_0x633c('0x62')][_0x633c('0x62')]),'bodyTitle':_0x3bbc34['offlineMessageBody']});return db[_0x633c('0xd6')]['create']({'body':_0x2fbe63,'ContactId':_0x7f9b23['id'],'ChatWebsiteId':_0x3bbc34['id']});}})['then'](function(_0x166069){_0x4487c7=_0x166069;if(_0x1e5f66[_0x633c('0x5e')]){var _0x272e79=_0x1e5f66[_0x633c('0x43')](function(_0x3a18d7){return{'name':_0x3a18d7[_0x633c('0xd7')],'basename':_0x3a18d7[_0x633c('0x75')],'type':_0x3a18d7[_0x633c('0xd8')],'ChatOfflineMessageId':_0x166069['id']};});_0x493cf8=_0x272e79[_0x633c('0x43')](_0x1e5e43=>{var _0x1911d5={'filename':_0x1e5e43[_0x633c('0x3e')],'path':path[_0x633c('0x7f')](config[_0x633c('0x7d')],_0x633c('0xd9'),_0x633c('0xcd'),_0x633c('0xda'),_0x633c('0xdb'),_0x1e5e43[_0x633c('0xdc')])};return _0x1911d5;});if(!_0x3bbc34[_0x633c('0xdd')]){return db[_0x633c('0xde')][_0x633c('0xdf')](function(_0x1d7371){return db[_0x633c('0xe0')][_0x633c('0xe1')](_0x272e79,{'transaction':_0x1d7371});});}}})[_0x633c('0x24')](function(){if(_0x4487c7){_0x23c0a9=_0x4487c7;return db['MailAccount']['findOne']({'where':{'active':!![]},'include':[{'model':db[_0x633c('0xe2')],'as':_0x633c('0xe3'),'raw':!![]}]});}})['then'](function(_0x44b74a){if(_0x44b74a&&_0x44b74a[_0x633c('0xe3')]&&_0x3bbc34[_0x633c('0xe4')]&&_0x3bbc34[_0x633c('0xe5')]){var _0x3848e4={'tls':{'rejectUnauthorized':![]}};if(_0x44b74a['Smtp']['service']){_0x3848e4[_0x633c('0xe6')]=_0x44b74a[_0x633c('0xe3')][_0x633c('0xe6')];}else{_0x3848e4[_0x633c('0xe7')]=_0x44b74a[_0x633c('0xe3')][_0x633c('0xe7')];_0x3848e4[_0x633c('0xe8')]=_0x44b74a[_0x633c('0xe3')][_0x633c('0xe8')];_0x3848e4[_0x633c('0xe9')]=_0x44b74a[_0x633c('0xe3')][_0x633c('0xe9')];}if(_0x44b74a[_0x633c('0xe3')][_0x633c('0xea')]){_0x3848e4[_0x633c('0xeb')]={'user':_0x44b74a['Smtp'][_0x633c('0x63')],'pass':_0x44b74a['Smtp'][_0x633c('0xec')]};}return respondWithRpcPromise(_0x633c('0xed'),_0x633c('0xee'),{'account':_0x3848e4,'message':{'from':util[_0x633c('0xb5')](_0x633c('0xef'),_0x44b74a[_0x633c('0x3e')],_0x44b74a[_0x633c('0xf0')]||_0x44b74a['Smtp'][_0x633c('0x63')]),'to':_0x3bbc34[_0x633c('0xe5')],'subject':_0x3bbc34['offlineMessageSubject'],'html':_0x23c0a9[_0x633c('0x62')],'attachments':_0x493cf8}},client9003)[_0x633c('0x24')](function(){return _0x23c0a9;})[_0x633c('0x2d')](function(_0x3a62e4){console['error'](_0x3a62e4);});}})[_0x633c('0x24')](function(){if(_0x3bbc34&&_0x3bbc34['openNewInteraction']&&_0x3bbc34['MailAccountId']){var _0x1f60f1=[];if(_0x1e5f66[_0x633c('0x5e')]){_0x1f60f1=_0x1e5f66[_0x633c('0x43')](function(_0x564921){return{'name':_0x564921[_0x633c('0xd7')],'basename':_0x564921[_0x633c('0x75')],'type':_0x564921[_0x633c('0xd8')],'ChatOfflineMessageId':_0x4487c7['id']};});}var _0x360e91;if(!_[_0x633c('0x84')](_0x3bbc34['subjectOffline'])){var _0x7db2da=_['map'](_0x173be2[_0x633c('0x62')],function(_0x2af060){return _0x2af060;});var _0x53fbdf=_[_0x633c('0xf1')](_0x7db2da)[0x0];var _0x1095a9=_[_0x633c('0xf2')](_0x53fbdf,function(_0x3596d5){return _0x3596d5;});_0x360e91=_0x1095a9[0x1][_0x3bbc34[_0x633c('0xf3')]];}var _0x1c1e84={'from':_0x191e7c[_0x633c('0xf0')],'firstName':_0x191e7c[_0x633c('0xbd')],'lastName':_0x191e7c[_0x633c('0xae')],'mapKey':_0x633c('0xf0'),'message':{'from':_0x191e7c[_0x633c('0xf0')],'to':_0x3bbc34[_0x633c('0xd0')]['email'],'cc':'','subject':_[_0x633c('0x84')](_0x360e91)?_0x3bbc34['offlineMessageSubject']:_0x360e91,'messageId':'','sentAt':new Date(),'attach':_0x1f60f1[_0x633c('0x5e')],'attachments':_0x1f60f1,'originChannel':_0x633c('0xf4'),'ChatWebsiteId':_0x3bbc34['id'],'ChatOfflineMessageId':_0x23c0a9['id'],'originTo':_0x3bbc34[_0x633c('0xd0')]['email']},'body':_0x23c0a9[_0x633c('0x62')]};var _0x50cca0={'account':{'id':_0x3bbc34[_0x633c('0xf5')]},'body':_0x1c1e84,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x633c('0xf6'),'notifyMail',_0x50cca0,client9001)[_0x633c('0x24')](function(){return _0x23c0a9;})['catch'](function(_0x3b1f10){console[_0x633c('0x29')](_0x3b1f10);});}return;})[_0x633c('0x24')](function(){if(_0x23c0a9){return _0x23c0a9;}})['then'](respondWithResult(_0x2f26b4,null))['catch'](function(_0x3ed427){console[_0x633c('0x29')](_0x633c('0x2d'),_0x3ed427);for(var _0x5e8255 of _0x1e5f66){var _0x41b2a2=path[_0x633c('0x7f')](config[_0x633c('0x7d')],_0x633c('0xd9'),_0x633c('0xcd'),_0x633c('0xda'),_0x633c('0xdb'),_0x5e8255[_0x633c('0x75')]);fs_extra[_0x633c('0xf7')](_0x41b2a2)['catch'](function(_0x138ae6){console[_0x633c('0x29')]('Could\x20not\x20remove\x20attachment\x20file',_0x41b2a2,_0x138ae6);});}});};exports[_0x633c('0xf8')]=function(_0xeac44f,_0x5bbff9,_0x41126b){return db[_0x633c('0xb9')]['find']({'where':{'id':_0xeac44f[_0x633c('0x5d')]['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x5bbff9,null))['then'](function(_0x274a61){if(_0x274a61){return _0x274a61[_0x633c('0xf8')](_0xeac44f[_0x633c('0x62')][_0x633c('0xf9')],_['omit'](_0xeac44f[_0x633c('0x62')],['ids','id'])||{});}})[_0x633c('0x24')](respondWithResult(_0x5bbff9,null))[_0x633c('0x2d')](handleError(_0x5bbff9,null));};exports[_0x633c('0xfa')]=function(_0x4496a9,_0xce02d6,_0x15510d){var _0xd40156={'raw':![],'where':{}};var _0x595e86={};var _0x1bbf85={'count':0x0,'rows':[]};return db[_0x633c('0x44')]['findOne']({'where':{'id':_0x4496a9['params']['id']}})[_0x633c('0x24')](handleEntityNotFound(_0xce02d6,null))[_0x633c('0x24')](function(_0x3ede38){if(_0x3ede38){_0x595e86['model']=_['keys'](db[_0x633c('0xb9')][_0x633c('0x45')]);_0x595e86[_0x633c('0x4f')]=_[_0x633c('0x4a')](_0x4496a9[_0x633c('0x4f')]);_0x595e86[_0x633c('0x4b')]=_[_0x633c('0x4c')](_0x595e86[_0x633c('0x49')],_0x595e86[_0x633c('0x4f')]);_0xd40156[_0x633c('0x4d')]=_[_0x633c('0x4c')](_0x595e86[_0x633c('0x49')],qs[_0x633c('0x4e')](_0x4496a9[_0x633c('0x4f')][_0x633c('0x4e')]));_0xd40156['attributes']=_0xd40156[_0x633c('0x4d')]['length']?_0xd40156[_0x633c('0x4d')]:_0x595e86[_0x633c('0x49')];if(!_0x4496a9[_0x633c('0x4f')][_0x633c('0x50')]('nolimit')){_0xd40156[_0x633c('0x52')]=qs[_0x633c('0x52')](_0x4496a9[_0x633c('0x4f')]['limit']);_0xd40156['offset']=qs[_0x633c('0x33')](_0x4496a9['query'][_0x633c('0x33')]);}_0xd40156[_0x633c('0x53')]=qs['sort'](_0x4496a9['query']['sort']);_0xd40156[_0x633c('0x55')]=qs[_0x633c('0x4b')](_['pick'](_0x4496a9[_0x633c('0x4f')],_0x595e86[_0x633c('0x4b')]));_0xd40156[_0x633c('0x55')][_0x633c('0x69')]=_0x3ede38['id'];if(_0x4496a9[_0x633c('0x4f')][_0x633c('0x58')]){_0xd40156[_0x633c('0x55')]=_[_0x633c('0x57')](_0xd40156[_0x633c('0x55')],{'$or':_['map'](_0xd40156['attributes'],function(_0x49584a){var _0xa8acdf={};_0xa8acdf[_0x49584a]={'$like':'%'+_0x4496a9[_0x633c('0x4f')][_0x633c('0x58')]+'%'};return _0xa8acdf;})});}_0xd40156=_[_0x633c('0x57')]({},_0xd40156,_0x4496a9[_0x633c('0x5f')]);return db[_0x633c('0xb9')]['count']({'where':_0xd40156[_0x633c('0x55')]})[_0x633c('0x24')](function(_0x2316f0){_0x1bbf85[_0x633c('0x32')]=_0x2316f0;if(_0x4496a9[_0x633c('0x4f')]['includeAll']){_0xd40156[_0x633c('0x5a')]=[{'model':db['CmContact'],'as':_0x633c('0xfb'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x633c('0x3e'),_0x633c('0xfc'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x633c('0xfd'),'attributes':['id',_0x633c('0x3e'),_0x633c('0xfe')],'where':_0x4496a9[_0x633c('0x4f')][_0x633c('0xff')]?{'id':_0x4496a9[_0x633c('0x4f')][_0x633c('0xff')]}:undefined,'required':_0x4496a9[_0x633c('0x4f')][_0x633c('0xff')]?!![]:![]}];}return db[_0x633c('0xb9')][_0x633c('0x5b')](_0xd40156);})[_0x633c('0x24')](function(_0xd02075){_0x1bbf85[_0x633c('0x5c')]=_0xd02075;return _0x1bbf85;});}})[_0x633c('0x24')](respondWithFilteredResult(_0xce02d6,_0xd40156))[_0x633c('0x2d')](handleError(_0xce02d6,null));};function iftimePromise(_0x17c56a,_0x344a16){return respondWithRpcPromise('Command',_0x633c('0x100'),{'command':_0x344a16[_0x633c('0x101')]?util[_0x633c('0xb5')]('iftime\x20%s,%s',_0x17c56a[_0x633c('0x102')],_0x344a16['timezone']):util['format'](_0x633c('0x103'),_0x17c56a[_0x633c('0x102')])},client9002)['then'](function(_0x353267){var _0x2c6c00=_0x353267&&_0x353267['indexOf'](_0x633c('0x104'))>=0x0?!![]:![];logger['info'](_0x633c('0x105'),_0x344a16['id'],_0x17c56a['id'],_0x17c56a[_0x633c('0x102')],_0x2c6c00?_0x633c('0x106'):'OFFLINE',_0x344a16[_0x633c('0x101')]?_0x344a16['timezone']:_0x633c('0x107'));return _0x2c6c00;})[_0x633c('0x2d')](function(_0x4eecba){logger[_0x633c('0x29')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x344a16['id'],_0x17c56a['id'],_0x17c56a[_0x633c('0x102')],util[_0x633c('0x108')](_0x4eecba,{'showHidden':![],'depth':null}),_0x344a16['timezone']?_0x344a16['timezone']:_0x633c('0x107'));return![];});}exports[_0x633c('0x100')]=function(_0x54c205,_0x23e6b3,_0x4b176d){var _0x45d6ea=0x0;var _0x2d985b=0x0;var _0x1f35e2=![];var _0x6e932b;var _0x34fe19;return db[_0x633c('0x44')]['find']({'where':{'id':_0x54c205[_0x633c('0x5d')]['id']},'include':[{'model':db[_0x633c('0x109')],'as':'Interval','include':[{'model':db[_0x633c('0x109')],'as':_0x633c('0x10a'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x633c('0x24')](handleEntityNotFound(_0x23e6b3,null))[_0x633c('0x24')](function(_0x384c6b){if(_0x384c6b){_0x6e932b=_0x384c6b;return _0x384c6b['getProactiveActions']({'raw':!![]});}})[_0x633c('0x24')](function(_0x56c79c){if(_0x6e932b){if(_0x56c79c){_0x34fe19=_0x56c79c;}}return require(_0x633c('0x19'))[_0x633c('0x7b')]();})[_0x633c('0x24')](function(_0x4a7df8){if(_0x4a7df8){_0x2d985b=_0x4a7df8[_0x633c('0x10b')];_0x1f35e2=_0x4a7df8['custom'];}})[_0x633c('0x24')](function(){return db[_0x633c('0xb9')]['count']({'where':{'closed':![]}});})[_0x633c('0x24')](function(_0x1ade54){_0x45d6ea=_0x1ade54;if(_0x2d985b&&_0x1ade54>_0x2d985b){return db[_0x633c('0x10c')][_0x633c('0x6c')]({'where':{'id':0x1}})['then'](function(_0x24c7c0){if(_0x24c7c0){_0x24c7c0['increment'](_0x633c('0x10d'));}});}})['then'](function(){if(_0x6e932b['Interval']&&_0x6e932b[_0x633c('0x109')][_0x633c('0x10a')]){var _0x22d20c=[];for(var _0xf88f4d=0x0;_0xf88f4d<_0x6e932b[_0x633c('0x109')]['Intervals'][_0x633c('0x5e')];_0xf88f4d++){var _0x1386fd=_0x6e932b[_0x633c('0x109')][_0x633c('0x10a')][_0xf88f4d][_0x633c('0x38')]({'plain':!![]});_0x22d20c['push'](iftimePromise(_0x1386fd,_0x6e932b));}return BPromise[_0x633c('0x10e')](_0x22d20c)['then'](function(_0x4a9be3){return _[_0x633c('0x10f')](_0x4a9be3);});}else{return!![];}})[_0x633c('0x24')](function(_0x132f26){var _0x47ca34=fs[_0x633c('0xd2')](path[_0x633c('0x7f')](config[_0x633c('0x7d')],_0x633c('0x110')),_0x633c('0xd4'));var _0x505c73={'remote':_0x6e932b[_0x633c('0x111')],'query':querystring[_0x633c('0x28')](_[_0x633c('0x57')](_0x6e932b['get']({'plain':!![]}),{'customerIp':_0x54c205[_0x633c('0x8d')][_0x633c('0xac')]||_0x54c205[_0x633c('0x8d')]['x-real-ip']||_0x54c205[_0x633c('0x112')][_0x633c('0x113')]||_0x54c205['ip'],'referer':_0x54c205['headers'][_0x633c('0xb0')],'openedInteractions':_0x45d6ea,'maxInteractions':_0x2d985b,'virtual':_0x1f35e2[_0x633c('0x10b')],'online':_0x132f26,'custom':_0x1f35e2}))['replace'](/'/g,'\x5c\x27')};_0x23e6b3[_0x633c('0x3f')](ejs['render'](Mustache[_0x633c('0xd5')](_0x47ca34,_0x505c73),{'proactiveActions':_0x34fe19,'alignment':_0x6e932b['alignment'],'verticalAlignment':_0x6e932b[_0x633c('0x114')],'div_color':_0x6e932b[_0x633c('0xfe')],'text_color':_0x6e932b[_0x633c('0x115')],'button_color':_0x6e932b[_0x633c('0x116')],'background_color':_0x6e932b[_0x633c('0x117')]}));})['catch'](handleError(_0x23e6b3,null));};exports[_0x633c('0x118')]=function(_0x6e189,_0x22017c,_0x389fca){return db[_0x633c('0x44')]['findOne']({'where':{'id':_0x6e189[_0x633c('0x5d')]['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x22017c,null))[_0x633c('0x24')](function(_0x2ea4e1){if(_0x2ea4e1){return db[_0x633c('0xde')]['transaction'](function(_0x1a78d4){return db[_0x633c('0xa1')]['destroy']({'where':{'ChatWebsiteId':_0x6e189['params']['id']},'transaction':_0x1a78d4})[_0x633c('0x24')](function(_0x59b9d8){var _0x2e784e=_['map'](_0x6e189[_0x633c('0x62')],function(_0x4572f3){_0x4572f3[_0x633c('0x69')]=_0x6e189[_0x633c('0x5d')]['id'];return _0x4572f3;});return db['ChatApplication']['bulkCreate'](_0x2e784e,{'transaction':_0x1a78d4});});})[_0x633c('0x24')](function(){return db['ChatApplication'][_0x633c('0x119')]({'where':{'ChatWebsiteId':_0x6e189[_0x633c('0x5d')]['id']},'order':_0x633c('0xa5')});});}})[_0x633c('0x24')](respondWithResult(_0x22017c,null))[_0x633c('0x2d')](handleError(_0x22017c,null));};exports['getApplications']=function(_0x200c8e,_0x1ca2bd,_0x17bd1c){var _0x2cb3fa={};var _0x15c4e5={};var _0x2ee49b;var _0x437e86;return db[_0x633c('0x44')][_0x633c('0x6c')]({'where':{'id':_0x200c8e[_0x633c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1ca2bd,null))['then'](function(_0x47627c){if(_0x47627c){_0x2ee49b=_0x47627c;_0x15c4e5[_0x633c('0x49')]=_[_0x633c('0x4a')](db[_0x633c('0xa1')][_0x633c('0x45')]);_0x15c4e5[_0x633c('0x4f')]=_['keys'](_0x200c8e[_0x633c('0x4f')]);_0x15c4e5['filters']=_[_0x633c('0x4c')](_0x15c4e5[_0x633c('0x49')],_0x15c4e5[_0x633c('0x4f')]);_0x2cb3fa['attributes']=_[_0x633c('0x4c')](_0x15c4e5[_0x633c('0x49')],qs[_0x633c('0x4e')](_0x200c8e[_0x633c('0x4f')]['fields']));_0x2cb3fa[_0x633c('0x4d')]=_0x2cb3fa['attributes'][_0x633c('0x5e')]?_0x2cb3fa['attributes']:_0x15c4e5[_0x633c('0x49')];_0x2cb3fa[_0x633c('0x53')]=qs[_0x633c('0x54')](_0x200c8e[_0x633c('0x4f')][_0x633c('0x54')]);_0x2cb3fa[_0x633c('0x55')]=qs[_0x633c('0x4b')](_[_0x633c('0x56')](_0x200c8e[_0x633c('0x4f')],_0x15c4e5[_0x633c('0x4b')]));if(_0x200c8e[_0x633c('0x4f')]['filter']){_0x2cb3fa['where']=_[_0x633c('0x57')](_0x2cb3fa[_0x633c('0x55')],{'$or':_[_0x633c('0x43')](_0x2cb3fa['attributes'],function(_0x1b361a){var _0x19dff9={};_0x19dff9[_0x1b361a]={'$like':'%'+_0x200c8e['query'][_0x633c('0x58')]+'%'};return _0x19dff9;})});}_0x2cb3fa=_[_0x633c('0x57')]({},_0x2cb3fa,_0x200c8e[_0x633c('0x5f')]);return _0x2ee49b[_0x633c('0x11a')](_0x2cb3fa);}})[_0x633c('0x24')](function(_0x5d3397){if(_0x5d3397){_0x437e86=_0x5d3397[_0x633c('0x5e')];if(!_0x200c8e['query'][_0x633c('0x50')]('nolimit')){_0x2cb3fa['limit']=qs['limit'](_0x200c8e[_0x633c('0x4f')][_0x633c('0x52')]);_0x2cb3fa[_0x633c('0x33')]=qs[_0x633c('0x33')](_0x200c8e[_0x633c('0x4f')][_0x633c('0x33')]);}return _0x2ee49b['getApplications'](_0x2cb3fa);}})[_0x633c('0x24')](function(_0x5c39b1){if(_0x5c39b1){return _0x5c39b1?{'count':_0x437e86,'rows':_0x5c39b1}:null;}})['then'](respondWithResult(_0x1ca2bd,null))[_0x633c('0x2d')](handleError(_0x1ca2bd,null));};exports['addProactiveActions']=function(_0x119817,_0x3b8bd3,_0x27840c){return db['chatProactiveAction'][_0x633c('0x60')]({'where':{'id':_0x119817[_0x633c('0x5d')]['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x3b8bd3,null))[_0x633c('0x24')](function(_0x1d5b03){if(_0x1d5b03){return _0x1d5b03[_0x633c('0x11b')](_0x119817[_0x633c('0x62')][_0x633c('0xf9')],_[_0x633c('0x11c')](_0x119817['body'],[_0x633c('0xf9'),'id'])||{});}})[_0x633c('0x24')](respondWithResult(_0x3b8bd3,null))[_0x633c('0x2d')](handleError(_0x3b8bd3,null));};exports[_0x633c('0x11d')]=function(_0x36643e,_0x4fa414,_0x3d61f5){var _0x4decfb={};var _0x2b51a0={};var _0x39e6de;var _0x591669;return db[_0x633c('0x44')]['findOne']({'where':{'id':_0x36643e[_0x633c('0x5d')]['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x4fa414,null))[_0x633c('0x24')](function(_0x3aef2c){if(_0x3aef2c){_0x39e6de=_0x3aef2c;_0x2b51a0[_0x633c('0x49')]=_[_0x633c('0x4a')](db['ChatProactiveAction'][_0x633c('0x45')]);_0x2b51a0[_0x633c('0x4f')]=_[_0x633c('0x4a')](_0x36643e[_0x633c('0x4f')]);_0x2b51a0[_0x633c('0x4b')]=_[_0x633c('0x4c')](_0x2b51a0['model'],_0x2b51a0[_0x633c('0x4f')]);_0x4decfb['attributes']=_[_0x633c('0x4c')](_0x2b51a0[_0x633c('0x49')],qs[_0x633c('0x4e')](_0x36643e[_0x633c('0x4f')][_0x633c('0x4e')]));_0x4decfb['attributes']=_0x4decfb[_0x633c('0x4d')][_0x633c('0x5e')]?_0x4decfb[_0x633c('0x4d')]:_0x2b51a0[_0x633c('0x49')];_0x4decfb[_0x633c('0x53')]=qs[_0x633c('0x54')](_0x36643e[_0x633c('0x4f')]['sort']);_0x4decfb[_0x633c('0x55')]=qs[_0x633c('0x4b')](_[_0x633c('0x56')](_0x36643e[_0x633c('0x4f')],_0x2b51a0[_0x633c('0x4b')]));if(_0x36643e[_0x633c('0x4f')][_0x633c('0x58')]){_0x4decfb[_0x633c('0x55')]=_[_0x633c('0x57')](_0x4decfb['where'],{'$or':_[_0x633c('0x43')](_0x4decfb[_0x633c('0x4d')],function(_0x4ef0ac){var _0x46514c={};_0x46514c[_0x4ef0ac]={'$like':'%'+_0x36643e['query'][_0x633c('0x58')]+'%'};return _0x46514c;})});}_0x4decfb=_[_0x633c('0x57')]({},_0x4decfb,_0x36643e[_0x633c('0x5f')]);return _0x39e6de['getProactiveActions'](_0x4decfb);}})['then'](function(_0x4b785d){if(_0x4b785d){_0x591669=_0x4b785d[_0x633c('0x5e')];if(!_0x36643e[_0x633c('0x4f')][_0x633c('0x50')](_0x633c('0x51'))){_0x4decfb[_0x633c('0x52')]=qs['limit'](_0x36643e[_0x633c('0x4f')][_0x633c('0x52')]);_0x4decfb[_0x633c('0x33')]=qs[_0x633c('0x33')](_0x36643e[_0x633c('0x4f')][_0x633c('0x33')]);}return _0x39e6de['getProactiveActions'](_0x4decfb);}})[_0x633c('0x24')](function(_0x56bf14){if(_0x56bf14){return _0x56bf14?{'count':_0x591669,'rows':_0x56bf14}:null;}})[_0x633c('0x24')](respondWithResult(_0x4fa414,null))[_0x633c('0x2d')](handleError(_0x4fa414,null));};exports[_0x633c('0x11e')]=function(_0x15ecf9,_0x2bf306,_0x54b245){var _0x4257fd=_0x15ecf9[_0x633c('0x4f')]['online']===_0x633c('0x11f')?'offlineForm':_0x633c('0x120');return db[_0x633c('0x44')][_0x633c('0x60')]({'attributes':['id',_0x4257fd],'where':{'id':_0x15ecf9['params']['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x2bf306,null))[_0x633c('0x24')](function(_0x5ccdd1){if(_0x5ccdd1){var _0x147296=_0x5ccdd1[_0x4257fd];var _0x549191=_0x147296&&_0x147296[_0x633c('0x121')]?_0x147296['items']:[];_0x2bf306[_0x633c('0x3f')]({'fromKey':_[_0x633c('0x84')](_0x147296[_0x633c('0x122')])?undefined:_0x147296[_0x633c('0x122')],'count':_0x549191[_0x633c('0x5e')],'rows':_0x549191});}})[_0x633c('0x2d')](handleError(_0x2bf306,null));};exports[_0x633c('0x123')]=function(_0x1d46f4,_0x1cde54,_0x3f65fd){var _0x16c955={'raw':![],'where':{}};var _0x1b7a58={};var _0x6f83be={'count':0x0,'rows':[]};return db[_0x633c('0x44')]['findOne']({'where':{'id':_0x1d46f4[_0x633c('0x5d')]['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x1cde54,null))[_0x633c('0x24')](function(_0x541a40){if(_0x541a40){_0x1b7a58[_0x633c('0x49')]=_[_0x633c('0x4a')](db[_0x633c('0xd6')][_0x633c('0x45')]);_0x1b7a58[_0x633c('0x4f')]=_[_0x633c('0x4a')](_0x1d46f4['query']);_0x1b7a58[_0x633c('0x4b')]=_[_0x633c('0x4c')](_0x1b7a58['model'],_0x1b7a58['query']);_0x16c955[_0x633c('0x4d')]=_[_0x633c('0x4c')](_0x1b7a58[_0x633c('0x49')],qs[_0x633c('0x4e')](_0x1d46f4[_0x633c('0x4f')]['fields']));_0x16c955[_0x633c('0x4d')]=_0x16c955[_0x633c('0x4d')][_0x633c('0x5e')]?_0x16c955[_0x633c('0x4d')]:_0x1b7a58['model'];if(!_0x1d46f4[_0x633c('0x4f')][_0x633c('0x50')](_0x633c('0x51'))){_0x16c955[_0x633c('0x52')]=qs[_0x633c('0x52')](_0x1d46f4[_0x633c('0x4f')]['limit']);_0x16c955['offset']=qs[_0x633c('0x33')](_0x1d46f4['query']['offset']);}_0x16c955[_0x633c('0x53')]=qs[_0x633c('0x54')](_0x1d46f4[_0x633c('0x4f')][_0x633c('0x54')]);_0x16c955['where']=qs['filters'](_['pick'](_0x1d46f4[_0x633c('0x4f')],_0x1b7a58['filters']));_0x16c955[_0x633c('0x55')][_0x633c('0x69')]=_0x541a40['id'];if(_0x1d46f4[_0x633c('0x4f')][_0x633c('0x58')]){_0x16c955[_0x633c('0x55')]=_['merge'](_0x16c955[_0x633c('0x55')],{'$or':_[_0x633c('0x43')](_0x16c955[_0x633c('0x4d')],function(_0x1049bb){var _0x53c841={};_0x53c841[_0x1049bb]={'$like':'%'+_0x1d46f4[_0x633c('0x4f')][_0x633c('0x58')]+'%'};return _0x53c841;})});}_0x16c955=_[_0x633c('0x57')]({},_0x16c955,_0x1d46f4[_0x633c('0x5f')]);return db[_0x633c('0xd6')][_0x633c('0x32')]({'where':_0x16c955[_0x633c('0x55')]})[_0x633c('0x24')](function(_0x4a1f3f){_0x6f83be['count']=_0x4a1f3f;if(_0x1d46f4[_0x633c('0x4f')]['includeAll']){_0x16c955[_0x633c('0x5a')]=[{'all':!![]}];}else{_0x16c955[_0x633c('0x5a')]=[{'model':db[_0x633c('0x8f')],'as':_0x633c('0xfb'),'required':![]},{'model':db[_0x633c('0xe0')],'as':_0x633c('0x124'),'required':![]}];}return db[_0x633c('0xd6')][_0x633c('0x5b')](_0x16c955);})[_0x633c('0x24')](function(_0x3e686f){_0x6f83be[_0x633c('0x5c')]=_0x3e686f;return _0x6f83be;});}})[_0x633c('0x24')](respondWithFilteredResult(_0x1cde54,_0x16c955))['catch'](handleError(_0x1cde54,null));};exports[_0x633c('0x125')]=function(_0x2b5d8c,_0x337ee4,_0x3b35a2){return db['ChatWebsite'][_0x633c('0x60')]({'where':{'id':_0x2b5d8c['params']['id']}})[_0x633c('0x24')](handleEntityNotFound(_0x337ee4,null))[_0x633c('0x24')](function(_0x11f6f6){if(_0x11f6f6){return _0x11f6f6[_0x633c('0x125')](_0x2b5d8c[_0x633c('0x62')][_0x633c('0xf9')],_['omit'](_0x2b5d8c['body'],[_0x633c('0xf9'),'id'])||{})[_0x633c('0xbc')](function(_0x5f07a6){for(var _0x5a4dfc=0x0;_0x5a4dfc<_0x2b5d8c['body'][_0x633c('0xf9')][_0x633c('0x5e')];_0x5a4dfc+=0x1){socket['emit'](_0x633c('0x126'),{'UserId':_0x2b5d8c['body'][_0x633c('0xf9')][_0x5a4dfc],'ChatWebsiteId':_0x2b5d8c[_0x633c('0x5d')]['id']});}return _0x5f07a6;});}})['then'](respondWithResult(_0x337ee4,null))[_0x633c('0x2d')](handleError(_0x337ee4,null));};exports[_0x633c('0x127')]=function(_0x5c5c37,_0xda873,_0x552e0e){return db[_0x633c('0x44')][_0x633c('0x60')]({'where':{'id':_0x5c5c37['params']['id']}})[_0x633c('0x24')](handleEntityNotFound(_0xda873,null))[_0x633c('0x24')](function(_0x37f9c9){if(_0x37f9c9){return _0x37f9c9[_0x633c('0x127')](_0x5c5c37['query'][_0x633c('0xf9')])[_0x633c('0x24')](function(){if(_[_0x633c('0x128')](_0x5c5c37[_0x633c('0x4f')]['ids'])){for(var _0xde48f9=0x0;_0xde48f9<_0x5c5c37['query'][_0x633c('0xf9')][_0x633c('0x5e')];_0xde48f9+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x5c5c37[_0x633c('0x4f')]['ids'][_0xde48f9]),'ChatWebsiteId':Number(_0x5c5c37[_0x633c('0x5d')]['id'])});}}else{socket[_0x633c('0x129')]('userChatWebsite:remove',{'UserId':Number(_0x5c5c37[_0x633c('0x4f')][_0x633c('0xf9')]),'ChatWebsiteId':Number(_0x5c5c37[_0x633c('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0xda873,null))[_0x633c('0x2d')](handleError(_0xda873,null));};exports[_0x633c('0x12a')]=function(_0x3e31bc,_0x233b0f,_0x571385){var _0x3d09f3={};var _0x1305db={};var _0x44fa74;var _0x2a0b60;return db[_0x633c('0x44')][_0x633c('0x6c')]({'where':{'id':_0x3e31bc['params']['id']}})['then'](handleEntityNotFound(_0x233b0f,null))[_0x633c('0x24')](function(_0x2762ae){if(_0x2762ae){_0x44fa74=_0x2762ae;_0x1305db['model']=_['keys'](db[_0x633c('0xc5')][_0x633c('0x45')]);_0x1305db[_0x633c('0x4f')]=_[_0x633c('0x4a')](_0x3e31bc[_0x633c('0x4f')]);_0x1305db[_0x633c('0x4b')]=_[_0x633c('0x4c')](_0x1305db[_0x633c('0x49')],_0x1305db[_0x633c('0x4f')]);_0x3d09f3['attributes']=_[_0x633c('0x4c')](_0x1305db[_0x633c('0x49')],qs[_0x633c('0x4e')](_0x3e31bc[_0x633c('0x4f')]['fields']));_0x3d09f3[_0x633c('0x4d')]=_0x3d09f3['attributes'][_0x633c('0x5e')]?_0x3d09f3['attributes']:_0x1305db['model'];_0x3d09f3[_0x633c('0x53')]=qs[_0x633c('0x54')](_0x3e31bc[_0x633c('0x4f')][_0x633c('0x54')]);_0x3d09f3[_0x633c('0x55')]=qs[_0x633c('0x4b')](_[_0x633c('0x56')](_0x3e31bc[_0x633c('0x4f')],_0x1305db['filters']));if(_0x3e31bc['query'][_0x633c('0x58')]){_0x3d09f3[_0x633c('0x55')]=_[_0x633c('0x57')](_0x3d09f3['where'],{'$or':_[_0x633c('0x43')](_0x3d09f3[_0x633c('0x4d')],function(_0x31820b){var _0xecd6ad={};_0xecd6ad[_0x31820b]={'$like':'%'+_0x3e31bc['query']['filter']+'%'};return _0xecd6ad;})});}_0x3d09f3=_[_0x633c('0x57')]({},_0x3d09f3,_0x3e31bc[_0x633c('0x5f')]);return _0x44fa74[_0x633c('0x12a')](_0x3d09f3);}})[_0x633c('0x24')](function(_0x3d9205){if(_0x3d9205){_0x2a0b60=_0x3d9205[_0x633c('0x5e')];if(!_0x3e31bc[_0x633c('0x4f')][_0x633c('0x50')](_0x633c('0x51'))){_0x3d09f3['limit']=qs[_0x633c('0x52')](_0x3e31bc['query'][_0x633c('0x52')]);_0x3d09f3['offset']=qs[_0x633c('0x33')](_0x3e31bc[_0x633c('0x4f')][_0x633c('0x33')]);}return _0x44fa74[_0x633c('0x12a')](_0x3d09f3);}})[_0x633c('0x24')](function(_0x4cf80e){if(_0x4cf80e){return _0x4cf80e?{'count':_0x2a0b60,'rows':_0x4cf80e}:null;}})[_0x633c('0x24')](respondWithResult(_0x233b0f,null))[_0x633c('0x2d')](handleError(_0x233b0f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 41146ec..e3d982d 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 _0x80d9=['events','ChatWebsite','setMaxListeners','save','remove','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x80d9,0x15c));var _0x980d=function(_0x5e8935,_0x5efae0){_0x5e8935=_0x5e8935-0x0;var _0x44c78d=_0x80d9[_0x5e8935];return _0x44c78d;};'use strict';var EventEmitter=require(_0x980d('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x980d('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x980d('0x2')](0x0);var events={'afterCreate':_0x980d('0x3'),'afterUpdate':'update','afterDestroy':_0x980d('0x4')};function emitEvent(_0x3a9d1e){return function(_0x38d1b9,_0x279d93,_0x290800){ChatWebsiteEvents['emit'](_0x3a9d1e+':'+_0x38d1b9['id'],_0x38d1b9);ChatWebsiteEvents['emit'](_0x3a9d1e,_0x38d1b9);_0x290800(null);};}for(var e in events){if(events[_0x980d('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x1703=['hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x444c46,_0x15eea1){var _0x4644a0=function(_0x460f90){while(--_0x460f90){_0x444c46['push'](_0x444c46['shift']());}};_0x4644a0(++_0x15eea1);}(_0x1703,0x16a));var _0x3170=function(_0xfd1128,_0x34a9f3){_0xfd1128=_0xfd1128-0x0;var _0x3e7287=_0x1703[_0xfd1128];return _0x3e7287;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x3170('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3170('0x1')](0x0);var events={'afterCreate':_0x3170('0x2'),'afterUpdate':_0x3170('0x3'),'afterDestroy':_0x3170('0x4')};function emitEvent(_0x1440e6){return function(_0x4c3c67,_0x46dead,_0x48a6c2){ChatWebsiteEvents[_0x3170('0x5')](_0x1440e6+':'+_0x4c3c67['id'],_0x4c3c67);ChatWebsiteEvents[_0x3170('0x5')](_0x1440e6,_0x4c3c67);_0x48a6c2(null);};}for(var e in events){if(events[_0x3170('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x3170('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index e13baad..ceedbb8 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 _0x0fd9=['./chatWebsite.attributes','exports','ChatWebsite','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x448427,_0x393e74){var _0x313f05=function(_0x36dd47){while(--_0x36dd47){_0x448427['push'](_0x448427['shift']());}};_0x313f05(++_0x393e74);}(_0x0fd9,0xa3));var _0x90fd=function(_0x299784,_0xb0918f){_0x299784=_0x299784-0x0;var _0x5ab008=_0x0fd9[_0x299784];return _0x5ab008;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var logger=require(_0x90fd('0x1'))(_0x90fd('0x2'));var moment=require(_0x90fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x90fd('0x4'));var rimraf=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var attributes=require(_0x90fd('0x7'));module[_0x90fd('0x8')]=function(_0x23e11b,_0x5e2107){return _0x23e11b['define'](_0x90fd('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee5b=['request-promise','path','rimraf','exports','define','lodash','../../config/logger','api','bluebird'];(function(_0xdbc93e,_0x4fcd8e){var _0x29df2c=function(_0x486542){while(--_0x486542){_0xdbc93e['push'](_0xdbc93e['shift']());}};_0x29df2c(++_0x4fcd8e);}(_0xee5b,0x1f4));var _0xbee5=function(_0x4af7f3,_0x3d326b){_0x4af7f3=_0x4af7f3-0x0;var _0x39bb3d=_0xee5b[_0x4af7f3];return _0x39bb3d;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var moment=require('moment');var BPromise=require(_0xbee5('0x3'));var rp=require(_0xbee5('0x4'));var fs=require('fs');var path=require(_0xbee5('0x5'));var rimraf=require(_0xbee5('0x6'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0xbee5('0x7')]=function(_0x2c0bde,_0xab6e4d){return _0x2c0bde[_0xbee5('0x8')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 5f605d6..fb73c60 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 _0x57ca=['redis','defaults','localhost','register','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5afe69,_0x2f5f0b){var _0x316774=function(_0x4a87cc){while(--_0x4a87cc){_0x5afe69['push'](_0x5afe69['shift']());}};_0x316774(++_0x2f5f0b);}(_0x57ca,0x108));var _0xa57c=function(_0x1f2f03,_0x3c6937){_0x1f2f03=_0x1f2f03-0x0;var _0x1ca131=_0x57ca[_0x1f2f03];return _0x1ca131;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});config[_0xa57c('0xb')]=_[_0xa57c('0xc')](config[_0xa57c('0xb')],{'host':_0xa57c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa57c('0xb')]));require('./chatWebsite.socket')[_0xa57c('0xe')](socket);function respondWithRpcPromise(_0x932dcc,_0x4fa5ed,_0x156bca){return new BPromise(function(_0x51f287,_0x554101){return client[_0xa57c('0xf')](_0x932dcc,_0x156bca)['then'](function(_0x2ed4c6){logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));logger[_0xa57c('0x12')](_0xa57c('0x13'),_0x4fa5ed,_0xa57c('0x11'),JSON['stringify'](_0x2ed4c6));if(_0x2ed4c6[_0xa57c('0x14')]){if(_0x2ed4c6['error'][_0xa57c('0x15')]===0x1f4){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x554101(_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);}logger['error'](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x51f287(_0x2ed4c6['error'][_0xa57c('0x16')]);}else{logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));_0x51f287(_0x2ed4c6[_0xa57c('0x17')][_0xa57c('0x16')]);}})[_0xa57c('0x18')](function(_0x4728f9){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x4728f9);_0x554101(_0x4728f9);});});} \ No newline at end of file +var _0x4975=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','register','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4975,0x86));var _0x5497=function(_0x585ddc,_0x6eff6b){_0x585ddc=_0x585ddc-0x0;var _0x5081ac=_0x4975[_0x585ddc];return _0x5081ac;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});config['redis']=_[_0x5497('0xc')](config[_0x5497('0xd')],{'host':_0x5497('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5497('0xd')]));require('./chatWebsite.socket')[_0x5497('0xf')](socket);function respondWithRpcPromise(_0x29c93f,_0x2ec5a4,_0x32a8a2){return new BPromise(function(_0x131627,_0x425288){return client[_0x5497('0x10')](_0x29c93f,_0x32a8a2)[_0x5497('0x11')](function(_0x50d716){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x2ec5a4,_0x5497('0x12'));logger[_0x5497('0x13')](_0x5497('0x14'),_0x2ec5a4,_0x5497('0x12'),JSON[_0x5497('0x15')](_0x50d716));if(_0x50d716[_0x5497('0x16')]){if(_0x50d716[_0x5497('0x16')][_0x5497('0x17')]===0x1f4){logger[_0x5497('0x16')](_0x5497('0x18'),_0x2ec5a4,_0x50d716['error'][_0x5497('0x19')]);return _0x425288(_0x50d716['error'][_0x5497('0x19')]);}logger[_0x5497('0x16')](_0x5497('0x18'),_0x2ec5a4,_0x50d716[_0x5497('0x16')][_0x5497('0x19')]);return _0x131627(_0x50d716[_0x5497('0x16')][_0x5497('0x19')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x2ec5a4,_0x5497('0x12'));_0x131627(_0x50d716[_0x5497('0x1a')][_0x5497('0x19')]);}})['catch'](function(_0xbf1ba7){logger[_0x5497('0x16')](_0x5497('0x18'),_0x2ec5a4,_0xbf1ba7);_0x425288(_0xbf1ba7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 5e745fc..138f3ce 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x216e72,_0x5cd161){var _0x2ff28d=function(_0x29a533){while(--_0x29a533){_0x216e72['push'](_0x216e72['shift']());}};_0x2ff28d(++_0x5cd161);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a62c5,_0x2aff63){_0x5a62c5=_0x5a62c5-0x0;var _0x5ea813=_0x5f2f[_0x5a62c5];return _0x5ea813;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x98e64,_0x216f4d){var _0x48d537=function(_0x573983){while(--_0x573983){_0x98e64['push'](_0x98e64['shift']());}};_0x48d537(++_0x216f4d);}(_0xb10b,0x12a));var _0xbb10=function(_0x16eadc,_0x3fc953){_0x16eadc=_0x16eadc-0x0;var _0x5b05c8=_0xb10b[_0x16eadc];return _0x5b05c8;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index fed955b..bb269f2 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 _0x6cd8=['removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','/:id/avatar','single','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','put','destroy','delete','removeDispositions','removeAnswers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6cd8,0x121));var _0x86cd=function(_0x392b30,_0x4817e6){_0x392b30=_0x392b30-0x0;var _0x1023aa=_0x6cd8[_0x392b30];return _0x1023aa;};'use strict';var multer=require(_0x86cd('0x0'));var util=require(_0x86cd('0x1'));var path=require(_0x86cd('0x2'));var timeout=require(_0x86cd('0x3'));var express=require(_0x86cd('0x4'));var router=express[_0x86cd('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x86cd('0x6'));var config=require(_0x86cd('0x7'));var controller=require(_0x86cd('0x8'));router['get']('/',auth[_0x86cd('0x9')](),controller[_0x86cd('0xa')]);router[_0x86cd('0xb')](_0x86cd('0xc'),auth[_0x86cd('0x9')](),controller[_0x86cd('0xd')]);router[_0x86cd('0xb')](_0x86cd('0xe'),auth[_0x86cd('0x9')](),controller[_0x86cd('0xf')]);router['get'](_0x86cd('0x10'),auth[_0x86cd('0x9')](),controller[_0x86cd('0x11')]);router[_0x86cd('0xb')]('/:id/canned_answers',auth[_0x86cd('0x9')](),controller['getAnswers']);router[_0x86cd('0xb')](_0x86cd('0x12'),controller[_0x86cd('0x13')]);router[_0x86cd('0xb')]('/:id/avatar',controller['getAvatar']);router['get'](_0x86cd('0x14'),controller[_0x86cd('0x15')]);router[_0x86cd('0xb')]('/:id/system_avatar',controller[_0x86cd('0x16')]);router[_0x86cd('0xb')](_0x86cd('0x17'),auth[_0x86cd('0x9')](),controller[_0x86cd('0x18')]);router[_0x86cd('0xb')]('/:id/snippet',controller[_0x86cd('0x19')]);router['get'](_0x86cd('0x1a'),auth[_0x86cd('0x9')](),controller['getApplications']);router['get'](_0x86cd('0x1b'),auth['isAuthenticated'](),controller[_0x86cd('0x1c')]);router[_0x86cd('0xb')]('/:id/fields',controller[_0x86cd('0x1d')]);router[_0x86cd('0xb')](_0x86cd('0x1e'),auth[_0x86cd('0x9')](),controller['getOfflineMessages']);router['get'](_0x86cd('0x1f'),auth[_0x86cd('0x9')](),controller[_0x86cd('0x20')]);router[_0x86cd('0x21')]('/',auth['isAuthenticated'](),controller[_0x86cd('0x22')]);router[_0x86cd('0x21')](_0x86cd('0x10'),auth['isAuthenticated'](),controller[_0x86cd('0x23')]);router[_0x86cd('0x21')](_0x86cd('0x24'),auth['isAuthenticated'](),controller[_0x86cd('0x25')]);var upload=multer({'storage':multer[_0x86cd('0x26')]({'destination':function(_0x1c7521,_0x1c6e0c,_0x2635fc){_0x2635fc(null,path[_0x86cd('0x27')](config[_0x86cd('0x28')],_0x86cd('0x29')));},'filename':function(_0x328fae,_0x52b725,_0xd2631){_0xd2631(null,util[_0x86cd('0x2a')](_0x86cd('0x2b'),Date[_0x86cd('0x2c')](),_0x52b725[_0x86cd('0x2d')]));}})});router['post'](_0x86cd('0x12'),upload['single'](_0x86cd('0x2e')),controller[_0x86cd('0x2f')]);var upload=multer({'storage':multer[_0x86cd('0x26')]({'destination':function(_0x32f1b2,_0x3097d6,_0x2ddb6b){_0x2ddb6b(null,path['join'](config[_0x86cd('0x28')],'server/files/images/avatars/'));},'filename':function(_0x55a430,_0x459021,_0x55daaf){_0x55daaf(null,util['format'](_0x86cd('0x2b'),Date['now'](),_0x459021[_0x86cd('0x2d')]));}})});router[_0x86cd('0x21')](_0x86cd('0x30'),upload[_0x86cd('0x31')](_0x86cd('0x2e')),controller[_0x86cd('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x20d103,_0x1d8799,_0x42a800){_0x42a800(null,path[_0x86cd('0x27')](config[_0x86cd('0x28')],_0x86cd('0x33')));},'filename':function(_0x551174,_0x5ee705,_0x92bab0){_0x92bab0(null,util[_0x86cd('0x2a')](_0x86cd('0x2b'),Date[_0x86cd('0x2c')](),_0x5ee705['originalname']));}})});router['post'](_0x86cd('0x14'),upload[_0x86cd('0x31')](_0x86cd('0x2e')),controller[_0x86cd('0x34')]);var upload=multer({'storage':multer[_0x86cd('0x26')]({'destination':function(_0x4bd43c,_0x5b4add,_0x3a31dc){_0x3a31dc(null,path[_0x86cd('0x27')](config[_0x86cd('0x28')],_0x86cd('0x33')));},'filename':function(_0x152fb5,_0x5938bf,_0x5e2815){_0x5e2815(null,util['format']('%s-%s',Date['now'](),_0x5938bf['originalname']));}})});router[_0x86cd('0x21')]('/:id/system_avatar',upload[_0x86cd('0x31')](_0x86cd('0x2e')),controller[_0x86cd('0x35')]);router[_0x86cd('0x21')](_0x86cd('0x36'),controller[_0x86cd('0x37')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x1f1f02,_0x48d418,_0x1d9b09){const _0x14f931=path[_0x86cd('0x27')](config[_0x86cd('0x28')],_0x86cd('0x38'),'attachments',_0x86cd('0x39'));fs_extra[_0x86cd('0x3a')](_0x14f931,function(){_0x1d9b09(null,_0x14f931);});},'filename':function(_0x142e1e,_0x242837,_0x4d29ec){const _0x1abc1e=_0x242837[_0x86cd('0x2d')][_0x86cd('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x759c3=path[_0x86cd('0x3c')](_0x1abc1e);const _0x35488e=Date[_0x86cd('0x2c')]()+'-'+_0x1abc1e[_0x86cd('0x3b')](_0x759c3,'')+_0x759c3;_0x4d29ec(null,_0x35488e);}})});router[_0x86cd('0x21')](_0x86cd('0x3d'),offlineUploadMulter['any'](),controller[_0x86cd('0x3e')]);router[_0x86cd('0x21')](_0x86cd('0x17'),auth[_0x86cd('0x9')](),controller[_0x86cd('0x3f')]);router[_0x86cd('0x21')]('/:id/applications',auth[_0x86cd('0x9')](),controller[_0x86cd('0x40')]);router[_0x86cd('0x21')]('/:id/proactive_actions',auth[_0x86cd('0x9')](),controller[_0x86cd('0x41')]);router[_0x86cd('0x21')](_0x86cd('0x1f'),auth[_0x86cd('0x9')](),controller['addAgents']);router[_0x86cd('0x42')](_0x86cd('0xe'),auth[_0x86cd('0x9')](),controller['update']);router['delete'](_0x86cd('0xe'),auth[_0x86cd('0x9')](),controller[_0x86cd('0x43')]);router[_0x86cd('0x44')](_0x86cd('0x10'),auth['isAuthenticated'](),controller[_0x86cd('0x45')]);router[_0x86cd('0x44')](_0x86cd('0x24'),auth[_0x86cd('0x9')](),controller[_0x86cd('0x46')]);router[_0x86cd('0x44')](_0x86cd('0x1f'),auth[_0x86cd('0x9')](),controller[_0x86cd('0x47')]);module['exports']=router; \ No newline at end of file +var _0xdf21=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','create','addDisposition','post','/:id/canned_answers','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','diskStorage','single','addCustomerAvatar','server/files/images/avatars/','addSystemAvatar','ensureDir','extname','replace','/:id/offline','any','offline','addInteraction','addApplications','/:id/users','addAgents','update','delete','removeDispositions','removeAnswers','removeAgents'];(function(_0x4be00d,_0x42686c){var _0x407e9f=function(_0x36f705){while(--_0x36f705){_0x4be00d['push'](_0x4be00d['shift']());}};_0x407e9f(++_0x42686c);}(_0xdf21,0xd6));var _0x1df2=function(_0x472fa2,_0x1596c3){_0x472fa2=_0x472fa2-0x0;var _0x6095c3=_0xdf21[_0x472fa2];return _0x6095c3;};'use strict';var multer=require(_0x1df2('0x0'));var util=require('util');var path=require(_0x1df2('0x1'));var timeout=require(_0x1df2('0x2'));var express=require(_0x1df2('0x3'));var router=express[_0x1df2('0x4')]();var fs_extra=require(_0x1df2('0x5'));var auth=require(_0x1df2('0x6'));var interaction=require(_0x1df2('0x7'));var config=require(_0x1df2('0x8'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x1df2('0x9')](),controller[_0x1df2('0xa')]);router[_0x1df2('0xb')](_0x1df2('0xc'),auth['isAuthenticated'](),controller[_0x1df2('0xd')]);router[_0x1df2('0xb')](_0x1df2('0xe'),auth['isAuthenticated'](),controller[_0x1df2('0xf')]);router['get'](_0x1df2('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x1df2('0xb')]('/:id/canned_answers',auth[_0x1df2('0x9')](),controller[_0x1df2('0x11')]);router['get'](_0x1df2('0x12'),controller[_0x1df2('0x13')]);router['get'](_0x1df2('0x14'),controller[_0x1df2('0x15')]);router[_0x1df2('0xb')](_0x1df2('0x16'),controller[_0x1df2('0x17')]);router['get'](_0x1df2('0x18'),controller[_0x1df2('0x19')]);router[_0x1df2('0xb')]('/:id/interactions',auth[_0x1df2('0x9')](),controller[_0x1df2('0x1a')]);router[_0x1df2('0xb')]('/:id/snippet',controller[_0x1df2('0x1b')]);router[_0x1df2('0xb')](_0x1df2('0x1c'),auth[_0x1df2('0x9')](),controller[_0x1df2('0x1d')]);router['get'](_0x1df2('0x1e'),auth[_0x1df2('0x9')](),controller[_0x1df2('0x1f')]);router[_0x1df2('0xb')](_0x1df2('0x20'),controller[_0x1df2('0x21')]);router[_0x1df2('0xb')](_0x1df2('0x22'),auth['isAuthenticated'](),controller[_0x1df2('0x23')]);router['get']('/:id/users',auth[_0x1df2('0x9')](),controller['getAgents']);router['post']('/',auth[_0x1df2('0x9')](),controller[_0x1df2('0x24')]);router['post'](_0x1df2('0x10'),auth[_0x1df2('0x9')](),controller[_0x1df2('0x25')]);router[_0x1df2('0x26')](_0x1df2('0x27'),auth[_0x1df2('0x9')](),controller[_0x1df2('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4553c3,_0x1b5e7d,_0x5b9313){_0x5b9313(null,path[_0x1df2('0x29')](config[_0x1df2('0x2a')],_0x1df2('0x2b')));},'filename':function(_0x35fd07,_0x3147cf,_0x267a0e){_0x267a0e(null,util[_0x1df2('0x2c')](_0x1df2('0x2d'),Date[_0x1df2('0x2e')](),_0x3147cf[_0x1df2('0x2f')]));}})});router['post'](_0x1df2('0x12'),upload['single'](_0x1df2('0x30')),controller[_0x1df2('0x31')]);var upload=multer({'storage':multer[_0x1df2('0x32')]({'destination':function(_0xe16ba6,_0x3cb093,_0x55d586){_0x55d586(null,path[_0x1df2('0x29')](config[_0x1df2('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x477dec,_0x239611,_0x4622d0){_0x4622d0(null,util[_0x1df2('0x2c')]('%s-%s',Date[_0x1df2('0x2e')](),_0x239611['originalname']));}})});router['post'](_0x1df2('0x14'),upload['single'](_0x1df2('0x30')),controller['addAvatar']);var upload=multer({'storage':multer[_0x1df2('0x32')]({'destination':function(_0x382ecc,_0x3992a8,_0xff2629){_0xff2629(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x5964bd,_0x5dd446,_0x56793d){_0x56793d(null,util[_0x1df2('0x2c')]('%s-%s',Date[_0x1df2('0x2e')](),_0x5dd446[_0x1df2('0x2f')]));}})});router['post'](_0x1df2('0x16'),upload[_0x1df2('0x33')](_0x1df2('0x30')),controller[_0x1df2('0x34')]);var upload=multer({'storage':multer[_0x1df2('0x32')]({'destination':function(_0x5cc9df,_0x3a67cb,_0x469551){_0x469551(null,path[_0x1df2('0x29')](config['root'],_0x1df2('0x35')));},'filename':function(_0x2fb8eb,_0x2e400c,_0x1b6daa){_0x1b6daa(null,util[_0x1df2('0x2c')](_0x1df2('0x2d'),Date['now'](),_0x2e400c['originalname']));}})});router[_0x1df2('0x26')](_0x1df2('0x18'),upload['single'](_0x1df2('0x30')),controller[_0x1df2('0x36')]);router[_0x1df2('0x26')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x1df2('0x32')]({'destination':function(_0xcd9437,_0x6a9f41,_0x347673){const _0x6fca34=path['join'](config[_0x1df2('0x2a')],'server/files','attachments','offline-chat');fs_extra[_0x1df2('0x37')](_0x6fca34,function(){_0x347673(null,_0x6fca34);});},'filename':function(_0x30dfed,_0x39bb1e,_0x3a842f){const _0x3247ff=_0x39bb1e[_0x1df2('0x2f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x872f3c=path[_0x1df2('0x38')](_0x3247ff);const _0x16db15=Date[_0x1df2('0x2e')]()+'-'+_0x3247ff[_0x1df2('0x39')](_0x872f3c,'')+_0x872f3c;_0x3a842f(null,_0x16db15);}})});router[_0x1df2('0x26')](_0x1df2('0x3a'),offlineUploadMulter[_0x1df2('0x3b')](),controller[_0x1df2('0x3c')]);router[_0x1df2('0x26')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x1df2('0x3d')]);router[_0x1df2('0x26')](_0x1df2('0x1c'),auth[_0x1df2('0x9')](),controller[_0x1df2('0x3e')]);router[_0x1df2('0x26')]('/:id/proactive_actions',auth[_0x1df2('0x9')](),controller['addProactiveActions']);router['post'](_0x1df2('0x3f'),auth[_0x1df2('0x9')](),controller[_0x1df2('0x40')]);router['put'](_0x1df2('0xe'),auth[_0x1df2('0x9')](),controller[_0x1df2('0x41')]);router[_0x1df2('0x42')](_0x1df2('0xe'),auth[_0x1df2('0x9')](),controller['destroy']);router['delete'](_0x1df2('0x10'),auth[_0x1df2('0x9')](),controller[_0x1df2('0x43')]);router[_0x1df2('0x42')]('/:id/canned_answers',auth[_0x1df2('0x9')](),controller[_0x1df2('0x44')]);router[_0x1df2('0x42')](_0x1df2('0x3f'),auth[_0x1df2('0x9')](),controller[_0x1df2('0x45')]);module[_0x1df2('0x46')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 921b549..7b09694 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 _0x0a1c=['STRING','ENUM','AmazonAWS'];(function(_0x280537,_0x1e941c){var _0x124a13=function(_0xbafd94){while(--_0xbafd94){_0x280537['push'](_0x280537['shift']());}};_0x124a13(++_0x1e941c);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0x0a1c[_0x3c81b5];return _0x5888c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc0a1('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc0a1('0x1')](_0xc0a1('0x2'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc0a1('0x0')]}}; \ No newline at end of file +var _0xfdcd=['Google','exports','STRING','ENUM'];(function(_0x183547,_0x3dafe5){var _0x2a83ca=function(_0x31e340){while(--_0x31e340){_0x183547['push'](_0x183547['shift']());}};_0x2a83ca(++_0x3dafe5);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0xdfdc('0x0')]={'name':{'type':Sequelize[_0xdfdc('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xdfdc('0x2')]('AmazonAWS',_0xdfdc('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xdfdc('0x1')]},'data2':{'type':Sequelize[_0xdfdc('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 989acc2..cae545b 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 _0xd0e2=['type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','update','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','error','stack','name','index','CloudProvider','fieldName'];(function(_0x3ad59b,_0x13aca3){var _0x453202=function(_0x177ab8){while(--_0x177ab8){_0x3ad59b['push'](_0x3ad59b['shift']());}};_0x453202(++_0x13aca3);}(_0xd0e2,0xfa));var _0x2d0e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd0e2[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2d0e('0x0'));var rimraf=require(_0x2d0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d0e('0x2'));var rp=require(_0x2d0e('0x3'));var moment=require(_0x2d0e('0x4'));var BPromise=require(_0x2d0e('0x5'));var Mustache=require(_0x2d0e('0x6'));var util=require(_0x2d0e('0x7'));var path=require(_0x2d0e('0x8'));var sox=require(_0x2d0e('0x9'));var csv=require(_0x2d0e('0xa'));var ejs=require(_0x2d0e('0xb'));var fs=require('fs');var fs_extra=require(_0x2d0e('0xc'));var _=require(_0x2d0e('0xd'));var squel=require(_0x2d0e('0xe'));var crypto=require(_0x2d0e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2d0e('0x10'));var toCsv=require(_0x2d0e('0xa'));var querystring=require('querystring');var Papa=require(_0x2d0e('0x11'));var Redis=require('ioredis');var authService=require(_0x2d0e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2d0e('0x13'));var hardwareService=require(_0x2d0e('0x14'));var logger=require('../../config/logger')(_0x2d0e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2d0e('0x16'))['db'];function respondWithStatusCode(_0x21d42d,_0x2a1533){_0x2a1533=_0x2a1533||0xcc;return function(_0x2abe5d){if(_0x2abe5d){return _0x21d42d[_0x2d0e('0x17')](_0x2a1533);}return _0x21d42d[_0x2d0e('0x18')](_0x2a1533)[_0x2d0e('0x19')]();};}function respondWithResult(_0x285cc4,_0x2f5b47){_0x2f5b47=_0x2f5b47||0xc8;return function(_0xc5afe2){if(_0xc5afe2){return _0x285cc4[_0x2d0e('0x18')](_0x2f5b47)[_0x2d0e('0x1a')](_0xc5afe2);}};}function respondWithFilteredResult(_0x385f8b,_0x445ff7){return function(_0x9a359a){if(_0x9a359a){var _0x1f8752=typeof _0x445ff7[_0x2d0e('0x1b')]===_0x2d0e('0x1c')&&typeof _0x445ff7[_0x2d0e('0x1d')]===_0x2d0e('0x1c');var _0x7428e4=_0x9a359a[_0x2d0e('0x1e')];var _0x4879ca=_0x1f8752?0x0:_0x445ff7[_0x2d0e('0x1b')];var _0x10f546=_0x1f8752?_0x9a359a['count']:_0x445ff7[_0x2d0e('0x1b')]+_0x445ff7[_0x2d0e('0x1d')];var _0x87e34a;if(_0x10f546>=_0x7428e4){_0x10f546=_0x7428e4;_0x87e34a=0xc8;}else{_0x87e34a=0xce;}_0x385f8b[_0x2d0e('0x18')](_0x87e34a);return _0x385f8b['set'](_0x2d0e('0x1f'),_0x4879ca+'-'+_0x10f546+'/'+_0x7428e4)[_0x2d0e('0x1a')](_0x9a359a);}return null;};}function patchUpdates(_0x8f9f43){return function(_0x38bb15){try{jsonpatch['apply'](_0x38bb15,_0x8f9f43,!![]);}catch(_0x30522b){return BPromise[_0x2d0e('0x20')](_0x30522b);}return _0x38bb15[_0x2d0e('0x21')]();};}function saveUpdates(_0x307846,_0x2435ba){return function(_0x593e19){if(_0x593e19){return _0x593e19['update'](_0x307846)[_0x2d0e('0x22')](function(_0x8d9e38){return _0x8d9e38;});}return null;};}function removeEntity(_0x2b9d0e,_0x1380c5){return function(_0x3d30a6){if(_0x3d30a6){return _0x3d30a6[_0x2d0e('0x23')]()['then'](function(){_0x2b9d0e[_0x2d0e('0x18')](0xcc)[_0x2d0e('0x19')]();});}};}function handleEntityNotFound(_0x53e31c,_0x148b53){return function(_0x47acab){if(!_0x47acab){_0x53e31c['sendStatus'](0x194);}return _0x47acab;};}function handleError(_0x46d798,_0x1daa02){_0x1daa02=_0x1daa02||0x1f4;return function(_0x4a6c12){logger[_0x2d0e('0x24')](_0x4a6c12[_0x2d0e('0x25')]);if(_0x4a6c12[_0x2d0e('0x26')]){delete _0x4a6c12[_0x2d0e('0x26')];}_0x46d798['status'](_0x1daa02)['send'](_0x4a6c12);};}exports[_0x2d0e('0x27')]=function(_0x343f17,_0x2ca4d4){var _0x12f64e={},_0x3e9b48={},_0x2fc4a7={'count':0x0,'rows':[]};var _0x240e6a=_['map'](db[_0x2d0e('0x28')]['rawAttributes'],function(_0x1b36cb){return{'name':_0x1b36cb[_0x2d0e('0x29')],'type':_0x1b36cb[_0x2d0e('0x2a')][_0x2d0e('0x2b')]};});_0x3e9b48[_0x2d0e('0x2c')]=_[_0x2d0e('0x2d')](_0x240e6a,_0x2d0e('0x26'));_0x3e9b48[_0x2d0e('0x2e')]=_[_0x2d0e('0x2f')](_0x343f17[_0x2d0e('0x2e')]);_0x3e9b48[_0x2d0e('0x30')]=_['intersection'](_0x3e9b48[_0x2d0e('0x2c')],_0x3e9b48[_0x2d0e('0x2e')]);_0x12f64e[_0x2d0e('0x31')]=_[_0x2d0e('0x32')](_0x3e9b48[_0x2d0e('0x2c')],qs[_0x2d0e('0x33')](_0x343f17[_0x2d0e('0x2e')]['fields']));_0x12f64e[_0x2d0e('0x31')]=_0x12f64e[_0x2d0e('0x31')][_0x2d0e('0x34')]?_0x12f64e['attributes']:_0x3e9b48[_0x2d0e('0x2c')];if(!_0x343f17[_0x2d0e('0x2e')]['hasOwnProperty'](_0x2d0e('0x35'))){_0x12f64e['limit']=qs[_0x2d0e('0x1d')](_0x343f17[_0x2d0e('0x2e')]['limit']);_0x12f64e[_0x2d0e('0x1b')]=qs[_0x2d0e('0x1b')](_0x343f17[_0x2d0e('0x2e')][_0x2d0e('0x1b')]);}_0x12f64e[_0x2d0e('0x36')]=qs[_0x2d0e('0x37')](_0x343f17['query'][_0x2d0e('0x37')]);_0x12f64e[_0x2d0e('0x38')]=qs[_0x2d0e('0x30')](_['pick'](_0x343f17[_0x2d0e('0x2e')],_0x3e9b48['filters']),_0x240e6a);if(_0x343f17['query'][_0x2d0e('0x39')]){_0x12f64e[_0x2d0e('0x38')]=_[_0x2d0e('0x3a')](_0x12f64e[_0x2d0e('0x38')],{'$or':_[_0x2d0e('0x2d')](_0x240e6a,function(_0x39b0d3){if(_0x39b0d3['type']!==_0x2d0e('0x3b')){var _0x1201e1={};_0x1201e1[_0x39b0d3[_0x2d0e('0x26')]]={'$like':'%'+_0x343f17['query'][_0x2d0e('0x39')]+'%'};return _0x1201e1;}})});}_0x12f64e=_[_0x2d0e('0x3a')]({},_0x12f64e,_0x343f17[_0x2d0e('0x3c')]);var _0x33ab51={'where':_0x12f64e[_0x2d0e('0x38')]};return db[_0x2d0e('0x28')][_0x2d0e('0x1e')](_0x33ab51)[_0x2d0e('0x22')](function(_0x440b3e){_0x2fc4a7['count']=_0x440b3e;if(_0x343f17[_0x2d0e('0x2e')][_0x2d0e('0x3d')]){_0x12f64e[_0x2d0e('0x3e')]=[{'all':!![]}];}return db[_0x2d0e('0x28')][_0x2d0e('0x3f')](_0x12f64e);})['then'](function(_0x1c31c1){_0x2fc4a7[_0x2d0e('0x40')]=_0x1c31c1;return _0x2fc4a7;})[_0x2d0e('0x22')](respondWithFilteredResult(_0x2ca4d4,_0x12f64e))[_0x2d0e('0x41')](handleError(_0x2ca4d4,null));};exports[_0x2d0e('0x42')]=function(_0x5b032d,_0x1fb02d){var _0x3666f8={'raw':!![],'where':{'id':_0x5b032d[_0x2d0e('0x43')]['id']}},_0x3ea101={};_0x3ea101['model']=_['keys'](db[_0x2d0e('0x28')][_0x2d0e('0x44')]);_0x3ea101[_0x2d0e('0x2e')]=_[_0x2d0e('0x2f')](_0x5b032d[_0x2d0e('0x2e')]);_0x3ea101[_0x2d0e('0x30')]=_[_0x2d0e('0x32')](_0x3ea101[_0x2d0e('0x2c')],_0x3ea101[_0x2d0e('0x2e')]);_0x3666f8[_0x2d0e('0x31')]=_[_0x2d0e('0x32')](_0x3ea101[_0x2d0e('0x2c')],qs[_0x2d0e('0x33')](_0x5b032d[_0x2d0e('0x2e')]['fields']));_0x3666f8[_0x2d0e('0x31')]=_0x3666f8[_0x2d0e('0x31')]['length']?_0x3666f8[_0x2d0e('0x31')]:_0x3ea101['model'];if(_0x5b032d[_0x2d0e('0x2e')][_0x2d0e('0x3d')]){_0x3666f8[_0x2d0e('0x3e')]=[{'all':!![]}];}_0x3666f8=_[_0x2d0e('0x3a')]({},_0x3666f8,_0x5b032d[_0x2d0e('0x3c')]);return db[_0x2d0e('0x28')]['find'](_0x3666f8)[_0x2d0e('0x22')](handleEntityNotFound(_0x1fb02d,null))['then'](respondWithResult(_0x1fb02d,null))[_0x2d0e('0x41')](handleError(_0x1fb02d,null));};exports[_0x2d0e('0x45')]=function(_0x5672f6,_0x502c32){return db[_0x2d0e('0x28')][_0x2d0e('0x45')](_0x5672f6['body'],{})[_0x2d0e('0x22')](respondWithResult(_0x502c32,0xc9))[_0x2d0e('0x41')](handleError(_0x502c32,null));};exports[_0x2d0e('0x46')]=function(_0x3a03cd,_0x5bee42){if(_0x3a03cd[_0x2d0e('0x47')]['id']){delete _0x3a03cd['body']['id'];}return db[_0x2d0e('0x28')][_0x2d0e('0x48')]({'where':{'id':_0x3a03cd['params']['id']}})[_0x2d0e('0x22')](handleEntityNotFound(_0x5bee42,null))[_0x2d0e('0x22')](saveUpdates(_0x3a03cd[_0x2d0e('0x47')],null))[_0x2d0e('0x22')](respondWithResult(_0x5bee42,null))[_0x2d0e('0x41')](handleError(_0x5bee42,null));};exports[_0x2d0e('0x23')]=function(_0xa30ebf,_0x5bec79){return db[_0x2d0e('0x28')][_0x2d0e('0x48')]({'where':{'id':_0xa30ebf[_0x2d0e('0x43')]['id']}})[_0x2d0e('0x22')](handleEntityNotFound(_0x5bec79,null))['then'](removeEntity(_0x5bec79,null))[_0x2d0e('0x41')](handleError(_0x5bec79,null));}; \ No newline at end of file +var _0xa375=['lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','body','eml-format','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xa375,0xdb));var _0x5a37=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0xa375[_0x2c6810];return _0x213881;};'use strict';var emlformat=require(_0x5a37('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a37('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a37('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5a37('0x3'));var util=require('util');var path=require(_0x5a37('0x4'));var sox=require(_0x5a37('0x5'));var csv=require(_0x5a37('0x6'));var ejs=require(_0x5a37('0x7'));var fs=require('fs');var fs_extra=require(_0x5a37('0x8'));var _=require(_0x5a37('0x9'));var squel=require(_0x5a37('0xa'));var crypto=require('crypto');var jsforce=require(_0x5a37('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5a37('0x6'));var querystring=require(_0x5a37('0xc'));var Papa=require(_0x5a37('0xd'));var Redis=require('ioredis');var authService=require(_0x5a37('0xe'));var qs=require(_0x5a37('0xf'));var as=require(_0x5a37('0x10'));var hardwareService=require(_0x5a37('0x11'));var logger=require('../../config/logger')(_0x5a37('0x12'));var utils=require(_0x5a37('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5a37('0x14'));var db=require(_0x5a37('0x15'))['db'];function respondWithStatusCode(_0x1a2e30,_0x4d909e){_0x4d909e=_0x4d909e||0xcc;return function(_0x4e2639){if(_0x4e2639){return _0x1a2e30[_0x5a37('0x16')](_0x4d909e);}return _0x1a2e30[_0x5a37('0x17')](_0x4d909e)[_0x5a37('0x18')]();};}function respondWithResult(_0x354d14,_0x45666f){_0x45666f=_0x45666f||0xc8;return function(_0x3d3bef){if(_0x3d3bef){return _0x354d14[_0x5a37('0x17')](_0x45666f)[_0x5a37('0x19')](_0x3d3bef);}};}function respondWithFilteredResult(_0x543f46,_0x38ebf2){return function(_0x4ea460){if(_0x4ea460){var _0x765783=typeof _0x38ebf2[_0x5a37('0x1a')]===_0x5a37('0x1b')&&typeof _0x38ebf2[_0x5a37('0x1c')]===_0x5a37('0x1b');var _0x4b3c9f=_0x4ea460[_0x5a37('0x1d')];var _0x114efe=_0x765783?0x0:_0x38ebf2['offset'];var _0x12b3df=_0x765783?_0x4ea460[_0x5a37('0x1d')]:_0x38ebf2[_0x5a37('0x1a')]+_0x38ebf2[_0x5a37('0x1c')];var _0x41c914;if(_0x12b3df>=_0x4b3c9f){_0x12b3df=_0x4b3c9f;_0x41c914=0xc8;}else{_0x41c914=0xce;}_0x543f46[_0x5a37('0x17')](_0x41c914);return _0x543f46[_0x5a37('0x1e')](_0x5a37('0x1f'),_0x114efe+'-'+_0x12b3df+'/'+_0x4b3c9f)[_0x5a37('0x19')](_0x4ea460);}return null;};}function patchUpdates(_0x1cb354){return function(_0x2c34a2){try{jsonpatch[_0x5a37('0x20')](_0x2c34a2,_0x1cb354,!![]);}catch(_0x4ea7e3){return BPromise[_0x5a37('0x21')](_0x4ea7e3);}return _0x2c34a2[_0x5a37('0x22')]();};}function saveUpdates(_0xb41fd9,_0x29dd1a){return function(_0x10a390){if(_0x10a390){return _0x10a390[_0x5a37('0x23')](_0xb41fd9)[_0x5a37('0x24')](function(_0x3acda6){return _0x3acda6;});}return null;};}function removeEntity(_0x31879a,_0x875ffb){return function(_0xefecf8){if(_0xefecf8){return _0xefecf8[_0x5a37('0x25')]()[_0x5a37('0x24')](function(){_0x31879a[_0x5a37('0x17')](0xcc)[_0x5a37('0x18')]();});}};}function handleEntityNotFound(_0x5b235e,_0x547c9a){return function(_0x22157b){if(!_0x22157b){_0x5b235e[_0x5a37('0x16')](0x194);}return _0x22157b;};}function handleError(_0x32bd24,_0x4de54d){_0x4de54d=_0x4de54d||0x1f4;return function(_0x2ba022){logger[_0x5a37('0x26')](_0x2ba022[_0x5a37('0x27')]);if(_0x2ba022[_0x5a37('0x28')]){delete _0x2ba022[_0x5a37('0x28')];}_0x32bd24[_0x5a37('0x17')](_0x4de54d)[_0x5a37('0x29')](_0x2ba022);};}exports[_0x5a37('0x2a')]=function(_0xf0d1b8,_0x5887fe){var _0x1ddb01={},_0x28ed41={},_0x346c52={'count':0x0,'rows':[]};var _0x2410fb=_[_0x5a37('0x2b')](db[_0x5a37('0x2c')][_0x5a37('0x2d')],function(_0x4f9f36){return{'name':_0x4f9f36[_0x5a37('0x2e')],'type':_0x4f9f36[_0x5a37('0x2f')][_0x5a37('0x30')]};});_0x28ed41[_0x5a37('0x31')]=_[_0x5a37('0x2b')](_0x2410fb,_0x5a37('0x28'));_0x28ed41[_0x5a37('0x32')]=_[_0x5a37('0x33')](_0xf0d1b8['query']);_0x28ed41[_0x5a37('0x34')]=_[_0x5a37('0x35')](_0x28ed41[_0x5a37('0x31')],_0x28ed41[_0x5a37('0x32')]);_0x1ddb01[_0x5a37('0x36')]=_[_0x5a37('0x35')](_0x28ed41[_0x5a37('0x31')],qs[_0x5a37('0x37')](_0xf0d1b8[_0x5a37('0x32')][_0x5a37('0x37')]));_0x1ddb01[_0x5a37('0x36')]=_0x1ddb01[_0x5a37('0x36')][_0x5a37('0x38')]?_0x1ddb01[_0x5a37('0x36')]:_0x28ed41['model'];if(!_0xf0d1b8[_0x5a37('0x32')][_0x5a37('0x39')](_0x5a37('0x3a'))){_0x1ddb01[_0x5a37('0x1c')]=qs[_0x5a37('0x1c')](_0xf0d1b8['query'][_0x5a37('0x1c')]);_0x1ddb01[_0x5a37('0x1a')]=qs[_0x5a37('0x1a')](_0xf0d1b8[_0x5a37('0x32')]['offset']);}_0x1ddb01[_0x5a37('0x3b')]=qs[_0x5a37('0x3c')](_0xf0d1b8[_0x5a37('0x32')][_0x5a37('0x3c')]);_0x1ddb01[_0x5a37('0x3d')]=qs['filters'](_[_0x5a37('0x3e')](_0xf0d1b8[_0x5a37('0x32')],_0x28ed41[_0x5a37('0x34')]),_0x2410fb);if(_0xf0d1b8[_0x5a37('0x32')][_0x5a37('0x3f')]){_0x1ddb01[_0x5a37('0x3d')]=_[_0x5a37('0x40')](_0x1ddb01[_0x5a37('0x3d')],{'$or':_['map'](_0x2410fb,function(_0x1bb985){if(_0x1bb985[_0x5a37('0x2f')]!==_0x5a37('0x41')){var _0xa19dfa={};_0xa19dfa[_0x1bb985[_0x5a37('0x28')]]={'$like':'%'+_0xf0d1b8[_0x5a37('0x32')][_0x5a37('0x3f')]+'%'};return _0xa19dfa;}})});}_0x1ddb01=_['merge']({},_0x1ddb01,_0xf0d1b8['options']);var _0x37b9ae={'where':_0x1ddb01['where']};return db['CloudProvider'][_0x5a37('0x1d')](_0x37b9ae)[_0x5a37('0x24')](function(_0x1d2592){_0x346c52[_0x5a37('0x1d')]=_0x1d2592;if(_0xf0d1b8[_0x5a37('0x32')][_0x5a37('0x42')]){_0x1ddb01['include']=[{'all':!![]}];}return db[_0x5a37('0x2c')]['findAll'](_0x1ddb01);})[_0x5a37('0x24')](function(_0x46ad12){_0x346c52[_0x5a37('0x43')]=_0x46ad12;return _0x346c52;})[_0x5a37('0x24')](respondWithFilteredResult(_0x5887fe,_0x1ddb01))[_0x5a37('0x44')](handleError(_0x5887fe,null));};exports[_0x5a37('0x45')]=function(_0x543640,_0x179dca){var _0x387334={'raw':!![],'where':{'id':_0x543640[_0x5a37('0x46')]['id']}},_0x4e3ce4={};_0x4e3ce4[_0x5a37('0x31')]=_[_0x5a37('0x33')](db['CloudProvider'][_0x5a37('0x2d')]);_0x4e3ce4[_0x5a37('0x32')]=_[_0x5a37('0x33')](_0x543640[_0x5a37('0x32')]);_0x4e3ce4['filters']=_[_0x5a37('0x35')](_0x4e3ce4[_0x5a37('0x31')],_0x4e3ce4[_0x5a37('0x32')]);_0x387334[_0x5a37('0x36')]=_[_0x5a37('0x35')](_0x4e3ce4[_0x5a37('0x31')],qs[_0x5a37('0x37')](_0x543640['query'][_0x5a37('0x37')]));_0x387334[_0x5a37('0x36')]=_0x387334[_0x5a37('0x36')]['length']?_0x387334[_0x5a37('0x36')]:_0x4e3ce4['model'];if(_0x543640[_0x5a37('0x32')][_0x5a37('0x42')]){_0x387334[_0x5a37('0x47')]=[{'all':!![]}];}_0x387334=_[_0x5a37('0x40')]({},_0x387334,_0x543640[_0x5a37('0x48')]);return db[_0x5a37('0x2c')][_0x5a37('0x49')](_0x387334)[_0x5a37('0x24')](handleEntityNotFound(_0x179dca,null))[_0x5a37('0x24')](respondWithResult(_0x179dca,null))[_0x5a37('0x44')](handleError(_0x179dca,null));};exports[_0x5a37('0x4a')]=function(_0x10e542,_0xeab0a8){return db[_0x5a37('0x2c')][_0x5a37('0x4a')](_0x10e542[_0x5a37('0x4b')],{})[_0x5a37('0x24')](respondWithResult(_0xeab0a8,0xc9))['catch'](handleError(_0xeab0a8,null));};exports['update']=function(_0x4ab720,_0x141989){if(_0x4ab720[_0x5a37('0x4b')]['id']){delete _0x4ab720['body']['id'];}return db[_0x5a37('0x2c')]['find']({'where':{'id':_0x4ab720[_0x5a37('0x46')]['id']}})['then'](handleEntityNotFound(_0x141989,null))[_0x5a37('0x24')](saveUpdates(_0x4ab720[_0x5a37('0x4b')],null))[_0x5a37('0x24')](respondWithResult(_0x141989,null))[_0x5a37('0x44')](handleError(_0x141989,null));};exports[_0x5a37('0x25')]=function(_0x4a716f,_0x2b2524){return db[_0x5a37('0x2c')][_0x5a37('0x49')]({'where':{'id':_0x4a716f[_0x5a37('0x46')]['id']}})['then'](handleEntityNotFound(_0x2b2524,null))['then'](removeEntity(_0x2b2524,null))['catch'](handleError(_0x2b2524,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 43007f3..f394808 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 _0x401a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash'];(function(_0x4f067e,_0x406536){var _0x3930d1=function(_0x326249){while(--_0x326249){_0x4f067e['push'](_0x4f067e['shift']());}};_0x3930d1(++_0x406536);}(_0x401a,0x1ac));var _0xa401=function(_0x438237,_0x4e3e20){_0x438237=_0x438237-0x0;var _0x292113=_0x401a[_0x438237];return _0x292113;};'use strict';var _=require(_0xa401('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa401('0x1'));var moment=require(_0xa401('0x2'));var BPromise=require(_0xa401('0x3'));var rp=require(_0xa401('0x4'));var fs=require('fs');var path=require(_0xa401('0x5'));var rimraf=require(_0xa401('0x6'));var config=require(_0xa401('0x7'));var attributes=require(_0xa401('0x8'));module[_0xa401('0x9')]=function(_0x1051be,_0x10d0d0){return _0x1051be[_0xa401('0xa')](_0xa401('0xb'),attributes,{'tableName':_0xa401('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ef=['../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x18d6a4,_0x4c3f2d){var _0x313355=function(_0x33ca48){while(--_0x33ca48){_0x18d6a4['push'](_0x18d6a4['shift']());}};_0x313355(++_0x4c3f2d);}(_0x71ef,0xf4));var _0xf71e=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x71ef[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xf71e('0x0'));var util=require(_0xf71e('0x1'));var logger=require(_0xf71e('0x2'))('api');var moment=require(_0xf71e('0x3'));var BPromise=require(_0xf71e('0x4'));var rp=require(_0xf71e('0x5'));var fs=require('fs');var path=require(_0xf71e('0x6'));var rimraf=require(_0xf71e('0x7'));var config=require(_0xf71e('0x8'));var attributes=require(_0xf71e('0x9'));module[_0xf71e('0xa')]=function(_0x2f27cf,_0x5a21d8){return _0x2f27cf[_0xf71e('0xb')](_0xf71e('0xc'),attributes,{'tableName':_0xf71e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index dcecfb3..5e936e9 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 _0xbe0d=['message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x2519a1,_0x1e92f5){var _0x335f4c=function(_0x4a2361){while(--_0x4a2361){_0x2519a1['push'](_0x2519a1['shift']());}};_0x335f4c(++_0x1e92f5);}(_0xbe0d,0x157));var _0xdbe0=function(_0x35b395,_0x5561a8){_0x35b395=_0x35b395-0x0;var _0x28c3f7=_0xbe0d[_0x35b395];return _0x28c3f7;};'use strict';var _=require(_0xdbe0('0x0'));var util=require(_0xdbe0('0x1'));var moment=require(_0xdbe0('0x2'));var BPromise=require(_0xdbe0('0x3'));var rs=require(_0xdbe0('0x4'));var fs=require('fs');var Redis=require(_0xdbe0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdbe0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xdbe0('0x7'));var jayson=require(_0xdbe0('0x8'));var client=jayson[_0xdbe0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x401856,_0x4f4ed5,_0x310b89){return new BPromise(function(_0x4a7cd8,_0xbfc1bf){return client[_0xdbe0('0xa')](_0x401856,_0x310b89)[_0xdbe0('0xb')](function(_0xb08f1a){logger[_0xdbe0('0xc')](_0xdbe0('0xd'),_0x4f4ed5,'request\x20sent');logger[_0xdbe0('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x4f4ed5,_0xdbe0('0xf'),JSON[_0xdbe0('0x10')](_0xb08f1a));if(_0xb08f1a['error']){if(_0xb08f1a[_0xdbe0('0x11')]['code']===0x1f4){logger[_0xdbe0('0x11')](_0xdbe0('0xd'),_0x4f4ed5,_0xb08f1a['error']['message']);return _0xbfc1bf(_0xb08f1a[_0xdbe0('0x11')]['message']);}logger['error'](_0xdbe0('0xd'),_0x4f4ed5,_0xb08f1a['error'][_0xdbe0('0x12')]);return _0x4a7cd8(_0xb08f1a['error'][_0xdbe0('0x12')]);}else{logger[_0xdbe0('0xc')](_0xdbe0('0xd'),_0x4f4ed5,'request\x20sent');_0x4a7cd8(_0xb08f1a['result'][_0xdbe0('0x12')]);}})['catch'](function(_0x37c52d){logger['error']('CloudProvider,\x20%s,\x20%s',_0x4f4ed5,_0x37c52d);_0xbfc1bf(_0x37c52d);});});} \ No newline at end of file +var _0x8555=['../../config/utils','rpc','../../config/environment','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2cf437,_0x5b0508){var _0x2f1fd2=function(_0x30f000){while(--_0x30f000){_0x2cf437['push'](_0x2cf437['shift']());}};_0x2f1fd2(++_0x5b0508);}(_0x8555,0x19f));var _0x5855=function(_0x7f305c,_0x3a802f){_0x7f305c=_0x7f305c-0x0;var _0x3dbbae=_0x8555[_0x7f305c];return _0x3dbbae;};'use strict';var _=require(_0x5855('0x0'));var util=require('util');var moment=require(_0x5855('0x1'));var BPromise=require(_0x5855('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5855('0x3'));var db=require(_0x5855('0x4'))['db'];var utils=require(_0x5855('0x5'));var logger=require('../../config/logger')(_0x5855('0x6'));var config=require(_0x5855('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5855('0x8')][_0x5855('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x209220,_0x50b353,_0x44cdbc){return new BPromise(function(_0x23a6e0,_0x2c1654){return client['request'](_0x209220,_0x44cdbc)[_0x5855('0xa')](function(_0x3eaad8){logger[_0x5855('0xb')](_0x5855('0xc'),_0x50b353,_0x5855('0xd'));logger[_0x5855('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x50b353,_0x5855('0xd'),JSON[_0x5855('0xf')](_0x3eaad8));if(_0x3eaad8[_0x5855('0x10')]){if(_0x3eaad8['error'][_0x5855('0x11')]===0x1f4){logger[_0x5855('0x10')](_0x5855('0xc'),_0x50b353,_0x3eaad8[_0x5855('0x10')][_0x5855('0x12')]);return _0x2c1654(_0x3eaad8[_0x5855('0x10')]['message']);}logger[_0x5855('0x10')](_0x5855('0xc'),_0x50b353,_0x3eaad8[_0x5855('0x10')][_0x5855('0x12')]);return _0x23a6e0(_0x3eaad8[_0x5855('0x10')][_0x5855('0x12')]);}else{logger[_0x5855('0xb')](_0x5855('0xc'),_0x50b353,_0x5855('0xd'));_0x23a6e0(_0x3eaad8[_0x5855('0x13')][_0x5855('0x12')]);}})['catch'](function(_0x332258){logger[_0x5855('0x10')](_0x5855('0xc'),_0x50b353,_0x332258);_0x2c1654(_0x332258);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 51005ec..1add726 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 _0x7bf2=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','update','delete'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7bf2,0xc8));var _0x27bf=function(_0x3bd1f4,_0x51945c){_0x3bd1f4=_0x3bd1f4-0x0;var _0x2e63c9=_0x7bf2[_0x3bd1f4];return _0x2e63c9;};'use strict';var multer=require(_0x27bf('0x0'));var util=require(_0x27bf('0x1'));var path=require('path');var timeout=require(_0x27bf('0x2'));var express=require(_0x27bf('0x3'));var router=express[_0x27bf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x27bf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x27bf('0x6'));var controller=require(_0x27bf('0x7'));router[_0x27bf('0x8')]('/',auth[_0x27bf('0x9')](),controller[_0x27bf('0xa')]);router[_0x27bf('0x8')](_0x27bf('0xb'),auth[_0x27bf('0x9')](),controller[_0x27bf('0xc')]);router[_0x27bf('0xd')]('/',auth[_0x27bf('0x9')](),controller['create']);router['put'](_0x27bf('0xb'),auth[_0x27bf('0x9')](),controller[_0x27bf('0xe')]);router[_0x27bf('0xf')](_0x27bf('0xb'),auth['isAuthenticated'](),controller[_0x27bf('0x10')]);module[_0x27bf('0x11')]=router; \ No newline at end of file +var _0x85f8=['Router','fs-extra','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x45647b,_0x3df179){var _0x3fd467=function(_0x592979){while(--_0x592979){_0x45647b['push'](_0x45647b['shift']());}};_0x3fd467(++_0x3df179);}(_0x85f8,0xd7));var _0x885f=function(_0x1d7004,_0x577617){_0x1d7004=_0x1d7004-0x0;var _0x5d075e=_0x85f8[_0x1d7004];return _0x5d075e;};'use strict';var multer=require(_0x885f('0x0'));var util=require(_0x885f('0x1'));var path=require(_0x885f('0x2'));var timeout=require(_0x885f('0x3'));var express=require(_0x885f('0x4'));var router=express[_0x885f('0x5')]();var fs_extra=require(_0x885f('0x6'));var auth=require(_0x885f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x885f('0x8'));var controller=require(_0x885f('0x9'));router[_0x885f('0xa')]('/',auth['isAuthenticated'](),controller[_0x885f('0xb')]);router[_0x885f('0xa')](_0x885f('0xc'),auth[_0x885f('0xd')](),controller[_0x885f('0xe')]);router[_0x885f('0xf')]('/',auth[_0x885f('0xd')](),controller[_0x885f('0x10')]);router[_0x885f('0x11')](_0x885f('0xc'),auth[_0x885f('0xd')](),controller[_0x885f('0x12')]);router[_0x885f('0x13')](_0x885f('0xc'),auth['isAuthenticated'](),controller[_0x885f('0x14')]);module[_0x885f('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 28840e3..5d75bcb 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 _0x4caf=['STRING','exports','name'];(function(_0x5a9368,_0x575133){var _0x3d9a54=function(_0x44e838){while(--_0x44e838){_0x5a9368['push'](_0x5a9368['shift']());}};_0x3d9a54(++_0x575133);}(_0x4caf,0x1ed));var _0xf4ca=function(_0x140acf,_0x3ba030){_0x140acf=_0x140acf-0x0;var _0xbca81c=_0x4caf[_0x140acf];return _0xbca81c;};'use strict';var Sequelize=require('sequelize');module[_0xf4ca('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xf4ca('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf4ca('0x2')]},'companyId':{'type':Sequelize[_0xf4ca('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xf4ca('0x2')]},'fax':{'type':Sequelize[_0xf4ca('0x2')]},'type':{'type':Sequelize[_0xf4ca('0x2')]},'street':{'type':Sequelize[_0xf4ca('0x2')]},'postalCode':{'type':Sequelize[_0xf4ca('0x2')]},'city':{'type':Sequelize[_0xf4ca('0x2')]},'country':{'type':Sequelize[_0xf4ca('0x2')]},'email':{'type':Sequelize[_0xf4ca('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xf4ca('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xf4ca('0x2')]},'sCountry':{'type':Sequelize[_0xf4ca('0x2')]},'description':{'type':Sequelize[_0xf4ca('0x2')]}}; \ No newline at end of file +var _0x2af5=['exports','STRING','sequelize'];(function(_0x329444,_0x20eeb5){var _0x483227=function(_0x301781){while(--_0x301781){_0x329444['push'](_0x329444['shift']());}};_0x483227(++_0x20eeb5);}(_0x2af5,0x12b));var _0x52af=function(_0x4d230c,_0x3862fd){_0x4d230c=_0x4d230c-0x0;var _0x16b044=_0x2af5[_0x4d230c];return _0x16b044;};'use strict';var Sequelize=require(_0x52af('0x0'));module[_0x52af('0x1')]={'name':{'type':Sequelize[_0x52af('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x52af('0x2')]},'companyId':{'type':Sequelize[_0x52af('0x2')]},'website':{'type':Sequelize[_0x52af('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x52af('0x2')]},'type':{'type':Sequelize[_0x52af('0x2')]},'street':{'type':Sequelize[_0x52af('0x2')]},'postalCode':{'type':Sequelize[_0x52af('0x2')]},'city':{'type':Sequelize[_0x52af('0x2')]},'country':{'type':Sequelize[_0x52af('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x52af('0x2')]},'sStreet':{'type':Sequelize[_0x52af('0x2')]},'sPostalCode':{'type':Sequelize[_0x52af('0x2')]},'sCity':{'type':Sequelize[_0x52af('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x52af('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index ddbbe56..446764f 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 _0x757a=['../../config/license/hardware','../../config/logger','api','status','json','offset','undefined','count','limit','Content-Range','apply','update','then','get','Companies','UserProfileResource','destroy','end','error','name','send','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','addContacts','CmContact','omit','ids','getContacts','findOne','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1118c3,_0x3d90ac){var _0x4a651a=function(_0x2d6164){while(--_0x2d6164){_0x1118c3['push'](_0x1118c3['shift']());}};_0x4a651a(++_0x3d90ac);}(_0x757a,0xde));var _0xa757=function(_0x288ead,_0x1fd214){_0x288ead=_0x288ead-0x0;var _0x4d6b59=_0x757a[_0x288ead];return _0x4d6b59;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db68e,_0x421040){_0x421040=_0x421040||0xcc;return function(_0x544b45){if(_0x544b45){return _0x4db68e['sendStatus'](_0x421040);}return _0x4db68e[_0xa757('0x15')](_0x421040)['end']();};}function respondWithResult(_0x481508,_0x32112b){_0x32112b=_0x32112b||0xc8;return function(_0x1b670e){if(_0x1b670e){return _0x481508[_0xa757('0x15')](_0x32112b)[_0xa757('0x16')](_0x1b670e);}};}function respondWithFilteredResult(_0x86abd,_0x31cfd2){return function(_0xf12b68){if(_0xf12b68){var _0x2f7947=typeof _0x31cfd2[_0xa757('0x17')]===_0xa757('0x18')&&typeof _0x31cfd2['limit']===_0xa757('0x18');var _0x44eab8=_0xf12b68[_0xa757('0x19')];var _0x4d9f58=_0x2f7947?0x0:_0x31cfd2['offset'];var _0x151c04=_0x2f7947?_0xf12b68[_0xa757('0x19')]:_0x31cfd2[_0xa757('0x17')]+_0x31cfd2[_0xa757('0x1a')];var _0x27f4ba;if(_0x151c04>=_0x44eab8){_0x151c04=_0x44eab8;_0x27f4ba=0xc8;}else{_0x27f4ba=0xce;}_0x86abd[_0xa757('0x15')](_0x27f4ba);return _0x86abd['set'](_0xa757('0x1b'),_0x4d9f58+'-'+_0x151c04+'/'+_0x44eab8)['json'](_0xf12b68);}return null;};}function patchUpdates(_0x32c2a1){return function(_0x167640){try{jsonpatch[_0xa757('0x1c')](_0x167640,_0x32c2a1,!![]);}catch(_0x2c9ec6){return BPromise['reject'](_0x2c9ec6);}return _0x167640['save']();};}function saveUpdates(_0x40ec48,_0x2159cf){return function(_0x2ba923){if(_0x2ba923){return _0x2ba923[_0xa757('0x1d')](_0x40ec48)[_0xa757('0x1e')](function(_0x40562f){return _0x40562f;});}return null;};}function removeEntity(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(_0x2bf276){return _0x2bf276['destroy']()[_0xa757('0x1e')](function(){var _0x59e9d4=_0x2bf276[_0xa757('0x1f')]({'plain':!![]});var _0x47903b=_0xa757('0x20');return db[_0xa757('0x21')][_0xa757('0x22')]({'where':{'type':_0x47903b,'resourceId':_0x59e9d4['id']}})['then'](function(){return _0x2bf276;});})[_0xa757('0x1e')](function(){_0x2ca10d[_0xa757('0x15')](0xcc)[_0xa757('0x23')]();});}};}function handleEntityNotFound(_0x3bf7f3,_0x5b4779){return function(_0x449a7d){if(!_0x449a7d){_0x3bf7f3['sendStatus'](0x194);}return _0x449a7d;};}function handleError(_0x5a5664,_0x54b75e){_0x54b75e=_0x54b75e||0x1f4;return function(_0x4f8de2){logger[_0xa757('0x24')](_0x4f8de2['stack']);if(_0x4f8de2[_0xa757('0x25')]){delete _0x4f8de2[_0xa757('0x25')];}_0x5a5664['status'](_0x54b75e)[_0xa757('0x26')](_0x4f8de2);};}exports['index']=function(_0x2c4823,_0xa6d0f6){var _0x5307c3={},_0x235e54={},_0x5ade7b={'count':0x0,'rows':[]};return db[_0xa757('0x27')][_0xa757('0x28')]()[_0xa757('0x1e')](function(_0x300dc4){_0x235e54[_0xa757('0x29')]=_[_0xa757('0x2a')](_0x300dc4);_0x235e54[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x2c4823[_0xa757('0x2b')]);_0x235e54[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x235e54[_0xa757('0x29')],_0x235e54[_0xa757('0x2b')]);_0x5307c3[_0xa757('0x2e')]=_[_0xa757('0x2d')](_0x235e54[_0xa757('0x29')],qs[_0xa757('0x2f')](_0x2c4823[_0xa757('0x2b')][_0xa757('0x2f')]));_0x5307c3[_0xa757('0x2e')]=_0x5307c3[_0xa757('0x2e')][_0xa757('0x30')]?_0x5307c3[_0xa757('0x2e')]:_0x235e54[_0xa757('0x29')];if(!_0x2c4823['query'][_0xa757('0x31')](_0xa757('0x32'))){_0x5307c3[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x2c4823[_0xa757('0x2b')]['limit']);_0x5307c3[_0xa757('0x17')]=qs[_0xa757('0x17')](_0x2c4823[_0xa757('0x2b')][_0xa757('0x17')]);}_0x5307c3[_0xa757('0x33')]=qs[_0xa757('0x34')](_0x2c4823['query'][_0xa757('0x34')]);_0x5307c3[_0xa757('0x35')]=qs[_0xa757('0x2c')](_[_0xa757('0x36')](_0x2c4823[_0xa757('0x2b')],_0x235e54[_0xa757('0x2c')]),_0x300dc4);if(_0x2c4823[_0xa757('0x2b')][_0xa757('0x37')]){_0x5307c3[_0xa757('0x35')]=_['merge'](_0x5307c3[_0xa757('0x35')],{'$or':_[_0xa757('0x38')](_0x5307c3[_0xa757('0x2e')],function(_0x35c15a){var _0x2531be={};_0x2531be[_0x35c15a]={'$like':'%'+_0x2c4823[_0xa757('0x2b')]['filter']+'%'};return _0x2531be;})});}_0x5307c3=_[_0xa757('0x39')]({},_0x5307c3,_0x2c4823[_0xa757('0x3a')]);var _0x48cde9={'where':_0x5307c3['where']};return db[_0xa757('0x27')][_0xa757('0x19')](_0x48cde9)['then'](function(_0x51c3d1){_0x5ade7b[_0xa757('0x19')]=_0x51c3d1;if(_0x2c4823[_0xa757('0x2b')][_0xa757('0x3b')]){_0x5307c3['include']=[{'all':!![]}];}return db[_0xa757('0x27')][_0xa757('0x3c')](_0x5307c3);})[_0xa757('0x1e')](function(_0x1ba399){_0x5ade7b[_0xa757('0x3d')]=_0x1ba399;return _0x5ade7b;})['then'](respondWithFilteredResult(_0xa6d0f6,_0x5307c3))[_0xa757('0x3e')](handleError(_0xa6d0f6,null));})['catch'](handleError(_0xa6d0f6,null));};exports['show']=function(_0x43329c,_0x57298b){var _0x373747={'raw':![],'where':{'id':_0x43329c[_0xa757('0x3f')]['id']}},_0x626b1f={};_0x626b1f['model']=_['keys'](db[_0xa757('0x27')][_0xa757('0x40')]);_0x626b1f[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x43329c[_0xa757('0x2b')]);_0x626b1f[_0xa757('0x2c')]=_['intersection'](_0x626b1f[_0xa757('0x29')],_0x626b1f[_0xa757('0x2b')]);_0x373747['attributes']=_[_0xa757('0x2d')](_0x626b1f['model'],qs[_0xa757('0x2f')](_0x43329c[_0xa757('0x2b')]['fields']));_0x373747[_0xa757('0x2e')]=_0x373747[_0xa757('0x2e')]['length']?_0x373747[_0xa757('0x2e')]:_0x626b1f[_0xa757('0x29')];if(_0x43329c[_0xa757('0x2b')][_0xa757('0x3b')]){_0x373747['include']=[{'all':!![]}];}_0x373747=_[_0xa757('0x39')]({},_0x373747,_0x43329c[_0xa757('0x3a')]);return db[_0xa757('0x27')][_0xa757('0x41')](_0x373747)['then'](handleEntityNotFound(_0x57298b,null))[_0xa757('0x1e')](respondWithResult(_0x57298b,null))['catch'](handleError(_0x57298b,null));};exports['create']=function(_0x2acf88,_0x3c039d){return db[_0xa757('0x27')]['create'](_0x2acf88[_0xa757('0x42')],{})['then'](function(_0x2ed63f){var _0x151cc3=_0x2acf88[_0xa757('0x43')][_0xa757('0x1f')]({'plain':!![]});if(!_0x151cc3)throw new Error(_0xa757('0x44'));if(_0x151cc3[_0xa757('0x45')]===_0xa757('0x43')){var _0x505cd=_0x2ed63f['get']({'plain':!![]});var _0x2de226=_0xa757('0x20');return db[_0xa757('0x46')][_0xa757('0x41')]({'where':{'name':_0x2de226,'userProfileId':_0x151cc3[_0xa757('0x47')]},'raw':!![]})[_0xa757('0x1e')](function(_0x15bad7){if(_0x15bad7&&_0x15bad7[_0xa757('0x48')]===0x0){return db[_0xa757('0x21')][_0xa757('0x49')]({'name':_0x505cd[_0xa757('0x25')],'resourceId':_0x505cd['id'],'type':_0x15bad7[_0xa757('0x25')],'sectionId':_0x15bad7['id']},{})[_0xa757('0x1e')](function(){return _0x2ed63f;});}else{return _0x2ed63f;}})[_0xa757('0x3e')](function(_0x388573){logger[_0xa757('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x388573);throw _0x388573;});}return _0x2ed63f;})[_0xa757('0x1e')](respondWithResult(_0x3c039d,0xc9))['catch'](handleError(_0x3c039d,null));};exports[_0xa757('0x1d')]=function(_0x311c25,_0xa89d24){if(_0x311c25[_0xa757('0x42')]['id']){delete _0x311c25['body']['id'];}return db[_0xa757('0x27')][_0xa757('0x41')]({'where':{'id':_0x311c25[_0xa757('0x3f')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0xa89d24,null))['then'](saveUpdates(_0x311c25[_0xa757('0x42')],null))[_0xa757('0x1e')](respondWithResult(_0xa89d24,null))[_0xa757('0x3e')](handleError(_0xa89d24,null));};exports[_0xa757('0x22')]=function(_0x33666d,_0x291b26){return db['CmCompany']['find']({'where':{'id':_0x33666d['params']['id']}})['then'](handleEntityNotFound(_0x291b26,null))[_0xa757('0x1e')](removeEntity(_0x291b26,null))[_0xa757('0x3e')](handleError(_0x291b26,null));};exports[_0xa757('0x28')]=function(_0x32313b,_0x1e31ef){return db[_0xa757('0x27')]['describe']()[_0xa757('0x1e')](respondWithResult(_0x1e31ef,null))[_0xa757('0x3e')](handleError(_0x1e31ef,null));};exports[_0xa757('0x4a')]=function(_0x29b2f5,_0x48b578,_0x26c74e){return db[_0xa757('0x4b')]['find']({'where':{'id':_0x29b2f5[_0xa757('0x3f')]['id']}})['then'](handleEntityNotFound(_0x48b578,null))[_0xa757('0x1e')](function(_0x5d375c){if(_0x5d375c){return _0x5d375c[_0xa757('0x4a')](_0x29b2f5['body']['ids'],_[_0xa757('0x4c')](_0x29b2f5[_0xa757('0x42')],[_0xa757('0x4d'),'id'])||{});}})[_0xa757('0x1e')](respondWithResult(_0x48b578,null))[_0xa757('0x3e')](handleError(_0x48b578,null));};exports[_0xa757('0x4e')]=function(_0x4c19a6,_0x4f0d7b,_0x201557){var _0x3afa56={};var _0x3ca1ef={};var _0x4a5ad5;var _0x55a7d2;return db[_0xa757('0x27')][_0xa757('0x4f')]({'where':{'id':_0x4c19a6[_0xa757('0x3f')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x4f0d7b,null))[_0xa757('0x1e')](function(_0x3e6d40){if(_0x3e6d40){_0x4a5ad5=_0x3e6d40;_0x3ca1ef['model']=_[_0xa757('0x2a')](db[_0xa757('0x4b')][_0xa757('0x40')]);_0x3ca1ef[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x4c19a6[_0xa757('0x2b')]);_0x3ca1ef[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x3ca1ef[_0xa757('0x29')],_0x3ca1ef[_0xa757('0x2b')]);_0x3afa56['attributes']=_[_0xa757('0x2d')](_0x3ca1ef['model'],qs['fields'](_0x4c19a6[_0xa757('0x2b')][_0xa757('0x2f')]));_0x3afa56[_0xa757('0x2e')]=_0x3afa56[_0xa757('0x2e')][_0xa757('0x30')]?_0x3afa56[_0xa757('0x2e')]:_0x3ca1ef[_0xa757('0x29')];_0x3afa56[_0xa757('0x33')]=qs[_0xa757('0x34')](_0x4c19a6[_0xa757('0x2b')][_0xa757('0x34')]);_0x3afa56['where']=qs[_0xa757('0x2c')](_[_0xa757('0x36')](_0x4c19a6['query'],_0x3ca1ef[_0xa757('0x2c')]));if(_0x4c19a6[_0xa757('0x2b')][_0xa757('0x37')]){_0x3afa56[_0xa757('0x35')]=_[_0xa757('0x39')](_0x3afa56[_0xa757('0x35')],{'$or':_['map'](_0x3afa56[_0xa757('0x2e')],function(_0x4ab31d){var _0xee5b78={};_0xee5b78[_0x4ab31d]={'$like':'%'+_0x4c19a6[_0xa757('0x2b')][_0xa757('0x37')]+'%'};return _0xee5b78;})});}_0x3afa56=_[_0xa757('0x39')]({},_0x3afa56,_0x4c19a6[_0xa757('0x3a')]);return _0x4a5ad5['getContacts'](_0x3afa56);}})['then'](function(_0x1c8807){if(_0x1c8807){_0x55a7d2=_0x1c8807[_0xa757('0x30')];if(!_0x4c19a6[_0xa757('0x2b')]['hasOwnProperty'](_0xa757('0x32'))){_0x3afa56['limit']=qs[_0xa757('0x1a')](_0x4c19a6[_0xa757('0x2b')][_0xa757('0x1a')]);_0x3afa56[_0xa757('0x17')]=qs[_0xa757('0x17')](_0x4c19a6[_0xa757('0x2b')]['offset']);}return _0x4a5ad5[_0xa757('0x4e')](_0x3afa56);}})[_0xa757('0x1e')](function(_0x1e15ee){if(_0x1e15ee){return _0x1e15ee?{'count':_0x55a7d2,'rows':_0x1e15ee}:null;}})[_0xa757('0x1e')](respondWithResult(_0x4f0d7b,null))[_0xa757('0x3e')](handleError(_0x4f0d7b,null));}; \ No newline at end of file +var _0x0b0e=['fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','map','options','CmCompany','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addContacts','CmContact','ids','omit','getContacts','findOne','sort','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','UserProfileResource','stack','name','send','index','describe','model','keys','query','filters','intersection','attributes'];(function(_0x4825ce,_0x3cdc1b){var _0x264411=function(_0x3ece82){while(--_0x3ece82){_0x4825ce['push'](_0x4825ce['shift']());}};_0x264411(++_0x3cdc1b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x319fc1,_0x29179b){_0x319fc1=_0x319fc1-0x0;var _0xb768af=_0x0b0e[_0x319fc1];return _0xb768af;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){var _0x28586d=_0x503883['get']({'plain':!![]});var _0x3e5c88='Companies';return db[_0xe0b0('0x25')]['destroy']({'where':{'type':_0x3e5c88,'resourceId':_0x28586d['id']}})[_0xe0b0('0x23')](function(){return _0x503883;});})['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)[_0xe0b0('0x19')]();});}};}function handleEntityNotFound(_0x1f1ebd,_0x1d91ad){return function(_0x3ec2){if(!_0x3ec2){_0x1f1ebd[_0xe0b0('0x18')](0x194);}return _0x3ec2;};}function handleError(_0x5200a6,_0x1444b9){_0x1444b9=_0x1444b9||0x1f4;return function(_0x1b8aa8){logger['error'](_0x1b8aa8[_0xe0b0('0x26')]);if(_0x1b8aa8[_0xe0b0('0x27')]){delete _0x1b8aa8[_0xe0b0('0x27')];}_0x5200a6[_0xe0b0('0x1a')](_0x1444b9)[_0xe0b0('0x28')](_0x1b8aa8);};}exports[_0xe0b0('0x29')]=function(_0x136bd4,_0x4fb3b7){var _0x1854b8={},_0x3c0109={},_0x48a9b5={'count':0x0,'rows':[]};return db['CmCompany'][_0xe0b0('0x2a')]()[_0xe0b0('0x23')](function(_0x422575){_0x3c0109[_0xe0b0('0x2b')]=_[_0xe0b0('0x2c')](_0x422575);_0x3c0109['query']=_[_0xe0b0('0x2c')](_0x136bd4[_0xe0b0('0x2d')]);_0x3c0109[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x3c0109[_0xe0b0('0x2b')],_0x3c0109['query']);_0x1854b8[_0xe0b0('0x30')]=_[_0xe0b0('0x2f')](_0x3c0109[_0xe0b0('0x2b')],qs[_0xe0b0('0x31')](_0x136bd4[_0xe0b0('0x2d')][_0xe0b0('0x31')]));_0x1854b8[_0xe0b0('0x30')]=_0x1854b8[_0xe0b0('0x30')][_0xe0b0('0x32')]?_0x1854b8[_0xe0b0('0x30')]:_0x3c0109[_0xe0b0('0x2b')];if(!_0x136bd4[_0xe0b0('0x2d')][_0xe0b0('0x33')](_0xe0b0('0x34'))){_0x1854b8[_0xe0b0('0x1d')]=qs['limit'](_0x136bd4[_0xe0b0('0x2d')][_0xe0b0('0x1d')]);_0x1854b8[_0xe0b0('0x1c')]=qs[_0xe0b0('0x1c')](_0x136bd4[_0xe0b0('0x2d')][_0xe0b0('0x1c')]);}_0x1854b8[_0xe0b0('0x35')]=qs['sort'](_0x136bd4['query']['sort']);_0x1854b8['where']=qs[_0xe0b0('0x2e')](_[_0xe0b0('0x36')](_0x136bd4[_0xe0b0('0x2d')],_0x3c0109['filters']),_0x422575);if(_0x136bd4[_0xe0b0('0x2d')][_0xe0b0('0x37')]){_0x1854b8[_0xe0b0('0x38')]=_[_0xe0b0('0x39')](_0x1854b8['where'],{'$or':_[_0xe0b0('0x3a')](_0x1854b8[_0xe0b0('0x30')],function(_0x43d352){var _0x30dcbb={};_0x30dcbb[_0x43d352]={'$like':'%'+_0x136bd4[_0xe0b0('0x2d')][_0xe0b0('0x37')]+'%'};return _0x30dcbb;})});}_0x1854b8=_[_0xe0b0('0x39')]({},_0x1854b8,_0x136bd4[_0xe0b0('0x3b')]);var _0xeaffbb={'where':_0x1854b8['where']};return db[_0xe0b0('0x3c')]['count'](_0xeaffbb)[_0xe0b0('0x23')](function(_0x2d5f47){_0x48a9b5[_0xe0b0('0x3d')]=_0x2d5f47;if(_0x136bd4[_0xe0b0('0x2d')]['includeAll']){_0x1854b8[_0xe0b0('0x3e')]=[{'all':!![]}];}return db[_0xe0b0('0x3c')][_0xe0b0('0x3f')](_0x1854b8);})[_0xe0b0('0x23')](function(_0x19c80e){_0x48a9b5[_0xe0b0('0x40')]=_0x19c80e;return _0x48a9b5;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x4fb3b7,_0x1854b8))[_0xe0b0('0x41')](handleError(_0x4fb3b7,null));})['catch'](handleError(_0x4fb3b7,null));};exports[_0xe0b0('0x42')]=function(_0x309bbf,_0x528818){var _0x515bd2={'raw':![],'where':{'id':_0x309bbf[_0xe0b0('0x43')]['id']}},_0x327fb4={};_0x327fb4['model']=_[_0xe0b0('0x2c')](db[_0xe0b0('0x3c')][_0xe0b0('0x44')]);_0x327fb4[_0xe0b0('0x2d')]=_[_0xe0b0('0x2c')](_0x309bbf['query']);_0x327fb4['filters']=_['intersection'](_0x327fb4[_0xe0b0('0x2b')],_0x327fb4[_0xe0b0('0x2d')]);_0x515bd2['attributes']=_[_0xe0b0('0x2f')](_0x327fb4[_0xe0b0('0x2b')],qs[_0xe0b0('0x31')](_0x309bbf[_0xe0b0('0x2d')][_0xe0b0('0x31')]));_0x515bd2['attributes']=_0x515bd2['attributes'][_0xe0b0('0x32')]?_0x515bd2[_0xe0b0('0x30')]:_0x327fb4[_0xe0b0('0x2b')];if(_0x309bbf[_0xe0b0('0x2d')][_0xe0b0('0x45')]){_0x515bd2['include']=[{'all':!![]}];}_0x515bd2=_[_0xe0b0('0x39')]({},_0x515bd2,_0x309bbf[_0xe0b0('0x3b')]);return db['CmCompany']['find'](_0x515bd2)['then'](handleEntityNotFound(_0x528818,null))[_0xe0b0('0x23')](respondWithResult(_0x528818,null))[_0xe0b0('0x41')](handleError(_0x528818,null));};exports[_0xe0b0('0x46')]=function(_0x364877,_0x5b1756){return db[_0xe0b0('0x3c')][_0xe0b0('0x46')](_0x364877['body'],{})['then'](function(_0x2365be){var _0x1bc6e0=_0x364877['user'][_0xe0b0('0x47')]({'plain':!![]});if(!_0x1bc6e0)throw new Error(_0xe0b0('0x48'));if(_0x1bc6e0['role']==='user'){var _0x123ad2=_0x2365be['get']({'plain':!![]});var _0x165dc8=_0xe0b0('0x49');return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'name':_0x165dc8,'userProfileId':_0x1bc6e0[_0xe0b0('0x4c')]},'raw':!![]})[_0xe0b0('0x23')](function(_0x5f5486){if(_0x5f5486&&_0x5f5486['autoAssociation']===0x0){return db[_0xe0b0('0x25')]['create']({'name':_0x123ad2['name'],'resourceId':_0x123ad2['id'],'type':_0x5f5486[_0xe0b0('0x27')],'sectionId':_0x5f5486['id']},{})[_0xe0b0('0x23')](function(){return _0x2365be;});}else{return _0x2365be;}})['catch'](function(_0x4b65d1){logger[_0xe0b0('0x4d')](_0xe0b0('0x4e'),_0x4b65d1);throw _0x4b65d1;});}return _0x2365be;})[_0xe0b0('0x23')](respondWithResult(_0x5b1756,0xc9))[_0xe0b0('0x41')](handleError(_0x5b1756,null));};exports[_0xe0b0('0x4f')]=function(_0x24115f,_0x84fabb){if(_0x24115f['body']['id']){delete _0x24115f[_0xe0b0('0x50')]['id'];}return db['CmCompany'][_0xe0b0('0x4b')]({'where':{'id':_0x24115f['params']['id']}})['then'](handleEntityNotFound(_0x84fabb,null))[_0xe0b0('0x23')](saveUpdates(_0x24115f[_0xe0b0('0x50')],null))[_0xe0b0('0x23')](respondWithResult(_0x84fabb,null))[_0xe0b0('0x41')](handleError(_0x84fabb,null));};exports[_0xe0b0('0x24')]=function(_0x2a588d,_0x4548da){return db[_0xe0b0('0x3c')][_0xe0b0('0x4b')]({'where':{'id':_0x2a588d['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x4548da,null))['then'](removeEntity(_0x4548da,null))[_0xe0b0('0x41')](handleError(_0x4548da,null));};exports[_0xe0b0('0x2a')]=function(_0x30c4a9,_0xb9904c){return db[_0xe0b0('0x3c')][_0xe0b0('0x2a')]()['then'](respondWithResult(_0xb9904c,null))[_0xe0b0('0x41')](handleError(_0xb9904c,null));};exports[_0xe0b0('0x51')]=function(_0x437a15,_0x271445,_0x3bb6d6){return db[_0xe0b0('0x52')][_0xe0b0('0x4b')]({'where':{'id':_0x437a15[_0xe0b0('0x43')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x271445,null))[_0xe0b0('0x23')](function(_0x1eb5d6){if(_0x1eb5d6){return _0x1eb5d6[_0xe0b0('0x51')](_0x437a15[_0xe0b0('0x50')][_0xe0b0('0x53')],_[_0xe0b0('0x54')](_0x437a15[_0xe0b0('0x50')],[_0xe0b0('0x53'),'id'])||{});}})[_0xe0b0('0x23')](respondWithResult(_0x271445,null))['catch'](handleError(_0x271445,null));};exports[_0xe0b0('0x55')]=function(_0xe7fbac,_0x1182dc,_0x2f24e6){var _0x3916ab={};var _0x405d7e={};var _0x2bdb59;var _0x4f818b;return db['CmCompany'][_0xe0b0('0x56')]({'where':{'id':_0xe7fbac[_0xe0b0('0x43')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1182dc,null))['then'](function(_0x117d20){if(_0x117d20){_0x2bdb59=_0x117d20;_0x405d7e[_0xe0b0('0x2b')]=_[_0xe0b0('0x2c')](db[_0xe0b0('0x52')][_0xe0b0('0x44')]);_0x405d7e['query']=_[_0xe0b0('0x2c')](_0xe7fbac[_0xe0b0('0x2d')]);_0x405d7e[_0xe0b0('0x2e')]=_['intersection'](_0x405d7e[_0xe0b0('0x2b')],_0x405d7e[_0xe0b0('0x2d')]);_0x3916ab['attributes']=_[_0xe0b0('0x2f')](_0x405d7e['model'],qs['fields'](_0xe7fbac[_0xe0b0('0x2d')]['fields']));_0x3916ab['attributes']=_0x3916ab[_0xe0b0('0x30')][_0xe0b0('0x32')]?_0x3916ab[_0xe0b0('0x30')]:_0x405d7e[_0xe0b0('0x2b')];_0x3916ab['order']=qs[_0xe0b0('0x57')](_0xe7fbac[_0xe0b0('0x2d')][_0xe0b0('0x57')]);_0x3916ab[_0xe0b0('0x38')]=qs[_0xe0b0('0x2e')](_[_0xe0b0('0x36')](_0xe7fbac[_0xe0b0('0x2d')],_0x405d7e[_0xe0b0('0x2e')]));if(_0xe7fbac['query']['filter']){_0x3916ab[_0xe0b0('0x38')]=_[_0xe0b0('0x39')](_0x3916ab[_0xe0b0('0x38')],{'$or':_['map'](_0x3916ab['attributes'],function(_0x2eb16f){var _0x26f36f={};_0x26f36f[_0x2eb16f]={'$like':'%'+_0xe7fbac['query']['filter']+'%'};return _0x26f36f;})});}_0x3916ab=_[_0xe0b0('0x39')]({},_0x3916ab,_0xe7fbac[_0xe0b0('0x3b')]);return _0x2bdb59[_0xe0b0('0x55')](_0x3916ab);}})[_0xe0b0('0x23')](function(_0x3b263f){if(_0x3b263f){_0x4f818b=_0x3b263f[_0xe0b0('0x32')];if(!_0xe7fbac[_0xe0b0('0x2d')][_0xe0b0('0x33')]('nolimit')){_0x3916ab[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0xe7fbac[_0xe0b0('0x2d')]['limit']);_0x3916ab['offset']=qs['offset'](_0xe7fbac['query']['offset']);}return _0x2bdb59['getContacts'](_0x3916ab);}})[_0xe0b0('0x23')](function(_0x51b492){if(_0x51b492){return _0x51b492?{'count':_0x4f818b,'rows':_0x51b492}:null;}})['then'](respondWithResult(_0x1182dc,null))[_0xe0b0('0x41')](handleError(_0x1182dc,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7c59489..a02a378 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 _0x4016=['../../config/logger','request-promise','rimraf','../../config/environment','CmCompany','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4016,0x131));var _0x6401=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4016[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x6401('0x0'));var logger=require(_0x6401('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6401('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6401('0x3'));var config=require(_0x6401('0x4'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x3e2c0b,_0x34c7f2){return _0x3e2c0b['define'](_0x6401('0x5'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa63f=['request-promise','path','rimraf','../../config/environment','define','CmCompany','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3862d4,_0x14b6d9){var _0x1cc5e6=function(_0x582097){while(--_0x582097){_0x3862d4['push'](_0x3862d4['shift']());}};_0x1cc5e6(++_0x14b6d9);}(_0xa63f,0x1b6));var _0xfa63=function(_0xcba291,_0x10e9d5){_0xcba291=_0xcba291-0x0;var _0x162274=_0xa63f[_0xcba291];return _0x162274;};'use strict';var _=require(_0xfa63('0x0'));var util=require(_0xfa63('0x1'));var logger=require(_0xfa63('0x2'))(_0xfa63('0x3'));var moment=require(_0xfa63('0x4'));var BPromise=require(_0xfa63('0x5'));var rp=require(_0xfa63('0x6'));var fs=require('fs');var path=require(_0xfa63('0x7'));var rimraf=require(_0xfa63('0x8'));var config=require(_0xfa63('0x9'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x20d4f6,_0x41efce){return _0x20d4f6[_0xfa63('0xa')](_0xfa63('0xb'),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 7070e76..60abfc2 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 _0xb6fb=['message','result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x398bff,_0x25ef31){var _0x34e7a4=function(_0x5a22ce){while(--_0x5a22ce){_0x398bff['push'](_0x398bff['shift']());}};_0x34e7a4(++_0x25ef31);}(_0xb6fb,0x1de));var _0xbb6f=function(_0x179702,_0x1b1c4d){_0x179702=_0x179702-0x0;var _0x55e871=_0xb6fb[_0x179702];return _0x55e871;};'use strict';var _=require(_0xbb6f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbb6f('0x1'));var fs=require('fs');var Redis=require(_0xbb6f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb6f('0x3'));var logger=require(_0xbb6f('0x4'))(_0xbb6f('0x5'));var config=require('../../config/environment');var jayson=require(_0xbb6f('0x6'));var client=jayson['client'][_0xbb6f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x448115,_0x5116f8,_0x484ba0){return new BPromise(function(_0x3d2616,_0x399db1){return client[_0xbb6f('0x8')](_0x448115,_0x484ba0)[_0xbb6f('0x9')](function(_0x3feba9){logger[_0xbb6f('0xa')](_0xbb6f('0xb'),_0x5116f8,_0xbb6f('0xc'));logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x5116f8,'request\x20sent',JSON[_0xbb6f('0xd')](_0x3feba9));if(_0x3feba9[_0xbb6f('0xe')]){if(_0x3feba9[_0xbb6f('0xe')][_0xbb6f('0xf')]===0x1f4){logger[_0xbb6f('0xe')](_0xbb6f('0xb'),_0x5116f8,_0x3feba9[_0xbb6f('0xe')][_0xbb6f('0x10')]);return _0x399db1(_0x3feba9[_0xbb6f('0xe')][_0xbb6f('0x10')]);}logger[_0xbb6f('0xe')]('CmCompany,\x20%s,\x20%s',_0x5116f8,_0x3feba9[_0xbb6f('0xe')][_0xbb6f('0x10')]);return _0x3d2616(_0x3feba9[_0xbb6f('0xe')][_0xbb6f('0x10')]);}else{logger['info'](_0xbb6f('0xb'),_0x5116f8,_0xbb6f('0xc'));_0x3d2616(_0x3feba9[_0xbb6f('0x11')]['message']);}})[_0xbb6f('0x12')](function(_0x4d3450){logger[_0xbb6f('0xe')](_0xbb6f('0xb'),_0x5116f8,_0x4d3450);_0x399db1(_0x4d3450);});});} \ No newline at end of file +var _0xbf96=['request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x29e3c2,_0x461221){var _0x4586d0=function(_0x1ea34b){while(--_0x1ea34b){_0x29e3c2['push'](_0x29e3c2['shift']());}};_0x4586d0(++_0x461221);}(_0xbf96,0x1c4));var _0x6bf9=function(_0x535b9c,_0x94875b){_0x535b9c=_0x535b9c-0x0;var _0x421056=_0xbf96[_0x535b9c];return _0x421056;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6bf9('0x0'));var BPromise=require('bluebird');var rs=require(_0x6bf9('0x1'));var fs=require('fs');var Redis=require(_0x6bf9('0x2'));var db=require(_0x6bf9('0x3'))['db'];var utils=require(_0x6bf9('0x4'));var logger=require(_0x6bf9('0x5'))(_0x6bf9('0x6'));var config=require(_0x6bf9('0x7'));var jayson=require(_0x6bf9('0x8'));var client=jayson[_0x6bf9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x179833,_0x8558c0,_0x42a0bb){return new BPromise(function(_0x2c2010,_0x57c1f0){return client[_0x6bf9('0xa')](_0x179833,_0x42a0bb)['then'](function(_0x24b41c){logger['info'](_0x6bf9('0xb'),_0x8558c0,_0x6bf9('0xc'));logger[_0x6bf9('0xd')](_0x6bf9('0xe'),_0x8558c0,_0x6bf9('0xc'),JSON['stringify'](_0x24b41c));if(_0x24b41c[_0x6bf9('0xf')]){if(_0x24b41c[_0x6bf9('0xf')][_0x6bf9('0x10')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x8558c0,_0x24b41c['error'][_0x6bf9('0x11')]);return _0x57c1f0(_0x24b41c['error'][_0x6bf9('0x11')]);}logger[_0x6bf9('0xf')](_0x6bf9('0xb'),_0x8558c0,_0x24b41c[_0x6bf9('0xf')][_0x6bf9('0x11')]);return _0x2c2010(_0x24b41c[_0x6bf9('0xf')][_0x6bf9('0x11')]);}else{logger[_0x6bf9('0x12')](_0x6bf9('0xb'),_0x8558c0,_0x6bf9('0xc'));_0x2c2010(_0x24b41c[_0x6bf9('0x13')][_0x6bf9('0x11')]);}})[_0x6bf9('0x14')](function(_0x16083a){logger[_0x6bf9('0xf')]('CmCompany,\x20%s,\x20%s',_0x8558c0,_0x16083a);_0x57c1f0(_0x16083a);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 74214e1..05dd93a 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 _0xa040=['/:id','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','getContacts','post','/:id/contacts','addContacts','put'];(function(_0x3ce673,_0x186ab5){var _0x24bbaf=function(_0x2fe701){while(--_0x2fe701){_0x3ce673['push'](_0x3ce673['shift']());}};_0x24bbaf(++_0x186ab5);}(_0xa040,0xdc));var _0x0a04=function(_0x4e141c,_0x1b6038){_0x4e141c=_0x4e141c-0x0;var _0x1e9240=_0xa040[_0x4e141c];return _0x1e9240;};'use strict';var multer=require('multer');var util=require(_0x0a04('0x0'));var path=require(_0x0a04('0x1'));var timeout=require('connect-timeout');var express=require(_0x0a04('0x2'));var router=express[_0x0a04('0x3')]();var fs_extra=require(_0x0a04('0x4'));var auth=require(_0x0a04('0x5'));var interaction=require(_0x0a04('0x6'));var config=require(_0x0a04('0x7'));var controller=require(_0x0a04('0x8'));router[_0x0a04('0x9')]('/',auth[_0x0a04('0xa')](),controller[_0x0a04('0xb')]);router[_0x0a04('0x9')](_0x0a04('0xc'),auth[_0x0a04('0xa')](),controller[_0x0a04('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0a04('0xe')]);router['get']('/:id/contacts',auth[_0x0a04('0xa')](),controller[_0x0a04('0xf')]);router[_0x0a04('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a04('0x10')](_0x0a04('0x11'),auth[_0x0a04('0xa')](),controller[_0x0a04('0x12')]);router[_0x0a04('0x13')](_0x0a04('0x14'),auth[_0x0a04('0xa')](),controller[_0x0a04('0x15')]);router['delete']('/:id',auth[_0x0a04('0xa')](),controller[_0x0a04('0x16')]);module[_0x0a04('0x17')]=router; \ No newline at end of file +var _0x42cf=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','/describe','describe','get','show','/:id/contacts','getContacts','post','create','addContacts','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3bd478,_0x1bb19a){var _0x5d4211=function(_0xa26806){while(--_0xa26806){_0x3bd478['push'](_0x3bd478['shift']());}};_0x5d4211(++_0x1bb19a);}(_0x42cf,0x11c));var _0xf42c=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x42cf[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0xf42c('0x0'));var util=require(_0xf42c('0x1'));var path=require(_0xf42c('0x2'));var timeout=require(_0xf42c('0x3'));var express=require(_0xf42c('0x4'));var router=express['Router']();var fs_extra=require(_0xf42c('0x5'));var auth=require(_0xf42c('0x6'));var interaction=require(_0xf42c('0x7'));var config=require(_0xf42c('0x8'));var controller=require(_0xf42c('0x9'));router['get']('/',auth[_0xf42c('0xa')](),controller[_0xf42c('0xb')]);router['get'](_0xf42c('0xc'),auth[_0xf42c('0xa')](),controller[_0xf42c('0xd')]);router[_0xf42c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf42c('0xf')]);router[_0xf42c('0xe')](_0xf42c('0x10'),auth['isAuthenticated'](),controller[_0xf42c('0x11')]);router[_0xf42c('0x12')]('/',auth[_0xf42c('0xa')](),controller[_0xf42c('0x13')]);router[_0xf42c('0x12')](_0xf42c('0x10'),auth['isAuthenticated'](),controller[_0xf42c('0x14')]);router['put'](_0xf42c('0x15'),auth[_0xf42c('0xa')](),controller['update']);router['delete']('/:id',auth[_0xf42c('0xa')](),controller[_0xf42c('0x16')]);module[_0xf42c('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 5777c17..e2a4eef 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 _0x1599=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','INTEGER'];(function(_0x14063f,_0x4d3f7b){var _0x24b031=function(_0x7060ff){while(--_0x7060ff){_0x14063f['push'](_0x14063f['shift']());}};_0x24b031(++_0x4d3f7b);}(_0x1599,0x193));var _0x9159=function(_0x57e17e,_0x3a9c10){_0x57e17e=_0x57e17e-0x0;var _0x186f64=_0x1599[_0x57e17e];return _0x186f64;};'use strict';var _=require(_0x9159('0x0'));var Sequelize=require(_0x9159('0x1'));module[_0x9159('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x9159('0x3')]},'postalCode':{'type':Sequelize[_0x9159('0x3')]},'city':{'type':Sequelize[_0x9159('0x3')]},'country':{'type':Sequelize[_0x9159('0x3')]},'dateOfBirth':{'type':Sequelize[_0x9159('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x9159('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x9159('0x3')]},'facebook':{'type':Sequelize[_0x9159('0x3')]},'fb_data':{'type':Sequelize[_0x9159('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x9159('0x3')]},'teams':{'type':Sequelize[_0x9159('0x3')]},'viber':{'type':Sequelize[_0x9159('0x3')]},'line':{'type':Sequelize[_0x9159('0x3')]},'wechat':{'type':Sequelize[_0x9159('0x3')]},'telegram':{'type':Sequelize[_0x9159('0x3')]},'UserId':{'type':Sequelize[_0x9159('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x9159('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x9159('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9159('0x6')],'defaultValue':Sequelize[_0x9159('0x7')]}}; \ No newline at end of file +var _0x6ae0=['INTEGER','UNSIGNED','DATE','lodash','STRING','TEXT'];(function(_0x50cd9d,_0xa509cc){var _0x33b72c=function(_0x175f0c){while(--_0x175f0c){_0x50cd9d['push'](_0x50cd9d['shift']());}};_0x33b72c(++_0xa509cc);}(_0x6ae0,0x1ad));var _0x06ae=function(_0x4ce6b1,_0x312769){_0x4ce6b1=_0x4ce6b1-0x0;var _0x42c356=_0x6ae0[_0x4ce6b1];return _0x42c356;};'use strict';var _=require(_0x06ae('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0x06ae('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x06ae('0x1')]},'street':{'type':Sequelize[_0x06ae('0x1')]},'postalCode':{'type':Sequelize[_0x06ae('0x1')]},'city':{'type':Sequelize[_0x06ae('0x1')]},'country':{'type':Sequelize[_0x06ae('0x1')]},'dateOfBirth':{'type':Sequelize[_0x06ae('0x1')]},'description':{'type':Sequelize[_0x06ae('0x2')]},'phone':{'type':Sequelize[_0x06ae('0x1')]},'mobile':{'type':Sequelize[_0x06ae('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x06ae('0x1')]},'url':{'type':Sequelize[_0x06ae('0x1')]},'facebook':{'type':Sequelize[_0x06ae('0x1')]},'fb_data':{'type':Sequelize[_0x06ae('0x1')]},'twitter':{'type':Sequelize[_0x06ae('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x06ae('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x06ae('0x1')]},'wechat':{'type':Sequelize[_0x06ae('0x1')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x06ae('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x06ae('0x1')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x06ae('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x06ae('0x5')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index fa8c924..ddcb83d 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 _0xa9e0=['status','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','index','CmContact','describe','keys','length','cf_','push','CmCustomField','findOne','trimStart','all','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','castTo','DATE','buildExpression','text','start','filter','Contact','isEmpty','ListId','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','clone','DESC','t.id\x20IN\x20?','resolve','user','agent','some','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','role','sequelize','toString','c.firstName','c.mobile','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','split','rows','find','startsWith','displayName','columnName','custom','catch','body','findAll','get','mergeWith','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','contact','show','Phones','params','ContactItemType','ItemType','literal','`Phones.ItemType`.OrderBy','log','$and','omit','format','cf_%d','pickBy','setFields','id\x20=\x20?','values','phone','getTags','rawAttributes','pick','merge','options','setTags','ids','setAdditionalPhones','items','item_types','isNil','ItemTypeId','description','CmHopperAdditionalPhone','item','OrderBy','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','PHONE','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','ContactId','includeAll','include','getHopperHistories','getHopperFinals','uploadCsv','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','send','upload','file','parse','json','meta','No\x20ListId\x20specified','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','message','mail','chat','sms','fax','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','alias','Website','closed','closedAt','disposition','secondDisposition','Account','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','startCase','flatten','sortBy','slice','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','redis','defaults','localhost','./cmContact.socket','register'];(function(_0x407f6c,_0xb52dca){var _0x305845=function(_0x2f09f5){while(--_0x2f09f5){_0x407f6c['push'](_0x407f6c['shift']());}};_0x305845(++_0xb52dca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=typeof _0x5a0a06[_0x0a9e('0x1b')]===_0x0a9e('0x1c')&&typeof _0x5a0a06[_0x0a9e('0x1d')]===_0x0a9e('0x1c');var _0x530eb7=_0x459eb1[_0x0a9e('0x1e')];var _0x1314ae=_0x478723?0x0:_0x5a0a06[_0x0a9e('0x1b')];var _0x1c696a=_0x478723?_0x459eb1[_0x0a9e('0x1e')]:_0x5a0a06['offset']+_0x5a0a06[_0x0a9e('0x1d')];var _0x155cce;if(_0x1c696a>=_0x530eb7){_0x1c696a=_0x530eb7;_0x155cce=0xc8;}else{_0x155cce=0xce;}_0x225616['status'](_0x155cce);return _0x225616[_0x0a9e('0x1f')]('Content-Range',_0x1314ae+'-'+_0x1c696a+'/'+_0x530eb7)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x3a02e1){return function(_0x432e56){try{jsonpatch[_0x0a9e('0x20')](_0x432e56,_0x3a02e1,!![]);}catch(_0x30bae6){return BPromise['reject'](_0x30bae6);}return _0x432e56[_0x0a9e('0x21')]();};}function saveUpdates(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x22')](_0x2fb0e4)[_0x0a9e('0x23')](function(_0x16b1ca){return _0x16b1ca;});}return null;};}function removeEntity(_0x5ea472,_0x59181e){return function(_0x197ec0){if(_0x197ec0){return _0x197ec0[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){_0x5ea472[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x25')](_0x25fba9[_0x0a9e('0x26')]);if(_0x25fba9[_0x0a9e('0x27')]){delete _0x25fba9[_0x0a9e('0x27')];}_0x1dc186[_0x0a9e('0x1a')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x28')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x58b06f){var _0x563b45=[];for(var _0x296f41=0x0;_0x296f410x1){_0x10b040['or'](_0x0a9e('0x66'),qs['getFullTextValue'](_0x121cef),null);}else{if(qs[_0x0a9e('0x67')](_0x121cef)){_0x10b040['or']('c.id\x20LIKE\x20?',_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x68'),_0x121cef+'%');_0x10b040['or']('c.mobile\x20LIKE\x20?',_0x121cef+'%');_0x10b040['or']('c.fax\x20LIKE\x20?',_0x121cef+'%');}else if(qs['isEmail'](_0x121cef)){_0x10b040['or'](_0x0a9e('0x69'),_0x121cef+'%');}else{_0x10b040['or']('c.firstName\x20LIKE\x20?','%'+_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x6a'),'%'+_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x69'),'%'+_0x121cef+'%');}}}}_0x23b089[_0x0a9e('0x3e')](_0x10b040);_0x23b089[_0x0a9e('0x6b')](_0x0a9e('0x6c'));var _0x26d7db={'type':db['Sequelize'][_0x0a9e('0x6d')]['SELECT'],'raw':!![]};var _0xca4ade=_0x23b089[_0x0a9e('0x6e')]()[_0x0a9e('0x40')]('c.id');if(_0x2ec755[_0x0a9e('0x3c')]){_0x2ec755[_0x0a9e('0x3c')][_0x0a9e('0x53')](function(_0x32e134){_0x23b089['order']('c.'+_0x32e134[0x0],_0x32e134[0x1]===_0x0a9e('0x6f')?![]:!![]);});}if(!_[_0x0a9e('0x5f')](_0x432fcc)){_0x23b089['having'](_0x25c6e6);_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x70'),_0x432fcc);}BPromise[_0x0a9e('0x71')]()[_0x0a9e('0x23')](function(){if(!_0x35ed4a)return;if(_0x468813[_0x0a9e('0x72')]['role']!==_0x0a9e('0x73'))return;if(!_[_0x0a9e('0x74')](_0x35ed4a[_0x0a9e('0x4f')],['field',_0x0a9e('0x56')])){return _0x468813['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x0a9e('0x23')](function(_0x4556c5){if(_[_0x0a9e('0x5f')](_0x4556c5)){_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x75'));_0x23b089[_0x0a9e('0x3e')](_0x0a9e('0x75'));}else{_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x76'),_[_0x0a9e('0x52')](_0x4556c5,'id'));_0x23b089[_0x0a9e('0x3e')](_0x0a9e('0x76'),_[_0x0a9e('0x52')](_0x4556c5,'id'));}});}})[_0x0a9e('0x23')](function(){if(_0x468813[_0x0a9e('0x72')][_0x0a9e('0x77')]===_0x0a9e('0x73')&&!_0x35ed4a&&!_0x468813[_0x0a9e('0x35')]['ListId'])return[];return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0xca4ade[_0x0a9e('0x79')](),_0x26d7db);})['then'](function(_0x1148a1){_0x15b200[_0x0a9e('0x1e')]=_0x1148a1['length'];if(_0x15b200[_0x0a9e('0x1e')]===0x0)return[];return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0x5b4f5e[_0x0a9e('0x79')](),_0x26d7db)[_0x0a9e('0x23')](function(_0x4a43a8){_0x1459bb=_['keyBy'](_0x4a43a8,'id');_0x26d7db=_['merge'](_0x26d7db,{'model':db[_0x0a9e('0x29')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x468813[_0x0a9e('0x35')][_0x0a9e('0x38')]){_0x2ec755[_0x0a9e('0x39')][_0x0a9e('0x53')](function(_0x380ab3){_0x23b089[_0x0a9e('0x40')]('c.'+_0x380ab3);});}else{_0x23b089[_0x0a9e('0x40')]('c.id');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7a'));_0x23b089[_0x0a9e('0x40')]('c.lastName');_0x23b089[_0x0a9e('0x40')]('c.phone');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7b'));_0x23b089['field'](_0x0a9e('0x7c'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7d'));_0x23b089[_0x0a9e('0x40')]('c.ListId');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7e'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7f'));_0x23b089['field'](_0x0a9e('0x80'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x81'),_0x0a9e('0x82'));}if(_0x2ec755['limit'])_0x23b089[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x1d')]);if(_0x2ec755[_0x0a9e('0x1b')])_0x23b089[_0x0a9e('0x1b')](_0x2ec755[_0x0a9e('0x1b')]);return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0x23b089[_0x0a9e('0x79')](),_0x26d7db);});})[_0x0a9e('0x23')](function(_0x336dc3){_0x336dc3[_0x0a9e('0x53')](function(_0x1f10ef){if(_0x1f10ef[_0x0a9e('0x82')]){_0x1f10ef[_0x0a9e('0x83')]=[];_0x1f10ef['TagIds'][_0x0a9e('0x84')](',')[_0x0a9e('0x53')](function(_0xc599b3){_0x1f10ef['Tags'][_0x0a9e('0x2e')](_0x1459bb[_0xc599b3]);});}delete _0x1f10ef[_0x0a9e('0x82')];});_0x15b200[_0x0a9e('0x85')]=_0x336dc3;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755));})['catch'](handleError(_0x2b1f27,null));};exports['destroy']=function(_0x7ebea8,_0x2bbdb5){return db['CmContact'][_0x0a9e('0x86')]({'where':{'id':_0x7ebea8['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x23')](removeEntity(_0x2bbdb5,null))['catch'](handleError(_0x2bbdb5,null));};exports[_0x0a9e('0x2a')]=function(_0x41cf12,_0x2d2286){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x444f1f){delete _0x444f1f['tags'];for(var _0x2973d3=0x0;_0x2973d30x0){return new Promise(function(_0x4a70ce,_0x55f91a){var _0x183244=[];for(var _0x1f78b4=0x0;_0x1f78b4<_0x5c4be0[_0x0a9e('0x2c')];_0x1f78b4++){_0x183244['push'](insertAdditionalPhones(_0x5c4be0[_0x1f78b4][_0x0a9e('0xb6')],_0x5c4be0[_0x1f78b4][_0x0a9e('0xaf')]));}Promise[_0x0a9e('0x32')](_0x183244)[_0x0a9e('0x23')](function(){_0x4a70ce(0x1);});})[_0x0a9e('0x23')](function(){return{'success':_0x5b93dd,'failure':_0x556443,'duplicates':_0x6eaaf0};});}else{return{'success':_0x5b93dd,'failure':_0x556443,'duplicates':_0x6eaaf0};}}})[_0x0a9e('0x23')](respondWithResult(_0x98c62c,0xc9))[_0x0a9e('0x8b')](handleError(_0x98c62c,null));};exports[_0x0a9e('0xb7')]=function(_0x3b5bda,_0x5a1848,_0x43c397){var _0x5526a7;return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x3cf222){return db[_0x0a9e('0x29')][_0x0a9e('0x86')]({'where':{'id':_0x3b5bda['params']['id']},'include':[{'model':db[_0x0a9e('0x50')],'as':_0x0a9e('0x83'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x41')],'required':_0x3b5bda['query'][_0x0a9e('0x64')]?!![]:![]},{'model':db[_0x0a9e('0xa3')],'as':_0x0a9e('0xb8'),'where':{'CmContactId':_0x3b5bda[_0x0a9e('0xb9')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0xba')],'as':_0x0a9e('0xbb')}]}],'order':[db[_0x0a9e('0x78')][_0x0a9e('0xbc')](_0x0a9e('0xbd'))],'logging':console[_0x0a9e('0xbe')],'attributes':_['keys'](_0x3cf222)});})[_0x0a9e('0x23')](function(_0x88b25f){_0x5526a7=_0x88b25f[_0x0a9e('0x8e')]({'plain':!![]});var _0x26b826={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x88b25f&&_0x88b25f[_0x0a9e('0x60')]){if(_0x88b25f[_0x0a9e('0x60')]){_0x26b826[_0x0a9e('0x3e')][_0x0a9e('0xbf')]['push']({'ListId':{'$ne':_0x88b25f[_0x0a9e('0x60')]}});}}return db[_0x0a9e('0x2f')][_0x0a9e('0x8d')](_0x26b826);})['then'](function(_0x1402c7){return _[_0x0a9e('0xc0')](_0x5526a7,_[_0x0a9e('0x52')](_0x1402c7,function(_0x97d5b5){return util[_0x0a9e('0xc1')](_0x0a9e('0xc2'),_0x97d5b5['id']);}));})[_0x0a9e('0x23')](handleEntityNotFound(_0x5a1848,null))[_0x0a9e('0x23')](respondWithResult(_0x5a1848,null))[_0x0a9e('0x8b')](handleError(_0x5a1848,null));};exports[_0x0a9e('0x22')]=function(_0x5a7dad,_0x251753){var _0x446e6;if(_0x5a7dad[_0x0a9e('0x8c')]['id']){delete _0x5a7dad[_0x0a9e('0x8c')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x86')]({'where':{'id':_0x5a7dad['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x251753,null))['then'](saveUpdates(_0x5a7dad['body'],null))['then'](function(_0x19e4e6){_0x446e6=_0x19e4e6;var _0x3fa3f2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x19e4e6&&_0x19e4e6[_0x0a9e('0x60')]){if(_0x19e4e6[_0x0a9e('0x60')]){_0x3fa3f2['where'][_0x0a9e('0xbf')][_0x0a9e('0x2e')]({'ListId':{'$ne':_0x19e4e6[_0x0a9e('0x60')]}});}}return db[_0x0a9e('0x2f')][_0x0a9e('0x8d')](_0x3fa3f2);})['then'](function(_0x57b1b1){if(_0x57b1b1){return _[_0x0a9e('0xc0')](_[_0x0a9e('0xc3')](_0x5a7dad[_0x0a9e('0x8c')],function(_0x5e85d0,_0x319752){return _[_0x0a9e('0x87')](_0x319752,_0x0a9e('0x2d'));}),_['map'](_0x57b1b1,function(_0x8ad1c0){return util[_0x0a9e('0xc1')](_0x0a9e('0xc2'),_0x8ad1c0['id']);}));}})['then'](function(_0x272291){if(_0x272291&&!_[_0x0a9e('0x5f')](_0x272291)){var _0x3b7213=squel['update']()['table']('cm_contacts')[_0x0a9e('0xc4')](_0x272291)[_0x0a9e('0x3e')](_0x0a9e('0xc5'),_0x5a7dad[_0x0a9e('0xb9')]['id'])['toParam']();return db[_0x0a9e('0x78')]['query'](_0x3b7213[_0x0a9e('0x5b')],{'replacements':_0x3b7213[_0x0a9e('0xc6')]});}})[_0x0a9e('0x23')](function(){if(_0x5a7dad['body'][_0x0a9e('0xc7')]&&_0x446e6){return db[_0x0a9e('0x94')][_0x0a9e('0x22')]({'phone':_0x5a7dad['body'][_0x0a9e('0xc7')]},{'where':{'ContactId':_0x446e6['id']}});}})['then'](function(){return _0x446e6;})[_0x0a9e('0x23')](respondWithResult(_0x251753,null))['catch'](handleError(_0x251753,null));};exports[_0x0a9e('0xc8')]=function(_0x57b7d4,_0xb14971,_0x37215d){var _0xa288e4={};var _0x10ace8={};var _0x1e306c;var _0x251dd9;return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x57b7d4[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0xb14971,null))['then'](function(_0xf4fb77){if(_0xf4fb77){_0x1e306c=_0xf4fb77;_0x10ace8[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x50')][_0x0a9e('0xc9')]);_0x10ace8[_0x0a9e('0x35')]=_['keys'](_0x57b7d4[_0x0a9e('0x35')]);_0x10ace8[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x10ace8[_0x0a9e('0x34')],_0x10ace8[_0x0a9e('0x35')]);_0xa288e4[_0x0a9e('0x39')]=_[_0x0a9e('0x37')](_0x10ace8[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x57b7d4[_0x0a9e('0x35')]['fields']));_0xa288e4[_0x0a9e('0x39')]=_0xa288e4['attributes'][_0x0a9e('0x2c')]?_0xa288e4[_0x0a9e('0x39')]:_0x10ace8[_0x0a9e('0x34')];_0xa288e4[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x57b7d4[_0x0a9e('0x35')]['sort']);_0xa288e4[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x57b7d4['query'],_0x10ace8[_0x0a9e('0x36')]));if(_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x5d')]){_0xa288e4[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0xa288e4[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0xa288e4['attributes'],function(_0x4e1b3){var _0x228c10={};_0x228c10[_0x4e1b3]={'$like':'%'+_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x228c10;})});}_0xa288e4=_[_0x0a9e('0xcb')]({},_0xa288e4,_0x57b7d4[_0x0a9e('0xcc')]);return _0x1e306c[_0x0a9e('0xc8')](_0xa288e4);}})['then'](function(_0x5c8720){if(_0x5c8720){_0x251dd9=_0x5c8720[_0x0a9e('0x2c')];if(!_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0xa288e4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x57b7d4[_0x0a9e('0x35')]['limit']);_0xa288e4[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}return _0x1e306c[_0x0a9e('0xc8')](_0xa288e4);}})[_0x0a9e('0x23')](function(_0x16be7e){if(_0x16be7e){return _0x16be7e?{'count':_0x251dd9,'rows':_0x16be7e}:null;}})['then'](respondWithResult(_0xb14971,null))[_0x0a9e('0x8b')](handleError(_0xb14971,null));};exports[_0x0a9e('0xcd')]=function(_0x231826,_0x5885c3,_0x2b8ad4){if(_0x231826[_0x0a9e('0x8c')]['id']){delete _0x231826[_0x0a9e('0x8c')]['id'];}return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x231826[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5885c3,null))[_0x0a9e('0x23')](function(_0x93d953){if(_0x93d953){return _0x93d953[_0x0a9e('0xcd')](_0x231826[_0x0a9e('0x8c')][_0x0a9e('0xce')]||[]);}return null;})[_0x0a9e('0x23')](respondWithResult(_0x5885c3,null))['catch'](handleError(_0x5885c3,null));};exports[_0x0a9e('0xcf')]=function(_0x266aa1,_0x25e41f){var _0x397771=[];_0x397771['push'](addAdditionalPhones(_0x266aa1['body']));Promise[_0x0a9e('0x32')](_0x397771)[_0x0a9e('0x23')](function(){_0x397771=[];_0x397771[_0x0a9e('0x2e')](deleteCmHopperPhones(_0x266aa1['body']['id']));_0x397771[_0x0a9e('0x2e')](addCmHopperPhones(_0x266aa1[_0x0a9e('0x8c')]['id']));Promise['all'](_0x397771)[_0x0a9e('0x23')](function(){return[0x1];})['then'](respondWithResult(_0x25e41f,null));});};function addAdditionalPhones(_0x35cc2a){return new Promise(function(_0x54dbbf,_0x5b42b9){return db['CmContactHasItem'][_0x0a9e('0x24')]({'where':{'CmContactId':_0x35cc2a['id']}})[_0x0a9e('0x23')](function(){var _0x19f800=[];for(var _0x20007e=0x0;_0x20007e<_0x35cc2a[_0x0a9e('0xd0')][_0x0a9e('0x2c')];_0x20007e++){_0x19f800['push'](addAdditionalPhone(_0x35cc2a['id'],_0x35cc2a[_0x0a9e('0xd0')][_0x20007e][_0x0a9e('0xc7')],_0x35cc2a[_0x0a9e('0xd1')]?_[_0x0a9e('0xd2')](_0x35cc2a[_0x0a9e('0xd1')][_0x20007e])?null:_0x35cc2a[_0x0a9e('0xd1')][_0x20007e]:_0x35cc2a[_0x0a9e('0xd0')][_0x20007e]['ItemTypeId']?_0x35cc2a['items'][_0x20007e][_0x0a9e('0xd3')]:null,_0x20007e,_0x35cc2a['items'][_0x20007e][_0x0a9e('0xd4')]));}Promise[_0x0a9e('0x32')](_0x19f800)[_0x0a9e('0x23')](function(){_0x54dbbf(0x1);});});});}function addAdditionalPhone(_0xa3695f,_0x37a448,_0x383dd8,_0x594f25,_0x4716d1){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0xa3695f,'item':_0x37a448}})[_0x0a9e('0x23')](function(_0x593f9e){if(_0x593f9e)logger[_0x0a9e('0x92')]('contact\x20phone\x20exists',_0x593f9e);else{db['CmContactHasItem'][_0x0a9e('0x98')]({'CmContactId':_0xa3695f,'item':_0x37a448,'ItemTypeId':_0x383dd8,'OrderBy':_0x594f25,'ItemClass':'PHONE','description':_0x4716d1});}});}function deletePhones(_0x24470a){return db[_0x0a9e('0xa3')][_0x0a9e('0x24')]({'where':{'CmContactId':_0x24470a}});}function deleteCmHopperPhones(_0x48f532){return new Promise(function(_0x4152cd,_0x1209c4){return db[_0x0a9e('0x94')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x48f532}})['then'](function(_0xdc77d){db[_0x0a9e('0xd5')][_0x0a9e('0x24')]({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x52')](_0xdc77d,'id')}}});})[_0x0a9e('0x23')](function(){_0x4152cd(0x1);});});}function addCmHopperPhones(_0x376b97){return new Promise(function(_0x247a6c,_0x170b3d){return db[_0x0a9e('0x94')][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x376b97}})['then'](function(_0x51fa33){var _0x558171=[];_[_0x0a9e('0x52')](_0x51fa33,function(_0x19dcc2){_0x558171[_0x0a9e('0x2e')](createCmHopperPhone(_0x376b97,_0x19dcc2['id']));});Promise[_0x0a9e('0x32')](_0x558171)[_0x0a9e('0x23')](function(){_0x247a6c(0x1);});});});}function createCmHopperPhone(_0x2dc202,_0x2b97fc){return new Promise(function(_0x307d13,_0x5d74e9){db['CmContactHasItem'][_0x0a9e('0x8d')]({'raw':!![],'attributes':[_0x0a9e('0xd6')],'where':{'CmContactId':_0x2dc202,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0xba')],'attributes':[_0x0a9e('0xd7')],'as':_0x0a9e('0xbb')}],'order':[db[_0x0a9e('0x78')][_0x0a9e('0xbc')](_0x0a9e('0xd8'))]})[_0x0a9e('0x23')](function(_0x262281){var _0x59f8f7=0x1;var _0x400800=_[_0x0a9e('0x52')](_0x262281,function(_0x20e191){_0x20e191['CmHopperId']=_0x2b97fc;_0x20e191[_0x0a9e('0xc7')]=_0x20e191[_0x0a9e('0xd6')];_0x20e191[_0x0a9e('0xd7')]=_0x20e191[_0x0a9e('0xd9')]||_0x59f8f7;delete _0x20e191[_0x0a9e('0xd9')];_0x59f8f7=_0x59f8f7+0x1;return _0x20e191;});return db[_0x0a9e('0xd5')][_0x0a9e('0xb0')](_0x400800,{});})[_0x0a9e('0x23')](function(){_0x307d13(0x1);});});}function insertAdditionalPhones(_0x3a9c0f,_0x3f1959){return new Promise(function(_0x6b048e,_0x3ba472){var _0x4e6eb9=[];for(var _0x572a72=0x0;_0x572a72<_0x3f1959[_0x0a9e('0x2c')];_0x572a72++){var _0x401207=_0x3f1959[_0x572a72];_0x4e6eb9[_0x0a9e('0x2e')](parseContactItemType(_0x401207));}Promise[_0x0a9e('0x32')](_0x4e6eb9)[_0x0a9e('0x23')](function(){var _0x1e29e2={'id':_0x3a9c0f['id'],'items':_0x3f1959};return addAdditionalPhones(_0x1e29e2)[_0x0a9e('0x23')](function(_0x4f7907){return addCmHopperPhones(_0x3a9c0f['id']);});})[_0x0a9e('0x23')](function(){_0x6b048e(_0x3a9c0f);});});}function parseContactItemType(_0x49fd0e){return new Promise(function(_0x26aa44,_0x1ad1d7){if(_0x49fd0e[_0x0a9e('0x3a')](_0x0a9e('0xd3'))){_0x26aa44(_0x49fd0e);}else{return db[_0x0a9e('0xba')][_0x0a9e('0x86')]({'where':{'name':_0x49fd0e[_0x0a9e('0xbb')]}})[_0x0a9e('0x23')](function(_0xa7a754){if(_[_0x0a9e('0xd2')](_0xa7a754))_0x49fd0e[_0x0a9e('0xd3')]=null;else _0x49fd0e[_0x0a9e('0xd3')]=_0xa7a754['id'];_0x26aa44(_0x49fd0e);});}});}exports[_0x0a9e('0xda')]=function(_0x3f7cb6,_0x3c8a9a){return db[_0x0a9e('0xa3')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3f7cb6['params']['id'],'ItemClass':_0x0a9e('0xdb')},'include':[{'model':db[_0x0a9e('0xba')],'as':'ItemType'}],'order':[[db['sequelize'][_0x0a9e('0xbc')](_0x0a9e('0xd8'))],[_0x0a9e('0xd7')]]})['then'](function(_0x268eae){return _0x268eae;})['then'](respondWithResult(_0x3c8a9a,null))[_0x0a9e('0x8b')](handleError(_0x3c8a9a,null));};exports['duplicateAdditionalPhones']=function(_0x22d31f,_0x5e9c92){return db[_0x0a9e('0xa3')][_0x0a9e('0x8d')]({'raw':!![],'where':{'CmContactId':_0x22d31f[_0x0a9e('0x8c')]['fromContactId']}})[_0x0a9e('0x23')](function(_0x497fda){var _0x505ffd=_[_0x0a9e('0x52')](_0x497fda,function(_0x23993f){_0x23993f[_0x0a9e('0xdc')]=_0x22d31f[_0x0a9e('0x8c')][_0x0a9e('0xdd')];return _0x23993f;});return db[_0x0a9e('0xa3')][_0x0a9e('0xb0')](_0x505ffd,{});})[_0x0a9e('0x23')](function(_0x1a3143){return addCmHopperPhones(_0x22d31f[_0x0a9e('0x8c')][_0x0a9e('0xdd')]);})[_0x0a9e('0x23')](function(_0x26361f){return['ok'];})[_0x0a9e('0x23')](respondWithResult(_0x5e9c92,null))[_0x0a9e('0x8b')](handleError(_0x5e9c92,null));};exports[_0x0a9e('0xde')]=function(_0x310026,_0x643f66){var _0x153de1=[];_0x153de1['push'](createCmHopperPhone(_0x310026[_0x0a9e('0x8c')]['id'],_0x310026[_0x0a9e('0x8c')][_0x0a9e('0xdf')]));Promise[_0x0a9e('0x32')](_0x153de1)['then'](function(){return[0x1];})['then'](respondWithResult(_0x643f66,null));};exports['getHoppers']=function(_0x2b8823,_0x55926d,_0xea26ca){var _0x1fafc2={'raw':![],'where':{}};var _0x130ae8={};var _0x43fe24={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x2b8823[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x55926d,null))[_0x0a9e('0x23')](function(_0x6b948a){if(_0x6b948a){_0x130ae8['model']=_[_0x0a9e('0x2b')](db['CmHopper'][_0x0a9e('0xc9')]);_0x130ae8['query']=_[_0x0a9e('0x2b')](_0x2b8823[_0x0a9e('0x35')]);_0x130ae8[_0x0a9e('0x36')]=_['intersection'](_0x130ae8[_0x0a9e('0x34')],_0x130ae8[_0x0a9e('0x35')]);_0x1fafc2['attributes']=_['intersection'](_0x130ae8[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x2b8823[_0x0a9e('0x35')]['fields']));_0x1fafc2['attributes']=_0x1fafc2['attributes'][_0x0a9e('0x2c')]?_0x1fafc2[_0x0a9e('0x39')]:_0x130ae8[_0x0a9e('0x34')];if(!_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x1fafc2[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x1fafc2[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0x1fafc2[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x1fafc2['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x2b8823[_0x0a9e('0x35')],_0x130ae8[_0x0a9e('0x36')]));_0x1fafc2[_0x0a9e('0x3e')][_0x0a9e('0xe0')]=_0x6b948a['id'];if(_0x2b8823['query'][_0x0a9e('0x5d')]){_0x1fafc2[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0x1fafc2[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x1fafc2[_0x0a9e('0x39')],function(_0x103ad9){var _0x7c4ce2={};_0x7c4ce2[_0x103ad9]={'$like':'%'+_0x2b8823[_0x0a9e('0x35')]['filter']+'%'};return _0x7c4ce2;})});}_0x1fafc2=_['merge']({},_0x1fafc2,_0x2b8823[_0x0a9e('0xcc')]);return db[_0x0a9e('0x94')]['count']({'where':_0x1fafc2[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x4c8d75){_0x43fe24[_0x0a9e('0x1e')]=_0x4c8d75;if(_0x2b8823['query'][_0x0a9e('0xe1')]){_0x1fafc2[_0x0a9e('0xe2')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x8d')](_0x1fafc2);})[_0x0a9e('0x23')](function(_0x5952c8){_0x43fe24[_0x0a9e('0x85')]=_0x5952c8;return _0x43fe24;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x55926d,_0x1fafc2))['catch'](handleError(_0x55926d,null));};exports[_0x0a9e('0xe3')]=function(_0x237994,_0x28a078,_0x24361){var _0x8f68ec={'raw':!![],'where':{}};var _0x17a0d5={};var _0x5d525f={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x237994['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x28a078,null))[_0x0a9e('0x23')](function(_0x22c390){if(_0x22c390){_0x17a0d5[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0xa5')][_0x0a9e('0xc9')]);_0x17a0d5['query']=_['keys'](_0x237994['query']);_0x17a0d5['filters']=_['intersection'](_0x17a0d5[_0x0a9e('0x34')],_0x17a0d5[_0x0a9e('0x35')]);_0x8f68ec['attributes']=_['intersection'](_0x17a0d5[_0x0a9e('0x34')],qs['fields'](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x38')]));_0x8f68ec[_0x0a9e('0x39')]=_0x8f68ec[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0x8f68ec[_0x0a9e('0x39')]:_0x17a0d5['model'];if(!_0x237994[_0x0a9e('0x35')][_0x0a9e('0x3a')]('nolimit')){_0x8f68ec[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x8f68ec[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x237994[_0x0a9e('0x35')]['offset']);}_0x8f68ec[_0x0a9e('0x3c')]=qs['sort'](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x8f68ec['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x237994['query'],_0x17a0d5[_0x0a9e('0x36')]));_0x8f68ec['where'][_0x0a9e('0xe0')]=_0x22c390['id'];if(_0x237994[_0x0a9e('0x35')]['filter']){_0x8f68ec[_0x0a9e('0x3e')]=_['merge'](_0x8f68ec[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x8f68ec[_0x0a9e('0x39')],function(_0x37ef45){var _0x288127={};_0x288127[_0x37ef45]={'$like':'%'+_0x237994[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x288127;})});}_0x8f68ec=_['merge']({},_0x8f68ec,_0x237994[_0x0a9e('0xcc')]);return db[_0x0a9e('0xa5')][_0x0a9e('0x1e')]({'where':_0x8f68ec[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x5932ad){_0x5d525f[_0x0a9e('0x1e')]=_0x5932ad;if(_0x237994['query']['includeAll']){_0x8f68ec[_0x0a9e('0xe2')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x8d')](_0x8f68ec);})[_0x0a9e('0x23')](function(_0x58d5fd){_0x5d525f[_0x0a9e('0x85')]=_0x58d5fd;return _0x5d525f;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x28a078,_0x8f68ec))[_0x0a9e('0x8b')](handleError(_0x28a078,null));};exports[_0x0a9e('0xe4')]=function(_0x2e1adc,_0x25eb44,_0x3d2bb0){var _0xb8c15={'raw':!![],'where':{}};var _0x3d02ae={};var _0x5871d7={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x2e1adc[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x25eb44,null))['then'](function(_0x38d95a){if(_0x38d95a){_0x3d02ae[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db['CmHopperFinal'][_0x0a9e('0xc9')]);_0x3d02ae[_0x0a9e('0x35')]=_[_0x0a9e('0x2b')](_0x2e1adc['query']);_0x3d02ae[_0x0a9e('0x36')]=_['intersection'](_0x3d02ae[_0x0a9e('0x34')],_0x3d02ae[_0x0a9e('0x35')]);_0xb8c15[_0x0a9e('0x39')]=_[_0x0a9e('0x37')](_0x3d02ae[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x2e1adc[_0x0a9e('0x35')]['fields']));_0xb8c15[_0x0a9e('0x39')]=_0xb8c15[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0xb8c15[_0x0a9e('0x39')]:_0x3d02ae[_0x0a9e('0x34')];if(!_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0xb8c15[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0xb8c15[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0xb8c15[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0xb8c15[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x2e1adc['query'],_0x3d02ae[_0x0a9e('0x36')]));_0xb8c15[_0x0a9e('0x3e')][_0x0a9e('0xe0')]=_0x38d95a['id'];if(_0x2e1adc['query'][_0x0a9e('0x5d')]){_0xb8c15['where']=_[_0x0a9e('0xcb')](_0xb8c15[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0xb8c15[_0x0a9e('0x39')],function(_0x455bca){var _0xb09ef6={};_0xb09ef6[_0x455bca]={'$like':'%'+_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0xb09ef6;})});}_0xb8c15=_['merge']({},_0xb8c15,_0x2e1adc[_0x0a9e('0xcc')]);return db[_0x0a9e('0xa4')]['count']({'where':_0xb8c15[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x579bb0){_0x5871d7['count']=_0x579bb0;if(_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0xe1')]){_0xb8c15[_0x0a9e('0xe2')]=[{'all':!![]}];}return db[_0x0a9e('0xa4')]['findAll'](_0xb8c15);})[_0x0a9e('0x23')](function(_0x31648e){_0x5871d7[_0x0a9e('0x85')]=_0x31648e;return _0x5871d7;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x25eb44,_0xb8c15))[_0x0a9e('0x8b')](handleError(_0x25eb44,null));};exports['getJscriptySessions']=function(_0xa3ba12,_0x3fc431,_0x4df303){var _0x34112c={'raw':!![],'where':{}};var _0x2d20a0={};var _0x38284a={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0xa3ba12[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x3fc431,null))[_0x0a9e('0x23')](function(_0x283bbb){if(_0x283bbb){_0x2d20a0[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0xab')][_0x0a9e('0xc9')]);_0x2d20a0['query']=_['keys'](_0xa3ba12[_0x0a9e('0x35')]);_0x2d20a0['filters']=_[_0x0a9e('0x37')](_0x2d20a0[_0x0a9e('0x34')],_0x2d20a0[_0x0a9e('0x35')]);_0x34112c[_0x0a9e('0x39')]=_['intersection'](_0x2d20a0[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0xa3ba12['query'][_0x0a9e('0x38')]));_0x34112c['attributes']=_0x34112c[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0x34112c[_0x0a9e('0x39')]:_0x2d20a0[_0x0a9e('0x34')];if(!_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x3a')]('nolimit')){_0x34112c[_0x0a9e('0x1d')]=qs['limit'](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x34112c[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0x34112c[_0x0a9e('0x3c')]=qs['sort'](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x34112c[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0xa3ba12['query'],_0x2d20a0[_0x0a9e('0x36')]));_0x34112c[_0x0a9e('0x3e')]['ContactId']=_0x283bbb['id'];if(_0xa3ba12['query'][_0x0a9e('0x5d')]){_0x34112c[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0x34112c[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x34112c[_0x0a9e('0x39')],function(_0x4d35ed){var _0x1e31c2={};_0x1e31c2[_0x4d35ed]={'$like':'%'+_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x1e31c2;})});}_0x34112c=_['merge']({},_0x34112c,_0xa3ba12[_0x0a9e('0xcc')]);return db[_0x0a9e('0xab')][_0x0a9e('0x1e')]({'where':_0x34112c[_0x0a9e('0x3e')]})['then'](function(_0x5d4935){_0x38284a[_0x0a9e('0x1e')]=_0x5d4935;if(_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0xe1')]){_0x34112c[_0x0a9e('0xe2')]=[{'all':!![]}];}return db[_0x0a9e('0xab')][_0x0a9e('0x8d')](_0x34112c);})[_0x0a9e('0x23')](function(_0x23dd12){_0x38284a['rows']=_0x23dd12;return _0x38284a;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x3fc431,_0x34112c))['catch'](handleError(_0x3fc431,null));};exports[_0x0a9e('0xe5')]=function(_0x20dcfd,_0x3fd399,_0x4984b1){try{if(!_0x20dcfd['body'][_0x0a9e('0x60')]){throw new Error('No\x20ListId\x20specified');}if(!_0x20dcfd[_0x0a9e('0x8c')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe6')]){throw new Error(_0x0a9e('0xe7'));}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe8')]){throw new Error(_0x0a9e('0xe9'));}var _0x2f64ef=_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xea')][_0x0a9e('0x84')](',');var _0x81f495=_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe6')]['split'](',');if(!_0x2f64ef['length']||!_0x81f495[_0x0a9e('0x2c')]||_0x2f64ef['length']!==_0x81f495[_0x0a9e('0x2c')]){throw new Error(_0x0a9e('0xeb'));}_0x20dcfd[_0x0a9e('0x8c')]['fields']=_['zipObject'](_0x2f64ef,_0x81f495);if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x38')][_0x0a9e('0xc7')]){throw new Error(_0x0a9e('0xec'));}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x38')][_0x0a9e('0xed')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x12984a=path['join'](config[_0x0a9e('0xee')],_0x0a9e('0xef'),_0x20dcfd['file'][_0x0a9e('0xf0')]);fs[_0x0a9e('0xf1')](_0x12984a,parseInt(_0x0a9e('0xf2'),0x8));var _0x4524b8=require(_0x0a9e('0xf3'))[_0x0a9e('0xf4')](path['join'](__dirname,_0x0a9e('0xf5')),[_0x12984a,_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xea')],_0x20dcfd['body'][_0x0a9e('0xe6')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x60')],_0x20dcfd['body'][_0x0a9e('0xf6')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xb2')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe8')]]);return _0x3fd399[_0x0a9e('0x1a')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x4524b8[_0x0a9e('0xf7')]});}catch(_0x1e01af){return _0x3fd399['status'](0x1f4)[_0x0a9e('0xf8')](_0x1e01af);}};exports[_0x0a9e('0xf9')]=function(_0x315735,_0x35dadd,_0x2e413d){var _0x4e3983=fs['createReadStream'](_0x315735[_0x0a9e('0xfa')][_0x0a9e('0x6')]);Papa[_0x0a9e('0xfb')](_0x4e3983,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4edb79){return _0x35dadd[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0xfc')]({'file':_0x315735[_0x0a9e('0xfa')],'fields':_0x4edb79[_0x0a9e('0xfd')]['fields']});}});};exports['import']=function(_0x46b143,_0x14b098,_0x16b4ae){return db['User'][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0x73')}})[_0x0a9e('0x23')](function(_0x1fc545){var _0x45616c=![];if(!_0x46b143[_0x0a9e('0x8c')][_0x0a9e('0x60')]){throw new Error(_0x0a9e('0xfe'));}if(!_0x46b143['body']['binding'][_0x0a9e('0xc7')]){throw new Error(_0x0a9e('0xec'));}if(!_0x46b143['body'][_0x0a9e('0xff')]['firstName']){throw new Error(_0x0a9e('0x100'));}if(!_0x46b143[_0x0a9e('0x8c')]['socket_timestamp']){throw new Error(_0x0a9e('0xe9'));}var _0xd6570f=require('child_process')[_0x0a9e('0xf4')](path[_0x0a9e('0x91')](__dirname,_0x0a9e('0x101')),[_0x46b143[_0x0a9e('0xb9')]['id'],JSON[_0x0a9e('0x102')](_0x46b143[_0x0a9e('0x8c')]),JSON[_0x0a9e('0x102')](_0x1fc545)]);_0xd6570f['on']('message',function(_0x1da68c){_0x45616c=!![];return _0x14b098[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0xfc')]({'message':_0x0a9e('0x103'),'pid':_0xd6570f[_0x0a9e('0xf7')]});});_0xd6570f['on'](_0x0a9e('0x104'),function(_0x456884){if(_0x456884&&!_0x45616c){return _0x14b098['status'](0x1f4)['json']({'message':_0x0a9e('0x105'),'pid':_0xd6570f[_0x0a9e('0xf7')]});}});})[_0x0a9e('0x8b')](handleError(_0x14b098,null));};exports['importUpdates']=function(_0x5cf1ba,_0xf7ddca,_0x55075d){return db[_0x0a9e('0x56')][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0x73')}})[_0x0a9e('0x23')](function(_0x20f4cb){var _0x13c6df=![];if(!_0x5cf1ba[_0x0a9e('0x8c')][_0x0a9e('0x60')]){throw new Error(_0x0a9e('0xfe'));}if(!_0x5cf1ba['body']['binding'][_0x0a9e('0xc7')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5cf1ba[_0x0a9e('0x8c')][_0x0a9e('0xff')][_0x0a9e('0xed')]){throw new Error(_0x0a9e('0x100'));}if(!_0x5cf1ba['body'][_0x0a9e('0xe8')]){throw new Error(_0x0a9e('0xe9'));}var _0x2bc6a3=require('child_process')[_0x0a9e('0xf4')](path[_0x0a9e('0x91')](__dirname,_0x0a9e('0x106')),[_0x5cf1ba['params']['id'],JSON[_0x0a9e('0x102')](_0x5cf1ba[_0x0a9e('0x8c')]),JSON[_0x0a9e('0x102')](_0x20f4cb)]);_0x2bc6a3['on'](_0x0a9e('0x107'),function(_0x69b4d6){_0x13c6df=!![];return _0xf7ddca[_0x0a9e('0x1a')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x2bc6a3[_0x0a9e('0xf7')]});});_0x2bc6a3['on'](_0x0a9e('0x104'),function(_0x10d713){if(_0x10d713&&!_0x13c6df){return _0xf7ddca['status'](0x1f4)['json']({'message':_0x0a9e('0x105'),'pid':_0x2bc6a3[_0x0a9e('0xf7')]});}});})[_0x0a9e('0x8b')](handleError(_0xf7ddca,null));};exports['getJourney']=function(_0x4b51ff,_0x12d1dd){var _0x2c8d95=[_0x0a9e('0x108'),_0x0a9e('0x109'),_0x0a9e('0x10a'),'openchannel',_0x0a9e('0x10b'),'whatsapp',_0x0a9e('0x10c')];var _0x311e40={'offset':0x0,'order':qs[_0x0a9e('0x3d')]('-createdAt')},_0x57e719={'count':0x0,'rows':[]};Promise[_0x0a9e('0x71')]()[_0x0a9e('0x23')](function(){if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x10d')]){if(!_[_0x0a9e('0x10e')](_0x2c8d95,_0x4b51ff['query'][_0x0a9e('0x10d')][_0x0a9e('0x10f')]())){throw new Error(_0x0a9e('0x110'));}_0x2c8d95=[_0x4b51ff['query'][_0x0a9e('0x10d')]['toLowerCase']()];}if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){try{var _0x2777fe=JSON['parse'](_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]);if(!moment(_0x2777fe[_0x0a9e('0x42')])[_0x0a9e('0x112')]()){throw new Error(_0x0a9e('0x113'));}if(!moment(_0x2777fe['to'])[_0x0a9e('0x112')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x3057c9){throw new Error(_0x0a9e('0x114'));}}if(!_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x311e40[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x4b51ff[_0x0a9e('0x35')]['limit']||0xa);_0x311e40[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}var _0x55a300=_0x2c8d95[_0x0a9e('0x52')](function(_0x57c3c4){if(_0x57c3c4===_0x0a9e('0x10c')){var _0x22ef0f={'attributes':['id',_0x0a9e('0x115'),'type',_0x0a9e('0x116'),_0x0a9e('0x117'),_0x0a9e('0x118'),_0x0a9e('0x119'),'endtime',_0x0a9e('0x11a'),_0x0a9e('0x11b'),_0x0a9e('0x11c'),_0x0a9e('0x11d'),_0x0a9e('0x11e'),_0x0a9e('0x11f'),_0x0a9e('0x120')],'where':{'ContactId':_0x4b51ff['params']['id']},'include':[{'model':db[_0x0a9e('0x56')],'as':_0x0a9e('0x56'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x121'),'alias']}],'order':[[_0x0a9e('0x11c'),'DESC']]};if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){_0x22ef0f[_0x0a9e('0x3e')][_0x0a9e('0x11c')]={'$gte':_0x2777fe[_0x0a9e('0x42')],'$lte':_0x2777fe['to']};}return db[_0x0a9e('0xa6')][_0x0a9e('0x122')](_0x22ef0f)['then'](function(_0x173f03){_0x57e719['count']+=_0x173f03[_0x0a9e('0x1e')];return _[_0x0a9e('0x52')](_0x173f03['rows'],function(_0x2ebed3){var _0x167f89=_0x2ebed3[_0x0a9e('0x8e')]({'plain':!![]});_0x167f89[_0x0a9e('0x10d')]=_0x57c3c4;if(_0x167f89['User']){_0x167f89[_0x0a9e('0x56')]={'id':_0x167f89[_0x0a9e('0x56')]['id'],'name':_0x167f89['User'][_0x0a9e('0x27')],'fullname':_0x167f89['User']['fullname'],'alias':_0x167f89['User'][_0x0a9e('0x123')]};}return _0x167f89;});});}else{var _0x2ec662=_['startCase'](_0x57c3c4)+(_0x57c3c4===_0x0a9e('0x109')?_0x0a9e('0x124'):'Account');var _0xc48226={'attributes':['id',_0x0a9e('0x125'),_0x0a9e('0x126'),_0x0a9e('0x11c'),_0x0a9e('0x11b'),_0x0a9e('0x127'),_0x0a9e('0x128'),'thirdDisposition',_0x0a9e('0x120'),_0x2ec662+'Id'],'where':{'ContactId':_0x4b51ff['params']['id']},'include':[{'model':db[_0x2ec662],'as':_0x0a9e('0x129'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x12a')]},{'model':db[_0x0a9e('0x56')],'as':_0x0a9e('0x12b'),'attributes':['id',_0x0a9e('0x27'),'fullname']},{'model':db[_0x0a9e('0x50')],'as':_0x0a9e('0x83'),'attributes':['id',_0x0a9e('0x27'),'color'],'through':{'attributes':[]}}],'order':[[_0x0a9e('0x11c'),_0x0a9e('0x6f')]]};if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){_0xc48226[_0x0a9e('0x3e')][_0x0a9e('0x11c')]={'$gte':_0x2777fe[_0x0a9e('0x42')],'$lte':_0x2777fe['to']};}switch(_0x57c3c4){case _0x0a9e('0x109'):_0xc48226[_0x0a9e('0x39')][_0x0a9e('0x2e')](_0x0a9e('0x12c'),_0x0a9e('0x12d'),_0x0a9e('0x12e'),_0x0a9e('0x12f'),_0x0a9e('0x130'),_0x0a9e('0x131'),'ratingType',_0x0a9e('0x132'),_0x0a9e('0x133'));break;case _0x0a9e('0x108'):_0xc48226['attributes'][_0x0a9e('0x2e')](_0x0a9e('0x134'),_0x0a9e('0x135'));break;case _0x0a9e('0x136'):_0xc48226['attributes'][_0x0a9e('0x2e')](_0x0a9e('0x137'),_0x0a9e('0x138'));break;}return db[_[_0x0a9e('0x139')](_0x57c3c4)+'Interaction'][_0x0a9e('0x122')](_0xc48226)[_0x0a9e('0x23')](function(_0x132455){_0x57e719[_0x0a9e('0x1e')]+=_0x132455['count'];return _['map'](_0x132455[_0x0a9e('0x85')],function(_0x44343f){var _0x2de997=_0x44343f[_0x0a9e('0x8e')]({'plain':!![]});_0x2de997[_0x0a9e('0x10d')]=_0x57c3c4;if(_0x2de997[_0x0a9e('0x12b')]){_0x2de997[_0x0a9e('0x12b')]={'id':_0x2de997[_0x0a9e('0x12b')]['id'],'name':_0x2de997[_0x0a9e('0x12b')][_0x0a9e('0x27')],'fullname':_0x2de997[_0x0a9e('0x12b')][_0x0a9e('0x121')]};}return _0x2de997;});});}});return Promise[_0x0a9e('0x32')](_0x55a300);})[_0x0a9e('0x23')](function(_0x4f5ebd){return _(_0x4f5ebd)[_0x0a9e('0x13a')]()[_0x0a9e('0x13b')](_0x0a9e('0x11c'))['reverse']()['value']();})[_0x0a9e('0x23')](function(_0x51ec16){_0x57e719[_0x0a9e('0x85')]=_0x311e40[_0x0a9e('0x1d')]?_0x51ec16[_0x0a9e('0x13c')](_0x311e40[_0x0a9e('0x1b')],_0x311e40['offset']+_0x311e40['limit']):_0x51ec16;return _0x57e719;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x12d1dd,_0x311e40))[_0x0a9e('0x8b')](handleError(_0x12d1dd,null));}; \ No newline at end of file +var _0xa9e0=['status','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','index','CmContact','describe','keys','length','cf_','push','CmCustomField','findOne','trimStart','all','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','castTo','DATE','buildExpression','text','start','filter','Contact','isEmpty','ListId','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','clone','DESC','t.id\x20IN\x20?','resolve','user','agent','some','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','role','sequelize','toString','c.firstName','c.mobile','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','split','rows','find','startsWith','displayName','columnName','custom','catch','body','findAll','get','mergeWith','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','contact','show','Phones','params','ContactItemType','ItemType','literal','`Phones.ItemType`.OrderBy','log','$and','omit','format','cf_%d','pickBy','setFields','id\x20=\x20?','values','phone','getTags','rawAttributes','pick','merge','options','setTags','ids','setAdditionalPhones','items','item_types','isNil','ItemTypeId','description','CmHopperAdditionalPhone','item','OrderBy','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','PHONE','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','ContactId','includeAll','include','getHopperHistories','getHopperFinals','uploadCsv','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','send','upload','file','parse','json','meta','No\x20ListId\x20specified','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','message','mail','chat','sms','fax','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','alias','Website','closed','closedAt','disposition','secondDisposition','Account','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','startCase','flatten','sortBy','slice','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','redis','defaults','localhost','./cmContact.socket','register'];(function(_0x513093,_0x449ffc){var _0x3f5880=function(_0xf13d35){while(--_0xf13d35){_0x513093['push'](_0x513093['shift']());}};_0x3f5880(++_0x449ffc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=typeof _0x5a0a06[_0x0a9e('0x1b')]===_0x0a9e('0x1c')&&typeof _0x5a0a06[_0x0a9e('0x1d')]===_0x0a9e('0x1c');var _0x530eb7=_0x459eb1[_0x0a9e('0x1e')];var _0x1314ae=_0x478723?0x0:_0x5a0a06[_0x0a9e('0x1b')];var _0x1c696a=_0x478723?_0x459eb1[_0x0a9e('0x1e')]:_0x5a0a06['offset']+_0x5a0a06[_0x0a9e('0x1d')];var _0x155cce;if(_0x1c696a>=_0x530eb7){_0x1c696a=_0x530eb7;_0x155cce=0xc8;}else{_0x155cce=0xce;}_0x225616['status'](_0x155cce);return _0x225616[_0x0a9e('0x1f')]('Content-Range',_0x1314ae+'-'+_0x1c696a+'/'+_0x530eb7)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x3a02e1){return function(_0x432e56){try{jsonpatch[_0x0a9e('0x20')](_0x432e56,_0x3a02e1,!![]);}catch(_0x30bae6){return BPromise['reject'](_0x30bae6);}return _0x432e56[_0x0a9e('0x21')]();};}function saveUpdates(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x22')](_0x2fb0e4)[_0x0a9e('0x23')](function(_0x16b1ca){return _0x16b1ca;});}return null;};}function removeEntity(_0x5ea472,_0x59181e){return function(_0x197ec0){if(_0x197ec0){return _0x197ec0[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){_0x5ea472[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x25')](_0x25fba9[_0x0a9e('0x26')]);if(_0x25fba9[_0x0a9e('0x27')]){delete _0x25fba9[_0x0a9e('0x27')];}_0x1dc186[_0x0a9e('0x1a')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x28')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x58b06f){var _0x563b45=[];for(var _0x296f41=0x0;_0x296f410x1){_0x10b040['or'](_0x0a9e('0x66'),qs['getFullTextValue'](_0x121cef),null);}else{if(qs[_0x0a9e('0x67')](_0x121cef)){_0x10b040['or']('c.id\x20LIKE\x20?',_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x68'),_0x121cef+'%');_0x10b040['or']('c.mobile\x20LIKE\x20?',_0x121cef+'%');_0x10b040['or']('c.fax\x20LIKE\x20?',_0x121cef+'%');}else if(qs['isEmail'](_0x121cef)){_0x10b040['or'](_0x0a9e('0x69'),_0x121cef+'%');}else{_0x10b040['or']('c.firstName\x20LIKE\x20?','%'+_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x6a'),'%'+_0x121cef+'%');_0x10b040['or'](_0x0a9e('0x69'),'%'+_0x121cef+'%');}}}}_0x23b089[_0x0a9e('0x3e')](_0x10b040);_0x23b089[_0x0a9e('0x6b')](_0x0a9e('0x6c'));var _0x26d7db={'type':db['Sequelize'][_0x0a9e('0x6d')]['SELECT'],'raw':!![]};var _0xca4ade=_0x23b089[_0x0a9e('0x6e')]()[_0x0a9e('0x40')]('c.id');if(_0x2ec755[_0x0a9e('0x3c')]){_0x2ec755[_0x0a9e('0x3c')][_0x0a9e('0x53')](function(_0x32e134){_0x23b089['order']('c.'+_0x32e134[0x0],_0x32e134[0x1]===_0x0a9e('0x6f')?![]:!![]);});}if(!_[_0x0a9e('0x5f')](_0x432fcc)){_0x23b089['having'](_0x25c6e6);_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x70'),_0x432fcc);}BPromise[_0x0a9e('0x71')]()[_0x0a9e('0x23')](function(){if(!_0x35ed4a)return;if(_0x468813[_0x0a9e('0x72')]['role']!==_0x0a9e('0x73'))return;if(!_[_0x0a9e('0x74')](_0x35ed4a[_0x0a9e('0x4f')],['field',_0x0a9e('0x56')])){return _0x468813['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x0a9e('0x23')](function(_0x4556c5){if(_[_0x0a9e('0x5f')](_0x4556c5)){_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x75'));_0x23b089[_0x0a9e('0x3e')](_0x0a9e('0x75'));}else{_0xca4ade[_0x0a9e('0x3e')](_0x0a9e('0x76'),_[_0x0a9e('0x52')](_0x4556c5,'id'));_0x23b089[_0x0a9e('0x3e')](_0x0a9e('0x76'),_[_0x0a9e('0x52')](_0x4556c5,'id'));}});}})[_0x0a9e('0x23')](function(){if(_0x468813[_0x0a9e('0x72')][_0x0a9e('0x77')]===_0x0a9e('0x73')&&!_0x35ed4a&&!_0x468813[_0x0a9e('0x35')]['ListId'])return[];return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0xca4ade[_0x0a9e('0x79')](),_0x26d7db);})['then'](function(_0x1148a1){_0x15b200[_0x0a9e('0x1e')]=_0x1148a1['length'];if(_0x15b200[_0x0a9e('0x1e')]===0x0)return[];return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0x5b4f5e[_0x0a9e('0x79')](),_0x26d7db)[_0x0a9e('0x23')](function(_0x4a43a8){_0x1459bb=_['keyBy'](_0x4a43a8,'id');_0x26d7db=_['merge'](_0x26d7db,{'model':db[_0x0a9e('0x29')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x468813[_0x0a9e('0x35')][_0x0a9e('0x38')]){_0x2ec755[_0x0a9e('0x39')][_0x0a9e('0x53')](function(_0x380ab3){_0x23b089[_0x0a9e('0x40')]('c.'+_0x380ab3);});}else{_0x23b089[_0x0a9e('0x40')]('c.id');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7a'));_0x23b089[_0x0a9e('0x40')]('c.lastName');_0x23b089[_0x0a9e('0x40')]('c.phone');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7b'));_0x23b089['field'](_0x0a9e('0x7c'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7d'));_0x23b089[_0x0a9e('0x40')]('c.ListId');_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7e'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x7f'));_0x23b089['field'](_0x0a9e('0x80'));_0x23b089[_0x0a9e('0x40')](_0x0a9e('0x81'),_0x0a9e('0x82'));}if(_0x2ec755['limit'])_0x23b089[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x1d')]);if(_0x2ec755[_0x0a9e('0x1b')])_0x23b089[_0x0a9e('0x1b')](_0x2ec755[_0x0a9e('0x1b')]);return db[_0x0a9e('0x78')][_0x0a9e('0x35')](_0x23b089[_0x0a9e('0x79')](),_0x26d7db);});})[_0x0a9e('0x23')](function(_0x336dc3){_0x336dc3[_0x0a9e('0x53')](function(_0x1f10ef){if(_0x1f10ef[_0x0a9e('0x82')]){_0x1f10ef[_0x0a9e('0x83')]=[];_0x1f10ef['TagIds'][_0x0a9e('0x84')](',')[_0x0a9e('0x53')](function(_0xc599b3){_0x1f10ef['Tags'][_0x0a9e('0x2e')](_0x1459bb[_0xc599b3]);});}delete _0x1f10ef[_0x0a9e('0x82')];});_0x15b200[_0x0a9e('0x85')]=_0x336dc3;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755));})['catch'](handleError(_0x2b1f27,null));};exports['destroy']=function(_0x7ebea8,_0x2bbdb5){return db['CmContact'][_0x0a9e('0x86')]({'where':{'id':_0x7ebea8['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x23')](removeEntity(_0x2bbdb5,null))['catch'](handleError(_0x2bbdb5,null));};exports[_0x0a9e('0x2a')]=function(_0x41cf12,_0x2d2286){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x444f1f){delete _0x444f1f['tags'];for(var _0x2973d3=0x0;_0x2973d30x0){return new Promise(function(_0x4a70ce,_0x55f91a){var _0x183244=[];for(var _0x1f78b4=0x0;_0x1f78b4<_0x5c4be0[_0x0a9e('0x2c')];_0x1f78b4++){_0x183244['push'](insertAdditionalPhones(_0x5c4be0[_0x1f78b4][_0x0a9e('0xb6')],_0x5c4be0[_0x1f78b4][_0x0a9e('0xaf')]));}Promise[_0x0a9e('0x32')](_0x183244)[_0x0a9e('0x23')](function(){_0x4a70ce(0x1);});})[_0x0a9e('0x23')](function(){return{'success':_0x5b93dd,'failure':_0x556443,'duplicates':_0x6eaaf0};});}else{return{'success':_0x5b93dd,'failure':_0x556443,'duplicates':_0x6eaaf0};}}})[_0x0a9e('0x23')](respondWithResult(_0x98c62c,0xc9))[_0x0a9e('0x8b')](handleError(_0x98c62c,null));};exports[_0x0a9e('0xb7')]=function(_0x3b5bda,_0x5a1848,_0x43c397){var _0x5526a7;return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x23')](function(_0x3cf222){return db[_0x0a9e('0x29')][_0x0a9e('0x86')]({'where':{'id':_0x3b5bda['params']['id']},'include':[{'model':db[_0x0a9e('0x50')],'as':_0x0a9e('0x83'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x41')],'required':_0x3b5bda['query'][_0x0a9e('0x64')]?!![]:![]},{'model':db[_0x0a9e('0xa3')],'as':_0x0a9e('0xb8'),'where':{'CmContactId':_0x3b5bda[_0x0a9e('0xb9')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0xba')],'as':_0x0a9e('0xbb')}]}],'order':[db[_0x0a9e('0x78')][_0x0a9e('0xbc')](_0x0a9e('0xbd'))],'logging':console[_0x0a9e('0xbe')],'attributes':_['keys'](_0x3cf222)});})[_0x0a9e('0x23')](function(_0x88b25f){_0x5526a7=_0x88b25f[_0x0a9e('0x8e')]({'plain':!![]});var _0x26b826={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x88b25f&&_0x88b25f[_0x0a9e('0x60')]){if(_0x88b25f[_0x0a9e('0x60')]){_0x26b826[_0x0a9e('0x3e')][_0x0a9e('0xbf')]['push']({'ListId':{'$ne':_0x88b25f[_0x0a9e('0x60')]}});}}return db[_0x0a9e('0x2f')][_0x0a9e('0x8d')](_0x26b826);})['then'](function(_0x1402c7){return _[_0x0a9e('0xc0')](_0x5526a7,_[_0x0a9e('0x52')](_0x1402c7,function(_0x97d5b5){return util[_0x0a9e('0xc1')](_0x0a9e('0xc2'),_0x97d5b5['id']);}));})[_0x0a9e('0x23')](handleEntityNotFound(_0x5a1848,null))[_0x0a9e('0x23')](respondWithResult(_0x5a1848,null))[_0x0a9e('0x8b')](handleError(_0x5a1848,null));};exports[_0x0a9e('0x22')]=function(_0x5a7dad,_0x251753){var _0x446e6;if(_0x5a7dad[_0x0a9e('0x8c')]['id']){delete _0x5a7dad[_0x0a9e('0x8c')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x86')]({'where':{'id':_0x5a7dad['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x251753,null))['then'](saveUpdates(_0x5a7dad['body'],null))['then'](function(_0x19e4e6){_0x446e6=_0x19e4e6;var _0x3fa3f2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x19e4e6&&_0x19e4e6[_0x0a9e('0x60')]){if(_0x19e4e6[_0x0a9e('0x60')]){_0x3fa3f2['where'][_0x0a9e('0xbf')][_0x0a9e('0x2e')]({'ListId':{'$ne':_0x19e4e6[_0x0a9e('0x60')]}});}}return db[_0x0a9e('0x2f')][_0x0a9e('0x8d')](_0x3fa3f2);})['then'](function(_0x57b1b1){if(_0x57b1b1){return _[_0x0a9e('0xc0')](_[_0x0a9e('0xc3')](_0x5a7dad[_0x0a9e('0x8c')],function(_0x5e85d0,_0x319752){return _[_0x0a9e('0x87')](_0x319752,_0x0a9e('0x2d'));}),_['map'](_0x57b1b1,function(_0x8ad1c0){return util[_0x0a9e('0xc1')](_0x0a9e('0xc2'),_0x8ad1c0['id']);}));}})['then'](function(_0x272291){if(_0x272291&&!_[_0x0a9e('0x5f')](_0x272291)){var _0x3b7213=squel['update']()['table']('cm_contacts')[_0x0a9e('0xc4')](_0x272291)[_0x0a9e('0x3e')](_0x0a9e('0xc5'),_0x5a7dad[_0x0a9e('0xb9')]['id'])['toParam']();return db[_0x0a9e('0x78')]['query'](_0x3b7213[_0x0a9e('0x5b')],{'replacements':_0x3b7213[_0x0a9e('0xc6')]});}})[_0x0a9e('0x23')](function(){if(_0x5a7dad['body'][_0x0a9e('0xc7')]&&_0x446e6){return db[_0x0a9e('0x94')][_0x0a9e('0x22')]({'phone':_0x5a7dad['body'][_0x0a9e('0xc7')]},{'where':{'ContactId':_0x446e6['id']}});}})['then'](function(){return _0x446e6;})[_0x0a9e('0x23')](respondWithResult(_0x251753,null))['catch'](handleError(_0x251753,null));};exports[_0x0a9e('0xc8')]=function(_0x57b7d4,_0xb14971,_0x37215d){var _0xa288e4={};var _0x10ace8={};var _0x1e306c;var _0x251dd9;return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x57b7d4[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0xb14971,null))['then'](function(_0xf4fb77){if(_0xf4fb77){_0x1e306c=_0xf4fb77;_0x10ace8[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x50')][_0x0a9e('0xc9')]);_0x10ace8[_0x0a9e('0x35')]=_['keys'](_0x57b7d4[_0x0a9e('0x35')]);_0x10ace8[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x10ace8[_0x0a9e('0x34')],_0x10ace8[_0x0a9e('0x35')]);_0xa288e4[_0x0a9e('0x39')]=_[_0x0a9e('0x37')](_0x10ace8[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x57b7d4[_0x0a9e('0x35')]['fields']));_0xa288e4[_0x0a9e('0x39')]=_0xa288e4['attributes'][_0x0a9e('0x2c')]?_0xa288e4[_0x0a9e('0x39')]:_0x10ace8[_0x0a9e('0x34')];_0xa288e4[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x57b7d4[_0x0a9e('0x35')]['sort']);_0xa288e4[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x57b7d4['query'],_0x10ace8[_0x0a9e('0x36')]));if(_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x5d')]){_0xa288e4[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0xa288e4[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0xa288e4['attributes'],function(_0x4e1b3){var _0x228c10={};_0x228c10[_0x4e1b3]={'$like':'%'+_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x228c10;})});}_0xa288e4=_[_0x0a9e('0xcb')]({},_0xa288e4,_0x57b7d4[_0x0a9e('0xcc')]);return _0x1e306c[_0x0a9e('0xc8')](_0xa288e4);}})['then'](function(_0x5c8720){if(_0x5c8720){_0x251dd9=_0x5c8720[_0x0a9e('0x2c')];if(!_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0xa288e4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x57b7d4[_0x0a9e('0x35')]['limit']);_0xa288e4[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x57b7d4[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}return _0x1e306c[_0x0a9e('0xc8')](_0xa288e4);}})[_0x0a9e('0x23')](function(_0x16be7e){if(_0x16be7e){return _0x16be7e?{'count':_0x251dd9,'rows':_0x16be7e}:null;}})['then'](respondWithResult(_0xb14971,null))[_0x0a9e('0x8b')](handleError(_0xb14971,null));};exports[_0x0a9e('0xcd')]=function(_0x231826,_0x5885c3,_0x2b8ad4){if(_0x231826[_0x0a9e('0x8c')]['id']){delete _0x231826[_0x0a9e('0x8c')]['id'];}return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x231826[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5885c3,null))[_0x0a9e('0x23')](function(_0x93d953){if(_0x93d953){return _0x93d953[_0x0a9e('0xcd')](_0x231826[_0x0a9e('0x8c')][_0x0a9e('0xce')]||[]);}return null;})[_0x0a9e('0x23')](respondWithResult(_0x5885c3,null))['catch'](handleError(_0x5885c3,null));};exports[_0x0a9e('0xcf')]=function(_0x266aa1,_0x25e41f){var _0x397771=[];_0x397771['push'](addAdditionalPhones(_0x266aa1['body']));Promise[_0x0a9e('0x32')](_0x397771)[_0x0a9e('0x23')](function(){_0x397771=[];_0x397771[_0x0a9e('0x2e')](deleteCmHopperPhones(_0x266aa1['body']['id']));_0x397771[_0x0a9e('0x2e')](addCmHopperPhones(_0x266aa1[_0x0a9e('0x8c')]['id']));Promise['all'](_0x397771)[_0x0a9e('0x23')](function(){return[0x1];})['then'](respondWithResult(_0x25e41f,null));});};function addAdditionalPhones(_0x35cc2a){return new Promise(function(_0x54dbbf,_0x5b42b9){return db['CmContactHasItem'][_0x0a9e('0x24')]({'where':{'CmContactId':_0x35cc2a['id']}})[_0x0a9e('0x23')](function(){var _0x19f800=[];for(var _0x20007e=0x0;_0x20007e<_0x35cc2a[_0x0a9e('0xd0')][_0x0a9e('0x2c')];_0x20007e++){_0x19f800['push'](addAdditionalPhone(_0x35cc2a['id'],_0x35cc2a[_0x0a9e('0xd0')][_0x20007e][_0x0a9e('0xc7')],_0x35cc2a[_0x0a9e('0xd1')]?_[_0x0a9e('0xd2')](_0x35cc2a[_0x0a9e('0xd1')][_0x20007e])?null:_0x35cc2a[_0x0a9e('0xd1')][_0x20007e]:_0x35cc2a[_0x0a9e('0xd0')][_0x20007e]['ItemTypeId']?_0x35cc2a['items'][_0x20007e][_0x0a9e('0xd3')]:null,_0x20007e,_0x35cc2a['items'][_0x20007e][_0x0a9e('0xd4')]));}Promise[_0x0a9e('0x32')](_0x19f800)[_0x0a9e('0x23')](function(){_0x54dbbf(0x1);});});});}function addAdditionalPhone(_0xa3695f,_0x37a448,_0x383dd8,_0x594f25,_0x4716d1){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0xa3695f,'item':_0x37a448}})[_0x0a9e('0x23')](function(_0x593f9e){if(_0x593f9e)logger[_0x0a9e('0x92')]('contact\x20phone\x20exists',_0x593f9e);else{db['CmContactHasItem'][_0x0a9e('0x98')]({'CmContactId':_0xa3695f,'item':_0x37a448,'ItemTypeId':_0x383dd8,'OrderBy':_0x594f25,'ItemClass':'PHONE','description':_0x4716d1});}});}function deletePhones(_0x24470a){return db[_0x0a9e('0xa3')][_0x0a9e('0x24')]({'where':{'CmContactId':_0x24470a}});}function deleteCmHopperPhones(_0x48f532){return new Promise(function(_0x4152cd,_0x1209c4){return db[_0x0a9e('0x94')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x48f532}})['then'](function(_0xdc77d){db[_0x0a9e('0xd5')][_0x0a9e('0x24')]({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x52')](_0xdc77d,'id')}}});})[_0x0a9e('0x23')](function(){_0x4152cd(0x1);});});}function addCmHopperPhones(_0x376b97){return new Promise(function(_0x247a6c,_0x170b3d){return db[_0x0a9e('0x94')][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x376b97}})['then'](function(_0x51fa33){var _0x558171=[];_[_0x0a9e('0x52')](_0x51fa33,function(_0x19dcc2){_0x558171[_0x0a9e('0x2e')](createCmHopperPhone(_0x376b97,_0x19dcc2['id']));});Promise[_0x0a9e('0x32')](_0x558171)[_0x0a9e('0x23')](function(){_0x247a6c(0x1);});});});}function createCmHopperPhone(_0x2dc202,_0x2b97fc){return new Promise(function(_0x307d13,_0x5d74e9){db['CmContactHasItem'][_0x0a9e('0x8d')]({'raw':!![],'attributes':[_0x0a9e('0xd6')],'where':{'CmContactId':_0x2dc202,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0xba')],'attributes':[_0x0a9e('0xd7')],'as':_0x0a9e('0xbb')}],'order':[db[_0x0a9e('0x78')][_0x0a9e('0xbc')](_0x0a9e('0xd8'))]})[_0x0a9e('0x23')](function(_0x262281){var _0x59f8f7=0x1;var _0x400800=_[_0x0a9e('0x52')](_0x262281,function(_0x20e191){_0x20e191['CmHopperId']=_0x2b97fc;_0x20e191[_0x0a9e('0xc7')]=_0x20e191[_0x0a9e('0xd6')];_0x20e191[_0x0a9e('0xd7')]=_0x20e191[_0x0a9e('0xd9')]||_0x59f8f7;delete _0x20e191[_0x0a9e('0xd9')];_0x59f8f7=_0x59f8f7+0x1;return _0x20e191;});return db[_0x0a9e('0xd5')][_0x0a9e('0xb0')](_0x400800,{});})[_0x0a9e('0x23')](function(){_0x307d13(0x1);});});}function insertAdditionalPhones(_0x3a9c0f,_0x3f1959){return new Promise(function(_0x6b048e,_0x3ba472){var _0x4e6eb9=[];for(var _0x572a72=0x0;_0x572a72<_0x3f1959[_0x0a9e('0x2c')];_0x572a72++){var _0x401207=_0x3f1959[_0x572a72];_0x4e6eb9[_0x0a9e('0x2e')](parseContactItemType(_0x401207));}Promise[_0x0a9e('0x32')](_0x4e6eb9)[_0x0a9e('0x23')](function(){var _0x1e29e2={'id':_0x3a9c0f['id'],'items':_0x3f1959};return addAdditionalPhones(_0x1e29e2)[_0x0a9e('0x23')](function(_0x4f7907){return addCmHopperPhones(_0x3a9c0f['id']);});})[_0x0a9e('0x23')](function(){_0x6b048e(_0x3a9c0f);});});}function parseContactItemType(_0x49fd0e){return new Promise(function(_0x26aa44,_0x1ad1d7){if(_0x49fd0e[_0x0a9e('0x3a')](_0x0a9e('0xd3'))){_0x26aa44(_0x49fd0e);}else{return db[_0x0a9e('0xba')][_0x0a9e('0x86')]({'where':{'name':_0x49fd0e[_0x0a9e('0xbb')]}})[_0x0a9e('0x23')](function(_0xa7a754){if(_[_0x0a9e('0xd2')](_0xa7a754))_0x49fd0e[_0x0a9e('0xd3')]=null;else _0x49fd0e[_0x0a9e('0xd3')]=_0xa7a754['id'];_0x26aa44(_0x49fd0e);});}});}exports[_0x0a9e('0xda')]=function(_0x3f7cb6,_0x3c8a9a){return db[_0x0a9e('0xa3')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3f7cb6['params']['id'],'ItemClass':_0x0a9e('0xdb')},'include':[{'model':db[_0x0a9e('0xba')],'as':'ItemType'}],'order':[[db['sequelize'][_0x0a9e('0xbc')](_0x0a9e('0xd8'))],[_0x0a9e('0xd7')]]})['then'](function(_0x268eae){return _0x268eae;})['then'](respondWithResult(_0x3c8a9a,null))[_0x0a9e('0x8b')](handleError(_0x3c8a9a,null));};exports['duplicateAdditionalPhones']=function(_0x22d31f,_0x5e9c92){return db[_0x0a9e('0xa3')][_0x0a9e('0x8d')]({'raw':!![],'where':{'CmContactId':_0x22d31f[_0x0a9e('0x8c')]['fromContactId']}})[_0x0a9e('0x23')](function(_0x497fda){var _0x505ffd=_[_0x0a9e('0x52')](_0x497fda,function(_0x23993f){_0x23993f[_0x0a9e('0xdc')]=_0x22d31f[_0x0a9e('0x8c')][_0x0a9e('0xdd')];return _0x23993f;});return db[_0x0a9e('0xa3')][_0x0a9e('0xb0')](_0x505ffd,{});})[_0x0a9e('0x23')](function(_0x1a3143){return addCmHopperPhones(_0x22d31f[_0x0a9e('0x8c')][_0x0a9e('0xdd')]);})[_0x0a9e('0x23')](function(_0x26361f){return['ok'];})[_0x0a9e('0x23')](respondWithResult(_0x5e9c92,null))[_0x0a9e('0x8b')](handleError(_0x5e9c92,null));};exports[_0x0a9e('0xde')]=function(_0x310026,_0x643f66){var _0x153de1=[];_0x153de1['push'](createCmHopperPhone(_0x310026[_0x0a9e('0x8c')]['id'],_0x310026[_0x0a9e('0x8c')][_0x0a9e('0xdf')]));Promise[_0x0a9e('0x32')](_0x153de1)['then'](function(){return[0x1];})['then'](respondWithResult(_0x643f66,null));};exports['getHoppers']=function(_0x2b8823,_0x55926d,_0xea26ca){var _0x1fafc2={'raw':![],'where':{}};var _0x130ae8={};var _0x43fe24={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x2b8823[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x55926d,null))[_0x0a9e('0x23')](function(_0x6b948a){if(_0x6b948a){_0x130ae8['model']=_[_0x0a9e('0x2b')](db['CmHopper'][_0x0a9e('0xc9')]);_0x130ae8['query']=_[_0x0a9e('0x2b')](_0x2b8823[_0x0a9e('0x35')]);_0x130ae8[_0x0a9e('0x36')]=_['intersection'](_0x130ae8[_0x0a9e('0x34')],_0x130ae8[_0x0a9e('0x35')]);_0x1fafc2['attributes']=_['intersection'](_0x130ae8[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x2b8823[_0x0a9e('0x35')]['fields']));_0x1fafc2['attributes']=_0x1fafc2['attributes'][_0x0a9e('0x2c')]?_0x1fafc2[_0x0a9e('0x39')]:_0x130ae8[_0x0a9e('0x34')];if(!_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x1fafc2[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x1fafc2[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0x1fafc2[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2b8823[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x1fafc2['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x2b8823[_0x0a9e('0x35')],_0x130ae8[_0x0a9e('0x36')]));_0x1fafc2[_0x0a9e('0x3e')][_0x0a9e('0xe0')]=_0x6b948a['id'];if(_0x2b8823['query'][_0x0a9e('0x5d')]){_0x1fafc2[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0x1fafc2[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x1fafc2[_0x0a9e('0x39')],function(_0x103ad9){var _0x7c4ce2={};_0x7c4ce2[_0x103ad9]={'$like':'%'+_0x2b8823[_0x0a9e('0x35')]['filter']+'%'};return _0x7c4ce2;})});}_0x1fafc2=_['merge']({},_0x1fafc2,_0x2b8823[_0x0a9e('0xcc')]);return db[_0x0a9e('0x94')]['count']({'where':_0x1fafc2[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x4c8d75){_0x43fe24[_0x0a9e('0x1e')]=_0x4c8d75;if(_0x2b8823['query'][_0x0a9e('0xe1')]){_0x1fafc2[_0x0a9e('0xe2')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x8d')](_0x1fafc2);})[_0x0a9e('0x23')](function(_0x5952c8){_0x43fe24[_0x0a9e('0x85')]=_0x5952c8;return _0x43fe24;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x55926d,_0x1fafc2))['catch'](handleError(_0x55926d,null));};exports[_0x0a9e('0xe3')]=function(_0x237994,_0x28a078,_0x24361){var _0x8f68ec={'raw':!![],'where':{}};var _0x17a0d5={};var _0x5d525f={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x237994['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x28a078,null))[_0x0a9e('0x23')](function(_0x22c390){if(_0x22c390){_0x17a0d5[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0xa5')][_0x0a9e('0xc9')]);_0x17a0d5['query']=_['keys'](_0x237994['query']);_0x17a0d5['filters']=_['intersection'](_0x17a0d5[_0x0a9e('0x34')],_0x17a0d5[_0x0a9e('0x35')]);_0x8f68ec['attributes']=_['intersection'](_0x17a0d5[_0x0a9e('0x34')],qs['fields'](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x38')]));_0x8f68ec[_0x0a9e('0x39')]=_0x8f68ec[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0x8f68ec[_0x0a9e('0x39')]:_0x17a0d5['model'];if(!_0x237994[_0x0a9e('0x35')][_0x0a9e('0x3a')]('nolimit')){_0x8f68ec[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x8f68ec[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x237994[_0x0a9e('0x35')]['offset']);}_0x8f68ec[_0x0a9e('0x3c')]=qs['sort'](_0x237994[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x8f68ec['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x237994['query'],_0x17a0d5[_0x0a9e('0x36')]));_0x8f68ec['where'][_0x0a9e('0xe0')]=_0x22c390['id'];if(_0x237994[_0x0a9e('0x35')]['filter']){_0x8f68ec[_0x0a9e('0x3e')]=_['merge'](_0x8f68ec[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x8f68ec[_0x0a9e('0x39')],function(_0x37ef45){var _0x288127={};_0x288127[_0x37ef45]={'$like':'%'+_0x237994[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x288127;})});}_0x8f68ec=_['merge']({},_0x8f68ec,_0x237994[_0x0a9e('0xcc')]);return db[_0x0a9e('0xa5')][_0x0a9e('0x1e')]({'where':_0x8f68ec[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x5932ad){_0x5d525f[_0x0a9e('0x1e')]=_0x5932ad;if(_0x237994['query']['includeAll']){_0x8f68ec[_0x0a9e('0xe2')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x8d')](_0x8f68ec);})[_0x0a9e('0x23')](function(_0x58d5fd){_0x5d525f[_0x0a9e('0x85')]=_0x58d5fd;return _0x5d525f;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x28a078,_0x8f68ec))[_0x0a9e('0x8b')](handleError(_0x28a078,null));};exports[_0x0a9e('0xe4')]=function(_0x2e1adc,_0x25eb44,_0x3d2bb0){var _0xb8c15={'raw':!![],'where':{}};var _0x3d02ae={};var _0x5871d7={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x30')]({'where':{'id':_0x2e1adc[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x25eb44,null))['then'](function(_0x38d95a){if(_0x38d95a){_0x3d02ae[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db['CmHopperFinal'][_0x0a9e('0xc9')]);_0x3d02ae[_0x0a9e('0x35')]=_[_0x0a9e('0x2b')](_0x2e1adc['query']);_0x3d02ae[_0x0a9e('0x36')]=_['intersection'](_0x3d02ae[_0x0a9e('0x34')],_0x3d02ae[_0x0a9e('0x35')]);_0xb8c15[_0x0a9e('0x39')]=_[_0x0a9e('0x37')](_0x3d02ae[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0x2e1adc[_0x0a9e('0x35')]['fields']));_0xb8c15[_0x0a9e('0x39')]=_0xb8c15[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0xb8c15[_0x0a9e('0x39')]:_0x3d02ae[_0x0a9e('0x34')];if(!_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0xb8c15[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0xb8c15[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0xb8c15[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0xb8c15[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0x2e1adc['query'],_0x3d02ae[_0x0a9e('0x36')]));_0xb8c15[_0x0a9e('0x3e')][_0x0a9e('0xe0')]=_0x38d95a['id'];if(_0x2e1adc['query'][_0x0a9e('0x5d')]){_0xb8c15['where']=_[_0x0a9e('0xcb')](_0xb8c15[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0xb8c15[_0x0a9e('0x39')],function(_0x455bca){var _0xb09ef6={};_0xb09ef6[_0x455bca]={'$like':'%'+_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0xb09ef6;})});}_0xb8c15=_['merge']({},_0xb8c15,_0x2e1adc[_0x0a9e('0xcc')]);return db[_0x0a9e('0xa4')]['count']({'where':_0xb8c15[_0x0a9e('0x3e')]})[_0x0a9e('0x23')](function(_0x579bb0){_0x5871d7['count']=_0x579bb0;if(_0x2e1adc[_0x0a9e('0x35')][_0x0a9e('0xe1')]){_0xb8c15[_0x0a9e('0xe2')]=[{'all':!![]}];}return db[_0x0a9e('0xa4')]['findAll'](_0xb8c15);})[_0x0a9e('0x23')](function(_0x31648e){_0x5871d7[_0x0a9e('0x85')]=_0x31648e;return _0x5871d7;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x25eb44,_0xb8c15))[_0x0a9e('0x8b')](handleError(_0x25eb44,null));};exports['getJscriptySessions']=function(_0xa3ba12,_0x3fc431,_0x4df303){var _0x34112c={'raw':!![],'where':{}};var _0x2d20a0={};var _0x38284a={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0xa3ba12[_0x0a9e('0xb9')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x3fc431,null))[_0x0a9e('0x23')](function(_0x283bbb){if(_0x283bbb){_0x2d20a0[_0x0a9e('0x34')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0xab')][_0x0a9e('0xc9')]);_0x2d20a0['query']=_['keys'](_0xa3ba12[_0x0a9e('0x35')]);_0x2d20a0['filters']=_[_0x0a9e('0x37')](_0x2d20a0[_0x0a9e('0x34')],_0x2d20a0[_0x0a9e('0x35')]);_0x34112c[_0x0a9e('0x39')]=_['intersection'](_0x2d20a0[_0x0a9e('0x34')],qs[_0x0a9e('0x38')](_0xa3ba12['query'][_0x0a9e('0x38')]));_0x34112c['attributes']=_0x34112c[_0x0a9e('0x39')][_0x0a9e('0x2c')]?_0x34112c[_0x0a9e('0x39')]:_0x2d20a0[_0x0a9e('0x34')];if(!_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x3a')]('nolimit')){_0x34112c[_0x0a9e('0x1d')]=qs['limit'](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x1d')]);_0x34112c[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}_0x34112c[_0x0a9e('0x3c')]=qs['sort'](_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x34112c[_0x0a9e('0x3e')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0xca')](_0xa3ba12['query'],_0x2d20a0[_0x0a9e('0x36')]));_0x34112c[_0x0a9e('0x3e')]['ContactId']=_0x283bbb['id'];if(_0xa3ba12['query'][_0x0a9e('0x5d')]){_0x34112c[_0x0a9e('0x3e')]=_[_0x0a9e('0xcb')](_0x34112c[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x52')](_0x34112c[_0x0a9e('0x39')],function(_0x4d35ed){var _0x1e31c2={};_0x1e31c2[_0x4d35ed]={'$like':'%'+_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0x5d')]+'%'};return _0x1e31c2;})});}_0x34112c=_['merge']({},_0x34112c,_0xa3ba12[_0x0a9e('0xcc')]);return db[_0x0a9e('0xab')][_0x0a9e('0x1e')]({'where':_0x34112c[_0x0a9e('0x3e')]})['then'](function(_0x5d4935){_0x38284a[_0x0a9e('0x1e')]=_0x5d4935;if(_0xa3ba12[_0x0a9e('0x35')][_0x0a9e('0xe1')]){_0x34112c[_0x0a9e('0xe2')]=[{'all':!![]}];}return db[_0x0a9e('0xab')][_0x0a9e('0x8d')](_0x34112c);})[_0x0a9e('0x23')](function(_0x23dd12){_0x38284a['rows']=_0x23dd12;return _0x38284a;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x3fc431,_0x34112c))['catch'](handleError(_0x3fc431,null));};exports[_0x0a9e('0xe5')]=function(_0x20dcfd,_0x3fd399,_0x4984b1){try{if(!_0x20dcfd['body'][_0x0a9e('0x60')]){throw new Error('No\x20ListId\x20specified');}if(!_0x20dcfd[_0x0a9e('0x8c')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe6')]){throw new Error(_0x0a9e('0xe7'));}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe8')]){throw new Error(_0x0a9e('0xe9'));}var _0x2f64ef=_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xea')][_0x0a9e('0x84')](',');var _0x81f495=_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe6')]['split'](',');if(!_0x2f64ef['length']||!_0x81f495[_0x0a9e('0x2c')]||_0x2f64ef['length']!==_0x81f495[_0x0a9e('0x2c')]){throw new Error(_0x0a9e('0xeb'));}_0x20dcfd[_0x0a9e('0x8c')]['fields']=_['zipObject'](_0x2f64ef,_0x81f495);if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x38')][_0x0a9e('0xc7')]){throw new Error(_0x0a9e('0xec'));}if(!_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x38')][_0x0a9e('0xed')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x12984a=path['join'](config[_0x0a9e('0xee')],_0x0a9e('0xef'),_0x20dcfd['file'][_0x0a9e('0xf0')]);fs[_0x0a9e('0xf1')](_0x12984a,parseInt(_0x0a9e('0xf2'),0x8));var _0x4524b8=require(_0x0a9e('0xf3'))[_0x0a9e('0xf4')](path['join'](__dirname,_0x0a9e('0xf5')),[_0x12984a,_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xea')],_0x20dcfd['body'][_0x0a9e('0xe6')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0x60')],_0x20dcfd['body'][_0x0a9e('0xf6')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xb2')],_0x20dcfd[_0x0a9e('0x8c')][_0x0a9e('0xe8')]]);return _0x3fd399[_0x0a9e('0x1a')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x4524b8[_0x0a9e('0xf7')]});}catch(_0x1e01af){return _0x3fd399['status'](0x1f4)[_0x0a9e('0xf8')](_0x1e01af);}};exports[_0x0a9e('0xf9')]=function(_0x315735,_0x35dadd,_0x2e413d){var _0x4e3983=fs['createReadStream'](_0x315735[_0x0a9e('0xfa')][_0x0a9e('0x6')]);Papa[_0x0a9e('0xfb')](_0x4e3983,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4edb79){return _0x35dadd[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0xfc')]({'file':_0x315735[_0x0a9e('0xfa')],'fields':_0x4edb79[_0x0a9e('0xfd')]['fields']});}});};exports['import']=function(_0x46b143,_0x14b098,_0x16b4ae){return db['User'][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0x73')}})[_0x0a9e('0x23')](function(_0x1fc545){var _0x45616c=![];if(!_0x46b143[_0x0a9e('0x8c')][_0x0a9e('0x60')]){throw new Error(_0x0a9e('0xfe'));}if(!_0x46b143['body']['binding'][_0x0a9e('0xc7')]){throw new Error(_0x0a9e('0xec'));}if(!_0x46b143['body'][_0x0a9e('0xff')]['firstName']){throw new Error(_0x0a9e('0x100'));}if(!_0x46b143[_0x0a9e('0x8c')]['socket_timestamp']){throw new Error(_0x0a9e('0xe9'));}var _0xd6570f=require('child_process')[_0x0a9e('0xf4')](path[_0x0a9e('0x91')](__dirname,_0x0a9e('0x101')),[_0x46b143[_0x0a9e('0xb9')]['id'],JSON[_0x0a9e('0x102')](_0x46b143[_0x0a9e('0x8c')]),JSON[_0x0a9e('0x102')](_0x1fc545)]);_0xd6570f['on']('message',function(_0x1da68c){_0x45616c=!![];return _0x14b098[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0xfc')]({'message':_0x0a9e('0x103'),'pid':_0xd6570f[_0x0a9e('0xf7')]});});_0xd6570f['on'](_0x0a9e('0x104'),function(_0x456884){if(_0x456884&&!_0x45616c){return _0x14b098['status'](0x1f4)['json']({'message':_0x0a9e('0x105'),'pid':_0xd6570f[_0x0a9e('0xf7')]});}});})[_0x0a9e('0x8b')](handleError(_0x14b098,null));};exports['importUpdates']=function(_0x5cf1ba,_0xf7ddca,_0x55075d){return db[_0x0a9e('0x56')][_0x0a9e('0x8d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0x73')}})[_0x0a9e('0x23')](function(_0x20f4cb){var _0x13c6df=![];if(!_0x5cf1ba[_0x0a9e('0x8c')][_0x0a9e('0x60')]){throw new Error(_0x0a9e('0xfe'));}if(!_0x5cf1ba['body']['binding'][_0x0a9e('0xc7')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5cf1ba[_0x0a9e('0x8c')][_0x0a9e('0xff')][_0x0a9e('0xed')]){throw new Error(_0x0a9e('0x100'));}if(!_0x5cf1ba['body'][_0x0a9e('0xe8')]){throw new Error(_0x0a9e('0xe9'));}var _0x2bc6a3=require('child_process')[_0x0a9e('0xf4')](path[_0x0a9e('0x91')](__dirname,_0x0a9e('0x106')),[_0x5cf1ba['params']['id'],JSON[_0x0a9e('0x102')](_0x5cf1ba[_0x0a9e('0x8c')]),JSON[_0x0a9e('0x102')](_0x20f4cb)]);_0x2bc6a3['on'](_0x0a9e('0x107'),function(_0x69b4d6){_0x13c6df=!![];return _0xf7ddca[_0x0a9e('0x1a')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x2bc6a3[_0x0a9e('0xf7')]});});_0x2bc6a3['on'](_0x0a9e('0x104'),function(_0x10d713){if(_0x10d713&&!_0x13c6df){return _0xf7ddca['status'](0x1f4)['json']({'message':_0x0a9e('0x105'),'pid':_0x2bc6a3[_0x0a9e('0xf7')]});}});})[_0x0a9e('0x8b')](handleError(_0xf7ddca,null));};exports['getJourney']=function(_0x4b51ff,_0x12d1dd){var _0x2c8d95=[_0x0a9e('0x108'),_0x0a9e('0x109'),_0x0a9e('0x10a'),'openchannel',_0x0a9e('0x10b'),'whatsapp',_0x0a9e('0x10c')];var _0x311e40={'offset':0x0,'order':qs[_0x0a9e('0x3d')]('-createdAt')},_0x57e719={'count':0x0,'rows':[]};Promise[_0x0a9e('0x71')]()[_0x0a9e('0x23')](function(){if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x10d')]){if(!_[_0x0a9e('0x10e')](_0x2c8d95,_0x4b51ff['query'][_0x0a9e('0x10d')][_0x0a9e('0x10f')]())){throw new Error(_0x0a9e('0x110'));}_0x2c8d95=[_0x4b51ff['query'][_0x0a9e('0x10d')]['toLowerCase']()];}if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){try{var _0x2777fe=JSON['parse'](_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]);if(!moment(_0x2777fe[_0x0a9e('0x42')])[_0x0a9e('0x112')]()){throw new Error(_0x0a9e('0x113'));}if(!moment(_0x2777fe['to'])[_0x0a9e('0x112')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x3057c9){throw new Error(_0x0a9e('0x114'));}}if(!_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x3a')](_0x0a9e('0x3b'))){_0x311e40[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x4b51ff[_0x0a9e('0x35')]['limit']||0xa);_0x311e40[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x1b')]);}var _0x55a300=_0x2c8d95[_0x0a9e('0x52')](function(_0x57c3c4){if(_0x57c3c4===_0x0a9e('0x10c')){var _0x22ef0f={'attributes':['id',_0x0a9e('0x115'),'type',_0x0a9e('0x116'),_0x0a9e('0x117'),_0x0a9e('0x118'),_0x0a9e('0x119'),'endtime',_0x0a9e('0x11a'),_0x0a9e('0x11b'),_0x0a9e('0x11c'),_0x0a9e('0x11d'),_0x0a9e('0x11e'),_0x0a9e('0x11f'),_0x0a9e('0x120')],'where':{'ContactId':_0x4b51ff['params']['id']},'include':[{'model':db[_0x0a9e('0x56')],'as':_0x0a9e('0x56'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x121'),'alias']}],'order':[[_0x0a9e('0x11c'),'DESC']]};if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){_0x22ef0f[_0x0a9e('0x3e')][_0x0a9e('0x11c')]={'$gte':_0x2777fe[_0x0a9e('0x42')],'$lte':_0x2777fe['to']};}return db[_0x0a9e('0xa6')][_0x0a9e('0x122')](_0x22ef0f)['then'](function(_0x173f03){_0x57e719['count']+=_0x173f03[_0x0a9e('0x1e')];return _[_0x0a9e('0x52')](_0x173f03['rows'],function(_0x2ebed3){var _0x167f89=_0x2ebed3[_0x0a9e('0x8e')]({'plain':!![]});_0x167f89[_0x0a9e('0x10d')]=_0x57c3c4;if(_0x167f89['User']){_0x167f89[_0x0a9e('0x56')]={'id':_0x167f89[_0x0a9e('0x56')]['id'],'name':_0x167f89['User'][_0x0a9e('0x27')],'fullname':_0x167f89['User']['fullname'],'alias':_0x167f89['User'][_0x0a9e('0x123')]};}return _0x167f89;});});}else{var _0x2ec662=_['startCase'](_0x57c3c4)+(_0x57c3c4===_0x0a9e('0x109')?_0x0a9e('0x124'):'Account');var _0xc48226={'attributes':['id',_0x0a9e('0x125'),_0x0a9e('0x126'),_0x0a9e('0x11c'),_0x0a9e('0x11b'),_0x0a9e('0x127'),_0x0a9e('0x128'),'thirdDisposition',_0x0a9e('0x120'),_0x2ec662+'Id'],'where':{'ContactId':_0x4b51ff['params']['id']},'include':[{'model':db[_0x2ec662],'as':_0x0a9e('0x129'),'attributes':['id',_0x0a9e('0x27'),_0x0a9e('0x12a')]},{'model':db[_0x0a9e('0x56')],'as':_0x0a9e('0x12b'),'attributes':['id',_0x0a9e('0x27'),'fullname']},{'model':db[_0x0a9e('0x50')],'as':_0x0a9e('0x83'),'attributes':['id',_0x0a9e('0x27'),'color'],'through':{'attributes':[]}}],'order':[[_0x0a9e('0x11c'),_0x0a9e('0x6f')]]};if(_0x4b51ff[_0x0a9e('0x35')][_0x0a9e('0x111')]){_0xc48226[_0x0a9e('0x3e')][_0x0a9e('0x11c')]={'$gte':_0x2777fe[_0x0a9e('0x42')],'$lte':_0x2777fe['to']};}switch(_0x57c3c4){case _0x0a9e('0x109'):_0xc48226[_0x0a9e('0x39')][_0x0a9e('0x2e')](_0x0a9e('0x12c'),_0x0a9e('0x12d'),_0x0a9e('0x12e'),_0x0a9e('0x12f'),_0x0a9e('0x130'),_0x0a9e('0x131'),'ratingType',_0x0a9e('0x132'),_0x0a9e('0x133'));break;case _0x0a9e('0x108'):_0xc48226['attributes'][_0x0a9e('0x2e')](_0x0a9e('0x134'),_0x0a9e('0x135'));break;case _0x0a9e('0x136'):_0xc48226['attributes'][_0x0a9e('0x2e')](_0x0a9e('0x137'),_0x0a9e('0x138'));break;}return db[_[_0x0a9e('0x139')](_0x57c3c4)+'Interaction'][_0x0a9e('0x122')](_0xc48226)[_0x0a9e('0x23')](function(_0x132455){_0x57e719[_0x0a9e('0x1e')]+=_0x132455['count'];return _['map'](_0x132455[_0x0a9e('0x85')],function(_0x44343f){var _0x2de997=_0x44343f[_0x0a9e('0x8e')]({'plain':!![]});_0x2de997[_0x0a9e('0x10d')]=_0x57c3c4;if(_0x2de997[_0x0a9e('0x12b')]){_0x2de997[_0x0a9e('0x12b')]={'id':_0x2de997[_0x0a9e('0x12b')]['id'],'name':_0x2de997[_0x0a9e('0x12b')][_0x0a9e('0x27')],'fullname':_0x2de997[_0x0a9e('0x12b')][_0x0a9e('0x121')]};}return _0x2de997;});});}});return Promise[_0x0a9e('0x32')](_0x55a300);})[_0x0a9e('0x23')](function(_0x4f5ebd){return _(_0x4f5ebd)[_0x0a9e('0x13a')]()[_0x0a9e('0x13b')](_0x0a9e('0x11c'))['reverse']()['value']();})[_0x0a9e('0x23')](function(_0x51ec16){_0x57e719[_0x0a9e('0x85')]=_0x311e40[_0x0a9e('0x1d')]?_0x51ec16[_0x0a9e('0x13c')](_0x311e40[_0x0a9e('0x1b')],_0x311e40['offset']+_0x311e40['limit']):_0x51ec16;return _0x57e719;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x12d1dd,_0x311e40))[_0x0a9e('0x8b')](handleError(_0x12d1dd,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index e39fffc..59fa896 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 _0x53cf=['hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','save','update','remove','emit'];(function(_0x33f756,_0x439bb6){var _0x140a9a=function(_0x255bce){while(--_0x255bce){_0x33f756['push'](_0x33f756['shift']());}};_0x140a9a(++_0x439bb6);}(_0x53cf,0x189));var _0xf53c=function(_0x3059dd,_0x4a94d0){_0x3059dd=_0x3059dd-0x0;var _0x23a0bd=_0x53cf[_0x3059dd];return _0x23a0bd;};'use strict';var EventEmitter=require(_0xf53c('0x0'));var CmContact=require(_0xf53c('0x1'))['db'][_0xf53c('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf53c('0x3'),'afterUpdate':_0xf53c('0x4'),'afterDestroy':_0xf53c('0x5')};function emitEvent(_0x48792d){return function(_0x2bb6a4,_0x2242fc,_0x402bfe){CmContactEvents[_0xf53c('0x6')](_0x48792d+':'+_0x2bb6a4['id'],_0x2bb6a4);CmContactEvents[_0xf53c('0x6')](_0x48792d,_0x2bb6a4);_0x402bfe(null);};}for(var e in events){if(events[_0xf53c('0x7')](e)){var event=events[e];CmContact[_0xf53c('0x8')](e,emitEvent(event));}}module[_0xf53c('0x9')]=CmContactEvents; \ No newline at end of file +var _0xd5fa=['update','emit','exports','events','../../mysqldb'];(function(_0x13ec3e,_0x17387d){var _0x4a599b=function(_0x371511){while(--_0x371511){_0x13ec3e['push'](_0x13ec3e['shift']());}};_0x4a599b(++_0x17387d);}(_0xd5fa,0x184));var _0xad5f=function(_0x3fa52a,_0x406bac){_0x3fa52a=_0x3fa52a-0x0;var _0x217d98=_0xd5fa[_0x3fa52a];return _0x217d98;};'use strict';var EventEmitter=require(_0xad5f('0x0'));var CmContact=require(_0xad5f('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xad5f('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3b5183){return function(_0x39f1b6,_0x1b3b88,_0x2c1b64){CmContactEvents[_0xad5f('0x3')](_0x3b5183+':'+_0x39f1b6['id'],_0x39f1b6);CmContactEvents['emit'](_0x3b5183,_0x39f1b6);_0x2c1b64(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xad5f('0x4')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index c042845..5de690d 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 _0xa6ce=['create','ListId','priority','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','cmContact','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','message','Campaign','CmHopperBlack','List\x20not\x20found','ContactId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','models','get','error','afterCreate','inspect','findOne','then','isNil','cmContact,\x20afterCreate\x20','CmHopper'];(function(_0xca92b0,_0x3b5fb7){var _0x483a4e=function(_0x8fdc96){while(--_0x8fdc96){_0xca92b0['push'](_0xca92b0['shift']());}};_0x483a4e(++_0x3b5fb7);}(_0xa6ce,0x15e));var _0xea6c=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0xa6ce[_0x2085f3];return _0x384e3c;};'use strict';var _=require(_0xea6c('0x0'));var util=require('util');var logger=require(_0xea6c('0x1'))(_0xea6c('0x2'));var moment=require('moment');var BPromise=require(_0xea6c('0x3'));var rp=require(_0xea6c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xea6c('0x5'));var attributes=require(_0xea6c('0x6'));module[_0xea6c('0x7')]=function(_0x236ed9,_0x267f26){return _0x236ed9[_0xea6c('0x8')]('CmContact',attributes,{'tableName':_0xea6c('0x9'),'paranoid':!![],'indexes':[{'name':_0xea6c('0xa'),'fields':[_0xea6c('0xa')]},{'name':_0xea6c('0xb'),'fields':[_0xea6c('0xc'),_0xea6c('0xd'),_0xea6c('0xa'),_0xea6c('0xe'),_0xea6c('0xf'),_0xea6c('0x10')],'type':_0xea6c('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb1e8b5,_0xfc7a5e,_0x3c0992){var _0x55be99=_0x236ed9[_0xea6c('0x12')];var _0x1b28ac=_0xb1e8b5[_0xea6c('0x13')]({'plain':!![]});function _0x5a7dcd(){return function(_0x723b5b){logger[_0xea6c('0x14')]('cmContact',_0xea6c('0x15'),util[_0xea6c('0x16')](_0x723b5b,{'showHidden':![],'depth':null}));};}var _0x13fd94=function(_0xc5c82e){return new BPromise(function(_0xb6ecb1,_0x748e7){_0x55be99['CmHopper'][_0xea6c('0x17')]({'where':{'phone':_0x1b28ac['phone'],'VoiceQueueId':_0xc5c82e['id']}})[_0xea6c('0x18')](function(_0x6499ed){if(!_[_0xea6c('0x19')](_0x6499ed)){throw new Error(_0xea6c('0x1a')+_0x1b28ac[_0xea6c('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0xc5c82e['id']);}return _0x55be99[_0xea6c('0x1b')][_0xea6c('0x1c')]({'phone':_0x1b28ac[_0xea6c('0xa')],'ContactId':_0x1b28ac['id'],'ListId':_0x1b28ac[_0xea6c('0x1d')],'priority':_0x1b28ac[_0xea6c('0x1e')]?_0x1b28ac[_0xea6c('0x1e')]:0x2,'scheduledat':_0x1b28ac[_0xea6c('0x1f')]?_0x1b28ac[_0xea6c('0x1f')]:moment()[_0xea6c('0x20')](_0xea6c('0x21')),'callback':_0x1b28ac['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1b28ac[_0xea6c('0x22')]?_0x1b28ac['callbackUniqueid']:undefined,'callbackat':_0x1b28ac[_0xea6c('0x22')]?moment()['format'](_0xea6c('0x21')):undefined,'VoiceQueueId':_0xc5c82e['id']});})[_0xea6c('0x23')](function(_0x1d3eca){_0x748e7(_0x1d3eca);});});};var _0x539b63=function(_0x417cfa){return new BPromise(function(_0x371327,_0x499ea6){_0x55be99['CmHopper'][_0xea6c('0x17')]({'where':{'phone':_0x1b28ac['phone'],'VoiceQueueId':_0x417cfa['id']}})['then'](function(_0x270ce7){if(!_[_0xea6c('0x19')](_0x270ce7)){throw new Error(_0xea6c('0x1a')+_0x1b28ac[_0xea6c('0xa')]+_0xea6c('0x24')+_0x417cfa['id']);}return _0x55be99['CmHopperFinal'][_0xea6c('0x17')]({'where':{'calleridnum':_0x1b28ac['phone'],'VoiceQueueId':_0x417cfa['id']}});})['then'](function(_0x16e88d){if(!_['isNil'](_0x16e88d)){throw new Error(_0xea6c('0x25')+_0x1b28ac[_0xea6c('0xa')]+_0xea6c('0x26')+_0x417cfa['id']);}return _0x55be99[_0xea6c('0x1b')][_0xea6c('0x1c')]({'phone':_0x1b28ac[_0xea6c('0xa')],'ContactId':_0x1b28ac['id'],'ListId':_0x1b28ac[_0xea6c('0x1d')],'priority':_0x1b28ac[_0xea6c('0x1e')]?_0x1b28ac[_0xea6c('0x1e')]:0x2,'scheduledat':_0x1b28ac[_0xea6c('0x1f')]?_0x1b28ac[_0xea6c('0x1f')]:moment()[_0xea6c('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1b28ac[_0xea6c('0x22')]?!![]:![],'callbackuniqueid':_0x1b28ac[_0xea6c('0x22')]?_0x1b28ac['callbackUniqueid']:undefined,'callbackat':_0x1b28ac['callbackUniqueid']?moment()['format'](_0xea6c('0x21')):undefined,'VoiceQueueId':_0x417cfa['id']});})[_0xea6c('0x23')](function(_0xc6836){_0x499ea6(_0xc6836);});});};function _0xba97af(){return function(_0xedbff6){logger[_0xea6c('0x14')](_0xea6c('0x27'),_0xea6c('0x15'),util[_0xea6c('0x16')](_0xedbff6,{'showHidden':![],'depth':null}));};}var _0x484d5a=function(_0x458187){return new BPromise(function(_0xf7b677,_0x439013){_0x55be99[_0xea6c('0x1b')][_0xea6c('0x17')]({'where':{'phone':_0x1b28ac[_0xea6c('0xa')],'CampaignId':_0x458187['id']}})['then'](function(_0xc0c5b9){if(!_[_0xea6c('0x19')](_0xc0c5b9)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1b28ac[_0xea6c('0xa')]+_0xea6c('0x28')+_0x458187['id']);}return _0x55be99[_0xea6c('0x1b')]['create']({'phone':_0x1b28ac['phone'],'ContactId':_0x1b28ac['id'],'ListId':_0x1b28ac['ListId'],'priority':_0x1b28ac['priority']?_0x1b28ac['priority']:0x2,'scheduledat':_0x1b28ac[_0xea6c('0x1f')]?_0x1b28ac[_0xea6c('0x1f')]:moment()[_0xea6c('0x20')](_0xea6c('0x21')),'callback':_0x1b28ac['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1b28ac[_0xea6c('0x22')]?_0x1b28ac[_0xea6c('0x22')]:undefined,'callbackat':_0x1b28ac[_0xea6c('0x22')]?moment()['format'](_0xea6c('0x21')):undefined,'CampaignId':_0x458187['id']});})[_0xea6c('0x23')](function(_0x4dcbc1){_0x439013(_0x4dcbc1);});});};var _0xb52f55=function(_0x23dd91){return new BPromise(function(_0x3033da,_0x261082){_0x55be99[_0xea6c('0x1b')][_0xea6c('0x17')]({'where':{'phone':_0x1b28ac[_0xea6c('0xa')],'CampaignId':_0x23dd91['id']}})[_0xea6c('0x18')](function(_0x404a74){if(!_[_0xea6c('0x19')](_0x404a74)){throw new Error(_0xea6c('0x1a')+_0x1b28ac[_0xea6c('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x23dd91['id']);}return _0x55be99[_0xea6c('0x29')]['findOne']({'where':{'calleridnum':_0x1b28ac[_0xea6c('0xa')],'CampaignId':_0x23dd91['id']}});})[_0xea6c('0x18')](function(_0x328934){if(!_[_0xea6c('0x19')](_0x328934)){throw new Error(_0xea6c('0x25')+_0x1b28ac['phone']+_0xea6c('0x2a')+_0x23dd91['id']);}return _0x55be99[_0xea6c('0x1b')][_0xea6c('0x1c')]({'phone':_0x1b28ac['phone'],'ContactId':_0x1b28ac['id'],'ListId':_0x1b28ac['ListId'],'priority':_0x1b28ac[_0xea6c('0x1e')]?_0x1b28ac['priority']:0x2,'scheduledat':_0x1b28ac[_0xea6c('0x1f')]?_0x1b28ac[_0xea6c('0x1f')]:moment()[_0xea6c('0x20')](_0xea6c('0x21')),'callback':_0x1b28ac['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1b28ac[_0xea6c('0x22')]?_0x1b28ac[_0xea6c('0x22')]:undefined,'callbackat':_0x1b28ac[_0xea6c('0x22')]?moment()['format'](_0xea6c('0x21')):undefined,'CampaignId':_0x23dd91['id']});})['catch'](function(_0x43c41a){_0x261082(_0x43c41a);});});};if(_0x1b28ac[_0xea6c('0x1d')]){_0x55be99['VoiceQueue'][_0xea6c('0x2b')]({'where':{'type':_0xea6c('0x2c')},'attributes':['id',_0xea6c('0x2d')],'include':[{'model':_0x55be99[_0xea6c('0x2e')],'as':_0xea6c('0x2f'),'where':{'id':_0x1b28ac[_0xea6c('0x1d')]}}]})['then'](function(_0x1e4f3b){if(_0x1e4f3b){var _0x33c878=[];for(var _0x3156a9=0x0,_0xd019b1;_0x3156a9<_0x1e4f3b[_0xea6c('0x30')];_0x3156a9+=0x1){_0xd019b1=_0x1e4f3b[_0x3156a9][_0xea6c('0x13')]({'plain':!![]});switch(_0xd019b1[_0xea6c('0x2d')]){case _0xea6c('0x31'):_0x539b63(_0xd019b1)[_0xea6c('0x23')](_0x5a7dcd());break;case _0xea6c('0x32'):_0x13fd94(_0xd019b1)[_0xea6c('0x23')](_0x5a7dcd());break;default:_0x55be99[_0xea6c('0x1b')][_0xea6c('0x1c')]({'phone':_0x1b28ac[_0xea6c('0xa')],'ContactId':_0x1b28ac['id'],'ListId':_0x1b28ac['ListId'],'scheduledat':_0x1b28ac[_0xea6c('0x1f')]?_0x1b28ac[_0xea6c('0x1f')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x1b28ac[_0xea6c('0x1e')]?_0x1b28ac[_0xea6c('0x1e')]:0x2,'callback':_0x1b28ac[_0xea6c('0x22')]?!![]:![],'callbackuniqueid':_0x1b28ac[_0xea6c('0x22')]?_0x1b28ac[_0xea6c('0x22')]:undefined,'callbackat':_0x1b28ac[_0xea6c('0x22')]?moment()[_0xea6c('0x20')](_0xea6c('0x21')):undefined,'VoiceQueueId':_0xd019b1['id']})[_0xea6c('0x23')](_0x5a7dcd());}}}})[_0xea6c('0x18')](function(){return _0x55be99['VoiceQueue']['findAll']({'where':{'type':_0xea6c('0x2c')},'attributes':['id'],'include':[{'model':_0x55be99[_0xea6c('0x2e')],'as':_0xea6c('0x33'),'where':{'id':_0x1b28ac['ListId']}}]})[_0xea6c('0x18')](function(_0x509def){if(_0x509def){var _0x31aaae=[];for(var _0x3cd47c=0x0,_0x42323e;_0x3cd47c<_0x509def['length'];_0x3cd47c+=0x1){_0x42323e=_0x509def[_0x3cd47c][_0xea6c('0x13')]({'plain':!![]});_0x55be99['CmHopperBlack'][_0xea6c('0x1c')]({'phone':_0x1b28ac[_0xea6c('0xa')],'ContactId':_0x1b28ac['id'],'ListId':_0x1b28ac[_0xea6c('0x1d')],'VoiceQueueId':_0x42323e['id']})[_0xea6c('0x23')](function(_0x3fa695){logger[_0xea6c('0x14')](_0xea6c('0x34'),_0xea6c('0x15'),_0x3fa695[_0xea6c('0x35')]);});}}});})[_0xea6c('0x18')](function(){return _0x55be99[_0xea6c('0x36')][_0xea6c('0x2b')]({'attributes':['id',_0xea6c('0x2d')],'include':[{'model':_0x55be99[_0xea6c('0x2e')],'as':_0xea6c('0x2f'),'where':{'id':_0x1b28ac[_0xea6c('0x1d')]}}]})[_0xea6c('0x18')](function(_0x1e37aa){if(_0x1e37aa){var _0x330e24=[];for(var _0x1a5260=0x0,_0x294424;_0x1a5260<_0x1e37aa['length'];_0x1a5260+=0x1){_0x294424=_0x1e37aa[_0x1a5260][_0xea6c('0x13')]({'plain':!![]});switch(_0x294424[_0xea6c('0x2d')]){case _0xea6c('0x31'):_0xb52f55(_0x294424)[_0xea6c('0x23')](_0xba97af());break;case _0xea6c('0x32'):_0x484d5a(_0x294424)[_0xea6c('0x23')](_0xba97af());break;default:_0x55be99['CmHopper'][_0xea6c('0x1c')]({'phone':_0x1b28ac[_0xea6c('0xa')],'ContactId':_0x1b28ac['id'],'ListId':_0x1b28ac[_0xea6c('0x1d')],'scheduledat':_0x1b28ac[_0xea6c('0x1f')]?_0x1b28ac[_0xea6c('0x1f')]:moment()[_0xea6c('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x1b28ac[_0xea6c('0x1e')]?_0x1b28ac['priority']:0x2,'callback':_0x1b28ac[_0xea6c('0x22')]?!![]:![],'callbackuniqueid':_0x1b28ac[_0xea6c('0x22')]?_0x1b28ac['callbackUniqueid']:undefined,'callbackat':_0x1b28ac[_0xea6c('0x22')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x294424['id']})[_0xea6c('0x23')](_0xba97af());}}}});})[_0xea6c('0x18')](function(){return _0x55be99[_0xea6c('0x36')][_0xea6c('0x2b')]({'attributes':['id'],'include':[{'model':_0x55be99[_0xea6c('0x2e')],'as':_0xea6c('0x33'),'where':{'id':_0x1b28ac[_0xea6c('0x1d')]}}]})[_0xea6c('0x18')](function(_0x535400){if(_0x535400){var _0x49835d=[];for(var _0x4bbda5=0x0,_0x18cd0d;_0x4bbda5<_0x535400[_0xea6c('0x30')];_0x4bbda5+=0x1){_0x18cd0d=_0x535400[_0x4bbda5][_0xea6c('0x13')]({'plain':!![]});_0x55be99[_0xea6c('0x37')][_0xea6c('0x1c')]({'phone':_0x1b28ac[_0xea6c('0xa')],'ContactId':_0x1b28ac['id'],'ListId':_0x1b28ac['ListId'],'CampaignId':_0x18cd0d['id']})[_0xea6c('0x23')](function(_0x13f150){logger[_0xea6c('0x14')](_0xea6c('0x34'),'afterCreate',_0x13f150[_0xea6c('0x35')]);});}}});})[_0xea6c('0x18')](function(){_0x3c0992();})['catch'](function(_0x5271c9){logger[_0xea6c('0x14')](_0xea6c('0x34'),_0xea6c('0x15'),_0x5271c9[_0xea6c('0x35')]);_0x3c0992(_0x5271c9);});}else{_0x3c0992(new Error(_0xea6c('0x38')));}},'afterDestroy':function(_0x46079e,_0x27b7d5,_0xb93247){var _0x1a5fa9=_0x236ed9[_0xea6c('0x12')];var _0x14e9c9=_0x46079e[_0xea6c('0x13')]({'plain':!![]});return _0x1a5fa9[_0xea6c('0x1b')][_0xea6c('0x2b')]({'raw':!![],'where':{'ListId':_0x14e9c9['ListId'],'ContactId':_0x14e9c9['id']}})[_0xea6c('0x18')](function(_0x2dab44){if(!_['isEmpty'](_0x2dab44)){var _0x1a050f=[];for(var _0x47c1c1=0x0;_0x47c1c1<_0x2dab44[_0xea6c('0x30')];_0x47c1c1+=0x1){var _0x5667d6=_0x1a5fa9[_0xea6c('0x1b')]['destroy']({'where':{'ListId':_0x2dab44[_0x47c1c1][_0xea6c('0x1d')],'ContactId':_0x2dab44[_0x47c1c1][_0xea6c('0x39')],'VoiceQueueId':_0x2dab44[_0x47c1c1]['VoiceQueueId'],'CampaignId':_0x2dab44[_0x47c1c1][_0xea6c('0x3a')]}});_0x1a050f['push'](_0x5667d6);}return BPromise[_0xea6c('0x3b')](_0x1a050f);}})[_0xea6c('0x18')](function(_0x4d2673){logger[_0xea6c('0x3c')](_0xea6c('0x3d'),util[_0xea6c('0x16')](_0x4d2673,{'showHidden':![],'depth':null}));_0xb93247();})[_0xea6c('0x23')](function(_0x5b7df5){logger[_0xea6c('0x14')](_0xea6c('0x3e'),util[_0xea6c('0x16')](_0x5b7df5,{'showHidden':![],'depth':null}));_0xb93247(_0x5b7df5);});}}});}; \ No newline at end of file +var _0x53ec=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\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','VoiceQueue','findAll','dialCheckDuplicateType','length','onlyIfOpen','outbound','CmList','BlackLists','CmHopperBlack','error','cmContact,\x20%s,\x20%s','Campaign','Lists','always','message','List\x20not\x20found','destroy','ContactId','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cmContact.attributes','define','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','models','get','cmContact','afterCreate','inspect','CmHopper','findOne','isNil','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','then','CmHopperFinal','cmContact,\x20afterCreate,\x20','priority'];(function(_0x328534,_0x33b41e){var _0x2796c0=function(_0x1ba8ad){while(--_0x1ba8ad){_0x328534['push'](_0x328534['shift']());}};_0x2796c0(++_0x33b41e);}(_0x53ec,0x192));var _0xc53e=function(_0x196257,_0x256195){_0x196257=_0x196257-0x0;var _0x30d5c7=_0x53ec[_0x196257];return _0x30d5c7;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]},{'name':_0xc53e('0xc'),'fields':[_0xc53e('0xd'),_0xc53e('0xe'),_0xc53e('0xb'),_0xc53e('0xf'),_0xc53e('0x10'),_0xc53e('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57e818,_0x35128a,_0x5a2da7){var _0x54e3ba=_0x2f1414[_0xc53e('0x12')];var _0x9ffbcb=_0x57e818[_0xc53e('0x13')]({'plain':!![]});function _0x4203aa(){return function(_0x56f0e5){logger['error'](_0xc53e('0x14'),_0xc53e('0x15'),util[_0xc53e('0x16')](_0x56f0e5,{'showHidden':![],'depth':null}));};}var _0x3d2e17=function(_0x358ef3){return new BPromise(function(_0x382e87,_0x3dc2fa){_0x54e3ba[_0xc53e('0x17')][_0xc53e('0x18')]({'where':{'phone':_0x9ffbcb[_0xc53e('0xb')],'VoiceQueueId':_0x358ef3['id']}})['then'](function(_0x8a522e){if(!_[_0xc53e('0x19')](_0x8a522e)){throw new Error(_0xc53e('0x1a')+_0x9ffbcb[_0xc53e('0xb')]+_0xc53e('0x1b')+_0x358ef3['id']);}return _0x54e3ba[_0xc53e('0x17')][_0xc53e('0x1c')]({'phone':_0x9ffbcb[_0xc53e('0xb')],'ContactId':_0x9ffbcb['id'],'ListId':_0x9ffbcb[_0xc53e('0x1d')],'priority':_0x9ffbcb['priority']?_0x9ffbcb['priority']:0x2,'scheduledat':_0x9ffbcb[_0xc53e('0x1e')]?_0x9ffbcb[_0xc53e('0x1e')]:moment()[_0xc53e('0x1f')](_0xc53e('0x20')),'callback':_0x9ffbcb[_0xc53e('0x21')]?!![]:![],'callbackuniqueid':_0x9ffbcb[_0xc53e('0x21')]?_0x9ffbcb[_0xc53e('0x21')]:undefined,'callbackat':_0x9ffbcb[_0xc53e('0x21')]?moment()[_0xc53e('0x1f')](_0xc53e('0x20')):undefined,'VoiceQueueId':_0x358ef3['id']});})[_0xc53e('0x22')](function(_0x44fd93){_0x3dc2fa(_0x44fd93);});});};var _0x426467=function(_0x4fb695){return new BPromise(function(_0x47cfdd,_0x531ede){_0x54e3ba[_0xc53e('0x17')][_0xc53e('0x18')]({'where':{'phone':_0x9ffbcb[_0xc53e('0xb')],'VoiceQueueId':_0x4fb695['id']}})[_0xc53e('0x23')](function(_0x180811){if(!_['isNil'](_0x180811)){throw new Error('cmContact,\x20afterCreate\x20'+_0x9ffbcb[_0xc53e('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x4fb695['id']);}return _0x54e3ba[_0xc53e('0x24')][_0xc53e('0x18')]({'where':{'calleridnum':_0x9ffbcb[_0xc53e('0xb')],'VoiceQueueId':_0x4fb695['id']}});})[_0xc53e('0x23')](function(_0x63c5dc){if(!_['isNil'](_0x63c5dc)){throw new Error(_0xc53e('0x25')+_0x9ffbcb['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x4fb695['id']);}return _0x54e3ba['CmHopper'][_0xc53e('0x1c')]({'phone':_0x9ffbcb['phone'],'ContactId':_0x9ffbcb['id'],'ListId':_0x9ffbcb[_0xc53e('0x1d')],'priority':_0x9ffbcb['priority']?_0x9ffbcb[_0xc53e('0x26')]:0x2,'scheduledat':_0x9ffbcb['scheduledat']?_0x9ffbcb['scheduledat']:moment()[_0xc53e('0x1f')](_0xc53e('0x20')),'callback':_0x9ffbcb[_0xc53e('0x21')]?!![]:![],'callbackuniqueid':_0x9ffbcb[_0xc53e('0x21')]?_0x9ffbcb[_0xc53e('0x21')]:undefined,'callbackat':_0x9ffbcb[_0xc53e('0x21')]?moment()[_0xc53e('0x1f')](_0xc53e('0x20')):undefined,'VoiceQueueId':_0x4fb695['id']});})['catch'](function(_0x437893){_0x531ede(_0x437893);});});};function _0x311835(){return function(_0x2d36c0){logger['error'](_0xc53e('0x14'),'afterCreate',util[_0xc53e('0x16')](_0x2d36c0,{'showHidden':![],'depth':null}));};}var _0x2467f4=function(_0x49ab9b){return new BPromise(function(_0x5a64e2,_0x3cd8a1){_0x54e3ba[_0xc53e('0x17')][_0xc53e('0x18')]({'where':{'phone':_0x9ffbcb[_0xc53e('0xb')],'CampaignId':_0x49ab9b['id']}})[_0xc53e('0x23')](function(_0x45fedc){if(!_[_0xc53e('0x19')](_0x45fedc)){throw new Error(_0xc53e('0x1a')+_0x9ffbcb['phone']+_0xc53e('0x27')+_0x49ab9b['id']);}return _0x54e3ba[_0xc53e('0x17')][_0xc53e('0x1c')]({'phone':_0x9ffbcb[_0xc53e('0xb')],'ContactId':_0x9ffbcb['id'],'ListId':_0x9ffbcb[_0xc53e('0x1d')],'priority':_0x9ffbcb[_0xc53e('0x26')]?_0x9ffbcb[_0xc53e('0x26')]:0x2,'scheduledat':_0x9ffbcb[_0xc53e('0x1e')]?_0x9ffbcb[_0xc53e('0x1e')]:moment()['format'](_0xc53e('0x20')),'callback':_0x9ffbcb['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x9ffbcb[_0xc53e('0x21')]?_0x9ffbcb[_0xc53e('0x21')]:undefined,'callbackat':_0x9ffbcb['callbackUniqueid']?moment()[_0xc53e('0x1f')](_0xc53e('0x20')):undefined,'CampaignId':_0x49ab9b['id']});})[_0xc53e('0x22')](function(_0x5ed90b){_0x3cd8a1(_0x5ed90b);});});};var _0x4b82bb=function(_0x17ec92){return new BPromise(function(_0x10a90d,_0x78eb5e){_0x54e3ba[_0xc53e('0x17')][_0xc53e('0x18')]({'where':{'phone':_0x9ffbcb[_0xc53e('0xb')],'CampaignId':_0x17ec92['id']}})['then'](function(_0x2a85d1){if(!_[_0xc53e('0x19')](_0x2a85d1)){throw new Error(_0xc53e('0x1a')+_0x9ffbcb['phone']+_0xc53e('0x28')+_0x17ec92['id']);}return _0x54e3ba['CmHopperFinal'][_0xc53e('0x18')]({'where':{'calleridnum':_0x9ffbcb[_0xc53e('0xb')],'CampaignId':_0x17ec92['id']}});})[_0xc53e('0x23')](function(_0xad1232){if(!_[_0xc53e('0x19')](_0xad1232)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x9ffbcb[_0xc53e('0xb')]+_0xc53e('0x29')+_0x17ec92['id']);}return _0x54e3ba['CmHopper']['create']({'phone':_0x9ffbcb['phone'],'ContactId':_0x9ffbcb['id'],'ListId':_0x9ffbcb['ListId'],'priority':_0x9ffbcb[_0xc53e('0x26')]?_0x9ffbcb[_0xc53e('0x26')]:0x2,'scheduledat':_0x9ffbcb['scheduledat']?_0x9ffbcb[_0xc53e('0x1e')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x9ffbcb['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x9ffbcb[_0xc53e('0x21')]?_0x9ffbcb['callbackUniqueid']:undefined,'callbackat':_0x9ffbcb['callbackUniqueid']?moment()[_0xc53e('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x17ec92['id']});})[_0xc53e('0x22')](function(_0x360af9){_0x78eb5e(_0x360af9);});});};if(_0x9ffbcb['ListId']){_0x54e3ba[_0xc53e('0x2a')][_0xc53e('0x2b')]({'where':{'type':'outbound'},'attributes':['id',_0xc53e('0x2c')],'include':[{'model':_0x54e3ba['CmList'],'as':'Lists','where':{'id':_0x9ffbcb['ListId']}}]})['then'](function(_0x887d78){if(_0x887d78){var _0x17b586=[];for(var _0x3b2834=0x0,_0x5f1884;_0x3b2834<_0x887d78[_0xc53e('0x2d')];_0x3b2834+=0x1){_0x5f1884=_0x887d78[_0x3b2834][_0xc53e('0x13')]({'plain':!![]});switch(_0x5f1884['dialCheckDuplicateType']){case'always':_0x426467(_0x5f1884)[_0xc53e('0x22')](_0x4203aa());break;case _0xc53e('0x2e'):_0x3d2e17(_0x5f1884)[_0xc53e('0x22')](_0x4203aa());break;default:_0x54e3ba['CmHopper'][_0xc53e('0x1c')]({'phone':_0x9ffbcb[_0xc53e('0xb')],'ContactId':_0x9ffbcb['id'],'ListId':_0x9ffbcb[_0xc53e('0x1d')],'scheduledat':_0x9ffbcb[_0xc53e('0x1e')]?_0x9ffbcb[_0xc53e('0x1e')]:moment()[_0xc53e('0x1f')](_0xc53e('0x20')),'priority':_0x9ffbcb['priority']?_0x9ffbcb[_0xc53e('0x26')]:0x2,'callback':_0x9ffbcb[_0xc53e('0x21')]?!![]:![],'callbackuniqueid':_0x9ffbcb[_0xc53e('0x21')]?_0x9ffbcb['callbackUniqueid']:undefined,'callbackat':_0x9ffbcb[_0xc53e('0x21')]?moment()[_0xc53e('0x1f')](_0xc53e('0x20')):undefined,'VoiceQueueId':_0x5f1884['id']})[_0xc53e('0x22')](_0x4203aa());}}}})[_0xc53e('0x23')](function(){return _0x54e3ba[_0xc53e('0x2a')]['findAll']({'where':{'type':_0xc53e('0x2f')},'attributes':['id'],'include':[{'model':_0x54e3ba[_0xc53e('0x30')],'as':_0xc53e('0x31'),'where':{'id':_0x9ffbcb['ListId']}}]})[_0xc53e('0x23')](function(_0x1d2491){if(_0x1d2491){var _0x1eeb65=[];for(var _0x3f81b8=0x0,_0x293f36;_0x3f81b8<_0x1d2491[_0xc53e('0x2d')];_0x3f81b8+=0x1){_0x293f36=_0x1d2491[_0x3f81b8][_0xc53e('0x13')]({'plain':!![]});_0x54e3ba[_0xc53e('0x32')][_0xc53e('0x1c')]({'phone':_0x9ffbcb[_0xc53e('0xb')],'ContactId':_0x9ffbcb['id'],'ListId':_0x9ffbcb['ListId'],'VoiceQueueId':_0x293f36['id']})[_0xc53e('0x22')](function(_0x17cf13){logger[_0xc53e('0x33')](_0xc53e('0x34'),_0xc53e('0x15'),_0x17cf13['message']);});}}});})['then'](function(){return _0x54e3ba[_0xc53e('0x35')]['findAll']({'attributes':['id',_0xc53e('0x2c')],'include':[{'model':_0x54e3ba['CmList'],'as':_0xc53e('0x36'),'where':{'id':_0x9ffbcb[_0xc53e('0x1d')]}}]})[_0xc53e('0x23')](function(_0x55797f){if(_0x55797f){var _0x393611=[];for(var _0x10bebb=0x0,_0x395913;_0x10bebb<_0x55797f['length'];_0x10bebb+=0x1){_0x395913=_0x55797f[_0x10bebb][_0xc53e('0x13')]({'plain':!![]});switch(_0x395913['dialCheckDuplicateType']){case _0xc53e('0x37'):_0x4b82bb(_0x395913)[_0xc53e('0x22')](_0x311835());break;case'onlyIfOpen':_0x2467f4(_0x395913)[_0xc53e('0x22')](_0x311835());break;default:_0x54e3ba[_0xc53e('0x17')]['create']({'phone':_0x9ffbcb[_0xc53e('0xb')],'ContactId':_0x9ffbcb['id'],'ListId':_0x9ffbcb[_0xc53e('0x1d')],'scheduledat':_0x9ffbcb[_0xc53e('0x1e')]?_0x9ffbcb[_0xc53e('0x1e')]:moment()[_0xc53e('0x1f')](_0xc53e('0x20')),'priority':_0x9ffbcb[_0xc53e('0x26')]?_0x9ffbcb[_0xc53e('0x26')]:0x2,'callback':_0x9ffbcb[_0xc53e('0x21')]?!![]:![],'callbackuniqueid':_0x9ffbcb[_0xc53e('0x21')]?_0x9ffbcb[_0xc53e('0x21')]:undefined,'callbackat':_0x9ffbcb['callbackUniqueid']?moment()[_0xc53e('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x395913['id']})[_0xc53e('0x22')](_0x311835());}}}});})['then'](function(){return _0x54e3ba[_0xc53e('0x35')][_0xc53e('0x2b')]({'attributes':['id'],'include':[{'model':_0x54e3ba['CmList'],'as':_0xc53e('0x31'),'where':{'id':_0x9ffbcb[_0xc53e('0x1d')]}}]})[_0xc53e('0x23')](function(_0x432a91){if(_0x432a91){var _0x53083b=[];for(var _0x41c46c=0x0,_0x335427;_0x41c46c<_0x432a91['length'];_0x41c46c+=0x1){_0x335427=_0x432a91[_0x41c46c]['get']({'plain':!![]});_0x54e3ba[_0xc53e('0x32')]['create']({'phone':_0x9ffbcb['phone'],'ContactId':_0x9ffbcb['id'],'ListId':_0x9ffbcb['ListId'],'CampaignId':_0x335427['id']})[_0xc53e('0x22')](function(_0x5f5dad){logger[_0xc53e('0x33')]('cmContact,\x20%s,\x20%s',_0xc53e('0x15'),_0x5f5dad[_0xc53e('0x38')]);});}}});})[_0xc53e('0x23')](function(){_0x5a2da7();})[_0xc53e('0x22')](function(_0x202a30){logger['error']('cmContact,\x20%s,\x20%s',_0xc53e('0x15'),_0x202a30[_0xc53e('0x38')]);_0x5a2da7(_0x202a30);});}else{_0x5a2da7(new Error(_0xc53e('0x39')));}},'afterDestroy':function(_0x1ae133,_0x11278d,_0x2487ad){var _0x31f72e=_0x2f1414[_0xc53e('0x12')];var _0x13bf71=_0x1ae133[_0xc53e('0x13')]({'plain':!![]});return _0x31f72e[_0xc53e('0x17')][_0xc53e('0x2b')]({'raw':!![],'where':{'ListId':_0x13bf71[_0xc53e('0x1d')],'ContactId':_0x13bf71['id']}})['then'](function(_0xb4ef48){if(!_['isEmpty'](_0xb4ef48)){var _0x2d5311=[];for(var _0x298551=0x0;_0x298551<_0xb4ef48[_0xc53e('0x2d')];_0x298551+=0x1){var _0x24f8ef=_0x31f72e[_0xc53e('0x17')][_0xc53e('0x3a')]({'where':{'ListId':_0xb4ef48[_0x298551][_0xc53e('0x1d')],'ContactId':_0xb4ef48[_0x298551][_0xc53e('0x3b')],'VoiceQueueId':_0xb4ef48[_0x298551]['VoiceQueueId'],'CampaignId':_0xb4ef48[_0x298551]['CampaignId']}});_0x2d5311['push'](_0x24f8ef);}return BPromise[_0xc53e('0x3c')](_0x2d5311);}})[_0xc53e('0x23')](function(_0x37ac78){logger[_0xc53e('0x3d')](_0xc53e('0x3e'),util[_0xc53e('0x16')](_0x37ac78,{'showHidden':![],'depth':null}));_0x2487ad();})[_0xc53e('0x22')](function(_0x5a9596){logger['error']('[CmContact][afterDestroy][Error]',util[_0xc53e('0x16')](_0x5a9596,{'showHidden':![],'depth':null}));_0x2487ad(_0x5a9596);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index efd049b..6a33563 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 _0x2b66=['then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','raw','where','limit','include','model','attributes','map','stringify','CreateCmContact','create','body','keys','length','startsWith','update','cm_contacts','set','toString','sequelize','query','lodash','util','moment','bluebird','randomstring','ioredis','squel','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register'];(function(_0x1a3e92,_0x20fe1e){var _0x596078=function(_0x4f0be9){while(--_0x4f0be9){_0x1a3e92['push'](_0x1a3e92['shift']());}};_0x596078(++_0x20fe1e);}(_0x2b66,0x196));var _0x62b6=function(_0x2065ae,_0x4ac511){_0x2065ae=_0x2065ae-0x0;var _0x18c20c=_0x2b66[_0x2065ae];return _0x18c20c;};'use strict';var _=require(_0x62b6('0x0'));var util=require(_0x62b6('0x1'));var moment=require(_0x62b6('0x2'));var BPromise=require(_0x62b6('0x3'));var rs=require(_0x62b6('0x4'));var fs=require('fs');var Redis=require(_0x62b6('0x5'));var squel=require(_0x62b6('0x6'));var db=require('../../mysqldb')['db'];var utils=require(_0x62b6('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62b6('0x8'));var jayson=require(_0x62b6('0x9'));var client=jayson[_0x62b6('0xa')][_0x62b6('0xb')]({'port':0x232a});config['redis']=_[_0x62b6('0xc')](config[_0x62b6('0xd')],{'host':_0x62b6('0xe'),'port':0x18eb});var socket=require(_0x62b6('0xf'))(new Redis(config[_0x62b6('0xd')]));require(_0x62b6('0x10'))[_0x62b6('0x11')](socket);function respondWithRpcPromise(_0x187136,_0x180b96,_0xc25310){return new BPromise(function(_0x1e5113,_0x221dd8){return client['request'](_0x187136,_0xc25310)[_0x62b6('0x12')](function(_0x4aef9d){logger[_0x62b6('0x13')](_0x62b6('0x14'),_0x180b96,_0x62b6('0x15'));logger[_0x62b6('0x16')](_0x62b6('0x17'),_0x180b96,_0x62b6('0x15'),JSON['stringify'](_0x4aef9d));if(_0x4aef9d[_0x62b6('0x18')]){if(_0x4aef9d[_0x62b6('0x18')][_0x62b6('0x19')]===0x1f4){logger[_0x62b6('0x18')](_0x62b6('0x14'),_0x180b96,_0x4aef9d['error'][_0x62b6('0x1a')]);return _0x221dd8(_0x4aef9d[_0x62b6('0x18')]['message']);}logger[_0x62b6('0x18')](_0x62b6('0x14'),_0x180b96,_0x4aef9d['error'][_0x62b6('0x1a')]);return _0x1e5113(_0x4aef9d['error'][_0x62b6('0x1a')]);}else{logger['info'](_0x62b6('0x14'),_0x180b96,'request\x20sent');_0x1e5113(_0x4aef9d[_0x62b6('0x1b')][_0x62b6('0x1a')]);}})[_0x62b6('0x1c')](function(_0x3b41c4){logger[_0x62b6('0x18')]('CmContact,\x20%s,\x20%s',_0x180b96,_0x3b41c4);_0x221dd8(_0x3b41c4);});});}exports[_0x62b6('0x1d')]=function(_0x214ee8){var _0x269abb=this;return new Promise(function(_0xf1bc4c,_0x4ae7a9){return db[_0x62b6('0x1e')][_0x62b6('0x1f')]({'raw':_0x214ee8[_0x62b6('0x20')]?_0x214ee8[_0x62b6('0x20')][_0x62b6('0x21')]===undefined?!![]:![]:!![],'where':_0x214ee8['options']?_0x214ee8[_0x62b6('0x20')][_0x62b6('0x22')]||null:null,'attributes':_0x214ee8[_0x62b6('0x20')]?_0x214ee8[_0x62b6('0x20')]['attributes']||null:null,'limit':_0x214ee8[_0x62b6('0x20')]?_0x214ee8[_0x62b6('0x20')][_0x62b6('0x23')]||null:null,'include':_0x214ee8[_0x62b6('0x20')]?_0x214ee8[_0x62b6('0x20')]['include']?_['map'](_0x214ee8[_0x62b6('0x20')][_0x62b6('0x24')],function(_0x75679e){return{'model':db[_0x75679e[_0x62b6('0x25')]],'as':_0x75679e['as'],'attributes':_0x75679e[_0x62b6('0x26')],'include':_0x75679e[_0x62b6('0x24')]?_[_0x62b6('0x27')](_0x75679e[_0x62b6('0x24')],function(_0x1f2b89){return{'model':db[_0x1f2b89[_0x62b6('0x25')]],'as':_0x1f2b89['as'],'attributes':_0x1f2b89[_0x62b6('0x26')],'include':_0x1f2b89[_0x62b6('0x24')]?_[_0x62b6('0x27')](_0x1f2b89['include'],function(_0x3d328d){return{'model':db[_0x3d328d[_0x62b6('0x25')]],'as':_0x3d328d['as'],'attributes':_0x3d328d[_0x62b6('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6b87c){logger[_0x62b6('0x13')](_0x62b6('0x1d'),_0x214ee8);logger['debug'](_0x62b6('0x1d'),_0x214ee8,JSON[_0x62b6('0x28')](_0x6b87c));_0xf1bc4c(_0x6b87c);})[_0x62b6('0x1c')](function(_0x3ddc6d){logger[_0x62b6('0x18')](_0x62b6('0x1d'),_0x3ddc6d[_0x62b6('0x1a')],_0x214ee8);_0x4ae7a9(_0x269abb[_0x62b6('0x18')](0x1f4,_0x3ddc6d[_0x62b6('0x1a')]));});});};exports[_0x62b6('0x29')]=function(_0x4e2a03){var _0x1f4316=this;return new Promise(function(_0x586e60,_0x360a5c){return db['CmContact'][_0x62b6('0x2a')](_0x4e2a03[_0x62b6('0x2b')],{'raw':_0x4e2a03[_0x62b6('0x20')]?_0x4e2a03['options'][_0x62b6('0x21')]===undefined?!![]:![]:!![]})[_0x62b6('0x12')](function(_0x1f27dd){var _0x202c9c;for(var _0x52f153=0x0;_0x52f153{}\s\\|]/g,'-');_0x3e99f8(null,util[_0x0a5d('0x28')](_0x0a5d('0x29'),path[_0x0a5d('0x2a')](_0x248aea[_0x0a5d('0x26')],path['extname'](_0x248aea[_0x0a5d('0x26')])),Date[_0x0a5d('0x2b')](),path[_0x0a5d('0x2c')](_0x248aea[_0x0a5d('0x26')])));}})});router[_0x0a5d('0x1c')](_0x0a5d('0x2d'),upload[_0x0a5d('0x2e')](_0x0a5d('0x2f')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x0a5d('0x30')]({'destination':function(_0xff534a,_0x5bc91f,_0x3bbd80){_0x3bbd80(null,path['join'](config[_0x0a5d('0x24')],_0x0a5d('0x25')));},'filename':function(_0x45bc9b,_0x1f5508,_0x49f88c){_0x1f5508['originalname']=_0x1f5508[_0x0a5d('0x26')][_0x0a5d('0x27')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x49f88c(null,util['format'](_0x0a5d('0x29'),path['basename'](_0x1f5508[_0x0a5d('0x26')],path['extname'](_0x1f5508[_0x0a5d('0x26')])),Date[_0x0a5d('0x2b')](),path['extname'](_0x1f5508['originalname'])));}})});router[_0x0a5d('0x1c')](_0x0a5d('0x31'),upload[_0x0a5d('0x2e')](_0x0a5d('0x2f')),controller[_0x0a5d('0x32')]);router[_0x0a5d('0x1c')]('/upload/:id',auth[_0x0a5d('0xb')](),controller['import']);router[_0x0a5d('0x1c')]('/uploadUpdates/:id',auth[_0x0a5d('0xb')](),controller[_0x0a5d('0x33')]);router[_0x0a5d('0x34')](_0x0a5d('0xf'),auth[_0x0a5d('0xb')](),controller[_0x0a5d('0x35')]);router[_0x0a5d('0x36')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0a5d('0x37')]=router; \ No newline at end of file +var _0x4ef5=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','show','getTags','/:id/phones','getAdditionalPhones','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','merge','post','/create_many','bulkCreate','/:id/tags','setTags','/:id/duplicateAdditionalPhones','duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','root','server/files/tmp','originalname','basename','extname','single','file','uploadCsv','join','replace','format','%s-%s%s','import','put','/:id','update','delete','exports','util'];(function(_0x4f8e06,_0x3226b1){var _0x327dad=function(_0x4dced3){while(--_0x4dced3){_0x4f8e06['push'](_0x4f8e06['shift']());}};_0x327dad(++_0x3226b1);}(_0x4ef5,0xf9));var _0x54ef=function(_0x23f976,_0x56acdc){_0x23f976=_0x23f976-0x0;var _0xad2bad=_0x4ef5[_0x23f976];return _0xad2bad;};'use strict';var multer=require('multer');var util=require(_0x54ef('0x0'));var path=require(_0x54ef('0x1'));var timeout=require(_0x54ef('0x2'));var express=require(_0x54ef('0x3'));var router=express['Router']();var fs_extra=require(_0x54ef('0x4'));var auth=require(_0x54ef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x54ef('0x6'));var controller=require('./cmContact.controller');router[_0x54ef('0x7')]('/',auth[_0x54ef('0x8')](),controller['index']);router[_0x54ef('0x7')]('/describe',auth[_0x54ef('0x8')](),controller[_0x54ef('0x9')]);router[_0x54ef('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x54ef('0xa')]);router[_0x54ef('0x7')]('/:id/tags',auth[_0x54ef('0x8')](),controller[_0x54ef('0xb')]);router[_0x54ef('0x7')](_0x54ef('0xc'),auth[_0x54ef('0x8')](),controller[_0x54ef('0xd')]);router[_0x54ef('0x7')](_0x54ef('0xe'),auth[_0x54ef('0x8')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x54ef('0xf')]);router[_0x54ef('0x7')](_0x54ef('0x10'),auth[_0x54ef('0x8')](),controller[_0x54ef('0x11')]);router[_0x54ef('0x7')](_0x54ef('0x12'),auth[_0x54ef('0x8')](),controller[_0x54ef('0x13')]);router[_0x54ef('0x7')](_0x54ef('0x14'),auth[_0x54ef('0x8')](),controller[_0x54ef('0x15')]);router['post']('/merge',auth[_0x54ef('0x8')](),controller[_0x54ef('0x16')]);router[_0x54ef('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x54ef('0x17')](_0x54ef('0x18'),auth[_0x54ef('0x8')](),controller[_0x54ef('0x19')]);router[_0x54ef('0x17')](_0x54ef('0x1a'),auth['isAuthenticated'](),controller[_0x54ef('0x1b')]);router['post'](_0x54ef('0xc'),auth['isAuthenticated'](),controller['setAdditionalPhones']);router[_0x54ef('0x17')](_0x54ef('0x1c'),auth[_0x54ef('0x8')](),controller[_0x54ef('0x1d')]);router[_0x54ef('0x17')](_0x54ef('0x1e'),auth[_0x54ef('0x8')](),controller[_0x54ef('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e7293,_0x23c97f,_0x27f376){_0x27f376(null,path['join'](config[_0x54ef('0x20')],_0x54ef('0x21')));},'filename':function(_0x2fe8f3,_0x29df9c,_0x12a427){_0x29df9c[_0x54ef('0x22')]=_0x29df9c[_0x54ef('0x22')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x12a427(null,util['format']('%s-%s%s',path[_0x54ef('0x23')](_0x29df9c[_0x54ef('0x22')],path[_0x54ef('0x24')](_0x29df9c[_0x54ef('0x22')])),Date['now'](),path['extname'](_0x29df9c[_0x54ef('0x22')])));}})});router[_0x54ef('0x17')]('/csv',upload[_0x54ef('0x25')](_0x54ef('0x26')),controller[_0x54ef('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1cdc32,_0x909ff,_0xa724b9){_0xa724b9(null,path[_0x54ef('0x28')](config[_0x54ef('0x20')],_0x54ef('0x21')));},'filename':function(_0x441e3a,_0x243809,_0x2c2fe2){_0x243809['originalname']=_0x243809['originalname'][_0x54ef('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c2fe2(null,util[_0x54ef('0x2a')](_0x54ef('0x2b'),path[_0x54ef('0x23')](_0x243809[_0x54ef('0x22')],path['extname'](_0x243809[_0x54ef('0x22')])),Date['now'](),path[_0x54ef('0x24')](_0x243809[_0x54ef('0x22')])));}})});router['post']('/upload',upload[_0x54ef('0x25')](_0x54ef('0x26')),controller['upload']);router[_0x54ef('0x17')]('/upload/:id',auth[_0x54ef('0x8')](),controller[_0x54ef('0x2c')]);router[_0x54ef('0x17')]('/uploadUpdates/:id',auth[_0x54ef('0x8')](),controller['importUpdates']);router[_0x54ef('0x2d')](_0x54ef('0x2e'),auth[_0x54ef('0x8')](),controller[_0x54ef('0x2f')]);router[_0x54ef('0x30')](_0x54ef('0x2e'),auth['isAuthenticated'](),controller['destroy']);module[_0x54ef('0x31')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index e58895b..2b982f6 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 _0x1e9b=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x4b96be,_0x20866e){var _0x3afa6d=function(_0x4e199e){while(--_0x4e199e){_0x4b96be['push'](_0x4b96be['shift']());}};_0x3afa6d(++_0x20866e);}(_0x1e9b,0x1db));var _0xb1e9=function(_0x14f458,_0x5dd219){_0x14f458=_0x14f458-0x0;var _0x4ff2da=_0x1e9b[_0x14f458];return _0x4ff2da;};'use strict';var Sequelize=require(_0xb1e9('0x0'));module[_0xb1e9('0x1')]={'CmContactId':{'type':Sequelize[_0xb1e9('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xb1e9('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xb1e9('0x3')],'defaultValue':_0xb1e9('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xa0de=['STRING','PHONE','exports','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa0de,0x17a));var _0xea0d=function(_0xf05566,_0x516781){_0xf05566=_0xf05566-0x0;var _0x4ed036=_0xa0de[_0xf05566];return _0x4ed036;};'use strict';var Sequelize=require('sequelize');module[_0xea0d('0x0')]={'CmContactId':{'type':Sequelize[_0xea0d('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xea0d('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xea0d('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xea0d('0x2')],'defaultValue':_0xea0d('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xea0d('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 39d2f40..af032ab 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 _0xd92a=['end','status','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','CmContactHasItem','rawAttributes','type','key','map','keys','filters','intersection','model','query','attributes','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','options','findAll','catch','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4a1ec0,_0x26287b){var _0x49ab91=function(_0x206584){while(--_0x206584){_0x4a1ec0['push'](_0x4a1ec0['shift']());}};_0x49ab91(++_0x26287b);}(_0xd92a,0x16d));var _0xad92=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd92a[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xad92('0x0'));var rimraf=require(_0xad92('0x1'));var zipdir=require(_0xad92('0x2'));var jsonpatch=require(_0xad92('0x3'));var rp=require(_0xad92('0x4'));var moment=require(_0xad92('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xad92('0x6'));var path=require(_0xad92('0x7'));var sox=require(_0xad92('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad92('0x9'));var _=require(_0xad92('0xa'));var squel=require(_0xad92('0xb'));var crypto=require(_0xad92('0xc'));var jsforce=require(_0xad92('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xad92('0xe'));var authService=require(_0xad92('0xf'));var qs=require(_0xad92('0x10'));var as=require(_0xad92('0x11'));var hardwareService=require(_0xad92('0x12'));var logger=require(_0xad92('0x13'))('api');var utils=require(_0xad92('0x14'));var config=require(_0xad92('0x15'));var licenseUtil=require(_0xad92('0x16'));var db=require(_0xad92('0x17'))['db'];function respondWithStatusCode(_0x3d96bf,_0x35f36){_0x35f36=_0x35f36||0xcc;return function(_0x4493be){if(_0x4493be){return _0x3d96bf[_0xad92('0x18')](_0x35f36);}return _0x3d96bf['status'](_0x35f36)[_0xad92('0x19')]();};}function respondWithResult(_0x15b815,_0x513e41){_0x513e41=_0x513e41||0xc8;return function(_0xfb8463){if(_0xfb8463){return _0x15b815[_0xad92('0x1a')](_0x513e41)['json'](_0xfb8463);}};}function respondWithFilteredResult(_0x5c8cf8,_0x2f4b98){return function(_0x1f1eaf){if(_0x1f1eaf){var _0x509312=typeof _0x2f4b98['offset']===_0xad92('0x1b')&&typeof _0x2f4b98[_0xad92('0x1c')]===_0xad92('0x1b');var _0x1eb407=_0x1f1eaf[_0xad92('0x1d')];var _0x3c92db=_0x509312?0x0:_0x2f4b98[_0xad92('0x1e')];var _0x28a326=_0x509312?_0x1f1eaf['count']:_0x2f4b98['offset']+_0x2f4b98[_0xad92('0x1c')];var _0x2a9f11;if(_0x28a326>=_0x1eb407){_0x28a326=_0x1eb407;_0x2a9f11=0xc8;}else{_0x2a9f11=0xce;}_0x5c8cf8[_0xad92('0x1a')](_0x2a9f11);return _0x5c8cf8['set'](_0xad92('0x1f'),_0x3c92db+'-'+_0x28a326+'/'+_0x1eb407)['json'](_0x1f1eaf);}return null;};}function patchUpdates(_0x50c80b){return function(_0x16c487){try{jsonpatch[_0xad92('0x20')](_0x16c487,_0x50c80b,!![]);}catch(_0x15ea5c){return BPromise['reject'](_0x15ea5c);}return _0x16c487[_0xad92('0x21')]();};}function saveUpdates(_0xc8e70d,_0x2bedaa){return function(_0x258835){if(_0x258835){return _0x258835[_0xad92('0x22')](_0xc8e70d)[_0xad92('0x23')](function(_0x3c0795){return _0x3c0795;});}return null;};}function removeEntity(_0x177cb0,_0x17841e){return function(_0x13920c){if(_0x13920c){return _0x13920c[_0xad92('0x24')]()[_0xad92('0x23')](function(){var _0x1cd867=_0x13920c[_0xad92('0x25')]({'plain':!![]});var _0x200793='CmContactHasItems';return db[_0xad92('0x26')][_0xad92('0x24')]({'where':{'type':_0x200793,'resourceId':_0x1cd867['id']}})[_0xad92('0x23')](function(){return _0x13920c;});})[_0xad92('0x23')](function(){_0x177cb0['status'](0xcc)[_0xad92('0x19')]();});}};}function handleEntityNotFound(_0x147c33,_0x2c855d){return function(_0x5b529c){if(!_0x5b529c){_0x147c33['sendStatus'](0x194);}return _0x5b529c;};}function handleError(_0x33bf03,_0x598c73){_0x598c73=_0x598c73||0x1f4;return function(_0x19fb02){logger[_0xad92('0x27')](_0x19fb02[_0xad92('0x28')]);if(_0x19fb02[_0xad92('0x29')]){delete _0x19fb02[_0xad92('0x29')];}_0x33bf03[_0xad92('0x1a')](_0x598c73)[_0xad92('0x2a')](_0x19fb02);};}exports[_0xad92('0x2b')]=function(_0x17e0b8,_0x1c48bf){var _0x1537e1={},_0xcd8bed={},_0x10fb3a={'count':0x0,'rows':[]};var _0x532900=_['map'](db[_0xad92('0x2c')][_0xad92('0x2d')],function(_0x49eec5){return{'name':_0x49eec5['fieldName'],'type':_0x49eec5[_0xad92('0x2e')][_0xad92('0x2f')]};});_0xcd8bed['model']=_[_0xad92('0x30')](_0x532900,_0xad92('0x29'));_0xcd8bed['query']=_[_0xad92('0x31')](_0x17e0b8['query']);_0xcd8bed[_0xad92('0x32')]=_[_0xad92('0x33')](_0xcd8bed[_0xad92('0x34')],_0xcd8bed[_0xad92('0x35')]);_0x1537e1[_0xad92('0x36')]=_[_0xad92('0x33')](_0xcd8bed[_0xad92('0x34')],qs[_0xad92('0x37')](_0x17e0b8[_0xad92('0x35')][_0xad92('0x37')]));_0x1537e1[_0xad92('0x36')]=_0x1537e1[_0xad92('0x36')][_0xad92('0x38')]?_0x1537e1[_0xad92('0x36')]:_0xcd8bed[_0xad92('0x34')];if(!_0x17e0b8[_0xad92('0x35')]['hasOwnProperty'](_0xad92('0x39'))){_0x1537e1['limit']=qs['limit'](_0x17e0b8[_0xad92('0x35')][_0xad92('0x1c')]);_0x1537e1[_0xad92('0x1e')]=qs[_0xad92('0x1e')](_0x17e0b8[_0xad92('0x35')][_0xad92('0x1e')]);}_0x1537e1['order']=qs[_0xad92('0x3a')](_0x17e0b8['query']['sort']);_0x1537e1['where']=qs[_0xad92('0x32')](_['pick'](_0x17e0b8['query'],_0xcd8bed['filters']),_0x532900);if(_0x17e0b8['query'][_0xad92('0x3b')]){_0x1537e1[_0xad92('0x3c')]=_[_0xad92('0x3d')](_0x1537e1[_0xad92('0x3c')],{'$or':_['map'](_0x532900,function(_0x34d370){if(_0x34d370[_0xad92('0x2e')]!==_0xad92('0x3e')){var _0x58c849={};_0x58c849[_0x34d370['name']]={'$like':'%'+_0x17e0b8[_0xad92('0x35')][_0xad92('0x3b')]+'%'};return _0x58c849;}})});}_0x1537e1=_[_0xad92('0x3d')]({},_0x1537e1,_0x17e0b8[_0xad92('0x3f')]);var _0x3df1aa={'where':_0x1537e1['where']};return db[_0xad92('0x2c')][_0xad92('0x1d')](_0x3df1aa)[_0xad92('0x23')](function(_0x1756a5){_0x10fb3a[_0xad92('0x1d')]=_0x1756a5;if(_0x17e0b8[_0xad92('0x35')]['includeAll']){_0x1537e1['include']=[{'all':!![]}];}return db[_0xad92('0x2c')][_0xad92('0x40')](_0x1537e1);})[_0xad92('0x23')](function(_0x42e5de){_0x10fb3a['rows']=_0x42e5de;return _0x10fb3a;})[_0xad92('0x23')](respondWithFilteredResult(_0x1c48bf,_0x1537e1))[_0xad92('0x41')](handleError(_0x1c48bf,null));};exports['show']=function(_0xe7faf3,_0x307a51){var _0x21bb3c={'raw':!![],'where':{'id':_0xe7faf3['params']['id']}},_0x12eb12={};_0x12eb12[_0xad92('0x34')]=_[_0xad92('0x31')](db[_0xad92('0x2c')]['rawAttributes']);_0x12eb12['query']=_['keys'](_0xe7faf3['query']);_0x12eb12[_0xad92('0x32')]=_[_0xad92('0x33')](_0x12eb12[_0xad92('0x34')],_0x12eb12[_0xad92('0x35')]);_0x21bb3c[_0xad92('0x36')]=_[_0xad92('0x33')](_0x12eb12[_0xad92('0x34')],qs[_0xad92('0x37')](_0xe7faf3[_0xad92('0x35')][_0xad92('0x37')]));_0x21bb3c[_0xad92('0x36')]=_0x21bb3c[_0xad92('0x36')][_0xad92('0x38')]?_0x21bb3c['attributes']:_0x12eb12[_0xad92('0x34')];if(_0xe7faf3[_0xad92('0x35')]['includeAll']){_0x21bb3c[_0xad92('0x42')]=[{'all':!![]}];}_0x21bb3c=_['merge']({},_0x21bb3c,_0xe7faf3[_0xad92('0x3f')]);return db[_0xad92('0x2c')][_0xad92('0x43')](_0x21bb3c)[_0xad92('0x23')](handleEntityNotFound(_0x307a51,null))['then'](respondWithResult(_0x307a51,null))[_0xad92('0x41')](handleError(_0x307a51,null));};exports[_0xad92('0x44')]=function(_0x58aadf,_0x24d0aa){return db['CmContactHasItem'][_0xad92('0x44')](_0x58aadf['body'],{})[_0xad92('0x23')](function(_0x58696e){var _0x8f75f=_0x58aadf[_0xad92('0x45')][_0xad92('0x25')]({'plain':!![]});if(!_0x8f75f)throw new Error(_0xad92('0x46'));if(_0x8f75f[_0xad92('0x47')]===_0xad92('0x45')){var _0x53d7e2=_0x58696e[_0xad92('0x25')]({'plain':!![]});var _0x3e2ced=_0xad92('0x48');return db[_0xad92('0x49')]['find']({'where':{'name':_0x3e2ced,'userProfileId':_0x8f75f['userProfileId']},'raw':!![]})[_0xad92('0x23')](function(_0xd416fe){if(_0xd416fe&&_0xd416fe[_0xad92('0x4a')]===0x0){return db[_0xad92('0x26')]['create']({'name':_0x53d7e2[_0xad92('0x29')],'resourceId':_0x53d7e2['id'],'type':_0xd416fe[_0xad92('0x29')],'sectionId':_0xd416fe['id']},{})['then'](function(){return _0x58696e;});}else{return _0x58696e;}})[_0xad92('0x41')](function(_0x60f411){logger[_0xad92('0x27')](_0xad92('0x4b'),_0x60f411);throw _0x60f411;});}return _0x58696e;})[_0xad92('0x23')](respondWithResult(_0x24d0aa,0xc9))['catch'](handleError(_0x24d0aa,null));};exports[_0xad92('0x22')]=function(_0x517d59,_0x49d7fe){if(_0x517d59['body']['id']){delete _0x517d59[_0xad92('0x4c')]['id'];}return db[_0xad92('0x2c')][_0xad92('0x43')]({'where':{'id':_0x517d59[_0xad92('0x4d')]['id']}})[_0xad92('0x23')](handleEntityNotFound(_0x49d7fe,null))['then'](saveUpdates(_0x517d59[_0xad92('0x4c')],null))[_0xad92('0x23')](respondWithResult(_0x49d7fe,null))[_0xad92('0x41')](handleError(_0x49d7fe,null));};exports['destroy']=function(_0x566a3b,_0xc4466f){return db[_0xad92('0x2c')][_0xad92('0x43')]({'where':{'id':_0x566a3b[_0xad92('0x4d')]['id']}})[_0xad92('0x23')](handleEntityNotFound(_0xc4466f,null))['then'](removeEntity(_0xc4466f,null))[_0xad92('0x41')](handleError(_0xc4466f,null));}; \ No newline at end of file +var _0xe65d=['role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','CmContactHasItems','UserProfileResource','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmContactHasItem','includeAll','rows','show','params','keys','include','find','catch','create','body'];(function(_0x155af3,_0x4b7f9a){var _0x15a675=function(_0xec0188){while(--_0xec0188){_0x155af3['push'](_0x155af3['shift']());}};_0x15a675(++_0x4b7f9a);}(_0xe65d,0x113));var _0xde65=function(_0x1a9d20,_0x5b15f2){_0x1a9d20=_0x1a9d20-0x0;var _0x87ac10=_0xe65d[_0x1a9d20];return _0x87ac10;};'use strict';var emlformat=require(_0xde65('0x0'));var rimraf=require(_0xde65('0x1'));var zipdir=require(_0xde65('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde65('0x3'));var moment=require(_0xde65('0x4'));var BPromise=require(_0xde65('0x5'));var Mustache=require(_0xde65('0x6'));var util=require('util');var path=require(_0xde65('0x7'));var sox=require(_0xde65('0x8'));var csv=require(_0xde65('0x9'));var ejs=require(_0xde65('0xa'));var fs=require('fs');var fs_extra=require(_0xde65('0xb'));var _=require(_0xde65('0xc'));var squel=require(_0xde65('0xd'));var crypto=require('crypto');var jsforce=require(_0xde65('0xe'));var deskjs=require(_0xde65('0xf'));var toCsv=require(_0xde65('0x9'));var querystring=require(_0xde65('0x10'));var Papa=require(_0xde65('0x11'));var Redis=require(_0xde65('0x12'));var authService=require(_0xde65('0x13'));var qs=require(_0xde65('0x14'));var as=require(_0xde65('0x15'));var hardwareService=require(_0xde65('0x16'));var logger=require('../../config/logger')(_0xde65('0x17'));var utils=require(_0xde65('0x18'));var config=require(_0xde65('0x19'));var licenseUtil=require(_0xde65('0x1a'));var db=require(_0xde65('0x1b'))['db'];function respondWithStatusCode(_0x13cb9c,_0x18d097){_0x18d097=_0x18d097||0xcc;return function(_0x139582){if(_0x139582){return _0x13cb9c['sendStatus'](_0x18d097);}return _0x13cb9c[_0xde65('0x1c')](_0x18d097)[_0xde65('0x1d')]();};}function respondWithResult(_0x51ec19,_0x4062e8){_0x4062e8=_0x4062e8||0xc8;return function(_0x3d6549){if(_0x3d6549){return _0x51ec19['status'](_0x4062e8)[_0xde65('0x1e')](_0x3d6549);}};}function respondWithFilteredResult(_0x30384b,_0x4084f3){return function(_0x11ab8c){if(_0x11ab8c){var _0x5ae659=typeof _0x4084f3['offset']===_0xde65('0x1f')&&typeof _0x4084f3[_0xde65('0x20')]===_0xde65('0x1f');var _0x2c75f4=_0x11ab8c[_0xde65('0x21')];var _0x3928f3=_0x5ae659?0x0:_0x4084f3['offset'];var _0x2e5f35=_0x5ae659?_0x11ab8c[_0xde65('0x21')]:_0x4084f3[_0xde65('0x22')]+_0x4084f3[_0xde65('0x20')];var _0x2d921e;if(_0x2e5f35>=_0x2c75f4){_0x2e5f35=_0x2c75f4;_0x2d921e=0xc8;}else{_0x2d921e=0xce;}_0x30384b['status'](_0x2d921e);return _0x30384b[_0xde65('0x23')](_0xde65('0x24'),_0x3928f3+'-'+_0x2e5f35+'/'+_0x2c75f4)['json'](_0x11ab8c);}return null;};}function patchUpdates(_0x32f085){return function(_0x4f94f8){try{jsonpatch[_0xde65('0x25')](_0x4f94f8,_0x32f085,!![]);}catch(_0x48816b){return BPromise[_0xde65('0x26')](_0x48816b);}return _0x4f94f8[_0xde65('0x27')]();};}function saveUpdates(_0x2014b9,_0x4fdf68){return function(_0x25f7c7){if(_0x25f7c7){return _0x25f7c7['update'](_0x2014b9)[_0xde65('0x28')](function(_0x52efdc){return _0x52efdc;});}return null;};}function removeEntity(_0x2a3cb2,_0x928d6c){return function(_0xa5015e){if(_0xa5015e){return _0xa5015e['destroy']()[_0xde65('0x28')](function(){var _0x494008=_0xa5015e[_0xde65('0x29')]({'plain':!![]});var _0x3d825d=_0xde65('0x2a');return db[_0xde65('0x2b')][_0xde65('0x2c')]({'where':{'type':_0x3d825d,'resourceId':_0x494008['id']}})['then'](function(){return _0xa5015e;});})[_0xde65('0x28')](function(){_0x2a3cb2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1076bb,_0x5d3435){return function(_0x1ddb5c){if(!_0x1ddb5c){_0x1076bb[_0xde65('0x2d')](0x194);}return _0x1ddb5c;};}function handleError(_0x376fa6,_0x59a39a){_0x59a39a=_0x59a39a||0x1f4;return function(_0x54fb89){logger['error'](_0x54fb89[_0xde65('0x2e')]);if(_0x54fb89[_0xde65('0x2f')]){delete _0x54fb89[_0xde65('0x2f')];}_0x376fa6[_0xde65('0x1c')](_0x59a39a)[_0xde65('0x30')](_0x54fb89);};}exports['index']=function(_0x2e8c58,_0x4c51c7){var _0x3c470e={},_0x8d0fc2={},_0x19cb6f={'count':0x0,'rows':[]};var _0x56da16=_[_0xde65('0x31')](db['CmContactHasItem'][_0xde65('0x32')],function(_0x8fd997){return{'name':_0x8fd997[_0xde65('0x33')],'type':_0x8fd997[_0xde65('0x34')][_0xde65('0x35')]};});_0x8d0fc2[_0xde65('0x36')]=_['map'](_0x56da16,_0xde65('0x2f'));_0x8d0fc2[_0xde65('0x37')]=_['keys'](_0x2e8c58[_0xde65('0x37')]);_0x8d0fc2[_0xde65('0x38')]=_[_0xde65('0x39')](_0x8d0fc2[_0xde65('0x36')],_0x8d0fc2[_0xde65('0x37')]);_0x3c470e[_0xde65('0x3a')]=_['intersection'](_0x8d0fc2[_0xde65('0x36')],qs[_0xde65('0x3b')](_0x2e8c58[_0xde65('0x37')][_0xde65('0x3b')]));_0x3c470e[_0xde65('0x3a')]=_0x3c470e[_0xde65('0x3a')][_0xde65('0x3c')]?_0x3c470e[_0xde65('0x3a')]:_0x8d0fc2[_0xde65('0x36')];if(!_0x2e8c58['query'][_0xde65('0x3d')](_0xde65('0x3e'))){_0x3c470e[_0xde65('0x20')]=qs[_0xde65('0x20')](_0x2e8c58[_0xde65('0x37')][_0xde65('0x20')]);_0x3c470e[_0xde65('0x22')]=qs[_0xde65('0x22')](_0x2e8c58[_0xde65('0x37')][_0xde65('0x22')]);}_0x3c470e[_0xde65('0x3f')]=qs[_0xde65('0x40')](_0x2e8c58[_0xde65('0x37')][_0xde65('0x40')]);_0x3c470e[_0xde65('0x41')]=qs[_0xde65('0x38')](_['pick'](_0x2e8c58[_0xde65('0x37')],_0x8d0fc2['filters']),_0x56da16);if(_0x2e8c58[_0xde65('0x37')][_0xde65('0x42')]){_0x3c470e[_0xde65('0x41')]=_[_0xde65('0x43')](_0x3c470e[_0xde65('0x41')],{'$or':_[_0xde65('0x31')](_0x56da16,function(_0x1b934c){if(_0x1b934c[_0xde65('0x34')]!==_0xde65('0x44')){var _0x3a0db4={};_0x3a0db4[_0x1b934c[_0xde65('0x2f')]]={'$like':'%'+_0x2e8c58['query'][_0xde65('0x42')]+'%'};return _0x3a0db4;}})});}_0x3c470e=_[_0xde65('0x43')]({},_0x3c470e,_0x2e8c58[_0xde65('0x45')]);var _0x2ab463={'where':_0x3c470e[_0xde65('0x41')]};return db[_0xde65('0x46')][_0xde65('0x21')](_0x2ab463)[_0xde65('0x28')](function(_0x5b712a){_0x19cb6f['count']=_0x5b712a;if(_0x2e8c58[_0xde65('0x37')][_0xde65('0x47')]){_0x3c470e['include']=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x3c470e);})[_0xde65('0x28')](function(_0x352528){_0x19cb6f[_0xde65('0x48')]=_0x352528;return _0x19cb6f;})['then'](respondWithFilteredResult(_0x4c51c7,_0x3c470e))['catch'](handleError(_0x4c51c7,null));};exports[_0xde65('0x49')]=function(_0x5cd462,_0x4ad076){var _0x4f7963={'raw':!![],'where':{'id':_0x5cd462[_0xde65('0x4a')]['id']}},_0x8c647c={};_0x8c647c[_0xde65('0x36')]=_[_0xde65('0x4b')](db[_0xde65('0x46')][_0xde65('0x32')]);_0x8c647c[_0xde65('0x37')]=_[_0xde65('0x4b')](_0x5cd462['query']);_0x8c647c[_0xde65('0x38')]=_[_0xde65('0x39')](_0x8c647c[_0xde65('0x36')],_0x8c647c[_0xde65('0x37')]);_0x4f7963['attributes']=_[_0xde65('0x39')](_0x8c647c[_0xde65('0x36')],qs[_0xde65('0x3b')](_0x5cd462[_0xde65('0x37')]['fields']));_0x4f7963['attributes']=_0x4f7963[_0xde65('0x3a')][_0xde65('0x3c')]?_0x4f7963[_0xde65('0x3a')]:_0x8c647c[_0xde65('0x36')];if(_0x5cd462['query']['includeAll']){_0x4f7963[_0xde65('0x4c')]=[{'all':!![]}];}_0x4f7963=_[_0xde65('0x43')]({},_0x4f7963,_0x5cd462['options']);return db[_0xde65('0x46')][_0xde65('0x4d')](_0x4f7963)[_0xde65('0x28')](handleEntityNotFound(_0x4ad076,null))[_0xde65('0x28')](respondWithResult(_0x4ad076,null))[_0xde65('0x4e')](handleError(_0x4ad076,null));};exports['create']=function(_0x4bda17,_0x14fee4){return db[_0xde65('0x46')][_0xde65('0x4f')](_0x4bda17[_0xde65('0x50')],{})[_0xde65('0x28')](function(_0x4b78d1){var _0x4df534=_0x4bda17['user'][_0xde65('0x29')]({'plain':!![]});if(!_0x4df534)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4df534[_0xde65('0x51')]===_0xde65('0x52')){var _0x1c67c9=_0x4b78d1[_0xde65('0x29')]({'plain':!![]});var _0x225fe5=_0xde65('0x2a');return db[_0xde65('0x53')][_0xde65('0x4d')]({'where':{'name':_0x225fe5,'userProfileId':_0x4df534[_0xde65('0x54')]},'raw':!![]})[_0xde65('0x28')](function(_0x4a411f){if(_0x4a411f&&_0x4a411f[_0xde65('0x55')]===0x0){return db[_0xde65('0x2b')][_0xde65('0x4f')]({'name':_0x1c67c9[_0xde65('0x2f')],'resourceId':_0x1c67c9['id'],'type':_0x4a411f['name'],'sectionId':_0x4a411f['id']},{})[_0xde65('0x28')](function(){return _0x4b78d1;});}else{return _0x4b78d1;}})[_0xde65('0x4e')](function(_0x30ee73){logger[_0xde65('0x56')](_0xde65('0x57'),_0x30ee73);throw _0x30ee73;});}return _0x4b78d1;})[_0xde65('0x28')](respondWithResult(_0x14fee4,0xc9))[_0xde65('0x4e')](handleError(_0x14fee4,null));};exports[_0xde65('0x58')]=function(_0x113456,_0x513938){if(_0x113456['body']['id']){delete _0x113456[_0xde65('0x50')]['id'];}return db[_0xde65('0x46')][_0xde65('0x4d')]({'where':{'id':_0x113456[_0xde65('0x4a')]['id']}})['then'](handleEntityNotFound(_0x513938,null))['then'](saveUpdates(_0x113456[_0xde65('0x50')],null))['then'](respondWithResult(_0x513938,null))[_0xde65('0x4e')](handleError(_0x513938,null));};exports[_0xde65('0x2c')]=function(_0x2a929e,_0xbe2fe2){return db['CmContactHasItem'][_0xde65('0x4d')]({'where':{'id':_0x2a929e[_0xde65('0x4a')]['id']}})[_0xde65('0x28')](handleEntityNotFound(_0xbe2fe2,null))[_0xde65('0x28')](removeEntity(_0xbe2fe2,null))[_0xde65('0x4e')](handleError(_0xbe2fe2,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 83e569f..27d6d4b 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 _0x84e7=['./cmContactHasItem.attributes','exports','define','cm_contact_has_items','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x84e7,0x122));var _0x784e=function(_0x5b75fa,_0x1411e0){_0x5b75fa=_0x5b75fa-0x0;var _0x1f4ceb=_0x84e7[_0x5b75fa];return _0x1f4ceb;};'use strict';var _=require('lodash');var util=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('api');var moment=require(_0x784e('0x2'));var BPromise=require(_0x784e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x784e('0x4'));var rimraf=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var attributes=require(_0x784e('0x7'));module[_0x784e('0x8')]=function(_0x133296,_0x48ed22){return _0x133296[_0x784e('0x9')]('CmContactHasItem',attributes,{'tableName':_0x784e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5162=['bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0x215a42,_0x14340f){var _0x782a2f=function(_0x85e616){while(--_0x85e616){_0x215a42['push'](_0x215a42['shift']());}};_0x782a2f(++_0x14340f);}(_0x5162,0x103));var _0x2516=function(_0x4eda22,_0x3d2db4){_0x4eda22=_0x4eda22-0x0;var _0x4a5706=_0x5162[_0x4eda22];return _0x4a5706;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2516('0x1'));var rp=require(_0x2516('0x2'));var fs=require('fs');var path=require(_0x2516('0x3'));var rimraf=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var attributes=require(_0x2516('0x6'));module[_0x2516('0x7')]=function(_0x5b71b5,_0x48f411){return _0x5b71b5['define'](_0x2516('0x8'),attributes,{'tableName':_0x2516('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 3b5a787..0884204 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 _0xd9fe=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3855fd,_0x26003f){var _0x226a53=function(_0x14186f){while(--_0x14186f){_0x3855fd['push'](_0x3855fd['shift']());}};_0x226a53(++_0x26003f);}(_0xd9fe,0x1a0));var _0xed9f=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xd9fe[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xed9f('0x0'));var util=require(_0xed9f('0x1'));var moment=require(_0xed9f('0x2'));var BPromise=require(_0xed9f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed9f('0x4'));var db=require(_0xed9f('0x5'))['db'];var utils=require(_0xed9f('0x6'));var logger=require('../../config/logger')(_0xed9f('0x7'));var config=require(_0xed9f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xed9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1008d9,_0x4675d1,_0xb038a){return new BPromise(function(_0x4243f0,_0x80c7c8){return client[_0xed9f('0xa')](_0x1008d9,_0xb038a)[_0xed9f('0xb')](function(_0x56af06){logger[_0xed9f('0xc')](_0xed9f('0xd'),_0x4675d1,_0xed9f('0xe'));logger[_0xed9f('0xf')](_0xed9f('0x10'),_0x4675d1,_0xed9f('0xe'),JSON[_0xed9f('0x11')](_0x56af06));if(_0x56af06[_0xed9f('0x12')]){if(_0x56af06['error'][_0xed9f('0x13')]===0x1f4){logger['error'](_0xed9f('0xd'),_0x4675d1,_0x56af06[_0xed9f('0x12')][_0xed9f('0x14')]);return _0x80c7c8(_0x56af06[_0xed9f('0x12')][_0xed9f('0x14')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4675d1,_0x56af06[_0xed9f('0x12')][_0xed9f('0x14')]);return _0x4243f0(_0x56af06[_0xed9f('0x12')][_0xed9f('0x14')]);}else{logger[_0xed9f('0xc')](_0xed9f('0xd'),_0x4675d1,_0xed9f('0xe'));_0x4243f0(_0x56af06[_0xed9f('0x15')]['message']);}})[_0xed9f('0x16')](function(_0x49a9f7){logger[_0xed9f('0x12')](_0xed9f('0xd'),_0x4675d1,_0x49a9f7);_0x80c7c8(_0x49a9f7);});});} \ No newline at end of file +var _0xb465=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb465,0x9b));var _0x5b46=function(_0x24b2ec,_0x54598e){_0x24b2ec=_0x24b2ec-0x0;var _0x12a791=_0xb465[_0x24b2ec];return _0x12a791;};'use strict';var _=require(_0x5b46('0x0'));var util=require(_0x5b46('0x1'));var moment=require(_0x5b46('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b46('0x3'));var db=require(_0x5b46('0x4'))['db'];var utils=require(_0x5b46('0x5'));var logger=require(_0x5b46('0x6'))('rpc');var config=require(_0x5b46('0x7'));var jayson=require(_0x5b46('0x8'));var client=jayson[_0x5b46('0x9')][_0x5b46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b862c,_0x41840c,_0x15b406){return new BPromise(function(_0x35aca3,_0x16ae8b){return client[_0x5b46('0xb')](_0x4b862c,_0x15b406)[_0x5b46('0xc')](function(_0x103d21){logger[_0x5b46('0xd')](_0x5b46('0xe'),_0x41840c,_0x5b46('0xf'));logger[_0x5b46('0x10')](_0x5b46('0x11'),_0x41840c,_0x5b46('0xf'),JSON[_0x5b46('0x12')](_0x103d21));if(_0x103d21['error']){if(_0x103d21[_0x5b46('0x13')][_0x5b46('0x14')]===0x1f4){logger[_0x5b46('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x41840c,_0x103d21['error']['message']);return _0x16ae8b(_0x103d21['error'][_0x5b46('0x15')]);}logger[_0x5b46('0x13')](_0x5b46('0xe'),_0x41840c,_0x103d21[_0x5b46('0x13')][_0x5b46('0x15')]);return _0x35aca3(_0x103d21[_0x5b46('0x13')][_0x5b46('0x15')]);}else{logger[_0x5b46('0xd')](_0x5b46('0xe'),_0x41840c,'request\x20sent');_0x35aca3(_0x103d21[_0x5b46('0x16')]['message']);}})[_0x5b46('0x17')](function(_0x282d37){logger[_0x5b46('0x13')](_0x5b46('0xe'),_0x41840c,_0x282d37);_0x16ae8b(_0x282d37);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 82df04e..503486e 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 _0xa482=['destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0xb1b18f,_0x42791a){var _0x525b65=function(_0x3b32e3){while(--_0x3b32e3){_0xb1b18f['push'](_0xb1b18f['shift']());}};_0x525b65(++_0x42791a);}(_0xa482,0x1ca));var _0x2a48=function(_0x3b7030,_0x16271c){_0x3b7030=_0x3b7030-0x0;var _0x43d2ae=_0xa482[_0x3b7030];return _0x43d2ae;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2a48('0x0'));var timeout=require('connect-timeout');var express=require(_0x2a48('0x1'));var router=express['Router']();var fs_extra=require(_0x2a48('0x2'));var auth=require(_0x2a48('0x3'));var interaction=require(_0x2a48('0x4'));var config=require(_0x2a48('0x5'));var controller=require(_0x2a48('0x6'));router[_0x2a48('0x7')]('/',auth['isAuthenticated'](),controller[_0x2a48('0x8')]);router['get'](_0x2a48('0x9'),auth[_0x2a48('0xa')](),controller[_0x2a48('0xb')]);router[_0x2a48('0xc')]('/',auth[_0x2a48('0xa')](),controller[_0x2a48('0xd')]);router[_0x2a48('0xe')](_0x2a48('0x9'),auth[_0x2a48('0xa')](),controller[_0x2a48('0xf')]);router[_0x2a48('0x10')](_0x2a48('0x9'),auth[_0x2a48('0xa')](),controller[_0x2a48('0x11')]);module[_0x2a48('0x12')]=router; \ No newline at end of file +var _0x4124=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','post'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x4124,0x131));var _0x4412=function(_0x144055,_0x44aa48){_0x144055=_0x144055-0x0;var _0x37459c=_0x4124[_0x144055];return _0x37459c;};'use strict';var multer=require(_0x4412('0x0'));var util=require(_0x4412('0x1'));var path=require(_0x4412('0x2'));var timeout=require(_0x4412('0x3'));var express=require(_0x4412('0x4'));var router=express['Router']();var fs_extra=require(_0x4412('0x5'));var auth=require(_0x4412('0x6'));var interaction=require(_0x4412('0x7'));var config=require(_0x4412('0x8'));var controller=require(_0x4412('0x9'));router['get']('/',auth[_0x4412('0xa')](),controller[_0x4412('0xb')]);router[_0x4412('0xc')](_0x4412('0xd'),auth[_0x4412('0xa')](),controller['show']);router[_0x4412('0xe')]('/',auth[_0x4412('0xa')](),controller[_0x4412('0xf')]);router[_0x4412('0x10')](_0x4412('0xd'),auth['isAuthenticated'](),controller[_0x4412('0x11')]);router[_0x4412('0x12')](_0x4412('0xd'),auth[_0x4412('0xa')](),controller['destroy']);module[_0x4412('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 7764603..a99c9d2 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 _0xe132=['STRING','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','getDataValue','alias','setDataValue','name'];(function(_0x46905f,_0x36815b){var _0x50fec3=function(_0x364a8a){while(--_0x364a8a){_0x46905f['push'](_0x46905f['shift']());}};_0x50fec3(++_0x36815b);}(_0xe132,0x162));var _0x2e13=function(_0xd15d28,_0x4c8852){_0xd15d28=_0xd15d28-0x0;var _0x3098ff=_0xe132[_0xd15d28];return _0x3098ff;};'use strict';var Sequelize=require(_0x2e13('0x0'));var _=require('lodash');module[_0x2e13('0x1')]={'name':{'type':Sequelize[_0x2e13('0x2')],'get':function(_0x21dfef){return this[_0x2e13('0x3')](_0x2e13('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1ae6a9){this[_0x2e13('0x5')]('alias',_0x1ae6a9?_0x1ae6a9:this['getDataValue'](_0x2e13('0x6')));}},'type':{'type':Sequelize[_0x2e13('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x2e13('0x8')](_0x2e13('0x9')),'get':function(){if(this[_0x2e13('0x3')](_0x2e13('0xa'))===_0x2e13('0xb')){return JSON[_0x2e13('0xc')](this[_0x2e13('0x3')](_0x2e13('0xd')));}else{return this['getDataValue'](_0x2e13('0xd'));}},'set':function(_0x20fe3e){if(Array[_0x2e13('0xe')](_0x20fe3e)){this[_0x2e13('0x5')](_0x2e13('0xd'),JSON[_0x2e13('0xf')](_0x20fe3e));}else{this[_0x2e13('0x5')]('values',_0x20fe3e);}}},'required':{'type':Sequelize[_0x2e13('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x2e13('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x2e13('0x11')](_0x2e13('0x12'))}}; \ No newline at end of file +var _0xbd50=['voice','sequelize','lodash','exports','getDataValue','alias','STRING','name','TEXT','long','parse','values','setDataValue','BOOLEAN','ENUM'];(function(_0x583eac,_0xb14ae9){var _0x4e70d9=function(_0x4a1761){while(--_0x4a1761){_0x583eac['push'](_0x583eac['shift']());}};_0x4e70d9(++_0xb14ae9);}(_0xbd50,0x196));var _0x0bd5=function(_0x34f135,_0x192fea){_0x34f135=_0x34f135-0x0;var _0x195545=_0xbd50[_0x34f135];return _0x195545;};'use strict';var Sequelize=require(_0x0bd5('0x0'));var _=require(_0x0bd5('0x1'));module[_0x0bd5('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x44fcb9){return this[_0x0bd5('0x3')](_0x0bd5('0x4'));}},'alias':{'type':Sequelize[_0x0bd5('0x5')],'allowNull':![],'set':function(_0x15620d){this['setDataValue']('alias',_0x15620d?_0x15620d:this['getDataValue'](_0x0bd5('0x6')));}},'type':{'type':Sequelize[_0x0bd5('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x0bd5('0x7')](_0x0bd5('0x8')),'get':function(){if(this[_0x0bd5('0x3')]('type')==='select'){return JSON[_0x0bd5('0x9')](this[_0x0bd5('0x3')](_0x0bd5('0xa')));}else{return this['getDataValue'](_0x0bd5('0xa'));}},'set':function(_0x2fa7d1){if(Array['isArray'](_0x2fa7d1)){this[_0x0bd5('0xb')](_0x0bd5('0xa'),JSON['stringify'](_0x2fa7d1));}else{this[_0x0bd5('0xb')](_0x0bd5('0xa'),_0x2fa7d1);}}},'required':{'type':Sequelize[_0x0bd5('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0bd5('0xd')](_0x0bd5('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0db8792..37b7822 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 _0xd5bc=['defaultValue','sequelize','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','rows','catch','include','find','body','params','create','transaction','Sequelize','text','number','switch','BOOLEAN'];(function(_0x3a335c,_0x5d3fc7){var _0x22e891=function(_0x253361){while(--_0x253361){_0x3a335c['push'](_0x3a335c['shift']());}};_0x22e891(++_0x5d3fc7);}(_0xd5bc,0xab));var _0xcd5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd5bc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xcd5b('0x0'));var rimraf=require(_0xcd5b('0x1'));var zipdir=require(_0xcd5b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd5b('0x3'));var moment=require('moment');var BPromise=require(_0xcd5b('0x4'));var Mustache=require(_0xcd5b('0x5'));var util=require('util');var path=require(_0xcd5b('0x6'));var sox=require(_0xcd5b('0x7'));var csv=require(_0xcd5b('0x8'));var ejs=require(_0xcd5b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd5b('0xa'));var squel=require(_0xcd5b('0xb'));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(_0xcd5b('0xc'));var Redis=require(_0xcd5b('0xd'));var authService=require(_0xcd5b('0xe'));var qs=require(_0xcd5b('0xf'));var as=require(_0xcd5b('0x10'));var hardwareService=require(_0xcd5b('0x11'));var logger=require(_0xcd5b('0x12'))(_0xcd5b('0x13'));var utils=require(_0xcd5b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcd5b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44e963,_0x5c0281){_0x5c0281=_0x5c0281||0xcc;return function(_0x395233){if(_0x395233){return _0x44e963['sendStatus'](_0x5c0281);}return _0x44e963[_0xcd5b('0x16')](_0x5c0281)[_0xcd5b('0x17')]();};}function respondWithResult(_0x691b30,_0x53c12d){_0x53c12d=_0x53c12d||0xc8;return function(_0x52834a){if(_0x52834a){return _0x691b30[_0xcd5b('0x16')](_0x53c12d)[_0xcd5b('0x18')](_0x52834a);}};}function respondWithFilteredResult(_0x1cd416,_0x396228){return function(_0x4f5425){if(_0x4f5425){var _0x53df24=typeof _0x396228[_0xcd5b('0x19')]===_0xcd5b('0x1a')&&typeof _0x396228[_0xcd5b('0x1b')]===_0xcd5b('0x1a');var _0x5a792c=_0x4f5425[_0xcd5b('0x1c')];var _0x34a8e8=_0x53df24?0x0:_0x396228[_0xcd5b('0x19')];var _0x1880ed=_0x53df24?_0x4f5425[_0xcd5b('0x1c')]:_0x396228[_0xcd5b('0x19')]+_0x396228['limit'];var _0x3fc47d;if(_0x1880ed>=_0x5a792c){_0x1880ed=_0x5a792c;_0x3fc47d=0xc8;}else{_0x3fc47d=0xce;}_0x1cd416[_0xcd5b('0x16')](_0x3fc47d);return _0x1cd416[_0xcd5b('0x1d')](_0xcd5b('0x1e'),_0x34a8e8+'-'+_0x1880ed+'/'+_0x5a792c)[_0xcd5b('0x18')](_0x4f5425);}return null;};}function patchUpdates(_0x460315){return function(_0x5e38ec){try{jsonpatch[_0xcd5b('0x1f')](_0x5e38ec,_0x460315,!![]);}catch(_0x561d88){return BPromise['reject'](_0x561d88);}return _0x5e38ec['save']();};}function saveUpdates(_0x18814a,_0x5a9582){return function(_0x374d7d){if(_0x374d7d){return _0x374d7d[_0xcd5b('0x20')](_0x18814a)[_0xcd5b('0x21')](function(_0x3bfaf1){return _0x3bfaf1;});}return null;};}function removeEntity(_0xdf8f8c,_0xcc858){return function(_0x24ff4a){if(_0x24ff4a){return _0x24ff4a[_0xcd5b('0x22')]()['then'](function(){_0xdf8f8c[_0xcd5b('0x16')](0xcc)[_0xcd5b('0x17')]();});}};}function handleEntityNotFound(_0x7fcf9b,_0x28940e){return function(_0x1fe89c){if(!_0x1fe89c){_0x7fcf9b[_0xcd5b('0x23')](0x194);}return _0x1fe89c;};}function handleError(_0x3dab9f,_0x2ae17b){_0x2ae17b=_0x2ae17b||0x1f4;return function(_0x1f52f3){logger[_0xcd5b('0x24')](_0x1f52f3[_0xcd5b('0x25')]);if(_0x1f52f3[_0xcd5b('0x26')]){delete _0x1f52f3[_0xcd5b('0x26')];}_0x3dab9f['status'](_0x2ae17b)[_0xcd5b('0x27')](_0x1f52f3);};}exports['index']=function(_0x12aabc,_0x2238d0){var _0x13d736={},_0x198b2d={},_0xf9a561={'count':0x0,'rows':[]};var _0x3daa16=_[_0xcd5b('0x28')](db[_0xcd5b('0x29')][_0xcd5b('0x2a')],function(_0x33aa46){return{'name':_0x33aa46[_0xcd5b('0x2b')],'type':_0x33aa46[_0xcd5b('0x2c')][_0xcd5b('0x2d')]};});_0x198b2d[_0xcd5b('0x2e')]=_[_0xcd5b('0x2f')](_[_0xcd5b('0x28')](_0x3daa16,_0xcd5b('0x26')),[_0xcd5b('0x26')]);_0x198b2d['query']=_[_0xcd5b('0x30')](_0x12aabc[_0xcd5b('0x31')]);_0x198b2d['filters']=_[_0xcd5b('0x32')](_0x198b2d[_0xcd5b('0x2e')],_0x198b2d[_0xcd5b('0x31')]);_0x13d736[_0xcd5b('0x33')]=_[_0xcd5b('0x32')](_0x198b2d[_0xcd5b('0x2e')],qs[_0xcd5b('0x34')](_0x12aabc['query'][_0xcd5b('0x34')]));_0x13d736['attributes']=_0x13d736[_0xcd5b('0x33')]['length']?_0x13d736[_0xcd5b('0x33')]:_0x198b2d[_0xcd5b('0x2e')];if(!_0x12aabc['query'][_0xcd5b('0x35')](_0xcd5b('0x36'))){_0x13d736[_0xcd5b('0x1b')]=qs[_0xcd5b('0x1b')](_0x12aabc[_0xcd5b('0x31')][_0xcd5b('0x1b')]);_0x13d736[_0xcd5b('0x19')]=qs[_0xcd5b('0x19')](_0x12aabc[_0xcd5b('0x31')][_0xcd5b('0x19')]);}_0x13d736[_0xcd5b('0x37')]=qs[_0xcd5b('0x38')](_0x12aabc[_0xcd5b('0x31')][_0xcd5b('0x38')]);_0x13d736[_0xcd5b('0x39')]=qs['filters'](_[_0xcd5b('0x3a')](_0x12aabc[_0xcd5b('0x31')],_0x198b2d[_0xcd5b('0x3b')]),_0x3daa16);if(_0x12aabc[_0xcd5b('0x31')]['filter']){_0x13d736[_0xcd5b('0x39')]=_[_0xcd5b('0x3c')](_0x13d736[_0xcd5b('0x39')],{'$or':_[_0xcd5b('0x28')](_0x3daa16,function(_0x40705c){if(_0x40705c['type']!==_0xcd5b('0x3d')){var _0x1aff05={};_0x1aff05[_0x40705c[_0xcd5b('0x26')]]={'$like':'%'+_0x12aabc[_0xcd5b('0x31')][_0xcd5b('0x3e')]+'%'};return _0x1aff05;}})});}_0x13d736=_[_0xcd5b('0x3c')]({},_0x13d736,_0x12aabc[_0xcd5b('0x3f')]);var _0xb1d04={'where':_0x13d736['where']};return db['CmCustomField'][_0xcd5b('0x1c')](_0xb1d04)[_0xcd5b('0x21')](function(_0x9e7396){_0xf9a561['count']=_0x9e7396;if(_0x12aabc[_0xcd5b('0x31')][_0xcd5b('0x40')]){_0x13d736['include']=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x13d736);})[_0xcd5b('0x21')](function(_0x208b68){_0xf9a561[_0xcd5b('0x41')]=_0x208b68;return _0xf9a561;})[_0xcd5b('0x21')](respondWithFilteredResult(_0x2238d0,_0x13d736))[_0xcd5b('0x42')](handleError(_0x2238d0,null));};exports['show']=function(_0x48ed10,_0x3121b8){var _0x1bbc8c={'raw':!![],'where':{'id':_0x48ed10['params']['id']}},_0x878082={};_0x878082[_0xcd5b('0x2e')]=_[_0xcd5b('0x30')](db[_0xcd5b('0x29')][_0xcd5b('0x2a')]);_0x878082[_0xcd5b('0x31')]=_[_0xcd5b('0x30')](_0x48ed10[_0xcd5b('0x31')]);_0x878082['filters']=_[_0xcd5b('0x32')](_0x878082['model'],_0x878082[_0xcd5b('0x31')]);_0x1bbc8c[_0xcd5b('0x33')]=_[_0xcd5b('0x32')](_0x878082['model'],qs[_0xcd5b('0x34')](_0x48ed10['query'][_0xcd5b('0x34')]));_0x1bbc8c[_0xcd5b('0x33')]=_0x1bbc8c[_0xcd5b('0x33')]['length']?_0x1bbc8c['attributes']:_0x878082[_0xcd5b('0x2e')];if(_0x48ed10[_0xcd5b('0x31')]['includeAll']){_0x1bbc8c[_0xcd5b('0x43')]=[{'all':!![]}];}_0x1bbc8c=_[_0xcd5b('0x3c')]({},_0x1bbc8c,_0x48ed10[_0xcd5b('0x3f')]);return db['CmCustomField'][_0xcd5b('0x44')](_0x1bbc8c)['then'](handleEntityNotFound(_0x3121b8,null))[_0xcd5b('0x21')](respondWithResult(_0x3121b8,null))['catch'](handleError(_0x3121b8,null));};exports['update']=function(_0x241578,_0x52b5e5){if(_0x241578[_0xcd5b('0x45')]['id']){delete _0x241578[_0xcd5b('0x45')]['id'];}return db[_0xcd5b('0x29')][_0xcd5b('0x44')]({'where':{'id':_0x241578[_0xcd5b('0x46')]['id']}})[_0xcd5b('0x21')](handleEntityNotFound(_0x52b5e5,null))[_0xcd5b('0x21')](saveUpdates(_0x241578[_0xcd5b('0x45')],null))[_0xcd5b('0x21')](respondWithResult(_0x52b5e5,null))[_0xcd5b('0x42')](handleError(_0x52b5e5,null));};exports['destroy']=function(_0x423cb0,_0xe41fc6){return db['CmCustomField']['find']({'where':{'id':_0x423cb0['params']['id']}})[_0xcd5b('0x21')](handleEntityNotFound(_0xe41fc6,null))[_0xcd5b('0x21')](removeEntity(_0xe41fc6,null))['catch'](handleError(_0xe41fc6,null));};exports[_0xcd5b('0x47')]=function(_0x559ed2,_0x1392fd){var _0x205e4d;return db['sequelize'][_0xcd5b('0x48')](function(_0x186cad){return db[_0xcd5b('0x29')][_0xcd5b('0x47')](_0x559ed2[_0xcd5b('0x45')],{'transaction':_0x186cad})[_0xcd5b('0x21')](function(_0x5b3951){_0x205e4d=_0x5b3951;var _0x5509e4={'type':db[_0xcd5b('0x49')]['TEXT'],'transaction':_0x186cad};switch(_0x559ed2[_0xcd5b('0x45')][_0xcd5b('0x2c')]){case _0xcd5b('0x4a'):_0x5509e4[_0xcd5b('0x2c')]=db['Sequelize']['TEXT'];break;case _0xcd5b('0x4b'):_0x5509e4['type']=db['Sequelize']['INTEGER'];break;case _0xcd5b('0x4c'):_0x5509e4[_0xcd5b('0x2c')]=db[_0xcd5b('0x49')][_0xcd5b('0x4d')];_0x5509e4[_0xcd5b('0x4e')]=![];break;default:}return db[_0xcd5b('0x4f')]['queryInterface']['addColumn'](_0xcd5b('0x50'),util[_0xcd5b('0x51')](_0xcd5b('0x52'),_0x205e4d['id']),_0x5509e4);})[_0xcd5b('0x21')](function(){return _0x205e4d;});})[_0xcd5b('0x21')](respondWithResult(_0x1392fd,0xc9))['catch'](handleError(_0x1392fd,null));}; \ No newline at end of file +var _0xf3ee=['filters','pick','merge','VIRTUAL','filter','options','where','CmCustomField','includeAll','findAll','show','params','include','find','catch','destroy','sequelize','create','body','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort'];(function(_0x689936,_0x12b55b){var _0x21ec42=function(_0x3f2770){while(--_0x3f2770){_0x689936['push'](_0x689936['shift']());}};_0x21ec42(++_0x12b55b);}(_0xf3ee,0x188));var _0xef3e=function(_0x3fbf5b,_0x289ccb){_0x3fbf5b=_0x3fbf5b-0x0;var _0x4ff44e=_0xf3ee[_0x3fbf5b];return _0x4ff44e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xef3e('0x0'));var jsonpatch=require(_0xef3e('0x1'));var rp=require(_0xef3e('0x2'));var moment=require(_0xef3e('0x3'));var BPromise=require(_0xef3e('0x4'));var Mustache=require(_0xef3e('0x5'));var util=require(_0xef3e('0x6'));var path=require(_0xef3e('0x7'));var sox=require(_0xef3e('0x8'));var csv=require(_0xef3e('0x9'));var ejs=require(_0xef3e('0xa'));var fs=require('fs');var fs_extra=require(_0xef3e('0xb'));var _=require(_0xef3e('0xc'));var squel=require(_0xef3e('0xd'));var crypto=require('crypto');var jsforce=require(_0xef3e('0xe'));var deskjs=require(_0xef3e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xef3e('0x10'));var Papa=require(_0xef3e('0x11'));var Redis=require(_0xef3e('0x12'));var authService=require(_0xef3e('0x13'));var qs=require(_0xef3e('0x14'));var as=require(_0xef3e('0x15'));var hardwareService=require(_0xef3e('0x16'));var logger=require('../../config/logger')(_0xef3e('0x17'));var utils=require(_0xef3e('0x18'));var config=require(_0xef3e('0x19'));var licenseUtil=require(_0xef3e('0x1a'));var db=require(_0xef3e('0x1b'))['db'];function respondWithStatusCode(_0x5de11a,_0x2fe3a2){_0x2fe3a2=_0x2fe3a2||0xcc;return function(_0x14164a){if(_0x14164a){return _0x5de11a[_0xef3e('0x1c')](_0x2fe3a2);}return _0x5de11a[_0xef3e('0x1d')](_0x2fe3a2)[_0xef3e('0x1e')]();};}function respondWithResult(_0x521c00,_0x561a92){_0x561a92=_0x561a92||0xc8;return function(_0x423afe){if(_0x423afe){return _0x521c00[_0xef3e('0x1d')](_0x561a92)[_0xef3e('0x1f')](_0x423afe);}};}function respondWithFilteredResult(_0x46799b,_0x46c966){return function(_0x5292d9){if(_0x5292d9){var _0x541b7e=typeof _0x46c966[_0xef3e('0x20')]==='undefined'&&typeof _0x46c966['limit']===_0xef3e('0x21');var _0x2b363a=_0x5292d9[_0xef3e('0x22')];var _0x2a1ec6=_0x541b7e?0x0:_0x46c966[_0xef3e('0x20')];var _0x4fac7d=_0x541b7e?_0x5292d9['count']:_0x46c966[_0xef3e('0x20')]+_0x46c966['limit'];var _0x2274f9;if(_0x4fac7d>=_0x2b363a){_0x4fac7d=_0x2b363a;_0x2274f9=0xc8;}else{_0x2274f9=0xce;}_0x46799b[_0xef3e('0x1d')](_0x2274f9);return _0x46799b[_0xef3e('0x23')]('Content-Range',_0x2a1ec6+'-'+_0x4fac7d+'/'+_0x2b363a)[_0xef3e('0x1f')](_0x5292d9);}return null;};}function patchUpdates(_0x2e9c72){return function(_0x1073be){try{jsonpatch[_0xef3e('0x24')](_0x1073be,_0x2e9c72,!![]);}catch(_0x5d704d){return BPromise[_0xef3e('0x25')](_0x5d704d);}return _0x1073be[_0xef3e('0x26')]();};}function saveUpdates(_0x4ee276,_0x548ac6){return function(_0x440def){if(_0x440def){return _0x440def[_0xef3e('0x27')](_0x4ee276)[_0xef3e('0x28')](function(_0x55ecb1){return _0x55ecb1;});}return null;};}function removeEntity(_0x44a622,_0x52c260){return function(_0xbc70e){if(_0xbc70e){return _0xbc70e['destroy']()['then'](function(){_0x44a622['status'](0xcc)[_0xef3e('0x1e')]();});}};}function handleEntityNotFound(_0x54c102,_0x15dcbd){return function(_0x5e3802){if(!_0x5e3802){_0x54c102['sendStatus'](0x194);}return _0x5e3802;};}function handleError(_0x6b3053,_0x153b28){_0x153b28=_0x153b28||0x1f4;return function(_0x4e40d7){logger[_0xef3e('0x29')](_0x4e40d7[_0xef3e('0x2a')]);if(_0x4e40d7[_0xef3e('0x2b')]){delete _0x4e40d7[_0xef3e('0x2b')];}_0x6b3053['status'](_0x153b28)[_0xef3e('0x2c')](_0x4e40d7);};}exports[_0xef3e('0x2d')]=function(_0x41d547,_0x130814){var _0x5aeb60={},_0x3affbe={},_0x478561={'count':0x0,'rows':[]};var _0x4ea3f5=_['map'](db['CmCustomField'][_0xef3e('0x2e')],function(_0x315d03){return{'name':_0x315d03[_0xef3e('0x2f')],'type':_0x315d03[_0xef3e('0x30')][_0xef3e('0x31')]};});_0x3affbe[_0xef3e('0x32')]=_[_0xef3e('0x33')](_[_0xef3e('0x34')](_0x4ea3f5,_0xef3e('0x2b')),[_0xef3e('0x2b')]);_0x3affbe[_0xef3e('0x35')]=_[_0xef3e('0x36')](_0x41d547['query']);_0x3affbe['filters']=_[_0xef3e('0x37')](_0x3affbe[_0xef3e('0x32')],_0x3affbe['query']);_0x5aeb60[_0xef3e('0x38')]=_[_0xef3e('0x37')](_0x3affbe[_0xef3e('0x32')],qs[_0xef3e('0x39')](_0x41d547['query'][_0xef3e('0x39')]));_0x5aeb60['attributes']=_0x5aeb60[_0xef3e('0x38')][_0xef3e('0x3a')]?_0x5aeb60[_0xef3e('0x38')]:_0x3affbe[_0xef3e('0x32')];if(!_0x41d547[_0xef3e('0x35')][_0xef3e('0x3b')]('nolimit')){_0x5aeb60[_0xef3e('0x3c')]=qs[_0xef3e('0x3c')](_0x41d547['query'][_0xef3e('0x3c')]);_0x5aeb60['offset']=qs[_0xef3e('0x20')](_0x41d547['query'][_0xef3e('0x20')]);}_0x5aeb60[_0xef3e('0x3d')]=qs['sort'](_0x41d547['query'][_0xef3e('0x3e')]);_0x5aeb60['where']=qs[_0xef3e('0x3f')](_[_0xef3e('0x40')](_0x41d547[_0xef3e('0x35')],_0x3affbe['filters']),_0x4ea3f5);if(_0x41d547[_0xef3e('0x35')]['filter']){_0x5aeb60['where']=_[_0xef3e('0x41')](_0x5aeb60['where'],{'$or':_[_0xef3e('0x34')](_0x4ea3f5,function(_0x5978d9){if(_0x5978d9[_0xef3e('0x30')]!==_0xef3e('0x42')){var _0x201493={};_0x201493[_0x5978d9['name']]={'$like':'%'+_0x41d547[_0xef3e('0x35')][_0xef3e('0x43')]+'%'};return _0x201493;}})});}_0x5aeb60=_[_0xef3e('0x41')]({},_0x5aeb60,_0x41d547[_0xef3e('0x44')]);var _0x3d4d9a={'where':_0x5aeb60[_0xef3e('0x45')]};return db[_0xef3e('0x46')][_0xef3e('0x22')](_0x3d4d9a)['then'](function(_0x526c34){_0x478561[_0xef3e('0x22')]=_0x526c34;if(_0x41d547[_0xef3e('0x35')][_0xef3e('0x47')]){_0x5aeb60['include']=[{'all':!![]}];}return db[_0xef3e('0x46')][_0xef3e('0x48')](_0x5aeb60);})['then'](function(_0x5998f0){_0x478561['rows']=_0x5998f0;return _0x478561;})[_0xef3e('0x28')](respondWithFilteredResult(_0x130814,_0x5aeb60))['catch'](handleError(_0x130814,null));};exports[_0xef3e('0x49')]=function(_0x15e18e,_0x4eb8dd){var _0xdada6a={'raw':!![],'where':{'id':_0x15e18e[_0xef3e('0x4a')]['id']}},_0x2f2210={};_0x2f2210['model']=_[_0xef3e('0x36')](db[_0xef3e('0x46')][_0xef3e('0x2e')]);_0x2f2210[_0xef3e('0x35')]=_[_0xef3e('0x36')](_0x15e18e['query']);_0x2f2210[_0xef3e('0x3f')]=_[_0xef3e('0x37')](_0x2f2210[_0xef3e('0x32')],_0x2f2210[_0xef3e('0x35')]);_0xdada6a['attributes']=_['intersection'](_0x2f2210[_0xef3e('0x32')],qs[_0xef3e('0x39')](_0x15e18e['query'][_0xef3e('0x39')]));_0xdada6a[_0xef3e('0x38')]=_0xdada6a[_0xef3e('0x38')][_0xef3e('0x3a')]?_0xdada6a[_0xef3e('0x38')]:_0x2f2210['model'];if(_0x15e18e[_0xef3e('0x35')][_0xef3e('0x47')]){_0xdada6a[_0xef3e('0x4b')]=[{'all':!![]}];}_0xdada6a=_[_0xef3e('0x41')]({},_0xdada6a,_0x15e18e[_0xef3e('0x44')]);return db[_0xef3e('0x46')][_0xef3e('0x4c')](_0xdada6a)['then'](handleEntityNotFound(_0x4eb8dd,null))[_0xef3e('0x28')](respondWithResult(_0x4eb8dd,null))['catch'](handleError(_0x4eb8dd,null));};exports[_0xef3e('0x27')]=function(_0xbd0b6b,_0x5395ef){if(_0xbd0b6b['body']['id']){delete _0xbd0b6b['body']['id'];}return db['CmCustomField'][_0xef3e('0x4c')]({'where':{'id':_0xbd0b6b[_0xef3e('0x4a')]['id']}})[_0xef3e('0x28')](handleEntityNotFound(_0x5395ef,null))['then'](saveUpdates(_0xbd0b6b['body'],null))['then'](respondWithResult(_0x5395ef,null))[_0xef3e('0x4d')](handleError(_0x5395ef,null));};exports[_0xef3e('0x4e')]=function(_0x57c9e2,_0x4480a9){return db[_0xef3e('0x46')][_0xef3e('0x4c')]({'where':{'id':_0x57c9e2[_0xef3e('0x4a')]['id']}})[_0xef3e('0x28')](handleEntityNotFound(_0x4480a9,null))['then'](removeEntity(_0x4480a9,null))[_0xef3e('0x4d')](handleError(_0x4480a9,null));};exports['create']=function(_0x5b3671,_0x471df2){var _0x41273d;return db[_0xef3e('0x4f')]['transaction'](function(_0x3c2e59){return db[_0xef3e('0x46')][_0xef3e('0x50')](_0x5b3671[_0xef3e('0x51')],{'transaction':_0x3c2e59})[_0xef3e('0x28')](function(_0x1f2c2c){_0x41273d=_0x1f2c2c;var _0x2ed2f6={'type':db[_0xef3e('0x52')]['TEXT'],'transaction':_0x3c2e59};switch(_0x5b3671[_0xef3e('0x51')][_0xef3e('0x30')]){case'text':_0x2ed2f6[_0xef3e('0x30')]=db[_0xef3e('0x52')][_0xef3e('0x53')];break;case _0xef3e('0x54'):_0x2ed2f6[_0xef3e('0x30')]=db[_0xef3e('0x52')][_0xef3e('0x55')];break;case _0xef3e('0x56'):_0x2ed2f6['type']=db[_0xef3e('0x52')][_0xef3e('0x57')];_0x2ed2f6[_0xef3e('0x58')]=![];break;default:}return db['sequelize']['queryInterface'][_0xef3e('0x59')]('cm_contacts',util[_0xef3e('0x5a')]('cf_%d',_0x41273d['id']),_0x2ed2f6);})[_0xef3e('0x28')](function(){return _0x41273d;});})[_0xef3e('0x28')](respondWithResult(_0x471df2,0xc9))[_0xef3e('0x4d')](handleError(_0x471df2,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index fdddba4..c27affc 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 _0x6560=['path','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x44fc3f,_0x4774d1){var _0x926ba3=function(_0x2af2a9){while(--_0x2af2a9){_0x44fc3f['push'](_0x44fc3f['shift']());}};_0x926ba3(++_0x4774d1);}(_0x6560,0x7c));var _0x0656=function(_0x3d9ef7,_0x5dc09e){_0x3d9ef7=_0x3d9ef7-0x0;var _0x477065=_0x6560[_0x3d9ef7];return _0x477065;};'use strict';var _=require(_0x0656('0x0'));var util=require('util');var logger=require(_0x0656('0x1'))(_0x0656('0x2'));var moment=require(_0x0656('0x3'));var BPromise=require(_0x0656('0x4'));var rp=require(_0x0656('0x5'));var fs=require('fs');var path=require(_0x0656('0x6'));var rimraf=require(_0x0656('0x7'));var config=require(_0x0656('0x8'));var attributes=require(_0x0656('0x9'));module['exports']=function(_0x3bc1df,_0xe15966){return _0x3bc1df[_0x0656('0xa')](_0x0656('0xb'),attributes,{'tableName':_0x0656('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31cc=['api','request-promise','path','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x31cc,0x10b));var _0xc31c=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x31cc[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0xc31c('0x0'));var util=require(_0xc31c('0x1'));var logger=require(_0xc31c('0x2'))(_0xc31c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc31c('0x4'));var fs=require('fs');var path=require(_0xc31c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0xc31c('0x6')]=function(_0x35687b,_0x490e69){return _0x35687b[_0xc31c('0x7')](_0xc31c('0x8'),attributes,{'tableName':_0xc31c('0x9'),'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 fdeb5da..00adae0 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 _0xc3b5=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x42b949,_0x5ef2cd){var _0x1bd737=function(_0x5d9af2){while(--_0x5d9af2){_0x42b949['push'](_0x42b949['shift']());}};_0x1bd737(++_0x5ef2cd);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x5b8913,_0x867b1){_0x5b8913=_0x5b8913-0x0;var _0x5a16b8=_0xc3b5[_0x5b8913];return _0x5a16b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5c3b('0x0'));var BPromise=require(_0x5c3b('0x1'));var rs=require(_0x5c3b('0x2'));var fs=require('fs');var Redis=require(_0x5c3b('0x3'));var db=require(_0x5c3b('0x4'))['db'];var utils=require(_0x5c3b('0x5'));var logger=require(_0x5c3b('0x6'))(_0x5c3b('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c3b('0x8'));var client=jayson[_0x5c3b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568a28,_0x30a08f,_0x420839){return new BPromise(function(_0x3892ad,_0x5be9ee){return client[_0x5c3b('0xa')](_0x568a28,_0x420839)[_0x5c3b('0xb')](function(_0x159db5){logger[_0x5c3b('0xc')]('CmCustomField,\x20%s,\x20%s',_0x30a08f,_0x5c3b('0xd'));logger[_0x5c3b('0xe')](_0x5c3b('0xf'),_0x30a08f,_0x5c3b('0xd'),JSON[_0x5c3b('0x10')](_0x159db5));if(_0x159db5['error']){if(_0x159db5[_0x5c3b('0x11')][_0x5c3b('0x12')]===0x1f4){logger['error'](_0x5c3b('0x13'),_0x30a08f,_0x159db5[_0x5c3b('0x11')]['message']);return _0x5be9ee(_0x159db5[_0x5c3b('0x11')][_0x5c3b('0x14')]);}logger[_0x5c3b('0x11')](_0x5c3b('0x13'),_0x30a08f,_0x159db5[_0x5c3b('0x11')][_0x5c3b('0x14')]);return _0x3892ad(_0x159db5[_0x5c3b('0x11')]['message']);}else{logger[_0x5c3b('0xc')]('CmCustomField,\x20%s,\x20%s',_0x30a08f,'request\x20sent');_0x3892ad(_0x159db5[_0x5c3b('0x15')][_0x5c3b('0x14')]);}})[_0x5c3b('0x16')](function(_0x589797){logger[_0x5c3b('0x11')](_0x5c3b('0x13'),_0x30a08f,_0x589797);_0x5be9ee(_0x589797);});});} \ No newline at end of file +var _0x5178=['request','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x5178,0x171));var _0x8517=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5178[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x8517('0x0'));var moment=require(_0x8517('0x1'));var BPromise=require(_0x8517('0x2'));var rs=require(_0x8517('0x3'));var fs=require('fs');var Redis=require(_0x8517('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8517('0x5'))(_0x8517('0x6'));var config=require('../../config/environment');var jayson=require(_0x8517('0x7'));var client=jayson['client'][_0x8517('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45498e,_0x3615b2,_0x10f918){return new BPromise(function(_0x25146d,_0x49739b){return client[_0x8517('0x9')](_0x45498e,_0x10f918)['then'](function(_0x485677){logger[_0x8517('0xa')](_0x8517('0xb'),_0x3615b2,'request\x20sent');logger[_0x8517('0xc')](_0x8517('0xd'),_0x3615b2,_0x8517('0xe'),JSON[_0x8517('0xf')](_0x485677));if(_0x485677[_0x8517('0x10')]){if(_0x485677[_0x8517('0x10')][_0x8517('0x11')]===0x1f4){logger[_0x8517('0x10')]('CmCustomField,\x20%s,\x20%s',_0x3615b2,_0x485677[_0x8517('0x10')][_0x8517('0x12')]);return _0x49739b(_0x485677[_0x8517('0x10')][_0x8517('0x12')]);}logger[_0x8517('0x10')]('CmCustomField,\x20%s,\x20%s',_0x3615b2,_0x485677[_0x8517('0x10')][_0x8517('0x12')]);return _0x25146d(_0x485677[_0x8517('0x10')][_0x8517('0x12')]);}else{logger[_0x8517('0xa')](_0x8517('0xb'),_0x3615b2,_0x8517('0xe'));_0x25146d(_0x485677[_0x8517('0x13')][_0x8517('0x12')]);}})[_0x8517('0x14')](function(_0x22b687){logger[_0x8517('0x10')]('CmCustomField,\x20%s,\x20%s',_0x3615b2,_0x22b687);_0x49739b(_0x22b687);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index c856a64..7762c94 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 _0x5666=['Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x37907d,_0x2ba626){var _0x2ba7d5=function(_0x5c73f1){while(--_0x5c73f1){_0x37907d['push'](_0x37907d['shift']());}};_0x2ba7d5(++_0x2ba626);}(_0x5666,0x10c));var _0x6566=function(_0x9531d5,_0x32496d){_0x9531d5=_0x9531d5-0x0;var _0x98e321=_0x5666[_0x9531d5];return _0x98e321;};'use strict';var multer=require('multer');var util=require(_0x6566('0x0'));var path=require(_0x6566('0x1'));var timeout=require(_0x6566('0x2'));var express=require(_0x6566('0x3'));var router=express[_0x6566('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6566('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6566('0x6'));var controller=require(_0x6566('0x7'));router[_0x6566('0x8')]('/',auth[_0x6566('0x9')](),controller['index']);router[_0x6566('0x8')](_0x6566('0xa'),auth[_0x6566('0x9')](),controller['show']);router[_0x6566('0xb')]('/',auth[_0x6566('0x9')](),controller[_0x6566('0xc')]);router[_0x6566('0xd')](_0x6566('0xa'),auth[_0x6566('0x9')](),controller['update']);router[_0x6566('0xe')](_0x6566('0xa'),auth[_0x6566('0x9')](),controller[_0x6566('0xf')]);module[_0x6566('0x10')]=router; \ No newline at end of file +var _0xe1f4=['./cmCustomField.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x5e687f,_0x2a2ac8){var _0x169773=function(_0x34fa3d){while(--_0x34fa3d){_0x5e687f['push'](_0x5e687f['shift']());}};_0x169773(++_0x2a2ac8);}(_0xe1f4,0x15d));var _0x4e1f=function(_0x36bcd8,_0x387fbe){_0x36bcd8=_0x36bcd8-0x0;var _0x509a40=_0xe1f4[_0x36bcd8];return _0x509a40;};'use strict';var multer=require(_0x4e1f('0x0'));var util=require(_0x4e1f('0x1'));var path=require(_0x4e1f('0x2'));var timeout=require(_0x4e1f('0x3'));var express=require(_0x4e1f('0x4'));var router=express[_0x4e1f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4e1f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4e1f('0x7'));var controller=require(_0x4e1f('0x8'));router[_0x4e1f('0x9')]('/',auth[_0x4e1f('0xa')](),controller['index']);router[_0x4e1f('0x9')](_0x4e1f('0xb'),auth[_0x4e1f('0xa')](),controller['show']);router[_0x4e1f('0xc')]('/',auth[_0x4e1f('0xa')](),controller[_0x4e1f('0xd')]);router[_0x4e1f('0xe')](_0x4e1f('0xb'),auth['isAuthenticated'](),controller[_0x4e1f('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4e1f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index fbef6af..29b4d2f 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 _0xbaf0=['contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE','format','INTEGER','UNSIGNED'];(function(_0x4018ae,_0x4480bf){var _0x4f5095=function(_0x26d6aa){while(--_0x26d6aa){_0x4018ae['push'](_0x4018ae['shift']());}};_0x4f5095(++_0x4480bf);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var moment=require('moment');var Sequelize=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'phone':{'type':Sequelize[_0x0baf('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x0baf('0x4')],'defaultValue':moment()[_0x0baf('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0baf('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0baf('0x4')]},'priority':{'type':Sequelize[_0x0baf('0x6')](0x2)[_0x0baf('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x0baf('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x0baf('0x8')},'UserId':{'type':Sequelize[_0x0baf('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x0baf('0x6')],'unique':_0x0baf('0x8')},'CampaignId':{'type':Sequelize[_0x0baf('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0baf('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x0baf('0x6')],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file +var _0x153f=['BOOLEAN','DATE','format','INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x153f,0x15b));var _0xf153=function(_0x40f1c1,_0x5bd171){_0x40f1c1=_0x40f1c1-0x0;var _0x556aff=_0x153f[_0x40f1c1];return _0x556aff;};'use strict';var moment=require(_0xf153('0x0'));var Sequelize=require(_0xf153('0x1'));module[_0xf153('0x2')]={'phone':{'type':Sequelize[_0xf153('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xf153('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf153('0x5')],'defaultValue':moment()[_0xf153('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xf153('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf153('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf153('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf153('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf153('0x5')]},'priority':{'type':Sequelize[_0xf153('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf153('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf153('0x7')],'unique':_0xf153('0x8')},'ListId':{'type':Sequelize[_0xf153('0x7')],'unique':_0xf153('0x8')},'UserId':{'type':Sequelize[_0xf153('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xf153('0x7')],'unique':_0xf153('0x8')},'CampaignId':{'type':Sequelize[_0xf153('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xf153('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf153('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf153('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf153('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 40512ec..7bcf331 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 _0xadd0=['List','VoiceQueue','Queue','dialActive','getOpenContacts','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','status','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$iLike','$notILike','$like','$overlap','$contained','$any','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','length','find','body','describe','VoiceQueueId','CampaignId','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','firstName','lastName','isNil','calleridname','CmHopperFinal','create','CmHopperAdditionalPhone','getPreview','outbound','preview','transaction','format','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','dialOrderByScheduledAt','findOne','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList'];(function(_0x26a21a,_0x40972c){var _0x6cd87b=function(_0x1bdb16){while(--_0x1bdb16){_0x26a21a['push'](_0x26a21a['shift']());}};_0x6cd87b(++_0x40972c);}(_0xadd0,0x1e0));var _0x0add=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xadd0[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x0add('0x0'));var rimraf=require(_0x0add('0x1'));var zipdir=require(_0x0add('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0add('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0add('0x4'));var util=require(_0x0add('0x5'));var path=require(_0x0add('0x6'));var sox=require(_0x0add('0x7'));var csv=require(_0x0add('0x8'));var ejs=require(_0x0add('0x9'));var fs=require('fs');var fs_extra=require(_0x0add('0xa'));var _=require(_0x0add('0xb'));var squel=require(_0x0add('0xc'));var crypto=require(_0x0add('0xd'));var jsforce=require(_0x0add('0xe'));var deskjs=require(_0x0add('0xf'));var toCsv=require(_0x0add('0x8'));var querystring=require(_0x0add('0x10'));var Papa=require(_0x0add('0x11'));var Redis=require(_0x0add('0x12'));var authService=require(_0x0add('0x13'));var qs=require(_0x0add('0x14'));var as=require(_0x0add('0x15'));var hardwareService=require(_0x0add('0x16'));var logger=require(_0x0add('0x17'))(_0x0add('0x18'));var utils=require(_0x0add('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x0add('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd2ed25,_0x6b9871){_0x6b9871=_0x6b9871||0xcc;return function(_0x34798d){if(_0x34798d){return _0xd2ed25['sendStatus'](_0x6b9871);}return _0xd2ed25['status'](_0x6b9871)[_0x0add('0x1b')]();};}function respondWithResult(_0x587450,_0x778f47){_0x778f47=_0x778f47||0xc8;return function(_0x3ce617){if(_0x3ce617){return _0x587450[_0x0add('0x1c')](_0x778f47)['json'](_0x3ce617);}};}function respondWithFilteredResult(_0x5b7cc1,_0x45f20f){return function(_0x465813){if(_0x465813){var _0x144baa=typeof _0x45f20f[_0x0add('0x1d')]===_0x0add('0x1e')&&typeof _0x45f20f['limit']===_0x0add('0x1e');var _0x1ed2c1=_0x465813[_0x0add('0x1f')];var _0x4133a7=_0x144baa?0x0:_0x45f20f[_0x0add('0x1d')];var _0x56b226=_0x144baa?_0x465813['count']:_0x45f20f[_0x0add('0x1d')]+_0x45f20f['limit'];var _0xdaf4ad;if(_0x56b226>=_0x1ed2c1){_0x56b226=_0x1ed2c1;_0xdaf4ad=0xc8;}else{_0xdaf4ad=0xce;}_0x5b7cc1[_0x0add('0x1c')](_0xdaf4ad);return _0x5b7cc1[_0x0add('0x20')](_0x0add('0x21'),_0x4133a7+'-'+_0x56b226+'/'+_0x1ed2c1)['json'](_0x465813);}return null;};}function patchUpdates(_0x1b1e41){return function(_0x565e76){try{jsonpatch[_0x0add('0x22')](_0x565e76,_0x1b1e41,!![]);}catch(_0x49dac8){return BPromise[_0x0add('0x23')](_0x49dac8);}return _0x565e76[_0x0add('0x24')]();};}function saveUpdates(_0x5772e9,_0x5f125a){return function(_0x245b4){if(_0x245b4){return _0x245b4[_0x0add('0x25')](_0x5772e9)[_0x0add('0x26')](function(_0x5c8c22){return _0x5c8c22;});}return null;};}function removeEntity(_0x3ca9c2,_0x21baf2){return function(_0x374e09){if(_0x374e09){return _0x374e09[_0x0add('0x27')]()[_0x0add('0x26')](function(){_0x3ca9c2[_0x0add('0x1c')](0xcc)[_0x0add('0x1b')]();});}};}function handleEntityNotFound(_0x198438,_0x13a295){return function(_0x1ac623){if(!_0x1ac623){_0x198438[_0x0add('0x28')](0x194);}return _0x1ac623;};}function handleError(_0x63df5b,_0x38f1b3){_0x38f1b3=_0x38f1b3||0x1f4;return function(_0xe3d222){logger[_0x0add('0x29')](_0xe3d222[_0x0add('0x2a')]);if(_0xe3d222[_0x0add('0x2b')]){delete _0xe3d222[_0x0add('0x2b')];}_0x63df5b[_0x0add('0x1c')](_0x38f1b3)[_0x0add('0x2c')](_0xe3d222);};}exports[_0x0add('0x2d')]=function(_0x3da73b,_0x23781e){var _0x7cd888={},_0x240bb0={},_0x13f728={'count':0x0,'rows':[]};var _0x19b0af=_[_0x0add('0x2e')](db[_0x0add('0x2f')][_0x0add('0x30')],function(_0x43eaf4){return{'name':_0x43eaf4[_0x0add('0x31')],'type':_0x43eaf4[_0x0add('0x32')][_0x0add('0x33')]};});_0x240bb0[_0x0add('0x34')]=_[_0x0add('0x2e')](_0x19b0af,_0x0add('0x2b'));_0x240bb0[_0x0add('0x35')]=_[_0x0add('0x36')](_0x3da73b[_0x0add('0x35')]);_0x240bb0[_0x0add('0x37')]=_[_0x0add('0x38')](_0x240bb0[_0x0add('0x34')],_0x240bb0[_0x0add('0x35')]);_0x240bb0['filters']=_[_0x0add('0x39')](_0x240bb0['filters'],[_0x0add('0x3a'),_0x0add('0x3b'),_0x0add('0x3c'),_0x0add('0x3d'),'$lt',_0x0add('0x3e'),_0x0add('0x3f'),_0x0add('0x40'),_0x0add('0x41'),_0x0add('0x42'),_0x0add('0x43'),'$in',_0x0add('0x44'),'$like','$notLike',_0x0add('0x45'),_0x0add('0x46'),_0x0add('0x47'),_0x0add('0x48'),'$contains',_0x0add('0x49'),_0x0add('0x4a')]);_0x7cd888[_0x0add('0x4b')]=_['intersection'](_0x240bb0[_0x0add('0x34')],qs[_0x0add('0x4c')](_0x3da73b[_0x0add('0x35')][_0x0add('0x4c')]));_0x7cd888[_0x0add('0x4b')]=_0x7cd888['attributes']['length']?_0x7cd888[_0x0add('0x4b')]:_0x240bb0[_0x0add('0x34')];if(!_0x3da73b[_0x0add('0x35')][_0x0add('0x4d')](_0x0add('0x4e'))){_0x7cd888[_0x0add('0x4f')]=qs['limit'](_0x3da73b['query'][_0x0add('0x4f')]);_0x7cd888['offset']=qs[_0x0add('0x1d')](_0x3da73b[_0x0add('0x35')][_0x0add('0x1d')]);}_0x7cd888[_0x0add('0x50')]=qs[_0x0add('0x51')](_0x3da73b[_0x0add('0x35')][_0x0add('0x51')]);_0x7cd888['where']=qs[_0x0add('0x37')](_[_0x0add('0x52')](_0x3da73b[_0x0add('0x35')],_0x240bb0[_0x0add('0x37')]),_0x19b0af);if(_0x3da73b[_0x0add('0x35')]['filter']){_0x7cd888[_0x0add('0x53')]=_[_0x0add('0x54')](_0x7cd888[_0x0add('0x53')],{'$or':_[_0x0add('0x2e')](_0x19b0af,function(_0x5a61ff){if(_0x5a61ff[_0x0add('0x32')]!==_0x0add('0x55')){var _0x4171ef={};_0x4171ef[_0x5a61ff[_0x0add('0x2b')]]={'$like':'%'+_0x3da73b['query'][_0x0add('0x56')]+'%'};return _0x4171ef;}})});}_0x7cd888=_[_0x0add('0x54')]({},_0x7cd888,_0x3da73b[_0x0add('0x57')]);var _0x42ed65={'where':_0x7cd888[_0x0add('0x53')]};return db[_0x0add('0x2f')][_0x0add('0x1f')](_0x42ed65)[_0x0add('0x26')](function(_0x49e109){_0x13f728[_0x0add('0x1f')]=_0x49e109;if(_0x3da73b[_0x0add('0x35')][_0x0add('0x58')]){_0x7cd888[_0x0add('0x59')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x7cd888);})['then'](function(_0x8712b7){_0x13f728[_0x0add('0x5a')]=_0x8712b7;return _0x13f728;})[_0x0add('0x26')](respondWithFilteredResult(_0x23781e,_0x7cd888))[_0x0add('0x5b')](handleError(_0x23781e,null));};exports['show']=function(_0x548226,_0x8bc92d){var _0x51990c={'raw':!![],'where':{'id':_0x548226[_0x0add('0x5c')]['id']}},_0x3c4aa8={};_0x3c4aa8[_0x0add('0x34')]=_['keys'](db[_0x0add('0x2f')][_0x0add('0x30')]);_0x3c4aa8['query']=_[_0x0add('0x36')](_0x548226[_0x0add('0x35')]);_0x3c4aa8['filters']=_['intersection'](_0x3c4aa8['model'],_0x3c4aa8[_0x0add('0x35')]);_0x51990c[_0x0add('0x4b')]=_[_0x0add('0x38')](_0x3c4aa8[_0x0add('0x34')],qs[_0x0add('0x4c')](_0x548226[_0x0add('0x35')]['fields']));_0x51990c[_0x0add('0x4b')]=_0x51990c['attributes'][_0x0add('0x5d')]?_0x51990c['attributes']:_0x3c4aa8[_0x0add('0x34')];if(_0x548226['query'][_0x0add('0x58')]){_0x51990c['include']=[{'all':!![]}];}_0x51990c=_[_0x0add('0x54')]({},_0x51990c,_0x548226[_0x0add('0x57')]);return db[_0x0add('0x2f')][_0x0add('0x5e')](_0x51990c)[_0x0add('0x26')](handleEntityNotFound(_0x8bc92d,null))[_0x0add('0x26')](respondWithResult(_0x8bc92d,null))[_0x0add('0x5b')](handleError(_0x8bc92d,null));};exports['create']=function(_0x205331,_0x28a1f6){return db[_0x0add('0x2f')]['create'](_0x205331['body'],{})[_0x0add('0x26')](respondWithResult(_0x28a1f6,0xc9))[_0x0add('0x5b')](handleError(_0x28a1f6,null));};exports[_0x0add('0x25')]=function(_0x4647e3,_0x56389e){if(_0x4647e3['body']['id']){delete _0x4647e3[_0x0add('0x5f')]['id'];}return db[_0x0add('0x2f')][_0x0add('0x5e')]({'where':{'id':_0x4647e3[_0x0add('0x5c')]['id']}})[_0x0add('0x26')](handleEntityNotFound(_0x56389e,null))[_0x0add('0x26')](saveUpdates(_0x4647e3[_0x0add('0x5f')],null))[_0x0add('0x26')](respondWithResult(_0x56389e,null))[_0x0add('0x5b')](handleError(_0x56389e,null));};exports[_0x0add('0x60')]=function(_0x5c458f,_0x5cac57){return db[_0x0add('0x2f')][_0x0add('0x60')]()[_0x0add('0x26')](respondWithResult(_0x5cac57,null))[_0x0add('0x5b')](handleError(_0x5cac57,null));};exports[_0x0add('0x27')]=function(_0x119177,_0x251878){var _0x27d6e3;var _0x12c77a=_0x119177[_0x0add('0x5c')]['id'];return db[_0x0add('0x2f')]['find']({'where':{'id':_0x119177['params']['id']}})[_0x0add('0x26')](handleEntityNotFound(_0x251878,null))[_0x0add('0x26')](function(_0x265c57){if(_0x265c57){return _0x265c57[_0x0add('0x27')]()[_0x0add('0x26')](function(_0x1ceb6a){return _0x1ceb6a;});}})[_0x0add('0x26')](function(_0x4f4da3){_0x27d6e3=_0x4f4da3;if(_0x4f4da3){if(_0x4f4da3[_0x0add('0x61')]||_0x4f4da3[_0x0add('0x62')]){return db[_0x4f4da3[_0x0add('0x61')]?'VoiceQueue':_0x0add('0x63')][_0x0add('0x5e')]({'where':{'id':_0x4f4da3['VoiceQueueId']?_0x4f4da3[_0x0add('0x61')]:_0x4f4da3[_0x0add('0x62')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x281233){var _0x2f1148={};if(_0x281233){_[_0x0add('0x54')](_0x2f1148,_['omit'](_0x27d6e3[_0x0add('0x64')],[_0x0add('0x65'),_0x0add('0x66'),'id']));_0x2f1148[_0x0add('0x67')]=0x15;_0x2f1148[_0x0add('0x68')]=_0x0add('0x69');_0x2f1148[_0x0add('0x6a')]=_0x281233[_0x0add('0x2b')];_0x2f1148[_0x0add('0x6b')]=_0x119177[_0x0add('0x6c')][_0x0add('0x2b')];_0x2f1148[_0x0add('0x6d')]=_0x119177[_0x0add('0x6c')]['id'];_0x2f1148[_0x0add('0x69')]=!![];_0x2f1148[_0x0add('0x6e')]=moment()['format'](_0x0add('0x6f'));_0x2f1148[_0x0add('0x70')]=_0x27d6e3[_0x0add('0x71')];_0x2f1148[_0x0add('0x72')]=_0x27d6e3[_0x0add('0x61')]?'queue':_0x0add('0x73');return db[_0x0add('0x74')][_0x0add('0x5e')]({'where':{'id':_0x2f1148['ContactId']},'attributes':[_0x0add('0x75'),_0x0add('0x76')]})[_0x0add('0x26')](function(_0x9bd57){if(!_[_0x0add('0x77')](_0x251878)&&!_['isNil'](_0x9bd57[_0x0add('0x75')])){_0x2f1148[_0x0add('0x78')]=_0x9bd57[_0x0add('0x75')];if(!_[_0x0add('0x77')](_0x9bd57[_0x0add('0x76')])){_0x2f1148[_0x0add('0x78')]+='\x20'+_0x9bd57[_0x0add('0x76')];}}})['finally'](function(){return db[_0x0add('0x79')][_0x0add('0x7a')](_0x2f1148);});}})[_0x0add('0x26')](function(_0x2a3ba1){return db[_0x0add('0x7b')][_0x0add('0x27')]({'where':{'CmHopperId':_0x12c77a}});})[_0x0add('0x26')](function(){return _0x251878[_0x0add('0x1c')](0xcc)['end']();})['catch'](handleError(_0x251878,null));};exports[_0x0add('0x7c')]=function(_0x504b2d,_0x350e40,_0x362bfc){var _0x53868b=[];return db['CmContact'][_0x0add('0x60')]()[_0x0add('0x26')](function(_0x2e489a){_0x53868b=_[_0x0add('0x36')](_0x2e489a);return _0x504b2d[_0x0add('0x6c')]['getVoiceQueues']({'where':{'type':_0x0add('0x7d'),'dialActive':!![],'dialMethod':_0x0add('0x7e')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x0add('0x26')](function(_0x595952){if(_0x595952&&_0x595952['length']){return db['sequelize'][_0x0add('0x7f')](function(_0x59bb31){var _0x303186={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0add('0x80')](_0x0add('0x6f'))},'VoiceQueueId':{'$in':_['map'](_0x595952,'id')},'$or':[{'UserId':null},{'UserId':_0x504b2d[_0x0add('0x6c')]['id']}]};var _0x1412ef=[];if(_0x504b2d[_0x0add('0x5f')][_0x0add('0x81')]&&_0x504b2d['body'][_0x0add('0x81')]===_0x0add('0x82')){if(!_[_0x0add('0x83')](_0x504b2d['body']['hopperIds'])){_0x303186['id']={'$in':_0x504b2d['body'][_0x0add('0x84')]};}_0x1412ef=[[_0x0add('0x85'),_0x0add('0x86')],[_0x0add('0x87'),_0x595952[0x0]['dialOrderByScheduledAt']===_0x0add('0x86')?_0x0add('0x88'):'ASC'],db[_0x0add('0x89')][_0x0add('0x8a')](_0x0add('0x8b')),['id',_0x0add('0x88')]];}else{if(!_[_0x0add('0x83')](_0x504b2d[_0x0add('0x5f')][_0x0add('0x84')])){_0x303186['id']={'$notIn':_0x504b2d[_0x0add('0x5f')]['hopperIds']};}_0x1412ef=[[_0x0add('0x85'),_0x0add('0x88')],['scheduledAt',_0x595952[0x0][_0x0add('0x8c')]],db[_0x0add('0x89')][_0x0add('0x8a')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0x0add('0x2f')][_0x0add('0x8d')]({'attributes':['id',_0x0add('0x8e'),'phone'],'where':_0x303186,'order':_0x1412ef,'transaction':_0x59bb31,'lock':_0x59bb31[_0x0add('0x8f')][_0x0add('0x90')],'include':[{'model':db[_0x0add('0x74')],'as':'Contact','attributes':_0x53868b,'include':[{'model':db[_0x0add('0x91')],'as':_0x0add('0x92'),'attributes':['id','name']}]},{'model':db[_0x0add('0x93')],'as':_0x0add('0x94'),'attributes':['id',_0x0add('0x2b')]},{'model':db[_0x0add('0x95')],'as':_0x0add('0x96'),'attributes':['id',_0x0add('0x2b'),_0x0add('0x97')]}]})['then'](function(_0x2f3c14){if(_0x2f3c14){return _0x2f3c14[_0x0add('0x25')]({'UserId':_0x504b2d['user']['id']},{'transaction':_0x59bb31});}});});}})[_0x0add('0x26')](handleEntityNotFound(_0x350e40,null))['then'](respondWithResult(_0x350e40,null))['catch'](handleError(_0x350e40,null));};exports[_0x0add('0x98')]=function(_0x2aa383,_0x1be35b,_0x29b792){return _0x2aa383[_0x0add('0x6c')]['getVoiceQueues']({'where':{'type':_0x0add('0x7d'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x0add('0x26')](function(_0xdecc7c){if(_0xdecc7c&&_0xdecc7c['length']){return db[_0x0add('0x2f')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0add('0x80')](_0x0add('0x6f'))},'VoiceQueueId':{'$in':_[_0x0add('0x2e')](_0xdecc7c,'id')},'$or':[{'UserId':null},{'UserId':_0x2aa383[_0x0add('0x6c')]['id']}]}});}return 0x0;})[_0x0add('0x26')](function(_0x299180){if(!_[_0x0add('0x77')](_0x299180)&&_[_0x0add('0x99')](_0x299180)){return _0x1be35b[_0x0add('0x1c')](0xc8)[_0x0add('0x9a')]({'contacts':_0x299180});}else{logger[_0x0add('0x29')](_0x0add('0x9b'),_0x0add('0x98'),0x194,_0x0add('0x9c'));_0x1be35b[_0x0add('0x28')](0x194);}})['catch'](handleError(_0x1be35b,null));}; \ No newline at end of file +var _0x8d02=['outbound','preview','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','index','map','CmHopper','fieldName','type','query','keys','filters','intersection','model','$and','$or','$gt','$lte','$ne','$not','$between','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','calleridname','isNil','lastName','finally','create','CmHopperAdditionalPhone','getPreview','getVoiceQueues'];(function(_0x5519c7,_0x2641d2){var _0x2b8842=function(_0x2721c6){while(--_0x2721c6){_0x5519c7['push'](_0x5519c7['shift']());}};_0x2b8842(++_0x2641d2);}(_0x8d02,0x134));var _0x28d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8d02[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x28d0('0x0'));var rimraf=require(_0x28d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28d0('0x2'));var rp=require(_0x28d0('0x3'));var moment=require(_0x28d0('0x4'));var BPromise=require(_0x28d0('0x5'));var Mustache=require(_0x28d0('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x28d0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28d0('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x28d0('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x28d0('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x28d0('0xb'));var qs=require(_0x28d0('0xc'));var as=require(_0x28d0('0xd'));var hardwareService=require(_0x28d0('0xe'));var logger=require('../../config/logger')(_0x28d0('0xf'));var utils=require(_0x28d0('0x10'));var config=require(_0x28d0('0x11'));var licenseUtil=require(_0x28d0('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2aa7ac,_0x3601be){_0x3601be=_0x3601be||0xcc;return function(_0x3f298b){if(_0x3f298b){return _0x2aa7ac[_0x28d0('0x13')](_0x3601be);}return _0x2aa7ac[_0x28d0('0x14')](_0x3601be)[_0x28d0('0x15')]();};}function respondWithResult(_0x33922f,_0x5a47f7){_0x5a47f7=_0x5a47f7||0xc8;return function(_0x2d08c5){if(_0x2d08c5){return _0x33922f[_0x28d0('0x14')](_0x5a47f7)[_0x28d0('0x16')](_0x2d08c5);}};}function respondWithFilteredResult(_0x29532a,_0x59c02f){return function(_0x53360d){if(_0x53360d){var _0x121527=typeof _0x59c02f[_0x28d0('0x17')]===_0x28d0('0x18')&&typeof _0x59c02f[_0x28d0('0x19')]==='undefined';var _0x49ab7a=_0x53360d[_0x28d0('0x1a')];var _0x3ac280=_0x121527?0x0:_0x59c02f[_0x28d0('0x17')];var _0xde75b3=_0x121527?_0x53360d[_0x28d0('0x1a')]:_0x59c02f[_0x28d0('0x17')]+_0x59c02f[_0x28d0('0x19')];var _0x2e8c2a;if(_0xde75b3>=_0x49ab7a){_0xde75b3=_0x49ab7a;_0x2e8c2a=0xc8;}else{_0x2e8c2a=0xce;}_0x29532a[_0x28d0('0x14')](_0x2e8c2a);return _0x29532a[_0x28d0('0x1b')](_0x28d0('0x1c'),_0x3ac280+'-'+_0xde75b3+'/'+_0x49ab7a)['json'](_0x53360d);}return null;};}function patchUpdates(_0x2b4093){return function(_0x28682c){try{jsonpatch[_0x28d0('0x1d')](_0x28682c,_0x2b4093,!![]);}catch(_0x34b811){return BPromise[_0x28d0('0x1e')](_0x34b811);}return _0x28682c[_0x28d0('0x1f')]();};}function saveUpdates(_0x582bb4,_0xc9df32){return function(_0xb71140){if(_0xb71140){return _0xb71140[_0x28d0('0x20')](_0x582bb4)[_0x28d0('0x21')](function(_0x27f489){return _0x27f489;});}return null;};}function removeEntity(_0x490800,_0x3e08ae){return function(_0xa9f2c6){if(_0xa9f2c6){return _0xa9f2c6['destroy']()[_0x28d0('0x21')](function(){_0x490800[_0x28d0('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e71d3,_0x5a41ad){return function(_0x545a06){if(!_0x545a06){_0x3e71d3[_0x28d0('0x13')](0x194);}return _0x545a06;};}function handleError(_0x2f510d,_0xa89aa4){_0xa89aa4=_0xa89aa4||0x1f4;return function(_0x431278){logger[_0x28d0('0x22')](_0x431278['stack']);if(_0x431278[_0x28d0('0x23')]){delete _0x431278['name'];}_0x2f510d[_0x28d0('0x14')](_0xa89aa4)['send'](_0x431278);};}exports[_0x28d0('0x24')]=function(_0xbbfd44,_0x48e4bc){var _0x2e9792={},_0x35a250={},_0x44f50b={'count':0x0,'rows':[]};var _0x19b8ba=_[_0x28d0('0x25')](db[_0x28d0('0x26')]['rawAttributes'],function(_0x45b0d8){return{'name':_0x45b0d8[_0x28d0('0x27')],'type':_0x45b0d8[_0x28d0('0x28')]['key']};});_0x35a250['model']=_[_0x28d0('0x25')](_0x19b8ba,'name');_0x35a250[_0x28d0('0x29')]=_[_0x28d0('0x2a')](_0xbbfd44[_0x28d0('0x29')]);_0x35a250[_0x28d0('0x2b')]=_[_0x28d0('0x2c')](_0x35a250[_0x28d0('0x2d')],_0x35a250['query']);_0x35a250[_0x28d0('0x2b')]=_['concat'](_0x35a250[_0x28d0('0x2b')],[_0x28d0('0x2e'),_0x28d0('0x2f'),_0x28d0('0x30'),'$gte','$lt',_0x28d0('0x31'),_0x28d0('0x32'),'$eq',_0x28d0('0x33'),_0x28d0('0x34'),'$notBetween','$in',_0x28d0('0x35'),_0x28d0('0x36'),_0x28d0('0x37'),_0x28d0('0x38'),_0x28d0('0x39'),_0x28d0('0x36'),'$overlap',_0x28d0('0x3a'),_0x28d0('0x3b'),_0x28d0('0x3c')]);_0x2e9792[_0x28d0('0x3d')]=_[_0x28d0('0x2c')](_0x35a250[_0x28d0('0x2d')],qs['fields'](_0xbbfd44[_0x28d0('0x29')]['fields']));_0x2e9792['attributes']=_0x2e9792['attributes'][_0x28d0('0x3e')]?_0x2e9792[_0x28d0('0x3d')]:_0x35a250[_0x28d0('0x2d')];if(!_0xbbfd44[_0x28d0('0x29')]['hasOwnProperty']('nolimit')){_0x2e9792[_0x28d0('0x19')]=qs[_0x28d0('0x19')](_0xbbfd44['query'][_0x28d0('0x19')]);_0x2e9792['offset']=qs[_0x28d0('0x17')](_0xbbfd44[_0x28d0('0x29')][_0x28d0('0x17')]);}_0x2e9792[_0x28d0('0x3f')]=qs['sort'](_0xbbfd44['query'][_0x28d0('0x40')]);_0x2e9792[_0x28d0('0x41')]=qs[_0x28d0('0x2b')](_[_0x28d0('0x42')](_0xbbfd44[_0x28d0('0x29')],_0x35a250[_0x28d0('0x2b')]),_0x19b8ba);if(_0xbbfd44[_0x28d0('0x29')][_0x28d0('0x43')]){_0x2e9792[_0x28d0('0x41')]=_[_0x28d0('0x44')](_0x2e9792['where'],{'$or':_[_0x28d0('0x25')](_0x19b8ba,function(_0x2721b9){if(_0x2721b9['type']!==_0x28d0('0x45')){var _0x20bae8={};_0x20bae8[_0x2721b9[_0x28d0('0x23')]]={'$like':'%'+_0xbbfd44[_0x28d0('0x29')][_0x28d0('0x43')]+'%'};return _0x20bae8;}})});}_0x2e9792=_[_0x28d0('0x44')]({},_0x2e9792,_0xbbfd44[_0x28d0('0x46')]);var _0x297531={'where':_0x2e9792[_0x28d0('0x41')]};return db[_0x28d0('0x26')]['count'](_0x297531)[_0x28d0('0x21')](function(_0x252a0a){_0x44f50b[_0x28d0('0x1a')]=_0x252a0a;if(_0xbbfd44[_0x28d0('0x29')][_0x28d0('0x47')]){_0x2e9792[_0x28d0('0x48')]=[{'all':!![]}];}return db[_0x28d0('0x26')][_0x28d0('0x49')](_0x2e9792);})[_0x28d0('0x21')](function(_0x396d03){_0x44f50b[_0x28d0('0x4a')]=_0x396d03;return _0x44f50b;})['then'](respondWithFilteredResult(_0x48e4bc,_0x2e9792))[_0x28d0('0x4b')](handleError(_0x48e4bc,null));};exports[_0x28d0('0x4c')]=function(_0x10f061,_0x1abc31){var _0x4e1cf3={'raw':!![],'where':{'id':_0x10f061[_0x28d0('0x4d')]['id']}},_0x57c587={};_0x57c587['model']=_[_0x28d0('0x2a')](db[_0x28d0('0x26')]['rawAttributes']);_0x57c587[_0x28d0('0x29')]=_[_0x28d0('0x2a')](_0x10f061[_0x28d0('0x29')]);_0x57c587[_0x28d0('0x2b')]=_[_0x28d0('0x2c')](_0x57c587[_0x28d0('0x2d')],_0x57c587[_0x28d0('0x29')]);_0x4e1cf3[_0x28d0('0x3d')]=_[_0x28d0('0x2c')](_0x57c587[_0x28d0('0x2d')],qs[_0x28d0('0x4e')](_0x10f061[_0x28d0('0x29')]['fields']));_0x4e1cf3['attributes']=_0x4e1cf3[_0x28d0('0x3d')][_0x28d0('0x3e')]?_0x4e1cf3[_0x28d0('0x3d')]:_0x57c587['model'];if(_0x10f061['query'][_0x28d0('0x47')]){_0x4e1cf3[_0x28d0('0x48')]=[{'all':!![]}];}_0x4e1cf3=_[_0x28d0('0x44')]({},_0x4e1cf3,_0x10f061['options']);return db[_0x28d0('0x26')][_0x28d0('0x4f')](_0x4e1cf3)['then'](handleEntityNotFound(_0x1abc31,null))[_0x28d0('0x21')](respondWithResult(_0x1abc31,null))[_0x28d0('0x4b')](handleError(_0x1abc31,null));};exports['create']=function(_0x5de86f,_0x38d362){return db[_0x28d0('0x26')]['create'](_0x5de86f[_0x28d0('0x50')],{})['then'](respondWithResult(_0x38d362,0xc9))[_0x28d0('0x4b')](handleError(_0x38d362,null));};exports[_0x28d0('0x20')]=function(_0x1c187f,_0x577f49){if(_0x1c187f['body']['id']){delete _0x1c187f[_0x28d0('0x50')]['id'];}return db[_0x28d0('0x26')]['find']({'where':{'id':_0x1c187f[_0x28d0('0x4d')]['id']}})[_0x28d0('0x21')](handleEntityNotFound(_0x577f49,null))[_0x28d0('0x21')](saveUpdates(_0x1c187f[_0x28d0('0x50')],null))[_0x28d0('0x21')](respondWithResult(_0x577f49,null))[_0x28d0('0x4b')](handleError(_0x577f49,null));};exports[_0x28d0('0x51')]=function(_0x344bca,_0x5260d4){return db[_0x28d0('0x26')][_0x28d0('0x51')]()[_0x28d0('0x21')](respondWithResult(_0x5260d4,null))[_0x28d0('0x4b')](handleError(_0x5260d4,null));};exports[_0x28d0('0x52')]=function(_0x2c664e,_0xead2b7){var _0x4efb06;var _0x36d744=_0x2c664e[_0x28d0('0x4d')]['id'];return db[_0x28d0('0x26')][_0x28d0('0x4f')]({'where':{'id':_0x2c664e[_0x28d0('0x4d')]['id']}})[_0x28d0('0x21')](handleEntityNotFound(_0xead2b7,null))[_0x28d0('0x21')](function(_0x264308){if(_0x264308){return _0x264308[_0x28d0('0x52')]()[_0x28d0('0x21')](function(_0x4ef8a7){return _0x4ef8a7;});}})['then'](function(_0x333371){_0x4efb06=_0x333371;if(_0x333371){if(_0x333371[_0x28d0('0x53')]||_0x333371[_0x28d0('0x54')]){return db[_0x333371['VoiceQueueId']?_0x28d0('0x55'):'Campaign'][_0x28d0('0x4f')]({'where':{'id':_0x333371[_0x28d0('0x53')]?_0x333371['VoiceQueueId']:_0x333371['CampaignId']},'attributes':['id',_0x28d0('0x23')],'raw':!![]});}}})[_0x28d0('0x21')](function(_0x372b24){var _0x3e6493={};if(_0x372b24){_[_0x28d0('0x44')](_0x3e6493,_[_0x28d0('0x56')](_0x4efb06[_0x28d0('0x57')],[_0x28d0('0x58'),_0x28d0('0x59'),'id']));_0x3e6493[_0x28d0('0x5a')]=0x15;_0x3e6493[_0x28d0('0x5b')]=_0x28d0('0x5c');_0x3e6493[_0x28d0('0x5d')]=_0x372b24[_0x28d0('0x23')];_0x3e6493[_0x28d0('0x5e')]=_0x2c664e[_0x28d0('0x5f')][_0x28d0('0x23')];_0x3e6493['UserId']=_0x2c664e[_0x28d0('0x5f')]['id'];_0x3e6493['deleted']=!![];_0x3e6493[_0x28d0('0x60')]=moment()[_0x28d0('0x61')](_0x28d0('0x62'));_0x3e6493[_0x28d0('0x63')]=_0x4efb06[_0x28d0('0x64')];_0x3e6493[_0x28d0('0x65')]=_0x4efb06[_0x28d0('0x53')]?_0x28d0('0x66'):_0x28d0('0x67');return db[_0x28d0('0x68')][_0x28d0('0x4f')]({'where':{'id':_0x3e6493[_0x28d0('0x69')]},'attributes':[_0x28d0('0x6a'),'lastName']})[_0x28d0('0x21')](function(_0x46a26f){if(!_['isNil'](_0xead2b7)&&!_['isNil'](_0x46a26f[_0x28d0('0x6a')])){_0x3e6493[_0x28d0('0x6b')]=_0x46a26f[_0x28d0('0x6a')];if(!_[_0x28d0('0x6c')](_0x46a26f['lastName'])){_0x3e6493[_0x28d0('0x6b')]+='\x20'+_0x46a26f[_0x28d0('0x6d')];}}})[_0x28d0('0x6e')](function(){return db['CmHopperFinal'][_0x28d0('0x6f')](_0x3e6493);});}})[_0x28d0('0x21')](function(_0x440baf){return db[_0x28d0('0x70')][_0x28d0('0x52')]({'where':{'CmHopperId':_0x36d744}});})[_0x28d0('0x21')](function(){return _0xead2b7[_0x28d0('0x14')](0xcc)[_0x28d0('0x15')]();})[_0x28d0('0x4b')](handleError(_0xead2b7,null));};exports[_0x28d0('0x71')]=function(_0x22c1c5,_0x10cd78,_0x553281){var _0x158986=[];return db['CmContact'][_0x28d0('0x51')]()['then'](function(_0x37f21d){_0x158986=_['keys'](_0x37f21d);return _0x22c1c5[_0x28d0('0x5f')][_0x28d0('0x72')]({'where':{'type':_0x28d0('0x73'),'dialActive':!![],'dialMethod':_0x28d0('0x74')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x5290c1){if(_0x5290c1&&_0x5290c1[_0x28d0('0x3e')]){return db[_0x28d0('0x75')][_0x28d0('0x76')](function(_0x378c1e){var _0x14d492={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x28d0('0x61')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x28d0('0x25')](_0x5290c1,'id')},'$or':[{'UserId':null},{'UserId':_0x22c1c5[_0x28d0('0x5f')]['id']}]};var _0x30c907=[];if(_0x22c1c5[_0x28d0('0x50')][_0x28d0('0x77')]&&_0x22c1c5['body'][_0x28d0('0x77')]===_0x28d0('0x78')){if(!_[_0x28d0('0x79')](_0x22c1c5['body'][_0x28d0('0x7a')])){_0x14d492['id']={'$in':_0x22c1c5[_0x28d0('0x50')][_0x28d0('0x7a')]};}_0x30c907=[[_0x28d0('0x7b'),_0x28d0('0x7c')],[_0x28d0('0x7d'),_0x5290c1[0x0][_0x28d0('0x7e')]==='ASC'?_0x28d0('0x7f'):_0x28d0('0x7c')],db[_0x28d0('0x75')][_0x28d0('0x80')](_0x28d0('0x81')),['id',_0x28d0('0x7f')]];}else{if(!_['isEmpty'](_0x22c1c5[_0x28d0('0x50')][_0x28d0('0x7a')])){_0x14d492['id']={'$notIn':_0x22c1c5['body'][_0x28d0('0x7a')]};}_0x30c907=[['priority','DESC'],[_0x28d0('0x7d'),_0x5290c1[0x0]['dialOrderByScheduledAt']],db[_0x28d0('0x75')][_0x28d0('0x80')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db['CmHopper']['findOne']({'attributes':['id','scheduledat',_0x28d0('0x64')],'where':_0x14d492,'order':_0x30c907,'transaction':_0x378c1e,'lock':_0x378c1e[_0x28d0('0x82')][_0x28d0('0x83')],'include':[{'model':db[_0x28d0('0x68')],'as':_0x28d0('0x84'),'attributes':_0x158986,'include':[{'model':db[_0x28d0('0x85')],'as':_0x28d0('0x86'),'attributes':['id',_0x28d0('0x23')]}]},{'model':db[_0x28d0('0x87')],'as':'List','attributes':['id','name']},{'model':db[_0x28d0('0x55')],'as':_0x28d0('0x88'),'attributes':['id',_0x28d0('0x23'),'dialActive']}]})[_0x28d0('0x21')](function(_0x7cbb3){if(_0x7cbb3){return _0x7cbb3[_0x28d0('0x20')]({'UserId':_0x22c1c5[_0x28d0('0x5f')]['id']},{'transaction':_0x378c1e});}});});}})[_0x28d0('0x21')](handleEntityNotFound(_0x10cd78,null))['then'](respondWithResult(_0x10cd78,null))[_0x28d0('0x4b')](handleError(_0x10cd78,null));};exports['getOpenContacts']=function(_0x41921d,_0x259502,_0x25b917){return _0x41921d[_0x28d0('0x5f')][_0x28d0('0x72')]({'where':{'type':_0x28d0('0x73'),'dialActive':!![],'dialMethod':_0x28d0('0x74')},'attributes':['id'],'raw':!![]})[_0x28d0('0x21')](function(_0x1bc90c){if(_0x1bc90c&&_0x1bc90c[_0x28d0('0x3e')]){return db['CmHopper'][_0x28d0('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x28d0('0x61')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x28d0('0x25')](_0x1bc90c,'id')},'$or':[{'UserId':null},{'UserId':_0x41921d[_0x28d0('0x5f')]['id']}]}});}return 0x0;})[_0x28d0('0x21')](function(_0x346d75){if(!_['isNil'](_0x346d75)&&_[_0x28d0('0x89')](_0x346d75)){return _0x259502[_0x28d0('0x14')](0xc8)[_0x28d0('0x16')]({'contacts':_0x346d75});}else{logger['error'](_0x28d0('0x8a'),_0x28d0('0x8b'),0x194,_0x28d0('0x8c'));_0x259502['sendStatus'](0x194);}})[_0x28d0('0x4b')](handleError(_0x259502,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index ef900c0..b701f45 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 _0xb43b=['phone','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','define','cm_hopper'];(function(_0x1886a8,_0x13e23f){var _0x2ac907=function(_0x51fa2f){while(--_0x51fa2f){_0x1886a8['push'](_0x1886a8['shift']());}};_0x2ac907(++_0x13e23f);}(_0xb43b,0x1c1));var _0xbb43=function(_0x38b9d7,_0x3a26a2){_0x38b9d7=_0x38b9d7-0x0;var _0x4591ff=_0xb43b[_0x38b9d7];return _0x4591ff;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require(_0xbb43('0x2'))(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require(_0xbb43('0x5'));var rp=require(_0xbb43('0x6'));var fs=require('fs');var path=require(_0xbb43('0x7'));var rimraf=require(_0xbb43('0x8'));var config=require('../../config/environment');var attributes=require(_0xbb43('0x9'));module[_0xbb43('0xa')]=function(_0x529ac8,_0x4bf2ab){return _0x529ac8[_0xbb43('0xb')]('CmHopper',attributes,{'tableName':_0xbb43('0xc'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xbb43('0xd'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ef0=['../../config/environment','./cmHopper.attributes','exports','CmHopper','scheduledat','phone','priority','api','moment','bluebird','path','rimraf'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x0ef0,0x19f));var _0x00ef=function(_0x4ada50,_0x54757b){_0x4ada50=_0x4ada50-0x0;var _0x3d85d5=_0x0ef0[_0x4ada50];return _0x3d85d5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x00ef('0x0'));var moment=require(_0x00ef('0x1'));var BPromise=require(_0x00ef('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00ef('0x3'));var rimraf=require(_0x00ef('0x4'));var config=require(_0x00ef('0x5'));var attributes=require(_0x00ef('0x6'));module[_0x00ef('0x7')]=function(_0x557dd3,_0x30b792){return _0x557dd3['define'](_0x00ef('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x00ef('0x9'),'fields':['scheduledat']},{'name':_0x00ef('0xa'),'fields':[_0x00ef('0xa')]},{'name':_0x00ef('0xb'),'fields':[_0x00ef('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 38fc8dd..87d2ee8 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 _0x5368=['keys','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','map','model','include','debug','catch','find','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','limit','destroy','DestroyCmHopper','CmContact','describe','sequelize','transaction','UPDATE','Contact','Agent','name','length','UserId','push','includes','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','LOCK','all','GetCmHopperPreview'];(function(_0x1a894f,_0x1f43f6){var _0x41b66f=function(_0x3a3dc8){while(--_0x3a3dc8){_0x1a894f['push'](_0x1a894f['shift']());}};_0x41b66f(++_0x1f43f6);}(_0x5368,0x93));var _0x8536=function(_0x2c4d30,_0x3ec3a9){_0x2c4d30=_0x2c4d30-0x0;var _0x18bd66=_0x5368[_0x2c4d30];return _0x18bd66;};'use strict';var _=require(_0x8536('0x0'));var util=require(_0x8536('0x1'));var moment=require('moment');var BPromise=require(_0x8536('0x2'));var rs=require(_0x8536('0x3'));var fs=require('fs');var Redis=require(_0x8536('0x4'));var db=require(_0x8536('0x5'))['db'];var utils=require(_0x8536('0x6'));var logger=require(_0x8536('0x7'))(_0x8536('0x8'));var config=require(_0x8536('0x9'));var jayson=require(_0x8536('0xa'));var client=jayson['client'][_0x8536('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5962a4,_0x5786f7,_0x623ed4){return new BPromise(function(_0x1872b6,_0xa0f98e){return client['request'](_0x5962a4,_0x623ed4)[_0x8536('0xc')](function(_0x15c740){logger[_0x8536('0xd')](_0x8536('0xe'),_0x5786f7,_0x8536('0xf'));logger['debug'](_0x8536('0x10'),_0x5786f7,'request\x20sent',JSON[_0x8536('0x11')](_0x15c740));if(_0x15c740[_0x8536('0x12')]){if(_0x15c740[_0x8536('0x12')][_0x8536('0x13')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x5786f7,_0x15c740[_0x8536('0x12')][_0x8536('0x14')]);return _0xa0f98e(_0x15c740[_0x8536('0x12')][_0x8536('0x14')]);}logger[_0x8536('0x12')](_0x8536('0xe'),_0x5786f7,_0x15c740[_0x8536('0x12')]['message']);return _0x1872b6(_0x15c740[_0x8536('0x12')]['message']);}else{logger['info'](_0x8536('0xe'),_0x5786f7,_0x8536('0xf'));_0x1872b6(_0x15c740[_0x8536('0x15')][_0x8536('0x14')]);}})['catch'](function(_0x2cafd1){logger[_0x8536('0x12')](_0x8536('0xe'),_0x5786f7,_0x2cafd1);_0xa0f98e(_0x2cafd1);});});}exports[_0x8536('0x16')]=function(_0x26321e){var _0x1c79ca=this;return new Promise(function(_0x130237,_0x4aa98a){return db[_0x8536('0x17')][_0x8536('0x18')]({'raw':_0x26321e[_0x8536('0x19')]?_0x26321e[_0x8536('0x19')][_0x8536('0x1a')]===undefined?!![]:![]:!![],'where':_0x26321e[_0x8536('0x19')]?_0x26321e[_0x8536('0x19')][_0x8536('0x1b')]||null:null,'attributes':_0x26321e[_0x8536('0x19')]?_0x26321e[_0x8536('0x19')][_0x8536('0x1c')]||null:null,'limit':_0x26321e['options']?_0x26321e[_0x8536('0x19')]['limit']||null:null,'include':_0x26321e[_0x8536('0x19')]?_0x26321e[_0x8536('0x19')]['include']?_[_0x8536('0x1d')](_0x26321e[_0x8536('0x19')]['include'],function(_0x3ab2c3){return{'model':db[_0x3ab2c3[_0x8536('0x1e')]],'as':_0x3ab2c3['as'],'attributes':_0x3ab2c3[_0x8536('0x1c')],'include':_0x3ab2c3[_0x8536('0x1f')]?_['map'](_0x3ab2c3[_0x8536('0x1f')],function(_0x15bb7e){return{'model':db[_0x15bb7e[_0x8536('0x1e')]],'as':_0x15bb7e['as'],'attributes':_0x15bb7e[_0x8536('0x1c')],'include':_0x15bb7e[_0x8536('0x1f')]?_['map'](_0x15bb7e[_0x8536('0x1f')],function(_0x5a3c32){return{'model':db[_0x5a3c32[_0x8536('0x1e')]],'as':_0x5a3c32['as'],'attributes':_0x5a3c32[_0x8536('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8536('0xc')](function(_0x2ec411){logger['info'](_0x8536('0x16'),_0x26321e);logger[_0x8536('0x20')]('GetCmHopper',_0x26321e,JSON[_0x8536('0x11')](_0x2ec411));_0x130237(_0x2ec411);})[_0x8536('0x21')](function(_0x597b6d){logger[_0x8536('0x12')](_0x8536('0x16'),_0x597b6d[_0x8536('0x14')],_0x26321e);_0x4aa98a(_0x1c79ca[_0x8536('0x12')](0x1f4,_0x597b6d['message']));});});};exports['ShowCmHopper']=function(_0x5bda20){var _0x2b400d=this;return new Promise(function(_0x50ef37,_0x157f00){return db['CmHopper'][_0x8536('0x22')]({'raw':_0x5bda20[_0x8536('0x19')]?_0x5bda20[_0x8536('0x19')][_0x8536('0x1a')]===undefined?!![]:![]:!![],'where':_0x5bda20['options']?_0x5bda20[_0x8536('0x19')][_0x8536('0x1b')]||null:null,'attributes':_0x5bda20[_0x8536('0x19')]?_0x5bda20['options'][_0x8536('0x1c')]||null:null,'include':_0x5bda20[_0x8536('0x19')]?_0x5bda20[_0x8536('0x19')][_0x8536('0x1f')]?_[_0x8536('0x1d')](_0x5bda20[_0x8536('0x19')][_0x8536('0x1f')],function(_0x29597b){return{'model':db[_0x29597b[_0x8536('0x1e')]],'as':_0x29597b['as'],'attributes':_0x29597b[_0x8536('0x1c')],'include':_0x29597b['include']?_[_0x8536('0x1d')](_0x29597b[_0x8536('0x1f')],function(_0x5692fe){return{'model':db[_0x5692fe[_0x8536('0x1e')]],'as':_0x5692fe['as'],'attributes':_0x5692fe['attributes'],'include':_0x5692fe[_0x8536('0x1f')]?_[_0x8536('0x1d')](_0x5692fe['include'],function(_0x41c2e6){return{'model':db[_0x41c2e6[_0x8536('0x1e')]],'as':_0x41c2e6['as'],'attributes':_0x41c2e6[_0x8536('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8536('0xc')](function(_0x4c6100){logger['info'](_0x8536('0x23'),_0x5bda20);logger[_0x8536('0x20')](_0x8536('0x23'),_0x5bda20,JSON['stringify'](_0x4c6100));_0x50ef37(_0x4c6100);})[_0x8536('0x21')](function(_0x5b084c){logger[_0x8536('0x12')](_0x8536('0x23'),_0x5b084c[_0x8536('0x14')],_0x5bda20);_0x157f00(_0x2b400d['error'](0x1f4,_0x5b084c[_0x8536('0x14')]));});});};exports['CreateCmHopper']=function(_0x2f22a7){var _0x4bba18=this;return new Promise(function(_0x3351ab,_0x35660f){return db[_0x8536('0x17')][_0x8536('0x24')](_0x2f22a7[_0x8536('0x25')],{'raw':_0x2f22a7['options']?_0x2f22a7[_0x8536('0x19')][_0x8536('0x1a')]===undefined?!![]:![]:!![]})[_0x8536('0xc')](function(_0x33bebf){logger['info']('CreateCmHopper',_0x2f22a7);logger[_0x8536('0x20')](_0x8536('0x26'),_0x2f22a7,JSON[_0x8536('0x11')](_0x33bebf));_0x3351ab(_0x33bebf);})[_0x8536('0x21')](function(_0x2cca2f){logger[_0x8536('0x12')]('CreateCmHopper',_0x2cca2f[_0x8536('0x14')],_0x2f22a7);_0x35660f(_0x4bba18['error'](0x1f4,_0x2cca2f[_0x8536('0x14')]));});});};exports[_0x8536('0x27')]=function(_0x23a579){var _0x12d549=this;return new Promise(function(_0x3efa40,_0x1e5d3e){return db[_0x8536('0x17')][_0x8536('0x28')](_0x23a579[_0x8536('0x25')],{'raw':_0x23a579['options']?_0x23a579['options'][_0x8536('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23a579[_0x8536('0x19')]?_0x23a579[_0x8536('0x19')]['where']||null:null,'attributes':_0x23a579[_0x8536('0x19')]?_0x23a579[_0x8536('0x19')][_0x8536('0x1c')]||null:null,'limit':_0x23a579[_0x8536('0x19')]?_0x23a579[_0x8536('0x19')][_0x8536('0x29')]||null:null})[_0x8536('0xc')](function(_0x51d5b7){logger[_0x8536('0xd')](_0x8536('0x27'),_0x23a579);logger[_0x8536('0x20')]('UpdateCmHopper',_0x23a579,JSON[_0x8536('0x11')](_0x51d5b7));_0x3efa40(_0x51d5b7);})[_0x8536('0x21')](function(_0x2d716a){logger[_0x8536('0x12')](_0x8536('0x27'),_0x2d716a[_0x8536('0x14')],_0x23a579);_0x1e5d3e(_0x12d549['error'](0x1f4,_0x2d716a[_0x8536('0x14')]));});});};exports['DestroyCmHopper']=function(_0x37f5de){var _0x18017e=this;return new Promise(function(_0xdb446e,_0x56a997){return db[_0x8536('0x17')][_0x8536('0x2a')]({'where':_0x37f5de[_0x8536('0x19')]?_0x37f5de['options'][_0x8536('0x1b')]||null:null})[_0x8536('0xc')](function(_0x2c7635){logger['info'](_0x8536('0x2b'),_0x37f5de);logger['debug'](_0x8536('0x2b'),_0x37f5de,JSON[_0x8536('0x11')](_0x2c7635));_0xdb446e(_0x2c7635);})[_0x8536('0x21')](function(_0x53ccdd){logger[_0x8536('0x12')](_0x8536('0x2b'),_0x53ccdd['message'],_0x37f5de);_0x56a997(_0x18017e[_0x8536('0x12')](0x1f4,_0x53ccdd[_0x8536('0x14')]));});});};exports['GetContactDialer']=function(_0x36f197){var _0x187b8f=this;return new Promise(function(_0x251605,_0x5d0a38){return db[_0x8536('0x2c')][_0x8536('0x2d')]()[_0x8536('0xc')](function(_0x33da18){return db[_0x8536('0x2e')][_0x8536('0x2f')](function(_0x376f1f){return db[_0x8536('0x17')]['findAll']({'where':_0x36f197[_0x8536('0x19')]?_0x36f197[_0x8536('0x19')][_0x8536('0x1b')]||null:null,'attributes':_0x36f197[_0x8536('0x19')]?_0x36f197[_0x8536('0x19')][_0x8536('0x1c')]||null:null,'limit':_0x36f197[_0x8536('0x19')]?_0x36f197[_0x8536('0x19')][_0x8536('0x29')]||null:null,'order':_0x36f197[_0x8536('0x19')]?_0x36f197[_0x8536('0x19')]['order']||null:null,'transaction':_0x376f1f,'lock':_0x376f1f['LOCK'][_0x8536('0x30')],'include':[{'model':db[_0x8536('0x2c')],'as':_0x8536('0x31'),'attributes':_['keys'](_0x33da18)},{'model':db['User'],'as':_0x8536('0x32'),'attributes':['id',_0x8536('0x33'),'voicePause']}]})['then'](function(_0x3d00f2){var _0x596d80=[];var _0x41dd6e=[];for(var _0x29b970=0x0;_0x29b970<_0x3d00f2[_0x8536('0x34')];_0x29b970+=0x1){var _0x299515=_0x3d00f2[_0x29b970][_0x8536('0x35')];if(_0x299515===null){_0x596d80[_0x8536('0x36')](_0x3d00f2[_0x29b970][_0x8536('0x28')](_0x36f197[_0x8536('0x25')],{'transaction':_0x376f1f}));}else if(!_0x41dd6e[_0x8536('0x37')](_0x299515)){_0x41dd6e[_0x8536('0x36')](_0x299515);_0x596d80['push'](_0x3d00f2[_0x29b970]['update'](_0x36f197[_0x8536('0x25')],{'transaction':_0x376f1f}));}}return BPromise['all'](_0x596d80);});})[_0x8536('0xc')](function(_0x11f691){logger[_0x8536('0xd')](_0x8536('0x38'),_0x36f197);logger['debug'](_0x8536('0x38'),_0x36f197,JSON[_0x8536('0x11')](_0x11f691));_0x251605(_0x11f691);})[_0x8536('0x21')](function(_0x1b1628){logger[_0x8536('0x12')](_0x8536('0x38'),_0x1b1628[_0x8536('0x14')],_0x36f197);_0x5d0a38(_0x187b8f[_0x8536('0x12')](0x1f4,_0x1b1628[_0x8536('0x14')]));});});});};exports[_0x8536('0x39')]=function(_0x15dd53){var _0x9afff3=this;return new Promise(function(_0x53a2d5,_0x50d8c1){return db[_0x8536('0x2e')]['transaction'](function(_0x2d5a78){return db[_0x8536('0x3a')]['create'](_0x15dd53['body'],{'raw':_0x15dd53[_0x8536('0x19')]?_0x15dd53[_0x8536('0x19')][_0x8536('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x2d5a78})['then'](function(){return db[_0x8536('0x17')][_0x8536('0x2a')]({'where':_0x15dd53[_0x8536('0x19')]?_0x15dd53[_0x8536('0x19')][_0x8536('0x1b')]||null:null,'transaction':_0x2d5a78});});})['then'](function(_0x21e735){logger['info'](_0x8536('0x39'),_0x15dd53);logger[_0x8536('0x20')](_0x8536('0x39'),_0x15dd53,JSON[_0x8536('0x11')](_0x21e735));_0x53a2d5(_0x21e735);})['catch'](function(_0x3d4e2b){logger[_0x8536('0x12')](_0x8536('0x39'),_0x3d4e2b[_0x8536('0x14')],_0x15dd53);_0x50d8c1(_0x9afff3[_0x8536('0x12')](0x1f4,_0x3d4e2b[_0x8536('0x14')]));});});};exports[_0x8536('0x3b')]=function(_0x4cd736){var _0x3d9d1b=this;return new Promise(function(_0x18c1af,_0x21db7a){return db[_0x8536('0x17')]['findAll']({'raw':_0x4cd736[_0x8536('0x19')]?_0x4cd736[_0x8536('0x19')][_0x8536('0x1a')]===undefined?!![]:![]:!![],'where':_0x4cd736['options']?_0x4cd736[_0x8536('0x19')][_0x8536('0x1b')]||null:null,'attributes':[[db[_0x8536('0x2e')]['fn'](_0x8536('0x3c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x8536('0x3d')+util[_0x8536('0x3e')](_0x8536('0x3f'),moment()['format'](_0x8536('0x40')))+_0x8536('0x41')))),_0x8536('0x42')]]})[_0x8536('0xc')](function(_0x5dceb7){logger['info']('CountReScheduled',_0x4cd736);logger['debug'](_0x8536('0x3b'),_0x4cd736,JSON['stringify'](_0x5dceb7));_0x18c1af(_0x5dceb7);})[_0x8536('0x21')](function(_0x54e900){logger[_0x8536('0x12')]('CountReScheduled',_0x54e900[_0x8536('0x14')],_0x4cd736);_0x21db7a(_0x3d9d1b[_0x8536('0x12')](0x1f4,_0x54e900[_0x8536('0x14')]));});});};exports[_0x8536('0x43')]=function(_0x277b3c){var _0xebf768=this;return new Promise(function(_0x5f50ac,_0x2c1773){return db[_0x8536('0x2c')][_0x8536('0x2d')]()[_0x8536('0xc')](function(_0x5c4782){return db[_0x8536('0x2e')][_0x8536('0x2f')](function(_0x216702){return db['CmHopper']['findAll']({'where':_0x277b3c[_0x8536('0x19')]?_0x277b3c[_0x8536('0x19')][_0x8536('0x1b')]||null:null,'attributes':_0x277b3c[_0x8536('0x19')]?_0x277b3c['options']['attributes']||null:null,'limit':0x1,'order':_0x277b3c[_0x8536('0x19')]?_0x277b3c[_0x8536('0x19')][_0x8536('0x44')]||null:null,'group':db['CmHopper'][_0x8536('0x35')],'transaction':_0x216702,'lock':_0x216702[_0x8536('0x45')][_0x8536('0x30')],'include':_0x277b3c[_0x8536('0x19')]?_0x277b3c['options'][_0x8536('0x1f')]?_[_0x8536('0x1d')](_0x277b3c[_0x8536('0x19')][_0x8536('0x1f')],function(_0x2c8ca6){return{'model':db[_0x2c8ca6['model']],'as':_0x2c8ca6['as'],'attributes':_0x2c8ca6[_0x8536('0x1c')],'include':_0x2c8ca6[_0x8536('0x1f')]?_[_0x8536('0x1d')](_0x2c8ca6['include'],function(_0x3d9ac1){return{'model':db[_0x3d9ac1[_0x8536('0x1e')]],'as':_0x3d9ac1['as'],'attributes':_0x3d9ac1[_0x8536('0x1c')],'include':_0x3d9ac1['include']?_[_0x8536('0x1d')](_0x3d9ac1[_0x8536('0x1f')],function(_0x32ad22){return{'model':db[_0x32ad22[_0x8536('0x1e')]],'as':_0x32ad22['as'],'attributes':_0x32ad22[_0x8536('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8536('0xc')](function(_0x59b203){var _0x554142=[];for(var _0x32a7c8=0x0;_0x32a7c8<_0x59b203[_0x8536('0x34')];_0x32a7c8+=0x1){_0x554142['push'](_0x59b203[_0x32a7c8]['update'](_0x277b3c[_0x8536('0x25')],{'transaction':_0x216702}));}return BPromise[_0x8536('0x46')](_0x554142);});})[_0x8536('0xc')](function(_0x164224){logger[_0x8536('0xd')]('GetContactRecallMe',_0x277b3c);logger[_0x8536('0x20')](_0x8536('0x43'),_0x277b3c,JSON['stringify'](_0x164224));_0x5f50ac(_0x164224);})[_0x8536('0x21')](function(_0x5485f0){logger['error'](_0x8536('0x43'),_0x5485f0[_0x8536('0x14')],_0x277b3c);_0x2c1773(_0xebf768[_0x8536('0x12')](0x1f4,_0x5485f0[_0x8536('0x14')]));});});});};exports[_0x8536('0x47')]=function(_0x4f34ee){var _0x145d46=this;return new Promise(function(_0x10c65b,_0x5a688f){db[_0x8536('0x2c')][_0x8536('0x2d')]()[_0x8536('0xc')](function(_0x1ba768){return db[_0x8536('0x17')][_0x8536('0x18')]({'raw':_0x4f34ee['options']?_0x4f34ee[_0x8536('0x19')][_0x8536('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f34ee[_0x8536('0x19')]?_0x4f34ee[_0x8536('0x19')][_0x8536('0x1b')]||null:null,'attributes':_0x4f34ee['options']?_0x4f34ee[_0x8536('0x19')][_0x8536('0x1c')]||null:null,'limit':_0x4f34ee[_0x8536('0x19')]?_0x4f34ee[_0x8536('0x19')][_0x8536('0x29')]||null:null,'include':_0x4f34ee['options']?_0x4f34ee[_0x8536('0x19')][_0x8536('0x1f')]?_['map'](_0x4f34ee[_0x8536('0x19')][_0x8536('0x1f')],function(_0x4cc9e7){return{'model':db[_0x4cc9e7[_0x8536('0x1e')]],'as':_0x4cc9e7['as'],'attributes':_0x4cc9e7['as']===_0x8536('0x31')?_[_0x8536('0x48')](_0x1ba768):_0x4cc9e7[_0x8536('0x1c')],'include':_0x4cc9e7[_0x8536('0x1f')]?_[_0x8536('0x1d')](_0x4cc9e7['include'],function(_0x5226a6){return{'model':db[_0x5226a6[_0x8536('0x1e')]],'as':_0x5226a6['as'],'attributes':_0x5226a6[_0x8536('0x1c')],'include':_0x5226a6['include']?_[_0x8536('0x1d')](_0x5226a6['include'],function(_0x17e747){return{'model':db[_0x17e747[_0x8536('0x1e')]],'as':_0x17e747['as'],'attributes':_0x17e747[_0x8536('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8536('0xc')](function(_0x29be44){logger[_0x8536('0xd')]('GetCmHopper',_0x4f34ee);logger[_0x8536('0x20')]('GetCmHopper',_0x4f34ee,JSON[_0x8536('0x11')](_0x29be44));_0x10c65b(_0x29be44);})['catch'](function(_0x450c1c){logger['error']('GetCmHopper',_0x450c1c[_0x8536('0x14')],_0x4f34ee);_0x5a688f(_0x145d46[_0x8536('0x12')](0x1f4,_0x450c1c[_0x8536('0x14')]));});});});}; \ No newline at end of file +var _0xadb5=['includes','all','MoveContactManagedDialer','CmHopperFinal','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','describe','order','UPDATE','length','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','map','model','find','ShowCmHopper','CreateCmHopper','create','raw','catch','UpdateCmHopper','update','destroy','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','LOCK','Contact','keys','User','Agent','name','push','body'];(function(_0x790f2c,_0x421bf7){var _0x314e2c=function(_0x55fa88){while(--_0x55fa88){_0x790f2c['push'](_0x790f2c['shift']());}};_0x314e2c(++_0x421bf7);}(_0xadb5,0x16f));var _0x5adb=function(_0xfe7b19,_0x42b655){_0xfe7b19=_0xfe7b19-0x0;var _0x4b53ee=_0xadb5[_0xfe7b19];return _0x4b53ee;};'use strict';var _=require(_0x5adb('0x0'));var util=require(_0x5adb('0x1'));var moment=require('moment');var BPromise=require(_0x5adb('0x2'));var rs=require(_0x5adb('0x3'));var fs=require('fs');var Redis=require(_0x5adb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x5'));var logger=require(_0x5adb('0x6'))(_0x5adb('0x7'));var config=require(_0x5adb('0x8'));var jayson=require(_0x5adb('0x9'));var client=jayson[_0x5adb('0xa')][_0x5adb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50b8da,_0x20e522,_0x74d882){return new BPromise(function(_0x3b68a8,_0x171141){return client['request'](_0x50b8da,_0x74d882)[_0x5adb('0xc')](function(_0x1ef80a){logger['info'](_0x5adb('0xd'),_0x20e522,_0x5adb('0xe'));logger[_0x5adb('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x20e522,_0x5adb('0xe'),JSON[_0x5adb('0x10')](_0x1ef80a));if(_0x1ef80a[_0x5adb('0x11')]){if(_0x1ef80a[_0x5adb('0x11')][_0x5adb('0x12')]===0x1f4){logger['error'](_0x5adb('0xd'),_0x20e522,_0x1ef80a[_0x5adb('0x11')][_0x5adb('0x13')]);return _0x171141(_0x1ef80a[_0x5adb('0x11')][_0x5adb('0x13')]);}logger[_0x5adb('0x11')](_0x5adb('0xd'),_0x20e522,_0x1ef80a[_0x5adb('0x11')][_0x5adb('0x13')]);return _0x3b68a8(_0x1ef80a[_0x5adb('0x11')][_0x5adb('0x13')]);}else{logger[_0x5adb('0x14')](_0x5adb('0xd'),_0x20e522,_0x5adb('0xe'));_0x3b68a8(_0x1ef80a['result'][_0x5adb('0x13')]);}})['catch'](function(_0x39d661){logger[_0x5adb('0x11')](_0x5adb('0xd'),_0x20e522,_0x39d661);_0x171141(_0x39d661);});});}exports[_0x5adb('0x15')]=function(_0x85226){var _0x1f3752=this;return new Promise(function(_0x3839d1,_0x42d477){return db[_0x5adb('0x16')][_0x5adb('0x17')]({'raw':_0x85226[_0x5adb('0x18')]?_0x85226[_0x5adb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x85226[_0x5adb('0x18')]?_0x85226[_0x5adb('0x18')][_0x5adb('0x19')]||null:null,'attributes':_0x85226[_0x5adb('0x18')]?_0x85226[_0x5adb('0x18')][_0x5adb('0x1a')]||null:null,'limit':_0x85226[_0x5adb('0x18')]?_0x85226[_0x5adb('0x18')][_0x5adb('0x1b')]||null:null,'include':_0x85226[_0x5adb('0x18')]?_0x85226[_0x5adb('0x18')][_0x5adb('0x1c')]?_[_0x5adb('0x1d')](_0x85226[_0x5adb('0x18')][_0x5adb('0x1c')],function(_0x16c438){return{'model':db[_0x16c438[_0x5adb('0x1e')]],'as':_0x16c438['as'],'attributes':_0x16c438[_0x5adb('0x1a')],'include':_0x16c438[_0x5adb('0x1c')]?_[_0x5adb('0x1d')](_0x16c438[_0x5adb('0x1c')],function(_0xa10e42){return{'model':db[_0xa10e42[_0x5adb('0x1e')]],'as':_0xa10e42['as'],'attributes':_0xa10e42[_0x5adb('0x1a')],'include':_0xa10e42[_0x5adb('0x1c')]?_[_0x5adb('0x1d')](_0xa10e42[_0x5adb('0x1c')],function(_0x3bba2b){return{'model':db[_0x3bba2b[_0x5adb('0x1e')]],'as':_0x3bba2b['as'],'attributes':_0x3bba2b[_0x5adb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5adb('0xc')](function(_0x1e00f0){logger[_0x5adb('0x14')](_0x5adb('0x15'),_0x85226);logger[_0x5adb('0xf')](_0x5adb('0x15'),_0x85226,JSON[_0x5adb('0x10')](_0x1e00f0));_0x3839d1(_0x1e00f0);})['catch'](function(_0x3f05cd){logger[_0x5adb('0x11')](_0x5adb('0x15'),_0x3f05cd[_0x5adb('0x13')],_0x85226);_0x42d477(_0x1f3752['error'](0x1f4,_0x3f05cd[_0x5adb('0x13')]));});});};exports['ShowCmHopper']=function(_0x1f7bb5){var _0x2d5f3a=this;return new Promise(function(_0x414e6d,_0x423a94){return db['CmHopper'][_0x5adb('0x1f')]({'raw':_0x1f7bb5['options']?_0x1f7bb5[_0x5adb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1f7bb5[_0x5adb('0x18')]?_0x1f7bb5['options'][_0x5adb('0x19')]||null:null,'attributes':_0x1f7bb5[_0x5adb('0x18')]?_0x1f7bb5['options']['attributes']||null:null,'include':_0x1f7bb5[_0x5adb('0x18')]?_0x1f7bb5[_0x5adb('0x18')]['include']?_[_0x5adb('0x1d')](_0x1f7bb5[_0x5adb('0x18')][_0x5adb('0x1c')],function(_0x12a6f4){return{'model':db[_0x12a6f4[_0x5adb('0x1e')]],'as':_0x12a6f4['as'],'attributes':_0x12a6f4[_0x5adb('0x1a')],'include':_0x12a6f4[_0x5adb('0x1c')]?_['map'](_0x12a6f4[_0x5adb('0x1c')],function(_0x5824c5){return{'model':db[_0x5824c5['model']],'as':_0x5824c5['as'],'attributes':_0x5824c5[_0x5adb('0x1a')],'include':_0x5824c5[_0x5adb('0x1c')]?_[_0x5adb('0x1d')](_0x5824c5['include'],function(_0x22abd9){return{'model':db[_0x22abd9[_0x5adb('0x1e')]],'as':_0x22abd9['as'],'attributes':_0x22abd9[_0x5adb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5adb('0xc')](function(_0x1bfe3c){logger[_0x5adb('0x14')](_0x5adb('0x20'),_0x1f7bb5);logger[_0x5adb('0xf')](_0x5adb('0x20'),_0x1f7bb5,JSON[_0x5adb('0x10')](_0x1bfe3c));_0x414e6d(_0x1bfe3c);})['catch'](function(_0x3ca82f){logger[_0x5adb('0x11')](_0x5adb('0x20'),_0x3ca82f['message'],_0x1f7bb5);_0x423a94(_0x2d5f3a['error'](0x1f4,_0x3ca82f[_0x5adb('0x13')]));});});};exports[_0x5adb('0x21')]=function(_0x15d2cb){var _0x43f334=this;return new Promise(function(_0x44b07f,_0x495923){return db[_0x5adb('0x16')][_0x5adb('0x22')](_0x15d2cb['body'],{'raw':_0x15d2cb[_0x5adb('0x18')]?_0x15d2cb[_0x5adb('0x18')][_0x5adb('0x23')]===undefined?!![]:![]:!![]})[_0x5adb('0xc')](function(_0x1e5e2e){logger[_0x5adb('0x14')](_0x5adb('0x21'),_0x15d2cb);logger[_0x5adb('0xf')](_0x5adb('0x21'),_0x15d2cb,JSON[_0x5adb('0x10')](_0x1e5e2e));_0x44b07f(_0x1e5e2e);})[_0x5adb('0x24')](function(_0x538b9c){logger[_0x5adb('0x11')](_0x5adb('0x21'),_0x538b9c[_0x5adb('0x13')],_0x15d2cb);_0x495923(_0x43f334[_0x5adb('0x11')](0x1f4,_0x538b9c[_0x5adb('0x13')]));});});};exports[_0x5adb('0x25')]=function(_0x573861){var _0x4a143d=this;return new Promise(function(_0x403837,_0x29b48d){return db[_0x5adb('0x16')][_0x5adb('0x26')](_0x573861['body'],{'raw':_0x573861[_0x5adb('0x18')]?_0x573861[_0x5adb('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x573861[_0x5adb('0x18')]?_0x573861[_0x5adb('0x18')][_0x5adb('0x19')]||null:null,'attributes':_0x573861[_0x5adb('0x18')]?_0x573861[_0x5adb('0x18')][_0x5adb('0x1a')]||null:null,'limit':_0x573861[_0x5adb('0x18')]?_0x573861['options'][_0x5adb('0x1b')]||null:null})[_0x5adb('0xc')](function(_0x7ac005){logger[_0x5adb('0x14')](_0x5adb('0x25'),_0x573861);logger[_0x5adb('0xf')](_0x5adb('0x25'),_0x573861,JSON[_0x5adb('0x10')](_0x7ac005));_0x403837(_0x7ac005);})['catch'](function(_0x301cf0){logger[_0x5adb('0x11')](_0x5adb('0x25'),_0x301cf0[_0x5adb('0x13')],_0x573861);_0x29b48d(_0x4a143d[_0x5adb('0x11')](0x1f4,_0x301cf0[_0x5adb('0x13')]));});});};exports['DestroyCmHopper']=function(_0x3b2bbb){var _0x27a340=this;return new Promise(function(_0x21f235,_0x5666fb){return db[_0x5adb('0x16')][_0x5adb('0x27')]({'where':_0x3b2bbb[_0x5adb('0x18')]?_0x3b2bbb['options'][_0x5adb('0x19')]||null:null})['then'](function(_0x5c9e91){logger[_0x5adb('0x14')](_0x5adb('0x28'),_0x3b2bbb);logger[_0x5adb('0xf')](_0x5adb('0x28'),_0x3b2bbb,JSON[_0x5adb('0x10')](_0x5c9e91));_0x21f235(_0x5c9e91);})[_0x5adb('0x24')](function(_0x226592){logger[_0x5adb('0x11')](_0x5adb('0x28'),_0x226592[_0x5adb('0x13')],_0x3b2bbb);_0x5666fb(_0x27a340[_0x5adb('0x11')](0x1f4,_0x226592[_0x5adb('0x13')]));});});};exports[_0x5adb('0x29')]=function(_0x39b96e){var _0x3c9ccd=this;return new Promise(function(_0x48cbbc,_0xaa7b56){return db[_0x5adb('0x2a')]['describe']()[_0x5adb('0xc')](function(_0x2abf6d){return db[_0x5adb('0x2b')][_0x5adb('0x2c')](function(_0x2badf0){return db[_0x5adb('0x16')][_0x5adb('0x17')]({'where':_0x39b96e[_0x5adb('0x18')]?_0x39b96e[_0x5adb('0x18')]['where']||null:null,'attributes':_0x39b96e[_0x5adb('0x18')]?_0x39b96e[_0x5adb('0x18')][_0x5adb('0x1a')]||null:null,'limit':_0x39b96e[_0x5adb('0x18')]?_0x39b96e[_0x5adb('0x18')]['limit']||null:null,'order':_0x39b96e['options']?_0x39b96e['options']['order']||null:null,'transaction':_0x2badf0,'lock':_0x2badf0[_0x5adb('0x2d')]['UPDATE'],'include':[{'model':db[_0x5adb('0x2a')],'as':_0x5adb('0x2e'),'attributes':_[_0x5adb('0x2f')](_0x2abf6d)},{'model':db[_0x5adb('0x30')],'as':_0x5adb('0x31'),'attributes':['id',_0x5adb('0x32'),'voicePause']}]})[_0x5adb('0xc')](function(_0x4085f8){var _0x71a824=[];var _0x15ed92=[];for(var _0x3a784a=0x0;_0x3a784a<_0x4085f8['length'];_0x3a784a+=0x1){var _0x3b7ee5=_0x4085f8[_0x3a784a]['UserId'];if(_0x3b7ee5===null){_0x71a824[_0x5adb('0x33')](_0x4085f8[_0x3a784a][_0x5adb('0x26')](_0x39b96e[_0x5adb('0x34')],{'transaction':_0x2badf0}));}else if(!_0x15ed92[_0x5adb('0x35')](_0x3b7ee5)){_0x15ed92[_0x5adb('0x33')](_0x3b7ee5);_0x71a824[_0x5adb('0x33')](_0x4085f8[_0x3a784a][_0x5adb('0x26')](_0x39b96e[_0x5adb('0x34')],{'transaction':_0x2badf0}));}}return BPromise[_0x5adb('0x36')](_0x71a824);});})[_0x5adb('0xc')](function(_0xfc99b6){logger[_0x5adb('0x14')](_0x5adb('0x29'),_0x39b96e);logger[_0x5adb('0xf')](_0x5adb('0x29'),_0x39b96e,JSON[_0x5adb('0x10')](_0xfc99b6));_0x48cbbc(_0xfc99b6);})[_0x5adb('0x24')](function(_0x5af431){logger[_0x5adb('0x11')]('GetContactDialer',_0x5af431[_0x5adb('0x13')],_0x39b96e);_0xaa7b56(_0x3c9ccd[_0x5adb('0x11')](0x1f4,_0x5af431[_0x5adb('0x13')]));});});});};exports[_0x5adb('0x37')]=function(_0x23746e){var _0x19c093=this;return new Promise(function(_0x3038fe,_0x19d332){return db[_0x5adb('0x2b')]['transaction'](function(_0x17d558){return db[_0x5adb('0x38')]['create'](_0x23746e[_0x5adb('0x34')],{'raw':_0x23746e[_0x5adb('0x18')]?_0x23746e['options'][_0x5adb('0x23')]===undefined?!![]:![]:!![],'transaction':_0x17d558})[_0x5adb('0xc')](function(){return db[_0x5adb('0x16')][_0x5adb('0x27')]({'where':_0x23746e[_0x5adb('0x18')]?_0x23746e[_0x5adb('0x18')][_0x5adb('0x19')]||null:null,'transaction':_0x17d558});});})[_0x5adb('0xc')](function(_0xadd03b){logger[_0x5adb('0x14')](_0x5adb('0x37'),_0x23746e);logger[_0x5adb('0xf')]('MoveContactManagedDialer',_0x23746e,JSON[_0x5adb('0x10')](_0xadd03b));_0x3038fe(_0xadd03b);})[_0x5adb('0x24')](function(_0x580b0d){logger['error'](_0x5adb('0x37'),_0x580b0d[_0x5adb('0x13')],_0x23746e);_0x19d332(_0x19c093[_0x5adb('0x11')](0x1f4,_0x580b0d[_0x5adb('0x13')]));});});};exports['CountReScheduled']=function(_0x5850de){var _0xbc066b=this;return new Promise(function(_0xdb9303,_0x5f03ad){return db['CmHopper'][_0x5adb('0x17')]({'raw':_0x5850de[_0x5adb('0x18')]?_0x5850de[_0x5adb('0x18')][_0x5adb('0x23')]===undefined?!![]:![]:!![],'where':_0x5850de[_0x5adb('0x18')]?_0x5850de[_0x5adb('0x18')][_0x5adb('0x19')]||null:null,'attributes':[[db['sequelize']['fn'](_0x5adb('0x39'),db['sequelize']['fn']('IF',db[_0x5adb('0x2b')][_0x5adb('0x3a')]('`scheduledat`\x20>=\x20'+util[_0x5adb('0x3b')](_0x5adb('0x3c'),moment()['format'](_0x5adb('0x3d')))+_0x5adb('0x3e')))),_0x5adb('0x3f')]]})[_0x5adb('0xc')](function(_0x18b846){logger[_0x5adb('0x14')](_0x5adb('0x40'),_0x5850de);logger['debug'](_0x5adb('0x40'),_0x5850de,JSON[_0x5adb('0x10')](_0x18b846));_0xdb9303(_0x18b846);})['catch'](function(_0x3363fa){logger[_0x5adb('0x11')](_0x5adb('0x40'),_0x3363fa['message'],_0x5850de);_0x5f03ad(_0xbc066b[_0x5adb('0x11')](0x1f4,_0x3363fa[_0x5adb('0x13')]));});});};exports[_0x5adb('0x41')]=function(_0x51a869){var _0x2b584e=this;return new Promise(function(_0x1b0a08,_0xa2d0a8){return db['CmContact'][_0x5adb('0x42')]()[_0x5adb('0xc')](function(_0x17ba41){return db['sequelize']['transaction'](function(_0x12b5b6){return db[_0x5adb('0x16')][_0x5adb('0x17')]({'where':_0x51a869[_0x5adb('0x18')]?_0x51a869[_0x5adb('0x18')][_0x5adb('0x19')]||null:null,'attributes':_0x51a869[_0x5adb('0x18')]?_0x51a869[_0x5adb('0x18')]['attributes']||null:null,'limit':0x1,'order':_0x51a869[_0x5adb('0x18')]?_0x51a869[_0x5adb('0x18')][_0x5adb('0x43')]||null:null,'group':db[_0x5adb('0x16')]['UserId'],'transaction':_0x12b5b6,'lock':_0x12b5b6[_0x5adb('0x2d')][_0x5adb('0x44')],'include':_0x51a869[_0x5adb('0x18')]?_0x51a869[_0x5adb('0x18')][_0x5adb('0x1c')]?_['map'](_0x51a869['options'][_0x5adb('0x1c')],function(_0x7a2e5d){return{'model':db[_0x7a2e5d[_0x5adb('0x1e')]],'as':_0x7a2e5d['as'],'attributes':_0x7a2e5d[_0x5adb('0x1a')],'include':_0x7a2e5d[_0x5adb('0x1c')]?_[_0x5adb('0x1d')](_0x7a2e5d['include'],function(_0x5d1981){return{'model':db[_0x5d1981[_0x5adb('0x1e')]],'as':_0x5d1981['as'],'attributes':_0x5d1981[_0x5adb('0x1a')],'include':_0x5d1981[_0x5adb('0x1c')]?_['map'](_0x5d1981['include'],function(_0x45d526){return{'model':db[_0x45d526['model']],'as':_0x45d526['as'],'attributes':_0x45d526['attributes']};}):[]};}):[]};}):[]:[]})[_0x5adb('0xc')](function(_0x1afdac){var _0x4d88f2=[];for(var _0x321d6e=0x0;_0x321d6e<_0x1afdac[_0x5adb('0x45')];_0x321d6e+=0x1){_0x4d88f2[_0x5adb('0x33')](_0x1afdac[_0x321d6e][_0x5adb('0x26')](_0x51a869[_0x5adb('0x34')],{'transaction':_0x12b5b6}));}return BPromise[_0x5adb('0x36')](_0x4d88f2);});})[_0x5adb('0xc')](function(_0x343e3e){logger['info'](_0x5adb('0x41'),_0x51a869);logger['debug'](_0x5adb('0x41'),_0x51a869,JSON['stringify'](_0x343e3e));_0x1b0a08(_0x343e3e);})['catch'](function(_0x5589ce){logger[_0x5adb('0x11')](_0x5adb('0x41'),_0x5589ce[_0x5adb('0x13')],_0x51a869);_0xa2d0a8(_0x2b584e[_0x5adb('0x11')](0x1f4,_0x5589ce[_0x5adb('0x13')]));});});});};exports['GetCmHopperPreview']=function(_0x17c2f){var _0x49c918=this;return new Promise(function(_0x190440,_0xeafb6e){db[_0x5adb('0x2a')]['describe']()[_0x5adb('0xc')](function(_0x254260){return db[_0x5adb('0x16')][_0x5adb('0x17')]({'raw':_0x17c2f[_0x5adb('0x18')]?_0x17c2f[_0x5adb('0x18')][_0x5adb('0x23')]===undefined?!![]:![]:!![],'where':_0x17c2f[_0x5adb('0x18')]?_0x17c2f[_0x5adb('0x18')]['where']||null:null,'attributes':_0x17c2f[_0x5adb('0x18')]?_0x17c2f[_0x5adb('0x18')][_0x5adb('0x1a')]||null:null,'limit':_0x17c2f[_0x5adb('0x18')]?_0x17c2f[_0x5adb('0x18')][_0x5adb('0x1b')]||null:null,'include':_0x17c2f['options']?_0x17c2f[_0x5adb('0x18')][_0x5adb('0x1c')]?_[_0x5adb('0x1d')](_0x17c2f['options'][_0x5adb('0x1c')],function(_0x5de787){return{'model':db[_0x5de787[_0x5adb('0x1e')]],'as':_0x5de787['as'],'attributes':_0x5de787['as']===_0x5adb('0x2e')?_[_0x5adb('0x2f')](_0x254260):_0x5de787['attributes'],'include':_0x5de787[_0x5adb('0x1c')]?_[_0x5adb('0x1d')](_0x5de787['include'],function(_0x3f84fd){return{'model':db[_0x3f84fd['model']],'as':_0x3f84fd['as'],'attributes':_0x3f84fd['attributes'],'include':_0x3f84fd['include']?_[_0x5adb('0x1d')](_0x3f84fd[_0x5adb('0x1c')],function(_0x17a9b5){return{'model':db[_0x17a9b5[_0x5adb('0x1e')]],'as':_0x17a9b5['as'],'attributes':_0x17a9b5[_0x5adb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5adb('0xc')](function(_0x19bcc2){logger['info'](_0x5adb('0x15'),_0x17c2f);logger[_0x5adb('0xf')](_0x5adb('0x15'),_0x17c2f,JSON[_0x5adb('0x10')](_0x19bcc2));_0x190440(_0x19bcc2);})[_0x5adb('0x24')](function(_0x472f2d){logger['error'](_0x5adb('0x15'),_0x472f2d['message'],_0x17c2f);_0xeafb6e(_0x49c918['error'](0x1f4,_0x472f2d[_0x5adb('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 8d8808b..d39c731 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 _0x899e=['/:id','post','/preview','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','index','/describe','isAuthenticated','/opencontacts','getOpenContacts'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x899e,0xe4));var _0xe899=function(_0x3a85d2,_0x35f4d8){_0x3a85d2=_0x3a85d2-0x0;var _0x40820f=_0x899e[_0x3a85d2];return _0x40820f;};'use strict';var multer=require('multer');var util=require(_0xe899('0x0'));var path=require(_0xe899('0x1'));var timeout=require('connect-timeout');var express=require(_0xe899('0x2'));var router=express[_0xe899('0x3')]();var fs_extra=require(_0xe899('0x4'));var auth=require(_0xe899('0x5'));var interaction=require(_0xe899('0x6'));var config=require('../../config/environment');var controller=require(_0xe899('0x7'));router[_0xe899('0x8')]('/',auth['isAuthenticated'](),controller[_0xe899('0x9')]);router[_0xe899('0x8')](_0xe899('0xa'),auth[_0xe899('0xb')](),controller['describe']);router['get'](_0xe899('0xc'),auth['isAuthenticated'](),controller[_0xe899('0xd')]);router['get'](_0xe899('0xe'),auth[_0xe899('0xb')](),controller['show']);router[_0xe899('0xf')]('/',auth[_0xe899('0xb')](),controller['create']);router[_0xe899('0xf')](_0xe899('0x10'),auth[_0xe899('0xb')](),controller['getPreview']);router[_0xe899('0x11')]('/:id',auth[_0xe899('0xb')](),controller[_0xe899('0x12')]);router[_0xe899('0x13')](_0xe899('0xe'),auth[_0xe899('0xb')](),controller[_0xe899('0x14')]);module[_0xe899('0x15')]=router; \ No newline at end of file +var _0xe31f=['get','describe','/opencontacts','/:id','show','post','create','/preview','getPreview','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index'];(function(_0x142ea8,_0x603c2c){var _0x5d5812=function(_0x33acc7){while(--_0x33acc7){_0x142ea8['push'](_0x142ea8['shift']());}};_0x5d5812(++_0x603c2c);}(_0xe31f,0x9d));var _0xfe31=function(_0x1ef62e,_0x102d96){_0x1ef62e=_0x1ef62e-0x0;var _0x2dc0aa=_0xe31f[_0x1ef62e];return _0x2dc0aa;};'use strict';var multer=require(_0xfe31('0x0'));var util=require(_0xfe31('0x1'));var path=require(_0xfe31('0x2'));var timeout=require(_0xfe31('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfe31('0x4'));var auth=require(_0xfe31('0x5'));var interaction=require(_0xfe31('0x6'));var config=require(_0xfe31('0x7'));var controller=require(_0xfe31('0x8'));router['get']('/',auth[_0xfe31('0x9')](),controller[_0xfe31('0xa')]);router[_0xfe31('0xb')]('/describe',auth[_0xfe31('0x9')](),controller[_0xfe31('0xc')]);router[_0xfe31('0xb')](_0xfe31('0xd'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0xfe31('0xb')](_0xfe31('0xe'),auth[_0xfe31('0x9')](),controller[_0xfe31('0xf')]);router[_0xfe31('0x10')]('/',auth['isAuthenticated'](),controller[_0xfe31('0x11')]);router[_0xfe31('0x10')](_0xfe31('0x12'),auth[_0xfe31('0x9')](),controller[_0xfe31('0x13')]);router[_0xfe31('0x14')](_0xfe31('0xe'),auth[_0xfe31('0x9')](),controller['update']);router[_0xfe31('0x15')](_0xfe31('0xe'),auth[_0xfe31('0x9')](),controller[_0xfe31('0x16')]);module[_0xfe31('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 4f10846..3fe8ca1 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 _0x0dd7=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','INTEGER'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x0dd7,0x1e4));var _0x70dd=function(_0x28014d,_0x383e2f){_0x28014d=_0x28014d-0x0;var _0x2572cc=_0x0dd7[_0x28014d];return _0x2572cc;};'use strict';var moment=require(_0x70dd('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0x70dd('0x1')]},'phone':{'type':Sequelize[_0x70dd('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x70dd('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x70dd('0x3')],'defaultValue':moment()[_0x70dd('0x4')](_0x70dd('0x5'))},'countbusyretry':{'type':Sequelize[_0x70dd('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x70dd('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x70dd('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x70dd('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x70dd('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa226=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER'];(function(_0x36d25e,_0x1a047d){var _0x4b95b8=function(_0x74da3){while(--_0x74da3){_0x36d25e['push'](_0x36d25e['shift']());}};_0x4b95b8(++_0x1a047d);}(_0xa226,0x1d1));var _0x6a22=function(_0x1d7b02,_0x1125d2){_0x1d7b02=_0x1d7b02-0x0;var _0x27f63=_0xa226[_0x1d7b02];return _0x27f63;};'use strict';var moment=require(_0x6a22('0x0'));var Sequelize=require(_0x6a22('0x1'));module[_0x6a22('0x2')]={'CmHopperId':{'type':Sequelize[_0x6a22('0x3')]},'phone':{'type':Sequelize[_0x6a22('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x6a22('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x6a22('0x5')],'defaultValue':moment()['format'](_0x6a22('0x6'))},'countbusyretry':{'type':Sequelize[_0x6a22('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6a22('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6a22('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6a22('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index d54a86b..674350a 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 _0x479b=['find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','end','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes'];(function(_0x59cdaa,_0x19701c){var _0x59b7e6=function(_0x2c8bfc){while(--_0x2c8bfc){_0x59cdaa['push'](_0x59cdaa['shift']());}};_0x59b7e6(++_0x19701c);}(_0x479b,0x151));var _0xb479=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x479b[_0x59c301];return _0x3866b9;};'use strict';var emlformat=require(_0xb479('0x0'));var rimraf=require(_0xb479('0x1'));var zipdir=require(_0xb479('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb479('0x3'));var moment=require(_0xb479('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb479('0x5'));var sox=require(_0xb479('0x6'));var csv=require('to-csv');var ejs=require(_0xb479('0x7'));var fs=require('fs');var fs_extra=require(_0xb479('0x8'));var _=require('lodash');var squel=require(_0xb479('0x9'));var crypto=require(_0xb479('0xa'));var jsforce=require(_0xb479('0xb'));var deskjs=require(_0xb479('0xc'));var toCsv=require(_0xb479('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb479('0xe'));var authService=require(_0xb479('0xf'));var qs=require(_0xb479('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb479('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xb479('0x12'));var config=require(_0xb479('0x13'));var licenseUtil=require(_0xb479('0x14'));var db=require(_0xb479('0x15'))['db'];function respondWithStatusCode(_0x5ae39b,_0x46bc36){_0x46bc36=_0x46bc36||0xcc;return function(_0x339f72){if(_0x339f72){return _0x5ae39b[_0xb479('0x16')](_0x46bc36);}return _0x5ae39b[_0xb479('0x17')](_0x46bc36)['end']();};}function respondWithResult(_0x2b53cf,_0x54d08b){_0x54d08b=_0x54d08b||0xc8;return function(_0xadcc4b){if(_0xadcc4b){return _0x2b53cf['status'](_0x54d08b)['json'](_0xadcc4b);}};}function respondWithFilteredResult(_0x24a8b4,_0x2598da){return function(_0x13166a){if(_0x13166a){var _0x7ab68c=typeof _0x2598da[_0xb479('0x18')]==='undefined'&&typeof _0x2598da[_0xb479('0x19')]===_0xb479('0x1a');var _0x33451f=_0x13166a['count'];var _0xc152ad=_0x7ab68c?0x0:_0x2598da[_0xb479('0x18')];var _0x41ecdf=_0x7ab68c?_0x13166a[_0xb479('0x1b')]:_0x2598da[_0xb479('0x18')]+_0x2598da['limit'];var _0x1257c9;if(_0x41ecdf>=_0x33451f){_0x41ecdf=_0x33451f;_0x1257c9=0xc8;}else{_0x1257c9=0xce;}_0x24a8b4[_0xb479('0x17')](_0x1257c9);return _0x24a8b4[_0xb479('0x1c')](_0xb479('0x1d'),_0xc152ad+'-'+_0x41ecdf+'/'+_0x33451f)[_0xb479('0x1e')](_0x13166a);}return null;};}function patchUpdates(_0x23db5f){return function(_0x4693fc){try{jsonpatch['apply'](_0x4693fc,_0x23db5f,!![]);}catch(_0x54e110){return BPromise[_0xb479('0x1f')](_0x54e110);}return _0x4693fc[_0xb479('0x20')]();};}function saveUpdates(_0xe0756b,_0x4fbe98){return function(_0x1077ca){if(_0x1077ca){return _0x1077ca['update'](_0xe0756b)[_0xb479('0x21')](function(_0x4d46a2){return _0x4d46a2;});}return null;};}function removeEntity(_0x6685a4,_0xe869e2){return function(_0x1a04dd){if(_0x1a04dd){return _0x1a04dd[_0xb479('0x22')]()['then'](function(){var _0x1a9295=_0x1a04dd[_0xb479('0x23')]({'plain':!![]});var _0x424187=_0xb479('0x24');return db[_0xb479('0x25')][_0xb479('0x22')]({'where':{'type':_0x424187,'resourceId':_0x1a9295['id']}})[_0xb479('0x21')](function(){return _0x1a04dd;});})[_0xb479('0x21')](function(){_0x6685a4[_0xb479('0x17')](0xcc)[_0xb479('0x26')]();});}};}function handleEntityNotFound(_0x6a0563,_0x383467){return function(_0x1e253d){if(!_0x1e253d){_0x6a0563['sendStatus'](0x194);}return _0x1e253d;};}function handleError(_0x3955db,_0xfb6e12){_0xfb6e12=_0xfb6e12||0x1f4;return function(_0x73114a){logger[_0xb479('0x27')](_0x73114a[_0xb479('0x28')]);if(_0x73114a['name']){delete _0x73114a[_0xb479('0x29')];}_0x3955db['status'](_0xfb6e12)[_0xb479('0x2a')](_0x73114a);};}exports[_0xb479('0x2b')]=function(_0x6c1a79,_0x1304e0){var _0x55de03={},_0x218cdf={},_0x200136={'count':0x0,'rows':[]};var _0x2f6e91=_[_0xb479('0x2c')](db[_0xb479('0x2d')]['rawAttributes'],function(_0x22b280){return{'name':_0x22b280[_0xb479('0x2e')],'type':_0x22b280[_0xb479('0x2f')][_0xb479('0x30')]};});_0x218cdf[_0xb479('0x31')]=_[_0xb479('0x2c')](_0x2f6e91,_0xb479('0x29'));_0x218cdf['query']=_['keys'](_0x6c1a79[_0xb479('0x32')]);_0x218cdf[_0xb479('0x33')]=_['intersection'](_0x218cdf[_0xb479('0x31')],_0x218cdf[_0xb479('0x32')]);_0x55de03[_0xb479('0x34')]=_[_0xb479('0x35')](_0x218cdf[_0xb479('0x31')],qs['fields'](_0x6c1a79[_0xb479('0x32')][_0xb479('0x36')]));_0x55de03[_0xb479('0x34')]=_0x55de03[_0xb479('0x34')][_0xb479('0x37')]?_0x55de03[_0xb479('0x34')]:_0x218cdf['model'];if(!_0x6c1a79[_0xb479('0x32')][_0xb479('0x38')](_0xb479('0x39'))){_0x55de03['limit']=qs[_0xb479('0x19')](_0x6c1a79[_0xb479('0x32')][_0xb479('0x19')]);_0x55de03[_0xb479('0x18')]=qs[_0xb479('0x18')](_0x6c1a79[_0xb479('0x32')][_0xb479('0x18')]);}_0x55de03[_0xb479('0x3a')]=qs['sort'](_0x6c1a79[_0xb479('0x32')][_0xb479('0x3b')]);_0x55de03[_0xb479('0x3c')]=qs[_0xb479('0x33')](_[_0xb479('0x3d')](_0x6c1a79[_0xb479('0x32')],_0x218cdf[_0xb479('0x33')]),_0x2f6e91);if(_0x6c1a79[_0xb479('0x32')][_0xb479('0x3e')]){_0x55de03['where']=_[_0xb479('0x3f')](_0x55de03['where'],{'$or':_[_0xb479('0x2c')](_0x2f6e91,function(_0x4b1751){if(_0x4b1751[_0xb479('0x2f')]!==_0xb479('0x40')){var _0x589d79={};_0x589d79[_0x4b1751[_0xb479('0x29')]]={'$like':'%'+_0x6c1a79[_0xb479('0x32')][_0xb479('0x3e')]+'%'};return _0x589d79;}})});}_0x55de03=_[_0xb479('0x3f')]({},_0x55de03,_0x6c1a79[_0xb479('0x41')]);var _0x5aa31a={'where':_0x55de03[_0xb479('0x3c')]};return db['CmHopperAdditionalPhone']['count'](_0x5aa31a)[_0xb479('0x21')](function(_0x2215c2){_0x200136[_0xb479('0x1b')]=_0x2215c2;if(_0x6c1a79[_0xb479('0x32')][_0xb479('0x42')]){_0x55de03[_0xb479('0x43')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x55de03);})[_0xb479('0x21')](function(_0x5db39e){_0x200136[_0xb479('0x44')]=_0x5db39e;return _0x200136;})[_0xb479('0x21')](respondWithFilteredResult(_0x1304e0,_0x55de03))[_0xb479('0x45')](handleError(_0x1304e0,null));};exports[_0xb479('0x46')]=function(_0x3cdc48,_0x531683){var _0x2f9869={'raw':!![],'where':{'id':_0x3cdc48[_0xb479('0x47')]['id']}},_0x3e9995={};_0x3e9995[_0xb479('0x31')]=_['keys'](db['CmHopperAdditionalPhone'][_0xb479('0x48')]);_0x3e9995[_0xb479('0x32')]=_['keys'](_0x3cdc48[_0xb479('0x32')]);_0x3e9995[_0xb479('0x33')]=_[_0xb479('0x35')](_0x3e9995[_0xb479('0x31')],_0x3e9995[_0xb479('0x32')]);_0x2f9869['attributes']=_['intersection'](_0x3e9995[_0xb479('0x31')],qs[_0xb479('0x36')](_0x3cdc48[_0xb479('0x32')]['fields']));_0x2f9869[_0xb479('0x34')]=_0x2f9869['attributes'][_0xb479('0x37')]?_0x2f9869[_0xb479('0x34')]:_0x3e9995[_0xb479('0x31')];if(_0x3cdc48[_0xb479('0x32')][_0xb479('0x42')]){_0x2f9869[_0xb479('0x43')]=[{'all':!![]}];}_0x2f9869=_[_0xb479('0x3f')]({},_0x2f9869,_0x3cdc48[_0xb479('0x41')]);return db[_0xb479('0x2d')][_0xb479('0x49')](_0x2f9869)['then'](handleEntityNotFound(_0x531683,null))[_0xb479('0x21')](respondWithResult(_0x531683,null))['catch'](handleError(_0x531683,null));};exports['create']=function(_0x35817f,_0x148b3d){return db[_0xb479('0x2d')][_0xb479('0x4a')](_0x35817f[_0xb479('0x4b')],{})['then'](function(_0x5941fa){var _0xb4f5c8=_0x35817f[_0xb479('0x4c')][_0xb479('0x23')]({'plain':!![]});if(!_0xb4f5c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb4f5c8[_0xb479('0x4d')]===_0xb479('0x4c')){var _0x2ce9f4=_0x5941fa['get']({'plain':!![]});var _0x4b7144=_0xb479('0x24');return db[_0xb479('0x4e')][_0xb479('0x49')]({'where':{'name':_0x4b7144,'userProfileId':_0xb4f5c8[_0xb479('0x4f')]},'raw':!![]})[_0xb479('0x21')](function(_0x55ecbb){if(_0x55ecbb&&_0x55ecbb['autoAssociation']===0x0){return db[_0xb479('0x25')]['create']({'name':_0x2ce9f4[_0xb479('0x29')],'resourceId':_0x2ce9f4['id'],'type':_0x55ecbb['name'],'sectionId':_0x55ecbb['id']},{})[_0xb479('0x21')](function(){return _0x5941fa;});}else{return _0x5941fa;}})['catch'](function(_0x2f1c6c){logger[_0xb479('0x27')](_0xb479('0x50'),_0x2f1c6c);throw _0x2f1c6c;});}return _0x5941fa;})['then'](respondWithResult(_0x148b3d,0xc9))['catch'](handleError(_0x148b3d,null));};exports[_0xb479('0x51')]=function(_0x250d9c,_0x17f095){if(_0x250d9c['body']['id']){delete _0x250d9c[_0xb479('0x4b')]['id'];}return db[_0xb479('0x2d')][_0xb479('0x49')]({'where':{'id':_0x250d9c[_0xb479('0x47')]['id']}})[_0xb479('0x21')](handleEntityNotFound(_0x17f095,null))[_0xb479('0x21')](saveUpdates(_0x250d9c['body'],null))[_0xb479('0x21')](respondWithResult(_0x17f095,null))[_0xb479('0x45')](handleError(_0x17f095,null));};exports[_0xb479('0x22')]=function(_0x1c6231,_0x40bdd5){return db[_0xb479('0x2d')]['find']({'where':{'id':_0x1c6231[_0xb479('0x47')]['id']}})[_0xb479('0x21')](handleEntityNotFound(_0x40bdd5,null))[_0xb479('0x21')](removeEntity(_0x40bdd5,null))[_0xb479('0x45')](handleError(_0x40bdd5,null));}; \ No newline at end of file +var _0x01a2=['set','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','stack','name','index','CmHopperAdditionalPhone','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','include','find','user','role','UserProfileSection','userProfileId','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x1b6994,_0x561a7d){var _0xfb675=function(_0x4f0e47){while(--_0x4f0e47){_0x1b6994['push'](_0x1b6994['shift']());}};_0xfb675(++_0x561a7d);}(_0x01a2,0x1cb));var _0x201a=function(_0x1e7fc5,_0x569e0d){_0x1e7fc5=_0x1e7fc5-0x0;var _0x5ad53c=_0x01a2[_0x1e7fc5];return _0x5ad53c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x201a('0x0'));var zipdir=require(_0x201a('0x1'));var jsonpatch=require(_0x201a('0x2'));var rp=require(_0x201a('0x3'));var moment=require(_0x201a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x201a('0x5'));var path=require(_0x201a('0x6'));var sox=require(_0x201a('0x7'));var csv=require(_0x201a('0x8'));var ejs=require(_0x201a('0x9'));var fs=require('fs');var fs_extra=require(_0x201a('0xa'));var _=require(_0x201a('0xb'));var squel=require(_0x201a('0xc'));var crypto=require(_0x201a('0xd'));var jsforce=require(_0x201a('0xe'));var deskjs=require(_0x201a('0xf'));var toCsv=require(_0x201a('0x8'));var querystring=require(_0x201a('0x10'));var Papa=require(_0x201a('0x11'));var Redis=require(_0x201a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x201a('0x13'));var as=require(_0x201a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x201a('0x15'));var utils=require(_0x201a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x201a('0x17'));var db=require(_0x201a('0x18'))['db'];function respondWithStatusCode(_0x19c6ef,_0x2e4f88){_0x2e4f88=_0x2e4f88||0xcc;return function(_0x1dd9df){if(_0x1dd9df){return _0x19c6ef[_0x201a('0x19')](_0x2e4f88);}return _0x19c6ef[_0x201a('0x1a')](_0x2e4f88)[_0x201a('0x1b')]();};}function respondWithResult(_0x534e7b,_0x526d84){_0x526d84=_0x526d84||0xc8;return function(_0x239f77){if(_0x239f77){return _0x534e7b['status'](_0x526d84)[_0x201a('0x1c')](_0x239f77);}};}function respondWithFilteredResult(_0x29ca5c,_0x5924bc){return function(_0x38c5eb){if(_0x38c5eb){var _0x57f5e2=typeof _0x5924bc[_0x201a('0x1d')]===_0x201a('0x1e')&&typeof _0x5924bc[_0x201a('0x1f')]===_0x201a('0x1e');var _0x28a443=_0x38c5eb['count'];var _0x12cc5f=_0x57f5e2?0x0:_0x5924bc[_0x201a('0x1d')];var _0x3d3009=_0x57f5e2?_0x38c5eb[_0x201a('0x20')]:_0x5924bc[_0x201a('0x1d')]+_0x5924bc[_0x201a('0x1f')];var _0x3c932b;if(_0x3d3009>=_0x28a443){_0x3d3009=_0x28a443;_0x3c932b=0xc8;}else{_0x3c932b=0xce;}_0x29ca5c['status'](_0x3c932b);return _0x29ca5c[_0x201a('0x21')]('Content-Range',_0x12cc5f+'-'+_0x3d3009+'/'+_0x28a443)[_0x201a('0x1c')](_0x38c5eb);}return null;};}function patchUpdates(_0x11e5dc){return function(_0x557e93){try{jsonpatch[_0x201a('0x22')](_0x557e93,_0x11e5dc,!![]);}catch(_0x794c79){return BPromise[_0x201a('0x23')](_0x794c79);}return _0x557e93[_0x201a('0x24')]();};}function saveUpdates(_0x437924,_0x465e64){return function(_0x3077a3){if(_0x3077a3){return _0x3077a3[_0x201a('0x25')](_0x437924)[_0x201a('0x26')](function(_0x3298b9){return _0x3298b9;});}return null;};}function removeEntity(_0x3abfdd,_0x1abf5d){return function(_0x60aeb5){if(_0x60aeb5){return _0x60aeb5[_0x201a('0x27')]()[_0x201a('0x26')](function(){var _0x59d919=_0x60aeb5[_0x201a('0x28')]({'plain':!![]});var _0x1c5d78=_0x201a('0x29');return db[_0x201a('0x2a')]['destroy']({'where':{'type':_0x1c5d78,'resourceId':_0x59d919['id']}})[_0x201a('0x26')](function(){return _0x60aeb5;});})[_0x201a('0x26')](function(){_0x3abfdd['status'](0xcc)[_0x201a('0x1b')]();});}};}function handleEntityNotFound(_0x5c43c0,_0x559d33){return function(_0x73806b){if(!_0x73806b){_0x5c43c0[_0x201a('0x19')](0x194);}return _0x73806b;};}function handleError(_0x162fc4,_0x2f6b9f){_0x2f6b9f=_0x2f6b9f||0x1f4;return function(_0x2ec8d5){logger['error'](_0x2ec8d5[_0x201a('0x2b')]);if(_0x2ec8d5[_0x201a('0x2c')]){delete _0x2ec8d5[_0x201a('0x2c')];}_0x162fc4[_0x201a('0x1a')](_0x2f6b9f)['send'](_0x2ec8d5);};}exports[_0x201a('0x2d')]=function(_0x44e6ab,_0xc086de){var _0x1f8fba={},_0x530ef5={},_0x55d6c5={'count':0x0,'rows':[]};var _0x1819cd=_['map'](db[_0x201a('0x2e')][_0x201a('0x2f')],function(_0x46e033){return{'name':_0x46e033[_0x201a('0x30')],'type':_0x46e033['type']['key']};});_0x530ef5['model']=_[_0x201a('0x31')](_0x1819cd,_0x201a('0x2c'));_0x530ef5[_0x201a('0x32')]=_[_0x201a('0x33')](_0x44e6ab[_0x201a('0x32')]);_0x530ef5[_0x201a('0x34')]=_[_0x201a('0x35')](_0x530ef5[_0x201a('0x36')],_0x530ef5[_0x201a('0x32')]);_0x1f8fba[_0x201a('0x37')]=_[_0x201a('0x35')](_0x530ef5[_0x201a('0x36')],qs[_0x201a('0x38')](_0x44e6ab['query'][_0x201a('0x38')]));_0x1f8fba['attributes']=_0x1f8fba[_0x201a('0x37')][_0x201a('0x39')]?_0x1f8fba[_0x201a('0x37')]:_0x530ef5[_0x201a('0x36')];if(!_0x44e6ab[_0x201a('0x32')]['hasOwnProperty']('nolimit')){_0x1f8fba[_0x201a('0x1f')]=qs['limit'](_0x44e6ab[_0x201a('0x32')][_0x201a('0x1f')]);_0x1f8fba[_0x201a('0x1d')]=qs[_0x201a('0x1d')](_0x44e6ab['query'][_0x201a('0x1d')]);}_0x1f8fba[_0x201a('0x3a')]=qs['sort'](_0x44e6ab[_0x201a('0x32')][_0x201a('0x3b')]);_0x1f8fba[_0x201a('0x3c')]=qs['filters'](_[_0x201a('0x3d')](_0x44e6ab[_0x201a('0x32')],_0x530ef5['filters']),_0x1819cd);if(_0x44e6ab[_0x201a('0x32')][_0x201a('0x3e')]){_0x1f8fba[_0x201a('0x3c')]=_[_0x201a('0x3f')](_0x1f8fba[_0x201a('0x3c')],{'$or':_[_0x201a('0x31')](_0x1819cd,function(_0x1c94e3){if(_0x1c94e3[_0x201a('0x40')]!==_0x201a('0x41')){var _0x47ca87={};_0x47ca87[_0x1c94e3[_0x201a('0x2c')]]={'$like':'%'+_0x44e6ab[_0x201a('0x32')][_0x201a('0x3e')]+'%'};return _0x47ca87;}})});}_0x1f8fba=_['merge']({},_0x1f8fba,_0x44e6ab[_0x201a('0x42')]);var _0x31e479={'where':_0x1f8fba[_0x201a('0x3c')]};return db[_0x201a('0x2e')][_0x201a('0x20')](_0x31e479)[_0x201a('0x26')](function(_0x5440b4){_0x55d6c5[_0x201a('0x20')]=_0x5440b4;if(_0x44e6ab[_0x201a('0x32')][_0x201a('0x43')]){_0x1f8fba['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x1f8fba);})[_0x201a('0x26')](function(_0x1277c2){_0x55d6c5[_0x201a('0x44')]=_0x1277c2;return _0x55d6c5;})['then'](respondWithFilteredResult(_0xc086de,_0x1f8fba))[_0x201a('0x45')](handleError(_0xc086de,null));};exports[_0x201a('0x46')]=function(_0x28bd2f,_0x4e2a31){var _0xddaea1={'raw':!![],'where':{'id':_0x28bd2f['params']['id']}},_0x4b873f={};_0x4b873f[_0x201a('0x36')]=_[_0x201a('0x33')](db[_0x201a('0x2e')]['rawAttributes']);_0x4b873f[_0x201a('0x32')]=_[_0x201a('0x33')](_0x28bd2f['query']);_0x4b873f[_0x201a('0x34')]=_[_0x201a('0x35')](_0x4b873f[_0x201a('0x36')],_0x4b873f[_0x201a('0x32')]);_0xddaea1['attributes']=_[_0x201a('0x35')](_0x4b873f[_0x201a('0x36')],qs[_0x201a('0x38')](_0x28bd2f[_0x201a('0x32')][_0x201a('0x38')]));_0xddaea1[_0x201a('0x37')]=_0xddaea1[_0x201a('0x37')][_0x201a('0x39')]?_0xddaea1['attributes']:_0x4b873f[_0x201a('0x36')];if(_0x28bd2f[_0x201a('0x32')]['includeAll']){_0xddaea1[_0x201a('0x47')]=[{'all':!![]}];}_0xddaea1=_[_0x201a('0x3f')]({},_0xddaea1,_0x28bd2f[_0x201a('0x42')]);return db['CmHopperAdditionalPhone'][_0x201a('0x48')](_0xddaea1)[_0x201a('0x26')](handleEntityNotFound(_0x4e2a31,null))[_0x201a('0x26')](respondWithResult(_0x4e2a31,null))['catch'](handleError(_0x4e2a31,null));};exports['create']=function(_0x18abb1,_0x19b1f7){return db[_0x201a('0x2e')]['create'](_0x18abb1['body'],{})[_0x201a('0x26')](function(_0x48158c){var _0x17a4d4=_0x18abb1[_0x201a('0x49')][_0x201a('0x28')]({'plain':!![]});if(!_0x17a4d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17a4d4[_0x201a('0x4a')]==='user'){var _0x18c239=_0x48158c[_0x201a('0x28')]({'plain':!![]});var _0x1701c4=_0x201a('0x29');return db[_0x201a('0x4b')]['find']({'where':{'name':_0x1701c4,'userProfileId':_0x17a4d4[_0x201a('0x4c')]},'raw':!![]})[_0x201a('0x26')](function(_0x2b1029){if(_0x2b1029&&_0x2b1029['autoAssociation']===0x0){return db[_0x201a('0x2a')][_0x201a('0x4d')]({'name':_0x18c239[_0x201a('0x2c')],'resourceId':_0x18c239['id'],'type':_0x2b1029[_0x201a('0x2c')],'sectionId':_0x2b1029['id']},{})[_0x201a('0x26')](function(){return _0x48158c;});}else{return _0x48158c;}})['catch'](function(_0xd02c83){logger[_0x201a('0x4e')](_0x201a('0x4f'),_0xd02c83);throw _0xd02c83;});}return _0x48158c;})[_0x201a('0x26')](respondWithResult(_0x19b1f7,0xc9))[_0x201a('0x45')](handleError(_0x19b1f7,null));};exports[_0x201a('0x25')]=function(_0x47cdfd,_0xdcb64d){if(_0x47cdfd[_0x201a('0x50')]['id']){delete _0x47cdfd[_0x201a('0x50')]['id'];}return db['CmHopperAdditionalPhone'][_0x201a('0x48')]({'where':{'id':_0x47cdfd['params']['id']}})[_0x201a('0x26')](handleEntityNotFound(_0xdcb64d,null))[_0x201a('0x26')](saveUpdates(_0x47cdfd[_0x201a('0x50')],null))[_0x201a('0x26')](respondWithResult(_0xdcb64d,null))[_0x201a('0x45')](handleError(_0xdcb64d,null));};exports['destroy']=function(_0x4ce083,_0x4e19ed){return db[_0x201a('0x2e')][_0x201a('0x48')]({'where':{'id':_0x4ce083[_0x201a('0x51')]['id']}})[_0x201a('0x26')](handleEntityNotFound(_0x4e19ed,null))[_0x201a('0x26')](removeEntity(_0x4e19ed,null))[_0x201a('0x45')](handleError(_0x4e19ed,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 6cbe9f7..08e6380 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 _0x37fb=['rimraf','exports','define','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x3cd91d,_0x163516){var _0x3b4fab=function(_0x1b3319){while(--_0x1b3319){_0x3cd91d['push'](_0x3cd91d['shift']());}};_0x3b4fab(++_0x163516);}(_0x37fb,0x1e0));var _0xb37f=function(_0x341a3e,_0x2f5e29){_0x341a3e=_0x341a3e-0x0;var _0x134c26=_0x37fb[_0x341a3e];return _0x134c26;};'use strict';var _=require(_0xb37f('0x0'));var util=require(_0xb37f('0x1'));var logger=require(_0xb37f('0x2'))('api');var moment=require(_0xb37f('0x3'));var BPromise=require(_0xb37f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb37f('0x5'));var rimraf=require(_0xb37f('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xb37f('0x7')]=function(_0x582937,_0x5917de){return _0x582937[_0xb37f('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeade=['rimraf','define','CmHopperAdditionalPhone','lodash','api','moment','bluebird','request-promise'];(function(_0x27ddf5,_0x5a3e18){var _0x26e74a=function(_0x5f24ac){while(--_0x5f24ac){_0x27ddf5['push'](_0x27ddf5['shift']());}};_0x26e74a(++_0x5a3e18);}(_0xeade,0x16b));var _0xeead=function(_0x478c5c,_0x11b167){_0x478c5c=_0x478c5c-0x0;var _0x3b32f3=_0xeade[_0x478c5c];return _0x3b32f3;};'use strict';var _=require(_0xeead('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeead('0x1'));var moment=require(_0xeead('0x2'));var BPromise=require(_0xeead('0x3'));var rp=require(_0xeead('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeead('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x3c0702,_0x1c2451){return _0x3c0702[_0xeead('0x6')](_0xeead('0x7'),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 d502c86..abdcae6 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 _0x6b8f=['rpc','../../config/environment','jayson/promise','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','ListId','duration','waitTime','scheduledat','add','minutes','phone','countnosuchnumberretry','createdAt','isNil','countbusyretry','updatedAt','hopperToAdd','additionalToHop','transaction','update','field','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x42e631,_0x274c81){var _0x19bc46=function(_0x28e4cf){while(--_0x28e4cf){_0x42e631['push'](_0x42e631['shift']());}};_0x19bc46(++_0x274c81);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x5e08ac,_0x223bbf){_0x5e08ac=_0x5e08ac-0x0;var _0x92b578=_0x6b8f[_0x5e08ac];return _0x92b578;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var moment=require('moment');var BPromise=require(_0xf6b8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6b8('0x2'))['db'];var utils=require(_0xf6b8('0x3'));var logger=require('../../config/logger')(_0xf6b8('0x4'));var config=require(_0xf6b8('0x5'));var jayson=require(_0xf6b8('0x6'));var client=jayson['client'][_0xf6b8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x79c66d,_0x446336,_0x3c3430){return new BPromise(function(_0x557910,_0x5f07f4){return client[_0xf6b8('0x8')](_0x79c66d,_0x3c3430)['then'](function(_0x24458c){logger[_0xf6b8('0x9')](_0xf6b8('0xa'),_0x446336,_0xf6b8('0xb'));logger[_0xf6b8('0xc')](_0xf6b8('0xd'),_0x446336,'request\x20sent',JSON['stringify'](_0x24458c));if(_0x24458c['error']){if(_0x24458c[_0xf6b8('0xe')][_0xf6b8('0xf')]===0x1f4){logger[_0xf6b8('0xe')](_0xf6b8('0xa'),_0x446336,_0x24458c['error']['message']);return _0x5f07f4(_0x24458c[_0xf6b8('0xe')][_0xf6b8('0x10')]);}logger['error'](_0xf6b8('0xa'),_0x446336,_0x24458c[_0xf6b8('0xe')][_0xf6b8('0x10')]);return _0x557910(_0x24458c['error'][_0xf6b8('0x10')]);}else{logger['info'](_0xf6b8('0xa'),_0x446336,_0xf6b8('0xb'));_0x557910(_0x24458c[_0xf6b8('0x11')][_0xf6b8('0x10')]);}})[_0xf6b8('0x12')](function(_0x567b58){logger['error'](_0xf6b8('0xa'),_0x446336,_0x567b58);_0x5f07f4(_0x567b58);});});}exports['VerifyAdditionalPhones']=function(_0x3cf63c){var _0x206a84=this;return new Promise(function(_0x4a93a8,_0x58cd71){return db[_0xf6b8('0x13')][_0xf6b8('0x14')]({'raw':!![],'where':{'ContactId':_0x3cf63c[_0xf6b8('0x15')][_0xf6b8('0x16')],'ListId':_0x3cf63c['body']['ListId'],'VoiceQueueId':_0x3cf63c['body'][_0xf6b8('0x17')]===undefined?null:_0x3cf63c[_0xf6b8('0x15')][_0xf6b8('0x17')],'CampaignId':_0x3cf63c['body'][_0xf6b8('0x18')]===undefined?null:_0x3cf63c[_0xf6b8('0x15')][_0xf6b8('0x18')]}})[_0xf6b8('0x19')](function(_0x5dd616){if(_0x5dd616!=null){return db[_0xf6b8('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5dd616['id'],'OrderBy':{'$gt':_0x5dd616[_0xf6b8('0x1b')]}},'order':[[_0xf6b8('0x1b'),_0xf6b8('0x1c')]]})[_0xf6b8('0x19')](function(_0x565e45){var _0x55c72=0x0;if(_0x565e45){if(_0x565e45['countbusyretry']+_0x565e45[_0xf6b8('0x1d')]+_0x565e45[_0xf6b8('0x1e')]+_0x565e45['countnosuchnumberretry']+_0x565e45[_0xf6b8('0x1f')]+_0x565e45[_0xf6b8('0x20')]+_0x565e45[_0xf6b8('0x21')]+_0x565e45[_0xf6b8('0x22')]<_0x3cf63c[_0xf6b8('0x23')]['dialGlobalMaxRetry'])_0x55c72=0x1;_0x4a93a8({'additional':_0x55c72});}else{return db['CmHopperAdditionalPhone'][_0xf6b8('0x14')]({'raw':!![],'where':{'CmHopperId':_0x5dd616['id']},'order':[[_0xf6b8('0x1b'),'ASC']]})[_0xf6b8('0x19')](function(_0x27e46d){var _0x888319=0x0;if(_0x27e46d){if(_0x27e46d['countbusyretry']+_0x27e46d[_0xf6b8('0x1d')]+_0x27e46d[_0xf6b8('0x1e')]+_0x27e46d['countnosuchnumberretry']+_0x27e46d[_0xf6b8('0x1f')]+_0x27e46d[_0xf6b8('0x20')]+_0x27e46d[_0xf6b8('0x21')]+_0x27e46d[_0xf6b8('0x22')]<_0x3cf63c['entity'][_0xf6b8('0x24')])_0x888319=0x1;_0x4a93a8({'additional':_0x888319});}else{_0x4a93a8({'additional':0x0});}})[_0xf6b8('0x12')](function(_0x4006a6){logger['error'](_0xf6b8('0x25'),_0x4006a6[_0xf6b8('0x10')],_0x3cf63c);_0x58cd71(_0x206a84[_0xf6b8('0xe')](0x1f4,_0x4006a6['message']));});}})[_0xf6b8('0x12')](function(_0x11b040){logger[_0xf6b8('0xe')](_0xf6b8('0x25'),_0x11b040['message'],_0x3cf63c);_0x58cd71(_0x206a84[_0xf6b8('0xe')](0x1f4,_0x11b040[_0xf6b8('0x10')]));});}else _0x4a93a8({'additional':0x0});});});};exports[_0xf6b8('0x26')]=function(_0x5e0ed9){var _0x583341=this;return new Promise(function(_0xb3487a,_0x4602b1){return db[_0xf6b8('0x13')][_0xf6b8('0x14')]({'raw':!![],'where':{'ContactId':_0x5e0ed9[_0xf6b8('0x15')][_0xf6b8('0x16')],'ListId':_0x5e0ed9[_0xf6b8('0x15')][_0xf6b8('0x27')],'VoiceQueueId':_0x5e0ed9[_0xf6b8('0x15')][_0xf6b8('0x17')]===undefined?null:_0x5e0ed9[_0xf6b8('0x15')][_0xf6b8('0x17')],'CampaignId':_0x5e0ed9[_0xf6b8('0x15')][_0xf6b8('0x18')]===undefined?null:_0x5e0ed9[_0xf6b8('0x15')][_0xf6b8('0x18')]}})[_0xf6b8('0x19')](function(_0x132f2b){if(_0x132f2b!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x132f2b['id'],'OrderBy':{'$gte':_0x132f2b[_0xf6b8('0x1b')]}},'order':[[_0xf6b8('0x1b'),_0xf6b8('0x1c')]]})[_0xf6b8('0x19')](function(_0x3760b8){if(_0x3760b8)return activateAdditionalPhone(_0x132f2b,_0x5e0ed9[_0xf6b8('0x15')],_0x3760b8,_0x5e0ed9[_0xf6b8('0x28')],_0x5e0ed9[_0xf6b8('0x29')])[_0xf6b8('0x19')](function(_0x3238e8){_0xb3487a(_0x3238e8);});else{return db[_0xf6b8('0x1a')][_0xf6b8('0x14')]({'raw':!![],'where':{'CmHopperId':_0x132f2b['id']},'order':[['OrderBy',_0xf6b8('0x1c')]]})[_0xf6b8('0x19')](function(_0x5d26ad){if(_0x5d26ad)return activateAdditionalPhone(_0x132f2b,_0x5e0ed9[_0xf6b8('0x15')],_0x5d26ad,_0x5e0ed9[_0xf6b8('0x28')],_0x5e0ed9[_0xf6b8('0x29')])[_0xf6b8('0x19')](function(_0x844393){_0xb3487a(_0x844393);});else{_0xb3487a({'id':_0x132f2b['id'],'phone':''});}})[_0xf6b8('0x12')](function(_0x1896a5){logger[_0xf6b8('0xe')](_0xf6b8('0x25'),_0x1896a5[_0xf6b8('0x10')],_0x5e0ed9);_0x4602b1(_0x583341[_0xf6b8('0xe')](0x1f4,_0x1896a5[_0xf6b8('0x10')]));});}})[_0xf6b8('0x12')](function(_0x54897d){logger['error']('VerifyAdditionalPhones',_0x54897d['message'],_0x5e0ed9);_0x4602b1(_0x583341[_0xf6b8('0xe')](0x1f4,_0x54897d[_0xf6b8('0x10')]));});}else _0xb3487a(0x1);});});};function activateAdditionalPhone(_0x45daea,_0x163e6d,_0x2b11d7,_0xc8b382,_0x1390dc){return new Promise(function(_0x48f4cb,_0x1f5e72){logger['info'](_0xf6b8('0x25'),_0x2b11d7);var _0x430247;if(moment()>moment(_0x2b11d7[_0xf6b8('0x2a')])){_0x430247=moment()[_0xf6b8('0x2b')](_0x1390dc||0x3,_0xf6b8('0x2c'));}else{if(_0x2b11d7['OrderBy']==0x0){_0x430247=moment(_0x2b11d7[_0xf6b8('0x2a')]);}else{_0x430247=moment()[_0xf6b8('0x2b')](_0x1390dc||0x3,_0xf6b8('0x2c'));}}var _0x448243={'phone':_0x45daea[_0xf6b8('0x2d')],'active':0x0,'OrderBy':_['isNil'](_0x45daea[_0xf6b8('0x1b')])?0x0:_0x45daea[_0xf6b8('0x1b')],'scheduledat':moment()[_0xf6b8('0x2b')](_0xc8b382||0x1,'minutes'),'countbusyretry':_0x163e6d['countbusyretry'],'countcongestionretry':_0x163e6d[_0xf6b8('0x1d')],'countnoanswerretry':_0x163e6d[_0xf6b8('0x1e')],'countnosuchnumberretry':_0x163e6d[_0xf6b8('0x2e')],'countdropretry':_0x163e6d[_0xf6b8('0x1f')],'countabandonedretry':_0x163e6d['countabandonedretry'],'countmachineretry':_0x163e6d['countmachineretry'],'countagentrejectretry':_0x163e6d['countagentrejectretry'],'createdAt':_0x163e6d[_0xf6b8('0x2f')],'updatedAt':_0x163e6d['updatedAt']};var _0x7865dc={'CmHopperId':_0x45daea['id'],'phone':_0x2b11d7[_0xf6b8('0x2d')],'active':0x0,'OrderBy':_[_0xf6b8('0x30')](_0x2b11d7[_0xf6b8('0x1b')])?0x0:_0x2b11d7[_0xf6b8('0x1b')],'scheduledat':_0x430247,'countbusyretry':_0x2b11d7[_0xf6b8('0x31')],'countcongestionretry':_0x2b11d7[_0xf6b8('0x1d')],'countnoanswerretry':_0x2b11d7[_0xf6b8('0x1e')],'countnosuchnumberretry':_0x2b11d7[_0xf6b8('0x2e')],'countdropretry':_0x2b11d7['countdropretry'],'countabandonedretry':_0x2b11d7[_0xf6b8('0x20')],'countmachineretry':_0x2b11d7['countmachineretry'],'countagentrejectretry':_0x2b11d7[_0xf6b8('0x22')],'createdAt':_0x2b11d7[_0xf6b8('0x2f')],'updatedAt':_0x2b11d7[_0xf6b8('0x32')]};logger[_0xf6b8('0x9')](_0xf6b8('0x33'),_0x448243);logger[_0xf6b8('0x9')](_0xf6b8('0x34'),_0x7865dc);return db['sequelize'][_0xf6b8('0x35')](function(_0x6024f5){return db[_0xf6b8('0x1a')][_0xf6b8('0x36')](_0x448243,{'where':{'id':_0x2b11d7['id']}},{'transaction':_0x6024f5})['then'](function(){return db[_0xf6b8('0x13')][_0xf6b8('0x36')](_0x7865dc,{'where':{'id':_0x45daea['id']}},{'transaction':_0x6024f5});});})['then'](function(_0x3a38eb){_0x48f4cb({'id':_0x45daea['id'],'phone':_0x2b11d7[_0xf6b8('0x2d')]});})[_0xf6b8('0x12')](function(_0x55eeb5){logger[_0xf6b8('0xe')]('VerifyAdditionalPhones',_0x55eeb5[_0xf6b8('0x10')],req);_0x1f5e72(_this[_0xf6b8('0xe')](0x1f4,_0x55eeb5['message']));});});}exports['IncrementPreviewCounters']=function(_0x55c392){var _0x22c1eb=this;return new Promise(function(_0x8f384e,_0x2cac02){return db[_0xf6b8('0x13')]['update'](_0x55c392[_0xf6b8('0x15')][_0xf6b8('0x37')],{'where':{'id':_0x55c392[_0xf6b8('0x15')]['id']}})[_0xf6b8('0x19')](function(_0x7f08b8){_0x8f384e(_0x7f08b8);})[_0xf6b8('0x12')](function(_0x4075ec){logger['error']('IncrementPreviewCounters',_0x4075ec[_0xf6b8('0x10')],_0x55c392);_0x2cac02(_0x22c1eb[_0xf6b8('0xe')](0x1f4,_0x4075ec['message']));});});}; \ No newline at end of file +var _0xac9d=['ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','countnosuchnumberretry','countmachineretry','entity','VerifyAdditionalPhones','ASC','duration','waitTime','add','minutes','scheduledat','phone','isNil','countcongestionretry','createdAt','updatedAt','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopper','findOne','body'];(function(_0x1ce25f,_0x6d3d55){var _0x38aac3=function(_0x2ad6a1){while(--_0x2ad6a1){_0x1ce25f['push'](_0x1ce25f['shift']());}};_0x38aac3(++_0x6d3d55);}(_0xac9d,0x14d));var _0xdac9=function(_0x586837,_0x4f9ed1){_0x586837=_0x586837-0x0;var _0xea18c3=_0xac9d[_0x586837];return _0xea18c3;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){return client['request'](_0x776b6c,_0x39f560)[_0xdac9('0xc')](function(_0x3a013b){logger[_0xdac9('0xd')](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));logger[_0xdac9('0x10')](_0xdac9('0x11'),_0x1c78c5,_0xdac9('0xf'),JSON[_0xdac9('0x12')](_0x3a013b));if(_0x3a013b['error']){if(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x14')]===0x1f4){logger['error'](_0xdac9('0xe'),_0x1c78c5,_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);return _0x2b1d6f(_0x3a013b['error'][_0xdac9('0x15')]);}logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x3a013b['error']['message']);return _0x5531af(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);}else{logger['info'](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));_0x5531af(_0x3a013b[_0xdac9('0x16')][_0xdac9('0x15')]);}})[_0xdac9('0x17')](function(_0x393acc){logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x393acc);_0x2b1d6f(_0x393acc);});});}exports['VerifyAdditionalPhones']=function(_0x283343){var _0x36b817=this;return new Promise(function(_0x571e07,_0x1cd239){return db[_0xdac9('0x18')][_0xdac9('0x19')]({'raw':!![],'where':{'ContactId':_0x283343[_0xdac9('0x1a')]['ContactId'],'ListId':_0x283343['body'][_0xdac9('0x1b')],'VoiceQueueId':_0x283343[_0xdac9('0x1a')][_0xdac9('0x1c')]===undefined?null:_0x283343[_0xdac9('0x1a')]['VoiceQueueId'],'CampaignId':_0x283343[_0xdac9('0x1a')][_0xdac9('0x1d')]===undefined?null:_0x283343[_0xdac9('0x1a')][_0xdac9('0x1d')]}})[_0xdac9('0xc')](function(_0x42317c){if(_0x42317c!=null){return db[_0xdac9('0x1e')][_0xdac9('0x19')]({'raw':!![],'where':{'CmHopperId':_0x42317c['id'],'OrderBy':{'$gt':_0x42317c[_0xdac9('0x1f')]}},'order':[[_0xdac9('0x1f'),'ASC']]})[_0xdac9('0xc')](function(_0x11f4fd){var _0x3c942c=0x0;if(_0x11f4fd){if(_0x11f4fd[_0xdac9('0x20')]+_0x11f4fd['countcongestionretry']+_0x11f4fd[_0xdac9('0x21')]+_0x11f4fd['countnosuchnumberretry']+_0x11f4fd[_0xdac9('0x22')]+_0x11f4fd[_0xdac9('0x23')]+_0x11f4fd['countmachineretry']+_0x11f4fd[_0xdac9('0x24')]<_0x283343['entity'][_0xdac9('0x25')])_0x3c942c=0x1;_0x571e07({'additional':_0x3c942c});}else{return db[_0xdac9('0x1e')][_0xdac9('0x19')]({'raw':!![],'where':{'CmHopperId':_0x42317c['id']},'order':[[_0xdac9('0x1f'),'ASC']]})['then'](function(_0x13e9de){var _0x170afd=0x0;if(_0x13e9de){if(_0x13e9de['countbusyretry']+_0x13e9de['countcongestionretry']+_0x13e9de[_0xdac9('0x21')]+_0x13e9de[_0xdac9('0x26')]+_0x13e9de[_0xdac9('0x22')]+_0x13e9de[_0xdac9('0x23')]+_0x13e9de[_0xdac9('0x27')]+_0x13e9de[_0xdac9('0x24')]<_0x283343[_0xdac9('0x28')][_0xdac9('0x25')])_0x170afd=0x1;_0x571e07({'additional':_0x170afd});}else{_0x571e07({'additional':0x0});}})[_0xdac9('0x17')](function(_0x2f36f4){logger[_0xdac9('0x13')](_0xdac9('0x29'),_0x2f36f4[_0xdac9('0x15')],_0x283343);_0x1cd239(_0x36b817[_0xdac9('0x13')](0x1f4,_0x2f36f4[_0xdac9('0x15')]));});}})[_0xdac9('0x17')](function(_0x372f02){logger[_0xdac9('0x13')](_0xdac9('0x29'),_0x372f02[_0xdac9('0x15')],_0x283343);_0x1cd239(_0x36b817[_0xdac9('0x13')](0x1f4,_0x372f02['message']));});}else _0x571e07({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x1e6832){var _0x416501=this;return new Promise(function(_0x1cf2c7,_0x3ecff5){return db[_0xdac9('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x1e6832[_0xdac9('0x1a')]['ContactId'],'ListId':_0x1e6832[_0xdac9('0x1a')][_0xdac9('0x1b')],'VoiceQueueId':_0x1e6832['body'][_0xdac9('0x1c')]===undefined?null:_0x1e6832['body']['VoiceQueueId'],'CampaignId':_0x1e6832[_0xdac9('0x1a')][_0xdac9('0x1d')]===undefined?null:_0x1e6832[_0xdac9('0x1a')][_0xdac9('0x1d')]}})[_0xdac9('0xc')](function(_0x363d93){if(_0x363d93!=null){return db['CmHopperAdditionalPhone'][_0xdac9('0x19')]({'raw':!![],'where':{'CmHopperId':_0x363d93['id'],'OrderBy':{'$gte':_0x363d93[_0xdac9('0x1f')]}},'order':[['OrderBy',_0xdac9('0x2a')]]})[_0xdac9('0xc')](function(_0x2a24f0){if(_0x2a24f0)return activateAdditionalPhone(_0x363d93,_0x1e6832[_0xdac9('0x1a')],_0x2a24f0,_0x1e6832[_0xdac9('0x2b')],_0x1e6832[_0xdac9('0x2c')])[_0xdac9('0xc')](function(_0x561fc7){_0x1cf2c7(_0x561fc7);});else{return db[_0xdac9('0x1e')][_0xdac9('0x19')]({'raw':!![],'where':{'CmHopperId':_0x363d93['id']},'order':[[_0xdac9('0x1f'),'ASC']]})[_0xdac9('0xc')](function(_0x338e4a){if(_0x338e4a)return activateAdditionalPhone(_0x363d93,_0x1e6832[_0xdac9('0x1a')],_0x338e4a,_0x1e6832[_0xdac9('0x2b')],_0x1e6832['waitTime'])['then'](function(_0x1d0243){_0x1cf2c7(_0x1d0243);});else{_0x1cf2c7({'id':_0x363d93['id'],'phone':''});}})[_0xdac9('0x17')](function(_0x2889f7){logger[_0xdac9('0x13')](_0xdac9('0x29'),_0x2889f7['message'],_0x1e6832);_0x3ecff5(_0x416501[_0xdac9('0x13')](0x1f4,_0x2889f7['message']));});}})[_0xdac9('0x17')](function(_0xaca43c){logger[_0xdac9('0x13')](_0xdac9('0x29'),_0xaca43c[_0xdac9('0x15')],_0x1e6832);_0x3ecff5(_0x416501[_0xdac9('0x13')](0x1f4,_0xaca43c[_0xdac9('0x15')]));});}else _0x1cf2c7(0x1);});});};function activateAdditionalPhone(_0xb176e0,_0x11362d,_0x8a0538,_0x89240c,_0x24b570){return new Promise(function(_0x278826,_0x441676){logger['info'](_0xdac9('0x29'),_0x8a0538);var _0x272b52;if(moment()>moment(_0x8a0538['scheduledat'])){_0x272b52=moment()[_0xdac9('0x2d')](_0x24b570||0x3,_0xdac9('0x2e'));}else{if(_0x8a0538[_0xdac9('0x1f')]==0x0){_0x272b52=moment(_0x8a0538[_0xdac9('0x2f')]);}else{_0x272b52=moment()[_0xdac9('0x2d')](_0x24b570||0x3,_0xdac9('0x2e'));}}var _0x4c334a={'phone':_0xb176e0[_0xdac9('0x30')],'active':0x0,'OrderBy':_['isNil'](_0xb176e0[_0xdac9('0x1f')])?0x0:_0xb176e0[_0xdac9('0x1f')],'scheduledat':moment()[_0xdac9('0x2d')](_0x89240c||0x1,_0xdac9('0x2e')),'countbusyretry':_0x11362d['countbusyretry'],'countcongestionretry':_0x11362d['countcongestionretry'],'countnoanswerretry':_0x11362d['countnoanswerretry'],'countnosuchnumberretry':_0x11362d[_0xdac9('0x26')],'countdropretry':_0x11362d['countdropretry'],'countabandonedretry':_0x11362d['countabandonedretry'],'countmachineretry':_0x11362d[_0xdac9('0x27')],'countagentrejectretry':_0x11362d[_0xdac9('0x24')],'createdAt':_0x11362d['createdAt'],'updatedAt':_0x11362d['updatedAt']};var _0x1666c5={'CmHopperId':_0xb176e0['id'],'phone':_0x8a0538[_0xdac9('0x30')],'active':0x0,'OrderBy':_[_0xdac9('0x31')](_0x8a0538[_0xdac9('0x1f')])?0x0:_0x8a0538[_0xdac9('0x1f')],'scheduledat':_0x272b52,'countbusyretry':_0x8a0538[_0xdac9('0x20')],'countcongestionretry':_0x8a0538[_0xdac9('0x32')],'countnoanswerretry':_0x8a0538[_0xdac9('0x21')],'countnosuchnumberretry':_0x8a0538['countnosuchnumberretry'],'countdropretry':_0x8a0538[_0xdac9('0x22')],'countabandonedretry':_0x8a0538[_0xdac9('0x23')],'countmachineretry':_0x8a0538[_0xdac9('0x27')],'countagentrejectretry':_0x8a0538[_0xdac9('0x24')],'createdAt':_0x8a0538[_0xdac9('0x33')],'updatedAt':_0x8a0538[_0xdac9('0x34')]};logger[_0xdac9('0xd')](_0xdac9('0x35'),_0x4c334a);logger[_0xdac9('0xd')](_0xdac9('0x36'),_0x1666c5);return db[_0xdac9('0x37')][_0xdac9('0x38')](function(_0x33de66){return db[_0xdac9('0x1e')]['update'](_0x4c334a,{'where':{'id':_0x8a0538['id']}},{'transaction':_0x33de66})['then'](function(){return db['CmHopper'][_0xdac9('0x39')](_0x1666c5,{'where':{'id':_0xb176e0['id']}},{'transaction':_0x33de66});});})[_0xdac9('0xc')](function(_0x59478e){_0x278826({'id':_0xb176e0['id'],'phone':_0x8a0538[_0xdac9('0x30')]});})[_0xdac9('0x17')](function(_0x45c869){logger['error'](_0xdac9('0x29'),_0x45c869[_0xdac9('0x15')],req);_0x441676(_this['error'](0x1f4,_0x45c869['message']));});});}exports[_0xdac9('0x3a')]=function(_0x4469d8){var _0x222de9=this;return new Promise(function(_0x370532,_0x39df88){return db[_0xdac9('0x18')][_0xdac9('0x39')](_0x4469d8[_0xdac9('0x1a')][_0xdac9('0x3b')],{'where':{'id':_0x4469d8[_0xdac9('0x1a')]['id']}})[_0xdac9('0xc')](function(_0x32b5f5){_0x370532(_0x32b5f5);})[_0xdac9('0x17')](function(_0x314e03){logger[_0xdac9('0x13')]('IncrementPreviewCounters',_0x314e03[_0xdac9('0x15')],_0x4469d8);_0x39df88(_0x222de9[_0xdac9('0x13')](0x1f4,_0x314e03[_0xdac9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 3be9754..6f6c3bc 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 _0x4a9a=['update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','/:id'];(function(_0x40b8f3,_0x4acc40){var _0x1b5c38=function(_0x52e7a6){while(--_0x52e7a6){_0x40b8f3['push'](_0x40b8f3['shift']());}};_0x1b5c38(++_0x4acc40);}(_0x4a9a,0x123));var _0xa4a9=function(_0x54de73,_0x522510){_0x54de73=_0x54de73-0x0;var _0x210f88=_0x4a9a[_0x54de73];return _0x210f88;};'use strict';var multer=require('multer');var util=require(_0xa4a9('0x0'));var path=require(_0xa4a9('0x1'));var timeout=require('connect-timeout');var express=require(_0xa4a9('0x2'));var router=express[_0xa4a9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa4a9('0x4'));var interaction=require(_0xa4a9('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0xa4a9('0x6')]('/',auth[_0xa4a9('0x7')](),controller[_0xa4a9('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa4a9('0x9')]);router[_0xa4a9('0xa')]('/',auth['isAuthenticated'](),controller[_0xa4a9('0xb')]);router['put'](_0xa4a9('0xc'),auth[_0xa4a9('0x7')](),controller[_0xa4a9('0xd')]);router['delete'](_0xa4a9('0xc'),auth['isAuthenticated'](),controller[_0xa4a9('0xe')]);module[_0xa4a9('0xf')]=router; \ No newline at end of file +var _0x92b3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','express'];(function(_0x2fd2ec,_0x146368){var _0x2eeee2=function(_0x192665){while(--_0x192665){_0x2fd2ec['push'](_0x2fd2ec['shift']());}};_0x2eeee2(++_0x146368);}(_0x92b3,0xa8));var _0x392b=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x92b3[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x392b('0x0'));var util=require('util');var path=require(_0x392b('0x1'));var timeout=require('connect-timeout');var express=require(_0x392b('0x2'));var router=express[_0x392b('0x3')]();var fs_extra=require(_0x392b('0x4'));var auth=require(_0x392b('0x5'));var interaction=require(_0x392b('0x6'));var config=require('../../config/environment');var controller=require(_0x392b('0x7'));router[_0x392b('0x8')]('/',auth[_0x392b('0x9')](),controller[_0x392b('0xa')]);router['get'](_0x392b('0xb'),auth[_0x392b('0x9')](),controller[_0x392b('0xc')]);router[_0x392b('0xd')]('/',auth['isAuthenticated'](),controller[_0x392b('0xe')]);router[_0x392b('0xf')]('/:id',auth[_0x392b('0x9')](),controller['update']);router[_0x392b('0x10')](_0x392b('0xb'),auth[_0x392b('0x9')](),controller[_0x392b('0x11')]);module[_0x392b('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 03710bb..fb8d1ba 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 _0xd737=['INTEGER','sequelize','exports','STRING','contactListQueue'];(function(_0x1fbf3c,_0x2b91d5){var _0x136cec=function(_0x1c3da2){while(--_0x1c3da2){_0x1fbf3c['push'](_0x1fbf3c['shift']());}};_0x136cec(++_0x2b91d5);}(_0xd737,0x164));var _0x7d73=function(_0x1ae31c,_0x8dcd2d){_0x1ae31c=_0x1ae31c-0x0;var _0x19519d=_0xd737[_0x1ae31c];return _0x19519d;};'use strict';var moment=require('moment');var Sequelize=require(_0x7d73('0x0'));module[_0x7d73('0x1')]={'phone':{'type':Sequelize[_0x7d73('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x7d73('0x3')},'ListId':{'type':Sequelize[_0x7d73('0x4')],'unique':_0x7d73('0x3')},'VoiceQueueId':{'type':Sequelize[_0x7d73('0x4')],'unique':_0x7d73('0x3')}}; \ No newline at end of file +var _0x601a=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x486d7c,_0x25f99d){var _0x2bc318=function(_0x494474){while(--_0x494474){_0x486d7c['push'](_0x486d7c['shift']());}};_0x2bc318(++_0x25f99d);}(_0x601a,0x1a7));var _0xa601=function(_0xb40734,_0x574376){_0xb40734=_0xb40734-0x0;var _0x185a58=_0x601a[_0xb40734];return _0x185a58;};'use strict';var moment=require(_0xa601('0x0'));var Sequelize=require('sequelize');module[_0xa601('0x1')]={'phone':{'type':Sequelize[_0xa601('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa601('0x3')],'unique':_0xa601('0x4')},'ListId':{'type':Sequelize[_0xa601('0x3')],'unique':_0xa601('0x4')},'VoiceQueueId':{'type':Sequelize[_0xa601('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 46cc7ae..a8b167b 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 _0x7881=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','set','Content-Range','update','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','keys','include','options','find','body','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x44d814,_0x112456){var _0x55eebf=function(_0x8bc0e3){while(--_0x8bc0e3){_0x44d814['push'](_0x44d814['shift']());}};_0x55eebf(++_0x112456);}(_0x7881,0x1b0));var _0x1788=function(_0x37728e,_0x1a2440){_0x37728e=_0x37728e-0x0;var _0x138374=_0x7881[_0x37728e];return _0x138374;};'use strict';var emlformat=require(_0x1788('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1788('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1788('0x2'));var moment=require(_0x1788('0x3'));var BPromise=require(_0x1788('0x4'));var Mustache=require(_0x1788('0x5'));var util=require(_0x1788('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1788('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1788('0x8'));var _=require(_0x1788('0x9'));var squel=require(_0x1788('0xa'));var crypto=require(_0x1788('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1788('0x7'));var querystring=require(_0x1788('0xc'));var Papa=require(_0x1788('0xd'));var Redis=require('ioredis');var authService=require(_0x1788('0xe'));var qs=require(_0x1788('0xf'));var as=require(_0x1788('0x10'));var hardwareService=require(_0x1788('0x11'));var logger=require(_0x1788('0x12'))(_0x1788('0x13'));var utils=require(_0x1788('0x14'));var config=require(_0x1788('0x15'));var licenseUtil=require(_0x1788('0x16'));var db=require(_0x1788('0x17'))['db'];function respondWithStatusCode(_0x1d8455,_0x2602e4){_0x2602e4=_0x2602e4||0xcc;return function(_0x112709){if(_0x112709){return _0x1d8455[_0x1788('0x18')](_0x2602e4);}return _0x1d8455['status'](_0x2602e4)[_0x1788('0x19')]();};}function respondWithResult(_0x4c4dd0,_0x399c00){_0x399c00=_0x399c00||0xc8;return function(_0x3bb766){if(_0x3bb766){return _0x4c4dd0[_0x1788('0x1a')](_0x399c00)[_0x1788('0x1b')](_0x3bb766);}};}function respondWithFilteredResult(_0x2cc2b8,_0x14097c){return function(_0x2ca2fb){if(_0x2ca2fb){var _0x2b58de=typeof _0x14097c['offset']==='undefined'&&typeof _0x14097c[_0x1788('0x1c')]===_0x1788('0x1d');var _0x1d8c96=_0x2ca2fb[_0x1788('0x1e')];var _0x45d451=_0x2b58de?0x0:_0x14097c['offset'];var _0x41bf05=_0x2b58de?_0x2ca2fb[_0x1788('0x1e')]:_0x14097c['offset']+_0x14097c['limit'];var _0x32f149;if(_0x41bf05>=_0x1d8c96){_0x41bf05=_0x1d8c96;_0x32f149=0xc8;}else{_0x32f149=0xce;}_0x2cc2b8[_0x1788('0x1a')](_0x32f149);return _0x2cc2b8[_0x1788('0x1f')](_0x1788('0x20'),_0x45d451+'-'+_0x41bf05+'/'+_0x1d8c96)[_0x1788('0x1b')](_0x2ca2fb);}return null;};}function patchUpdates(_0x4116cb){return function(_0x38a62b){try{jsonpatch['apply'](_0x38a62b,_0x4116cb,!![]);}catch(_0x29d46c){return BPromise['reject'](_0x29d46c);}return _0x38a62b['save']();};}function saveUpdates(_0x49b45e,_0x7cc765){return function(_0x3fe4e6){if(_0x3fe4e6){return _0x3fe4e6[_0x1788('0x21')](_0x49b45e)[_0x1788('0x22')](function(_0x486a72){return _0x486a72;});}return null;};}function removeEntity(_0x3269e8,_0x4e3e8b){return function(_0x11fb31){if(_0x11fb31){return _0x11fb31['destroy']()['then'](function(){_0x3269e8[_0x1788('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35fd69,_0x1e8769){return function(_0x470713){if(!_0x470713){_0x35fd69[_0x1788('0x18')](0x194);}return _0x470713;};}function handleError(_0x3e3c57,_0x4e1ea7){_0x4e1ea7=_0x4e1ea7||0x1f4;return function(_0x246246){logger[_0x1788('0x23')](_0x246246[_0x1788('0x24')]);if(_0x246246['name']){delete _0x246246[_0x1788('0x25')];}_0x3e3c57[_0x1788('0x1a')](_0x4e1ea7)[_0x1788('0x26')](_0x246246);};}exports[_0x1788('0x27')]=function(_0x110756,_0x32fc91){var _0x2939fb={},_0x499bc0={},_0x2e7314={'count':0x0,'rows':[]};var _0x3b352f=_[_0x1788('0x28')](db[_0x1788('0x29')][_0x1788('0x2a')],function(_0x421e06){return{'name':_0x421e06[_0x1788('0x2b')],'type':_0x421e06[_0x1788('0x2c')]['key']};});_0x499bc0[_0x1788('0x2d')]=_['map'](_0x3b352f,_0x1788('0x25'));_0x499bc0[_0x1788('0x2e')]=_['keys'](_0x110756[_0x1788('0x2e')]);_0x499bc0[_0x1788('0x2f')]=_[_0x1788('0x30')](_0x499bc0[_0x1788('0x2d')],_0x499bc0[_0x1788('0x2e')]);_0x2939fb['attributes']=_[_0x1788('0x30')](_0x499bc0['model'],qs['fields'](_0x110756[_0x1788('0x2e')][_0x1788('0x31')]));_0x2939fb[_0x1788('0x32')]=_0x2939fb[_0x1788('0x32')][_0x1788('0x33')]?_0x2939fb[_0x1788('0x32')]:_0x499bc0['model'];if(!_0x110756[_0x1788('0x2e')][_0x1788('0x34')](_0x1788('0x35'))){_0x2939fb['limit']=qs[_0x1788('0x1c')](_0x110756['query'][_0x1788('0x1c')]);_0x2939fb[_0x1788('0x36')]=qs[_0x1788('0x36')](_0x110756[_0x1788('0x2e')][_0x1788('0x36')]);}_0x2939fb[_0x1788('0x37')]=qs[_0x1788('0x38')](_0x110756[_0x1788('0x2e')][_0x1788('0x38')]);_0x2939fb[_0x1788('0x39')]=qs[_0x1788('0x2f')](_[_0x1788('0x3a')](_0x110756[_0x1788('0x2e')],_0x499bc0[_0x1788('0x2f')]),_0x3b352f);if(_0x110756['query'][_0x1788('0x3b')]){_0x2939fb['where']=_['merge'](_0x2939fb[_0x1788('0x39')],{'$or':_[_0x1788('0x28')](_0x3b352f,function(_0x2e502a){if(_0x2e502a[_0x1788('0x2c')]!==_0x1788('0x3c')){var _0x306c29={};_0x306c29[_0x2e502a['name']]={'$like':'%'+_0x110756[_0x1788('0x2e')]['filter']+'%'};return _0x306c29;}})});}_0x2939fb=_[_0x1788('0x3d')]({},_0x2939fb,_0x110756['options']);var _0x15585c={'where':_0x2939fb[_0x1788('0x39')]};return db[_0x1788('0x29')][_0x1788('0x1e')](_0x15585c)['then'](function(_0x537289){_0x2e7314[_0x1788('0x1e')]=_0x537289;if(_0x110756['query'][_0x1788('0x3e')]){_0x2939fb['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x1788('0x3f')](_0x2939fb);})[_0x1788('0x22')](function(_0x47580c){_0x2e7314[_0x1788('0x40')]=_0x47580c;return _0x2e7314;})[_0x1788('0x22')](respondWithFilteredResult(_0x32fc91,_0x2939fb))[_0x1788('0x41')](handleError(_0x32fc91,null));};exports[_0x1788('0x42')]=function(_0x43a781,_0x59e7b8){var _0x538b67={'raw':!![],'where':{'id':_0x43a781[_0x1788('0x43')]['id']}},_0x560615={};_0x560615[_0x1788('0x2d')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x560615[_0x1788('0x2e')]=_[_0x1788('0x44')](_0x43a781[_0x1788('0x2e')]);_0x560615[_0x1788('0x2f')]=_['intersection'](_0x560615[_0x1788('0x2d')],_0x560615[_0x1788('0x2e')]);_0x538b67[_0x1788('0x32')]=_['intersection'](_0x560615[_0x1788('0x2d')],qs[_0x1788('0x31')](_0x43a781[_0x1788('0x2e')][_0x1788('0x31')]));_0x538b67[_0x1788('0x32')]=_0x538b67[_0x1788('0x32')][_0x1788('0x33')]?_0x538b67['attributes']:_0x560615[_0x1788('0x2d')];if(_0x43a781[_0x1788('0x2e')][_0x1788('0x3e')]){_0x538b67[_0x1788('0x45')]=[{'all':!![]}];}_0x538b67=_['merge']({},_0x538b67,_0x43a781[_0x1788('0x46')]);return db[_0x1788('0x29')][_0x1788('0x47')](_0x538b67)[_0x1788('0x22')](handleEntityNotFound(_0x59e7b8,null))[_0x1788('0x22')](respondWithResult(_0x59e7b8,null))[_0x1788('0x41')](handleError(_0x59e7b8,null));};exports[_0x1788('0x21')]=function(_0x392c87,_0x308ed8){if(_0x392c87['body']['id']){delete _0x392c87[_0x1788('0x48')]['id'];}return db[_0x1788('0x29')][_0x1788('0x47')]({'where':{'id':_0x392c87[_0x1788('0x43')]['id']}})['then'](handleEntityNotFound(_0x308ed8,null))[_0x1788('0x22')](saveUpdates(_0x392c87['body'],null))[_0x1788('0x22')](respondWithResult(_0x308ed8,null))['catch'](handleError(_0x308ed8,null));};exports[_0x1788('0x49')]=function(_0x4f3a4d,_0x55b4c8){return db[_0x1788('0x29')][_0x1788('0x47')]({'where':{'id':_0x4f3a4d[_0x1788('0x43')]['id']}})['then'](handleEntityNotFound(_0x55b4c8,null))[_0x1788('0x22')](removeEntity(_0x55b4c8,null))[_0x1788('0x41')](handleError(_0x55b4c8,null));};exports[_0x1788('0x4a')]=function(_0x6c84ce,_0x23a699){return db[_0x1788('0x29')]['describe']()[_0x1788('0x22')](respondWithResult(_0x23a699,null))[_0x1788('0x41')](handleError(_0x23a699,null));}; \ No newline at end of file +var _0xbd10=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','map','CmHopperBlack','fieldName','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','params','keys','rawAttributes','options','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xbd10,0x85));var _0x0bd1=function(_0x326508,_0x31cb07){_0x326508=_0x326508-0x0;var _0x4e761f=_0xbd10[_0x326508];return _0x4e761f;};'use strict';var emlformat=require(_0x0bd1('0x0'));var rimraf=require(_0x0bd1('0x1'));var zipdir=require(_0x0bd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bd1('0x3'));var moment=require(_0x0bd1('0x4'));var BPromise=require(_0x0bd1('0x5'));var Mustache=require('mustache');var util=require(_0x0bd1('0x6'));var path=require(_0x0bd1('0x7'));var sox=require(_0x0bd1('0x8'));var csv=require(_0x0bd1('0x9'));var ejs=require(_0x0bd1('0xa'));var fs=require('fs');var fs_extra=require(_0x0bd1('0xb'));var _=require('lodash');var squel=require(_0x0bd1('0xc'));var crypto=require('crypto');var jsforce=require(_0x0bd1('0xd'));var deskjs=require(_0x0bd1('0xe'));var toCsv=require(_0x0bd1('0x9'));var querystring=require(_0x0bd1('0xf'));var Papa=require('papaparse');var Redis=require(_0x0bd1('0x10'));var authService=require(_0x0bd1('0x11'));var qs=require(_0x0bd1('0x12'));var as=require(_0x0bd1('0x13'));var hardwareService=require(_0x0bd1('0x14'));var logger=require(_0x0bd1('0x15'))('api');var utils=require(_0x0bd1('0x16'));var config=require(_0x0bd1('0x17'));var licenseUtil=require(_0x0bd1('0x18'));var db=require(_0x0bd1('0x19'))['db'];function respondWithStatusCode(_0x4009e4,_0x1f441f){_0x1f441f=_0x1f441f||0xcc;return function(_0x57fd1d){if(_0x57fd1d){return _0x4009e4[_0x0bd1('0x1a')](_0x1f441f);}return _0x4009e4[_0x0bd1('0x1b')](_0x1f441f)[_0x0bd1('0x1c')]();};}function respondWithResult(_0x5025e1,_0x51f988){_0x51f988=_0x51f988||0xc8;return function(_0x3e2f49){if(_0x3e2f49){return _0x5025e1[_0x0bd1('0x1b')](_0x51f988)[_0x0bd1('0x1d')](_0x3e2f49);}};}function respondWithFilteredResult(_0x56055b,_0x5ab8a5){return function(_0x180809){if(_0x180809){var _0x88e088=typeof _0x5ab8a5[_0x0bd1('0x1e')]==='undefined'&&typeof _0x5ab8a5[_0x0bd1('0x1f')]===_0x0bd1('0x20');var _0x2f2969=_0x180809[_0x0bd1('0x21')];var _0x4790eb=_0x88e088?0x0:_0x5ab8a5[_0x0bd1('0x1e')];var _0x3d1170=_0x88e088?_0x180809['count']:_0x5ab8a5[_0x0bd1('0x1e')]+_0x5ab8a5[_0x0bd1('0x1f')];var _0x59d106;if(_0x3d1170>=_0x2f2969){_0x3d1170=_0x2f2969;_0x59d106=0xc8;}else{_0x59d106=0xce;}_0x56055b['status'](_0x59d106);return _0x56055b[_0x0bd1('0x22')](_0x0bd1('0x23'),_0x4790eb+'-'+_0x3d1170+'/'+_0x2f2969)[_0x0bd1('0x1d')](_0x180809);}return null;};}function patchUpdates(_0x6959b7){return function(_0x1f8536){try{jsonpatch[_0x0bd1('0x24')](_0x1f8536,_0x6959b7,!![]);}catch(_0xc5ece1){return BPromise[_0x0bd1('0x25')](_0xc5ece1);}return _0x1f8536['save']();};}function saveUpdates(_0x2d5861,_0x44095f){return function(_0x31eaf5){if(_0x31eaf5){return _0x31eaf5[_0x0bd1('0x26')](_0x2d5861)[_0x0bd1('0x27')](function(_0x569b09){return _0x569b09;});}return null;};}function removeEntity(_0x35a8ca,_0x4d6828){return function(_0x5f0742){if(_0x5f0742){return _0x5f0742[_0x0bd1('0x28')]()[_0x0bd1('0x27')](function(){_0x35a8ca[_0x0bd1('0x1b')](0xcc)[_0x0bd1('0x1c')]();});}};}function handleEntityNotFound(_0x237f4a,_0x16eb7b){return function(_0x3e0c07){if(!_0x3e0c07){_0x237f4a[_0x0bd1('0x1a')](0x194);}return _0x3e0c07;};}function handleError(_0x2cacfc,_0x58a565){_0x58a565=_0x58a565||0x1f4;return function(_0x5cb236){logger[_0x0bd1('0x29')](_0x5cb236['stack']);if(_0x5cb236[_0x0bd1('0x2a')]){delete _0x5cb236[_0x0bd1('0x2a')];}_0x2cacfc['status'](_0x58a565)['send'](_0x5cb236);};}exports['index']=function(_0x4b64cb,_0x551fcd){var _0x4616b9={},_0x2ac8bb={},_0x38e655={'count':0x0,'rows':[]};var _0x5b07cd=_[_0x0bd1('0x2b')](db[_0x0bd1('0x2c')]['rawAttributes'],function(_0x49debf){return{'name':_0x49debf[_0x0bd1('0x2d')],'type':_0x49debf['type']['key']};});_0x2ac8bb['model']=_[_0x0bd1('0x2b')](_0x5b07cd,_0x0bd1('0x2a'));_0x2ac8bb[_0x0bd1('0x2e')]=_['keys'](_0x4b64cb[_0x0bd1('0x2e')]);_0x2ac8bb[_0x0bd1('0x2f')]=_['intersection'](_0x2ac8bb['model'],_0x2ac8bb[_0x0bd1('0x2e')]);_0x4616b9['attributes']=_[_0x0bd1('0x30')](_0x2ac8bb[_0x0bd1('0x31')],qs['fields'](_0x4b64cb[_0x0bd1('0x2e')][_0x0bd1('0x32')]));_0x4616b9[_0x0bd1('0x33')]=_0x4616b9['attributes'][_0x0bd1('0x34')]?_0x4616b9['attributes']:_0x2ac8bb[_0x0bd1('0x31')];if(!_0x4b64cb[_0x0bd1('0x2e')][_0x0bd1('0x35')](_0x0bd1('0x36'))){_0x4616b9['limit']=qs[_0x0bd1('0x1f')](_0x4b64cb[_0x0bd1('0x2e')][_0x0bd1('0x1f')]);_0x4616b9[_0x0bd1('0x1e')]=qs[_0x0bd1('0x1e')](_0x4b64cb[_0x0bd1('0x2e')][_0x0bd1('0x1e')]);}_0x4616b9['order']=qs[_0x0bd1('0x37')](_0x4b64cb[_0x0bd1('0x2e')]['sort']);_0x4616b9[_0x0bd1('0x38')]=qs[_0x0bd1('0x2f')](_[_0x0bd1('0x39')](_0x4b64cb[_0x0bd1('0x2e')],_0x2ac8bb[_0x0bd1('0x2f')]),_0x5b07cd);if(_0x4b64cb[_0x0bd1('0x2e')][_0x0bd1('0x3a')]){_0x4616b9[_0x0bd1('0x38')]=_[_0x0bd1('0x3b')](_0x4616b9[_0x0bd1('0x38')],{'$or':_[_0x0bd1('0x2b')](_0x5b07cd,function(_0x3715f6){if(_0x3715f6[_0x0bd1('0x3c')]!==_0x0bd1('0x3d')){var _0x28b835={};_0x28b835[_0x3715f6[_0x0bd1('0x2a')]]={'$like':'%'+_0x4b64cb[_0x0bd1('0x2e')][_0x0bd1('0x3a')]+'%'};return _0x28b835;}})});}_0x4616b9=_['merge']({},_0x4616b9,_0x4b64cb['options']);var _0x2fe9da={'where':_0x4616b9[_0x0bd1('0x38')]};return db[_0x0bd1('0x2c')][_0x0bd1('0x21')](_0x2fe9da)[_0x0bd1('0x27')](function(_0x5fcd17){_0x38e655['count']=_0x5fcd17;if(_0x4b64cb['query'][_0x0bd1('0x3e')]){_0x4616b9[_0x0bd1('0x3f')]=[{'all':!![]}];}return db[_0x0bd1('0x2c')][_0x0bd1('0x40')](_0x4616b9);})['then'](function(_0x12c010){_0x38e655['rows']=_0x12c010;return _0x38e655;})[_0x0bd1('0x27')](respondWithFilteredResult(_0x551fcd,_0x4616b9))['catch'](handleError(_0x551fcd,null));};exports[_0x0bd1('0x41')]=function(_0x3b7677,_0x32cff5){var _0xd4217c={'raw':!![],'where':{'id':_0x3b7677[_0x0bd1('0x42')]['id']}},_0x5894f4={};_0x5894f4[_0x0bd1('0x31')]=_[_0x0bd1('0x43')](db['CmHopperBlack'][_0x0bd1('0x44')]);_0x5894f4[_0x0bd1('0x2e')]=_[_0x0bd1('0x43')](_0x3b7677[_0x0bd1('0x2e')]);_0x5894f4[_0x0bd1('0x2f')]=_[_0x0bd1('0x30')](_0x5894f4[_0x0bd1('0x31')],_0x5894f4[_0x0bd1('0x2e')]);_0xd4217c[_0x0bd1('0x33')]=_[_0x0bd1('0x30')](_0x5894f4[_0x0bd1('0x31')],qs['fields'](_0x3b7677['query'][_0x0bd1('0x32')]));_0xd4217c['attributes']=_0xd4217c[_0x0bd1('0x33')]['length']?_0xd4217c[_0x0bd1('0x33')]:_0x5894f4[_0x0bd1('0x31')];if(_0x3b7677[_0x0bd1('0x2e')][_0x0bd1('0x3e')]){_0xd4217c[_0x0bd1('0x3f')]=[{'all':!![]}];}_0xd4217c=_[_0x0bd1('0x3b')]({},_0xd4217c,_0x3b7677[_0x0bd1('0x45')]);return db[_0x0bd1('0x2c')][_0x0bd1('0x46')](_0xd4217c)[_0x0bd1('0x27')](handleEntityNotFound(_0x32cff5,null))['then'](respondWithResult(_0x32cff5,null))[_0x0bd1('0x47')](handleError(_0x32cff5,null));};exports[_0x0bd1('0x26')]=function(_0x34a20d,_0x1ef213){if(_0x34a20d['body']['id']){delete _0x34a20d['body']['id'];}return db[_0x0bd1('0x2c')][_0x0bd1('0x46')]({'where':{'id':_0x34a20d[_0x0bd1('0x42')]['id']}})['then'](handleEntityNotFound(_0x1ef213,null))[_0x0bd1('0x27')](saveUpdates(_0x34a20d[_0x0bd1('0x48')],null))[_0x0bd1('0x27')](respondWithResult(_0x1ef213,null))[_0x0bd1('0x47')](handleError(_0x1ef213,null));};exports['destroy']=function(_0x516f4c,_0x2b254f){return db['CmHopperBlack'][_0x0bd1('0x46')]({'where':{'id':_0x516f4c['params']['id']}})[_0x0bd1('0x27')](handleEntityNotFound(_0x2b254f,null))['then'](removeEntity(_0x2b254f,null))[_0x0bd1('0x47')](handleError(_0x2b254f,null));};exports[_0x0bd1('0x49')]=function(_0x53b563,_0x5220bc){return db[_0x0bd1('0x2c')][_0x0bd1('0x49')]()['then'](respondWithResult(_0x5220bc,null))['catch'](handleError(_0x5220bc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 383e8fd..364364e 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 _0x6603=['./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4b85d4,_0x35b6bd){var _0x2b244a=function(_0x4d5afd){while(--_0x4d5afd){_0x4b85d4['push'](_0x4b85d4['shift']());}};_0x2b244a(++_0x35b6bd);}(_0x6603,0xbb));var _0x3660=function(_0x4b83f9,_0x5a8dc5){_0x4b83f9=_0x4b83f9-0x0;var _0x46c4d1=_0x6603[_0x4b83f9];return _0x46c4d1;};'use strict';var _=require(_0x3660('0x0'));var util=require(_0x3660('0x1'));var logger=require('../../config/logger')(_0x3660('0x2'));var moment=require(_0x3660('0x3'));var BPromise=require(_0x3660('0x4'));var rp=require(_0x3660('0x5'));var fs=require('fs');var path=require(_0x3660('0x6'));var rimraf=require(_0x3660('0x7'));var config=require('../../config/environment');var attributes=require(_0x3660('0x8'));module[_0x3660('0x9')]=function(_0x18c8aa,_0x24898f){return _0x18c8aa[_0x3660('0xa')](_0x3660('0xb'),attributes,{'tableName':_0x3660('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e93=['exports','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7e93,0x87));var _0x37e9=function(_0x52fc8c,_0x1bbded){_0x52fc8c=_0x52fc8c-0x0;var _0x1438ac=_0x7e93[_0x52fc8c];return _0x1438ac;};'use strict';var _=require('lodash');var util=require(_0x37e9('0x0'));var logger=require(_0x37e9('0x1'))(_0x37e9('0x2'));var moment=require(_0x37e9('0x3'));var BPromise=require(_0x37e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x37e9('0x5'));var config=require(_0x37e9('0x6'));var attributes=require(_0x37e9('0x7'));module[_0x37e9('0x8')]=function(_0x456e84,_0x5b0d0f){return _0x456e84['define'](_0x37e9('0x9'),attributes,{'tableName':_0x37e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 151433a..218b9cf 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 _0x402c=['message','info','GetCmHopperBlack','CmHopperBlack','options','raw','attributes','limit','include','map','model','update','body','where','then','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x5c12bd,_0x55bdbf){var _0x52bd8f=function(_0x5dea59){while(--_0x5dea59){_0x5c12bd['push'](_0x5c12bd['shift']());}};_0x52bd8f(++_0x55bdbf);}(_0x402c,0xc2));var _0xc402=function(_0xb4f240,_0x15f734){_0xb4f240=_0xb4f240-0x0;var _0x30682a=_0x402c[_0xb4f240];return _0x30682a;};'use strict';var _=require(_0xc402('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc402('0x1'));var rs=require(_0xc402('0x2'));var fs=require('fs');var Redis=require(_0xc402('0x3'));var db=require(_0xc402('0x4'))['db'];var utils=require(_0xc402('0x5'));var logger=require(_0xc402('0x6'))(_0xc402('0x7'));var config=require(_0xc402('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc402('0x9')][_0xc402('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34f096,_0xc32618,_0x5e0ef4){return new BPromise(function(_0x7a578e,_0x198858){return client[_0xc402('0xb')](_0x34f096,_0x5e0ef4)['then'](function(_0x22d6bc){logger['info'](_0xc402('0xc'),_0xc32618,_0xc402('0xd'));logger[_0xc402('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0xc32618,_0xc402('0xd'),JSON['stringify'](_0x22d6bc));if(_0x22d6bc[_0xc402('0xf')]){if(_0x22d6bc['error']['code']===0x1f4){logger['error'](_0xc402('0xc'),_0xc32618,_0x22d6bc['error'][_0xc402('0x10')]);return _0x198858(_0x22d6bc[_0xc402('0xf')][_0xc402('0x10')]);}logger[_0xc402('0xf')](_0xc402('0xc'),_0xc32618,_0x22d6bc[_0xc402('0xf')][_0xc402('0x10')]);return _0x7a578e(_0x22d6bc['error'][_0xc402('0x10')]);}else{logger[_0xc402('0x11')](_0xc402('0xc'),_0xc32618,_0xc402('0xd'));_0x7a578e(_0x22d6bc['result']['message']);}})['catch'](function(_0x4af015){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0xc32618,_0x4af015);_0x198858(_0x4af015);});});}exports[_0xc402('0x12')]=function(_0x266c9b){var _0x531513=this;return new Promise(function(_0x50a28a,_0x1c47f9){return db[_0xc402('0x13')]['findAll']({'raw':_0x266c9b[_0xc402('0x14')]?_0x266c9b[_0xc402('0x14')][_0xc402('0x15')]===undefined?!![]:![]:!![],'where':_0x266c9b[_0xc402('0x14')]?_0x266c9b[_0xc402('0x14')]['where']||null:null,'attributes':_0x266c9b[_0xc402('0x14')]?_0x266c9b[_0xc402('0x14')][_0xc402('0x16')]||null:null,'limit':_0x266c9b[_0xc402('0x14')]?_0x266c9b[_0xc402('0x14')][_0xc402('0x17')]||null:null,'include':_0x266c9b[_0xc402('0x14')]?_0x266c9b[_0xc402('0x14')][_0xc402('0x18')]?_[_0xc402('0x19')](_0x266c9b[_0xc402('0x14')]['include'],function(_0x5cfeab){return{'model':db[_0x5cfeab['model']],'as':_0x5cfeab['as'],'attributes':_0x5cfeab[_0xc402('0x16')],'include':_0x5cfeab[_0xc402('0x18')]?_[_0xc402('0x19')](_0x5cfeab[_0xc402('0x18')],function(_0x4690f6){return{'model':db[_0x4690f6[_0xc402('0x1a')]],'as':_0x4690f6['as'],'attributes':_0x4690f6[_0xc402('0x16')],'include':_0x4690f6[_0xc402('0x18')]?_[_0xc402('0x19')](_0x4690f6[_0xc402('0x18')],function(_0x540a91){return{'model':db[_0x540a91['model']],'as':_0x540a91['as'],'attributes':_0x540a91[_0xc402('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd08335){logger[_0xc402('0x11')](_0xc402('0x12'),_0x266c9b);logger['debug'](_0xc402('0x12'),_0x266c9b,JSON['stringify'](_0xd08335));_0x50a28a(_0xd08335);})['catch'](function(_0x471bdd){logger['error'](_0xc402('0x12'),_0x471bdd[_0xc402('0x10')],_0x266c9b);_0x1c47f9(_0x531513[_0xc402('0xf')](0x1f4,_0x471bdd[_0xc402('0x10')]));});});};exports['UpdateCmHopperBlack']=function(_0x2fb192){var _0x130918=this;return new Promise(function(_0x44b27b,_0xba4fda){return db[_0xc402('0x13')][_0xc402('0x1b')](_0x2fb192[_0xc402('0x1c')],{'raw':_0x2fb192[_0xc402('0x14')]?_0x2fb192[_0xc402('0x14')][_0xc402('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fb192[_0xc402('0x14')]?_0x2fb192[_0xc402('0x14')][_0xc402('0x1d')]||null:null,'attributes':_0x2fb192[_0xc402('0x14')]?_0x2fb192[_0xc402('0x14')][_0xc402('0x16')]||null:null,'limit':_0x2fb192[_0xc402('0x14')]?_0x2fb192[_0xc402('0x14')][_0xc402('0x17')]||null:null})[_0xc402('0x1e')](function(_0x349e28){logger[_0xc402('0x11')]('UpdateCmHopperBlack',_0x2fb192);logger[_0xc402('0xe')](_0xc402('0x1f'),_0x2fb192,JSON['stringify'](_0x349e28));_0x44b27b(_0x349e28);})['catch'](function(_0x1bf78a){logger[_0xc402('0xf')](_0xc402('0x1f'),_0x1bf78a[_0xc402('0x10')],_0x2fb192);_0xba4fda(_0x130918[_0xc402('0xf')](0x1f4,_0x1bf78a['message']));});});};exports[_0xc402('0x20')]=function(_0x535187){var _0x2efed5=this;return new Promise(function(_0xfdae63,_0x5c3011){return db[_0xc402('0x13')][_0xc402('0x21')]({'where':_0x535187['options']?_0x535187[_0xc402('0x14')]['where']||null:null})[_0xc402('0x1e')](function(_0x372e7e){logger[_0xc402('0x11')](_0xc402('0x20'),_0x535187);logger[_0xc402('0xe')](_0xc402('0x20'),_0x535187,JSON['stringify'](_0x372e7e));_0xfdae63(_0x372e7e);})[_0xc402('0x22')](function(_0x3d9b37){logger[_0xc402('0xf')]('DestroyCmHopperBlack',_0x3d9b37['message'],_0x535187);_0x5c3011(_0x2efed5['error'](0x1f4,_0x3d9b37[_0xc402('0x10')]));});});}; \ No newline at end of file +var _0xa477=['result','catch','GetCmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0xa477,0x11b));var _0x7a47=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa477[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require(_0x7a47('0x2'));var BPromise=require(_0x7a47('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require(_0x7a47('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24ef2b,_0x436d6d,_0x369d28){return new BPromise(function(_0x227b7c,_0x51239a){return client[_0x7a47('0xa')](_0x24ef2b,_0x369d28)[_0x7a47('0xb')](function(_0x39acfa){logger['info'](_0x7a47('0xc'),_0x436d6d,_0x7a47('0xd'));logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x436d6d,_0x7a47('0xd'),JSON[_0x7a47('0x10')](_0x39acfa));if(_0x39acfa['error']){if(_0x39acfa[_0x7a47('0x11')][_0x7a47('0x12')]===0x1f4){logger[_0x7a47('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x436d6d,_0x39acfa[_0x7a47('0x11')][_0x7a47('0x13')]);return _0x51239a(_0x39acfa[_0x7a47('0x11')]['message']);}logger[_0x7a47('0x11')](_0x7a47('0xc'),_0x436d6d,_0x39acfa['error'][_0x7a47('0x13')]);return _0x227b7c(_0x39acfa[_0x7a47('0x11')][_0x7a47('0x13')]);}else{logger[_0x7a47('0x14')](_0x7a47('0xc'),_0x436d6d,_0x7a47('0xd'));_0x227b7c(_0x39acfa[_0x7a47('0x15')]['message']);}})[_0x7a47('0x16')](function(_0x91d54c){logger[_0x7a47('0x11')](_0x7a47('0xc'),_0x436d6d,_0x91d54c);_0x51239a(_0x91d54c);});});}exports[_0x7a47('0x17')]=function(_0x26431d){var _0x56d177=this;return new Promise(function(_0x4b5e94,_0x1d24d8){return db['CmHopperBlack'][_0x7a47('0x18')]({'raw':_0x26431d['options']?_0x26431d[_0x7a47('0x19')][_0x7a47('0x1a')]===undefined?!![]:![]:!![],'where':_0x26431d[_0x7a47('0x19')]?_0x26431d[_0x7a47('0x19')]['where']||null:null,'attributes':_0x26431d[_0x7a47('0x19')]?_0x26431d[_0x7a47('0x19')][_0x7a47('0x1b')]||null:null,'limit':_0x26431d[_0x7a47('0x19')]?_0x26431d[_0x7a47('0x19')][_0x7a47('0x1c')]||null:null,'include':_0x26431d[_0x7a47('0x19')]?_0x26431d[_0x7a47('0x19')][_0x7a47('0x1d')]?_[_0x7a47('0x1e')](_0x26431d[_0x7a47('0x19')][_0x7a47('0x1d')],function(_0x198ede){return{'model':db[_0x198ede['model']],'as':_0x198ede['as'],'attributes':_0x198ede['attributes'],'include':_0x198ede[_0x7a47('0x1d')]?_[_0x7a47('0x1e')](_0x198ede['include'],function(_0x22d706){return{'model':db[_0x22d706[_0x7a47('0x1f')]],'as':_0x22d706['as'],'attributes':_0x22d706['attributes'],'include':_0x22d706[_0x7a47('0x1d')]?_[_0x7a47('0x1e')](_0x22d706[_0x7a47('0x1d')],function(_0x495ba2){return{'model':db[_0x495ba2[_0x7a47('0x1f')]],'as':_0x495ba2['as'],'attributes':_0x495ba2[_0x7a47('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f7154){logger[_0x7a47('0x14')](_0x7a47('0x17'),_0x26431d);logger['debug']('GetCmHopperBlack',_0x26431d,JSON['stringify'](_0x4f7154));_0x4b5e94(_0x4f7154);})[_0x7a47('0x16')](function(_0x406e7b){logger['error'](_0x7a47('0x17'),_0x406e7b['message'],_0x26431d);_0x1d24d8(_0x56d177[_0x7a47('0x11')](0x1f4,_0x406e7b[_0x7a47('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x4a880e){var _0x4ae405=this;return new Promise(function(_0x5edff7,_0x42bef1){return db['CmHopperBlack'][_0x7a47('0x20')](_0x4a880e[_0x7a47('0x21')],{'raw':_0x4a880e[_0x7a47('0x19')]?_0x4a880e[_0x7a47('0x19')][_0x7a47('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a880e[_0x7a47('0x19')]?_0x4a880e[_0x7a47('0x19')]['where']||null:null,'attributes':_0x4a880e[_0x7a47('0x19')]?_0x4a880e[_0x7a47('0x19')]['attributes']||null:null,'limit':_0x4a880e[_0x7a47('0x19')]?_0x4a880e[_0x7a47('0x19')][_0x7a47('0x1c')]||null:null})[_0x7a47('0xb')](function(_0x48c264){logger[_0x7a47('0x14')](_0x7a47('0x22'),_0x4a880e);logger[_0x7a47('0xe')]('UpdateCmHopperBlack',_0x4a880e,JSON[_0x7a47('0x10')](_0x48c264));_0x5edff7(_0x48c264);})['catch'](function(_0x4ec717){logger['error']('UpdateCmHopperBlack',_0x4ec717[_0x7a47('0x13')],_0x4a880e);_0x42bef1(_0x4ae405[_0x7a47('0x11')](0x1f4,_0x4ec717[_0x7a47('0x13')]));});});};exports[_0x7a47('0x23')]=function(_0x54cddf){var _0x52d52c=this;return new Promise(function(_0x398a4c,_0x2adead){return db['CmHopperBlack'][_0x7a47('0x24')]({'where':_0x54cddf[_0x7a47('0x19')]?_0x54cddf[_0x7a47('0x19')][_0x7a47('0x25')]||null:null})['then'](function(_0x3e2862){logger[_0x7a47('0x14')](_0x7a47('0x23'),_0x54cddf);logger[_0x7a47('0xe')]('DestroyCmHopperBlack',_0x54cddf,JSON[_0x7a47('0x10')](_0x3e2862));_0x398a4c(_0x3e2862);})[_0x7a47('0x16')](function(_0x1c9edd){logger['error']('DestroyCmHopperBlack',_0x1c9edd[_0x7a47('0x13')],_0x54cddf);_0x2adead(_0x52d52c['error'](0x1f4,_0x1c9edd[_0x7a47('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 599d933..43e1b41 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 _0x5334=['isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','describe','get','/:id'];(function(_0x24b538,_0x8749b0){var _0x12fade=function(_0x66dd2b){while(--_0x66dd2b){_0x24b538['push'](_0x24b538['shift']());}};_0x12fade(++_0x8749b0);}(_0x5334,0x84));var _0x4533=function(_0x46732e,_0x33c42a){_0x46732e=_0x46732e-0x0;var _0x3f5262=_0x5334[_0x46732e];return _0x3f5262;};'use strict';var multer=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var path=require(_0x4533('0x2'));var timeout=require(_0x4533('0x3'));var express=require(_0x4533('0x4'));var router=express['Router']();var fs_extra=require(_0x4533('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4533('0x6'));var config=require(_0x4533('0x7'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4533('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4533('0x9')]);router[_0x4533('0xa')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller[_0x4533('0xd')]);router[_0x4533('0xe')](_0x4533('0xb'),auth['isAuthenticated'](),controller[_0x4533('0xf')]);router[_0x4533('0x10')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller['destroy']);module[_0x4533('0x11')]=router; \ No newline at end of file +var _0x31c2=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','util'];(function(_0x559583,_0x1e60cf){var _0x52ce36=function(_0x4bb443){while(--_0x4bb443){_0x559583['push'](_0x559583['shift']());}};_0x52ce36(++_0x1e60cf);}(_0x31c2,0x1e1));var _0x231c=function(_0x522f80,_0x1f8ebb){_0x522f80=_0x522f80-0x0;var _0x8f37e3=_0x31c2[_0x522f80];return _0x8f37e3;};'use strict';var multer=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var path=require(_0x231c('0x2'));var timeout=require(_0x231c('0x3'));var express=require(_0x231c('0x4'));var router=express[_0x231c('0x5')]();var fs_extra=require(_0x231c('0x6'));var auth=require(_0x231c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x231c('0x8'));router[_0x231c('0x9')]('/',auth[_0x231c('0xa')](),controller[_0x231c('0xb')]);router['get'](_0x231c('0xc'),auth['isAuthenticated'](),controller[_0x231c('0xd')]);router[_0x231c('0x9')](_0x231c('0xe'),auth['isAuthenticated'](),controller[_0x231c('0xf')]);router[_0x231c('0x10')](_0x231c('0xe'),auth[_0x231c('0xa')](),controller[_0x231c('0x11')]);router[_0x231c('0x12')](_0x231c('0xe'),auth['isAuthenticated'](),controller[_0x231c('0x13')]);module[_0x231c('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 601050e..b4eab10 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 _0x8505=['INTEGER','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','STRING'];(function(_0x17757e,_0x2c43d9){var _0x2ef988=function(_0x20e5d5){while(--_0x20e5d5){_0x17757e['push'](_0x17757e['shift']());}};_0x2ef988(++_0x2c43d9);}(_0x8505,0x189));var _0x5850=function(_0x43452d,_0x2e60b9){_0x43452d=_0x43452d-0x0;var _0x2733f3=_0x8505[_0x43452d];return _0x2733f3;};'use strict';var Sequelize=require(_0x5850('0x0'));var moment=require(_0x5850('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5850('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x5850('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5850('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5850('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5850('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x5850('0x2')]},'calleridnum':{'type':Sequelize[_0x5850('0x2')]},'calleridname':{'type':Sequelize[_0x5850('0x2')]},'starttime':{'type':Sequelize[_0x5850('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x5850('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x5850('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5850('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5850('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x5850('0x2')]},'campaigntype':{'type':Sequelize[_0x5850('0x2')]},'membername':{'type':Sequelize[_0x5850('0x2')]},'reason':{'type':Sequelize[_0x5850('0x2')]},'disposition':{'type':Sequelize[_0x5850('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5850('0x2')]},'dispositionat':{'type':Sequelize[_0x5850('0x4')],'set':function(_0x480ed5){var _0x31b6bf=this[_0x5850('0x5')](_0x5850('0x6'));if(_0x31b6bf&&_0x480ed5){this[_0x5850('0x7')](_0x5850('0x8'),moment(_0x480ed5)[_0x5850('0x9')](moment(_0x31b6bf),_0x5850('0xa')));}}},'amd':{'type':Sequelize[_0x5850('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5850('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x5850('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5850('0x4')]},'callback':{'type':Sequelize[_0x5850('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5850('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5850('0x4')]},'deleted':{'type':Sequelize[_0x5850('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5850('0x4')]},'recallme':{'type':Sequelize[_0x5850('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x5850('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5850('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5850('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5850('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x51ac=['seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','setDataValue','diff'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x51ac,0x178));var _0xc51a=function(_0x5e52b2,_0x3023e0){_0x5e52b2=_0x5e52b2-0x0;var _0x1b0610=_0x51ac[_0x5e52b2];return _0x1b0610;};'use strict';var Sequelize=require(_0xc51a('0x0'));var moment=require(_0xc51a('0x1'));module[_0xc51a('0x2')]={'state':{'type':Sequelize[_0xc51a('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xc51a('0x4')]},'scheduledat':{'type':Sequelize[_0xc51a('0x5')]},'countbusyretry':{'type':Sequelize[_0xc51a('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc51a('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc51a('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xc51a('0x4')]},'originatecalleridname':{'type':Sequelize[_0xc51a('0x4')]},'calleridnum':{'type':Sequelize[_0xc51a('0x4')]},'calleridname':{'type':Sequelize[_0xc51a('0x4')]},'starttime':{'type':Sequelize[_0xc51a('0x5')]},'responsetime':{'type':Sequelize[_0xc51a('0x5')]},'answertime':{'type':Sequelize[_0xc51a('0x5')]},'droptime':{'type':Sequelize[_0xc51a('0x5')]},'endtime':{'type':Sequelize[_0xc51a('0x5')]},'ringtime':{'type':Sequelize[_0xc51a('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc51a('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc51a('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xc51a('0x4')]},'campaigntype':{'type':Sequelize[_0xc51a('0x4')]},'membername':{'type':Sequelize[_0xc51a('0x4')]},'reason':{'type':Sequelize[_0xc51a('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc51a('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xc51a('0x5')],'set':function(_0x2e0cb9){var _0x124084=this[_0xc51a('0x6')]('endtime');if(_0x124084&&_0x2e0cb9){this[_0xc51a('0x7')]('followuptime',moment(_0x2e0cb9)[_0xc51a('0x8')](moment(_0x124084),_0xc51a('0x9')));}}},'amd':{'type':Sequelize[_0xc51a('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xc51a('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xc51a('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xc51a('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc51a('0x5')]},'deleted':{'type':Sequelize[_0xc51a('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xc51a('0x5')]},'recallme':{'type':Sequelize[_0xc51a('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc51a('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc51a('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc51a('0x3')],'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 568330a..9c42776 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 _0xf81c=['CmHopper','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','CmHopperFinal','includeAll','catch','show','params','rawAttributes','include','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','findAll','busyContacts','`state`\x20=\x208,\x201,\x20null','reCallContacts','into','cm_hopper','fromQuery','phone','scheduledAt','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','ContactId','ANY_VALUE(ListId)','ListId','NOW()','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','checkContactHopper'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0xf81c,0x103));var _0xcf81=function(_0x31eb98,_0x592fa2){_0x31eb98=_0x31eb98-0x0;var _0x20cf3e=_0xf81c[_0x31eb98];return _0x20cf3e;};'use strict';var emlformat=require(_0xcf81('0x0'));var rimraf=require(_0xcf81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf81('0x2'));var rp=require(_0xcf81('0x3'));var moment=require(_0xcf81('0x4'));var BPromise=require(_0xcf81('0x5'));var Mustache=require(_0xcf81('0x6'));var util=require('util');var path=require(_0xcf81('0x7'));var sox=require(_0xcf81('0x8'));var csv=require(_0xcf81('0x9'));var ejs=require(_0xcf81('0xa'));var fs=require('fs');var fs_extra=require(_0xcf81('0xb'));var _=require(_0xcf81('0xc'));var squel=require('squel');var crypto=require(_0xcf81('0xd'));var jsforce=require(_0xcf81('0xe'));var deskjs=require(_0xcf81('0xf'));var toCsv=require(_0xcf81('0x9'));var querystring=require(_0xcf81('0x10'));var Papa=require(_0xcf81('0x11'));var Redis=require(_0xcf81('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcf81('0x13'));var hardwareService=require(_0xcf81('0x14'));var logger=require(_0xcf81('0x15'))(_0xcf81('0x16'));var utils=require(_0xcf81('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcf81('0x18'))['db'];function respondWithStatusCode(_0x1d09db,_0x4af7bd){_0x4af7bd=_0x4af7bd||0xcc;return function(_0x228b24){if(_0x228b24){return _0x1d09db[_0xcf81('0x19')](_0x4af7bd);}return _0x1d09db['status'](_0x4af7bd)[_0xcf81('0x1a')]();};}function respondWithResult(_0x4e9285,_0x2016e8){_0x2016e8=_0x2016e8||0xc8;return function(_0x5a1e95){if(_0x5a1e95){return _0x4e9285[_0xcf81('0x1b')](_0x2016e8)['json'](_0x5a1e95);}};}function respondWithFilteredResult(_0x507bc5,_0x1a9f0d){return function(_0x48e19f){if(_0x48e19f){var _0x1f6f83=typeof _0x1a9f0d[_0xcf81('0x1c')]===_0xcf81('0x1d')&&typeof _0x1a9f0d[_0xcf81('0x1e')]===_0xcf81('0x1d');var _0x5caea3=_0x48e19f['count'];var _0x3c460b=_0x1f6f83?0x0:_0x1a9f0d['offset'];var _0x3c0736=_0x1f6f83?_0x48e19f[_0xcf81('0x1f')]:_0x1a9f0d['offset']+_0x1a9f0d[_0xcf81('0x1e')];var _0x693743;if(_0x3c0736>=_0x5caea3){_0x3c0736=_0x5caea3;_0x693743=0xc8;}else{_0x693743=0xce;}_0x507bc5[_0xcf81('0x1b')](_0x693743);return _0x507bc5['set'](_0xcf81('0x20'),_0x3c460b+'-'+_0x3c0736+'/'+_0x5caea3)[_0xcf81('0x21')](_0x48e19f);}return null;};}function patchUpdates(_0x4d4807){return function(_0x4f37ad){try{jsonpatch[_0xcf81('0x22')](_0x4f37ad,_0x4d4807,!![]);}catch(_0xd59061){return BPromise['reject'](_0xd59061);}return _0x4f37ad[_0xcf81('0x23')]();};}function saveUpdates(_0x29184c,_0x198008){return function(_0x3b5ad0){if(_0x3b5ad0){return _0x3b5ad0[_0xcf81('0x24')](_0x29184c)[_0xcf81('0x25')](function(_0x53af44){return _0x53af44;});}return null;};}function removeEntity(_0x2294b3,_0x357ed6){return function(_0x57ad6d){if(_0x57ad6d){return _0x57ad6d[_0xcf81('0x26')]()[_0xcf81('0x25')](function(){_0x2294b3[_0xcf81('0x1b')](0xcc)[_0xcf81('0x1a')]();});}};}function handleEntityNotFound(_0x7b8ab0,_0x1f17b1){return function(_0xad0d03){if(!_0xad0d03){_0x7b8ab0['sendStatus'](0x194);}return _0xad0d03;};}function handleError(_0x17a1cc,_0x263ca6){_0x263ca6=_0x263ca6||0x1f4;return function(_0x55bd75){logger['error'](_0x55bd75[_0xcf81('0x27')]);if(_0x55bd75[_0xcf81('0x28')]){delete _0x55bd75['name'];}_0x17a1cc[_0xcf81('0x1b')](_0x263ca6)[_0xcf81('0x29')](_0x55bd75);};}exports[_0xcf81('0x2a')]=function(_0x47c325,_0x3270d9){var _0x4d7277={},_0x536df6={},_0x438429={'count':0x0,'rows':[]};var _0x8c505b=_[_0xcf81('0x2b')](db['CmHopperFinal']['rawAttributes'],function(_0x5794bc){return{'name':_0x5794bc[_0xcf81('0x2c')],'type':_0x5794bc['type'][_0xcf81('0x2d')]};});_0x536df6['model']=_[_0xcf81('0x2b')](_0x8c505b,'name');_0x536df6[_0xcf81('0x2e')]=_[_0xcf81('0x2f')](_0x47c325[_0xcf81('0x2e')]);_0x536df6['filters']=_[_0xcf81('0x30')](_0x536df6[_0xcf81('0x31')],_0x536df6[_0xcf81('0x2e')]);_0x4d7277[_0xcf81('0x32')]=_[_0xcf81('0x30')](_0x536df6[_0xcf81('0x31')],qs[_0xcf81('0x33')](_0x47c325['query'][_0xcf81('0x33')]));_0x4d7277[_0xcf81('0x32')]=_0x4d7277[_0xcf81('0x32')][_0xcf81('0x34')]?_0x4d7277[_0xcf81('0x32')]:_0x536df6['model'];if(!_0x47c325[_0xcf81('0x2e')][_0xcf81('0x35')]('nolimit')){_0x4d7277[_0xcf81('0x1e')]=qs[_0xcf81('0x1e')](_0x47c325[_0xcf81('0x2e')][_0xcf81('0x1e')]);_0x4d7277[_0xcf81('0x1c')]=qs[_0xcf81('0x1c')](_0x47c325['query'][_0xcf81('0x1c')]);}_0x4d7277[_0xcf81('0x36')]=qs[_0xcf81('0x37')](_0x47c325[_0xcf81('0x2e')]['sort']);_0x4d7277[_0xcf81('0x38')]=qs[_0xcf81('0x39')](_[_0xcf81('0x3a')](_0x47c325[_0xcf81('0x2e')],_0x536df6[_0xcf81('0x39')]),_0x8c505b);if(_0x47c325['query'][_0xcf81('0x3b')]){_0x4d7277['where']=_[_0xcf81('0x3c')](_0x4d7277['where'],{'$or':_[_0xcf81('0x2b')](_0x8c505b,function(_0x14728d){if(_0x14728d[_0xcf81('0x3d')]!==_0xcf81('0x3e')){var _0x19be46={};_0x19be46[_0x14728d[_0xcf81('0x28')]]={'$like':'%'+_0x47c325[_0xcf81('0x2e')][_0xcf81('0x3b')]+'%'};return _0x19be46;}})});}_0x4d7277=_['merge']({},_0x4d7277,_0x47c325[_0xcf81('0x3f')]);var _0x246550={'where':_0x4d7277[_0xcf81('0x38')]};return db[_0xcf81('0x40')]['count'](_0x246550)[_0xcf81('0x25')](function(_0x276835){_0x438429[_0xcf81('0x1f')]=_0x276835;if(_0x47c325[_0xcf81('0x2e')][_0xcf81('0x41')]){_0x4d7277['include']=[{'all':!![]}];}return db[_0xcf81('0x40')]['findAll'](_0x4d7277);})[_0xcf81('0x25')](function(_0x37f4e0){_0x438429['rows']=_0x37f4e0;return _0x438429;})['then'](respondWithFilteredResult(_0x3270d9,_0x4d7277))[_0xcf81('0x42')](handleError(_0x3270d9,null));};exports[_0xcf81('0x43')]=function(_0x831e4c,_0x1fcac5){var _0x22f87b={'raw':!![],'where':{'id':_0x831e4c[_0xcf81('0x44')]['id']}},_0x29b558={};_0x29b558['model']=_[_0xcf81('0x2f')](db[_0xcf81('0x40')][_0xcf81('0x45')]);_0x29b558['query']=_['keys'](_0x831e4c['query']);_0x29b558['filters']=_[_0xcf81('0x30')](_0x29b558[_0xcf81('0x31')],_0x29b558[_0xcf81('0x2e')]);_0x22f87b[_0xcf81('0x32')]=_['intersection'](_0x29b558[_0xcf81('0x31')],qs[_0xcf81('0x33')](_0x831e4c[_0xcf81('0x2e')][_0xcf81('0x33')]));_0x22f87b[_0xcf81('0x32')]=_0x22f87b[_0xcf81('0x32')][_0xcf81('0x34')]?_0x22f87b[_0xcf81('0x32')]:_0x29b558[_0xcf81('0x31')];if(_0x831e4c['query'][_0xcf81('0x41')]){_0x22f87b[_0xcf81('0x46')]=[{'all':!![]}];}_0x22f87b=_[_0xcf81('0x3c')]({},_0x22f87b,_0x831e4c[_0xcf81('0x3f')]);return db[_0xcf81('0x40')][_0xcf81('0x47')](_0x22f87b)['then'](handleEntityNotFound(_0x1fcac5,null))['then'](respondWithResult(_0x1fcac5,null))[_0xcf81('0x42')](handleError(_0x1fcac5,null));};exports[_0xcf81('0x48')]=function(_0x1eb028,_0x11d170){return db[_0xcf81('0x40')]['describe']()['then'](respondWithResult(_0x11d170,null))[_0xcf81('0x42')](handleError(_0x11d170,null));};exports['update']=function(_0x17c984,_0x581595){if(_0x17c984['body'][_0xcf81('0x49')]){delete _0x17c984[_0xcf81('0x4a')][_0xcf81('0x49')];}return db[_0xcf81('0x40')][_0xcf81('0x47')]({'where':{'uniqueid':_0x17c984['params']['id']}})[_0xcf81('0x25')](handleEntityNotFound(_0x581595,null))['then'](saveUpdates(_0x17c984[_0xcf81('0x4a')],null))['then'](respondWithResult(_0x581595,null))[_0xcf81('0x42')](handleError(_0x581595,null));};exports[_0xcf81('0x4b')]=function(_0x240fb3,_0x3a2c22,_0x167892){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x240fb3[_0xcf81('0x44')]['id']},'attributes':[[db[_0xcf81('0x4c')]['fn'](_0xcf81('0x4d'),db[_0xcf81('0x4c')]['fn']('IF',db['sequelize'][_0xcf81('0x4e')](_0xcf81('0x4f')))),_0xcf81('0x50')],[db[_0xcf81('0x4c')]['fn'](_0xcf81('0x4d'),db[_0xcf81('0x4c')]['fn']('IF',db[_0xcf81('0x4c')][_0xcf81('0x4e')](_0xcf81('0x51')))),_0xcf81('0x52')],[db[_0xcf81('0x4c')]['fn'](_0xcf81('0x4d'),db[_0xcf81('0x4c')]['fn']('IF',db[_0xcf81('0x4c')]['literal'](_0xcf81('0x53')))),'busyContacts'],[db[_0xcf81('0x4c')]['fn']('COUNT',db[_0xcf81('0x4c')]['fn']('IF',db[_0xcf81('0x4c')][_0xcf81('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),_0xcf81('0x54')],[db[_0xcf81('0x4c')]['fn'](_0xcf81('0x4d'),db[_0xcf81('0x4c')]['fn']('IF',db['sequelize'][_0xcf81('0x4e')](_0xcf81('0x55')))),_0xcf81('0x56')],[db['sequelize']['fn'](_0xcf81('0x4d'),db[_0xcf81('0x4c')]['fn']('IF',db[_0xcf81('0x4c')][_0xcf81('0x4e')](_0xcf81('0x57')))),_0xcf81('0x58')],[db[_0xcf81('0x4c')]['fn'](_0xcf81('0x4d'),db[_0xcf81('0x4c')]['fn']('IF',db[_0xcf81('0x4c')][_0xcf81('0x4e')](_0xcf81('0x59')))),'reCallContacts'],[db[_0xcf81('0x4c')]['fn'](_0xcf81('0x4d'),db[_0xcf81('0x4c')]['fn']('IF',db[_0xcf81('0x4c')]['literal'](_0xcf81('0x5a')))),'answeringMachine']]})[_0xcf81('0x25')](handleEntityNotFound(_0x3a2c22,null))[_0xcf81('0x25')](respondWithResult(_0x3a2c22,null))[_0xcf81('0x42')](handleError(_0x3a2c22,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x188825,_0x1597f7,_0xca2695){return db[_0xcf81('0x40')][_0xcf81('0x5b')]({'raw':![],'where':{'CampaignId':_0x188825['params']['id']},'attributes':[[db['sequelize']['fn'](_0xcf81('0x4d'),db[_0xcf81('0x4c')]['fn']('IF',db[_0xcf81('0x4c')][_0xcf81('0x4e')](_0xcf81('0x4f')))),'noSuchContacts'],[db[_0xcf81('0x4c')]['fn'](_0xcf81('0x4d'),db['sequelize']['fn']('IF',db[_0xcf81('0x4c')]['literal'](_0xcf81('0x51')))),_0xcf81('0x52')],[db[_0xcf81('0x4c')]['fn']('COUNT',db[_0xcf81('0x4c')]['fn']('IF',db['sequelize'][_0xcf81('0x4e')](_0xcf81('0x53')))),_0xcf81('0x5c')],[db[_0xcf81('0x4c')]['fn'](_0xcf81('0x4d'),db[_0xcf81('0x4c')]['fn']('IF',db['sequelize'][_0xcf81('0x4e')](_0xcf81('0x5d')))),_0xcf81('0x54')],[db[_0xcf81('0x4c')]['fn'](_0xcf81('0x4d'),db['sequelize']['fn']('IF',db[_0xcf81('0x4c')][_0xcf81('0x4e')](_0xcf81('0x55')))),_0xcf81('0x56')],[db[_0xcf81('0x4c')]['fn'](_0xcf81('0x4d'),db[_0xcf81('0x4c')]['fn']('IF',db['sequelize'][_0xcf81('0x4e')](_0xcf81('0x57')))),'abandonedContacts'],[db[_0xcf81('0x4c')]['fn'](_0xcf81('0x4d'),db[_0xcf81('0x4c')]['fn']('IF',db[_0xcf81('0x4c')][_0xcf81('0x4e')](_0xcf81('0x59')))),_0xcf81('0x5e')],[db[_0xcf81('0x4c')]['fn'](_0xcf81('0x4d'),db['sequelize']['fn']('IF',db[_0xcf81('0x4c')][_0xcf81('0x4e')](_0xcf81('0x5a')))),'answeringMachine']]})[_0xcf81('0x25')](handleEntityNotFound(_0x1597f7,null))[_0xcf81('0x25')](respondWithResult(_0x1597f7,null))['catch'](handleError(_0x1597f7,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x1fbc25,_0x5544d1,_0x5ec114){return db['VoiceQueue'][_0xcf81('0x47')]({'where':{'id':_0x1fbc25['params']['id']}})[_0xcf81('0x25')](handleEntityNotFound(_0x5544d1,null))[_0xcf81('0x25')](function(_0x53336d){var _0x503bbf;if(_0x53336d){_0x503bbf=squel['insert']()[_0xcf81('0x5f')](_0xcf81('0x60'))[_0xcf81('0x61')]([_0xcf81('0x62'),_0xcf81('0x63'),'ContactId','ListId',_0xcf81('0x64'),_0xcf81('0x65'),'updatedAt'],squel[_0xcf81('0x66')]()[_0xcf81('0x67')](_0xcf81('0x68'),'phone')['field']('NOW()','scheduledAt')[_0xcf81('0x67')]('ANY_VALUE(ContactId)',_0xcf81('0x69'))[_0xcf81('0x67')](_0xcf81('0x6a'),_0xcf81('0x6b'))['field']('ANY_VALUE(VoiceQueueId)',_0xcf81('0x64'))[_0xcf81('0x67')](_0xcf81('0x6c'),_0xcf81('0x65'))[_0xcf81('0x67')](_0xcf81('0x6c'),_0xcf81('0x6d'))[_0xcf81('0x6e')](_0xcf81('0x6f'))[_0xcf81('0x38')](_0xcf81('0x70'),_0x1fbc25[_0xcf81('0x44')]['id'][_0xcf81('0x71')]())['where'](_0xcf81('0x72'),_0x1fbc25[_0xcf81('0x4a')][_0xcf81('0x73')][_0xcf81('0x71')]())[_0xcf81('0x38')](_0xcf81('0x74'))[_0xcf81('0x38')](_0xcf81('0x75'),squel['select']()[_0xcf81('0x67')](_0xcf81('0x62'))[_0xcf81('0x6e')](_0xcf81('0x60'))[_0xcf81('0x38')](_0xcf81('0x70'),_0x1fbc25[_0xcf81('0x44')]['id']['toString']()))[_0xcf81('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xcf81('0x66')]()[_0xcf81('0x67')]('calleridnum')[_0xcf81('0x6e')](_0xcf81('0x6f'))[_0xcf81('0x38')]('VoiceQueueId\x20=\x20?',_0x1fbc25[_0xcf81('0x44')]['id'][_0xcf81('0x71')]())[_0xcf81('0x38')](_0xcf81('0x76')))[_0xcf81('0x77')]('ContactId'))['toString']();return db[_0xcf81('0x4c')][_0xcf81('0x2e')](_0x503bbf);}return[];})['then'](respondWithResult(_0x5544d1,null))[_0xcf81('0x42')](handleError(_0x5544d1,null));};exports[_0xcf81('0x78')]=function(_0x1cb399,_0x37d6c9,_0x3fde0b){return db['Campaign']['find']({'where':{'id':_0x1cb399[_0xcf81('0x44')]['id']}})[_0xcf81('0x25')](handleEntityNotFound(_0x37d6c9,null))[_0xcf81('0x25')](function(_0x476fc8){var _0x5daaf8;if(_0x476fc8){_0x5daaf8=squel[_0xcf81('0x79')]()[_0xcf81('0x5f')](_0xcf81('0x60'))[_0xcf81('0x61')]([_0xcf81('0x62'),'scheduledAt',_0xcf81('0x69'),_0xcf81('0x6b'),_0xcf81('0x7a'),_0xcf81('0x65'),_0xcf81('0x6d')],squel[_0xcf81('0x66')]()[_0xcf81('0x67')](_0xcf81('0x68'),'phone')['field']('NOW()','scheduledAt')['field'](_0xcf81('0x7b'),_0xcf81('0x69'))[_0xcf81('0x67')](_0xcf81('0x6a'),_0xcf81('0x6b'))['field'](_0xcf81('0x7c'),_0xcf81('0x7a'))[_0xcf81('0x67')](_0xcf81('0x6c'),_0xcf81('0x65'))[_0xcf81('0x67')](_0xcf81('0x6c'),_0xcf81('0x6d'))['from'](_0xcf81('0x6f'))[_0xcf81('0x38')](_0xcf81('0x7d'),_0x1cb399[_0xcf81('0x44')]['id'][_0xcf81('0x71')]())['where'](_0xcf81('0x72'),_0x1cb399[_0xcf81('0x4a')]['state'][_0xcf81('0x71')]())[_0xcf81('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xcf81('0x38')](_0xcf81('0x75'),squel[_0xcf81('0x66')]()['field'](_0xcf81('0x62'))['from'](_0xcf81('0x60'))['where'](_0xcf81('0x7d'),_0x1cb399[_0xcf81('0x44')]['id']['toString']()))['where'](_0xcf81('0x75'),squel[_0xcf81('0x66')]()[_0xcf81('0x67')](_0xcf81('0x7e'))[_0xcf81('0x6e')](_0xcf81('0x6f'))['where'](_0xcf81('0x7d'),_0x1cb399['params']['id']['toString']())[_0xcf81('0x38')]('state\x20=\x204'))[_0xcf81('0x77')]('ContactId'))[_0xcf81('0x71')]();return db[_0xcf81('0x4c')][_0xcf81('0x2e')](_0x5daaf8);}return[];})[_0xcf81('0x25')](respondWithResult(_0x37d6c9,null))[_0xcf81('0x42')](handleError(_0x37d6c9,null));};exports[_0xcf81('0x7f')]=function(_0x5c4901,_0x2d20b2,_0x4a9991){return db[_0xcf81('0x80')]['findOne']({'where':{'VoiceQueueId':_0x5c4901[_0xcf81('0x4a')][_0xcf81('0x64')],'CampaignId':_0x5c4901[_0xcf81('0x4a')][_0xcf81('0x7a')],'ContactId':_0x5c4901['body'][_0xcf81('0x69')]}})[_0xcf81('0x25')](handleEntityNotFound(_0x2d20b2,null))[_0xcf81('0x25')](function(_0x41acda){if(_0x41acda){return _0x41acda;}return null;})[_0xcf81('0x25')](respondWithResult(_0x2d20b2,null))[_0xcf81('0x42')](handleError(_0x2d20b2,null));}; \ No newline at end of file +var _0xd291=['ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','COUNT','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt','ANY_VALUE(ContactId)'];(function(_0x5421f4,_0x1e1aca){var _0x3bbe7b=function(_0x213674){while(--_0x213674){_0x5421f4['push'](_0x5421f4['shift']());}};_0x3bbe7b(++_0x1e1aca);}(_0xd291,0x117));var _0x1d29=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd291[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x1d29('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1d29('0x1'));var jsonpatch=require(_0x1d29('0x2'));var rp=require('request-promise');var moment=require(_0x1d29('0x3'));var BPromise=require(_0x1d29('0x4'));var Mustache=require(_0x1d29('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1d29('0x6'));var csv=require(_0x1d29('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d29('0x8'));var _=require(_0x1d29('0x9'));var squel=require(_0x1d29('0xa'));var crypto=require('crypto');var jsforce=require(_0x1d29('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1d29('0x7'));var querystring=require('querystring');var Papa=require(_0x1d29('0xc'));var Redis=require(_0x1d29('0xd'));var authService=require(_0x1d29('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1d29('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d29('0x10'))('api');var utils=require(_0x1d29('0x11'));var config=require(_0x1d29('0x12'));var licenseUtil=require(_0x1d29('0x13'));var db=require(_0x1d29('0x14'))['db'];function respondWithStatusCode(_0x1d7750,_0x207176){_0x207176=_0x207176||0xcc;return function(_0x4b0282){if(_0x4b0282){return _0x1d7750[_0x1d29('0x15')](_0x207176);}return _0x1d7750[_0x1d29('0x16')](_0x207176)[_0x1d29('0x17')]();};}function respondWithResult(_0x4719ff,_0x5c956a){_0x5c956a=_0x5c956a||0xc8;return function(_0x2f230e){if(_0x2f230e){return _0x4719ff['status'](_0x5c956a)[_0x1d29('0x18')](_0x2f230e);}};}function respondWithFilteredResult(_0x645289,_0x17ae27){return function(_0x335d8f){if(_0x335d8f){var _0x26b134=typeof _0x17ae27[_0x1d29('0x19')]===_0x1d29('0x1a')&&typeof _0x17ae27[_0x1d29('0x1b')]===_0x1d29('0x1a');var _0x4ddf1a=_0x335d8f['count'];var _0x4f2ca4=_0x26b134?0x0:_0x17ae27[_0x1d29('0x19')];var _0x135d50=_0x26b134?_0x335d8f[_0x1d29('0x1c')]:_0x17ae27['offset']+_0x17ae27[_0x1d29('0x1b')];var _0x4257ec;if(_0x135d50>=_0x4ddf1a){_0x135d50=_0x4ddf1a;_0x4257ec=0xc8;}else{_0x4257ec=0xce;}_0x645289[_0x1d29('0x16')](_0x4257ec);return _0x645289[_0x1d29('0x1d')]('Content-Range',_0x4f2ca4+'-'+_0x135d50+'/'+_0x4ddf1a)['json'](_0x335d8f);}return null;};}function patchUpdates(_0x8999f){return function(_0x189fc8){try{jsonpatch[_0x1d29('0x1e')](_0x189fc8,_0x8999f,!![]);}catch(_0x571834){return BPromise[_0x1d29('0x1f')](_0x571834);}return _0x189fc8['save']();};}function saveUpdates(_0x1c76e4,_0x39baef){return function(_0x373bc6){if(_0x373bc6){return _0x373bc6[_0x1d29('0x20')](_0x1c76e4)[_0x1d29('0x21')](function(_0x13031d){return _0x13031d;});}return null;};}function removeEntity(_0x214921,_0x44c98d){return function(_0x501f89){if(_0x501f89){return _0x501f89[_0x1d29('0x22')]()['then'](function(){_0x214921[_0x1d29('0x16')](0xcc)[_0x1d29('0x17')]();});}};}function handleEntityNotFound(_0x224c82,_0x20df76){return function(_0x498a19){if(!_0x498a19){_0x224c82['sendStatus'](0x194);}return _0x498a19;};}function handleError(_0x298aee,_0x1055b0){_0x1055b0=_0x1055b0||0x1f4;return function(_0x407135){logger['error'](_0x407135[_0x1d29('0x23')]);if(_0x407135[_0x1d29('0x24')]){delete _0x407135[_0x1d29('0x24')];}_0x298aee['status'](_0x1055b0)[_0x1d29('0x25')](_0x407135);};}exports[_0x1d29('0x26')]=function(_0x16d798,_0x88ddb1){var _0x2b05fc={},_0x2b3544={},_0x2d7838={'count':0x0,'rows':[]};var _0x1ec1b8=_[_0x1d29('0x27')](db[_0x1d29('0x28')][_0x1d29('0x29')],function(_0x51a86a){return{'name':_0x51a86a[_0x1d29('0x2a')],'type':_0x51a86a[_0x1d29('0x2b')][_0x1d29('0x2c')]};});_0x2b3544[_0x1d29('0x2d')]=_[_0x1d29('0x27')](_0x1ec1b8,'name');_0x2b3544[_0x1d29('0x2e')]=_[_0x1d29('0x2f')](_0x16d798[_0x1d29('0x2e')]);_0x2b3544['filters']=_[_0x1d29('0x30')](_0x2b3544['model'],_0x2b3544[_0x1d29('0x2e')]);_0x2b05fc[_0x1d29('0x31')]=_['intersection'](_0x2b3544[_0x1d29('0x2d')],qs[_0x1d29('0x32')](_0x16d798[_0x1d29('0x2e')][_0x1d29('0x32')]));_0x2b05fc[_0x1d29('0x31')]=_0x2b05fc[_0x1d29('0x31')]['length']?_0x2b05fc['attributes']:_0x2b3544[_0x1d29('0x2d')];if(!_0x16d798[_0x1d29('0x2e')][_0x1d29('0x33')](_0x1d29('0x34'))){_0x2b05fc[_0x1d29('0x1b')]=qs['limit'](_0x16d798[_0x1d29('0x2e')][_0x1d29('0x1b')]);_0x2b05fc[_0x1d29('0x19')]=qs[_0x1d29('0x19')](_0x16d798[_0x1d29('0x2e')][_0x1d29('0x19')]);}_0x2b05fc[_0x1d29('0x35')]=qs[_0x1d29('0x36')](_0x16d798[_0x1d29('0x2e')]['sort']);_0x2b05fc[_0x1d29('0x37')]=qs[_0x1d29('0x38')](_[_0x1d29('0x39')](_0x16d798['query'],_0x2b3544[_0x1d29('0x38')]),_0x1ec1b8);if(_0x16d798[_0x1d29('0x2e')][_0x1d29('0x3a')]){_0x2b05fc[_0x1d29('0x37')]=_[_0x1d29('0x3b')](_0x2b05fc[_0x1d29('0x37')],{'$or':_[_0x1d29('0x27')](_0x1ec1b8,function(_0xd820e9){if(_0xd820e9[_0x1d29('0x2b')]!=='VIRTUAL'){var _0x26a3e4={};_0x26a3e4[_0xd820e9[_0x1d29('0x24')]]={'$like':'%'+_0x16d798[_0x1d29('0x2e')]['filter']+'%'};return _0x26a3e4;}})});}_0x2b05fc=_[_0x1d29('0x3b')]({},_0x2b05fc,_0x16d798[_0x1d29('0x3c')]);var _0x3e62c5={'where':_0x2b05fc[_0x1d29('0x37')]};return db[_0x1d29('0x28')][_0x1d29('0x1c')](_0x3e62c5)['then'](function(_0x1c1526){_0x2d7838[_0x1d29('0x1c')]=_0x1c1526;if(_0x16d798[_0x1d29('0x2e')][_0x1d29('0x3d')]){_0x2b05fc[_0x1d29('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x1d29('0x3f')](_0x2b05fc);})[_0x1d29('0x21')](function(_0x5c7651){_0x2d7838[_0x1d29('0x40')]=_0x5c7651;return _0x2d7838;})[_0x1d29('0x21')](respondWithFilteredResult(_0x88ddb1,_0x2b05fc))[_0x1d29('0x41')](handleError(_0x88ddb1,null));};exports[_0x1d29('0x42')]=function(_0x726432,_0x36d01c){var _0x3becfe={'raw':!![],'where':{'id':_0x726432[_0x1d29('0x43')]['id']}},_0xb9b799={};_0xb9b799['model']=_[_0x1d29('0x2f')](db['CmHopperFinal']['rawAttributes']);_0xb9b799['query']=_[_0x1d29('0x2f')](_0x726432[_0x1d29('0x2e')]);_0xb9b799[_0x1d29('0x38')]=_[_0x1d29('0x30')](_0xb9b799[_0x1d29('0x2d')],_0xb9b799[_0x1d29('0x2e')]);_0x3becfe['attributes']=_[_0x1d29('0x30')](_0xb9b799['model'],qs[_0x1d29('0x32')](_0x726432['query'][_0x1d29('0x32')]));_0x3becfe[_0x1d29('0x31')]=_0x3becfe[_0x1d29('0x31')][_0x1d29('0x44')]?_0x3becfe[_0x1d29('0x31')]:_0xb9b799[_0x1d29('0x2d')];if(_0x726432[_0x1d29('0x2e')][_0x1d29('0x3d')]){_0x3becfe['include']=[{'all':!![]}];}_0x3becfe=_[_0x1d29('0x3b')]({},_0x3becfe,_0x726432['options']);return db['CmHopperFinal'][_0x1d29('0x45')](_0x3becfe)[_0x1d29('0x21')](handleEntityNotFound(_0x36d01c,null))[_0x1d29('0x21')](respondWithResult(_0x36d01c,null))[_0x1d29('0x41')](handleError(_0x36d01c,null));};exports[_0x1d29('0x46')]=function(_0x597119,_0x321762){return db['CmHopperFinal'][_0x1d29('0x46')]()[_0x1d29('0x21')](respondWithResult(_0x321762,null))[_0x1d29('0x41')](handleError(_0x321762,null));};exports[_0x1d29('0x20')]=function(_0x4a7053,_0x4bebb5){if(_0x4a7053['body']['uniqueid']){delete _0x4a7053[_0x1d29('0x47')][_0x1d29('0x48')];}return db[_0x1d29('0x28')][_0x1d29('0x45')]({'where':{'uniqueid':_0x4a7053['params']['id']}})[_0x1d29('0x21')](handleEntityNotFound(_0x4bebb5,null))[_0x1d29('0x21')](saveUpdates(_0x4a7053[_0x1d29('0x47')],null))['then'](respondWithResult(_0x4bebb5,null))[_0x1d29('0x41')](handleError(_0x4bebb5,null));};exports[_0x1d29('0x49')]=function(_0x53fcf3,_0x45ff9b,_0x340ad0){return db[_0x1d29('0x28')][_0x1d29('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x53fcf3[_0x1d29('0x43')]['id']},'attributes':[[db[_0x1d29('0x4a')]['fn']('COUNT',db[_0x1d29('0x4a')]['fn']('IF',db[_0x1d29('0x4a')]['literal'](_0x1d29('0x4b')))),_0x1d29('0x4c')],[db[_0x1d29('0x4a')]['fn']('COUNT',db[_0x1d29('0x4a')]['fn']('IF',db[_0x1d29('0x4a')][_0x1d29('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db['sequelize']['fn'](_0x1d29('0x4e'),db[_0x1d29('0x4a')]['fn']('IF',db[_0x1d29('0x4a')][_0x1d29('0x4d')](_0x1d29('0x4f')))),'busyContacts'],[db['sequelize']['fn'](_0x1d29('0x4e'),db[_0x1d29('0x4a')]['fn']('IF',db[_0x1d29('0x4a')][_0x1d29('0x4d')](_0x1d29('0x50')))),_0x1d29('0x51')],[db[_0x1d29('0x4a')]['fn'](_0x1d29('0x4e'),db['sequelize']['fn']('IF',db[_0x1d29('0x4a')][_0x1d29('0x4d')](_0x1d29('0x52')))),_0x1d29('0x53')],[db[_0x1d29('0x4a')]['fn'](_0x1d29('0x4e'),db['sequelize']['fn']('IF',db[_0x1d29('0x4a')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1d29('0x54')],[db['sequelize']['fn'](_0x1d29('0x4e'),db['sequelize']['fn']('IF',db[_0x1d29('0x4a')][_0x1d29('0x4d')](_0x1d29('0x55')))),_0x1d29('0x56')],[db[_0x1d29('0x4a')]['fn'](_0x1d29('0x4e'),db['sequelize']['fn']('IF',db[_0x1d29('0x4a')]['literal'](_0x1d29('0x57')))),_0x1d29('0x58')]]})[_0x1d29('0x21')](handleEntityNotFound(_0x45ff9b,null))['then'](respondWithResult(_0x45ff9b,null))[_0x1d29('0x41')](handleError(_0x45ff9b,null));};exports[_0x1d29('0x59')]=function(_0x193547,_0x34dcaf,_0x1fa70a){return db[_0x1d29('0x28')][_0x1d29('0x3f')]({'raw':![],'where':{'CampaignId':_0x193547[_0x1d29('0x43')]['id']},'attributes':[[db[_0x1d29('0x4a')]['fn'](_0x1d29('0x4e'),db[_0x1d29('0x4a')]['fn']('IF',db[_0x1d29('0x4a')]['literal'](_0x1d29('0x4b')))),_0x1d29('0x4c')],[db[_0x1d29('0x4a')]['fn']('COUNT',db[_0x1d29('0x4a')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x1d29('0x5a')],[db[_0x1d29('0x4a')]['fn'](_0x1d29('0x4e'),db[_0x1d29('0x4a')]['fn']('IF',db['sequelize'][_0x1d29('0x4d')](_0x1d29('0x4f')))),'busyContacts'],[db['sequelize']['fn'](_0x1d29('0x4e'),db[_0x1d29('0x4a')]['fn']('IF',db[_0x1d29('0x4a')]['literal'](_0x1d29('0x50')))),_0x1d29('0x51')],[db[_0x1d29('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1d29('0x4a')][_0x1d29('0x4d')](_0x1d29('0x52')))),_0x1d29('0x53')],[db[_0x1d29('0x4a')]['fn']('COUNT',db[_0x1d29('0x4a')]['fn']('IF',db[_0x1d29('0x4a')][_0x1d29('0x4d')](_0x1d29('0x5b')))),'abandonedContacts'],[db['sequelize']['fn'](_0x1d29('0x4e'),db[_0x1d29('0x4a')]['fn']('IF',db[_0x1d29('0x4a')][_0x1d29('0x4d')](_0x1d29('0x55')))),'reCallContacts'],[db[_0x1d29('0x4a')]['fn'](_0x1d29('0x4e'),db[_0x1d29('0x4a')]['fn']('IF',db['sequelize'][_0x1d29('0x4d')](_0x1d29('0x57')))),'answeringMachine']]})[_0x1d29('0x21')](handleEntityNotFound(_0x34dcaf,null))[_0x1d29('0x21')](respondWithResult(_0x34dcaf,null))['catch'](handleError(_0x34dcaf,null));};exports[_0x1d29('0x5c')]=function(_0x1be2ab,_0x50ce92,_0x47538e){return db[_0x1d29('0x5d')][_0x1d29('0x45')]({'where':{'id':_0x1be2ab[_0x1d29('0x43')]['id']}})[_0x1d29('0x21')](handleEntityNotFound(_0x50ce92,null))[_0x1d29('0x21')](function(_0x56c1bf){var _0x3df6c6;if(_0x56c1bf){_0x3df6c6=squel[_0x1d29('0x5e')]()['into'](_0x1d29('0x5f'))[_0x1d29('0x60')]([_0x1d29('0x61'),'scheduledAt',_0x1d29('0x62'),'ListId',_0x1d29('0x63'),_0x1d29('0x64'),_0x1d29('0x65')],squel[_0x1d29('0x66')]()[_0x1d29('0x67')](_0x1d29('0x68'),_0x1d29('0x61'))['field'](_0x1d29('0x69'),_0x1d29('0x6a'))['field'](_0x1d29('0x6b'),_0x1d29('0x62'))['field']('ANY_VALUE(ListId)',_0x1d29('0x6c'))[_0x1d29('0x67')](_0x1d29('0x6d'),_0x1d29('0x63'))[_0x1d29('0x67')]('NOW()',_0x1d29('0x64'))[_0x1d29('0x67')]('NOW()',_0x1d29('0x65'))[_0x1d29('0x6e')](_0x1d29('0x6f'))[_0x1d29('0x37')]('VoiceQueueId\x20=\x20?',_0x1be2ab['params']['id'][_0x1d29('0x70')]())[_0x1d29('0x37')](_0x1d29('0x71'),_0x1be2ab['body'][_0x1d29('0x72')][_0x1d29('0x70')]())['where'](_0x1d29('0x73'))[_0x1d29('0x37')](_0x1d29('0x74'),squel['select']()[_0x1d29('0x67')]('phone')['from'](_0x1d29('0x5f'))[_0x1d29('0x37')](_0x1d29('0x75'),_0x1be2ab[_0x1d29('0x43')]['id'][_0x1d29('0x70')]()))[_0x1d29('0x37')](_0x1d29('0x74'),squel['select']()[_0x1d29('0x67')](_0x1d29('0x76'))[_0x1d29('0x6e')](_0x1d29('0x6f'))[_0x1d29('0x37')](_0x1d29('0x75'),_0x1be2ab[_0x1d29('0x43')]['id'][_0x1d29('0x70')]())[_0x1d29('0x37')](_0x1d29('0x77')))[_0x1d29('0x78')](_0x1d29('0x62')))['toString']();return db[_0x1d29('0x4a')]['query'](_0x3df6c6);}return[];})[_0x1d29('0x21')](respondWithResult(_0x50ce92,null))[_0x1d29('0x41')](handleError(_0x50ce92,null));};exports[_0x1d29('0x79')]=function(_0x3286d5,_0x5342ea,_0x5a17eb){return db[_0x1d29('0x7a')][_0x1d29('0x45')]({'where':{'id':_0x3286d5[_0x1d29('0x43')]['id']}})[_0x1d29('0x21')](handleEntityNotFound(_0x5342ea,null))[_0x1d29('0x21')](function(_0x528cb9){var _0x322dab;if(_0x528cb9){_0x322dab=squel[_0x1d29('0x5e')]()['into']('cm_hopper')[_0x1d29('0x60')]([_0x1d29('0x61'),_0x1d29('0x6a'),'ContactId',_0x1d29('0x6c'),_0x1d29('0x7b'),_0x1d29('0x64'),'updatedAt'],squel[_0x1d29('0x66')]()['field']('ANY_VALUE(calleridnum)',_0x1d29('0x61'))[_0x1d29('0x67')](_0x1d29('0x69'),_0x1d29('0x6a'))[_0x1d29('0x67')]('ANY_VALUE(ContactId)',_0x1d29('0x62'))['field'](_0x1d29('0x7c'),_0x1d29('0x6c'))[_0x1d29('0x67')]('ANY_VALUE(CampaignId)',_0x1d29('0x7b'))['field'](_0x1d29('0x69'),_0x1d29('0x64'))[_0x1d29('0x67')]('NOW()','updatedAt')[_0x1d29('0x6e')](_0x1d29('0x6f'))[_0x1d29('0x37')]('CampaignId\x20=\x20?',_0x3286d5[_0x1d29('0x43')]['id'][_0x1d29('0x70')]())['where']('state\x20=\x20?',_0x3286d5['body'][_0x1d29('0x72')][_0x1d29('0x70')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x1d29('0x37')](_0x1d29('0x74'),squel['select']()[_0x1d29('0x67')]('phone')[_0x1d29('0x6e')]('cm_hopper')['where'](_0x1d29('0x7d'),_0x3286d5[_0x1d29('0x43')]['id'][_0x1d29('0x70')]()))['where'](_0x1d29('0x74'),squel['select']()[_0x1d29('0x67')](_0x1d29('0x76'))['from'](_0x1d29('0x6f'))[_0x1d29('0x37')](_0x1d29('0x7d'),_0x3286d5['params']['id']['toString']())[_0x1d29('0x37')](_0x1d29('0x77')))[_0x1d29('0x78')]('ContactId'))['toString']();return db[_0x1d29('0x4a')][_0x1d29('0x2e')](_0x322dab);}return[];})[_0x1d29('0x21')](respondWithResult(_0x5342ea,null))[_0x1d29('0x41')](handleError(_0x5342ea,null));};exports[_0x1d29('0x7e')]=function(_0x10d2e0,_0x250db5,_0xdd3055){return db[_0x1d29('0x7f')][_0x1d29('0x80')]({'where':{'VoiceQueueId':_0x10d2e0[_0x1d29('0x47')]['VoiceQueueId'],'CampaignId':_0x10d2e0['body'][_0x1d29('0x7b')],'ContactId':_0x10d2e0[_0x1d29('0x47')]['ContactId']}})[_0x1d29('0x21')](handleEntityNotFound(_0x250db5,null))['then'](function(_0x1a19eb){if(_0x1a19eb){return _0x1a19eb;}return null;})[_0x1d29('0x21')](respondWithResult(_0x250db5,null))[_0x1d29('0x41')](handleError(_0x250db5,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 8109e8a..76758c5 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 _0xa651=['api','bluebird','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','../../config/logger'];(function(_0x2577f7,_0x4e4781){var _0x55d372=function(_0x59b397){while(--_0x59b397){_0x2577f7['push'](_0x2577f7['shift']());}};_0x55d372(++_0x4e4781);}(_0xa651,0x18b));var _0x1a65=function(_0xd63e3a,_0x1bd6eb){_0xd63e3a=_0xd63e3a-0x0;var _0x19c178=_0xa651[_0xd63e3a];return _0x19c178;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1a65('0x0'))(_0x1a65('0x1'));var moment=require('moment');var BPromise=require(_0x1a65('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1a65('0x3'));var config=require(_0x1a65('0x4'));var attributes=require(_0x1a65('0x5'));module[_0x1a65('0x6')]=function(_0x51a1ff,_0x3ebdf3){return _0x51a1ff['define'](_0x1a65('0x7'),attributes,{'tableName':_0x1a65('0x8'),'paranoid':![],'indexes':[{'name':_0x1a65('0x9'),'fields':['calleridnum']},{'name':_0x1a65('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5896=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x331ac7,_0xaef4c6){var _0x112cf8=function(_0x19d7b5){while(--_0x19d7b5){_0x331ac7['push'](_0x331ac7['shift']());}};_0x112cf8(++_0xaef4c6);}(_0x5896,0x1ef));var _0x6589=function(_0x45371e,_0x284f4b){_0x45371e=_0x45371e-0x0;var _0x92b59d=_0x5896[_0x45371e];return _0x92b59d;};'use strict';var _=require(_0x6589('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6589('0x1'));var moment=require(_0x6589('0x2'));var BPromise=require(_0x6589('0x3'));var rp=require(_0x6589('0x4'));var fs=require('fs');var path=require(_0x6589('0x5'));var rimraf=require(_0x6589('0x6'));var config=require(_0x6589('0x7'));var attributes=require(_0x6589('0x8'));module[_0x6589('0x9')]=function(_0x1c2c7e,_0x146a8f){return _0x1c2c7e['define'](_0x6589('0xa'),attributes,{'tableName':_0x6589('0xb'),'paranoid':![],'indexes':[{'name':_0x6589('0xc'),'fields':[_0x6589('0xc')]},{'name':_0x6589('0xd'),'fields':[_0x6589('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index c1fd419..feed7b2 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 _0x8aee=['then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateCmHopperFinal','body','options','raw','stringify','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x2ebe90,_0x2825d9){var _0x184e90=function(_0x1115a7){while(--_0x1115a7){_0x2ebe90['push'](_0x2ebe90['shift']());}};_0x184e90(++_0x2825d9);}(_0x8aee,0xb7));var _0xe8ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe8ae('0x0'));var util=require('util');var moment=require(_0xe8ae('0x1'));var BPromise=require(_0xe8ae('0x2'));var rs=require(_0xe8ae('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8ae('0x4'));var logger=require(_0xe8ae('0x5'))(_0xe8ae('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe8ae('0x7')][_0xe8ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26c2be,_0x2755b8,_0x403e2a){return new BPromise(function(_0x397cff,_0x3f6087){return client['request'](_0x26c2be,_0x403e2a)[_0xe8ae('0x9')](function(_0x1e4388){logger['info'](_0xe8ae('0xa'),_0x2755b8,_0xe8ae('0xb'));logger[_0xe8ae('0xc')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x2755b8,'request\x20sent',JSON['stringify'](_0x1e4388));if(_0x1e4388['error']){if(_0x1e4388[_0xe8ae('0xd')][_0xe8ae('0xe')]===0x1f4){logger[_0xe8ae('0xd')](_0xe8ae('0xa'),_0x2755b8,_0x1e4388[_0xe8ae('0xd')][_0xe8ae('0xf')]);return _0x3f6087(_0x1e4388[_0xe8ae('0xd')]['message']);}logger[_0xe8ae('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0x2755b8,_0x1e4388['error'][_0xe8ae('0xf')]);return _0x397cff(_0x1e4388[_0xe8ae('0xd')][_0xe8ae('0xf')]);}else{logger[_0xe8ae('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x2755b8,_0xe8ae('0xb'));_0x397cff(_0x1e4388[_0xe8ae('0x11')]['message']);}})[_0xe8ae('0x12')](function(_0x33ba4a){logger[_0xe8ae('0xd')](_0xe8ae('0xa'),_0x2755b8,_0x33ba4a);_0x3f6087(_0x33ba4a);});});}exports[_0xe8ae('0x13')]=function(_0x38b17e){var _0x178c6c=this;return new Promise(function(_0xf8c07d,_0x180e35){return db['CmHopperFinal']['create'](_0x38b17e[_0xe8ae('0x14')],{'raw':_0x38b17e[_0xe8ae('0x15')]?_0x38b17e[_0xe8ae('0x15')][_0xe8ae('0x16')]===undefined?!![]:![]:!![]})[_0xe8ae('0x9')](function(_0x1c1589){logger['info']('CreateCmHopperFinal',_0x38b17e);logger[_0xe8ae('0xc')](_0xe8ae('0x13'),_0x38b17e,JSON[_0xe8ae('0x17')](_0x1c1589));_0xf8c07d(_0x1c1589);})[_0xe8ae('0x12')](function(_0x2d83a0){logger['error'](_0xe8ae('0x13'),_0x2d83a0['message'],_0x38b17e);_0x180e35(_0x178c6c[_0xe8ae('0xd')](0x1f4,_0x2d83a0[_0xe8ae('0xf')]));});});}; \ No newline at end of file +var _0xcecd=['result','CreateCmHopperFinal','create','body','options','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','CmHopperFinal,\x20%s,\x20%s','message'];(function(_0x2c7689,_0x5d61d9){var _0x58b15c=function(_0x187afc){while(--_0x187afc){_0x2c7689['push'](_0x2c7689['shift']());}};_0x58b15c(++_0x5d61d9);}(_0xcecd,0xdd));var _0xdcec=function(_0xf5688a,_0x507fd0){_0xf5688a=_0xf5688a-0x0;var _0x25f036=_0xcecd[_0xf5688a];return _0x25f036;};'use strict';var _=require(_0xdcec('0x0'));var util=require(_0xdcec('0x1'));var moment=require('moment');var BPromise=require(_0xdcec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcec('0x3'));var db=require(_0xdcec('0x4'))['db'];var utils=require(_0xdcec('0x5'));var logger=require(_0xdcec('0x6'))('rpc');var config=require(_0xdcec('0x7'));var jayson=require(_0xdcec('0x8'));var client=jayson[_0xdcec('0x9')][_0xdcec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x137ab7,_0xabdec3,_0x3e4ef0){return new BPromise(function(_0x4472dc,_0x4d1649){return client['request'](_0x137ab7,_0x3e4ef0)[_0xdcec('0xb')](function(_0x4dc50c){logger[_0xdcec('0xc')]('CmHopperFinal,\x20%s,\x20%s',_0xabdec3,_0xdcec('0xd'));logger[_0xdcec('0xe')](_0xdcec('0xf'),_0xabdec3,'request\x20sent',JSON['stringify'](_0x4dc50c));if(_0x4dc50c['error']){if(_0x4dc50c[_0xdcec('0x10')]['code']===0x1f4){logger[_0xdcec('0x10')](_0xdcec('0x11'),_0xabdec3,_0x4dc50c[_0xdcec('0x10')]['message']);return _0x4d1649(_0x4dc50c[_0xdcec('0x10')][_0xdcec('0x12')]);}logger[_0xdcec('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0xabdec3,_0x4dc50c[_0xdcec('0x10')][_0xdcec('0x12')]);return _0x4472dc(_0x4dc50c[_0xdcec('0x10')][_0xdcec('0x12')]);}else{logger[_0xdcec('0xc')]('CmHopperFinal,\x20%s,\x20%s',_0xabdec3,_0xdcec('0xd'));_0x4472dc(_0x4dc50c[_0xdcec('0x13')]['message']);}})['catch'](function(_0x57bd83){logger[_0xdcec('0x10')](_0xdcec('0x11'),_0xabdec3,_0x57bd83);_0x4d1649(_0x57bd83);});});}exports[_0xdcec('0x14')]=function(_0x24e710){var _0x122c0a=this;return new Promise(function(_0x52d81a,_0x2ddac1){return db['CmHopperFinal'][_0xdcec('0x15')](_0x24e710[_0xdcec('0x16')],{'raw':_0x24e710['options']?_0x24e710[_0xdcec('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xdcec('0xb')](function(_0x5d202c){logger[_0xdcec('0xc')](_0xdcec('0x14'),_0x24e710);logger[_0xdcec('0xe')](_0xdcec('0x14'),_0x24e710,JSON['stringify'](_0x5d202c));_0x52d81a(_0x5d202c);})['catch'](function(_0xebe86e){logger[_0xdcec('0x10')]('CreateCmHopperFinal',_0xebe86e['message'],_0x24e710);_0x2ddac1(_0x122c0a[_0xdcec('0x10')](0x1f4,_0xebe86e[_0xdcec('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index b112b5f..2803602 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 _0x1f39=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','index','get','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','post','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x52ee25,_0x279fae){var _0x255e33=function(_0x315f3b){while(--_0x315f3b){_0x52ee25['push'](_0x52ee25['shift']());}};_0x255e33(++_0x279fae);}(_0x1f39,0x66));var _0x91f3=function(_0x5815bc,_0x59caf5){_0x5815bc=_0x5815bc-0x0;var _0x1163c2=_0x1f39[_0x5815bc];return _0x1163c2;};'use strict';var multer=require(_0x91f3('0x0'));var util=require(_0x91f3('0x1'));var path=require('path');var timeout=require(_0x91f3('0x2'));var express=require(_0x91f3('0x3'));var router=express[_0x91f3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91f3('0x5'));var interaction=require(_0x91f3('0x6'));var config=require(_0x91f3('0x7'));var controller=require(_0x91f3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x91f3('0x9')]);router[_0x91f3('0xa')]('/describe',auth[_0x91f3('0xb')](),controller['describe']);router[_0x91f3('0xa')](_0x91f3('0xc'),auth['isAuthenticated'](),controller[_0x91f3('0xd')]);router[_0x91f3('0xa')](_0x91f3('0xe'),auth['isAuthenticated'](),controller[_0x91f3('0xf')]);router['get'](_0x91f3('0x10'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x91f3('0x11'),auth['isAuthenticated'](),controller[_0x91f3('0x12')]);router['post'](_0x91f3('0x13'),auth[_0x91f3('0xb')](),controller[_0x91f3('0x14')]);router[_0x91f3('0x15')](_0x91f3('0x16'),auth[_0x91f3('0xb')](),controller[_0x91f3('0x17')]);router[_0x91f3('0x18')](_0x91f3('0xc'),auth['isAuthenticated'](),controller[_0x91f3('0x19')]);module[_0x91f3('0x1a')]=router; \ No newline at end of file +var _0x55dc=['describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe'];(function(_0x2b7c38,_0x496d14){var _0x313fcc=function(_0x145a36){while(--_0x145a36){_0x2b7c38['push'](_0x2b7c38['shift']());}};_0x313fcc(++_0x496d14);}(_0x55dc,0xf8));var _0xc55d=function(_0x2a6469,_0x5ececb){_0x2a6469=_0x2a6469-0x0;var _0x443de6=_0x55dc[_0x2a6469];return _0x443de6;};'use strict';var multer=require(_0xc55d('0x0'));var util=require(_0xc55d('0x1'));var path=require(_0xc55d('0x2'));var timeout=require(_0xc55d('0x3'));var express=require(_0xc55d('0x4'));var router=express['Router']();var fs_extra=require(_0xc55d('0x5'));var auth=require(_0xc55d('0x6'));var interaction=require(_0xc55d('0x7'));var config=require(_0xc55d('0x8'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0xc55d('0x9')](),controller['index']);router[_0xc55d('0xa')](_0xc55d('0xb'),auth[_0xc55d('0x9')](),controller[_0xc55d('0xc')]);router[_0xc55d('0xa')](_0xc55d('0xd'),auth[_0xc55d('0x9')](),controller[_0xc55d('0xe')]);router[_0xc55d('0xa')](_0xc55d('0xf'),auth['isAuthenticated'](),controller[_0xc55d('0x10')]);router[_0xc55d('0xa')](_0xc55d('0x11'),auth[_0xc55d('0x9')](),controller[_0xc55d('0x12')]);router[_0xc55d('0x13')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0xc55d('0x14')]);router['post'](_0xc55d('0x15'),auth['isAuthenticated'](),controller[_0xc55d('0x16')]);router['post'](_0xc55d('0x17'),auth[_0xc55d('0x9')](),controller[_0xc55d('0x18')]);router['put']('/:id',auth[_0xc55d('0x9')](),controller[_0xc55d('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 9a471f3..671c6ba 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 _0x73b7=['sequelize','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x375b19,_0x1c4837){var _0x57828c=function(_0x20bc11){while(--_0x20bc11){_0x375b19['push'](_0x375b19['shift']());}};_0x57828c(++_0x1c4837);}(_0x73b7,0x168));var _0x773b=function(_0x4bdbc1,_0x5164ba){_0x4bdbc1=_0x4bdbc1-0x0;var _0x310b2c=_0x73b7[_0x4bdbc1];return _0x310b2c;};'use strict';var Sequelize=require(_0x773b('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x773b('0x1')]},'scheduledat':{'type':Sequelize[_0x773b('0x2')]},'countbusyretry':{'type':Sequelize[_0x773b('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x773b('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x773b('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x773b('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x773b('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x773b('0x1')]},'calleridname':{'type':Sequelize[_0x773b('0x1')]},'starttime':{'type':Sequelize[_0x773b('0x2')]},'responsetime':{'type':Sequelize[_0x773b('0x2')]},'answertime':{'type':Sequelize[_0x773b('0x2')]},'droptime':{'type':Sequelize[_0x773b('0x2')]},'endtime':{'type':Sequelize[_0x773b('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x773b('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x773b('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x773b('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x773b('0x1')]},'campaign':{'type':Sequelize[_0x773b('0x1')]},'campaigntype':{'type':Sequelize[_0x773b('0x1')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x773b('0x1')]},'amd':{'type':Sequelize[_0x773b('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x773b('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x773b('0x2')]},'recallme':{'type':Sequelize[_0x773b('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x773b('0x2')]},'edited':{'type':Sequelize[_0x773b('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x773b('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x773b('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x773b('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x773b('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6b13=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x384cde,_0x41e143){var _0x386e48=function(_0x1e61a0){while(--_0x1e61a0){_0x384cde['push'](_0x384cde['shift']());}};_0x386e48(++_0x41e143);}(_0x6b13,0xea));var _0x36b1=function(_0x24c24e,_0x1649a0){_0x24c24e=_0x24c24e-0x0;var _0x2b0732=_0x6b13[_0x24c24e];return _0x2b0732;};'use strict';var Sequelize=require(_0x36b1('0x0'));module[_0x36b1('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x36b1('0x2')]},'scheduledat':{'type':Sequelize[_0x36b1('0x3')]},'countbusyretry':{'type':Sequelize[_0x36b1('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x36b1('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x36b1('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x36b1('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x36b1('0x2')]},'originatecalleridname':{'type':Sequelize[_0x36b1('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x36b1('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x36b1('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x36b1('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x36b1('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x36b1('0x2')]},'campaigntype':{'type':Sequelize[_0x36b1('0x2')]},'membername':{'type':Sequelize[_0x36b1('0x2')]},'reason':{'type':Sequelize[_0x36b1('0x2')]},'amd':{'type':Sequelize[_0x36b1('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x36b1('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x36b1('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x36b1('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x36b1('0x3')]},'edited':{'type':Sequelize[_0x36b1('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x36b1('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 6cac26c..210568e 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 _0x69b9=['error','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','model','map','keys','attributes','intersection','fields','query','length','nolimit','sort','where','filters','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','body','update','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy'];(function(_0x1c2478,_0x466bf3){var _0x36c4af=function(_0x3b3541){while(--_0x3b3541){_0x1c2478['push'](_0x1c2478['shift']());}};_0x36c4af(++_0x466bf3);}(_0x69b9,0x6d));var _0x969b=function(_0xd97af0,_0x48a085){_0xd97af0=_0xd97af0-0x0;var _0x1fe98c=_0x69b9[_0xd97af0];return _0x1fe98c;};'use strict';var emlformat=require(_0x969b('0x0'));var rimraf=require(_0x969b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x969b('0x2'));var rp=require(_0x969b('0x3'));var moment=require(_0x969b('0x4'));var BPromise=require(_0x969b('0x5'));var Mustache=require(_0x969b('0x6'));var util=require(_0x969b('0x7'));var path=require('path');var sox=require(_0x969b('0x8'));var csv=require(_0x969b('0x9'));var ejs=require(_0x969b('0xa'));var fs=require('fs');var fs_extra=require(_0x969b('0xb'));var _=require(_0x969b('0xc'));var squel=require(_0x969b('0xd'));var crypto=require(_0x969b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x969b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x969b('0x10'));var Redis=require(_0x969b('0x11'));var authService=require(_0x969b('0x12'));var qs=require(_0x969b('0x13'));var as=require(_0x969b('0x14'));var hardwareService=require(_0x969b('0x15'));var logger=require(_0x969b('0x16'))(_0x969b('0x17'));var utils=require(_0x969b('0x18'));var config=require(_0x969b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x969b('0x1a'))['db'];function respondWithStatusCode(_0x2319c5,_0x2b8f69){_0x2b8f69=_0x2b8f69||0xcc;return function(_0x299ebd){if(_0x299ebd){return _0x2319c5[_0x969b('0x1b')](_0x2b8f69);}return _0x2319c5[_0x969b('0x1c')](_0x2b8f69)[_0x969b('0x1d')]();};}function respondWithResult(_0x2ed578,_0x3e4a23){_0x3e4a23=_0x3e4a23||0xc8;return function(_0x3c1ad1){if(_0x3c1ad1){return _0x2ed578[_0x969b('0x1c')](_0x3e4a23)[_0x969b('0x1e')](_0x3c1ad1);}};}function respondWithFilteredResult(_0x369a9b,_0x5221ce){return function(_0x142d0c){if(_0x142d0c){var _0x27fcc3=typeof _0x5221ce['offset']===_0x969b('0x1f')&&typeof _0x5221ce[_0x969b('0x20')]==='undefined';var _0x4f1d47=_0x142d0c[_0x969b('0x21')];var _0x16fb45=_0x27fcc3?0x0:_0x5221ce['offset'];var _0x2f6ac7=_0x27fcc3?_0x142d0c[_0x969b('0x21')]:_0x5221ce[_0x969b('0x22')]+_0x5221ce['limit'];var _0x20eeb2;if(_0x2f6ac7>=_0x4f1d47){_0x2f6ac7=_0x4f1d47;_0x20eeb2=0xc8;}else{_0x20eeb2=0xce;}_0x369a9b[_0x969b('0x1c')](_0x20eeb2);return _0x369a9b[_0x969b('0x23')](_0x969b('0x24'),_0x16fb45+'-'+_0x2f6ac7+'/'+_0x4f1d47)[_0x969b('0x1e')](_0x142d0c);}return null;};}function patchUpdates(_0x30844a){return function(_0x567c29){try{jsonpatch[_0x969b('0x25')](_0x567c29,_0x30844a,!![]);}catch(_0x176809){return BPromise[_0x969b('0x26')](_0x176809);}return _0x567c29['save']();};}function saveUpdates(_0x8ccded,_0x1305e7){return function(_0x4ca8e2){if(_0x4ca8e2){return _0x4ca8e2['update'](_0x8ccded)[_0x969b('0x27')](function(_0x40d436){return _0x40d436;});}return null;};}function removeEntity(_0x4cf743,_0x266347){return function(_0x38a1b2){if(_0x38a1b2){return _0x38a1b2[_0x969b('0x28')]()[_0x969b('0x27')](function(){_0x4cf743[_0x969b('0x1c')](0xcc)[_0x969b('0x1d')]();});}};}function handleEntityNotFound(_0x26947f,_0x3dc3e6){return function(_0x36fdb5){if(!_0x36fdb5){_0x26947f[_0x969b('0x1b')](0x194);}return _0x36fdb5;};}function handleError(_0x5c3c10,_0x109ac5){_0x109ac5=_0x109ac5||0x1f4;return function(_0x13db17){logger[_0x969b('0x29')](_0x13db17['stack']);if(_0x13db17['name']){delete _0x13db17[_0x969b('0x2a')];}_0x5c3c10[_0x969b('0x1c')](_0x109ac5)[_0x969b('0x2b')](_0x13db17);};}exports[_0x969b('0x2c')]=function(_0x253f3e,_0x12126f){var _0x405ddd={},_0x4d5430={},_0x2eefdc={'count':0x0,'rows':[]};var _0x533672=_['map'](db[_0x969b('0x2d')][_0x969b('0x2e')],function(_0x2a69bd){return{'name':_0x2a69bd[_0x969b('0x2f')],'type':_0x2a69bd[_0x969b('0x30')]['key']};});_0x4d5430[_0x969b('0x31')]=_[_0x969b('0x32')](_0x533672,_0x969b('0x2a'));_0x4d5430['query']=_[_0x969b('0x33')](_0x253f3e['query']);_0x4d5430['filters']=_['intersection'](_0x4d5430['model'],_0x4d5430['query']);_0x405ddd[_0x969b('0x34')]=_[_0x969b('0x35')](_0x4d5430[_0x969b('0x31')],qs[_0x969b('0x36')](_0x253f3e[_0x969b('0x37')][_0x969b('0x36')]));_0x405ddd[_0x969b('0x34')]=_0x405ddd[_0x969b('0x34')][_0x969b('0x38')]?_0x405ddd[_0x969b('0x34')]:_0x4d5430['model'];if(!_0x253f3e[_0x969b('0x37')]['hasOwnProperty'](_0x969b('0x39'))){_0x405ddd[_0x969b('0x20')]=qs[_0x969b('0x20')](_0x253f3e[_0x969b('0x37')][_0x969b('0x20')]);_0x405ddd['offset']=qs[_0x969b('0x22')](_0x253f3e['query'][_0x969b('0x22')]);}_0x405ddd['order']=qs[_0x969b('0x3a')](_0x253f3e[_0x969b('0x37')]['sort']);_0x405ddd[_0x969b('0x3b')]=qs[_0x969b('0x3c')](_['pick'](_0x253f3e['query'],_0x4d5430[_0x969b('0x3c')]),_0x533672);if(_0x253f3e[_0x969b('0x37')][_0x969b('0x3d')]){_0x405ddd[_0x969b('0x3b')]=_['merge'](_0x405ddd[_0x969b('0x3b')],{'$or':_[_0x969b('0x32')](_0x533672,function(_0x48d3e0){if(_0x48d3e0[_0x969b('0x30')]!=='VIRTUAL'){var _0x1c0916={};_0x1c0916[_0x48d3e0[_0x969b('0x2a')]]={'$like':'%'+_0x253f3e[_0x969b('0x37')][_0x969b('0x3d')]+'%'};return _0x1c0916;}})});}_0x405ddd=_[_0x969b('0x3e')]({},_0x405ddd,_0x253f3e['options']);var _0x1382fd={'where':_0x405ddd[_0x969b('0x3b')]};return db[_0x969b('0x2d')][_0x969b('0x21')](_0x1382fd)[_0x969b('0x27')](function(_0x192406){_0x2eefdc[_0x969b('0x21')]=_0x192406;if(_0x253f3e[_0x969b('0x37')][_0x969b('0x3f')]){_0x405ddd[_0x969b('0x40')]=[{'all':!![]}];}return db[_0x969b('0x2d')]['findAll'](_0x405ddd);})['then'](function(_0x320623){_0x2eefdc[_0x969b('0x41')]=_0x320623;return _0x2eefdc;})[_0x969b('0x27')](respondWithFilteredResult(_0x12126f,_0x405ddd))[_0x969b('0x42')](handleError(_0x12126f,null));};exports[_0x969b('0x43')]=function(_0x2b7241,_0x53a89b){var _0x220561={'raw':!![],'where':{'id':_0x2b7241[_0x969b('0x44')]['id']}},_0x4099bf={};_0x4099bf[_0x969b('0x31')]=_['keys'](db[_0x969b('0x2d')][_0x969b('0x2e')]);_0x4099bf[_0x969b('0x37')]=_[_0x969b('0x33')](_0x2b7241[_0x969b('0x37')]);_0x4099bf[_0x969b('0x3c')]=_[_0x969b('0x35')](_0x4099bf[_0x969b('0x31')],_0x4099bf[_0x969b('0x37')]);_0x220561[_0x969b('0x34')]=_[_0x969b('0x35')](_0x4099bf[_0x969b('0x31')],qs[_0x969b('0x36')](_0x2b7241[_0x969b('0x37')]['fields']));_0x220561['attributes']=_0x220561[_0x969b('0x34')][_0x969b('0x38')]?_0x220561[_0x969b('0x34')]:_0x4099bf[_0x969b('0x31')];if(_0x2b7241[_0x969b('0x37')]['includeAll']){_0x220561[_0x969b('0x40')]=[{'all':!![]}];}_0x220561=_[_0x969b('0x3e')]({},_0x220561,_0x2b7241[_0x969b('0x45')]);return db[_0x969b('0x2d')][_0x969b('0x46')](_0x220561)[_0x969b('0x27')](handleEntityNotFound(_0x53a89b,null))[_0x969b('0x27')](respondWithResult(_0x53a89b,null))[_0x969b('0x42')](handleError(_0x53a89b,null));};exports['create']=function(_0x3a915f,_0x13a65f){return db[_0x969b('0x2d')][_0x969b('0x47')](_0x3a915f[_0x969b('0x48')],{})[_0x969b('0x27')](respondWithResult(_0x13a65f,0xc9))[_0x969b('0x42')](handleError(_0x13a65f,null));};exports['describe']=function(_0x221436,_0x5a783e){return db[_0x969b('0x2d')]['describe']()[_0x969b('0x27')](respondWithResult(_0x5a783e,null))['catch'](handleError(_0x5a783e,null));};exports[_0x969b('0x49')]=function(_0x226b0c,_0x374c9d){if(_0x226b0c[_0x969b('0x48')][_0x969b('0x4a')]){delete _0x226b0c[_0x969b('0x48')]['uniqueid'];}return db[_0x969b('0x2d')][_0x969b('0x46')]({'where':{'uniqueid':_0x226b0c[_0x969b('0x44')]['id']}})[_0x969b('0x27')](handleEntityNotFound(_0x374c9d,null))[_0x969b('0x27')](saveUpdates(_0x226b0c[_0x969b('0x48')],null))[_0x969b('0x27')](respondWithResult(_0x374c9d,null))['catch'](handleError(_0x374c9d,null));}; \ No newline at end of file +var _0x9374=['json','reject','save','update','destroy','then','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','params','filters','find','describe','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range'];(function(_0x590f5d,_0x24c6b8){var _0x28bea1=function(_0x42a52d){while(--_0x42a52d){_0x590f5d['push'](_0x590f5d['shift']());}};_0x28bea1(++_0x24c6b8);}(_0x9374,0x107));var _0x4937=function(_0x17099b,_0x5c25ea){_0x17099b=_0x17099b-0x0;var _0x5a6b58=_0x9374[_0x17099b];return _0x5a6b58;};'use strict';var emlformat=require(_0x4937('0x0'));var rimraf=require(_0x4937('0x1'));var zipdir=require(_0x4937('0x2'));var jsonpatch=require(_0x4937('0x3'));var rp=require('request-promise');var moment=require(_0x4937('0x4'));var BPromise=require(_0x4937('0x5'));var Mustache=require(_0x4937('0x6'));var util=require(_0x4937('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4937('0x8'));var ejs=require(_0x4937('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4937('0xa'));var squel=require(_0x4937('0xb'));var crypto=require(_0x4937('0xc'));var jsforce=require(_0x4937('0xd'));var deskjs=require(_0x4937('0xe'));var toCsv=require(_0x4937('0x8'));var querystring=require(_0x4937('0xf'));var Papa=require(_0x4937('0x10'));var Redis=require(_0x4937('0x11'));var authService=require(_0x4937('0x12'));var qs=require(_0x4937('0x13'));var as=require(_0x4937('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4937('0x15'));var config=require(_0x4937('0x16'));var licenseUtil=require(_0x4937('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a4ab6,_0x18ece4){_0x18ece4=_0x18ece4||0xcc;return function(_0x24fcdb){if(_0x24fcdb){return _0x1a4ab6[_0x4937('0x18')](_0x18ece4);}return _0x1a4ab6['status'](_0x18ece4)[_0x4937('0x19')]();};}function respondWithResult(_0x5ea97f,_0x448189){_0x448189=_0x448189||0xc8;return function(_0xe2a697){if(_0xe2a697){return _0x5ea97f[_0x4937('0x1a')](_0x448189)['json'](_0xe2a697);}};}function respondWithFilteredResult(_0x4337b9,_0x1472f3){return function(_0x552860){if(_0x552860){var _0x5b6997=typeof _0x1472f3['offset']===_0x4937('0x1b')&&typeof _0x1472f3[_0x4937('0x1c')]==='undefined';var _0x1c1aec=_0x552860[_0x4937('0x1d')];var _0x1f3bcf=_0x5b6997?0x0:_0x1472f3[_0x4937('0x1e')];var _0x19abe9=_0x5b6997?_0x552860['count']:_0x1472f3[_0x4937('0x1e')]+_0x1472f3[_0x4937('0x1c')];var _0x18a348;if(_0x19abe9>=_0x1c1aec){_0x19abe9=_0x1c1aec;_0x18a348=0xc8;}else{_0x18a348=0xce;}_0x4337b9['status'](_0x18a348);return _0x4337b9[_0x4937('0x1f')](_0x4937('0x20'),_0x1f3bcf+'-'+_0x19abe9+'/'+_0x1c1aec)[_0x4937('0x21')](_0x552860);}return null;};}function patchUpdates(_0xa4bb58){return function(_0x589635){try{jsonpatch['apply'](_0x589635,_0xa4bb58,!![]);}catch(_0x5bccd7){return BPromise[_0x4937('0x22')](_0x5bccd7);}return _0x589635[_0x4937('0x23')]();};}function saveUpdates(_0x1888c2,_0x4932b3){return function(_0x5c956c){if(_0x5c956c){return _0x5c956c[_0x4937('0x24')](_0x1888c2)['then'](function(_0x5be4e2){return _0x5be4e2;});}return null;};}function removeEntity(_0x5371e6,_0x5ace5b){return function(_0x2c3793){if(_0x2c3793){return _0x2c3793[_0x4937('0x25')]()[_0x4937('0x26')](function(){_0x5371e6[_0x4937('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ec8b3,_0x3cb138){return function(_0x5a077c){if(!_0x5a077c){_0x3ec8b3[_0x4937('0x18')](0x194);}return _0x5a077c;};}function handleError(_0xd644bc,_0x5627bb){_0x5627bb=_0x5627bb||0x1f4;return function(_0x4a115d){logger['error'](_0x4a115d[_0x4937('0x27')]);if(_0x4a115d[_0x4937('0x28')]){delete _0x4a115d[_0x4937('0x28')];}_0xd644bc[_0x4937('0x1a')](_0x5627bb)[_0x4937('0x29')](_0x4a115d);};}exports[_0x4937('0x2a')]=function(_0x8c7cfa,_0x281a8c){var _0xcd701c={},_0x138298={},_0x31d881={'count':0x0,'rows':[]};var _0x3f29af=_[_0x4937('0x2b')](db[_0x4937('0x2c')][_0x4937('0x2d')],function(_0xe0e4df){return{'name':_0xe0e4df[_0x4937('0x2e')],'type':_0xe0e4df[_0x4937('0x2f')][_0x4937('0x30')]};});_0x138298[_0x4937('0x31')]=_[_0x4937('0x2b')](_0x3f29af,_0x4937('0x28'));_0x138298[_0x4937('0x32')]=_[_0x4937('0x33')](_0x8c7cfa[_0x4937('0x32')]);_0x138298['filters']=_[_0x4937('0x34')](_0x138298[_0x4937('0x31')],_0x138298[_0x4937('0x32')]);_0xcd701c['attributes']=_[_0x4937('0x34')](_0x138298[_0x4937('0x31')],qs['fields'](_0x8c7cfa[_0x4937('0x32')][_0x4937('0x35')]));_0xcd701c[_0x4937('0x36')]=_0xcd701c['attributes'][_0x4937('0x37')]?_0xcd701c[_0x4937('0x36')]:_0x138298['model'];if(!_0x8c7cfa['query'][_0x4937('0x38')](_0x4937('0x39'))){_0xcd701c[_0x4937('0x1c')]=qs[_0x4937('0x1c')](_0x8c7cfa[_0x4937('0x32')][_0x4937('0x1c')]);_0xcd701c[_0x4937('0x1e')]=qs[_0x4937('0x1e')](_0x8c7cfa[_0x4937('0x32')][_0x4937('0x1e')]);}_0xcd701c[_0x4937('0x3a')]=qs[_0x4937('0x3b')](_0x8c7cfa[_0x4937('0x32')][_0x4937('0x3b')]);_0xcd701c[_0x4937('0x3c')]=qs['filters'](_[_0x4937('0x3d')](_0x8c7cfa[_0x4937('0x32')],_0x138298['filters']),_0x3f29af);if(_0x8c7cfa[_0x4937('0x32')][_0x4937('0x3e')]){_0xcd701c[_0x4937('0x3c')]=_[_0x4937('0x3f')](_0xcd701c[_0x4937('0x3c')],{'$or':_[_0x4937('0x2b')](_0x3f29af,function(_0x2c060a){if(_0x2c060a[_0x4937('0x2f')]!=='VIRTUAL'){var _0x57f8b7={};_0x57f8b7[_0x2c060a[_0x4937('0x28')]]={'$like':'%'+_0x8c7cfa['query'][_0x4937('0x3e')]+'%'};return _0x57f8b7;}})});}_0xcd701c=_[_0x4937('0x3f')]({},_0xcd701c,_0x8c7cfa[_0x4937('0x40')]);var _0x884317={'where':_0xcd701c[_0x4937('0x3c')]};return db[_0x4937('0x2c')][_0x4937('0x1d')](_0x884317)[_0x4937('0x26')](function(_0x3f87ca){_0x31d881[_0x4937('0x1d')]=_0x3f87ca;if(_0x8c7cfa['query'][_0x4937('0x41')]){_0xcd701c[_0x4937('0x42')]=[{'all':!![]}];}return db[_0x4937('0x2c')]['findAll'](_0xcd701c);})[_0x4937('0x26')](function(_0xa27df9){_0x31d881['rows']=_0xa27df9;return _0x31d881;})['then'](respondWithFilteredResult(_0x281a8c,_0xcd701c))[_0x4937('0x43')](handleError(_0x281a8c,null));};exports['show']=function(_0x14dfa5,_0x690575){var _0x454d0a={'raw':!![],'where':{'id':_0x14dfa5[_0x4937('0x44')]['id']}},_0x2ef027={};_0x2ef027[_0x4937('0x31')]=_[_0x4937('0x33')](db[_0x4937('0x2c')][_0x4937('0x2d')]);_0x2ef027['query']=_['keys'](_0x14dfa5['query']);_0x2ef027[_0x4937('0x45')]=_[_0x4937('0x34')](_0x2ef027[_0x4937('0x31')],_0x2ef027[_0x4937('0x32')]);_0x454d0a[_0x4937('0x36')]=_[_0x4937('0x34')](_0x2ef027[_0x4937('0x31')],qs[_0x4937('0x35')](_0x14dfa5[_0x4937('0x32')][_0x4937('0x35')]));_0x454d0a[_0x4937('0x36')]=_0x454d0a[_0x4937('0x36')][_0x4937('0x37')]?_0x454d0a[_0x4937('0x36')]:_0x2ef027[_0x4937('0x31')];if(_0x14dfa5[_0x4937('0x32')]['includeAll']){_0x454d0a[_0x4937('0x42')]=[{'all':!![]}];}_0x454d0a=_[_0x4937('0x3f')]({},_0x454d0a,_0x14dfa5['options']);return db[_0x4937('0x2c')][_0x4937('0x46')](_0x454d0a)[_0x4937('0x26')](handleEntityNotFound(_0x690575,null))[_0x4937('0x26')](respondWithResult(_0x690575,null))[_0x4937('0x43')](handleError(_0x690575,null));};exports['create']=function(_0x2e9b3c,_0x316944){return db['CmHopperHistory']['create'](_0x2e9b3c['body'],{})[_0x4937('0x26')](respondWithResult(_0x316944,0xc9))[_0x4937('0x43')](handleError(_0x316944,null));};exports['describe']=function(_0x6e3a91,_0x493f87){return db[_0x4937('0x2c')][_0x4937('0x47')]()['then'](respondWithResult(_0x493f87,null))[_0x4937('0x43')](handleError(_0x493f87,null));};exports[_0x4937('0x24')]=function(_0x2711b8,_0x4ecdc6){if(_0x2711b8[_0x4937('0x48')][_0x4937('0x49')]){delete _0x2711b8[_0x4937('0x48')]['uniqueid'];}return db[_0x4937('0x2c')]['find']({'where':{'uniqueid':_0x2711b8[_0x4937('0x44')]['id']}})['then'](handleEntityNotFound(_0x4ecdc6,null))[_0x4937('0x26')](saveUpdates(_0x2711b8[_0x4937('0x48')],null))[_0x4937('0x26')](respondWithResult(_0x4ecdc6,null))[_0x4937('0x43')](handleError(_0x4ecdc6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 1e3faea..5654192 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 _0xa8d3=['uniqueid','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime'];(function(_0xb09b44,_0x5cca48){var _0xba6f6a=function(_0x1135ca){while(--_0x1135ca){_0xb09b44['push'](_0xb09b44['shift']());}};_0xba6f6a(++_0x5cca48);}(_0xa8d3,0x1a5));var _0x3a8d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa8d3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x3a8d('0x0'));var util=require(_0x3a8d('0x1'));var logger=require('../../config/logger')(_0x3a8d('0x2'));var moment=require('moment');var BPromise=require(_0x3a8d('0x3'));var rp=require(_0x3a8d('0x4'));var fs=require('fs');var path=require(_0x3a8d('0x5'));var rimraf=require(_0x3a8d('0x6'));var config=require(_0x3a8d('0x7'));var attributes=require(_0x3a8d('0x8'));module[_0x3a8d('0x9')]=function(_0x1df92a,_0x2e1083){return _0x1df92a['define'](_0x3a8d('0xa'),attributes,{'tableName':_0x3a8d('0xb'),'paranoid':![],'indexes':[{'name':_0x3a8d('0xc'),'fields':[_0x3a8d('0xc')]},{'name':'uniqueid','fields':[_0x3a8d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa4a=['moment','bluebird','request-promise','path','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api'];(function(_0x35a05a,_0x1595bb){var _0x86a11d=function(_0x1e7254){while(--_0x1e7254){_0x35a05a['push'](_0x35a05a['shift']());}};_0x86a11d(++_0x1595bb);}(_0xaa4a,0x128));var _0xaaa4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xaa4a[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xaaa4('0x0'));var util=require(_0xaaa4('0x1'));var logger=require(_0xaaa4('0x2'))(_0xaaa4('0x3'));var moment=require(_0xaaa4('0x4'));var BPromise=require(_0xaaa4('0x5'));var rp=require(_0xaaa4('0x6'));var fs=require('fs');var path=require(_0xaaa4('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x5cd08f,_0x2226b5){return _0x5cd08f['define'](_0xaaa4('0x8'),attributes,{'tableName':_0xaaa4('0x9'),'paranoid':![],'indexes':[{'name':_0xaaa4('0xa'),'fields':[_0xaaa4('0xa')]},{'name':_0xaaa4('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 7053c2d..4b32b23 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 _0x8d54=['GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrAnswerCallsDay','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','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','body','options','raw','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay'];(function(_0x16d90e,_0x157405){var _0x3dae80=function(_0x4a5995){while(--_0x4a5995){_0x16d90e['push'](_0x16d90e['shift']());}};_0x3dae80(++_0x157405);}(_0x8d54,0x161));var _0x48d5=function(_0x530245,_0x1541ab){_0x530245=_0x530245-0x0;var _0x22506d=_0x8d54[_0x530245];return _0x22506d;};'use strict';var _=require('lodash');var util=require(_0x48d5('0x0'));var moment=require(_0x48d5('0x1'));var BPromise=require('bluebird');var rs=require(_0x48d5('0x2'));var fs=require('fs');var Redis=require(_0x48d5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x48d5('0x4'));var logger=require('../../config/logger')(_0x48d5('0x5'));var config=require(_0x48d5('0x6'));var jayson=require(_0x48d5('0x7'));var client=jayson[_0x48d5('0x8')][_0x48d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2407cc,_0x488d30,_0x25b65f){return new BPromise(function(_0x40c0d8,_0x8560db){return client[_0x48d5('0xa')](_0x2407cc,_0x25b65f)[_0x48d5('0xb')](function(_0x18aff4){logger[_0x48d5('0xc')](_0x48d5('0xd'),_0x488d30,_0x48d5('0xe'));logger[_0x48d5('0xf')](_0x48d5('0x10'),_0x488d30,_0x48d5('0xe'),JSON[_0x48d5('0x11')](_0x18aff4));if(_0x18aff4['error']){if(_0x18aff4[_0x48d5('0x12')][_0x48d5('0x13')]===0x1f4){logger[_0x48d5('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x488d30,_0x18aff4['error']['message']);return _0x8560db(_0x18aff4[_0x48d5('0x12')]['message']);}logger[_0x48d5('0x12')](_0x48d5('0xd'),_0x488d30,_0x18aff4['error'][_0x48d5('0x14')]);return _0x40c0d8(_0x18aff4[_0x48d5('0x12')]['message']);}else{logger[_0x48d5('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x488d30,_0x48d5('0xe'));_0x40c0d8(_0x18aff4[_0x48d5('0x15')]['message']);}})[_0x48d5('0x16')](function(_0xb2b323){logger[_0x48d5('0x12')](_0x48d5('0xd'),_0x488d30,_0xb2b323);_0x8560db(_0xb2b323);});});}exports[_0x48d5('0x17')]=function(_0x5e7811){var _0x244a52=this;return new Promise(function(_0x417b45,_0x4d49e8){return db[_0x48d5('0x18')]['create'](_0x5e7811[_0x48d5('0x19')],{'raw':_0x5e7811[_0x48d5('0x1a')]?_0x5e7811[_0x48d5('0x1a')][_0x48d5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x36899d){logger['info']('CreateCmHopperHistory',_0x5e7811);logger[_0x48d5('0xf')](_0x48d5('0x17'),_0x5e7811,JSON[_0x48d5('0x11')](_0x36899d));_0x417b45(_0x36899d);})[_0x48d5('0x16')](function(_0x560aef){logger['error'](_0x48d5('0x17'),_0x560aef['message'],_0x5e7811);_0x4d49e8(_0x244a52[_0x48d5('0x12')](0x1f4,_0x560aef['message']));});});};exports[_0x48d5('0x1c')]=function(_0x147eff){var _0x19b994=this;return new Promise(function(_0x3e3d2e,_0x2cda96){return db[_0x48d5('0x18')][_0x48d5('0x1d')]({'raw':_0x147eff[_0x48d5('0x1a')]?_0x147eff[_0x48d5('0x1a')][_0x48d5('0x1b')]===undefined?!![]:![]:!![],'where':_0x147eff[_0x48d5('0x1a')]?_0x147eff[_0x48d5('0x1a')][_0x48d5('0x1e')]||null:null,'attributes':[[db[_0x48d5('0x1f')]['fn']('COUNT',db['sequelize'][_0x48d5('0x20')]('id')),_0x48d5('0x21')],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x48d5('0x23')](_0x48d5('0x24')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x48d5('0x22'),db[_0x48d5('0x1f')]['fn']('IF',db['sequelize'][_0x48d5('0x23')]('`state`\x20=\x2010,\x201,\x20null'))),_0x48d5('0x25')],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db[_0x48d5('0x1f')]['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')](_0x48d5('0x26')))),_0x48d5('0x27')],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x28'),db[_0x48d5('0x1f')]['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x48d5('0x29')],[db['sequelize']['fn'](_0x48d5('0x28'),db[_0x48d5('0x1f')]['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')](_0x48d5('0x2a')))),_0x48d5('0x2b')]]})[_0x48d5('0xb')](function(_0x9b3378){logger[_0x48d5('0xc')](_0x48d5('0x1c'),_0x147eff);logger['debug'](_0x48d5('0x1c'),_0x147eff,JSON['stringify'](_0x9b3378));_0x3e3d2e(_0x9b3378);})['catch'](function(_0x15b9df){logger['error'](_0x48d5('0x1c'),_0x15b9df[_0x48d5('0x14')],_0x147eff);_0x2cda96(_0x19b994[_0x48d5('0x12')](0x1f4,_0x15b9df[_0x48d5('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x1b4f96){var _0x126421=this;return new Promise(function(_0x346b9e,_0x53c3fe){return db['CmHopperHistory'][_0x48d5('0x1d')]({'raw':_0x1b4f96[_0x48d5('0x1a')]?_0x1b4f96[_0x48d5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1b4f96['options']?_0x1b4f96[_0x48d5('0x1a')]['where']||null:null,'attributes':[[_0x48d5('0x2c'),_0x48d5('0x2d')],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db[_0x48d5('0x1f')]['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db[_0x48d5('0x1f')]['fn']('IF',db[_0x48d5('0x1f')]['literal'](_0x48d5('0x2e')))),_0x48d5('0x2f')],[db['sequelize']['fn'](_0x48d5('0x22'),db[_0x48d5('0x1f')]['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db[_0x48d5('0x1f')]['fn']('IF',db['sequelize'][_0x48d5('0x23')](_0x48d5('0x30')))),_0x48d5('0x31')],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db['sequelize']['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')](_0x48d5('0x32')))),_0x48d5('0x33')],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db[_0x48d5('0x1f')]['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x48d5('0x34')],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db[_0x48d5('0x1f')]['fn']('IF',db['sequelize'][_0x48d5('0x23')](_0x48d5('0x35')))),_0x48d5('0x36')],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db['sequelize']['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')]('`state`\x20=\x2012,\x201,\x20null'))),_0x48d5('0x37')],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db[_0x48d5('0x1f')]['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')](_0x48d5('0x38')))),_0x48d5('0x39')],[db['sequelize']['fn'](_0x48d5('0x22'),db['sequelize']['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')](_0x48d5('0x3a')))),_0x48d5('0x3b')],[db['sequelize']['fn']('COUNT',db[_0x48d5('0x1f')]['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')](_0x48d5('0x3c')))),_0x48d5('0x3d')],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db[_0x48d5('0x1f')]['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')](_0x48d5('0x3e')))),_0x48d5('0x3f')],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db[_0x48d5('0x1f')]['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')](_0x48d5('0x40')))),'outboundRejectCallsDay'],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db['sequelize']['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')](_0x48d5('0x41')))),_0x48d5('0x42')]],'group':[_0x48d5('0x2c')]})['then'](function(_0x1dfbc3){logger['info'](_0x48d5('0x43'),_0x1b4f96);logger['debug'](_0x48d5('0x43'),_0x1b4f96,JSON[_0x48d5('0x11')](_0x1dfbc3));_0x346b9e(_0x1dfbc3);})[_0x48d5('0x16')](function(_0x4866c3){logger[_0x48d5('0x12')](_0x48d5('0x43'),_0x4866c3[_0x48d5('0x14')],_0x1b4f96);_0x53c3fe(_0x126421[_0x48d5('0x12')](0x1f4,_0x4866c3[_0x48d5('0x14')]));});});};exports[_0x48d5('0x44')]=function(_0x304d67){var _0x63e1f3=this;return new Promise(function(_0x209fb7,_0x4e089b){return db[_0x48d5('0x18')][_0x48d5('0x1d')]({'raw':_0x304d67['options']?_0x304d67[_0x48d5('0x1a')][_0x48d5('0x1b')]===undefined?!![]:![]:!![],'where':_0x304d67['options']?_0x304d67[_0x48d5('0x1a')][_0x48d5('0x1e')]||null:null,'attributes':[[_0x48d5('0x2c'),_0x48d5('0x2d')],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db['sequelize']['col']('id')),'ivrTotalCallsDays'],[db[_0x48d5('0x1f')]['fn'](_0x48d5('0x22'),db[_0x48d5('0x1f')]['fn']('IF',db[_0x48d5('0x1f')][_0x48d5('0x23')](_0x48d5('0x24')))),_0x48d5('0x45')]],'group':['campaign']})[_0x48d5('0xb')](function(_0x2da086){logger[_0x48d5('0xc')]('GetCampaignHopperHistory',_0x304d67);logger[_0x48d5('0xf')](_0x48d5('0x44'),_0x304d67,JSON[_0x48d5('0x11')](_0x2da086));_0x209fb7(_0x2da086);})[_0x48d5('0x16')](function(_0x3f6368){logger[_0x48d5('0x12')](_0x48d5('0x44'),_0x3f6368[_0x48d5('0x14')],_0x304d67);_0x4e089b(_0x63e1f3[_0x48d5('0x12')](0x1f4,_0x3f6368[_0x48d5('0x14')]));});});}; \ No newline at end of file +var _0x38db=['name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','col','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','raw','debug','AvgHandleTime','findAll','options','where','sequelize','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null'];(function(_0x587fce,_0x258beb){var _0x21e802=function(_0x156119){while(--_0x156119){_0x587fce['push'](_0x587fce['shift']());}};_0x21e802(++_0x258beb);}(_0x38db,0x191));var _0xb38d=function(_0x28b93a,_0x283962){_0x28b93a=_0x28b93a-0x0;var _0xb3d4d6=_0x38db[_0x28b93a];return _0xb3d4d6;};'use strict';var _=require(_0xb38d('0x0'));var util=require(_0xb38d('0x1'));var moment=require(_0xb38d('0x2'));var BPromise=require(_0xb38d('0x3'));var rs=require(_0xb38d('0x4'));var fs=require('fs');var Redis=require(_0xb38d('0x5'));var db=require(_0xb38d('0x6'))['db'];var utils=require(_0xb38d('0x7'));var logger=require(_0xb38d('0x8'))(_0xb38d('0x9'));var config=require(_0xb38d('0xa'));var jayson=require(_0xb38d('0xb'));var client=jayson[_0xb38d('0xc')][_0xb38d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2165eb,_0x5b3a45,_0x408e97){return new BPromise(function(_0x27fc6e,_0xf7ef86){return client[_0xb38d('0xe')](_0x2165eb,_0x408e97)[_0xb38d('0xf')](function(_0x139235){logger['info'](_0xb38d('0x10'),_0x5b3a45,_0xb38d('0x11'));logger['debug'](_0xb38d('0x12'),_0x5b3a45,_0xb38d('0x11'),JSON[_0xb38d('0x13')](_0x139235));if(_0x139235[_0xb38d('0x14')]){if(_0x139235[_0xb38d('0x14')][_0xb38d('0x15')]===0x1f4){logger[_0xb38d('0x14')](_0xb38d('0x10'),_0x5b3a45,_0x139235[_0xb38d('0x14')][_0xb38d('0x16')]);return _0xf7ef86(_0x139235[_0xb38d('0x14')]['message']);}logger[_0xb38d('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x5b3a45,_0x139235[_0xb38d('0x14')][_0xb38d('0x16')]);return _0x27fc6e(_0x139235['error'][_0xb38d('0x16')]);}else{logger[_0xb38d('0x17')](_0xb38d('0x10'),_0x5b3a45,_0xb38d('0x11'));_0x27fc6e(_0x139235[_0xb38d('0x18')]['message']);}})[_0xb38d('0x19')](function(_0x549a71){logger[_0xb38d('0x14')](_0xb38d('0x10'),_0x5b3a45,_0x549a71);_0xf7ef86(_0x549a71);});});}exports[_0xb38d('0x1a')]=function(_0x28d39f){var _0x19dc1f=this;return new Promise(function(_0x2b24c9,_0x4ceb58){return db[_0xb38d('0x1b')][_0xb38d('0x1c')](_0x28d39f[_0xb38d('0x1d')],{'raw':_0x28d39f['options']?_0x28d39f['options'][_0xb38d('0x1e')]===undefined?!![]:![]:!![]})[_0xb38d('0xf')](function(_0x59f5ad){logger['info'](_0xb38d('0x1a'),_0x28d39f);logger[_0xb38d('0x1f')](_0xb38d('0x1a'),_0x28d39f,JSON[_0xb38d('0x13')](_0x59f5ad));_0x2b24c9(_0x59f5ad);})['catch'](function(_0x338991){logger[_0xb38d('0x14')](_0xb38d('0x1a'),_0x338991[_0xb38d('0x16')],_0x28d39f);_0x4ceb58(_0x19dc1f[_0xb38d('0x14')](0x1f4,_0x338991[_0xb38d('0x16')]));});});};exports[_0xb38d('0x20')]=function(_0x35f58d){var _0x3165f0=this;return new Promise(function(_0x419626,_0xc99634){return db[_0xb38d('0x1b')][_0xb38d('0x21')]({'raw':_0x35f58d[_0xb38d('0x22')]?_0x35f58d['options'][_0xb38d('0x1e')]===undefined?!![]:![]:!![],'where':_0x35f58d['options']?_0x35f58d[_0xb38d('0x22')][_0xb38d('0x23')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xb38d('0x24')]['col']('id')),_0xb38d('0x25')],[db[_0xb38d('0x24')]['fn'](_0xb38d('0x26'),db[_0xb38d('0x24')]['fn']('IF',db[_0xb38d('0x24')]['literal'](_0xb38d('0x27')))),_0xb38d('0x28')],[db[_0xb38d('0x24')]['fn'](_0xb38d('0x26'),db['sequelize']['fn']('IF',db[_0xb38d('0x24')][_0xb38d('0x29')](_0xb38d('0x2a')))),_0xb38d('0x2b')],[db['sequelize']['fn'](_0xb38d('0x26'),db[_0xb38d('0x24')]['fn']('IF',db[_0xb38d('0x24')][_0xb38d('0x29')]('`state`\x20=\x2011,\x201,\x20null'))),_0xb38d('0x2c')],[db[_0xb38d('0x24')]['fn'](_0xb38d('0x2d'),db[_0xb38d('0x24')]['fn']('IF',db['sequelize'][_0xb38d('0x29')](_0xb38d('0x2e')))),_0xb38d('0x2f')],[db[_0xb38d('0x24')]['fn']('AVG',db[_0xb38d('0x24')]['fn']('IF',db[_0xb38d('0x24')][_0xb38d('0x29')](_0xb38d('0x30')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x5e19ae){logger[_0xb38d('0x17')](_0xb38d('0x20'),_0x35f58d);logger[_0xb38d('0x1f')](_0xb38d('0x20'),_0x35f58d,JSON[_0xb38d('0x13')](_0x5e19ae));_0x419626(_0x5e19ae);})[_0xb38d('0x19')](function(_0x59473a){logger[_0xb38d('0x14')]('AvgHandleTime',_0x59473a[_0xb38d('0x16')],_0x35f58d);_0xc99634(_0x3165f0[_0xb38d('0x14')](0x1f4,_0x59473a[_0xb38d('0x16')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x1abe15){var _0x575b21=this;return new Promise(function(_0x3b74f5,_0x3a1bf4){return db[_0xb38d('0x1b')][_0xb38d('0x21')]({'raw':_0x1abe15[_0xb38d('0x22')]?_0x1abe15[_0xb38d('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x1abe15[_0xb38d('0x22')]?_0x1abe15[_0xb38d('0x22')][_0xb38d('0x23')]||null:null,'attributes':[['campaign',_0xb38d('0x31')],[db[_0xb38d('0x24')]['fn'](_0xb38d('0x26'),db['sequelize']['fn']('IF',db['sequelize'][_0xb38d('0x29')]('`state`\x20=\x200,\x201,\x20null'))),_0xb38d('0x32')],[db[_0xb38d('0x24')]['fn']('COUNT',db[_0xb38d('0x24')]['fn']('IF',db[_0xb38d('0x24')][_0xb38d('0x29')]('`state`\x20=\x203,\x201,\x20null'))),_0xb38d('0x33')],[db['sequelize']['fn'](_0xb38d('0x26'),db[_0xb38d('0x24')]['fn']('IF',db[_0xb38d('0x24')][_0xb38d('0x29')]('`state`\x20=\x204,\x201,\x20null'))),_0xb38d('0x34')],[db[_0xb38d('0x24')]['fn']('COUNT',db[_0xb38d('0x24')]['fn']('IF',db['sequelize'][_0xb38d('0x29')](_0xb38d('0x35')))),_0xb38d('0x36')],[db[_0xb38d('0x24')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb38d('0x24')][_0xb38d('0x29')](_0xb38d('0x37')))),'outboundCongestionCallsDay'],[db[_0xb38d('0x24')]['fn'](_0xb38d('0x26'),db[_0xb38d('0x24')]['fn']('IF',db[_0xb38d('0x24')]['literal'](_0xb38d('0x38')))),_0xb38d('0x39')],[db[_0xb38d('0x24')]['fn'](_0xb38d('0x26'),db['sequelize']['fn']('IF',db['sequelize'][_0xb38d('0x29')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb38d('0x3a')],[db[_0xb38d('0x24')]['fn'](_0xb38d('0x26'),db[_0xb38d('0x24')]['fn']('IF',db[_0xb38d('0x24')][_0xb38d('0x29')](_0xb38d('0x3b')))),_0xb38d('0x3c')],[db['sequelize']['fn'](_0xb38d('0x26'),db['sequelize']['fn']('IF',db[_0xb38d('0x24')][_0xb38d('0x29')]('`state`\x20=\x2013,\x201,\x20null'))),_0xb38d('0x3d')],[db[_0xb38d('0x24')]['fn']('COUNT',db[_0xb38d('0x24')]['fn']('IF',db[_0xb38d('0x24')][_0xb38d('0x29')](_0xb38d('0x3e')))),_0xb38d('0x3f')],[db[_0xb38d('0x24')]['fn'](_0xb38d('0x26'),db[_0xb38d('0x24')]['fn']('IF',db[_0xb38d('0x24')][_0xb38d('0x29')](_0xb38d('0x40')))),_0xb38d('0x41')],[db[_0xb38d('0x24')]['fn'](_0xb38d('0x26'),db[_0xb38d('0x24')]['fn']('IF',db[_0xb38d('0x24')][_0xb38d('0x29')](_0xb38d('0x42')))),_0xb38d('0x43')],[db['sequelize']['fn'](_0xb38d('0x26'),db[_0xb38d('0x24')]['fn']('IF',db[_0xb38d('0x24')]['literal'](_0xb38d('0x44')))),_0xb38d('0x41')],[db[_0xb38d('0x24')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xb38d('0x29')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xb38d('0x45')]],'group':[_0xb38d('0x46')]})[_0xb38d('0xf')](function(_0x31b47f){logger[_0xb38d('0x17')](_0xb38d('0x47'),_0x1abe15);logger[_0xb38d('0x1f')](_0xb38d('0x47'),_0x1abe15,JSON[_0xb38d('0x13')](_0x31b47f));_0x3b74f5(_0x31b47f);})[_0xb38d('0x19')](function(_0x3d35ff){logger[_0xb38d('0x14')](_0xb38d('0x47'),_0x3d35ff[_0xb38d('0x16')],_0x1abe15);_0x3a1bf4(_0x575b21[_0xb38d('0x14')](0x1f4,_0x3d35ff[_0xb38d('0x16')]));});});};exports[_0xb38d('0x48')]=function(_0x4e568a){var _0x45a460=this;return new Promise(function(_0x446839,_0x46e01c){return db[_0xb38d('0x1b')][_0xb38d('0x21')]({'raw':_0x4e568a[_0xb38d('0x22')]?_0x4e568a[_0xb38d('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x4e568a[_0xb38d('0x22')]?_0x4e568a[_0xb38d('0x22')]['where']||null:null,'attributes':[[_0xb38d('0x46'),_0xb38d('0x31')],[db[_0xb38d('0x24')]['fn'](_0xb38d('0x26'),db[_0xb38d('0x24')][_0xb38d('0x49')]('id')),_0xb38d('0x4a')],[db[_0xb38d('0x24')]['fn'](_0xb38d('0x26'),db[_0xb38d('0x24')]['fn']('IF',db[_0xb38d('0x24')][_0xb38d('0x29')](_0xb38d('0x27')))),'ivrAnswerCallsDay']],'group':[_0xb38d('0x46')]})[_0xb38d('0xf')](function(_0x5b6053){logger[_0xb38d('0x17')](_0xb38d('0x48'),_0x4e568a);logger[_0xb38d('0x1f')](_0xb38d('0x48'),_0x4e568a,JSON[_0xb38d('0x13')](_0x5b6053));_0x446839(_0x5b6053);})[_0xb38d('0x19')](function(_0x2ea045){logger[_0xb38d('0x14')](_0xb38d('0x48'),_0x2ea045['message'],_0x4e568a);_0x46e01c(_0x45a460['error'](0x1f4,_0x2ea045[_0xb38d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 14e080b..2c6183e 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 _0xf007=['fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','describe','get','/:id','post','create','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf007,0x13e));var _0x7f00=function(_0x24e320,_0x32bd95){_0x24e320=_0x24e320-0x0;var _0x5dfb42=_0xf007[_0x24e320];return _0x5dfb42;};'use strict';var multer=require(_0x7f00('0x0'));var util=require(_0x7f00('0x1'));var path=require(_0x7f00('0x2'));var timeout=require(_0x7f00('0x3'));var express=require(_0x7f00('0x4'));var router=express[_0x7f00('0x5')]();var fs_extra=require(_0x7f00('0x6'));var auth=require(_0x7f00('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7f00('0x8'));var controller=require(_0x7f00('0x9'));router['get']('/',auth[_0x7f00('0xa')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7f00('0xb')]);router[_0x7f00('0xc')](_0x7f00('0xd'),auth[_0x7f00('0xa')](),controller['show']);router[_0x7f00('0xe')]('/',auth['isAuthenticated'](),controller[_0x7f00('0xf')]);router['put'](_0x7f00('0xd'),auth['isAuthenticated'](),controller[_0x7f00('0x10')]);module[_0x7f00('0x11')]=router; \ No newline at end of file +var _0x41eb=['./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x576265,_0xb94887){var _0x5ea30d=function(_0x128079){while(--_0x128079){_0x576265['push'](_0x576265['shift']());}};_0x5ea30d(++_0xb94887);}(_0x41eb,0x1e7));var _0xb41e=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0x41eb[_0x582274];return _0x8f14d3;};'use strict';var multer=require(_0xb41e('0x0'));var util=require(_0xb41e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb41e('0x2'));var router=express[_0xb41e('0x3')]();var fs_extra=require(_0xb41e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb41e('0x5'));var config=require(_0xb41e('0x6'));var controller=require(_0xb41e('0x7'));router[_0xb41e('0x8')]('/',auth[_0xb41e('0x9')](),controller[_0xb41e('0xa')]);router['get'](_0xb41e('0xb'),auth[_0xb41e('0x9')](),controller[_0xb41e('0xc')]);router[_0xb41e('0x8')](_0xb41e('0xd'),auth['isAuthenticated'](),controller[_0xb41e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb41e('0xf')]);router[_0xb41e('0x10')](_0xb41e('0xd'),auth[_0xb41e('0x9')](),controller[_0xb41e('0x11')]);module[_0xb41e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 452ed03..1b2059a 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 _0xb3ef=['sequelize','exports','STRING','name'];(function(_0x1706e8,_0x535a1a){var _0x2e23a1=function(_0x315e96){while(--_0x315e96){_0x1706e8['push'](_0x1706e8['shift']());}};_0x2e23a1(++_0x535a1a);}(_0xb3ef,0xdc));var _0xfb3e=function(_0x101f01,_0x3de7aa){_0x101f01=_0x101f01-0x0;var _0x530a63=_0xb3ef[_0x101f01];return _0x530a63;};'use strict';var Sequelize=require(_0xfb3e('0x0'));module[_0xfb3e('0x1')]={'name':{'type':Sequelize[_0xfb3e('0x2')],'unique':_0xfb3e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfb3e('0x2')]},'dialPrefix':{'type':Sequelize[_0xfb3e('0x2')]}}; \ No newline at end of file +var _0xcf40=['exports','STRING','name','sequelize'];(function(_0x29eeac,_0x546ecb){var _0xb83fa7=function(_0x2c5b48){while(--_0x2c5b48){_0x29eeac['push'](_0x29eeac['shift']());}};_0xb83fa7(++_0x546ecb);}(_0xcf40,0x18b));var _0x0cf4=function(_0x2bd9af,_0x222e01){_0x2bd9af=_0x2bd9af-0x0;var _0x384f70=_0xcf40[_0x2bd9af];return _0x384f70;};'use strict';var Sequelize=require(_0x0cf4('0x0'));module[_0x0cf4('0x1')]={'name':{'type':Sequelize[_0x0cf4('0x2')],'unique':_0x0cf4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0cf4('0x2')]},'dialPrefix':{'type':Sequelize[_0x0cf4('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 25c97c6..42bcb80 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 _0x97fe=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','findOne','nolimit','pick','removeDispositions','CmContact','tags','join','isArray','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','/tmp/list_%d_%s.csv','addCustomField','sequelize','addCustomFields','Sequelize','text','number','switch','defaultValue','getCustomFields','findAndCountAll','addAgents','ids','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','include','findAll','rows','params','keys','includeAll','find','catch','create'];(function(_0x98f2ba,_0x1f681d){var _0x2c9d5c=function(_0x5f0999){while(--_0x5f0999){_0x98f2ba['push'](_0x98f2ba['shift']());}};_0x2c9d5c(++_0x1f681d);}(_0x97fe,0xcb));var _0xe97f=function(_0x496150,_0x514cc8){_0x496150=_0x496150-0x0;var _0xe33010=_0x97fe[_0x496150];return _0xe33010;};'use strict';var emlformat=require(_0xe97f('0x0'));var rimraf=require(_0xe97f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe97f('0x2'));var moment=require(_0xe97f('0x3'));var BPromise=require(_0xe97f('0x4'));var Mustache=require('mustache');var util=require(_0xe97f('0x5'));var path=require(_0xe97f('0x6'));var sox=require(_0xe97f('0x7'));var csv=require(_0xe97f('0x8'));var ejs=require(_0xe97f('0x9'));var fs=require('fs');var fs_extra=require(_0xe97f('0xa'));var _=require(_0xe97f('0xb'));var squel=require(_0xe97f('0xc'));var crypto=require('crypto');var jsforce=require(_0xe97f('0xd'));var deskjs=require(_0xe97f('0xe'));var toCsv=require(_0xe97f('0x8'));var querystring=require(_0xe97f('0xf'));var Papa=require(_0xe97f('0x10'));var Redis=require(_0xe97f('0x11'));var authService=require(_0xe97f('0x12'));var qs=require(_0xe97f('0x13'));var as=require(_0xe97f('0x14'));var hardwareService=require(_0xe97f('0x15'));var logger=require(_0xe97f('0x16'))('api');var utils=require(_0xe97f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe97f('0x18'));var db=require(_0xe97f('0x19'))['db'];config[_0xe97f('0x1a')]=_[_0xe97f('0x1b')](config[_0xe97f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe97f('0x1c'))[_0xe97f('0x1d')](socket);function respondWithStatusCode(_0x258d5e,_0x162ac7){_0x162ac7=_0x162ac7||0xcc;return function(_0x127d96){if(_0x127d96){return _0x258d5e[_0xe97f('0x1e')](_0x162ac7);}return _0x258d5e[_0xe97f('0x1f')](_0x162ac7)['end']();};}function respondWithResult(_0x3d0c99,_0x1a15b1){_0x1a15b1=_0x1a15b1||0xc8;return function(_0xf0b7f0){if(_0xf0b7f0){return _0x3d0c99[_0xe97f('0x1f')](_0x1a15b1)[_0xe97f('0x20')](_0xf0b7f0);}};}function respondWithFilteredResult(_0x5747a7,_0x30ac07){return function(_0x34c21){if(_0x34c21){var _0x3f0289=typeof _0x30ac07[_0xe97f('0x21')]===_0xe97f('0x22')&&typeof _0x30ac07[_0xe97f('0x23')]===_0xe97f('0x22');var _0x23b7e3=_0x34c21['count'];var _0xd39cc6=_0x3f0289?0x0:_0x30ac07['offset'];var _0x496a3b=_0x3f0289?_0x34c21[_0xe97f('0x24')]:_0x30ac07[_0xe97f('0x21')]+_0x30ac07['limit'];var _0x44d416;if(_0x496a3b>=_0x23b7e3){_0x496a3b=_0x23b7e3;_0x44d416=0xc8;}else{_0x44d416=0xce;}_0x5747a7[_0xe97f('0x1f')](_0x44d416);return _0x5747a7['set'](_0xe97f('0x25'),_0xd39cc6+'-'+_0x496a3b+'/'+_0x23b7e3)['json'](_0x34c21);}return null;};}function patchUpdates(_0xfedcfc){return function(_0x5d7d22){try{jsonpatch[_0xe97f('0x26')](_0x5d7d22,_0xfedcfc,!![]);}catch(_0x1ec918){return BPromise[_0xe97f('0x27')](_0x1ec918);}return _0x5d7d22[_0xe97f('0x28')]();};}function saveUpdates(_0x2f9060,_0x194144){return function(_0x52f551){if(_0x52f551){return _0x52f551['update'](_0x2f9060)[_0xe97f('0x29')](function(_0x1df3cd){return _0x1df3cd;});}return null;};}function removeEntity(_0x384b45,_0x2b036c){return function(_0x26e297){if(_0x26e297){return _0x26e297[_0xe97f('0x2a')]()[_0xe97f('0x29')](function(){var _0x132119=_0x26e297[_0xe97f('0x2b')]({'plain':!![]});var _0x462fcb=_0xe97f('0x2c');return db[_0xe97f('0x2d')]['destroy']({'where':{'type':_0x462fcb,'resourceId':_0x132119['id']}})['then'](function(){return _0x26e297;});})[_0xe97f('0x29')](function(){_0x384b45[_0xe97f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8d991d,_0x26d876){return function(_0x301131){if(!_0x301131){_0x8d991d[_0xe97f('0x1e')](0x194);}return _0x301131;};}function handleError(_0x555891,_0x5dea8d){_0x5dea8d=_0x5dea8d||0x1f4;return function(_0x102404){logger[_0xe97f('0x2e')](_0x102404[_0xe97f('0x2f')]);if(_0x102404[_0xe97f('0x30')]){delete _0x102404[_0xe97f('0x30')];}_0x555891[_0xe97f('0x1f')](_0x5dea8d)[_0xe97f('0x31')](_0x102404);};}exports[_0xe97f('0x32')]=function(_0x11373d,_0x38df3c){var _0x495eb6={},_0x2263ed={},_0x1605d9={'count':0x0,'rows':[]};var _0x21026e=_[_0xe97f('0x33')](db[_0xe97f('0x34')][_0xe97f('0x35')],function(_0x289b8a){return{'name':_0x289b8a['fieldName'],'type':_0x289b8a[_0xe97f('0x36')][_0xe97f('0x37')]};});_0x2263ed[_0xe97f('0x38')]=_[_0xe97f('0x33')](_0x21026e,_0xe97f('0x30'));_0x2263ed[_0xe97f('0x39')]=_['keys'](_0x11373d[_0xe97f('0x39')]);_0x2263ed[_0xe97f('0x3a')]=_[_0xe97f('0x3b')](_0x2263ed[_0xe97f('0x38')],_0x2263ed['query']);_0x495eb6[_0xe97f('0x3c')]=_[_0xe97f('0x3b')](_0x2263ed['model'],qs[_0xe97f('0x3d')](_0x11373d[_0xe97f('0x39')][_0xe97f('0x3d')]));_0x495eb6[_0xe97f('0x3c')]=_0x495eb6[_0xe97f('0x3c')][_0xe97f('0x3e')]?_0x495eb6[_0xe97f('0x3c')]:_0x2263ed['model'];if(!_0x11373d[_0xe97f('0x39')][_0xe97f('0x3f')]('nolimit')){_0x495eb6[_0xe97f('0x23')]=qs[_0xe97f('0x23')](_0x11373d[_0xe97f('0x39')]['limit']);_0x495eb6[_0xe97f('0x21')]=qs[_0xe97f('0x21')](_0x11373d[_0xe97f('0x39')][_0xe97f('0x21')]);}_0x495eb6[_0xe97f('0x40')]=qs[_0xe97f('0x41')](_0x11373d[_0xe97f('0x39')][_0xe97f('0x41')]);_0x495eb6[_0xe97f('0x42')]=qs[_0xe97f('0x3a')](_['pick'](_0x11373d[_0xe97f('0x39')],_0x2263ed[_0xe97f('0x3a')]),_0x21026e);if(_0x11373d[_0xe97f('0x39')]['filter']){_0x495eb6['where']=_[_0xe97f('0x43')](_0x495eb6[_0xe97f('0x42')],{'$or':_['map'](_0x21026e,function(_0x3cb689){if(_0x3cb689['type']!=='VIRTUAL'){var _0x766a85={};_0x766a85[_0x3cb689[_0xe97f('0x30')]]={'$like':'%'+_0x11373d[_0xe97f('0x39')][_0xe97f('0x44')]+'%'};return _0x766a85;}})});}_0x495eb6=_['merge']({},_0x495eb6,_0x11373d[_0xe97f('0x45')]);var _0x4073b9={'where':_0x495eb6[_0xe97f('0x42')]};return db[_0xe97f('0x34')][_0xe97f('0x24')](_0x4073b9)[_0xe97f('0x29')](function(_0x3f6b10){_0x1605d9['count']=_0x3f6b10;if(_0x11373d[_0xe97f('0x39')]['includeAll']){_0x495eb6[_0xe97f('0x46')]=[{'all':!![]}];}return db[_0xe97f('0x34')][_0xe97f('0x47')](_0x495eb6);})[_0xe97f('0x29')](function(_0xf59e35){_0x1605d9[_0xe97f('0x48')]=_0xf59e35;return _0x1605d9;})['then'](respondWithFilteredResult(_0x38df3c,_0x495eb6))['catch'](handleError(_0x38df3c,null));};exports['show']=function(_0x2216d0,_0x3a7db4){var _0x42327c={'raw':![],'where':{'id':_0x2216d0[_0xe97f('0x49')]['id']}},_0x47e196={};_0x47e196[_0xe97f('0x38')]=_['keys'](db[_0xe97f('0x34')]['rawAttributes']);_0x47e196[_0xe97f('0x39')]=_[_0xe97f('0x4a')](_0x2216d0[_0xe97f('0x39')]);_0x47e196[_0xe97f('0x3a')]=_['intersection'](_0x47e196['model'],_0x47e196[_0xe97f('0x39')]);_0x42327c[_0xe97f('0x3c')]=_[_0xe97f('0x3b')](_0x47e196[_0xe97f('0x38')],qs[_0xe97f('0x3d')](_0x2216d0[_0xe97f('0x39')]['fields']));_0x42327c[_0xe97f('0x3c')]=_0x42327c[_0xe97f('0x3c')][_0xe97f('0x3e')]?_0x42327c[_0xe97f('0x3c')]:_0x47e196[_0xe97f('0x38')];if(_0x2216d0[_0xe97f('0x39')][_0xe97f('0x4b')]){_0x42327c[_0xe97f('0x46')]=[{'all':!![]}];}_0x42327c=_[_0xe97f('0x43')]({},_0x42327c,_0x2216d0[_0xe97f('0x45')]);return db[_0xe97f('0x34')][_0xe97f('0x4c')](_0x42327c)[_0xe97f('0x29')](handleEntityNotFound(_0x3a7db4,null))['then'](respondWithResult(_0x3a7db4,null))[_0xe97f('0x4d')](handleError(_0x3a7db4,null));};exports[_0xe97f('0x4e')]=function(_0x94facd,_0x36bda1){return db[_0xe97f('0x34')][_0xe97f('0x4e')](_0x94facd[_0xe97f('0x4f')],{})['then'](function(_0x43f888){var _0x5bc711=_0x94facd[_0xe97f('0x50')][_0xe97f('0x2b')]({'plain':!![]});if(!_0x5bc711)throw new Error(_0xe97f('0x51'));if(_0x5bc711[_0xe97f('0x52')]===_0xe97f('0x50')){var _0x49c0eb=_0x43f888[_0xe97f('0x2b')]({'plain':!![]});var _0x561421=_0xe97f('0x2c');return db[_0xe97f('0x53')][_0xe97f('0x4c')]({'where':{'name':_0x561421,'userProfileId':_0x5bc711[_0xe97f('0x54')]},'raw':!![]})[_0xe97f('0x29')](function(_0x59d3fe){if(_0x59d3fe&&_0x59d3fe[_0xe97f('0x55')]===0x0){return db[_0xe97f('0x2d')][_0xe97f('0x4e')]({'name':_0x49c0eb[_0xe97f('0x30')],'resourceId':_0x49c0eb['id'],'type':_0x59d3fe[_0xe97f('0x30')],'sectionId':_0x59d3fe['id']},{})['then'](function(){return _0x43f888;});}else{return _0x43f888;}})['catch'](function(_0x4a632a){logger['error'](_0xe97f('0x56'),_0x4a632a);throw _0x4a632a;});}return _0x43f888;})[_0xe97f('0x29')](respondWithResult(_0x36bda1,0xc9))[_0xe97f('0x4d')](handleError(_0x36bda1,null));};exports[_0xe97f('0x57')]=function(_0x41fddf,_0x506471){if(_0x41fddf['body']['id']){delete _0x41fddf[_0xe97f('0x4f')]['id'];}return db[_0xe97f('0x34')][_0xe97f('0x4c')]({'where':{'id':_0x41fddf[_0xe97f('0x49')]['id']}})['then'](handleEntityNotFound(_0x506471,null))[_0xe97f('0x29')](saveUpdates(_0x41fddf['body'],null))[_0xe97f('0x29')](respondWithResult(_0x506471,null))['catch'](handleError(_0x506471,null));};exports[_0xe97f('0x2a')]=function(_0x1948b0,_0x53cdbc){return db[_0xe97f('0x34')][_0xe97f('0x4c')]({'where':{'id':_0x1948b0[_0xe97f('0x49')]['id']}})[_0xe97f('0x29')](handleEntityNotFound(_0x53cdbc,null))[_0xe97f('0x29')](removeEntity(_0x53cdbc,null))[_0xe97f('0x4d')](handleError(_0x53cdbc,null));};exports[_0xe97f('0x58')]=function(_0x12865b,_0x5cb814){return db[_0xe97f('0x34')]['describe']()['then'](respondWithResult(_0x5cb814,null))[_0xe97f('0x4d')](handleError(_0x5cb814,null));};exports[_0xe97f('0x59')]=function(_0x4553a9,_0x4773cf,_0x23150f){if(_0x4553a9[_0xe97f('0x4f')]['id']){delete _0x4553a9[_0xe97f('0x4f')]['id'];}return db[_0xe97f('0x34')][_0xe97f('0x4c')]({'where':{'id':_0x4553a9[_0xe97f('0x49')]['id']}})[_0xe97f('0x29')](handleEntityNotFound(_0x4773cf,null))[_0xe97f('0x29')](function(_0x22570f){if(_0x22570f){_0x4553a9[_0xe97f('0x4f')][_0xe97f('0x5a')]=_0x22570f['id'];return db[_0xe97f('0x5b')][_0xe97f('0x4e')](_0x4553a9[_0xe97f('0x4f')]);}})[_0xe97f('0x29')](respondWithResult(_0x4773cf,null))['catch'](handleError(_0x4773cf,null));};exports['getDispositions']=function(_0x2ffb8c,_0x282b97,_0xfe1db0){var _0x41898c={'raw':![],'where':{}};var _0x475c39={};var _0xb0987e={'count':0x0,'rows':[]};return db[_0xe97f('0x34')][_0xe97f('0x5c')]({'where':{'id':_0x2ffb8c['params']['id']}})[_0xe97f('0x29')](handleEntityNotFound(_0x282b97,null))[_0xe97f('0x29')](function(_0x3de336){if(_0x3de336){_0x475c39[_0xe97f('0x38')]=_[_0xe97f('0x4a')](db['Disposition'][_0xe97f('0x35')]);_0x475c39[_0xe97f('0x39')]=_[_0xe97f('0x4a')](_0x2ffb8c[_0xe97f('0x39')]);_0x475c39['filters']=_[_0xe97f('0x3b')](_0x475c39['model'],_0x475c39['query']);_0x41898c['attributes']=_[_0xe97f('0x3b')](_0x475c39[_0xe97f('0x38')],qs['fields'](_0x2ffb8c['query'][_0xe97f('0x3d')]));_0x41898c['attributes']=_0x41898c[_0xe97f('0x3c')][_0xe97f('0x3e')]?_0x41898c[_0xe97f('0x3c')]:_0x475c39[_0xe97f('0x38')];if(!_0x2ffb8c[_0xe97f('0x39')]['hasOwnProperty'](_0xe97f('0x5d'))){_0x41898c['limit']=qs[_0xe97f('0x23')](_0x2ffb8c[_0xe97f('0x39')]['limit']);_0x41898c['offset']=qs[_0xe97f('0x21')](_0x2ffb8c['query'][_0xe97f('0x21')]);}_0x41898c['order']=qs[_0xe97f('0x41')](_0x2ffb8c[_0xe97f('0x39')]['sort']);_0x41898c[_0xe97f('0x42')]=qs[_0xe97f('0x3a')](_[_0xe97f('0x5e')](_0x2ffb8c[_0xe97f('0x39')],_0x475c39[_0xe97f('0x3a')]));_0x41898c[_0xe97f('0x42')]['ListId']=_0x3de336['id'];if(_0x2ffb8c[_0xe97f('0x39')]['filter']){_0x41898c[_0xe97f('0x42')]=_[_0xe97f('0x43')](_0x41898c['where'],{'$or':_[_0xe97f('0x33')](_0x41898c[_0xe97f('0x3c')],function(_0x4a1e89){var _0x28a1bc={};_0x28a1bc[_0x4a1e89]={'$like':'%'+_0x2ffb8c[_0xe97f('0x39')][_0xe97f('0x44')]+'%'};return _0x28a1bc;})});}_0x41898c=_[_0xe97f('0x43')]({},_0x41898c,_0x2ffb8c['options']);return db[_0xe97f('0x5b')][_0xe97f('0x24')]({'where':_0x41898c[_0xe97f('0x42')]})[_0xe97f('0x29')](function(_0x46e0c2){_0xb0987e[_0xe97f('0x24')]=_0x46e0c2;if(_0x2ffb8c[_0xe97f('0x39')][_0xe97f('0x4b')]){_0x41898c[_0xe97f('0x46')]=[{'all':!![]}];}return db['Disposition'][_0xe97f('0x47')](_0x41898c);})[_0xe97f('0x29')](function(_0x88c494){_0xb0987e[_0xe97f('0x48')]=_0x88c494;return _0xb0987e;});}})['then'](respondWithFilteredResult(_0x282b97,_0x41898c))['catch'](handleError(_0x282b97,null));};exports[_0xe97f('0x5f')]=function(_0x4ace90,_0x2588a0,_0x4f7614){return db[_0xe97f('0x34')]['find']({'where':{'id':_0x4ace90[_0xe97f('0x49')]['id']}})[_0xe97f('0x29')](handleEntityNotFound(_0x2588a0,null))[_0xe97f('0x29')](function(_0x115109){if(_0x115109){return _0x115109[_0xe97f('0x5f')](_0x4ace90[_0xe97f('0x39')]['ids']);}})[_0xe97f('0x29')](respondWithStatusCode(_0x2588a0,null))[_0xe97f('0x4d')](handleError(_0x2588a0,null));};exports['addContacts']=function(_0x27dbcc,_0x2c9eca,_0x1e9b08){return db['CmList'][_0xe97f('0x4c')]({'where':{'id':_0x27dbcc['params']['id']}})[_0xe97f('0x29')](handleEntityNotFound(_0x2c9eca,null))['then'](function(_0x27eb02){if(_0x27eb02){var _0x1037f7=[];var _0x177ea9={'success':[],'errors':[]};return db[_0xe97f('0x60')][_0xe97f('0x58')]()[_0xe97f('0x29')](function(_0x33b8bd){if(_0x27dbcc[_0xe97f('0x4f')]['tags']&&_['isArray'](_0x27dbcc[_0xe97f('0x4f')][_0xe97f('0x61')])){if(_0x27dbcc['body']['tags'][_0xe97f('0x3e')]){_0x27dbcc[_0xe97f('0x4f')][_0xe97f('0x61')]=_0x27dbcc[_0xe97f('0x4f')]['tags'][_0xe97f('0x62')](';')+';';}else{_0x27dbcc[_0xe97f('0x4f')][_0xe97f('0x61')]=null;}}else{_0x27dbcc['body'][_0xe97f('0x61')]=null;}if(_0x27dbcc['body']&&_[_0xe97f('0x63')](_0x27dbcc[_0xe97f('0x4f')])){for(var _0x430e7f=0x0;_0x430e7f<_0x27dbcc[_0xe97f('0x4f')][_0xe97f('0x3e')];_0x430e7f+=0x1){_0x27dbcc[_0xe97f('0x4f')][_0x430e7f][_0xe97f('0x5a')]=_0x27dbcc[_0xe97f('0x49')]['id'];_0x1037f7[_0xe97f('0x64')](_0x27dbcc[_0xe97f('0x4f')][_0x430e7f]);}return BPromise[_0xe97f('0x65')](_0x1037f7,function(_0xc6ee36){return db['CmContact'][_0xe97f('0x4e')](_[_0xe97f('0x66')](_0xc6ee36,['ids','id'])||{},{'fields':_['keys'](_0x33b8bd),'raw':!![]})[_0xe97f('0x29')](function(_0x4ff5f3){_0x177ea9[_0xe97f('0x67')]['push'](_0x4ff5f3[_0xe97f('0x68')]);})[_0xe97f('0x4d')](function(_0x2646ca){_0x177ea9[_0xe97f('0x69')][_0xe97f('0x64')]({'data':_0xc6ee36,'error':_0x2646ca[_0xe97f('0x6a')]});});})[_0xe97f('0x29')](function(_0x2449d0){return _0x177ea9;})[_0xe97f('0x4d')](function(_0x4d60f3){return _0x4d60f3;});}else{_0x2c9eca[_0xe97f('0x1f')](0x190)[_0xe97f('0x20')]({'message':_0xe97f('0x6b')});}});}})['then'](respondWithResult(_0x2c9eca,null))[_0xe97f('0x4d')](handleError(_0x2c9eca,null));};exports['getContacts']=function(_0x1d7f0b,_0x340906,_0x18c106){var _0x391c90;return db[_0xe97f('0x34')][_0xe97f('0x4c')]({'where':{'id':_0x1d7f0b[_0xe97f('0x49')]['id']},'include':[{'model':db[_0xe97f('0x6c')],'as':_0xe97f('0x6d')}]})[_0xe97f('0x29')](handleEntityNotFound(_0x340906,null))[_0xe97f('0x29')](function(_0x50357d){if(_0x50357d){_0x391c90=_0x50357d;return db[_0xe97f('0x60')]['rawAttributes'];}})[_0xe97f('0x29')](function(_0x3d66e4){if(_0x3d66e4){var _0x293679={};var _0x2844a4={};_0x2844a4['model']=_[_0xe97f('0x6e')](_[_0xe97f('0x4a')](_0x3d66e4),_[_0xe97f('0x33')](_0x391c90[_0xe97f('0x6d')],function(_0xe3c024){return util[_0xe97f('0x6f')](_0xe97f('0x70'),_0xe3c024['id']);}));_0x2844a4[_0xe97f('0x39')]=_[_0xe97f('0x4a')](_0x1d7f0b['query']);_0x2844a4[_0xe97f('0x3a')]=_[_0xe97f('0x3b')](_0x2844a4['model'],_0x2844a4[_0xe97f('0x39')]);_0x293679['attributes']=_[_0xe97f('0x3b')](_0x2844a4[_0xe97f('0x38')],qs['fields'](_0x1d7f0b[_0xe97f('0x39')][_0xe97f('0x3d')]));_0x293679[_0xe97f('0x3c')]=_0x293679['attributes']['length']?_0x293679[_0xe97f('0x3c')]:_0x2844a4['model'];if(!_0x1d7f0b[_0xe97f('0x39')]['hasOwnProperty'](_0xe97f('0x5d'))){_0x293679['limit']=qs[_0xe97f('0x23')](_0x1d7f0b[_0xe97f('0x39')][_0xe97f('0x23')]);_0x293679['offset']=qs[_0xe97f('0x21')](_0x1d7f0b[_0xe97f('0x39')]['offset']);}_0x293679['order']=qs[_0xe97f('0x41')](_0x1d7f0b[_0xe97f('0x39')]['sort']);_0x293679['where']=qs[_0xe97f('0x3a')](_[_0xe97f('0x5e')](_0x1d7f0b[_0xe97f('0x39')],_0x2844a4[_0xe97f('0x3a')]));_0x293679[_0xe97f('0x71')]=!![];if(_0x1d7f0b[_0xe97f('0x39')][_0xe97f('0x44')]){_0x293679[_0xe97f('0x42')]=_[_0xe97f('0x43')](_0x293679['where'],{'$or':_[_0xe97f('0x33')](_0x293679[_0xe97f('0x3c')],function(_0xe3fb5c){var _0x1cb618={};_0x1cb618[_0xe3fb5c]={'$like':'%'+_0x1d7f0b[_0xe97f('0x39')][_0xe97f('0x44')]+'%'};return _0x1cb618;})});}_0x293679=_[_0xe97f('0x43')]({},_0x293679,_0x1d7f0b[_0xe97f('0x45')]);return _0x391c90['getContacts'](_0x293679);}})[_0xe97f('0x29')](respondWithResult(_0x340906,null))['catch'](handleError(_0x340906,null));};exports[_0xe97f('0x72')]=function(_0x1cbbb2,_0x4ad12c,_0xdea06e){var _0x15f079;return db[_0xe97f('0x34')]['find']({'where':{'id':_0x1cbbb2[_0xe97f('0x49')]['id']},'include':[{'model':db[_0xe97f('0x6c')],'as':'CustomFields'}]})[_0xe97f('0x29')](handleEntityNotFound(_0x4ad12c,null))[_0xe97f('0x29')](function(_0x8bde67){if(_0x8bde67){_0x15f079=_0x8bde67;return db['CmContact'][_0xe97f('0x35')];}})[_0xe97f('0x29')](function(_0x47fa9b){if(_0x47fa9b){var _0x598fa6={};var _0x375640={};_0x375640[_0xe97f('0x38')]=_[_0xe97f('0x6e')](_[_0xe97f('0x4a')](_0x47fa9b),_[_0xe97f('0x33')](_0x15f079[_0xe97f('0x6d')],function(_0xbe62dd){return util[_0xe97f('0x6f')](_0xe97f('0x70'),_0xbe62dd['id']);}));_0x375640[_0xe97f('0x39')]=_[_0xe97f('0x4a')](_0x1cbbb2[_0xe97f('0x39')]);_0x375640[_0xe97f('0x3a')]=_[_0xe97f('0x3b')](_0x375640[_0xe97f('0x38')],_0x375640[_0xe97f('0x39')]);_0x598fa6[_0xe97f('0x3c')]=_[_0xe97f('0x3b')](_0x375640[_0xe97f('0x38')],qs[_0xe97f('0x3d')](_0x1cbbb2[_0xe97f('0x39')][_0xe97f('0x3d')]));_0x598fa6[_0xe97f('0x3c')]=_0x598fa6[_0xe97f('0x3c')][_0xe97f('0x3e')]?_0x598fa6[_0xe97f('0x3c')]:_0x375640[_0xe97f('0x38')];if(!_0x1cbbb2[_0xe97f('0x39')][_0xe97f('0x3f')](_0xe97f('0x5d'))){_0x598fa6[_0xe97f('0x23')]=qs[_0xe97f('0x23')](_0x1cbbb2[_0xe97f('0x39')][_0xe97f('0x23')]);_0x598fa6['offset']=qs[_0xe97f('0x21')](_0x1cbbb2[_0xe97f('0x39')]['offset']);}_0x598fa6['order']=qs[_0xe97f('0x41')](_0x1cbbb2['query'][_0xe97f('0x41')]);_0x598fa6[_0xe97f('0x42')]=qs[_0xe97f('0x3a')](_['pick'](_0x1cbbb2[_0xe97f('0x39')],_0x375640[_0xe97f('0x3a')]));_0x598fa6[_0xe97f('0x71')]=!![];if(_0x1cbbb2['query'][_0xe97f('0x44')]){_0x598fa6[_0xe97f('0x42')]=_[_0xe97f('0x43')](_0x598fa6[_0xe97f('0x42')],{'$or':_['map'](_0x598fa6[_0xe97f('0x3c')],function(_0x336867){var _0x568904={};_0x568904[_0x336867]={'$like':'%'+_0x1cbbb2[_0xe97f('0x39')][_0xe97f('0x44')]+'%'};return _0x568904;})});}_0x598fa6=_[_0xe97f('0x43')]({},_0x598fa6,_0x1cbbb2['options']);return _0x15f079['getContacts'](_0x598fa6);}})[_0xe97f('0x29')](function(_0xa9b276){if(!_['isEmpty'](_0xa9b276)){var _0x3be708=toCsv(_0xa9b276);var _0x326583=Date[_0xe97f('0x73')]();fs[_0xe97f('0x74')](util[_0xe97f('0x6f')]('/tmp/list_%d_%s.csv',_0x15f079['id'],_0x326583),_0x3be708);_0x4ad12c[_0xe97f('0x75')](_0xe97f('0x76'),_0xe97f('0x77')+util[_0xe97f('0x6f')]('list_%d_%s.csv',_0x15f079['id'],_0x326583));_0x4ad12c[_0xe97f('0x75')](_0xe97f('0x78'),_0xe97f('0x79'));return _0x4ad12c['download'](util['format'](_0xe97f('0x7a'),_0x15f079['id'],_0x326583));}else{return _0x4ad12c[_0xe97f('0x1e')](0xcc);}})[_0xe97f('0x4d')](handleError(_0x4ad12c,null));};exports[_0xe97f('0x7b')]=function(_0x540b6a,_0x4358e2,_0x206d17){var _0x2f8170;delete _0x540b6a[_0xe97f('0x4f')]['id'];return db['CmList'][_0xe97f('0x5c')]({'where':{'id':_0x540b6a[_0xe97f('0x49')]['id']}})[_0xe97f('0x29')](handleEntityNotFound(_0x4358e2,null))[_0xe97f('0x29')](function(_0x42a945){if(_0x42a945){return db[_0xe97f('0x7c')]['transaction'](function(_0x16a2f8){return db[_0xe97f('0x6c')][_0xe97f('0x4e')](_0x540b6a[_0xe97f('0x4f')],{'transaction':_0x16a2f8})['then'](function(_0x3651f6){_0x2f8170=_0x3651f6;return _0x42a945[_0xe97f('0x7d')](_0x3651f6,{'transaction':_0x16a2f8});})[_0xe97f('0x29')](function(){var _0xaff466={'type':db[_0xe97f('0x7e')]['TEXT'],'transaction':_0x16a2f8};switch(_0x540b6a[_0xe97f('0x4f')]['type']){case _0xe97f('0x7f'):_0xaff466[_0xe97f('0x36')]=db['Sequelize']['TEXT'];break;case _0xe97f('0x80'):_0xaff466['type']=db[_0xe97f('0x7e')]['INTEGER'];break;case _0xe97f('0x81'):_0xaff466[_0xe97f('0x36')]=db[_0xe97f('0x7e')]['BOOLEAN'];_0xaff466[_0xe97f('0x82')]=![];break;default:}return db[_0xe97f('0x7c')]['queryInterface']['addColumn']('cm_contacts',util[_0xe97f('0x6f')]('cf_%s',_0x2f8170['id']),_0xaff466);})[_0xe97f('0x29')](function(){return _0x2f8170;});});}})['then'](respondWithResult(_0x4358e2,null))['catch'](handleError(_0x4358e2,null));};exports[_0xe97f('0x83')]=function(_0x2b7e1e,_0x4e089e,_0x337bbe){var _0x282001={};var _0x677bbf={};var _0x18962c;var _0x1bc755;return db[_0xe97f('0x34')][_0xe97f('0x5c')]({'where':{'id':_0x2b7e1e['params']['id']}})[_0xe97f('0x29')](handleEntityNotFound(_0x4e089e,null))['then'](function(_0x208297){if(_0x208297){_0x18962c=_0x208297;_0x677bbf[_0xe97f('0x38')]=_[_0xe97f('0x4a')](db[_0xe97f('0x6c')][_0xe97f('0x35')]);_0x677bbf[_0xe97f('0x39')]=_[_0xe97f('0x4a')](_0x2b7e1e[_0xe97f('0x39')]);_0x677bbf[_0xe97f('0x3a')]=_[_0xe97f('0x3b')](_0x677bbf[_0xe97f('0x38')],_0x677bbf[_0xe97f('0x39')]);_0x282001[_0xe97f('0x3c')]=_[_0xe97f('0x3b')](_0x677bbf['model'],qs[_0xe97f('0x3d')](_0x2b7e1e[_0xe97f('0x39')][_0xe97f('0x3d')]));_0x282001[_0xe97f('0x3c')]=_0x282001[_0xe97f('0x3c')][_0xe97f('0x3e')]?_0x282001[_0xe97f('0x3c')]:_0x677bbf[_0xe97f('0x38')];_0x282001['order']=qs[_0xe97f('0x41')](_0x2b7e1e[_0xe97f('0x39')]['sort']);_0x282001[_0xe97f('0x42')]=qs[_0xe97f('0x3a')](_[_0xe97f('0x5e')](_0x2b7e1e[_0xe97f('0x39')],_0x677bbf['filters']));_0x282001['where']=_[_0xe97f('0x43')](_0x282001[_0xe97f('0x42')],{'$or':[{'ListId':_0x208297['id']},{'ListId':null}]});if(_0x2b7e1e[_0xe97f('0x39')][_0xe97f('0x44')]){_0x282001['where']=_[_0xe97f('0x43')](_0x282001[_0xe97f('0x42')],{'$or':_[_0xe97f('0x33')](_0x282001[_0xe97f('0x3c')],function(_0x283356){var _0xf5cb25={};_0xf5cb25[_0x283356]={'$like':'%'+_0x2b7e1e[_0xe97f('0x39')][_0xe97f('0x44')]+'%'};return _0xf5cb25;})});}_0x282001=_['merge']({},_0x282001,_0x2b7e1e[_0xe97f('0x45')]);return db[_0xe97f('0x6c')][_0xe97f('0x84')](_0x282001);}})['then'](respondWithResult(_0x4e089e,null))[_0xe97f('0x4d')](handleError(_0x4e089e,null));};exports[_0xe97f('0x85')]=function(_0x2d5672,_0x55308f,_0x44bd3d){return db[_0xe97f('0x34')][_0xe97f('0x4c')]({'where':{'id':_0x2d5672['params']['id']}})[_0xe97f('0x29')](handleEntityNotFound(_0x55308f,null))['then'](function(_0x37a704){if(_0x37a704){return _0x37a704[_0xe97f('0x85')](_0x2d5672[_0xe97f('0x4f')][_0xe97f('0x86')],_[_0xe97f('0x66')](_0x2d5672[_0xe97f('0x4f')],[_0xe97f('0x86'),'id'])||{})['spread'](function(_0x2e22fd){for(var _0x5cfd79=0x0;_0x5cfd79<_0x2d5672[_0xe97f('0x4f')][_0xe97f('0x86')][_0xe97f('0x3e')];_0x5cfd79+=0x1){socket[_0xe97f('0x87')](_0xe97f('0x88'),{'UserId':_0x2d5672['body']['ids'][_0x5cfd79],'CmListId':_0x2d5672['params']['id']});}return _0x2e22fd;});}})[_0xe97f('0x29')](respondWithResult(_0x55308f,null))[_0xe97f('0x4d')](handleError(_0x55308f,null));};exports[_0xe97f('0x89')]=function(_0x41d51a,_0x2653f7,_0x1d6685){return db[_0xe97f('0x34')][_0xe97f('0x4c')]({'where':{'id':_0x41d51a[_0xe97f('0x49')]['id']}})['then'](handleEntityNotFound(_0x2653f7,null))[_0xe97f('0x29')](function(_0x5018e7){if(_0x5018e7){return _0x5018e7[_0xe97f('0x89')](_0x41d51a[_0xe97f('0x39')]['ids'])[_0xe97f('0x29')](function(){if(_['isArray'](_0x41d51a['query'][_0xe97f('0x86')])){for(var _0x20d365=0x0;_0x20d365<_0x41d51a[_0xe97f('0x39')][_0xe97f('0x86')][_0xe97f('0x3e')];_0x20d365+=0x1){socket['emit'](_0xe97f('0x8a'),{'UserId':Number(_0x41d51a[_0xe97f('0x39')][_0xe97f('0x86')][_0x20d365]),'CmListId':Number(_0x41d51a['params']['id'])});}}else{socket[_0xe97f('0x87')]('userCmList:remove',{'UserId':Number(_0x41d51a[_0xe97f('0x39')]['ids']),'CmListId':Number(_0x41d51a[_0xe97f('0x49')]['id'])});}});}})[_0xe97f('0x29')](respondWithStatusCode(_0x2653f7,null))['catch'](handleError(_0x2653f7,null));};exports[_0xe97f('0x8b')]=function(_0x36ccdc,_0x65542e,_0x2ec107){var _0x449dac={};var _0x58289b={};var _0x5aea72;var _0x56a181;return db['CmList'][_0xe97f('0x5c')]({'where':{'id':_0x36ccdc['params']['id']}})[_0xe97f('0x29')](handleEntityNotFound(_0x65542e,null))[_0xe97f('0x29')](function(_0x3f0f53){if(_0x3f0f53){_0x5aea72=_0x3f0f53;_0x58289b[_0xe97f('0x38')]=_['keys'](db[_0xe97f('0x8c')][_0xe97f('0x35')]);_0x58289b['query']=_[_0xe97f('0x4a')](_0x36ccdc[_0xe97f('0x39')]);_0x58289b[_0xe97f('0x3a')]=_[_0xe97f('0x3b')](_0x58289b[_0xe97f('0x38')],_0x58289b[_0xe97f('0x39')]);_0x449dac['attributes']=_[_0xe97f('0x3b')](_0x58289b[_0xe97f('0x38')],qs['fields'](_0x36ccdc['query'][_0xe97f('0x3d')]));_0x449dac[_0xe97f('0x3c')]=_0x449dac[_0xe97f('0x3c')]['length']?_0x449dac[_0xe97f('0x3c')]:_0x58289b[_0xe97f('0x38')];_0x449dac[_0xe97f('0x40')]=qs['sort'](_0x36ccdc[_0xe97f('0x39')][_0xe97f('0x41')]);_0x449dac[_0xe97f('0x42')]=qs[_0xe97f('0x3a')](_['pick'](_0x36ccdc[_0xe97f('0x39')],_0x58289b['filters']));if(_0x36ccdc['query'][_0xe97f('0x44')]){_0x449dac[_0xe97f('0x42')]=_[_0xe97f('0x43')](_0x449dac[_0xe97f('0x42')],{'$or':_['map'](_0x449dac['attributes'],function(_0x408d08){var _0x2cbe28={};_0x2cbe28[_0x408d08]={'$like':'%'+_0x36ccdc[_0xe97f('0x39')]['filter']+'%'};return _0x2cbe28;})});}_0x449dac=_[_0xe97f('0x43')]({},_0x449dac,_0x36ccdc[_0xe97f('0x45')]);return _0x5aea72[_0xe97f('0x8b')](_0x449dac);}})['then'](function(_0x433fca){if(_0x433fca){_0x56a181=_0x433fca[_0xe97f('0x3e')];if(!_0x36ccdc['query'][_0xe97f('0x3f')](_0xe97f('0x5d'))){_0x449dac[_0xe97f('0x23')]=qs[_0xe97f('0x23')](_0x36ccdc[_0xe97f('0x39')][_0xe97f('0x23')]);_0x449dac[_0xe97f('0x21')]=qs['offset'](_0x36ccdc[_0xe97f('0x39')][_0xe97f('0x21')]);}return _0x5aea72['getAgents'](_0x449dac);}})[_0xe97f('0x29')](function(_0x103c54){if(_0x103c54){return _0x103c54?{'count':_0x56a181,'rows':_0x103c54}:null;}})[_0xe97f('0x29')](respondWithResult(_0x65542e,null))[_0xe97f('0x4d')](handleError(_0x65542e,null));}; \ No newline at end of file +var _0xe0e5=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','ListId','getDispositions','findOne','Disposition','pick','removeDispositions','ids','CmContact','isArray','tags','join','each','omit','success','push','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','cf_%d','raw','getContactsCsv','CustomFields','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','sequelize','transaction','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','queryInterface','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','CmList','includeAll','include','rows','catch','show','params','length'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0xe0e5,0x163));var _0x5e0e=function(_0x34a14d,_0xc49d24){_0x34a14d=_0x34a14d-0x0;var _0x2015f2=_0xe0e5[_0x34a14d];return _0x2015f2;};'use strict';var emlformat=require(_0x5e0e('0x0'));var rimraf=require(_0x5e0e('0x1'));var zipdir=require(_0x5e0e('0x2'));var jsonpatch=require(_0x5e0e('0x3'));var rp=require(_0x5e0e('0x4'));var moment=require(_0x5e0e('0x5'));var BPromise=require(_0x5e0e('0x6'));var Mustache=require(_0x5e0e('0x7'));var util=require(_0x5e0e('0x8'));var path=require(_0x5e0e('0x9'));var sox=require(_0x5e0e('0xa'));var csv=require('to-csv');var ejs=require(_0x5e0e('0xb'));var fs=require('fs');var fs_extra=require(_0x5e0e('0xc'));var _=require('lodash');var squel=require(_0x5e0e('0xd'));var crypto=require(_0x5e0e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5e0e('0xf'));var toCsv=require(_0x5e0e('0x10'));var querystring=require('querystring');var Papa=require(_0x5e0e('0x11'));var Redis=require('ioredis');var authService=require(_0x5e0e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5e0e('0x13'));var hardwareService=require(_0x5e0e('0x14'));var logger=require(_0x5e0e('0x15'))(_0x5e0e('0x16'));var utils=require(_0x5e0e('0x17'));var config=require(_0x5e0e('0x18'));var licenseUtil=require(_0x5e0e('0x19'));var db=require(_0x5e0e('0x1a'))['db'];config['redis']=_['defaults'](config[_0x5e0e('0x1b')],{'host':_0x5e0e('0x1c'),'port':0x18eb});var socket=require(_0x5e0e('0x1d'))(new Redis(config['redis']));require(_0x5e0e('0x1e'))[_0x5e0e('0x1f')](socket);function respondWithStatusCode(_0x53a663,_0x48ebbe){_0x48ebbe=_0x48ebbe||0xcc;return function(_0x3bf9c9){if(_0x3bf9c9){return _0x53a663[_0x5e0e('0x20')](_0x48ebbe);}return _0x53a663[_0x5e0e('0x21')](_0x48ebbe)['end']();};}function respondWithResult(_0x13fd88,_0x56e4f8){_0x56e4f8=_0x56e4f8||0xc8;return function(_0x59f330){if(_0x59f330){return _0x13fd88[_0x5e0e('0x21')](_0x56e4f8)[_0x5e0e('0x22')](_0x59f330);}};}function respondWithFilteredResult(_0x3c6441,_0x530f42){return function(_0x20dbd7){if(_0x20dbd7){var _0x18dfc3=typeof _0x530f42[_0x5e0e('0x23')]===_0x5e0e('0x24')&&typeof _0x530f42[_0x5e0e('0x25')]===_0x5e0e('0x24');var _0x49f785=_0x20dbd7[_0x5e0e('0x26')];var _0x3b1867=_0x18dfc3?0x0:_0x530f42[_0x5e0e('0x23')];var _0xc76dab=_0x18dfc3?_0x20dbd7[_0x5e0e('0x26')]:_0x530f42['offset']+_0x530f42['limit'];var _0x153bc3;if(_0xc76dab>=_0x49f785){_0xc76dab=_0x49f785;_0x153bc3=0xc8;}else{_0x153bc3=0xce;}_0x3c6441[_0x5e0e('0x21')](_0x153bc3);return _0x3c6441[_0x5e0e('0x27')](_0x5e0e('0x28'),_0x3b1867+'-'+_0xc76dab+'/'+_0x49f785)[_0x5e0e('0x22')](_0x20dbd7);}return null;};}function patchUpdates(_0x446346){return function(_0x335ace){try{jsonpatch['apply'](_0x335ace,_0x446346,!![]);}catch(_0x3c88ed){return BPromise[_0x5e0e('0x29')](_0x3c88ed);}return _0x335ace['save']();};}function saveUpdates(_0x940445,_0x143457){return function(_0x207525){if(_0x207525){return _0x207525[_0x5e0e('0x2a')](_0x940445)[_0x5e0e('0x2b')](function(_0x543ce0){return _0x543ce0;});}return null;};}function removeEntity(_0x26f5a0,_0x320e56){return function(_0x40032b){if(_0x40032b){return _0x40032b[_0x5e0e('0x2c')]()[_0x5e0e('0x2b')](function(){var _0x34e648=_0x40032b[_0x5e0e('0x2d')]({'plain':!![]});var _0x47af13='Lists';return db[_0x5e0e('0x2e')][_0x5e0e('0x2c')]({'where':{'type':_0x47af13,'resourceId':_0x34e648['id']}})['then'](function(){return _0x40032b;});})[_0x5e0e('0x2b')](function(){_0x26f5a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fe03a,_0x4ffcef){return function(_0x5b47bf){if(!_0x5b47bf){_0x2fe03a[_0x5e0e('0x20')](0x194);}return _0x5b47bf;};}function handleError(_0x20b647,_0x3edf21){_0x3edf21=_0x3edf21||0x1f4;return function(_0x5d2f93){logger[_0x5e0e('0x2f')](_0x5d2f93[_0x5e0e('0x30')]);if(_0x5d2f93['name']){delete _0x5d2f93[_0x5e0e('0x31')];}_0x20b647['status'](_0x3edf21)[_0x5e0e('0x32')](_0x5d2f93);};}exports[_0x5e0e('0x33')]=function(_0x18fec9,_0x548139){var _0x40294c={},_0x2107c8={},_0x43d3f6={'count':0x0,'rows':[]};var _0x2850ed=_[_0x5e0e('0x34')](db['CmList'][_0x5e0e('0x35')],function(_0x1d20d1){return{'name':_0x1d20d1[_0x5e0e('0x36')],'type':_0x1d20d1[_0x5e0e('0x37')][_0x5e0e('0x38')]};});_0x2107c8[_0x5e0e('0x39')]=_[_0x5e0e('0x34')](_0x2850ed,_0x5e0e('0x31'));_0x2107c8['query']=_[_0x5e0e('0x3a')](_0x18fec9[_0x5e0e('0x3b')]);_0x2107c8[_0x5e0e('0x3c')]=_[_0x5e0e('0x3d')](_0x2107c8[_0x5e0e('0x39')],_0x2107c8['query']);_0x40294c[_0x5e0e('0x3e')]=_[_0x5e0e('0x3d')](_0x2107c8[_0x5e0e('0x39')],qs[_0x5e0e('0x3f')](_0x18fec9[_0x5e0e('0x3b')][_0x5e0e('0x3f')]));_0x40294c['attributes']=_0x40294c[_0x5e0e('0x3e')]['length']?_0x40294c[_0x5e0e('0x3e')]:_0x2107c8[_0x5e0e('0x39')];if(!_0x18fec9[_0x5e0e('0x3b')][_0x5e0e('0x40')](_0x5e0e('0x41'))){_0x40294c['limit']=qs[_0x5e0e('0x25')](_0x18fec9[_0x5e0e('0x3b')][_0x5e0e('0x25')]);_0x40294c['offset']=qs['offset'](_0x18fec9['query'][_0x5e0e('0x23')]);}_0x40294c[_0x5e0e('0x42')]=qs[_0x5e0e('0x43')](_0x18fec9[_0x5e0e('0x3b')][_0x5e0e('0x43')]);_0x40294c[_0x5e0e('0x44')]=qs[_0x5e0e('0x3c')](_['pick'](_0x18fec9[_0x5e0e('0x3b')],_0x2107c8[_0x5e0e('0x3c')]),_0x2850ed);if(_0x18fec9['query']['filter']){_0x40294c[_0x5e0e('0x44')]=_['merge'](_0x40294c['where'],{'$or':_[_0x5e0e('0x34')](_0x2850ed,function(_0x21153a){if(_0x21153a['type']!=='VIRTUAL'){var _0x27b097={};_0x27b097[_0x21153a[_0x5e0e('0x31')]]={'$like':'%'+_0x18fec9['query'][_0x5e0e('0x45')]+'%'};return _0x27b097;}})});}_0x40294c=_[_0x5e0e('0x46')]({},_0x40294c,_0x18fec9[_0x5e0e('0x47')]);var _0x325027={'where':_0x40294c[_0x5e0e('0x44')]};return db[_0x5e0e('0x48')][_0x5e0e('0x26')](_0x325027)[_0x5e0e('0x2b')](function(_0x30c860){_0x43d3f6[_0x5e0e('0x26')]=_0x30c860;if(_0x18fec9['query'][_0x5e0e('0x49')]){_0x40294c[_0x5e0e('0x4a')]=[{'all':!![]}];}return db[_0x5e0e('0x48')]['findAll'](_0x40294c);})[_0x5e0e('0x2b')](function(_0x340bf8){_0x43d3f6[_0x5e0e('0x4b')]=_0x340bf8;return _0x43d3f6;})[_0x5e0e('0x2b')](respondWithFilteredResult(_0x548139,_0x40294c))[_0x5e0e('0x4c')](handleError(_0x548139,null));};exports[_0x5e0e('0x4d')]=function(_0x248f40,_0x1558bb){var _0x297c5c={'raw':![],'where':{'id':_0x248f40[_0x5e0e('0x4e')]['id']}},_0x5a87b1={};_0x5a87b1['model']=_[_0x5e0e('0x3a')](db['CmList'][_0x5e0e('0x35')]);_0x5a87b1[_0x5e0e('0x3b')]=_['keys'](_0x248f40[_0x5e0e('0x3b')]);_0x5a87b1['filters']=_[_0x5e0e('0x3d')](_0x5a87b1[_0x5e0e('0x39')],_0x5a87b1[_0x5e0e('0x3b')]);_0x297c5c[_0x5e0e('0x3e')]=_[_0x5e0e('0x3d')](_0x5a87b1[_0x5e0e('0x39')],qs['fields'](_0x248f40[_0x5e0e('0x3b')]['fields']));_0x297c5c[_0x5e0e('0x3e')]=_0x297c5c[_0x5e0e('0x3e')][_0x5e0e('0x4f')]?_0x297c5c[_0x5e0e('0x3e')]:_0x5a87b1[_0x5e0e('0x39')];if(_0x248f40[_0x5e0e('0x3b')][_0x5e0e('0x49')]){_0x297c5c[_0x5e0e('0x4a')]=[{'all':!![]}];}_0x297c5c=_[_0x5e0e('0x46')]({},_0x297c5c,_0x248f40[_0x5e0e('0x47')]);return db[_0x5e0e('0x48')][_0x5e0e('0x50')](_0x297c5c)[_0x5e0e('0x2b')](handleEntityNotFound(_0x1558bb,null))[_0x5e0e('0x2b')](respondWithResult(_0x1558bb,null))[_0x5e0e('0x4c')](handleError(_0x1558bb,null));};exports[_0x5e0e('0x51')]=function(_0x35e060,_0x1487c4){return db[_0x5e0e('0x48')][_0x5e0e('0x51')](_0x35e060[_0x5e0e('0x52')],{})[_0x5e0e('0x2b')](function(_0x5eca39){var _0x2af7e8=_0x35e060[_0x5e0e('0x53')][_0x5e0e('0x2d')]({'plain':!![]});if(!_0x2af7e8)throw new Error(_0x5e0e('0x54'));if(_0x2af7e8[_0x5e0e('0x55')]===_0x5e0e('0x53')){var _0x1fc3b0=_0x5eca39[_0x5e0e('0x2d')]({'plain':!![]});var _0x52b4cf=_0x5e0e('0x56');return db[_0x5e0e('0x57')][_0x5e0e('0x50')]({'where':{'name':_0x52b4cf,'userProfileId':_0x2af7e8[_0x5e0e('0x58')]},'raw':!![]})[_0x5e0e('0x2b')](function(_0x40f1a3){if(_0x40f1a3&&_0x40f1a3[_0x5e0e('0x59')]===0x0){return db[_0x5e0e('0x2e')][_0x5e0e('0x51')]({'name':_0x1fc3b0[_0x5e0e('0x31')],'resourceId':_0x1fc3b0['id'],'type':_0x40f1a3['name'],'sectionId':_0x40f1a3['id']},{})['then'](function(){return _0x5eca39;});}else{return _0x5eca39;}})['catch'](function(_0x569e4f){logger[_0x5e0e('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x569e4f);throw _0x569e4f;});}return _0x5eca39;})[_0x5e0e('0x2b')](respondWithResult(_0x1487c4,0xc9))[_0x5e0e('0x4c')](handleError(_0x1487c4,null));};exports[_0x5e0e('0x2a')]=function(_0x465301,_0x7345e6){if(_0x465301[_0x5e0e('0x52')]['id']){delete _0x465301['body']['id'];}return db[_0x5e0e('0x48')][_0x5e0e('0x50')]({'where':{'id':_0x465301[_0x5e0e('0x4e')]['id']}})[_0x5e0e('0x2b')](handleEntityNotFound(_0x7345e6,null))[_0x5e0e('0x2b')](saveUpdates(_0x465301[_0x5e0e('0x52')],null))['then'](respondWithResult(_0x7345e6,null))[_0x5e0e('0x4c')](handleError(_0x7345e6,null));};exports[_0x5e0e('0x2c')]=function(_0xb313d4,_0x37d515){return db[_0x5e0e('0x48')]['find']({'where':{'id':_0xb313d4[_0x5e0e('0x4e')]['id']}})[_0x5e0e('0x2b')](handleEntityNotFound(_0x37d515,null))[_0x5e0e('0x2b')](removeEntity(_0x37d515,null))[_0x5e0e('0x4c')](handleError(_0x37d515,null));};exports[_0x5e0e('0x5a')]=function(_0x27928b,_0x13f7ff){return db['CmList'][_0x5e0e('0x5a')]()[_0x5e0e('0x2b')](respondWithResult(_0x13f7ff,null))[_0x5e0e('0x4c')](handleError(_0x13f7ff,null));};exports[_0x5e0e('0x5b')]=function(_0x2ba8ab,_0x64f512,_0x2d0f4d){if(_0x2ba8ab['body']['id']){delete _0x2ba8ab[_0x5e0e('0x52')]['id'];}return db['CmList'][_0x5e0e('0x50')]({'where':{'id':_0x2ba8ab['params']['id']}})['then'](handleEntityNotFound(_0x64f512,null))[_0x5e0e('0x2b')](function(_0x20987d){if(_0x20987d){_0x2ba8ab[_0x5e0e('0x52')][_0x5e0e('0x5c')]=_0x20987d['id'];return db['Disposition']['create'](_0x2ba8ab[_0x5e0e('0x52')]);}})[_0x5e0e('0x2b')](respondWithResult(_0x64f512,null))['catch'](handleError(_0x64f512,null));};exports[_0x5e0e('0x5d')]=function(_0x3e574b,_0x227516,_0x19ebc9){var _0x19a943={'raw':![],'where':{}};var _0x541ed3={};var _0x215055={'count':0x0,'rows':[]};return db['CmList'][_0x5e0e('0x5e')]({'where':{'id':_0x3e574b[_0x5e0e('0x4e')]['id']}})[_0x5e0e('0x2b')](handleEntityNotFound(_0x227516,null))['then'](function(_0x16526c){if(_0x16526c){_0x541ed3[_0x5e0e('0x39')]=_['keys'](db[_0x5e0e('0x5f')][_0x5e0e('0x35')]);_0x541ed3[_0x5e0e('0x3b')]=_[_0x5e0e('0x3a')](_0x3e574b[_0x5e0e('0x3b')]);_0x541ed3[_0x5e0e('0x3c')]=_[_0x5e0e('0x3d')](_0x541ed3['model'],_0x541ed3['query']);_0x19a943[_0x5e0e('0x3e')]=_[_0x5e0e('0x3d')](_0x541ed3[_0x5e0e('0x39')],qs[_0x5e0e('0x3f')](_0x3e574b[_0x5e0e('0x3b')]['fields']));_0x19a943['attributes']=_0x19a943[_0x5e0e('0x3e')][_0x5e0e('0x4f')]?_0x19a943['attributes']:_0x541ed3[_0x5e0e('0x39')];if(!_0x3e574b[_0x5e0e('0x3b')][_0x5e0e('0x40')]('nolimit')){_0x19a943['limit']=qs[_0x5e0e('0x25')](_0x3e574b[_0x5e0e('0x3b')][_0x5e0e('0x25')]);_0x19a943['offset']=qs[_0x5e0e('0x23')](_0x3e574b[_0x5e0e('0x3b')][_0x5e0e('0x23')]);}_0x19a943[_0x5e0e('0x42')]=qs[_0x5e0e('0x43')](_0x3e574b[_0x5e0e('0x3b')][_0x5e0e('0x43')]);_0x19a943[_0x5e0e('0x44')]=qs[_0x5e0e('0x3c')](_[_0x5e0e('0x60')](_0x3e574b[_0x5e0e('0x3b')],_0x541ed3['filters']));_0x19a943[_0x5e0e('0x44')][_0x5e0e('0x5c')]=_0x16526c['id'];if(_0x3e574b[_0x5e0e('0x3b')][_0x5e0e('0x45')]){_0x19a943[_0x5e0e('0x44')]=_['merge'](_0x19a943[_0x5e0e('0x44')],{'$or':_['map'](_0x19a943['attributes'],function(_0x4eb493){var _0x576712={};_0x576712[_0x4eb493]={'$like':'%'+_0x3e574b[_0x5e0e('0x3b')][_0x5e0e('0x45')]+'%'};return _0x576712;})});}_0x19a943=_[_0x5e0e('0x46')]({},_0x19a943,_0x3e574b[_0x5e0e('0x47')]);return db[_0x5e0e('0x5f')][_0x5e0e('0x26')]({'where':_0x19a943[_0x5e0e('0x44')]})[_0x5e0e('0x2b')](function(_0x108779){_0x215055[_0x5e0e('0x26')]=_0x108779;if(_0x3e574b[_0x5e0e('0x3b')][_0x5e0e('0x49')]){_0x19a943[_0x5e0e('0x4a')]=[{'all':!![]}];}return db[_0x5e0e('0x5f')]['findAll'](_0x19a943);})[_0x5e0e('0x2b')](function(_0x22feb3){_0x215055['rows']=_0x22feb3;return _0x215055;});}})['then'](respondWithFilteredResult(_0x227516,_0x19a943))[_0x5e0e('0x4c')](handleError(_0x227516,null));};exports[_0x5e0e('0x61')]=function(_0x4d7391,_0x578348,_0x1e97ce){return db[_0x5e0e('0x48')][_0x5e0e('0x50')]({'where':{'id':_0x4d7391[_0x5e0e('0x4e')]['id']}})[_0x5e0e('0x2b')](handleEntityNotFound(_0x578348,null))['then'](function(_0x4ac936){if(_0x4ac936){return _0x4ac936[_0x5e0e('0x61')](_0x4d7391[_0x5e0e('0x3b')][_0x5e0e('0x62')]);}})[_0x5e0e('0x2b')](respondWithStatusCode(_0x578348,null))['catch'](handleError(_0x578348,null));};exports['addContacts']=function(_0x510726,_0x1aa68a,_0x1d0770){return db['CmList'][_0x5e0e('0x50')]({'where':{'id':_0x510726[_0x5e0e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1aa68a,null))['then'](function(_0x17aedb){if(_0x17aedb){var _0x2b2828=[];var _0x527475={'success':[],'errors':[]};return db[_0x5e0e('0x63')][_0x5e0e('0x5a')]()['then'](function(_0x321275){if(_0x510726[_0x5e0e('0x52')]['tags']&&_[_0x5e0e('0x64')](_0x510726['body'][_0x5e0e('0x65')])){if(_0x510726['body'][_0x5e0e('0x65')][_0x5e0e('0x4f')]){_0x510726[_0x5e0e('0x52')][_0x5e0e('0x65')]=_0x510726[_0x5e0e('0x52')][_0x5e0e('0x65')][_0x5e0e('0x66')](';')+';';}else{_0x510726[_0x5e0e('0x52')][_0x5e0e('0x65')]=null;}}else{_0x510726[_0x5e0e('0x52')][_0x5e0e('0x65')]=null;}if(_0x510726[_0x5e0e('0x52')]&&_[_0x5e0e('0x64')](_0x510726[_0x5e0e('0x52')])){for(var _0x4b9b86=0x0;_0x4b9b86<_0x510726['body'][_0x5e0e('0x4f')];_0x4b9b86+=0x1){_0x510726[_0x5e0e('0x52')][_0x4b9b86][_0x5e0e('0x5c')]=_0x510726[_0x5e0e('0x4e')]['id'];_0x2b2828['push'](_0x510726['body'][_0x4b9b86]);}return BPromise[_0x5e0e('0x67')](_0x2b2828,function(_0x2242e7){return db[_0x5e0e('0x63')][_0x5e0e('0x51')](_[_0x5e0e('0x68')](_0x2242e7,[_0x5e0e('0x62'),'id'])||{},{'fields':_[_0x5e0e('0x3a')](_0x321275),'raw':!![]})['then'](function(_0x5b1a8e){_0x527475[_0x5e0e('0x69')][_0x5e0e('0x6a')](_0x5b1a8e['dataValues']);})['catch'](function(_0x494edd){_0x527475[_0x5e0e('0x6b')]['push']({'data':_0x2242e7,'error':_0x494edd['message']});});})[_0x5e0e('0x2b')](function(_0x42dc44){return _0x527475;})[_0x5e0e('0x4c')](function(_0x7474a0){return _0x7474a0;});}else{_0x1aa68a[_0x5e0e('0x21')](0x190)[_0x5e0e('0x22')]({'message':_0x5e0e('0x6c')});}});}})[_0x5e0e('0x2b')](respondWithResult(_0x1aa68a,null))[_0x5e0e('0x4c')](handleError(_0x1aa68a,null));};exports[_0x5e0e('0x6d')]=function(_0x1caf5c,_0x947a2b,_0x3aecd2){var _0x41510c;return db[_0x5e0e('0x48')][_0x5e0e('0x50')]({'where':{'id':_0x1caf5c[_0x5e0e('0x4e')]['id']},'include':[{'model':db[_0x5e0e('0x6e')],'as':'CustomFields'}]})[_0x5e0e('0x2b')](handleEntityNotFound(_0x947a2b,null))[_0x5e0e('0x2b')](function(_0x2aeedc){if(_0x2aeedc){_0x41510c=_0x2aeedc;return db['CmContact']['rawAttributes'];}})[_0x5e0e('0x2b')](function(_0x2dcd7c){if(_0x2dcd7c){var _0xaf865f={};var _0x46b8f4={};_0x46b8f4[_0x5e0e('0x39')]=_[_0x5e0e('0x6f')](_[_0x5e0e('0x3a')](_0x2dcd7c),_[_0x5e0e('0x34')](_0x41510c['CustomFields'],function(_0x3c0ab6){return util['format'](_0x5e0e('0x70'),_0x3c0ab6['id']);}));_0x46b8f4['query']=_['keys'](_0x1caf5c['query']);_0x46b8f4[_0x5e0e('0x3c')]=_[_0x5e0e('0x3d')](_0x46b8f4[_0x5e0e('0x39')],_0x46b8f4[_0x5e0e('0x3b')]);_0xaf865f[_0x5e0e('0x3e')]=_[_0x5e0e('0x3d')](_0x46b8f4[_0x5e0e('0x39')],qs[_0x5e0e('0x3f')](_0x1caf5c[_0x5e0e('0x3b')][_0x5e0e('0x3f')]));_0xaf865f[_0x5e0e('0x3e')]=_0xaf865f['attributes']['length']?_0xaf865f[_0x5e0e('0x3e')]:_0x46b8f4[_0x5e0e('0x39')];if(!_0x1caf5c[_0x5e0e('0x3b')][_0x5e0e('0x40')]('nolimit')){_0xaf865f['limit']=qs[_0x5e0e('0x25')](_0x1caf5c['query'][_0x5e0e('0x25')]);_0xaf865f[_0x5e0e('0x23')]=qs['offset'](_0x1caf5c[_0x5e0e('0x3b')][_0x5e0e('0x23')]);}_0xaf865f[_0x5e0e('0x42')]=qs[_0x5e0e('0x43')](_0x1caf5c[_0x5e0e('0x3b')]['sort']);_0xaf865f['where']=qs[_0x5e0e('0x3c')](_[_0x5e0e('0x60')](_0x1caf5c[_0x5e0e('0x3b')],_0x46b8f4[_0x5e0e('0x3c')]));_0xaf865f[_0x5e0e('0x71')]=!![];if(_0x1caf5c[_0x5e0e('0x3b')][_0x5e0e('0x45')]){_0xaf865f[_0x5e0e('0x44')]=_[_0x5e0e('0x46')](_0xaf865f[_0x5e0e('0x44')],{'$or':_[_0x5e0e('0x34')](_0xaf865f[_0x5e0e('0x3e')],function(_0x5b258d){var _0x2a6ae5={};_0x2a6ae5[_0x5b258d]={'$like':'%'+_0x1caf5c[_0x5e0e('0x3b')][_0x5e0e('0x45')]+'%'};return _0x2a6ae5;})});}_0xaf865f=_[_0x5e0e('0x46')]({},_0xaf865f,_0x1caf5c['options']);return _0x41510c[_0x5e0e('0x6d')](_0xaf865f);}})[_0x5e0e('0x2b')](respondWithResult(_0x947a2b,null))['catch'](handleError(_0x947a2b,null));};exports[_0x5e0e('0x72')]=function(_0x254b48,_0xd3d1da,_0x2c81e3){var _0x5df3e7;return db['CmList'][_0x5e0e('0x50')]({'where':{'id':_0x254b48[_0x5e0e('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x5e0e('0x73')}]})['then'](handleEntityNotFound(_0xd3d1da,null))['then'](function(_0x2a4413){if(_0x2a4413){_0x5df3e7=_0x2a4413;return db[_0x5e0e('0x63')][_0x5e0e('0x35')];}})[_0x5e0e('0x2b')](function(_0x45f6e0){if(_0x45f6e0){var _0x4d9d9a={};var _0x807258={};_0x807258[_0x5e0e('0x39')]=_[_0x5e0e('0x6f')](_[_0x5e0e('0x3a')](_0x45f6e0),_[_0x5e0e('0x34')](_0x5df3e7[_0x5e0e('0x73')],function(_0x593a46){return util['format'](_0x5e0e('0x70'),_0x593a46['id']);}));_0x807258[_0x5e0e('0x3b')]=_['keys'](_0x254b48[_0x5e0e('0x3b')]);_0x807258['filters']=_[_0x5e0e('0x3d')](_0x807258[_0x5e0e('0x39')],_0x807258[_0x5e0e('0x3b')]);_0x4d9d9a['attributes']=_[_0x5e0e('0x3d')](_0x807258[_0x5e0e('0x39')],qs['fields'](_0x254b48[_0x5e0e('0x3b')][_0x5e0e('0x3f')]));_0x4d9d9a[_0x5e0e('0x3e')]=_0x4d9d9a[_0x5e0e('0x3e')]['length']?_0x4d9d9a[_0x5e0e('0x3e')]:_0x807258[_0x5e0e('0x39')];if(!_0x254b48[_0x5e0e('0x3b')][_0x5e0e('0x40')](_0x5e0e('0x41'))){_0x4d9d9a[_0x5e0e('0x25')]=qs['limit'](_0x254b48[_0x5e0e('0x3b')]['limit']);_0x4d9d9a[_0x5e0e('0x23')]=qs[_0x5e0e('0x23')](_0x254b48[_0x5e0e('0x3b')][_0x5e0e('0x23')]);}_0x4d9d9a[_0x5e0e('0x42')]=qs['sort'](_0x254b48['query'][_0x5e0e('0x43')]);_0x4d9d9a[_0x5e0e('0x44')]=qs[_0x5e0e('0x3c')](_[_0x5e0e('0x60')](_0x254b48['query'],_0x807258[_0x5e0e('0x3c')]));_0x4d9d9a[_0x5e0e('0x71')]=!![];if(_0x254b48[_0x5e0e('0x3b')][_0x5e0e('0x45')]){_0x4d9d9a[_0x5e0e('0x44')]=_[_0x5e0e('0x46')](_0x4d9d9a[_0x5e0e('0x44')],{'$or':_[_0x5e0e('0x34')](_0x4d9d9a[_0x5e0e('0x3e')],function(_0x4ea896){var _0x281372={};_0x281372[_0x4ea896]={'$like':'%'+_0x254b48[_0x5e0e('0x3b')]['filter']+'%'};return _0x281372;})});}_0x4d9d9a=_[_0x5e0e('0x46')]({},_0x4d9d9a,_0x254b48[_0x5e0e('0x47')]);return _0x5df3e7[_0x5e0e('0x6d')](_0x4d9d9a);}})[_0x5e0e('0x2b')](function(_0x4f54cb){if(!_['isEmpty'](_0x4f54cb)){var _0x40382f=toCsv(_0x4f54cb);var _0x2d23ba=Date['now']();fs[_0x5e0e('0x74')](util[_0x5e0e('0x75')](_0x5e0e('0x76'),_0x5df3e7['id'],_0x2d23ba),_0x40382f);_0xd3d1da[_0x5e0e('0x77')](_0x5e0e('0x78'),_0x5e0e('0x79')+util[_0x5e0e('0x75')](_0x5e0e('0x7a'),_0x5df3e7['id'],_0x2d23ba));_0xd3d1da[_0x5e0e('0x77')](_0x5e0e('0x7b'),'text/csv');return _0xd3d1da[_0x5e0e('0x7c')](util[_0x5e0e('0x75')](_0x5e0e('0x76'),_0x5df3e7['id'],_0x2d23ba));}else{return _0xd3d1da[_0x5e0e('0x20')](0xcc);}})['catch'](handleError(_0xd3d1da,null));};exports['addCustomField']=function(_0x4ad81c,_0x126112,_0x17333d){var _0x10b5f7;delete _0x4ad81c[_0x5e0e('0x52')]['id'];return db[_0x5e0e('0x48')][_0x5e0e('0x5e')]({'where':{'id':_0x4ad81c[_0x5e0e('0x4e')]['id']}})[_0x5e0e('0x2b')](handleEntityNotFound(_0x126112,null))['then'](function(_0x4ddee2){if(_0x4ddee2){return db[_0x5e0e('0x7d')][_0x5e0e('0x7e')](function(_0x5b85b0){return db[_0x5e0e('0x6e')][_0x5e0e('0x51')](_0x4ad81c[_0x5e0e('0x52')],{'transaction':_0x5b85b0})['then'](function(_0x5f4a23){_0x10b5f7=_0x5f4a23;return _0x4ddee2['addCustomFields'](_0x5f4a23,{'transaction':_0x5b85b0});})['then'](function(){var _0x3374b6={'type':db['Sequelize'][_0x5e0e('0x7f')],'transaction':_0x5b85b0};switch(_0x4ad81c['body']['type']){case _0x5e0e('0x80'):_0x3374b6[_0x5e0e('0x37')]=db[_0x5e0e('0x81')][_0x5e0e('0x7f')];break;case _0x5e0e('0x82'):_0x3374b6[_0x5e0e('0x37')]=db[_0x5e0e('0x81')][_0x5e0e('0x83')];break;case _0x5e0e('0x84'):_0x3374b6[_0x5e0e('0x37')]=db[_0x5e0e('0x81')][_0x5e0e('0x85')];_0x3374b6['defaultValue']=![];break;default:}return db[_0x5e0e('0x7d')][_0x5e0e('0x86')]['addColumn']('cm_contacts',util[_0x5e0e('0x75')]('cf_%s',_0x10b5f7['id']),_0x3374b6);})[_0x5e0e('0x2b')](function(){return _0x10b5f7;});});}})[_0x5e0e('0x2b')](respondWithResult(_0x126112,null))['catch'](handleError(_0x126112,null));};exports[_0x5e0e('0x87')]=function(_0x248655,_0x2d1b43,_0x1ab53f){var _0x3ef395={};var _0x52e22e={};var _0x776480;var _0x2b2f84;return db[_0x5e0e('0x48')]['findOne']({'where':{'id':_0x248655[_0x5e0e('0x4e')]['id']}})[_0x5e0e('0x2b')](handleEntityNotFound(_0x2d1b43,null))[_0x5e0e('0x2b')](function(_0x24f025){if(_0x24f025){_0x776480=_0x24f025;_0x52e22e[_0x5e0e('0x39')]=_['keys'](db[_0x5e0e('0x6e')][_0x5e0e('0x35')]);_0x52e22e[_0x5e0e('0x3b')]=_[_0x5e0e('0x3a')](_0x248655['query']);_0x52e22e[_0x5e0e('0x3c')]=_[_0x5e0e('0x3d')](_0x52e22e[_0x5e0e('0x39')],_0x52e22e['query']);_0x3ef395['attributes']=_[_0x5e0e('0x3d')](_0x52e22e['model'],qs[_0x5e0e('0x3f')](_0x248655['query'][_0x5e0e('0x3f')]));_0x3ef395[_0x5e0e('0x3e')]=_0x3ef395[_0x5e0e('0x3e')]['length']?_0x3ef395['attributes']:_0x52e22e['model'];_0x3ef395['order']=qs[_0x5e0e('0x43')](_0x248655['query'][_0x5e0e('0x43')]);_0x3ef395['where']=qs[_0x5e0e('0x3c')](_[_0x5e0e('0x60')](_0x248655[_0x5e0e('0x3b')],_0x52e22e[_0x5e0e('0x3c')]));_0x3ef395[_0x5e0e('0x44')]=_['merge'](_0x3ef395['where'],{'$or':[{'ListId':_0x24f025['id']},{'ListId':null}]});if(_0x248655[_0x5e0e('0x3b')][_0x5e0e('0x45')]){_0x3ef395[_0x5e0e('0x44')]=_[_0x5e0e('0x46')](_0x3ef395[_0x5e0e('0x44')],{'$or':_[_0x5e0e('0x34')](_0x3ef395[_0x5e0e('0x3e')],function(_0x5b5271){var _0x1c782f={};_0x1c782f[_0x5b5271]={'$like':'%'+_0x248655['query']['filter']+'%'};return _0x1c782f;})});}_0x3ef395=_[_0x5e0e('0x46')]({},_0x3ef395,_0x248655[_0x5e0e('0x47')]);return db['CmCustomField'][_0x5e0e('0x88')](_0x3ef395);}})['then'](respondWithResult(_0x2d1b43,null))[_0x5e0e('0x4c')](handleError(_0x2d1b43,null));};exports[_0x5e0e('0x89')]=function(_0x2ce8f1,_0x75555d,_0x4c6aac){return db[_0x5e0e('0x48')][_0x5e0e('0x50')]({'where':{'id':_0x2ce8f1[_0x5e0e('0x4e')]['id']}})[_0x5e0e('0x2b')](handleEntityNotFound(_0x75555d,null))[_0x5e0e('0x2b')](function(_0x4747c1){if(_0x4747c1){return _0x4747c1[_0x5e0e('0x89')](_0x2ce8f1[_0x5e0e('0x52')][_0x5e0e('0x62')],_[_0x5e0e('0x68')](_0x2ce8f1['body'],[_0x5e0e('0x62'),'id'])||{})[_0x5e0e('0x8a')](function(_0x17aaf7){for(var _0x49a7d6=0x0;_0x49a7d6<_0x2ce8f1[_0x5e0e('0x52')]['ids'][_0x5e0e('0x4f')];_0x49a7d6+=0x1){socket[_0x5e0e('0x8b')](_0x5e0e('0x8c'),{'UserId':_0x2ce8f1[_0x5e0e('0x52')]['ids'][_0x49a7d6],'CmListId':_0x2ce8f1[_0x5e0e('0x4e')]['id']});}return _0x17aaf7;});}})['then'](respondWithResult(_0x75555d,null))[_0x5e0e('0x4c')](handleError(_0x75555d,null));};exports['removeAgents']=function(_0xf2917a,_0x37fb21,_0x281172){return db[_0x5e0e('0x48')][_0x5e0e('0x50')]({'where':{'id':_0xf2917a[_0x5e0e('0x4e')]['id']}})[_0x5e0e('0x2b')](handleEntityNotFound(_0x37fb21,null))[_0x5e0e('0x2b')](function(_0x9a2929){if(_0x9a2929){return _0x9a2929[_0x5e0e('0x8d')](_0xf2917a['query'][_0x5e0e('0x62')])['then'](function(){if(_[_0x5e0e('0x64')](_0xf2917a[_0x5e0e('0x3b')][_0x5e0e('0x62')])){for(var _0x1993d1=0x0;_0x1993d1<_0xf2917a[_0x5e0e('0x3b')][_0x5e0e('0x62')][_0x5e0e('0x4f')];_0x1993d1+=0x1){socket[_0x5e0e('0x8b')]('userCmList:remove',{'UserId':Number(_0xf2917a['query'][_0x5e0e('0x62')][_0x1993d1]),'CmListId':Number(_0xf2917a[_0x5e0e('0x4e')]['id'])});}}else{socket['emit'](_0x5e0e('0x8e'),{'UserId':Number(_0xf2917a[_0x5e0e('0x3b')][_0x5e0e('0x62')]),'CmListId':Number(_0xf2917a['params']['id'])});}});}})[_0x5e0e('0x2b')](respondWithStatusCode(_0x37fb21,null))[_0x5e0e('0x4c')](handleError(_0x37fb21,null));};exports[_0x5e0e('0x8f')]=function(_0x276f84,_0x2b4552,_0x5e2e9e){var _0xeb52a1={};var _0x1cb747={};var _0x14f36f;var _0x141170;return db[_0x5e0e('0x48')][_0x5e0e('0x5e')]({'where':{'id':_0x276f84[_0x5e0e('0x4e')]['id']}})[_0x5e0e('0x2b')](handleEntityNotFound(_0x2b4552,null))[_0x5e0e('0x2b')](function(_0xe634d9){if(_0xe634d9){_0x14f36f=_0xe634d9;_0x1cb747[_0x5e0e('0x39')]=_['keys'](db[_0x5e0e('0x90')]['rawAttributes']);_0x1cb747['query']=_[_0x5e0e('0x3a')](_0x276f84[_0x5e0e('0x3b')]);_0x1cb747[_0x5e0e('0x3c')]=_[_0x5e0e('0x3d')](_0x1cb747[_0x5e0e('0x39')],_0x1cb747[_0x5e0e('0x3b')]);_0xeb52a1['attributes']=_['intersection'](_0x1cb747[_0x5e0e('0x39')],qs[_0x5e0e('0x3f')](_0x276f84[_0x5e0e('0x3b')][_0x5e0e('0x3f')]));_0xeb52a1['attributes']=_0xeb52a1[_0x5e0e('0x3e')][_0x5e0e('0x4f')]?_0xeb52a1[_0x5e0e('0x3e')]:_0x1cb747[_0x5e0e('0x39')];_0xeb52a1[_0x5e0e('0x42')]=qs['sort'](_0x276f84[_0x5e0e('0x3b')][_0x5e0e('0x43')]);_0xeb52a1[_0x5e0e('0x44')]=qs[_0x5e0e('0x3c')](_['pick'](_0x276f84['query'],_0x1cb747[_0x5e0e('0x3c')]));if(_0x276f84['query'][_0x5e0e('0x45')]){_0xeb52a1['where']=_[_0x5e0e('0x46')](_0xeb52a1[_0x5e0e('0x44')],{'$or':_[_0x5e0e('0x34')](_0xeb52a1[_0x5e0e('0x3e')],function(_0x3fb79c){var _0x51bfed={};_0x51bfed[_0x3fb79c]={'$like':'%'+_0x276f84['query'][_0x5e0e('0x45')]+'%'};return _0x51bfed;})});}_0xeb52a1=_[_0x5e0e('0x46')]({},_0xeb52a1,_0x276f84[_0x5e0e('0x47')]);return _0x14f36f[_0x5e0e('0x8f')](_0xeb52a1);}})['then'](function(_0x25e775){if(_0x25e775){_0x141170=_0x25e775[_0x5e0e('0x4f')];if(!_0x276f84['query'][_0x5e0e('0x40')](_0x5e0e('0x41'))){_0xeb52a1[_0x5e0e('0x25')]=qs[_0x5e0e('0x25')](_0x276f84['query'][_0x5e0e('0x25')]);_0xeb52a1[_0x5e0e('0x23')]=qs[_0x5e0e('0x23')](_0x276f84[_0x5e0e('0x3b')][_0x5e0e('0x23')]);}return _0x14f36f[_0x5e0e('0x8f')](_0xeb52a1);}})['then'](function(_0x77b022){if(_0x77b022){return _0x77b022?{'count':_0x141170,'rows':_0x77b022}:null;}})[_0x5e0e('0x2b')](respondWithResult(_0x2b4552,null))[_0x5e0e('0x4c')](handleError(_0x2b4552,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index e581635..c9519e4 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 _0x7a0d=['exports','../../mysqldb','CmList','setMaxListeners','update','remove','emit','hook'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x7a0d,0x1d9));var _0xd7a0=function(_0x40cb69,_0x37f2ba){_0x40cb69=_0x40cb69-0x0;var _0x55e036=_0x7a0d[_0x40cb69];return _0x55e036;};'use strict';var EventEmitter=require('events');var CmList=require(_0xd7a0('0x0'))['db'][_0xd7a0('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0xd7a0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd7a0('0x3'),'afterDestroy':_0xd7a0('0x4')};function emitEvent(_0x27e690){return function(_0x4c1dff,_0x37c8fe,_0xfffb8f){CmListEvents[_0xd7a0('0x5')](_0x27e690+':'+_0x4c1dff['id'],_0x4c1dff);CmListEvents[_0xd7a0('0x5')](_0x27e690,_0x4c1dff);_0xfffb8f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xd7a0('0x6')](e,emitEvent(event));}}module[_0xd7a0('0x7')]=CmListEvents; \ No newline at end of file +var _0x0768=['../../mysqldb','CmList','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x11f0d4,_0x54c4dc){var _0x260d1f=function(_0x1ee6a8){while(--_0x1ee6a8){_0x11f0d4['push'](_0x11f0d4['shift']());}};_0x260d1f(++_0x54c4dc);}(_0x0768,0xfc));var _0x8076=function(_0x1bd8aa,_0x170834){_0x1bd8aa=_0x1bd8aa-0x0;var _0x3fdbe0=_0x0768[_0x1bd8aa];return _0x3fdbe0;};'use strict';var EventEmitter=require('events');var CmList=require(_0x8076('0x0'))['db'][_0x8076('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x8076('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8076('0x3'),'afterDestroy':_0x8076('0x4')};function emitEvent(_0x242384){return function(_0x27fb1d,_0x28eb30,_0x155968){CmListEvents[_0x8076('0x5')](_0x242384+':'+_0x27fb1d['id'],_0x27fb1d);CmListEvents[_0x8076('0x5')](_0x242384,_0x27fb1d);_0x155968(null);};}for(var e in events){if(events[_0x8076('0x6')](e)){var event=events[e];CmList[_0x8076('0x7')](e,emitEvent(event));}}module[_0x8076('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 2f19578..5e02450 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 _0xd200=['exports','define','CmList','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./cmList.attributes'];(function(_0x3a6f2a,_0x5d0da8){var _0x8c3ed8=function(_0x213cc2){while(--_0x213cc2){_0x3a6f2a['push'](_0x3a6f2a['shift']());}};_0x8c3ed8(++_0x5d0da8);}(_0xd200,0x1a5));var _0x0d20=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xd200[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require('lodash');var util=require(_0x0d20('0x0'));var logger=require(_0x0d20('0x1'))(_0x0d20('0x2'));var moment=require(_0x0d20('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d20('0x4'));var rimraf=require(_0x0d20('0x5'));var config=require(_0x0d20('0x6'));var attributes=require(_0x0d20('0x7'));module[_0x0d20('0x8')]=function(_0x4ea707,_0x501b7a){return _0x4ea707[_0x0d20('0x9')](_0x0d20('0xa'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65f8=['../../config/logger','moment','bluebird','../../config/environment','exports','define','cm_lists','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x65f8,0x139));var _0x865f=function(_0x390083,_0x31ba26){_0x390083=_0x390083-0x0;var _0x41a4db=_0x65f8[_0x390083];return _0x41a4db;};'use strict';var _=require(_0x865f('0x0'));var util=require(_0x865f('0x1'));var logger=require(_0x865f('0x2'))('api');var moment=require(_0x865f('0x3'));var BPromise=require(_0x865f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x865f('0x5'));var attributes=require('./cmList.attributes');module[_0x865f('0x6')]=function(_0x4cff33,_0x2e6818){return _0x4cff33[_0x865f('0x7')]('CmList',attributes,{'tableName':_0x865f('0x8'),'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 1916bd9..785769e 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 _0x71ee=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x13b1b4,_0x47f759){var _0x286225=function(_0x23d06b){while(--_0x23d06b){_0x13b1b4['push'](_0x13b1b4['shift']());}};_0x286225(++_0x47f759);}(_0x71ee,0x13b));var _0xe71e=function(_0x2f4de8,_0x313395){_0x2f4de8=_0x2f4de8-0x0;var _0x4569cb=_0x71ee[_0x2f4de8];return _0x4569cb;};'use strict';var _=require(_0xe71e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe71e('0x1'));var rs=require(_0xe71e('0x2'));var fs=require('fs');var Redis=require(_0xe71e('0x3'));var db=require(_0xe71e('0x4'))['db'];var utils=require(_0xe71e('0x5'));var logger=require('../../config/logger')(_0xe71e('0x6'));var config=require(_0xe71e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe71e('0x8')][_0xe71e('0x9')]({'port':0x232a});config[_0xe71e('0xa')]=_[_0xe71e('0xb')](config['redis'],{'host':_0xe71e('0xc'),'port':0x18eb});var socket=require(_0xe71e('0xd'))(new Redis(config[_0xe71e('0xa')]));require(_0xe71e('0xe'))[_0xe71e('0xf')](socket);function respondWithRpcPromise(_0x333c42,_0x33bc09,_0x1d4a79){return new BPromise(function(_0x34e277,_0x27e4af){return client[_0xe71e('0x10')](_0x333c42,_0x1d4a79)[_0xe71e('0x11')](function(_0xac782a){logger[_0xe71e('0x12')]('CmList,\x20%s,\x20%s',_0x33bc09,_0xe71e('0x13'));logger[_0xe71e('0x14')](_0xe71e('0x15'),_0x33bc09,_0xe71e('0x13'),JSON[_0xe71e('0x16')](_0xac782a));if(_0xac782a[_0xe71e('0x17')]){if(_0xac782a['error'][_0xe71e('0x18')]===0x1f4){logger['error'](_0xe71e('0x19'),_0x33bc09,_0xac782a[_0xe71e('0x17')][_0xe71e('0x1a')]);return _0x27e4af(_0xac782a[_0xe71e('0x17')][_0xe71e('0x1a')]);}logger[_0xe71e('0x17')](_0xe71e('0x19'),_0x33bc09,_0xac782a[_0xe71e('0x17')][_0xe71e('0x1a')]);return _0x34e277(_0xac782a['error']['message']);}else{logger['info'](_0xe71e('0x19'),_0x33bc09,_0xe71e('0x13'));_0x34e277(_0xac782a[_0xe71e('0x1b')][_0xe71e('0x1a')]);}})[_0xe71e('0x1c')](function(_0x2ff1fe){logger[_0xe71e('0x17')]('CmList,\x20%s,\x20%s',_0x33bc09,_0x2ff1fe);_0x27e4af(_0x2ff1fe);});});} \ No newline at end of file +var _0xbb65=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x106c9f,_0x5b1429){var _0x4f3ebc=function(_0x5b783b){while(--_0x5b783b){_0x106c9f['push'](_0x106c9f['shift']());}};_0x4f3ebc(++_0x5b1429);}(_0xbb65,0x116));var _0x5bb6=function(_0xd3b0ae,_0x383ab0){_0xd3b0ae=_0xd3b0ae-0x0;var _0x565a2e=_0xbb65[_0xd3b0ae];return _0x565a2e;};'use strict';var _=require(_0x5bb6('0x0'));var util=require(_0x5bb6('0x1'));var moment=require(_0x5bb6('0x2'));var BPromise=require(_0x5bb6('0x3'));var rs=require(_0x5bb6('0x4'));var fs=require('fs');var Redis=require(_0x5bb6('0x5'));var db=require(_0x5bb6('0x6'))['db'];var utils=require(_0x5bb6('0x7'));var logger=require(_0x5bb6('0x8'))('rpc');var config=require(_0x5bb6('0x9'));var jayson=require(_0x5bb6('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x5bb6('0xb')]=_['defaults'](config['redis'],{'host':_0x5bb6('0xc'),'port':0x18eb});var socket=require(_0x5bb6('0xd'))(new Redis(config[_0x5bb6('0xb')]));require(_0x5bb6('0xe'))[_0x5bb6('0xf')](socket);function respondWithRpcPromise(_0x1e1e58,_0x1b9242,_0x51cfee){return new BPromise(function(_0x3a6ffa,_0x108454){return client[_0x5bb6('0x10')](_0x1e1e58,_0x51cfee)[_0x5bb6('0x11')](function(_0x105306){logger[_0x5bb6('0x12')](_0x5bb6('0x13'),_0x1b9242,_0x5bb6('0x14'));logger[_0x5bb6('0x15')](_0x5bb6('0x16'),_0x1b9242,_0x5bb6('0x14'),JSON[_0x5bb6('0x17')](_0x105306));if(_0x105306['error']){if(_0x105306[_0x5bb6('0x18')][_0x5bb6('0x19')]===0x1f4){logger[_0x5bb6('0x18')](_0x5bb6('0x13'),_0x1b9242,_0x105306['error']['message']);return _0x108454(_0x105306['error']['message']);}logger[_0x5bb6('0x18')](_0x5bb6('0x13'),_0x1b9242,_0x105306[_0x5bb6('0x18')][_0x5bb6('0x1a')]);return _0x3a6ffa(_0x105306[_0x5bb6('0x18')][_0x5bb6('0x1a')]);}else{logger[_0x5bb6('0x12')](_0x5bb6('0x13'),_0x1b9242,_0x5bb6('0x14'));_0x3a6ffa(_0x105306[_0x5bb6('0x1b')][_0x5bb6('0x1a')]);}})['catch'](function(_0x59b959){logger[_0x5bb6('0x18')](_0x5bb6('0x13'),_0x1b9242,_0x59b959);_0x108454(_0x59b959);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index d17c746..386a839 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 _0xd634=['remove','removeListener','register','length','save'];(function(_0x16b51e,_0x30cb17){var _0x27b91a=function(_0x131411){while(--_0x131411){_0x16b51e['push'](_0x16b51e['shift']());}};_0x27b91a(++_0x30cb17);}(_0xd634,0xf4));var _0x4d63=function(_0x246115,_0x398123){_0x246115=_0x246115-0x0;var _0x385878=_0xd634[_0x246115];return _0x385878;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x4d63('0x0'),_0x4d63('0x1'),'update'];function createListener(_0x4b0edc,_0x2034ac){return function(_0x42e27c){_0x2034ac['emit'](_0x4b0edc,_0x42e27c);};}function removeListener(_0x4f99ac,_0x2b8d62){return function(){CmListEvents[_0x4d63('0x2')](_0x4f99ac,_0x2b8d62);};}exports[_0x4d63('0x3')]=function(_0x3b573c){for(var _0x3f188d=0x0,_0x381601=events[_0x4d63('0x4')];_0x3f188d<_0x381601;_0x3f188d++){var _0x6a60f4=events[_0x3f188d];var _0x49c1da=createListener('cmList:'+_0x6a60f4,_0x3b573c);CmListEvents['on'](_0x6a60f4,_0x49c1da);}}; \ No newline at end of file +var _0x979e=['update','emit','register','length','cmList:','./cmList.events','save','remove'];(function(_0x5879ce,_0x257a94){var _0x692f46=function(_0x5457e9){while(--_0x5457e9){_0x5879ce['push'](_0x5879ce['shift']());}};_0x692f46(++_0x257a94);}(_0x979e,0x195));var _0xe979=function(_0x5b0dad,_0x1d9a78){_0x5b0dad=_0x5b0dad-0x0;var _0x1b3dd7=_0x979e[_0x5b0dad];return _0x1b3dd7;};'use strict';var CmListEvents=require(_0xe979('0x0'));var events=[_0xe979('0x1'),_0xe979('0x2'),_0xe979('0x3')];function createListener(_0x5ce889,_0x10fb90){return function(_0x47321a){_0x10fb90[_0xe979('0x4')](_0x5ce889,_0x47321a);};}function removeListener(_0x3b4b06,_0x2d62dd){return function(){CmListEvents['removeListener'](_0x3b4b06,_0x2d62dd);};}exports[_0xe979('0x5')]=function(_0x580e20){for(var _0x1a0d35=0x0,_0x13a9ee=events[_0xe979('0x6')];_0x1a0d35<_0x13a9ee;_0x1a0d35++){var _0xc63524=events[_0x1a0d35];var _0xc79c06=createListener(_0xe979('0x7')+_0xc63524,_0x580e20);CmListEvents['on'](_0xc63524,_0xc79c06);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index d80b94f..92db9bf 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 _0x9a19=['delete','destroy','removeDispositions','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/:id','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addCustomField','addAgents','put'];(function(_0x1c823a,_0x77515f){var _0x4630cf=function(_0x2775b1){while(--_0x2775b1){_0x1c823a['push'](_0x1c823a['shift']());}};_0x4630cf(++_0x77515f);}(_0x9a19,0x114));var _0x99a1=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x9a19[_0x346737];return _0x1ade2e;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var fs_extra=require(_0x99a1('0x5'));var auth=require(_0x99a1('0x6'));var interaction=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var controller=require(_0x99a1('0x9'));router[_0x99a1('0xa')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xc')]);router[_0x99a1('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x99a1('0xa')](_0x99a1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x99a1('0xa')](_0x99a1('0xe'),auth[_0x99a1('0xb')](),controller[_0x99a1('0xf')]);router[_0x99a1('0xa')]('/:id/contacts',auth[_0x99a1('0xb')](),controller[_0x99a1('0x10')]);router[_0x99a1('0xa')](_0x99a1('0x11'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x12')]);router[_0x99a1('0xa')](_0x99a1('0x13'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x14')]);router[_0x99a1('0xa')](_0x99a1('0x15'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x16')]);router[_0x99a1('0x17')]('/',auth['isAuthenticated'](),controller[_0x99a1('0x18')]);router[_0x99a1('0x17')](_0x99a1('0xe'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x19')]);router[_0x99a1('0x17')](_0x99a1('0x1a'),auth['isAuthenticated'](),controller['addContacts']);router[_0x99a1('0x17')](_0x99a1('0x13'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x1b')]);router[_0x99a1('0x17')](_0x99a1('0x15'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x1c')]);router[_0x99a1('0x1d')](_0x99a1('0xd'),auth[_0x99a1('0xb')](),controller['update']);router[_0x99a1('0x1e')](_0x99a1('0xd'),auth['isAuthenticated'](),controller[_0x99a1('0x1f')]);router['delete'](_0x99a1('0xe'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x20')]);router[_0x99a1('0x1e')]('/:id/users',auth[_0x99a1('0xb')](),controller[_0x99a1('0x21')]);module['exports']=router; \ No newline at end of file +var _0xb903=['getAgents','create','post','/:id/dispositions','addDisposition','addContacts','/:id/fields','addCustomField','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','isAuthenticated','describe','/:id','/:id/contacts','getContacts','getContactsCsv','getCustomFields'];(function(_0x472463,_0xe06173){var _0x42f814=function(_0x46c9f3){while(--_0x46c9f3){_0x472463['push'](_0x472463['shift']());}};_0x42f814(++_0xe06173);}(_0xb903,0x185));var _0x3b90=function(_0x76d9f5,_0x2efdd7){_0x76d9f5=_0x76d9f5-0x0;var _0x2e0b83=_0xb903[_0x76d9f5];return _0x2e0b83;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var fs_extra=require(_0x3b90('0x5'));var auth=require(_0x3b90('0x6'));var interaction=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var controller=require(_0x3b90('0x9'));router[_0x3b90('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router['get']('/describe',auth[_0x3b90('0xc')](),controller[_0x3b90('0xd')]);router[_0x3b90('0xa')](_0x3b90('0xe'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x3b90('0xa')](_0x3b90('0xf'),auth['isAuthenticated'](),controller[_0x3b90('0x10')]);router[_0x3b90('0xa')]('/:id/contacts/csv',auth[_0x3b90('0xc')](),controller[_0x3b90('0x11')]);router[_0x3b90('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x3b90('0x12')]);router['get']('/:id/users',auth[_0x3b90('0xc')](),controller[_0x3b90('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3b90('0x14')]);router[_0x3b90('0x15')](_0x3b90('0x16'),auth[_0x3b90('0xc')](),controller[_0x3b90('0x17')]);router['post']('/:id/contacts',auth[_0x3b90('0xc')](),controller[_0x3b90('0x18')]);router['post'](_0x3b90('0x19'),auth[_0x3b90('0xc')](),controller[_0x3b90('0x1a')]);router[_0x3b90('0x15')]('/:id/users',auth[_0x3b90('0xc')](),controller['addAgents']);router[_0x3b90('0x1b')](_0x3b90('0xe'),auth['isAuthenticated'](),controller[_0x3b90('0x1c')]);router[_0x3b90('0x1d')](_0x3b90('0xe'),auth[_0x3b90('0xc')](),controller[_0x3b90('0x1e')]);router[_0x3b90('0x1d')](_0x3b90('0x16'),auth[_0x3b90('0xc')](),controller[_0x3b90('0x1f')]);router[_0x3b90('0x1d')]('/:id/users',auth[_0x3b90('0xc')](),controller[_0x3b90('0x20')]);module[_0x3b90('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index b418fbd..3639fb1 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 _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x460386,_0x553ec4){var _0x326666=function(_0x1bb173){while(--_0x1bb173){_0x460386['push'](_0x460386['shift']());}};_0x326666(++_0x553ec4);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x456993,_0x245792){var _0x10f21e=function(_0x228457){while(--_0x228457){_0x456993['push'](_0x456993['shift']());}};_0x10f21e(++_0x245792);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('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 9b8538e..8b6b6eb 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 _0xe14d=['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','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring'];(function(_0xea86c3,_0x379478){var _0x5185bd=function(_0x5db032){while(--_0x5db032){_0xea86c3['push'](_0xea86c3['shift']());}};_0x5185bd(++_0x379478);}(_0xe14d,0x1ee));var _0xde14=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xe14d[_0x409353];return _0x4f4b59;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];function respondWithStatusCode(_0x34e28f,_0x29e3ca){_0x29e3ca=_0x29e3ca||0xcc;return function(_0x105f96){if(_0x105f96){return _0x34e28f[_0xde14('0x1b')](_0x29e3ca);}return _0x34e28f[_0xde14('0x1c')](_0x29e3ca)[_0xde14('0x1d')]();};}function respondWithResult(_0x1489e9,_0x54c58b){_0x54c58b=_0x54c58b||0xc8;return function(_0x584959){if(_0x584959){return _0x1489e9[_0xde14('0x1c')](_0x54c58b)[_0xde14('0x1e')](_0x584959);}};}function respondWithFilteredResult(_0x26c1ec,_0x4c86ff){return function(_0x16aa55){if(_0x16aa55){var _0x31adb3=typeof _0x4c86ff[_0xde14('0x1f')]===_0xde14('0x20')&&typeof _0x4c86ff[_0xde14('0x21')]===_0xde14('0x20');var _0x29e243=_0x16aa55[_0xde14('0x22')];var _0x3cc317=_0x31adb3?0x0:_0x4c86ff[_0xde14('0x1f')];var _0x590a8b=_0x31adb3?_0x16aa55[_0xde14('0x22')]:_0x4c86ff[_0xde14('0x1f')]+_0x4c86ff[_0xde14('0x21')];var _0x44ce4c;if(_0x590a8b>=_0x29e243){_0x590a8b=_0x29e243;_0x44ce4c=0xc8;}else{_0x44ce4c=0xce;}_0x26c1ec['status'](_0x44ce4c);return _0x26c1ec[_0xde14('0x23')]('Content-Range',_0x3cc317+'-'+_0x590a8b+'/'+_0x29e243)[_0xde14('0x1e')](_0x16aa55);}return null;};}function patchUpdates(_0x4c24a8){return function(_0xa50687){try{jsonpatch[_0xde14('0x24')](_0xa50687,_0x4c24a8,!![]);}catch(_0x51ee8d){return BPromise[_0xde14('0x25')](_0x51ee8d);}return _0xa50687[_0xde14('0x26')]();};}function saveUpdates(_0x11a4d9,_0x40b648){return function(_0x2dd9e7){if(_0x2dd9e7){return _0x2dd9e7[_0xde14('0x27')](_0x11a4d9)[_0xde14('0x28')](function(_0x475f2f){return _0x475f2f;});}return null;};}function removeEntity(_0xbaa078,_0x8f8033){return function(_0x5ae4c1){if(_0x5ae4c1){return _0x5ae4c1[_0xde14('0x29')]()[_0xde14('0x28')](function(){_0xbaa078[_0xde14('0x1c')](0xcc)[_0xde14('0x1d')]();});}};}function handleEntityNotFound(_0x1bb7be,_0x21ef15){return function(_0x310d75){if(!_0x310d75){_0x1bb7be[_0xde14('0x1b')](0x194);}return _0x310d75;};}function handleError(_0x1618e1,_0x350a78){_0x350a78=_0x350a78||0x1f4;return function(_0x4eff65){logger[_0xde14('0x2a')](_0x4eff65[_0xde14('0x2b')]);if(_0x4eff65[_0xde14('0x2c')]){delete _0x4eff65[_0xde14('0x2c')];}_0x1618e1['status'](_0x350a78)[_0xde14('0x2d')](_0x4eff65);};}exports[_0xde14('0x27')]=function(_0x30c4a8,_0x553cab){if(_0x30c4a8[_0xde14('0x2e')]['id']){delete _0x30c4a8['body']['id'];}return db[_0xde14('0x2f')][_0xde14('0x30')]({'where':{'id':_0x30c4a8[_0xde14('0x31')]['id']}})[_0xde14('0x28')](handleEntityNotFound(_0x553cab,null))[_0xde14('0x28')](saveUpdates(_0x30c4a8[_0xde14('0x2e')],null))[_0xde14('0x28')](respondWithResult(_0x553cab,null))[_0xde14('0x32')](handleError(_0x553cab,null));};exports['destroy']=function(_0xbfc01b,_0xbf49ac){return db['Condition'][_0xde14('0x30')]({'where':{'id':_0xbfc01b['params']['id']}})[_0xde14('0x28')](handleEntityNotFound(_0xbf49ac,null))[_0xde14('0x28')](removeEntity(_0xbf49ac,null))[_0xde14('0x32')](handleError(_0xbf49ac,null));}; \ No newline at end of file +var _0x3140=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','update','then','end','stack','name','send','body','find','params','destroy','Condition','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x21dcdc,_0x4e878c){var _0x20f8ab=function(_0x1aba4f){while(--_0x1aba4f){_0x21dcdc['push'](_0x21dcdc['shift']());}};_0x20f8ab(++_0x4e878c);}(_0x3140,0xaf));var _0x0314=function(_0x323021,_0x30f030){_0x323021=_0x323021-0x0;var _0x52cb3e=_0x3140[_0x323021];return _0x52cb3e;};'use strict';var emlformat=require(_0x0314('0x0'));var rimraf=require(_0x0314('0x1'));var zipdir=require(_0x0314('0x2'));var jsonpatch=require(_0x0314('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0314('0x4'));var Mustache=require(_0x0314('0x5'));var util=require(_0x0314('0x6'));var path=require(_0x0314('0x7'));var sox=require(_0x0314('0x8'));var csv=require(_0x0314('0x9'));var ejs=require(_0x0314('0xa'));var fs=require('fs');var fs_extra=require(_0x0314('0xb'));var _=require(_0x0314('0xc'));var squel=require(_0x0314('0xd'));var crypto=require(_0x0314('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0314('0xf'));var toCsv=require(_0x0314('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0314('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0314('0x11'));var as=require(_0x0314('0x12'));var hardwareService=require(_0x0314('0x13'));var logger=require(_0x0314('0x14'))(_0x0314('0x15'));var utils=require(_0x0314('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0314('0x17'));var db=require(_0x0314('0x18'))['db'];function respondWithStatusCode(_0xd85ddf,_0x4602ec){_0x4602ec=_0x4602ec||0xcc;return function(_0x153077){if(_0x153077){return _0xd85ddf[_0x0314('0x19')](_0x4602ec);}return _0xd85ddf[_0x0314('0x1a')](_0x4602ec)['end']();};}function respondWithResult(_0x1c26ff,_0xbe0b07){_0xbe0b07=_0xbe0b07||0xc8;return function(_0x1316a0){if(_0x1316a0){return _0x1c26ff[_0x0314('0x1a')](_0xbe0b07)[_0x0314('0x1b')](_0x1316a0);}};}function respondWithFilteredResult(_0x398c91,_0x413bfa){return function(_0x3ea356){if(_0x3ea356){var _0x5e460f=typeof _0x413bfa[_0x0314('0x1c')]===_0x0314('0x1d')&&typeof _0x413bfa[_0x0314('0x1e')]==='undefined';var _0x6c48cb=_0x3ea356['count'];var _0x575b68=_0x5e460f?0x0:_0x413bfa[_0x0314('0x1c')];var _0x329679=_0x5e460f?_0x3ea356['count']:_0x413bfa[_0x0314('0x1c')]+_0x413bfa[_0x0314('0x1e')];var _0x583ffa;if(_0x329679>=_0x6c48cb){_0x329679=_0x6c48cb;_0x583ffa=0xc8;}else{_0x583ffa=0xce;}_0x398c91[_0x0314('0x1a')](_0x583ffa);return _0x398c91['set'](_0x0314('0x1f'),_0x575b68+'-'+_0x329679+'/'+_0x6c48cb)[_0x0314('0x1b')](_0x3ea356);}return null;};}function patchUpdates(_0x16d273){return function(_0x77ddfd){try{jsonpatch[_0x0314('0x20')](_0x77ddfd,_0x16d273,!![]);}catch(_0xdfad84){return BPromise['reject'](_0xdfad84);}return _0x77ddfd['save']();};}function saveUpdates(_0x20305b,_0xbd3ad0){return function(_0x1945f8){if(_0x1945f8){return _0x1945f8[_0x0314('0x21')](_0x20305b)[_0x0314('0x22')](function(_0xd7638b){return _0xd7638b;});}return null;};}function removeEntity(_0x58a1c9,_0x3c743e){return function(_0x43fb0e){if(_0x43fb0e){return _0x43fb0e['destroy']()[_0x0314('0x22')](function(){_0x58a1c9[_0x0314('0x1a')](0xcc)[_0x0314('0x23')]();});}};}function handleEntityNotFound(_0x26c6a4,_0x867cf7){return function(_0x3af9d3){if(!_0x3af9d3){_0x26c6a4['sendStatus'](0x194);}return _0x3af9d3;};}function handleError(_0x1a5947,_0x2e0c77){_0x2e0c77=_0x2e0c77||0x1f4;return function(_0x2d636b){logger['error'](_0x2d636b[_0x0314('0x24')]);if(_0x2d636b[_0x0314('0x25')]){delete _0x2d636b['name'];}_0x1a5947['status'](_0x2e0c77)[_0x0314('0x26')](_0x2d636b);};}exports[_0x0314('0x21')]=function(_0x550dc4,_0x1c3dfd){if(_0x550dc4[_0x0314('0x27')]['id']){delete _0x550dc4['body']['id'];}return db['Condition'][_0x0314('0x28')]({'where':{'id':_0x550dc4[_0x0314('0x29')]['id']}})['then'](handleEntityNotFound(_0x1c3dfd,null))[_0x0314('0x22')](saveUpdates(_0x550dc4[_0x0314('0x27')],null))[_0x0314('0x22')](respondWithResult(_0x1c3dfd,null))['catch'](handleError(_0x1c3dfd,null));};exports[_0x0314('0x2a')]=function(_0x37ab90,_0x2ce20c){return db[_0x0314('0x2b')]['find']({'where':{'id':_0x37ab90[_0x0314('0x29')]['id']}})['then'](handleEntityNotFound(_0x2ce20c,null))['then'](removeEntity(_0x2ce20c,null))[_0x0314('0x2c')](handleError(_0x2ce20c,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index adeccbb..f339506 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 _0xf521=['../../config/logger','api','moment','path','rimraf','./condition.attributes','exports','Condition','tools_conditions','util'];(function(_0x575a46,_0x3fbb23){var _0x32fd1a=function(_0x23a395){while(--_0x23a395){_0x575a46['push'](_0x575a46['shift']());}};_0x32fd1a(++_0x3fbb23);}(_0xf521,0x153));var _0x1f52=function(_0x91ff52,_0x2cde3c){_0x91ff52=_0x91ff52-0x0;var _0x37d193=_0xf521[_0x91ff52];return _0x37d193;};'use strict';var _=require('lodash');var util=require(_0x1f52('0x0'));var logger=require(_0x1f52('0x1'))(_0x1f52('0x2'));var moment=require(_0x1f52('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f52('0x4'));var rimraf=require(_0x1f52('0x5'));var config=require('../../config/environment');var attributes=require(_0x1f52('0x6'));module[_0x1f52('0x7')]=function(_0x23f046,_0x589c72){return _0x23f046['define'](_0x1f52('0x8'),attributes,{'tableName':_0x1f52('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x063f=['exports','define','Condition','tools_conditions','util','api','bluebird','path','../../config/environment','./condition.attributes'];(function(_0x77773a,_0x5a7026){var _0x1091a2=function(_0x276af5){while(--_0x276af5){_0x77773a['push'](_0x77773a['shift']());}};_0x1091a2(++_0x5a7026);}(_0x063f,0x1b2));var _0xf063=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0x063f[_0x2a3c4d];return _0x55c390;};'use strict';var _=require('lodash');var util=require(_0xf063('0x0'));var logger=require('../../config/logger')(_0xf063('0x1'));var moment=require('moment');var BPromise=require(_0xf063('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf063('0x3'));var rimraf=require('rimraf');var config=require(_0xf063('0x4'));var attributes=require(_0xf063('0x5'));module[_0xf063('0x6')]=function(_0x490fbd,_0x31a74e){return _0x490fbd[_0xf063('0x7')](_0xf063('0x8'),attributes,{'tableName':_0xf063('0x9'),'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 1562ed9..f28c6a3 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 _0x8866=['Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x223e96,_0xc2b0e1){var _0x2018a9=function(_0x587103){while(--_0x587103){_0x223e96['push'](_0x223e96['shift']());}};_0x2018a9(++_0xc2b0e1);}(_0x8866,0xa4));var _0x6886=function(_0x1aa26d,_0x5d4ac0){_0x1aa26d=_0x1aa26d-0x0;var _0x15d0ec=_0x8866[_0x1aa26d];return _0x15d0ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6886('0x0'));var BPromise=require(_0x6886('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6886('0x2'));var db=require(_0x6886('0x3'))['db'];var utils=require(_0x6886('0x4'));var logger=require(_0x6886('0x5'))(_0x6886('0x6'));var config=require(_0x6886('0x7'));var jayson=require(_0x6886('0x8'));var client=jayson[_0x6886('0x9')][_0x6886('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cc513,_0x7543c5,_0x570099){return new BPromise(function(_0x185610,_0x496d7e){return client['request'](_0x2cc513,_0x570099)['then'](function(_0x11a7f2){logger[_0x6886('0xb')](_0x6886('0xc'),_0x7543c5,_0x6886('0xd'));logger[_0x6886('0xe')](_0x6886('0xf'),_0x7543c5,_0x6886('0xd'),JSON[_0x6886('0x10')](_0x11a7f2));if(_0x11a7f2[_0x6886('0x11')]){if(_0x11a7f2[_0x6886('0x11')][_0x6886('0x12')]===0x1f4){logger['error'](_0x6886('0xc'),_0x7543c5,_0x11a7f2['error'][_0x6886('0x13')]);return _0x496d7e(_0x11a7f2[_0x6886('0x11')][_0x6886('0x13')]);}logger[_0x6886('0x11')](_0x6886('0xc'),_0x7543c5,_0x11a7f2['error']['message']);return _0x185610(_0x11a7f2[_0x6886('0x11')][_0x6886('0x13')]);}else{logger[_0x6886('0xb')](_0x6886('0xc'),_0x7543c5,_0x6886('0xd'));_0x185610(_0x11a7f2[_0x6886('0x14')][_0x6886('0x13')]);}})[_0x6886('0x15')](function(_0x1637d0){logger['error']('Condition,\x20%s,\x20%s',_0x7543c5,_0x1637d0);_0x496d7e(_0x1637d0);});});} \ No newline at end of file +var _0xb9ff=['request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','client','http'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xb9ff,0x7d));var _0xfb9f=function(_0xdfec04,_0x397252){_0xdfec04=_0xdfec04-0x0;var _0x5bebf5=_0xb9ff[_0xdfec04];return _0x5bebf5;};'use strict';var _=require(_0xfb9f('0x0'));var util=require(_0xfb9f('0x1'));var moment=require('moment');var BPromise=require(_0xfb9f('0x2'));var rs=require(_0xfb9f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfb9f('0x4'))(_0xfb9f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfb9f('0x6')][_0xfb9f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f718e,_0x5e3491,_0x2431b1){return new BPromise(function(_0x179a26,_0x25b207){return client[_0xfb9f('0x8')](_0x1f718e,_0x2431b1)[_0xfb9f('0x9')](function(_0x4b97ea){logger[_0xfb9f('0xa')](_0xfb9f('0xb'),_0x5e3491,_0xfb9f('0xc'));logger[_0xfb9f('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x5e3491,_0xfb9f('0xc'),JSON['stringify'](_0x4b97ea));if(_0x4b97ea[_0xfb9f('0xe')]){if(_0x4b97ea[_0xfb9f('0xe')][_0xfb9f('0xf')]===0x1f4){logger[_0xfb9f('0xe')](_0xfb9f('0xb'),_0x5e3491,_0x4b97ea[_0xfb9f('0xe')]['message']);return _0x25b207(_0x4b97ea['error'][_0xfb9f('0x10')]);}logger[_0xfb9f('0xe')](_0xfb9f('0xb'),_0x5e3491,_0x4b97ea['error'][_0xfb9f('0x10')]);return _0x179a26(_0x4b97ea['error'][_0xfb9f('0x10')]);}else{logger[_0xfb9f('0xa')](_0xfb9f('0xb'),_0x5e3491,'request\x20sent');_0x179a26(_0x4b97ea[_0xfb9f('0x11')][_0xfb9f('0x10')]);}})[_0xfb9f('0x12')](function(_0x153444){logger[_0xfb9f('0xe')](_0xfb9f('0xb'),_0x5e3491,_0x153444);_0x25b207(_0x153444);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e753918..48cf39c 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 _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','delete','/:id','destroy','multer','util','path','express'];(function(_0x5bd0e9,_0x109e72){var _0x404f93=function(_0xc23b1e){while(--_0xc23b1e){_0x5bd0e9['push'](_0x5bd0e9['shift']());}};_0x404f93(++_0x109e72);}(_0x7a54,0x106));var _0x47a5=function(_0x24095e,_0x11e8f7){_0x24095e=_0x24095e-0x0;var _0x4246d9=_0x7a54[_0x24095e];return _0x4246d9;};'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')]('/:id',auth[_0x47a5('0xa')](),controller['update']);router[_0x47a5('0xb')](_0x47a5('0xc'),auth['isAuthenticated'](),controller[_0x47a5('0xd')]);module['exports']=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index e9e1dce..4bb670d 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 _0xadb8=['STRING','INTEGER'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xadb8,0x1d0));var _0x8adb=function(_0x209e12,_0x2ce907){_0x209e12=_0x209e12-0x0;var _0x3f5b89=_0xadb8[_0x209e12];return _0x3f5b89;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8adb('0x0')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x8adb('0x1')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8adb('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0x089f=['STRING','name','INTEGER','exports'];(function(_0x3c080c,_0x165a8b){var _0x3c2b25=function(_0x55df61){while(--_0x55df61){_0x3c080c['push'](_0x3c080c['shift']());}};_0x3c2b25(++_0x165a8b);}(_0x089f,0x1c7));var _0xf089=function(_0x4bf9c3,_0x15889c){_0x4bf9c3=_0x4bf9c3-0x0;var _0x22e39b=_0x089f[_0x4bf9c3];return _0x22e39b;};'use strict';var Sequelize=require('sequelize');module[_0xf089('0x0')]={'name':{'type':Sequelize[_0xf089('0x1')],'allowNull':![],'unique':_0xf089('0x2')},'OrderBy':{'type':Sequelize[_0xf089('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xf089('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 5db00db..e8c2d68 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 _0xd166=['jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','save','update','then','get','UserProfileResource','destroy','end','error','name','send','index','ContactItemType','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x14d88b,_0x2c70b8){var _0x5d0e9c=function(_0x540fb1){while(--_0x540fb1){_0x14d88b['push'](_0x14d88b['shift']());}};_0x5d0e9c(++_0x2c70b8);}(_0xd166,0xeb));var _0x6d16=function(_0xc19b6e,_0x9a847){_0xc19b6e=_0xc19b6e-0x0;var _0x35aac9=_0xd166[_0xc19b6e];return _0x35aac9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d16('0x0'));var zipdir=require(_0x6d16('0x1'));var jsonpatch=require(_0x6d16('0x2'));var rp=require('request-promise');var moment=require(_0x6d16('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6d16('0x4'));var util=require(_0x6d16('0x5'));var path=require(_0x6d16('0x6'));var sox=require(_0x6d16('0x7'));var csv=require(_0x6d16('0x8'));var ejs=require(_0x6d16('0x9'));var fs=require('fs');var fs_extra=require(_0x6d16('0xa'));var _=require(_0x6d16('0xb'));var squel=require(_0x6d16('0xc'));var crypto=require(_0x6d16('0xd'));var jsforce=require(_0x6d16('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6d16('0x8'));var querystring=require('querystring');var Papa=require(_0x6d16('0xf'));var Redis=require(_0x6d16('0x10'));var authService=require(_0x6d16('0x11'));var qs=require(_0x6d16('0x12'));var as=require(_0x6d16('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d16('0x14'))('api');var utils=require(_0x6d16('0x15'));var config=require(_0x6d16('0x16'));var licenseUtil=require(_0x6d16('0x17'));var db=require(_0x6d16('0x18'))['db'];function respondWithStatusCode(_0x2cd366,_0x16517d){_0x16517d=_0x16517d||0xcc;return function(_0x11f696){if(_0x11f696){return _0x2cd366[_0x6d16('0x19')](_0x16517d);}return _0x2cd366[_0x6d16('0x1a')](_0x16517d)['end']();};}function respondWithResult(_0x435a14,_0x3957ef){_0x3957ef=_0x3957ef||0xc8;return function(_0x472de6){if(_0x472de6){return _0x435a14[_0x6d16('0x1a')](_0x3957ef)[_0x6d16('0x1b')](_0x472de6);}};}function respondWithFilteredResult(_0x26515c,_0x2ff500){return function(_0x3b18f6){if(_0x3b18f6){var _0x589cd3=typeof _0x2ff500['offset']==='undefined'&&typeof _0x2ff500['limit']===_0x6d16('0x1c');var _0x4c7239=_0x3b18f6[_0x6d16('0x1d')];var _0x4ae335=_0x589cd3?0x0:_0x2ff500[_0x6d16('0x1e')];var _0x3d7568=_0x589cd3?_0x3b18f6[_0x6d16('0x1d')]:_0x2ff500['offset']+_0x2ff500[_0x6d16('0x1f')];var _0x3f0e4c;if(_0x3d7568>=_0x4c7239){_0x3d7568=_0x4c7239;_0x3f0e4c=0xc8;}else{_0x3f0e4c=0xce;}_0x26515c[_0x6d16('0x1a')](_0x3f0e4c);return _0x26515c[_0x6d16('0x20')]('Content-Range',_0x4ae335+'-'+_0x3d7568+'/'+_0x4c7239)[_0x6d16('0x1b')](_0x3b18f6);}return null;};}function patchUpdates(_0x4b0583){return function(_0x781f78){try{jsonpatch[_0x6d16('0x21')](_0x781f78,_0x4b0583,!![]);}catch(_0x3a5aec){return BPromise[_0x6d16('0x22')](_0x3a5aec);}return _0x781f78[_0x6d16('0x23')]();};}function saveUpdates(_0x575ed6,_0x22c7b7){return function(_0x105b4a){if(_0x105b4a){return _0x105b4a[_0x6d16('0x24')](_0x575ed6)['then'](function(_0x3dbd74){return _0x3dbd74;});}return null;};}function removeEntity(_0x2dd5aa,_0x2784f5){return function(_0x230a33){if(_0x230a33){return _0x230a33['destroy']()[_0x6d16('0x25')](function(){var _0x289dd5=_0x230a33[_0x6d16('0x26')]({'plain':!![]});var _0x37bfac='ContactItemTypes';return db[_0x6d16('0x27')][_0x6d16('0x28')]({'where':{'type':_0x37bfac,'resourceId':_0x289dd5['id']}})[_0x6d16('0x25')](function(){return _0x230a33;});})[_0x6d16('0x25')](function(){_0x2dd5aa[_0x6d16('0x1a')](0xcc)[_0x6d16('0x29')]();});}};}function handleEntityNotFound(_0x3e5239,_0x19fc5b){return function(_0x345240){if(!_0x345240){_0x3e5239[_0x6d16('0x19')](0x194);}return _0x345240;};}function handleError(_0x56418b,_0x5d238f){_0x5d238f=_0x5d238f||0x1f4;return function(_0x5974ef){logger[_0x6d16('0x2a')](_0x5974ef['stack']);if(_0x5974ef[_0x6d16('0x2b')]){delete _0x5974ef[_0x6d16('0x2b')];}_0x56418b[_0x6d16('0x1a')](_0x5d238f)[_0x6d16('0x2c')](_0x5974ef);};}exports[_0x6d16('0x2d')]=function(_0x548c88,_0x2c0eb0){var _0x5ea045={},_0x239f85={},_0xb020f5={'count':0x0,'rows':[]};var _0x18324e=_['map'](db[_0x6d16('0x2e')][_0x6d16('0x2f')],function(_0x6e6ab0){return{'name':_0x6e6ab0[_0x6d16('0x30')],'type':_0x6e6ab0['type'][_0x6d16('0x31')]};});_0x239f85[_0x6d16('0x32')]=_[_0x6d16('0x33')](_0x18324e,_0x6d16('0x2b'));_0x239f85[_0x6d16('0x34')]=_[_0x6d16('0x35')](_0x548c88[_0x6d16('0x34')]);_0x239f85['filters']=_[_0x6d16('0x36')](_0x239f85[_0x6d16('0x32')],_0x239f85['query']);_0x5ea045[_0x6d16('0x37')]=_['intersection'](_0x239f85['model'],qs['fields'](_0x548c88[_0x6d16('0x34')][_0x6d16('0x38')]));_0x5ea045[_0x6d16('0x37')]=_0x5ea045['attributes'][_0x6d16('0x39')]?_0x5ea045[_0x6d16('0x37')]:_0x239f85[_0x6d16('0x32')];if(!_0x548c88[_0x6d16('0x34')][_0x6d16('0x3a')](_0x6d16('0x3b'))){_0x5ea045[_0x6d16('0x1f')]=qs[_0x6d16('0x1f')](_0x548c88[_0x6d16('0x34')][_0x6d16('0x1f')]);_0x5ea045[_0x6d16('0x1e')]=qs[_0x6d16('0x1e')](_0x548c88[_0x6d16('0x34')][_0x6d16('0x1e')]);}_0x5ea045['order']=qs[_0x6d16('0x3c')](_0x548c88[_0x6d16('0x34')][_0x6d16('0x3c')]);_0x5ea045[_0x6d16('0x3d')]=qs[_0x6d16('0x3e')](_[_0x6d16('0x3f')](_0x548c88['query'],_0x239f85[_0x6d16('0x3e')]),_0x18324e);if(_0x548c88[_0x6d16('0x34')]['filter']){_0x5ea045[_0x6d16('0x3d')]=_['merge'](_0x5ea045[_0x6d16('0x3d')],{'$or':_[_0x6d16('0x33')](_0x18324e,function(_0x26ee3e){if(_0x26ee3e['type']!==_0x6d16('0x40')){var _0x2bc35f={};_0x2bc35f[_0x26ee3e[_0x6d16('0x2b')]]={'$like':'%'+_0x548c88['query']['filter']+'%'};return _0x2bc35f;}})});}_0x5ea045=_[_0x6d16('0x41')]({},_0x5ea045,_0x548c88[_0x6d16('0x42')]);var _0x2e6939={'where':_0x5ea045[_0x6d16('0x3d')]};return db[_0x6d16('0x2e')][_0x6d16('0x1d')](_0x2e6939)[_0x6d16('0x25')](function(_0xc48991){_0xb020f5[_0x6d16('0x1d')]=_0xc48991;if(_0x548c88['query'][_0x6d16('0x43')]){_0x5ea045[_0x6d16('0x44')]=[{'all':!![]}];}return db[_0x6d16('0x2e')][_0x6d16('0x45')](_0x5ea045);})[_0x6d16('0x25')](function(_0x296ef5){_0xb020f5[_0x6d16('0x46')]=_0x296ef5;return _0xb020f5;})['then'](respondWithFilteredResult(_0x2c0eb0,_0x5ea045))[_0x6d16('0x47')](handleError(_0x2c0eb0,null));};exports[_0x6d16('0x48')]=function(_0x10b3af,_0x4d4c3a){var _0x276d7f={'raw':!![],'where':{'id':_0x10b3af['params']['id']}},_0x3e6c2c={};_0x3e6c2c[_0x6d16('0x32')]=_[_0x6d16('0x35')](db['ContactItemType'][_0x6d16('0x2f')]);_0x3e6c2c['query']=_[_0x6d16('0x35')](_0x10b3af[_0x6d16('0x34')]);_0x3e6c2c[_0x6d16('0x3e')]=_[_0x6d16('0x36')](_0x3e6c2c[_0x6d16('0x32')],_0x3e6c2c[_0x6d16('0x34')]);_0x276d7f[_0x6d16('0x37')]=_[_0x6d16('0x36')](_0x3e6c2c[_0x6d16('0x32')],qs[_0x6d16('0x38')](_0x10b3af[_0x6d16('0x34')][_0x6d16('0x38')]));_0x276d7f[_0x6d16('0x37')]=_0x276d7f[_0x6d16('0x37')]['length']?_0x276d7f['attributes']:_0x3e6c2c[_0x6d16('0x32')];if(_0x10b3af[_0x6d16('0x34')][_0x6d16('0x43')]){_0x276d7f[_0x6d16('0x44')]=[{'all':!![]}];}_0x276d7f=_[_0x6d16('0x41')]({},_0x276d7f,_0x10b3af[_0x6d16('0x42')]);return db[_0x6d16('0x2e')]['find'](_0x276d7f)[_0x6d16('0x25')](handleEntityNotFound(_0x4d4c3a,null))[_0x6d16('0x25')](respondWithResult(_0x4d4c3a,null))[_0x6d16('0x47')](handleError(_0x4d4c3a,null));};exports[_0x6d16('0x49')]=function(_0x1d50f9,_0x92377b){return db['ContactItemType'][_0x6d16('0x49')](_0x1d50f9['body'],{})[_0x6d16('0x25')](function(_0x26f07c){var _0x2d75bb=_0x1d50f9[_0x6d16('0x4a')][_0x6d16('0x26')]({'plain':!![]});if(!_0x2d75bb)throw new Error(_0x6d16('0x4b'));if(_0x2d75bb[_0x6d16('0x4c')]===_0x6d16('0x4a')){var _0x120708=_0x26f07c['get']({'plain':!![]});var _0x4925c9='ContactItemTypes';return db[_0x6d16('0x4d')][_0x6d16('0x4e')]({'where':{'name':_0x4925c9,'userProfileId':_0x2d75bb[_0x6d16('0x4f')]},'raw':!![]})[_0x6d16('0x25')](function(_0x3dd87a){if(_0x3dd87a&&_0x3dd87a['autoAssociation']===0x0){return db[_0x6d16('0x27')][_0x6d16('0x49')]({'name':_0x120708['name'],'resourceId':_0x120708['id'],'type':_0x3dd87a['name'],'sectionId':_0x3dd87a['id']},{})[_0x6d16('0x25')](function(){return _0x26f07c;});}else{return _0x26f07c;}})[_0x6d16('0x47')](function(_0x36374b){logger[_0x6d16('0x2a')](_0x6d16('0x50'),_0x36374b);throw _0x36374b;});}return _0x26f07c;})['then'](respondWithResult(_0x92377b,0xc9))['catch'](handleError(_0x92377b,null));};exports[_0x6d16('0x24')]=function(_0x14099f,_0x3af12d){if(_0x14099f[_0x6d16('0x51')]['id']){delete _0x14099f[_0x6d16('0x51')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0x14099f['params']['id']}})[_0x6d16('0x25')](handleEntityNotFound(_0x3af12d,null))['then'](saveUpdates(_0x14099f[_0x6d16('0x51')],null))['then'](respondWithResult(_0x3af12d,null))[_0x6d16('0x47')](handleError(_0x3af12d,null));};exports['destroy']=function(_0x171b21,_0x5ed7d0){return db['ContactItemType'][_0x6d16('0x4e')]({'where':{'id':_0x171b21[_0x6d16('0x52')]['id']}})[_0x6d16('0x25')](handleEntityNotFound(_0x5ed7d0,null))[_0x6d16('0x25')](removeEntity(_0x5ed7d0,null))[_0x6d16('0x47')](handleError(_0x5ed7d0,null));}; \ No newline at end of file +var _0x9aab=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','get','ContactItemTypes','error','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','catch','show','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','rimraf','request-promise'];(function(_0x29bd9f,_0x4baae0){var _0x427785=function(_0x4469d1){while(--_0x4469d1){_0x29bd9f['push'](_0x29bd9f['shift']());}};_0x427785(++_0x4baae0);}(_0x9aab,0xa6));var _0xb9aa=function(_0x773558,_0x2bfd48){_0x773558=_0x773558-0x0;var _0xb487a9=_0x9aab[_0x773558];return _0xb487a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9aa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb9aa('0x1'));var moment=require(_0xb9aa('0x2'));var BPromise=require(_0xb9aa('0x3'));var Mustache=require(_0xb9aa('0x4'));var util=require(_0xb9aa('0x5'));var path=require(_0xb9aa('0x6'));var sox=require(_0xb9aa('0x7'));var csv=require(_0xb9aa('0x8'));var ejs=require(_0xb9aa('0x9'));var fs=require('fs');var fs_extra=require(_0xb9aa('0xa'));var _=require(_0xb9aa('0xb'));var squel=require(_0xb9aa('0xc'));var crypto=require(_0xb9aa('0xd'));var jsforce=require(_0xb9aa('0xe'));var deskjs=require(_0xb9aa('0xf'));var toCsv=require(_0xb9aa('0x8'));var querystring=require(_0xb9aa('0x10'));var Papa=require('papaparse');var Redis=require(_0xb9aa('0x11'));var authService=require(_0xb9aa('0x12'));var qs=require(_0xb9aa('0x13'));var as=require(_0xb9aa('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9aa('0x15'))(_0xb9aa('0x16'));var utils=require(_0xb9aa('0x17'));var config=require(_0xb9aa('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58ee00,_0x5a304d){_0x5a304d=_0x5a304d||0xcc;return function(_0x528c9a){if(_0x528c9a){return _0x58ee00[_0xb9aa('0x19')](_0x5a304d);}return _0x58ee00[_0xb9aa('0x1a')](_0x5a304d)[_0xb9aa('0x1b')]();};}function respondWithResult(_0x1844fa,_0xb32bf8){_0xb32bf8=_0xb32bf8||0xc8;return function(_0x2f0492){if(_0x2f0492){return _0x1844fa['status'](_0xb32bf8)[_0xb9aa('0x1c')](_0x2f0492);}};}function respondWithFilteredResult(_0x517c9b,_0x660a9){return function(_0x203f41){if(_0x203f41){var _0x4c73c0=typeof _0x660a9['offset']==='undefined'&&typeof _0x660a9['limit']===_0xb9aa('0x1d');var _0x28ccc6=_0x203f41[_0xb9aa('0x1e')];var _0x4154a2=_0x4c73c0?0x0:_0x660a9[_0xb9aa('0x1f')];var _0x43e8fa=_0x4c73c0?_0x203f41[_0xb9aa('0x1e')]:_0x660a9[_0xb9aa('0x1f')]+_0x660a9['limit'];var _0x339ae1;if(_0x43e8fa>=_0x28ccc6){_0x43e8fa=_0x28ccc6;_0x339ae1=0xc8;}else{_0x339ae1=0xce;}_0x517c9b['status'](_0x339ae1);return _0x517c9b[_0xb9aa('0x20')](_0xb9aa('0x21'),_0x4154a2+'-'+_0x43e8fa+'/'+_0x28ccc6)[_0xb9aa('0x1c')](_0x203f41);}return null;};}function patchUpdates(_0x5ce4d3){return function(_0x21aa41){try{jsonpatch[_0xb9aa('0x22')](_0x21aa41,_0x5ce4d3,!![]);}catch(_0x4d2e9f){return BPromise[_0xb9aa('0x23')](_0x4d2e9f);}return _0x21aa41['save']();};}function saveUpdates(_0x2d1f50,_0xfc1ee9){return function(_0x55ac3b){if(_0x55ac3b){return _0x55ac3b['update'](_0x2d1f50)[_0xb9aa('0x24')](function(_0x27890e){return _0x27890e;});}return null;};}function removeEntity(_0x339f3a,_0x468728){return function(_0x2214fb){if(_0x2214fb){return _0x2214fb[_0xb9aa('0x25')]()[_0xb9aa('0x24')](function(){var _0x20f3ea=_0x2214fb[_0xb9aa('0x26')]({'plain':!![]});var _0x47c95f=_0xb9aa('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x47c95f,'resourceId':_0x20f3ea['id']}})[_0xb9aa('0x24')](function(){return _0x2214fb;});})[_0xb9aa('0x24')](function(){_0x339f3a[_0xb9aa('0x1a')](0xcc)[_0xb9aa('0x1b')]();});}};}function handleEntityNotFound(_0x4fd6ec,_0x4e9f23){return function(_0x1b6ba3){if(!_0x1b6ba3){_0x4fd6ec['sendStatus'](0x194);}return _0x1b6ba3;};}function handleError(_0x26aec7,_0x9d7874){_0x9d7874=_0x9d7874||0x1f4;return function(_0x228cc8){logger[_0xb9aa('0x28')](_0x228cc8[_0xb9aa('0x29')]);if(_0x228cc8[_0xb9aa('0x2a')]){delete _0x228cc8[_0xb9aa('0x2a')];}_0x26aec7[_0xb9aa('0x1a')](_0x9d7874)[_0xb9aa('0x2b')](_0x228cc8);};}exports[_0xb9aa('0x2c')]=function(_0x5315d5,_0x1b7f07){var _0x369e55={},_0x2ca2fc={},_0x2f42e7={'count':0x0,'rows':[]};var _0x58e6e9=_[_0xb9aa('0x2d')](db[_0xb9aa('0x2e')][_0xb9aa('0x2f')],function(_0x3d855a){return{'name':_0x3d855a['fieldName'],'type':_0x3d855a[_0xb9aa('0x30')][_0xb9aa('0x31')]};});_0x2ca2fc[_0xb9aa('0x32')]=_['map'](_0x58e6e9,_0xb9aa('0x2a'));_0x2ca2fc[_0xb9aa('0x33')]=_[_0xb9aa('0x34')](_0x5315d5[_0xb9aa('0x33')]);_0x2ca2fc[_0xb9aa('0x35')]=_[_0xb9aa('0x36')](_0x2ca2fc[_0xb9aa('0x32')],_0x2ca2fc[_0xb9aa('0x33')]);_0x369e55[_0xb9aa('0x37')]=_[_0xb9aa('0x36')](_0x2ca2fc['model'],qs['fields'](_0x5315d5[_0xb9aa('0x33')][_0xb9aa('0x38')]));_0x369e55[_0xb9aa('0x37')]=_0x369e55[_0xb9aa('0x37')][_0xb9aa('0x39')]?_0x369e55[_0xb9aa('0x37')]:_0x2ca2fc[_0xb9aa('0x32')];if(!_0x5315d5['query']['hasOwnProperty'](_0xb9aa('0x3a'))){_0x369e55['limit']=qs[_0xb9aa('0x3b')](_0x5315d5[_0xb9aa('0x33')][_0xb9aa('0x3b')]);_0x369e55[_0xb9aa('0x1f')]=qs['offset'](_0x5315d5[_0xb9aa('0x33')]['offset']);}_0x369e55[_0xb9aa('0x3c')]=qs['sort'](_0x5315d5['query'][_0xb9aa('0x3d')]);_0x369e55['where']=qs[_0xb9aa('0x35')](_[_0xb9aa('0x3e')](_0x5315d5[_0xb9aa('0x33')],_0x2ca2fc[_0xb9aa('0x35')]),_0x58e6e9);if(_0x5315d5[_0xb9aa('0x33')]['filter']){_0x369e55[_0xb9aa('0x3f')]=_[_0xb9aa('0x40')](_0x369e55[_0xb9aa('0x3f')],{'$or':_[_0xb9aa('0x2d')](_0x58e6e9,function(_0x1eac4a){if(_0x1eac4a[_0xb9aa('0x30')]!=='VIRTUAL'){var _0x3a9357={};_0x3a9357[_0x1eac4a['name']]={'$like':'%'+_0x5315d5[_0xb9aa('0x33')][_0xb9aa('0x41')]+'%'};return _0x3a9357;}})});}_0x369e55=_[_0xb9aa('0x40')]({},_0x369e55,_0x5315d5[_0xb9aa('0x42')]);var _0x5a0743={'where':_0x369e55[_0xb9aa('0x3f')]};return db[_0xb9aa('0x2e')]['count'](_0x5a0743)[_0xb9aa('0x24')](function(_0x1aa1c9){_0x2f42e7[_0xb9aa('0x1e')]=_0x1aa1c9;if(_0x5315d5[_0xb9aa('0x33')][_0xb9aa('0x43')]){_0x369e55[_0xb9aa('0x44')]=[{'all':!![]}];}return db[_0xb9aa('0x2e')][_0xb9aa('0x45')](_0x369e55);})[_0xb9aa('0x24')](function(_0x418e7c){_0x2f42e7['rows']=_0x418e7c;return _0x2f42e7;})[_0xb9aa('0x24')](respondWithFilteredResult(_0x1b7f07,_0x369e55))[_0xb9aa('0x46')](handleError(_0x1b7f07,null));};exports[_0xb9aa('0x47')]=function(_0x106734,_0x2faca7){var _0x24d71a={'raw':!![],'where':{'id':_0x106734['params']['id']}},_0x5b916c={};_0x5b916c[_0xb9aa('0x32')]=_[_0xb9aa('0x34')](db[_0xb9aa('0x2e')]['rawAttributes']);_0x5b916c[_0xb9aa('0x33')]=_[_0xb9aa('0x34')](_0x106734[_0xb9aa('0x33')]);_0x5b916c[_0xb9aa('0x35')]=_[_0xb9aa('0x36')](_0x5b916c[_0xb9aa('0x32')],_0x5b916c[_0xb9aa('0x33')]);_0x24d71a[_0xb9aa('0x37')]=_['intersection'](_0x5b916c['model'],qs[_0xb9aa('0x38')](_0x106734[_0xb9aa('0x33')]['fields']));_0x24d71a['attributes']=_0x24d71a['attributes'][_0xb9aa('0x39')]?_0x24d71a[_0xb9aa('0x37')]:_0x5b916c['model'];if(_0x106734[_0xb9aa('0x33')]['includeAll']){_0x24d71a['include']=[{'all':!![]}];}_0x24d71a=_[_0xb9aa('0x40')]({},_0x24d71a,_0x106734['options']);return db[_0xb9aa('0x2e')][_0xb9aa('0x48')](_0x24d71a)[_0xb9aa('0x24')](handleEntityNotFound(_0x2faca7,null))[_0xb9aa('0x24')](respondWithResult(_0x2faca7,null))[_0xb9aa('0x46')](handleError(_0x2faca7,null));};exports['create']=function(_0x47e629,_0x532a67){return db[_0xb9aa('0x2e')][_0xb9aa('0x49')](_0x47e629['body'],{})['then'](function(_0x23c817){var _0x249d0a=_0x47e629['user'][_0xb9aa('0x26')]({'plain':!![]});if(!_0x249d0a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x249d0a[_0xb9aa('0x4a')]===_0xb9aa('0x4b')){var _0x1dda30=_0x23c817[_0xb9aa('0x26')]({'plain':!![]});var _0x380b90='ContactItemTypes';return db[_0xb9aa('0x4c')][_0xb9aa('0x48')]({'where':{'name':_0x380b90,'userProfileId':_0x249d0a[_0xb9aa('0x4d')]},'raw':!![]})[_0xb9aa('0x24')](function(_0x445e38){if(_0x445e38&&_0x445e38[_0xb9aa('0x4e')]===0x0){return db[_0xb9aa('0x4f')][_0xb9aa('0x49')]({'name':_0x1dda30[_0xb9aa('0x2a')],'resourceId':_0x1dda30['id'],'type':_0x445e38['name'],'sectionId':_0x445e38['id']},{})['then'](function(){return _0x23c817;});}else{return _0x23c817;}})[_0xb9aa('0x46')](function(_0xd8a7a){logger[_0xb9aa('0x28')](_0xb9aa('0x50'),_0xd8a7a);throw _0xd8a7a;});}return _0x23c817;})['then'](respondWithResult(_0x532a67,0xc9))[_0xb9aa('0x46')](handleError(_0x532a67,null));};exports[_0xb9aa('0x51')]=function(_0x2fc409,_0x1b835c){if(_0x2fc409[_0xb9aa('0x52')]['id']){delete _0x2fc409[_0xb9aa('0x52')]['id'];}return db[_0xb9aa('0x2e')][_0xb9aa('0x48')]({'where':{'id':_0x2fc409[_0xb9aa('0x53')]['id']}})['then'](handleEntityNotFound(_0x1b835c,null))[_0xb9aa('0x24')](saveUpdates(_0x2fc409[_0xb9aa('0x52')],null))[_0xb9aa('0x24')](respondWithResult(_0x1b835c,null))[_0xb9aa('0x46')](handleError(_0x1b835c,null));};exports[_0xb9aa('0x25')]=function(_0x2eafb8,_0x40889d){return db[_0xb9aa('0x2e')][_0xb9aa('0x48')]({'where':{'id':_0x2eafb8['params']['id']}})[_0xb9aa('0x24')](handleEntityNotFound(_0x40889d,null))[_0xb9aa('0x24')](removeEntity(_0x40889d,null))[_0xb9aa('0x46')](handleError(_0x40889d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 27ec2ae..c209de1 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 _0xa647=['exports','define','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes'];(function(_0xd501b,_0x570d56){var _0x26a42a=function(_0x10a148){while(--_0x10a148){_0xd501b['push'](_0xd501b['shift']());}};_0x26a42a(++_0x570d56);}(_0xa647,0x81));var _0x7a64=function(_0x345839,_0x28f63e){_0x345839=_0x345839-0x0;var _0x35fc0d=_0xa647[_0x345839];return _0x35fc0d;};'use strict';var _=require(_0x7a64('0x0'));var util=require(_0x7a64('0x1'));var logger=require(_0x7a64('0x2'))(_0x7a64('0x3'));var moment=require(_0x7a64('0x4'));var BPromise=require(_0x7a64('0x5'));var rp=require(_0x7a64('0x6'));var fs=require('fs');var path=require(_0x7a64('0x7'));var rimraf=require(_0x7a64('0x8'));var config=require(_0x7a64('0x9'));var attributes=require(_0x7a64('0xa'));module[_0x7a64('0xb')]=function(_0x4a47b8,_0xec81c9){return _0x4a47b8[_0x7a64('0xc')]('ContactItemType',attributes,{'tableName':_0x7a64('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6b0=['rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','moment','bluebird','request-promise'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x4005b0,_0x36450c){_0x4005b0=_0x4005b0-0x0;var _0x467905=_0xa6b0[_0x4005b0];return _0x467905;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a6b('0x2'));var BPromise=require(_0x0a6b('0x3'));var rp=require(_0x0a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var attributes=require(_0x0a6b('0x7'));module[_0x0a6b('0x8')]=function(_0x3dc2b0,_0x3b6967){return _0x3dc2b0[_0x0a6b('0x9')](_0x0a6b('0xa'),attributes,{'tableName':_0x0a6b('0xb'),'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 1691794..d716835 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 _0x5712=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x5712,0x140));var _0x2571=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5712[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var moment=require(_0x2571('0x2'));var BPromise=require(_0x2571('0x3'));var rs=require(_0x2571('0x4'));var fs=require('fs');var Redis=require(_0x2571('0x5'));var db=require(_0x2571('0x6'))['db'];var utils=require(_0x2571('0x7'));var logger=require(_0x2571('0x8'))(_0x2571('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2571('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e19b2,_0x251ee6,_0x3ca885){return new BPromise(function(_0x204ecc,_0xda659a){return client[_0x2571('0xb')](_0x3e19b2,_0x3ca885)['then'](function(_0x1f0c98){logger['info'](_0x2571('0xc'),_0x251ee6,_0x2571('0xd'));logger[_0x2571('0xe')](_0x2571('0xf'),_0x251ee6,_0x2571('0xd'),JSON[_0x2571('0x10')](_0x1f0c98));if(_0x1f0c98[_0x2571('0x11')]){if(_0x1f0c98[_0x2571('0x11')]['code']===0x1f4){logger['error'](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0xda659a(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0x204ecc(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}else{logger[_0x2571('0x13')]('ContactItemType,\x20%s,\x20%s',_0x251ee6,_0x2571('0xd'));_0x204ecc(_0x1f0c98['result']['message']);}})['catch'](function(_0x4c3e11){logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x4c3e11);_0xda659a(_0x4c3e11);});});} \ No newline at end of file +var _0x4517=['info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x249626,_0xad9337){var _0x5de76a=function(_0x1a016a){while(--_0x1a016a){_0x249626['push'](_0x249626['shift']());}};_0x5de76a(++_0xad9337);}(_0x4517,0x112));var _0x7451=function(_0x1937fb,_0x41f297){_0x1937fb=_0x1937fb-0x0;var _0x2c1d5a=_0x4517[_0x1937fb];return _0x2c1d5a;};'use strict';var _=require('lodash');var util=require(_0x7451('0x0'));var moment=require(_0x7451('0x1'));var BPromise=require('bluebird');var rs=require(_0x7451('0x2'));var fs=require('fs');var Redis=require(_0x7451('0x3'));var db=require(_0x7451('0x4'))['db'];var utils=require(_0x7451('0x5'));var logger=require(_0x7451('0x6'))(_0x7451('0x7'));var config=require(_0x7451('0x8'));var jayson=require(_0x7451('0x9'));var client=jayson[_0x7451('0xa')][_0x7451('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ac271,_0x1bfc08,_0x26306e){return new BPromise(function(_0x443b80,_0x2c2ace){return client[_0x7451('0xc')](_0x3ac271,_0x26306e)[_0x7451('0xd')](function(_0x4b7888){logger[_0x7451('0xe')](_0x7451('0xf'),_0x1bfc08,_0x7451('0x10'));logger[_0x7451('0x11')](_0x7451('0x12'),_0x1bfc08,_0x7451('0x10'),JSON[_0x7451('0x13')](_0x4b7888));if(_0x4b7888['error']){if(_0x4b7888['error'][_0x7451('0x14')]===0x1f4){logger['error'](_0x7451('0xf'),_0x1bfc08,_0x4b7888[_0x7451('0x15')]['message']);return _0x2c2ace(_0x4b7888[_0x7451('0x15')][_0x7451('0x16')]);}logger['error'](_0x7451('0xf'),_0x1bfc08,_0x4b7888[_0x7451('0x15')][_0x7451('0x16')]);return _0x443b80(_0x4b7888[_0x7451('0x15')]['message']);}else{logger[_0x7451('0xe')](_0x7451('0xf'),_0x1bfc08,_0x7451('0x10'));_0x443b80(_0x4b7888['result']['message']);}})[_0x7451('0x17')](function(_0x1db688){logger[_0x7451('0x15')](_0x7451('0xf'),_0x1bfc08,_0x1db688);_0x2c2ace(_0x1db688);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 436809a..ee5cfd4 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 _0xe08e=['isAuthenticated','/:id','show','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xe08e,0x112));var _0xee08=function(_0x17402f,_0x3bf6f4){_0x17402f=_0x17402f-0x0;var _0x13ab54=_0xe08e[_0x17402f];return _0x13ab54;};'use strict';var multer=require(_0xee08('0x0'));var util=require(_0xee08('0x1'));var path=require(_0xee08('0x2'));var timeout=require('connect-timeout');var express=require(_0xee08('0x3'));var router=express[_0xee08('0x4')]();var fs_extra=require(_0xee08('0x5'));var auth=require(_0xee08('0x6'));var interaction=require(_0xee08('0x7'));var config=require(_0xee08('0x8'));var controller=require(_0xee08('0x9'));router[_0xee08('0xa')]('/',auth[_0xee08('0xb')](),controller['index']);router[_0xee08('0xa')](_0xee08('0xc'),auth['isAuthenticated'](),controller[_0xee08('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xee08('0xe')]);router[_0xee08('0xf')](_0xee08('0xc'),auth[_0xee08('0xb')](),controller[_0xee08('0x10')]);router[_0xee08('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xee08('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3cea=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x579221,_0x373425){var _0x3631a1=function(_0x4090e7){while(--_0x4090e7){_0x579221['push'](_0x579221['shift']());}};_0x3631a1(++_0x373425);}(_0x3cea,0x176));var _0xa3ce=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3cea[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xa3ce('0x0'));var util=require(_0xa3ce('0x1'));var path=require(_0xa3ce('0x2'));var timeout=require(_0xa3ce('0x3'));var express=require(_0xa3ce('0x4'));var router=express[_0xa3ce('0x5')]();var fs_extra=require(_0xa3ce('0x6'));var auth=require(_0xa3ce('0x7'));var interaction=require(_0xa3ce('0x8'));var config=require(_0xa3ce('0x9'));var controller=require('./contactItemType.controller');router[_0xa3ce('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa3ce('0xa')]('/:id',auth[_0xa3ce('0xb')](),controller[_0xa3ce('0xc')]);router[_0xa3ce('0xd')]('/',auth['isAuthenticated'](),controller[_0xa3ce('0xe')]);router[_0xa3ce('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa3ce('0x10')]);router[_0xa3ce('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa3ce('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 010ce0a..2d7ce33 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 _0x3248=['sequelize','exports','STRING','name'];(function(_0x13c453,_0x5d204c){var _0x42281a=function(_0xe3eccb){while(--_0xe3eccb){_0x13c453['push'](_0x13c453['shift']());}};_0x42281a(++_0x5d204c);}(_0x3248,0x1b0));var _0x8324=function(_0x13ee33,_0x542178){_0x13ee33=_0x13ee33-0x0;var _0x2ffc01=_0x3248[_0x13ee33];return _0x2ffc01;};'use strict';var Sequelize=require(_0x8324('0x0'));module[_0x8324('0x1')]={'name':{'type':Sequelize[_0x8324('0x2')],'allowNull':![],'unique':_0x8324('0x3')},'description':{'type':Sequelize[_0x8324('0x2')]}}; \ No newline at end of file +var _0xfa5d=['sequelize','STRING'];(function(_0x4900e4,_0x125f32){var _0x3ed7f5=function(_0x3083c2){while(--_0x3083c2){_0x4900e4['push'](_0x4900e4['shift']());}};_0x3ed7f5(++_0x125f32);}(_0xfa5d,0x19e));var _0xdfa5=function(_0x410ac0,_0x223579){_0x410ac0=_0x410ac0-0x0;var _0x37a0df=_0xfa5d[_0x410ac0];return _0x37a0df;};'use strict';var Sequelize=require(_0xdfa5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xdfa5('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 582acba..fd72e35 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 _0xe047=['json','offset','limit','undefined','count','set','apply','reject','save','destroy','then','get','CustomDashboards','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','autoAssociation','update','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','filter','getItems','eml-format','zip-dir','moment','bluebird','mustache','util','path','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe047,0x1be));var _0x7e04=function(_0x4ae89d,_0x5af74b){_0x4ae89d=_0x4ae89d-0x0;var _0x411fd7=_0xe047[_0x4ae89d];return _0x411fd7;};'use strict';var emlformat=require(_0x7e04('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e04('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7e04('0x2'));var BPromise=require(_0x7e04('0x3'));var Mustache=require(_0x7e04('0x4'));var util=require(_0x7e04('0x5'));var path=require(_0x7e04('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7e04('0x7'));var crypto=require(_0x7e04('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x7e04('0x9'));var toCsv=require(_0x7e04('0xa'));var querystring=require(_0x7e04('0xb'));var Papa=require(_0x7e04('0xc'));var Redis=require('ioredis');var authService=require(_0x7e04('0xd'));var qs=require(_0x7e04('0xe'));var as=require(_0x7e04('0xf'));var hardwareService=require(_0x7e04('0x10'));var logger=require(_0x7e04('0x11'))(_0x7e04('0x12'));var utils=require(_0x7e04('0x13'));var config=require(_0x7e04('0x14'));var licenseUtil=require(_0x7e04('0x15'));var db=require('../../mysqldb')['db'];config[_0x7e04('0x16')]=_[_0x7e04('0x17')](config['redis'],{'host':_0x7e04('0x18'),'port':0x18eb});var socket=require(_0x7e04('0x19'))(new Redis(config[_0x7e04('0x16')]));require(_0x7e04('0x1a'))[_0x7e04('0x1b')](socket);function respondWithStatusCode(_0xab978,_0x1cc7cf){_0x1cc7cf=_0x1cc7cf||0xcc;return function(_0x5b858d){if(_0x5b858d){return _0xab978['sendStatus'](_0x1cc7cf);}return _0xab978[_0x7e04('0x1c')](_0x1cc7cf)[_0x7e04('0x1d')]();};}function respondWithResult(_0x3b5dde,_0x30f17e){_0x30f17e=_0x30f17e||0xc8;return function(_0x21e996){if(_0x21e996){return _0x3b5dde[_0x7e04('0x1c')](_0x30f17e)[_0x7e04('0x1e')](_0x21e996);}};}function respondWithFilteredResult(_0x37dce8,_0x58c8a0){return function(_0x4f660a){if(_0x4f660a){var _0x5926ce=typeof _0x58c8a0[_0x7e04('0x1f')]==='undefined'&&typeof _0x58c8a0[_0x7e04('0x20')]===_0x7e04('0x21');var _0x1eb7fb=_0x4f660a[_0x7e04('0x22')];var _0x348d52=_0x5926ce?0x0:_0x58c8a0['offset'];var _0x59ce81=_0x5926ce?_0x4f660a['count']:_0x58c8a0[_0x7e04('0x1f')]+_0x58c8a0[_0x7e04('0x20')];var _0x25e79b;if(_0x59ce81>=_0x1eb7fb){_0x59ce81=_0x1eb7fb;_0x25e79b=0xc8;}else{_0x25e79b=0xce;}_0x37dce8[_0x7e04('0x1c')](_0x25e79b);return _0x37dce8[_0x7e04('0x23')]('Content-Range',_0x348d52+'-'+_0x59ce81+'/'+_0x1eb7fb)[_0x7e04('0x1e')](_0x4f660a);}return null;};}function patchUpdates(_0x2956a3){return function(_0x28e8d2){try{jsonpatch[_0x7e04('0x24')](_0x28e8d2,_0x2956a3,!![]);}catch(_0x3b2bfc){return BPromise[_0x7e04('0x25')](_0x3b2bfc);}return _0x28e8d2[_0x7e04('0x26')]();};}function saveUpdates(_0x52a2e9,_0x42a67d){return function(_0x3e914d){if(_0x3e914d){return _0x3e914d['update'](_0x52a2e9)['then'](function(_0x53f711){return _0x53f711;});}return null;};}function removeEntity(_0x160154,_0x4e1434){return function(_0x1ecd30){if(_0x1ecd30){return _0x1ecd30[_0x7e04('0x27')]()[_0x7e04('0x28')](function(){var _0x506b25=_0x1ecd30[_0x7e04('0x29')]({'plain':!![]});var _0x2e8074=_0x7e04('0x2a');return db[_0x7e04('0x2b')][_0x7e04('0x27')]({'where':{'type':_0x2e8074,'resourceId':_0x506b25['id']}})[_0x7e04('0x28')](function(){return _0x1ecd30;});})[_0x7e04('0x28')](function(){_0x160154[_0x7e04('0x1c')](0xcc)[_0x7e04('0x1d')]();});}};}function handleEntityNotFound(_0x1152a0,_0x1ecfcd){return function(_0x11f9b2){if(!_0x11f9b2){_0x1152a0['sendStatus'](0x194);}return _0x11f9b2;};}function handleError(_0x56468c,_0x4a709f){_0x4a709f=_0x4a709f||0x1f4;return function(_0x220a85){logger[_0x7e04('0x2c')](_0x220a85[_0x7e04('0x2d')]);if(_0x220a85[_0x7e04('0x2e')]){delete _0x220a85[_0x7e04('0x2e')];}_0x56468c['status'](_0x4a709f)['send'](_0x220a85);};}exports[_0x7e04('0x2f')]=function(_0x4ab1fb,_0x451291){var _0x29efd7={},_0x379aeb={},_0x3911fe={'count':0x0,'rows':[]};var _0x3dd8ed=_[_0x7e04('0x30')](db[_0x7e04('0x31')][_0x7e04('0x32')],function(_0x417f1a){return{'name':_0x417f1a[_0x7e04('0x33')],'type':_0x417f1a[_0x7e04('0x34')][_0x7e04('0x35')]};});_0x379aeb[_0x7e04('0x36')]=_[_0x7e04('0x30')](_0x3dd8ed,'name');_0x379aeb[_0x7e04('0x37')]=_['keys'](_0x4ab1fb[_0x7e04('0x37')]);_0x379aeb['filters']=_['intersection'](_0x379aeb[_0x7e04('0x36')],_0x379aeb[_0x7e04('0x37')]);_0x29efd7[_0x7e04('0x38')]=_[_0x7e04('0x39')](_0x379aeb['model'],qs['fields'](_0x4ab1fb[_0x7e04('0x37')][_0x7e04('0x3a')]));_0x29efd7[_0x7e04('0x38')]=_0x29efd7[_0x7e04('0x38')][_0x7e04('0x3b')]?_0x29efd7[_0x7e04('0x38')]:_0x379aeb[_0x7e04('0x36')];if(!_0x4ab1fb['query'][_0x7e04('0x3c')](_0x7e04('0x3d'))){_0x29efd7[_0x7e04('0x20')]=qs[_0x7e04('0x20')](_0x4ab1fb[_0x7e04('0x37')][_0x7e04('0x20')]);_0x29efd7[_0x7e04('0x1f')]=qs[_0x7e04('0x1f')](_0x4ab1fb[_0x7e04('0x37')]['offset']);}_0x29efd7['order']=qs[_0x7e04('0x3e')](_0x4ab1fb['query'][_0x7e04('0x3e')]);_0x29efd7[_0x7e04('0x3f')]=qs['filters'](_[_0x7e04('0x40')](_0x4ab1fb[_0x7e04('0x37')],_0x379aeb[_0x7e04('0x41')]),_0x3dd8ed);if(_0x4ab1fb[_0x7e04('0x37')]['filter']){_0x29efd7[_0x7e04('0x3f')]=_[_0x7e04('0x42')](_0x29efd7[_0x7e04('0x3f')],{'$or':_[_0x7e04('0x30')](_0x3dd8ed,function(_0x842c90){if(_0x842c90[_0x7e04('0x34')]!==_0x7e04('0x43')){var _0x13e7c3={};_0x13e7c3[_0x842c90[_0x7e04('0x2e')]]={'$like':'%'+_0x4ab1fb[_0x7e04('0x37')]['filter']+'%'};return _0x13e7c3;}})});}_0x29efd7=_[_0x7e04('0x42')]({},_0x29efd7,_0x4ab1fb[_0x7e04('0x44')]);var _0x5d434d={'where':_0x29efd7[_0x7e04('0x3f')]};return db[_0x7e04('0x31')][_0x7e04('0x22')](_0x5d434d)['then'](function(_0x24d40e){_0x3911fe['count']=_0x24d40e;if(_0x4ab1fb[_0x7e04('0x37')][_0x7e04('0x45')]){_0x29efd7[_0x7e04('0x46')]=[{'all':!![]}];}return db['Dashboard'][_0x7e04('0x47')](_0x29efd7);})['then'](function(_0x4c834e){_0x3911fe[_0x7e04('0x48')]=_0x4c834e;return _0x3911fe;})[_0x7e04('0x28')](respondWithFilteredResult(_0x451291,_0x29efd7))['catch'](handleError(_0x451291,null));};exports[_0x7e04('0x49')]=function(_0x35ec45,_0x552898){var _0xdb8159={'raw':![],'where':{'id':_0x35ec45[_0x7e04('0x4a')]['id']}},_0x55f625={};_0x55f625['model']=_[_0x7e04('0x4b')](db[_0x7e04('0x31')]['rawAttributes']);_0x55f625['query']=_[_0x7e04('0x4b')](_0x35ec45['query']);_0x55f625[_0x7e04('0x41')]=_[_0x7e04('0x39')](_0x55f625[_0x7e04('0x36')],_0x55f625[_0x7e04('0x37')]);_0xdb8159[_0x7e04('0x38')]=_['intersection'](_0x55f625[_0x7e04('0x36')],qs[_0x7e04('0x3a')](_0x35ec45['query'][_0x7e04('0x3a')]));_0xdb8159[_0x7e04('0x38')]=_0xdb8159['attributes'][_0x7e04('0x3b')]?_0xdb8159[_0x7e04('0x38')]:_0x55f625['model'];if(_0x35ec45[_0x7e04('0x37')][_0x7e04('0x45')]){_0xdb8159[_0x7e04('0x46')]=[{'all':!![]}];}_0xdb8159=_[_0x7e04('0x42')]({},_0xdb8159,_0x35ec45[_0x7e04('0x44')]);return db[_0x7e04('0x31')][_0x7e04('0x4c')](_0xdb8159)[_0x7e04('0x28')](handleEntityNotFound(_0x552898,null))[_0x7e04('0x28')](respondWithResult(_0x552898,null))[_0x7e04('0x4d')](handleError(_0x552898,null));};exports[_0x7e04('0x4e')]=function(_0x1b6d49,_0x480a7a){return db['Dashboard'][_0x7e04('0x4e')](_0x1b6d49[_0x7e04('0x4f')],{})[_0x7e04('0x28')](function(_0x487919){var _0x188c47=_0x1b6d49[_0x7e04('0x50')]['get']({'plain':!![]});if(!_0x188c47)throw new Error(_0x7e04('0x51'));if(_0x188c47[_0x7e04('0x52')]===_0x7e04('0x50')){var _0x4e5d76=_0x487919[_0x7e04('0x29')]({'plain':!![]});var _0x326753=_0x7e04('0x2a');return db[_0x7e04('0x53')][_0x7e04('0x4c')]({'where':{'name':_0x326753,'userProfileId':_0x188c47[_0x7e04('0x54')]},'raw':!![]})['then'](function(_0x3e6c6d){if(_0x3e6c6d&&_0x3e6c6d['autoAssociation']===0x0){return db[_0x7e04('0x2b')][_0x7e04('0x4e')]({'name':_0x4e5d76[_0x7e04('0x2e')],'resourceId':_0x4e5d76['id'],'type':_0x3e6c6d[_0x7e04('0x2e')],'sectionId':_0x3e6c6d['id']},{})[_0x7e04('0x28')](function(){return _0x487919;});}else{return _0x487919;}})[_0x7e04('0x4d')](function(_0x45692e){logger[_0x7e04('0x2c')](_0x7e04('0x55'),_0x45692e);throw _0x45692e;});}return _0x487919;})[_0x7e04('0x28')](respondWithResult(_0x480a7a,0xc9))[_0x7e04('0x4d')](handleError(_0x480a7a,null));};exports[_0x7e04('0x56')]=function(_0x1dcdd3,_0x4d1daa){var _0x27bae2={'where':{'id':_0x1dcdd3['params']['id']}},_0x194b49={};_0x194b49[_0x7e04('0x36')]=_[_0x7e04('0x4b')](db[_0x7e04('0x31')][_0x7e04('0x32')]);_0x27bae2['attributes']=_[_0x7e04('0x39')](_0x194b49[_0x7e04('0x36')],qs[_0x7e04('0x3a')](_0x1dcdd3[_0x7e04('0x37')][_0x7e04('0x3a')]));_0x27bae2[_0x7e04('0x38')]=_0x27bae2[_0x7e04('0x38')]['length']?_0x27bae2[_0x7e04('0x38')]:_0x194b49[_0x7e04('0x36')];if(_0x1dcdd3['query']['includeAll']){_0x27bae2[_0x7e04('0x46')]=[{'all':!![]}];}_0x27bae2=_[_0x7e04('0x42')]({},_0x27bae2,_0x1dcdd3[_0x7e04('0x44')]);return db[_0x7e04('0x31')][_0x7e04('0x4c')](_0x27bae2)[_0x7e04('0x28')](handleEntityNotFound(_0x4d1daa,null))[_0x7e04('0x28')](function(_0x1d617f){if(_0x1d617f){var _0x3494b9=_0x1d617f[_0x7e04('0x29')]({'plain':!![]});_0x3494b9=qs[_0x7e04('0x57')](_0x3494b9,['id','createdAt',_0x7e04('0x58')]);_0x1dcdd3['body']=_['omit'](_0x1dcdd3[_0x7e04('0x4f')],['id',_0x7e04('0x59'),_0x7e04('0x58')]);return db[_0x7e04('0x31')][_0x7e04('0x4e')](_['merge'](_0x3494b9,_0x1dcdd3[_0x7e04('0x4f')]),{'include':_0x1dcdd3[_0x7e04('0x37')][_0x7e04('0x45')]?[{'all':!![]}]:undefined})[_0x7e04('0x28')](function(_0x29b719){var _0x5b66ae=_0x1dcdd3[_0x7e04('0x50')]['get']({'plain':!![]});if(!_0x5b66ae)throw new Error(_0x7e04('0x51'));if(_0x5b66ae[_0x7e04('0x52')]===_0x7e04('0x50')){var _0x1dd809=_0x29b719[_0x7e04('0x29')]({'plain':!![]});var _0x247bce=_0x7e04('0x2a');return db[_0x7e04('0x53')][_0x7e04('0x4c')]({'where':{'name':_0x247bce,'userProfileId':_0x5b66ae[_0x7e04('0x54')]},'raw':!![]})[_0x7e04('0x28')](function(_0xd3e0dd){if(_0xd3e0dd&&_0xd3e0dd[_0x7e04('0x5a')]===0x0){return db[_0x7e04('0x2b')][_0x7e04('0x4e')]({'name':_0x1dd809[_0x7e04('0x2e')],'resourceId':_0x1dd809['id'],'type':_0xd3e0dd[_0x7e04('0x2e')],'sectionId':_0xd3e0dd['id']},{})['then'](function(){return _0x29b719;});}else{return _0x29b719;}})[_0x7e04('0x4d')](function(_0x8ce2a2){logger[_0x7e04('0x2c')](_0x7e04('0x55'),_0x8ce2a2);throw _0x8ce2a2;});}return _0x29b719;});}})[_0x7e04('0x28')](respondWithResult(_0x4d1daa,0xc9))['catch'](handleError(_0x4d1daa,null));};exports[_0x7e04('0x5b')]=function(_0x556434,_0x1e91da){if(_0x556434[_0x7e04('0x4f')]['id']){delete _0x556434[_0x7e04('0x4f')]['id'];}return db[_0x7e04('0x31')][_0x7e04('0x4c')]({'where':{'id':_0x556434['params']['id']}})[_0x7e04('0x28')](handleEntityNotFound(_0x1e91da,null))[_0x7e04('0x28')](saveUpdates(_0x556434['body'],null))[_0x7e04('0x28')](respondWithResult(_0x1e91da,null))[_0x7e04('0x4d')](handleError(_0x1e91da,null));};exports['destroy']=function(_0x3f3d57,_0x226a49){return db['Dashboard'][_0x7e04('0x4c')]({'where':{'id':_0x3f3d57[_0x7e04('0x4a')]['id']}})[_0x7e04('0x28')](handleEntityNotFound(_0x226a49,null))[_0x7e04('0x28')](removeEntity(_0x226a49,null))[_0x7e04('0x4d')](handleError(_0x226a49,null));};function widgetAttributes(_0x2ba4a3){try{switch(_0x2ba4a3[_0x7e04('0x34')]){case _0x7e04('0x5c'):return[{'name':_0x7e04('0x5d'),'value':_0x2ba4a3[_0x7e04('0x5d')]||(_0x2ba4a3[_0x7e04('0x5e')]&&_0x2ba4a3['attrs'][0x0]?_0x2ba4a3[_0x7e04('0x5e')][0x0][_0x7e04('0x5f')]:undefined)||_0x7e04('0x60')}];case'custom':return[{'name':_0x7e04('0x61'),'value':_0x2ba4a3[_0x7e04('0x61')]||(_0x2ba4a3[_0x7e04('0x5e')]&&_0x2ba4a3[_0x7e04('0x5e')][0x0]?_0x2ba4a3[_0x7e04('0x5e')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x7e04('0x62'),'value':_0x2ba4a3[_0x7e04('0x62')]||(_0x2ba4a3[_0x7e04('0x5e')]&&_0x2ba4a3[_0x7e04('0x5e')][0x0]?_0x2ba4a3['attrs'][0x0][_0x7e04('0x5f')]:undefined)||'HH:mm:ss'},{'name':_0x7e04('0x63'),'value':_0x2ba4a3[_0x7e04('0x63')]||(_0x2ba4a3[_0x7e04('0x5e')]&&_0x2ba4a3[_0x7e04('0x5e')][0x1]?_0x2ba4a3[_0x7e04('0x5e')][0x1]['value']:undefined)||_0x7e04('0x64')},{'name':_0x7e04('0x65'),'value':_0x2ba4a3[_0x7e04('0x65')]||(_0x2ba4a3[_0x7e04('0x5e')]&&_0x2ba4a3['attrs'][0x2]?_0x2ba4a3[_0x7e04('0x5e')][0x2][_0x7e04('0x5f')]:undefined)||0xc}];case'counter':return[{'name':_0x7e04('0x66'),'value':_0x2ba4a3[_0x7e04('0x66')]||(_0x2ba4a3[_0x7e04('0x5e')]&&_0x2ba4a3['attrs'][0x0]?_0x2ba4a3[_0x7e04('0x5e')][0x0][_0x7e04('0x5f')]:undefined)||_0x7e04('0x67')},{'name':'attrVoiceQueues','value':_0x2ba4a3[_0x7e04('0x68')]||(_0x2ba4a3[_0x7e04('0x5e')]&&_0x2ba4a3['attrs'][0x1]?_0x2ba4a3[_0x7e04('0x5e')][0x1]['value']:undefined)||[]},{'name':_0x7e04('0x65'),'value':_0x2ba4a3[_0x7e04('0x65')]||(_0x2ba4a3[_0x7e04('0x5e')]&&_0x2ba4a3['attrs'][0x2]?_0x2ba4a3['attrs'][0x2][_0x7e04('0x5f')]:undefined)||0x14}];case _0x7e04('0x69'):case _0x7e04('0x6a'):return[{'name':_0x7e04('0x6b'),'value':_0x2ba4a3['attrSerie1']||(_0x2ba4a3[_0x7e04('0x5e')]&&_0x2ba4a3['attrs'][0x0]?_0x2ba4a3[_0x7e04('0x5e')][0x0]['value']:undefined)||_0x7e04('0x67')},{'name':_0x7e04('0x6c'),'value':_0x2ba4a3[_0x7e04('0x6c')]||(_0x2ba4a3['attrs']&&_0x2ba4a3[_0x7e04('0x5e')][0x1]?_0x2ba4a3[_0x7e04('0x5e')][0x1][_0x7e04('0x5f')]:undefined)||null},{'name':_0x7e04('0x6d'),'value':_0x2ba4a3[_0x7e04('0x6d')]||(_0x2ba4a3[_0x7e04('0x5e')]&&_0x2ba4a3[_0x7e04('0x5e')][0x2]?_0x2ba4a3[_0x7e04('0x5e')][0x2][_0x7e04('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2ba4a3[_0x7e04('0x68')]||(_0x2ba4a3['attrs']&&_0x2ba4a3[_0x7e04('0x5e')][0x3]?_0x2ba4a3[_0x7e04('0x5e')][0x3][_0x7e04('0x5f')]:undefined)||[]}];case _0x7e04('0x6e'):return[{'name':'attrReport','type':_0x2ba4a3[_0x7e04('0x6f')]||(_0x2ba4a3[_0x7e04('0x5e')]&&_0x2ba4a3[_0x7e04('0x5e')][0x0]?_0x2ba4a3[_0x7e04('0x5e')][0x0][_0x7e04('0x34')]:undefined)||null,'value':_0x2ba4a3[_0x7e04('0x70')]||(_0x2ba4a3['attrs']&&_0x2ba4a3[_0x7e04('0x5e')][0x0]?_0x2ba4a3['attrs'][0x0]['value']:undefined)||null},{'name':_0x7e04('0x71'),'value':_0x2ba4a3[_0x7e04('0x71')]||(_0x2ba4a3[_0x7e04('0x5e')]&&_0x2ba4a3['attrs'][0x1]?_0x2ba4a3[_0x7e04('0x5e')][0x1][_0x7e04('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x561099){logger[_0x7e04('0x2c')](_0x7e04('0x72'),JSON[_0x7e04('0x73')](_0x561099));return[];}}exports['addItem']=function(_0x526b4c,_0x5cd35b,_0x4b893b){if(_0x526b4c[_0x7e04('0x4f')]['id']){delete _0x526b4c[_0x7e04('0x4f')]['id'];}return db[_0x7e04('0x31')]['find']({'where':{'id':_0x526b4c['params']['id']}})['then'](handleEntityNotFound(_0x5cd35b,null))['then'](function(_0x4edeb3){if(_0x4edeb3){_0x526b4c['body'][_0x7e04('0x74')]=_0x4edeb3['id'];_0x526b4c[_0x7e04('0x4f')][_0x7e04('0x5e')]=widgetAttributes(_0x526b4c[_0x7e04('0x4f')]);return db['DashboardItem']['create'](_0x526b4c['body']);}})[_0x7e04('0x28')](respondWithResult(_0x5cd35b,null))[_0x7e04('0x4d')](handleError(_0x5cd35b,null));};exports['getItems']=function(_0x264541,_0x46f437,_0x20a410){var _0x390be5={};var _0x31923b={};var _0x46bbc0;var _0x1c4661;return db['Dashboard']['findOne']({'where':{'id':_0x264541[_0x7e04('0x4a')]['id']}})['then'](handleEntityNotFound(_0x46f437,null))[_0x7e04('0x28')](function(_0x39db6b){if(_0x39db6b){_0x46bbc0=_0x39db6b;_0x31923b['model']=_['keys'](db['DashboardItem'][_0x7e04('0x32')]);_0x31923b[_0x7e04('0x37')]=_[_0x7e04('0x4b')](_0x264541[_0x7e04('0x37')]);_0x31923b[_0x7e04('0x41')]=_[_0x7e04('0x39')](_0x31923b[_0x7e04('0x36')],_0x31923b[_0x7e04('0x37')]);_0x390be5['attributes']=_[_0x7e04('0x39')](_0x31923b['model'],qs['fields'](_0x264541[_0x7e04('0x37')][_0x7e04('0x3a')]));_0x390be5['attributes']=_0x390be5['attributes'][_0x7e04('0x3b')]?_0x390be5['attributes']:_0x31923b[_0x7e04('0x36')];_0x390be5['order']=qs[_0x7e04('0x3e')](_0x264541[_0x7e04('0x37')][_0x7e04('0x3e')]);_0x390be5[_0x7e04('0x3f')]=qs[_0x7e04('0x41')](_['pick'](_0x264541['query'],_0x31923b[_0x7e04('0x41')]));if(_0x264541[_0x7e04('0x37')][_0x7e04('0x75')]){_0x390be5[_0x7e04('0x3f')]=_['merge'](_0x390be5[_0x7e04('0x3f')],{'$or':_[_0x7e04('0x30')](_0x390be5['attributes'],function(_0x3af5ba){var _0x170ecc={};_0x170ecc[_0x3af5ba]={'$like':'%'+_0x264541[_0x7e04('0x37')][_0x7e04('0x75')]+'%'};return _0x170ecc;})});}_0x390be5=_[_0x7e04('0x42')]({},_0x390be5,_0x264541['options']);return _0x46bbc0[_0x7e04('0x76')](_0x390be5);}})['then'](function(_0x1855cd){if(_0x1855cd){_0x1c4661=_0x1855cd[_0x7e04('0x3b')];if(!_0x264541[_0x7e04('0x37')][_0x7e04('0x3c')](_0x7e04('0x3d'))){_0x390be5[_0x7e04('0x20')]=qs['limit'](_0x264541['query'][_0x7e04('0x20')]);_0x390be5[_0x7e04('0x1f')]=qs['offset'](_0x264541[_0x7e04('0x37')][_0x7e04('0x1f')]);}return _0x46bbc0[_0x7e04('0x76')](_0x390be5);}})[_0x7e04('0x28')](function(_0xc66f6a){if(_0xc66f6a){return _0xc66f6a?{'count':_0x1c4661,'rows':_0xc66f6a}:null;}})[_0x7e04('0x28')](respondWithResult(_0x46f437,null))[_0x7e04('0x4d')](handleError(_0x46f437,null));}; \ No newline at end of file +var _0x5ae6=['attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','rows','catch','show','params','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x5ae6,0x16f));var _0x65ae=function(_0x32d414,_0x4d23da){_0x32d414=_0x32d414-0x0;var _0x4e0bca=_0x5ae6[_0x32d414];return _0x4e0bca;};'use strict';var emlformat=require(_0x65ae('0x0'));var rimraf=require(_0x65ae('0x1'));var zipdir=require(_0x65ae('0x2'));var jsonpatch=require(_0x65ae('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x65ae('0x4'));var Mustache=require(_0x65ae('0x5'));var util=require(_0x65ae('0x6'));var path=require(_0x65ae('0x7'));var sox=require(_0x65ae('0x8'));var csv=require(_0x65ae('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65ae('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x65ae('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x65ae('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x65ae('0xc'));var authService=require(_0x65ae('0xd'));var qs=require(_0x65ae('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65ae('0xf'));var logger=require('../../config/logger')(_0x65ae('0x10'));var utils=require(_0x65ae('0x11'));var config=require(_0x65ae('0x12'));var licenseUtil=require(_0x65ae('0x13'));var db=require(_0x65ae('0x14'))['db'];config['redis']=_[_0x65ae('0x15')](config[_0x65ae('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x65ae('0x17'))(new Redis(config[_0x65ae('0x16')]));require(_0x65ae('0x18'))['register'](socket);function respondWithStatusCode(_0x80b79,_0x2eb107){_0x2eb107=_0x2eb107||0xcc;return function(_0x54a280){if(_0x54a280){return _0x80b79[_0x65ae('0x19')](_0x2eb107);}return _0x80b79[_0x65ae('0x1a')](_0x2eb107)[_0x65ae('0x1b')]();};}function respondWithResult(_0x2f7b90,_0x333e10){_0x333e10=_0x333e10||0xc8;return function(_0x1f96c5){if(_0x1f96c5){return _0x2f7b90['status'](_0x333e10)[_0x65ae('0x1c')](_0x1f96c5);}};}function respondWithFilteredResult(_0x27b9b6,_0x23e7cc){return function(_0x423a02){if(_0x423a02){var _0xfb17b0=typeof _0x23e7cc[_0x65ae('0x1d')]===_0x65ae('0x1e')&&typeof _0x23e7cc[_0x65ae('0x1f')]===_0x65ae('0x1e');var _0x3293a5=_0x423a02['count'];var _0x3f2e26=_0xfb17b0?0x0:_0x23e7cc[_0x65ae('0x1d')];var _0x5ce75c=_0xfb17b0?_0x423a02[_0x65ae('0x20')]:_0x23e7cc['offset']+_0x23e7cc[_0x65ae('0x1f')];var _0x506496;if(_0x5ce75c>=_0x3293a5){_0x5ce75c=_0x3293a5;_0x506496=0xc8;}else{_0x506496=0xce;}_0x27b9b6[_0x65ae('0x1a')](_0x506496);return _0x27b9b6[_0x65ae('0x21')](_0x65ae('0x22'),_0x3f2e26+'-'+_0x5ce75c+'/'+_0x3293a5)[_0x65ae('0x1c')](_0x423a02);}return null;};}function patchUpdates(_0x454cc8){return function(_0x170265){try{jsonpatch[_0x65ae('0x23')](_0x170265,_0x454cc8,!![]);}catch(_0x5d2392){return BPromise['reject'](_0x5d2392);}return _0x170265[_0x65ae('0x24')]();};}function saveUpdates(_0x51ac13,_0x30eb03){return function(_0x56286a){if(_0x56286a){return _0x56286a[_0x65ae('0x25')](_0x51ac13)[_0x65ae('0x26')](function(_0x4dab7a){return _0x4dab7a;});}return null;};}function removeEntity(_0x516ee4,_0x4e311d){return function(_0x29079c){if(_0x29079c){return _0x29079c[_0x65ae('0x27')]()[_0x65ae('0x26')](function(){var _0x26dcd0=_0x29079c[_0x65ae('0x28')]({'plain':!![]});var _0xd20bf9=_0x65ae('0x29');return db[_0x65ae('0x2a')][_0x65ae('0x27')]({'where':{'type':_0xd20bf9,'resourceId':_0x26dcd0['id']}})[_0x65ae('0x26')](function(){return _0x29079c;});})[_0x65ae('0x26')](function(){_0x516ee4[_0x65ae('0x1a')](0xcc)[_0x65ae('0x1b')]();});}};}function handleEntityNotFound(_0x330dd9,_0x505d9f){return function(_0x5d87ce){if(!_0x5d87ce){_0x330dd9[_0x65ae('0x19')](0x194);}return _0x5d87ce;};}function handleError(_0x2afc3f,_0x1ea2a3){_0x1ea2a3=_0x1ea2a3||0x1f4;return function(_0x515850){logger[_0x65ae('0x2b')](_0x515850[_0x65ae('0x2c')]);if(_0x515850[_0x65ae('0x2d')]){delete _0x515850[_0x65ae('0x2d')];}_0x2afc3f[_0x65ae('0x1a')](_0x1ea2a3)[_0x65ae('0x2e')](_0x515850);};}exports[_0x65ae('0x2f')]=function(_0x315e5e,_0x2f734e){var _0xfa3708={},_0x5bd416={},_0x3ba04e={'count':0x0,'rows':[]};var _0x35439e=_[_0x65ae('0x30')](db[_0x65ae('0x31')][_0x65ae('0x32')],function(_0x40f4f1){return{'name':_0x40f4f1[_0x65ae('0x33')],'type':_0x40f4f1[_0x65ae('0x34')][_0x65ae('0x35')]};});_0x5bd416[_0x65ae('0x36')]=_[_0x65ae('0x30')](_0x35439e,_0x65ae('0x2d'));_0x5bd416['query']=_[_0x65ae('0x37')](_0x315e5e[_0x65ae('0x38')]);_0x5bd416[_0x65ae('0x39')]=_[_0x65ae('0x3a')](_0x5bd416[_0x65ae('0x36')],_0x5bd416[_0x65ae('0x38')]);_0xfa3708['attributes']=_[_0x65ae('0x3a')](_0x5bd416[_0x65ae('0x36')],qs[_0x65ae('0x3b')](_0x315e5e['query'][_0x65ae('0x3b')]));_0xfa3708[_0x65ae('0x3c')]=_0xfa3708['attributes'][_0x65ae('0x3d')]?_0xfa3708['attributes']:_0x5bd416['model'];if(!_0x315e5e[_0x65ae('0x38')][_0x65ae('0x3e')](_0x65ae('0x3f'))){_0xfa3708[_0x65ae('0x1f')]=qs[_0x65ae('0x1f')](_0x315e5e[_0x65ae('0x38')][_0x65ae('0x1f')]);_0xfa3708['offset']=qs[_0x65ae('0x1d')](_0x315e5e[_0x65ae('0x38')][_0x65ae('0x1d')]);}_0xfa3708[_0x65ae('0x40')]=qs['sort'](_0x315e5e['query'][_0x65ae('0x41')]);_0xfa3708[_0x65ae('0x42')]=qs[_0x65ae('0x39')](_['pick'](_0x315e5e[_0x65ae('0x38')],_0x5bd416[_0x65ae('0x39')]),_0x35439e);if(_0x315e5e['query'][_0x65ae('0x43')]){_0xfa3708[_0x65ae('0x42')]=_[_0x65ae('0x44')](_0xfa3708[_0x65ae('0x42')],{'$or':_['map'](_0x35439e,function(_0x56a33f){if(_0x56a33f[_0x65ae('0x34')]!=='VIRTUAL'){var _0x1b9d5c={};_0x1b9d5c[_0x56a33f[_0x65ae('0x2d')]]={'$like':'%'+_0x315e5e['query'][_0x65ae('0x43')]+'%'};return _0x1b9d5c;}})});}_0xfa3708=_[_0x65ae('0x44')]({},_0xfa3708,_0x315e5e[_0x65ae('0x45')]);var _0x4316ab={'where':_0xfa3708[_0x65ae('0x42')]};return db[_0x65ae('0x31')][_0x65ae('0x20')](_0x4316ab)[_0x65ae('0x26')](function(_0x420ae6){_0x3ba04e[_0x65ae('0x20')]=_0x420ae6;if(_0x315e5e[_0x65ae('0x38')][_0x65ae('0x46')]){_0xfa3708['include']=[{'all':!![]}];}return db[_0x65ae('0x31')]['findAll'](_0xfa3708);})[_0x65ae('0x26')](function(_0x2edaf2){_0x3ba04e[_0x65ae('0x47')]=_0x2edaf2;return _0x3ba04e;})[_0x65ae('0x26')](respondWithFilteredResult(_0x2f734e,_0xfa3708))[_0x65ae('0x48')](handleError(_0x2f734e,null));};exports[_0x65ae('0x49')]=function(_0x13fea9,_0xfbb3e9){var _0x487fe7={'raw':![],'where':{'id':_0x13fea9[_0x65ae('0x4a')]['id']}},_0x4defed={};_0x4defed['model']=_[_0x65ae('0x37')](db[_0x65ae('0x31')][_0x65ae('0x32')]);_0x4defed[_0x65ae('0x38')]=_[_0x65ae('0x37')](_0x13fea9[_0x65ae('0x38')]);_0x4defed['filters']=_[_0x65ae('0x3a')](_0x4defed[_0x65ae('0x36')],_0x4defed[_0x65ae('0x38')]);_0x487fe7['attributes']=_[_0x65ae('0x3a')](_0x4defed[_0x65ae('0x36')],qs[_0x65ae('0x3b')](_0x13fea9['query'][_0x65ae('0x3b')]));_0x487fe7['attributes']=_0x487fe7[_0x65ae('0x3c')][_0x65ae('0x3d')]?_0x487fe7['attributes']:_0x4defed[_0x65ae('0x36')];if(_0x13fea9[_0x65ae('0x38')][_0x65ae('0x46')]){_0x487fe7[_0x65ae('0x4b')]=[{'all':!![]}];}_0x487fe7=_[_0x65ae('0x44')]({},_0x487fe7,_0x13fea9['options']);return db[_0x65ae('0x31')]['find'](_0x487fe7)[_0x65ae('0x26')](handleEntityNotFound(_0xfbb3e9,null))['then'](respondWithResult(_0xfbb3e9,null))[_0x65ae('0x48')](handleError(_0xfbb3e9,null));};exports[_0x65ae('0x4c')]=function(_0x43af34,_0x46c257){return db['Dashboard']['create'](_0x43af34['body'],{})[_0x65ae('0x26')](function(_0x1ed064){var _0x4760e1=_0x43af34['user'][_0x65ae('0x28')]({'plain':!![]});if(!_0x4760e1)throw new Error(_0x65ae('0x4d'));if(_0x4760e1[_0x65ae('0x4e')]===_0x65ae('0x4f')){var _0xbfc2e0=_0x1ed064[_0x65ae('0x28')]({'plain':!![]});var _0x1b3bd8=_0x65ae('0x29');return db[_0x65ae('0x50')][_0x65ae('0x51')]({'where':{'name':_0x1b3bd8,'userProfileId':_0x4760e1[_0x65ae('0x52')]},'raw':!![]})[_0x65ae('0x26')](function(_0x14c8cb){if(_0x14c8cb&&_0x14c8cb[_0x65ae('0x53')]===0x0){return db[_0x65ae('0x2a')][_0x65ae('0x4c')]({'name':_0xbfc2e0[_0x65ae('0x2d')],'resourceId':_0xbfc2e0['id'],'type':_0x14c8cb[_0x65ae('0x2d')],'sectionId':_0x14c8cb['id']},{})['then'](function(){return _0x1ed064;});}else{return _0x1ed064;}})[_0x65ae('0x48')](function(_0x410d21){logger[_0x65ae('0x2b')](_0x65ae('0x54'),_0x410d21);throw _0x410d21;});}return _0x1ed064;})[_0x65ae('0x26')](respondWithResult(_0x46c257,0xc9))[_0x65ae('0x48')](handleError(_0x46c257,null));};exports['clone']=function(_0x614d00,_0x4d0b10){var _0x423ce8={'where':{'id':_0x614d00[_0x65ae('0x4a')]['id']}},_0x689f53={};_0x689f53[_0x65ae('0x36')]=_[_0x65ae('0x37')](db[_0x65ae('0x31')]['rawAttributes']);_0x423ce8[_0x65ae('0x3c')]=_[_0x65ae('0x3a')](_0x689f53['model'],qs[_0x65ae('0x3b')](_0x614d00[_0x65ae('0x38')][_0x65ae('0x3b')]));_0x423ce8[_0x65ae('0x3c')]=_0x423ce8[_0x65ae('0x3c')][_0x65ae('0x3d')]?_0x423ce8[_0x65ae('0x3c')]:_0x689f53[_0x65ae('0x36')];if(_0x614d00[_0x65ae('0x38')]['includeAll']){_0x423ce8[_0x65ae('0x4b')]=[{'all':!![]}];}_0x423ce8=_[_0x65ae('0x44')]({},_0x423ce8,_0x614d00[_0x65ae('0x45')]);return db['Dashboard'][_0x65ae('0x51')](_0x423ce8)[_0x65ae('0x26')](handleEntityNotFound(_0x4d0b10,null))[_0x65ae('0x26')](function(_0x21d546){if(_0x21d546){var _0x5298e3=_0x21d546[_0x65ae('0x28')]({'plain':!![]});_0x5298e3=qs[_0x65ae('0x55')](_0x5298e3,['id',_0x65ae('0x56'),_0x65ae('0x57')]);_0x614d00[_0x65ae('0x58')]=_[_0x65ae('0x55')](_0x614d00['body'],['id',_0x65ae('0x56'),'updatedAt']);return db[_0x65ae('0x31')][_0x65ae('0x4c')](_[_0x65ae('0x44')](_0x5298e3,_0x614d00[_0x65ae('0x58')]),{'include':_0x614d00[_0x65ae('0x38')][_0x65ae('0x46')]?[{'all':!![]}]:undefined})[_0x65ae('0x26')](function(_0x392d07){var _0x217ae8=_0x614d00['user'][_0x65ae('0x28')]({'plain':!![]});if(!_0x217ae8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x217ae8['role']===_0x65ae('0x4f')){var _0x4e3e29=_0x392d07[_0x65ae('0x28')]({'plain':!![]});var _0x50f3a1=_0x65ae('0x29');return db[_0x65ae('0x50')][_0x65ae('0x51')]({'where':{'name':_0x50f3a1,'userProfileId':_0x217ae8[_0x65ae('0x52')]},'raw':!![]})[_0x65ae('0x26')](function(_0x5d20da){if(_0x5d20da&&_0x5d20da[_0x65ae('0x53')]===0x0){return db[_0x65ae('0x2a')][_0x65ae('0x4c')]({'name':_0x4e3e29[_0x65ae('0x2d')],'resourceId':_0x4e3e29['id'],'type':_0x5d20da['name'],'sectionId':_0x5d20da['id']},{})[_0x65ae('0x26')](function(){return _0x392d07;});}else{return _0x392d07;}})[_0x65ae('0x48')](function(_0x518b79){logger[_0x65ae('0x2b')](_0x65ae('0x54'),_0x518b79);throw _0x518b79;});}return _0x392d07;});}})['then'](respondWithResult(_0x4d0b10,0xc9))[_0x65ae('0x48')](handleError(_0x4d0b10,null));};exports['update']=function(_0x1b0831,_0x53e923){if(_0x1b0831[_0x65ae('0x58')]['id']){delete _0x1b0831[_0x65ae('0x58')]['id'];}return db[_0x65ae('0x31')]['find']({'where':{'id':_0x1b0831[_0x65ae('0x4a')]['id']}})[_0x65ae('0x26')](handleEntityNotFound(_0x53e923,null))[_0x65ae('0x26')](saveUpdates(_0x1b0831[_0x65ae('0x58')],null))['then'](respondWithResult(_0x53e923,null))[_0x65ae('0x48')](handleError(_0x53e923,null));};exports[_0x65ae('0x27')]=function(_0x3fbb31,_0x46c0ec){return db[_0x65ae('0x31')]['find']({'where':{'id':_0x3fbb31[_0x65ae('0x4a')]['id']}})[_0x65ae('0x26')](handleEntityNotFound(_0x46c0ec,null))[_0x65ae('0x26')](removeEntity(_0x46c0ec,null))[_0x65ae('0x48')](handleError(_0x46c0ec,null));};function widgetAttributes(_0x4144a1){try{switch(_0x4144a1[_0x65ae('0x34')]){case _0x65ae('0x59'):return[{'name':_0x65ae('0x5a'),'value':_0x4144a1[_0x65ae('0x5a')]||(_0x4144a1['attrs']&&_0x4144a1[_0x65ae('0x5b')][0x0]?_0x4144a1[_0x65ae('0x5b')][0x0][_0x65ae('0x5c')]:undefined)||_0x65ae('0x5d')}];case'custom':return[{'name':'attrPath','value':_0x4144a1[_0x65ae('0x5e')]||(_0x4144a1['attrs']&&_0x4144a1[_0x65ae('0x5b')][0x0]?_0x4144a1[_0x65ae('0x5b')][0x0][_0x65ae('0x5c')]:undefined)||''}];case'clock':return[{'name':_0x65ae('0x5f'),'value':_0x4144a1[_0x65ae('0x5f')]||(_0x4144a1[_0x65ae('0x5b')]&&_0x4144a1[_0x65ae('0x5b')][0x0]?_0x4144a1[_0x65ae('0x5b')][0x0][_0x65ae('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0x65ae('0x60'),'value':_0x4144a1[_0x65ae('0x60')]||(_0x4144a1[_0x65ae('0x5b')]&&_0x4144a1[_0x65ae('0x5b')][0x1]?_0x4144a1[_0x65ae('0x5b')][0x1][_0x65ae('0x5c')]:undefined)||_0x65ae('0x61')},{'name':_0x65ae('0x62'),'value':_0x4144a1['attrFontSize']||(_0x4144a1['attrs']&&_0x4144a1[_0x65ae('0x5b')][0x2]?_0x4144a1[_0x65ae('0x5b')][0x2][_0x65ae('0x5c')]:undefined)||0xc}];case _0x65ae('0x63'):return[{'name':_0x65ae('0x64'),'value':_0x4144a1[_0x65ae('0x64')]||(_0x4144a1[_0x65ae('0x5b')]&&_0x4144a1[_0x65ae('0x5b')][0x0]?_0x4144a1[_0x65ae('0x5b')][0x0]['value']:undefined)||_0x65ae('0x65')},{'name':'attrVoiceQueues','value':_0x4144a1[_0x65ae('0x66')]||(_0x4144a1[_0x65ae('0x5b')]&&_0x4144a1[_0x65ae('0x5b')][0x1]?_0x4144a1[_0x65ae('0x5b')][0x1][_0x65ae('0x5c')]:undefined)||[]},{'name':_0x65ae('0x62'),'value':_0x4144a1[_0x65ae('0x62')]||(_0x4144a1[_0x65ae('0x5b')]&&_0x4144a1[_0x65ae('0x5b')][0x2]?_0x4144a1[_0x65ae('0x5b')][0x2][_0x65ae('0x5c')]:undefined)||0x14}];case _0x65ae('0x67'):case _0x65ae('0x68'):return[{'name':_0x65ae('0x69'),'value':_0x4144a1[_0x65ae('0x69')]||(_0x4144a1[_0x65ae('0x5b')]&&_0x4144a1['attrs'][0x0]?_0x4144a1['attrs'][0x0]['value']:undefined)||_0x65ae('0x65')},{'name':_0x65ae('0x6a'),'value':_0x4144a1['attrSerie2']||(_0x4144a1[_0x65ae('0x5b')]&&_0x4144a1['attrs'][0x1]?_0x4144a1[_0x65ae('0x5b')][0x1][_0x65ae('0x5c')]:undefined)||null},{'name':'attrSerie3','value':_0x4144a1[_0x65ae('0x6b')]||(_0x4144a1['attrs']&&_0x4144a1['attrs'][0x2]?_0x4144a1[_0x65ae('0x5b')][0x2][_0x65ae('0x5c')]:undefined)||null},{'name':_0x65ae('0x66'),'value':_0x4144a1[_0x65ae('0x66')]||(_0x4144a1['attrs']&&_0x4144a1[_0x65ae('0x5b')][0x3]?_0x4144a1[_0x65ae('0x5b')][0x3]['value']:undefined)||[]}];case _0x65ae('0x6c'):return[{'name':_0x65ae('0x6d'),'type':_0x4144a1[_0x65ae('0x6e')]||(_0x4144a1['attrs']&&_0x4144a1[_0x65ae('0x5b')][0x0]?_0x4144a1['attrs'][0x0]['type']:undefined)||null,'value':_0x4144a1[_0x65ae('0x6d')]||(_0x4144a1['attrs']&&_0x4144a1[_0x65ae('0x5b')][0x0]?_0x4144a1[_0x65ae('0x5b')][0x0]['value']:undefined)||null},{'name':_0x65ae('0x6f'),'value':_0x4144a1[_0x65ae('0x6f')]||(_0x4144a1['attrs']&&_0x4144a1[_0x65ae('0x5b')][0x1]?_0x4144a1[_0x65ae('0x5b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x18c5b2){logger['error'](_0x65ae('0x70'),JSON[_0x65ae('0x71')](_0x18c5b2));return[];}}exports[_0x65ae('0x72')]=function(_0x3bf30e,_0x45c9de,_0x17aaff){if(_0x3bf30e[_0x65ae('0x58')]['id']){delete _0x3bf30e[_0x65ae('0x58')]['id'];}return db['Dashboard'][_0x65ae('0x51')]({'where':{'id':_0x3bf30e[_0x65ae('0x4a')]['id']}})[_0x65ae('0x26')](handleEntityNotFound(_0x45c9de,null))[_0x65ae('0x26')](function(_0x261c3c){if(_0x261c3c){_0x3bf30e[_0x65ae('0x58')][_0x65ae('0x73')]=_0x261c3c['id'];_0x3bf30e['body']['attrs']=widgetAttributes(_0x3bf30e[_0x65ae('0x58')]);return db[_0x65ae('0x74')][_0x65ae('0x4c')](_0x3bf30e[_0x65ae('0x58')]);}})[_0x65ae('0x26')](respondWithResult(_0x45c9de,null))[_0x65ae('0x48')](handleError(_0x45c9de,null));};exports[_0x65ae('0x75')]=function(_0x9fac13,_0x48f4e2,_0x9e5d4b){var _0x368922={};var _0x2c4b18={};var _0x265269;var _0x31fede;return db[_0x65ae('0x31')][_0x65ae('0x76')]({'where':{'id':_0x9fac13[_0x65ae('0x4a')]['id']}})[_0x65ae('0x26')](handleEntityNotFound(_0x48f4e2,null))[_0x65ae('0x26')](function(_0x1ecc90){if(_0x1ecc90){_0x265269=_0x1ecc90;_0x2c4b18['model']=_[_0x65ae('0x37')](db[_0x65ae('0x74')][_0x65ae('0x32')]);_0x2c4b18[_0x65ae('0x38')]=_[_0x65ae('0x37')](_0x9fac13[_0x65ae('0x38')]);_0x2c4b18[_0x65ae('0x39')]=_[_0x65ae('0x3a')](_0x2c4b18[_0x65ae('0x36')],_0x2c4b18[_0x65ae('0x38')]);_0x368922[_0x65ae('0x3c')]=_[_0x65ae('0x3a')](_0x2c4b18[_0x65ae('0x36')],qs['fields'](_0x9fac13[_0x65ae('0x38')]['fields']));_0x368922[_0x65ae('0x3c')]=_0x368922['attributes'][_0x65ae('0x3d')]?_0x368922[_0x65ae('0x3c')]:_0x2c4b18[_0x65ae('0x36')];_0x368922[_0x65ae('0x40')]=qs[_0x65ae('0x41')](_0x9fac13[_0x65ae('0x38')][_0x65ae('0x41')]);_0x368922[_0x65ae('0x42')]=qs['filters'](_['pick'](_0x9fac13[_0x65ae('0x38')],_0x2c4b18[_0x65ae('0x39')]));if(_0x9fac13[_0x65ae('0x38')][_0x65ae('0x43')]){_0x368922['where']=_['merge'](_0x368922[_0x65ae('0x42')],{'$or':_[_0x65ae('0x30')](_0x368922[_0x65ae('0x3c')],function(_0x3a12ca){var _0x52cb85={};_0x52cb85[_0x3a12ca]={'$like':'%'+_0x9fac13[_0x65ae('0x38')][_0x65ae('0x43')]+'%'};return _0x52cb85;})});}_0x368922=_[_0x65ae('0x44')]({},_0x368922,_0x9fac13[_0x65ae('0x45')]);return _0x265269[_0x65ae('0x75')](_0x368922);}})[_0x65ae('0x26')](function(_0x5ece65){if(_0x5ece65){_0x31fede=_0x5ece65[_0x65ae('0x3d')];if(!_0x9fac13[_0x65ae('0x38')][_0x65ae('0x3e')](_0x65ae('0x3f'))){_0x368922[_0x65ae('0x1f')]=qs[_0x65ae('0x1f')](_0x9fac13[_0x65ae('0x38')][_0x65ae('0x1f')]);_0x368922[_0x65ae('0x1d')]=qs[_0x65ae('0x1d')](_0x9fac13[_0x65ae('0x38')]['offset']);}return _0x265269[_0x65ae('0x75')](_0x368922);}})['then'](function(_0x849cb5){if(_0x849cb5){return _0x849cb5?{'count':_0x31fede,'rows':_0x849cb5}:null;}})['then'](respondWithResult(_0x48f4e2,null))['catch'](handleError(_0x48f4e2,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 1cbd52a..dac8e1a 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 _0xa9c3=['Dashboard','setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x1139d0,_0x41e5f8){var _0xcc01a6=function(_0x504ffa){while(--_0x504ffa){_0x1139d0['push'](_0x1139d0['shift']());}};_0xcc01a6(++_0x41e5f8);}(_0xa9c3,0x167));var _0x3a9c=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xa9c3[_0x49b207];return _0x2dc8fa;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x3a9c('0x0'))['db'][_0x3a9c('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3a9c('0x2')](0x0);var events={'afterCreate':_0x3a9c('0x3'),'afterUpdate':'update','afterDestroy':_0x3a9c('0x4')};function emitEvent(_0x12b6b7){return function(_0x54a622,_0x1e04f5,_0x1b075f){DashboardEvents['emit'](_0x12b6b7+':'+_0x54a622['id'],_0x54a622);DashboardEvents[_0x3a9c('0x5')](_0x12b6b7,_0x54a622);_0x1b075f(null);};}for(var e in events){if(events[_0x3a9c('0x6')](e)){var event=events[e];Dashboard[_0x3a9c('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x7d0e=['emit','hook','events','../../mysqldb','Dashboard','setMaxListeners','save','remove'];(function(_0x8ccf38,_0x1c4b39){var _0x30cd54=function(_0x556d39){while(--_0x556d39){_0x8ccf38['push'](_0x8ccf38['shift']());}};_0x30cd54(++_0x1c4b39);}(_0x7d0e,0xb2));var _0xe7d0=function(_0x28f7f8,_0x3a801b){_0x28f7f8=_0x28f7f8-0x0;var _0x57b872=_0x7d0e[_0x28f7f8];return _0x57b872;};'use strict';var EventEmitter=require(_0xe7d0('0x0'));var Dashboard=require(_0xe7d0('0x1'))['db'][_0xe7d0('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xe7d0('0x3')](0x0);var events={'afterCreate':_0xe7d0('0x4'),'afterUpdate':'update','afterDestroy':_0xe7d0('0x5')};function emitEvent(_0x4d6460){return function(_0x24a6ff,_0x1e5082,_0x51f06a){DashboardEvents['emit'](_0x4d6460+':'+_0x24a6ff['id'],_0x24a6ff);DashboardEvents[_0xe7d0('0x6')](_0x4d6460,_0x24a6ff);_0x51f06a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xe7d0('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 26f30be..c6fffc2 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 _0x44aa=['define','Dashboard','lodash','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x54218e,_0x1b09dd){var _0x3c8e20=function(_0x5115b2){while(--_0x5115b2){_0x54218e['push'](_0x54218e['shift']());}};_0x3c8e20(++_0x1b09dd);}(_0x44aa,0x1aa));var _0xa44a=function(_0x2b8fc6,_0x20daec){_0x2b8fc6=_0x2b8fc6-0x0;var _0x203aa1=_0x44aa[_0x2b8fc6];return _0x203aa1;};'use strict';var _=require(_0xa44a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa44a('0x1'));var BPromise=require(_0xa44a('0x2'));var rp=require(_0xa44a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa44a('0x4'));var attributes=require('./dashboard.attributes');module[_0xa44a('0x5')]=function(_0x173177,_0x5ca0e9){return _0x173177[_0xa44a('0x6')](_0xa44a('0x7'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5168=['api','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','util','../../config/logger'];(function(_0x3f2a8f,_0x2a28cb){var _0xd9e68b=function(_0x48e253){while(--_0x48e253){_0x3f2a8f['push'](_0x3f2a8f['shift']());}};_0xd9e68b(++_0x2a28cb);}(_0x5168,0x136));var _0x8516=function(_0x241386,_0xcbb31f){_0x241386=_0x241386-0x0;var _0x1135cd=_0x5168[_0x241386];return _0x1135cd;};'use strict';var _=require('lodash');var util=require(_0x8516('0x0'));var logger=require(_0x8516('0x1'))(_0x8516('0x2'));var moment=require('moment');var BPromise=require(_0x8516('0x3'));var rp=require(_0x8516('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8516('0x5'));var config=require(_0x8516('0x6'));var attributes=require(_0x8516('0x7'));module[_0x8516('0x8')]=function(_0x48d999,_0x53b9c6){return _0x48d999[_0x8516('0x9')](_0x8516('0xa'),attributes,{'tableName':_0x8516('0xb'),'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 9886086..6484314 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 _0x1527=['stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x1527,0x12e));var _0x7152=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x1527[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require(_0x7152('0x0'));var moment=require(_0x7152('0x1'));var BPromise=require(_0x7152('0x2'));var rs=require(_0x7152('0x3'));var fs=require('fs');var Redis=require(_0x7152('0x4'));var db=require(_0x7152('0x5'))['db'];var utils=require(_0x7152('0x6'));var logger=require(_0x7152('0x7'))(_0x7152('0x8'));var config=require(_0x7152('0x9'));var jayson=require(_0x7152('0xa'));var client=jayson['client'][_0x7152('0xb')]({'port':0x232a});config[_0x7152('0xc')]=_['defaults'](config[_0x7152('0xc')],{'host':_0x7152('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7152('0xc')]));require(_0x7152('0xe'))[_0x7152('0xf')](socket);function respondWithRpcPromise(_0x4c4eef,_0x435d29,_0x32d9f6){return new BPromise(function(_0x41e244,_0x481519){return client['request'](_0x4c4eef,_0x32d9f6)[_0x7152('0x10')](function(_0x40f77d){logger[_0x7152('0x11')](_0x7152('0x12'),_0x435d29,_0x7152('0x13'));logger[_0x7152('0x14')](_0x7152('0x15'),_0x435d29,'request\x20sent',JSON[_0x7152('0x16')](_0x40f77d));if(_0x40f77d[_0x7152('0x17')]){if(_0x40f77d[_0x7152('0x17')][_0x7152('0x18')]===0x1f4){logger[_0x7152('0x17')](_0x7152('0x12'),_0x435d29,_0x40f77d['error'][_0x7152('0x19')]);return _0x481519(_0x40f77d[_0x7152('0x17')][_0x7152('0x19')]);}logger[_0x7152('0x17')]('Dashboard,\x20%s,\x20%s',_0x435d29,_0x40f77d['error'][_0x7152('0x19')]);return _0x41e244(_0x40f77d[_0x7152('0x17')][_0x7152('0x19')]);}else{logger[_0x7152('0x11')]('Dashboard,\x20%s,\x20%s',_0x435d29,_0x7152('0x13'));_0x41e244(_0x40f77d[_0x7152('0x1a')][_0x7152('0x19')]);}})['catch'](function(_0x797690){logger[_0x7152('0x17')](_0x7152('0x12'),_0x435d29,_0x797690);_0x481519(_0x797690);});});} \ No newline at end of file +var _0x22b9=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1d5d16,_0x132ed8){var _0x11be18=function(_0x2cf37f){while(--_0x2cf37f){_0x1d5d16['push'](_0x1d5d16['shift']());}};_0x11be18(++_0x132ed8);}(_0x22b9,0x9a));var _0x922b=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x22b9[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0x922b('0x0'));var util=require(_0x922b('0x1'));var moment=require(_0x922b('0x2'));var BPromise=require(_0x922b('0x3'));var rs=require(_0x922b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x922b('0x5'))['db'];var utils=require(_0x922b('0x6'));var logger=require(_0x922b('0x7'))('rpc');var config=require(_0x922b('0x8'));var jayson=require(_0x922b('0x9'));var client=jayson[_0x922b('0xa')][_0x922b('0xb')]({'port':0x232a});config[_0x922b('0xc')]=_[_0x922b('0xd')](config[_0x922b('0xc')],{'host':_0x922b('0xe'),'port':0x18eb});var socket=require(_0x922b('0xf'))(new Redis(config[_0x922b('0xc')]));require(_0x922b('0x10'))[_0x922b('0x11')](socket);function respondWithRpcPromise(_0x4c05a5,_0x460a72,_0x3eeb4e){return new BPromise(function(_0x30c95f,_0x146ead){return client['request'](_0x4c05a5,_0x3eeb4e)[_0x922b('0x12')](function(_0x5ede9a){logger[_0x922b('0x13')](_0x922b('0x14'),_0x460a72,'request\x20sent');logger[_0x922b('0x15')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x460a72,'request\x20sent',JSON[_0x922b('0x16')](_0x5ede9a));if(_0x5ede9a[_0x922b('0x17')]){if(_0x5ede9a['error'][_0x922b('0x18')]===0x1f4){logger[_0x922b('0x17')]('Dashboard,\x20%s,\x20%s',_0x460a72,_0x5ede9a['error']['message']);return _0x146ead(_0x5ede9a['error']['message']);}logger['error'](_0x922b('0x14'),_0x460a72,_0x5ede9a[_0x922b('0x17')][_0x922b('0x19')]);return _0x30c95f(_0x5ede9a[_0x922b('0x17')]['message']);}else{logger[_0x922b('0x13')](_0x922b('0x14'),_0x460a72,'request\x20sent');_0x30c95f(_0x5ede9a['result'][_0x922b('0x19')]);}})[_0x922b('0x1a')](function(_0x9983c){logger['error'](_0x922b('0x14'),_0x460a72,_0x9983c);_0x146ead(_0x9983c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index fe37263..eaff90d 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 _0xdb58=['save','update','emit','register','length','./dashboard.events'];(function(_0x24e65f,_0xa66cf){var _0x3c5924=function(_0x4d0f10){while(--_0x4d0f10){_0x24e65f['push'](_0x24e65f['shift']());}};_0x3c5924(++_0xa66cf);}(_0xdb58,0x167));var _0x8db5=function(_0x1eb9eb,_0x1f4b8d){_0x1eb9eb=_0x1eb9eb-0x0;var _0x2eaabf=_0xdb58[_0x1eb9eb];return _0x2eaabf;};'use strict';var DashboardEvents=require(_0x8db5('0x0'));var events=[_0x8db5('0x1'),'remove',_0x8db5('0x2')];function createListener(_0x3ec328,_0x5eb6fd){return function(_0xfb99a1){_0x5eb6fd[_0x8db5('0x3')](_0x3ec328,_0xfb99a1);};}function removeListener(_0x9ba50,_0xf6da5c){return function(){DashboardEvents['removeListener'](_0x9ba50,_0xf6da5c);};}exports[_0x8db5('0x4')]=function(_0x5355aa){for(var _0x1a0d90=0x0,_0x2c7a57=events[_0x8db5('0x5')];_0x1a0d90<_0x2c7a57;_0x1a0d90++){var _0x4e07d7=events[_0x1a0d90];var _0x188799=createListener('dashboard:'+_0x4e07d7,_0x5355aa);DashboardEvents['on'](_0x4e07d7,_0x188799);}}; \ No newline at end of file +var _0x8aca=['emit','register','dashboard:','./dashboard.events','remove','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8aca,0x117));var _0xa8ac=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x8aca[_0x22e9fe];return _0x47cd19;};'use strict';var DashboardEvents=require(_0xa8ac('0x0'));var events=['save',_0xa8ac('0x1'),_0xa8ac('0x2')];function createListener(_0x440564,_0x4cca1f){return function(_0x30adba){_0x4cca1f[_0xa8ac('0x3')](_0x440564,_0x30adba);};}function removeListener(_0x586aec,_0x2d87cc){return function(){DashboardEvents['removeListener'](_0x586aec,_0x2d87cc);};}exports[_0xa8ac('0x4')]=function(_0x618f26){for(var _0x1c1812=0x0,_0x5f5a11=events['length'];_0x1c1812<_0x5f5a11;_0x1c1812++){var _0x153781=events[_0x1c1812];var _0x2a0f59=createListener(_0xa8ac('0x5')+_0x153781,_0x618f26);DashboardEvents['on'](_0x153781,_0x2a0f59);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5841000..6a48766 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 _0x55e0=['isAuthenticated','show','/:id/items','post','create','/:id/clone','addItem','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get'];(function(_0x1b0bdb,_0x41c282){var _0x9b2bc6=function(_0xa96e55){while(--_0xa96e55){_0x1b0bdb['push'](_0x1b0bdb['shift']());}};_0x9b2bc6(++_0x41c282);}(_0x55e0,0xdc));var _0x055e=function(_0x32672c,_0xe823d){_0x32672c=_0x32672c-0x0;var _0x32a8ed=_0x55e0[_0x32672c];return _0x32a8ed;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/:id',auth[_0x055e('0xa')](),controller[_0x055e('0xb')]);router[_0x055e('0x9')](_0x055e('0xc'),auth[_0x055e('0xa')](),controller['getItems']);router[_0x055e('0xd')]('/',auth[_0x055e('0xa')](),controller[_0x055e('0xe')]);router[_0x055e('0xd')](_0x055e('0xf'),auth['isAuthenticated'](),controller['clone']);router[_0x055e('0xd')]('/:id/items',auth[_0x055e('0xa')](),controller[_0x055e('0x10')]);router[_0x055e('0x11')](_0x055e('0x12'),auth[_0x055e('0xa')](),controller[_0x055e('0x13')]);router[_0x055e('0x14')]('/:id',auth[_0x055e('0xa')](),controller[_0x055e('0x15')]);module[_0x055e('0x16')]=router; \ No newline at end of file +var _0xec56=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','clone','addItem','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xec56,0x1bd));var _0x6ec5=function(_0x13c2fc,_0xfc4e29){_0x13c2fc=_0x13c2fc-0x0;var _0x598b56=_0xec56[_0x13c2fc];return _0x598b56;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0x9')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router['post']('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x10')]);router[_0x6ec5('0x11')](_0x6ec5('0x12'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x13')]);router[_0x6ec5('0x11')]('/:id/items',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x14')]);router[_0x6ec5('0x15')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x16')]);router[_0x6ec5('0x17')](_0x6ec5('0xc'),auth['isAuthenticated'](),controller[_0x6ec5('0x18')]);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 e2b07c6..f809a28 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 _0x4f99=['STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','lodash'];(function(_0x46ec68,_0x9cbd97){var _0x373338=function(_0x5201e1){while(--_0x5201e1){_0x46ec68['push'](_0x46ec68['shift']());}};_0x373338(++_0x9cbd97);}(_0x4f99,0x177));var _0x94f9=function(_0x31cc87,_0x325e95){_0x31cc87=_0x31cc87-0x0;var _0x1b8298=_0x4f99[_0x31cc87];return _0x1b8298;};'use strict';var Sequelize=require(_0x94f9('0x0'));var squel=require('squel');var _=require(_0x94f9('0x1'));module['exports']={'title':{'type':Sequelize[_0x94f9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x94f9('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x94f9('0x3')](_0x94f9('0x4')),'get':function(){try{return JSON[_0x94f9('0x5')](this[_0x94f9('0x6')](_0x94f9('0x7')));}catch(_0x14acee){return[];}},'set':function(_0x2993b9){try{this[_0x94f9('0x8')]('attrs',JSON[_0x94f9('0x9')](_0x2993b9));}catch(_0x1e3caf){this[_0x94f9('0x8')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x94f9('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x94f9('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x94f9('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x94f9('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x94f9('0x2')]},'titleFontSize':{'type':Sequelize[_0x94f9('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xed4a=['squel','lodash','exports','STRING','long','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xed4a,0xc6));var _0xaed4=function(_0x16b724,_0x4a365a){_0x16b724=_0x16b724-0x0;var _0x2950ff=_0xed4a[_0x16b724];return _0x2950ff;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xaed4('0x0'));var _=require(_0xaed4('0x1'));module[_0xaed4('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xaed4('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xaed4('0x4')),'get':function(){try{return JSON['parse'](this[_0xaed4('0x5')](_0xaed4('0x6')));}catch(_0x2671ec){return[];}},'set':function(_0x1e13ce){try{this[_0xaed4('0x7')](_0xaed4('0x6'),JSON[_0xaed4('0x8')](_0x1e13ce));}catch(_0x49e3bf){this[_0xaed4('0x7')](_0xaed4('0x6'),JSON[_0xaed4('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xaed4('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xaed4('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xaed4('0x9')]},'col':{'type':Sequelize[_0xaed4('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaed4('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xaed4('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xaed4('0x3')]},'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 42e2aba..ee7d7e8 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 _0xff92=['lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./dashboardItem.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','options','find','catch','DashboardItem','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','body','create','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra'];(function(_0x3d5936,_0x19c4d6){var _0x4c924e=function(_0x3924b4){while(--_0x3924b4){_0x3d5936['push'](_0x3d5936['shift']());}};_0x4c924e(++_0x19c4d6);}(_0xff92,0x11a));var _0x2ff9=function(_0x13f43c,_0x273f4e){_0x13f43c=_0x13f43c-0x0;var _0x48ca4e=_0xff92[_0x13f43c];return _0x48ca4e;};'use strict';var emlformat=require(_0x2ff9('0x0'));var rimraf=require(_0x2ff9('0x1'));var zipdir=require(_0x2ff9('0x2'));var jsonpatch=require(_0x2ff9('0x3'));var rp=require(_0x2ff9('0x4'));var moment=require(_0x2ff9('0x5'));var BPromise=require(_0x2ff9('0x6'));var Mustache=require(_0x2ff9('0x7'));var util=require(_0x2ff9('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x2ff9('0x9'));var ejs=require(_0x2ff9('0xa'));var fs=require('fs');var fs_extra=require(_0x2ff9('0xb'));var _=require(_0x2ff9('0xc'));var squel=require(_0x2ff9('0xd'));var crypto=require(_0x2ff9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2ff9('0x9'));var querystring=require(_0x2ff9('0xf'));var Papa=require(_0x2ff9('0x10'));var Redis=require(_0x2ff9('0x11'));var authService=require(_0x2ff9('0x12'));var qs=require(_0x2ff9('0x13'));var as=require(_0x2ff9('0x14'));var hardwareService=require(_0x2ff9('0x15'));var logger=require(_0x2ff9('0x16'))(_0x2ff9('0x17'));var utils=require(_0x2ff9('0x18'));var config=require(_0x2ff9('0x19'));var licenseUtil=require(_0x2ff9('0x1a'));var db=require(_0x2ff9('0x1b'))['db'];config['redis']=_[_0x2ff9('0x1c')](config[_0x2ff9('0x1d')],{'host':_0x2ff9('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ff9('0x1d')]));require(_0x2ff9('0x1f'))[_0x2ff9('0x20')](socket);function respondWithStatusCode(_0x48cd80,_0x2cba59){_0x2cba59=_0x2cba59||0xcc;return function(_0x1cafb8){if(_0x1cafb8){return _0x48cd80['sendStatus'](_0x2cba59);}return _0x48cd80[_0x2ff9('0x21')](_0x2cba59)[_0x2ff9('0x22')]();};}function respondWithResult(_0x320d36,_0x5433b0){_0x5433b0=_0x5433b0||0xc8;return function(_0x3a6a8c){if(_0x3a6a8c){return _0x320d36[_0x2ff9('0x21')](_0x5433b0)[_0x2ff9('0x23')](_0x3a6a8c);}};}function respondWithFilteredResult(_0x306c09,_0x16cde6){return function(_0x48aa38){if(_0x48aa38){var _0x55f95a=typeof _0x16cde6[_0x2ff9('0x24')]===_0x2ff9('0x25')&&typeof _0x16cde6[_0x2ff9('0x26')]===_0x2ff9('0x25');var _0x309967=_0x48aa38['count'];var _0x246687=_0x55f95a?0x0:_0x16cde6[_0x2ff9('0x24')];var _0x3a84b6=_0x55f95a?_0x48aa38[_0x2ff9('0x27')]:_0x16cde6[_0x2ff9('0x24')]+_0x16cde6[_0x2ff9('0x26')];var _0x165048;if(_0x3a84b6>=_0x309967){_0x3a84b6=_0x309967;_0x165048=0xc8;}else{_0x165048=0xce;}_0x306c09[_0x2ff9('0x21')](_0x165048);return _0x306c09[_0x2ff9('0x28')](_0x2ff9('0x29'),_0x246687+'-'+_0x3a84b6+'/'+_0x309967)[_0x2ff9('0x23')](_0x48aa38);}return null;};}function patchUpdates(_0x18322){return function(_0x47c827){try{jsonpatch[_0x2ff9('0x2a')](_0x47c827,_0x18322,!![]);}catch(_0x55b82c){return BPromise[_0x2ff9('0x2b')](_0x55b82c);}return _0x47c827[_0x2ff9('0x2c')]();};}function saveUpdates(_0xf92fbc,_0x6e933a){return function(_0x66a86f){if(_0x66a86f){return _0x66a86f['update'](_0xf92fbc)[_0x2ff9('0x2d')](function(_0x584bec){return _0x584bec;});}return null;};}function removeEntity(_0x471a2a,_0x13be7f){return function(_0x898a57){if(_0x898a57){return _0x898a57[_0x2ff9('0x2e')]()[_0x2ff9('0x2d')](function(){_0x471a2a[_0x2ff9('0x21')](0xcc)[_0x2ff9('0x22')]();});}};}function handleEntityNotFound(_0x156462,_0x30597f){return function(_0x33fb32){if(!_0x33fb32){_0x156462[_0x2ff9('0x2f')](0x194);}return _0x33fb32;};}function handleError(_0x181455,_0x4e127d){_0x4e127d=_0x4e127d||0x1f4;return function(_0x412f77){logger[_0x2ff9('0x30')](_0x412f77['stack']);if(_0x412f77['name']){delete _0x412f77[_0x2ff9('0x31')];}_0x181455[_0x2ff9('0x21')](_0x4e127d)[_0x2ff9('0x32')](_0x412f77);};}exports[_0x2ff9('0x33')]=function(_0x2b11bc,_0x59719c){var _0x11eac5={'raw':![],'where':{'id':_0x2b11bc[_0x2ff9('0x34')]['id']}},_0xde16a8={};_0xde16a8[_0x2ff9('0x35')]=_[_0x2ff9('0x36')](db['DashboardItem'][_0x2ff9('0x37')]);_0xde16a8[_0x2ff9('0x38')]=_['keys'](_0x2b11bc[_0x2ff9('0x38')]);_0xde16a8[_0x2ff9('0x39')]=_[_0x2ff9('0x3a')](_0xde16a8[_0x2ff9('0x35')],_0xde16a8['query']);_0x11eac5['attributes']=_[_0x2ff9('0x3a')](_0xde16a8[_0x2ff9('0x35')],qs[_0x2ff9('0x3b')](_0x2b11bc[_0x2ff9('0x38')][_0x2ff9('0x3b')]));_0x11eac5[_0x2ff9('0x3c')]=_0x11eac5[_0x2ff9('0x3c')][_0x2ff9('0x3d')]?_0x11eac5[_0x2ff9('0x3c')]:_0xde16a8['model'];if(_0x2b11bc[_0x2ff9('0x38')]['includeAll']){_0x11eac5[_0x2ff9('0x3e')]=[{'all':!![]}];}_0x11eac5=_[_0x2ff9('0x3f')]({},_0x11eac5,_0x2b11bc[_0x2ff9('0x40')]);return db['DashboardItem'][_0x2ff9('0x41')](_0x11eac5)[_0x2ff9('0x2d')](handleEntityNotFound(_0x59719c,null))[_0x2ff9('0x2d')](respondWithResult(_0x59719c,null))[_0x2ff9('0x42')](handleError(_0x59719c,null));};exports[_0x2ff9('0x2e')]=function(_0x26661d,_0x47b217){return db[_0x2ff9('0x43')]['find']({'where':{'id':_0x26661d['params']['id']}})['then'](handleEntityNotFound(_0x47b217,null))['then'](removeEntity(_0x47b217,null))[_0x2ff9('0x42')](handleError(_0x47b217,null));};function widgetAttributes(_0x1ec487){try{switch(_0x1ec487[_0x2ff9('0x44')]){case _0x2ff9('0x45'):return[{'name':_0x2ff9('0x46'),'value':_0x1ec487[_0x2ff9('0x46')]||(_0x1ec487['attrs']&&_0x1ec487[_0x2ff9('0x47')][0x0]?_0x1ec487[_0x2ff9('0x47')][0x0][_0x2ff9('0x48')]:undefined)||_0x2ff9('0x49')}];case _0x2ff9('0x4a'):return[{'name':_0x2ff9('0x4b'),'value':_0x1ec487[_0x2ff9('0x4b')]||(_0x1ec487[_0x2ff9('0x47')]&&_0x1ec487[_0x2ff9('0x47')][0x0]?_0x1ec487[_0x2ff9('0x47')][0x0][_0x2ff9('0x48')]:undefined)||''}];case _0x2ff9('0x4c'):return[{'name':_0x2ff9('0x4d'),'value':_0x1ec487[_0x2ff9('0x4d')]||(_0x1ec487[_0x2ff9('0x47')]&&_0x1ec487['attrs'][0x0]?_0x1ec487['attrs'][0x0][_0x2ff9('0x48')]:undefined)||_0x2ff9('0x4e')},{'name':_0x2ff9('0x4f'),'value':_0x1ec487['attrTimezone']||(_0x1ec487[_0x2ff9('0x47')]&&_0x1ec487[_0x2ff9('0x47')][0x1]?_0x1ec487[_0x2ff9('0x47')][0x1][_0x2ff9('0x48')]:undefined)||_0x2ff9('0x50')},{'name':_0x2ff9('0x51'),'value':_0x1ec487[_0x2ff9('0x51')]||(_0x1ec487['attrs']&&_0x1ec487[_0x2ff9('0x47')][0x2]?_0x1ec487[_0x2ff9('0x47')][0x2][_0x2ff9('0x48')]:undefined)||0xc}];case'counter':return[{'name':_0x2ff9('0x52'),'value':_0x1ec487['attrMetric']||(_0x1ec487['attrs']&&_0x1ec487[_0x2ff9('0x47')][0x0]?_0x1ec487[_0x2ff9('0x47')][0x0]['value']:undefined)||_0x2ff9('0x53')},{'name':_0x2ff9('0x54'),'value':_0x1ec487['attrVoiceQueues']||(_0x1ec487['attrs']&&_0x1ec487['attrs'][0x1]?_0x1ec487[_0x2ff9('0x47')][0x1]['value']:undefined)||[]},{'name':_0x2ff9('0x51'),'value':_0x1ec487[_0x2ff9('0x51')]||(_0x1ec487[_0x2ff9('0x47')]&&_0x1ec487[_0x2ff9('0x47')][0x2]?_0x1ec487[_0x2ff9('0x47')][0x2][_0x2ff9('0x48')]:undefined)||0x14}];case _0x2ff9('0x55'):case _0x2ff9('0x56'):return[{'name':_0x2ff9('0x57'),'value':_0x1ec487[_0x2ff9('0x57')]||(_0x1ec487[_0x2ff9('0x47')]&&_0x1ec487[_0x2ff9('0x47')][0x0]?_0x1ec487[_0x2ff9('0x47')][0x0][_0x2ff9('0x48')]:undefined)||_0x2ff9('0x53')},{'name':_0x2ff9('0x58'),'value':_0x1ec487[_0x2ff9('0x58')]||(_0x1ec487[_0x2ff9('0x47')]&&_0x1ec487[_0x2ff9('0x47')][0x1]?_0x1ec487[_0x2ff9('0x47')][0x1][_0x2ff9('0x48')]:undefined)||null},{'name':_0x2ff9('0x59'),'value':_0x1ec487['attrSerie3']||(_0x1ec487[_0x2ff9('0x47')]&&_0x1ec487[_0x2ff9('0x47')][0x2]?_0x1ec487[_0x2ff9('0x47')][0x2]['value']:undefined)||null},{'name':_0x2ff9('0x54'),'value':_0x1ec487[_0x2ff9('0x54')]||(_0x1ec487[_0x2ff9('0x47')]&&_0x1ec487[_0x2ff9('0x47')][0x3]?_0x1ec487['attrs'][0x3][_0x2ff9('0x48')]:undefined)||[]}];case _0x2ff9('0x5a'):return[{'name':_0x2ff9('0x5b'),'type':_0x1ec487[_0x2ff9('0x5c')]||(_0x1ec487[_0x2ff9('0x47')]&&_0x1ec487[_0x2ff9('0x47')][0x0]?_0x1ec487[_0x2ff9('0x47')][0x0][_0x2ff9('0x44')]:undefined)||null,'value':_0x1ec487['attrReport']||(_0x1ec487[_0x2ff9('0x47')]&&_0x1ec487[_0x2ff9('0x47')][0x0]?_0x1ec487[_0x2ff9('0x47')][0x0][_0x2ff9('0x48')]:undefined)||null},{'name':_0x2ff9('0x5d'),'value':_0x1ec487[_0x2ff9('0x5d')]||(_0x1ec487[_0x2ff9('0x47')]&&_0x1ec487[_0x2ff9('0x47')][0x1]?_0x1ec487[_0x2ff9('0x47')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xf60dc6){logger['error'](_0x2ff9('0x5e'),JSON['stringify'](_0xf60dc6));return[];}}exports['create']=function(_0x1d84a1,_0x2ad61a){if(_0x1d84a1[_0x2ff9('0x5f')]){_0x1d84a1[_0x2ff9('0x5f')][_0x2ff9('0x47')]=widgetAttributes(_0x1d84a1[_0x2ff9('0x5f')]);}return db[_0x2ff9('0x43')][_0x2ff9('0x60')](_0x1d84a1[_0x2ff9('0x5f')],{})[_0x2ff9('0x2d')](respondWithResult(_0x2ad61a,0xc9))[_0x2ff9('0x42')](handleError(_0x2ad61a,null));};exports[_0x2ff9('0x61')]=function(_0xc42001,_0x33d92d){if(_0xc42001[_0x2ff9('0x5f')]['id']){delete _0xc42001[_0x2ff9('0x5f')]['id'];}_0xc42001['body']['attrs']=widgetAttributes(_0xc42001[_0x2ff9('0x5f')]);return db['DashboardItem'][_0x2ff9('0x41')]({'where':{'id':_0xc42001[_0x2ff9('0x34')]['id']}})[_0x2ff9('0x2d')](handleEntityNotFound(_0x33d92d,null))[_0x2ff9('0x2d')](saveUpdates(_0xc42001[_0x2ff9('0x5f')],null))[_0x2ff9('0x2d')](respondWithResult(_0x33d92d,null))[_0x2ff9('0x42')](handleError(_0x33d92d,null));}; \ No newline at end of file +var _0xc85f=['params','keys','DashboardItem','rawAttributes','filters','intersection','model','attributes','fields','query','includeAll','merge','options','find','catch','type','iframe','attrUrl','attrs','https://','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie3','web-report','reportType','attrRefresh','error','widgetAttributes:\x20%s','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','stack','name','send','show'];(function(_0x1f4cac,_0x376aa7){var _0x18470d=function(_0x2064c1){while(--_0x2064c1){_0x1f4cac['push'](_0x1f4cac['shift']());}};_0x18470d(++_0x376aa7);}(_0xc85f,0x140));var _0xfc85=function(_0x2fcce9,_0x46c97f){_0x2fcce9=_0x2fcce9-0x0;var _0x1de945=_0xc85f[_0x2fcce9];return _0x1de945;};'use strict';var emlformat=require(_0xfc85('0x0'));var rimraf=require(_0xfc85('0x1'));var zipdir=require(_0xfc85('0x2'));var jsonpatch=require(_0xfc85('0x3'));var rp=require(_0xfc85('0x4'));var moment=require(_0xfc85('0x5'));var BPromise=require(_0xfc85('0x6'));var Mustache=require('mustache');var util=require(_0xfc85('0x7'));var path=require(_0xfc85('0x8'));var sox=require('sox');var csv=require(_0xfc85('0x9'));var ejs=require(_0xfc85('0xa'));var fs=require('fs');var fs_extra=require(_0xfc85('0xb'));var _=require(_0xfc85('0xc'));var squel=require('squel');var crypto=require(_0xfc85('0xd'));var jsforce=require(_0xfc85('0xe'));var deskjs=require(_0xfc85('0xf'));var toCsv=require(_0xfc85('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfc85('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfc85('0x11'));var as=require(_0xfc85('0x12'));var hardwareService=require(_0xfc85('0x13'));var logger=require(_0xfc85('0x14'))('api');var utils=require(_0xfc85('0x15'));var config=require(_0xfc85('0x16'));var licenseUtil=require(_0xfc85('0x17'));var db=require(_0xfc85('0x18'))['db'];config[_0xfc85('0x19')]=_[_0xfc85('0x1a')](config['redis'],{'host':_0xfc85('0x1b'),'port':0x18eb});var socket=require(_0xfc85('0x1c'))(new Redis(config[_0xfc85('0x19')]));require(_0xfc85('0x1d'))[_0xfc85('0x1e')](socket);function respondWithStatusCode(_0x13d2d0,_0x1518af){_0x1518af=_0x1518af||0xcc;return function(_0x9ba60f){if(_0x9ba60f){return _0x13d2d0[_0xfc85('0x1f')](_0x1518af);}return _0x13d2d0[_0xfc85('0x20')](_0x1518af)[_0xfc85('0x21')]();};}function respondWithResult(_0x389fde,_0x435806){_0x435806=_0x435806||0xc8;return function(_0x3f9f48){if(_0x3f9f48){return _0x389fde[_0xfc85('0x20')](_0x435806)[_0xfc85('0x22')](_0x3f9f48);}};}function respondWithFilteredResult(_0x328bb9,_0x12d692){return function(_0x4ab3b4){if(_0x4ab3b4){var _0x5c2bbd=typeof _0x12d692[_0xfc85('0x23')]==='undefined'&&typeof _0x12d692['limit']===_0xfc85('0x24');var _0x50f134=_0x4ab3b4[_0xfc85('0x25')];var _0x1b677f=_0x5c2bbd?0x0:_0x12d692[_0xfc85('0x23')];var _0x2a4f7f=_0x5c2bbd?_0x4ab3b4['count']:_0x12d692[_0xfc85('0x23')]+_0x12d692[_0xfc85('0x26')];var _0x30f4de;if(_0x2a4f7f>=_0x50f134){_0x2a4f7f=_0x50f134;_0x30f4de=0xc8;}else{_0x30f4de=0xce;}_0x328bb9[_0xfc85('0x20')](_0x30f4de);return _0x328bb9[_0xfc85('0x27')]('Content-Range',_0x1b677f+'-'+_0x2a4f7f+'/'+_0x50f134)[_0xfc85('0x22')](_0x4ab3b4);}return null;};}function patchUpdates(_0x421957){return function(_0x5e7cbc){try{jsonpatch[_0xfc85('0x28')](_0x5e7cbc,_0x421957,!![]);}catch(_0x42019c){return BPromise[_0xfc85('0x29')](_0x42019c);}return _0x5e7cbc[_0xfc85('0x2a')]();};}function saveUpdates(_0x3ad25f,_0x221feb){return function(_0x529e6d){if(_0x529e6d){return _0x529e6d['update'](_0x3ad25f)[_0xfc85('0x2b')](function(_0x1f2ec1){return _0x1f2ec1;});}return null;};}function removeEntity(_0x29edcb,_0x544b49){return function(_0x197657){if(_0x197657){return _0x197657['destroy']()['then'](function(){_0x29edcb[_0xfc85('0x20')](0xcc)[_0xfc85('0x21')]();});}};}function handleEntityNotFound(_0x21c420,_0x41e262){return function(_0x148ac0){if(!_0x148ac0){_0x21c420['sendStatus'](0x194);}return _0x148ac0;};}function handleError(_0x54d942,_0xb87f94){_0xb87f94=_0xb87f94||0x1f4;return function(_0xd37d3){logger['error'](_0xd37d3[_0xfc85('0x2c')]);if(_0xd37d3[_0xfc85('0x2d')]){delete _0xd37d3[_0xfc85('0x2d')];}_0x54d942['status'](_0xb87f94)[_0xfc85('0x2e')](_0xd37d3);};}exports[_0xfc85('0x2f')]=function(_0x53337e,_0x5d7638){var _0x9668d1={'raw':![],'where':{'id':_0x53337e[_0xfc85('0x30')]['id']}},_0x319975={};_0x319975['model']=_[_0xfc85('0x31')](db[_0xfc85('0x32')][_0xfc85('0x33')]);_0x319975['query']=_[_0xfc85('0x31')](_0x53337e['query']);_0x319975[_0xfc85('0x34')]=_[_0xfc85('0x35')](_0x319975[_0xfc85('0x36')],_0x319975['query']);_0x9668d1[_0xfc85('0x37')]=_['intersection'](_0x319975['model'],qs[_0xfc85('0x38')](_0x53337e[_0xfc85('0x39')][_0xfc85('0x38')]));_0x9668d1['attributes']=_0x9668d1[_0xfc85('0x37')]['length']?_0x9668d1[_0xfc85('0x37')]:_0x319975[_0xfc85('0x36')];if(_0x53337e[_0xfc85('0x39')][_0xfc85('0x3a')]){_0x9668d1['include']=[{'all':!![]}];}_0x9668d1=_[_0xfc85('0x3b')]({},_0x9668d1,_0x53337e[_0xfc85('0x3c')]);return db[_0xfc85('0x32')][_0xfc85('0x3d')](_0x9668d1)[_0xfc85('0x2b')](handleEntityNotFound(_0x5d7638,null))[_0xfc85('0x2b')](respondWithResult(_0x5d7638,null))[_0xfc85('0x3e')](handleError(_0x5d7638,null));};exports['destroy']=function(_0x12de49,_0xffb6ba){return db[_0xfc85('0x32')][_0xfc85('0x3d')]({'where':{'id':_0x12de49['params']['id']}})[_0xfc85('0x2b')](handleEntityNotFound(_0xffb6ba,null))[_0xfc85('0x2b')](removeEntity(_0xffb6ba,null))['catch'](handleError(_0xffb6ba,null));};function widgetAttributes(_0x4bc33d){try{switch(_0x4bc33d[_0xfc85('0x3f')]){case _0xfc85('0x40'):return[{'name':_0xfc85('0x41'),'value':_0x4bc33d['attrUrl']||(_0x4bc33d[_0xfc85('0x42')]&&_0x4bc33d['attrs'][0x0]?_0x4bc33d[_0xfc85('0x42')][0x0]['value']:undefined)||_0xfc85('0x43')}];case'custom':return[{'name':_0xfc85('0x44'),'value':_0x4bc33d[_0xfc85('0x44')]||(_0x4bc33d[_0xfc85('0x42')]&&_0x4bc33d['attrs'][0x0]?_0x4bc33d[_0xfc85('0x42')][0x0]['value']:undefined)||''}];case _0xfc85('0x45'):return[{'name':_0xfc85('0x46'),'value':_0x4bc33d['attrHourFormat']||(_0x4bc33d['attrs']&&_0x4bc33d[_0xfc85('0x42')][0x0]?_0x4bc33d[_0xfc85('0x42')][0x0][_0xfc85('0x47')]:undefined)||_0xfc85('0x48')},{'name':_0xfc85('0x49'),'value':_0x4bc33d[_0xfc85('0x49')]||(_0x4bc33d[_0xfc85('0x42')]&&_0x4bc33d[_0xfc85('0x42')][0x1]?_0x4bc33d[_0xfc85('0x42')][0x1][_0xfc85('0x47')]:undefined)||_0xfc85('0x4a')},{'name':_0xfc85('0x4b'),'value':_0x4bc33d[_0xfc85('0x4b')]||(_0x4bc33d['attrs']&&_0x4bc33d['attrs'][0x2]?_0x4bc33d[_0xfc85('0x42')][0x2]['value']:undefined)||0xc}];case _0xfc85('0x4c'):return[{'name':_0xfc85('0x4d'),'value':_0x4bc33d[_0xfc85('0x4d')]||(_0x4bc33d[_0xfc85('0x42')]&&_0x4bc33d[_0xfc85('0x42')][0x0]?_0x4bc33d[_0xfc85('0x42')][0x0][_0xfc85('0x47')]:undefined)||'total'},{'name':_0xfc85('0x4e'),'value':_0x4bc33d[_0xfc85('0x4e')]||(_0x4bc33d[_0xfc85('0x42')]&&_0x4bc33d[_0xfc85('0x42')][0x1]?_0x4bc33d[_0xfc85('0x42')][0x1]['value']:undefined)||[]},{'name':_0xfc85('0x4b'),'value':_0x4bc33d[_0xfc85('0x4b')]||(_0x4bc33d[_0xfc85('0x42')]&&_0x4bc33d[_0xfc85('0x42')][0x2]?_0x4bc33d[_0xfc85('0x42')][0x2][_0xfc85('0x47')]:undefined)||0x14}];case _0xfc85('0x4f'):case _0xfc85('0x50'):return[{'name':_0xfc85('0x51'),'value':_0x4bc33d[_0xfc85('0x51')]||(_0x4bc33d['attrs']&&_0x4bc33d['attrs'][0x0]?_0x4bc33d['attrs'][0x0]['value']:undefined)||_0xfc85('0x52')},{'name':'attrSerie2','value':_0x4bc33d['attrSerie2']||(_0x4bc33d[_0xfc85('0x42')]&&_0x4bc33d['attrs'][0x1]?_0x4bc33d[_0xfc85('0x42')][0x1]['value']:undefined)||null},{'name':_0xfc85('0x53'),'value':_0x4bc33d[_0xfc85('0x53')]||(_0x4bc33d[_0xfc85('0x42')]&&_0x4bc33d[_0xfc85('0x42')][0x2]?_0x4bc33d['attrs'][0x2]['value']:undefined)||null},{'name':_0xfc85('0x4e'),'value':_0x4bc33d[_0xfc85('0x4e')]||(_0x4bc33d['attrs']&&_0x4bc33d['attrs'][0x3]?_0x4bc33d[_0xfc85('0x42')][0x3][_0xfc85('0x47')]:undefined)||[]}];case _0xfc85('0x54'):return[{'name':'attrReport','type':_0x4bc33d[_0xfc85('0x55')]||(_0x4bc33d[_0xfc85('0x42')]&&_0x4bc33d[_0xfc85('0x42')][0x0]?_0x4bc33d[_0xfc85('0x42')][0x0]['type']:undefined)||null,'value':_0x4bc33d['attrReport']||(_0x4bc33d[_0xfc85('0x42')]&&_0x4bc33d[_0xfc85('0x42')][0x0]?_0x4bc33d[_0xfc85('0x42')][0x0]['value']:undefined)||null},{'name':_0xfc85('0x56'),'value':_0x4bc33d[_0xfc85('0x56')]||(_0x4bc33d['attrs']&&_0x4bc33d[_0xfc85('0x42')][0x1]?_0x4bc33d['attrs'][0x1][_0xfc85('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x2a2796){logger[_0xfc85('0x57')](_0xfc85('0x58'),JSON['stringify'](_0x2a2796));return[];}}exports[_0xfc85('0x59')]=function(_0x24de11,_0x13e7a8){if(_0x24de11['body']){_0x24de11[_0xfc85('0x5a')][_0xfc85('0x42')]=widgetAttributes(_0x24de11['body']);}return db['DashboardItem'][_0xfc85('0x59')](_0x24de11['body'],{})[_0xfc85('0x2b')](respondWithResult(_0x13e7a8,0xc9))['catch'](handleError(_0x13e7a8,null));};exports[_0xfc85('0x5b')]=function(_0x3e70ac,_0xcc35a1){if(_0x3e70ac[_0xfc85('0x5a')]['id']){delete _0x3e70ac[_0xfc85('0x5a')]['id'];}_0x3e70ac[_0xfc85('0x5a')][_0xfc85('0x42')]=widgetAttributes(_0x3e70ac[_0xfc85('0x5a')]);return db[_0xfc85('0x32')]['find']({'where':{'id':_0x3e70ac[_0xfc85('0x30')]['id']}})[_0xfc85('0x2b')](handleEntityNotFound(_0xcc35a1,null))[_0xfc85('0x2b')](saveUpdates(_0x3e70ac[_0xfc85('0x5a')],null))[_0xfc85('0x2b')](respondWithResult(_0xcc35a1,null))[_0xfc85('0x3e')](handleError(_0xcc35a1,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 06a3ace..b7a163e 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 _0xcc6f=['DashboardItem','setMaxListeners','update','remove','hook','events','../../mysqldb'];(function(_0x1d147c,_0x127756){var _0xe0e145=function(_0xa995f6){while(--_0xa995f6){_0x1d147c['push'](_0x1d147c['shift']());}};_0xe0e145(++_0x127756);}(_0xcc6f,0x10f));var _0xfcc6=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xcc6f[_0x346737];return _0x1ade2e;};'use strict';var EventEmitter=require(_0xfcc6('0x0'));var DashboardItem=require(_0xfcc6('0x1'))['db'][_0xfcc6('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xfcc6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfcc6('0x4'),'afterDestroy':_0xfcc6('0x5')};function emitEvent(_0x16ba1b){return function(_0x35b526,_0x3bb507,_0x4c32c5){DashboardItemEvents['emit'](_0x16ba1b+':'+_0x35b526['id'],_0x35b526);DashboardItemEvents['emit'](_0x16ba1b,_0x35b526);_0x4c32c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xfcc6('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x035c=['events','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xb24521,_0x23f689){var _0x1f5842=function(_0x460fcc){while(--_0x460fcc){_0xb24521['push'](_0xb24521['shift']());}};_0x1f5842(++_0x23f689);}(_0x035c,0xa8));var _0xc035=function(_0x56971c,_0x505bcf){_0x56971c=_0x56971c-0x0;var _0xa20915=_0x035c[_0x56971c];return _0xa20915;};'use strict';var EventEmitter=require(_0xc035('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xc035('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc035('0x2')](0x0);var events={'afterCreate':_0xc035('0x3'),'afterUpdate':_0xc035('0x4'),'afterDestroy':_0xc035('0x5')};function emitEvent(_0x29443d){return function(_0x8ec421,_0xd9678e,_0x1335c8){DashboardItemEvents['emit'](_0x29443d+':'+_0x8ec421['id'],_0x8ec421);DashboardItemEvents[_0xc035('0x6')](_0x29443d,_0x8ec421);_0x1335c8(null);};}for(var e in events){if(events[_0xc035('0x7')](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 18e4361..fb5aba5 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 _0xabc7=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xabc7,0x138));var _0x7abc=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xabc7[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x7abc('0x0'));var util=require(_0x7abc('0x1'));var logger=require(_0x7abc('0x2'))(_0x7abc('0x3'));var moment=require('moment');var BPromise=require(_0x7abc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7abc('0x5'));var rimraf=require('rimraf');var config=require(_0x7abc('0x6'));var attributes=require(_0x7abc('0x7'));module[_0x7abc('0x8')]=function(_0x431fa7,_0xd39e4b){return _0x431fa7[_0x7abc('0x9')](_0x7abc('0xa'),attributes,{'tableName':_0x7abc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50dc=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash','util','api'];(function(_0x4383e9,_0xa4b307){var _0x355405=function(_0x545b5b){while(--_0x545b5b){_0x4383e9['push'](_0x4383e9['shift']());}};_0x355405(++_0xa4b307);}(_0x50dc,0x1b5));var _0xc50d=function(_0x34172a,_0x3c324a){_0x34172a=_0x34172a-0x0;var _0x4c229c=_0x50dc[_0x34172a];return _0x4c229c;};'use strict';var _=require(_0xc50d('0x0'));var util=require(_0xc50d('0x1'));var logger=require('../../config/logger')(_0xc50d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc50d('0x3'));var fs=require('fs');var path=require(_0xc50d('0x4'));var rimraf=require(_0xc50d('0x5'));var config=require(_0xc50d('0x6'));var attributes=require(_0xc50d('0x7'));module[_0xc50d('0x8')]=function(_0xe0e7d7,_0x49638f){return _0xe0e7d7[_0xc50d('0x9')]('DashboardItem',attributes,{'tableName':_0xc50d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 8aa1991..5c9fe56 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 _0x5ab7=['rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x7c3c27,_0x16c034){var _0x4a2c4b=function(_0x293b82){while(--_0x293b82){_0x7c3c27['push'](_0x7c3c27['shift']());}};_0x4a2c4b(++_0x16c034);}(_0x5ab7,0x164));var _0x75ab=function(_0x2d4765,_0x2f5bd4){_0x2d4765=_0x2d4765-0x0;var _0x2ba630=_0x5ab7[_0x2d4765];return _0x2ba630;};'use strict';var _=require(_0x75ab('0x0'));var util=require(_0x75ab('0x1'));var moment=require(_0x75ab('0x2'));var BPromise=require(_0x75ab('0x3'));var rs=require(_0x75ab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75ab('0x5'))['db'];var utils=require(_0x75ab('0x6'));var logger=require(_0x75ab('0x7'))(_0x75ab('0x8'));var config=require(_0x75ab('0x9'));var jayson=require(_0x75ab('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x75ab('0xb')](config[_0x75ab('0xc')],{'host':_0x75ab('0xd'),'port':0x18eb});var socket=require(_0x75ab('0xe'))(new Redis(config[_0x75ab('0xc')]));require(_0x75ab('0xf'))[_0x75ab('0x10')](socket);function respondWithRpcPromise(_0x560019,_0x2432f1,_0x5d779a){return new BPromise(function(_0x57bf5b,_0x1d16c5){return client[_0x75ab('0x11')](_0x560019,_0x5d779a)[_0x75ab('0x12')](function(_0x59ec52){logger[_0x75ab('0x13')]('DashboardItem,\x20%s,\x20%s',_0x2432f1,'request\x20sent');logger[_0x75ab('0x14')](_0x75ab('0x15'),_0x2432f1,'request\x20sent',JSON[_0x75ab('0x16')](_0x59ec52));if(_0x59ec52[_0x75ab('0x17')]){if(_0x59ec52['error'][_0x75ab('0x18')]===0x1f4){logger[_0x75ab('0x17')](_0x75ab('0x19'),_0x2432f1,_0x59ec52['error'][_0x75ab('0x1a')]);return _0x1d16c5(_0x59ec52['error'][_0x75ab('0x1a')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x2432f1,_0x59ec52['error'][_0x75ab('0x1a')]);return _0x57bf5b(_0x59ec52['error']['message']);}else{logger[_0x75ab('0x13')](_0x75ab('0x19'),_0x2432f1,'request\x20sent');_0x57bf5b(_0x59ec52['result'][_0x75ab('0x1a')]);}})[_0x75ab('0x1b')](function(_0x224b4f){logger['error'](_0x75ab('0x19'),_0x2432f1,_0x224b4f);_0x1d16c5(_0x224b4f);});});} \ No newline at end of file +var _0x8de8=['error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x468cda,_0x54c405){var _0x2369b0=function(_0x33da5c){while(--_0x33da5c){_0x468cda['push'](_0x468cda['shift']());}};_0x2369b0(++_0x54c405);}(_0x8de8,0x8e));var _0x88de=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8de8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x88de('0x0'));var util=require(_0x88de('0x1'));var moment=require(_0x88de('0x2'));var BPromise=require(_0x88de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88de('0x4'));var db=require(_0x88de('0x5'))['db'];var utils=require(_0x88de('0x6'));var logger=require(_0x88de('0x7'))(_0x88de('0x8'));var config=require(_0x88de('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x88de('0xa')][_0x88de('0xb')]({'port':0x232a});config[_0x88de('0xc')]=_[_0x88de('0xd')](config[_0x88de('0xc')],{'host':_0x88de('0xe'),'port':0x18eb});var socket=require(_0x88de('0xf'))(new Redis(config[_0x88de('0xc')]));require(_0x88de('0x10'))[_0x88de('0x11')](socket);function respondWithRpcPromise(_0x2eb9e7,_0x18db02,_0x355570){return new BPromise(function(_0x5511bf,_0x5a3136){return client[_0x88de('0x12')](_0x2eb9e7,_0x355570)[_0x88de('0x13')](function(_0x42ef6f){logger[_0x88de('0x14')](_0x88de('0x15'),_0x18db02,'request\x20sent');logger[_0x88de('0x16')](_0x88de('0x17'),_0x18db02,_0x88de('0x18'),JSON[_0x88de('0x19')](_0x42ef6f));if(_0x42ef6f[_0x88de('0x1a')]){if(_0x42ef6f[_0x88de('0x1a')]['code']===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x18db02,_0x42ef6f[_0x88de('0x1a')][_0x88de('0x1b')]);return _0x5a3136(_0x42ef6f[_0x88de('0x1a')][_0x88de('0x1b')]);}logger[_0x88de('0x1a')](_0x88de('0x15'),_0x18db02,_0x42ef6f[_0x88de('0x1a')][_0x88de('0x1b')]);return _0x5511bf(_0x42ef6f['error'][_0x88de('0x1b')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x18db02,_0x88de('0x18'));_0x5511bf(_0x42ef6f['result'][_0x88de('0x1b')]);}})['catch'](function(_0x4df544){logger[_0x88de('0x1a')]('DashboardItem,\x20%s,\x20%s',_0x18db02,_0x4df544);_0x5a3136(_0x4df544);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 1f3000f..5a6c257 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 _0xef77=['register','length','dashboardItem:','./dashboardItem.events','update','emit','removeListener'];(function(_0x1392c4,_0x5a51c6){var _0x179f77=function(_0x14ecba){while(--_0x14ecba){_0x1392c4['push'](_0x1392c4['shift']());}};_0x179f77(++_0x5a51c6);}(_0xef77,0x161));var _0x7ef7=function(_0x4c8f9c,_0x4f2f6a){_0x4c8f9c=_0x4c8f9c-0x0;var _0x157e26=_0xef77[_0x4c8f9c];return _0x157e26;};'use strict';var DashboardItemEvents=require(_0x7ef7('0x0'));var events=['save','remove',_0x7ef7('0x1')];function createListener(_0x3c2ee4,_0x58671d){return function(_0x1d9c92){_0x58671d[_0x7ef7('0x2')](_0x3c2ee4,_0x1d9c92);};}function removeListener(_0xb9a2d2,_0x1066ef){return function(){DashboardItemEvents[_0x7ef7('0x3')](_0xb9a2d2,_0x1066ef);};}exports[_0x7ef7('0x4')]=function(_0x220587){for(var _0x33a1fb=0x0,_0x29356b=events[_0x7ef7('0x5')];_0x33a1fb<_0x29356b;_0x33a1fb++){var _0x59f157=events[_0x33a1fb];var _0x389fc6=createListener(_0x7ef7('0x6')+_0x59f157,_0x220587);DashboardItemEvents['on'](_0x59f157,_0x389fc6);}}; \ No newline at end of file +var _0x0d8c=['./dashboardItem.events','save','remove','update','emit','removeListener','register','length','dashboardItem:'];(function(_0x5f002d,_0x1b9dc8){var _0x544598=function(_0x929264){while(--_0x929264){_0x5f002d['push'](_0x5f002d['shift']());}};_0x544598(++_0x1b9dc8);}(_0x0d8c,0x1b0));var _0xc0d8=function(_0x472c48,_0xf5330f){_0x472c48=_0x472c48-0x0;var _0x30495a=_0x0d8c[_0x472c48];return _0x30495a;};'use strict';var DashboardItemEvents=require(_0xc0d8('0x0'));var events=[_0xc0d8('0x1'),_0xc0d8('0x2'),_0xc0d8('0x3')];function createListener(_0x3f91e3,_0x3d13a2){return function(_0x2745e3){_0x3d13a2[_0xc0d8('0x4')](_0x3f91e3,_0x2745e3);};}function removeListener(_0x25d4ed,_0x1e1a7d){return function(){DashboardItemEvents[_0xc0d8('0x5')](_0x25d4ed,_0x1e1a7d);};}exports[_0xc0d8('0x6')]=function(_0x952e37){for(var _0x5ad50b=0x0,_0x1b3c8a=events[_0xc0d8('0x7')];_0x5ad50b<_0x1b3c8a;_0x5ad50b++){var _0x4dc368=events[_0x5ad50b];var _0xa1fa4d=createListener(_0xc0d8('0x8')+_0x4dc368,_0x952e37);DashboardItemEvents['on'](_0x4dc368,_0xa1fa4d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 63a8140..009637a 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 _0xa3ad=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','post','isAuthenticated','create','put'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0xa3ad,0x9b));var _0xda3a=function(_0x4bde90,_0x2f9eb2){_0x4bde90=_0x4bde90-0x0;var _0x21546b=_0xa3ad[_0x4bde90];return _0x21546b;};'use strict';var multer=require(_0xda3a('0x0'));var util=require(_0xda3a('0x1'));var path=require(_0xda3a('0x2'));var timeout=require(_0xda3a('0x3'));var express=require(_0xda3a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xda3a('0x5'));var interaction=require(_0xda3a('0x6'));var config=require(_0xda3a('0x7'));var controller=require(_0xda3a('0x8'));router[_0xda3a('0x9')](_0xda3a('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xda3a('0xb')]('/',auth[_0xda3a('0xc')](),controller[_0xda3a('0xd')]);router[_0xda3a('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xda3a('0xa'),auth[_0xda3a('0xc')](),controller[_0xda3a('0xf')]);module[_0xda3a('0x10')]=router; \ No newline at end of file +var _0xe6b0=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','./dashboardItem.controller','/:id','isAuthenticated','show','post','put','update','delete','destroy'];(function(_0x879aba,_0x22bbe1){var _0x2dff0b=function(_0x21da3e){while(--_0x21da3e){_0x879aba['push'](_0x879aba['shift']());}};_0x2dff0b(++_0x22bbe1);}(_0xe6b0,0x1e0));var _0x0e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0e6b('0x0'));var util=require(_0x0e6b('0x1'));var path=require(_0x0e6b('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e6b('0x3'));var router=express[_0x0e6b('0x4')]();var fs_extra=require(_0x0e6b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0e6b('0x6'));var config=require('../../config/environment');var controller=require(_0x0e6b('0x7'));router['get'](_0x0e6b('0x8'),auth[_0x0e6b('0x9')](),controller[_0x0e6b('0xa')]);router[_0x0e6b('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0e6b('0xc')](_0x0e6b('0x8'),auth[_0x0e6b('0x9')](),controller[_0x0e6b('0xd')]);router[_0x0e6b('0xe')](_0x0e6b('0x8'),auth[_0x0e6b('0x9')](),controller[_0x0e6b('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index ebc2bde..2127501 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 _0x74df=['third','sequelize','exports','STRING','ENUM','first'];(function(_0xc50fa2,_0x314c7e){var _0x127610=function(_0x184882){while(--_0x184882){_0xc50fa2['push'](_0xc50fa2['shift']());}};_0x127610(++_0x314c7e);}(_0x74df,0xb5));var _0xf74d=function(_0x5a1395,_0x500545){_0x5a1395=_0x5a1395-0x0;var _0x56a08a=_0x74df[_0x5a1395];return _0x56a08a;};'use strict';var Sequelize=require(_0xf74d('0x0'));module[_0xf74d('0x1')]={'name':{'type':Sequelize[_0xf74d('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xf74d('0x3')](_0xf74d('0x4'),'second',_0xf74d('0x5')),'allowNull':![],'defaultValue':_0xf74d('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf96f=['second','first','sequelize','exports','STRING'];(function(_0x316c4f,_0x5a39df){var _0x49cd1e=function(_0x11e533){while(--_0x11e533){_0x316c4f['push'](_0x316c4f['shift']());}};_0x49cd1e(++_0x5a39df);}(_0xf96f,0xe3));var _0xff96=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf96f[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xff96('0x0'));module[_0xff96('0x1')]={'name':{'type':Sequelize[_0xff96('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0xff96('0x3'),'third'),'allowNull':![],'defaultValue':_0xff96('0x4')},'description':{'type':Sequelize[_0xff96('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 53d358c..6f0add9 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 _0x6011=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x2f5ee6,_0x3d4315){var _0x116d9f=function(_0x4c736f){while(--_0x4c736f){_0x2f5ee6['push'](_0x2f5ee6['shift']());}};_0x116d9f(++_0x3d4315);}(_0x6011,0x196));var _0x1601=function(_0x45b669,_0x2cb4af){_0x45b669=_0x45b669-0x0;var _0x2fad92=_0x6011[_0x45b669];return _0x2fad92;};'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(_0x1601('0x0'));var BPromise=require(_0x1601('0x1'));var Mustache=require('mustache');var util=require(_0x1601('0x2'));var path=require(_0x1601('0x3'));var sox=require(_0x1601('0x4'));var csv=require(_0x1601('0x5'));var ejs=require(_0x1601('0x6'));var fs=require('fs');var fs_extra=require(_0x1601('0x7'));var _=require(_0x1601('0x8'));var squel=require(_0x1601('0x9'));var crypto=require(_0x1601('0xa'));var jsforce=require(_0x1601('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1601('0x5'));var querystring=require(_0x1601('0xc'));var Papa=require(_0x1601('0xd'));var Redis=require(_0x1601('0xe'));var authService=require(_0x1601('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1601('0x10'))('api');var utils=require(_0x1601('0x11'));var config=require(_0x1601('0x12'));var licenseUtil=require(_0x1601('0x13'));var db=require(_0x1601('0x14'))['db'];function respondWithStatusCode(_0x263bef,_0x322025){_0x322025=_0x322025||0xcc;return function(_0x3ac50b){if(_0x3ac50b){return _0x263bef[_0x1601('0x15')](_0x322025);}return _0x263bef['status'](_0x322025)[_0x1601('0x16')]();};}function respondWithResult(_0x555d4f,_0x4705f0){_0x4705f0=_0x4705f0||0xc8;return function(_0x5d642d){if(_0x5d642d){return _0x555d4f[_0x1601('0x17')](_0x4705f0)[_0x1601('0x18')](_0x5d642d);}};}function respondWithFilteredResult(_0x4bb5c1,_0x1b40be){return function(_0x39873a){if(_0x39873a){var _0x12ddb0=typeof _0x1b40be['offset']==='undefined'&&typeof _0x1b40be[_0x1601('0x19')]===_0x1601('0x1a');var _0x3621e2=_0x39873a[_0x1601('0x1b')];var _0x1d8563=_0x12ddb0?0x0:_0x1b40be[_0x1601('0x1c')];var _0x23b992=_0x12ddb0?_0x39873a[_0x1601('0x1b')]:_0x1b40be[_0x1601('0x1c')]+_0x1b40be['limit'];var _0x4d077e;if(_0x23b992>=_0x3621e2){_0x23b992=_0x3621e2;_0x4d077e=0xc8;}else{_0x4d077e=0xce;}_0x4bb5c1[_0x1601('0x17')](_0x4d077e);return _0x4bb5c1[_0x1601('0x1d')](_0x1601('0x1e'),_0x1d8563+'-'+_0x23b992+'/'+_0x3621e2)['json'](_0x39873a);}return null;};}function patchUpdates(_0x2c3b5d){return function(_0x380157){try{jsonpatch[_0x1601('0x1f')](_0x380157,_0x2c3b5d,!![]);}catch(_0x2e2e0d){return BPromise[_0x1601('0x20')](_0x2e2e0d);}return _0x380157['save']();};}function saveUpdates(_0x1b8314,_0x296023){return function(_0x220313){if(_0x220313){return _0x220313['update'](_0x1b8314)[_0x1601('0x21')](function(_0x330033){return _0x330033;});}return null;};}function removeEntity(_0x4f918b,_0x2b01da){return function(_0xa8e856){if(_0xa8e856){return _0xa8e856['destroy']()['then'](function(){var _0x65fb4f=_0xa8e856[_0x1601('0x22')]({'plain':!![]});var _0x34d021='Dispositions';return db[_0x1601('0x23')][_0x1601('0x24')]({'where':{'type':_0x34d021,'resourceId':_0x65fb4f['id']}})[_0x1601('0x21')](function(){return _0xa8e856;});})[_0x1601('0x21')](function(){_0x4f918b[_0x1601('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b2f0d,_0x1fa0a6){return function(_0x1aef35){if(!_0x1aef35){_0x4b2f0d[_0x1601('0x15')](0x194);}return _0x1aef35;};}function handleError(_0x4ee7b1,_0x2b55e1){_0x2b55e1=_0x2b55e1||0x1f4;return function(_0x57eb42){logger[_0x1601('0x25')](_0x57eb42[_0x1601('0x26')]);if(_0x57eb42[_0x1601('0x27')]){delete _0x57eb42['name'];}_0x4ee7b1[_0x1601('0x17')](_0x2b55e1)[_0x1601('0x28')](_0x57eb42);};}exports[_0x1601('0x29')]=function(_0x10458c,_0x5cdcfb){var _0x32740e={},_0x3ef6a7={},_0x2a4ef9={'count':0x0,'rows':[]};var _0x224a1c=_[_0x1601('0x2a')](db[_0x1601('0x2b')][_0x1601('0x2c')],function(_0x3fee6e){return{'name':_0x3fee6e[_0x1601('0x2d')],'type':_0x3fee6e[_0x1601('0x2e')][_0x1601('0x2f')]};});_0x3ef6a7[_0x1601('0x30')]=_[_0x1601('0x2a')](_0x224a1c,'name');_0x3ef6a7[_0x1601('0x31')]=_[_0x1601('0x32')](_0x10458c[_0x1601('0x31')]);_0x3ef6a7[_0x1601('0x33')]=_[_0x1601('0x34')](_0x3ef6a7['model'],_0x3ef6a7[_0x1601('0x31')]);_0x32740e[_0x1601('0x35')]=_['intersection'](_0x3ef6a7[_0x1601('0x30')],qs['fields'](_0x10458c[_0x1601('0x31')][_0x1601('0x36')]));_0x32740e['attributes']=_0x32740e[_0x1601('0x35')][_0x1601('0x37')]?_0x32740e[_0x1601('0x35')]:_0x3ef6a7[_0x1601('0x30')];if(!_0x10458c[_0x1601('0x31')][_0x1601('0x38')](_0x1601('0x39'))){_0x32740e['limit']=qs[_0x1601('0x19')](_0x10458c[_0x1601('0x31')]['limit']);_0x32740e['offset']=qs[_0x1601('0x1c')](_0x10458c[_0x1601('0x31')][_0x1601('0x1c')]);}_0x32740e[_0x1601('0x3a')]=qs[_0x1601('0x3b')](_0x10458c[_0x1601('0x31')][_0x1601('0x3b')]);_0x32740e['where']=qs[_0x1601('0x33')](_[_0x1601('0x3c')](_0x10458c['query'],_0x3ef6a7['filters']),_0x224a1c);if(_0x10458c[_0x1601('0x31')]['filter']){_0x32740e['where']=_['merge'](_0x32740e[_0x1601('0x3d')],{'$or':_[_0x1601('0x2a')](_0x224a1c,function(_0x299cb0){if(_0x299cb0[_0x1601('0x2e')]!==_0x1601('0x3e')){var _0x1269c5={};_0x1269c5[_0x299cb0[_0x1601('0x27')]]={'$like':'%'+_0x10458c[_0x1601('0x31')][_0x1601('0x3f')]+'%'};return _0x1269c5;}})});}_0x32740e=_[_0x1601('0x40')]({},_0x32740e,_0x10458c[_0x1601('0x41')]);var _0x3acb2d={'where':_0x32740e[_0x1601('0x3d')]};return db['Disposition'][_0x1601('0x1b')](_0x3acb2d)['then'](function(_0x5acf66){_0x2a4ef9['count']=_0x5acf66;if(_0x10458c[_0x1601('0x31')][_0x1601('0x42')]){_0x32740e[_0x1601('0x43')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x32740e);})[_0x1601('0x21')](function(_0x3ce65d){_0x2a4ef9[_0x1601('0x44')]=_0x3ce65d;return _0x2a4ef9;})['then'](respondWithFilteredResult(_0x5cdcfb,_0x32740e))[_0x1601('0x45')](handleError(_0x5cdcfb,null));};exports['show']=function(_0x3aba50,_0x109928){var _0x38bc04={'raw':!![],'where':{'id':_0x3aba50['params']['id']}},_0x2eaab6={};_0x2eaab6[_0x1601('0x30')]=_['keys'](db[_0x1601('0x2b')][_0x1601('0x2c')]);_0x2eaab6['query']=_[_0x1601('0x32')](_0x3aba50[_0x1601('0x31')]);_0x2eaab6[_0x1601('0x33')]=_['intersection'](_0x2eaab6[_0x1601('0x30')],_0x2eaab6['query']);_0x38bc04[_0x1601('0x35')]=_[_0x1601('0x34')](_0x2eaab6[_0x1601('0x30')],qs[_0x1601('0x36')](_0x3aba50[_0x1601('0x31')][_0x1601('0x36')]));_0x38bc04[_0x1601('0x35')]=_0x38bc04[_0x1601('0x35')][_0x1601('0x37')]?_0x38bc04['attributes']:_0x2eaab6[_0x1601('0x30')];if(_0x3aba50['query'][_0x1601('0x42')]){_0x38bc04[_0x1601('0x43')]=[{'all':!![]}];}_0x38bc04=_['merge']({},_0x38bc04,_0x3aba50[_0x1601('0x41')]);return db[_0x1601('0x2b')]['find'](_0x38bc04)[_0x1601('0x21')](handleEntityNotFound(_0x109928,null))[_0x1601('0x21')](respondWithResult(_0x109928,null))[_0x1601('0x45')](handleError(_0x109928,null));};exports[_0x1601('0x46')]=function(_0x30f2bf,_0xf14c98){return db[_0x1601('0x2b')][_0x1601('0x46')](_0x30f2bf[_0x1601('0x47')],{})[_0x1601('0x21')](function(_0x58802e){var _0x3acebb=_0x30f2bf['user'][_0x1601('0x22')]({'plain':!![]});if(!_0x3acebb)throw new Error(_0x1601('0x48'));if(_0x3acebb[_0x1601('0x49')]==='user'){var _0x56b904=_0x58802e[_0x1601('0x22')]({'plain':!![]});var _0x3e82d3='Dispositions';return db['UserProfileSection']['find']({'where':{'name':_0x3e82d3,'userProfileId':_0x3acebb[_0x1601('0x4a')]},'raw':!![]})['then'](function(_0x3aceb6){if(_0x3aceb6&&_0x3aceb6[_0x1601('0x4b')]===0x0){return db[_0x1601('0x23')][_0x1601('0x46')]({'name':_0x56b904['name'],'resourceId':_0x56b904['id'],'type':_0x3aceb6['name'],'sectionId':_0x3aceb6['id']},{})[_0x1601('0x21')](function(){return _0x58802e;});}else{return _0x58802e;}})[_0x1601('0x45')](function(_0x562e11){logger[_0x1601('0x25')](_0x1601('0x4c'),_0x562e11);throw _0x562e11;});}return _0x58802e;})[_0x1601('0x21')](respondWithResult(_0xf14c98,0xc9))[_0x1601('0x45')](handleError(_0xf14c98,null));};exports[_0x1601('0x4d')]=function(_0x23cc2c,_0x372a61){if(_0x23cc2c['body']['id']){delete _0x23cc2c[_0x1601('0x47')]['id'];}return db[_0x1601('0x2b')][_0x1601('0x4e')]({'where':{'id':_0x23cc2c['params']['id']}})['then'](handleEntityNotFound(_0x372a61,null))[_0x1601('0x21')](saveUpdates(_0x23cc2c[_0x1601('0x47')],null))['then'](respondWithResult(_0x372a61,null))[_0x1601('0x45')](handleError(_0x372a61,null));};exports[_0x1601('0x24')]=function(_0x467b7e,_0xd4019f){return db[_0x1601('0x2b')][_0x1601('0x4e')]({'where':{'id':_0x467b7e[_0x1601('0x4f')]['id']}})[_0x1601('0x21')](handleEntityNotFound(_0xd4019f,null))[_0x1601('0x21')](removeEntity(_0xd4019f,null))[_0x1601('0x45')](handleError(_0xd4019f,null));}; \ No newline at end of file +var _0x85d8=['catch','show','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','error','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x5da73b,_0x13c824){var _0x33c7ad=function(_0x53f75a){while(--_0x53f75a){_0x5da73b['push'](_0x5da73b['shift']());}};_0x33c7ad(++_0x13c824);}(_0x85d8,0x1b0));var _0x885d=function(_0x5b9feb,_0x5ffe53){_0x5b9feb=_0x5b9feb-0x0;var _0x5cf7b7=_0x85d8[_0x5b9feb];return _0x5cf7b7;};'use strict';var emlformat=require(_0x885d('0x0'));var rimraf=require(_0x885d('0x1'));var zipdir=require(_0x885d('0x2'));var jsonpatch=require(_0x885d('0x3'));var rp=require(_0x885d('0x4'));var moment=require('moment');var BPromise=require(_0x885d('0x5'));var Mustache=require(_0x885d('0x6'));var util=require(_0x885d('0x7'));var path=require(_0x885d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x885d('0x9'));var fs=require('fs');var fs_extra=require(_0x885d('0xa'));var _=require(_0x885d('0xb'));var squel=require(_0x885d('0xc'));var crypto=require(_0x885d('0xd'));var jsforce=require(_0x885d('0xe'));var deskjs=require(_0x885d('0xf'));var toCsv=require(_0x885d('0x10'));var querystring=require(_0x885d('0x11'));var Papa=require(_0x885d('0x12'));var Redis=require(_0x885d('0x13'));var authService=require(_0x885d('0x14'));var qs=require(_0x885d('0x15'));var as=require(_0x885d('0x16'));var hardwareService=require(_0x885d('0x17'));var logger=require(_0x885d('0x18'))(_0x885d('0x19'));var utils=require(_0x885d('0x1a'));var config=require(_0x885d('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28b541,_0x127cd8){_0x127cd8=_0x127cd8||0xcc;return function(_0x495a56){if(_0x495a56){return _0x28b541[_0x885d('0x1c')](_0x127cd8);}return _0x28b541[_0x885d('0x1d')](_0x127cd8)['end']();};}function respondWithResult(_0x527a40,_0x466be5){_0x466be5=_0x466be5||0xc8;return function(_0x3a0ab7){if(_0x3a0ab7){return _0x527a40[_0x885d('0x1d')](_0x466be5)[_0x885d('0x1e')](_0x3a0ab7);}};}function respondWithFilteredResult(_0x2ecb5c,_0x1b837f){return function(_0x5d8bcd){if(_0x5d8bcd){var _0x594a29=typeof _0x1b837f[_0x885d('0x1f')]===_0x885d('0x20')&&typeof _0x1b837f[_0x885d('0x21')]===_0x885d('0x20');var _0x22c285=_0x5d8bcd[_0x885d('0x22')];var _0x1e2a42=_0x594a29?0x0:_0x1b837f[_0x885d('0x1f')];var _0x4b565a=_0x594a29?_0x5d8bcd[_0x885d('0x22')]:_0x1b837f[_0x885d('0x1f')]+_0x1b837f[_0x885d('0x21')];var _0x3cadff;if(_0x4b565a>=_0x22c285){_0x4b565a=_0x22c285;_0x3cadff=0xc8;}else{_0x3cadff=0xce;}_0x2ecb5c[_0x885d('0x1d')](_0x3cadff);return _0x2ecb5c['set'](_0x885d('0x23'),_0x1e2a42+'-'+_0x4b565a+'/'+_0x22c285)[_0x885d('0x1e')](_0x5d8bcd);}return null;};}function patchUpdates(_0x55738d){return function(_0x175e05){try{jsonpatch['apply'](_0x175e05,_0x55738d,!![]);}catch(_0x1bca4b){return BPromise[_0x885d('0x24')](_0x1bca4b);}return _0x175e05[_0x885d('0x25')]();};}function saveUpdates(_0x90589,_0x261c0f){return function(_0x2e76ef){if(_0x2e76ef){return _0x2e76ef[_0x885d('0x26')](_0x90589)[_0x885d('0x27')](function(_0x598b20){return _0x598b20;});}return null;};}function removeEntity(_0x38af62,_0x2b7e32){return function(_0x3032ac){if(_0x3032ac){return _0x3032ac['destroy']()[_0x885d('0x27')](function(){var _0x389803=_0x3032ac[_0x885d('0x28')]({'plain':!![]});var _0x7dc85b=_0x885d('0x29');return db[_0x885d('0x2a')][_0x885d('0x2b')]({'where':{'type':_0x7dc85b,'resourceId':_0x389803['id']}})[_0x885d('0x27')](function(){return _0x3032ac;});})[_0x885d('0x27')](function(){_0x38af62['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13948c,_0x4cd7fb){return function(_0x1dda46){if(!_0x1dda46){_0x13948c[_0x885d('0x1c')](0x194);}return _0x1dda46;};}function handleError(_0x34c415,_0x1f7120){_0x1f7120=_0x1f7120||0x1f4;return function(_0x16f4c1){logger[_0x885d('0x2c')](_0x16f4c1['stack']);if(_0x16f4c1[_0x885d('0x2d')]){delete _0x16f4c1[_0x885d('0x2d')];}_0x34c415['status'](_0x1f7120)[_0x885d('0x2e')](_0x16f4c1);};}exports['index']=function(_0x4dfad0,_0x3db722){var _0x5e54eb={},_0x3baf94={},_0x3b3024={'count':0x0,'rows':[]};var _0x20a5f8=_[_0x885d('0x2f')](db[_0x885d('0x30')][_0x885d('0x31')],function(_0x5a0f63){return{'name':_0x5a0f63[_0x885d('0x32')],'type':_0x5a0f63[_0x885d('0x33')][_0x885d('0x34')]};});_0x3baf94[_0x885d('0x35')]=_[_0x885d('0x2f')](_0x20a5f8,'name');_0x3baf94[_0x885d('0x36')]=_[_0x885d('0x37')](_0x4dfad0['query']);_0x3baf94[_0x885d('0x38')]=_[_0x885d('0x39')](_0x3baf94[_0x885d('0x35')],_0x3baf94[_0x885d('0x36')]);_0x5e54eb[_0x885d('0x3a')]=_[_0x885d('0x39')](_0x3baf94[_0x885d('0x35')],qs[_0x885d('0x3b')](_0x4dfad0['query']['fields']));_0x5e54eb['attributes']=_0x5e54eb['attributes'][_0x885d('0x3c')]?_0x5e54eb[_0x885d('0x3a')]:_0x3baf94['model'];if(!_0x4dfad0[_0x885d('0x36')]['hasOwnProperty'](_0x885d('0x3d'))){_0x5e54eb[_0x885d('0x21')]=qs[_0x885d('0x21')](_0x4dfad0[_0x885d('0x36')][_0x885d('0x21')]);_0x5e54eb[_0x885d('0x1f')]=qs[_0x885d('0x1f')](_0x4dfad0['query']['offset']);}_0x5e54eb[_0x885d('0x3e')]=qs['sort'](_0x4dfad0[_0x885d('0x36')]['sort']);_0x5e54eb['where']=qs[_0x885d('0x38')](_[_0x885d('0x3f')](_0x4dfad0[_0x885d('0x36')],_0x3baf94[_0x885d('0x38')]),_0x20a5f8);if(_0x4dfad0[_0x885d('0x36')][_0x885d('0x40')]){_0x5e54eb[_0x885d('0x41')]=_[_0x885d('0x42')](_0x5e54eb[_0x885d('0x41')],{'$or':_[_0x885d('0x2f')](_0x20a5f8,function(_0x11aebf){if(_0x11aebf[_0x885d('0x33')]!==_0x885d('0x43')){var _0x32079f={};_0x32079f[_0x11aebf[_0x885d('0x2d')]]={'$like':'%'+_0x4dfad0[_0x885d('0x36')]['filter']+'%'};return _0x32079f;}})});}_0x5e54eb=_[_0x885d('0x42')]({},_0x5e54eb,_0x4dfad0[_0x885d('0x44')]);var _0x33e227={'where':_0x5e54eb['where']};return db['Disposition'][_0x885d('0x22')](_0x33e227)[_0x885d('0x27')](function(_0x3a85f8){_0x3b3024[_0x885d('0x22')]=_0x3a85f8;if(_0x4dfad0[_0x885d('0x36')]['includeAll']){_0x5e54eb[_0x885d('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x885d('0x46')](_0x5e54eb);})[_0x885d('0x27')](function(_0x52b601){_0x3b3024[_0x885d('0x47')]=_0x52b601;return _0x3b3024;})['then'](respondWithFilteredResult(_0x3db722,_0x5e54eb))[_0x885d('0x48')](handleError(_0x3db722,null));};exports[_0x885d('0x49')]=function(_0x484094,_0x56f816){var _0x9f0b3c={'raw':!![],'where':{'id':_0x484094['params']['id']}},_0x43dcae={};_0x43dcae['model']=_['keys'](db[_0x885d('0x30')][_0x885d('0x31')]);_0x43dcae[_0x885d('0x36')]=_[_0x885d('0x37')](_0x484094['query']);_0x43dcae[_0x885d('0x38')]=_[_0x885d('0x39')](_0x43dcae[_0x885d('0x35')],_0x43dcae[_0x885d('0x36')]);_0x9f0b3c[_0x885d('0x3a')]=_[_0x885d('0x39')](_0x43dcae[_0x885d('0x35')],qs[_0x885d('0x3b')](_0x484094['query'][_0x885d('0x3b')]));_0x9f0b3c[_0x885d('0x3a')]=_0x9f0b3c['attributes'][_0x885d('0x3c')]?_0x9f0b3c[_0x885d('0x3a')]:_0x43dcae[_0x885d('0x35')];if(_0x484094['query']['includeAll']){_0x9f0b3c[_0x885d('0x45')]=[{'all':!![]}];}_0x9f0b3c=_[_0x885d('0x42')]({},_0x9f0b3c,_0x484094[_0x885d('0x44')]);return db[_0x885d('0x30')][_0x885d('0x4a')](_0x9f0b3c)[_0x885d('0x27')](handleEntityNotFound(_0x56f816,null))[_0x885d('0x27')](respondWithResult(_0x56f816,null))[_0x885d('0x48')](handleError(_0x56f816,null));};exports['create']=function(_0x151615,_0x4fb992){return db[_0x885d('0x30')]['create'](_0x151615['body'],{})[_0x885d('0x27')](function(_0xae07d9){var _0x2ea0c0=_0x151615[_0x885d('0x4b')][_0x885d('0x28')]({'plain':!![]});if(!_0x2ea0c0)throw new Error(_0x885d('0x4c'));if(_0x2ea0c0[_0x885d('0x4d')]===_0x885d('0x4b')){var _0x24f675=_0xae07d9[_0x885d('0x28')]({'plain':!![]});var _0x1774bd='Dispositions';return db[_0x885d('0x4e')][_0x885d('0x4a')]({'where':{'name':_0x1774bd,'userProfileId':_0x2ea0c0[_0x885d('0x4f')]},'raw':!![]})[_0x885d('0x27')](function(_0x49234f){if(_0x49234f&&_0x49234f[_0x885d('0x50')]===0x0){return db[_0x885d('0x2a')]['create']({'name':_0x24f675[_0x885d('0x2d')],'resourceId':_0x24f675['id'],'type':_0x49234f['name'],'sectionId':_0x49234f['id']},{})['then'](function(){return _0xae07d9;});}else{return _0xae07d9;}})[_0x885d('0x48')](function(_0x219b2b){logger[_0x885d('0x2c')](_0x885d('0x51'),_0x219b2b);throw _0x219b2b;});}return _0xae07d9;})[_0x885d('0x27')](respondWithResult(_0x4fb992,0xc9))['catch'](handleError(_0x4fb992,null));};exports[_0x885d('0x26')]=function(_0x5634d0,_0x4caed7){if(_0x5634d0['body']['id']){delete _0x5634d0['body']['id'];}return db[_0x885d('0x30')][_0x885d('0x4a')]({'where':{'id':_0x5634d0[_0x885d('0x52')]['id']}})[_0x885d('0x27')](handleEntityNotFound(_0x4caed7,null))[_0x885d('0x27')](saveUpdates(_0x5634d0[_0x885d('0x53')],null))[_0x885d('0x27')](respondWithResult(_0x4caed7,null))['catch'](handleError(_0x4caed7,null));};exports[_0x885d('0x2b')]=function(_0x5351fb,_0x7976ea){return db[_0x885d('0x30')][_0x885d('0x4a')]({'where':{'id':_0x5351fb[_0x885d('0x52')]['id']}})['then'](handleEntityNotFound(_0x7976ea,null))[_0x885d('0x27')](removeEntity(_0x7976ea,null))['catch'](handleError(_0x7976ea,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 08c6e6c..a6b6b1b 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 _0x9a6b=['name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','name_chat','name_mail','MailAccountId','name_sms'];(function(_0x15e10c,_0x545ca1){var _0x17cb4b=function(_0x5ba7d5){while(--_0x5ba7d5){_0x15e10c['push'](_0x15e10c['shift']());}};_0x17cb4b(++_0x545ca1);}(_0x9a6b,0x77));var _0xb9a6=function(_0x1396d7,_0x2a73e8){_0x1396d7=_0x1396d7-0x0;var _0x39166c=_0x9a6b[_0x1396d7];return _0x39166c;};'use strict';var _=require(_0xb9a6('0x0'));var util=require(_0xb9a6('0x1'));var logger=require(_0xb9a6('0x2'))(_0xb9a6('0x3'));var moment=require(_0xb9a6('0x4'));var BPromise=require(_0xb9a6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9a6('0x6'));var rimraf=require('rimraf');var config=require(_0xb9a6('0x7'));var attributes=require(_0xb9a6('0x8'));module[_0xb9a6('0x9')]=function(_0x2ca15b,_0x160e75){return _0x2ca15b[_0xb9a6('0xa')](_0xb9a6('0xb'),attributes,{'tableName':_0xb9a6('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xb9a6('0xd'),'fields':[_0xb9a6('0xe'),'ListId']},{'unique':!![],'name':_0xb9a6('0xf'),'fields':[_0xb9a6('0xe'),'ChatWebsiteId']},{'unique':!![],'name':_0xb9a6('0x10'),'fields':[_0xb9a6('0xe'),_0xb9a6('0x11')]},{'unique':!![],'name':_0xb9a6('0x12'),'fields':['name','SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0xb9a6('0xe'),'FaxAccountId']},{'unique':!![],'name':_0xb9a6('0x13'),'fields':['name',_0xb9a6('0x14')]},{'unique':!![],'name':_0xb9a6('0x15'),'fields':[_0xb9a6('0xe'),_0xb9a6('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc569=['../../config/environment','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','MailAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc569,0x159));var _0x9c56=function(_0x4d04b8,_0x539145){_0x4d04b8=_0x4d04b8-0x0;var _0x17e842=_0xc569[_0x4d04b8];return _0x17e842;};'use strict';var _=require(_0x9c56('0x0'));var util=require(_0x9c56('0x1'));var logger=require(_0x9c56('0x2'))('api');var moment=require(_0x9c56('0x3'));var BPromise=require(_0x9c56('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c56('0x5'));var rimraf=require(_0x9c56('0x6'));var config=require(_0x9c56('0x7'));var attributes=require('./disposition.attributes');module[_0x9c56('0x8')]=function(_0x2e2421,_0xe6ba11){return _0x2e2421[_0x9c56('0x9')]('Disposition',attributes,{'tableName':_0x9c56('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x9c56('0xb'),'fields':[_0x9c56('0xc'),_0x9c56('0xd')]},{'unique':!![],'name':_0x9c56('0xe'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x9c56('0xc'),_0x9c56('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0x9c56('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x9c56('0x10'),'fields':[_0x9c56('0xc'),_0x9c56('0x11')]},{'unique':!![],'name':_0x9c56('0x12'),'fields':[_0x9c56('0xc'),_0x9c56('0x13')]},{'unique':!![],'name':_0x9c56('0x14'),'fields':['name',_0x9c56('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 6503f94..93b3ee6 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 _0x420d=['rpc','../../config/environment','jayson/promise','client','http','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5326f3,_0x52db74){var _0x301be8=function(_0x969d4f){while(--_0x969d4f){_0x5326f3['push'](_0x5326f3['shift']());}};_0x301be8(++_0x52db74);}(_0x420d,0x148));var _0xd420=function(_0x5d8492,_0x10ce3a){_0x5d8492=_0x5d8492-0x0;var _0x1a17c2=_0x420d[_0x5d8492];return _0x1a17c2;};'use strict';var _=require(_0xd420('0x0'));var util=require(_0xd420('0x1'));var moment=require(_0xd420('0x2'));var BPromise=require(_0xd420('0x3'));var rs=require(_0xd420('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd420('0x5'))['db'];var utils=require(_0xd420('0x6'));var logger=require(_0xd420('0x7'))(_0xd420('0x8'));var config=require(_0xd420('0x9'));var jayson=require(_0xd420('0xa'));var client=jayson[_0xd420('0xb')][_0xd420('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x277bae,_0x39f7e6,_0x359d04){return new BPromise(function(_0x4fcd50,_0x98c52c){return client['request'](_0x277bae,_0x359d04)[_0xd420('0xd')](function(_0x3af0f5){logger[_0xd420('0xe')](_0xd420('0xf'),_0x39f7e6,_0xd420('0x10'));logger[_0xd420('0x11')](_0xd420('0x12'),_0x39f7e6,'request\x20sent',JSON[_0xd420('0x13')](_0x3af0f5));if(_0x3af0f5[_0xd420('0x14')]){if(_0x3af0f5['error'][_0xd420('0x15')]===0x1f4){logger['error'](_0xd420('0xf'),_0x39f7e6,_0x3af0f5['error'][_0xd420('0x16')]);return _0x98c52c(_0x3af0f5[_0xd420('0x14')][_0xd420('0x16')]);}logger[_0xd420('0x14')](_0xd420('0xf'),_0x39f7e6,_0x3af0f5[_0xd420('0x14')][_0xd420('0x16')]);return _0x4fcd50(_0x3af0f5[_0xd420('0x14')]['message']);}else{logger[_0xd420('0xe')](_0xd420('0xf'),_0x39f7e6,_0xd420('0x10'));_0x4fcd50(_0x3af0f5['result']['message']);}})[_0xd420('0x17')](function(_0x111294){logger[_0xd420('0x14')](_0xd420('0xf'),_0x39f7e6,_0x111294);_0x98c52c(_0x111294);});});} \ No newline at end of file +var _0x7d31=['../../config/environment','jayson/promise','client','http','Disposition,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','rpc'];(function(_0x22a3bc,_0x4da94e){var _0x4dcc97=function(_0x3408da){while(--_0x3408da){_0x22a3bc['push'](_0x22a3bc['shift']());}};_0x4dcc97(++_0x4da94e);}(_0x7d31,0x14e));var _0x17d3=function(_0x51ce3e,_0x4a1ed5){_0x51ce3e=_0x51ce3e-0x0;var _0x175562=_0x7d31[_0x51ce3e];return _0x175562;};'use strict';var _=require(_0x17d3('0x0'));var util=require(_0x17d3('0x1'));var moment=require(_0x17d3('0x2'));var BPromise=require(_0x17d3('0x3'));var rs=require(_0x17d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x17d3('0x5'));var config=require(_0x17d3('0x6'));var jayson=require(_0x17d3('0x7'));var client=jayson[_0x17d3('0x8')][_0x17d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43646a,_0xeda723,_0x346c02){return new BPromise(function(_0x5095bb,_0x5d9997){return client['request'](_0x43646a,_0x346c02)['then'](function(_0x120c4d){logger['info'](_0x17d3('0xa'),_0xeda723,_0x17d3('0xb'));logger['debug']('Disposition,\x20%s,\x20%s,\x20%s',_0xeda723,_0x17d3('0xb'),JSON[_0x17d3('0xc')](_0x120c4d));if(_0x120c4d['error']){if(_0x120c4d[_0x17d3('0xd')]['code']===0x1f4){logger[_0x17d3('0xd')](_0x17d3('0xa'),_0xeda723,_0x120c4d[_0x17d3('0xd')]['message']);return _0x5d9997(_0x120c4d[_0x17d3('0xd')][_0x17d3('0xe')]);}logger['error'](_0x17d3('0xa'),_0xeda723,_0x120c4d[_0x17d3('0xd')][_0x17d3('0xe')]);return _0x5095bb(_0x120c4d[_0x17d3('0xd')][_0x17d3('0xe')]);}else{logger[_0x17d3('0xf')](_0x17d3('0xa'),_0xeda723,_0x17d3('0xb'));_0x5095bb(_0x120c4d[_0x17d3('0x10')][_0x17d3('0xe')]);}})['catch'](function(_0x4e82d2){logger[_0x17d3('0xd')]('Disposition,\x20%s,\x20%s',_0xeda723,_0x4e82d2);_0x5d9997(_0x4e82d2);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index fb4b5b3..fb148e5 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 _0x83ad=['get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4af82a,_0x324b56){var _0x31a7f6=function(_0x4cea72){while(--_0x4cea72){_0x4af82a['push'](_0x4af82a['shift']());}};_0x31a7f6(++_0x324b56);}(_0x83ad,0x11a));var _0xd83a=function(_0x58f679,_0x11e21e){_0x58f679=_0x58f679-0x0;var _0x578cf7=_0x83ad[_0x58f679];return _0x578cf7;};'use strict';var multer=require('multer');var util=require(_0xd83a('0x0'));var path=require('path');var timeout=require(_0xd83a('0x1'));var express=require(_0xd83a('0x2'));var router=express['Router']();var fs_extra=require(_0xd83a('0x3'));var auth=require(_0xd83a('0x4'));var interaction=require(_0xd83a('0x5'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0xd83a('0x6')]('/',auth[_0xd83a('0x7')](),controller[_0xd83a('0x8')]);router[_0xd83a('0x6')](_0xd83a('0x9'),auth[_0xd83a('0x7')](),controller['show']);router[_0xd83a('0xa')]('/',auth[_0xd83a('0x7')](),controller['create']);router[_0xd83a('0xb')](_0xd83a('0x9'),auth[_0xd83a('0x7')](),controller[_0xd83a('0xc')]);router[_0xd83a('0xd')](_0xd83a('0x9'),auth['isAuthenticated'](),controller[_0xd83a('0xe')]);module[_0xd83a('0xf')]=router; \ No newline at end of file +var _0x86db=['put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./disposition.controller','get','/:id','isAuthenticated','create'];(function(_0x5ea416,_0x50ddcb){var _0x155582=function(_0x4fc75c){while(--_0x4fc75c){_0x5ea416['push'](_0x5ea416['shift']());}};_0x155582(++_0x50ddcb);}(_0x86db,0x16b));var _0xb86d=function(_0x17785e,_0x407d4e){_0x17785e=_0x17785e-0x0;var _0x5ccb41=_0x86db[_0x17785e];return _0x5ccb41;};'use strict';var multer=require('multer');var util=require(_0xb86d('0x0'));var path=require(_0xb86d('0x1'));var timeout=require(_0xb86d('0x2'));var express=require(_0xb86d('0x3'));var router=express[_0xb86d('0x4')]();var fs_extra=require(_0xb86d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb86d('0x6'));var controller=require(_0xb86d('0x7'));router[_0xb86d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb86d('0x8')](_0xb86d('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb86d('0xa')](),controller[_0xb86d('0xb')]);router[_0xb86d('0xc')]('/:id',auth[_0xb86d('0xa')](),controller[_0xb86d('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb86d('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index af99453..b60d0e1 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 _0x1ea2=['7200','12000','14400','9600','v17,v27,v29','INTEGER','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800'];(function(_0x18c1c9,_0x20818b){var _0x38cd88=function(_0x1c51b9){while(--_0x1c51b9){_0x18c1c9['push'](_0x18c1c9['shift']());}};_0x38cd88(++_0x20818b);}(_0x1ea2,0x160));var _0x21ea=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x1ea2[_0x369151];return _0x4292d5;};'use strict';var Sequelize=require(_0x21ea('0x0'));module['exports']={'name':{'type':Sequelize[_0x21ea('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x21ea('0x1')]},'ecm':{'type':Sequelize[_0x21ea('0x2')]('yes','no'),'defaultValue':_0x21ea('0x3')},'headerinfo':{'type':Sequelize[_0x21ea('0x1')],'defaultValue':_0x21ea('0x4')},'localstationid':{'type':Sequelize[_0x21ea('0x1')],'unique':_0x21ea('0x5')},'minrate':{'type':Sequelize[_0x21ea('0x2')](_0x21ea('0x6'),_0x21ea('0x7'),_0x21ea('0x8'),'9600',_0x21ea('0x9'),_0x21ea('0xa')),'defaultValue':_0x21ea('0x7')},'maxrate':{'type':Sequelize['ENUM']('2400',_0x21ea('0x7'),_0x21ea('0x8'),_0x21ea('0xb'),'12000','14400'),'defaultValue':_0x21ea('0xa')},'modem':{'type':Sequelize[_0x21ea('0x1')],'defaultValue':_0x21ea('0xc')},'gateway':{'type':Sequelize[_0x21ea('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x21ea('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x21ea('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x21ea('0x2')]('SIP','IAX',_0x21ea('0xe'),_0x21ea('0xf')),'defaultValue':_0x21ea('0x10')},'key':{'type':Sequelize[_0x21ea('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x21ea('0x11')],'defaultValue':function(){return _0x21ea('0x12');}},'notificationSound':{'type':Sequelize[_0x21ea('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x21ea('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x21ea('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x21ea('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x21ea('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x21ea('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x21ea('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x21ea('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x21ea('0x13')],'defaultValue':![],'comment':_0x21ea('0x15'),'set':function(_0x55fbdc){if(!_0x55fbdc)this[_0x21ea('0x16')]('mandatoryDispositionPauseId',null);this[_0x21ea('0x16')](_0x21ea('0x17'),_0x55fbdc);}}}; \ No newline at end of file +var _0x893b=['4800','7200','12000','14400','INTEGER','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','2400'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x893b,0x86));var _0xb893=function(_0x35e636,_0x570443){_0x35e636=_0x35e636-0x0;var _0x5e7c6a=_0x893b[_0x35e636];return _0x5e7c6a;};'use strict';var Sequelize=require(_0xb893('0x0'));module[_0xb893('0x1')]={'name':{'type':Sequelize[_0xb893('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb893('0x2')]},'ecm':{'type':Sequelize[_0xb893('0x3')](_0xb893('0x4'),'no'),'defaultValue':_0xb893('0x4')},'headerinfo':{'type':Sequelize[_0xb893('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xb893('0x3')](_0xb893('0x5'),_0xb893('0x6'),_0xb893('0x7'),'9600',_0xb893('0x8'),_0xb893('0x9')),'defaultValue':_0xb893('0x6')},'maxrate':{'type':Sequelize[_0xb893('0x3')](_0xb893('0x5'),_0xb893('0x6'),'7200','9600',_0xb893('0x8'),'14400'),'defaultValue':_0xb893('0x9')},'modem':{'type':Sequelize[_0xb893('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xb893('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb893('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb893('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xb893('0xb'),'IAX','DADHI','KHOMP'),'defaultValue':_0xb893('0xb')},'key':{'type':Sequelize[_0xb893('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb893('0xc')],'defaultValue':function(){return _0xb893('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb893('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb893('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb893('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb893('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb893('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb893('0xa')],'allowNull':!![],'defaultValue':null,'comment':_0xb893('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xb893('0xe')],'defaultValue':![],'comment':_0xb893('0x10'),'set':function(_0x55a16d){if(!_0x55a16d)this['setDataValue'](_0xb893('0x11'),null);this[_0xb893('0x12')](_0xb893('0x13'),_0x55a16d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index b4d386a..aaf2ddd 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 _0x8016=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','removeDispositions','ids','addAnswer','FaxAccountId','CannedAnswer','findOne','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','app','type','description','Fax\x20Extension','priority','Answer','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','push','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','Messages','dataValues','info','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','http','client','request','then','FaxAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','get','FaxAccounts','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8016,0x142));var _0x6801=function(_0x34ed02,_0x3eddbb){_0x34ed02=_0x34ed02-0x0;var _0xa80fcd=_0x8016[_0x34ed02];return _0xa80fcd;};'use strict';var emlformat=require(_0x6801('0x0'));var rimraf=require(_0x6801('0x1'));var zipdir=require(_0x6801('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6801('0x3'));var util=require(_0x6801('0x4'));var path=require(_0x6801('0x5'));var sox=require(_0x6801('0x6'));var csv=require(_0x6801('0x7'));var ejs=require(_0x6801('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6801('0x9'));var squel=require(_0x6801('0xa'));var crypto=require(_0x6801('0xb'));var jsforce=require(_0x6801('0xc'));var deskjs=require(_0x6801('0xd'));var toCsv=require(_0x6801('0x7'));var querystring=require(_0x6801('0xe'));var Papa=require('papaparse');var Redis=require(_0x6801('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6801('0x10'));var as=require(_0x6801('0x11'));var hardwareService=require(_0x6801('0x12'));var logger=require(_0x6801('0x13'))(_0x6801('0x14'));var utils=require(_0x6801('0x15'));var config=require(_0x6801('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6801('0x17'))['db'];config[_0x6801('0x18')]=_[_0x6801('0x19')](config[_0x6801('0x18')],{'host':_0x6801('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6801('0x18')]));require(_0x6801('0x1b'))[_0x6801('0x1c')](socket);var jayson=require(_0x6801('0x1d'));var client=jayson['client'][_0x6801('0x1e')]({'port':0x232c});var client9002=jayson[_0x6801('0x1f')][_0x6801('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4cbd7d,_0x114b22,_0x3e5d6b,_0xb40432){return new BPromise(function(_0x33064c,_0x269d8c){var _0x9a50b1=_0xb40432||client;return _0x9a50b1[_0x6801('0x20')](_0x4cbd7d,_0x3e5d6b)[_0x6801('0x21')](function(_0x56d035){logger['info'](_0x6801('0x22'),_0x114b22,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x114b22,'request\x20sent',JSON[_0x6801('0x23')](_0x56d035));if(_0x56d035[_0x6801('0x24')]){if(_0x56d035[_0x6801('0x24')][_0x6801('0x25')]===0x1f4){logger[_0x6801('0x24')]('FaxAccount,\x20%s,\x20%s',_0x114b22,_0x56d035['error'][_0x6801('0x26')]);return _0x269d8c(_0x56d035[_0x6801('0x24')][_0x6801('0x26')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x114b22,_0x56d035['error'][_0x6801('0x26')]);return _0x33064c(_0x56d035[_0x6801('0x24')][_0x6801('0x26')]);}else{logger['info'](_0x6801('0x22'),_0x114b22,_0x6801('0x27'));_0x33064c(_0x56d035[_0x6801('0x28')][_0x6801('0x26')]);}})['catch'](function(_0x5e5afc){logger['error']('FaxAccount,\x20%s,\x20%s',_0x114b22,_0x5e5afc);_0x269d8c(_0x5e5afc);});});}function respondWithStatusCode(_0x4079f4,_0x18bd45){_0x18bd45=_0x18bd45||0xcc;return function(_0x473523){if(_0x473523){return _0x4079f4['sendStatus'](_0x18bd45);}return _0x4079f4[_0x6801('0x29')](_0x18bd45)[_0x6801('0x2a')]();};}function respondWithResult(_0x59fcbd,_0x485193){_0x485193=_0x485193||0xc8;return function(_0x5d0f9d){if(_0x5d0f9d){return _0x59fcbd[_0x6801('0x29')](_0x485193)[_0x6801('0x2b')](_0x5d0f9d);}};}function respondWithFilteredResult(_0x476b5e,_0x4efd6e){return function(_0x157bf3){if(_0x157bf3){var _0x35b006=typeof _0x4efd6e[_0x6801('0x2c')]==='undefined'&&typeof _0x4efd6e[_0x6801('0x2d')]===_0x6801('0x2e');var _0x31a6a7=_0x157bf3[_0x6801('0x2f')];var _0x4b2d5c=_0x35b006?0x0:_0x4efd6e[_0x6801('0x2c')];var _0x4f2d11=_0x35b006?_0x157bf3[_0x6801('0x2f')]:_0x4efd6e['offset']+_0x4efd6e[_0x6801('0x2d')];var _0x4fc01c;if(_0x4f2d11>=_0x31a6a7){_0x4f2d11=_0x31a6a7;_0x4fc01c=0xc8;}else{_0x4fc01c=0xce;}_0x476b5e['status'](_0x4fc01c);return _0x476b5e[_0x6801('0x30')](_0x6801('0x31'),_0x4b2d5c+'-'+_0x4f2d11+'/'+_0x31a6a7)[_0x6801('0x2b')](_0x157bf3);}return null;};}function patchUpdates(_0x5684de){return function(_0x524e41){try{jsonpatch['apply'](_0x524e41,_0x5684de,!![]);}catch(_0x5ccd09){return BPromise[_0x6801('0x32')](_0x5ccd09);}return _0x524e41[_0x6801('0x33')]();};}function saveUpdates(_0x5d0a56,_0x565a58){return function(_0x48f015){if(_0x48f015){return _0x48f015[_0x6801('0x34')](_0x5d0a56)[_0x6801('0x21')](function(_0x58d43c){return _0x58d43c;});}return null;};}function removeEntity(_0x23620e,_0x316adc){return function(_0x203434){if(_0x203434){return _0x203434[_0x6801('0x35')]()[_0x6801('0x21')](function(){var _0x82e6a5=_0x203434[_0x6801('0x36')]({'plain':!![]});var _0x4df6b2=_0x6801('0x37');return db['UserProfileResource'][_0x6801('0x35')]({'where':{'type':_0x4df6b2,'resourceId':_0x82e6a5['id']}})[_0x6801('0x21')](function(){return _0x203434;});})['then'](function(){_0x23620e[_0x6801('0x29')](0xcc)[_0x6801('0x2a')]();});}};}function handleEntityNotFound(_0x52f6d1,_0x218c26){return function(_0x53f71f){if(!_0x53f71f){_0x52f6d1[_0x6801('0x38')](0x194);}return _0x53f71f;};}function handleError(_0x46a9aa,_0x3d5bf6){_0x3d5bf6=_0x3d5bf6||0x1f4;return function(_0x2f2fc6){logger['error'](_0x2f2fc6[_0x6801('0x39')]);if(_0x2f2fc6['name']){delete _0x2f2fc6[_0x6801('0x3a')];}_0x46a9aa[_0x6801('0x29')](_0x3d5bf6)['send'](_0x2f2fc6);};}exports[_0x6801('0x3b')]=function(_0x4a40cd,_0x2233d9){var _0x4f7ff9={'include':[{'model':db[_0x6801('0x3c')],'as':_0x6801('0x3d')}]},_0x44522e={},_0x4aa1d6={'count':0x0,'rows':[]};var _0x288498=_['map'](db[_0x6801('0x3e')][_0x6801('0x3f')],function(_0x4c27ce){return{'name':_0x4c27ce[_0x6801('0x40')],'type':_0x4c27ce['type'][_0x6801('0x41')]};});_0x44522e[_0x6801('0x42')]=_[_0x6801('0x43')](_0x288498,_0x6801('0x3a'));_0x44522e[_0x6801('0x44')]=_[_0x6801('0x45')](_0x4a40cd[_0x6801('0x44')]);_0x44522e[_0x6801('0x46')]=_[_0x6801('0x47')](_0x44522e['model'],_0x44522e['query']);_0x4f7ff9[_0x6801('0x48')]=_[_0x6801('0x47')](_0x44522e[_0x6801('0x42')],qs[_0x6801('0x49')](_0x4a40cd[_0x6801('0x44')][_0x6801('0x49')]));_0x4f7ff9[_0x6801('0x48')]=_0x4f7ff9['attributes']['length']?_0x4f7ff9[_0x6801('0x48')]:_0x44522e[_0x6801('0x42')];if(!_0x4a40cd[_0x6801('0x44')][_0x6801('0x4a')](_0x6801('0x4b'))){_0x4f7ff9[_0x6801('0x2d')]=qs[_0x6801('0x2d')](_0x4a40cd['query'][_0x6801('0x2d')]);_0x4f7ff9[_0x6801('0x2c')]=qs[_0x6801('0x2c')](_0x4a40cd[_0x6801('0x44')][_0x6801('0x2c')]);}_0x4f7ff9[_0x6801('0x4c')]=qs[_0x6801('0x4d')](_0x4a40cd[_0x6801('0x44')][_0x6801('0x4d')]);_0x4f7ff9[_0x6801('0x4e')]=qs[_0x6801('0x46')](_[_0x6801('0x4f')](_0x4a40cd[_0x6801('0x44')],_0x44522e['filters']),_0x288498);if(_0x4a40cd[_0x6801('0x44')][_0x6801('0x50')]){_0x4f7ff9['where']=_[_0x6801('0x51')](_0x4f7ff9[_0x6801('0x4e')],{'$or':_[_0x6801('0x43')](_0x288498,function(_0x1d2627){if(_0x1d2627['type']!=='VIRTUAL'){var _0x5c1ae8={};_0x5c1ae8[_0x1d2627['name']]={'$like':'%'+_0x4a40cd[_0x6801('0x44')]['filter']+'%'};return _0x5c1ae8;}})});}_0x4f7ff9=_[_0x6801('0x51')]({},_0x4f7ff9,_0x4a40cd[_0x6801('0x52')]);var _0x158991={'where':_0x4f7ff9[_0x6801('0x4e')]};return db[_0x6801('0x3e')][_0x6801('0x2f')](_0x158991)[_0x6801('0x21')](function(_0x45c2e7){_0x4aa1d6['count']=_0x45c2e7;if(_0x4a40cd[_0x6801('0x44')][_0x6801('0x53')]){_0x4f7ff9[_0x6801('0x54')]=[{'all':!![]}];}return db[_0x6801('0x3e')][_0x6801('0x55')](_0x4f7ff9);})[_0x6801('0x21')](function(_0xc22efa){_0x4aa1d6[_0x6801('0x56')]=_0xc22efa;return _0x4aa1d6;})[_0x6801('0x21')](respondWithFilteredResult(_0x2233d9,_0x4f7ff9))[_0x6801('0x57')](handleError(_0x2233d9,null));};exports[_0x6801('0x58')]=function(_0x30214e,_0x315fb0){var _0x3166d0={'raw':![],'where':{'id':_0x30214e[_0x6801('0x59')]['id']},'include':[{'model':db[_0x6801('0x3c')],'as':_0x6801('0x3d')}]},_0x533c61={};_0x533c61[_0x6801('0x42')]=_[_0x6801('0x45')](db['FaxAccount'][_0x6801('0x3f')]);_0x533c61['query']=_['keys'](_0x30214e[_0x6801('0x44')]);_0x533c61[_0x6801('0x46')]=_['intersection'](_0x533c61[_0x6801('0x42')],_0x533c61[_0x6801('0x44')]);_0x3166d0['attributes']=_[_0x6801('0x47')](_0x533c61['model'],qs[_0x6801('0x49')](_0x30214e[_0x6801('0x44')][_0x6801('0x49')]));_0x3166d0[_0x6801('0x48')]=_0x3166d0[_0x6801('0x48')][_0x6801('0x5a')]?_0x3166d0[_0x6801('0x48')]:_0x533c61[_0x6801('0x42')];if(_0x30214e[_0x6801('0x44')][_0x6801('0x53')]){_0x3166d0[_0x6801('0x54')]=[{'all':!![]}];}_0x3166d0=_[_0x6801('0x51')]({},_0x3166d0,_0x30214e['options']);return db[_0x6801('0x3e')][_0x6801('0x5b')](_0x3166d0)[_0x6801('0x21')](handleEntityNotFound(_0x315fb0,null))['then'](respondWithResult(_0x315fb0,null))[_0x6801('0x57')](handleError(_0x315fb0,null));};exports[_0x6801('0x5c')]=function(_0x1c0111,_0xc0ee0a){return db['FaxAccount']['create'](_0x1c0111[_0x6801('0x5d')],{})['then'](function(_0x39e638){var _0x27f90b=_0x1c0111['user'][_0x6801('0x36')]({'plain':!![]});if(!_0x27f90b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27f90b[_0x6801('0x5e')]===_0x6801('0x5f')){var _0x5b9cb2=_0x39e638['get']({'plain':!![]});var _0x34c440='FaxAccounts';return db[_0x6801('0x60')][_0x6801('0x5b')]({'where':{'name':_0x34c440,'userProfileId':_0x27f90b[_0x6801('0x61')]},'raw':!![]})['then'](function(_0x502313){if(_0x502313&&_0x502313[_0x6801('0x62')]===0x0){return db[_0x6801('0x63')][_0x6801('0x5c')]({'name':_0x5b9cb2['name'],'resourceId':_0x5b9cb2['id'],'type':_0x502313[_0x6801('0x3a')],'sectionId':_0x502313['id']},{})['then'](function(){return _0x39e638;});}else{return _0x39e638;}})[_0x6801('0x57')](function(_0x2b3f60){logger[_0x6801('0x24')](_0x6801('0x64'),_0x2b3f60);throw _0x2b3f60;});}return _0x39e638;})[_0x6801('0x21')](respondWithResult(_0xc0ee0a,0xc9))['catch'](handleError(_0xc0ee0a,null));};exports[_0x6801('0x34')]=function(_0xe04149,_0x8cea3f){if(_0xe04149['body']['id']){delete _0xe04149[_0x6801('0x5d')]['id'];}return db[_0x6801('0x3e')][_0x6801('0x5b')]({'where':{'id':_0xe04149[_0x6801('0x59')]['id']},'include':[{'model':db[_0x6801('0x3c')],'as':_0x6801('0x3d')}]})[_0x6801('0x21')](handleEntityNotFound(_0x8cea3f,null))[_0x6801('0x21')](saveUpdates(_0xe04149[_0x6801('0x5d')],null))[_0x6801('0x21')](respondWithResult(_0x8cea3f,null))[_0x6801('0x57')](handleError(_0x8cea3f,null));};exports['destroy']=function(_0x554ed5,_0x11ae13){return db[_0x6801('0x3e')]['find']({'where':{'id':_0x554ed5[_0x6801('0x59')]['id']}})['then'](handleEntityNotFound(_0x11ae13,null))[_0x6801('0x21')](removeEntity(_0x11ae13,null))['catch'](handleError(_0x11ae13,null));};exports[_0x6801('0x65')]=function(_0x59faf2,_0x133e7b){return db[_0x6801('0x3e')][_0x6801('0x65')]()[_0x6801('0x21')](respondWithResult(_0x133e7b,null))[_0x6801('0x57')](handleError(_0x133e7b,null));};exports[_0x6801('0x66')]=function(_0x3a4f16,_0x45cc3f,_0x381fa7){if(_0x3a4f16[_0x6801('0x5d')]['id']){delete _0x3a4f16[_0x6801('0x5d')]['id'];}return db['FaxAccount'][_0x6801('0x5b')]({'where':{'id':_0x3a4f16[_0x6801('0x59')]['id']}})[_0x6801('0x21')](handleEntityNotFound(_0x45cc3f,null))[_0x6801('0x21')](function(_0x2bb3db){if(_0x2bb3db){_0x3a4f16['body']['FaxAccountId']=_0x2bb3db['id'];return db[_0x6801('0x67')][_0x6801('0x5c')](_0x3a4f16[_0x6801('0x5d')]);}})[_0x6801('0x21')](respondWithResult(_0x45cc3f,null))['catch'](handleError(_0x45cc3f,null));};exports['getDispositions']=function(_0x29e6d9,_0xc787c9,_0x38e101){var _0x55bd42={'raw':![],'where':{}};var _0x52314a={};var _0x11f017={'count':0x0,'rows':[]};return db[_0x6801('0x3e')]['findOne']({'where':{'id':_0x29e6d9['params']['id']}})[_0x6801('0x21')](handleEntityNotFound(_0xc787c9,null))[_0x6801('0x21')](function(_0x1c677e){if(_0x1c677e){_0x52314a['model']=_[_0x6801('0x45')](db[_0x6801('0x67')][_0x6801('0x3f')]);_0x52314a[_0x6801('0x44')]=_[_0x6801('0x45')](_0x29e6d9[_0x6801('0x44')]);_0x52314a[_0x6801('0x46')]=_['intersection'](_0x52314a[_0x6801('0x42')],_0x52314a[_0x6801('0x44')]);_0x55bd42[_0x6801('0x48')]=_[_0x6801('0x47')](_0x52314a[_0x6801('0x42')],qs[_0x6801('0x49')](_0x29e6d9[_0x6801('0x44')][_0x6801('0x49')]));_0x55bd42[_0x6801('0x48')]=_0x55bd42['attributes'][_0x6801('0x5a')]?_0x55bd42['attributes']:_0x52314a['model'];if(!_0x29e6d9['query'][_0x6801('0x4a')](_0x6801('0x4b'))){_0x55bd42[_0x6801('0x2d')]=qs['limit'](_0x29e6d9['query'][_0x6801('0x2d')]);_0x55bd42['offset']=qs['offset'](_0x29e6d9[_0x6801('0x44')][_0x6801('0x2c')]);}_0x55bd42['order']=qs[_0x6801('0x4d')](_0x29e6d9['query'][_0x6801('0x4d')]);_0x55bd42['where']=qs[_0x6801('0x46')](_['pick'](_0x29e6d9[_0x6801('0x44')],_0x52314a['filters']));_0x55bd42[_0x6801('0x4e')]['FaxAccountId']=_0x1c677e['id'];if(_0x29e6d9[_0x6801('0x44')][_0x6801('0x50')]){_0x55bd42[_0x6801('0x4e')]=_[_0x6801('0x51')](_0x55bd42[_0x6801('0x4e')],{'$or':_['map'](_0x55bd42['attributes'],function(_0x2aba5d){var _0x283c7f={};_0x283c7f[_0x2aba5d]={'$like':'%'+_0x29e6d9['query'][_0x6801('0x50')]+'%'};return _0x283c7f;})});}_0x55bd42=_['merge']({},_0x55bd42,_0x29e6d9[_0x6801('0x52')]);return db['Disposition']['count']({'where':_0x55bd42[_0x6801('0x4e')]})[_0x6801('0x21')](function(_0x557418){_0x11f017[_0x6801('0x2f')]=_0x557418;if(_0x29e6d9[_0x6801('0x44')]['includeAll']){_0x55bd42['include']=[{'all':!![]}];}return db[_0x6801('0x67')][_0x6801('0x55')](_0x55bd42);})['then'](function(_0x24c985){_0x11f017['rows']=_0x24c985;return _0x11f017;});}})[_0x6801('0x21')](respondWithFilteredResult(_0xc787c9,_0x55bd42))[_0x6801('0x57')](handleError(_0xc787c9,null));};exports['removeDispositions']=function(_0x529df4,_0x348a19,_0x411acd){return db[_0x6801('0x3e')][_0x6801('0x5b')]({'where':{'id':_0x529df4[_0x6801('0x59')]['id']}})[_0x6801('0x21')](handleEntityNotFound(_0x348a19,null))[_0x6801('0x21')](function(_0x5326f1){if(_0x5326f1){return _0x5326f1[_0x6801('0x68')](_0x529df4[_0x6801('0x44')][_0x6801('0x69')]);}})[_0x6801('0x21')](respondWithStatusCode(_0x348a19,null))[_0x6801('0x57')](handleError(_0x348a19,null));};exports[_0x6801('0x6a')]=function(_0x40dfe6,_0x53b343,_0x402c20){if(_0x40dfe6[_0x6801('0x5d')]['id']){delete _0x40dfe6[_0x6801('0x5d')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x40dfe6[_0x6801('0x59')]['id']}})[_0x6801('0x21')](handleEntityNotFound(_0x53b343,null))[_0x6801('0x21')](function(_0x391b98){if(_0x391b98){_0x40dfe6['body'][_0x6801('0x6b')]=_0x391b98['id'];return db[_0x6801('0x6c')]['create'](_0x40dfe6[_0x6801('0x5d')]);}})[_0x6801('0x21')](respondWithResult(_0x53b343,null))[_0x6801('0x57')](handleError(_0x53b343,null));};exports['getAnswers']=function(_0x1299f7,_0x38f8d5,_0x44d177){var _0x138f73={'raw':![],'where':{}};var _0x2855a8={};var _0x5a63be={'count':0x0,'rows':[]};return db[_0x6801('0x3e')][_0x6801('0x6d')]({'where':{'id':_0x1299f7[_0x6801('0x59')]['id']}})[_0x6801('0x21')](handleEntityNotFound(_0x38f8d5,null))[_0x6801('0x21')](function(_0x5a3163){if(_0x5a3163){_0x2855a8['model']=_['keys'](db['CannedAnswer'][_0x6801('0x3f')]);_0x2855a8[_0x6801('0x44')]=_['keys'](_0x1299f7['query']);_0x2855a8[_0x6801('0x46')]=_[_0x6801('0x47')](_0x2855a8[_0x6801('0x42')],_0x2855a8[_0x6801('0x44')]);_0x138f73[_0x6801('0x48')]=_[_0x6801('0x47')](_0x2855a8[_0x6801('0x42')],qs[_0x6801('0x49')](_0x1299f7[_0x6801('0x44')][_0x6801('0x49')]));_0x138f73[_0x6801('0x48')]=_0x138f73['attributes'][_0x6801('0x5a')]?_0x138f73[_0x6801('0x48')]:_0x2855a8[_0x6801('0x42')];if(!_0x1299f7[_0x6801('0x44')][_0x6801('0x4a')](_0x6801('0x4b'))){_0x138f73[_0x6801('0x2d')]=qs['limit'](_0x1299f7[_0x6801('0x44')][_0x6801('0x2d')]);_0x138f73[_0x6801('0x2c')]=qs[_0x6801('0x2c')](_0x1299f7[_0x6801('0x44')][_0x6801('0x2c')]);}_0x138f73['order']=qs[_0x6801('0x4d')](_0x1299f7['query'][_0x6801('0x4d')]);_0x138f73[_0x6801('0x4e')]=qs[_0x6801('0x46')](_[_0x6801('0x4f')](_0x1299f7[_0x6801('0x44')],_0x2855a8[_0x6801('0x46')]));_0x138f73[_0x6801('0x4e')]['FaxAccountId']=_0x5a3163['id'];if(_0x1299f7[_0x6801('0x44')]['filter']){_0x138f73[_0x6801('0x4e')]=_[_0x6801('0x51')](_0x138f73['where'],{'$or':_['map'](_0x138f73[_0x6801('0x48')],function(_0x7b6744){var _0x5c7c5e={};_0x5c7c5e[_0x7b6744]={'$like':'%'+_0x1299f7[_0x6801('0x44')]['filter']+'%'};return _0x5c7c5e;})});}_0x138f73=_['merge']({},_0x138f73,_0x1299f7[_0x6801('0x52')]);return db[_0x6801('0x6c')][_0x6801('0x2f')]({'where':_0x138f73[_0x6801('0x4e')]})[_0x6801('0x21')](function(_0x14517c){_0x5a63be['count']=_0x14517c;if(_0x1299f7[_0x6801('0x44')][_0x6801('0x53')]){_0x138f73[_0x6801('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x138f73);})[_0x6801('0x21')](function(_0x4a78f5){_0x5a63be['rows']=_0x4a78f5;return _0x5a63be;});}})[_0x6801('0x21')](respondWithFilteredResult(_0x38f8d5,_0x138f73))['catch'](handleError(_0x38f8d5,null));};exports[_0x6801('0x6e')]=function(_0x5a521d,_0x578447,_0x3c411c){return db['FaxAccount'][_0x6801('0x5b')]({'where':{'id':_0x5a521d[_0x6801('0x59')]['id']}})['then'](handleEntityNotFound(_0x578447,null))[_0x6801('0x21')](function(_0x151158){if(_0x151158){return _0x151158[_0x6801('0x6e')](_0x5a521d[_0x6801('0x44')][_0x6801('0x69')]);}})[_0x6801('0x21')](respondWithStatusCode(_0x578447,null))['catch'](handleError(_0x578447,null));};exports[_0x6801('0x6f')]=function(_0x50951a,_0x2de725,_0x4be5d6){return db[_0x6801('0x70')][_0x6801('0x5b')]({'where':{'id':_0x50951a[_0x6801('0x59')]['id']}})[_0x6801('0x21')](handleEntityNotFound(_0x2de725,null))[_0x6801('0x21')](function(_0x34042f){if(_0x34042f){return _0x34042f[_0x6801('0x6f')](_0x50951a['body'][_0x6801('0x69')],_[_0x6801('0x71')](_0x50951a[_0x6801('0x5d')],[_0x6801('0x69'),'id'])||{});}})[_0x6801('0x21')](respondWithResult(_0x2de725,null))['catch'](handleError(_0x2de725,null));};exports[_0x6801('0x72')]=function(_0x10a5d7,_0x3682c8,_0x444d10){var _0x47c916={'raw':![],'where':{}};var _0x4bc1ca={};var _0x40b8a7={'count':0x0,'rows':[]};return db[_0x6801('0x3e')][_0x6801('0x6d')]({'where':{'id':_0x10a5d7['params']['id']}})[_0x6801('0x21')](handleEntityNotFound(_0x3682c8,null))[_0x6801('0x21')](function(_0x48f3d6){if(_0x48f3d6){_0x4bc1ca[_0x6801('0x42')]=_['keys'](db[_0x6801('0x70')]['rawAttributes']);_0x4bc1ca[_0x6801('0x44')]=_[_0x6801('0x45')](_0x10a5d7[_0x6801('0x44')]);_0x4bc1ca[_0x6801('0x46')]=_[_0x6801('0x47')](_0x4bc1ca[_0x6801('0x42')],_0x4bc1ca['query']);_0x47c916[_0x6801('0x48')]=_[_0x6801('0x47')](_0x4bc1ca[_0x6801('0x42')],qs[_0x6801('0x49')](_0x10a5d7['query'][_0x6801('0x49')]));_0x47c916[_0x6801('0x48')]=_0x47c916[_0x6801('0x48')][_0x6801('0x5a')]?_0x47c916[_0x6801('0x48')]:_0x4bc1ca[_0x6801('0x42')];if(!_0x10a5d7['query'][_0x6801('0x4a')](_0x6801('0x4b'))){_0x47c916[_0x6801('0x2d')]=qs[_0x6801('0x2d')](_0x10a5d7[_0x6801('0x44')][_0x6801('0x2d')]);_0x47c916[_0x6801('0x2c')]=qs[_0x6801('0x2c')](_0x10a5d7['query'][_0x6801('0x2c')]);}_0x47c916['order']=qs[_0x6801('0x4d')](_0x10a5d7[_0x6801('0x44')]['sort']);_0x47c916[_0x6801('0x4e')]=qs['filters'](_[_0x6801('0x4f')](_0x10a5d7[_0x6801('0x44')],_0x4bc1ca['filters']));_0x47c916['where'][_0x6801('0x6b')]=_0x48f3d6['id'];if(_0x10a5d7[_0x6801('0x44')][_0x6801('0x50')]){_0x47c916[_0x6801('0x4e')]=_['merge'](_0x47c916[_0x6801('0x4e')],{'$or':_[_0x6801('0x43')](_0x47c916['attributes'],function(_0x18de7e){var _0x483974={};_0x483974[_0x18de7e]={'$like':'%'+_0x10a5d7[_0x6801('0x44')][_0x6801('0x50')]+'%'};return _0x483974;})});}_0x47c916=_['merge']({},_0x47c916,_0x10a5d7['options']);return db[_0x6801('0x70')][_0x6801('0x2f')]({'where':_0x47c916[_0x6801('0x4e')]})[_0x6801('0x21')](function(_0x69d9de){_0x40b8a7[_0x6801('0x2f')]=_0x69d9de;if(_0x10a5d7['query'][_0x6801('0x53')]){_0x47c916[_0x6801('0x54')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x6801('0x73')],'as':_0x6801('0x74'),'attributes':['name',_0x6801('0x75'),'internal'],'required':![]},{'model':db[_0x6801('0x76')],'as':_0x6801('0x77'),'attributes':['id',_0x6801('0x3a'),_0x6801('0x78')],'where':_0x10a5d7[_0x6801('0x44')][_0x6801('0x79')]?{'id':_0x10a5d7['query'][_0x6801('0x79')]}:undefined,'required':_0x10a5d7[_0x6801('0x44')][_0x6801('0x79')]?!![]:![]}];}return db[_0x6801('0x70')][_0x6801('0x55')](_0x47c916);})['then'](function(_0x42825f){_0x40b8a7[_0x6801('0x56')]=_0x42825f;return _0x40b8a7;});}})[_0x6801('0x21')](respondWithFilteredResult(_0x3682c8,_0x47c916))['catch'](handleError(_0x3682c8,null));};exports[_0x6801('0x7a')]=function(_0x5d06b2,_0x3d1e6e,_0x5c1f66){return db[_0x6801('0x3e')][_0x6801('0x6d')]({'where':{'id':_0x5d06b2[_0x6801('0x59')]['id']}})[_0x6801('0x21')](handleEntityNotFound(_0x3d1e6e,null))[_0x6801('0x21')](function(_0x4aba25){if(_0x4aba25){return db[_0x6801('0x7b')][_0x6801('0x7c')](function(_0x3ee78c){return db['FaxApplication'][_0x6801('0x35')]({'where':{'FaxAccountId':_0x5d06b2[_0x6801('0x59')]['id']},'transaction':_0x3ee78c})[_0x6801('0x21')](function(_0x32b9b9){var _0x28b749=_[_0x6801('0x43')](_0x5d06b2[_0x6801('0x5d')],function(_0x29933f){_0x29933f['FaxAccountId']=_0x5d06b2['params']['id'];return _0x29933f;});return db[_0x6801('0x7d')][_0x6801('0x7e')](_0x28b749,{'transaction':_0x3ee78c});});})['then'](function(){return db['FaxApplication'][_0x6801('0x7f')]({'where':{'FaxAccountId':_0x5d06b2[_0x6801('0x59')]['id']},'order':'priority'});});}})[_0x6801('0x21')](respondWithResult(_0x3d1e6e,null))[_0x6801('0x57')](handleError(_0x3d1e6e,null));};exports[_0x6801('0x80')]=function(_0x137cfa,_0x5bad9b,_0x263778){var _0x51b4c4={};var _0x270b85={};var _0x332b21;var _0x5b1e74;return db[_0x6801('0x3e')]['findOne']({'where':{'id':_0x137cfa[_0x6801('0x59')]['id']}})[_0x6801('0x21')](handleEntityNotFound(_0x5bad9b,null))[_0x6801('0x21')](function(_0x4e2727){if(_0x4e2727){_0x332b21=_0x4e2727;_0x270b85[_0x6801('0x42')]=_[_0x6801('0x45')](db['FaxApplication'][_0x6801('0x3f')]);_0x270b85['query']=_['keys'](_0x137cfa[_0x6801('0x44')]);_0x270b85[_0x6801('0x46')]=_[_0x6801('0x47')](_0x270b85['model'],_0x270b85[_0x6801('0x44')]);_0x51b4c4[_0x6801('0x48')]=_[_0x6801('0x47')](_0x270b85['model'],qs[_0x6801('0x49')](_0x137cfa[_0x6801('0x44')][_0x6801('0x49')]));_0x51b4c4[_0x6801('0x48')]=_0x51b4c4['attributes']['length']?_0x51b4c4['attributes']:_0x270b85[_0x6801('0x42')];_0x51b4c4[_0x6801('0x4c')]=qs['sort'](_0x137cfa[_0x6801('0x44')][_0x6801('0x4d')]);_0x51b4c4[_0x6801('0x4e')]=qs['filters'](_[_0x6801('0x4f')](_0x137cfa[_0x6801('0x44')],_0x270b85[_0x6801('0x46')]));if(_0x137cfa[_0x6801('0x44')][_0x6801('0x50')]){_0x51b4c4[_0x6801('0x4e')]=_[_0x6801('0x51')](_0x51b4c4['where'],{'$or':_[_0x6801('0x43')](_0x51b4c4[_0x6801('0x48')],function(_0x12e393){var _0x371f02={};_0x371f02[_0x12e393]={'$like':'%'+_0x137cfa['query'][_0x6801('0x50')]+'%'};return _0x371f02;})});}_0x51b4c4=_['merge']({},_0x51b4c4,_0x137cfa['options']);return _0x332b21[_0x6801('0x80')](_0x51b4c4);}})[_0x6801('0x21')](function(_0x55c1bb){if(_0x55c1bb){_0x5b1e74=_0x55c1bb['length'];if(!_0x137cfa[_0x6801('0x44')]['hasOwnProperty'](_0x6801('0x4b'))){_0x51b4c4[_0x6801('0x2d')]=qs[_0x6801('0x2d')](_0x137cfa[_0x6801('0x44')][_0x6801('0x2d')]);_0x51b4c4[_0x6801('0x2c')]=qs['offset'](_0x137cfa[_0x6801('0x44')][_0x6801('0x2c')]);}return _0x332b21[_0x6801('0x80')](_0x51b4c4);}})[_0x6801('0x21')](function(_0x528770){if(_0x528770){return _0x528770?{'count':_0x5b1e74,'rows':_0x528770}:null;}})[_0x6801('0x21')](respondWithResult(_0x5bad9b,null))[_0x6801('0x57')](handleError(_0x5bad9b,null));};function Extension(_0x1ea3c5,_0x3f3dd2,_0x179b4a,_0x2f3820){this[_0x6801('0x81')]=_0x6801('0x82');this[_0x6801('0x83')]=_0x1ea3c5['localstationid'];this[_0x6801('0x84')]=_0x2f3820;this[_0x6801('0x85')]='system';this[_0x6801('0x86')]=_0x6801('0x87');this[_0x6801('0x6b')]=_0x1ea3c5['id'];this[_0x6801('0x88')]=_0x3f3dd2;this['appdata']=_0x179b4a;}function createExtensionsReciveFax(_0x58e543){var _0xdc5739=0x1;var _0x367625=[];_0x367625['push'](new Extension(_0x58e543,_0xdc5739,'',_0x6801('0x89')));_0xdc5739+=0x1;_0x367625['push'](new Extension(_0x58e543,_0xdc5739,'CDR(type)=inbound-fax','Set'));_0xdc5739+=0x1;for(var _0x4e71af in _0x58e543){if(_0x58e543[_0x6801('0x4a')](_0x4e71af)&&(_0x4e71af===_0x6801('0x8a')||_0x4e71af===_0x6801('0x8b')||_0x4e71af===_0x6801('0x8c')||_0x4e71af===_0x6801('0x8d')||_0x4e71af===_0x6801('0x8e')||_0x4e71af===_0x6801('0x8f')||_0x4e71af===_0x6801('0x90')||_0x4e71af===_0x6801('0x91')||_0x4e71af===_0x6801('0x92'))){_0x367625['push'](new Extension(_0x58e543,_0xdc5739,'FAXOPT('+_0x4e71af+')='+_0x58e543[_0x4e71af],_0x6801('0x93')));_0xdc5739+=0x1;}}_0x367625[_0x6801('0x94')](new Extension(_0x58e543,_0xdc5739,'6',_0x6801('0x95')));_0xdc5739+=0x1;_0x367625['push'](new Extension(_0x58e543,_0xdc5739,_0x6801('0x96'),_0x6801('0x97')));_0xdc5739=0x0;return _0x367625;}exports[_0x6801('0x98')]=function(_0xf4ead1,_0x53850b,_0xad5cd4){var _0x26ea93;return db[_0x6801('0x7b')][_0x6801('0x7c')](function(_0x5981a9){return db['FaxAccount'][_0x6801('0x5c')](_0xf4ead1[_0x6801('0x5d')],{'transaction':_0x5981a9})[_0x6801('0x21')](function(_0xb0c00e){_0x26ea93=_0xb0c00e['get']({'plain':!![]});return db[_0x6801('0x99')][_0x6801('0x7e')](createExtensionsReciveFax(_0x26ea93),{'transaction':_0x5981a9});});})[_0x6801('0x21')](function(){return _0x26ea93;})[_0x6801('0x21')](respondWithResult(_0x53850b,null))['catch'](handleError(_0x53850b,null));};exports['updateAccountApplications']=function(_0x4123f1,_0x4166fa,_0x4d640b){var _0x3f03c9;return db['sequelize'][_0x6801('0x7c')](function(_0x46b625){return db[_0x6801('0x3e')][_0x6801('0x34')](_0x4123f1[_0x6801('0x5d')],{'where':{'id':_0x4123f1[_0x6801('0x5d')]['id']},'transaction':_0x46b625})['then'](function(_0x4f4b28){return db[_0x6801('0x99')][_0x6801('0x35')]({'where':{'FaxAccountId':_0x4123f1[_0x6801('0x5d')]['id']},'transaction':_0x46b625})[_0x6801('0x21')](function(_0x3dede1){return db[_0x6801('0x99')][_0x6801('0x7e')](createExtensionsReciveFax(_[_0x6801('0x71')](_0x4123f1[_0x6801('0x5d')],[_0x6801('0x9a'),_0x6801('0x41'),_0x6801('0x9b'),_0x6801('0x9c'),_0x6801('0x9d'),_0x6801('0x9e')])),{'transaction':_0x46b625});});});})['then'](function(){return db[_0x6801('0x3e')][_0x6801('0x9f')](_0x4123f1[_0x6801('0x5d')]['id']);})[_0x6801('0x21')](respondWithResult(_0x4166fa,null))[_0x6801('0x57')](handleError(_0x4166fa,null));};exports[_0x6801('0xa0')]=function(_0x2a5dd5,_0x25976f,_0x3774f0){var _0x17c257={'raw':!![],'where':{}};var _0x17a6bd={};var _0x3be92a={'count':0x0,'rows':[]};return db[_0x6801('0x3e')][_0x6801('0x6d')]({'where':{'id':_0x2a5dd5[_0x6801('0x59')]['id']}})['then'](handleEntityNotFound(_0x25976f,null))[_0x6801('0x21')](function(_0x5f2408){if(_0x5f2408){_0x17a6bd[_0x6801('0x42')]=_[_0x6801('0x45')](db[_0x6801('0xa1')][_0x6801('0x3f')]);_0x17a6bd['query']=_[_0x6801('0x45')](_0x2a5dd5[_0x6801('0x44')]);_0x17a6bd[_0x6801('0x46')]=_['intersection'](_0x17a6bd['model'],_0x17a6bd['query']);_0x17c257[_0x6801('0x48')]=_[_0x6801('0x47')](_0x17a6bd[_0x6801('0x42')],qs[_0x6801('0x49')](_0x2a5dd5[_0x6801('0x44')][_0x6801('0x49')]));_0x17c257['attributes']=_0x17c257['attributes'][_0x6801('0x5a')]?_0x17c257[_0x6801('0x48')]:_0x17a6bd[_0x6801('0x42')];if(!_0x2a5dd5['query'][_0x6801('0x4a')](_0x6801('0x4b'))){_0x17c257[_0x6801('0x2d')]=qs['limit'](_0x2a5dd5[_0x6801('0x44')]['limit']);_0x17c257[_0x6801('0x2c')]=qs[_0x6801('0x2c')](_0x2a5dd5[_0x6801('0x44')][_0x6801('0x2c')]);}_0x17c257[_0x6801('0x4c')]=qs['sort'](_0x2a5dd5['query'][_0x6801('0x4d')]);_0x17c257[_0x6801('0x4e')]=qs[_0x6801('0x46')](_[_0x6801('0x4f')](_0x2a5dd5[_0x6801('0x44')],_0x17a6bd[_0x6801('0x46')]));_0x17c257['where'][_0x6801('0x6b')]=_0x5f2408['id'];if(_0x2a5dd5[_0x6801('0x44')][_0x6801('0x50')]){_0x17c257[_0x6801('0x4e')]=_[_0x6801('0x51')](_0x17c257[_0x6801('0x4e')],{'$or':_[_0x6801('0x43')](_0x17c257['attributes'],function(_0x265d05){var _0x5a4917={};_0x5a4917[_0x265d05]={'$like':'%'+_0x2a5dd5[_0x6801('0x44')]['filter']+'%'};return _0x5a4917;})});}if(_0x2a5dd5[_0x6801('0x44')][_0x6801('0xa2')]){var _0xecd6f8=_0x2a5dd5[_0x6801('0x44')][_0x6801('0xa2')]['split'](',');var _0x720cbd={};_0x720cbd[_0xecd6f8[0x0]]={'$gte':moment(_0xecd6f8[0x1])[_0x6801('0xa3')](_0x6801('0xa4'))};_0x17c257[_0x6801('0x4e')]=_['merge'](_0x17c257[_0x6801('0x4e')],_0x720cbd);}_0x17c257=_[_0x6801('0x51')]({},_0x17c257,_0x2a5dd5[_0x6801('0x52')]);return db[_0x6801('0xa1')]['count']({'where':_0x17c257[_0x6801('0x4e')]})['then'](function(_0x783d54){_0x3be92a[_0x6801('0x2f')]=_0x783d54;if(_0x2a5dd5[_0x6801('0x44')][_0x6801('0x53')]){_0x17c257[_0x6801('0x54')]=[{'all':!![]}];}return db[_0x6801('0xa1')]['findAll'](_0x17c257);})[_0x6801('0x21')](function(_0x42269e){_0x3be92a[_0x6801('0x56')]=_0x42269e;return _0x3be92a;});}})[_0x6801('0x21')](respondWithFilteredResult(_0x25976f,_0x17c257))[_0x6801('0x57')](handleError(_0x25976f,null));};exports[_0x6801('0xa5')]=function(_0x2adb01,_0x57627e,_0x345a07){var _0x666225,_0x13c47d={},_0x2acc6f;if(_0x2adb01[_0x6801('0x5d')]['to']){_0x2acc6f=_0x2adb01[_0x6801('0x5d')]['to'][0x0];}return db[_0x6801('0x3e')][_0x6801('0x5b')]({'where':{'id':_0x2adb01[_0x6801('0x59')]['id']},'include':[{'model':db[_0x6801('0xa6')],'as':_0x6801('0xa7'),'include':[{'model':db[_0x6801('0xa8')],'as':_0x6801('0xa9'),'where':{'fax':_0x2acc6f},'limit':0x1,'order':[[_0x6801('0x9c'),_0x6801('0xaa')]]}]}]})[_0x6801('0x21')](handleEntityNotFound(_0x57627e,null))[_0x6801('0x21')](function(_0x4dfe0d){_0x666225=_0x4dfe0d;if(_0x2adb01[_0x6801('0x5d')][_0x6801('0xab')]&&_0x2adb01['body'][_0x6801('0xab')]['length']){for(var _0x37ce19=0x0;_0x37ce19<_0x2adb01['body'][_0x6801('0xab')]['length'];_0x37ce19+=0x1){_0x2adb01[_0x6801('0x5d')][_0x6801('0xab')][_0x37ce19]={'filename':_0x2adb01[_0x6801('0x5d')][_0x6801('0xab')][_0x37ce19][_0x6801('0x3a')],'id':_0x2adb01['body']['attachments'][_0x37ce19]['id'],'path':path[_0x6801('0xac')](config[_0x6801('0xad')],_0x6801('0xae'),_0x2adb01[_0x6801('0x5d')][_0x6801('0xab')][_0x37ce19]['basename'])};}}return respondWithRpcPromise(_0x6801('0xaf'),_0x6801('0xaf'),{'FaxAccountId':_[_0x6801('0xb0')](_0x2adb01[_0x6801('0x59')]['id'])?undefined:_0x2adb01[_0x6801('0x59')]['id'],'path':_[_0x6801('0xb0')](_0x2adb01[_0x6801('0x5d')]['attachments'][0x0][_0x6801('0x5')])?undefined:_0x2adb01[_0x6801('0x5d')][_0x6801('0xab')][0x0][_0x6801('0x5')],'fax':_[_0x6801('0xb0')](_0x2adb01[_0x6801('0x5d')]['to'][0x0])?undefined:_0x2adb01['body']['to'][0x0]},client9002);})['then'](function(){if(_0x666225){if(_['isNil'](_0x2adb01['body'][_0x6801('0xb1')])){_0x2adb01['body'][_0x6801('0xb1')]=util[_0x6801('0xa3')](_0x6801('0xb2'),_0x666225['name'],_0x666225[_0x6801('0xb3')]);}if(_0x666225[_0x6801('0xa7')]){if(_0x666225[_0x6801('0xa7')][_0x6801('0xa9')]['length']){return _0x666225[_0x6801('0xa7')][_0x6801('0xa9')][0x0];}else{return db['CmContact'][_0x6801('0x5c')](_[_0x6801('0x19')](_0x2adb01[_0x6801('0x5d')],{'firstName':_0x2adb01['body']['to'][0x0],'phone':_0x2adb01['body']['to'][0x0],'fax':_0x2adb01['body']['to'][0x0],'ListId':_0x666225[_0x6801('0x9e')]}));}}else{throw new Error(_0x6801('0xb4'));}}else{throw new Error(_0x6801('0xb5'));}})['then'](function(_0x44ef37){if(_0x44ef37){return db[_0x6801('0x70')][_0x6801('0x5b')]({'where':{'ContactId':_0x44ef37['id'],'closed':![],'FaxAccountId':_0x666225['id']}})['then'](function(_0x11458e){if(_0x11458e){return[_0x11458e,![]];}return db['FaxInteraction'][_0x6801('0x5c')]({'UserId':_0x2adb01[_0x6801('0x5f')]['id'],'ContactId':_0x44ef37['id'],'FaxAccountId':_0x666225['id'],'fax':_0x2adb01[_0x6801('0x5d')]['to'][0x0],'firstMsgDirection':_0x6801('0xb6'),'Messages':[_['merge'](_0x2adb01[_0x6801('0x5d')],{'read':![],'body':_0x2adb01[_0x6801('0x5d')]['attachments'][0x0][_0x6801('0xb7')],'FaxAccountId':_0x666225['id'],'UserId':_0x2adb01[_0x6801('0x5f')]['id'],'ContactId':_0x44ef37['id'],'AttachmentId':_0x2adb01[_0x6801('0x5d')][_0x6801('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x6801('0xa1')],'as':'Messages'}]})[_0x6801('0x21')](function(_0x4a5338){return[_0x4a5338,!![]];});});}else{throw new Error(_0x6801('0xb8'));}})[_0x6801('0xb9')](function(_0x402098,_0x456d79){if(_0x456d79){return _0x402098;}return db[_0x6801('0xa1')][_0x6801('0x5c')]({'direction':_0x6801('0xb6'),'read':![],'body':_0x2adb01[_0x6801('0x5d')][_0x6801('0xab')][0x0][_0x6801('0xb7')],'FaxAccountId':_0x666225['id'],'FaxInteractionId':_0x402098['id'],'UserId':_0x2adb01[_0x6801('0x5f')]['id'],'ContactId':_0x402098[_0x6801('0xba')],'AttachmentId':_0x2adb01[_0x6801('0x5d')][_0x6801('0xab')][0x0]['id']})[_0x6801('0x21')](function(_0x326490){_0x402098['dataValues'][_0x6801('0xbb')]=[];_0x402098[_0x6801('0xbc')]['Messages'][_0x6801('0x94')](_0x326490[_0x6801('0xbc')]);return _0x402098;});})['then'](function(_0x3b5191){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x6801('0xb0')](_0x2adb01['params']['id'])?undefined:_0x2adb01[_0x6801('0x59')]['id'],'path':_[_0x6801('0xb0')](_0x2adb01[_0x6801('0x5d')][_0x6801('0xab')][0x0][_0x6801('0x5')])?undefined:_0x2adb01[_0x6801('0x5d')][_0x6801('0xab')][0x0][_0x6801('0x5')],'fax':_[_0x6801('0xb0')](_0x2adb01[_0x6801('0x5d')]['to'][0x0])?undefined:_0x2adb01[_0x6801('0x5d')]['to'][0x0],'AttachmentId':_0x2adb01['body']['attachments'][0x0]['id']},client9002)[_0x6801('0x21')](function(_0xb22549){logger[_0x6801('0xbd')](_0x6801('0xbe'),_0xb22549);})[_0x6801('0x57')](function(_0x400269){logger['info'](_0x6801('0xbe'),_0x400269);});return _0x3b5191;})['then'](respondWithResult(_0x57627e,null))[_0x6801('0x57')](handleError(_0x57627e,null));};exports[_0x6801('0xbf')]=function(_0x4b3a47,_0x2abce8,_0x34e043){return db[_0x6801('0x3e')][_0x6801('0x5b')]({'where':{'id':_0x4b3a47[_0x6801('0x59')]['id']}})['then'](handleEntityNotFound(_0x2abce8,null))[_0x6801('0x21')](function(_0x4ebaf8){if(_0x4ebaf8){return _0x4ebaf8['addAgents'](_0x4b3a47['body'][_0x6801('0x69')],_[_0x6801('0x71')](_0x4b3a47[_0x6801('0x5d')],[_0x6801('0x69'),'id'])||{})['spread'](function(_0x6bc2){for(var _0x5511fa=0x0;_0x5511fa<_0x4b3a47[_0x6801('0x5d')][_0x6801('0x69')]['length'];_0x5511fa+=0x1){socket[_0x6801('0xc0')]('userFaxAccount:save',{'UserId':_0x4b3a47[_0x6801('0x5d')][_0x6801('0x69')][_0x5511fa],'FaxAccountId':_0x4b3a47[_0x6801('0x59')]['id']});}return _0x6bc2;});}})[_0x6801('0x21')](respondWithResult(_0x2abce8,null))['catch'](handleError(_0x2abce8,null));};exports[_0x6801('0xc1')]=function(_0x59e9e3,_0x25d886,_0xaad75f){return db['FaxAccount'][_0x6801('0x5b')]({'where':{'id':_0x59e9e3['params']['id']}})['then'](handleEntityNotFound(_0x25d886,null))['then'](function(_0x3c65e2){if(_0x3c65e2){return _0x3c65e2[_0x6801('0xc1')](_0x59e9e3[_0x6801('0x44')]['ids'])[_0x6801('0x21')](function(){if(_[_0x6801('0xc2')](_0x59e9e3['query'][_0x6801('0x69')])){for(var _0x4fad0b=0x0;_0x4fad0b<_0x59e9e3[_0x6801('0x44')][_0x6801('0x69')]['length'];_0x4fad0b+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x59e9e3['query'][_0x6801('0x69')][_0x4fad0b]),'FaxAccountId':Number(_0x59e9e3['params']['id'])});}}else{socket[_0x6801('0xc0')](_0x6801('0xc3'),{'UserId':Number(_0x59e9e3[_0x6801('0x44')][_0x6801('0x69')]),'FaxAccountId':Number(_0x59e9e3[_0x6801('0x59')]['id'])});}});}})[_0x6801('0x21')](respondWithStatusCode(_0x25d886,null))['catch'](handleError(_0x25d886,null));};exports[_0x6801('0xc4')]=function(_0x29f2f4,_0x4e6521,_0x4e898e){var _0x4d23fd={};var _0x4d7686={};var _0x20289f;var _0x2033bf;return db[_0x6801('0x3e')]['findOne']({'where':{'id':_0x29f2f4[_0x6801('0x59')]['id']}})[_0x6801('0x21')](handleEntityNotFound(_0x4e6521,null))[_0x6801('0x21')](function(_0x5b9f44){if(_0x5b9f44){_0x20289f=_0x5b9f44;_0x4d7686[_0x6801('0x42')]=_[_0x6801('0x45')](db['User'][_0x6801('0x3f')]);_0x4d7686[_0x6801('0x44')]=_[_0x6801('0x45')](_0x29f2f4[_0x6801('0x44')]);_0x4d7686[_0x6801('0x46')]=_['intersection'](_0x4d7686[_0x6801('0x42')],_0x4d7686[_0x6801('0x44')]);_0x4d23fd[_0x6801('0x48')]=_['intersection'](_0x4d7686['model'],qs[_0x6801('0x49')](_0x29f2f4[_0x6801('0x44')][_0x6801('0x49')]));_0x4d23fd[_0x6801('0x48')]=_0x4d23fd['attributes'][_0x6801('0x5a')]?_0x4d23fd[_0x6801('0x48')]:_0x4d7686['model'];_0x4d23fd['order']=qs[_0x6801('0x4d')](_0x29f2f4[_0x6801('0x44')]['sort']);_0x4d23fd[_0x6801('0x4e')]=qs[_0x6801('0x46')](_[_0x6801('0x4f')](_0x29f2f4[_0x6801('0x44')],_0x4d7686[_0x6801('0x46')]));if(_0x29f2f4[_0x6801('0x44')][_0x6801('0x50')]){_0x4d23fd[_0x6801('0x4e')]=_[_0x6801('0x51')](_0x4d23fd[_0x6801('0x4e')],{'$or':_[_0x6801('0x43')](_0x4d23fd[_0x6801('0x48')],function(_0x34a68c){var _0x1e652a={};_0x1e652a[_0x34a68c]={'$like':'%'+_0x29f2f4[_0x6801('0x44')][_0x6801('0x50')]+'%'};return _0x1e652a;})});}_0x4d23fd=_[_0x6801('0x51')]({},_0x4d23fd,_0x29f2f4[_0x6801('0x52')]);return _0x20289f['getAgents'](_0x4d23fd);}})[_0x6801('0x21')](function(_0x580403){if(_0x580403){_0x2033bf=_0x580403[_0x6801('0x5a')];if(!_0x29f2f4[_0x6801('0x44')]['hasOwnProperty'](_0x6801('0x4b'))){_0x4d23fd['limit']=qs['limit'](_0x29f2f4[_0x6801('0x44')][_0x6801('0x2d')]);_0x4d23fd['offset']=qs[_0x6801('0x2c')](_0x29f2f4['query'][_0x6801('0x2c')]);}return _0x20289f[_0x6801('0xc4')](_0x4d23fd);}})[_0x6801('0x21')](function(_0xf76913){if(_0xf76913){return _0xf76913?{'count':_0x2033bf,'rows':_0xf76913}:null;}})['then'](respondWithResult(_0x4e6521,null))['catch'](handleError(_0x4e6521,null));}; \ No newline at end of file +var _0xa5d1=['userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./faxAccount.socket','register','jayson/promise','client','http','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','index','mandatoryDispositionPause','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','includeAll','include','findAll','rows','show','params','Pause','keys','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','CmContact','User','fullname','internal','Tag','tag','addApplications','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','app','system','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','Wait','ReceiveFax','addAccountApplications','sequelize','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','send','List','Contacts','attachments','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','dataValues','Messages','SendFax','addAgents','omit','spread','emit','userFaxAccount:save','removeAgents'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0xa5d1,0x182));var _0x1a5d=function(_0x2605f9,_0x3bfbc7){_0x2605f9=_0x2605f9-0x0;var _0x3eed4a=_0xa5d1[_0x2605f9];return _0x3eed4a;};'use strict';var emlformat=require(_0x1a5d('0x0'));var rimraf=require(_0x1a5d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a5d('0x2'));var rp=require(_0x1a5d('0x3'));var moment=require(_0x1a5d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a5d('0x5'));var util=require(_0x1a5d('0x6'));var path=require(_0x1a5d('0x7'));var sox=require(_0x1a5d('0x8'));var csv=require(_0x1a5d('0x9'));var ejs=require(_0x1a5d('0xa'));var fs=require('fs');var fs_extra=require(_0x1a5d('0xb'));var _=require(_0x1a5d('0xc'));var squel=require(_0x1a5d('0xd'));var crypto=require('crypto');var jsforce=require(_0x1a5d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1a5d('0x9'));var querystring=require(_0x1a5d('0xf'));var Papa=require('papaparse');var Redis=require(_0x1a5d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1a5d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a5d('0x12'));var logger=require(_0x1a5d('0x13'))(_0x1a5d('0x14'));var utils=require(_0x1a5d('0x15'));var config=require(_0x1a5d('0x16'));var licenseUtil=require(_0x1a5d('0x17'));var db=require(_0x1a5d('0x18'))['db'];config[_0x1a5d('0x19')]=_[_0x1a5d('0x1a')](config[_0x1a5d('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1a5d('0x1b'))[_0x1a5d('0x1c')](socket);var jayson=require(_0x1a5d('0x1d'));var client=jayson[_0x1a5d('0x1e')][_0x1a5d('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50caec,_0x460799,_0x1d830d,_0x28bf00){return new BPromise(function(_0x5347f4,_0x339c15){var _0x3040f7=_0x28bf00||client;return _0x3040f7['request'](_0x50caec,_0x1d830d)['then'](function(_0x3162c0){logger[_0x1a5d('0x20')](_0x1a5d('0x21'),_0x460799,_0x1a5d('0x22'));logger[_0x1a5d('0x23')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x460799,_0x1a5d('0x22'),JSON[_0x1a5d('0x24')](_0x3162c0));if(_0x3162c0['error']){if(_0x3162c0['error'][_0x1a5d('0x25')]===0x1f4){logger[_0x1a5d('0x26')](_0x1a5d('0x21'),_0x460799,_0x3162c0[_0x1a5d('0x26')][_0x1a5d('0x27')]);return _0x339c15(_0x3162c0[_0x1a5d('0x26')][_0x1a5d('0x27')]);}logger[_0x1a5d('0x26')](_0x1a5d('0x21'),_0x460799,_0x3162c0[_0x1a5d('0x26')][_0x1a5d('0x27')]);return _0x5347f4(_0x3162c0[_0x1a5d('0x26')][_0x1a5d('0x27')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x460799,'request\x20sent');_0x5347f4(_0x3162c0[_0x1a5d('0x28')]['message']);}})[_0x1a5d('0x29')](function(_0x4f949e){logger[_0x1a5d('0x26')]('FaxAccount,\x20%s,\x20%s',_0x460799,_0x4f949e);_0x339c15(_0x4f949e);});});}function respondWithStatusCode(_0x1d17eb,_0x52bdfd){_0x52bdfd=_0x52bdfd||0xcc;return function(_0x1e58b3){if(_0x1e58b3){return _0x1d17eb[_0x1a5d('0x2a')](_0x52bdfd);}return _0x1d17eb['status'](_0x52bdfd)[_0x1a5d('0x2b')]();};}function respondWithResult(_0x586d9e,_0x9a541b){_0x9a541b=_0x9a541b||0xc8;return function(_0x49831e){if(_0x49831e){return _0x586d9e[_0x1a5d('0x2c')](_0x9a541b)[_0x1a5d('0x2d')](_0x49831e);}};}function respondWithFilteredResult(_0x429fa2,_0x19b36c){return function(_0x3178e1){if(_0x3178e1){var _0x190233=typeof _0x19b36c[_0x1a5d('0x2e')]===_0x1a5d('0x2f')&&typeof _0x19b36c[_0x1a5d('0x30')]===_0x1a5d('0x2f');var _0x5bda1e=_0x3178e1['count'];var _0x29484b=_0x190233?0x0:_0x19b36c[_0x1a5d('0x2e')];var _0x41845a=_0x190233?_0x3178e1[_0x1a5d('0x31')]:_0x19b36c['offset']+_0x19b36c[_0x1a5d('0x30')];var _0x5d347b;if(_0x41845a>=_0x5bda1e){_0x41845a=_0x5bda1e;_0x5d347b=0xc8;}else{_0x5d347b=0xce;}_0x429fa2[_0x1a5d('0x2c')](_0x5d347b);return _0x429fa2[_0x1a5d('0x32')]('Content-Range',_0x29484b+'-'+_0x41845a+'/'+_0x5bda1e)[_0x1a5d('0x2d')](_0x3178e1);}return null;};}function patchUpdates(_0x2a4f63){return function(_0x2f8de8){try{jsonpatch[_0x1a5d('0x33')](_0x2f8de8,_0x2a4f63,!![]);}catch(_0x288934){return BPromise[_0x1a5d('0x34')](_0x288934);}return _0x2f8de8[_0x1a5d('0x35')]();};}function saveUpdates(_0x4aaffc,_0x375c89){return function(_0xa10f17){if(_0xa10f17){return _0xa10f17['update'](_0x4aaffc)[_0x1a5d('0x36')](function(_0x206a2e){return _0x206a2e;});}return null;};}function removeEntity(_0x4f42c8,_0x58ef6c){return function(_0x520147){if(_0x520147){return _0x520147[_0x1a5d('0x37')]()['then'](function(){var _0x463afe=_0x520147[_0x1a5d('0x38')]({'plain':!![]});var _0x555930='FaxAccounts';return db[_0x1a5d('0x39')][_0x1a5d('0x37')]({'where':{'type':_0x555930,'resourceId':_0x463afe['id']}})[_0x1a5d('0x36')](function(){return _0x520147;});})['then'](function(){_0x4f42c8[_0x1a5d('0x2c')](0xcc)[_0x1a5d('0x2b')]();});}};}function handleEntityNotFound(_0x15a9f7,_0x3dfa83){return function(_0x5ca25c){if(!_0x5ca25c){_0x15a9f7[_0x1a5d('0x2a')](0x194);}return _0x5ca25c;};}function handleError(_0x5631a3,_0x464fbb){_0x464fbb=_0x464fbb||0x1f4;return function(_0x57f8da){logger[_0x1a5d('0x26')](_0x57f8da[_0x1a5d('0x3a')]);if(_0x57f8da['name']){delete _0x57f8da[_0x1a5d('0x3b')];}_0x5631a3[_0x1a5d('0x2c')](_0x464fbb)['send'](_0x57f8da);};}exports[_0x1a5d('0x3c')]=function(_0x382490,_0x1ff727){var _0x3fbeb5={'include':[{'model':db['Pause'],'as':_0x1a5d('0x3d')}]},_0x13c459={},_0x204ad2={'count':0x0,'rows':[]};var _0x54a9b0=_['map'](db['FaxAccount']['rawAttributes'],function(_0x405996){return{'name':_0x405996[_0x1a5d('0x3e')],'type':_0x405996[_0x1a5d('0x3f')][_0x1a5d('0x40')]};});_0x13c459[_0x1a5d('0x41')]=_[_0x1a5d('0x42')](_0x54a9b0,_0x1a5d('0x3b'));_0x13c459[_0x1a5d('0x43')]=_['keys'](_0x382490[_0x1a5d('0x43')]);_0x13c459[_0x1a5d('0x44')]=_[_0x1a5d('0x45')](_0x13c459[_0x1a5d('0x41')],_0x13c459[_0x1a5d('0x43')]);_0x3fbeb5[_0x1a5d('0x46')]=_[_0x1a5d('0x45')](_0x13c459[_0x1a5d('0x41')],qs[_0x1a5d('0x47')](_0x382490[_0x1a5d('0x43')][_0x1a5d('0x47')]));_0x3fbeb5[_0x1a5d('0x46')]=_0x3fbeb5[_0x1a5d('0x46')][_0x1a5d('0x48')]?_0x3fbeb5[_0x1a5d('0x46')]:_0x13c459[_0x1a5d('0x41')];if(!_0x382490['query'][_0x1a5d('0x49')](_0x1a5d('0x4a'))){_0x3fbeb5[_0x1a5d('0x30')]=qs[_0x1a5d('0x30')](_0x382490[_0x1a5d('0x43')]['limit']);_0x3fbeb5[_0x1a5d('0x2e')]=qs[_0x1a5d('0x2e')](_0x382490['query'][_0x1a5d('0x2e')]);}_0x3fbeb5[_0x1a5d('0x4b')]=qs['sort'](_0x382490['query'][_0x1a5d('0x4c')]);_0x3fbeb5[_0x1a5d('0x4d')]=qs['filters'](_[_0x1a5d('0x4e')](_0x382490['query'],_0x13c459[_0x1a5d('0x44')]),_0x54a9b0);if(_0x382490[_0x1a5d('0x43')][_0x1a5d('0x4f')]){_0x3fbeb5[_0x1a5d('0x4d')]=_[_0x1a5d('0x50')](_0x3fbeb5[_0x1a5d('0x4d')],{'$or':_[_0x1a5d('0x42')](_0x54a9b0,function(_0x52a23a){if(_0x52a23a['type']!==_0x1a5d('0x51')){var _0x4e321d={};_0x4e321d[_0x52a23a[_0x1a5d('0x3b')]]={'$like':'%'+_0x382490[_0x1a5d('0x43')][_0x1a5d('0x4f')]+'%'};return _0x4e321d;}})});}_0x3fbeb5=_[_0x1a5d('0x50')]({},_0x3fbeb5,_0x382490[_0x1a5d('0x52')]);var _0x70000b={'where':_0x3fbeb5[_0x1a5d('0x4d')]};return db[_0x1a5d('0x53')]['count'](_0x70000b)[_0x1a5d('0x36')](function(_0x1ed8b3){_0x204ad2[_0x1a5d('0x31')]=_0x1ed8b3;if(_0x382490[_0x1a5d('0x43')][_0x1a5d('0x54')]){_0x3fbeb5[_0x1a5d('0x55')]=[{'all':!![]}];}return db[_0x1a5d('0x53')][_0x1a5d('0x56')](_0x3fbeb5);})[_0x1a5d('0x36')](function(_0x5ecc21){_0x204ad2[_0x1a5d('0x57')]=_0x5ecc21;return _0x204ad2;})[_0x1a5d('0x36')](respondWithFilteredResult(_0x1ff727,_0x3fbeb5))['catch'](handleError(_0x1ff727,null));};exports[_0x1a5d('0x58')]=function(_0x35da36,_0x255c7a){var _0x58db66={'raw':![],'where':{'id':_0x35da36[_0x1a5d('0x59')]['id']},'include':[{'model':db[_0x1a5d('0x5a')],'as':_0x1a5d('0x3d')}]},_0x5d5141={};_0x5d5141[_0x1a5d('0x41')]=_[_0x1a5d('0x5b')](db['FaxAccount'][_0x1a5d('0x5c')]);_0x5d5141[_0x1a5d('0x43')]=_['keys'](_0x35da36['query']);_0x5d5141[_0x1a5d('0x44')]=_[_0x1a5d('0x45')](_0x5d5141[_0x1a5d('0x41')],_0x5d5141[_0x1a5d('0x43')]);_0x58db66['attributes']=_[_0x1a5d('0x45')](_0x5d5141[_0x1a5d('0x41')],qs[_0x1a5d('0x47')](_0x35da36[_0x1a5d('0x43')][_0x1a5d('0x47')]));_0x58db66[_0x1a5d('0x46')]=_0x58db66[_0x1a5d('0x46')][_0x1a5d('0x48')]?_0x58db66['attributes']:_0x5d5141['model'];if(_0x35da36[_0x1a5d('0x43')][_0x1a5d('0x54')]){_0x58db66[_0x1a5d('0x55')]=[{'all':!![]}];}_0x58db66=_[_0x1a5d('0x50')]({},_0x58db66,_0x35da36[_0x1a5d('0x52')]);return db['FaxAccount']['find'](_0x58db66)['then'](handleEntityNotFound(_0x255c7a,null))['then'](respondWithResult(_0x255c7a,null))[_0x1a5d('0x29')](handleError(_0x255c7a,null));};exports['create']=function(_0x539a07,_0x481786){return db[_0x1a5d('0x53')][_0x1a5d('0x5d')](_0x539a07[_0x1a5d('0x5e')],{})[_0x1a5d('0x36')](function(_0x302dde){var _0x5c453c=_0x539a07[_0x1a5d('0x5f')]['get']({'plain':!![]});if(!_0x5c453c)throw new Error(_0x1a5d('0x60'));if(_0x5c453c[_0x1a5d('0x61')]===_0x1a5d('0x5f')){var _0x1cda0c=_0x302dde[_0x1a5d('0x38')]({'plain':!![]});var _0x130f65=_0x1a5d('0x62');return db[_0x1a5d('0x63')]['find']({'where':{'name':_0x130f65,'userProfileId':_0x5c453c[_0x1a5d('0x64')]},'raw':!![]})['then'](function(_0x24eafe){if(_0x24eafe&&_0x24eafe[_0x1a5d('0x65')]===0x0){return db[_0x1a5d('0x39')][_0x1a5d('0x5d')]({'name':_0x1cda0c[_0x1a5d('0x3b')],'resourceId':_0x1cda0c['id'],'type':_0x24eafe[_0x1a5d('0x3b')],'sectionId':_0x24eafe['id']},{})[_0x1a5d('0x36')](function(){return _0x302dde;});}else{return _0x302dde;}})[_0x1a5d('0x29')](function(_0x57613e){logger[_0x1a5d('0x26')](_0x1a5d('0x66'),_0x57613e);throw _0x57613e;});}return _0x302dde;})[_0x1a5d('0x36')](respondWithResult(_0x481786,0xc9))[_0x1a5d('0x29')](handleError(_0x481786,null));};exports[_0x1a5d('0x67')]=function(_0x4a6a80,_0x3b135c){if(_0x4a6a80[_0x1a5d('0x5e')]['id']){delete _0x4a6a80['body']['id'];}return db[_0x1a5d('0x53')][_0x1a5d('0x68')]({'where':{'id':_0x4a6a80[_0x1a5d('0x59')]['id']},'include':[{'model':db[_0x1a5d('0x5a')],'as':_0x1a5d('0x3d')}]})[_0x1a5d('0x36')](handleEntityNotFound(_0x3b135c,null))[_0x1a5d('0x36')](saveUpdates(_0x4a6a80['body'],null))[_0x1a5d('0x36')](respondWithResult(_0x3b135c,null))[_0x1a5d('0x29')](handleError(_0x3b135c,null));};exports[_0x1a5d('0x37')]=function(_0x4c0edd,_0x19ef22){return db[_0x1a5d('0x53')]['find']({'where':{'id':_0x4c0edd['params']['id']}})[_0x1a5d('0x36')](handleEntityNotFound(_0x19ef22,null))['then'](removeEntity(_0x19ef22,null))[_0x1a5d('0x29')](handleError(_0x19ef22,null));};exports['describe']=function(_0x1236bc,_0x3e75d5){return db[_0x1a5d('0x53')]['describe']()[_0x1a5d('0x36')](respondWithResult(_0x3e75d5,null))[_0x1a5d('0x29')](handleError(_0x3e75d5,null));};exports[_0x1a5d('0x69')]=function(_0x51cf18,_0x5fca11,_0xd6a5b0){if(_0x51cf18[_0x1a5d('0x5e')]['id']){delete _0x51cf18[_0x1a5d('0x5e')]['id'];}return db[_0x1a5d('0x53')][_0x1a5d('0x68')]({'where':{'id':_0x51cf18[_0x1a5d('0x59')]['id']}})['then'](handleEntityNotFound(_0x5fca11,null))['then'](function(_0x10f201){if(_0x10f201){_0x51cf18['body']['FaxAccountId']=_0x10f201['id'];return db[_0x1a5d('0x6a')]['create'](_0x51cf18[_0x1a5d('0x5e')]);}})[_0x1a5d('0x36')](respondWithResult(_0x5fca11,null))['catch'](handleError(_0x5fca11,null));};exports[_0x1a5d('0x6b')]=function(_0x58ab9d,_0x266fb8,_0x2a0432){var _0x2f0cd1={'raw':![],'where':{}};var _0x4c9a28={};var _0x2a4ced={'count':0x0,'rows':[]};return db[_0x1a5d('0x53')][_0x1a5d('0x6c')]({'where':{'id':_0x58ab9d[_0x1a5d('0x59')]['id']}})[_0x1a5d('0x36')](handleEntityNotFound(_0x266fb8,null))[_0x1a5d('0x36')](function(_0x413c12){if(_0x413c12){_0x4c9a28['model']=_[_0x1a5d('0x5b')](db[_0x1a5d('0x6a')]['rawAttributes']);_0x4c9a28['query']=_[_0x1a5d('0x5b')](_0x58ab9d['query']);_0x4c9a28[_0x1a5d('0x44')]=_['intersection'](_0x4c9a28[_0x1a5d('0x41')],_0x4c9a28[_0x1a5d('0x43')]);_0x2f0cd1[_0x1a5d('0x46')]=_[_0x1a5d('0x45')](_0x4c9a28['model'],qs['fields'](_0x58ab9d[_0x1a5d('0x43')]['fields']));_0x2f0cd1['attributes']=_0x2f0cd1[_0x1a5d('0x46')][_0x1a5d('0x48')]?_0x2f0cd1['attributes']:_0x4c9a28[_0x1a5d('0x41')];if(!_0x58ab9d[_0x1a5d('0x43')]['hasOwnProperty'](_0x1a5d('0x4a'))){_0x2f0cd1[_0x1a5d('0x30')]=qs['limit'](_0x58ab9d[_0x1a5d('0x43')]['limit']);_0x2f0cd1[_0x1a5d('0x2e')]=qs['offset'](_0x58ab9d['query'][_0x1a5d('0x2e')]);}_0x2f0cd1[_0x1a5d('0x4b')]=qs[_0x1a5d('0x4c')](_0x58ab9d[_0x1a5d('0x43')]['sort']);_0x2f0cd1['where']=qs[_0x1a5d('0x44')](_[_0x1a5d('0x4e')](_0x58ab9d[_0x1a5d('0x43')],_0x4c9a28[_0x1a5d('0x44')]));_0x2f0cd1[_0x1a5d('0x4d')][_0x1a5d('0x6d')]=_0x413c12['id'];if(_0x58ab9d[_0x1a5d('0x43')]['filter']){_0x2f0cd1['where']=_[_0x1a5d('0x50')](_0x2f0cd1[_0x1a5d('0x4d')],{'$or':_[_0x1a5d('0x42')](_0x2f0cd1['attributes'],function(_0x48ac01){var _0x1bf526={};_0x1bf526[_0x48ac01]={'$like':'%'+_0x58ab9d['query'][_0x1a5d('0x4f')]+'%'};return _0x1bf526;})});}_0x2f0cd1=_[_0x1a5d('0x50')]({},_0x2f0cd1,_0x58ab9d['options']);return db[_0x1a5d('0x6a')]['count']({'where':_0x2f0cd1[_0x1a5d('0x4d')]})[_0x1a5d('0x36')](function(_0x276273){_0x2a4ced[_0x1a5d('0x31')]=_0x276273;if(_0x58ab9d[_0x1a5d('0x43')]['includeAll']){_0x2f0cd1['include']=[{'all':!![]}];}return db['Disposition'][_0x1a5d('0x56')](_0x2f0cd1);})[_0x1a5d('0x36')](function(_0x293216){_0x2a4ced[_0x1a5d('0x57')]=_0x293216;return _0x2a4ced;});}})[_0x1a5d('0x36')](respondWithFilteredResult(_0x266fb8,_0x2f0cd1))[_0x1a5d('0x29')](handleError(_0x266fb8,null));};exports['removeDispositions']=function(_0x125124,_0x451516,_0x17a3ec){return db[_0x1a5d('0x53')][_0x1a5d('0x68')]({'where':{'id':_0x125124['params']['id']}})['then'](handleEntityNotFound(_0x451516,null))[_0x1a5d('0x36')](function(_0x22f973){if(_0x22f973){return _0x22f973[_0x1a5d('0x6e')](_0x125124[_0x1a5d('0x43')][_0x1a5d('0x6f')]);}})[_0x1a5d('0x36')](respondWithStatusCode(_0x451516,null))['catch'](handleError(_0x451516,null));};exports['addAnswer']=function(_0x282eb2,_0x223405,_0x142331){if(_0x282eb2[_0x1a5d('0x5e')]['id']){delete _0x282eb2['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x282eb2[_0x1a5d('0x59')]['id']}})['then'](handleEntityNotFound(_0x223405,null))[_0x1a5d('0x36')](function(_0x15f0a5){if(_0x15f0a5){_0x282eb2['body'][_0x1a5d('0x6d')]=_0x15f0a5['id'];return db[_0x1a5d('0x70')]['create'](_0x282eb2['body']);}})[_0x1a5d('0x36')](respondWithResult(_0x223405,null))['catch'](handleError(_0x223405,null));};exports[_0x1a5d('0x71')]=function(_0xb4a867,_0x30bbf0,_0x2c84f4){var _0x586cf2={'raw':![],'where':{}};var _0x11acfe={};var _0x301b93={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1a5d('0x6c')]({'where':{'id':_0xb4a867[_0x1a5d('0x59')]['id']}})[_0x1a5d('0x36')](handleEntityNotFound(_0x30bbf0,null))['then'](function(_0x403415){if(_0x403415){_0x11acfe[_0x1a5d('0x41')]=_[_0x1a5d('0x5b')](db[_0x1a5d('0x70')][_0x1a5d('0x5c')]);_0x11acfe['query']=_[_0x1a5d('0x5b')](_0xb4a867[_0x1a5d('0x43')]);_0x11acfe[_0x1a5d('0x44')]=_['intersection'](_0x11acfe[_0x1a5d('0x41')],_0x11acfe[_0x1a5d('0x43')]);_0x586cf2[_0x1a5d('0x46')]=_[_0x1a5d('0x45')](_0x11acfe[_0x1a5d('0x41')],qs[_0x1a5d('0x47')](_0xb4a867[_0x1a5d('0x43')][_0x1a5d('0x47')]));_0x586cf2[_0x1a5d('0x46')]=_0x586cf2[_0x1a5d('0x46')]['length']?_0x586cf2['attributes']:_0x11acfe[_0x1a5d('0x41')];if(!_0xb4a867[_0x1a5d('0x43')][_0x1a5d('0x49')](_0x1a5d('0x4a'))){_0x586cf2['limit']=qs[_0x1a5d('0x30')](_0xb4a867[_0x1a5d('0x43')][_0x1a5d('0x30')]);_0x586cf2[_0x1a5d('0x2e')]=qs[_0x1a5d('0x2e')](_0xb4a867[_0x1a5d('0x43')][_0x1a5d('0x2e')]);}_0x586cf2[_0x1a5d('0x4b')]=qs[_0x1a5d('0x4c')](_0xb4a867[_0x1a5d('0x43')][_0x1a5d('0x4c')]);_0x586cf2['where']=qs[_0x1a5d('0x44')](_[_0x1a5d('0x4e')](_0xb4a867['query'],_0x11acfe[_0x1a5d('0x44')]));_0x586cf2[_0x1a5d('0x4d')]['FaxAccountId']=_0x403415['id'];if(_0xb4a867[_0x1a5d('0x43')][_0x1a5d('0x4f')]){_0x586cf2[_0x1a5d('0x4d')]=_[_0x1a5d('0x50')](_0x586cf2[_0x1a5d('0x4d')],{'$or':_['map'](_0x586cf2[_0x1a5d('0x46')],function(_0x25b856){var _0xb5fa43={};_0xb5fa43[_0x25b856]={'$like':'%'+_0xb4a867[_0x1a5d('0x43')][_0x1a5d('0x4f')]+'%'};return _0xb5fa43;})});}_0x586cf2=_['merge']({},_0x586cf2,_0xb4a867['options']);return db['CannedAnswer'][_0x1a5d('0x31')]({'where':_0x586cf2[_0x1a5d('0x4d')]})['then'](function(_0x33b6e1){_0x301b93[_0x1a5d('0x31')]=_0x33b6e1;if(_0xb4a867[_0x1a5d('0x43')]['includeAll']){_0x586cf2[_0x1a5d('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1a5d('0x56')](_0x586cf2);})['then'](function(_0x59e50d){_0x301b93[_0x1a5d('0x57')]=_0x59e50d;return _0x301b93;});}})['then'](respondWithFilteredResult(_0x30bbf0,_0x586cf2))[_0x1a5d('0x29')](handleError(_0x30bbf0,null));};exports[_0x1a5d('0x72')]=function(_0x484674,_0x1ec7e3,_0x57fe49){return db[_0x1a5d('0x53')][_0x1a5d('0x68')]({'where':{'id':_0x484674[_0x1a5d('0x59')]['id']}})[_0x1a5d('0x36')](handleEntityNotFound(_0x1ec7e3,null))[_0x1a5d('0x36')](function(_0x5c77fd){if(_0x5c77fd){return _0x5c77fd[_0x1a5d('0x72')](_0x484674['query']['ids']);}})['then'](respondWithStatusCode(_0x1ec7e3,null))[_0x1a5d('0x29')](handleError(_0x1ec7e3,null));};exports[_0x1a5d('0x73')]=function(_0xd22eb4,_0x1c482c,_0xd2b4ff){return db[_0x1a5d('0x74')][_0x1a5d('0x68')]({'where':{'id':_0xd22eb4[_0x1a5d('0x59')]['id']}})[_0x1a5d('0x36')](handleEntityNotFound(_0x1c482c,null))[_0x1a5d('0x36')](function(_0x29fd85){if(_0x29fd85){return _0x29fd85[_0x1a5d('0x73')](_0xd22eb4['body'][_0x1a5d('0x6f')],_['omit'](_0xd22eb4['body'],[_0x1a5d('0x6f'),'id'])||{});}})[_0x1a5d('0x36')](respondWithResult(_0x1c482c,null))[_0x1a5d('0x29')](handleError(_0x1c482c,null));};exports['getInteractions']=function(_0x1d1bd8,_0x5c95db,_0x17f0ca){var _0x1841a4={'raw':![],'where':{}};var _0x52d56f={};var _0x1b2d75={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1a5d('0x6c')]({'where':{'id':_0x1d1bd8[_0x1a5d('0x59')]['id']}})['then'](handleEntityNotFound(_0x5c95db,null))[_0x1a5d('0x36')](function(_0x386eb5){if(_0x386eb5){_0x52d56f[_0x1a5d('0x41')]=_[_0x1a5d('0x5b')](db[_0x1a5d('0x74')][_0x1a5d('0x5c')]);_0x52d56f[_0x1a5d('0x43')]=_['keys'](_0x1d1bd8[_0x1a5d('0x43')]);_0x52d56f[_0x1a5d('0x44')]=_[_0x1a5d('0x45')](_0x52d56f[_0x1a5d('0x41')],_0x52d56f[_0x1a5d('0x43')]);_0x1841a4[_0x1a5d('0x46')]=_[_0x1a5d('0x45')](_0x52d56f[_0x1a5d('0x41')],qs[_0x1a5d('0x47')](_0x1d1bd8[_0x1a5d('0x43')][_0x1a5d('0x47')]));_0x1841a4[_0x1a5d('0x46')]=_0x1841a4[_0x1a5d('0x46')]['length']?_0x1841a4['attributes']:_0x52d56f[_0x1a5d('0x41')];if(!_0x1d1bd8[_0x1a5d('0x43')][_0x1a5d('0x49')](_0x1a5d('0x4a'))){_0x1841a4[_0x1a5d('0x30')]=qs[_0x1a5d('0x30')](_0x1d1bd8['query'][_0x1a5d('0x30')]);_0x1841a4[_0x1a5d('0x2e')]=qs['offset'](_0x1d1bd8[_0x1a5d('0x43')][_0x1a5d('0x2e')]);}_0x1841a4['order']=qs[_0x1a5d('0x4c')](_0x1d1bd8[_0x1a5d('0x43')][_0x1a5d('0x4c')]);_0x1841a4[_0x1a5d('0x4d')]=qs[_0x1a5d('0x44')](_[_0x1a5d('0x4e')](_0x1d1bd8[_0x1a5d('0x43')],_0x52d56f[_0x1a5d('0x44')]));_0x1841a4[_0x1a5d('0x4d')][_0x1a5d('0x6d')]=_0x386eb5['id'];if(_0x1d1bd8[_0x1a5d('0x43')][_0x1a5d('0x4f')]){_0x1841a4[_0x1a5d('0x4d')]=_[_0x1a5d('0x50')](_0x1841a4[_0x1a5d('0x4d')],{'$or':_['map'](_0x1841a4[_0x1a5d('0x46')],function(_0x5d80b4){var _0x3e6554={};_0x3e6554[_0x5d80b4]={'$like':'%'+_0x1d1bd8[_0x1a5d('0x43')]['filter']+'%'};return _0x3e6554;})});}_0x1841a4=_[_0x1a5d('0x50')]({},_0x1841a4,_0x1d1bd8[_0x1a5d('0x52')]);return db[_0x1a5d('0x74')]['count']({'where':_0x1841a4[_0x1a5d('0x4d')]})[_0x1a5d('0x36')](function(_0x504b29){_0x1b2d75[_0x1a5d('0x31')]=_0x504b29;if(_0x1d1bd8['query'][_0x1a5d('0x54')]){_0x1841a4[_0x1a5d('0x55')]=[{'model':db[_0x1a5d('0x75')],'as':'Contact','required':![]},{'model':db[_0x1a5d('0x76')],'as':'Owner','attributes':['name',_0x1a5d('0x77'),_0x1a5d('0x78')],'required':![]},{'model':db[_0x1a5d('0x79')],'as':'Tags','attributes':['id',_0x1a5d('0x3b'),'color'],'where':_0x1d1bd8[_0x1a5d('0x43')][_0x1a5d('0x7a')]?{'id':_0x1d1bd8['query'][_0x1a5d('0x7a')]}:undefined,'required':_0x1d1bd8[_0x1a5d('0x43')][_0x1a5d('0x7a')]?!![]:![]}];}return db[_0x1a5d('0x74')][_0x1a5d('0x56')](_0x1841a4);})[_0x1a5d('0x36')](function(_0x361361){_0x1b2d75[_0x1a5d('0x57')]=_0x361361;return _0x1b2d75;});}})['then'](respondWithFilteredResult(_0x5c95db,_0x1841a4))['catch'](handleError(_0x5c95db,null));};exports[_0x1a5d('0x7b')]=function(_0x554e1c,_0x480f73,_0x4dea4c){return db['FaxAccount'][_0x1a5d('0x6c')]({'where':{'id':_0x554e1c[_0x1a5d('0x59')]['id']}})['then'](handleEntityNotFound(_0x480f73,null))[_0x1a5d('0x36')](function(_0x1aa8bb){if(_0x1aa8bb){return db['sequelize']['transaction'](function(_0x488c65){return db[_0x1a5d('0x7c')][_0x1a5d('0x37')]({'where':{'FaxAccountId':_0x554e1c[_0x1a5d('0x59')]['id']},'transaction':_0x488c65})[_0x1a5d('0x36')](function(_0x1d3449){var _0x2a8852=_[_0x1a5d('0x42')](_0x554e1c['body'],function(_0x326346){_0x326346[_0x1a5d('0x6d')]=_0x554e1c[_0x1a5d('0x59')]['id'];return _0x326346;});return db[_0x1a5d('0x7c')][_0x1a5d('0x7d')](_0x2a8852,{'transaction':_0x488c65});});})[_0x1a5d('0x36')](function(){return db['FaxApplication'][_0x1a5d('0x7e')]({'where':{'FaxAccountId':_0x554e1c[_0x1a5d('0x59')]['id']},'order':_0x1a5d('0x7f')});});}})[_0x1a5d('0x36')](respondWithResult(_0x480f73,null))[_0x1a5d('0x29')](handleError(_0x480f73,null));};exports['getApplications']=function(_0x2c0969,_0x5ef150,_0x2bda5f){var _0x32cf00={};var _0x1fb6d7={};var _0x204a0c;var _0x1ddb77;return db[_0x1a5d('0x53')][_0x1a5d('0x6c')]({'where':{'id':_0x2c0969[_0x1a5d('0x59')]['id']}})[_0x1a5d('0x36')](handleEntityNotFound(_0x5ef150,null))['then'](function(_0x22ff83){if(_0x22ff83){_0x204a0c=_0x22ff83;_0x1fb6d7[_0x1a5d('0x41')]=_[_0x1a5d('0x5b')](db['FaxApplication'][_0x1a5d('0x5c')]);_0x1fb6d7[_0x1a5d('0x43')]=_['keys'](_0x2c0969[_0x1a5d('0x43')]);_0x1fb6d7[_0x1a5d('0x44')]=_[_0x1a5d('0x45')](_0x1fb6d7[_0x1a5d('0x41')],_0x1fb6d7[_0x1a5d('0x43')]);_0x32cf00[_0x1a5d('0x46')]=_[_0x1a5d('0x45')](_0x1fb6d7[_0x1a5d('0x41')],qs[_0x1a5d('0x47')](_0x2c0969[_0x1a5d('0x43')][_0x1a5d('0x47')]));_0x32cf00[_0x1a5d('0x46')]=_0x32cf00[_0x1a5d('0x46')][_0x1a5d('0x48')]?_0x32cf00[_0x1a5d('0x46')]:_0x1fb6d7['model'];_0x32cf00[_0x1a5d('0x4b')]=qs['sort'](_0x2c0969['query'][_0x1a5d('0x4c')]);_0x32cf00[_0x1a5d('0x4d')]=qs[_0x1a5d('0x44')](_[_0x1a5d('0x4e')](_0x2c0969[_0x1a5d('0x43')],_0x1fb6d7[_0x1a5d('0x44')]));if(_0x2c0969[_0x1a5d('0x43')][_0x1a5d('0x4f')]){_0x32cf00[_0x1a5d('0x4d')]=_[_0x1a5d('0x50')](_0x32cf00[_0x1a5d('0x4d')],{'$or':_['map'](_0x32cf00['attributes'],function(_0x73b0dc){var _0x33090e={};_0x33090e[_0x73b0dc]={'$like':'%'+_0x2c0969[_0x1a5d('0x43')][_0x1a5d('0x4f')]+'%'};return _0x33090e;})});}_0x32cf00=_[_0x1a5d('0x50')]({},_0x32cf00,_0x2c0969['options']);return _0x204a0c[_0x1a5d('0x80')](_0x32cf00);}})['then'](function(_0x1c81a4){if(_0x1c81a4){_0x1ddb77=_0x1c81a4[_0x1a5d('0x48')];if(!_0x2c0969[_0x1a5d('0x43')][_0x1a5d('0x49')]('nolimit')){_0x32cf00[_0x1a5d('0x30')]=qs[_0x1a5d('0x30')](_0x2c0969['query'][_0x1a5d('0x30')]);_0x32cf00[_0x1a5d('0x2e')]=qs['offset'](_0x2c0969[_0x1a5d('0x43')][_0x1a5d('0x2e')]);}return _0x204a0c[_0x1a5d('0x80')](_0x32cf00);}})['then'](function(_0x3b2863){if(_0x3b2863){return _0x3b2863?{'count':_0x1ddb77,'rows':_0x3b2863}:null;}})['then'](respondWithResult(_0x5ef150,null))[_0x1a5d('0x29')](handleError(_0x5ef150,null));};function Extension(_0xd22f80,_0x4749c8,_0x517800,_0x253f92){this[_0x1a5d('0x81')]='from-voip-provider';this[_0x1a5d('0x82')]=_0xd22f80[_0x1a5d('0x83')];this[_0x1a5d('0x84')]=_0x253f92;this['type']=_0x1a5d('0x85');this['description']='Fax\x20Extension';this[_0x1a5d('0x6d')]=_0xd22f80['id'];this[_0x1a5d('0x7f')]=_0x4749c8;this[_0x1a5d('0x86')]=_0x517800;}function createExtensionsReciveFax(_0x204702){var _0x1529b9=0x1;var _0x28232a=[];_0x28232a[_0x1a5d('0x87')](new Extension(_0x204702,_0x1529b9,'',_0x1a5d('0x88')));_0x1529b9+=0x1;_0x28232a[_0x1a5d('0x87')](new Extension(_0x204702,_0x1529b9,_0x1a5d('0x89'),_0x1a5d('0x8a')));_0x1529b9+=0x1;for(var _0x4bb4f9 in _0x204702){if(_0x204702[_0x1a5d('0x49')](_0x4bb4f9)&&(_0x4bb4f9===_0x1a5d('0x8b')||_0x4bb4f9===_0x1a5d('0x83')||_0x4bb4f9===_0x1a5d('0x8c')||_0x4bb4f9==='faxdetect'||_0x4bb4f9===_0x1a5d('0x8d')||_0x4bb4f9===_0x1a5d('0x8e')||_0x4bb4f9===_0x1a5d('0x8f')||_0x4bb4f9===_0x1a5d('0x90')||_0x4bb4f9===_0x1a5d('0x91'))){_0x28232a[_0x1a5d('0x87')](new Extension(_0x204702,_0x1529b9,'FAXOPT('+_0x4bb4f9+')='+_0x204702[_0x4bb4f9],'Set'));_0x1529b9+=0x1;}}_0x28232a[_0x1a5d('0x87')](new Extension(_0x204702,_0x1529b9,'6',_0x1a5d('0x92')));_0x1529b9+=0x1;_0x28232a[_0x1a5d('0x87')](new Extension(_0x204702,_0x1529b9,'/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',_0x1a5d('0x93')));_0x1529b9=0x0;return _0x28232a;}exports[_0x1a5d('0x94')]=function(_0x239fd0,_0x1966db,_0x17a720){var _0x31ce30;return db[_0x1a5d('0x95')][_0x1a5d('0x96')](function(_0x1b690e){return db[_0x1a5d('0x53')][_0x1a5d('0x5d')](_0x239fd0[_0x1a5d('0x5e')],{'transaction':_0x1b690e})[_0x1a5d('0x36')](function(_0x2e5afe){_0x31ce30=_0x2e5afe['get']({'plain':!![]});return db[_0x1a5d('0x97')]['bulkCreate'](createExtensionsReciveFax(_0x31ce30),{'transaction':_0x1b690e});});})[_0x1a5d('0x36')](function(){return _0x31ce30;})[_0x1a5d('0x36')](respondWithResult(_0x1966db,null))[_0x1a5d('0x29')](handleError(_0x1966db,null));};exports[_0x1a5d('0x98')]=function(_0x50507f,_0x1741bb,_0xf4859c){var _0x6f79ac;return db[_0x1a5d('0x95')]['transaction'](function(_0x394340){return db[_0x1a5d('0x53')][_0x1a5d('0x67')](_0x50507f[_0x1a5d('0x5e')],{'where':{'id':_0x50507f['body']['id']},'transaction':_0x394340})[_0x1a5d('0x36')](function(_0x516a0f){return db[_0x1a5d('0x97')]['destroy']({'where':{'FaxAccountId':_0x50507f[_0x1a5d('0x5e')]['id']},'transaction':_0x394340})['then'](function(_0xfee950){return db[_0x1a5d('0x97')][_0x1a5d('0x7d')](createExtensionsReciveFax(_['omit'](_0x50507f[_0x1a5d('0x5e')],[_0x1a5d('0x99'),_0x1a5d('0x40'),_0x1a5d('0x9a'),_0x1a5d('0x9b'),_0x1a5d('0x9c'),_0x1a5d('0x9d')])),{'transaction':_0x394340});});});})['then'](function(){return db[_0x1a5d('0x53')][_0x1a5d('0x9e')](_0x50507f[_0x1a5d('0x5e')]['id']);})[_0x1a5d('0x36')](respondWithResult(_0x1741bb,null))[_0x1a5d('0x29')](handleError(_0x1741bb,null));};exports[_0x1a5d('0x9f')]=function(_0x1513e2,_0x24a79b,_0xf15fda){var _0x1917f7={'raw':!![],'where':{}};var _0x4a1ada={};var _0xac638c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1a5d('0x6c')]({'where':{'id':_0x1513e2[_0x1a5d('0x59')]['id']}})[_0x1a5d('0x36')](handleEntityNotFound(_0x24a79b,null))[_0x1a5d('0x36')](function(_0x5d570b){if(_0x5d570b){_0x4a1ada[_0x1a5d('0x41')]=_[_0x1a5d('0x5b')](db[_0x1a5d('0xa0')][_0x1a5d('0x5c')]);_0x4a1ada[_0x1a5d('0x43')]=_[_0x1a5d('0x5b')](_0x1513e2[_0x1a5d('0x43')]);_0x4a1ada[_0x1a5d('0x44')]=_[_0x1a5d('0x45')](_0x4a1ada[_0x1a5d('0x41')],_0x4a1ada[_0x1a5d('0x43')]);_0x1917f7[_0x1a5d('0x46')]=_[_0x1a5d('0x45')](_0x4a1ada[_0x1a5d('0x41')],qs['fields'](_0x1513e2[_0x1a5d('0x43')][_0x1a5d('0x47')]));_0x1917f7['attributes']=_0x1917f7[_0x1a5d('0x46')]['length']?_0x1917f7['attributes']:_0x4a1ada[_0x1a5d('0x41')];if(!_0x1513e2['query']['hasOwnProperty'](_0x1a5d('0x4a'))){_0x1917f7[_0x1a5d('0x30')]=qs[_0x1a5d('0x30')](_0x1513e2[_0x1a5d('0x43')][_0x1a5d('0x30')]);_0x1917f7[_0x1a5d('0x2e')]=qs[_0x1a5d('0x2e')](_0x1513e2[_0x1a5d('0x43')][_0x1a5d('0x2e')]);}_0x1917f7['order']=qs[_0x1a5d('0x4c')](_0x1513e2[_0x1a5d('0x43')][_0x1a5d('0x4c')]);_0x1917f7['where']=qs[_0x1a5d('0x44')](_[_0x1a5d('0x4e')](_0x1513e2['query'],_0x4a1ada[_0x1a5d('0x44')]));_0x1917f7[_0x1a5d('0x4d')]['FaxAccountId']=_0x5d570b['id'];if(_0x1513e2[_0x1a5d('0x43')][_0x1a5d('0x4f')]){_0x1917f7[_0x1a5d('0x4d')]=_[_0x1a5d('0x50')](_0x1917f7['where'],{'$or':_[_0x1a5d('0x42')](_0x1917f7['attributes'],function(_0x410bf4){var _0x23c0a6={};_0x23c0a6[_0x410bf4]={'$like':'%'+_0x1513e2['query'][_0x1a5d('0x4f')]+'%'};return _0x23c0a6;})});}if(_0x1513e2[_0x1a5d('0x43')]['$gte']){var _0x12388d=_0x1513e2['query']['$gte'][_0x1a5d('0xa1')](',');var _0x50a33e={};_0x50a33e[_0x12388d[0x0]]={'$gte':moment(_0x12388d[0x1])[_0x1a5d('0xa2')](_0x1a5d('0xa3'))};_0x1917f7['where']=_['merge'](_0x1917f7[_0x1a5d('0x4d')],_0x50a33e);}_0x1917f7=_[_0x1a5d('0x50')]({},_0x1917f7,_0x1513e2['options']);return db[_0x1a5d('0xa0')]['count']({'where':_0x1917f7['where']})[_0x1a5d('0x36')](function(_0x58daae){_0xac638c[_0x1a5d('0x31')]=_0x58daae;if(_0x1513e2[_0x1a5d('0x43')][_0x1a5d('0x54')]){_0x1917f7[_0x1a5d('0x55')]=[{'all':!![]}];}return db[_0x1a5d('0xa0')][_0x1a5d('0x56')](_0x1917f7);})[_0x1a5d('0x36')](function(_0x4e726d){_0xac638c[_0x1a5d('0x57')]=_0x4e726d;return _0xac638c;});}})[_0x1a5d('0x36')](respondWithFilteredResult(_0x24a79b,_0x1917f7))[_0x1a5d('0x29')](handleError(_0x24a79b,null));};exports[_0x1a5d('0xa4')]=function(_0x4837cc,_0x3139ad,_0x21502b){var _0xabb36,_0x29ed4f={},_0x1bbc85;if(_0x4837cc['body']['to']){_0x1bbc85=_0x4837cc[_0x1a5d('0x5e')]['to'][0x0];}return db[_0x1a5d('0x53')][_0x1a5d('0x68')]({'where':{'id':_0x4837cc[_0x1a5d('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x1a5d('0xa5'),'include':[{'model':db['CmContact'],'as':_0x1a5d('0xa6'),'where':{'fax':_0x1bbc85},'limit':0x1,'order':[[_0x1a5d('0x9b'),'DESC']]}]}]})[_0x1a5d('0x36')](handleEntityNotFound(_0x3139ad,null))['then'](function(_0x3f5f55){_0xabb36=_0x3f5f55;if(_0x4837cc[_0x1a5d('0x5e')]['attachments']&&_0x4837cc[_0x1a5d('0x5e')][_0x1a5d('0xa7')][_0x1a5d('0x48')]){for(var _0x2ba065=0x0;_0x2ba065<_0x4837cc[_0x1a5d('0x5e')][_0x1a5d('0xa7')]['length'];_0x2ba065+=0x1){_0x4837cc[_0x1a5d('0x5e')][_0x1a5d('0xa7')][_0x2ba065]={'filename':_0x4837cc['body'][_0x1a5d('0xa7')][_0x2ba065][_0x1a5d('0x3b')],'id':_0x4837cc[_0x1a5d('0x5e')][_0x1a5d('0xa7')][_0x2ba065]['id'],'path':path['join'](config[_0x1a5d('0xa8')],_0x1a5d('0xa9'),_0x4837cc[_0x1a5d('0x5e')][_0x1a5d('0xa7')][_0x2ba065]['basename'])};}}return respondWithRpcPromise(_0x1a5d('0xaa'),_0x1a5d('0xaa'),{'FaxAccountId':_[_0x1a5d('0xab')](_0x4837cc['params']['id'])?undefined:_0x4837cc['params']['id'],'path':_['isNil'](_0x4837cc[_0x1a5d('0x5e')][_0x1a5d('0xa7')][0x0][_0x1a5d('0x7')])?undefined:_0x4837cc[_0x1a5d('0x5e')][_0x1a5d('0xa7')][0x0][_0x1a5d('0x7')],'fax':_[_0x1a5d('0xab')](_0x4837cc[_0x1a5d('0x5e')]['to'][0x0])?undefined:_0x4837cc[_0x1a5d('0x5e')]['to'][0x0]},client9002);})[_0x1a5d('0x36')](function(){if(_0xabb36){if(_[_0x1a5d('0xab')](_0x4837cc[_0x1a5d('0x5e')][_0x1a5d('0xac')])){_0x4837cc[_0x1a5d('0x5e')][_0x1a5d('0xac')]=util[_0x1a5d('0xa2')](_0x1a5d('0xad'),_0xabb36['name'],_0xabb36[_0x1a5d('0xae')]);}if(_0xabb36[_0x1a5d('0xa5')]){if(_0xabb36['List'][_0x1a5d('0xa6')][_0x1a5d('0x48')]){return _0xabb36[_0x1a5d('0xa5')][_0x1a5d('0xa6')][0x0];}else{return db[_0x1a5d('0x75')][_0x1a5d('0x5d')](_[_0x1a5d('0x1a')](_0x4837cc[_0x1a5d('0x5e')],{'firstName':_0x4837cc[_0x1a5d('0x5e')]['to'][0x0],'phone':_0x4837cc['body']['to'][0x0],'fax':_0x4837cc[_0x1a5d('0x5e')]['to'][0x0],'ListId':_0xabb36[_0x1a5d('0x9d')]}));}}else{throw new Error(_0x1a5d('0xaf'));}}else{throw new Error(_0x1a5d('0xb0'));}})['then'](function(_0x2b5254){if(_0x2b5254){return db['FaxInteraction']['find']({'where':{'ContactId':_0x2b5254['id'],'closed':![],'FaxAccountId':_0xabb36['id']}})[_0x1a5d('0x36')](function(_0xc79696){if(_0xc79696){return[_0xc79696,![]];}return db['FaxInteraction'][_0x1a5d('0x5d')]({'UserId':_0x4837cc[_0x1a5d('0x5f')]['id'],'ContactId':_0x2b5254['id'],'FaxAccountId':_0xabb36['id'],'fax':_0x4837cc[_0x1a5d('0x5e')]['to'][0x0],'firstMsgDirection':_0x1a5d('0xb1'),'Messages':[_[_0x1a5d('0x50')](_0x4837cc[_0x1a5d('0x5e')],{'read':![],'body':_0x4837cc[_0x1a5d('0x5e')][_0x1a5d('0xa7')][0x0][_0x1a5d('0xb2')],'FaxAccountId':_0xabb36['id'],'UserId':_0x4837cc[_0x1a5d('0x5f')]['id'],'ContactId':_0x2b5254['id'],'AttachmentId':_0x4837cc['body'][_0x1a5d('0xa7')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x1a5d('0x36')](function(_0x1d478d){return[_0x1d478d,!![]];});});}else{throw new Error(_0x1a5d('0xb3'));}})['spread'](function(_0x4876e0,_0x59ccd6){if(_0x59ccd6){return _0x4876e0;}return db[_0x1a5d('0xa0')][_0x1a5d('0x5d')]({'direction':_0x1a5d('0xb1'),'read':![],'body':_0x4837cc[_0x1a5d('0x5e')]['attachments'][0x0][_0x1a5d('0xb2')],'FaxAccountId':_0xabb36['id'],'FaxInteractionId':_0x4876e0['id'],'UserId':_0x4837cc[_0x1a5d('0x5f')]['id'],'ContactId':_0x4876e0[_0x1a5d('0xb4')],'AttachmentId':_0x4837cc[_0x1a5d('0x5e')]['attachments'][0x0]['id']})[_0x1a5d('0x36')](function(_0x407fd2){_0x4876e0[_0x1a5d('0xb5')][_0x1a5d('0xb6')]=[];_0x4876e0[_0x1a5d('0xb5')][_0x1a5d('0xb6')]['push'](_0x407fd2[_0x1a5d('0xb5')]);return _0x4876e0;});})[_0x1a5d('0x36')](function(_0xbbd63e){respondWithRpcPromise('SendFax',_0x1a5d('0xb7'),{'FaxAccountId':_[_0x1a5d('0xab')](_0x4837cc[_0x1a5d('0x59')]['id'])?undefined:_0x4837cc[_0x1a5d('0x59')]['id'],'path':_[_0x1a5d('0xab')](_0x4837cc[_0x1a5d('0x5e')][_0x1a5d('0xa7')][0x0][_0x1a5d('0x7')])?undefined:_0x4837cc['body'][_0x1a5d('0xa7')][0x0][_0x1a5d('0x7')],'fax':_['isNil'](_0x4837cc['body']['to'][0x0])?undefined:_0x4837cc[_0x1a5d('0x5e')]['to'][0x0],'AttachmentId':_0x4837cc[_0x1a5d('0x5e')][_0x1a5d('0xa7')][0x0]['id']},client9002)['then'](function(_0x3dc73e){logger[_0x1a5d('0x20')]('SendFaxRpc,\x20%s',_0x3dc73e);})[_0x1a5d('0x29')](function(_0xe7c350){logger[_0x1a5d('0x20')]('SendFaxRpc,\x20%s',_0xe7c350);});return _0xbbd63e;})[_0x1a5d('0x36')](respondWithResult(_0x3139ad,null))[_0x1a5d('0x29')](handleError(_0x3139ad,null));};exports[_0x1a5d('0xb8')]=function(_0x1b33cc,_0x256161,_0x564034){return db[_0x1a5d('0x53')]['find']({'where':{'id':_0x1b33cc[_0x1a5d('0x59')]['id']}})[_0x1a5d('0x36')](handleEntityNotFound(_0x256161,null))[_0x1a5d('0x36')](function(_0x1b8499){if(_0x1b8499){return _0x1b8499['addAgents'](_0x1b33cc[_0x1a5d('0x5e')]['ids'],_[_0x1a5d('0xb9')](_0x1b33cc[_0x1a5d('0x5e')],[_0x1a5d('0x6f'),'id'])||{})[_0x1a5d('0xba')](function(_0x2894c0){for(var _0x50182e=0x0;_0x50182e<_0x1b33cc[_0x1a5d('0x5e')][_0x1a5d('0x6f')][_0x1a5d('0x48')];_0x50182e+=0x1){socket[_0x1a5d('0xbb')](_0x1a5d('0xbc'),{'UserId':_0x1b33cc[_0x1a5d('0x5e')][_0x1a5d('0x6f')][_0x50182e],'FaxAccountId':_0x1b33cc[_0x1a5d('0x59')]['id']});}return _0x2894c0;});}})[_0x1a5d('0x36')](respondWithResult(_0x256161,null))[_0x1a5d('0x29')](handleError(_0x256161,null));};exports[_0x1a5d('0xbd')]=function(_0x2b105c,_0x1638e9,_0x4e8047){return db[_0x1a5d('0x53')][_0x1a5d('0x68')]({'where':{'id':_0x2b105c['params']['id']}})[_0x1a5d('0x36')](handleEntityNotFound(_0x1638e9,null))[_0x1a5d('0x36')](function(_0x212af5){if(_0x212af5){return _0x212af5[_0x1a5d('0xbd')](_0x2b105c[_0x1a5d('0x43')][_0x1a5d('0x6f')])[_0x1a5d('0x36')](function(){if(_['isArray'](_0x2b105c[_0x1a5d('0x43')][_0x1a5d('0x6f')])){for(var _0xe0faa2=0x0;_0xe0faa2<_0x2b105c[_0x1a5d('0x43')][_0x1a5d('0x6f')][_0x1a5d('0x48')];_0xe0faa2+=0x1){socket[_0x1a5d('0xbb')](_0x1a5d('0xbe'),{'UserId':Number(_0x2b105c[_0x1a5d('0x43')][_0x1a5d('0x6f')][_0xe0faa2]),'FaxAccountId':Number(_0x2b105c['params']['id'])});}}else{socket['emit'](_0x1a5d('0xbe'),{'UserId':Number(_0x2b105c[_0x1a5d('0x43')][_0x1a5d('0x6f')]),'FaxAccountId':Number(_0x2b105c[_0x1a5d('0x59')]['id'])});}});}})[_0x1a5d('0x36')](respondWithStatusCode(_0x1638e9,null))[_0x1a5d('0x29')](handleError(_0x1638e9,null));};exports['getAgents']=function(_0x1e195e,_0x964fcf,_0x31f0d7){var _0x1a03e3={};var _0x527366={};var _0x30456b;var _0x49627f;return db[_0x1a5d('0x53')][_0x1a5d('0x6c')]({'where':{'id':_0x1e195e[_0x1a5d('0x59')]['id']}})[_0x1a5d('0x36')](handleEntityNotFound(_0x964fcf,null))['then'](function(_0x5e7600){if(_0x5e7600){_0x30456b=_0x5e7600;_0x527366[_0x1a5d('0x41')]=_[_0x1a5d('0x5b')](db[_0x1a5d('0x76')][_0x1a5d('0x5c')]);_0x527366[_0x1a5d('0x43')]=_['keys'](_0x1e195e[_0x1a5d('0x43')]);_0x527366[_0x1a5d('0x44')]=_[_0x1a5d('0x45')](_0x527366[_0x1a5d('0x41')],_0x527366[_0x1a5d('0x43')]);_0x1a03e3[_0x1a5d('0x46')]=_[_0x1a5d('0x45')](_0x527366[_0x1a5d('0x41')],qs['fields'](_0x1e195e[_0x1a5d('0x43')][_0x1a5d('0x47')]));_0x1a03e3[_0x1a5d('0x46')]=_0x1a03e3[_0x1a5d('0x46')][_0x1a5d('0x48')]?_0x1a03e3[_0x1a5d('0x46')]:_0x527366[_0x1a5d('0x41')];_0x1a03e3[_0x1a5d('0x4b')]=qs[_0x1a5d('0x4c')](_0x1e195e['query'][_0x1a5d('0x4c')]);_0x1a03e3['where']=qs['filters'](_[_0x1a5d('0x4e')](_0x1e195e[_0x1a5d('0x43')],_0x527366[_0x1a5d('0x44')]));if(_0x1e195e[_0x1a5d('0x43')][_0x1a5d('0x4f')]){_0x1a03e3[_0x1a5d('0x4d')]=_[_0x1a5d('0x50')](_0x1a03e3[_0x1a5d('0x4d')],{'$or':_[_0x1a5d('0x42')](_0x1a03e3[_0x1a5d('0x46')],function(_0x154f93){var _0x3954ba={};_0x3954ba[_0x154f93]={'$like':'%'+_0x1e195e['query'][_0x1a5d('0x4f')]+'%'};return _0x3954ba;})});}_0x1a03e3=_['merge']({},_0x1a03e3,_0x1e195e[_0x1a5d('0x52')]);return _0x30456b[_0x1a5d('0xbf')](_0x1a03e3);}})[_0x1a5d('0x36')](function(_0x41e6b7){if(_0x41e6b7){_0x49627f=_0x41e6b7[_0x1a5d('0x48')];if(!_0x1e195e[_0x1a5d('0x43')][_0x1a5d('0x49')]('nolimit')){_0x1a03e3['limit']=qs[_0x1a5d('0x30')](_0x1e195e[_0x1a5d('0x43')]['limit']);_0x1a03e3[_0x1a5d('0x2e')]=qs[_0x1a5d('0x2e')](_0x1e195e[_0x1a5d('0x43')]['offset']);}return _0x30456b[_0x1a5d('0xbf')](_0x1a03e3);}})[_0x1a5d('0x36')](function(_0x341438){if(_0x341438){return _0x341438?{'count':_0x49627f,'rows':_0x341438}:null;}})['then'](respondWithResult(_0x964fcf,null))[_0x1a5d('0x29')](handleError(_0x964fcf,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 013efe2..da9c425 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 _0xc29d=['events','../../mysqldb','update','remove','emit','hook','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc29d,0x149));var _0xdc29=function(_0x1a5436,_0x4b0cbb){_0x1a5436=_0x1a5436-0x0;var _0x408548=_0xc29d[_0x1a5436];return _0x408548;};'use strict';var EventEmitter=require(_0xdc29('0x0'));var FaxAccount=require(_0xdc29('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xdc29('0x2'),'afterDestroy':_0xdc29('0x3')};function emitEvent(_0x3c332d){return function(_0x2c0714,_0x28dfa7,_0x5d05bc){FaxAccountEvents[_0xdc29('0x4')](_0x3c332d+':'+_0x2c0714['id'],_0x2c0714);FaxAccountEvents['emit'](_0x3c332d,_0x2c0714);_0x5d05bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xdc29('0x5')](e,emitEvent(event));}}module[_0xdc29('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0xa16c=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','remove','emit'];(function(_0x67eec8,_0x30acdd){var _0x1882f4=function(_0x8c388a){while(--_0x8c388a){_0x67eec8['push'](_0x67eec8['shift']());}};_0x1882f4(++_0x30acdd);}(_0xa16c,0x18f));var _0xca16=function(_0x8dbb22,_0x166585){_0x8dbb22=_0x8dbb22-0x0;var _0x18d5ea=_0xa16c[_0x8dbb22];return _0x18d5ea;};'use strict';var EventEmitter=require(_0xca16('0x0'));var FaxAccount=require(_0xca16('0x1'))['db'][_0xca16('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xca16('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xca16('0x4')};function emitEvent(_0x1816a2){return function(_0x14d423,_0x3e8061,_0x19bc70){FaxAccountEvents[_0xca16('0x5')](_0x1816a2+':'+_0x14d423['id'],_0x14d423);FaxAccountEvents['emit'](_0x1816a2,_0x14d423);_0x19bc70(null);};}for(var e in events){if(events[_0xca16('0x6')](e)){var event=events[e];FaxAccount[_0xca16('0x7')](e,emitEvent(event));}}module[_0xca16('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 d3aad8c..329cc8b 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 _0xe37e=['rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3d85be,_0x53c96c){var _0x41242c=function(_0x4b87fd){while(--_0x4b87fd){_0x3d85be['push'](_0x3d85be['shift']());}};_0x41242c(++_0x53c96c);}(_0xe37e,0x18d));var _0xee37=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xe37e[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0xee37('0x0'));var util=require(_0xee37('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xee37('0x2'));var BPromise=require(_0xee37('0x3'));var rp=require(_0xee37('0x4'));var fs=require('fs');var path=require(_0xee37('0x5'));var rimraf=require(_0xee37('0x6'));var config=require(_0xee37('0x7'));var attributes=require(_0xee37('0x8'));module[_0xee37('0x9')]=function(_0x40af48,_0x13f47c){return _0x40af48[_0xee37('0xa')](_0xee37('0xb'),attributes,{'tableName':_0xee37('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x792c=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x3111f6,_0x816b4c){var _0x291c2e=function(_0x118d96){while(--_0x118d96){_0x3111f6['push'](_0x3111f6['shift']());}};_0x291c2e(++_0x816b4c);}(_0x792c,0x97));var _0xc792=function(_0x9c4cb9,_0x48f3e0){_0x9c4cb9=_0x9c4cb9-0x0;var _0x5aeba9=_0x792c[_0x9c4cb9];return _0x5aeba9;};'use strict';var _=require('lodash');var util=require(_0xc792('0x0'));var logger=require(_0xc792('0x1'))(_0xc792('0x2'));var moment=require(_0xc792('0x3'));var BPromise=require(_0xc792('0x4'));var rp=require(_0xc792('0x5'));var fs=require('fs');var path=require(_0xc792('0x6'));var rimraf=require(_0xc792('0x7'));var config=require(_0xc792('0x8'));var attributes=require(_0xc792('0x9'));module['exports']=function(_0xd31b30,_0xd78a57){return _0xd31b30[_0xc792('0xa')](_0xc792('0xb'),attributes,{'tableName':_0xc792('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 5e6e7c3..eaaa25b 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 _0xcc3c=['body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','orderBy','priority','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','map','include','NotifyFaxAccount'];(function(_0x2392b0,_0x3a9fe2){var _0x558009=function(_0x37e0b7){while(--_0x37e0b7){_0x2392b0['push'](_0x2392b0['shift']());}};_0x558009(++_0x3a9fe2);}(_0xcc3c,0x92));var _0xccc3=function(_0x261b59,_0x4e1782){_0x261b59=_0x261b59-0x0;var _0x334adc=_0xcc3c[_0x261b59];return _0x334adc;};'use strict';var _=require(_0xccc3('0x0'));var util=require(_0xccc3('0x1'));var moment=require('moment');var BPromise=require(_0xccc3('0x2'));var rs=require(_0xccc3('0x3'));var fs=require('fs');var Redis=require(_0xccc3('0x4'));var db=require(_0xccc3('0x5'))['db'];var utils=require(_0xccc3('0x6'));var logger=require('../../config/logger')(_0xccc3('0x7'));var config=require('../../config/environment');var jayson=require(_0xccc3('0x8'));var client=jayson[_0xccc3('0x9')][_0xccc3('0xa')]({'port':0x232c});config[_0xccc3('0xb')]=_['defaults'](config[_0xccc3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xccc3('0xc'))(new Redis(config[_0xccc3('0xb')]));require(_0xccc3('0xd'))[_0xccc3('0xe')](socket);function respondWithRpcPromise(_0x9e12e3,_0x50a20e,_0xfb2df5){return new BPromise(function(_0x5e47eb,_0x21a885){return client['request'](_0x9e12e3,_0xfb2df5)[_0xccc3('0xf')](function(_0x30ae06){logger[_0xccc3('0x10')](_0xccc3('0x11'),_0x50a20e,_0xccc3('0x12'));logger[_0xccc3('0x13')](_0xccc3('0x14'),_0x50a20e,'request\x20sent',JSON[_0xccc3('0x15')](_0x30ae06));if(_0x30ae06[_0xccc3('0x16')]){if(_0x30ae06[_0xccc3('0x16')][_0xccc3('0x17')]===0x1f4){logger[_0xccc3('0x16')](_0xccc3('0x11'),_0x50a20e,_0x30ae06[_0xccc3('0x16')][_0xccc3('0x18')]);return _0x21a885(_0x30ae06[_0xccc3('0x16')][_0xccc3('0x18')]);}logger[_0xccc3('0x16')](_0xccc3('0x11'),_0x50a20e,_0x30ae06[_0xccc3('0x16')][_0xccc3('0x18')]);return _0x5e47eb(_0x30ae06[_0xccc3('0x16')]['message']);}else{logger[_0xccc3('0x10')](_0xccc3('0x11'),_0x50a20e,_0xccc3('0x12'));_0x5e47eb(_0x30ae06[_0xccc3('0x19')][_0xccc3('0x18')]);}})[_0xccc3('0x1a')](function(_0x3a237c){logger[_0xccc3('0x16')](_0xccc3('0x11'),_0x50a20e,_0x3a237c);_0x21a885(_0x3a237c);});});}exports[_0xccc3('0x1b')]=function(_0x2427aa){var _0x19da10=this;return new Promise(function(_0xa9b1a4,_0x5e09bb){return db[_0xccc3('0x1c')][_0xccc3('0x1d')]({'raw':_0x2427aa[_0xccc3('0x1e')]?_0x2427aa[_0xccc3('0x1e')][_0xccc3('0x1f')]===undefined?!![]:![]:!![],'where':_0x2427aa['options']?_0x2427aa[_0xccc3('0x1e')][_0xccc3('0x20')]||null:null,'attributes':_0x2427aa['options']?_0x2427aa[_0xccc3('0x1e')][_0xccc3('0x21')]||null:null,'limit':_0x2427aa[_0xccc3('0x1e')]?_0x2427aa[_0xccc3('0x1e')][_0xccc3('0x22')]||null:null,'include':_0x2427aa[_0xccc3('0x1e')]?_0x2427aa[_0xccc3('0x1e')]['include']?_[_0xccc3('0x23')](_0x2427aa[_0xccc3('0x1e')][_0xccc3('0x24')],function(_0x4914a5){return{'model':db[_0x4914a5['model']],'as':_0x4914a5['as'],'attributes':_0x4914a5[_0xccc3('0x21')],'include':_0x4914a5[_0xccc3('0x24')]?_['map'](_0x4914a5[_0xccc3('0x24')],function(_0x13f6c8){return{'model':db[_0x13f6c8['model']],'as':_0x13f6c8['as'],'attributes':_0x13f6c8['attributes'],'include':_0x13f6c8[_0xccc3('0x24')]?_['map'](_0x13f6c8[_0xccc3('0x24')],function(_0x47fbe5){return{'model':db[_0x47fbe5['model']],'as':_0x47fbe5['as'],'attributes':_0x47fbe5[_0xccc3('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a47f1){logger[_0xccc3('0x10')](_0xccc3('0x1b'),_0x2427aa);logger[_0xccc3('0x13')](_0xccc3('0x1b'),_0x2427aa,JSON['stringify'](_0x4a47f1));_0xa9b1a4(_0x4a47f1);})[_0xccc3('0x1a')](function(_0x5364f6){logger['error'](_0xccc3('0x1b'),_0x5364f6[_0xccc3('0x18')],_0x2427aa);_0x5e09bb(_0x19da10[_0xccc3('0x16')](0x1f4,_0x5364f6['message']));});});};exports[_0xccc3('0x25')]=function(_0x191362,_0x515be0,_0x3e6101){var _0x58a2d1=this;return new Promise(function(_0x3ac339,_0x3b7edb){var _0x543d1f={'body':_0x191362[_0xccc3('0x26')],'channel':_0xccc3('0x27')};var _0x332305=[];var _0x99a4e3=[];var _0x3519eb={};return db[_0xccc3('0x28')]['describe']()['then'](function(_0x845c0b){if(!_0x845c0b){throw new db[(_0xccc3('0x29'))][(_0xccc3('0x2a'))](_0xccc3('0x2b'));}_0x332305=_[_0xccc3('0x2c')](_[_0xccc3('0x2d')](_0x845c0b),[_0xccc3('0x2e'),'updatedAt']);_0x99a4e3=_[_0xccc3('0x2c')](_[_0xccc3('0x2d')](_0x845c0b),[_0xccc3('0x2e'),_0xccc3('0x2f'),_0xccc3('0x30'),_0xccc3('0x31')]);if(_0x191362[_0xccc3('0x26')]['id']){delete _0x191362['body']['id'];}if(_[_0xccc3('0x32')](_0x191362[_0xccc3('0x26')][_0xccc3('0x33')])){throw new db[(_0xccc3('0x29'))]['ValidationError'](_0xccc3('0x34'));}if(_[_0xccc3('0x32')](_0x191362[_0xccc3('0x26')]['body'])||_0x191362['body'][_0xccc3('0x26')]===''){throw new db[(_0xccc3('0x29'))][(_0xccc3('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x191362[_0xccc3('0x26')][_0xccc3('0x35')])){throw new db['Sequelize'][(_0xccc3('0x2a'))](_0xccc3('0x36')+_0x99a4e3);}if(!_[_0xccc3('0x37')](_0x99a4e3,_0x191362[_0xccc3('0x26')][_0xccc3('0x35')])){throw new db['Sequelize'][(_0xccc3('0x2a'))](_0xccc3('0x38')+_0x99a4e3);}_0x3519eb[_0x191362['body'][_0xccc3('0x35')]]=_0x191362[_0xccc3('0x26')]['from'];})['then'](function(){return db['FaxAccount'][_0xccc3('0x39')]({'where':{'id':_0x191362[_0xccc3('0x3a')]['id']},'include':[{'model':db[_0xccc3('0x3b')],'as':_0xccc3('0x3c'),'include':[{'model':db[_0xccc3('0x28')],'as':_0xccc3('0x3d'),'where':_0x3519eb,'limit':0x1,'order':[[_0xccc3('0x2f'),_0xccc3('0x3e')]]}]},{'model':db[_0xccc3('0x3f')],'as':_0xccc3('0x40')}]});})['then'](function(_0x2b14be){if(_0x2b14be&&_0x2b14be[_0xccc3('0x3c')]){var _0x5e12ed=_0x2b14be[_0xccc3('0x41')]({'plain':!![]});_0x543d1f['account']=_0x5e12ed;_0x543d1f['applications']=_0x5e12ed['Applications'];_0x543d1f[_0xccc3('0x42')]=_0x5e12ed[_0xccc3('0x3c')];_0x543d1f[_0xccc3('0x43')]=_[_0xccc3('0x44')](_0x543d1f['applications'],[_0xccc3('0x45')],['asc']);if(_0x543d1f[_0xccc3('0x3a')][_0xccc3('0x40')]){delete _0x543d1f[_0xccc3('0x3a')][_0xccc3('0x40')];}if(_0x543d1f[_0xccc3('0x3a')][_0xccc3('0x3c')]&&_0x543d1f['account']['List'][_0xccc3('0x3d')]['length']){return _0x543d1f[_0xccc3('0x3a')]['List']['Contacts'][0x0];}var _0x3ec5f6=_[_0xccc3('0x46')](_0x191362[_0xccc3('0x26')],{'firstName':_0x191362[_0xccc3('0x26')][_0xccc3('0x33')],'ListId':_0x5e12ed[_0xccc3('0x31')]});_0x3ec5f6[_0x191362[_0xccc3('0x26')][_0xccc3('0x35')]]=_0x191362[_0xccc3('0x26')][_0xccc3('0x33')];return db[_0xccc3('0x28')][_0xccc3('0x47')](_0x3ec5f6,{'fields':_0x332305,'raw':!![]});}})[_0xccc3('0xf')](function(_0x49f77a){_0x543d1f[_0xccc3('0x48')]=_0x49f77a;if(_0x49f77a){var _0x1fc3cd={'ContactId':_0x49f77a['id'],'FaxAccountId':_0x191362[_0xccc3('0x3a')]['id'],'fax':_0x49f77a[_0xccc3('0x27')]};return db[_0xccc3('0x49')][_0xccc3('0x39')]({'where':{'ContactId':_0x49f77a['id'],'closed':![],'FaxAccountId':_0x191362[_0xccc3('0x3a')]['id']}})[_0xccc3('0xf')](function(_0x3cb940){if(_0x3cb940){return[_0x3cb940,![]];}return db[_0xccc3('0x49')][_0xccc3('0x47')](_0x1fc3cd)[_0xccc3('0xf')](function(_0x262a1f){return[_0x262a1f,!![]];});});}else{throw new Error(_0xccc3('0x4a'));}})[_0xccc3('0x4b')](function(_0x2b860c,_0x3f51d3){var _0x3c16c2=_0x2b860c[_0xccc3('0x41')]({'plain':!![]});if(_0x3f51d3){if(_0x543d1f['account'][_0xccc3('0x4c')]){_0x543d1f['applications'][_0xccc3('0x4d')]({'id':0x0,'priority':_0x543d1f[_0xccc3('0x43')]['length']+0x1,'app':_0xccc3('0x4e'),'appdata':_0xccc3('0x4f'),'interval':_0xccc3('0x50')});}_0x3c16c2[_0xccc3('0x51')]=!![];}else{_0x3c16c2[_0xccc3('0x51')]=![];}_0x543d1f[_0xccc3('0x52')]=_0x3c16c2;return db['FaxMessage'][_0xccc3('0x47')]({'body':_0x191362['body'][_0xccc3('0x26')],'FaxAccountId':_0x191362[_0xccc3('0x3a')]['id'],'FaxInteractionId':_0x2b860c['id'],'direction':'in','ContactId':_0x2b860c[_0xccc3('0x53')],'AttachmentId':_0x191362['body'][_0xccc3('0x54')]});})[_0xccc3('0xf')](function(_0x4f725b){_0x543d1f[_0xccc3('0x18')]=_0x4f725b;if(_0x543d1f['interaction'][_0xccc3('0x55')]){return db['User']['find']({'attributes':['id',_0xccc3('0x56')],'where':{'id':_0x543d1f['interaction']['UserId']}})[_0xccc3('0xf')](function(_0x206b52){if(_0x206b52){_0x543d1f[_0xccc3('0x43')][_0xccc3('0x57')]({'id':0x0,'priority':0x0,'app':_0xccc3('0x58'),'appdata':_0x206b52[_0xccc3('0x56')]+','+(_0x543d1f[_0xccc3('0x3a')][_0xccc3('0x59')]||0xa),'interval':_0xccc3('0x50')});}return respondWithRpcPromise('Start','startRouting',_0x543d1f);});}return respondWithRpcPromise(_0xccc3('0x5a'),_0xccc3('0x5b'),_0x543d1f);})['then'](function(_0x584747){_0x3ac339(_0x584747);})[_0xccc3('0x1a')](function(_0x418a5e){_0x3b7edb(_0x58a2d1[_0xccc3('0x16')](0x1f4,_0x418a5e[_0xccc3('0x18')]));});});}; \ No newline at end of file +var _0x7ae3=['raw','where','attributes','limit','map','include','model','NotifyFaxAccount','body','fax','describe','ValidationError','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts','DESC','Applications','get','list','applications','priority','asc','length','defaults','contact','FaxInteraction','create','spread','autoclose','close','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','options'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0x7ae3,0x14a));var _0x37ae=function(_0x17606f,_0x1e2e94){_0x17606f=_0x17606f-0x0;var _0x3658e7=_0x7ae3[_0x17606f];return _0x3658e7;};'use strict';var _=require(_0x37ae('0x0'));var util=require('util');var moment=require(_0x37ae('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37ae('0x2'));var db=require(_0x37ae('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x37ae('0x4'))(_0x37ae('0x5'));var config=require(_0x37ae('0x6'));var jayson=require(_0x37ae('0x7'));var client=jayson[_0x37ae('0x8')][_0x37ae('0x9')]({'port':0x232c});config[_0x37ae('0xa')]=_['defaults'](config['redis'],{'host':_0x37ae('0xb'),'port':0x18eb});var socket=require(_0x37ae('0xc'))(new Redis(config[_0x37ae('0xa')]));require(_0x37ae('0xd'))[_0x37ae('0xe')](socket);function respondWithRpcPromise(_0x2f6509,_0x191a0a,_0x59df0a){return new BPromise(function(_0x18ce80,_0x11ea5c){return client[_0x37ae('0xf')](_0x2f6509,_0x59df0a)[_0x37ae('0x10')](function(_0x1a6336){logger['info'](_0x37ae('0x11'),_0x191a0a,_0x37ae('0x12'));logger[_0x37ae('0x13')](_0x37ae('0x14'),_0x191a0a,_0x37ae('0x12'),JSON[_0x37ae('0x15')](_0x1a6336));if(_0x1a6336[_0x37ae('0x16')]){if(_0x1a6336[_0x37ae('0x16')][_0x37ae('0x17')]===0x1f4){logger['error'](_0x37ae('0x11'),_0x191a0a,_0x1a6336[_0x37ae('0x16')]['message']);return _0x11ea5c(_0x1a6336[_0x37ae('0x16')][_0x37ae('0x18')]);}logger[_0x37ae('0x16')](_0x37ae('0x11'),_0x191a0a,_0x1a6336[_0x37ae('0x16')]['message']);return _0x18ce80(_0x1a6336['error'][_0x37ae('0x18')]);}else{logger['info'](_0x37ae('0x11'),_0x191a0a,_0x37ae('0x12'));_0x18ce80(_0x1a6336[_0x37ae('0x19')][_0x37ae('0x18')]);}})[_0x37ae('0x1a')](function(_0x59ef37){logger[_0x37ae('0x16')](_0x37ae('0x11'),_0x191a0a,_0x59ef37);_0x11ea5c(_0x59ef37);});});}exports[_0x37ae('0x1b')]=function(_0x23011d){var _0x154bfb=this;return new Promise(function(_0x63db7d,_0x108d7e){return db[_0x37ae('0x1c')]['findAll']({'raw':_0x23011d[_0x37ae('0x1d')]?_0x23011d['options'][_0x37ae('0x1e')]===undefined?!![]:![]:!![],'where':_0x23011d[_0x37ae('0x1d')]?_0x23011d[_0x37ae('0x1d')][_0x37ae('0x1f')]||null:null,'attributes':_0x23011d[_0x37ae('0x1d')]?_0x23011d[_0x37ae('0x1d')][_0x37ae('0x20')]||null:null,'limit':_0x23011d[_0x37ae('0x1d')]?_0x23011d['options'][_0x37ae('0x21')]||null:null,'include':_0x23011d['options']?_0x23011d['options']['include']?_[_0x37ae('0x22')](_0x23011d[_0x37ae('0x1d')][_0x37ae('0x23')],function(_0x59fbcb){return{'model':db[_0x59fbcb[_0x37ae('0x24')]],'as':_0x59fbcb['as'],'attributes':_0x59fbcb[_0x37ae('0x20')],'include':_0x59fbcb[_0x37ae('0x23')]?_[_0x37ae('0x22')](_0x59fbcb[_0x37ae('0x23')],function(_0x28f5fc){return{'model':db[_0x28f5fc[_0x37ae('0x24')]],'as':_0x28f5fc['as'],'attributes':_0x28f5fc['attributes'],'include':_0x28f5fc['include']?_[_0x37ae('0x22')](_0x28f5fc[_0x37ae('0x23')],function(_0x259ce0){return{'model':db[_0x259ce0[_0x37ae('0x24')]],'as':_0x259ce0['as'],'attributes':_0x259ce0[_0x37ae('0x20')]};}):[]};}):[]};}):[]:[]})[_0x37ae('0x10')](function(_0x4f5e69){logger['info']('GetFaxAccount',_0x23011d);logger[_0x37ae('0x13')](_0x37ae('0x1b'),_0x23011d,JSON[_0x37ae('0x15')](_0x4f5e69));_0x63db7d(_0x4f5e69);})[_0x37ae('0x1a')](function(_0x4dc170){logger[_0x37ae('0x16')](_0x37ae('0x1b'),_0x4dc170[_0x37ae('0x18')],_0x23011d);_0x108d7e(_0x154bfb[_0x37ae('0x16')](0x1f4,_0x4dc170[_0x37ae('0x18')]));});});};exports[_0x37ae('0x25')]=function(_0x44bd13,_0x949579,_0x539c8f){var _0xee6cfd=this;return new Promise(function(_0x3a08c9,_0x29c9dc){var _0x40186f={'body':_0x44bd13[_0x37ae('0x26')],'channel':_0x37ae('0x27')};var _0x49c817=[];var _0x213da4=[];var _0x3fdf66={};return db['CmContact'][_0x37ae('0x28')]()[_0x37ae('0x10')](function(_0x946d43){if(!_0x946d43){throw new db['Sequelize'][(_0x37ae('0x29'))]('no\x20available\x20attributes');}_0x49c817=_[_0x37ae('0x2a')](_['keys'](_0x946d43),[_0x37ae('0x2b'),_0x37ae('0x2c')]);_0x213da4=_[_0x37ae('0x2a')](_[_0x37ae('0x2d')](_0x946d43),[_0x37ae('0x2b'),_0x37ae('0x2c'),_0x37ae('0x2e'),_0x37ae('0x2f')]);if(_0x44bd13[_0x37ae('0x26')]['id']){delete _0x44bd13['body']['id'];}if(_[_0x37ae('0x30')](_0x44bd13[_0x37ae('0x26')][_0x37ae('0x31')])){throw new db[(_0x37ae('0x32'))][(_0x37ae('0x29'))](_0x37ae('0x33'));}if(_['isNil'](_0x44bd13[_0x37ae('0x26')][_0x37ae('0x26')])||_0x44bd13[_0x37ae('0x26')][_0x37ae('0x26')]===''){throw new db[(_0x37ae('0x32'))][(_0x37ae('0x29'))](_0x37ae('0x34'));}if(_[_0x37ae('0x30')](_0x44bd13[_0x37ae('0x26')][_0x37ae('0x35')])){throw new db[(_0x37ae('0x32'))][(_0x37ae('0x29'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x213da4);}if(!_[_0x37ae('0x36')](_0x213da4,_0x44bd13[_0x37ae('0x26')][_0x37ae('0x35')])){throw new db[(_0x37ae('0x32'))][(_0x37ae('0x29'))](_0x37ae('0x37')+_0x213da4);}_0x3fdf66[_0x44bd13[_0x37ae('0x26')]['mapKey']]=_0x44bd13['body'][_0x37ae('0x31')];})[_0x37ae('0x10')](function(){return db[_0x37ae('0x1c')][_0x37ae('0x38')]({'where':{'id':_0x44bd13[_0x37ae('0x39')]['id']},'include':[{'model':db[_0x37ae('0x3a')],'as':_0x37ae('0x3b'),'include':[{'model':db[_0x37ae('0x3c')],'as':_0x37ae('0x3d'),'where':_0x3fdf66,'limit':0x1,'order':[[_0x37ae('0x2c'),_0x37ae('0x3e')]]}]},{'model':db['FaxApplication'],'as':_0x37ae('0x3f')}]});})['then'](function(_0x3814df){if(_0x3814df&&_0x3814df[_0x37ae('0x3b')]){var _0xb6f632=_0x3814df[_0x37ae('0x40')]({'plain':!![]});_0x40186f[_0x37ae('0x39')]=_0xb6f632;_0x40186f['applications']=_0xb6f632[_0x37ae('0x3f')];_0x40186f[_0x37ae('0x41')]=_0xb6f632['List'];_0x40186f[_0x37ae('0x42')]=_['orderBy'](_0x40186f[_0x37ae('0x42')],[_0x37ae('0x43')],[_0x37ae('0x44')]);if(_0x40186f[_0x37ae('0x39')][_0x37ae('0x3f')]){delete _0x40186f['account'][_0x37ae('0x3f')];}if(_0x40186f['account'][_0x37ae('0x3b')]&&_0x40186f['account'][_0x37ae('0x3b')]['Contacts'][_0x37ae('0x45')]){return _0x40186f[_0x37ae('0x39')]['List'][_0x37ae('0x3d')][0x0];}var _0x4d1d5e=_[_0x37ae('0x46')](_0x44bd13[_0x37ae('0x26')],{'firstName':_0x44bd13['body'][_0x37ae('0x31')],'ListId':_0xb6f632['ListId']});_0x4d1d5e[_0x44bd13['body'][_0x37ae('0x35')]]=_0x44bd13[_0x37ae('0x26')][_0x37ae('0x31')];return db[_0x37ae('0x3c')]['create'](_0x4d1d5e,{'fields':_0x49c817,'raw':!![]});}})[_0x37ae('0x10')](function(_0x24321b){_0x40186f[_0x37ae('0x47')]=_0x24321b;if(_0x24321b){var _0x47205e={'ContactId':_0x24321b['id'],'FaxAccountId':_0x44bd13[_0x37ae('0x39')]['id'],'fax':_0x24321b['fax']};return db[_0x37ae('0x48')][_0x37ae('0x38')]({'where':{'ContactId':_0x24321b['id'],'closed':![],'FaxAccountId':_0x44bd13[_0x37ae('0x39')]['id']}})[_0x37ae('0x10')](function(_0x5decef){if(_0x5decef){return[_0x5decef,![]];}return db[_0x37ae('0x48')][_0x37ae('0x49')](_0x47205e)[_0x37ae('0x10')](function(_0x4aa5d1){return[_0x4aa5d1,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x37ae('0x4a')](function(_0x16da49,_0x59fd85){var _0x229635=_0x16da49[_0x37ae('0x40')]({'plain':!![]});if(_0x59fd85){if(_0x40186f[_0x37ae('0x39')][_0x37ae('0x4b')]){_0x40186f[_0x37ae('0x42')]['push']({'id':0x0,'priority':_0x40186f['applications'][_0x37ae('0x45')]+0x1,'app':_0x37ae('0x4c'),'appdata':'unmanaged','interval':_0x37ae('0x4d')});}_0x229635[_0x37ae('0x4e')]=!![];}else{_0x229635['created']=![];}_0x40186f[_0x37ae('0x4f')]=_0x229635;return db['FaxMessage'][_0x37ae('0x49')]({'body':_0x44bd13[_0x37ae('0x26')][_0x37ae('0x26')],'FaxAccountId':_0x44bd13[_0x37ae('0x39')]['id'],'FaxInteractionId':_0x16da49['id'],'direction':'in','ContactId':_0x16da49[_0x37ae('0x50')],'AttachmentId':_0x44bd13[_0x37ae('0x26')][_0x37ae('0x51')]});})['then'](function(_0x578d93){_0x40186f[_0x37ae('0x18')]=_0x578d93;if(_0x40186f['interaction'][_0x37ae('0x52')]){return db[_0x37ae('0x53')]['find']({'attributes':['id',_0x37ae('0x54')],'where':{'id':_0x40186f[_0x37ae('0x4f')][_0x37ae('0x52')]}})[_0x37ae('0x10')](function(_0x3e5767){if(_0x3e5767){_0x40186f[_0x37ae('0x42')][_0x37ae('0x55')]({'id':0x0,'priority':0x0,'app':_0x37ae('0x56'),'appdata':_0x3e5767[_0x37ae('0x54')]+','+(_0x40186f['account'][_0x37ae('0x57')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x40186f);});}return respondWithRpcPromise(_0x37ae('0x58'),_0x37ae('0x59'),_0x40186f);})['then'](function(_0x34686f){_0x3a08c9(_0x34686f);})[_0x37ae('0x1a')](function(_0x5b7743){_0x29c9dc(_0xee6cfd[_0x37ae('0x16')](0x1f4,_0x5b7743[_0x37ae('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index da8dfa0..6dcb26d 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 _0xed1c=['removeListener','register','length','faxAccount:','./faxAccount.events','save','emit'];(function(_0x350182,_0x2a9feb){var _0x4a0892=function(_0x2c994d){while(--_0x2c994d){_0x350182['push'](_0x350182['shift']());}};_0x4a0892(++_0x2a9feb);}(_0xed1c,0xe4));var _0xced1=function(_0x1ed311,_0xb346e7){_0x1ed311=_0x1ed311-0x0;var _0x34f63b=_0xed1c[_0x1ed311];return _0x34f63b;};'use strict';var FaxAccountEvents=require(_0xced1('0x0'));var events=[_0xced1('0x1'),'remove','update'];function createListener(_0x5abe0f,_0x4c3102){return function(_0x424db6){_0x4c3102[_0xced1('0x2')](_0x5abe0f,_0x424db6);};}function removeListener(_0x79202e,_0x47a45c){return function(){FaxAccountEvents[_0xced1('0x3')](_0x79202e,_0x47a45c);};}exports[_0xced1('0x4')]=function(_0x466657){for(var _0x37b22b=0x0,_0x59399e=events[_0xced1('0x5')];_0x37b22b<_0x59399e;_0x37b22b++){var _0x38bca8=events[_0x37b22b];var _0x39d5df=createListener(_0xced1('0x6')+_0x38bca8,_0x466657);FaxAccountEvents['on'](_0x38bca8,_0x39d5df);}}; \ No newline at end of file +var _0x5fdc=['save','remove','update','emit','removeListener','register','faxAccount:','./faxAccount.events'];(function(_0x119b4b,_0x322a87){var _0x2ca4d5=function(_0x45a93e){while(--_0x45a93e){_0x119b4b['push'](_0x119b4b['shift']());}};_0x2ca4d5(++_0x322a87);}(_0x5fdc,0x127));var _0xc5fd=function(_0x27e763,_0x39bdcc){_0x27e763=_0x27e763-0x0;var _0x1daae9=_0x5fdc[_0x27e763];return _0x1daae9;};'use strict';var FaxAccountEvents=require(_0xc5fd('0x0'));var events=[_0xc5fd('0x1'),_0xc5fd('0x2'),_0xc5fd('0x3')];function createListener(_0x36e895,_0x341db9){return function(_0x3be451){_0x341db9[_0xc5fd('0x4')](_0x36e895,_0x3be451);};}function removeListener(_0xfdf928,_0x1b6205){return function(){FaxAccountEvents[_0xc5fd('0x5')](_0xfdf928,_0x1b6205);};}exports[_0xc5fd('0x6')]=function(_0x44722b){for(var _0x216902=0x0,_0x15ffe7=events['length'];_0x216902<_0x15ffe7;_0x216902++){var _0x5d86e5=events[_0x216902];var _0x493389=createListener(_0xc5fd('0x7')+_0x5d86e5,_0x44722b);FaxAccountEvents['on'](_0x5d86e5,_0x493389);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 7520599..9f39268 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 _0xfd17=['post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','/updateaccountapplications','updateAccountApplications','addAgents','update','destroy','delete','removeAnswers','removeAgents','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0xfd17,0x148));var _0x7fd1=function(_0x329808,_0x343255){_0x329808=_0x329808-0x0;var _0x1bbad0=_0xfd17[_0x329808];return _0x1bbad0;};'use strict';var multer=require(_0x7fd1('0x0'));var util=require('util');var path=require(_0x7fd1('0x1'));var timeout=require(_0x7fd1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7fd1('0x3'));var auth=require(_0x7fd1('0x4'));var interaction=require(_0x7fd1('0x5'));var config=require(_0x7fd1('0x6'));var controller=require(_0x7fd1('0x7'));router[_0x7fd1('0x8')]('/',auth[_0x7fd1('0x9')](),controller[_0x7fd1('0xa')]);router[_0x7fd1('0x8')](_0x7fd1('0xb'),auth[_0x7fd1('0x9')](),controller[_0x7fd1('0xc')]);router[_0x7fd1('0x8')](_0x7fd1('0xd'),auth[_0x7fd1('0x9')](),controller[_0x7fd1('0xe')]);router[_0x7fd1('0x8')]('/:id/dispositions',auth[_0x7fd1('0x9')](),controller[_0x7fd1('0xf')]);router[_0x7fd1('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7fd1('0x10')]);router[_0x7fd1('0x8')]('/:id/interactions',auth[_0x7fd1('0x9')](),controller['getInteractions']);router[_0x7fd1('0x8')](_0x7fd1('0x11'),auth[_0x7fd1('0x9')](),controller[_0x7fd1('0x12')]);router['get'](_0x7fd1('0x13'),auth[_0x7fd1('0x9')](),controller[_0x7fd1('0x14')]);router['get'](_0x7fd1('0x15'),auth['isAuthenticated'](),controller[_0x7fd1('0x16')]);router[_0x7fd1('0x17')]('/',auth[_0x7fd1('0x9')](),controller[_0x7fd1('0x18')]);router[_0x7fd1('0x17')]('/:id/dispositions',auth[_0x7fd1('0x9')](),controller[_0x7fd1('0x19')]);router[_0x7fd1('0x17')](_0x7fd1('0x1a'),auth['isAuthenticated'](),controller[_0x7fd1('0x1b')]);router[_0x7fd1('0x17')]('/:id/interactions',auth[_0x7fd1('0x9')](),controller[_0x7fd1('0x1c')]);router[_0x7fd1('0x17')](_0x7fd1('0x11'),auth[_0x7fd1('0x9')](),controller[_0x7fd1('0x1d')]);router[_0x7fd1('0x17')]('/addaccountapplications',auth[_0x7fd1('0x9')](),controller['addAccountApplications']);router[_0x7fd1('0x17')](_0x7fd1('0x1e'),auth['isAuthenticated'](),controller[_0x7fd1('0x1f')]);router['post']('/:id/send',auth[_0x7fd1('0x9')](),controller['send']);router[_0x7fd1('0x17')](_0x7fd1('0x15'),auth['isAuthenticated'](),controller[_0x7fd1('0x20')]);router['put'](_0x7fd1('0xd'),auth[_0x7fd1('0x9')](),controller[_0x7fd1('0x21')]);router['delete']('/:id',auth[_0x7fd1('0x9')](),controller[_0x7fd1('0x22')]);router[_0x7fd1('0x23')]('/:id/dispositions',auth[_0x7fd1('0x9')](),controller['removeDispositions']);router[_0x7fd1('0x23')](_0x7fd1('0x1a'),auth[_0x7fd1('0x9')](),controller[_0x7fd1('0x24')]);router[_0x7fd1('0x23')](_0x7fd1('0x15'),auth[_0x7fd1('0x9')](),controller[_0x7fd1('0x25')]);module[_0x7fd1('0x26')]=router; \ No newline at end of file +var _0x1ab0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put','update','destroy','removeDispositions','removeAnswers','removeAgents','exports','util'];(function(_0x2f4696,_0xf0cbca){var _0x396438=function(_0x2d833a){while(--_0x2d833a){_0x2f4696['push'](_0x2f4696['shift']());}};_0x396438(++_0xf0cbca);}(_0x1ab0,0x1ee));var _0x01ab=function(_0x5911af,_0xa0bbe2){_0x5911af=_0x5911af-0x0;var _0x27a87b=_0x1ab0[_0x5911af];return _0x27a87b;};'use strict';var multer=require('multer');var util=require(_0x01ab('0x0'));var path=require('path');var timeout=require(_0x01ab('0x1'));var express=require(_0x01ab('0x2'));var router=express[_0x01ab('0x3')]();var fs_extra=require(_0x01ab('0x4'));var auth=require(_0x01ab('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x01ab('0x6'));var controller=require('./faxAccount.controller');router[_0x01ab('0x7')]('/',auth[_0x01ab('0x8')](),controller[_0x01ab('0x9')]);router[_0x01ab('0x7')](_0x01ab('0xa'),auth[_0x01ab('0x8')](),controller[_0x01ab('0xb')]);router[_0x01ab('0x7')](_0x01ab('0xc'),auth[_0x01ab('0x8')](),controller[_0x01ab('0xd')]);router[_0x01ab('0x7')](_0x01ab('0xe'),auth[_0x01ab('0x8')](),controller[_0x01ab('0xf')]);router[_0x01ab('0x7')](_0x01ab('0x10'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x11')]);router['get'](_0x01ab('0x12'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x13')]);router['get'](_0x01ab('0x14'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x15')]);router['get'](_0x01ab('0x16'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x17')]);router[_0x01ab('0x7')](_0x01ab('0x18'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x19')]);router[_0x01ab('0x1a')]('/',auth[_0x01ab('0x8')](),controller[_0x01ab('0x1b')]);router[_0x01ab('0x1a')](_0x01ab('0xe'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x1c')]);router[_0x01ab('0x1a')]('/:id/canned_answers',auth[_0x01ab('0x8')](),controller[_0x01ab('0x1d')]);router['post'](_0x01ab('0x12'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x1e')]);router['post'](_0x01ab('0x14'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x1f')]);router[_0x01ab('0x1a')](_0x01ab('0x20'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x21')]);router[_0x01ab('0x1a')](_0x01ab('0x22'),auth['isAuthenticated'](),controller[_0x01ab('0x23')]);router[_0x01ab('0x1a')](_0x01ab('0x24'),auth[_0x01ab('0x8')](),controller['send']);router[_0x01ab('0x1a')](_0x01ab('0x18'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x25')]);router[_0x01ab('0x26')](_0x01ab('0xc'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x27')]);router['delete'](_0x01ab('0xc'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x28')]);router['delete'](_0x01ab('0xe'),auth['isAuthenticated'](),controller[_0x01ab('0x29')]);router['delete'](_0x01ab('0x10'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x2a')]);router['delete'](_0x01ab('0x18'),auth[_0x01ab('0x8')](),controller[_0x01ab('0x2b')]);module[_0x01ab('0x2c')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 3816b1c..aa1a255 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 _0x9a0a=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x246a98,_0xdf59a8){var _0x3b8b79=function(_0x2d0a7b){while(--_0x2d0a7b){_0x246a98['push'](_0x246a98['shift']());}};_0x3b8b79(++_0xdf59a8);}(_0x9a0a,0x7c));var _0xa9a0=function(_0x43e2e4,_0x3864e6){_0x43e2e4=_0x43e2e4-0x0;var _0x2f9966=_0x9a0a[_0x43e2e4];return _0x2f9966;};'use strict';var Sequelize=require(_0xa9a0('0x0'));module[_0xa9a0('0x1')]={'priority':{'type':Sequelize[_0xa9a0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa9a0('0x3')],'allowNull':![],'defaultValue':_0xa9a0('0x4')},'appdata':{'type':Sequelize[_0xa9a0('0x5')]()},'description':{'type':Sequelize[_0xa9a0('0x3')]},'interval':{'type':Sequelize[_0xa9a0('0x3')],'defaultValue':_0xa9a0('0x6')}}; \ No newline at end of file +var _0x9931=['noop','TEXT','*,*,*,*','exports','STRING'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x9931,0x1b6));var _0x1993=function(_0x15c78f,_0x2762cc){_0x15c78f=_0x15c78f-0x0;var _0x39a0e8=_0x9931[_0x15c78f];return _0x39a0e8;};'use strict';var Sequelize=require('sequelize');module[_0x1993('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1993('0x1')],'allowNull':![],'defaultValue':_0x1993('0x2')},'appdata':{'type':Sequelize[_0x1993('0x3')]()},'description':{'type':Sequelize[_0x1993('0x1')]},'interval':{'type':Sequelize[_0x1993('0x1')],'defaultValue':_0x1993('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 979f855..1671c26 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 _0x07a0=['update','then','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','length','include','catch','create','body','find','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save'];(function(_0x32459e,_0x433526){var _0x2453a4=function(_0x1672fb){while(--_0x1672fb){_0x32459e['push'](_0x32459e['shift']());}};_0x2453a4(++_0x433526);}(_0x07a0,0x72));var _0x007a=function(_0x30b8ae,_0x275a41){_0x30b8ae=_0x30b8ae-0x0;var _0x4d9aa0=_0x07a0[_0x30b8ae];return _0x4d9aa0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x007a('0x0'));var zipdir=require(_0x007a('0x1'));var jsonpatch=require(_0x007a('0x2'));var rp=require(_0x007a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x007a('0x4'));var util=require(_0x007a('0x5'));var path=require(_0x007a('0x6'));var sox=require(_0x007a('0x7'));var csv=require(_0x007a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x007a('0x9'));var _=require(_0x007a('0xa'));var squel=require(_0x007a('0xb'));var crypto=require(_0x007a('0xc'));var jsforce=require(_0x007a('0xd'));var deskjs=require(_0x007a('0xe'));var toCsv=require(_0x007a('0x8'));var querystring=require(_0x007a('0xf'));var Papa=require(_0x007a('0x10'));var Redis=require(_0x007a('0x11'));var authService=require(_0x007a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x007a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x007a('0x14'))(_0x007a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x007a('0x16'));var db=require(_0x007a('0x17'))['db'];function respondWithStatusCode(_0x379575,_0x4153b6){_0x4153b6=_0x4153b6||0xcc;return function(_0x5391e0){if(_0x5391e0){return _0x379575[_0x007a('0x18')](_0x4153b6);}return _0x379575['status'](_0x4153b6)[_0x007a('0x19')]();};}function respondWithResult(_0x425b5d,_0x16c48c){_0x16c48c=_0x16c48c||0xc8;return function(_0x3dae86){if(_0x3dae86){return _0x425b5d[_0x007a('0x1a')](_0x16c48c)[_0x007a('0x1b')](_0x3dae86);}};}function respondWithFilteredResult(_0x411fa0,_0x5c4eb3){return function(_0x4519d6){if(_0x4519d6){var _0x117cb8=typeof _0x5c4eb3[_0x007a('0x1c')]==='undefined'&&typeof _0x5c4eb3[_0x007a('0x1d')]===_0x007a('0x1e');var _0x13bcba=_0x4519d6['count'];var _0x31f066=_0x117cb8?0x0:_0x5c4eb3[_0x007a('0x1c')];var _0x356034=_0x117cb8?_0x4519d6[_0x007a('0x1f')]:_0x5c4eb3[_0x007a('0x1c')]+_0x5c4eb3[_0x007a('0x1d')];var _0x19a0ba;if(_0x356034>=_0x13bcba){_0x356034=_0x13bcba;_0x19a0ba=0xc8;}else{_0x19a0ba=0xce;}_0x411fa0[_0x007a('0x1a')](_0x19a0ba);return _0x411fa0[_0x007a('0x20')](_0x007a('0x21'),_0x31f066+'-'+_0x356034+'/'+_0x13bcba)[_0x007a('0x1b')](_0x4519d6);}return null;};}function patchUpdates(_0x733399){return function(_0x4286ae){try{jsonpatch['apply'](_0x4286ae,_0x733399,!![]);}catch(_0x370d0b){return BPromise[_0x007a('0x22')](_0x370d0b);}return _0x4286ae[_0x007a('0x23')]();};}function saveUpdates(_0x430f86,_0x196f40){return function(_0x4fbcd8){if(_0x4fbcd8){return _0x4fbcd8[_0x007a('0x24')](_0x430f86)[_0x007a('0x25')](function(_0x4752f2){return _0x4752f2;});}return null;};}function removeEntity(_0x356500,_0x23bd53){return function(_0x2dd0a1){if(_0x2dd0a1){return _0x2dd0a1['destroy']()[_0x007a('0x25')](function(){_0x356500[_0x007a('0x1a')](0xcc)[_0x007a('0x19')]();});}};}function handleEntityNotFound(_0x13da55,_0x2f2865){return function(_0x47f262){if(!_0x47f262){_0x13da55[_0x007a('0x18')](0x194);}return _0x47f262;};}function handleError(_0x53eb2a,_0x46055f){_0x46055f=_0x46055f||0x1f4;return function(_0x1d46d1){logger[_0x007a('0x26')](_0x1d46d1[_0x007a('0x27')]);if(_0x1d46d1[_0x007a('0x28')]){delete _0x1d46d1[_0x007a('0x28')];}_0x53eb2a[_0x007a('0x1a')](_0x46055f)[_0x007a('0x29')](_0x1d46d1);};}exports['index']=function(_0x293697,_0x2465af){var _0x3cc712={},_0x43a8e4={},_0x4ec3f1={'count':0x0,'rows':[]};var _0xe1a0bd=_[_0x007a('0x2a')](db[_0x007a('0x2b')][_0x007a('0x2c')],function(_0x2c6aac){return{'name':_0x2c6aac[_0x007a('0x2d')],'type':_0x2c6aac[_0x007a('0x2e')][_0x007a('0x2f')]};});_0x43a8e4['model']=_[_0x007a('0x2a')](_0xe1a0bd,_0x007a('0x28'));_0x43a8e4[_0x007a('0x30')]=_[_0x007a('0x31')](_0x293697[_0x007a('0x30')]);_0x43a8e4[_0x007a('0x32')]=_[_0x007a('0x33')](_0x43a8e4[_0x007a('0x34')],_0x43a8e4[_0x007a('0x30')]);_0x3cc712[_0x007a('0x35')]=_['intersection'](_0x43a8e4['model'],qs[_0x007a('0x36')](_0x293697['query'][_0x007a('0x36')]));_0x3cc712[_0x007a('0x35')]=_0x3cc712[_0x007a('0x35')]['length']?_0x3cc712[_0x007a('0x35')]:_0x43a8e4[_0x007a('0x34')];if(!_0x293697['query'][_0x007a('0x37')](_0x007a('0x38'))){_0x3cc712['limit']=qs[_0x007a('0x1d')](_0x293697['query'][_0x007a('0x1d')]);_0x3cc712[_0x007a('0x1c')]=qs[_0x007a('0x1c')](_0x293697[_0x007a('0x30')][_0x007a('0x1c')]);}_0x3cc712[_0x007a('0x39')]=qs[_0x007a('0x3a')](_0x293697[_0x007a('0x30')]['sort']);_0x3cc712[_0x007a('0x3b')]=qs['filters'](_[_0x007a('0x3c')](_0x293697[_0x007a('0x30')],_0x43a8e4[_0x007a('0x32')]),_0xe1a0bd);if(_0x293697[_0x007a('0x30')][_0x007a('0x3d')]){_0x3cc712[_0x007a('0x3b')]=_[_0x007a('0x3e')](_0x3cc712[_0x007a('0x3b')],{'$or':_[_0x007a('0x2a')](_0xe1a0bd,function(_0x17773d){if(_0x17773d[_0x007a('0x2e')]!=='VIRTUAL'){var _0x2db159={};_0x2db159[_0x17773d[_0x007a('0x28')]]={'$like':'%'+_0x293697['query'][_0x007a('0x3d')]+'%'};return _0x2db159;}})});}_0x3cc712=_[_0x007a('0x3e')]({},_0x3cc712,_0x293697[_0x007a('0x3f')]);var _0x11dcf9={'where':_0x3cc712[_0x007a('0x3b')]};return db[_0x007a('0x2b')][_0x007a('0x1f')](_0x11dcf9)[_0x007a('0x25')](function(_0x1716fe){_0x4ec3f1[_0x007a('0x1f')]=_0x1716fe;if(_0x293697['query'][_0x007a('0x40')]){_0x3cc712['include']=[{'all':!![]}];}return db[_0x007a('0x2b')][_0x007a('0x41')](_0x3cc712);})[_0x007a('0x25')](function(_0x2541f8){_0x4ec3f1[_0x007a('0x42')]=_0x2541f8;return _0x4ec3f1;})[_0x007a('0x25')](respondWithFilteredResult(_0x2465af,_0x3cc712))['catch'](handleError(_0x2465af,null));};exports['show']=function(_0x1e8faf,_0x3b1071){var _0x31a07c={'raw':!![],'where':{'id':_0x1e8faf['params']['id']}},_0x2d9b5c={};_0x2d9b5c[_0x007a('0x34')]=_[_0x007a('0x31')](db['FaxApplication'][_0x007a('0x2c')]);_0x2d9b5c[_0x007a('0x30')]=_[_0x007a('0x31')](_0x1e8faf[_0x007a('0x30')]);_0x2d9b5c['filters']=_[_0x007a('0x33')](_0x2d9b5c[_0x007a('0x34')],_0x2d9b5c[_0x007a('0x30')]);_0x31a07c['attributes']=_[_0x007a('0x33')](_0x2d9b5c[_0x007a('0x34')],qs[_0x007a('0x36')](_0x1e8faf[_0x007a('0x30')]['fields']));_0x31a07c[_0x007a('0x35')]=_0x31a07c[_0x007a('0x35')][_0x007a('0x43')]?_0x31a07c[_0x007a('0x35')]:_0x2d9b5c[_0x007a('0x34')];if(_0x1e8faf[_0x007a('0x30')][_0x007a('0x40')]){_0x31a07c[_0x007a('0x44')]=[{'all':!![]}];}_0x31a07c=_[_0x007a('0x3e')]({},_0x31a07c,_0x1e8faf[_0x007a('0x3f')]);return db['FaxApplication']['find'](_0x31a07c)['then'](handleEntityNotFound(_0x3b1071,null))[_0x007a('0x25')](respondWithResult(_0x3b1071,null))[_0x007a('0x45')](handleError(_0x3b1071,null));};exports['create']=function(_0x470c17,_0x24310f){return db[_0x007a('0x2b')][_0x007a('0x46')](_0x470c17[_0x007a('0x47')],{})[_0x007a('0x25')](respondWithResult(_0x24310f,0xc9))[_0x007a('0x45')](handleError(_0x24310f,null));};exports[_0x007a('0x24')]=function(_0x348f78,_0x59e450){if(_0x348f78[_0x007a('0x47')]['id']){delete _0x348f78[_0x007a('0x47')]['id'];}return db[_0x007a('0x2b')][_0x007a('0x48')]({'where':{'id':_0x348f78[_0x007a('0x49')]['id']}})['then'](handleEntityNotFound(_0x59e450,null))[_0x007a('0x25')](saveUpdates(_0x348f78[_0x007a('0x47')],null))[_0x007a('0x25')](respondWithResult(_0x59e450,null))[_0x007a('0x45')](handleError(_0x59e450,null));};exports[_0x007a('0x4a')]=function(_0x17c3ee,_0x30160a){return db[_0x007a('0x2b')][_0x007a('0x48')]({'where':{'id':_0x17c3ee['params']['id']}})[_0x007a('0x25')](handleEntityNotFound(_0x30160a,null))[_0x007a('0x25')](removeEntity(_0x30160a,null))[_0x007a('0x45')](handleError(_0x30160a,null));}; \ No newline at end of file +var _0x770c=['count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','type','options','FaxApplication','includeAll','include','findAll','rows','catch','show','params','filters','length','merge','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x31193b,_0x49ed8b){var _0x37fa99=function(_0x83ed52){while(--_0x83ed52){_0x31193b['push'](_0x31193b['shift']());}};_0x37fa99(++_0x49ed8b);}(_0x770c,0x7f));var _0xc770=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x770c[_0x5783f4];return _0x28e380;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc770('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc770('0x1'));var rp=require(_0xc770('0x2'));var moment=require(_0xc770('0x3'));var BPromise=require(_0xc770('0x4'));var Mustache=require('mustache');var util=require(_0xc770('0x5'));var path=require('path');var sox=require(_0xc770('0x6'));var csv=require(_0xc770('0x7'));var ejs=require(_0xc770('0x8'));var fs=require('fs');var fs_extra=require(_0xc770('0x9'));var _=require('lodash');var squel=require(_0xc770('0xa'));var crypto=require('crypto');var jsforce=require(_0xc770('0xb'));var deskjs=require(_0xc770('0xc'));var toCsv=require(_0xc770('0x7'));var querystring=require(_0xc770('0xd'));var Papa=require(_0xc770('0xe'));var Redis=require(_0xc770('0xf'));var authService=require(_0xc770('0x10'));var qs=require(_0xc770('0x11'));var as=require(_0xc770('0x12'));var hardwareService=require(_0xc770('0x13'));var logger=require('../../config/logger')(_0xc770('0x14'));var utils=require(_0xc770('0x15'));var config=require(_0xc770('0x16'));var licenseUtil=require(_0xc770('0x17'));var db=require(_0xc770('0x18'))['db'];function respondWithStatusCode(_0x260ed5,_0x26470b){_0x26470b=_0x26470b||0xcc;return function(_0x364e5e){if(_0x364e5e){return _0x260ed5['sendStatus'](_0x26470b);}return _0x260ed5[_0xc770('0x19')](_0x26470b)['end']();};}function respondWithResult(_0x1fc594,_0xd8e74d){_0xd8e74d=_0xd8e74d||0xc8;return function(_0x4e403d){if(_0x4e403d){return _0x1fc594['status'](_0xd8e74d)[_0xc770('0x1a')](_0x4e403d);}};}function respondWithFilteredResult(_0x2f8990,_0x8cf60f){return function(_0x20bace){if(_0x20bace){var _0x32df29=typeof _0x8cf60f[_0xc770('0x1b')]===_0xc770('0x1c')&&typeof _0x8cf60f['limit']==='undefined';var _0x1693e5=_0x20bace[_0xc770('0x1d')];var _0x5abf46=_0x32df29?0x0:_0x8cf60f[_0xc770('0x1b')];var _0x471f95=_0x32df29?_0x20bace[_0xc770('0x1d')]:_0x8cf60f['offset']+_0x8cf60f[_0xc770('0x1e')];var _0x4247ec;if(_0x471f95>=_0x1693e5){_0x471f95=_0x1693e5;_0x4247ec=0xc8;}else{_0x4247ec=0xce;}_0x2f8990['status'](_0x4247ec);return _0x2f8990[_0xc770('0x1f')](_0xc770('0x20'),_0x5abf46+'-'+_0x471f95+'/'+_0x1693e5)['json'](_0x20bace);}return null;};}function patchUpdates(_0x337c72){return function(_0x24fe15){try{jsonpatch[_0xc770('0x21')](_0x24fe15,_0x337c72,!![]);}catch(_0x12d63a){return BPromise[_0xc770('0x22')](_0x12d63a);}return _0x24fe15[_0xc770('0x23')]();};}function saveUpdates(_0xb8fd28,_0x7444a5){return function(_0x3515bc){if(_0x3515bc){return _0x3515bc[_0xc770('0x24')](_0xb8fd28)[_0xc770('0x25')](function(_0x5eb669){return _0x5eb669;});}return null;};}function removeEntity(_0x550c42,_0x402bab){return function(_0x5bcfa0){if(_0x5bcfa0){return _0x5bcfa0[_0xc770('0x26')]()[_0xc770('0x25')](function(){_0x550c42[_0xc770('0x19')](0xcc)[_0xc770('0x27')]();});}};}function handleEntityNotFound(_0x546c89,_0x3d5032){return function(_0x270f5f){if(!_0x270f5f){_0x546c89[_0xc770('0x28')](0x194);}return _0x270f5f;};}function handleError(_0x1abd3c,_0xcee2e4){_0xcee2e4=_0xcee2e4||0x1f4;return function(_0x3aee8d){logger[_0xc770('0x29')](_0x3aee8d[_0xc770('0x2a')]);if(_0x3aee8d[_0xc770('0x2b')]){delete _0x3aee8d[_0xc770('0x2b')];}_0x1abd3c[_0xc770('0x19')](_0xcee2e4)[_0xc770('0x2c')](_0x3aee8d);};}exports[_0xc770('0x2d')]=function(_0x59e02b,_0x2aa49c){var _0x1fdc13={},_0xaf42be={},_0xc4591={'count':0x0,'rows':[]};var _0x1cbaa4=_[_0xc770('0x2e')](db['FaxApplication'][_0xc770('0x2f')],function(_0x3eafcb){return{'name':_0x3eafcb[_0xc770('0x30')],'type':_0x3eafcb['type'][_0xc770('0x31')]};});_0xaf42be[_0xc770('0x32')]=_[_0xc770('0x2e')](_0x1cbaa4,_0xc770('0x2b'));_0xaf42be[_0xc770('0x33')]=_[_0xc770('0x34')](_0x59e02b[_0xc770('0x33')]);_0xaf42be['filters']=_[_0xc770('0x35')](_0xaf42be[_0xc770('0x32')],_0xaf42be[_0xc770('0x33')]);_0x1fdc13['attributes']=_[_0xc770('0x35')](_0xaf42be[_0xc770('0x32')],qs[_0xc770('0x36')](_0x59e02b[_0xc770('0x33')][_0xc770('0x36')]));_0x1fdc13[_0xc770('0x37')]=_0x1fdc13['attributes']['length']?_0x1fdc13[_0xc770('0x37')]:_0xaf42be['model'];if(!_0x59e02b['query'][_0xc770('0x38')](_0xc770('0x39'))){_0x1fdc13['limit']=qs[_0xc770('0x1e')](_0x59e02b[_0xc770('0x33')][_0xc770('0x1e')]);_0x1fdc13[_0xc770('0x1b')]=qs[_0xc770('0x1b')](_0x59e02b[_0xc770('0x33')][_0xc770('0x1b')]);}_0x1fdc13['order']=qs[_0xc770('0x3a')](_0x59e02b[_0xc770('0x33')][_0xc770('0x3a')]);_0x1fdc13[_0xc770('0x3b')]=qs['filters'](_[_0xc770('0x3c')](_0x59e02b[_0xc770('0x33')],_0xaf42be['filters']),_0x1cbaa4);if(_0x59e02b[_0xc770('0x33')][_0xc770('0x3d')]){_0x1fdc13['where']=_['merge'](_0x1fdc13[_0xc770('0x3b')],{'$or':_['map'](_0x1cbaa4,function(_0x43ba04){if(_0x43ba04[_0xc770('0x3e')]!=='VIRTUAL'){var _0x11cb41={};_0x11cb41[_0x43ba04[_0xc770('0x2b')]]={'$like':'%'+_0x59e02b[_0xc770('0x33')][_0xc770('0x3d')]+'%'};return _0x11cb41;}})});}_0x1fdc13=_['merge']({},_0x1fdc13,_0x59e02b[_0xc770('0x3f')]);var _0x5a6452={'where':_0x1fdc13[_0xc770('0x3b')]};return db[_0xc770('0x40')]['count'](_0x5a6452)[_0xc770('0x25')](function(_0x524d35){_0xc4591[_0xc770('0x1d')]=_0x524d35;if(_0x59e02b[_0xc770('0x33')][_0xc770('0x41')]){_0x1fdc13[_0xc770('0x42')]=[{'all':!![]}];}return db[_0xc770('0x40')][_0xc770('0x43')](_0x1fdc13);})[_0xc770('0x25')](function(_0x5681e7){_0xc4591[_0xc770('0x44')]=_0x5681e7;return _0xc4591;})[_0xc770('0x25')](respondWithFilteredResult(_0x2aa49c,_0x1fdc13))[_0xc770('0x45')](handleError(_0x2aa49c,null));};exports[_0xc770('0x46')]=function(_0x74697d,_0x1b1e19){var _0x278e68={'raw':!![],'where':{'id':_0x74697d[_0xc770('0x47')]['id']}},_0x128955={};_0x128955[_0xc770('0x32')]=_[_0xc770('0x34')](db[_0xc770('0x40')]['rawAttributes']);_0x128955['query']=_[_0xc770('0x34')](_0x74697d[_0xc770('0x33')]);_0x128955[_0xc770('0x48')]=_[_0xc770('0x35')](_0x128955[_0xc770('0x32')],_0x128955['query']);_0x278e68[_0xc770('0x37')]=_['intersection'](_0x128955[_0xc770('0x32')],qs[_0xc770('0x36')](_0x74697d[_0xc770('0x33')]['fields']));_0x278e68[_0xc770('0x37')]=_0x278e68[_0xc770('0x37')][_0xc770('0x49')]?_0x278e68[_0xc770('0x37')]:_0x128955['model'];if(_0x74697d[_0xc770('0x33')][_0xc770('0x41')]){_0x278e68['include']=[{'all':!![]}];}_0x278e68=_[_0xc770('0x4a')]({},_0x278e68,_0x74697d['options']);return db['FaxApplication'][_0xc770('0x4b')](_0x278e68)[_0xc770('0x25')](handleEntityNotFound(_0x1b1e19,null))['then'](respondWithResult(_0x1b1e19,null))['catch'](handleError(_0x1b1e19,null));};exports[_0xc770('0x4c')]=function(_0x4f31e2,_0x2b4208){return db['FaxApplication'][_0xc770('0x4c')](_0x4f31e2[_0xc770('0x4d')],{})[_0xc770('0x25')](respondWithResult(_0x2b4208,0xc9))[_0xc770('0x45')](handleError(_0x2b4208,null));};exports[_0xc770('0x24')]=function(_0x3abb2d,_0x54fd7b){if(_0x3abb2d['body']['id']){delete _0x3abb2d[_0xc770('0x4d')]['id'];}return db[_0xc770('0x40')][_0xc770('0x4b')]({'where':{'id':_0x3abb2d[_0xc770('0x47')]['id']}})[_0xc770('0x25')](handleEntityNotFound(_0x54fd7b,null))['then'](saveUpdates(_0x3abb2d[_0xc770('0x4d')],null))[_0xc770('0x25')](respondWithResult(_0x54fd7b,null))[_0xc770('0x45')](handleError(_0x54fd7b,null));};exports[_0xc770('0x26')]=function(_0x1fdf03,_0x3154c1){return db[_0xc770('0x40')][_0xc770('0x4b')]({'where':{'id':_0x1fdf03[_0xc770('0x47')]['id']}})[_0xc770('0x25')](handleEntityNotFound(_0x3154c1,null))['then'](removeEntity(_0x3154c1,null))[_0xc770('0x45')](handleError(_0x3154c1,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 3236ebc..7480c3c 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 _0x96f7=['exports','define','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0x96f7,0xf2));var _0x796f=function(_0xb6afe,_0x38671f){_0xb6afe=_0xb6afe-0x0;var _0x335218=_0x96f7[_0xb6afe];return _0x335218;};'use strict';var _=require(_0x796f('0x0'));var util=require(_0x796f('0x1'));var logger=require(_0x796f('0x2'))(_0x796f('0x3'));var moment=require(_0x796f('0x4'));var BPromise=require(_0x796f('0x5'));var rp=require(_0x796f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x796f('0x7'));var config=require(_0x796f('0x8'));var attributes=require(_0x796f('0x9'));module[_0x796f('0xa')]=function(_0x2b41ec,_0x4825af){return _0x2b41ec[_0x796f('0xb')]('FaxApplication',attributes,{'tableName':_0x796f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x796f('0xd')});}; \ No newline at end of file +var _0xb0a0=['path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise'];(function(_0xdf2f46,_0x753804){var _0x5aedc9=function(_0x4ba84d){while(--_0x4ba84d){_0xdf2f46['push'](_0xdf2f46['shift']());}};_0x5aedc9(++_0x753804);}(_0xb0a0,0x74));var _0x0b0a=function(_0x409682,_0x370090){_0x409682=_0x409682-0x0;var _0x1ee901=_0xb0a0[_0x409682];return _0x1ee901;};'use strict';var _=require(_0x0b0a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0b0a('0x1'));var moment=require('moment');var BPromise=require(_0x0b0a('0x2'));var rp=require(_0x0b0a('0x3'));var fs=require('fs');var path=require(_0x0b0a('0x4'));var rimraf=require(_0x0b0a('0x5'));var config=require(_0x0b0a('0x6'));var attributes=require('./faxApplication.attributes');module[_0x0b0a('0x7')]=function(_0x1fa414,_0x150ca9){return _0x1fa414[_0x0b0a('0x8')](_0x0b0a('0x9'),attributes,{'tableName':_0x0b0a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0b0a('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 5caee68..0dbdeb7 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 _0xf0ce=['http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client'];(function(_0x262c39,_0x14b574){var _0x371d00=function(_0x2fc39e){while(--_0x2fc39e){_0x262c39['push'](_0x262c39['shift']());}};_0x371d00(++_0x14b574);}(_0xf0ce,0x117));var _0xef0c=function(_0x25f1f7,_0x1d9363){_0x25f1f7=_0x25f1f7-0x0;var _0x8c8ad2=_0xf0ce[_0x25f1f7];return _0x8c8ad2;};'use strict';var _=require(_0xef0c('0x0'));var util=require(_0xef0c('0x1'));var moment=require(_0xef0c('0x2'));var BPromise=require(_0xef0c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef0c('0x4'));var db=require(_0xef0c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xef0c('0x6'))('rpc');var config=require(_0xef0c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xef0c('0x8')][_0xef0c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x290f66,_0x53c8fe,_0x175fb8){return new BPromise(function(_0x39c576,_0x3fa63f){return client[_0xef0c('0xa')](_0x290f66,_0x175fb8)[_0xef0c('0xb')](function(_0x3b807d){logger[_0xef0c('0xc')](_0xef0c('0xd'),_0x53c8fe,_0xef0c('0xe'));logger[_0xef0c('0xf')](_0xef0c('0x10'),_0x53c8fe,_0xef0c('0xe'),JSON[_0xef0c('0x11')](_0x3b807d));if(_0x3b807d[_0xef0c('0x12')]){if(_0x3b807d['error'][_0xef0c('0x13')]===0x1f4){logger[_0xef0c('0x12')](_0xef0c('0xd'),_0x53c8fe,_0x3b807d[_0xef0c('0x12')]['message']);return _0x3fa63f(_0x3b807d[_0xef0c('0x12')][_0xef0c('0x14')]);}logger[_0xef0c('0x12')](_0xef0c('0xd'),_0x53c8fe,_0x3b807d[_0xef0c('0x12')][_0xef0c('0x14')]);return _0x39c576(_0x3b807d[_0xef0c('0x12')]['message']);}else{logger[_0xef0c('0xc')](_0xef0c('0xd'),_0x53c8fe,_0xef0c('0xe'));_0x39c576(_0x3b807d[_0xef0c('0x15')][_0xef0c('0x14')]);}})[_0xef0c('0x16')](function(_0x2d7e9d){logger['error'](_0xef0c('0xd'),_0x53c8fe,_0x2d7e9d);_0x3fa63f(_0x2d7e9d);});});}exports[_0xef0c('0x17')]=function(_0x18034c){var _0x42b994=this;return new Promise(function(_0x4e3a54,_0x3a5a8d){return db[_0xef0c('0x18')][_0xef0c('0x19')](_0x18034c[_0xef0c('0x1a')],{'raw':_0x18034c['options']?_0x18034c[_0xef0c('0x1b')][_0xef0c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18034c[_0xef0c('0x1b')]?_0x18034c[_0xef0c('0x1b')][_0xef0c('0x1d')]||null:null,'attributes':_0x18034c['options']?_0x18034c[_0xef0c('0x1b')][_0xef0c('0x1e')]||null:null,'limit':_0x18034c['options']?_0x18034c[_0xef0c('0x1b')][_0xef0c('0x1f')]||null:null})[_0xef0c('0xb')](function(_0x586ffa){logger['info'](_0xef0c('0x17'),_0x18034c);logger['debug'](_0xef0c('0x17'),_0x18034c,JSON['stringify'](_0x586ffa));_0x4e3a54(_0x586ffa);})[_0xef0c('0x16')](function(_0x3d2969){logger[_0xef0c('0x12')]('UpdateFaxApplication',_0x3d2969[_0xef0c('0x14')],_0x18034c);_0x3a5a8d(_0x42b994['error'](0x1f4,_0x3d2969[_0xef0c('0x14')]));});});}; \ No newline at end of file +var _0x56e5=['error','code','message','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x503ec3,_0x5f851e){var _0x4ce7cf=function(_0x5231bb){while(--_0x5231bb){_0x503ec3['push'](_0x503ec3['shift']());}};_0x4ce7cf(++_0x5f851e);}(_0x56e5,0xd6));var _0x556e=function(_0x12ef39,_0x18d320){_0x12ef39=_0x12ef39-0x0;var _0x47a734=_0x56e5[_0x12ef39];return _0x47a734;};'use strict';var _=require(_0x556e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x556e('0x1'));var rs=require(_0x556e('0x2'));var fs=require('fs');var Redis=require(_0x556e('0x3'));var db=require(_0x556e('0x4'))['db'];var utils=require(_0x556e('0x5'));var logger=require(_0x556e('0x6'))('rpc');var config=require(_0x556e('0x7'));var jayson=require(_0x556e('0x8'));var client=jayson[_0x556e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5999f7,_0x2fdb5a,_0xcee119){return new BPromise(function(_0x570b37,_0x28b644){return client[_0x556e('0xa')](_0x5999f7,_0xcee119)[_0x556e('0xb')](function(_0x4cef56){logger[_0x556e('0xc')](_0x556e('0xd'),_0x2fdb5a,'request\x20sent');logger[_0x556e('0xe')](_0x556e('0xf'),_0x2fdb5a,_0x556e('0x10'),JSON[_0x556e('0x11')](_0x4cef56));if(_0x4cef56[_0x556e('0x12')]){if(_0x4cef56[_0x556e('0x12')][_0x556e('0x13')]===0x1f4){logger[_0x556e('0x12')](_0x556e('0xd'),_0x2fdb5a,_0x4cef56[_0x556e('0x12')]['message']);return _0x28b644(_0x4cef56[_0x556e('0x12')][_0x556e('0x14')]);}logger[_0x556e('0x12')](_0x556e('0xd'),_0x2fdb5a,_0x4cef56[_0x556e('0x12')]['message']);return _0x570b37(_0x4cef56[_0x556e('0x12')][_0x556e('0x14')]);}else{logger[_0x556e('0xc')](_0x556e('0xd'),_0x2fdb5a,_0x556e('0x10'));_0x570b37(_0x4cef56['result'][_0x556e('0x14')]);}})['catch'](function(_0x528bf8){logger[_0x556e('0x12')](_0x556e('0xd'),_0x2fdb5a,_0x528bf8);_0x28b644(_0x528bf8);});});}exports['UpdateFaxApplication']=function(_0x550641){var _0x33cfda=this;return new Promise(function(_0x1ba70e,_0xc62fb){return db['FaxApplication'][_0x556e('0x15')](_0x550641[_0x556e('0x16')],{'raw':_0x550641[_0x556e('0x17')]?_0x550641['options'][_0x556e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x550641[_0x556e('0x17')]?_0x550641[_0x556e('0x17')][_0x556e('0x19')]||null:null,'attributes':_0x550641[_0x556e('0x17')]?_0x550641['options'][_0x556e('0x1a')]||null:null,'limit':_0x550641['options']?_0x550641[_0x556e('0x17')][_0x556e('0x1b')]||null:null})[_0x556e('0xb')](function(_0x54fd33){logger[_0x556e('0xc')](_0x556e('0x1c'),_0x550641);logger['debug']('UpdateFaxApplication',_0x550641,JSON[_0x556e('0x11')](_0x54fd33));_0x1ba70e(_0x54fd33);})['catch'](function(_0x2d42f3){logger[_0x556e('0x12')](_0x556e('0x1c'),_0x2d42f3['message'],_0x550641);_0xc62fb(_0x33cfda['error'](0x1f4,_0x2d42f3['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 377c400..2d0b262 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 _0x77ea=['multer','util','path','express','Router','fs-extra','../../config/environment','./faxApplication.controller','get','index','show','post','isAuthenticated','create','put','/:id','update','delete','destroy'];(function(_0x26ed29,_0x2288f1){var _0x26182c=function(_0x23dc71){while(--_0x23dc71){_0x26ed29['push'](_0x26ed29['shift']());}};_0x26182c(++_0x2288f1);}(_0x77ea,0xbe));var _0xa77e=function(_0x52fd40,_0x482e35){_0x52fd40=_0x52fd40-0x0;var _0x99fc52=_0x77ea[_0x52fd40];return _0x99fc52;};'use strict';var multer=require(_0xa77e('0x0'));var util=require(_0xa77e('0x1'));var path=require(_0xa77e('0x2'));var timeout=require('connect-timeout');var express=require(_0xa77e('0x3'));var router=express[_0xa77e('0x4')]();var fs_extra=require(_0xa77e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa77e('0x6'));var controller=require(_0xa77e('0x7'));router[_0xa77e('0x8')]('/',auth['isAuthenticated'](),controller[_0xa77e('0x9')]);router[_0xa77e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa77e('0xa')]);router[_0xa77e('0xb')]('/',auth[_0xa77e('0xc')](),controller[_0xa77e('0xd')]);router[_0xa77e('0xe')](_0xa77e('0xf'),auth[_0xa77e('0xc')](),controller[_0xa77e('0x10')]);router[_0xa77e('0x11')]('/:id',auth[_0xa77e('0xc')](),controller[_0xa77e('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2155=['isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','../../config/environment','get'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0x2155,0x117));var _0x5215=function(_0x46fbdc,_0x2c043c){_0x46fbdc=_0x46fbdc-0x0;var _0x1def42=_0x2155[_0x46fbdc];return _0x1def42;};'use strict';var multer=require(_0x5215('0x0'));var util=require(_0x5215('0x1'));var path=require(_0x5215('0x2'));var timeout=require(_0x5215('0x3'));var express=require('express');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(_0x5215('0x4'));var controller=require('./faxApplication.controller');router[_0x5215('0x5')]('/',auth[_0x5215('0x6')](),controller[_0x5215('0x7')]);router[_0x5215('0x5')](_0x5215('0x8'),auth[_0x5215('0x6')](),controller[_0x5215('0x9')]);router[_0x5215('0xa')]('/',auth['isAuthenticated'](),controller[_0x5215('0xb')]);router[_0x5215('0xc')](_0x5215('0x8'),auth['isAuthenticated'](),controller[_0x5215('0xd')]);router[_0x5215('0xe')]('/:id',auth[_0x5215('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 8121e1a..82134bb 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 _0xa63f=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x590614,_0x1abe26){var _0x44eadb=function(_0x325eb1){while(--_0x325eb1){_0x590614['push'](_0x590614['shift']());}};_0x44eadb(++_0x1abe26);}(_0xa63f,0x1b6));var _0xfa63=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0xa63f[_0x30bd4d];return _0x306915;};'use strict';var Sequelize=require(_0xfa63('0x0'));module[_0xfa63('0x1')]={'closed':{'type':Sequelize[_0xfa63('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfa63('0x3')]},'disposition':{'type':Sequelize[_0xfa63('0x4')]},'secondDisposition':{'type':Sequelize[_0xfa63('0x4')]},'thirdDisposition':{'type':Sequelize[_0xfa63('0x4')]},'note':{'type':Sequelize[_0xfa63('0x4')]},'read1stAt':{'type':Sequelize[_0xfa63('0x3')]},'fax':{'type':Sequelize[_0xfa63('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfa63('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xfa63('0x5')]('in',_0xfa63('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3edc=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x150ffc,_0x10e224){var _0x168c9b=function(_0xe9ed77){while(--_0xe9ed77){_0x150ffc['push'](_0x150ffc['shift']());}};_0x168c9b(++_0x10e224);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x46cf8b,_0x3d6aa8){_0x46cf8b=_0x46cf8b-0x0;var _0x57440e=_0x3edc[_0x46cf8b];return _0x57440e;};'use strict';var Sequelize=require(_0xc3ed('0x0'));module[_0xc3ed('0x1')]={'closed':{'type':Sequelize[_0xc3ed('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc3ed('0x3')]},'disposition':{'type':Sequelize[_0xc3ed('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc3ed('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc3ed('0x3')]},'fax':{'type':Sequelize[_0xc3ed('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc3ed('0x5')]('in',_0xc3ed('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc3ed('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc3ed('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index bdc4452..df68f4f 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 _0x170b=['Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','push','rows','show','includeAll','include','create','describe','addMessage','params','ids','getMessages','findOne','FaxMessage','nolimit','$gte','format','findAll','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','join','server','root','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createWriteStream','resolve','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','end','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update','then','sendStatus','error','Users','map','fullname','TagIds','split','forEach','Tags','catch','FaxInteraction','rawAttributes','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','select','field','from','tools_tags','u.fullname','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','left_join','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','start','body','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName'];(function(_0x6a734c,_0x1b2d9f){var _0x494d0d=function(_0x36fd39){while(--_0x36fd39){_0x6a734c['push'](_0x6a734c['shift']());}};_0x494d0d(++_0x1b2d9f);}(_0x170b,0x1e4));var _0xb170=function(_0x2d9e4c,_0x3ff4d2){_0x2d9e4c=_0x2d9e4c-0x0;var _0xe17eec=_0x170b[_0x2d9e4c];return _0xe17eec;};'use strict';var emlformat=require(_0xb170('0x0'));var rimraf=require(_0xb170('0x1'));var zipdir=require(_0xb170('0x2'));var jsonpatch=require(_0xb170('0x3'));var rp=require(_0xb170('0x4'));var moment=require(_0xb170('0x5'));var BPromise=require(_0xb170('0x6'));var Mustache=require(_0xb170('0x7'));var util=require('util');var path=require(_0xb170('0x8'));var sox=require(_0xb170('0x9'));var csv=require(_0xb170('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb170('0xb'));var _=require(_0xb170('0xc'));var squel=require(_0xb170('0xd'));var crypto=require(_0xb170('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb170('0xa'));var querystring=require(_0xb170('0xf'));var Papa=require(_0xb170('0x10'));var Redis=require(_0xb170('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb170('0x12'));var as=require(_0xb170('0x13'));var hardwareService=require(_0xb170('0x14'));var logger=require(_0xb170('0x15'))(_0xb170('0x16'));var utils=require(_0xb170('0x17'));var config=require(_0xb170('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb170('0x19'))['db'];config[_0xb170('0x1a')]=_[_0xb170('0x1b')](config['redis'],{'host':_0xb170('0x1c'),'port':0x18eb});var socket=require(_0xb170('0x1d'))(new Redis(config[_0xb170('0x1a')]));require(_0xb170('0x1e'))[_0xb170('0x1f')](socket);function respondWithStatusCode(_0x17584e,_0x4ec6fa){_0x4ec6fa=_0x4ec6fa||0xcc;return function(_0x1b2555){if(_0x1b2555){return _0x17584e['sendStatus'](_0x4ec6fa);}return _0x17584e['status'](_0x4ec6fa)[_0xb170('0x20')]();};}function respondWithResult(_0x42d05d,_0x36b525){_0x36b525=_0x36b525||0xc8;return function(_0x446aa5){if(_0x446aa5){return _0x42d05d['status'](_0x36b525)[_0xb170('0x21')](_0x446aa5);}};}function respondWithFilteredResult(_0x20fcfa,_0x2d3264){return function(_0xa00daf){if(_0xa00daf){var _0x318d0d=typeof _0x2d3264[_0xb170('0x22')]===_0xb170('0x23')&&typeof _0x2d3264['limit']===_0xb170('0x23');var _0x3531c3=_0xa00daf['count'];var _0x317ab3=_0x318d0d?0x0:_0x2d3264[_0xb170('0x22')];var _0x3f1f56=_0x318d0d?_0xa00daf[_0xb170('0x24')]:_0x2d3264[_0xb170('0x22')]+_0x2d3264[_0xb170('0x25')];var _0x11a0c8;if(_0x3f1f56>=_0x3531c3){_0x3f1f56=_0x3531c3;_0x11a0c8=0xc8;}else{_0x11a0c8=0xce;}_0x20fcfa[_0xb170('0x26')](_0x11a0c8);return _0x20fcfa['set'](_0xb170('0x27'),_0x317ab3+'-'+_0x3f1f56+'/'+_0x3531c3)['json'](_0xa00daf);}return null;};}function patchUpdates(_0x4e7fcb){return function(_0xc19cff){try{jsonpatch[_0xb170('0x28')](_0xc19cff,_0x4e7fcb,!![]);}catch(_0x3f4af5){return BPromise[_0xb170('0x29')](_0x3f4af5);}return _0xc19cff[_0xb170('0x2a')]();};}function saveUpdates(_0x4999f7,_0x4119e0){return function(_0x52125b){if(_0x52125b){return _0x52125b[_0xb170('0x2b')](_0x4999f7)[_0xb170('0x2c')](function(_0x1130bb){return _0x1130bb;});}return null;};}function removeEntity(_0x2627c6,_0x562c0e){return function(_0x56a200){if(_0x56a200){return _0x56a200['destroy']()['then'](function(){_0x2627c6[_0xb170('0x26')](0xcc)[_0xb170('0x20')]();});}};}function handleEntityNotFound(_0x47ee56,_0xddbc6c){return function(_0x3dd678){if(!_0x3dd678){_0x47ee56[_0xb170('0x2d')](0x194);}return _0x3dd678;};}function handleError(_0x59f9f8,_0x38e300){_0x38e300=_0x38e300||0x1f4;return function(_0x4d20f1){logger[_0xb170('0x2e')](_0x4d20f1['stack']);if(_0x4d20f1['name']){delete _0x4d20f1['name'];}_0x59f9f8[_0xb170('0x26')](_0x38e300)['send'](_0x4d20f1);};}function getInteractionUsers(_0x3e1392,_0x3999f7){return new BPromise(function(_0xca978d,_0x25761f){try{if(_0x3999f7[_0x3e1392['id']]){_0x3e1392[_0xb170('0x2f')]=_[_0xb170('0x30')](_0x3999f7[_0x3e1392['id']],function(_0x3b84f3){return{'id':_0x3b84f3['id'],'fullname':_0x3b84f3[_0xb170('0x31')]};});}}catch(_0x3f26c5){_0x25761f(_0x3f26c5);}_0xca978d(_0x3e1392);});}function getInteractionTags(_0x4f6bc0,_0xacffd3){return new BPromise(function(_0x305016,_0x343c3e){try{if(_0x4f6bc0[_0xb170('0x32')]){_0x4f6bc0['Tags']=[];_0x4f6bc0[_0xb170('0x32')][_0xb170('0x33')](',')[_0xb170('0x34')](function(_0xf806ff){_0x4f6bc0[_0xb170('0x35')]['push'](_0xacffd3[_0xf806ff]);});}delete _0x4f6bc0[_0xb170('0x32')];}catch(_0x331526){_0x343c3e(_0x331526);}_0x305016(_0x4f6bc0);});}function updateFaxInteraction(_0x374a68,_0x3be36c,_0x528317){return new BPromise(function(_0x1425df,_0x47808f){return getInteractionUsers(_0x374a68,_0x528317)['then'](function(_0x300efa){return getInteractionTags(_0x300efa,_0x3be36c);})[_0xb170('0x2c')](function(_0xc1d7a8){_0x1425df(_0xc1d7a8);})[_0xb170('0x36')](function(_0x1314e0){_0x47808f(_0x1314e0);});});}exports['index']=function(_0x5b73f8,_0x266dfc){var _0x15ae52={},_0x37121d={},_0xdda00c={'count':0x0,'rows':[]};var _0xdf68b3=_[_0xb170('0x30')](db[_0xb170('0x37')][_0xb170('0x38')],function(_0x280486){return{'name':_0x280486['fieldName'],'type':_0x280486[_0xb170('0x39')][_0xb170('0x3a')]};});_0x37121d[_0xb170('0x3b')]=_[_0xb170('0x30')](_0xdf68b3,_0xb170('0x3c'));_0x37121d[_0xb170('0x3d')]=_[_0xb170('0x3e')](_0x5b73f8[_0xb170('0x3d')]);_0x37121d['filters']=_[_0xb170('0x3f')](_0x37121d[_0xb170('0x3b')],_0x37121d['query']);_0x15ae52[_0xb170('0x40')]=_[_0xb170('0x3f')](_0x37121d[_0xb170('0x3b')],qs[_0xb170('0x41')](_0x5b73f8['query']['fields']));_0x15ae52['attributes']=_0x15ae52[_0xb170('0x40')][_0xb170('0x42')]?_0x15ae52[_0xb170('0x40')]:_0x37121d[_0xb170('0x3b')];if(!_0x5b73f8[_0xb170('0x3d')][_0xb170('0x43')]('nolimit')){_0x15ae52[_0xb170('0x25')]=qs[_0xb170('0x25')](_0x5b73f8[_0xb170('0x3d')][_0xb170('0x25')]);_0x15ae52[_0xb170('0x22')]=qs[_0xb170('0x22')](_0x5b73f8[_0xb170('0x3d')]['offset']);}_0x15ae52['order']=qs['sort'](_0x5b73f8[_0xb170('0x3d')][_0xb170('0x44')]);_0x15ae52[_0xb170('0x45')]=qs[_0xb170('0x46')](_[_0xb170('0x47')](_0x5b73f8[_0xb170('0x3d')],_0x37121d[_0xb170('0x46')]),_0xdf68b3);var _0x2fe066=[];var _0x4ac4ae=squel[_0xb170('0x48')]()[_0xb170('0x49')]('id')['field']('name')[_0xb170('0x49')]('color')[_0xb170('0x4a')](_0xb170('0x4b'));var _0x3a339e=squel[_0xb170('0x48')]()['field']('u.id')[_0xb170('0x49')](_0xb170('0x4c'))[_0xb170('0x49')]('ui.FaxInteractionId')[_0xb170('0x4a')]('user_has_fax_interactions','ui')['left_join'](_0xb170('0x4d'),'u',_0xb170('0x4e'));var _0x16af22=squel[_0xb170('0x48')]()[_0xb170('0x4a')](_0xb170('0x4f'),'i')['left_join'](_0xb170('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xb170('0x51')]('users','o',_0xb170('0x52'))['left_join'](_0xb170('0x53'),'a',_0xb170('0x54'))['left_join'](_0xb170('0x55'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xb170('0x51')](_0xb170('0x56'),'it','it.FaxInteractionId\x20=\x20i.id')[_0xb170('0x51')](_0xb170('0x4b'),'t',_0xb170('0x57'));var _0x177f48=squel[_0xb170('0x58')]();var _0x18cceb=[];var _0x56c501=squel['expr']();var _0x5392a5;if(_0x5b73f8[_0xb170('0x3d')][_0xb170('0x59')]){_0x5392a5=as[_0xb170('0x5a')](_0x5b73f8[_0xb170('0x3d')]['search']);var _0x4d019c=_0x5392a5[_0xb170('0x5b')];for(var _0x403353=0x0;_0x403353<_0x5392a5[_0xb170('0x5c')][_0xb170('0x42')];_0x403353++){var _0x285b56=_0x5392a5[_0xb170('0x5c')][_0x403353];var _0x2af445='i';var _0x23ed54=_['find'](_0xdf68b3,['name',_0x285b56[_0xb170('0x49')]]);if(!_0x23ed54){switch(_0x285b56[_0xb170('0x49')]){case _0xb170('0x5d'):if(_0x285b56[_0xb170('0x5e')]==0x1){_0x16af22[_0xb170('0x5f')]('`'+_0x285b56[_0xb170('0x49')]+_0xb170('0x60'));}else{_0x16af22[_0xb170('0x5f')]('`'+_0x285b56[_0xb170('0x49')]+_0xb170('0x61'));}break;case'Contact':if(_0x285b56[_0xb170('0x62')]===_0xb170('0x63')){if(_0x285b56['value']['split']('\x20')[_0xb170('0x42')]>0x1){_0x177f48[_0x4d019c](_0xb170('0x64'),qs[_0xb170('0x65')](_0x285b56['value']),null);}else{var _0x59a613='%'+_0x285b56['value']+'%';_0x177f48[_0x4d019c](_0xb170('0x66'),_0x59a613,_0x59a613,_0x59a613);}}else{_0x23ed54=_['find'](_0xdf68b3,[_0xb170('0x3c'),_0xb170('0x67')]);_0x285b56[_0xb170('0x49')]=_0xb170('0x67');_0x4be924=as[_0xb170('0x68')](_0x2af445,_0x23ed54[_0xb170('0x39')],_0x285b56);_0x177f48[_0x4d019c](_0x4be924[_0xb170('0x69')],_0x4be924['value']['start'],_0x4be924[_0xb170('0x5e')][_0xb170('0x20')]);}break;case _0xb170('0x6a'):var _0x145827=_0x285b56[_0xb170('0x5e')][_0xb170('0x33')](',')[_0xb170('0x30')](function(_0x1fc2d5){return Number(_0x1fc2d5);});_0x145827[_0xb170('0x34')](function(_0x30106a){_0x56c501['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x30106a+',%');});_0x18cceb=_[_0xb170('0x6b')](_0x18cceb,_0x145827);break;case'User':if(_0x285b56['operator']===_0xb170('0x63')){_0x177f48[_0x4d019c](_0xb170('0x6c'),'%'+_0x285b56[_0xb170('0x5e')]+'%',null);}else{_0x23ed54=_[_0xb170('0x6d')](_0xdf68b3,['name',_0xb170('0x6e')]);_0x285b56['field']=_0xb170('0x6e');_0x4be924=as['buildExpression'](_0x2af445,_0x23ed54['type'],_0x285b56);_0x177f48[_0x4d019c](_0x4be924[_0xb170('0x69')],_0x4be924['value'][_0xb170('0x6f')],_0x4be924[_0xb170('0x5e')][_0xb170('0x20')]);}break;case _0xb170('0x70'):_0x4be924=as['buildExpression']('me',null,_0x285b56);_0x177f48[_0x4d019c](_0x4be924[_0xb170('0x69')],_0x4be924['value'][_0xb170('0x6f')],_0x4be924[_0xb170('0x5e')][_0xb170('0x20')]);break;}}else{var _0x4be924=as[_0xb170('0x68')](_0x2af445,_0x23ed54[_0xb170('0x39')],_0x285b56);_0x177f48[_0x4d019c](_0x4be924[_0xb170('0x69')],_0x4be924[_0xb170('0x5e')]['start'],_0x4be924[_0xb170('0x5e')][_0xb170('0x20')]);}}}else{var _0x51c27e=_(_0x5b73f8[_0xb170('0x3d')])[_0xb170('0x3e')]()['map'](function(_0x2a750e){return _[_0xb170('0x71')](_0xdf68b3,['name',_0x2a750e])?_0x2a750e:undefined;})['compact']()['value']();if(!_[_0xb170('0x72')](_0x51c27e)){_0x51c27e['forEach'](function(_0x49dfbe){if(_0x49dfbe===_0xb170('0x73')){_0x16af22[_0xb170('0x45')](_0xb170('0x74'),[][_0xb170('0x75')](_0x5b73f8[_0xb170('0x3d')][_0x49dfbe]));}else if(_0x49dfbe==='createdAt'){var _0x105415=JSON[_0xb170('0x76')](_0x5b73f8[_0xb170('0x3d')][_0x49dfbe])['$gte'];var _0x407e48=JSON[_0xb170('0x76')](_0x5b73f8[_0xb170('0x3d')][_0x49dfbe])[_0xb170('0x77')];_0x16af22[_0xb170('0x45')](_0xb170('0x78'),_0x105415,_0x407e48);}else{if(_0x5b73f8[_0xb170('0x3d')][_0x49dfbe]===_0xb170('0x79')){_0x16af22['where']('i.'+_0x49dfbe+_0xb170('0x7a'));}else{_0x16af22[_0xb170('0x45')]('i.'+_0x49dfbe+_0xb170('0x7b'),_0x5b73f8[_0xb170('0x3d')][_0x49dfbe]);}}});}if(_0x5b73f8[_0xb170('0x3d')][_0xb170('0x7c')]){if(_0x5b73f8[_0xb170('0x3d')][_0xb170('0x7c')]==0x1){_0x16af22[_0xb170('0x5f')](_0xb170('0x7d'));}else{_0x16af22[_0xb170('0x5f')](_0xb170('0x7e'));}}if(_0x5b73f8[_0xb170('0x3d')]['tag']){_0x18cceb=_[_0xb170('0x7f')](_0x5b73f8[_0xb170('0x3d')][_0xb170('0x80')])?_0x5b73f8[_0xb170('0x3d')][_0xb170('0x80')]:new Array(_0x5b73f8[_0xb170('0x3d')][_0xb170('0x80')]);_0x18cceb['forEach'](function(_0x2f4e68){_0x56c501['or'](_0xb170('0x81'),'%,'+_0x2f4e68+',%');});}if(_0x5b73f8['query'][_0xb170('0x82')]){var _0xd8ad67=_0x5b73f8[_0xb170('0x3d')][_0xb170('0x82')][_0xb170('0x83')]('\x5c','\x5c\x5c')[_0xb170('0x83')](/'/g,'\x27\x27');if(qs[_0xb170('0x84')](_0xd8ad67)){_0x177f48['or'](_0xb170('0x85'),_0xd8ad67+'%')['or'](_0xb170('0x86'),_0xd8ad67+'%');}_0x177f48['or'](_0xb170('0x87'),_0xd8ad67+'%');}}_0x16af22[_0xb170('0x45')](_0x177f48);_0x16af22[_0xb170('0x88')](_0xb170('0x89'));var _0xe10f0f={'type':db[_0xb170('0x8a')][_0xb170('0x8b')]['SELECT'],'raw':!![]};var _0x30a96c=_0x16af22['clone']();_0x30a96c['field'](_0xb170('0x89'));_0x30a96c['field'](_0xb170('0x8c'),_0xb170('0x5d'));if(_0x15ae52['order']){_0x15ae52[_0xb170('0x8d')][_0xb170('0x34')](function(_0x558d08){var _0x309cba=_0x558d08[0x0]===_0xb170('0x8e')?_0x558d08[0x0]:'i.'+_0x558d08[0x0];_0x16af22[_0xb170('0x8d')](_0x309cba,_0x558d08[0x1]===_0xb170('0x8f')?![]:!![]);});}if(!_[_0xb170('0x72')](_0x18cceb)){_0x16af22[_0xb170('0x5f')](_0x56c501);_0x30a96c[_0xb170('0x45')](_0xb170('0x90'),_0x18cceb);}BPromise['resolve']()[_0xb170('0x2c')](function(){if(!_0x5392a5){if(_0x5b73f8[_0xb170('0x3d')]['FaxAccountId'])return;_0x30a96c[_0xb170('0x45')](_0xb170('0x91'));_0x16af22['where'](_0xb170('0x91'));return;}if(_0x5b73f8['user'][_0xb170('0x92')]!==_0xb170('0x93'))return;return _0x5b73f8[_0xb170('0x94')][_0xb170('0x95')]({'attributes':['id'],'raw':!![]})[_0xb170('0x2c')](function(_0x2cbf19){if(_[_0xb170('0x72')](_0x2cbf19)){_0x30a96c['where'](_0xb170('0x96'));_0x16af22[_0xb170('0x45')](_0xb170('0x96'));}else{_0x30a96c['where'](_0xb170('0x74'),_[_0xb170('0x30')](_0x2cbf19,'id'));_0x16af22[_0xb170('0x45')]('i.FaxAccountId\x20IN\x20?',_[_0xb170('0x30')](_0x2cbf19,'id'));}});})['then'](function(){if(_0x5b73f8[_0xb170('0x94')][_0xb170('0x92')]==='agent'&&!_0x5392a5&&!_0x5b73f8['query']['FaxAccountId'])return[];return db[_0xb170('0x97')][_0xb170('0x3d')](_0x30a96c[_0xb170('0x98')](),_0xe10f0f);})['then'](function(_0x522ccd){_0xdda00c[_0xb170('0x24')]=_0x522ccd['length'];if(_0xdda00c[_0xb170('0x24')]===0x0)return[];return db['sequelize'][_0xb170('0x3d')](_0x4ac4ae[_0xb170('0x98')](),_0xe10f0f)[_0xb170('0x2c')](function(_0x2d3c8f){_0x2fe066=_[_0xb170('0x99')](_0x2d3c8f,'id');_0xe10f0f=_[_0xb170('0x9a')](_0xe10f0f,{'model':db[_0xb170('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5b73f8[_0xb170('0x3d')][_0xb170('0x41')]){_0x15ae52[_0xb170('0x40')][_0xb170('0x34')](function(_0x2ec1c6){_0x16af22[_0xb170('0x49')]('i.'+_0x2ec1c6);});}else{_0x16af22[_0xb170('0x49')](_0xb170('0x8c'),_0xb170('0x5d'));_0x16af22[_0xb170('0x49')](_0xb170('0x9b'),_0xb170('0x9c'));_0x16af22[_0xb170('0x49')](_0xb170('0x9d'),_0xb170('0x9e'));_0x16af22['field']('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',_0xb170('0x8e'));_0x16af22[_0xb170('0x49')](_0xb170('0x9f'));_0x16af22['field'](_0xb170('0xa0'),_0xb170('0xa1'));_0x16af22[_0xb170('0x49')](_0xb170('0xa2'),_0xb170('0xa3'));_0x16af22[_0xb170('0x49')]('c.email',_0xb170('0xa4'));_0x16af22[_0xb170('0x49')](_0xb170('0xa5'),_0xb170('0xa6'));_0x16af22[_0xb170('0x49')](_0xb170('0xa7'),_0xb170('0xa8'));_0x16af22[_0xb170('0x49')](_0xb170('0xa9'),'Contact.fax');_0x16af22['field'](_0xb170('0xaa'),'Owner.fullname');_0x16af22[_0xb170('0x49')](_0xb170('0xab'),'Owner.internal');_0x16af22[_0xb170('0x49')](_0xb170('0xac'),_0xb170('0x32'));}if(_0x15ae52[_0xb170('0x25')])_0x16af22[_0xb170('0x25')](_0x15ae52['limit']);if(_0x15ae52['offset'])_0x16af22['offset'](_0x15ae52[_0xb170('0x22')]);return db['sequelize']['query'](_0x16af22[_0xb170('0x98')](),_0xe10f0f);})['then'](function(_0xd6daf0){if(_0xd6daf0[_0xb170('0x42')]>0x0)_0x3a339e[_0xb170('0x45')](_0xb170('0xad'),_[_0xb170('0x30')](_0xd6daf0,'id'));return db[_0xb170('0x97')][_0xb170('0x3d')](_0x3a339e[_0xb170('0x98')](),_0xe10f0f)[_0xb170('0x2c')](function(_0x12b169){var _0x3f734a=_['groupBy'](_0x12b169,_0xb170('0xae'));var _0x514508=[];_0xd6daf0[_0xb170('0x34')](function(_0x241362){_0x514508[_0xb170('0xaf')](updateFaxInteraction(_0x241362,_0x2fe066,_0x3f734a));});return BPromise['all'](_0x514508);});});})['then'](function(_0x1579af){_0xdda00c[_0xb170('0xb0')]=_0x1579af;return _0xdda00c;})['then'](respondWithFilteredResult(_0x266dfc,_0x15ae52))[_0xb170('0x36')](handleError(_0x266dfc,null));};exports[_0xb170('0xb1')]=function(_0x2c0974,_0x18d849){var _0x44ebe0={'raw':![],'where':{'id':_0x2c0974['params']['id']}},_0x26485a={};_0x26485a[_0xb170('0x3b')]=_[_0xb170('0x3e')](db[_0xb170('0x37')][_0xb170('0x38')]);_0x26485a['query']=_['keys'](_0x2c0974[_0xb170('0x3d')]);_0x26485a[_0xb170('0x46')]=_[_0xb170('0x3f')](_0x26485a['model'],_0x26485a[_0xb170('0x3d')]);_0x44ebe0[_0xb170('0x40')]=_[_0xb170('0x3f')](_0x26485a['model'],qs[_0xb170('0x41')](_0x2c0974[_0xb170('0x3d')][_0xb170('0x41')]));_0x44ebe0[_0xb170('0x40')]=_0x44ebe0['attributes']['length']?_0x44ebe0['attributes']:_0x26485a[_0xb170('0x3b')];if(_0x2c0974[_0xb170('0x3d')][_0xb170('0xb2')]){_0x44ebe0[_0xb170('0xb3')]=[{'all':!![]}];}_0x44ebe0=_[_0xb170('0x9a')]({},_0x44ebe0,_0x2c0974['options']);return db[_0xb170('0x37')][_0xb170('0x6d')](_0x44ebe0)['then'](handleEntityNotFound(_0x18d849,null))[_0xb170('0x2c')](respondWithResult(_0x18d849,null))['catch'](handleError(_0x18d849,null));};exports[_0xb170('0xb4')]=function(_0x4c9f31,_0x367f3b){return db[_0xb170('0x37')]['create'](_0x4c9f31[_0xb170('0x70')],{})[_0xb170('0x2c')](respondWithResult(_0x367f3b,0xc9))[_0xb170('0x36')](handleError(_0x367f3b,null));};exports[_0xb170('0x2b')]=function(_0x427d2d,_0x54abed){if(_0x427d2d[_0xb170('0x70')]['id']){delete _0x427d2d[_0xb170('0x70')]['id'];}return db['FaxInteraction'][_0xb170('0x6d')]({'where':{'id':_0x427d2d['params']['id']}})[_0xb170('0x2c')](handleEntityNotFound(_0x54abed,null))[_0xb170('0x2c')](saveUpdates(_0x427d2d[_0xb170('0x70')],null))[_0xb170('0x2c')](respondWithResult(_0x54abed,null))['catch'](handleError(_0x54abed,null));};exports['destroy']=function(_0x1b8ba5,_0x50c81a){return db[_0xb170('0x37')][_0xb170('0x6d')]({'where':{'id':_0x1b8ba5['params']['id']}})['then'](handleEntityNotFound(_0x50c81a,null))['then'](removeEntity(_0x50c81a,null))['catch'](handleError(_0x50c81a,null));};exports[_0xb170('0xb5')]=function(_0xffe11d,_0x59a3db){return db[_0xb170('0x37')][_0xb170('0xb5')]()[_0xb170('0x2c')](respondWithResult(_0x59a3db,null))['catch'](handleError(_0x59a3db,null));};exports[_0xb170('0xb6')]=function(_0x1f2951,_0x267759,_0x3aa8e1){return db['FaxMessage'][_0xb170('0x6d')]({'where':{'id':_0x1f2951[_0xb170('0xb7')]['id']}})['then'](handleEntityNotFound(_0x267759,null))[_0xb170('0x2c')](function(_0x1ec2a6){if(_0x1ec2a6){return _0x1ec2a6[_0xb170('0xb6')](_0x1f2951['body'][_0xb170('0xb8')],_['omit'](_0x1f2951[_0xb170('0x70')],[_0xb170('0xb8'),'id'])||{});}})[_0xb170('0x2c')](respondWithResult(_0x267759,null))[_0xb170('0x36')](handleError(_0x267759,null));};exports[_0xb170('0xb9')]=function(_0x24bfa2,_0xa1db00,_0xb32b71){var _0x1a6ec5={'raw':![],'where':{}};var _0x321cd4={};var _0xeac706={'count':0x0,'rows':[]};return db[_0xb170('0x37')][_0xb170('0xba')]({'where':{'id':_0x24bfa2[_0xb170('0xb7')]['id']}})[_0xb170('0x2c')](handleEntityNotFound(_0xa1db00,null))[_0xb170('0x2c')](function(_0xc3be11){if(_0xc3be11){_0x321cd4[_0xb170('0x3b')]=_['keys'](db[_0xb170('0xbb')][_0xb170('0x38')]);_0x321cd4[_0xb170('0x3d')]=_[_0xb170('0x3e')](_0x24bfa2['query']);_0x321cd4[_0xb170('0x46')]=_[_0xb170('0x3f')](_0x321cd4[_0xb170('0x3b')],_0x321cd4[_0xb170('0x3d')]);_0x1a6ec5[_0xb170('0x40')]=_['intersection'](_0x321cd4[_0xb170('0x3b')],qs[_0xb170('0x41')](_0x24bfa2[_0xb170('0x3d')][_0xb170('0x41')]));_0x1a6ec5[_0xb170('0x40')]=_0x1a6ec5['attributes']['length']?_0x1a6ec5['attributes']:_0x321cd4[_0xb170('0x3b')];if(!_0x24bfa2[_0xb170('0x3d')][_0xb170('0x43')](_0xb170('0xbc'))){_0x1a6ec5['limit']=qs['limit'](_0x24bfa2[_0xb170('0x3d')]['limit']);_0x1a6ec5[_0xb170('0x22')]=qs[_0xb170('0x22')](_0x24bfa2[_0xb170('0x3d')]['offset']);}_0x1a6ec5['order']=qs[_0xb170('0x44')](_0x24bfa2[_0xb170('0x3d')][_0xb170('0x44')]);_0x1a6ec5[_0xb170('0x45')]=qs[_0xb170('0x46')](_[_0xb170('0x47')](_0x24bfa2[_0xb170('0x3d')],_0x321cd4[_0xb170('0x46')]));_0x1a6ec5[_0xb170('0x45')][_0xb170('0xae')]=_0xc3be11['id'];if(_0x24bfa2[_0xb170('0x3d')][_0xb170('0x82')]){_0x1a6ec5['where']=_[_0xb170('0x9a')](_0x1a6ec5[_0xb170('0x45')],{'$or':_[_0xb170('0x30')](_0x1a6ec5['attributes'],function(_0x165acf){var _0x2d7825={};_0x2d7825[_0x165acf]={'$like':'%'+_0x24bfa2[_0xb170('0x3d')][_0xb170('0x82')]+'%'};return _0x2d7825;})});}if(_0x24bfa2[_0xb170('0x3d')]['$gte']){var _0x4258ec=_0x24bfa2[_0xb170('0x3d')][_0xb170('0xbd')][_0xb170('0x33')](',');var _0x9e7ac8={};_0x9e7ac8[_0x4258ec[0x0]]={'$gte':moment(_0x4258ec[0x1])[_0xb170('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1a6ec5['where']=_[_0xb170('0x9a')](_0x1a6ec5[_0xb170('0x45')],_0x9e7ac8);}_0x1a6ec5=_['merge']({},_0x1a6ec5,_0x24bfa2['options']);return db[_0xb170('0xbb')]['count']({'where':_0x1a6ec5['where']})['then'](function(_0x2ab124){_0xeac706[_0xb170('0x24')]=_0x2ab124;if(_0x24bfa2[_0xb170('0x3d')]['includeAll']){_0x1a6ec5[_0xb170('0xb3')]=[{'all':!![]}];}return db[_0xb170('0xbb')][_0xb170('0xbf')](_0x1a6ec5);})['then'](function(_0x3ef9ac){_0xeac706[_0xb170('0xb0')]=_0x3ef9ac;return _0xeac706;});}})['then'](respondWithFilteredResult(_0xa1db00,_0x1a6ec5))[_0xb170('0x36')](handleError(_0xa1db00,null));};exports[_0xb170('0xc0')]=function(_0x4885d1,_0x13ec2a,_0x4bbaef){return db['FaxInteraction'][_0xb170('0x6d')]({'where':{'id':_0x4885d1[_0xb170('0xb7')]['id']}})[_0xb170('0x2c')](handleEntityNotFound(_0x13ec2a,null))['then'](function(_0x2f164d){if(_0x2f164d){return _0x2f164d[_0xb170('0xc1')](_0x4885d1[_0xb170('0x70')][_0xb170('0xb8')],_['omit'](_0x4885d1[_0xb170('0x70')],[_0xb170('0xb8'),'id'])||{})[_0xb170('0xc2')](function(){return db['Tag'][_0xb170('0xbf')]({'attributes':['id',_0xb170('0x3c'),_0xb170('0xc3')],'where':{'id':_0x4885d1['body'][_0xb170('0xb8')]}});})[_0xb170('0x2c')](function(_0x46a362){socket[_0xb170('0xc4')](_0xb170('0xc5'),{'id':Number(_0x4885d1['params']['id']),'tags':_0x46a362||[]});return{'id':Number(_0x4885d1['params']['id']),'tags':_0x46a362||[]};});}})['then'](respondWithResult(_0x13ec2a,null))['catch'](handleError(_0x13ec2a,null));};exports['removeTags']=function(_0x1defc6,_0xf7b199,_0x2f86cd){return db[_0xb170('0x37')]['find']({'where':{'id':_0x1defc6[_0xb170('0xb7')]['id']}})['then'](handleEntityNotFound(_0xf7b199,null))[_0xb170('0x2c')](function(_0x3b6656){if(_0x3b6656){return _0x3b6656[_0xb170('0xc6')](_0x1defc6['query'][_0xb170('0xb8')]);}})[_0xb170('0x2c')](respondWithStatusCode(_0xf7b199,null))[_0xb170('0x36')](handleError(_0xf7b199,null));};exports['download']=function(_0x3a9aa6,_0x48209d){var _0x37df2e=moment()['unix']()['toString']();var _0x800c25=path[_0xb170('0xc7')](config['root'],_0xb170('0xc8'),'files','tmp');var _0x144fef=path[_0xb170('0xc7')](config[_0xb170('0xc9')],_0xb170('0xc8'),_0xb170('0xca'),_0xb170('0xcb'));var _0x2d504b=path[_0xb170('0xc7')](_0x800c25,_0x37df2e);var _0x468444=util['format'](_0xb170('0xcc'),_0x3a9aa6[_0xb170('0xb7')]['id'],_0x37df2e);var _0x28cc0e=path['join'](_0x800c25,_0x468444);var _0x4b3894=[];_0x4b3894['push']({'model':db[_0xb170('0xcd')],'as':_0xb170('0xcd'),'raw':!![]});var _0x4aff79=[{'model':db[_0xb170('0xbb')],'as':_0xb170('0xce'),'attributes':['id',_0xb170('0x70'),'createdAt'],'include':_0x4b3894}];return db[_0xb170('0x37')][_0xb170('0x6d')]({'where':{'id':_0x3a9aa6[_0xb170('0xb7')]['id']},'include':_0x4aff79})[_0xb170('0x2c')](handleEntityNotFound(_0x48209d,null))[_0xb170('0x2c')](function(_0x48aaa0){if(_0x48aaa0&&_0x48aaa0['Messages']){var _0x423610=_0x48aaa0[_0xb170('0xcf')]({'plain':!![]});fs[_0xb170('0xd0')](_0x2d504b);for(var _0x12c236=0x0;_0x12c236<_0x423610['Messages'][_0xb170('0x42')];_0x12c236++){var _0x51e53b=_0x423610[_0xb170('0xce')][_0x12c236][_0xb170('0xcd')];if(_0x51e53b){var _0x16b7c1=path[_0xb170('0xc7')](_0x144fef,_0x51e53b[_0xb170('0xd1')]);if(fs['existsSync'](_0x16b7c1)){fs['createReadStream'](_0x16b7c1)['pipe'](fs[_0xb170('0xd2')](path[_0xb170('0xc7')](_0x2d504b,_0x51e53b['basename'])));}}}return BPromise[_0xb170('0xd3')]()[_0xb170('0x2c')](function(){return new BPromise(function(_0x53c0e2,_0x2833a2){zipdir(_0x2d504b,{'saveTo':_0x28cc0e},function(_0x19948e,_0x348e64){if(_0x19948e)return _0x2833a2(_0x19948e);return _0x53c0e2(_0x348e64);});})[_0xb170('0x2c')](function(){return new BPromise(function(_0x39588b,_0x2fc117){rimraf(_0x2d504b,function(_0x37bc2f){if(_0x37bc2f)_0x2fc117(_0x37bc2f);return _0x39588b();});});})[_0xb170('0x2c')](function(){return _0x48209d['download'](_0x28cc0e,_0x468444,function(_0x1f9e71){if(_0x1f9e71){console[_0xb170('0xd4')](_0xb170('0xd5'),_0x1f9e71);}else{fs[_0xb170('0xd6')](_0x28cc0e);}});});});}else{return _0x48209d[_0xb170('0x2d')](0xc8);}})[_0xb170('0x36')](handleError(_0x48209d,null));}; \ No newline at end of file +var _0x1f6c=['cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','buildExpression','keys','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','params','rawAttributes','includeAll','include','options','create','update','addMessage','FaxMessage','ids','getMessages','findOne','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','Tag','emit','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','transcript-%d-%s.zip','Messages','mkdirSync','Attachment','basename','createReadStream','pipe','createWriteStream','resolve','log','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','then','error','name','send','map','fullname','Tags','TagIds','forEach','push','catch','index','FaxInteraction','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x1f6c,0x87));var _0xc1f6=function(_0x4cdc7e,_0x5d2257){_0x4cdc7e=_0x4cdc7e-0x0;var _0x3718ea=_0x1f6c[_0x4cdc7e];return _0x3718ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1f6('0x0'));var zipdir=require(_0xc1f6('0x1'));var jsonpatch=require(_0xc1f6('0x2'));var rp=require(_0xc1f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc1f6('0x4'));var util=require(_0xc1f6('0x5'));var path=require('path');var sox=require(_0xc1f6('0x6'));var csv=require(_0xc1f6('0x7'));var ejs=require(_0xc1f6('0x8'));var fs=require('fs');var fs_extra=require(_0xc1f6('0x9'));var _=require(_0xc1f6('0xa'));var squel=require(_0xc1f6('0xb'));var crypto=require(_0xc1f6('0xc'));var jsforce=require(_0xc1f6('0xd'));var deskjs=require(_0xc1f6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc1f6('0xf'));var Papa=require(_0xc1f6('0x10'));var Redis=require(_0xc1f6('0x11'));var authService=require(_0xc1f6('0x12'));var qs=require(_0xc1f6('0x13'));var as=require(_0xc1f6('0x14'));var hardwareService=require(_0xc1f6('0x15'));var logger=require(_0xc1f6('0x16'))(_0xc1f6('0x17'));var utils=require(_0xc1f6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc1f6('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc1f6('0x1a')](config[_0xc1f6('0x1b')],{'host':_0xc1f6('0x1c'),'port':0x18eb});var socket=require(_0xc1f6('0x1d'))(new Redis(config['redis']));require(_0xc1f6('0x1e'))[_0xc1f6('0x1f')](socket);function respondWithStatusCode(_0x5eea1a,_0x5f1404){_0x5f1404=_0x5f1404||0xcc;return function(_0x23c7e5){if(_0x23c7e5){return _0x5eea1a[_0xc1f6('0x20')](_0x5f1404);}return _0x5eea1a['status'](_0x5f1404)[_0xc1f6('0x21')]();};}function respondWithResult(_0x462f09,_0x572ae2){_0x572ae2=_0x572ae2||0xc8;return function(_0x49918e){if(_0x49918e){return _0x462f09[_0xc1f6('0x22')](_0x572ae2)[_0xc1f6('0x23')](_0x49918e);}};}function respondWithFilteredResult(_0x39c6b3,_0x26d55b){return function(_0x1c1689){if(_0x1c1689){var _0x4e4921=typeof _0x26d55b[_0xc1f6('0x24')]===_0xc1f6('0x25')&&typeof _0x26d55b['limit']===_0xc1f6('0x25');var _0x58da85=_0x1c1689[_0xc1f6('0x26')];var _0x24ff8b=_0x4e4921?0x0:_0x26d55b[_0xc1f6('0x24')];var _0x3c2f33=_0x4e4921?_0x1c1689[_0xc1f6('0x26')]:_0x26d55b['offset']+_0x26d55b[_0xc1f6('0x27')];var _0x13dddd;if(_0x3c2f33>=_0x58da85){_0x3c2f33=_0x58da85;_0x13dddd=0xc8;}else{_0x13dddd=0xce;}_0x39c6b3[_0xc1f6('0x22')](_0x13dddd);return _0x39c6b3[_0xc1f6('0x28')](_0xc1f6('0x29'),_0x24ff8b+'-'+_0x3c2f33+'/'+_0x58da85)[_0xc1f6('0x23')](_0x1c1689);}return null;};}function patchUpdates(_0xaee621){return function(_0x5887bf){try{jsonpatch['apply'](_0x5887bf,_0xaee621,!![]);}catch(_0x23ca3e){return BPromise[_0xc1f6('0x2a')](_0x23ca3e);}return _0x5887bf[_0xc1f6('0x2b')]();};}function saveUpdates(_0xad91a9,_0x4af20c){return function(_0xf8bf01){if(_0xf8bf01){return _0xf8bf01['update'](_0xad91a9)['then'](function(_0x3200e8){return _0x3200e8;});}return null;};}function removeEntity(_0x42cde0,_0x243430){return function(_0x13b265){if(_0x13b265){return _0x13b265[_0xc1f6('0x2c')]()[_0xc1f6('0x2d')](function(){_0x42cde0['status'](0xcc)[_0xc1f6('0x21')]();});}};}function handleEntityNotFound(_0xa8269e,_0x384ffc){return function(_0x2b39c2){if(!_0x2b39c2){_0xa8269e[_0xc1f6('0x20')](0x194);}return _0x2b39c2;};}function handleError(_0x5cf44f,_0x3924b3){_0x3924b3=_0x3924b3||0x1f4;return function(_0x49776d){logger[_0xc1f6('0x2e')](_0x49776d['stack']);if(_0x49776d[_0xc1f6('0x2f')]){delete _0x49776d['name'];}_0x5cf44f[_0xc1f6('0x22')](_0x3924b3)[_0xc1f6('0x30')](_0x49776d);};}function getInteractionUsers(_0x18015b,_0x17ee05){return new BPromise(function(_0x369788,_0x203b4e){try{if(_0x17ee05[_0x18015b['id']]){_0x18015b['Users']=_[_0xc1f6('0x31')](_0x17ee05[_0x18015b['id']],function(_0x1ba3fd){return{'id':_0x1ba3fd['id'],'fullname':_0x1ba3fd[_0xc1f6('0x32')]};});}}catch(_0x1c4a01){_0x203b4e(_0x1c4a01);}_0x369788(_0x18015b);});}function getInteractionTags(_0x2b96d7,_0x21e446){return new BPromise(function(_0x1a6fb0,_0x5e07b6){try{if(_0x2b96d7['TagIds']){_0x2b96d7[_0xc1f6('0x33')]=[];_0x2b96d7[_0xc1f6('0x34')]['split'](',')[_0xc1f6('0x35')](function(_0x2cab6a){_0x2b96d7[_0xc1f6('0x33')][_0xc1f6('0x36')](_0x21e446[_0x2cab6a]);});}delete _0x2b96d7['TagIds'];}catch(_0x3e26f4){_0x5e07b6(_0x3e26f4);}_0x1a6fb0(_0x2b96d7);});}function updateFaxInteraction(_0x5419d2,_0xf6c770,_0x41d5e4){return new BPromise(function(_0x20e3c5,_0x224bcb){return getInteractionUsers(_0x5419d2,_0x41d5e4)[_0xc1f6('0x2d')](function(_0xdbd466){return getInteractionTags(_0xdbd466,_0xf6c770);})[_0xc1f6('0x2d')](function(_0x498253){_0x20e3c5(_0x498253);})[_0xc1f6('0x37')](function(_0x4e9280){_0x224bcb(_0x4e9280);});});}exports[_0xc1f6('0x38')]=function(_0x1f0b76,_0x16d1ab){var _0x3248ff={},_0x40290d={},_0x170a37={'count':0x0,'rows':[]};var _0xd56139=_['map'](db[_0xc1f6('0x39')]['rawAttributes'],function(_0x3653b3){return{'name':_0x3653b3[_0xc1f6('0x3a')],'type':_0x3653b3['type']['key']};});_0x40290d['model']=_['map'](_0xd56139,_0xc1f6('0x2f'));_0x40290d['query']=_['keys'](_0x1f0b76[_0xc1f6('0x3b')]);_0x40290d[_0xc1f6('0x3c')]=_[_0xc1f6('0x3d')](_0x40290d[_0xc1f6('0x3e')],_0x40290d[_0xc1f6('0x3b')]);_0x3248ff[_0xc1f6('0x3f')]=_[_0xc1f6('0x3d')](_0x40290d[_0xc1f6('0x3e')],qs[_0xc1f6('0x40')](_0x1f0b76[_0xc1f6('0x3b')][_0xc1f6('0x40')]));_0x3248ff[_0xc1f6('0x3f')]=_0x3248ff[_0xc1f6('0x3f')][_0xc1f6('0x41')]?_0x3248ff[_0xc1f6('0x3f')]:_0x40290d[_0xc1f6('0x3e')];if(!_0x1f0b76[_0xc1f6('0x3b')][_0xc1f6('0x42')](_0xc1f6('0x43'))){_0x3248ff[_0xc1f6('0x27')]=qs[_0xc1f6('0x27')](_0x1f0b76['query'][_0xc1f6('0x27')]);_0x3248ff[_0xc1f6('0x24')]=qs[_0xc1f6('0x24')](_0x1f0b76[_0xc1f6('0x3b')][_0xc1f6('0x24')]);}_0x3248ff[_0xc1f6('0x44')]=qs[_0xc1f6('0x45')](_0x1f0b76[_0xc1f6('0x3b')][_0xc1f6('0x45')]);_0x3248ff[_0xc1f6('0x46')]=qs[_0xc1f6('0x3c')](_[_0xc1f6('0x47')](_0x1f0b76[_0xc1f6('0x3b')],_0x40290d['filters']),_0xd56139);var _0x2254c0=[];var _0x2b9edd=squel[_0xc1f6('0x48')]()[_0xc1f6('0x49')]('id')[_0xc1f6('0x49')](_0xc1f6('0x2f'))[_0xc1f6('0x49')](_0xc1f6('0x4a'))[_0xc1f6('0x4b')](_0xc1f6('0x4c'));var _0x585452=squel['select']()[_0xc1f6('0x49')](_0xc1f6('0x4d'))[_0xc1f6('0x49')](_0xc1f6('0x4e'))[_0xc1f6('0x49')]('ui.FaxInteractionId')[_0xc1f6('0x4b')](_0xc1f6('0x4f'),'ui')[_0xc1f6('0x50')](_0xc1f6('0x51'),'u',_0xc1f6('0x52'));var _0xb51db6=squel[_0xc1f6('0x48')]()[_0xc1f6('0x4b')](_0xc1f6('0x53'),'i')[_0xc1f6('0x50')](_0xc1f6('0x54'),'c',_0xc1f6('0x55'))[_0xc1f6('0x50')](_0xc1f6('0x51'),'o','o.id\x20=\x20i.UserId')[_0xc1f6('0x50')](_0xc1f6('0x56'),'a','a.id\x20=\x20i.FaxAccountId')[_0xc1f6('0x50')](_0xc1f6('0x57'),'me',_0xc1f6('0x58'))[_0xc1f6('0x50')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0xc1f6('0x50')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1f9885=squel[_0xc1f6('0x59')]();var _0x256771=[];var _0x2292e7=squel[_0xc1f6('0x59')]();var _0x48d1dc;if(_0x1f0b76[_0xc1f6('0x3b')][_0xc1f6('0x5a')]){_0x48d1dc=as[_0xc1f6('0x5b')](_0x1f0b76[_0xc1f6('0x3b')][_0xc1f6('0x5a')]);var _0x48ea45=_0x48d1dc[_0xc1f6('0x5c')];for(var _0x4101ec=0x0;_0x4101ec<_0x48d1dc['conditions'][_0xc1f6('0x41')];_0x4101ec++){var _0x24047e=_0x48d1dc[_0xc1f6('0x5d')][_0x4101ec];var _0x2f5bc7='i';var _0x2d4a41=_[_0xc1f6('0x5e')](_0xd56139,[_0xc1f6('0x2f'),_0x24047e[_0xc1f6('0x49')]]);if(!_0x2d4a41){switch(_0x24047e['field']){case _0xc1f6('0x5f'):if(_0x24047e[_0xc1f6('0x60')]==0x1){_0xb51db6[_0xc1f6('0x61')]('`'+_0x24047e[_0xc1f6('0x49')]+_0xc1f6('0x62'));}else{_0xb51db6[_0xc1f6('0x61')]('`'+_0x24047e[_0xc1f6('0x49')]+'`\x20>\x200');}break;case _0xc1f6('0x63'):if(_0x24047e[_0xc1f6('0x64')]==='$substring'){if(_0x24047e[_0xc1f6('0x60')][_0xc1f6('0x65')]('\x20')[_0xc1f6('0x41')]>0x1){_0x1f9885[_0x48ea45](_0xc1f6('0x66'),qs[_0xc1f6('0x67')](_0x24047e[_0xc1f6('0x60')]),null);}else{var _0x20bab2='%'+_0x24047e[_0xc1f6('0x60')]+'%';_0x1f9885[_0x48ea45](_0xc1f6('0x68'),_0x20bab2,_0x20bab2,_0x20bab2);}}else{_0x2d4a41=_[_0xc1f6('0x5e')](_0xd56139,[_0xc1f6('0x2f'),'ContactId']);_0x24047e[_0xc1f6('0x49')]=_0xc1f6('0x69');_0x2b364e=as['buildExpression'](_0x2f5bc7,_0x2d4a41[_0xc1f6('0x6a')],_0x24047e);_0x1f9885[_0x48ea45](_0x2b364e[_0xc1f6('0x6b')],_0x2b364e[_0xc1f6('0x60')]['start'],_0x2b364e[_0xc1f6('0x60')][_0xc1f6('0x21')]);}break;case'Tag':var _0x2dce40=_0x24047e[_0xc1f6('0x60')][_0xc1f6('0x65')](',')[_0xc1f6('0x31')](function(_0x565b82){return Number(_0x565b82);});_0x2dce40[_0xc1f6('0x35')](function(_0x3d5f1e){_0x2292e7['or'](_0xc1f6('0x6c'),'%,'+_0x3d5f1e+',%');});_0x256771=_['union'](_0x256771,_0x2dce40);break;case'User':if(_0x24047e[_0xc1f6('0x64')]==='$substring'){_0x1f9885[_0x48ea45](_0xc1f6('0x6d'),'%'+_0x24047e[_0xc1f6('0x60')]+'%',null);}else{_0x2d4a41=_[_0xc1f6('0x5e')](_0xd56139,[_0xc1f6('0x2f'),_0xc1f6('0x6e')]);_0x24047e[_0xc1f6('0x49')]='UserId';_0x2b364e=as['buildExpression'](_0x2f5bc7,_0x2d4a41['type'],_0x24047e);_0x1f9885[_0x48ea45](_0x2b364e['text'],_0x2b364e['value'][_0xc1f6('0x6f')],_0x2b364e['value'][_0xc1f6('0x21')]);}break;case _0xc1f6('0x70'):_0x2b364e=as['buildExpression']('me',null,_0x24047e);_0x1f9885[_0x48ea45](_0x2b364e[_0xc1f6('0x6b')],_0x2b364e[_0xc1f6('0x60')][_0xc1f6('0x6f')],_0x2b364e[_0xc1f6('0x60')]['end']);break;}}else{var _0x2b364e=as[_0xc1f6('0x71')](_0x2f5bc7,_0x2d4a41[_0xc1f6('0x6a')],_0x24047e);_0x1f9885[_0x48ea45](_0x2b364e[_0xc1f6('0x6b')],_0x2b364e['value'][_0xc1f6('0x6f')],_0x2b364e[_0xc1f6('0x60')][_0xc1f6('0x21')]);}}}else{var _0x35e81c=_(_0x1f0b76[_0xc1f6('0x3b')])[_0xc1f6('0x72')]()[_0xc1f6('0x31')](function(_0x38ad08){return _[_0xc1f6('0x73')](_0xd56139,[_0xc1f6('0x2f'),_0x38ad08])?_0x38ad08:undefined;})['compact']()[_0xc1f6('0x60')]();if(!_[_0xc1f6('0x74')](_0x35e81c)){_0x35e81c['forEach'](function(_0x4d6dcd){if(_0x4d6dcd===_0xc1f6('0x75')){_0xb51db6['where'](_0xc1f6('0x76'),[][_0xc1f6('0x77')](_0x1f0b76[_0xc1f6('0x3b')][_0x4d6dcd]));}else if(_0x4d6dcd==='createdAt'){var _0x18247e=JSON[_0xc1f6('0x78')](_0x1f0b76[_0xc1f6('0x3b')][_0x4d6dcd])['$gte'];var _0x252e32=JSON[_0xc1f6('0x78')](_0x1f0b76[_0xc1f6('0x3b')][_0x4d6dcd])[_0xc1f6('0x79')];_0xb51db6[_0xc1f6('0x46')](_0xc1f6('0x7a'),_0x18247e,_0x252e32);}else{if(_0x1f0b76[_0xc1f6('0x3b')][_0x4d6dcd]===_0xc1f6('0x7b')){_0xb51db6[_0xc1f6('0x46')]('i.'+_0x4d6dcd+_0xc1f6('0x7c'));}else{_0xb51db6[_0xc1f6('0x46')]('i.'+_0x4d6dcd+'\x20=\x20?',_0x1f0b76[_0xc1f6('0x3b')][_0x4d6dcd]);}}});}if(_0x1f0b76[_0xc1f6('0x3b')][_0xc1f6('0x7d')]){if(_0x1f0b76[_0xc1f6('0x3b')]['read']==0x1){_0xb51db6[_0xc1f6('0x61')](_0xc1f6('0x7e'));}else{_0xb51db6['having'](_0xc1f6('0x7f'));}}if(_0x1f0b76[_0xc1f6('0x3b')][_0xc1f6('0x80')]){_0x256771=_[_0xc1f6('0x81')](_0x1f0b76[_0xc1f6('0x3b')][_0xc1f6('0x80')])?_0x1f0b76[_0xc1f6('0x3b')][_0xc1f6('0x80')]:new Array(_0x1f0b76['query'][_0xc1f6('0x80')]);_0x256771[_0xc1f6('0x35')](function(_0x3511bd){_0x2292e7['or'](_0xc1f6('0x6c'),'%,'+_0x3511bd+',%');});}if(_0x1f0b76[_0xc1f6('0x3b')]['filter']){var _0x3e9795=_0x1f0b76[_0xc1f6('0x3b')]['filter'][_0xc1f6('0x82')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc1f6('0x83')](_0x3e9795)){_0x1f9885['or'](_0xc1f6('0x84'),_0x3e9795+'%')['or'](_0xc1f6('0x85'),_0x3e9795+'%');}_0x1f9885['or'](_0xc1f6('0x86'),_0x3e9795+'%');}}_0xb51db6[_0xc1f6('0x46')](_0x1f9885);_0xb51db6[_0xc1f6('0x87')](_0xc1f6('0x88'));var _0x485378={'type':db['Sequelize'][_0xc1f6('0x89')][_0xc1f6('0x8a')],'raw':!![]};var _0x2cee8d=_0xb51db6[_0xc1f6('0x8b')]();_0x2cee8d[_0xc1f6('0x49')]('i.id');_0x2cee8d['field'](_0xc1f6('0x8c'),_0xc1f6('0x5f'));if(_0x3248ff[_0xc1f6('0x44')]){_0x3248ff['order'][_0xc1f6('0x35')](function(_0x301d23){var _0x1cca0c=_0x301d23[0x0]===_0xc1f6('0x8d')?_0x301d23[0x0]:'i.'+_0x301d23[0x0];_0xb51db6[_0xc1f6('0x44')](_0x1cca0c,_0x301d23[0x1]===_0xc1f6('0x8e')?![]:!![]);});}if(!_[_0xc1f6('0x74')](_0x256771)){_0xb51db6['having'](_0x2292e7);_0x2cee8d[_0xc1f6('0x46')](_0xc1f6('0x8f'),_0x256771);}BPromise['resolve']()[_0xc1f6('0x2d')](function(){if(!_0x48d1dc){if(_0x1f0b76['query'][_0xc1f6('0x75')])return;_0x2cee8d['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0xb51db6['where'](_0xc1f6('0x90'));return;}if(_0x1f0b76[_0xc1f6('0x91')][_0xc1f6('0x92')]!==_0xc1f6('0x93'))return;return _0x1f0b76[_0xc1f6('0x91')][_0xc1f6('0x94')]({'attributes':['id'],'raw':!![]})[_0xc1f6('0x2d')](function(_0xcc922e){if(_[_0xc1f6('0x74')](_0xcc922e)){_0x2cee8d[_0xc1f6('0x46')]('i.FaxAccountId\x20IS\x20NULL');_0xb51db6[_0xc1f6('0x46')](_0xc1f6('0x95'));}else{_0x2cee8d[_0xc1f6('0x46')]('i.FaxAccountId\x20IN\x20?',_[_0xc1f6('0x31')](_0xcc922e,'id'));_0xb51db6[_0xc1f6('0x46')](_0xc1f6('0x76'),_[_0xc1f6('0x31')](_0xcc922e,'id'));}});})[_0xc1f6('0x2d')](function(){if(_0x1f0b76[_0xc1f6('0x91')][_0xc1f6('0x92')]===_0xc1f6('0x93')&&!_0x48d1dc&&!_0x1f0b76[_0xc1f6('0x3b')][_0xc1f6('0x75')])return[];return db[_0xc1f6('0x96')][_0xc1f6('0x3b')](_0x2cee8d[_0xc1f6('0x97')](),_0x485378);})[_0xc1f6('0x2d')](function(_0x282985){_0x170a37[_0xc1f6('0x26')]=_0x282985[_0xc1f6('0x41')];if(_0x170a37[_0xc1f6('0x26')]===0x0)return[];return db[_0xc1f6('0x96')][_0xc1f6('0x3b')](_0x2b9edd[_0xc1f6('0x97')](),_0x485378)[_0xc1f6('0x2d')](function(_0x24adee){_0x2254c0=_[_0xc1f6('0x98')](_0x24adee,'id');_0x485378=_[_0xc1f6('0x99')](_0x485378,{'model':db[_0xc1f6('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f0b76[_0xc1f6('0x3b')][_0xc1f6('0x40')]){_0x3248ff[_0xc1f6('0x3f')][_0xc1f6('0x35')](function(_0x3daa2d){_0xb51db6[_0xc1f6('0x49')]('i.'+_0x3daa2d);});}else{_0xb51db6[_0xc1f6('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc1f6('0x5f'));_0xb51db6[_0xc1f6('0x49')](_0xc1f6('0x9a'),_0xc1f6('0x9b'));_0xb51db6[_0xc1f6('0x49')](_0xc1f6('0x9c'),_0xc1f6('0x9d'));_0xb51db6['field'](_0xc1f6('0x9e'),_0xc1f6('0x8d'));_0xb51db6[_0xc1f6('0x49')](_0xc1f6('0x9f'));_0xb51db6[_0xc1f6('0x49')]('c.firstName',_0xc1f6('0xa0'));_0xb51db6[_0xc1f6('0x49')](_0xc1f6('0xa1'),_0xc1f6('0xa2'));_0xb51db6[_0xc1f6('0x49')]('c.email',_0xc1f6('0xa3'));_0xb51db6[_0xc1f6('0x49')](_0xc1f6('0xa4'),_0xc1f6('0xa5'));_0xb51db6['field'](_0xc1f6('0xa6'),'Contact.mobile');_0xb51db6[_0xc1f6('0x49')](_0xc1f6('0xa7'),_0xc1f6('0xa8'));_0xb51db6[_0xc1f6('0x49')](_0xc1f6('0xa9'),_0xc1f6('0xaa'));_0xb51db6[_0xc1f6('0x49')](_0xc1f6('0xab'),_0xc1f6('0xac'));_0xb51db6['field'](_0xc1f6('0xad'),_0xc1f6('0x34'));}if(_0x3248ff[_0xc1f6('0x27')])_0xb51db6[_0xc1f6('0x27')](_0x3248ff[_0xc1f6('0x27')]);if(_0x3248ff[_0xc1f6('0x24')])_0xb51db6['offset'](_0x3248ff[_0xc1f6('0x24')]);return db[_0xc1f6('0x96')][_0xc1f6('0x3b')](_0xb51db6[_0xc1f6('0x97')](),_0x485378);})[_0xc1f6('0x2d')](function(_0x5162bd){if(_0x5162bd[_0xc1f6('0x41')]>0x0)_0x585452['where'](_0xc1f6('0xae'),_['map'](_0x5162bd,'id'));return db[_0xc1f6('0x96')][_0xc1f6('0x3b')](_0x585452[_0xc1f6('0x97')](),_0x485378)[_0xc1f6('0x2d')](function(_0x35b687){var _0x5321c7=_[_0xc1f6('0xaf')](_0x35b687,'FaxInteractionId');var _0x195c0e=[];_0x5162bd['forEach'](function(_0x5dff76){_0x195c0e[_0xc1f6('0x36')](updateFaxInteraction(_0x5dff76,_0x2254c0,_0x5321c7));});return BPromise[_0xc1f6('0xb0')](_0x195c0e);});});})[_0xc1f6('0x2d')](function(_0x45a4c4){_0x170a37[_0xc1f6('0xb1')]=_0x45a4c4;return _0x170a37;})[_0xc1f6('0x2d')](respondWithFilteredResult(_0x16d1ab,_0x3248ff))['catch'](handleError(_0x16d1ab,null));};exports[_0xc1f6('0xb2')]=function(_0x144cff,_0x4d5bab){var _0x133137={'raw':![],'where':{'id':_0x144cff[_0xc1f6('0xb3')]['id']}},_0x404152={};_0x404152['model']=_[_0xc1f6('0x72')](db[_0xc1f6('0x39')][_0xc1f6('0xb4')]);_0x404152[_0xc1f6('0x3b')]=_[_0xc1f6('0x72')](_0x144cff[_0xc1f6('0x3b')]);_0x404152[_0xc1f6('0x3c')]=_[_0xc1f6('0x3d')](_0x404152[_0xc1f6('0x3e')],_0x404152[_0xc1f6('0x3b')]);_0x133137[_0xc1f6('0x3f')]=_['intersection'](_0x404152[_0xc1f6('0x3e')],qs[_0xc1f6('0x40')](_0x144cff[_0xc1f6('0x3b')]['fields']));_0x133137[_0xc1f6('0x3f')]=_0x133137[_0xc1f6('0x3f')][_0xc1f6('0x41')]?_0x133137[_0xc1f6('0x3f')]:_0x404152['model'];if(_0x144cff['query'][_0xc1f6('0xb5')]){_0x133137[_0xc1f6('0xb6')]=[{'all':!![]}];}_0x133137=_[_0xc1f6('0x99')]({},_0x133137,_0x144cff[_0xc1f6('0xb7')]);return db['FaxInteraction'][_0xc1f6('0x5e')](_0x133137)[_0xc1f6('0x2d')](handleEntityNotFound(_0x4d5bab,null))[_0xc1f6('0x2d')](respondWithResult(_0x4d5bab,null))[_0xc1f6('0x37')](handleError(_0x4d5bab,null));};exports[_0xc1f6('0xb8')]=function(_0x1d2321,_0x340426){return db[_0xc1f6('0x39')][_0xc1f6('0xb8')](_0x1d2321[_0xc1f6('0x70')],{})['then'](respondWithResult(_0x340426,0xc9))[_0xc1f6('0x37')](handleError(_0x340426,null));};exports[_0xc1f6('0xb9')]=function(_0x1e7832,_0x37cf82){if(_0x1e7832[_0xc1f6('0x70')]['id']){delete _0x1e7832[_0xc1f6('0x70')]['id'];}return db[_0xc1f6('0x39')][_0xc1f6('0x5e')]({'where':{'id':_0x1e7832['params']['id']}})['then'](handleEntityNotFound(_0x37cf82,null))[_0xc1f6('0x2d')](saveUpdates(_0x1e7832[_0xc1f6('0x70')],null))[_0xc1f6('0x2d')](respondWithResult(_0x37cf82,null))[_0xc1f6('0x37')](handleError(_0x37cf82,null));};exports[_0xc1f6('0x2c')]=function(_0x3fff98,_0x8f5cf3){return db[_0xc1f6('0x39')][_0xc1f6('0x5e')]({'where':{'id':_0x3fff98[_0xc1f6('0xb3')]['id']}})[_0xc1f6('0x2d')](handleEntityNotFound(_0x8f5cf3,null))['then'](removeEntity(_0x8f5cf3,null))[_0xc1f6('0x37')](handleError(_0x8f5cf3,null));};exports['describe']=function(_0x1c0915,_0x3f82b1){return db['FaxInteraction']['describe']()['then'](respondWithResult(_0x3f82b1,null))[_0xc1f6('0x37')](handleError(_0x3f82b1,null));};exports[_0xc1f6('0xba')]=function(_0x1586ec,_0x2fbb04,_0x5f3afa){return db[_0xc1f6('0xbb')][_0xc1f6('0x5e')]({'where':{'id':_0x1586ec[_0xc1f6('0xb3')]['id']}})[_0xc1f6('0x2d')](handleEntityNotFound(_0x2fbb04,null))[_0xc1f6('0x2d')](function(_0xc774a5){if(_0xc774a5){return _0xc774a5['addMessage'](_0x1586ec[_0xc1f6('0x70')][_0xc1f6('0xbc')],_['omit'](_0x1586ec[_0xc1f6('0x70')],['ids','id'])||{});}})[_0xc1f6('0x2d')](respondWithResult(_0x2fbb04,null))[_0xc1f6('0x37')](handleError(_0x2fbb04,null));};exports[_0xc1f6('0xbd')]=function(_0x197397,_0x5d2185,_0xcc35c2){var _0xb5627f={'raw':![],'where':{}};var _0x5340f4={};var _0x3e6583={'count':0x0,'rows':[]};return db[_0xc1f6('0x39')][_0xc1f6('0xbe')]({'where':{'id':_0x197397[_0xc1f6('0xb3')]['id']}})['then'](handleEntityNotFound(_0x5d2185,null))['then'](function(_0x5888aa){if(_0x5888aa){_0x5340f4[_0xc1f6('0x3e')]=_[_0xc1f6('0x72')](db[_0xc1f6('0xbb')][_0xc1f6('0xb4')]);_0x5340f4[_0xc1f6('0x3b')]=_[_0xc1f6('0x72')](_0x197397[_0xc1f6('0x3b')]);_0x5340f4[_0xc1f6('0x3c')]=_[_0xc1f6('0x3d')](_0x5340f4[_0xc1f6('0x3e')],_0x5340f4[_0xc1f6('0x3b')]);_0xb5627f[_0xc1f6('0x3f')]=_[_0xc1f6('0x3d')](_0x5340f4['model'],qs[_0xc1f6('0x40')](_0x197397[_0xc1f6('0x3b')]['fields']));_0xb5627f['attributes']=_0xb5627f['attributes']['length']?_0xb5627f[_0xc1f6('0x3f')]:_0x5340f4[_0xc1f6('0x3e')];if(!_0x197397[_0xc1f6('0x3b')][_0xc1f6('0x42')](_0xc1f6('0x43'))){_0xb5627f[_0xc1f6('0x27')]=qs[_0xc1f6('0x27')](_0x197397[_0xc1f6('0x3b')][_0xc1f6('0x27')]);_0xb5627f['offset']=qs[_0xc1f6('0x24')](_0x197397[_0xc1f6('0x3b')]['offset']);}_0xb5627f[_0xc1f6('0x44')]=qs[_0xc1f6('0x45')](_0x197397['query']['sort']);_0xb5627f['where']=qs[_0xc1f6('0x3c')](_[_0xc1f6('0x47')](_0x197397[_0xc1f6('0x3b')],_0x5340f4[_0xc1f6('0x3c')]));_0xb5627f[_0xc1f6('0x46')][_0xc1f6('0xbf')]=_0x5888aa['id'];if(_0x197397[_0xc1f6('0x3b')][_0xc1f6('0xc0')]){_0xb5627f['where']=_[_0xc1f6('0x99')](_0xb5627f[_0xc1f6('0x46')],{'$or':_[_0xc1f6('0x31')](_0xb5627f['attributes'],function(_0x1df263){var _0x3dc2a6={};_0x3dc2a6[_0x1df263]={'$like':'%'+_0x197397[_0xc1f6('0x3b')][_0xc1f6('0xc0')]+'%'};return _0x3dc2a6;})});}if(_0x197397['query'][_0xc1f6('0xc1')]){var _0x13ac01=_0x197397['query'][_0xc1f6('0xc1')][_0xc1f6('0x65')](',');var _0x468dbb={};_0x468dbb[_0x13ac01[0x0]]={'$gte':moment(_0x13ac01[0x1])[_0xc1f6('0xc2')](_0xc1f6('0xc3'))};_0xb5627f[_0xc1f6('0x46')]=_[_0xc1f6('0x99')](_0xb5627f[_0xc1f6('0x46')],_0x468dbb);}_0xb5627f=_[_0xc1f6('0x99')]({},_0xb5627f,_0x197397[_0xc1f6('0xb7')]);return db['FaxMessage'][_0xc1f6('0x26')]({'where':_0xb5627f['where']})[_0xc1f6('0x2d')](function(_0x5a6ef2){_0x3e6583['count']=_0x5a6ef2;if(_0x197397['query'][_0xc1f6('0xb5')]){_0xb5627f[_0xc1f6('0xb6')]=[{'all':!![]}];}return db[_0xc1f6('0xbb')][_0xc1f6('0xc4')](_0xb5627f);})['then'](function(_0x54a70c){_0x3e6583[_0xc1f6('0xb1')]=_0x54a70c;return _0x3e6583;});}})['then'](respondWithFilteredResult(_0x5d2185,_0xb5627f))[_0xc1f6('0x37')](handleError(_0x5d2185,null));};exports['addTags']=function(_0x325e67,_0x3bea18,_0x221f45){return db[_0xc1f6('0x39')][_0xc1f6('0x5e')]({'where':{'id':_0x325e67['params']['id']}})[_0xc1f6('0x2d')](handleEntityNotFound(_0x3bea18,null))[_0xc1f6('0x2d')](function(_0x6877a0){if(_0x6877a0){return _0x6877a0[_0xc1f6('0xc5')](_0x325e67[_0xc1f6('0x70')][_0xc1f6('0xbc')],_[_0xc1f6('0xc6')](_0x325e67[_0xc1f6('0x70')],[_0xc1f6('0xbc'),'id'])||{})['spread'](function(){return db[_0xc1f6('0xc7')][_0xc1f6('0xc4')]({'attributes':['id',_0xc1f6('0x2f'),_0xc1f6('0x4a')],'where':{'id':_0x325e67['body'][_0xc1f6('0xbc')]}});})['then'](function(_0x1eb5e4){socket[_0xc1f6('0xc8')](_0xc1f6('0xc9'),{'id':Number(_0x325e67['params']['id']),'tags':_0x1eb5e4||[]});return{'id':Number(_0x325e67[_0xc1f6('0xb3')]['id']),'tags':_0x1eb5e4||[]};});}})[_0xc1f6('0x2d')](respondWithResult(_0x3bea18,null))[_0xc1f6('0x37')](handleError(_0x3bea18,null));};exports[_0xc1f6('0xca')]=function(_0x525146,_0x1ba40f,_0x357386){return db['FaxInteraction'][_0xc1f6('0x5e')]({'where':{'id':_0x525146['params']['id']}})[_0xc1f6('0x2d')](handleEntityNotFound(_0x1ba40f,null))[_0xc1f6('0x2d')](function(_0x10ef5c){if(_0x10ef5c){return _0x10ef5c[_0xc1f6('0xca')](_0x525146[_0xc1f6('0x3b')]['ids']);}})[_0xc1f6('0x2d')](respondWithStatusCode(_0x1ba40f,null))['catch'](handleError(_0x1ba40f,null));};exports[_0xc1f6('0xcb')]=function(_0x2a6a47,_0x4808b2){var _0xe56c71=moment()['unix']()[_0xc1f6('0x97')]();var _0x18f81f=path[_0xc1f6('0xcc')](config[_0xc1f6('0xcd')],_0xc1f6('0xce'),_0xc1f6('0xcf'),_0xc1f6('0xd0'));var _0x38c340=path[_0xc1f6('0xcc')](config[_0xc1f6('0xcd')],_0xc1f6('0xce'),'files','attachments');var _0x12347f=path['join'](_0x18f81f,_0xe56c71);var _0x232f14=util[_0xc1f6('0xc2')](_0xc1f6('0xd1'),_0x2a6a47[_0xc1f6('0xb3')]['id'],_0xe56c71);var _0x453ffd=path[_0xc1f6('0xcc')](_0x18f81f,_0x232f14);var _0x2a76dd=[];_0x2a76dd[_0xc1f6('0x36')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x1605c4=[{'model':db[_0xc1f6('0xbb')],'as':_0xc1f6('0xd2'),'attributes':['id',_0xc1f6('0x70'),'createdAt'],'include':_0x2a76dd}];return db[_0xc1f6('0x39')][_0xc1f6('0x5e')]({'where':{'id':_0x2a6a47[_0xc1f6('0xb3')]['id']},'include':_0x1605c4})[_0xc1f6('0x2d')](handleEntityNotFound(_0x4808b2,null))[_0xc1f6('0x2d')](function(_0x1ecebc){if(_0x1ecebc&&_0x1ecebc['Messages']){var _0x1d1adf=_0x1ecebc['get']({'plain':!![]});fs[_0xc1f6('0xd3')](_0x12347f);for(var _0x5016e1=0x0;_0x5016e1<_0x1d1adf[_0xc1f6('0xd2')][_0xc1f6('0x41')];_0x5016e1++){var _0xb3b844=_0x1d1adf[_0xc1f6('0xd2')][_0x5016e1][_0xc1f6('0xd4')];if(_0xb3b844){var _0x49c999=path['join'](_0x38c340,_0xb3b844[_0xc1f6('0xd5')]);if(fs['existsSync'](_0x49c999)){fs[_0xc1f6('0xd6')](_0x49c999)[_0xc1f6('0xd7')](fs[_0xc1f6('0xd8')](path[_0xc1f6('0xcc')](_0x12347f,_0xb3b844[_0xc1f6('0xd5')])));}}}return BPromise[_0xc1f6('0xd9')]()[_0xc1f6('0x2d')](function(){return new BPromise(function(_0x32647b,_0x44c7be){zipdir(_0x12347f,{'saveTo':_0x453ffd},function(_0x1149a6,_0x388e30){if(_0x1149a6)return _0x44c7be(_0x1149a6);return _0x32647b(_0x388e30);});})[_0xc1f6('0x2d')](function(){return new BPromise(function(_0x2a644d,_0xe9bbae){rimraf(_0x12347f,function(_0x2c21cb){if(_0x2c21cb)_0xe9bbae(_0x2c21cb);return _0x2a644d();});});})[_0xc1f6('0x2d')](function(){return _0x4808b2[_0xc1f6('0xcb')](_0x453ffd,_0x232f14,function(_0x594003){if(_0x594003){console[_0xc1f6('0xda')]('err',_0x594003);}else{fs['unlinkSync'](_0x453ffd);}});});});}else{return _0x4808b2[_0xc1f6('0x20')](0xc8);}})['catch'](handleError(_0x4808b2,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 48d3dc7..4bf5931 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 _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x519c1b,_0x51a665){var _0x5b3431=function(_0x397e52){while(--_0x397e52){_0x519c1b['push'](_0x519c1b['shift']());}};_0x5b3431(++_0x51a665);}(_0x326f,0xd1));var _0xf326=function(_0x3e6f90,_0xd8cde5){_0x3e6f90=_0x3e6f90-0x0;var _0x366f6d=_0x326f[_0x3e6f90];return _0x366f6d;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0xa1018b,_0x44feeb){var _0x1c1241=function(_0x22aeda){while(--_0x22aeda){_0xa1018b['push'](_0xa1018b['shift']());}};_0x1c1241(++_0x44feeb);}(_0x1261,0x144));var _0x1126=function(_0x3ce6d2,_0x90364d){_0x3ce6d2=_0x3ce6d2-0x0;var _0x4c1dd4=_0x1261[_0x3ce6d2];return _0x4c1dd4;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 6637f4b..875edc2 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 _0xe4e1=['api','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x2886e2,_0x95fe23){var _0x267ec6=function(_0x539da4){while(--_0x539da4){_0x2886e2['push'](_0x2886e2['shift']());}};_0x267ec6(++_0x95fe23);}(_0xe4e1,0x74));var _0x1e4e=function(_0x33100c,_0x29e414){_0x33100c=_0x33100c-0x0;var _0x3e321c=_0xe4e1[_0x33100c];return _0x3e321c;};'use strict';var _=require(_0x1e4e('0x0'));var util=require(_0x1e4e('0x1'));var logger=require(_0x1e4e('0x2'))(_0x1e4e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1e4e('0x4'));var fs=require('fs');var path=require(_0x1e4e('0x5'));var rimraf=require(_0x1e4e('0x6'));var config=require(_0x1e4e('0x7'));var attributes=require(_0x1e4e('0x8'));module[_0x1e4e('0x9')]=function(_0x3f0e39,_0x2c668d){return _0x3f0e39[_0x1e4e('0xa')](_0x1e4e('0xb'),attributes,{'tableName':_0x1e4e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3345a0,_0x1a25df,_0x3a9e91){if(_0x3345a0[_0x1e4e('0xd')]('closed')){_0x3345a0[_0x1e4e('0xe')]=moment()[_0x1e4e('0xf')](_0x1e4e('0x10'));}_0x3a9e91(null,_0x3345a0);}}});}; \ No newline at end of file +var _0xacf7=['exports','define','fax_interactions','changed','closed','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xacf7,0x94));var _0x7acf=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xacf7[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x7acf('0x0'));var util=require(_0x7acf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7acf('0x2'));var BPromise=require('bluebird');var rp=require(_0x7acf('0x3'));var fs=require('fs');var path=require(_0x7acf('0x4'));var rimraf=require(_0x7acf('0x5'));var config=require(_0x7acf('0x6'));var attributes=require(_0x7acf('0x7'));module[_0x7acf('0x8')]=function(_0x19b8e5,_0x348763){return _0x19b8e5[_0x7acf('0x9')]('FaxInteraction',attributes,{'tableName':_0x7acf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f9b50,_0x4f7652,_0x29eb8d){if(_0x1f9b50[_0x7acf('0xb')](_0x7acf('0xc'))){_0x1f9b50['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x29eb8d(null,_0x1f9b50);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index b781010..c392060 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 _0xb8c0=['register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','./faxInteraction.socket'];(function(_0x29c728,_0x5aed0d){var _0x17be77=function(_0x2d9715){while(--_0x2d9715){_0x29c728['push'](_0x29c728['shift']());}};_0x17be77(++_0x5aed0d);}(_0xb8c0,0x184));var _0x0b8c=function(_0x3a8cb4,_0x3a6095){_0x3a8cb4=_0x3a8cb4-0x0;var _0x433455=_0xb8c0[_0x3a8cb4];return _0x433455;};'use strict';var _=require(_0x0b8c('0x0'));var util=require(_0x0b8c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0b8c('0x2'));var fs=require('fs');var Redis=require(_0x0b8c('0x3'));var db=require(_0x0b8c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0b8c('0x5'));var config=require(_0x0b8c('0x6'));var jayson=require(_0x0b8c('0x7'));var client=jayson[_0x0b8c('0x8')][_0x0b8c('0x9')]({'port':0x232a});config[_0x0b8c('0xa')]=_['defaults'](config[_0x0b8c('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0b8c('0xa')]));require(_0x0b8c('0xb'))[_0x0b8c('0xc')](socket);function respondWithRpcPromise(_0x23f80a,_0x518d8,_0x4396ba){return new BPromise(function(_0x20c021,_0x44a817){return client['request'](_0x23f80a,_0x4396ba)[_0x0b8c('0xd')](function(_0x2ffc31){logger[_0x0b8c('0xe')](_0x0b8c('0xf'),_0x518d8,_0x0b8c('0x10'));logger[_0x0b8c('0x11')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x518d8,_0x0b8c('0x10'),JSON[_0x0b8c('0x12')](_0x2ffc31));if(_0x2ffc31['error']){if(_0x2ffc31[_0x0b8c('0x13')][_0x0b8c('0x14')]===0x1f4){logger[_0x0b8c('0x13')](_0x0b8c('0xf'),_0x518d8,_0x2ffc31[_0x0b8c('0x13')][_0x0b8c('0x15')]);return _0x44a817(_0x2ffc31['error'][_0x0b8c('0x15')]);}logger['error'](_0x0b8c('0xf'),_0x518d8,_0x2ffc31[_0x0b8c('0x13')][_0x0b8c('0x15')]);return _0x20c021(_0x2ffc31[_0x0b8c('0x13')][_0x0b8c('0x15')]);}else{logger[_0x0b8c('0xe')](_0x0b8c('0xf'),_0x518d8,_0x0b8c('0x10'));_0x20c021(_0x2ffc31[_0x0b8c('0x16')][_0x0b8c('0x15')]);}})[_0x0b8c('0x17')](function(_0xb16bbb){logger[_0x0b8c('0x13')](_0x0b8c('0xf'),_0x518d8,_0xb16bbb);_0x44a817(_0xb16bbb);});});}exports[_0x0b8c('0x18')]=function(_0x5148ee){var _0x50e209=this;return new Promise(function(_0x292beb,_0x2b6bdf){return db['FaxInteraction'][_0x0b8c('0x19')](_0x5148ee[_0x0b8c('0x1a')],{'raw':_0x5148ee[_0x0b8c('0x1b')]?_0x5148ee['options'][_0x0b8c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5148ee[_0x0b8c('0x1b')]?_0x5148ee['options'][_0x0b8c('0x1d')]||null:null,'attributes':_0x5148ee[_0x0b8c('0x1b')]?_0x5148ee[_0x0b8c('0x1b')][_0x0b8c('0x1e')]||null:null,'limit':_0x5148ee[_0x0b8c('0x1b')]?_0x5148ee['options'][_0x0b8c('0x1f')]||null:null})[_0x0b8c('0xd')](function(_0x1ebb2d){logger[_0x0b8c('0xe')](_0x0b8c('0x18'),_0x5148ee);logger['debug'](_0x0b8c('0x18'),_0x5148ee,JSON[_0x0b8c('0x12')](_0x1ebb2d));_0x292beb(_0x1ebb2d);})[_0x0b8c('0x17')](function(_0x121807){logger['error']('UpdateFaxInteraction',_0x121807[_0x0b8c('0x15')],_0x5148ee);_0x2b6bdf(_0x50e209[_0x0b8c('0x13')](0x1f4,_0x121807['message']));});});};exports[_0x0b8c('0x20')]=function(_0x4e015c){return new Promise(function(_0x406ea5,_0x1368bf){return db[_0x0b8c('0x21')][_0x0b8c('0x22')]({'where':_0x4e015c[_0x0b8c('0x1b')]?_0x4e015c[_0x0b8c('0x1b')][_0x0b8c('0x1d')]||null:null})['then'](function(_0x3365cd){if(_0x3365cd){return _0x3365cd[_0x0b8c('0x23')](_0x4e015c[_0x0b8c('0x1a')]['ids'],_[_0x0b8c('0x24')](_0x4e015c[_0x0b8c('0x1a')],[_0x0b8c('0x25'),'id'])||{});}})[_0x0b8c('0x26')](function(_0x361089){logger[_0x0b8c('0xe')](_0x0b8c('0x27'),_0x4e015c);logger[_0x0b8c('0x11')]('AddTags',_0x4e015c,JSON[_0x0b8c('0x12')](_0x361089));_0x406ea5(_0x361089);})[_0x0b8c('0x17')](function(_0x547d6d){logger[_0x0b8c('0x13')](_0x0b8c('0x27'),_0x547d6d['message'],_0x4e015c);_0x1368bf(_this[_0x0b8c('0x13')](0x1f4,_0x547d6d[_0x0b8c('0x15')]));});});}; \ No newline at end of file +var _0x423f=['localhost','./faxInteraction.socket','register','then','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','info','AddTagsToFaxInteraction','find','addTags','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis'];(function(_0x3c79c5,_0x30c6db){var _0x33ef2c=function(_0x20b6c1){while(--_0x20b6c1){_0x3c79c5['push'](_0x3c79c5['shift']());}};_0x33ef2c(++_0x30c6db);}(_0x423f,0x1bd));var _0xf423=function(_0x3012a9,_0x220e46){_0x3012a9=_0x3012a9-0x0;var _0x2d0f97=_0x423f[_0x3012a9];return _0x2d0f97;};'use strict';var _=require(_0xf423('0x0'));var util=require(_0xf423('0x1'));var moment=require(_0xf423('0x2'));var BPromise=require(_0xf423('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf423('0x4'));var db=require(_0xf423('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf423('0x6'))(_0xf423('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf423('0x8')][_0xf423('0x9')]({'port':0x232a});config[_0xf423('0xa')]=_['defaults'](config[_0xf423('0xa')],{'host':_0xf423('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf423('0xa')]));require(_0xf423('0xc'))[_0xf423('0xd')](socket);function respondWithRpcPromise(_0x20f08b,_0x57b37b,_0x27a69e){return new BPromise(function(_0x555585,_0x59189a){return client['request'](_0x20f08b,_0x27a69e)[_0xf423('0xe')](function(_0xaec84c){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x57b37b,_0xf423('0xf'));logger[_0xf423('0x10')](_0xf423('0x11'),_0x57b37b,_0xf423('0xf'),JSON[_0xf423('0x12')](_0xaec84c));if(_0xaec84c['error']){if(_0xaec84c[_0xf423('0x13')]['code']===0x1f4){logger[_0xf423('0x13')](_0xf423('0x14'),_0x57b37b,_0xaec84c[_0xf423('0x13')][_0xf423('0x15')]);return _0x59189a(_0xaec84c['error']['message']);}logger[_0xf423('0x13')](_0xf423('0x14'),_0x57b37b,_0xaec84c[_0xf423('0x13')]['message']);return _0x555585(_0xaec84c[_0xf423('0x13')][_0xf423('0x15')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x57b37b,'request\x20sent');_0x555585(_0xaec84c[_0xf423('0x16')]['message']);}})[_0xf423('0x17')](function(_0x17441b){logger[_0xf423('0x13')](_0xf423('0x14'),_0x57b37b,_0x17441b);_0x59189a(_0x17441b);});});}exports[_0xf423('0x18')]=function(_0x1b2195){var _0x1fe5f0=this;return new Promise(function(_0x4c821f,_0x295267){return db[_0xf423('0x19')][_0xf423('0x1a')](_0x1b2195[_0xf423('0x1b')],{'raw':_0x1b2195[_0xf423('0x1c')]?_0x1b2195['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b2195[_0xf423('0x1c')]?_0x1b2195[_0xf423('0x1c')][_0xf423('0x1d')]||null:null,'attributes':_0x1b2195['options']?_0x1b2195[_0xf423('0x1c')][_0xf423('0x1e')]||null:null,'limit':_0x1b2195[_0xf423('0x1c')]?_0x1b2195[_0xf423('0x1c')][_0xf423('0x1f')]||null:null})[_0xf423('0xe')](function(_0x45eb43){logger[_0xf423('0x20')](_0xf423('0x18'),_0x1b2195);logger[_0xf423('0x10')](_0xf423('0x18'),_0x1b2195,JSON[_0xf423('0x12')](_0x45eb43));_0x4c821f(_0x45eb43);})[_0xf423('0x17')](function(_0x3de5e5){logger[_0xf423('0x13')](_0xf423('0x18'),_0x3de5e5[_0xf423('0x15')],_0x1b2195);_0x295267(_0x1fe5f0[_0xf423('0x13')](0x1f4,_0x3de5e5[_0xf423('0x15')]));});});};exports[_0xf423('0x21')]=function(_0x5c8995){return new Promise(function(_0x26cc14,_0x243072){return db[_0xf423('0x19')][_0xf423('0x22')]({'where':_0x5c8995[_0xf423('0x1c')]?_0x5c8995[_0xf423('0x1c')][_0xf423('0x1d')]||null:null})[_0xf423('0xe')](function(_0x509c93){if(_0x509c93){return _0x509c93[_0xf423('0x23')](_0x5c8995[_0xf423('0x1b')]['ids'],_['omit'](_0x5c8995['body'],['ids','id'])||{});}})[_0xf423('0x24')](function(_0x57ecd4){logger[_0xf423('0x20')](_0xf423('0x25'),_0x5c8995);logger[_0xf423('0x10')]('AddTags',_0x5c8995,JSON[_0xf423('0x12')](_0x57ecd4));_0x26cc14(_0x57ecd4);})[_0xf423('0x17')](function(_0x4b89c5){logger[_0xf423('0x13')](_0xf423('0x25'),_0x4b89c5[_0xf423('0x15')],_0x5c8995);_0x243072(_this['error'](0x1f4,_0x4b89c5['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index e1d6484..b3ae82e 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 _0x87ef=['update','emit','removeListener','register','faxInteraction:','save','remove'];(function(_0x300915,_0x320ae4){var _0x5887ed=function(_0x211c35){while(--_0x211c35){_0x300915['push'](_0x300915['shift']());}};_0x5887ed(++_0x320ae4);}(_0x87ef,0x75));var _0xf87e=function(_0x257841,_0x389b4d){_0x257841=_0x257841-0x0;var _0x1b87ed=_0x87ef[_0x257841];return _0x1b87ed;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xf87e('0x0'),_0xf87e('0x1'),_0xf87e('0x2')];function createListener(_0x2c0942,_0x45a4dd){return function(_0x5bbf4c){_0x45a4dd[_0xf87e('0x3')](_0x2c0942,_0x5bbf4c);};}function removeListener(_0x14a248,_0x25119c){return function(){FaxInteractionEvents[_0xf87e('0x4')](_0x14a248,_0x25119c);};}exports[_0xf87e('0x5')]=function(_0x10567f){for(var _0x6fba6f=0x0,_0x28b3d0=events['length'];_0x6fba6f<_0x28b3d0;_0x6fba6f++){var _0x31f856=events[_0x6fba6f];var _0x106140=createListener(_0xf87e('0x6')+_0x31f856,_0x10567f);FaxInteractionEvents['on'](_0x31f856,_0x106140);}}; \ No newline at end of file +var _0xeb24=['length','faxInteraction:','./faxInteraction.events','save','remove','removeListener','register'];(function(_0x13a58f,_0x109ac6){var _0x5079b3=function(_0x40fed0){while(--_0x40fed0){_0x13a58f['push'](_0x13a58f['shift']());}};_0x5079b3(++_0x109ac6);}(_0xeb24,0x11a));var _0x4eb2=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xeb24[_0x5d2803];return _0xdcad2c;};'use strict';var FaxInteractionEvents=require(_0x4eb2('0x0'));var events=[_0x4eb2('0x1'),_0x4eb2('0x2'),'update'];function createListener(_0x55014b,_0xbc773d){return function(_0x548285){_0xbc773d['emit'](_0x55014b,_0x548285);};}function removeListener(_0x325cc3,_0x2db9cf){return function(){FaxInteractionEvents[_0x4eb2('0x3')](_0x325cc3,_0x2db9cf);};}exports[_0x4eb2('0x4')]=function(_0x3c2b02){for(var _0x296400=0x0,_0x392b5c=events[_0x4eb2('0x5')];_0x296400<_0x392b5c;_0x296400++){var _0x1de57a=events[_0x296400];var _0x11b04d=createListener(_0x4eb2('0x6')+_0x1de57a,_0x3c2b02);FaxInteractionEvents['on'](_0x1de57a,_0x11b04d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 50b1638..403346a 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 _0x5977=['/:id/download','download','post','addMessage','/:id/tags','tracked','fax','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages'];(function(_0x3a328b,_0x424de0){var _0x3ed7c4=function(_0x41c6a3){while(--_0x41c6a3){_0x3a328b['push'](_0x3a328b['shift']());}};_0x3ed7c4(++_0x424de0);}(_0x5977,0x194));var _0x7597=function(_0x226021,_0x4730d4){_0x226021=_0x226021-0x0;var _0x5b526f=_0x5977[_0x226021];return _0x5b526f;};'use strict';var multer=require(_0x7597('0x0'));var util=require(_0x7597('0x1'));var path=require(_0x7597('0x2'));var timeout=require(_0x7597('0x3'));var express=require('express');var router=express[_0x7597('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7597('0x5'));var interaction=require(_0x7597('0x6'));var config=require(_0x7597('0x7'));var controller=require(_0x7597('0x8'));router[_0x7597('0x9')]('/',auth[_0x7597('0xa')](),controller[_0x7597('0xb')]);router['get']('/describe',auth[_0x7597('0xa')](),controller[_0x7597('0xc')]);router[_0x7597('0x9')](_0x7597('0xd'),auth[_0x7597('0xa')](),controller[_0x7597('0xe')]);router['get'](_0x7597('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0x7597('0x9')](_0x7597('0x10'),auth['isAuthenticated'](),controller[_0x7597('0x11')]);router[_0x7597('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7597('0x12')](_0x7597('0xf'),auth[_0x7597('0xa')](),controller[_0x7597('0x13')]);router[_0x7597('0x12')](_0x7597('0x14'),auth[_0x7597('0xa')](),interaction[_0x7597('0x15')](_0x7597('0x16'),'faxinteraction:addtags'),controller['addTags']);router[_0x7597('0x17')](_0x7597('0xd'),auth[_0x7597('0xa')](),interaction[_0x7597('0x15')](_0x7597('0x16'),'faxinteraction:update'),controller[_0x7597('0x18')]);router[_0x7597('0x19')](_0x7597('0xd'),auth[_0x7597('0xa')](),interaction[_0x7597('0x15')](_0x7597('0x16'),'faxinteraction:destroy'),controller[_0x7597('0x1a')]);router[_0x7597('0x19')]('/:id/tags',auth[_0x7597('0xa')](),controller['removeTags']);module[_0x7597('0x1b')]=router; \ No newline at end of file +var _0x61ca=['/:id/tags','tracked','faxinteraction:addtags','put','/:id','fax','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','/:id/download','create','post','addMessage'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0x61ca,0x1cd));var _0xa61c=function(_0xac9d1e,_0x318d05){_0xac9d1e=_0xac9d1e-0x0;var _0x2a22d3=_0x61ca[_0xac9d1e];return _0x2a22d3;};'use strict';var multer=require(_0xa61c('0x0'));var util=require(_0xa61c('0x1'));var path=require(_0xa61c('0x2'));var timeout=require(_0xa61c('0x3'));var express=require('express');var router=express[_0xa61c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa61c('0x5'));var config=require(_0xa61c('0x6'));var controller=require(_0xa61c('0x7'));router[_0xa61c('0x8')]('/',auth[_0xa61c('0x9')](),controller[_0xa61c('0xa')]);router[_0xa61c('0x8')](_0xa61c('0xb'),auth[_0xa61c('0x9')](),controller[_0xa61c('0xc')]);router[_0xa61c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa61c('0xd')]);router[_0xa61c('0x8')](_0xa61c('0xe'),auth[_0xa61c('0x9')](),controller['getMessages']);router[_0xa61c('0x8')](_0xa61c('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xa61c('0x9')](),controller[_0xa61c('0x10')]);router[_0xa61c('0x11')]('/:id/messages',auth[_0xa61c('0x9')](),controller[_0xa61c('0x12')]);router['post'](_0xa61c('0x13'),auth[_0xa61c('0x9')](),interaction[_0xa61c('0x14')]('fax',_0xa61c('0x15')),controller['addTags']);router[_0xa61c('0x16')](_0xa61c('0x17'),auth[_0xa61c('0x9')](),interaction[_0xa61c('0x14')](_0xa61c('0x18'),_0xa61c('0x19')),controller[_0xa61c('0x1a')]);router[_0xa61c('0x1b')](_0xa61c('0x17'),auth['isAuthenticated'](),interaction[_0xa61c('0x14')](_0xa61c('0x18'),_0xa61c('0x1c')),controller[_0xa61c('0x1d')]);router[_0xa61c('0x1b')](_0xa61c('0x13'),auth[_0xa61c('0x9')](),controller[_0xa61c('0x1e')]);module[_0xa61c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index f56f004..b18aaa6 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 _0x11c9=['DATE','exports','medium','BOOLEAN','out','TEXT'];(function(_0x12ac9a,_0x277265){var _0x580fa9=function(_0x28eb82){while(--_0x28eb82){_0x12ac9a['push'](_0x12ac9a['shift']());}};_0x580fa9(++_0x277265);}(_0x11c9,0xf7));var _0x911c=function(_0x764874,_0x3ed544){_0x764874=_0x764874-0x0;var _0x29f9d5=_0x11c9[_0x764874];return _0x29f9d5;};'use strict';var Sequelize=require('sequelize');module[_0x911c('0x0')]={'body':{'type':Sequelize['TEXT'](_0x911c('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x911c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x911c('0x3')),'defaultValue':_0x911c('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x911c('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x911c('0x5')]}}; \ No newline at end of file +var _0x5763=['exports','TEXT','BOOLEAN','out','DATE'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5763,0x127));var _0x3576=function(_0x2c6ec8,_0x527be9){_0x2c6ec8=_0x2c6ec8-0x0;var _0x1c9f27=_0x5763[_0x2c6ec8];return _0x1c9f27;};'use strict';var Sequelize=require('sequelize');module[_0x3576('0x0')]={'body':{'type':Sequelize[_0x3576('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3576('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3576('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x3576('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x3576('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index d29e320..fd77eb2 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 _0xf4b1=['AcceptMessage','startsWith','cf_','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','contact','reject','rejectmessage','create','findOne','isNil','AttachmentId','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','Attachment','basename','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','destroy','stack','name','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','find','body','params','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','FaxInteraction','FaxInteractionId','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null'];(function(_0x2ae457,_0x449e42){var _0x22c611=function(_0x1c7eda){while(--_0x1c7eda){_0x2ae457['push'](_0x2ae457['shift']());}};_0x22c611(++_0x449e42);}(_0xf4b1,0x1db));var _0x1f4b=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xf4b1[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require(_0x1f4b('0x0'));var rimraf=require(_0x1f4b('0x1'));var zipdir=require(_0x1f4b('0x2'));var jsonpatch=require(_0x1f4b('0x3'));var rp=require('request-promise');var moment=require(_0x1f4b('0x4'));var BPromise=require(_0x1f4b('0x5'));var Mustache=require(_0x1f4b('0x6'));var util=require('util');var path=require(_0x1f4b('0x7'));var sox=require('sox');var csv=require(_0x1f4b('0x8'));var ejs=require(_0x1f4b('0x9'));var fs=require('fs');var fs_extra=require(_0x1f4b('0xa'));var _=require(_0x1f4b('0xb'));var squel=require(_0x1f4b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1f4b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1f4b('0xe'));var Papa=require('papaparse');var Redis=require(_0x1f4b('0xf'));var authService=require(_0x1f4b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1f4b('0x11'));var hardwareService=require(_0x1f4b('0x12'));var logger=require(_0x1f4b('0x13'))(_0x1f4b('0x14'));var utils=require(_0x1f4b('0x15'));var config=require(_0x1f4b('0x16'));var licenseUtil=require(_0x1f4b('0x17'));var db=require(_0x1f4b('0x18'))['db'];config[_0x1f4b('0x19')]=_[_0x1f4b('0x1a')](config['redis'],{'host':_0x1f4b('0x1b'),'port':0x18eb});var socket=require(_0x1f4b('0x1c'))(new Redis(config[_0x1f4b('0x19')]));require(_0x1f4b('0x1d'))[_0x1f4b('0x1e')](socket);var jayson=require(_0x1f4b('0x1f'));var client=jayson[_0x1f4b('0x20')][_0x1f4b('0x21')]({'port':0x232c});var client9002=jayson[_0x1f4b('0x20')][_0x1f4b('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x56ed76,_0x5eacc1,_0x22a68f,_0x2cd427){return new BPromise(function(_0x125f02,_0x888795){var _0x366118=_0x2cd427||client;return _0x366118[_0x1f4b('0x22')](_0x56ed76,_0x22a68f)[_0x1f4b('0x23')](function(_0x4e5749){logger[_0x1f4b('0x24')](_0x1f4b('0x25'),_0x5eacc1,_0x1f4b('0x26'));logger['debug'](_0x1f4b('0x27'),_0x5eacc1,'request\x20sent',JSON['stringify'](_0x4e5749));if(_0x4e5749['error']){if(_0x4e5749[_0x1f4b('0x28')][_0x1f4b('0x29')]===0x1f4){logger[_0x1f4b('0x28')](_0x1f4b('0x25'),_0x5eacc1,_0x4e5749['error'][_0x1f4b('0x2a')]);return _0x888795(_0x4e5749[_0x1f4b('0x28')][_0x1f4b('0x2a')]);}logger['error'](_0x1f4b('0x25'),_0x5eacc1,_0x4e5749[_0x1f4b('0x28')][_0x1f4b('0x2a')]);return _0x125f02(_0x4e5749['error'][_0x1f4b('0x2a')]);}else{logger[_0x1f4b('0x24')](_0x1f4b('0x25'),_0x5eacc1,_0x1f4b('0x26'));_0x125f02(_0x4e5749[_0x1f4b('0x2b')][_0x1f4b('0x2a')]);}})[_0x1f4b('0x2c')](function(_0x58bc0a){logger['error'](_0x1f4b('0x25'),_0x5eacc1,_0x58bc0a);_0x888795(_0x58bc0a);});});}function respondWithStatusCode(_0x3c65ec,_0x2fd241){_0x2fd241=_0x2fd241||0xcc;return function(_0x2480e1){if(_0x2480e1){return _0x3c65ec[_0x1f4b('0x2d')](_0x2fd241);}return _0x3c65ec[_0x1f4b('0x2e')](_0x2fd241)[_0x1f4b('0x2f')]();};}function respondWithResult(_0x2c020e,_0x868fb1){_0x868fb1=_0x868fb1||0xc8;return function(_0x121ad3){if(_0x121ad3){return _0x2c020e[_0x1f4b('0x2e')](_0x868fb1)['json'](_0x121ad3);}};}function respondWithFilteredResult(_0xfd3349,_0x2c5279){return function(_0xe777a){if(_0xe777a){var _0x517000=typeof _0x2c5279[_0x1f4b('0x30')]===_0x1f4b('0x31')&&typeof _0x2c5279[_0x1f4b('0x32')]==='undefined';var _0x201939=_0xe777a[_0x1f4b('0x33')];var _0x48e2d4=_0x517000?0x0:_0x2c5279['offset'];var _0xfc1df7=_0x517000?_0xe777a['count']:_0x2c5279[_0x1f4b('0x30')]+_0x2c5279['limit'];var _0x2366c9;if(_0xfc1df7>=_0x201939){_0xfc1df7=_0x201939;_0x2366c9=0xc8;}else{_0x2366c9=0xce;}_0xfd3349[_0x1f4b('0x2e')](_0x2366c9);return _0xfd3349[_0x1f4b('0x34')](_0x1f4b('0x35'),_0x48e2d4+'-'+_0xfc1df7+'/'+_0x201939)[_0x1f4b('0x36')](_0xe777a);}return null;};}function patchUpdates(_0x1543b5){return function(_0x15e52e){try{jsonpatch[_0x1f4b('0x37')](_0x15e52e,_0x1543b5,!![]);}catch(_0x4d8b3a){return BPromise['reject'](_0x4d8b3a);}return _0x15e52e['save']();};}function saveUpdates(_0x128975,_0x450fee){return function(_0x430141){if(_0x430141){return _0x430141[_0x1f4b('0x38')](_0x128975)[_0x1f4b('0x23')](function(_0x92e976){return _0x92e976;});}return null;};}function removeEntity(_0x3942ce,_0x55d004){return function(_0x555cd4){if(_0x555cd4){return _0x555cd4[_0x1f4b('0x39')]()[_0x1f4b('0x23')](function(){_0x3942ce[_0x1f4b('0x2e')](0xcc)[_0x1f4b('0x2f')]();});}};}function handleEntityNotFound(_0x5e36e1,_0x2ab54e){return function(_0x4d753d){if(!_0x4d753d){_0x5e36e1[_0x1f4b('0x2d')](0x194);}return _0x4d753d;};}function handleError(_0x2783a2,_0x21d4e4){_0x21d4e4=_0x21d4e4||0x1f4;return function(_0x56ddb9){logger[_0x1f4b('0x28')](_0x56ddb9[_0x1f4b('0x3a')]);if(_0x56ddb9[_0x1f4b('0x3b')]){delete _0x56ddb9['name'];}_0x2783a2[_0x1f4b('0x2e')](_0x21d4e4)['send'](_0x56ddb9);};}exports[_0x1f4b('0x3c')]=function(_0x344746,_0x29e3b5){var _0x31b2a3={},_0x318a6e={},_0x5864c4={'count':0x0,'rows':[]};var _0x69fd5c=_['map'](db[_0x1f4b('0x3d')][_0x1f4b('0x3e')],function(_0x256b6c){return{'name':_0x256b6c[_0x1f4b('0x3f')],'type':_0x256b6c[_0x1f4b('0x40')][_0x1f4b('0x41')]};});_0x318a6e[_0x1f4b('0x42')]=_[_0x1f4b('0x43')](_0x69fd5c,'name');_0x318a6e[_0x1f4b('0x44')]=_[_0x1f4b('0x45')](_0x344746[_0x1f4b('0x44')]);_0x318a6e[_0x1f4b('0x46')]=_['intersection'](_0x318a6e['model'],_0x318a6e[_0x1f4b('0x44')]);_0x31b2a3['attributes']=_[_0x1f4b('0x47')](_0x318a6e[_0x1f4b('0x42')],qs[_0x1f4b('0x48')](_0x344746[_0x1f4b('0x44')][_0x1f4b('0x48')]));_0x31b2a3[_0x1f4b('0x49')]=_0x31b2a3[_0x1f4b('0x49')][_0x1f4b('0x4a')]?_0x31b2a3['attributes']:_0x318a6e[_0x1f4b('0x42')];if(!_0x344746[_0x1f4b('0x44')][_0x1f4b('0x4b')]('nolimit')){_0x31b2a3['limit']=qs[_0x1f4b('0x32')](_0x344746[_0x1f4b('0x44')]['limit']);_0x31b2a3[_0x1f4b('0x30')]=qs[_0x1f4b('0x30')](_0x344746[_0x1f4b('0x44')][_0x1f4b('0x30')]);}_0x31b2a3[_0x1f4b('0x4c')]=qs['sort'](_0x344746[_0x1f4b('0x44')][_0x1f4b('0x4d')]);_0x31b2a3['where']=qs[_0x1f4b('0x46')](_[_0x1f4b('0x4e')](_0x344746[_0x1f4b('0x44')],_0x318a6e['filters']),_0x69fd5c);if(_0x344746['query'][_0x1f4b('0x4f')]){_0x31b2a3[_0x1f4b('0x50')]=_['merge'](_0x31b2a3['where'],{'$or':_['map'](_0x69fd5c,function(_0x23d652){if(_0x23d652['type']!==_0x1f4b('0x51')){var _0x1ddf2d={};_0x1ddf2d[_0x23d652[_0x1f4b('0x3b')]]={'$like':'%'+_0x344746['query'][_0x1f4b('0x4f')]+'%'};return _0x1ddf2d;}})});}_0x31b2a3=_[_0x1f4b('0x52')]({},_0x31b2a3,_0x344746[_0x1f4b('0x53')]);var _0x2ca6e3={'where':_0x31b2a3[_0x1f4b('0x50')]};return db[_0x1f4b('0x3d')][_0x1f4b('0x33')](_0x2ca6e3)[_0x1f4b('0x23')](function(_0x5d93e6){_0x5864c4['count']=_0x5d93e6;if(_0x344746[_0x1f4b('0x44')][_0x1f4b('0x54')]){_0x31b2a3[_0x1f4b('0x55')]=[{'all':!![]}];}return db['FaxMessage'][_0x1f4b('0x56')](_0x31b2a3);})[_0x1f4b('0x23')](function(_0x51753a){_0x5864c4[_0x1f4b('0x57')]=_0x51753a;return _0x5864c4;})['then'](respondWithFilteredResult(_0x29e3b5,_0x31b2a3))[_0x1f4b('0x2c')](handleError(_0x29e3b5,null));};exports['show']=function(_0x320af8,_0x47e8b5){var _0x4ece2={'raw':!![],'where':{'id':_0x320af8['params']['id']}},_0x10471a={};_0x10471a[_0x1f4b('0x42')]=_[_0x1f4b('0x45')](db['FaxMessage'][_0x1f4b('0x3e')]);_0x10471a[_0x1f4b('0x44')]=_['keys'](_0x320af8['query']);_0x10471a[_0x1f4b('0x46')]=_[_0x1f4b('0x47')](_0x10471a[_0x1f4b('0x42')],_0x10471a[_0x1f4b('0x44')]);_0x4ece2[_0x1f4b('0x49')]=_[_0x1f4b('0x47')](_0x10471a[_0x1f4b('0x42')],qs['fields'](_0x320af8[_0x1f4b('0x44')][_0x1f4b('0x48')]));_0x4ece2[_0x1f4b('0x49')]=_0x4ece2[_0x1f4b('0x49')][_0x1f4b('0x4a')]?_0x4ece2['attributes']:_0x10471a['model'];if(_0x320af8['query'][_0x1f4b('0x54')]){_0x4ece2[_0x1f4b('0x55')]=[{'all':!![]}];}_0x4ece2=_[_0x1f4b('0x52')]({},_0x4ece2,_0x320af8['options']);return db[_0x1f4b('0x3d')][_0x1f4b('0x58')](_0x4ece2)[_0x1f4b('0x23')](handleEntityNotFound(_0x47e8b5,null))[_0x1f4b('0x23')](respondWithResult(_0x47e8b5,null))[_0x1f4b('0x2c')](handleError(_0x47e8b5,null));};exports[_0x1f4b('0x38')]=function(_0x44dcd2,_0x56a067){if(_0x44dcd2['body']['id']){delete _0x44dcd2[_0x1f4b('0x59')]['id'];}return db[_0x1f4b('0x3d')][_0x1f4b('0x58')]({'where':{'id':_0x44dcd2['params']['id']}})[_0x1f4b('0x23')](handleEntityNotFound(_0x56a067,null))[_0x1f4b('0x23')](saveUpdates(_0x44dcd2[_0x1f4b('0x59')],null))['then'](respondWithResult(_0x56a067,null))[_0x1f4b('0x2c')](handleError(_0x56a067,null));};exports[_0x1f4b('0x39')]=function(_0x42da0e,_0x2c94f7){return db[_0x1f4b('0x3d')]['find']({'where':{'id':_0x42da0e[_0x1f4b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2c94f7,null))[_0x1f4b('0x23')](removeEntity(_0x2c94f7,null))[_0x1f4b('0x2c')](handleError(_0x2c94f7,null));};exports[_0x1f4b('0x5b')]=function(_0x3f4bee,_0xf4650e){return db[_0x1f4b('0x3d')]['describe']()[_0x1f4b('0x23')](respondWithResult(_0xf4650e,null))['catch'](handleError(_0xf4650e,null));};var interaction_log=require(_0x1f4b('0x13'))(_0x1f4b('0x5c'));exports[_0x1f4b('0x5d')]=function(_0xc6399,_0x4d9c38,_0x253da4){var _0x125a36={'agent':{},'channel':_0x1f4b('0x5e')};if(_0xc6399[_0x1f4b('0x59')]['id']){delete _0xc6399[_0x1f4b('0x59')]['id'];}_0xc6399[_0x1f4b('0x59')][_0x1f4b('0x5f')]=!![];_0xc6399['body'][_0x1f4b('0x60')]=moment()[_0x1f4b('0x61')](_0x1f4b('0x62'));_0xc6399['body'][_0x1f4b('0x63')]=_0xc6399[_0x1f4b('0x59')][_0x1f4b('0x63')]||_0xc6399[_0x1f4b('0x64')]['id'];_0x125a36[_0x1f4b('0x65')]['id']=_0xc6399[_0x1f4b('0x59')][_0x1f4b('0x63')];return db[_0x1f4b('0x3d')][_0x1f4b('0x58')]({'where':{'id':_0xc6399[_0x1f4b('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x1f4b('0x66')],'as':_0x1f4b('0x67')}]})[_0x1f4b('0x23')](handleEntityNotFound(_0x4d9c38,null))[_0x1f4b('0x23')](saveUpdates(_0xc6399[_0x1f4b('0x59')],null))[_0x1f4b('0x23')](function(_0x17e521){if(_0x17e521){_0x125a36['message']=_0x17e521[_0x1f4b('0x68')]({'plain':!![]});return db[_0x1f4b('0x69')][_0x1f4b('0x58')]({'where':{'id':_0x17e521[_0x1f4b('0x6a')]}});}return null;})[_0x1f4b('0x23')](handleEntityNotFound(_0x4d9c38,null))['then'](function(_0x466400){if(_0x466400){return _0x466400[_0x1f4b('0x38')]({'UserId':_0xc6399[_0x1f4b('0x59')][_0x1f4b('0x63')],'read1stAt':_['isNil'](_0x466400[_0x1f4b('0x6b')])?moment()[_0x1f4b('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1f4b('0x23')](function(_0x50bfe8){if(_0x50bfe8){_0x125a36[_0x1f4b('0x6c')]=_0x50bfe8[_0x1f4b('0x68')]({'plain':!![]});interaction_log[_0x1f4b('0x24')](_0x1f4b('0x6d'),_0xc6399[_0x1f4b('0x64')]['id'],_0xc6399[_0x1f4b('0x64')][_0x1f4b('0x3b')],_0xc6399[_0x1f4b('0x64')][_0x1f4b('0x6e')],_0x125a36['interaction']['id'],_0xc6399[_0x1f4b('0x59')]?JSON[_0x1f4b('0x6f')](_0xc6399[_0x1f4b('0x59')]):_0x1f4b('0x70'));return respondWithRpcPromise(_0x1f4b('0x71'),'acceptMessage',_0x125a36);}return null;})[_0x1f4b('0x23')](function(_0x5c8d82){return db['CmContact']['describe']()[_0x1f4b('0x23')](function(_0x3ef492){var _0x3f21fe=[];for(var _0x499a78=0x0;_0x499a78=_0x1a6ad8){_0x4e7c51=_0x1a6ad8;_0x3f7012=0xc8;}else{_0x3f7012=0xce;}_0x7516f7[_0x2fd2('0x2d')](_0x3f7012);return _0x7516f7['set'](_0x2fd2('0x33'),_0x5e3878+'-'+_0x4e7c51+'/'+_0x1a6ad8)[_0x2fd2('0x2f')](_0x24cfd4);}return null;};}function patchUpdates(_0x149548){return function(_0x2fd248){try{jsonpatch['apply'](_0x2fd248,_0x149548,!![]);}catch(_0x2465f3){return BPromise[_0x2fd2('0x34')](_0x2465f3);}return _0x2fd248['save']();};}function saveUpdates(_0x3fa9b0,_0x37aa74){return function(_0x32edaa){if(_0x32edaa){return _0x32edaa[_0x2fd2('0x35')](_0x3fa9b0)['then'](function(_0x173186){return _0x173186;});}return null;};}function removeEntity(_0x375c35,_0x3a5769){return function(_0xbbe22a){if(_0xbbe22a){return _0xbbe22a[_0x2fd2('0x36')]()[_0x2fd2('0x21')](function(){_0x375c35['status'](0xcc)[_0x2fd2('0x2e')]();});}};}function handleEntityNotFound(_0x14ada3,_0x8247e3){return function(_0x5e3d13){if(!_0x5e3d13){_0x14ada3['sendStatus'](0x194);}return _0x5e3d13;};}function handleError(_0x58a3ca,_0x12257c){_0x12257c=_0x12257c||0x1f4;return function(_0x2a9b8b){logger['error'](_0x2a9b8b[_0x2fd2('0x37')]);if(_0x2a9b8b[_0x2fd2('0x38')]){delete _0x2a9b8b['name'];}_0x58a3ca[_0x2fd2('0x2d')](_0x12257c)[_0x2fd2('0x39')](_0x2a9b8b);};}exports['index']=function(_0x3c82b7,_0x3eb4d0){var _0x319da4={},_0x22c5cb={},_0x38cb16={'count':0x0,'rows':[]};var _0x3e8c01=_['map'](db['FaxMessage']['rawAttributes'],function(_0x16ed91){return{'name':_0x16ed91[_0x2fd2('0x3a')],'type':_0x16ed91['type'][_0x2fd2('0x3b')]};});_0x22c5cb[_0x2fd2('0x3c')]=_['map'](_0x3e8c01,_0x2fd2('0x38'));_0x22c5cb[_0x2fd2('0x3d')]=_[_0x2fd2('0x3e')](_0x3c82b7[_0x2fd2('0x3d')]);_0x22c5cb[_0x2fd2('0x3f')]=_[_0x2fd2('0x40')](_0x22c5cb[_0x2fd2('0x3c')],_0x22c5cb[_0x2fd2('0x3d')]);_0x319da4['attributes']=_[_0x2fd2('0x40')](_0x22c5cb[_0x2fd2('0x3c')],qs[_0x2fd2('0x41')](_0x3c82b7[_0x2fd2('0x3d')][_0x2fd2('0x41')]));_0x319da4[_0x2fd2('0x42')]=_0x319da4['attributes'][_0x2fd2('0x43')]?_0x319da4['attributes']:_0x22c5cb[_0x2fd2('0x3c')];if(!_0x3c82b7[_0x2fd2('0x3d')][_0x2fd2('0x44')](_0x2fd2('0x45'))){_0x319da4[_0x2fd2('0x32')]=qs[_0x2fd2('0x32')](_0x3c82b7[_0x2fd2('0x3d')][_0x2fd2('0x32')]);_0x319da4['offset']=qs[_0x2fd2('0x31')](_0x3c82b7[_0x2fd2('0x3d')][_0x2fd2('0x31')]);}_0x319da4[_0x2fd2('0x46')]=qs['sort'](_0x3c82b7[_0x2fd2('0x3d')][_0x2fd2('0x47')]);_0x319da4['where']=qs['filters'](_[_0x2fd2('0x48')](_0x3c82b7['query'],_0x22c5cb[_0x2fd2('0x3f')]),_0x3e8c01);if(_0x3c82b7[_0x2fd2('0x3d')]['filter']){_0x319da4[_0x2fd2('0x49')]=_['merge'](_0x319da4[_0x2fd2('0x49')],{'$or':_['map'](_0x3e8c01,function(_0x3ae159){if(_0x3ae159['type']!=='VIRTUAL'){var _0x3805e4={};_0x3805e4[_0x3ae159[_0x2fd2('0x38')]]={'$like':'%'+_0x3c82b7[_0x2fd2('0x3d')][_0x2fd2('0x4a')]+'%'};return _0x3805e4;}})});}_0x319da4=_[_0x2fd2('0x4b')]({},_0x319da4,_0x3c82b7['options']);var _0x44b9c6={'where':_0x319da4[_0x2fd2('0x49')]};return db['FaxMessage']['count'](_0x44b9c6)[_0x2fd2('0x21')](function(_0x53e2d1){_0x38cb16[_0x2fd2('0x30')]=_0x53e2d1;if(_0x3c82b7[_0x2fd2('0x3d')][_0x2fd2('0x4c')]){_0x319da4[_0x2fd2('0x4d')]=[{'all':!![]}];}return db[_0x2fd2('0x4e')]['findAll'](_0x319da4);})['then'](function(_0x70d10d){_0x38cb16[_0x2fd2('0x4f')]=_0x70d10d;return _0x38cb16;})[_0x2fd2('0x21')](respondWithFilteredResult(_0x3eb4d0,_0x319da4))[_0x2fd2('0x2b')](handleError(_0x3eb4d0,null));};exports[_0x2fd2('0x50')]=function(_0x55646c,_0x3ab8b2){var _0x5ce780={'raw':!![],'where':{'id':_0x55646c[_0x2fd2('0x51')]['id']}},_0x28bd04={};_0x28bd04[_0x2fd2('0x3c')]=_['keys'](db['FaxMessage'][_0x2fd2('0x52')]);_0x28bd04[_0x2fd2('0x3d')]=_['keys'](_0x55646c['query']);_0x28bd04[_0x2fd2('0x3f')]=_[_0x2fd2('0x40')](_0x28bd04['model'],_0x28bd04['query']);_0x5ce780['attributes']=_[_0x2fd2('0x40')](_0x28bd04[_0x2fd2('0x3c')],qs[_0x2fd2('0x41')](_0x55646c[_0x2fd2('0x3d')][_0x2fd2('0x41')]));_0x5ce780['attributes']=_0x5ce780[_0x2fd2('0x42')][_0x2fd2('0x43')]?_0x5ce780[_0x2fd2('0x42')]:_0x28bd04['model'];if(_0x55646c[_0x2fd2('0x3d')]['includeAll']){_0x5ce780[_0x2fd2('0x4d')]=[{'all':!![]}];}_0x5ce780=_[_0x2fd2('0x4b')]({},_0x5ce780,_0x55646c[_0x2fd2('0x53')]);return db[_0x2fd2('0x4e')]['find'](_0x5ce780)[_0x2fd2('0x21')](handleEntityNotFound(_0x3ab8b2,null))[_0x2fd2('0x21')](respondWithResult(_0x3ab8b2,null))[_0x2fd2('0x2b')](handleError(_0x3ab8b2,null));};exports['update']=function(_0x126cdf,_0x56d479){if(_0x126cdf[_0x2fd2('0x54')]['id']){delete _0x126cdf[_0x2fd2('0x54')]['id'];}return db[_0x2fd2('0x4e')][_0x2fd2('0x55')]({'where':{'id':_0x126cdf[_0x2fd2('0x51')]['id']}})[_0x2fd2('0x21')](handleEntityNotFound(_0x56d479,null))[_0x2fd2('0x21')](saveUpdates(_0x126cdf[_0x2fd2('0x54')],null))['then'](respondWithResult(_0x56d479,null))[_0x2fd2('0x2b')](handleError(_0x56d479,null));};exports[_0x2fd2('0x36')]=function(_0x434d85,_0x1ad0b7){return db[_0x2fd2('0x4e')]['find']({'where':{'id':_0x434d85[_0x2fd2('0x51')]['id']}})[_0x2fd2('0x21')](handleEntityNotFound(_0x1ad0b7,null))[_0x2fd2('0x21')](removeEntity(_0x1ad0b7,null))[_0x2fd2('0x2b')](handleError(_0x1ad0b7,null));};exports[_0x2fd2('0x56')]=function(_0x4420ae,_0x306586){return db[_0x2fd2('0x4e')][_0x2fd2('0x56')]()[_0x2fd2('0x21')](respondWithResult(_0x306586,null))[_0x2fd2('0x2b')](handleError(_0x306586,null));};var interaction_log=require(_0x2fd2('0x14'))(_0x2fd2('0x57'));exports['accept']=function(_0x597d23,_0xa2c572,_0x31d91d){var _0x10e3de={'agent':{},'channel':_0x2fd2('0x58')};if(_0x597d23[_0x2fd2('0x54')]['id']){delete _0x597d23[_0x2fd2('0x54')]['id'];}_0x597d23['body']['read']=!![];_0x597d23['body']['readAt']=moment()[_0x2fd2('0x59')](_0x2fd2('0x5a'));_0x597d23['body'][_0x2fd2('0x5b')]=_0x597d23[_0x2fd2('0x54')][_0x2fd2('0x5b')]||_0x597d23[_0x2fd2('0x5c')]['id'];_0x10e3de[_0x2fd2('0x5d')]['id']=_0x597d23[_0x2fd2('0x54')][_0x2fd2('0x5b')];return db['FaxMessage']['find']({'where':{'id':_0x597d23[_0x2fd2('0x51')]['id'],'UserId':null},'include':[{'model':db[_0x2fd2('0x5e')],'as':_0x2fd2('0x5f')}]})['then'](handleEntityNotFound(_0xa2c572,null))[_0x2fd2('0x21')](saveUpdates(_0x597d23['body'],null))['then'](function(_0x4aae27){if(_0x4aae27){_0x10e3de['message']=_0x4aae27[_0x2fd2('0x60')]({'plain':!![]});return db[_0x2fd2('0x61')]['find']({'where':{'id':_0x4aae27['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xa2c572,null))['then'](function(_0x2b9658){if(_0x2b9658){return _0x2b9658[_0x2fd2('0x35')]({'UserId':_0x597d23[_0x2fd2('0x54')][_0x2fd2('0x5b')],'read1stAt':_[_0x2fd2('0x62')](_0x2b9658['read1stAt'])?moment()[_0x2fd2('0x59')](_0x2fd2('0x5a')):undefined});}return null;})[_0x2fd2('0x21')](function(_0x57f069){if(_0x57f069){_0x10e3de[_0x2fd2('0x63')]=_0x57f069[_0x2fd2('0x60')]({'plain':!![]});interaction_log[_0x2fd2('0x2a')](_0x2fd2('0x64'),_0x597d23[_0x2fd2('0x5c')]['id'],_0x597d23['user']['name'],_0x597d23[_0x2fd2('0x5c')]['role'],_0x10e3de[_0x2fd2('0x63')]['id'],_0x597d23[_0x2fd2('0x54')]?JSON[_0x2fd2('0x26')](_0x597d23[_0x2fd2('0x54')]):_0x2fd2('0x65'));return respondWithRpcPromise(_0x2fd2('0x66'),'acceptMessage',_0x10e3de);}return null;})[_0x2fd2('0x21')](function(_0x3aec17){return db[_0x2fd2('0x5e')][_0x2fd2('0x56')]()['then'](function(_0x334016){var _0x2f5b5d=[];for(var _0x2660a1=0x0;_0x2660a1=_0x53ecfc){_0x1e9327=_0x53ecfc;_0x58818f=0xc8;}else{_0x58818f=0xce;}_0x1622b1[_0xe0bb('0x21')](_0x58818f);return _0x1622b1[_0xe0bb('0x27')](_0xe0bb('0x28'),_0x3289bb+'-'+_0x1e9327+'/'+_0x53ecfc)[_0xe0bb('0x29')](_0xe08afa);}return null;};}function patchUpdates(_0x27a8b6){return function(_0x54b82c){try{jsonpatch[_0xe0bb('0x2a')](_0x54b82c,_0x27a8b6,!![]);}catch(_0x3f4d61){return BPromise['reject'](_0x3f4d61);}return _0x54b82c[_0xe0bb('0x2b')]();};}function saveUpdates(_0x4a6d47,_0x4f0146){return function(_0xb58370){if(_0xb58370){return _0xb58370[_0xe0bb('0x2c')](_0x4a6d47)[_0xe0bb('0x2d')](function(_0x3caf2f){return _0x3caf2f;});}return null;};}function removeEntity(_0x2efbf7,_0x27d4bd){return function(_0x2ee35f){if(_0x2ee35f){return _0x2ee35f['destroy']()[_0xe0bb('0x2d')](function(){var _0xae9b07=_0x2ee35f[_0xe0bb('0x2e')]({'plain':!![]});var _0x356a97='FaxQueues';return db[_0xe0bb('0x2f')][_0xe0bb('0x30')]({'where':{'type':_0x356a97,'resourceId':_0xae9b07['id']}})[_0xe0bb('0x2d')](function(){return _0x2ee35f;});})[_0xe0bb('0x2d')](function(){_0x2efbf7[_0xe0bb('0x21')](0xcc)[_0xe0bb('0x22')]();});}};}function handleEntityNotFound(_0x536fd4,_0x2459b6){return function(_0x4a1883){if(!_0x4a1883){_0x536fd4['sendStatus'](0x194);}return _0x4a1883;};}function handleError(_0x5b3465,_0x3587f1){_0x3587f1=_0x3587f1||0x1f4;return function(_0x437622){logger[_0xe0bb('0x31')](_0x437622[_0xe0bb('0x32')]);if(_0x437622[_0xe0bb('0x33')]){delete _0x437622[_0xe0bb('0x33')];}_0x5b3465[_0xe0bb('0x21')](_0x3587f1)[_0xe0bb('0x34')](_0x437622);};}exports['index']=function(_0x5e650a,_0x4e1cba){var _0x185ee6={},_0xe5f13d={},_0x3b8dd7={'count':0x0,'rows':[]};var _0x41e5a9=_[_0xe0bb('0x35')](db[_0xe0bb('0x36')][_0xe0bb('0x37')],function(_0x3fb479){return{'name':_0x3fb479[_0xe0bb('0x38')],'type':_0x3fb479[_0xe0bb('0x39')]['key']};});_0xe5f13d['model']=_['map'](_0x41e5a9,_0xe0bb('0x33'));_0xe5f13d[_0xe0bb('0x3a')]=_['keys'](_0x5e650a[_0xe0bb('0x3a')]);_0xe5f13d[_0xe0bb('0x3b')]=_[_0xe0bb('0x3c')](_0xe5f13d['model'],_0xe5f13d[_0xe0bb('0x3a')]);_0x185ee6[_0xe0bb('0x3d')]=_['intersection'](_0xe5f13d['model'],qs['fields'](_0x5e650a[_0xe0bb('0x3a')][_0xe0bb('0x3e')]));_0x185ee6[_0xe0bb('0x3d')]=_0x185ee6[_0xe0bb('0x3d')][_0xe0bb('0x3f')]?_0x185ee6[_0xe0bb('0x3d')]:_0xe5f13d[_0xe0bb('0x40')];if(!_0x5e650a[_0xe0bb('0x3a')][_0xe0bb('0x41')](_0xe0bb('0x42'))){_0x185ee6['limit']=qs[_0xe0bb('0x24')](_0x5e650a['query']['limit']);_0x185ee6['offset']=qs['offset'](_0x5e650a[_0xe0bb('0x3a')]['offset']);}_0x185ee6[_0xe0bb('0x43')]=qs[_0xe0bb('0x44')](_0x5e650a[_0xe0bb('0x3a')][_0xe0bb('0x44')]);_0x185ee6[_0xe0bb('0x45')]=qs['filters'](_['pick'](_0x5e650a[_0xe0bb('0x3a')],_0xe5f13d[_0xe0bb('0x3b')]),_0x41e5a9);if(_0x5e650a['query']['filter']){_0x185ee6['where']=_[_0xe0bb('0x46')](_0x185ee6[_0xe0bb('0x45')],{'$or':_[_0xe0bb('0x35')](_0x41e5a9,function(_0x3faf24){if(_0x3faf24['type']!==_0xe0bb('0x47')){var _0x4bd172={};_0x4bd172[_0x3faf24[_0xe0bb('0x33')]]={'$like':'%'+_0x5e650a['query'][_0xe0bb('0x48')]+'%'};return _0x4bd172;}})});}_0x185ee6=_[_0xe0bb('0x46')]({},_0x185ee6,_0x5e650a[_0xe0bb('0x49')]);var _0x184bbd={'where':_0x185ee6['where']};return db[_0xe0bb('0x36')][_0xe0bb('0x26')](_0x184bbd)[_0xe0bb('0x2d')](function(_0x5d9ba4){_0x3b8dd7[_0xe0bb('0x26')]=_0x5d9ba4;if(_0x5e650a[_0xe0bb('0x3a')][_0xe0bb('0x4a')]){_0x185ee6[_0xe0bb('0x4b')]=[{'all':!![]}];}return db['FaxQueue'][_0xe0bb('0x4c')](_0x185ee6);})[_0xe0bb('0x2d')](function(_0xbc7976){_0x3b8dd7[_0xe0bb('0x4d')]=_0xbc7976;return _0x3b8dd7;})[_0xe0bb('0x2d')](respondWithFilteredResult(_0x4e1cba,_0x185ee6))[_0xe0bb('0x4e')](handleError(_0x4e1cba,null));};exports[_0xe0bb('0x4f')]=function(_0x497d78,_0x59c99d){var _0x1cb505={'raw':!![],'where':{'id':_0x497d78[_0xe0bb('0x50')]['id']}},_0x4de19c={};_0x4de19c['model']=_[_0xe0bb('0x51')](db[_0xe0bb('0x36')][_0xe0bb('0x37')]);_0x4de19c[_0xe0bb('0x3a')]=_[_0xe0bb('0x51')](_0x497d78['query']);_0x4de19c[_0xe0bb('0x3b')]=_[_0xe0bb('0x3c')](_0x4de19c['model'],_0x4de19c[_0xe0bb('0x3a')]);_0x1cb505[_0xe0bb('0x3d')]=_[_0xe0bb('0x3c')](_0x4de19c[_0xe0bb('0x40')],qs['fields'](_0x497d78['query'][_0xe0bb('0x3e')]));_0x1cb505[_0xe0bb('0x3d')]=_0x1cb505['attributes'][_0xe0bb('0x3f')]?_0x1cb505[_0xe0bb('0x3d')]:_0x4de19c[_0xe0bb('0x40')];if(_0x497d78[_0xe0bb('0x3a')]['includeAll']){_0x1cb505[_0xe0bb('0x4b')]=[{'all':!![]}];}_0x1cb505=_[_0xe0bb('0x46')]({},_0x1cb505,_0x497d78['options']);return db[_0xe0bb('0x36')]['find'](_0x1cb505)['then'](handleEntityNotFound(_0x59c99d,null))[_0xe0bb('0x2d')](respondWithResult(_0x59c99d,null))[_0xe0bb('0x4e')](handleError(_0x59c99d,null));};exports['create']=function(_0x1f6623,_0x5f8c31){return db[_0xe0bb('0x36')][_0xe0bb('0x52')](_0x1f6623[_0xe0bb('0x53')],{})[_0xe0bb('0x2d')](function(_0x20a5a2){var _0x56704f=_0x1f6623[_0xe0bb('0x54')][_0xe0bb('0x2e')]({'plain':!![]});if(!_0x56704f)throw new Error(_0xe0bb('0x55'));if(_0x56704f[_0xe0bb('0x56')]===_0xe0bb('0x54')){var _0x2a8fdc=_0x20a5a2[_0xe0bb('0x2e')]({'plain':!![]});var _0x11d67a=_0xe0bb('0x57');return db[_0xe0bb('0x58')]['find']({'where':{'name':_0x11d67a,'userProfileId':_0x56704f[_0xe0bb('0x59')]},'raw':!![]})[_0xe0bb('0x2d')](function(_0x6a3561){if(_0x6a3561&&_0x6a3561[_0xe0bb('0x5a')]===0x0){return db[_0xe0bb('0x2f')][_0xe0bb('0x52')]({'name':_0x2a8fdc[_0xe0bb('0x33')],'resourceId':_0x2a8fdc['id'],'type':_0x6a3561['name'],'sectionId':_0x6a3561['id']},{})[_0xe0bb('0x2d')](function(){return _0x20a5a2;});}else{return _0x20a5a2;}})[_0xe0bb('0x4e')](function(_0x50bdae){logger[_0xe0bb('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50bdae);throw _0x50bdae;});}return _0x20a5a2;})[_0xe0bb('0x2d')](respondWithResult(_0x5f8c31,0xc9))[_0xe0bb('0x4e')](handleError(_0x5f8c31,null));};exports[_0xe0bb('0x2c')]=function(_0x274874,_0x52862c){if(_0x274874['body']['id']){delete _0x274874[_0xe0bb('0x53')]['id'];}return db['FaxQueue'][_0xe0bb('0x5b')]({'where':{'id':_0x274874[_0xe0bb('0x50')]['id']}})[_0xe0bb('0x2d')](handleEntityNotFound(_0x52862c,null))[_0xe0bb('0x2d')](saveUpdates(_0x274874[_0xe0bb('0x53')],null))[_0xe0bb('0x2d')](respondWithResult(_0x52862c,null))[_0xe0bb('0x4e')](handleError(_0x52862c,null));};exports['destroy']=function(_0x4db911,_0x77efd3){return db['FaxQueue'][_0xe0bb('0x5b')]({'where':{'id':_0x4db911[_0xe0bb('0x50')]['id']}})[_0xe0bb('0x2d')](handleEntityNotFound(_0x77efd3,null))[_0xe0bb('0x2d')](removeEntity(_0x77efd3,null))[_0xe0bb('0x4e')](handleError(_0x77efd3,null));};exports['describe']=function(_0x56d367,_0x3ae580){return db[_0xe0bb('0x36')][_0xe0bb('0x5c')]()[_0xe0bb('0x2d')](respondWithResult(_0x3ae580,null))[_0xe0bb('0x4e')](handleError(_0x3ae580,null));};exports['getMembers']=function(_0x4231bf,_0x208935,_0x2642c8){var _0x4ba200={'raw':!![],'where':{}},_0x3eca85={},_0x507ebe;return db[_0xe0bb('0x36')][_0xe0bb('0x5d')]({'where':{'id':_0x4231bf[_0xe0bb('0x50')]['id']}})[_0xe0bb('0x2d')](handleEntityNotFound(_0x208935,null))['then'](function(_0x335bcc){if(_0x335bcc){_0x507ebe=_0x335bcc[_0xe0bb('0x2e')]({'plain':!![]});_0x3eca85[_0xe0bb('0x40')]=_[_0xe0bb('0x51')](db[_0xe0bb('0x5e')][_0xe0bb('0x37')]);_0x3eca85[_0xe0bb('0x3a')]=_[_0xe0bb('0x51')](_0x4231bf[_0xe0bb('0x3a')]);_0x3eca85[_0xe0bb('0x3b')]=_[_0xe0bb('0x3c')](_0x3eca85['model'],_0x3eca85[_0xe0bb('0x3a')]);_0x4ba200['attributes']=_[_0xe0bb('0x3c')](_0x3eca85[_0xe0bb('0x40')],qs[_0xe0bb('0x3e')](_0x4231bf[_0xe0bb('0x3a')][_0xe0bb('0x3e')]));_0x4ba200['attributes']=_0x4ba200[_0xe0bb('0x3d')][_0xe0bb('0x3f')]?_0x4ba200[_0xe0bb('0x3d')]:_0x3eca85[_0xe0bb('0x40')];if(!_0x4231bf[_0xe0bb('0x3a')][_0xe0bb('0x41')]('nolimit')){_0x4ba200['limit']=qs[_0xe0bb('0x24')](_0x4231bf[_0xe0bb('0x3a')][_0xe0bb('0x24')]);_0x4ba200[_0xe0bb('0x23')]=qs[_0xe0bb('0x23')](_0x4231bf[_0xe0bb('0x3a')]['offset']);}_0x4ba200[_0xe0bb('0x43')]=qs['sort'](_0x4231bf['query']['sort']);_0x4ba200[_0xe0bb('0x45')]=qs[_0xe0bb('0x3b')](_['pick'](_0x4231bf[_0xe0bb('0x3a')],_0x3eca85[_0xe0bb('0x3b')]));_0x4ba200['where'][_0xe0bb('0x5f')]=_0x335bcc['id'];if(_0x4231bf[_0xe0bb('0x3a')][_0xe0bb('0x48')]){_0x4ba200['where']=_['merge'](_0x4ba200[_0xe0bb('0x45')],{'$or':_['map'](_0x4ba200[_0xe0bb('0x3d')],function(_0x141800){var _0xb2728c={};_0xb2728c[_0x141800]={'$like':'%'+_0x4231bf['query'][_0xe0bb('0x48')]+'%'};return _0xb2728c;})});}_0x4ba200=_[_0xe0bb('0x46')]({},_0x4ba200,_0x4231bf['options']);return db['UserFaxQueue'][_0xe0bb('0x4c')](_0x4ba200);}})[_0xe0bb('0x2d')](function(_0x19fee1){if(_0x19fee1){return db[_0xe0bb('0x60')][_0xe0bb('0x61')]({'where':{'id':_[_0xe0bb('0x35')](_0x19fee1,_0xe0bb('0x62')),'role':_0xe0bb('0x63')},'attributes':['id',_0xe0bb('0x33'),_0xe0bb('0x64'),_0xe0bb('0x65'),'createdAt']});}})[_0xe0bb('0x2d')](function(_0x543ec6){if(_0x543ec6){return{'count':_0x543ec6[_0xe0bb('0x26')],'rows':_[_0xe0bb('0x35')](_0x543ec6[_0xe0bb('0x4d')],function(_0x24ae54){return{'membername':_0x24ae54[_0xe0bb('0x33')],'UserId':_0x24ae54['id'],'queue_name':_0x507ebe[_0xe0bb('0x33')],'FaxQueueId':_0x507ebe['id'],'interface':util[_0xe0bb('0x66')](_0xe0bb('0x67'),_0xe0bb('0x68'),_0x24ae54[_0xe0bb('0x33')]),'penalty':0x0,'paused':_0x24ae54[_0xe0bb('0x64')],'createdAt':_0x24ae54[_0xe0bb('0x69')],'updatedAt':_0x24ae54[_0xe0bb('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0bb('0x2d')](respondWithFilteredResult(_0x208935,_0x4ba200))['catch'](handleError(_0x208935,null));};exports[_0xe0bb('0x6a')]=function(_0x21de67,_0x1ef7de,_0x20b4db){var _0x21d099={};var _0x5ab1c7={};var _0x1bd130;var _0x386d87;return db[_0xe0bb('0x36')][_0xe0bb('0x5d')]({'where':{'id':_0x21de67['params']['id']}})[_0xe0bb('0x2d')](handleEntityNotFound(_0x1ef7de,null))[_0xe0bb('0x2d')](function(_0xa9d90b){if(_0xa9d90b){_0x1bd130=_0xa9d90b;_0x5ab1c7[_0xe0bb('0x40')]=_[_0xe0bb('0x51')](db[_0xe0bb('0x6b')][_0xe0bb('0x37')]);_0x5ab1c7[_0xe0bb('0x3a')]=_['keys'](_0x21de67['query']);_0x5ab1c7[_0xe0bb('0x3b')]=_[_0xe0bb('0x3c')](_0x5ab1c7[_0xe0bb('0x40')],_0x5ab1c7[_0xe0bb('0x3a')]);_0x21d099[_0xe0bb('0x3d')]=_[_0xe0bb('0x3c')](_0x5ab1c7['model'],qs[_0xe0bb('0x3e')](_0x21de67['query']['fields']));_0x21d099['attributes']=_0x21d099['attributes'][_0xe0bb('0x3f')]?_0x21d099[_0xe0bb('0x3d')]:_0x5ab1c7[_0xe0bb('0x40')];_0x21d099[_0xe0bb('0x43')]=qs[_0xe0bb('0x44')](_0x21de67['query'][_0xe0bb('0x44')]);_0x21d099['where']=qs['filters'](_[_0xe0bb('0x6c')](_0x21de67['query'],_0x5ab1c7[_0xe0bb('0x3b')]));if(_0x21de67[_0xe0bb('0x3a')][_0xe0bb('0x48')]){_0x21d099[_0xe0bb('0x45')]=_['merge'](_0x21d099[_0xe0bb('0x45')],{'$or':_['map'](_0x21d099[_0xe0bb('0x3d')],function(_0x4473c6){var _0x252dec={};_0x252dec[_0x4473c6]={'$like':'%'+_0x21de67[_0xe0bb('0x3a')]['filter']+'%'};return _0x252dec;})});}_0x21d099=_[_0xe0bb('0x46')]({},_0x21d099,_0x21de67['options']);return _0x1bd130[_0xe0bb('0x6a')](_0x21d099);}})[_0xe0bb('0x2d')](function(_0x1dbe73){if(_0x1dbe73){_0x386d87=_0x1dbe73[_0xe0bb('0x3f')];if(!_0x21de67[_0xe0bb('0x3a')][_0xe0bb('0x41')](_0xe0bb('0x42'))){_0x21d099[_0xe0bb('0x24')]=qs['limit'](_0x21de67[_0xe0bb('0x3a')][_0xe0bb('0x24')]);_0x21d099[_0xe0bb('0x23')]=qs['offset'](_0x21de67[_0xe0bb('0x3a')][_0xe0bb('0x23')]);}return _0x1bd130['getTeams'](_0x21d099);}})[_0xe0bb('0x2d')](function(_0x3c98fb){if(_0x3c98fb){return _0x3c98fb?{'count':_0x386d87,'rows':_0x3c98fb}:null;}})[_0xe0bb('0x2d')](respondWithResult(_0x1ef7de,null))[_0xe0bb('0x4e')](handleError(_0x1ef7de,null));};exports['addTeams']=function(_0x8f9879,_0xdd9732,_0x130a91){var _0x4d993c=_0x8f9879[_0xe0bb('0x53')][_0xe0bb('0x6d')];return db[_0xe0bb('0x6b')][_0xe0bb('0x4c')]({'where':{'id':_0x4d993c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xe0bb('0x6e'),_0xe0bb('0x6f'),_0xe0bb('0x70')],'raw':!![]}]})['then'](function(_0x523142){if(_0x523142){var _0x3f3a64=_[_0xe0bb('0x71')](_0x523142,function(_0x158d58){var _0x2eb1bd=_0x158d58[_0xe0bb('0x2e')]({'plain':!![]});return _0x2eb1bd[_0xe0bb('0x72')];});return db[_0xe0bb('0x36')]['find']({'where':{'id':_0x8f9879[_0xe0bb('0x50')]['id']}})[_0xe0bb('0x2d')](function(_0x25f02f){return db['sequelize'][_0xe0bb('0x73')](function(_0x233893){return _0x25f02f[_0xe0bb('0x74')](_0x4d993c,{'transaction':_0x233893})[_0xe0bb('0x2d')](function(){return BPromise[_0xe0bb('0x75')](_0x3f3a64,function(_0x3ea87f){return db[_0xe0bb('0x5e')][_0xe0bb('0x76')]({'where':{'UserId':_0x3ea87f['id'],'FaxQueueId':_0x8f9879[_0xe0bb('0x50')]['id']},'transaction':_0x233893});});})['then'](function(){_0x3f3a64[_0xe0bb('0x77')](function(_0xaf3569){socket['emit']('userFaxQueue:save',{'UserId':_0xaf3569['id'],'FaxQueueId':_0x25f02f['id']});});});});});}})['then'](respondWithStatusCode(_0xdd9732,null))[_0xe0bb('0x4e')](handleError(_0xdd9732,null));};exports[_0xe0bb('0x78')]=function(_0x4a84f8,_0x10818d,_0x25bfe8){return db[_0xe0bb('0x6b')][_0xe0bb('0x4c')]({'where':{'id':_0x4a84f8[_0xe0bb('0x3a')][_0xe0bb('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0bb('0x72'),'attributes':['id'],'raw':!![]}]})[_0xe0bb('0x2d')](handleEntityNotFound(_0x10818d,null))['then'](function(_0x176b21){var _0x3528fa=_[_0xe0bb('0x35')](_0x176b21,'id');var _0x41ebf4=[];var _0x133aa4=[];var _0xaa0652=squel[_0xe0bb('0x79')]();_0xaa0652['field'](_0xe0bb('0x7a'))['from'](_0xe0bb('0x7b'),'tq')[_0xe0bb('0x7c')](_0xe0bb('0x7d'),'ut',_0xe0bb('0x7e'))[_0xe0bb('0x45')](_0xe0bb('0x7f'),_0x4a84f8[_0xe0bb('0x50')]['id']);for(var _0x2318b5=0x0;_0x2318b5<_0x176b21[_0xe0bb('0x3f')];_0x2318b5+=0x1){let _0x59f91b=_0x176b21[_0x2318b5];for(var _0x49bcd2=0x0;_0x49bcd2<_0x59f91b[_0xe0bb('0x72')][_0xe0bb('0x3f')];_0x49bcd2+=0x1){let _0x340d69=_0x59f91b[_0xe0bb('0x72')][_0x49bcd2];var _0x30e25e=_0xaa0652['clone']();_0x30e25e['where']('ut.UserId\x20=\x20?',_0x340d69['id']);_0x133aa4[_0xe0bb('0x80')](db['sequelize'][_0xe0bb('0x3a')](_0x30e25e[_0xe0bb('0x81')](),{'type':db['sequelize'][_0xe0bb('0x82')]['SELECT']})['then'](function(_0x1559c5){if(_0x1559c5[_0xe0bb('0x3f')]===0x1){return _0x340d69['id'];}else{var _0x273e1d=_[_0xe0bb('0x83')](_[_0xe0bb('0x35')](_0x1559c5,_0xe0bb('0x84')),function(_0x5be78b){return _[_0xe0bb('0x85')](_0x3528fa,_0x5be78b);});if(_0x273e1d){return _0x340d69['id'];}}}));}}return BPromise[_0xe0bb('0x86')](_0x133aa4)[_0xe0bb('0x2d')](function(_0x2c5858){_0x41ebf4=_(_0x41ebf4)[_0xe0bb('0x87')](_0x2c5858)[_0xe0bb('0x88')]()['value']();return db[_0xe0bb('0x36')][_0xe0bb('0x5b')]({'where':{'id':_0x4a84f8[_0xe0bb('0x50')]['id']}})[_0xe0bb('0x2d')](function(_0x1b11ba){return db[_0xe0bb('0x89')][_0xe0bb('0x73')](function(_0x571725){return _0x1b11ba[_0xe0bb('0x78')](_0x4a84f8[_0xe0bb('0x3a')][_0xe0bb('0x6d')],{'transaction':_0x571725})[_0xe0bb('0x2d')](function(){if(!_[_0xe0bb('0x8a')](_0x41ebf4)){return _0x1b11ba[_0xe0bb('0x8b')](_0x41ebf4,{'transaction':_0x571725});}})[_0xe0bb('0x2d')](function(){_0x41ebf4[_0xe0bb('0x77')](function(_0x5bc6ea){socket[_0xe0bb('0x8c')](_0xe0bb('0x8d'),{'UserId':_0x5bc6ea,'FaxQueueId':_0x1b11ba['id']});});});});});});})[_0xe0bb('0x2d')](respondWithStatusCode(_0x10818d,null))[_0xe0bb('0x4e')](handleError(_0x10818d,null));};exports[_0xe0bb('0x8e')]=function(_0x3a292f,_0x4909c1,_0xcf4ec2){return db[_0xe0bb('0x36')][_0xe0bb('0x5b')]({'where':{'id':_0x3a292f[_0xe0bb('0x50')]['id']}})[_0xe0bb('0x2d')](handleEntityNotFound(_0x4909c1,null))['then'](function(_0x957463){if(_0x957463){return _0x957463[_0xe0bb('0x8e')](_0x3a292f[_0xe0bb('0x53')][_0xe0bb('0x6d')],_['omit'](_0x3a292f[_0xe0bb('0x53')],['ids','id'])||{})[_0xe0bb('0x8f')](function(_0x54e5c9){for(var _0xcfced5=0x0;_0xcfced5<_0x3a292f[_0xe0bb('0x53')]['ids']['length'];_0xcfced5+=0x1){socket[_0xe0bb('0x8c')](_0xe0bb('0x90'),{'UserId':_0x3a292f[_0xe0bb('0x53')]['ids'][_0xcfced5],'FaxQueueId':_0x3a292f[_0xe0bb('0x50')]['id']});}return _0x54e5c9;});}})[_0xe0bb('0x2d')](respondWithResult(_0x4909c1,null))[_0xe0bb('0x4e')](handleError(_0x4909c1,null));};exports['removeAgents']=function(_0x2cde94,_0x3f74a2,_0x2b026c){return db[_0xe0bb('0x36')][_0xe0bb('0x5b')]({'where':{'id':_0x2cde94[_0xe0bb('0x50')]['id']}})[_0xe0bb('0x2d')](handleEntityNotFound(_0x3f74a2,null))[_0xe0bb('0x2d')](function(_0x2816eb){if(_0x2816eb){return _0x2816eb[_0xe0bb('0x8b')](_0x2cde94[_0xe0bb('0x3a')][_0xe0bb('0x6d')])[_0xe0bb('0x2d')](function(){if(_['isArray'](_0x2cde94[_0xe0bb('0x3a')][_0xe0bb('0x6d')])){for(var _0x1c3a1e=0x0;_0x1c3a1e<_0x2cde94[_0xe0bb('0x3a')]['ids']['length'];_0x1c3a1e+=0x1){socket[_0xe0bb('0x8c')](_0xe0bb('0x8d'),{'UserId':Number(_0x2cde94[_0xe0bb('0x3a')][_0xe0bb('0x6d')][_0x1c3a1e]),'FaxQueueId':Number(_0x2cde94[_0xe0bb('0x50')]['id'])});}}else{socket[_0xe0bb('0x8c')](_0xe0bb('0x8d'),{'UserId':Number(_0x2cde94[_0xe0bb('0x3a')][_0xe0bb('0x6d')]),'FaxQueueId':Number(_0x2cde94[_0xe0bb('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x3f74a2,null))['catch'](handleError(_0x3f74a2,null));};exports['getAgents']=function(_0x35b95d,_0xa26683,_0x525137){var _0x5178d8={};var _0x2ce698={};var _0x14347f;var _0x4f111c;return db[_0xe0bb('0x36')][_0xe0bb('0x5d')]({'where':{'id':_0x35b95d[_0xe0bb('0x50')]['id']}})['then'](handleEntityNotFound(_0xa26683,null))[_0xe0bb('0x2d')](function(_0x776474){if(_0x776474){_0x14347f=_0x776474;_0x2ce698['model']=_['keys'](db[_0xe0bb('0x60')][_0xe0bb('0x37')]);_0x2ce698[_0xe0bb('0x3a')]=_['keys'](_0x35b95d[_0xe0bb('0x3a')]);_0x2ce698[_0xe0bb('0x3b')]=_[_0xe0bb('0x3c')](_0x2ce698[_0xe0bb('0x40')],_0x2ce698[_0xe0bb('0x3a')]);_0x5178d8[_0xe0bb('0x3d')]=_['intersection'](_0x2ce698[_0xe0bb('0x40')],qs[_0xe0bb('0x3e')](_0x35b95d[_0xe0bb('0x3a')][_0xe0bb('0x3e')]));_0x5178d8[_0xe0bb('0x3d')]=_0x5178d8[_0xe0bb('0x3d')]['length']?_0x5178d8['attributes']:_0x2ce698['model'];_0x5178d8[_0xe0bb('0x43')]=qs[_0xe0bb('0x44')](_0x35b95d['query']['sort']);_0x5178d8[_0xe0bb('0x45')]=qs[_0xe0bb('0x3b')](_[_0xe0bb('0x6c')](_0x35b95d[_0xe0bb('0x3a')],_0x2ce698['filters']));if(_0x35b95d[_0xe0bb('0x3a')][_0xe0bb('0x48')]){_0x5178d8[_0xe0bb('0x45')]=_['merge'](_0x5178d8[_0xe0bb('0x45')],{'$or':_[_0xe0bb('0x35')](_0x5178d8[_0xe0bb('0x3d')],function(_0x4bf6cb){var _0x14d64f={};_0x14d64f[_0x4bf6cb]={'$like':'%'+_0x35b95d[_0xe0bb('0x3a')][_0xe0bb('0x48')]+'%'};return _0x14d64f;})});}_0x5178d8=_[_0xe0bb('0x46')]({},_0x5178d8,_0x35b95d[_0xe0bb('0x49')]);return _0x14347f[_0xe0bb('0x91')](_0x5178d8);}})[_0xe0bb('0x2d')](function(_0x4b6555){if(_0x4b6555){_0x4f111c=_0x4b6555[_0xe0bb('0x3f')];if(!_0x35b95d['query'][_0xe0bb('0x41')](_0xe0bb('0x42'))){_0x5178d8[_0xe0bb('0x24')]=qs['limit'](_0x35b95d[_0xe0bb('0x3a')][_0xe0bb('0x24')]);_0x5178d8[_0xe0bb('0x23')]=qs[_0xe0bb('0x23')](_0x35b95d[_0xe0bb('0x3a')][_0xe0bb('0x23')]);}return _0x14347f[_0xe0bb('0x91')](_0x5178d8);}})[_0xe0bb('0x2d')](function(_0x23f7ca){if(_0x23f7ca){return _0x23f7ca?{'count':_0x4f111c,'rows':_0x23f7ca}:null;}})[_0xe0bb('0x2d')](respondWithResult(_0xa26683,null))[_0xe0bb('0x4e')](handleError(_0xa26683,null));}; \ No newline at end of file +var _0x775e=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','findOne','UserFaxQueue','nolimit','pick','FaxQueueId','findAndCountAll','UserId','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','User','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','Team','ids','select','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','json','offset','limit','count','status','set','Content-Range','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','index','map','FaxQueue','rawAttributes','fieldName'];(function(_0x1f77b0,_0x44e4e7){var _0xcefa51=function(_0x2194d1){while(--_0x2194d1){_0x1f77b0['push'](_0x1f77b0['shift']());}};_0xcefa51(++_0x44e4e7);}(_0x775e,0xda));var _0xe775=function(_0x15dc01,_0x201222){_0x15dc01=_0x15dc01-0x0;var _0x303c2e=_0x775e[_0x15dc01];return _0x303c2e;};'use strict';var emlformat=require(_0xe775('0x0'));var rimraf=require(_0xe775('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe775('0x2'));var moment=require(_0xe775('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe775('0x4'));var util=require(_0xe775('0x5'));var path=require('path');var sox=require(_0xe775('0x6'));var csv=require(_0xe775('0x7'));var ejs=require(_0xe775('0x8'));var fs=require('fs');var fs_extra=require(_0xe775('0x9'));var _=require(_0xe775('0xa'));var squel=require(_0xe775('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe775('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe775('0xd'));var Papa=require('papaparse');var Redis=require(_0xe775('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe775('0xf'));var as=require(_0xe775('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe775('0x11'))(_0xe775('0x12'));var utils=require(_0xe775('0x13'));var config=require(_0xe775('0x14'));var licenseUtil=require(_0xe775('0x15'));var db=require(_0xe775('0x16'))['db'];config[_0xe775('0x17')]=_['defaults'](config[_0xe775('0x17')],{'host':_0xe775('0x18'),'port':0x18eb});var socket=require(_0xe775('0x19'))(new Redis(config[_0xe775('0x17')]));require(_0xe775('0x1a'))[_0xe775('0x1b')](socket);function respondWithStatusCode(_0x393a19,_0x363e5b){_0x363e5b=_0x363e5b||0xcc;return function(_0x312e86){if(_0x312e86){return _0x393a19[_0xe775('0x1c')](_0x363e5b);}return _0x393a19['status'](_0x363e5b)['end']();};}function respondWithResult(_0x50955b,_0x53605c){_0x53605c=_0x53605c||0xc8;return function(_0x3200e9){if(_0x3200e9){return _0x50955b['status'](_0x53605c)[_0xe775('0x1d')](_0x3200e9);}};}function respondWithFilteredResult(_0x5a1cfe,_0x250fae){return function(_0xf3720c){if(_0xf3720c){var _0x9165ec=typeof _0x250fae[_0xe775('0x1e')]==='undefined'&&typeof _0x250fae[_0xe775('0x1f')]==='undefined';var _0x20f909=_0xf3720c[_0xe775('0x20')];var _0x445633=_0x9165ec?0x0:_0x250fae[_0xe775('0x1e')];var _0x5efad1=_0x9165ec?_0xf3720c[_0xe775('0x20')]:_0x250fae[_0xe775('0x1e')]+_0x250fae[_0xe775('0x1f')];var _0x102ce7;if(_0x5efad1>=_0x20f909){_0x5efad1=_0x20f909;_0x102ce7=0xc8;}else{_0x102ce7=0xce;}_0x5a1cfe[_0xe775('0x21')](_0x102ce7);return _0x5a1cfe[_0xe775('0x22')](_0xe775('0x23'),_0x445633+'-'+_0x5efad1+'/'+_0x20f909)[_0xe775('0x1d')](_0xf3720c);}return null;};}function patchUpdates(_0x25ca8d){return function(_0x419fd2){try{jsonpatch[_0xe775('0x24')](_0x419fd2,_0x25ca8d,!![]);}catch(_0x3dda85){return BPromise['reject'](_0x3dda85);}return _0x419fd2[_0xe775('0x25')]();};}function saveUpdates(_0x4f4e40,_0x539ad8){return function(_0x6b0c1e){if(_0x6b0c1e){return _0x6b0c1e[_0xe775('0x26')](_0x4f4e40)[_0xe775('0x27')](function(_0x4b02c4){return _0x4b02c4;});}return null;};}function removeEntity(_0xb8ce4,_0x3d85b7){return function(_0x25336a){if(_0x25336a){return _0x25336a[_0xe775('0x28')]()['then'](function(){var _0x2d90fe=_0x25336a[_0xe775('0x29')]({'plain':!![]});var _0x18926e=_0xe775('0x2a');return db[_0xe775('0x2b')][_0xe775('0x28')]({'where':{'type':_0x18926e,'resourceId':_0x2d90fe['id']}})[_0xe775('0x27')](function(){return _0x25336a;});})['then'](function(){_0xb8ce4[_0xe775('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8e7a9c,_0x283670){return function(_0x929433){if(!_0x929433){_0x8e7a9c[_0xe775('0x1c')](0x194);}return _0x929433;};}function handleError(_0x4aedf1,_0x27a67c){_0x27a67c=_0x27a67c||0x1f4;return function(_0x1c4dfc){logger[_0xe775('0x2c')](_0x1c4dfc[_0xe775('0x2d')]);if(_0x1c4dfc[_0xe775('0x2e')]){delete _0x1c4dfc['name'];}_0x4aedf1['status'](_0x27a67c)['send'](_0x1c4dfc);};}exports[_0xe775('0x2f')]=function(_0x59310b,_0x5ea755){var _0x12728c={},_0x5ac2fa={},_0x2dd502={'count':0x0,'rows':[]};var _0x4b9287=_[_0xe775('0x30')](db[_0xe775('0x31')][_0xe775('0x32')],function(_0x474eb9){return{'name':_0x474eb9[_0xe775('0x33')],'type':_0x474eb9[_0xe775('0x34')][_0xe775('0x35')]};});_0x5ac2fa[_0xe775('0x36')]=_[_0xe775('0x30')](_0x4b9287,'name');_0x5ac2fa[_0xe775('0x37')]=_[_0xe775('0x38')](_0x59310b[_0xe775('0x37')]);_0x5ac2fa[_0xe775('0x39')]=_[_0xe775('0x3a')](_0x5ac2fa['model'],_0x5ac2fa[_0xe775('0x37')]);_0x12728c[_0xe775('0x3b')]=_[_0xe775('0x3a')](_0x5ac2fa[_0xe775('0x36')],qs[_0xe775('0x3c')](_0x59310b[_0xe775('0x37')][_0xe775('0x3c')]));_0x12728c[_0xe775('0x3b')]=_0x12728c[_0xe775('0x3b')][_0xe775('0x3d')]?_0x12728c[_0xe775('0x3b')]:_0x5ac2fa[_0xe775('0x36')];if(!_0x59310b['query'][_0xe775('0x3e')]('nolimit')){_0x12728c['limit']=qs[_0xe775('0x1f')](_0x59310b[_0xe775('0x37')][_0xe775('0x1f')]);_0x12728c[_0xe775('0x1e')]=qs['offset'](_0x59310b[_0xe775('0x37')][_0xe775('0x1e')]);}_0x12728c[_0xe775('0x3f')]=qs[_0xe775('0x40')](_0x59310b[_0xe775('0x37')][_0xe775('0x40')]);_0x12728c[_0xe775('0x41')]=qs[_0xe775('0x39')](_['pick'](_0x59310b[_0xe775('0x37')],_0x5ac2fa['filters']),_0x4b9287);if(_0x59310b[_0xe775('0x37')][_0xe775('0x42')]){_0x12728c[_0xe775('0x41')]=_[_0xe775('0x43')](_0x12728c['where'],{'$or':_['map'](_0x4b9287,function(_0x24f8b0){if(_0x24f8b0[_0xe775('0x34')]!==_0xe775('0x44')){var _0x21fd01={};_0x21fd01[_0x24f8b0[_0xe775('0x2e')]]={'$like':'%'+_0x59310b[_0xe775('0x37')][_0xe775('0x42')]+'%'};return _0x21fd01;}})});}_0x12728c=_[_0xe775('0x43')]({},_0x12728c,_0x59310b[_0xe775('0x45')]);var _0x289f13={'where':_0x12728c['where']};return db[_0xe775('0x31')][_0xe775('0x20')](_0x289f13)[_0xe775('0x27')](function(_0x4df8d8){_0x2dd502[_0xe775('0x20')]=_0x4df8d8;if(_0x59310b['query'][_0xe775('0x46')]){_0x12728c[_0xe775('0x47')]=[{'all':!![]}];}return db['FaxQueue'][_0xe775('0x48')](_0x12728c);})[_0xe775('0x27')](function(_0x5b5567){_0x2dd502[_0xe775('0x49')]=_0x5b5567;return _0x2dd502;})[_0xe775('0x27')](respondWithFilteredResult(_0x5ea755,_0x12728c))[_0xe775('0x4a')](handleError(_0x5ea755,null));};exports['show']=function(_0x302c87,_0x53d02e){var _0x2abe80={'raw':!![],'where':{'id':_0x302c87[_0xe775('0x4b')]['id']}},_0x5cbfdd={};_0x5cbfdd['model']=_[_0xe775('0x38')](db['FaxQueue']['rawAttributes']);_0x5cbfdd[_0xe775('0x37')]=_[_0xe775('0x38')](_0x302c87[_0xe775('0x37')]);_0x5cbfdd['filters']=_[_0xe775('0x3a')](_0x5cbfdd['model'],_0x5cbfdd[_0xe775('0x37')]);_0x2abe80['attributes']=_[_0xe775('0x3a')](_0x5cbfdd['model'],qs['fields'](_0x302c87[_0xe775('0x37')][_0xe775('0x3c')]));_0x2abe80[_0xe775('0x3b')]=_0x2abe80['attributes'][_0xe775('0x3d')]?_0x2abe80[_0xe775('0x3b')]:_0x5cbfdd['model'];if(_0x302c87[_0xe775('0x37')]['includeAll']){_0x2abe80[_0xe775('0x47')]=[{'all':!![]}];}_0x2abe80=_[_0xe775('0x43')]({},_0x2abe80,_0x302c87[_0xe775('0x45')]);return db[_0xe775('0x31')][_0xe775('0x4c')](_0x2abe80)[_0xe775('0x27')](handleEntityNotFound(_0x53d02e,null))[_0xe775('0x27')](respondWithResult(_0x53d02e,null))['catch'](handleError(_0x53d02e,null));};exports[_0xe775('0x4d')]=function(_0x4d7a1f,_0x41696b){return db['FaxQueue'][_0xe775('0x4d')](_0x4d7a1f[_0xe775('0x4e')],{})[_0xe775('0x27')](function(_0x3b3e76){var _0x51428f=_0x4d7a1f['user']['get']({'plain':!![]});if(!_0x51428f)throw new Error(_0xe775('0x4f'));if(_0x51428f[_0xe775('0x50')]===_0xe775('0x51')){var _0x56daaf=_0x3b3e76[_0xe775('0x29')]({'plain':!![]});var _0x5f25d9='FaxQueues';return db[_0xe775('0x52')][_0xe775('0x4c')]({'where':{'name':_0x5f25d9,'userProfileId':_0x51428f[_0xe775('0x53')]},'raw':!![]})[_0xe775('0x27')](function(_0x16f8c2){if(_0x16f8c2&&_0x16f8c2[_0xe775('0x54')]===0x0){return db['UserProfileResource'][_0xe775('0x4d')]({'name':_0x56daaf[_0xe775('0x2e')],'resourceId':_0x56daaf['id'],'type':_0x16f8c2[_0xe775('0x2e')],'sectionId':_0x16f8c2['id']},{})['then'](function(){return _0x3b3e76;});}else{return _0x3b3e76;}})[_0xe775('0x4a')](function(_0x181ae4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x181ae4);throw _0x181ae4;});}return _0x3b3e76;})['then'](respondWithResult(_0x41696b,0xc9))['catch'](handleError(_0x41696b,null));};exports[_0xe775('0x26')]=function(_0x40963d,_0x956ec9){if(_0x40963d['body']['id']){delete _0x40963d['body']['id'];}return db['FaxQueue']['find']({'where':{'id':_0x40963d['params']['id']}})[_0xe775('0x27')](handleEntityNotFound(_0x956ec9,null))[_0xe775('0x27')](saveUpdates(_0x40963d[_0xe775('0x4e')],null))['then'](respondWithResult(_0x956ec9,null))['catch'](handleError(_0x956ec9,null));};exports[_0xe775('0x28')]=function(_0x4a04be,_0x114238){return db[_0xe775('0x31')][_0xe775('0x4c')]({'where':{'id':_0x4a04be['params']['id']}})[_0xe775('0x27')](handleEntityNotFound(_0x114238,null))['then'](removeEntity(_0x114238,null))[_0xe775('0x4a')](handleError(_0x114238,null));};exports['describe']=function(_0x251137,_0x3ac855){return db[_0xe775('0x31')]['describe']()[_0xe775('0x27')](respondWithResult(_0x3ac855,null))[_0xe775('0x4a')](handleError(_0x3ac855,null));};exports['getMembers']=function(_0x1cf14a,_0xaf64ac,_0x41d785){var _0x57ee18={'raw':!![],'where':{}},_0x5684a2={},_0x217958;return db[_0xe775('0x31')][_0xe775('0x55')]({'where':{'id':_0x1cf14a[_0xe775('0x4b')]['id']}})[_0xe775('0x27')](handleEntityNotFound(_0xaf64ac,null))[_0xe775('0x27')](function(_0xe0f120){if(_0xe0f120){_0x217958=_0xe0f120['get']({'plain':!![]});_0x5684a2[_0xe775('0x36')]=_[_0xe775('0x38')](db[_0xe775('0x56')][_0xe775('0x32')]);_0x5684a2[_0xe775('0x37')]=_[_0xe775('0x38')](_0x1cf14a[_0xe775('0x37')]);_0x5684a2[_0xe775('0x39')]=_[_0xe775('0x3a')](_0x5684a2['model'],_0x5684a2[_0xe775('0x37')]);_0x57ee18[_0xe775('0x3b')]=_[_0xe775('0x3a')](_0x5684a2[_0xe775('0x36')],qs[_0xe775('0x3c')](_0x1cf14a[_0xe775('0x37')][_0xe775('0x3c')]));_0x57ee18['attributes']=_0x57ee18[_0xe775('0x3b')][_0xe775('0x3d')]?_0x57ee18[_0xe775('0x3b')]:_0x5684a2[_0xe775('0x36')];if(!_0x1cf14a[_0xe775('0x37')]['hasOwnProperty'](_0xe775('0x57'))){_0x57ee18[_0xe775('0x1f')]=qs[_0xe775('0x1f')](_0x1cf14a[_0xe775('0x37')][_0xe775('0x1f')]);_0x57ee18['offset']=qs[_0xe775('0x1e')](_0x1cf14a['query'][_0xe775('0x1e')]);}_0x57ee18[_0xe775('0x3f')]=qs['sort'](_0x1cf14a['query'][_0xe775('0x40')]);_0x57ee18[_0xe775('0x41')]=qs['filters'](_[_0xe775('0x58')](_0x1cf14a[_0xe775('0x37')],_0x5684a2[_0xe775('0x39')]));_0x57ee18[_0xe775('0x41')][_0xe775('0x59')]=_0xe0f120['id'];if(_0x1cf14a[_0xe775('0x37')][_0xe775('0x42')]){_0x57ee18['where']=_[_0xe775('0x43')](_0x57ee18[_0xe775('0x41')],{'$or':_[_0xe775('0x30')](_0x57ee18[_0xe775('0x3b')],function(_0x4cd349){var _0x36235c={};_0x36235c[_0x4cd349]={'$like':'%'+_0x1cf14a['query']['filter']+'%'};return _0x36235c;})});}_0x57ee18=_[_0xe775('0x43')]({},_0x57ee18,_0x1cf14a[_0xe775('0x45')]);return db[_0xe775('0x56')]['findAll'](_0x57ee18);}})[_0xe775('0x27')](function(_0x3a01b4){if(_0x3a01b4){return db['User'][_0xe775('0x5a')]({'where':{'id':_[_0xe775('0x30')](_0x3a01b4,_0xe775('0x5b')),'role':'agent'},'attributes':['id',_0xe775('0x2e'),_0xe775('0x5c'),_0xe775('0x5d'),'createdAt']});}})[_0xe775('0x27')](function(_0x231926){if(_0x231926){return{'count':_0x231926['count'],'rows':_[_0xe775('0x30')](_0x231926[_0xe775('0x49')],function(_0x557d77){return{'membername':_0x557d77[_0xe775('0x2e')],'UserId':_0x557d77['id'],'queue_name':_0x217958[_0xe775('0x2e')],'FaxQueueId':_0x217958['id'],'interface':util[_0xe775('0x5e')](_0xe775('0x5f'),_0xe775('0x60'),_0x557d77['name']),'penalty':0x0,'paused':_0x557d77[_0xe775('0x5c')],'createdAt':_0x557d77[_0xe775('0x61')],'updatedAt':_0x557d77['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe775('0x27')](respondWithFilteredResult(_0xaf64ac,_0x57ee18))[_0xe775('0x4a')](handleError(_0xaf64ac,null));};exports[_0xe775('0x62')]=function(_0x194f11,_0x5e64c0,_0xc239b5){var _0x4fcd85={};var _0xd2226f={};var _0x19491f;var _0x1adbe9;return db[_0xe775('0x31')][_0xe775('0x55')]({'where':{'id':_0x194f11[_0xe775('0x4b')]['id']}})[_0xe775('0x27')](handleEntityNotFound(_0x5e64c0,null))['then'](function(_0x2009c9){if(_0x2009c9){_0x19491f=_0x2009c9;_0xd2226f[_0xe775('0x36')]=_[_0xe775('0x38')](db['Team'][_0xe775('0x32')]);_0xd2226f[_0xe775('0x37')]=_[_0xe775('0x38')](_0x194f11[_0xe775('0x37')]);_0xd2226f['filters']=_[_0xe775('0x3a')](_0xd2226f[_0xe775('0x36')],_0xd2226f[_0xe775('0x37')]);_0x4fcd85[_0xe775('0x3b')]=_[_0xe775('0x3a')](_0xd2226f[_0xe775('0x36')],qs[_0xe775('0x3c')](_0x194f11[_0xe775('0x37')]['fields']));_0x4fcd85[_0xe775('0x3b')]=_0x4fcd85[_0xe775('0x3b')][_0xe775('0x3d')]?_0x4fcd85[_0xe775('0x3b')]:_0xd2226f['model'];_0x4fcd85[_0xe775('0x3f')]=qs[_0xe775('0x40')](_0x194f11[_0xe775('0x37')][_0xe775('0x40')]);_0x4fcd85[_0xe775('0x41')]=qs['filters'](_[_0xe775('0x58')](_0x194f11['query'],_0xd2226f['filters']));if(_0x194f11[_0xe775('0x37')][_0xe775('0x42')]){_0x4fcd85['where']=_['merge'](_0x4fcd85['where'],{'$or':_[_0xe775('0x30')](_0x4fcd85[_0xe775('0x3b')],function(_0x5cee45){var _0x10d6c3={};_0x10d6c3[_0x5cee45]={'$like':'%'+_0x194f11[_0xe775('0x37')][_0xe775('0x42')]+'%'};return _0x10d6c3;})});}_0x4fcd85=_[_0xe775('0x43')]({},_0x4fcd85,_0x194f11[_0xe775('0x45')]);return _0x19491f['getTeams'](_0x4fcd85);}})[_0xe775('0x27')](function(_0x1767eb){if(_0x1767eb){_0x1adbe9=_0x1767eb['length'];if(!_0x194f11[_0xe775('0x37')]['hasOwnProperty'](_0xe775('0x57'))){_0x4fcd85[_0xe775('0x1f')]=qs[_0xe775('0x1f')](_0x194f11['query'][_0xe775('0x1f')]);_0x4fcd85[_0xe775('0x1e')]=qs[_0xe775('0x1e')](_0x194f11[_0xe775('0x37')][_0xe775('0x1e')]);}return _0x19491f[_0xe775('0x62')](_0x4fcd85);}})['then'](function(_0x53dacb){if(_0x53dacb){return _0x53dacb?{'count':_0x1adbe9,'rows':_0x53dacb}:null;}})[_0xe775('0x27')](respondWithResult(_0x5e64c0,null))['catch'](handleError(_0x5e64c0,null));};exports['addTeams']=function(_0x153019,_0x48049c,_0x19464e){var _0x5b459=_0x153019[_0xe775('0x4e')]['ids'];return db['Team'][_0xe775('0x48')]({'where':{'id':_0x5b459},'attributes':['id'],'include':[{'model':db[_0xe775('0x63')],'as':_0xe775('0x64'),'attributes':['id','name',_0xe775('0x65'),_0xe775('0x66'),_0xe775('0x67')],'raw':!![]}]})['then'](function(_0x32262f){if(_0x32262f){var _0x1bc09f=_['flatMap'](_0x32262f,function(_0x53e6fe){var _0x1aa87a=_0x53e6fe[_0xe775('0x29')]({'plain':!![]});return _0x1aa87a[_0xe775('0x64')];});return db[_0xe775('0x31')]['find']({'where':{'id':_0x153019[_0xe775('0x4b')]['id']}})['then'](function(_0x1fe553){return db[_0xe775('0x68')][_0xe775('0x69')](function(_0x3e2378){return _0x1fe553['addTeams'](_0x5b459,{'transaction':_0x3e2378})[_0xe775('0x27')](function(){return BPromise[_0xe775('0x6a')](_0x1bc09f,function(_0x1949b2){return db[_0xe775('0x56')][_0xe775('0x6b')]({'where':{'UserId':_0x1949b2['id'],'FaxQueueId':_0x153019['params']['id']},'transaction':_0x3e2378});});})[_0xe775('0x27')](function(){_0x1bc09f[_0xe775('0x6c')](function(_0x4112d9){socket[_0xe775('0x6d')](_0xe775('0x6e'),{'UserId':_0x4112d9['id'],'FaxQueueId':_0x1fe553['id']});});});});});}})[_0xe775('0x27')](respondWithStatusCode(_0x48049c,null))[_0xe775('0x4a')](handleError(_0x48049c,null));};exports[_0xe775('0x6f')]=function(_0x61307b,_0x12a7f5,_0x3c8bd4){return db[_0xe775('0x70')]['findAll']({'where':{'id':_0x61307b[_0xe775('0x37')][_0xe775('0x71')]},'attributes':['id'],'include':[{'model':db[_0xe775('0x63')],'as':_0xe775('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x12a7f5,null))[_0xe775('0x27')](function(_0x26e239){var _0x1e79b8=_['map'](_0x26e239,'id');var _0x27f00a=[];var _0x5a61d7=[];var _0x3f18b3=squel[_0xe775('0x72')]();_0x3f18b3['field']('tq.TeamId')['from'](_0xe775('0x73'),'tq')[_0xe775('0x74')]('user_has_teams','ut',_0xe775('0x75'))['where'](_0xe775('0x76'),_0x61307b[_0xe775('0x4b')]['id']);for(var _0x3edca3=0x0;_0x3edca3<_0x26e239['length'];_0x3edca3+=0x1){let _0x5299a2=_0x26e239[_0x3edca3];for(var _0x41becc=0x0;_0x41becc<_0x5299a2[_0xe775('0x64')][_0xe775('0x3d')];_0x41becc+=0x1){let _0x265bed=_0x5299a2[_0xe775('0x64')][_0x41becc];var _0xfe2a39=_0x3f18b3[_0xe775('0x77')]();_0xfe2a39[_0xe775('0x41')](_0xe775('0x78'),_0x265bed['id']);_0x5a61d7[_0xe775('0x79')](db['sequelize'][_0xe775('0x37')](_0xfe2a39[_0xe775('0x7a')](),{'type':db[_0xe775('0x68')]['QueryTypes'][_0xe775('0x7b')]})['then'](function(_0x2affb7){if(_0x2affb7[_0xe775('0x3d')]===0x1){return _0x265bed['id'];}else{var _0xbe49ab=_[_0xe775('0x7c')](_['map'](_0x2affb7,'TeamId'),function(_0x39ee0d){return _[_0xe775('0x7d')](_0x1e79b8,_0x39ee0d);});if(_0xbe49ab){return _0x265bed['id'];}}}));}}return BPromise[_0xe775('0x7e')](_0x5a61d7)[_0xe775('0x27')](function(_0x4bdc17){_0x27f00a=_(_0x27f00a)['union'](_0x4bdc17)[_0xe775('0x7f')]()[_0xe775('0x80')]();return db[_0xe775('0x31')][_0xe775('0x4c')]({'where':{'id':_0x61307b[_0xe775('0x4b')]['id']}})[_0xe775('0x27')](function(_0x1f82ae){return db[_0xe775('0x68')][_0xe775('0x69')](function(_0x5bd01e){return _0x1f82ae[_0xe775('0x6f')](_0x61307b[_0xe775('0x37')]['ids'],{'transaction':_0x5bd01e})['then'](function(){if(!_['isEmpty'](_0x27f00a)){return _0x1f82ae[_0xe775('0x81')](_0x27f00a,{'transaction':_0x5bd01e});}})[_0xe775('0x27')](function(){_0x27f00a[_0xe775('0x6c')](function(_0x27142a){socket[_0xe775('0x6d')](_0xe775('0x82'),{'UserId':_0x27142a,'FaxQueueId':_0x1f82ae['id']});});});});});});})[_0xe775('0x27')](respondWithStatusCode(_0x12a7f5,null))[_0xe775('0x4a')](handleError(_0x12a7f5,null));};exports[_0xe775('0x83')]=function(_0x5863f6,_0x14b4ba,_0x4b769f){return db[_0xe775('0x31')][_0xe775('0x4c')]({'where':{'id':_0x5863f6[_0xe775('0x4b')]['id']}})['then'](handleEntityNotFound(_0x14b4ba,null))[_0xe775('0x27')](function(_0x2a06c6){if(_0x2a06c6){return _0x2a06c6[_0xe775('0x83')](_0x5863f6['body'][_0xe775('0x71')],_[_0xe775('0x84')](_0x5863f6[_0xe775('0x4e')],[_0xe775('0x71'),'id'])||{})[_0xe775('0x85')](function(_0x1c9c79){for(var _0x47ba20=0x0;_0x47ba20<_0x5863f6[_0xe775('0x4e')]['ids']['length'];_0x47ba20+=0x1){socket[_0xe775('0x6d')](_0xe775('0x6e'),{'UserId':_0x5863f6[_0xe775('0x4e')][_0xe775('0x71')][_0x47ba20],'FaxQueueId':_0x5863f6['params']['id']});}return _0x1c9c79;});}})['then'](respondWithResult(_0x14b4ba,null))[_0xe775('0x4a')](handleError(_0x14b4ba,null));};exports[_0xe775('0x81')]=function(_0x3f0bdb,_0x5e2b09,_0x48bc3f){return db['FaxQueue']['find']({'where':{'id':_0x3f0bdb[_0xe775('0x4b')]['id']}})[_0xe775('0x27')](handleEntityNotFound(_0x5e2b09,null))[_0xe775('0x27')](function(_0x3ba1bc){if(_0x3ba1bc){return _0x3ba1bc['removeAgents'](_0x3f0bdb['query'][_0xe775('0x71')])['then'](function(){if(_['isArray'](_0x3f0bdb[_0xe775('0x37')][_0xe775('0x71')])){for(var _0x47ffe8=0x0;_0x47ffe8<_0x3f0bdb[_0xe775('0x37')][_0xe775('0x71')][_0xe775('0x3d')];_0x47ffe8+=0x1){socket['emit'](_0xe775('0x82'),{'UserId':Number(_0x3f0bdb[_0xe775('0x37')][_0xe775('0x71')][_0x47ffe8]),'FaxQueueId':Number(_0x3f0bdb[_0xe775('0x4b')]['id'])});}}else{socket['emit'](_0xe775('0x82'),{'UserId':Number(_0x3f0bdb['query']['ids']),'FaxQueueId':Number(_0x3f0bdb[_0xe775('0x4b')]['id'])});}});}})[_0xe775('0x27')](respondWithStatusCode(_0x5e2b09,null))[_0xe775('0x4a')](handleError(_0x5e2b09,null));};exports['getAgents']=function(_0x22d9d5,_0x125e90,_0x56a1e7){var _0x1bf51={};var _0x588750={};var _0x2a5e63;var _0x4f68e0;return db['FaxQueue'][_0xe775('0x55')]({'where':{'id':_0x22d9d5[_0xe775('0x4b')]['id']}})[_0xe775('0x27')](handleEntityNotFound(_0x125e90,null))[_0xe775('0x27')](function(_0x288fd1){if(_0x288fd1){_0x2a5e63=_0x288fd1;_0x588750[_0xe775('0x36')]=_[_0xe775('0x38')](db[_0xe775('0x63')][_0xe775('0x32')]);_0x588750[_0xe775('0x37')]=_[_0xe775('0x38')](_0x22d9d5['query']);_0x588750['filters']=_['intersection'](_0x588750['model'],_0x588750['query']);_0x1bf51[_0xe775('0x3b')]=_['intersection'](_0x588750['model'],qs['fields'](_0x22d9d5[_0xe775('0x37')][_0xe775('0x3c')]));_0x1bf51[_0xe775('0x3b')]=_0x1bf51[_0xe775('0x3b')][_0xe775('0x3d')]?_0x1bf51[_0xe775('0x3b')]:_0x588750['model'];_0x1bf51[_0xe775('0x3f')]=qs[_0xe775('0x40')](_0x22d9d5['query'][_0xe775('0x40')]);_0x1bf51[_0xe775('0x41')]=qs['filters'](_[_0xe775('0x58')](_0x22d9d5[_0xe775('0x37')],_0x588750['filters']));if(_0x22d9d5[_0xe775('0x37')][_0xe775('0x42')]){_0x1bf51[_0xe775('0x41')]=_[_0xe775('0x43')](_0x1bf51['where'],{'$or':_[_0xe775('0x30')](_0x1bf51[_0xe775('0x3b')],function(_0x1cf0cc){var _0x40db4c={};_0x40db4c[_0x1cf0cc]={'$like':'%'+_0x22d9d5[_0xe775('0x37')]['filter']+'%'};return _0x40db4c;})});}_0x1bf51=_[_0xe775('0x43')]({},_0x1bf51,_0x22d9d5['options']);return _0x2a5e63[_0xe775('0x86')](_0x1bf51);}})[_0xe775('0x27')](function(_0x6259b3){if(_0x6259b3){_0x4f68e0=_0x6259b3[_0xe775('0x3d')];if(!_0x22d9d5[_0xe775('0x37')][_0xe775('0x3e')](_0xe775('0x57'))){_0x1bf51[_0xe775('0x1f')]=qs[_0xe775('0x1f')](_0x22d9d5[_0xe775('0x37')]['limit']);_0x1bf51[_0xe775('0x1e')]=qs[_0xe775('0x1e')](_0x22d9d5[_0xe775('0x37')][_0xe775('0x1e')]);}return _0x2a5e63[_0xe775('0x86')](_0x1bf51);}})[_0xe775('0x27')](function(_0x271822){if(_0x271822){return _0x271822?{'count':_0x4f68e0,'rows':_0x271822}:null;}})['then'](respondWithResult(_0x125e90,null))[_0xe775('0x4a')](handleError(_0x125e90,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 8f4cd26..7fb644f 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 _0x9025=['update','remove','emit','hasOwnProperty','hook','exports','events','FaxQueue','save'];(function(_0x16df8f,_0x3dbe15){var _0x56ffee=function(_0x23aa44){while(--_0x23aa44){_0x16df8f['push'](_0x16df8f['shift']());}};_0x56ffee(++_0x3dbe15);}(_0x9025,0x1ad));var _0x5902=function(_0xbf04eb,_0x22bd08){_0xbf04eb=_0xbf04eb-0x0;var _0x539894=_0x9025[_0xbf04eb];return _0x539894;};'use strict';var EventEmitter=require(_0x5902('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x5902('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5902('0x2'),'afterUpdate':_0x5902('0x3'),'afterDestroy':_0x5902('0x4')};function emitEvent(_0x50f770){return function(_0x87e6b4,_0x59a257,_0x476afe){FaxQueueEvents[_0x5902('0x5')](_0x50f770+':'+_0x87e6b4['id'],_0x87e6b4);FaxQueueEvents[_0x5902('0x5')](_0x50f770,_0x87e6b4);_0x476afe(null);};}for(var e in events){if(events[_0x5902('0x6')](e)){var event=events[e];FaxQueue[_0x5902('0x7')](e,emitEvent(event));}}module[_0x5902('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xd989=['../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit','hook','events'];(function(_0x432411,_0x4201bd){var _0x1e3942=function(_0x30ce10){while(--_0x30ce10){_0x432411['push'](_0x432411['shift']());}};_0x1e3942(++_0x4201bd);}(_0xd989,0x147));var _0x9d98=function(_0x1d8468,_0x524250){_0x1d8468=_0x1d8468-0x0;var _0x3c7e0a=_0xd989[_0x1d8468];return _0x3c7e0a;};'use strict';var EventEmitter=require(_0x9d98('0x0'));var FaxQueue=require(_0x9d98('0x1'))['db'][_0x9d98('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9d98('0x3')](0x0);var events={'afterCreate':_0x9d98('0x4'),'afterUpdate':'update','afterDestroy':_0x9d98('0x5')};function emitEvent(_0x124333){return function(_0x522f38,_0x3aa254,_0x69f821){FaxQueueEvents[_0x9d98('0x6')](_0x124333+':'+_0x522f38['id'],_0x522f38);FaxQueueEvents[_0x9d98('0x6')](_0x124333,_0x522f38);_0x69f821(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x9d98('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index d9a00b4..12d2b91 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 _0x86ec=['exports','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueue.attributes'];(function(_0x256827,_0xc5c033){var _0x41efa8=function(_0x5eb4f2){while(--_0x5eb4f2){_0x256827['push'](_0x256827['shift']());}};_0x41efa8(++_0xc5c033);}(_0x86ec,0x162));var _0xc86e=function(_0x29a32f,_0x3d07b8){_0x29a32f=_0x29a32f-0x0;var _0x376321=_0x86ec[_0x29a32f];return _0x376321;};'use strict';var _=require(_0xc86e('0x0'));var util=require(_0xc86e('0x1'));var logger=require(_0xc86e('0x2'))(_0xc86e('0x3'));var moment=require(_0xc86e('0x4'));var BPromise=require(_0xc86e('0x5'));var rp=require(_0xc86e('0x6'));var fs=require('fs');var path=require(_0xc86e('0x7'));var rimraf=require('rimraf');var config=require(_0xc86e('0x8'));var attributes=require(_0xc86e('0x9'));module[_0xc86e('0xa')]=function(_0x27baf3,_0x16f63f){return _0x27baf3['define'](_0xc86e('0xb'),attributes,{'tableName':_0xc86e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd751=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','FaxQueue','fax_queues','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd751,0xb2));var _0x1d75=function(_0x26ff84,_0x55f92d){_0x26ff84=_0x26ff84-0x0;var _0x585e43=_0xd751[_0x26ff84];return _0x585e43;};'use strict';var _=require(_0x1d75('0x0'));var util=require(_0x1d75('0x1'));var logger=require('../../config/logger')(_0x1d75('0x2'));var moment=require(_0x1d75('0x3'));var BPromise=require('bluebird');var rp=require(_0x1d75('0x4'));var fs=require('fs');var path=require(_0x1d75('0x5'));var rimraf=require(_0x1d75('0x6'));var config=require(_0x1d75('0x7'));var attributes=require('./faxQueue.attributes');module[_0x1d75('0x8')]=function(_0x3b8b4a,_0x30c159){return _0x3b8b4a[_0x1d75('0x9')](_0x1d75('0xa'),attributes,{'tableName':_0x1d75('0xb'),'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 ea880c2..eadce87 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 _0xeaba=['socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x179714,_0x4411de){var _0x191127=function(_0x4ed8cd){while(--_0x4ed8cd){_0x179714['push'](_0x179714['shift']());}};_0x191127(++_0x4411de);}(_0xeaba,0x92));var _0xaeab=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xeaba[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xaeab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaeab('0x1'));var rs=require(_0xaeab('0x2'));var fs=require('fs');var Redis=require(_0xaeab('0x3'));var db=require(_0xaeab('0x4'))['db'];var utils=require(_0xaeab('0x5'));var logger=require(_0xaeab('0x6'))(_0xaeab('0x7'));var config=require(_0xaeab('0x8'));var jayson=require(_0xaeab('0x9'));var client=jayson[_0xaeab('0xa')][_0xaeab('0xb')]({'port':0x232a});config[_0xaeab('0xc')]=_[_0xaeab('0xd')](config[_0xaeab('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xaeab('0xe'))(new Redis(config[_0xaeab('0xc')]));require('./faxQueue.socket')[_0xaeab('0xf')](socket);function respondWithRpcPromise(_0x4f2a58,_0x383116,_0x29687a){return new BPromise(function(_0x141034,_0x1de832){return client['request'](_0x4f2a58,_0x29687a)[_0xaeab('0x10')](function(_0x2865a){logger[_0xaeab('0x11')](_0xaeab('0x12'),_0x383116,_0xaeab('0x13'));logger[_0xaeab('0x14')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x383116,_0xaeab('0x13'),JSON[_0xaeab('0x15')](_0x2865a));if(_0x2865a[_0xaeab('0x16')]){if(_0x2865a[_0xaeab('0x16')][_0xaeab('0x17')]===0x1f4){logger[_0xaeab('0x16')](_0xaeab('0x12'),_0x383116,_0x2865a[_0xaeab('0x16')][_0xaeab('0x18')]);return _0x1de832(_0x2865a[_0xaeab('0x16')]['message']);}logger[_0xaeab('0x16')](_0xaeab('0x12'),_0x383116,_0x2865a[_0xaeab('0x16')][_0xaeab('0x18')]);return _0x141034(_0x2865a[_0xaeab('0x16')]['message']);}else{logger[_0xaeab('0x11')](_0xaeab('0x12'),_0x383116,'request\x20sent');_0x141034(_0x2865a[_0xaeab('0x19')]['message']);}})[_0xaeab('0x1a')](function(_0x30d5ed){logger['error'](_0xaeab('0x12'),_0x383116,_0x30d5ed);_0x1de832(_0x30d5ed);});});}exports[_0xaeab('0x1b')]=function(_0x189edd){var _0x25c783=this;return new Promise(function(_0x41ab1a,_0xf1a2c2){return db[_0xaeab('0x1c')][_0xaeab('0x1d')]({'raw':_0x189edd[_0xaeab('0x1e')]?_0x189edd['options'][_0xaeab('0x1f')]===undefined?!![]:![]:!![],'where':_0x189edd[_0xaeab('0x1e')]?_0x189edd[_0xaeab('0x1e')][_0xaeab('0x20')]||null:null,'attributes':_0x189edd[_0xaeab('0x1e')]?_0x189edd[_0xaeab('0x1e')][_0xaeab('0x21')]||null:null,'limit':_0x189edd[_0xaeab('0x1e')]?_0x189edd[_0xaeab('0x1e')][_0xaeab('0x22')]||null:null,'include':_0x189edd[_0xaeab('0x1e')]?_0x189edd[_0xaeab('0x1e')][_0xaeab('0x23')]?_[_0xaeab('0x24')](_0x189edd[_0xaeab('0x1e')]['include'],function(_0x81e62a){return{'model':db[_0x81e62a[_0xaeab('0x25')]],'as':_0x81e62a['as'],'attributes':_0x81e62a[_0xaeab('0x21')],'include':_0x81e62a[_0xaeab('0x23')]?_['map'](_0x81e62a['include'],function(_0x4ab79b){return{'model':db[_0x4ab79b['model']],'as':_0x4ab79b['as'],'attributes':_0x4ab79b['attributes'],'include':_0x4ab79b['include']?_[_0xaeab('0x24')](_0x4ab79b['include'],function(_0x4085ae){return{'model':db[_0x4085ae[_0xaeab('0x25')]],'as':_0x4085ae['as'],'attributes':_0x4085ae[_0xaeab('0x21')]};}):[]};}):[]};}):[]:[]})[_0xaeab('0x10')](function(_0x23acd2){logger[_0xaeab('0x11')](_0xaeab('0x1b'),_0x189edd);logger[_0xaeab('0x14')](_0xaeab('0x1b'),_0x189edd,JSON[_0xaeab('0x15')](_0x23acd2));_0x41ab1a(_0x23acd2);})[_0xaeab('0x1a')](function(_0x5f7de2){logger['error'](_0xaeab('0x1b'),_0x5f7de2['message'],_0x189edd);_0xf1a2c2(_0x25c783[_0xaeab('0x16')](0x1f4,_0x5f7de2[_0xaeab('0x18')]));});});};exports[_0xaeab('0x26')]=function(_0x4d8c23){var _0x57d494=this;return new Promise(function(_0x2a77f6,_0x12ec3a){return db[_0xaeab('0x1c')][_0xaeab('0x27')]({'raw':_0x4d8c23['options']?_0x4d8c23['options'][_0xaeab('0x1f')]===undefined?!![]:![]:!![],'where':_0x4d8c23[_0xaeab('0x1e')]?_0x4d8c23['options'][_0xaeab('0x20')]||null:null,'attributes':_0x4d8c23['options']?_0x4d8c23[_0xaeab('0x1e')][_0xaeab('0x21')]||null:null,'include':_0x4d8c23['options']?_0x4d8c23[_0xaeab('0x1e')][_0xaeab('0x23')]?_['map'](_0x4d8c23[_0xaeab('0x1e')][_0xaeab('0x23')],function(_0x53788e){return{'model':db[_0x53788e[_0xaeab('0x25')]],'as':_0x53788e['as'],'attributes':_0x53788e[_0xaeab('0x21')],'include':_0x53788e['include']?_[_0xaeab('0x24')](_0x53788e[_0xaeab('0x23')],function(_0x424fee){return{'model':db[_0x424fee[_0xaeab('0x25')]],'as':_0x424fee['as'],'attributes':_0x424fee['attributes'],'include':_0x424fee[_0xaeab('0x23')]?_[_0xaeab('0x24')](_0x424fee[_0xaeab('0x23')],function(_0x5e557e){return{'model':db[_0x5e557e[_0xaeab('0x25')]],'as':_0x5e557e['as'],'attributes':_0x5e557e[_0xaeab('0x21')]};}):[]};}):[]};}):[]:[]})[_0xaeab('0x10')](function(_0x5952d1){logger[_0xaeab('0x11')](_0xaeab('0x26'),_0x4d8c23);logger['debug'](_0xaeab('0x26'),_0x4d8c23,JSON[_0xaeab('0x15')](_0x5952d1));_0x2a77f6(_0x5952d1);})[_0xaeab('0x1a')](function(_0x41745e){logger[_0xaeab('0x16')](_0xaeab('0x26'),_0x41745e[_0xaeab('0x18')],_0x4d8c23);_0x12ec3a(_0x57d494[_0xaeab('0x16')](0x1f4,_0x41745e[_0xaeab('0x18')]));});});}; \ No newline at end of file +var _0xeca0=['defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','include','model','map','ShowFaxQueue','find','where','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xb35d42,_0x136b8a){var _0x14daff=function(_0x3e4f38){while(--_0x3e4f38){_0xb35d42['push'](_0xb35d42['shift']());}};_0x14daff(++_0x136b8a);}(_0xeca0,0x1e2));var _0x0eca=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xeca0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0eca('0x0'));var util=require(_0x0eca('0x1'));var moment=require('moment');var BPromise=require(_0x0eca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0eca('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0eca('0x4'));var logger=require(_0x0eca('0x5'))(_0x0eca('0x6'));var config=require(_0x0eca('0x7'));var jayson=require(_0x0eca('0x8'));var client=jayson[_0x0eca('0x9')]['http']({'port':0x232a});config['redis']=_[_0x0eca('0xa')](config[_0x0eca('0xb')],{'host':_0x0eca('0xc'),'port':0x18eb});var socket=require(_0x0eca('0xd'))(new Redis(config['redis']));require(_0x0eca('0xe'))[_0x0eca('0xf')](socket);function respondWithRpcPromise(_0x28f3db,_0xa76d8a,_0x38cfa0){return new BPromise(function(_0x334bcc,_0x11fb12){return client[_0x0eca('0x10')](_0x28f3db,_0x38cfa0)[_0x0eca('0x11')](function(_0xaab267){logger[_0x0eca('0x12')](_0x0eca('0x13'),_0xa76d8a,_0x0eca('0x14'));logger[_0x0eca('0x15')](_0x0eca('0x16'),_0xa76d8a,'request\x20sent',JSON[_0x0eca('0x17')](_0xaab267));if(_0xaab267['error']){if(_0xaab267[_0x0eca('0x18')][_0x0eca('0x19')]===0x1f4){logger['error'](_0x0eca('0x13'),_0xa76d8a,_0xaab267['error']['message']);return _0x11fb12(_0xaab267[_0x0eca('0x18')][_0x0eca('0x1a')]);}logger['error'](_0x0eca('0x13'),_0xa76d8a,_0xaab267[_0x0eca('0x18')][_0x0eca('0x1a')]);return _0x334bcc(_0xaab267[_0x0eca('0x18')][_0x0eca('0x1a')]);}else{logger[_0x0eca('0x12')]('FaxQueue,\x20%s,\x20%s',_0xa76d8a,'request\x20sent');_0x334bcc(_0xaab267[_0x0eca('0x1b')][_0x0eca('0x1a')]);}})[_0x0eca('0x1c')](function(_0x88b6bd){logger[_0x0eca('0x18')](_0x0eca('0x13'),_0xa76d8a,_0x88b6bd);_0x11fb12(_0x88b6bd);});});}exports[_0x0eca('0x1d')]=function(_0x1b537c){var _0x42788e=this;return new Promise(function(_0x334b2c,_0xe0835){return db[_0x0eca('0x1e')][_0x0eca('0x1f')]({'raw':_0x1b537c[_0x0eca('0x20')]?_0x1b537c[_0x0eca('0x20')][_0x0eca('0x21')]===undefined?!![]:![]:!![],'where':_0x1b537c['options']?_0x1b537c[_0x0eca('0x20')]['where']||null:null,'attributes':_0x1b537c['options']?_0x1b537c['options'][_0x0eca('0x22')]||null:null,'limit':_0x1b537c[_0x0eca('0x20')]?_0x1b537c['options']['limit']||null:null,'include':_0x1b537c[_0x0eca('0x20')]?_0x1b537c[_0x0eca('0x20')]['include']?_['map'](_0x1b537c[_0x0eca('0x20')][_0x0eca('0x23')],function(_0x252e0e){return{'model':db[_0x252e0e['model']],'as':_0x252e0e['as'],'attributes':_0x252e0e['attributes'],'include':_0x252e0e[_0x0eca('0x23')]?_['map'](_0x252e0e[_0x0eca('0x23')],function(_0x5c1660){return{'model':db[_0x5c1660[_0x0eca('0x24')]],'as':_0x5c1660['as'],'attributes':_0x5c1660['attributes'],'include':_0x5c1660['include']?_[_0x0eca('0x25')](_0x5c1660['include'],function(_0xd1c575){return{'model':db[_0xd1c575[_0x0eca('0x24')]],'as':_0xd1c575['as'],'attributes':_0xd1c575['attributes']};}):[]};}):[]};}):[]:[]})[_0x0eca('0x11')](function(_0x3953c4){logger['info'](_0x0eca('0x1d'),_0x1b537c);logger['debug']('GetFaxQueue',_0x1b537c,JSON['stringify'](_0x3953c4));_0x334b2c(_0x3953c4);})[_0x0eca('0x1c')](function(_0x3b28fe){logger[_0x0eca('0x18')](_0x0eca('0x1d'),_0x3b28fe[_0x0eca('0x1a')],_0x1b537c);_0xe0835(_0x42788e[_0x0eca('0x18')](0x1f4,_0x3b28fe[_0x0eca('0x1a')]));});});};exports[_0x0eca('0x26')]=function(_0xa327cf){var _0x34ce43=this;return new Promise(function(_0x415104,_0x27a1fc){return db[_0x0eca('0x1e')][_0x0eca('0x27')]({'raw':_0xa327cf[_0x0eca('0x20')]?_0xa327cf['options'][_0x0eca('0x21')]===undefined?!![]:![]:!![],'where':_0xa327cf[_0x0eca('0x20')]?_0xa327cf[_0x0eca('0x20')][_0x0eca('0x28')]||null:null,'attributes':_0xa327cf[_0x0eca('0x20')]?_0xa327cf[_0x0eca('0x20')][_0x0eca('0x22')]||null:null,'include':_0xa327cf[_0x0eca('0x20')]?_0xa327cf['options']['include']?_[_0x0eca('0x25')](_0xa327cf[_0x0eca('0x20')][_0x0eca('0x23')],function(_0x29efd1){return{'model':db[_0x29efd1['model']],'as':_0x29efd1['as'],'attributes':_0x29efd1[_0x0eca('0x22')],'include':_0x29efd1[_0x0eca('0x23')]?_['map'](_0x29efd1[_0x0eca('0x23')],function(_0x4c5d8d){return{'model':db[_0x4c5d8d[_0x0eca('0x24')]],'as':_0x4c5d8d['as'],'attributes':_0x4c5d8d[_0x0eca('0x22')],'include':_0x4c5d8d['include']?_[_0x0eca('0x25')](_0x4c5d8d[_0x0eca('0x23')],function(_0x24597c){return{'model':db[_0x24597c['model']],'as':_0x24597c['as'],'attributes':_0x24597c[_0x0eca('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0eca('0x11')](function(_0x50d35d){logger[_0x0eca('0x12')](_0x0eca('0x26'),_0xa327cf);logger[_0x0eca('0x15')]('ShowFaxQueue',_0xa327cf,JSON[_0x0eca('0x17')](_0x50d35d));_0x415104(_0x50d35d);})[_0x0eca('0x1c')](function(_0x18f664){logger[_0x0eca('0x18')](_0x0eca('0x26'),_0x18f664[_0x0eca('0x1a')],_0xa327cf);_0x27a1fc(_0x34ce43['error'](0x1f4,_0x18f664['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d20cd8d..27afa2b 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 _0x1e9e=['./faxQueue.events','update','emit','register'];(function(_0x4a15cd,_0x2d3835){var _0x17cb47=function(_0x78e35){while(--_0x78e35){_0x4a15cd['push'](_0x4a15cd['shift']());}};_0x17cb47(++_0x2d3835);}(_0x1e9e,0x1e8));var _0xe1e9=function(_0x24cec5,_0x2eca07){_0x24cec5=_0x24cec5-0x0;var _0x5bb114=_0x1e9e[_0x24cec5];return _0x5bb114;};'use strict';var FaxQueueEvents=require(_0xe1e9('0x0'));var events=['save','remove',_0xe1e9('0x1')];function createListener(_0x192058,_0x3e7743){return function(_0x196d16){_0x3e7743[_0xe1e9('0x2')](_0x192058,_0x196d16);};}function removeListener(_0xca6f36,_0x45e7ac){return function(){FaxQueueEvents['removeListener'](_0xca6f36,_0x45e7ac);};}exports[_0xe1e9('0x3')]=function(_0x44e43d){for(var _0x31ca76=0x0,_0x4dfe7b=events['length'];_0x31ca76<_0x4dfe7b;_0x31ca76++){var _0x53da04=events[_0x31ca76];var _0x250a79=createListener('faxQueue:'+_0x53da04,_0x44e43d);FaxQueueEvents['on'](_0x53da04,_0x250a79);}}; \ No newline at end of file +var _0x3719=['emit','removeListener','register','length','faxQueue:','./faxQueue.events','save','remove'];(function(_0x3abb55,_0x688be3){var _0x1dac9d=function(_0x207fa0){while(--_0x207fa0){_0x3abb55['push'](_0x3abb55['shift']());}};_0x1dac9d(++_0x688be3);}(_0x3719,0x1d5));var _0x9371=function(_0x5db1f9,_0x2408c1){_0x5db1f9=_0x5db1f9-0x0;var _0x1a1853=_0x3719[_0x5db1f9];return _0x1a1853;};'use strict';var FaxQueueEvents=require(_0x9371('0x0'));var events=[_0x9371('0x1'),_0x9371('0x2'),'update'];function createListener(_0x5e9f05,_0x5568c1){return function(_0x5b50bd){_0x5568c1[_0x9371('0x3')](_0x5e9f05,_0x5b50bd);};}function removeListener(_0x185dc7,_0x117a54){return function(){FaxQueueEvents[_0x9371('0x4')](_0x185dc7,_0x117a54);};}exports[_0x9371('0x5')]=function(_0x4f118c){for(var _0x17fd2e=0x0,_0x5819ca=events[_0x9371('0x6')];_0x17fd2e<_0x5819ca;_0x17fd2e++){var _0x4131e5=events[_0x17fd2e];var _0x240536=createListener(_0x9371('0x7')+_0x4131e5,_0x4f118c);FaxQueueEvents['on'](_0x4131e5,_0x240536);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index fe2c103..118ccb4 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 _0xfa0d=['post','addAgents','put','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0xbfc4f1,_0x13a332){var _0x21c719=function(_0x5cf047){while(--_0x5cf047){_0xbfc4f1['push'](_0xbfc4f1['shift']());}};_0x21c719(++_0x13a332);}(_0xfa0d,0x1e2));var _0xdfa0=function(_0x432605,_0xfdcdc5){_0x432605=_0x432605-0x0;var _0x451ae0=_0xfa0d[_0x432605];return _0x451ae0;};'use strict';var multer=require(_0xdfa0('0x0'));var util=require('util');var path=require(_0xdfa0('0x1'));var timeout=require(_0xdfa0('0x2'));var express=require(_0xdfa0('0x3'));var router=express[_0xdfa0('0x4')]();var fs_extra=require(_0xdfa0('0x5'));var auth=require(_0xdfa0('0x6'));var interaction=require(_0xdfa0('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xdfa0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdfa0('0x8')]('/describe',auth[_0xdfa0('0x9')](),controller['describe']);router[_0xdfa0('0x8')](_0xdfa0('0xa'),auth[_0xdfa0('0x9')](),controller[_0xdfa0('0xb')]);router[_0xdfa0('0x8')](_0xdfa0('0xc'),auth[_0xdfa0('0x9')](),controller[_0xdfa0('0xd')]);router[_0xdfa0('0x8')](_0xdfa0('0xe'),auth['isAuthenticated'](),controller[_0xdfa0('0xf')]);router[_0xdfa0('0x8')](_0xdfa0('0x10'),auth[_0xdfa0('0x9')](),controller[_0xdfa0('0x11')]);router[_0xdfa0('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdfa0('0x12')](_0xdfa0('0xe'),auth[_0xdfa0('0x9')](),controller['addTeams']);router['post']('/:id/users',auth[_0xdfa0('0x9')](),controller[_0xdfa0('0x13')]);router[_0xdfa0('0x14')](_0xdfa0('0xa'),auth[_0xdfa0('0x9')](),controller['update']);router[_0xdfa0('0x15')](_0xdfa0('0xa'),auth[_0xdfa0('0x9')](),controller[_0xdfa0('0x16')]);router[_0xdfa0('0x15')]('/:id/teams',auth[_0xdfa0('0x9')](),controller['removeTeams']);router[_0xdfa0('0x15')](_0xdfa0('0x10'),auth[_0xdfa0('0x9')](),controller[_0xdfa0('0x17')]);module[_0xdfa0('0x18')]=router; \ No newline at end of file +var _0x3502=['addAgents','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','getMembers','/:id/users','getAgents','post','create'];(function(_0x50ee4e,_0x1a326e){var _0x37a074=function(_0x56d3f9){while(--_0x56d3f9){_0x50ee4e['push'](_0x50ee4e['shift']());}};_0x37a074(++_0x1a326e);}(_0x3502,0x1f4));var _0x2350=function(_0x4cb2c6,_0x31439d){_0x4cb2c6=_0x4cb2c6-0x0;var _0x2c6432=_0x3502[_0x4cb2c6];return _0x2c6432;};'use strict';var multer=require(_0x2350('0x0'));var util=require(_0x2350('0x1'));var path=require(_0x2350('0x2'));var timeout=require(_0x2350('0x3'));var express=require(_0x2350('0x4'));var router=express[_0x2350('0x5')]();var fs_extra=require(_0x2350('0x6'));var auth=require(_0x2350('0x7'));var interaction=require(_0x2350('0x8'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router['get']('/',auth[_0x2350('0x9')](),controller[_0x2350('0xa')]);router[_0x2350('0xb')](_0x2350('0xc'),auth[_0x2350('0x9')](),controller['describe']);router['get'](_0x2350('0xd'),auth[_0x2350('0x9')](),controller[_0x2350('0xe')]);router[_0x2350('0xb')]('/:id/members',auth[_0x2350('0x9')](),controller[_0x2350('0xf')]);router[_0x2350('0xb')]('/:id/teams',auth[_0x2350('0x9')](),controller['getTeams']);router['get'](_0x2350('0x10'),auth[_0x2350('0x9')](),controller[_0x2350('0x11')]);router[_0x2350('0x12')]('/',auth['isAuthenticated'](),controller[_0x2350('0x13')]);router[_0x2350('0x12')]('/:id/teams',auth[_0x2350('0x9')](),controller['addTeams']);router[_0x2350('0x12')](_0x2350('0x10'),auth['isAuthenticated'](),controller[_0x2350('0x14')]);router['put'](_0x2350('0xd'),auth[_0x2350('0x9')](),controller[_0x2350('0x15')]);router[_0x2350('0x16')](_0x2350('0xd'),auth[_0x2350('0x9')](),controller[_0x2350('0x17')]);router[_0x2350('0x16')]('/:id/teams',auth[_0x2350('0x9')](),controller[_0x2350('0x18')]);router['delete'](_0x2350('0x10'),auth[_0x2350('0x9')](),controller['removeAgents']);module[_0x2350('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index fe65ff3..e704e35 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 _0xca9e=['moment','sequelize','STRING','DATE'];(function(_0x4e447f,_0x466549){var _0x2bde29=function(_0x49ee57){while(--_0x49ee57){_0x4e447f['push'](_0x4e447f['shift']());}};_0x2bde29(++_0x466549);}(_0xca9e,0x1cc));var _0xeca9=function(_0x4521bc,_0x36d505){_0x4521bc=_0x4521bc-0x0;var _0x125d19=_0xca9e[_0x4521bc];return _0x125d19;};'use strict';var moment=require(_0xeca9('0x0'));var Sequelize=require(_0xeca9('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xeca9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xeca9('0x2')]},'joinAt':{'type':Sequelize[_0xeca9('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xeca9('0x3')]},'reason':{'type':Sequelize[_0xeca9('0x2')]}}; \ No newline at end of file +var _0x607b=['STRING','moment','sequelize','exports','DATE'];(function(_0x5a4bbf,_0xae274){var _0x300bc1=function(_0x5103f0){while(--_0x5103f0){_0x5a4bbf['push'](_0x5a4bbf['shift']());}};_0x300bc1(++_0xae274);}(_0x607b,0x1b9));var _0xb607=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x607b[_0x55f8b4];return _0x2475f9;};'use strict';var moment=require(_0xb607('0x0'));var Sequelize=require(_0xb607('0x1'));module[_0xb607('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb607('0x3')]},'leaveAt':{'type':Sequelize[_0xb607('0x3')]},'acceptAt':{'type':Sequelize[_0xb607('0x3')]},'exitAt':{'type':Sequelize[_0xb607('0x3')]},'reason':{'type':Sequelize[_0xb607('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 4235605..b2ba83a 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 _0x80cb=['filters','pick','merge','VIRTUAL','filter','options','include','FaxQueueReport','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../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','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x586fa2,_0x1a45bc){var _0x515be9=function(_0x4e90d5){while(--_0x4e90d5){_0x586fa2['push'](_0x586fa2['shift']());}};_0x515be9(++_0x1a45bc);}(_0x80cb,0x193));var _0xb80c=function(_0x155a28,_0x349edd){_0x155a28=_0x155a28-0x0;var _0x514fe3=_0x80cb[_0x155a28];return _0x514fe3;};'use strict';var emlformat=require(_0xb80c('0x0'));var rimraf=require(_0xb80c('0x1'));var zipdir=require(_0xb80c('0x2'));var jsonpatch=require(_0xb80c('0x3'));var rp=require(_0xb80c('0x4'));var moment=require(_0xb80c('0x5'));var BPromise=require(_0xb80c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb80c('0x7'));var csv=require(_0xb80c('0x8'));var ejs=require(_0xb80c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb80c('0xa'));var squel=require('squel');var crypto=require(_0xb80c('0xb'));var jsforce=require(_0xb80c('0xc'));var deskjs=require(_0xb80c('0xd'));var toCsv=require(_0xb80c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb80c('0xe'));var qs=require(_0xb80c('0xf'));var as=require(_0xb80c('0x10'));var hardwareService=require(_0xb80c('0x11'));var logger=require(_0xb80c('0x12'))(_0xb80c('0x13'));var utils=require(_0xb80c('0x14'));var config=require(_0xb80c('0x15'));var licenseUtil=require(_0xb80c('0x16'));var db=require(_0xb80c('0x17'))['db'];function respondWithStatusCode(_0x37f7a9,_0x4e529a){_0x4e529a=_0x4e529a||0xcc;return function(_0x129b63){if(_0x129b63){return _0x37f7a9[_0xb80c('0x18')](_0x4e529a);}return _0x37f7a9['status'](_0x4e529a)[_0xb80c('0x19')]();};}function respondWithResult(_0x211306,_0x10b588){_0x10b588=_0x10b588||0xc8;return function(_0x5ca8bc){if(_0x5ca8bc){return _0x211306[_0xb80c('0x1a')](_0x10b588)['json'](_0x5ca8bc);}};}function respondWithFilteredResult(_0x13d29d,_0x3269c8){return function(_0x439d14){if(_0x439d14){var _0x185dbb=typeof _0x3269c8[_0xb80c('0x1b')]===_0xb80c('0x1c')&&typeof _0x3269c8[_0xb80c('0x1d')]===_0xb80c('0x1c');var _0x4fc347=_0x439d14['count'];var _0x149f9e=_0x185dbb?0x0:_0x3269c8[_0xb80c('0x1b')];var _0x5c3b76=_0x185dbb?_0x439d14[_0xb80c('0x1e')]:_0x3269c8[_0xb80c('0x1b')]+_0x3269c8[_0xb80c('0x1d')];var _0x406071;if(_0x5c3b76>=_0x4fc347){_0x5c3b76=_0x4fc347;_0x406071=0xc8;}else{_0x406071=0xce;}_0x13d29d[_0xb80c('0x1a')](_0x406071);return _0x13d29d[_0xb80c('0x1f')](_0xb80c('0x20'),_0x149f9e+'-'+_0x5c3b76+'/'+_0x4fc347)[_0xb80c('0x21')](_0x439d14);}return null;};}function patchUpdates(_0x15153a){return function(_0xb60fcb){try{jsonpatch['apply'](_0xb60fcb,_0x15153a,!![]);}catch(_0x353098){return BPromise[_0xb80c('0x22')](_0x353098);}return _0xb60fcb[_0xb80c('0x23')]();};}function saveUpdates(_0xa76a51,_0x57a1ab){return function(_0x478e30){if(_0x478e30){return _0x478e30[_0xb80c('0x24')](_0xa76a51)[_0xb80c('0x25')](function(_0x199c52){return _0x199c52;});}return null;};}function removeEntity(_0x2cd222,_0x1ea65b){return function(_0x58340d){if(_0x58340d){return _0x58340d[_0xb80c('0x26')]()[_0xb80c('0x25')](function(){_0x2cd222[_0xb80c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x354dd1,_0x355d1a){return function(_0x47003a){if(!_0x47003a){_0x354dd1[_0xb80c('0x18')](0x194);}return _0x47003a;};}function handleError(_0x2a442d,_0x404921){_0x404921=_0x404921||0x1f4;return function(_0x4c0755){logger[_0xb80c('0x27')](_0x4c0755[_0xb80c('0x28')]);if(_0x4c0755['name']){delete _0x4c0755[_0xb80c('0x29')];}_0x2a442d['status'](_0x404921)[_0xb80c('0x2a')](_0x4c0755);};}exports[_0xb80c('0x2b')]=function(_0x4a80ad,_0x1fd6f4){var _0x2878fa={},_0xc485f8={},_0x519f25={'count':0x0,'rows':[]};var _0x58784c=_[_0xb80c('0x2c')](db['FaxQueueReport']['rawAttributes'],function(_0x2ef2ef){return{'name':_0x2ef2ef[_0xb80c('0x2d')],'type':_0x2ef2ef[_0xb80c('0x2e')]['key']};});_0xc485f8[_0xb80c('0x2f')]=_[_0xb80c('0x2c')](_0x58784c,'name');_0xc485f8[_0xb80c('0x30')]=_[_0xb80c('0x31')](_0x4a80ad[_0xb80c('0x30')]);_0xc485f8['filters']=_[_0xb80c('0x32')](_0xc485f8[_0xb80c('0x2f')],_0xc485f8[_0xb80c('0x30')]);_0x2878fa['attributes']=_[_0xb80c('0x32')](_0xc485f8[_0xb80c('0x2f')],qs['fields'](_0x4a80ad['query'][_0xb80c('0x33')]));_0x2878fa[_0xb80c('0x34')]=_0x2878fa[_0xb80c('0x34')][_0xb80c('0x35')]?_0x2878fa[_0xb80c('0x34')]:_0xc485f8[_0xb80c('0x2f')];if(!_0x4a80ad[_0xb80c('0x30')][_0xb80c('0x36')](_0xb80c('0x37'))){_0x2878fa[_0xb80c('0x1d')]=qs['limit'](_0x4a80ad[_0xb80c('0x30')][_0xb80c('0x1d')]);_0x2878fa[_0xb80c('0x1b')]=qs[_0xb80c('0x1b')](_0x4a80ad[_0xb80c('0x30')][_0xb80c('0x1b')]);}_0x2878fa[_0xb80c('0x38')]=qs[_0xb80c('0x39')](_0x4a80ad[_0xb80c('0x30')]['sort']);_0x2878fa[_0xb80c('0x3a')]=qs[_0xb80c('0x3b')](_[_0xb80c('0x3c')](_0x4a80ad[_0xb80c('0x30')],_0xc485f8[_0xb80c('0x3b')]),_0x58784c);if(_0x4a80ad[_0xb80c('0x30')]['filter']){_0x2878fa[_0xb80c('0x3a')]=_[_0xb80c('0x3d')](_0x2878fa['where'],{'$or':_[_0xb80c('0x2c')](_0x58784c,function(_0x39bcd6){if(_0x39bcd6['type']!==_0xb80c('0x3e')){var _0x47efcc={};_0x47efcc[_0x39bcd6[_0xb80c('0x29')]]={'$like':'%'+_0x4a80ad['query'][_0xb80c('0x3f')]+'%'};return _0x47efcc;}})});}_0x2878fa=_[_0xb80c('0x3d')]({},_0x2878fa,_0x4a80ad[_0xb80c('0x40')]);var _0x194ee4={'where':_0x2878fa['where']};return db['FaxQueueReport']['count'](_0x194ee4)[_0xb80c('0x25')](function(_0x5959cf){_0x519f25['count']=_0x5959cf;if(_0x4a80ad[_0xb80c('0x30')]['includeAll']){_0x2878fa[_0xb80c('0x41')]=[{'all':!![]}];}return db[_0xb80c('0x42')][_0xb80c('0x43')](_0x2878fa);})['then'](function(_0x11d967){_0x519f25[_0xb80c('0x44')]=_0x11d967;return _0x519f25;})['then'](respondWithFilteredResult(_0x1fd6f4,_0x2878fa))[_0xb80c('0x45')](handleError(_0x1fd6f4,null));};exports['show']=function(_0x3da8ed,_0x57f492){var _0x1129c0={'raw':!![],'where':{'id':_0x3da8ed[_0xb80c('0x46')]['id']}},_0x320d92={};_0x320d92[_0xb80c('0x2f')]=_['keys'](db[_0xb80c('0x42')][_0xb80c('0x47')]);_0x320d92['query']=_[_0xb80c('0x31')](_0x3da8ed[_0xb80c('0x30')]);_0x320d92[_0xb80c('0x3b')]=_[_0xb80c('0x32')](_0x320d92[_0xb80c('0x2f')],_0x320d92['query']);_0x1129c0[_0xb80c('0x34')]=_['intersection'](_0x320d92[_0xb80c('0x2f')],qs[_0xb80c('0x33')](_0x3da8ed[_0xb80c('0x30')][_0xb80c('0x33')]));_0x1129c0[_0xb80c('0x34')]=_0x1129c0['attributes'][_0xb80c('0x35')]?_0x1129c0['attributes']:_0x320d92['model'];if(_0x3da8ed[_0xb80c('0x30')][_0xb80c('0x48')]){_0x1129c0[_0xb80c('0x41')]=[{'all':!![]}];}_0x1129c0=_[_0xb80c('0x3d')]({},_0x1129c0,_0x3da8ed[_0xb80c('0x40')]);return db['FaxQueueReport'][_0xb80c('0x49')](_0x1129c0)['then'](handleEntityNotFound(_0x57f492,null))[_0xb80c('0x25')](respondWithResult(_0x57f492,null))['catch'](handleError(_0x57f492,null));};exports['create']=function(_0x38234f,_0x52fa42){return db[_0xb80c('0x42')][_0xb80c('0x4a')](_0x38234f[_0xb80c('0x4b')],{})[_0xb80c('0x25')](respondWithResult(_0x52fa42,0xc9))[_0xb80c('0x45')](handleError(_0x52fa42,null));};exports['update']=function(_0x798901,_0x352f30){if(_0x798901['body']['id']){delete _0x798901['body']['id'];}return db[_0xb80c('0x42')]['find']({'where':{'id':_0x798901[_0xb80c('0x46')]['id']}})['then'](handleEntityNotFound(_0x352f30,null))[_0xb80c('0x25')](saveUpdates(_0x798901['body'],null))[_0xb80c('0x25')](respondWithResult(_0x352f30,null))[_0xb80c('0x45')](handleError(_0x352f30,null));};exports[_0xb80c('0x26')]=function(_0x1a02f1,_0x4c135a){return db[_0xb80c('0x42')][_0xb80c('0x49')]({'where':{'id':_0x1a02f1['params']['id']}})[_0xb80c('0x25')](handleEntityNotFound(_0x4c135a,null))['then'](removeEntity(_0x4c135a,null))['catch'](handleError(_0x4c135a,null));};exports['describe']=function(_0x1a7dfa,_0x17ef3e){return db[_0xb80c('0x42')][_0xb80c('0x4c')]()[_0xb80c('0x25')](respondWithResult(_0x17ef3e,null))[_0xb80c('0x45')](handleError(_0x17ef3e,null));}; \ No newline at end of file +var _0x261c=['../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','includeAll','include','findAll','rows','show','options','find','catch','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x261c,0x7d));var _0xc261=function(_0x5089ea,_0x3d8378){_0x5089ea=_0x5089ea-0x0;var _0xabe953=_0x261c[_0x5089ea];return _0xabe953;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc261('0x0'));var zipdir=require(_0xc261('0x1'));var jsonpatch=require(_0xc261('0x2'));var rp=require(_0xc261('0x3'));var moment=require(_0xc261('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc261('0x5'));var util=require(_0xc261('0x6'));var path=require(_0xc261('0x7'));var sox=require(_0xc261('0x8'));var csv=require('to-csv');var ejs=require(_0xc261('0x9'));var fs=require('fs');var fs_extra=require(_0xc261('0xa'));var _=require(_0xc261('0xb'));var squel=require(_0xc261('0xc'));var crypto=require('crypto');var jsforce=require(_0xc261('0xd'));var deskjs=require(_0xc261('0xe'));var toCsv=require(_0xc261('0xf'));var querystring=require(_0xc261('0x10'));var Papa=require('papaparse');var Redis=require(_0xc261('0x11'));var authService=require(_0xc261('0x12'));var qs=require(_0xc261('0x13'));var as=require(_0xc261('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc261('0x15'))(_0xc261('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc261('0x17'))['db'];function respondWithStatusCode(_0x34da95,_0x3cc96c){_0x3cc96c=_0x3cc96c||0xcc;return function(_0x5e0baf){if(_0x5e0baf){return _0x34da95[_0xc261('0x18')](_0x3cc96c);}return _0x34da95[_0xc261('0x19')](_0x3cc96c)['end']();};}function respondWithResult(_0x194486,_0x1315e4){_0x1315e4=_0x1315e4||0xc8;return function(_0x42dfff){if(_0x42dfff){return _0x194486[_0xc261('0x19')](_0x1315e4)[_0xc261('0x1a')](_0x42dfff);}};}function respondWithFilteredResult(_0x363756,_0x31c589){return function(_0x1d82bb){if(_0x1d82bb){var _0x3b750e=typeof _0x31c589[_0xc261('0x1b')]===_0xc261('0x1c')&&typeof _0x31c589[_0xc261('0x1d')]===_0xc261('0x1c');var _0x350fa6=_0x1d82bb[_0xc261('0x1e')];var _0x1c07f1=_0x3b750e?0x0:_0x31c589['offset'];var _0x515572=_0x3b750e?_0x1d82bb[_0xc261('0x1e')]:_0x31c589[_0xc261('0x1b')]+_0x31c589[_0xc261('0x1d')];var _0x5efc9a;if(_0x515572>=_0x350fa6){_0x515572=_0x350fa6;_0x5efc9a=0xc8;}else{_0x5efc9a=0xce;}_0x363756[_0xc261('0x19')](_0x5efc9a);return _0x363756[_0xc261('0x1f')](_0xc261('0x20'),_0x1c07f1+'-'+_0x515572+'/'+_0x350fa6)[_0xc261('0x1a')](_0x1d82bb);}return null;};}function patchUpdates(_0x20ad57){return function(_0x7b1bad){try{jsonpatch['apply'](_0x7b1bad,_0x20ad57,!![]);}catch(_0x5d03b7){return BPromise[_0xc261('0x21')](_0x5d03b7);}return _0x7b1bad[_0xc261('0x22')]();};}function saveUpdates(_0x20d4c2,_0x4c6560){return function(_0x217bd1){if(_0x217bd1){return _0x217bd1[_0xc261('0x23')](_0x20d4c2)[_0xc261('0x24')](function(_0x4cccdf){return _0x4cccdf;});}return null;};}function removeEntity(_0x5623a6,_0x6c63a9){return function(_0x4c2781){if(_0x4c2781){return _0x4c2781[_0xc261('0x25')]()[_0xc261('0x24')](function(){_0x5623a6[_0xc261('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415241,_0x2d6df7){return function(_0x2cc090){if(!_0x2cc090){_0x415241[_0xc261('0x18')](0x194);}return _0x2cc090;};}function handleError(_0x51f9f3,_0x47e34e){_0x47e34e=_0x47e34e||0x1f4;return function(_0x18c29e){logger[_0xc261('0x26')](_0x18c29e[_0xc261('0x27')]);if(_0x18c29e[_0xc261('0x28')]){delete _0x18c29e[_0xc261('0x28')];}_0x51f9f3[_0xc261('0x19')](_0x47e34e)[_0xc261('0x29')](_0x18c29e);};}exports['index']=function(_0x203399,_0x371b1f){var _0x1ed8a9={},_0x1b9e98={},_0x2f16d1={'count':0x0,'rows':[]};var _0x21ee2a=_[_0xc261('0x2a')](db[_0xc261('0x2b')][_0xc261('0x2c')],function(_0x384264){return{'name':_0x384264[_0xc261('0x2d')],'type':_0x384264['type'][_0xc261('0x2e')]};});_0x1b9e98['model']=_['map'](_0x21ee2a,_0xc261('0x28'));_0x1b9e98[_0xc261('0x2f')]=_[_0xc261('0x30')](_0x203399[_0xc261('0x2f')]);_0x1b9e98[_0xc261('0x31')]=_[_0xc261('0x32')](_0x1b9e98['model'],_0x1b9e98['query']);_0x1ed8a9[_0xc261('0x33')]=_[_0xc261('0x32')](_0x1b9e98[_0xc261('0x34')],qs[_0xc261('0x35')](_0x203399[_0xc261('0x2f')][_0xc261('0x35')]));_0x1ed8a9[_0xc261('0x33')]=_0x1ed8a9[_0xc261('0x33')][_0xc261('0x36')]?_0x1ed8a9[_0xc261('0x33')]:_0x1b9e98[_0xc261('0x34')];if(!_0x203399[_0xc261('0x2f')][_0xc261('0x37')](_0xc261('0x38'))){_0x1ed8a9[_0xc261('0x1d')]=qs[_0xc261('0x1d')](_0x203399[_0xc261('0x2f')][_0xc261('0x1d')]);_0x1ed8a9[_0xc261('0x1b')]=qs[_0xc261('0x1b')](_0x203399[_0xc261('0x2f')][_0xc261('0x1b')]);}_0x1ed8a9[_0xc261('0x39')]=qs[_0xc261('0x3a')](_0x203399['query']['sort']);_0x1ed8a9['where']=qs[_0xc261('0x31')](_['pick'](_0x203399[_0xc261('0x2f')],_0x1b9e98[_0xc261('0x31')]),_0x21ee2a);if(_0x203399[_0xc261('0x2f')][_0xc261('0x3b')]){_0x1ed8a9[_0xc261('0x3c')]=_[_0xc261('0x3d')](_0x1ed8a9[_0xc261('0x3c')],{'$or':_[_0xc261('0x2a')](_0x21ee2a,function(_0x1e92d){if(_0x1e92d['type']!=='VIRTUAL'){var _0x302d14={};_0x302d14[_0x1e92d[_0xc261('0x28')]]={'$like':'%'+_0x203399[_0xc261('0x2f')][_0xc261('0x3b')]+'%'};return _0x302d14;}})});}_0x1ed8a9=_['merge']({},_0x1ed8a9,_0x203399['options']);var _0x14ad51={'where':_0x1ed8a9[_0xc261('0x3c')]};return db[_0xc261('0x2b')][_0xc261('0x1e')](_0x14ad51)[_0xc261('0x24')](function(_0x448c17){_0x2f16d1['count']=_0x448c17;if(_0x203399[_0xc261('0x2f')][_0xc261('0x3e')]){_0x1ed8a9[_0xc261('0x3f')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xc261('0x40')](_0x1ed8a9);})[_0xc261('0x24')](function(_0x46922e){_0x2f16d1[_0xc261('0x41')]=_0x46922e;return _0x2f16d1;})['then'](respondWithFilteredResult(_0x371b1f,_0x1ed8a9))['catch'](handleError(_0x371b1f,null));};exports[_0xc261('0x42')]=function(_0x4b121a,_0x56d0eb){var _0x5cdaea={'raw':!![],'where':{'id':_0x4b121a['params']['id']}},_0x1c2d72={};_0x1c2d72[_0xc261('0x34')]=_[_0xc261('0x30')](db[_0xc261('0x2b')][_0xc261('0x2c')]);_0x1c2d72[_0xc261('0x2f')]=_['keys'](_0x4b121a[_0xc261('0x2f')]);_0x1c2d72[_0xc261('0x31')]=_['intersection'](_0x1c2d72[_0xc261('0x34')],_0x1c2d72['query']);_0x5cdaea['attributes']=_[_0xc261('0x32')](_0x1c2d72[_0xc261('0x34')],qs['fields'](_0x4b121a['query'][_0xc261('0x35')]));_0x5cdaea[_0xc261('0x33')]=_0x5cdaea[_0xc261('0x33')][_0xc261('0x36')]?_0x5cdaea[_0xc261('0x33')]:_0x1c2d72[_0xc261('0x34')];if(_0x4b121a[_0xc261('0x2f')][_0xc261('0x3e')]){_0x5cdaea[_0xc261('0x3f')]=[{'all':!![]}];}_0x5cdaea=_[_0xc261('0x3d')]({},_0x5cdaea,_0x4b121a[_0xc261('0x43')]);return db['FaxQueueReport'][_0xc261('0x44')](_0x5cdaea)[_0xc261('0x24')](handleEntityNotFound(_0x56d0eb,null))['then'](respondWithResult(_0x56d0eb,null))[_0xc261('0x45')](handleError(_0x56d0eb,null));};exports['create']=function(_0x122366,_0x55999d){return db[_0xc261('0x2b')]['create'](_0x122366['body'],{})[_0xc261('0x24')](respondWithResult(_0x55999d,0xc9))['catch'](handleError(_0x55999d,null));};exports[_0xc261('0x23')]=function(_0x59d379,_0x306f4c){if(_0x59d379[_0xc261('0x46')]['id']){delete _0x59d379[_0xc261('0x46')]['id'];}return db[_0xc261('0x2b')]['find']({'where':{'id':_0x59d379[_0xc261('0x47')]['id']}})[_0xc261('0x24')](handleEntityNotFound(_0x306f4c,null))[_0xc261('0x24')](saveUpdates(_0x59d379['body'],null))[_0xc261('0x24')](respondWithResult(_0x306f4c,null))[_0xc261('0x45')](handleError(_0x306f4c,null));};exports[_0xc261('0x25')]=function(_0x4a5333,_0x5b0607){return db['FaxQueueReport']['find']({'where':{'id':_0x4a5333[_0xc261('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b0607,null))[_0xc261('0x24')](removeEntity(_0x5b0607,null))[_0xc261('0x45')](handleError(_0x5b0607,null));};exports[_0xc261('0x48')]=function(_0x352edb,_0x4a7f4b){return db[_0xc261('0x2b')][_0xc261('0x48')]()[_0xc261('0x24')](respondWithResult(_0x4a7f4b,null))['catch'](handleError(_0x4a7f4b,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 3683426..b17be9c 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 _0x49f4=['./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x3d089a,_0x3265a9){var _0x18db66=function(_0x546a84){while(--_0x546a84){_0x3d089a['push'](_0x3d089a['shift']());}};_0x18db66(++_0x3265a9);}(_0x49f4,0x13a));var _0x449f=function(_0x53b55f,_0x7980d0){_0x53b55f=_0x53b55f-0x0;var _0x71d9fa=_0x49f4[_0x53b55f];return _0x71d9fa;};'use strict';var _=require(_0x449f('0x0'));var util=require(_0x449f('0x1'));var logger=require(_0x449f('0x2'))(_0x449f('0x3'));var moment=require(_0x449f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x449f('0x5'));var rimraf=require(_0x449f('0x6'));var config=require(_0x449f('0x7'));var attributes=require(_0x449f('0x8'));module[_0x449f('0x9')]=function(_0x93f0bd,_0x1909bc){return _0x93f0bd[_0x449f('0xa')](_0x449f('0xb'),attributes,{'tableName':_0x449f('0xc'),'paranoid':![],'indexes':[{'name':_0x449f('0xd'),'fields':[_0x449f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7667=['../../config/logger','bluebird','request-promise','path','rimraf','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x348d6e,_0x18e9ee){var _0x423f36=function(_0x1ea484){while(--_0x1ea484){_0x348d6e['push'](_0x348d6e['shift']());}};_0x423f36(++_0x18e9ee);}(_0x7667,0xf8));var _0x7766=function(_0x1debe8,_0x4c3d0e){_0x1debe8=_0x1debe8-0x0;var _0x54f33c=_0x7667[_0x1debe8];return _0x54f33c;};'use strict';var _=require(_0x7766('0x0'));var util=require(_0x7766('0x1'));var logger=require(_0x7766('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7766('0x3'));var rp=require(_0x7766('0x4'));var fs=require('fs');var path=require(_0x7766('0x5'));var rimraf=require(_0x7766('0x6'));var config=require('../../config/environment');var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x3de666,_0x54b5bf){return _0x3de666[_0x7766('0x7')](_0x7766('0x8'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7766('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 2e9b90e..6d15c13 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 _0x8fcf=['then','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxQueueReport,\x20%s,\x20%s','message','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','stringify','UpdateFaxQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x8fcf,0x1b4));var _0xf8fc=function(_0x100861,_0xe712ea){_0x100861=_0x100861-0x0;var _0x536160=_0x8fcf[_0x100861];return _0x536160;};'use strict';var _=require(_0xf8fc('0x0'));var util=require(_0xf8fc('0x1'));var moment=require(_0xf8fc('0x2'));var BPromise=require(_0xf8fc('0x3'));var rs=require(_0xf8fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8fc('0x6'))('rpc');var config=require(_0xf8fc('0x7'));var jayson=require(_0xf8fc('0x8'));var client=jayson[_0xf8fc('0x9')][_0xf8fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x553bcd,_0xda0aab,_0x45e82a){return new BPromise(function(_0x5b3e72,_0x582c22){return client[_0xf8fc('0xb')](_0x553bcd,_0x45e82a)[_0xf8fc('0xc')](function(_0x3bd38e){logger[_0xf8fc('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0xda0aab,'request\x20sent');logger[_0xf8fc('0xe')](_0xf8fc('0xf'),_0xda0aab,_0xf8fc('0x10'),JSON['stringify'](_0x3bd38e));if(_0x3bd38e[_0xf8fc('0x11')]){if(_0x3bd38e[_0xf8fc('0x11')]['code']===0x1f4){logger[_0xf8fc('0x11')](_0xf8fc('0x12'),_0xda0aab,_0x3bd38e[_0xf8fc('0x11')]['message']);return _0x582c22(_0x3bd38e['error'][_0xf8fc('0x13')]);}logger[_0xf8fc('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0xda0aab,_0x3bd38e[_0xf8fc('0x11')][_0xf8fc('0x13')]);return _0x5b3e72(_0x3bd38e[_0xf8fc('0x11')][_0xf8fc('0x13')]);}else{logger[_0xf8fc('0xd')](_0xf8fc('0x12'),_0xda0aab,_0xf8fc('0x10'));_0x5b3e72(_0x3bd38e['result'][_0xf8fc('0x13')]);}})[_0xf8fc('0x14')](function(_0x5b1817){logger['error'](_0xf8fc('0x12'),_0xda0aab,_0x5b1817);_0x582c22(_0x5b1817);});});}exports['CreateFaxQueueReport']=function(_0x4c7969){var _0x5167a9=this;return new Promise(function(_0x4a3eae,_0x108ce9){return db[_0xf8fc('0x15')][_0xf8fc('0x16')](_0x4c7969[_0xf8fc('0x17')],{'raw':_0x4c7969[_0xf8fc('0x18')]?_0x4c7969['options'][_0xf8fc('0x19')]===undefined?!![]:![]:!![]})[_0xf8fc('0xc')](function(_0x252feb){logger[_0xf8fc('0xd')](_0xf8fc('0x1a'),_0x4c7969);logger[_0xf8fc('0xe')](_0xf8fc('0x1a'),_0x4c7969,JSON[_0xf8fc('0x1b')](_0x252feb));_0x4a3eae(_0x252feb);})[_0xf8fc('0x14')](function(_0x4b6212){logger[_0xf8fc('0x11')]('CreateFaxQueueReport',_0x4b6212[_0xf8fc('0x13')],_0x4c7969);_0x108ce9(_0x5167a9['error'](0x1f4,_0x4b6212[_0xf8fc('0x13')]));});});};exports[_0xf8fc('0x1c')]=function(_0xc2e87d){var _0x48257c=this;return new Promise(function(_0x283459,_0x1c085a){return db[_0xf8fc('0x15')][_0xf8fc('0x1d')](_0xc2e87d[_0xf8fc('0x17')],{'raw':_0xc2e87d[_0xf8fc('0x18')]?_0xc2e87d[_0xf8fc('0x18')][_0xf8fc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc2e87d[_0xf8fc('0x18')]?_0xc2e87d[_0xf8fc('0x18')][_0xf8fc('0x1e')]||null:null,'attributes':_0xc2e87d['options']?_0xc2e87d[_0xf8fc('0x18')]['attributes']||null:null,'limit':_0xc2e87d[_0xf8fc('0x18')]?_0xc2e87d[_0xf8fc('0x18')][_0xf8fc('0x1f')]||null:null})[_0xf8fc('0xc')](function(_0x3858c7){logger[_0xf8fc('0xd')](_0xf8fc('0x1c'),_0xc2e87d);logger[_0xf8fc('0xe')](_0xf8fc('0x1c'),_0xc2e87d,JSON[_0xf8fc('0x1b')](_0x3858c7));_0x283459(_0x3858c7);})[_0xf8fc('0x14')](function(_0x359017){logger[_0xf8fc('0x11')](_0xf8fc('0x1c'),_0x359017['message'],_0xc2e87d);_0x1c085a(_0x48257c['error'](0x1f4,_0x359017[_0xf8fc('0x13')]));});});}; \ No newline at end of file +var _0x5a66=['raw','UpdateFaxQueueReport','update','where','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','FaxQueueReport','body','options'];(function(_0x3043ea,_0x16b865){var _0x57c82c=function(_0x401ba3){while(--_0x401ba3){_0x3043ea['push'](_0x3043ea['shift']());}};_0x57c82c(++_0x16b865);}(_0x5a66,0x1b3));var _0x65a6=function(_0x1e03e4,_0x362f76){_0x1e03e4=_0x1e03e4-0x0;var _0x4a887e=_0x5a66[_0x1e03e4];return _0x4a887e;};'use strict';var _=require(_0x65a6('0x0'));var util=require(_0x65a6('0x1'));var moment=require(_0x65a6('0x2'));var BPromise=require(_0x65a6('0x3'));var rs=require(_0x65a6('0x4'));var fs=require('fs');var Redis=require(_0x65a6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x65a6('0x6'));var logger=require(_0x65a6('0x7'))(_0x65a6('0x8'));var config=require(_0x65a6('0x9'));var jayson=require(_0x65a6('0xa'));var client=jayson['client'][_0x65a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x342abc,_0x521d22,_0x2dd079){return new BPromise(function(_0x2f9035,_0x4c9100){return client[_0x65a6('0xc')](_0x342abc,_0x2dd079)[_0x65a6('0xd')](function(_0x6e3e90){logger[_0x65a6('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x521d22,_0x65a6('0xf'));logger[_0x65a6('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x521d22,_0x65a6('0xf'),JSON[_0x65a6('0x11')](_0x6e3e90));if(_0x6e3e90['error']){if(_0x6e3e90[_0x65a6('0x12')][_0x65a6('0x13')]===0x1f4){logger[_0x65a6('0x12')](_0x65a6('0x14'),_0x521d22,_0x6e3e90[_0x65a6('0x12')]['message']);return _0x4c9100(_0x6e3e90[_0x65a6('0x12')][_0x65a6('0x15')]);}logger[_0x65a6('0x12')](_0x65a6('0x14'),_0x521d22,_0x6e3e90[_0x65a6('0x12')][_0x65a6('0x15')]);return _0x2f9035(_0x6e3e90[_0x65a6('0x12')][_0x65a6('0x15')]);}else{logger[_0x65a6('0xe')](_0x65a6('0x14'),_0x521d22,_0x65a6('0xf'));_0x2f9035(_0x6e3e90[_0x65a6('0x16')][_0x65a6('0x15')]);}})['catch'](function(_0x3b9a3e){logger[_0x65a6('0x12')](_0x65a6('0x14'),_0x521d22,_0x3b9a3e);_0x4c9100(_0x3b9a3e);});});}exports[_0x65a6('0x17')]=function(_0x532482){var _0x59de75=this;return new Promise(function(_0xa8f52b,_0x2bffc5){return db[_0x65a6('0x18')]['create'](_0x532482[_0x65a6('0x19')],{'raw':_0x532482[_0x65a6('0x1a')]?_0x532482[_0x65a6('0x1a')][_0x65a6('0x1b')]===undefined?!![]:![]:!![]})[_0x65a6('0xd')](function(_0x47a9d7){logger[_0x65a6('0xe')](_0x65a6('0x17'),_0x532482);logger[_0x65a6('0x10')]('CreateFaxQueueReport',_0x532482,JSON['stringify'](_0x47a9d7));_0xa8f52b(_0x47a9d7);})['catch'](function(_0x597bec){logger[_0x65a6('0x12')](_0x65a6('0x17'),_0x597bec[_0x65a6('0x15')],_0x532482);_0x2bffc5(_0x59de75[_0x65a6('0x12')](0x1f4,_0x597bec[_0x65a6('0x15')]));});});};exports[_0x65a6('0x1c')]=function(_0x3da89e){var _0x444056=this;return new Promise(function(_0x2cba78,_0x3da657){return db['FaxQueueReport'][_0x65a6('0x1d')](_0x3da89e[_0x65a6('0x19')],{'raw':_0x3da89e[_0x65a6('0x1a')]?_0x3da89e[_0x65a6('0x1a')][_0x65a6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3da89e[_0x65a6('0x1a')]?_0x3da89e[_0x65a6('0x1a')][_0x65a6('0x1e')]||null:null,'attributes':_0x3da89e[_0x65a6('0x1a')]?_0x3da89e['options'][_0x65a6('0x1f')]||null:null,'limit':_0x3da89e['options']?_0x3da89e[_0x65a6('0x1a')]['limit']||null:null})[_0x65a6('0xd')](function(_0x471bef){logger[_0x65a6('0xe')](_0x65a6('0x1c'),_0x3da89e);logger['debug'](_0x65a6('0x1c'),_0x3da89e,JSON[_0x65a6('0x11')](_0x471bef));_0x2cba78(_0x471bef);})[_0x65a6('0x20')](function(_0x1e0772){logger[_0x65a6('0x12')](_0x65a6('0x1c'),_0x1e0772[_0x65a6('0x15')],_0x3da89e);_0x3da657(_0x444056[_0x65a6('0x12')](0x1f4,_0x1e0772[_0x65a6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 4a1c903..e5caf33 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 _0x5de5=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','/describe','/:id','isAuthenticated','post','create'];(function(_0x2c87dc,_0x5a947b){var _0x1485a0=function(_0x561cc9){while(--_0x561cc9){_0x2c87dc['push'](_0x2c87dc['shift']());}};_0x1485a0(++_0x5a947b);}(_0x5de5,0x1e4));var _0x55de=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5de5[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x55de('0x0'));var util=require(_0x55de('0x1'));var path=require(_0x55de('0x2'));var timeout=require(_0x55de('0x3'));var express=require(_0x55de('0x4'));var router=express[_0x55de('0x5')]();var fs_extra=require(_0x55de('0x6'));var auth=require(_0x55de('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x55de('0x8'));var controller=require(_0x55de('0x9'));router[_0x55de('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x55de('0xa')](_0x55de('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x55de('0xa')](_0x55de('0xc'),auth[_0x55de('0xd')](),controller['show']);router[_0x55de('0xe')]('/',auth[_0x55de('0xd')](),controller[_0x55de('0xf')]);router[_0x55de('0x10')](_0x55de('0xc'),auth[_0x55de('0xd')](),controller[_0x55de('0x11')]);router[_0x55de('0x12')](_0x55de('0xc'),auth[_0x55de('0xd')](),controller[_0x55de('0x13')]);module['exports']=router; \ No newline at end of file +var _0x74a7=['../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74a7,0x117));var _0x774a=function(_0x5426a0,_0x4eba6b){_0x5426a0=_0x5426a0-0x0;var _0x184217=_0x74a7[_0x5426a0];return _0x184217;};'use strict';var multer=require('multer');var util=require(_0x774a('0x0'));var path=require(_0x774a('0x1'));var timeout=require(_0x774a('0x2'));var express=require(_0x774a('0x3'));var router=express[_0x774a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x774a('0x5'));var interaction=require(_0x774a('0x6'));var config=require(_0x774a('0x7'));var controller=require(_0x774a('0x8'));router[_0x774a('0x9')]('/',auth[_0x774a('0xa')](),controller[_0x774a('0xb')]);router['get'](_0x774a('0xc'),auth[_0x774a('0xa')](),controller[_0x774a('0xd')]);router[_0x774a('0x9')](_0x774a('0xe'),auth['isAuthenticated'](),controller[_0x774a('0xf')]);router[_0x774a('0x10')]('/',auth[_0x774a('0xa')](),controller[_0x774a('0x11')]);router[_0x774a('0x12')](_0x774a('0xe'),auth[_0x774a('0xa')](),controller[_0x774a('0x13')]);router[_0x774a('0x14')]('/:id',auth[_0x774a('0xa')](),controller['destroy']);module[_0x774a('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index c1e98ca..05b566b 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 _0xd97d=['exports','STRING','account','agent','queue','DATE','NOW','moment'];(function(_0x56ebce,_0x4fd57e){var _0x1c4a46=function(_0x23a092){while(--_0x23a092){_0x56ebce['push'](_0x56ebce['shift']());}};_0x1c4a46(++_0x4fd57e);}(_0xd97d,0x10f));var _0xdd97=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xd97d[_0x382e89];return _0x3a1318;};'use strict';var moment=require(_0xdd97('0x0'));var Sequelize=require('sequelize');module[_0xdd97('0x1')]={'uniqueid':{'type':Sequelize[_0xdd97('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xdd97('0x3'),_0xdd97('0x4'),_0xdd97('0x5')),'allowNull':![],'defaultValue':_0xdd97('0x5')},'transferredAt':{'type':Sequelize[_0xdd97('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xdd97('0x7')]}}; \ No newline at end of file +var _0xd5d9=['queue','NOW','sequelize','STRING','account','agent'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xd5d9,0x128));var _0x9d5d=function(_0x52bf81,_0x5c93dc){_0x52bf81=_0x52bf81-0x0;var _0x45f9b4=_0xd5d9[_0x52bf81];return _0x45f9b4;};'use strict';var moment=require('moment');var Sequelize=require(_0x9d5d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9d5d('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9d5d('0x2'),_0x9d5d('0x3'),_0x9d5d('0x4')),'allowNull':![],'defaultValue':_0x9d5d('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9d5d('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index b251931..316577e 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 _0xedd0=['index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','FaxTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','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','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x2126f6,_0x3cad9d){var _0x278d8f=function(_0x8928d4){while(--_0x8928d4){_0x2126f6['push'](_0x2126f6['shift']());}};_0x278d8f(++_0x3cad9d);}(_0xedd0,0x110));var _0x0edd=function(_0x59f1ee,_0x4c94a5){_0x59f1ee=_0x59f1ee-0x0;var _0x216c9e=_0xedd0[_0x59f1ee];return _0x216c9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0edd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0edd('0x1'));var moment=require(_0x0edd('0x2'));var BPromise=require(_0x0edd('0x3'));var Mustache=require(_0x0edd('0x4'));var util=require(_0x0edd('0x5'));var path=require(_0x0edd('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0edd('0x7'));var _=require(_0x0edd('0x8'));var squel=require(_0x0edd('0x9'));var crypto=require(_0x0edd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0edd('0xb'));var toCsv=require(_0x0edd('0xc'));var querystring=require(_0x0edd('0xd'));var Papa=require(_0x0edd('0xe'));var Redis=require(_0x0edd('0xf'));var authService=require(_0x0edd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0edd('0x11'));var hardwareService=require(_0x0edd('0x12'));var logger=require(_0x0edd('0x13'))(_0x0edd('0x14'));var utils=require(_0x0edd('0x15'));var config=require(_0x0edd('0x16'));var licenseUtil=require(_0x0edd('0x17'));var db=require(_0x0edd('0x18'))['db'];function respondWithStatusCode(_0x186b06,_0x4f3e1f){_0x4f3e1f=_0x4f3e1f||0xcc;return function(_0x507fc4){if(_0x507fc4){return _0x186b06[_0x0edd('0x19')](_0x4f3e1f);}return _0x186b06[_0x0edd('0x1a')](_0x4f3e1f)[_0x0edd('0x1b')]();};}function respondWithResult(_0x5e918b,_0x1b7627){_0x1b7627=_0x1b7627||0xc8;return function(_0x1a40ba){if(_0x1a40ba){return _0x5e918b[_0x0edd('0x1a')](_0x1b7627)[_0x0edd('0x1c')](_0x1a40ba);}};}function respondWithFilteredResult(_0x39580f,_0x8569d8){return function(_0x7494e7){if(_0x7494e7){var _0x56a5b3=typeof _0x8569d8[_0x0edd('0x1d')]===_0x0edd('0x1e')&&typeof _0x8569d8['limit']===_0x0edd('0x1e');var _0xc5b4c1=_0x7494e7[_0x0edd('0x1f')];var _0x2cf17e=_0x56a5b3?0x0:_0x8569d8['offset'];var _0x1293ad=_0x56a5b3?_0x7494e7[_0x0edd('0x1f')]:_0x8569d8[_0x0edd('0x1d')]+_0x8569d8[_0x0edd('0x20')];var _0x392f29;if(_0x1293ad>=_0xc5b4c1){_0x1293ad=_0xc5b4c1;_0x392f29=0xc8;}else{_0x392f29=0xce;}_0x39580f[_0x0edd('0x1a')](_0x392f29);return _0x39580f[_0x0edd('0x21')](_0x0edd('0x22'),_0x2cf17e+'-'+_0x1293ad+'/'+_0xc5b4c1)['json'](_0x7494e7);}return null;};}function patchUpdates(_0x3c8a74){return function(_0x2d48cb){try{jsonpatch['apply'](_0x2d48cb,_0x3c8a74,!![]);}catch(_0x2a8a64){return BPromise[_0x0edd('0x23')](_0x2a8a64);}return _0x2d48cb[_0x0edd('0x24')]();};}function saveUpdates(_0x29a893,_0x28bd95){return function(_0x10ba1c){if(_0x10ba1c){return _0x10ba1c[_0x0edd('0x25')](_0x29a893)[_0x0edd('0x26')](function(_0x601519){return _0x601519;});}return null;};}function removeEntity(_0x3462ec,_0x358166){return function(_0x210d6f){if(_0x210d6f){return _0x210d6f[_0x0edd('0x27')]()[_0x0edd('0x26')](function(){_0x3462ec[_0x0edd('0x1a')](0xcc)[_0x0edd('0x1b')]();});}};}function handleEntityNotFound(_0x370557,_0xa5bcbd){return function(_0x2eb9ea){if(!_0x2eb9ea){_0x370557['sendStatus'](0x194);}return _0x2eb9ea;};}function handleError(_0x1bf678,_0x2c9e31){_0x2c9e31=_0x2c9e31||0x1f4;return function(_0x1355c5){logger[_0x0edd('0x28')](_0x1355c5[_0x0edd('0x29')]);if(_0x1355c5[_0x0edd('0x2a')]){delete _0x1355c5[_0x0edd('0x2a')];}_0x1bf678[_0x0edd('0x1a')](_0x2c9e31)[_0x0edd('0x2b')](_0x1355c5);};}exports[_0x0edd('0x2c')]=function(_0x5ebac2,_0x496517){var _0x2f1d5a={},_0x13fc5a={},_0x3c0246={'count':0x0,'rows':[]};var _0x37bf7b=_[_0x0edd('0x2d')](db['FaxTransferReport'][_0x0edd('0x2e')],function(_0x17ba72){return{'name':_0x17ba72[_0x0edd('0x2f')],'type':_0x17ba72[_0x0edd('0x30')][_0x0edd('0x31')]};});_0x13fc5a[_0x0edd('0x32')]=_['map'](_0x37bf7b,_0x0edd('0x2a'));_0x13fc5a[_0x0edd('0x33')]=_['keys'](_0x5ebac2[_0x0edd('0x33')]);_0x13fc5a[_0x0edd('0x34')]=_[_0x0edd('0x35')](_0x13fc5a[_0x0edd('0x32')],_0x13fc5a[_0x0edd('0x33')]);_0x2f1d5a[_0x0edd('0x36')]=_[_0x0edd('0x35')](_0x13fc5a['model'],qs[_0x0edd('0x37')](_0x5ebac2[_0x0edd('0x33')][_0x0edd('0x37')]));_0x2f1d5a[_0x0edd('0x36')]=_0x2f1d5a['attributes'][_0x0edd('0x38')]?_0x2f1d5a[_0x0edd('0x36')]:_0x13fc5a['model'];if(!_0x5ebac2['query'][_0x0edd('0x39')](_0x0edd('0x3a'))){_0x2f1d5a[_0x0edd('0x20')]=qs['limit'](_0x5ebac2['query'][_0x0edd('0x20')]);_0x2f1d5a[_0x0edd('0x1d')]=qs['offset'](_0x5ebac2['query'][_0x0edd('0x1d')]);}_0x2f1d5a[_0x0edd('0x3b')]=qs['sort'](_0x5ebac2[_0x0edd('0x33')]['sort']);_0x2f1d5a['where']=qs['filters'](_[_0x0edd('0x3c')](_0x5ebac2[_0x0edd('0x33')],_0x13fc5a[_0x0edd('0x34')]),_0x37bf7b);if(_0x5ebac2[_0x0edd('0x33')][_0x0edd('0x3d')]){_0x2f1d5a[_0x0edd('0x3e')]=_[_0x0edd('0x3f')](_0x2f1d5a[_0x0edd('0x3e')],{'$or':_['map'](_0x37bf7b,function(_0x4dc9a2){if(_0x4dc9a2[_0x0edd('0x30')]!==_0x0edd('0x40')){var _0x4ebe8f={};_0x4ebe8f[_0x4dc9a2[_0x0edd('0x2a')]]={'$like':'%'+_0x5ebac2['query'][_0x0edd('0x3d')]+'%'};return _0x4ebe8f;}})});}_0x2f1d5a=_[_0x0edd('0x3f')]({},_0x2f1d5a,_0x5ebac2[_0x0edd('0x41')]);var _0x4be915={'where':_0x2f1d5a[_0x0edd('0x3e')]};return db[_0x0edd('0x42')][_0x0edd('0x1f')](_0x4be915)['then'](function(_0x21761d){_0x3c0246[_0x0edd('0x1f')]=_0x21761d;if(_0x5ebac2[_0x0edd('0x33')][_0x0edd('0x43')]){_0x2f1d5a[_0x0edd('0x44')]=[{'all':!![]}];}return db[_0x0edd('0x42')][_0x0edd('0x45')](_0x2f1d5a);})[_0x0edd('0x26')](function(_0x389a07){_0x3c0246[_0x0edd('0x46')]=_0x389a07;return _0x3c0246;})['then'](respondWithFilteredResult(_0x496517,_0x2f1d5a))[_0x0edd('0x47')](handleError(_0x496517,null));};exports[_0x0edd('0x48')]=function(_0x38d2b6,_0x28f85e){var _0x14e6f2={'raw':!![],'where':{'id':_0x38d2b6[_0x0edd('0x49')]['id']}},_0x591112={};_0x591112['model']=_[_0x0edd('0x4a')](db['FaxTransferReport'][_0x0edd('0x2e')]);_0x591112[_0x0edd('0x33')]=_[_0x0edd('0x4a')](_0x38d2b6[_0x0edd('0x33')]);_0x591112[_0x0edd('0x34')]=_['intersection'](_0x591112[_0x0edd('0x32')],_0x591112[_0x0edd('0x33')]);_0x14e6f2[_0x0edd('0x36')]=_[_0x0edd('0x35')](_0x591112['model'],qs[_0x0edd('0x37')](_0x38d2b6[_0x0edd('0x33')]['fields']));_0x14e6f2[_0x0edd('0x36')]=_0x14e6f2[_0x0edd('0x36')]['length']?_0x14e6f2['attributes']:_0x591112[_0x0edd('0x32')];if(_0x38d2b6['query'][_0x0edd('0x43')]){_0x14e6f2[_0x0edd('0x44')]=[{'all':!![]}];}_0x14e6f2=_['merge']({},_0x14e6f2,_0x38d2b6['options']);return db[_0x0edd('0x42')][_0x0edd('0x4b')](_0x14e6f2)[_0x0edd('0x26')](handleEntityNotFound(_0x28f85e,null))[_0x0edd('0x26')](respondWithResult(_0x28f85e,null))['catch'](handleError(_0x28f85e,null));};exports[_0x0edd('0x4c')]=function(_0x369584,_0x357edc){return db[_0x0edd('0x42')][_0x0edd('0x4c')](_0x369584[_0x0edd('0x4d')],{})['then'](respondWithResult(_0x357edc,0xc9))['catch'](handleError(_0x357edc,null));};exports[_0x0edd('0x25')]=function(_0x3b0193,_0x6f804){if(_0x3b0193[_0x0edd('0x4d')]['id']){delete _0x3b0193[_0x0edd('0x4d')]['id'];}return db[_0x0edd('0x42')][_0x0edd('0x4b')]({'where':{'id':_0x3b0193[_0x0edd('0x49')]['id']}})['then'](handleEntityNotFound(_0x6f804,null))[_0x0edd('0x26')](saveUpdates(_0x3b0193[_0x0edd('0x4d')],null))[_0x0edd('0x26')](respondWithResult(_0x6f804,null))[_0x0edd('0x47')](handleError(_0x6f804,null));};exports[_0x0edd('0x27')]=function(_0x9f35a8,_0x42ce6f){return db['FaxTransferReport'][_0x0edd('0x4b')]({'where':{'id':_0x9f35a8[_0x0edd('0x49')]['id']}})['then'](handleEntityNotFound(_0x42ce6f,null))[_0x0edd('0x26')](removeEntity(_0x42ce6f,null))['catch'](handleError(_0x42ce6f,null));};exports[_0x0edd('0x4e')]=function(_0x3bcb20,_0x4f225e){return db[_0x0edd('0x42')][_0x0edd('0x4e')]()[_0x0edd('0x26')](respondWithResult(_0x4f225e,null))[_0x0edd('0x47')](handleError(_0x4f225e,null));}; \ No newline at end of file +var _0x352a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','end','sendStatus','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','desk.js'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x352a,0x83));var _0xa352=function(_0x1964e6,_0x314579){_0x1964e6=_0x1964e6-0x0;var _0x5cebc8=_0x352a[_0x1964e6];return _0x5cebc8;};'use strict';var emlformat=require(_0xa352('0x0'));var rimraf=require(_0xa352('0x1'));var zipdir=require(_0xa352('0x2'));var jsonpatch=require(_0xa352('0x3'));var rp=require('request-promise');var moment=require(_0xa352('0x4'));var BPromise=require(_0xa352('0x5'));var Mustache=require(_0xa352('0x6'));var util=require(_0xa352('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa352('0x8'));var ejs=require(_0xa352('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa352('0xa'));var toCsv=require(_0xa352('0x8'));var querystring=require(_0xa352('0xb'));var Papa=require(_0xa352('0xc'));var Redis=require(_0xa352('0xd'));var authService=require(_0xa352('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xa352('0xf'));var hardwareService=require(_0xa352('0x10'));var logger=require(_0xa352('0x11'))(_0xa352('0x12'));var utils=require('../../config/utils');var config=require(_0xa352('0x13'));var licenseUtil=require(_0xa352('0x14'));var db=require(_0xa352('0x15'))['db'];function respondWithStatusCode(_0x4f255b,_0x3c35d4){_0x3c35d4=_0x3c35d4||0xcc;return function(_0x4a0713){if(_0x4a0713){return _0x4f255b['sendStatus'](_0x3c35d4);}return _0x4f255b[_0xa352('0x16')](_0x3c35d4)['end']();};}function respondWithResult(_0x486bb1,_0x1eac3f){_0x1eac3f=_0x1eac3f||0xc8;return function(_0x11eaa7){if(_0x11eaa7){return _0x486bb1[_0xa352('0x16')](_0x1eac3f)[_0xa352('0x17')](_0x11eaa7);}};}function respondWithFilteredResult(_0x332ae9,_0x243ed3){return function(_0x31bd0f){if(_0x31bd0f){var _0x2d21ca=typeof _0x243ed3[_0xa352('0x18')]===_0xa352('0x19')&&typeof _0x243ed3[_0xa352('0x1a')]===_0xa352('0x19');var _0xcbbc98=_0x31bd0f[_0xa352('0x1b')];var _0x30b1ef=_0x2d21ca?0x0:_0x243ed3[_0xa352('0x18')];var _0x1c522b=_0x2d21ca?_0x31bd0f[_0xa352('0x1b')]:_0x243ed3[_0xa352('0x18')]+_0x243ed3[_0xa352('0x1a')];var _0x5d5128;if(_0x1c522b>=_0xcbbc98){_0x1c522b=_0xcbbc98;_0x5d5128=0xc8;}else{_0x5d5128=0xce;}_0x332ae9[_0xa352('0x16')](_0x5d5128);return _0x332ae9[_0xa352('0x1c')](_0xa352('0x1d'),_0x30b1ef+'-'+_0x1c522b+'/'+_0xcbbc98)[_0xa352('0x17')](_0x31bd0f);}return null;};}function patchUpdates(_0x28042b){return function(_0x2ab25f){try{jsonpatch['apply'](_0x2ab25f,_0x28042b,!![]);}catch(_0x3a2a8c){return BPromise[_0xa352('0x1e')](_0x3a2a8c);}return _0x2ab25f['save']();};}function saveUpdates(_0x1e6f25,_0x4ed038){return function(_0x4d17a6){if(_0x4d17a6){return _0x4d17a6[_0xa352('0x1f')](_0x1e6f25)[_0xa352('0x20')](function(_0x49b9d2){return _0x49b9d2;});}return null;};}function removeEntity(_0xb7282c,_0x4778d5){return function(_0x10cbc0){if(_0x10cbc0){return _0x10cbc0['destroy']()['then'](function(){_0xb7282c[_0xa352('0x16')](0xcc)[_0xa352('0x21')]();});}};}function handleEntityNotFound(_0xe405c5,_0x5845ef){return function(_0x23768a){if(!_0x23768a){_0xe405c5[_0xa352('0x22')](0x194);}return _0x23768a;};}function handleError(_0x19eec4,_0x1d2af9){_0x1d2af9=_0x1d2af9||0x1f4;return function(_0xa6830b){logger[_0xa352('0x23')](_0xa6830b['stack']);if(_0xa6830b[_0xa352('0x24')]){delete _0xa6830b[_0xa352('0x24')];}_0x19eec4[_0xa352('0x16')](_0x1d2af9)[_0xa352('0x25')](_0xa6830b);};}exports[_0xa352('0x26')]=function(_0x1c3da0,_0x59a70a){var _0x239990={},_0x50eb99={},_0x16ec76={'count':0x0,'rows':[]};var _0x4a4581=_[_0xa352('0x27')](db[_0xa352('0x28')][_0xa352('0x29')],function(_0x1d8b0f){return{'name':_0x1d8b0f[_0xa352('0x2a')],'type':_0x1d8b0f['type'][_0xa352('0x2b')]};});_0x50eb99[_0xa352('0x2c')]=_[_0xa352('0x27')](_0x4a4581,_0xa352('0x24'));_0x50eb99['query']=_[_0xa352('0x2d')](_0x1c3da0[_0xa352('0x2e')]);_0x50eb99[_0xa352('0x2f')]=_[_0xa352('0x30')](_0x50eb99[_0xa352('0x2c')],_0x50eb99[_0xa352('0x2e')]);_0x239990[_0xa352('0x31')]=_['intersection'](_0x50eb99['model'],qs[_0xa352('0x32')](_0x1c3da0['query'][_0xa352('0x32')]));_0x239990['attributes']=_0x239990[_0xa352('0x31')]['length']?_0x239990['attributes']:_0x50eb99[_0xa352('0x2c')];if(!_0x1c3da0['query']['hasOwnProperty'](_0xa352('0x33'))){_0x239990[_0xa352('0x1a')]=qs['limit'](_0x1c3da0[_0xa352('0x2e')][_0xa352('0x1a')]);_0x239990['offset']=qs[_0xa352('0x18')](_0x1c3da0[_0xa352('0x2e')][_0xa352('0x18')]);}_0x239990['order']=qs[_0xa352('0x34')](_0x1c3da0[_0xa352('0x2e')]['sort']);_0x239990[_0xa352('0x35')]=qs[_0xa352('0x2f')](_['pick'](_0x1c3da0[_0xa352('0x2e')],_0x50eb99['filters']),_0x4a4581);if(_0x1c3da0['query'][_0xa352('0x36')]){_0x239990[_0xa352('0x35')]=_[_0xa352('0x37')](_0x239990['where'],{'$or':_[_0xa352('0x27')](_0x4a4581,function(_0x15554d){if(_0x15554d[_0xa352('0x38')]!==_0xa352('0x39')){var _0x91a937={};_0x91a937[_0x15554d[_0xa352('0x24')]]={'$like':'%'+_0x1c3da0[_0xa352('0x2e')]['filter']+'%'};return _0x91a937;}})});}_0x239990=_[_0xa352('0x37')]({},_0x239990,_0x1c3da0[_0xa352('0x3a')]);var _0xf813a3={'where':_0x239990[_0xa352('0x35')]};return db[_0xa352('0x28')][_0xa352('0x1b')](_0xf813a3)[_0xa352('0x20')](function(_0x466107){_0x16ec76[_0xa352('0x1b')]=_0x466107;if(_0x1c3da0[_0xa352('0x2e')][_0xa352('0x3b')]){_0x239990[_0xa352('0x3c')]=[{'all':!![]}];}return db[_0xa352('0x28')][_0xa352('0x3d')](_0x239990);})[_0xa352('0x20')](function(_0x4d461f){_0x16ec76[_0xa352('0x3e')]=_0x4d461f;return _0x16ec76;})[_0xa352('0x20')](respondWithFilteredResult(_0x59a70a,_0x239990))[_0xa352('0x3f')](handleError(_0x59a70a,null));};exports[_0xa352('0x40')]=function(_0xb13acc,_0x4e5f1e){var _0x50fb99={'raw':!![],'where':{'id':_0xb13acc['params']['id']}},_0xadf913={};_0xadf913[_0xa352('0x2c')]=_[_0xa352('0x2d')](db[_0xa352('0x28')][_0xa352('0x29')]);_0xadf913[_0xa352('0x2e')]=_[_0xa352('0x2d')](_0xb13acc[_0xa352('0x2e')]);_0xadf913[_0xa352('0x2f')]=_[_0xa352('0x30')](_0xadf913[_0xa352('0x2c')],_0xadf913[_0xa352('0x2e')]);_0x50fb99['attributes']=_[_0xa352('0x30')](_0xadf913[_0xa352('0x2c')],qs[_0xa352('0x32')](_0xb13acc[_0xa352('0x2e')][_0xa352('0x32')]));_0x50fb99[_0xa352('0x31')]=_0x50fb99['attributes'][_0xa352('0x41')]?_0x50fb99['attributes']:_0xadf913[_0xa352('0x2c')];if(_0xb13acc[_0xa352('0x2e')][_0xa352('0x3b')]){_0x50fb99['include']=[{'all':!![]}];}_0x50fb99=_[_0xa352('0x37')]({},_0x50fb99,_0xb13acc[_0xa352('0x3a')]);return db['FaxTransferReport'][_0xa352('0x42')](_0x50fb99)[_0xa352('0x20')](handleEntityNotFound(_0x4e5f1e,null))[_0xa352('0x20')](respondWithResult(_0x4e5f1e,null))[_0xa352('0x3f')](handleError(_0x4e5f1e,null));};exports[_0xa352('0x43')]=function(_0x2e6265,_0x446049){return db[_0xa352('0x28')]['create'](_0x2e6265[_0xa352('0x44')],{})[_0xa352('0x20')](respondWithResult(_0x446049,0xc9))[_0xa352('0x3f')](handleError(_0x446049,null));};exports[_0xa352('0x1f')]=function(_0x295cac,_0x495ca7){if(_0x295cac['body']['id']){delete _0x295cac[_0xa352('0x44')]['id'];}return db[_0xa352('0x28')]['find']({'where':{'id':_0x295cac['params']['id']}})[_0xa352('0x20')](handleEntityNotFound(_0x495ca7,null))[_0xa352('0x20')](saveUpdates(_0x295cac[_0xa352('0x44')],null))['then'](respondWithResult(_0x495ca7,null))[_0xa352('0x3f')](handleError(_0x495ca7,null));};exports['destroy']=function(_0x187587,_0x26d85b){return db[_0xa352('0x28')][_0xa352('0x42')]({'where':{'id':_0x187587[_0xa352('0x45')]['id']}})[_0xa352('0x20')](handleEntityNotFound(_0x26d85b,null))[_0xa352('0x20')](removeEntity(_0x26d85b,null))[_0xa352('0x3f')](handleError(_0x26d85b,null));};exports[_0xa352('0x46')]=function(_0x5758db,_0x4bfa96){return db[_0xa352('0x28')][_0xa352('0x46')]()[_0xa352('0x20')](respondWithResult(_0x4bfa96,null))[_0xa352('0x3f')](handleError(_0x4bfa96,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 45a80dd..e7fd1a9 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 _0x1faf=['FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1faf,0x1e3));var _0xf1fa=function(_0x146544,_0x4987dd){_0x146544=_0x146544-0x0;var _0x57794e=_0x1faf[_0x146544];return _0x57794e;};'use strict';var _=require(_0xf1fa('0x0'));var util=require(_0xf1fa('0x1'));var logger=require(_0xf1fa('0x2'))(_0xf1fa('0x3'));var moment=require(_0xf1fa('0x4'));var BPromise=require(_0xf1fa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1fa('0x6'));var rimraf=require(_0xf1fa('0x7'));var config=require(_0xf1fa('0x8'));var attributes=require(_0xf1fa('0x9'));module[_0xf1fa('0xa')]=function(_0x24a7d5,_0x461a1e){return _0x24a7d5['define'](_0xf1fa('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xf1fa('0xc'),'fields':[_0xf1fa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab29=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x5d2ebe,_0x3f5d6c){var _0x1d1b50=function(_0x124461){while(--_0x124461){_0x5d2ebe['push'](_0x5d2ebe['shift']());}};_0x1d1b50(++_0x3f5d6c);}(_0xab29,0x1b6));var _0x9ab2=function(_0x377723,_0xd1599f){_0x377723=_0x377723-0x0;var _0x3a8e8a=_0xab29[_0x377723];return _0x3a8e8a;};'use strict';var _=require(_0x9ab2('0x0'));var util=require(_0x9ab2('0x1'));var logger=require(_0x9ab2('0x2'))(_0x9ab2('0x3'));var moment=require(_0x9ab2('0x4'));var BPromise=require(_0x9ab2('0x5'));var rp=require(_0x9ab2('0x6'));var fs=require('fs');var path=require(_0x9ab2('0x7'));var rimraf=require(_0x9ab2('0x8'));var config=require(_0x9ab2('0x9'));var attributes=require(_0x9ab2('0xa'));module[_0x9ab2('0xb')]=function(_0x3ec89a,_0x1cc379){return _0x3ec89a['define'](_0x9ab2('0xc'),attributes,{'tableName':_0x9ab2('0xd'),'paranoid':![],'indexes':[{'name':_0x9ab2('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 5f831ba..c693199 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 _0xd0c4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xd0c4,0x8e));var _0x4d0c=function(_0x4d1dcb,_0x49df03){_0x4d1dcb=_0x4d1dcb-0x0;var _0x3088a7=_0xd0c4[_0x4d1dcb];return _0x3088a7;};'use strict';var _=require(_0x4d0c('0x0'));var util=require(_0x4d0c('0x1'));var moment=require('moment');var BPromise=require(_0x4d0c('0x2'));var rs=require(_0x4d0c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d0c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d0c('0x5'))(_0x4d0c('0x6'));var config=require(_0x4d0c('0x7'));var jayson=require(_0x4d0c('0x8'));var client=jayson[_0x4d0c('0x9')][_0x4d0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eb877,_0x9e084f,_0x540b7f){return new BPromise(function(_0x5e3369,_0x59d229){return client['request'](_0x2eb877,_0x540b7f)[_0x4d0c('0xb')](function(_0xe94245){logger['info'](_0x4d0c('0xc'),_0x9e084f,_0x4d0c('0xd'));logger['debug'](_0x4d0c('0xe'),_0x9e084f,_0x4d0c('0xd'),JSON[_0x4d0c('0xf')](_0xe94245));if(_0xe94245[_0x4d0c('0x10')]){if(_0xe94245[_0x4d0c('0x10')][_0x4d0c('0x11')]===0x1f4){logger[_0x4d0c('0x10')](_0x4d0c('0xc'),_0x9e084f,_0xe94245['error'][_0x4d0c('0x12')]);return _0x59d229(_0xe94245['error'][_0x4d0c('0x12')]);}logger['error'](_0x4d0c('0xc'),_0x9e084f,_0xe94245[_0x4d0c('0x10')][_0x4d0c('0x12')]);return _0x5e3369(_0xe94245['error'][_0x4d0c('0x12')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x9e084f,_0x4d0c('0xd'));_0x5e3369(_0xe94245[_0x4d0c('0x13')]['message']);}})[_0x4d0c('0x14')](function(_0x19bce5){logger[_0x4d0c('0x10')](_0x4d0c('0xc'),_0x9e084f,_0x19bce5);_0x59d229(_0x19bce5);});});} \ No newline at end of file +var _0xc7c7=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','result','message','catch','lodash','moment'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xc7c7,0x139));var _0x7c7c=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xc7c7[_0x374ada];return _0x449ed8;};'use strict';var _=require(_0x7c7c('0x0'));var util=require('util');var moment=require(_0x7c7c('0x1'));var BPromise=require(_0x7c7c('0x2'));var rs=require(_0x7c7c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c7c('0x4'))['db'];var utils=require(_0x7c7c('0x5'));var logger=require(_0x7c7c('0x6'))(_0x7c7c('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c7c('0x8'));var client=jayson[_0x7c7c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33d9ba,_0x54ae1b,_0x4c3a7b){return new BPromise(function(_0x1e45a1,_0x3746b4){return client[_0x7c7c('0xa')](_0x33d9ba,_0x4c3a7b)['then'](function(_0x3a48a5){logger[_0x7c7c('0xb')](_0x7c7c('0xc'),_0x54ae1b,_0x7c7c('0xd'));logger[_0x7c7c('0xe')](_0x7c7c('0xf'),_0x54ae1b,_0x7c7c('0xd'),JSON['stringify'](_0x3a48a5));if(_0x3a48a5[_0x7c7c('0x10')]){if(_0x3a48a5[_0x7c7c('0x10')][_0x7c7c('0x11')]===0x1f4){logger[_0x7c7c('0x10')](_0x7c7c('0xc'),_0x54ae1b,_0x3a48a5[_0x7c7c('0x10')]['message']);return _0x3746b4(_0x3a48a5[_0x7c7c('0x10')]['message']);}logger[_0x7c7c('0x10')](_0x7c7c('0xc'),_0x54ae1b,_0x3a48a5[_0x7c7c('0x10')]['message']);return _0x1e45a1(_0x3a48a5['error']['message']);}else{logger[_0x7c7c('0xb')](_0x7c7c('0xc'),_0x54ae1b,_0x7c7c('0xd'));_0x1e45a1(_0x3a48a5[_0x7c7c('0x12')][_0x7c7c('0x13')]);}})[_0x7c7c('0x14')](function(_0x11806c){logger[_0x7c7c('0x10')](_0x7c7c('0xc'),_0x54ae1b,_0x11806c);_0x3746b4(_0x11806c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 3987200..8ab10b4 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 _0xa86a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x2561d6,_0x1e98e2){var _0x37183e=function(_0x237cab){while(--_0x237cab){_0x2561d6['push'](_0x2561d6['shift']());}};_0x37183e(++_0x1e98e2);}(_0xa86a,0x13d));var _0xaa86=function(_0x5d50dc,_0x133930){_0x5d50dc=_0x5d50dc-0x0;var _0x4360ed=_0xa86a[_0x5d50dc];return _0x4360ed;};'use strict';var multer=require(_0xaa86('0x0'));var util=require(_0xaa86('0x1'));var path=require(_0xaa86('0x2'));var timeout=require(_0xaa86('0x3'));var express=require(_0xaa86('0x4'));var router=express[_0xaa86('0x5')]();var fs_extra=require(_0xaa86('0x6'));var auth=require(_0xaa86('0x7'));var interaction=require(_0xaa86('0x8'));var config=require(_0xaa86('0x9'));var controller=require('./faxTransferReport.controller');router[_0xaa86('0xa')]('/',auth[_0xaa86('0xb')](),controller['index']);router[_0xaa86('0xa')]('/describe',auth[_0xaa86('0xb')](),controller[_0xaa86('0xc')]);router['get']('/:id',auth[_0xaa86('0xb')](),controller['show']);router['post']('/',auth[_0xaa86('0xb')](),controller[_0xaa86('0xd')]);router[_0xaa86('0xe')](_0xaa86('0xf'),auth['isAuthenticated'](),controller[_0xaa86('0x10')]);router[_0xaa86('0x11')](_0xaa86('0xf'),auth[_0xaa86('0xb')](),controller[_0xaa86('0x12')]);module[_0xaa86('0x13')]=router; \ No newline at end of file +var _0xb029=['get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller'];(function(_0x162ec5,_0x23c2d3){var _0x6ddef1=function(_0x30d089){while(--_0x30d089){_0x162ec5['push'](_0x162ec5['shift']());}};_0x6ddef1(++_0x23c2d3);}(_0xb029,0x1b1));var _0x9b02=function(_0x1d64db,_0x424a78){_0x1d64db=_0x1d64db-0x0;var _0x8df836=_0xb029[_0x1d64db];return _0x8df836;};'use strict';var multer=require('multer');var util=require(_0x9b02('0x0'));var path=require('path');var timeout=require(_0x9b02('0x1'));var express=require(_0x9b02('0x2'));var router=express[_0x9b02('0x3')]();var fs_extra=require(_0x9b02('0x4'));var auth=require(_0x9b02('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9b02('0x6'));var controller=require(_0x9b02('0x7'));router[_0x9b02('0x8')]('/',auth[_0x9b02('0x9')](),controller['index']);router[_0x9b02('0x8')](_0x9b02('0xa'),auth[_0x9b02('0x9')](),controller[_0x9b02('0xb')]);router[_0x9b02('0x8')](_0x9b02('0xc'),auth['isAuthenticated'](),controller[_0x9b02('0xd')]);router[_0x9b02('0xe')]('/',auth[_0x9b02('0x9')](),controller[_0x9b02('0xf')]);router[_0x9b02('0x10')](_0x9b02('0xc'),auth[_0x9b02('0x9')](),controller[_0x9b02('0x11')]);router[_0x9b02('0x12')](_0x9b02('0xc'),auth[_0x9b02('0x9')](),controller[_0x9b02('0x13')]);module[_0x9b02('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 53c1d1b..887ea6a 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 _0x191c=['show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','get'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x191c,0xdc));var _0xc191=function(_0xd09616,_0x424199){_0xd09616=_0xd09616-0x0;var _0x84a883=_0x191c[_0xd09616];return _0x84a883;};'use strict';var multer=require(_0xc191('0x0'));var util=require(_0xc191('0x1'));var path=require(_0xc191('0x2'));var timeout=require('connect-timeout');var express=require(_0xc191('0x3'));var router=express['Router']();var fs_extra=require(_0xc191('0x4'));var auth=require(_0xc191('0x5'));var interaction=require(_0xc191('0x6'));var config=require(_0xc191('0x7'));var controller=require(_0xc191('0x8'));router['get']('/',auth[_0xc191('0x9')](),controller['index']);router[_0xc191('0xa')]('/:id',auth[_0xc191('0x9')](),controller[_0xc191('0xb')]);router[_0xc191('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xc191('0xc')]);router[_0xc191('0xa')](_0xc191('0xd'),auth['isAuthenticated'](),controller[_0xc191('0xe')]);router[_0xc191('0xf')]('/',auth[_0xc191('0x9')](),controller[_0xc191('0x10')]);router[_0xc191('0xf')]('/:id/configurations',auth[_0xc191('0x9')](),controller[_0xc191('0x11')]);router[_0xc191('0x12')](_0xc191('0x13'),auth[_0xc191('0x9')](),controller['update']);router['delete']('/:id',auth[_0xc191('0x9')](),controller['destroy']);module[_0xc191('0x14')]=router; \ No newline at end of file +var _0x929d=['create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x929d,0x9f));var _0xd929=function(_0x55f5bd,_0x3f4770){_0x55f5bd=_0x55f5bd-0x0;var _0x2e6d95=_0x929d[_0x55f5bd];return _0x2e6d95;};'use strict';var multer=require(_0xd929('0x0'));var util=require('util');var path=require(_0xd929('0x1'));var timeout=require(_0xd929('0x2'));var express=require('express');var router=express[_0xd929('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd929('0x4'));var interaction=require(_0xd929('0x5'));var config=require(_0xd929('0x6'));var controller=require(_0xd929('0x7'));router['get']('/',auth[_0xd929('0x8')](),controller[_0xd929('0x9')]);router[_0xd929('0xa')](_0xd929('0xb'),auth[_0xd929('0x8')](),controller[_0xd929('0xc')]);router[_0xd929('0xa')]('/:id/configurations',auth[_0xd929('0x8')](),controller[_0xd929('0xd')]);router[_0xd929('0xa')](_0xd929('0xe'),auth[_0xd929('0x8')](),controller[_0xd929('0xf')]);router['post']('/',auth[_0xd929('0x8')](),controller[_0xd929('0x10')]);router[_0xd929('0x11')](_0xd929('0x12'),auth[_0xd929('0x8')](),controller[_0xd929('0x13')]);router[_0xd929('0x14')]('/:id',auth[_0xd929('0x8')](),controller[_0xd929('0x15')]);router[_0xd929('0x16')]('/:id',auth[_0xd929('0x8')](),controller[_0xd929('0x17')]);module[_0xd929('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index c7f19d4..ee29bff 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 _0x9db7=['exports','STRING','basic','ENUM','integrationTab','newTab','sequelize'];(function(_0x351454,_0x52e05d){var _0x50ed7c=function(_0x5efd7d){while(--_0x5efd7d){_0x351454['push'](_0x351454['shift']());}};_0x50ed7c(++_0x52e05d);}(_0x9db7,0x1bf));var _0x79db=function(_0x5bce7f,_0x19b56a){_0x5bce7f=_0x5bce7f-0x0;var _0x52de31=_0x9db7[_0x5bce7f];return _0x52de31;};'use strict';var Sequelize=require(_0x79db('0x0'));module[_0x79db('0x1')]={'name':{'type':Sequelize[_0x79db('0x2')]},'description':{'type':Sequelize[_0x79db('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x79db('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x79db('0x3')),'defaultValue':_0x79db('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x79db('0x2')]},'consumerSecret':{'type':Sequelize[_0x79db('0x2')]},'token':{'type':Sequelize[_0x79db('0x2')]},'tokenSecret':{'type':Sequelize[_0x79db('0x2')]},'serverUrl':{'type':Sequelize[_0x79db('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x79db('0x4')](_0x79db('0x5'),_0x79db('0x6')),'defaultValue':_0x79db('0x5')}}; \ No newline at end of file +var _0x2b50=['integrationTab','newTab','sequelize','STRING','ENUM','basic'];(function(_0x5a488c,_0x4cc470){var _0x53a7d6=function(_0x43a0d8){while(--_0x43a0d8){_0x5a488c['push'](_0x5a488c['shift']());}};_0x53a7d6(++_0x4cc470);}(_0x2b50,0x68));var _0x02b5=function(_0x46185e,_0x4658b8){_0x46185e=_0x46185e-0x0;var _0x1f5603=_0x2b50[_0x46185e];return _0x1f5603;};'use strict';var Sequelize=require(_0x02b5('0x0'));module['exports']={'name':{'type':Sequelize[_0x02b5('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x02b5('0x2')](_0x02b5('0x3')),'defaultValue':_0x02b5('0x3')},'password':{'type':Sequelize[_0x02b5('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x02b5('0x1')]},'token':{'type':Sequelize[_0x02b5('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x02b5('0x4'),_0x02b5('0x5')),'defaultValue':_0x02b5('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 869e985..70031a3 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 _0x2eb2=['merge','options','includeAll','show','params','keys','rawAttributes','include','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','DeskField','getFields','priority','authType','username','consumerSecret','token','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','password','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','stack','name','map','DeskAccount','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x1ed39d,_0x56e59b){var _0x44d058=function(_0x4d7d30){while(--_0x4d7d30){_0x1ed39d['push'](_0x1ed39d['shift']());}};_0x44d058(++_0x56e59b);}(_0x2eb2,0x19f));var _0x22eb=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2eb2[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x22eb('0x16'));var jayson=require(_0x22eb('0x17'));var client=jayson[_0x22eb('0x18')][_0x22eb('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x427439,_0x49e37e,_0x350ade,_0x53f14e){return new BPromise(function(_0x1f5089,_0x55ede8){var _0x40c8cb=_0x53f14e||client;return _0x40c8cb[_0x22eb('0x1a')](_0x427439,_0x350ade)['then'](function(_0x48b63c){logger['info'](_0x22eb('0x1b'),_0x49e37e,'request\x20sent');logger['debug'](_0x22eb('0x1c'),_0x49e37e,'request\x20sent',JSON['stringify'](_0x48b63c));if(_0x48b63c[_0x22eb('0x1d')]){if(_0x48b63c[_0x22eb('0x1d')][_0x22eb('0x1e')]===0x1f4){logger[_0x22eb('0x1d')](_0x22eb('0x1b'),_0x49e37e,_0x48b63c['error'][_0x22eb('0x1f')]);return _0x55ede8(_0x48b63c[_0x22eb('0x1d')][_0x22eb('0x1f')]);}logger[_0x22eb('0x1d')](_0x22eb('0x1b'),_0x49e37e,_0x48b63c['error'][_0x22eb('0x1f')]);return _0x1f5089(_0x48b63c[_0x22eb('0x1d')][_0x22eb('0x1f')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x49e37e,_0x22eb('0x20'));_0x1f5089(_0x48b63c[_0x22eb('0x21')][_0x22eb('0x1f')]);}})[_0x22eb('0x22')](function(_0x2d95f0){logger[_0x22eb('0x1d')](_0x22eb('0x1b'),_0x49e37e,_0x2d95f0);_0x55ede8(_0x2d95f0);});});}function respondWithStatusCode(_0x4e7e69,_0x2e8f7c){_0x2e8f7c=_0x2e8f7c||0xcc;return function(_0x11edbd){if(_0x11edbd){return _0x4e7e69[_0x22eb('0x23')](_0x2e8f7c);}return _0x4e7e69[_0x22eb('0x24')](_0x2e8f7c)[_0x22eb('0x25')]();};}function respondWithResult(_0x4da252,_0x12c133){_0x12c133=_0x12c133||0xc8;return function(_0x6f8ff3){if(_0x6f8ff3){return _0x4da252[_0x22eb('0x24')](_0x12c133)['json'](_0x6f8ff3);}};}function respondWithFilteredResult(_0xe0783c,_0x259847){return function(_0x4b409a){if(_0x4b409a){var _0x32a4b6=typeof _0x259847[_0x22eb('0x26')]===_0x22eb('0x27')&&typeof _0x259847[_0x22eb('0x28')]===_0x22eb('0x27');var _0x4f4f56=_0x4b409a['count'];var _0x2a950e=_0x32a4b6?0x0:_0x259847[_0x22eb('0x26')];var _0x44cf91=_0x32a4b6?_0x4b409a[_0x22eb('0x29')]:_0x259847[_0x22eb('0x26')]+_0x259847[_0x22eb('0x28')];var _0x2375e7;if(_0x44cf91>=_0x4f4f56){_0x44cf91=_0x4f4f56;_0x2375e7=0xc8;}else{_0x2375e7=0xce;}_0xe0783c[_0x22eb('0x24')](_0x2375e7);return _0xe0783c[_0x22eb('0x2a')](_0x22eb('0x2b'),_0x2a950e+'-'+_0x44cf91+'/'+_0x4f4f56)[_0x22eb('0x2c')](_0x4b409a);}return null;};}function patchUpdates(_0x5a37f8){return function(_0x54f401){try{jsonpatch[_0x22eb('0x2d')](_0x54f401,_0x5a37f8,!![]);}catch(_0x4e3604){return BPromise[_0x22eb('0x2e')](_0x4e3604);}return _0x54f401[_0x22eb('0x2f')]();};}function saveUpdates(_0xd564a9,_0x11199f){return function(_0x351ed8){if(_0x351ed8){return _0x351ed8[_0x22eb('0x30')](_0xd564a9)[_0x22eb('0x31')](function(_0x476cdb){return _0x476cdb;});}return null;};}function removeEntity(_0x22354d,_0x232af4){return function(_0x509bb7){if(_0x509bb7){return _0x509bb7['destroy']()[_0x22eb('0x31')](function(){_0x22354d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2caba3,_0xaa12a0){return function(_0x39dbc6){if(!_0x39dbc6){_0x2caba3[_0x22eb('0x23')](0x194);}return _0x39dbc6;};}function handleError(_0x45c53e,_0x332e9a){_0x332e9a=_0x332e9a||0x1f4;return function(_0x3855df){logger[_0x22eb('0x1d')](_0x3855df[_0x22eb('0x32')]);if(_0x3855df[_0x22eb('0x33')]){delete _0x3855df['name'];}_0x45c53e[_0x22eb('0x24')](_0x332e9a)['send'](_0x3855df);};}exports['index']=function(_0x35a264,_0x2b5cb5){var _0x48e47e={},_0x42e9bd={},_0x121c04={'count':0x0,'rows':[]};var _0x236def=_[_0x22eb('0x34')](db[_0x22eb('0x35')]['rawAttributes'],function(_0x25f140){return{'name':_0x25f140[_0x22eb('0x36')],'type':_0x25f140['type'][_0x22eb('0x37')]};});_0x42e9bd[_0x22eb('0x38')]=_[_0x22eb('0x34')](_0x236def,_0x22eb('0x33'));_0x42e9bd[_0x22eb('0x39')]=_['keys'](_0x35a264['query']);_0x42e9bd[_0x22eb('0x3a')]=_[_0x22eb('0x3b')](_0x42e9bd['model'],_0x42e9bd[_0x22eb('0x39')]);_0x48e47e[_0x22eb('0x3c')]=_[_0x22eb('0x3b')](_0x42e9bd['model'],qs[_0x22eb('0x3d')](_0x35a264[_0x22eb('0x39')][_0x22eb('0x3d')]));_0x48e47e[_0x22eb('0x3c')]=_0x48e47e[_0x22eb('0x3c')][_0x22eb('0x3e')]?_0x48e47e['attributes']:_0x42e9bd[_0x22eb('0x38')];if(!_0x35a264[_0x22eb('0x39')]['hasOwnProperty'](_0x22eb('0x3f'))){_0x48e47e[_0x22eb('0x28')]=qs[_0x22eb('0x28')](_0x35a264[_0x22eb('0x39')][_0x22eb('0x28')]);_0x48e47e[_0x22eb('0x26')]=qs[_0x22eb('0x26')](_0x35a264[_0x22eb('0x39')][_0x22eb('0x26')]);}_0x48e47e[_0x22eb('0x40')]=qs[_0x22eb('0x41')](_0x35a264[_0x22eb('0x39')][_0x22eb('0x41')]);_0x48e47e[_0x22eb('0x42')]=qs[_0x22eb('0x3a')](_[_0x22eb('0x43')](_0x35a264[_0x22eb('0x39')],_0x42e9bd[_0x22eb('0x3a')]),_0x236def);if(_0x35a264['query'][_0x22eb('0x44')]){_0x48e47e[_0x22eb('0x42')]=_['merge'](_0x48e47e[_0x22eb('0x42')],{'$or':_[_0x22eb('0x34')](_0x236def,function(_0x5e9952){if(_0x5e9952['type']!=='VIRTUAL'){var _0xada312={};_0xada312[_0x5e9952[_0x22eb('0x33')]]={'$like':'%'+_0x35a264['query']['filter']+'%'};return _0xada312;}})});}_0x48e47e=_[_0x22eb('0x45')]({},_0x48e47e,_0x35a264[_0x22eb('0x46')]);var _0x326b24={'where':_0x48e47e[_0x22eb('0x42')]};return db[_0x22eb('0x35')][_0x22eb('0x29')](_0x326b24)[_0x22eb('0x31')](function(_0x147ca0){_0x121c04['count']=_0x147ca0;if(_0x35a264['query'][_0x22eb('0x47')]){_0x48e47e['include']=[{'all':!![]}];}return db[_0x22eb('0x35')]['findAll'](_0x48e47e);})[_0x22eb('0x31')](function(_0x5c41c0){_0x121c04['rows']=_0x5c41c0;return _0x121c04;})['then'](respondWithFilteredResult(_0x2b5cb5,_0x48e47e))['catch'](handleError(_0x2b5cb5,null));};exports[_0x22eb('0x48')]=function(_0x4b5c03,_0x320211){var _0x3b35c6={'raw':![],'where':{'id':_0x4b5c03[_0x22eb('0x49')]['id']}},_0x490bef={};_0x490bef['model']=_[_0x22eb('0x4a')](db[_0x22eb('0x35')][_0x22eb('0x4b')]);_0x490bef[_0x22eb('0x39')]=_[_0x22eb('0x4a')](_0x4b5c03[_0x22eb('0x39')]);_0x490bef[_0x22eb('0x3a')]=_[_0x22eb('0x3b')](_0x490bef[_0x22eb('0x38')],_0x490bef['query']);_0x3b35c6[_0x22eb('0x3c')]=_[_0x22eb('0x3b')](_0x490bef['model'],qs[_0x22eb('0x3d')](_0x4b5c03[_0x22eb('0x39')][_0x22eb('0x3d')]));_0x3b35c6[_0x22eb('0x3c')]=_0x3b35c6['attributes'][_0x22eb('0x3e')]?_0x3b35c6[_0x22eb('0x3c')]:_0x490bef[_0x22eb('0x38')];if(_0x4b5c03[_0x22eb('0x39')][_0x22eb('0x47')]){_0x3b35c6[_0x22eb('0x4c')]=[{'all':!![]}];}_0x3b35c6=_['merge']({},_0x3b35c6,_0x4b5c03[_0x22eb('0x46')]);return db['DeskAccount'][_0x22eb('0x4d')](_0x3b35c6)['then'](handleEntityNotFound(_0x320211,null))[_0x22eb('0x31')](respondWithResult(_0x320211,null))[_0x22eb('0x22')](handleError(_0x320211,null));};exports[_0x22eb('0x4e')]=function(_0x2c1b87,_0x3f03df){return db['DeskAccount']['create'](_0x2c1b87[_0x22eb('0x4f')],{})[_0x22eb('0x31')](respondWithResult(_0x3f03df,0xc9))['catch'](handleError(_0x3f03df,null));};exports[_0x22eb('0x30')]=function(_0xdf9531,_0x2c5165){if(_0xdf9531[_0x22eb('0x4f')]['id']){delete _0xdf9531[_0x22eb('0x4f')]['id'];}return db[_0x22eb('0x35')][_0x22eb('0x4d')]({'where':{'id':_0xdf9531[_0x22eb('0x49')]['id']}})[_0x22eb('0x31')](handleEntityNotFound(_0x2c5165,null))[_0x22eb('0x31')](saveUpdates(_0xdf9531[_0x22eb('0x4f')],null))['then'](respondWithResult(_0x2c5165,null))[_0x22eb('0x22')](handleError(_0x2c5165,null));};exports[_0x22eb('0x50')]=function(_0x3764d4,_0x2562a1){return db[_0x22eb('0x35')][_0x22eb('0x4d')]({'where':{'id':_0x3764d4[_0x22eb('0x49')]['id']}})[_0x22eb('0x31')](handleEntityNotFound(_0x2562a1,null))[_0x22eb('0x31')](removeEntity(_0x2562a1,null))[_0x22eb('0x22')](handleError(_0x2562a1,null));};exports[_0x22eb('0x51')]=function(_0x108607,_0x38d5aa,_0x4f3be6){var _0x586384={};var _0x597497={};var _0x36ee0d;var _0x91c8a3;return db[_0x22eb('0x35')][_0x22eb('0x52')]({'where':{'id':_0x108607[_0x22eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x38d5aa,null))[_0x22eb('0x31')](function(_0x2a6857){if(_0x2a6857){_0x36ee0d=_0x2a6857;_0x597497['model']=_['keys'](db[_0x22eb('0x53')][_0x22eb('0x4b')]);_0x597497[_0x22eb('0x39')]=_[_0x22eb('0x4a')](_0x108607[_0x22eb('0x39')]);_0x597497[_0x22eb('0x3a')]=_[_0x22eb('0x3b')](_0x597497[_0x22eb('0x38')],_0x597497[_0x22eb('0x39')]);_0x586384[_0x22eb('0x3c')]=_[_0x22eb('0x3b')](_0x597497[_0x22eb('0x38')],qs[_0x22eb('0x3d')](_0x108607[_0x22eb('0x39')]['fields']));_0x586384[_0x22eb('0x3c')]=_0x586384[_0x22eb('0x3c')][_0x22eb('0x3e')]?_0x586384['attributes']:_0x597497[_0x22eb('0x38')];_0x586384['order']=qs[_0x22eb('0x41')](_0x108607['query'][_0x22eb('0x41')]);_0x586384[_0x22eb('0x42')]=qs['filters'](_[_0x22eb('0x43')](_0x108607[_0x22eb('0x39')],_0x597497['filters']));if(_0x108607['query'][_0x22eb('0x44')]){_0x586384[_0x22eb('0x42')]=_[_0x22eb('0x45')](_0x586384[_0x22eb('0x42')],{'$or':_[_0x22eb('0x34')](_0x586384[_0x22eb('0x3c')],function(_0x4f5eee){var _0x2e77c6={};_0x2e77c6[_0x4f5eee]={'$like':'%'+_0x108607['query']['filter']+'%'};return _0x2e77c6;})});}_0x586384=_[_0x22eb('0x45')]({},_0x586384,_0x108607[_0x22eb('0x46')]);return _0x36ee0d[_0x22eb('0x51')](_0x586384);}})[_0x22eb('0x31')](function(_0x300e45){if(_0x300e45){_0x91c8a3=_0x300e45[_0x22eb('0x3e')];if(!_0x108607[_0x22eb('0x39')][_0x22eb('0x54')]('nolimit')){_0x586384['limit']=qs[_0x22eb('0x28')](_0x108607[_0x22eb('0x39')]['limit']);_0x586384[_0x22eb('0x26')]=qs[_0x22eb('0x26')](_0x108607[_0x22eb('0x39')][_0x22eb('0x26')]);}return _0x36ee0d[_0x22eb('0x51')](_0x586384);}})[_0x22eb('0x31')](function(_0x5ce4ea){if(_0x5ce4ea){return _0x5ce4ea?{'count':_0x91c8a3,'rows':_0x5ce4ea}:null;}})[_0x22eb('0x31')](respondWithResult(_0x38d5aa,null))[_0x22eb('0x22')](handleError(_0x38d5aa,null));};exports[_0x22eb('0x55')]=function(_0x5e46b0,_0x4fcc2c,_0x3b1dc9){if(_0x5e46b0[_0x22eb('0x4f')]['id']){delete _0x5e46b0[_0x22eb('0x4f')]['id'];}return db['DeskAccount'][_0x22eb('0x52')]({'where':{'id':_0x5e46b0['params']['id']}})[_0x22eb('0x31')](handleEntityNotFound(_0x4fcc2c,null))[_0x22eb('0x31')](function(_0x3d7636){if(_0x3d7636){_0x5e46b0[_0x22eb('0x4f')]['AccountId']=_0x3d7636['id'];_0x5e46b0[_0x22eb('0x4f')][_0x22eb('0x56')]=integrations[_0x22eb('0x57')](_0x5e46b0[_0x22eb('0x4f')][_0x22eb('0x58')],_0x5e46b0[_0x22eb('0x4f')][_0x22eb('0x59')]);_0x5e46b0[_0x22eb('0x4f')][_0x22eb('0x5a')]=integrations[_0x22eb('0x5b')](_0x5e46b0[_0x22eb('0x4f')]['channel'],_0x5e46b0[_0x22eb('0x4f')][_0x22eb('0x59')]);return db['DeskConfiguration']['create'](_0x5e46b0['body'],{'include':[{'model':db[_0x22eb('0x5c')],'as':_0x22eb('0x56')},{'model':db['DeskField'],'as':_0x22eb('0x5a')}]});}return null;})[_0x22eb('0x31')](respondWithResult(_0x4fcc2c,null))[_0x22eb('0x22')](handleError(_0x4fcc2c,null));};exports[_0x22eb('0x5d')]=function(_0x8cbc83,_0x4ab4f8,_0x5e01b5){var _0x297554=[{'name':_0x22eb('0x5e'),'label':_0x22eb('0x5e'),'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 _0x4fffb3='';return db['DeskAccount'][_0x22eb('0x52')]({'where':{'id':_0x8cbc83['params']['id']},'attributes':['id','remoteUri',_0x22eb('0x5f'),_0x22eb('0x60'),'password','consumerKey',_0x22eb('0x61'),_0x22eb('0x62'),'tokenSecret']})[_0x22eb('0x31')](handleEntityNotFound(_0x4ab4f8,null))[_0x22eb('0x31')](function(_0x1224b5){if(_0x1224b5){_0x4fffb3=_0x1224b5['remoteUri'];var _0x464f4f=_0x4fffb3[_0x22eb('0x63')](-0x1);if(_0x464f4f==='/'){_0x4fffb3=_0x4fffb3[_0x22eb('0x64')](0x0,_0x4fffb3[_0x22eb('0x65')](_0x464f4f));}var _0x3697ad={'method':'GET','uri':util[_0x22eb('0x66')](_0x22eb('0x67'),_0x4fffb3),'headers':{'Content-Type':_0x22eb('0x68'),'Accept':'application/json'},'json':!![]};if(_0x1224b5['authType']===_0x22eb('0x69')){_0x3697ad[_0x22eb('0x6a')][_0x22eb('0x6b')]=util['format'](_0x22eb('0x6c'),new Buffer(util[_0x22eb('0x66')](_0x22eb('0x6d'),_0x1224b5['username'],_0x1224b5[_0x22eb('0x6e')]))['toString']('base64'));}return rp(_0x3697ad)[_0x22eb('0x31')](function(_0x1e541f){return _0x297554[_0x22eb('0x6f')](_['map'](_0x1e541f[_0x22eb('0x70')][_0x22eb('0x71')],function(_0x2d422b){return{'id':_0x2d422b[_0x22eb('0x33')],'name':_0x2d422b[_0x22eb('0x33')],'type':_0x2d422b['type'],'active':_0x2d422b[_0x22eb('0x72')],'label':_0x2d422b['label'],'custom':!![]};}));});}})[_0x22eb('0x31')](function(_0x40161b){return{'count':_0x40161b[_0x22eb('0x3e')],'rows':_0x40161b};})['then'](respondWithResult(_0x4ab4f8,null))[_0x22eb('0x22')](function(_0x45859c){var _0x25dff0=_0x8cbc83[_0x22eb('0x39')][_0x22eb('0x73')]?0x1f4:_0x45859c[_0x22eb('0x74')]||0x1f4;logger[_0x22eb('0x1d')](_0x22eb('0x75'),_0x22eb('0x5d'),_0x25dff0,JSON[_0x22eb('0x76')](_0x45859c));delete _0x45859c[_0x22eb('0x33')];if(_0x25dff0===0x191){_0x25dff0=0x190;}_0x4ab4f8['status'](_0x25dff0)[_0x22eb('0x77')](_0x8cbc83[_0x22eb('0x39')][_0x22eb('0x73')]?{'message':_0x22eb('0x78'),'statusCode':_0x45859c['statusCode']}:_0x45859c);});}; \ No newline at end of file +var _0x83ed=['api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','DeskAccount,\x20%s,\x20%s','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','params','create','body','find','findOne','map','options','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','priority','remoteUri','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','entries','active','label','test','statusCode','getFields','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger'];(function(_0xde12e5,_0x526e33){var _0x332c1c=function(_0x4b8326){while(--_0x4b8326){_0xde12e5['push'](_0xde12e5['shift']());}};_0x332c1c(++_0x526e33);}(_0x83ed,0x66));var _0xd83e=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x83ed[_0x53cf8e];return _0x459197;};'use strict';var emlformat=require(_0xd83e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd83e('0x1'));var jsonpatch=require(_0xd83e('0x2'));var rp=require(_0xd83e('0x3'));var moment=require('moment');var BPromise=require(_0xd83e('0x4'));var Mustache=require(_0xd83e('0x5'));var util=require(_0xd83e('0x6'));var path=require(_0xd83e('0x7'));var sox=require(_0xd83e('0x8'));var csv=require(_0xd83e('0x9'));var ejs=require(_0xd83e('0xa'));var fs=require('fs');var fs_extra=require(_0xd83e('0xb'));var _=require(_0xd83e('0xc'));var squel=require('squel');var crypto=require(_0xd83e('0xd'));var jsforce=require(_0xd83e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd83e('0x9'));var querystring=require(_0xd83e('0xf'));var Papa=require(_0xd83e('0x10'));var Redis=require('ioredis');var authService=require(_0xd83e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd83e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd83e('0x13'))(_0xd83e('0x14'));var utils=require('../../config/utils');var config=require(_0xd83e('0x15'));var licenseUtil=require(_0xd83e('0x16'));var db=require(_0xd83e('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xd83e('0x18'));var client=jayson[_0xd83e('0x19')][_0xd83e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2042c1,_0x131938,_0x275334,_0x4739b3){return new BPromise(function(_0x23c5cc,_0x201af3){var _0x301767=_0x4739b3||client;return _0x301767[_0xd83e('0x1b')](_0x2042c1,_0x275334)[_0xd83e('0x1c')](function(_0x8b7347){logger['info']('DeskAccount,\x20%s,\x20%s',_0x131938,_0xd83e('0x1d'));logger['debug'](_0xd83e('0x1e'),_0x131938,'request\x20sent',JSON[_0xd83e('0x1f')](_0x8b7347));if(_0x8b7347[_0xd83e('0x20')]){if(_0x8b7347['error']['code']===0x1f4){logger[_0xd83e('0x20')](_0xd83e('0x21'),_0x131938,_0x8b7347[_0xd83e('0x20')][_0xd83e('0x22')]);return _0x201af3(_0x8b7347[_0xd83e('0x20')][_0xd83e('0x22')]);}logger[_0xd83e('0x20')](_0xd83e('0x21'),_0x131938,_0x8b7347[_0xd83e('0x20')]['message']);return _0x23c5cc(_0x8b7347[_0xd83e('0x20')]['message']);}else{logger[_0xd83e('0x23')](_0xd83e('0x21'),_0x131938,'request\x20sent');_0x23c5cc(_0x8b7347[_0xd83e('0x24')][_0xd83e('0x22')]);}})[_0xd83e('0x25')](function(_0xd6acd6){logger[_0xd83e('0x20')](_0xd83e('0x21'),_0x131938,_0xd6acd6);_0x201af3(_0xd6acd6);});});}function respondWithStatusCode(_0x43b520,_0x38842d){_0x38842d=_0x38842d||0xcc;return function(_0x54d243){if(_0x54d243){return _0x43b520['sendStatus'](_0x38842d);}return _0x43b520['status'](_0x38842d)['end']();};}function respondWithResult(_0x21aafc,_0x3d19b8){_0x3d19b8=_0x3d19b8||0xc8;return function(_0x2d1549){if(_0x2d1549){return _0x21aafc[_0xd83e('0x26')](_0x3d19b8)[_0xd83e('0x27')](_0x2d1549);}};}function respondWithFilteredResult(_0x2bc6f8,_0x40c974){return function(_0x1f95d9){if(_0x1f95d9){var _0xb213a2=typeof _0x40c974[_0xd83e('0x28')]===_0xd83e('0x29')&&typeof _0x40c974[_0xd83e('0x2a')]===_0xd83e('0x29');var _0x57f55b=_0x1f95d9[_0xd83e('0x2b')];var _0x4189e2=_0xb213a2?0x0:_0x40c974[_0xd83e('0x28')];var _0x2f1178=_0xb213a2?_0x1f95d9['count']:_0x40c974[_0xd83e('0x28')]+_0x40c974['limit'];var _0x53792b;if(_0x2f1178>=_0x57f55b){_0x2f1178=_0x57f55b;_0x53792b=0xc8;}else{_0x53792b=0xce;}_0x2bc6f8[_0xd83e('0x26')](_0x53792b);return _0x2bc6f8[_0xd83e('0x2c')](_0xd83e('0x2d'),_0x4189e2+'-'+_0x2f1178+'/'+_0x57f55b)[_0xd83e('0x27')](_0x1f95d9);}return null;};}function patchUpdates(_0x4a3a8f){return function(_0x498603){try{jsonpatch['apply'](_0x498603,_0x4a3a8f,!![]);}catch(_0x1bcf09){return BPromise[_0xd83e('0x2e')](_0x1bcf09);}return _0x498603[_0xd83e('0x2f')]();};}function saveUpdates(_0x4409bf,_0x52dd16){return function(_0xb7efa9){if(_0xb7efa9){return _0xb7efa9[_0xd83e('0x30')](_0x4409bf)[_0xd83e('0x1c')](function(_0x2fde2c){return _0x2fde2c;});}return null;};}function removeEntity(_0x12c53c,_0xa81e30){return function(_0x2640cc){if(_0x2640cc){return _0x2640cc[_0xd83e('0x31')]()['then'](function(){_0x12c53c[_0xd83e('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b9e7e,_0x5d814e){return function(_0x168c2b){if(!_0x168c2b){_0x3b9e7e[_0xd83e('0x32')](0x194);}return _0x168c2b;};}function handleError(_0x6569aa,_0x1a6b8a){_0x1a6b8a=_0x1a6b8a||0x1f4;return function(_0x3097b7){logger[_0xd83e('0x20')](_0x3097b7[_0xd83e('0x33')]);if(_0x3097b7[_0xd83e('0x34')]){delete _0x3097b7[_0xd83e('0x34')];}_0x6569aa[_0xd83e('0x26')](_0x1a6b8a)['send'](_0x3097b7);};}exports['index']=function(_0x453c14,_0x128e98){var _0x2f38de={},_0x346982={},_0x5e4711={'count':0x0,'rows':[]};var _0x59b435=_['map'](db[_0xd83e('0x35')][_0xd83e('0x36')],function(_0x51fd6b){return{'name':_0x51fd6b[_0xd83e('0x37')],'type':_0x51fd6b[_0xd83e('0x38')][_0xd83e('0x39')]};});_0x346982[_0xd83e('0x3a')]=_['map'](_0x59b435,'name');_0x346982[_0xd83e('0x3b')]=_[_0xd83e('0x3c')](_0x453c14[_0xd83e('0x3b')]);_0x346982[_0xd83e('0x3d')]=_[_0xd83e('0x3e')](_0x346982[_0xd83e('0x3a')],_0x346982[_0xd83e('0x3b')]);_0x2f38de[_0xd83e('0x3f')]=_[_0xd83e('0x3e')](_0x346982[_0xd83e('0x3a')],qs[_0xd83e('0x40')](_0x453c14[_0xd83e('0x3b')][_0xd83e('0x40')]));_0x2f38de[_0xd83e('0x3f')]=_0x2f38de[_0xd83e('0x3f')][_0xd83e('0x41')]?_0x2f38de['attributes']:_0x346982[_0xd83e('0x3a')];if(!_0x453c14['query'][_0xd83e('0x42')](_0xd83e('0x43'))){_0x2f38de['limit']=qs[_0xd83e('0x2a')](_0x453c14[_0xd83e('0x3b')][_0xd83e('0x2a')]);_0x2f38de[_0xd83e('0x28')]=qs[_0xd83e('0x28')](_0x453c14[_0xd83e('0x3b')][_0xd83e('0x28')]);}_0x2f38de[_0xd83e('0x44')]=qs[_0xd83e('0x45')](_0x453c14[_0xd83e('0x3b')][_0xd83e('0x45')]);_0x2f38de[_0xd83e('0x46')]=qs[_0xd83e('0x3d')](_[_0xd83e('0x47')](_0x453c14[_0xd83e('0x3b')],_0x346982['filters']),_0x59b435);if(_0x453c14['query'][_0xd83e('0x48')]){_0x2f38de[_0xd83e('0x46')]=_[_0xd83e('0x49')](_0x2f38de['where'],{'$or':_['map'](_0x59b435,function(_0x16df9e){if(_0x16df9e[_0xd83e('0x38')]!==_0xd83e('0x4a')){var _0x4b8e79={};_0x4b8e79[_0x16df9e['name']]={'$like':'%'+_0x453c14[_0xd83e('0x3b')][_0xd83e('0x48')]+'%'};return _0x4b8e79;}})});}_0x2f38de=_['merge']({},_0x2f38de,_0x453c14['options']);var _0x31244a={'where':_0x2f38de[_0xd83e('0x46')]};return db['DeskAccount']['count'](_0x31244a)[_0xd83e('0x1c')](function(_0x42e8ac){_0x5e4711[_0xd83e('0x2b')]=_0x42e8ac;if(_0x453c14[_0xd83e('0x3b')][_0xd83e('0x4b')]){_0x2f38de[_0xd83e('0x4c')]=[{'all':!![]}];}return db[_0xd83e('0x35')][_0xd83e('0x4d')](_0x2f38de);})[_0xd83e('0x1c')](function(_0x3f892a){_0x5e4711['rows']=_0x3f892a;return _0x5e4711;})[_0xd83e('0x1c')](respondWithFilteredResult(_0x128e98,_0x2f38de))[_0xd83e('0x25')](handleError(_0x128e98,null));};exports['show']=function(_0xf632ee,_0x113646){var _0x431f6f={'raw':![],'where':{'id':_0xf632ee[_0xd83e('0x4e')]['id']}},_0x1b3477={};_0x1b3477[_0xd83e('0x3a')]=_[_0xd83e('0x3c')](db[_0xd83e('0x35')]['rawAttributes']);_0x1b3477[_0xd83e('0x3b')]=_['keys'](_0xf632ee['query']);_0x1b3477[_0xd83e('0x3d')]=_[_0xd83e('0x3e')](_0x1b3477[_0xd83e('0x3a')],_0x1b3477[_0xd83e('0x3b')]);_0x431f6f[_0xd83e('0x3f')]=_[_0xd83e('0x3e')](_0x1b3477['model'],qs[_0xd83e('0x40')](_0xf632ee[_0xd83e('0x3b')][_0xd83e('0x40')]));_0x431f6f[_0xd83e('0x3f')]=_0x431f6f[_0xd83e('0x3f')]['length']?_0x431f6f[_0xd83e('0x3f')]:_0x1b3477[_0xd83e('0x3a')];if(_0xf632ee[_0xd83e('0x3b')][_0xd83e('0x4b')]){_0x431f6f[_0xd83e('0x4c')]=[{'all':!![]}];}_0x431f6f=_['merge']({},_0x431f6f,_0xf632ee['options']);return db[_0xd83e('0x35')]['find'](_0x431f6f)[_0xd83e('0x1c')](handleEntityNotFound(_0x113646,null))['then'](respondWithResult(_0x113646,null))[_0xd83e('0x25')](handleError(_0x113646,null));};exports[_0xd83e('0x4f')]=function(_0x5180ac,_0xec9d2f){return db[_0xd83e('0x35')][_0xd83e('0x4f')](_0x5180ac[_0xd83e('0x50')],{})[_0xd83e('0x1c')](respondWithResult(_0xec9d2f,0xc9))[_0xd83e('0x25')](handleError(_0xec9d2f,null));};exports['update']=function(_0x35f734,_0x5eb109){if(_0x35f734[_0xd83e('0x50')]['id']){delete _0x35f734['body']['id'];}return db[_0xd83e('0x35')][_0xd83e('0x51')]({'where':{'id':_0x35f734[_0xd83e('0x4e')]['id']}})[_0xd83e('0x1c')](handleEntityNotFound(_0x5eb109,null))[_0xd83e('0x1c')](saveUpdates(_0x35f734[_0xd83e('0x50')],null))[_0xd83e('0x1c')](respondWithResult(_0x5eb109,null))[_0xd83e('0x25')](handleError(_0x5eb109,null));};exports[_0xd83e('0x31')]=function(_0x4fa89d,_0x24e6b6){return db[_0xd83e('0x35')][_0xd83e('0x51')]({'where':{'id':_0x4fa89d['params']['id']}})[_0xd83e('0x1c')](handleEntityNotFound(_0x24e6b6,null))[_0xd83e('0x1c')](removeEntity(_0x24e6b6,null))[_0xd83e('0x25')](handleError(_0x24e6b6,null));};exports['getConfigurations']=function(_0xa04414,_0x1876eb,_0x52836d){var _0x5222ae={};var _0x58d8ae={};var _0x4915ea;var _0x5b38d9;return db[_0xd83e('0x35')][_0xd83e('0x52')]({'where':{'id':_0xa04414[_0xd83e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1876eb,null))[_0xd83e('0x1c')](function(_0x1420d9){if(_0x1420d9){_0x4915ea=_0x1420d9;_0x58d8ae[_0xd83e('0x3a')]=_[_0xd83e('0x3c')](db['DeskConfiguration'][_0xd83e('0x36')]);_0x58d8ae[_0xd83e('0x3b')]=_[_0xd83e('0x3c')](_0xa04414[_0xd83e('0x3b')]);_0x58d8ae[_0xd83e('0x3d')]=_[_0xd83e('0x3e')](_0x58d8ae['model'],_0x58d8ae[_0xd83e('0x3b')]);_0x5222ae[_0xd83e('0x3f')]=_[_0xd83e('0x3e')](_0x58d8ae[_0xd83e('0x3a')],qs[_0xd83e('0x40')](_0xa04414[_0xd83e('0x3b')][_0xd83e('0x40')]));_0x5222ae[_0xd83e('0x3f')]=_0x5222ae['attributes'][_0xd83e('0x41')]?_0x5222ae['attributes']:_0x58d8ae[_0xd83e('0x3a')];_0x5222ae[_0xd83e('0x44')]=qs['sort'](_0xa04414['query'][_0xd83e('0x45')]);_0x5222ae[_0xd83e('0x46')]=qs['filters'](_[_0xd83e('0x47')](_0xa04414[_0xd83e('0x3b')],_0x58d8ae['filters']));if(_0xa04414['query']['filter']){_0x5222ae[_0xd83e('0x46')]=_['merge'](_0x5222ae['where'],{'$or':_[_0xd83e('0x53')](_0x5222ae[_0xd83e('0x3f')],function(_0x299122){var _0x53485d={};_0x53485d[_0x299122]={'$like':'%'+_0xa04414[_0xd83e('0x3b')][_0xd83e('0x48')]+'%'};return _0x53485d;})});}_0x5222ae=_['merge']({},_0x5222ae,_0xa04414[_0xd83e('0x54')]);return _0x4915ea[_0xd83e('0x55')](_0x5222ae);}})[_0xd83e('0x1c')](function(_0x52d31a){if(_0x52d31a){_0x5b38d9=_0x52d31a[_0xd83e('0x41')];if(!_0xa04414['query'][_0xd83e('0x42')](_0xd83e('0x43'))){_0x5222ae[_0xd83e('0x2a')]=qs[_0xd83e('0x2a')](_0xa04414[_0xd83e('0x3b')][_0xd83e('0x2a')]);_0x5222ae[_0xd83e('0x28')]=qs['offset'](_0xa04414['query'][_0xd83e('0x28')]);}return _0x4915ea[_0xd83e('0x55')](_0x5222ae);}})[_0xd83e('0x1c')](function(_0x3bd1ff){if(_0x3bd1ff){return _0x3bd1ff?{'count':_0x5b38d9,'rows':_0x3bd1ff}:null;}})[_0xd83e('0x1c')](respondWithResult(_0x1876eb,null))[_0xd83e('0x25')](handleError(_0x1876eb,null));};exports[_0xd83e('0x56')]=function(_0x5db5fd,_0x56b46f,_0x32907b){if(_0x5db5fd[_0xd83e('0x50')]['id']){delete _0x5db5fd[_0xd83e('0x50')]['id'];}return db[_0xd83e('0x35')][_0xd83e('0x52')]({'where':{'id':_0x5db5fd[_0xd83e('0x4e')]['id']}})[_0xd83e('0x1c')](handleEntityNotFound(_0x56b46f,null))['then'](function(_0x39eec8){if(_0x39eec8){_0x5db5fd[_0xd83e('0x50')][_0xd83e('0x57')]=_0x39eec8['id'];_0x5db5fd[_0xd83e('0x50')][_0xd83e('0x58')]=integrations[_0xd83e('0x59')](_0x5db5fd['body'][_0xd83e('0x5a')],_0x5db5fd['body'][_0xd83e('0x38')]);_0x5db5fd[_0xd83e('0x50')][_0xd83e('0x5b')]=integrations[_0xd83e('0x5c')](_0x5db5fd[_0xd83e('0x50')][_0xd83e('0x5a')],_0x5db5fd[_0xd83e('0x50')][_0xd83e('0x38')]);return db[_0xd83e('0x5d')][_0xd83e('0x4f')](_0x5db5fd[_0xd83e('0x50')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':_0xd83e('0x5b')}]});}return null;})['then'](respondWithResult(_0x56b46f,null))[_0xd83e('0x25')](handleError(_0x56b46f,null));};exports['getFields']=function(_0x5f33e3,_0x4d1a25,_0x26e2b4){var _0x45982e=[{'name':_0xd83e('0x5e'),'label':_0xd83e('0x5e'),'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 _0x36044a='';return db['DeskAccount'][_0xd83e('0x52')]({'where':{'id':_0x5f33e3['params']['id']},'attributes':['id',_0xd83e('0x5f'),'authType',_0xd83e('0x60'),_0xd83e('0x61'),_0xd83e('0x62'),_0xd83e('0x63'),_0xd83e('0x64'),_0xd83e('0x65')]})['then'](handleEntityNotFound(_0x4d1a25,null))[_0xd83e('0x1c')](function(_0x34eca9){if(_0x34eca9){_0x36044a=_0x34eca9[_0xd83e('0x5f')];var _0x3bc6e3=_0x36044a['slice'](-0x1);if(_0x3bc6e3==='/'){_0x36044a=_0x36044a[_0xd83e('0x66')](0x0,_0x36044a[_0xd83e('0x67')](_0x3bc6e3));}var _0x195c44={'method':_0xd83e('0x68'),'uri':util[_0xd83e('0x69')]('%s/custom_fields',_0x36044a),'headers':{'Content-Type':_0xd83e('0x6a'),'Accept':_0xd83e('0x6a')},'json':!![]};if(_0x34eca9[_0xd83e('0x6b')]===_0xd83e('0x6c')){_0x195c44[_0xd83e('0x6d')][_0xd83e('0x6e')]=util[_0xd83e('0x69')](_0xd83e('0x6f'),new Buffer(util['format'](_0xd83e('0x70'),_0x34eca9['username'],_0x34eca9[_0xd83e('0x61')]))[_0xd83e('0x71')](_0xd83e('0x72')));}return rp(_0x195c44)[_0xd83e('0x1c')](function(_0x60155c){return _0x45982e['concat'](_['map'](_0x60155c['_embedded'][_0xd83e('0x73')],function(_0x4a9aef){return{'id':_0x4a9aef[_0xd83e('0x34')],'name':_0x4a9aef['name'],'type':_0x4a9aef[_0xd83e('0x38')],'active':_0x4a9aef[_0xd83e('0x74')],'label':_0x4a9aef[_0xd83e('0x75')],'custom':!![]};}));});}})[_0xd83e('0x1c')](function(_0x3aea9b){return{'count':_0x3aea9b[_0xd83e('0x41')],'rows':_0x3aea9b};})[_0xd83e('0x1c')](respondWithResult(_0x4d1a25,null))[_0xd83e('0x25')](function(_0x3d48bb){var _0x45371b=_0x5f33e3['query'][_0xd83e('0x76')]?0x1f4:_0x3d48bb[_0xd83e('0x77')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xd83e('0x78'),_0x45371b,JSON[_0xd83e('0x1f')](_0x3d48bb));delete _0x3d48bb[_0xd83e('0x34')];if(_0x45371b===0x191){_0x45371b=0x190;}_0x4d1a25['status'](_0x45371b)[_0xd83e('0x79')](_0x5f33e3[_0xd83e('0x3b')][_0xd83e('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x3d48bb[_0xd83e('0x77')]}:_0x3d48bb);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 1962f6b..18e5118 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 _0x6780=['bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','../../config/logger','api'];(function(_0x44b0de,_0x213afa){var _0x21da2a=function(_0x264f30){while(--_0x264f30){_0x44b0de['push'](_0x44b0de['shift']());}};_0x21da2a(++_0x213afa);}(_0x6780,0x18a));var _0x0678=function(_0x2f605c,_0x462d5f){_0x2f605c=_0x2f605c-0x0;var _0x318b3b=_0x6780[_0x2f605c];return _0x318b3b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0678('0x0'))(_0x0678('0x1'));var moment=require('moment');var BPromise=require(_0x0678('0x2'));var rp=require(_0x0678('0x3'));var fs=require('fs');var path=require(_0x0678('0x4'));var rimraf=require(_0x0678('0x5'));var config=require('../../config/environment');var attributes=require(_0x0678('0x6'));var integrations=require(_0x0678('0x7'));module[_0x0678('0x8')]=function(_0x25285b,_0x3b6e48){return _0x25285b['define'](_0x0678('0x9'),attributes,{'tableName':_0x0678('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2230=['moment','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api'];(function(_0x1c7195,_0x272b55){var _0x144896=function(_0x4a4d47){while(--_0x4a4d47){_0x1c7195['push'](_0x1c7195['shift']());}};_0x144896(++_0x272b55);}(_0x2230,0xc0));var _0x0223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2230[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0223('0x0'));var util=require(_0x0223('0x1'));var logger=require(_0x0223('0x2'))(_0x0223('0x3'));var moment=require(_0x0223('0x4'));var BPromise=require(_0x0223('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0223('0x6'));var rimraf=require(_0x0223('0x7'));var config=require(_0x0223('0x8'));var attributes=require(_0x0223('0x9'));var integrations=require(_0x0223('0xa'));module['exports']=function(_0x27c594,_0x44c6e2){return _0x27c594[_0x0223('0xb')](_0x0223('0xc'),attributes,{'tableName':_0x0223('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 53e3ab1..d0a1995 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 _0x047d=['debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','attributes','limit','map','include','model','then','find','where','ShowDeskAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x22583c,_0x4106d4){var _0x5ac3de=function(_0x189d3a){while(--_0x189d3a){_0x22583c['push'](_0x22583c['shift']());}};_0x5ac3de(++_0x4106d4);}(_0x047d,0x162));var _0xd047=function(_0x10bac5,_0x13c467){_0x10bac5=_0x10bac5-0x0;var _0x377a8b=_0x047d[_0x10bac5];return _0x377a8b;};'use strict';var _=require(_0xd047('0x0'));var util=require(_0xd047('0x1'));var moment=require(_0xd047('0x2'));var BPromise=require('bluebird');var rs=require(_0xd047('0x3'));var fs=require('fs');var Redis=require(_0xd047('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd047('0x5'));var logger=require(_0xd047('0x6'))(_0xd047('0x7'));var config=require(_0xd047('0x8'));var jayson=require(_0xd047('0x9'));var client=jayson[_0xd047('0xa')][_0xd047('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a4711,_0x2663b1,_0x22e014){return new BPromise(function(_0x3acc51,_0x3c7792){return client[_0xd047('0xc')](_0x3a4711,_0x22e014)['then'](function(_0x38005c){logger[_0xd047('0xd')](_0xd047('0xe'),_0x2663b1,_0xd047('0xf'));logger[_0xd047('0x10')](_0xd047('0x11'),_0x2663b1,_0xd047('0xf'),JSON[_0xd047('0x12')](_0x38005c));if(_0x38005c[_0xd047('0x13')]){if(_0x38005c['error'][_0xd047('0x14')]===0x1f4){logger[_0xd047('0x13')]('DeskAccount,\x20%s,\x20%s',_0x2663b1,_0x38005c[_0xd047('0x13')][_0xd047('0x15')]);return _0x3c7792(_0x38005c['error'][_0xd047('0x15')]);}logger[_0xd047('0x13')](_0xd047('0xe'),_0x2663b1,_0x38005c['error'][_0xd047('0x15')]);return _0x3acc51(_0x38005c[_0xd047('0x13')][_0xd047('0x15')]);}else{logger['info'](_0xd047('0xe'),_0x2663b1,_0xd047('0xf'));_0x3acc51(_0x38005c[_0xd047('0x16')][_0xd047('0x15')]);}})[_0xd047('0x17')](function(_0x296cbb){logger['error'](_0xd047('0xe'),_0x2663b1,_0x296cbb);_0x3c7792(_0x296cbb);});});}exports[_0xd047('0x18')]=function(_0x5ab02f){var _0x491b8a=this;return new Promise(function(_0x141bb4,_0x5daa6a){return db[_0xd047('0x19')]['findAll']({'raw':_0x5ab02f[_0xd047('0x1a')]?_0x5ab02f['options'][_0xd047('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ab02f[_0xd047('0x1a')]?_0x5ab02f[_0xd047('0x1a')]['where']||null:null,'attributes':_0x5ab02f[_0xd047('0x1a')]?_0x5ab02f[_0xd047('0x1a')][_0xd047('0x1c')]||null:null,'limit':_0x5ab02f[_0xd047('0x1a')]?_0x5ab02f[_0xd047('0x1a')][_0xd047('0x1d')]||null:null,'include':_0x5ab02f[_0xd047('0x1a')]?_0x5ab02f['options']['include']?_[_0xd047('0x1e')](_0x5ab02f['options'][_0xd047('0x1f')],function(_0x1266a4){return{'model':db[_0x1266a4[_0xd047('0x20')]],'as':_0x1266a4['as'],'attributes':_0x1266a4[_0xd047('0x1c')],'include':_0x1266a4['include']?_[_0xd047('0x1e')](_0x1266a4[_0xd047('0x1f')],function(_0x35d3c5){return{'model':db[_0x35d3c5[_0xd047('0x20')]],'as':_0x35d3c5['as'],'attributes':_0x35d3c5[_0xd047('0x1c')],'include':_0x35d3c5[_0xd047('0x1f')]?_[_0xd047('0x1e')](_0x35d3c5[_0xd047('0x1f')],function(_0x3858f7){return{'model':db[_0x3858f7['model']],'as':_0x3858f7['as'],'attributes':_0x3858f7[_0xd047('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd047('0x21')](function(_0x1dd05b){logger[_0xd047('0xd')]('GetDeskAccount',_0x5ab02f);logger[_0xd047('0x10')](_0xd047('0x18'),_0x5ab02f,JSON[_0xd047('0x12')](_0x1dd05b));_0x141bb4(_0x1dd05b);})[_0xd047('0x17')](function(_0x443aad){logger[_0xd047('0x13')]('GetDeskAccount',_0x443aad[_0xd047('0x15')],_0x5ab02f);_0x5daa6a(_0x491b8a[_0xd047('0x13')](0x1f4,_0x443aad[_0xd047('0x15')]));});});};exports['ShowDeskAccount']=function(_0x13c7e4){var _0x59d02a=this;return new Promise(function(_0x5bbff9,_0x135498){return db[_0xd047('0x19')][_0xd047('0x22')]({'raw':_0x13c7e4['options']?_0x13c7e4[_0xd047('0x1a')][_0xd047('0x1b')]===undefined?!![]:![]:!![],'where':_0x13c7e4[_0xd047('0x1a')]?_0x13c7e4[_0xd047('0x1a')][_0xd047('0x23')]||null:null,'attributes':_0x13c7e4[_0xd047('0x1a')]?_0x13c7e4[_0xd047('0x1a')]['attributes']||null:null,'include':_0x13c7e4['options']?_0x13c7e4[_0xd047('0x1a')]['include']?_['map'](_0x13c7e4[_0xd047('0x1a')][_0xd047('0x1f')],function(_0x4c147b){return{'model':db[_0x4c147b[_0xd047('0x20')]],'as':_0x4c147b['as'],'attributes':_0x4c147b[_0xd047('0x1c')],'include':_0x4c147b[_0xd047('0x1f')]?_['map'](_0x4c147b[_0xd047('0x1f')],function(_0x38cc7f){return{'model':db[_0x38cc7f['model']],'as':_0x38cc7f['as'],'attributes':_0x38cc7f[_0xd047('0x1c')],'include':_0x38cc7f[_0xd047('0x1f')]?_[_0xd047('0x1e')](_0x38cc7f[_0xd047('0x1f')],function(_0x3432c7){return{'model':db[_0x3432c7[_0xd047('0x20')]],'as':_0x3432c7['as'],'attributes':_0x3432c7['attributes']};}):[]};}):[]};}):[]:[]})[_0xd047('0x21')](function(_0x5c5d4d){logger[_0xd047('0xd')](_0xd047('0x24'),_0x13c7e4);logger[_0xd047('0x10')]('ShowDeskAccount',_0x13c7e4,JSON[_0xd047('0x12')](_0x5c5d4d));_0x5bbff9(_0x5c5d4d);})[_0xd047('0x17')](function(_0x527441){logger[_0xd047('0x13')](_0xd047('0x24'),_0x527441[_0xd047('0x15')],_0x13c7e4);_0x135498(_0x59d02a[_0xd047('0x13')](0x1f4,_0x527441[_0xd047('0x15')]));});});}; \ No newline at end of file +var _0xdf99=['model','ShowDeskAccount','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','map'];(function(_0x5b2ced,_0x29cd3a){var _0x1ec63b=function(_0x5e0906){while(--_0x5e0906){_0x5b2ced['push'](_0x5b2ced['shift']());}};_0x1ec63b(++_0x29cd3a);}(_0xdf99,0x161));var _0x9df9=function(_0x566168,_0x4c39af){_0x566168=_0x566168-0x0;var _0x4e1f7a=_0xdf99[_0x566168];return _0x4e1f7a;};'use strict';var _=require(_0x9df9('0x0'));var util=require(_0x9df9('0x1'));var moment=require('moment');var BPromise=require(_0x9df9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9df9('0x3'));var db=require(_0x9df9('0x4'))['db'];var utils=require(_0x9df9('0x5'));var logger=require(_0x9df9('0x6'))(_0x9df9('0x7'));var config=require(_0x9df9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9df9('0x9')][_0x9df9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x310df6,_0x4db68d,_0x100b70){return new BPromise(function(_0x208f0b,_0x2363aa){return client[_0x9df9('0xb')](_0x310df6,_0x100b70)[_0x9df9('0xc')](function(_0x29ef25){logger[_0x9df9('0xd')](_0x9df9('0xe'),_0x4db68d,_0x9df9('0xf'));logger[_0x9df9('0x10')](_0x9df9('0x11'),_0x4db68d,_0x9df9('0xf'),JSON[_0x9df9('0x12')](_0x29ef25));if(_0x29ef25[_0x9df9('0x13')]){if(_0x29ef25['error'][_0x9df9('0x14')]===0x1f4){logger[_0x9df9('0x13')](_0x9df9('0xe'),_0x4db68d,_0x29ef25[_0x9df9('0x13')][_0x9df9('0x15')]);return _0x2363aa(_0x29ef25[_0x9df9('0x13')][_0x9df9('0x15')]);}logger['error'](_0x9df9('0xe'),_0x4db68d,_0x29ef25['error'][_0x9df9('0x15')]);return _0x208f0b(_0x29ef25['error'][_0x9df9('0x15')]);}else{logger[_0x9df9('0xd')](_0x9df9('0xe'),_0x4db68d,'request\x20sent');_0x208f0b(_0x29ef25['result'][_0x9df9('0x15')]);}})[_0x9df9('0x16')](function(_0x522caa){logger[_0x9df9('0x13')](_0x9df9('0xe'),_0x4db68d,_0x522caa);_0x2363aa(_0x522caa);});});}exports[_0x9df9('0x17')]=function(_0x575e4b){var _0x3a53d5=this;return new Promise(function(_0x570f13,_0x1a9006){return db[_0x9df9('0x18')][_0x9df9('0x19')]({'raw':_0x575e4b['options']?_0x575e4b[_0x9df9('0x1a')][_0x9df9('0x1b')]===undefined?!![]:![]:!![],'where':_0x575e4b[_0x9df9('0x1a')]?_0x575e4b[_0x9df9('0x1a')]['where']||null:null,'attributes':_0x575e4b[_0x9df9('0x1a')]?_0x575e4b['options'][_0x9df9('0x1c')]||null:null,'limit':_0x575e4b[_0x9df9('0x1a')]?_0x575e4b[_0x9df9('0x1a')][_0x9df9('0x1d')]||null:null,'include':_0x575e4b[_0x9df9('0x1a')]?_0x575e4b[_0x9df9('0x1a')][_0x9df9('0x1e')]?_[_0x9df9('0x1f')](_0x575e4b[_0x9df9('0x1a')]['include'],function(_0x49391d){return{'model':db[_0x49391d[_0x9df9('0x20')]],'as':_0x49391d['as'],'attributes':_0x49391d[_0x9df9('0x1c')],'include':_0x49391d['include']?_[_0x9df9('0x1f')](_0x49391d[_0x9df9('0x1e')],function(_0x582201){return{'model':db[_0x582201[_0x9df9('0x20')]],'as':_0x582201['as'],'attributes':_0x582201['attributes'],'include':_0x582201[_0x9df9('0x1e')]?_['map'](_0x582201[_0x9df9('0x1e')],function(_0x3f23bb){return{'model':db[_0x3f23bb[_0x9df9('0x20')]],'as':_0x3f23bb['as'],'attributes':_0x3f23bb[_0x9df9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9df9('0xc')](function(_0xe4f30c){logger['info'](_0x9df9('0x17'),_0x575e4b);logger['debug'](_0x9df9('0x17'),_0x575e4b,JSON[_0x9df9('0x12')](_0xe4f30c));_0x570f13(_0xe4f30c);})[_0x9df9('0x16')](function(_0x6dd5e0){logger['error'](_0x9df9('0x17'),_0x6dd5e0['message'],_0x575e4b);_0x1a9006(_0x3a53d5['error'](0x1f4,_0x6dd5e0[_0x9df9('0x15')]));});});};exports[_0x9df9('0x21')]=function(_0x461a84){var _0x376c97=this;return new Promise(function(_0x55093a,_0x1662b9){return db['DeskAccount']['find']({'raw':_0x461a84[_0x9df9('0x1a')]?_0x461a84['options'][_0x9df9('0x1b')]===undefined?!![]:![]:!![],'where':_0x461a84[_0x9df9('0x1a')]?_0x461a84[_0x9df9('0x1a')][_0x9df9('0x22')]||null:null,'attributes':_0x461a84[_0x9df9('0x1a')]?_0x461a84[_0x9df9('0x1a')][_0x9df9('0x1c')]||null:null,'include':_0x461a84[_0x9df9('0x1a')]?_0x461a84[_0x9df9('0x1a')][_0x9df9('0x1e')]?_[_0x9df9('0x1f')](_0x461a84[_0x9df9('0x1a')][_0x9df9('0x1e')],function(_0x4b27c8){return{'model':db[_0x4b27c8[_0x9df9('0x20')]],'as':_0x4b27c8['as'],'attributes':_0x4b27c8[_0x9df9('0x1c')],'include':_0x4b27c8[_0x9df9('0x1e')]?_[_0x9df9('0x1f')](_0x4b27c8[_0x9df9('0x1e')],function(_0x4ee6b7){return{'model':db[_0x4ee6b7[_0x9df9('0x20')]],'as':_0x4ee6b7['as'],'attributes':_0x4ee6b7[_0x9df9('0x1c')],'include':_0x4ee6b7[_0x9df9('0x1e')]?_['map'](_0x4ee6b7['include'],function(_0xe01164){return{'model':db[_0xe01164['model']],'as':_0xe01164['as'],'attributes':_0xe01164[_0x9df9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9df9('0xc')](function(_0x4bb74e){logger[_0x9df9('0xd')](_0x9df9('0x21'),_0x461a84);logger[_0x9df9('0x10')](_0x9df9('0x21'),_0x461a84,JSON[_0x9df9('0x12')](_0x4bb74e));_0x55093a(_0x4bb74e);})[_0x9df9('0x16')](function(_0xc4ab72){logger['error'](_0x9df9('0x21'),_0xc4ab72[_0x9df9('0x15')],_0x461a84);_0x1662b9(_0x376c97[_0x9df9('0x13')](0x1f4,_0xc4ab72['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 163132a..51be5c9 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 _0x7bef=['/:id/subjects','getDescriptions','getTags','post','create','/:id/tags','put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields'];(function(_0x686086,_0x2f84d0){var _0x2ce9b8=function(_0x2ba7d6){while(--_0x2ba7d6){_0x686086['push'](_0x686086['shift']());}};_0x2ce9b8(++_0x2f84d0);}(_0x7bef,0x69));var _0xf7be=function(_0x2b6b89,_0x172ec0){_0x2b6b89=_0x2b6b89-0x0;var _0x5aa6af=_0x7bef[_0x2b6b89];return _0x5aa6af;};'use strict';var multer=require(_0xf7be('0x0'));var util=require('util');var path=require(_0xf7be('0x1'));var timeout=require(_0xf7be('0x2'));var express=require(_0xf7be('0x3'));var router=express[_0xf7be('0x4')]();var fs_extra=require(_0xf7be('0x5'));var auth=require(_0xf7be('0x6'));var interaction=require(_0xf7be('0x7'));var config=require(_0xf7be('0x8'));var controller=require('./intDeskConfiguration.controller');router[_0xf7be('0x9')]('/',auth[_0xf7be('0xa')](),controller['index']);router['get'](_0xf7be('0xb'),auth[_0xf7be('0xa')](),controller[_0xf7be('0xc')]);router[_0xf7be('0x9')](_0xf7be('0xd'),auth['isAuthenticated'](),controller[_0xf7be('0xe')]);router[_0xf7be('0x9')](_0xf7be('0xf'),auth[_0xf7be('0xa')](),controller['getSubjects']);router[_0xf7be('0x9')]('/:id/descriptions',auth[_0xf7be('0xa')](),controller[_0xf7be('0x10')]);router[_0xf7be('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0xf7be('0x11')]);router[_0xf7be('0x12')]('/',auth['isAuthenticated'](),controller[_0xf7be('0x13')]);router[_0xf7be('0x12')](_0xf7be('0x14'),auth[_0xf7be('0xa')](),controller['setTags']);router[_0xf7be('0x15')](_0xf7be('0xb'),auth[_0xf7be('0xa')](),controller['update']);router['delete'](_0xf7be('0xb'),auth[_0xf7be('0xa')](),controller[_0xf7be('0x16')]);module[_0xf7be('0x17')]=router; \ No newline at end of file +var _0x0491=['./intDeskConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x13d2e8,_0x193847){var _0x230601=function(_0x4af3be){while(--_0x4af3be){_0x13d2e8['push'](_0x13d2e8['shift']());}};_0x230601(++_0x193847);}(_0x0491,0x9b));var _0x1049=function(_0x594d09,_0x302fb9){_0x594d09=_0x594d09-0x0;var _0xd07832=_0x0491[_0x594d09];return _0xd07832;};'use strict';var multer=require(_0x1049('0x0'));var util=require('util');var path=require(_0x1049('0x1'));var timeout=require(_0x1049('0x2'));var express=require('express');var router=express[_0x1049('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1049('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1049('0x5'));var controller=require(_0x1049('0x6'));router[_0x1049('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1049('0x7')](_0x1049('0x8'),auth[_0x1049('0x9')](),controller[_0x1049('0xa')]);router[_0x1049('0x7')](_0x1049('0xb'),auth[_0x1049('0x9')](),controller['getFields']);router[_0x1049('0x7')](_0x1049('0xc'),auth[_0x1049('0x9')](),controller[_0x1049('0xd')]);router[_0x1049('0x7')](_0x1049('0xe'),auth['isAuthenticated'](),controller[_0x1049('0xf')]);router[_0x1049('0x7')](_0x1049('0x10'),auth[_0x1049('0x9')](),controller[_0x1049('0x11')]);router[_0x1049('0x12')]('/',auth[_0x1049('0x9')](),controller[_0x1049('0x13')]);router[_0x1049('0x12')](_0x1049('0x10'),auth[_0x1049('0x9')](),controller['setTags']);router['put']('/:id',auth[_0x1049('0x9')](),controller[_0x1049('0x14')]);router[_0x1049('0x15')](_0x1049('0x8'),auth[_0x1049('0x9')](),controller[_0x1049('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 87be78d..5a53fd3 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 _0x2fcb=['sequelize','exports','STRING'];(function(_0x3238bd,_0x4ea3ef){var _0xdc7a7e=function(_0x275fbc){while(--_0x275fbc){_0x3238bd['push'](_0x3238bd['shift']());}};_0xdc7a7e(++_0x4ea3ef);}(_0x2fcb,0x72));var _0xb2fc=function(_0x18d99e,_0x1d17fb){_0x18d99e=_0x18d99e-0x0;var _0x4e5ff2=_0x2fcb[_0x18d99e];return _0x4e5ff2;};'use strict';var Sequelize=require(_0xb2fc('0x0'));module[_0xb2fc('0x1')]={'name':{'type':Sequelize[_0xb2fc('0x2')]},'description':{'type':Sequelize[_0xb2fc('0x2')]}}; \ No newline at end of file +var _0x6230=['STRING'];(function(_0x57cb3e,_0x3cf3a8){var _0xb30280=function(_0x5f206e){while(--_0x5f206e){_0x57cb3e['push'](_0x57cb3e['shift']());}};_0xb30280(++_0x3cf3a8);}(_0x6230,0x178));var _0x0623=function(_0x1c24bb,_0x20a80c){_0x1c24bb=_0x1c24bb-0x0;var _0x26851d=_0x6230[_0x1c24bb];return _0x26851d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0623('0x0')]},'description':{'type':Sequelize[_0x0623('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4dd52fa..a0d0e68 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 _0xb7e7=['request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','show','params','fields','length','find','create','body','getFields','findOne','pick','getSubjects','DeskField','getDescriptions','getTags','setTags','ids','eml-format','zip-dir'];(function(_0x110571,_0x5328d7){var _0x37b81c=function(_0x581ff4){while(--_0x581ff4){_0x110571['push'](_0x110571['shift']());}};_0x37b81c(++_0x5328d7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb7e7[_0x34bc30];return _0x5706de;};'use strict';var emlformat=require(_0x7b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7e('0x2'));var moment=require('moment');var BPromise=require(_0x7b7e('0x3'));var Mustache=require('mustache');var util=require(_0x7b7e('0x4'));var path=require(_0x7b7e('0x5'));var sox=require(_0x7b7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7e('0x7'));var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];var jayson=require(_0x7b7e('0x19'));var client=jayson['client'][_0x7b7e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x430eab,_0x50d7d2,_0x422d3a,_0x5976ac){return new BPromise(function(_0x4c6011,_0x2889ed){var _0xd304f5=_0x5976ac||client;return _0xd304f5[_0x7b7e('0x1b')](_0x430eab,_0x422d3a)[_0x7b7e('0x1c')](function(_0x3d2fb2){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x50d7d2,_0x7b7e('0x1d'));logger[_0x7b7e('0x1e')](_0x7b7e('0x1f'),_0x50d7d2,_0x7b7e('0x1d'),JSON[_0x7b7e('0x20')](_0x3d2fb2));if(_0x3d2fb2[_0x7b7e('0x21')]){if(_0x3d2fb2[_0x7b7e('0x21')][_0x7b7e('0x22')]===0x1f4){logger[_0x7b7e('0x21')](_0x7b7e('0x23'),_0x50d7d2,_0x3d2fb2[_0x7b7e('0x21')][_0x7b7e('0x24')]);return _0x2889ed(_0x3d2fb2[_0x7b7e('0x21')][_0x7b7e('0x24')]);}logger[_0x7b7e('0x21')](_0x7b7e('0x23'),_0x50d7d2,_0x3d2fb2[_0x7b7e('0x21')]['message']);return _0x4c6011(_0x3d2fb2[_0x7b7e('0x21')][_0x7b7e('0x24')]);}else{logger[_0x7b7e('0x25')]('DeskConfiguration,\x20%s,\x20%s',_0x50d7d2,_0x7b7e('0x1d'));_0x4c6011(_0x3d2fb2[_0x7b7e('0x26')][_0x7b7e('0x24')]);}})[_0x7b7e('0x27')](function(_0x2b7211){logger[_0x7b7e('0x21')](_0x7b7e('0x23'),_0x50d7d2,_0x2b7211);_0x2889ed(_0x2b7211);});});}function respondWithStatusCode(_0x10a66a,_0x53bbb3){_0x53bbb3=_0x53bbb3||0xcc;return function(_0x5d6215){if(_0x5d6215){return _0x10a66a['sendStatus'](_0x53bbb3);}return _0x10a66a[_0x7b7e('0x28')](_0x53bbb3)[_0x7b7e('0x29')]();};}function respondWithResult(_0x23bfa3,_0x483c6f){_0x483c6f=_0x483c6f||0xc8;return function(_0x51d3b1){if(_0x51d3b1){return _0x23bfa3['status'](_0x483c6f)[_0x7b7e('0x2a')](_0x51d3b1);}};}function respondWithFilteredResult(_0x3c8192,_0x16a3c7){return function(_0x7aa71){if(_0x7aa71){var _0x3ceaf5=typeof _0x16a3c7['offset']===_0x7b7e('0x2b')&&typeof _0x16a3c7[_0x7b7e('0x2c')]==='undefined';var _0x57b9da=_0x7aa71['count'];var _0x12ef0b=_0x3ceaf5?0x0:_0x16a3c7[_0x7b7e('0x2d')];var _0x503625=_0x3ceaf5?_0x7aa71[_0x7b7e('0x2e')]:_0x16a3c7['offset']+_0x16a3c7[_0x7b7e('0x2c')];var _0xb9b6bf;if(_0x503625>=_0x57b9da){_0x503625=_0x57b9da;_0xb9b6bf=0xc8;}else{_0xb9b6bf=0xce;}_0x3c8192[_0x7b7e('0x28')](_0xb9b6bf);return _0x3c8192['set'](_0x7b7e('0x2f'),_0x12ef0b+'-'+_0x503625+'/'+_0x57b9da)[_0x7b7e('0x2a')](_0x7aa71);}return null;};}function patchUpdates(_0x35602a){return function(_0x326dd2){try{jsonpatch[_0x7b7e('0x30')](_0x326dd2,_0x35602a,!![]);}catch(_0x5732ee){return BPromise[_0x7b7e('0x31')](_0x5732ee);}return _0x326dd2['save']();};}function saveUpdates(_0x23a453,_0x1c7de4){return function(_0x383de5){if(_0x383de5){return _0x383de5[_0x7b7e('0x32')](_0x23a453)[_0x7b7e('0x1c')](function(_0x247ea0){return _0x247ea0;});}return null;};}function removeEntity(_0x29cb58,_0x4bfe7f){return function(_0x5227a7){if(_0x5227a7){return _0x5227a7[_0x7b7e('0x33')]()[_0x7b7e('0x1c')](function(){_0x29cb58['status'](0xcc)[_0x7b7e('0x29')]();});}};}function handleEntityNotFound(_0x2a4754,_0x2ca366){return function(_0x48e255){if(!_0x48e255){_0x2a4754[_0x7b7e('0x34')](0x194);}return _0x48e255;};}function handleError(_0x256908,_0x187184){_0x187184=_0x187184||0x1f4;return function(_0xf1225){logger[_0x7b7e('0x21')](_0xf1225[_0x7b7e('0x35')]);if(_0xf1225[_0x7b7e('0x36')]){delete _0xf1225[_0x7b7e('0x36')];}_0x256908[_0x7b7e('0x28')](_0x187184)[_0x7b7e('0x37')](_0xf1225);};}exports[_0x7b7e('0x38')]=function(_0x2d0620,_0x442366){var _0xdcb8ef={},_0x116563={},_0x279f46={'count':0x0,'rows':[]};var _0x5a4f92=_[_0x7b7e('0x39')](db[_0x7b7e('0x3a')][_0x7b7e('0x3b')],function(_0x242609){return{'name':_0x242609[_0x7b7e('0x3c')],'type':_0x242609[_0x7b7e('0x3d')][_0x7b7e('0x3e')]};});_0x116563[_0x7b7e('0x3f')]=_[_0x7b7e('0x39')](_0x5a4f92,_0x7b7e('0x36'));_0x116563['query']=_[_0x7b7e('0x40')](_0x2d0620[_0x7b7e('0x41')]);_0x116563[_0x7b7e('0x42')]=_[_0x7b7e('0x43')](_0x116563['model'],_0x116563[_0x7b7e('0x41')]);_0xdcb8ef[_0x7b7e('0x44')]=_[_0x7b7e('0x43')](_0x116563['model'],qs['fields'](_0x2d0620[_0x7b7e('0x41')]['fields']));_0xdcb8ef[_0x7b7e('0x44')]=_0xdcb8ef[_0x7b7e('0x44')]['length']?_0xdcb8ef[_0x7b7e('0x44')]:_0x116563[_0x7b7e('0x3f')];if(!_0x2d0620[_0x7b7e('0x41')][_0x7b7e('0x45')](_0x7b7e('0x46'))){_0xdcb8ef[_0x7b7e('0x2c')]=qs[_0x7b7e('0x2c')](_0x2d0620[_0x7b7e('0x41')][_0x7b7e('0x2c')]);_0xdcb8ef['offset']=qs['offset'](_0x2d0620[_0x7b7e('0x41')]['offset']);}_0xdcb8ef[_0x7b7e('0x47')]=qs['sort'](_0x2d0620['query'][_0x7b7e('0x48')]);_0xdcb8ef['where']=qs[_0x7b7e('0x42')](_['pick'](_0x2d0620[_0x7b7e('0x41')],_0x116563[_0x7b7e('0x42')]),_0x5a4f92);if(_0x2d0620[_0x7b7e('0x41')][_0x7b7e('0x49')]){_0xdcb8ef['where']=_[_0x7b7e('0x4a')](_0xdcb8ef[_0x7b7e('0x4b')],{'$or':_[_0x7b7e('0x39')](_0x5a4f92,function(_0x37895a){if(_0x37895a[_0x7b7e('0x3d')]!==_0x7b7e('0x4c')){var _0x5e8572={};_0x5e8572[_0x37895a['name']]={'$like':'%'+_0x2d0620['query'][_0x7b7e('0x49')]+'%'};return _0x5e8572;}})});}_0xdcb8ef=_[_0x7b7e('0x4a')]({},_0xdcb8ef,_0x2d0620[_0x7b7e('0x4d')]);var _0x2cfe70={'where':_0xdcb8ef[_0x7b7e('0x4b')]};return db[_0x7b7e('0x3a')]['count'](_0x2cfe70)[_0x7b7e('0x1c')](function(_0x42e560){_0x279f46['count']=_0x42e560;if(_0x2d0620['query'][_0x7b7e('0x4e')]){_0xdcb8ef[_0x7b7e('0x4f')]=[{'all':!![]}];}return db[_0x7b7e('0x3a')][_0x7b7e('0x50')](_0xdcb8ef);})[_0x7b7e('0x1c')](function(_0xb46776){_0x279f46['rows']=_0xb46776;return _0x279f46;})[_0x7b7e('0x1c')](respondWithFilteredResult(_0x442366,_0xdcb8ef))['catch'](handleError(_0x442366,null));};exports[_0x7b7e('0x51')]=function(_0x1dad4c,_0x2ea2b2){var _0x5874e2={'raw':![],'where':{'id':_0x1dad4c[_0x7b7e('0x52')]['id']}},_0x58e4e6={};_0x58e4e6[_0x7b7e('0x3f')]=_[_0x7b7e('0x40')](db[_0x7b7e('0x3a')][_0x7b7e('0x3b')]);_0x58e4e6['query']=_[_0x7b7e('0x40')](_0x1dad4c[_0x7b7e('0x41')]);_0x58e4e6[_0x7b7e('0x42')]=_[_0x7b7e('0x43')](_0x58e4e6[_0x7b7e('0x3f')],_0x58e4e6['query']);_0x5874e2[_0x7b7e('0x44')]=_[_0x7b7e('0x43')](_0x58e4e6[_0x7b7e('0x3f')],qs[_0x7b7e('0x53')](_0x1dad4c[_0x7b7e('0x41')][_0x7b7e('0x53')]));_0x5874e2[_0x7b7e('0x44')]=_0x5874e2['attributes'][_0x7b7e('0x54')]?_0x5874e2['attributes']:_0x58e4e6[_0x7b7e('0x3f')];if(_0x1dad4c[_0x7b7e('0x41')]['includeAll']){_0x5874e2[_0x7b7e('0x4f')]=[{'all':!![]}];}_0x5874e2=_[_0x7b7e('0x4a')]({},_0x5874e2,_0x1dad4c[_0x7b7e('0x4d')]);return db[_0x7b7e('0x3a')][_0x7b7e('0x55')](_0x5874e2)[_0x7b7e('0x1c')](handleEntityNotFound(_0x2ea2b2,null))[_0x7b7e('0x1c')](respondWithResult(_0x2ea2b2,null))['catch'](handleError(_0x2ea2b2,null));};exports[_0x7b7e('0x56')]=function(_0x3ff731,_0x96752e){return db[_0x7b7e('0x3a')]['create'](_0x3ff731['body'],{})['then'](respondWithResult(_0x96752e,0xc9))[_0x7b7e('0x27')](handleError(_0x96752e,null));};exports[_0x7b7e('0x32')]=function(_0x26d52f,_0x4aa92e){if(_0x26d52f['body']['id']){delete _0x26d52f[_0x7b7e('0x57')]['id'];}return db[_0x7b7e('0x3a')]['find']({'where':{'id':_0x26d52f[_0x7b7e('0x52')]['id']}})[_0x7b7e('0x1c')](handleEntityNotFound(_0x4aa92e,null))[_0x7b7e('0x1c')](saveUpdates(_0x26d52f['body'],null))[_0x7b7e('0x1c')](respondWithResult(_0x4aa92e,null))[_0x7b7e('0x27')](handleError(_0x4aa92e,null));};exports['destroy']=function(_0x25c933,_0x441c3c){return db[_0x7b7e('0x3a')][_0x7b7e('0x55')]({'where':{'id':_0x25c933[_0x7b7e('0x52')]['id']}})[_0x7b7e('0x1c')](handleEntityNotFound(_0x441c3c,null))[_0x7b7e('0x1c')](removeEntity(_0x441c3c,null))[_0x7b7e('0x27')](handleError(_0x441c3c,null));};exports[_0x7b7e('0x58')]=function(_0x5509ad,_0x29d0af,_0x20108a){var _0x516e75={};var _0xc2b1b6={};var _0xa22edc;var _0x3da726;return db['DeskConfiguration'][_0x7b7e('0x59')]({'where':{'id':_0x5509ad['params']['id']}})[_0x7b7e('0x1c')](handleEntityNotFound(_0x29d0af,null))[_0x7b7e('0x1c')](function(_0x51aa97){if(_0x51aa97){_0xa22edc=_0x51aa97;_0xc2b1b6[_0x7b7e('0x3f')]=_[_0x7b7e('0x40')](db['DeskField'][_0x7b7e('0x3b')]);_0xc2b1b6[_0x7b7e('0x41')]=_[_0x7b7e('0x40')](_0x5509ad[_0x7b7e('0x41')]);_0xc2b1b6['filters']=_[_0x7b7e('0x43')](_0xc2b1b6[_0x7b7e('0x3f')],_0xc2b1b6[_0x7b7e('0x41')]);_0x516e75[_0x7b7e('0x44')]=_[_0x7b7e('0x43')](_0xc2b1b6[_0x7b7e('0x3f')],qs[_0x7b7e('0x53')](_0x5509ad[_0x7b7e('0x41')][_0x7b7e('0x53')]));_0x516e75[_0x7b7e('0x44')]=_0x516e75['attributes'][_0x7b7e('0x54')]?_0x516e75['attributes']:_0xc2b1b6['model'];_0x516e75[_0x7b7e('0x47')]=qs[_0x7b7e('0x48')](_0x5509ad[_0x7b7e('0x41')][_0x7b7e('0x48')]);_0x516e75['where']=qs[_0x7b7e('0x42')](_[_0x7b7e('0x5a')](_0x5509ad[_0x7b7e('0x41')],_0xc2b1b6[_0x7b7e('0x42')]));if(_0x5509ad[_0x7b7e('0x41')][_0x7b7e('0x49')]){_0x516e75['where']=_[_0x7b7e('0x4a')](_0x516e75['where'],{'$or':_['map'](_0x516e75[_0x7b7e('0x44')],function(_0x4ef741){var _0x47aa4c={};_0x47aa4c[_0x4ef741]={'$like':'%'+_0x5509ad['query'][_0x7b7e('0x49')]+'%'};return _0x47aa4c;})});}_0x516e75=_[_0x7b7e('0x4a')]({},_0x516e75,_0x5509ad['options']);return _0xa22edc[_0x7b7e('0x58')](_0x516e75);}})[_0x7b7e('0x1c')](function(_0x57e88f){if(_0x57e88f){_0x3da726=_0x57e88f[_0x7b7e('0x54')];if(!_0x5509ad[_0x7b7e('0x41')][_0x7b7e('0x45')](_0x7b7e('0x46'))){_0x516e75[_0x7b7e('0x2c')]=qs[_0x7b7e('0x2c')](_0x5509ad[_0x7b7e('0x41')][_0x7b7e('0x2c')]);_0x516e75[_0x7b7e('0x2d')]=qs[_0x7b7e('0x2d')](_0x5509ad['query']['offset']);}return _0xa22edc[_0x7b7e('0x58')](_0x516e75);}})[_0x7b7e('0x1c')](function(_0x2c6e3a){if(_0x2c6e3a){return _0x2c6e3a?{'count':_0x3da726,'rows':_0x2c6e3a}:null;}})[_0x7b7e('0x1c')](respondWithResult(_0x29d0af,null))[_0x7b7e('0x27')](handleError(_0x29d0af,null));};exports[_0x7b7e('0x5b')]=function(_0x385f0c,_0x5d2526,_0x28e6ac){var _0x2aca93={};var _0x4ff2c8={};var _0x3ce80e;var _0x3f8162;return db[_0x7b7e('0x3a')][_0x7b7e('0x59')]({'where':{'id':_0x385f0c[_0x7b7e('0x52')]['id']}})[_0x7b7e('0x1c')](handleEntityNotFound(_0x5d2526,null))[_0x7b7e('0x1c')](function(_0x1673cc){if(_0x1673cc){_0x3ce80e=_0x1673cc;_0x4ff2c8[_0x7b7e('0x3f')]=_[_0x7b7e('0x40')](db[_0x7b7e('0x5c')]['rawAttributes']);_0x4ff2c8[_0x7b7e('0x41')]=_[_0x7b7e('0x40')](_0x385f0c[_0x7b7e('0x41')]);_0x4ff2c8[_0x7b7e('0x42')]=_[_0x7b7e('0x43')](_0x4ff2c8[_0x7b7e('0x3f')],_0x4ff2c8[_0x7b7e('0x41')]);_0x2aca93['attributes']=_[_0x7b7e('0x43')](_0x4ff2c8[_0x7b7e('0x3f')],qs[_0x7b7e('0x53')](_0x385f0c['query'][_0x7b7e('0x53')]));_0x2aca93[_0x7b7e('0x44')]=_0x2aca93[_0x7b7e('0x44')][_0x7b7e('0x54')]?_0x2aca93[_0x7b7e('0x44')]:_0x4ff2c8['model'];_0x2aca93['order']=qs['sort'](_0x385f0c[_0x7b7e('0x41')][_0x7b7e('0x48')]);_0x2aca93[_0x7b7e('0x4b')]=qs['filters'](_[_0x7b7e('0x5a')](_0x385f0c[_0x7b7e('0x41')],_0x4ff2c8[_0x7b7e('0x42')]));if(_0x385f0c['query'][_0x7b7e('0x49')]){_0x2aca93[_0x7b7e('0x4b')]=_[_0x7b7e('0x4a')](_0x2aca93[_0x7b7e('0x4b')],{'$or':_['map'](_0x2aca93[_0x7b7e('0x44')],function(_0x40b4ae){var _0xa52b93={};_0xa52b93[_0x40b4ae]={'$like':'%'+_0x385f0c[_0x7b7e('0x41')]['filter']+'%'};return _0xa52b93;})});}_0x2aca93=_['merge']({},_0x2aca93,_0x385f0c[_0x7b7e('0x4d')]);return _0x3ce80e['getSubjects'](_0x2aca93);}})[_0x7b7e('0x1c')](function(_0x4215b5){if(_0x4215b5){_0x3f8162=_0x4215b5[_0x7b7e('0x54')];if(!_0x385f0c[_0x7b7e('0x41')]['hasOwnProperty'](_0x7b7e('0x46'))){_0x2aca93[_0x7b7e('0x2c')]=qs[_0x7b7e('0x2c')](_0x385f0c[_0x7b7e('0x41')][_0x7b7e('0x2c')]);_0x2aca93[_0x7b7e('0x2d')]=qs[_0x7b7e('0x2d')](_0x385f0c[_0x7b7e('0x41')][_0x7b7e('0x2d')]);}return _0x3ce80e[_0x7b7e('0x5b')](_0x2aca93);}})[_0x7b7e('0x1c')](function(_0x31a353){if(_0x31a353){return _0x31a353?{'count':_0x3f8162,'rows':_0x31a353}:null;}})[_0x7b7e('0x1c')](respondWithResult(_0x5d2526,null))[_0x7b7e('0x27')](handleError(_0x5d2526,null));};exports[_0x7b7e('0x5d')]=function(_0x28e2e9,_0x57d925,_0x3f4d00){var _0x31b9c5={};var _0x1d9e08={};var _0xa03d7a;var _0x10c35e;return db[_0x7b7e('0x3a')][_0x7b7e('0x59')]({'where':{'id':_0x28e2e9['params']['id']}})[_0x7b7e('0x1c')](handleEntityNotFound(_0x57d925,null))[_0x7b7e('0x1c')](function(_0x3d86d6){if(_0x3d86d6){_0xa03d7a=_0x3d86d6;_0x1d9e08[_0x7b7e('0x3f')]=_[_0x7b7e('0x40')](db['DeskField']['rawAttributes']);_0x1d9e08[_0x7b7e('0x41')]=_[_0x7b7e('0x40')](_0x28e2e9[_0x7b7e('0x41')]);_0x1d9e08[_0x7b7e('0x42')]=_[_0x7b7e('0x43')](_0x1d9e08[_0x7b7e('0x3f')],_0x1d9e08[_0x7b7e('0x41')]);_0x31b9c5[_0x7b7e('0x44')]=_[_0x7b7e('0x43')](_0x1d9e08[_0x7b7e('0x3f')],qs['fields'](_0x28e2e9[_0x7b7e('0x41')][_0x7b7e('0x53')]));_0x31b9c5[_0x7b7e('0x44')]=_0x31b9c5[_0x7b7e('0x44')][_0x7b7e('0x54')]?_0x31b9c5[_0x7b7e('0x44')]:_0x1d9e08[_0x7b7e('0x3f')];_0x31b9c5['order']=qs[_0x7b7e('0x48')](_0x28e2e9['query'][_0x7b7e('0x48')]);_0x31b9c5[_0x7b7e('0x4b')]=qs['filters'](_[_0x7b7e('0x5a')](_0x28e2e9[_0x7b7e('0x41')],_0x1d9e08[_0x7b7e('0x42')]));if(_0x28e2e9[_0x7b7e('0x41')][_0x7b7e('0x49')]){_0x31b9c5['where']=_[_0x7b7e('0x4a')](_0x31b9c5['where'],{'$or':_['map'](_0x31b9c5[_0x7b7e('0x44')],function(_0x2df7a5){var _0x1ca753={};_0x1ca753[_0x2df7a5]={'$like':'%'+_0x28e2e9[_0x7b7e('0x41')]['filter']+'%'};return _0x1ca753;})});}_0x31b9c5=_[_0x7b7e('0x4a')]({},_0x31b9c5,_0x28e2e9['options']);return _0xa03d7a[_0x7b7e('0x5d')](_0x31b9c5);}})[_0x7b7e('0x1c')](function(_0x451fe0){if(_0x451fe0){_0x10c35e=_0x451fe0[_0x7b7e('0x54')];if(!_0x28e2e9[_0x7b7e('0x41')][_0x7b7e('0x45')](_0x7b7e('0x46'))){_0x31b9c5['limit']=qs[_0x7b7e('0x2c')](_0x28e2e9[_0x7b7e('0x41')]['limit']);_0x31b9c5[_0x7b7e('0x2d')]=qs[_0x7b7e('0x2d')](_0x28e2e9[_0x7b7e('0x41')][_0x7b7e('0x2d')]);}return _0xa03d7a[_0x7b7e('0x5d')](_0x31b9c5);}})[_0x7b7e('0x1c')](function(_0xa304f1){if(_0xa304f1){return _0xa304f1?{'count':_0x10c35e,'rows':_0xa304f1}:null;}})[_0x7b7e('0x1c')](respondWithResult(_0x57d925,null))[_0x7b7e('0x27')](handleError(_0x57d925,null));};exports[_0x7b7e('0x5e')]=function(_0x4395c7,_0x197b92,_0x5c8c30){var _0x3b1ee6={};var _0x12d0cb={};var _0x1e2f9f;var _0x11a814;return db[_0x7b7e('0x3a')][_0x7b7e('0x59')]({'where':{'id':_0x4395c7[_0x7b7e('0x52')]['id']}})[_0x7b7e('0x1c')](handleEntityNotFound(_0x197b92,null))[_0x7b7e('0x1c')](function(_0x4a3ff7){if(_0x4a3ff7){_0x1e2f9f=_0x4a3ff7;_0x12d0cb[_0x7b7e('0x3f')]=_[_0x7b7e('0x40')](db['Tag'][_0x7b7e('0x3b')]);_0x12d0cb['query']=_['keys'](_0x4395c7[_0x7b7e('0x41')]);_0x12d0cb['filters']=_['intersection'](_0x12d0cb[_0x7b7e('0x3f')],_0x12d0cb[_0x7b7e('0x41')]);_0x3b1ee6[_0x7b7e('0x44')]=_['intersection'](_0x12d0cb[_0x7b7e('0x3f')],qs[_0x7b7e('0x53')](_0x4395c7[_0x7b7e('0x41')][_0x7b7e('0x53')]));_0x3b1ee6[_0x7b7e('0x44')]=_0x3b1ee6[_0x7b7e('0x44')][_0x7b7e('0x54')]?_0x3b1ee6[_0x7b7e('0x44')]:_0x12d0cb[_0x7b7e('0x3f')];_0x3b1ee6['order']=qs[_0x7b7e('0x48')](_0x4395c7[_0x7b7e('0x41')][_0x7b7e('0x48')]);_0x3b1ee6['where']=qs[_0x7b7e('0x42')](_[_0x7b7e('0x5a')](_0x4395c7['query'],_0x12d0cb[_0x7b7e('0x42')]));if(_0x4395c7['query']['filter']){_0x3b1ee6[_0x7b7e('0x4b')]=_[_0x7b7e('0x4a')](_0x3b1ee6['where'],{'$or':_[_0x7b7e('0x39')](_0x3b1ee6['attributes'],function(_0x4c7158){var _0x5c0d1c={};_0x5c0d1c[_0x4c7158]={'$like':'%'+_0x4395c7[_0x7b7e('0x41')][_0x7b7e('0x49')]+'%'};return _0x5c0d1c;})});}_0x3b1ee6=_[_0x7b7e('0x4a')]({},_0x3b1ee6,_0x4395c7[_0x7b7e('0x4d')]);return _0x1e2f9f[_0x7b7e('0x5e')](_0x3b1ee6);}})[_0x7b7e('0x1c')](function(_0x21bed7){if(_0x21bed7){_0x11a814=_0x21bed7['length'];if(!_0x4395c7[_0x7b7e('0x41')][_0x7b7e('0x45')](_0x7b7e('0x46'))){_0x3b1ee6[_0x7b7e('0x2c')]=qs[_0x7b7e('0x2c')](_0x4395c7[_0x7b7e('0x41')][_0x7b7e('0x2c')]);_0x3b1ee6[_0x7b7e('0x2d')]=qs[_0x7b7e('0x2d')](_0x4395c7[_0x7b7e('0x41')][_0x7b7e('0x2d')]);}return _0x1e2f9f[_0x7b7e('0x5e')](_0x3b1ee6);}})['then'](function(_0x493128){if(_0x493128){return _0x493128?{'count':_0x11a814,'rows':_0x493128}:null;}})[_0x7b7e('0x1c')](respondWithResult(_0x197b92,null))[_0x7b7e('0x27')](handleError(_0x197b92,null));};exports[_0x7b7e('0x5f')]=function(_0x40f2fb,_0xb5e531,_0x420199){if(_0x40f2fb[_0x7b7e('0x57')]['id']){delete _0x40f2fb[_0x7b7e('0x57')]['id'];}return db[_0x7b7e('0x3a')][_0x7b7e('0x59')]({'where':{'id':_0x40f2fb[_0x7b7e('0x52')]['id']}})[_0x7b7e('0x1c')](handleEntityNotFound(_0xb5e531,null))['then'](function(_0x38cd68){if(_0x38cd68){return _0x38cd68['setTags'](_0x40f2fb[_0x7b7e('0x57')][_0x7b7e('0x60')]||[]);}return null;})[_0x7b7e('0x1c')](respondWithResult(_0xb5e531,null))['catch'](handleError(_0xb5e531,null));}; \ No newline at end of file +var _0x3266=['findOne','DeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','request\x20sent','code','error','DeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','destroy','stack','send','index','map','DeskConfiguration','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','show','params','keys','includeAll','find','create','body','getFields'];(function(_0x42d3ff,_0xf96b42){var _0x28bb50=function(_0x3e97c6){while(--_0x3e97c6){_0x42d3ff['push'](_0x42d3ff['shift']());}};_0x28bb50(++_0xf96b42);}(_0x3266,0x6a));var _0x6326=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x3266[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];var jayson=require(_0x6326('0x1c'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x301f34,_0x136946,_0x591b81,_0x425878){return new BPromise(function(_0x4caef3,_0x2d2d9b){var _0x20dcc6=_0x425878||client;return _0x20dcc6[_0x6326('0x1d')](_0x301f34,_0x591b81)[_0x6326('0x1e')](function(_0x1ed3a3){logger[_0x6326('0x1f')]('DeskConfiguration,\x20%s,\x20%s',_0x136946,_0x6326('0x20'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x136946,'request\x20sent',JSON['stringify'](_0x1ed3a3));if(_0x1ed3a3['error']){if(_0x1ed3a3['error'][_0x6326('0x21')]===0x1f4){logger[_0x6326('0x22')](_0x6326('0x23'),_0x136946,_0x1ed3a3['error']['message']);return _0x2d2d9b(_0x1ed3a3[_0x6326('0x22')][_0x6326('0x24')]);}logger[_0x6326('0x22')](_0x6326('0x23'),_0x136946,_0x1ed3a3[_0x6326('0x22')][_0x6326('0x24')]);return _0x4caef3(_0x1ed3a3[_0x6326('0x22')]['message']);}else{logger[_0x6326('0x1f')]('DeskConfiguration,\x20%s,\x20%s',_0x136946,_0x6326('0x20'));_0x4caef3(_0x1ed3a3[_0x6326('0x25')][_0x6326('0x24')]);}})[_0x6326('0x26')](function(_0x43cdfc){logger[_0x6326('0x22')](_0x6326('0x23'),_0x136946,_0x43cdfc);_0x2d2d9b(_0x43cdfc);});});}function respondWithStatusCode(_0x429bb0,_0x4781cc){_0x4781cc=_0x4781cc||0xcc;return function(_0x2d0d00){if(_0x2d0d00){return _0x429bb0[_0x6326('0x27')](_0x4781cc);}return _0x429bb0['status'](_0x4781cc)[_0x6326('0x28')]();};}function respondWithResult(_0x325cfd,_0x575701){_0x575701=_0x575701||0xc8;return function(_0x4e272b){if(_0x4e272b){return _0x325cfd['status'](_0x575701)[_0x6326('0x29')](_0x4e272b);}};}function respondWithFilteredResult(_0x4dae28,_0x33c466){return function(_0x1a48da){if(_0x1a48da){var _0x5a907f=typeof _0x33c466[_0x6326('0x2a')]===_0x6326('0x2b')&&typeof _0x33c466[_0x6326('0x2c')]===_0x6326('0x2b');var _0x2d2180=_0x1a48da[_0x6326('0x2d')];var _0x40e036=_0x5a907f?0x0:_0x33c466[_0x6326('0x2a')];var _0x461e0f=_0x5a907f?_0x1a48da[_0x6326('0x2d')]:_0x33c466[_0x6326('0x2a')]+_0x33c466[_0x6326('0x2c')];var _0x331772;if(_0x461e0f>=_0x2d2180){_0x461e0f=_0x2d2180;_0x331772=0xc8;}else{_0x331772=0xce;}_0x4dae28[_0x6326('0x2e')](_0x331772);return _0x4dae28[_0x6326('0x2f')](_0x6326('0x30'),_0x40e036+'-'+_0x461e0f+'/'+_0x2d2180)['json'](_0x1a48da);}return null;};}function patchUpdates(_0x2bf5ef){return function(_0x47303c){try{jsonpatch[_0x6326('0x31')](_0x47303c,_0x2bf5ef,!![]);}catch(_0x52365c){return BPromise[_0x6326('0x32')](_0x52365c);}return _0x47303c['save']();};}function saveUpdates(_0x4e703a,_0xfb6b62){return function(_0x7ac8d9){if(_0x7ac8d9){return _0x7ac8d9[_0x6326('0x33')](_0x4e703a)[_0x6326('0x1e')](function(_0x3269c8){return _0x3269c8;});}return null;};}function removeEntity(_0x380593,_0x1a7924){return function(_0x46c803){if(_0x46c803){return _0x46c803[_0x6326('0x34')]()[_0x6326('0x1e')](function(){_0x380593[_0x6326('0x2e')](0xcc)[_0x6326('0x28')]();});}};}function handleEntityNotFound(_0x55aa3b,_0xe1bb4f){return function(_0x315276){if(!_0x315276){_0x55aa3b['sendStatus'](0x194);}return _0x315276;};}function handleError(_0x1933a2,_0x2958af){_0x2958af=_0x2958af||0x1f4;return function(_0x28ef24){logger['error'](_0x28ef24[_0x6326('0x35')]);if(_0x28ef24['name']){delete _0x28ef24['name'];}_0x1933a2[_0x6326('0x2e')](_0x2958af)[_0x6326('0x36')](_0x28ef24);};}exports[_0x6326('0x37')]=function(_0x4c06d9,_0x40d890){var _0x55a431={},_0xe5d93c={},_0x4fb95d={'count':0x0,'rows':[]};var _0x3168f9=_[_0x6326('0x38')](db[_0x6326('0x39')][_0x6326('0x3a')],function(_0x3fb30b){return{'name':_0x3fb30b[_0x6326('0x3b')],'type':_0x3fb30b['type'][_0x6326('0x3c')]};});_0xe5d93c[_0x6326('0x3d')]=_['map'](_0x3168f9,_0x6326('0x3e'));_0xe5d93c['query']=_['keys'](_0x4c06d9[_0x6326('0x3f')]);_0xe5d93c[_0x6326('0x40')]=_[_0x6326('0x41')](_0xe5d93c[_0x6326('0x3d')],_0xe5d93c[_0x6326('0x3f')]);_0x55a431[_0x6326('0x42')]=_['intersection'](_0xe5d93c['model'],qs[_0x6326('0x43')](_0x4c06d9['query'][_0x6326('0x43')]));_0x55a431['attributes']=_0x55a431[_0x6326('0x42')][_0x6326('0x44')]?_0x55a431[_0x6326('0x42')]:_0xe5d93c[_0x6326('0x3d')];if(!_0x4c06d9[_0x6326('0x3f')][_0x6326('0x45')](_0x6326('0x46'))){_0x55a431[_0x6326('0x2c')]=qs[_0x6326('0x2c')](_0x4c06d9[_0x6326('0x3f')][_0x6326('0x2c')]);_0x55a431['offset']=qs[_0x6326('0x2a')](_0x4c06d9['query'][_0x6326('0x2a')]);}_0x55a431[_0x6326('0x47')]=qs[_0x6326('0x48')](_0x4c06d9[_0x6326('0x3f')]['sort']);_0x55a431[_0x6326('0x49')]=qs[_0x6326('0x40')](_['pick'](_0x4c06d9[_0x6326('0x3f')],_0xe5d93c[_0x6326('0x40')]),_0x3168f9);if(_0x4c06d9[_0x6326('0x3f')][_0x6326('0x4a')]){_0x55a431['where']=_[_0x6326('0x4b')](_0x55a431[_0x6326('0x49')],{'$or':_[_0x6326('0x38')](_0x3168f9,function(_0x28504f){if(_0x28504f[_0x6326('0x4c')]!==_0x6326('0x4d')){var _0xa71ecb={};_0xa71ecb[_0x28504f['name']]={'$like':'%'+_0x4c06d9[_0x6326('0x3f')][_0x6326('0x4a')]+'%'};return _0xa71ecb;}})});}_0x55a431=_[_0x6326('0x4b')]({},_0x55a431,_0x4c06d9[_0x6326('0x4e')]);var _0x5f25cb={'where':_0x55a431[_0x6326('0x49')]};return db['DeskConfiguration'][_0x6326('0x2d')](_0x5f25cb)[_0x6326('0x1e')](function(_0x119559){_0x4fb95d[_0x6326('0x2d')]=_0x119559;if(_0x4c06d9[_0x6326('0x3f')]['includeAll']){_0x55a431[_0x6326('0x4f')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x55a431);})[_0x6326('0x1e')](function(_0x44cf9d){_0x4fb95d['rows']=_0x44cf9d;return _0x4fb95d;})[_0x6326('0x1e')](respondWithFilteredResult(_0x40d890,_0x55a431))[_0x6326('0x26')](handleError(_0x40d890,null));};exports[_0x6326('0x50')]=function(_0x27e458,_0x3a3907){var _0x4f8dc0={'raw':![],'where':{'id':_0x27e458[_0x6326('0x51')]['id']}},_0x4af0ee={};_0x4af0ee[_0x6326('0x3d')]=_[_0x6326('0x52')](db[_0x6326('0x39')][_0x6326('0x3a')]);_0x4af0ee[_0x6326('0x3f')]=_[_0x6326('0x52')](_0x27e458['query']);_0x4af0ee[_0x6326('0x40')]=_[_0x6326('0x41')](_0x4af0ee[_0x6326('0x3d')],_0x4af0ee[_0x6326('0x3f')]);_0x4f8dc0[_0x6326('0x42')]=_['intersection'](_0x4af0ee[_0x6326('0x3d')],qs['fields'](_0x27e458[_0x6326('0x3f')][_0x6326('0x43')]));_0x4f8dc0['attributes']=_0x4f8dc0[_0x6326('0x42')]['length']?_0x4f8dc0[_0x6326('0x42')]:_0x4af0ee[_0x6326('0x3d')];if(_0x27e458[_0x6326('0x3f')][_0x6326('0x53')]){_0x4f8dc0['include']=[{'all':!![]}];}_0x4f8dc0=_[_0x6326('0x4b')]({},_0x4f8dc0,_0x27e458[_0x6326('0x4e')]);return db['DeskConfiguration'][_0x6326('0x54')](_0x4f8dc0)[_0x6326('0x1e')](handleEntityNotFound(_0x3a3907,null))[_0x6326('0x1e')](respondWithResult(_0x3a3907,null))['catch'](handleError(_0x3a3907,null));};exports[_0x6326('0x55')]=function(_0x2ac64b,_0x59a167){return db[_0x6326('0x39')]['create'](_0x2ac64b[_0x6326('0x56')],{})[_0x6326('0x1e')](respondWithResult(_0x59a167,0xc9))[_0x6326('0x26')](handleError(_0x59a167,null));};exports[_0x6326('0x33')]=function(_0x13022f,_0x420290){if(_0x13022f[_0x6326('0x56')]['id']){delete _0x13022f['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x13022f[_0x6326('0x51')]['id']}})['then'](handleEntityNotFound(_0x420290,null))[_0x6326('0x1e')](saveUpdates(_0x13022f[_0x6326('0x56')],null))[_0x6326('0x1e')](respondWithResult(_0x420290,null))[_0x6326('0x26')](handleError(_0x420290,null));};exports[_0x6326('0x34')]=function(_0x4b5bc6,_0x23bf64){return db[_0x6326('0x39')]['find']({'where':{'id':_0x4b5bc6[_0x6326('0x51')]['id']}})[_0x6326('0x1e')](handleEntityNotFound(_0x23bf64,null))[_0x6326('0x1e')](removeEntity(_0x23bf64,null))[_0x6326('0x26')](handleError(_0x23bf64,null));};exports[_0x6326('0x57')]=function(_0x36f2f5,_0x320d43,_0x2f624f){var _0x2c7a8d={};var _0x37506f={};var _0x4c6544;var _0x426b5a;return db[_0x6326('0x39')][_0x6326('0x58')]({'where':{'id':_0x36f2f5[_0x6326('0x51')]['id']}})['then'](handleEntityNotFound(_0x320d43,null))['then'](function(_0x8d9eea){if(_0x8d9eea){_0x4c6544=_0x8d9eea;_0x37506f[_0x6326('0x3d')]=_[_0x6326('0x52')](db[_0x6326('0x59')][_0x6326('0x3a')]);_0x37506f['query']=_['keys'](_0x36f2f5[_0x6326('0x3f')]);_0x37506f[_0x6326('0x40')]=_[_0x6326('0x41')](_0x37506f[_0x6326('0x3d')],_0x37506f['query']);_0x2c7a8d[_0x6326('0x42')]=_[_0x6326('0x41')](_0x37506f[_0x6326('0x3d')],qs[_0x6326('0x43')](_0x36f2f5[_0x6326('0x3f')][_0x6326('0x43')]));_0x2c7a8d['attributes']=_0x2c7a8d[_0x6326('0x42')]['length']?_0x2c7a8d[_0x6326('0x42')]:_0x37506f[_0x6326('0x3d')];_0x2c7a8d['order']=qs[_0x6326('0x48')](_0x36f2f5[_0x6326('0x3f')][_0x6326('0x48')]);_0x2c7a8d[_0x6326('0x49')]=qs[_0x6326('0x40')](_[_0x6326('0x5a')](_0x36f2f5[_0x6326('0x3f')],_0x37506f[_0x6326('0x40')]));if(_0x36f2f5[_0x6326('0x3f')][_0x6326('0x4a')]){_0x2c7a8d['where']=_[_0x6326('0x4b')](_0x2c7a8d[_0x6326('0x49')],{'$or':_[_0x6326('0x38')](_0x2c7a8d[_0x6326('0x42')],function(_0x26b86b){var _0x5599da={};_0x5599da[_0x26b86b]={'$like':'%'+_0x36f2f5[_0x6326('0x3f')][_0x6326('0x4a')]+'%'};return _0x5599da;})});}_0x2c7a8d=_[_0x6326('0x4b')]({},_0x2c7a8d,_0x36f2f5[_0x6326('0x4e')]);return _0x4c6544[_0x6326('0x57')](_0x2c7a8d);}})['then'](function(_0x468e7d){if(_0x468e7d){_0x426b5a=_0x468e7d['length'];if(!_0x36f2f5['query'][_0x6326('0x45')](_0x6326('0x46'))){_0x2c7a8d[_0x6326('0x2c')]=qs[_0x6326('0x2c')](_0x36f2f5['query']['limit']);_0x2c7a8d['offset']=qs['offset'](_0x36f2f5[_0x6326('0x3f')]['offset']);}return _0x4c6544[_0x6326('0x57')](_0x2c7a8d);}})[_0x6326('0x1e')](function(_0x54730e){if(_0x54730e){return _0x54730e?{'count':_0x426b5a,'rows':_0x54730e}:null;}})[_0x6326('0x1e')](respondWithResult(_0x320d43,null))['catch'](handleError(_0x320d43,null));};exports[_0x6326('0x5b')]=function(_0x50724d,_0x22cae7,_0x488e03){var _0x4d41c0={};var _0x528944={};var _0x47f0c0;var _0x19916e;return db['DeskConfiguration'][_0x6326('0x58')]({'where':{'id':_0x50724d[_0x6326('0x51')]['id']}})['then'](handleEntityNotFound(_0x22cae7,null))[_0x6326('0x1e')](function(_0x50e78c){if(_0x50e78c){_0x47f0c0=_0x50e78c;_0x528944[_0x6326('0x3d')]=_[_0x6326('0x52')](db[_0x6326('0x59')][_0x6326('0x3a')]);_0x528944[_0x6326('0x3f')]=_[_0x6326('0x52')](_0x50724d[_0x6326('0x3f')]);_0x528944[_0x6326('0x40')]=_[_0x6326('0x41')](_0x528944[_0x6326('0x3d')],_0x528944[_0x6326('0x3f')]);_0x4d41c0[_0x6326('0x42')]=_[_0x6326('0x41')](_0x528944[_0x6326('0x3d')],qs[_0x6326('0x43')](_0x50724d[_0x6326('0x3f')][_0x6326('0x43')]));_0x4d41c0['attributes']=_0x4d41c0['attributes']['length']?_0x4d41c0['attributes']:_0x528944[_0x6326('0x3d')];_0x4d41c0['order']=qs['sort'](_0x50724d['query']['sort']);_0x4d41c0['where']=qs['filters'](_[_0x6326('0x5a')](_0x50724d[_0x6326('0x3f')],_0x528944['filters']));if(_0x50724d[_0x6326('0x3f')][_0x6326('0x4a')]){_0x4d41c0[_0x6326('0x49')]=_['merge'](_0x4d41c0[_0x6326('0x49')],{'$or':_[_0x6326('0x38')](_0x4d41c0[_0x6326('0x42')],function(_0x396cbf){var _0x3e9477={};_0x3e9477[_0x396cbf]={'$like':'%'+_0x50724d['query'][_0x6326('0x4a')]+'%'};return _0x3e9477;})});}_0x4d41c0=_['merge']({},_0x4d41c0,_0x50724d['options']);return _0x47f0c0[_0x6326('0x5b')](_0x4d41c0);}})['then'](function(_0x57c845){if(_0x57c845){_0x19916e=_0x57c845['length'];if(!_0x50724d['query']['hasOwnProperty']('nolimit')){_0x4d41c0['limit']=qs[_0x6326('0x2c')](_0x50724d[_0x6326('0x3f')][_0x6326('0x2c')]);_0x4d41c0[_0x6326('0x2a')]=qs['offset'](_0x50724d['query']['offset']);}return _0x47f0c0[_0x6326('0x5b')](_0x4d41c0);}})[_0x6326('0x1e')](function(_0x482231){if(_0x482231){return _0x482231?{'count':_0x19916e,'rows':_0x482231}:null;}})[_0x6326('0x1e')](respondWithResult(_0x22cae7,null))['catch'](handleError(_0x22cae7,null));};exports['getDescriptions']=function(_0x23d12d,_0xc626ff,_0x2d81b0){var _0x3c2348={};var _0x2da14d={};var _0x26929e;var _0x45560f;return db['DeskConfiguration']['findOne']({'where':{'id':_0x23d12d['params']['id']}})[_0x6326('0x1e')](handleEntityNotFound(_0xc626ff,null))['then'](function(_0x48631a){if(_0x48631a){_0x26929e=_0x48631a;_0x2da14d[_0x6326('0x3d')]=_[_0x6326('0x52')](db['DeskField'][_0x6326('0x3a')]);_0x2da14d['query']=_['keys'](_0x23d12d[_0x6326('0x3f')]);_0x2da14d[_0x6326('0x40')]=_['intersection'](_0x2da14d['model'],_0x2da14d[_0x6326('0x3f')]);_0x3c2348[_0x6326('0x42')]=_[_0x6326('0x41')](_0x2da14d[_0x6326('0x3d')],qs['fields'](_0x23d12d['query'][_0x6326('0x43')]));_0x3c2348[_0x6326('0x42')]=_0x3c2348[_0x6326('0x42')][_0x6326('0x44')]?_0x3c2348[_0x6326('0x42')]:_0x2da14d[_0x6326('0x3d')];_0x3c2348[_0x6326('0x47')]=qs[_0x6326('0x48')](_0x23d12d['query'][_0x6326('0x48')]);_0x3c2348['where']=qs[_0x6326('0x40')](_[_0x6326('0x5a')](_0x23d12d[_0x6326('0x3f')],_0x2da14d[_0x6326('0x40')]));if(_0x23d12d[_0x6326('0x3f')][_0x6326('0x4a')]){_0x3c2348['where']=_[_0x6326('0x4b')](_0x3c2348[_0x6326('0x49')],{'$or':_['map'](_0x3c2348[_0x6326('0x42')],function(_0x472866){var _0x3104c5={};_0x3104c5[_0x472866]={'$like':'%'+_0x23d12d[_0x6326('0x3f')][_0x6326('0x4a')]+'%'};return _0x3104c5;})});}_0x3c2348=_[_0x6326('0x4b')]({},_0x3c2348,_0x23d12d[_0x6326('0x4e')]);return _0x26929e['getDescriptions'](_0x3c2348);}})[_0x6326('0x1e')](function(_0x21ccbf){if(_0x21ccbf){_0x45560f=_0x21ccbf[_0x6326('0x44')];if(!_0x23d12d[_0x6326('0x3f')][_0x6326('0x45')]('nolimit')){_0x3c2348[_0x6326('0x2c')]=qs[_0x6326('0x2c')](_0x23d12d['query'][_0x6326('0x2c')]);_0x3c2348[_0x6326('0x2a')]=qs[_0x6326('0x2a')](_0x23d12d[_0x6326('0x3f')][_0x6326('0x2a')]);}return _0x26929e[_0x6326('0x5c')](_0x3c2348);}})[_0x6326('0x1e')](function(_0x107b7b){if(_0x107b7b){return _0x107b7b?{'count':_0x45560f,'rows':_0x107b7b}:null;}})['then'](respondWithResult(_0xc626ff,null))[_0x6326('0x26')](handleError(_0xc626ff,null));};exports[_0x6326('0x5d')]=function(_0x911a32,_0x1335da,_0x38788f){var _0x3124ab={};var _0xcb5683={};var _0x562929;var _0x1cdb68;return db['DeskConfiguration'][_0x6326('0x58')]({'where':{'id':_0x911a32['params']['id']}})[_0x6326('0x1e')](handleEntityNotFound(_0x1335da,null))['then'](function(_0x2b885b){if(_0x2b885b){_0x562929=_0x2b885b;_0xcb5683[_0x6326('0x3d')]=_[_0x6326('0x52')](db[_0x6326('0x5e')][_0x6326('0x3a')]);_0xcb5683[_0x6326('0x3f')]=_[_0x6326('0x52')](_0x911a32['query']);_0xcb5683[_0x6326('0x40')]=_[_0x6326('0x41')](_0xcb5683[_0x6326('0x3d')],_0xcb5683['query']);_0x3124ab[_0x6326('0x42')]=_['intersection'](_0xcb5683[_0x6326('0x3d')],qs[_0x6326('0x43')](_0x911a32[_0x6326('0x3f')][_0x6326('0x43')]));_0x3124ab[_0x6326('0x42')]=_0x3124ab[_0x6326('0x42')][_0x6326('0x44')]?_0x3124ab['attributes']:_0xcb5683[_0x6326('0x3d')];_0x3124ab['order']=qs[_0x6326('0x48')](_0x911a32[_0x6326('0x3f')][_0x6326('0x48')]);_0x3124ab[_0x6326('0x49')]=qs['filters'](_['pick'](_0x911a32[_0x6326('0x3f')],_0xcb5683[_0x6326('0x40')]));if(_0x911a32[_0x6326('0x3f')][_0x6326('0x4a')]){_0x3124ab['where']=_[_0x6326('0x4b')](_0x3124ab['where'],{'$or':_['map'](_0x3124ab[_0x6326('0x42')],function(_0x33db4f){var _0xc32fa6={};_0xc32fa6[_0x33db4f]={'$like':'%'+_0x911a32[_0x6326('0x3f')][_0x6326('0x4a')]+'%'};return _0xc32fa6;})});}_0x3124ab=_[_0x6326('0x4b')]({},_0x3124ab,_0x911a32[_0x6326('0x4e')]);return _0x562929[_0x6326('0x5d')](_0x3124ab);}})[_0x6326('0x1e')](function(_0x3884db){if(_0x3884db){_0x1cdb68=_0x3884db['length'];if(!_0x911a32['query'][_0x6326('0x45')]('nolimit')){_0x3124ab[_0x6326('0x2c')]=qs['limit'](_0x911a32['query'][_0x6326('0x2c')]);_0x3124ab[_0x6326('0x2a')]=qs[_0x6326('0x2a')](_0x911a32[_0x6326('0x3f')][_0x6326('0x2a')]);}return _0x562929[_0x6326('0x5d')](_0x3124ab);}})[_0x6326('0x1e')](function(_0x179b3f){if(_0x179b3f){return _0x179b3f?{'count':_0x1cdb68,'rows':_0x179b3f}:null;}})['then'](respondWithResult(_0x1335da,null))['catch'](handleError(_0x1335da,null));};exports[_0x6326('0x5f')]=function(_0x47b0e0,_0x2a1a9c,_0x1746b5){if(_0x47b0e0['body']['id']){delete _0x47b0e0['body']['id'];}return db[_0x6326('0x39')]['findOne']({'where':{'id':_0x47b0e0['params']['id']}})['then'](handleEntityNotFound(_0x2a1a9c,null))[_0x6326('0x1e')](function(_0x3a9a9e){if(_0x3a9a9e){return _0x3a9a9e[_0x6326('0x5f')](_0x47b0e0[_0x6326('0x56')][_0x6326('0x60')]||[]);}return null;})[_0x6326('0x1e')](respondWithResult(_0x2a1a9c,null))[_0x6326('0x26')](handleError(_0x2a1a9c,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 99aeb97..4824fcc 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 _0x3a78=['exports','define','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intDeskConfiguration.attributes'];(function(_0x5e5d0b,_0x5405af){var _0x2214f7=function(_0x28398a){while(--_0x28398a){_0x5e5d0b['push'](_0x5e5d0b['shift']());}};_0x2214f7(++_0x5405af);}(_0x3a78,0x7b));var _0x83a7=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x3a78[_0x22dac7];return _0x3e6cfa;};'use strict';var _=require(_0x83a7('0x0'));var util=require(_0x83a7('0x1'));var logger=require(_0x83a7('0x2'))(_0x83a7('0x3'));var moment=require(_0x83a7('0x4'));var BPromise=require(_0x83a7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x83a7('0x6'));var rimraf=require(_0x83a7('0x7'));var config=require('../../config/environment');var attributes=require(_0x83a7('0x8'));module[_0x83a7('0x9')]=function(_0x1fbfff,_0x57a873){return _0x1fbfff[_0x83a7('0xa')]('DeskConfiguration',attributes,{'tableName':_0x83a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1385=['int_desk_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf','define','DeskConfiguration'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0x1385,0x141));var _0x5138=function(_0x180cd5,_0x2af23d){_0x180cd5=_0x180cd5-0x0;var _0x48cbe9=_0x1385[_0x180cd5];return _0x48cbe9;};'use strict';var _=require(_0x5138('0x0'));var util=require(_0x5138('0x1'));var logger=require(_0x5138('0x2'))('api');var moment=require(_0x5138('0x3'));var BPromise=require(_0x5138('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5138('0x5'));var rimraf=require(_0x5138('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x146a4e,_0x533e8a){return _0x146a4e[_0x5138('0x7')](_0x5138('0x8'),attributes,{'tableName':_0x5138('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index c090fc3..109b7e4 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 _0x867f=['then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x391932,_0x3c1b9f){var _0x49ca90=function(_0x589776){while(--_0x589776){_0x391932['push'](_0x391932['shift']());}};_0x49ca90(++_0x3c1b9f);}(_0x867f,0xe6));var _0xf867=function(_0x55a802,_0x10ab3a){_0x55a802=_0x55a802-0x0;var _0x1a0461=_0x867f[_0x55a802];return _0x1a0461;};'use strict';var _=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var moment=require(_0xf867('0x2'));var BPromise=require(_0xf867('0x3'));var rs=require(_0xf867('0x4'));var fs=require('fs');var Redis=require(_0xf867('0x5'));var db=require(_0xf867('0x6'))['db'];var utils=require(_0xf867('0x7'));var logger=require(_0xf867('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf867('0x9'));var client=jayson[_0xf867('0xa')][_0xf867('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2841d1,_0x3fe5d1,_0x5c35f9){return new BPromise(function(_0x583f87,_0x26cfba){return client['request'](_0x2841d1,_0x5c35f9)[_0xf867('0xc')](function(_0x2b1c12){logger[_0xf867('0xd')](_0xf867('0xe'),_0x3fe5d1,_0xf867('0xf'));logger[_0xf867('0x10')](_0xf867('0x11'),_0x3fe5d1,_0xf867('0xf'),JSON['stringify'](_0x2b1c12));if(_0x2b1c12[_0xf867('0x12')]){if(_0x2b1c12['error']['code']===0x1f4){logger[_0xf867('0x12')](_0xf867('0xe'),_0x3fe5d1,_0x2b1c12[_0xf867('0x12')]['message']);return _0x26cfba(_0x2b1c12['error'][_0xf867('0x13')]);}logger['error'](_0xf867('0xe'),_0x3fe5d1,_0x2b1c12['error']['message']);return _0x583f87(_0x2b1c12[_0xf867('0x12')][_0xf867('0x13')]);}else{logger[_0xf867('0xd')](_0xf867('0xe'),_0x3fe5d1,_0xf867('0xf'));_0x583f87(_0x2b1c12[_0xf867('0x14')][_0xf867('0x13')]);}})[_0xf867('0x15')](function(_0x33c10b){logger['error'](_0xf867('0xe'),_0x3fe5d1,_0x33c10b);_0x26cfba(_0x33c10b);});});} \ No newline at end of file +var _0x94b1=['rpc','../../config/environment','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xf29840,_0x5071a6){var _0x1c5935=function(_0xe902b7){while(--_0xe902b7){_0xf29840['push'](_0xf29840['shift']());}};_0x1c5935(++_0x5071a6);}(_0x94b1,0x102));var _0x194b=function(_0x59a033,_0x59ebb2){_0x59a033=_0x59a033-0x0;var _0x2b0b6e=_0x94b1[_0x59a033];return _0x2b0b6e;};'use strict';var _=require('lodash');var util=require(_0x194b('0x0'));var moment=require('moment');var BPromise=require(_0x194b('0x1'));var rs=require(_0x194b('0x2'));var fs=require('fs');var Redis=require(_0x194b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x194b('0x4'));var logger=require(_0x194b('0x5'))(_0x194b('0x6'));var config=require(_0x194b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x194b('0x8')][_0x194b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5213ad,_0x3ec8c2,_0x4e82ac){return new BPromise(function(_0x24b450,_0x4759c0){return client[_0x194b('0xa')](_0x5213ad,_0x4e82ac)[_0x194b('0xb')](function(_0x2f5bb3){logger[_0x194b('0xc')](_0x194b('0xd'),_0x3ec8c2,'request\x20sent');logger[_0x194b('0xe')](_0x194b('0xf'),_0x3ec8c2,_0x194b('0x10'),JSON['stringify'](_0x2f5bb3));if(_0x2f5bb3[_0x194b('0x11')]){if(_0x2f5bb3[_0x194b('0x11')][_0x194b('0x12')]===0x1f4){logger[_0x194b('0x11')](_0x194b('0xd'),_0x3ec8c2,_0x2f5bb3[_0x194b('0x11')][_0x194b('0x13')]);return _0x4759c0(_0x2f5bb3[_0x194b('0x11')][_0x194b('0x13')]);}logger[_0x194b('0x11')](_0x194b('0xd'),_0x3ec8c2,_0x2f5bb3[_0x194b('0x11')][_0x194b('0x13')]);return _0x24b450(_0x2f5bb3[_0x194b('0x11')][_0x194b('0x13')]);}else{logger[_0x194b('0xc')](_0x194b('0xd'),_0x3ec8c2,_0x194b('0x10'));_0x24b450(_0x2f5bb3[_0x194b('0x14')][_0x194b('0x13')]);}})[_0x194b('0x15')](function(_0x4a115a){logger['error'](_0x194b('0xd'),_0x3ec8c2,_0x4a115a);_0x4759c0(_0x4a115a);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index cbf1f27..d442742 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x7a54,0x106));var _0x47a5=function(_0x19f720,_0x170695){_0x19f720=_0x19f720-0x0;var _0x5373ef=_0x7a54[_0x19f720];return _0x5373ef;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0x222806,_0xa0c1c4){_0x222806=_0x222806-0x0;var _0xa7165=_0x7a54[_0x222806];return _0xa7165;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index e5fbb80..d6f6ab1 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 _0xa66f=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist'];(function(_0x13548e,_0xbe957e){var _0x4d66fd=function(_0x4713ab){while(--_0x4713ab){_0x13548e['push'](_0x13548e['shift']());}};_0x4d66fd(++_0xbe957e);}(_0xa66f,0xa3));var _0xfa66=function(_0x853cc1,_0x1f8186){_0x853cc1=_0x853cc1-0x0;var _0x2caef4=_0xa66f[_0x853cc1];return _0x2caef4;};'use strict';var Sequelize=require(_0xfa66('0x0'));module[_0xfa66('0x1')]={'type':{'type':Sequelize[_0xfa66('0x2')](_0xfa66('0x3'),_0xfa66('0x4'),'customVariable',_0xfa66('0x5'),_0xfa66('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfa66('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfa66('0x2')](_0xfa66('0x3'),'variable',_0xfa66('0x8'))},'keyContent':{'type':Sequelize[_0xfa66('0x7')]},'idField':{'type':Sequelize[_0xfa66('0x7')]},'nameField':{'type':Sequelize[_0xfa66('0x7')]},'customField':{'type':Sequelize[_0xfa66('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfa66('0x7')]}}; \ No newline at end of file +var _0x3717=['customVariable','exports','ENUM','variable','picklist','string','STRING'];(function(_0x4a23ee,_0x15d8e5){var _0x3dbf39=function(_0x591e46){while(--_0x591e46){_0x4a23ee['push'](_0x4a23ee['shift']());}};_0x3dbf39(++_0x15d8e5);}(_0x3717,0x8d));var _0x7371=function(_0x402d40,_0x3a4b7b){_0x402d40=_0x402d40-0x0;var _0x58d649=_0x3717[_0x402d40];return _0x58d649;};'use strict';var Sequelize=require('sequelize');module[_0x7371('0x0')]={'type':{'type':Sequelize[_0x7371('0x1')]('string',_0x7371('0x2'),'customVariable','keyValue',_0x7371('0x3')),'defaultValue':_0x7371('0x4')},'content':{'type':Sequelize[_0x7371('0x5')]},'key':{'type':Sequelize[_0x7371('0x5')]},'keyType':{'type':Sequelize[_0x7371('0x1')]('string',_0x7371('0x2'),_0x7371('0x6'))},'keyContent':{'type':Sequelize[_0x7371('0x5')]},'idField':{'type':Sequelize[_0x7371('0x5')]},'nameField':{'type':Sequelize[_0x7371('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7371('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index dfc670b..d36a25e 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 _0x84a0=['map','DeskField','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','destroy','then','name'];(function(_0x338f23,_0x4baf56){var _0x11a457=function(_0x12a128){while(--_0x12a128){_0x338f23['push'](_0x338f23['shift']());}};_0x11a457(++_0x4baf56);}(_0x84a0,0x66));var _0x084a=function(_0x41064d,_0x58b2ba){_0x41064d=_0x41064d-0x0;var _0x57ab96=_0x84a0[_0x41064d];return _0x57ab96;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];function respondWithStatusCode(_0x3ca72f,_0xec90a5){_0xec90a5=_0xec90a5||0xcc;return function(_0x9245b1){if(_0x9245b1){return _0x3ca72f[_0x084a('0x18')](_0xec90a5);}return _0x3ca72f[_0x084a('0x19')](_0xec90a5)[_0x084a('0x1a')]();};}function respondWithResult(_0x3a76d1,_0x5aef40){_0x5aef40=_0x5aef40||0xc8;return function(_0x4277c9){if(_0x4277c9){return _0x3a76d1['status'](_0x5aef40)[_0x084a('0x1b')](_0x4277c9);}};}function respondWithFilteredResult(_0x3ccaca,_0x366624){return function(_0x2d35b8){if(_0x2d35b8){var _0xd20527=typeof _0x366624['offset']===_0x084a('0x1c')&&typeof _0x366624['limit']===_0x084a('0x1c');var _0x355b45=_0x2d35b8['count'];var _0xf2c333=_0xd20527?0x0:_0x366624[_0x084a('0x1d')];var _0x4134b9=_0xd20527?_0x2d35b8[_0x084a('0x1e')]:_0x366624[_0x084a('0x1d')]+_0x366624[_0x084a('0x1f')];var _0x447a19;if(_0x4134b9>=_0x355b45){_0x4134b9=_0x355b45;_0x447a19=0xc8;}else{_0x447a19=0xce;}_0x3ccaca[_0x084a('0x19')](_0x447a19);return _0x3ccaca[_0x084a('0x20')](_0x084a('0x21'),_0xf2c333+'-'+_0x4134b9+'/'+_0x355b45)[_0x084a('0x1b')](_0x2d35b8);}return null;};}function patchUpdates(_0x279e25){return function(_0x116328){try{jsonpatch[_0x084a('0x22')](_0x116328,_0x279e25,!![]);}catch(_0xf0dd98){return BPromise['reject'](_0xf0dd98);}return _0x116328[_0x084a('0x23')]();};}function saveUpdates(_0x1ad257,_0x41a90f){return function(_0x2d62bf){if(_0x2d62bf){return _0x2d62bf[_0x084a('0x24')](_0x1ad257)['then'](function(_0x755c24){return _0x755c24;});}return null;};}function removeEntity(_0x288e9e,_0x6346a5){return function(_0x1f2c9f){if(_0x1f2c9f){return _0x1f2c9f[_0x084a('0x25')]()[_0x084a('0x26')](function(){_0x288e9e['status'](0xcc)[_0x084a('0x1a')]();});}};}function handleEntityNotFound(_0x2af138,_0x54233b){return function(_0x5b1474){if(!_0x5b1474){_0x2af138[_0x084a('0x18')](0x194);}return _0x5b1474;};}function handleError(_0x3dd8b9,_0xfc9b8c){_0xfc9b8c=_0xfc9b8c||0x1f4;return function(_0x4c5658){logger['error'](_0x4c5658['stack']);if(_0x4c5658['name']){delete _0x4c5658[_0x084a('0x27')];}_0x3dd8b9['status'](_0xfc9b8c)['send'](_0x4c5658);};}exports['index']=function(_0x3b8176,_0x4651e6){var _0x388062={},_0x2c4149={},_0x3be7a6={'count':0x0,'rows':[]};var _0x25a2a1=_[_0x084a('0x28')](db[_0x084a('0x29')]['rawAttributes'],function(_0x2ed3cd){return{'name':_0x2ed3cd[_0x084a('0x2a')],'type':_0x2ed3cd['type'][_0x084a('0x2b')]};});_0x2c4149[_0x084a('0x2c')]=_[_0x084a('0x28')](_0x25a2a1,_0x084a('0x27'));_0x2c4149[_0x084a('0x2d')]=_[_0x084a('0x2e')](_0x3b8176[_0x084a('0x2d')]);_0x2c4149[_0x084a('0x2f')]=_[_0x084a('0x30')](_0x2c4149[_0x084a('0x2c')],_0x2c4149[_0x084a('0x2d')]);_0x388062[_0x084a('0x31')]=_[_0x084a('0x30')](_0x2c4149['model'],qs['fields'](_0x3b8176[_0x084a('0x2d')][_0x084a('0x32')]));_0x388062[_0x084a('0x31')]=_0x388062[_0x084a('0x31')][_0x084a('0x33')]?_0x388062['attributes']:_0x2c4149[_0x084a('0x2c')];if(!_0x3b8176[_0x084a('0x2d')][_0x084a('0x34')]('nolimit')){_0x388062[_0x084a('0x1f')]=qs[_0x084a('0x1f')](_0x3b8176[_0x084a('0x2d')]['limit']);_0x388062['offset']=qs['offset'](_0x3b8176[_0x084a('0x2d')][_0x084a('0x1d')]);}_0x388062[_0x084a('0x35')]=qs['sort'](_0x3b8176[_0x084a('0x2d')][_0x084a('0x36')]);_0x388062[_0x084a('0x37')]=qs[_0x084a('0x2f')](_[_0x084a('0x38')](_0x3b8176[_0x084a('0x2d')],_0x2c4149[_0x084a('0x2f')]),_0x25a2a1);if(_0x3b8176[_0x084a('0x2d')][_0x084a('0x39')]){_0x388062[_0x084a('0x37')]=_[_0x084a('0x3a')](_0x388062[_0x084a('0x37')],{'$or':_[_0x084a('0x28')](_0x25a2a1,function(_0x1659d3){if(_0x1659d3[_0x084a('0x3b')]!=='VIRTUAL'){var _0x220f88={};_0x220f88[_0x1659d3[_0x084a('0x27')]]={'$like':'%'+_0x3b8176[_0x084a('0x2d')][_0x084a('0x39')]+'%'};return _0x220f88;}})});}_0x388062=_[_0x084a('0x3a')]({},_0x388062,_0x3b8176[_0x084a('0x3c')]);var _0xa7b652={'where':_0x388062[_0x084a('0x37')]};return db[_0x084a('0x29')]['count'](_0xa7b652)[_0x084a('0x26')](function(_0x3d1aa5){_0x3be7a6[_0x084a('0x1e')]=_0x3d1aa5;if(_0x3b8176[_0x084a('0x2d')][_0x084a('0x3d')]){_0x388062[_0x084a('0x3e')]=[{'all':!![]}];}return db['DeskField'][_0x084a('0x3f')](_0x388062);})[_0x084a('0x26')](function(_0x55c5f4){_0x3be7a6[_0x084a('0x40')]=_0x55c5f4;return _0x3be7a6;})[_0x084a('0x26')](respondWithFilteredResult(_0x4651e6,_0x388062))[_0x084a('0x41')](handleError(_0x4651e6,null));};exports['show']=function(_0x1aa4ea,_0xba1081){var _0x4fe9c2={'raw':!![],'where':{'id':_0x1aa4ea[_0x084a('0x42')]['id']}},_0x3e2b92={};_0x3e2b92['model']=_['keys'](db[_0x084a('0x29')][_0x084a('0x43')]);_0x3e2b92[_0x084a('0x2d')]=_[_0x084a('0x2e')](_0x1aa4ea[_0x084a('0x2d')]);_0x3e2b92[_0x084a('0x2f')]=_[_0x084a('0x30')](_0x3e2b92[_0x084a('0x2c')],_0x3e2b92[_0x084a('0x2d')]);_0x4fe9c2[_0x084a('0x31')]=_[_0x084a('0x30')](_0x3e2b92['model'],qs['fields'](_0x1aa4ea[_0x084a('0x2d')][_0x084a('0x32')]));_0x4fe9c2[_0x084a('0x31')]=_0x4fe9c2['attributes'][_0x084a('0x33')]?_0x4fe9c2[_0x084a('0x31')]:_0x3e2b92[_0x084a('0x2c')];if(_0x1aa4ea[_0x084a('0x2d')][_0x084a('0x3d')]){_0x4fe9c2['include']=[{'all':!![]}];}_0x4fe9c2=_[_0x084a('0x3a')]({},_0x4fe9c2,_0x1aa4ea['options']);return db[_0x084a('0x29')][_0x084a('0x44')](_0x4fe9c2)[_0x084a('0x26')](handleEntityNotFound(_0xba1081,null))['then'](respondWithResult(_0xba1081,null))['catch'](handleError(_0xba1081,null));};exports[_0x084a('0x45')]=function(_0xef8fc7,_0x505965){return db[_0x084a('0x29')][_0x084a('0x45')](_0xef8fc7[_0x084a('0x46')],{})[_0x084a('0x26')](respondWithResult(_0x505965,0xc9))['catch'](handleError(_0x505965,null));};exports[_0x084a('0x24')]=function(_0x865368,_0x31677b){if(_0x865368[_0x084a('0x46')]['id']){delete _0x865368['body']['id'];}return db[_0x084a('0x29')][_0x084a('0x44')]({'where':{'id':_0x865368[_0x084a('0x42')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x31677b,null))['then'](saveUpdates(_0x865368['body'],null))[_0x084a('0x26')](respondWithResult(_0x31677b,null))[_0x084a('0x41')](handleError(_0x31677b,null));};exports[_0x084a('0x25')]=function(_0x264f09,_0xf936e){return db[_0x084a('0x29')][_0x084a('0x44')]({'where':{'id':_0x264f09[_0x084a('0x42')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0xf936e,null))[_0x084a('0x26')](removeEntity(_0xf936e,null))[_0x084a('0x41')](handleError(_0xf936e,null));}; \ No newline at end of file +var _0xa30a=['catch','includeAll','find','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','apply','save','update','then','error','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','rows'];(function(_0x2fb252,_0x50501f){var _0x55d04d=function(_0x21c80b){while(--_0x21c80b){_0x2fb252['push'](_0x2fb252['shift']());}};_0x55d04d(++_0x50501f);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec992f,_0x3de2d1){_0x3de2d1=_0x3de2d1||0xcc;return function(_0xcd1d3b){if(_0xcd1d3b){return _0xec992f['sendStatus'](_0x3de2d1);}return _0xec992f[_0xaa30('0x19')](_0x3de2d1)[_0xaa30('0x1a')]();};}function respondWithResult(_0x25c02e,_0x14de74){_0x14de74=_0x14de74||0xc8;return function(_0x41f1d9){if(_0x41f1d9){return _0x25c02e[_0xaa30('0x19')](_0x14de74)[_0xaa30('0x1b')](_0x41f1d9);}};}function respondWithFilteredResult(_0x3b8095,_0x2e37af){return function(_0xfae724){if(_0xfae724){var _0x519518=typeof _0x2e37af[_0xaa30('0x1c')]==='undefined'&&typeof _0x2e37af['limit']===_0xaa30('0x1d');var _0x153939=_0xfae724[_0xaa30('0x1e')];var _0x540e36=_0x519518?0x0:_0x2e37af['offset'];var _0x53f9fd=_0x519518?_0xfae724[_0xaa30('0x1e')]:_0x2e37af['offset']+_0x2e37af[_0xaa30('0x1f')];var _0x332a0a;if(_0x53f9fd>=_0x153939){_0x53f9fd=_0x153939;_0x332a0a=0xc8;}else{_0x332a0a=0xce;}_0x3b8095['status'](_0x332a0a);return _0x3b8095['set']('Content-Range',_0x540e36+'-'+_0x53f9fd+'/'+_0x153939)[_0xaa30('0x1b')](_0xfae724);}return null;};}function patchUpdates(_0x3e4f1d){return function(_0x61b85){try{jsonpatch[_0xaa30('0x20')](_0x61b85,_0x3e4f1d,!![]);}catch(_0x43a526){return BPromise['reject'](_0x43a526);}return _0x61b85[_0xaa30('0x21')]();};}function saveUpdates(_0x24bb25,_0x2e16e7){return function(_0x2d9e35){if(_0x2d9e35){return _0x2d9e35[_0xaa30('0x22')](_0x24bb25)['then'](function(_0x325b42){return _0x325b42;});}return null;};}function removeEntity(_0x13128a,_0x2fecdd){return function(_0x326f84){if(_0x326f84){return _0x326f84['destroy']()[_0xaa30('0x23')](function(){_0x13128a[_0xaa30('0x19')](0xcc)[_0xaa30('0x1a')]();});}};}function handleEntityNotFound(_0x12da2f,_0x97b038){return function(_0x2a59ce){if(!_0x2a59ce){_0x12da2f['sendStatus'](0x194);}return _0x2a59ce;};}function handleError(_0x467850,_0x465701){_0x465701=_0x465701||0x1f4;return function(_0x5d4da8){logger[_0xaa30('0x24')](_0x5d4da8['stack']);if(_0x5d4da8[_0xaa30('0x25')]){delete _0x5d4da8[_0xaa30('0x25')];}_0x467850[_0xaa30('0x19')](_0x465701)[_0xaa30('0x26')](_0x5d4da8);};}exports[_0xaa30('0x27')]=function(_0xc10b8f,_0x6ff09a){var _0x39f708={},_0x1f288c={},_0x43fb30={'count':0x0,'rows':[]};var _0x44aa9b=_[_0xaa30('0x28')](db[_0xaa30('0x29')][_0xaa30('0x2a')],function(_0x40e4ee){return{'name':_0x40e4ee[_0xaa30('0x2b')],'type':_0x40e4ee[_0xaa30('0x2c')][_0xaa30('0x2d')]};});_0x1f288c['model']=_[_0xaa30('0x28')](_0x44aa9b,_0xaa30('0x25'));_0x1f288c[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0xc10b8f[_0xaa30('0x2e')]);_0x1f288c[_0xaa30('0x30')]=_['intersection'](_0x1f288c['model'],_0x1f288c['query']);_0x39f708[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x1f288c[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0xc10b8f[_0xaa30('0x2e')]['fields']));_0x39f708['attributes']=_0x39f708[_0xaa30('0x31')][_0xaa30('0x35')]?_0x39f708['attributes']:_0x1f288c[_0xaa30('0x33')];if(!_0xc10b8f['query'][_0xaa30('0x36')]('nolimit')){_0x39f708[_0xaa30('0x1f')]=qs[_0xaa30('0x1f')](_0xc10b8f['query'][_0xaa30('0x1f')]);_0x39f708[_0xaa30('0x1c')]=qs[_0xaa30('0x1c')](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x1c')]);}_0x39f708[_0xaa30('0x37')]=qs['sort'](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x38')]);_0x39f708['where']=qs[_0xaa30('0x30')](_[_0xaa30('0x39')](_0xc10b8f[_0xaa30('0x2e')],_0x1f288c['filters']),_0x44aa9b);if(_0xc10b8f['query'][_0xaa30('0x3a')]){_0x39f708[_0xaa30('0x3b')]=_[_0xaa30('0x3c')](_0x39f708[_0xaa30('0x3b')],{'$or':_[_0xaa30('0x28')](_0x44aa9b,function(_0x291854){if(_0x291854['type']!=='VIRTUAL'){var _0x120c43={};_0x120c43[_0x291854[_0xaa30('0x25')]]={'$like':'%'+_0xc10b8f[_0xaa30('0x2e')]['filter']+'%'};return _0x120c43;}})});}_0x39f708=_[_0xaa30('0x3c')]({},_0x39f708,_0xc10b8f[_0xaa30('0x3d')]);var _0x8fb95e={'where':_0x39f708[_0xaa30('0x3b')]};return db['DeskField'][_0xaa30('0x1e')](_0x8fb95e)[_0xaa30('0x23')](function(_0x2c5ddb){_0x43fb30[_0xaa30('0x1e')]=_0x2c5ddb;if(_0xc10b8f[_0xaa30('0x2e')]['includeAll']){_0x39f708[_0xaa30('0x3e')]=[{'all':!![]}];}return db[_0xaa30('0x29')][_0xaa30('0x3f')](_0x39f708);})[_0xaa30('0x23')](function(_0x13f08f){_0x43fb30[_0xaa30('0x40')]=_0x13f08f;return _0x43fb30;})[_0xaa30('0x23')](respondWithFilteredResult(_0x6ff09a,_0x39f708))[_0xaa30('0x41')](handleError(_0x6ff09a,null));};exports['show']=function(_0x59ef25,_0x18771d){var _0x4a170a={'raw':!![],'where':{'id':_0x59ef25['params']['id']}},_0x5208f8={};_0x5208f8[_0xaa30('0x33')]=_['keys'](db[_0xaa30('0x29')]['rawAttributes']);_0x5208f8[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0x59ef25[_0xaa30('0x2e')]);_0x5208f8[_0xaa30('0x30')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],_0x5208f8[_0xaa30('0x2e')]);_0x4a170a[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0x59ef25['query'][_0xaa30('0x34')]));_0x4a170a[_0xaa30('0x31')]=_0x4a170a[_0xaa30('0x31')][_0xaa30('0x35')]?_0x4a170a[_0xaa30('0x31')]:_0x5208f8['model'];if(_0x59ef25['query'][_0xaa30('0x42')]){_0x4a170a['include']=[{'all':!![]}];}_0x4a170a=_[_0xaa30('0x3c')]({},_0x4a170a,_0x59ef25[_0xaa30('0x3d')]);return db[_0xaa30('0x29')][_0xaa30('0x43')](_0x4a170a)[_0xaa30('0x23')](handleEntityNotFound(_0x18771d,null))[_0xaa30('0x23')](respondWithResult(_0x18771d,null))[_0xaa30('0x41')](handleError(_0x18771d,null));};exports['create']=function(_0x3cf0bb,_0x6c9da6){return db[_0xaa30('0x29')]['create'](_0x3cf0bb[_0xaa30('0x44')],{})[_0xaa30('0x23')](respondWithResult(_0x6c9da6,0xc9))['catch'](handleError(_0x6c9da6,null));};exports[_0xaa30('0x22')]=function(_0x4a8fcc,_0x25d227){if(_0x4a8fcc['body']['id']){delete _0x4a8fcc['body']['id'];}return db[_0xaa30('0x29')]['find']({'where':{'id':_0x4a8fcc['params']['id']}})[_0xaa30('0x23')](handleEntityNotFound(_0x25d227,null))[_0xaa30('0x23')](saveUpdates(_0x4a8fcc[_0xaa30('0x44')],null))[_0xaa30('0x23')](respondWithResult(_0x25d227,null))[_0xaa30('0x41')](handleError(_0x25d227,null));};exports[_0xaa30('0x45')]=function(_0x5616cd,_0x17d75d){return db[_0xaa30('0x29')][_0xaa30('0x43')]({'where':{'id':_0x5616cd['params']['id']}})['then'](handleEntityNotFound(_0x17d75d,null))['then'](removeEntity(_0x17d75d,null))['catch'](handleError(_0x17d75d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 403844e..dea000b 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 _0xd7b8=['lodash','util','../../config/logger','request-promise','exports','DeskField','int_desk_fields','idField'];(function(_0x66891e,_0x43dc18){var _0x5113bb=function(_0x4ff56c){while(--_0x4ff56c){_0x66891e['push'](_0x66891e['shift']());}};_0x5113bb(++_0x43dc18);}(_0xd7b8,0x108));var _0x8d7b=function(_0x4e6ea8,_0xa9de23){_0x4e6ea8=_0x4e6ea8-0x0;var _0x5b4765=_0xd7b8[_0x4e6ea8];return _0x5b4765;};'use strict';var _=require(_0x8d7b('0x0'));var util=require(_0x8d7b('0x1'));var logger=require(_0x8d7b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8d7b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x8d7b('0x4')]=function(_0x21c754,_0x2a6ed1){return _0x21c754['define'](_0x8d7b('0x5'),attributes,{'tableName':_0x8d7b('0x6'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x8d7b('0x7'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02a2=['exports','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./intDeskField.attributes'];(function(_0x4c89c2,_0x40343e){var _0x175289=function(_0x508d72){while(--_0x508d72){_0x4c89c2['push'](_0x4c89c2['shift']());}};_0x175289(++_0x40343e);}(_0x02a2,0x102));var _0x202a=function(_0x6c8fc3,_0x439e62){_0x6c8fc3=_0x6c8fc3-0x0;var _0x48d628=_0x02a2[_0x6c8fc3];return _0x48d628;};'use strict';var _=require(_0x202a('0x0'));var util=require(_0x202a('0x1'));var logger=require(_0x202a('0x2'))('api');var moment=require(_0x202a('0x3'));var BPromise=require(_0x202a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x202a('0x5'));var rimraf=require('rimraf');var config=require(_0x202a('0x6'));var attributes=require(_0x202a('0x7'));module[_0x202a('0x8')]=function(_0x387573,_0x104f42){return _0x387573[_0x202a('0x9')](_0x202a('0xa'),attributes,{'tableName':_0x202a('0xb'),'paranoid':![],'indexes':[{'name':_0x202a('0xc'),'fields':[_0x202a('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index ed7f81c..fe9ad05 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 _0xdd3e=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment'];(function(_0x7fc8ca,_0x378bb4){var _0x517007=function(_0x4cf712){while(--_0x4cf712){_0x7fc8ca['push'](_0x7fc8ca['shift']());}};_0x517007(++_0x378bb4);}(_0xdd3e,0x18d));var _0xedd3=function(_0x473110,_0x2540a3){_0x473110=_0x473110-0x0;var _0x2b4551=_0xdd3e[_0x473110];return _0x2b4551;};'use strict';var _=require('lodash');var util=require(_0xedd3('0x0'));var moment=require(_0xedd3('0x1'));var BPromise=require(_0xedd3('0x2'));var rs=require(_0xedd3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedd3('0x4'))['db'];var utils=require(_0xedd3('0x5'));var logger=require(_0xedd3('0x6'))(_0xedd3('0x7'));var config=require(_0xedd3('0x8'));var jayson=require(_0xedd3('0x9'));var client=jayson[_0xedd3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eabd4,_0x4140c7,_0x5900e4){return new BPromise(function(_0x15a07c,_0x4e4880){return client['request'](_0x2eabd4,_0x5900e4)[_0xedd3('0xb')](function(_0x5e77fe){logger[_0xedd3('0xc')](_0xedd3('0xd'),_0x4140c7,_0xedd3('0xe'));logger[_0xedd3('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x4140c7,_0xedd3('0xe'),JSON[_0xedd3('0x10')](_0x5e77fe));if(_0x5e77fe[_0xedd3('0x11')]){if(_0x5e77fe[_0xedd3('0x11')]['code']===0x1f4){logger[_0xedd3('0x11')]('DeskField,\x20%s,\x20%s',_0x4140c7,_0x5e77fe[_0xedd3('0x11')][_0xedd3('0x12')]);return _0x4e4880(_0x5e77fe['error'][_0xedd3('0x12')]);}logger['error'](_0xedd3('0xd'),_0x4140c7,_0x5e77fe[_0xedd3('0x11')][_0xedd3('0x12')]);return _0x15a07c(_0x5e77fe[_0xedd3('0x11')][_0xedd3('0x12')]);}else{logger[_0xedd3('0xc')](_0xedd3('0xd'),_0x4140c7,_0xedd3('0xe'));_0x15a07c(_0x5e77fe[_0xedd3('0x13')][_0xedd3('0x12')]);}})[_0xedd3('0x14')](function(_0x4fc3f5){logger[_0xedd3('0x11')](_0xedd3('0xd'),_0x4140c7,_0x4fc3f5);_0x4e4880(_0x4fc3f5);});});} \ No newline at end of file +var _0xbad2=['result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','DeskField,\x20%s,\x20%s','message'];(function(_0x9e689c,_0x2600d8){var _0x13ee00=function(_0x60e5e2){while(--_0x60e5e2){_0x9e689c['push'](_0x9e689c['shift']());}};_0x13ee00(++_0x2600d8);}(_0xbad2,0x113));var _0x2bad=function(_0x290622,_0x322de3){_0x290622=_0x290622-0x0;var _0x211b5d=_0xbad2[_0x290622];return _0x211b5d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2bad('0x0'));var rs=require(_0x2bad('0x1'));var fs=require('fs');var Redis=require(_0x2bad('0x2'));var db=require(_0x2bad('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2bad('0x4'))(_0x2bad('0x5'));var config=require(_0x2bad('0x6'));var jayson=require(_0x2bad('0x7'));var client=jayson[_0x2bad('0x8')][_0x2bad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x350cd8,_0x197fac,_0x290f48){return new BPromise(function(_0xaa7bb6,_0x255301){return client[_0x2bad('0xa')](_0x350cd8,_0x290f48)['then'](function(_0x1cd3f7){logger[_0x2bad('0xb')]('DeskField,\x20%s,\x20%s',_0x197fac,_0x2bad('0xc'));logger[_0x2bad('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x197fac,_0x2bad('0xc'),JSON[_0x2bad('0xe')](_0x1cd3f7));if(_0x1cd3f7['error']){if(_0x1cd3f7[_0x2bad('0xf')][_0x2bad('0x10')]===0x1f4){logger[_0x2bad('0xf')](_0x2bad('0x11'),_0x197fac,_0x1cd3f7[_0x2bad('0xf')][_0x2bad('0x12')]);return _0x255301(_0x1cd3f7[_0x2bad('0xf')]['message']);}logger[_0x2bad('0xf')](_0x2bad('0x11'),_0x197fac,_0x1cd3f7[_0x2bad('0xf')]['message']);return _0xaa7bb6(_0x1cd3f7[_0x2bad('0xf')][_0x2bad('0x12')]);}else{logger['info'](_0x2bad('0x11'),_0x197fac,'request\x20sent');_0xaa7bb6(_0x1cd3f7[_0x2bad('0x13')][_0x2bad('0x12')]);}})[_0x2bad('0x14')](function(_0x432ec6){logger[_0x2bad('0xf')]('DeskField,\x20%s,\x20%s',_0x197fac,_0x432ec6);_0x255301(_0x432ec6);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 13eda59..12b2ec4 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 _0x502b=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','../../components/auth/service','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x502b,0x9f));var _0xb502=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0x502b[_0x2bcb75];return _0x175345;};'use strict';var multer=require(_0xb502('0x0'));var util=require(_0xb502('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb502('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb502('0x3'));router[_0xb502('0x4')]('/',auth[_0xb502('0x5')](),controller[_0xb502('0x6')]);router[_0xb502('0x4')]('/:id',auth[_0xb502('0x5')](),controller[_0xb502('0x7')]);router['get'](_0xb502('0x8'),auth[_0xb502('0x5')](),controller[_0xb502('0x9')]);router[_0xb502('0x4')](_0xb502('0xa'),auth[_0xb502('0x5')](),controller[_0xb502('0xb')]);router[_0xb502('0xc')]('/',auth[_0xb502('0x5')](),controller[_0xb502('0xd')]);router[_0xb502('0xc')](_0xb502('0x8'),auth[_0xb502('0x5')](),controller[_0xb502('0xe')]);router[_0xb502('0xf')](_0xb502('0x10'),auth[_0xb502('0x5')](),controller[_0xb502('0x11')]);router[_0xb502('0x12')](_0xb502('0x10'),auth[_0xb502('0x5')](),controller[_0xb502('0x13')]);module[_0xb502('0x14')]=router; \ No newline at end of file +var _0x74a4=['index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get'];(function(_0x3ebe58,_0x8f5578){var _0x5026dc=function(_0x37df22){while(--_0x37df22){_0x3ebe58['push'](_0x3ebe58['shift']());}};_0x5026dc(++_0x8f5578);}(_0x74a4,0x121));var _0x474a=function(_0x3767a0,_0x3191a4){_0x3767a0=_0x3767a0-0x0;var _0x10d8d1=_0x74a4[_0x3767a0];return _0x10d8d1;};'use strict';var multer=require(_0x474a('0x0'));var util=require(_0x474a('0x1'));var path=require(_0x474a('0x2'));var timeout=require(_0x474a('0x3'));var express=require(_0x474a('0x4'));var router=express['Router']();var fs_extra=require(_0x474a('0x5'));var auth=require(_0x474a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x474a('0x7'));var controller=require(_0x474a('0x8'));router[_0x474a('0x9')]('/',auth['isAuthenticated'](),controller[_0x474a('0xa')]);router['get'](_0x474a('0xb'),auth[_0x474a('0xc')](),controller[_0x474a('0xd')]);router[_0x474a('0x9')](_0x474a('0xe'),auth[_0x474a('0xc')](),controller[_0x474a('0xf')]);router['get'](_0x474a('0x10'),auth[_0x474a('0xc')](),controller['getFields']);router[_0x474a('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x474a('0xe'),auth[_0x474a('0xc')](),controller[_0x474a('0x12')]);router[_0x474a('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x474a('0x14')](_0x474a('0xb'),auth[_0x474a('0xc')](),controller[_0x474a('0x15')]);module[_0x474a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index a1f7d85..586c1ba 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 _0x685a=['exports','STRING'];(function(_0x5a0f7b,_0x36962e){var _0x200648=function(_0x54beed){while(--_0x54beed){_0x5a0f7b['push'](_0x5a0f7b['shift']());}};_0x200648(++_0x36962e);}(_0x685a,0x1c2));var _0xa685=function(_0x236eb8,_0x1b52ef){_0x236eb8=_0x236eb8-0x0;var _0x56ce14=_0x685a[_0x236eb8];return _0x56ce14;};'use strict';var Sequelize=require('sequelize');module[_0xa685('0x0')]={'name':{'type':Sequelize[_0xa685('0x1')]},'username':{'type':Sequelize[_0xa685('0x1')]},'password':{'type':Sequelize[_0xa685('0x1')]},'remoteUri':{'type':Sequelize[_0xa685('0x1')]},'tenantId':{'type':Sequelize[_0xa685('0x1')]},'clientId':{'type':Sequelize[_0xa685('0x1')]},'clientSecret':{'type':Sequelize[_0xa685('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa685('0x1')]}}; \ No newline at end of file +var _0x0eb2=['STRING'];(function(_0x5e913f,_0x265fc0){var _0x472cc4=function(_0x49df8d){while(--_0x49df8d){_0x5e913f['push'](_0x5e913f['shift']());}};_0x472cc4(++_0x265fc0);}(_0x0eb2,0x88));var _0x20eb=function(_0x284521,_0x51faaa){_0x284521=_0x284521-0x0;var _0x524a84=_0x0eb2[_0x284521];return _0x524a84;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x20eb('0x0')]},'username':{'type':Sequelize[_0x20eb('0x0')]},'password':{'type':Sequelize[_0x20eb('0x0')]},'remoteUri':{'type':Sequelize[_0x20eb('0x0')]},'tenantId':{'type':Sequelize[_0x20eb('0x0')]},'clientId':{'type':Sequelize[_0x20eb('0x0')]},'clientSecret':{'type':Sequelize[_0x20eb('0x0')]},'serverUrl':{'type':Sequelize[_0x20eb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x20eb('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 8514f8f..e09930b 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 _0x649e=['Options','Label','UserLocalizedLabel','LogicalName','true','FalseOption','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','stack','name','send','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','params','options','create','body','destroy','find','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId','GET','EntityDefinitions(','Attributes','remove','includes','forEach','@odata.type','all','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','OptionSet'];(function(_0x2aa0d7,_0x4e366e){var _0x2de4f1=function(_0x341bad){while(--_0x341bad){_0x2aa0d7['push'](_0x2aa0d7['shift']());}};_0x2de4f1(++_0x4e366e);}(_0x649e,0x1b7));var _0xe649=function(_0x4b0adc,_0x1363b2){_0x4b0adc=_0x4b0adc-0x0;var _0x3d112d=_0x649e[_0x4b0adc];return _0x3d112d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe649('0x0'));var jsonpatch=require(_0xe649('0x1'));var rp=require(_0xe649('0x2'));var moment=require('moment');var BPromise=require(_0xe649('0x3'));var Mustache=require(_0xe649('0x4'));var util=require(_0xe649('0x5'));var path=require(_0xe649('0x6'));var sox=require(_0xe649('0x7'));var csv=require(_0xe649('0x8'));var ejs=require(_0xe649('0x9'));var fs=require('fs');var fs_extra=require(_0xe649('0xa'));var _=require(_0xe649('0xb'));var squel=require(_0xe649('0xc'));var crypto=require(_0xe649('0xd'));var jsforce=require(_0xe649('0xe'));var deskjs=require(_0xe649('0xf'));var toCsv=require(_0xe649('0x8'));var querystring=require(_0xe649('0x10'));var Papa=require('papaparse');var Redis=require(_0xe649('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe649('0x12'));var hardwareService=require(_0xe649('0x13'));var logger=require(_0xe649('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xe649('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe649('0x16'))['db'];var integrations=require(_0xe649('0x17'));var jayson=require(_0xe649('0x18'));var client=jayson[_0xe649('0x19')][_0xe649('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x249590,_0x2a723b,_0xbce6cd,_0x102004){return new BPromise(function(_0x2298c3,_0x2f6865){var _0xd1c5a9=_0x102004||client;return _0xd1c5a9[_0xe649('0x1b')](_0x249590,_0xbce6cd)[_0xe649('0x1c')](function(_0x21fd47){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x2a723b,_0xe649('0x1d'));logger[_0xe649('0x1e')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x2a723b,_0xe649('0x1d'),JSON[_0xe649('0x1f')](_0x21fd47));if(_0x21fd47['error']){if(_0x21fd47['error']['code']===0x1f4){logger[_0xe649('0x20')](_0xe649('0x21'),_0x2a723b,_0x21fd47[_0xe649('0x20')][_0xe649('0x22')]);return _0x2f6865(_0x21fd47[_0xe649('0x20')][_0xe649('0x22')]);}logger['error'](_0xe649('0x21'),_0x2a723b,_0x21fd47['error']['message']);return _0x2298c3(_0x21fd47[_0xe649('0x20')][_0xe649('0x22')]);}else{logger['info'](_0xe649('0x21'),_0x2a723b,_0xe649('0x1d'));_0x2298c3(_0x21fd47[_0xe649('0x23')]['message']);}})[_0xe649('0x24')](function(_0x3faf6b){logger[_0xe649('0x20')](_0xe649('0x21'),_0x2a723b,_0x3faf6b);_0x2f6865(_0x3faf6b);});});}function respondWithStatusCode(_0x61fb2f,_0x556230){_0x556230=_0x556230||0xcc;return function(_0x55f399){if(_0x55f399){return _0x61fb2f[_0xe649('0x25')](_0x556230);}return _0x61fb2f[_0xe649('0x26')](_0x556230)[_0xe649('0x27')]();};}function respondWithResult(_0xe0ac65,_0x1ec938){_0x1ec938=_0x1ec938||0xc8;return function(_0x4692de){if(_0x4692de){return _0xe0ac65[_0xe649('0x26')](_0x1ec938)['json'](_0x4692de);}};}function respondWithFilteredResult(_0x9dda16,_0x21d524){return function(_0x232c98){if(_0x232c98){var _0x343295=typeof _0x21d524[_0xe649('0x28')]===_0xe649('0x29')&&typeof _0x21d524[_0xe649('0x2a')]===_0xe649('0x29');var _0x1955e3=_0x232c98['count'];var _0x40e735=_0x343295?0x0:_0x21d524[_0xe649('0x28')];var _0x5b5bcf=_0x343295?_0x232c98[_0xe649('0x2b')]:_0x21d524['offset']+_0x21d524['limit'];var _0x464245;if(_0x5b5bcf>=_0x1955e3){_0x5b5bcf=_0x1955e3;_0x464245=0xc8;}else{_0x464245=0xce;}_0x9dda16[_0xe649('0x26')](_0x464245);return _0x9dda16['set'](_0xe649('0x2c'),_0x40e735+'-'+_0x5b5bcf+'/'+_0x1955e3)[_0xe649('0x2d')](_0x232c98);}return null;};}function patchUpdates(_0x390db0){return function(_0x1eda3f){try{jsonpatch['apply'](_0x1eda3f,_0x390db0,!![]);}catch(_0x11c8c6){return BPromise[_0xe649('0x2e')](_0x11c8c6);}return _0x1eda3f[_0xe649('0x2f')]();};}function saveUpdates(_0x14a7c5,_0x5b89d5){return function(_0x5766ee){if(_0x5766ee){return _0x5766ee[_0xe649('0x30')](_0x14a7c5)[_0xe649('0x1c')](function(_0x42d039){return _0x42d039;});}return null;};}function removeEntity(_0xfc7848,_0x1b423e){return function(_0x3ea760){if(_0x3ea760){return _0x3ea760['destroy']()[_0xe649('0x1c')](function(){_0xfc7848[_0xe649('0x26')](0xcc)[_0xe649('0x27')]();});}};}function handleEntityNotFound(_0x10a04d,_0xd4da50){return function(_0x168a79){if(!_0x168a79){_0x10a04d[_0xe649('0x25')](0x194);}return _0x168a79;};}function handleError(_0x39c8a6,_0x3d0677){_0x3d0677=_0x3d0677||0x1f4;return function(_0x4ed3d5){logger[_0xe649('0x20')](_0x4ed3d5[_0xe649('0x31')]);if(_0x4ed3d5[_0xe649('0x32')]){delete _0x4ed3d5[_0xe649('0x32')];}_0x39c8a6['status'](_0x3d0677)[_0xe649('0x33')](_0x4ed3d5);};}exports['index']=function(_0x244951,_0x3483c4){var _0x5c3824={},_0x34600a={},_0x89c00c={'count':0x0,'rows':[]};var _0x17301f=_['map'](db[_0xe649('0x34')][_0xe649('0x35')],function(_0x17563){return{'name':_0x17563[_0xe649('0x36')],'type':_0x17563[_0xe649('0x37')][_0xe649('0x38')]};});_0x34600a[_0xe649('0x39')]=_[_0xe649('0x3a')](_0x17301f,_0xe649('0x32'));_0x34600a[_0xe649('0x3b')]=_[_0xe649('0x3c')](_0x244951[_0xe649('0x3b')]);_0x34600a[_0xe649('0x3d')]=_['intersection'](_0x34600a[_0xe649('0x39')],_0x34600a[_0xe649('0x3b')]);_0x5c3824[_0xe649('0x3e')]=_[_0xe649('0x3f')](_0x34600a['model'],qs[_0xe649('0x40')](_0x244951['query']['fields']));_0x5c3824[_0xe649('0x3e')]=_0x5c3824[_0xe649('0x3e')][_0xe649('0x41')]?_0x5c3824[_0xe649('0x3e')]:_0x34600a['model'];if(!_0x244951[_0xe649('0x3b')][_0xe649('0x42')]('nolimit')){_0x5c3824[_0xe649('0x2a')]=qs[_0xe649('0x2a')](_0x244951[_0xe649('0x3b')][_0xe649('0x2a')]);_0x5c3824[_0xe649('0x28')]=qs[_0xe649('0x28')](_0x244951[_0xe649('0x3b')][_0xe649('0x28')]);}_0x5c3824[_0xe649('0x43')]=qs[_0xe649('0x44')](_0x244951['query'][_0xe649('0x44')]);_0x5c3824['where']=qs[_0xe649('0x3d')](_[_0xe649('0x45')](_0x244951[_0xe649('0x3b')],_0x34600a[_0xe649('0x3d')]),_0x17301f);if(_0x244951['query'][_0xe649('0x46')]){_0x5c3824[_0xe649('0x47')]=_['merge'](_0x5c3824[_0xe649('0x47')],{'$or':_[_0xe649('0x3a')](_0x17301f,function(_0x26f198){if(_0x26f198[_0xe649('0x37')]!==_0xe649('0x48')){var _0x155f52={};_0x155f52[_0x26f198[_0xe649('0x32')]]={'$like':'%'+_0x244951[_0xe649('0x3b')][_0xe649('0x46')]+'%'};return _0x155f52;}})});}_0x5c3824=_[_0xe649('0x49')]({},_0x5c3824,_0x244951['options']);var _0x4ae2b4={'where':_0x5c3824[_0xe649('0x47')]};return db[_0xe649('0x34')]['count'](_0x4ae2b4)[_0xe649('0x1c')](function(_0xe82da4){_0x89c00c[_0xe649('0x2b')]=_0xe82da4;if(_0x244951[_0xe649('0x3b')][_0xe649('0x4a')]){_0x5c3824[_0xe649('0x4b')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xe649('0x4c')](_0x5c3824);})[_0xe649('0x1c')](function(_0xfb6f9c){_0x89c00c[_0xe649('0x4d')]=_0xfb6f9c;return _0x89c00c;})[_0xe649('0x1c')](respondWithFilteredResult(_0x3483c4,_0x5c3824))[_0xe649('0x24')](handleError(_0x3483c4,null));};exports['show']=function(_0x26142c,_0x150efc){var _0x438d59={'raw':![],'where':{'id':_0x26142c[_0xe649('0x4e')]['id']}},_0xaf88e3={};_0xaf88e3['model']=_['keys'](db['Dynamics365Account']['rawAttributes']);_0xaf88e3['query']=_[_0xe649('0x3c')](_0x26142c['query']);_0xaf88e3[_0xe649('0x3d')]=_[_0xe649('0x3f')](_0xaf88e3['model'],_0xaf88e3[_0xe649('0x3b')]);_0x438d59[_0xe649('0x3e')]=_[_0xe649('0x3f')](_0xaf88e3[_0xe649('0x39')],qs[_0xe649('0x40')](_0x26142c[_0xe649('0x3b')][_0xe649('0x40')]));_0x438d59[_0xe649('0x3e')]=_0x438d59[_0xe649('0x3e')]['length']?_0x438d59[_0xe649('0x3e')]:_0xaf88e3[_0xe649('0x39')];if(_0x26142c['query'][_0xe649('0x4a')]){_0x438d59[_0xe649('0x4b')]=[{'all':!![]}];}_0x438d59=_['merge']({},_0x438d59,_0x26142c[_0xe649('0x4f')]);return db[_0xe649('0x34')]['find'](_0x438d59)[_0xe649('0x1c')](handleEntityNotFound(_0x150efc,null))[_0xe649('0x1c')](respondWithResult(_0x150efc,null))[_0xe649('0x24')](handleError(_0x150efc,null));};exports[_0xe649('0x50')]=function(_0x3a474d,_0x1d7929){return db['Dynamics365Account'][_0xe649('0x50')](_0x3a474d[_0xe649('0x51')],{})[_0xe649('0x1c')](respondWithResult(_0x1d7929,0xc9))['catch'](handleError(_0x1d7929,null));};exports['update']=function(_0xfab665,_0x2c8114){if(_0xfab665[_0xe649('0x51')]['id']){delete _0xfab665[_0xe649('0x51')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0xfab665['params']['id']}})[_0xe649('0x1c')](handleEntityNotFound(_0x2c8114,null))['then'](saveUpdates(_0xfab665['body'],null))[_0xe649('0x1c')](respondWithResult(_0x2c8114,null))[_0xe649('0x24')](handleError(_0x2c8114,null));};exports[_0xe649('0x52')]=function(_0x1995b5,_0x16c0f8){return db['Dynamics365Account'][_0xe649('0x53')]({'where':{'id':_0x1995b5[_0xe649('0x4e')]['id']}})[_0xe649('0x1c')](handleEntityNotFound(_0x16c0f8,null))['then'](removeEntity(_0x16c0f8,null))[_0xe649('0x24')](handleError(_0x16c0f8,null));};exports[_0xe649('0x54')]=function(_0x1cdfcd,_0x17edb3,_0x481dbe){var _0x7e6173={};var _0x5e8e3a={};var _0x4d6509;var _0x27f041;return db[_0xe649('0x34')][_0xe649('0x55')]({'where':{'id':_0x1cdfcd[_0xe649('0x4e')]['id']}})['then'](handleEntityNotFound(_0x17edb3,null))[_0xe649('0x1c')](function(_0x3a6de9){if(_0x3a6de9){_0x4d6509=_0x3a6de9;_0x5e8e3a[_0xe649('0x39')]=_['keys'](db[_0xe649('0x56')][_0xe649('0x35')]);_0x5e8e3a[_0xe649('0x3b')]=_[_0xe649('0x3c')](_0x1cdfcd['query']);_0x5e8e3a[_0xe649('0x3d')]=_[_0xe649('0x3f')](_0x5e8e3a['model'],_0x5e8e3a['query']);_0x7e6173[_0xe649('0x3e')]=_[_0xe649('0x3f')](_0x5e8e3a[_0xe649('0x39')],qs['fields'](_0x1cdfcd[_0xe649('0x3b')][_0xe649('0x40')]));_0x7e6173[_0xe649('0x3e')]=_0x7e6173[_0xe649('0x3e')][_0xe649('0x41')]?_0x7e6173[_0xe649('0x3e')]:_0x5e8e3a[_0xe649('0x39')];_0x7e6173[_0xe649('0x43')]=qs[_0xe649('0x44')](_0x1cdfcd[_0xe649('0x3b')]['sort']);_0x7e6173['where']=qs[_0xe649('0x3d')](_['pick'](_0x1cdfcd[_0xe649('0x3b')],_0x5e8e3a[_0xe649('0x3d')]));if(_0x1cdfcd[_0xe649('0x3b')][_0xe649('0x46')]){_0x7e6173[_0xe649('0x47')]=_['merge'](_0x7e6173['where'],{'$or':_[_0xe649('0x3a')](_0x7e6173['attributes'],function(_0x178c51){var _0x59b1b9={};_0x59b1b9[_0x178c51]={'$like':'%'+_0x1cdfcd[_0xe649('0x3b')][_0xe649('0x46')]+'%'};return _0x59b1b9;})});}_0x7e6173=_[_0xe649('0x49')]({},_0x7e6173,_0x1cdfcd['options']);return _0x4d6509[_0xe649('0x54')](_0x7e6173);}})[_0xe649('0x1c')](function(_0x1a2e20){if(_0x1a2e20){_0x27f041=_0x1a2e20[_0xe649('0x41')];if(!_0x1cdfcd[_0xe649('0x3b')][_0xe649('0x42')](_0xe649('0x57'))){_0x7e6173[_0xe649('0x2a')]=qs[_0xe649('0x2a')](_0x1cdfcd['query'][_0xe649('0x2a')]);_0x7e6173['offset']=qs[_0xe649('0x28')](_0x1cdfcd[_0xe649('0x3b')][_0xe649('0x28')]);}return _0x4d6509['getConfigurations'](_0x7e6173);}})[_0xe649('0x1c')](function(_0x1b0ba3){if(_0x1b0ba3){return _0x1b0ba3?{'count':_0x27f041,'rows':_0x1b0ba3}:null;}})['then'](respondWithResult(_0x17edb3,null))[_0xe649('0x24')](handleError(_0x17edb3,null));};exports[_0xe649('0x58')]=function(_0xf1d228,_0x28aef6,_0x14cf21){if(_0xf1d228[_0xe649('0x51')]['id']){delete _0xf1d228[_0xe649('0x51')]['id'];}return db[_0xe649('0x34')][_0xe649('0x55')]({'where':{'id':_0xf1d228[_0xe649('0x4e')]['id']}})[_0xe649('0x1c')](handleEntityNotFound(_0x28aef6,null))[_0xe649('0x1c')](function(_0x2ecbf5){if(_0x2ecbf5){_0xf1d228[_0xe649('0x51')][_0xe649('0x59')]=_0x2ecbf5['id'];_0xf1d228[_0xe649('0x51')][_0xe649('0x5a')]=integrations[_0xe649('0x5b')](_0xf1d228[_0xe649('0x51')]['channel'],_0xf1d228[_0xe649('0x51')][_0xe649('0x37')]);_0xf1d228[_0xe649('0x51')][_0xe649('0x5c')]=integrations[_0xe649('0x5d')](_0xf1d228['body'][_0xe649('0x5e')],_0xf1d228[_0xe649('0x51')][_0xe649('0x37')]);return db[_0xe649('0x56')][_0xe649('0x50')](_0xf1d228[_0xe649('0x51')],{'include':[{'model':db[_0xe649('0x5f')],'as':'Subjects'},{'model':db[_0xe649('0x5f')],'as':_0xe649('0x5c')}]});}return null;})[_0xe649('0x1c')](respondWithResult(_0x28aef6,null))[_0xe649('0x24')](handleError(_0x28aef6,null));};exports[_0xe649('0x60')]=function(_0x2f2f6f,_0x40cc66,_0x5621a7){var _0x148ed1=_0x2f2f6f['query'][_0xe649('0x61')];var _0x45d8d5=_0x148ed1===_0xe649('0x62')?_0xe649('0x63'):_0xe649('0x64');var _0x44a590='';var _0x5dfe14='';var _0x252399='';var _0xf3b8b0='';var _0x4b024c='';var _0x17f59='';var _0x3a11b9='';var _0x5a2051='';var _0x442e9b=['title',_0xe649('0x65'),_0xe649('0x66'),_0xe649('0x67'),_0xe649('0x68'),_0xe649('0x69'),_0xe649('0x6a'),_0xe649('0x6b'),_0xe649('0x6c'),_0xe649('0x6d')];var _0xc63fd5=[_0xe649('0x6e'),_0xe649('0x6f'),_0xe649('0x70'),_0xe649('0x71'),_0xe649('0x72'),_0xe649('0x73'),_0xe649('0x74'),_0xe649('0x75'),_0xe649('0x76'),'createdbyexternalpartyyominame',_0xe649('0x77'),'createdbyyominame',_0xe649('0x78'),_0xe649('0x79'),_0xe649('0x7a'),_0xe649('0x7b'),'customeridtype',_0xe649('0x7c'),_0xe649('0x7d'),_0xe649('0x7e'),_0xe649('0x7f'),_0xe649('0x80'),_0xe649('0x81'),_0xe649('0x82'),_0xe649('0x83'),_0xe649('0x84'),_0xe649('0x85'),_0xe649('0x86'),'kbarticleidname',_0xe649('0x87'),'masteridname',_0xe649('0x88'),'modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame',_0xe649('0x89'),_0xe649('0x8a'),_0xe649('0x8b'),_0xe649('0x8c'),_0xe649('0x8d'),_0xe649('0x8e'),_0xe649('0x8f'),_0xe649('0x90'),'owneridname','owneridtype',_0xe649('0x91'),_0xe649('0x92'),_0xe649('0x93'),_0xe649('0x94'),'prioritycodename','productidname',_0xe649('0x95'),_0xe649('0x96'),_0xe649('0x97'),_0xe649('0x98'),_0xe649('0x99'),'responsiblecontactidyominame','sentimentvalue',_0xe649('0x9a'),_0xe649('0x9b'),_0xe649('0x9c'),_0xe649('0x9d'),_0xe649('0x9e'),'subjectidname',_0xe649('0x9f'),_0xe649('0xa0'),_0xe649('0xa1'),'traversedpath','utcconversiontimezonecode',_0xe649('0xa2')];var _0x182de3=_0x442e9b[_0xe649('0xa3')](_0xc63fd5);return db['Dynamics365Account'][_0xe649('0x55')]({'where':{'id':_0x2f2f6f['params']['id']},'attributes':['id',_0xe649('0xa4'),_0xe649('0xa5'),_0xe649('0xa6'),_0xe649('0xa7'),_0xe649('0xa8'),_0xe649('0xa9')]})[_0xe649('0x1c')](handleEntityNotFound(_0x40cc66,null))[_0xe649('0x1c')](function(_0x4deb5f){if(_0x4deb5f){_0x5a2051=_0x4deb5f['remoteUri'];var _0x26e413=_0x5a2051['slice'](-0x1);if(_0x26e413==='/'){_0x5a2051=_0x5a2051[_0xe649('0xaa')](0x0,_0x5a2051[_0xe649('0xab')](_0x26e413));}_0x3a11b9=util['format'](_0xe649('0xac'),_0x5a2051);var _0x50c106={'method':_0xe649('0xad'),'uri':_0xe649('0xae')+_0x4deb5f[_0xe649('0xa7')]+_0xe649('0xaf'),'form':{'client_id':_0x4deb5f['clientId'],'resource':_0x5a2051,'username':_0x4deb5f[_0xe649('0xa4')],'password':_0x4deb5f[_0xe649('0xa5')],'grant_type':_0xe649('0xa5'),'client_secret':_0x4deb5f[_0xe649('0xa9')]},'json':!![]};return rp(_0x50c106);}})['then'](function(_0x523d49){_0x17f59=_0x523d49[_0xe649('0xb0')];var _0x1274fd={'method':'GET','uri':encodeURI(_0x3a11b9+_0xe649('0xb1')+_0x45d8d5+'\x27'),'headers':{'Authorization':_0xe649('0xb2')+_0x17f59,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1274fd);})[_0xe649('0x1c')](function(_0x199704){var _0x29a231=_0x199704['value'][0x0];var _0x320fb3=_0x29a231[_0xe649('0xb3')];var _0x5511ea={'method':_0xe649('0xb4'),'uri':_0x3a11b9+_0xe649('0xb5')+_0x320fb3+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xe649('0xb2')+_0x17f59,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5511ea);})[_0xe649('0x1c')](function(_0x1adbad){_0x44a590=_0x1adbad;_0x5dfe14=_0x44a590[_0xe649('0xb6')];_0x5dfe14=_[_0xe649('0xb7')](_0x5dfe14,function(_0x554d4d){return!_0x182de3[_0xe649('0xb8')](_0x554d4d['LogicalName']);});var _0x32d600=[];var _0xfc2303=[];_0x5dfe14[_0xe649('0xb9')](function(_0x4afcaf){if(_0x4afcaf[_0xe649('0xba')]){var _0x32aa17=_0x4afcaf[_0xe649('0xba')][_0xe649('0xaa')](_0x4afcaf['@odata.type'][_0xe649('0xab')]('.')+0x1);if(_0x32aa17==='PicklistAttributeMetadata'){_0x32d600['push'](getSelectList(_0x3a11b9,_0x148ed1,_0xfc2303,_0x44a590[_0xe649('0xb3')],_0x4afcaf[_0xe649('0xb3')],_0x17f59));}}});return Promise[_0xe649('0xbb')](_0x32d600);})['then'](function(_0x184da5){_0x252399=_0x184da5[0x0];var _0x22ede8=[];var _0x24e0e0=[];_0x5dfe14['forEach'](function(_0x1d6f16){if(!_['isNil'](_0x1d6f16[_0xe649('0xba')])){var _0x137183=_0x1d6f16[_0xe649('0xba')][_0xe649('0xaa')](_0x1d6f16['@odata.type'][_0xe649('0xab')]('.')+0x1);if(_0x137183==='BooleanAttributeMetadata'){_0x22ede8[_0xe649('0xbc')](getBooleanList(_0x3a11b9,_0x148ed1,_0x24e0e0,_0x44a590[_0xe649('0xb3')],_0x1d6f16[_0xe649('0xb3')],_0x17f59));}}});return Promise[_0xe649('0xbb')](_0x22ede8);})[_0xe649('0x1c')](function(_0x4c07fd){_0xf3b8b0=_0x4c07fd[0x0];var _0x31c8d8=[];var _0x5d9a65=[];_0x5dfe14[_0xe649('0xb9')](function(_0x2c0708){if(_0x2c0708[_0xe649('0xba')]){var _0x4b9246=_0x2c0708[_0xe649('0xba')][_0xe649('0xaa')](_0x2c0708[_0xe649('0xba')][_0xe649('0xab')]('.')+0x1);if(_0x4b9246===_0xe649('0xbd')||_0x4b9246===_0xe649('0xbe')||_0x4b9246===_0xe649('0xbf')||_0x4b9246===_0xe649('0xc0')||_0x4b9246===_0xe649('0xc1')||_0x4b9246===_0xe649('0xc2')||_0x4b9246===_0xe649('0xc3')||_0x4b9246===_0xe649('0xc4')||_0x4b9246==='StateAttributeMetadata'||_0x4b9246===_0xe649('0xc5')){_0x31c8d8['push'](getInputList(_0x3a11b9,_0x148ed1,_0x4b9246,_0x5d9a65,_0x44a590[_0xe649('0xb3')],_0x2c0708[_0xe649('0xb3')],_0x17f59));}}});return Promise[_0xe649('0xbb')](_0x31c8d8);})[_0xe649('0x1c')](function(_0xe9f671){_0x4b024c=_0xe9f671[0x0];var _0x3d36b1=_0x252399['concat'](_0xf3b8b0)[_0xe649('0xa3')](_0x4b024c);var _0x4aeacf={'count':_0x3d36b1['length'],'rows':_0x3d36b1};return _0x4aeacf;})[_0xe649('0x1c')](respondWithResult(_0x40cc66,null))[_0xe649('0x24')](function(_0x369738){var _0x439dac=_0x2f2f6f[_0xe649('0x3b')][_0xe649('0xc6')]?0x1f4:_0x369738[_0xe649('0xc7')]||0x1f4;logger[_0xe649('0x20')](_0x369738[_0xe649('0x31')]);delete _0x369738[_0xe649('0x32')];if(_0x439dac===0x191){_0x439dac=0x190;}_0x40cc66[_0xe649('0x26')](_0x439dac)[_0xe649('0x33')](_0x2f2f6f['query'][_0xe649('0xc6')]?{'message':_0xe649('0xc8'),'statusCode':_0x369738['statusCode']}:_0x369738);});};function getSelectList(_0x1ca7b1,_0xf29ba1,_0x13e5dd,_0x2d28d4,_0x4715cb,_0x21dd82){var _0x51e9d9={'method':_0xe649('0xb4'),'uri':_0x1ca7b1+_0xe649('0xb5')+_0x2d28d4+_0xe649('0xc9')+_0x4715cb+_0xe649('0xca')+_0xe649('0xcb'),'headers':{'Authorization':_0xe649('0xb2')+_0x21dd82,'If-None-Match':null,'OData-Version':_0xe649('0xcc')},'json':!![]};return rp(_0x51e9d9)[_0xe649('0x1c')](function(_0x5d7e78){var _0x2a4593=[];var _0x3385d1=_0x5d7e78[_0xe649('0xcd')][_0xe649('0xce')];_0x3385d1[_0xe649('0xb9')](function(_0xaf4314){_0x2a4593[_0xe649('0xbc')]({'name':_0xaf4314[_0xe649('0xcf')][_0xe649('0xd0')][_0xe649('0xcf')],'value':String(_0xaf4314['Value'])});});var _0x48f197={'id':_0xf29ba1+'_'+_0x5d7e78[_0xe649('0xd1')],'name':_0x5d7e78['DisplayName'][_0xe649('0xd0')][_0xe649('0xcf')],'custom':![],'options':_0x2a4593};_0x13e5dd[_0xe649('0xbc')](_0x48f197);return _0x13e5dd;});}function getBooleanList(_0x24ec6d,_0x36f06e,_0xdb7fc3,_0x523699,_0xdc9781,_0x3a3886){var _0x437e7a={'method':_0xe649('0xb4'),'uri':_0x24ec6d+_0xe649('0xb5')+_0x523699+_0xe649('0xc9')+_0xdc9781+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xe649('0xb2')+_0x3a3886,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x437e7a)[_0xe649('0x1c')](function(_0x108060){var _0x2308bb=[];_0x2308bb[_0xe649('0xbc')]({'name':_0x108060[_0xe649('0xcd')]['TrueOption']['Label'][_0xe649('0xd0')][_0xe649('0xcf')],'value':_0xe649('0xd2')},{'name':_0x108060['OptionSet'][_0xe649('0xd3')]['Label']['UserLocalizedLabel'][_0xe649('0xcf')],'value':'false'});var _0x54f34f={'id':_0x36f06e+'_'+_0x108060['LogicalName'],'name':_0x108060[_0xe649('0xd4')][_0xe649('0xd0')][_0xe649('0xcf')],'custom':![],'options':_0x2308bb};_0xdb7fc3[_0xe649('0xbc')](_0x54f34f);return _0xdb7fc3;});}function getInputList(_0x25a082,_0x5b5544,_0x3781d7,_0x112d7b,_0x1f4cfd,_0x53be43,_0x3e890a){var _0x485bdf={'method':_0xe649('0xb4'),'uri':_0x25a082+'EntityDefinitions('+_0x1f4cfd+_0xe649('0xc9')+_0x53be43+_0xe649('0xd5')+_0x3781d7+_0xe649('0xd6'),'headers':{'Authorization':_0xe649('0xb2')+_0x3e890a,'If-None-Match':null,'OData-Version':_0xe649('0xcc')},'json':!![]};return rp(_0x485bdf)[_0xe649('0x1c')](function(_0x271737){var _0x4183c9={'id':_0x5b5544+'_'+_0x271737['LogicalName'],'name':_0x271737['DisplayName'][_0xe649('0xd0')]?_0x271737['DisplayName'][_0xe649('0xd0')][_0xe649('0xcf')]:_0x271737['LogicalName'],'custom':![],'options':[]};_0x112d7b[_0xe649('0xbc')](_0x4183c9);return _0x112d7b;});} \ No newline at end of file +var _0x8547=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','Dynamics365Account','includeAll','findAll','rows','params','fields','length','include','find','body','getConfigurations','findOne','Dynamics365Configuration','order','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','Dynamics365Field','getFields','ticketType','Incident','PhoneCall','title','customerid','ownerid','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridyominame','emailaddress','entitlementidname','entityimage_url','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','versionnumber','concat','username','password','clientSecret','remoteUri','substring','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','@odata.type','lastIndexOf','push','forEach','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','GET',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Value','DisplayName','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','UserLocalizedLabel','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x5d808e,_0x3787c2){var _0x4f2740=function(_0x3e431f){while(--_0x3e431f){_0x5d808e['push'](_0x5d808e['shift']());}};_0x4f2740(++_0x3787c2);}(_0x8547,0x1a2));var _0x7854=function(_0x261c40,_0x327cec){_0x261c40=_0x261c40-0x0;var _0x345cab=_0x8547[_0x261c40];return _0x345cab;};'use strict';var emlformat=require(_0x7854('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7854('0x1'));var rp=require('request-promise');var moment=require(_0x7854('0x2'));var BPromise=require(_0x7854('0x3'));var Mustache=require(_0x7854('0x4'));var util=require('util');var path=require(_0x7854('0x5'));var sox=require(_0x7854('0x6'));var csv=require(_0x7854('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7854('0x8'));var squel=require(_0x7854('0x9'));var crypto=require(_0x7854('0xa'));var jsforce=require(_0x7854('0xb'));var deskjs=require(_0x7854('0xc'));var toCsv=require(_0x7854('0x7'));var querystring=require(_0x7854('0xd'));var Papa=require(_0x7854('0xe'));var Redis=require(_0x7854('0xf'));var authService=require(_0x7854('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7854('0x11'));var hardwareService=require(_0x7854('0x12'));var logger=require(_0x7854('0x13'))(_0x7854('0x14'));var utils=require(_0x7854('0x15'));var config=require(_0x7854('0x16'));var licenseUtil=require(_0x7854('0x17'));var db=require(_0x7854('0x18'))['db'];var integrations=require(_0x7854('0x19'));var jayson=require(_0x7854('0x1a'));var client=jayson[_0x7854('0x1b')][_0x7854('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2515e4,_0x4b7ea4,_0x532dde,_0x5263b9){return new BPromise(function(_0x4b6a76,_0x215f06){var _0x5cc0fe=_0x5263b9||client;return _0x5cc0fe[_0x7854('0x1d')](_0x2515e4,_0x532dde)[_0x7854('0x1e')](function(_0x164170){logger[_0x7854('0x1f')](_0x7854('0x20'),_0x4b7ea4,_0x7854('0x21'));logger[_0x7854('0x22')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4b7ea4,_0x7854('0x21'),JSON['stringify'](_0x164170));if(_0x164170[_0x7854('0x23')]){if(_0x164170[_0x7854('0x23')][_0x7854('0x24')]===0x1f4){logger[_0x7854('0x23')](_0x7854('0x20'),_0x4b7ea4,_0x164170[_0x7854('0x23')][_0x7854('0x25')]);return _0x215f06(_0x164170[_0x7854('0x23')][_0x7854('0x25')]);}logger[_0x7854('0x23')](_0x7854('0x20'),_0x4b7ea4,_0x164170['error'][_0x7854('0x25')]);return _0x4b6a76(_0x164170['error'][_0x7854('0x25')]);}else{logger[_0x7854('0x1f')](_0x7854('0x20'),_0x4b7ea4,_0x7854('0x21'));_0x4b6a76(_0x164170[_0x7854('0x26')][_0x7854('0x25')]);}})[_0x7854('0x27')](function(_0x3b3f1a){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4b7ea4,_0x3b3f1a);_0x215f06(_0x3b3f1a);});});}function respondWithStatusCode(_0x1ff234,_0x2271a2){_0x2271a2=_0x2271a2||0xcc;return function(_0x2813a5){if(_0x2813a5){return _0x1ff234[_0x7854('0x28')](_0x2271a2);}return _0x1ff234[_0x7854('0x29')](_0x2271a2)[_0x7854('0x2a')]();};}function respondWithResult(_0x1d0ffb,_0x39e2e3){_0x39e2e3=_0x39e2e3||0xc8;return function(_0x47266a){if(_0x47266a){return _0x1d0ffb[_0x7854('0x29')](_0x39e2e3)[_0x7854('0x2b')](_0x47266a);}};}function respondWithFilteredResult(_0x44a865,_0x2b6226){return function(_0x3c0cb0){if(_0x3c0cb0){var _0x127f88=typeof _0x2b6226[_0x7854('0x2c')]===_0x7854('0x2d')&&typeof _0x2b6226[_0x7854('0x2e')]===_0x7854('0x2d');var _0x42e66f=_0x3c0cb0[_0x7854('0x2f')];var _0x15af47=_0x127f88?0x0:_0x2b6226[_0x7854('0x2c')];var _0x3866cb=_0x127f88?_0x3c0cb0['count']:_0x2b6226['offset']+_0x2b6226[_0x7854('0x2e')];var _0x1fa368;if(_0x3866cb>=_0x42e66f){_0x3866cb=_0x42e66f;_0x1fa368=0xc8;}else{_0x1fa368=0xce;}_0x44a865['status'](_0x1fa368);return _0x44a865[_0x7854('0x30')](_0x7854('0x31'),_0x15af47+'-'+_0x3866cb+'/'+_0x42e66f)['json'](_0x3c0cb0);}return null;};}function patchUpdates(_0x239e13){return function(_0x359c20){try{jsonpatch[_0x7854('0x32')](_0x359c20,_0x239e13,!![]);}catch(_0xaa833d){return BPromise[_0x7854('0x33')](_0xaa833d);}return _0x359c20[_0x7854('0x34')]();};}function saveUpdates(_0x1284df,_0x3a096c){return function(_0x2a41fb){if(_0x2a41fb){return _0x2a41fb[_0x7854('0x35')](_0x1284df)['then'](function(_0x46d213){return _0x46d213;});}return null;};}function removeEntity(_0x2af165,_0x418ad1){return function(_0x10cd51){if(_0x10cd51){return _0x10cd51[_0x7854('0x36')]()['then'](function(){_0x2af165[_0x7854('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdd0fb9,_0x26cca0){return function(_0x138634){if(!_0x138634){_0xdd0fb9[_0x7854('0x28')](0x194);}return _0x138634;};}function handleError(_0x76919d,_0x3ddb76){_0x3ddb76=_0x3ddb76||0x1f4;return function(_0x1b0bba){logger[_0x7854('0x23')](_0x1b0bba[_0x7854('0x37')]);if(_0x1b0bba[_0x7854('0x38')]){delete _0x1b0bba[_0x7854('0x38')];}_0x76919d[_0x7854('0x29')](_0x3ddb76)[_0x7854('0x39')](_0x1b0bba);};}exports[_0x7854('0x3a')]=function(_0x45a14e,_0x47d970){var _0x2d8b27={},_0x17c248={},_0x15e7bb={'count':0x0,'rows':[]};var _0x44c30a=_['map'](db['Dynamics365Account'][_0x7854('0x3b')],function(_0x34a6f8){return{'name':_0x34a6f8[_0x7854('0x3c')],'type':_0x34a6f8[_0x7854('0x3d')]['key']};});_0x17c248[_0x7854('0x3e')]=_[_0x7854('0x3f')](_0x44c30a,_0x7854('0x38'));_0x17c248[_0x7854('0x40')]=_[_0x7854('0x41')](_0x45a14e['query']);_0x17c248[_0x7854('0x42')]=_[_0x7854('0x43')](_0x17c248['model'],_0x17c248[_0x7854('0x40')]);_0x2d8b27[_0x7854('0x44')]=_[_0x7854('0x43')](_0x17c248[_0x7854('0x3e')],qs['fields'](_0x45a14e[_0x7854('0x40')]['fields']));_0x2d8b27['attributes']=_0x2d8b27[_0x7854('0x44')]['length']?_0x2d8b27[_0x7854('0x44')]:_0x17c248[_0x7854('0x3e')];if(!_0x45a14e['query']['hasOwnProperty'](_0x7854('0x45'))){_0x2d8b27[_0x7854('0x2e')]=qs[_0x7854('0x2e')](_0x45a14e[_0x7854('0x40')][_0x7854('0x2e')]);_0x2d8b27[_0x7854('0x2c')]=qs[_0x7854('0x2c')](_0x45a14e[_0x7854('0x40')][_0x7854('0x2c')]);}_0x2d8b27['order']=qs[_0x7854('0x46')](_0x45a14e[_0x7854('0x40')]['sort']);_0x2d8b27[_0x7854('0x47')]=qs[_0x7854('0x42')](_[_0x7854('0x48')](_0x45a14e[_0x7854('0x40')],_0x17c248[_0x7854('0x42')]),_0x44c30a);if(_0x45a14e[_0x7854('0x40')]['filter']){_0x2d8b27['where']=_[_0x7854('0x49')](_0x2d8b27[_0x7854('0x47')],{'$or':_[_0x7854('0x3f')](_0x44c30a,function(_0x505e6d){if(_0x505e6d[_0x7854('0x3d')]!==_0x7854('0x4a')){var _0xe8c281={};_0xe8c281[_0x505e6d['name']]={'$like':'%'+_0x45a14e[_0x7854('0x40')][_0x7854('0x4b')]+'%'};return _0xe8c281;}})});}_0x2d8b27=_[_0x7854('0x49')]({},_0x2d8b27,_0x45a14e[_0x7854('0x4c')]);var _0x18d9d8={'where':_0x2d8b27[_0x7854('0x47')]};return db[_0x7854('0x4d')][_0x7854('0x2f')](_0x18d9d8)[_0x7854('0x1e')](function(_0x498bd8){_0x15e7bb[_0x7854('0x2f')]=_0x498bd8;if(_0x45a14e[_0x7854('0x40')][_0x7854('0x4e')]){_0x2d8b27['include']=[{'all':!![]}];}return db[_0x7854('0x4d')][_0x7854('0x4f')](_0x2d8b27);})['then'](function(_0x2ca161){_0x15e7bb[_0x7854('0x50')]=_0x2ca161;return _0x15e7bb;})[_0x7854('0x1e')](respondWithFilteredResult(_0x47d970,_0x2d8b27))['catch'](handleError(_0x47d970,null));};exports['show']=function(_0x49980f,_0x5a1bdc){var _0xd774c7={'raw':![],'where':{'id':_0x49980f[_0x7854('0x51')]['id']}},_0x43721f={};_0x43721f['model']=_[_0x7854('0x41')](db['Dynamics365Account'][_0x7854('0x3b')]);_0x43721f['query']=_['keys'](_0x49980f[_0x7854('0x40')]);_0x43721f[_0x7854('0x42')]=_['intersection'](_0x43721f['model'],_0x43721f[_0x7854('0x40')]);_0xd774c7[_0x7854('0x44')]=_[_0x7854('0x43')](_0x43721f[_0x7854('0x3e')],qs[_0x7854('0x52')](_0x49980f[_0x7854('0x40')][_0x7854('0x52')]));_0xd774c7[_0x7854('0x44')]=_0xd774c7['attributes'][_0x7854('0x53')]?_0xd774c7['attributes']:_0x43721f[_0x7854('0x3e')];if(_0x49980f[_0x7854('0x40')][_0x7854('0x4e')]){_0xd774c7[_0x7854('0x54')]=[{'all':!![]}];}_0xd774c7=_[_0x7854('0x49')]({},_0xd774c7,_0x49980f[_0x7854('0x4c')]);return db[_0x7854('0x4d')][_0x7854('0x55')](_0xd774c7)[_0x7854('0x1e')](handleEntityNotFound(_0x5a1bdc,null))[_0x7854('0x1e')](respondWithResult(_0x5a1bdc,null))[_0x7854('0x27')](handleError(_0x5a1bdc,null));};exports['create']=function(_0x1d639f,_0x55ae33){return db[_0x7854('0x4d')]['create'](_0x1d639f[_0x7854('0x56')],{})['then'](respondWithResult(_0x55ae33,0xc9))['catch'](handleError(_0x55ae33,null));};exports[_0x7854('0x35')]=function(_0xa4040f,_0x4702b7){if(_0xa4040f[_0x7854('0x56')]['id']){delete _0xa4040f['body']['id'];}return db[_0x7854('0x4d')][_0x7854('0x55')]({'where':{'id':_0xa4040f[_0x7854('0x51')]['id']}})['then'](handleEntityNotFound(_0x4702b7,null))['then'](saveUpdates(_0xa4040f[_0x7854('0x56')],null))[_0x7854('0x1e')](respondWithResult(_0x4702b7,null))['catch'](handleError(_0x4702b7,null));};exports[_0x7854('0x36')]=function(_0x16cd27,_0xbdd9f4){return db[_0x7854('0x4d')][_0x7854('0x55')]({'where':{'id':_0x16cd27[_0x7854('0x51')]['id']}})[_0x7854('0x1e')](handleEntityNotFound(_0xbdd9f4,null))[_0x7854('0x1e')](removeEntity(_0xbdd9f4,null))[_0x7854('0x27')](handleError(_0xbdd9f4,null));};exports[_0x7854('0x57')]=function(_0x47195e,_0x3a6d10,_0x1c2244){var _0xc3113f={};var _0x2f2a82={};var _0x3432ae;var _0x505f55;return db[_0x7854('0x4d')][_0x7854('0x58')]({'where':{'id':_0x47195e[_0x7854('0x51')]['id']}})[_0x7854('0x1e')](handleEntityNotFound(_0x3a6d10,null))[_0x7854('0x1e')](function(_0x541ef0){if(_0x541ef0){_0x3432ae=_0x541ef0;_0x2f2a82[_0x7854('0x3e')]=_[_0x7854('0x41')](db[_0x7854('0x59')][_0x7854('0x3b')]);_0x2f2a82[_0x7854('0x40')]=_['keys'](_0x47195e[_0x7854('0x40')]);_0x2f2a82['filters']=_[_0x7854('0x43')](_0x2f2a82[_0x7854('0x3e')],_0x2f2a82['query']);_0xc3113f[_0x7854('0x44')]=_['intersection'](_0x2f2a82[_0x7854('0x3e')],qs[_0x7854('0x52')](_0x47195e[_0x7854('0x40')][_0x7854('0x52')]));_0xc3113f['attributes']=_0xc3113f[_0x7854('0x44')][_0x7854('0x53')]?_0xc3113f[_0x7854('0x44')]:_0x2f2a82[_0x7854('0x3e')];_0xc3113f[_0x7854('0x5a')]=qs['sort'](_0x47195e[_0x7854('0x40')][_0x7854('0x46')]);_0xc3113f[_0x7854('0x47')]=qs['filters'](_[_0x7854('0x48')](_0x47195e['query'],_0x2f2a82[_0x7854('0x42')]));if(_0x47195e[_0x7854('0x40')][_0x7854('0x4b')]){_0xc3113f[_0x7854('0x47')]=_['merge'](_0xc3113f[_0x7854('0x47')],{'$or':_['map'](_0xc3113f[_0x7854('0x44')],function(_0x1f1bf2){var _0x3ce34a={};_0x3ce34a[_0x1f1bf2]={'$like':'%'+_0x47195e[_0x7854('0x40')][_0x7854('0x4b')]+'%'};return _0x3ce34a;})});}_0xc3113f=_[_0x7854('0x49')]({},_0xc3113f,_0x47195e[_0x7854('0x4c')]);return _0x3432ae[_0x7854('0x57')](_0xc3113f);}})[_0x7854('0x1e')](function(_0x4fb767){if(_0x4fb767){_0x505f55=_0x4fb767['length'];if(!_0x47195e[_0x7854('0x40')]['hasOwnProperty']('nolimit')){_0xc3113f[_0x7854('0x2e')]=qs[_0x7854('0x2e')](_0x47195e[_0x7854('0x40')]['limit']);_0xc3113f[_0x7854('0x2c')]=qs[_0x7854('0x2c')](_0x47195e[_0x7854('0x40')]['offset']);}return _0x3432ae[_0x7854('0x57')](_0xc3113f);}})['then'](function(_0x1a541e){if(_0x1a541e){return _0x1a541e?{'count':_0x505f55,'rows':_0x1a541e}:null;}})[_0x7854('0x1e')](respondWithResult(_0x3a6d10,null))['catch'](handleError(_0x3a6d10,null));};exports[_0x7854('0x5b')]=function(_0x2fe5c3,_0x584525,_0x16173e){if(_0x2fe5c3[_0x7854('0x56')]['id']){delete _0x2fe5c3[_0x7854('0x56')]['id'];}return db['Dynamics365Account'][_0x7854('0x58')]({'where':{'id':_0x2fe5c3['params']['id']}})['then'](handleEntityNotFound(_0x584525,null))[_0x7854('0x1e')](function(_0x25a7a3){if(_0x25a7a3){_0x2fe5c3['body']['AccountId']=_0x25a7a3['id'];_0x2fe5c3[_0x7854('0x56')][_0x7854('0x5c')]=integrations[_0x7854('0x5d')](_0x2fe5c3['body']['channel'],_0x2fe5c3[_0x7854('0x56')]['type']);_0x2fe5c3['body'][_0x7854('0x5e')]=integrations[_0x7854('0x5f')](_0x2fe5c3[_0x7854('0x56')][_0x7854('0x60')],_0x2fe5c3[_0x7854('0x56')][_0x7854('0x3d')]);return db[_0x7854('0x59')][_0x7854('0x61')](_0x2fe5c3['body'],{'include':[{'model':db[_0x7854('0x62')],'as':_0x7854('0x5c')},{'model':db['Dynamics365Field'],'as':_0x7854('0x5e')}]});}return null;})[_0x7854('0x1e')](respondWithResult(_0x584525,null))['catch'](handleError(_0x584525,null));};exports[_0x7854('0x63')]=function(_0x2e2f9a,_0x54e881,_0x146257){var _0x3f7abc=_0x2e2f9a['query'][_0x7854('0x64')];var _0x15f03b=_0x3f7abc==='incident'?_0x7854('0x65'):_0x7854('0x66');var _0x174e4c='';var _0xf709f6='';var _0x54bc93='';var _0x1a6d87='';var _0x532fa5='';var _0x5db145='';var _0x1060ed='';var _0x49fe4e='';var _0x2b1086=[_0x7854('0x67'),'description',_0x7854('0x68'),_0x7854('0x69'),'caseorigincode','subject',_0x7854('0x6a'),_0x7854('0x6b'),_0x7854('0x6c'),_0x7854('0x6d')];var _0x1fc827=['accountidname','accountidyominame','actualserviceunits',_0x7854('0x6e'),_0x7854('0x6f'),_0x7854('0x70'),'contractdetailidname',_0x7854('0x71'),_0x7854('0x72'),_0x7854('0x73'),_0x7854('0x74'),_0x7854('0x75'),_0x7854('0x76'),_0x7854('0x77'),'createdonbehalfbyyominame','customeridname','customeridtype',_0x7854('0x78'),_0x7854('0x79'),_0x7854('0x7a'),'entityimage_timestamp',_0x7854('0x7b'),'escalatedon',_0x7854('0x7c'),_0x7854('0x7d'),'followupby',_0x7854('0x7e'),_0x7854('0x7f'),_0x7854('0x80'),_0x7854('0x81'),'masteridname','modifiedbyexternalpartyname',_0x7854('0x82'),_0x7854('0x83'),_0x7854('0x84'),_0x7854('0x85'),_0x7854('0x86'),_0x7854('0x87'),_0x7854('0x88'),_0x7854('0x89'),_0x7854('0x8a'),_0x7854('0x8b'),_0x7854('0x8c'),_0x7854('0x8d'),_0x7854('0x8e'),_0x7854('0x8f'),_0x7854('0x90'),_0x7854('0x91'),'primarycontactidyominame',_0x7854('0x92'),_0x7854('0x93'),_0x7854('0x94'),_0x7854('0x95'),_0x7854('0x96'),'responseby',_0x7854('0x97'),_0x7854('0x98'),_0x7854('0x99'),_0x7854('0x9a'),_0x7854('0x9b'),_0x7854('0x9c'),_0x7854('0x9d'),_0x7854('0x9e'),_0x7854('0x9f'),_0x7854('0xa0'),_0x7854('0xa1'),'transactioncurrencyidname','traversedpath','utcconversiontimezonecode',_0x7854('0xa2')];var _0x268012=_0x2b1086[_0x7854('0xa3')](_0x1fc827);return db[_0x7854('0x4d')][_0x7854('0x58')]({'where':{'id':_0x2e2f9a[_0x7854('0x51')]['id']},'attributes':['id',_0x7854('0xa4'),_0x7854('0xa5'),'remoteUri','tenantId','clientId',_0x7854('0xa6')]})[_0x7854('0x1e')](handleEntityNotFound(_0x54e881,null))[_0x7854('0x1e')](function(_0x488395){if(_0x488395){_0x49fe4e=_0x488395[_0x7854('0xa7')];var _0x5dd7d6=_0x49fe4e['slice'](-0x1);if(_0x5dd7d6==='/'){_0x49fe4e=_0x49fe4e[_0x7854('0xa8')](0x0,_0x49fe4e['lastIndexOf'](_0x5dd7d6));}_0x1060ed=util[_0x7854('0xa9')](_0x7854('0xaa'),_0x49fe4e);var _0xd95acb={'method':_0x7854('0xab'),'uri':_0x7854('0xac')+_0x488395[_0x7854('0xad')]+'/oauth2/token','form':{'client_id':_0x488395['clientId'],'resource':_0x49fe4e,'username':_0x488395[_0x7854('0xa4')],'password':_0x488395[_0x7854('0xa5')],'grant_type':_0x7854('0xa5'),'client_secret':_0x488395[_0x7854('0xa6')]},'json':!![]};return rp(_0xd95acb);}})[_0x7854('0x1e')](function(_0x3a121a){_0x5db145=_0x3a121a[_0x7854('0xae')];var _0x401ccd={'method':'GET','uri':encodeURI(_0x1060ed+_0x7854('0xaf')+_0x15f03b+'\x27'),'headers':{'Authorization':_0x7854('0xb0')+_0x5db145,'If-None-Match':null,'OData-Version':_0x7854('0xb1')},'json':!![]};return rp(_0x401ccd);})[_0x7854('0x1e')](function(_0x3c77b7){var _0x3d1e3a=_0x3c77b7[_0x7854('0xb2')][0x0];var _0x21f00c=_0x3d1e3a[_0x7854('0xb3')];var _0x542a12={'method':'GET','uri':_0x1060ed+_0x7854('0xb4')+_0x21f00c+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x7854('0xb0')+_0x5db145,'If-None-Match':null,'OData-Version':_0x7854('0xb1')},'json':!![]};return rp(_0x542a12);})[_0x7854('0x1e')](function(_0xd2261){_0x174e4c=_0xd2261;_0xf709f6=_0x174e4c[_0x7854('0xb5')];_0xf709f6=_[_0x7854('0xb6')](_0xf709f6,function(_0x5ab209){return!_0x268012[_0x7854('0xb7')](_0x5ab209[_0x7854('0xb8')]);});var _0x3d538d=[];var _0xbdbf86=[];_0xf709f6['forEach'](function(_0x2f0245){if(_0x2f0245[_0x7854('0xb9')]){var _0x25239f=_0x2f0245[_0x7854('0xb9')][_0x7854('0xa8')](_0x2f0245[_0x7854('0xb9')][_0x7854('0xba')]('.')+0x1);if(_0x25239f==='PicklistAttributeMetadata'){_0x3d538d[_0x7854('0xbb')](getSelectList(_0x1060ed,_0x3f7abc,_0xbdbf86,_0x174e4c[_0x7854('0xb3')],_0x2f0245[_0x7854('0xb3')],_0x5db145));}}});return Promise['all'](_0x3d538d);})[_0x7854('0x1e')](function(_0x25be12){_0x54bc93=_0x25be12[0x0];var _0x39ba3=[];var _0x31851a=[];_0xf709f6[_0x7854('0xbc')](function(_0x4afbab){if(!_['isNil'](_0x4afbab[_0x7854('0xb9')])){var _0x3caed3=_0x4afbab[_0x7854('0xb9')][_0x7854('0xa8')](_0x4afbab[_0x7854('0xb9')][_0x7854('0xba')]('.')+0x1);if(_0x3caed3===_0x7854('0xbd')){_0x39ba3[_0x7854('0xbb')](getBooleanList(_0x1060ed,_0x3f7abc,_0x31851a,_0x174e4c[_0x7854('0xb3')],_0x4afbab[_0x7854('0xb3')],_0x5db145));}}});return Promise[_0x7854('0xbe')](_0x39ba3);})['then'](function(_0x20644d){_0x1a6d87=_0x20644d[0x0];var _0x2b4dd5=[];var _0x507587=[];_0xf709f6['forEach'](function(_0x32f7f1){if(_0x32f7f1[_0x7854('0xb9')]){var _0xe5dc74=_0x32f7f1[_0x7854('0xb9')][_0x7854('0xa8')](_0x32f7f1[_0x7854('0xb9')][_0x7854('0xba')]('.')+0x1);if(_0xe5dc74===_0x7854('0xbf')||_0xe5dc74===_0x7854('0xc0')||_0xe5dc74===_0x7854('0xc1')||_0xe5dc74===_0x7854('0xc2')||_0xe5dc74===_0x7854('0xc3')||_0xe5dc74===_0x7854('0xc4')||_0xe5dc74==='StatusAttributeMetadata'||_0xe5dc74==='EntityNameAttributeMetadata'||_0xe5dc74===_0x7854('0xc5')||_0xe5dc74===_0x7854('0xc6')){_0x2b4dd5[_0x7854('0xbb')](getInputList(_0x1060ed,_0x3f7abc,_0xe5dc74,_0x507587,_0x174e4c[_0x7854('0xb3')],_0x32f7f1[_0x7854('0xb3')],_0x5db145));}}});return Promise[_0x7854('0xbe')](_0x2b4dd5);})[_0x7854('0x1e')](function(_0x56f5ac){_0x532fa5=_0x56f5ac[0x0];var _0x2ca044=_0x54bc93[_0x7854('0xa3')](_0x1a6d87)['concat'](_0x532fa5);var _0x1c3b6a={'count':_0x2ca044[_0x7854('0x53')],'rows':_0x2ca044};return _0x1c3b6a;})[_0x7854('0x1e')](respondWithResult(_0x54e881,null))[_0x7854('0x27')](function(_0x20ecaf){var _0xbb0fd5=_0x2e2f9a[_0x7854('0x40')][_0x7854('0xc7')]?0x1f4:_0x20ecaf[_0x7854('0xc8')]||0x1f4;logger[_0x7854('0x23')](_0x20ecaf[_0x7854('0x37')]);delete _0x20ecaf[_0x7854('0x38')];if(_0xbb0fd5===0x191){_0xbb0fd5=0x190;}_0x54e881['status'](_0xbb0fd5)[_0x7854('0x39')](_0x2e2f9a[_0x7854('0x40')][_0x7854('0xc7')]?{'message':_0x7854('0xc9'),'statusCode':_0x20ecaf['statusCode']}:_0x20ecaf);});};function getSelectList(_0x15a207,_0x33a1c9,_0xa6a901,_0x4f26e1,_0x5c1f7f,_0x482d83){var _0xc744ff={'method':_0x7854('0xca'),'uri':_0x15a207+_0x7854('0xb4')+_0x4f26e1+_0x7854('0xcb')+_0x5c1f7f+_0x7854('0xcc')+_0x7854('0xcd'),'headers':{'Authorization':'Bearer\x20'+_0x482d83,'If-None-Match':null,'OData-Version':_0x7854('0xb1')},'json':!![]};return rp(_0xc744ff)[_0x7854('0x1e')](function(_0x506e80){var _0x39828c=[];var _0x3b5ce0=_0x506e80[_0x7854('0xce')][_0x7854('0xcf')];_0x3b5ce0[_0x7854('0xbc')](function(_0x4a6a6b){_0x39828c['push']({'name':_0x4a6a6b['Label']['UserLocalizedLabel']['Label'],'value':String(_0x4a6a6b[_0x7854('0xd0')])});});var _0x4a9f1e={'id':_0x33a1c9+'_'+_0x506e80[_0x7854('0xb8')],'name':_0x506e80[_0x7854('0xd1')]['UserLocalizedLabel'][_0x7854('0xd2')],'custom':![],'options':_0x39828c};_0xa6a901[_0x7854('0xbb')](_0x4a9f1e);return _0xa6a901;});}function getBooleanList(_0x5e59eb,_0x4187ef,_0x37bc3d,_0x5d21bf,_0x24ef17,_0x47e724){var _0x19ba96={'method':_0x7854('0xca'),'uri':_0x5e59eb+_0x7854('0xb4')+_0x5d21bf+_0x7854('0xcb')+_0x24ef17+_0x7854('0xd3'),'headers':{'Authorization':_0x7854('0xb0')+_0x47e724,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x19ba96)[_0x7854('0x1e')](function(_0x599766){var _0x3c9c32=[];_0x3c9c32[_0x7854('0xbb')]({'name':_0x599766[_0x7854('0xce')][_0x7854('0xd4')][_0x7854('0xd2')][_0x7854('0xd5')][_0x7854('0xd2')],'value':_0x7854('0xd6')},{'name':_0x599766[_0x7854('0xce')][_0x7854('0xd7')][_0x7854('0xd2')][_0x7854('0xd5')][_0x7854('0xd2')],'value':_0x7854('0xd8')});var _0x437db6={'id':_0x4187ef+'_'+_0x599766[_0x7854('0xb8')],'name':_0x599766[_0x7854('0xd1')][_0x7854('0xd5')][_0x7854('0xd2')],'custom':![],'options':_0x3c9c32};_0x37bc3d[_0x7854('0xbb')](_0x437db6);return _0x37bc3d;});}function getInputList(_0x342397,_0x172187,_0x251063,_0x7f07a3,_0x42546b,_0x6a139d,_0xd5e14){var _0x471aaf={'method':_0x7854('0xca'),'uri':_0x342397+_0x7854('0xb4')+_0x42546b+')/Attributes('+_0x6a139d+_0x7854('0xd9')+_0x251063+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x7854('0xb0')+_0xd5e14,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x471aaf)['then'](function(_0xe9afba){var _0x25d3e7={'id':_0x172187+'_'+_0xe9afba[_0x7854('0xb8')],'name':_0xe9afba['DisplayName'][_0x7854('0xd5')]?_0xe9afba[_0x7854('0xd1')]['UserLocalizedLabel']['Label']:_0xe9afba['LogicalName'],'custom':![],'options':[]};_0x7f07a3['push'](_0x25d3e7);return _0x7f07a3;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b084149..48dfc3c 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 _0x1405=['api','moment','bluebird','path','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','Dynamics365Account','int_dynamics365_accounts','../../config/logger'];(function(_0x5aae6c,_0x20bc80){var _0x3946d4=function(_0x34b839){while(--_0x34b839){_0x5aae6c['push'](_0x5aae6c['shift']());}};_0x3946d4(++_0x20bc80);}(_0x1405,0x8b));var _0x5140=function(_0xd2523a,_0x375dab){_0xd2523a=_0xd2523a-0x0;var _0x47ea5e=_0x1405[_0xd2523a];return _0x47ea5e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5140('0x0'))(_0x5140('0x1'));var moment=require(_0x5140('0x2'));var BPromise=require(_0x5140('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5140('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5140('0x5'));var integrations=require(_0x5140('0x6'));module[_0x5140('0x7')]=function(_0x4c406e,_0xf81e93){return _0x4c406e['define'](_0x5140('0x8'),attributes,{'tableName':_0x5140('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd950=['Dynamics365Account','int_dynamics365_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x5b1a21,_0x3f16e0){var _0x39728a=function(_0x5b3596){while(--_0x5b3596){_0x5b1a21['push'](_0x5b1a21['shift']());}};_0x39728a(++_0x3f16e0);}(_0xd950,0x6a));var _0x0d95=function(_0x5972f8,_0x42be78){_0x5972f8=_0x5972f8-0x0;var _0x15b240=_0xd950[_0x5972f8];return _0x15b240;};'use strict';var _=require(_0x0d95('0x0'));var util=require(_0x0d95('0x1'));var logger=require('../../config/logger')(_0x0d95('0x2'));var moment=require(_0x0d95('0x3'));var BPromise=require(_0x0d95('0x4'));var rp=require(_0x0d95('0x5'));var fs=require('fs');var path=require(_0x0d95('0x6'));var rimraf=require(_0x0d95('0x7'));var config=require(_0x0d95('0x8'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x0d95('0x9'));module[_0x0d95('0xa')]=function(_0x5220df,_0x45e357){return _0x5220df['define'](_0x0d95('0xb'),attributes,{'tableName':_0x0d95('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index f00c775..925e94d 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 _0x1134=['http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowDynamics365Account','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0xc47214,_0x2591cb){var _0x2fd92c=function(_0x453469){while(--_0x453469){_0xc47214['push'](_0xc47214['shift']());}};_0x2fd92c(++_0x2591cb);}(_0x1134,0x19c));var _0x4113=function(_0x2e00e2,_0x493538){_0x2e00e2=_0x2e00e2-0x0;var _0x4d23b7=_0x1134[_0x2e00e2];return _0x4d23b7;};'use strict';var _=require(_0x4113('0x0'));var util=require(_0x4113('0x1'));var moment=require('moment');var BPromise=require(_0x4113('0x2'));var rs=require(_0x4113('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4113('0x4'))['db'];var utils=require(_0x4113('0x5'));var logger=require('../../config/logger')(_0x4113('0x6'));var config=require('../../config/environment');var jayson=require(_0x4113('0x7'));var client=jayson['client'][_0x4113('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x493b42,_0xb1cea2,_0x28520f){return new BPromise(function(_0x3b6cc4,_0x11153c){return client[_0x4113('0x9')](_0x493b42,_0x28520f)[_0x4113('0xa')](function(_0x19c657){logger[_0x4113('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0xb1cea2,_0x4113('0xc'));logger[_0x4113('0xd')](_0x4113('0xe'),_0xb1cea2,_0x4113('0xc'),JSON[_0x4113('0xf')](_0x19c657));if(_0x19c657[_0x4113('0x10')]){if(_0x19c657[_0x4113('0x10')][_0x4113('0x11')]===0x1f4){logger[_0x4113('0x10')](_0x4113('0x12'),_0xb1cea2,_0x19c657['error']['message']);return _0x11153c(_0x19c657['error'][_0x4113('0x13')]);}logger[_0x4113('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0xb1cea2,_0x19c657['error'][_0x4113('0x13')]);return _0x3b6cc4(_0x19c657['error'][_0x4113('0x13')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0xb1cea2,_0x4113('0xc'));_0x3b6cc4(_0x19c657[_0x4113('0x14')][_0x4113('0x13')]);}})[_0x4113('0x15')](function(_0x21d732){logger[_0x4113('0x10')](_0x4113('0x12'),_0xb1cea2,_0x21d732);_0x11153c(_0x21d732);});});}exports[_0x4113('0x16')]=function(_0x1051d4){var _0x1cd9ae=this;return new Promise(function(_0x59b821,_0x41d58b){return db[_0x4113('0x17')][_0x4113('0x18')]({'raw':_0x1051d4[_0x4113('0x19')]?_0x1051d4[_0x4113('0x19')][_0x4113('0x1a')]===undefined?!![]:![]:!![],'where':_0x1051d4[_0x4113('0x19')]?_0x1051d4[_0x4113('0x19')][_0x4113('0x1b')]||null:null,'attributes':_0x1051d4['options']?_0x1051d4[_0x4113('0x19')][_0x4113('0x1c')]||null:null,'limit':_0x1051d4['options']?_0x1051d4['options'][_0x4113('0x1d')]||null:null,'include':_0x1051d4['options']?_0x1051d4[_0x4113('0x19')][_0x4113('0x1e')]?_[_0x4113('0x1f')](_0x1051d4['options'][_0x4113('0x1e')],function(_0x16b16c){return{'model':db[_0x16b16c[_0x4113('0x20')]],'as':_0x16b16c['as'],'attributes':_0x16b16c[_0x4113('0x1c')],'include':_0x16b16c[_0x4113('0x1e')]?_[_0x4113('0x1f')](_0x16b16c[_0x4113('0x1e')],function(_0x1c498a){return{'model':db[_0x1c498a[_0x4113('0x20')]],'as':_0x1c498a['as'],'attributes':_0x1c498a[_0x4113('0x1c')],'include':_0x1c498a[_0x4113('0x1e')]?_[_0x4113('0x1f')](_0x1c498a['include'],function(_0x44b317){return{'model':db[_0x44b317[_0x4113('0x20')]],'as':_0x44b317['as'],'attributes':_0x44b317['attributes']};}):[]};}):[]};}):[]:[]})[_0x4113('0xa')](function(_0x98d652){logger[_0x4113('0xb')](_0x4113('0x16'),_0x1051d4);logger[_0x4113('0xd')](_0x4113('0x16'),_0x1051d4,JSON[_0x4113('0xf')](_0x98d652));_0x59b821(_0x98d652);})[_0x4113('0x15')](function(_0x3f063f){logger[_0x4113('0x10')](_0x4113('0x16'),_0x3f063f[_0x4113('0x13')],_0x1051d4);_0x41d58b(_0x1cd9ae[_0x4113('0x10')](0x1f4,_0x3f063f[_0x4113('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x1607a6){var _0xfeabfd=this;return new Promise(function(_0x4ecf29,_0x201966){return db[_0x4113('0x17')][_0x4113('0x21')]({'raw':_0x1607a6[_0x4113('0x19')]?_0x1607a6['options'][_0x4113('0x1a')]===undefined?!![]:![]:!![],'where':_0x1607a6[_0x4113('0x19')]?_0x1607a6[_0x4113('0x19')][_0x4113('0x1b')]||null:null,'attributes':_0x1607a6[_0x4113('0x19')]?_0x1607a6[_0x4113('0x19')][_0x4113('0x1c')]||null:null,'include':_0x1607a6[_0x4113('0x19')]?_0x1607a6[_0x4113('0x19')]['include']?_[_0x4113('0x1f')](_0x1607a6['options'][_0x4113('0x1e')],function(_0x18d748){return{'model':db[_0x18d748[_0x4113('0x20')]],'as':_0x18d748['as'],'attributes':_0x18d748[_0x4113('0x1c')],'include':_0x18d748[_0x4113('0x1e')]?_[_0x4113('0x1f')](_0x18d748['include'],function(_0x1f63ec){return{'model':db[_0x1f63ec['model']],'as':_0x1f63ec['as'],'attributes':_0x1f63ec[_0x4113('0x1c')],'include':_0x1f63ec[_0x4113('0x1e')]?_[_0x4113('0x1f')](_0x1f63ec['include'],function(_0xbce45d){return{'model':db[_0xbce45d['model']],'as':_0xbce45d['as'],'attributes':_0xbce45d[_0x4113('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13d161){logger[_0x4113('0xb')]('ShowDynamics365Account',_0x1607a6);logger['debug'](_0x4113('0x22'),_0x1607a6,JSON[_0x4113('0xf')](_0x13d161));_0x4ecf29(_0x13d161);})[_0x4113('0x15')](function(_0x4b2739){logger['error'](_0x4113('0x22'),_0x4b2739[_0x4113('0x13')],_0x1607a6);_0x201966(_0xfeabfd[_0x4113('0x10')](0x1f4,_0x4b2739[_0x4113('0x13')]));});});}; \ No newline at end of file +var _0xdbcd=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','findAll','options','raw','limit','include','model','attributes','map','info','debug','ShowDynamics365Account','Dynamics365Account','find','where'];(function(_0x585c2f,_0x45a028){var _0x678316=function(_0x4d2702){while(--_0x4d2702){_0x585c2f['push'](_0x585c2f['shift']());}};_0x678316(++_0x45a028);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x257b06,_0x46e8f6){_0x257b06=_0x257b06-0x0;var _0x2fc518=_0xdbcd[_0x257b06];return _0x2fc518;};'use strict';var _=require(_0xddbc('0x0'));var util=require(_0xddbc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xddbc('0x2'));var fs=require('fs');var Redis=require(_0xddbc('0x3'));var db=require(_0xddbc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xddbc('0x5'))(_0xddbc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xddbc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d8331,_0x5b9a2f,_0x5bea89){return new BPromise(function(_0x51f0ae,_0x3b637c){return client[_0xddbc('0x8')](_0x4d8331,_0x5bea89)[_0xddbc('0x9')](function(_0x123450){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5b9a2f,_0xddbc('0xa'));logger['debug'](_0xddbc('0xb'),_0x5b9a2f,'request\x20sent',JSON[_0xddbc('0xc')](_0x123450));if(_0x123450[_0xddbc('0xd')]){if(_0x123450[_0xddbc('0xd')][_0xddbc('0xe')]===0x1f4){logger[_0xddbc('0xd')](_0xddbc('0xf'),_0x5b9a2f,_0x123450[_0xddbc('0xd')][_0xddbc('0x10')]);return _0x3b637c(_0x123450[_0xddbc('0xd')][_0xddbc('0x10')]);}logger[_0xddbc('0xd')](_0xddbc('0xf'),_0x5b9a2f,_0x123450['error']['message']);return _0x51f0ae(_0x123450[_0xddbc('0xd')][_0xddbc('0x10')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5b9a2f,_0xddbc('0xa'));_0x51f0ae(_0x123450[_0xddbc('0x11')][_0xddbc('0x10')]);}})[_0xddbc('0x12')](function(_0x5427b0){logger['error'](_0xddbc('0xf'),_0x5b9a2f,_0x5427b0);_0x3b637c(_0x5427b0);});});}exports[_0xddbc('0x13')]=function(_0x5d0a34){var _0x48efdb=this;return new Promise(function(_0x4cf7ea,_0x870da4){return db['Dynamics365Account'][_0xddbc('0x14')]({'raw':_0x5d0a34[_0xddbc('0x15')]?_0x5d0a34[_0xddbc('0x15')][_0xddbc('0x16')]===undefined?!![]:![]:!![],'where':_0x5d0a34[_0xddbc('0x15')]?_0x5d0a34[_0xddbc('0x15')]['where']||null:null,'attributes':_0x5d0a34[_0xddbc('0x15')]?_0x5d0a34['options']['attributes']||null:null,'limit':_0x5d0a34[_0xddbc('0x15')]?_0x5d0a34['options'][_0xddbc('0x17')]||null:null,'include':_0x5d0a34[_0xddbc('0x15')]?_0x5d0a34[_0xddbc('0x15')][_0xddbc('0x18')]?_['map'](_0x5d0a34[_0xddbc('0x15')][_0xddbc('0x18')],function(_0x1d0dfc){return{'model':db[_0x1d0dfc[_0xddbc('0x19')]],'as':_0x1d0dfc['as'],'attributes':_0x1d0dfc[_0xddbc('0x1a')],'include':_0x1d0dfc['include']?_['map'](_0x1d0dfc['include'],function(_0x302120){return{'model':db[_0x302120[_0xddbc('0x19')]],'as':_0x302120['as'],'attributes':_0x302120[_0xddbc('0x1a')],'include':_0x302120[_0xddbc('0x18')]?_[_0xddbc('0x1b')](_0x302120[_0xddbc('0x18')],function(_0x177520){return{'model':db[_0x177520['model']],'as':_0x177520['as'],'attributes':_0x177520[_0xddbc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xddbc('0x9')](function(_0x12bf5b){logger[_0xddbc('0x1c')](_0xddbc('0x13'),_0x5d0a34);logger[_0xddbc('0x1d')](_0xddbc('0x13'),_0x5d0a34,JSON['stringify'](_0x12bf5b));_0x4cf7ea(_0x12bf5b);})[_0xddbc('0x12')](function(_0x158cc0){logger[_0xddbc('0xd')](_0xddbc('0x13'),_0x158cc0['message'],_0x5d0a34);_0x870da4(_0x48efdb[_0xddbc('0xd')](0x1f4,_0x158cc0['message']));});});};exports[_0xddbc('0x1e')]=function(_0x95a9c6){var _0x4d6329=this;return new Promise(function(_0x19d2f0,_0x2e261e){return db[_0xddbc('0x1f')][_0xddbc('0x20')]({'raw':_0x95a9c6[_0xddbc('0x15')]?_0x95a9c6['options'][_0xddbc('0x16')]===undefined?!![]:![]:!![],'where':_0x95a9c6['options']?_0x95a9c6[_0xddbc('0x15')][_0xddbc('0x21')]||null:null,'attributes':_0x95a9c6[_0xddbc('0x15')]?_0x95a9c6[_0xddbc('0x15')][_0xddbc('0x1a')]||null:null,'include':_0x95a9c6[_0xddbc('0x15')]?_0x95a9c6[_0xddbc('0x15')][_0xddbc('0x18')]?_['map'](_0x95a9c6[_0xddbc('0x15')][_0xddbc('0x18')],function(_0x3ea296){return{'model':db[_0x3ea296['model']],'as':_0x3ea296['as'],'attributes':_0x3ea296[_0xddbc('0x1a')],'include':_0x3ea296['include']?_[_0xddbc('0x1b')](_0x3ea296[_0xddbc('0x18')],function(_0x5ba5f4){return{'model':db[_0x5ba5f4[_0xddbc('0x19')]],'as':_0x5ba5f4['as'],'attributes':_0x5ba5f4['attributes'],'include':_0x5ba5f4[_0xddbc('0x18')]?_['map'](_0x5ba5f4['include'],function(_0x363c59){return{'model':db[_0x363c59['model']],'as':_0x363c59['as'],'attributes':_0x363c59['attributes']};}):[]};}):[]};}):[]:[]})[_0xddbc('0x9')](function(_0x8d2fbd){logger[_0xddbc('0x1c')]('ShowDynamics365Account',_0x95a9c6);logger['debug'](_0xddbc('0x1e'),_0x95a9c6,JSON['stringify'](_0x8d2fbd));_0x19d2f0(_0x8d2fbd);})[_0xddbc('0x12')](function(_0x217c99){logger[_0xddbc('0xd')](_0xddbc('0x1e'),_0x217c99[_0xddbc('0x10')],_0x95a9c6);_0x2e261e(_0x4d6329[_0xddbc('0xd')](0x1f4,_0x217c99[_0xddbc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index ea8431b..71c1181 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 _0x06b4=['delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','create'];(function(_0x301872,_0x140453){var _0x42fb6c=function(_0x2fa2e){while(--_0x2fa2e){_0x301872['push'](_0x301872['shift']());}};_0x42fb6c(++_0x140453);}(_0x06b4,0xdd));var _0x406b=function(_0x538152,_0x517bb3){_0x538152=_0x538152-0x0;var _0xfd3e35=_0x06b4[_0x538152];return _0xfd3e35;};'use strict';var multer=require(_0x406b('0x0'));var util=require(_0x406b('0x1'));var path=require(_0x406b('0x2'));var timeout=require(_0x406b('0x3'));var express=require('express');var router=express[_0x406b('0x4')]();var fs_extra=require(_0x406b('0x5'));var auth=require(_0x406b('0x6'));var interaction=require(_0x406b('0x7'));var config=require(_0x406b('0x8'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x406b('0x9')](),controller[_0x406b('0xa')]);router[_0x406b('0xb')](_0x406b('0xc'),auth['isAuthenticated'](),controller[_0x406b('0xd')]);router[_0x406b('0xb')](_0x406b('0xe'),auth[_0x406b('0x9')](),controller[_0x406b('0xf')]);router[_0x406b('0xb')](_0x406b('0x10'),auth[_0x406b('0x9')](),controller[_0x406b('0x11')]);router[_0x406b('0xb')]('/:id/descriptions',auth[_0x406b('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x406b('0x9')](),controller[_0x406b('0x12')]);router['put'](_0x406b('0xc'),auth[_0x406b('0x9')](),controller['update']);router[_0x406b('0x13')](_0x406b('0xc'),auth[_0x406b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xadff=['get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','/:id','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x448375,_0x50636f){var _0x3962e6=function(_0x34f582){while(--_0x34f582){_0x448375['push'](_0x448375['shift']());}};_0x3962e6(++_0x50636f);}(_0xadff,0xde));var _0xfadf=function(_0x20a086,_0x15cef2){_0x20a086=_0x20a086-0x0;var _0x379cc3=_0xadff[_0x20a086];return _0x379cc3;};'use strict';var multer=require('multer');var util=require(_0xfadf('0x0'));var path=require(_0xfadf('0x1'));var timeout=require(_0xfadf('0x2'));var express=require(_0xfadf('0x3'));var router=express[_0xfadf('0x4')]();var fs_extra=require(_0xfadf('0x5'));var auth=require(_0xfadf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfadf('0x7'));var controller=require(_0xfadf('0x8'));router[_0xfadf('0x9')]('/',auth[_0xfadf('0xa')](),controller[_0xfadf('0xb')]);router[_0xfadf('0x9')]('/:id',auth[_0xfadf('0xa')](),controller[_0xfadf('0xc')]);router[_0xfadf('0x9')](_0xfadf('0xd'),auth[_0xfadf('0xa')](),controller['getFields']);router[_0xfadf('0x9')](_0xfadf('0xe'),auth[_0xfadf('0xa')](),controller[_0xfadf('0xf')]);router[_0xfadf('0x9')](_0xfadf('0x10'),auth[_0xfadf('0xa')](),controller[_0xfadf('0x11')]);router['post']('/',auth[_0xfadf('0xa')](),controller[_0xfadf('0x12')]);router['put'](_0xfadf('0x13'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xfadf('0x13'),auth[_0xfadf('0xa')](),controller[_0xfadf('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 979e741..f3120f8 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 _0xab6d=['STRING','incident','phonecall','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab6d,0x1a7));var _0xdab6=function(_0x4e04a7,_0x156bb5){_0x4e04a7=_0x4e04a7-0x0;var _0x5e86b6=_0xab6d[_0x4e04a7];return _0x5e86b6;};'use strict';var Sequelize=require(_0xdab6('0x0'));module[_0xdab6('0x1')]={'name':{'type':Sequelize[_0xdab6('0x2')]},'description':{'type':Sequelize[_0xdab6('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xdab6('0x3'),_0xdab6('0x4')),'defaultValue':_0xdab6('0x3')}}; \ No newline at end of file +var _0x2e47=['STRING','ENUM','incident','phonecall','sequelize','exports'];(function(_0x249f20,_0x41c6ab){var _0x1a6715=function(_0x5a9581){while(--_0x5a9581){_0x249f20['push'](_0x249f20['shift']());}};_0x1a6715(++_0x41c6ab);}(_0x2e47,0xac));var _0x72e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2e47[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x72e4('0x0'));module[_0x72e4('0x1')]={'name':{'type':Sequelize[_0x72e4('0x2')]},'description':{'type':Sequelize[_0x72e4('0x2')]},'ticketType':{'type':Sequelize[_0x72e4('0x3')](_0x72e4('0x4'),_0x72e4('0x5')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 2ec6cf9..a762219 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 _0x338b=['update','destroy','sendStatus','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','show','keys','includeAll','options','create','body','find','params','getFields','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','limit','undefined','count','offset','set','apply','reject'];(function(_0x1a2b70,_0x5a9c8b){var _0x2432dc=function(_0x503a90){while(--_0x503a90){_0x1a2b70['push'](_0x1a2b70['shift']());}};_0x2432dc(++_0x5a9c8b);}(_0x338b,0x138));var _0xb338=function(_0x154bcc,_0x1ccc24){_0x154bcc=_0x154bcc-0x0;var _0x400b3e=_0x338b[_0x154bcc];return _0x400b3e;};'use strict';var emlformat=require(_0xb338('0x0'));var rimraf=require(_0xb338('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb338('0x2'));var rp=require(_0xb338('0x3'));var moment=require('moment');var BPromise=require(_0xb338('0x4'));var Mustache=require(_0xb338('0x5'));var util=require(_0xb338('0x6'));var path=require(_0xb338('0x7'));var sox=require('sox');var csv=require(_0xb338('0x8'));var ejs=require(_0xb338('0x9'));var fs=require('fs');var fs_extra=require(_0xb338('0xa'));var _=require(_0xb338('0xb'));var squel=require(_0xb338('0xc'));var crypto=require(_0xb338('0xd'));var jsforce=require(_0xb338('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb338('0x8'));var querystring=require('querystring');var Papa=require(_0xb338('0xf'));var Redis=require(_0xb338('0x10'));var authService=require(_0xb338('0x11'));var qs=require(_0xb338('0x12'));var as=require(_0xb338('0x13'));var hardwareService=require(_0xb338('0x14'));var logger=require(_0xb338('0x15'))(_0xb338('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb338('0x17'));var db=require(_0xb338('0x18'))['db'];var jayson=require(_0xb338('0x19'));var client=jayson[_0xb338('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d92f4,_0x5a3d96,_0x2861e4,_0x53dfa8){return new BPromise(function(_0x439462,_0x1a9615){var _0x4e26df=_0x53dfa8||client;return _0x4e26df[_0xb338('0x1b')](_0x3d92f4,_0x2861e4)[_0xb338('0x1c')](function(_0x23473e){logger[_0xb338('0x1d')](_0xb338('0x1e'),_0x5a3d96,_0xb338('0x1f'));logger['debug'](_0xb338('0x20'),_0x5a3d96,_0xb338('0x1f'),JSON['stringify'](_0x23473e));if(_0x23473e[_0xb338('0x21')]){if(_0x23473e[_0xb338('0x21')][_0xb338('0x22')]===0x1f4){logger[_0xb338('0x21')](_0xb338('0x1e'),_0x5a3d96,_0x23473e['error']['message']);return _0x1a9615(_0x23473e[_0xb338('0x21')][_0xb338('0x23')]);}logger['error'](_0xb338('0x1e'),_0x5a3d96,_0x23473e[_0xb338('0x21')]['message']);return _0x439462(_0x23473e[_0xb338('0x21')][_0xb338('0x23')]);}else{logger['info'](_0xb338('0x1e'),_0x5a3d96,'request\x20sent');_0x439462(_0x23473e[_0xb338('0x24')][_0xb338('0x23')]);}})[_0xb338('0x25')](function(_0x17a8c5){logger[_0xb338('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5a3d96,_0x17a8c5);_0x1a9615(_0x17a8c5);});});}function respondWithStatusCode(_0xeba05b,_0x345209){_0x345209=_0x345209||0xcc;return function(_0x99215f){if(_0x99215f){return _0xeba05b['sendStatus'](_0x345209);}return _0xeba05b['status'](_0x345209)[_0xb338('0x26')]();};}function respondWithResult(_0x5ece39,_0x5d0d04){_0x5d0d04=_0x5d0d04||0xc8;return function(_0x32db81){if(_0x32db81){return _0x5ece39[_0xb338('0x27')](_0x5d0d04)[_0xb338('0x28')](_0x32db81);}};}function respondWithFilteredResult(_0x53a4f3,_0x2c6f16){return function(_0x479a70){if(_0x479a70){var _0x59e31a=typeof _0x2c6f16['offset']==='undefined'&&typeof _0x2c6f16[_0xb338('0x29')]===_0xb338('0x2a');var _0x359fc5=_0x479a70[_0xb338('0x2b')];var _0x157386=_0x59e31a?0x0:_0x2c6f16[_0xb338('0x2c')];var _0x53d4f4=_0x59e31a?_0x479a70[_0xb338('0x2b')]:_0x2c6f16[_0xb338('0x2c')]+_0x2c6f16[_0xb338('0x29')];var _0x2feaed;if(_0x53d4f4>=_0x359fc5){_0x53d4f4=_0x359fc5;_0x2feaed=0xc8;}else{_0x2feaed=0xce;}_0x53a4f3[_0xb338('0x27')](_0x2feaed);return _0x53a4f3[_0xb338('0x2d')]('Content-Range',_0x157386+'-'+_0x53d4f4+'/'+_0x359fc5)[_0xb338('0x28')](_0x479a70);}return null;};}function patchUpdates(_0x16e052){return function(_0x5d1b9){try{jsonpatch[_0xb338('0x2e')](_0x5d1b9,_0x16e052,!![]);}catch(_0x2f7529){return BPromise[_0xb338('0x2f')](_0x2f7529);}return _0x5d1b9['save']();};}function saveUpdates(_0x5c711d,_0xb326e4){return function(_0x418215){if(_0x418215){return _0x418215[_0xb338('0x30')](_0x5c711d)[_0xb338('0x1c')](function(_0x3cc070){return _0x3cc070;});}return null;};}function removeEntity(_0x19f9b4,_0x3cd744){return function(_0x30b125){if(_0x30b125){return _0x30b125[_0xb338('0x31')]()['then'](function(){_0x19f9b4['status'](0xcc)[_0xb338('0x26')]();});}};}function handleEntityNotFound(_0x442d88,_0x29f970){return function(_0xabe8df){if(!_0xabe8df){_0x442d88[_0xb338('0x32')](0x194);}return _0xabe8df;};}function handleError(_0x2b2618,_0x58268a){_0x58268a=_0x58268a||0x1f4;return function(_0x317610){logger[_0xb338('0x21')](_0x317610[_0xb338('0x33')]);if(_0x317610[_0xb338('0x34')]){delete _0x317610[_0xb338('0x34')];}_0x2b2618['status'](_0x58268a)[_0xb338('0x35')](_0x317610);};}exports[_0xb338('0x36')]=function(_0x248f2f,_0x262eba){var _0x59c539={},_0x283252={},_0x68578a={'count':0x0,'rows':[]};var _0x19ba98=_[_0xb338('0x37')](db[_0xb338('0x38')][_0xb338('0x39')],function(_0x2a7911){return{'name':_0x2a7911['fieldName'],'type':_0x2a7911[_0xb338('0x3a')][_0xb338('0x3b')]};});_0x283252[_0xb338('0x3c')]=_['map'](_0x19ba98,_0xb338('0x34'));_0x283252[_0xb338('0x3d')]=_['keys'](_0x248f2f[_0xb338('0x3d')]);_0x283252[_0xb338('0x3e')]=_[_0xb338('0x3f')](_0x283252[_0xb338('0x3c')],_0x283252[_0xb338('0x3d')]);_0x59c539[_0xb338('0x40')]=_[_0xb338('0x3f')](_0x283252['model'],qs[_0xb338('0x41')](_0x248f2f[_0xb338('0x3d')]['fields']));_0x59c539[_0xb338('0x40')]=_0x59c539[_0xb338('0x40')][_0xb338('0x42')]?_0x59c539['attributes']:_0x283252[_0xb338('0x3c')];if(!_0x248f2f[_0xb338('0x3d')][_0xb338('0x43')](_0xb338('0x44'))){_0x59c539[_0xb338('0x29')]=qs[_0xb338('0x29')](_0x248f2f['query'][_0xb338('0x29')]);_0x59c539[_0xb338('0x2c')]=qs['offset'](_0x248f2f[_0xb338('0x3d')]['offset']);}_0x59c539[_0xb338('0x45')]=qs[_0xb338('0x46')](_0x248f2f[_0xb338('0x3d')]['sort']);_0x59c539[_0xb338('0x47')]=qs['filters'](_[_0xb338('0x48')](_0x248f2f['query'],_0x283252[_0xb338('0x3e')]),_0x19ba98);if(_0x248f2f['query'][_0xb338('0x49')]){_0x59c539['where']=_[_0xb338('0x4a')](_0x59c539[_0xb338('0x47')],{'$or':_[_0xb338('0x37')](_0x19ba98,function(_0x682220){if(_0x682220[_0xb338('0x3a')]!=='VIRTUAL'){var _0x4d0d03={};_0x4d0d03[_0x682220[_0xb338('0x34')]]={'$like':'%'+_0x248f2f[_0xb338('0x3d')]['filter']+'%'};return _0x4d0d03;}})});}_0x59c539=_[_0xb338('0x4a')]({},_0x59c539,_0x248f2f['options']);var _0x2627eb={'where':_0x59c539[_0xb338('0x47')]};return db[_0xb338('0x38')][_0xb338('0x2b')](_0x2627eb)['then'](function(_0x3c4595){_0x68578a[_0xb338('0x2b')]=_0x3c4595;if(_0x248f2f[_0xb338('0x3d')]['includeAll']){_0x59c539[_0xb338('0x4b')]=[{'all':!![]}];}return db[_0xb338('0x38')][_0xb338('0x4c')](_0x59c539);})[_0xb338('0x1c')](function(_0x428031){_0x68578a[_0xb338('0x4d')]=_0x428031;return _0x68578a;})['then'](respondWithFilteredResult(_0x262eba,_0x59c539))[_0xb338('0x25')](handleError(_0x262eba,null));};exports[_0xb338('0x4e')]=function(_0x10c112,_0x5ed669){var _0x19022b={'raw':![],'where':{'id':_0x10c112['params']['id']}},_0x443b3d={};_0x443b3d[_0xb338('0x3c')]=_['keys'](db[_0xb338('0x38')][_0xb338('0x39')]);_0x443b3d['query']=_[_0xb338('0x4f')](_0x10c112[_0xb338('0x3d')]);_0x443b3d[_0xb338('0x3e')]=_[_0xb338('0x3f')](_0x443b3d[_0xb338('0x3c')],_0x443b3d[_0xb338('0x3d')]);_0x19022b[_0xb338('0x40')]=_[_0xb338('0x3f')](_0x443b3d[_0xb338('0x3c')],qs[_0xb338('0x41')](_0x10c112[_0xb338('0x3d')]['fields']));_0x19022b[_0xb338('0x40')]=_0x19022b[_0xb338('0x40')][_0xb338('0x42')]?_0x19022b['attributes']:_0x443b3d[_0xb338('0x3c')];if(_0x10c112[_0xb338('0x3d')][_0xb338('0x50')]){_0x19022b[_0xb338('0x4b')]=[{'all':!![]}];}_0x19022b=_['merge']({},_0x19022b,_0x10c112[_0xb338('0x51')]);return db[_0xb338('0x38')]['find'](_0x19022b)['then'](handleEntityNotFound(_0x5ed669,null))[_0xb338('0x1c')](respondWithResult(_0x5ed669,null))[_0xb338('0x25')](handleError(_0x5ed669,null));};exports[_0xb338('0x52')]=function(_0x11545c,_0x3eab70){return db[_0xb338('0x38')][_0xb338('0x52')](_0x11545c[_0xb338('0x53')],{})[_0xb338('0x1c')](respondWithResult(_0x3eab70,0xc9))[_0xb338('0x25')](handleError(_0x3eab70,null));};exports[_0xb338('0x30')]=function(_0x16d8a1,_0x4ddb80){if(_0x16d8a1[_0xb338('0x53')]['id']){delete _0x16d8a1['body']['id'];}return db[_0xb338('0x38')][_0xb338('0x54')]({'where':{'id':_0x16d8a1[_0xb338('0x55')]['id']}})[_0xb338('0x1c')](handleEntityNotFound(_0x4ddb80,null))[_0xb338('0x1c')](saveUpdates(_0x16d8a1[_0xb338('0x53')],null))['then'](respondWithResult(_0x4ddb80,null))[_0xb338('0x25')](handleError(_0x4ddb80,null));};exports['destroy']=function(_0x193ed6,_0x497eed){return db[_0xb338('0x38')][_0xb338('0x54')]({'where':{'id':_0x193ed6[_0xb338('0x55')]['id']}})[_0xb338('0x1c')](handleEntityNotFound(_0x497eed,null))[_0xb338('0x1c')](removeEntity(_0x497eed,null))[_0xb338('0x25')](handleError(_0x497eed,null));};exports[_0xb338('0x56')]=function(_0x31717e,_0x383798,_0x18d74d){var _0x6b41b2={};var _0x16f414={};var _0x5a87a4;var _0x299be5;return db[_0xb338('0x38')]['findOne']({'where':{'id':_0x31717e[_0xb338('0x55')]['id']}})[_0xb338('0x1c')](handleEntityNotFound(_0x383798,null))[_0xb338('0x1c')](function(_0x46a166){if(_0x46a166){_0x5a87a4=_0x46a166;_0x16f414[_0xb338('0x3c')]=_[_0xb338('0x4f')](db['Dynamics365Field'][_0xb338('0x39')]);_0x16f414[_0xb338('0x3d')]=_['keys'](_0x31717e[_0xb338('0x3d')]);_0x16f414[_0xb338('0x3e')]=_['intersection'](_0x16f414[_0xb338('0x3c')],_0x16f414[_0xb338('0x3d')]);_0x6b41b2[_0xb338('0x40')]=_[_0xb338('0x3f')](_0x16f414[_0xb338('0x3c')],qs['fields'](_0x31717e[_0xb338('0x3d')]['fields']));_0x6b41b2[_0xb338('0x40')]=_0x6b41b2[_0xb338('0x40')][_0xb338('0x42')]?_0x6b41b2[_0xb338('0x40')]:_0x16f414[_0xb338('0x3c')];_0x6b41b2['order']=qs[_0xb338('0x46')](_0x31717e[_0xb338('0x3d')]['sort']);_0x6b41b2[_0xb338('0x47')]=qs[_0xb338('0x3e')](_[_0xb338('0x48')](_0x31717e[_0xb338('0x3d')],_0x16f414[_0xb338('0x3e')]));if(_0x31717e[_0xb338('0x3d')][_0xb338('0x49')]){_0x6b41b2[_0xb338('0x47')]=_[_0xb338('0x4a')](_0x6b41b2[_0xb338('0x47')],{'$or':_[_0xb338('0x37')](_0x6b41b2['attributes'],function(_0x34707c){var _0x2edc54={};_0x2edc54[_0x34707c]={'$like':'%'+_0x31717e['query'][_0xb338('0x49')]+'%'};return _0x2edc54;})});}_0x6b41b2=_['merge']({},_0x6b41b2,_0x31717e['options']);return _0x5a87a4[_0xb338('0x56')](_0x6b41b2);}})['then'](function(_0x37a198){if(_0x37a198){_0x299be5=_0x37a198[_0xb338('0x42')];if(!_0x31717e[_0xb338('0x3d')]['hasOwnProperty'](_0xb338('0x44'))){_0x6b41b2[_0xb338('0x29')]=qs[_0xb338('0x29')](_0x31717e['query'][_0xb338('0x29')]);_0x6b41b2[_0xb338('0x2c')]=qs[_0xb338('0x2c')](_0x31717e[_0xb338('0x3d')][_0xb338('0x2c')]);}return _0x5a87a4[_0xb338('0x56')](_0x6b41b2);}})[_0xb338('0x1c')](function(_0x388060){if(_0x388060){return _0x388060?{'count':_0x299be5,'rows':_0x388060}:null;}})[_0xb338('0x1c')](respondWithResult(_0x383798,null))[_0xb338('0x25')](handleError(_0x383798,null));};exports[_0xb338('0x57')]=function(_0x38f8b9,_0x23dacc,_0x189525){var _0x1f81e9={};var _0xa50fac={};var _0x2ba3cb;var _0x22d93a;return db[_0xb338('0x38')]['findOne']({'where':{'id':_0x38f8b9[_0xb338('0x55')]['id']}})[_0xb338('0x1c')](handleEntityNotFound(_0x23dacc,null))[_0xb338('0x1c')](function(_0x40cf3e){if(_0x40cf3e){_0x2ba3cb=_0x40cf3e;_0xa50fac[_0xb338('0x3c')]=_[_0xb338('0x4f')](db[_0xb338('0x58')]['rawAttributes']);_0xa50fac[_0xb338('0x3d')]=_[_0xb338('0x4f')](_0x38f8b9['query']);_0xa50fac['filters']=_[_0xb338('0x3f')](_0xa50fac[_0xb338('0x3c')],_0xa50fac[_0xb338('0x3d')]);_0x1f81e9[_0xb338('0x40')]=_['intersection'](_0xa50fac[_0xb338('0x3c')],qs[_0xb338('0x41')](_0x38f8b9['query'][_0xb338('0x41')]));_0x1f81e9[_0xb338('0x40')]=_0x1f81e9[_0xb338('0x40')][_0xb338('0x42')]?_0x1f81e9[_0xb338('0x40')]:_0xa50fac[_0xb338('0x3c')];_0x1f81e9['order']=qs[_0xb338('0x46')](_0x38f8b9[_0xb338('0x3d')]['sort']);_0x1f81e9['where']=qs['filters'](_[_0xb338('0x48')](_0x38f8b9[_0xb338('0x3d')],_0xa50fac[_0xb338('0x3e')]));if(_0x38f8b9['query']['filter']){_0x1f81e9[_0xb338('0x47')]=_[_0xb338('0x4a')](_0x1f81e9[_0xb338('0x47')],{'$or':_[_0xb338('0x37')](_0x1f81e9['attributes'],function(_0x2b353d){var _0x5170aa={};_0x5170aa[_0x2b353d]={'$like':'%'+_0x38f8b9[_0xb338('0x3d')][_0xb338('0x49')]+'%'};return _0x5170aa;})});}_0x1f81e9=_[_0xb338('0x4a')]({},_0x1f81e9,_0x38f8b9[_0xb338('0x51')]);return _0x2ba3cb[_0xb338('0x57')](_0x1f81e9);}})['then'](function(_0x23ca61){if(_0x23ca61){_0x22d93a=_0x23ca61['length'];if(!_0x38f8b9[_0xb338('0x3d')][_0xb338('0x43')](_0xb338('0x44'))){_0x1f81e9[_0xb338('0x29')]=qs[_0xb338('0x29')](_0x38f8b9['query'][_0xb338('0x29')]);_0x1f81e9['offset']=qs['offset'](_0x38f8b9[_0xb338('0x3d')][_0xb338('0x2c')]);}return _0x2ba3cb[_0xb338('0x57')](_0x1f81e9);}})[_0xb338('0x1c')](function(_0x482ee4){if(_0x482ee4){return _0x482ee4?{'count':_0x22d93a,'rows':_0x482ee4}:null;}})[_0xb338('0x1c')](respondWithResult(_0x23dacc,null))['catch'](handleError(_0x23dacc,null));};exports[_0xb338('0x59')]=function(_0x1d7b9c,_0x1ed0c7,_0x5151c9){var _0x30d2bb={};var _0x41a32d={};var _0x3169f6;var _0x3b65c2;return db[_0xb338('0x38')]['findOne']({'where':{'id':_0x1d7b9c['params']['id']}})['then'](handleEntityNotFound(_0x1ed0c7,null))['then'](function(_0x37588d){if(_0x37588d){_0x3169f6=_0x37588d;_0x41a32d[_0xb338('0x3c')]=_[_0xb338('0x4f')](db['Dynamics365Field'][_0xb338('0x39')]);_0x41a32d[_0xb338('0x3d')]=_[_0xb338('0x4f')](_0x1d7b9c[_0xb338('0x3d')]);_0x41a32d[_0xb338('0x3e')]=_[_0xb338('0x3f')](_0x41a32d['model'],_0x41a32d[_0xb338('0x3d')]);_0x30d2bb[_0xb338('0x40')]=_[_0xb338('0x3f')](_0x41a32d[_0xb338('0x3c')],qs[_0xb338('0x41')](_0x1d7b9c[_0xb338('0x3d')][_0xb338('0x41')]));_0x30d2bb[_0xb338('0x40')]=_0x30d2bb[_0xb338('0x40')][_0xb338('0x42')]?_0x30d2bb[_0xb338('0x40')]:_0x41a32d[_0xb338('0x3c')];_0x30d2bb[_0xb338('0x45')]=qs['sort'](_0x1d7b9c[_0xb338('0x3d')][_0xb338('0x46')]);_0x30d2bb[_0xb338('0x47')]=qs[_0xb338('0x3e')](_[_0xb338('0x48')](_0x1d7b9c['query'],_0x41a32d[_0xb338('0x3e')]));if(_0x1d7b9c[_0xb338('0x3d')][_0xb338('0x49')]){_0x30d2bb['where']=_[_0xb338('0x4a')](_0x30d2bb['where'],{'$or':_[_0xb338('0x37')](_0x30d2bb[_0xb338('0x40')],function(_0x27e9d6){var _0x1ad2e2={};_0x1ad2e2[_0x27e9d6]={'$like':'%'+_0x1d7b9c[_0xb338('0x3d')]['filter']+'%'};return _0x1ad2e2;})});}_0x30d2bb=_['merge']({},_0x30d2bb,_0x1d7b9c[_0xb338('0x51')]);return _0x3169f6[_0xb338('0x59')](_0x30d2bb);}})[_0xb338('0x1c')](function(_0x22a995){if(_0x22a995){_0x3b65c2=_0x22a995[_0xb338('0x42')];if(!_0x1d7b9c['query'][_0xb338('0x43')]('nolimit')){_0x30d2bb['limit']=qs[_0xb338('0x29')](_0x1d7b9c[_0xb338('0x3d')]['limit']);_0x30d2bb[_0xb338('0x2c')]=qs[_0xb338('0x2c')](_0x1d7b9c[_0xb338('0x3d')][_0xb338('0x2c')]);}return _0x3169f6[_0xb338('0x59')](_0x30d2bb);}})[_0xb338('0x1c')](function(_0x5e3c86){if(_0x5e3c86){return _0x5e3c86?{'count':_0x3b65c2,'rows':_0x5e3c86}:null;}})[_0xb338('0x1c')](respondWithResult(_0x1ed0c7,null))[_0xb338('0x25')](handleError(_0x1ed0c7,null));}; \ No newline at end of file +var _0x27e8=['request','then','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','name','index','map','Dynamics365Configuration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','keys','rawAttributes','find','create','body','params','getFields','getSubjects','findOne','getDescriptions','Dynamics365Field','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http'];(function(_0x37d0f9,_0x10291f){var _0x5c5a7a=function(_0x5c8c92){while(--_0x5c8c92){_0x37d0f9['push'](_0x37d0f9['shift']());}};_0x5c5a7a(++_0x10291f);}(_0x27e8,0x9d));var _0x827e=function(_0x289d3c,_0x1fe0af){_0x289d3c=_0x289d3c-0x0;var _0x10c187=_0x27e8[_0x289d3c];return _0x10c187;};'use strict';var emlformat=require(_0x827e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x827e('0x1'));var jsonpatch=require(_0x827e('0x2'));var rp=require(_0x827e('0x3'));var moment=require(_0x827e('0x4'));var BPromise=require(_0x827e('0x5'));var Mustache=require('mustache');var util=require(_0x827e('0x6'));var path=require(_0x827e('0x7'));var sox=require('sox');var csv=require(_0x827e('0x8'));var ejs=require(_0x827e('0x9'));var fs=require('fs');var fs_extra=require(_0x827e('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x827e('0xb'));var jsforce=require(_0x827e('0xc'));var deskjs=require(_0x827e('0xd'));var toCsv=require(_0x827e('0x8'));var querystring=require(_0x827e('0xe'));var Papa=require(_0x827e('0xf'));var Redis=require('ioredis');var authService=require(_0x827e('0x10'));var qs=require(_0x827e('0x11'));var as=require(_0x827e('0x12'));var hardwareService=require(_0x827e('0x13'));var logger=require('../../config/logger')(_0x827e('0x14'));var utils=require('../../config/utils');var config=require(_0x827e('0x15'));var licenseUtil=require(_0x827e('0x16'));var db=require(_0x827e('0x17'))['db'];var jayson=require(_0x827e('0x18'));var client=jayson[_0x827e('0x19')][_0x827e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x13afbb,_0x345e19,_0x579ab7,_0x3a5b28){return new BPromise(function(_0x2ce185,_0x535c72){var _0x5dfbc6=_0x3a5b28||client;return _0x5dfbc6[_0x827e('0x1b')](_0x13afbb,_0x579ab7)[_0x827e('0x1c')](function(_0x2ae505){logger[_0x827e('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s',_0x345e19,'request\x20sent');logger[_0x827e('0x1e')](_0x827e('0x1f'),_0x345e19,_0x827e('0x20'),JSON[_0x827e('0x21')](_0x2ae505));if(_0x2ae505[_0x827e('0x22')]){if(_0x2ae505[_0x827e('0x22')][_0x827e('0x23')]===0x1f4){logger[_0x827e('0x22')](_0x827e('0x24'),_0x345e19,_0x2ae505[_0x827e('0x22')]['message']);return _0x535c72(_0x2ae505['error'][_0x827e('0x25')]);}logger[_0x827e('0x22')](_0x827e('0x24'),_0x345e19,_0x2ae505['error'][_0x827e('0x25')]);return _0x2ce185(_0x2ae505['error']['message']);}else{logger['info'](_0x827e('0x24'),_0x345e19,_0x827e('0x20'));_0x2ce185(_0x2ae505['result']['message']);}})[_0x827e('0x26')](function(_0x27abc7){logger[_0x827e('0x22')](_0x827e('0x24'),_0x345e19,_0x27abc7);_0x535c72(_0x27abc7);});});}function respondWithStatusCode(_0x19ef9a,_0x24cf07){_0x24cf07=_0x24cf07||0xcc;return function(_0x45f8ed){if(_0x45f8ed){return _0x19ef9a[_0x827e('0x27')](_0x24cf07);}return _0x19ef9a[_0x827e('0x28')](_0x24cf07)[_0x827e('0x29')]();};}function respondWithResult(_0x1eca29,_0x1ec082){_0x1ec082=_0x1ec082||0xc8;return function(_0x55a64c){if(_0x55a64c){return _0x1eca29[_0x827e('0x28')](_0x1ec082)[_0x827e('0x2a')](_0x55a64c);}};}function respondWithFilteredResult(_0x384348,_0x416066){return function(_0x4abe01){if(_0x4abe01){var _0x4b9f4d=typeof _0x416066[_0x827e('0x2b')]===_0x827e('0x2c')&&typeof _0x416066['limit']===_0x827e('0x2c');var _0x32632f=_0x4abe01[_0x827e('0x2d')];var _0x3c40a8=_0x4b9f4d?0x0:_0x416066['offset'];var _0x17f71b=_0x4b9f4d?_0x4abe01[_0x827e('0x2d')]:_0x416066['offset']+_0x416066[_0x827e('0x2e')];var _0x185e71;if(_0x17f71b>=_0x32632f){_0x17f71b=_0x32632f;_0x185e71=0xc8;}else{_0x185e71=0xce;}_0x384348[_0x827e('0x28')](_0x185e71);return _0x384348[_0x827e('0x2f')](_0x827e('0x30'),_0x3c40a8+'-'+_0x17f71b+'/'+_0x32632f)[_0x827e('0x2a')](_0x4abe01);}return null;};}function patchUpdates(_0xa0b1c){return function(_0x2d43d6){try{jsonpatch[_0x827e('0x31')](_0x2d43d6,_0xa0b1c,!![]);}catch(_0x5620fe){return BPromise[_0x827e('0x32')](_0x5620fe);}return _0x2d43d6['save']();};}function saveUpdates(_0x381bef,_0xe93057){return function(_0x1e4ac0){if(_0x1e4ac0){return _0x1e4ac0[_0x827e('0x33')](_0x381bef)['then'](function(_0x4c721b){return _0x4c721b;});}return null;};}function removeEntity(_0x129c7f,_0x2061d5){return function(_0x5569d9){if(_0x5569d9){return _0x5569d9[_0x827e('0x34')]()[_0x827e('0x1c')](function(){_0x129c7f[_0x827e('0x28')](0xcc)[_0x827e('0x29')]();});}};}function handleEntityNotFound(_0x596944,_0x4922d0){return function(_0x152ae3){if(!_0x152ae3){_0x596944[_0x827e('0x27')](0x194);}return _0x152ae3;};}function handleError(_0x4886d6,_0x505584){_0x505584=_0x505584||0x1f4;return function(_0x2b199f){logger[_0x827e('0x22')](_0x2b199f['stack']);if(_0x2b199f['name']){delete _0x2b199f[_0x827e('0x35')];}_0x4886d6[_0x827e('0x28')](_0x505584)['send'](_0x2b199f);};}exports[_0x827e('0x36')]=function(_0x9be4c7,_0x398769){var _0x5d0c9a={},_0x28ba75={},_0x3c57a3={'count':0x0,'rows':[]};var _0x3ea64a=_[_0x827e('0x37')](db[_0x827e('0x38')]['rawAttributes'],function(_0x288604){return{'name':_0x288604[_0x827e('0x39')],'type':_0x288604[_0x827e('0x3a')][_0x827e('0x3b')]};});_0x28ba75[_0x827e('0x3c')]=_[_0x827e('0x37')](_0x3ea64a,_0x827e('0x35'));_0x28ba75[_0x827e('0x3d')]=_['keys'](_0x9be4c7[_0x827e('0x3d')]);_0x28ba75[_0x827e('0x3e')]=_[_0x827e('0x3f')](_0x28ba75[_0x827e('0x3c')],_0x28ba75['query']);_0x5d0c9a[_0x827e('0x40')]=_['intersection'](_0x28ba75[_0x827e('0x3c')],qs[_0x827e('0x41')](_0x9be4c7[_0x827e('0x3d')][_0x827e('0x41')]));_0x5d0c9a[_0x827e('0x40')]=_0x5d0c9a[_0x827e('0x40')][_0x827e('0x42')]?_0x5d0c9a[_0x827e('0x40')]:_0x28ba75[_0x827e('0x3c')];if(!_0x9be4c7[_0x827e('0x3d')][_0x827e('0x43')](_0x827e('0x44'))){_0x5d0c9a['limit']=qs[_0x827e('0x2e')](_0x9be4c7[_0x827e('0x3d')][_0x827e('0x2e')]);_0x5d0c9a['offset']=qs[_0x827e('0x2b')](_0x9be4c7[_0x827e('0x3d')][_0x827e('0x2b')]);}_0x5d0c9a[_0x827e('0x45')]=qs['sort'](_0x9be4c7[_0x827e('0x3d')][_0x827e('0x46')]);_0x5d0c9a[_0x827e('0x47')]=qs[_0x827e('0x3e')](_[_0x827e('0x48')](_0x9be4c7[_0x827e('0x3d')],_0x28ba75[_0x827e('0x3e')]),_0x3ea64a);if(_0x9be4c7[_0x827e('0x3d')]['filter']){_0x5d0c9a[_0x827e('0x47')]=_[_0x827e('0x49')](_0x5d0c9a['where'],{'$or':_['map'](_0x3ea64a,function(_0x427c49){if(_0x427c49[_0x827e('0x3a')]!==_0x827e('0x4a')){var _0x575ee0={};_0x575ee0[_0x427c49[_0x827e('0x35')]]={'$like':'%'+_0x9be4c7[_0x827e('0x3d')][_0x827e('0x4b')]+'%'};return _0x575ee0;}})});}_0x5d0c9a=_[_0x827e('0x49')]({},_0x5d0c9a,_0x9be4c7[_0x827e('0x4c')]);var _0x1f203d={'where':_0x5d0c9a['where']};return db['Dynamics365Configuration'][_0x827e('0x2d')](_0x1f203d)['then'](function(_0x37524e){_0x3c57a3[_0x827e('0x2d')]=_0x37524e;if(_0x9be4c7[_0x827e('0x3d')][_0x827e('0x4d')]){_0x5d0c9a[_0x827e('0x4e')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x827e('0x4f')](_0x5d0c9a);})['then'](function(_0x3d1936){_0x3c57a3['rows']=_0x3d1936;return _0x3c57a3;})[_0x827e('0x1c')](respondWithFilteredResult(_0x398769,_0x5d0c9a))[_0x827e('0x26')](handleError(_0x398769,null));};exports[_0x827e('0x50')]=function(_0x5ad82e,_0x1db87c){var _0x461270={'raw':![],'where':{'id':_0x5ad82e['params']['id']}},_0x3448e2={};_0x3448e2[_0x827e('0x3c')]=_[_0x827e('0x51')](db[_0x827e('0x38')][_0x827e('0x52')]);_0x3448e2[_0x827e('0x3d')]=_[_0x827e('0x51')](_0x5ad82e[_0x827e('0x3d')]);_0x3448e2['filters']=_[_0x827e('0x3f')](_0x3448e2[_0x827e('0x3c')],_0x3448e2[_0x827e('0x3d')]);_0x461270[_0x827e('0x40')]=_[_0x827e('0x3f')](_0x3448e2[_0x827e('0x3c')],qs[_0x827e('0x41')](_0x5ad82e[_0x827e('0x3d')][_0x827e('0x41')]));_0x461270['attributes']=_0x461270['attributes'][_0x827e('0x42')]?_0x461270[_0x827e('0x40')]:_0x3448e2['model'];if(_0x5ad82e[_0x827e('0x3d')]['includeAll']){_0x461270[_0x827e('0x4e')]=[{'all':!![]}];}_0x461270=_[_0x827e('0x49')]({},_0x461270,_0x5ad82e[_0x827e('0x4c')]);return db[_0x827e('0x38')][_0x827e('0x53')](_0x461270)[_0x827e('0x1c')](handleEntityNotFound(_0x1db87c,null))[_0x827e('0x1c')](respondWithResult(_0x1db87c,null))[_0x827e('0x26')](handleError(_0x1db87c,null));};exports['create']=function(_0x510359,_0x7655e7){return db[_0x827e('0x38')][_0x827e('0x54')](_0x510359['body'],{})[_0x827e('0x1c')](respondWithResult(_0x7655e7,0xc9))[_0x827e('0x26')](handleError(_0x7655e7,null));};exports[_0x827e('0x33')]=function(_0x3aa4b3,_0x3a34de){if(_0x3aa4b3[_0x827e('0x55')]['id']){delete _0x3aa4b3[_0x827e('0x55')]['id'];}return db[_0x827e('0x38')][_0x827e('0x53')]({'where':{'id':_0x3aa4b3[_0x827e('0x56')]['id']}})[_0x827e('0x1c')](handleEntityNotFound(_0x3a34de,null))['then'](saveUpdates(_0x3aa4b3[_0x827e('0x55')],null))['then'](respondWithResult(_0x3a34de,null))['catch'](handleError(_0x3a34de,null));};exports['destroy']=function(_0x55883e,_0x312036){return db[_0x827e('0x38')]['find']({'where':{'id':_0x55883e[_0x827e('0x56')]['id']}})['then'](handleEntityNotFound(_0x312036,null))[_0x827e('0x1c')](removeEntity(_0x312036,null))[_0x827e('0x26')](handleError(_0x312036,null));};exports[_0x827e('0x57')]=function(_0x5e09a3,_0x1250b0,_0x52add5){var _0x403f16={};var _0xcbddc1={};var _0x420246;var _0x3c0995;return db[_0x827e('0x38')]['findOne']({'where':{'id':_0x5e09a3[_0x827e('0x56')]['id']}})['then'](handleEntityNotFound(_0x1250b0,null))[_0x827e('0x1c')](function(_0x5dad36){if(_0x5dad36){_0x420246=_0x5dad36;_0xcbddc1[_0x827e('0x3c')]=_[_0x827e('0x51')](db['Dynamics365Field']['rawAttributes']);_0xcbddc1[_0x827e('0x3d')]=_[_0x827e('0x51')](_0x5e09a3['query']);_0xcbddc1[_0x827e('0x3e')]=_[_0x827e('0x3f')](_0xcbddc1['model'],_0xcbddc1[_0x827e('0x3d')]);_0x403f16[_0x827e('0x40')]=_[_0x827e('0x3f')](_0xcbddc1[_0x827e('0x3c')],qs['fields'](_0x5e09a3[_0x827e('0x3d')][_0x827e('0x41')]));_0x403f16[_0x827e('0x40')]=_0x403f16['attributes'][_0x827e('0x42')]?_0x403f16['attributes']:_0xcbddc1[_0x827e('0x3c')];_0x403f16['order']=qs[_0x827e('0x46')](_0x5e09a3[_0x827e('0x3d')][_0x827e('0x46')]);_0x403f16[_0x827e('0x47')]=qs['filters'](_[_0x827e('0x48')](_0x5e09a3[_0x827e('0x3d')],_0xcbddc1[_0x827e('0x3e')]));if(_0x5e09a3[_0x827e('0x3d')][_0x827e('0x4b')]){_0x403f16[_0x827e('0x47')]=_['merge'](_0x403f16['where'],{'$or':_[_0x827e('0x37')](_0x403f16[_0x827e('0x40')],function(_0x1e829c){var _0x5f2b94={};_0x5f2b94[_0x1e829c]={'$like':'%'+_0x5e09a3['query']['filter']+'%'};return _0x5f2b94;})});}_0x403f16=_[_0x827e('0x49')]({},_0x403f16,_0x5e09a3[_0x827e('0x4c')]);return _0x420246[_0x827e('0x57')](_0x403f16);}})[_0x827e('0x1c')](function(_0x377f08){if(_0x377f08){_0x3c0995=_0x377f08[_0x827e('0x42')];if(!_0x5e09a3[_0x827e('0x3d')]['hasOwnProperty'](_0x827e('0x44'))){_0x403f16['limit']=qs[_0x827e('0x2e')](_0x5e09a3[_0x827e('0x3d')][_0x827e('0x2e')]);_0x403f16[_0x827e('0x2b')]=qs[_0x827e('0x2b')](_0x5e09a3[_0x827e('0x3d')][_0x827e('0x2b')]);}return _0x420246[_0x827e('0x57')](_0x403f16);}})[_0x827e('0x1c')](function(_0x133af2){if(_0x133af2){return _0x133af2?{'count':_0x3c0995,'rows':_0x133af2}:null;}})[_0x827e('0x1c')](respondWithResult(_0x1250b0,null))['catch'](handleError(_0x1250b0,null));};exports[_0x827e('0x58')]=function(_0x179ebb,_0x87cf7b,_0x2ab53c){var _0x3e8d50={};var _0x143187={};var _0x35e5e2;var _0x47b1f2;return db[_0x827e('0x38')][_0x827e('0x59')]({'where':{'id':_0x179ebb[_0x827e('0x56')]['id']}})[_0x827e('0x1c')](handleEntityNotFound(_0x87cf7b,null))[_0x827e('0x1c')](function(_0x4b88d3){if(_0x4b88d3){_0x35e5e2=_0x4b88d3;_0x143187['model']=_[_0x827e('0x51')](db['Dynamics365Field']['rawAttributes']);_0x143187[_0x827e('0x3d')]=_[_0x827e('0x51')](_0x179ebb[_0x827e('0x3d')]);_0x143187['filters']=_[_0x827e('0x3f')](_0x143187[_0x827e('0x3c')],_0x143187['query']);_0x3e8d50[_0x827e('0x40')]=_[_0x827e('0x3f')](_0x143187[_0x827e('0x3c')],qs[_0x827e('0x41')](_0x179ebb[_0x827e('0x3d')][_0x827e('0x41')]));_0x3e8d50['attributes']=_0x3e8d50[_0x827e('0x40')][_0x827e('0x42')]?_0x3e8d50[_0x827e('0x40')]:_0x143187[_0x827e('0x3c')];_0x3e8d50[_0x827e('0x45')]=qs[_0x827e('0x46')](_0x179ebb['query']['sort']);_0x3e8d50['where']=qs[_0x827e('0x3e')](_[_0x827e('0x48')](_0x179ebb[_0x827e('0x3d')],_0x143187['filters']));if(_0x179ebb[_0x827e('0x3d')]['filter']){_0x3e8d50['where']=_[_0x827e('0x49')](_0x3e8d50[_0x827e('0x47')],{'$or':_[_0x827e('0x37')](_0x3e8d50[_0x827e('0x40')],function(_0xf8b7c0){var _0x3f6442={};_0x3f6442[_0xf8b7c0]={'$like':'%'+_0x179ebb[_0x827e('0x3d')][_0x827e('0x4b')]+'%'};return _0x3f6442;})});}_0x3e8d50=_['merge']({},_0x3e8d50,_0x179ebb[_0x827e('0x4c')]);return _0x35e5e2[_0x827e('0x58')](_0x3e8d50);}})[_0x827e('0x1c')](function(_0x47401d){if(_0x47401d){_0x47b1f2=_0x47401d[_0x827e('0x42')];if(!_0x179ebb['query']['hasOwnProperty'](_0x827e('0x44'))){_0x3e8d50[_0x827e('0x2e')]=qs[_0x827e('0x2e')](_0x179ebb[_0x827e('0x3d')][_0x827e('0x2e')]);_0x3e8d50['offset']=qs[_0x827e('0x2b')](_0x179ebb[_0x827e('0x3d')]['offset']);}return _0x35e5e2[_0x827e('0x58')](_0x3e8d50);}})[_0x827e('0x1c')](function(_0x5218d9){if(_0x5218d9){return _0x5218d9?{'count':_0x47b1f2,'rows':_0x5218d9}:null;}})[_0x827e('0x1c')](respondWithResult(_0x87cf7b,null))[_0x827e('0x26')](handleError(_0x87cf7b,null));};exports[_0x827e('0x5a')]=function(_0x304330,_0xe262fd,_0x3182a1){var _0x3aa946={};var _0x19d257={};var _0x1d8004;var _0x64e811;return db['Dynamics365Configuration'][_0x827e('0x59')]({'where':{'id':_0x304330['params']['id']}})[_0x827e('0x1c')](handleEntityNotFound(_0xe262fd,null))['then'](function(_0x547e54){if(_0x547e54){_0x1d8004=_0x547e54;_0x19d257['model']=_[_0x827e('0x51')](db[_0x827e('0x5b')][_0x827e('0x52')]);_0x19d257[_0x827e('0x3d')]=_[_0x827e('0x51')](_0x304330[_0x827e('0x3d')]);_0x19d257[_0x827e('0x3e')]=_['intersection'](_0x19d257[_0x827e('0x3c')],_0x19d257['query']);_0x3aa946[_0x827e('0x40')]=_[_0x827e('0x3f')](_0x19d257[_0x827e('0x3c')],qs[_0x827e('0x41')](_0x304330[_0x827e('0x3d')][_0x827e('0x41')]));_0x3aa946[_0x827e('0x40')]=_0x3aa946['attributes'][_0x827e('0x42')]?_0x3aa946[_0x827e('0x40')]:_0x19d257['model'];_0x3aa946['order']=qs[_0x827e('0x46')](_0x304330[_0x827e('0x3d')][_0x827e('0x46')]);_0x3aa946[_0x827e('0x47')]=qs[_0x827e('0x3e')](_[_0x827e('0x48')](_0x304330[_0x827e('0x3d')],_0x19d257[_0x827e('0x3e')]));if(_0x304330['query'][_0x827e('0x4b')]){_0x3aa946[_0x827e('0x47')]=_['merge'](_0x3aa946[_0x827e('0x47')],{'$or':_[_0x827e('0x37')](_0x3aa946[_0x827e('0x40')],function(_0x2d581a){var _0xeff67d={};_0xeff67d[_0x2d581a]={'$like':'%'+_0x304330[_0x827e('0x3d')][_0x827e('0x4b')]+'%'};return _0xeff67d;})});}_0x3aa946=_[_0x827e('0x49')]({},_0x3aa946,_0x304330[_0x827e('0x4c')]);return _0x1d8004['getDescriptions'](_0x3aa946);}})[_0x827e('0x1c')](function(_0x130fd7){if(_0x130fd7){_0x64e811=_0x130fd7[_0x827e('0x42')];if(!_0x304330[_0x827e('0x3d')][_0x827e('0x43')]('nolimit')){_0x3aa946[_0x827e('0x2e')]=qs[_0x827e('0x2e')](_0x304330['query'][_0x827e('0x2e')]);_0x3aa946[_0x827e('0x2b')]=qs[_0x827e('0x2b')](_0x304330[_0x827e('0x3d')][_0x827e('0x2b')]);}return _0x1d8004[_0x827e('0x5a')](_0x3aa946);}})[_0x827e('0x1c')](function(_0x29ee99){if(_0x29ee99){return _0x29ee99?{'count':_0x64e811,'rows':_0x29ee99}:null;}})[_0x827e('0x1c')](respondWithResult(_0xe262fd,null))[_0x827e('0x26')](handleError(_0xe262fd,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 9839f36..f1c9bd7 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 _0x06bf=['bluebird','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x06bf,0x105));var _0xf06b=function(_0x3ce8f2,_0x16de75){_0x3ce8f2=_0x3ce8f2-0x0;var _0x595bdb=_0x06bf[_0x3ce8f2];return _0x595bdb;};'use strict';var _=require(_0xf06b('0x0'));var util=require(_0xf06b('0x1'));var logger=require(_0xf06b('0x2'))(_0xf06b('0x3'));var moment=require(_0xf06b('0x4'));var BPromise=require(_0xf06b('0x5'));var rp=require(_0xf06b('0x6'));var fs=require('fs');var path=require(_0xf06b('0x7'));var rimraf=require('rimraf');var config=require(_0xf06b('0x8'));var attributes=require(_0xf06b('0x9'));module[_0xf06b('0xa')]=function(_0x502d7f,_0x2f1d0e){return _0x502d7f[_0xf06b('0xb')](_0xf06b('0xc'),attributes,{'tableName':_0xf06b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b1f=['int_dynamics365_configurations','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','Dynamics365Configuration'];(function(_0x446af7,_0x31b1a2){var _0x1dd765=function(_0x5cc7e3){while(--_0x5cc7e3){_0x446af7['push'](_0x446af7['shift']());}};_0x1dd765(++_0x31b1a2);}(_0x2b1f,0x182));var _0xf2b1=function(_0x4ce35c,_0x1cf5cd){_0x4ce35c=_0x4ce35c-0x0;var _0x554eaa=_0x2b1f[_0x4ce35c];return _0x554eaa;};'use strict';var _=require(_0xf2b1('0x0'));var util=require(_0xf2b1('0x1'));var logger=require(_0xf2b1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf2b1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2b1('0x4'));var rimraf=require(_0xf2b1('0x5'));var config=require(_0xf2b1('0x6'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xf2b1('0x7')]=function(_0x1d28f0,_0x5df82d){return _0x1d28f0[_0xf2b1('0x8')](_0xf2b1('0x9'),attributes,{'tableName':_0xf2b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index e508059..075fe9e 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 _0x6f66=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f66,0xe2));var _0x66f6=function(_0x47bc58,_0x1e1998){_0x47bc58=_0x47bc58-0x0;var _0x4a0860=_0x6f66[_0x47bc58];return _0x4a0860;};'use strict';var _=require(_0x66f6('0x0'));var util=require('util');var moment=require(_0x66f6('0x1'));var BPromise=require(_0x66f6('0x2'));var rs=require(_0x66f6('0x3'));var fs=require('fs');var Redis=require(_0x66f6('0x4'));var db=require(_0x66f6('0x5'))['db'];var utils=require(_0x66f6('0x6'));var logger=require('../../config/logger')(_0x66f6('0x7'));var config=require(_0x66f6('0x8'));var jayson=require(_0x66f6('0x9'));var client=jayson[_0x66f6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e6add,_0x1e9ee6,_0x5a9021){return new BPromise(function(_0x4eb573,_0xf4d421){return client[_0x66f6('0xb')](_0x1e6add,_0x5a9021)[_0x66f6('0xc')](function(_0x5a032e){logger[_0x66f6('0xd')](_0x66f6('0xe'),_0x1e9ee6,_0x66f6('0xf'));logger[_0x66f6('0x10')](_0x66f6('0x11'),_0x1e9ee6,_0x66f6('0xf'),JSON['stringify'](_0x5a032e));if(_0x5a032e[_0x66f6('0x12')]){if(_0x5a032e[_0x66f6('0x12')][_0x66f6('0x13')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1e9ee6,_0x5a032e[_0x66f6('0x12')][_0x66f6('0x14')]);return _0xf4d421(_0x5a032e[_0x66f6('0x12')][_0x66f6('0x14')]);}logger[_0x66f6('0x12')](_0x66f6('0xe'),_0x1e9ee6,_0x5a032e[_0x66f6('0x12')]['message']);return _0x4eb573(_0x5a032e[_0x66f6('0x12')][_0x66f6('0x14')]);}else{logger['info'](_0x66f6('0xe'),_0x1e9ee6,'request\x20sent');_0x4eb573(_0x5a032e[_0x66f6('0x15')][_0x66f6('0x14')]);}})[_0x66f6('0x16')](function(_0x534685){logger[_0x66f6('0x12')](_0x66f6('0xe'),_0x1e9ee6,_0x534685);_0xf4d421(_0x534685);});});} \ No newline at end of file +var _0x9ddb=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','info','request\x20sent','debug','error','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x2d9245,_0x4e4f08){var _0x3256ca=function(_0x4fe6c5){while(--_0x4fe6c5){_0x2d9245['push'](_0x2d9245['shift']());}};_0x3256ca(++_0x4e4f08);}(_0x9ddb,0xa4));var _0xb9dd=function(_0x212c45,_0x4d6c7c){_0x212c45=_0x212c45-0x0;var _0x29e47e=_0x9ddb[_0x212c45];return _0x29e47e;};'use strict';var _=require(_0xb9dd('0x0'));var util=require(_0xb9dd('0x1'));var moment=require(_0xb9dd('0x2'));var BPromise=require(_0xb9dd('0x3'));var rs=require(_0xb9dd('0x4'));var fs=require('fs');var Redis=require(_0xb9dd('0x5'));var db=require(_0xb9dd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9dd('0x7'))('rpc');var config=require(_0xb9dd('0x8'));var jayson=require(_0xb9dd('0x9'));var client=jayson['client'][_0xb9dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39c649,_0x305e17,_0x600bfb){return new BPromise(function(_0x1596de,_0x30b03e){return client['request'](_0x39c649,_0x600bfb)['then'](function(_0x2266b9){logger[_0xb9dd('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x305e17,_0xb9dd('0xc'));logger[_0xb9dd('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x305e17,_0xb9dd('0xc'),JSON['stringify'](_0x2266b9));if(_0x2266b9[_0xb9dd('0xe')]){if(_0x2266b9[_0xb9dd('0xe')]['code']===0x1f4){logger['error'](_0xb9dd('0xf'),_0x305e17,_0x2266b9[_0xb9dd('0xe')][_0xb9dd('0x10')]);return _0x30b03e(_0x2266b9[_0xb9dd('0xe')][_0xb9dd('0x10')]);}logger[_0xb9dd('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x305e17,_0x2266b9['error']['message']);return _0x1596de(_0x2266b9[_0xb9dd('0xe')]['message']);}else{logger[_0xb9dd('0xb')](_0xb9dd('0xf'),_0x305e17,_0xb9dd('0xc'));_0x1596de(_0x2266b9['result'][_0xb9dd('0x10')]);}})[_0xb9dd('0x11')](function(_0x3e1c4e){logger[_0xb9dd('0xe')](_0xb9dd('0xf'),_0x305e17,_0x3e1c4e);_0x30b03e(_0x3e1c4e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 2f04999..2e5d886 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 _0x4899=['update','delete','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','create','put'];(function(_0x18307e,_0x1898e8){var _0x24186b=function(_0x5ee12b){while(--_0x5ee12b){_0x18307e['push'](_0x18307e['shift']());}};_0x24186b(++_0x1898e8);}(_0x4899,0x142));var _0x9489=function(_0x494e8c,_0x155f83){_0x494e8c=_0x494e8c-0x0;var _0x51fa7a=_0x4899[_0x494e8c];return _0x51fa7a;};'use strict';var multer=require('multer');var util=require(_0x9489('0x0'));var path=require('path');var timeout=require(_0x9489('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9489('0x2'));var auth=require(_0x9489('0x3'));var interaction=require(_0x9489('0x4'));var config=require(_0x9489('0x5'));var controller=require(_0x9489('0x6'));router['get']('/',auth[_0x9489('0x7')](),controller[_0x9489('0x8')]);router[_0x9489('0x9')](_0x9489('0xa'),auth[_0x9489('0x7')](),controller[_0x9489('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9489('0xc')]);router[_0x9489('0xd')](_0x9489('0xa'),auth[_0x9489('0x7')](),controller[_0x9489('0xe')]);router[_0x9489('0xf')]('/:id',auth[_0x9489('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa03f=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x3c5e1e,_0x17e56d){var _0x5591ac=function(_0x18d4d1){while(--_0x18d4d1){_0x3c5e1e['push'](_0x3c5e1e['shift']());}};_0x5591ac(++_0x17e56d);}(_0xa03f,0x1ce));var _0xfa03=function(_0x4540ac,_0x175df7){_0x4540ac=_0x4540ac-0x0;var _0x65f938=_0xa03f[_0x4540ac];return _0x65f938;};'use strict';var multer=require(_0xfa03('0x0'));var util=require(_0xfa03('0x1'));var path=require(_0xfa03('0x2'));var timeout=require(_0xfa03('0x3'));var express=require('express');var router=express[_0xfa03('0x4')]();var fs_extra=require(_0xfa03('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfa03('0x6'));var config=require(_0xfa03('0x7'));var controller=require(_0xfa03('0x8'));router[_0xfa03('0x9')]('/',auth[_0xfa03('0xa')](),controller[_0xfa03('0xb')]);router[_0xfa03('0x9')]('/:id',auth[_0xfa03('0xa')](),controller[_0xfa03('0xc')]);router[_0xfa03('0xd')]('/',auth[_0xfa03('0xa')](),controller[_0xfa03('0xe')]);router[_0xfa03('0xf')](_0xfa03('0x10'),auth[_0xfa03('0xa')](),controller[_0xfa03('0x11')]);router[_0xfa03('0x12')](_0xfa03('0x10'),auth[_0xfa03('0xa')](),controller[_0xfa03('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 488cece..f75485d 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 _0x71ab=['BOOLEAN','exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable'];(function(_0x561467,_0x4e72f3){var _0x3ea7eb=function(_0x17e100){while(--_0x17e100){_0x561467['push'](_0x561467['shift']());}};_0x3ea7eb(++_0x4e72f3);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'type':{'type':Sequelize['ENUM'](_0xb71a('0x1'),'variable',_0xb71a('0x2'),_0xb71a('0x3'),_0xb71a('0x4')),'defaultValue':_0xb71a('0x1')},'content':{'type':Sequelize[_0xb71a('0x5')]},'key':{'type':Sequelize[_0xb71a('0x5')]},'keyType':{'type':Sequelize[_0xb71a('0x6')](_0xb71a('0x1'),_0xb71a('0x7'),_0xb71a('0x2'))},'keyContent':{'type':Sequelize[_0xb71a('0x5')]},'idField':{'type':Sequelize[_0xb71a('0x5')]},'nameField':{'type':Sequelize[_0xb71a('0x5')]},'customField':{'type':Sequelize[_0xb71a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb71a('0x5')]}}; \ No newline at end of file +var _0xe0ae=['ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN'];(function(_0x4145ed,_0x1965e3){var _0x2294a6=function(_0x21c3bb){while(--_0x21c3bb){_0x4145ed['push'](_0x4145ed['shift']());}};_0x2294a6(++_0x1965e3);}(_0xe0ae,0xa1));var _0xee0a=function(_0x54e6f5,_0x4f4e99){_0x54e6f5=_0x54e6f5-0x0;var _0x5e8794=_0xe0ae[_0x54e6f5];return _0x5e8794;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xee0a('0x0')](_0xee0a('0x1'),'variable',_0xee0a('0x2'),'keyValue',_0xee0a('0x3')),'defaultValue':_0xee0a('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xee0a('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0xee0a('0x5'),_0xee0a('0x2'))},'keyContent':{'type':Sequelize[_0xee0a('0x4')]},'idField':{'type':Sequelize[_0xee0a('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xee0a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 92ea975..2904d12 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 _0xfde4=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','Dynamics365Field','fieldName','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x44e974,_0x4de526){var _0x521723=function(_0x56d311){while(--_0x56d311){_0x44e974['push'](_0x44e974['shift']());}};_0x521723(++_0x4de526);}(_0xfde4,0x1dd));var _0x4fde=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0xfde4[_0x217ff6];return _0x417c93;};'use strict';var emlformat=require(_0x4fde('0x0'));var rimraf=require(_0x4fde('0x1'));var zipdir=require(_0x4fde('0x2'));var jsonpatch=require(_0x4fde('0x3'));var rp=require(_0x4fde('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4fde('0x5'));var util=require(_0x4fde('0x6'));var path=require('path');var sox=require(_0x4fde('0x7'));var csv=require('to-csv');var ejs=require(_0x4fde('0x8'));var fs=require('fs');var fs_extra=require(_0x4fde('0x9'));var _=require(_0x4fde('0xa'));var squel=require('squel');var crypto=require(_0x4fde('0xb'));var jsforce=require(_0x4fde('0xc'));var deskjs=require(_0x4fde('0xd'));var toCsv=require(_0x4fde('0xe'));var querystring=require('querystring');var Papa=require(_0x4fde('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4fde('0x10'));var as=require(_0x4fde('0x11'));var hardwareService=require(_0x4fde('0x12'));var logger=require(_0x4fde('0x13'))(_0x4fde('0x14'));var utils=require(_0x4fde('0x15'));var config=require(_0x4fde('0x16'));var licenseUtil=require(_0x4fde('0x17'));var db=require(_0x4fde('0x18'))['db'];function respondWithStatusCode(_0x43b8b9,_0x3fe024){_0x3fe024=_0x3fe024||0xcc;return function(_0x15c34f){if(_0x15c34f){return _0x43b8b9[_0x4fde('0x19')](_0x3fe024);}return _0x43b8b9[_0x4fde('0x1a')](_0x3fe024)[_0x4fde('0x1b')]();};}function respondWithResult(_0x47ab4f,_0x1045fc){_0x1045fc=_0x1045fc||0xc8;return function(_0x5ced90){if(_0x5ced90){return _0x47ab4f[_0x4fde('0x1a')](_0x1045fc)['json'](_0x5ced90);}};}function respondWithFilteredResult(_0x3afdef,_0x3e131a){return function(_0x46e9ff){if(_0x46e9ff){var _0x5a5019=typeof _0x3e131a[_0x4fde('0x1c')]===_0x4fde('0x1d')&&typeof _0x3e131a[_0x4fde('0x1e')]===_0x4fde('0x1d');var _0x4a520c=_0x46e9ff[_0x4fde('0x1f')];var _0xc96d8e=_0x5a5019?0x0:_0x3e131a['offset'];var _0x4d89bd=_0x5a5019?_0x46e9ff[_0x4fde('0x1f')]:_0x3e131a[_0x4fde('0x1c')]+_0x3e131a[_0x4fde('0x1e')];var _0x5d6fab;if(_0x4d89bd>=_0x4a520c){_0x4d89bd=_0x4a520c;_0x5d6fab=0xc8;}else{_0x5d6fab=0xce;}_0x3afdef[_0x4fde('0x1a')](_0x5d6fab);return _0x3afdef['set'](_0x4fde('0x20'),_0xc96d8e+'-'+_0x4d89bd+'/'+_0x4a520c)[_0x4fde('0x21')](_0x46e9ff);}return null;};}function patchUpdates(_0x4a7289){return function(_0x47ed2d){try{jsonpatch[_0x4fde('0x22')](_0x47ed2d,_0x4a7289,!![]);}catch(_0x594c89){return BPromise[_0x4fde('0x23')](_0x594c89);}return _0x47ed2d[_0x4fde('0x24')]();};}function saveUpdates(_0x2252e9,_0x68fe94){return function(_0xd605ee){if(_0xd605ee){return _0xd605ee[_0x4fde('0x25')](_0x2252e9)[_0x4fde('0x26')](function(_0x5516af){return _0x5516af;});}return null;};}function removeEntity(_0x350c8c,_0x49c0b2){return function(_0x5296c7){if(_0x5296c7){return _0x5296c7[_0x4fde('0x27')]()['then'](function(){_0x350c8c['status'](0xcc)[_0x4fde('0x1b')]();});}};}function handleEntityNotFound(_0x83ae,_0x4d2012){return function(_0x12163b){if(!_0x12163b){_0x83ae['sendStatus'](0x194);}return _0x12163b;};}function handleError(_0x37626d,_0x554709){_0x554709=_0x554709||0x1f4;return function(_0x5e786e){logger[_0x4fde('0x28')](_0x5e786e['stack']);if(_0x5e786e[_0x4fde('0x29')]){delete _0x5e786e[_0x4fde('0x29')];}_0x37626d[_0x4fde('0x1a')](_0x554709)[_0x4fde('0x2a')](_0x5e786e);};}exports[_0x4fde('0x2b')]=function(_0x22439b,_0x2db787){var _0x4cabf3={},_0x494a2f={},_0x176db6={'count':0x0,'rows':[]};var _0x15776b=_[_0x4fde('0x2c')](db[_0x4fde('0x2d')]['rawAttributes'],function(_0x18d631){return{'name':_0x18d631[_0x4fde('0x2e')],'type':_0x18d631['type'][_0x4fde('0x2f')]};});_0x494a2f[_0x4fde('0x30')]=_['map'](_0x15776b,_0x4fde('0x29'));_0x494a2f[_0x4fde('0x31')]=_['keys'](_0x22439b['query']);_0x494a2f[_0x4fde('0x32')]=_[_0x4fde('0x33')](_0x494a2f[_0x4fde('0x30')],_0x494a2f['query']);_0x4cabf3[_0x4fde('0x34')]=_[_0x4fde('0x33')](_0x494a2f[_0x4fde('0x30')],qs[_0x4fde('0x35')](_0x22439b[_0x4fde('0x31')][_0x4fde('0x35')]));_0x4cabf3[_0x4fde('0x34')]=_0x4cabf3['attributes'][_0x4fde('0x36')]?_0x4cabf3[_0x4fde('0x34')]:_0x494a2f[_0x4fde('0x30')];if(!_0x22439b[_0x4fde('0x31')][_0x4fde('0x37')](_0x4fde('0x38'))){_0x4cabf3[_0x4fde('0x1e')]=qs[_0x4fde('0x1e')](_0x22439b[_0x4fde('0x31')][_0x4fde('0x1e')]);_0x4cabf3[_0x4fde('0x1c')]=qs[_0x4fde('0x1c')](_0x22439b['query'][_0x4fde('0x1c')]);}_0x4cabf3[_0x4fde('0x39')]=qs['sort'](_0x22439b[_0x4fde('0x31')][_0x4fde('0x3a')]);_0x4cabf3[_0x4fde('0x3b')]=qs['filters'](_[_0x4fde('0x3c')](_0x22439b['query'],_0x494a2f['filters']),_0x15776b);if(_0x22439b[_0x4fde('0x31')][_0x4fde('0x3d')]){_0x4cabf3[_0x4fde('0x3b')]=_[_0x4fde('0x3e')](_0x4cabf3[_0x4fde('0x3b')],{'$or':_[_0x4fde('0x2c')](_0x15776b,function(_0x357193){if(_0x357193[_0x4fde('0x3f')]!==_0x4fde('0x40')){var _0x116a55={};_0x116a55[_0x357193['name']]={'$like':'%'+_0x22439b[_0x4fde('0x31')][_0x4fde('0x3d')]+'%'};return _0x116a55;}})});}_0x4cabf3=_[_0x4fde('0x3e')]({},_0x4cabf3,_0x22439b[_0x4fde('0x41')]);var _0x147378={'where':_0x4cabf3['where']};return db[_0x4fde('0x2d')][_0x4fde('0x1f')](_0x147378)[_0x4fde('0x26')](function(_0x55b958){_0x176db6['count']=_0x55b958;if(_0x22439b[_0x4fde('0x31')][_0x4fde('0x42')]){_0x4cabf3[_0x4fde('0x43')]=[{'all':!![]}];}return db[_0x4fde('0x2d')][_0x4fde('0x44')](_0x4cabf3);})['then'](function(_0x40de70){_0x176db6[_0x4fde('0x45')]=_0x40de70;return _0x176db6;})[_0x4fde('0x26')](respondWithFilteredResult(_0x2db787,_0x4cabf3))[_0x4fde('0x46')](handleError(_0x2db787,null));};exports[_0x4fde('0x47')]=function(_0xd41290,_0x58b7e6){var _0x42fe2e={'raw':!![],'where':{'id':_0xd41290[_0x4fde('0x48')]['id']}},_0x8648d2={};_0x8648d2[_0x4fde('0x30')]=_[_0x4fde('0x49')](db[_0x4fde('0x2d')]['rawAttributes']);_0x8648d2['query']=_[_0x4fde('0x49')](_0xd41290['query']);_0x8648d2[_0x4fde('0x32')]=_['intersection'](_0x8648d2['model'],_0x8648d2[_0x4fde('0x31')]);_0x42fe2e[_0x4fde('0x34')]=_['intersection'](_0x8648d2[_0x4fde('0x30')],qs[_0x4fde('0x35')](_0xd41290[_0x4fde('0x31')][_0x4fde('0x35')]));_0x42fe2e[_0x4fde('0x34')]=_0x42fe2e[_0x4fde('0x34')][_0x4fde('0x36')]?_0x42fe2e[_0x4fde('0x34')]:_0x8648d2[_0x4fde('0x30')];if(_0xd41290[_0x4fde('0x31')][_0x4fde('0x42')]){_0x42fe2e[_0x4fde('0x43')]=[{'all':!![]}];}_0x42fe2e=_['merge']({},_0x42fe2e,_0xd41290['options']);return db[_0x4fde('0x2d')][_0x4fde('0x4a')](_0x42fe2e)['then'](handleEntityNotFound(_0x58b7e6,null))[_0x4fde('0x26')](respondWithResult(_0x58b7e6,null))[_0x4fde('0x46')](handleError(_0x58b7e6,null));};exports['create']=function(_0x267d7e,_0x190603){return db['Dynamics365Field']['create'](_0x267d7e[_0x4fde('0x4b')],{})[_0x4fde('0x26')](respondWithResult(_0x190603,0xc9))['catch'](handleError(_0x190603,null));};exports[_0x4fde('0x25')]=function(_0x87a32a,_0xc22cda){if(_0x87a32a[_0x4fde('0x4b')]['id']){delete _0x87a32a[_0x4fde('0x4b')]['id'];}return db[_0x4fde('0x2d')][_0x4fde('0x4a')]({'where':{'id':_0x87a32a['params']['id']}})['then'](handleEntityNotFound(_0xc22cda,null))[_0x4fde('0x26')](saveUpdates(_0x87a32a[_0x4fde('0x4b')],null))[_0x4fde('0x26')](respondWithResult(_0xc22cda,null))[_0x4fde('0x46')](handleError(_0xc22cda,null));};exports[_0x4fde('0x27')]=function(_0xdf91ae,_0x58acbe){return db[_0x4fde('0x2d')][_0x4fde('0x4a')]({'where':{'id':_0xdf91ae[_0x4fde('0x48')]['id']}})[_0x4fde('0x26')](handleEntityNotFound(_0x58acbe,null))[_0x4fde('0x26')](removeEntity(_0x58acbe,null))[_0x4fde('0x46')](handleError(_0x58acbe,null));}; \ No newline at end of file +var _0x83fa=['sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','include','rows','catch','show','params','keys','options','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x3af384,_0x2b2160){var _0x194aad=function(_0x39c9e4){while(--_0x39c9e4){_0x3af384['push'](_0x3af384['shift']());}};_0x194aad(++_0x2b2160);}(_0x83fa,0x11a));var _0xa83f=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x83fa[_0x31cb5f];return _0x586042;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa83f('0x0'));var jsonpatch=require(_0xa83f('0x1'));var rp=require(_0xa83f('0x2'));var moment=require(_0xa83f('0x3'));var BPromise=require(_0xa83f('0x4'));var Mustache=require('mustache');var util=require(_0xa83f('0x5'));var path=require('path');var sox=require(_0xa83f('0x6'));var csv=require(_0xa83f('0x7'));var ejs=require(_0xa83f('0x8'));var fs=require('fs');var fs_extra=require(_0xa83f('0x9'));var _=require('lodash');var squel=require(_0xa83f('0xa'));var crypto=require(_0xa83f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa83f('0xc'));var Papa=require(_0xa83f('0xd'));var Redis=require(_0xa83f('0xe'));var authService=require(_0xa83f('0xf'));var qs=require(_0xa83f('0x10'));var as=require(_0xa83f('0x11'));var hardwareService=require(_0xa83f('0x12'));var logger=require(_0xa83f('0x13'))(_0xa83f('0x14'));var utils=require('../../config/utils');var config=require(_0xa83f('0x15'));var licenseUtil=require(_0xa83f('0x16'));var db=require(_0xa83f('0x17'))['db'];function respondWithStatusCode(_0x48a743,_0x8312a2){_0x8312a2=_0x8312a2||0xcc;return function(_0x1bda39){if(_0x1bda39){return _0x48a743['sendStatus'](_0x8312a2);}return _0x48a743[_0xa83f('0x18')](_0x8312a2)[_0xa83f('0x19')]();};}function respondWithResult(_0xf7405e,_0xb280e3){_0xb280e3=_0xb280e3||0xc8;return function(_0x11bfb2){if(_0x11bfb2){return _0xf7405e[_0xa83f('0x18')](_0xb280e3)[_0xa83f('0x1a')](_0x11bfb2);}};}function respondWithFilteredResult(_0xaedd95,_0x497f40){return function(_0x1d629a){if(_0x1d629a){var _0x2db87d=typeof _0x497f40['offset']===_0xa83f('0x1b')&&typeof _0x497f40[_0xa83f('0x1c')]===_0xa83f('0x1b');var _0x439ac6=_0x1d629a[_0xa83f('0x1d')];var _0x1ca790=_0x2db87d?0x0:_0x497f40[_0xa83f('0x1e')];var _0x2ba0f1=_0x2db87d?_0x1d629a[_0xa83f('0x1d')]:_0x497f40[_0xa83f('0x1e')]+_0x497f40[_0xa83f('0x1c')];var _0x439dde;if(_0x2ba0f1>=_0x439ac6){_0x2ba0f1=_0x439ac6;_0x439dde=0xc8;}else{_0x439dde=0xce;}_0xaedd95['status'](_0x439dde);return _0xaedd95[_0xa83f('0x1f')]('Content-Range',_0x1ca790+'-'+_0x2ba0f1+'/'+_0x439ac6)[_0xa83f('0x1a')](_0x1d629a);}return null;};}function patchUpdates(_0x4178ce){return function(_0x48d9f4){try{jsonpatch[_0xa83f('0x20')](_0x48d9f4,_0x4178ce,!![]);}catch(_0x5950a4){return BPromise[_0xa83f('0x21')](_0x5950a4);}return _0x48d9f4[_0xa83f('0x22')]();};}function saveUpdates(_0x4e4695,_0x413ae0){return function(_0xf9544f){if(_0xf9544f){return _0xf9544f[_0xa83f('0x23')](_0x4e4695)[_0xa83f('0x24')](function(_0x720456){return _0x720456;});}return null;};}function removeEntity(_0x2f6bc9,_0x3fce36){return function(_0x1d0931){if(_0x1d0931){return _0x1d0931[_0xa83f('0x25')]()['then'](function(){_0x2f6bc9[_0xa83f('0x18')](0xcc)[_0xa83f('0x19')]();});}};}function handleEntityNotFound(_0x1cb048,_0x5252fc){return function(_0x13ee9c){if(!_0x13ee9c){_0x1cb048[_0xa83f('0x26')](0x194);}return _0x13ee9c;};}function handleError(_0x349838,_0x3b4712){_0x3b4712=_0x3b4712||0x1f4;return function(_0x573651){logger['error'](_0x573651[_0xa83f('0x27')]);if(_0x573651[_0xa83f('0x28')]){delete _0x573651['name'];}_0x349838['status'](_0x3b4712)[_0xa83f('0x29')](_0x573651);};}exports[_0xa83f('0x2a')]=function(_0x6b1523,_0x36cb00){var _0x696474={},_0x3eace3={},_0x48e3d6={'count':0x0,'rows':[]};var _0x2168d4=_[_0xa83f('0x2b')](db[_0xa83f('0x2c')][_0xa83f('0x2d')],function(_0x1fbdc8){return{'name':_0x1fbdc8['fieldName'],'type':_0x1fbdc8[_0xa83f('0x2e')][_0xa83f('0x2f')]};});_0x3eace3[_0xa83f('0x30')]=_['map'](_0x2168d4,'name');_0x3eace3[_0xa83f('0x31')]=_['keys'](_0x6b1523['query']);_0x3eace3[_0xa83f('0x32')]=_[_0xa83f('0x33')](_0x3eace3[_0xa83f('0x30')],_0x3eace3[_0xa83f('0x31')]);_0x696474[_0xa83f('0x34')]=_[_0xa83f('0x33')](_0x3eace3[_0xa83f('0x30')],qs['fields'](_0x6b1523[_0xa83f('0x31')][_0xa83f('0x35')]));_0x696474['attributes']=_0x696474[_0xa83f('0x34')][_0xa83f('0x36')]?_0x696474['attributes']:_0x3eace3[_0xa83f('0x30')];if(!_0x6b1523[_0xa83f('0x31')][_0xa83f('0x37')]('nolimit')){_0x696474[_0xa83f('0x1c')]=qs[_0xa83f('0x1c')](_0x6b1523[_0xa83f('0x31')][_0xa83f('0x1c')]);_0x696474[_0xa83f('0x1e')]=qs[_0xa83f('0x1e')](_0x6b1523[_0xa83f('0x31')][_0xa83f('0x1e')]);}_0x696474[_0xa83f('0x38')]=qs[_0xa83f('0x39')](_0x6b1523['query'][_0xa83f('0x39')]);_0x696474[_0xa83f('0x3a')]=qs[_0xa83f('0x32')](_[_0xa83f('0x3b')](_0x6b1523[_0xa83f('0x31')],_0x3eace3['filters']),_0x2168d4);if(_0x6b1523['query']['filter']){_0x696474['where']=_['merge'](_0x696474[_0xa83f('0x3a')],{'$or':_['map'](_0x2168d4,function(_0x32e8fe){if(_0x32e8fe[_0xa83f('0x2e')]!==_0xa83f('0x3c')){var _0x3a1520={};_0x3a1520[_0x32e8fe[_0xa83f('0x28')]]={'$like':'%'+_0x6b1523[_0xa83f('0x31')]['filter']+'%'};return _0x3a1520;}})});}_0x696474=_[_0xa83f('0x3d')]({},_0x696474,_0x6b1523['options']);var _0x5dab4a={'where':_0x696474['where']};return db[_0xa83f('0x2c')][_0xa83f('0x1d')](_0x5dab4a)[_0xa83f('0x24')](function(_0x11eb97){_0x48e3d6[_0xa83f('0x1d')]=_0x11eb97;if(_0x6b1523[_0xa83f('0x31')]['includeAll']){_0x696474[_0xa83f('0x3e')]=[{'all':!![]}];}return db[_0xa83f('0x2c')]['findAll'](_0x696474);})[_0xa83f('0x24')](function(_0x18f112){_0x48e3d6[_0xa83f('0x3f')]=_0x18f112;return _0x48e3d6;})[_0xa83f('0x24')](respondWithFilteredResult(_0x36cb00,_0x696474))[_0xa83f('0x40')](handleError(_0x36cb00,null));};exports[_0xa83f('0x41')]=function(_0x3b4811,_0x64eb6b){var _0x1567fe={'raw':!![],'where':{'id':_0x3b4811[_0xa83f('0x42')]['id']}},_0x1bccf5={};_0x1bccf5['model']=_[_0xa83f('0x43')](db[_0xa83f('0x2c')][_0xa83f('0x2d')]);_0x1bccf5[_0xa83f('0x31')]=_[_0xa83f('0x43')](_0x3b4811[_0xa83f('0x31')]);_0x1bccf5[_0xa83f('0x32')]=_[_0xa83f('0x33')](_0x1bccf5[_0xa83f('0x30')],_0x1bccf5[_0xa83f('0x31')]);_0x1567fe['attributes']=_[_0xa83f('0x33')](_0x1bccf5[_0xa83f('0x30')],qs[_0xa83f('0x35')](_0x3b4811[_0xa83f('0x31')][_0xa83f('0x35')]));_0x1567fe[_0xa83f('0x34')]=_0x1567fe[_0xa83f('0x34')]['length']?_0x1567fe['attributes']:_0x1bccf5[_0xa83f('0x30')];if(_0x3b4811[_0xa83f('0x31')]['includeAll']){_0x1567fe[_0xa83f('0x3e')]=[{'all':!![]}];}_0x1567fe=_['merge']({},_0x1567fe,_0x3b4811[_0xa83f('0x44')]);return db[_0xa83f('0x2c')][_0xa83f('0x45')](_0x1567fe)[_0xa83f('0x24')](handleEntityNotFound(_0x64eb6b,null))[_0xa83f('0x24')](respondWithResult(_0x64eb6b,null))[_0xa83f('0x40')](handleError(_0x64eb6b,null));};exports[_0xa83f('0x46')]=function(_0x27785d,_0x1860d1){return db[_0xa83f('0x2c')][_0xa83f('0x46')](_0x27785d[_0xa83f('0x47')],{})['then'](respondWithResult(_0x1860d1,0xc9))[_0xa83f('0x40')](handleError(_0x1860d1,null));};exports['update']=function(_0x262ea2,_0x571863){if(_0x262ea2['body']['id']){delete _0x262ea2['body']['id'];}return db['Dynamics365Field'][_0xa83f('0x45')]({'where':{'id':_0x262ea2['params']['id']}})[_0xa83f('0x24')](handleEntityNotFound(_0x571863,null))[_0xa83f('0x24')](saveUpdates(_0x262ea2['body'],null))['then'](respondWithResult(_0x571863,null))[_0xa83f('0x40')](handleError(_0x571863,null));};exports[_0xa83f('0x25')]=function(_0x2cabd2,_0x2dfc6d){return db[_0xa83f('0x2c')][_0xa83f('0x45')]({'where':{'id':_0x2cabd2['params']['id']}})['then'](handleEntityNotFound(_0x2dfc6d,null))[_0xa83f('0x24')](removeEntity(_0x2dfc6d,null))[_0xa83f('0x40')](handleError(_0x2dfc6d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index fc25c2e..34cdcd7 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 _0x2643=['bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x2f1fd7,_0x370064){var _0x125811=function(_0x2d9209){while(--_0x2d9209){_0x2f1fd7['push'](_0x2f1fd7['shift']());}};_0x125811(++_0x370064);}(_0x2643,0x169));var _0x3264=function(_0x3c560a,_0x5daaff){_0x3c560a=_0x3c560a-0x0;var _0x461527=_0x2643[_0x3c560a];return _0x461527;};'use strict';var _=require(_0x3264('0x0'));var util=require('util');var logger=require(_0x3264('0x1'))(_0x3264('0x2'));var moment=require('moment');var BPromise=require(_0x3264('0x3'));var rp=require(_0x3264('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3264('0x5'));var config=require(_0x3264('0x6'));var attributes=require(_0x3264('0x7'));module[_0x3264('0x8')]=function(_0x2f05ab,_0x3b8782){return _0x2f05ab['define']('Dynamics365Field',attributes,{'tableName':_0x3264('0x9'),'paranoid':![],'indexes':[{'name':_0x3264('0xa'),'fields':[_0x3264('0xb'),_0x3264('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8aab=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x55cdec,_0x4bd2d6){var _0x36a0a1=function(_0x43bc02){while(--_0x43bc02){_0x55cdec['push'](_0x55cdec['shift']());}};_0x36a0a1(++_0x4bd2d6);}(_0x8aab,0xc3));var _0xb8aa=function(_0x16b791,_0x1af83b){_0x16b791=_0x16b791-0x0;var _0x543772=_0x8aab[_0x16b791];return _0x543772;};'use strict';var _=require(_0xb8aa('0x0'));var util=require(_0xb8aa('0x1'));var logger=require(_0xb8aa('0x2'))(_0xb8aa('0x3'));var moment=require(_0xb8aa('0x4'));var BPromise=require(_0xb8aa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8aa('0x6'));var rimraf=require(_0xb8aa('0x7'));var config=require('../../config/environment');var attributes=require(_0xb8aa('0x8'));module[_0xb8aa('0x9')]=function(_0x806822,_0x52fd2d){return _0x806822[_0xb8aa('0xa')]('Dynamics365Field',attributes,{'tableName':_0xb8aa('0xb'),'paranoid':![],'indexes':[{'name':_0xb8aa('0xc'),'fields':[_0xb8aa('0xd'),_0xb8aa('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 fb6c95c..d35f114 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 _0xe6e9=['Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xa0a23e,_0x32c3c7){var _0xdfbe8e=function(_0x350f02){while(--_0x350f02){_0xa0a23e['push'](_0xa0a23e['shift']());}};_0xdfbe8e(++_0x32c3c7);}(_0xe6e9,0x182));var _0x9e6e=function(_0x17a3ce,_0x4a2810){_0x17a3ce=_0x17a3ce-0x0;var _0x341475=_0xe6e9[_0x17a3ce];return _0x341475;};'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});function respondWithRpcPromise(_0x174aaa,_0x5eda3e,_0x165666){return new BPromise(function(_0x2bf742,_0x2b8c88){return client[_0x9e6e('0xc')](_0x174aaa,_0x165666)[_0x9e6e('0xd')](function(_0x42b7ed){logger['info'](_0x9e6e('0xe'),_0x5eda3e,_0x9e6e('0xf'));logger[_0x9e6e('0x10')](_0x9e6e('0x11'),_0x5eda3e,'request\x20sent',JSON[_0x9e6e('0x12')](_0x42b7ed));if(_0x42b7ed[_0x9e6e('0x13')]){if(_0x42b7ed['error'][_0x9e6e('0x14')]===0x1f4){logger[_0x9e6e('0x13')](_0x9e6e('0xe'),_0x5eda3e,_0x42b7ed[_0x9e6e('0x13')]['message']);return _0x2b8c88(_0x42b7ed[_0x9e6e('0x13')][_0x9e6e('0x15')]);}logger[_0x9e6e('0x13')](_0x9e6e('0xe'),_0x5eda3e,_0x42b7ed[_0x9e6e('0x13')][_0x9e6e('0x15')]);return _0x2bf742(_0x42b7ed[_0x9e6e('0x13')][_0x9e6e('0x15')]);}else{logger[_0x9e6e('0x16')](_0x9e6e('0xe'),_0x5eda3e,_0x9e6e('0xf'));_0x2bf742(_0x42b7ed[_0x9e6e('0x17')][_0x9e6e('0x15')]);}})[_0x9e6e('0x18')](function(_0x452bc3){logger[_0x9e6e('0x13')](_0x9e6e('0xe'),_0x5eda3e,_0x452bc3);_0x2b8c88(_0x452bc3);});});} \ No newline at end of file +var _0xd663=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xd663,0x1ed));var _0x3d66=function(_0x3bc0c9,_0x127784){_0x3bc0c9=_0x3bc0c9-0x0;var _0x4f68f8=_0xd663[_0x3bc0c9];return _0x4f68f8;};'use strict';var _=require(_0x3d66('0x0'));var util=require(_0x3d66('0x1'));var moment=require('moment');var BPromise=require(_0x3d66('0x2'));var rs=require(_0x3d66('0x3'));var fs=require('fs');var Redis=require(_0x3d66('0x4'));var db=require(_0x3d66('0x5'))['db'];var utils=require(_0x3d66('0x6'));var logger=require('../../config/logger')(_0x3d66('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2783f6,_0x4ad571,_0x50a1aa){return new BPromise(function(_0x3b6a81,_0x10a510){return client[_0x3d66('0x8')](_0x2783f6,_0x50a1aa)[_0x3d66('0x9')](function(_0x8cc498){logger[_0x3d66('0xa')](_0x3d66('0xb'),_0x4ad571,'request\x20sent');logger[_0x3d66('0xc')](_0x3d66('0xd'),_0x4ad571,_0x3d66('0xe'),JSON['stringify'](_0x8cc498));if(_0x8cc498[_0x3d66('0xf')]){if(_0x8cc498[_0x3d66('0xf')][_0x3d66('0x10')]===0x1f4){logger['error'](_0x3d66('0xb'),_0x4ad571,_0x8cc498[_0x3d66('0xf')][_0x3d66('0x11')]);return _0x10a510(_0x8cc498[_0x3d66('0xf')]['message']);}logger[_0x3d66('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x4ad571,_0x8cc498[_0x3d66('0xf')][_0x3d66('0x11')]);return _0x3b6a81(_0x8cc498[_0x3d66('0xf')][_0x3d66('0x11')]);}else{logger[_0x3d66('0xa')](_0x3d66('0xb'),_0x4ad571,'request\x20sent');_0x3b6a81(_0x8cc498['result'][_0x3d66('0x11')]);}})[_0x3d66('0x12')](function(_0x4bd10f){logger[_0x3d66('0xf')](_0x3d66('0xb'),_0x4ad571,_0x4bd10f);_0x10a510(_0x4bd10f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 031fd9a..197d0c1 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 _0xb120=['show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','/:id','delete','destroy','multer','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3ef324,_0x4968d1){var _0x383d57=function(_0x1b62cb){while(--_0x1b62cb){_0x3ef324['push'](_0x3ef324['shift']());}};_0x383d57(++_0x4968d1);}(_0xb120,0x1a8));var _0x0b12=function(_0x142dcb,_0x56cbeb){_0x142dcb=_0x142dcb-0x0;var _0x538520=_0xb120[_0x142dcb];return _0x538520;};'use strict';var multer=require(_0x0b12('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0b12('0x1'));var router=express[_0x0b12('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0b12('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0b12('0x4'));var controller=require('./intFreshdeskAccount.controller');router[_0x0b12('0x5')]('/',auth[_0x0b12('0x6')](),controller[_0x0b12('0x7')]);router[_0x0b12('0x5')]('/:id',auth[_0x0b12('0x6')](),controller[_0x0b12('0x8')]);router['get'](_0x0b12('0x9'),auth[_0x0b12('0x6')](),controller[_0x0b12('0xa')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x0b12('0xb')]);router['post']('/',auth[_0x0b12('0x6')](),controller[_0x0b12('0xc')]);router[_0x0b12('0xd')](_0x0b12('0x9'),auth['isAuthenticated'](),controller[_0x0b12('0xe')]);router['put'](_0x0b12('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x0b12('0x10')](_0x0b12('0xf'),auth[_0x0b12('0x6')](),controller[_0x0b12('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb907=['/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0xb907,0x19f));var _0x7b90=function(_0x2855a6,_0x22f356){_0x2855a6=_0x2855a6-0x0;var _0x5eff03=_0xb907[_0x2855a6];return _0x5eff03;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7b90('0x0'));var express=require(_0x7b90('0x1'));var router=express[_0x7b90('0x2')]();var fs_extra=require(_0x7b90('0x3'));var auth=require(_0x7b90('0x4'));var interaction=require(_0x7b90('0x5'));var config=require(_0x7b90('0x6'));var controller=require(_0x7b90('0x7'));router[_0x7b90('0x8')]('/',auth['isAuthenticated'](),controller[_0x7b90('0x9')]);router['get'](_0x7b90('0xa'),auth[_0x7b90('0xb')](),controller[_0x7b90('0xc')]);router[_0x7b90('0x8')]('/:id/configurations',auth[_0x7b90('0xb')](),controller[_0x7b90('0xd')]);router[_0x7b90('0x8')](_0x7b90('0xe'),auth[_0x7b90('0xb')](),controller[_0x7b90('0xf')]);router[_0x7b90('0x10')]('/',auth[_0x7b90('0xb')](),controller[_0x7b90('0x11')]);router['post'](_0x7b90('0x12'),auth['isAuthenticated'](),controller[_0x7b90('0x13')]);router[_0x7b90('0x14')](_0x7b90('0xa'),auth[_0x7b90('0xb')](),controller[_0x7b90('0x15')]);router[_0x7b90('0x16')](_0x7b90('0xa'),auth[_0x7b90('0xb')](),controller[_0x7b90('0x17')]);module[_0x7b90('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 199352d..4745aec 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 _0x1e00=['username','sequelize','STRING'];(function(_0x44389c,_0x73f05e){var _0x329b1b=function(_0x18aab4){while(--_0x18aab4){_0x44389c['push'](_0x44389c['shift']());}};_0x329b1b(++_0x73f05e);}(_0x1e00,0xa3));var _0x01e0=function(_0x5d9e7f,_0x371657){_0x5d9e7f=_0x5d9e7f-0x0;var _0x50053a=_0x1e00[_0x5d9e7f];return _0x50053a;};'use strict';var Sequelize=require(_0x01e0('0x0'));module['exports']={'name':{'type':Sequelize[_0x01e0('0x1')]},'description':{'type':Sequelize[_0x01e0('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x01e0('0x2')},'apiKey':{'type':Sequelize[_0x01e0('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x18cb=['STRING','username','remoteUri','sequelize','exports'];(function(_0x52643d,_0x469153){var _0x234a34=function(_0x2210c8){while(--_0x2210c8){_0x52643d['push'](_0x52643d['shift']());}};_0x234a34(++_0x469153);}(_0x18cb,0x85));var _0xb18c=function(_0x53e6dc,_0xee86ac){_0x53e6dc=_0x53e6dc-0x0;var _0x540d52=_0x18cb[_0x53e6dc];return _0x540d52;};'use strict';var Sequelize=require(_0xb18c('0x0'));module[_0xb18c('0x1')]={'name':{'type':Sequelize[_0xb18c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb18c('0x2')],'unique':_0xb18c('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb18c('0x2')],'unique':_0xb18c('0x4')},'serverUrl':{'type':Sequelize[_0xb18c('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 e1e3928..9d15815 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 _0xcd7c=['util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','stack','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','filter','merge','map','name','options','FreshdeskAccount','include','findAll','rows','show','length','includeAll','find','create','body','update','params','getConfigurations','findOne','FreshdeskConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','custom_text','custom_dropdown','default','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2ce655,_0x567922){var _0x4c1c57=function(_0x316e68){while(--_0x316e68){_0x2ce655['push'](_0x2ce655['shift']());}};_0x4c1c57(++_0x567922);}(_0xcd7c,0x104));var _0xccd7=function(_0x41ea14,_0x56c3f8){_0x41ea14=_0x41ea14-0x0;var _0x1b5681=_0xcd7c[_0x41ea14];return _0x1b5681;};'use strict';var emlformat=require(_0xccd7('0x0'));var rimraf=require(_0xccd7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xccd7('0x2'));var rp=require(_0xccd7('0x3'));var moment=require(_0xccd7('0x4'));var BPromise=require(_0xccd7('0x5'));var Mustache=require('mustache');var util=require(_0xccd7('0x6'));var path=require(_0xccd7('0x7'));var sox=require(_0xccd7('0x8'));var csv=require('to-csv');var ejs=require(_0xccd7('0x9'));var fs=require('fs');var fs_extra=require(_0xccd7('0xa'));var _=require(_0xccd7('0xb'));var squel=require('squel');var crypto=require(_0xccd7('0xc'));var jsforce=require(_0xccd7('0xd'));var deskjs=require(_0xccd7('0xe'));var toCsv=require('to-csv');var querystring=require(_0xccd7('0xf'));var Papa=require('papaparse');var Redis=require(_0xccd7('0x10'));var authService=require(_0xccd7('0x11'));var qs=require(_0xccd7('0x12'));var as=require(_0xccd7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccd7('0x14'))(_0xccd7('0x15'));var utils=require(_0xccd7('0x16'));var config=require(_0xccd7('0x17'));var licenseUtil=require(_0xccd7('0x18'));var db=require(_0xccd7('0x19'))['db'];var integrations=require(_0xccd7('0x1a'));var jayson=require(_0xccd7('0x1b'));var client=jayson[_0xccd7('0x1c')][_0xccd7('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4778ce,_0x318a94,_0x17e6a6,_0x15b799){return new BPromise(function(_0x5e5325,_0x2db7a2){var _0x18badb=_0x15b799||client;return _0x18badb[_0xccd7('0x1e')](_0x4778ce,_0x17e6a6)[_0xccd7('0x1f')](function(_0x5c1821){logger[_0xccd7('0x20')](_0xccd7('0x21'),_0x318a94,_0xccd7('0x22'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x318a94,_0xccd7('0x22'),JSON['stringify'](_0x5c1821));if(_0x5c1821[_0xccd7('0x23')]){if(_0x5c1821[_0xccd7('0x23')][_0xccd7('0x24')]===0x1f4){logger[_0xccd7('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x318a94,_0x5c1821[_0xccd7('0x23')][_0xccd7('0x25')]);return _0x2db7a2(_0x5c1821[_0xccd7('0x23')]['message']);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x318a94,_0x5c1821[_0xccd7('0x23')]['message']);return _0x5e5325(_0x5c1821['error'][_0xccd7('0x25')]);}else{logger['info'](_0xccd7('0x21'),_0x318a94,_0xccd7('0x22'));_0x5e5325(_0x5c1821[_0xccd7('0x26')]['message']);}})[_0xccd7('0x27')](function(_0x3c8a00){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x318a94,_0x3c8a00);_0x2db7a2(_0x3c8a00);});});}function respondWithStatusCode(_0x552b07,_0x2c7671){_0x2c7671=_0x2c7671||0xcc;return function(_0x187189){if(_0x187189){return _0x552b07[_0xccd7('0x28')](_0x2c7671);}return _0x552b07[_0xccd7('0x29')](_0x2c7671)[_0xccd7('0x2a')]();};}function respondWithResult(_0x222073,_0x4928ca){_0x4928ca=_0x4928ca||0xc8;return function(_0x1a32ea){if(_0x1a32ea){return _0x222073['status'](_0x4928ca)[_0xccd7('0x2b')](_0x1a32ea);}};}function respondWithFilteredResult(_0x263283,_0x514faf){return function(_0x457d6f){if(_0x457d6f){var _0xcbef76=typeof _0x514faf[_0xccd7('0x2c')]==='undefined'&&typeof _0x514faf[_0xccd7('0x2d')]===_0xccd7('0x2e');var _0x42aaf9=_0x457d6f[_0xccd7('0x2f')];var _0x44c428=_0xcbef76?0x0:_0x514faf['offset'];var _0x2c324f=_0xcbef76?_0x457d6f['count']:_0x514faf[_0xccd7('0x2c')]+_0x514faf[_0xccd7('0x2d')];var _0x552dd4;if(_0x2c324f>=_0x42aaf9){_0x2c324f=_0x42aaf9;_0x552dd4=0xc8;}else{_0x552dd4=0xce;}_0x263283['status'](_0x552dd4);return _0x263283[_0xccd7('0x30')](_0xccd7('0x31'),_0x44c428+'-'+_0x2c324f+'/'+_0x42aaf9)[_0xccd7('0x2b')](_0x457d6f);}return null;};}function patchUpdates(_0x15170a){return function(_0x3a9d8c){try{jsonpatch[_0xccd7('0x32')](_0x3a9d8c,_0x15170a,!![]);}catch(_0x1960cb){return BPromise[_0xccd7('0x33')](_0x1960cb);}return _0x3a9d8c[_0xccd7('0x34')]();};}function saveUpdates(_0x25badc,_0x3b5b07){return function(_0x33eb0c){if(_0x33eb0c){return _0x33eb0c['update'](_0x25badc)[_0xccd7('0x1f')](function(_0x1e9bc4){return _0x1e9bc4;});}return null;};}function removeEntity(_0x4f69d2,_0x66e256){return function(_0x46d3f1){if(_0x46d3f1){return _0x46d3f1[_0xccd7('0x35')]()['then'](function(){_0x4f69d2[_0xccd7('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5661c7,_0x3a755e){return function(_0x230f08){if(!_0x230f08){_0x5661c7['sendStatus'](0x194);}return _0x230f08;};}function handleError(_0x229769,_0x310433){_0x310433=_0x310433||0x1f4;return function(_0x576bc6){logger[_0xccd7('0x23')](_0x576bc6[_0xccd7('0x36')]);if(_0x576bc6['name']){delete _0x576bc6['name'];}_0x229769[_0xccd7('0x29')](_0x310433)['send'](_0x576bc6);};}exports[_0xccd7('0x37')]=function(_0x1eb289,_0x1e3158){var _0x473bdc={},_0x23712e={},_0x3def79={'count':0x0,'rows':[]};var _0x1bc462=_['map'](db['FreshdeskAccount'][_0xccd7('0x38')],function(_0x4e73be){return{'name':_0x4e73be[_0xccd7('0x39')],'type':_0x4e73be[_0xccd7('0x3a')][_0xccd7('0x3b')]};});_0x23712e[_0xccd7('0x3c')]=_['map'](_0x1bc462,'name');_0x23712e[_0xccd7('0x3d')]=_[_0xccd7('0x3e')](_0x1eb289[_0xccd7('0x3d')]);_0x23712e[_0xccd7('0x3f')]=_[_0xccd7('0x40')](_0x23712e['model'],_0x23712e['query']);_0x473bdc[_0xccd7('0x41')]=_[_0xccd7('0x40')](_0x23712e[_0xccd7('0x3c')],qs['fields'](_0x1eb289[_0xccd7('0x3d')][_0xccd7('0x42')]));_0x473bdc[_0xccd7('0x41')]=_0x473bdc[_0xccd7('0x41')]['length']?_0x473bdc[_0xccd7('0x41')]:_0x23712e['model'];if(!_0x1eb289[_0xccd7('0x3d')]['hasOwnProperty'](_0xccd7('0x43'))){_0x473bdc['limit']=qs['limit'](_0x1eb289[_0xccd7('0x3d')]['limit']);_0x473bdc['offset']=qs['offset'](_0x1eb289['query'][_0xccd7('0x2c')]);}_0x473bdc['order']=qs[_0xccd7('0x44')](_0x1eb289['query'][_0xccd7('0x44')]);_0x473bdc[_0xccd7('0x45')]=qs[_0xccd7('0x3f')](_['pick'](_0x1eb289[_0xccd7('0x3d')],_0x23712e[_0xccd7('0x3f')]),_0x1bc462);if(_0x1eb289[_0xccd7('0x3d')][_0xccd7('0x46')]){_0x473bdc['where']=_[_0xccd7('0x47')](_0x473bdc['where'],{'$or':_[_0xccd7('0x48')](_0x1bc462,function(_0x6854b8){if(_0x6854b8[_0xccd7('0x3a')]!=='VIRTUAL'){var _0x30c637={};_0x30c637[_0x6854b8[_0xccd7('0x49')]]={'$like':'%'+_0x1eb289[_0xccd7('0x3d')][_0xccd7('0x46')]+'%'};return _0x30c637;}})});}_0x473bdc=_[_0xccd7('0x47')]({},_0x473bdc,_0x1eb289[_0xccd7('0x4a')]);var _0x547c68={'where':_0x473bdc['where']};return db[_0xccd7('0x4b')][_0xccd7('0x2f')](_0x547c68)[_0xccd7('0x1f')](function(_0x2985cb){_0x3def79[_0xccd7('0x2f')]=_0x2985cb;if(_0x1eb289[_0xccd7('0x3d')]['includeAll']){_0x473bdc[_0xccd7('0x4c')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xccd7('0x4d')](_0x473bdc);})['then'](function(_0x1a3f52){_0x3def79[_0xccd7('0x4e')]=_0x1a3f52;return _0x3def79;})['then'](respondWithFilteredResult(_0x1e3158,_0x473bdc))['catch'](handleError(_0x1e3158,null));};exports[_0xccd7('0x4f')]=function(_0x30d9ae,_0xd79c34){var _0x27c734={'raw':![],'where':{'id':_0x30d9ae['params']['id']}},_0x459c65={};_0x459c65[_0xccd7('0x3c')]=_['keys'](db[_0xccd7('0x4b')][_0xccd7('0x38')]);_0x459c65[_0xccd7('0x3d')]=_['keys'](_0x30d9ae['query']);_0x459c65[_0xccd7('0x3f')]=_['intersection'](_0x459c65['model'],_0x459c65[_0xccd7('0x3d')]);_0x27c734['attributes']=_['intersection'](_0x459c65[_0xccd7('0x3c')],qs[_0xccd7('0x42')](_0x30d9ae[_0xccd7('0x3d')][_0xccd7('0x42')]));_0x27c734[_0xccd7('0x41')]=_0x27c734[_0xccd7('0x41')][_0xccd7('0x50')]?_0x27c734[_0xccd7('0x41')]:_0x459c65['model'];if(_0x30d9ae[_0xccd7('0x3d')][_0xccd7('0x51')]){_0x27c734['include']=[{'all':!![]}];}_0x27c734=_[_0xccd7('0x47')]({},_0x27c734,_0x30d9ae[_0xccd7('0x4a')]);return db[_0xccd7('0x4b')][_0xccd7('0x52')](_0x27c734)['then'](handleEntityNotFound(_0xd79c34,null))[_0xccd7('0x1f')](respondWithResult(_0xd79c34,null))[_0xccd7('0x27')](handleError(_0xd79c34,null));};exports[_0xccd7('0x53')]=function(_0x2b918a,_0x3dfa55){return db[_0xccd7('0x4b')][_0xccd7('0x53')](_0x2b918a[_0xccd7('0x54')],{})[_0xccd7('0x1f')](respondWithResult(_0x3dfa55,0xc9))[_0xccd7('0x27')](handleError(_0x3dfa55,null));};exports[_0xccd7('0x55')]=function(_0x2b1a86,_0x265b9a){if(_0x2b1a86[_0xccd7('0x54')]['id']){delete _0x2b1a86[_0xccd7('0x54')]['id'];}return db[_0xccd7('0x4b')][_0xccd7('0x52')]({'where':{'id':_0x2b1a86[_0xccd7('0x56')]['id']}})[_0xccd7('0x1f')](handleEntityNotFound(_0x265b9a,null))[_0xccd7('0x1f')](saveUpdates(_0x2b1a86['body'],null))['then'](respondWithResult(_0x265b9a,null))[_0xccd7('0x27')](handleError(_0x265b9a,null));};exports['destroy']=function(_0x956670,_0x2ea8e3){return db[_0xccd7('0x4b')][_0xccd7('0x52')]({'where':{'id':_0x956670[_0xccd7('0x56')]['id']}})[_0xccd7('0x1f')](handleEntityNotFound(_0x2ea8e3,null))[_0xccd7('0x1f')](removeEntity(_0x2ea8e3,null))['catch'](handleError(_0x2ea8e3,null));};exports[_0xccd7('0x57')]=function(_0x4ffb2e,_0x447249,_0x32fd6f){var _0x4c27ae={};var _0x45bbf6={};var _0x20cbd8;var _0x47a05a;return db[_0xccd7('0x4b')][_0xccd7('0x58')]({'where':{'id':_0x4ffb2e[_0xccd7('0x56')]['id']}})['then'](handleEntityNotFound(_0x447249,null))[_0xccd7('0x1f')](function(_0x337544){if(_0x337544){_0x20cbd8=_0x337544;_0x45bbf6[_0xccd7('0x3c')]=_[_0xccd7('0x3e')](db[_0xccd7('0x59')][_0xccd7('0x38')]);_0x45bbf6['query']=_[_0xccd7('0x3e')](_0x4ffb2e['query']);_0x45bbf6['filters']=_[_0xccd7('0x40')](_0x45bbf6[_0xccd7('0x3c')],_0x45bbf6[_0xccd7('0x3d')]);_0x4c27ae[_0xccd7('0x41')]=_[_0xccd7('0x40')](_0x45bbf6['model'],qs[_0xccd7('0x42')](_0x4ffb2e[_0xccd7('0x3d')][_0xccd7('0x42')]));_0x4c27ae[_0xccd7('0x41')]=_0x4c27ae[_0xccd7('0x41')]['length']?_0x4c27ae[_0xccd7('0x41')]:_0x45bbf6[_0xccd7('0x3c')];_0x4c27ae[_0xccd7('0x5a')]=qs[_0xccd7('0x44')](_0x4ffb2e[_0xccd7('0x3d')][_0xccd7('0x44')]);_0x4c27ae['where']=qs[_0xccd7('0x3f')](_['pick'](_0x4ffb2e[_0xccd7('0x3d')],_0x45bbf6[_0xccd7('0x3f')]));if(_0x4ffb2e[_0xccd7('0x3d')][_0xccd7('0x46')]){_0x4c27ae[_0xccd7('0x45')]=_['merge'](_0x4c27ae[_0xccd7('0x45')],{'$or':_[_0xccd7('0x48')](_0x4c27ae[_0xccd7('0x41')],function(_0x341eda){var _0x1dcf27={};_0x1dcf27[_0x341eda]={'$like':'%'+_0x4ffb2e[_0xccd7('0x3d')][_0xccd7('0x46')]+'%'};return _0x1dcf27;})});}_0x4c27ae=_[_0xccd7('0x47')]({},_0x4c27ae,_0x4ffb2e[_0xccd7('0x4a')]);return _0x20cbd8[_0xccd7('0x57')](_0x4c27ae);}})['then'](function(_0x24c63d){if(_0x24c63d){_0x47a05a=_0x24c63d[_0xccd7('0x50')];if(!_0x4ffb2e[_0xccd7('0x3d')][_0xccd7('0x5b')](_0xccd7('0x43'))){_0x4c27ae[_0xccd7('0x2d')]=qs['limit'](_0x4ffb2e[_0xccd7('0x3d')][_0xccd7('0x2d')]);_0x4c27ae[_0xccd7('0x2c')]=qs['offset'](_0x4ffb2e['query']['offset']);}return _0x20cbd8[_0xccd7('0x57')](_0x4c27ae);}})[_0xccd7('0x1f')](function(_0x2c74b9){if(_0x2c74b9){return _0x2c74b9?{'count':_0x47a05a,'rows':_0x2c74b9}:null;}})[_0xccd7('0x1f')](respondWithResult(_0x447249,null))[_0xccd7('0x27')](handleError(_0x447249,null));};exports[_0xccd7('0x5c')]=function(_0x4baa7f,_0x27b52f,_0x3cef01){if(_0x4baa7f[_0xccd7('0x54')]['id']){delete _0x4baa7f['body']['id'];}return db['FreshdeskAccount'][_0xccd7('0x58')]({'where':{'id':_0x4baa7f[_0xccd7('0x56')]['id']}})['then'](handleEntityNotFound(_0x27b52f,null))[_0xccd7('0x1f')](function(_0x5e70a0){if(_0x5e70a0){_0x4baa7f[_0xccd7('0x54')][_0xccd7('0x5d')]=_0x5e70a0['id'];_0x4baa7f[_0xccd7('0x54')][_0xccd7('0x5e')]=integrations[_0xccd7('0x5f')](_0x4baa7f[_0xccd7('0x54')]['channel'],_0x4baa7f[_0xccd7('0x54')][_0xccd7('0x3a')]);_0x4baa7f[_0xccd7('0x54')][_0xccd7('0x60')]=integrations[_0xccd7('0x61')](_0x4baa7f[_0xccd7('0x54')][_0xccd7('0x62')],_0x4baa7f['body'][_0xccd7('0x3a')]);return db[_0xccd7('0x59')][_0xccd7('0x53')](_0x4baa7f[_0xccd7('0x54')],{'include':[{'model':db[_0xccd7('0x63')],'as':_0xccd7('0x5e')},{'model':db[_0xccd7('0x63')],'as':_0xccd7('0x60')}]});}return null;})[_0xccd7('0x1f')](respondWithResult(_0x27b52f,null))[_0xccd7('0x27')](handleError(_0x27b52f,null));};exports['getFields']=function(_0x5d4173,_0x2e73b2,_0x28eb00){var _0x57ee4d='';return db['FreshdeskAccount'][_0xccd7('0x58')]({'where':{'id':_0x5d4173['params']['id']},'attributes':['id','remoteUri',_0xccd7('0x64')]})['then'](handleEntityNotFound(_0x2e73b2,null))[_0xccd7('0x1f')](function(_0x2a2198){if(_0x2a2198){_0x57ee4d=_0x2a2198[_0xccd7('0x65')];var _0x1c0bb4=_0x57ee4d[_0xccd7('0x66')](-0x1);if(_0x1c0bb4==='/'){_0x57ee4d=_0x57ee4d[_0xccd7('0x67')](0x0,_0x57ee4d[_0xccd7('0x68')](_0x1c0bb4));}return rp({'method':_0xccd7('0x69'),'uri':util[_0xccd7('0x6a')](_0xccd7('0x6b'),_0x57ee4d,_0xccd7('0x6c')),'headers':{'Authorization':util[_0xccd7('0x6a')]('Basic\x20%s',new Buffer(util[_0xccd7('0x6a')](_0xccd7('0x6d'),_0x2a2198[_0xccd7('0x64')]))[_0xccd7('0x6e')](_0xccd7('0x6f')))},'json':!![]});}})['then'](function(_0x11576f){if(_0x11576f){var _0x5836e5=['requester',_0xccd7('0x70'),_0xccd7('0x71'),_0xccd7('0x72'),_0xccd7('0x29'),_0xccd7('0x73'),_0xccd7('0x74'),_0xccd7('0x75'),_0xccd7('0x76'),'group',_0xccd7('0x77')];_[_0xccd7('0x78')](_0x11576f,function(_0x518795){return _0x5836e5[_0xccd7('0x79')](_0x518795[_0xccd7('0x49')])||!_0x518795['default']&&_0x518795['type']!==_0xccd7('0x7a')&&_0x518795[_0xccd7('0x3a')]!==_0xccd7('0x7b');});return{'count':_0x11576f[_0xccd7('0x50')],'rows':_[_0xccd7('0x48')](_0x11576f,function(_0x1b6a63){return{'id':_0x1b6a63[_0xccd7('0x49')],'name':_0x1b6a63['label'],'custom':!_0x1b6a63[_0xccd7('0x7c')],'options':_0x1b6a63['choices']?_[_0xccd7('0x48')](_0x1b6a63[_0xccd7('0x7d')],function(_0x45e312){return{'name':_[_0xccd7('0x7e')](_0x45e312),'value':_0x45e312};}):[]};})};}})[_0xccd7('0x1f')](respondWithResult(_0x2e73b2,null))[_0xccd7('0x27')](function(_0x50b944){var _0xb85874=_0x5d4173[_0xccd7('0x3d')][_0xccd7('0x7f')]?0x1f4:_0x50b944['statusCode']||0x1f4;logger[_0xccd7('0x23')](_0xccd7('0x80'),'getFields',_0xb85874,JSON[_0xccd7('0x81')](_0x50b944));delete _0x50b944[_0xccd7('0x49')];if(_0xb85874===0x191){_0xb85874=0x190;}_0x2e73b2[_0xccd7('0x29')](_0xb85874)[_0xccd7('0x82')](_0x5d4173[_0xccd7('0x3d')][_0xccd7('0x7f')]?{'message':_0xccd7('0x83'),'statusCode':_0x50b944[_0xccd7('0x84')]}:_0x50b944);});}; \ No newline at end of file +var _0x2ed3=['Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','filter','where','merge','options','includeAll','include','findAll','rows','show','params','fields','find','create','body','getConfigurations','FreshdeskConfiguration','sort','pick','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','toString','requester','agent','description','priority','group','source','ticket_type','company','remove','includes','custom_text','custom_dropdown','default','choices','statusCode','send','test'];(function(_0x3582a1,_0x38314a){var _0x5054c0=function(_0x4bc158){while(--_0x4bc158){_0x3582a1['push'](_0x3582a1['shift']());}};_0x5054c0(++_0x38314a);}(_0x2ed3,0x7c));var _0x32ed=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0x2ed3[_0x2b55b5];return _0x103d28;};'use strict';var emlformat=require(_0x32ed('0x0'));var rimraf=require(_0x32ed('0x1'));var zipdir=require(_0x32ed('0x2'));var jsonpatch=require(_0x32ed('0x3'));var rp=require(_0x32ed('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x32ed('0x5'));var util=require(_0x32ed('0x6'));var path=require('path');var sox=require(_0x32ed('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x32ed('0x8'));var _=require(_0x32ed('0x9'));var squel=require(_0x32ed('0xa'));var crypto=require(_0x32ed('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x32ed('0xc'));var querystring=require(_0x32ed('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x32ed('0xe'));var qs=require(_0x32ed('0xf'));var as=require(_0x32ed('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x32ed('0x11'))(_0x32ed('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x32ed('0x13'));var db=require(_0x32ed('0x14'))['db'];var integrations=require(_0x32ed('0x15'));var jayson=require(_0x32ed('0x16'));var client=jayson[_0x32ed('0x17')][_0x32ed('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3da5e4,_0x44dd52,_0x2ab26d,_0x1dae5e){return new BPromise(function(_0x312856,_0x3878ee){var _0x5a8ca4=_0x1dae5e||client;return _0x5a8ca4['request'](_0x3da5e4,_0x2ab26d)[_0x32ed('0x19')](function(_0x90126a){logger[_0x32ed('0x1a')](_0x32ed('0x1b'),_0x44dd52,_0x32ed('0x1c'));logger['debug'](_0x32ed('0x1d'),_0x44dd52,_0x32ed('0x1c'),JSON[_0x32ed('0x1e')](_0x90126a));if(_0x90126a[_0x32ed('0x1f')]){if(_0x90126a[_0x32ed('0x1f')][_0x32ed('0x20')]===0x1f4){logger['error'](_0x32ed('0x1b'),_0x44dd52,_0x90126a[_0x32ed('0x1f')][_0x32ed('0x21')]);return _0x3878ee(_0x90126a[_0x32ed('0x1f')][_0x32ed('0x21')]);}logger[_0x32ed('0x1f')](_0x32ed('0x1b'),_0x44dd52,_0x90126a[_0x32ed('0x1f')][_0x32ed('0x21')]);return _0x312856(_0x90126a['error']['message']);}else{logger[_0x32ed('0x1a')](_0x32ed('0x1b'),_0x44dd52,'request\x20sent');_0x312856(_0x90126a[_0x32ed('0x22')]['message']);}})[_0x32ed('0x23')](function(_0x302d4d){logger[_0x32ed('0x1f')](_0x32ed('0x1b'),_0x44dd52,_0x302d4d);_0x3878ee(_0x302d4d);});});}function respondWithStatusCode(_0x234519,_0x589d56){_0x589d56=_0x589d56||0xcc;return function(_0x593f0a){if(_0x593f0a){return _0x234519[_0x32ed('0x24')](_0x589d56);}return _0x234519[_0x32ed('0x25')](_0x589d56)[_0x32ed('0x26')]();};}function respondWithResult(_0x367c78,_0x146465){_0x146465=_0x146465||0xc8;return function(_0x31708a){if(_0x31708a){return _0x367c78[_0x32ed('0x25')](_0x146465)['json'](_0x31708a);}};}function respondWithFilteredResult(_0x25376a,_0x4c3115){return function(_0x55898a){if(_0x55898a){var _0x611331=typeof _0x4c3115[_0x32ed('0x27')]===_0x32ed('0x28')&&typeof _0x4c3115[_0x32ed('0x29')]===_0x32ed('0x28');var _0x3e1292=_0x55898a[_0x32ed('0x2a')];var _0x4cc868=_0x611331?0x0:_0x4c3115['offset'];var _0x6d71a1=_0x611331?_0x55898a['count']:_0x4c3115[_0x32ed('0x27')]+_0x4c3115['limit'];var _0x44e838;if(_0x6d71a1>=_0x3e1292){_0x6d71a1=_0x3e1292;_0x44e838=0xc8;}else{_0x44e838=0xce;}_0x25376a[_0x32ed('0x25')](_0x44e838);return _0x25376a[_0x32ed('0x2b')](_0x32ed('0x2c'),_0x4cc868+'-'+_0x6d71a1+'/'+_0x3e1292)['json'](_0x55898a);}return null;};}function patchUpdates(_0x1759c1){return function(_0xccb403){try{jsonpatch[_0x32ed('0x2d')](_0xccb403,_0x1759c1,!![]);}catch(_0x50839b){return BPromise[_0x32ed('0x2e')](_0x50839b);}return _0xccb403[_0x32ed('0x2f')]();};}function saveUpdates(_0x3c6990,_0x378064){return function(_0x2aa884){if(_0x2aa884){return _0x2aa884[_0x32ed('0x30')](_0x3c6990)[_0x32ed('0x19')](function(_0x5aac2d){return _0x5aac2d;});}return null;};}function removeEntity(_0xc95a65,_0x581dbd){return function(_0x2e2aeb){if(_0x2e2aeb){return _0x2e2aeb[_0x32ed('0x31')]()['then'](function(){_0xc95a65[_0x32ed('0x25')](0xcc)[_0x32ed('0x26')]();});}};}function handleEntityNotFound(_0x4105f5,_0x1fa65d){return function(_0xd02bf0){if(!_0xd02bf0){_0x4105f5[_0x32ed('0x24')](0x194);}return _0xd02bf0;};}function handleError(_0x4831e1,_0x534146){_0x534146=_0x534146||0x1f4;return function(_0x20d927){logger[_0x32ed('0x1f')](_0x20d927['stack']);if(_0x20d927[_0x32ed('0x32')]){delete _0x20d927[_0x32ed('0x32')];}_0x4831e1[_0x32ed('0x25')](_0x534146)['send'](_0x20d927);};}exports['index']=function(_0x390a2e,_0x19b2d9){var _0x599b3a={},_0x249308={},_0x30a04c={'count':0x0,'rows':[]};var _0x21b254=_[_0x32ed('0x33')](db[_0x32ed('0x34')][_0x32ed('0x35')],function(_0x5a9117){return{'name':_0x5a9117[_0x32ed('0x36')],'type':_0x5a9117[_0x32ed('0x37')][_0x32ed('0x38')]};});_0x249308[_0x32ed('0x39')]=_[_0x32ed('0x33')](_0x21b254,_0x32ed('0x32'));_0x249308[_0x32ed('0x3a')]=_[_0x32ed('0x3b')](_0x390a2e[_0x32ed('0x3a')]);_0x249308[_0x32ed('0x3c')]=_[_0x32ed('0x3d')](_0x249308[_0x32ed('0x39')],_0x249308[_0x32ed('0x3a')]);_0x599b3a[_0x32ed('0x3e')]=_[_0x32ed('0x3d')](_0x249308[_0x32ed('0x39')],qs['fields'](_0x390a2e['query']['fields']));_0x599b3a[_0x32ed('0x3e')]=_0x599b3a['attributes'][_0x32ed('0x3f')]?_0x599b3a['attributes']:_0x249308[_0x32ed('0x39')];if(!_0x390a2e[_0x32ed('0x3a')]['hasOwnProperty'](_0x32ed('0x40'))){_0x599b3a[_0x32ed('0x29')]=qs[_0x32ed('0x29')](_0x390a2e[_0x32ed('0x3a')][_0x32ed('0x29')]);_0x599b3a[_0x32ed('0x27')]=qs[_0x32ed('0x27')](_0x390a2e[_0x32ed('0x3a')][_0x32ed('0x27')]);}_0x599b3a[_0x32ed('0x41')]=qs['sort'](_0x390a2e[_0x32ed('0x3a')]['sort']);_0x599b3a['where']=qs[_0x32ed('0x3c')](_['pick'](_0x390a2e['query'],_0x249308[_0x32ed('0x3c')]),_0x21b254);if(_0x390a2e[_0x32ed('0x3a')][_0x32ed('0x42')]){_0x599b3a[_0x32ed('0x43')]=_[_0x32ed('0x44')](_0x599b3a['where'],{'$or':_[_0x32ed('0x33')](_0x21b254,function(_0x31c5d4){if(_0x31c5d4[_0x32ed('0x37')]!=='VIRTUAL'){var _0x4f23cb={};_0x4f23cb[_0x31c5d4[_0x32ed('0x32')]]={'$like':'%'+_0x390a2e['query']['filter']+'%'};return _0x4f23cb;}})});}_0x599b3a=_['merge']({},_0x599b3a,_0x390a2e[_0x32ed('0x45')]);var _0x48da0c={'where':_0x599b3a['where']};return db[_0x32ed('0x34')]['count'](_0x48da0c)[_0x32ed('0x19')](function(_0x31fbf8){_0x30a04c['count']=_0x31fbf8;if(_0x390a2e[_0x32ed('0x3a')][_0x32ed('0x46')]){_0x599b3a[_0x32ed('0x47')]=[{'all':!![]}];}return db[_0x32ed('0x34')][_0x32ed('0x48')](_0x599b3a);})['then'](function(_0x23ee15){_0x30a04c[_0x32ed('0x49')]=_0x23ee15;return _0x30a04c;})[_0x32ed('0x19')](respondWithFilteredResult(_0x19b2d9,_0x599b3a))[_0x32ed('0x23')](handleError(_0x19b2d9,null));};exports[_0x32ed('0x4a')]=function(_0x2acd54,_0x92453b){var _0x44f5cb={'raw':![],'where':{'id':_0x2acd54[_0x32ed('0x4b')]['id']}},_0x328f17={};_0x328f17[_0x32ed('0x39')]=_[_0x32ed('0x3b')](db[_0x32ed('0x34')][_0x32ed('0x35')]);_0x328f17[_0x32ed('0x3a')]=_[_0x32ed('0x3b')](_0x2acd54[_0x32ed('0x3a')]);_0x328f17['filters']=_['intersection'](_0x328f17[_0x32ed('0x39')],_0x328f17['query']);_0x44f5cb[_0x32ed('0x3e')]=_[_0x32ed('0x3d')](_0x328f17[_0x32ed('0x39')],qs[_0x32ed('0x4c')](_0x2acd54[_0x32ed('0x3a')]['fields']));_0x44f5cb['attributes']=_0x44f5cb[_0x32ed('0x3e')]['length']?_0x44f5cb[_0x32ed('0x3e')]:_0x328f17[_0x32ed('0x39')];if(_0x2acd54[_0x32ed('0x3a')][_0x32ed('0x46')]){_0x44f5cb[_0x32ed('0x47')]=[{'all':!![]}];}_0x44f5cb=_[_0x32ed('0x44')]({},_0x44f5cb,_0x2acd54['options']);return db[_0x32ed('0x34')][_0x32ed('0x4d')](_0x44f5cb)[_0x32ed('0x19')](handleEntityNotFound(_0x92453b,null))[_0x32ed('0x19')](respondWithResult(_0x92453b,null))[_0x32ed('0x23')](handleError(_0x92453b,null));};exports[_0x32ed('0x4e')]=function(_0x49288e,_0x5d82fd){return db[_0x32ed('0x34')][_0x32ed('0x4e')](_0x49288e[_0x32ed('0x4f')],{})[_0x32ed('0x19')](respondWithResult(_0x5d82fd,0xc9))['catch'](handleError(_0x5d82fd,null));};exports[_0x32ed('0x30')]=function(_0x40a89b,_0x286bb7){if(_0x40a89b['body']['id']){delete _0x40a89b['body']['id'];}return db[_0x32ed('0x34')][_0x32ed('0x4d')]({'where':{'id':_0x40a89b['params']['id']}})[_0x32ed('0x19')](handleEntityNotFound(_0x286bb7,null))[_0x32ed('0x19')](saveUpdates(_0x40a89b['body'],null))[_0x32ed('0x19')](respondWithResult(_0x286bb7,null))[_0x32ed('0x23')](handleError(_0x286bb7,null));};exports[_0x32ed('0x31')]=function(_0x4e9727,_0x520a66){return db[_0x32ed('0x34')][_0x32ed('0x4d')]({'where':{'id':_0x4e9727[_0x32ed('0x4b')]['id']}})[_0x32ed('0x19')](handleEntityNotFound(_0x520a66,null))['then'](removeEntity(_0x520a66,null))[_0x32ed('0x23')](handleError(_0x520a66,null));};exports[_0x32ed('0x50')]=function(_0x24b253,_0x1d1660,_0x1df5a4){var _0x1348ef={};var _0x3d3c6b={};var _0x29489f;var _0x57c15c;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x24b253[_0x32ed('0x4b')]['id']}})[_0x32ed('0x19')](handleEntityNotFound(_0x1d1660,null))[_0x32ed('0x19')](function(_0x3e16b2){if(_0x3e16b2){_0x29489f=_0x3e16b2;_0x3d3c6b[_0x32ed('0x39')]=_[_0x32ed('0x3b')](db[_0x32ed('0x51')][_0x32ed('0x35')]);_0x3d3c6b[_0x32ed('0x3a')]=_[_0x32ed('0x3b')](_0x24b253['query']);_0x3d3c6b['filters']=_['intersection'](_0x3d3c6b[_0x32ed('0x39')],_0x3d3c6b[_0x32ed('0x3a')]);_0x1348ef['attributes']=_[_0x32ed('0x3d')](_0x3d3c6b['model'],qs[_0x32ed('0x4c')](_0x24b253[_0x32ed('0x3a')][_0x32ed('0x4c')]));_0x1348ef['attributes']=_0x1348ef[_0x32ed('0x3e')]['length']?_0x1348ef[_0x32ed('0x3e')]:_0x3d3c6b['model'];_0x1348ef[_0x32ed('0x41')]=qs[_0x32ed('0x52')](_0x24b253[_0x32ed('0x3a')][_0x32ed('0x52')]);_0x1348ef[_0x32ed('0x43')]=qs[_0x32ed('0x3c')](_[_0x32ed('0x53')](_0x24b253['query'],_0x3d3c6b[_0x32ed('0x3c')]));if(_0x24b253[_0x32ed('0x3a')][_0x32ed('0x42')]){_0x1348ef['where']=_[_0x32ed('0x44')](_0x1348ef[_0x32ed('0x43')],{'$or':_[_0x32ed('0x33')](_0x1348ef[_0x32ed('0x3e')],function(_0x302d56){var _0x3257fd={};_0x3257fd[_0x302d56]={'$like':'%'+_0x24b253[_0x32ed('0x3a')]['filter']+'%'};return _0x3257fd;})});}_0x1348ef=_[_0x32ed('0x44')]({},_0x1348ef,_0x24b253[_0x32ed('0x45')]);return _0x29489f[_0x32ed('0x50')](_0x1348ef);}})[_0x32ed('0x19')](function(_0x45e1f5){if(_0x45e1f5){_0x57c15c=_0x45e1f5[_0x32ed('0x3f')];if(!_0x24b253[_0x32ed('0x3a')][_0x32ed('0x54')](_0x32ed('0x40'))){_0x1348ef['limit']=qs['limit'](_0x24b253['query']['limit']);_0x1348ef[_0x32ed('0x27')]=qs[_0x32ed('0x27')](_0x24b253[_0x32ed('0x3a')][_0x32ed('0x27')]);}return _0x29489f[_0x32ed('0x50')](_0x1348ef);}})[_0x32ed('0x19')](function(_0x5c95ae){if(_0x5c95ae){return _0x5c95ae?{'count':_0x57c15c,'rows':_0x5c95ae}:null;}})[_0x32ed('0x19')](respondWithResult(_0x1d1660,null))[_0x32ed('0x23')](handleError(_0x1d1660,null));};exports[_0x32ed('0x55')]=function(_0x35f8db,_0x3bb2b4,_0x56d037){if(_0x35f8db[_0x32ed('0x4f')]['id']){delete _0x35f8db[_0x32ed('0x4f')]['id'];}return db[_0x32ed('0x34')][_0x32ed('0x56')]({'where':{'id':_0x35f8db[_0x32ed('0x4b')]['id']}})[_0x32ed('0x19')](handleEntityNotFound(_0x3bb2b4,null))['then'](function(_0x32d1c3){if(_0x32d1c3){_0x35f8db[_0x32ed('0x4f')][_0x32ed('0x57')]=_0x32d1c3['id'];_0x35f8db[_0x32ed('0x4f')][_0x32ed('0x58')]=integrations[_0x32ed('0x59')](_0x35f8db[_0x32ed('0x4f')][_0x32ed('0x5a')],_0x35f8db['body'][_0x32ed('0x37')]);_0x35f8db[_0x32ed('0x4f')][_0x32ed('0x5b')]=integrations[_0x32ed('0x5c')](_0x35f8db[_0x32ed('0x4f')]['channel'],_0x35f8db[_0x32ed('0x4f')][_0x32ed('0x37')]);return db[_0x32ed('0x51')][_0x32ed('0x4e')](_0x35f8db['body'],{'include':[{'model':db[_0x32ed('0x5d')],'as':_0x32ed('0x58')},{'model':db[_0x32ed('0x5d')],'as':_0x32ed('0x5b')}]});}return null;})[_0x32ed('0x19')](respondWithResult(_0x3bb2b4,null))[_0x32ed('0x23')](handleError(_0x3bb2b4,null));};exports[_0x32ed('0x5e')]=function(_0x232ca7,_0x4c2e8a,_0x21344e){var _0x2d6a34='';return db[_0x32ed('0x34')][_0x32ed('0x56')]({'where':{'id':_0x232ca7[_0x32ed('0x4b')]['id']},'attributes':['id',_0x32ed('0x5f'),_0x32ed('0x60')]})[_0x32ed('0x19')](handleEntityNotFound(_0x4c2e8a,null))[_0x32ed('0x19')](function(_0x436f88){if(_0x436f88){_0x2d6a34=_0x436f88[_0x32ed('0x5f')];var _0x5840cd=_0x2d6a34[_0x32ed('0x61')](-0x1);if(_0x5840cd==='/'){_0x2d6a34=_0x2d6a34[_0x32ed('0x62')](0x0,_0x2d6a34[_0x32ed('0x63')](_0x5840cd));}return rp({'method':_0x32ed('0x64'),'uri':util[_0x32ed('0x65')]('%s/%s',_0x2d6a34,_0x32ed('0x66')),'headers':{'Authorization':util[_0x32ed('0x65')](_0x32ed('0x67'),new Buffer(util[_0x32ed('0x65')]('%s:X',_0x436f88['apiKey']))[_0x32ed('0x68')]('base64'))},'json':!![]});}})[_0x32ed('0x19')](function(_0x7efac9){if(_0x7efac9){var _0x2a5398=[_0x32ed('0x69'),'subject',_0x32ed('0x6a'),_0x32ed('0x6b'),_0x32ed('0x25'),_0x32ed('0x6c'),_0x32ed('0x6d'),_0x32ed('0x6e'),_0x32ed('0x6f'),_0x32ed('0x6d'),_0x32ed('0x70')];_[_0x32ed('0x71')](_0x7efac9,function(_0x359c07){return _0x2a5398[_0x32ed('0x72')](_0x359c07[_0x32ed('0x32')])||!_0x359c07['default']&&_0x359c07['type']!==_0x32ed('0x73')&&_0x359c07[_0x32ed('0x37')]!==_0x32ed('0x74');});return{'count':_0x7efac9['length'],'rows':_[_0x32ed('0x33')](_0x7efac9,function(_0x45b4d1){return{'id':_0x45b4d1[_0x32ed('0x32')],'name':_0x45b4d1['label'],'custom':!_0x45b4d1[_0x32ed('0x75')],'options':_0x45b4d1[_0x32ed('0x76')]?_[_0x32ed('0x33')](_0x45b4d1[_0x32ed('0x76')],function(_0xde4af5){return{'name':_['capitalize'](_0xde4af5),'value':_0xde4af5};}):[]};})};}})['then'](respondWithResult(_0x4c2e8a,null))['catch'](function(_0x2d9fe2){var _0x30d879=_0x232ca7[_0x32ed('0x3a')]['test']?0x1f4:_0x2d9fe2[_0x32ed('0x77')]||0x1f4;logger[_0x32ed('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0x32ed('0x5e'),_0x30d879,JSON[_0x32ed('0x1e')](_0x2d9fe2));delete _0x2d9fe2[_0x32ed('0x32')];if(_0x30d879===0x191){_0x30d879=0x190;}_0x4c2e8a[_0x32ed('0x25')](_0x30d879)[_0x32ed('0x78')](_0x232ca7['query'][_0x32ed('0x79')]?{'message':_0x32ed('0x7a'),'statusCode':_0x2d9fe2[_0x32ed('0x77')]}:_0x2d9fe2);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 10bc51e..799a3d7 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 _0xecb5=['moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger'];(function(_0x275784,_0x33e55b){var _0x46e2c9=function(_0x116bd2){while(--_0x116bd2){_0x275784['push'](_0x275784['shift']());}};_0x46e2c9(++_0x33e55b);}(_0xecb5,0x129));var _0x5ecb=function(_0x582c5c,_0x2ecce3){_0x582c5c=_0x582c5c-0x0;var _0x137b65=_0xecb5[_0x582c5c];return _0x137b65;};'use strict';var _=require(_0x5ecb('0x0'));var util=require(_0x5ecb('0x1'));var logger=require(_0x5ecb('0x2'))('api');var moment=require(_0x5ecb('0x3'));var BPromise=require('bluebird');var rp=require(_0x5ecb('0x4'));var fs=require('fs');var path=require(_0x5ecb('0x5'));var rimraf=require(_0x5ecb('0x6'));var config=require(_0x5ecb('0x7'));var attributes=require(_0x5ecb('0x8'));var integrations=require(_0x5ecb('0x9'));module[_0x5ecb('0xa')]=function(_0x49ce38,_0x46609b){return _0x49ce38[_0x5ecb('0xb')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98fb=['define','FreshdeskAccount','lodash','util','../../config/logger','rimraf','./intFreshdeskAccount.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x98fb,0x1ea));var _0xb98f=function(_0x153304,_0x25da33){_0x153304=_0x153304-0x0;var _0x479c46=_0x98fb[_0x153304];return _0x479c46;};'use strict';var _=require(_0xb98f('0x0'));var util=require(_0xb98f('0x1'));var logger=require(_0xb98f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb98f('0x3'));var config=require('../../config/environment');var attributes=require(_0xb98f('0x4'));var integrations=require('../../components/integrations/configuration');module[_0xb98f('0x5')]=function(_0x129d0f,_0x37f3e4){return _0x129d0f[_0xb98f('0x6')](_0xb98f('0x7'),attributes,{'tableName':'int_freshdesk_accounts','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 4f2c06d..b6760d8 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 _0x73ee=['debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','include','map','model','attributes','catch','ShowFreshdeskAccount','raw','then','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','request\x20sent'];(function(_0x12d013,_0x286e4c){var _0x54220c=function(_0x31d518){while(--_0x31d518){_0x12d013['push'](_0x12d013['shift']());}};_0x54220c(++_0x286e4c);}(_0x73ee,0xe2));var _0xe73e=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x73ee[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xe73e('0x0'));var util=require(_0xe73e('0x1'));var moment=require(_0xe73e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe73e('0x3'));var db=require(_0xe73e('0x4'))['db'];var utils=require(_0xe73e('0x5'));var logger=require(_0xe73e('0x6'))('rpc');var config=require(_0xe73e('0x7'));var jayson=require(_0xe73e('0x8'));var client=jayson['client'][_0xe73e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c333c,_0x4a75e1,_0x2641b2){return new BPromise(function(_0x370812,_0x56ec6a){return client['request'](_0x3c333c,_0x2641b2)['then'](function(_0x55ddac){logger[_0xe73e('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x4a75e1,_0xe73e('0xb'));logger[_0xe73e('0xc')](_0xe73e('0xd'),_0x4a75e1,_0xe73e('0xb'),JSON[_0xe73e('0xe')](_0x55ddac));if(_0x55ddac['error']){if(_0x55ddac[_0xe73e('0xf')][_0xe73e('0x10')]===0x1f4){logger[_0xe73e('0xf')](_0xe73e('0x11'),_0x4a75e1,_0x55ddac['error'][_0xe73e('0x12')]);return _0x56ec6a(_0x55ddac[_0xe73e('0xf')][_0xe73e('0x12')]);}logger[_0xe73e('0xf')](_0xe73e('0x11'),_0x4a75e1,_0x55ddac[_0xe73e('0xf')][_0xe73e('0x12')]);return _0x370812(_0x55ddac[_0xe73e('0xf')][_0xe73e('0x12')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x4a75e1,_0xe73e('0xb'));_0x370812(_0x55ddac[_0xe73e('0x13')][_0xe73e('0x12')]);}})['catch'](function(_0x1d9eec){logger[_0xe73e('0xf')](_0xe73e('0x11'),_0x4a75e1,_0x1d9eec);_0x56ec6a(_0x1d9eec);});});}exports[_0xe73e('0x14')]=function(_0x1abcf9){var _0x47942e=this;return new Promise(function(_0x917d2f,_0x2f5828){return db[_0xe73e('0x15')][_0xe73e('0x16')]({'raw':_0x1abcf9[_0xe73e('0x17')]?_0x1abcf9[_0xe73e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1abcf9['options']?_0x1abcf9[_0xe73e('0x17')][_0xe73e('0x18')]||null:null,'attributes':_0x1abcf9[_0xe73e('0x17')]?_0x1abcf9[_0xe73e('0x17')]['attributes']||null:null,'limit':_0x1abcf9[_0xe73e('0x17')]?_0x1abcf9[_0xe73e('0x17')][_0xe73e('0x19')]||null:null,'include':_0x1abcf9[_0xe73e('0x17')]?_0x1abcf9[_0xe73e('0x17')][_0xe73e('0x1a')]?_[_0xe73e('0x1b')](_0x1abcf9['options']['include'],function(_0x51b26d){return{'model':db[_0x51b26d[_0xe73e('0x1c')]],'as':_0x51b26d['as'],'attributes':_0x51b26d[_0xe73e('0x1d')],'include':_0x51b26d[_0xe73e('0x1a')]?_[_0xe73e('0x1b')](_0x51b26d['include'],function(_0x4e1437){return{'model':db[_0x4e1437[_0xe73e('0x1c')]],'as':_0x4e1437['as'],'attributes':_0x4e1437[_0xe73e('0x1d')],'include':_0x4e1437[_0xe73e('0x1a')]?_[_0xe73e('0x1b')](_0x4e1437['include'],function(_0x3c1b87){return{'model':db[_0x3c1b87[_0xe73e('0x1c')]],'as':_0x3c1b87['as'],'attributes':_0x3c1b87['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x329442){logger['info']('GetFreshdeskAccount',_0x1abcf9);logger['debug'](_0xe73e('0x14'),_0x1abcf9,JSON[_0xe73e('0xe')](_0x329442));_0x917d2f(_0x329442);})[_0xe73e('0x1e')](function(_0x8a9ad9){logger[_0xe73e('0xf')](_0xe73e('0x14'),_0x8a9ad9['message'],_0x1abcf9);_0x2f5828(_0x47942e[_0xe73e('0xf')](0x1f4,_0x8a9ad9['message']));});});};exports[_0xe73e('0x1f')]=function(_0x6b315c){var _0x1a019e=this;return new Promise(function(_0x392625,_0x224e76){return db['FreshdeskAccount']['find']({'raw':_0x6b315c[_0xe73e('0x17')]?_0x6b315c['options'][_0xe73e('0x20')]===undefined?!![]:![]:!![],'where':_0x6b315c[_0xe73e('0x17')]?_0x6b315c['options']['where']||null:null,'attributes':_0x6b315c[_0xe73e('0x17')]?_0x6b315c[_0xe73e('0x17')][_0xe73e('0x1d')]||null:null,'include':_0x6b315c[_0xe73e('0x17')]?_0x6b315c[_0xe73e('0x17')][_0xe73e('0x1a')]?_[_0xe73e('0x1b')](_0x6b315c[_0xe73e('0x17')]['include'],function(_0x1c1f0f){return{'model':db[_0x1c1f0f[_0xe73e('0x1c')]],'as':_0x1c1f0f['as'],'attributes':_0x1c1f0f[_0xe73e('0x1d')],'include':_0x1c1f0f[_0xe73e('0x1a')]?_[_0xe73e('0x1b')](_0x1c1f0f[_0xe73e('0x1a')],function(_0x18436d){return{'model':db[_0x18436d[_0xe73e('0x1c')]],'as':_0x18436d['as'],'attributes':_0x18436d[_0xe73e('0x1d')],'include':_0x18436d[_0xe73e('0x1a')]?_[_0xe73e('0x1b')](_0x18436d['include'],function(_0x1bceb0){return{'model':db[_0x1bceb0['model']],'as':_0x1bceb0['as'],'attributes':_0x1bceb0[_0xe73e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe73e('0x21')](function(_0x3b22cf){logger[_0xe73e('0xa')](_0xe73e('0x1f'),_0x6b315c);logger[_0xe73e('0xc')](_0xe73e('0x1f'),_0x6b315c,JSON['stringify'](_0x3b22cf));_0x392625(_0x3b22cf);})[_0xe73e('0x1e')](function(_0xc4c450){logger[_0xe73e('0xf')](_0xe73e('0x1f'),_0xc4c450['message'],_0x6b315c);_0x224e76(_0x1a019e[_0xe73e('0xf')](0x1f4,_0xc4c450[_0xe73e('0x12')]));});});}; \ No newline at end of file +var _0xb0f9=['find','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','then','ShowFreshdeskAccount'];(function(_0x50c3d,_0x225e95){var _0x3a7fe2=function(_0x21187a){while(--_0x21187a){_0x50c3d['push'](_0x50c3d['shift']());}};_0x3a7fe2(++_0x225e95);}(_0xb0f9,0xda));var _0x9b0f=function(_0x5b15c0,_0x214f5a){_0x5b15c0=_0x5b15c0-0x0;var _0x42c219=_0xb0f9[_0x5b15c0];return _0x42c219;};'use strict';var _=require(_0x9b0f('0x0'));var util=require(_0x9b0f('0x1'));var moment=require('moment');var BPromise=require(_0x9b0f('0x2'));var rs=require(_0x9b0f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b0f('0x4'))['db'];var utils=require(_0x9b0f('0x5'));var logger=require(_0x9b0f('0x6'))(_0x9b0f('0x7'));var config=require(_0x9b0f('0x8'));var jayson=require(_0x9b0f('0x9'));var client=jayson[_0x9b0f('0xa')][_0x9b0f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x920d99,_0x394305,_0x3e9fa8){return new BPromise(function(_0x57e82f,_0x49e46f){return client[_0x9b0f('0xc')](_0x920d99,_0x3e9fa8)['then'](function(_0x4fdfc1){logger[_0x9b0f('0xd')](_0x9b0f('0xe'),_0x394305,_0x9b0f('0xf'));logger[_0x9b0f('0x10')](_0x9b0f('0x11'),_0x394305,_0x9b0f('0xf'),JSON[_0x9b0f('0x12')](_0x4fdfc1));if(_0x4fdfc1[_0x9b0f('0x13')]){if(_0x4fdfc1['error'][_0x9b0f('0x14')]===0x1f4){logger[_0x9b0f('0x13')](_0x9b0f('0xe'),_0x394305,_0x4fdfc1[_0x9b0f('0x13')][_0x9b0f('0x15')]);return _0x49e46f(_0x4fdfc1['error']['message']);}logger[_0x9b0f('0x13')](_0x9b0f('0xe'),_0x394305,_0x4fdfc1[_0x9b0f('0x13')][_0x9b0f('0x15')]);return _0x57e82f(_0x4fdfc1[_0x9b0f('0x13')][_0x9b0f('0x15')]);}else{logger[_0x9b0f('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x394305,'request\x20sent');_0x57e82f(_0x4fdfc1[_0x9b0f('0x16')][_0x9b0f('0x15')]);}})['catch'](function(_0x466a0e){logger[_0x9b0f('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x394305,_0x466a0e);_0x49e46f(_0x466a0e);});});}exports[_0x9b0f('0x17')]=function(_0x2720d5){var _0x3826e3=this;return new Promise(function(_0x8e896e,_0xc09814){return db['FreshdeskAccount'][_0x9b0f('0x18')]({'raw':_0x2720d5[_0x9b0f('0x19')]?_0x2720d5[_0x9b0f('0x19')][_0x9b0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x2720d5[_0x9b0f('0x19')]?_0x2720d5['options']['where']||null:null,'attributes':_0x2720d5[_0x9b0f('0x19')]?_0x2720d5['options'][_0x9b0f('0x1b')]||null:null,'limit':_0x2720d5[_0x9b0f('0x19')]?_0x2720d5['options'][_0x9b0f('0x1c')]||null:null,'include':_0x2720d5[_0x9b0f('0x19')]?_0x2720d5['options'][_0x9b0f('0x1d')]?_[_0x9b0f('0x1e')](_0x2720d5['options'][_0x9b0f('0x1d')],function(_0x29d6bf){return{'model':db[_0x29d6bf[_0x9b0f('0x1f')]],'as':_0x29d6bf['as'],'attributes':_0x29d6bf[_0x9b0f('0x1b')],'include':_0x29d6bf[_0x9b0f('0x1d')]?_['map'](_0x29d6bf[_0x9b0f('0x1d')],function(_0x3c0596){return{'model':db[_0x3c0596['model']],'as':_0x3c0596['as'],'attributes':_0x3c0596[_0x9b0f('0x1b')],'include':_0x3c0596['include']?_['map'](_0x3c0596['include'],function(_0xaa78f5){return{'model':db[_0xaa78f5['model']],'as':_0xaa78f5['as'],'attributes':_0xaa78f5[_0x9b0f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9b0f('0x20')](function(_0x34f7cb){logger[_0x9b0f('0xd')](_0x9b0f('0x17'),_0x2720d5);logger[_0x9b0f('0x10')]('GetFreshdeskAccount',_0x2720d5,JSON[_0x9b0f('0x12')](_0x34f7cb));_0x8e896e(_0x34f7cb);})['catch'](function(_0x1d1f79){logger[_0x9b0f('0x13')](_0x9b0f('0x17'),_0x1d1f79[_0x9b0f('0x15')],_0x2720d5);_0xc09814(_0x3826e3[_0x9b0f('0x13')](0x1f4,_0x1d1f79[_0x9b0f('0x15')]));});});};exports[_0x9b0f('0x21')]=function(_0x5715c0){var _0x2a0adc=this;return new Promise(function(_0x3b1016,_0x5bc935){return db['FreshdeskAccount'][_0x9b0f('0x22')]({'raw':_0x5715c0[_0x9b0f('0x19')]?_0x5715c0['options'][_0x9b0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x5715c0[_0x9b0f('0x19')]?_0x5715c0[_0x9b0f('0x19')][_0x9b0f('0x23')]||null:null,'attributes':_0x5715c0[_0x9b0f('0x19')]?_0x5715c0[_0x9b0f('0x19')][_0x9b0f('0x1b')]||null:null,'include':_0x5715c0[_0x9b0f('0x19')]?_0x5715c0['options']['include']?_['map'](_0x5715c0[_0x9b0f('0x19')][_0x9b0f('0x1d')],function(_0x1535e7){return{'model':db[_0x1535e7[_0x9b0f('0x1f')]],'as':_0x1535e7['as'],'attributes':_0x1535e7['attributes'],'include':_0x1535e7[_0x9b0f('0x1d')]?_[_0x9b0f('0x1e')](_0x1535e7['include'],function(_0x1207c8){return{'model':db[_0x1207c8['model']],'as':_0x1207c8['as'],'attributes':_0x1207c8[_0x9b0f('0x1b')],'include':_0x1207c8[_0x9b0f('0x1d')]?_[_0x9b0f('0x1e')](_0x1207c8[_0x9b0f('0x1d')],function(_0x2a6c27){return{'model':db[_0x2a6c27[_0x9b0f('0x1f')]],'as':_0x2a6c27['as'],'attributes':_0x2a6c27['attributes']};}):[]};}):[]};}):[]:[]})[_0x9b0f('0x20')](function(_0x518d04){logger['info'](_0x9b0f('0x21'),_0x5715c0);logger['debug']('ShowFreshdeskAccount',_0x5715c0,JSON[_0x9b0f('0x12')](_0x518d04));_0x3b1016(_0x518d04);})['catch'](function(_0x46d9b6){logger[_0x9b0f('0x13')](_0x9b0f('0x21'),_0x46d9b6[_0x9b0f('0x15')],_0x5715c0);_0x5bc935(_0x2a0adc[_0x9b0f('0x13')](0x1f4,_0x46d9b6[_0x9b0f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 1eade14..ab52099 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 _0x719a=['/:id/fields','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','/:id','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','show'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x719a,0xcc));var _0xa719=function(_0x5b2687,_0x2e9697){_0x5b2687=_0x5b2687-0x0;var _0x4b618c=_0x719a[_0x5b2687];return _0x4b618c;};'use strict';var multer=require(_0xa719('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa719('0x1'));var express=require(_0xa719('0x2'));var router=express[_0xa719('0x3')]();var fs_extra=require(_0xa719('0x4'));var auth=require(_0xa719('0x5'));var interaction=require(_0xa719('0x6'));var config=require('../../config/environment');var controller=require(_0xa719('0x7'));router['get']('/',auth[_0xa719('0x8')](),controller[_0xa719('0x9')]);router[_0xa719('0xa')]('/:id',auth[_0xa719('0x8')](),controller[_0xa719('0xb')]);router[_0xa719('0xa')](_0xa719('0xc'),auth[_0xa719('0x8')](),controller[_0xa719('0xd')]);router[_0xa719('0xa')]('/:id/subjects',auth[_0xa719('0x8')](),controller['getSubjects']);router[_0xa719('0xa')](_0xa719('0xe'),auth[_0xa719('0x8')](),controller[_0xa719('0xf')]);router['get'](_0xa719('0x10'),auth['isAuthenticated'](),controller[_0xa719('0x11')]);router[_0xa719('0x12')]('/',auth[_0xa719('0x8')](),controller[_0xa719('0x13')]);router['post'](_0xa719('0x10'),auth[_0xa719('0x8')](),controller['setTags']);router[_0xa719('0x14')](_0xa719('0x15'),auth['isAuthenticated'](),controller['update']);router[_0xa719('0x16')]('/:id',auth[_0xa719('0x8')](),controller[_0xa719('0x17')]);module['exports']=router; \ No newline at end of file +var _0x4a39=['/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','isAuthenticated','get','/:id','/:id/fields','getFields','getSubjects'];(function(_0xb90068,_0x53cb50){var _0x5c2022=function(_0x54673a){while(--_0x54673a){_0xb90068['push'](_0xb90068['shift']());}};_0x5c2022(++_0x53cb50);}(_0x4a39,0x65));var _0x94a3=function(_0x4c446e,_0x19a934){_0x4c446e=_0x4c446e-0x0;var _0x367191=_0x4a39[_0x4c446e];return _0x367191;};'use strict';var multer=require(_0x94a3('0x0'));var util=require('util');var path=require(_0x94a3('0x1'));var timeout=require('connect-timeout');var express=require(_0x94a3('0x2'));var router=express[_0x94a3('0x3')]();var fs_extra=require(_0x94a3('0x4'));var auth=require(_0x94a3('0x5'));var interaction=require(_0x94a3('0x6'));var config=require('../../config/environment');var controller=require(_0x94a3('0x7'));router['get']('/',auth[_0x94a3('0x8')](),controller['index']);router[_0x94a3('0x9')](_0x94a3('0xa'),auth[_0x94a3('0x8')](),controller['show']);router[_0x94a3('0x9')](_0x94a3('0xb'),auth[_0x94a3('0x8')](),controller[_0x94a3('0xc')]);router['get']('/:id/subjects',auth[_0x94a3('0x8')](),controller[_0x94a3('0xd')]);router[_0x94a3('0x9')](_0x94a3('0xe'),auth[_0x94a3('0x8')](),controller[_0x94a3('0xf')]);router['get']('/:id/tags',auth[_0x94a3('0x8')](),controller[_0x94a3('0x10')]);router[_0x94a3('0x11')]('/',auth[_0x94a3('0x8')](),controller[_0x94a3('0x12')]);router[_0x94a3('0x11')](_0x94a3('0x13'),auth['isAuthenticated'](),controller[_0x94a3('0x14')]);router['put'](_0x94a3('0xa'),auth['isAuthenticated'](),controller[_0x94a3('0x15')]);router['delete'](_0x94a3('0xa'),auth[_0x94a3('0x8')](),controller['destroy']);module[_0x94a3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 35f6e5f..a22f5b0 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 _0xb15e=['exports','STRING'];(function(_0x4dcb1f,_0x205c1e){var _0x235eca=function(_0x2d6693){while(--_0x2d6693){_0x4dcb1f['push'](_0x4dcb1f['shift']());}};_0x235eca(++_0x205c1e);}(_0xb15e,0xc0));var _0xeb15=function(_0x540a68,_0x8fc7a4){_0x540a68=_0x540a68-0x0;var _0x58679d=_0xb15e[_0x540a68];return _0x58679d;};'use strict';var Sequelize=require('sequelize');module[_0xeb15('0x0')]={'name':{'type':Sequelize[_0xeb15('0x1')]},'description':{'type':Sequelize[_0xeb15('0x1')]}}; \ No newline at end of file +var _0x3be1=['STRING','exports'];(function(_0x5793e0,_0x1e4b1e){var _0xfaeb86=function(_0x28a1ce){while(--_0x28a1ce){_0x5793e0['push'](_0x5793e0['shift']());}};_0xfaeb86(++_0x1e4b1e);}(_0x3be1,0xb5));var _0x13be=function(_0x432d7f,_0x374beb){_0x432d7f=_0x432d7f-0x0;var _0x2b9618=_0x3be1[_0x432d7f];return _0x2b9618;};'use strict';var Sequelize=require('sequelize');module[_0x13be('0x0')]={'name':{'type':Sequelize[_0x13be('0x1')]},'description':{'type':Sequelize[_0x13be('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 933f63b..13fe6f3 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 _0x887d=['options','include','findAll','params','includeAll','find','create','body','catch','destroy','getFields','findOne','FreshdeskField','pick','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','util','path','sox','ejs','fs-extra','lodash','squel','crypto','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','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge'];(function(_0xa72345,_0x1fd304){var _0xbc82fb=function(_0xb1594f){while(--_0xb1594f){_0xa72345['push'](_0xa72345['shift']());}};_0xbc82fb(++_0x1fd304);}(_0x887d,0xd0));var _0xd887=function(_0x43469e,_0x4e69d6){_0x43469e=_0x43469e-0x0;var _0xcefd2a=_0x887d[_0x43469e];return _0xcefd2a;};'use strict';var emlformat=require(_0xd887('0x0'));var rimraf=require(_0xd887('0x1'));var zipdir=require(_0xd887('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd887('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd887('0x4'));var path=require(_0xd887('0x5'));var sox=require(_0xd887('0x6'));var csv=require('to-csv');var ejs=require(_0xd887('0x7'));var fs=require('fs');var fs_extra=require(_0xd887('0x8'));var _=require(_0xd887('0x9'));var squel=require(_0xd887('0xa'));var crypto=require(_0xd887('0xb'));var jsforce=require(_0xd887('0xc'));var deskjs=require(_0xd887('0xd'));var toCsv=require(_0xd887('0xe'));var querystring=require(_0xd887('0xf'));var Papa=require('papaparse');var Redis=require(_0xd887('0x10'));var authService=require(_0xd887('0x11'));var qs=require(_0xd887('0x12'));var as=require(_0xd887('0x13'));var hardwareService=require(_0xd887('0x14'));var logger=require('../../config/logger')(_0xd887('0x15'));var utils=require(_0xd887('0x16'));var config=require(_0xd887('0x17'));var licenseUtil=require(_0xd887('0x18'));var db=require(_0xd887('0x19'))['db'];var jayson=require(_0xd887('0x1a'));var client=jayson['client'][_0xd887('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1d2850,_0xc86fea,_0x5e5326,_0x5bd8e2){return new BPromise(function(_0x22f394,_0x3be5c9){var _0x3ab48e=_0x5bd8e2||client;return _0x3ab48e[_0xd887('0x1c')](_0x1d2850,_0x5e5326)[_0xd887('0x1d')](function(_0x56ef1d){logger[_0xd887('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xc86fea,_0xd887('0x1f'));logger[_0xd887('0x20')](_0xd887('0x21'),_0xc86fea,_0xd887('0x1f'),JSON[_0xd887('0x22')](_0x56ef1d));if(_0x56ef1d[_0xd887('0x23')]){if(_0x56ef1d[_0xd887('0x23')][_0xd887('0x24')]===0x1f4){logger['error'](_0xd887('0x25'),_0xc86fea,_0x56ef1d['error'][_0xd887('0x26')]);return _0x3be5c9(_0x56ef1d[_0xd887('0x23')]['message']);}logger['error'](_0xd887('0x25'),_0xc86fea,_0x56ef1d['error'][_0xd887('0x26')]);return _0x22f394(_0x56ef1d[_0xd887('0x23')][_0xd887('0x26')]);}else{logger[_0xd887('0x1e')](_0xd887('0x25'),_0xc86fea,_0xd887('0x1f'));_0x22f394(_0x56ef1d[_0xd887('0x27')]['message']);}})['catch'](function(_0x48b13a){logger['error'](_0xd887('0x25'),_0xc86fea,_0x48b13a);_0x3be5c9(_0x48b13a);});});}function respondWithStatusCode(_0x5a3ef8,_0x497221){_0x497221=_0x497221||0xcc;return function(_0x647608){if(_0x647608){return _0x5a3ef8[_0xd887('0x28')](_0x497221);}return _0x5a3ef8[_0xd887('0x29')](_0x497221)[_0xd887('0x2a')]();};}function respondWithResult(_0x36a2b4,_0x149260){_0x149260=_0x149260||0xc8;return function(_0x148b7e){if(_0x148b7e){return _0x36a2b4[_0xd887('0x29')](_0x149260)[_0xd887('0x2b')](_0x148b7e);}};}function respondWithFilteredResult(_0x997ffe,_0x3878b2){return function(_0x1a8972){if(_0x1a8972){var _0x5997ea=typeof _0x3878b2[_0xd887('0x2c')]===_0xd887('0x2d')&&typeof _0x3878b2['limit']===_0xd887('0x2d');var _0x203f27=_0x1a8972[_0xd887('0x2e')];var _0x3e9cd1=_0x5997ea?0x0:_0x3878b2[_0xd887('0x2c')];var _0x528e8a=_0x5997ea?_0x1a8972[_0xd887('0x2e')]:_0x3878b2['offset']+_0x3878b2[_0xd887('0x2f')];var _0x1ee794;if(_0x528e8a>=_0x203f27){_0x528e8a=_0x203f27;_0x1ee794=0xc8;}else{_0x1ee794=0xce;}_0x997ffe['status'](_0x1ee794);return _0x997ffe[_0xd887('0x30')](_0xd887('0x31'),_0x3e9cd1+'-'+_0x528e8a+'/'+_0x203f27)['json'](_0x1a8972);}return null;};}function patchUpdates(_0x35158e){return function(_0x55a14e){try{jsonpatch[_0xd887('0x32')](_0x55a14e,_0x35158e,!![]);}catch(_0x238151){return BPromise[_0xd887('0x33')](_0x238151);}return _0x55a14e[_0xd887('0x34')]();};}function saveUpdates(_0x3f08b2,_0xd02f7b){return function(_0x48eadf){if(_0x48eadf){return _0x48eadf['update'](_0x3f08b2)[_0xd887('0x1d')](function(_0x380355){return _0x380355;});}return null;};}function removeEntity(_0x56491a,_0x3eb652){return function(_0x443b1d){if(_0x443b1d){return _0x443b1d['destroy']()['then'](function(){_0x56491a[_0xd887('0x29')](0xcc)[_0xd887('0x2a')]();});}};}function handleEntityNotFound(_0x26b902,_0x17bb2a){return function(_0x5b915b){if(!_0x5b915b){_0x26b902[_0xd887('0x28')](0x194);}return _0x5b915b;};}function handleError(_0x473fba,_0x32ee49){_0x32ee49=_0x32ee49||0x1f4;return function(_0x58493c){logger[_0xd887('0x23')](_0x58493c['stack']);if(_0x58493c[_0xd887('0x35')]){delete _0x58493c[_0xd887('0x35')];}_0x473fba['status'](_0x32ee49)['send'](_0x58493c);};}exports[_0xd887('0x36')]=function(_0x50a4ea,_0x6d8ddc){var _0x58848a={},_0x5bc9df={},_0x576575={'count':0x0,'rows':[]};var _0x24da37=_[_0xd887('0x37')](db[_0xd887('0x38')][_0xd887('0x39')],function(_0x2de630){return{'name':_0x2de630[_0xd887('0x3a')],'type':_0x2de630[_0xd887('0x3b')]['key']};});_0x5bc9df[_0xd887('0x3c')]=_['map'](_0x24da37,'name');_0x5bc9df[_0xd887('0x3d')]=_[_0xd887('0x3e')](_0x50a4ea[_0xd887('0x3d')]);_0x5bc9df[_0xd887('0x3f')]=_[_0xd887('0x40')](_0x5bc9df['model'],_0x5bc9df[_0xd887('0x3d')]);_0x58848a[_0xd887('0x41')]=_['intersection'](_0x5bc9df[_0xd887('0x3c')],qs['fields'](_0x50a4ea['query'][_0xd887('0x42')]));_0x58848a[_0xd887('0x41')]=_0x58848a['attributes'][_0xd887('0x43')]?_0x58848a[_0xd887('0x41')]:_0x5bc9df[_0xd887('0x3c')];if(!_0x50a4ea[_0xd887('0x3d')][_0xd887('0x44')]('nolimit')){_0x58848a[_0xd887('0x2f')]=qs[_0xd887('0x2f')](_0x50a4ea[_0xd887('0x3d')]['limit']);_0x58848a[_0xd887('0x2c')]=qs[_0xd887('0x2c')](_0x50a4ea[_0xd887('0x3d')][_0xd887('0x2c')]);}_0x58848a[_0xd887('0x45')]=qs[_0xd887('0x46')](_0x50a4ea[_0xd887('0x3d')][_0xd887('0x46')]);_0x58848a['where']=qs[_0xd887('0x3f')](_['pick'](_0x50a4ea['query'],_0x5bc9df[_0xd887('0x3f')]),_0x24da37);if(_0x50a4ea[_0xd887('0x3d')][_0xd887('0x47')]){_0x58848a[_0xd887('0x48')]=_[_0xd887('0x49')](_0x58848a[_0xd887('0x48')],{'$or':_[_0xd887('0x37')](_0x24da37,function(_0x4b6dd8){if(_0x4b6dd8['type']!=='VIRTUAL'){var _0x3ad6c7={};_0x3ad6c7[_0x4b6dd8[_0xd887('0x35')]]={'$like':'%'+_0x50a4ea[_0xd887('0x3d')]['filter']+'%'};return _0x3ad6c7;}})});}_0x58848a=_['merge']({},_0x58848a,_0x50a4ea[_0xd887('0x4a')]);var _0x24d8f8={'where':_0x58848a['where']};return db[_0xd887('0x38')][_0xd887('0x2e')](_0x24d8f8)[_0xd887('0x1d')](function(_0x25df4f){_0x576575[_0xd887('0x2e')]=_0x25df4f;if(_0x50a4ea[_0xd887('0x3d')]['includeAll']){_0x58848a[_0xd887('0x4b')]=[{'all':!![]}];}return db[_0xd887('0x38')][_0xd887('0x4c')](_0x58848a);})[_0xd887('0x1d')](function(_0x451ba8){_0x576575['rows']=_0x451ba8;return _0x576575;})[_0xd887('0x1d')](respondWithFilteredResult(_0x6d8ddc,_0x58848a))['catch'](handleError(_0x6d8ddc,null));};exports['show']=function(_0x5ff015,_0x2eadbf){var _0x516c68={'raw':![],'where':{'id':_0x5ff015[_0xd887('0x4d')]['id']}},_0x5e0f8f={};_0x5e0f8f['model']=_[_0xd887('0x3e')](db[_0xd887('0x38')][_0xd887('0x39')]);_0x5e0f8f[_0xd887('0x3d')]=_['keys'](_0x5ff015[_0xd887('0x3d')]);_0x5e0f8f['filters']=_[_0xd887('0x40')](_0x5e0f8f[_0xd887('0x3c')],_0x5e0f8f[_0xd887('0x3d')]);_0x516c68[_0xd887('0x41')]=_[_0xd887('0x40')](_0x5e0f8f[_0xd887('0x3c')],qs[_0xd887('0x42')](_0x5ff015[_0xd887('0x3d')][_0xd887('0x42')]));_0x516c68['attributes']=_0x516c68[_0xd887('0x41')][_0xd887('0x43')]?_0x516c68[_0xd887('0x41')]:_0x5e0f8f[_0xd887('0x3c')];if(_0x5ff015['query'][_0xd887('0x4e')]){_0x516c68[_0xd887('0x4b')]=[{'all':!![]}];}_0x516c68=_[_0xd887('0x49')]({},_0x516c68,_0x5ff015['options']);return db[_0xd887('0x38')][_0xd887('0x4f')](_0x516c68)['then'](handleEntityNotFound(_0x2eadbf,null))[_0xd887('0x1d')](respondWithResult(_0x2eadbf,null))['catch'](handleError(_0x2eadbf,null));};exports['create']=function(_0x3c040a,_0xda19d8){return db[_0xd887('0x38')][_0xd887('0x50')](_0x3c040a[_0xd887('0x51')],{})['then'](respondWithResult(_0xda19d8,0xc9))[_0xd887('0x52')](handleError(_0xda19d8,null));};exports['update']=function(_0x27bd79,_0x46549b){if(_0x27bd79[_0xd887('0x51')]['id']){delete _0x27bd79['body']['id'];}return db[_0xd887('0x38')][_0xd887('0x4f')]({'where':{'id':_0x27bd79[_0xd887('0x4d')]['id']}})[_0xd887('0x1d')](handleEntityNotFound(_0x46549b,null))[_0xd887('0x1d')](saveUpdates(_0x27bd79['body'],null))[_0xd887('0x1d')](respondWithResult(_0x46549b,null))['catch'](handleError(_0x46549b,null));};exports[_0xd887('0x53')]=function(_0x42a81f,_0x2b0579){return db['FreshdeskConfiguration'][_0xd887('0x4f')]({'where':{'id':_0x42a81f['params']['id']}})[_0xd887('0x1d')](handleEntityNotFound(_0x2b0579,null))[_0xd887('0x1d')](removeEntity(_0x2b0579,null))[_0xd887('0x52')](handleError(_0x2b0579,null));};exports[_0xd887('0x54')]=function(_0x144b4b,_0x4d285d,_0x4fb20a){var _0x9f7c09={};var _0x322f12={};var _0x38c614;var _0xcc5720;return db[_0xd887('0x38')][_0xd887('0x55')]({'where':{'id':_0x144b4b[_0xd887('0x4d')]['id']}})[_0xd887('0x1d')](handleEntityNotFound(_0x4d285d,null))['then'](function(_0x309e0e){if(_0x309e0e){_0x38c614=_0x309e0e;_0x322f12[_0xd887('0x3c')]=_['keys'](db[_0xd887('0x56')]['rawAttributes']);_0x322f12[_0xd887('0x3d')]=_[_0xd887('0x3e')](_0x144b4b[_0xd887('0x3d')]);_0x322f12['filters']=_[_0xd887('0x40')](_0x322f12[_0xd887('0x3c')],_0x322f12[_0xd887('0x3d')]);_0x9f7c09['attributes']=_[_0xd887('0x40')](_0x322f12[_0xd887('0x3c')],qs[_0xd887('0x42')](_0x144b4b['query']['fields']));_0x9f7c09[_0xd887('0x41')]=_0x9f7c09[_0xd887('0x41')][_0xd887('0x43')]?_0x9f7c09[_0xd887('0x41')]:_0x322f12['model'];_0x9f7c09[_0xd887('0x45')]=qs['sort'](_0x144b4b[_0xd887('0x3d')]['sort']);_0x9f7c09[_0xd887('0x48')]=qs['filters'](_[_0xd887('0x57')](_0x144b4b['query'],_0x322f12['filters']));if(_0x144b4b['query'][_0xd887('0x47')]){_0x9f7c09['where']=_[_0xd887('0x49')](_0x9f7c09[_0xd887('0x48')],{'$or':_['map'](_0x9f7c09[_0xd887('0x41')],function(_0x21efa6){var _0x387e30={};_0x387e30[_0x21efa6]={'$like':'%'+_0x144b4b['query']['filter']+'%'};return _0x387e30;})});}_0x9f7c09=_['merge']({},_0x9f7c09,_0x144b4b[_0xd887('0x4a')]);return _0x38c614['getFields'](_0x9f7c09);}})['then'](function(_0x113d0e){if(_0x113d0e){_0xcc5720=_0x113d0e[_0xd887('0x43')];if(!_0x144b4b[_0xd887('0x3d')][_0xd887('0x44')](_0xd887('0x58'))){_0x9f7c09[_0xd887('0x2f')]=qs['limit'](_0x144b4b['query']['limit']);_0x9f7c09[_0xd887('0x2c')]=qs[_0xd887('0x2c')](_0x144b4b[_0xd887('0x3d')][_0xd887('0x2c')]);}return _0x38c614['getFields'](_0x9f7c09);}})[_0xd887('0x1d')](function(_0x190f3c){if(_0x190f3c){return _0x190f3c?{'count':_0xcc5720,'rows':_0x190f3c}:null;}})[_0xd887('0x1d')](respondWithResult(_0x4d285d,null))[_0xd887('0x52')](handleError(_0x4d285d,null));};exports['getSubjects']=function(_0x18aa2e,_0x4b9a05,_0x11f38b){var _0x4c181a={};var _0x5d9b42={};var _0x32deb9;var _0x469f1e;return db['FreshdeskConfiguration'][_0xd887('0x55')]({'where':{'id':_0x18aa2e[_0xd887('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4b9a05,null))[_0xd887('0x1d')](function(_0x46baf9){if(_0x46baf9){_0x32deb9=_0x46baf9;_0x5d9b42[_0xd887('0x3c')]=_['keys'](db[_0xd887('0x56')][_0xd887('0x39')]);_0x5d9b42[_0xd887('0x3d')]=_['keys'](_0x18aa2e[_0xd887('0x3d')]);_0x5d9b42['filters']=_[_0xd887('0x40')](_0x5d9b42[_0xd887('0x3c')],_0x5d9b42[_0xd887('0x3d')]);_0x4c181a[_0xd887('0x41')]=_['intersection'](_0x5d9b42['model'],qs['fields'](_0x18aa2e[_0xd887('0x3d')][_0xd887('0x42')]));_0x4c181a['attributes']=_0x4c181a[_0xd887('0x41')]['length']?_0x4c181a['attributes']:_0x5d9b42[_0xd887('0x3c')];_0x4c181a['order']=qs['sort'](_0x18aa2e['query']['sort']);_0x4c181a[_0xd887('0x48')]=qs[_0xd887('0x3f')](_[_0xd887('0x57')](_0x18aa2e[_0xd887('0x3d')],_0x5d9b42['filters']));if(_0x18aa2e[_0xd887('0x3d')]['filter']){_0x4c181a[_0xd887('0x48')]=_[_0xd887('0x49')](_0x4c181a[_0xd887('0x48')],{'$or':_[_0xd887('0x37')](_0x4c181a[_0xd887('0x41')],function(_0x3aab85){var _0x554323={};_0x554323[_0x3aab85]={'$like':'%'+_0x18aa2e[_0xd887('0x3d')][_0xd887('0x47')]+'%'};return _0x554323;})});}_0x4c181a=_[_0xd887('0x49')]({},_0x4c181a,_0x18aa2e[_0xd887('0x4a')]);return _0x32deb9[_0xd887('0x59')](_0x4c181a);}})[_0xd887('0x1d')](function(_0x31f686){if(_0x31f686){_0x469f1e=_0x31f686[_0xd887('0x43')];if(!_0x18aa2e[_0xd887('0x3d')][_0xd887('0x44')](_0xd887('0x58'))){_0x4c181a['limit']=qs['limit'](_0x18aa2e[_0xd887('0x3d')]['limit']);_0x4c181a[_0xd887('0x2c')]=qs[_0xd887('0x2c')](_0x18aa2e['query'][_0xd887('0x2c')]);}return _0x32deb9[_0xd887('0x59')](_0x4c181a);}})[_0xd887('0x1d')](function(_0x1c2760){if(_0x1c2760){return _0x1c2760?{'count':_0x469f1e,'rows':_0x1c2760}:null;}})['then'](respondWithResult(_0x4b9a05,null))['catch'](handleError(_0x4b9a05,null));};exports[_0xd887('0x5a')]=function(_0x49c5dc,_0x410ce9,_0x23b7cb){var _0xeb474={};var _0x4503bf={};var _0x2fdaa7;var _0x156556;return db[_0xd887('0x38')]['findOne']({'where':{'id':_0x49c5dc[_0xd887('0x4d')]['id']}})[_0xd887('0x1d')](handleEntityNotFound(_0x410ce9,null))['then'](function(_0x9e03cd){if(_0x9e03cd){_0x2fdaa7=_0x9e03cd;_0x4503bf[_0xd887('0x3c')]=_[_0xd887('0x3e')](db[_0xd887('0x56')][_0xd887('0x39')]);_0x4503bf[_0xd887('0x3d')]=_[_0xd887('0x3e')](_0x49c5dc[_0xd887('0x3d')]);_0x4503bf[_0xd887('0x3f')]=_[_0xd887('0x40')](_0x4503bf[_0xd887('0x3c')],_0x4503bf[_0xd887('0x3d')]);_0xeb474['attributes']=_['intersection'](_0x4503bf[_0xd887('0x3c')],qs[_0xd887('0x42')](_0x49c5dc[_0xd887('0x3d')][_0xd887('0x42')]));_0xeb474['attributes']=_0xeb474['attributes']['length']?_0xeb474[_0xd887('0x41')]:_0x4503bf[_0xd887('0x3c')];_0xeb474['order']=qs[_0xd887('0x46')](_0x49c5dc[_0xd887('0x3d')][_0xd887('0x46')]);_0xeb474[_0xd887('0x48')]=qs[_0xd887('0x3f')](_[_0xd887('0x57')](_0x49c5dc[_0xd887('0x3d')],_0x4503bf['filters']));if(_0x49c5dc[_0xd887('0x3d')][_0xd887('0x47')]){_0xeb474[_0xd887('0x48')]=_[_0xd887('0x49')](_0xeb474[_0xd887('0x48')],{'$or':_[_0xd887('0x37')](_0xeb474[_0xd887('0x41')],function(_0x1035b5){var _0x5b767b={};_0x5b767b[_0x1035b5]={'$like':'%'+_0x49c5dc[_0xd887('0x3d')]['filter']+'%'};return _0x5b767b;})});}_0xeb474=_[_0xd887('0x49')]({},_0xeb474,_0x49c5dc['options']);return _0x2fdaa7[_0xd887('0x5a')](_0xeb474);}})['then'](function(_0x83855b){if(_0x83855b){_0x156556=_0x83855b['length'];if(!_0x49c5dc[_0xd887('0x3d')][_0xd887('0x44')](_0xd887('0x58'))){_0xeb474['limit']=qs[_0xd887('0x2f')](_0x49c5dc[_0xd887('0x3d')]['limit']);_0xeb474['offset']=qs[_0xd887('0x2c')](_0x49c5dc[_0xd887('0x3d')][_0xd887('0x2c')]);}return _0x2fdaa7[_0xd887('0x5a')](_0xeb474);}})['then'](function(_0x35ea54){if(_0x35ea54){return _0x35ea54?{'count':_0x156556,'rows':_0x35ea54}:null;}})[_0xd887('0x1d')](respondWithResult(_0x410ce9,null))[_0xd887('0x52')](handleError(_0x410ce9,null));};exports[_0xd887('0x5b')]=function(_0x55d3f6,_0xb6c791,_0x197aec){var _0x2b4015={};var _0x5013ab={};var _0x26c4a8;var _0x507ed1;return db[_0xd887('0x38')][_0xd887('0x55')]({'where':{'id':_0x55d3f6[_0xd887('0x4d')]['id']}})['then'](handleEntityNotFound(_0xb6c791,null))['then'](function(_0xa990d3){if(_0xa990d3){_0x26c4a8=_0xa990d3;_0x5013ab[_0xd887('0x3c')]=_[_0xd887('0x3e')](db['Tag'][_0xd887('0x39')]);_0x5013ab[_0xd887('0x3d')]=_[_0xd887('0x3e')](_0x55d3f6[_0xd887('0x3d')]);_0x5013ab[_0xd887('0x3f')]=_['intersection'](_0x5013ab['model'],_0x5013ab[_0xd887('0x3d')]);_0x2b4015['attributes']=_[_0xd887('0x40')](_0x5013ab['model'],qs[_0xd887('0x42')](_0x55d3f6[_0xd887('0x3d')][_0xd887('0x42')]));_0x2b4015[_0xd887('0x41')]=_0x2b4015[_0xd887('0x41')]['length']?_0x2b4015[_0xd887('0x41')]:_0x5013ab[_0xd887('0x3c')];_0x2b4015['order']=qs[_0xd887('0x46')](_0x55d3f6['query'][_0xd887('0x46')]);_0x2b4015[_0xd887('0x48')]=qs['filters'](_[_0xd887('0x57')](_0x55d3f6['query'],_0x5013ab[_0xd887('0x3f')]));if(_0x55d3f6[_0xd887('0x3d')][_0xd887('0x47')]){_0x2b4015[_0xd887('0x48')]=_[_0xd887('0x49')](_0x2b4015[_0xd887('0x48')],{'$or':_[_0xd887('0x37')](_0x2b4015[_0xd887('0x41')],function(_0x4d2aab){var _0x5e0805={};_0x5e0805[_0x4d2aab]={'$like':'%'+_0x55d3f6['query'][_0xd887('0x47')]+'%'};return _0x5e0805;})});}_0x2b4015=_['merge']({},_0x2b4015,_0x55d3f6['options']);return _0x26c4a8[_0xd887('0x5b')](_0x2b4015);}})[_0xd887('0x1d')](function(_0x19ef79){if(_0x19ef79){_0x507ed1=_0x19ef79[_0xd887('0x43')];if(!_0x55d3f6[_0xd887('0x3d')][_0xd887('0x44')](_0xd887('0x58'))){_0x2b4015[_0xd887('0x2f')]=qs[_0xd887('0x2f')](_0x55d3f6[_0xd887('0x3d')]['limit']);_0x2b4015[_0xd887('0x2c')]=qs['offset'](_0x55d3f6[_0xd887('0x3d')][_0xd887('0x2c')]);}return _0x26c4a8['getTags'](_0x2b4015);}})[_0xd887('0x1d')](function(_0x544172){if(_0x544172){return _0x544172?{'count':_0x507ed1,'rows':_0x544172}:null;}})['then'](respondWithResult(_0xb6c791,null))[_0xd887('0x52')](handleError(_0xb6c791,null));};exports[_0xd887('0x5c')]=function(_0x328214,_0x485e33,_0x8edd93){if(_0x328214[_0xd887('0x51')]['id']){delete _0x328214[_0xd887('0x51')]['id'];}return db[_0xd887('0x38')][_0xd887('0x55')]({'where':{'id':_0x328214[_0xd887('0x4d')]['id']}})['then'](handleEntityNotFound(_0x485e33,null))[_0xd887('0x1d')](function(_0x379023){if(_0x379023){return _0x379023[_0xd887('0x5c')](_0x328214[_0xd887('0x51')][_0xd887('0x5d')]||[]);}return null;})[_0xd887('0x1d')](respondWithResult(_0x485e33,null))[_0xd887('0x52')](handleError(_0x485e33,null));}; \ No newline at end of file +var _0x7740=['fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','FreshdeskConfiguration','rawAttributes','type','key','keys','filters','model','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','intersection','include','find','create','body','findOne','FreshdeskField','order','getFields','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir'];(function(_0x4827a3,_0x2c76be){var _0x42db08=function(_0x2ebd78){while(--_0x2ebd78){_0x4827a3['push'](_0x4827a3['shift']());}};_0x42db08(++_0x2c76be);}(_0x7740,0xbd));var _0x0774=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x7740[_0x393d69];return _0x3cee37;};'use strict';var emlformat=require(_0x0774('0x0'));var rimraf=require(_0x0774('0x1'));var zipdir=require(_0x0774('0x2'));var jsonpatch=require(_0x0774('0x3'));var rp=require(_0x0774('0x4'));var moment=require(_0x0774('0x5'));var BPromise=require(_0x0774('0x6'));var Mustache=require(_0x0774('0x7'));var util=require(_0x0774('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0774('0x9'));var ejs=require(_0x0774('0xa'));var fs=require('fs');var fs_extra=require(_0x0774('0xb'));var _=require(_0x0774('0xc'));var squel=require('squel');var crypto=require(_0x0774('0xd'));var jsforce=require(_0x0774('0xe'));var deskjs=require(_0x0774('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0774('0x10'));var Papa=require(_0x0774('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0774('0x12'));var hardwareService=require(_0x0774('0x13'));var logger=require(_0x0774('0x14'))(_0x0774('0x15'));var utils=require(_0x0774('0x16'));var config=require(_0x0774('0x17'));var licenseUtil=require(_0x0774('0x18'));var db=require(_0x0774('0x19'))['db'];var jayson=require(_0x0774('0x1a'));var client=jayson[_0x0774('0x1b')][_0x0774('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x37dfbc,_0xb16d8d,_0x17eb36,_0x472fed){return new BPromise(function(_0x3a1de2,_0x4e7dee){var _0x62c361=_0x472fed||client;return _0x62c361['request'](_0x37dfbc,_0x17eb36)[_0x0774('0x1d')](function(_0x5eaddf){logger[_0x0774('0x1e')](_0x0774('0x1f'),_0xb16d8d,_0x0774('0x20'));logger[_0x0774('0x21')](_0x0774('0x22'),_0xb16d8d,_0x0774('0x20'),JSON[_0x0774('0x23')](_0x5eaddf));if(_0x5eaddf[_0x0774('0x24')]){if(_0x5eaddf[_0x0774('0x24')]['code']===0x1f4){logger[_0x0774('0x24')](_0x0774('0x1f'),_0xb16d8d,_0x5eaddf['error']['message']);return _0x4e7dee(_0x5eaddf[_0x0774('0x24')][_0x0774('0x25')]);}logger[_0x0774('0x24')](_0x0774('0x1f'),_0xb16d8d,_0x5eaddf[_0x0774('0x24')][_0x0774('0x25')]);return _0x3a1de2(_0x5eaddf[_0x0774('0x24')][_0x0774('0x25')]);}else{logger[_0x0774('0x1e')](_0x0774('0x1f'),_0xb16d8d,_0x0774('0x20'));_0x3a1de2(_0x5eaddf[_0x0774('0x26')][_0x0774('0x25')]);}})[_0x0774('0x27')](function(_0x2c0999){logger[_0x0774('0x24')](_0x0774('0x1f'),_0xb16d8d,_0x2c0999);_0x4e7dee(_0x2c0999);});});}function respondWithStatusCode(_0x1d67ab,_0x52641a){_0x52641a=_0x52641a||0xcc;return function(_0x44fdd9){if(_0x44fdd9){return _0x1d67ab['sendStatus'](_0x52641a);}return _0x1d67ab[_0x0774('0x28')](_0x52641a)[_0x0774('0x29')]();};}function respondWithResult(_0x50f2a3,_0x4bfda3){_0x4bfda3=_0x4bfda3||0xc8;return function(_0x75adbe){if(_0x75adbe){return _0x50f2a3[_0x0774('0x28')](_0x4bfda3)[_0x0774('0x2a')](_0x75adbe);}};}function respondWithFilteredResult(_0x368105,_0xd273b2){return function(_0x58b58a){if(_0x58b58a){var _0x55b167=typeof _0xd273b2[_0x0774('0x2b')]===_0x0774('0x2c')&&typeof _0xd273b2[_0x0774('0x2d')]===_0x0774('0x2c');var _0x320620=_0x58b58a[_0x0774('0x2e')];var _0x22e601=_0x55b167?0x0:_0xd273b2[_0x0774('0x2b')];var _0x625d9a=_0x55b167?_0x58b58a[_0x0774('0x2e')]:_0xd273b2[_0x0774('0x2b')]+_0xd273b2[_0x0774('0x2d')];var _0x27d444;if(_0x625d9a>=_0x320620){_0x625d9a=_0x320620;_0x27d444=0xc8;}else{_0x27d444=0xce;}_0x368105[_0x0774('0x28')](_0x27d444);return _0x368105[_0x0774('0x2f')](_0x0774('0x30'),_0x22e601+'-'+_0x625d9a+'/'+_0x320620)[_0x0774('0x2a')](_0x58b58a);}return null;};}function patchUpdates(_0x3fd6c7){return function(_0x35c630){try{jsonpatch[_0x0774('0x31')](_0x35c630,_0x3fd6c7,!![]);}catch(_0x46ed79){return BPromise[_0x0774('0x32')](_0x46ed79);}return _0x35c630[_0x0774('0x33')]();};}function saveUpdates(_0x9bfe14,_0x9b3528){return function(_0x3d28ca){if(_0x3d28ca){return _0x3d28ca[_0x0774('0x34')](_0x9bfe14)[_0x0774('0x1d')](function(_0xb4b752){return _0xb4b752;});}return null;};}function removeEntity(_0x17c9e5,_0xe6ea25){return function(_0x2b2eaa){if(_0x2b2eaa){return _0x2b2eaa[_0x0774('0x35')]()[_0x0774('0x1d')](function(){_0x17c9e5['status'](0xcc)[_0x0774('0x29')]();});}};}function handleEntityNotFound(_0x1a44b9,_0xd23058){return function(_0x1d98ec){if(!_0x1d98ec){_0x1a44b9['sendStatus'](0x194);}return _0x1d98ec;};}function handleError(_0x346528,_0x52c48f){_0x52c48f=_0x52c48f||0x1f4;return function(_0x228501){logger['error'](_0x228501[_0x0774('0x36')]);if(_0x228501[_0x0774('0x37')]){delete _0x228501[_0x0774('0x37')];}_0x346528[_0x0774('0x28')](_0x52c48f)['send'](_0x228501);};}exports[_0x0774('0x38')]=function(_0x4a443e,_0x40995a){var _0x3777aa={},_0x3910dc={},_0x829e67={'count':0x0,'rows':[]};var _0x36b7b6=_[_0x0774('0x39')](db[_0x0774('0x3a')][_0x0774('0x3b')],function(_0x4f101a){return{'name':_0x4f101a['fieldName'],'type':_0x4f101a[_0x0774('0x3c')][_0x0774('0x3d')]};});_0x3910dc['model']=_[_0x0774('0x39')](_0x36b7b6,'name');_0x3910dc['query']=_[_0x0774('0x3e')](_0x4a443e['query']);_0x3910dc[_0x0774('0x3f')]=_['intersection'](_0x3910dc[_0x0774('0x40')],_0x3910dc[_0x0774('0x41')]);_0x3777aa[_0x0774('0x42')]=_['intersection'](_0x3910dc['model'],qs[_0x0774('0x43')](_0x4a443e[_0x0774('0x41')][_0x0774('0x43')]));_0x3777aa['attributes']=_0x3777aa[_0x0774('0x42')][_0x0774('0x44')]?_0x3777aa[_0x0774('0x42')]:_0x3910dc['model'];if(!_0x4a443e[_0x0774('0x41')][_0x0774('0x45')]('nolimit')){_0x3777aa[_0x0774('0x2d')]=qs[_0x0774('0x2d')](_0x4a443e[_0x0774('0x41')][_0x0774('0x2d')]);_0x3777aa[_0x0774('0x2b')]=qs[_0x0774('0x2b')](_0x4a443e[_0x0774('0x41')][_0x0774('0x2b')]);}_0x3777aa['order']=qs[_0x0774('0x46')](_0x4a443e[_0x0774('0x41')][_0x0774('0x46')]);_0x3777aa['where']=qs[_0x0774('0x3f')](_[_0x0774('0x47')](_0x4a443e[_0x0774('0x41')],_0x3910dc[_0x0774('0x3f')]),_0x36b7b6);if(_0x4a443e[_0x0774('0x41')][_0x0774('0x48')]){_0x3777aa[_0x0774('0x49')]=_[_0x0774('0x4a')](_0x3777aa[_0x0774('0x49')],{'$or':_['map'](_0x36b7b6,function(_0x449974){if(_0x449974[_0x0774('0x3c')]!==_0x0774('0x4b')){var _0xc7b136={};_0xc7b136[_0x449974['name']]={'$like':'%'+_0x4a443e['query']['filter']+'%'};return _0xc7b136;}})});}_0x3777aa=_[_0x0774('0x4a')]({},_0x3777aa,_0x4a443e[_0x0774('0x4c')]);var _0x287d27={'where':_0x3777aa['where']};return db[_0x0774('0x3a')][_0x0774('0x2e')](_0x287d27)[_0x0774('0x1d')](function(_0xebbd9e){_0x829e67['count']=_0xebbd9e;if(_0x4a443e['query'][_0x0774('0x4d')]){_0x3777aa['include']=[{'all':!![]}];}return db[_0x0774('0x3a')]['findAll'](_0x3777aa);})[_0x0774('0x1d')](function(_0xbc8758){_0x829e67[_0x0774('0x4e')]=_0xbc8758;return _0x829e67;})[_0x0774('0x1d')](respondWithFilteredResult(_0x40995a,_0x3777aa))[_0x0774('0x27')](handleError(_0x40995a,null));};exports[_0x0774('0x4f')]=function(_0x15241b,_0x52f5a6){var _0x3829fb={'raw':![],'where':{'id':_0x15241b[_0x0774('0x50')]['id']}},_0x5e9b67={};_0x5e9b67[_0x0774('0x40')]=_['keys'](db[_0x0774('0x3a')]['rawAttributes']);_0x5e9b67[_0x0774('0x41')]=_['keys'](_0x15241b[_0x0774('0x41')]);_0x5e9b67[_0x0774('0x3f')]=_[_0x0774('0x51')](_0x5e9b67[_0x0774('0x40')],_0x5e9b67[_0x0774('0x41')]);_0x3829fb[_0x0774('0x42')]=_[_0x0774('0x51')](_0x5e9b67['model'],qs[_0x0774('0x43')](_0x15241b[_0x0774('0x41')][_0x0774('0x43')]));_0x3829fb[_0x0774('0x42')]=_0x3829fb[_0x0774('0x42')][_0x0774('0x44')]?_0x3829fb[_0x0774('0x42')]:_0x5e9b67[_0x0774('0x40')];if(_0x15241b[_0x0774('0x41')]['includeAll']){_0x3829fb[_0x0774('0x52')]=[{'all':!![]}];}_0x3829fb=_[_0x0774('0x4a')]({},_0x3829fb,_0x15241b[_0x0774('0x4c')]);return db[_0x0774('0x3a')][_0x0774('0x53')](_0x3829fb)[_0x0774('0x1d')](handleEntityNotFound(_0x52f5a6,null))[_0x0774('0x1d')](respondWithResult(_0x52f5a6,null))[_0x0774('0x27')](handleError(_0x52f5a6,null));};exports[_0x0774('0x54')]=function(_0x40f143,_0x246c18){return db['FreshdeskConfiguration'][_0x0774('0x54')](_0x40f143[_0x0774('0x55')],{})[_0x0774('0x1d')](respondWithResult(_0x246c18,0xc9))[_0x0774('0x27')](handleError(_0x246c18,null));};exports['update']=function(_0x199f02,_0x708bf){if(_0x199f02[_0x0774('0x55')]['id']){delete _0x199f02[_0x0774('0x55')]['id'];}return db['FreshdeskConfiguration'][_0x0774('0x53')]({'where':{'id':_0x199f02[_0x0774('0x50')]['id']}})[_0x0774('0x1d')](handleEntityNotFound(_0x708bf,null))[_0x0774('0x1d')](saveUpdates(_0x199f02[_0x0774('0x55')],null))['then'](respondWithResult(_0x708bf,null))['catch'](handleError(_0x708bf,null));};exports[_0x0774('0x35')]=function(_0x111334,_0x532950){return db[_0x0774('0x3a')][_0x0774('0x53')]({'where':{'id':_0x111334[_0x0774('0x50')]['id']}})[_0x0774('0x1d')](handleEntityNotFound(_0x532950,null))['then'](removeEntity(_0x532950,null))['catch'](handleError(_0x532950,null));};exports['getFields']=function(_0x4bc469,_0x5359f7,_0x4503d5){var _0x164a39={};var _0x368205={};var _0x28be01;var _0x406c06;return db[_0x0774('0x3a')][_0x0774('0x56')]({'where':{'id':_0x4bc469['params']['id']}})[_0x0774('0x1d')](handleEntityNotFound(_0x5359f7,null))[_0x0774('0x1d')](function(_0x4303bc){if(_0x4303bc){_0x28be01=_0x4303bc;_0x368205['model']=_[_0x0774('0x3e')](db[_0x0774('0x57')][_0x0774('0x3b')]);_0x368205[_0x0774('0x41')]=_[_0x0774('0x3e')](_0x4bc469[_0x0774('0x41')]);_0x368205['filters']=_['intersection'](_0x368205['model'],_0x368205[_0x0774('0x41')]);_0x164a39[_0x0774('0x42')]=_[_0x0774('0x51')](_0x368205[_0x0774('0x40')],qs[_0x0774('0x43')](_0x4bc469[_0x0774('0x41')][_0x0774('0x43')]));_0x164a39[_0x0774('0x42')]=_0x164a39['attributes'][_0x0774('0x44')]?_0x164a39[_0x0774('0x42')]:_0x368205[_0x0774('0x40')];_0x164a39[_0x0774('0x58')]=qs[_0x0774('0x46')](_0x4bc469['query'][_0x0774('0x46')]);_0x164a39[_0x0774('0x49')]=qs[_0x0774('0x3f')](_[_0x0774('0x47')](_0x4bc469[_0x0774('0x41')],_0x368205[_0x0774('0x3f')]));if(_0x4bc469[_0x0774('0x41')]['filter']){_0x164a39['where']=_['merge'](_0x164a39[_0x0774('0x49')],{'$or':_['map'](_0x164a39[_0x0774('0x42')],function(_0x5f2488){var _0x538c6a={};_0x538c6a[_0x5f2488]={'$like':'%'+_0x4bc469[_0x0774('0x41')][_0x0774('0x48')]+'%'};return _0x538c6a;})});}_0x164a39=_['merge']({},_0x164a39,_0x4bc469[_0x0774('0x4c')]);return _0x28be01[_0x0774('0x59')](_0x164a39);}})[_0x0774('0x1d')](function(_0x1148c){if(_0x1148c){_0x406c06=_0x1148c[_0x0774('0x44')];if(!_0x4bc469[_0x0774('0x41')][_0x0774('0x45')](_0x0774('0x5a'))){_0x164a39[_0x0774('0x2d')]=qs[_0x0774('0x2d')](_0x4bc469[_0x0774('0x41')]['limit']);_0x164a39[_0x0774('0x2b')]=qs[_0x0774('0x2b')](_0x4bc469[_0x0774('0x41')]['offset']);}return _0x28be01[_0x0774('0x59')](_0x164a39);}})[_0x0774('0x1d')](function(_0x1dd43d){if(_0x1dd43d){return _0x1dd43d?{'count':_0x406c06,'rows':_0x1dd43d}:null;}})['then'](respondWithResult(_0x5359f7,null))[_0x0774('0x27')](handleError(_0x5359f7,null));};exports[_0x0774('0x5b')]=function(_0x40f1ca,_0x12d59d,_0x882738){var _0x1d8615={};var _0x4d364e={};var _0x5a061e;var _0x28172d;return db[_0x0774('0x3a')][_0x0774('0x56')]({'where':{'id':_0x40f1ca[_0x0774('0x50')]['id']}})['then'](handleEntityNotFound(_0x12d59d,null))[_0x0774('0x1d')](function(_0x2a5110){if(_0x2a5110){_0x5a061e=_0x2a5110;_0x4d364e[_0x0774('0x40')]=_['keys'](db[_0x0774('0x57')][_0x0774('0x3b')]);_0x4d364e[_0x0774('0x41')]=_['keys'](_0x40f1ca[_0x0774('0x41')]);_0x4d364e[_0x0774('0x3f')]=_[_0x0774('0x51')](_0x4d364e[_0x0774('0x40')],_0x4d364e[_0x0774('0x41')]);_0x1d8615[_0x0774('0x42')]=_[_0x0774('0x51')](_0x4d364e['model'],qs[_0x0774('0x43')](_0x40f1ca[_0x0774('0x41')][_0x0774('0x43')]));_0x1d8615[_0x0774('0x42')]=_0x1d8615[_0x0774('0x42')]['length']?_0x1d8615['attributes']:_0x4d364e[_0x0774('0x40')];_0x1d8615[_0x0774('0x58')]=qs['sort'](_0x40f1ca[_0x0774('0x41')][_0x0774('0x46')]);_0x1d8615[_0x0774('0x49')]=qs[_0x0774('0x3f')](_[_0x0774('0x47')](_0x40f1ca[_0x0774('0x41')],_0x4d364e['filters']));if(_0x40f1ca[_0x0774('0x41')][_0x0774('0x48')]){_0x1d8615[_0x0774('0x49')]=_['merge'](_0x1d8615['where'],{'$or':_['map'](_0x1d8615['attributes'],function(_0x5f3402){var _0xd7937e={};_0xd7937e[_0x5f3402]={'$like':'%'+_0x40f1ca[_0x0774('0x41')][_0x0774('0x48')]+'%'};return _0xd7937e;})});}_0x1d8615=_['merge']({},_0x1d8615,_0x40f1ca[_0x0774('0x4c')]);return _0x5a061e[_0x0774('0x5b')](_0x1d8615);}})[_0x0774('0x1d')](function(_0x15837d){if(_0x15837d){_0x28172d=_0x15837d[_0x0774('0x44')];if(!_0x40f1ca[_0x0774('0x41')][_0x0774('0x45')]('nolimit')){_0x1d8615['limit']=qs[_0x0774('0x2d')](_0x40f1ca[_0x0774('0x41')]['limit']);_0x1d8615['offset']=qs[_0x0774('0x2b')](_0x40f1ca['query'][_0x0774('0x2b')]);}return _0x5a061e[_0x0774('0x5b')](_0x1d8615);}})[_0x0774('0x1d')](function(_0x4191aa){if(_0x4191aa){return _0x4191aa?{'count':_0x28172d,'rows':_0x4191aa}:null;}})[_0x0774('0x1d')](respondWithResult(_0x12d59d,null))[_0x0774('0x27')](handleError(_0x12d59d,null));};exports[_0x0774('0x5c')]=function(_0x5c9733,_0x9e5082,_0x54aab9){var _0x40659f={};var _0x589059={};var _0x20706f;var _0x5243ae;return db[_0x0774('0x3a')]['findOne']({'where':{'id':_0x5c9733[_0x0774('0x50')]['id']}})[_0x0774('0x1d')](handleEntityNotFound(_0x9e5082,null))['then'](function(_0x221e59){if(_0x221e59){_0x20706f=_0x221e59;_0x589059[_0x0774('0x40')]=_[_0x0774('0x3e')](db[_0x0774('0x57')][_0x0774('0x3b')]);_0x589059[_0x0774('0x41')]=_[_0x0774('0x3e')](_0x5c9733[_0x0774('0x41')]);_0x589059[_0x0774('0x3f')]=_[_0x0774('0x51')](_0x589059['model'],_0x589059[_0x0774('0x41')]);_0x40659f[_0x0774('0x42')]=_[_0x0774('0x51')](_0x589059['model'],qs[_0x0774('0x43')](_0x5c9733[_0x0774('0x41')][_0x0774('0x43')]));_0x40659f['attributes']=_0x40659f[_0x0774('0x42')]['length']?_0x40659f['attributes']:_0x589059[_0x0774('0x40')];_0x40659f['order']=qs['sort'](_0x5c9733[_0x0774('0x41')][_0x0774('0x46')]);_0x40659f[_0x0774('0x49')]=qs[_0x0774('0x3f')](_[_0x0774('0x47')](_0x5c9733[_0x0774('0x41')],_0x589059[_0x0774('0x3f')]));if(_0x5c9733[_0x0774('0x41')][_0x0774('0x48')]){_0x40659f[_0x0774('0x49')]=_[_0x0774('0x4a')](_0x40659f['where'],{'$or':_['map'](_0x40659f[_0x0774('0x42')],function(_0x348fd2){var _0x41af3a={};_0x41af3a[_0x348fd2]={'$like':'%'+_0x5c9733[_0x0774('0x41')][_0x0774('0x48')]+'%'};return _0x41af3a;})});}_0x40659f=_['merge']({},_0x40659f,_0x5c9733[_0x0774('0x4c')]);return _0x20706f[_0x0774('0x5c')](_0x40659f);}})[_0x0774('0x1d')](function(_0x422d90){if(_0x422d90){_0x5243ae=_0x422d90[_0x0774('0x44')];if(!_0x5c9733['query']['hasOwnProperty']('nolimit')){_0x40659f[_0x0774('0x2d')]=qs[_0x0774('0x2d')](_0x5c9733[_0x0774('0x41')][_0x0774('0x2d')]);_0x40659f[_0x0774('0x2b')]=qs[_0x0774('0x2b')](_0x5c9733['query'][_0x0774('0x2b')]);}return _0x20706f[_0x0774('0x5c')](_0x40659f);}})[_0x0774('0x1d')](function(_0x18e8c6){if(_0x18e8c6){return _0x18e8c6?{'count':_0x5243ae,'rows':_0x18e8c6}:null;}})[_0x0774('0x1d')](respondWithResult(_0x9e5082,null))['catch'](handleError(_0x9e5082,null));};exports[_0x0774('0x5d')]=function(_0x5505b0,_0x443b54,_0xcf7288){var _0x13c54f={};var _0x94bcf2={};var _0x2fdd70;var _0x5e074d;return db[_0x0774('0x3a')]['findOne']({'where':{'id':_0x5505b0[_0x0774('0x50')]['id']}})['then'](handleEntityNotFound(_0x443b54,null))['then'](function(_0x5c2eae){if(_0x5c2eae){_0x2fdd70=_0x5c2eae;_0x94bcf2[_0x0774('0x40')]=_[_0x0774('0x3e')](db[_0x0774('0x5e')]['rawAttributes']);_0x94bcf2[_0x0774('0x41')]=_['keys'](_0x5505b0[_0x0774('0x41')]);_0x94bcf2[_0x0774('0x3f')]=_[_0x0774('0x51')](_0x94bcf2[_0x0774('0x40')],_0x94bcf2[_0x0774('0x41')]);_0x13c54f[_0x0774('0x42')]=_[_0x0774('0x51')](_0x94bcf2['model'],qs[_0x0774('0x43')](_0x5505b0[_0x0774('0x41')][_0x0774('0x43')]));_0x13c54f[_0x0774('0x42')]=_0x13c54f[_0x0774('0x42')][_0x0774('0x44')]?_0x13c54f['attributes']:_0x94bcf2[_0x0774('0x40')];_0x13c54f[_0x0774('0x58')]=qs[_0x0774('0x46')](_0x5505b0[_0x0774('0x41')][_0x0774('0x46')]);_0x13c54f[_0x0774('0x49')]=qs[_0x0774('0x3f')](_[_0x0774('0x47')](_0x5505b0[_0x0774('0x41')],_0x94bcf2[_0x0774('0x3f')]));if(_0x5505b0[_0x0774('0x41')][_0x0774('0x48')]){_0x13c54f[_0x0774('0x49')]=_[_0x0774('0x4a')](_0x13c54f[_0x0774('0x49')],{'$or':_[_0x0774('0x39')](_0x13c54f[_0x0774('0x42')],function(_0x503a9c){var _0x3048d2={};_0x3048d2[_0x503a9c]={'$like':'%'+_0x5505b0[_0x0774('0x41')][_0x0774('0x48')]+'%'};return _0x3048d2;})});}_0x13c54f=_[_0x0774('0x4a')]({},_0x13c54f,_0x5505b0[_0x0774('0x4c')]);return _0x2fdd70[_0x0774('0x5d')](_0x13c54f);}})['then'](function(_0x34fd8f){if(_0x34fd8f){_0x5e074d=_0x34fd8f[_0x0774('0x44')];if(!_0x5505b0[_0x0774('0x41')][_0x0774('0x45')]('nolimit')){_0x13c54f[_0x0774('0x2d')]=qs['limit'](_0x5505b0[_0x0774('0x41')][_0x0774('0x2d')]);_0x13c54f[_0x0774('0x2b')]=qs[_0x0774('0x2b')](_0x5505b0[_0x0774('0x41')][_0x0774('0x2b')]);}return _0x2fdd70[_0x0774('0x5d')](_0x13c54f);}})[_0x0774('0x1d')](function(_0x4a85d2){if(_0x4a85d2){return _0x4a85d2?{'count':_0x5e074d,'rows':_0x4a85d2}:null;}})[_0x0774('0x1d')](respondWithResult(_0x443b54,null))[_0x0774('0x27')](handleError(_0x443b54,null));};exports[_0x0774('0x5f')]=function(_0x271311,_0x1ee34c,_0x227081){if(_0x271311['body']['id']){delete _0x271311['body']['id'];}return db[_0x0774('0x3a')]['findOne']({'where':{'id':_0x271311[_0x0774('0x50')]['id']}})[_0x0774('0x1d')](handleEntityNotFound(_0x1ee34c,null))[_0x0774('0x1d')](function(_0x35c200){if(_0x35c200){return _0x35c200[_0x0774('0x5f')](_0x271311[_0x0774('0x55')]['ids']||[]);}return null;})[_0x0774('0x1d')](respondWithResult(_0x1ee34c,null))[_0x0774('0x27')](handleError(_0x1ee34c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 1c1787a..c5e2429 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 _0x4824=['../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x15ebfa,_0x1b15e4){var _0xf2781f=function(_0x54a3f7){while(--_0x54a3f7){_0x15ebfa['push'](_0x15ebfa['shift']());}};_0xf2781f(++_0x1b15e4);}(_0x4824,0xc0));var _0x4482=function(_0x41898b,_0x44acab){_0x41898b=_0x41898b-0x0;var _0x568f31=_0x4824[_0x41898b];return _0x568f31;};'use strict';var _=require('lodash');var util=require(_0x4482('0x0'));var logger=require(_0x4482('0x1'))(_0x4482('0x2'));var moment=require('moment');var BPromise=require(_0x4482('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4482('0x4'));var rimraf=require(_0x4482('0x5'));var config=require(_0x4482('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x4482('0x7')]=function(_0x589b69,_0x2a6137){return _0x589b69[_0x4482('0x8')](_0x4482('0x9'),attributes,{'tableName':_0x4482('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b71=['../../config/logger','moment','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','FreshdeskConfiguration','int_freshdesk_configurations','util'];(function(_0x4704dc,_0x575a5f){var _0x254d81=function(_0x3b135d){while(--_0x3b135d){_0x4704dc['push'](_0x4704dc['shift']());}};_0x254d81(++_0x575a5f);}(_0x0b71,0x170));var _0x10b7=function(_0x64f4bc,_0x232ea1){_0x64f4bc=_0x64f4bc-0x0;var _0x3bec49=_0x0b71[_0x64f4bc];return _0x3bec49;};'use strict';var _=require('lodash');var util=require(_0x10b7('0x0'));var logger=require(_0x10b7('0x1'))('api');var moment=require(_0x10b7('0x2'));var BPromise=require('bluebird');var rp=require(_0x10b7('0x3'));var fs=require('fs');var path=require(_0x10b7('0x4'));var rimraf=require('rimraf');var config=require(_0x10b7('0x5'));var attributes=require(_0x10b7('0x6'));module['exports']=function(_0x154b4e,_0x482d13){return _0x154b4e['define'](_0x10b7('0x7'),attributes,{'tableName':_0x10b7('0x8'),'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 43d05e4..a2c943c 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 _0x9646=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x30b53e,_0x462c0a){var _0x175bcf=function(_0x400f71){while(--_0x400f71){_0x30b53e['push'](_0x30b53e['shift']());}};_0x175bcf(++_0x462c0a);}(_0x9646,0x15a));var _0x6964=function(_0x39e4a1,_0x4edcc5){_0x39e4a1=_0x39e4a1-0x0;var _0x55b30e=_0x9646[_0x39e4a1];return _0x55b30e;};'use strict';var _=require(_0x6964('0x0'));var util=require(_0x6964('0x1'));var moment=require('moment');var BPromise=require(_0x6964('0x2'));var rs=require(_0x6964('0x3'));var fs=require('fs');var Redis=require(_0x6964('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6964('0x5'));var logger=require(_0x6964('0x6'))(_0x6964('0x7'));var config=require(_0x6964('0x8'));var jayson=require(_0x6964('0x9'));var client=jayson[_0x6964('0xa')][_0x6964('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c40cd,_0x1c0a8b,_0x12152e){return new BPromise(function(_0x503852,_0x585b6e){return client[_0x6964('0xc')](_0x1c40cd,_0x12152e)[_0x6964('0xd')](function(_0x91bc57){logger[_0x6964('0xe')](_0x6964('0xf'),_0x1c0a8b,'request\x20sent');logger['debug'](_0x6964('0x10'),_0x1c0a8b,'request\x20sent',JSON[_0x6964('0x11')](_0x91bc57));if(_0x91bc57[_0x6964('0x12')]){if(_0x91bc57['error']['code']===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1c0a8b,_0x91bc57[_0x6964('0x12')][_0x6964('0x13')]);return _0x585b6e(_0x91bc57[_0x6964('0x12')][_0x6964('0x13')]);}logger['error'](_0x6964('0xf'),_0x1c0a8b,_0x91bc57[_0x6964('0x12')]['message']);return _0x503852(_0x91bc57['error']['message']);}else{logger['info'](_0x6964('0xf'),_0x1c0a8b,'request\x20sent');_0x503852(_0x91bc57[_0x6964('0x14')][_0x6964('0x13')]);}})[_0x6964('0x15')](function(_0x20f178){logger[_0x6964('0x12')](_0x6964('0xf'),_0x1c0a8b,_0x20f178);_0x585b6e(_0x20f178);});});} \ No newline at end of file +var _0x3876=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x586de9,_0x102c93){var _0x1a6327=function(_0x22ab38){while(--_0x22ab38){_0x586de9['push'](_0x586de9['shift']());}};_0x1a6327(++_0x102c93);}(_0x3876,0x81));var _0x6387=function(_0x7e4685,_0xef3f68){_0x7e4685=_0x7e4685-0x0;var _0x99d33f=_0x3876[_0x7e4685];return _0x99d33f;};'use strict';var _=require(_0x6387('0x0'));var util=require(_0x6387('0x1'));var moment=require(_0x6387('0x2'));var BPromise=require(_0x6387('0x3'));var rs=require(_0x6387('0x4'));var fs=require('fs');var Redis=require(_0x6387('0x5'));var db=require(_0x6387('0x6'))['db'];var utils=require(_0x6387('0x7'));var logger=require(_0x6387('0x8'))(_0x6387('0x9'));var config=require(_0x6387('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6387('0xb')][_0x6387('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38fcb7,_0x13e295,_0x4dc1e9){return new BPromise(function(_0x27959f,_0x1e8a4){return client[_0x6387('0xd')](_0x38fcb7,_0x4dc1e9)[_0x6387('0xe')](function(_0x307cc8){logger[_0x6387('0xf')](_0x6387('0x10'),_0x13e295,_0x6387('0x11'));logger[_0x6387('0x12')](_0x6387('0x13'),_0x13e295,_0x6387('0x11'),JSON[_0x6387('0x14')](_0x307cc8));if(_0x307cc8[_0x6387('0x15')]){if(_0x307cc8[_0x6387('0x15')][_0x6387('0x16')]===0x1f4){logger[_0x6387('0x15')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x13e295,_0x307cc8[_0x6387('0x15')][_0x6387('0x17')]);return _0x1e8a4(_0x307cc8[_0x6387('0x15')]['message']);}logger[_0x6387('0x15')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x13e295,_0x307cc8[_0x6387('0x15')][_0x6387('0x17')]);return _0x27959f(_0x307cc8['error']['message']);}else{logger['info'](_0x6387('0x10'),_0x13e295,'request\x20sent');_0x27959f(_0x307cc8[_0x6387('0x18')]['message']);}})[_0x6387('0x19')](function(_0x49916c){logger['error'](_0x6387('0x10'),_0x13e295,_0x49916c);_0x1e8a4(_0x49916c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index b5751ed..8f1b396 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 _0xca45=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','show','post','isAuthenticated','create','update','delete','/:id','destroy','exports','multer'];(function(_0x764874,_0x3ed544){var _0x29f9d5=function(_0x152dad){while(--_0x152dad){_0x764874['push'](_0x764874['shift']());}};_0x29f9d5(++_0x3ed544);}(_0xca45,0x19d));var _0x5ca4=function(_0x1b8962,_0x4e44f0){_0x1b8962=_0x1b8962-0x0;var _0x593fb7=_0xca45[_0x1b8962];return _0x593fb7;};'use strict';var multer=require(_0x5ca4('0x0'));var util=require(_0x5ca4('0x1'));var path=require(_0x5ca4('0x2'));var timeout=require(_0x5ca4('0x3'));var express=require(_0x5ca4('0x4'));var router=express['Router']();var fs_extra=require(_0x5ca4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5ca4('0x6'));var config=require(_0x5ca4('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x5ca4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5ca4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5ca4('0x9')]);router[_0x5ca4('0xa')]('/',auth[_0x5ca4('0xb')](),controller[_0x5ca4('0xc')]);router['put']('/:id',auth[_0x5ca4('0xb')](),controller[_0x5ca4('0xd')]);router[_0x5ca4('0xe')](_0x5ca4('0xf'),auth[_0x5ca4('0xb')](),controller[_0x5ca4('0x10')]);module[_0x5ca4('0x11')]=router; \ No newline at end of file +var _0xa7b1=['get','index','/:id','isAuthenticated','create','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','./intFreshdeskField.controller'];(function(_0x3875ed,_0x3b9fc2){var _0x1d1abf=function(_0x2020f4){while(--_0x2020f4){_0x3875ed['push'](_0x3875ed['shift']());}};_0x1d1abf(++_0x3b9fc2);}(_0xa7b1,0x1da));var _0x1a7b=function(_0x2f4a31,_0x3144fa){_0x2f4a31=_0x2f4a31-0x0;var _0x5732b6=_0xa7b1[_0x2f4a31];return _0x5732b6;};'use strict';var multer=require(_0x1a7b('0x0'));var util=require(_0x1a7b('0x1'));var path=require(_0x1a7b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1a7b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1a7b('0x4'));var config=require('../../config/environment');var controller=require(_0x1a7b('0x5'));router[_0x1a7b('0x6')]('/',auth['isAuthenticated'](),controller[_0x1a7b('0x7')]);router['get'](_0x1a7b('0x8'),auth[_0x1a7b('0x9')](),controller['show']);router['post']('/',auth[_0x1a7b('0x9')](),controller[_0x1a7b('0xa')]);router[_0x1a7b('0xb')](_0x1a7b('0x8'),auth[_0x1a7b('0x9')](),controller[_0x1a7b('0xc')]);router[_0x1a7b('0xd')]('/:id',auth[_0x1a7b('0x9')](),controller['destroy']);module[_0x1a7b('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 1ff5253..1563939 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 _0xcea2=['STRING','BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','string'];(function(_0x2c737e,_0x3df548){var _0xc61af0=function(_0x14c131){while(--_0x14c131){_0x2c737e['push'](_0x2c737e['shift']());}};_0xc61af0(++_0x3df548);}(_0xcea2,0x15a));var _0x2cea=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcea2[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x2cea('0x0'));module['exports']={'type':{'type':Sequelize[_0x2cea('0x1')]('string',_0x2cea('0x2'),_0x2cea('0x3'),_0x2cea('0x4'),'picklist'),'defaultValue':_0x2cea('0x5')},'content':{'type':Sequelize[_0x2cea('0x6')]},'key':{'type':Sequelize[_0x2cea('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x2cea('0x5'),'variable',_0x2cea('0x3'))},'keyContent':{'type':Sequelize[_0x2cea('0x6')]},'idField':{'type':Sequelize[_0x2cea('0x6')]},'nameField':{'type':Sequelize[_0x2cea('0x6')]},'customField':{'type':Sequelize[_0x2cea('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2cea('0x6')]}}; \ No newline at end of file +var _0x008c=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x5412c2,_0x2f3149){var _0x5766d0=function(_0xc6de7d){while(--_0xc6de7d){_0x5412c2['push'](_0x5412c2['shift']());}};_0x5766d0(++_0x2f3149);}(_0x008c,0x188));var _0xc008=function(_0x1657a0,_0x39129c){_0x1657a0=_0x1657a0-0x0;var _0x5246bb=_0x008c[_0x1657a0];return _0x5246bb;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'type':{'type':Sequelize[_0xc008('0x2')](_0xc008('0x3'),_0xc008('0x4'),'customVariable',_0xc008('0x5'),_0xc008('0x6')),'defaultValue':_0xc008('0x3')},'content':{'type':Sequelize[_0xc008('0x7')]},'key':{'type':Sequelize[_0xc008('0x7')]},'keyType':{'type':Sequelize[_0xc008('0x2')](_0xc008('0x3'),_0xc008('0x4'),_0xc008('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc008('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc008('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 2a6e59c..3080181 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 _0x8a6e=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskField','rawAttributes','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','catch','include','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5565d8,_0x4e85a9){var _0x479fc5=function(_0x21baed){while(--_0x21baed){_0x5565d8['push'](_0x5565d8['shift']());}};_0x479fc5(++_0x4e85a9);}(_0x8a6e,0x16c));var _0xe8a6=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x8a6e[_0x138f59];return _0x3d114d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe8a6('0x0'));var jsonpatch=require(_0xe8a6('0x1'));var rp=require(_0xe8a6('0x2'));var moment=require(_0xe8a6('0x3'));var BPromise=require(_0xe8a6('0x4'));var Mustache=require(_0xe8a6('0x5'));var util=require(_0xe8a6('0x6'));var path=require(_0xe8a6('0x7'));var sox=require('sox');var csv=require(_0xe8a6('0x8'));var ejs=require(_0xe8a6('0x9'));var fs=require('fs');var fs_extra=require(_0xe8a6('0xa'));var _=require('lodash');var squel=require(_0xe8a6('0xb'));var crypto=require(_0xe8a6('0xc'));var jsforce=require(_0xe8a6('0xd'));var deskjs=require(_0xe8a6('0xe'));var toCsv=require(_0xe8a6('0x8'));var querystring=require(_0xe8a6('0xf'));var Papa=require(_0xe8a6('0x10'));var Redis=require(_0xe8a6('0x11'));var authService=require(_0xe8a6('0x12'));var qs=require(_0xe8a6('0x13'));var as=require(_0xe8a6('0x14'));var hardwareService=require(_0xe8a6('0x15'));var logger=require(_0xe8a6('0x16'))(_0xe8a6('0x17'));var utils=require(_0xe8a6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe8a6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x521b53,_0x2240f0){_0x2240f0=_0x2240f0||0xcc;return function(_0x1870fe){if(_0x1870fe){return _0x521b53['sendStatus'](_0x2240f0);}return _0x521b53[_0xe8a6('0x1a')](_0x2240f0)[_0xe8a6('0x1b')]();};}function respondWithResult(_0x387033,_0xeafbe6){_0xeafbe6=_0xeafbe6||0xc8;return function(_0x1771e9){if(_0x1771e9){return _0x387033['status'](_0xeafbe6)[_0xe8a6('0x1c')](_0x1771e9);}};}function respondWithFilteredResult(_0xa414c1,_0xcba23f){return function(_0xf9627a){if(_0xf9627a){var _0x35ee4d=typeof _0xcba23f['offset']===_0xe8a6('0x1d')&&typeof _0xcba23f[_0xe8a6('0x1e')]==='undefined';var _0x54864f=_0xf9627a[_0xe8a6('0x1f')];var _0x437e63=_0x35ee4d?0x0:_0xcba23f[_0xe8a6('0x20')];var _0x53e9be=_0x35ee4d?_0xf9627a[_0xe8a6('0x1f')]:_0xcba23f[_0xe8a6('0x20')]+_0xcba23f['limit'];var _0x5a6f4a;if(_0x53e9be>=_0x54864f){_0x53e9be=_0x54864f;_0x5a6f4a=0xc8;}else{_0x5a6f4a=0xce;}_0xa414c1[_0xe8a6('0x1a')](_0x5a6f4a);return _0xa414c1['set'](_0xe8a6('0x21'),_0x437e63+'-'+_0x53e9be+'/'+_0x54864f)[_0xe8a6('0x1c')](_0xf9627a);}return null;};}function patchUpdates(_0x43f375){return function(_0x407a4a){try{jsonpatch[_0xe8a6('0x22')](_0x407a4a,_0x43f375,!![]);}catch(_0x27fc82){return BPromise[_0xe8a6('0x23')](_0x27fc82);}return _0x407a4a[_0xe8a6('0x24')]();};}function saveUpdates(_0x50e6a0,_0x3e1d30){return function(_0x22a31e){if(_0x22a31e){return _0x22a31e[_0xe8a6('0x25')](_0x50e6a0)[_0xe8a6('0x26')](function(_0x494868){return _0x494868;});}return null;};}function removeEntity(_0xffcf3f,_0x168ed0){return function(_0xcd626a){if(_0xcd626a){return _0xcd626a[_0xe8a6('0x27')]()[_0xe8a6('0x26')](function(){_0xffcf3f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x371615,_0x193a1c){return function(_0x13de99){if(!_0x13de99){_0x371615[_0xe8a6('0x28')](0x194);}return _0x13de99;};}function handleError(_0x12968c,_0x49aeba){_0x49aeba=_0x49aeba||0x1f4;return function(_0xc6a07d){logger[_0xe8a6('0x29')](_0xc6a07d[_0xe8a6('0x2a')]);if(_0xc6a07d[_0xe8a6('0x2b')]){delete _0xc6a07d[_0xe8a6('0x2b')];}_0x12968c[_0xe8a6('0x1a')](_0x49aeba)[_0xe8a6('0x2c')](_0xc6a07d);};}exports[_0xe8a6('0x2d')]=function(_0x495a8b,_0x3adbf8){var _0x9b3a09={},_0x45939d={},_0x3cf56d={'count':0x0,'rows':[]};var _0xf176c0=_[_0xe8a6('0x2e')](db[_0xe8a6('0x2f')][_0xe8a6('0x30')],function(_0x21d97c){return{'name':_0x21d97c['fieldName'],'type':_0x21d97c['type'][_0xe8a6('0x31')]};});_0x45939d['model']=_['map'](_0xf176c0,_0xe8a6('0x2b'));_0x45939d['query']=_[_0xe8a6('0x32')](_0x495a8b[_0xe8a6('0x33')]);_0x45939d[_0xe8a6('0x34')]=_['intersection'](_0x45939d['model'],_0x45939d[_0xe8a6('0x33')]);_0x9b3a09[_0xe8a6('0x35')]=_[_0xe8a6('0x36')](_0x45939d[_0xe8a6('0x37')],qs[_0xe8a6('0x38')](_0x495a8b['query'][_0xe8a6('0x38')]));_0x9b3a09['attributes']=_0x9b3a09[_0xe8a6('0x35')][_0xe8a6('0x39')]?_0x9b3a09['attributes']:_0x45939d['model'];if(!_0x495a8b[_0xe8a6('0x33')][_0xe8a6('0x3a')](_0xe8a6('0x3b'))){_0x9b3a09['limit']=qs[_0xe8a6('0x1e')](_0x495a8b[_0xe8a6('0x33')]['limit']);_0x9b3a09[_0xe8a6('0x20')]=qs[_0xe8a6('0x20')](_0x495a8b[_0xe8a6('0x33')][_0xe8a6('0x20')]);}_0x9b3a09[_0xe8a6('0x3c')]=qs[_0xe8a6('0x3d')](_0x495a8b[_0xe8a6('0x33')]['sort']);_0x9b3a09['where']=qs['filters'](_['pick'](_0x495a8b['query'],_0x45939d[_0xe8a6('0x34')]),_0xf176c0);if(_0x495a8b[_0xe8a6('0x33')][_0xe8a6('0x3e')]){_0x9b3a09[_0xe8a6('0x3f')]=_[_0xe8a6('0x40')](_0x9b3a09[_0xe8a6('0x3f')],{'$or':_[_0xe8a6('0x2e')](_0xf176c0,function(_0x4b0b0d){if(_0x4b0b0d[_0xe8a6('0x41')]!==_0xe8a6('0x42')){var _0x1ff8ef={};_0x1ff8ef[_0x4b0b0d[_0xe8a6('0x2b')]]={'$like':'%'+_0x495a8b['query'][_0xe8a6('0x3e')]+'%'};return _0x1ff8ef;}})});}_0x9b3a09=_[_0xe8a6('0x40')]({},_0x9b3a09,_0x495a8b[_0xe8a6('0x43')]);var _0x2e8ed4={'where':_0x9b3a09['where']};return db[_0xe8a6('0x2f')][_0xe8a6('0x1f')](_0x2e8ed4)[_0xe8a6('0x26')](function(_0x1cafd4){_0x3cf56d[_0xe8a6('0x1f')]=_0x1cafd4;if(_0x495a8b[_0xe8a6('0x33')][_0xe8a6('0x44')]){_0x9b3a09['include']=[{'all':!![]}];}return db[_0xe8a6('0x2f')][_0xe8a6('0x45')](_0x9b3a09);})[_0xe8a6('0x26')](function(_0x44b2c0){_0x3cf56d['rows']=_0x44b2c0;return _0x3cf56d;})['then'](respondWithFilteredResult(_0x3adbf8,_0x9b3a09))[_0xe8a6('0x46')](handleError(_0x3adbf8,null));};exports['show']=function(_0x2d3e36,_0x53c1dd){var _0x190d2c={'raw':!![],'where':{'id':_0x2d3e36['params']['id']}},_0x1efb72={};_0x1efb72[_0xe8a6('0x37')]=_[_0xe8a6('0x32')](db['FreshdeskField'][_0xe8a6('0x30')]);_0x1efb72['query']=_[_0xe8a6('0x32')](_0x2d3e36['query']);_0x1efb72[_0xe8a6('0x34')]=_[_0xe8a6('0x36')](_0x1efb72['model'],_0x1efb72[_0xe8a6('0x33')]);_0x190d2c[_0xe8a6('0x35')]=_[_0xe8a6('0x36')](_0x1efb72[_0xe8a6('0x37')],qs[_0xe8a6('0x38')](_0x2d3e36[_0xe8a6('0x33')][_0xe8a6('0x38')]));_0x190d2c[_0xe8a6('0x35')]=_0x190d2c[_0xe8a6('0x35')][_0xe8a6('0x39')]?_0x190d2c[_0xe8a6('0x35')]:_0x1efb72[_0xe8a6('0x37')];if(_0x2d3e36[_0xe8a6('0x33')][_0xe8a6('0x44')]){_0x190d2c[_0xe8a6('0x47')]=[{'all':!![]}];}_0x190d2c=_[_0xe8a6('0x40')]({},_0x190d2c,_0x2d3e36[_0xe8a6('0x43')]);return db['FreshdeskField'][_0xe8a6('0x48')](_0x190d2c)[_0xe8a6('0x26')](handleEntityNotFound(_0x53c1dd,null))[_0xe8a6('0x26')](respondWithResult(_0x53c1dd,null))[_0xe8a6('0x46')](handleError(_0x53c1dd,null));};exports[_0xe8a6('0x49')]=function(_0x17b18d,_0x14d7ce){return db[_0xe8a6('0x2f')][_0xe8a6('0x49')](_0x17b18d[_0xe8a6('0x4a')],{})[_0xe8a6('0x26')](respondWithResult(_0x14d7ce,0xc9))[_0xe8a6('0x46')](handleError(_0x14d7ce,null));};exports[_0xe8a6('0x25')]=function(_0xdce69d,_0x5d4247){if(_0xdce69d[_0xe8a6('0x4a')]['id']){delete _0xdce69d[_0xe8a6('0x4a')]['id'];}return db['FreshdeskField'][_0xe8a6('0x48')]({'where':{'id':_0xdce69d['params']['id']}})[_0xe8a6('0x26')](handleEntityNotFound(_0x5d4247,null))[_0xe8a6('0x26')](saveUpdates(_0xdce69d[_0xe8a6('0x4a')],null))['then'](respondWithResult(_0x5d4247,null))['catch'](handleError(_0x5d4247,null));};exports[_0xe8a6('0x27')]=function(_0x22c5d3,_0x41a1c7){return db[_0xe8a6('0x2f')][_0xe8a6('0x48')]({'where':{'id':_0x22c5d3[_0xe8a6('0x4b')]['id']}})[_0xe8a6('0x26')](handleEntityNotFound(_0x41a1c7,null))[_0xe8a6('0x26')](removeEntity(_0x41a1c7,null))[_0xe8a6('0x46')](handleError(_0x41a1c7,null));}; \ No newline at end of file +var _0xd45b=['find','create','body','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','type','VIRTUAL','merge','FreshdeskField','includeAll','include','rows','catch','params','options'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xd45b,0x11f));var _0xbd45=function(_0x25f35d,_0xe72b3d){_0x25f35d=_0x25f35d-0x0;var _0x20acbe=_0xd45b[_0x25f35d];return _0x20acbe;};'use strict';var emlformat=require(_0xbd45('0x0'));var rimraf=require(_0xbd45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbd45('0x2'));var moment=require(_0xbd45('0x3'));var BPromise=require(_0xbd45('0x4'));var Mustache=require('mustache');var util=require(_0xbd45('0x5'));var path=require(_0xbd45('0x6'));var sox=require(_0xbd45('0x7'));var csv=require(_0xbd45('0x8'));var ejs=require(_0xbd45('0x9'));var fs=require('fs');var fs_extra=require(_0xbd45('0xa'));var _=require(_0xbd45('0xb'));var squel=require(_0xbd45('0xc'));var crypto=require('crypto');var jsforce=require(_0xbd45('0xd'));var deskjs=require(_0xbd45('0xe'));var toCsv=require(_0xbd45('0x8'));var querystring=require(_0xbd45('0xf'));var Papa=require('papaparse');var Redis=require(_0xbd45('0x10'));var authService=require(_0xbd45('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd45('0x12'));var logger=require(_0xbd45('0x13'))(_0xbd45('0x14'));var utils=require(_0xbd45('0x15'));var config=require(_0xbd45('0x16'));var licenseUtil=require(_0xbd45('0x17'));var db=require(_0xbd45('0x18'))['db'];function respondWithStatusCode(_0x9e2aab,_0x5903fc){_0x5903fc=_0x5903fc||0xcc;return function(_0x460d8c){if(_0x460d8c){return _0x9e2aab[_0xbd45('0x19')](_0x5903fc);}return _0x9e2aab[_0xbd45('0x1a')](_0x5903fc)['end']();};}function respondWithResult(_0x143bfb,_0x1fa426){_0x1fa426=_0x1fa426||0xc8;return function(_0x3fe212){if(_0x3fe212){return _0x143bfb[_0xbd45('0x1a')](_0x1fa426)['json'](_0x3fe212);}};}function respondWithFilteredResult(_0x67a704,_0x566efd){return function(_0x346a1e){if(_0x346a1e){var _0x22d361=typeof _0x566efd['offset']===_0xbd45('0x1b')&&typeof _0x566efd[_0xbd45('0x1c')]===_0xbd45('0x1b');var _0x51e0e1=_0x346a1e[_0xbd45('0x1d')];var _0x467795=_0x22d361?0x0:_0x566efd[_0xbd45('0x1e')];var _0x36457f=_0x22d361?_0x346a1e[_0xbd45('0x1d')]:_0x566efd['offset']+_0x566efd[_0xbd45('0x1c')];var _0xb0c281;if(_0x36457f>=_0x51e0e1){_0x36457f=_0x51e0e1;_0xb0c281=0xc8;}else{_0xb0c281=0xce;}_0x67a704[_0xbd45('0x1a')](_0xb0c281);return _0x67a704[_0xbd45('0x1f')](_0xbd45('0x20'),_0x467795+'-'+_0x36457f+'/'+_0x51e0e1)[_0xbd45('0x21')](_0x346a1e);}return null;};}function patchUpdates(_0x55e8ee){return function(_0x56f138){try{jsonpatch['apply'](_0x56f138,_0x55e8ee,!![]);}catch(_0x1a1451){return BPromise['reject'](_0x1a1451);}return _0x56f138[_0xbd45('0x22')]();};}function saveUpdates(_0x2f3c9f,_0x4d2884){return function(_0x2d6577){if(_0x2d6577){return _0x2d6577[_0xbd45('0x23')](_0x2f3c9f)[_0xbd45('0x24')](function(_0x277a71){return _0x277a71;});}return null;};}function removeEntity(_0x26b8e0,_0x4f864d){return function(_0x2a376a){if(_0x2a376a){return _0x2a376a[_0xbd45('0x25')]()[_0xbd45('0x24')](function(){_0x26b8e0[_0xbd45('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33efe9,_0x163512){return function(_0xdf11cf){if(!_0xdf11cf){_0x33efe9[_0xbd45('0x19')](0x194);}return _0xdf11cf;};}function handleError(_0x39aeb7,_0x50f5fa){_0x50f5fa=_0x50f5fa||0x1f4;return function(_0x5f1428){logger[_0xbd45('0x26')](_0x5f1428['stack']);if(_0x5f1428['name']){delete _0x5f1428[_0xbd45('0x27')];}_0x39aeb7[_0xbd45('0x1a')](_0x50f5fa)[_0xbd45('0x28')](_0x5f1428);};}exports[_0xbd45('0x29')]=function(_0x4a8b12,_0x3d9959){var _0x43ac01={},_0x1f5798={},_0x436149={'count':0x0,'rows':[]};var _0xc46e47=_[_0xbd45('0x2a')](db['FreshdeskField'][_0xbd45('0x2b')],function(_0x37655f){return{'name':_0x37655f[_0xbd45('0x2c')],'type':_0x37655f['type'][_0xbd45('0x2d')]};});_0x1f5798['model']=_[_0xbd45('0x2a')](_0xc46e47,_0xbd45('0x27'));_0x1f5798[_0xbd45('0x2e')]=_[_0xbd45('0x2f')](_0x4a8b12['query']);_0x1f5798[_0xbd45('0x30')]=_[_0xbd45('0x31')](_0x1f5798[_0xbd45('0x32')],_0x1f5798['query']);_0x43ac01[_0xbd45('0x33')]=_['intersection'](_0x1f5798[_0xbd45('0x32')],qs[_0xbd45('0x34')](_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x34')]));_0x43ac01[_0xbd45('0x33')]=_0x43ac01[_0xbd45('0x33')][_0xbd45('0x35')]?_0x43ac01[_0xbd45('0x33')]:_0x1f5798[_0xbd45('0x32')];if(!_0x4a8b12['query']['hasOwnProperty'](_0xbd45('0x36'))){_0x43ac01['limit']=qs[_0xbd45('0x1c')](_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x1c')]);_0x43ac01[_0xbd45('0x1e')]=qs[_0xbd45('0x1e')](_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x1e')]);}_0x43ac01['order']=qs[_0xbd45('0x37')](_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x37')]);_0x43ac01[_0xbd45('0x38')]=qs[_0xbd45('0x30')](_['pick'](_0x4a8b12[_0xbd45('0x2e')],_0x1f5798[_0xbd45('0x30')]),_0xc46e47);if(_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x39')]){_0x43ac01[_0xbd45('0x38')]=_['merge'](_0x43ac01[_0xbd45('0x38')],{'$or':_[_0xbd45('0x2a')](_0xc46e47,function(_0x4c8f27){if(_0x4c8f27[_0xbd45('0x3a')]!==_0xbd45('0x3b')){var _0x154cb7={};_0x154cb7[_0x4c8f27['name']]={'$like':'%'+_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x39')]+'%'};return _0x154cb7;}})});}_0x43ac01=_[_0xbd45('0x3c')]({},_0x43ac01,_0x4a8b12['options']);var _0x200cd9={'where':_0x43ac01[_0xbd45('0x38')]};return db[_0xbd45('0x3d')]['count'](_0x200cd9)[_0xbd45('0x24')](function(_0x4a9c63){_0x436149[_0xbd45('0x1d')]=_0x4a9c63;if(_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x3e')]){_0x43ac01[_0xbd45('0x3f')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x43ac01);})['then'](function(_0x111e85){_0x436149[_0xbd45('0x40')]=_0x111e85;return _0x436149;})[_0xbd45('0x24')](respondWithFilteredResult(_0x3d9959,_0x43ac01))[_0xbd45('0x41')](handleError(_0x3d9959,null));};exports['show']=function(_0x4dd69e,_0x46bd14){var _0x53b291={'raw':!![],'where':{'id':_0x4dd69e[_0xbd45('0x42')]['id']}},_0x4a4f82={};_0x4a4f82[_0xbd45('0x32')]=_[_0xbd45('0x2f')](db[_0xbd45('0x3d')][_0xbd45('0x2b')]);_0x4a4f82['query']=_[_0xbd45('0x2f')](_0x4dd69e['query']);_0x4a4f82[_0xbd45('0x30')]=_[_0xbd45('0x31')](_0x4a4f82['model'],_0x4a4f82[_0xbd45('0x2e')]);_0x53b291[_0xbd45('0x33')]=_[_0xbd45('0x31')](_0x4a4f82[_0xbd45('0x32')],qs[_0xbd45('0x34')](_0x4dd69e[_0xbd45('0x2e')]['fields']));_0x53b291['attributes']=_0x53b291['attributes'][_0xbd45('0x35')]?_0x53b291[_0xbd45('0x33')]:_0x4a4f82[_0xbd45('0x32')];if(_0x4dd69e[_0xbd45('0x2e')]['includeAll']){_0x53b291[_0xbd45('0x3f')]=[{'all':!![]}];}_0x53b291=_[_0xbd45('0x3c')]({},_0x53b291,_0x4dd69e[_0xbd45('0x43')]);return db[_0xbd45('0x3d')][_0xbd45('0x44')](_0x53b291)[_0xbd45('0x24')](handleEntityNotFound(_0x46bd14,null))['then'](respondWithResult(_0x46bd14,null))[_0xbd45('0x41')](handleError(_0x46bd14,null));};exports['create']=function(_0x563342,_0x9d12be){return db[_0xbd45('0x3d')][_0xbd45('0x45')](_0x563342[_0xbd45('0x46')],{})[_0xbd45('0x24')](respondWithResult(_0x9d12be,0xc9))[_0xbd45('0x41')](handleError(_0x9d12be,null));};exports[_0xbd45('0x23')]=function(_0x4d9c3a,_0x140a09){if(_0x4d9c3a[_0xbd45('0x46')]['id']){delete _0x4d9c3a[_0xbd45('0x46')]['id'];}return db[_0xbd45('0x3d')][_0xbd45('0x44')]({'where':{'id':_0x4d9c3a[_0xbd45('0x42')]['id']}})['then'](handleEntityNotFound(_0x140a09,null))[_0xbd45('0x24')](saveUpdates(_0x4d9c3a[_0xbd45('0x46')],null))[_0xbd45('0x24')](respondWithResult(_0x140a09,null))[_0xbd45('0x41')](handleError(_0x140a09,null));};exports[_0xbd45('0x25')]=function(_0x3d2955,_0x4e2ab8){return db[_0xbd45('0x3d')]['find']({'where':{'id':_0x3d2955[_0xbd45('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e2ab8,null))[_0xbd45('0x24')](removeEntity(_0x4e2ab8,null))[_0xbd45('0x41')](handleError(_0x4e2ab8,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 6ab933a..fa1e0fe 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 _0xee95=['FreshdeskField','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define'];(function(_0x3b28be,_0x59bb74){var _0x5c86c4=function(_0x218120){while(--_0x218120){_0x3b28be['push'](_0x3b28be['shift']());}};_0x5c86c4(++_0x59bb74);}(_0xee95,0x99));var _0x5ee9=function(_0x4eff0d,_0x347b16){_0x4eff0d=_0x4eff0d-0x0;var _0x1bbaad=_0xee95[_0x4eff0d];return _0x1bbaad;};'use strict';var _=require(_0x5ee9('0x0'));var util=require(_0x5ee9('0x1'));var logger=require('../../config/logger')(_0x5ee9('0x2'));var moment=require(_0x5ee9('0x3'));var BPromise=require(_0x5ee9('0x4'));var rp=require(_0x5ee9('0x5'));var fs=require('fs');var path=require(_0x5ee9('0x6'));var rimraf=require(_0x5ee9('0x7'));var config=require(_0x5ee9('0x8'));var attributes=require(_0x5ee9('0x9'));module[_0x5ee9('0xa')]=function(_0x2dacdb,_0x235ff6){return _0x2dacdb[_0x5ee9('0xb')](_0x5ee9('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x5ee9('0xd'),_0x5ee9('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcfcc=['exports','define','FreshdeskField','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x59de36,_0x93345a){var _0x325ccb=function(_0x5f30cd){while(--_0x5f30cd){_0x59de36['push'](_0x59de36['shift']());}};_0x325ccb(++_0x93345a);}(_0xcfcc,0x1b8));var _0xccfc=function(_0x36728b,_0x2db859){_0x36728b=_0x36728b-0x0;var _0x564222=_0xcfcc[_0x36728b];return _0x564222;};'use strict';var _=require(_0xccfc('0x0'));var util=require(_0xccfc('0x1'));var logger=require(_0xccfc('0x2'))(_0xccfc('0x3'));var moment=require(_0xccfc('0x4'));var BPromise=require(_0xccfc('0x5'));var rp=require(_0xccfc('0x6'));var fs=require('fs');var path=require(_0xccfc('0x7'));var rimraf=require(_0xccfc('0x8'));var config=require(_0xccfc('0x9'));var attributes=require('./intFreshdeskField.attributes');module[_0xccfc('0xa')]=function(_0x41ed2f,_0x400314){return _0x41ed2f[_0xccfc('0xb')](_0xccfc('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xccfc('0xd'),'fields':['idField',_0xccfc('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 9abdc66..04088a7 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 _0x7a54=['info','FreshdeskField,\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(_0x456868,_0x3ff97a){_0x456868=_0x456868-0x0;var _0x4d334b=_0x7a54[_0x456868];return _0x4d334b;};'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')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x2a62b4,_0x4dcdc6){_0x2a62b4=_0x2a62b4-0x0;var _0x2a07f2=_0x7a54[_0x2a62b4];return _0x2a07f2;};'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')]('FreshdeskField,\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/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index d7ea90a..eb5e5d1 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 _0x7f22=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7f22,0x1c5));var _0x27f2=function(_0x43a6e6,_0x293c78){_0x43a6e6=_0x43a6e6-0x0;var _0x520119=_0x7f22[_0x43a6e6];return _0x520119;};'use strict';var multer=require(_0x27f2('0x0'));var util=require(_0x27f2('0x1'));var path=require(_0x27f2('0x2'));var timeout=require(_0x27f2('0x3'));var express=require(_0x27f2('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x27f2('0x5'));var interaction=require(_0x27f2('0x6'));var config=require('../../config/environment');var controller=require(_0x27f2('0x7'));router[_0x27f2('0x8')]('/',auth[_0x27f2('0x9')](),controller[_0x27f2('0xa')]);router[_0x27f2('0x8')]('/:id',auth[_0x27f2('0x9')](),controller[_0x27f2('0xb')]);router['get'](_0x27f2('0xc'),auth[_0x27f2('0x9')](),controller[_0x27f2('0xd')]);router['get'](_0x27f2('0xe'),auth[_0x27f2('0x9')](),controller[_0x27f2('0xf')]);router[_0x27f2('0x10')]('/',auth[_0x27f2('0x9')](),controller[_0x27f2('0x11')]);router[_0x27f2('0x10')](_0x27f2('0xc'),auth[_0x27f2('0x9')](),controller[_0x27f2('0x12')]);router[_0x27f2('0x13')](_0x27f2('0x14'),auth[_0x27f2('0x9')](),controller[_0x27f2('0x15')]);router[_0x27f2('0x16')](_0x27f2('0x14'),auth[_0x27f2('0x9')](),controller[_0x27f2('0x17')]);module[_0x27f2('0x18')]=router; \ No newline at end of file +var _0x1c0a=['post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0x1c0a,0x14a));var _0xa1c0=function(_0x4d7280,_0x1755e9){_0x4d7280=_0x4d7280-0x0;var _0x4c467f=_0x1c0a[_0x4d7280];return _0x4c467f;};'use strict';var multer=require('multer');var util=require(_0xa1c0('0x0'));var path=require(_0xa1c0('0x1'));var timeout=require(_0xa1c0('0x2'));var express=require(_0xa1c0('0x3'));var router=express['Router']();var fs_extra=require(_0xa1c0('0x4'));var auth=require(_0xa1c0('0x5'));var interaction=require(_0xa1c0('0x6'));var config=require('../../config/environment');var controller=require(_0xa1c0('0x7'));router[_0xa1c0('0x8')]('/',auth[_0xa1c0('0x9')](),controller[_0xa1c0('0xa')]);router['get'](_0xa1c0('0xb'),auth[_0xa1c0('0x9')](),controller[_0xa1c0('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xa1c0('0x8')](_0xa1c0('0xd'),auth['isAuthenticated'](),controller[_0xa1c0('0xe')]);router[_0xa1c0('0xf')]('/',auth['isAuthenticated'](),controller[_0xa1c0('0x10')]);router['post'](_0xa1c0('0x11'),auth[_0xa1c0('0x9')](),controller[_0xa1c0('0x12')]);router[_0xa1c0('0x13')](_0xa1c0('0xb'),auth[_0xa1c0('0x9')](),controller[_0xa1c0('0x14')]);router[_0xa1c0('0x15')](_0xa1c0('0xb'),auth[_0xa1c0('0x9')](),controller[_0xa1c0('0x16')]);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 8571300..7bd3fbc 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 _0x7e0c=['remoteUri','sequelize','STRING','username'];(function(_0x54bf2e,_0x379dd3){var _0x5116d4=function(_0x557666){while(--_0x557666){_0x54bf2e['push'](_0x54bf2e['shift']());}};_0x5116d4(++_0x379dd3);}(_0x7e0c,0x1a1));var _0xc7e0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e0c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc7e0('0x0'));module['exports']={'name':{'type':Sequelize[_0xc7e0('0x1')]},'description':{'type':Sequelize[_0xc7e0('0x1')]},'username':{'type':Sequelize[_0xc7e0('0x1')],'unique':_0xc7e0('0x2')},'apiKey':{'type':Sequelize[_0xc7e0('0x1')]},'remoteUri':{'type':Sequelize[_0xc7e0('0x1')],'unique':_0xc7e0('0x3')},'serverUrl':{'type':Sequelize[_0xc7e0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x308c=['STRING','remoteUri','sequelize','exports'];(function(_0x19afb9,_0x3df9e7){var _0x6fc88b=function(_0x5bc9b2){while(--_0x5bc9b2){_0x19afb9['push'](_0x19afb9['shift']());}};_0x6fc88b(++_0x3df9e7);}(_0x308c,0xf2));var _0xc308=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x308c[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0xc308('0x0'));module[_0xc308('0x1')]={'name':{'type':Sequelize[_0xc308('0x2')]},'description':{'type':Sequelize[_0xc308('0x2')]},'username':{'type':Sequelize[_0xc308('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc308('0x3')},'serverUrl':{'type':Sequelize[_0xc308('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 735958e..e6dd08d 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 _0x4453=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','FreshsalesConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','remoteUri','apiKey','username','slice','substring','lastIndexOf','%s%s','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','sendStatus','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4453,0x9c));var _0x3445=function(_0x10d358,_0x594e73){_0x10d358=_0x10d358-0x0;var _0x549c73=_0x4453[_0x10d358];return _0x549c73;};'use strict';var emlformat=require(_0x3445('0x0'));var rimraf=require(_0x3445('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3445('0x2'));var rp=require(_0x3445('0x3'));var moment=require('moment');var BPromise=require(_0x3445('0x4'));var Mustache=require(_0x3445('0x5'));var util=require(_0x3445('0x6'));var path=require(_0x3445('0x7'));var sox=require(_0x3445('0x8'));var csv=require(_0x3445('0x9'));var ejs=require(_0x3445('0xa'));var fs=require('fs');var fs_extra=require(_0x3445('0xb'));var _=require(_0x3445('0xc'));var squel=require(_0x3445('0xd'));var crypto=require('crypto');var jsforce=require(_0x3445('0xe'));var deskjs=require(_0x3445('0xf'));var toCsv=require(_0x3445('0x9'));var querystring=require(_0x3445('0x10'));var Papa=require(_0x3445('0x11'));var Redis=require(_0x3445('0x12'));var authService=require(_0x3445('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3445('0x14'));var hardwareService=require(_0x3445('0x15'));var logger=require(_0x3445('0x16'))(_0x3445('0x17'));var utils=require('../../config/utils');var config=require(_0x3445('0x18'));var licenseUtil=require(_0x3445('0x19'));var db=require(_0x3445('0x1a'))['db'];var integrations=require(_0x3445('0x1b'));var jayson=require(_0x3445('0x1c'));var client=jayson[_0x3445('0x1d')][_0x3445('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4f3621,_0x5be0ce,_0x10ef76,_0x51f5f4){return new BPromise(function(_0x23dfc8,_0x548da1){var _0x357816=_0x51f5f4||client;return _0x357816[_0x3445('0x1f')](_0x4f3621,_0x10ef76)[_0x3445('0x20')](function(_0x3b0339){logger[_0x3445('0x21')](_0x3445('0x22'),_0x5be0ce,_0x3445('0x23'));logger['debug'](_0x3445('0x24'),_0x5be0ce,_0x3445('0x23'),JSON['stringify'](_0x3b0339));if(_0x3b0339[_0x3445('0x25')]){if(_0x3b0339[_0x3445('0x25')][_0x3445('0x26')]===0x1f4){logger[_0x3445('0x25')](_0x3445('0x22'),_0x5be0ce,_0x3b0339[_0x3445('0x25')][_0x3445('0x27')]);return _0x548da1(_0x3b0339[_0x3445('0x25')][_0x3445('0x27')]);}logger['error'](_0x3445('0x22'),_0x5be0ce,_0x3b0339[_0x3445('0x25')][_0x3445('0x27')]);return _0x23dfc8(_0x3b0339['error']['message']);}else{logger[_0x3445('0x21')](_0x3445('0x22'),_0x5be0ce,_0x3445('0x23'));_0x23dfc8(_0x3b0339['result'][_0x3445('0x27')]);}})[_0x3445('0x28')](function(_0x4a5bf0){logger[_0x3445('0x25')]('FreshsalesAccount,\x20%s,\x20%s',_0x5be0ce,_0x4a5bf0);_0x548da1(_0x4a5bf0);});});}function respondWithStatusCode(_0x2cd7ac,_0x5718f2){_0x5718f2=_0x5718f2||0xcc;return function(_0x400446){if(_0x400446){return _0x2cd7ac['sendStatus'](_0x5718f2);}return _0x2cd7ac[_0x3445('0x29')](_0x5718f2)[_0x3445('0x2a')]();};}function respondWithResult(_0x10bfe8,_0xece9b6){_0xece9b6=_0xece9b6||0xc8;return function(_0x4d790c){if(_0x4d790c){return _0x10bfe8[_0x3445('0x29')](_0xece9b6)[_0x3445('0x2b')](_0x4d790c);}};}function respondWithFilteredResult(_0x2596fe,_0x190723){return function(_0xd25bf8){if(_0xd25bf8){var _0x3e53e8=typeof _0x190723['offset']==='undefined'&&typeof _0x190723[_0x3445('0x2c')]===_0x3445('0x2d');var _0x4c318a=_0xd25bf8[_0x3445('0x2e')];var _0x5d2247=_0x3e53e8?0x0:_0x190723[_0x3445('0x2f')];var _0x35cf56=_0x3e53e8?_0xd25bf8['count']:_0x190723[_0x3445('0x2f')]+_0x190723[_0x3445('0x2c')];var _0x27649f;if(_0x35cf56>=_0x4c318a){_0x35cf56=_0x4c318a;_0x27649f=0xc8;}else{_0x27649f=0xce;}_0x2596fe['status'](_0x27649f);return _0x2596fe[_0x3445('0x30')](_0x3445('0x31'),_0x5d2247+'-'+_0x35cf56+'/'+_0x4c318a)[_0x3445('0x2b')](_0xd25bf8);}return null;};}function patchUpdates(_0x4feb54){return function(_0x15c1ff){try{jsonpatch[_0x3445('0x32')](_0x15c1ff,_0x4feb54,!![]);}catch(_0x3dbd39){return BPromise[_0x3445('0x33')](_0x3dbd39);}return _0x15c1ff['save']();};}function saveUpdates(_0x514a95,_0x2facd1){return function(_0x5baa7f){if(_0x5baa7f){return _0x5baa7f[_0x3445('0x34')](_0x514a95)['then'](function(_0x1c184f){return _0x1c184f;});}return null;};}function removeEntity(_0x3faa57,_0x358063){return function(_0x270b72){if(_0x270b72){return _0x270b72[_0x3445('0x35')]()[_0x3445('0x20')](function(){_0x3faa57[_0x3445('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55eecc,_0x2d1336){return function(_0x55015b){if(!_0x55015b){_0x55eecc[_0x3445('0x36')](0x194);}return _0x55015b;};}function handleError(_0x4a0452,_0xb1551a){_0xb1551a=_0xb1551a||0x1f4;return function(_0xce9ad9){logger[_0x3445('0x25')](_0xce9ad9['stack']);if(_0xce9ad9[_0x3445('0x37')]){delete _0xce9ad9['name'];}_0x4a0452['status'](_0xb1551a)[_0x3445('0x38')](_0xce9ad9);};}exports[_0x3445('0x39')]=function(_0x25fc07,_0x20ccf6){var _0xe625f2={},_0x3f4655={},_0x469f76={'count':0x0,'rows':[]};var _0x153287=_[_0x3445('0x3a')](db[_0x3445('0x3b')][_0x3445('0x3c')],function(_0x2ec660){return{'name':_0x2ec660[_0x3445('0x3d')],'type':_0x2ec660[_0x3445('0x3e')][_0x3445('0x3f')]};});_0x3f4655[_0x3445('0x40')]=_[_0x3445('0x3a')](_0x153287,_0x3445('0x37'));_0x3f4655[_0x3445('0x41')]=_[_0x3445('0x42')](_0x25fc07[_0x3445('0x41')]);_0x3f4655[_0x3445('0x43')]=_[_0x3445('0x44')](_0x3f4655[_0x3445('0x40')],_0x3f4655[_0x3445('0x41')]);_0xe625f2[_0x3445('0x45')]=_['intersection'](_0x3f4655[_0x3445('0x40')],qs['fields'](_0x25fc07['query'][_0x3445('0x46')]));_0xe625f2[_0x3445('0x45')]=_0xe625f2[_0x3445('0x45')][_0x3445('0x47')]?_0xe625f2['attributes']:_0x3f4655[_0x3445('0x40')];if(!_0x25fc07[_0x3445('0x41')][_0x3445('0x48')](_0x3445('0x49'))){_0xe625f2[_0x3445('0x2c')]=qs[_0x3445('0x2c')](_0x25fc07[_0x3445('0x41')]['limit']);_0xe625f2[_0x3445('0x2f')]=qs[_0x3445('0x2f')](_0x25fc07[_0x3445('0x41')]['offset']);}_0xe625f2[_0x3445('0x4a')]=qs[_0x3445('0x4b')](_0x25fc07[_0x3445('0x41')][_0x3445('0x4b')]);_0xe625f2['where']=qs['filters'](_[_0x3445('0x4c')](_0x25fc07['query'],_0x3f4655[_0x3445('0x43')]),_0x153287);if(_0x25fc07['query'][_0x3445('0x4d')]){_0xe625f2[_0x3445('0x4e')]=_[_0x3445('0x4f')](_0xe625f2[_0x3445('0x4e')],{'$or':_[_0x3445('0x3a')](_0x153287,function(_0x5aa2a0){if(_0x5aa2a0['type']!==_0x3445('0x50')){var _0x2c2b7e={};_0x2c2b7e[_0x5aa2a0[_0x3445('0x37')]]={'$like':'%'+_0x25fc07[_0x3445('0x41')]['filter']+'%'};return _0x2c2b7e;}})});}_0xe625f2=_[_0x3445('0x4f')]({},_0xe625f2,_0x25fc07[_0x3445('0x51')]);var _0x4a77cb={'where':_0xe625f2[_0x3445('0x4e')]};return db[_0x3445('0x3b')][_0x3445('0x2e')](_0x4a77cb)[_0x3445('0x20')](function(_0x52bffc){_0x469f76['count']=_0x52bffc;if(_0x25fc07[_0x3445('0x41')][_0x3445('0x52')]){_0xe625f2[_0x3445('0x53')]=[{'all':!![]}];}return db[_0x3445('0x3b')]['findAll'](_0xe625f2);})[_0x3445('0x20')](function(_0x548a85){_0x469f76[_0x3445('0x54')]=_0x548a85;return _0x469f76;})['then'](respondWithFilteredResult(_0x20ccf6,_0xe625f2))[_0x3445('0x28')](handleError(_0x20ccf6,null));};exports[_0x3445('0x55')]=function(_0x48d2ee,_0x147427){var _0x13fd8d={'raw':![],'where':{'id':_0x48d2ee[_0x3445('0x56')]['id']}},_0x1334f6={};_0x1334f6['model']=_['keys'](db['FreshsalesAccount'][_0x3445('0x3c')]);_0x1334f6[_0x3445('0x41')]=_[_0x3445('0x42')](_0x48d2ee[_0x3445('0x41')]);_0x1334f6[_0x3445('0x43')]=_[_0x3445('0x44')](_0x1334f6[_0x3445('0x40')],_0x1334f6[_0x3445('0x41')]);_0x13fd8d[_0x3445('0x45')]=_[_0x3445('0x44')](_0x1334f6[_0x3445('0x40')],qs[_0x3445('0x46')](_0x48d2ee[_0x3445('0x41')]['fields']));_0x13fd8d[_0x3445('0x45')]=_0x13fd8d[_0x3445('0x45')]['length']?_0x13fd8d[_0x3445('0x45')]:_0x1334f6[_0x3445('0x40')];if(_0x48d2ee[_0x3445('0x41')][_0x3445('0x52')]){_0x13fd8d['include']=[{'all':!![]}];}_0x13fd8d=_[_0x3445('0x4f')]({},_0x13fd8d,_0x48d2ee[_0x3445('0x51')]);return db['FreshsalesAccount'][_0x3445('0x57')](_0x13fd8d)[_0x3445('0x20')](handleEntityNotFound(_0x147427,null))[_0x3445('0x20')](respondWithResult(_0x147427,null))[_0x3445('0x28')](handleError(_0x147427,null));};exports['create']=function(_0x4c4ea9,_0x818333){return db['FreshsalesAccount'][_0x3445('0x58')](_0x4c4ea9[_0x3445('0x59')],{})[_0x3445('0x20')](respondWithResult(_0x818333,0xc9))['catch'](handleError(_0x818333,null));};exports[_0x3445('0x34')]=function(_0x202e3c,_0x22db89){if(_0x202e3c[_0x3445('0x59')]['id']){delete _0x202e3c[_0x3445('0x59')]['id'];}return db[_0x3445('0x3b')]['find']({'where':{'id':_0x202e3c[_0x3445('0x56')]['id']}})[_0x3445('0x20')](handleEntityNotFound(_0x22db89,null))[_0x3445('0x20')](saveUpdates(_0x202e3c[_0x3445('0x59')],null))[_0x3445('0x20')](respondWithResult(_0x22db89,null))[_0x3445('0x28')](handleError(_0x22db89,null));};exports[_0x3445('0x35')]=function(_0x3dd3cc,_0x1cb2fb){return db[_0x3445('0x3b')][_0x3445('0x57')]({'where':{'id':_0x3dd3cc[_0x3445('0x56')]['id']}})[_0x3445('0x20')](handleEntityNotFound(_0x1cb2fb,null))[_0x3445('0x20')](removeEntity(_0x1cb2fb,null))[_0x3445('0x28')](handleError(_0x1cb2fb,null));};exports['getConfigurations']=function(_0x3f48df,_0x472e4f,_0x75f500){var _0x5c517f={};var _0x51d8bf={};var _0x471778;var _0x317605;return db[_0x3445('0x3b')]['findOne']({'where':{'id':_0x3f48df['params']['id']}})[_0x3445('0x20')](handleEntityNotFound(_0x472e4f,null))['then'](function(_0x47e3e4){if(_0x47e3e4){_0x471778=_0x47e3e4;_0x51d8bf[_0x3445('0x40')]=_['keys'](db[_0x3445('0x5a')][_0x3445('0x3c')]);_0x51d8bf[_0x3445('0x41')]=_[_0x3445('0x42')](_0x3f48df['query']);_0x51d8bf[_0x3445('0x43')]=_[_0x3445('0x44')](_0x51d8bf[_0x3445('0x40')],_0x51d8bf[_0x3445('0x41')]);_0x5c517f[_0x3445('0x45')]=_[_0x3445('0x44')](_0x51d8bf[_0x3445('0x40')],qs[_0x3445('0x46')](_0x3f48df[_0x3445('0x41')]['fields']));_0x5c517f[_0x3445('0x45')]=_0x5c517f['attributes'][_0x3445('0x47')]?_0x5c517f['attributes']:_0x51d8bf[_0x3445('0x40')];_0x5c517f[_0x3445('0x4a')]=qs['sort'](_0x3f48df[_0x3445('0x41')][_0x3445('0x4b')]);_0x5c517f[_0x3445('0x4e')]=qs[_0x3445('0x43')](_['pick'](_0x3f48df[_0x3445('0x41')],_0x51d8bf['filters']));if(_0x3f48df[_0x3445('0x41')]['filter']){_0x5c517f[_0x3445('0x4e')]=_[_0x3445('0x4f')](_0x5c517f['where'],{'$or':_[_0x3445('0x3a')](_0x5c517f[_0x3445('0x45')],function(_0x29fea1){var _0x56a0f9={};_0x56a0f9[_0x29fea1]={'$like':'%'+_0x3f48df[_0x3445('0x41')][_0x3445('0x4d')]+'%'};return _0x56a0f9;})});}_0x5c517f=_['merge']({},_0x5c517f,_0x3f48df['options']);return _0x471778['getConfigurations'](_0x5c517f);}})[_0x3445('0x20')](function(_0x575bd6){if(_0x575bd6){_0x317605=_0x575bd6['length'];if(!_0x3f48df['query'][_0x3445('0x48')](_0x3445('0x49'))){_0x5c517f[_0x3445('0x2c')]=qs[_0x3445('0x2c')](_0x3f48df['query'][_0x3445('0x2c')]);_0x5c517f[_0x3445('0x2f')]=qs['offset'](_0x3f48df[_0x3445('0x41')][_0x3445('0x2f')]);}return _0x471778['getConfigurations'](_0x5c517f);}})[_0x3445('0x20')](function(_0x498b52){if(_0x498b52){return _0x498b52?{'count':_0x317605,'rows':_0x498b52}:null;}})['then'](respondWithResult(_0x472e4f,null))['catch'](handleError(_0x472e4f,null));};exports[_0x3445('0x5b')]=function(_0x32a370,_0x51f4ba,_0x59d4fe){if(_0x32a370[_0x3445('0x59')]['id']){delete _0x32a370['body']['id'];}return db['FreshsalesAccount'][_0x3445('0x5c')]({'where':{'id':_0x32a370[_0x3445('0x56')]['id']}})[_0x3445('0x20')](handleEntityNotFound(_0x51f4ba,null))[_0x3445('0x20')](function(_0x76cc55){if(_0x76cc55){_0x32a370[_0x3445('0x59')][_0x3445('0x5d')]=_0x76cc55['id'];_0x32a370['body'][_0x3445('0x5e')]=integrations[_0x3445('0x5f')](_0x32a370[_0x3445('0x59')][_0x3445('0x60')],_0x32a370[_0x3445('0x59')]['type']);_0x32a370['body'][_0x3445('0x61')]=integrations['getDescriptions'](_0x32a370[_0x3445('0x59')][_0x3445('0x60')],_0x32a370['body']['type']);return db['FreshsalesConfiguration'][_0x3445('0x58')](_0x32a370[_0x3445('0x59')],{'include':[{'model':db[_0x3445('0x62')],'as':_0x3445('0x5e')},{'model':db[_0x3445('0x62')],'as':'Descriptions'}]});}return null;})[_0x3445('0x20')](respondWithResult(_0x51f4ba,null))['catch'](handleError(_0x51f4ba,null));};exports[_0x3445('0x63')]=function(_0x52e7b0,_0x594b96,_0x5a81d9){var _0x10b9e7='';var _0x6e5517='';return db[_0x3445('0x3b')][_0x3445('0x5c')]({'where':{'id':_0x52e7b0[_0x3445('0x56')]['id']},'attributes':['id','username',_0x3445('0x64'),_0x3445('0x65')]})[_0x3445('0x20')](handleEntityNotFound(_0x594b96,null))[_0x3445('0x20')](function(_0x3e3fd0){if(_0x3e3fd0){_0x6e5517=_0x3e3fd0[_0x3445('0x66')];_0x10b9e7=_0x3e3fd0['remoteUri'];var _0x3f43b5=_0x3e3fd0['remoteUri'][_0x3445('0x67')](-0x1);if(_0x3f43b5==='/'){_0x10b9e7=_0x10b9e7[_0x3445('0x68')](0x0,_0x10b9e7[_0x3445('0x69')](_0x3f43b5));}return rp({'method':'GET','uri':util['format'](_0x3445('0x6a'),_0x10b9e7,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x3e3fd0[_0x3445('0x65')]},'json':!![]});}})[_0x3445('0x20')](function(_0x4b1a95){if(_0x4b1a95){var _0x5b153e=_0x4b1a95[_0x3445('0x6b')];var _0x4c9f5d=![];var _0x370f27=null;for(_0x370f27=0x0;_0x370f27<_0x5b153e['length'];_0x370f27++){if(_0x5b153e[_0x370f27][_0x3445('0x6c')]===_0x6e5517){_0x4c9f5d=!![];}}if(_0x4c9f5d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3445('0x6d')});}}})[_0x3445('0x20')](respondWithResult(_0x594b96,null))[_0x3445('0x28')](function(_0x3e562e){var _0x64f48a=_0x52e7b0[_0x3445('0x41')][_0x3445('0x6e')]?0x1f4:_0x3e562e[_0x3445('0x6f')]||0x1f4;logger['error'](_0x3445('0x70'),_0x3445('0x63'),_0x64f48a,JSON[_0x3445('0x71')](_0x3e562e));delete _0x3e562e['name'];if(_0x64f48a===0x191){_0x64f48a=0x190;}_0x594b96[_0x3445('0x29')](_0x64f48a)[_0x3445('0x38')](_0x52e7b0[_0x3445('0x41')][_0x3445('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x3e562e[_0x3445('0x6f')]}:_0x3e562e);});}; \ No newline at end of file +var _0x744c=['fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','show','params','length','options','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','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','../../components/integrations/configuration','client','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection'];(function(_0x18bd51,_0x292ba4){var _0x43f465=function(_0x212ad1){while(--_0x212ad1){_0x18bd51['push'](_0x18bd51['shift']());}};_0x43f465(++_0x292ba4);}(_0x744c,0xa0));var _0xc744=function(_0x3459ed,_0x1bee20){_0x3459ed=_0x3459ed-0x0;var _0x4519a3=_0x744c[_0x3459ed];return _0x4519a3;};'use strict';var emlformat=require(_0xc744('0x0'));var rimraf=require(_0xc744('0x1'));var zipdir=require(_0xc744('0x2'));var jsonpatch=require(_0xc744('0x3'));var rp=require('request-promise');var moment=require(_0xc744('0x4'));var BPromise=require(_0xc744('0x5'));var Mustache=require(_0xc744('0x6'));var util=require(_0xc744('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc744('0x8'));var ejs=require(_0xc744('0x9'));var fs=require('fs');var fs_extra=require(_0xc744('0xa'));var _=require(_0xc744('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc744('0xc'));var deskjs=require(_0xc744('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc744('0xe'));var Papa=require(_0xc744('0xf'));var Redis=require(_0xc744('0x10'));var authService=require(_0xc744('0x11'));var qs=require(_0xc744('0x12'));var as=require(_0xc744('0x13'));var hardwareService=require(_0xc744('0x14'));var logger=require('../../config/logger')(_0xc744('0x15'));var utils=require(_0xc744('0x16'));var config=require(_0xc744('0x17'));var licenseUtil=require(_0xc744('0x18'));var db=require(_0xc744('0x19'))['db'];var integrations=require(_0xc744('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0xc744('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8d5a96,_0x3c84f4,_0x11bc7b,_0x53ed35){return new BPromise(function(_0x5d75bf,_0x589fa4){var _0x5883e9=_0x53ed35||client;return _0x5883e9[_0xc744('0x1c')](_0x8d5a96,_0x11bc7b)[_0xc744('0x1d')](function(_0x5ad488){logger['info'](_0xc744('0x1e'),_0x3c84f4,_0xc744('0x1f'));logger[_0xc744('0x20')](_0xc744('0x21'),_0x3c84f4,'request\x20sent',JSON[_0xc744('0x22')](_0x5ad488));if(_0x5ad488[_0xc744('0x23')]){if(_0x5ad488[_0xc744('0x23')][_0xc744('0x24')]===0x1f4){logger['error'](_0xc744('0x1e'),_0x3c84f4,_0x5ad488[_0xc744('0x23')][_0xc744('0x25')]);return _0x589fa4(_0x5ad488[_0xc744('0x23')][_0xc744('0x25')]);}logger[_0xc744('0x23')](_0xc744('0x1e'),_0x3c84f4,_0x5ad488[_0xc744('0x23')][_0xc744('0x25')]);return _0x5d75bf(_0x5ad488[_0xc744('0x23')][_0xc744('0x25')]);}else{logger[_0xc744('0x26')]('FreshsalesAccount,\x20%s,\x20%s',_0x3c84f4,_0xc744('0x1f'));_0x5d75bf(_0x5ad488[_0xc744('0x27')][_0xc744('0x25')]);}})[_0xc744('0x28')](function(_0x3753dd){logger[_0xc744('0x23')]('FreshsalesAccount,\x20%s,\x20%s',_0x3c84f4,_0x3753dd);_0x589fa4(_0x3753dd);});});}function respondWithStatusCode(_0x2fae17,_0xc52e54){_0xc52e54=_0xc52e54||0xcc;return function(_0x3ce09e){if(_0x3ce09e){return _0x2fae17[_0xc744('0x29')](_0xc52e54);}return _0x2fae17['status'](_0xc52e54)['end']();};}function respondWithResult(_0x2f5d88,_0x4edfd1){_0x4edfd1=_0x4edfd1||0xc8;return function(_0x18a0b2){if(_0x18a0b2){return _0x2f5d88[_0xc744('0x2a')](_0x4edfd1)[_0xc744('0x2b')](_0x18a0b2);}};}function respondWithFilteredResult(_0x354895,_0xf07a89){return function(_0x2cb8a7){if(_0x2cb8a7){var _0x51a797=typeof _0xf07a89[_0xc744('0x2c')]===_0xc744('0x2d')&&typeof _0xf07a89[_0xc744('0x2e')]==='undefined';var _0x221a20=_0x2cb8a7[_0xc744('0x2f')];var _0x316a6f=_0x51a797?0x0:_0xf07a89[_0xc744('0x2c')];var _0x33c2bf=_0x51a797?_0x2cb8a7[_0xc744('0x2f')]:_0xf07a89['offset']+_0xf07a89[_0xc744('0x2e')];var _0x109ada;if(_0x33c2bf>=_0x221a20){_0x33c2bf=_0x221a20;_0x109ada=0xc8;}else{_0x109ada=0xce;}_0x354895[_0xc744('0x2a')](_0x109ada);return _0x354895[_0xc744('0x30')](_0xc744('0x31'),_0x316a6f+'-'+_0x33c2bf+'/'+_0x221a20)[_0xc744('0x2b')](_0x2cb8a7);}return null;};}function patchUpdates(_0x3dfea6){return function(_0x188764){try{jsonpatch[_0xc744('0x32')](_0x188764,_0x3dfea6,!![]);}catch(_0x808a7b){return BPromise[_0xc744('0x33')](_0x808a7b);}return _0x188764[_0xc744('0x34')]();};}function saveUpdates(_0x2538e3,_0x3df350){return function(_0x2c1821){if(_0x2c1821){return _0x2c1821[_0xc744('0x35')](_0x2538e3)['then'](function(_0x2a14be){return _0x2a14be;});}return null;};}function removeEntity(_0x5532c7,_0x14d3d7){return function(_0x507a06){if(_0x507a06){return _0x507a06[_0xc744('0x36')]()[_0xc744('0x1d')](function(){_0x5532c7[_0xc744('0x2a')](0xcc)[_0xc744('0x37')]();});}};}function handleEntityNotFound(_0x3cd4e1,_0x1c4d9e){return function(_0x30fcfe){if(!_0x30fcfe){_0x3cd4e1[_0xc744('0x29')](0x194);}return _0x30fcfe;};}function handleError(_0x521303,_0x2c4c48){_0x2c4c48=_0x2c4c48||0x1f4;return function(_0x44ea38){logger[_0xc744('0x23')](_0x44ea38[_0xc744('0x38')]);if(_0x44ea38[_0xc744('0x39')]){delete _0x44ea38[_0xc744('0x39')];}_0x521303[_0xc744('0x2a')](_0x2c4c48)[_0xc744('0x3a')](_0x44ea38);};}exports['index']=function(_0x1ed722,_0x17f550){var _0x5b1208={},_0x3c44eb={},_0xd02c4b={'count':0x0,'rows':[]};var _0xb09ec3=_[_0xc744('0x3b')](db[_0xc744('0x3c')][_0xc744('0x3d')],function(_0x54c4b0){return{'name':_0x54c4b0[_0xc744('0x3e')],'type':_0x54c4b0['type'][_0xc744('0x3f')]};});_0x3c44eb[_0xc744('0x40')]=_[_0xc744('0x3b')](_0xb09ec3,'name');_0x3c44eb[_0xc744('0x41')]=_[_0xc744('0x42')](_0x1ed722[_0xc744('0x41')]);_0x3c44eb[_0xc744('0x43')]=_['intersection'](_0x3c44eb['model'],_0x3c44eb['query']);_0x5b1208[_0xc744('0x44')]=_[_0xc744('0x45')](_0x3c44eb['model'],qs[_0xc744('0x46')](_0x1ed722['query'][_0xc744('0x46')]));_0x5b1208[_0xc744('0x44')]=_0x5b1208[_0xc744('0x44')]['length']?_0x5b1208[_0xc744('0x44')]:_0x3c44eb[_0xc744('0x40')];if(!_0x1ed722[_0xc744('0x41')][_0xc744('0x47')](_0xc744('0x48'))){_0x5b1208[_0xc744('0x2e')]=qs[_0xc744('0x2e')](_0x1ed722['query'][_0xc744('0x2e')]);_0x5b1208['offset']=qs['offset'](_0x1ed722[_0xc744('0x41')][_0xc744('0x2c')]);}_0x5b1208[_0xc744('0x49')]=qs['sort'](_0x1ed722['query'][_0xc744('0x4a')]);_0x5b1208[_0xc744('0x4b')]=qs[_0xc744('0x43')](_[_0xc744('0x4c')](_0x1ed722[_0xc744('0x41')],_0x3c44eb['filters']),_0xb09ec3);if(_0x1ed722[_0xc744('0x41')]['filter']){_0x5b1208['where']=_[_0xc744('0x4d')](_0x5b1208[_0xc744('0x4b')],{'$or':_[_0xc744('0x3b')](_0xb09ec3,function(_0x1366db){if(_0x1366db['type']!==_0xc744('0x4e')){var _0x3d7d1a={};_0x3d7d1a[_0x1366db[_0xc744('0x39')]]={'$like':'%'+_0x1ed722[_0xc744('0x41')][_0xc744('0x4f')]+'%'};return _0x3d7d1a;}})});}_0x5b1208=_[_0xc744('0x4d')]({},_0x5b1208,_0x1ed722['options']);var _0xc05500={'where':_0x5b1208[_0xc744('0x4b')]};return db[_0xc744('0x3c')]['count'](_0xc05500)[_0xc744('0x1d')](function(_0x372c7f){_0xd02c4b[_0xc744('0x2f')]=_0x372c7f;if(_0x1ed722[_0xc744('0x41')][_0xc744('0x50')]){_0x5b1208['include']=[{'all':!![]}];}return db[_0xc744('0x3c')][_0xc744('0x51')](_0x5b1208);})[_0xc744('0x1d')](function(_0x504994){_0xd02c4b['rows']=_0x504994;return _0xd02c4b;})[_0xc744('0x1d')](respondWithFilteredResult(_0x17f550,_0x5b1208))[_0xc744('0x28')](handleError(_0x17f550,null));};exports[_0xc744('0x52')]=function(_0x17ac94,_0x2744d5){var _0x45c9b8={'raw':![],'where':{'id':_0x17ac94[_0xc744('0x53')]['id']}},_0x32f850={};_0x32f850['model']=_[_0xc744('0x42')](db[_0xc744('0x3c')][_0xc744('0x3d')]);_0x32f850[_0xc744('0x41')]=_[_0xc744('0x42')](_0x17ac94['query']);_0x32f850['filters']=_[_0xc744('0x45')](_0x32f850[_0xc744('0x40')],_0x32f850[_0xc744('0x41')]);_0x45c9b8[_0xc744('0x44')]=_['intersection'](_0x32f850[_0xc744('0x40')],qs['fields'](_0x17ac94[_0xc744('0x41')]['fields']));_0x45c9b8[_0xc744('0x44')]=_0x45c9b8['attributes'][_0xc744('0x54')]?_0x45c9b8['attributes']:_0x32f850[_0xc744('0x40')];if(_0x17ac94[_0xc744('0x41')][_0xc744('0x50')]){_0x45c9b8['include']=[{'all':!![]}];}_0x45c9b8=_['merge']({},_0x45c9b8,_0x17ac94[_0xc744('0x55')]);return db[_0xc744('0x3c')][_0xc744('0x56')](_0x45c9b8)[_0xc744('0x1d')](handleEntityNotFound(_0x2744d5,null))['then'](respondWithResult(_0x2744d5,null))[_0xc744('0x28')](handleError(_0x2744d5,null));};exports[_0xc744('0x57')]=function(_0x8526d5,_0x250d7b){return db[_0xc744('0x3c')]['create'](_0x8526d5[_0xc744('0x58')],{})[_0xc744('0x1d')](respondWithResult(_0x250d7b,0xc9))[_0xc744('0x28')](handleError(_0x250d7b,null));};exports[_0xc744('0x35')]=function(_0x3d7de1,_0x688c9){if(_0x3d7de1[_0xc744('0x58')]['id']){delete _0x3d7de1[_0xc744('0x58')]['id'];}return db[_0xc744('0x3c')]['find']({'where':{'id':_0x3d7de1[_0xc744('0x53')]['id']}})[_0xc744('0x1d')](handleEntityNotFound(_0x688c9,null))['then'](saveUpdates(_0x3d7de1[_0xc744('0x58')],null))[_0xc744('0x1d')](respondWithResult(_0x688c9,null))[_0xc744('0x28')](handleError(_0x688c9,null));};exports['destroy']=function(_0xc03aaf,_0x39230e){return db['FreshsalesAccount'][_0xc744('0x56')]({'where':{'id':_0xc03aaf[_0xc744('0x53')]['id']}})[_0xc744('0x1d')](handleEntityNotFound(_0x39230e,null))['then'](removeEntity(_0x39230e,null))[_0xc744('0x28')](handleError(_0x39230e,null));};exports[_0xc744('0x59')]=function(_0x256bd5,_0xf46c3d,_0x545f07){var _0x4c75a7={};var _0x2d3574={};var _0x3534dd;var _0x486234;return db['FreshsalesAccount'][_0xc744('0x5a')]({'where':{'id':_0x256bd5[_0xc744('0x53')]['id']}})['then'](handleEntityNotFound(_0xf46c3d,null))[_0xc744('0x1d')](function(_0x60d115){if(_0x60d115){_0x3534dd=_0x60d115;_0x2d3574['model']=_[_0xc744('0x42')](db[_0xc744('0x5b')]['rawAttributes']);_0x2d3574[_0xc744('0x41')]=_['keys'](_0x256bd5[_0xc744('0x41')]);_0x2d3574[_0xc744('0x43')]=_[_0xc744('0x45')](_0x2d3574[_0xc744('0x40')],_0x2d3574[_0xc744('0x41')]);_0x4c75a7[_0xc744('0x44')]=_[_0xc744('0x45')](_0x2d3574[_0xc744('0x40')],qs['fields'](_0x256bd5['query']['fields']));_0x4c75a7['attributes']=_0x4c75a7[_0xc744('0x44')][_0xc744('0x54')]?_0x4c75a7[_0xc744('0x44')]:_0x2d3574[_0xc744('0x40')];_0x4c75a7[_0xc744('0x49')]=qs[_0xc744('0x4a')](_0x256bd5[_0xc744('0x41')][_0xc744('0x4a')]);_0x4c75a7[_0xc744('0x4b')]=qs[_0xc744('0x43')](_['pick'](_0x256bd5[_0xc744('0x41')],_0x2d3574[_0xc744('0x43')]));if(_0x256bd5['query'][_0xc744('0x4f')]){_0x4c75a7[_0xc744('0x4b')]=_[_0xc744('0x4d')](_0x4c75a7[_0xc744('0x4b')],{'$or':_['map'](_0x4c75a7[_0xc744('0x44')],function(_0x35993b){var _0x30e77e={};_0x30e77e[_0x35993b]={'$like':'%'+_0x256bd5['query'][_0xc744('0x4f')]+'%'};return _0x30e77e;})});}_0x4c75a7=_['merge']({},_0x4c75a7,_0x256bd5[_0xc744('0x55')]);return _0x3534dd['getConfigurations'](_0x4c75a7);}})[_0xc744('0x1d')](function(_0x3e4d1e){if(_0x3e4d1e){_0x486234=_0x3e4d1e[_0xc744('0x54')];if(!_0x256bd5[_0xc744('0x41')][_0xc744('0x47')]('nolimit')){_0x4c75a7['limit']=qs[_0xc744('0x2e')](_0x256bd5['query'][_0xc744('0x2e')]);_0x4c75a7[_0xc744('0x2c')]=qs[_0xc744('0x2c')](_0x256bd5[_0xc744('0x41')]['offset']);}return _0x3534dd[_0xc744('0x59')](_0x4c75a7);}})[_0xc744('0x1d')](function(_0xa67ff1){if(_0xa67ff1){return _0xa67ff1?{'count':_0x486234,'rows':_0xa67ff1}:null;}})['then'](respondWithResult(_0xf46c3d,null))['catch'](handleError(_0xf46c3d,null));};exports[_0xc744('0x5c')]=function(_0xc5c781,_0x44e4ba,_0x5d9b44){if(_0xc5c781['body']['id']){delete _0xc5c781['body']['id'];}return db[_0xc744('0x3c')][_0xc744('0x5a')]({'where':{'id':_0xc5c781[_0xc744('0x53')]['id']}})[_0xc744('0x1d')](handleEntityNotFound(_0x44e4ba,null))[_0xc744('0x1d')](function(_0x428a03){if(_0x428a03){_0xc5c781[_0xc744('0x58')][_0xc744('0x5d')]=_0x428a03['id'];_0xc5c781[_0xc744('0x58')][_0xc744('0x5e')]=integrations[_0xc744('0x5f')](_0xc5c781['body']['channel'],_0xc5c781[_0xc744('0x58')][_0xc744('0x60')]);_0xc5c781[_0xc744('0x58')][_0xc744('0x61')]=integrations[_0xc744('0x62')](_0xc5c781[_0xc744('0x58')]['channel'],_0xc5c781[_0xc744('0x58')][_0xc744('0x60')]);return db['FreshsalesConfiguration']['create'](_0xc5c781[_0xc744('0x58')],{'include':[{'model':db['FreshsalesField'],'as':_0xc744('0x5e')},{'model':db[_0xc744('0x63')],'as':_0xc744('0x61')}]});}return null;})['then'](respondWithResult(_0x44e4ba,null))[_0xc744('0x28')](handleError(_0x44e4ba,null));};exports[_0xc744('0x64')]=function(_0x37ff79,_0x2bcaef,_0x116400){var _0x34ad46='';var _0x3314fa='';return db['FreshsalesAccount'][_0xc744('0x5a')]({'where':{'id':_0x37ff79[_0xc744('0x53')]['id']},'attributes':['id',_0xc744('0x65'),_0xc744('0x66'),_0xc744('0x67')]})['then'](handleEntityNotFound(_0x2bcaef,null))[_0xc744('0x1d')](function(_0x4d8da3){if(_0x4d8da3){_0x3314fa=_0x4d8da3[_0xc744('0x65')];_0x34ad46=_0x4d8da3['remoteUri'];var _0x3d05ad=_0x4d8da3[_0xc744('0x66')]['slice'](-0x1);if(_0x3d05ad==='/'){_0x34ad46=_0x34ad46['substring'](0x0,_0x34ad46[_0xc744('0x68')](_0x3d05ad));}return rp({'method':_0xc744('0x69'),'uri':util['format'](_0xc744('0x6a'),_0x34ad46,_0xc744('0x6b')),'headers':{'Authorization':_0xc744('0x6c')+_0x4d8da3['apiKey']},'json':!![]});}})[_0xc744('0x1d')](function(_0x1bf230){if(_0x1bf230){var _0x11f113=_0x1bf230[_0xc744('0x6d')];var _0x55f1ff=![];var _0x13a252=null;for(_0x13a252=0x0;_0x13a252<_0x11f113[_0xc744('0x54')];_0x13a252++){if(_0x11f113[_0x13a252]['email']===_0x3314fa){_0x55f1ff=!![];}}if(_0x55f1ff){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xc744('0x6e')});}}})[_0xc744('0x1d')](respondWithResult(_0x2bcaef,null))[_0xc744('0x28')](function(_0x1502f7){var _0x4d067f=_0x37ff79['query'][_0xc744('0x6f')]?0x1f4:_0x1502f7[_0xc744('0x70')]||0x1f4;logger['error'](_0xc744('0x71'),_0xc744('0x64'),_0x4d067f,JSON[_0xc744('0x22')](_0x1502f7));delete _0x1502f7['name'];if(_0x4d067f===0x191){_0x4d067f=0x190;}_0x2bcaef['status'](_0x4d067f)[_0xc744('0x3a')](_0x37ff79['query'][_0xc744('0x6f')]?{'message':_0xc744('0x72'),'statusCode':_0x1502f7[_0xc744('0x70')]}:_0x1502f7);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 653aa3f..fe4a1f1 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 _0xb13e=['FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x573e63,_0x40e843){var _0x4eeca6=function(_0x46a447){while(--_0x46a447){_0x573e63['push'](_0x573e63['shift']());}};_0x4eeca6(++_0x40e843);}(_0xb13e,0x1f0));var _0xeb13=function(_0x7596be,_0x4f6cee){_0x7596be=_0x7596be-0x0;var _0x3704aa=_0xb13e[_0x7596be];return _0x3704aa;};'use strict';var _=require(_0xeb13('0x0'));var util=require(_0xeb13('0x1'));var logger=require(_0xeb13('0x2'))(_0xeb13('0x3'));var moment=require(_0xeb13('0x4'));var BPromise=require(_0xeb13('0x5'));var rp=require(_0xeb13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb13('0x7'));var config=require(_0xeb13('0x8'));var attributes=require(_0xeb13('0x9'));var integrations=require(_0xeb13('0xa'));module['exports']=function(_0x90474f,_0x11f729){return _0x90474f['define'](_0xeb13('0xb'),attributes,{'tableName':_0xeb13('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intFreshsalesAccount.attributes'];(function(_0x96989f,_0x596b2b){var _0x55a35c=function(_0x3b21eb){while(--_0x3b21eb){_0x96989f['push'](_0x96989f['shift']());}};_0x55a35c(++_0x596b2b);}(_0x2ef3,0xba));var _0x32ef=function(_0x32eaf2,_0x3c0330){_0x32eaf2=_0x32eaf2-0x0;var _0x578a5f=_0x2ef3[_0x32eaf2];return _0x578a5f;};'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'));var integrations=require(_0x32ef('0x9'));module['exports']=function(_0x5dfa09,_0x2c0089){return _0x5dfa09[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 56a1526..a05f7e3 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 _0x1f92=['request\x20sent','debug','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','ShowFreshsalesAccount','find','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x535028,_0x1ec74f){var _0x5483b4=function(_0x2ffaa5){while(--_0x2ffaa5){_0x535028['push'](_0x535028['shift']());}};_0x5483b4(++_0x1ec74f);}(_0x1f92,0x1ad));var _0x21f9=function(_0x23c5c3,_0x2eb334){_0x23c5c3=_0x23c5c3-0x0;var _0x59ee08=_0x1f92[_0x23c5c3];return _0x59ee08;};'use strict';var _=require(_0x21f9('0x0'));var util=require('util');var moment=require(_0x21f9('0x1'));var BPromise=require(_0x21f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21f9('0x3'))['db'];var utils=require(_0x21f9('0x4'));var logger=require(_0x21f9('0x5'))(_0x21f9('0x6'));var config=require(_0x21f9('0x7'));var jayson=require(_0x21f9('0x8'));var client=jayson[_0x21f9('0x9')][_0x21f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44afd8,_0x2590dd,_0x2bba30){return new BPromise(function(_0x261881,_0x4abee7){return client[_0x21f9('0xb')](_0x44afd8,_0x2bba30)[_0x21f9('0xc')](function(_0x345f68){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x2590dd,_0x21f9('0xd'));logger[_0x21f9('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x2590dd,_0x21f9('0xd'),JSON[_0x21f9('0xf')](_0x345f68));if(_0x345f68[_0x21f9('0x10')]){if(_0x345f68[_0x21f9('0x10')][_0x21f9('0x11')]===0x1f4){logger[_0x21f9('0x10')](_0x21f9('0x12'),_0x2590dd,_0x345f68[_0x21f9('0x10')][_0x21f9('0x13')]);return _0x4abee7(_0x345f68['error']['message']);}logger[_0x21f9('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x2590dd,_0x345f68[_0x21f9('0x10')][_0x21f9('0x13')]);return _0x261881(_0x345f68[_0x21f9('0x10')][_0x21f9('0x13')]);}else{logger[_0x21f9('0x14')](_0x21f9('0x12'),_0x2590dd,_0x21f9('0xd'));_0x261881(_0x345f68['result'][_0x21f9('0x13')]);}})[_0x21f9('0x15')](function(_0x1c62ca){logger[_0x21f9('0x10')](_0x21f9('0x12'),_0x2590dd,_0x1c62ca);_0x4abee7(_0x1c62ca);});});}exports[_0x21f9('0x16')]=function(_0x219bf5){var _0x1bc133=this;return new Promise(function(_0x1ad569,_0x29ec30){return db[_0x21f9('0x17')][_0x21f9('0x18')]({'raw':_0x219bf5[_0x21f9('0x19')]?_0x219bf5[_0x21f9('0x19')][_0x21f9('0x1a')]===undefined?!![]:![]:!![],'where':_0x219bf5[_0x21f9('0x19')]?_0x219bf5[_0x21f9('0x19')][_0x21f9('0x1b')]||null:null,'attributes':_0x219bf5[_0x21f9('0x19')]?_0x219bf5['options'][_0x21f9('0x1c')]||null:null,'limit':_0x219bf5[_0x21f9('0x19')]?_0x219bf5[_0x21f9('0x19')]['limit']||null:null,'include':_0x219bf5['options']?_0x219bf5[_0x21f9('0x19')][_0x21f9('0x1d')]?_[_0x21f9('0x1e')](_0x219bf5['options'][_0x21f9('0x1d')],function(_0x264d0c){return{'model':db[_0x264d0c[_0x21f9('0x1f')]],'as':_0x264d0c['as'],'attributes':_0x264d0c['attributes'],'include':_0x264d0c[_0x21f9('0x1d')]?_[_0x21f9('0x1e')](_0x264d0c[_0x21f9('0x1d')],function(_0x57bd4d){return{'model':db[_0x57bd4d[_0x21f9('0x1f')]],'as':_0x57bd4d['as'],'attributes':_0x57bd4d[_0x21f9('0x1c')],'include':_0x57bd4d['include']?_[_0x21f9('0x1e')](_0x57bd4d[_0x21f9('0x1d')],function(_0x14731e){return{'model':db[_0x14731e[_0x21f9('0x1f')]],'as':_0x14731e['as'],'attributes':_0x14731e[_0x21f9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x21f9('0xc')](function(_0x6b6cd6){logger['info']('GetFreshsalesAccount',_0x219bf5);logger[_0x21f9('0xe')](_0x21f9('0x16'),_0x219bf5,JSON['stringify'](_0x6b6cd6));_0x1ad569(_0x6b6cd6);})[_0x21f9('0x15')](function(_0x4527e4){logger[_0x21f9('0x10')](_0x21f9('0x16'),_0x4527e4[_0x21f9('0x13')],_0x219bf5);_0x29ec30(_0x1bc133['error'](0x1f4,_0x4527e4[_0x21f9('0x13')]));});});};exports[_0x21f9('0x20')]=function(_0xe9ad3d){var _0x3eeaeb=this;return new Promise(function(_0x166bc1,_0x2f6122){return db[_0x21f9('0x17')][_0x21f9('0x21')]({'raw':_0xe9ad3d[_0x21f9('0x19')]?_0xe9ad3d[_0x21f9('0x19')][_0x21f9('0x1a')]===undefined?!![]:![]:!![],'where':_0xe9ad3d[_0x21f9('0x19')]?_0xe9ad3d['options'][_0x21f9('0x1b')]||null:null,'attributes':_0xe9ad3d[_0x21f9('0x19')]?_0xe9ad3d[_0x21f9('0x19')][_0x21f9('0x1c')]||null:null,'include':_0xe9ad3d[_0x21f9('0x19')]?_0xe9ad3d[_0x21f9('0x19')][_0x21f9('0x1d')]?_['map'](_0xe9ad3d[_0x21f9('0x19')]['include'],function(_0x45751b){return{'model':db[_0x45751b[_0x21f9('0x1f')]],'as':_0x45751b['as'],'attributes':_0x45751b['attributes'],'include':_0x45751b[_0x21f9('0x1d')]?_[_0x21f9('0x1e')](_0x45751b['include'],function(_0x1e1755){return{'model':db[_0x1e1755[_0x21f9('0x1f')]],'as':_0x1e1755['as'],'attributes':_0x1e1755[_0x21f9('0x1c')],'include':_0x1e1755[_0x21f9('0x1d')]?_[_0x21f9('0x1e')](_0x1e1755[_0x21f9('0x1d')],function(_0x52f892){return{'model':db[_0x52f892[_0x21f9('0x1f')]],'as':_0x52f892['as'],'attributes':_0x52f892['attributes']};}):[]};}):[]};}):[]:[]})[_0x21f9('0xc')](function(_0x53474b){logger[_0x21f9('0x14')]('ShowFreshsalesAccount',_0xe9ad3d);logger[_0x21f9('0xe')](_0x21f9('0x20'),_0xe9ad3d,JSON[_0x21f9('0xf')](_0x53474b));_0x166bc1(_0x53474b);})[_0x21f9('0x15')](function(_0x2f8690){logger[_0x21f9('0x10')](_0x21f9('0x20'),_0x2f8690[_0x21f9('0x13')],_0xe9ad3d);_0x2f6122(_0x3eeaeb[_0x21f9('0x10')](0x1f4,_0x2f8690[_0x21f9('0x13')]));});});}; \ No newline at end of file +var _0x1681=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','include','map','model','attributes','find','ShowFreshsalesAccount','catch'];(function(_0x4d9c7e,_0x19ebf2){var _0x1493b7=function(_0x58ef99){while(--_0x58ef99){_0x4d9c7e['push'](_0x4d9c7e['shift']());}};_0x1493b7(++_0x19ebf2);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1168('0x0'));var BPromise=require(_0x1168('0x1'));var rs=require(_0x1168('0x2'));var fs=require('fs');var Redis=require(_0x1168('0x3'));var db=require(_0x1168('0x4'))['db'];var utils=require(_0x1168('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1168('0x6'));var jayson=require(_0x1168('0x7'));var client=jayson['client'][_0x1168('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d0634,_0x5e6752,_0x27309b){return new BPromise(function(_0x53baca,_0x262f80){return client[_0x1168('0x9')](_0x1d0634,_0x27309b)['then'](function(_0x38096f){logger[_0x1168('0xa')]('FreshsalesAccount,\x20%s,\x20%s',_0x5e6752,_0x1168('0xb'));logger[_0x1168('0xc')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5e6752,'request\x20sent',JSON[_0x1168('0xd')](_0x38096f));if(_0x38096f[_0x1168('0xe')]){if(_0x38096f[_0x1168('0xe')][_0x1168('0xf')]===0x1f4){logger[_0x1168('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x5e6752,_0x38096f[_0x1168('0xe')][_0x1168('0x10')]);return _0x262f80(_0x38096f[_0x1168('0xe')][_0x1168('0x10')]);}logger[_0x1168('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x5e6752,_0x38096f[_0x1168('0xe')]['message']);return _0x53baca(_0x38096f[_0x1168('0xe')][_0x1168('0x10')]);}else{logger['info'](_0x1168('0x11'),_0x5e6752,_0x1168('0xb'));_0x53baca(_0x38096f['result'][_0x1168('0x10')]);}})['catch'](function(_0x45e07e){logger[_0x1168('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x5e6752,_0x45e07e);_0x262f80(_0x45e07e);});});}exports[_0x1168('0x12')]=function(_0x36130f){var _0x213c45=this;return new Promise(function(_0x5d8498,_0x5dec5c){return db[_0x1168('0x13')]['findAll']({'raw':_0x36130f[_0x1168('0x14')]?_0x36130f[_0x1168('0x14')][_0x1168('0x15')]===undefined?!![]:![]:!![],'where':_0x36130f[_0x1168('0x14')]?_0x36130f[_0x1168('0x14')][_0x1168('0x16')]||null:null,'attributes':_0x36130f['options']?_0x36130f[_0x1168('0x14')]['attributes']||null:null,'limit':_0x36130f[_0x1168('0x14')]?_0x36130f[_0x1168('0x14')]['limit']||null:null,'include':_0x36130f['options']?_0x36130f[_0x1168('0x14')][_0x1168('0x17')]?_[_0x1168('0x18')](_0x36130f[_0x1168('0x14')][_0x1168('0x17')],function(_0x305d39){return{'model':db[_0x305d39[_0x1168('0x19')]],'as':_0x305d39['as'],'attributes':_0x305d39[_0x1168('0x1a')],'include':_0x305d39[_0x1168('0x17')]?_[_0x1168('0x18')](_0x305d39[_0x1168('0x17')],function(_0x4177ec){return{'model':db[_0x4177ec[_0x1168('0x19')]],'as':_0x4177ec['as'],'attributes':_0x4177ec['attributes'],'include':_0x4177ec[_0x1168('0x17')]?_[_0x1168('0x18')](_0x4177ec['include'],function(_0x3cb49c){return{'model':db[_0x3cb49c[_0x1168('0x19')]],'as':_0x3cb49c['as'],'attributes':_0x3cb49c[_0x1168('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ec395){logger[_0x1168('0xa')](_0x1168('0x12'),_0x36130f);logger[_0x1168('0xc')]('GetFreshsalesAccount',_0x36130f,JSON[_0x1168('0xd')](_0x2ec395));_0x5d8498(_0x2ec395);})['catch'](function(_0xc7ba15){logger[_0x1168('0xe')](_0x1168('0x12'),_0xc7ba15[_0x1168('0x10')],_0x36130f);_0x5dec5c(_0x213c45['error'](0x1f4,_0xc7ba15[_0x1168('0x10')]));});});};exports['ShowFreshsalesAccount']=function(_0x4c1ba9){var _0x26ccc9=this;return new Promise(function(_0x3100c2,_0x2fdf71){return db['FreshsalesAccount'][_0x1168('0x1b')]({'raw':_0x4c1ba9[_0x1168('0x14')]?_0x4c1ba9['options'][_0x1168('0x15')]===undefined?!![]:![]:!![],'where':_0x4c1ba9[_0x1168('0x14')]?_0x4c1ba9[_0x1168('0x14')][_0x1168('0x16')]||null:null,'attributes':_0x4c1ba9[_0x1168('0x14')]?_0x4c1ba9[_0x1168('0x14')][_0x1168('0x1a')]||null:null,'include':_0x4c1ba9[_0x1168('0x14')]?_0x4c1ba9['options'][_0x1168('0x17')]?_['map'](_0x4c1ba9[_0x1168('0x14')]['include'],function(_0x318e00){return{'model':db[_0x318e00[_0x1168('0x19')]],'as':_0x318e00['as'],'attributes':_0x318e00[_0x1168('0x1a')],'include':_0x318e00['include']?_[_0x1168('0x18')](_0x318e00[_0x1168('0x17')],function(_0x13cc6e){return{'model':db[_0x13cc6e[_0x1168('0x19')]],'as':_0x13cc6e['as'],'attributes':_0x13cc6e[_0x1168('0x1a')],'include':_0x13cc6e['include']?_[_0x1168('0x18')](_0x13cc6e[_0x1168('0x17')],function(_0x1412ff){return{'model':db[_0x1412ff['model']],'as':_0x1412ff['as'],'attributes':_0x1412ff[_0x1168('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cdf9d){logger[_0x1168('0xa')](_0x1168('0x1c'),_0x4c1ba9);logger['debug'](_0x1168('0x1c'),_0x4c1ba9,JSON[_0x1168('0xd')](_0x5cdf9d));_0x3100c2(_0x5cdf9d);})[_0x1168('0x1d')](function(_0x23f06b){logger[_0x1168('0xe')](_0x1168('0x1c'),_0x23f06b[_0x1168('0x10')],_0x4c1ba9);_0x2fdf71(_0x26ccc9['error'](0x1f4,_0x23f06b[_0x1168('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 9f41d76..4809eff 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 _0x3b72=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','destroy','multer','util','path'];(function(_0x3e553f,_0x1e10ce){var _0x481e82=function(_0x145013){while(--_0x145013){_0x3e553f['push'](_0x3e553f['shift']());}};_0x481e82(++_0x1e10ce);}(_0x3b72,0x93));var _0x23b7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3b72[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x23b7('0x0'));var util=require(_0x23b7('0x1'));var path=require(_0x23b7('0x2'));var timeout=require(_0x23b7('0x3'));var express=require(_0x23b7('0x4'));var router=express[_0x23b7('0x5')]();var fs_extra=require(_0x23b7('0x6'));var auth=require(_0x23b7('0x7'));var interaction=require(_0x23b7('0x8'));var config=require(_0x23b7('0x9'));var controller=require(_0x23b7('0xa'));router[_0x23b7('0xb')]('/',auth[_0x23b7('0xc')](),controller[_0x23b7('0xd')]);router[_0x23b7('0xb')](_0x23b7('0xe'),auth['isAuthenticated'](),controller[_0x23b7('0xf')]);router[_0x23b7('0xb')](_0x23b7('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x23b7('0xb')](_0x23b7('0x11'),auth[_0x23b7('0xc')](),controller[_0x23b7('0x12')]);router[_0x23b7('0xb')](_0x23b7('0x13'),auth['isAuthenticated'](),controller[_0x23b7('0x14')]);router[_0x23b7('0x15')]('/',auth[_0x23b7('0xc')](),controller[_0x23b7('0x16')]);router[_0x23b7('0x17')](_0x23b7('0xe'),auth[_0x23b7('0xc')](),controller['update']);router['delete'](_0x23b7('0xe'),auth[_0x23b7('0xc')](),controller[_0x23b7('0x18')]);module['exports']=router; \ No newline at end of file +var _0x38fb=['/:id','show','get','/:id/subjects','getDescriptions','/:id/fields','getFields','post','create','update','destroy','multer','util','express','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','isAuthenticated'];(function(_0x57877c,_0x5db020){var _0x145f0b=function(_0x179327){while(--_0x179327){_0x57877c['push'](_0x57877c['shift']());}};_0x145f0b(++_0x5db020);}(_0x38fb,0xd1));var _0xb38f=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0x38fb[_0x296809];return _0x18c0d3;};'use strict';var multer=require(_0xb38f('0x0'));var util=require(_0xb38f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb38f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb38f('0x3'));var interaction=require(_0xb38f('0x4'));var config=require('../../config/environment');var controller=require(_0xb38f('0x5'));router['get']('/',auth[_0xb38f('0x6')](),controller['index']);router['get'](_0xb38f('0x7'),auth['isAuthenticated'](),controller[_0xb38f('0x8')]);router[_0xb38f('0x9')](_0xb38f('0xa'),auth[_0xb38f('0x6')](),controller['getSubjects']);router[_0xb38f('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xb38f('0xb')]);router[_0xb38f('0x9')](_0xb38f('0xc'),auth[_0xb38f('0x6')](),controller[_0xb38f('0xd')]);router[_0xb38f('0xe')]('/',auth[_0xb38f('0x6')](),controller[_0xb38f('0xf')]);router['put'](_0xb38f('0x7'),auth[_0xb38f('0x6')](),controller[_0xb38f('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb38f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 400815c..fa2ecf0 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 _0x5938=['exports','STRING','sequelize'];(function(_0x31da34,_0x24ca9a){var _0x100fd6=function(_0x6098b7){while(--_0x6098b7){_0x31da34['push'](_0x31da34['shift']());}};_0x100fd6(++_0x24ca9a);}(_0x5938,0x113));var _0x8593=function(_0x1b3d3e,_0x4c357f){_0x1b3d3e=_0x1b3d3e-0x0;var _0x509c95=_0x5938[_0x1b3d3e];return _0x509c95;};'use strict';var Sequelize=require(_0x8593('0x0'));module[_0x8593('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8593('0x2')]}}; \ No newline at end of file +var _0x7f3c=['STRING'];(function(_0x273b77,_0x195e0b){var _0x2dd9e2=function(_0x463769){while(--_0x463769){_0x273b77['push'](_0x273b77['shift']());}};_0x2dd9e2(++_0x195e0b);}(_0x7f3c,0x10f));var _0xc7f3=function(_0x3ea8b8,_0x508efb){_0x3ea8b8=_0x3ea8b8-0x0;var _0x7d213f=_0x7f3c[_0x3ea8b8];return _0x7d213f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc7f3('0x0')]},'description':{'type':Sequelize[_0xc7f3('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index a829ba5..7a9f2e4 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 _0x50d8=['apply','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','rows','catch','show','params','find','create','body','getSubjects','findOne','FreshsalesField','length','pick','getDescriptions','getFields','nolimit','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x3e645f,_0xebd82c){var _0x255874=function(_0x19ac81){while(--_0x19ac81){_0x3e645f['push'](_0x3e645f['shift']());}};_0x255874(++_0xebd82c);}(_0x50d8,0x12b));var _0x850d=function(_0x2aed53,_0x13e078){_0x2aed53=_0x2aed53-0x0;var _0x24c121=_0x50d8[_0x2aed53];return _0x24c121;};'use strict';var emlformat=require(_0x850d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x850d('0x1'));var jsonpatch=require(_0x850d('0x2'));var rp=require('request-promise');var moment=require(_0x850d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x850d('0x4'));var path=require(_0x850d('0x5'));var sox=require(_0x850d('0x6'));var csv=require(_0x850d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x850d('0x8'));var squel=require(_0x850d('0x9'));var crypto=require(_0x850d('0xa'));var jsforce=require(_0x850d('0xb'));var deskjs=require(_0x850d('0xc'));var toCsv=require(_0x850d('0x7'));var querystring=require(_0x850d('0xd'));var Papa=require(_0x850d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x850d('0xf'));var as=require(_0x850d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x850d('0x11'));var utils=require(_0x850d('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x850d('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x850d('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x142dd6,_0x20a048,_0x3f3be6,_0x2415a6){return new BPromise(function(_0xe57d3b,_0x2cf6f9){var _0x198125=_0x2415a6||client;return _0x198125[_0x850d('0x15')](_0x142dd6,_0x3f3be6)[_0x850d('0x16')](function(_0x40b94f){logger['info'](_0x850d('0x17'),_0x20a048,_0x850d('0x18'));logger[_0x850d('0x19')](_0x850d('0x1a'),_0x20a048,_0x850d('0x18'),JSON[_0x850d('0x1b')](_0x40b94f));if(_0x40b94f['error']){if(_0x40b94f[_0x850d('0x1c')][_0x850d('0x1d')]===0x1f4){logger['error'](_0x850d('0x17'),_0x20a048,_0x40b94f[_0x850d('0x1c')][_0x850d('0x1e')]);return _0x2cf6f9(_0x40b94f[_0x850d('0x1c')][_0x850d('0x1e')]);}logger[_0x850d('0x1c')](_0x850d('0x17'),_0x20a048,_0x40b94f['error'][_0x850d('0x1e')]);return _0xe57d3b(_0x40b94f[_0x850d('0x1c')][_0x850d('0x1e')]);}else{logger[_0x850d('0x1f')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x20a048,_0x850d('0x18'));_0xe57d3b(_0x40b94f['result']['message']);}})['catch'](function(_0x39e1b7){logger['error'](_0x850d('0x17'),_0x20a048,_0x39e1b7);_0x2cf6f9(_0x39e1b7);});});}function respondWithStatusCode(_0x15c578,_0x510e03){_0x510e03=_0x510e03||0xcc;return function(_0x415b25){if(_0x415b25){return _0x15c578[_0x850d('0x20')](_0x510e03);}return _0x15c578[_0x850d('0x21')](_0x510e03)[_0x850d('0x22')]();};}function respondWithResult(_0x193a51,_0x3beca4){_0x3beca4=_0x3beca4||0xc8;return function(_0x96f836){if(_0x96f836){return _0x193a51[_0x850d('0x21')](_0x3beca4)[_0x850d('0x23')](_0x96f836);}};}function respondWithFilteredResult(_0x5c4f19,_0x4140f5){return function(_0x2b0383){if(_0x2b0383){var _0x22fb58=typeof _0x4140f5[_0x850d('0x24')]===_0x850d('0x25')&&typeof _0x4140f5[_0x850d('0x26')]===_0x850d('0x25');var _0x527b7a=_0x2b0383[_0x850d('0x27')];var _0x5241a0=_0x22fb58?0x0:_0x4140f5[_0x850d('0x24')];var _0x458cc2=_0x22fb58?_0x2b0383[_0x850d('0x27')]:_0x4140f5[_0x850d('0x24')]+_0x4140f5[_0x850d('0x26')];var _0x48730f;if(_0x458cc2>=_0x527b7a){_0x458cc2=_0x527b7a;_0x48730f=0xc8;}else{_0x48730f=0xce;}_0x5c4f19['status'](_0x48730f);return _0x5c4f19['set'](_0x850d('0x28'),_0x5241a0+'-'+_0x458cc2+'/'+_0x527b7a)[_0x850d('0x23')](_0x2b0383);}return null;};}function patchUpdates(_0x1f8394){return function(_0x1e1f88){try{jsonpatch[_0x850d('0x29')](_0x1e1f88,_0x1f8394,!![]);}catch(_0x1fc6a2){return BPromise['reject'](_0x1fc6a2);}return _0x1e1f88[_0x850d('0x2a')]();};}function saveUpdates(_0x2ffaa2,_0x5c0425){return function(_0x37e64c){if(_0x37e64c){return _0x37e64c[_0x850d('0x2b')](_0x2ffaa2)['then'](function(_0x3a54ca){return _0x3a54ca;});}return null;};}function removeEntity(_0x429fba,_0x3ea8f2){return function(_0x238b10){if(_0x238b10){return _0x238b10[_0x850d('0x2c')]()[_0x850d('0x16')](function(){_0x429fba[_0x850d('0x21')](0xcc)[_0x850d('0x22')]();});}};}function handleEntityNotFound(_0x16bfa3,_0x499984){return function(_0x2177ac){if(!_0x2177ac){_0x16bfa3[_0x850d('0x20')](0x194);}return _0x2177ac;};}function handleError(_0x564da9,_0x212a99){_0x212a99=_0x212a99||0x1f4;return function(_0x31f921){logger['error'](_0x31f921[_0x850d('0x2d')]);if(_0x31f921['name']){delete _0x31f921[_0x850d('0x2e')];}_0x564da9['status'](_0x212a99)[_0x850d('0x2f')](_0x31f921);};}exports['index']=function(_0x55faa1,_0xc4ad1e){var _0x12728f={},_0x351d6a={},_0x595101={'count':0x0,'rows':[]};var _0x477816=_[_0x850d('0x30')](db['FreshsalesConfiguration'][_0x850d('0x31')],function(_0x75b813){return{'name':_0x75b813[_0x850d('0x32')],'type':_0x75b813[_0x850d('0x33')]['key']};});_0x351d6a[_0x850d('0x34')]=_['map'](_0x477816,_0x850d('0x2e'));_0x351d6a[_0x850d('0x35')]=_[_0x850d('0x36')](_0x55faa1['query']);_0x351d6a[_0x850d('0x37')]=_['intersection'](_0x351d6a[_0x850d('0x34')],_0x351d6a[_0x850d('0x35')]);_0x12728f[_0x850d('0x38')]=_[_0x850d('0x39')](_0x351d6a[_0x850d('0x34')],qs[_0x850d('0x3a')](_0x55faa1[_0x850d('0x35')][_0x850d('0x3a')]));_0x12728f[_0x850d('0x38')]=_0x12728f[_0x850d('0x38')]['length']?_0x12728f[_0x850d('0x38')]:_0x351d6a[_0x850d('0x34')];if(!_0x55faa1['query'][_0x850d('0x3b')]('nolimit')){_0x12728f['limit']=qs[_0x850d('0x26')](_0x55faa1['query'][_0x850d('0x26')]);_0x12728f[_0x850d('0x24')]=qs['offset'](_0x55faa1[_0x850d('0x35')][_0x850d('0x24')]);}_0x12728f[_0x850d('0x3c')]=qs[_0x850d('0x3d')](_0x55faa1[_0x850d('0x35')][_0x850d('0x3d')]);_0x12728f['where']=qs[_0x850d('0x37')](_['pick'](_0x55faa1[_0x850d('0x35')],_0x351d6a['filters']),_0x477816);if(_0x55faa1[_0x850d('0x35')][_0x850d('0x3e')]){_0x12728f['where']=_[_0x850d('0x3f')](_0x12728f[_0x850d('0x40')],{'$or':_[_0x850d('0x30')](_0x477816,function(_0x3bbc4f){if(_0x3bbc4f[_0x850d('0x33')]!==_0x850d('0x41')){var _0x13e075={};_0x13e075[_0x3bbc4f[_0x850d('0x2e')]]={'$like':'%'+_0x55faa1['query'][_0x850d('0x3e')]+'%'};return _0x13e075;}})});}_0x12728f=_[_0x850d('0x3f')]({},_0x12728f,_0x55faa1[_0x850d('0x42')]);var _0x353fa9={'where':_0x12728f[_0x850d('0x40')]};return db[_0x850d('0x43')][_0x850d('0x27')](_0x353fa9)[_0x850d('0x16')](function(_0x3d476c){_0x595101[_0x850d('0x27')]=_0x3d476c;if(_0x55faa1['query'][_0x850d('0x44')]){_0x12728f[_0x850d('0x45')]=[{'all':!![]}];}return db[_0x850d('0x43')]['findAll'](_0x12728f);})[_0x850d('0x16')](function(_0x3ff459){_0x595101[_0x850d('0x46')]=_0x3ff459;return _0x595101;})[_0x850d('0x16')](respondWithFilteredResult(_0xc4ad1e,_0x12728f))[_0x850d('0x47')](handleError(_0xc4ad1e,null));};exports[_0x850d('0x48')]=function(_0x3470d2,_0x1b4817){var _0x4a99fb={'raw':![],'where':{'id':_0x3470d2[_0x850d('0x49')]['id']}},_0x20ec64={};_0x20ec64['model']=_[_0x850d('0x36')](db[_0x850d('0x43')][_0x850d('0x31')]);_0x20ec64[_0x850d('0x35')]=_[_0x850d('0x36')](_0x3470d2[_0x850d('0x35')]);_0x20ec64[_0x850d('0x37')]=_[_0x850d('0x39')](_0x20ec64[_0x850d('0x34')],_0x20ec64[_0x850d('0x35')]);_0x4a99fb[_0x850d('0x38')]=_[_0x850d('0x39')](_0x20ec64[_0x850d('0x34')],qs[_0x850d('0x3a')](_0x3470d2[_0x850d('0x35')][_0x850d('0x3a')]));_0x4a99fb[_0x850d('0x38')]=_0x4a99fb[_0x850d('0x38')]['length']?_0x4a99fb[_0x850d('0x38')]:_0x20ec64[_0x850d('0x34')];if(_0x3470d2[_0x850d('0x35')][_0x850d('0x44')]){_0x4a99fb[_0x850d('0x45')]=[{'all':!![]}];}_0x4a99fb=_[_0x850d('0x3f')]({},_0x4a99fb,_0x3470d2[_0x850d('0x42')]);return db[_0x850d('0x43')][_0x850d('0x4a')](_0x4a99fb)['then'](handleEntityNotFound(_0x1b4817,null))[_0x850d('0x16')](respondWithResult(_0x1b4817,null))[_0x850d('0x47')](handleError(_0x1b4817,null));};exports[_0x850d('0x4b')]=function(_0x56e54c,_0x5de026){return db[_0x850d('0x43')][_0x850d('0x4b')](_0x56e54c[_0x850d('0x4c')],{})[_0x850d('0x16')](respondWithResult(_0x5de026,0xc9))['catch'](handleError(_0x5de026,null));};exports['update']=function(_0x4c23a5,_0x2b07b3){if(_0x4c23a5[_0x850d('0x4c')]['id']){delete _0x4c23a5[_0x850d('0x4c')]['id'];}return db[_0x850d('0x43')][_0x850d('0x4a')]({'where':{'id':_0x4c23a5[_0x850d('0x49')]['id']}})[_0x850d('0x16')](handleEntityNotFound(_0x2b07b3,null))['then'](saveUpdates(_0x4c23a5[_0x850d('0x4c')],null))[_0x850d('0x16')](respondWithResult(_0x2b07b3,null))[_0x850d('0x47')](handleError(_0x2b07b3,null));};exports[_0x850d('0x2c')]=function(_0x57a7c2,_0x1cfa31){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x57a7c2[_0x850d('0x49')]['id']}})['then'](handleEntityNotFound(_0x1cfa31,null))[_0x850d('0x16')](removeEntity(_0x1cfa31,null))[_0x850d('0x47')](handleError(_0x1cfa31,null));};exports[_0x850d('0x4d')]=function(_0x6ec4ba,_0x187f3d,_0x13bc3d){var _0x2c9f33={};var _0x162ab7={};var _0x25581c;var _0x563522;return db[_0x850d('0x43')][_0x850d('0x4e')]({'where':{'id':_0x6ec4ba[_0x850d('0x49')]['id']}})[_0x850d('0x16')](handleEntityNotFound(_0x187f3d,null))[_0x850d('0x16')](function(_0x2a4417){if(_0x2a4417){_0x25581c=_0x2a4417;_0x162ab7[_0x850d('0x34')]=_[_0x850d('0x36')](db[_0x850d('0x4f')][_0x850d('0x31')]);_0x162ab7[_0x850d('0x35')]=_['keys'](_0x6ec4ba[_0x850d('0x35')]);_0x162ab7[_0x850d('0x37')]=_['intersection'](_0x162ab7[_0x850d('0x34')],_0x162ab7[_0x850d('0x35')]);_0x2c9f33[_0x850d('0x38')]=_[_0x850d('0x39')](_0x162ab7['model'],qs['fields'](_0x6ec4ba[_0x850d('0x35')][_0x850d('0x3a')]));_0x2c9f33[_0x850d('0x38')]=_0x2c9f33[_0x850d('0x38')][_0x850d('0x50')]?_0x2c9f33[_0x850d('0x38')]:_0x162ab7[_0x850d('0x34')];_0x2c9f33[_0x850d('0x3c')]=qs[_0x850d('0x3d')](_0x6ec4ba['query'][_0x850d('0x3d')]);_0x2c9f33[_0x850d('0x40')]=qs[_0x850d('0x37')](_[_0x850d('0x51')](_0x6ec4ba[_0x850d('0x35')],_0x162ab7[_0x850d('0x37')]));if(_0x6ec4ba[_0x850d('0x35')]['filter']){_0x2c9f33['where']=_[_0x850d('0x3f')](_0x2c9f33[_0x850d('0x40')],{'$or':_[_0x850d('0x30')](_0x2c9f33[_0x850d('0x38')],function(_0x2afaa4){var _0x3bcb93={};_0x3bcb93[_0x2afaa4]={'$like':'%'+_0x6ec4ba['query']['filter']+'%'};return _0x3bcb93;})});}_0x2c9f33=_[_0x850d('0x3f')]({},_0x2c9f33,_0x6ec4ba['options']);return _0x25581c['getSubjects'](_0x2c9f33);}})[_0x850d('0x16')](function(_0x55cbd2){if(_0x55cbd2){_0x563522=_0x55cbd2[_0x850d('0x50')];if(!_0x6ec4ba[_0x850d('0x35')][_0x850d('0x3b')]('nolimit')){_0x2c9f33[_0x850d('0x26')]=qs[_0x850d('0x26')](_0x6ec4ba[_0x850d('0x35')]['limit']);_0x2c9f33[_0x850d('0x24')]=qs[_0x850d('0x24')](_0x6ec4ba[_0x850d('0x35')][_0x850d('0x24')]);}return _0x25581c['getSubjects'](_0x2c9f33);}})[_0x850d('0x16')](function(_0xe5b772){if(_0xe5b772){return _0xe5b772?{'count':_0x563522,'rows':_0xe5b772}:null;}})[_0x850d('0x16')](respondWithResult(_0x187f3d,null))[_0x850d('0x47')](handleError(_0x187f3d,null));};exports[_0x850d('0x52')]=function(_0x10143c,_0x1b8720,_0x3dcadd){var _0x4617e2={};var _0x51d4f2={};var _0x237c80;var _0x44ce4d;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x10143c[_0x850d('0x49')]['id']}})[_0x850d('0x16')](handleEntityNotFound(_0x1b8720,null))['then'](function(_0x48677e){if(_0x48677e){_0x237c80=_0x48677e;_0x51d4f2[_0x850d('0x34')]=_[_0x850d('0x36')](db[_0x850d('0x4f')][_0x850d('0x31')]);_0x51d4f2[_0x850d('0x35')]=_[_0x850d('0x36')](_0x10143c[_0x850d('0x35')]);_0x51d4f2['filters']=_['intersection'](_0x51d4f2['model'],_0x51d4f2[_0x850d('0x35')]);_0x4617e2[_0x850d('0x38')]=_['intersection'](_0x51d4f2[_0x850d('0x34')],qs[_0x850d('0x3a')](_0x10143c['query'][_0x850d('0x3a')]));_0x4617e2[_0x850d('0x38')]=_0x4617e2[_0x850d('0x38')][_0x850d('0x50')]?_0x4617e2[_0x850d('0x38')]:_0x51d4f2['model'];_0x4617e2[_0x850d('0x3c')]=qs[_0x850d('0x3d')](_0x10143c['query']['sort']);_0x4617e2[_0x850d('0x40')]=qs[_0x850d('0x37')](_[_0x850d('0x51')](_0x10143c['query'],_0x51d4f2[_0x850d('0x37')]));if(_0x10143c[_0x850d('0x35')][_0x850d('0x3e')]){_0x4617e2[_0x850d('0x40')]=_[_0x850d('0x3f')](_0x4617e2['where'],{'$or':_[_0x850d('0x30')](_0x4617e2[_0x850d('0x38')],function(_0x4d0b58){var _0x106555={};_0x106555[_0x4d0b58]={'$like':'%'+_0x10143c['query'][_0x850d('0x3e')]+'%'};return _0x106555;})});}_0x4617e2=_[_0x850d('0x3f')]({},_0x4617e2,_0x10143c[_0x850d('0x42')]);return _0x237c80['getDescriptions'](_0x4617e2);}})[_0x850d('0x16')](function(_0x27ee7d){if(_0x27ee7d){_0x44ce4d=_0x27ee7d['length'];if(!_0x10143c[_0x850d('0x35')]['hasOwnProperty']('nolimit')){_0x4617e2[_0x850d('0x26')]=qs[_0x850d('0x26')](_0x10143c[_0x850d('0x35')]['limit']);_0x4617e2[_0x850d('0x24')]=qs[_0x850d('0x24')](_0x10143c[_0x850d('0x35')][_0x850d('0x24')]);}return _0x237c80[_0x850d('0x52')](_0x4617e2);}})['then'](function(_0x1861b9){if(_0x1861b9){return _0x1861b9?{'count':_0x44ce4d,'rows':_0x1861b9}:null;}})['then'](respondWithResult(_0x1b8720,null))['catch'](handleError(_0x1b8720,null));};exports[_0x850d('0x53')]=function(_0x290ead,_0x1aa660,_0x2405d6){var _0x13558e={};var _0xc18989={};var _0x4d021a;var _0x3345bc;return db[_0x850d('0x43')][_0x850d('0x4e')]({'where':{'id':_0x290ead['params']['id']}})[_0x850d('0x16')](handleEntityNotFound(_0x1aa660,null))[_0x850d('0x16')](function(_0x506e6e){if(_0x506e6e){_0x4d021a=_0x506e6e;_0xc18989['model']=_[_0x850d('0x36')](db[_0x850d('0x4f')][_0x850d('0x31')]);_0xc18989['query']=_[_0x850d('0x36')](_0x290ead[_0x850d('0x35')]);_0xc18989[_0x850d('0x37')]=_[_0x850d('0x39')](_0xc18989['model'],_0xc18989['query']);_0x13558e['attributes']=_[_0x850d('0x39')](_0xc18989[_0x850d('0x34')],qs[_0x850d('0x3a')](_0x290ead[_0x850d('0x35')][_0x850d('0x3a')]));_0x13558e[_0x850d('0x38')]=_0x13558e[_0x850d('0x38')][_0x850d('0x50')]?_0x13558e['attributes']:_0xc18989[_0x850d('0x34')];_0x13558e[_0x850d('0x3c')]=qs[_0x850d('0x3d')](_0x290ead[_0x850d('0x35')][_0x850d('0x3d')]);_0x13558e['where']=qs[_0x850d('0x37')](_[_0x850d('0x51')](_0x290ead['query'],_0xc18989[_0x850d('0x37')]));if(_0x290ead[_0x850d('0x35')][_0x850d('0x3e')]){_0x13558e[_0x850d('0x40')]=_[_0x850d('0x3f')](_0x13558e[_0x850d('0x40')],{'$or':_[_0x850d('0x30')](_0x13558e[_0x850d('0x38')],function(_0x58292f){var _0x5a9f0f={};_0x5a9f0f[_0x58292f]={'$like':'%'+_0x290ead[_0x850d('0x35')]['filter']+'%'};return _0x5a9f0f;})});}_0x13558e=_['merge']({},_0x13558e,_0x290ead[_0x850d('0x42')]);return _0x4d021a['getFields'](_0x13558e);}})[_0x850d('0x16')](function(_0x2f3924){if(_0x2f3924){_0x3345bc=_0x2f3924['length'];if(!_0x290ead[_0x850d('0x35')][_0x850d('0x3b')](_0x850d('0x54'))){_0x13558e[_0x850d('0x26')]=qs[_0x850d('0x26')](_0x290ead['query'][_0x850d('0x26')]);_0x13558e['offset']=qs[_0x850d('0x24')](_0x290ead[_0x850d('0x35')]['offset']);}return _0x4d021a[_0x850d('0x53')](_0x13558e);}})['then'](function(_0x5c6d26){if(_0x5c6d26){return _0x5c6d26?{'count':_0x3345bc,'rows':_0x5c6d26}:null;}})[_0x850d('0x16')](respondWithResult(_0x1aa660,null))[_0x850d('0x47')](handleError(_0x1aa660,null));}; \ No newline at end of file +var _0x4e06=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','include','findAll','rows','show','params','includeAll','find','create','body','findOne','FreshsalesField','pick','getSubjects','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x4e06,0x1d2));var _0x64e0=function(_0x180a8d,_0x432a75){_0x180a8d=_0x180a8d-0x0;var _0xe5b5c8=_0x4e06[_0x180a8d];return _0xe5b5c8;};'use strict';var emlformat=require(_0x64e0('0x0'));var rimraf=require(_0x64e0('0x1'));var zipdir=require(_0x64e0('0x2'));var jsonpatch=require(_0x64e0('0x3'));var rp=require('request-promise');var moment=require(_0x64e0('0x4'));var BPromise=require(_0x64e0('0x5'));var Mustache=require(_0x64e0('0x6'));var util=require(_0x64e0('0x7'));var path=require(_0x64e0('0x8'));var sox=require('sox');var csv=require(_0x64e0('0x9'));var ejs=require(_0x64e0('0xa'));var fs=require('fs');var fs_extra=require(_0x64e0('0xb'));var _=require(_0x64e0('0xc'));var squel=require(_0x64e0('0xd'));var crypto=require(_0x64e0('0xe'));var jsforce=require(_0x64e0('0xf'));var deskjs=require(_0x64e0('0x10'));var toCsv=require(_0x64e0('0x9'));var querystring=require(_0x64e0('0x11'));var Papa=require(_0x64e0('0x12'));var Redis=require(_0x64e0('0x13'));var authService=require(_0x64e0('0x14'));var qs=require(_0x64e0('0x15'));var as=require(_0x64e0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64e0('0x17'))(_0x64e0('0x18'));var utils=require(_0x64e0('0x19'));var config=require(_0x64e0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x64e0('0x1b'))['db'];var jayson=require(_0x64e0('0x1c'));var client=jayson[_0x64e0('0x1d')][_0x64e0('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xce9af7,_0x46b52f,_0x4b0c67,_0x4b04b8){return new BPromise(function(_0x25b854,_0x566c7e){var _0x14bf01=_0x4b04b8||client;return _0x14bf01[_0x64e0('0x1f')](_0xce9af7,_0x4b0c67)[_0x64e0('0x20')](function(_0x32fdd4){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x46b52f,_0x64e0('0x21'));logger[_0x64e0('0x22')](_0x64e0('0x23'),_0x46b52f,_0x64e0('0x21'),JSON[_0x64e0('0x24')](_0x32fdd4));if(_0x32fdd4[_0x64e0('0x25')]){if(_0x32fdd4[_0x64e0('0x25')][_0x64e0('0x26')]===0x1f4){logger['error'](_0x64e0('0x27'),_0x46b52f,_0x32fdd4[_0x64e0('0x25')][_0x64e0('0x28')]);return _0x566c7e(_0x32fdd4['error'][_0x64e0('0x28')]);}logger['error'](_0x64e0('0x27'),_0x46b52f,_0x32fdd4[_0x64e0('0x25')][_0x64e0('0x28')]);return _0x25b854(_0x32fdd4[_0x64e0('0x25')][_0x64e0('0x28')]);}else{logger['info'](_0x64e0('0x27'),_0x46b52f,_0x64e0('0x21'));_0x25b854(_0x32fdd4['result'][_0x64e0('0x28')]);}})[_0x64e0('0x29')](function(_0xfdd2c0){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x46b52f,_0xfdd2c0);_0x566c7e(_0xfdd2c0);});});}function respondWithStatusCode(_0x465844,_0x39a4be){_0x39a4be=_0x39a4be||0xcc;return function(_0x530216){if(_0x530216){return _0x465844[_0x64e0('0x2a')](_0x39a4be);}return _0x465844[_0x64e0('0x2b')](_0x39a4be)[_0x64e0('0x2c')]();};}function respondWithResult(_0x166f12,_0x41c5b7){_0x41c5b7=_0x41c5b7||0xc8;return function(_0x417bcd){if(_0x417bcd){return _0x166f12[_0x64e0('0x2b')](_0x41c5b7)['json'](_0x417bcd);}};}function respondWithFilteredResult(_0x532122,_0x20d6d1){return function(_0x296d46){if(_0x296d46){var _0x4b842f=typeof _0x20d6d1['offset']===_0x64e0('0x2d')&&typeof _0x20d6d1[_0x64e0('0x2e')]==='undefined';var _0x5ebb16=_0x296d46[_0x64e0('0x2f')];var _0x385fd2=_0x4b842f?0x0:_0x20d6d1[_0x64e0('0x30')];var _0x5eade3=_0x4b842f?_0x296d46['count']:_0x20d6d1[_0x64e0('0x30')]+_0x20d6d1[_0x64e0('0x2e')];var _0x23e6c9;if(_0x5eade3>=_0x5ebb16){_0x5eade3=_0x5ebb16;_0x23e6c9=0xc8;}else{_0x23e6c9=0xce;}_0x532122[_0x64e0('0x2b')](_0x23e6c9);return _0x532122[_0x64e0('0x31')](_0x64e0('0x32'),_0x385fd2+'-'+_0x5eade3+'/'+_0x5ebb16)[_0x64e0('0x33')](_0x296d46);}return null;};}function patchUpdates(_0xef6ed){return function(_0x418562){try{jsonpatch[_0x64e0('0x34')](_0x418562,_0xef6ed,!![]);}catch(_0x2c3961){return BPromise['reject'](_0x2c3961);}return _0x418562[_0x64e0('0x35')]();};}function saveUpdates(_0x141883,_0x218538){return function(_0x1a5f77){if(_0x1a5f77){return _0x1a5f77[_0x64e0('0x36')](_0x141883)[_0x64e0('0x20')](function(_0x1e9463){return _0x1e9463;});}return null;};}function removeEntity(_0x38a8d9,_0x3f5105){return function(_0x1296ca){if(_0x1296ca){return _0x1296ca[_0x64e0('0x37')]()[_0x64e0('0x20')](function(){_0x38a8d9[_0x64e0('0x2b')](0xcc)[_0x64e0('0x2c')]();});}};}function handleEntityNotFound(_0x20a815,_0xfda3a){return function(_0x5651b6){if(!_0x5651b6){_0x20a815[_0x64e0('0x2a')](0x194);}return _0x5651b6;};}function handleError(_0x141994,_0x72413c){_0x72413c=_0x72413c||0x1f4;return function(_0x592a90){logger['error'](_0x592a90['stack']);if(_0x592a90[_0x64e0('0x38')]){delete _0x592a90['name'];}_0x141994['status'](_0x72413c)[_0x64e0('0x39')](_0x592a90);};}exports[_0x64e0('0x3a')]=function(_0x2ede29,_0xbc21a3){var _0x427e60={},_0x4230dc={},_0x329e0c={'count':0x0,'rows':[]};var _0x68513c=_[_0x64e0('0x3b')](db[_0x64e0('0x3c')][_0x64e0('0x3d')],function(_0x3ae781){return{'name':_0x3ae781[_0x64e0('0x3e')],'type':_0x3ae781[_0x64e0('0x3f')][_0x64e0('0x40')]};});_0x4230dc[_0x64e0('0x41')]=_[_0x64e0('0x3b')](_0x68513c,_0x64e0('0x38'));_0x4230dc[_0x64e0('0x42')]=_[_0x64e0('0x43')](_0x2ede29[_0x64e0('0x42')]);_0x4230dc[_0x64e0('0x44')]=_[_0x64e0('0x45')](_0x4230dc[_0x64e0('0x41')],_0x4230dc[_0x64e0('0x42')]);_0x427e60[_0x64e0('0x46')]=_[_0x64e0('0x45')](_0x4230dc[_0x64e0('0x41')],qs[_0x64e0('0x47')](_0x2ede29[_0x64e0('0x42')]['fields']));_0x427e60[_0x64e0('0x46')]=_0x427e60[_0x64e0('0x46')][_0x64e0('0x48')]?_0x427e60[_0x64e0('0x46')]:_0x4230dc[_0x64e0('0x41')];if(!_0x2ede29[_0x64e0('0x42')][_0x64e0('0x49')](_0x64e0('0x4a'))){_0x427e60[_0x64e0('0x2e')]=qs[_0x64e0('0x2e')](_0x2ede29['query'][_0x64e0('0x2e')]);_0x427e60[_0x64e0('0x30')]=qs['offset'](_0x2ede29[_0x64e0('0x42')][_0x64e0('0x30')]);}_0x427e60[_0x64e0('0x4b')]=qs[_0x64e0('0x4c')](_0x2ede29[_0x64e0('0x42')][_0x64e0('0x4c')]);_0x427e60[_0x64e0('0x4d')]=qs['filters'](_['pick'](_0x2ede29[_0x64e0('0x42')],_0x4230dc[_0x64e0('0x44')]),_0x68513c);if(_0x2ede29[_0x64e0('0x42')]['filter']){_0x427e60[_0x64e0('0x4d')]=_[_0x64e0('0x4e')](_0x427e60[_0x64e0('0x4d')],{'$or':_[_0x64e0('0x3b')](_0x68513c,function(_0x3bf508){if(_0x3bf508['type']!=='VIRTUAL'){var _0x31cda7={};_0x31cda7[_0x3bf508[_0x64e0('0x38')]]={'$like':'%'+_0x2ede29[_0x64e0('0x42')][_0x64e0('0x4f')]+'%'};return _0x31cda7;}})});}_0x427e60=_[_0x64e0('0x4e')]({},_0x427e60,_0x2ede29[_0x64e0('0x50')]);var _0x46d17c={'where':_0x427e60[_0x64e0('0x4d')]};return db['FreshsalesConfiguration']['count'](_0x46d17c)[_0x64e0('0x20')](function(_0x24fc2e){_0x329e0c[_0x64e0('0x2f')]=_0x24fc2e;if(_0x2ede29[_0x64e0('0x42')]['includeAll']){_0x427e60[_0x64e0('0x51')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x64e0('0x52')](_0x427e60);})[_0x64e0('0x20')](function(_0x29766d){_0x329e0c[_0x64e0('0x53')]=_0x29766d;return _0x329e0c;})['then'](respondWithFilteredResult(_0xbc21a3,_0x427e60))['catch'](handleError(_0xbc21a3,null));};exports[_0x64e0('0x54')]=function(_0x4129be,_0x4fb79f){var _0x33a68a={'raw':![],'where':{'id':_0x4129be[_0x64e0('0x55')]['id']}},_0x56433f={};_0x56433f[_0x64e0('0x41')]=_[_0x64e0('0x43')](db[_0x64e0('0x3c')][_0x64e0('0x3d')]);_0x56433f[_0x64e0('0x42')]=_[_0x64e0('0x43')](_0x4129be['query']);_0x56433f['filters']=_[_0x64e0('0x45')](_0x56433f[_0x64e0('0x41')],_0x56433f[_0x64e0('0x42')]);_0x33a68a['attributes']=_[_0x64e0('0x45')](_0x56433f[_0x64e0('0x41')],qs[_0x64e0('0x47')](_0x4129be['query'][_0x64e0('0x47')]));_0x33a68a[_0x64e0('0x46')]=_0x33a68a[_0x64e0('0x46')][_0x64e0('0x48')]?_0x33a68a[_0x64e0('0x46')]:_0x56433f[_0x64e0('0x41')];if(_0x4129be['query'][_0x64e0('0x56')]){_0x33a68a[_0x64e0('0x51')]=[{'all':!![]}];}_0x33a68a=_[_0x64e0('0x4e')]({},_0x33a68a,_0x4129be[_0x64e0('0x50')]);return db[_0x64e0('0x3c')][_0x64e0('0x57')](_0x33a68a)['then'](handleEntityNotFound(_0x4fb79f,null))['then'](respondWithResult(_0x4fb79f,null))[_0x64e0('0x29')](handleError(_0x4fb79f,null));};exports[_0x64e0('0x58')]=function(_0x6f9de6,_0x4b96aa){return db['FreshsalesConfiguration'][_0x64e0('0x58')](_0x6f9de6[_0x64e0('0x59')],{})[_0x64e0('0x20')](respondWithResult(_0x4b96aa,0xc9))[_0x64e0('0x29')](handleError(_0x4b96aa,null));};exports['update']=function(_0x3c8267,_0x3eec1d){if(_0x3c8267[_0x64e0('0x59')]['id']){delete _0x3c8267[_0x64e0('0x59')]['id'];}return db['FreshsalesConfiguration'][_0x64e0('0x57')]({'where':{'id':_0x3c8267['params']['id']}})[_0x64e0('0x20')](handleEntityNotFound(_0x3eec1d,null))[_0x64e0('0x20')](saveUpdates(_0x3c8267[_0x64e0('0x59')],null))[_0x64e0('0x20')](respondWithResult(_0x3eec1d,null))['catch'](handleError(_0x3eec1d,null));};exports[_0x64e0('0x37')]=function(_0x331916,_0x26b1a9){return db['FreshsalesConfiguration'][_0x64e0('0x57')]({'where':{'id':_0x331916['params']['id']}})[_0x64e0('0x20')](handleEntityNotFound(_0x26b1a9,null))[_0x64e0('0x20')](removeEntity(_0x26b1a9,null))[_0x64e0('0x29')](handleError(_0x26b1a9,null));};exports['getSubjects']=function(_0x4664ef,_0x4eabad,_0x10a1af){var _0x2e8357={};var _0x5890e4={};var _0xf90d7;var _0x3b4a74;return db['FreshsalesConfiguration'][_0x64e0('0x5a')]({'where':{'id':_0x4664ef[_0x64e0('0x55')]['id']}})[_0x64e0('0x20')](handleEntityNotFound(_0x4eabad,null))['then'](function(_0x581bc9){if(_0x581bc9){_0xf90d7=_0x581bc9;_0x5890e4['model']=_[_0x64e0('0x43')](db[_0x64e0('0x5b')][_0x64e0('0x3d')]);_0x5890e4[_0x64e0('0x42')]=_[_0x64e0('0x43')](_0x4664ef[_0x64e0('0x42')]);_0x5890e4[_0x64e0('0x44')]=_[_0x64e0('0x45')](_0x5890e4['model'],_0x5890e4['query']);_0x2e8357['attributes']=_[_0x64e0('0x45')](_0x5890e4[_0x64e0('0x41')],qs[_0x64e0('0x47')](_0x4664ef[_0x64e0('0x42')][_0x64e0('0x47')]));_0x2e8357['attributes']=_0x2e8357[_0x64e0('0x46')][_0x64e0('0x48')]?_0x2e8357['attributes']:_0x5890e4[_0x64e0('0x41')];_0x2e8357['order']=qs[_0x64e0('0x4c')](_0x4664ef[_0x64e0('0x42')][_0x64e0('0x4c')]);_0x2e8357[_0x64e0('0x4d')]=qs[_0x64e0('0x44')](_[_0x64e0('0x5c')](_0x4664ef[_0x64e0('0x42')],_0x5890e4[_0x64e0('0x44')]));if(_0x4664ef[_0x64e0('0x42')][_0x64e0('0x4f')]){_0x2e8357[_0x64e0('0x4d')]=_[_0x64e0('0x4e')](_0x2e8357['where'],{'$or':_['map'](_0x2e8357['attributes'],function(_0x34b9ef){var _0x54f48f={};_0x54f48f[_0x34b9ef]={'$like':'%'+_0x4664ef[_0x64e0('0x42')]['filter']+'%'};return _0x54f48f;})});}_0x2e8357=_['merge']({},_0x2e8357,_0x4664ef['options']);return _0xf90d7[_0x64e0('0x5d')](_0x2e8357);}})['then'](function(_0x4be205){if(_0x4be205){_0x3b4a74=_0x4be205['length'];if(!_0x4664ef[_0x64e0('0x42')][_0x64e0('0x49')](_0x64e0('0x4a'))){_0x2e8357['limit']=qs[_0x64e0('0x2e')](_0x4664ef[_0x64e0('0x42')][_0x64e0('0x2e')]);_0x2e8357[_0x64e0('0x30')]=qs[_0x64e0('0x30')](_0x4664ef[_0x64e0('0x42')][_0x64e0('0x30')]);}return _0xf90d7['getSubjects'](_0x2e8357);}})[_0x64e0('0x20')](function(_0x28a311){if(_0x28a311){return _0x28a311?{'count':_0x3b4a74,'rows':_0x28a311}:null;}})[_0x64e0('0x20')](respondWithResult(_0x4eabad,null))[_0x64e0('0x29')](handleError(_0x4eabad,null));};exports['getDescriptions']=function(_0x118d1,_0x348c7f,_0x296638){var _0x232fc0={};var _0x18a229={};var _0x459044;var _0x141b7c;return db[_0x64e0('0x3c')][_0x64e0('0x5a')]({'where':{'id':_0x118d1['params']['id']}})[_0x64e0('0x20')](handleEntityNotFound(_0x348c7f,null))['then'](function(_0x2e500c){if(_0x2e500c){_0x459044=_0x2e500c;_0x18a229['model']=_[_0x64e0('0x43')](db[_0x64e0('0x5b')][_0x64e0('0x3d')]);_0x18a229[_0x64e0('0x42')]=_[_0x64e0('0x43')](_0x118d1[_0x64e0('0x42')]);_0x18a229[_0x64e0('0x44')]=_['intersection'](_0x18a229[_0x64e0('0x41')],_0x18a229[_0x64e0('0x42')]);_0x232fc0[_0x64e0('0x46')]=_[_0x64e0('0x45')](_0x18a229[_0x64e0('0x41')],qs[_0x64e0('0x47')](_0x118d1[_0x64e0('0x42')][_0x64e0('0x47')]));_0x232fc0[_0x64e0('0x46')]=_0x232fc0[_0x64e0('0x46')]['length']?_0x232fc0[_0x64e0('0x46')]:_0x18a229['model'];_0x232fc0[_0x64e0('0x4b')]=qs[_0x64e0('0x4c')](_0x118d1['query'][_0x64e0('0x4c')]);_0x232fc0[_0x64e0('0x4d')]=qs[_0x64e0('0x44')](_[_0x64e0('0x5c')](_0x118d1[_0x64e0('0x42')],_0x18a229[_0x64e0('0x44')]));if(_0x118d1['query'][_0x64e0('0x4f')]){_0x232fc0[_0x64e0('0x4d')]=_['merge'](_0x232fc0['where'],{'$or':_[_0x64e0('0x3b')](_0x232fc0[_0x64e0('0x46')],function(_0x3640c3){var _0x179608={};_0x179608[_0x3640c3]={'$like':'%'+_0x118d1[_0x64e0('0x42')]['filter']+'%'};return _0x179608;})});}_0x232fc0=_[_0x64e0('0x4e')]({},_0x232fc0,_0x118d1[_0x64e0('0x50')]);return _0x459044[_0x64e0('0x5e')](_0x232fc0);}})[_0x64e0('0x20')](function(_0x47c303){if(_0x47c303){_0x141b7c=_0x47c303[_0x64e0('0x48')];if(!_0x118d1['query'][_0x64e0('0x49')]('nolimit')){_0x232fc0['limit']=qs[_0x64e0('0x2e')](_0x118d1[_0x64e0('0x42')][_0x64e0('0x2e')]);_0x232fc0[_0x64e0('0x30')]=qs[_0x64e0('0x30')](_0x118d1['query'][_0x64e0('0x30')]);}return _0x459044['getDescriptions'](_0x232fc0);}})[_0x64e0('0x20')](function(_0x1a31e3){if(_0x1a31e3){return _0x1a31e3?{'count':_0x141b7c,'rows':_0x1a31e3}:null;}})[_0x64e0('0x20')](respondWithResult(_0x348c7f,null))[_0x64e0('0x29')](handleError(_0x348c7f,null));};exports[_0x64e0('0x5f')]=function(_0x7dc1d,_0x324781,_0x10d534){var _0x462d91={};var _0x22dd7a={};var _0x26e07f;var _0x3860a6;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x7dc1d[_0x64e0('0x55')]['id']}})[_0x64e0('0x20')](handleEntityNotFound(_0x324781,null))[_0x64e0('0x20')](function(_0x35decb){if(_0x35decb){_0x26e07f=_0x35decb;_0x22dd7a['model']=_[_0x64e0('0x43')](db[_0x64e0('0x5b')][_0x64e0('0x3d')]);_0x22dd7a[_0x64e0('0x42')]=_[_0x64e0('0x43')](_0x7dc1d['query']);_0x22dd7a[_0x64e0('0x44')]=_[_0x64e0('0x45')](_0x22dd7a[_0x64e0('0x41')],_0x22dd7a['query']);_0x462d91[_0x64e0('0x46')]=_[_0x64e0('0x45')](_0x22dd7a[_0x64e0('0x41')],qs['fields'](_0x7dc1d[_0x64e0('0x42')][_0x64e0('0x47')]));_0x462d91['attributes']=_0x462d91['attributes'][_0x64e0('0x48')]?_0x462d91[_0x64e0('0x46')]:_0x22dd7a[_0x64e0('0x41')];_0x462d91[_0x64e0('0x4b')]=qs[_0x64e0('0x4c')](_0x7dc1d['query'][_0x64e0('0x4c')]);_0x462d91[_0x64e0('0x4d')]=qs[_0x64e0('0x44')](_[_0x64e0('0x5c')](_0x7dc1d['query'],_0x22dd7a[_0x64e0('0x44')]));if(_0x7dc1d['query'][_0x64e0('0x4f')]){_0x462d91['where']=_[_0x64e0('0x4e')](_0x462d91[_0x64e0('0x4d')],{'$or':_['map'](_0x462d91[_0x64e0('0x46')],function(_0x174c8c){var _0x431ef0={};_0x431ef0[_0x174c8c]={'$like':'%'+_0x7dc1d[_0x64e0('0x42')][_0x64e0('0x4f')]+'%'};return _0x431ef0;})});}_0x462d91=_[_0x64e0('0x4e')]({},_0x462d91,_0x7dc1d[_0x64e0('0x50')]);return _0x26e07f['getFields'](_0x462d91);}})[_0x64e0('0x20')](function(_0x5c7117){if(_0x5c7117){_0x3860a6=_0x5c7117['length'];if(!_0x7dc1d[_0x64e0('0x42')][_0x64e0('0x49')](_0x64e0('0x4a'))){_0x462d91[_0x64e0('0x2e')]=qs[_0x64e0('0x2e')](_0x7dc1d[_0x64e0('0x42')][_0x64e0('0x2e')]);_0x462d91['offset']=qs[_0x64e0('0x30')](_0x7dc1d['query'][_0x64e0('0x30')]);}return _0x26e07f[_0x64e0('0x5f')](_0x462d91);}})['then'](function(_0x2be43f){if(_0x2be43f){return _0x2be43f?{'count':_0x3860a6,'rows':_0x2be43f}:null;}})[_0x64e0('0x20')](respondWithResult(_0x324781,null))['catch'](handleError(_0x324781,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 153bb25..3b02711 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 _0x3d15=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3d15,0x127));var _0x53d1=function(_0x1d227e,_0x361094){_0x1d227e=_0x1d227e-0x0;var _0x7ccf13=_0x3d15[_0x1d227e];return _0x7ccf13;};'use strict';var _=require('lodash');var util=require(_0x53d1('0x0'));var logger=require(_0x53d1('0x1'))('api');var moment=require(_0x53d1('0x2'));var BPromise=require(_0x53d1('0x3'));var rp=require(_0x53d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53d1('0x5'));var config=require(_0x53d1('0x6'));var attributes=require(_0x53d1('0x7'));module['exports']=function(_0x3b3e81,_0x74eec6){return _0x3b3e81['define'](_0x53d1('0x8'),attributes,{'tableName':_0x53d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5076=['bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','../../config/logger','moment'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0x5076,0x168));var _0x6507=function(_0x2e8e23,_0x4e2504){_0x2e8e23=_0x2e8e23-0x0;var _0x4e285f=_0x5076[_0x2e8e23];return _0x4e285f;};'use strict';var _=require(_0x6507('0x0'));var util=require('util');var logger=require(_0x6507('0x1'))('api');var moment=require(_0x6507('0x2'));var BPromise=require(_0x6507('0x3'));var rp=require(_0x6507('0x4'));var fs=require('fs');var path=require(_0x6507('0x5'));var rimraf=require('rimraf');var config=require(_0x6507('0x6'));var attributes=require(_0x6507('0x7'));module[_0x6507('0x8')]=function(_0x527649,_0x40d670){return _0x527649[_0x6507('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0x6507('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 18b52f1..36d0a0f 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 _0x41bb=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x2ae882,_0x5a6f39){var _0x49d18b=function(_0x2d1835){while(--_0x2d1835){_0x2ae882['push'](_0x2ae882['shift']());}};_0x49d18b(++_0x5a6f39);}(_0x41bb,0xc5));var _0xb41b=function(_0x4d78fb,_0x280202){_0x4d78fb=_0x4d78fb-0x0;var _0x2898bf=_0x41bb[_0x4d78fb];return _0x2898bf;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5455ce,_0x497242,_0x2704f0){return new BPromise(function(_0x29c30d,_0x53722a){return client[_0xb41b('0xa')](_0x5455ce,_0x2704f0)[_0xb41b('0xb')](function(_0x11b8b2){logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));logger[_0xb41b('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x497242,_0xb41b('0xe'),JSON['stringify'](_0x11b8b2));if(_0x11b8b2[_0xb41b('0x10')]){if(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error'][_0xb41b('0x12')]);return _0x53722a(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error']['message']);return _0x29c30d(_0x11b8b2['error'][_0xb41b('0x12')]);}else{logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));_0x29c30d(_0x11b8b2[_0xb41b('0x13')]['message']);}})[_0xb41b('0x14')](function(_0xd0b6b5){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0xd0b6b5);_0x53722a(_0xd0b6b5);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x58ae8a,_0x3c619e){var _0x2f0b6b=function(_0x6db940){while(--_0x6db940){_0x58ae8a['push'](_0x58ae8a['shift']());}};_0x2f0b6b(++_0x3c619e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 9d80d80..e63dcc4 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 _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x408815,_0x395cd2){var _0x2aebbf=function(_0x6b3120){while(--_0x6b3120){_0x408815['push'](_0x408815['shift']());}};_0x2aebbf(++_0x395cd2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x31d5f8,_0x15ad85){var _0x3fb7d0=function(_0x4a8cf3){while(--_0x4a8cf3){_0x31d5f8['push'](_0x31d5f8['shift']());}};_0x3fb7d0(++_0x15ad85);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 0c79708..aa920b6 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 _0xd8fb=['BOOLEAN','sequelize','exports','ENUM','string','picklist','STRING','variable'];(function(_0x4426a6,_0x19230f){var _0x4d4ec3=function(_0x477f41){while(--_0x477f41){_0x4426a6['push'](_0x4426a6['shift']());}};_0x4d4ec3(++_0x19230f);}(_0xd8fb,0x99));var _0xbd8f=function(_0x299c27,_0x496d3d){_0x299c27=_0x299c27-0x0;var _0x38ddc2=_0xd8fb[_0x299c27];return _0x38ddc2;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'type':{'type':Sequelize[_0xbd8f('0x2')](_0xbd8f('0x3'),'variable','customVariable','keyValue',_0xbd8f('0x4')),'defaultValue':_0xbd8f('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xbd8f('0x5')]},'keyType':{'type':Sequelize[_0xbd8f('0x2')]('string',_0xbd8f('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xbd8f('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbd8f('0x5')]},'customField':{'type':Sequelize[_0xbd8f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4b19=['sequelize','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0x4b19,0x195));var _0x94b1=function(_0x3d9e55,_0x407319){_0x3d9e55=_0x3d9e55-0x0;var _0x4e7408=_0x4b19[_0x3d9e55];return _0x4e7408;};'use strict';var Sequelize=require(_0x94b1('0x0'));module['exports']={'type':{'type':Sequelize[_0x94b1('0x1')](_0x94b1('0x2'),_0x94b1('0x3'),'customVariable',_0x94b1('0x4'),_0x94b1('0x5')),'defaultValue':_0x94b1('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x94b1('0x6')]},'keyType':{'type':Sequelize[_0x94b1('0x1')]('string',_0x94b1('0x3'),_0x94b1('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x94b1('0x6')]},'nameField':{'type':Sequelize[_0x94b1('0x6')]},'customField':{'type':Sequelize[_0x94b1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 4ac7d32..9b35b19 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 _0x666d=['query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','pick','filter','merge','options','include','findAll','rows','params','find','catch','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model'];(function(_0x50fc7d,_0x4d1fb3){var _0x42d5a8=function(_0x864e1e){while(--_0x864e1e){_0x50fc7d['push'](_0x50fc7d['shift']());}};_0x42d5a8(++_0x4d1fb3);}(_0x666d,0x1de));var _0xd666=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x666d[_0xac151d];return _0x111dba;};'use strict';var emlformat=require(_0xd666('0x0'));var rimraf=require(_0xd666('0x1'));var zipdir=require(_0xd666('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd666('0x3'));var moment=require(_0xd666('0x4'));var BPromise=require(_0xd666('0x5'));var Mustache=require(_0xd666('0x6'));var util=require(_0xd666('0x7'));var path=require(_0xd666('0x8'));var sox=require(_0xd666('0x9'));var csv=require(_0xd666('0xa'));var ejs=require(_0xd666('0xb'));var fs=require('fs');var fs_extra=require(_0xd666('0xc'));var _=require('lodash');var squel=require(_0xd666('0xd'));var crypto=require(_0xd666('0xe'));var jsforce=require(_0xd666('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd666('0xa'));var querystring=require(_0xd666('0x10'));var Papa=require(_0xd666('0x11'));var Redis=require('ioredis');var authService=require(_0xd666('0x12'));var qs=require(_0xd666('0x13'));var as=require(_0xd666('0x14'));var hardwareService=require(_0xd666('0x15'));var logger=require(_0xd666('0x16'))(_0xd666('0x17'));var utils=require(_0xd666('0x18'));var config=require(_0xd666('0x19'));var licenseUtil=require(_0xd666('0x1a'));var db=require(_0xd666('0x1b'))['db'];function respondWithStatusCode(_0x7cb95,_0x34a0a2){_0x34a0a2=_0x34a0a2||0xcc;return function(_0x43a6c0){if(_0x43a6c0){return _0x7cb95['sendStatus'](_0x34a0a2);}return _0x7cb95[_0xd666('0x1c')](_0x34a0a2)[_0xd666('0x1d')]();};}function respondWithResult(_0x148c0a,_0x3c3785){_0x3c3785=_0x3c3785||0xc8;return function(_0x500db6){if(_0x500db6){return _0x148c0a['status'](_0x3c3785)[_0xd666('0x1e')](_0x500db6);}};}function respondWithFilteredResult(_0x487f48,_0x20cebd){return function(_0x55dbf4){if(_0x55dbf4){var _0x130067=typeof _0x20cebd[_0xd666('0x1f')]===_0xd666('0x20')&&typeof _0x20cebd['limit']===_0xd666('0x20');var _0x7bed2f=_0x55dbf4[_0xd666('0x21')];var _0x394cf1=_0x130067?0x0:_0x20cebd[_0xd666('0x1f')];var _0x7fbda0=_0x130067?_0x55dbf4[_0xd666('0x21')]:_0x20cebd[_0xd666('0x1f')]+_0x20cebd[_0xd666('0x22')];var _0x2c0644;if(_0x7fbda0>=_0x7bed2f){_0x7fbda0=_0x7bed2f;_0x2c0644=0xc8;}else{_0x2c0644=0xce;}_0x487f48[_0xd666('0x1c')](_0x2c0644);return _0x487f48[_0xd666('0x23')](_0xd666('0x24'),_0x394cf1+'-'+_0x7fbda0+'/'+_0x7bed2f)[_0xd666('0x1e')](_0x55dbf4);}return null;};}function patchUpdates(_0x35d670){return function(_0x244a1b){try{jsonpatch[_0xd666('0x25')](_0x244a1b,_0x35d670,!![]);}catch(_0x494cbd){return BPromise[_0xd666('0x26')](_0x494cbd);}return _0x244a1b[_0xd666('0x27')]();};}function saveUpdates(_0x1fff3a,_0x5cc21a){return function(_0x2d8c5a){if(_0x2d8c5a){return _0x2d8c5a[_0xd666('0x28')](_0x1fff3a)[_0xd666('0x29')](function(_0x385097){return _0x385097;});}return null;};}function removeEntity(_0x28a33c,_0x4723d0){return function(_0x3316ea){if(_0x3316ea){return _0x3316ea['destroy']()[_0xd666('0x29')](function(){_0x28a33c[_0xd666('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a6db,_0x283392){return function(_0x3cea01){if(!_0x3cea01){_0x5a6db[_0xd666('0x2a')](0x194);}return _0x3cea01;};}function handleError(_0x55a6f1,_0x2ebce2){_0x2ebce2=_0x2ebce2||0x1f4;return function(_0x1cca51){logger[_0xd666('0x2b')](_0x1cca51['stack']);if(_0x1cca51[_0xd666('0x2c')]){delete _0x1cca51[_0xd666('0x2c')];}_0x55a6f1['status'](_0x2ebce2)[_0xd666('0x2d')](_0x1cca51);};}exports[_0xd666('0x2e')]=function(_0x796689,_0x939e9b){var _0x23bb6b={},_0x3203a9={},_0x166009={'count':0x0,'rows':[]};var _0x37c7e5=_[_0xd666('0x2f')](db[_0xd666('0x30')][_0xd666('0x31')],function(_0x3be986){return{'name':_0x3be986[_0xd666('0x32')],'type':_0x3be986[_0xd666('0x33')][_0xd666('0x34')]};});_0x3203a9[_0xd666('0x35')]=_[_0xd666('0x2f')](_0x37c7e5,'name');_0x3203a9[_0xd666('0x36')]=_[_0xd666('0x37')](_0x796689[_0xd666('0x36')]);_0x3203a9[_0xd666('0x38')]=_['intersection'](_0x3203a9[_0xd666('0x35')],_0x3203a9['query']);_0x23bb6b[_0xd666('0x39')]=_[_0xd666('0x3a')](_0x3203a9[_0xd666('0x35')],qs[_0xd666('0x3b')](_0x796689[_0xd666('0x36')]['fields']));_0x23bb6b[_0xd666('0x39')]=_0x23bb6b[_0xd666('0x39')][_0xd666('0x3c')]?_0x23bb6b['attributes']:_0x3203a9[_0xd666('0x35')];if(!_0x796689[_0xd666('0x36')]['hasOwnProperty'](_0xd666('0x3d'))){_0x23bb6b['limit']=qs[_0xd666('0x22')](_0x796689[_0xd666('0x36')][_0xd666('0x22')]);_0x23bb6b[_0xd666('0x1f')]=qs['offset'](_0x796689[_0xd666('0x36')][_0xd666('0x1f')]);}_0x23bb6b[_0xd666('0x3e')]=qs['sort'](_0x796689[_0xd666('0x36')]['sort']);_0x23bb6b[_0xd666('0x3f')]=qs['filters'](_[_0xd666('0x40')](_0x796689[_0xd666('0x36')],_0x3203a9['filters']),_0x37c7e5);if(_0x796689['query'][_0xd666('0x41')]){_0x23bb6b[_0xd666('0x3f')]=_[_0xd666('0x42')](_0x23bb6b['where'],{'$or':_[_0xd666('0x2f')](_0x37c7e5,function(_0x37df72){if(_0x37df72['type']!=='VIRTUAL'){var _0x35ee2b={};_0x35ee2b[_0x37df72[_0xd666('0x2c')]]={'$like':'%'+_0x796689['query'][_0xd666('0x41')]+'%'};return _0x35ee2b;}})});}_0x23bb6b=_[_0xd666('0x42')]({},_0x23bb6b,_0x796689[_0xd666('0x43')]);var _0x2eb916={'where':_0x23bb6b[_0xd666('0x3f')]};return db[_0xd666('0x30')][_0xd666('0x21')](_0x2eb916)[_0xd666('0x29')](function(_0x3bb96f){_0x166009[_0xd666('0x21')]=_0x3bb96f;if(_0x796689[_0xd666('0x36')]['includeAll']){_0x23bb6b[_0xd666('0x44')]=[{'all':!![]}];}return db[_0xd666('0x30')][_0xd666('0x45')](_0x23bb6b);})[_0xd666('0x29')](function(_0x2bda01){_0x166009[_0xd666('0x46')]=_0x2bda01;return _0x166009;})[_0xd666('0x29')](respondWithFilteredResult(_0x939e9b,_0x23bb6b))['catch'](handleError(_0x939e9b,null));};exports['show']=function(_0x31a0fc,_0x1a8d93){var _0x151030={'raw':!![],'where':{'id':_0x31a0fc[_0xd666('0x47')]['id']}},_0x20e20b={};_0x20e20b[_0xd666('0x35')]=_[_0xd666('0x37')](db[_0xd666('0x30')]['rawAttributes']);_0x20e20b[_0xd666('0x36')]=_['keys'](_0x31a0fc['query']);_0x20e20b[_0xd666('0x38')]=_[_0xd666('0x3a')](_0x20e20b['model'],_0x20e20b[_0xd666('0x36')]);_0x151030[_0xd666('0x39')]=_[_0xd666('0x3a')](_0x20e20b[_0xd666('0x35')],qs[_0xd666('0x3b')](_0x31a0fc[_0xd666('0x36')][_0xd666('0x3b')]));_0x151030[_0xd666('0x39')]=_0x151030[_0xd666('0x39')]['length']?_0x151030[_0xd666('0x39')]:_0x20e20b['model'];if(_0x31a0fc[_0xd666('0x36')]['includeAll']){_0x151030[_0xd666('0x44')]=[{'all':!![]}];}_0x151030=_[_0xd666('0x42')]({},_0x151030,_0x31a0fc[_0xd666('0x43')]);return db['FreshsalesField'][_0xd666('0x48')](_0x151030)[_0xd666('0x29')](handleEntityNotFound(_0x1a8d93,null))[_0xd666('0x29')](respondWithResult(_0x1a8d93,null))[_0xd666('0x49')](handleError(_0x1a8d93,null));};exports['create']=function(_0x1dcd8f,_0x38c589){return db[_0xd666('0x30')]['create'](_0x1dcd8f[_0xd666('0x4a')],{})[_0xd666('0x29')](respondWithResult(_0x38c589,0xc9))['catch'](handleError(_0x38c589,null));};exports[_0xd666('0x28')]=function(_0xd6213d,_0x314a50){if(_0xd6213d['body']['id']){delete _0xd6213d['body']['id'];}return db[_0xd666('0x30')]['find']({'where':{'id':_0xd6213d[_0xd666('0x47')]['id']}})[_0xd666('0x29')](handleEntityNotFound(_0x314a50,null))[_0xd666('0x29')](saveUpdates(_0xd6213d['body'],null))[_0xd666('0x29')](respondWithResult(_0x314a50,null))[_0xd666('0x49')](handleError(_0x314a50,null));};exports[_0xd666('0x4b')]=function(_0x450349,_0x519f41){return db['FreshsalesField'][_0xd666('0x48')]({'where':{'id':_0x450349['params']['id']}})[_0xd666('0x29')](handleEntityNotFound(_0x519f41,null))['then'](removeEntity(_0x519f41,null))[_0xd666('0x49')](handleError(_0x519f41,null));}; \ No newline at end of file +var _0x6601=['type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','keys','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','FreshsalesField','fieldName','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x6601,0x137));var _0x1660=function(_0x509dee,_0x3eab24){_0x509dee=_0x509dee-0x0;var _0x3f57bb=_0x6601[_0x509dee];return _0x3f57bb;};'use strict';var emlformat=require(_0x1660('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1660('0x1'));var jsonpatch=require(_0x1660('0x2'));var rp=require(_0x1660('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1660('0x4'));var util=require('util');var path=require(_0x1660('0x5'));var sox=require(_0x1660('0x6'));var csv=require(_0x1660('0x7'));var ejs=require(_0x1660('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1660('0x9'));var squel=require(_0x1660('0xa'));var crypto=require(_0x1660('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1660('0xc'));var Redis=require(_0x1660('0xd'));var authService=require(_0x1660('0xe'));var qs=require(_0x1660('0xf'));var as=require(_0x1660('0x10'));var hardwareService=require(_0x1660('0x11'));var logger=require(_0x1660('0x12'))(_0x1660('0x13'));var utils=require(_0x1660('0x14'));var config=require(_0x1660('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1660('0x16'))['db'];function respondWithStatusCode(_0x4328df,_0x349848){_0x349848=_0x349848||0xcc;return function(_0x7353a6){if(_0x7353a6){return _0x4328df[_0x1660('0x17')](_0x349848);}return _0x4328df[_0x1660('0x18')](_0x349848)['end']();};}function respondWithResult(_0x1a093d,_0x1daad2){_0x1daad2=_0x1daad2||0xc8;return function(_0x4bbab4){if(_0x4bbab4){return _0x1a093d[_0x1660('0x18')](_0x1daad2)[_0x1660('0x19')](_0x4bbab4);}};}function respondWithFilteredResult(_0x358d90,_0x585e83){return function(_0x2c9600){if(_0x2c9600){var _0x77e063=typeof _0x585e83[_0x1660('0x1a')]===_0x1660('0x1b')&&typeof _0x585e83[_0x1660('0x1c')]===_0x1660('0x1b');var _0x48d191=_0x2c9600[_0x1660('0x1d')];var _0x14808a=_0x77e063?0x0:_0x585e83[_0x1660('0x1a')];var _0x1a68a2=_0x77e063?_0x2c9600['count']:_0x585e83[_0x1660('0x1a')]+_0x585e83[_0x1660('0x1c')];var _0x3c3227;if(_0x1a68a2>=_0x48d191){_0x1a68a2=_0x48d191;_0x3c3227=0xc8;}else{_0x3c3227=0xce;}_0x358d90['status'](_0x3c3227);return _0x358d90['set'](_0x1660('0x1e'),_0x14808a+'-'+_0x1a68a2+'/'+_0x48d191)[_0x1660('0x19')](_0x2c9600);}return null;};}function patchUpdates(_0x147551){return function(_0x215cd8){try{jsonpatch[_0x1660('0x1f')](_0x215cd8,_0x147551,!![]);}catch(_0x35276a){return BPromise[_0x1660('0x20')](_0x35276a);}return _0x215cd8[_0x1660('0x21')]();};}function saveUpdates(_0x3e79cd,_0x1b8861){return function(_0x1b5c90){if(_0x1b5c90){return _0x1b5c90[_0x1660('0x22')](_0x3e79cd)[_0x1660('0x23')](function(_0x19ea24){return _0x19ea24;});}return null;};}function removeEntity(_0x5e3292,_0x235d38){return function(_0x55e4c1){if(_0x55e4c1){return _0x55e4c1[_0x1660('0x24')]()[_0x1660('0x23')](function(){_0x5e3292[_0x1660('0x18')](0xcc)[_0x1660('0x25')]();});}};}function handleEntityNotFound(_0x3be8d6,_0xd5ede4){return function(_0x5f54bb){if(!_0x5f54bb){_0x3be8d6['sendStatus'](0x194);}return _0x5f54bb;};}function handleError(_0x2bf9c5,_0x45c426){_0x45c426=_0x45c426||0x1f4;return function(_0x4af704){logger['error'](_0x4af704[_0x1660('0x26')]);if(_0x4af704['name']){delete _0x4af704[_0x1660('0x27')];}_0x2bf9c5[_0x1660('0x18')](_0x45c426)['send'](_0x4af704);};}exports[_0x1660('0x28')]=function(_0xd53d0d,_0x477eea){var _0x1e7278={},_0x29a4c0={},_0x2f0720={'count':0x0,'rows':[]};var _0x1ff5d4=_['map'](db[_0x1660('0x29')]['rawAttributes'],function(_0x4bfbf7){return{'name':_0x4bfbf7[_0x1660('0x2a')],'type':_0x4bfbf7['type'][_0x1660('0x2b')]};});_0x29a4c0['model']=_[_0x1660('0x2c')](_0x1ff5d4,_0x1660('0x27'));_0x29a4c0['query']=_['keys'](_0xd53d0d[_0x1660('0x2d')]);_0x29a4c0[_0x1660('0x2e')]=_[_0x1660('0x2f')](_0x29a4c0['model'],_0x29a4c0[_0x1660('0x2d')]);_0x1e7278['attributes']=_[_0x1660('0x2f')](_0x29a4c0[_0x1660('0x30')],qs[_0x1660('0x31')](_0xd53d0d[_0x1660('0x2d')][_0x1660('0x31')]));_0x1e7278[_0x1660('0x32')]=_0x1e7278[_0x1660('0x32')][_0x1660('0x33')]?_0x1e7278[_0x1660('0x32')]:_0x29a4c0['model'];if(!_0xd53d0d[_0x1660('0x2d')][_0x1660('0x34')](_0x1660('0x35'))){_0x1e7278[_0x1660('0x1c')]=qs[_0x1660('0x1c')](_0xd53d0d[_0x1660('0x2d')][_0x1660('0x1c')]);_0x1e7278[_0x1660('0x1a')]=qs['offset'](_0xd53d0d['query'][_0x1660('0x1a')]);}_0x1e7278[_0x1660('0x36')]=qs[_0x1660('0x37')](_0xd53d0d[_0x1660('0x2d')]['sort']);_0x1e7278[_0x1660('0x38')]=qs[_0x1660('0x2e')](_[_0x1660('0x39')](_0xd53d0d['query'],_0x29a4c0['filters']),_0x1ff5d4);if(_0xd53d0d[_0x1660('0x2d')]['filter']){_0x1e7278[_0x1660('0x38')]=_[_0x1660('0x3a')](_0x1e7278[_0x1660('0x38')],{'$or':_['map'](_0x1ff5d4,function(_0x432fad){if(_0x432fad[_0x1660('0x3b')]!==_0x1660('0x3c')){var _0x25ea1d={};_0x25ea1d[_0x432fad['name']]={'$like':'%'+_0xd53d0d[_0x1660('0x2d')][_0x1660('0x3d')]+'%'};return _0x25ea1d;}})});}_0x1e7278=_[_0x1660('0x3a')]({},_0x1e7278,_0xd53d0d[_0x1660('0x3e')]);var _0x397717={'where':_0x1e7278[_0x1660('0x38')]};return db['FreshsalesField'][_0x1660('0x1d')](_0x397717)[_0x1660('0x23')](function(_0x398cad){_0x2f0720[_0x1660('0x1d')]=_0x398cad;if(_0xd53d0d[_0x1660('0x2d')][_0x1660('0x3f')]){_0x1e7278[_0x1660('0x40')]=[{'all':!![]}];}return db[_0x1660('0x29')][_0x1660('0x41')](_0x1e7278);})[_0x1660('0x23')](function(_0x48736f){_0x2f0720['rows']=_0x48736f;return _0x2f0720;})[_0x1660('0x23')](respondWithFilteredResult(_0x477eea,_0x1e7278))['catch'](handleError(_0x477eea,null));};exports[_0x1660('0x42')]=function(_0x32ad51,_0x4b3ca0){var _0x4a1a78={'raw':!![],'where':{'id':_0x32ad51[_0x1660('0x43')]['id']}},_0x2c8b79={};_0x2c8b79['model']=_['keys'](db['FreshsalesField'][_0x1660('0x44')]);_0x2c8b79[_0x1660('0x2d')]=_[_0x1660('0x45')](_0x32ad51[_0x1660('0x2d')]);_0x2c8b79[_0x1660('0x2e')]=_[_0x1660('0x2f')](_0x2c8b79['model'],_0x2c8b79[_0x1660('0x2d')]);_0x4a1a78[_0x1660('0x32')]=_['intersection'](_0x2c8b79[_0x1660('0x30')],qs[_0x1660('0x31')](_0x32ad51[_0x1660('0x2d')]['fields']));_0x4a1a78[_0x1660('0x32')]=_0x4a1a78[_0x1660('0x32')][_0x1660('0x33')]?_0x4a1a78[_0x1660('0x32')]:_0x2c8b79[_0x1660('0x30')];if(_0x32ad51[_0x1660('0x2d')][_0x1660('0x3f')]){_0x4a1a78[_0x1660('0x40')]=[{'all':!![]}];}_0x4a1a78=_[_0x1660('0x3a')]({},_0x4a1a78,_0x32ad51[_0x1660('0x3e')]);return db[_0x1660('0x29')][_0x1660('0x46')](_0x4a1a78)[_0x1660('0x23')](handleEntityNotFound(_0x4b3ca0,null))[_0x1660('0x23')](respondWithResult(_0x4b3ca0,null))[_0x1660('0x47')](handleError(_0x4b3ca0,null));};exports[_0x1660('0x48')]=function(_0x1e28f4,_0x1b252e){return db['FreshsalesField'][_0x1660('0x48')](_0x1e28f4[_0x1660('0x49')],{})[_0x1660('0x23')](respondWithResult(_0x1b252e,0xc9))[_0x1660('0x47')](handleError(_0x1b252e,null));};exports['update']=function(_0x2258d2,_0x2197f4){if(_0x2258d2[_0x1660('0x49')]['id']){delete _0x2258d2[_0x1660('0x49')]['id'];}return db[_0x1660('0x29')]['find']({'where':{'id':_0x2258d2[_0x1660('0x43')]['id']}})[_0x1660('0x23')](handleEntityNotFound(_0x2197f4,null))[_0x1660('0x23')](saveUpdates(_0x2258d2[_0x1660('0x49')],null))[_0x1660('0x23')](respondWithResult(_0x2197f4,null))[_0x1660('0x47')](handleError(_0x2197f4,null));};exports[_0x1660('0x24')]=function(_0x5597e2,_0xa6b6bd){return db['FreshsalesField']['find']({'where':{'id':_0x5597e2['params']['id']}})[_0x1660('0x23')](handleEntityNotFound(_0xa6b6bd,null))['then'](removeEntity(_0xa6b6bd,null))[_0x1660('0x47')](handleError(_0xa6b6bd,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 979169a..66addd4 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 _0x7525=['../../config/logger','bluebird','path','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','util'];(function(_0x48633e,_0x27944e){var _0x21173b=function(_0x5f0f73){while(--_0x5f0f73){_0x48633e['push'](_0x48633e['shift']());}};_0x21173b(++_0x27944e);}(_0x7525,0xef));var _0x5752=function(_0x57a97a,_0x3672e9){_0x57a97a=_0x57a97a-0x0;var _0x12a961=_0x7525[_0x57a97a];return _0x12a961;};'use strict';var _=require('lodash');var util=require(_0x5752('0x0'));var logger=require(_0x5752('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5752('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5752('0x3'));var rimraf=require('rimraf');var config=require(_0x5752('0x4'));var attributes=require(_0x5752('0x5'));module[_0x5752('0x6')]=function(_0xca4fe7,_0x6feca8){return _0xca4fe7[_0x5752('0x7')]('FreshsalesField',attributes,{'tableName':_0x5752('0x8'),'paranoid':![],'indexes':[{'name':_0x5752('0x9'),'fields':[_0x5752('0xa'),_0x5752('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x212f=['define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0x212f,0x1e5));var _0xf212=function(_0x58f17a,_0x1eeabc){_0x58f17a=_0x58f17a-0x0;var _0x56f805=_0x212f[_0x58f17a];return _0x56f805;};'use strict';var _=require(_0xf212('0x0'));var util=require(_0xf212('0x1'));var logger=require(_0xf212('0x2'))(_0xf212('0x3'));var moment=require(_0xf212('0x4'));var BPromise=require(_0xf212('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf212('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x409d91,_0x13c032){return _0x409d91[_0xf212('0x7')](_0xf212('0x8'),attributes,{'tableName':_0xf212('0x9'),'paranoid':![],'indexes':[{'name':_0xf212('0xa'),'fields':['idField',_0xf212('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index d4d5772..1c99edf 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 _0x3e68=['FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xe713f7,_0x14038b){var _0x31fcd3=function(_0x5ebb91){while(--_0x5ebb91){_0xe713f7['push'](_0xe713f7['shift']());}};_0x31fcd3(++_0x14038b);}(_0x3e68,0x82));var _0x83e6=function(_0x11f10b,_0x2c5e60){_0x11f10b=_0x11f10b-0x0;var _0x31f6fe=_0x3e68[_0x11f10b];return _0x31f6fe;};'use strict';var _=require(_0x83e6('0x0'));var util=require(_0x83e6('0x1'));var moment=require(_0x83e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x83e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x83e6('0x4'))(_0x83e6('0x5'));var config=require(_0x83e6('0x6'));var jayson=require(_0x83e6('0x7'));var client=jayson[_0x83e6('0x8')][_0x83e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d4309,_0x3b48b7,_0x4b2ac7){return new BPromise(function(_0x220aee,_0x1c80b2){return client[_0x83e6('0xa')](_0x4d4309,_0x4b2ac7)['then'](function(_0x2a0d16){logger[_0x83e6('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x3b48b7,'request\x20sent');logger[_0x83e6('0xc')](_0x83e6('0xd'),_0x3b48b7,_0x83e6('0xe'),JSON[_0x83e6('0xf')](_0x2a0d16));if(_0x2a0d16[_0x83e6('0x10')]){if(_0x2a0d16[_0x83e6('0x10')]['code']===0x1f4){logger[_0x83e6('0x10')](_0x83e6('0x11'),_0x3b48b7,_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);return _0x1c80b2(_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);}logger[_0x83e6('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x3b48b7,_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);return _0x220aee(_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);}else{logger[_0x83e6('0xb')](_0x83e6('0x11'),_0x3b48b7,'request\x20sent');_0x220aee(_0x2a0d16[_0x83e6('0x13')][_0x83e6('0x12')]);}})[_0x83e6('0x14')](function(_0x5f0741){logger[_0x83e6('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x3b48b7,_0x5f0741);_0x1c80b2(_0x5f0741);});});} \ No newline at end of file +var _0x85b8=['http','request','then','info','request\x20sent','debug','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4758d0,_0x1d7860){var _0x1d6e88=function(_0x2b2a51){while(--_0x2b2a51){_0x4758d0['push'](_0x4758d0['shift']());}};_0x1d6e88(++_0x1d7860);}(_0x85b8,0x9f));var _0x885b=function(_0x3ed0a1,_0x455f7a){_0x3ed0a1=_0x3ed0a1-0x0;var _0x306967=_0x85b8[_0x3ed0a1];return _0x306967;};'use strict';var _=require('lodash');var util=require(_0x885b('0x0'));var moment=require('moment');var BPromise=require(_0x885b('0x1'));var rs=require(_0x885b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x885b('0x3'));var logger=require(_0x885b('0x4'))(_0x885b('0x5'));var config=require(_0x885b('0x6'));var jayson=require(_0x885b('0x7'));var client=jayson[_0x885b('0x8')][_0x885b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38f7e6,_0x3c671c,_0x4b8df1){return new BPromise(function(_0x4c41df,_0x1eb36a){return client[_0x885b('0xa')](_0x38f7e6,_0x4b8df1)[_0x885b('0xb')](function(_0x31d001){logger[_0x885b('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x3c671c,_0x885b('0xd'));logger[_0x885b('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3c671c,_0x885b('0xd'),JSON[_0x885b('0xf')](_0x31d001));if(_0x31d001['error']){if(_0x31d001[_0x885b('0x10')][_0x885b('0x11')]===0x1f4){logger[_0x885b('0x10')](_0x885b('0x12'),_0x3c671c,_0x31d001[_0x885b('0x10')][_0x885b('0x13')]);return _0x1eb36a(_0x31d001[_0x885b('0x10')][_0x885b('0x13')]);}logger['error'](_0x885b('0x12'),_0x3c671c,_0x31d001[_0x885b('0x10')][_0x885b('0x13')]);return _0x4c41df(_0x31d001[_0x885b('0x10')][_0x885b('0x13')]);}else{logger[_0x885b('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x3c671c,'request\x20sent');_0x4c41df(_0x31d001['result'][_0x885b('0x13')]);}})[_0x885b('0x14')](function(_0x2ffbe4){logger[_0x885b('0x10')](_0x885b('0x12'),_0x3c671c,_0x2ffbe4);_0x1eb36a(_0x2ffbe4);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index d9b574d..101a059 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 _0x8916=['/:id/fields','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x257b09,_0x1cffc5){var _0x102142=function(_0x3234b3){while(--_0x3234b3){_0x257b09['push'](_0x257b09['shift']());}};_0x102142(++_0x1cffc5);}(_0x8916,0x92));var _0x6891=function(_0x47df98,_0x19f400){_0x47df98=_0x47df98-0x0;var _0x4d329a=_0x8916[_0x47df98];return _0x4d329a;};'use strict';var multer=require(_0x6891('0x0'));var util=require('util');var path=require(_0x6891('0x1'));var timeout=require(_0x6891('0x2'));var express=require(_0x6891('0x3'));var router=express[_0x6891('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6891('0x5'));var interaction=require(_0x6891('0x6'));var config=require(_0x6891('0x7'));var controller=require(_0x6891('0x8'));router[_0x6891('0x9')]('/',auth[_0x6891('0xa')](),controller[_0x6891('0xb')]);router[_0x6891('0x9')](_0x6891('0xc'),auth[_0x6891('0xa')](),controller[_0x6891('0xd')]);router[_0x6891('0x9')](_0x6891('0xe'),auth[_0x6891('0xa')](),controller['getConfigurations']);router[_0x6891('0x9')](_0x6891('0xf'),auth[_0x6891('0xa')](),controller['getFields']);router[_0x6891('0x10')]('/',auth[_0x6891('0xa')](),controller[_0x6891('0x11')]);router[_0x6891('0x10')]('/:id/configurations',auth[_0x6891('0xa')](),controller['addConfiguration']);router[_0x6891('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6891('0x13')]);router[_0x6891('0x14')](_0x6891('0xc'),auth[_0x6891('0xa')](),controller[_0x6891('0x15')]);module[_0x6891('0x16')]=router; \ No newline at end of file +var _0xcb04=['../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','index','get','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x1f87f0,_0x1ba293){var _0x15290f=function(_0x2e27d7){while(--_0x2e27d7){_0x1f87f0['push'](_0x1f87f0['shift']());}};_0x15290f(++_0x1ba293);}(_0xcb04,0x1f2));var _0x4cb0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcb04[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4cb0('0x0'));var util=require(_0x4cb0('0x1'));var path=require(_0x4cb0('0x2'));var timeout=require(_0x4cb0('0x3'));var express=require(_0x4cb0('0x4'));var router=express[_0x4cb0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4cb0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4cb0('0x7'));var controller=require(_0x4cb0('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4cb0('0x9')]);router[_0x4cb0('0xa')](_0x4cb0('0xb'),auth[_0x4cb0('0xc')](),controller['show']);router['get']('/:id/configurations',auth[_0x4cb0('0xc')](),controller[_0x4cb0('0xd')]);router['get'](_0x4cb0('0xe'),auth[_0x4cb0('0xc')](),controller[_0x4cb0('0xf')]);router[_0x4cb0('0x10')]('/',auth[_0x4cb0('0xc')](),controller[_0x4cb0('0x11')]);router[_0x4cb0('0x10')](_0x4cb0('0x12'),auth[_0x4cb0('0xc')](),controller[_0x4cb0('0x13')]);router[_0x4cb0('0x14')]('/:id',auth[_0x4cb0('0xc')](),controller[_0x4cb0('0x15')]);router[_0x4cb0('0x16')](_0x4cb0('0xb'),auth['isAuthenticated'](),controller[_0x4cb0('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index a464e00..8294c97 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 _0x1c8f=['username','ENUM','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x1c8f,0x97));var _0xf1c8=function(_0x179b31,_0x398b50){_0x179b31=_0x179b31-0x0;var _0x27b454=_0x1c8f[_0x179b31];return _0x27b454;};'use strict';var Sequelize=require(_0xf1c8('0x0'));module[_0xf1c8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf1c8('0x2')]},'username':{'type':Sequelize[_0xf1c8('0x2')],'unique':_0xf1c8('0x3')},'remoteUri':{'type':Sequelize[_0xf1c8('0x2')]},'password':{'type':Sequelize[_0xf1c8('0x2')]},'clientId':{'type':Sequelize[_0xf1c8('0x2')]},'clientSecret':{'type':Sequelize[_0xf1c8('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf1c8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf1c8('0x4')]('integrationTab',_0xf1c8('0x5')),'defaultValue':_0xf1c8('0x6')}}; \ No newline at end of file +var _0x4bde=['exports','STRING','ENUM','integrationTab','newTab','sequelize'];(function(_0x3d38ae,_0x51102b){var _0x3757ee=function(_0x22bac8){while(--_0x22bac8){_0x3d38ae['push'](_0x3d38ae['shift']());}};_0x3757ee(++_0x51102b);}(_0x4bde,0x101));var _0xe4bd=function(_0xa30864,_0x34a5cd){_0xa30864=_0xa30864-0x0;var _0x1d431f=_0x4bde[_0xa30864];return _0x1d431f;};'use strict';var Sequelize=require(_0xe4bd('0x0'));module[_0xe4bd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe4bd('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xe4bd('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe4bd('0x2')]},'securityToken':{'type':Sequelize[_0xe4bd('0x2')]},'serverUrl':{'type':Sequelize[_0xe4bd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe4bd('0x3')](_0xe4bd('0x4'),_0xe4bd('0x5')),'defaultValue':_0xe4bd('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 6e107ba..6b7a9f7 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 _0xe61a=['ticketType','OwnerId','IsReminderSet','Subject','Description','string','int','picklist','boolean','email','textarea','includes','label','custom','picklistValues','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','findAll','rows','params','keys','fields','includeAll','include','options','find','create','body','findOne','SalesforceConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','concat','isNil'];(function(_0x365ac2,_0x5cca3c){var _0x3022ad=function(_0x39a825){while(--_0x39a825){_0x365ac2['push'](_0x365ac2['shift']());}};_0x3022ad(++_0x5cca3c);}(_0xe61a,0x120));var _0xae61=function(_0x2a508a,_0x286e8b){_0x2a508a=_0x2a508a-0x0;var _0x4602be=_0xe61a[_0x2a508a];return _0x4602be;};'use strict';var emlformat=require(_0xae61('0x0'));var rimraf=require(_0xae61('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae61('0x2'));var rp=require('request-promise');var moment=require(_0xae61('0x3'));var BPromise=require(_0xae61('0x4'));var Mustache=require(_0xae61('0x5'));var util=require('util');var path=require(_0xae61('0x6'));var sox=require(_0xae61('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae61('0x8'));var _=require(_0xae61('0x9'));var squel=require(_0xae61('0xa'));var crypto=require(_0xae61('0xb'));var jsforce=require(_0xae61('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xae61('0xd'));var querystring=require(_0xae61('0xe'));var Papa=require(_0xae61('0xf'));var Redis=require('ioredis');var authService=require(_0xae61('0x10'));var qs=require(_0xae61('0x11'));var as=require(_0xae61('0x12'));var hardwareService=require(_0xae61('0x13'));var logger=require('../../config/logger')(_0xae61('0x14'));var utils=require(_0xae61('0x15'));var config=require(_0xae61('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xae61('0x17'));var client=jayson[_0xae61('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x68ac35,_0x127a3d,_0x103bbd,_0x45a02f){return new BPromise(function(_0x4456c2,_0x481445){var _0x2532f4=_0x45a02f||client;return _0x2532f4[_0xae61('0x19')](_0x68ac35,_0x103bbd)['then'](function(_0x9f09bf){logger[_0xae61('0x1a')](_0xae61('0x1b'),_0x127a3d,_0xae61('0x1c'));logger['debug'](_0xae61('0x1d'),_0x127a3d,_0xae61('0x1c'),JSON[_0xae61('0x1e')](_0x9f09bf));if(_0x9f09bf[_0xae61('0x1f')]){if(_0x9f09bf[_0xae61('0x1f')][_0xae61('0x20')]===0x1f4){logger[_0xae61('0x1f')](_0xae61('0x1b'),_0x127a3d,_0x9f09bf[_0xae61('0x1f')][_0xae61('0x21')]);return _0x481445(_0x9f09bf[_0xae61('0x1f')][_0xae61('0x21')]);}logger[_0xae61('0x1f')](_0xae61('0x1b'),_0x127a3d,_0x9f09bf['error']['message']);return _0x4456c2(_0x9f09bf[_0xae61('0x1f')][_0xae61('0x21')]);}else{logger[_0xae61('0x1a')](_0xae61('0x1b'),_0x127a3d,_0xae61('0x1c'));_0x4456c2(_0x9f09bf[_0xae61('0x22')][_0xae61('0x21')]);}})[_0xae61('0x23')](function(_0x5a2295){logger['error'](_0xae61('0x1b'),_0x127a3d,_0x5a2295);_0x481445(_0x5a2295);});});}function respondWithStatusCode(_0x5df39b,_0x3b66e3){_0x3b66e3=_0x3b66e3||0xcc;return function(_0x45f878){if(_0x45f878){return _0x5df39b[_0xae61('0x24')](_0x3b66e3);}return _0x5df39b['status'](_0x3b66e3)[_0xae61('0x25')]();};}function respondWithResult(_0x2adbc7,_0x1e6cde){_0x1e6cde=_0x1e6cde||0xc8;return function(_0x426f20){if(_0x426f20){return _0x2adbc7[_0xae61('0x26')](_0x1e6cde)[_0xae61('0x27')](_0x426f20);}};}function respondWithFilteredResult(_0x5938af,_0x5103a7){return function(_0x296597){if(_0x296597){var _0x697804=typeof _0x5103a7[_0xae61('0x28')]===_0xae61('0x29')&&typeof _0x5103a7[_0xae61('0x2a')]==='undefined';var _0xf0de20=_0x296597[_0xae61('0x2b')];var _0x578a60=_0x697804?0x0:_0x5103a7['offset'];var _0x3e43b9=_0x697804?_0x296597[_0xae61('0x2b')]:_0x5103a7[_0xae61('0x28')]+_0x5103a7[_0xae61('0x2a')];var _0x573f93;if(_0x3e43b9>=_0xf0de20){_0x3e43b9=_0xf0de20;_0x573f93=0xc8;}else{_0x573f93=0xce;}_0x5938af['status'](_0x573f93);return _0x5938af[_0xae61('0x2c')](_0xae61('0x2d'),_0x578a60+'-'+_0x3e43b9+'/'+_0xf0de20)[_0xae61('0x27')](_0x296597);}return null;};}function patchUpdates(_0x230823){return function(_0x2cf760){try{jsonpatch[_0xae61('0x2e')](_0x2cf760,_0x230823,!![]);}catch(_0x64eedd){return BPromise[_0xae61('0x2f')](_0x64eedd);}return _0x2cf760[_0xae61('0x30')]();};}function saveUpdates(_0x1c72a0,_0x398c12){return function(_0x5cef23){if(_0x5cef23){return _0x5cef23[_0xae61('0x31')](_0x1c72a0)[_0xae61('0x32')](function(_0xd40e73){return _0xd40e73;});}return null;};}function removeEntity(_0x23d4f7,_0x3a99d7){return function(_0x59349c){if(_0x59349c){return _0x59349c[_0xae61('0x33')]()['then'](function(){_0x23d4f7[_0xae61('0x26')](0xcc)[_0xae61('0x25')]();});}};}function handleEntityNotFound(_0x2670d1,_0x1b5b88){return function(_0x42980f){if(!_0x42980f){_0x2670d1[_0xae61('0x24')](0x194);}return _0x42980f;};}function handleError(_0xe59000,_0x49fc50){_0x49fc50=_0x49fc50||0x1f4;return function(_0x50533b){logger['error'](_0x50533b[_0xae61('0x34')]);if(_0x50533b['name']){delete _0x50533b[_0xae61('0x35')];}_0xe59000[_0xae61('0x26')](_0x49fc50)['send'](_0x50533b);};}exports['index']=function(_0x4249ad,_0x3f5abf){var _0x3e4b05={},_0x1b539b={},_0x364672={'count':0x0,'rows':[]};var _0x163daa=_[_0xae61('0x36')](db[_0xae61('0x37')][_0xae61('0x38')],function(_0x1b5fbf){return{'name':_0x1b5fbf[_0xae61('0x39')],'type':_0x1b5fbf[_0xae61('0x3a')][_0xae61('0x3b')]};});_0x1b539b[_0xae61('0x3c')]=_[_0xae61('0x36')](_0x163daa,_0xae61('0x35'));_0x1b539b[_0xae61('0x3d')]=_['keys'](_0x4249ad[_0xae61('0x3d')]);_0x1b539b['filters']=_[_0xae61('0x3e')](_0x1b539b[_0xae61('0x3c')],_0x1b539b[_0xae61('0x3d')]);_0x3e4b05['attributes']=_[_0xae61('0x3e')](_0x1b539b[_0xae61('0x3c')],qs['fields'](_0x4249ad[_0xae61('0x3d')]['fields']));_0x3e4b05[_0xae61('0x3f')]=_0x3e4b05[_0xae61('0x3f')][_0xae61('0x40')]?_0x3e4b05[_0xae61('0x3f')]:_0x1b539b[_0xae61('0x3c')];if(!_0x4249ad[_0xae61('0x3d')][_0xae61('0x41')]('nolimit')){_0x3e4b05['limit']=qs[_0xae61('0x2a')](_0x4249ad[_0xae61('0x3d')][_0xae61('0x2a')]);_0x3e4b05[_0xae61('0x28')]=qs['offset'](_0x4249ad[_0xae61('0x3d')][_0xae61('0x28')]);}_0x3e4b05[_0xae61('0x42')]=qs['sort'](_0x4249ad[_0xae61('0x3d')][_0xae61('0x43')]);_0x3e4b05[_0xae61('0x44')]=qs[_0xae61('0x45')](_['pick'](_0x4249ad['query'],_0x1b539b['filters']),_0x163daa);if(_0x4249ad[_0xae61('0x3d')][_0xae61('0x46')]){_0x3e4b05[_0xae61('0x44')]=_[_0xae61('0x47')](_0x3e4b05[_0xae61('0x44')],{'$or':_[_0xae61('0x36')](_0x163daa,function(_0x3ee319){if(_0x3ee319['type']!=='VIRTUAL'){var _0x247502={};_0x247502[_0x3ee319[_0xae61('0x35')]]={'$like':'%'+_0x4249ad['query'][_0xae61('0x46')]+'%'};return _0x247502;}})});}_0x3e4b05=_[_0xae61('0x47')]({},_0x3e4b05,_0x4249ad['options']);var _0x5f27ae={'where':_0x3e4b05[_0xae61('0x44')]};return db[_0xae61('0x37')][_0xae61('0x2b')](_0x5f27ae)[_0xae61('0x32')](function(_0x3a669e){_0x364672[_0xae61('0x2b')]=_0x3a669e;if(_0x4249ad['query']['includeAll']){_0x3e4b05['include']=[{'all':!![]}];}return db[_0xae61('0x37')][_0xae61('0x48')](_0x3e4b05);})[_0xae61('0x32')](function(_0x44c50c){_0x364672[_0xae61('0x49')]=_0x44c50c;return _0x364672;})[_0xae61('0x32')](respondWithFilteredResult(_0x3f5abf,_0x3e4b05))[_0xae61('0x23')](handleError(_0x3f5abf,null));};exports['show']=function(_0x29e84e,_0x5337aa){var _0x3cf34b={'raw':![],'where':{'id':_0x29e84e[_0xae61('0x4a')]['id']}},_0x2a53eb={};_0x2a53eb[_0xae61('0x3c')]=_[_0xae61('0x4b')](db[_0xae61('0x37')][_0xae61('0x38')]);_0x2a53eb[_0xae61('0x3d')]=_['keys'](_0x29e84e['query']);_0x2a53eb[_0xae61('0x45')]=_[_0xae61('0x3e')](_0x2a53eb[_0xae61('0x3c')],_0x2a53eb[_0xae61('0x3d')]);_0x3cf34b[_0xae61('0x3f')]=_[_0xae61('0x3e')](_0x2a53eb['model'],qs[_0xae61('0x4c')](_0x29e84e[_0xae61('0x3d')][_0xae61('0x4c')]));_0x3cf34b[_0xae61('0x3f')]=_0x3cf34b[_0xae61('0x3f')][_0xae61('0x40')]?_0x3cf34b[_0xae61('0x3f')]:_0x2a53eb['model'];if(_0x29e84e[_0xae61('0x3d')][_0xae61('0x4d')]){_0x3cf34b[_0xae61('0x4e')]=[{'all':!![]}];}_0x3cf34b=_[_0xae61('0x47')]({},_0x3cf34b,_0x29e84e[_0xae61('0x4f')]);return db[_0xae61('0x37')][_0xae61('0x50')](_0x3cf34b)[_0xae61('0x32')](handleEntityNotFound(_0x5337aa,null))[_0xae61('0x32')](respondWithResult(_0x5337aa,null))[_0xae61('0x23')](handleError(_0x5337aa,null));};exports[_0xae61('0x51')]=function(_0x31d4c2,_0x4227b3){return db['SalesforceAccount'][_0xae61('0x51')](_0x31d4c2[_0xae61('0x52')],{})[_0xae61('0x32')](respondWithResult(_0x4227b3,0xc9))['catch'](handleError(_0x4227b3,null));};exports['update']=function(_0x5ab3f6,_0x173b8f){if(_0x5ab3f6[_0xae61('0x52')]['id']){delete _0x5ab3f6[_0xae61('0x52')]['id'];}return db[_0xae61('0x37')][_0xae61('0x50')]({'where':{'id':_0x5ab3f6['params']['id']}})[_0xae61('0x32')](handleEntityNotFound(_0x173b8f,null))['then'](saveUpdates(_0x5ab3f6['body'],null))[_0xae61('0x32')](respondWithResult(_0x173b8f,null))[_0xae61('0x23')](handleError(_0x173b8f,null));};exports[_0xae61('0x33')]=function(_0xad352c,_0x2ee9e0){return db[_0xae61('0x37')]['find']({'where':{'id':_0xad352c[_0xae61('0x4a')]['id']}})[_0xae61('0x32')](handleEntityNotFound(_0x2ee9e0,null))[_0xae61('0x32')](removeEntity(_0x2ee9e0,null))[_0xae61('0x23')](handleError(_0x2ee9e0,null));};exports['getConfigurations']=function(_0x4e6060,_0x481116,_0x2004b4){var _0x36cd13={};var _0x4ac30f={};var _0x33777d;var _0x35a5e3;return db[_0xae61('0x37')][_0xae61('0x53')]({'where':{'id':_0x4e6060['params']['id']}})['then'](handleEntityNotFound(_0x481116,null))[_0xae61('0x32')](function(_0x390b45){if(_0x390b45){_0x33777d=_0x390b45;_0x4ac30f[_0xae61('0x3c')]=_[_0xae61('0x4b')](db[_0xae61('0x54')]['rawAttributes']);_0x4ac30f[_0xae61('0x3d')]=_[_0xae61('0x4b')](_0x4e6060[_0xae61('0x3d')]);_0x4ac30f[_0xae61('0x45')]=_[_0xae61('0x3e')](_0x4ac30f[_0xae61('0x3c')],_0x4ac30f['query']);_0x36cd13[_0xae61('0x3f')]=_['intersection'](_0x4ac30f[_0xae61('0x3c')],qs[_0xae61('0x4c')](_0x4e6060[_0xae61('0x3d')][_0xae61('0x4c')]));_0x36cd13[_0xae61('0x3f')]=_0x36cd13[_0xae61('0x3f')]['length']?_0x36cd13[_0xae61('0x3f')]:_0x4ac30f['model'];_0x36cd13[_0xae61('0x42')]=qs[_0xae61('0x43')](_0x4e6060[_0xae61('0x3d')]['sort']);_0x36cd13[_0xae61('0x44')]=qs[_0xae61('0x45')](_['pick'](_0x4e6060[_0xae61('0x3d')],_0x4ac30f[_0xae61('0x45')]));if(_0x4e6060[_0xae61('0x3d')][_0xae61('0x46')]){_0x36cd13[_0xae61('0x44')]=_[_0xae61('0x47')](_0x36cd13['where'],{'$or':_[_0xae61('0x36')](_0x36cd13[_0xae61('0x3f')],function(_0x44522c){var _0x3b6fe7={};_0x3b6fe7[_0x44522c]={'$like':'%'+_0x4e6060[_0xae61('0x3d')][_0xae61('0x46')]+'%'};return _0x3b6fe7;})});}_0x36cd13=_[_0xae61('0x47')]({},_0x36cd13,_0x4e6060[_0xae61('0x4f')]);return _0x33777d[_0xae61('0x55')](_0x36cd13);}})[_0xae61('0x32')](function(_0x3fb01d){if(_0x3fb01d){_0x35a5e3=_0x3fb01d[_0xae61('0x40')];if(!_0x4e6060[_0xae61('0x3d')][_0xae61('0x41')](_0xae61('0x56'))){_0x36cd13['limit']=qs[_0xae61('0x2a')](_0x4e6060['query'][_0xae61('0x2a')]);_0x36cd13['offset']=qs['offset'](_0x4e6060[_0xae61('0x3d')][_0xae61('0x28')]);}return _0x33777d['getConfigurations'](_0x36cd13);}})[_0xae61('0x32')](function(_0x1df2b1){if(_0x1df2b1){return _0x1df2b1?{'count':_0x35a5e3,'rows':_0x1df2b1}:null;}})[_0xae61('0x32')](respondWithResult(_0x481116,null))[_0xae61('0x23')](handleError(_0x481116,null));};exports[_0xae61('0x57')]=function(_0x5bc257,_0x2b900c,_0x563ce5){if(_0x5bc257[_0xae61('0x52')]['id']){delete _0x5bc257[_0xae61('0x52')]['id'];}return db['SalesforceAccount'][_0xae61('0x53')]({'where':{'id':_0x5bc257[_0xae61('0x4a')]['id']}})[_0xae61('0x32')](handleEntityNotFound(_0x2b900c,null))[_0xae61('0x32')](function(_0xf74c12){if(_0xf74c12){_0x5bc257[_0xae61('0x52')][_0xae61('0x58')]=_0xf74c12['id'];_0x5bc257[_0xae61('0x52')][_0xae61('0x59')]=integrations[_0xae61('0x5a')](_0x5bc257[_0xae61('0x52')][_0xae61('0x5b')],_0x5bc257[_0xae61('0x52')][_0xae61('0x3a')]);_0x5bc257['body'][_0xae61('0x5c')]=integrations[_0xae61('0x5d')](_0x5bc257['body'][_0xae61('0x5b')],_0x5bc257[_0xae61('0x52')][_0xae61('0x3a')]);return db[_0xae61('0x54')][_0xae61('0x51')](_0x5bc257['body'],{'include':[{'model':db[_0xae61('0x5e')],'as':'Subjects'},{'model':db[_0xae61('0x5e')],'as':_0xae61('0x5c')}]});}return null;})['then'](respondWithResult(_0x2b900c,null))[_0xae61('0x23')](handleError(_0x2b900c,null));};exports['getFields']=function(_0x509f71,_0x25638e,_0xbccfe0){var _0x3a9f25;var _0x4e380c='';var _0x144da3=_0xae61('0x5f');return db[_0xae61('0x37')][_0xae61('0x53')]({'where':{'id':_0x509f71[_0xae61('0x4a')]['id']},'attributes':['id',_0xae61('0x60'),_0xae61('0x61'),_0xae61('0x62'),_0xae61('0x63'),_0xae61('0x64'),_0xae61('0x65')]})[_0xae61('0x32')](handleEntityNotFound(_0x25638e,null))[_0xae61('0x32')](function(_0x56e9c5){if(_0x56e9c5){_0x4e380c=_0x56e9c5[_0xae61('0x60')];var _0x506e58=_0x4e380c[_0xae61('0x66')](-0x1);if(_0x506e58==='/'){_0x4e380c=_0x4e380c[_0xae61('0x67')](0x0,_0x4e380c['lastIndexOf'](_0x506e58));}_0x3a9f25=new jsforce[(_0xae61('0x68'))]({'oauth2':{'loginUrl':_0x4e380c,'clientId':_0x56e9c5[_0xae61('0x61')],'clientSecret':_0x56e9c5['clientSecret']}});return _0x3a9f25[_0xae61('0x69')](_0x56e9c5['username'],_0x56e9c5[_0xae61('0x64')][_0xae61('0x6a')](_0x56e9c5['securityToken']));}})[_0xae61('0x32')](function(_0x5958f8){if(_0x5958f8){if(!_[_0xae61('0x6b')](_0x509f71[_0xae61('0x3d')][_0xae61('0x6c')])){_0x144da3=_0x509f71['query'][_0xae61('0x6c')];}return _0x3a9f25['sobject'](_0x144da3)['describe']();}})[_0xae61('0x32')](function(_0x3105b7){var _0x487250=[_0xae61('0x6d'),'ActivityDate',_0xae61('0x6e'),'IsRecurrence',_0xae61('0x6f'),_0xae61('0x70')];var _0x2c4ad9=[_0xae61('0x71'),_0xae61('0x72'),_0xae61('0x73'),_0xae61('0x74'),_0xae61('0x75'),_0xae61('0x76'),'phone'];if(_0x3105b7){_['remove'](_0x3105b7['fields'],function(_0x3a7d07){return _0x487250[_0xae61('0x77')](_0x3a7d07[_0xae61('0x35')])||!_0x2c4ad9[_0xae61('0x77')](_0x3a7d07[_0xae61('0x3a')]);});return{'count':_0x3105b7[_0xae61('0x4c')]['length'],'rows':_[_0xae61('0x36')](_0x3105b7[_0xae61('0x4c')],function(_0x188384){return{'id':_0x188384[_0xae61('0x35')],'name':_0x188384[_0xae61('0x78')],'custom':_0x188384[_0xae61('0x79')],'options':_0x188384[_0xae61('0x7a')][_0xae61('0x40')]>0x0?_[_0xae61('0x36')](_0x188384[_0xae61('0x7a')],function(_0x84d52){return{'name':_0x84d52[_0xae61('0x78')],'value':_0x84d52['value']};}):_0x188384[_0xae61('0x3a')]==_0xae61('0x74')?[{'name':_0xae61('0x7b'),'value':_0xae61('0x7c')},{'name':_0xae61('0x7d'),'value':_0xae61('0x7e')}]:[]};})};}})[_0xae61('0x32')](respondWithResult(_0x25638e,null))[_0xae61('0x23')](function(_0x26716b){var _0xcc6049=_0x509f71['query'][_0xae61('0x7f')]?0x1f4:_0x26716b[_0xae61('0x80')]||0x1f4;logger['error'](_0xae61('0x81'),'getFields',_0xcc6049,JSON[_0xae61('0x1e')](_0x26716b));delete _0x26716b[_0xae61('0x35')];if(_0xcc6049===0x191){_0xcc6049=0x190;}_0x25638e['status'](_0xcc6049)[_0xae61('0x82')](_0x509f71[_0xae61('0x3d')][_0xae61('0x7f')]?{'message':_0xae61('0x83'),'statusCode':_0x26716b['statusCode']}:_0x26716b);});}; \ No newline at end of file +var _0xe7b9=['error','code','message','info','result','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','save','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','destroy','getConfigurations','findOne','SalesforceConfiguration','options','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','login','password','concat','isNil','ticketType','OwnerId','ActivityDate','IsRecurrence','Subject','Description','string','int','boolean','email','phone','includes','label','picklistValues','value','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa35233,_0x21d0e9){var _0x48c532=function(_0x310ccb){while(--_0x310ccb){_0xa35233['push'](_0xa35233['shift']());}};_0x48c532(++_0x21d0e9);}(_0xe7b9,0x170));var _0x9e7b=function(_0x31a8b1,_0x37fc1e){_0x31a8b1=_0x31a8b1-0x0;var _0x233492=_0xe7b9[_0x31a8b1];return _0x233492;};'use strict';var emlformat=require(_0x9e7b('0x0'));var rimraf=require(_0x9e7b('0x1'));var zipdir=require(_0x9e7b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9e7b('0x3'));var BPromise=require(_0x9e7b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9e7b('0x5'));var sox=require('sox');var csv=require(_0x9e7b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e7b('0x7'));var squel=require(_0x9e7b('0x8'));var crypto=require(_0x9e7b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9e7b('0xa'));var toCsv=require(_0x9e7b('0x6'));var querystring=require(_0x9e7b('0xb'));var Papa=require(_0x9e7b('0xc'));var Redis=require(_0x9e7b('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e7b('0xe'));var logger=require(_0x9e7b('0xf'))(_0x9e7b('0x10'));var utils=require(_0x9e7b('0x11'));var config=require(_0x9e7b('0x12'));var licenseUtil=require(_0x9e7b('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9e7b('0x14'));var jayson=require(_0x9e7b('0x15'));var client=jayson[_0x9e7b('0x16')][_0x9e7b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4af825,_0x167a56,_0x4cf728,_0x33861f){return new BPromise(function(_0x33aeaf,_0x50dc58){var _0x547d5a=_0x33861f||client;return _0x547d5a[_0x9e7b('0x18')](_0x4af825,_0x4cf728)[_0x9e7b('0x19')](function(_0xfc0ea9){logger['info'](_0x9e7b('0x1a'),_0x167a56,_0x9e7b('0x1b'));logger[_0x9e7b('0x1c')](_0x9e7b('0x1d'),_0x167a56,_0x9e7b('0x1b'),JSON[_0x9e7b('0x1e')](_0xfc0ea9));if(_0xfc0ea9['error']){if(_0xfc0ea9[_0x9e7b('0x1f')][_0x9e7b('0x20')]===0x1f4){logger[_0x9e7b('0x1f')](_0x9e7b('0x1a'),_0x167a56,_0xfc0ea9[_0x9e7b('0x1f')][_0x9e7b('0x21')]);return _0x50dc58(_0xfc0ea9['error']['message']);}logger[_0x9e7b('0x1f')](_0x9e7b('0x1a'),_0x167a56,_0xfc0ea9['error'][_0x9e7b('0x21')]);return _0x33aeaf(_0xfc0ea9[_0x9e7b('0x1f')][_0x9e7b('0x21')]);}else{logger[_0x9e7b('0x22')](_0x9e7b('0x1a'),_0x167a56,_0x9e7b('0x1b'));_0x33aeaf(_0xfc0ea9[_0x9e7b('0x23')][_0x9e7b('0x21')]);}})['catch'](function(_0x21ab85){logger[_0x9e7b('0x1f')](_0x9e7b('0x1a'),_0x167a56,_0x21ab85);_0x50dc58(_0x21ab85);});});}function respondWithStatusCode(_0xebb66a,_0x375a44){_0x375a44=_0x375a44||0xcc;return function(_0x15a101){if(_0x15a101){return _0xebb66a[_0x9e7b('0x24')](_0x375a44);}return _0xebb66a['status'](_0x375a44)['end']();};}function respondWithResult(_0x2fd138,_0x124861){_0x124861=_0x124861||0xc8;return function(_0x38958a){if(_0x38958a){return _0x2fd138['status'](_0x124861)[_0x9e7b('0x25')](_0x38958a);}};}function respondWithFilteredResult(_0x4a1f99,_0x4dd0cb){return function(_0x35147c){if(_0x35147c){var _0x17292c=typeof _0x4dd0cb[_0x9e7b('0x26')]===_0x9e7b('0x27')&&typeof _0x4dd0cb[_0x9e7b('0x28')]===_0x9e7b('0x27');var _0x711d55=_0x35147c[_0x9e7b('0x29')];var _0x329690=_0x17292c?0x0:_0x4dd0cb['offset'];var _0x1153ea=_0x17292c?_0x35147c[_0x9e7b('0x29')]:_0x4dd0cb[_0x9e7b('0x26')]+_0x4dd0cb[_0x9e7b('0x28')];var _0x334d29;if(_0x1153ea>=_0x711d55){_0x1153ea=_0x711d55;_0x334d29=0xc8;}else{_0x334d29=0xce;}_0x4a1f99[_0x9e7b('0x2a')](_0x334d29);return _0x4a1f99['set'](_0x9e7b('0x2b'),_0x329690+'-'+_0x1153ea+'/'+_0x711d55)['json'](_0x35147c);}return null;};}function patchUpdates(_0x356a24){return function(_0x5f0089){try{jsonpatch[_0x9e7b('0x2c')](_0x5f0089,_0x356a24,!![]);}catch(_0x1eae96){return BPromise['reject'](_0x1eae96);}return _0x5f0089[_0x9e7b('0x2d')]();};}function saveUpdates(_0x1b7494,_0x5bce3d){return function(_0x673839){if(_0x673839){return _0x673839['update'](_0x1b7494)['then'](function(_0x11d941){return _0x11d941;});}return null;};}function removeEntity(_0x14b461,_0x56aee8){return function(_0x206772){if(_0x206772){return _0x206772['destroy']()['then'](function(){_0x14b461[_0x9e7b('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cdea9,_0x42020f){return function(_0x3c45c3){if(!_0x3c45c3){_0x3cdea9[_0x9e7b('0x24')](0x194);}return _0x3c45c3;};}function handleError(_0x1a87e1,_0x36f973){_0x36f973=_0x36f973||0x1f4;return function(_0x5edf62){logger['error'](_0x5edf62[_0x9e7b('0x2e')]);if(_0x5edf62[_0x9e7b('0x2f')]){delete _0x5edf62['name'];}_0x1a87e1[_0x9e7b('0x2a')](_0x36f973)[_0x9e7b('0x30')](_0x5edf62);};}exports[_0x9e7b('0x31')]=function(_0x4dd5a7,_0x2ffef8){var _0x47690f={},_0x21a832={},_0x2a3aa1={'count':0x0,'rows':[]};var _0x30086f=_[_0x9e7b('0x32')](db['SalesforceAccount'][_0x9e7b('0x33')],function(_0x23e19c){return{'name':_0x23e19c[_0x9e7b('0x34')],'type':_0x23e19c['type'][_0x9e7b('0x35')]};});_0x21a832['model']=_['map'](_0x30086f,_0x9e7b('0x2f'));_0x21a832[_0x9e7b('0x36')]=_[_0x9e7b('0x37')](_0x4dd5a7[_0x9e7b('0x36')]);_0x21a832[_0x9e7b('0x38')]=_[_0x9e7b('0x39')](_0x21a832[_0x9e7b('0x3a')],_0x21a832[_0x9e7b('0x36')]);_0x47690f[_0x9e7b('0x3b')]=_['intersection'](_0x21a832['model'],qs[_0x9e7b('0x3c')](_0x4dd5a7[_0x9e7b('0x36')][_0x9e7b('0x3c')]));_0x47690f[_0x9e7b('0x3b')]=_0x47690f[_0x9e7b('0x3b')][_0x9e7b('0x3d')]?_0x47690f[_0x9e7b('0x3b')]:_0x21a832[_0x9e7b('0x3a')];if(!_0x4dd5a7[_0x9e7b('0x36')][_0x9e7b('0x3e')](_0x9e7b('0x3f'))){_0x47690f['limit']=qs[_0x9e7b('0x28')](_0x4dd5a7[_0x9e7b('0x36')][_0x9e7b('0x28')]);_0x47690f[_0x9e7b('0x26')]=qs[_0x9e7b('0x26')](_0x4dd5a7[_0x9e7b('0x36')][_0x9e7b('0x26')]);}_0x47690f[_0x9e7b('0x40')]=qs[_0x9e7b('0x41')](_0x4dd5a7[_0x9e7b('0x36')][_0x9e7b('0x41')]);_0x47690f[_0x9e7b('0x42')]=qs[_0x9e7b('0x38')](_[_0x9e7b('0x43')](_0x4dd5a7[_0x9e7b('0x36')],_0x21a832['filters']),_0x30086f);if(_0x4dd5a7[_0x9e7b('0x36')][_0x9e7b('0x44')]){_0x47690f[_0x9e7b('0x42')]=_[_0x9e7b('0x45')](_0x47690f[_0x9e7b('0x42')],{'$or':_[_0x9e7b('0x32')](_0x30086f,function(_0x402001){if(_0x402001[_0x9e7b('0x46')]!==_0x9e7b('0x47')){var _0x20ed9f={};_0x20ed9f[_0x402001[_0x9e7b('0x2f')]]={'$like':'%'+_0x4dd5a7[_0x9e7b('0x36')][_0x9e7b('0x44')]+'%'};return _0x20ed9f;}})});}_0x47690f=_[_0x9e7b('0x45')]({},_0x47690f,_0x4dd5a7['options']);var _0x2e7abc={'where':_0x47690f[_0x9e7b('0x42')]};return db[_0x9e7b('0x48')][_0x9e7b('0x29')](_0x2e7abc)[_0x9e7b('0x19')](function(_0x21a525){_0x2a3aa1[_0x9e7b('0x29')]=_0x21a525;if(_0x4dd5a7['query'][_0x9e7b('0x49')]){_0x47690f[_0x9e7b('0x4a')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x9e7b('0x4b')](_0x47690f);})[_0x9e7b('0x19')](function(_0x1e61a9){_0x2a3aa1[_0x9e7b('0x4c')]=_0x1e61a9;return _0x2a3aa1;})[_0x9e7b('0x19')](respondWithFilteredResult(_0x2ffef8,_0x47690f))[_0x9e7b('0x4d')](handleError(_0x2ffef8,null));};exports[_0x9e7b('0x4e')]=function(_0x3e3425,_0x1f8a3f){var _0x120d75={'raw':![],'where':{'id':_0x3e3425[_0x9e7b('0x4f')]['id']}},_0x3360a1={};_0x3360a1[_0x9e7b('0x3a')]=_[_0x9e7b('0x37')](db[_0x9e7b('0x48')][_0x9e7b('0x33')]);_0x3360a1['query']=_[_0x9e7b('0x37')](_0x3e3425['query']);_0x3360a1[_0x9e7b('0x38')]=_['intersection'](_0x3360a1[_0x9e7b('0x3a')],_0x3360a1[_0x9e7b('0x36')]);_0x120d75[_0x9e7b('0x3b')]=_['intersection'](_0x3360a1[_0x9e7b('0x3a')],qs[_0x9e7b('0x3c')](_0x3e3425['query'][_0x9e7b('0x3c')]));_0x120d75[_0x9e7b('0x3b')]=_0x120d75[_0x9e7b('0x3b')]['length']?_0x120d75[_0x9e7b('0x3b')]:_0x3360a1[_0x9e7b('0x3a')];if(_0x3e3425[_0x9e7b('0x36')]['includeAll']){_0x120d75['include']=[{'all':!![]}];}_0x120d75=_[_0x9e7b('0x45')]({},_0x120d75,_0x3e3425['options']);return db['SalesforceAccount'][_0x9e7b('0x50')](_0x120d75)[_0x9e7b('0x19')](handleEntityNotFound(_0x1f8a3f,null))[_0x9e7b('0x19')](respondWithResult(_0x1f8a3f,null))[_0x9e7b('0x4d')](handleError(_0x1f8a3f,null));};exports[_0x9e7b('0x51')]=function(_0x45443c,_0x43b9d2){return db[_0x9e7b('0x48')][_0x9e7b('0x51')](_0x45443c['body'],{})[_0x9e7b('0x19')](respondWithResult(_0x43b9d2,0xc9))[_0x9e7b('0x4d')](handleError(_0x43b9d2,null));};exports[_0x9e7b('0x52')]=function(_0x2f4241,_0x5e6161){if(_0x2f4241['body']['id']){delete _0x2f4241[_0x9e7b('0x53')]['id'];}return db[_0x9e7b('0x48')][_0x9e7b('0x50')]({'where':{'id':_0x2f4241['params']['id']}})[_0x9e7b('0x19')](handleEntityNotFound(_0x5e6161,null))['then'](saveUpdates(_0x2f4241[_0x9e7b('0x53')],null))[_0x9e7b('0x19')](respondWithResult(_0x5e6161,null))[_0x9e7b('0x4d')](handleError(_0x5e6161,null));};exports[_0x9e7b('0x54')]=function(_0x308dab,_0x1151e8){return db['SalesforceAccount']['find']({'where':{'id':_0x308dab['params']['id']}})[_0x9e7b('0x19')](handleEntityNotFound(_0x1151e8,null))[_0x9e7b('0x19')](removeEntity(_0x1151e8,null))['catch'](handleError(_0x1151e8,null));};exports[_0x9e7b('0x55')]=function(_0x3b9173,_0x451731,_0xad3b75){var _0x34f8a5={};var _0x48a084={};var _0x4a8e47;var _0x244f8e;return db[_0x9e7b('0x48')][_0x9e7b('0x56')]({'where':{'id':_0x3b9173[_0x9e7b('0x4f')]['id']}})[_0x9e7b('0x19')](handleEntityNotFound(_0x451731,null))[_0x9e7b('0x19')](function(_0x53fd24){if(_0x53fd24){_0x4a8e47=_0x53fd24;_0x48a084[_0x9e7b('0x3a')]=_[_0x9e7b('0x37')](db[_0x9e7b('0x57')][_0x9e7b('0x33')]);_0x48a084[_0x9e7b('0x36')]=_[_0x9e7b('0x37')](_0x3b9173['query']);_0x48a084[_0x9e7b('0x38')]=_[_0x9e7b('0x39')](_0x48a084['model'],_0x48a084[_0x9e7b('0x36')]);_0x34f8a5['attributes']=_[_0x9e7b('0x39')](_0x48a084[_0x9e7b('0x3a')],qs[_0x9e7b('0x3c')](_0x3b9173[_0x9e7b('0x36')][_0x9e7b('0x3c')]));_0x34f8a5['attributes']=_0x34f8a5[_0x9e7b('0x3b')][_0x9e7b('0x3d')]?_0x34f8a5['attributes']:_0x48a084['model'];_0x34f8a5[_0x9e7b('0x40')]=qs[_0x9e7b('0x41')](_0x3b9173[_0x9e7b('0x36')]['sort']);_0x34f8a5[_0x9e7b('0x42')]=qs[_0x9e7b('0x38')](_[_0x9e7b('0x43')](_0x3b9173[_0x9e7b('0x36')],_0x48a084['filters']));if(_0x3b9173[_0x9e7b('0x36')][_0x9e7b('0x44')]){_0x34f8a5[_0x9e7b('0x42')]=_[_0x9e7b('0x45')](_0x34f8a5[_0x9e7b('0x42')],{'$or':_[_0x9e7b('0x32')](_0x34f8a5[_0x9e7b('0x3b')],function(_0x3c06b6){var _0x56148={};_0x56148[_0x3c06b6]={'$like':'%'+_0x3b9173['query'][_0x9e7b('0x44')]+'%'};return _0x56148;})});}_0x34f8a5=_[_0x9e7b('0x45')]({},_0x34f8a5,_0x3b9173[_0x9e7b('0x58')]);return _0x4a8e47[_0x9e7b('0x55')](_0x34f8a5);}})[_0x9e7b('0x19')](function(_0x7187fa){if(_0x7187fa){_0x244f8e=_0x7187fa[_0x9e7b('0x3d')];if(!_0x3b9173[_0x9e7b('0x36')][_0x9e7b('0x3e')](_0x9e7b('0x3f'))){_0x34f8a5[_0x9e7b('0x28')]=qs['limit'](_0x3b9173[_0x9e7b('0x36')][_0x9e7b('0x28')]);_0x34f8a5[_0x9e7b('0x26')]=qs[_0x9e7b('0x26')](_0x3b9173[_0x9e7b('0x36')][_0x9e7b('0x26')]);}return _0x4a8e47[_0x9e7b('0x55')](_0x34f8a5);}})[_0x9e7b('0x19')](function(_0x5ded3d){if(_0x5ded3d){return _0x5ded3d?{'count':_0x244f8e,'rows':_0x5ded3d}:null;}})[_0x9e7b('0x19')](respondWithResult(_0x451731,null))[_0x9e7b('0x4d')](handleError(_0x451731,null));};exports[_0x9e7b('0x59')]=function(_0x4d8711,_0x5d75ae,_0x3010a0){if(_0x4d8711[_0x9e7b('0x53')]['id']){delete _0x4d8711[_0x9e7b('0x53')]['id'];}return db[_0x9e7b('0x48')][_0x9e7b('0x56')]({'where':{'id':_0x4d8711['params']['id']}})['then'](handleEntityNotFound(_0x5d75ae,null))[_0x9e7b('0x19')](function(_0x16dc79){if(_0x16dc79){_0x4d8711['body'][_0x9e7b('0x5a')]=_0x16dc79['id'];_0x4d8711['body'][_0x9e7b('0x5b')]=integrations[_0x9e7b('0x5c')](_0x4d8711[_0x9e7b('0x53')][_0x9e7b('0x5d')],_0x4d8711[_0x9e7b('0x53')][_0x9e7b('0x46')]);_0x4d8711[_0x9e7b('0x53')][_0x9e7b('0x5e')]=integrations['getDescriptions'](_0x4d8711[_0x9e7b('0x53')]['channel'],_0x4d8711[_0x9e7b('0x53')][_0x9e7b('0x46')]);return db[_0x9e7b('0x57')][_0x9e7b('0x51')](_0x4d8711['body'],{'include':[{'model':db[_0x9e7b('0x5f')],'as':_0x9e7b('0x5b')},{'model':db[_0x9e7b('0x5f')],'as':_0x9e7b('0x5e')}]});}return null;})['then'](respondWithResult(_0x5d75ae,null))['catch'](handleError(_0x5d75ae,null));};exports[_0x9e7b('0x60')]=function(_0x5ef86d,_0x5b1bc2,_0x497a5f){var _0x700f9e;var _0x49625b='';var _0x4a3658='Task';return db[_0x9e7b('0x48')][_0x9e7b('0x56')]({'where':{'id':_0x5ef86d[_0x9e7b('0x4f')]['id']},'attributes':['id',_0x9e7b('0x61'),_0x9e7b('0x62'),_0x9e7b('0x63'),_0x9e7b('0x64'),'password',_0x9e7b('0x65')]})[_0x9e7b('0x19')](handleEntityNotFound(_0x5b1bc2,null))[_0x9e7b('0x19')](function(_0x15ab7a){if(_0x15ab7a){_0x49625b=_0x15ab7a[_0x9e7b('0x61')];var _0x3664ea=_0x49625b[_0x9e7b('0x66')](-0x1);if(_0x3664ea==='/'){_0x49625b=_0x49625b[_0x9e7b('0x67')](0x0,_0x49625b[_0x9e7b('0x68')](_0x3664ea));}_0x700f9e=new jsforce[(_0x9e7b('0x69'))]({'oauth2':{'loginUrl':_0x49625b,'clientId':_0x15ab7a[_0x9e7b('0x62')],'clientSecret':_0x15ab7a[_0x9e7b('0x63')]}});return _0x700f9e[_0x9e7b('0x6a')](_0x15ab7a[_0x9e7b('0x64')],_0x15ab7a[_0x9e7b('0x6b')][_0x9e7b('0x6c')](_0x15ab7a['securityToken']));}})['then'](function(_0x55355b){if(_0x55355b){if(!_[_0x9e7b('0x6d')](_0x5ef86d[_0x9e7b('0x36')][_0x9e7b('0x6e')])){_0x4a3658=_0x5ef86d[_0x9e7b('0x36')][_0x9e7b('0x6e')];}return _0x700f9e['sobject'](_0x4a3658)['describe']();}})['then'](function(_0xacc47f){var _0x23f389=[_0x9e7b('0x6f'),_0x9e7b('0x70'),'IsReminderSet',_0x9e7b('0x71'),_0x9e7b('0x72'),_0x9e7b('0x73')];var _0x152110=[_0x9e7b('0x74'),_0x9e7b('0x75'),'picklist',_0x9e7b('0x76'),_0x9e7b('0x77'),'textarea',_0x9e7b('0x78')];if(_0xacc47f){_['remove'](_0xacc47f[_0x9e7b('0x3c')],function(_0x39ff07){return _0x23f389[_0x9e7b('0x79')](_0x39ff07[_0x9e7b('0x2f')])||!_0x152110[_0x9e7b('0x79')](_0x39ff07['type']);});return{'count':_0xacc47f[_0x9e7b('0x3c')][_0x9e7b('0x3d')],'rows':_[_0x9e7b('0x32')](_0xacc47f[_0x9e7b('0x3c')],function(_0x51f8ed){return{'id':_0x51f8ed['name'],'name':_0x51f8ed[_0x9e7b('0x7a')],'custom':_0x51f8ed['custom'],'options':_0x51f8ed[_0x9e7b('0x7b')][_0x9e7b('0x3d')]>0x0?_['map'](_0x51f8ed[_0x9e7b('0x7b')],function(_0x33a153){return{'name':_0x33a153[_0x9e7b('0x7a')],'value':_0x33a153[_0x9e7b('0x7c')]};}):_0x51f8ed[_0x9e7b('0x46')]==_0x9e7b('0x76')?[{'name':_0x9e7b('0x7d'),'value':_0x9e7b('0x7e')},{'name':_0x9e7b('0x7f'),'value':_0x9e7b('0x80')}]:[]};})};}})[_0x9e7b('0x19')](respondWithResult(_0x5b1bc2,null))[_0x9e7b('0x4d')](function(_0x47a1fd){var _0x4abd07=_0x5ef86d[_0x9e7b('0x36')]['test']?0x1f4:_0x47a1fd[_0x9e7b('0x81')]||0x1f4;logger[_0x9e7b('0x1f')](_0x9e7b('0x82'),_0x9e7b('0x60'),_0x4abd07,JSON[_0x9e7b('0x1e')](_0x47a1fd));delete _0x47a1fd[_0x9e7b('0x2f')];if(_0x4abd07===0x191){_0x4abd07=0x190;}_0x5b1bc2['status'](_0x4abd07)[_0x9e7b('0x30')](_0x5ef86d[_0x9e7b('0x36')][_0x9e7b('0x83')]?{'message':_0x9e7b('0x84'),'statusCode':_0x47a1fd[_0x9e7b('0x81')]}:_0x47a1fd);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ecd6086..9dbce26 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 _0x58b6=['../../components/integrations/configuration','exports','SalesforceAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x571a94,_0x52ad6){var _0x206827=function(_0x25e54c){while(--_0x25e54c){_0x571a94['push'](_0x571a94['shift']());}};_0x206827(++_0x52ad6);}(_0x58b6,0x1a3));var _0x658b=function(_0x428a1a,_0x43f832){_0x428a1a=_0x428a1a-0x0;var _0x5194ff=_0x58b6[_0x428a1a];return _0x5194ff;};'use strict';var _=require(_0x658b('0x0'));var util=require('util');var logger=require(_0x658b('0x1'))(_0x658b('0x2'));var moment=require(_0x658b('0x3'));var BPromise=require(_0x658b('0x4'));var rp=require(_0x658b('0x5'));var fs=require('fs');var path=require(_0x658b('0x6'));var rimraf=require(_0x658b('0x7'));var config=require(_0x658b('0x8'));var attributes=require(_0x658b('0x9'));var integrations=require(_0x658b('0xa'));module[_0x658b('0xb')]=function(_0x51e7d5,_0x18f5fb){return _0x51e7d5['define'](_0x658b('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x578a=['path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api'];(function(_0x472ee7,_0x302242){var _0x6aa3f3=function(_0x43beda){while(--_0x43beda){_0x472ee7['push'](_0x472ee7['shift']());}};_0x6aa3f3(++_0x302242);}(_0x578a,0x1eb));var _0xa578=function(_0x533132,_0xf5b6fa){_0x533132=_0x533132-0x0;var _0x1a7447=_0x578a[_0x533132];return _0x1a7447;};'use strict';var _=require(_0xa578('0x0'));var util=require(_0xa578('0x1'));var logger=require(_0xa578('0x2'))(_0xa578('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa578('0x4'));var rimraf=require(_0xa578('0x5'));var config=require('../../config/environment');var attributes=require(_0xa578('0x6'));var integrations=require(_0xa578('0x7'));module[_0xa578('0x8')]=function(_0x3fb4b9,_0x5c75b8){return _0x3fb4b9['define'](_0xa578('0x9'),attributes,{'tableName':_0xa578('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index d2261d6..0136245 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 _0x9f62=['limit','include','model','map','GetSalesforceAccount','debug','stringify','ShowSalesforceAccount','find','then','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','SalesforceAccount','findAll','options','raw','where','attributes'];(function(_0xbfdaab,_0x290a9b){var _0x4012df=function(_0x520418){while(--_0x520418){_0xbfdaab['push'](_0xbfdaab['shift']());}};_0x4012df(++_0x290a9b);}(_0x9f62,0x154));var _0x29f6=function(_0xf217c8,_0x30bec4){_0xf217c8=_0xf217c8-0x0;var _0x520227=_0x9f62[_0xf217c8];return _0x520227;};'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});function respondWithRpcPromise(_0x272876,_0x9a43fe,_0x2ba602){return new BPromise(function(_0x416c6c,_0x5e9945){return client['request'](_0x272876,_0x2ba602)['then'](function(_0x549f64){logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,'request\x20sent');logger['debug'](_0x29f6('0xb'),_0x9a43fe,_0x29f6('0xc'),JSON['stringify'](_0x549f64));if(_0x549f64[_0x29f6('0xd')]){if(_0x549f64[_0x29f6('0xd')]['code']===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x9a43fe,_0x549f64['error'][_0x29f6('0xe')]);return _0x5e9945(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}logger[_0x29f6('0xd')](_0x29f6('0xa'),_0x9a43fe,_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);return _0x416c6c(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}else{logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,_0x29f6('0xc'));_0x416c6c(_0x549f64[_0x29f6('0xf')][_0x29f6('0xe')]);}})[_0x29f6('0x10')](function(_0x14dd56){logger[_0x29f6('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x9a43fe,_0x14dd56);_0x5e9945(_0x14dd56);});});}exports['GetSalesforceAccount']=function(_0x2e66d3){var _0x3af478=this;return new Promise(function(_0xb31436,_0x5c8246){return db[_0x29f6('0x11')][_0x29f6('0x12')]({'raw':_0x2e66d3['options']?_0x2e66d3[_0x29f6('0x13')][_0x29f6('0x14')]===undefined?!![]:![]:!![],'where':_0x2e66d3[_0x29f6('0x13')]?_0x2e66d3[_0x29f6('0x13')][_0x29f6('0x15')]||null:null,'attributes':_0x2e66d3[_0x29f6('0x13')]?_0x2e66d3['options'][_0x29f6('0x16')]||null:null,'limit':_0x2e66d3['options']?_0x2e66d3['options'][_0x29f6('0x17')]||null:null,'include':_0x2e66d3[_0x29f6('0x13')]?_0x2e66d3[_0x29f6('0x13')][_0x29f6('0x18')]?_['map'](_0x2e66d3[_0x29f6('0x13')]['include'],function(_0xd4179c){return{'model':db[_0xd4179c[_0x29f6('0x19')]],'as':_0xd4179c['as'],'attributes':_0xd4179c[_0x29f6('0x16')],'include':_0xd4179c[_0x29f6('0x18')]?_['map'](_0xd4179c[_0x29f6('0x18')],function(_0x4d494f){return{'model':db[_0x4d494f['model']],'as':_0x4d494f['as'],'attributes':_0x4d494f[_0x29f6('0x16')],'include':_0x4d494f[_0x29f6('0x18')]?_[_0x29f6('0x1a')](_0x4d494f[_0x29f6('0x18')],function(_0x84ccb7){return{'model':db[_0x84ccb7[_0x29f6('0x19')]],'as':_0x84ccb7['as'],'attributes':_0x84ccb7[_0x29f6('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2183b7){logger[_0x29f6('0x9')](_0x29f6('0x1b'),_0x2e66d3);logger[_0x29f6('0x1c')](_0x29f6('0x1b'),_0x2e66d3,JSON[_0x29f6('0x1d')](_0x2183b7));_0xb31436(_0x2183b7);})[_0x29f6('0x10')](function(_0x17b2f2){logger[_0x29f6('0xd')](_0x29f6('0x1b'),_0x17b2f2[_0x29f6('0xe')],_0x2e66d3);_0x5c8246(_0x3af478[_0x29f6('0xd')](0x1f4,_0x17b2f2[_0x29f6('0xe')]));});});};exports[_0x29f6('0x1e')]=function(_0x375564){var _0x218931=this;return new Promise(function(_0x3a7249,_0x5492c2){return db['SalesforceAccount'][_0x29f6('0x1f')]({'raw':_0x375564['options']?_0x375564[_0x29f6('0x13')][_0x29f6('0x14')]===undefined?!![]:![]:!![],'where':_0x375564[_0x29f6('0x13')]?_0x375564[_0x29f6('0x13')]['where']||null:null,'attributes':_0x375564['options']?_0x375564[_0x29f6('0x13')][_0x29f6('0x16')]||null:null,'include':_0x375564[_0x29f6('0x13')]?_0x375564[_0x29f6('0x13')][_0x29f6('0x18')]?_[_0x29f6('0x1a')](_0x375564[_0x29f6('0x13')][_0x29f6('0x18')],function(_0xad83a3){return{'model':db[_0xad83a3[_0x29f6('0x19')]],'as':_0xad83a3['as'],'attributes':_0xad83a3[_0x29f6('0x16')],'include':_0xad83a3[_0x29f6('0x18')]?_[_0x29f6('0x1a')](_0xad83a3[_0x29f6('0x18')],function(_0x4e6304){return{'model':db[_0x4e6304['model']],'as':_0x4e6304['as'],'attributes':_0x4e6304[_0x29f6('0x16')],'include':_0x4e6304[_0x29f6('0x18')]?_[_0x29f6('0x1a')](_0x4e6304['include'],function(_0x3e1e25){return{'model':db[_0x3e1e25[_0x29f6('0x19')]],'as':_0x3e1e25['as'],'attributes':_0x3e1e25[_0x29f6('0x16')]};}):[]};}):[]};}):[]:[]})[_0x29f6('0x20')](function(_0x1d2b3c){logger['info'](_0x29f6('0x1e'),_0x375564);logger[_0x29f6('0x1c')](_0x29f6('0x1e'),_0x375564,JSON[_0x29f6('0x1d')](_0x1d2b3c));_0x3a7249(_0x1d2b3c);})['catch'](function(_0x30d747){logger[_0x29f6('0xd')](_0x29f6('0x1e'),_0x30d747[_0x29f6('0xe')],_0x375564);_0x5492c2(_0x218931['error'](0x1f4,_0x30d747['message']));});});}; \ No newline at end of file +var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowSalesforceAccount','SalesforceAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSalesforceAccount','findAll'];(function(_0x45a1c6,_0x152712){var _0x24311c=function(_0x4d6f3d){while(--_0x4d6f3d){_0x45a1c6['push'](_0x45a1c6['shift']());}};_0x24311c(++_0x152712);}(_0xe706,0xa3));var _0x6e70=function(_0x3ff59d,_0x209599){_0x3ff59d=_0x3ff59d-0x0;var _0x221f59=_0xe706[_0x3ff59d];return _0x221f59;};'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']('SalesforceAccount,\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']('SalesforceAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['SalesforceAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetSalesforceAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index d753495..e01ff20 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 _0x0763=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','path','connect-timeout'];(function(_0x446b50,_0x3fcc43){var _0x319613=function(_0x1e8aac){while(--_0x1e8aac){_0x446b50['push'](_0x446b50['shift']());}};_0x319613(++_0x3fcc43);}(_0x0763,0x87));var _0x3076=function(_0x6bb814,_0x17196b){_0x6bb814=_0x6bb814-0x0;var _0x3c4bf6=_0x0763[_0x6bb814];return _0x3c4bf6;};'use strict';var multer=require(_0x3076('0x0'));var util=require('util');var path=require(_0x3076('0x1'));var timeout=require(_0x3076('0x2'));var express=require('express');var router=express[_0x3076('0x3')]();var fs_extra=require(_0x3076('0x4'));var auth=require(_0x3076('0x5'));var interaction=require(_0x3076('0x6'));var config=require('../../config/environment');var controller=require(_0x3076('0x7'));router[_0x3076('0x8')]('/',auth[_0x3076('0x9')](),controller[_0x3076('0xa')]);router[_0x3076('0x8')](_0x3076('0xb'),auth[_0x3076('0x9')](),controller[_0x3076('0xc')]);router[_0x3076('0x8')](_0x3076('0xd'),auth['isAuthenticated'](),controller[_0x3076('0xe')]);router[_0x3076('0x8')](_0x3076('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x3076('0x8')](_0x3076('0x10'),auth[_0x3076('0x9')](),controller[_0x3076('0x11')]);router[_0x3076('0x12')]('/',auth['isAuthenticated'](),controller[_0x3076('0x13')]);router[_0x3076('0x14')](_0x3076('0xb'),auth[_0x3076('0x9')](),controller[_0x3076('0x15')]);router[_0x3076('0x16')](_0x3076('0xb'),auth[_0x3076('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0ed7=['get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','post','create','put','update','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated','index'];(function(_0x25f2bc,_0x3fd38a){var _0x21bd7=function(_0xb4c381){while(--_0xb4c381){_0x25f2bc['push'](_0x25f2bc['shift']());}};_0x21bd7(++_0x3fd38a);}(_0x0ed7,0xc5));var _0x70ed=function(_0x2fad8a,_0x26de69){_0x2fad8a=_0x2fad8a-0x0;var _0x494d7d=_0x0ed7[_0x2fad8a];return _0x494d7d;};'use strict';var multer=require(_0x70ed('0x0'));var util=require('util');var path=require(_0x70ed('0x1'));var timeout=require('connect-timeout');var express=require(_0x70ed('0x2'));var router=express['Router']();var fs_extra=require(_0x70ed('0x3'));var auth=require(_0x70ed('0x4'));var interaction=require(_0x70ed('0x5'));var config=require(_0x70ed('0x6'));var controller=require(_0x70ed('0x7'));router['get']('/',auth[_0x70ed('0x8')](),controller[_0x70ed('0x9')]);router[_0x70ed('0xa')](_0x70ed('0xb'),auth[_0x70ed('0x8')](),controller[_0x70ed('0xc')]);router[_0x70ed('0xa')](_0x70ed('0xd'),auth[_0x70ed('0x8')](),controller[_0x70ed('0xe')]);router[_0x70ed('0xa')](_0x70ed('0xf'),auth[_0x70ed('0x8')](),controller[_0x70ed('0x10')]);router[_0x70ed('0xa')]('/:id/descriptions',auth[_0x70ed('0x8')](),controller['getDescriptions']);router[_0x70ed('0x11')]('/',auth[_0x70ed('0x8')](),controller[_0x70ed('0x12')]);router[_0x70ed('0x13')](_0x70ed('0xb'),auth[_0x70ed('0x8')](),controller[_0x70ed('0x14')]);router['delete'](_0x70ed('0xb'),auth[_0x70ed('0x8')](),controller[_0x70ed('0x15')]);module[_0x70ed('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index ef2032e..e23baf7 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 _0xe492=['STRING','Task','Case','ENUM','contact_lead','lead','account_contact_lead','contact','sequelize','exports'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xe492,0xf8));var _0x2e49=function(_0x5806b1,_0x38c276){_0x5806b1=_0x5806b1-0x0;var _0x15f734=_0xe492[_0x5806b1];return _0x15f734;};'use strict';var Sequelize=require(_0x2e49('0x0'));module[_0x2e49('0x1')]={'name':{'type':Sequelize[_0x2e49('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x2e49('0x3'),_0x2e49('0x4')),'defaultValue':_0x2e49('0x3')},'moduleSearch':{'type':Sequelize[_0x2e49('0x5')](_0x2e49('0x6'),'contact',_0x2e49('0x7'),_0x2e49('0x8'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x2e49('0x5')]('nothing',_0x2e49('0x9'),_0x2e49('0x7'),'account'),'defaultValue':_0x2e49('0x7')},'leadId':{'type':Sequelize[_0x2e49('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x2e49('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x2e49('0x2')]}}; \ No newline at end of file +var _0x5971=['Case','contact_lead','contact','lead','account_contact_lead','account','nothing','STRING','ENUM','Task'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x5971,0x75));var _0x1597=function(_0x38faf1,_0x1b3be2){_0x38faf1=_0x38faf1-0x0;var _0x11837f=_0x5971[_0x38faf1];return _0x11837f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1597('0x0')]},'description':{'type':Sequelize[_0x1597('0x0')]},'ticketType':{'type':Sequelize[_0x1597('0x1')](_0x1597('0x2'),_0x1597('0x3')),'defaultValue':_0x1597('0x2')},'moduleSearch':{'type':Sequelize[_0x1597('0x1')](_0x1597('0x4'),_0x1597('0x5'),_0x1597('0x6'),_0x1597('0x7'),_0x1597('0x8')),'defaultValue':_0x1597('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x1597('0x9'),'contact','lead',_0x1597('0x8')),'defaultValue':_0x1597('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x1597('0x0')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x1597('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 09dc8f9..84a5bf9 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 _0x22f1=['getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','SalesforceConfiguration','includeAll','findAll','show','params','options','find','catch','create','body','update','findOne','SalesforceField','pick','filter','getFields','getSubjects'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x22f1,0x175));var _0x122f=function(_0x55043b,_0x3c1bf0){_0x55043b=_0x55043b-0x0;var _0x173786=_0x22f1[_0x55043b];return _0x173786;};'use strict';var emlformat=require(_0x122f('0x0'));var rimraf=require(_0x122f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x122f('0x2'));var rp=require(_0x122f('0x3'));var moment=require(_0x122f('0x4'));var BPromise=require(_0x122f('0x5'));var Mustache=require(_0x122f('0x6'));var util=require(_0x122f('0x7'));var path=require(_0x122f('0x8'));var sox=require(_0x122f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x122f('0xa'));var _=require(_0x122f('0xb'));var squel=require(_0x122f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x122f('0xd'));var toCsv=require(_0x122f('0xe'));var querystring=require(_0x122f('0xf'));var Papa=require('papaparse');var Redis=require(_0x122f('0x10'));var authService=require(_0x122f('0x11'));var qs=require(_0x122f('0x12'));var as=require(_0x122f('0x13'));var hardwareService=require(_0x122f('0x14'));var logger=require(_0x122f('0x15'))(_0x122f('0x16'));var utils=require('../../config/utils');var config=require(_0x122f('0x17'));var licenseUtil=require(_0x122f('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x122f('0x19'));var client=jayson[_0x122f('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444cea,_0xf0c7a6,_0x109576,_0x496a46){return new BPromise(function(_0x528ec9,_0xc119a8){var _0x5b63a1=_0x496a46||client;return _0x5b63a1[_0x122f('0x1b')](_0x444cea,_0x109576)[_0x122f('0x1c')](function(_0x2cd2e4){logger[_0x122f('0x1d')](_0x122f('0x1e'),_0xf0c7a6,'request\x20sent');logger[_0x122f('0x1f')](_0x122f('0x20'),_0xf0c7a6,_0x122f('0x21'),JSON[_0x122f('0x22')](_0x2cd2e4));if(_0x2cd2e4[_0x122f('0x23')]){if(_0x2cd2e4[_0x122f('0x23')]['code']===0x1f4){logger[_0x122f('0x23')](_0x122f('0x1e'),_0xf0c7a6,_0x2cd2e4['error'][_0x122f('0x24')]);return _0xc119a8(_0x2cd2e4[_0x122f('0x23')][_0x122f('0x24')]);}logger['error'](_0x122f('0x1e'),_0xf0c7a6,_0x2cd2e4[_0x122f('0x23')]['message']);return _0x528ec9(_0x2cd2e4[_0x122f('0x23')][_0x122f('0x24')]);}else{logger[_0x122f('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s',_0xf0c7a6,_0x122f('0x21'));_0x528ec9(_0x2cd2e4[_0x122f('0x25')][_0x122f('0x24')]);}})['catch'](function(_0x31b722){logger[_0x122f('0x23')](_0x122f('0x1e'),_0xf0c7a6,_0x31b722);_0xc119a8(_0x31b722);});});}function respondWithStatusCode(_0x4084c5,_0x5bc79d){_0x5bc79d=_0x5bc79d||0xcc;return function(_0x5660d6){if(_0x5660d6){return _0x4084c5[_0x122f('0x26')](_0x5bc79d);}return _0x4084c5[_0x122f('0x27')](_0x5bc79d)[_0x122f('0x28')]();};}function respondWithResult(_0x3405fb,_0x3d0c65){_0x3d0c65=_0x3d0c65||0xc8;return function(_0x50de7b){if(_0x50de7b){return _0x3405fb['status'](_0x3d0c65)[_0x122f('0x29')](_0x50de7b);}};}function respondWithFilteredResult(_0x2e803f,_0x5e84fe){return function(_0x5b773d){if(_0x5b773d){var _0x5989c6=typeof _0x5e84fe[_0x122f('0x2a')]==='undefined'&&typeof _0x5e84fe['limit']===_0x122f('0x2b');var _0x21d92c=_0x5b773d[_0x122f('0x2c')];var _0x32b548=_0x5989c6?0x0:_0x5e84fe['offset'];var _0x5b0175=_0x5989c6?_0x5b773d['count']:_0x5e84fe[_0x122f('0x2a')]+_0x5e84fe[_0x122f('0x2d')];var _0x3faaee;if(_0x5b0175>=_0x21d92c){_0x5b0175=_0x21d92c;_0x3faaee=0xc8;}else{_0x3faaee=0xce;}_0x2e803f[_0x122f('0x27')](_0x3faaee);return _0x2e803f[_0x122f('0x2e')](_0x122f('0x2f'),_0x32b548+'-'+_0x5b0175+'/'+_0x21d92c)['json'](_0x5b773d);}return null;};}function patchUpdates(_0x17d11d){return function(_0x196417){try{jsonpatch[_0x122f('0x30')](_0x196417,_0x17d11d,!![]);}catch(_0x26c051){return BPromise[_0x122f('0x31')](_0x26c051);}return _0x196417['save']();};}function saveUpdates(_0x1ce452,_0x4cfa4a){return function(_0x3e0308){if(_0x3e0308){return _0x3e0308['update'](_0x1ce452)[_0x122f('0x1c')](function(_0x576f39){return _0x576f39;});}return null;};}function removeEntity(_0x70739b,_0x140a87){return function(_0x4020d0){if(_0x4020d0){return _0x4020d0[_0x122f('0x32')]()['then'](function(){_0x70739b['status'](0xcc)[_0x122f('0x28')]();});}};}function handleEntityNotFound(_0x201f40,_0x221912){return function(_0x4ea2c3){if(!_0x4ea2c3){_0x201f40[_0x122f('0x26')](0x194);}return _0x4ea2c3;};}function handleError(_0x34c4a1,_0x88898f){_0x88898f=_0x88898f||0x1f4;return function(_0x1af46d){logger['error'](_0x1af46d[_0x122f('0x33')]);if(_0x1af46d[_0x122f('0x34')]){delete _0x1af46d[_0x122f('0x34')];}_0x34c4a1[_0x122f('0x27')](_0x88898f)[_0x122f('0x35')](_0x1af46d);};}exports[_0x122f('0x36')]=function(_0x389520,_0x4de294){var _0x43574={},_0x838aa8={},_0x34c775={'count':0x0,'rows':[]};var _0x5dd9e0=_[_0x122f('0x37')](db['SalesforceConfiguration'][_0x122f('0x38')],function(_0x11c985){return{'name':_0x11c985[_0x122f('0x39')],'type':_0x11c985[_0x122f('0x3a')][_0x122f('0x3b')]};});_0x838aa8[_0x122f('0x3c')]=_[_0x122f('0x37')](_0x5dd9e0,'name');_0x838aa8[_0x122f('0x3d')]=_[_0x122f('0x3e')](_0x389520[_0x122f('0x3d')]);_0x838aa8[_0x122f('0x3f')]=_[_0x122f('0x40')](_0x838aa8[_0x122f('0x3c')],_0x838aa8[_0x122f('0x3d')]);_0x43574[_0x122f('0x41')]=_['intersection'](_0x838aa8[_0x122f('0x3c')],qs[_0x122f('0x42')](_0x389520[_0x122f('0x3d')][_0x122f('0x42')]));_0x43574['attributes']=_0x43574['attributes'][_0x122f('0x43')]?_0x43574[_0x122f('0x41')]:_0x838aa8['model'];if(!_0x389520[_0x122f('0x3d')][_0x122f('0x44')](_0x122f('0x45'))){_0x43574[_0x122f('0x2d')]=qs['limit'](_0x389520[_0x122f('0x3d')]['limit']);_0x43574['offset']=qs[_0x122f('0x2a')](_0x389520['query']['offset']);}_0x43574[_0x122f('0x46')]=qs['sort'](_0x389520[_0x122f('0x3d')][_0x122f('0x47')]);_0x43574[_0x122f('0x48')]=qs[_0x122f('0x3f')](_['pick'](_0x389520['query'],_0x838aa8[_0x122f('0x3f')]),_0x5dd9e0);if(_0x389520[_0x122f('0x3d')]['filter']){_0x43574[_0x122f('0x48')]=_['merge'](_0x43574[_0x122f('0x48')],{'$or':_['map'](_0x5dd9e0,function(_0x31bad4){if(_0x31bad4[_0x122f('0x3a')]!==_0x122f('0x49')){var _0x363c36={};_0x363c36[_0x31bad4[_0x122f('0x34')]]={'$like':'%'+_0x389520['query']['filter']+'%'};return _0x363c36;}})});}_0x43574=_[_0x122f('0x4a')]({},_0x43574,_0x389520['options']);var _0x1eefd9={'where':_0x43574[_0x122f('0x48')]};return db[_0x122f('0x4b')]['count'](_0x1eefd9)[_0x122f('0x1c')](function(_0x24e672){_0x34c775[_0x122f('0x2c')]=_0x24e672;if(_0x389520['query'][_0x122f('0x4c')]){_0x43574['include']=[{'all':!![]}];}return db[_0x122f('0x4b')][_0x122f('0x4d')](_0x43574);})['then'](function(_0x45ddb3){_0x34c775['rows']=_0x45ddb3;return _0x34c775;})['then'](respondWithFilteredResult(_0x4de294,_0x43574))['catch'](handleError(_0x4de294,null));};exports[_0x122f('0x4e')]=function(_0x49435b,_0x5bee3c){var _0x54d225={'raw':![],'where':{'id':_0x49435b[_0x122f('0x4f')]['id']}},_0x401b96={};_0x401b96[_0x122f('0x3c')]=_[_0x122f('0x3e')](db[_0x122f('0x4b')][_0x122f('0x38')]);_0x401b96['query']=_[_0x122f('0x3e')](_0x49435b[_0x122f('0x3d')]);_0x401b96[_0x122f('0x3f')]=_[_0x122f('0x40')](_0x401b96[_0x122f('0x3c')],_0x401b96[_0x122f('0x3d')]);_0x54d225[_0x122f('0x41')]=_[_0x122f('0x40')](_0x401b96['model'],qs[_0x122f('0x42')](_0x49435b[_0x122f('0x3d')][_0x122f('0x42')]));_0x54d225['attributes']=_0x54d225['attributes'][_0x122f('0x43')]?_0x54d225[_0x122f('0x41')]:_0x401b96[_0x122f('0x3c')];if(_0x49435b[_0x122f('0x3d')][_0x122f('0x4c')]){_0x54d225['include']=[{'all':!![]}];}_0x54d225=_[_0x122f('0x4a')]({},_0x54d225,_0x49435b[_0x122f('0x50')]);return db['SalesforceConfiguration'][_0x122f('0x51')](_0x54d225)[_0x122f('0x1c')](handleEntityNotFound(_0x5bee3c,null))[_0x122f('0x1c')](respondWithResult(_0x5bee3c,null))[_0x122f('0x52')](handleError(_0x5bee3c,null));};exports[_0x122f('0x53')]=function(_0x1f5a01,_0x21be42){return db[_0x122f('0x4b')]['create'](_0x1f5a01[_0x122f('0x54')],{})['then'](respondWithResult(_0x21be42,0xc9))[_0x122f('0x52')](handleError(_0x21be42,null));};exports[_0x122f('0x55')]=function(_0x417882,_0x82e5ff){if(_0x417882[_0x122f('0x54')]['id']){delete _0x417882[_0x122f('0x54')]['id'];}return db[_0x122f('0x4b')][_0x122f('0x51')]({'where':{'id':_0x417882[_0x122f('0x4f')]['id']}})[_0x122f('0x1c')](handleEntityNotFound(_0x82e5ff,null))[_0x122f('0x1c')](saveUpdates(_0x417882[_0x122f('0x54')],null))[_0x122f('0x1c')](respondWithResult(_0x82e5ff,null))['catch'](handleError(_0x82e5ff,null));};exports[_0x122f('0x32')]=function(_0x3dc4b6,_0x184ae5){return db[_0x122f('0x4b')][_0x122f('0x51')]({'where':{'id':_0x3dc4b6['params']['id']}})[_0x122f('0x1c')](handleEntityNotFound(_0x184ae5,null))[_0x122f('0x1c')](removeEntity(_0x184ae5,null))['catch'](handleError(_0x184ae5,null));};exports['getFields']=function(_0x5b8dc1,_0x4f1f7b,_0x2999be){var _0x4eaad8={};var _0x55a69f={};var _0x4fb567;var _0xeb0fac;return db[_0x122f('0x4b')][_0x122f('0x56')]({'where':{'id':_0x5b8dc1['params']['id']}})[_0x122f('0x1c')](handleEntityNotFound(_0x4f1f7b,null))[_0x122f('0x1c')](function(_0xce6579){if(_0xce6579){_0x4fb567=_0xce6579;_0x55a69f[_0x122f('0x3c')]=_[_0x122f('0x3e')](db[_0x122f('0x57')]['rawAttributes']);_0x55a69f[_0x122f('0x3d')]=_[_0x122f('0x3e')](_0x5b8dc1['query']);_0x55a69f[_0x122f('0x3f')]=_[_0x122f('0x40')](_0x55a69f[_0x122f('0x3c')],_0x55a69f['query']);_0x4eaad8['attributes']=_[_0x122f('0x40')](_0x55a69f['model'],qs[_0x122f('0x42')](_0x5b8dc1[_0x122f('0x3d')]['fields']));_0x4eaad8['attributes']=_0x4eaad8[_0x122f('0x41')][_0x122f('0x43')]?_0x4eaad8[_0x122f('0x41')]:_0x55a69f[_0x122f('0x3c')];_0x4eaad8[_0x122f('0x46')]=qs['sort'](_0x5b8dc1['query'][_0x122f('0x47')]);_0x4eaad8['where']=qs['filters'](_[_0x122f('0x58')](_0x5b8dc1[_0x122f('0x3d')],_0x55a69f[_0x122f('0x3f')]));if(_0x5b8dc1['query'][_0x122f('0x59')]){_0x4eaad8[_0x122f('0x48')]=_[_0x122f('0x4a')](_0x4eaad8[_0x122f('0x48')],{'$or':_[_0x122f('0x37')](_0x4eaad8[_0x122f('0x41')],function(_0x15113f){var _0xe63300={};_0xe63300[_0x15113f]={'$like':'%'+_0x5b8dc1[_0x122f('0x3d')][_0x122f('0x59')]+'%'};return _0xe63300;})});}_0x4eaad8=_[_0x122f('0x4a')]({},_0x4eaad8,_0x5b8dc1[_0x122f('0x50')]);return _0x4fb567[_0x122f('0x5a')](_0x4eaad8);}})['then'](function(_0x1fb783){if(_0x1fb783){_0xeb0fac=_0x1fb783[_0x122f('0x43')];if(!_0x5b8dc1[_0x122f('0x3d')][_0x122f('0x44')](_0x122f('0x45'))){_0x4eaad8['limit']=qs[_0x122f('0x2d')](_0x5b8dc1[_0x122f('0x3d')]['limit']);_0x4eaad8['offset']=qs['offset'](_0x5b8dc1[_0x122f('0x3d')]['offset']);}return _0x4fb567['getFields'](_0x4eaad8);}})['then'](function(_0x19482d){if(_0x19482d){return _0x19482d?{'count':_0xeb0fac,'rows':_0x19482d}:null;}})[_0x122f('0x1c')](respondWithResult(_0x4f1f7b,null))['catch'](handleError(_0x4f1f7b,null));};exports[_0x122f('0x5b')]=function(_0x588c29,_0x2495f2,_0x36f1aa){var _0x2ca823={};var _0x599512={};var _0x1a2104;var _0x286ec5;return db[_0x122f('0x4b')][_0x122f('0x56')]({'where':{'id':_0x588c29[_0x122f('0x4f')]['id']}})[_0x122f('0x1c')](handleEntityNotFound(_0x2495f2,null))['then'](function(_0x504342){if(_0x504342){_0x1a2104=_0x504342;_0x599512[_0x122f('0x3c')]=_['keys'](db[_0x122f('0x57')]['rawAttributes']);_0x599512[_0x122f('0x3d')]=_[_0x122f('0x3e')](_0x588c29[_0x122f('0x3d')]);_0x599512[_0x122f('0x3f')]=_[_0x122f('0x40')](_0x599512[_0x122f('0x3c')],_0x599512[_0x122f('0x3d')]);_0x2ca823[_0x122f('0x41')]=_[_0x122f('0x40')](_0x599512['model'],qs[_0x122f('0x42')](_0x588c29['query'][_0x122f('0x42')]));_0x2ca823[_0x122f('0x41')]=_0x2ca823[_0x122f('0x41')]['length']?_0x2ca823[_0x122f('0x41')]:_0x599512['model'];_0x2ca823[_0x122f('0x46')]=qs[_0x122f('0x47')](_0x588c29[_0x122f('0x3d')][_0x122f('0x47')]);_0x2ca823['where']=qs['filters'](_['pick'](_0x588c29[_0x122f('0x3d')],_0x599512[_0x122f('0x3f')]));if(_0x588c29[_0x122f('0x3d')][_0x122f('0x59')]){_0x2ca823[_0x122f('0x48')]=_[_0x122f('0x4a')](_0x2ca823[_0x122f('0x48')],{'$or':_[_0x122f('0x37')](_0x2ca823['attributes'],function(_0x4ff5a0){var _0xec9961={};_0xec9961[_0x4ff5a0]={'$like':'%'+_0x588c29[_0x122f('0x3d')][_0x122f('0x59')]+'%'};return _0xec9961;})});}_0x2ca823=_[_0x122f('0x4a')]({},_0x2ca823,_0x588c29[_0x122f('0x50')]);return _0x1a2104[_0x122f('0x5b')](_0x2ca823);}})[_0x122f('0x1c')](function(_0x39bbf9){if(_0x39bbf9){_0x286ec5=_0x39bbf9[_0x122f('0x43')];if(!_0x588c29[_0x122f('0x3d')][_0x122f('0x44')](_0x122f('0x45'))){_0x2ca823[_0x122f('0x2d')]=qs[_0x122f('0x2d')](_0x588c29['query'][_0x122f('0x2d')]);_0x2ca823[_0x122f('0x2a')]=qs[_0x122f('0x2a')](_0x588c29[_0x122f('0x3d')][_0x122f('0x2a')]);}return _0x1a2104['getSubjects'](_0x2ca823);}})[_0x122f('0x1c')](function(_0x18fe4c){if(_0x18fe4c){return _0x18fe4c?{'count':_0x286ec5,'rows':_0x18fe4c}:null;}})[_0x122f('0x1c')](respondWithResult(_0x2495f2,null))['catch'](handleError(_0x2495f2,null));};exports[_0x122f('0x5c')]=function(_0x57494c,_0x3346dd,_0x53546b){var _0x5c15db={};var _0x3561da={};var _0xa7aad8;var _0x32f28f;return db[_0x122f('0x4b')]['findOne']({'where':{'id':_0x57494c[_0x122f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3346dd,null))['then'](function(_0x4705eb){if(_0x4705eb){_0xa7aad8=_0x4705eb;_0x3561da[_0x122f('0x3c')]=_[_0x122f('0x3e')](db[_0x122f('0x57')][_0x122f('0x38')]);_0x3561da[_0x122f('0x3d')]=_[_0x122f('0x3e')](_0x57494c[_0x122f('0x3d')]);_0x3561da[_0x122f('0x3f')]=_['intersection'](_0x3561da[_0x122f('0x3c')],_0x3561da[_0x122f('0x3d')]);_0x5c15db['attributes']=_['intersection'](_0x3561da['model'],qs['fields'](_0x57494c[_0x122f('0x3d')][_0x122f('0x42')]));_0x5c15db['attributes']=_0x5c15db['attributes'][_0x122f('0x43')]?_0x5c15db[_0x122f('0x41')]:_0x3561da['model'];_0x5c15db[_0x122f('0x46')]=qs[_0x122f('0x47')](_0x57494c[_0x122f('0x3d')][_0x122f('0x47')]);_0x5c15db[_0x122f('0x48')]=qs[_0x122f('0x3f')](_[_0x122f('0x58')](_0x57494c[_0x122f('0x3d')],_0x3561da[_0x122f('0x3f')]));if(_0x57494c[_0x122f('0x3d')][_0x122f('0x59')]){_0x5c15db['where']=_[_0x122f('0x4a')](_0x5c15db[_0x122f('0x48')],{'$or':_[_0x122f('0x37')](_0x5c15db[_0x122f('0x41')],function(_0x464ba5){var _0x3ff2df={};_0x3ff2df[_0x464ba5]={'$like':'%'+_0x57494c[_0x122f('0x3d')][_0x122f('0x59')]+'%'};return _0x3ff2df;})});}_0x5c15db=_[_0x122f('0x4a')]({},_0x5c15db,_0x57494c[_0x122f('0x50')]);return _0xa7aad8[_0x122f('0x5c')](_0x5c15db);}})[_0x122f('0x1c')](function(_0x552913){if(_0x552913){_0x32f28f=_0x552913['length'];if(!_0x57494c[_0x122f('0x3d')][_0x122f('0x44')](_0x122f('0x45'))){_0x5c15db[_0x122f('0x2d')]=qs['limit'](_0x57494c[_0x122f('0x3d')][_0x122f('0x2d')]);_0x5c15db[_0x122f('0x2a')]=qs['offset'](_0x57494c[_0x122f('0x3d')]['offset']);}return _0xa7aad8[_0x122f('0x5c')](_0x5c15db);}})[_0x122f('0x1c')](function(_0x30de30){if(_0x30de30){return _0x30de30?{'count':_0x32f28f,'rows':_0x30de30}:null;}})[_0x122f('0x1c')](respondWithResult(_0x3346dd,null))[_0x122f('0x52')](handleError(_0x3346dd,null));}; \ No newline at end of file +var _0xed06=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','SalesforceConfiguration','findAll','rows','show','merge','find','create','body','getFields','findOne','params','SalesforceField','getSubjects','getDescriptions'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xed06,0x170));var _0x6ed0=function(_0x14f434,_0x415371){_0x14f434=_0x14f434-0x0;var _0x3196ff=_0xed06[_0x14f434];return _0x3196ff;};'use strict';var emlformat=require(_0x6ed0('0x0'));var rimraf=require(_0x6ed0('0x1'));var zipdir=require(_0x6ed0('0x2'));var jsonpatch=require(_0x6ed0('0x3'));var rp=require(_0x6ed0('0x4'));var moment=require(_0x6ed0('0x5'));var BPromise=require(_0x6ed0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6ed0('0x7'));var fs=require('fs');var fs_extra=require(_0x6ed0('0x8'));var _=require(_0x6ed0('0x9'));var squel=require(_0x6ed0('0xa'));var crypto=require(_0x6ed0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6ed0('0xc'));var toCsv=require(_0x6ed0('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6ed0('0xe'));var authService=require(_0x6ed0('0xf'));var qs=require(_0x6ed0('0x10'));var as=require(_0x6ed0('0x11'));var hardwareService=require(_0x6ed0('0x12'));var logger=require(_0x6ed0('0x13'))('api');var utils=require(_0x6ed0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6ed0('0x15'));var db=require(_0x6ed0('0x16'))['db'];var jayson=require(_0x6ed0('0x17'));var client=jayson[_0x6ed0('0x18')][_0x6ed0('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x77dfec,_0x576897,_0x56dbf2,_0x431401){return new BPromise(function(_0x1e4c62,_0x63ea87){var _0x1318bf=_0x431401||client;return _0x1318bf['request'](_0x77dfec,_0x56dbf2)[_0x6ed0('0x1a')](function(_0x333fb3){logger[_0x6ed0('0x1b')]('SalesforceConfiguration,\x20%s,\x20%s',_0x576897,'request\x20sent');logger['debug'](_0x6ed0('0x1c'),_0x576897,_0x6ed0('0x1d'),JSON[_0x6ed0('0x1e')](_0x333fb3));if(_0x333fb3[_0x6ed0('0x1f')]){if(_0x333fb3[_0x6ed0('0x1f')][_0x6ed0('0x20')]===0x1f4){logger[_0x6ed0('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s',_0x576897,_0x333fb3[_0x6ed0('0x1f')][_0x6ed0('0x21')]);return _0x63ea87(_0x333fb3[_0x6ed0('0x1f')][_0x6ed0('0x21')]);}logger['error'](_0x6ed0('0x22'),_0x576897,_0x333fb3[_0x6ed0('0x1f')][_0x6ed0('0x21')]);return _0x1e4c62(_0x333fb3[_0x6ed0('0x1f')]['message']);}else{logger['info'](_0x6ed0('0x22'),_0x576897,'request\x20sent');_0x1e4c62(_0x333fb3[_0x6ed0('0x23')][_0x6ed0('0x21')]);}})[_0x6ed0('0x24')](function(_0x33f985){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x576897,_0x33f985);_0x63ea87(_0x33f985);});});}function respondWithStatusCode(_0x1ad88f,_0x10b419){_0x10b419=_0x10b419||0xcc;return function(_0x160e23){if(_0x160e23){return _0x1ad88f[_0x6ed0('0x25')](_0x10b419);}return _0x1ad88f[_0x6ed0('0x26')](_0x10b419)[_0x6ed0('0x27')]();};}function respondWithResult(_0x100074,_0x34fc09){_0x34fc09=_0x34fc09||0xc8;return function(_0x10fac3){if(_0x10fac3){return _0x100074[_0x6ed0('0x26')](_0x34fc09)[_0x6ed0('0x28')](_0x10fac3);}};}function respondWithFilteredResult(_0x24884a,_0x1789cc){return function(_0x174f8e){if(_0x174f8e){var _0x589f9c=typeof _0x1789cc[_0x6ed0('0x29')]===_0x6ed0('0x2a')&&typeof _0x1789cc['limit']===_0x6ed0('0x2a');var _0x1bedb7=_0x174f8e[_0x6ed0('0x2b')];var _0x54d8e2=_0x589f9c?0x0:_0x1789cc[_0x6ed0('0x29')];var _0x1cc2df=_0x589f9c?_0x174f8e[_0x6ed0('0x2b')]:_0x1789cc[_0x6ed0('0x29')]+_0x1789cc[_0x6ed0('0x2c')];var _0x564af1;if(_0x1cc2df>=_0x1bedb7){_0x1cc2df=_0x1bedb7;_0x564af1=0xc8;}else{_0x564af1=0xce;}_0x24884a[_0x6ed0('0x26')](_0x564af1);return _0x24884a[_0x6ed0('0x2d')](_0x6ed0('0x2e'),_0x54d8e2+'-'+_0x1cc2df+'/'+_0x1bedb7)[_0x6ed0('0x28')](_0x174f8e);}return null;};}function patchUpdates(_0xf77ac4){return function(_0x34e1df){try{jsonpatch[_0x6ed0('0x2f')](_0x34e1df,_0xf77ac4,!![]);}catch(_0x4f809f){return BPromise['reject'](_0x4f809f);}return _0x34e1df[_0x6ed0('0x30')]();};}function saveUpdates(_0x37dee5,_0x20a0b1){return function(_0x249e53){if(_0x249e53){return _0x249e53[_0x6ed0('0x31')](_0x37dee5)[_0x6ed0('0x1a')](function(_0x248d09){return _0x248d09;});}return null;};}function removeEntity(_0xc698c6,_0x1c0658){return function(_0xf1e82){if(_0xf1e82){return _0xf1e82[_0x6ed0('0x32')]()[_0x6ed0('0x1a')](function(){_0xc698c6[_0x6ed0('0x26')](0xcc)[_0x6ed0('0x27')]();});}};}function handleEntityNotFound(_0x3cb88e,_0x5d362f){return function(_0x159582){if(!_0x159582){_0x3cb88e[_0x6ed0('0x25')](0x194);}return _0x159582;};}function handleError(_0x4b4a91,_0x1720b1){_0x1720b1=_0x1720b1||0x1f4;return function(_0x281ad7){logger[_0x6ed0('0x1f')](_0x281ad7[_0x6ed0('0x33')]);if(_0x281ad7['name']){delete _0x281ad7[_0x6ed0('0x34')];}_0x4b4a91[_0x6ed0('0x26')](_0x1720b1)[_0x6ed0('0x35')](_0x281ad7);};}exports[_0x6ed0('0x36')]=function(_0x1fb162,_0x5cdc0e){var _0x243514={},_0x3db53a={},_0x314af5={'count':0x0,'rows':[]};var _0x1e9ac2=_[_0x6ed0('0x37')](db['SalesforceConfiguration'][_0x6ed0('0x38')],function(_0x228801){return{'name':_0x228801['fieldName'],'type':_0x228801[_0x6ed0('0x39')][_0x6ed0('0x3a')]};});_0x3db53a[_0x6ed0('0x3b')]=_[_0x6ed0('0x37')](_0x1e9ac2,_0x6ed0('0x34'));_0x3db53a['query']=_[_0x6ed0('0x3c')](_0x1fb162['query']);_0x3db53a[_0x6ed0('0x3d')]=_[_0x6ed0('0x3e')](_0x3db53a[_0x6ed0('0x3b')],_0x3db53a['query']);_0x243514[_0x6ed0('0x3f')]=_[_0x6ed0('0x3e')](_0x3db53a[_0x6ed0('0x3b')],qs[_0x6ed0('0x40')](_0x1fb162[_0x6ed0('0x41')][_0x6ed0('0x40')]));_0x243514['attributes']=_0x243514[_0x6ed0('0x3f')][_0x6ed0('0x42')]?_0x243514['attributes']:_0x3db53a[_0x6ed0('0x3b')];if(!_0x1fb162['query'][_0x6ed0('0x43')](_0x6ed0('0x44'))){_0x243514['limit']=qs[_0x6ed0('0x2c')](_0x1fb162[_0x6ed0('0x41')][_0x6ed0('0x2c')]);_0x243514[_0x6ed0('0x29')]=qs[_0x6ed0('0x29')](_0x1fb162[_0x6ed0('0x41')][_0x6ed0('0x29')]);}_0x243514[_0x6ed0('0x45')]=qs[_0x6ed0('0x46')](_0x1fb162['query'][_0x6ed0('0x46')]);_0x243514[_0x6ed0('0x47')]=qs[_0x6ed0('0x3d')](_[_0x6ed0('0x48')](_0x1fb162[_0x6ed0('0x41')],_0x3db53a[_0x6ed0('0x3d')]),_0x1e9ac2);if(_0x1fb162['query']['filter']){_0x243514['where']=_['merge'](_0x243514['where'],{'$or':_[_0x6ed0('0x37')](_0x1e9ac2,function(_0x5ebc45){if(_0x5ebc45[_0x6ed0('0x39')]!==_0x6ed0('0x49')){var _0x2fcb02={};_0x2fcb02[_0x5ebc45[_0x6ed0('0x34')]]={'$like':'%'+_0x1fb162[_0x6ed0('0x41')][_0x6ed0('0x4a')]+'%'};return _0x2fcb02;}})});}_0x243514=_['merge']({},_0x243514,_0x1fb162[_0x6ed0('0x4b')]);var _0x35a572={'where':_0x243514['where']};return db['SalesforceConfiguration']['count'](_0x35a572)[_0x6ed0('0x1a')](function(_0x4d7a58){_0x314af5[_0x6ed0('0x2b')]=_0x4d7a58;if(_0x1fb162[_0x6ed0('0x41')][_0x6ed0('0x4c')]){_0x243514[_0x6ed0('0x4d')]=[{'all':!![]}];}return db[_0x6ed0('0x4e')][_0x6ed0('0x4f')](_0x243514);})[_0x6ed0('0x1a')](function(_0x29e6c1){_0x314af5[_0x6ed0('0x50')]=_0x29e6c1;return _0x314af5;})[_0x6ed0('0x1a')](respondWithFilteredResult(_0x5cdc0e,_0x243514))[_0x6ed0('0x24')](handleError(_0x5cdc0e,null));};exports[_0x6ed0('0x51')]=function(_0x2e3884,_0x2a7f15){var _0x9542e0={'raw':![],'where':{'id':_0x2e3884['params']['id']}},_0x4eaace={};_0x4eaace['model']=_[_0x6ed0('0x3c')](db['SalesforceConfiguration'][_0x6ed0('0x38')]);_0x4eaace['query']=_[_0x6ed0('0x3c')](_0x2e3884[_0x6ed0('0x41')]);_0x4eaace[_0x6ed0('0x3d')]=_[_0x6ed0('0x3e')](_0x4eaace[_0x6ed0('0x3b')],_0x4eaace[_0x6ed0('0x41')]);_0x9542e0[_0x6ed0('0x3f')]=_['intersection'](_0x4eaace[_0x6ed0('0x3b')],qs[_0x6ed0('0x40')](_0x2e3884['query'][_0x6ed0('0x40')]));_0x9542e0[_0x6ed0('0x3f')]=_0x9542e0[_0x6ed0('0x3f')]['length']?_0x9542e0[_0x6ed0('0x3f')]:_0x4eaace[_0x6ed0('0x3b')];if(_0x2e3884[_0x6ed0('0x41')]['includeAll']){_0x9542e0[_0x6ed0('0x4d')]=[{'all':!![]}];}_0x9542e0=_[_0x6ed0('0x52')]({},_0x9542e0,_0x2e3884[_0x6ed0('0x4b')]);return db[_0x6ed0('0x4e')][_0x6ed0('0x53')](_0x9542e0)[_0x6ed0('0x1a')](handleEntityNotFound(_0x2a7f15,null))[_0x6ed0('0x1a')](respondWithResult(_0x2a7f15,null))[_0x6ed0('0x24')](handleError(_0x2a7f15,null));};exports[_0x6ed0('0x54')]=function(_0x30bbee,_0x412367){return db[_0x6ed0('0x4e')][_0x6ed0('0x54')](_0x30bbee[_0x6ed0('0x55')],{})[_0x6ed0('0x1a')](respondWithResult(_0x412367,0xc9))[_0x6ed0('0x24')](handleError(_0x412367,null));};exports[_0x6ed0('0x31')]=function(_0x5af2aa,_0x275516){if(_0x5af2aa[_0x6ed0('0x55')]['id']){delete _0x5af2aa[_0x6ed0('0x55')]['id'];}return db[_0x6ed0('0x4e')][_0x6ed0('0x53')]({'where':{'id':_0x5af2aa['params']['id']}})[_0x6ed0('0x1a')](handleEntityNotFound(_0x275516,null))[_0x6ed0('0x1a')](saveUpdates(_0x5af2aa[_0x6ed0('0x55')],null))[_0x6ed0('0x1a')](respondWithResult(_0x275516,null))[_0x6ed0('0x24')](handleError(_0x275516,null));};exports[_0x6ed0('0x32')]=function(_0x3a854d,_0x20d18e){return db[_0x6ed0('0x4e')][_0x6ed0('0x53')]({'where':{'id':_0x3a854d['params']['id']}})[_0x6ed0('0x1a')](handleEntityNotFound(_0x20d18e,null))[_0x6ed0('0x1a')](removeEntity(_0x20d18e,null))[_0x6ed0('0x24')](handleError(_0x20d18e,null));};exports[_0x6ed0('0x56')]=function(_0x152b50,_0x22355a,_0x5696c2){var _0x32af76={};var _0x7d474d={};var _0x1eadbf;var _0x5a1d87;return db[_0x6ed0('0x4e')][_0x6ed0('0x57')]({'where':{'id':_0x152b50[_0x6ed0('0x58')]['id']}})[_0x6ed0('0x1a')](handleEntityNotFound(_0x22355a,null))[_0x6ed0('0x1a')](function(_0x1e99d5){if(_0x1e99d5){_0x1eadbf=_0x1e99d5;_0x7d474d[_0x6ed0('0x3b')]=_[_0x6ed0('0x3c')](db[_0x6ed0('0x59')][_0x6ed0('0x38')]);_0x7d474d[_0x6ed0('0x41')]=_[_0x6ed0('0x3c')](_0x152b50['query']);_0x7d474d[_0x6ed0('0x3d')]=_[_0x6ed0('0x3e')](_0x7d474d[_0x6ed0('0x3b')],_0x7d474d[_0x6ed0('0x41')]);_0x32af76[_0x6ed0('0x3f')]=_[_0x6ed0('0x3e')](_0x7d474d[_0x6ed0('0x3b')],qs[_0x6ed0('0x40')](_0x152b50[_0x6ed0('0x41')][_0x6ed0('0x40')]));_0x32af76['attributes']=_0x32af76[_0x6ed0('0x3f')][_0x6ed0('0x42')]?_0x32af76[_0x6ed0('0x3f')]:_0x7d474d[_0x6ed0('0x3b')];_0x32af76[_0x6ed0('0x45')]=qs[_0x6ed0('0x46')](_0x152b50[_0x6ed0('0x41')][_0x6ed0('0x46')]);_0x32af76[_0x6ed0('0x47')]=qs['filters'](_[_0x6ed0('0x48')](_0x152b50['query'],_0x7d474d[_0x6ed0('0x3d')]));if(_0x152b50[_0x6ed0('0x41')][_0x6ed0('0x4a')]){_0x32af76[_0x6ed0('0x47')]=_[_0x6ed0('0x52')](_0x32af76[_0x6ed0('0x47')],{'$or':_[_0x6ed0('0x37')](_0x32af76[_0x6ed0('0x3f')],function(_0x4339f3){var _0xadace2={};_0xadace2[_0x4339f3]={'$like':'%'+_0x152b50[_0x6ed0('0x41')][_0x6ed0('0x4a')]+'%'};return _0xadace2;})});}_0x32af76=_[_0x6ed0('0x52')]({},_0x32af76,_0x152b50[_0x6ed0('0x4b')]);return _0x1eadbf[_0x6ed0('0x56')](_0x32af76);}})[_0x6ed0('0x1a')](function(_0x4c91f3){if(_0x4c91f3){_0x5a1d87=_0x4c91f3[_0x6ed0('0x42')];if(!_0x152b50['query'][_0x6ed0('0x43')](_0x6ed0('0x44'))){_0x32af76['limit']=qs[_0x6ed0('0x2c')](_0x152b50[_0x6ed0('0x41')]['limit']);_0x32af76[_0x6ed0('0x29')]=qs[_0x6ed0('0x29')](_0x152b50[_0x6ed0('0x41')][_0x6ed0('0x29')]);}return _0x1eadbf[_0x6ed0('0x56')](_0x32af76);}})[_0x6ed0('0x1a')](function(_0x2bd2c4){if(_0x2bd2c4){return _0x2bd2c4?{'count':_0x5a1d87,'rows':_0x2bd2c4}:null;}})[_0x6ed0('0x1a')](respondWithResult(_0x22355a,null))[_0x6ed0('0x24')](handleError(_0x22355a,null));};exports['getSubjects']=function(_0x3a30e3,_0x300f52,_0x2cf0d4){var _0x2398cb={};var _0x371b07={};var _0x4d37fb;var _0x19e296;return db[_0x6ed0('0x4e')][_0x6ed0('0x57')]({'where':{'id':_0x3a30e3[_0x6ed0('0x58')]['id']}})['then'](handleEntityNotFound(_0x300f52,null))['then'](function(_0x5b6486){if(_0x5b6486){_0x4d37fb=_0x5b6486;_0x371b07['model']=_[_0x6ed0('0x3c')](db['SalesforceField'][_0x6ed0('0x38')]);_0x371b07[_0x6ed0('0x41')]=_[_0x6ed0('0x3c')](_0x3a30e3[_0x6ed0('0x41')]);_0x371b07['filters']=_[_0x6ed0('0x3e')](_0x371b07[_0x6ed0('0x3b')],_0x371b07[_0x6ed0('0x41')]);_0x2398cb[_0x6ed0('0x3f')]=_[_0x6ed0('0x3e')](_0x371b07[_0x6ed0('0x3b')],qs['fields'](_0x3a30e3[_0x6ed0('0x41')][_0x6ed0('0x40')]));_0x2398cb[_0x6ed0('0x3f')]=_0x2398cb[_0x6ed0('0x3f')][_0x6ed0('0x42')]?_0x2398cb[_0x6ed0('0x3f')]:_0x371b07[_0x6ed0('0x3b')];_0x2398cb[_0x6ed0('0x45')]=qs[_0x6ed0('0x46')](_0x3a30e3[_0x6ed0('0x41')]['sort']);_0x2398cb[_0x6ed0('0x47')]=qs['filters'](_['pick'](_0x3a30e3[_0x6ed0('0x41')],_0x371b07[_0x6ed0('0x3d')]));if(_0x3a30e3[_0x6ed0('0x41')][_0x6ed0('0x4a')]){_0x2398cb[_0x6ed0('0x47')]=_[_0x6ed0('0x52')](_0x2398cb[_0x6ed0('0x47')],{'$or':_['map'](_0x2398cb[_0x6ed0('0x3f')],function(_0x8c3552){var _0x2f7067={};_0x2f7067[_0x8c3552]={'$like':'%'+_0x3a30e3[_0x6ed0('0x41')][_0x6ed0('0x4a')]+'%'};return _0x2f7067;})});}_0x2398cb=_[_0x6ed0('0x52')]({},_0x2398cb,_0x3a30e3['options']);return _0x4d37fb['getSubjects'](_0x2398cb);}})[_0x6ed0('0x1a')](function(_0x20e40f){if(_0x20e40f){_0x19e296=_0x20e40f['length'];if(!_0x3a30e3[_0x6ed0('0x41')]['hasOwnProperty']('nolimit')){_0x2398cb[_0x6ed0('0x2c')]=qs[_0x6ed0('0x2c')](_0x3a30e3['query']['limit']);_0x2398cb[_0x6ed0('0x29')]=qs[_0x6ed0('0x29')](_0x3a30e3['query'][_0x6ed0('0x29')]);}return _0x4d37fb[_0x6ed0('0x5a')](_0x2398cb);}})[_0x6ed0('0x1a')](function(_0x1343eb){if(_0x1343eb){return _0x1343eb?{'count':_0x19e296,'rows':_0x1343eb}:null;}})[_0x6ed0('0x1a')](respondWithResult(_0x300f52,null))[_0x6ed0('0x24')](handleError(_0x300f52,null));};exports['getDescriptions']=function(_0x1a00d9,_0x160161,_0x1f38dd){var _0x1bc52c={};var _0x38db0a={};var _0x1de6a4;var _0x4e71e9;return db[_0x6ed0('0x4e')]['findOne']({'where':{'id':_0x1a00d9[_0x6ed0('0x58')]['id']}})['then'](handleEntityNotFound(_0x160161,null))['then'](function(_0x40981c){if(_0x40981c){_0x1de6a4=_0x40981c;_0x38db0a[_0x6ed0('0x3b')]=_[_0x6ed0('0x3c')](db['SalesforceField']['rawAttributes']);_0x38db0a['query']=_[_0x6ed0('0x3c')](_0x1a00d9[_0x6ed0('0x41')]);_0x38db0a[_0x6ed0('0x3d')]=_[_0x6ed0('0x3e')](_0x38db0a['model'],_0x38db0a[_0x6ed0('0x41')]);_0x1bc52c['attributes']=_['intersection'](_0x38db0a[_0x6ed0('0x3b')],qs[_0x6ed0('0x40')](_0x1a00d9[_0x6ed0('0x41')][_0x6ed0('0x40')]));_0x1bc52c[_0x6ed0('0x3f')]=_0x1bc52c[_0x6ed0('0x3f')][_0x6ed0('0x42')]?_0x1bc52c[_0x6ed0('0x3f')]:_0x38db0a['model'];_0x1bc52c[_0x6ed0('0x45')]=qs[_0x6ed0('0x46')](_0x1a00d9[_0x6ed0('0x41')]['sort']);_0x1bc52c['where']=qs[_0x6ed0('0x3d')](_[_0x6ed0('0x48')](_0x1a00d9[_0x6ed0('0x41')],_0x38db0a[_0x6ed0('0x3d')]));if(_0x1a00d9[_0x6ed0('0x41')][_0x6ed0('0x4a')]){_0x1bc52c['where']=_[_0x6ed0('0x52')](_0x1bc52c['where'],{'$or':_['map'](_0x1bc52c['attributes'],function(_0xcb63ec){var _0x46f679={};_0x46f679[_0xcb63ec]={'$like':'%'+_0x1a00d9[_0x6ed0('0x41')][_0x6ed0('0x4a')]+'%'};return _0x46f679;})});}_0x1bc52c=_[_0x6ed0('0x52')]({},_0x1bc52c,_0x1a00d9[_0x6ed0('0x4b')]);return _0x1de6a4[_0x6ed0('0x5b')](_0x1bc52c);}})[_0x6ed0('0x1a')](function(_0x314401){if(_0x314401){_0x4e71e9=_0x314401[_0x6ed0('0x42')];if(!_0x1a00d9[_0x6ed0('0x41')][_0x6ed0('0x43')](_0x6ed0('0x44'))){_0x1bc52c['limit']=qs[_0x6ed0('0x2c')](_0x1a00d9['query'][_0x6ed0('0x2c')]);_0x1bc52c['offset']=qs[_0x6ed0('0x29')](_0x1a00d9[_0x6ed0('0x41')][_0x6ed0('0x29')]);}return _0x1de6a4[_0x6ed0('0x5b')](_0x1bc52c);}})[_0x6ed0('0x1a')](function(_0x3002da){if(_0x3002da){return _0x3002da?{'count':_0x4e71e9,'rows':_0x3002da}:null;}})[_0x6ed0('0x1a')](respondWithResult(_0x160161,null))[_0x6ed0('0x24')](handleError(_0x160161,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 59755c5..3a22de5 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 _0xc1eb=['api','moment','path','rimraf','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','util'];(function(_0x56dffa,_0x225063){var _0x5f3b00=function(_0x47d804){while(--_0x47d804){_0x56dffa['push'](_0x56dffa['shift']());}};_0x5f3b00(++_0x225063);}(_0xc1eb,0x131));var _0xbc1e=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0xc1eb[_0x59eefb];return _0x1a49e8;};'use strict';var _=require('lodash');var util=require(_0xbc1e('0x0'));var logger=require('../../config/logger')(_0xbc1e('0x1'));var moment=require(_0xbc1e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc1e('0x3'));var rimraf=require(_0xbc1e('0x4'));var config=require('../../config/environment');var attributes=require(_0xbc1e('0x5'));module[_0xbc1e('0x6')]=function(_0x5c623b,_0x54625f){return _0x5c623b['define'](_0xbc1e('0x7'),attributes,{'tableName':_0xbc1e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c78=['SalesforceConfiguration','int_salesforce_configurations','util','api','bluebird','path','rimraf','../../config/environment','define'];(function(_0x1f697b,_0x33c584){var _0x5907cf=function(_0x5bfc04){while(--_0x5bfc04){_0x1f697b['push'](_0x1f697b['shift']());}};_0x5907cf(++_0x33c584);}(_0x9c78,0xec));var _0x89c7=function(_0x13e588,_0x54974c){_0x13e588=_0x13e588-0x0;var _0x118820=_0x9c78[_0x13e588];return _0x118820;};'use strict';var _=require('lodash');var util=require(_0x89c7('0x0'));var logger=require('../../config/logger')(_0x89c7('0x1'));var moment=require('moment');var BPromise=require(_0x89c7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89c7('0x3'));var rimraf=require(_0x89c7('0x4'));var config=require(_0x89c7('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0xeb31e9,_0x550c3a){return _0xeb31e9[_0x89c7('0x6')](_0x89c7('0x7'),attributes,{'tableName':_0x89c7('0x8'),'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 c1abe0d..d711bb9 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 _0xf5b3=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','SalesforceConfiguration,\x20%s,\x20%s','message','catch'];(function(_0x16351e,_0x5a8fa9){var _0x2efeb8=function(_0x10ff8d){while(--_0x10ff8d){_0x16351e['push'](_0x16351e['shift']());}};_0x2efeb8(++_0x5a8fa9);}(_0xf5b3,0x72));var _0x3f5b=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0xf5b3[_0xfedc72];return _0x2c7c78;};'use strict';var _=require(_0x3f5b('0x0'));var util=require(_0x3f5b('0x1'));var moment=require('moment');var BPromise=require(_0x3f5b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f5b('0x3'));var db=require(_0x3f5b('0x4'))['db'];var utils=require(_0x3f5b('0x5'));var logger=require(_0x3f5b('0x6'))('rpc');var config=require(_0x3f5b('0x7'));var jayson=require(_0x3f5b('0x8'));var client=jayson[_0x3f5b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10fec2,_0x2e8b4f,_0x1316d5){return new BPromise(function(_0x2ffbf0,_0x153fc9){return client[_0x3f5b('0xa')](_0x10fec2,_0x1316d5)['then'](function(_0x532bb1){logger[_0x3f5b('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2e8b4f,_0x3f5b('0xc'));logger[_0x3f5b('0xd')](_0x3f5b('0xe'),_0x2e8b4f,_0x3f5b('0xc'),JSON['stringify'](_0x532bb1));if(_0x532bb1[_0x3f5b('0xf')]){if(_0x532bb1[_0x3f5b('0xf')]['code']===0x1f4){logger[_0x3f5b('0xf')](_0x3f5b('0x10'),_0x2e8b4f,_0x532bb1['error'][_0x3f5b('0x11')]);return _0x153fc9(_0x532bb1[_0x3f5b('0xf')]['message']);}logger[_0x3f5b('0xf')](_0x3f5b('0x10'),_0x2e8b4f,_0x532bb1[_0x3f5b('0xf')][_0x3f5b('0x11')]);return _0x2ffbf0(_0x532bb1[_0x3f5b('0xf')][_0x3f5b('0x11')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x2e8b4f,_0x3f5b('0xc'));_0x2ffbf0(_0x532bb1['result'][_0x3f5b('0x11')]);}})[_0x3f5b('0x12')](function(_0x11bb6d){logger[_0x3f5b('0xf')](_0x3f5b('0x10'),_0x2e8b4f,_0x11bb6d);_0x153fc9(_0x11bb6d);});});} \ No newline at end of file +var _0xcd2b=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash'];(function(_0x41df20,_0x19c9db){var _0x3f11ac=function(_0x50ff28){while(--_0x50ff28){_0x41df20['push'](_0x41df20['shift']());}};_0x3f11ac(++_0x19c9db);}(_0xcd2b,0x109));var _0xbcd2=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcd2b[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xbcd2('0x0'));var util=require(_0xbcd2('0x1'));var moment=require('moment');var BPromise=require(_0xbcd2('0x2'));var rs=require(_0xbcd2('0x3'));var fs=require('fs');var Redis=require(_0xbcd2('0x4'));var db=require(_0xbcd2('0x5'))['db'];var utils=require(_0xbcd2('0x6'));var logger=require(_0xbcd2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbcd2('0x8'));var client=jayson[_0xbcd2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2fb8,_0x11638b,_0x4f8910){return new BPromise(function(_0x1a17c1,_0x2b33ed){return client[_0xbcd2('0xa')](_0x4e2fb8,_0x4f8910)['then'](function(_0x4de1b2){logger[_0xbcd2('0xb')](_0xbcd2('0xc'),_0x11638b,_0xbcd2('0xd'));logger[_0xbcd2('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x11638b,_0xbcd2('0xd'),JSON[_0xbcd2('0xf')](_0x4de1b2));if(_0x4de1b2['error']){if(_0x4de1b2[_0xbcd2('0x10')][_0xbcd2('0x11')]===0x1f4){logger['error'](_0xbcd2('0xc'),_0x11638b,_0x4de1b2[_0xbcd2('0x10')]['message']);return _0x2b33ed(_0x4de1b2['error'][_0xbcd2('0x12')]);}logger[_0xbcd2('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x11638b,_0x4de1b2[_0xbcd2('0x10')]['message']);return _0x1a17c1(_0x4de1b2['error'][_0xbcd2('0x12')]);}else{logger[_0xbcd2('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x11638b,'request\x20sent');_0x1a17c1(_0x4de1b2['result'][_0xbcd2('0x12')]);}})['catch'](function(_0xb5cc6c){logger[_0xbcd2('0x10')](_0xbcd2('0xc'),_0x11638b,_0xb5cc6c);_0x2b33ed(_0xb5cc6c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 6e01d15..e0a5843 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 _0xbbdd=['post','create','put','/:id','update','delete','destroy','util','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','index','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xbbdd[_0x4e7d25];return _0x526fe6;};'use strict';var multer=require('multer');var util=require(_0xdbbd('0x0'));var path=require('path');var timeout=require(_0xdbbd('0x1'));var express=require(_0xdbbd('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbbd('0x3'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0xdbbd('0x4')]('/',auth[_0xdbbd('0x5')](),controller[_0xdbbd('0x6')]);router[_0xdbbd('0x4')]('/:id',auth[_0xdbbd('0x5')](),controller[_0xdbbd('0x7')]);router[_0xdbbd('0x8')]('/',auth[_0xdbbd('0x5')](),controller[_0xdbbd('0x9')]);router[_0xdbbd('0xa')](_0xdbbd('0xb'),auth[_0xdbbd('0x5')](),controller[_0xdbbd('0xc')]);router[_0xdbbd('0xd')]('/:id',auth[_0xdbbd('0x5')](),controller[_0xdbbd('0xe')]);module['exports']=router; \ No newline at end of file +var _0x195f=['create','put','/:id','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','show','post'];(function(_0x423703,_0x275998){var _0x1a754e=function(_0x3e2ded){while(--_0x3e2ded){_0x423703['push'](_0x423703['shift']());}};_0x1a754e(++_0x275998);}(_0x195f,0x113));var _0xf195=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x195f[_0x382e89];return _0x3a1318;};'use strict';var multer=require(_0xf195('0x0'));var util=require(_0xf195('0x1'));var path=require('path');var timeout=require(_0xf195('0x2'));var express=require(_0xf195('0x3'));var router=express['Router']();var fs_extra=require(_0xf195('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf195('0x5'));var config=require(_0xf195('0x6'));var controller=require(_0xf195('0x7'));router[_0xf195('0x8')]('/',auth[_0xf195('0x9')](),controller[_0xf195('0xa')]);router[_0xf195('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf195('0xb')]);router[_0xf195('0xc')]('/',auth[_0xf195('0x9')](),controller[_0xf195('0xd')]);router[_0xf195('0xe')](_0xf195('0xf'),auth[_0xf195('0x9')](),controller['update']);router[_0xf195('0x10')](_0xf195('0xf'),auth[_0xf195('0x9')](),controller['destroy']);module[_0xf195('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index c60ff11..31fb104 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 _0x9c44=['variable','customVariable','keyValue','picklist','STRING','ENUM','string'];(function(_0x34e73f,_0x2455fa){var _0x261b93=function(_0x282044){while(--_0x282044){_0x34e73f['push'](_0x34e73f['shift']());}};_0x261b93(++_0x2455fa);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x49c4('0x0')](_0x49c4('0x1'),_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x49c4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x49c4('0x1'),_0x49c4('0x2'),_0x49c4('0x3'))},'keyContent':{'type':Sequelize[_0x49c4('0x6')]},'idField':{'type':Sequelize[_0x49c4('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xedd9=['customVariable','keyValue','picklist','STRING','exports','ENUM','string','variable'];(function(_0x1db923,_0x426bc8){var _0x2bf565=function(_0x381b74){while(--_0x381b74){_0x1db923['push'](_0x1db923['shift']());}};_0x2bf565(++_0x426bc8);}(_0xedd9,0xfc));var _0x9edd=function(_0x49e11c,_0x55d3a5){_0x49e11c=_0x49e11c-0x0;var _0x46f14a=_0xedd9[_0x49e11c];return _0x46f14a;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'type':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2'),_0x9edd('0x3'),_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'defaultValue':_0x9edd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9edd('0x7')]},'keyType':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2'),_0x9edd('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x9edd('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 785bac9..74172f2 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 _0x21c4=['offset','limit','Content-Range','apply','reject','save','destroy','error','name','send','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','options','SalesforceField','count','then','includeAll','include','findAll','rows','show','params','keys','create','body','catch','find','eml-format','rimraf','zip-dir','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x39e2d7,_0x1b15f6){var _0x413d0d=function(_0x3af71d){while(--_0x3af71d){_0x39e2d7['push'](_0x39e2d7['shift']());}};_0x413d0d(++_0x1b15f6);}(_0x21c4,0xfc));var _0x421c=function(_0x2acd35,_0x2b21df){_0x2acd35=_0x2acd35-0x0;var _0x272693=_0x21c4[_0x2acd35];return _0x272693;};'use strict';var emlformat=require(_0x421c('0x0'));var rimraf=require(_0x421c('0x1'));var zipdir=require(_0x421c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x421c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x421c('0x4'));var path=require('path');var sox=require(_0x421c('0x5'));var csv=require(_0x421c('0x6'));var ejs=require(_0x421c('0x7'));var fs=require('fs');var fs_extra=require(_0x421c('0x8'));var _=require(_0x421c('0x9'));var squel=require(_0x421c('0xa'));var crypto=require('crypto');var jsforce=require(_0x421c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x421c('0xc'));var Papa=require(_0x421c('0xd'));var Redis=require('ioredis');var authService=require(_0x421c('0xe'));var qs=require(_0x421c('0xf'));var as=require(_0x421c('0x10'));var hardwareService=require(_0x421c('0x11'));var logger=require(_0x421c('0x12'))(_0x421c('0x13'));var utils=require(_0x421c('0x14'));var config=require(_0x421c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x421c('0x16'))['db'];function respondWithStatusCode(_0x80c22d,_0x6df73d){_0x6df73d=_0x6df73d||0xcc;return function(_0x25270c){if(_0x25270c){return _0x80c22d[_0x421c('0x17')](_0x6df73d);}return _0x80c22d[_0x421c('0x18')](_0x6df73d)[_0x421c('0x19')]();};}function respondWithResult(_0x5b6879,_0x45e0b2){_0x45e0b2=_0x45e0b2||0xc8;return function(_0x259f49){if(_0x259f49){return _0x5b6879[_0x421c('0x18')](_0x45e0b2)[_0x421c('0x1a')](_0x259f49);}};}function respondWithFilteredResult(_0x49f2e1,_0x179b71){return function(_0xc8da57){if(_0xc8da57){var _0xca83cf=typeof _0x179b71['offset']==='undefined'&&typeof _0x179b71['limit']===_0x421c('0x1b');var _0x191b56=_0xc8da57['count'];var _0x5098be=_0xca83cf?0x0:_0x179b71[_0x421c('0x1c')];var _0x229a4d=_0xca83cf?_0xc8da57['count']:_0x179b71[_0x421c('0x1c')]+_0x179b71[_0x421c('0x1d')];var _0x11669d;if(_0x229a4d>=_0x191b56){_0x229a4d=_0x191b56;_0x11669d=0xc8;}else{_0x11669d=0xce;}_0x49f2e1[_0x421c('0x18')](_0x11669d);return _0x49f2e1['set'](_0x421c('0x1e'),_0x5098be+'-'+_0x229a4d+'/'+_0x191b56)[_0x421c('0x1a')](_0xc8da57);}return null;};}function patchUpdates(_0x267c08){return function(_0x3be28c){try{jsonpatch[_0x421c('0x1f')](_0x3be28c,_0x267c08,!![]);}catch(_0x2d6460){return BPromise[_0x421c('0x20')](_0x2d6460);}return _0x3be28c[_0x421c('0x21')]();};}function saveUpdates(_0x1cc0d8,_0x1c8d51){return function(_0xfe475d){if(_0xfe475d){return _0xfe475d['update'](_0x1cc0d8)['then'](function(_0x28783f){return _0x28783f;});}return null;};}function removeEntity(_0x1e5cd4,_0x4fc4d7){return function(_0x39e088){if(_0x39e088){return _0x39e088[_0x421c('0x22')]()['then'](function(){_0x1e5cd4[_0x421c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d2ed,_0x46d650){return function(_0x266a71){if(!_0x266a71){_0x19d2ed[_0x421c('0x17')](0x194);}return _0x266a71;};}function handleError(_0x551af7,_0x1f99fb){_0x1f99fb=_0x1f99fb||0x1f4;return function(_0x5103c1){logger[_0x421c('0x23')](_0x5103c1['stack']);if(_0x5103c1[_0x421c('0x24')]){delete _0x5103c1['name'];}_0x551af7[_0x421c('0x18')](_0x1f99fb)[_0x421c('0x25')](_0x5103c1);};}exports['index']=function(_0x2058e5,_0x462c9a){var _0xbbb45a={},_0x290963={},_0x371a22={'count':0x0,'rows':[]};var _0x275a70=_['map'](db['SalesforceField'][_0x421c('0x26')],function(_0x12bbd4){return{'name':_0x12bbd4['fieldName'],'type':_0x12bbd4[_0x421c('0x27')][_0x421c('0x28')]};});_0x290963['model']=_[_0x421c('0x29')](_0x275a70,_0x421c('0x24'));_0x290963[_0x421c('0x2a')]=_['keys'](_0x2058e5[_0x421c('0x2a')]);_0x290963[_0x421c('0x2b')]=_[_0x421c('0x2c')](_0x290963[_0x421c('0x2d')],_0x290963['query']);_0xbbb45a[_0x421c('0x2e')]=_['intersection'](_0x290963['model'],qs[_0x421c('0x2f')](_0x2058e5[_0x421c('0x2a')][_0x421c('0x2f')]));_0xbbb45a[_0x421c('0x2e')]=_0xbbb45a[_0x421c('0x2e')][_0x421c('0x30')]?_0xbbb45a['attributes']:_0x290963[_0x421c('0x2d')];if(!_0x2058e5['query']['hasOwnProperty']('nolimit')){_0xbbb45a[_0x421c('0x1d')]=qs[_0x421c('0x1d')](_0x2058e5[_0x421c('0x2a')][_0x421c('0x1d')]);_0xbbb45a[_0x421c('0x1c')]=qs[_0x421c('0x1c')](_0x2058e5[_0x421c('0x2a')]['offset']);}_0xbbb45a[_0x421c('0x31')]=qs[_0x421c('0x32')](_0x2058e5[_0x421c('0x2a')][_0x421c('0x32')]);_0xbbb45a['where']=qs[_0x421c('0x2b')](_[_0x421c('0x33')](_0x2058e5['query'],_0x290963['filters']),_0x275a70);if(_0x2058e5[_0x421c('0x2a')]['filter']){_0xbbb45a[_0x421c('0x34')]=_[_0x421c('0x35')](_0xbbb45a[_0x421c('0x34')],{'$or':_[_0x421c('0x29')](_0x275a70,function(_0x21146e){if(_0x21146e['type']!==_0x421c('0x36')){var _0x395f52={};_0x395f52[_0x21146e[_0x421c('0x24')]]={'$like':'%'+_0x2058e5[_0x421c('0x2a')]['filter']+'%'};return _0x395f52;}})});}_0xbbb45a=_[_0x421c('0x35')]({},_0xbbb45a,_0x2058e5[_0x421c('0x37')]);var _0x552c8f={'where':_0xbbb45a[_0x421c('0x34')]};return db[_0x421c('0x38')][_0x421c('0x39')](_0x552c8f)[_0x421c('0x3a')](function(_0xa9dcd9){_0x371a22[_0x421c('0x39')]=_0xa9dcd9;if(_0x2058e5[_0x421c('0x2a')][_0x421c('0x3b')]){_0xbbb45a[_0x421c('0x3c')]=[{'all':!![]}];}return db[_0x421c('0x38')][_0x421c('0x3d')](_0xbbb45a);})['then'](function(_0x3a7eda){_0x371a22[_0x421c('0x3e')]=_0x3a7eda;return _0x371a22;})['then'](respondWithFilteredResult(_0x462c9a,_0xbbb45a))['catch'](handleError(_0x462c9a,null));};exports[_0x421c('0x3f')]=function(_0x1a674a,_0x1f05aa){var _0x2f0f2f={'raw':!![],'where':{'id':_0x1a674a[_0x421c('0x40')]['id']}},_0x4e358e={};_0x4e358e[_0x421c('0x2d')]=_[_0x421c('0x41')](db[_0x421c('0x38')][_0x421c('0x26')]);_0x4e358e['query']=_[_0x421c('0x41')](_0x1a674a['query']);_0x4e358e[_0x421c('0x2b')]=_['intersection'](_0x4e358e[_0x421c('0x2d')],_0x4e358e[_0x421c('0x2a')]);_0x2f0f2f[_0x421c('0x2e')]=_[_0x421c('0x2c')](_0x4e358e['model'],qs[_0x421c('0x2f')](_0x1a674a['query'][_0x421c('0x2f')]));_0x2f0f2f['attributes']=_0x2f0f2f[_0x421c('0x2e')][_0x421c('0x30')]?_0x2f0f2f['attributes']:_0x4e358e[_0x421c('0x2d')];if(_0x1a674a[_0x421c('0x2a')]['includeAll']){_0x2f0f2f[_0x421c('0x3c')]=[{'all':!![]}];}_0x2f0f2f=_[_0x421c('0x35')]({},_0x2f0f2f,_0x1a674a[_0x421c('0x37')]);return db[_0x421c('0x38')]['find'](_0x2f0f2f)['then'](handleEntityNotFound(_0x1f05aa,null))['then'](respondWithResult(_0x1f05aa,null))['catch'](handleError(_0x1f05aa,null));};exports['create']=function(_0xb4a0dc,_0x2d7e90){return db[_0x421c('0x38')][_0x421c('0x42')](_0xb4a0dc[_0x421c('0x43')],{})[_0x421c('0x3a')](respondWithResult(_0x2d7e90,0xc9))[_0x421c('0x44')](handleError(_0x2d7e90,null));};exports['update']=function(_0x2c7af,_0x416b1a){if(_0x2c7af[_0x421c('0x43')]['id']){delete _0x2c7af[_0x421c('0x43')]['id'];}return db[_0x421c('0x38')]['find']({'where':{'id':_0x2c7af[_0x421c('0x40')]['id']}})['then'](handleEntityNotFound(_0x416b1a,null))['then'](saveUpdates(_0x2c7af[_0x421c('0x43')],null))['then'](respondWithResult(_0x416b1a,null))[_0x421c('0x44')](handleError(_0x416b1a,null));};exports[_0x421c('0x22')]=function(_0x54d1dc,_0x3cbf25){return db[_0x421c('0x38')][_0x421c('0x45')]({'where':{'id':_0x54d1dc[_0x421c('0x40')]['id']}})['then'](handleEntityNotFound(_0x3cbf25,null))[_0x421c('0x3a')](removeEntity(_0x3cbf25,null))[_0x421c('0x44')](handleError(_0x3cbf25,null));}; \ No newline at end of file +var _0xa42a=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','stack','send','index','rawAttributes','fieldName','type','key','map','name','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceField','includeAll','include','findAll','show','keys','length','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x375ea6,_0x48f9c5){var _0x6a76da=function(_0x488d33){while(--_0x488d33){_0x375ea6['push'](_0x375ea6['shift']());}};_0x6a76da(++_0x48f9c5);}(_0xa42a,0x125));var _0xaa42=function(_0x5bebc5,_0x39bdeb){_0x5bebc5=_0x5bebc5-0x0;var _0x538278=_0xa42a[_0x5bebc5];return _0x538278;};'use strict';var emlformat=require(_0xaa42('0x0'));var rimraf=require(_0xaa42('0x1'));var zipdir=require(_0xaa42('0x2'));var jsonpatch=require(_0xaa42('0x3'));var rp=require(_0xaa42('0x4'));var moment=require('moment');var BPromise=require(_0xaa42('0x5'));var Mustache=require(_0xaa42('0x6'));var util=require(_0xaa42('0x7'));var path=require(_0xaa42('0x8'));var sox=require('sox');var csv=require(_0xaa42('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa42('0xa'));var _=require(_0xaa42('0xb'));var squel=require(_0xaa42('0xc'));var crypto=require(_0xaa42('0xd'));var jsforce=require(_0xaa42('0xe'));var deskjs=require(_0xaa42('0xf'));var toCsv=require(_0xaa42('0x9'));var querystring=require('querystring');var Papa=require(_0xaa42('0x10'));var Redis=require(_0xaa42('0x11'));var authService=require(_0xaa42('0x12'));var qs=require(_0xaa42('0x13'));var as=require(_0xaa42('0x14'));var hardwareService=require(_0xaa42('0x15'));var logger=require(_0xaa42('0x16'))(_0xaa42('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaa42('0x18'));var db=require(_0xaa42('0x19'))['db'];function respondWithStatusCode(_0x4a3530,_0x5bdbb4){_0x5bdbb4=_0x5bdbb4||0xcc;return function(_0x29b7c5){if(_0x29b7c5){return _0x4a3530[_0xaa42('0x1a')](_0x5bdbb4);}return _0x4a3530[_0xaa42('0x1b')](_0x5bdbb4)['end']();};}function respondWithResult(_0x38c6a4,_0x5a0b84){_0x5a0b84=_0x5a0b84||0xc8;return function(_0x393f20){if(_0x393f20){return _0x38c6a4[_0xaa42('0x1b')](_0x5a0b84)[_0xaa42('0x1c')](_0x393f20);}};}function respondWithFilteredResult(_0x33bd07,_0x4cd2f7){return function(_0x4eee63){if(_0x4eee63){var _0x3e17a0=typeof _0x4cd2f7[_0xaa42('0x1d')]===_0xaa42('0x1e')&&typeof _0x4cd2f7[_0xaa42('0x1f')]==='undefined';var _0x36a32f=_0x4eee63[_0xaa42('0x20')];var _0x33afe8=_0x3e17a0?0x0:_0x4cd2f7['offset'];var _0x5dc971=_0x3e17a0?_0x4eee63[_0xaa42('0x20')]:_0x4cd2f7[_0xaa42('0x1d')]+_0x4cd2f7['limit'];var _0x395328;if(_0x5dc971>=_0x36a32f){_0x5dc971=_0x36a32f;_0x395328=0xc8;}else{_0x395328=0xce;}_0x33bd07['status'](_0x395328);return _0x33bd07[_0xaa42('0x21')]('Content-Range',_0x33afe8+'-'+_0x5dc971+'/'+_0x36a32f)[_0xaa42('0x1c')](_0x4eee63);}return null;};}function patchUpdates(_0x5992dd){return function(_0x4bf136){try{jsonpatch[_0xaa42('0x22')](_0x4bf136,_0x5992dd,!![]);}catch(_0x23a35f){return BPromise[_0xaa42('0x23')](_0x23a35f);}return _0x4bf136[_0xaa42('0x24')]();};}function saveUpdates(_0x4b322d,_0x40a692){return function(_0x3c5ff7){if(_0x3c5ff7){return _0x3c5ff7[_0xaa42('0x25')](_0x4b322d)['then'](function(_0x52b4bb){return _0x52b4bb;});}return null;};}function removeEntity(_0x26fd8a,_0x3d5c38){return function(_0x4d0365){if(_0x4d0365){return _0x4d0365[_0xaa42('0x26')]()[_0xaa42('0x27')](function(){_0x26fd8a[_0xaa42('0x1b')](0xcc)[_0xaa42('0x28')]();});}};}function handleEntityNotFound(_0x2ffce7,_0x235c41){return function(_0x12d654){if(!_0x12d654){_0x2ffce7[_0xaa42('0x1a')](0x194);}return _0x12d654;};}function handleError(_0x41cb7f,_0x121fa2){_0x121fa2=_0x121fa2||0x1f4;return function(_0x32fdb0){logger['error'](_0x32fdb0[_0xaa42('0x29')]);if(_0x32fdb0['name']){delete _0x32fdb0['name'];}_0x41cb7f[_0xaa42('0x1b')](_0x121fa2)[_0xaa42('0x2a')](_0x32fdb0);};}exports[_0xaa42('0x2b')]=function(_0x177248,_0x2e6dcb){var _0x22995a={},_0x52af0e={},_0x5b8fb5={'count':0x0,'rows':[]};var _0xfa32d5=_['map'](db['SalesforceField'][_0xaa42('0x2c')],function(_0x26e81b){return{'name':_0x26e81b[_0xaa42('0x2d')],'type':_0x26e81b[_0xaa42('0x2e')][_0xaa42('0x2f')]};});_0x52af0e['model']=_[_0xaa42('0x30')](_0xfa32d5,_0xaa42('0x31'));_0x52af0e[_0xaa42('0x32')]=_['keys'](_0x177248[_0xaa42('0x32')]);_0x52af0e[_0xaa42('0x33')]=_[_0xaa42('0x34')](_0x52af0e['model'],_0x52af0e[_0xaa42('0x32')]);_0x22995a[_0xaa42('0x35')]=_[_0xaa42('0x34')](_0x52af0e[_0xaa42('0x36')],qs['fields'](_0x177248[_0xaa42('0x32')][_0xaa42('0x37')]));_0x22995a[_0xaa42('0x35')]=_0x22995a[_0xaa42('0x35')]['length']?_0x22995a[_0xaa42('0x35')]:_0x52af0e['model'];if(!_0x177248[_0xaa42('0x32')][_0xaa42('0x38')](_0xaa42('0x39'))){_0x22995a[_0xaa42('0x1f')]=qs[_0xaa42('0x1f')](_0x177248['query'][_0xaa42('0x1f')]);_0x22995a[_0xaa42('0x1d')]=qs[_0xaa42('0x1d')](_0x177248[_0xaa42('0x32')][_0xaa42('0x1d')]);}_0x22995a['order']=qs[_0xaa42('0x3a')](_0x177248[_0xaa42('0x32')][_0xaa42('0x3a')]);_0x22995a[_0xaa42('0x3b')]=qs['filters'](_[_0xaa42('0x3c')](_0x177248['query'],_0x52af0e[_0xaa42('0x33')]),_0xfa32d5);if(_0x177248[_0xaa42('0x32')][_0xaa42('0x3d')]){_0x22995a['where']=_[_0xaa42('0x3e')](_0x22995a[_0xaa42('0x3b')],{'$or':_[_0xaa42('0x30')](_0xfa32d5,function(_0x1f6aac){if(_0x1f6aac['type']!==_0xaa42('0x3f')){var _0x59f141={};_0x59f141[_0x1f6aac[_0xaa42('0x31')]]={'$like':'%'+_0x177248[_0xaa42('0x32')][_0xaa42('0x3d')]+'%'};return _0x59f141;}})});}_0x22995a=_[_0xaa42('0x3e')]({},_0x22995a,_0x177248[_0xaa42('0x40')]);var _0xee93eb={'where':_0x22995a[_0xaa42('0x3b')]};return db[_0xaa42('0x41')]['count'](_0xee93eb)['then'](function(_0x1036c6){_0x5b8fb5[_0xaa42('0x20')]=_0x1036c6;if(_0x177248['query'][_0xaa42('0x42')]){_0x22995a[_0xaa42('0x43')]=[{'all':!![]}];}return db['SalesforceField'][_0xaa42('0x44')](_0x22995a);})[_0xaa42('0x27')](function(_0x412372){_0x5b8fb5['rows']=_0x412372;return _0x5b8fb5;})[_0xaa42('0x27')](respondWithFilteredResult(_0x2e6dcb,_0x22995a))['catch'](handleError(_0x2e6dcb,null));};exports[_0xaa42('0x45')]=function(_0x59fd19,_0x2b2846){var _0x2c46c5={'raw':!![],'where':{'id':_0x59fd19['params']['id']}},_0x2b1b14={};_0x2b1b14['model']=_[_0xaa42('0x46')](db[_0xaa42('0x41')][_0xaa42('0x2c')]);_0x2b1b14[_0xaa42('0x32')]=_[_0xaa42('0x46')](_0x59fd19[_0xaa42('0x32')]);_0x2b1b14[_0xaa42('0x33')]=_['intersection'](_0x2b1b14[_0xaa42('0x36')],_0x2b1b14[_0xaa42('0x32')]);_0x2c46c5['attributes']=_['intersection'](_0x2b1b14[_0xaa42('0x36')],qs[_0xaa42('0x37')](_0x59fd19[_0xaa42('0x32')]['fields']));_0x2c46c5[_0xaa42('0x35')]=_0x2c46c5[_0xaa42('0x35')][_0xaa42('0x47')]?_0x2c46c5[_0xaa42('0x35')]:_0x2b1b14[_0xaa42('0x36')];if(_0x59fd19[_0xaa42('0x32')][_0xaa42('0x42')]){_0x2c46c5[_0xaa42('0x43')]=[{'all':!![]}];}_0x2c46c5=_[_0xaa42('0x3e')]({},_0x2c46c5,_0x59fd19[_0xaa42('0x40')]);return db[_0xaa42('0x41')]['find'](_0x2c46c5)[_0xaa42('0x27')](handleEntityNotFound(_0x2b2846,null))[_0xaa42('0x27')](respondWithResult(_0x2b2846,null))[_0xaa42('0x48')](handleError(_0x2b2846,null));};exports[_0xaa42('0x49')]=function(_0x4e67b0,_0x54f132){return db[_0xaa42('0x41')]['create'](_0x4e67b0['body'],{})['then'](respondWithResult(_0x54f132,0xc9))['catch'](handleError(_0x54f132,null));};exports[_0xaa42('0x25')]=function(_0x1a3463,_0x559c56){if(_0x1a3463[_0xaa42('0x4a')]['id']){delete _0x1a3463[_0xaa42('0x4a')]['id'];}return db[_0xaa42('0x41')][_0xaa42('0x4b')]({'where':{'id':_0x1a3463[_0xaa42('0x4c')]['id']}})[_0xaa42('0x27')](handleEntityNotFound(_0x559c56,null))[_0xaa42('0x27')](saveUpdates(_0x1a3463['body'],null))[_0xaa42('0x27')](respondWithResult(_0x559c56,null))['catch'](handleError(_0x559c56,null));};exports[_0xaa42('0x26')]=function(_0x105d87,_0x5417b1){return db[_0xaa42('0x41')]['find']({'where':{'id':_0x105d87[_0xaa42('0x4c')]['id']}})[_0xaa42('0x27')](handleEntityNotFound(_0x5417b1,null))['then'](removeEntity(_0x5417b1,null))[_0xaa42('0x48')](handleError(_0x5417b1,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 543fcc7..28040c9 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 _0x665a=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','util','api','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x56ee6d,_0x195268){var _0x4f6357=function(_0x406775){while(--_0x406775){_0x56ee6d['push'](_0x56ee6d['shift']());}};_0x4f6357(++_0x195268);}(_0x665a,0xbc));var _0xa665=function(_0x3b9b2e,_0x1d3afe){_0x3b9b2e=_0x3b9b2e-0x0;var _0x3e1a74=_0x665a[_0x3b9b2e];return _0x3e1a74;};'use strict';var _=require('lodash');var util=require(_0xa665('0x0'));var logger=require('../../config/logger')(_0xa665('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa665('0x2'));var fs=require('fs');var path=require(_0xa665('0x3'));var rimraf=require(_0xa665('0x4'));var config=require(_0xa665('0x5'));var attributes=require(_0xa665('0x6'));module[_0xa665('0x7')]=function(_0x5625f1,_0x2771ea){return _0x5625f1[_0xa665('0x8')](_0xa665('0x9'),attributes,{'tableName':_0xa665('0xa'),'paranoid':![],'indexes':[{'name':_0xa665('0xb'),'fields':[_0xa665('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe50e=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x4e091c,_0x27e613){var _0x4a0c80=function(_0x36d0ca){while(--_0x36d0ca){_0x4e091c['push'](_0x4e091c['shift']());}};_0x4a0c80(++_0x27e613);}(_0xe50e,0xf9));var _0xee50=function(_0x4cf328,_0x5d851e){_0x4cf328=_0x4cf328-0x0;var _0x391da4=_0xe50e[_0x4cf328];return _0x391da4;};'use strict';var _=require(_0xee50('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xee50('0x1'));var BPromise=require(_0xee50('0x2'));var rp=require(_0xee50('0x3'));var fs=require('fs');var path=require(_0xee50('0x4'));var rimraf=require(_0xee50('0x5'));var config=require(_0xee50('0x6'));var attributes=require(_0xee50('0x7'));module[_0xee50('0x8')]=function(_0x3fe965,_0x3b0585){return _0x3fe965[_0xee50('0x9')](_0xee50('0xa'),attributes,{'tableName':_0xee50('0xb'),'paranoid':![],'indexes':[{'name':_0xee50('0xc'),'fields':[_0xee50('0xd'),_0xee50('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 e731189..5e58659 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 _0xdace=['request\x20sent','debug','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0xdace,0xc5));var _0xedac=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0xdace[_0x59ee41];return _0x3ecd3e;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('SalesforceField,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x2b871b,_0x2ced5d){var _0x36918b=function(_0x101552){while(--_0x101552){_0x2b871b['push'](_0x2b871b['shift']());}};_0x36918b(++_0x2ced5d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0xcb91[_0x41d02a];return _0x4c3983;};'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')]('SalesforceField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index b787f7b..c517a72 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 _0xd4f4=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update'];(function(_0x16cf7e,_0x623417){var _0x5d8965=function(_0x408bc6){while(--_0x408bc6){_0x16cf7e['push'](_0x16cf7e['shift']());}};_0x5d8965(++_0x623417);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x2bba78,_0xb83302){_0x2bba78=_0x2bba78-0x0;var _0x3d7e9f=_0xd4f4[_0x2bba78];return _0x3d7e9f;};'use strict';var multer=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var path=require(_0x4d4f('0x2'));var timeout=require(_0x4d4f('0x3'));var express=require(_0x4d4f('0x4'));var router=express[_0x4d4f('0x5')]();var fs_extra=require(_0x4d4f('0x6'));var auth=require(_0x4d4f('0x7'));var interaction=require(_0x4d4f('0x8'));var config=require(_0x4d4f('0x9'));var controller=require(_0x4d4f('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4d4f('0xb')](_0x4d4f('0xc'),auth[_0x4d4f('0xd')](),controller[_0x4d4f('0xe')]);router[_0x4d4f('0xb')](_0x4d4f('0xf'),auth[_0x4d4f('0xd')](),controller[_0x4d4f('0x10')]);router[_0x4d4f('0xb')](_0x4d4f('0x11'),auth[_0x4d4f('0xd')](),controller[_0x4d4f('0x12')]);router[_0x4d4f('0x13')]('/',auth[_0x4d4f('0xd')](),controller[_0x4d4f('0x14')]);router[_0x4d4f('0x13')](_0x4d4f('0xf'),auth[_0x4d4f('0xd')](),controller['addConfiguration']);router['put']('/:id',auth[_0x4d4f('0xd')](),controller[_0x4d4f('0x15')]);router['delete'](_0x4d4f('0xc'),auth[_0x4d4f('0xd')](),controller[_0x4d4f('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0598=['delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','create','post','put','update'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x0598,0x92));var _0x8059=function(_0x15c4a8,_0x2c8bf5){_0x15c4a8=_0x15c4a8-0x0;var _0x1a3cdd=_0x0598[_0x15c4a8];return _0x1a3cdd;};'use strict';var multer=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var path=require('path');var timeout=require(_0x8059('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8059('0x3'));var auth=require(_0x8059('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0x8059('0x5')]('/',auth[_0x8059('0x6')](),controller['index']);router['get'](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0x8')]);router[_0x8059('0x5')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8059('0x9')]);router[_0x8059('0x5')](_0x8059('0xa'),auth[_0x8059('0x6')](),controller[_0x8059('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8059('0xc')]);router[_0x8059('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x8059('0xe')](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0xf')]);router[_0x8059('0x10')]('/:id',auth[_0x8059('0x6')](),controller['destroy']);module[_0x8059('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 5ef5e3f..7764750 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 _0x2507=['username','sequelize','STRING'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x2507,0x1f3));var _0x7250=function(_0x7032e1,_0x26a67c){_0x7032e1=_0x7032e1-0x0;var _0x2c663c=_0x2507[_0x7032e1];return _0x2c663c;};'use strict';var Sequelize=require(_0x7250('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7250('0x1')]},'username':{'type':Sequelize[_0x7250('0x1')],'unique':_0x7250('0x2')},'password':{'type':Sequelize[_0x7250('0x1')]},'email':{'type':Sequelize[_0x7250('0x1')]},'remoteUri':{'type':Sequelize[_0x7250('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x7250('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xdb63=['STRING','username','remoteUri','sequelize','exports'];(function(_0x16ffdd,_0x40d7a5){var _0x2d7d04=function(_0x5927b6){while(--_0x5927b6){_0x16ffdd['push'](_0x16ffdd['shift']());}};_0x2d7d04(++_0x40d7a5);}(_0xdb63,0xee));var _0x3db6=function(_0x45dae5,_0x1b4380){_0x45dae5=_0x45dae5-0x0;var _0x311c1e=_0xdb63[_0x45dae5];return _0x311c1e;};'use strict';var Sequelize=require(_0x3db6('0x0'));module[_0x3db6('0x1')]={'name':{'type':Sequelize[_0x3db6('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3db6('0x2')],'unique':_0x3db6('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3db6('0x2')]},'remoteUri':{'type':Sequelize[_0x3db6('0x2')],'unique':_0x3db6('0x4')},'serverUrl':{'type':Sequelize[_0x3db6('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 ffb6a52..1e746bb 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 _0xad63=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','status','end','offset','undefined','limit','count','set','json','apply','save','update','sendStatus','name','index','map','type','key','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','merge','options','ServicenowAccount','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','active','business_service','sys_domain_path','rfc','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','reopened_by','urgency','company','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','assign','remove','forEach','internalType','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','stack','send','Wrong\x20credentials','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x7efe31,_0x1b42d3){var _0x59ea5a=function(_0x299f73){while(--_0x299f73){_0x7efe31['push'](_0x7efe31['shift']());}};_0x59ea5a(++_0x1b42d3);}(_0xad63,0xb1));var _0x3ad6=function(_0x9eb4c5,_0x2e064c){_0x9eb4c5=_0x9eb4c5-0x0;var _0x6c0da5=_0xad63[_0x9eb4c5];return _0x6c0da5;};'use strict';var emlformat=require(_0x3ad6('0x0'));var rimraf=require(_0x3ad6('0x1'));var zipdir=require(_0x3ad6('0x2'));var jsonpatch=require(_0x3ad6('0x3'));var rp=require(_0x3ad6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3ad6('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3ad6('0x6'));var csv=require(_0x3ad6('0x7'));var ejs=require(_0x3ad6('0x8'));var fs=require('fs');var fs_extra=require(_0x3ad6('0x9'));var _=require('lodash');var squel=require(_0x3ad6('0xa'));var crypto=require(_0x3ad6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3ad6('0xc'));var toCsv=require(_0x3ad6('0x7'));var querystring=require(_0x3ad6('0xd'));var Papa=require(_0x3ad6('0xe'));var Redis=require(_0x3ad6('0xf'));var authService=require(_0x3ad6('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ad6('0x11'));var logger=require(_0x3ad6('0x12'))(_0x3ad6('0x13'));var utils=require(_0x3ad6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3ad6('0x15'));var db=require(_0x3ad6('0x16'))['db'];var integrations=require(_0x3ad6('0x17'));var jayson=require(_0x3ad6('0x18'));var client=jayson['client'][_0x3ad6('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4b04ea,_0x5a721f,_0x4feb5a,_0x23b805){return new BPromise(function(_0x316433,_0x128dbf){var _0x3ef7c6=_0x23b805||client;return _0x3ef7c6['request'](_0x4b04ea,_0x4feb5a)[_0x3ad6('0x1a')](function(_0x56f9fe){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x5a721f,_0x3ad6('0x1b'));logger[_0x3ad6('0x1c')](_0x3ad6('0x1d'),_0x5a721f,_0x3ad6('0x1b'),JSON['stringify'](_0x56f9fe));if(_0x56f9fe[_0x3ad6('0x1e')]){if(_0x56f9fe['error'][_0x3ad6('0x1f')]===0x1f4){logger['error'](_0x3ad6('0x20'),_0x5a721f,_0x56f9fe[_0x3ad6('0x1e')][_0x3ad6('0x21')]);return _0x128dbf(_0x56f9fe[_0x3ad6('0x1e')][_0x3ad6('0x21')]);}logger[_0x3ad6('0x1e')]('ServicenowAccount,\x20%s,\x20%s',_0x5a721f,_0x56f9fe[_0x3ad6('0x1e')][_0x3ad6('0x21')]);return _0x316433(_0x56f9fe[_0x3ad6('0x1e')][_0x3ad6('0x21')]);}else{logger[_0x3ad6('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x5a721f,_0x3ad6('0x1b'));_0x316433(_0x56f9fe['result']['message']);}})['catch'](function(_0x3c1287){logger[_0x3ad6('0x1e')](_0x3ad6('0x20'),_0x5a721f,_0x3c1287);_0x128dbf(_0x3c1287);});});}function respondWithStatusCode(_0x57ca0b,_0x2ad8d9){_0x2ad8d9=_0x2ad8d9||0xcc;return function(_0x230cb4){if(_0x230cb4){return _0x57ca0b['sendStatus'](_0x2ad8d9);}return _0x57ca0b[_0x3ad6('0x23')](_0x2ad8d9)[_0x3ad6('0x24')]();};}function respondWithResult(_0x549409,_0x4003ae){_0x4003ae=_0x4003ae||0xc8;return function(_0x534090){if(_0x534090){return _0x549409['status'](_0x4003ae)['json'](_0x534090);}};}function respondWithFilteredResult(_0x3bbe21,_0x57e24c){return function(_0x42e9dd){if(_0x42e9dd){var _0x2e8eeb=typeof _0x57e24c[_0x3ad6('0x25')]===_0x3ad6('0x26')&&typeof _0x57e24c[_0x3ad6('0x27')]===_0x3ad6('0x26');var _0x1c338c=_0x42e9dd[_0x3ad6('0x28')];var _0x36f8bb=_0x2e8eeb?0x0:_0x57e24c[_0x3ad6('0x25')];var _0x410aa0=_0x2e8eeb?_0x42e9dd[_0x3ad6('0x28')]:_0x57e24c[_0x3ad6('0x25')]+_0x57e24c['limit'];var _0x342954;if(_0x410aa0>=_0x1c338c){_0x410aa0=_0x1c338c;_0x342954=0xc8;}else{_0x342954=0xce;}_0x3bbe21[_0x3ad6('0x23')](_0x342954);return _0x3bbe21[_0x3ad6('0x29')]('Content-Range',_0x36f8bb+'-'+_0x410aa0+'/'+_0x1c338c)[_0x3ad6('0x2a')](_0x42e9dd);}return null;};}function patchUpdates(_0x19c0d4){return function(_0x1b84da){try{jsonpatch[_0x3ad6('0x2b')](_0x1b84da,_0x19c0d4,!![]);}catch(_0x17de10){return BPromise['reject'](_0x17de10);}return _0x1b84da[_0x3ad6('0x2c')]();};}function saveUpdates(_0x51d68f,_0x180902){return function(_0x599f4a){if(_0x599f4a){return _0x599f4a[_0x3ad6('0x2d')](_0x51d68f)[_0x3ad6('0x1a')](function(_0x5bc0f2){return _0x5bc0f2;});}return null;};}function removeEntity(_0x1c3411,_0x48a53b){return function(_0x690913){if(_0x690913){return _0x690913['destroy']()['then'](function(){_0x1c3411['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26b7a5,_0x2fb534){return function(_0x121f5f){if(!_0x121f5f){_0x26b7a5[_0x3ad6('0x2e')](0x194);}return _0x121f5f;};}function handleError(_0x2d4e57,_0x52252f){_0x52252f=_0x52252f||0x1f4;return function(_0x197b97){logger[_0x3ad6('0x1e')](_0x197b97['stack']);if(_0x197b97['name']){delete _0x197b97[_0x3ad6('0x2f')];}_0x2d4e57[_0x3ad6('0x23')](_0x52252f)['send'](_0x197b97);};}exports[_0x3ad6('0x30')]=function(_0x214b88,_0x56209a){var _0x55feed={},_0x2644b3={},_0x1e5a64={'count':0x0,'rows':[]};var _0x50861e=_[_0x3ad6('0x31')](db['ServicenowAccount']['rawAttributes'],function(_0x5e2d6d){return{'name':_0x5e2d6d['fieldName'],'type':_0x5e2d6d[_0x3ad6('0x32')][_0x3ad6('0x33')]};});_0x2644b3['model']=_[_0x3ad6('0x31')](_0x50861e,_0x3ad6('0x2f'));_0x2644b3['query']=_[_0x3ad6('0x34')](_0x214b88[_0x3ad6('0x35')]);_0x2644b3[_0x3ad6('0x36')]=_[_0x3ad6('0x37')](_0x2644b3['model'],_0x2644b3[_0x3ad6('0x35')]);_0x55feed[_0x3ad6('0x38')]=_['intersection'](_0x2644b3[_0x3ad6('0x39')],qs['fields'](_0x214b88[_0x3ad6('0x35')][_0x3ad6('0x3a')]));_0x55feed[_0x3ad6('0x38')]=_0x55feed['attributes'][_0x3ad6('0x3b')]?_0x55feed[_0x3ad6('0x38')]:_0x2644b3['model'];if(!_0x214b88[_0x3ad6('0x35')]['hasOwnProperty'](_0x3ad6('0x3c'))){_0x55feed[_0x3ad6('0x27')]=qs['limit'](_0x214b88[_0x3ad6('0x35')][_0x3ad6('0x27')]);_0x55feed['offset']=qs[_0x3ad6('0x25')](_0x214b88['query']['offset']);}_0x55feed[_0x3ad6('0x3d')]=qs[_0x3ad6('0x3e')](_0x214b88['query'][_0x3ad6('0x3e')]);_0x55feed['where']=qs[_0x3ad6('0x36')](_[_0x3ad6('0x3f')](_0x214b88[_0x3ad6('0x35')],_0x2644b3['filters']),_0x50861e);if(_0x214b88[_0x3ad6('0x35')][_0x3ad6('0x40')]){_0x55feed[_0x3ad6('0x41')]=_[_0x3ad6('0x42')](_0x55feed[_0x3ad6('0x41')],{'$or':_[_0x3ad6('0x31')](_0x50861e,function(_0xaa6793){if(_0xaa6793[_0x3ad6('0x32')]!=='VIRTUAL'){var _0x25e4f0={};_0x25e4f0[_0xaa6793[_0x3ad6('0x2f')]]={'$like':'%'+_0x214b88[_0x3ad6('0x35')][_0x3ad6('0x40')]+'%'};return _0x25e4f0;}})});}_0x55feed=_[_0x3ad6('0x42')]({},_0x55feed,_0x214b88[_0x3ad6('0x43')]);var _0x47cbf4={'where':_0x55feed[_0x3ad6('0x41')]};return db[_0x3ad6('0x44')][_0x3ad6('0x28')](_0x47cbf4)[_0x3ad6('0x1a')](function(_0x355092){_0x1e5a64[_0x3ad6('0x28')]=_0x355092;if(_0x214b88['query'][_0x3ad6('0x45')]){_0x55feed['include']=[{'all':!![]}];}return db[_0x3ad6('0x44')][_0x3ad6('0x46')](_0x55feed);})['then'](function(_0xf6e794){_0x1e5a64[_0x3ad6('0x47')]=_0xf6e794;return _0x1e5a64;})[_0x3ad6('0x1a')](respondWithFilteredResult(_0x56209a,_0x55feed))[_0x3ad6('0x48')](handleError(_0x56209a,null));};exports[_0x3ad6('0x49')]=function(_0x27db2a,_0x22ddac){var _0x2acd99={'raw':![],'where':{'id':_0x27db2a[_0x3ad6('0x4a')]['id']}},_0x3edaad={};_0x3edaad[_0x3ad6('0x39')]=_[_0x3ad6('0x34')](db['ServicenowAccount'][_0x3ad6('0x4b')]);_0x3edaad[_0x3ad6('0x35')]=_[_0x3ad6('0x34')](_0x27db2a[_0x3ad6('0x35')]);_0x3edaad[_0x3ad6('0x36')]=_[_0x3ad6('0x37')](_0x3edaad[_0x3ad6('0x39')],_0x3edaad[_0x3ad6('0x35')]);_0x2acd99[_0x3ad6('0x38')]=_['intersection'](_0x3edaad['model'],qs[_0x3ad6('0x3a')](_0x27db2a['query'][_0x3ad6('0x3a')]));_0x2acd99[_0x3ad6('0x38')]=_0x2acd99[_0x3ad6('0x38')][_0x3ad6('0x3b')]?_0x2acd99[_0x3ad6('0x38')]:_0x3edaad[_0x3ad6('0x39')];if(_0x27db2a[_0x3ad6('0x35')]['includeAll']){_0x2acd99[_0x3ad6('0x4c')]=[{'all':!![]}];}_0x2acd99=_[_0x3ad6('0x42')]({},_0x2acd99,_0x27db2a[_0x3ad6('0x43')]);return db['ServicenowAccount'][_0x3ad6('0x4d')](_0x2acd99)[_0x3ad6('0x1a')](handleEntityNotFound(_0x22ddac,null))[_0x3ad6('0x1a')](respondWithResult(_0x22ddac,null))[_0x3ad6('0x48')](handleError(_0x22ddac,null));};exports[_0x3ad6('0x4e')]=function(_0x1e327c,_0x4118c0){return db[_0x3ad6('0x44')][_0x3ad6('0x4e')](_0x1e327c[_0x3ad6('0x4f')],{})[_0x3ad6('0x1a')](respondWithResult(_0x4118c0,0xc9))[_0x3ad6('0x48')](handleError(_0x4118c0,null));};exports[_0x3ad6('0x2d')]=function(_0x233a21,_0x317f34){if(_0x233a21[_0x3ad6('0x4f')]['id']){delete _0x233a21[_0x3ad6('0x4f')]['id'];}return db[_0x3ad6('0x44')][_0x3ad6('0x4d')]({'where':{'id':_0x233a21[_0x3ad6('0x4a')]['id']}})[_0x3ad6('0x1a')](handleEntityNotFound(_0x317f34,null))[_0x3ad6('0x1a')](saveUpdates(_0x233a21['body'],null))[_0x3ad6('0x1a')](respondWithResult(_0x317f34,null))[_0x3ad6('0x48')](handleError(_0x317f34,null));};exports[_0x3ad6('0x50')]=function(_0x9c7427,_0x48f775){return db[_0x3ad6('0x44')][_0x3ad6('0x4d')]({'where':{'id':_0x9c7427[_0x3ad6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x48f775,null))[_0x3ad6('0x1a')](removeEntity(_0x48f775,null))[_0x3ad6('0x48')](handleError(_0x48f775,null));};exports[_0x3ad6('0x51')]=function(_0x480e2c,_0x1b1227,_0x3e3489){var _0x4637fe={};var _0x5b7703={};var _0x2c48e2;var _0x1be905;return db['ServicenowAccount'][_0x3ad6('0x52')]({'where':{'id':_0x480e2c[_0x3ad6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b1227,null))['then'](function(_0x138727){if(_0x138727){_0x2c48e2=_0x138727;_0x5b7703[_0x3ad6('0x39')]=_['keys'](db[_0x3ad6('0x53')][_0x3ad6('0x4b')]);_0x5b7703[_0x3ad6('0x35')]=_[_0x3ad6('0x34')](_0x480e2c[_0x3ad6('0x35')]);_0x5b7703[_0x3ad6('0x36')]=_['intersection'](_0x5b7703[_0x3ad6('0x39')],_0x5b7703[_0x3ad6('0x35')]);_0x4637fe[_0x3ad6('0x38')]=_[_0x3ad6('0x37')](_0x5b7703['model'],qs[_0x3ad6('0x3a')](_0x480e2c[_0x3ad6('0x35')][_0x3ad6('0x3a')]));_0x4637fe['attributes']=_0x4637fe[_0x3ad6('0x38')][_0x3ad6('0x3b')]?_0x4637fe[_0x3ad6('0x38')]:_0x5b7703[_0x3ad6('0x39')];_0x4637fe[_0x3ad6('0x3d')]=qs[_0x3ad6('0x3e')](_0x480e2c[_0x3ad6('0x35')][_0x3ad6('0x3e')]);_0x4637fe['where']=qs[_0x3ad6('0x36')](_[_0x3ad6('0x3f')](_0x480e2c[_0x3ad6('0x35')],_0x5b7703[_0x3ad6('0x36')]));if(_0x480e2c[_0x3ad6('0x35')][_0x3ad6('0x40')]){_0x4637fe[_0x3ad6('0x41')]=_['merge'](_0x4637fe[_0x3ad6('0x41')],{'$or':_[_0x3ad6('0x31')](_0x4637fe[_0x3ad6('0x38')],function(_0x796276){var _0x4883f3={};_0x4883f3[_0x796276]={'$like':'%'+_0x480e2c[_0x3ad6('0x35')][_0x3ad6('0x40')]+'%'};return _0x4883f3;})});}_0x4637fe=_[_0x3ad6('0x42')]({},_0x4637fe,_0x480e2c[_0x3ad6('0x43')]);return _0x2c48e2[_0x3ad6('0x51')](_0x4637fe);}})[_0x3ad6('0x1a')](function(_0x3dd088){if(_0x3dd088){_0x1be905=_0x3dd088[_0x3ad6('0x3b')];if(!_0x480e2c['query'][_0x3ad6('0x54')](_0x3ad6('0x3c'))){_0x4637fe['limit']=qs[_0x3ad6('0x27')](_0x480e2c[_0x3ad6('0x35')]['limit']);_0x4637fe['offset']=qs['offset'](_0x480e2c[_0x3ad6('0x35')]['offset']);}return _0x2c48e2['getConfigurations'](_0x4637fe);}})[_0x3ad6('0x1a')](function(_0x3802c6){if(_0x3802c6){return _0x3802c6?{'count':_0x1be905,'rows':_0x3802c6}:null;}})['then'](respondWithResult(_0x1b1227,null))[_0x3ad6('0x48')](handleError(_0x1b1227,null));};exports[_0x3ad6('0x55')]=function(_0x2f1d18,_0x9ccc29,_0x74da5){if(_0x2f1d18[_0x3ad6('0x4f')]['id']){delete _0x2f1d18[_0x3ad6('0x4f')]['id'];}return db[_0x3ad6('0x44')][_0x3ad6('0x52')]({'where':{'id':_0x2f1d18['params']['id']}})[_0x3ad6('0x1a')](handleEntityNotFound(_0x9ccc29,null))[_0x3ad6('0x1a')](function(_0x5360be){if(_0x5360be){_0x2f1d18['body'][_0x3ad6('0x56')]=_0x5360be['id'];_0x2f1d18[_0x3ad6('0x4f')][_0x3ad6('0x57')]=integrations['getSubjects'](_0x2f1d18[_0x3ad6('0x4f')][_0x3ad6('0x58')],_0x2f1d18[_0x3ad6('0x4f')][_0x3ad6('0x32')]);_0x2f1d18[_0x3ad6('0x4f')][_0x3ad6('0x59')]=integrations['getDescriptions'](_0x2f1d18[_0x3ad6('0x4f')][_0x3ad6('0x58')],_0x2f1d18['body'][_0x3ad6('0x32')]);return db[_0x3ad6('0x53')]['create'](_0x2f1d18[_0x3ad6('0x4f')],{'include':[{'model':db[_0x3ad6('0x5a')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x3ad6('0x59')}]});}return null;})[_0x3ad6('0x1a')](respondWithResult(_0x9ccc29,null))[_0x3ad6('0x48')](handleError(_0x9ccc29,null));};exports[_0x3ad6('0x5b')]=function(_0x4d7b26,_0x502e5e,_0x385476){var _0x15ddfa=[_0x3ad6('0x5c'),_0x3ad6('0x5d'),_0x3ad6('0x5e'),_0x3ad6('0x5f'),_0x3ad6('0x60'),_0x3ad6('0x61'),_0x3ad6('0x62'),_0x3ad6('0x63'),_0x3ad6('0x64')];var _0x47b99e=[_0x3ad6('0x65'),_0x3ad6('0x5c'),_0x3ad6('0x66'),_0x3ad6('0x67'),_0x3ad6('0x68'),_0x3ad6('0x69'),_0x3ad6('0x6a'),_0x3ad6('0x5d'),_0x3ad6('0x6b'),_0x3ad6('0x6c'),_0x3ad6('0x6d'),'sys_updated_by',_0x3ad6('0x6e'),_0x3ad6('0x6f'),_0x3ad6('0x70'),_0x3ad6('0x71'),_0x3ad6('0x72'),_0x3ad6('0x73'),_0x3ad6('0x5e'),'order',_0x3ad6('0x74'),'closed_at',_0x3ad6('0x75'),_0x3ad6('0x76'),_0x3ad6('0x77'),_0x3ad6('0x78'),'work_notes_list',_0x3ad6('0x79'),'priority',_0x3ad6('0x7a'),_0x3ad6('0x7b'),'time_worked','expected_start',_0x3ad6('0x7c'),_0x3ad6('0x7d'),_0x3ad6('0x7e'),_0x3ad6('0x7f'),_0x3ad6('0x80'),_0x3ad6('0x81'),_0x3ad6('0x82'),'approval_set','subcategory',_0x3ad6('0x83'),_0x3ad6('0x84'),_0x3ad6('0x60'),'correlation_display','delivery_task',_0x3ad6('0x85'),_0x3ad6('0x86'),_0x3ad6('0x87'),_0x3ad6('0x88'),_0x3ad6('0x89'),_0x3ad6('0x8a'),_0x3ad6('0x61'),_0x3ad6('0x8b'),_0x3ad6('0x8c'),_0x3ad6('0x8d'),_0x3ad6('0x8e'),'parent_incident',_0x3ad6('0x8f'),'contact_type',_0x3ad6('0x90'),'incident_state',_0x3ad6('0x91'),'problem_id',_0x3ad6('0x92'),'reassignment_count',_0x3ad6('0x93'),'assigned_to',_0x3ad6('0x63'),_0x3ad6('0x94'),_0x3ad6('0x95'),_0x3ad6('0x96'),_0x3ad6('0x97'),_0x3ad6('0x98'),_0x3ad6('0x99'),_0x3ad6('0x9a'),_0x3ad6('0x9b'),_0x3ad6('0x9c'),_0x3ad6('0x9d'),'correlation_id',_0x3ad6('0x9e'),_0x3ad6('0x64')];var _0xba2be1='';var _0x514402='';var _0x17622d=[];var _0x26815f='';var _0x5dfd32='';var _0x25b5ae=[];var _0xc7681e='';var _0x453928='';var _0x155aca={};var _0x13b81e='';return db[_0x3ad6('0x44')][_0x3ad6('0x52')]({'where':{'id':_0x4d7b26[_0x3ad6('0x4a')]['id']},'attributes':['id',_0x3ad6('0x9f'),_0x3ad6('0xa0'),_0x3ad6('0xa1'),_0x3ad6('0xa2'),_0x3ad6('0xa3')]})[_0x3ad6('0x1a')](handleEntityNotFound(_0x502e5e,null))[_0x3ad6('0x1a')](function(_0x15b5c3){if(_0x15b5c3){_0x13b81e=_0x15b5c3['remoteUri'];var _0x35063d=_0x13b81e[_0x3ad6('0xa4')](-0x1);if(_0x35063d==='/'){_0x13b81e=_0x13b81e[_0x3ad6('0xa5')](0x0,_0x13b81e[_0x3ad6('0xa6')](_0x35063d));}_0x453928=util[_0x3ad6('0xa7')](_0x3ad6('0xa8'),_0x13b81e);_0xc7681e=util[_0x3ad6('0xa7')](_0x3ad6('0xa9'),_0x13b81e);_0x155aca={'user':_0x15b5c3['username'],'pass':_0x15b5c3['password']};var _0x5d5da4={'method':_0x3ad6('0xaa'),'uri':_0x453928+'incident?sysparm_display_value=all','auth':_0x155aca,'json':!![]};return rp(_0x5d5da4);}})[_0x3ad6('0x1a')](function(_0x3b5a2a){if(_0x3b5a2a[_0x3ad6('0xab')][_0x3ad6('0x3b')]>0x0){_0xba2be1=_0x3b5a2a[_0x3ad6('0xab')];}console[_0x3ad6('0xac')]('incident\x20table\x20objects',_0xba2be1);_0x25b5ae=[];_0x514402=Object[_0x3ad6('0xad')]([],_0xba2be1);_[_0x3ad6('0xae')](_0x514402,function(_0x380be5){return!_0x15ddfa['includes'](_0x380be5['name']);});_0x514402[_0x3ad6('0xaf')](function(_0xa8bda8){var _0x436d13=createFieldObject(_0xc7681e,_0x155aca,_0xa8bda8[_0x3ad6('0xb0')],_0xa8bda8['name'],_0xa8bda8[_0x3ad6('0xb1')],![]);_0x25b5ae[_0x3ad6('0xb2')](_0x436d13);});return Promise[_0x3ad6('0xb3')](_0x25b5ae);})[_0x3ad6('0x1a')](function(_0xb55924){_0x17622d=_0xb55924;_0x26815f=Object[_0x3ad6('0xad')]([],_0xba2be1);console[_0x3ad6('0xac')](_0x3ad6('0xb4'),_0xba2be1);_[_0x3ad6('0xae')](_0x26815f,function(_0x54a78b){return _0x47b99e[_0x3ad6('0xb5')](_0x54a78b[_0x3ad6('0x2f')]);});console[_0x3ad6('0xac')](_0x3ad6('0xb6'),_0x26815f);_0x25b5ae=[];_0x26815f[_0x3ad6('0xaf')](function(_0x1c668d){var _0xdf83ba=createFieldObject(_0xc7681e,_0x155aca,_0x1c668d[_0x3ad6('0xb0')],_0x1c668d['name'],_0x1c668d[_0x3ad6('0xb1')],!![]);_0x25b5ae['push'](_0xdf83ba);});return Promise[_0x3ad6('0xb3')](_0x25b5ae);})[_0x3ad6('0x1a')](function(_0x29827f){_0x5dfd32=_0x29827f;var _0x37187d=_0x17622d[_0x3ad6('0xb7')](_0x5dfd32);return{'count':_0x37187d[_0x3ad6('0x3b')],'rows':_0x37187d};})[_0x3ad6('0x1a')](respondWithResult(_0x502e5e,null))['catch'](function(_0xe297f2){console['log'](_0x3ad6('0xb8')+_0xe297f2);var _0x1c4f4c=_0x4d7b26[_0x3ad6('0x35')][_0x3ad6('0xb9')]?0x1f4:_0xe297f2[_0x3ad6('0xba')]||0x1f4;logger[_0x3ad6('0x1e')](_0xe297f2[_0x3ad6('0xbb')]);delete _0xe297f2['name'];if(_0x1c4f4c===0x191){_0x1c4f4c=0x190;}_0x502e5e[_0x3ad6('0x23')](_0x1c4f4c)[_0x3ad6('0xbc')](_0x4d7b26[_0x3ad6('0x35')][_0x3ad6('0xb9')]?{'message':_0x3ad6('0xbd'),'statusCode':_0xe297f2['statusCode']}:_0xe297f2);});};function createFieldObject(_0x1d52de,_0xd41f2e,_0x1d8fb9,_0x365fab,_0x79001f,_0x2561d2){return new Promise(function(_0x5e8fcf,_0x5d268e){var _0x2dd39c={'id':_0x365fab,'name':_0x79001f,'custom':_0x2561d2};if(_0x1d8fb9==='boolean'){_0x2dd39c[_0x3ad6('0x43')]=[{'name':_0x3ad6('0xbe'),'value':'true'},{'name':_0x3ad6('0xbf'),'value':_0x3ad6('0xc0')}];_0x5e8fcf(_0x2dd39c);}else{var _0x7885db={'method':_0x3ad6('0xaa'),'uri':_0x1d52de+_0x3ad6('0xc1')+_0x365fab,'auth':_0xd41f2e,'json':!![]};return rp(_0x7885db)['then'](function(_0x277f12){var _0x39e384=[];if(_0x277f12[_0x3ad6('0xab')][_0x3ad6('0x3b')]>0x0){_0x277f12['result'][_0x3ad6('0xaf')](function(_0x426a34){if(_0x426a34[_0x3ad6('0xc2')]==='false'){var _0x29c973={'name':_0x426a34[_0x3ad6('0xb1')],'value':_0x426a34['value']};_0x39e384[_0x3ad6('0xb2')](_0x29c973);}});}_0x2dd39c[_0x3ad6('0x43')]=_0x39e384;if(_0x2dd39c[_0x3ad6('0x43')][_0x3ad6('0x3b')]>0x0){_0x5e8fcf(_0x2dd39c);}else{if(_0x2561d2==![]){_0x5e8fcf();}else{_0x5e8fcf(_0x2dd39c);}}});}});} \ No newline at end of file +var _0xd8f3=['assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','category','findOne','username','password','serverUrl','remoteUri','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','Wrong\x20credentials','statusCode','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','show','params','fields','include','catch','create','body','find','getConfigurations','ServicenowConfiguration','order','filter','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','parent','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','delivery_plan','impact','work_notes_list','business_service','rfc','time_worked','expected_start','group_list','work_end','resolved_at','caller_id','work_notes','short_description','correlation_display','delivery_task','work_start'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xd8f3,0xfe));var _0x3d8f=function(_0x4f10b2,_0x22376c){_0x4f10b2=_0x4f10b2-0x0;var _0x241095=_0xd8f3[_0x4f10b2];return _0x241095;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d8f('0x0'));var zipdir=require(_0x3d8f('0x1'));var jsonpatch=require(_0x3d8f('0x2'));var rp=require(_0x3d8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3d8f('0x4'));var util=require('util');var path=require(_0x3d8f('0x5'));var sox=require('sox');var csv=require(_0x3d8f('0x6'));var ejs=require(_0x3d8f('0x7'));var fs=require('fs');var fs_extra=require(_0x3d8f('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d8f('0x9'));var jsforce=require(_0x3d8f('0xa'));var deskjs=require(_0x3d8f('0xb'));var toCsv=require(_0x3d8f('0x6'));var querystring=require(_0x3d8f('0xc'));var Papa=require(_0x3d8f('0xd'));var Redis=require(_0x3d8f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d8f('0xf'));var as=require(_0x3d8f('0x10'));var hardwareService=require(_0x3d8f('0x11'));var logger=require('../../config/logger')(_0x3d8f('0x12'));var utils=require(_0x3d8f('0x13'));var config=require(_0x3d8f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3d8f('0x15'))['db'];var integrations=require(_0x3d8f('0x16'));var jayson=require(_0x3d8f('0x17'));var client=jayson[_0x3d8f('0x18')][_0x3d8f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5640b8,_0x28fa03,_0xc5ba6b,_0xac707c){return new BPromise(function(_0x3d363e,_0x52df14){var _0x1921bf=_0xac707c||client;return _0x1921bf[_0x3d8f('0x1a')](_0x5640b8,_0xc5ba6b)[_0x3d8f('0x1b')](function(_0x48d26c){logger[_0x3d8f('0x1c')](_0x3d8f('0x1d'),_0x28fa03,'request\x20sent');logger[_0x3d8f('0x1e')](_0x3d8f('0x1f'),_0x28fa03,_0x3d8f('0x20'),JSON[_0x3d8f('0x21')](_0x48d26c));if(_0x48d26c[_0x3d8f('0x22')]){if(_0x48d26c['error'][_0x3d8f('0x23')]===0x1f4){logger[_0x3d8f('0x22')](_0x3d8f('0x1d'),_0x28fa03,_0x48d26c[_0x3d8f('0x22')][_0x3d8f('0x24')]);return _0x52df14(_0x48d26c[_0x3d8f('0x22')][_0x3d8f('0x24')]);}logger[_0x3d8f('0x22')](_0x3d8f('0x1d'),_0x28fa03,_0x48d26c[_0x3d8f('0x22')][_0x3d8f('0x24')]);return _0x3d363e(_0x48d26c[_0x3d8f('0x22')]['message']);}else{logger[_0x3d8f('0x1c')](_0x3d8f('0x1d'),_0x28fa03,'request\x20sent');_0x3d363e(_0x48d26c[_0x3d8f('0x25')][_0x3d8f('0x24')]);}})['catch'](function(_0x2db143){logger[_0x3d8f('0x22')](_0x3d8f('0x1d'),_0x28fa03,_0x2db143);_0x52df14(_0x2db143);});});}function respondWithStatusCode(_0x3120f8,_0x110ae5){_0x110ae5=_0x110ae5||0xcc;return function(_0x54a6a0){if(_0x54a6a0){return _0x3120f8[_0x3d8f('0x26')](_0x110ae5);}return _0x3120f8[_0x3d8f('0x27')](_0x110ae5)[_0x3d8f('0x28')]();};}function respondWithResult(_0x385908,_0x414b41){_0x414b41=_0x414b41||0xc8;return function(_0x7251d6){if(_0x7251d6){return _0x385908[_0x3d8f('0x27')](_0x414b41)[_0x3d8f('0x29')](_0x7251d6);}};}function respondWithFilteredResult(_0x3e0e3f,_0x491b75){return function(_0x145c97){if(_0x145c97){var _0x5a5e49=typeof _0x491b75['offset']==='undefined'&&typeof _0x491b75[_0x3d8f('0x2a')]===_0x3d8f('0x2b');var _0x3ba8e5=_0x145c97['count'];var _0x56bcd5=_0x5a5e49?0x0:_0x491b75[_0x3d8f('0x2c')];var _0x4cdcd7=_0x5a5e49?_0x145c97[_0x3d8f('0x2d')]:_0x491b75[_0x3d8f('0x2c')]+_0x491b75['limit'];var _0x4efd80;if(_0x4cdcd7>=_0x3ba8e5){_0x4cdcd7=_0x3ba8e5;_0x4efd80=0xc8;}else{_0x4efd80=0xce;}_0x3e0e3f[_0x3d8f('0x27')](_0x4efd80);return _0x3e0e3f[_0x3d8f('0x2e')](_0x3d8f('0x2f'),_0x56bcd5+'-'+_0x4cdcd7+'/'+_0x3ba8e5)[_0x3d8f('0x29')](_0x145c97);}return null;};}function patchUpdates(_0x2c55c5){return function(_0x461026){try{jsonpatch[_0x3d8f('0x30')](_0x461026,_0x2c55c5,!![]);}catch(_0x3ef3c4){return BPromise[_0x3d8f('0x31')](_0x3ef3c4);}return _0x461026[_0x3d8f('0x32')]();};}function saveUpdates(_0x2e51e8,_0x4b7ffc){return function(_0x3a1372){if(_0x3a1372){return _0x3a1372[_0x3d8f('0x33')](_0x2e51e8)[_0x3d8f('0x1b')](function(_0x4adb85){return _0x4adb85;});}return null;};}function removeEntity(_0x1b8cd8,_0x2847cf){return function(_0x3ff624){if(_0x3ff624){return _0x3ff624[_0x3d8f('0x34')]()[_0x3d8f('0x1b')](function(){_0x1b8cd8[_0x3d8f('0x27')](0xcc)[_0x3d8f('0x28')]();});}};}function handleEntityNotFound(_0x37663a,_0x3fb5b5){return function(_0x36d707){if(!_0x36d707){_0x37663a['sendStatus'](0x194);}return _0x36d707;};}function handleError(_0x6c033f,_0x2a0d9b){_0x2a0d9b=_0x2a0d9b||0x1f4;return function(_0x14583d){logger['error'](_0x14583d[_0x3d8f('0x35')]);if(_0x14583d[_0x3d8f('0x36')]){delete _0x14583d['name'];}_0x6c033f[_0x3d8f('0x27')](_0x2a0d9b)[_0x3d8f('0x37')](_0x14583d);};}exports[_0x3d8f('0x38')]=function(_0x340b64,_0x4ade42){var _0x609515={},_0x319209={},_0x1b88a3={'count':0x0,'rows':[]};var _0x3e7772=_[_0x3d8f('0x39')](db[_0x3d8f('0x3a')][_0x3d8f('0x3b')],function(_0x4725ae){return{'name':_0x4725ae[_0x3d8f('0x3c')],'type':_0x4725ae[_0x3d8f('0x3d')][_0x3d8f('0x3e')]};});_0x319209[_0x3d8f('0x3f')]=_['map'](_0x3e7772,_0x3d8f('0x36'));_0x319209[_0x3d8f('0x40')]=_[_0x3d8f('0x41')](_0x340b64[_0x3d8f('0x40')]);_0x319209[_0x3d8f('0x42')]=_['intersection'](_0x319209['model'],_0x319209['query']);_0x609515[_0x3d8f('0x43')]=_[_0x3d8f('0x44')](_0x319209['model'],qs['fields'](_0x340b64['query']['fields']));_0x609515[_0x3d8f('0x43')]=_0x609515[_0x3d8f('0x43')][_0x3d8f('0x45')]?_0x609515[_0x3d8f('0x43')]:_0x319209['model'];if(!_0x340b64[_0x3d8f('0x40')][_0x3d8f('0x46')](_0x3d8f('0x47'))){_0x609515[_0x3d8f('0x2a')]=qs[_0x3d8f('0x2a')](_0x340b64[_0x3d8f('0x40')][_0x3d8f('0x2a')]);_0x609515[_0x3d8f('0x2c')]=qs[_0x3d8f('0x2c')](_0x340b64['query'][_0x3d8f('0x2c')]);}_0x609515['order']=qs[_0x3d8f('0x48')](_0x340b64[_0x3d8f('0x40')][_0x3d8f('0x48')]);_0x609515[_0x3d8f('0x49')]=qs[_0x3d8f('0x42')](_[_0x3d8f('0x4a')](_0x340b64[_0x3d8f('0x40')],_0x319209[_0x3d8f('0x42')]),_0x3e7772);if(_0x340b64[_0x3d8f('0x40')]['filter']){_0x609515[_0x3d8f('0x49')]=_[_0x3d8f('0x4b')](_0x609515[_0x3d8f('0x49')],{'$or':_[_0x3d8f('0x39')](_0x3e7772,function(_0x2ad0ec){if(_0x2ad0ec[_0x3d8f('0x3d')]!==_0x3d8f('0x4c')){var _0x413fba={};_0x413fba[_0x2ad0ec[_0x3d8f('0x36')]]={'$like':'%'+_0x340b64[_0x3d8f('0x40')]['filter']+'%'};return _0x413fba;}})});}_0x609515=_['merge']({},_0x609515,_0x340b64[_0x3d8f('0x4d')]);var _0x1dfa86={'where':_0x609515[_0x3d8f('0x49')]};return db[_0x3d8f('0x3a')][_0x3d8f('0x2d')](_0x1dfa86)['then'](function(_0x2d5563){_0x1b88a3[_0x3d8f('0x2d')]=_0x2d5563;if(_0x340b64[_0x3d8f('0x40')][_0x3d8f('0x4e')]){_0x609515['include']=[{'all':!![]}];}return db[_0x3d8f('0x3a')]['findAll'](_0x609515);})[_0x3d8f('0x1b')](function(_0x1056b4){_0x1b88a3['rows']=_0x1056b4;return _0x1b88a3;})['then'](respondWithFilteredResult(_0x4ade42,_0x609515))['catch'](handleError(_0x4ade42,null));};exports[_0x3d8f('0x4f')]=function(_0x5ba4bf,_0x5e3b63){var _0x17715f={'raw':![],'where':{'id':_0x5ba4bf[_0x3d8f('0x50')]['id']}},_0x4a12c2={};_0x4a12c2[_0x3d8f('0x3f')]=_[_0x3d8f('0x41')](db[_0x3d8f('0x3a')][_0x3d8f('0x3b')]);_0x4a12c2['query']=_[_0x3d8f('0x41')](_0x5ba4bf[_0x3d8f('0x40')]);_0x4a12c2[_0x3d8f('0x42')]=_[_0x3d8f('0x44')](_0x4a12c2[_0x3d8f('0x3f')],_0x4a12c2['query']);_0x17715f[_0x3d8f('0x43')]=_[_0x3d8f('0x44')](_0x4a12c2[_0x3d8f('0x3f')],qs[_0x3d8f('0x51')](_0x5ba4bf[_0x3d8f('0x40')]['fields']));_0x17715f['attributes']=_0x17715f['attributes']['length']?_0x17715f[_0x3d8f('0x43')]:_0x4a12c2[_0x3d8f('0x3f')];if(_0x5ba4bf[_0x3d8f('0x40')][_0x3d8f('0x4e')]){_0x17715f[_0x3d8f('0x52')]=[{'all':!![]}];}_0x17715f=_[_0x3d8f('0x4b')]({},_0x17715f,_0x5ba4bf[_0x3d8f('0x4d')]);return db[_0x3d8f('0x3a')]['find'](_0x17715f)['then'](handleEntityNotFound(_0x5e3b63,null))[_0x3d8f('0x1b')](respondWithResult(_0x5e3b63,null))[_0x3d8f('0x53')](handleError(_0x5e3b63,null));};exports[_0x3d8f('0x54')]=function(_0x2b734a,_0x3d465a){return db[_0x3d8f('0x3a')]['create'](_0x2b734a['body'],{})[_0x3d8f('0x1b')](respondWithResult(_0x3d465a,0xc9))[_0x3d8f('0x53')](handleError(_0x3d465a,null));};exports[_0x3d8f('0x33')]=function(_0x342eb0,_0x5eeb93){if(_0x342eb0[_0x3d8f('0x55')]['id']){delete _0x342eb0[_0x3d8f('0x55')]['id'];}return db[_0x3d8f('0x3a')][_0x3d8f('0x56')]({'where':{'id':_0x342eb0[_0x3d8f('0x50')]['id']}})[_0x3d8f('0x1b')](handleEntityNotFound(_0x5eeb93,null))[_0x3d8f('0x1b')](saveUpdates(_0x342eb0[_0x3d8f('0x55')],null))[_0x3d8f('0x1b')](respondWithResult(_0x5eeb93,null))[_0x3d8f('0x53')](handleError(_0x5eeb93,null));};exports[_0x3d8f('0x34')]=function(_0x1d6c61,_0x174351){return db[_0x3d8f('0x3a')][_0x3d8f('0x56')]({'where':{'id':_0x1d6c61['params']['id']}})[_0x3d8f('0x1b')](handleEntityNotFound(_0x174351,null))[_0x3d8f('0x1b')](removeEntity(_0x174351,null))[_0x3d8f('0x53')](handleError(_0x174351,null));};exports[_0x3d8f('0x57')]=function(_0x551908,_0x12d540,_0x1c2259){var _0x539a66={};var _0x33836b={};var _0x42e430;var _0x10a9c2;return db[_0x3d8f('0x3a')]['findOne']({'where':{'id':_0x551908[_0x3d8f('0x50')]['id']}})[_0x3d8f('0x1b')](handleEntityNotFound(_0x12d540,null))[_0x3d8f('0x1b')](function(_0x3e3418){if(_0x3e3418){_0x42e430=_0x3e3418;_0x33836b[_0x3d8f('0x3f')]=_[_0x3d8f('0x41')](db[_0x3d8f('0x58')][_0x3d8f('0x3b')]);_0x33836b[_0x3d8f('0x40')]=_['keys'](_0x551908['query']);_0x33836b[_0x3d8f('0x42')]=_[_0x3d8f('0x44')](_0x33836b[_0x3d8f('0x3f')],_0x33836b['query']);_0x539a66[_0x3d8f('0x43')]=_[_0x3d8f('0x44')](_0x33836b[_0x3d8f('0x3f')],qs[_0x3d8f('0x51')](_0x551908['query']['fields']));_0x539a66[_0x3d8f('0x43')]=_0x539a66['attributes']['length']?_0x539a66[_0x3d8f('0x43')]:_0x33836b['model'];_0x539a66[_0x3d8f('0x59')]=qs[_0x3d8f('0x48')](_0x551908['query']['sort']);_0x539a66[_0x3d8f('0x49')]=qs['filters'](_[_0x3d8f('0x4a')](_0x551908[_0x3d8f('0x40')],_0x33836b[_0x3d8f('0x42')]));if(_0x551908[_0x3d8f('0x40')][_0x3d8f('0x5a')]){_0x539a66[_0x3d8f('0x49')]=_[_0x3d8f('0x4b')](_0x539a66['where'],{'$or':_[_0x3d8f('0x39')](_0x539a66['attributes'],function(_0x3a2126){var _0x1f4a0c={};_0x1f4a0c[_0x3a2126]={'$like':'%'+_0x551908[_0x3d8f('0x40')][_0x3d8f('0x5a')]+'%'};return _0x1f4a0c;})});}_0x539a66=_[_0x3d8f('0x4b')]({},_0x539a66,_0x551908[_0x3d8f('0x4d')]);return _0x42e430['getConfigurations'](_0x539a66);}})[_0x3d8f('0x1b')](function(_0x30bdb9){if(_0x30bdb9){_0x10a9c2=_0x30bdb9[_0x3d8f('0x45')];if(!_0x551908[_0x3d8f('0x40')][_0x3d8f('0x46')](_0x3d8f('0x47'))){_0x539a66[_0x3d8f('0x2a')]=qs[_0x3d8f('0x2a')](_0x551908[_0x3d8f('0x40')][_0x3d8f('0x2a')]);_0x539a66['offset']=qs[_0x3d8f('0x2c')](_0x551908['query'][_0x3d8f('0x2c')]);}return _0x42e430[_0x3d8f('0x57')](_0x539a66);}})[_0x3d8f('0x1b')](function(_0x24c369){if(_0x24c369){return _0x24c369?{'count':_0x10a9c2,'rows':_0x24c369}:null;}})[_0x3d8f('0x1b')](respondWithResult(_0x12d540,null))[_0x3d8f('0x53')](handleError(_0x12d540,null));};exports['addConfiguration']=function(_0x4c449e,_0xd4932,_0x100e24){if(_0x4c449e[_0x3d8f('0x55')]['id']){delete _0x4c449e[_0x3d8f('0x55')]['id'];}return db[_0x3d8f('0x3a')]['findOne']({'where':{'id':_0x4c449e['params']['id']}})[_0x3d8f('0x1b')](handleEntityNotFound(_0xd4932,null))['then'](function(_0x5d9a89){if(_0x5d9a89){_0x4c449e['body'][_0x3d8f('0x5b')]=_0x5d9a89['id'];_0x4c449e['body'][_0x3d8f('0x5c')]=integrations['getSubjects'](_0x4c449e[_0x3d8f('0x55')][_0x3d8f('0x5d')],_0x4c449e[_0x3d8f('0x55')][_0x3d8f('0x3d')]);_0x4c449e['body'][_0x3d8f('0x5e')]=integrations[_0x3d8f('0x5f')](_0x4c449e['body']['channel'],_0x4c449e[_0x3d8f('0x55')][_0x3d8f('0x3d')]);return db['ServicenowConfiguration'][_0x3d8f('0x54')](_0x4c449e['body'],{'include':[{'model':db[_0x3d8f('0x60')],'as':_0x3d8f('0x5c')},{'model':db[_0x3d8f('0x60')],'as':_0x3d8f('0x5e')}]});}return null;})[_0x3d8f('0x1b')](respondWithResult(_0xd4932,null))[_0x3d8f('0x53')](handleError(_0xd4932,null));};exports[_0x3d8f('0x61')]=function(_0xc27f1a,_0x464622,_0x3f50b0){var _0x15128a=[_0x3d8f('0x62'),_0x3d8f('0x63'),'knowledge',_0x3d8f('0x64'),_0x3d8f('0x65'),_0x3d8f('0x66'),_0x3d8f('0x67'),_0x3d8f('0x68'),'category'];var _0x1fa1b8=[_0x3d8f('0x69'),'made_sla','caused_by','watch_list','upon_reject',_0x3d8f('0x6a'),_0x3d8f('0x6b'),'hold_reason',_0x3d8f('0x6c'),_0x3d8f('0x6d'),_0x3d8f('0x6e'),_0x3d8f('0x6f'),'opened_by',_0x3d8f('0x70'),_0x3d8f('0x71'),_0x3d8f('0x72'),_0x3d8f('0x73'),_0x3d8f('0x74'),_0x3d8f('0x75'),_0x3d8f('0x59'),_0x3d8f('0x76'),_0x3d8f('0x77'),'cmdb_ci',_0x3d8f('0x78'),_0x3d8f('0x79'),'active',_0x3d8f('0x7a'),_0x3d8f('0x7b'),'priority','sys_domain_path',_0x3d8f('0x7c'),_0x3d8f('0x7d'),_0x3d8f('0x7e'),'opened_at','business_duration',_0x3d8f('0x7f'),_0x3d8f('0x80'),'reopened_time',_0x3d8f('0x81'),_0x3d8f('0x82'),'approval_set',_0x3d8f('0x64'),_0x3d8f('0x83'),_0x3d8f('0x84'),_0x3d8f('0x65'),_0x3d8f('0x85'),_0x3d8f('0x86'),_0x3d8f('0x87'),_0x3d8f('0x88'),_0x3d8f('0x89'),_0x3d8f('0x8a'),'description',_0x3d8f('0x8b'),_0x3d8f('0x66'),_0x3d8f('0x8c'),'close_notes',_0x3d8f('0x8d'),_0x3d8f('0x8e'),_0x3d8f('0x8f'),'sys_id',_0x3d8f('0x90'),_0x3d8f('0x91'),_0x3d8f('0x67'),_0x3d8f('0x92'),_0x3d8f('0x93'),_0x3d8f('0x94'),_0x3d8f('0x95'),'activity_due',_0x3d8f('0x96'),_0x3d8f('0x68'),_0x3d8f('0x97'),_0x3d8f('0x98'),'approval','comments_and_work_notes',_0x3d8f('0x99'),_0x3d8f('0x9a'),_0x3d8f('0x9b'),_0x3d8f('0x9c'),_0x3d8f('0x9d'),_0x3d8f('0x9e'),_0x3d8f('0x9f'),'location',_0x3d8f('0xa0')];var _0x3fed7e='';var _0x5843e5='';var _0x4fca8e=[];var _0x505e92='';var _0x30599c='';var _0x3d78a3=[];var _0x24785f='';var _0xc3f58a='';var _0x3e0f96={};var _0x58c2a5='';return db['ServicenowAccount'][_0x3d8f('0xa1')]({'where':{'id':_0xc27f1a['params']['id']},'attributes':['id',_0x3d8f('0xa2'),_0x3d8f('0xa3'),'email','remoteUri',_0x3d8f('0xa4')]})[_0x3d8f('0x1b')](handleEntityNotFound(_0x464622,null))[_0x3d8f('0x1b')](function(_0x14229e){if(_0x14229e){_0x58c2a5=_0x14229e[_0x3d8f('0xa5')];var _0x17ffb5=_0x58c2a5[_0x3d8f('0xa6')](-0x1);if(_0x17ffb5==='/'){_0x58c2a5=_0x58c2a5[_0x3d8f('0xa7')](0x0,_0x58c2a5[_0x3d8f('0xa8')](_0x17ffb5));}_0xc3f58a=util['format'](_0x3d8f('0xa9'),_0x58c2a5);_0x24785f=util[_0x3d8f('0xaa')](_0x3d8f('0xab'),_0x58c2a5);_0x3e0f96={'user':_0x14229e['username'],'pass':_0x14229e[_0x3d8f('0xa3')]};var _0x34922f={'method':_0x3d8f('0xac'),'uri':_0xc3f58a+_0x3d8f('0xad'),'auth':_0x3e0f96,'json':!![]};return rp(_0x34922f);}})[_0x3d8f('0x1b')](function(_0xb62d9){if(_0xb62d9[_0x3d8f('0x25')][_0x3d8f('0x45')]>0x0){_0x3fed7e=_0xb62d9[_0x3d8f('0x25')];}console[_0x3d8f('0xae')](_0x3d8f('0xaf'),_0x3fed7e);_0x3d78a3=[];_0x5843e5=Object[_0x3d8f('0xb0')]([],_0x3fed7e);_['remove'](_0x5843e5,function(_0x254b3a){return!_0x15128a[_0x3d8f('0xb1')](_0x254b3a[_0x3d8f('0x36')]);});_0x5843e5[_0x3d8f('0xb2')](function(_0x4f44e0){var _0x2b582b=createFieldObject(_0x24785f,_0x3e0f96,_0x4f44e0[_0x3d8f('0xb3')],_0x4f44e0[_0x3d8f('0x36')],_0x4f44e0[_0x3d8f('0xb4')],![]);_0x3d78a3['push'](_0x2b582b);});return Promise[_0x3d8f('0xb5')](_0x3d78a3);})['then'](function(_0x35ee40){_0x4fca8e=_0x35ee40;_0x505e92=Object[_0x3d8f('0xb0')]([],_0x3fed7e);console['log'](_0x3d8f('0xb6'),_0x3fed7e);_[_0x3d8f('0xb7')](_0x505e92,function(_0x5891cb){return _0x1fa1b8[_0x3d8f('0xb1')](_0x5891cb[_0x3d8f('0x36')]);});console[_0x3d8f('0xae')](_0x3d8f('0xb8'),_0x505e92);_0x3d78a3=[];_0x505e92['forEach'](function(_0x5e655a){var _0x27de8c=createFieldObject(_0x24785f,_0x3e0f96,_0x5e655a[_0x3d8f('0xb3')],_0x5e655a[_0x3d8f('0x36')],_0x5e655a[_0x3d8f('0xb4')],!![]);_0x3d78a3[_0x3d8f('0xb9')](_0x27de8c);});return Promise[_0x3d8f('0xb5')](_0x3d78a3);})[_0x3d8f('0x1b')](function(_0x47852d){_0x30599c=_0x47852d;var _0x3e3101=_0x4fca8e[_0x3d8f('0xba')](_0x30599c);return{'count':_0x3e3101['length'],'rows':_0x3e3101};})[_0x3d8f('0x1b')](respondWithResult(_0x464622,null))[_0x3d8f('0x53')](function(_0x39e94a){console[_0x3d8f('0xae')]('ServiceNow\x20error:\x20'+_0x39e94a);var _0x2d5a84=_0xc27f1a[_0x3d8f('0x40')]['test']?0x1f4:_0x39e94a['statusCode']||0x1f4;logger[_0x3d8f('0x22')](_0x39e94a[_0x3d8f('0x35')]);delete _0x39e94a[_0x3d8f('0x36')];if(_0x2d5a84===0x191){_0x2d5a84=0x190;}_0x464622['status'](_0x2d5a84)[_0x3d8f('0x37')](_0xc27f1a[_0x3d8f('0x40')]['test']?{'message':_0x3d8f('0xbb'),'statusCode':_0x39e94a[_0x3d8f('0xbc')]}:_0x39e94a);});};function createFieldObject(_0x478336,_0x12d2c9,_0x34e7bb,_0x4ddaf6,_0x2856c9,_0x941ad1){return new Promise(function(_0x57da3b,_0x497c51){var _0x58d5e6={'id':_0x4ddaf6,'name':_0x2856c9,'custom':_0x941ad1};if(_0x34e7bb==='boolean'){_0x58d5e6[_0x3d8f('0x4d')]=[{'name':_0x3d8f('0xbd'),'value':'true'},{'name':_0x3d8f('0xbe'),'value':_0x3d8f('0xbf')}];_0x57da3b(_0x58d5e6);}else{var _0x3c3f18={'method':_0x3d8f('0xac'),'uri':_0x478336+_0x3d8f('0xc0')+_0x4ddaf6,'auth':_0x12d2c9,'json':!![]};return rp(_0x3c3f18)['then'](function(_0x564043){var _0x423a8b=[];if(_0x564043['result']['length']>0x0){_0x564043[_0x3d8f('0x25')]['forEach'](function(_0x1dc81e){if(_0x1dc81e[_0x3d8f('0xc1')]===_0x3d8f('0xbf')){var _0x87ebfd={'name':_0x1dc81e[_0x3d8f('0xb4')],'value':_0x1dc81e[_0x3d8f('0xc2')]};_0x423a8b[_0x3d8f('0xb9')](_0x87ebfd);}});}_0x58d5e6[_0x3d8f('0x4d')]=_0x423a8b;if(_0x58d5e6[_0x3d8f('0x4d')][_0x3d8f('0x45')]>0x0){_0x57da3b(_0x58d5e6);}else{if(_0x941ad1==![]){_0x57da3b();}else{_0x57da3b(_0x58d5e6);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index a0d952f..448b70a 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 _0xe015=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','bluebird'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0xe015,0x13b));var _0x5e01=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe015[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x5e01('0x8')]=function(_0x3d2da2,_0x4de678){return _0x3d2da2['define'](_0x5e01('0x9'),attributes,{'tableName':_0x5e01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98a8=['ServicenowAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x98a8,0x12c));var _0x898a=function(_0x2865f4,_0x1dd96f){_0x2865f4=_0x2865f4-0x0;var _0x2b46cd=_0x98a8[_0x2865f4];return _0x2b46cd;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var logger=require(_0x898a('0x2'))(_0x898a('0x3'));var moment=require(_0x898a('0x4'));var BPromise=require(_0x898a('0x5'));var rp=require(_0x898a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var attributes=require(_0x898a('0x9'));var integrations=require(_0x898a('0xa'));module[_0x898a('0xb')]=function(_0x5d7e59,_0x3aadc2){return _0x5d7e59['define'](_0x898a('0xc'),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 2795860..441d58d 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 _0xc1c6=['client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','GetServicenowAccount','ShowServicenowAccount','find','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5df59f,_0xf11a72){var _0x190e3b=function(_0x2b983e){while(--_0x2b983e){_0x5df59f['push'](_0x5df59f['shift']());}};_0x190e3b(++_0xf11a72);}(_0xc1c6,0xb4));var _0x6c1c=function(_0x5f4638,_0x2257fe){_0x5f4638=_0x5f4638-0x0;var _0x543191=_0xc1c6[_0x5f4638];return _0x543191;};'use strict';var _=require('lodash');var util=require(_0x6c1c('0x0'));var moment=require(_0x6c1c('0x1'));var BPromise=require(_0x6c1c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c1c('0x3'));var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))(_0x6c1c('0x7'));var config=require(_0x6c1c('0x8'));var jayson=require(_0x6c1c('0x9'));var client=jayson[_0x6c1c('0xa')][_0x6c1c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a16e7,_0x3af1d4,_0x596ff4){return new BPromise(function(_0x183e10,_0x58bcbb){return client[_0x6c1c('0xc')](_0x4a16e7,_0x596ff4)[_0x6c1c('0xd')](function(_0x349ada){logger[_0x6c1c('0xe')](_0x6c1c('0xf'),_0x3af1d4,_0x6c1c('0x10'));logger[_0x6c1c('0x11')](_0x6c1c('0x12'),_0x3af1d4,'request\x20sent',JSON[_0x6c1c('0x13')](_0x349ada));if(_0x349ada['error']){if(_0x349ada[_0x6c1c('0x14')][_0x6c1c('0x15')]===0x1f4){logger[_0x6c1c('0x14')](_0x6c1c('0xf'),_0x3af1d4,_0x349ada[_0x6c1c('0x14')][_0x6c1c('0x16')]);return _0x58bcbb(_0x349ada[_0x6c1c('0x14')][_0x6c1c('0x16')]);}logger[_0x6c1c('0x14')](_0x6c1c('0xf'),_0x3af1d4,_0x349ada[_0x6c1c('0x14')][_0x6c1c('0x16')]);return _0x183e10(_0x349ada[_0x6c1c('0x14')]['message']);}else{logger['info'](_0x6c1c('0xf'),_0x3af1d4,_0x6c1c('0x10'));_0x183e10(_0x349ada[_0x6c1c('0x17')][_0x6c1c('0x16')]);}})[_0x6c1c('0x18')](function(_0x7cca1){logger[_0x6c1c('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x3af1d4,_0x7cca1);_0x58bcbb(_0x7cca1);});});}exports['GetServicenowAccount']=function(_0x5ae47b){var _0x565a4e=this;return new Promise(function(_0x2ceb84,_0x2f7b00){return db[_0x6c1c('0x19')][_0x6c1c('0x1a')]({'raw':_0x5ae47b[_0x6c1c('0x1b')]?_0x5ae47b['options']['raw']===undefined?!![]:![]:!![],'where':_0x5ae47b[_0x6c1c('0x1b')]?_0x5ae47b[_0x6c1c('0x1b')][_0x6c1c('0x1c')]||null:null,'attributes':_0x5ae47b[_0x6c1c('0x1b')]?_0x5ae47b[_0x6c1c('0x1b')][_0x6c1c('0x1d')]||null:null,'limit':_0x5ae47b[_0x6c1c('0x1b')]?_0x5ae47b['options'][_0x6c1c('0x1e')]||null:null,'include':_0x5ae47b[_0x6c1c('0x1b')]?_0x5ae47b[_0x6c1c('0x1b')][_0x6c1c('0x1f')]?_[_0x6c1c('0x20')](_0x5ae47b[_0x6c1c('0x1b')][_0x6c1c('0x1f')],function(_0x5bf845){return{'model':db[_0x5bf845[_0x6c1c('0x21')]],'as':_0x5bf845['as'],'attributes':_0x5bf845['attributes'],'include':_0x5bf845['include']?_[_0x6c1c('0x20')](_0x5bf845['include'],function(_0x2a7996){return{'model':db[_0x2a7996[_0x6c1c('0x21')]],'as':_0x2a7996['as'],'attributes':_0x2a7996[_0x6c1c('0x1d')],'include':_0x2a7996[_0x6c1c('0x1f')]?_[_0x6c1c('0x20')](_0x2a7996[_0x6c1c('0x1f')],function(_0x3d74f8){return{'model':db[_0x3d74f8[_0x6c1c('0x21')]],'as':_0x3d74f8['as'],'attributes':_0x3d74f8[_0x6c1c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6c1c('0xd')](function(_0x440aae){logger['info']('GetServicenowAccount',_0x5ae47b);logger[_0x6c1c('0x11')](_0x6c1c('0x22'),_0x5ae47b,JSON[_0x6c1c('0x13')](_0x440aae));_0x2ceb84(_0x440aae);})['catch'](function(_0x145b61){logger[_0x6c1c('0x14')]('GetServicenowAccount',_0x145b61[_0x6c1c('0x16')],_0x5ae47b);_0x2f7b00(_0x565a4e['error'](0x1f4,_0x145b61['message']));});});};exports[_0x6c1c('0x23')]=function(_0xdc96c1){var _0x5ac8e1=this;return new Promise(function(_0x4c3791,_0x5b757b){return db['ServicenowAccount'][_0x6c1c('0x24')]({'raw':_0xdc96c1['options']?_0xdc96c1[_0x6c1c('0x1b')][_0x6c1c('0x25')]===undefined?!![]:![]:!![],'where':_0xdc96c1['options']?_0xdc96c1['options'][_0x6c1c('0x1c')]||null:null,'attributes':_0xdc96c1[_0x6c1c('0x1b')]?_0xdc96c1[_0x6c1c('0x1b')][_0x6c1c('0x1d')]||null:null,'include':_0xdc96c1[_0x6c1c('0x1b')]?_0xdc96c1[_0x6c1c('0x1b')]['include']?_['map'](_0xdc96c1[_0x6c1c('0x1b')]['include'],function(_0x19086c){return{'model':db[_0x19086c[_0x6c1c('0x21')]],'as':_0x19086c['as'],'attributes':_0x19086c[_0x6c1c('0x1d')],'include':_0x19086c[_0x6c1c('0x1f')]?_[_0x6c1c('0x20')](_0x19086c[_0x6c1c('0x1f')],function(_0x4eb4ee){return{'model':db[_0x4eb4ee[_0x6c1c('0x21')]],'as':_0x4eb4ee['as'],'attributes':_0x4eb4ee[_0x6c1c('0x1d')],'include':_0x4eb4ee[_0x6c1c('0x1f')]?_[_0x6c1c('0x20')](_0x4eb4ee[_0x6c1c('0x1f')],function(_0x387712){return{'model':db[_0x387712[_0x6c1c('0x21')]],'as':_0x387712['as'],'attributes':_0x387712[_0x6c1c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6c1c('0xd')](function(_0x245f73){logger[_0x6c1c('0xe')]('ShowServicenowAccount',_0xdc96c1);logger[_0x6c1c('0x11')]('ShowServicenowAccount',_0xdc96c1,JSON['stringify'](_0x245f73));_0x4c3791(_0x245f73);})['catch'](function(_0x4cc7aa){logger['error']('ShowServicenowAccount',_0x4cc7aa[_0x6c1c('0x16')],_0xdc96c1);_0x5b757b(_0x5ac8e1['error'](0x1f4,_0x4cc7aa[_0x6c1c('0x16')]));});});}; \ No newline at end of file +var _0x9d9b=['error','code','message','result','catch','ServicenowAccount','options','where','attributes','limit','include','map','model','then','GetServicenowAccount','ShowServicenowAccount','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x9d9b,0x16f));var _0xb9d9=function(_0x4f7cd6,_0xf5e132){_0x4f7cd6=_0x4f7cd6-0x0;var _0x4b2c6a=_0x9d9b[_0x4f7cd6];return _0x4b2c6a;};'use strict';var _=require(_0xb9d9('0x0'));var util=require(_0xb9d9('0x1'));var moment=require('moment');var BPromise=require(_0xb9d9('0x2'));var rs=require(_0xb9d9('0x3'));var fs=require('fs');var Redis=require(_0xb9d9('0x4'));var db=require(_0xb9d9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9d9('0x6'))(_0xb9d9('0x7'));var config=require(_0xb9d9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb9d9('0x9')][_0xb9d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21db46,_0x2b7728,_0x3a988c){return new BPromise(function(_0x2b877c,_0x109ddd){return client[_0xb9d9('0xb')](_0x21db46,_0x3a988c)['then'](function(_0x291a4a){logger[_0xb9d9('0xc')](_0xb9d9('0xd'),_0x2b7728,'request\x20sent');logger[_0xb9d9('0xe')](_0xb9d9('0xf'),_0x2b7728,_0xb9d9('0x10'),JSON[_0xb9d9('0x11')](_0x291a4a));if(_0x291a4a['error']){if(_0x291a4a[_0xb9d9('0x12')][_0xb9d9('0x13')]===0x1f4){logger[_0xb9d9('0x12')](_0xb9d9('0xd'),_0x2b7728,_0x291a4a[_0xb9d9('0x12')]['message']);return _0x109ddd(_0x291a4a[_0xb9d9('0x12')][_0xb9d9('0x14')]);}logger[_0xb9d9('0x12')](_0xb9d9('0xd'),_0x2b7728,_0x291a4a[_0xb9d9('0x12')]['message']);return _0x2b877c(_0x291a4a[_0xb9d9('0x12')][_0xb9d9('0x14')]);}else{logger[_0xb9d9('0xc')](_0xb9d9('0xd'),_0x2b7728,_0xb9d9('0x10'));_0x2b877c(_0x291a4a[_0xb9d9('0x15')][_0xb9d9('0x14')]);}})[_0xb9d9('0x16')](function(_0x4bb6e9){logger[_0xb9d9('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x2b7728,_0x4bb6e9);_0x109ddd(_0x4bb6e9);});});}exports['GetServicenowAccount']=function(_0x18678d){var _0x13b9eb=this;return new Promise(function(_0x206ce5,_0x482af9){return db[_0xb9d9('0x17')]['findAll']({'raw':_0x18678d[_0xb9d9('0x18')]?_0x18678d[_0xb9d9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x18678d[_0xb9d9('0x18')]?_0x18678d['options'][_0xb9d9('0x19')]||null:null,'attributes':_0x18678d['options']?_0x18678d['options'][_0xb9d9('0x1a')]||null:null,'limit':_0x18678d[_0xb9d9('0x18')]?_0x18678d['options'][_0xb9d9('0x1b')]||null:null,'include':_0x18678d[_0xb9d9('0x18')]?_0x18678d[_0xb9d9('0x18')][_0xb9d9('0x1c')]?_[_0xb9d9('0x1d')](_0x18678d[_0xb9d9('0x18')][_0xb9d9('0x1c')],function(_0x1d03ef){return{'model':db[_0x1d03ef['model']],'as':_0x1d03ef['as'],'attributes':_0x1d03ef[_0xb9d9('0x1a')],'include':_0x1d03ef[_0xb9d9('0x1c')]?_[_0xb9d9('0x1d')](_0x1d03ef[_0xb9d9('0x1c')],function(_0x4774a3){return{'model':db[_0x4774a3['model']],'as':_0x4774a3['as'],'attributes':_0x4774a3[_0xb9d9('0x1a')],'include':_0x4774a3['include']?_['map'](_0x4774a3[_0xb9d9('0x1c')],function(_0x18c98a){return{'model':db[_0x18c98a[_0xb9d9('0x1e')]],'as':_0x18c98a['as'],'attributes':_0x18c98a[_0xb9d9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb9d9('0x1f')](function(_0x5d7df5){logger[_0xb9d9('0xc')](_0xb9d9('0x20'),_0x18678d);logger[_0xb9d9('0xe')](_0xb9d9('0x20'),_0x18678d,JSON['stringify'](_0x5d7df5));_0x206ce5(_0x5d7df5);})['catch'](function(_0x44d761){logger[_0xb9d9('0x12')]('GetServicenowAccount',_0x44d761[_0xb9d9('0x14')],_0x18678d);_0x482af9(_0x13b9eb[_0xb9d9('0x12')](0x1f4,_0x44d761['message']));});});};exports[_0xb9d9('0x21')]=function(_0xcd6c){var _0x50d255=this;return new Promise(function(_0xedc752,_0x47d514){return db[_0xb9d9('0x17')]['find']({'raw':_0xcd6c['options']?_0xcd6c[_0xb9d9('0x18')][_0xb9d9('0x22')]===undefined?!![]:![]:!![],'where':_0xcd6c[_0xb9d9('0x18')]?_0xcd6c['options'][_0xb9d9('0x19')]||null:null,'attributes':_0xcd6c[_0xb9d9('0x18')]?_0xcd6c['options']['attributes']||null:null,'include':_0xcd6c['options']?_0xcd6c[_0xb9d9('0x18')][_0xb9d9('0x1c')]?_[_0xb9d9('0x1d')](_0xcd6c[_0xb9d9('0x18')][_0xb9d9('0x1c')],function(_0x4881b1){return{'model':db[_0x4881b1[_0xb9d9('0x1e')]],'as':_0x4881b1['as'],'attributes':_0x4881b1[_0xb9d9('0x1a')],'include':_0x4881b1[_0xb9d9('0x1c')]?_[_0xb9d9('0x1d')](_0x4881b1[_0xb9d9('0x1c')],function(_0x58e50b){return{'model':db[_0x58e50b[_0xb9d9('0x1e')]],'as':_0x58e50b['as'],'attributes':_0x58e50b['attributes'],'include':_0x58e50b[_0xb9d9('0x1c')]?_[_0xb9d9('0x1d')](_0x58e50b[_0xb9d9('0x1c')],function(_0x1b8e0a){return{'model':db[_0x1b8e0a[_0xb9d9('0x1e')]],'as':_0x1b8e0a['as'],'attributes':_0x1b8e0a[_0xb9d9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45460a){logger[_0xb9d9('0xc')](_0xb9d9('0x21'),_0xcd6c);logger[_0xb9d9('0xe')]('ShowServicenowAccount',_0xcd6c,JSON[_0xb9d9('0x11')](_0x45460a));_0xedc752(_0x45460a);})['catch'](function(_0x518084){logger[_0xb9d9('0x12')](_0xb9d9('0x21'),_0x518084[_0xb9d9('0x14')],_0xcd6c);_0x47d514(_0x50d255[_0xb9d9('0x12')](0x1f4,_0x518084['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 2f95492..b163d03 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 _0x8309=['../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x522559,_0x9db08){var _0x48593d=function(_0x31502b){while(--_0x31502b){_0x522559['push'](_0x522559['shift']());}};_0x48593d(++_0x9db08);}(_0x8309,0x90));var _0x9830=function(_0x5054e6,_0x2bc724){_0x5054e6=_0x5054e6-0x0;var _0x31c6c8=_0x8309[_0x5054e6];return _0x31c6c8;};'use strict';var multer=require(_0x9830('0x0'));var util=require(_0x9830('0x1'));var path=require('path');var timeout=require(_0x9830('0x2'));var express=require('express');var router=express[_0x9830('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9830('0x4'));var interaction=require(_0x9830('0x5'));var config=require(_0x9830('0x6'));var controller=require(_0x9830('0x7'));router['get']('/',auth[_0x9830('0x8')](),controller[_0x9830('0x9')]);router[_0x9830('0xa')](_0x9830('0xb'),auth[_0x9830('0x8')](),controller[_0x9830('0xc')]);router[_0x9830('0xa')](_0x9830('0xd'),auth[_0x9830('0x8')](),controller[_0x9830('0xe')]);router[_0x9830('0xa')](_0x9830('0xf'),auth[_0x9830('0x8')](),controller[_0x9830('0x10')]);router['get'](_0x9830('0x11'),auth[_0x9830('0x8')](),controller[_0x9830('0x12')]);router[_0x9830('0x13')]('/',auth['isAuthenticated'](),controller[_0x9830('0x14')]);router[_0x9830('0x15')](_0x9830('0xb'),auth[_0x9830('0x8')](),controller[_0x9830('0x16')]);router['delete'](_0x9830('0xb'),auth['isAuthenticated'](),controller[_0x9830('0x17')]);module[_0x9830('0x18')]=router; \ No newline at end of file +var _0x0619=['/:id/descriptions','getDescriptions','create','/:id','update','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','isAuthenticated','getFields','/:id/subjects','getSubjects'];(function(_0x4b74ba,_0x1e1a05){var _0x4277c0=function(_0xc2510d){while(--_0xc2510d){_0x4b74ba['push'](_0x4b74ba['shift']());}};_0x4277c0(++_0x1e1a05);}(_0x0619,0x6a));var _0x9061=function(_0x59883f,_0xad57df){_0x59883f=_0x59883f-0x0;var _0x2b347d=_0x0619[_0x59883f];return _0x2b347d;};'use strict';var multer=require(_0x9061('0x0'));var util=require(_0x9061('0x1'));var path=require('path');var timeout=require(_0x9061('0x2'));var express=require('express');var router=express[_0x9061('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9061('0x4'));var interaction=require(_0x9061('0x5'));var config=require(_0x9061('0x6'));var controller=require(_0x9061('0x7'));router[_0x9061('0x8')]('/',auth['isAuthenticated'](),controller[_0x9061('0x9')]);router[_0x9061('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/fields',auth[_0x9061('0xa')](),controller[_0x9061('0xb')]);router[_0x9061('0x8')](_0x9061('0xc'),auth['isAuthenticated'](),controller[_0x9061('0xd')]);router[_0x9061('0x8')](_0x9061('0xe'),auth[_0x9061('0xa')](),controller[_0x9061('0xf')]);router['post']('/',auth[_0x9061('0xa')](),controller[_0x9061('0x10')]);router['put'](_0x9061('0x11'),auth[_0x9061('0xa')](),controller[_0x9061('0x12')]);router[_0x9061('0x13')](_0x9061('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 9d8d0bc..d55bee3 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 _0xd32a=['sequelize','exports','STRING'];(function(_0x3de05f,_0x1b7804){var _0x427e36=function(_0x50bd3b){while(--_0x50bd3b){_0x3de05f['push'](_0x3de05f['shift']());}};_0x427e36(++_0x1b7804);}(_0xd32a,0x1c8));var _0xad32=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xd32a[_0x576170];return _0x397c70;};'use strict';var Sequelize=require(_0xad32('0x0'));module[_0xad32('0x1')]={'name':{'type':Sequelize[_0xad32('0x2')]},'description':{'type':Sequelize[_0xad32('0x2')]}}; \ No newline at end of file +var _0xc8f8=['STRING','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc8f8,0xfd));var _0x8c8f=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xc8f8[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require(_0x8c8f('0x0'));module[_0x8c8f('0x1')]={'name':{'type':Sequelize[_0x8c8f('0x2')]},'description':{'type':Sequelize[_0x8c8f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 3c99f92..53ca05f 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 _0xbc36=['squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','map','ServicenowConfiguration','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','params','keys','create','update','body','find','getFields','findOne','ServicenowField','getSubjects','nolimit','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash'];(function(_0x4a1fd5,_0x1e2159){var _0x26be24=function(_0x23a0d8){while(--_0x23a0d8){_0x4a1fd5['push'](_0x4a1fd5['shift']());}};_0x26be24(++_0x1e2159);}(_0xbc36,0x150));var _0x6bc3=function(_0x1b5792,_0x16b34b){_0x1b5792=_0x1b5792-0x0;var _0xc25239=_0xbc36[_0x1b5792];return _0xc25239;};'use strict';var emlformat=require(_0x6bc3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6bc3('0x1'));var jsonpatch=require(_0x6bc3('0x2'));var rp=require(_0x6bc3('0x3'));var moment=require(_0x6bc3('0x4'));var BPromise=require(_0x6bc3('0x5'));var Mustache=require('mustache');var util=require(_0x6bc3('0x6'));var path=require(_0x6bc3('0x7'));var sox=require('sox');var csv=require(_0x6bc3('0x8'));var ejs=require(_0x6bc3('0x9'));var fs=require('fs');var fs_extra=require(_0x6bc3('0xa'));var _=require(_0x6bc3('0xb'));var squel=require(_0x6bc3('0xc'));var crypto=require('crypto');var jsforce=require(_0x6bc3('0xd'));var deskjs=require(_0x6bc3('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6bc3('0xf'));var Redis=require(_0x6bc3('0x10'));var authService=require(_0x6bc3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6bc3('0x12'));var hardwareService=require(_0x6bc3('0x13'));var logger=require('../../config/logger')(_0x6bc3('0x14'));var utils=require(_0x6bc3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6bc3('0x16'));var db=require(_0x6bc3('0x17'))['db'];var jayson=require(_0x6bc3('0x18'));var client=jayson[_0x6bc3('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1740cd,_0x56040b,_0x53b392,_0x18e495){return new BPromise(function(_0x5709db,_0x578d7a){var _0x1f9d28=_0x18e495||client;return _0x1f9d28[_0x6bc3('0x1a')](_0x1740cd,_0x53b392)[_0x6bc3('0x1b')](function(_0x48f657){logger[_0x6bc3('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s',_0x56040b,_0x6bc3('0x1d'));logger['debug'](_0x6bc3('0x1e'),_0x56040b,'request\x20sent',JSON['stringify'](_0x48f657));if(_0x48f657['error']){if(_0x48f657[_0x6bc3('0x1f')][_0x6bc3('0x20')]===0x1f4){logger[_0x6bc3('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s',_0x56040b,_0x48f657[_0x6bc3('0x1f')][_0x6bc3('0x21')]);return _0x578d7a(_0x48f657['error'][_0x6bc3('0x21')]);}logger[_0x6bc3('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s',_0x56040b,_0x48f657[_0x6bc3('0x1f')][_0x6bc3('0x21')]);return _0x5709db(_0x48f657[_0x6bc3('0x1f')][_0x6bc3('0x21')]);}else{logger[_0x6bc3('0x1c')](_0x6bc3('0x22'),_0x56040b,_0x6bc3('0x1d'));_0x5709db(_0x48f657['result'][_0x6bc3('0x21')]);}})[_0x6bc3('0x23')](function(_0x3f9801){logger[_0x6bc3('0x1f')](_0x6bc3('0x22'),_0x56040b,_0x3f9801);_0x578d7a(_0x3f9801);});});}function respondWithStatusCode(_0x166f76,_0x127fd6){_0x127fd6=_0x127fd6||0xcc;return function(_0x36e6e5){if(_0x36e6e5){return _0x166f76[_0x6bc3('0x24')](_0x127fd6);}return _0x166f76[_0x6bc3('0x25')](_0x127fd6)['end']();};}function respondWithResult(_0x42618f,_0x3faa31){_0x3faa31=_0x3faa31||0xc8;return function(_0x3fa45e){if(_0x3fa45e){return _0x42618f[_0x6bc3('0x25')](_0x3faa31)[_0x6bc3('0x26')](_0x3fa45e);}};}function respondWithFilteredResult(_0x538bae,_0x152198){return function(_0x4a1dca){if(_0x4a1dca){var _0x2f23b9=typeof _0x152198['offset']===_0x6bc3('0x27')&&typeof _0x152198[_0x6bc3('0x28')]==='undefined';var _0x2e4205=_0x4a1dca[_0x6bc3('0x29')];var _0x40995d=_0x2f23b9?0x0:_0x152198['offset'];var _0x1417d9=_0x2f23b9?_0x4a1dca['count']:_0x152198[_0x6bc3('0x2a')]+_0x152198[_0x6bc3('0x28')];var _0x29a845;if(_0x1417d9>=_0x2e4205){_0x1417d9=_0x2e4205;_0x29a845=0xc8;}else{_0x29a845=0xce;}_0x538bae['status'](_0x29a845);return _0x538bae[_0x6bc3('0x2b')](_0x6bc3('0x2c'),_0x40995d+'-'+_0x1417d9+'/'+_0x2e4205)[_0x6bc3('0x26')](_0x4a1dca);}return null;};}function patchUpdates(_0x2489b7){return function(_0x368463){try{jsonpatch[_0x6bc3('0x2d')](_0x368463,_0x2489b7,!![]);}catch(_0x400079){return BPromise[_0x6bc3('0x2e')](_0x400079);}return _0x368463[_0x6bc3('0x2f')]();};}function saveUpdates(_0x5a875e,_0x5a6029){return function(_0x118d5d){if(_0x118d5d){return _0x118d5d['update'](_0x5a875e)[_0x6bc3('0x1b')](function(_0x1ab3f9){return _0x1ab3f9;});}return null;};}function removeEntity(_0x32628d,_0x18d5d9){return function(_0x5f3e5e){if(_0x5f3e5e){return _0x5f3e5e[_0x6bc3('0x30')]()['then'](function(){_0x32628d[_0x6bc3('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4761c3,_0x10f964){return function(_0x4c63f4){if(!_0x4c63f4){_0x4761c3[_0x6bc3('0x24')](0x194);}return _0x4c63f4;};}function handleError(_0x2485a4,_0x41c1b6){_0x41c1b6=_0x41c1b6||0x1f4;return function(_0x38f93b){logger['error'](_0x38f93b[_0x6bc3('0x31')]);if(_0x38f93b[_0x6bc3('0x32')]){delete _0x38f93b[_0x6bc3('0x32')];}_0x2485a4[_0x6bc3('0x25')](_0x41c1b6)[_0x6bc3('0x33')](_0x38f93b);};}exports['index']=function(_0x49fc1f,_0x52c505){var _0x44848b={},_0x364c67={},_0x44a4f3={'count':0x0,'rows':[]};var _0x518c4e=_[_0x6bc3('0x34')](db[_0x6bc3('0x35')][_0x6bc3('0x36')],function(_0x179839){return{'name':_0x179839['fieldName'],'type':_0x179839['type'][_0x6bc3('0x37')]};});_0x364c67[_0x6bc3('0x38')]=_['map'](_0x518c4e,'name');_0x364c67['query']=_['keys'](_0x49fc1f[_0x6bc3('0x39')]);_0x364c67[_0x6bc3('0x3a')]=_[_0x6bc3('0x3b')](_0x364c67[_0x6bc3('0x38')],_0x364c67['query']);_0x44848b[_0x6bc3('0x3c')]=_[_0x6bc3('0x3b')](_0x364c67[_0x6bc3('0x38')],qs[_0x6bc3('0x3d')](_0x49fc1f[_0x6bc3('0x39')][_0x6bc3('0x3d')]));_0x44848b[_0x6bc3('0x3c')]=_0x44848b[_0x6bc3('0x3c')][_0x6bc3('0x3e')]?_0x44848b[_0x6bc3('0x3c')]:_0x364c67[_0x6bc3('0x38')];if(!_0x49fc1f[_0x6bc3('0x39')][_0x6bc3('0x3f')]('nolimit')){_0x44848b[_0x6bc3('0x28')]=qs[_0x6bc3('0x28')](_0x49fc1f['query'][_0x6bc3('0x28')]);_0x44848b[_0x6bc3('0x2a')]=qs[_0x6bc3('0x2a')](_0x49fc1f[_0x6bc3('0x39')][_0x6bc3('0x2a')]);}_0x44848b[_0x6bc3('0x40')]=qs[_0x6bc3('0x41')](_0x49fc1f[_0x6bc3('0x39')][_0x6bc3('0x41')]);_0x44848b['where']=qs[_0x6bc3('0x3a')](_[_0x6bc3('0x42')](_0x49fc1f['query'],_0x364c67['filters']),_0x518c4e);if(_0x49fc1f[_0x6bc3('0x39')][_0x6bc3('0x43')]){_0x44848b[_0x6bc3('0x44')]=_['merge'](_0x44848b[_0x6bc3('0x44')],{'$or':_['map'](_0x518c4e,function(_0x3d911a){if(_0x3d911a[_0x6bc3('0x45')]!==_0x6bc3('0x46')){var _0x442065={};_0x442065[_0x3d911a[_0x6bc3('0x32')]]={'$like':'%'+_0x49fc1f[_0x6bc3('0x39')]['filter']+'%'};return _0x442065;}})});}_0x44848b=_[_0x6bc3('0x47')]({},_0x44848b,_0x49fc1f[_0x6bc3('0x48')]);var _0x411908={'where':_0x44848b['where']};return db[_0x6bc3('0x35')]['count'](_0x411908)[_0x6bc3('0x1b')](function(_0x432ea9){_0x44a4f3['count']=_0x432ea9;if(_0x49fc1f['query'][_0x6bc3('0x49')]){_0x44848b[_0x6bc3('0x4a')]=[{'all':!![]}];}return db[_0x6bc3('0x35')]['findAll'](_0x44848b);})[_0x6bc3('0x1b')](function(_0x49aa40){_0x44a4f3['rows']=_0x49aa40;return _0x44a4f3;})[_0x6bc3('0x1b')](respondWithFilteredResult(_0x52c505,_0x44848b))[_0x6bc3('0x23')](handleError(_0x52c505,null));};exports['show']=function(_0x29f486,_0x45ccfc){var _0x21b61b={'raw':![],'where':{'id':_0x29f486[_0x6bc3('0x4b')]['id']}},_0x38e481={};_0x38e481['model']=_[_0x6bc3('0x4c')](db[_0x6bc3('0x35')][_0x6bc3('0x36')]);_0x38e481[_0x6bc3('0x39')]=_[_0x6bc3('0x4c')](_0x29f486[_0x6bc3('0x39')]);_0x38e481[_0x6bc3('0x3a')]=_[_0x6bc3('0x3b')](_0x38e481[_0x6bc3('0x38')],_0x38e481[_0x6bc3('0x39')]);_0x21b61b[_0x6bc3('0x3c')]=_[_0x6bc3('0x3b')](_0x38e481[_0x6bc3('0x38')],qs[_0x6bc3('0x3d')](_0x29f486['query'][_0x6bc3('0x3d')]));_0x21b61b[_0x6bc3('0x3c')]=_0x21b61b['attributes'][_0x6bc3('0x3e')]?_0x21b61b[_0x6bc3('0x3c')]:_0x38e481[_0x6bc3('0x38')];if(_0x29f486[_0x6bc3('0x39')]['includeAll']){_0x21b61b[_0x6bc3('0x4a')]=[{'all':!![]}];}_0x21b61b=_['merge']({},_0x21b61b,_0x29f486[_0x6bc3('0x48')]);return db[_0x6bc3('0x35')]['find'](_0x21b61b)['then'](handleEntityNotFound(_0x45ccfc,null))['then'](respondWithResult(_0x45ccfc,null))[_0x6bc3('0x23')](handleError(_0x45ccfc,null));};exports['create']=function(_0x240701,_0x130df3){return db[_0x6bc3('0x35')][_0x6bc3('0x4d')](_0x240701['body'],{})[_0x6bc3('0x1b')](respondWithResult(_0x130df3,0xc9))[_0x6bc3('0x23')](handleError(_0x130df3,null));};exports[_0x6bc3('0x4e')]=function(_0x154bfe,_0x5b8366){if(_0x154bfe['body']['id']){delete _0x154bfe[_0x6bc3('0x4f')]['id'];}return db[_0x6bc3('0x35')][_0x6bc3('0x50')]({'where':{'id':_0x154bfe[_0x6bc3('0x4b')]['id']}})[_0x6bc3('0x1b')](handleEntityNotFound(_0x5b8366,null))[_0x6bc3('0x1b')](saveUpdates(_0x154bfe[_0x6bc3('0x4f')],null))['then'](respondWithResult(_0x5b8366,null))[_0x6bc3('0x23')](handleError(_0x5b8366,null));};exports[_0x6bc3('0x30')]=function(_0x331ed0,_0x3d3645){return db['ServicenowConfiguration']['find']({'where':{'id':_0x331ed0[_0x6bc3('0x4b')]['id']}})[_0x6bc3('0x1b')](handleEntityNotFound(_0x3d3645,null))['then'](removeEntity(_0x3d3645,null))[_0x6bc3('0x23')](handleError(_0x3d3645,null));};exports[_0x6bc3('0x51')]=function(_0x6d209e,_0x5f0c30,_0x391e4e){var _0x42b753={};var _0xfa8575={};var _0x175a5e;var _0x25d126;return db[_0x6bc3('0x35')][_0x6bc3('0x52')]({'where':{'id':_0x6d209e[_0x6bc3('0x4b')]['id']}})[_0x6bc3('0x1b')](handleEntityNotFound(_0x5f0c30,null))[_0x6bc3('0x1b')](function(_0x2dd839){if(_0x2dd839){_0x175a5e=_0x2dd839;_0xfa8575[_0x6bc3('0x38')]=_['keys'](db[_0x6bc3('0x53')]['rawAttributes']);_0xfa8575[_0x6bc3('0x39')]=_[_0x6bc3('0x4c')](_0x6d209e[_0x6bc3('0x39')]);_0xfa8575['filters']=_[_0x6bc3('0x3b')](_0xfa8575[_0x6bc3('0x38')],_0xfa8575['query']);_0x42b753['attributes']=_[_0x6bc3('0x3b')](_0xfa8575[_0x6bc3('0x38')],qs[_0x6bc3('0x3d')](_0x6d209e[_0x6bc3('0x39')][_0x6bc3('0x3d')]));_0x42b753[_0x6bc3('0x3c')]=_0x42b753['attributes']['length']?_0x42b753[_0x6bc3('0x3c')]:_0xfa8575['model'];_0x42b753[_0x6bc3('0x40')]=qs['sort'](_0x6d209e[_0x6bc3('0x39')][_0x6bc3('0x41')]);_0x42b753[_0x6bc3('0x44')]=qs[_0x6bc3('0x3a')](_[_0x6bc3('0x42')](_0x6d209e[_0x6bc3('0x39')],_0xfa8575[_0x6bc3('0x3a')]));if(_0x6d209e[_0x6bc3('0x39')]['filter']){_0x42b753[_0x6bc3('0x44')]=_[_0x6bc3('0x47')](_0x42b753[_0x6bc3('0x44')],{'$or':_[_0x6bc3('0x34')](_0x42b753[_0x6bc3('0x3c')],function(_0x4d5d3a){var _0x2e6f1c={};_0x2e6f1c[_0x4d5d3a]={'$like':'%'+_0x6d209e['query'][_0x6bc3('0x43')]+'%'};return _0x2e6f1c;})});}_0x42b753=_[_0x6bc3('0x47')]({},_0x42b753,_0x6d209e[_0x6bc3('0x48')]);return _0x175a5e[_0x6bc3('0x51')](_0x42b753);}})[_0x6bc3('0x1b')](function(_0xfcb212){if(_0xfcb212){_0x25d126=_0xfcb212[_0x6bc3('0x3e')];if(!_0x6d209e[_0x6bc3('0x39')]['hasOwnProperty']('nolimit')){_0x42b753[_0x6bc3('0x28')]=qs[_0x6bc3('0x28')](_0x6d209e[_0x6bc3('0x39')][_0x6bc3('0x28')]);_0x42b753[_0x6bc3('0x2a')]=qs[_0x6bc3('0x2a')](_0x6d209e['query']['offset']);}return _0x175a5e[_0x6bc3('0x51')](_0x42b753);}})['then'](function(_0x24be24){if(_0x24be24){return _0x24be24?{'count':_0x25d126,'rows':_0x24be24}:null;}})[_0x6bc3('0x1b')](respondWithResult(_0x5f0c30,null))[_0x6bc3('0x23')](handleError(_0x5f0c30,null));};exports[_0x6bc3('0x54')]=function(_0x3632ac,_0x14c3d9,_0x29f5e5){var _0x41d7d3={};var _0xfc75ac={};var _0x5538a8;var _0x5f0663;return db[_0x6bc3('0x35')][_0x6bc3('0x52')]({'where':{'id':_0x3632ac[_0x6bc3('0x4b')]['id']}})[_0x6bc3('0x1b')](handleEntityNotFound(_0x14c3d9,null))['then'](function(_0x3c85f2){if(_0x3c85f2){_0x5538a8=_0x3c85f2;_0xfc75ac[_0x6bc3('0x38')]=_['keys'](db['ServicenowField']['rawAttributes']);_0xfc75ac[_0x6bc3('0x39')]=_[_0x6bc3('0x4c')](_0x3632ac[_0x6bc3('0x39')]);_0xfc75ac[_0x6bc3('0x3a')]=_[_0x6bc3('0x3b')](_0xfc75ac[_0x6bc3('0x38')],_0xfc75ac[_0x6bc3('0x39')]);_0x41d7d3[_0x6bc3('0x3c')]=_['intersection'](_0xfc75ac[_0x6bc3('0x38')],qs[_0x6bc3('0x3d')](_0x3632ac['query'][_0x6bc3('0x3d')]));_0x41d7d3['attributes']=_0x41d7d3[_0x6bc3('0x3c')][_0x6bc3('0x3e')]?_0x41d7d3[_0x6bc3('0x3c')]:_0xfc75ac[_0x6bc3('0x38')];_0x41d7d3['order']=qs[_0x6bc3('0x41')](_0x3632ac[_0x6bc3('0x39')]['sort']);_0x41d7d3[_0x6bc3('0x44')]=qs[_0x6bc3('0x3a')](_[_0x6bc3('0x42')](_0x3632ac[_0x6bc3('0x39')],_0xfc75ac[_0x6bc3('0x3a')]));if(_0x3632ac[_0x6bc3('0x39')][_0x6bc3('0x43')]){_0x41d7d3['where']=_[_0x6bc3('0x47')](_0x41d7d3[_0x6bc3('0x44')],{'$or':_['map'](_0x41d7d3[_0x6bc3('0x3c')],function(_0x209101){var _0x1bd5d4={};_0x1bd5d4[_0x209101]={'$like':'%'+_0x3632ac['query'][_0x6bc3('0x43')]+'%'};return _0x1bd5d4;})});}_0x41d7d3=_[_0x6bc3('0x47')]({},_0x41d7d3,_0x3632ac[_0x6bc3('0x48')]);return _0x5538a8['getSubjects'](_0x41d7d3);}})['then'](function(_0x304634){if(_0x304634){_0x5f0663=_0x304634[_0x6bc3('0x3e')];if(!_0x3632ac['query'][_0x6bc3('0x3f')](_0x6bc3('0x55'))){_0x41d7d3[_0x6bc3('0x28')]=qs['limit'](_0x3632ac[_0x6bc3('0x39')][_0x6bc3('0x28')]);_0x41d7d3[_0x6bc3('0x2a')]=qs[_0x6bc3('0x2a')](_0x3632ac[_0x6bc3('0x39')][_0x6bc3('0x2a')]);}return _0x5538a8['getSubjects'](_0x41d7d3);}})[_0x6bc3('0x1b')](function(_0xb924d0){if(_0xb924d0){return _0xb924d0?{'count':_0x5f0663,'rows':_0xb924d0}:null;}})['then'](respondWithResult(_0x14c3d9,null))[_0x6bc3('0x23')](handleError(_0x14c3d9,null));};exports[_0x6bc3('0x56')]=function(_0x5a9f77,_0x488a94,_0x3bd3fe){var _0x14430e={};var _0x270ab6={};var _0x295123;var _0x2e92d8;return db[_0x6bc3('0x35')][_0x6bc3('0x52')]({'where':{'id':_0x5a9f77[_0x6bc3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x488a94,null))['then'](function(_0x4a2a21){if(_0x4a2a21){_0x295123=_0x4a2a21;_0x270ab6[_0x6bc3('0x38')]=_[_0x6bc3('0x4c')](db['ServicenowField'][_0x6bc3('0x36')]);_0x270ab6[_0x6bc3('0x39')]=_[_0x6bc3('0x4c')](_0x5a9f77['query']);_0x270ab6['filters']=_[_0x6bc3('0x3b')](_0x270ab6[_0x6bc3('0x38')],_0x270ab6[_0x6bc3('0x39')]);_0x14430e[_0x6bc3('0x3c')]=_['intersection'](_0x270ab6[_0x6bc3('0x38')],qs['fields'](_0x5a9f77[_0x6bc3('0x39')][_0x6bc3('0x3d')]));_0x14430e[_0x6bc3('0x3c')]=_0x14430e[_0x6bc3('0x3c')][_0x6bc3('0x3e')]?_0x14430e[_0x6bc3('0x3c')]:_0x270ab6[_0x6bc3('0x38')];_0x14430e[_0x6bc3('0x40')]=qs[_0x6bc3('0x41')](_0x5a9f77[_0x6bc3('0x39')][_0x6bc3('0x41')]);_0x14430e[_0x6bc3('0x44')]=qs[_0x6bc3('0x3a')](_['pick'](_0x5a9f77[_0x6bc3('0x39')],_0x270ab6['filters']));if(_0x5a9f77['query']['filter']){_0x14430e[_0x6bc3('0x44')]=_[_0x6bc3('0x47')](_0x14430e[_0x6bc3('0x44')],{'$or':_['map'](_0x14430e[_0x6bc3('0x3c')],function(_0x15cd56){var _0xfa43b9={};_0xfa43b9[_0x15cd56]={'$like':'%'+_0x5a9f77[_0x6bc3('0x39')][_0x6bc3('0x43')]+'%'};return _0xfa43b9;})});}_0x14430e=_[_0x6bc3('0x47')]({},_0x14430e,_0x5a9f77[_0x6bc3('0x48')]);return _0x295123[_0x6bc3('0x56')](_0x14430e);}})[_0x6bc3('0x1b')](function(_0x5870ca){if(_0x5870ca){_0x2e92d8=_0x5870ca['length'];if(!_0x5a9f77[_0x6bc3('0x39')]['hasOwnProperty'](_0x6bc3('0x55'))){_0x14430e['limit']=qs['limit'](_0x5a9f77[_0x6bc3('0x39')][_0x6bc3('0x28')]);_0x14430e['offset']=qs['offset'](_0x5a9f77['query'][_0x6bc3('0x2a')]);}return _0x295123[_0x6bc3('0x56')](_0x14430e);}})[_0x6bc3('0x1b')](function(_0x53dc8c){if(_0x53dc8c){return _0x53dc8c?{'count':_0x2e92d8,'rows':_0x53dc8c}:null;}})['then'](respondWithResult(_0x488a94,null))[_0x6bc3('0x23')](handleError(_0x488a94,null));}; \ No newline at end of file +var _0xc27a=['destroy','sendStatus','stack','name','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','length','include','find','create','body','getFields','getSubjects','findOne','ServicenowField','hasOwnProperty','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xc27a,0x13b));var _0xac27=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0xc27a[_0x545bed];return _0x16c79c;};'use strict';var emlformat=require(_0xac27('0x0'));var rimraf=require(_0xac27('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac27('0x2'));var rp=require(_0xac27('0x3'));var moment=require(_0xac27('0x4'));var BPromise=require(_0xac27('0x5'));var Mustache=require('mustache');var util=require(_0xac27('0x6'));var path=require(_0xac27('0x7'));var sox=require('sox');var csv=require(_0xac27('0x8'));var ejs=require(_0xac27('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac27('0xa'));var squel=require('squel');var crypto=require(_0xac27('0xb'));var jsforce=require(_0xac27('0xc'));var deskjs=require(_0xac27('0xd'));var toCsv=require(_0xac27('0x8'));var querystring=require(_0xac27('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xac27('0xf'));var qs=require(_0xac27('0x10'));var as=require(_0xac27('0x11'));var hardwareService=require(_0xac27('0x12'));var logger=require(_0xac27('0x13'))(_0xac27('0x14'));var utils=require('../../config/utils');var config=require(_0xac27('0x15'));var licenseUtil=require(_0xac27('0x16'));var db=require(_0xac27('0x17'))['db'];var jayson=require(_0xac27('0x18'));var client=jayson[_0xac27('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5230cf,_0x24d5f0,_0x2e0e60,_0x4f6d65){return new BPromise(function(_0x13e4b1,_0x2e13e0){var _0x12a773=_0x4f6d65||client;return _0x12a773[_0xac27('0x1a')](_0x5230cf,_0x2e0e60)[_0xac27('0x1b')](function(_0x57517d){logger[_0xac27('0x1c')](_0xac27('0x1d'),_0x24d5f0,_0xac27('0x1e'));logger['debug'](_0xac27('0x1f'),_0x24d5f0,_0xac27('0x1e'),JSON[_0xac27('0x20')](_0x57517d));if(_0x57517d[_0xac27('0x21')]){if(_0x57517d[_0xac27('0x21')][_0xac27('0x22')]===0x1f4){logger['error'](_0xac27('0x1d'),_0x24d5f0,_0x57517d[_0xac27('0x21')][_0xac27('0x23')]);return _0x2e13e0(_0x57517d[_0xac27('0x21')][_0xac27('0x23')]);}logger['error'](_0xac27('0x1d'),_0x24d5f0,_0x57517d['error'][_0xac27('0x23')]);return _0x13e4b1(_0x57517d[_0xac27('0x21')][_0xac27('0x23')]);}else{logger[_0xac27('0x1c')](_0xac27('0x1d'),_0x24d5f0,'request\x20sent');_0x13e4b1(_0x57517d[_0xac27('0x24')][_0xac27('0x23')]);}})[_0xac27('0x25')](function(_0x355752){logger[_0xac27('0x21')](_0xac27('0x1d'),_0x24d5f0,_0x355752);_0x2e13e0(_0x355752);});});}function respondWithStatusCode(_0x2f70e6,_0x318aa1){_0x318aa1=_0x318aa1||0xcc;return function(_0x40bd30){if(_0x40bd30){return _0x2f70e6['sendStatus'](_0x318aa1);}return _0x2f70e6[_0xac27('0x26')](_0x318aa1)[_0xac27('0x27')]();};}function respondWithResult(_0xd5444e,_0xcc2953){_0xcc2953=_0xcc2953||0xc8;return function(_0x5aaa8e){if(_0x5aaa8e){return _0xd5444e[_0xac27('0x26')](_0xcc2953)[_0xac27('0x28')](_0x5aaa8e);}};}function respondWithFilteredResult(_0x1173fe,_0x2d16d6){return function(_0x164312){if(_0x164312){var _0x4d7bd0=typeof _0x2d16d6[_0xac27('0x29')]===_0xac27('0x2a')&&typeof _0x2d16d6[_0xac27('0x2b')]===_0xac27('0x2a');var _0x26d4bf=_0x164312[_0xac27('0x2c')];var _0xb3ba28=_0x4d7bd0?0x0:_0x2d16d6[_0xac27('0x29')];var _0x54ad9a=_0x4d7bd0?_0x164312[_0xac27('0x2c')]:_0x2d16d6[_0xac27('0x29')]+_0x2d16d6[_0xac27('0x2b')];var _0x1f1546;if(_0x54ad9a>=_0x26d4bf){_0x54ad9a=_0x26d4bf;_0x1f1546=0xc8;}else{_0x1f1546=0xce;}_0x1173fe[_0xac27('0x26')](_0x1f1546);return _0x1173fe[_0xac27('0x2d')](_0xac27('0x2e'),_0xb3ba28+'-'+_0x54ad9a+'/'+_0x26d4bf)[_0xac27('0x28')](_0x164312);}return null;};}function patchUpdates(_0x1589ff){return function(_0x37eecf){try{jsonpatch[_0xac27('0x2f')](_0x37eecf,_0x1589ff,!![]);}catch(_0x3260ed){return BPromise['reject'](_0x3260ed);}return _0x37eecf[_0xac27('0x30')]();};}function saveUpdates(_0x56655a,_0x1f9509){return function(_0x479e47){if(_0x479e47){return _0x479e47['update'](_0x56655a)['then'](function(_0x1ccdda){return _0x1ccdda;});}return null;};}function removeEntity(_0x49174b,_0x37873b){return function(_0x59ed05){if(_0x59ed05){return _0x59ed05[_0xac27('0x31')]()[_0xac27('0x1b')](function(){_0x49174b[_0xac27('0x26')](0xcc)[_0xac27('0x27')]();});}};}function handleEntityNotFound(_0x39942f,_0x169dc4){return function(_0x4bfe0d){if(!_0x4bfe0d){_0x39942f[_0xac27('0x32')](0x194);}return _0x4bfe0d;};}function handleError(_0x3c8bad,_0x2d4ece){_0x2d4ece=_0x2d4ece||0x1f4;return function(_0x3b9129){logger[_0xac27('0x21')](_0x3b9129[_0xac27('0x33')]);if(_0x3b9129[_0xac27('0x34')]){delete _0x3b9129['name'];}_0x3c8bad[_0xac27('0x26')](_0x2d4ece)['send'](_0x3b9129);};}exports[_0xac27('0x35')]=function(_0x528b60,_0x31579a){var _0x187cba={},_0x29a28b={},_0x1cc7aa={'count':0x0,'rows':[]};var _0x5f557e=_['map'](db[_0xac27('0x36')][_0xac27('0x37')],function(_0x49ac21){return{'name':_0x49ac21[_0xac27('0x38')],'type':_0x49ac21[_0xac27('0x39')][_0xac27('0x3a')]};});_0x29a28b['model']=_[_0xac27('0x3b')](_0x5f557e,'name');_0x29a28b['query']=_[_0xac27('0x3c')](_0x528b60[_0xac27('0x3d')]);_0x29a28b[_0xac27('0x3e')]=_[_0xac27('0x3f')](_0x29a28b[_0xac27('0x40')],_0x29a28b[_0xac27('0x3d')]);_0x187cba[_0xac27('0x41')]=_[_0xac27('0x3f')](_0x29a28b['model'],qs[_0xac27('0x42')](_0x528b60[_0xac27('0x3d')]['fields']));_0x187cba[_0xac27('0x41')]=_0x187cba[_0xac27('0x41')]['length']?_0x187cba[_0xac27('0x41')]:_0x29a28b['model'];if(!_0x528b60[_0xac27('0x3d')]['hasOwnProperty'](_0xac27('0x43'))){_0x187cba[_0xac27('0x2b')]=qs['limit'](_0x528b60[_0xac27('0x3d')]['limit']);_0x187cba['offset']=qs[_0xac27('0x29')](_0x528b60['query'][_0xac27('0x29')]);}_0x187cba[_0xac27('0x44')]=qs[_0xac27('0x45')](_0x528b60[_0xac27('0x3d')][_0xac27('0x45')]);_0x187cba[_0xac27('0x46')]=qs[_0xac27('0x3e')](_[_0xac27('0x47')](_0x528b60[_0xac27('0x3d')],_0x29a28b[_0xac27('0x3e')]),_0x5f557e);if(_0x528b60[_0xac27('0x3d')][_0xac27('0x48')]){_0x187cba[_0xac27('0x46')]=_[_0xac27('0x49')](_0x187cba['where'],{'$or':_[_0xac27('0x3b')](_0x5f557e,function(_0x28220c){if(_0x28220c[_0xac27('0x39')]!==_0xac27('0x4a')){var _0x260284={};_0x260284[_0x28220c['name']]={'$like':'%'+_0x528b60[_0xac27('0x3d')][_0xac27('0x48')]+'%'};return _0x260284;}})});}_0x187cba=_[_0xac27('0x49')]({},_0x187cba,_0x528b60[_0xac27('0x4b')]);var _0x32095d={'where':_0x187cba[_0xac27('0x46')]};return db[_0xac27('0x36')][_0xac27('0x2c')](_0x32095d)[_0xac27('0x1b')](function(_0x45ee88){_0x1cc7aa[_0xac27('0x2c')]=_0x45ee88;if(_0x528b60[_0xac27('0x3d')][_0xac27('0x4c')]){_0x187cba['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xac27('0x4d')](_0x187cba);})['then'](function(_0x508199){_0x1cc7aa[_0xac27('0x4e')]=_0x508199;return _0x1cc7aa;})[_0xac27('0x1b')](respondWithFilteredResult(_0x31579a,_0x187cba))[_0xac27('0x25')](handleError(_0x31579a,null));};exports['show']=function(_0x49cd22,_0x19c676){var _0x4e0499={'raw':![],'where':{'id':_0x49cd22[_0xac27('0x4f')]['id']}},_0x54eb91={};_0x54eb91['model']=_[_0xac27('0x3c')](db[_0xac27('0x36')][_0xac27('0x37')]);_0x54eb91[_0xac27('0x3d')]=_[_0xac27('0x3c')](_0x49cd22[_0xac27('0x3d')]);_0x54eb91['filters']=_[_0xac27('0x3f')](_0x54eb91[_0xac27('0x40')],_0x54eb91[_0xac27('0x3d')]);_0x4e0499[_0xac27('0x41')]=_[_0xac27('0x3f')](_0x54eb91[_0xac27('0x40')],qs['fields'](_0x49cd22[_0xac27('0x3d')]['fields']));_0x4e0499[_0xac27('0x41')]=_0x4e0499[_0xac27('0x41')][_0xac27('0x50')]?_0x4e0499['attributes']:_0x54eb91[_0xac27('0x40')];if(_0x49cd22['query'][_0xac27('0x4c')]){_0x4e0499[_0xac27('0x51')]=[{'all':!![]}];}_0x4e0499=_[_0xac27('0x49')]({},_0x4e0499,_0x49cd22[_0xac27('0x4b')]);return db[_0xac27('0x36')][_0xac27('0x52')](_0x4e0499)[_0xac27('0x1b')](handleEntityNotFound(_0x19c676,null))[_0xac27('0x1b')](respondWithResult(_0x19c676,null))['catch'](handleError(_0x19c676,null));};exports[_0xac27('0x53')]=function(_0x57d7ed,_0x4a930f){return db[_0xac27('0x36')][_0xac27('0x53')](_0x57d7ed[_0xac27('0x54')],{})[_0xac27('0x1b')](respondWithResult(_0x4a930f,0xc9))[_0xac27('0x25')](handleError(_0x4a930f,null));};exports['update']=function(_0x390006,_0x38c919){if(_0x390006[_0xac27('0x54')]['id']){delete _0x390006[_0xac27('0x54')]['id'];}return db['ServicenowConfiguration'][_0xac27('0x52')]({'where':{'id':_0x390006[_0xac27('0x4f')]['id']}})[_0xac27('0x1b')](handleEntityNotFound(_0x38c919,null))['then'](saveUpdates(_0x390006[_0xac27('0x54')],null))[_0xac27('0x1b')](respondWithResult(_0x38c919,null))[_0xac27('0x25')](handleError(_0x38c919,null));};exports[_0xac27('0x31')]=function(_0x4fe98f,_0x362598){return db[_0xac27('0x36')][_0xac27('0x52')]({'where':{'id':_0x4fe98f[_0xac27('0x4f')]['id']}})[_0xac27('0x1b')](handleEntityNotFound(_0x362598,null))[_0xac27('0x1b')](removeEntity(_0x362598,null))[_0xac27('0x25')](handleError(_0x362598,null));};exports[_0xac27('0x55')]=function(_0x118270,_0x5c9b3c,_0x4cc5c5){var _0xcc19e8={};var _0x487018={};var _0x1c8e88;var _0xb1fb48;return db[_0xac27('0x36')]['findOne']({'where':{'id':_0x118270['params']['id']}})[_0xac27('0x1b')](handleEntityNotFound(_0x5c9b3c,null))[_0xac27('0x1b')](function(_0x76ab04){if(_0x76ab04){_0x1c8e88=_0x76ab04;_0x487018[_0xac27('0x40')]=_[_0xac27('0x3c')](db['ServicenowField'][_0xac27('0x37')]);_0x487018['query']=_['keys'](_0x118270[_0xac27('0x3d')]);_0x487018[_0xac27('0x3e')]=_[_0xac27('0x3f')](_0x487018[_0xac27('0x40')],_0x487018[_0xac27('0x3d')]);_0xcc19e8[_0xac27('0x41')]=_[_0xac27('0x3f')](_0x487018[_0xac27('0x40')],qs[_0xac27('0x42')](_0x118270[_0xac27('0x3d')]['fields']));_0xcc19e8['attributes']=_0xcc19e8[_0xac27('0x41')][_0xac27('0x50')]?_0xcc19e8['attributes']:_0x487018[_0xac27('0x40')];_0xcc19e8['order']=qs[_0xac27('0x45')](_0x118270[_0xac27('0x3d')]['sort']);_0xcc19e8[_0xac27('0x46')]=qs[_0xac27('0x3e')](_[_0xac27('0x47')](_0x118270[_0xac27('0x3d')],_0x487018[_0xac27('0x3e')]));if(_0x118270['query'][_0xac27('0x48')]){_0xcc19e8[_0xac27('0x46')]=_[_0xac27('0x49')](_0xcc19e8[_0xac27('0x46')],{'$or':_[_0xac27('0x3b')](_0xcc19e8['attributes'],function(_0x11baea){var _0x44c2e6={};_0x44c2e6[_0x11baea]={'$like':'%'+_0x118270[_0xac27('0x3d')][_0xac27('0x48')]+'%'};return _0x44c2e6;})});}_0xcc19e8=_[_0xac27('0x49')]({},_0xcc19e8,_0x118270[_0xac27('0x4b')]);return _0x1c8e88[_0xac27('0x55')](_0xcc19e8);}})['then'](function(_0x4a47c7){if(_0x4a47c7){_0xb1fb48=_0x4a47c7['length'];if(!_0x118270[_0xac27('0x3d')]['hasOwnProperty'](_0xac27('0x43'))){_0xcc19e8[_0xac27('0x2b')]=qs[_0xac27('0x2b')](_0x118270['query'][_0xac27('0x2b')]);_0xcc19e8[_0xac27('0x29')]=qs[_0xac27('0x29')](_0x118270[_0xac27('0x3d')][_0xac27('0x29')]);}return _0x1c8e88[_0xac27('0x55')](_0xcc19e8);}})['then'](function(_0x43951e){if(_0x43951e){return _0x43951e?{'count':_0xb1fb48,'rows':_0x43951e}:null;}})[_0xac27('0x1b')](respondWithResult(_0x5c9b3c,null))[_0xac27('0x25')](handleError(_0x5c9b3c,null));};exports[_0xac27('0x56')]=function(_0x11c6d4,_0x17c6aa,_0x1e0fd6){var _0x269117={};var _0x5344e1={};var _0x52c508;var _0x35ba66;return db[_0xac27('0x36')][_0xac27('0x57')]({'where':{'id':_0x11c6d4['params']['id']}})[_0xac27('0x1b')](handleEntityNotFound(_0x17c6aa,null))['then'](function(_0x3edb3a){if(_0x3edb3a){_0x52c508=_0x3edb3a;_0x5344e1[_0xac27('0x40')]=_[_0xac27('0x3c')](db[_0xac27('0x58')][_0xac27('0x37')]);_0x5344e1[_0xac27('0x3d')]=_[_0xac27('0x3c')](_0x11c6d4[_0xac27('0x3d')]);_0x5344e1[_0xac27('0x3e')]=_[_0xac27('0x3f')](_0x5344e1[_0xac27('0x40')],_0x5344e1['query']);_0x269117['attributes']=_['intersection'](_0x5344e1[_0xac27('0x40')],qs[_0xac27('0x42')](_0x11c6d4['query']['fields']));_0x269117['attributes']=_0x269117['attributes'][_0xac27('0x50')]?_0x269117['attributes']:_0x5344e1[_0xac27('0x40')];_0x269117[_0xac27('0x44')]=qs['sort'](_0x11c6d4[_0xac27('0x3d')][_0xac27('0x45')]);_0x269117[_0xac27('0x46')]=qs[_0xac27('0x3e')](_[_0xac27('0x47')](_0x11c6d4[_0xac27('0x3d')],_0x5344e1['filters']));if(_0x11c6d4[_0xac27('0x3d')][_0xac27('0x48')]){_0x269117[_0xac27('0x46')]=_[_0xac27('0x49')](_0x269117[_0xac27('0x46')],{'$or':_[_0xac27('0x3b')](_0x269117['attributes'],function(_0x314d6a){var _0x39043b={};_0x39043b[_0x314d6a]={'$like':'%'+_0x11c6d4[_0xac27('0x3d')][_0xac27('0x48')]+'%'};return _0x39043b;})});}_0x269117=_['merge']({},_0x269117,_0x11c6d4['options']);return _0x52c508[_0xac27('0x56')](_0x269117);}})[_0xac27('0x1b')](function(_0x5070c6){if(_0x5070c6){_0x35ba66=_0x5070c6['length'];if(!_0x11c6d4['query'][_0xac27('0x59')](_0xac27('0x43'))){_0x269117['limit']=qs['limit'](_0x11c6d4['query'][_0xac27('0x2b')]);_0x269117[_0xac27('0x29')]=qs[_0xac27('0x29')](_0x11c6d4[_0xac27('0x3d')]['offset']);}return _0x52c508[_0xac27('0x56')](_0x269117);}})[_0xac27('0x1b')](function(_0x19e051){if(_0x19e051){return _0x19e051?{'count':_0x35ba66,'rows':_0x19e051}:null;}})[_0xac27('0x1b')](respondWithResult(_0x17c6aa,null))[_0xac27('0x25')](handleError(_0x17c6aa,null));};exports[_0xac27('0x5a')]=function(_0x574fc6,_0x5df89b,_0x107e73){var _0x45d8b0={};var _0x5af115={};var _0x194b50;var _0x4a2347;return db[_0xac27('0x36')][_0xac27('0x57')]({'where':{'id':_0x574fc6[_0xac27('0x4f')]['id']}})[_0xac27('0x1b')](handleEntityNotFound(_0x5df89b,null))[_0xac27('0x1b')](function(_0x3fc0a1){if(_0x3fc0a1){_0x194b50=_0x3fc0a1;_0x5af115[_0xac27('0x40')]=_[_0xac27('0x3c')](db['ServicenowField'][_0xac27('0x37')]);_0x5af115['query']=_['keys'](_0x574fc6[_0xac27('0x3d')]);_0x5af115[_0xac27('0x3e')]=_[_0xac27('0x3f')](_0x5af115[_0xac27('0x40')],_0x5af115[_0xac27('0x3d')]);_0x45d8b0['attributes']=_[_0xac27('0x3f')](_0x5af115['model'],qs[_0xac27('0x42')](_0x574fc6['query'][_0xac27('0x42')]));_0x45d8b0['attributes']=_0x45d8b0['attributes'][_0xac27('0x50')]?_0x45d8b0['attributes']:_0x5af115[_0xac27('0x40')];_0x45d8b0['order']=qs[_0xac27('0x45')](_0x574fc6['query'][_0xac27('0x45')]);_0x45d8b0[_0xac27('0x46')]=qs[_0xac27('0x3e')](_['pick'](_0x574fc6[_0xac27('0x3d')],_0x5af115[_0xac27('0x3e')]));if(_0x574fc6[_0xac27('0x3d')][_0xac27('0x48')]){_0x45d8b0['where']=_[_0xac27('0x49')](_0x45d8b0['where'],{'$or':_['map'](_0x45d8b0[_0xac27('0x41')],function(_0x43d29c){var _0x367c2a={};_0x367c2a[_0x43d29c]={'$like':'%'+_0x574fc6['query'][_0xac27('0x48')]+'%'};return _0x367c2a;})});}_0x45d8b0=_[_0xac27('0x49')]({},_0x45d8b0,_0x574fc6[_0xac27('0x4b')]);return _0x194b50[_0xac27('0x5a')](_0x45d8b0);}})[_0xac27('0x1b')](function(_0x55aa4d){if(_0x55aa4d){_0x4a2347=_0x55aa4d['length'];if(!_0x574fc6['query'][_0xac27('0x59')](_0xac27('0x43'))){_0x45d8b0[_0xac27('0x2b')]=qs[_0xac27('0x2b')](_0x574fc6[_0xac27('0x3d')]['limit']);_0x45d8b0[_0xac27('0x29')]=qs[_0xac27('0x29')](_0x574fc6['query'][_0xac27('0x29')]);}return _0x194b50[_0xac27('0x5a')](_0x45d8b0);}})[_0xac27('0x1b')](function(_0x4000ee){if(_0x4000ee){return _0x4000ee?{'count':_0x4a2347,'rows':_0x4000ee}:null;}})[_0xac27('0x1b')](respondWithResult(_0x5df89b,null))[_0xac27('0x25')](handleError(_0x5df89b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 2ed92e5..d1b9ca5 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 _0xda6a=['exports','define','ServicenowConfiguration','lodash','util','api','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes'];(function(_0x364b32,_0x4dec35){var _0x3f3ea0=function(_0x1911a8){while(--_0x1911a8){_0x364b32['push'](_0x364b32['shift']());}};_0x3f3ea0(++_0x4dec35);}(_0xda6a,0x137));var _0xada6=function(_0x474868,_0x3ba747){_0x474868=_0x474868-0x0;var _0x4b591e=_0xda6a[_0x474868];return _0x4b591e;};'use strict';var _=require(_0xada6('0x0'));var util=require(_0xada6('0x1'));var logger=require('../../config/logger')(_0xada6('0x2'));var moment=require('moment');var BPromise=require(_0xada6('0x3'));var rp=require(_0xada6('0x4'));var fs=require('fs');var path=require(_0xada6('0x5'));var rimraf=require(_0xada6('0x6'));var config=require('../../config/environment');var attributes=require(_0xada6('0x7'));module[_0xada6('0x8')]=function(_0x511174,_0x525dc7){return _0x511174[_0xada6('0x9')](_0xada6('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe05c=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ServicenowConfiguration','lodash','util','../../config/logger','api'];(function(_0xecdb30,_0x34c807){var _0x4fdb54=function(_0x42e2ce){while(--_0x42e2ce){_0xecdb30['push'](_0xecdb30['shift']());}};_0x4fdb54(++_0x34c807);}(_0xe05c,0x8c));var _0xce05=function(_0x1e42ea,_0x2f8970){_0x1e42ea=_0x1e42ea-0x0;var _0x52115b=_0xe05c[_0x1e42ea];return _0x52115b;};'use strict';var _=require(_0xce05('0x0'));var util=require(_0xce05('0x1'));var logger=require(_0xce05('0x2'))(_0xce05('0x3'));var moment=require('moment');var BPromise=require(_0xce05('0x4'));var rp=require(_0xce05('0x5'));var fs=require('fs');var path=require(_0xce05('0x6'));var rimraf=require(_0xce05('0x7'));var config=require(_0xce05('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xce05('0x9')]=function(_0x186bff,_0x5584f7){return _0x186bff[_0xce05('0xa')](_0xce05('0xb'),attributes,{'tableName':'int_servicenow_configurations','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 8da71e1..cfded81 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 _0x2237=['request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x44b2db,_0x222d41){var _0x57fec4=function(_0x39d259){while(--_0x39d259){_0x44b2db['push'](_0x44b2db['shift']());}};_0x57fec4(++_0x222d41);}(_0x2237,0xf9));var _0x7223=function(_0x364606,_0x26efc3){_0x364606=_0x364606-0x0;var _0x9b6143=_0x2237[_0x364606];return _0x9b6143;};'use strict';var _=require(_0x7223('0x0'));var util=require(_0x7223('0x1'));var moment=require(_0x7223('0x2'));var BPromise=require('bluebird');var rs=require(_0x7223('0x3'));var fs=require('fs');var Redis=require(_0x7223('0x4'));var db=require(_0x7223('0x5'))['db'];var utils=require(_0x7223('0x6'));var logger=require(_0x7223('0x7'))('rpc');var config=require(_0x7223('0x8'));var jayson=require(_0x7223('0x9'));var client=jayson[_0x7223('0xa')][_0x7223('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x503e16,_0xa377bc,_0x507318){return new BPromise(function(_0x2c94af,_0x3cfc37){return client[_0x7223('0xc')](_0x503e16,_0x507318)[_0x7223('0xd')](function(_0x27bc77){logger['info'](_0x7223('0xe'),_0xa377bc,_0x7223('0xf'));logger[_0x7223('0x10')](_0x7223('0x11'),_0xa377bc,_0x7223('0xf'),JSON[_0x7223('0x12')](_0x27bc77));if(_0x27bc77['error']){if(_0x27bc77['error']['code']===0x1f4){logger[_0x7223('0x13')](_0x7223('0xe'),_0xa377bc,_0x27bc77[_0x7223('0x13')][_0x7223('0x14')]);return _0x3cfc37(_0x27bc77['error'][_0x7223('0x14')]);}logger[_0x7223('0x13')](_0x7223('0xe'),_0xa377bc,_0x27bc77[_0x7223('0x13')]['message']);return _0x2c94af(_0x27bc77[_0x7223('0x13')]['message']);}else{logger[_0x7223('0x15')](_0x7223('0xe'),_0xa377bc,'request\x20sent');_0x2c94af(_0x27bc77[_0x7223('0x16')][_0x7223('0x14')]);}})[_0x7223('0x17')](function(_0x1cf14d){logger[_0x7223('0x13')](_0x7223('0xe'),_0xa377bc,_0x1cf14d);_0x3cfc37(_0x1cf14d);});});} \ No newline at end of file +var _0x5572=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x5572,0x1b4));var _0x2557=function(_0x3a2e2a,_0x52cd9a){_0x3a2e2a=_0x3a2e2a-0x0;var _0x50d35c=_0x5572[_0x3a2e2a];return _0x50d35c;};'use strict';var _=require(_0x2557('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2557('0x1'));var fs=require('fs');var Redis=require(_0x2557('0x2'));var db=require(_0x2557('0x3'))['db'];var utils=require(_0x2557('0x4'));var logger=require(_0x2557('0x5'))(_0x2557('0x6'));var config=require(_0x2557('0x7'));var jayson=require(_0x2557('0x8'));var client=jayson[_0x2557('0x9')][_0x2557('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x544bf3,_0x56b59a,_0x9009ea){return new BPromise(function(_0x420400,_0xbdbc29){return client[_0x2557('0xb')](_0x544bf3,_0x9009ea)[_0x2557('0xc')](function(_0x558d40){logger[_0x2557('0xd')](_0x2557('0xe'),_0x56b59a,_0x2557('0xf'));logger[_0x2557('0x10')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x56b59a,'request\x20sent',JSON[_0x2557('0x11')](_0x558d40));if(_0x558d40[_0x2557('0x12')]){if(_0x558d40[_0x2557('0x12')][_0x2557('0x13')]===0x1f4){logger['error'](_0x2557('0xe'),_0x56b59a,_0x558d40[_0x2557('0x12')]['message']);return _0xbdbc29(_0x558d40['error'][_0x2557('0x14')]);}logger['error'](_0x2557('0xe'),_0x56b59a,_0x558d40[_0x2557('0x12')][_0x2557('0x14')]);return _0x420400(_0x558d40[_0x2557('0x12')][_0x2557('0x14')]);}else{logger['info'](_0x2557('0xe'),_0x56b59a,'request\x20sent');_0x420400(_0x558d40[_0x2557('0x15')]['message']);}})['catch'](function(_0x3532a9){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x56b59a,_0x3532a9);_0xbdbc29(_0x3532a9);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 0cdfa90..e521491 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 _0x7d46=['post','create','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show'];(function(_0x16f890,_0x5a0a1b){var _0x5e5da5=function(_0x57eb38){while(--_0x57eb38){_0x16f890['push'](_0x16f890['shift']());}};_0x5e5da5(++_0x5a0a1b);}(_0x7d46,0x6c));var _0x67d4=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x7d46[_0x368e09];return _0x14b7df;};'use strict';var multer=require('multer');var util=require(_0x67d4('0x0'));var path=require(_0x67d4('0x1'));var timeout=require(_0x67d4('0x2'));var express=require('express');var router=express[_0x67d4('0x3')]();var fs_extra=require(_0x67d4('0x4'));var auth=require(_0x67d4('0x5'));var interaction=require(_0x67d4('0x6'));var config=require(_0x67d4('0x7'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x67d4('0x8')](),controller['index']);router['get'](_0x67d4('0x9'),auth[_0x67d4('0x8')](),controller[_0x67d4('0xa')]);router[_0x67d4('0xb')]('/',auth['isAuthenticated'](),controller[_0x67d4('0xc')]);router[_0x67d4('0xd')](_0x67d4('0x9'),auth[_0x67d4('0x8')](),controller['update']);router[_0x67d4('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x67d4('0xf')]);module[_0x67d4('0x10')]=router; \ No newline at end of file +var _0xdd7f=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','util','path'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0xdd7f,0xbc));var _0xfdd7=function(_0x3567c6,_0x3aa913){_0x3567c6=_0x3567c6-0x0;var _0x1fe71c=_0xdd7f[_0x3567c6];return _0x1fe71c;};'use strict';var multer=require('multer');var util=require(_0xfdd7('0x0'));var path=require(_0xfdd7('0x1'));var timeout=require(_0xfdd7('0x2'));var express=require(_0xfdd7('0x3'));var router=express['Router']();var fs_extra=require(_0xfdd7('0x4'));var auth=require(_0xfdd7('0x5'));var interaction=require(_0xfdd7('0x6'));var config=require(_0xfdd7('0x7'));var controller=require(_0xfdd7('0x8'));router[_0xfdd7('0x9')]('/',auth[_0xfdd7('0xa')](),controller['index']);router[_0xfdd7('0x9')](_0xfdd7('0xb'),auth['isAuthenticated'](),controller[_0xfdd7('0xc')]);router[_0xfdd7('0xd')]('/',auth[_0xfdd7('0xa')](),controller[_0xfdd7('0xe')]);router[_0xfdd7('0xf')](_0xfdd7('0xb'),auth[_0xfdd7('0xa')](),controller['update']);router[_0xfdd7('0x10')](_0xfdd7('0xb'),auth[_0xfdd7('0xa')](),controller[_0xfdd7('0x11')]);module[_0xfdd7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index eaa99bd..448dcaf 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 _0x9957=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_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')]={'type':{'type':Sequelize[_0x7995('0x2')](_0x7995('0x3'),'variable',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6')),'defaultValue':_0x7995('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7995('0x7')]},'keyType':{'type':Sequelize[_0x7995('0x2')](_0x7995('0x3'),_0x7995('0x8'),_0x7995('0x4'))},'keyContent':{'type':Sequelize[_0x7995('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7995('0x7')]},'customField':{'type':Sequelize[_0x7995('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x326f=['ENUM','sequelize','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x326f,0xd1));var _0xf326=function(_0x2c2f7a,_0x4a0a5d){_0x2c2f7a=_0x2c2f7a-0x0;var _0x2c6c08=_0x326f[_0x2c2f7a];return _0x2c6c08;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xf326('0x1'),_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5')),'defaultValue':_0xf326('0x1')},'content':{'type':Sequelize[_0xf326('0x6')]},'key':{'type':Sequelize[_0xf326('0x6')]},'keyType':{'type':Sequelize[_0xf326('0x7')](_0xf326('0x1'),'variable',_0xf326('0x3'))},'keyContent':{'type':Sequelize[_0xf326('0x6')]},'idField':{'type':Sequelize[_0xf326('0x6')]},'nameField':{'type':Sequelize[_0xf326('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 4b07e1b..8f2b30e 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 _0xca56=['Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0xca56,0xbe));var _0x6ca5=function(_0x4ab08f,_0x1b2461){_0x4ab08f=_0x4ab08f-0x0;var _0x53c10e=_0xca56[_0x4ab08f];return _0x53c10e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ca5('0x0'));var zipdir=require(_0x6ca5('0x1'));var jsonpatch=require(_0x6ca5('0x2'));var rp=require(_0x6ca5('0x3'));var moment=require(_0x6ca5('0x4'));var BPromise=require(_0x6ca5('0x5'));var Mustache=require(_0x6ca5('0x6'));var util=require(_0x6ca5('0x7'));var path=require(_0x6ca5('0x8'));var sox=require(_0x6ca5('0x9'));var csv=require(_0x6ca5('0xa'));var ejs=require(_0x6ca5('0xb'));var fs=require('fs');var fs_extra=require(_0x6ca5('0xc'));var _=require(_0x6ca5('0xd'));var squel=require(_0x6ca5('0xe'));var crypto=require('crypto');var jsforce=require(_0x6ca5('0xf'));var deskjs=require(_0x6ca5('0x10'));var toCsv=require(_0x6ca5('0xa'));var querystring=require('querystring');var Papa=require(_0x6ca5('0x11'));var Redis=require(_0x6ca5('0x12'));var authService=require(_0x6ca5('0x13'));var qs=require(_0x6ca5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6ca5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6ca5('0x16'));var db=require(_0x6ca5('0x17'))['db'];function respondWithStatusCode(_0x3c77a7,_0x4e07c9){_0x4e07c9=_0x4e07c9||0xcc;return function(_0x41960d){if(_0x41960d){return _0x3c77a7[_0x6ca5('0x18')](_0x4e07c9);}return _0x3c77a7[_0x6ca5('0x19')](_0x4e07c9)[_0x6ca5('0x1a')]();};}function respondWithResult(_0x1139ad,_0x54be04){_0x54be04=_0x54be04||0xc8;return function(_0x1b1aa0){if(_0x1b1aa0){return _0x1139ad[_0x6ca5('0x19')](_0x54be04)['json'](_0x1b1aa0);}};}function respondWithFilteredResult(_0x581a3c,_0x24efee){return function(_0x24577e){if(_0x24577e){var _0x12ded6=typeof _0x24efee[_0x6ca5('0x1b')]===_0x6ca5('0x1c')&&typeof _0x24efee[_0x6ca5('0x1d')]===_0x6ca5('0x1c');var _0x214f43=_0x24577e[_0x6ca5('0x1e')];var _0x2449e0=_0x12ded6?0x0:_0x24efee[_0x6ca5('0x1b')];var _0x258964=_0x12ded6?_0x24577e[_0x6ca5('0x1e')]:_0x24efee['offset']+_0x24efee['limit'];var _0x530214;if(_0x258964>=_0x214f43){_0x258964=_0x214f43;_0x530214=0xc8;}else{_0x530214=0xce;}_0x581a3c[_0x6ca5('0x19')](_0x530214);return _0x581a3c[_0x6ca5('0x1f')](_0x6ca5('0x20'),_0x2449e0+'-'+_0x258964+'/'+_0x214f43)[_0x6ca5('0x21')](_0x24577e);}return null;};}function patchUpdates(_0x45e9e6){return function(_0xece57e){try{jsonpatch['apply'](_0xece57e,_0x45e9e6,!![]);}catch(_0x105536){return BPromise[_0x6ca5('0x22')](_0x105536);}return _0xece57e[_0x6ca5('0x23')]();};}function saveUpdates(_0x48795b,_0x5cba27){return function(_0x153804){if(_0x153804){return _0x153804[_0x6ca5('0x24')](_0x48795b)[_0x6ca5('0x25')](function(_0x26a2a6){return _0x26a2a6;});}return null;};}function removeEntity(_0xe3abda,_0x54ecb8){return function(_0x57c4b2){if(_0x57c4b2){return _0x57c4b2[_0x6ca5('0x26')]()[_0x6ca5('0x25')](function(){_0xe3abda[_0x6ca5('0x19')](0xcc)[_0x6ca5('0x1a')]();});}};}function handleEntityNotFound(_0x24d1d7,_0x2bb5fe){return function(_0x37b588){if(!_0x37b588){_0x24d1d7[_0x6ca5('0x18')](0x194);}return _0x37b588;};}function handleError(_0x19f4af,_0x11cd54){_0x11cd54=_0x11cd54||0x1f4;return function(_0x3ea565){logger[_0x6ca5('0x27')](_0x3ea565['stack']);if(_0x3ea565[_0x6ca5('0x28')]){delete _0x3ea565[_0x6ca5('0x28')];}_0x19f4af['status'](_0x11cd54)[_0x6ca5('0x29')](_0x3ea565);};}exports[_0x6ca5('0x2a')]=function(_0x35a0b3,_0x2874e5){var _0x58d36a={},_0xe65993={},_0x7966b7={'count':0x0,'rows':[]};var _0x2b0d2b=_[_0x6ca5('0x2b')](db[_0x6ca5('0x2c')][_0x6ca5('0x2d')],function(_0x176b5d){return{'name':_0x176b5d[_0x6ca5('0x2e')],'type':_0x176b5d['type'][_0x6ca5('0x2f')]};});_0xe65993[_0x6ca5('0x30')]=_[_0x6ca5('0x2b')](_0x2b0d2b,_0x6ca5('0x28'));_0xe65993[_0x6ca5('0x31')]=_[_0x6ca5('0x32')](_0x35a0b3['query']);_0xe65993[_0x6ca5('0x33')]=_[_0x6ca5('0x34')](_0xe65993[_0x6ca5('0x30')],_0xe65993[_0x6ca5('0x31')]);_0x58d36a[_0x6ca5('0x35')]=_[_0x6ca5('0x34')](_0xe65993['model'],qs[_0x6ca5('0x36')](_0x35a0b3[_0x6ca5('0x31')][_0x6ca5('0x36')]));_0x58d36a[_0x6ca5('0x35')]=_0x58d36a[_0x6ca5('0x35')][_0x6ca5('0x37')]?_0x58d36a[_0x6ca5('0x35')]:_0xe65993['model'];if(!_0x35a0b3['query']['hasOwnProperty']('nolimit')){_0x58d36a['limit']=qs[_0x6ca5('0x1d')](_0x35a0b3[_0x6ca5('0x31')]['limit']);_0x58d36a[_0x6ca5('0x1b')]=qs['offset'](_0x35a0b3['query'][_0x6ca5('0x1b')]);}_0x58d36a[_0x6ca5('0x38')]=qs[_0x6ca5('0x39')](_0x35a0b3[_0x6ca5('0x31')][_0x6ca5('0x39')]);_0x58d36a[_0x6ca5('0x3a')]=qs[_0x6ca5('0x33')](_[_0x6ca5('0x3b')](_0x35a0b3['query'],_0xe65993[_0x6ca5('0x33')]),_0x2b0d2b);if(_0x35a0b3[_0x6ca5('0x31')][_0x6ca5('0x3c')]){_0x58d36a[_0x6ca5('0x3a')]=_[_0x6ca5('0x3d')](_0x58d36a[_0x6ca5('0x3a')],{'$or':_[_0x6ca5('0x2b')](_0x2b0d2b,function(_0x24897f){if(_0x24897f[_0x6ca5('0x3e')]!==_0x6ca5('0x3f')){var _0x5e4a5b={};_0x5e4a5b[_0x24897f[_0x6ca5('0x28')]]={'$like':'%'+_0x35a0b3[_0x6ca5('0x31')][_0x6ca5('0x3c')]+'%'};return _0x5e4a5b;}})});}_0x58d36a=_[_0x6ca5('0x3d')]({},_0x58d36a,_0x35a0b3['options']);var _0x2c7fe9={'where':_0x58d36a[_0x6ca5('0x3a')]};return db[_0x6ca5('0x2c')][_0x6ca5('0x1e')](_0x2c7fe9)[_0x6ca5('0x25')](function(_0x285d98){_0x7966b7[_0x6ca5('0x1e')]=_0x285d98;if(_0x35a0b3[_0x6ca5('0x31')][_0x6ca5('0x40')]){_0x58d36a[_0x6ca5('0x41')]=[{'all':!![]}];}return db[_0x6ca5('0x2c')][_0x6ca5('0x42')](_0x58d36a);})['then'](function(_0x23ddc2){_0x7966b7['rows']=_0x23ddc2;return _0x7966b7;})[_0x6ca5('0x25')](respondWithFilteredResult(_0x2874e5,_0x58d36a))[_0x6ca5('0x43')](handleError(_0x2874e5,null));};exports[_0x6ca5('0x44')]=function(_0x2efcaf,_0x4ef5db){var _0x4136ac={'raw':!![],'where':{'id':_0x2efcaf[_0x6ca5('0x45')]['id']}},_0xf14b6d={};_0xf14b6d[_0x6ca5('0x30')]=_[_0x6ca5('0x32')](db[_0x6ca5('0x2c')][_0x6ca5('0x2d')]);_0xf14b6d[_0x6ca5('0x31')]=_[_0x6ca5('0x32')](_0x2efcaf['query']);_0xf14b6d[_0x6ca5('0x33')]=_[_0x6ca5('0x34')](_0xf14b6d['model'],_0xf14b6d[_0x6ca5('0x31')]);_0x4136ac[_0x6ca5('0x35')]=_[_0x6ca5('0x34')](_0xf14b6d[_0x6ca5('0x30')],qs[_0x6ca5('0x36')](_0x2efcaf['query'][_0x6ca5('0x36')]));_0x4136ac[_0x6ca5('0x35')]=_0x4136ac[_0x6ca5('0x35')][_0x6ca5('0x37')]?_0x4136ac[_0x6ca5('0x35')]:_0xf14b6d[_0x6ca5('0x30')];if(_0x2efcaf['query'][_0x6ca5('0x40')]){_0x4136ac['include']=[{'all':!![]}];}_0x4136ac=_[_0x6ca5('0x3d')]({},_0x4136ac,_0x2efcaf[_0x6ca5('0x46')]);return db[_0x6ca5('0x2c')][_0x6ca5('0x47')](_0x4136ac)['then'](handleEntityNotFound(_0x4ef5db,null))[_0x6ca5('0x25')](respondWithResult(_0x4ef5db,null))[_0x6ca5('0x43')](handleError(_0x4ef5db,null));};exports[_0x6ca5('0x48')]=function(_0x46aed3,_0x4b50e5){return db[_0x6ca5('0x2c')][_0x6ca5('0x48')](_0x46aed3[_0x6ca5('0x49')],{})[_0x6ca5('0x25')](respondWithResult(_0x4b50e5,0xc9))['catch'](handleError(_0x4b50e5,null));};exports[_0x6ca5('0x24')]=function(_0x2c959e,_0x35fae4){if(_0x2c959e[_0x6ca5('0x49')]['id']){delete _0x2c959e[_0x6ca5('0x49')]['id'];}return db[_0x6ca5('0x2c')][_0x6ca5('0x47')]({'where':{'id':_0x2c959e[_0x6ca5('0x45')]['id']}})[_0x6ca5('0x25')](handleEntityNotFound(_0x35fae4,null))['then'](saveUpdates(_0x2c959e['body'],null))[_0x6ca5('0x25')](respondWithResult(_0x35fae4,null))[_0x6ca5('0x43')](handleError(_0x35fae4,null));};exports['destroy']=function(_0x357366,_0x5013ff){return db[_0x6ca5('0x2c')][_0x6ca5('0x47')]({'where':{'id':_0x357366['params']['id']}})['then'](handleEntityNotFound(_0x5013ff,null))[_0x6ca5('0x25')](removeEntity(_0x5013ff,null))[_0x6ca5('0x43')](handleError(_0x5013ff,null));}; \ No newline at end of file +var _0xcf70=['show','params','intersection','options','create','body','destroy','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','includeAll','include','findAll','catch'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xcf70,0x189));var _0x0cf7=function(_0x1d6e01,_0x5d5c6b){_0x1d6e01=_0x1d6e01-0x0;var _0x246e97=_0xcf70[_0x1d6e01];return _0x246e97;};'use strict';var emlformat=require(_0x0cf7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0cf7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0cf7('0x2'));var moment=require(_0x0cf7('0x3'));var BPromise=require(_0x0cf7('0x4'));var Mustache=require(_0x0cf7('0x5'));var util=require(_0x0cf7('0x6'));var path=require('path');var sox=require(_0x0cf7('0x7'));var csv=require(_0x0cf7('0x8'));var ejs=require(_0x0cf7('0x9'));var fs=require('fs');var fs_extra=require(_0x0cf7('0xa'));var _=require(_0x0cf7('0xb'));var squel=require(_0x0cf7('0xc'));var crypto=require(_0x0cf7('0xd'));var jsforce=require(_0x0cf7('0xe'));var deskjs=require(_0x0cf7('0xf'));var toCsv=require(_0x0cf7('0x8'));var querystring=require(_0x0cf7('0x10'));var Papa=require(_0x0cf7('0x11'));var Redis=require(_0x0cf7('0x12'));var authService=require(_0x0cf7('0x13'));var qs=require(_0x0cf7('0x14'));var as=require(_0x0cf7('0x15'));var hardwareService=require(_0x0cf7('0x16'));var logger=require('../../config/logger')(_0x0cf7('0x17'));var utils=require(_0x0cf7('0x18'));var config=require(_0x0cf7('0x19'));var licenseUtil=require(_0x0cf7('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d7db2,_0x370baa){_0x370baa=_0x370baa||0xcc;return function(_0x59bc89){if(_0x59bc89){return _0x1d7db2[_0x0cf7('0x1b')](_0x370baa);}return _0x1d7db2[_0x0cf7('0x1c')](_0x370baa)[_0x0cf7('0x1d')]();};}function respondWithResult(_0x5a596e,_0x5af7f4){_0x5af7f4=_0x5af7f4||0xc8;return function(_0x3873ca){if(_0x3873ca){return _0x5a596e[_0x0cf7('0x1c')](_0x5af7f4)['json'](_0x3873ca);}};}function respondWithFilteredResult(_0x470fb7,_0x25ade0){return function(_0x7d0cc){if(_0x7d0cc){var _0x53a734=typeof _0x25ade0[_0x0cf7('0x1e')]===_0x0cf7('0x1f')&&typeof _0x25ade0[_0x0cf7('0x20')]===_0x0cf7('0x1f');var _0xf8cd96=_0x7d0cc[_0x0cf7('0x21')];var _0x49a82b=_0x53a734?0x0:_0x25ade0[_0x0cf7('0x1e')];var _0x26becc=_0x53a734?_0x7d0cc[_0x0cf7('0x21')]:_0x25ade0[_0x0cf7('0x1e')]+_0x25ade0['limit'];var _0x4a67df;if(_0x26becc>=_0xf8cd96){_0x26becc=_0xf8cd96;_0x4a67df=0xc8;}else{_0x4a67df=0xce;}_0x470fb7['status'](_0x4a67df);return _0x470fb7[_0x0cf7('0x22')](_0x0cf7('0x23'),_0x49a82b+'-'+_0x26becc+'/'+_0xf8cd96)[_0x0cf7('0x24')](_0x7d0cc);}return null;};}function patchUpdates(_0x52a46e){return function(_0x27b3f4){try{jsonpatch['apply'](_0x27b3f4,_0x52a46e,!![]);}catch(_0x7d228c){return BPromise[_0x0cf7('0x25')](_0x7d228c);}return _0x27b3f4[_0x0cf7('0x26')]();};}function saveUpdates(_0x1ef143,_0x4ed6e7){return function(_0x265b6f){if(_0x265b6f){return _0x265b6f[_0x0cf7('0x27')](_0x1ef143)[_0x0cf7('0x28')](function(_0x47f5d6){return _0x47f5d6;});}return null;};}function removeEntity(_0x384b2b,_0x5ee693){return function(_0x5730a2){if(_0x5730a2){return _0x5730a2['destroy']()[_0x0cf7('0x28')](function(){_0x384b2b['status'](0xcc)[_0x0cf7('0x1d')]();});}};}function handleEntityNotFound(_0x1db50a,_0x56fbe6){return function(_0x14efc6){if(!_0x14efc6){_0x1db50a[_0x0cf7('0x1b')](0x194);}return _0x14efc6;};}function handleError(_0x2a907b,_0x24f195){_0x24f195=_0x24f195||0x1f4;return function(_0x22c0e3){logger[_0x0cf7('0x29')](_0x22c0e3[_0x0cf7('0x2a')]);if(_0x22c0e3['name']){delete _0x22c0e3[_0x0cf7('0x2b')];}_0x2a907b[_0x0cf7('0x1c')](_0x24f195)['send'](_0x22c0e3);};}exports[_0x0cf7('0x2c')]=function(_0x390c89,_0x168186){var _0x380715={},_0x5eb330={},_0x177dcf={'count':0x0,'rows':[]};var _0x1a88de=_[_0x0cf7('0x2d')](db[_0x0cf7('0x2e')][_0x0cf7('0x2f')],function(_0x4b26cc){return{'name':_0x4b26cc[_0x0cf7('0x30')],'type':_0x4b26cc[_0x0cf7('0x31')][_0x0cf7('0x32')]};});_0x5eb330[_0x0cf7('0x33')]=_['map'](_0x1a88de,_0x0cf7('0x2b'));_0x5eb330[_0x0cf7('0x34')]=_[_0x0cf7('0x35')](_0x390c89[_0x0cf7('0x34')]);_0x5eb330['filters']=_['intersection'](_0x5eb330[_0x0cf7('0x33')],_0x5eb330[_0x0cf7('0x34')]);_0x380715[_0x0cf7('0x36')]=_['intersection'](_0x5eb330[_0x0cf7('0x33')],qs[_0x0cf7('0x37')](_0x390c89['query'][_0x0cf7('0x37')]));_0x380715[_0x0cf7('0x36')]=_0x380715[_0x0cf7('0x36')][_0x0cf7('0x38')]?_0x380715[_0x0cf7('0x36')]:_0x5eb330[_0x0cf7('0x33')];if(!_0x390c89['query'][_0x0cf7('0x39')](_0x0cf7('0x3a'))){_0x380715[_0x0cf7('0x20')]=qs[_0x0cf7('0x20')](_0x390c89[_0x0cf7('0x34')]['limit']);_0x380715[_0x0cf7('0x1e')]=qs[_0x0cf7('0x1e')](_0x390c89['query']['offset']);}_0x380715[_0x0cf7('0x3b')]=qs[_0x0cf7('0x3c')](_0x390c89[_0x0cf7('0x34')]['sort']);_0x380715[_0x0cf7('0x3d')]=qs[_0x0cf7('0x3e')](_['pick'](_0x390c89[_0x0cf7('0x34')],_0x5eb330[_0x0cf7('0x3e')]),_0x1a88de);if(_0x390c89[_0x0cf7('0x34')]['filter']){_0x380715[_0x0cf7('0x3d')]=_[_0x0cf7('0x3f')](_0x380715[_0x0cf7('0x3d')],{'$or':_[_0x0cf7('0x2d')](_0x1a88de,function(_0x1bbe1c){if(_0x1bbe1c[_0x0cf7('0x31')]!==_0x0cf7('0x40')){var _0x585c38={};_0x585c38[_0x1bbe1c['name']]={'$like':'%'+_0x390c89[_0x0cf7('0x34')]['filter']+'%'};return _0x585c38;}})});}_0x380715=_[_0x0cf7('0x3f')]({},_0x380715,_0x390c89['options']);var _0x16c29e={'where':_0x380715[_0x0cf7('0x3d')]};return db[_0x0cf7('0x2e')][_0x0cf7('0x21')](_0x16c29e)['then'](function(_0x336638){_0x177dcf[_0x0cf7('0x21')]=_0x336638;if(_0x390c89[_0x0cf7('0x34')][_0x0cf7('0x41')]){_0x380715[_0x0cf7('0x42')]=[{'all':!![]}];}return db[_0x0cf7('0x2e')][_0x0cf7('0x43')](_0x380715);})[_0x0cf7('0x28')](function(_0x381d56){_0x177dcf['rows']=_0x381d56;return _0x177dcf;})[_0x0cf7('0x28')](respondWithFilteredResult(_0x168186,_0x380715))[_0x0cf7('0x44')](handleError(_0x168186,null));};exports[_0x0cf7('0x45')]=function(_0x1f3077,_0x46bd6f){var _0x323411={'raw':!![],'where':{'id':_0x1f3077[_0x0cf7('0x46')]['id']}},_0x17c374={};_0x17c374[_0x0cf7('0x33')]=_[_0x0cf7('0x35')](db[_0x0cf7('0x2e')][_0x0cf7('0x2f')]);_0x17c374[_0x0cf7('0x34')]=_['keys'](_0x1f3077['query']);_0x17c374[_0x0cf7('0x3e')]=_[_0x0cf7('0x47')](_0x17c374['model'],_0x17c374[_0x0cf7('0x34')]);_0x323411[_0x0cf7('0x36')]=_[_0x0cf7('0x47')](_0x17c374['model'],qs[_0x0cf7('0x37')](_0x1f3077['query']['fields']));_0x323411[_0x0cf7('0x36')]=_0x323411[_0x0cf7('0x36')][_0x0cf7('0x38')]?_0x323411['attributes']:_0x17c374['model'];if(_0x1f3077[_0x0cf7('0x34')][_0x0cf7('0x41')]){_0x323411[_0x0cf7('0x42')]=[{'all':!![]}];}_0x323411=_[_0x0cf7('0x3f')]({},_0x323411,_0x1f3077[_0x0cf7('0x48')]);return db[_0x0cf7('0x2e')]['find'](_0x323411)['then'](handleEntityNotFound(_0x46bd6f,null))[_0x0cf7('0x28')](respondWithResult(_0x46bd6f,null))[_0x0cf7('0x44')](handleError(_0x46bd6f,null));};exports[_0x0cf7('0x49')]=function(_0x586893,_0x24045a){return db['ServicenowField'][_0x0cf7('0x49')](_0x586893[_0x0cf7('0x4a')],{})[_0x0cf7('0x28')](respondWithResult(_0x24045a,0xc9))[_0x0cf7('0x44')](handleError(_0x24045a,null));};exports[_0x0cf7('0x27')]=function(_0x176d9b,_0x2255ee){if(_0x176d9b['body']['id']){delete _0x176d9b[_0x0cf7('0x4a')]['id'];}return db[_0x0cf7('0x2e')]['find']({'where':{'id':_0x176d9b[_0x0cf7('0x46')]['id']}})[_0x0cf7('0x28')](handleEntityNotFound(_0x2255ee,null))[_0x0cf7('0x28')](saveUpdates(_0x176d9b[_0x0cf7('0x4a')],null))['then'](respondWithResult(_0x2255ee,null))['catch'](handleError(_0x2255ee,null));};exports[_0x0cf7('0x4b')]=function(_0x3e816e,_0x5001f8){return db[_0x0cf7('0x2e')][_0x0cf7('0x4c')]({'where':{'id':_0x3e816e[_0x0cf7('0x46')]['id']}})['then'](handleEntityNotFound(_0x5001f8,null))[_0x0cf7('0x28')](removeEntity(_0x5001f8,null))[_0x0cf7('0x44')](handleError(_0x5001f8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 13c8187..5a461fd 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 _0x42bc=['api','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','util','../../config/logger'];(function(_0x179b72,_0x113aca){var _0x17c0ee=function(_0x54c468){while(--_0x54c468){_0x179b72['push'](_0x179b72['shift']());}};_0x17c0ee(++_0x113aca);}(_0x42bc,0x1b6));var _0xc42b=function(_0x55e653,_0x30a4d3){_0x55e653=_0x55e653-0x0;var _0x26336d=_0x42bc[_0x55e653];return _0x26336d;};'use strict';var _=require('lodash');var util=require(_0xc42b('0x0'));var logger=require(_0xc42b('0x1'))(_0xc42b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc42b('0x3'));var rimraf=require(_0xc42b('0x4'));var config=require(_0xc42b('0x5'));var attributes=require(_0xc42b('0x6'));module[_0xc42b('0x7')]=function(_0x5e32e0,_0x57b06b){return _0x5e32e0['define'](_0xc42b('0x8'),attributes,{'tableName':_0xc42b('0x9'),'paranoid':![],'indexes':[{'name':_0xc42b('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb5ac=['FieldId','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ServicenowField','int_servicenow_fields'];(function(_0x32786b,_0x4e967d){var _0x2fd348=function(_0x39d2d2){while(--_0x39d2d2){_0x32786b['push'](_0x32786b['shift']());}};_0x2fd348(++_0x4e967d);}(_0xb5ac,0x14b));var _0xcb5a=function(_0x66f889,_0x58c8ba){_0x66f889=_0x66f889-0x0;var _0x584668=_0xb5ac[_0x66f889];return _0x584668;};'use strict';var _=require(_0xcb5a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcb5a('0x1'));var BPromise=require(_0xcb5a('0x2'));var rp=require(_0xcb5a('0x3'));var fs=require('fs');var path=require(_0xcb5a('0x4'));var rimraf=require(_0xcb5a('0x5'));var config=require(_0xcb5a('0x6'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x48d288,_0xf589ca){return _0x48d288[_0xcb5a('0x7')](_0xcb5a('0x8'),attributes,{'tableName':_0xcb5a('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0xcb5a('0xa')],'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 0a4dcb0..c03fd94 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 _0x7792=['jayson/promise','client','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x10a4bd,_0x1fb723){var _0x3210f1=function(_0x316452){while(--_0x316452){_0x10a4bd['push'](_0x10a4bd['shift']());}};_0x3210f1(++_0x1fb723);}(_0x7792,0x1c3));var _0x2779=function(_0x5b685e,_0x3e69ad){_0x5b685e=_0x5b685e-0x0;var _0x9a0173=_0x7792[_0x5b685e];return _0x9a0173;};'use strict';var _=require(_0x2779('0x0'));var util=require(_0x2779('0x1'));var moment=require(_0x2779('0x2'));var BPromise=require('bluebird');var rs=require(_0x2779('0x3'));var fs=require('fs');var Redis=require(_0x2779('0x4'));var db=require(_0x2779('0x5'))['db'];var utils=require(_0x2779('0x6'));var logger=require('../../config/logger')(_0x2779('0x7'));var config=require(_0x2779('0x8'));var jayson=require(_0x2779('0x9'));var client=jayson[_0x2779('0xa')][_0x2779('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bab7,_0x153511,_0xd8e6e3){return new BPromise(function(_0x5f5b50,_0x319b62){return client[_0x2779('0xc')](_0x2bab7,_0xd8e6e3)['then'](function(_0x416ac8){logger[_0x2779('0xd')](_0x2779('0xe'),_0x153511,_0x2779('0xf'));logger[_0x2779('0x10')](_0x2779('0x11'),_0x153511,'request\x20sent',JSON['stringify'](_0x416ac8));if(_0x416ac8[_0x2779('0x12')]){if(_0x416ac8[_0x2779('0x12')][_0x2779('0x13')]===0x1f4){logger[_0x2779('0x12')](_0x2779('0xe'),_0x153511,_0x416ac8[_0x2779('0x12')][_0x2779('0x14')]);return _0x319b62(_0x416ac8['error'][_0x2779('0x14')]);}logger[_0x2779('0x12')](_0x2779('0xe'),_0x153511,_0x416ac8['error'][_0x2779('0x14')]);return _0x5f5b50(_0x416ac8[_0x2779('0x12')][_0x2779('0x14')]);}else{logger[_0x2779('0xd')]('ServicenowField,\x20%s,\x20%s',_0x153511,_0x2779('0xf'));_0x5f5b50(_0x416ac8[_0x2779('0x15')]['message']);}})[_0x2779('0x16')](function(_0x5700be){logger[_0x2779('0x12')]('ServicenowField,\x20%s,\x20%s',_0x153511,_0x5700be);_0x319b62(_0x5700be);});});} \ No newline at end of file +var _0x1c09=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4df4c4,_0x13a087){var _0x23bc7=function(_0x54d049){while(--_0x54d049){_0x4df4c4['push'](_0x4df4c4['shift']());}};_0x23bc7(++_0x13a087);}(_0x1c09,0x178));var _0x91c0=function(_0xf38456,_0x5ebc38){_0xf38456=_0xf38456-0x0;var _0x4cab13=_0x1c09[_0xf38456];return _0x4cab13;};'use strict';var _=require(_0x91c0('0x0'));var util=require(_0x91c0('0x1'));var moment=require(_0x91c0('0x2'));var BPromise=require(_0x91c0('0x3'));var rs=require(_0x91c0('0x4'));var fs=require('fs');var Redis=require(_0x91c0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91c0('0x6'));var logger=require(_0x91c0('0x7'))(_0x91c0('0x8'));var config=require(_0x91c0('0x9'));var jayson=require(_0x91c0('0xa'));var client=jayson['client'][_0x91c0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x112d41,_0x4a2121,_0x218af8){return new BPromise(function(_0x1cacd4,_0x457b54){return client[_0x91c0('0xc')](_0x112d41,_0x218af8)[_0x91c0('0xd')](function(_0x12a4b2){logger['info'](_0x91c0('0xe'),_0x4a2121,_0x91c0('0xf'));logger['debug'](_0x91c0('0x10'),_0x4a2121,_0x91c0('0xf'),JSON[_0x91c0('0x11')](_0x12a4b2));if(_0x12a4b2[_0x91c0('0x12')]){if(_0x12a4b2['error'][_0x91c0('0x13')]===0x1f4){logger[_0x91c0('0x12')](_0x91c0('0xe'),_0x4a2121,_0x12a4b2[_0x91c0('0x12')][_0x91c0('0x14')]);return _0x457b54(_0x12a4b2['error'][_0x91c0('0x14')]);}logger[_0x91c0('0x12')](_0x91c0('0xe'),_0x4a2121,_0x12a4b2[_0x91c0('0x12')][_0x91c0('0x14')]);return _0x1cacd4(_0x12a4b2['error'][_0x91c0('0x14')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x4a2121,_0x91c0('0xf'));_0x1cacd4(_0x12a4b2[_0x91c0('0x15')][_0x91c0('0x14')]);}})['catch'](function(_0x269652){logger[_0x91c0('0x12')](_0x91c0('0xe'),_0x4a2121,_0x269652);_0x457b54(_0x269652);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index a71cf72..10efce4 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 _0x09f3=['create','addConfiguration','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x4f5c5a,_0x9441d3){var _0x4e3447=function(_0x334a92){while(--_0x334a92){_0x4f5c5a['push'](_0x4f5c5a['shift']());}};_0x4e3447(++_0x9441d3);}(_0x09f3,0x10e));var _0x309f=function(_0x51f2c0,_0xb7c46e){_0x51f2c0=_0x51f2c0-0x0;var _0x34ffd5=_0x09f3[_0x51f2c0];return _0x34ffd5;};'use strict';var multer=require(_0x309f('0x0'));var util=require(_0x309f('0x1'));var path=require(_0x309f('0x2'));var timeout=require(_0x309f('0x3'));var express=require(_0x309f('0x4'));var router=express[_0x309f('0x5')]();var fs_extra=require(_0x309f('0x6'));var auth=require(_0x309f('0x7'));var interaction=require(_0x309f('0x8'));var config=require(_0x309f('0x9'));var controller=require('./intSugarcrmAccount.controller');router[_0x309f('0xa')]('/',auth['isAuthenticated'](),controller[_0x309f('0xb')]);router[_0x309f('0xa')]('/:id',auth[_0x309f('0xc')](),controller['show']);router[_0x309f('0xa')](_0x309f('0xd'),auth['isAuthenticated'](),controller[_0x309f('0xe')]);router[_0x309f('0xa')](_0x309f('0xf'),auth['isAuthenticated'](),controller[_0x309f('0x10')]);router[_0x309f('0x11')]('/',auth['isAuthenticated'](),controller[_0x309f('0x12')]);router[_0x309f('0x11')]('/:id/configurations',auth[_0x309f('0xc')](),controller[_0x309f('0x13')]);router[_0x309f('0x14')](_0x309f('0x15'),auth[_0x309f('0xc')](),controller['update']);router[_0x309f('0x16')](_0x309f('0x15'),auth[_0x309f('0xc')](),controller['destroy']);module[_0x309f('0x17')]=router; \ No newline at end of file +var _0x8129=['destroy','exports','path','connect-timeout','fs-extra','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','addConfiguration','put','/:id','update','delete'];(function(_0x7f162,_0x1212e2){var _0x485e57=function(_0x382ee0){while(--_0x382ee0){_0x7f162['push'](_0x7f162['shift']());}};_0x485e57(++_0x1212e2);}(_0x8129,0x156));var _0x9812=function(_0x59f631,_0x52c9b3){_0x59f631=_0x59f631-0x0;var _0x578f9f=_0x8129[_0x59f631];return _0x578f9f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9812('0x0'));var timeout=require(_0x9812('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9812('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x9812('0x3'));var config=require('../../config/environment');var controller=require(_0x9812('0x4'));router[_0x9812('0x5')]('/',auth[_0x9812('0x6')](),controller['index']);router[_0x9812('0x5')]('/:id',auth[_0x9812('0x6')](),controller[_0x9812('0x7')]);router[_0x9812('0x5')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x9812('0x8')]);router[_0x9812('0x5')](_0x9812('0x9'),auth[_0x9812('0x6')](),controller['getFields']);router['post']('/',auth[_0x9812('0x6')](),controller['create']);router['post']('/:id/configurations',auth[_0x9812('0x6')](),controller[_0x9812('0xa')]);router[_0x9812('0xb')](_0x9812('0xc'),auth[_0x9812('0x6')](),controller[_0x9812('0xd')]);router[_0x9812('0xe')]('/:id',auth[_0x9812('0x6')](),controller[_0x9812('0xf')]);module[_0x9812('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 2cc6de3..733fd56 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 _0x5929=['exports','STRING','username','remoteUri','sequelize'];(function(_0x12e6a6,_0x4b455f){var _0x34bf2f=function(_0x5e0d6e){while(--_0x5e0d6e){_0x12e6a6['push'](_0x12e6a6['shift']());}};_0x34bf2f(++_0x4b455f);}(_0x5929,0x16c));var _0x9592=function(_0x4cda87,_0xa74464){_0x4cda87=_0x4cda87-0x0;var _0x4e3362=_0x5929[_0x4cda87];return _0x4e3362;};'use strict';var Sequelize=require(_0x9592('0x0'));module[_0x9592('0x1')]={'name':{'type':Sequelize[_0x9592('0x2')]},'description':{'type':Sequelize[_0x9592('0x2')]},'username':{'type':Sequelize[_0x9592('0x2')],'unique':_0x9592('0x3')},'password':{'type':Sequelize[_0x9592('0x2')]},'remoteUri':{'type':Sequelize[_0x9592('0x2')],'unique':_0x9592('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x091d=['sequelize','STRING','username'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x091d,0x13b));var _0xd091=function(_0x4dca04,_0x25273e){_0x4dca04=_0x4dca04-0x0;var _0x2c8686=_0x091d[_0x4dca04];return _0x2c8686;};'use strict';var Sequelize=require(_0xd091('0x0'));module['exports']={'name':{'type':Sequelize[_0xd091('0x1')]},'description':{'type':Sequelize[_0xd091('0x1')]},'username':{'type':Sequelize[_0xd091('0x1')],'unique':_0xd091('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd091('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd091('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index d3e7684..5b3f5ba 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 _0xe260=['duration_hours','duration_minutes','parent_name','direction','username','password','slice','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','get_module_fields','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','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','options','include','findAll','show','params','includeAll','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','hasOwnProperty','nolimit','addConfiguration','AccountId','channel','getDescriptions','SugarcrmField','Subjects','Descriptions','assigned_user_id','created_by','description','date_start'];(function(_0xcb3998,_0x511483){var _0x2bcb55=function(_0x264e1b){while(--_0x264e1b){_0xcb3998['push'](_0xcb3998['shift']());}};_0x2bcb55(++_0x511483);}(_0xe260,0x116));var _0x0e26=function(_0x248dff,_0x1a7f9d){_0x248dff=_0x248dff-0x0;var _0x869496=_0xe260[_0x248dff];return _0x869496;};'use strict';var emlformat=require(_0x0e26('0x0'));var rimraf=require(_0x0e26('0x1'));var zipdir=require(_0x0e26('0x2'));var jsonpatch=require(_0x0e26('0x3'));var rp=require(_0x0e26('0x4'));var moment=require('moment');var BPromise=require(_0x0e26('0x5'));var Mustache=require('mustache');var util=require(_0x0e26('0x6'));var path=require(_0x0e26('0x7'));var sox=require(_0x0e26('0x8'));var csv=require('to-csv');var ejs=require(_0x0e26('0x9'));var fs=require('fs');var fs_extra=require(_0x0e26('0xa'));var _=require(_0x0e26('0xb'));var squel=require('squel');var crypto=require(_0x0e26('0xc'));var jsforce=require(_0x0e26('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0e26('0xe'));var Papa=require(_0x0e26('0xf'));var Redis=require(_0x0e26('0x10'));var authService=require(_0x0e26('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0e26('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e26('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0e26('0x14'));var db=require(_0x0e26('0x15'))['db'];var integrations=require(_0x0e26('0x16'));var jayson=require(_0x0e26('0x17'));var client=jayson[_0x0e26('0x18')][_0x0e26('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x32ed6f,_0x112026,_0x586e74,_0x233836){return new BPromise(function(_0x5a5674,_0x3983bb){var _0x3f3ea4=_0x233836||client;return _0x3f3ea4['request'](_0x32ed6f,_0x586e74)[_0x0e26('0x1a')](function(_0x1ae29a){logger[_0x0e26('0x1b')]('SugarcrmAccount,\x20%s,\x20%s',_0x112026,_0x0e26('0x1c'));logger[_0x0e26('0x1d')](_0x0e26('0x1e'),_0x112026,'request\x20sent',JSON[_0x0e26('0x1f')](_0x1ae29a));if(_0x1ae29a[_0x0e26('0x20')]){if(_0x1ae29a['error'][_0x0e26('0x21')]===0x1f4){logger[_0x0e26('0x20')](_0x0e26('0x22'),_0x112026,_0x1ae29a[_0x0e26('0x20')][_0x0e26('0x23')]);return _0x3983bb(_0x1ae29a[_0x0e26('0x20')][_0x0e26('0x23')]);}logger[_0x0e26('0x20')](_0x0e26('0x22'),_0x112026,_0x1ae29a['error'][_0x0e26('0x23')]);return _0x5a5674(_0x1ae29a[_0x0e26('0x20')][_0x0e26('0x23')]);}else{logger['info'](_0x0e26('0x22'),_0x112026,_0x0e26('0x1c'));_0x5a5674(_0x1ae29a['result'][_0x0e26('0x23')]);}})[_0x0e26('0x24')](function(_0x369dc6){logger[_0x0e26('0x20')](_0x0e26('0x22'),_0x112026,_0x369dc6);_0x3983bb(_0x369dc6);});});}function respondWithStatusCode(_0x2ff30b,_0xe6ed6){_0xe6ed6=_0xe6ed6||0xcc;return function(_0x103cef){if(_0x103cef){return _0x2ff30b[_0x0e26('0x25')](_0xe6ed6);}return _0x2ff30b[_0x0e26('0x26')](_0xe6ed6)[_0x0e26('0x27')]();};}function respondWithResult(_0x5595bd,_0xae8084){_0xae8084=_0xae8084||0xc8;return function(_0x534760){if(_0x534760){return _0x5595bd[_0x0e26('0x26')](_0xae8084)[_0x0e26('0x28')](_0x534760);}};}function respondWithFilteredResult(_0x2658d2,_0x5ba909){return function(_0x1aadd5){if(_0x1aadd5){var _0x3cdb59=typeof _0x5ba909[_0x0e26('0x29')]===_0x0e26('0x2a')&&typeof _0x5ba909[_0x0e26('0x2b')]===_0x0e26('0x2a');var _0x4225a9=_0x1aadd5[_0x0e26('0x2c')];var _0x5df54e=_0x3cdb59?0x0:_0x5ba909[_0x0e26('0x29')];var _0x5eb3ec=_0x3cdb59?_0x1aadd5[_0x0e26('0x2c')]:_0x5ba909[_0x0e26('0x29')]+_0x5ba909['limit'];var _0x57ee1b;if(_0x5eb3ec>=_0x4225a9){_0x5eb3ec=_0x4225a9;_0x57ee1b=0xc8;}else{_0x57ee1b=0xce;}_0x2658d2[_0x0e26('0x26')](_0x57ee1b);return _0x2658d2['set'](_0x0e26('0x2d'),_0x5df54e+'-'+_0x5eb3ec+'/'+_0x4225a9)[_0x0e26('0x28')](_0x1aadd5);}return null;};}function patchUpdates(_0x2a7de9){return function(_0x222539){try{jsonpatch[_0x0e26('0x2e')](_0x222539,_0x2a7de9,!![]);}catch(_0x37b3ea){return BPromise['reject'](_0x37b3ea);}return _0x222539['save']();};}function saveUpdates(_0x3db964,_0x4968ac){return function(_0x188916){if(_0x188916){return _0x188916[_0x0e26('0x2f')](_0x3db964)[_0x0e26('0x1a')](function(_0xb26260){return _0xb26260;});}return null;};}function removeEntity(_0x54fe34,_0x411525){return function(_0x1b1aa5){if(_0x1b1aa5){return _0x1b1aa5[_0x0e26('0x30')]()['then'](function(){_0x54fe34['status'](0xcc)[_0x0e26('0x27')]();});}};}function handleEntityNotFound(_0x564ec7,_0x3650a7){return function(_0x507bd9){if(!_0x507bd9){_0x564ec7['sendStatus'](0x194);}return _0x507bd9;};}function handleError(_0x4bedcc,_0x55cedd){_0x55cedd=_0x55cedd||0x1f4;return function(_0x361ea6){logger[_0x0e26('0x20')](_0x361ea6[_0x0e26('0x31')]);if(_0x361ea6[_0x0e26('0x32')]){delete _0x361ea6[_0x0e26('0x32')];}_0x4bedcc[_0x0e26('0x26')](_0x55cedd)[_0x0e26('0x33')](_0x361ea6);};}exports[_0x0e26('0x34')]=function(_0x1a7422,_0x5dc8f6){var _0x2728b8={},_0x57d936={},_0x160769={'count':0x0,'rows':[]};var _0x49fb77=_[_0x0e26('0x35')](db[_0x0e26('0x36')][_0x0e26('0x37')],function(_0x8a3ebf){return{'name':_0x8a3ebf['fieldName'],'type':_0x8a3ebf[_0x0e26('0x38')][_0x0e26('0x39')]};});_0x57d936[_0x0e26('0x3a')]=_[_0x0e26('0x35')](_0x49fb77,'name');_0x57d936[_0x0e26('0x3b')]=_[_0x0e26('0x3c')](_0x1a7422[_0x0e26('0x3b')]);_0x57d936['filters']=_[_0x0e26('0x3d')](_0x57d936[_0x0e26('0x3a')],_0x57d936[_0x0e26('0x3b')]);_0x2728b8[_0x0e26('0x3e')]=_[_0x0e26('0x3d')](_0x57d936['model'],qs[_0x0e26('0x3f')](_0x1a7422[_0x0e26('0x3b')][_0x0e26('0x3f')]));_0x2728b8[_0x0e26('0x3e')]=_0x2728b8[_0x0e26('0x3e')][_0x0e26('0x40')]?_0x2728b8[_0x0e26('0x3e')]:_0x57d936[_0x0e26('0x3a')];if(!_0x1a7422['query']['hasOwnProperty']('nolimit')){_0x2728b8[_0x0e26('0x2b')]=qs['limit'](_0x1a7422[_0x0e26('0x3b')][_0x0e26('0x2b')]);_0x2728b8['offset']=qs[_0x0e26('0x29')](_0x1a7422[_0x0e26('0x3b')][_0x0e26('0x29')]);}_0x2728b8['order']=qs[_0x0e26('0x41')](_0x1a7422[_0x0e26('0x3b')][_0x0e26('0x41')]);_0x2728b8[_0x0e26('0x42')]=qs[_0x0e26('0x43')](_[_0x0e26('0x44')](_0x1a7422[_0x0e26('0x3b')],_0x57d936[_0x0e26('0x43')]),_0x49fb77);if(_0x1a7422[_0x0e26('0x3b')][_0x0e26('0x45')]){_0x2728b8['where']=_[_0x0e26('0x46')](_0x2728b8[_0x0e26('0x42')],{'$or':_[_0x0e26('0x35')](_0x49fb77,function(_0xd65612){if(_0xd65612[_0x0e26('0x38')]!=='VIRTUAL'){var _0x354077={};_0x354077[_0xd65612['name']]={'$like':'%'+_0x1a7422[_0x0e26('0x3b')]['filter']+'%'};return _0x354077;}})});}_0x2728b8=_[_0x0e26('0x46')]({},_0x2728b8,_0x1a7422[_0x0e26('0x47')]);var _0x4740da={'where':_0x2728b8[_0x0e26('0x42')]};return db[_0x0e26('0x36')]['count'](_0x4740da)[_0x0e26('0x1a')](function(_0x2c5e5d){_0x160769['count']=_0x2c5e5d;if(_0x1a7422[_0x0e26('0x3b')]['includeAll']){_0x2728b8[_0x0e26('0x48')]=[{'all':!![]}];}return db[_0x0e26('0x36')][_0x0e26('0x49')](_0x2728b8);})[_0x0e26('0x1a')](function(_0x1f7ac9){_0x160769['rows']=_0x1f7ac9;return _0x160769;})['then'](respondWithFilteredResult(_0x5dc8f6,_0x2728b8))[_0x0e26('0x24')](handleError(_0x5dc8f6,null));};exports[_0x0e26('0x4a')]=function(_0x5e630f,_0x3b68d9){var _0x5eec81={'raw':![],'where':{'id':_0x5e630f[_0x0e26('0x4b')]['id']}},_0x388715={};_0x388715[_0x0e26('0x3a')]=_[_0x0e26('0x3c')](db[_0x0e26('0x36')]['rawAttributes']);_0x388715[_0x0e26('0x3b')]=_['keys'](_0x5e630f[_0x0e26('0x3b')]);_0x388715[_0x0e26('0x43')]=_[_0x0e26('0x3d')](_0x388715[_0x0e26('0x3a')],_0x388715[_0x0e26('0x3b')]);_0x5eec81[_0x0e26('0x3e')]=_[_0x0e26('0x3d')](_0x388715[_0x0e26('0x3a')],qs[_0x0e26('0x3f')](_0x5e630f[_0x0e26('0x3b')][_0x0e26('0x3f')]));_0x5eec81[_0x0e26('0x3e')]=_0x5eec81[_0x0e26('0x3e')][_0x0e26('0x40')]?_0x5eec81[_0x0e26('0x3e')]:_0x388715[_0x0e26('0x3a')];if(_0x5e630f[_0x0e26('0x3b')][_0x0e26('0x4c')]){_0x5eec81[_0x0e26('0x48')]=[{'all':!![]}];}_0x5eec81=_[_0x0e26('0x46')]({},_0x5eec81,_0x5e630f[_0x0e26('0x47')]);return db['SugarcrmAccount'][_0x0e26('0x4d')](_0x5eec81)['then'](handleEntityNotFound(_0x3b68d9,null))[_0x0e26('0x1a')](respondWithResult(_0x3b68d9,null))[_0x0e26('0x24')](handleError(_0x3b68d9,null));};exports['create']=function(_0x1f72b7,_0x2c3708){return db[_0x0e26('0x36')][_0x0e26('0x4e')](_0x1f72b7[_0x0e26('0x4f')],{})[_0x0e26('0x1a')](respondWithResult(_0x2c3708,0xc9))[_0x0e26('0x24')](handleError(_0x2c3708,null));};exports[_0x0e26('0x2f')]=function(_0x1cfce4,_0x3c3aa7){if(_0x1cfce4[_0x0e26('0x4f')]['id']){delete _0x1cfce4[_0x0e26('0x4f')]['id'];}return db[_0x0e26('0x36')][_0x0e26('0x4d')]({'where':{'id':_0x1cfce4['params']['id']}})['then'](handleEntityNotFound(_0x3c3aa7,null))[_0x0e26('0x1a')](saveUpdates(_0x1cfce4[_0x0e26('0x4f')],null))[_0x0e26('0x1a')](respondWithResult(_0x3c3aa7,null))[_0x0e26('0x24')](handleError(_0x3c3aa7,null));};exports['destroy']=function(_0x243023,_0x277feb){return db[_0x0e26('0x36')][_0x0e26('0x4d')]({'where':{'id':_0x243023['params']['id']}})['then'](handleEntityNotFound(_0x277feb,null))['then'](removeEntity(_0x277feb,null))[_0x0e26('0x24')](handleError(_0x277feb,null));};exports[_0x0e26('0x50')]=function(_0x52d8f6,_0x50d868,_0x3f3935){var _0x2632f0={};var _0x25f5c7={};var _0x154768;var _0xf73bf1;return db[_0x0e26('0x36')][_0x0e26('0x51')]({'where':{'id':_0x52d8f6[_0x0e26('0x4b')]['id']}})[_0x0e26('0x1a')](handleEntityNotFound(_0x50d868,null))[_0x0e26('0x1a')](function(_0x56f1e1){if(_0x56f1e1){_0x154768=_0x56f1e1;_0x25f5c7[_0x0e26('0x3a')]=_['keys'](db[_0x0e26('0x52')][_0x0e26('0x37')]);_0x25f5c7[_0x0e26('0x3b')]=_['keys'](_0x52d8f6['query']);_0x25f5c7[_0x0e26('0x43')]=_['intersection'](_0x25f5c7['model'],_0x25f5c7['query']);_0x2632f0['attributes']=_[_0x0e26('0x3d')](_0x25f5c7[_0x0e26('0x3a')],qs[_0x0e26('0x3f')](_0x52d8f6[_0x0e26('0x3b')]['fields']));_0x2632f0[_0x0e26('0x3e')]=_0x2632f0[_0x0e26('0x3e')][_0x0e26('0x40')]?_0x2632f0[_0x0e26('0x3e')]:_0x25f5c7[_0x0e26('0x3a')];_0x2632f0[_0x0e26('0x53')]=qs[_0x0e26('0x41')](_0x52d8f6['query'][_0x0e26('0x41')]);_0x2632f0[_0x0e26('0x42')]=qs[_0x0e26('0x43')](_[_0x0e26('0x44')](_0x52d8f6[_0x0e26('0x3b')],_0x25f5c7['filters']));if(_0x52d8f6['query'][_0x0e26('0x45')]){_0x2632f0[_0x0e26('0x42')]=_[_0x0e26('0x46')](_0x2632f0[_0x0e26('0x42')],{'$or':_[_0x0e26('0x35')](_0x2632f0[_0x0e26('0x3e')],function(_0x4c0bb7){var _0x20a555={};_0x20a555[_0x4c0bb7]={'$like':'%'+_0x52d8f6['query'][_0x0e26('0x45')]+'%'};return _0x20a555;})});}_0x2632f0=_['merge']({},_0x2632f0,_0x52d8f6[_0x0e26('0x47')]);return _0x154768['getConfigurations'](_0x2632f0);}})['then'](function(_0x10b97e){if(_0x10b97e){_0xf73bf1=_0x10b97e[_0x0e26('0x40')];if(!_0x52d8f6[_0x0e26('0x3b')][_0x0e26('0x54')](_0x0e26('0x55'))){_0x2632f0[_0x0e26('0x2b')]=qs[_0x0e26('0x2b')](_0x52d8f6[_0x0e26('0x3b')]['limit']);_0x2632f0[_0x0e26('0x29')]=qs[_0x0e26('0x29')](_0x52d8f6[_0x0e26('0x3b')][_0x0e26('0x29')]);}return _0x154768['getConfigurations'](_0x2632f0);}})[_0x0e26('0x1a')](function(_0x58674d){if(_0x58674d){return _0x58674d?{'count':_0xf73bf1,'rows':_0x58674d}:null;}})['then'](respondWithResult(_0x50d868,null))[_0x0e26('0x24')](handleError(_0x50d868,null));};exports[_0x0e26('0x56')]=function(_0x4f9501,_0x24c02a,_0x96b88f){if(_0x4f9501[_0x0e26('0x4f')]['id']){delete _0x4f9501['body']['id'];}return db['SugarcrmAccount'][_0x0e26('0x51')]({'where':{'id':_0x4f9501[_0x0e26('0x4b')]['id']}})[_0x0e26('0x1a')](handleEntityNotFound(_0x24c02a,null))['then'](function(_0x431775){if(_0x431775){_0x4f9501[_0x0e26('0x4f')][_0x0e26('0x57')]=_0x431775['id'];_0x4f9501[_0x0e26('0x4f')]['Subjects']=integrations['getSubjects'](_0x4f9501['body'][_0x0e26('0x58')],_0x4f9501[_0x0e26('0x4f')][_0x0e26('0x38')]);_0x4f9501[_0x0e26('0x4f')]['Descriptions']=integrations[_0x0e26('0x59')](_0x4f9501[_0x0e26('0x4f')][_0x0e26('0x58')],_0x4f9501[_0x0e26('0x4f')][_0x0e26('0x38')]);return db['SugarcrmConfiguration'][_0x0e26('0x4e')](_0x4f9501[_0x0e26('0x4f')],{'include':[{'model':db[_0x0e26('0x5a')],'as':_0x0e26('0x5b')},{'model':db['SugarcrmField'],'as':_0x0e26('0x5c')}]});}return null;})[_0x0e26('0x1a')](respondWithResult(_0x24c02a,null))[_0x0e26('0x24')](handleError(_0x24c02a,null));};exports['getFields']=function(_0x3c67b9,_0x55a109,_0x4d2b56){var _0x16c951='';var _0x25a4e6=['id',_0x0e26('0x32'),_0x0e26('0x5d'),_0x0e26('0x5e'),_0x0e26('0x5f'),_0x0e26('0x60'),_0x0e26('0x61'),_0x0e26('0x62'),'parent_id','parent_type',_0x0e26('0x63'),_0x0e26('0x64')];return db[_0x0e26('0x36')][_0x0e26('0x51')]({'where':{'id':_0x3c67b9[_0x0e26('0x4b')]['id']},'attributes':['id',_0x0e26('0x65'),_0x0e26('0x66'),'remoteUri']})[_0x0e26('0x1a')](handleEntityNotFound(_0x55a109,null))['then'](function(_0x4c6ce3){if(_0x4c6ce3){_0x16c951=_0x4c6ce3['remoteUri'];var _0x193f7f=_0x16c951[_0x0e26('0x67')](-0x1);if(_0x193f7f==='/'){_0x16c951=_0x16c951['substring'](0x0,_0x16c951['lastIndexOf'](_0x193f7f));}return rp({'method':_0x0e26('0x68'),'uri':util[_0x0e26('0x69')](_0x0e26('0x6a'),_0x16c951,_0x0e26('0x6b')),'json':!![],'form':{'method':_0x0e26('0x6c'),'input_type':_0x0e26('0x6d'),'response_type':'JSON','rest_data':JSON[_0x0e26('0x1f')]({'user_auth':{'user_name':_0x4c6ce3[_0x0e26('0x65')],'password':_0x4c6ce3[_0x0e26('0x66')],'encryption':_0x0e26('0x6e')},'application':_0x0e26('0x6f')})}});}})[_0x0e26('0x1a')](function(_0x28d925){if(_0x28d925&&_0x28d925[_0x0e26('0x32')]!=='Invalid\x20Login'&&_0x28d925['name']!=='Password\x20Expired'){return rp({'method':_0x0e26('0x68'),'uri':util[_0x0e26('0x69')](_0x0e26('0x6a'),_0x16c951,_0x0e26('0x6b')),'json':!![],'form':{'method':_0x0e26('0x70'),'input_type':_0x0e26('0x6d'),'response_type':'JSON','rest_data':JSON[_0x0e26('0x1f')]({'session':_0x28d925['id'],'module_name':'Calls'})}})[_0x0e26('0x1a')](function(_0x1735eb){if(_0x1735eb){var _0x4e2b6b=_[_0x0e26('0x71')](_0x1735eb[_0x0e26('0x72')]);_[_0x0e26('0x73')](_0x4e2b6b,function(_0x3ec9e6){return _0x25a4e6[_0x0e26('0x74')](_0x3ec9e6[_0x0e26('0x32')]);});return{'count':_0x4e2b6b['length'],'rows':_[_0x0e26('0x35')](_0x4e2b6b,function(_0x26bf59){return{'id':_0x26bf59[_0x0e26('0x32')],'name':_0x26bf59[_0x0e26('0x75')],'custom':_[_0x0e26('0x76')](_0x26bf59['name'],'_c')?!![]:![],'options':_0x26bf59[_0x0e26('0x47')]?_[_0x0e26('0x35')](_[_0x0e26('0x71')](_0x26bf59[_0x0e26('0x47')]),function(_0x4da444){return{'name':_0x4da444[_0x0e26('0x77')],'value':_0x4da444[_0x0e26('0x32')]};}):[]};})};}})[_0x0e26('0x1a')](respondWithResult(_0x55a109,null))[_0x0e26('0x24')](function(_0x23a2fb){var _0x40c233=_0x3c67b9[_0x0e26('0x3b')][_0x0e26('0x78')]?0x1f4:_0x23a2fb[_0x0e26('0x79')]||0x1f4;logger[_0x0e26('0x20')](_0x0e26('0x7a'),_0x0e26('0x7b'),_0x40c233,JSON[_0x0e26('0x1f')](_0x23a2fb));delete _0x23a2fb['name'];if(_0x40c233===0x191){_0x40c233=0x190;}_0x55a109[_0x0e26('0x26')](_0x40c233)[_0x0e26('0x33')](_0x3c67b9['query'][_0x0e26('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x23a2fb[_0x0e26('0x79')]}:_0x23a2fb);});}else{var _0x3e245e=0x1f4;_0x55a109[_0x0e26('0x26')](_0x3e245e)['send']({'message':_0x0e26('0x7c'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x30c3=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','catch','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','count','include','findAll','rows','keys','includeAll','create','body','find','destroy','params','getConfigurations','SugarcrmConfiguration','order','filter','addConfiguration','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','duration_hours','parent_id','parent_name','findOne','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','get_module_fields','Calls','values','module_fields','includes','label','endsWith','value','test','getFields','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x3ddac0,_0x4b3b5e){var _0x260a72=function(_0x48e53c){while(--_0x48e53c){_0x3ddac0['push'](_0x3ddac0['shift']());}};_0x260a72(++_0x4b3b5e);}(_0x30c3,0x16b));var _0x330c=function(_0x48168a,_0xf9dfe5){_0x48168a=_0x48168a-0x0;var _0x346d98=_0x30c3[_0x48168a];return _0x346d98;};'use strict';var emlformat=require(_0x330c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x330c('0x1'));var jsonpatch=require(_0x330c('0x2'));var rp=require('request-promise');var moment=require(_0x330c('0x3'));var BPromise=require(_0x330c('0x4'));var Mustache=require('mustache');var util=require(_0x330c('0x5'));var path=require(_0x330c('0x6'));var sox=require('sox');var csv=require(_0x330c('0x7'));var ejs=require(_0x330c('0x8'));var fs=require('fs');var fs_extra=require(_0x330c('0x9'));var _=require(_0x330c('0xa'));var squel=require(_0x330c('0xb'));var crypto=require('crypto');var jsforce=require(_0x330c('0xc'));var deskjs=require(_0x330c('0xd'));var toCsv=require(_0x330c('0x7'));var querystring=require(_0x330c('0xe'));var Papa=require(_0x330c('0xf'));var Redis=require('ioredis');var authService=require(_0x330c('0x10'));var qs=require(_0x330c('0x11'));var as=require(_0x330c('0x12'));var hardwareService=require(_0x330c('0x13'));var logger=require(_0x330c('0x14'))(_0x330c('0x15'));var utils=require(_0x330c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x330c('0x17'));var db=require(_0x330c('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x330c('0x19'));var client=jayson[_0x330c('0x1a')][_0x330c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4ec517,_0x19ab06,_0x58ef12,_0x364e9c){return new BPromise(function(_0x28903b,_0x469889){var _0x69cda4=_0x364e9c||client;return _0x69cda4[_0x330c('0x1c')](_0x4ec517,_0x58ef12)[_0x330c('0x1d')](function(_0x48a16c){logger['info'](_0x330c('0x1e'),_0x19ab06,'request\x20sent');logger[_0x330c('0x1f')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x19ab06,_0x330c('0x20'),JSON[_0x330c('0x21')](_0x48a16c));if(_0x48a16c[_0x330c('0x22')]){if(_0x48a16c['error']['code']===0x1f4){logger[_0x330c('0x22')](_0x330c('0x1e'),_0x19ab06,_0x48a16c[_0x330c('0x22')][_0x330c('0x23')]);return _0x469889(_0x48a16c['error'][_0x330c('0x23')]);}logger[_0x330c('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x19ab06,_0x48a16c[_0x330c('0x22')]['message']);return _0x28903b(_0x48a16c['error'][_0x330c('0x23')]);}else{logger[_0x330c('0x24')](_0x330c('0x1e'),_0x19ab06,'request\x20sent');_0x28903b(_0x48a16c['result'][_0x330c('0x23')]);}})[_0x330c('0x25')](function(_0x1568fc){logger['error'](_0x330c('0x1e'),_0x19ab06,_0x1568fc);_0x469889(_0x1568fc);});});}function respondWithStatusCode(_0x33b100,_0xb4875b){_0xb4875b=_0xb4875b||0xcc;return function(_0x209fc8){if(_0x209fc8){return _0x33b100[_0x330c('0x26')](_0xb4875b);}return _0x33b100[_0x330c('0x27')](_0xb4875b)[_0x330c('0x28')]();};}function respondWithResult(_0x2294f0,_0x308f33){_0x308f33=_0x308f33||0xc8;return function(_0x565db3){if(_0x565db3){return _0x2294f0[_0x330c('0x27')](_0x308f33)['json'](_0x565db3);}};}function respondWithFilteredResult(_0x181bf2,_0x507933){return function(_0x4aa42f){if(_0x4aa42f){var _0x5c2c2a=typeof _0x507933[_0x330c('0x29')]===_0x330c('0x2a')&&typeof _0x507933[_0x330c('0x2b')]===_0x330c('0x2a');var _0x1757b5=_0x4aa42f['count'];var _0x17726d=_0x5c2c2a?0x0:_0x507933[_0x330c('0x29')];var _0x1a2ecc=_0x5c2c2a?_0x4aa42f['count']:_0x507933[_0x330c('0x29')]+_0x507933[_0x330c('0x2b')];var _0x596e5d;if(_0x1a2ecc>=_0x1757b5){_0x1a2ecc=_0x1757b5;_0x596e5d=0xc8;}else{_0x596e5d=0xce;}_0x181bf2[_0x330c('0x27')](_0x596e5d);return _0x181bf2[_0x330c('0x2c')](_0x330c('0x2d'),_0x17726d+'-'+_0x1a2ecc+'/'+_0x1757b5)[_0x330c('0x2e')](_0x4aa42f);}return null;};}function patchUpdates(_0x10a061){return function(_0x197512){try{jsonpatch[_0x330c('0x2f')](_0x197512,_0x10a061,!![]);}catch(_0x1ebf3c){return BPromise[_0x330c('0x30')](_0x1ebf3c);}return _0x197512[_0x330c('0x31')]();};}function saveUpdates(_0x59e3d0,_0x34ef42){return function(_0x5f9ad0){if(_0x5f9ad0){return _0x5f9ad0[_0x330c('0x32')](_0x59e3d0)[_0x330c('0x1d')](function(_0x152471){return _0x152471;});}return null;};}function removeEntity(_0x3a20e3,_0x2097f2){return function(_0x1d7929){if(_0x1d7929){return _0x1d7929['destroy']()['then'](function(){_0x3a20e3[_0x330c('0x27')](0xcc)[_0x330c('0x28')]();});}};}function handleEntityNotFound(_0x15f59a,_0x21e8f3){return function(_0x1289d5){if(!_0x1289d5){_0x15f59a[_0x330c('0x26')](0x194);}return _0x1289d5;};}function handleError(_0x32e162,_0x20624a){_0x20624a=_0x20624a||0x1f4;return function(_0x257963){logger['error'](_0x257963['stack']);if(_0x257963[_0x330c('0x33')]){delete _0x257963[_0x330c('0x33')];}_0x32e162[_0x330c('0x27')](_0x20624a)[_0x330c('0x34')](_0x257963);};}exports['index']=function(_0x492e23,_0x163827){var _0x3e5508={},_0x28cd05={},_0x325755={'count':0x0,'rows':[]};var _0x56a913=_[_0x330c('0x35')](db[_0x330c('0x36')][_0x330c('0x37')],function(_0x40f726){return{'name':_0x40f726[_0x330c('0x38')],'type':_0x40f726[_0x330c('0x39')][_0x330c('0x3a')]};});_0x28cd05[_0x330c('0x3b')]=_[_0x330c('0x35')](_0x56a913,_0x330c('0x33'));_0x28cd05['query']=_['keys'](_0x492e23[_0x330c('0x3c')]);_0x28cd05[_0x330c('0x3d')]=_[_0x330c('0x3e')](_0x28cd05[_0x330c('0x3b')],_0x28cd05[_0x330c('0x3c')]);_0x3e5508[_0x330c('0x3f')]=_[_0x330c('0x3e')](_0x28cd05[_0x330c('0x3b')],qs[_0x330c('0x40')](_0x492e23['query'][_0x330c('0x40')]));_0x3e5508[_0x330c('0x3f')]=_0x3e5508[_0x330c('0x3f')][_0x330c('0x41')]?_0x3e5508[_0x330c('0x3f')]:_0x28cd05['model'];if(!_0x492e23[_0x330c('0x3c')][_0x330c('0x42')](_0x330c('0x43'))){_0x3e5508['limit']=qs[_0x330c('0x2b')](_0x492e23[_0x330c('0x3c')][_0x330c('0x2b')]);_0x3e5508['offset']=qs[_0x330c('0x29')](_0x492e23[_0x330c('0x3c')][_0x330c('0x29')]);}_0x3e5508['order']=qs['sort'](_0x492e23[_0x330c('0x3c')][_0x330c('0x44')]);_0x3e5508[_0x330c('0x45')]=qs['filters'](_['pick'](_0x492e23[_0x330c('0x3c')],_0x28cd05[_0x330c('0x3d')]),_0x56a913);if(_0x492e23[_0x330c('0x3c')]['filter']){_0x3e5508[_0x330c('0x45')]=_[_0x330c('0x46')](_0x3e5508[_0x330c('0x45')],{'$or':_[_0x330c('0x35')](_0x56a913,function(_0x1e071d){if(_0x1e071d['type']!==_0x330c('0x47')){var _0x3b9dbd={};_0x3b9dbd[_0x1e071d[_0x330c('0x33')]]={'$like':'%'+_0x492e23[_0x330c('0x3c')]['filter']+'%'};return _0x3b9dbd;}})});}_0x3e5508=_[_0x330c('0x46')]({},_0x3e5508,_0x492e23[_0x330c('0x48')]);var _0x3e1fe9={'where':_0x3e5508[_0x330c('0x45')]};return db['SugarcrmAccount']['count'](_0x3e1fe9)[_0x330c('0x1d')](function(_0x3583cb){_0x325755[_0x330c('0x49')]=_0x3583cb;if(_0x492e23['query']['includeAll']){_0x3e5508[_0x330c('0x4a')]=[{'all':!![]}];}return db[_0x330c('0x36')][_0x330c('0x4b')](_0x3e5508);})[_0x330c('0x1d')](function(_0x393464){_0x325755[_0x330c('0x4c')]=_0x393464;return _0x325755;})[_0x330c('0x1d')](respondWithFilteredResult(_0x163827,_0x3e5508))[_0x330c('0x25')](handleError(_0x163827,null));};exports['show']=function(_0x539c92,_0x4fa65f){var _0xfdcb20={'raw':![],'where':{'id':_0x539c92['params']['id']}},_0x217c11={};_0x217c11[_0x330c('0x3b')]=_['keys'](db[_0x330c('0x36')][_0x330c('0x37')]);_0x217c11[_0x330c('0x3c')]=_[_0x330c('0x4d')](_0x539c92['query']);_0x217c11[_0x330c('0x3d')]=_['intersection'](_0x217c11[_0x330c('0x3b')],_0x217c11[_0x330c('0x3c')]);_0xfdcb20[_0x330c('0x3f')]=_[_0x330c('0x3e')](_0x217c11[_0x330c('0x3b')],qs[_0x330c('0x40')](_0x539c92[_0x330c('0x3c')][_0x330c('0x40')]));_0xfdcb20[_0x330c('0x3f')]=_0xfdcb20[_0x330c('0x3f')][_0x330c('0x41')]?_0xfdcb20[_0x330c('0x3f')]:_0x217c11[_0x330c('0x3b')];if(_0x539c92[_0x330c('0x3c')][_0x330c('0x4e')]){_0xfdcb20[_0x330c('0x4a')]=[{'all':!![]}];}_0xfdcb20=_[_0x330c('0x46')]({},_0xfdcb20,_0x539c92['options']);return db['SugarcrmAccount']['find'](_0xfdcb20)[_0x330c('0x1d')](handleEntityNotFound(_0x4fa65f,null))[_0x330c('0x1d')](respondWithResult(_0x4fa65f,null))['catch'](handleError(_0x4fa65f,null));};exports[_0x330c('0x4f')]=function(_0x5a22c6,_0x5cfbab){return db[_0x330c('0x36')]['create'](_0x5a22c6['body'],{})['then'](respondWithResult(_0x5cfbab,0xc9))[_0x330c('0x25')](handleError(_0x5cfbab,null));};exports[_0x330c('0x32')]=function(_0x56cbdf,_0x502c1f){if(_0x56cbdf[_0x330c('0x50')]['id']){delete _0x56cbdf[_0x330c('0x50')]['id'];}return db[_0x330c('0x36')][_0x330c('0x51')]({'where':{'id':_0x56cbdf['params']['id']}})['then'](handleEntityNotFound(_0x502c1f,null))[_0x330c('0x1d')](saveUpdates(_0x56cbdf['body'],null))[_0x330c('0x1d')](respondWithResult(_0x502c1f,null))['catch'](handleError(_0x502c1f,null));};exports[_0x330c('0x52')]=function(_0x5d8f15,_0x1c2b43){return db[_0x330c('0x36')][_0x330c('0x51')]({'where':{'id':_0x5d8f15[_0x330c('0x53')]['id']}})['then'](handleEntityNotFound(_0x1c2b43,null))['then'](removeEntity(_0x1c2b43,null))[_0x330c('0x25')](handleError(_0x1c2b43,null));};exports[_0x330c('0x54')]=function(_0x124f87,_0xa9e1b1,_0x7535ba){var _0x248060={};var _0x1cf40b={};var _0x16e254;var _0x416761;return db[_0x330c('0x36')]['findOne']({'where':{'id':_0x124f87[_0x330c('0x53')]['id']}})[_0x330c('0x1d')](handleEntityNotFound(_0xa9e1b1,null))[_0x330c('0x1d')](function(_0x1b4232){if(_0x1b4232){_0x16e254=_0x1b4232;_0x1cf40b[_0x330c('0x3b')]=_[_0x330c('0x4d')](db[_0x330c('0x55')][_0x330c('0x37')]);_0x1cf40b[_0x330c('0x3c')]=_[_0x330c('0x4d')](_0x124f87[_0x330c('0x3c')]);_0x1cf40b[_0x330c('0x3d')]=_[_0x330c('0x3e')](_0x1cf40b[_0x330c('0x3b')],_0x1cf40b['query']);_0x248060[_0x330c('0x3f')]=_[_0x330c('0x3e')](_0x1cf40b[_0x330c('0x3b')],qs[_0x330c('0x40')](_0x124f87[_0x330c('0x3c')][_0x330c('0x40')]));_0x248060[_0x330c('0x3f')]=_0x248060[_0x330c('0x3f')][_0x330c('0x41')]?_0x248060[_0x330c('0x3f')]:_0x1cf40b[_0x330c('0x3b')];_0x248060[_0x330c('0x56')]=qs[_0x330c('0x44')](_0x124f87[_0x330c('0x3c')]['sort']);_0x248060[_0x330c('0x45')]=qs[_0x330c('0x3d')](_['pick'](_0x124f87[_0x330c('0x3c')],_0x1cf40b['filters']));if(_0x124f87[_0x330c('0x3c')][_0x330c('0x57')]){_0x248060[_0x330c('0x45')]=_['merge'](_0x248060[_0x330c('0x45')],{'$or':_[_0x330c('0x35')](_0x248060[_0x330c('0x3f')],function(_0x16f21a){var _0xb81aed={};_0xb81aed[_0x16f21a]={'$like':'%'+_0x124f87[_0x330c('0x3c')]['filter']+'%'};return _0xb81aed;})});}_0x248060=_[_0x330c('0x46')]({},_0x248060,_0x124f87[_0x330c('0x48')]);return _0x16e254['getConfigurations'](_0x248060);}})[_0x330c('0x1d')](function(_0x4f84eb){if(_0x4f84eb){_0x416761=_0x4f84eb[_0x330c('0x41')];if(!_0x124f87[_0x330c('0x3c')][_0x330c('0x42')]('nolimit')){_0x248060[_0x330c('0x2b')]=qs[_0x330c('0x2b')](_0x124f87[_0x330c('0x3c')]['limit']);_0x248060[_0x330c('0x29')]=qs[_0x330c('0x29')](_0x124f87['query']['offset']);}return _0x16e254[_0x330c('0x54')](_0x248060);}})['then'](function(_0x3a1047){if(_0x3a1047){return _0x3a1047?{'count':_0x416761,'rows':_0x3a1047}:null;}})[_0x330c('0x1d')](respondWithResult(_0xa9e1b1,null))['catch'](handleError(_0xa9e1b1,null));};exports[_0x330c('0x58')]=function(_0x148953,_0x4d0445,_0x515938){if(_0x148953[_0x330c('0x50')]['id']){delete _0x148953[_0x330c('0x50')]['id'];}return db[_0x330c('0x36')]['findOne']({'where':{'id':_0x148953[_0x330c('0x53')]['id']}})[_0x330c('0x1d')](handleEntityNotFound(_0x4d0445,null))[_0x330c('0x1d')](function(_0x190543){if(_0x190543){_0x148953[_0x330c('0x50')]['AccountId']=_0x190543['id'];_0x148953[_0x330c('0x50')][_0x330c('0x59')]=integrations['getSubjects'](_0x148953[_0x330c('0x50')][_0x330c('0x5a')],_0x148953[_0x330c('0x50')][_0x330c('0x39')]);_0x148953[_0x330c('0x50')][_0x330c('0x5b')]=integrations[_0x330c('0x5c')](_0x148953[_0x330c('0x50')][_0x330c('0x5a')],_0x148953[_0x330c('0x50')][_0x330c('0x39')]);return db['SugarcrmConfiguration'][_0x330c('0x4f')](_0x148953[_0x330c('0x50')],{'include':[{'model':db['SugarcrmField'],'as':_0x330c('0x59')},{'model':db[_0x330c('0x5d')],'as':_0x330c('0x5b')}]});}return null;})[_0x330c('0x1d')](respondWithResult(_0x4d0445,null))[_0x330c('0x25')](handleError(_0x4d0445,null));};exports['getFields']=function(_0x32e605,_0xa0ee8b,_0x42ccf1){var _0x3a9567='';var _0x56c327=['id',_0x330c('0x33'),_0x330c('0x5e'),_0x330c('0x5f'),_0x330c('0x60'),'date_start',_0x330c('0x61'),'duration_minutes',_0x330c('0x62'),'parent_type',_0x330c('0x63'),'direction'];return db[_0x330c('0x36')][_0x330c('0x64')]({'where':{'id':_0x32e605[_0x330c('0x53')]['id']},'attributes':['id',_0x330c('0x65'),_0x330c('0x66'),'remoteUri']})[_0x330c('0x1d')](handleEntityNotFound(_0xa0ee8b,null))[_0x330c('0x1d')](function(_0x30a009){if(_0x30a009){_0x3a9567=_0x30a009[_0x330c('0x67')];var _0x1207f8=_0x3a9567[_0x330c('0x68')](-0x1);if(_0x1207f8==='/'){_0x3a9567=_0x3a9567[_0x330c('0x69')](0x0,_0x3a9567[_0x330c('0x6a')](_0x1207f8));}return rp({'method':_0x330c('0x6b'),'uri':util[_0x330c('0x6c')](_0x330c('0x6d'),_0x3a9567,_0x330c('0x6e')),'json':!![],'form':{'method':_0x330c('0x6f'),'input_type':_0x330c('0x70'),'response_type':_0x330c('0x70'),'rest_data':JSON[_0x330c('0x21')]({'user_auth':{'user_name':_0x30a009[_0x330c('0x65')],'password':_0x30a009[_0x330c('0x66')],'encryption':_0x330c('0x71')},'application':_0x330c('0x72')})}});}})[_0x330c('0x1d')](function(_0x3309f4){if(_0x3309f4&&_0x3309f4[_0x330c('0x33')]!=='Invalid\x20Login'&&_0x3309f4['name']!=='Password\x20Expired'){return rp({'method':_0x330c('0x6b'),'uri':util[_0x330c('0x6c')](_0x330c('0x6d'),_0x3a9567,_0x330c('0x6e')),'json':!![],'form':{'method':_0x330c('0x73'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x330c('0x21')]({'session':_0x3309f4['id'],'module_name':_0x330c('0x74')})}})[_0x330c('0x1d')](function(_0x52269c){if(_0x52269c){var _0x3f387b=_[_0x330c('0x75')](_0x52269c[_0x330c('0x76')]);_['remove'](_0x3f387b,function(_0x51abd8){return _0x56c327[_0x330c('0x77')](_0x51abd8['name']);});return{'count':_0x3f387b[_0x330c('0x41')],'rows':_[_0x330c('0x35')](_0x3f387b,function(_0x46cf4d){return{'id':_0x46cf4d[_0x330c('0x33')],'name':_0x46cf4d[_0x330c('0x78')],'custom':_[_0x330c('0x79')](_0x46cf4d[_0x330c('0x33')],'_c')?!![]:![],'options':_0x46cf4d[_0x330c('0x48')]?_[_0x330c('0x35')](_[_0x330c('0x75')](_0x46cf4d['options']),function(_0x42cd77){return{'name':_0x42cd77[_0x330c('0x7a')],'value':_0x42cd77['name']};}):[]};})};}})['then'](respondWithResult(_0xa0ee8b,null))[_0x330c('0x25')](function(_0x112a44){var _0x81a917=_0x32e605[_0x330c('0x3c')][_0x330c('0x7b')]?0x1f4:_0x112a44['statusCode']||0x1f4;logger[_0x330c('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x330c('0x7c'),_0x81a917,JSON[_0x330c('0x21')](_0x112a44));delete _0x112a44[_0x330c('0x33')];if(_0x81a917===0x191){_0x81a917=0x190;}_0xa0ee8b[_0x330c('0x27')](_0x81a917)[_0x330c('0x34')](_0x32e605['query'][_0x330c('0x7b')]?{'message':_0x330c('0x7d'),'statusCode':_0x112a44[_0x330c('0x7e')]}:_0x112a44);});}else{var _0x5eb6e6=0x1f4;_0xa0ee8b[_0x330c('0x27')](_0x5eb6e6)[_0x330c('0x34')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 58024a8..2e75538 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 _0xf7ae=['rimraf','../../config/environment','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x5055a9,_0x5c24d4){var _0x18b659=function(_0xaf338b){while(--_0xaf338b){_0x5055a9['push'](_0x5055a9['shift']());}};_0x18b659(++_0x5c24d4);}(_0xf7ae,0x1bd));var _0xef7a=function(_0x4c8564,_0x2d7dfc){_0x4c8564=_0x4c8564-0x0;var _0x316e69=_0xf7ae[_0x4c8564];return _0x316e69;};'use strict';var _=require(_0xef7a('0x0'));var util=require(_0xef7a('0x1'));var logger=require(_0xef7a('0x2'))('api');var moment=require(_0xef7a('0x3'));var BPromise=require('bluebird');var rp=require(_0xef7a('0x4'));var fs=require('fs');var path=require(_0xef7a('0x5'));var rimraf=require(_0xef7a('0x6'));var config=require(_0xef7a('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xef7a('0x8')]=function(_0x2a4307,_0xa49515){return _0x2a4307[_0xef7a('0x9')]('SugarcrmAccount',attributes,{'tableName':_0xef7a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94c6=['path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0x94c6,0xca));var _0x694c=function(_0x51e50f,_0x3e2284){_0x51e50f=_0x51e50f-0x0;var _0x1459c4=_0x94c6[_0x51e50f];return _0x1459c4;};'use strict';var _=require(_0x694c('0x0'));var util=require(_0x694c('0x1'));var logger=require(_0x694c('0x2'))(_0x694c('0x3'));var moment=require('moment');var BPromise=require(_0x694c('0x4'));var rp=require(_0x694c('0x5'));var fs=require('fs');var path=require(_0x694c('0x6'));var rimraf=require(_0x694c('0x7'));var config=require(_0x694c('0x8'));var attributes=require(_0x694c('0x9'));var integrations=require(_0x694c('0xa'));module[_0x694c('0xb')]=function(_0x2caa7d,_0x3ec8f7){return _0x2caa7d[_0x694c('0xc')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index a5493f7..b0b392f 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 _0x4e99=['GetSugarcrmAccount','findAll','options','where','limit','include','map','model','attributes','SugarcrmAccount','find','raw','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x4e99,0xc6));var _0x94e9=function(_0x2cf8f1,_0x34c0a7){_0x2cf8f1=_0x2cf8f1-0x0;var _0x590238=_0x4e99[_0x2cf8f1];return _0x590238;};'use strict';var _=require(_0x94e9('0x0'));var util=require(_0x94e9('0x1'));var moment=require(_0x94e9('0x2'));var BPromise=require(_0x94e9('0x3'));var rs=require(_0x94e9('0x4'));var fs=require('fs');var Redis=require(_0x94e9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x94e9('0x6'));var logger=require(_0x94e9('0x7'))(_0x94e9('0x8'));var config=require(_0x94e9('0x9'));var jayson=require(_0x94e9('0xa'));var client=jayson[_0x94e9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x302c41,_0x569739,_0x32a14f){return new BPromise(function(_0x44c85d,_0x4de958){return client[_0x94e9('0xc')](_0x302c41,_0x32a14f)['then'](function(_0xa85d64){logger[_0x94e9('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x569739,_0x94e9('0xe'));logger[_0x94e9('0xf')](_0x94e9('0x10'),_0x569739,_0x94e9('0xe'),JSON[_0x94e9('0x11')](_0xa85d64));if(_0xa85d64[_0x94e9('0x12')]){if(_0xa85d64['error'][_0x94e9('0x13')]===0x1f4){logger[_0x94e9('0x12')](_0x94e9('0x14'),_0x569739,_0xa85d64[_0x94e9('0x12')][_0x94e9('0x15')]);return _0x4de958(_0xa85d64[_0x94e9('0x12')]['message']);}logger[_0x94e9('0x12')](_0x94e9('0x14'),_0x569739,_0xa85d64['error']['message']);return _0x44c85d(_0xa85d64[_0x94e9('0x12')]['message']);}else{logger[_0x94e9('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x569739,_0x94e9('0xe'));_0x44c85d(_0xa85d64[_0x94e9('0x16')][_0x94e9('0x15')]);}})[_0x94e9('0x17')](function(_0x25c5f2){logger['error'](_0x94e9('0x14'),_0x569739,_0x25c5f2);_0x4de958(_0x25c5f2);});});}exports[_0x94e9('0x18')]=function(_0x5432cf){var _0x4dd673=this;return new Promise(function(_0x47832f,_0x46c1ad){return db['SugarcrmAccount'][_0x94e9('0x19')]({'raw':_0x5432cf[_0x94e9('0x1a')]?_0x5432cf['options']['raw']===undefined?!![]:![]:!![],'where':_0x5432cf[_0x94e9('0x1a')]?_0x5432cf['options'][_0x94e9('0x1b')]||null:null,'attributes':_0x5432cf['options']?_0x5432cf[_0x94e9('0x1a')]['attributes']||null:null,'limit':_0x5432cf[_0x94e9('0x1a')]?_0x5432cf['options'][_0x94e9('0x1c')]||null:null,'include':_0x5432cf[_0x94e9('0x1a')]?_0x5432cf[_0x94e9('0x1a')][_0x94e9('0x1d')]?_[_0x94e9('0x1e')](_0x5432cf[_0x94e9('0x1a')][_0x94e9('0x1d')],function(_0x4763c0){return{'model':db[_0x4763c0[_0x94e9('0x1f')]],'as':_0x4763c0['as'],'attributes':_0x4763c0[_0x94e9('0x20')],'include':_0x4763c0[_0x94e9('0x1d')]?_['map'](_0x4763c0['include'],function(_0x2f9fb0){return{'model':db[_0x2f9fb0['model']],'as':_0x2f9fb0['as'],'attributes':_0x2f9fb0[_0x94e9('0x20')],'include':_0x2f9fb0['include']?_['map'](_0x2f9fb0[_0x94e9('0x1d')],function(_0x303139){return{'model':db[_0x303139[_0x94e9('0x1f')]],'as':_0x303139['as'],'attributes':_0x303139[_0x94e9('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4211bd){logger[_0x94e9('0xd')](_0x94e9('0x18'),_0x5432cf);logger[_0x94e9('0xf')](_0x94e9('0x18'),_0x5432cf,JSON[_0x94e9('0x11')](_0x4211bd));_0x47832f(_0x4211bd);})[_0x94e9('0x17')](function(_0x1b94e0){logger['error'](_0x94e9('0x18'),_0x1b94e0[_0x94e9('0x15')],_0x5432cf);_0x46c1ad(_0x4dd673[_0x94e9('0x12')](0x1f4,_0x1b94e0['message']));});});};exports['ShowSugarcrmAccount']=function(_0x332d4d){var _0x1fc999=this;return new Promise(function(_0x32209b,_0x142e9a){return db[_0x94e9('0x21')][_0x94e9('0x22')]({'raw':_0x332d4d['options']?_0x332d4d[_0x94e9('0x1a')][_0x94e9('0x23')]===undefined?!![]:![]:!![],'where':_0x332d4d[_0x94e9('0x1a')]?_0x332d4d[_0x94e9('0x1a')][_0x94e9('0x1b')]||null:null,'attributes':_0x332d4d[_0x94e9('0x1a')]?_0x332d4d['options'][_0x94e9('0x20')]||null:null,'include':_0x332d4d['options']?_0x332d4d[_0x94e9('0x1a')][_0x94e9('0x1d')]?_[_0x94e9('0x1e')](_0x332d4d[_0x94e9('0x1a')]['include'],function(_0x4a94eb){return{'model':db[_0x4a94eb['model']],'as':_0x4a94eb['as'],'attributes':_0x4a94eb['attributes'],'include':_0x4a94eb['include']?_['map'](_0x4a94eb[_0x94e9('0x1d')],function(_0x2cbb70){return{'model':db[_0x2cbb70[_0x94e9('0x1f')]],'as':_0x2cbb70['as'],'attributes':_0x2cbb70[_0x94e9('0x20')],'include':_0x2cbb70[_0x94e9('0x1d')]?_[_0x94e9('0x1e')](_0x2cbb70[_0x94e9('0x1d')],function(_0x24743b){return{'model':db[_0x24743b[_0x94e9('0x1f')]],'as':_0x24743b['as'],'attributes':_0x24743b[_0x94e9('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4532fe){logger[_0x94e9('0xd')](_0x94e9('0x24'),_0x332d4d);logger[_0x94e9('0xf')](_0x94e9('0x24'),_0x332d4d,JSON[_0x94e9('0x11')](_0x4532fe));_0x32209b(_0x4532fe);})[_0x94e9('0x17')](function(_0x19b51c){logger[_0x94e9('0x12')]('ShowSugarcrmAccount',_0x19b51c[_0x94e9('0x15')],_0x332d4d);_0x142e9a(_0x1fc999['error'](0x1f4,_0x19b51c[_0x94e9('0x15')]));});});}; \ No newline at end of file +var _0xf7ea=['map','model','attributes','ShowSugarcrmAccount','SugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSugarcrmAccount','findAll','raw','options','limit','include'];(function(_0x1e55d9,_0x5ce14a){var _0x6dc799=function(_0x383e7b){while(--_0x383e7b){_0x1e55d9['push'](_0x1e55d9['shift']());}};_0x6dc799(++_0x5ce14a);}(_0xf7ea,0x11d));var _0xaf7e=function(_0x51e2d0,_0x290e1a){_0x51e2d0=_0x51e2d0-0x0;var _0x8abbe7=_0xf7ea[_0x51e2d0];return _0x8abbe7;};'use strict';var _=require(_0xaf7e('0x0'));var util=require(_0xaf7e('0x1'));var moment=require(_0xaf7e('0x2'));var BPromise=require(_0xaf7e('0x3'));var rs=require(_0xaf7e('0x4'));var fs=require('fs');var Redis=require(_0xaf7e('0x5'));var db=require(_0xaf7e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf7e('0x7'));var config=require(_0xaf7e('0x8'));var jayson=require(_0xaf7e('0x9'));var client=jayson[_0xaf7e('0xa')][_0xaf7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x593b20,_0x130f18,_0x2d35b2){return new BPromise(function(_0x3a06e2,_0x5ac9fc){return client[_0xaf7e('0xc')](_0x593b20,_0x2d35b2)[_0xaf7e('0xd')](function(_0xa83649){logger[_0xaf7e('0xe')](_0xaf7e('0xf'),_0x130f18,'request\x20sent');logger[_0xaf7e('0x10')](_0xaf7e('0x11'),_0x130f18,_0xaf7e('0x12'),JSON[_0xaf7e('0x13')](_0xa83649));if(_0xa83649[_0xaf7e('0x14')]){if(_0xa83649[_0xaf7e('0x14')]['code']===0x1f4){logger[_0xaf7e('0x14')](_0xaf7e('0xf'),_0x130f18,_0xa83649[_0xaf7e('0x14')][_0xaf7e('0x15')]);return _0x5ac9fc(_0xa83649['error'][_0xaf7e('0x15')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x130f18,_0xa83649[_0xaf7e('0x14')][_0xaf7e('0x15')]);return _0x3a06e2(_0xa83649[_0xaf7e('0x14')][_0xaf7e('0x15')]);}else{logger[_0xaf7e('0xe')](_0xaf7e('0xf'),_0x130f18,_0xaf7e('0x12'));_0x3a06e2(_0xa83649[_0xaf7e('0x16')][_0xaf7e('0x15')]);}})[_0xaf7e('0x17')](function(_0x2bbed3){logger[_0xaf7e('0x14')](_0xaf7e('0xf'),_0x130f18,_0x2bbed3);_0x5ac9fc(_0x2bbed3);});});}exports[_0xaf7e('0x18')]=function(_0x3f6d31){var _0xe96ac2=this;return new Promise(function(_0x36f219,_0x696f20){return db['SugarcrmAccount'][_0xaf7e('0x19')]({'raw':_0x3f6d31['options']?_0x3f6d31['options'][_0xaf7e('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f6d31[_0xaf7e('0x1b')]?_0x3f6d31[_0xaf7e('0x1b')]['where']||null:null,'attributes':_0x3f6d31[_0xaf7e('0x1b')]?_0x3f6d31['options']['attributes']||null:null,'limit':_0x3f6d31[_0xaf7e('0x1b')]?_0x3f6d31[_0xaf7e('0x1b')][_0xaf7e('0x1c')]||null:null,'include':_0x3f6d31['options']?_0x3f6d31[_0xaf7e('0x1b')][_0xaf7e('0x1d')]?_[_0xaf7e('0x1e')](_0x3f6d31[_0xaf7e('0x1b')][_0xaf7e('0x1d')],function(_0x1d6aca){return{'model':db[_0x1d6aca[_0xaf7e('0x1f')]],'as':_0x1d6aca['as'],'attributes':_0x1d6aca[_0xaf7e('0x20')],'include':_0x1d6aca[_0xaf7e('0x1d')]?_[_0xaf7e('0x1e')](_0x1d6aca[_0xaf7e('0x1d')],function(_0x2f36eb){return{'model':db[_0x2f36eb[_0xaf7e('0x1f')]],'as':_0x2f36eb['as'],'attributes':_0x2f36eb['attributes'],'include':_0x2f36eb[_0xaf7e('0x1d')]?_[_0xaf7e('0x1e')](_0x2f36eb[_0xaf7e('0x1d')],function(_0x429393){return{'model':db[_0x429393[_0xaf7e('0x1f')]],'as':_0x429393['as'],'attributes':_0x429393[_0xaf7e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xaf7e('0xd')](function(_0x58c582){logger[_0xaf7e('0xe')](_0xaf7e('0x18'),_0x3f6d31);logger[_0xaf7e('0x10')]('GetSugarcrmAccount',_0x3f6d31,JSON[_0xaf7e('0x13')](_0x58c582));_0x36f219(_0x58c582);})[_0xaf7e('0x17')](function(_0xa2b1b4){logger[_0xaf7e('0x14')](_0xaf7e('0x18'),_0xa2b1b4[_0xaf7e('0x15')],_0x3f6d31);_0x696f20(_0xe96ac2['error'](0x1f4,_0xa2b1b4[_0xaf7e('0x15')]));});});};exports[_0xaf7e('0x21')]=function(_0x4a5034){var _0x7a00a6=this;return new Promise(function(_0x4e8ae8,_0x1d6a2e){return db[_0xaf7e('0x22')]['find']({'raw':_0x4a5034[_0xaf7e('0x1b')]?_0x4a5034[_0xaf7e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4a5034[_0xaf7e('0x1b')]?_0x4a5034[_0xaf7e('0x1b')]['where']||null:null,'attributes':_0x4a5034[_0xaf7e('0x1b')]?_0x4a5034[_0xaf7e('0x1b')][_0xaf7e('0x20')]||null:null,'include':_0x4a5034['options']?_0x4a5034[_0xaf7e('0x1b')]['include']?_['map'](_0x4a5034['options'][_0xaf7e('0x1d')],function(_0xbe0855){return{'model':db[_0xbe0855[_0xaf7e('0x1f')]],'as':_0xbe0855['as'],'attributes':_0xbe0855[_0xaf7e('0x20')],'include':_0xbe0855[_0xaf7e('0x1d')]?_[_0xaf7e('0x1e')](_0xbe0855[_0xaf7e('0x1d')],function(_0x57c822){return{'model':db[_0x57c822[_0xaf7e('0x1f')]],'as':_0x57c822['as'],'attributes':_0x57c822[_0xaf7e('0x20')],'include':_0x57c822[_0xaf7e('0x1d')]?_[_0xaf7e('0x1e')](_0x57c822[_0xaf7e('0x1d')],function(_0x16fe17){return{'model':db[_0x16fe17[_0xaf7e('0x1f')]],'as':_0x16fe17['as'],'attributes':_0x16fe17[_0xaf7e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xaf7e('0xd')](function(_0x19f2b0){logger[_0xaf7e('0xe')](_0xaf7e('0x21'),_0x4a5034);logger[_0xaf7e('0x10')]('ShowSugarcrmAccount',_0x4a5034,JSON['stringify'](_0x19f2b0));_0x4e8ae8(_0x19f2b0);})['catch'](function(_0x4c50c2){logger['error'](_0xaf7e('0x21'),_0x4c50c2[_0xaf7e('0x15')],_0x4a5034);_0x1d6a2e(_0x7a00a6[_0xaf7e('0x14')](0x1f4,_0x4c50c2[_0xaf7e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index b64729b..fb701a0 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 _0xf11e=['delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','update'];(function(_0x5e10b4,_0x22590b){var _0x2c00d3=function(_0x1586a4){while(--_0x1586a4){_0x5e10b4['push'](_0x5e10b4['shift']());}};_0x2c00d3(++_0x22590b);}(_0xf11e,0xf5));var _0xef11=function(_0x522c6d,_0x139cb1){_0x522c6d=_0x522c6d-0x0;var _0x270d85=_0xf11e[_0x522c6d];return _0x270d85;};'use strict';var multer=require('multer');var util=require(_0xef11('0x0'));var path=require(_0xef11('0x1'));var timeout=require(_0xef11('0x2'));var express=require('express');var router=express[_0xef11('0x3')]();var fs_extra=require(_0xef11('0x4'));var auth=require(_0xef11('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xef11('0x6'));var controller=require(_0xef11('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xef11('0x8')](_0xef11('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xef11('0x8')](_0xef11('0xa'),auth[_0xef11('0xb')](),controller[_0xef11('0xc')]);router['get'](_0xef11('0xd'),auth[_0xef11('0xb')](),controller[_0xef11('0xe')]);router['get'](_0xef11('0xf'),auth[_0xef11('0xb')](),controller[_0xef11('0x10')]);router[_0xef11('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xef11('0xb')](),controller[_0xef11('0x12')]);router[_0xef11('0x13')]('/:id',auth[_0xef11('0xb')](),controller[_0xef11('0x14')]);module[_0xef11('0x15')]=router; \ No newline at end of file +var _0x9012=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/descriptions','getDescriptions','post','create','put','destroy'];(function(_0x2d7409,_0x3c5736){var _0xebdea8=function(_0x16cf33){while(--_0x16cf33){_0x2d7409['push'](_0x2d7409['shift']());}};_0xebdea8(++_0x3c5736);}(_0x9012,0x135));var _0x2901=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0x9012[_0x37c8ef];return _0x5eaee9;};'use strict';var multer=require(_0x2901('0x0'));var util=require(_0x2901('0x1'));var path=require('path');var timeout=require(_0x2901('0x2'));var express=require(_0x2901('0x3'));var router=express[_0x2901('0x4')]();var fs_extra=require(_0x2901('0x5'));var auth=require(_0x2901('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2901('0x7'));var controller=require(_0x2901('0x8'));router[_0x2901('0x9')]('/',auth[_0x2901('0xa')](),controller[_0x2901('0xb')]);router[_0x2901('0x9')](_0x2901('0xc'),auth[_0x2901('0xa')](),controller[_0x2901('0xd')]);router['get'](_0x2901('0xe'),auth[_0x2901('0xa')](),controller['getFields']);router[_0x2901('0x9')]('/:id/subjects',auth[_0x2901('0xa')](),controller['getSubjects']);router[_0x2901('0x9')](_0x2901('0xf'),auth[_0x2901('0xa')](),controller[_0x2901('0x10')]);router[_0x2901('0x11')]('/',auth['isAuthenticated'](),controller[_0x2901('0x12')]);router[_0x2901('0x13')](_0x2901('0xc'),auth[_0x2901('0xa')](),controller['update']);router['delete']('/:id',auth[_0x2901('0xa')](),controller[_0x2901('0x14')]);module[_0x2901('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index d6ca4ad..416ae9f 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 _0xba4f=['sequelize','exports','STRING'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xba4f,0x19e));var _0xfba4=function(_0x38ab8c,_0x441398){_0x38ab8c=_0x38ab8c-0x0;var _0x189e14=_0xba4f[_0x38ab8c];return _0x189e14;};'use strict';var Sequelize=require(_0xfba4('0x0'));module[_0xfba4('0x1')]={'name':{'type':Sequelize[_0xfba4('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x747e=['STRING','sequelize','exports'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x747e,0x9d));var _0xe747=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x747e[_0x2f9467];return _0x39894c;};'use strict';var Sequelize=require(_0xe747('0x0'));module[_0xe747('0x1')]={'name':{'type':Sequelize[_0xe747('0x2')]},'description':{'type':Sequelize[_0xe747('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 2e1fbc4..b53479f 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 _0x073d=['squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','type','key','model','keys','filters','intersection','attributes','query','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SugarcrmConfiguration','count','rows','catch','fields','includeAll','create','body','find','params','findOne','rawAttributes','getFields','getSubjects','getDescriptions','SugarcrmField','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x073d,0x103));var _0xd073=function(_0x194801,_0x147ece){_0x194801=_0x194801-0x0;var _0x18c56c=_0x073d[_0x194801];return _0x18c56c;};'use strict';var emlformat=require(_0xd073('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd073('0x1'));var rp=require(_0xd073('0x2'));var moment=require(_0xd073('0x3'));var BPromise=require(_0xd073('0x4'));var Mustache=require(_0xd073('0x5'));var util=require('util');var path=require(_0xd073('0x6'));var sox=require('sox');var csv=require(_0xd073('0x7'));var ejs=require(_0xd073('0x8'));var fs=require('fs');var fs_extra=require(_0xd073('0x9'));var _=require(_0xd073('0xa'));var squel=require(_0xd073('0xb'));var crypto=require(_0xd073('0xc'));var jsforce=require(_0xd073('0xd'));var deskjs=require(_0xd073('0xe'));var toCsv=require(_0xd073('0x7'));var querystring=require(_0xd073('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd073('0x10'));var qs=require(_0xd073('0x11'));var as=require(_0xd073('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd073('0x13'));var utils=require(_0xd073('0x14'));var config=require(_0xd073('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xd073('0x16'));var client=jayson[_0xd073('0x17')][_0xd073('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2191a3,_0x31176a,_0x1d2e5a,_0x201ce4){return new BPromise(function(_0x29a452,_0x3650d1){var _0x3f6a31=_0x201ce4||client;return _0x3f6a31[_0xd073('0x19')](_0x2191a3,_0x1d2e5a)[_0xd073('0x1a')](function(_0x5b227a){logger['info'](_0xd073('0x1b'),_0x31176a,'request\x20sent');logger[_0xd073('0x1c')](_0xd073('0x1d'),_0x31176a,_0xd073('0x1e'),JSON[_0xd073('0x1f')](_0x5b227a));if(_0x5b227a['error']){if(_0x5b227a[_0xd073('0x20')][_0xd073('0x21')]===0x1f4){logger[_0xd073('0x20')](_0xd073('0x1b'),_0x31176a,_0x5b227a['error']['message']);return _0x3650d1(_0x5b227a[_0xd073('0x20')][_0xd073('0x22')]);}logger[_0xd073('0x20')](_0xd073('0x1b'),_0x31176a,_0x5b227a[_0xd073('0x20')][_0xd073('0x22')]);return _0x29a452(_0x5b227a['error'][_0xd073('0x22')]);}else{logger[_0xd073('0x23')](_0xd073('0x1b'),_0x31176a,_0xd073('0x1e'));_0x29a452(_0x5b227a[_0xd073('0x24')][_0xd073('0x22')]);}})['catch'](function(_0x1ee7b1){logger[_0xd073('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x31176a,_0x1ee7b1);_0x3650d1(_0x1ee7b1);});});}function respondWithStatusCode(_0x52b29f,_0x276b7a){_0x276b7a=_0x276b7a||0xcc;return function(_0x9b222b){if(_0x9b222b){return _0x52b29f[_0xd073('0x25')](_0x276b7a);}return _0x52b29f[_0xd073('0x26')](_0x276b7a)[_0xd073('0x27')]();};}function respondWithResult(_0x123eed,_0x4aa7b2){_0x4aa7b2=_0x4aa7b2||0xc8;return function(_0x36aebb){if(_0x36aebb){return _0x123eed[_0xd073('0x26')](_0x4aa7b2)[_0xd073('0x28')](_0x36aebb);}};}function respondWithFilteredResult(_0x2163a5,_0x4e64ed){return function(_0x32d395){if(_0x32d395){var _0x5a27c9=typeof _0x4e64ed[_0xd073('0x29')]==='undefined'&&typeof _0x4e64ed[_0xd073('0x2a')]===_0xd073('0x2b');var _0x13a5a5=_0x32d395['count'];var _0x38e368=_0x5a27c9?0x0:_0x4e64ed[_0xd073('0x29')];var _0x34dd74=_0x5a27c9?_0x32d395['count']:_0x4e64ed[_0xd073('0x29')]+_0x4e64ed[_0xd073('0x2a')];var _0x190284;if(_0x34dd74>=_0x13a5a5){_0x34dd74=_0x13a5a5;_0x190284=0xc8;}else{_0x190284=0xce;}_0x2163a5[_0xd073('0x26')](_0x190284);return _0x2163a5['set'](_0xd073('0x2c'),_0x38e368+'-'+_0x34dd74+'/'+_0x13a5a5)[_0xd073('0x28')](_0x32d395);}return null;};}function patchUpdates(_0x34aa3d){return function(_0x147fe3){try{jsonpatch[_0xd073('0x2d')](_0x147fe3,_0x34aa3d,!![]);}catch(_0x44662d){return BPromise[_0xd073('0x2e')](_0x44662d);}return _0x147fe3[_0xd073('0x2f')]();};}function saveUpdates(_0x1b7d4a,_0xf12399){return function(_0x15b0e4){if(_0x15b0e4){return _0x15b0e4[_0xd073('0x30')](_0x1b7d4a)[_0xd073('0x1a')](function(_0x412d7c){return _0x412d7c;});}return null;};}function removeEntity(_0x1503a4,_0x114b7d){return function(_0x37dd7d){if(_0x37dd7d){return _0x37dd7d[_0xd073('0x31')]()[_0xd073('0x1a')](function(){_0x1503a4[_0xd073('0x26')](0xcc)[_0xd073('0x27')]();});}};}function handleEntityNotFound(_0x4b7464,_0x12ca7e){return function(_0x505605){if(!_0x505605){_0x4b7464[_0xd073('0x25')](0x194);}return _0x505605;};}function handleError(_0x49203d,_0x38238c){_0x38238c=_0x38238c||0x1f4;return function(_0x23548d){logger[_0xd073('0x20')](_0x23548d[_0xd073('0x32')]);if(_0x23548d[_0xd073('0x33')]){delete _0x23548d['name'];}_0x49203d[_0xd073('0x26')](_0x38238c)[_0xd073('0x34')](_0x23548d);};}exports[_0xd073('0x35')]=function(_0x23f5ae,_0x53f6b9){var _0x37be3d={},_0x59599={},_0x143e23={'count':0x0,'rows':[]};var _0x13d281=_[_0xd073('0x36')](db['SugarcrmConfiguration']['rawAttributes'],function(_0xa6183e){return{'name':_0xa6183e['fieldName'],'type':_0xa6183e[_0xd073('0x37')][_0xd073('0x38')]};});_0x59599[_0xd073('0x39')]=_[_0xd073('0x36')](_0x13d281,_0xd073('0x33'));_0x59599['query']=_[_0xd073('0x3a')](_0x23f5ae['query']);_0x59599[_0xd073('0x3b')]=_[_0xd073('0x3c')](_0x59599['model'],_0x59599['query']);_0x37be3d[_0xd073('0x3d')]=_[_0xd073('0x3c')](_0x59599[_0xd073('0x39')],qs['fields'](_0x23f5ae[_0xd073('0x3e')]['fields']));_0x37be3d[_0xd073('0x3d')]=_0x37be3d['attributes'][_0xd073('0x3f')]?_0x37be3d[_0xd073('0x3d')]:_0x59599[_0xd073('0x39')];if(!_0x23f5ae['query'][_0xd073('0x40')](_0xd073('0x41'))){_0x37be3d[_0xd073('0x2a')]=qs[_0xd073('0x2a')](_0x23f5ae[_0xd073('0x3e')][_0xd073('0x2a')]);_0x37be3d[_0xd073('0x29')]=qs['offset'](_0x23f5ae[_0xd073('0x3e')][_0xd073('0x29')]);}_0x37be3d[_0xd073('0x42')]=qs[_0xd073('0x43')](_0x23f5ae[_0xd073('0x3e')][_0xd073('0x43')]);_0x37be3d[_0xd073('0x44')]=qs['filters'](_[_0xd073('0x45')](_0x23f5ae['query'],_0x59599[_0xd073('0x3b')]),_0x13d281);if(_0x23f5ae[_0xd073('0x3e')]['filter']){_0x37be3d[_0xd073('0x44')]=_[_0xd073('0x46')](_0x37be3d[_0xd073('0x44')],{'$or':_[_0xd073('0x36')](_0x13d281,function(_0x1c3643){if(_0x1c3643[_0xd073('0x37')]!==_0xd073('0x47')){var _0x112711={};_0x112711[_0x1c3643['name']]={'$like':'%'+_0x23f5ae['query'][_0xd073('0x48')]+'%'};return _0x112711;}})});}_0x37be3d=_['merge']({},_0x37be3d,_0x23f5ae[_0xd073('0x49')]);var _0x545048={'where':_0x37be3d[_0xd073('0x44')]};return db[_0xd073('0x4a')][_0xd073('0x4b')](_0x545048)[_0xd073('0x1a')](function(_0x1a515e){_0x143e23[_0xd073('0x4b')]=_0x1a515e;if(_0x23f5ae[_0xd073('0x3e')]['includeAll']){_0x37be3d['include']=[{'all':!![]}];}return db[_0xd073('0x4a')]['findAll'](_0x37be3d);})['then'](function(_0x15bba5){_0x143e23[_0xd073('0x4c')]=_0x15bba5;return _0x143e23;})[_0xd073('0x1a')](respondWithFilteredResult(_0x53f6b9,_0x37be3d))[_0xd073('0x4d')](handleError(_0x53f6b9,null));};exports['show']=function(_0x294ae7,_0x333b83){var _0x164c8e={'raw':![],'where':{'id':_0x294ae7['params']['id']}},_0xa941ea={};_0xa941ea['model']=_['keys'](db[_0xd073('0x4a')]['rawAttributes']);_0xa941ea['query']=_[_0xd073('0x3a')](_0x294ae7[_0xd073('0x3e')]);_0xa941ea[_0xd073('0x3b')]=_['intersection'](_0xa941ea['model'],_0xa941ea['query']);_0x164c8e[_0xd073('0x3d')]=_['intersection'](_0xa941ea[_0xd073('0x39')],qs[_0xd073('0x4e')](_0x294ae7['query'][_0xd073('0x4e')]));_0x164c8e[_0xd073('0x3d')]=_0x164c8e[_0xd073('0x3d')][_0xd073('0x3f')]?_0x164c8e[_0xd073('0x3d')]:_0xa941ea[_0xd073('0x39')];if(_0x294ae7[_0xd073('0x3e')][_0xd073('0x4f')]){_0x164c8e['include']=[{'all':!![]}];}_0x164c8e=_[_0xd073('0x46')]({},_0x164c8e,_0x294ae7[_0xd073('0x49')]);return db[_0xd073('0x4a')]['find'](_0x164c8e)['then'](handleEntityNotFound(_0x333b83,null))[_0xd073('0x1a')](respondWithResult(_0x333b83,null))[_0xd073('0x4d')](handleError(_0x333b83,null));};exports[_0xd073('0x50')]=function(_0x54ad52,_0x286b95){return db[_0xd073('0x4a')]['create'](_0x54ad52[_0xd073('0x51')],{})[_0xd073('0x1a')](respondWithResult(_0x286b95,0xc9))['catch'](handleError(_0x286b95,null));};exports[_0xd073('0x30')]=function(_0x13436a,_0x16fa02){if(_0x13436a[_0xd073('0x51')]['id']){delete _0x13436a[_0xd073('0x51')]['id'];}return db[_0xd073('0x4a')][_0xd073('0x52')]({'where':{'id':_0x13436a[_0xd073('0x53')]['id']}})[_0xd073('0x1a')](handleEntityNotFound(_0x16fa02,null))[_0xd073('0x1a')](saveUpdates(_0x13436a[_0xd073('0x51')],null))[_0xd073('0x1a')](respondWithResult(_0x16fa02,null))[_0xd073('0x4d')](handleError(_0x16fa02,null));};exports[_0xd073('0x31')]=function(_0xcec94d,_0x73f120){return db['SugarcrmConfiguration'][_0xd073('0x52')]({'where':{'id':_0xcec94d['params']['id']}})[_0xd073('0x1a')](handleEntityNotFound(_0x73f120,null))[_0xd073('0x1a')](removeEntity(_0x73f120,null))['catch'](handleError(_0x73f120,null));};exports['getFields']=function(_0x47b315,_0x2fcd0a,_0x321cad){var _0x25cd14={};var _0x38e048={};var _0x14bca9;var _0x27c1fb;return db['SugarcrmConfiguration'][_0xd073('0x54')]({'where':{'id':_0x47b315[_0xd073('0x53')]['id']}})[_0xd073('0x1a')](handleEntityNotFound(_0x2fcd0a,null))[_0xd073('0x1a')](function(_0x2f1b8e){if(_0x2f1b8e){_0x14bca9=_0x2f1b8e;_0x38e048['model']=_[_0xd073('0x3a')](db['SugarcrmField'][_0xd073('0x55')]);_0x38e048['query']=_[_0xd073('0x3a')](_0x47b315[_0xd073('0x3e')]);_0x38e048['filters']=_[_0xd073('0x3c')](_0x38e048[_0xd073('0x39')],_0x38e048[_0xd073('0x3e')]);_0x25cd14[_0xd073('0x3d')]=_[_0xd073('0x3c')](_0x38e048[_0xd073('0x39')],qs[_0xd073('0x4e')](_0x47b315[_0xd073('0x3e')][_0xd073('0x4e')]));_0x25cd14[_0xd073('0x3d')]=_0x25cd14['attributes'][_0xd073('0x3f')]?_0x25cd14[_0xd073('0x3d')]:_0x38e048[_0xd073('0x39')];_0x25cd14[_0xd073('0x42')]=qs[_0xd073('0x43')](_0x47b315[_0xd073('0x3e')]['sort']);_0x25cd14[_0xd073('0x44')]=qs[_0xd073('0x3b')](_[_0xd073('0x45')](_0x47b315[_0xd073('0x3e')],_0x38e048[_0xd073('0x3b')]));if(_0x47b315[_0xd073('0x3e')][_0xd073('0x48')]){_0x25cd14[_0xd073('0x44')]=_[_0xd073('0x46')](_0x25cd14['where'],{'$or':_[_0xd073('0x36')](_0x25cd14[_0xd073('0x3d')],function(_0x495507){var _0xe4977e={};_0xe4977e[_0x495507]={'$like':'%'+_0x47b315[_0xd073('0x3e')][_0xd073('0x48')]+'%'};return _0xe4977e;})});}_0x25cd14=_['merge']({},_0x25cd14,_0x47b315['options']);return _0x14bca9[_0xd073('0x56')](_0x25cd14);}})['then'](function(_0x125612){if(_0x125612){_0x27c1fb=_0x125612[_0xd073('0x3f')];if(!_0x47b315[_0xd073('0x3e')]['hasOwnProperty'](_0xd073('0x41'))){_0x25cd14[_0xd073('0x2a')]=qs[_0xd073('0x2a')](_0x47b315['query']['limit']);_0x25cd14['offset']=qs['offset'](_0x47b315[_0xd073('0x3e')][_0xd073('0x29')]);}return _0x14bca9[_0xd073('0x56')](_0x25cd14);}})[_0xd073('0x1a')](function(_0x3fd123){if(_0x3fd123){return _0x3fd123?{'count':_0x27c1fb,'rows':_0x3fd123}:null;}})[_0xd073('0x1a')](respondWithResult(_0x2fcd0a,null))['catch'](handleError(_0x2fcd0a,null));};exports[_0xd073('0x57')]=function(_0x37609e,_0x5b05f8,_0x7b408){var _0x252e2c={};var _0x5f15e2={};var _0x277a72;var _0x34d544;return db['SugarcrmConfiguration'][_0xd073('0x54')]({'where':{'id':_0x37609e['params']['id']}})[_0xd073('0x1a')](handleEntityNotFound(_0x5b05f8,null))[_0xd073('0x1a')](function(_0x308a2d){if(_0x308a2d){_0x277a72=_0x308a2d;_0x5f15e2[_0xd073('0x39')]=_[_0xd073('0x3a')](db['SugarcrmField']['rawAttributes']);_0x5f15e2[_0xd073('0x3e')]=_[_0xd073('0x3a')](_0x37609e[_0xd073('0x3e')]);_0x5f15e2[_0xd073('0x3b')]=_['intersection'](_0x5f15e2['model'],_0x5f15e2[_0xd073('0x3e')]);_0x252e2c['attributes']=_[_0xd073('0x3c')](_0x5f15e2[_0xd073('0x39')],qs[_0xd073('0x4e')](_0x37609e['query']['fields']));_0x252e2c['attributes']=_0x252e2c['attributes']['length']?_0x252e2c[_0xd073('0x3d')]:_0x5f15e2[_0xd073('0x39')];_0x252e2c[_0xd073('0x42')]=qs['sort'](_0x37609e[_0xd073('0x3e')][_0xd073('0x43')]);_0x252e2c[_0xd073('0x44')]=qs[_0xd073('0x3b')](_[_0xd073('0x45')](_0x37609e[_0xd073('0x3e')],_0x5f15e2[_0xd073('0x3b')]));if(_0x37609e[_0xd073('0x3e')]['filter']){_0x252e2c[_0xd073('0x44')]=_[_0xd073('0x46')](_0x252e2c[_0xd073('0x44')],{'$or':_[_0xd073('0x36')](_0x252e2c['attributes'],function(_0x4c3424){var _0x28ec9e={};_0x28ec9e[_0x4c3424]={'$like':'%'+_0x37609e['query'][_0xd073('0x48')]+'%'};return _0x28ec9e;})});}_0x252e2c=_[_0xd073('0x46')]({},_0x252e2c,_0x37609e[_0xd073('0x49')]);return _0x277a72[_0xd073('0x57')](_0x252e2c);}})[_0xd073('0x1a')](function(_0x51590d){if(_0x51590d){_0x34d544=_0x51590d[_0xd073('0x3f')];if(!_0x37609e[_0xd073('0x3e')][_0xd073('0x40')](_0xd073('0x41'))){_0x252e2c[_0xd073('0x2a')]=qs[_0xd073('0x2a')](_0x37609e[_0xd073('0x3e')]['limit']);_0x252e2c[_0xd073('0x29')]=qs['offset'](_0x37609e[_0xd073('0x3e')][_0xd073('0x29')]);}return _0x277a72[_0xd073('0x57')](_0x252e2c);}})[_0xd073('0x1a')](function(_0x394dd1){if(_0x394dd1){return _0x394dd1?{'count':_0x34d544,'rows':_0x394dd1}:null;}})['then'](respondWithResult(_0x5b05f8,null))[_0xd073('0x4d')](handleError(_0x5b05f8,null));};exports[_0xd073('0x58')]=function(_0x3dcd4b,_0x13eab7,_0xeaa733){var _0x5132e6={};var _0x1e203a={};var _0x1221e1;var _0x2898cf;return db[_0xd073('0x4a')][_0xd073('0x54')]({'where':{'id':_0x3dcd4b[_0xd073('0x53')]['id']}})[_0xd073('0x1a')](handleEntityNotFound(_0x13eab7,null))[_0xd073('0x1a')](function(_0x472691){if(_0x472691){_0x1221e1=_0x472691;_0x1e203a[_0xd073('0x39')]=_['keys'](db[_0xd073('0x59')][_0xd073('0x55')]);_0x1e203a[_0xd073('0x3e')]=_[_0xd073('0x3a')](_0x3dcd4b[_0xd073('0x3e')]);_0x1e203a[_0xd073('0x3b')]=_['intersection'](_0x1e203a[_0xd073('0x39')],_0x1e203a[_0xd073('0x3e')]);_0x5132e6[_0xd073('0x3d')]=_[_0xd073('0x3c')](_0x1e203a[_0xd073('0x39')],qs[_0xd073('0x4e')](_0x3dcd4b[_0xd073('0x3e')][_0xd073('0x4e')]));_0x5132e6[_0xd073('0x3d')]=_0x5132e6['attributes']['length']?_0x5132e6['attributes']:_0x1e203a[_0xd073('0x39')];_0x5132e6['order']=qs[_0xd073('0x43')](_0x3dcd4b[_0xd073('0x3e')]['sort']);_0x5132e6[_0xd073('0x44')]=qs[_0xd073('0x3b')](_[_0xd073('0x45')](_0x3dcd4b['query'],_0x1e203a[_0xd073('0x3b')]));if(_0x3dcd4b['query'][_0xd073('0x48')]){_0x5132e6[_0xd073('0x44')]=_[_0xd073('0x46')](_0x5132e6[_0xd073('0x44')],{'$or':_[_0xd073('0x36')](_0x5132e6['attributes'],function(_0x23f4bd){var _0x1995f3={};_0x1995f3[_0x23f4bd]={'$like':'%'+_0x3dcd4b[_0xd073('0x3e')][_0xd073('0x48')]+'%'};return _0x1995f3;})});}_0x5132e6=_[_0xd073('0x46')]({},_0x5132e6,_0x3dcd4b[_0xd073('0x49')]);return _0x1221e1[_0xd073('0x58')](_0x5132e6);}})['then'](function(_0x3ef66c){if(_0x3ef66c){_0x2898cf=_0x3ef66c[_0xd073('0x3f')];if(!_0x3dcd4b[_0xd073('0x3e')][_0xd073('0x40')](_0xd073('0x41'))){_0x5132e6[_0xd073('0x2a')]=qs['limit'](_0x3dcd4b[_0xd073('0x3e')][_0xd073('0x2a')]);_0x5132e6[_0xd073('0x29')]=qs[_0xd073('0x29')](_0x3dcd4b[_0xd073('0x3e')][_0xd073('0x29')]);}return _0x1221e1['getDescriptions'](_0x5132e6);}})[_0xd073('0x1a')](function(_0x2805f2){if(_0x2805f2){return _0x2805f2?{'count':_0x2898cf,'rows':_0x2805f2}:null;}})[_0xd073('0x1a')](respondWithResult(_0x13eab7,null))['catch'](handleError(_0x13eab7,null));}; \ No newline at end of file +var _0xd01b=['getDescriptions','rimraf','zip-dir','moment','mustache','util','sox','to-csv','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','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','params','destroy','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects'];(function(_0x28a768,_0x161501){var _0x1049b1=function(_0x340a56){while(--_0x340a56){_0x28a768['push'](_0x28a768['shift']());}};_0x1049b1(++_0x161501);}(_0xd01b,0x11b));var _0xbd01=function(_0x2f8900,_0x10ce84){_0x2f8900=_0x2f8900-0x0;var _0x4f07aa=_0xd01b[_0x2f8900];return _0x4f07aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd01('0x0'));var zipdir=require(_0xbd01('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbd01('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbd01('0x3'));var util=require(_0xbd01('0x4'));var path=require('path');var sox=require(_0xbd01('0x5'));var csv=require(_0xbd01('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd01('0x7'));var _=require(_0xbd01('0x8'));var squel=require(_0xbd01('0x9'));var crypto=require(_0xbd01('0xa'));var jsforce=require(_0xbd01('0xb'));var deskjs=require(_0xbd01('0xc'));var toCsv=require(_0xbd01('0x6'));var querystring=require('querystring');var Papa=require(_0xbd01('0xd'));var Redis=require(_0xbd01('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xbd01('0xf'));var as=require(_0xbd01('0x10'));var hardwareService=require(_0xbd01('0x11'));var logger=require(_0xbd01('0x12'))(_0xbd01('0x13'));var utils=require(_0xbd01('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbd01('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xbd01('0x16'));var client=jayson[_0xbd01('0x17')][_0xbd01('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x191fe7,_0x4179a0,_0x25946e,_0x47d6d7){return new BPromise(function(_0x79f835,_0x425ca2){var _0x353bd0=_0x47d6d7||client;return _0x353bd0[_0xbd01('0x19')](_0x191fe7,_0x25946e)[_0xbd01('0x1a')](function(_0x214c5c){logger['info'](_0xbd01('0x1b'),_0x4179a0,_0xbd01('0x1c'));logger[_0xbd01('0x1d')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x4179a0,_0xbd01('0x1c'),JSON[_0xbd01('0x1e')](_0x214c5c));if(_0x214c5c[_0xbd01('0x1f')]){if(_0x214c5c['error'][_0xbd01('0x20')]===0x1f4){logger[_0xbd01('0x1f')](_0xbd01('0x1b'),_0x4179a0,_0x214c5c['error']['message']);return _0x425ca2(_0x214c5c[_0xbd01('0x1f')]['message']);}logger[_0xbd01('0x1f')](_0xbd01('0x1b'),_0x4179a0,_0x214c5c['error'][_0xbd01('0x21')]);return _0x79f835(_0x214c5c[_0xbd01('0x1f')]['message']);}else{logger[_0xbd01('0x22')](_0xbd01('0x1b'),_0x4179a0,_0xbd01('0x1c'));_0x79f835(_0x214c5c[_0xbd01('0x23')][_0xbd01('0x21')]);}})[_0xbd01('0x24')](function(_0x16fe7e){logger[_0xbd01('0x1f')](_0xbd01('0x1b'),_0x4179a0,_0x16fe7e);_0x425ca2(_0x16fe7e);});});}function respondWithStatusCode(_0x326a0b,_0x2642cf){_0x2642cf=_0x2642cf||0xcc;return function(_0x1c012f){if(_0x1c012f){return _0x326a0b[_0xbd01('0x25')](_0x2642cf);}return _0x326a0b[_0xbd01('0x26')](_0x2642cf)[_0xbd01('0x27')]();};}function respondWithResult(_0x44ea18,_0x22ccaf){_0x22ccaf=_0x22ccaf||0xc8;return function(_0x18b852){if(_0x18b852){return _0x44ea18[_0xbd01('0x26')](_0x22ccaf)[_0xbd01('0x28')](_0x18b852);}};}function respondWithFilteredResult(_0x440a2f,_0x2d7f0c){return function(_0x463baf){if(_0x463baf){var _0x43d6d2=typeof _0x2d7f0c[_0xbd01('0x29')]==='undefined'&&typeof _0x2d7f0c['limit']===_0xbd01('0x2a');var _0x424527=_0x463baf[_0xbd01('0x2b')];var _0x97724d=_0x43d6d2?0x0:_0x2d7f0c[_0xbd01('0x29')];var _0x22773c=_0x43d6d2?_0x463baf[_0xbd01('0x2b')]:_0x2d7f0c[_0xbd01('0x29')]+_0x2d7f0c['limit'];var _0x56fce8;if(_0x22773c>=_0x424527){_0x22773c=_0x424527;_0x56fce8=0xc8;}else{_0x56fce8=0xce;}_0x440a2f[_0xbd01('0x26')](_0x56fce8);return _0x440a2f[_0xbd01('0x2c')](_0xbd01('0x2d'),_0x97724d+'-'+_0x22773c+'/'+_0x424527)[_0xbd01('0x28')](_0x463baf);}return null;};}function patchUpdates(_0x575cb9){return function(_0x168df8){try{jsonpatch[_0xbd01('0x2e')](_0x168df8,_0x575cb9,!![]);}catch(_0x4979ff){return BPromise[_0xbd01('0x2f')](_0x4979ff);}return _0x168df8[_0xbd01('0x30')]();};}function saveUpdates(_0x426dcd,_0x555a9b){return function(_0x4d0ff5){if(_0x4d0ff5){return _0x4d0ff5[_0xbd01('0x31')](_0x426dcd)[_0xbd01('0x1a')](function(_0x52a491){return _0x52a491;});}return null;};}function removeEntity(_0x369910,_0x37a744){return function(_0x3cb794){if(_0x3cb794){return _0x3cb794['destroy']()[_0xbd01('0x1a')](function(){_0x369910['status'](0xcc)[_0xbd01('0x27')]();});}};}function handleEntityNotFound(_0x5043c3,_0x4a82d4){return function(_0x51eb7a){if(!_0x51eb7a){_0x5043c3['sendStatus'](0x194);}return _0x51eb7a;};}function handleError(_0x34d127,_0x2926ee){_0x2926ee=_0x2926ee||0x1f4;return function(_0x2745ed){logger['error'](_0x2745ed[_0xbd01('0x32')]);if(_0x2745ed[_0xbd01('0x33')]){delete _0x2745ed[_0xbd01('0x33')];}_0x34d127[_0xbd01('0x26')](_0x2926ee)[_0xbd01('0x34')](_0x2745ed);};}exports[_0xbd01('0x35')]=function(_0x4a9ba3,_0x473e94){var _0xc21064={},_0xc37ecc={},_0x20132d={'count':0x0,'rows':[]};var _0xfb66b7=_[_0xbd01('0x36')](db[_0xbd01('0x37')][_0xbd01('0x38')],function(_0x20dc1f){return{'name':_0x20dc1f[_0xbd01('0x39')],'type':_0x20dc1f[_0xbd01('0x3a')][_0xbd01('0x3b')]};});_0xc37ecc[_0xbd01('0x3c')]=_[_0xbd01('0x36')](_0xfb66b7,_0xbd01('0x33'));_0xc37ecc[_0xbd01('0x3d')]=_['keys'](_0x4a9ba3[_0xbd01('0x3d')]);_0xc37ecc[_0xbd01('0x3e')]=_[_0xbd01('0x3f')](_0xc37ecc[_0xbd01('0x3c')],_0xc37ecc[_0xbd01('0x3d')]);_0xc21064['attributes']=_[_0xbd01('0x3f')](_0xc37ecc[_0xbd01('0x3c')],qs[_0xbd01('0x40')](_0x4a9ba3[_0xbd01('0x3d')][_0xbd01('0x40')]));_0xc21064['attributes']=_0xc21064[_0xbd01('0x41')][_0xbd01('0x42')]?_0xc21064[_0xbd01('0x41')]:_0xc37ecc[_0xbd01('0x3c')];if(!_0x4a9ba3[_0xbd01('0x3d')]['hasOwnProperty'](_0xbd01('0x43'))){_0xc21064[_0xbd01('0x44')]=qs[_0xbd01('0x44')](_0x4a9ba3[_0xbd01('0x3d')][_0xbd01('0x44')]);_0xc21064[_0xbd01('0x29')]=qs[_0xbd01('0x29')](_0x4a9ba3['query']['offset']);}_0xc21064[_0xbd01('0x45')]=qs[_0xbd01('0x46')](_0x4a9ba3[_0xbd01('0x3d')][_0xbd01('0x46')]);_0xc21064[_0xbd01('0x47')]=qs[_0xbd01('0x3e')](_[_0xbd01('0x48')](_0x4a9ba3[_0xbd01('0x3d')],_0xc37ecc['filters']),_0xfb66b7);if(_0x4a9ba3[_0xbd01('0x3d')][_0xbd01('0x49')]){_0xc21064[_0xbd01('0x47')]=_[_0xbd01('0x4a')](_0xc21064[_0xbd01('0x47')],{'$or':_[_0xbd01('0x36')](_0xfb66b7,function(_0x3e454d){if(_0x3e454d[_0xbd01('0x3a')]!==_0xbd01('0x4b')){var _0x615cbf={};_0x615cbf[_0x3e454d['name']]={'$like':'%'+_0x4a9ba3[_0xbd01('0x3d')]['filter']+'%'};return _0x615cbf;}})});}_0xc21064=_['merge']({},_0xc21064,_0x4a9ba3[_0xbd01('0x4c')]);var _0x56cbd2={'where':_0xc21064[_0xbd01('0x47')]};return db[_0xbd01('0x37')][_0xbd01('0x2b')](_0x56cbd2)[_0xbd01('0x1a')](function(_0x593e25){_0x20132d['count']=_0x593e25;if(_0x4a9ba3[_0xbd01('0x3d')][_0xbd01('0x4d')]){_0xc21064[_0xbd01('0x4e')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xbd01('0x4f')](_0xc21064);})['then'](function(_0x5134df){_0x20132d[_0xbd01('0x50')]=_0x5134df;return _0x20132d;})['then'](respondWithFilteredResult(_0x473e94,_0xc21064))[_0xbd01('0x24')](handleError(_0x473e94,null));};exports[_0xbd01('0x51')]=function(_0x2435cf,_0x1ccdae){var _0x18e670={'raw':![],'where':{'id':_0x2435cf['params']['id']}},_0x5225a1={};_0x5225a1[_0xbd01('0x3c')]=_[_0xbd01('0x52')](db[_0xbd01('0x37')]['rawAttributes']);_0x5225a1[_0xbd01('0x3d')]=_[_0xbd01('0x52')](_0x2435cf[_0xbd01('0x3d')]);_0x5225a1[_0xbd01('0x3e')]=_[_0xbd01('0x3f')](_0x5225a1[_0xbd01('0x3c')],_0x5225a1['query']);_0x18e670[_0xbd01('0x41')]=_[_0xbd01('0x3f')](_0x5225a1[_0xbd01('0x3c')],qs[_0xbd01('0x40')](_0x2435cf['query'][_0xbd01('0x40')]));_0x18e670[_0xbd01('0x41')]=_0x18e670[_0xbd01('0x41')][_0xbd01('0x42')]?_0x18e670[_0xbd01('0x41')]:_0x5225a1[_0xbd01('0x3c')];if(_0x2435cf[_0xbd01('0x3d')]['includeAll']){_0x18e670[_0xbd01('0x4e')]=[{'all':!![]}];}_0x18e670=_[_0xbd01('0x4a')]({},_0x18e670,_0x2435cf[_0xbd01('0x4c')]);return db[_0xbd01('0x37')][_0xbd01('0x53')](_0x18e670)['then'](handleEntityNotFound(_0x1ccdae,null))['then'](respondWithResult(_0x1ccdae,null))[_0xbd01('0x24')](handleError(_0x1ccdae,null));};exports[_0xbd01('0x54')]=function(_0x301301,_0x41f0cf){return db[_0xbd01('0x37')][_0xbd01('0x54')](_0x301301['body'],{})[_0xbd01('0x1a')](respondWithResult(_0x41f0cf,0xc9))[_0xbd01('0x24')](handleError(_0x41f0cf,null));};exports[_0xbd01('0x31')]=function(_0x235b81,_0x3f03c7){if(_0x235b81[_0xbd01('0x55')]['id']){delete _0x235b81[_0xbd01('0x55')]['id'];}return db[_0xbd01('0x37')][_0xbd01('0x53')]({'where':{'id':_0x235b81[_0xbd01('0x56')]['id']}})['then'](handleEntityNotFound(_0x3f03c7,null))[_0xbd01('0x1a')](saveUpdates(_0x235b81['body'],null))[_0xbd01('0x1a')](respondWithResult(_0x3f03c7,null))[_0xbd01('0x24')](handleError(_0x3f03c7,null));};exports[_0xbd01('0x57')]=function(_0x519b61,_0x44925e){return db[_0xbd01('0x37')][_0xbd01('0x53')]({'where':{'id':_0x519b61[_0xbd01('0x56')]['id']}})[_0xbd01('0x1a')](handleEntityNotFound(_0x44925e,null))[_0xbd01('0x1a')](removeEntity(_0x44925e,null))['catch'](handleError(_0x44925e,null));};exports[_0xbd01('0x58')]=function(_0x249f27,_0x3ae812,_0x3f51e9){var _0x51499a={};var _0x178806={};var _0x4ee56d;var _0x5b16be;return db[_0xbd01('0x37')][_0xbd01('0x59')]({'where':{'id':_0x249f27[_0xbd01('0x56')]['id']}})[_0xbd01('0x1a')](handleEntityNotFound(_0x3ae812,null))[_0xbd01('0x1a')](function(_0x157d63){if(_0x157d63){_0x4ee56d=_0x157d63;_0x178806[_0xbd01('0x3c')]=_[_0xbd01('0x52')](db[_0xbd01('0x5a')][_0xbd01('0x38')]);_0x178806[_0xbd01('0x3d')]=_[_0xbd01('0x52')](_0x249f27[_0xbd01('0x3d')]);_0x178806[_0xbd01('0x3e')]=_['intersection'](_0x178806[_0xbd01('0x3c')],_0x178806[_0xbd01('0x3d')]);_0x51499a[_0xbd01('0x41')]=_[_0xbd01('0x3f')](_0x178806[_0xbd01('0x3c')],qs['fields'](_0x249f27['query'][_0xbd01('0x40')]));_0x51499a[_0xbd01('0x41')]=_0x51499a[_0xbd01('0x41')][_0xbd01('0x42')]?_0x51499a[_0xbd01('0x41')]:_0x178806[_0xbd01('0x3c')];_0x51499a[_0xbd01('0x45')]=qs[_0xbd01('0x46')](_0x249f27[_0xbd01('0x3d')][_0xbd01('0x46')]);_0x51499a['where']=qs[_0xbd01('0x3e')](_[_0xbd01('0x48')](_0x249f27[_0xbd01('0x3d')],_0x178806[_0xbd01('0x3e')]));if(_0x249f27['query'][_0xbd01('0x49')]){_0x51499a[_0xbd01('0x47')]=_[_0xbd01('0x4a')](_0x51499a[_0xbd01('0x47')],{'$or':_['map'](_0x51499a[_0xbd01('0x41')],function(_0x1b5d25){var _0x141ce7={};_0x141ce7[_0x1b5d25]={'$like':'%'+_0x249f27[_0xbd01('0x3d')]['filter']+'%'};return _0x141ce7;})});}_0x51499a=_[_0xbd01('0x4a')]({},_0x51499a,_0x249f27[_0xbd01('0x4c')]);return _0x4ee56d[_0xbd01('0x58')](_0x51499a);}})['then'](function(_0x9d09ed){if(_0x9d09ed){_0x5b16be=_0x9d09ed[_0xbd01('0x42')];if(!_0x249f27[_0xbd01('0x3d')][_0xbd01('0x5b')](_0xbd01('0x43'))){_0x51499a[_0xbd01('0x44')]=qs[_0xbd01('0x44')](_0x249f27['query'][_0xbd01('0x44')]);_0x51499a[_0xbd01('0x29')]=qs[_0xbd01('0x29')](_0x249f27['query'][_0xbd01('0x29')]);}return _0x4ee56d['getFields'](_0x51499a);}})['then'](function(_0x453b9c){if(_0x453b9c){return _0x453b9c?{'count':_0x5b16be,'rows':_0x453b9c}:null;}})[_0xbd01('0x1a')](respondWithResult(_0x3ae812,null))[_0xbd01('0x24')](handleError(_0x3ae812,null));};exports[_0xbd01('0x5c')]=function(_0x1919e7,_0x3390db,_0x291d55){var _0x127140={};var _0x424f45={};var _0x151a0b;var _0x40938f;return db[_0xbd01('0x37')][_0xbd01('0x59')]({'where':{'id':_0x1919e7[_0xbd01('0x56')]['id']}})['then'](handleEntityNotFound(_0x3390db,null))[_0xbd01('0x1a')](function(_0x66f244){if(_0x66f244){_0x151a0b=_0x66f244;_0x424f45[_0xbd01('0x3c')]=_['keys'](db[_0xbd01('0x5a')][_0xbd01('0x38')]);_0x424f45[_0xbd01('0x3d')]=_[_0xbd01('0x52')](_0x1919e7['query']);_0x424f45[_0xbd01('0x3e')]=_[_0xbd01('0x3f')](_0x424f45[_0xbd01('0x3c')],_0x424f45[_0xbd01('0x3d')]);_0x127140[_0xbd01('0x41')]=_['intersection'](_0x424f45[_0xbd01('0x3c')],qs[_0xbd01('0x40')](_0x1919e7[_0xbd01('0x3d')][_0xbd01('0x40')]));_0x127140[_0xbd01('0x41')]=_0x127140['attributes'][_0xbd01('0x42')]?_0x127140[_0xbd01('0x41')]:_0x424f45[_0xbd01('0x3c')];_0x127140[_0xbd01('0x45')]=qs[_0xbd01('0x46')](_0x1919e7[_0xbd01('0x3d')][_0xbd01('0x46')]);_0x127140[_0xbd01('0x47')]=qs[_0xbd01('0x3e')](_['pick'](_0x1919e7[_0xbd01('0x3d')],_0x424f45[_0xbd01('0x3e')]));if(_0x1919e7[_0xbd01('0x3d')][_0xbd01('0x49')]){_0x127140['where']=_[_0xbd01('0x4a')](_0x127140[_0xbd01('0x47')],{'$or':_[_0xbd01('0x36')](_0x127140[_0xbd01('0x41')],function(_0x1566c7){var _0x4fb653={};_0x4fb653[_0x1566c7]={'$like':'%'+_0x1919e7[_0xbd01('0x3d')][_0xbd01('0x49')]+'%'};return _0x4fb653;})});}_0x127140=_[_0xbd01('0x4a')]({},_0x127140,_0x1919e7[_0xbd01('0x4c')]);return _0x151a0b[_0xbd01('0x5c')](_0x127140);}})[_0xbd01('0x1a')](function(_0x488377){if(_0x488377){_0x40938f=_0x488377[_0xbd01('0x42')];if(!_0x1919e7['query']['hasOwnProperty']('nolimit')){_0x127140[_0xbd01('0x44')]=qs['limit'](_0x1919e7[_0xbd01('0x3d')][_0xbd01('0x44')]);_0x127140[_0xbd01('0x29')]=qs[_0xbd01('0x29')](_0x1919e7['query'][_0xbd01('0x29')]);}return _0x151a0b[_0xbd01('0x5c')](_0x127140);}})['then'](function(_0x31c048){if(_0x31c048){return _0x31c048?{'count':_0x40938f,'rows':_0x31c048}:null;}})[_0xbd01('0x1a')](respondWithResult(_0x3390db,null))[_0xbd01('0x24')](handleError(_0x3390db,null));};exports[_0xbd01('0x5d')]=function(_0x5a6658,_0xef9f90,_0x396fd5){var _0x545883={};var _0x3748a1={};var _0x549029;var _0x4a357c;return db[_0xbd01('0x37')][_0xbd01('0x59')]({'where':{'id':_0x5a6658[_0xbd01('0x56')]['id']}})[_0xbd01('0x1a')](handleEntityNotFound(_0xef9f90,null))[_0xbd01('0x1a')](function(_0x204961){if(_0x204961){_0x549029=_0x204961;_0x3748a1[_0xbd01('0x3c')]=_[_0xbd01('0x52')](db['SugarcrmField'][_0xbd01('0x38')]);_0x3748a1[_0xbd01('0x3d')]=_['keys'](_0x5a6658[_0xbd01('0x3d')]);_0x3748a1[_0xbd01('0x3e')]=_[_0xbd01('0x3f')](_0x3748a1[_0xbd01('0x3c')],_0x3748a1[_0xbd01('0x3d')]);_0x545883[_0xbd01('0x41')]=_[_0xbd01('0x3f')](_0x3748a1['model'],qs[_0xbd01('0x40')](_0x5a6658['query'][_0xbd01('0x40')]));_0x545883['attributes']=_0x545883[_0xbd01('0x41')][_0xbd01('0x42')]?_0x545883[_0xbd01('0x41')]:_0x3748a1[_0xbd01('0x3c')];_0x545883[_0xbd01('0x45')]=qs[_0xbd01('0x46')](_0x5a6658[_0xbd01('0x3d')]['sort']);_0x545883['where']=qs[_0xbd01('0x3e')](_[_0xbd01('0x48')](_0x5a6658['query'],_0x3748a1[_0xbd01('0x3e')]));if(_0x5a6658[_0xbd01('0x3d')]['filter']){_0x545883[_0xbd01('0x47')]=_['merge'](_0x545883[_0xbd01('0x47')],{'$or':_[_0xbd01('0x36')](_0x545883[_0xbd01('0x41')],function(_0x4cad42){var _0x41daa4={};_0x41daa4[_0x4cad42]={'$like':'%'+_0x5a6658[_0xbd01('0x3d')]['filter']+'%'};return _0x41daa4;})});}_0x545883=_[_0xbd01('0x4a')]({},_0x545883,_0x5a6658['options']);return _0x549029[_0xbd01('0x5d')](_0x545883);}})[_0xbd01('0x1a')](function(_0x53e1eb){if(_0x53e1eb){_0x4a357c=_0x53e1eb['length'];if(!_0x5a6658['query'][_0xbd01('0x5b')](_0xbd01('0x43'))){_0x545883[_0xbd01('0x44')]=qs[_0xbd01('0x44')](_0x5a6658[_0xbd01('0x3d')][_0xbd01('0x44')]);_0x545883['offset']=qs[_0xbd01('0x29')](_0x5a6658[_0xbd01('0x3d')][_0xbd01('0x29')]);}return _0x549029[_0xbd01('0x5d')](_0x545883);}})[_0xbd01('0x1a')](function(_0x298dcd){if(_0x298dcd){return _0x298dcd?{'count':_0x4a357c,'rows':_0x298dcd}:null;}})[_0xbd01('0x1a')](respondWithResult(_0xef9f90,null))[_0xbd01('0x24')](handleError(_0xef9f90,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 7ecfc49..0e9fea0 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 _0xce16=['../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','SugarcrmConfiguration','lodash','util'];(function(_0x1d2828,_0x419e36){var _0x164ef6=function(_0x847b5){while(--_0x847b5){_0x1d2828['push'](_0x1d2828['shift']());}};_0x164ef6(++_0x419e36);}(_0xce16,0x15e));var _0x6ce1=function(_0x88060,_0x2446f5){_0x88060=_0x88060-0x0;var _0x172823=_0xce16[_0x88060];return _0x172823;};'use strict';var _=require(_0x6ce1('0x0'));var util=require(_0x6ce1('0x1'));var logger=require(_0x6ce1('0x2'))(_0x6ce1('0x3'));var moment=require('moment');var BPromise=require(_0x6ce1('0x4'));var rp=require(_0x6ce1('0x5'));var fs=require('fs');var path=require(_0x6ce1('0x6'));var rimraf=require(_0x6ce1('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x6ce1('0x8')]=function(_0x56f251,_0x502175){return _0x56f251[_0x6ce1('0x9')](_0x6ce1('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a71=['../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3004a2,_0x2e437f){var _0x4b9b6e=function(_0x3cee44){while(--_0x3cee44){_0x3004a2['push'](_0x3004a2['shift']());}};_0x4b9b6e(++_0x2e437f);}(_0x3a71,0x147));var _0x13a7=function(_0x1f660c,_0x1fa832){_0x1f660c=_0x1f660c-0x0;var _0x57c14d=_0x3a71[_0x1f660c];return _0x57c14d;};'use strict';var _=require(_0x13a7('0x0'));var util=require(_0x13a7('0x1'));var logger=require(_0x13a7('0x2'))(_0x13a7('0x3'));var moment=require(_0x13a7('0x4'));var BPromise=require(_0x13a7('0x5'));var rp=require(_0x13a7('0x6'));var fs=require('fs');var path=require(_0x13a7('0x7'));var rimraf=require(_0x13a7('0x8'));var config=require(_0x13a7('0x9'));var attributes=require(_0x13a7('0xa'));module['exports']=function(_0x11aeaf,_0x3df2db){return _0x11aeaf[_0x13a7('0xb')](_0x13a7('0xc'),attributes,{'tableName':_0x13a7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index bd28c7f..5f93cef 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 _0x1242=['../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3fcac1,_0x1a079e){var _0x5290b1=function(_0x4f80be){while(--_0x4f80be){_0x3fcac1['push'](_0x3fcac1['shift']());}};_0x5290b1(++_0x1a079e);}(_0x1242,0x9a));var _0x2124=function(_0x36ea12,_0x175710){_0x36ea12=_0x36ea12-0x0;var _0x5bf298=_0x1242[_0x36ea12];return _0x5bf298;};'use strict';var _=require(_0x2124('0x0'));var util=require(_0x2124('0x1'));var moment=require('moment');var BPromise=require(_0x2124('0x2'));var rs=require(_0x2124('0x3'));var fs=require('fs');var Redis=require(_0x2124('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2124('0x5'));var logger=require(_0x2124('0x6'))('rpc');var config=require(_0x2124('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2124('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b18be,_0x34aba4,_0xaf52a2){return new BPromise(function(_0x53eb0e,_0x49e14d){return client[_0x2124('0x9')](_0x1b18be,_0xaf52a2)[_0x2124('0xa')](function(_0x4ff2cb){logger[_0x2124('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x34aba4,_0x2124('0xc'));logger[_0x2124('0xd')](_0x2124('0xe'),_0x34aba4,_0x2124('0xc'),JSON['stringify'](_0x4ff2cb));if(_0x4ff2cb[_0x2124('0xf')]){if(_0x4ff2cb[_0x2124('0xf')]['code']===0x1f4){logger['error'](_0x2124('0x10'),_0x34aba4,_0x4ff2cb[_0x2124('0xf')][_0x2124('0x11')]);return _0x49e14d(_0x4ff2cb[_0x2124('0xf')]['message']);}logger[_0x2124('0xf')](_0x2124('0x10'),_0x34aba4,_0x4ff2cb[_0x2124('0xf')]['message']);return _0x53eb0e(_0x4ff2cb[_0x2124('0xf')][_0x2124('0x11')]);}else{logger[_0x2124('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x34aba4,_0x2124('0xc'));_0x53eb0e(_0x4ff2cb[_0x2124('0x12')]['message']);}})[_0x2124('0x13')](function(_0x37ba3d){logger[_0x2124('0xf')](_0x2124('0x10'),_0x34aba4,_0x37ba3d);_0x49e14d(_0x37ba3d);});});} \ No newline at end of file +var _0x6bf2=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x6bf2,0xc9));var _0x26bf=function(_0x492188,_0x15d40b){_0x492188=_0x492188-0x0;var _0x527921=_0x6bf2[_0x492188];return _0x527921;};'use strict';var _=require(_0x26bf('0x0'));var util=require('util');var moment=require(_0x26bf('0x1'));var BPromise=require(_0x26bf('0x2'));var rs=require(_0x26bf('0x3'));var fs=require('fs');var Redis=require(_0x26bf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x26bf('0x5'));var logger=require(_0x26bf('0x6'))(_0x26bf('0x7'));var config=require(_0x26bf('0x8'));var jayson=require(_0x26bf('0x9'));var client=jayson['client'][_0x26bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51bc77,_0x1f3904,_0x542a8b){return new BPromise(function(_0x1174bc,_0x196364){return client[_0x26bf('0xb')](_0x51bc77,_0x542a8b)[_0x26bf('0xc')](function(_0x585596){logger[_0x26bf('0xd')](_0x26bf('0xe'),_0x1f3904,_0x26bf('0xf'));logger[_0x26bf('0x10')](_0x26bf('0x11'),_0x1f3904,_0x26bf('0xf'),JSON[_0x26bf('0x12')](_0x585596));if(_0x585596[_0x26bf('0x13')]){if(_0x585596[_0x26bf('0x13')][_0x26bf('0x14')]===0x1f4){logger[_0x26bf('0x13')](_0x26bf('0xe'),_0x1f3904,_0x585596[_0x26bf('0x13')][_0x26bf('0x15')]);return _0x196364(_0x585596[_0x26bf('0x13')]['message']);}logger[_0x26bf('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1f3904,_0x585596[_0x26bf('0x13')]['message']);return _0x1174bc(_0x585596[_0x26bf('0x13')][_0x26bf('0x15')]);}else{logger['info'](_0x26bf('0xe'),_0x1f3904,_0x26bf('0xf'));_0x1174bc(_0x585596[_0x26bf('0x16')][_0x26bf('0x15')]);}})[_0x26bf('0x17')](function(_0x1df257){logger[_0x26bf('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1f3904,_0x1df257);_0x196364(_0x1df257);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 32557fb..33d1b70 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 _0x7f97=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSugarcrmField.controller','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x7f97,0x7f));var _0x77f9=function(_0x531a83,_0x1afa41){_0x531a83=_0x531a83-0x0;var _0x3a67d6=_0x7f97[_0x531a83];return _0x3a67d6;};'use strict';var multer=require(_0x77f9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x77f9('0x1'));var express=require(_0x77f9('0x2'));var router=express[_0x77f9('0x3')]();var fs_extra=require(_0x77f9('0x4'));var auth=require(_0x77f9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x77f9('0x6'));router['get']('/',auth[_0x77f9('0x7')](),controller[_0x77f9('0x8')]);router['get'](_0x77f9('0x9'),auth['isAuthenticated'](),controller[_0x77f9('0xa')]);router[_0x77f9('0xb')]('/',auth[_0x77f9('0x7')](),controller[_0x77f9('0xc')]);router[_0x77f9('0xd')](_0x77f9('0x9'),auth[_0x77f9('0x7')](),controller['update']);router[_0x77f9('0xe')](_0x77f9('0x9'),auth[_0x77f9('0x7')](),controller['destroy']);module[_0x77f9('0xf')]=router; \ No newline at end of file +var _0xb894=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xb894,0xf0));var _0x4b89=function(_0x40cc2a,_0x39372c){_0x40cc2a=_0x40cc2a-0x0;var _0x5664af=_0xb894[_0x40cc2a];return _0x5664af;};'use strict';var multer=require(_0x4b89('0x0'));var util=require('util');var path=require(_0x4b89('0x1'));var timeout=require(_0x4b89('0x2'));var express=require(_0x4b89('0x3'));var router=express[_0x4b89('0x4')]();var fs_extra=require(_0x4b89('0x5'));var auth=require(_0x4b89('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4b89('0x7'));router[_0x4b89('0x8')]('/',auth[_0x4b89('0x9')](),controller[_0x4b89('0xa')]);router[_0x4b89('0x8')](_0x4b89('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4b89('0xc')]('/',auth[_0x4b89('0x9')](),controller[_0x4b89('0xd')]);router[_0x4b89('0xe')]('/:id',auth[_0x4b89('0x9')](),controller['update']);router[_0x4b89('0xf')]('/:id',auth[_0x4b89('0x9')](),controller[_0x4b89('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 647fee8..b897ba2 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 _0xe14d=['exports','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize'];(function(_0x1d6460,_0x8b24e4){var _0x5400d0=function(_0x54c60f){while(--_0x54c60f){_0x1d6460['push'](_0x1d6460['shift']());}};_0x5400d0(++_0x8b24e4);}(_0xe14d,0x1ee));var _0xde14=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xe14d[_0x397cfb];return _0x15fed9;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'type':{'type':Sequelize[_0xde14('0x2')](_0xde14('0x3'),'variable',_0xde14('0x4'),_0xde14('0x5'),'picklist'),'defaultValue':_0xde14('0x3')},'content':{'type':Sequelize[_0xde14('0x6')]},'key':{'type':Sequelize[_0xde14('0x6')]},'keyType':{'type':Sequelize[_0xde14('0x2')](_0xde14('0x3'),_0xde14('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xde14('0x6')]},'nameField':{'type':Sequelize[_0xde14('0x6')]},'customField':{'type':Sequelize[_0xde14('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde14('0x6')]}}; \ No newline at end of file +var _0xd691=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x2a3b18,_0x33292b){var _0x449ba6=function(_0x53590f){while(--_0x53590f){_0x2a3b18['push'](_0x2a3b18['shift']());}};_0x449ba6(++_0x33292b);}(_0xd691,0xe6));var _0x1d69=function(_0x43c3f9,_0x1861cb){_0x43c3f9=_0x43c3f9-0x0;var _0x4f4f54=_0xd691[_0x43c3f9];return _0x4f4f54;};'use strict';var Sequelize=require(_0x1d69('0x0'));module[_0x1d69('0x1')]={'type':{'type':Sequelize[_0x1d69('0x2')]('string',_0x1d69('0x3'),_0x1d69('0x4'),_0x1d69('0x5'),_0x1d69('0x6')),'defaultValue':_0x1d69('0x7')},'content':{'type':Sequelize[_0x1d69('0x8')]},'key':{'type':Sequelize[_0x1d69('0x8')]},'keyType':{'type':Sequelize[_0x1d69('0x2')](_0x1d69('0x7'),_0x1d69('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1d69('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1d69('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1d69('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 38cc443..aade4b3 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 _0xd404=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x4a48cb,_0x3dd1e1){var _0x58f277=function(_0x140ace){while(--_0x140ace){_0x4a48cb['push'](_0x4a48cb['shift']());}};_0x58f277(++_0x3dd1e1);}(_0xd404,0x15b));var _0x4d40=function(_0xcfa766,_0x2ab0ae){_0xcfa766=_0xcfa766-0x0;var _0x4ff08d=_0xd404[_0xcfa766];return _0x4ff08d;};'use strict';var emlformat=require(_0x4d40('0x0'));var rimraf=require(_0x4d40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d40('0x2'));var rp=require(_0x4d40('0x3'));var moment=require('moment');var BPromise=require(_0x4d40('0x4'));var Mustache=require(_0x4d40('0x5'));var util=require(_0x4d40('0x6'));var path=require(_0x4d40('0x7'));var sox=require(_0x4d40('0x8'));var csv=require(_0x4d40('0x9'));var ejs=require(_0x4d40('0xa'));var fs=require('fs');var fs_extra=require(_0x4d40('0xb'));var _=require(_0x4d40('0xc'));var squel=require('squel');var crypto=require(_0x4d40('0xd'));var jsforce=require(_0x4d40('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d40('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d40('0xf'));var authService=require(_0x4d40('0x10'));var qs=require(_0x4d40('0x11'));var as=require(_0x4d40('0x12'));var hardwareService=require(_0x4d40('0x13'));var logger=require(_0x4d40('0x14'))(_0x4d40('0x15'));var utils=require(_0x4d40('0x16'));var config=require(_0x4d40('0x17'));var licenseUtil=require(_0x4d40('0x18'));var db=require(_0x4d40('0x19'))['db'];function respondWithStatusCode(_0x3c3b7e,_0x28e5bf){_0x28e5bf=_0x28e5bf||0xcc;return function(_0x42a621){if(_0x42a621){return _0x3c3b7e['sendStatus'](_0x28e5bf);}return _0x3c3b7e[_0x4d40('0x1a')](_0x28e5bf)[_0x4d40('0x1b')]();};}function respondWithResult(_0x3b071b,_0x2083bd){_0x2083bd=_0x2083bd||0xc8;return function(_0x477a91){if(_0x477a91){return _0x3b071b['status'](_0x2083bd)[_0x4d40('0x1c')](_0x477a91);}};}function respondWithFilteredResult(_0x4077ce,_0x20bc1b){return function(_0xcee25a){if(_0xcee25a){var _0x453857=typeof _0x20bc1b[_0x4d40('0x1d')]===_0x4d40('0x1e')&&typeof _0x20bc1b[_0x4d40('0x1f')]===_0x4d40('0x1e');var _0x4b5d23=_0xcee25a['count'];var _0x1ae5c7=_0x453857?0x0:_0x20bc1b[_0x4d40('0x1d')];var _0x4e505f=_0x453857?_0xcee25a[_0x4d40('0x20')]:_0x20bc1b[_0x4d40('0x1d')]+_0x20bc1b['limit'];var _0x36d031;if(_0x4e505f>=_0x4b5d23){_0x4e505f=_0x4b5d23;_0x36d031=0xc8;}else{_0x36d031=0xce;}_0x4077ce['status'](_0x36d031);return _0x4077ce[_0x4d40('0x21')](_0x4d40('0x22'),_0x1ae5c7+'-'+_0x4e505f+'/'+_0x4b5d23)['json'](_0xcee25a);}return null;};}function patchUpdates(_0x57c997){return function(_0x375ce0){try{jsonpatch[_0x4d40('0x23')](_0x375ce0,_0x57c997,!![]);}catch(_0x4d52ce){return BPromise[_0x4d40('0x24')](_0x4d52ce);}return _0x375ce0[_0x4d40('0x25')]();};}function saveUpdates(_0x30f058,_0x5d4c24){return function(_0x356fd6){if(_0x356fd6){return _0x356fd6[_0x4d40('0x26')](_0x30f058)[_0x4d40('0x27')](function(_0x5ca0a0){return _0x5ca0a0;});}return null;};}function removeEntity(_0x4eebc3,_0x2df33a){return function(_0x90b652){if(_0x90b652){return _0x90b652[_0x4d40('0x28')]()[_0x4d40('0x27')](function(){_0x4eebc3[_0x4d40('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbcd540,_0x1f5e5b){return function(_0x560df8){if(!_0x560df8){_0xbcd540['sendStatus'](0x194);}return _0x560df8;};}function handleError(_0x274d44,_0x2a0c82){_0x2a0c82=_0x2a0c82||0x1f4;return function(_0x3fa83e){logger[_0x4d40('0x29')](_0x3fa83e[_0x4d40('0x2a')]);if(_0x3fa83e[_0x4d40('0x2b')]){delete _0x3fa83e[_0x4d40('0x2b')];}_0x274d44[_0x4d40('0x1a')](_0x2a0c82)[_0x4d40('0x2c')](_0x3fa83e);};}exports[_0x4d40('0x2d')]=function(_0x1c0fcf,_0x4ca431){var _0x4e4e61={},_0x52f706={},_0x158a86={'count':0x0,'rows':[]};var _0x350488=_[_0x4d40('0x2e')](db[_0x4d40('0x2f')]['rawAttributes'],function(_0x18e601){return{'name':_0x18e601[_0x4d40('0x30')],'type':_0x18e601[_0x4d40('0x31')]['key']};});_0x52f706[_0x4d40('0x32')]=_[_0x4d40('0x2e')](_0x350488,_0x4d40('0x2b'));_0x52f706[_0x4d40('0x33')]=_[_0x4d40('0x34')](_0x1c0fcf['query']);_0x52f706[_0x4d40('0x35')]=_['intersection'](_0x52f706[_0x4d40('0x32')],_0x52f706[_0x4d40('0x33')]);_0x4e4e61[_0x4d40('0x36')]=_[_0x4d40('0x37')](_0x52f706['model'],qs['fields'](_0x1c0fcf[_0x4d40('0x33')][_0x4d40('0x38')]));_0x4e4e61[_0x4d40('0x36')]=_0x4e4e61[_0x4d40('0x36')]['length']?_0x4e4e61[_0x4d40('0x36')]:_0x52f706['model'];if(!_0x1c0fcf[_0x4d40('0x33')][_0x4d40('0x39')](_0x4d40('0x3a'))){_0x4e4e61[_0x4d40('0x1f')]=qs[_0x4d40('0x1f')](_0x1c0fcf[_0x4d40('0x33')][_0x4d40('0x1f')]);_0x4e4e61[_0x4d40('0x1d')]=qs[_0x4d40('0x1d')](_0x1c0fcf[_0x4d40('0x33')]['offset']);}_0x4e4e61[_0x4d40('0x3b')]=qs[_0x4d40('0x3c')](_0x1c0fcf['query']['sort']);_0x4e4e61['where']=qs[_0x4d40('0x35')](_[_0x4d40('0x3d')](_0x1c0fcf['query'],_0x52f706[_0x4d40('0x35')]),_0x350488);if(_0x1c0fcf[_0x4d40('0x33')][_0x4d40('0x3e')]){_0x4e4e61[_0x4d40('0x3f')]=_[_0x4d40('0x40')](_0x4e4e61['where'],{'$or':_[_0x4d40('0x2e')](_0x350488,function(_0x21a4ec){if(_0x21a4ec['type']!=='VIRTUAL'){var _0x3a4924={};_0x3a4924[_0x21a4ec[_0x4d40('0x2b')]]={'$like':'%'+_0x1c0fcf['query'][_0x4d40('0x3e')]+'%'};return _0x3a4924;}})});}_0x4e4e61=_[_0x4d40('0x40')]({},_0x4e4e61,_0x1c0fcf['options']);var _0x1e8427={'where':_0x4e4e61[_0x4d40('0x3f')]};return db['SugarcrmField'][_0x4d40('0x20')](_0x1e8427)[_0x4d40('0x27')](function(_0x4841ac){_0x158a86[_0x4d40('0x20')]=_0x4841ac;if(_0x1c0fcf['query'][_0x4d40('0x41')]){_0x4e4e61[_0x4d40('0x42')]=[{'all':!![]}];}return db[_0x4d40('0x2f')][_0x4d40('0x43')](_0x4e4e61);})[_0x4d40('0x27')](function(_0x2ef0ca){_0x158a86[_0x4d40('0x44')]=_0x2ef0ca;return _0x158a86;})[_0x4d40('0x27')](respondWithFilteredResult(_0x4ca431,_0x4e4e61))[_0x4d40('0x45')](handleError(_0x4ca431,null));};exports['show']=function(_0x250847,_0x3718a8){var _0x1c2fa8={'raw':!![],'where':{'id':_0x250847[_0x4d40('0x46')]['id']}},_0xcdde22={};_0xcdde22['model']=_[_0x4d40('0x34')](db['SugarcrmField'][_0x4d40('0x47')]);_0xcdde22[_0x4d40('0x33')]=_[_0x4d40('0x34')](_0x250847[_0x4d40('0x33')]);_0xcdde22['filters']=_[_0x4d40('0x37')](_0xcdde22[_0x4d40('0x32')],_0xcdde22['query']);_0x1c2fa8[_0x4d40('0x36')]=_['intersection'](_0xcdde22[_0x4d40('0x32')],qs[_0x4d40('0x38')](_0x250847[_0x4d40('0x33')][_0x4d40('0x38')]));_0x1c2fa8['attributes']=_0x1c2fa8[_0x4d40('0x36')]['length']?_0x1c2fa8[_0x4d40('0x36')]:_0xcdde22[_0x4d40('0x32')];if(_0x250847[_0x4d40('0x33')][_0x4d40('0x41')]){_0x1c2fa8['include']=[{'all':!![]}];}_0x1c2fa8=_[_0x4d40('0x40')]({},_0x1c2fa8,_0x250847[_0x4d40('0x48')]);return db[_0x4d40('0x2f')][_0x4d40('0x49')](_0x1c2fa8)['then'](handleEntityNotFound(_0x3718a8,null))[_0x4d40('0x27')](respondWithResult(_0x3718a8,null))[_0x4d40('0x45')](handleError(_0x3718a8,null));};exports['create']=function(_0x200d29,_0x493d8e){return db[_0x4d40('0x2f')][_0x4d40('0x4a')](_0x200d29[_0x4d40('0x4b')],{})[_0x4d40('0x27')](respondWithResult(_0x493d8e,0xc9))[_0x4d40('0x45')](handleError(_0x493d8e,null));};exports[_0x4d40('0x26')]=function(_0x30be7b,_0x37b6bf){if(_0x30be7b[_0x4d40('0x4b')]['id']){delete _0x30be7b['body']['id'];}return db[_0x4d40('0x2f')][_0x4d40('0x49')]({'where':{'id':_0x30be7b[_0x4d40('0x46')]['id']}})[_0x4d40('0x27')](handleEntityNotFound(_0x37b6bf,null))[_0x4d40('0x27')](saveUpdates(_0x30be7b['body'],null))[_0x4d40('0x27')](respondWithResult(_0x37b6bf,null))[_0x4d40('0x45')](handleError(_0x37b6bf,null));};exports['destroy']=function(_0xdf0235,_0x48ffd7){return db[_0x4d40('0x2f')][_0x4d40('0x49')]({'where':{'id':_0xdf0235[_0x4d40('0x46')]['id']}})['then'](handleEntityNotFound(_0x48ffd7,null))[_0x4d40('0x27')](removeEntity(_0x48ffd7,null))[_0x4d40('0x45')](handleError(_0x48ffd7,null));}; \ No newline at end of file +var _0x2356=['rimraf','zip-dir','moment','bluebird','path','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','json','reject','save','destroy','then','name','send','index','map','SugarcrmField','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','merge','where','type','VIRTUAL','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','options','find','create','body','update'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x2356,0x14f));var _0x6235=function(_0x358f97,_0x2471e7){_0x358f97=_0x358f97-0x0;var _0x253cf3=_0x2356[_0x358f97];return _0x253cf3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6235('0x0'));var zipdir=require(_0x6235('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6235('0x2'));var BPromise=require(_0x6235('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6235('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6235('0x5'));var fs=require('fs');var fs_extra=require(_0x6235('0x6'));var _=require(_0x6235('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6235('0x8'));var toCsv=require('to-csv');var querystring=require(_0x6235('0x9'));var Papa=require(_0x6235('0xa'));var Redis=require(_0x6235('0xb'));var authService=require(_0x6235('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x6235('0xd'));var hardwareService=require(_0x6235('0xe'));var logger=require(_0x6235('0xf'))(_0x6235('0x10'));var utils=require(_0x6235('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x6235('0x12'));var db=require(_0x6235('0x13'))['db'];function respondWithStatusCode(_0x1303e7,_0x6c422b){_0x6c422b=_0x6c422b||0xcc;return function(_0x48df2d){if(_0x48df2d){return _0x1303e7[_0x6235('0x14')](_0x6c422b);}return _0x1303e7[_0x6235('0x15')](_0x6c422b)['end']();};}function respondWithResult(_0x3f5b7d,_0x48e3a7){_0x48e3a7=_0x48e3a7||0xc8;return function(_0x35156f){if(_0x35156f){return _0x3f5b7d[_0x6235('0x15')](_0x48e3a7)['json'](_0x35156f);}};}function respondWithFilteredResult(_0x1cfd0b,_0x1f1c54){return function(_0x3f619b){if(_0x3f619b){var _0x3f32af=typeof _0x1f1c54['offset']===_0x6235('0x16')&&typeof _0x1f1c54[_0x6235('0x17')]===_0x6235('0x16');var _0x2e5a84=_0x3f619b[_0x6235('0x18')];var _0x2a3554=_0x3f32af?0x0:_0x1f1c54[_0x6235('0x19')];var _0x22f090=_0x3f32af?_0x3f619b[_0x6235('0x18')]:_0x1f1c54[_0x6235('0x19')]+_0x1f1c54['limit'];var _0x35103a;if(_0x22f090>=_0x2e5a84){_0x22f090=_0x2e5a84;_0x35103a=0xc8;}else{_0x35103a=0xce;}_0x1cfd0b[_0x6235('0x15')](_0x35103a);return _0x1cfd0b['set']('Content-Range',_0x2a3554+'-'+_0x22f090+'/'+_0x2e5a84)[_0x6235('0x1a')](_0x3f619b);}return null;};}function patchUpdates(_0x4f0aa2){return function(_0x5d3872){try{jsonpatch['apply'](_0x5d3872,_0x4f0aa2,!![]);}catch(_0x367207){return BPromise[_0x6235('0x1b')](_0x367207);}return _0x5d3872[_0x6235('0x1c')]();};}function saveUpdates(_0x1c60c7,_0x24c057){return function(_0x270c49){if(_0x270c49){return _0x270c49['update'](_0x1c60c7)['then'](function(_0x4663b3){return _0x4663b3;});}return null;};}function removeEntity(_0x5ac43d,_0x2189d0){return function(_0x1bed65){if(_0x1bed65){return _0x1bed65[_0x6235('0x1d')]()[_0x6235('0x1e')](function(){_0x5ac43d[_0x6235('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e3d90,_0x1da380){return function(_0x168b01){if(!_0x168b01){_0x1e3d90[_0x6235('0x14')](0x194);}return _0x168b01;};}function handleError(_0x3eac45,_0x5a58d9){_0x5a58d9=_0x5a58d9||0x1f4;return function(_0x4b44f8){logger['error'](_0x4b44f8['stack']);if(_0x4b44f8[_0x6235('0x1f')]){delete _0x4b44f8[_0x6235('0x1f')];}_0x3eac45[_0x6235('0x15')](_0x5a58d9)[_0x6235('0x20')](_0x4b44f8);};}exports[_0x6235('0x21')]=function(_0x2acc8c,_0x59bb16){var _0x47e86b={},_0x5dc066={},_0x94db3c={'count':0x0,'rows':[]};var _0x50ea93=_[_0x6235('0x22')](db[_0x6235('0x23')]['rawAttributes'],function(_0x37580b){return{'name':_0x37580b[_0x6235('0x24')],'type':_0x37580b['type'][_0x6235('0x25')]};});_0x5dc066[_0x6235('0x26')]=_[_0x6235('0x22')](_0x50ea93,_0x6235('0x1f'));_0x5dc066[_0x6235('0x27')]=_[_0x6235('0x28')](_0x2acc8c[_0x6235('0x27')]);_0x5dc066[_0x6235('0x29')]=_[_0x6235('0x2a')](_0x5dc066[_0x6235('0x26')],_0x5dc066['query']);_0x47e86b[_0x6235('0x2b')]=_['intersection'](_0x5dc066['model'],qs[_0x6235('0x2c')](_0x2acc8c['query']['fields']));_0x47e86b[_0x6235('0x2b')]=_0x47e86b['attributes']['length']?_0x47e86b[_0x6235('0x2b')]:_0x5dc066[_0x6235('0x26')];if(!_0x2acc8c[_0x6235('0x27')]['hasOwnProperty'](_0x6235('0x2d'))){_0x47e86b[_0x6235('0x17')]=qs[_0x6235('0x17')](_0x2acc8c['query'][_0x6235('0x17')]);_0x47e86b['offset']=qs[_0x6235('0x19')](_0x2acc8c[_0x6235('0x27')][_0x6235('0x19')]);}_0x47e86b[_0x6235('0x2e')]=qs[_0x6235('0x2f')](_0x2acc8c['query'][_0x6235('0x2f')]);_0x47e86b['where']=qs[_0x6235('0x29')](_[_0x6235('0x30')](_0x2acc8c[_0x6235('0x27')],_0x5dc066[_0x6235('0x29')]),_0x50ea93);if(_0x2acc8c[_0x6235('0x27')]['filter']){_0x47e86b['where']=_[_0x6235('0x31')](_0x47e86b[_0x6235('0x32')],{'$or':_[_0x6235('0x22')](_0x50ea93,function(_0x41cdc2){if(_0x41cdc2[_0x6235('0x33')]!==_0x6235('0x34')){var _0xe277d0={};_0xe277d0[_0x41cdc2[_0x6235('0x1f')]]={'$like':'%'+_0x2acc8c[_0x6235('0x27')][_0x6235('0x35')]+'%'};return _0xe277d0;}})});}_0x47e86b=_['merge']({},_0x47e86b,_0x2acc8c['options']);var _0x4d1cac={'where':_0x47e86b['where']};return db['SugarcrmField'][_0x6235('0x18')](_0x4d1cac)[_0x6235('0x1e')](function(_0x290da6){_0x94db3c['count']=_0x290da6;if(_0x2acc8c[_0x6235('0x27')]['includeAll']){_0x47e86b[_0x6235('0x36')]=[{'all':!![]}];}return db[_0x6235('0x23')][_0x6235('0x37')](_0x47e86b);})[_0x6235('0x1e')](function(_0x36abb1){_0x94db3c[_0x6235('0x38')]=_0x36abb1;return _0x94db3c;})[_0x6235('0x1e')](respondWithFilteredResult(_0x59bb16,_0x47e86b))[_0x6235('0x39')](handleError(_0x59bb16,null));};exports['show']=function(_0x565c9f,_0x341fdc){var _0x54cbb1={'raw':!![],'where':{'id':_0x565c9f[_0x6235('0x3a')]['id']}},_0x173c62={};_0x173c62[_0x6235('0x26')]=_[_0x6235('0x28')](db[_0x6235('0x23')][_0x6235('0x3b')]);_0x173c62[_0x6235('0x27')]=_['keys'](_0x565c9f[_0x6235('0x27')]);_0x173c62[_0x6235('0x29')]=_[_0x6235('0x2a')](_0x173c62['model'],_0x173c62[_0x6235('0x27')]);_0x54cbb1[_0x6235('0x2b')]=_[_0x6235('0x2a')](_0x173c62[_0x6235('0x26')],qs[_0x6235('0x2c')](_0x565c9f[_0x6235('0x27')][_0x6235('0x2c')]));_0x54cbb1[_0x6235('0x2b')]=_0x54cbb1['attributes'][_0x6235('0x3c')]?_0x54cbb1[_0x6235('0x2b')]:_0x173c62[_0x6235('0x26')];if(_0x565c9f['query'][_0x6235('0x3d')]){_0x54cbb1[_0x6235('0x36')]=[{'all':!![]}];}_0x54cbb1=_[_0x6235('0x31')]({},_0x54cbb1,_0x565c9f[_0x6235('0x3e')]);return db[_0x6235('0x23')][_0x6235('0x3f')](_0x54cbb1)[_0x6235('0x1e')](handleEntityNotFound(_0x341fdc,null))[_0x6235('0x1e')](respondWithResult(_0x341fdc,null))[_0x6235('0x39')](handleError(_0x341fdc,null));};exports['create']=function(_0x148a78,_0x4f30c4){return db[_0x6235('0x23')][_0x6235('0x40')](_0x148a78[_0x6235('0x41')],{})['then'](respondWithResult(_0x4f30c4,0xc9))['catch'](handleError(_0x4f30c4,null));};exports[_0x6235('0x42')]=function(_0x433263,_0x4468d4){if(_0x433263[_0x6235('0x41')]['id']){delete _0x433263['body']['id'];}return db[_0x6235('0x23')][_0x6235('0x3f')]({'where':{'id':_0x433263['params']['id']}})[_0x6235('0x1e')](handleEntityNotFound(_0x4468d4,null))['then'](saveUpdates(_0x433263[_0x6235('0x41')],null))[_0x6235('0x1e')](respondWithResult(_0x4468d4,null))[_0x6235('0x39')](handleError(_0x4468d4,null));};exports['destroy']=function(_0x2aa5f9,_0x5bff03){return db['SugarcrmField']['find']({'where':{'id':_0x2aa5f9[_0x6235('0x3a')]['id']}})[_0x6235('0x1e')](handleEntityNotFound(_0x5bff03,null))[_0x6235('0x1e')](removeEntity(_0x5bff03,null))[_0x6235('0x39')](handleError(_0x5bff03,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 2e06795..3c817e3 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 _0x31f5=['sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x31f5,0xe3));var _0x531f=function(_0x1e53e5,_0x186c08){_0x1e53e5=_0x1e53e5-0x0;var _0x185457=_0x31f5[_0x1e53e5];return _0x185457;};'use strict';var _=require(_0x531f('0x0'));var util=require(_0x531f('0x1'));var logger=require(_0x531f('0x2'))(_0x531f('0x3'));var moment=require(_0x531f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x531f('0x5'));var rimraf=require(_0x531f('0x6'));var config=require(_0x531f('0x7'));var attributes=require(_0x531f('0x8'));module[_0x531f('0x9')]=function(_0x4bfd64,_0x317a1c){return _0x4bfd64[_0x531f('0xa')](_0x531f('0xb'),attributes,{'tableName':_0x531f('0xc'),'paranoid':![],'indexes':[{'name':_0x531f('0xd'),'fields':[_0x531f('0xe'),_0x531f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd928=['moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0xd928,0xc0));var _0x8d92=function(_0x1a84ec,_0x1d4b95){_0x1a84ec=_0x1a84ec-0x0;var _0x4d346d=_0xd928[_0x1a84ec];return _0x4d346d;};'use strict';var _=require(_0x8d92('0x0'));var util=require(_0x8d92('0x1'));var logger=require(_0x8d92('0x2'))('api');var moment=require(_0x8d92('0x3'));var BPromise=require('bluebird');var rp=require(_0x8d92('0x4'));var fs=require('fs');var path=require(_0x8d92('0x5'));var rimraf=require(_0x8d92('0x6'));var config=require(_0x8d92('0x7'));var attributes=require(_0x8d92('0x8'));module[_0x8d92('0x9')]=function(_0x33e9bb,_0x11e73a){return _0x33e9bb[_0x8d92('0xa')]('SugarcrmField',attributes,{'tableName':_0x8d92('0xb'),'paranoid':![],'indexes':[{'name':_0x8d92('0xc'),'fields':[_0x8d92('0xd'),_0x8d92('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 19fa039..c24637f 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 _0x0b0e=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x11d95f,_0x34f442){_0x11d95f=_0x11d95f-0x0;var _0x2b1a14=_0x0b0e[_0x11d95f];return _0x2b1a14;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8603,0x190));var _0x3860=function(_0x5e1fa4,_0x3b7ce6){_0x5e1fa4=_0x5e1fa4-0x0;var _0x2eb49a=_0x8603[_0x5e1fa4];return _0x2eb49a;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 8a960e8..3068b81 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 _0x5573=['isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get'];(function(_0x63811b,_0x56e665){var _0x8ffb7=function(_0x1e130e){while(--_0x1e130e){_0x63811b['push'](_0x63811b['shift']());}};_0x8ffb7(++_0x56e665);}(_0x5573,0x9e));var _0x3557=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0x5573[_0x419550];return _0x55f9ef;};'use strict';var multer=require(_0x3557('0x0'));var util=require('util');var path=require(_0x3557('0x1'));var timeout=require(_0x3557('0x2'));var express=require(_0x3557('0x3'));var router=express[_0x3557('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3557('0x5'));var interaction=require(_0x3557('0x6'));var config=require(_0x3557('0x7'));var controller=require(_0x3557('0x8'));router[_0x3557('0x9')]('/',auth[_0x3557('0xa')](),controller[_0x3557('0xb')]);router[_0x3557('0x9')]('/:id',auth[_0x3557('0xa')](),controller[_0x3557('0xc')]);router['get'](_0x3557('0xd'),auth['isAuthenticated'](),controller[_0x3557('0xe')]);router[_0x3557('0x9')](_0x3557('0xf'),auth['isAuthenticated'](),controller[_0x3557('0x10')]);router[_0x3557('0x11')]('/',auth[_0x3557('0xa')](),controller['create']);router['post'](_0x3557('0xd'),auth[_0x3557('0xa')](),controller[_0x3557('0x12')]);router[_0x3557('0x13')](_0x3557('0x14'),auth[_0x3557('0xa')](),controller[_0x3557('0x15')]);router[_0x3557('0x16')](_0x3557('0x14'),auth[_0x3557('0xa')](),controller[_0x3557('0x17')]);module['exports']=router; \ No newline at end of file +var _0x237f=['/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get'];(function(_0x5a3570,_0xdcd258){var _0x46a33a=function(_0xbd35a0){while(--_0xbd35a0){_0x5a3570['push'](_0x5a3570['shift']());}};_0x46a33a(++_0xdcd258);}(_0x237f,0x1ef));var _0xf237=function(_0x340c13,_0x595d66){_0x340c13=_0x340c13-0x0;var _0x5a7d96=_0x237f[_0x340c13];return _0x5a7d96;};'use strict';var multer=require(_0xf237('0x0'));var util=require('util');var path=require(_0xf237('0x1'));var timeout=require(_0xf237('0x2'));var express=require(_0xf237('0x3'));var router=express[_0xf237('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf237('0x5'));var interaction=require(_0xf237('0x6'));var config=require('../../config/environment');var controller=require(_0xf237('0x7'));router[_0xf237('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf237('0x9'),auth[_0xf237('0xa')](),controller[_0xf237('0xb')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xf237('0xc')]);router[_0xf237('0x8')](_0xf237('0xd'),auth[_0xf237('0xa')](),controller[_0xf237('0xe')]);router[_0xf237('0xf')]('/',auth['isAuthenticated'](),controller[_0xf237('0x10')]);router[_0xf237('0xf')](_0xf237('0x11'),auth['isAuthenticated'](),controller[_0xf237('0x12')]);router[_0xf237('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf237('0x14')]);router[_0xf237('0x15')](_0xf237('0x9'),auth['isAuthenticated'](),controller[_0xf237('0x16')]);module[_0xf237('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 423855d..516a467 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 _0x8bbf=['sequelize','exports','STRING','HelpDesk'];(function(_0x3bdb8d,_0xc7c152){var _0x2c44b6=function(_0x14df10){while(--_0x14df10){_0x3bdb8d['push'](_0x3bdb8d['shift']());}};_0x2c44b6(++_0xc7c152);}(_0x8bbf,0x184));var _0xf8bb=function(_0x26579d,_0x279e17){_0x26579d=_0x26579d-0x0;var _0x33b6a1=_0x8bbf[_0x26579d];return _0x33b6a1;};'use strict';var Sequelize=require(_0xf8bb('0x0'));module[_0xf8bb('0x1')]={'name':{'type':Sequelize[_0xf8bb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf8bb('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf8bb('0x3')},'remoteUri':{'type':Sequelize[_0xf8bb('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf8bb('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xf8bb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfdb3=['sequelize','exports','STRING','HelpDesk'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x6306d5,_0xbaeaaf){_0x6306d5=_0x6306d5-0x0;var _0x559042=_0xfdb3[_0x6306d5];return _0x559042;};'use strict';var Sequelize=require(_0x3fdb('0x0'));module[_0x3fdb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3fdb('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3fdb('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3fdb('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3fdb('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 49666bc..5064c20 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 _0xda3f=['http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','intersection','find','create','body','update','params','getConfigurations','findOne','VtigerConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','POST','token','sessionName','success','autogenerated','reference','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','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','jayson/promise'];(function(_0x1381e8,_0x45da1d){var _0x333a68=function(_0x99c57e){while(--_0x99c57e){_0x1381e8['push'](_0x1381e8['shift']());}};_0x333a68(++_0x45da1d);}(_0xda3f,0xec));var _0xfda3=function(_0x8e7ae4,_0x9d9f23){_0x8e7ae4=_0x8e7ae4-0x0;var _0x26359c=_0xda3f[_0x8e7ae4];return _0x26359c;};'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'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xfda3('0x17'));var client=jayson['client'][_0xfda3('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1e7a55,_0x4929fa,_0x501588,_0x587e9b){return new BPromise(function(_0x227d72,_0x477fc0){var _0x5ea793=_0x587e9b||client;return _0x5ea793['request'](_0x1e7a55,_0x501588)['then'](function(_0x80ea80){logger[_0xfda3('0x19')](_0xfda3('0x1a'),_0x4929fa,_0xfda3('0x1b'));logger[_0xfda3('0x1c')](_0xfda3('0x1d'),_0x4929fa,_0xfda3('0x1b'),JSON[_0xfda3('0x1e')](_0x80ea80));if(_0x80ea80[_0xfda3('0x1f')]){if(_0x80ea80[_0xfda3('0x1f')]['code']===0x1f4){logger[_0xfda3('0x1f')](_0xfda3('0x1a'),_0x4929fa,_0x80ea80[_0xfda3('0x1f')][_0xfda3('0x20')]);return _0x477fc0(_0x80ea80['error'][_0xfda3('0x20')]);}logger[_0xfda3('0x1f')](_0xfda3('0x1a'),_0x4929fa,_0x80ea80['error']['message']);return _0x227d72(_0x80ea80[_0xfda3('0x1f')][_0xfda3('0x20')]);}else{logger[_0xfda3('0x19')]('VtigerAccount,\x20%s,\x20%s',_0x4929fa,_0xfda3('0x1b'));_0x227d72(_0x80ea80[_0xfda3('0x21')][_0xfda3('0x20')]);}})[_0xfda3('0x22')](function(_0xfb4ee9){logger[_0xfda3('0x1f')](_0xfda3('0x1a'),_0x4929fa,_0xfb4ee9);_0x477fc0(_0xfb4ee9);});});}function respondWithStatusCode(_0xc6fb9a,_0x16eaa6){_0x16eaa6=_0x16eaa6||0xcc;return function(_0x5499f5){if(_0x5499f5){return _0xc6fb9a[_0xfda3('0x23')](_0x16eaa6);}return _0xc6fb9a[_0xfda3('0x24')](_0x16eaa6)[_0xfda3('0x25')]();};}function respondWithResult(_0x4ae9b9,_0x45a977){_0x45a977=_0x45a977||0xc8;return function(_0x39e246){if(_0x39e246){return _0x4ae9b9[_0xfda3('0x24')](_0x45a977)[_0xfda3('0x26')](_0x39e246);}};}function respondWithFilteredResult(_0x1cb831,_0xad9f7b){return function(_0x514d2a){if(_0x514d2a){var _0x3c6d7d=typeof _0xad9f7b[_0xfda3('0x27')]===_0xfda3('0x28')&&typeof _0xad9f7b[_0xfda3('0x29')]===_0xfda3('0x28');var _0x5704c7=_0x514d2a[_0xfda3('0x2a')];var _0x4101b1=_0x3c6d7d?0x0:_0xad9f7b[_0xfda3('0x27')];var _0x474992=_0x3c6d7d?_0x514d2a[_0xfda3('0x2a')]:_0xad9f7b[_0xfda3('0x27')]+_0xad9f7b[_0xfda3('0x29')];var _0x538902;if(_0x474992>=_0x5704c7){_0x474992=_0x5704c7;_0x538902=0xc8;}else{_0x538902=0xce;}_0x1cb831['status'](_0x538902);return _0x1cb831[_0xfda3('0x2b')]('Content-Range',_0x4101b1+'-'+_0x474992+'/'+_0x5704c7)['json'](_0x514d2a);}return null;};}function patchUpdates(_0x16b4a2){return function(_0x2a5971){try{jsonpatch[_0xfda3('0x2c')](_0x2a5971,_0x16b4a2,!![]);}catch(_0xd7e1d6){return BPromise[_0xfda3('0x2d')](_0xd7e1d6);}return _0x2a5971[_0xfda3('0x2e')]();};}function saveUpdates(_0x404531,_0xd6b6d7){return function(_0x261a81){if(_0x261a81){return _0x261a81['update'](_0x404531)[_0xfda3('0x2f')](function(_0x43b063){return _0x43b063;});}return null;};}function removeEntity(_0xacc8c,_0x227357){return function(_0x2b64a1){if(_0x2b64a1){return _0x2b64a1[_0xfda3('0x30')]()[_0xfda3('0x2f')](function(){_0xacc8c[_0xfda3('0x24')](0xcc)[_0xfda3('0x25')]();});}};}function handleEntityNotFound(_0x59a1c9,_0x51ecde){return function(_0x30e63e){if(!_0x30e63e){_0x59a1c9[_0xfda3('0x23')](0x194);}return _0x30e63e;};}function handleError(_0x58f805,_0x1ac6f2){_0x1ac6f2=_0x1ac6f2||0x1f4;return function(_0xc861d2){logger[_0xfda3('0x1f')](_0xc861d2['stack']);if(_0xc861d2[_0xfda3('0x31')]){delete _0xc861d2[_0xfda3('0x31')];}_0x58f805[_0xfda3('0x24')](_0x1ac6f2)[_0xfda3('0x32')](_0xc861d2);};}exports[_0xfda3('0x33')]=function(_0x5ae650,_0xc6dd4e){var _0x2d2043={},_0x33bdfb={},_0x56bed2={'count':0x0,'rows':[]};var _0x373c96=_['map'](db[_0xfda3('0x34')][_0xfda3('0x35')],function(_0x43a58a){return{'name':_0x43a58a[_0xfda3('0x36')],'type':_0x43a58a[_0xfda3('0x37')][_0xfda3('0x38')]};});_0x33bdfb[_0xfda3('0x39')]=_[_0xfda3('0x3a')](_0x373c96,'name');_0x33bdfb[_0xfda3('0x3b')]=_[_0xfda3('0x3c')](_0x5ae650[_0xfda3('0x3b')]);_0x33bdfb[_0xfda3('0x3d')]=_['intersection'](_0x33bdfb[_0xfda3('0x39')],_0x33bdfb[_0xfda3('0x3b')]);_0x2d2043[_0xfda3('0x3e')]=_['intersection'](_0x33bdfb['model'],qs[_0xfda3('0x3f')](_0x5ae650[_0xfda3('0x3b')][_0xfda3('0x3f')]));_0x2d2043[_0xfda3('0x3e')]=_0x2d2043[_0xfda3('0x3e')][_0xfda3('0x40')]?_0x2d2043[_0xfda3('0x3e')]:_0x33bdfb[_0xfda3('0x39')];if(!_0x5ae650[_0xfda3('0x3b')][_0xfda3('0x41')]('nolimit')){_0x2d2043[_0xfda3('0x29')]=qs[_0xfda3('0x29')](_0x5ae650['query'][_0xfda3('0x29')]);_0x2d2043['offset']=qs['offset'](_0x5ae650['query'][_0xfda3('0x27')]);}_0x2d2043[_0xfda3('0x42')]=qs[_0xfda3('0x43')](_0x5ae650[_0xfda3('0x3b')]['sort']);_0x2d2043[_0xfda3('0x44')]=qs[_0xfda3('0x3d')](_[_0xfda3('0x45')](_0x5ae650[_0xfda3('0x3b')],_0x33bdfb['filters']),_0x373c96);if(_0x5ae650[_0xfda3('0x3b')][_0xfda3('0x46')]){_0x2d2043[_0xfda3('0x44')]=_['merge'](_0x2d2043['where'],{'$or':_[_0xfda3('0x3a')](_0x373c96,function(_0xb3a539){if(_0xb3a539[_0xfda3('0x37')]!==_0xfda3('0x47')){var _0x2a854a={};_0x2a854a[_0xb3a539[_0xfda3('0x31')]]={'$like':'%'+_0x5ae650[_0xfda3('0x3b')][_0xfda3('0x46')]+'%'};return _0x2a854a;}})});}_0x2d2043=_[_0xfda3('0x48')]({},_0x2d2043,_0x5ae650[_0xfda3('0x49')]);var _0x1749f7={'where':_0x2d2043[_0xfda3('0x44')]};return db[_0xfda3('0x34')][_0xfda3('0x2a')](_0x1749f7)['then'](function(_0x4a0cbd){_0x56bed2[_0xfda3('0x2a')]=_0x4a0cbd;if(_0x5ae650[_0xfda3('0x3b')][_0xfda3('0x4a')]){_0x2d2043[_0xfda3('0x4b')]=[{'all':!![]}];}return db[_0xfda3('0x34')][_0xfda3('0x4c')](_0x2d2043);})[_0xfda3('0x2f')](function(_0x125f5a){_0x56bed2[_0xfda3('0x4d')]=_0x125f5a;return _0x56bed2;})[_0xfda3('0x2f')](respondWithFilteredResult(_0xc6dd4e,_0x2d2043))['catch'](handleError(_0xc6dd4e,null));};exports[_0xfda3('0x4e')]=function(_0x442cf8,_0x481356){var _0x36aa3a={'raw':![],'where':{'id':_0x442cf8['params']['id']}},_0x26496a={};_0x26496a[_0xfda3('0x39')]=_[_0xfda3('0x3c')](db[_0xfda3('0x34')]['rawAttributes']);_0x26496a[_0xfda3('0x3b')]=_[_0xfda3('0x3c')](_0x442cf8[_0xfda3('0x3b')]);_0x26496a['filters']=_[_0xfda3('0x4f')](_0x26496a[_0xfda3('0x39')],_0x26496a[_0xfda3('0x3b')]);_0x36aa3a[_0xfda3('0x3e')]=_[_0xfda3('0x4f')](_0x26496a['model'],qs[_0xfda3('0x3f')](_0x442cf8['query'][_0xfda3('0x3f')]));_0x36aa3a['attributes']=_0x36aa3a[_0xfda3('0x3e')][_0xfda3('0x40')]?_0x36aa3a[_0xfda3('0x3e')]:_0x26496a[_0xfda3('0x39')];if(_0x442cf8['query'][_0xfda3('0x4a')]){_0x36aa3a[_0xfda3('0x4b')]=[{'all':!![]}];}_0x36aa3a=_[_0xfda3('0x48')]({},_0x36aa3a,_0x442cf8[_0xfda3('0x49')]);return db[_0xfda3('0x34')][_0xfda3('0x50')](_0x36aa3a)[_0xfda3('0x2f')](handleEntityNotFound(_0x481356,null))['then'](respondWithResult(_0x481356,null))['catch'](handleError(_0x481356,null));};exports[_0xfda3('0x51')]=function(_0x27d7f9,_0x218ee5){return db['VtigerAccount']['create'](_0x27d7f9[_0xfda3('0x52')],{})[_0xfda3('0x2f')](respondWithResult(_0x218ee5,0xc9))[_0xfda3('0x22')](handleError(_0x218ee5,null));};exports[_0xfda3('0x53')]=function(_0x2fcbe7,_0x4bc976){if(_0x2fcbe7[_0xfda3('0x52')]['id']){delete _0x2fcbe7[_0xfda3('0x52')]['id'];}return db[_0xfda3('0x34')][_0xfda3('0x50')]({'where':{'id':_0x2fcbe7[_0xfda3('0x54')]['id']}})[_0xfda3('0x2f')](handleEntityNotFound(_0x4bc976,null))[_0xfda3('0x2f')](saveUpdates(_0x2fcbe7[_0xfda3('0x52')],null))[_0xfda3('0x2f')](respondWithResult(_0x4bc976,null))[_0xfda3('0x22')](handleError(_0x4bc976,null));};exports[_0xfda3('0x30')]=function(_0x1fa27a,_0x5b426b){return db[_0xfda3('0x34')][_0xfda3('0x50')]({'where':{'id':_0x1fa27a[_0xfda3('0x54')]['id']}})[_0xfda3('0x2f')](handleEntityNotFound(_0x5b426b,null))[_0xfda3('0x2f')](removeEntity(_0x5b426b,null))[_0xfda3('0x22')](handleError(_0x5b426b,null));};exports[_0xfda3('0x55')]=function(_0x4ce31c,_0x5a3a6f,_0x1401d8){var _0x35178a={};var _0x486e55={};var _0x29d503;var _0x178b06;return db[_0xfda3('0x34')][_0xfda3('0x56')]({'where':{'id':_0x4ce31c['params']['id']}})['then'](handleEntityNotFound(_0x5a3a6f,null))[_0xfda3('0x2f')](function(_0x34b8f7){if(_0x34b8f7){_0x29d503=_0x34b8f7;_0x486e55[_0xfda3('0x39')]=_['keys'](db[_0xfda3('0x57')]['rawAttributes']);_0x486e55[_0xfda3('0x3b')]=_[_0xfda3('0x3c')](_0x4ce31c[_0xfda3('0x3b')]);_0x486e55[_0xfda3('0x3d')]=_[_0xfda3('0x4f')](_0x486e55[_0xfda3('0x39')],_0x486e55['query']);_0x35178a[_0xfda3('0x3e')]=_[_0xfda3('0x4f')](_0x486e55[_0xfda3('0x39')],qs[_0xfda3('0x3f')](_0x4ce31c[_0xfda3('0x3b')]['fields']));_0x35178a['attributes']=_0x35178a[_0xfda3('0x3e')][_0xfda3('0x40')]?_0x35178a['attributes']:_0x486e55['model'];_0x35178a['order']=qs[_0xfda3('0x43')](_0x4ce31c[_0xfda3('0x3b')]['sort']);_0x35178a[_0xfda3('0x44')]=qs[_0xfda3('0x3d')](_[_0xfda3('0x45')](_0x4ce31c[_0xfda3('0x3b')],_0x486e55['filters']));if(_0x4ce31c[_0xfda3('0x3b')][_0xfda3('0x46')]){_0x35178a[_0xfda3('0x44')]=_[_0xfda3('0x48')](_0x35178a[_0xfda3('0x44')],{'$or':_[_0xfda3('0x3a')](_0x35178a['attributes'],function(_0x4e312d){var _0x31d657={};_0x31d657[_0x4e312d]={'$like':'%'+_0x4ce31c['query'][_0xfda3('0x46')]+'%'};return _0x31d657;})});}_0x35178a=_[_0xfda3('0x48')]({},_0x35178a,_0x4ce31c[_0xfda3('0x49')]);return _0x29d503[_0xfda3('0x55')](_0x35178a);}})[_0xfda3('0x2f')](function(_0x3c0155){if(_0x3c0155){_0x178b06=_0x3c0155[_0xfda3('0x40')];if(!_0x4ce31c[_0xfda3('0x3b')][_0xfda3('0x41')](_0xfda3('0x58'))){_0x35178a['limit']=qs[_0xfda3('0x29')](_0x4ce31c['query']['limit']);_0x35178a[_0xfda3('0x27')]=qs[_0xfda3('0x27')](_0x4ce31c['query'][_0xfda3('0x27')]);}return _0x29d503[_0xfda3('0x55')](_0x35178a);}})[_0xfda3('0x2f')](function(_0x589c7a){if(_0x589c7a){return _0x589c7a?{'count':_0x178b06,'rows':_0x589c7a}:null;}})[_0xfda3('0x2f')](respondWithResult(_0x5a3a6f,null))[_0xfda3('0x22')](handleError(_0x5a3a6f,null));};exports[_0xfda3('0x59')]=function(_0x28f4cd,_0x2448b1,_0x4c7435){if(_0x28f4cd['body']['id']){delete _0x28f4cd['body']['id'];}return db[_0xfda3('0x34')][_0xfda3('0x56')]({'where':{'id':_0x28f4cd[_0xfda3('0x54')]['id']}})[_0xfda3('0x2f')](handleEntityNotFound(_0x2448b1,null))[_0xfda3('0x2f')](function(_0x21f9ae){if(_0x21f9ae){_0x28f4cd['body'][_0xfda3('0x5a')]=_0x21f9ae['id'];_0x28f4cd[_0xfda3('0x52')][_0xfda3('0x5b')]=integrations[_0xfda3('0x5c')](_0x28f4cd['body'][_0xfda3('0x5d')],_0x28f4cd['body'][_0xfda3('0x37')]);_0x28f4cd[_0xfda3('0x52')][_0xfda3('0x5e')]=integrations[_0xfda3('0x5f')](_0x28f4cd[_0xfda3('0x52')][_0xfda3('0x5d')],_0x28f4cd[_0xfda3('0x52')]['type']);return db[_0xfda3('0x57')][_0xfda3('0x51')](_0x28f4cd[_0xfda3('0x52')],{'include':[{'model':db[_0xfda3('0x60')],'as':_0xfda3('0x5b')},{'model':db[_0xfda3('0x60')],'as':'Descriptions'}]});}return null;})[_0xfda3('0x2f')](respondWithResult(_0x2448b1,null))[_0xfda3('0x22')](handleError(_0x2448b1,null));};var md5=require(_0xfda3('0x61'));exports[_0xfda3('0x62')]=function(_0x3ce543,_0x4a0a1c,_0x174167){var _0x1d5b7a=null;var _0x2dab2d=null;var _0x42a092=null;var _0xcb7ff4=null;var _0x22fbc7='';return db[_0xfda3('0x34')][_0xfda3('0x56')]({'where':{'id':_0x3ce543[_0xfda3('0x54')]['id']},'attributes':['id',_0xfda3('0x31'),'username',_0xfda3('0x63'),_0xfda3('0x64'),_0xfda3('0x65'),_0xfda3('0x66'),_0xfda3('0x67')]})['then'](handleEntityNotFound(_0x4a0a1c,null))['then'](function(_0x232cd2){if(_0x232cd2){_0x1d5b7a=_0x232cd2[_0xfda3('0x68')];_0x2dab2d=_0x232cd2[_0xfda3('0x67')];_0x42a092=_0x232cd2[_0xfda3('0x64')];_0x22fbc7=_0x232cd2[_0xfda3('0x65')];var _0x402d0d=_0x22fbc7[_0xfda3('0x69')](-0x1);if(_0x402d0d==='/'){_0x22fbc7=_0x22fbc7[_0xfda3('0x6a')](0x0,_0x22fbc7[_0xfda3('0x6b')](_0x402d0d));}_0xcb7ff4=util[_0xfda3('0x6c')](_0xfda3('0x6d'),_0x22fbc7);var _0x593270={'method':_0xfda3('0x6e'),'uri':_0xcb7ff4,'qs':{'operation':'getchallenge','username':_0x232cd2['username']},'json':!![]};return rp(_0x593270);}})['then'](function(_0x26dca4){if(_0x26dca4['success']){var _0x334d87={'method':_0xfda3('0x6f'),'uri':_0xcb7ff4,'form':{'operation':'login','username':_0x1d5b7a,'accessKey':md5(_0x26dca4[_0xfda3('0x21')][_0xfda3('0x70')]+_0x2dab2d)},'json':!![]};return rp(_0x334d87);}})['then'](function(_0x12b727){if(_0x12b727['success']){var _0x35e986={'method':_0xfda3('0x6e'),'uri':_0xcb7ff4,'qs':{'operation':'describe','username':_0x1d5b7a,'sessionName':_0x12b727[_0xfda3('0x21')][_0xfda3('0x71')],'elementType':_0x42a092},'json':!![]};return rp(_0x35e986);}})[_0xfda3('0x2f')](function(_0x276d6d){if(_0x276d6d[_0xfda3('0x72')]){var _0x4e5791=[_0xfda3('0x73'),_0xfda3('0x74'),_0xfda3('0x75')];_[_0xfda3('0x76')](_0x276d6d[_0xfda3('0x21')]['fields'],function(_0x5d64bb){return _0x4e5791['includes'](_0x5d64bb[_0xfda3('0x37')][_0xfda3('0x31')]);});_[_0xfda3('0x76')](_0x276d6d[_0xfda3('0x21')][_0xfda3('0x3f')],function(_0x44d81d){return _0x44d81d[_0xfda3('0x77')]===_0xfda3('0x78');});return{'count':_0x276d6d['result'][_0xfda3('0x3f')][_0xfda3('0x40')],'rows':_['map'](_0x276d6d[_0xfda3('0x21')][_0xfda3('0x3f')],function(_0x481606){return{'id':_0x481606[_0xfda3('0x31')],'name':_0x481606[_0xfda3('0x79')],'custom':_[_0xfda3('0x7a')](_0x481606[_0xfda3('0x31')],_0xfda3('0x7b'))?!![]:![],'options':_0x481606['type'][_0xfda3('0x31')]===_0xfda3('0x7c')&&_0x481606[_0xfda3('0x37')][_0xfda3('0x7d')]['length']>0x0?_[_0xfda3('0x3a')](_0x481606[_0xfda3('0x37')][_0xfda3('0x7d')],function(_0x1f80d0){return{'name':_0x1f80d0[_0xfda3('0x79')],'value':_0x1f80d0[_0xfda3('0x7e')]};}):[]};})};}})[_0xfda3('0x2f')](respondWithResult(_0x4a0a1c,null))[_0xfda3('0x22')](function(_0x25c850){console[_0xfda3('0x7f')](_0xfda3('0x80')+_0x25c850);var _0x4ac498=_0x3ce543['query'][_0xfda3('0x81')]?0x1f4:_0x25c850['statusCode']||0x1f4;logger[_0xfda3('0x1f')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4ac498,JSON['stringify'](_0x25c850));delete _0x25c850[_0xfda3('0x31')];if(_0x4ac498===0x191){_0x4ac498=0x190;}_0x4a0a1c[_0xfda3('0x24')](_0x4ac498)['send'](_0x3ce543['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x25c850['statusCode']}:_0x25c850);});}; \ No newline at end of file +var _0xcb91=['include','findAll','rows','show','params','length','find','body','destroy','getConfigurations','VtigerConfiguration','hasOwnProperty','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','token','describe','sessionName','reference','remove','editable','false','label','startsWith','cf_','picklist','map','picklistValues','value','getFields,\x20%s,\x20%s,\x20%s','test','statusCode','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','sendStatus','stack','name','send','index','VtigerAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','options','includeAll'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0xcb91[_0x4bd950];return _0x5dc59a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0x1cb9('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x282bc6,_0x384496,_0x1c714f,_0x56884d){return new BPromise(function(_0x397727,_0x6ef389){var _0x1b3cd7=_0x56884d||client;return _0x1b3cd7[_0x1cb9('0x17')](_0x282bc6,_0x1c714f)[_0x1cb9('0x18')](function(_0x5806d8){logger['info'](_0x1cb9('0x19'),_0x384496,_0x1cb9('0x1a'));logger[_0x1cb9('0x1b')](_0x1cb9('0x1c'),_0x384496,_0x1cb9('0x1a'),JSON[_0x1cb9('0x1d')](_0x5806d8));if(_0x5806d8[_0x1cb9('0x1e')]){if(_0x5806d8['error']['code']===0x1f4){logger[_0x1cb9('0x1e')](_0x1cb9('0x19'),_0x384496,_0x5806d8[_0x1cb9('0x1e')][_0x1cb9('0x1f')]);return _0x6ef389(_0x5806d8[_0x1cb9('0x1e')][_0x1cb9('0x1f')]);}logger[_0x1cb9('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x384496,_0x5806d8['error'][_0x1cb9('0x1f')]);return _0x397727(_0x5806d8['error'][_0x1cb9('0x1f')]);}else{logger[_0x1cb9('0x20')]('VtigerAccount,\x20%s,\x20%s',_0x384496,'request\x20sent');_0x397727(_0x5806d8[_0x1cb9('0x21')][_0x1cb9('0x1f')]);}})[_0x1cb9('0x22')](function(_0x4601b8){logger[_0x1cb9('0x1e')](_0x1cb9('0x19'),_0x384496,_0x4601b8);_0x6ef389(_0x4601b8);});});}function respondWithStatusCode(_0x59ebea,_0x55b232){_0x55b232=_0x55b232||0xcc;return function(_0x6c6f61){if(_0x6c6f61){return _0x59ebea['sendStatus'](_0x55b232);}return _0x59ebea[_0x1cb9('0x23')](_0x55b232)[_0x1cb9('0x24')]();};}function respondWithResult(_0x69b4c8,_0x44d3c4){_0x44d3c4=_0x44d3c4||0xc8;return function(_0x43a100){if(_0x43a100){return _0x69b4c8['status'](_0x44d3c4)[_0x1cb9('0x25')](_0x43a100);}};}function respondWithFilteredResult(_0x9df250,_0x4c8d76){return function(_0xd6891c){if(_0xd6891c){var _0x21effa=typeof _0x4c8d76[_0x1cb9('0x26')]===_0x1cb9('0x27')&&typeof _0x4c8d76[_0x1cb9('0x28')]===_0x1cb9('0x27');var _0x2e28fe=_0xd6891c[_0x1cb9('0x29')];var _0x41e5c2=_0x21effa?0x0:_0x4c8d76[_0x1cb9('0x26')];var _0x48888d=_0x21effa?_0xd6891c[_0x1cb9('0x29')]:_0x4c8d76['offset']+_0x4c8d76[_0x1cb9('0x28')];var _0x4efebc;if(_0x48888d>=_0x2e28fe){_0x48888d=_0x2e28fe;_0x4efebc=0xc8;}else{_0x4efebc=0xce;}_0x9df250[_0x1cb9('0x23')](_0x4efebc);return _0x9df250[_0x1cb9('0x2a')](_0x1cb9('0x2b'),_0x41e5c2+'-'+_0x48888d+'/'+_0x2e28fe)[_0x1cb9('0x25')](_0xd6891c);}return null;};}function patchUpdates(_0x561d89){return function(_0x1c701f){try{jsonpatch['apply'](_0x1c701f,_0x561d89,!![]);}catch(_0xe0a0e2){return BPromise[_0x1cb9('0x2c')](_0xe0a0e2);}return _0x1c701f[_0x1cb9('0x2d')]();};}function saveUpdates(_0x5d8793,_0xae4c7a){return function(_0x5e84fd){if(_0x5e84fd){return _0x5e84fd[_0x1cb9('0x2e')](_0x5d8793)['then'](function(_0x2164e3){return _0x2164e3;});}return null;};}function removeEntity(_0x42a688,_0x3a2c60){return function(_0xae910){if(_0xae910){return _0xae910['destroy']()[_0x1cb9('0x18')](function(){_0x42a688[_0x1cb9('0x23')](0xcc)[_0x1cb9('0x24')]();});}};}function handleEntityNotFound(_0x91a1db,_0xc6784c){return function(_0x2794fa){if(!_0x2794fa){_0x91a1db[_0x1cb9('0x2f')](0x194);}return _0x2794fa;};}function handleError(_0x1ed5ad,_0x386e8b){_0x386e8b=_0x386e8b||0x1f4;return function(_0x1de287){logger[_0x1cb9('0x1e')](_0x1de287[_0x1cb9('0x30')]);if(_0x1de287[_0x1cb9('0x31')]){delete _0x1de287['name'];}_0x1ed5ad['status'](_0x386e8b)[_0x1cb9('0x32')](_0x1de287);};}exports[_0x1cb9('0x33')]=function(_0x91c937,_0x29f451){var _0x385daa={},_0x3a06e6={},_0x35f5e8={'count':0x0,'rows':[]};var _0x3f5637=_['map'](db[_0x1cb9('0x34')][_0x1cb9('0x35')],function(_0xefe136){return{'name':_0xefe136['fieldName'],'type':_0xefe136[_0x1cb9('0x36')]['key']};});_0x3a06e6[_0x1cb9('0x37')]=_['map'](_0x3f5637,_0x1cb9('0x31'));_0x3a06e6[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x91c937[_0x1cb9('0x38')]);_0x3a06e6[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](_0x3a06e6[_0x1cb9('0x37')],_0x3a06e6['query']);_0x385daa['attributes']=_[_0x1cb9('0x3b')](_0x3a06e6[_0x1cb9('0x37')],qs[_0x1cb9('0x3c')](_0x91c937[_0x1cb9('0x38')][_0x1cb9('0x3c')]));_0x385daa[_0x1cb9('0x3d')]=_0x385daa[_0x1cb9('0x3d')]['length']?_0x385daa[_0x1cb9('0x3d')]:_0x3a06e6['model'];if(!_0x91c937['query']['hasOwnProperty'](_0x1cb9('0x3e'))){_0x385daa[_0x1cb9('0x28')]=qs[_0x1cb9('0x28')](_0x91c937[_0x1cb9('0x38')][_0x1cb9('0x28')]);_0x385daa['offset']=qs[_0x1cb9('0x26')](_0x91c937['query'][_0x1cb9('0x26')]);}_0x385daa[_0x1cb9('0x3f')]=qs[_0x1cb9('0x40')](_0x91c937['query'][_0x1cb9('0x40')]);_0x385daa['where']=qs[_0x1cb9('0x3a')](_[_0x1cb9('0x41')](_0x91c937['query'],_0x3a06e6['filters']),_0x3f5637);if(_0x91c937[_0x1cb9('0x38')][_0x1cb9('0x42')]){_0x385daa[_0x1cb9('0x43')]=_[_0x1cb9('0x44')](_0x385daa[_0x1cb9('0x43')],{'$or':_['map'](_0x3f5637,function(_0x11d877){if(_0x11d877['type']!=='VIRTUAL'){var _0x495335={};_0x495335[_0x11d877[_0x1cb9('0x31')]]={'$like':'%'+_0x91c937[_0x1cb9('0x38')][_0x1cb9('0x42')]+'%'};return _0x495335;}})});}_0x385daa=_[_0x1cb9('0x44')]({},_0x385daa,_0x91c937[_0x1cb9('0x45')]);var _0x2a8b7f={'where':_0x385daa[_0x1cb9('0x43')]};return db[_0x1cb9('0x34')][_0x1cb9('0x29')](_0x2a8b7f)[_0x1cb9('0x18')](function(_0x3ea88c){_0x35f5e8['count']=_0x3ea88c;if(_0x91c937[_0x1cb9('0x38')][_0x1cb9('0x46')]){_0x385daa[_0x1cb9('0x47')]=[{'all':!![]}];}return db['VtigerAccount'][_0x1cb9('0x48')](_0x385daa);})[_0x1cb9('0x18')](function(_0x3c6044){_0x35f5e8[_0x1cb9('0x49')]=_0x3c6044;return _0x35f5e8;})[_0x1cb9('0x18')](respondWithFilteredResult(_0x29f451,_0x385daa))['catch'](handleError(_0x29f451,null));};exports[_0x1cb9('0x4a')]=function(_0x59d76b,_0x2eaa11){var _0x4ac483={'raw':![],'where':{'id':_0x59d76b[_0x1cb9('0x4b')]['id']}},_0x1cf2ee={};_0x1cf2ee[_0x1cb9('0x37')]=_[_0x1cb9('0x39')](db['VtigerAccount'][_0x1cb9('0x35')]);_0x1cf2ee[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x59d76b[_0x1cb9('0x38')]);_0x1cf2ee[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](_0x1cf2ee[_0x1cb9('0x37')],_0x1cf2ee[_0x1cb9('0x38')]);_0x4ac483[_0x1cb9('0x3d')]=_[_0x1cb9('0x3b')](_0x1cf2ee['model'],qs['fields'](_0x59d76b[_0x1cb9('0x38')][_0x1cb9('0x3c')]));_0x4ac483[_0x1cb9('0x3d')]=_0x4ac483[_0x1cb9('0x3d')][_0x1cb9('0x4c')]?_0x4ac483[_0x1cb9('0x3d')]:_0x1cf2ee[_0x1cb9('0x37')];if(_0x59d76b[_0x1cb9('0x38')][_0x1cb9('0x46')]){_0x4ac483[_0x1cb9('0x47')]=[{'all':!![]}];}_0x4ac483=_['merge']({},_0x4ac483,_0x59d76b[_0x1cb9('0x45')]);return db['VtigerAccount'][_0x1cb9('0x4d')](_0x4ac483)['then'](handleEntityNotFound(_0x2eaa11,null))[_0x1cb9('0x18')](respondWithResult(_0x2eaa11,null))['catch'](handleError(_0x2eaa11,null));};exports['create']=function(_0x44e918,_0x3b0c2e){return db[_0x1cb9('0x34')]['create'](_0x44e918[_0x1cb9('0x4e')],{})[_0x1cb9('0x18')](respondWithResult(_0x3b0c2e,0xc9))['catch'](handleError(_0x3b0c2e,null));};exports['update']=function(_0x398d9d,_0x1a0314){if(_0x398d9d[_0x1cb9('0x4e')]['id']){delete _0x398d9d[_0x1cb9('0x4e')]['id'];}return db[_0x1cb9('0x34')][_0x1cb9('0x4d')]({'where':{'id':_0x398d9d[_0x1cb9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1a0314,null))[_0x1cb9('0x18')](saveUpdates(_0x398d9d[_0x1cb9('0x4e')],null))[_0x1cb9('0x18')](respondWithResult(_0x1a0314,null))['catch'](handleError(_0x1a0314,null));};exports[_0x1cb9('0x4f')]=function(_0x9893a3,_0x1651c5){return db[_0x1cb9('0x34')][_0x1cb9('0x4d')]({'where':{'id':_0x9893a3[_0x1cb9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1651c5,null))[_0x1cb9('0x18')](removeEntity(_0x1651c5,null))[_0x1cb9('0x22')](handleError(_0x1651c5,null));};exports[_0x1cb9('0x50')]=function(_0x128c5b,_0x4ad7cd,_0x274c90){var _0x1c27d3={};var _0x3c126a={};var _0x40875a;var _0x3a4cbe;return db[_0x1cb9('0x34')]['findOne']({'where':{'id':_0x128c5b[_0x1cb9('0x4b')]['id']}})[_0x1cb9('0x18')](handleEntityNotFound(_0x4ad7cd,null))[_0x1cb9('0x18')](function(_0x11fd9a){if(_0x11fd9a){_0x40875a=_0x11fd9a;_0x3c126a['model']=_['keys'](db[_0x1cb9('0x51')][_0x1cb9('0x35')]);_0x3c126a[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x128c5b[_0x1cb9('0x38')]);_0x3c126a[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](_0x3c126a[_0x1cb9('0x37')],_0x3c126a['query']);_0x1c27d3['attributes']=_[_0x1cb9('0x3b')](_0x3c126a['model'],qs['fields'](_0x128c5b['query']['fields']));_0x1c27d3['attributes']=_0x1c27d3[_0x1cb9('0x3d')][_0x1cb9('0x4c')]?_0x1c27d3[_0x1cb9('0x3d')]:_0x3c126a[_0x1cb9('0x37')];_0x1c27d3[_0x1cb9('0x3f')]=qs[_0x1cb9('0x40')](_0x128c5b['query'][_0x1cb9('0x40')]);_0x1c27d3[_0x1cb9('0x43')]=qs['filters'](_['pick'](_0x128c5b[_0x1cb9('0x38')],_0x3c126a[_0x1cb9('0x3a')]));if(_0x128c5b[_0x1cb9('0x38')][_0x1cb9('0x42')]){_0x1c27d3[_0x1cb9('0x43')]=_['merge'](_0x1c27d3['where'],{'$or':_['map'](_0x1c27d3[_0x1cb9('0x3d')],function(_0x2fd5a0){var _0x196349={};_0x196349[_0x2fd5a0]={'$like':'%'+_0x128c5b[_0x1cb9('0x38')][_0x1cb9('0x42')]+'%'};return _0x196349;})});}_0x1c27d3=_['merge']({},_0x1c27d3,_0x128c5b[_0x1cb9('0x45')]);return _0x40875a[_0x1cb9('0x50')](_0x1c27d3);}})['then'](function(_0x55b8e9){if(_0x55b8e9){_0x3a4cbe=_0x55b8e9[_0x1cb9('0x4c')];if(!_0x128c5b['query'][_0x1cb9('0x52')](_0x1cb9('0x3e'))){_0x1c27d3[_0x1cb9('0x28')]=qs[_0x1cb9('0x28')](_0x128c5b[_0x1cb9('0x38')][_0x1cb9('0x28')]);_0x1c27d3['offset']=qs[_0x1cb9('0x26')](_0x128c5b[_0x1cb9('0x38')][_0x1cb9('0x26')]);}return _0x40875a[_0x1cb9('0x50')](_0x1c27d3);}})['then'](function(_0x520d98){if(_0x520d98){return _0x520d98?{'count':_0x3a4cbe,'rows':_0x520d98}:null;}})[_0x1cb9('0x18')](respondWithResult(_0x4ad7cd,null))[_0x1cb9('0x22')](handleError(_0x4ad7cd,null));};exports[_0x1cb9('0x53')]=function(_0x1ee140,_0x210b0b,_0x267a3c){if(_0x1ee140['body']['id']){delete _0x1ee140[_0x1cb9('0x4e')]['id'];}return db['VtigerAccount'][_0x1cb9('0x54')]({'where':{'id':_0x1ee140[_0x1cb9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x210b0b,null))[_0x1cb9('0x18')](function(_0xce1835){if(_0xce1835){_0x1ee140[_0x1cb9('0x4e')]['AccountId']=_0xce1835['id'];_0x1ee140[_0x1cb9('0x4e')][_0x1cb9('0x55')]=integrations[_0x1cb9('0x56')](_0x1ee140[_0x1cb9('0x4e')][_0x1cb9('0x57')],_0x1ee140[_0x1cb9('0x4e')]['type']);_0x1ee140[_0x1cb9('0x4e')][_0x1cb9('0x58')]=integrations[_0x1cb9('0x59')](_0x1ee140[_0x1cb9('0x4e')][_0x1cb9('0x57')],_0x1ee140[_0x1cb9('0x4e')][_0x1cb9('0x36')]);return db[_0x1cb9('0x51')]['create'](_0x1ee140[_0x1cb9('0x4e')],{'include':[{'model':db[_0x1cb9('0x5a')],'as':'Subjects'},{'model':db[_0x1cb9('0x5a')],'as':'Descriptions'}]});}return null;})[_0x1cb9('0x18')](respondWithResult(_0x210b0b,null))['catch'](handleError(_0x210b0b,null));};var md5=require('md5');exports[_0x1cb9('0x5b')]=function(_0x3297f0,_0x538b49,_0x342cb1){var _0x5b5419=null;var _0x3d6474=null;var _0x7ecb4e=null;var _0x399986=null;var _0xb1e45='';return db['VtigerAccount'][_0x1cb9('0x54')]({'where':{'id':_0x3297f0[_0x1cb9('0x4b')]['id']},'attributes':['id',_0x1cb9('0x31'),_0x1cb9('0x5c'),_0x1cb9('0x5d'),_0x1cb9('0x5e'),'remoteUri',_0x1cb9('0x5f'),_0x1cb9('0x60')]})[_0x1cb9('0x18')](handleEntityNotFound(_0x538b49,null))[_0x1cb9('0x18')](function(_0x102f2c){if(_0x102f2c){_0x5b5419=_0x102f2c[_0x1cb9('0x5c')];_0x3d6474=_0x102f2c['accessKey'];_0x7ecb4e=_0x102f2c[_0x1cb9('0x5e')];_0xb1e45=_0x102f2c[_0x1cb9('0x61')];var _0x56c4ae=_0xb1e45[_0x1cb9('0x62')](-0x1);if(_0x56c4ae==='/'){_0xb1e45=_0xb1e45[_0x1cb9('0x63')](0x0,_0xb1e45[_0x1cb9('0x64')](_0x56c4ae));}_0x399986=util[_0x1cb9('0x65')](_0x1cb9('0x66'),_0xb1e45);var _0x209dc7={'method':_0x1cb9('0x67'),'uri':_0x399986,'qs':{'operation':'getchallenge','username':_0x102f2c[_0x1cb9('0x5c')]},'json':!![]};return rp(_0x209dc7);}})['then'](function(_0x3a89f5){if(_0x3a89f5[_0x1cb9('0x68')]){var _0x50dd60={'method':_0x1cb9('0x69'),'uri':_0x399986,'form':{'operation':_0x1cb9('0x6a'),'username':_0x5b5419,'accessKey':md5(_0x3a89f5[_0x1cb9('0x21')][_0x1cb9('0x6b')]+_0x3d6474)},'json':!![]};return rp(_0x50dd60);}})['then'](function(_0x113367){if(_0x113367[_0x1cb9('0x68')]){var _0x429371={'method':'GET','uri':_0x399986,'qs':{'operation':_0x1cb9('0x6c'),'username':_0x5b5419,'sessionName':_0x113367[_0x1cb9('0x21')][_0x1cb9('0x6d')],'elementType':_0x7ecb4e},'json':!![]};return rp(_0x429371);}})[_0x1cb9('0x18')](function(_0x10b508){if(_0x10b508[_0x1cb9('0x68')]){var _0x893ef4=['autogenerated',_0x1cb9('0x6e'),'owner'];_[_0x1cb9('0x6f')](_0x10b508[_0x1cb9('0x21')][_0x1cb9('0x3c')],function(_0x329175){return _0x893ef4['includes'](_0x329175[_0x1cb9('0x36')][_0x1cb9('0x31')]);});_['remove'](_0x10b508[_0x1cb9('0x21')][_0x1cb9('0x3c')],function(_0x3cf4a5){return _0x3cf4a5[_0x1cb9('0x70')]===_0x1cb9('0x71');});return{'count':_0x10b508['result']['fields']['length'],'rows':_['map'](_0x10b508[_0x1cb9('0x21')][_0x1cb9('0x3c')],function(_0xe99ac7){return{'id':_0xe99ac7[_0x1cb9('0x31')],'name':_0xe99ac7[_0x1cb9('0x72')],'custom':_[_0x1cb9('0x73')](_0xe99ac7[_0x1cb9('0x31')],_0x1cb9('0x74'))?!![]:![],'options':_0xe99ac7['type'][_0x1cb9('0x31')]===_0x1cb9('0x75')&&_0xe99ac7[_0x1cb9('0x36')]['picklistValues'][_0x1cb9('0x4c')]>0x0?_[_0x1cb9('0x76')](_0xe99ac7['type'][_0x1cb9('0x77')],function(_0x31cc7c){return{'name':_0x31cc7c[_0x1cb9('0x72')],'value':_0x31cc7c[_0x1cb9('0x78')]};}):[]};})};}})['then'](respondWithResult(_0x538b49,null))[_0x1cb9('0x22')](function(_0x282ffa){console['log']('vTiger\x20error:\x20'+_0x282ffa);var _0x1f2d69=_0x3297f0[_0x1cb9('0x38')]['test']?0x1f4:_0x282ffa['statusCode']||0x1f4;logger[_0x1cb9('0x1e')](_0x1cb9('0x79'),'getFields',_0x1f2d69,JSON['stringify'](_0x282ffa));delete _0x282ffa[_0x1cb9('0x31')];if(_0x1f2d69===0x191){_0x1f2d69=0x190;}_0x538b49['status'](_0x1f2d69)['send'](_0x3297f0['query'][_0x1cb9('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x282ffa[_0x1cb9('0x7b')]}:_0x282ffa);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 5e6c842..ae4c9fe 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 _0x5db9=['VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x5db9,0x1ca));var _0x95db=function(_0x11dc84,_0x4c4365){_0x11dc84=_0x11dc84-0x0;var _0x46bb76=_0x5db9[_0x11dc84];return _0x46bb76;};'use strict';var _=require(_0x95db('0x0'));var util=require('util');var logger=require(_0x95db('0x1'))(_0x95db('0x2'));var moment=require(_0x95db('0x3'));var BPromise=require('bluebird');var rp=require(_0x95db('0x4'));var fs=require('fs');var path=require(_0x95db('0x5'));var rimraf=require('rimraf');var config=require(_0x95db('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x95db('0x7'));module[_0x95db('0x8')]=function(_0x1c37d8,_0x607b3a){return _0x1c37d8[_0x95db('0x9')](_0x95db('0xa'),attributes,{'tableName':_0x95db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84fc=['lodash','util','../../config/logger','api','moment','path','rimraf','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0x53fdec,_0x54474a){var _0x3adffb=function(_0x2e85a2){while(--_0x2e85a2){_0x53fdec['push'](_0x53fdec['shift']());}};_0x3adffb(++_0x54474a);}(_0x84fc,0x90));var _0xc84f=function(_0x3e95a8,_0xa7af87){_0x3e95a8=_0x3e95a8-0x0;var _0x1d8724=_0x84fc[_0x3e95a8];return _0x1d8724;};'use strict';var _=require(_0xc84f('0x0'));var util=require(_0xc84f('0x1'));var logger=require(_0xc84f('0x2'))(_0xc84f('0x3'));var moment=require(_0xc84f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc84f('0x5'));var rimraf=require(_0xc84f('0x6'));var config=require('../../config/environment');var attributes=require(_0xc84f('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xc84f('0x8')]=function(_0x540842,_0x1f1e76){return _0x540842[_0xc84f('0x9')](_0xc84f('0xa'),attributes,{'tableName':_0xc84f('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 37c01aa..16ee0ca 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 _0x773b=['VtigerAccount','findAll','raw','options','limit','include','map','model','attributes','catch','ShowVtigerAccount','find','then','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVtigerAccount'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x773b,0x73));var _0xb773=function(_0x103b3b,_0x13aa14){_0x103b3b=_0x103b3b-0x0;var _0x4a3d32=_0x773b[_0x103b3b];return _0x4a3d32;};'use strict';var _=require(_0xb773('0x0'));var util=require('util');var moment=require(_0xb773('0x1'));var BPromise=require(_0xb773('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb773('0x3'))['db'];var utils=require(_0xb773('0x4'));var logger=require(_0xb773('0x5'))(_0xb773('0x6'));var config=require(_0xb773('0x7'));var jayson=require(_0xb773('0x8'));var client=jayson[_0xb773('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bfbf1,_0x541e47,_0x6156e6){return new BPromise(function(_0xb33012,_0xf89247){return client[_0xb773('0xa')](_0x3bfbf1,_0x6156e6)['then'](function(_0x21b26e){logger[_0xb773('0xb')](_0xb773('0xc'),_0x541e47,_0xb773('0xd'));logger[_0xb773('0xe')](_0xb773('0xf'),_0x541e47,_0xb773('0xd'),JSON[_0xb773('0x10')](_0x21b26e));if(_0x21b26e[_0xb773('0x11')]){if(_0x21b26e[_0xb773('0x11')][_0xb773('0x12')]===0x1f4){logger[_0xb773('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x541e47,_0x21b26e[_0xb773('0x11')][_0xb773('0x13')]);return _0xf89247(_0x21b26e[_0xb773('0x11')][_0xb773('0x13')]);}logger[_0xb773('0x11')](_0xb773('0xc'),_0x541e47,_0x21b26e['error']['message']);return _0xb33012(_0x21b26e[_0xb773('0x11')][_0xb773('0x13')]);}else{logger[_0xb773('0xb')](_0xb773('0xc'),_0x541e47,'request\x20sent');_0xb33012(_0x21b26e['result'][_0xb773('0x13')]);}})['catch'](function(_0x283f1a){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x541e47,_0x283f1a);_0xf89247(_0x283f1a);});});}exports[_0xb773('0x14')]=function(_0x19ae28){var _0x1819c3=this;return new Promise(function(_0x26fb38,_0x52afd6){return db[_0xb773('0x15')][_0xb773('0x16')]({'raw':_0x19ae28['options']?_0x19ae28['options'][_0xb773('0x17')]===undefined?!![]:![]:!![],'where':_0x19ae28['options']?_0x19ae28['options']['where']||null:null,'attributes':_0x19ae28[_0xb773('0x18')]?_0x19ae28[_0xb773('0x18')]['attributes']||null:null,'limit':_0x19ae28[_0xb773('0x18')]?_0x19ae28['options'][_0xb773('0x19')]||null:null,'include':_0x19ae28[_0xb773('0x18')]?_0x19ae28[_0xb773('0x18')][_0xb773('0x1a')]?_[_0xb773('0x1b')](_0x19ae28[_0xb773('0x18')][_0xb773('0x1a')],function(_0x55f037){return{'model':db[_0x55f037[_0xb773('0x1c')]],'as':_0x55f037['as'],'attributes':_0x55f037[_0xb773('0x1d')],'include':_0x55f037[_0xb773('0x1a')]?_['map'](_0x55f037[_0xb773('0x1a')],function(_0x4226f4){return{'model':db[_0x4226f4[_0xb773('0x1c')]],'as':_0x4226f4['as'],'attributes':_0x4226f4[_0xb773('0x1d')],'include':_0x4226f4['include']?_[_0xb773('0x1b')](_0x4226f4[_0xb773('0x1a')],function(_0x471d1c){return{'model':db[_0x471d1c[_0xb773('0x1c')]],'as':_0x471d1c['as'],'attributes':_0x471d1c[_0xb773('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52f0d8){logger[_0xb773('0xb')](_0xb773('0x14'),_0x19ae28);logger['debug'](_0xb773('0x14'),_0x19ae28,JSON[_0xb773('0x10')](_0x52f0d8));_0x26fb38(_0x52f0d8);})[_0xb773('0x1e')](function(_0x344d6d){logger['error'](_0xb773('0x14'),_0x344d6d[_0xb773('0x13')],_0x19ae28);_0x52afd6(_0x1819c3['error'](0x1f4,_0x344d6d[_0xb773('0x13')]));});});};exports[_0xb773('0x1f')]=function(_0x39d409){var _0x4c4c20=this;return new Promise(function(_0x2f0394,_0x3ce965){return db[_0xb773('0x15')][_0xb773('0x20')]({'raw':_0x39d409[_0xb773('0x18')]?_0x39d409['options'][_0xb773('0x17')]===undefined?!![]:![]:!![],'where':_0x39d409[_0xb773('0x18')]?_0x39d409[_0xb773('0x18')]['where']||null:null,'attributes':_0x39d409['options']?_0x39d409[_0xb773('0x18')][_0xb773('0x1d')]||null:null,'include':_0x39d409['options']?_0x39d409['options']['include']?_[_0xb773('0x1b')](_0x39d409[_0xb773('0x18')][_0xb773('0x1a')],function(_0x140632){return{'model':db[_0x140632[_0xb773('0x1c')]],'as':_0x140632['as'],'attributes':_0x140632[_0xb773('0x1d')],'include':_0x140632[_0xb773('0x1a')]?_[_0xb773('0x1b')](_0x140632['include'],function(_0x3d5db1){return{'model':db[_0x3d5db1['model']],'as':_0x3d5db1['as'],'attributes':_0x3d5db1['attributes'],'include':_0x3d5db1[_0xb773('0x1a')]?_[_0xb773('0x1b')](_0x3d5db1[_0xb773('0x1a')],function(_0xbbc9dc){return{'model':db[_0xbbc9dc[_0xb773('0x1c')]],'as':_0xbbc9dc['as'],'attributes':_0xbbc9dc[_0xb773('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb773('0x21')](function(_0x5aef0c){logger[_0xb773('0xb')](_0xb773('0x1f'),_0x39d409);logger[_0xb773('0xe')](_0xb773('0x1f'),_0x39d409,JSON[_0xb773('0x10')](_0x5aef0c));_0x2f0394(_0x5aef0c);})['catch'](function(_0x4e8b1a){logger['error'](_0xb773('0x1f'),_0x4e8b1a[_0xb773('0x13')],_0x39d409);_0x3ce965(_0x4c4c20[_0xb773('0x11')](0x1f4,_0x4e8b1a[_0xb773('0x13')]));});});}; \ No newline at end of file +var _0xeff3=['info','VtigerAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','find','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xeff3,0x80));var _0x3eff=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0xeff3[_0x2b9e8a];return _0x520e67;};'use strict';var _=require(_0x3eff('0x0'));var util=require(_0x3eff('0x1'));var moment=require(_0x3eff('0x2'));var BPromise=require(_0x3eff('0x3'));var rs=require(_0x3eff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3eff('0x5'))['db'];var utils=require(_0x3eff('0x6'));var logger=require(_0x3eff('0x7'))(_0x3eff('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3eff('0x9')][_0x3eff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30b17f,_0x1fb80a,_0x124e06){return new BPromise(function(_0xe85b0a,_0x5c5f27){return client['request'](_0x30b17f,_0x124e06)[_0x3eff('0xb')](function(_0x530191){logger[_0x3eff('0xc')](_0x3eff('0xd'),_0x1fb80a,_0x3eff('0xe'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1fb80a,_0x3eff('0xe'),JSON[_0x3eff('0xf')](_0x530191));if(_0x530191[_0x3eff('0x10')]){if(_0x530191['error'][_0x3eff('0x11')]===0x1f4){logger['error'](_0x3eff('0xd'),_0x1fb80a,_0x530191['error']['message']);return _0x5c5f27(_0x530191[_0x3eff('0x10')]['message']);}logger[_0x3eff('0x10')](_0x3eff('0xd'),_0x1fb80a,_0x530191[_0x3eff('0x10')]['message']);return _0xe85b0a(_0x530191[_0x3eff('0x10')][_0x3eff('0x12')]);}else{logger[_0x3eff('0xc')](_0x3eff('0xd'),_0x1fb80a,_0x3eff('0xe'));_0xe85b0a(_0x530191[_0x3eff('0x13')][_0x3eff('0x12')]);}})[_0x3eff('0x14')](function(_0x5e506b){logger[_0x3eff('0x10')](_0x3eff('0xd'),_0x1fb80a,_0x5e506b);_0x5c5f27(_0x5e506b);});});}exports[_0x3eff('0x15')]=function(_0x3d1e14){var _0x384c9e=this;return new Promise(function(_0x4d0925,_0x3f8aa8){return db[_0x3eff('0x16')][_0x3eff('0x17')]({'raw':_0x3d1e14[_0x3eff('0x18')]?_0x3d1e14[_0x3eff('0x18')][_0x3eff('0x19')]===undefined?!![]:![]:!![],'where':_0x3d1e14[_0x3eff('0x18')]?_0x3d1e14[_0x3eff('0x18')][_0x3eff('0x1a')]||null:null,'attributes':_0x3d1e14[_0x3eff('0x18')]?_0x3d1e14['options']['attributes']||null:null,'limit':_0x3d1e14['options']?_0x3d1e14['options'][_0x3eff('0x1b')]||null:null,'include':_0x3d1e14['options']?_0x3d1e14['options'][_0x3eff('0x1c')]?_[_0x3eff('0x1d')](_0x3d1e14[_0x3eff('0x18')][_0x3eff('0x1c')],function(_0x9be810){return{'model':db[_0x9be810[_0x3eff('0x1e')]],'as':_0x9be810['as'],'attributes':_0x9be810['attributes'],'include':_0x9be810[_0x3eff('0x1c')]?_[_0x3eff('0x1d')](_0x9be810[_0x3eff('0x1c')],function(_0x283a1f){return{'model':db[_0x283a1f[_0x3eff('0x1e')]],'as':_0x283a1f['as'],'attributes':_0x283a1f[_0x3eff('0x1f')],'include':_0x283a1f[_0x3eff('0x1c')]?_[_0x3eff('0x1d')](_0x283a1f[_0x3eff('0x1c')],function(_0x2343d0){return{'model':db[_0x2343d0['model']],'as':_0x2343d0['as'],'attributes':_0x2343d0[_0x3eff('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3eff('0xb')](function(_0x4ae5f6){logger[_0x3eff('0xc')]('GetVtigerAccount',_0x3d1e14);logger[_0x3eff('0x20')](_0x3eff('0x15'),_0x3d1e14,JSON[_0x3eff('0xf')](_0x4ae5f6));_0x4d0925(_0x4ae5f6);})['catch'](function(_0x1e2eb1){logger['error'](_0x3eff('0x15'),_0x1e2eb1[_0x3eff('0x12')],_0x3d1e14);_0x3f8aa8(_0x384c9e[_0x3eff('0x10')](0x1f4,_0x1e2eb1['message']));});});};exports['ShowVtigerAccount']=function(_0x25751c){var _0x3175db=this;return new Promise(function(_0x28c3ac,_0xb6ef5d){return db[_0x3eff('0x16')][_0x3eff('0x21')]({'raw':_0x25751c[_0x3eff('0x18')]?_0x25751c[_0x3eff('0x18')][_0x3eff('0x19')]===undefined?!![]:![]:!![],'where':_0x25751c[_0x3eff('0x18')]?_0x25751c['options'][_0x3eff('0x1a')]||null:null,'attributes':_0x25751c[_0x3eff('0x18')]?_0x25751c[_0x3eff('0x18')][_0x3eff('0x1f')]||null:null,'include':_0x25751c[_0x3eff('0x18')]?_0x25751c[_0x3eff('0x18')][_0x3eff('0x1c')]?_[_0x3eff('0x1d')](_0x25751c[_0x3eff('0x18')][_0x3eff('0x1c')],function(_0x2b64bb){return{'model':db[_0x2b64bb[_0x3eff('0x1e')]],'as':_0x2b64bb['as'],'attributes':_0x2b64bb[_0x3eff('0x1f')],'include':_0x2b64bb['include']?_[_0x3eff('0x1d')](_0x2b64bb['include'],function(_0x3cb482){return{'model':db[_0x3cb482['model']],'as':_0x3cb482['as'],'attributes':_0x3cb482[_0x3eff('0x1f')],'include':_0x3cb482['include']?_[_0x3eff('0x1d')](_0x3cb482['include'],function(_0x553b14){return{'model':db[_0x553b14[_0x3eff('0x1e')]],'as':_0x553b14['as'],'attributes':_0x553b14['attributes']};}):[]};}):[]};}):[]:[]})[_0x3eff('0xb')](function(_0x2a5a2c){logger[_0x3eff('0xc')]('ShowVtigerAccount',_0x25751c);logger[_0x3eff('0x20')]('ShowVtigerAccount',_0x25751c,JSON[_0x3eff('0xf')](_0x2a5a2c));_0x28c3ac(_0x2a5a2c);})['catch'](function(_0x31ddfd){logger[_0x3eff('0x10')](_0x3eff('0x22'),_0x31ddfd['message'],_0x25751c);_0xb6ef5d(_0x3175db['error'](0x1f4,_0x31ddfd[_0x3eff('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index c8370ed..f906f5a 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x23a185,_0x5e7325){var _0x5173c3=function(_0x3d23d7){while(--_0x3d23d7){_0x23a185['push'](_0x23a185['shift']());}};_0x5173c3(++_0x5e7325);}(_0xadb5,0xad));var _0x5adb=function(_0x3a34b0,_0x4d2a18){_0x3a34b0=_0x3a34b0-0x0;var _0x3c2e78=_0xadb5[_0x3a34b0];return _0x3c2e78;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0xc4aa=['getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0x12')]);router[_0xac4a('0x13')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x14')]);router[_0xac4a('0x15')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x16')]);module[_0xac4a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index aae821f..008a739 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 _0xf379=['sequelize','exports','STRING'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0xf379,0x9f));var _0x9f37=function(_0x4e2b94,_0x499887){_0x4e2b94=_0x4e2b94-0x0;var _0x35171e=_0xf379[_0x4e2b94];return _0x35171e;};'use strict';var Sequelize=require(_0x9f37('0x0'));module[_0x9f37('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9f37('0x2')]}}; \ No newline at end of file +var _0xe837=['sequelize','STRING'];(function(_0x13cfa3,_0x380416){var _0x16c88b=function(_0xbd587){while(--_0xbd587){_0x13cfa3['push'](_0x13cfa3['shift']());}};_0x16c88b(++_0x380416);}(_0xe837,0x1de));var _0x7e83=function(_0x330141,_0x1dd290){_0x330141=_0x330141-0x0;var _0x1b68a2=_0xe837[_0x330141];return _0x1b68a2;};'use strict';var Sequelize=require(_0x7e83('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e83('0x1')]},'description':{'type':Sequelize[_0x7e83('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 7f9ca18..94efbff 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 _0xb476=['Content-Range','apply','reject','destroy','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','VtigerConfiguration','includeAll','findAll','rows','show','include','find','create','update','body','params','getFields','findOne','VtigerField','sort','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','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','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb476,0x1ef));var _0x6b47=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xb476[_0x236d24];return _0x1574cf;};'use strict';var emlformat=require(_0x6b47('0x0'));var rimraf=require(_0x6b47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b47('0x2'));var rp=require(_0x6b47('0x3'));var moment=require('moment');var BPromise=require(_0x6b47('0x4'));var Mustache=require(_0x6b47('0x5'));var util=require(_0x6b47('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6b47('0x7'));var fs=require('fs');var fs_extra=require(_0x6b47('0x8'));var _=require(_0x6b47('0x9'));var squel=require('squel');var crypto=require(_0x6b47('0xa'));var jsforce=require(_0x6b47('0xb'));var deskjs=require(_0x6b47('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6b47('0xd'));var Papa=require(_0x6b47('0xe'));var Redis=require('ioredis');var authService=require(_0x6b47('0xf'));var qs=require(_0x6b47('0x10'));var as=require(_0x6b47('0x11'));var hardwareService=require(_0x6b47('0x12'));var logger=require(_0x6b47('0x13'))('api');var utils=require(_0x6b47('0x14'));var config=require(_0x6b47('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b47('0x16'))['db'];var jayson=require(_0x6b47('0x17'));var client=jayson[_0x6b47('0x18')][_0x6b47('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x53d5de,_0x2d49f0,_0x1788dc,_0x55dfcd){return new BPromise(function(_0x226040,_0x3f0554){var _0x17e01d=_0x55dfcd||client;return _0x17e01d[_0x6b47('0x1a')](_0x53d5de,_0x1788dc)[_0x6b47('0x1b')](function(_0x279990){logger[_0x6b47('0x1c')]('VtigerConfiguration,\x20%s,\x20%s',_0x2d49f0,_0x6b47('0x1d'));logger[_0x6b47('0x1e')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2d49f0,'request\x20sent',JSON['stringify'](_0x279990));if(_0x279990[_0x6b47('0x1f')]){if(_0x279990[_0x6b47('0x1f')][_0x6b47('0x20')]===0x1f4){logger[_0x6b47('0x1f')](_0x6b47('0x21'),_0x2d49f0,_0x279990['error']['message']);return _0x3f0554(_0x279990[_0x6b47('0x1f')]['message']);}logger['error'](_0x6b47('0x21'),_0x2d49f0,_0x279990[_0x6b47('0x1f')][_0x6b47('0x22')]);return _0x226040(_0x279990[_0x6b47('0x1f')][_0x6b47('0x22')]);}else{logger[_0x6b47('0x1c')]('VtigerConfiguration,\x20%s,\x20%s',_0x2d49f0,_0x6b47('0x1d'));_0x226040(_0x279990['result']['message']);}})[_0x6b47('0x23')](function(_0xa54146){logger[_0x6b47('0x1f')](_0x6b47('0x21'),_0x2d49f0,_0xa54146);_0x3f0554(_0xa54146);});});}function respondWithStatusCode(_0x574dfe,_0x9d25d6){_0x9d25d6=_0x9d25d6||0xcc;return function(_0x5eef90){if(_0x5eef90){return _0x574dfe[_0x6b47('0x24')](_0x9d25d6);}return _0x574dfe[_0x6b47('0x25')](_0x9d25d6)[_0x6b47('0x26')]();};}function respondWithResult(_0x3a2ee7,_0x9bce68){_0x9bce68=_0x9bce68||0xc8;return function(_0x1a64aa){if(_0x1a64aa){return _0x3a2ee7[_0x6b47('0x25')](_0x9bce68)[_0x6b47('0x27')](_0x1a64aa);}};}function respondWithFilteredResult(_0x14261f,_0x271ecf){return function(_0x9b86a8){if(_0x9b86a8){var _0x5cab7b=typeof _0x271ecf[_0x6b47('0x28')]===_0x6b47('0x29')&&typeof _0x271ecf[_0x6b47('0x2a')]===_0x6b47('0x29');var _0xae5b68=_0x9b86a8[_0x6b47('0x2b')];var _0x19c28c=_0x5cab7b?0x0:_0x271ecf['offset'];var _0x4eed0b=_0x5cab7b?_0x9b86a8[_0x6b47('0x2b')]:_0x271ecf[_0x6b47('0x28')]+_0x271ecf[_0x6b47('0x2a')];var _0x2929a0;if(_0x4eed0b>=_0xae5b68){_0x4eed0b=_0xae5b68;_0x2929a0=0xc8;}else{_0x2929a0=0xce;}_0x14261f[_0x6b47('0x25')](_0x2929a0);return _0x14261f[_0x6b47('0x2c')](_0x6b47('0x2d'),_0x19c28c+'-'+_0x4eed0b+'/'+_0xae5b68)[_0x6b47('0x27')](_0x9b86a8);}return null;};}function patchUpdates(_0x395bc1){return function(_0x5f46ee){try{jsonpatch[_0x6b47('0x2e')](_0x5f46ee,_0x395bc1,!![]);}catch(_0x4b653d){return BPromise[_0x6b47('0x2f')](_0x4b653d);}return _0x5f46ee['save']();};}function saveUpdates(_0x273981,_0x14177c){return function(_0x54833c){if(_0x54833c){return _0x54833c['update'](_0x273981)[_0x6b47('0x1b')](function(_0x640faf){return _0x640faf;});}return null;};}function removeEntity(_0xe12f84,_0x26d8bd){return function(_0x3347ba){if(_0x3347ba){return _0x3347ba[_0x6b47('0x30')]()['then'](function(){_0xe12f84[_0x6b47('0x25')](0xcc)[_0x6b47('0x26')]();});}};}function handleEntityNotFound(_0x9c07a2,_0x553270){return function(_0x756c51){if(!_0x756c51){_0x9c07a2[_0x6b47('0x24')](0x194);}return _0x756c51;};}function handleError(_0x3a8433,_0x2c437d){_0x2c437d=_0x2c437d||0x1f4;return function(_0x532898){logger[_0x6b47('0x1f')](_0x532898['stack']);if(_0x532898[_0x6b47('0x31')]){delete _0x532898[_0x6b47('0x31')];}_0x3a8433[_0x6b47('0x25')](_0x2c437d)['send'](_0x532898);};}exports[_0x6b47('0x32')]=function(_0x5c24a7,_0x4ba929){var _0x3f9a42={},_0x448e9f={},_0x7ca482={'count':0x0,'rows':[]};var _0x4948f2=_[_0x6b47('0x33')](db['VtigerConfiguration'][_0x6b47('0x34')],function(_0x1c294a){return{'name':_0x1c294a[_0x6b47('0x35')],'type':_0x1c294a[_0x6b47('0x36')][_0x6b47('0x37')]};});_0x448e9f[_0x6b47('0x38')]=_['map'](_0x4948f2,_0x6b47('0x31'));_0x448e9f[_0x6b47('0x39')]=_[_0x6b47('0x3a')](_0x5c24a7[_0x6b47('0x39')]);_0x448e9f[_0x6b47('0x3b')]=_[_0x6b47('0x3c')](_0x448e9f[_0x6b47('0x38')],_0x448e9f[_0x6b47('0x39')]);_0x3f9a42[_0x6b47('0x3d')]=_[_0x6b47('0x3c')](_0x448e9f[_0x6b47('0x38')],qs[_0x6b47('0x3e')](_0x5c24a7['query'][_0x6b47('0x3e')]));_0x3f9a42[_0x6b47('0x3d')]=_0x3f9a42[_0x6b47('0x3d')][_0x6b47('0x3f')]?_0x3f9a42[_0x6b47('0x3d')]:_0x448e9f['model'];if(!_0x5c24a7[_0x6b47('0x39')][_0x6b47('0x40')](_0x6b47('0x41'))){_0x3f9a42['limit']=qs[_0x6b47('0x2a')](_0x5c24a7[_0x6b47('0x39')]['limit']);_0x3f9a42[_0x6b47('0x28')]=qs[_0x6b47('0x28')](_0x5c24a7['query'][_0x6b47('0x28')]);}_0x3f9a42[_0x6b47('0x42')]=qs['sort'](_0x5c24a7[_0x6b47('0x39')]['sort']);_0x3f9a42[_0x6b47('0x43')]=qs[_0x6b47('0x3b')](_[_0x6b47('0x44')](_0x5c24a7[_0x6b47('0x39')],_0x448e9f[_0x6b47('0x3b')]),_0x4948f2);if(_0x5c24a7[_0x6b47('0x39')][_0x6b47('0x45')]){_0x3f9a42['where']=_[_0x6b47('0x46')](_0x3f9a42['where'],{'$or':_[_0x6b47('0x33')](_0x4948f2,function(_0x4c82b0){if(_0x4c82b0[_0x6b47('0x36')]!==_0x6b47('0x47')){var _0x28d939={};_0x28d939[_0x4c82b0[_0x6b47('0x31')]]={'$like':'%'+_0x5c24a7['query'][_0x6b47('0x45')]+'%'};return _0x28d939;}})});}_0x3f9a42=_[_0x6b47('0x46')]({},_0x3f9a42,_0x5c24a7[_0x6b47('0x48')]);var _0x504ba3={'where':_0x3f9a42[_0x6b47('0x43')]};return db[_0x6b47('0x49')]['count'](_0x504ba3)[_0x6b47('0x1b')](function(_0x1b669e){_0x7ca482[_0x6b47('0x2b')]=_0x1b669e;if(_0x5c24a7[_0x6b47('0x39')][_0x6b47('0x4a')]){_0x3f9a42['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0x6b47('0x4b')](_0x3f9a42);})['then'](function(_0x39ff4c){_0x7ca482[_0x6b47('0x4c')]=_0x39ff4c;return _0x7ca482;})['then'](respondWithFilteredResult(_0x4ba929,_0x3f9a42))[_0x6b47('0x23')](handleError(_0x4ba929,null));};exports[_0x6b47('0x4d')]=function(_0x46de9c,_0x4994f8){var _0x5c3d10={'raw':![],'where':{'id':_0x46de9c['params']['id']}},_0xbaf977={};_0xbaf977[_0x6b47('0x38')]=_[_0x6b47('0x3a')](db[_0x6b47('0x49')]['rawAttributes']);_0xbaf977[_0x6b47('0x39')]=_[_0x6b47('0x3a')](_0x46de9c[_0x6b47('0x39')]);_0xbaf977[_0x6b47('0x3b')]=_[_0x6b47('0x3c')](_0xbaf977[_0x6b47('0x38')],_0xbaf977[_0x6b47('0x39')]);_0x5c3d10[_0x6b47('0x3d')]=_[_0x6b47('0x3c')](_0xbaf977[_0x6b47('0x38')],qs[_0x6b47('0x3e')](_0x46de9c[_0x6b47('0x39')][_0x6b47('0x3e')]));_0x5c3d10['attributes']=_0x5c3d10[_0x6b47('0x3d')][_0x6b47('0x3f')]?_0x5c3d10['attributes']:_0xbaf977[_0x6b47('0x38')];if(_0x46de9c[_0x6b47('0x39')][_0x6b47('0x4a')]){_0x5c3d10[_0x6b47('0x4e')]=[{'all':!![]}];}_0x5c3d10=_[_0x6b47('0x46')]({},_0x5c3d10,_0x46de9c['options']);return db[_0x6b47('0x49')][_0x6b47('0x4f')](_0x5c3d10)[_0x6b47('0x1b')](handleEntityNotFound(_0x4994f8,null))[_0x6b47('0x1b')](respondWithResult(_0x4994f8,null))['catch'](handleError(_0x4994f8,null));};exports[_0x6b47('0x50')]=function(_0x5a4a2c,_0x1bb7e9){return db['VtigerConfiguration']['create'](_0x5a4a2c['body'],{})[_0x6b47('0x1b')](respondWithResult(_0x1bb7e9,0xc9))['catch'](handleError(_0x1bb7e9,null));};exports[_0x6b47('0x51')]=function(_0x312cd5,_0x1bc8ba){if(_0x312cd5['body']['id']){delete _0x312cd5[_0x6b47('0x52')]['id'];}return db[_0x6b47('0x49')][_0x6b47('0x4f')]({'where':{'id':_0x312cd5[_0x6b47('0x53')]['id']}})[_0x6b47('0x1b')](handleEntityNotFound(_0x1bc8ba,null))[_0x6b47('0x1b')](saveUpdates(_0x312cd5['body'],null))[_0x6b47('0x1b')](respondWithResult(_0x1bc8ba,null))[_0x6b47('0x23')](handleError(_0x1bc8ba,null));};exports[_0x6b47('0x30')]=function(_0x2fe782,_0x184a17){return db[_0x6b47('0x49')][_0x6b47('0x4f')]({'where':{'id':_0x2fe782[_0x6b47('0x53')]['id']}})[_0x6b47('0x1b')](handleEntityNotFound(_0x184a17,null))[_0x6b47('0x1b')](removeEntity(_0x184a17,null))[_0x6b47('0x23')](handleError(_0x184a17,null));};exports[_0x6b47('0x54')]=function(_0x3eb8ce,_0x253bd1,_0x2bd8a1){var _0x9c7fdb={};var _0x5249ee={};var _0x52ae03;var _0x4c7f6c;return db[_0x6b47('0x49')][_0x6b47('0x55')]({'where':{'id':_0x3eb8ce['params']['id']}})['then'](handleEntityNotFound(_0x253bd1,null))[_0x6b47('0x1b')](function(_0x27f5fb){if(_0x27f5fb){_0x52ae03=_0x27f5fb;_0x5249ee[_0x6b47('0x38')]=_[_0x6b47('0x3a')](db[_0x6b47('0x56')][_0x6b47('0x34')]);_0x5249ee[_0x6b47('0x39')]=_[_0x6b47('0x3a')](_0x3eb8ce['query']);_0x5249ee[_0x6b47('0x3b')]=_[_0x6b47('0x3c')](_0x5249ee[_0x6b47('0x38')],_0x5249ee[_0x6b47('0x39')]);_0x9c7fdb[_0x6b47('0x3d')]=_[_0x6b47('0x3c')](_0x5249ee[_0x6b47('0x38')],qs['fields'](_0x3eb8ce[_0x6b47('0x39')][_0x6b47('0x3e')]));_0x9c7fdb['attributes']=_0x9c7fdb[_0x6b47('0x3d')][_0x6b47('0x3f')]?_0x9c7fdb[_0x6b47('0x3d')]:_0x5249ee['model'];_0x9c7fdb['order']=qs['sort'](_0x3eb8ce[_0x6b47('0x39')][_0x6b47('0x57')]);_0x9c7fdb[_0x6b47('0x43')]=qs[_0x6b47('0x3b')](_[_0x6b47('0x44')](_0x3eb8ce[_0x6b47('0x39')],_0x5249ee[_0x6b47('0x3b')]));if(_0x3eb8ce[_0x6b47('0x39')][_0x6b47('0x45')]){_0x9c7fdb['where']=_[_0x6b47('0x46')](_0x9c7fdb['where'],{'$or':_[_0x6b47('0x33')](_0x9c7fdb[_0x6b47('0x3d')],function(_0x544085){var _0x233231={};_0x233231[_0x544085]={'$like':'%'+_0x3eb8ce[_0x6b47('0x39')][_0x6b47('0x45')]+'%'};return _0x233231;})});}_0x9c7fdb=_[_0x6b47('0x46')]({},_0x9c7fdb,_0x3eb8ce['options']);return _0x52ae03[_0x6b47('0x54')](_0x9c7fdb);}})['then'](function(_0x4a09ee){if(_0x4a09ee){_0x4c7f6c=_0x4a09ee[_0x6b47('0x3f')];if(!_0x3eb8ce['query']['hasOwnProperty'](_0x6b47('0x41'))){_0x9c7fdb['limit']=qs[_0x6b47('0x2a')](_0x3eb8ce[_0x6b47('0x39')][_0x6b47('0x2a')]);_0x9c7fdb['offset']=qs[_0x6b47('0x28')](_0x3eb8ce[_0x6b47('0x39')][_0x6b47('0x28')]);}return _0x52ae03['getFields'](_0x9c7fdb);}})[_0x6b47('0x1b')](function(_0x3de489){if(_0x3de489){return _0x3de489?{'count':_0x4c7f6c,'rows':_0x3de489}:null;}})[_0x6b47('0x1b')](respondWithResult(_0x253bd1,null))[_0x6b47('0x23')](handleError(_0x253bd1,null));};exports[_0x6b47('0x58')]=function(_0x1c58cb,_0x843b8b,_0x2b8b7a){var _0x48f7f6={};var _0x30e3b4={};var _0x5be68c;var _0x3abed0;return db[_0x6b47('0x49')][_0x6b47('0x55')]({'where':{'id':_0x1c58cb['params']['id']}})[_0x6b47('0x1b')](handleEntityNotFound(_0x843b8b,null))[_0x6b47('0x1b')](function(_0x55e836){if(_0x55e836){_0x5be68c=_0x55e836;_0x30e3b4['model']=_[_0x6b47('0x3a')](db[_0x6b47('0x56')][_0x6b47('0x34')]);_0x30e3b4[_0x6b47('0x39')]=_[_0x6b47('0x3a')](_0x1c58cb[_0x6b47('0x39')]);_0x30e3b4[_0x6b47('0x3b')]=_[_0x6b47('0x3c')](_0x30e3b4[_0x6b47('0x38')],_0x30e3b4[_0x6b47('0x39')]);_0x48f7f6['attributes']=_[_0x6b47('0x3c')](_0x30e3b4[_0x6b47('0x38')],qs[_0x6b47('0x3e')](_0x1c58cb[_0x6b47('0x39')][_0x6b47('0x3e')]));_0x48f7f6[_0x6b47('0x3d')]=_0x48f7f6[_0x6b47('0x3d')]['length']?_0x48f7f6[_0x6b47('0x3d')]:_0x30e3b4[_0x6b47('0x38')];_0x48f7f6[_0x6b47('0x42')]=qs[_0x6b47('0x57')](_0x1c58cb['query'][_0x6b47('0x57')]);_0x48f7f6[_0x6b47('0x43')]=qs['filters'](_[_0x6b47('0x44')](_0x1c58cb['query'],_0x30e3b4[_0x6b47('0x3b')]));if(_0x1c58cb[_0x6b47('0x39')][_0x6b47('0x45')]){_0x48f7f6[_0x6b47('0x43')]=_[_0x6b47('0x46')](_0x48f7f6[_0x6b47('0x43')],{'$or':_['map'](_0x48f7f6[_0x6b47('0x3d')],function(_0x86e34b){var _0x50089f={};_0x50089f[_0x86e34b]={'$like':'%'+_0x1c58cb[_0x6b47('0x39')]['filter']+'%'};return _0x50089f;})});}_0x48f7f6=_[_0x6b47('0x46')]({},_0x48f7f6,_0x1c58cb[_0x6b47('0x48')]);return _0x5be68c[_0x6b47('0x58')](_0x48f7f6);}})[_0x6b47('0x1b')](function(_0x19b76c){if(_0x19b76c){_0x3abed0=_0x19b76c[_0x6b47('0x3f')];if(!_0x1c58cb[_0x6b47('0x39')]['hasOwnProperty']('nolimit')){_0x48f7f6['limit']=qs[_0x6b47('0x2a')](_0x1c58cb['query']['limit']);_0x48f7f6[_0x6b47('0x28')]=qs[_0x6b47('0x28')](_0x1c58cb['query'][_0x6b47('0x28')]);}return _0x5be68c[_0x6b47('0x58')](_0x48f7f6);}})['then'](function(_0x220933){if(_0x220933){return _0x220933?{'count':_0x3abed0,'rows':_0x220933}:null;}})[_0x6b47('0x1b')](respondWithResult(_0x843b8b,null))['catch'](handleError(_0x843b8b,null));};exports[_0x6b47('0x59')]=function(_0x1be597,_0x5ec8df,_0x463e1d){var _0x18d8fa={};var _0x1ef0ba={};var _0x596240;var _0x251ae4;return db[_0x6b47('0x49')][_0x6b47('0x55')]({'where':{'id':_0x1be597[_0x6b47('0x53')]['id']}})[_0x6b47('0x1b')](handleEntityNotFound(_0x5ec8df,null))[_0x6b47('0x1b')](function(_0x8cb104){if(_0x8cb104){_0x596240=_0x8cb104;_0x1ef0ba[_0x6b47('0x38')]=_[_0x6b47('0x3a')](db[_0x6b47('0x56')][_0x6b47('0x34')]);_0x1ef0ba['query']=_[_0x6b47('0x3a')](_0x1be597['query']);_0x1ef0ba[_0x6b47('0x3b')]=_[_0x6b47('0x3c')](_0x1ef0ba[_0x6b47('0x38')],_0x1ef0ba[_0x6b47('0x39')]);_0x18d8fa[_0x6b47('0x3d')]=_[_0x6b47('0x3c')](_0x1ef0ba[_0x6b47('0x38')],qs[_0x6b47('0x3e')](_0x1be597[_0x6b47('0x39')][_0x6b47('0x3e')]));_0x18d8fa[_0x6b47('0x3d')]=_0x18d8fa[_0x6b47('0x3d')][_0x6b47('0x3f')]?_0x18d8fa['attributes']:_0x1ef0ba[_0x6b47('0x38')];_0x18d8fa[_0x6b47('0x42')]=qs['sort'](_0x1be597[_0x6b47('0x39')][_0x6b47('0x57')]);_0x18d8fa[_0x6b47('0x43')]=qs[_0x6b47('0x3b')](_['pick'](_0x1be597['query'],_0x1ef0ba[_0x6b47('0x3b')]));if(_0x1be597[_0x6b47('0x39')][_0x6b47('0x45')]){_0x18d8fa[_0x6b47('0x43')]=_['merge'](_0x18d8fa[_0x6b47('0x43')],{'$or':_[_0x6b47('0x33')](_0x18d8fa['attributes'],function(_0x463765){var _0x36b140={};_0x36b140[_0x463765]={'$like':'%'+_0x1be597['query']['filter']+'%'};return _0x36b140;})});}_0x18d8fa=_[_0x6b47('0x46')]({},_0x18d8fa,_0x1be597[_0x6b47('0x48')]);return _0x596240['getDescriptions'](_0x18d8fa);}})[_0x6b47('0x1b')](function(_0x6dbe7){if(_0x6dbe7){_0x251ae4=_0x6dbe7[_0x6b47('0x3f')];if(!_0x1be597['query'][_0x6b47('0x40')](_0x6b47('0x41'))){_0x18d8fa[_0x6b47('0x2a')]=qs[_0x6b47('0x2a')](_0x1be597[_0x6b47('0x39')][_0x6b47('0x2a')]);_0x18d8fa[_0x6b47('0x28')]=qs[_0x6b47('0x28')](_0x1be597['query'][_0x6b47('0x28')]);}return _0x596240['getDescriptions'](_0x18d8fa);}})[_0x6b47('0x1b')](function(_0x3e7358){if(_0x3e7358){return _0x3e7358?{'count':_0x251ae4,'rows':_0x3e7358}:null;}})[_0x6b47('0x1b')](respondWithResult(_0x5ec8df,null))[_0x6b47('0x23')](handleError(_0x5ec8df,null));}; \ No newline at end of file +var _0xc5c4=['../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','destroy','stack','send','VtigerConfiguration','rawAttributes','fieldName','type','key','map','name','filters','intersection','model','attributes','query','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','show','keys','find','create','body','params','order','getFields','nolimit','getSubjects','findOne','VtigerField','getDescriptions','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x57357b,_0x22d830){var _0x12b8c1=function(_0x264051){while(--_0x264051){_0x57357b['push'](_0x57357b['shift']());}};_0x12b8c1(++_0x22d830);}(_0xc5c4,0xa1));var _0x4c5c=function(_0x1710be,_0x227cdf){_0x1710be=_0x1710be-0x0;var _0x5bac42=_0xc5c4[_0x1710be];return _0x5bac42;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c5c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c5c('0x1'));var moment=require(_0x4c5c('0x2'));var BPromise=require(_0x4c5c('0x3'));var Mustache=require(_0x4c5c('0x4'));var util=require(_0x4c5c('0x5'));var path=require(_0x4c5c('0x6'));var sox=require(_0x4c5c('0x7'));var csv=require(_0x4c5c('0x8'));var ejs=require(_0x4c5c('0x9'));var fs=require('fs');var fs_extra=require(_0x4c5c('0xa'));var _=require(_0x4c5c('0xb'));var squel=require(_0x4c5c('0xc'));var crypto=require('crypto');var jsforce=require(_0x4c5c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4c5c('0xe'));var Papa=require(_0x4c5c('0xf'));var Redis=require(_0x4c5c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4c5c('0x11'));var hardwareService=require(_0x4c5c('0x12'));var logger=require(_0x4c5c('0x13'))(_0x4c5c('0x14'));var utils=require(_0x4c5c('0x15'));var config=require(_0x4c5c('0x16'));var licenseUtil=require(_0x4c5c('0x17'));var db=require(_0x4c5c('0x18'))['db'];var jayson=require(_0x4c5c('0x19'));var client=jayson[_0x4c5c('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x433d70,_0x175f2c,_0x2150b4,_0x2bd3a7){return new BPromise(function(_0x23166f,_0x1435ce){var _0x39c29f=_0x2bd3a7||client;return _0x39c29f[_0x4c5c('0x1b')](_0x433d70,_0x2150b4)[_0x4c5c('0x1c')](function(_0x18c1c0){logger[_0x4c5c('0x1d')](_0x4c5c('0x1e'),_0x175f2c,_0x4c5c('0x1f'));logger[_0x4c5c('0x20')](_0x4c5c('0x21'),_0x175f2c,_0x4c5c('0x1f'),JSON[_0x4c5c('0x22')](_0x18c1c0));if(_0x18c1c0['error']){if(_0x18c1c0[_0x4c5c('0x23')][_0x4c5c('0x24')]===0x1f4){logger[_0x4c5c('0x23')](_0x4c5c('0x1e'),_0x175f2c,_0x18c1c0[_0x4c5c('0x23')][_0x4c5c('0x25')]);return _0x1435ce(_0x18c1c0[_0x4c5c('0x23')][_0x4c5c('0x25')]);}logger['error'](_0x4c5c('0x1e'),_0x175f2c,_0x18c1c0['error'][_0x4c5c('0x25')]);return _0x23166f(_0x18c1c0['error']['message']);}else{logger['info'](_0x4c5c('0x1e'),_0x175f2c,_0x4c5c('0x1f'));_0x23166f(_0x18c1c0[_0x4c5c('0x26')][_0x4c5c('0x25')]);}})[_0x4c5c('0x27')](function(_0x42a59d){logger[_0x4c5c('0x23')](_0x4c5c('0x1e'),_0x175f2c,_0x42a59d);_0x1435ce(_0x42a59d);});});}function respondWithStatusCode(_0x2030b5,_0x1f81a0){_0x1f81a0=_0x1f81a0||0xcc;return function(_0x1c72de){if(_0x1c72de){return _0x2030b5[_0x4c5c('0x28')](_0x1f81a0);}return _0x2030b5[_0x4c5c('0x29')](_0x1f81a0)[_0x4c5c('0x2a')]();};}function respondWithResult(_0x431276,_0x9a050c){_0x9a050c=_0x9a050c||0xc8;return function(_0x4320d7){if(_0x4320d7){return _0x431276[_0x4c5c('0x29')](_0x9a050c)[_0x4c5c('0x2b')](_0x4320d7);}};}function respondWithFilteredResult(_0x1a548c,_0x51e8b7){return function(_0x1d0c3a){if(_0x1d0c3a){var _0x191250=typeof _0x51e8b7['offset']==='undefined'&&typeof _0x51e8b7['limit']===_0x4c5c('0x2c');var _0x62be75=_0x1d0c3a['count'];var _0x3db406=_0x191250?0x0:_0x51e8b7[_0x4c5c('0x2d')];var _0xc741d7=_0x191250?_0x1d0c3a[_0x4c5c('0x2e')]:_0x51e8b7[_0x4c5c('0x2d')]+_0x51e8b7[_0x4c5c('0x2f')];var _0x381cba;if(_0xc741d7>=_0x62be75){_0xc741d7=_0x62be75;_0x381cba=0xc8;}else{_0x381cba=0xce;}_0x1a548c[_0x4c5c('0x29')](_0x381cba);return _0x1a548c[_0x4c5c('0x30')](_0x4c5c('0x31'),_0x3db406+'-'+_0xc741d7+'/'+_0x62be75)[_0x4c5c('0x2b')](_0x1d0c3a);}return null;};}function patchUpdates(_0x139890){return function(_0x15d08e){try{jsonpatch[_0x4c5c('0x32')](_0x15d08e,_0x139890,!![]);}catch(_0x484ade){return BPromise['reject'](_0x484ade);}return _0x15d08e[_0x4c5c('0x33')]();};}function saveUpdates(_0x411b55,_0x2fc833){return function(_0x100703){if(_0x100703){return _0x100703['update'](_0x411b55)['then'](function(_0x49f9c4){return _0x49f9c4;});}return null;};}function removeEntity(_0x2d12ea,_0x27baf1){return function(_0x3c6561){if(_0x3c6561){return _0x3c6561[_0x4c5c('0x34')]()[_0x4c5c('0x1c')](function(){_0x2d12ea[_0x4c5c('0x29')](0xcc)[_0x4c5c('0x2a')]();});}};}function handleEntityNotFound(_0x4e2082,_0x97622){return function(_0x4e4166){if(!_0x4e4166){_0x4e2082['sendStatus'](0x194);}return _0x4e4166;};}function handleError(_0x377524,_0x1382da){_0x1382da=_0x1382da||0x1f4;return function(_0x13793f){logger[_0x4c5c('0x23')](_0x13793f[_0x4c5c('0x35')]);if(_0x13793f['name']){delete _0x13793f['name'];}_0x377524[_0x4c5c('0x29')](_0x1382da)[_0x4c5c('0x36')](_0x13793f);};}exports['index']=function(_0x531aa5,_0x1d75c5){var _0x4aa7a0={},_0x4526e5={},_0x7069ce={'count':0x0,'rows':[]};var _0x4b2468=_['map'](db[_0x4c5c('0x37')][_0x4c5c('0x38')],function(_0x39c03d){return{'name':_0x39c03d[_0x4c5c('0x39')],'type':_0x39c03d[_0x4c5c('0x3a')][_0x4c5c('0x3b')]};});_0x4526e5['model']=_[_0x4c5c('0x3c')](_0x4b2468,_0x4c5c('0x3d'));_0x4526e5['query']=_['keys'](_0x531aa5['query']);_0x4526e5[_0x4c5c('0x3e')]=_[_0x4c5c('0x3f')](_0x4526e5[_0x4c5c('0x40')],_0x4526e5['query']);_0x4aa7a0[_0x4c5c('0x41')]=_['intersection'](_0x4526e5['model'],qs['fields'](_0x531aa5[_0x4c5c('0x42')][_0x4c5c('0x43')]));_0x4aa7a0[_0x4c5c('0x41')]=_0x4aa7a0['attributes'][_0x4c5c('0x44')]?_0x4aa7a0[_0x4c5c('0x41')]:_0x4526e5[_0x4c5c('0x40')];if(!_0x531aa5[_0x4c5c('0x42')][_0x4c5c('0x45')]('nolimit')){_0x4aa7a0['limit']=qs[_0x4c5c('0x2f')](_0x531aa5[_0x4c5c('0x42')][_0x4c5c('0x2f')]);_0x4aa7a0[_0x4c5c('0x2d')]=qs[_0x4c5c('0x2d')](_0x531aa5[_0x4c5c('0x42')][_0x4c5c('0x2d')]);}_0x4aa7a0['order']=qs['sort'](_0x531aa5['query'][_0x4c5c('0x46')]);_0x4aa7a0[_0x4c5c('0x47')]=qs[_0x4c5c('0x3e')](_[_0x4c5c('0x48')](_0x531aa5[_0x4c5c('0x42')],_0x4526e5[_0x4c5c('0x3e')]),_0x4b2468);if(_0x531aa5[_0x4c5c('0x42')][_0x4c5c('0x49')]){_0x4aa7a0[_0x4c5c('0x47')]=_['merge'](_0x4aa7a0['where'],{'$or':_[_0x4c5c('0x3c')](_0x4b2468,function(_0x26cea9){if(_0x26cea9[_0x4c5c('0x3a')]!==_0x4c5c('0x4a')){var _0x4b0242={};_0x4b0242[_0x26cea9[_0x4c5c('0x3d')]]={'$like':'%'+_0x531aa5[_0x4c5c('0x42')][_0x4c5c('0x49')]+'%'};return _0x4b0242;}})});}_0x4aa7a0=_[_0x4c5c('0x4b')]({},_0x4aa7a0,_0x531aa5[_0x4c5c('0x4c')]);var _0x48f8d8={'where':_0x4aa7a0[_0x4c5c('0x47')]};return db[_0x4c5c('0x37')]['count'](_0x48f8d8)[_0x4c5c('0x1c')](function(_0x83d5e3){_0x7069ce[_0x4c5c('0x2e')]=_0x83d5e3;if(_0x531aa5[_0x4c5c('0x42')][_0x4c5c('0x4d')]){_0x4aa7a0[_0x4c5c('0x4e')]=[{'all':!![]}];}return db[_0x4c5c('0x37')]['findAll'](_0x4aa7a0);})[_0x4c5c('0x1c')](function(_0xec753f){_0x7069ce['rows']=_0xec753f;return _0x7069ce;})[_0x4c5c('0x1c')](respondWithFilteredResult(_0x1d75c5,_0x4aa7a0))['catch'](handleError(_0x1d75c5,null));};exports[_0x4c5c('0x4f')]=function(_0x5755bf,_0x4278e7){var _0x589cba={'raw':![],'where':{'id':_0x5755bf['params']['id']}},_0x2179dc={};_0x2179dc[_0x4c5c('0x40')]=_[_0x4c5c('0x50')](db[_0x4c5c('0x37')]['rawAttributes']);_0x2179dc[_0x4c5c('0x42')]=_[_0x4c5c('0x50')](_0x5755bf[_0x4c5c('0x42')]);_0x2179dc['filters']=_[_0x4c5c('0x3f')](_0x2179dc[_0x4c5c('0x40')],_0x2179dc['query']);_0x589cba[_0x4c5c('0x41')]=_[_0x4c5c('0x3f')](_0x2179dc[_0x4c5c('0x40')],qs[_0x4c5c('0x43')](_0x5755bf[_0x4c5c('0x42')][_0x4c5c('0x43')]));_0x589cba[_0x4c5c('0x41')]=_0x589cba[_0x4c5c('0x41')][_0x4c5c('0x44')]?_0x589cba[_0x4c5c('0x41')]:_0x2179dc[_0x4c5c('0x40')];if(_0x5755bf[_0x4c5c('0x42')][_0x4c5c('0x4d')]){_0x589cba[_0x4c5c('0x4e')]=[{'all':!![]}];}_0x589cba=_[_0x4c5c('0x4b')]({},_0x589cba,_0x5755bf[_0x4c5c('0x4c')]);return db[_0x4c5c('0x37')][_0x4c5c('0x51')](_0x589cba)[_0x4c5c('0x1c')](handleEntityNotFound(_0x4278e7,null))['then'](respondWithResult(_0x4278e7,null))[_0x4c5c('0x27')](handleError(_0x4278e7,null));};exports[_0x4c5c('0x52')]=function(_0x3ca3b8,_0x46b851){return db[_0x4c5c('0x37')]['create'](_0x3ca3b8[_0x4c5c('0x53')],{})[_0x4c5c('0x1c')](respondWithResult(_0x46b851,0xc9))['catch'](handleError(_0x46b851,null));};exports['update']=function(_0x3cebaf,_0xfe19ec){if(_0x3cebaf[_0x4c5c('0x53')]['id']){delete _0x3cebaf[_0x4c5c('0x53')]['id'];}return db[_0x4c5c('0x37')][_0x4c5c('0x51')]({'where':{'id':_0x3cebaf[_0x4c5c('0x54')]['id']}})[_0x4c5c('0x1c')](handleEntityNotFound(_0xfe19ec,null))['then'](saveUpdates(_0x3cebaf['body'],null))[_0x4c5c('0x1c')](respondWithResult(_0xfe19ec,null))['catch'](handleError(_0xfe19ec,null));};exports[_0x4c5c('0x34')]=function(_0x5d868d,_0x5b7fa2){return db[_0x4c5c('0x37')]['find']({'where':{'id':_0x5d868d[_0x4c5c('0x54')]['id']}})[_0x4c5c('0x1c')](handleEntityNotFound(_0x5b7fa2,null))[_0x4c5c('0x1c')](removeEntity(_0x5b7fa2,null))[_0x4c5c('0x27')](handleError(_0x5b7fa2,null));};exports['getFields']=function(_0x5eb79b,_0x1eaa76,_0x238f72){var _0x2b0790={};var _0x462ff5={};var _0x28b5e7;var _0x4ea0b1;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x5eb79b['params']['id']}})['then'](handleEntityNotFound(_0x1eaa76,null))[_0x4c5c('0x1c')](function(_0x3a12bd){if(_0x3a12bd){_0x28b5e7=_0x3a12bd;_0x462ff5[_0x4c5c('0x40')]=_[_0x4c5c('0x50')](db['VtigerField'][_0x4c5c('0x38')]);_0x462ff5[_0x4c5c('0x42')]=_[_0x4c5c('0x50')](_0x5eb79b[_0x4c5c('0x42')]);_0x462ff5[_0x4c5c('0x3e')]=_[_0x4c5c('0x3f')](_0x462ff5['model'],_0x462ff5[_0x4c5c('0x42')]);_0x2b0790[_0x4c5c('0x41')]=_[_0x4c5c('0x3f')](_0x462ff5[_0x4c5c('0x40')],qs[_0x4c5c('0x43')](_0x5eb79b[_0x4c5c('0x42')][_0x4c5c('0x43')]));_0x2b0790[_0x4c5c('0x41')]=_0x2b0790[_0x4c5c('0x41')][_0x4c5c('0x44')]?_0x2b0790[_0x4c5c('0x41')]:_0x462ff5[_0x4c5c('0x40')];_0x2b0790[_0x4c5c('0x55')]=qs[_0x4c5c('0x46')](_0x5eb79b[_0x4c5c('0x42')]['sort']);_0x2b0790[_0x4c5c('0x47')]=qs[_0x4c5c('0x3e')](_[_0x4c5c('0x48')](_0x5eb79b['query'],_0x462ff5['filters']));if(_0x5eb79b['query'][_0x4c5c('0x49')]){_0x2b0790[_0x4c5c('0x47')]=_[_0x4c5c('0x4b')](_0x2b0790[_0x4c5c('0x47')],{'$or':_[_0x4c5c('0x3c')](_0x2b0790[_0x4c5c('0x41')],function(_0x1a01a2){var _0x46cc7e={};_0x46cc7e[_0x1a01a2]={'$like':'%'+_0x5eb79b[_0x4c5c('0x42')][_0x4c5c('0x49')]+'%'};return _0x46cc7e;})});}_0x2b0790=_[_0x4c5c('0x4b')]({},_0x2b0790,_0x5eb79b['options']);return _0x28b5e7[_0x4c5c('0x56')](_0x2b0790);}})['then'](function(_0xf4fe98){if(_0xf4fe98){_0x4ea0b1=_0xf4fe98[_0x4c5c('0x44')];if(!_0x5eb79b['query']['hasOwnProperty'](_0x4c5c('0x57'))){_0x2b0790['limit']=qs[_0x4c5c('0x2f')](_0x5eb79b['query']['limit']);_0x2b0790[_0x4c5c('0x2d')]=qs[_0x4c5c('0x2d')](_0x5eb79b[_0x4c5c('0x42')][_0x4c5c('0x2d')]);}return _0x28b5e7[_0x4c5c('0x56')](_0x2b0790);}})[_0x4c5c('0x1c')](function(_0x485561){if(_0x485561){return _0x485561?{'count':_0x4ea0b1,'rows':_0x485561}:null;}})[_0x4c5c('0x1c')](respondWithResult(_0x1eaa76,null))[_0x4c5c('0x27')](handleError(_0x1eaa76,null));};exports[_0x4c5c('0x58')]=function(_0x5b2165,_0x5c0b34,_0x226d20){var _0xdbb7a1={};var _0x19c33a={};var _0x54901f;var _0x32c8d7;return db[_0x4c5c('0x37')][_0x4c5c('0x59')]({'where':{'id':_0x5b2165[_0x4c5c('0x54')]['id']}})[_0x4c5c('0x1c')](handleEntityNotFound(_0x5c0b34,null))[_0x4c5c('0x1c')](function(_0x179b9a){if(_0x179b9a){_0x54901f=_0x179b9a;_0x19c33a[_0x4c5c('0x40')]=_[_0x4c5c('0x50')](db[_0x4c5c('0x5a')]['rawAttributes']);_0x19c33a[_0x4c5c('0x42')]=_[_0x4c5c('0x50')](_0x5b2165[_0x4c5c('0x42')]);_0x19c33a['filters']=_[_0x4c5c('0x3f')](_0x19c33a[_0x4c5c('0x40')],_0x19c33a[_0x4c5c('0x42')]);_0xdbb7a1['attributes']=_[_0x4c5c('0x3f')](_0x19c33a[_0x4c5c('0x40')],qs['fields'](_0x5b2165[_0x4c5c('0x42')][_0x4c5c('0x43')]));_0xdbb7a1[_0x4c5c('0x41')]=_0xdbb7a1[_0x4c5c('0x41')][_0x4c5c('0x44')]?_0xdbb7a1[_0x4c5c('0x41')]:_0x19c33a['model'];_0xdbb7a1[_0x4c5c('0x55')]=qs[_0x4c5c('0x46')](_0x5b2165[_0x4c5c('0x42')][_0x4c5c('0x46')]);_0xdbb7a1[_0x4c5c('0x47')]=qs[_0x4c5c('0x3e')](_[_0x4c5c('0x48')](_0x5b2165[_0x4c5c('0x42')],_0x19c33a['filters']));if(_0x5b2165[_0x4c5c('0x42')]['filter']){_0xdbb7a1[_0x4c5c('0x47')]=_[_0x4c5c('0x4b')](_0xdbb7a1['where'],{'$or':_['map'](_0xdbb7a1[_0x4c5c('0x41')],function(_0x248633){var _0x40b11a={};_0x40b11a[_0x248633]={'$like':'%'+_0x5b2165['query']['filter']+'%'};return _0x40b11a;})});}_0xdbb7a1=_[_0x4c5c('0x4b')]({},_0xdbb7a1,_0x5b2165[_0x4c5c('0x4c')]);return _0x54901f[_0x4c5c('0x58')](_0xdbb7a1);}})[_0x4c5c('0x1c')](function(_0x338294){if(_0x338294){_0x32c8d7=_0x338294[_0x4c5c('0x44')];if(!_0x5b2165['query'][_0x4c5c('0x45')]('nolimit')){_0xdbb7a1['limit']=qs[_0x4c5c('0x2f')](_0x5b2165[_0x4c5c('0x42')][_0x4c5c('0x2f')]);_0xdbb7a1[_0x4c5c('0x2d')]=qs[_0x4c5c('0x2d')](_0x5b2165['query'][_0x4c5c('0x2d')]);}return _0x54901f[_0x4c5c('0x58')](_0xdbb7a1);}})['then'](function(_0x184fda){if(_0x184fda){return _0x184fda?{'count':_0x32c8d7,'rows':_0x184fda}:null;}})['then'](respondWithResult(_0x5c0b34,null))[_0x4c5c('0x27')](handleError(_0x5c0b34,null));};exports['getDescriptions']=function(_0x30d295,_0x13a91f,_0x221668){var _0x4ce217={};var _0x33de17={};var _0x225d27;var _0x448b97;return db['VtigerConfiguration'][_0x4c5c('0x59')]({'where':{'id':_0x30d295['params']['id']}})[_0x4c5c('0x1c')](handleEntityNotFound(_0x13a91f,null))['then'](function(_0x10129f){if(_0x10129f){_0x225d27=_0x10129f;_0x33de17[_0x4c5c('0x40')]=_[_0x4c5c('0x50')](db[_0x4c5c('0x5a')][_0x4c5c('0x38')]);_0x33de17['query']=_[_0x4c5c('0x50')](_0x30d295['query']);_0x33de17[_0x4c5c('0x3e')]=_[_0x4c5c('0x3f')](_0x33de17[_0x4c5c('0x40')],_0x33de17[_0x4c5c('0x42')]);_0x4ce217[_0x4c5c('0x41')]=_[_0x4c5c('0x3f')](_0x33de17[_0x4c5c('0x40')],qs[_0x4c5c('0x43')](_0x30d295['query'][_0x4c5c('0x43')]));_0x4ce217['attributes']=_0x4ce217[_0x4c5c('0x41')][_0x4c5c('0x44')]?_0x4ce217[_0x4c5c('0x41')]:_0x33de17[_0x4c5c('0x40')];_0x4ce217['order']=qs[_0x4c5c('0x46')](_0x30d295[_0x4c5c('0x42')][_0x4c5c('0x46')]);_0x4ce217[_0x4c5c('0x47')]=qs[_0x4c5c('0x3e')](_[_0x4c5c('0x48')](_0x30d295[_0x4c5c('0x42')],_0x33de17['filters']));if(_0x30d295[_0x4c5c('0x42')]['filter']){_0x4ce217[_0x4c5c('0x47')]=_['merge'](_0x4ce217['where'],{'$or':_[_0x4c5c('0x3c')](_0x4ce217[_0x4c5c('0x41')],function(_0x5842ce){var _0xc00aa3={};_0xc00aa3[_0x5842ce]={'$like':'%'+_0x30d295[_0x4c5c('0x42')]['filter']+'%'};return _0xc00aa3;})});}_0x4ce217=_['merge']({},_0x4ce217,_0x30d295[_0x4c5c('0x4c')]);return _0x225d27[_0x4c5c('0x5b')](_0x4ce217);}})[_0x4c5c('0x1c')](function(_0x58b2fc){if(_0x58b2fc){_0x448b97=_0x58b2fc[_0x4c5c('0x44')];if(!_0x30d295[_0x4c5c('0x42')][_0x4c5c('0x45')](_0x4c5c('0x57'))){_0x4ce217[_0x4c5c('0x2f')]=qs['limit'](_0x30d295[_0x4c5c('0x42')][_0x4c5c('0x2f')]);_0x4ce217[_0x4c5c('0x2d')]=qs['offset'](_0x30d295[_0x4c5c('0x42')][_0x4c5c('0x2d')]);}return _0x225d27['getDescriptions'](_0x4ce217);}})[_0x4c5c('0x1c')](function(_0x293952){if(_0x293952){return _0x293952?{'count':_0x448b97,'rows':_0x293952}:null;}})[_0x4c5c('0x1c')](respondWithResult(_0x13a91f,null))[_0x4c5c('0x27')](handleError(_0x13a91f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 4c83910..b51f722 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 _0x1d39=['./intVtigerConfiguration.attributes','define','int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x25222b,_0x4f2c21){var _0x386cec=function(_0x4a7d89){while(--_0x4a7d89){_0x25222b['push'](_0x25222b['shift']());}};_0x386cec(++_0x4f2c21);}(_0x1d39,0x8f));var _0x91d3=function(_0x5d6d88,_0x3e941e){_0x5d6d88=_0x5d6d88-0x0;var _0x3a5905=_0x1d39[_0x5d6d88];return _0x3a5905;};'use strict';var _=require('lodash');var util=require(_0x91d3('0x0'));var logger=require(_0x91d3('0x1'))(_0x91d3('0x2'));var moment=require(_0x91d3('0x3'));var BPromise=require(_0x91d3('0x4'));var rp=require(_0x91d3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x91d3('0x6'));var attributes=require(_0x91d3('0x7'));module['exports']=function(_0x25458a,_0x1f4d7d){return _0x25458a[_0x91d3('0x8')]('VtigerConfiguration',attributes,{'tableName':_0x91d3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf07b=['moment','bluebird','request-promise','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','api'];(function(_0x8b62a9,_0x17b817){var _0x1a9082=function(_0x3a8386){while(--_0x3a8386){_0x8b62a9['push'](_0x8b62a9['shift']());}};_0x1a9082(++_0x17b817);}(_0xf07b,0x17e));var _0xbf07=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf07b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xbf07('0x0'));var util=require('util');var logger=require(_0xbf07('0x1'))(_0xbf07('0x2'));var moment=require(_0xbf07('0x3'));var BPromise=require(_0xbf07('0x4'));var rp=require(_0xbf07('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbf07('0x6'));var attributes=require(_0xbf07('0x7'));module[_0xbf07('0x8')]=function(_0x3d8b78,_0x5325a8){return _0x3d8b78['define'](_0xbf07('0x9'),attributes,{'tableName':_0xbf07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index e29b07d..768a893 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 _0xf209=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x5b5eee,_0x51f2ec){var _0x47e626=function(_0xe33a49){while(--_0xe33a49){_0x5b5eee['push'](_0x5b5eee['shift']());}};_0x47e626(++_0x51f2ec);}(_0xf209,0x1c8));var _0x9f20=function(_0x52ab0a,_0xf641d5){_0x52ab0a=_0x52ab0a-0x0;var _0x1d2cab=_0xf209[_0x52ab0a];return _0x1d2cab;};'use strict';var _=require(_0x9f20('0x0'));var util=require(_0x9f20('0x1'));var moment=require(_0x9f20('0x2'));var BPromise=require(_0x9f20('0x3'));var rs=require(_0x9f20('0x4'));var fs=require('fs');var Redis=require(_0x9f20('0x5'));var db=require(_0x9f20('0x6'))['db'];var utils=require(_0x9f20('0x7'));var logger=require(_0x9f20('0x8'))(_0x9f20('0x9'));var config=require(_0x9f20('0xa'));var jayson=require(_0x9f20('0xb'));var client=jayson[_0x9f20('0xc')][_0x9f20('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x318138,_0x2433b5,_0x4f606a){return new BPromise(function(_0x4c4a0e,_0x54cde8){return client[_0x9f20('0xe')](_0x318138,_0x4f606a)[_0x9f20('0xf')](function(_0x30839a){logger[_0x9f20('0x10')](_0x9f20('0x11'),_0x2433b5,_0x9f20('0x12'));logger[_0x9f20('0x13')](_0x9f20('0x14'),_0x2433b5,'request\x20sent',JSON['stringify'](_0x30839a));if(_0x30839a[_0x9f20('0x15')]){if(_0x30839a[_0x9f20('0x15')]['code']===0x1f4){logger[_0x9f20('0x15')]('VtigerConfiguration,\x20%s,\x20%s',_0x2433b5,_0x30839a[_0x9f20('0x15')]['message']);return _0x54cde8(_0x30839a[_0x9f20('0x15')][_0x9f20('0x16')]);}logger[_0x9f20('0x15')](_0x9f20('0x11'),_0x2433b5,_0x30839a[_0x9f20('0x15')][_0x9f20('0x16')]);return _0x4c4a0e(_0x30839a[_0x9f20('0x15')][_0x9f20('0x16')]);}else{logger[_0x9f20('0x10')](_0x9f20('0x11'),_0x2433b5,_0x9f20('0x12'));_0x4c4a0e(_0x30839a[_0x9f20('0x17')][_0x9f20('0x16')]);}})[_0x9f20('0x18')](function(_0x3b10f4){logger[_0x9f20('0x15')](_0x9f20('0x11'),_0x2433b5,_0x3b10f4);_0x54cde8(_0x3b10f4);});});} \ No newline at end of file +var _0x9cb3=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2cd612,_0x2afcbb){var _0x3fe8d0=function(_0x442aa6){while(--_0x442aa6){_0x2cd612['push'](_0x2cd612['shift']());}};_0x3fe8d0(++_0x2afcbb);}(_0x9cb3,0x18d));var _0x39cb=function(_0x42f687,_0x558724){_0x42f687=_0x42f687-0x0;var _0x108838=_0x9cb3[_0x42f687];return _0x108838;};'use strict';var _=require(_0x39cb('0x0'));var util=require(_0x39cb('0x1'));var moment=require(_0x39cb('0x2'));var BPromise=require('bluebird');var rs=require(_0x39cb('0x3'));var fs=require('fs');var Redis=require(_0x39cb('0x4'));var db=require(_0x39cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x39cb('0x6'))(_0x39cb('0x7'));var config=require(_0x39cb('0x8'));var jayson=require(_0x39cb('0x9'));var client=jayson[_0x39cb('0xa')][_0x39cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x217952,_0xe7214f,_0x280b8e){return new BPromise(function(_0x2a0eb4,_0x32ca61){return client[_0x39cb('0xc')](_0x217952,_0x280b8e)['then'](function(_0x43b16c){logger[_0x39cb('0xd')](_0x39cb('0xe'),_0xe7214f,_0x39cb('0xf'));logger[_0x39cb('0x10')](_0x39cb('0x11'),_0xe7214f,'request\x20sent',JSON[_0x39cb('0x12')](_0x43b16c));if(_0x43b16c['error']){if(_0x43b16c[_0x39cb('0x13')]['code']===0x1f4){logger[_0x39cb('0x13')](_0x39cb('0xe'),_0xe7214f,_0x43b16c[_0x39cb('0x13')][_0x39cb('0x14')]);return _0x32ca61(_0x43b16c[_0x39cb('0x13')]['message']);}logger['error'](_0x39cb('0xe'),_0xe7214f,_0x43b16c[_0x39cb('0x13')][_0x39cb('0x14')]);return _0x2a0eb4(_0x43b16c[_0x39cb('0x13')]['message']);}else{logger[_0x39cb('0xd')](_0x39cb('0xe'),_0xe7214f,'request\x20sent');_0x2a0eb4(_0x43b16c[_0x39cb('0x15')]['message']);}})[_0x39cb('0x16')](function(_0x283cb0){logger['error'](_0x39cb('0xe'),_0xe7214f,_0x283cb0);_0x32ca61(_0x283cb0);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 3392e22..e6dc76e 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7a54,0x106));var _0x47a5=function(_0x24f26a,_0x4a23ff){_0x24f26a=_0x24f26a-0x0;var _0x1d98b4=_0x7a54[_0x24f26a];return _0x1d98b4;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0xadb5=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14c72b,_0x583726){var _0x5796b4=function(_0xca8165){while(--_0xca8165){_0x14c72b['push'](_0x14c72b['shift']());}};_0x5796b4(++_0x583726);}(_0xadb5,0xad));var _0x5adb=function(_0x2b829d,_0x1cab7c){_0x2b829d=_0x2b829d-0x0;var _0x3b7b4d=_0xadb5[_0x2b829d];return _0x3b7b4d;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intVtigerField.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0xc')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['delete']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);module[_0x5adb('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 44ad39f..ea3fb7b 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 _0x202c=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','string'];(function(_0x2bd8a6,_0x5b9211){var _0x1e037a=function(_0x486e4b){while(--_0x486e4b){_0x2bd8a6['push'](_0x2bd8a6['shift']());}};_0x1e037a(++_0x5b9211);}(_0x202c,0x178));var _0xc202=function(_0xb92876,_0xff627a){_0xb92876=_0xb92876-0x0;var _0x275f70=_0x202c[_0xb92876];return _0x275f70;};'use strict';var Sequelize=require(_0xc202('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xc202('0x1'),_0xc202('0x2'),_0xc202('0x3'),'keyValue',_0xc202('0x4')),'defaultValue':_0xc202('0x1')},'content':{'type':Sequelize[_0xc202('0x5')]},'key':{'type':Sequelize[_0xc202('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xc202('0x1'),_0xc202('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xc202('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc202('0x5')]},'customField':{'type':Sequelize[_0xc202('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc202('0x5')]}}; \ No newline at end of file +var _0x5577=['picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string','customVariable','keyValue'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x5577,0x1b4));var _0x7557=function(_0x578f8f,_0x175b8a){_0x578f8f=_0x578f8f-0x0;var _0xf6480=_0x5577[_0x578f8f];return _0xf6480;};'use strict';var Sequelize=require(_0x7557('0x0'));module['exports']={'type':{'type':Sequelize[_0x7557('0x1')](_0x7557('0x2'),'variable',_0x7557('0x3'),_0x7557('0x4'),_0x7557('0x5')),'defaultValue':_0x7557('0x2')},'content':{'type':Sequelize[_0x7557('0x6')]},'key':{'type':Sequelize[_0x7557('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x7557('0x2'),_0x7557('0x7'),_0x7557('0x3'))},'keyContent':{'type':Sequelize[_0x7557('0x6')]},'idField':{'type':Sequelize[_0x7557('0x6')]},'nameField':{'type':Sequelize[_0x7557('0x6')]},'customField':{'type':Sequelize[_0x7557('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7557('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index a8b4881..98fa1c5 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 _0xd75e=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','save','destroy','then','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3908ce,_0xf2e781){var _0x17f026=function(_0x4f2ef7){while(--_0x4f2ef7){_0x3908ce['push'](_0x3908ce['shift']());}};_0x17f026(++_0xf2e781);}(_0xd75e,0x1ab));var _0xed75=function(_0x3cf73f,_0x86bce2){_0x3cf73f=_0x3cf73f-0x0;var _0x158b88=_0xd75e[_0x3cf73f];return _0x158b88;};'use strict';var emlformat=require(_0xed75('0x0'));var rimraf=require(_0xed75('0x1'));var zipdir=require(_0xed75('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xed75('0x3'));var BPromise=require(_0xed75('0x4'));var Mustache=require(_0xed75('0x5'));var util=require('util');var path=require('path');var sox=require(_0xed75('0x6'));var csv=require('to-csv');var ejs=require(_0xed75('0x7'));var fs=require('fs');var fs_extra=require(_0xed75('0x8'));var _=require(_0xed75('0x9'));var squel=require('squel');var crypto=require(_0xed75('0xa'));var jsforce=require(_0xed75('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed75('0xc'));var Papa=require(_0xed75('0xd'));var Redis=require(_0xed75('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xed75('0xf'));var as=require(_0xed75('0x10'));var hardwareService=require(_0xed75('0x11'));var logger=require(_0xed75('0x12'))(_0xed75('0x13'));var utils=require(_0xed75('0x14'));var config=require(_0xed75('0x15'));var licenseUtil=require(_0xed75('0x16'));var db=require(_0xed75('0x17'))['db'];function respondWithStatusCode(_0x2f8984,_0x2aef38){_0x2aef38=_0x2aef38||0xcc;return function(_0x47c96a){if(_0x47c96a){return _0x2f8984[_0xed75('0x18')](_0x2aef38);}return _0x2f8984['status'](_0x2aef38)[_0xed75('0x19')]();};}function respondWithResult(_0x3f0c9d,_0x167b56){_0x167b56=_0x167b56||0xc8;return function(_0x178ff4){if(_0x178ff4){return _0x3f0c9d['status'](_0x167b56)[_0xed75('0x1a')](_0x178ff4);}};}function respondWithFilteredResult(_0x1373da,_0x10853d){return function(_0x4124e6){if(_0x4124e6){var _0x61769c=typeof _0x10853d[_0xed75('0x1b')]===_0xed75('0x1c')&&typeof _0x10853d[_0xed75('0x1d')]===_0xed75('0x1c');var _0x451f11=_0x4124e6[_0xed75('0x1e')];var _0x25e99a=_0x61769c?0x0:_0x10853d[_0xed75('0x1b')];var _0x435a6d=_0x61769c?_0x4124e6['count']:_0x10853d['offset']+_0x10853d[_0xed75('0x1d')];var _0x20cdc6;if(_0x435a6d>=_0x451f11){_0x435a6d=_0x451f11;_0x20cdc6=0xc8;}else{_0x20cdc6=0xce;}_0x1373da[_0xed75('0x1f')](_0x20cdc6);return _0x1373da[_0xed75('0x20')](_0xed75('0x21'),_0x25e99a+'-'+_0x435a6d+'/'+_0x451f11)[_0xed75('0x1a')](_0x4124e6);}return null;};}function patchUpdates(_0x61443f){return function(_0x2bdeac){try{jsonpatch['apply'](_0x2bdeac,_0x61443f,!![]);}catch(_0x56be97){return BPromise['reject'](_0x56be97);}return _0x2bdeac[_0xed75('0x22')]();};}function saveUpdates(_0x5d7f89,_0x262539){return function(_0x568d30){if(_0x568d30){return _0x568d30['update'](_0x5d7f89)['then'](function(_0x59d6ab){return _0x59d6ab;});}return null;};}function removeEntity(_0x1f4714,_0xb27dab){return function(_0x1a3d62){if(_0x1a3d62){return _0x1a3d62[_0xed75('0x23')]()[_0xed75('0x24')](function(){_0x1f4714[_0xed75('0x1f')](0xcc)[_0xed75('0x19')]();});}};}function handleEntityNotFound(_0x2914e2,_0x5c2d0c){return function(_0x3e098a){if(!_0x3e098a){_0x2914e2[_0xed75('0x18')](0x194);}return _0x3e098a;};}function handleError(_0x2d8348,_0xb0a0ea){_0xb0a0ea=_0xb0a0ea||0x1f4;return function(_0x2e1aeb){logger[_0xed75('0x25')](_0x2e1aeb[_0xed75('0x26')]);if(_0x2e1aeb[_0xed75('0x27')]){delete _0x2e1aeb[_0xed75('0x27')];}_0x2d8348[_0xed75('0x1f')](_0xb0a0ea)[_0xed75('0x28')](_0x2e1aeb);};}exports['index']=function(_0x4630e3,_0x2845ee){var _0x37a315={},_0x29d7cd={},_0x14312c={'count':0x0,'rows':[]};var _0x2ba150=_[_0xed75('0x29')](db[_0xed75('0x2a')][_0xed75('0x2b')],function(_0x315bcb){return{'name':_0x315bcb[_0xed75('0x2c')],'type':_0x315bcb['type'][_0xed75('0x2d')]};});_0x29d7cd[_0xed75('0x2e')]=_['map'](_0x2ba150,_0xed75('0x27'));_0x29d7cd['query']=_[_0xed75('0x2f')](_0x4630e3[_0xed75('0x30')]);_0x29d7cd['filters']=_['intersection'](_0x29d7cd[_0xed75('0x2e')],_0x29d7cd[_0xed75('0x30')]);_0x37a315['attributes']=_[_0xed75('0x31')](_0x29d7cd[_0xed75('0x2e')],qs[_0xed75('0x32')](_0x4630e3[_0xed75('0x30')][_0xed75('0x32')]));_0x37a315[_0xed75('0x33')]=_0x37a315['attributes']['length']?_0x37a315[_0xed75('0x33')]:_0x29d7cd[_0xed75('0x2e')];if(!_0x4630e3[_0xed75('0x30')][_0xed75('0x34')](_0xed75('0x35'))){_0x37a315[_0xed75('0x1d')]=qs[_0xed75('0x1d')](_0x4630e3[_0xed75('0x30')]['limit']);_0x37a315['offset']=qs[_0xed75('0x1b')](_0x4630e3['query']['offset']);}_0x37a315[_0xed75('0x36')]=qs[_0xed75('0x37')](_0x4630e3['query'][_0xed75('0x37')]);_0x37a315['where']=qs['filters'](_[_0xed75('0x38')](_0x4630e3[_0xed75('0x30')],_0x29d7cd[_0xed75('0x39')]),_0x2ba150);if(_0x4630e3[_0xed75('0x30')][_0xed75('0x3a')]){_0x37a315[_0xed75('0x3b')]=_['merge'](_0x37a315['where'],{'$or':_['map'](_0x2ba150,function(_0x47f465){if(_0x47f465[_0xed75('0x3c')]!==_0xed75('0x3d')){var _0xf56916={};_0xf56916[_0x47f465['name']]={'$like':'%'+_0x4630e3[_0xed75('0x30')]['filter']+'%'};return _0xf56916;}})});}_0x37a315=_[_0xed75('0x3e')]({},_0x37a315,_0x4630e3[_0xed75('0x3f')]);var _0x4abd21={'where':_0x37a315[_0xed75('0x3b')]};return db[_0xed75('0x2a')][_0xed75('0x1e')](_0x4abd21)['then'](function(_0x41587e){_0x14312c['count']=_0x41587e;if(_0x4630e3['query'][_0xed75('0x40')]){_0x37a315[_0xed75('0x41')]=[{'all':!![]}];}return db[_0xed75('0x2a')][_0xed75('0x42')](_0x37a315);})[_0xed75('0x24')](function(_0x231e24){_0x14312c[_0xed75('0x43')]=_0x231e24;return _0x14312c;})['then'](respondWithFilteredResult(_0x2845ee,_0x37a315))[_0xed75('0x44')](handleError(_0x2845ee,null));};exports['show']=function(_0xb892a4,_0x138522){var _0x33f551={'raw':!![],'where':{'id':_0xb892a4[_0xed75('0x45')]['id']}},_0x548096={};_0x548096[_0xed75('0x2e')]=_['keys'](db[_0xed75('0x2a')]['rawAttributes']);_0x548096['query']=_[_0xed75('0x2f')](_0xb892a4[_0xed75('0x30')]);_0x548096['filters']=_[_0xed75('0x31')](_0x548096['model'],_0x548096[_0xed75('0x30')]);_0x33f551['attributes']=_[_0xed75('0x31')](_0x548096[_0xed75('0x2e')],qs[_0xed75('0x32')](_0xb892a4[_0xed75('0x30')][_0xed75('0x32')]));_0x33f551[_0xed75('0x33')]=_0x33f551['attributes']['length']?_0x33f551[_0xed75('0x33')]:_0x548096['model'];if(_0xb892a4[_0xed75('0x30')][_0xed75('0x40')]){_0x33f551[_0xed75('0x41')]=[{'all':!![]}];}_0x33f551=_[_0xed75('0x3e')]({},_0x33f551,_0xb892a4['options']);return db[_0xed75('0x2a')][_0xed75('0x46')](_0x33f551)['then'](handleEntityNotFound(_0x138522,null))['then'](respondWithResult(_0x138522,null))['catch'](handleError(_0x138522,null));};exports[_0xed75('0x47')]=function(_0x1d649d,_0x3e1c90){return db[_0xed75('0x2a')]['create'](_0x1d649d[_0xed75('0x48')],{})[_0xed75('0x24')](respondWithResult(_0x3e1c90,0xc9))[_0xed75('0x44')](handleError(_0x3e1c90,null));};exports[_0xed75('0x49')]=function(_0x2c4609,_0x43e5fa){if(_0x2c4609['body']['id']){delete _0x2c4609[_0xed75('0x48')]['id'];}return db[_0xed75('0x2a')]['find']({'where':{'id':_0x2c4609[_0xed75('0x45')]['id']}})[_0xed75('0x24')](handleEntityNotFound(_0x43e5fa,null))[_0xed75('0x24')](saveUpdates(_0x2c4609[_0xed75('0x48')],null))[_0xed75('0x24')](respondWithResult(_0x43e5fa,null))[_0xed75('0x44')](handleError(_0x43e5fa,null));};exports[_0xed75('0x23')]=function(_0x5dcd57,_0x492355){return db['VtigerField'][_0xed75('0x46')]({'where':{'id':_0x5dcd57[_0xed75('0x45')]['id']}})[_0xed75('0x24')](handleEntityNotFound(_0x492355,null))['then'](removeEntity(_0x492355,null))[_0xed75('0x44')](handleError(_0x492355,null));}; \ No newline at end of file +var _0xc52e=['destroy','error','stack','name','send','VtigerField','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x532745,_0x1a16d6){var _0x37a301=function(_0x380cb7){while(--_0x380cb7){_0x532745['push'](_0x532745['shift']());}};_0x37a301(++_0x1a16d6);}(_0xc52e,0x107));var _0xec52=function(_0x502b76,_0xfc08b7){_0x502b76=_0x502b76-0x0;var _0x44467d=_0xc52e[_0x502b76];return _0x44467d;};'use strict';var emlformat=require(_0xec52('0x0'));var rimraf=require(_0xec52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec52('0x2'));var rp=require(_0xec52('0x3'));var moment=require(_0xec52('0x4'));var BPromise=require(_0xec52('0x5'));var Mustache=require(_0xec52('0x6'));var util=require(_0xec52('0x7'));var path=require(_0xec52('0x8'));var sox=require('sox');var csv=require(_0xec52('0x9'));var ejs=require(_0xec52('0xa'));var fs=require('fs');var fs_extra=require(_0xec52('0xb'));var _=require(_0xec52('0xc'));var squel=require('squel');var crypto=require(_0xec52('0xd'));var jsforce=require(_0xec52('0xe'));var deskjs=require(_0xec52('0xf'));var toCsv=require(_0xec52('0x9'));var querystring=require(_0xec52('0x10'));var Papa=require(_0xec52('0x11'));var Redis=require('ioredis');var authService=require(_0xec52('0x12'));var qs=require(_0xec52('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xec52('0x14'))(_0xec52('0x15'));var utils=require(_0xec52('0x16'));var config=require(_0xec52('0x17'));var licenseUtil=require(_0xec52('0x18'));var db=require(_0xec52('0x19'))['db'];function respondWithStatusCode(_0x32e39d,_0x54a160){_0x54a160=_0x54a160||0xcc;return function(_0x244e6f){if(_0x244e6f){return _0x32e39d[_0xec52('0x1a')](_0x54a160);}return _0x32e39d['status'](_0x54a160)[_0xec52('0x1b')]();};}function respondWithResult(_0x22097b,_0x1c13cb){_0x1c13cb=_0x1c13cb||0xc8;return function(_0xe61aaf){if(_0xe61aaf){return _0x22097b[_0xec52('0x1c')](_0x1c13cb)[_0xec52('0x1d')](_0xe61aaf);}};}function respondWithFilteredResult(_0x13cd37,_0x559b0){return function(_0x46aa78){if(_0x46aa78){var _0x5f7ab3=typeof _0x559b0[_0xec52('0x1e')]===_0xec52('0x1f')&&typeof _0x559b0[_0xec52('0x20')]==='undefined';var _0x421641=_0x46aa78['count'];var _0x19fa4f=_0x5f7ab3?0x0:_0x559b0[_0xec52('0x1e')];var _0x4f8501=_0x5f7ab3?_0x46aa78[_0xec52('0x21')]:_0x559b0[_0xec52('0x1e')]+_0x559b0[_0xec52('0x20')];var _0x15af80;if(_0x4f8501>=_0x421641){_0x4f8501=_0x421641;_0x15af80=0xc8;}else{_0x15af80=0xce;}_0x13cd37[_0xec52('0x1c')](_0x15af80);return _0x13cd37[_0xec52('0x22')](_0xec52('0x23'),_0x19fa4f+'-'+_0x4f8501+'/'+_0x421641)[_0xec52('0x1d')](_0x46aa78);}return null;};}function patchUpdates(_0x3a91e7){return function(_0x468e97){try{jsonpatch[_0xec52('0x24')](_0x468e97,_0x3a91e7,!![]);}catch(_0x24d1a3){return BPromise[_0xec52('0x25')](_0x24d1a3);}return _0x468e97[_0xec52('0x26')]();};}function saveUpdates(_0xf4b70e,_0x149df5){return function(_0xc38e9a){if(_0xc38e9a){return _0xc38e9a[_0xec52('0x27')](_0xf4b70e)[_0xec52('0x28')](function(_0x2840cb){return _0x2840cb;});}return null;};}function removeEntity(_0x477208,_0x498d8e){return function(_0x359f3f){if(_0x359f3f){return _0x359f3f[_0xec52('0x29')]()[_0xec52('0x28')](function(){_0x477208[_0xec52('0x1c')](0xcc)[_0xec52('0x1b')]();});}};}function handleEntityNotFound(_0x30c35a,_0x82f6e1){return function(_0xd5a451){if(!_0xd5a451){_0x30c35a[_0xec52('0x1a')](0x194);}return _0xd5a451;};}function handleError(_0x38b092,_0x4b11b0){_0x4b11b0=_0x4b11b0||0x1f4;return function(_0x478404){logger[_0xec52('0x2a')](_0x478404[_0xec52('0x2b')]);if(_0x478404[_0xec52('0x2c')]){delete _0x478404[_0xec52('0x2c')];}_0x38b092[_0xec52('0x1c')](_0x4b11b0)[_0xec52('0x2d')](_0x478404);};}exports['index']=function(_0x1eddc7,_0x378ac8){var _0x1e1c8d={},_0x57ef20={},_0x49683f={'count':0x0,'rows':[]};var _0x13f90a=_['map'](db[_0xec52('0x2e')][_0xec52('0x2f')],function(_0x152f4d){return{'name':_0x152f4d[_0xec52('0x30')],'type':_0x152f4d[_0xec52('0x31')]['key']};});_0x57ef20[_0xec52('0x32')]=_[_0xec52('0x33')](_0x13f90a,_0xec52('0x2c'));_0x57ef20['query']=_[_0xec52('0x34')](_0x1eddc7[_0xec52('0x35')]);_0x57ef20[_0xec52('0x36')]=_[_0xec52('0x37')](_0x57ef20[_0xec52('0x32')],_0x57ef20['query']);_0x1e1c8d['attributes']=_['intersection'](_0x57ef20[_0xec52('0x32')],qs[_0xec52('0x38')](_0x1eddc7[_0xec52('0x35')][_0xec52('0x38')]));_0x1e1c8d[_0xec52('0x39')]=_0x1e1c8d[_0xec52('0x39')][_0xec52('0x3a')]?_0x1e1c8d[_0xec52('0x39')]:_0x57ef20[_0xec52('0x32')];if(!_0x1eddc7[_0xec52('0x35')][_0xec52('0x3b')]('nolimit')){_0x1e1c8d[_0xec52('0x20')]=qs['limit'](_0x1eddc7[_0xec52('0x35')][_0xec52('0x20')]);_0x1e1c8d[_0xec52('0x1e')]=qs[_0xec52('0x1e')](_0x1eddc7['query'][_0xec52('0x1e')]);}_0x1e1c8d['order']=qs['sort'](_0x1eddc7[_0xec52('0x35')][_0xec52('0x3c')]);_0x1e1c8d[_0xec52('0x3d')]=qs[_0xec52('0x36')](_[_0xec52('0x3e')](_0x1eddc7['query'],_0x57ef20[_0xec52('0x36')]),_0x13f90a);if(_0x1eddc7[_0xec52('0x35')][_0xec52('0x3f')]){_0x1e1c8d[_0xec52('0x3d')]=_['merge'](_0x1e1c8d[_0xec52('0x3d')],{'$or':_['map'](_0x13f90a,function(_0x59acd0){if(_0x59acd0[_0xec52('0x31')]!==_0xec52('0x40')){var _0x501982={};_0x501982[_0x59acd0[_0xec52('0x2c')]]={'$like':'%'+_0x1eddc7[_0xec52('0x35')][_0xec52('0x3f')]+'%'};return _0x501982;}})});}_0x1e1c8d=_['merge']({},_0x1e1c8d,_0x1eddc7['options']);var _0x209e96={'where':_0x1e1c8d[_0xec52('0x3d')]};return db[_0xec52('0x2e')][_0xec52('0x21')](_0x209e96)[_0xec52('0x28')](function(_0xaf89b2){_0x49683f['count']=_0xaf89b2;if(_0x1eddc7[_0xec52('0x35')][_0xec52('0x41')]){_0x1e1c8d[_0xec52('0x42')]=[{'all':!![]}];}return db['VtigerField'][_0xec52('0x43')](_0x1e1c8d);})[_0xec52('0x28')](function(_0x26a306){_0x49683f[_0xec52('0x44')]=_0x26a306;return _0x49683f;})['then'](respondWithFilteredResult(_0x378ac8,_0x1e1c8d))[_0xec52('0x45')](handleError(_0x378ac8,null));};exports[_0xec52('0x46')]=function(_0x375920,_0x2a1b9b){var _0x2eb4fc={'raw':!![],'where':{'id':_0x375920[_0xec52('0x47')]['id']}},_0xeb2089={};_0xeb2089[_0xec52('0x32')]=_[_0xec52('0x34')](db[_0xec52('0x2e')][_0xec52('0x2f')]);_0xeb2089[_0xec52('0x35')]=_[_0xec52('0x34')](_0x375920[_0xec52('0x35')]);_0xeb2089[_0xec52('0x36')]=_[_0xec52('0x37')](_0xeb2089[_0xec52('0x32')],_0xeb2089[_0xec52('0x35')]);_0x2eb4fc[_0xec52('0x39')]=_[_0xec52('0x37')](_0xeb2089[_0xec52('0x32')],qs[_0xec52('0x38')](_0x375920[_0xec52('0x35')][_0xec52('0x38')]));_0x2eb4fc[_0xec52('0x39')]=_0x2eb4fc[_0xec52('0x39')][_0xec52('0x3a')]?_0x2eb4fc[_0xec52('0x39')]:_0xeb2089['model'];if(_0x375920[_0xec52('0x35')][_0xec52('0x41')]){_0x2eb4fc['include']=[{'all':!![]}];}_0x2eb4fc=_['merge']({},_0x2eb4fc,_0x375920[_0xec52('0x48')]);return db['VtigerField'][_0xec52('0x49')](_0x2eb4fc)[_0xec52('0x28')](handleEntityNotFound(_0x2a1b9b,null))[_0xec52('0x28')](respondWithResult(_0x2a1b9b,null))[_0xec52('0x45')](handleError(_0x2a1b9b,null));};exports[_0xec52('0x4a')]=function(_0x52fea4,_0x4fd27b){return db[_0xec52('0x2e')]['create'](_0x52fea4[_0xec52('0x4b')],{})[_0xec52('0x28')](respondWithResult(_0x4fd27b,0xc9))[_0xec52('0x45')](handleError(_0x4fd27b,null));};exports[_0xec52('0x27')]=function(_0x2e1611,_0x598069){if(_0x2e1611[_0xec52('0x4b')]['id']){delete _0x2e1611[_0xec52('0x4b')]['id'];}return db[_0xec52('0x2e')]['find']({'where':{'id':_0x2e1611[_0xec52('0x47')]['id']}})['then'](handleEntityNotFound(_0x598069,null))[_0xec52('0x28')](saveUpdates(_0x2e1611[_0xec52('0x4b')],null))['then'](respondWithResult(_0x598069,null))[_0xec52('0x45')](handleError(_0x598069,null));};exports[_0xec52('0x29')]=function(_0x303438,_0x3d467e){return db[_0xec52('0x2e')][_0xec52('0x49')]({'where':{'id':_0x303438['params']['id']}})[_0xec52('0x28')](handleEntityNotFound(_0x3d467e,null))[_0xec52('0x28')](removeEntity(_0x3d467e,null))[_0xec52('0x45')](handleError(_0x3d467e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 1522910..ac05974 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 _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x22f75d,_0x43c03d){var _0x4c5a32=function(_0xa0b9b2){while(--_0xa0b9b2){_0x22f75d['push'](_0x22f75d['shift']());}};_0x4c5a32(++_0x43c03d);}(_0x7a54,0x106));var _0x47a5=function(_0x297a8e,_0x2f491d){_0x297a8e=_0x297a8e-0x0;var _0x381a8d=_0x7a54[_0x297a8e];return _0x381a8d;};'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':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index f992e21..aacc828 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 _0x6215=['debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','then','info','VtigerField,\x20%s,\x20%s'];(function(_0x2fd324,_0x3eace0){var _0x4a3ffb=function(_0x55aae9){while(--_0x55aae9){_0x2fd324['push'](_0x2fd324['shift']());}};_0x4a3ffb(++_0x3eace0);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var util=require(_0x5621('0x1'));var moment=require(_0x5621('0x2'));var BPromise=require('bluebird');var rs=require(_0x5621('0x3'));var fs=require('fs');var Redis=require(_0x5621('0x4'));var db=require(_0x5621('0x5'))['db'];var utils=require(_0x5621('0x6'));var logger=require(_0x5621('0x7'))(_0x5621('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x431e77,_0x13ed74,_0x2b7275){return new BPromise(function(_0x253c0b,_0x19427d){return client['request'](_0x431e77,_0x2b7275)[_0x5621('0x9')](function(_0x39b1c0){logger[_0x5621('0xa')](_0x5621('0xb'),_0x13ed74,'request\x20sent');logger[_0x5621('0xc')](_0x5621('0xd'),_0x13ed74,_0x5621('0xe'),JSON['stringify'](_0x39b1c0));if(_0x39b1c0[_0x5621('0xf')]){if(_0x39b1c0[_0x5621('0xf')][_0x5621('0x10')]===0x1f4){logger[_0x5621('0xf')](_0x5621('0xb'),_0x13ed74,_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);return _0x19427d(_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);}logger[_0x5621('0xf')]('VtigerField,\x20%s,\x20%s',_0x13ed74,_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);return _0x253c0b(_0x39b1c0[_0x5621('0xf')]['message']);}else{logger[_0x5621('0xa')](_0x5621('0xb'),_0x13ed74,'request\x20sent');_0x253c0b(_0x39b1c0[_0x5621('0x12')][_0x5621('0x11')]);}})[_0x5621('0x13')](function(_0x180926){logger[_0x5621('0xf')](_0x5621('0xb'),_0x13ed74,_0x180926);_0x19427d(_0x180926);});});} \ No newline at end of file +var _0x7269=['VtigerField,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x37f63a,_0x50ffe2){var _0x757de7=function(_0x4181c8){while(--_0x4181c8){_0x37f63a['push'](_0x37f63a['shift']());}};_0x757de7(++_0x50ffe2);}(_0x7269,0x76));var _0x9726=function(_0xefb653,_0x9993c9){_0xefb653=_0xefb653-0x0;var _0x850d4e=_0x7269[_0xefb653];return _0x850d4e;};'use strict';var _=require(_0x9726('0x0'));var util=require(_0x9726('0x1'));var moment=require(_0x9726('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9726('0x3'));var db=require(_0x9726('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9726('0x5'))(_0x9726('0x6'));var config=require(_0x9726('0x7'));var jayson=require(_0x9726('0x8'));var client=jayson[_0x9726('0x9')][_0x9726('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1982d3,_0x381bb2,_0x1a5e03){return new BPromise(function(_0x494854,_0xcbdb72){return client['request'](_0x1982d3,_0x1a5e03)[_0x9726('0xb')](function(_0x3e72b0){logger[_0x9726('0xc')]('VtigerField,\x20%s,\x20%s',_0x381bb2,_0x9726('0xd'));logger[_0x9726('0xe')](_0x9726('0xf'),_0x381bb2,'request\x20sent',JSON[_0x9726('0x10')](_0x3e72b0));if(_0x3e72b0[_0x9726('0x11')]){if(_0x3e72b0[_0x9726('0x11')][_0x9726('0x12')]===0x1f4){logger[_0x9726('0x11')]('VtigerField,\x20%s,\x20%s',_0x381bb2,_0x3e72b0['error'][_0x9726('0x13')]);return _0xcbdb72(_0x3e72b0[_0x9726('0x11')]['message']);}logger[_0x9726('0x11')](_0x9726('0x14'),_0x381bb2,_0x3e72b0[_0x9726('0x11')][_0x9726('0x13')]);return _0x494854(_0x3e72b0['error'][_0x9726('0x13')]);}else{logger[_0x9726('0xc')](_0x9726('0x14'),_0x381bb2,_0x9726('0xd'));_0x494854(_0x3e72b0[_0x9726('0x15')][_0x9726('0x13')]);}})[_0x9726('0x16')](function(_0x235beb){logger['error'](_0x9726('0x14'),_0x381bb2,_0x235beb);_0xcbdb72(_0x235beb);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 9d6d2b0..a8bf5a7 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 _0x91c6=['create','post','put','/:id','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x6d80ae,_0x4825a5){var _0xad0d4c=function(_0x380c5d){while(--_0x380c5d){_0x6d80ae['push'](_0x6d80ae['shift']());}};_0xad0d4c(++_0x4825a5);}(_0x91c6,0xf9));var _0x691c=function(_0x2aa82d,_0x20d453){_0x2aa82d=_0x2aa82d-0x0;var _0x5ee415=_0x91c6[_0x2aa82d];return _0x5ee415;};'use strict';var multer=require(_0x691c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x691c('0x1'));var express=require(_0x691c('0x2'));var router=express[_0x691c('0x3')]();var fs_extra=require(_0x691c('0x4'));var auth=require(_0x691c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x691c('0x6'));var controller=require(_0x691c('0x7'));router[_0x691c('0x8')]('/',auth[_0x691c('0x9')](),controller[_0x691c('0xa')]);router[_0x691c('0x8')]('/:id',auth[_0x691c('0x9')](),controller[_0x691c('0xb')]);router[_0x691c('0x8')](_0x691c('0xc'),auth['isAuthenticated'](),controller[_0x691c('0xd')]);router[_0x691c('0x8')](_0x691c('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x691c('0x9')](),controller[_0x691c('0xf')]);router[_0x691c('0x10')](_0x691c('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x691c('0x11')](_0x691c('0x12'),auth[_0x691c('0x9')](),controller[_0x691c('0x13')]);router[_0x691c('0x14')](_0x691c('0x12'),auth[_0x691c('0x9')](),controller[_0x691c('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa6bb=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy'];(function(_0x183acf,_0x20a500){var _0x52453c=function(_0x3c36ec){while(--_0x3c36ec){_0x183acf['push'](_0x183acf['shift']());}};_0x52453c(++_0x20a500);}(_0xa6bb,0x12c));var _0xba6b=function(_0x1e00db,_0x1e2443){_0x1e00db=_0x1e00db-0x0;var _0x443820=_0xa6bb[_0x1e00db];return _0x443820;};'use strict';var multer=require('multer');var util=require(_0xba6b('0x0'));var path=require(_0xba6b('0x1'));var timeout=require(_0xba6b('0x2'));var express=require(_0xba6b('0x3'));var router=express[_0xba6b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xba6b('0x5'));var config=require(_0xba6b('0x6'));var controller=require(_0xba6b('0x7'));router[_0xba6b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xba6b('0x8')](_0xba6b('0x9'),auth[_0xba6b('0xa')](),controller['show']);router['get'](_0xba6b('0xb'),auth[_0xba6b('0xa')](),controller[_0xba6b('0xc')]);router[_0xba6b('0x8')](_0xba6b('0xd'),auth['isAuthenticated'](),controller[_0xba6b('0xe')]);router[_0xba6b('0xf')]('/',auth[_0xba6b('0xa')](),controller['create']);router[_0xba6b('0xf')](_0xba6b('0xb'),auth[_0xba6b('0xa')](),controller[_0xba6b('0x10')]);router['put'](_0xba6b('0x9'),auth['isAuthenticated'](),controller[_0xba6b('0x11')]);router[_0xba6b('0x12')](_0xba6b('0x9'),auth[_0xba6b('0xa')](),controller[_0xba6b('0x13')]);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 1c28936..310c5f4 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 _0xe41e=['remoteUri','password','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x3fb9f4,_0xe3b081){var _0x5416bc=function(_0x5dfef0){while(--_0x5dfef0){_0x3fb9f4['push'](_0x3fb9f4['shift']());}};_0x5416bc(++_0xe3b081);}(_0xe41e,0x19a));var _0xee41=function(_0x3180f0,_0x3b5bd6){_0x3180f0=_0x3180f0-0x0;var _0x5ce78e=_0xe41e[_0x3180f0];return _0x5ce78e;};'use strict';var Sequelize=require(_0xee41('0x0'));module[_0xee41('0x1')]={'name':{'type':Sequelize[_0xee41('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xee41('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xee41('0x2')]},'remoteUri':{'type':Sequelize[_0xee41('0x2')],'unique':_0xee41('0x3')},'authType':{'type':Sequelize['ENUM'](_0xee41('0x4'),'token'),'defaultValue':_0xee41('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xee41('0x5')](_0xee41('0x6'),'newTab'),'defaultValue':_0xee41('0x6')}}; \ No newline at end of file +var _0x7cce=['username','remoteUri','ENUM','password','newTab','exports','STRING'];(function(_0x1d3d44,_0x30de20){var _0x3546bd=function(_0x4d1ae3){while(--_0x4d1ae3){_0x1d3d44['push'](_0x1d3d44['shift']());}};_0x3546bd(++_0x30de20);}(_0x7cce,0x19b));var _0xe7cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cce[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe7cc('0x0')]={'name':{'type':Sequelize[_0xe7cc('0x1')]},'description':{'type':Sequelize[_0xe7cc('0x1')]},'username':{'type':Sequelize[_0xe7cc('0x1')],'unique':_0xe7cc('0x2')},'password':{'type':Sequelize[_0xe7cc('0x1')]},'token':{'type':Sequelize[_0xe7cc('0x1')]},'remoteUri':{'type':Sequelize[_0xe7cc('0x1')],'unique':_0xe7cc('0x3')},'authType':{'type':Sequelize[_0xe7cc('0x4')](_0xe7cc('0x5'),'token'),'defaultValue':_0xe7cc('0x5')},'serverUrl':{'type':Sequelize[_0xe7cc('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe7cc('0x4')]('integrationTab',_0xe7cc('0x6')),'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 aeb4e7f..be63606 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 _0xc376=['message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','end','stack','name','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','getConfigurations','ZendeskConfiguration','order','filter','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','toString','base64','Basic\x20%s','Sequelize','ValidationError','group','assignee','remove','includes','map','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x36913e,_0x8cb39f){var _0x4e7d10=function(_0x332742){while(--_0x332742){_0x36913e['push'](_0x36913e['shift']());}};_0x4e7d10(++_0x8cb39f);}(_0xc376,0xe4));var _0x6c37=function(_0x58de4a,_0x564dbc){_0x58de4a=_0x58de4a-0x0;var _0x178820=_0xc376[_0x58de4a];return _0x178820;};'use strict';var emlformat=require(_0x6c37('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6c37('0x1'));var rp=require(_0x6c37('0x2'));var moment=require(_0x6c37('0x3'));var BPromise=require(_0x6c37('0x4'));var Mustache=require(_0x6c37('0x5'));var util=require(_0x6c37('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c37('0x7'));var ejs=require(_0x6c37('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c37('0x9'));var squel=require(_0x6c37('0xa'));var crypto=require('crypto');var jsforce=require(_0x6c37('0xb'));var deskjs=require(_0x6c37('0xc'));var toCsv=require(_0x6c37('0x7'));var querystring=require(_0x6c37('0xd'));var Papa=require(_0x6c37('0xe'));var Redis=require('ioredis');var authService=require(_0x6c37('0xf'));var qs=require(_0x6c37('0x10'));var as=require(_0x6c37('0x11'));var hardwareService=require(_0x6c37('0x12'));var logger=require(_0x6c37('0x13'))(_0x6c37('0x14'));var utils=require('../../config/utils');var config=require(_0x6c37('0x15'));var licenseUtil=require(_0x6c37('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6c37('0x17'));var jayson=require(_0x6c37('0x18'));var client=jayson[_0x6c37('0x19')][_0x6c37('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x373ab9,_0x1d027b,_0x50e99b,_0x1081c2){return new BPromise(function(_0x18289d,_0x25dacd){var _0x4a5212=_0x1081c2||client;return _0x4a5212[_0x6c37('0x1b')](_0x373ab9,_0x50e99b)[_0x6c37('0x1c')](function(_0x5be6d6){logger[_0x6c37('0x1d')](_0x6c37('0x1e'),_0x1d027b,_0x6c37('0x1f'));logger[_0x6c37('0x20')](_0x6c37('0x21'),_0x1d027b,_0x6c37('0x1f'),JSON['stringify'](_0x5be6d6));if(_0x5be6d6[_0x6c37('0x22')]){if(_0x5be6d6[_0x6c37('0x22')][_0x6c37('0x23')]===0x1f4){logger[_0x6c37('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x1d027b,_0x5be6d6[_0x6c37('0x22')][_0x6c37('0x24')]);return _0x25dacd(_0x5be6d6['error'][_0x6c37('0x24')]);}logger[_0x6c37('0x22')](_0x6c37('0x1e'),_0x1d027b,_0x5be6d6[_0x6c37('0x22')][_0x6c37('0x24')]);return _0x18289d(_0x5be6d6[_0x6c37('0x22')][_0x6c37('0x24')]);}else{logger[_0x6c37('0x1d')](_0x6c37('0x1e'),_0x1d027b,'request\x20sent');_0x18289d(_0x5be6d6[_0x6c37('0x25')][_0x6c37('0x24')]);}})[_0x6c37('0x26')](function(_0x34a0eb){logger[_0x6c37('0x22')](_0x6c37('0x1e'),_0x1d027b,_0x34a0eb);_0x25dacd(_0x34a0eb);});});}function respondWithStatusCode(_0x21bc94,_0xed713d){_0xed713d=_0xed713d||0xcc;return function(_0x42a6d8){if(_0x42a6d8){return _0x21bc94[_0x6c37('0x27')](_0xed713d);}return _0x21bc94['status'](_0xed713d)['end']();};}function respondWithResult(_0x578374,_0x59f4b3){_0x59f4b3=_0x59f4b3||0xc8;return function(_0x156d6f){if(_0x156d6f){return _0x578374[_0x6c37('0x28')](_0x59f4b3)[_0x6c37('0x29')](_0x156d6f);}};}function respondWithFilteredResult(_0x27d7d0,_0x4a439c){return function(_0x291269){if(_0x291269){var _0x4f9c38=typeof _0x4a439c[_0x6c37('0x2a')]===_0x6c37('0x2b')&&typeof _0x4a439c[_0x6c37('0x2c')]===_0x6c37('0x2b');var _0xb94580=_0x291269[_0x6c37('0x2d')];var _0x4dd00b=_0x4f9c38?0x0:_0x4a439c[_0x6c37('0x2a')];var _0x54e6a3=_0x4f9c38?_0x291269[_0x6c37('0x2d')]:_0x4a439c['offset']+_0x4a439c['limit'];var _0x281344;if(_0x54e6a3>=_0xb94580){_0x54e6a3=_0xb94580;_0x281344=0xc8;}else{_0x281344=0xce;}_0x27d7d0[_0x6c37('0x28')](_0x281344);return _0x27d7d0['set'](_0x6c37('0x2e'),_0x4dd00b+'-'+_0x54e6a3+'/'+_0xb94580)[_0x6c37('0x29')](_0x291269);}return null;};}function patchUpdates(_0x3a3f18){return function(_0xff694e){try{jsonpatch[_0x6c37('0x2f')](_0xff694e,_0x3a3f18,!![]);}catch(_0x4b7890){return BPromise[_0x6c37('0x30')](_0x4b7890);}return _0xff694e[_0x6c37('0x31')]();};}function saveUpdates(_0x339ec5,_0x3c5125){return function(_0x36acc3){if(_0x36acc3){return _0x36acc3[_0x6c37('0x32')](_0x339ec5)[_0x6c37('0x1c')](function(_0x5173f5){return _0x5173f5;});}return null;};}function removeEntity(_0x181297,_0x368f5e){return function(_0x47cc8a){if(_0x47cc8a){return _0x47cc8a[_0x6c37('0x33')]()['then'](function(){_0x181297[_0x6c37('0x28')](0xcc)[_0x6c37('0x34')]();});}};}function handleEntityNotFound(_0x1c8ec3,_0x1c92fd){return function(_0x2b32e5){if(!_0x2b32e5){_0x1c8ec3[_0x6c37('0x27')](0x194);}return _0x2b32e5;};}function handleError(_0x599e77,_0x25c27c){_0x25c27c=_0x25c27c||0x1f4;return function(_0x27c4e8){logger[_0x6c37('0x22')](_0x27c4e8[_0x6c37('0x35')]);if(_0x27c4e8[_0x6c37('0x36')]){delete _0x27c4e8[_0x6c37('0x36')];}_0x599e77['status'](_0x25c27c)['send'](_0x27c4e8);};}exports[_0x6c37('0x37')]=function(_0x1b4d52,_0x179e51){var _0x1f0a15={},_0x24fccf={},_0x15e356={'count':0x0,'rows':[]};var _0x2a96c0=_['map'](db[_0x6c37('0x38')][_0x6c37('0x39')],function(_0x49fada){return{'name':_0x49fada[_0x6c37('0x3a')],'type':_0x49fada[_0x6c37('0x3b')][_0x6c37('0x3c')]};});_0x24fccf[_0x6c37('0x3d')]=_['map'](_0x2a96c0,_0x6c37('0x36'));_0x24fccf[_0x6c37('0x3e')]=_['keys'](_0x1b4d52['query']);_0x24fccf['filters']=_[_0x6c37('0x3f')](_0x24fccf['model'],_0x24fccf['query']);_0x1f0a15[_0x6c37('0x40')]=_['intersection'](_0x24fccf[_0x6c37('0x3d')],qs[_0x6c37('0x41')](_0x1b4d52['query'][_0x6c37('0x41')]));_0x1f0a15[_0x6c37('0x40')]=_0x1f0a15[_0x6c37('0x40')][_0x6c37('0x42')]?_0x1f0a15[_0x6c37('0x40')]:_0x24fccf[_0x6c37('0x3d')];if(!_0x1b4d52[_0x6c37('0x3e')][_0x6c37('0x43')](_0x6c37('0x44'))){_0x1f0a15[_0x6c37('0x2c')]=qs[_0x6c37('0x2c')](_0x1b4d52[_0x6c37('0x3e')]['limit']);_0x1f0a15[_0x6c37('0x2a')]=qs[_0x6c37('0x2a')](_0x1b4d52['query'][_0x6c37('0x2a')]);}_0x1f0a15['order']=qs[_0x6c37('0x45')](_0x1b4d52['query'][_0x6c37('0x45')]);_0x1f0a15[_0x6c37('0x46')]=qs['filters'](_[_0x6c37('0x47')](_0x1b4d52[_0x6c37('0x3e')],_0x24fccf[_0x6c37('0x48')]),_0x2a96c0);if(_0x1b4d52[_0x6c37('0x3e')]['filter']){_0x1f0a15[_0x6c37('0x46')]=_[_0x6c37('0x49')](_0x1f0a15[_0x6c37('0x46')],{'$or':_['map'](_0x2a96c0,function(_0x12d453){if(_0x12d453[_0x6c37('0x3b')]!==_0x6c37('0x4a')){var _0x1af004={};_0x1af004[_0x12d453['name']]={'$like':'%'+_0x1b4d52[_0x6c37('0x3e')]['filter']+'%'};return _0x1af004;}})});}_0x1f0a15=_[_0x6c37('0x49')]({},_0x1f0a15,_0x1b4d52['options']);var _0x40155a={'where':_0x1f0a15[_0x6c37('0x46')]};return db['ZendeskAccount'][_0x6c37('0x2d')](_0x40155a)[_0x6c37('0x1c')](function(_0x5e4903){_0x15e356[_0x6c37('0x2d')]=_0x5e4903;if(_0x1b4d52['query'][_0x6c37('0x4b')]){_0x1f0a15[_0x6c37('0x4c')]=[{'all':!![]}];}return db[_0x6c37('0x38')][_0x6c37('0x4d')](_0x1f0a15);})['then'](function(_0x5c2460){_0x15e356[_0x6c37('0x4e')]=_0x5c2460;return _0x15e356;})[_0x6c37('0x1c')](respondWithFilteredResult(_0x179e51,_0x1f0a15))['catch'](handleError(_0x179e51,null));};exports[_0x6c37('0x4f')]=function(_0x3397fe,_0x3b2eed){var _0x53cb34={'raw':![],'where':{'id':_0x3397fe[_0x6c37('0x50')]['id']}},_0xc6e36d={};_0xc6e36d['model']=_[_0x6c37('0x51')](db['ZendeskAccount'][_0x6c37('0x39')]);_0xc6e36d['query']=_[_0x6c37('0x51')](_0x3397fe[_0x6c37('0x3e')]);_0xc6e36d['filters']=_[_0x6c37('0x3f')](_0xc6e36d['model'],_0xc6e36d['query']);_0x53cb34[_0x6c37('0x40')]=_[_0x6c37('0x3f')](_0xc6e36d[_0x6c37('0x3d')],qs[_0x6c37('0x41')](_0x3397fe[_0x6c37('0x3e')][_0x6c37('0x41')]));_0x53cb34[_0x6c37('0x40')]=_0x53cb34[_0x6c37('0x40')]['length']?_0x53cb34[_0x6c37('0x40')]:_0xc6e36d[_0x6c37('0x3d')];if(_0x3397fe[_0x6c37('0x3e')][_0x6c37('0x4b')]){_0x53cb34['include']=[{'all':!![]}];}_0x53cb34=_[_0x6c37('0x49')]({},_0x53cb34,_0x3397fe[_0x6c37('0x52')]);return db[_0x6c37('0x38')][_0x6c37('0x53')](_0x53cb34)[_0x6c37('0x1c')](handleEntityNotFound(_0x3b2eed,null))[_0x6c37('0x1c')](respondWithResult(_0x3b2eed,null))['catch'](handleError(_0x3b2eed,null));};exports[_0x6c37('0x54')]=function(_0x51b01c,_0x5bba71){return db['ZendeskAccount'][_0x6c37('0x54')](_0x51b01c[_0x6c37('0x55')],{})['then'](respondWithResult(_0x5bba71,0xc9))['catch'](handleError(_0x5bba71,null));};exports[_0x6c37('0x32')]=function(_0x1cbff8,_0x20bb99){if(_0x1cbff8[_0x6c37('0x55')]['id']){delete _0x1cbff8[_0x6c37('0x55')]['id'];}return db[_0x6c37('0x38')][_0x6c37('0x53')]({'where':{'id':_0x1cbff8[_0x6c37('0x50')]['id']}})[_0x6c37('0x1c')](handleEntityNotFound(_0x20bb99,null))['then'](saveUpdates(_0x1cbff8['body'],null))[_0x6c37('0x1c')](respondWithResult(_0x20bb99,null))[_0x6c37('0x26')](handleError(_0x20bb99,null));};exports['destroy']=function(_0x4d1d9f,_0x5d033c){return db[_0x6c37('0x38')]['find']({'where':{'id':_0x4d1d9f[_0x6c37('0x50')]['id']}})[_0x6c37('0x1c')](handleEntityNotFound(_0x5d033c,null))[_0x6c37('0x1c')](removeEntity(_0x5d033c,null))[_0x6c37('0x26')](handleError(_0x5d033c,null));};exports[_0x6c37('0x56')]=function(_0xcab79c,_0x511e14,_0x437a16){var _0x2691ec={};var _0x1c574e={};var _0x11d8da;var _0x3905c8;return db['ZendeskAccount']['findOne']({'where':{'id':_0xcab79c[_0x6c37('0x50')]['id']}})[_0x6c37('0x1c')](handleEntityNotFound(_0x511e14,null))[_0x6c37('0x1c')](function(_0x150c71){if(_0x150c71){_0x11d8da=_0x150c71;_0x1c574e[_0x6c37('0x3d')]=_['keys'](db[_0x6c37('0x57')][_0x6c37('0x39')]);_0x1c574e[_0x6c37('0x3e')]=_[_0x6c37('0x51')](_0xcab79c[_0x6c37('0x3e')]);_0x1c574e[_0x6c37('0x48')]=_[_0x6c37('0x3f')](_0x1c574e[_0x6c37('0x3d')],_0x1c574e['query']);_0x2691ec[_0x6c37('0x40')]=_[_0x6c37('0x3f')](_0x1c574e[_0x6c37('0x3d')],qs['fields'](_0xcab79c[_0x6c37('0x3e')][_0x6c37('0x41')]));_0x2691ec[_0x6c37('0x40')]=_0x2691ec[_0x6c37('0x40')]['length']?_0x2691ec['attributes']:_0x1c574e[_0x6c37('0x3d')];_0x2691ec[_0x6c37('0x58')]=qs[_0x6c37('0x45')](_0xcab79c[_0x6c37('0x3e')][_0x6c37('0x45')]);_0x2691ec[_0x6c37('0x46')]=qs[_0x6c37('0x48')](_[_0x6c37('0x47')](_0xcab79c['query'],_0x1c574e[_0x6c37('0x48')]));if(_0xcab79c[_0x6c37('0x3e')][_0x6c37('0x59')]){_0x2691ec[_0x6c37('0x46')]=_[_0x6c37('0x49')](_0x2691ec[_0x6c37('0x46')],{'$or':_['map'](_0x2691ec[_0x6c37('0x40')],function(_0x383130){var _0x52eefd={};_0x52eefd[_0x383130]={'$like':'%'+_0xcab79c[_0x6c37('0x3e')][_0x6c37('0x59')]+'%'};return _0x52eefd;})});}_0x2691ec=_[_0x6c37('0x49')]({},_0x2691ec,_0xcab79c['options']);return _0x11d8da[_0x6c37('0x56')](_0x2691ec);}})[_0x6c37('0x1c')](function(_0x2d5a12){if(_0x2d5a12){_0x3905c8=_0x2d5a12[_0x6c37('0x42')];if(!_0xcab79c[_0x6c37('0x3e')][_0x6c37('0x43')]('nolimit')){_0x2691ec[_0x6c37('0x2c')]=qs[_0x6c37('0x2c')](_0xcab79c['query'][_0x6c37('0x2c')]);_0x2691ec['offset']=qs[_0x6c37('0x2a')](_0xcab79c['query'][_0x6c37('0x2a')]);}return _0x11d8da[_0x6c37('0x56')](_0x2691ec);}})[_0x6c37('0x1c')](function(_0x319137){if(_0x319137){return _0x319137?{'count':_0x3905c8,'rows':_0x319137}:null;}})[_0x6c37('0x1c')](respondWithResult(_0x511e14,null))[_0x6c37('0x26')](handleError(_0x511e14,null));};exports[_0x6c37('0x5a')]=function(_0x154e68,_0x2ee221,_0x627bac){if(_0x154e68[_0x6c37('0x55')]['id']){delete _0x154e68[_0x6c37('0x55')]['id'];}return db[_0x6c37('0x38')][_0x6c37('0x5b')]({'where':{'id':_0x154e68['params']['id']}})[_0x6c37('0x1c')](handleEntityNotFound(_0x2ee221,null))['then'](function(_0x429e26){if(_0x429e26){_0x154e68[_0x6c37('0x55')][_0x6c37('0x5c')]=_0x429e26['id'];_0x154e68[_0x6c37('0x55')][_0x6c37('0x5d')]=integrations[_0x6c37('0x5e')](_0x154e68[_0x6c37('0x55')][_0x6c37('0x5f')],_0x154e68[_0x6c37('0x55')][_0x6c37('0x3b')]);_0x154e68[_0x6c37('0x55')][_0x6c37('0x60')]=integrations[_0x6c37('0x61')](_0x154e68[_0x6c37('0x55')]['channel'],_0x154e68[_0x6c37('0x55')][_0x6c37('0x3b')]);return db[_0x6c37('0x57')]['create'](_0x154e68['body'],{'include':[{'model':db['ZendeskField'],'as':_0x6c37('0x5d')},{'model':db[_0x6c37('0x62')],'as':_0x6c37('0x60')}]});}return null;})['then'](respondWithResult(_0x2ee221,null))[_0x6c37('0x26')](handleError(_0x2ee221,null));};exports[_0x6c37('0x63')]=function(_0x36ba04,_0x825c8a,_0x4bd583){var _0x29d762='';return db[_0x6c37('0x38')][_0x6c37('0x5b')]({'where':{'id':_0x36ba04[_0x6c37('0x50')]['id']},'attributes':['id',_0x6c37('0x64'),_0x6c37('0x65'),_0x6c37('0x66'),_0x6c37('0x67'),_0x6c37('0x68')]})['then'](handleEntityNotFound(_0x825c8a,null))[_0x6c37('0x1c')](function(_0x68322){if(_0x68322){_0x29d762=_0x68322[_0x6c37('0x68')];var _0x517aef=_0x29d762[_0x6c37('0x69')](-0x1);if(_0x517aef==='/'){_0x29d762=_0x29d762[_0x6c37('0x6a')](0x0,_0x29d762[_0x6c37('0x6b')](_0x517aef));}var _0x418f21={'method':_0x6c37('0x6c'),'uri':util[_0x6c37('0x6d')](_0x6c37('0x6e'),_0x29d762,_0x6c37('0x6f')),'json':!![]};switch(_0x68322[_0x6c37('0x67')]){case _0x6c37('0x65'):_0x418f21[_0x6c37('0x70')]={'Authorization':util[_0x6c37('0x6d')]('Basic\x20%s',new Buffer(util[_0x6c37('0x6d')]('%s:%s',_0x68322[_0x6c37('0x64')],_0x68322[_0x6c37('0x65')]))[_0x6c37('0x71')](_0x6c37('0x72')))};break;case _0x6c37('0x66'):_0x418f21[_0x6c37('0x70')]={'Authorization':util[_0x6c37('0x6d')](_0x6c37('0x73'),new Buffer(util[_0x6c37('0x6d')]('%s/token:%s',_0x68322[_0x6c37('0x64')],_0x68322[_0x6c37('0x66')]))[_0x6c37('0x71')](_0x6c37('0x72')))};break;default:throw new db[(_0x6c37('0x74'))][(_0x6c37('0x75'))]('Unknown\x20authentication\x20type');}return rp(_0x418f21);}})['then'](function(_0x47140f){if(_0x47140f){var _0x41cc2c=['subject','description',_0x6c37('0x76'),_0x6c37('0x77')];_[_0x6c37('0x78')](_0x47140f['ticket_fields'],function(_0xdd7656){return _0x41cc2c[_0x6c37('0x79')](_0xdd7656[_0x6c37('0x3b')]);});return{'count':_0x47140f[_0x6c37('0x6f')][_0x6c37('0x42')],'rows':_[_0x6c37('0x7a')](_0x47140f[_0x6c37('0x6f')],function(_0x4a7bbe){return{'id':_0x4a7bbe['id'],'name':_0x4a7bbe[_0x6c37('0x7b')]>0x7?_0x4a7bbe[_0x6c37('0x7c')]:_0x4a7bbe['type'],'custom':_0x4a7bbe[_0x6c37('0x7b')]>0x7?!![]:![],'options':_0x4a7bbe[_0x6c37('0x7d')]?_0x4a7bbe['system_field_options']:_0x4a7bbe[_0x6c37('0x7e')]?_0x4a7bbe['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x825c8a,null))[_0x6c37('0x26')](function(_0x3e704b){var _0x24f03c=_0x36ba04[_0x6c37('0x3e')][_0x6c37('0x7f')]?0x1f4:_0x3e704b[_0x6c37('0x80')]||0x1f4;logger['error'](_0x6c37('0x81'),_0x6c37('0x63'),_0x24f03c,JSON[_0x6c37('0x82')](_0x3e704b));delete _0x3e704b[_0x6c37('0x36')];if(_0x24f03c===0x191){_0x24f03c=0x190;}_0x825c8a[_0x6c37('0x28')](_0x24f03c)[_0x6c37('0x83')](_0x36ba04[_0x6c37('0x3e')][_0x6c37('0x7f')]?{'message':'Wrong\x20credentials','statusCode':_0x3e704b[_0x6c37('0x80')]}:_0x3e704b);});}; \ No newline at end of file +var _0xe819=['includeAll','include','rows','catch','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','GET','%s/%s','ticket_fields','headers','format','%s:%s','base64','%s/token:%s','toString','Sequelize','ValidationError','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','bluebird','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/utils','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','stack','name','send','map','ZendeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options'];(function(_0x350258,_0x4e0a50){var _0x3714b3=function(_0x8918f7){while(--_0x8918f7){_0x350258['push'](_0x350258['shift']());}};_0x3714b3(++_0x4e0a50);}(_0xe819,0x1a3));var _0x9e81=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe819[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x9e81('0x0'));var rimraf=require(_0x9e81('0x1'));var zipdir=require(_0x9e81('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9e81('0x3'));var Mustache=require('mustache');var util=require(_0x9e81('0x4'));var path=require(_0x9e81('0x5'));var sox=require(_0x9e81('0x6'));var csv=require(_0x9e81('0x7'));var ejs=require(_0x9e81('0x8'));var fs=require('fs');var fs_extra=require(_0x9e81('0x9'));var _=require('lodash');var squel=require(_0x9e81('0xa'));var crypto=require(_0x9e81('0xb'));var jsforce=require(_0x9e81('0xc'));var deskjs=require(_0x9e81('0xd'));var toCsv=require(_0x9e81('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9e81('0xe'));var authService=require(_0x9e81('0xf'));var qs=require(_0x9e81('0x10'));var as=require(_0x9e81('0x11'));var hardwareService=require(_0x9e81('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9e81('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9e81('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9e81('0x15'));var jayson=require(_0x9e81('0x16'));var client=jayson[_0x9e81('0x17')][_0x9e81('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x178dbf,_0x554b5a,_0x240e19,_0x2cf59b){return new BPromise(function(_0x59f410,_0x248db1){var _0x520db7=_0x2cf59b||client;return _0x520db7['request'](_0x178dbf,_0x240e19)[_0x9e81('0x19')](function(_0x57577f){logger['info'](_0x9e81('0x1a'),_0x554b5a,_0x9e81('0x1b'));logger[_0x9e81('0x1c')](_0x9e81('0x1d'),_0x554b5a,_0x9e81('0x1b'),JSON['stringify'](_0x57577f));if(_0x57577f[_0x9e81('0x1e')]){if(_0x57577f['error'][_0x9e81('0x1f')]===0x1f4){logger[_0x9e81('0x1e')](_0x9e81('0x1a'),_0x554b5a,_0x57577f['error'][_0x9e81('0x20')]);return _0x248db1(_0x57577f['error'][_0x9e81('0x20')]);}logger[_0x9e81('0x1e')](_0x9e81('0x1a'),_0x554b5a,_0x57577f[_0x9e81('0x1e')][_0x9e81('0x20')]);return _0x59f410(_0x57577f['error'][_0x9e81('0x20')]);}else{logger[_0x9e81('0x21')](_0x9e81('0x1a'),_0x554b5a,_0x9e81('0x1b'));_0x59f410(_0x57577f['result'][_0x9e81('0x20')]);}})['catch'](function(_0x25a3cc){logger[_0x9e81('0x1e')](_0x9e81('0x1a'),_0x554b5a,_0x25a3cc);_0x248db1(_0x25a3cc);});});}function respondWithStatusCode(_0x2dd8fe,_0x31652c){_0x31652c=_0x31652c||0xcc;return function(_0x12cfaa){if(_0x12cfaa){return _0x2dd8fe[_0x9e81('0x22')](_0x31652c);}return _0x2dd8fe[_0x9e81('0x23')](_0x31652c)[_0x9e81('0x24')]();};}function respondWithResult(_0x89b9df,_0x361e66){_0x361e66=_0x361e66||0xc8;return function(_0x470dc4){if(_0x470dc4){return _0x89b9df[_0x9e81('0x23')](_0x361e66)['json'](_0x470dc4);}};}function respondWithFilteredResult(_0x51c25a,_0x2b68be){return function(_0x72856){if(_0x72856){var _0x3c3d0c=typeof _0x2b68be[_0x9e81('0x25')]===_0x9e81('0x26')&&typeof _0x2b68be[_0x9e81('0x27')]===_0x9e81('0x26');var _0x51ba06=_0x72856['count'];var _0x163e06=_0x3c3d0c?0x0:_0x2b68be[_0x9e81('0x25')];var _0x57ab1a=_0x3c3d0c?_0x72856[_0x9e81('0x28')]:_0x2b68be[_0x9e81('0x25')]+_0x2b68be[_0x9e81('0x27')];var _0x51cb0c;if(_0x57ab1a>=_0x51ba06){_0x57ab1a=_0x51ba06;_0x51cb0c=0xc8;}else{_0x51cb0c=0xce;}_0x51c25a[_0x9e81('0x23')](_0x51cb0c);return _0x51c25a[_0x9e81('0x29')](_0x9e81('0x2a'),_0x163e06+'-'+_0x57ab1a+'/'+_0x51ba06)[_0x9e81('0x2b')](_0x72856);}return null;};}function patchUpdates(_0x37eabe){return function(_0x415123){try{jsonpatch[_0x9e81('0x2c')](_0x415123,_0x37eabe,!![]);}catch(_0x2a8870){return BPromise['reject'](_0x2a8870);}return _0x415123[_0x9e81('0x2d')]();};}function saveUpdates(_0x199679,_0x4fa9c7){return function(_0x3fc82d){if(_0x3fc82d){return _0x3fc82d['update'](_0x199679)[_0x9e81('0x19')](function(_0xd909d1){return _0xd909d1;});}return null;};}function removeEntity(_0x577c8a,_0x20f3e9){return function(_0x4eb295){if(_0x4eb295){return _0x4eb295[_0x9e81('0x2e')]()[_0x9e81('0x19')](function(){_0x577c8a[_0x9e81('0x23')](0xcc)[_0x9e81('0x24')]();});}};}function handleEntityNotFound(_0x537d2c,_0x247354){return function(_0x9ea983){if(!_0x9ea983){_0x537d2c[_0x9e81('0x22')](0x194);}return _0x9ea983;};}function handleError(_0x45934d,_0x21ce1d){_0x21ce1d=_0x21ce1d||0x1f4;return function(_0x25d193){logger[_0x9e81('0x1e')](_0x25d193[_0x9e81('0x2f')]);if(_0x25d193['name']){delete _0x25d193[_0x9e81('0x30')];}_0x45934d[_0x9e81('0x23')](_0x21ce1d)[_0x9e81('0x31')](_0x25d193);};}exports['index']=function(_0x1c9081,_0x54c922){var _0x31e9e2={},_0x1f4416={},_0x453646={'count':0x0,'rows':[]};var _0x20d969=_[_0x9e81('0x32')](db[_0x9e81('0x33')][_0x9e81('0x34')],function(_0xf409b9){return{'name':_0xf409b9[_0x9e81('0x35')],'type':_0xf409b9['type'][_0x9e81('0x36')]};});_0x1f4416[_0x9e81('0x37')]=_[_0x9e81('0x32')](_0x20d969,_0x9e81('0x30'));_0x1f4416[_0x9e81('0x38')]=_[_0x9e81('0x39')](_0x1c9081['query']);_0x1f4416[_0x9e81('0x3a')]=_['intersection'](_0x1f4416[_0x9e81('0x37')],_0x1f4416[_0x9e81('0x38')]);_0x31e9e2['attributes']=_[_0x9e81('0x3b')](_0x1f4416[_0x9e81('0x37')],qs[_0x9e81('0x3c')](_0x1c9081[_0x9e81('0x38')][_0x9e81('0x3c')]));_0x31e9e2[_0x9e81('0x3d')]=_0x31e9e2[_0x9e81('0x3d')][_0x9e81('0x3e')]?_0x31e9e2['attributes']:_0x1f4416['model'];if(!_0x1c9081[_0x9e81('0x38')][_0x9e81('0x3f')](_0x9e81('0x40'))){_0x31e9e2[_0x9e81('0x27')]=qs[_0x9e81('0x27')](_0x1c9081['query'][_0x9e81('0x27')]);_0x31e9e2[_0x9e81('0x25')]=qs[_0x9e81('0x25')](_0x1c9081[_0x9e81('0x38')][_0x9e81('0x25')]);}_0x31e9e2[_0x9e81('0x41')]=qs['sort'](_0x1c9081[_0x9e81('0x38')][_0x9e81('0x42')]);_0x31e9e2[_0x9e81('0x43')]=qs['filters'](_[_0x9e81('0x44')](_0x1c9081['query'],_0x1f4416[_0x9e81('0x3a')]),_0x20d969);if(_0x1c9081[_0x9e81('0x38')][_0x9e81('0x45')]){_0x31e9e2[_0x9e81('0x43')]=_['merge'](_0x31e9e2['where'],{'$or':_[_0x9e81('0x32')](_0x20d969,function(_0xda186){if(_0xda186[_0x9e81('0x46')]!=='VIRTUAL'){var _0x576a89={};_0x576a89[_0xda186[_0x9e81('0x30')]]={'$like':'%'+_0x1c9081[_0x9e81('0x38')]['filter']+'%'};return _0x576a89;}})});}_0x31e9e2=_[_0x9e81('0x47')]({},_0x31e9e2,_0x1c9081[_0x9e81('0x48')]);var _0x111b5e={'where':_0x31e9e2[_0x9e81('0x43')]};return db['ZendeskAccount'][_0x9e81('0x28')](_0x111b5e)[_0x9e81('0x19')](function(_0x3a2333){_0x453646[_0x9e81('0x28')]=_0x3a2333;if(_0x1c9081[_0x9e81('0x38')][_0x9e81('0x49')]){_0x31e9e2[_0x9e81('0x4a')]=[{'all':!![]}];}return db[_0x9e81('0x33')]['findAll'](_0x31e9e2);})['then'](function(_0x13d05b){_0x453646[_0x9e81('0x4b')]=_0x13d05b;return _0x453646;})[_0x9e81('0x19')](respondWithFilteredResult(_0x54c922,_0x31e9e2))[_0x9e81('0x4c')](handleError(_0x54c922,null));};exports['show']=function(_0x5cdc25,_0x768b15){var _0x589ad5={'raw':![],'where':{'id':_0x5cdc25[_0x9e81('0x4d')]['id']}},_0x240836={};_0x240836[_0x9e81('0x37')]=_[_0x9e81('0x39')](db[_0x9e81('0x33')][_0x9e81('0x34')]);_0x240836[_0x9e81('0x38')]=_['keys'](_0x5cdc25[_0x9e81('0x38')]);_0x240836['filters']=_['intersection'](_0x240836[_0x9e81('0x37')],_0x240836['query']);_0x589ad5[_0x9e81('0x3d')]=_[_0x9e81('0x3b')](_0x240836[_0x9e81('0x37')],qs[_0x9e81('0x3c')](_0x5cdc25[_0x9e81('0x38')][_0x9e81('0x3c')]));_0x589ad5[_0x9e81('0x3d')]=_0x589ad5['attributes'][_0x9e81('0x3e')]?_0x589ad5[_0x9e81('0x3d')]:_0x240836[_0x9e81('0x37')];if(_0x5cdc25['query'][_0x9e81('0x49')]){_0x589ad5[_0x9e81('0x4a')]=[{'all':!![]}];}_0x589ad5=_[_0x9e81('0x47')]({},_0x589ad5,_0x5cdc25[_0x9e81('0x48')]);return db[_0x9e81('0x33')][_0x9e81('0x4e')](_0x589ad5)['then'](handleEntityNotFound(_0x768b15,null))[_0x9e81('0x19')](respondWithResult(_0x768b15,null))['catch'](handleError(_0x768b15,null));};exports[_0x9e81('0x4f')]=function(_0x37bda7,_0x557ef0){return db[_0x9e81('0x33')][_0x9e81('0x4f')](_0x37bda7[_0x9e81('0x50')],{})[_0x9e81('0x19')](respondWithResult(_0x557ef0,0xc9))[_0x9e81('0x4c')](handleError(_0x557ef0,null));};exports['update']=function(_0x340689,_0x20e9dd){if(_0x340689[_0x9e81('0x50')]['id']){delete _0x340689['body']['id'];}return db['ZendeskAccount'][_0x9e81('0x4e')]({'where':{'id':_0x340689['params']['id']}})['then'](handleEntityNotFound(_0x20e9dd,null))[_0x9e81('0x19')](saveUpdates(_0x340689[_0x9e81('0x50')],null))['then'](respondWithResult(_0x20e9dd,null))[_0x9e81('0x4c')](handleError(_0x20e9dd,null));};exports[_0x9e81('0x2e')]=function(_0x3aa7bc,_0x3cb713){return db['ZendeskAccount'][_0x9e81('0x4e')]({'where':{'id':_0x3aa7bc[_0x9e81('0x4d')]['id']}})[_0x9e81('0x19')](handleEntityNotFound(_0x3cb713,null))['then'](removeEntity(_0x3cb713,null))[_0x9e81('0x4c')](handleError(_0x3cb713,null));};exports[_0x9e81('0x51')]=function(_0x164902,_0x2a1cbf,_0xf4996b){var _0x4c3077={};var _0x31cec1={};var _0xdf791a;var _0xadefae;return db[_0x9e81('0x33')][_0x9e81('0x52')]({'where':{'id':_0x164902[_0x9e81('0x4d')]['id']}})[_0x9e81('0x19')](handleEntityNotFound(_0x2a1cbf,null))[_0x9e81('0x19')](function(_0x3cb00d){if(_0x3cb00d){_0xdf791a=_0x3cb00d;_0x31cec1[_0x9e81('0x37')]=_['keys'](db[_0x9e81('0x53')][_0x9e81('0x34')]);_0x31cec1[_0x9e81('0x38')]=_[_0x9e81('0x39')](_0x164902[_0x9e81('0x38')]);_0x31cec1['filters']=_[_0x9e81('0x3b')](_0x31cec1[_0x9e81('0x37')],_0x31cec1[_0x9e81('0x38')]);_0x4c3077['attributes']=_[_0x9e81('0x3b')](_0x31cec1[_0x9e81('0x37')],qs[_0x9e81('0x3c')](_0x164902['query']['fields']));_0x4c3077['attributes']=_0x4c3077[_0x9e81('0x3d')][_0x9e81('0x3e')]?_0x4c3077[_0x9e81('0x3d')]:_0x31cec1[_0x9e81('0x37')];_0x4c3077['order']=qs[_0x9e81('0x42')](_0x164902['query'][_0x9e81('0x42')]);_0x4c3077[_0x9e81('0x43')]=qs['filters'](_['pick'](_0x164902[_0x9e81('0x38')],_0x31cec1['filters']));if(_0x164902[_0x9e81('0x38')][_0x9e81('0x45')]){_0x4c3077[_0x9e81('0x43')]=_['merge'](_0x4c3077['where'],{'$or':_[_0x9e81('0x32')](_0x4c3077['attributes'],function(_0x17ac29){var _0x2b22ad={};_0x2b22ad[_0x17ac29]={'$like':'%'+_0x164902[_0x9e81('0x38')][_0x9e81('0x45')]+'%'};return _0x2b22ad;})});}_0x4c3077=_[_0x9e81('0x47')]({},_0x4c3077,_0x164902[_0x9e81('0x48')]);return _0xdf791a[_0x9e81('0x51')](_0x4c3077);}})[_0x9e81('0x19')](function(_0xc5051b){if(_0xc5051b){_0xadefae=_0xc5051b['length'];if(!_0x164902[_0x9e81('0x38')][_0x9e81('0x3f')]('nolimit')){_0x4c3077[_0x9e81('0x27')]=qs[_0x9e81('0x27')](_0x164902[_0x9e81('0x38')]['limit']);_0x4c3077[_0x9e81('0x25')]=qs['offset'](_0x164902[_0x9e81('0x38')][_0x9e81('0x25')]);}return _0xdf791a[_0x9e81('0x51')](_0x4c3077);}})[_0x9e81('0x19')](function(_0x3a3784){if(_0x3a3784){return _0x3a3784?{'count':_0xadefae,'rows':_0x3a3784}:null;}})[_0x9e81('0x19')](respondWithResult(_0x2a1cbf,null))['catch'](handleError(_0x2a1cbf,null));};exports[_0x9e81('0x54')]=function(_0x52ad72,_0x3198cd,_0x32112d){if(_0x52ad72[_0x9e81('0x50')]['id']){delete _0x52ad72[_0x9e81('0x50')]['id'];}return db[_0x9e81('0x33')]['findOne']({'where':{'id':_0x52ad72['params']['id']}})['then'](handleEntityNotFound(_0x3198cd,null))['then'](function(_0x3a3248){if(_0x3a3248){_0x52ad72[_0x9e81('0x50')]['AccountId']=_0x3a3248['id'];_0x52ad72['body'][_0x9e81('0x55')]=integrations[_0x9e81('0x56')](_0x52ad72[_0x9e81('0x50')][_0x9e81('0x57')],_0x52ad72[_0x9e81('0x50')][_0x9e81('0x46')]);_0x52ad72['body'][_0x9e81('0x58')]=integrations[_0x9e81('0x59')](_0x52ad72['body']['channel'],_0x52ad72[_0x9e81('0x50')]['type']);return db[_0x9e81('0x53')][_0x9e81('0x4f')](_0x52ad72['body'],{'include':[{'model':db['ZendeskField'],'as':_0x9e81('0x55')},{'model':db[_0x9e81('0x5a')],'as':_0x9e81('0x58')}]});}return null;})[_0x9e81('0x19')](respondWithResult(_0x3198cd,null))[_0x9e81('0x4c')](handleError(_0x3198cd,null));};exports[_0x9e81('0x5b')]=function(_0x1a17d1,_0xd70356,_0x2e8425){var _0xac2f9c='';return db[_0x9e81('0x33')][_0x9e81('0x52')]({'where':{'id':_0x1a17d1['params']['id']},'attributes':['id',_0x9e81('0x5c'),_0x9e81('0x5d'),_0x9e81('0x5e'),_0x9e81('0x5f'),_0x9e81('0x60')]})['then'](handleEntityNotFound(_0xd70356,null))[_0x9e81('0x19')](function(_0x2d310b){if(_0x2d310b){_0xac2f9c=_0x2d310b['remoteUri'];var _0x35b8c9=_0xac2f9c['slice'](-0x1);if(_0x35b8c9==='/'){_0xac2f9c=_0xac2f9c['substring'](0x0,_0xac2f9c['lastIndexOf'](_0x35b8c9));}var _0x513148={'method':_0x9e81('0x61'),'uri':util['format'](_0x9e81('0x62'),_0xac2f9c,_0x9e81('0x63')),'json':!![]};switch(_0x2d310b[_0x9e81('0x5f')]){case'password':_0x513148[_0x9e81('0x64')]={'Authorization':util[_0x9e81('0x65')]('Basic\x20%s',new Buffer(util['format'](_0x9e81('0x66'),_0x2d310b[_0x9e81('0x5c')],_0x2d310b[_0x9e81('0x5d')]))['toString'](_0x9e81('0x67')))};break;case'token':_0x513148[_0x9e81('0x64')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x9e81('0x68'),_0x2d310b['username'],_0x2d310b[_0x9e81('0x5e')]))[_0x9e81('0x69')](_0x9e81('0x67')))};break;default:throw new db[(_0x9e81('0x6a'))][(_0x9e81('0x6b'))]('Unknown\x20authentication\x20type');}return rp(_0x513148);}})[_0x9e81('0x19')](function(_0x476a1f){if(_0x476a1f){var _0x3546b7=[_0x9e81('0x6c'),_0x9e81('0x6d'),_0x9e81('0x6e'),_0x9e81('0x6f')];_[_0x9e81('0x70')](_0x476a1f[_0x9e81('0x63')],function(_0x462c34){return _0x3546b7[_0x9e81('0x71')](_0x462c34['type']);});return{'count':_0x476a1f[_0x9e81('0x63')][_0x9e81('0x3e')],'rows':_['map'](_0x476a1f['ticket_fields'],function(_0x23c7ba){return{'id':_0x23c7ba['id'],'name':_0x23c7ba[_0x9e81('0x72')]>0x7?_0x23c7ba[_0x9e81('0x73')]:_0x23c7ba[_0x9e81('0x46')],'custom':_0x23c7ba['position']>0x7?!![]:![],'options':_0x23c7ba[_0x9e81('0x74')]?_0x23c7ba[_0x9e81('0x74')]:_0x23c7ba[_0x9e81('0x75')]?_0x23c7ba[_0x9e81('0x75')]:[]};})};}})[_0x9e81('0x19')](respondWithResult(_0xd70356,null))[_0x9e81('0x4c')](function(_0x4c32fe){var _0x2d5d13=_0x1a17d1['query'][_0x9e81('0x76')]?0x1f4:_0x4c32fe[_0x9e81('0x77')]||0x1f4;logger[_0x9e81('0x1e')](_0x9e81('0x78'),'getFields',_0x2d5d13,JSON[_0x9e81('0x79')](_0x4c32fe));delete _0x4c32fe[_0x9e81('0x30')];if(_0x2d5d13===0x191){_0x2d5d13=0x190;}_0xd70356[_0x9e81('0x23')](_0x2d5d13)[_0x9e81('0x31')](_0x1a17d1[_0x9e81('0x38')][_0x9e81('0x76')]?{'message':_0x9e81('0x7a'),'statusCode':_0x4c32fe[_0x9e81('0x77')]}:_0x4c32fe);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 658683d..030cc54 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 _0x93a8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','api'];(function(_0x464b49,_0x24f821){var _0x587e61=function(_0x1c241d){while(--_0x1c241d){_0x464b49['push'](_0x464b49['shift']());}};_0x587e61(++_0x24f821);}(_0x93a8,0x129));var _0x893a=function(_0x4c61da,_0x2196b3){_0x4c61da=_0x4c61da-0x0;var _0x116a67=_0x93a8[_0x4c61da];return _0x116a67;};'use strict';var _=require(_0x893a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x893a('0x1'));var moment=require(_0x893a('0x2'));var BPromise=require(_0x893a('0x3'));var rp=require(_0x893a('0x4'));var fs=require('fs');var path=require(_0x893a('0x5'));var rimraf=require(_0x893a('0x6'));var config=require(_0x893a('0x7'));var attributes=require(_0x893a('0x8'));var integrations=require(_0x893a('0x9'));module[_0x893a('0xa')]=function(_0x447bba,_0x2077a3){return _0x447bba[_0x893a('0xb')](_0x893a('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf898=['../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes'];(function(_0x360cc7,_0x2373f4){var _0x36c3b7=function(_0x112d09){while(--_0x112d09){_0x360cc7['push'](_0x360cc7['shift']());}};_0x36c3b7(++_0x2373f4);}(_0xf898,0x171));var _0x8f89=function(_0x71a864,_0x332fed){_0x71a864=_0x71a864-0x0;var _0x13ef99=_0xf898[_0x71a864];return _0x13ef99;};'use strict';var _=require('lodash');var util=require(_0x8f89('0x0'));var logger=require(_0x8f89('0x1'))('api');var moment=require(_0x8f89('0x2'));var BPromise=require(_0x8f89('0x3'));var rp=require(_0x8f89('0x4'));var fs=require('fs');var path=require(_0x8f89('0x5'));var rimraf=require('rimraf');var config=require(_0x8f89('0x6'));var attributes=require(_0x8f89('0x7'));var integrations=require(_0x8f89('0x8'));module[_0x8f89('0x9')]=function(_0x15c962,_0x57ac5a){return _0x15c962[_0x8f89('0xa')](_0x8f89('0xb'),attributes,{'tableName':_0x8f89('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 7c36b46..652605b 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 _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x205572,_0x1b721a){var _0x29916a=function(_0x458754){while(--_0x458754){_0x205572['push'](_0x205572['shift']());}};_0x29916a(++_0x1b721a);}(_0x757a,0xde));var _0xa757=function(_0x21ce4f,_0x543fec){_0x21ce4f=_0x21ce4f-0x0;var _0x57bfb0=_0x757a[_0x21ce4f];return _0x57bfb0;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x4f6908,_0x3e0211){var _0x4127fc=function(_0x171ec4){while(--_0x171ec4){_0x4f6908['push'](_0x4f6908['shift']());}};_0x4127fc(++_0x3e0211);}(_0xe706,0xa3));var _0x6e70=function(_0x397bfb,_0x589665){_0x397bfb=_0x397bfb-0x0;var _0x16c9b9=_0xe706[_0x397bfb];return _0x16c9b9;};'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']('ZendeskAccount,\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']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index bce0104..a1570e5 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 _0x34ac=['/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x4e35dc,_0x53daef){var _0x315b47=function(_0x1da58b){while(--_0x1da58b){_0x4e35dc['push'](_0x4e35dc['shift']());}};_0x315b47(++_0x53daef);}(_0x34ac,0xcb));var _0xc34a=function(_0x217a0b,_0x1afe1b){_0x217a0b=_0x217a0b-0x0;var _0x298e0c=_0x34ac[_0x217a0b];return _0x298e0c;};'use strict';var multer=require(_0xc34a('0x0'));var util=require(_0xc34a('0x1'));var path=require(_0xc34a('0x2'));var timeout=require(_0xc34a('0x3'));var express=require(_0xc34a('0x4'));var router=express[_0xc34a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc34a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc34a('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0xc34a('0x8')]('/',auth['isAuthenticated'](),controller[_0xc34a('0x9')]);router[_0xc34a('0x8')](_0xc34a('0xa'),auth[_0xc34a('0xb')](),controller[_0xc34a('0xc')]);router[_0xc34a('0x8')](_0xc34a('0xd'),auth[_0xc34a('0xb')](),controller['getFields']);router[_0xc34a('0x8')](_0xc34a('0xe'),auth[_0xc34a('0xb')](),controller['getSubjects']);router[_0xc34a('0x8')](_0xc34a('0xf'),auth[_0xc34a('0xb')](),controller[_0xc34a('0x10')]);router[_0xc34a('0x8')]('/:id/tags',auth[_0xc34a('0xb')](),controller[_0xc34a('0x11')]);router['post']('/',auth[_0xc34a('0xb')](),controller[_0xc34a('0x12')]);router['post']('/:id/tags',auth[_0xc34a('0xb')](),controller[_0xc34a('0x13')]);router[_0xc34a('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xc34a('0x15')]);router[_0xc34a('0x16')](_0xc34a('0xa'),auth[_0xc34a('0xb')](),controller['destroy']);module[_0xc34a('0x17')]=router; \ No newline at end of file +var _0x5eab=['get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller'];(function(_0x346806,_0x422d8e){var _0x5d86db=function(_0x2d7960){while(--_0x2d7960){_0x346806['push'](_0x346806['shift']());}};_0x5d86db(++_0x422d8e);}(_0x5eab,0x124));var _0xb5ea=function(_0x282f51,_0x13a8de){_0x282f51=_0x282f51-0x0;var _0x196e37=_0x5eab[_0x282f51];return _0x196e37;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb5ea('0x0'));var timeout=require(_0xb5ea('0x1'));var express=require('express');var router=express[_0xb5ea('0x2')]();var fs_extra=require(_0xb5ea('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb5ea('0x4'));var config=require(_0xb5ea('0x5'));var controller=require(_0xb5ea('0x6'));router[_0xb5ea('0x7')]('/',auth[_0xb5ea('0x8')](),controller['index']);router[_0xb5ea('0x7')](_0xb5ea('0x9'),auth[_0xb5ea('0x8')](),controller[_0xb5ea('0xa')]);router[_0xb5ea('0x7')](_0xb5ea('0xb'),auth[_0xb5ea('0x8')](),controller[_0xb5ea('0xc')]);router[_0xb5ea('0x7')](_0xb5ea('0xd'),auth[_0xb5ea('0x8')](),controller['getSubjects']);router['get'](_0xb5ea('0xe'),auth[_0xb5ea('0x8')](),controller[_0xb5ea('0xf')]);router[_0xb5ea('0x7')](_0xb5ea('0x10'),auth[_0xb5ea('0x8')](),controller[_0xb5ea('0x11')]);router[_0xb5ea('0x12')]('/',auth[_0xb5ea('0x8')](),controller[_0xb5ea('0x13')]);router[_0xb5ea('0x12')]('/:id/tags',auth[_0xb5ea('0x8')](),controller[_0xb5ea('0x14')]);router['put']('/:id',auth[_0xb5ea('0x8')](),controller[_0xb5ea('0x15')]);router[_0xb5ea('0x16')](_0xb5ea('0x9'),auth[_0xb5ea('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index cd48778..737f7d7 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 _0x9314=['exports'];(function(_0x2f6276,_0x540a57){var _0x3c3df9=function(_0x211b6e){while(--_0x211b6e){_0x2f6276['push'](_0x2f6276['shift']());}};_0x3c3df9(++_0x540a57);}(_0x9314,0x125));var _0x4931=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9314[_0x5d2803];return _0xdcad2c;};'use strict';var Sequelize=require('sequelize');module[_0x4931('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x17b1=['STRING','sequelize'];(function(_0x31eb6a,_0x4853c2){var _0xc7c43e=function(_0x3c1796){while(--_0x3c1796){_0x31eb6a['push'](_0x31eb6a['shift']());}};_0xc7c43e(++_0x4853c2);}(_0x17b1,0x165));var _0x117b=function(_0x34ecea,_0x3d11ce){_0x34ecea=_0x34ecea-0x0;var _0x44b6a8=_0x17b1[_0x34ecea];return _0x44b6a8;};'use strict';var Sequelize=require(_0x117b('0x0'));module['exports']={'name':{'type':Sequelize[_0x117b('0x1')]},'description':{'type':Sequelize[_0x117b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index dbb4b47..d19919a 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 _0x4707=['apply','save','update','destroy','sendStatus','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','include','create','body','params','find','getFields','ZendeskField','length','getSubjects','findOne','pick','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','offset','undefined','limit','count','set'];(function(_0x3109c8,_0x1510cc){var _0x294f06=function(_0x56f0b2){while(--_0x56f0b2){_0x3109c8['push'](_0x3109c8['shift']());}};_0x294f06(++_0x1510cc);}(_0x4707,0x19c));var _0x7470=function(_0x24b7c3,_0x4a04d6){_0x24b7c3=_0x24b7c3-0x0;var _0x1fd661=_0x4707[_0x24b7c3];return _0x1fd661;};'use strict';var emlformat=require(_0x7470('0x0'));var rimraf=require(_0x7470('0x1'));var zipdir=require(_0x7470('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7470('0x3'));var moment=require(_0x7470('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7470('0x5'));var path=require(_0x7470('0x6'));var sox=require(_0x7470('0x7'));var csv=require(_0x7470('0x8'));var ejs=require(_0x7470('0x9'));var fs=require('fs');var fs_extra=require(_0x7470('0xa'));var _=require('lodash');var squel=require(_0x7470('0xb'));var crypto=require(_0x7470('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7470('0xd'));var toCsv=require(_0x7470('0x8'));var querystring=require(_0x7470('0xe'));var Papa=require('papaparse');var Redis=require(_0x7470('0xf'));var authService=require(_0x7470('0x10'));var qs=require(_0x7470('0x11'));var as=require(_0x7470('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7470('0x13'));var utils=require(_0x7470('0x14'));var config=require(_0x7470('0x15'));var licenseUtil=require(_0x7470('0x16'));var db=require(_0x7470('0x17'))['db'];var jayson=require(_0x7470('0x18'));var client=jayson[_0x7470('0x19')][_0x7470('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x37280b,_0x335969,_0x3876c5,_0x354396){return new BPromise(function(_0x4939a4,_0x18dc45){var _0x54d2f8=_0x354396||client;return _0x54d2f8['request'](_0x37280b,_0x3876c5)[_0x7470('0x1b')](function(_0x5d328c){logger[_0x7470('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x335969,_0x7470('0x1d'));logger['debug'](_0x7470('0x1e'),_0x335969,'request\x20sent',JSON[_0x7470('0x1f')](_0x5d328c));if(_0x5d328c[_0x7470('0x20')]){if(_0x5d328c['error']['code']===0x1f4){logger[_0x7470('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x335969,_0x5d328c[_0x7470('0x20')]['message']);return _0x18dc45(_0x5d328c[_0x7470('0x20')][_0x7470('0x21')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x335969,_0x5d328c[_0x7470('0x20')]['message']);return _0x4939a4(_0x5d328c[_0x7470('0x20')]['message']);}else{logger[_0x7470('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x335969,_0x7470('0x1d'));_0x4939a4(_0x5d328c['result'][_0x7470('0x21')]);}})[_0x7470('0x22')](function(_0x7cb276){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x335969,_0x7cb276);_0x18dc45(_0x7cb276);});});}function respondWithStatusCode(_0x54f29d,_0x4ecbbf){_0x4ecbbf=_0x4ecbbf||0xcc;return function(_0x479c4d){if(_0x479c4d){return _0x54f29d['sendStatus'](_0x4ecbbf);}return _0x54f29d[_0x7470('0x23')](_0x4ecbbf)[_0x7470('0x24')]();};}function respondWithResult(_0xf15a22,_0x434435){_0x434435=_0x434435||0xc8;return function(_0x4e685b){if(_0x4e685b){return _0xf15a22['status'](_0x434435)[_0x7470('0x25')](_0x4e685b);}};}function respondWithFilteredResult(_0x3f765f,_0x277b81){return function(_0x4e137b){if(_0x4e137b){var _0x3ef644=typeof _0x277b81[_0x7470('0x26')]===_0x7470('0x27')&&typeof _0x277b81[_0x7470('0x28')]===_0x7470('0x27');var _0x51e8e3=_0x4e137b[_0x7470('0x29')];var _0x2cc7b9=_0x3ef644?0x0:_0x277b81['offset'];var _0x33118a=_0x3ef644?_0x4e137b[_0x7470('0x29')]:_0x277b81[_0x7470('0x26')]+_0x277b81[_0x7470('0x28')];var _0x29fe7e;if(_0x33118a>=_0x51e8e3){_0x33118a=_0x51e8e3;_0x29fe7e=0xc8;}else{_0x29fe7e=0xce;}_0x3f765f[_0x7470('0x23')](_0x29fe7e);return _0x3f765f[_0x7470('0x2a')]('Content-Range',_0x2cc7b9+'-'+_0x33118a+'/'+_0x51e8e3)[_0x7470('0x25')](_0x4e137b);}return null;};}function patchUpdates(_0x3359f4){return function(_0x20adee){try{jsonpatch[_0x7470('0x2b')](_0x20adee,_0x3359f4,!![]);}catch(_0x51d3bc){return BPromise['reject'](_0x51d3bc);}return _0x20adee[_0x7470('0x2c')]();};}function saveUpdates(_0x2676ab,_0x3eb0c5){return function(_0x5815b9){if(_0x5815b9){return _0x5815b9[_0x7470('0x2d')](_0x2676ab)['then'](function(_0x11ca28){return _0x11ca28;});}return null;};}function removeEntity(_0x35a1bc,_0x10fe9b){return function(_0x272edf){if(_0x272edf){return _0x272edf[_0x7470('0x2e')]()[_0x7470('0x1b')](function(){_0x35a1bc[_0x7470('0x23')](0xcc)[_0x7470('0x24')]();});}};}function handleEntityNotFound(_0x90b56c,_0x507700){return function(_0x371136){if(!_0x371136){_0x90b56c[_0x7470('0x2f')](0x194);}return _0x371136;};}function handleError(_0x32b6e5,_0x17a48c){_0x17a48c=_0x17a48c||0x1f4;return function(_0x532928){logger[_0x7470('0x20')](_0x532928['stack']);if(_0x532928[_0x7470('0x30')]){delete _0x532928[_0x7470('0x30')];}_0x32b6e5[_0x7470('0x23')](_0x17a48c)[_0x7470('0x31')](_0x532928);};}exports['index']=function(_0x52b93c,_0x1384bf){var _0x1eff66={},_0xc27cda={},_0x13a0e3={'count':0x0,'rows':[]};var _0x9de693=_[_0x7470('0x32')](db[_0x7470('0x33')][_0x7470('0x34')],function(_0x45d4f8){return{'name':_0x45d4f8[_0x7470('0x35')],'type':_0x45d4f8['type'][_0x7470('0x36')]};});_0xc27cda[_0x7470('0x37')]=_['map'](_0x9de693,_0x7470('0x30'));_0xc27cda[_0x7470('0x38')]=_[_0x7470('0x39')](_0x52b93c[_0x7470('0x38')]);_0xc27cda['filters']=_[_0x7470('0x3a')](_0xc27cda[_0x7470('0x37')],_0xc27cda[_0x7470('0x38')]);_0x1eff66[_0x7470('0x3b')]=_[_0x7470('0x3a')](_0xc27cda['model'],qs[_0x7470('0x3c')](_0x52b93c['query'][_0x7470('0x3c')]));_0x1eff66[_0x7470('0x3b')]=_0x1eff66[_0x7470('0x3b')]['length']?_0x1eff66[_0x7470('0x3b')]:_0xc27cda[_0x7470('0x37')];if(!_0x52b93c[_0x7470('0x38')][_0x7470('0x3d')](_0x7470('0x3e'))){_0x1eff66[_0x7470('0x28')]=qs[_0x7470('0x28')](_0x52b93c[_0x7470('0x38')][_0x7470('0x28')]);_0x1eff66['offset']=qs['offset'](_0x52b93c[_0x7470('0x38')][_0x7470('0x26')]);}_0x1eff66[_0x7470('0x3f')]=qs['sort'](_0x52b93c['query'][_0x7470('0x40')]);_0x1eff66[_0x7470('0x41')]=qs['filters'](_['pick'](_0x52b93c['query'],_0xc27cda[_0x7470('0x42')]),_0x9de693);if(_0x52b93c[_0x7470('0x38')]['filter']){_0x1eff66[_0x7470('0x41')]=_[_0x7470('0x43')](_0x1eff66['where'],{'$or':_[_0x7470('0x32')](_0x9de693,function(_0x3add8c){if(_0x3add8c[_0x7470('0x44')]!==_0x7470('0x45')){var _0x32ce38={};_0x32ce38[_0x3add8c[_0x7470('0x30')]]={'$like':'%'+_0x52b93c[_0x7470('0x38')][_0x7470('0x46')]+'%'};return _0x32ce38;}})});}_0x1eff66=_['merge']({},_0x1eff66,_0x52b93c[_0x7470('0x47')]);var _0x26acaa={'where':_0x1eff66[_0x7470('0x41')]};return db['ZendeskConfiguration'][_0x7470('0x29')](_0x26acaa)[_0x7470('0x1b')](function(_0x435443){_0x13a0e3['count']=_0x435443;if(_0x52b93c[_0x7470('0x38')][_0x7470('0x48')]){_0x1eff66['include']=[{'all':!![]}];}return db[_0x7470('0x33')][_0x7470('0x49')](_0x1eff66);})[_0x7470('0x1b')](function(_0x54ba6f){_0x13a0e3[_0x7470('0x4a')]=_0x54ba6f;return _0x13a0e3;})[_0x7470('0x1b')](respondWithFilteredResult(_0x1384bf,_0x1eff66))['catch'](handleError(_0x1384bf,null));};exports[_0x7470('0x4b')]=function(_0x8a032c,_0x4a2e03){var _0x39e179={'raw':![],'where':{'id':_0x8a032c['params']['id']}},_0x558242={};_0x558242[_0x7470('0x37')]=_['keys'](db['ZendeskConfiguration'][_0x7470('0x34')]);_0x558242[_0x7470('0x38')]=_[_0x7470('0x39')](_0x8a032c[_0x7470('0x38')]);_0x558242[_0x7470('0x42')]=_[_0x7470('0x3a')](_0x558242[_0x7470('0x37')],_0x558242[_0x7470('0x38')]);_0x39e179[_0x7470('0x3b')]=_['intersection'](_0x558242[_0x7470('0x37')],qs['fields'](_0x8a032c[_0x7470('0x38')][_0x7470('0x3c')]));_0x39e179[_0x7470('0x3b')]=_0x39e179['attributes']['length']?_0x39e179[_0x7470('0x3b')]:_0x558242[_0x7470('0x37')];if(_0x8a032c[_0x7470('0x38')]['includeAll']){_0x39e179[_0x7470('0x4c')]=[{'all':!![]}];}_0x39e179=_[_0x7470('0x43')]({},_0x39e179,_0x8a032c[_0x7470('0x47')]);return db[_0x7470('0x33')]['find'](_0x39e179)['then'](handleEntityNotFound(_0x4a2e03,null))[_0x7470('0x1b')](respondWithResult(_0x4a2e03,null))[_0x7470('0x22')](handleError(_0x4a2e03,null));};exports['create']=function(_0x4b87ff,_0x598696){return db[_0x7470('0x33')][_0x7470('0x4d')](_0x4b87ff[_0x7470('0x4e')],{})['then'](respondWithResult(_0x598696,0xc9))[_0x7470('0x22')](handleError(_0x598696,null));};exports[_0x7470('0x2d')]=function(_0x12ce8f,_0x1db3fb){if(_0x12ce8f[_0x7470('0x4e')]['id']){delete _0x12ce8f[_0x7470('0x4e')]['id'];}return db[_0x7470('0x33')]['find']({'where':{'id':_0x12ce8f[_0x7470('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1db3fb,null))[_0x7470('0x1b')](saveUpdates(_0x12ce8f[_0x7470('0x4e')],null))[_0x7470('0x1b')](respondWithResult(_0x1db3fb,null))[_0x7470('0x22')](handleError(_0x1db3fb,null));};exports[_0x7470('0x2e')]=function(_0x4c34dd,_0x69702a){return db[_0x7470('0x33')][_0x7470('0x50')]({'where':{'id':_0x4c34dd[_0x7470('0x4f')]['id']}})['then'](handleEntityNotFound(_0x69702a,null))['then'](removeEntity(_0x69702a,null))[_0x7470('0x22')](handleError(_0x69702a,null));};exports[_0x7470('0x51')]=function(_0x51a97a,_0x17557d,_0x114ea1){var _0x3fb531={};var _0x5527ae={};var _0x310cc9;var _0x4981f0;return db[_0x7470('0x33')]['findOne']({'where':{'id':_0x51a97a['params']['id']}})[_0x7470('0x1b')](handleEntityNotFound(_0x17557d,null))[_0x7470('0x1b')](function(_0x5c80f7){if(_0x5c80f7){_0x310cc9=_0x5c80f7;_0x5527ae[_0x7470('0x37')]=_[_0x7470('0x39')](db[_0x7470('0x52')]['rawAttributes']);_0x5527ae[_0x7470('0x38')]=_[_0x7470('0x39')](_0x51a97a[_0x7470('0x38')]);_0x5527ae[_0x7470('0x42')]=_['intersection'](_0x5527ae[_0x7470('0x37')],_0x5527ae[_0x7470('0x38')]);_0x3fb531[_0x7470('0x3b')]=_[_0x7470('0x3a')](_0x5527ae[_0x7470('0x37')],qs[_0x7470('0x3c')](_0x51a97a[_0x7470('0x38')][_0x7470('0x3c')]));_0x3fb531['attributes']=_0x3fb531[_0x7470('0x3b')][_0x7470('0x53')]?_0x3fb531[_0x7470('0x3b')]:_0x5527ae[_0x7470('0x37')];_0x3fb531[_0x7470('0x3f')]=qs[_0x7470('0x40')](_0x51a97a[_0x7470('0x38')][_0x7470('0x40')]);_0x3fb531[_0x7470('0x41')]=qs['filters'](_['pick'](_0x51a97a['query'],_0x5527ae['filters']));if(_0x51a97a['query'][_0x7470('0x46')]){_0x3fb531[_0x7470('0x41')]=_[_0x7470('0x43')](_0x3fb531[_0x7470('0x41')],{'$or':_[_0x7470('0x32')](_0x3fb531[_0x7470('0x3b')],function(_0x1565b8){var _0x13d9a7={};_0x13d9a7[_0x1565b8]={'$like':'%'+_0x51a97a['query']['filter']+'%'};return _0x13d9a7;})});}_0x3fb531=_[_0x7470('0x43')]({},_0x3fb531,_0x51a97a[_0x7470('0x47')]);return _0x310cc9[_0x7470('0x51')](_0x3fb531);}})[_0x7470('0x1b')](function(_0x48353f){if(_0x48353f){_0x4981f0=_0x48353f[_0x7470('0x53')];if(!_0x51a97a[_0x7470('0x38')]['hasOwnProperty'](_0x7470('0x3e'))){_0x3fb531['limit']=qs['limit'](_0x51a97a[_0x7470('0x38')][_0x7470('0x28')]);_0x3fb531[_0x7470('0x26')]=qs[_0x7470('0x26')](_0x51a97a[_0x7470('0x38')][_0x7470('0x26')]);}return _0x310cc9[_0x7470('0x51')](_0x3fb531);}})['then'](function(_0x150d2b){if(_0x150d2b){return _0x150d2b?{'count':_0x4981f0,'rows':_0x150d2b}:null;}})[_0x7470('0x1b')](respondWithResult(_0x17557d,null))[_0x7470('0x22')](handleError(_0x17557d,null));};exports[_0x7470('0x54')]=function(_0x17a4c1,_0x4cbae1,_0x378ff1){var _0xe0b77f={};var _0x1727d4={};var _0x59332d;var _0x18f91a;return db['ZendeskConfiguration'][_0x7470('0x55')]({'where':{'id':_0x17a4c1[_0x7470('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4cbae1,null))[_0x7470('0x1b')](function(_0x480210){if(_0x480210){_0x59332d=_0x480210;_0x1727d4['model']=_['keys'](db[_0x7470('0x52')][_0x7470('0x34')]);_0x1727d4[_0x7470('0x38')]=_[_0x7470('0x39')](_0x17a4c1[_0x7470('0x38')]);_0x1727d4[_0x7470('0x42')]=_[_0x7470('0x3a')](_0x1727d4['model'],_0x1727d4[_0x7470('0x38')]);_0xe0b77f['attributes']=_[_0x7470('0x3a')](_0x1727d4[_0x7470('0x37')],qs[_0x7470('0x3c')](_0x17a4c1[_0x7470('0x38')][_0x7470('0x3c')]));_0xe0b77f[_0x7470('0x3b')]=_0xe0b77f[_0x7470('0x3b')][_0x7470('0x53')]?_0xe0b77f[_0x7470('0x3b')]:_0x1727d4['model'];_0xe0b77f[_0x7470('0x3f')]=qs[_0x7470('0x40')](_0x17a4c1[_0x7470('0x38')][_0x7470('0x40')]);_0xe0b77f[_0x7470('0x41')]=qs[_0x7470('0x42')](_[_0x7470('0x56')](_0x17a4c1[_0x7470('0x38')],_0x1727d4[_0x7470('0x42')]));if(_0x17a4c1['query'][_0x7470('0x46')]){_0xe0b77f['where']=_[_0x7470('0x43')](_0xe0b77f[_0x7470('0x41')],{'$or':_[_0x7470('0x32')](_0xe0b77f['attributes'],function(_0x243642){var _0x3a8dd2={};_0x3a8dd2[_0x243642]={'$like':'%'+_0x17a4c1[_0x7470('0x38')][_0x7470('0x46')]+'%'};return _0x3a8dd2;})});}_0xe0b77f=_[_0x7470('0x43')]({},_0xe0b77f,_0x17a4c1[_0x7470('0x47')]);return _0x59332d[_0x7470('0x54')](_0xe0b77f);}})['then'](function(_0x8a75c4){if(_0x8a75c4){_0x18f91a=_0x8a75c4[_0x7470('0x53')];if(!_0x17a4c1[_0x7470('0x38')]['hasOwnProperty'](_0x7470('0x3e'))){_0xe0b77f[_0x7470('0x28')]=qs[_0x7470('0x28')](_0x17a4c1[_0x7470('0x38')][_0x7470('0x28')]);_0xe0b77f['offset']=qs[_0x7470('0x26')](_0x17a4c1[_0x7470('0x38')][_0x7470('0x26')]);}return _0x59332d[_0x7470('0x54')](_0xe0b77f);}})[_0x7470('0x1b')](function(_0x4d4d94){if(_0x4d4d94){return _0x4d4d94?{'count':_0x18f91a,'rows':_0x4d4d94}:null;}})['then'](respondWithResult(_0x4cbae1,null))[_0x7470('0x22')](handleError(_0x4cbae1,null));};exports[_0x7470('0x57')]=function(_0x1724e0,_0xf1dd82,_0x1c6883){var _0x2e3f13={};var _0x3d4b53={};var _0x369dc2;var _0x22ecbe;return db[_0x7470('0x33')][_0x7470('0x55')]({'where':{'id':_0x1724e0['params']['id']}})[_0x7470('0x1b')](handleEntityNotFound(_0xf1dd82,null))[_0x7470('0x1b')](function(_0x624a59){if(_0x624a59){_0x369dc2=_0x624a59;_0x3d4b53['model']=_[_0x7470('0x39')](db[_0x7470('0x52')][_0x7470('0x34')]);_0x3d4b53[_0x7470('0x38')]=_[_0x7470('0x39')](_0x1724e0[_0x7470('0x38')]);_0x3d4b53[_0x7470('0x42')]=_['intersection'](_0x3d4b53[_0x7470('0x37')],_0x3d4b53[_0x7470('0x38')]);_0x2e3f13[_0x7470('0x3b')]=_[_0x7470('0x3a')](_0x3d4b53['model'],qs[_0x7470('0x3c')](_0x1724e0[_0x7470('0x38')]['fields']));_0x2e3f13[_0x7470('0x3b')]=_0x2e3f13[_0x7470('0x3b')][_0x7470('0x53')]?_0x2e3f13[_0x7470('0x3b')]:_0x3d4b53[_0x7470('0x37')];_0x2e3f13[_0x7470('0x3f')]=qs['sort'](_0x1724e0['query'][_0x7470('0x40')]);_0x2e3f13[_0x7470('0x41')]=qs[_0x7470('0x42')](_[_0x7470('0x56')](_0x1724e0['query'],_0x3d4b53['filters']));if(_0x1724e0[_0x7470('0x38')][_0x7470('0x46')]){_0x2e3f13['where']=_['merge'](_0x2e3f13[_0x7470('0x41')],{'$or':_[_0x7470('0x32')](_0x2e3f13[_0x7470('0x3b')],function(_0x37f3cc){var _0x5689db={};_0x5689db[_0x37f3cc]={'$like':'%'+_0x1724e0[_0x7470('0x38')]['filter']+'%'};return _0x5689db;})});}_0x2e3f13=_[_0x7470('0x43')]({},_0x2e3f13,_0x1724e0[_0x7470('0x47')]);return _0x369dc2['getDescriptions'](_0x2e3f13);}})[_0x7470('0x1b')](function(_0xa8d31c){if(_0xa8d31c){_0x22ecbe=_0xa8d31c[_0x7470('0x53')];if(!_0x1724e0[_0x7470('0x38')][_0x7470('0x3d')](_0x7470('0x3e'))){_0x2e3f13[_0x7470('0x28')]=qs[_0x7470('0x28')](_0x1724e0[_0x7470('0x38')]['limit']);_0x2e3f13[_0x7470('0x26')]=qs['offset'](_0x1724e0[_0x7470('0x38')]['offset']);}return _0x369dc2['getDescriptions'](_0x2e3f13);}})[_0x7470('0x1b')](function(_0x527775){if(_0x527775){return _0x527775?{'count':_0x22ecbe,'rows':_0x527775}:null;}})[_0x7470('0x1b')](respondWithResult(_0xf1dd82,null))[_0x7470('0x22')](handleError(_0xf1dd82,null));};exports[_0x7470('0x58')]=function(_0x1625d1,_0xd6974,_0x20f130){var _0x561151={};var _0x26f9d4={};var _0x5b0318;var _0x3ae294;return db[_0x7470('0x33')][_0x7470('0x55')]({'where':{'id':_0x1625d1[_0x7470('0x4f')]['id']}})[_0x7470('0x1b')](handleEntityNotFound(_0xd6974,null))['then'](function(_0x1de956){if(_0x1de956){_0x5b0318=_0x1de956;_0x26f9d4[_0x7470('0x37')]=_['keys'](db[_0x7470('0x59')]['rawAttributes']);_0x26f9d4[_0x7470('0x38')]=_[_0x7470('0x39')](_0x1625d1['query']);_0x26f9d4['filters']=_[_0x7470('0x3a')](_0x26f9d4[_0x7470('0x37')],_0x26f9d4[_0x7470('0x38')]);_0x561151['attributes']=_[_0x7470('0x3a')](_0x26f9d4['model'],qs[_0x7470('0x3c')](_0x1625d1[_0x7470('0x38')]['fields']));_0x561151[_0x7470('0x3b')]=_0x561151[_0x7470('0x3b')][_0x7470('0x53')]?_0x561151[_0x7470('0x3b')]:_0x26f9d4[_0x7470('0x37')];_0x561151[_0x7470('0x3f')]=qs[_0x7470('0x40')](_0x1625d1[_0x7470('0x38')]['sort']);_0x561151[_0x7470('0x41')]=qs[_0x7470('0x42')](_[_0x7470('0x56')](_0x1625d1['query'],_0x26f9d4[_0x7470('0x42')]));if(_0x1625d1[_0x7470('0x38')][_0x7470('0x46')]){_0x561151[_0x7470('0x41')]=_[_0x7470('0x43')](_0x561151[_0x7470('0x41')],{'$or':_[_0x7470('0x32')](_0x561151['attributes'],function(_0x41a0a8){var _0x6e78d9={};_0x6e78d9[_0x41a0a8]={'$like':'%'+_0x1625d1['query'][_0x7470('0x46')]+'%'};return _0x6e78d9;})});}_0x561151=_[_0x7470('0x43')]({},_0x561151,_0x1625d1[_0x7470('0x47')]);return _0x5b0318[_0x7470('0x58')](_0x561151);}})[_0x7470('0x1b')](function(_0x2875cd){if(_0x2875cd){_0x3ae294=_0x2875cd[_0x7470('0x53')];if(!_0x1625d1['query'][_0x7470('0x3d')](_0x7470('0x3e'))){_0x561151[_0x7470('0x28')]=qs[_0x7470('0x28')](_0x1625d1[_0x7470('0x38')][_0x7470('0x28')]);_0x561151['offset']=qs['offset'](_0x1625d1[_0x7470('0x38')]['offset']);}return _0x5b0318[_0x7470('0x58')](_0x561151);}})[_0x7470('0x1b')](function(_0xab7105){if(_0xab7105){return _0xab7105?{'count':_0x3ae294,'rows':_0xab7105}:null;}})[_0x7470('0x1b')](respondWithResult(_0xd6974,null))['catch'](handleError(_0xd6974,null));};exports['setTags']=function(_0x3f40a0,_0xc957c4,_0x1a4224){if(_0x3f40a0[_0x7470('0x4e')]['id']){delete _0x3f40a0[_0x7470('0x4e')]['id'];}return db[_0x7470('0x33')][_0x7470('0x55')]({'where':{'id':_0x3f40a0[_0x7470('0x4f')]['id']}})[_0x7470('0x1b')](handleEntityNotFound(_0xc957c4,null))[_0x7470('0x1b')](function(_0x37ca49){if(_0x37ca49){return _0x37ca49[_0x7470('0x5a')](_0x3f40a0[_0x7470('0x4e')]['ids']||[]);}return null;})[_0x7470('0x1b')](respondWithResult(_0xc957c4,null))['catch'](handleError(_0xc957c4,null));}; \ No newline at end of file +var _0x4f80=['limit','count','set','apply','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','merge','type','filter','options','includeAll','include','ZendeskConfiguration','findAll','rows','show','length','find','create','body','params','findOne','getFields','getSubjects','ZendeskField','nolimit','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined'];(function(_0x55361e,_0x14e3a6){var _0x1b06b0=function(_0x207c6e){while(--_0x207c6e){_0x55361e['push'](_0x55361e['shift']());}};_0x1b06b0(++_0x14e3a6);}(_0x4f80,0xea));var _0x04f8=function(_0x33298b,_0x42f55f){_0x33298b=_0x33298b-0x0;var _0x49bc13=_0x4f80[_0x33298b];return _0x49bc13;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x04f8('0x0'));var jsonpatch=require(_0x04f8('0x1'));var rp=require('request-promise');var moment=require(_0x04f8('0x2'));var BPromise=require(_0x04f8('0x3'));var Mustache=require(_0x04f8('0x4'));var util=require(_0x04f8('0x5'));var path=require(_0x04f8('0x6'));var sox=require(_0x04f8('0x7'));var csv=require('to-csv');var ejs=require(_0x04f8('0x8'));var fs=require('fs');var fs_extra=require(_0x04f8('0x9'));var _=require(_0x04f8('0xa'));var squel=require(_0x04f8('0xb'));var crypto=require(_0x04f8('0xc'));var jsforce=require(_0x04f8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x04f8('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x04f8('0xf'));var as=require(_0x04f8('0x10'));var hardwareService=require(_0x04f8('0x11'));var logger=require('../../config/logger')(_0x04f8('0x12'));var utils=require(_0x04f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x04f8('0x14'));var db=require(_0x04f8('0x15'))['db'];var jayson=require(_0x04f8('0x16'));var client=jayson[_0x04f8('0x17')][_0x04f8('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x376ea2,_0x1432c6,_0x4c1726,_0x49ff87){return new BPromise(function(_0x3af916,_0x1142ea){var _0x538452=_0x49ff87||client;return _0x538452[_0x04f8('0x19')](_0x376ea2,_0x4c1726)[_0x04f8('0x1a')](function(_0x4882fe){logger[_0x04f8('0x1b')](_0x04f8('0x1c'),_0x1432c6,_0x04f8('0x1d'));logger[_0x04f8('0x1e')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1432c6,_0x04f8('0x1d'),JSON[_0x04f8('0x1f')](_0x4882fe));if(_0x4882fe[_0x04f8('0x20')]){if(_0x4882fe[_0x04f8('0x20')][_0x04f8('0x21')]===0x1f4){logger[_0x04f8('0x20')](_0x04f8('0x1c'),_0x1432c6,_0x4882fe[_0x04f8('0x20')][_0x04f8('0x22')]);return _0x1142ea(_0x4882fe[_0x04f8('0x20')][_0x04f8('0x22')]);}logger[_0x04f8('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1432c6,_0x4882fe['error']['message']);return _0x3af916(_0x4882fe[_0x04f8('0x20')][_0x04f8('0x22')]);}else{logger[_0x04f8('0x1b')](_0x04f8('0x1c'),_0x1432c6,_0x04f8('0x1d'));_0x3af916(_0x4882fe[_0x04f8('0x23')][_0x04f8('0x22')]);}})[_0x04f8('0x24')](function(_0x54c960){logger[_0x04f8('0x20')](_0x04f8('0x1c'),_0x1432c6,_0x54c960);_0x1142ea(_0x54c960);});});}function respondWithStatusCode(_0x49ac8f,_0x4df5bb){_0x4df5bb=_0x4df5bb||0xcc;return function(_0x295a0a){if(_0x295a0a){return _0x49ac8f[_0x04f8('0x25')](_0x4df5bb);}return _0x49ac8f[_0x04f8('0x26')](_0x4df5bb)[_0x04f8('0x27')]();};}function respondWithResult(_0x21923f,_0x1572fa){_0x1572fa=_0x1572fa||0xc8;return function(_0x33123b){if(_0x33123b){return _0x21923f[_0x04f8('0x26')](_0x1572fa)['json'](_0x33123b);}};}function respondWithFilteredResult(_0x3f2445,_0x3cb936){return function(_0x1b3a6f){if(_0x1b3a6f){var _0x56cc4c=typeof _0x3cb936[_0x04f8('0x28')]===_0x04f8('0x29')&&typeof _0x3cb936[_0x04f8('0x2a')]===_0x04f8('0x29');var _0xdd427=_0x1b3a6f[_0x04f8('0x2b')];var _0x19d11c=_0x56cc4c?0x0:_0x3cb936[_0x04f8('0x28')];var _0x23d7a3=_0x56cc4c?_0x1b3a6f[_0x04f8('0x2b')]:_0x3cb936[_0x04f8('0x28')]+_0x3cb936[_0x04f8('0x2a')];var _0x1eae8b;if(_0x23d7a3>=_0xdd427){_0x23d7a3=_0xdd427;_0x1eae8b=0xc8;}else{_0x1eae8b=0xce;}_0x3f2445['status'](_0x1eae8b);return _0x3f2445[_0x04f8('0x2c')]('Content-Range',_0x19d11c+'-'+_0x23d7a3+'/'+_0xdd427)['json'](_0x1b3a6f);}return null;};}function patchUpdates(_0x20452e){return function(_0x2d9fae){try{jsonpatch[_0x04f8('0x2d')](_0x2d9fae,_0x20452e,!![]);}catch(_0x4a0428){return BPromise['reject'](_0x4a0428);}return _0x2d9fae[_0x04f8('0x2e')]();};}function saveUpdates(_0x1d654e,_0x4654d6){return function(_0x3cae9d){if(_0x3cae9d){return _0x3cae9d['update'](_0x1d654e)[_0x04f8('0x1a')](function(_0x8fcddd){return _0x8fcddd;});}return null;};}function removeEntity(_0x488ee7,_0x71d3ea){return function(_0x44e89b){if(_0x44e89b){return _0x44e89b[_0x04f8('0x2f')]()['then'](function(){_0x488ee7[_0x04f8('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4481ef,_0x30b5db){return function(_0x163448){if(!_0x163448){_0x4481ef[_0x04f8('0x25')](0x194);}return _0x163448;};}function handleError(_0x773bef,_0x585be1){_0x585be1=_0x585be1||0x1f4;return function(_0xf854cf){logger['error'](_0xf854cf[_0x04f8('0x30')]);if(_0xf854cf[_0x04f8('0x31')]){delete _0xf854cf[_0x04f8('0x31')];}_0x773bef[_0x04f8('0x26')](_0x585be1)[_0x04f8('0x32')](_0xf854cf);};}exports[_0x04f8('0x33')]=function(_0x24b47d,_0xbfd8ce){var _0x39353c={},_0x36a51d={},_0x5a237b={'count':0x0,'rows':[]};var _0x578116=_[_0x04f8('0x34')](db['ZendeskConfiguration'][_0x04f8('0x35')],function(_0x31451e){return{'name':_0x31451e[_0x04f8('0x36')],'type':_0x31451e['type'][_0x04f8('0x37')]};});_0x36a51d[_0x04f8('0x38')]=_[_0x04f8('0x34')](_0x578116,_0x04f8('0x31'));_0x36a51d[_0x04f8('0x39')]=_[_0x04f8('0x3a')](_0x24b47d[_0x04f8('0x39')]);_0x36a51d[_0x04f8('0x3b')]=_[_0x04f8('0x3c')](_0x36a51d[_0x04f8('0x38')],_0x36a51d[_0x04f8('0x39')]);_0x39353c['attributes']=_[_0x04f8('0x3c')](_0x36a51d[_0x04f8('0x38')],qs[_0x04f8('0x3d')](_0x24b47d[_0x04f8('0x39')][_0x04f8('0x3d')]));_0x39353c[_0x04f8('0x3e')]=_0x39353c['attributes']['length']?_0x39353c[_0x04f8('0x3e')]:_0x36a51d[_0x04f8('0x38')];if(!_0x24b47d['query'][_0x04f8('0x3f')]('nolimit')){_0x39353c['limit']=qs[_0x04f8('0x2a')](_0x24b47d[_0x04f8('0x39')][_0x04f8('0x2a')]);_0x39353c[_0x04f8('0x28')]=qs[_0x04f8('0x28')](_0x24b47d[_0x04f8('0x39')][_0x04f8('0x28')]);}_0x39353c['order']=qs[_0x04f8('0x40')](_0x24b47d[_0x04f8('0x39')][_0x04f8('0x40')]);_0x39353c[_0x04f8('0x41')]=qs[_0x04f8('0x3b')](_[_0x04f8('0x42')](_0x24b47d[_0x04f8('0x39')],_0x36a51d['filters']),_0x578116);if(_0x24b47d[_0x04f8('0x39')]['filter']){_0x39353c[_0x04f8('0x41')]=_[_0x04f8('0x43')](_0x39353c[_0x04f8('0x41')],{'$or':_[_0x04f8('0x34')](_0x578116,function(_0x5a653a){if(_0x5a653a[_0x04f8('0x44')]!=='VIRTUAL'){var _0x5c6d5c={};_0x5c6d5c[_0x5a653a[_0x04f8('0x31')]]={'$like':'%'+_0x24b47d[_0x04f8('0x39')][_0x04f8('0x45')]+'%'};return _0x5c6d5c;}})});}_0x39353c=_['merge']({},_0x39353c,_0x24b47d[_0x04f8('0x46')]);var _0x22fb27={'where':_0x39353c[_0x04f8('0x41')]};return db['ZendeskConfiguration'][_0x04f8('0x2b')](_0x22fb27)[_0x04f8('0x1a')](function(_0x495cf9){_0x5a237b[_0x04f8('0x2b')]=_0x495cf9;if(_0x24b47d[_0x04f8('0x39')][_0x04f8('0x47')]){_0x39353c[_0x04f8('0x48')]=[{'all':!![]}];}return db[_0x04f8('0x49')][_0x04f8('0x4a')](_0x39353c);})[_0x04f8('0x1a')](function(_0x23826c){_0x5a237b[_0x04f8('0x4b')]=_0x23826c;return _0x5a237b;})[_0x04f8('0x1a')](respondWithFilteredResult(_0xbfd8ce,_0x39353c))[_0x04f8('0x24')](handleError(_0xbfd8ce,null));};exports[_0x04f8('0x4c')]=function(_0x13b4d5,_0x489be){var _0xdac177={'raw':![],'where':{'id':_0x13b4d5['params']['id']}},_0x3281d7={};_0x3281d7[_0x04f8('0x38')]=_['keys'](db[_0x04f8('0x49')][_0x04f8('0x35')]);_0x3281d7[_0x04f8('0x39')]=_[_0x04f8('0x3a')](_0x13b4d5[_0x04f8('0x39')]);_0x3281d7[_0x04f8('0x3b')]=_[_0x04f8('0x3c')](_0x3281d7[_0x04f8('0x38')],_0x3281d7[_0x04f8('0x39')]);_0xdac177[_0x04f8('0x3e')]=_[_0x04f8('0x3c')](_0x3281d7[_0x04f8('0x38')],qs[_0x04f8('0x3d')](_0x13b4d5[_0x04f8('0x39')][_0x04f8('0x3d')]));_0xdac177[_0x04f8('0x3e')]=_0xdac177[_0x04f8('0x3e')][_0x04f8('0x4d')]?_0xdac177[_0x04f8('0x3e')]:_0x3281d7[_0x04f8('0x38')];if(_0x13b4d5[_0x04f8('0x39')][_0x04f8('0x47')]){_0xdac177[_0x04f8('0x48')]=[{'all':!![]}];}_0xdac177=_[_0x04f8('0x43')]({},_0xdac177,_0x13b4d5[_0x04f8('0x46')]);return db['ZendeskConfiguration'][_0x04f8('0x4e')](_0xdac177)['then'](handleEntityNotFound(_0x489be,null))[_0x04f8('0x1a')](respondWithResult(_0x489be,null))[_0x04f8('0x24')](handleError(_0x489be,null));};exports['create']=function(_0x5104e5,_0x45f361){return db['ZendeskConfiguration'][_0x04f8('0x4f')](_0x5104e5['body'],{})[_0x04f8('0x1a')](respondWithResult(_0x45f361,0xc9))['catch'](handleError(_0x45f361,null));};exports['update']=function(_0x127a5b,_0x2b8e7d){if(_0x127a5b[_0x04f8('0x50')]['id']){delete _0x127a5b[_0x04f8('0x50')]['id'];}return db['ZendeskConfiguration'][_0x04f8('0x4e')]({'where':{'id':_0x127a5b[_0x04f8('0x51')]['id']}})[_0x04f8('0x1a')](handleEntityNotFound(_0x2b8e7d,null))['then'](saveUpdates(_0x127a5b[_0x04f8('0x50')],null))['then'](respondWithResult(_0x2b8e7d,null))[_0x04f8('0x24')](handleError(_0x2b8e7d,null));};exports['destroy']=function(_0x4a2a6f,_0x577597){return db[_0x04f8('0x49')][_0x04f8('0x4e')]({'where':{'id':_0x4a2a6f['params']['id']}})[_0x04f8('0x1a')](handleEntityNotFound(_0x577597,null))[_0x04f8('0x1a')](removeEntity(_0x577597,null))[_0x04f8('0x24')](handleError(_0x577597,null));};exports['getFields']=function(_0x953087,_0x2ddb14,_0x2d046a){var _0x431c5d={};var _0x62f420={};var _0x42ad85;var _0xa91509;return db[_0x04f8('0x49')][_0x04f8('0x52')]({'where':{'id':_0x953087[_0x04f8('0x51')]['id']}})[_0x04f8('0x1a')](handleEntityNotFound(_0x2ddb14,null))[_0x04f8('0x1a')](function(_0xb53295){if(_0xb53295){_0x42ad85=_0xb53295;_0x62f420[_0x04f8('0x38')]=_[_0x04f8('0x3a')](db['ZendeskField'][_0x04f8('0x35')]);_0x62f420[_0x04f8('0x39')]=_[_0x04f8('0x3a')](_0x953087[_0x04f8('0x39')]);_0x62f420['filters']=_[_0x04f8('0x3c')](_0x62f420['model'],_0x62f420[_0x04f8('0x39')]);_0x431c5d[_0x04f8('0x3e')]=_['intersection'](_0x62f420[_0x04f8('0x38')],qs[_0x04f8('0x3d')](_0x953087[_0x04f8('0x39')][_0x04f8('0x3d')]));_0x431c5d['attributes']=_0x431c5d[_0x04f8('0x3e')]['length']?_0x431c5d['attributes']:_0x62f420[_0x04f8('0x38')];_0x431c5d['order']=qs['sort'](_0x953087[_0x04f8('0x39')][_0x04f8('0x40')]);_0x431c5d[_0x04f8('0x41')]=qs['filters'](_['pick'](_0x953087[_0x04f8('0x39')],_0x62f420['filters']));if(_0x953087[_0x04f8('0x39')][_0x04f8('0x45')]){_0x431c5d[_0x04f8('0x41')]=_[_0x04f8('0x43')](_0x431c5d[_0x04f8('0x41')],{'$or':_[_0x04f8('0x34')](_0x431c5d[_0x04f8('0x3e')],function(_0x71fc8e){var _0x172491={};_0x172491[_0x71fc8e]={'$like':'%'+_0x953087[_0x04f8('0x39')]['filter']+'%'};return _0x172491;})});}_0x431c5d=_[_0x04f8('0x43')]({},_0x431c5d,_0x953087[_0x04f8('0x46')]);return _0x42ad85[_0x04f8('0x53')](_0x431c5d);}})['then'](function(_0x19d4c9){if(_0x19d4c9){_0xa91509=_0x19d4c9[_0x04f8('0x4d')];if(!_0x953087['query'][_0x04f8('0x3f')]('nolimit')){_0x431c5d[_0x04f8('0x2a')]=qs[_0x04f8('0x2a')](_0x953087[_0x04f8('0x39')][_0x04f8('0x2a')]);_0x431c5d[_0x04f8('0x28')]=qs[_0x04f8('0x28')](_0x953087[_0x04f8('0x39')][_0x04f8('0x28')]);}return _0x42ad85[_0x04f8('0x53')](_0x431c5d);}})[_0x04f8('0x1a')](function(_0x44022c){if(_0x44022c){return _0x44022c?{'count':_0xa91509,'rows':_0x44022c}:null;}})[_0x04f8('0x1a')](respondWithResult(_0x2ddb14,null))[_0x04f8('0x24')](handleError(_0x2ddb14,null));};exports[_0x04f8('0x54')]=function(_0xc017c3,_0x14ff11,_0x4aab1b){var _0x5be24e={};var _0x547ae3={};var _0x1af507;var _0x1d3920;return db[_0x04f8('0x49')][_0x04f8('0x52')]({'where':{'id':_0xc017c3[_0x04f8('0x51')]['id']}})[_0x04f8('0x1a')](handleEntityNotFound(_0x14ff11,null))[_0x04f8('0x1a')](function(_0x1cf5bb){if(_0x1cf5bb){_0x1af507=_0x1cf5bb;_0x547ae3[_0x04f8('0x38')]=_[_0x04f8('0x3a')](db[_0x04f8('0x55')][_0x04f8('0x35')]);_0x547ae3[_0x04f8('0x39')]=_[_0x04f8('0x3a')](_0xc017c3[_0x04f8('0x39')]);_0x547ae3[_0x04f8('0x3b')]=_['intersection'](_0x547ae3[_0x04f8('0x38')],_0x547ae3['query']);_0x5be24e[_0x04f8('0x3e')]=_[_0x04f8('0x3c')](_0x547ae3[_0x04f8('0x38')],qs[_0x04f8('0x3d')](_0xc017c3['query']['fields']));_0x5be24e[_0x04f8('0x3e')]=_0x5be24e[_0x04f8('0x3e')][_0x04f8('0x4d')]?_0x5be24e[_0x04f8('0x3e')]:_0x547ae3[_0x04f8('0x38')];_0x5be24e['order']=qs[_0x04f8('0x40')](_0xc017c3[_0x04f8('0x39')]['sort']);_0x5be24e[_0x04f8('0x41')]=qs[_0x04f8('0x3b')](_[_0x04f8('0x42')](_0xc017c3[_0x04f8('0x39')],_0x547ae3[_0x04f8('0x3b')]));if(_0xc017c3['query'][_0x04f8('0x45')]){_0x5be24e['where']=_[_0x04f8('0x43')](_0x5be24e[_0x04f8('0x41')],{'$or':_[_0x04f8('0x34')](_0x5be24e[_0x04f8('0x3e')],function(_0x22886e){var _0x1552ae={};_0x1552ae[_0x22886e]={'$like':'%'+_0xc017c3[_0x04f8('0x39')][_0x04f8('0x45')]+'%'};return _0x1552ae;})});}_0x5be24e=_['merge']({},_0x5be24e,_0xc017c3[_0x04f8('0x46')]);return _0x1af507[_0x04f8('0x54')](_0x5be24e);}})[_0x04f8('0x1a')](function(_0x26a0ba){if(_0x26a0ba){_0x1d3920=_0x26a0ba[_0x04f8('0x4d')];if(!_0xc017c3[_0x04f8('0x39')][_0x04f8('0x3f')](_0x04f8('0x56'))){_0x5be24e[_0x04f8('0x2a')]=qs['limit'](_0xc017c3[_0x04f8('0x39')][_0x04f8('0x2a')]);_0x5be24e[_0x04f8('0x28')]=qs['offset'](_0xc017c3['query'][_0x04f8('0x28')]);}return _0x1af507['getSubjects'](_0x5be24e);}})[_0x04f8('0x1a')](function(_0x33c580){if(_0x33c580){return _0x33c580?{'count':_0x1d3920,'rows':_0x33c580}:null;}})[_0x04f8('0x1a')](respondWithResult(_0x14ff11,null))['catch'](handleError(_0x14ff11,null));};exports[_0x04f8('0x57')]=function(_0x545678,_0x47dbde,_0x22fe6f){var _0x1cf708={};var _0x445964={};var _0x4870dd;var _0x518e35;return db[_0x04f8('0x49')][_0x04f8('0x52')]({'where':{'id':_0x545678[_0x04f8('0x51')]['id']}})[_0x04f8('0x1a')](handleEntityNotFound(_0x47dbde,null))[_0x04f8('0x1a')](function(_0x343c81){if(_0x343c81){_0x4870dd=_0x343c81;_0x445964[_0x04f8('0x38')]=_[_0x04f8('0x3a')](db[_0x04f8('0x55')][_0x04f8('0x35')]);_0x445964[_0x04f8('0x39')]=_[_0x04f8('0x3a')](_0x545678[_0x04f8('0x39')]);_0x445964[_0x04f8('0x3b')]=_['intersection'](_0x445964[_0x04f8('0x38')],_0x445964['query']);_0x1cf708[_0x04f8('0x3e')]=_['intersection'](_0x445964[_0x04f8('0x38')],qs[_0x04f8('0x3d')](_0x545678[_0x04f8('0x39')][_0x04f8('0x3d')]));_0x1cf708[_0x04f8('0x3e')]=_0x1cf708[_0x04f8('0x3e')]['length']?_0x1cf708[_0x04f8('0x3e')]:_0x445964[_0x04f8('0x38')];_0x1cf708['order']=qs[_0x04f8('0x40')](_0x545678['query']['sort']);_0x1cf708['where']=qs['filters'](_[_0x04f8('0x42')](_0x545678[_0x04f8('0x39')],_0x445964[_0x04f8('0x3b')]));if(_0x545678['query'][_0x04f8('0x45')]){_0x1cf708[_0x04f8('0x41')]=_['merge'](_0x1cf708[_0x04f8('0x41')],{'$or':_[_0x04f8('0x34')](_0x1cf708[_0x04f8('0x3e')],function(_0x3502de){var _0x3b7453={};_0x3b7453[_0x3502de]={'$like':'%'+_0x545678[_0x04f8('0x39')][_0x04f8('0x45')]+'%'};return _0x3b7453;})});}_0x1cf708=_[_0x04f8('0x43')]({},_0x1cf708,_0x545678[_0x04f8('0x46')]);return _0x4870dd['getDescriptions'](_0x1cf708);}})[_0x04f8('0x1a')](function(_0x25c345){if(_0x25c345){_0x518e35=_0x25c345['length'];if(!_0x545678[_0x04f8('0x39')]['hasOwnProperty'](_0x04f8('0x56'))){_0x1cf708[_0x04f8('0x2a')]=qs[_0x04f8('0x2a')](_0x545678[_0x04f8('0x39')][_0x04f8('0x2a')]);_0x1cf708['offset']=qs['offset'](_0x545678[_0x04f8('0x39')][_0x04f8('0x28')]);}return _0x4870dd['getDescriptions'](_0x1cf708);}})[_0x04f8('0x1a')](function(_0x46b2eb){if(_0x46b2eb){return _0x46b2eb?{'count':_0x518e35,'rows':_0x46b2eb}:null;}})[_0x04f8('0x1a')](respondWithResult(_0x47dbde,null))[_0x04f8('0x24')](handleError(_0x47dbde,null));};exports[_0x04f8('0x58')]=function(_0x93e984,_0x10ee8c,_0x47809c){var _0x409402={};var _0x57c215={};var _0x4e5b6a;var _0x2bae79;return db[_0x04f8('0x49')][_0x04f8('0x52')]({'where':{'id':_0x93e984['params']['id']}})[_0x04f8('0x1a')](handleEntityNotFound(_0x10ee8c,null))[_0x04f8('0x1a')](function(_0x45f48a){if(_0x45f48a){_0x4e5b6a=_0x45f48a;_0x57c215[_0x04f8('0x38')]=_['keys'](db[_0x04f8('0x59')][_0x04f8('0x35')]);_0x57c215['query']=_[_0x04f8('0x3a')](_0x93e984[_0x04f8('0x39')]);_0x57c215[_0x04f8('0x3b')]=_[_0x04f8('0x3c')](_0x57c215[_0x04f8('0x38')],_0x57c215[_0x04f8('0x39')]);_0x409402[_0x04f8('0x3e')]=_[_0x04f8('0x3c')](_0x57c215[_0x04f8('0x38')],qs[_0x04f8('0x3d')](_0x93e984['query']['fields']));_0x409402[_0x04f8('0x3e')]=_0x409402[_0x04f8('0x3e')][_0x04f8('0x4d')]?_0x409402[_0x04f8('0x3e')]:_0x57c215[_0x04f8('0x38')];_0x409402['order']=qs[_0x04f8('0x40')](_0x93e984[_0x04f8('0x39')]['sort']);_0x409402[_0x04f8('0x41')]=qs[_0x04f8('0x3b')](_['pick'](_0x93e984[_0x04f8('0x39')],_0x57c215[_0x04f8('0x3b')]));if(_0x93e984['query'][_0x04f8('0x45')]){_0x409402[_0x04f8('0x41')]=_[_0x04f8('0x43')](_0x409402[_0x04f8('0x41')],{'$or':_[_0x04f8('0x34')](_0x409402[_0x04f8('0x3e')],function(_0x115aba){var _0x454e57={};_0x454e57[_0x115aba]={'$like':'%'+_0x93e984[_0x04f8('0x39')][_0x04f8('0x45')]+'%'};return _0x454e57;})});}_0x409402=_[_0x04f8('0x43')]({},_0x409402,_0x93e984[_0x04f8('0x46')]);return _0x4e5b6a[_0x04f8('0x58')](_0x409402);}})[_0x04f8('0x1a')](function(_0x47df16){if(_0x47df16){_0x2bae79=_0x47df16[_0x04f8('0x4d')];if(!_0x93e984[_0x04f8('0x39')][_0x04f8('0x3f')](_0x04f8('0x56'))){_0x409402[_0x04f8('0x2a')]=qs[_0x04f8('0x2a')](_0x93e984['query'][_0x04f8('0x2a')]);_0x409402[_0x04f8('0x28')]=qs['offset'](_0x93e984[_0x04f8('0x39')]['offset']);}return _0x4e5b6a[_0x04f8('0x58')](_0x409402);}})[_0x04f8('0x1a')](function(_0x470dd8){if(_0x470dd8){return _0x470dd8?{'count':_0x2bae79,'rows':_0x470dd8}:null;}})[_0x04f8('0x1a')](respondWithResult(_0x10ee8c,null))[_0x04f8('0x24')](handleError(_0x10ee8c,null));};exports['setTags']=function(_0x2c7c91,_0x2c989d,_0x41473e){if(_0x2c7c91['body']['id']){delete _0x2c7c91[_0x04f8('0x50')]['id'];}return db['ZendeskConfiguration'][_0x04f8('0x52')]({'where':{'id':_0x2c7c91['params']['id']}})[_0x04f8('0x1a')](handleEntityNotFound(_0x2c989d,null))[_0x04f8('0x1a')](function(_0x4868ca){if(_0x4868ca){return _0x4868ca[_0x04f8('0x5a')](_0x2c7c91[_0x04f8('0x50')][_0x04f8('0x5b')]||[]);}return null;})[_0x04f8('0x1a')](respondWithResult(_0x2c989d,null))[_0x04f8('0x24')](handleError(_0x2c989d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 27f45c7..038f069 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 _0x755f=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x755f,0xec));var _0xf755=function(_0x1e053f,_0x53ce14){_0x1e053f=_0x1e053f-0x0;var _0x4a0c43=_0x755f[_0x1e053f];return _0x4a0c43;};'use strict';var _=require('lodash');var util=require(_0xf755('0x0'));var logger=require(_0xf755('0x1'))(_0xf755('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf755('0x3'));var fs=require('fs');var path=require(_0xf755('0x4'));var rimraf=require(_0xf755('0x5'));var config=require(_0xf755('0x6'));var attributes=require(_0xf755('0x7'));module[_0xf755('0x8')]=function(_0x2b1a14,_0x25a239){return _0x2b1a14[_0xf755('0x9')](_0xf755('0xa'),attributes,{'tableName':_0xf755('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf65=['request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','bluebird'];(function(_0x435065,_0x4516a4){var _0x2ec3df=function(_0x1b14a1){while(--_0x1b14a1){_0x435065['push'](_0x435065['shift']());}};_0x2ec3df(++_0x4516a4);}(_0xbf65,0x158));var _0x5bf6=function(_0x85cb49,_0x50a08a){_0x85cb49=_0x85cb49-0x0;var _0x52f463=_0xbf65[_0x85cb49];return _0x52f463;};'use strict';var _=require(_0x5bf6('0x0'));var util=require(_0x5bf6('0x1'));var logger=require('../../config/logger')(_0x5bf6('0x2'));var moment=require('moment');var BPromise=require(_0x5bf6('0x3'));var rp=require(_0x5bf6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bf6('0x5'));var config=require(_0x5bf6('0x6'));var attributes=require(_0x5bf6('0x7'));module[_0x5bf6('0x8')]=function(_0x3853b9,_0xe20271){return _0x3853b9[_0x5bf6('0x9')](_0x5bf6('0xa'),attributes,{'tableName':_0x5bf6('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 1f0221a..048cf54 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 _0xb450=['message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x44d869,_0x49425f){var _0x1ed521=function(_0x2c2968){while(--_0x2c2968){_0x44d869['push'](_0x44d869['shift']());}};_0x1ed521(++_0x49425f);}(_0xb450,0x14e));var _0x0b45=function(_0x5bb372,_0x4a52cd){_0x5bb372=_0x5bb372-0x0;var _0x7cb118=_0xb450[_0x5bb372];return _0x7cb118;};'use strict';var _=require(_0x0b45('0x0'));var util=require(_0x0b45('0x1'));var moment=require(_0x0b45('0x2'));var BPromise=require(_0x0b45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b45('0x4'));var db=require(_0x0b45('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b45('0x6'))('rpc');var config=require(_0x0b45('0x7'));var jayson=require(_0x0b45('0x8'));var client=jayson['client'][_0x0b45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x269323,_0x344644,_0x3dcdd3){return new BPromise(function(_0x1ce6e9,_0x243232){return client['request'](_0x269323,_0x3dcdd3)[_0x0b45('0xa')](function(_0x3babd8){logger['info'](_0x0b45('0xb'),_0x344644,_0x0b45('0xc'));logger[_0x0b45('0xd')](_0x0b45('0xe'),_0x344644,_0x0b45('0xc'),JSON[_0x0b45('0xf')](_0x3babd8));if(_0x3babd8[_0x0b45('0x10')]){if(_0x3babd8['error'][_0x0b45('0x11')]===0x1f4){logger[_0x0b45('0x10')](_0x0b45('0xb'),_0x344644,_0x3babd8[_0x0b45('0x10')][_0x0b45('0x12')]);return _0x243232(_0x3babd8['error']['message']);}logger[_0x0b45('0x10')](_0x0b45('0xb'),_0x344644,_0x3babd8[_0x0b45('0x10')]['message']);return _0x1ce6e9(_0x3babd8['error'][_0x0b45('0x12')]);}else{logger[_0x0b45('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x344644,'request\x20sent');_0x1ce6e9(_0x3babd8[_0x0b45('0x14')]['message']);}})[_0x0b45('0x15')](function(_0xa17579){logger[_0x0b45('0x10')](_0x0b45('0xb'),_0x344644,_0xa17579);_0x243232(_0xa17579);});});} \ No newline at end of file +var _0x9b17=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird'];(function(_0x245d06,_0x55a819){var _0x28924f=function(_0x597c06){while(--_0x597c06){_0x245d06['push'](_0x245d06['shift']());}};_0x28924f(++_0x55a819);}(_0x9b17,0x1de));var _0x79b1=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x9b17[_0x403c20];return _0x2b271a;};'use strict';var _=require('lodash');var util=require(_0x79b1('0x0'));var moment=require('moment');var BPromise=require(_0x79b1('0x1'));var rs=require(_0x79b1('0x2'));var fs=require('fs');var Redis=require(_0x79b1('0x3'));var db=require(_0x79b1('0x4'))['db'];var utils=require(_0x79b1('0x5'));var logger=require(_0x79b1('0x6'))(_0x79b1('0x7'));var config=require(_0x79b1('0x8'));var jayson=require(_0x79b1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45a2e1,_0x5c3b7a,_0x22947a){return new BPromise(function(_0x3d34ad,_0x58bf97){return client['request'](_0x45a2e1,_0x22947a)['then'](function(_0x328866){logger[_0x79b1('0xa')](_0x79b1('0xb'),_0x5c3b7a,_0x79b1('0xc'));logger[_0x79b1('0xd')](_0x79b1('0xe'),_0x5c3b7a,_0x79b1('0xc'),JSON[_0x79b1('0xf')](_0x328866));if(_0x328866['error']){if(_0x328866[_0x79b1('0x10')]['code']===0x1f4){logger[_0x79b1('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5c3b7a,_0x328866[_0x79b1('0x10')]['message']);return _0x58bf97(_0x328866['error']['message']);}logger[_0x79b1('0x10')](_0x79b1('0xb'),_0x5c3b7a,_0x328866[_0x79b1('0x10')][_0x79b1('0x11')]);return _0x3d34ad(_0x328866['error'][_0x79b1('0x11')]);}else{logger[_0x79b1('0xa')](_0x79b1('0xb'),_0x5c3b7a,_0x79b1('0xc'));_0x3d34ad(_0x328866[_0x79b1('0x12')][_0x79b1('0x11')]);}})[_0x79b1('0x13')](function(_0x2f4b79){logger['error'](_0x79b1('0xb'),_0x5c3b7a,_0x2f4b79);_0x58bf97(_0x2f4b79);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index fca4d9c..3751d72 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 _0x1deb=['get','index','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e5e48,_0x305a64){var _0xc9239f=function(_0x254a0c){while(--_0x254a0c){_0x2e5e48['push'](_0x2e5e48['shift']());}};_0xc9239f(++_0x305a64);}(_0x1deb,0x114));var _0xb1de=function(_0x4218bb,_0x4ac1d9){_0x4218bb=_0x4218bb-0x0;var _0x126439=_0x1deb[_0x4218bb];return _0x126439;};'use strict';var multer=require(_0xb1de('0x0'));var util=require('util');var path=require(_0xb1de('0x1'));var timeout=require(_0xb1de('0x2'));var express=require(_0xb1de('0x3'));var router=express[_0xb1de('0x4')]();var fs_extra=require(_0xb1de('0x5'));var auth=require(_0xb1de('0x6'));var interaction=require(_0xb1de('0x7'));var config=require(_0xb1de('0x8'));var controller=require('./intZendeskField.controller');router[_0xb1de('0x9')]('/',auth['isAuthenticated'](),controller[_0xb1de('0xa')]);router[_0xb1de('0x9')](_0xb1de('0xb'),auth[_0xb1de('0xc')](),controller['show']);router[_0xb1de('0xd')]('/',auth[_0xb1de('0xc')](),controller[_0xb1de('0xe')]);router[_0xb1de('0xf')](_0xb1de('0xb'),auth[_0xb1de('0xc')](),controller[_0xb1de('0x10')]);router['delete'](_0xb1de('0xb'),auth[_0xb1de('0xc')](),controller[_0xb1de('0x11')]);module[_0xb1de('0x12')]=router; \ No newline at end of file +var _0xd705=['../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0xd705,0x1bf));var _0x5d70=function(_0x4a176e,_0x3a88a2){_0x4a176e=_0x4a176e-0x0;var _0x175f61=_0xd705[_0x4a176e];return _0x175f61;};'use strict';var multer=require(_0x5d70('0x0'));var util=require(_0x5d70('0x1'));var path=require(_0x5d70('0x2'));var timeout=require(_0x5d70('0x3'));var express=require(_0x5d70('0x4'));var router=express[_0x5d70('0x5')]();var fs_extra=require(_0x5d70('0x6'));var auth=require(_0x5d70('0x7'));var interaction=require(_0x5d70('0x8'));var config=require(_0x5d70('0x9'));var controller=require('./intZendeskField.controller');router[_0x5d70('0xa')]('/',auth[_0x5d70('0xb')](),controller[_0x5d70('0xc')]);router[_0x5d70('0xa')](_0x5d70('0xd'),auth[_0x5d70('0xb')](),controller[_0x5d70('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5d70('0xf')]);router[_0x5d70('0x10')]('/:id',auth[_0x5d70('0xb')](),controller[_0x5d70('0x11')]);router['delete'](_0x5d70('0xd'),auth[_0x5d70('0xb')](),controller[_0x5d70('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 996f372..394b124 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 _0x54f3=['BOOLEAN','exports','ENUM','string','variable','customVariable','STRING'];(function(_0x55f898,_0x542314){var _0x36e2f3=function(_0x1f7272){while(--_0x1f7272){_0x55f898['push'](_0x55f898['shift']());}};_0x36e2f3(++_0x542314);}(_0x54f3,0x120));var _0x354f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x54f3[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0x354f('0x0')]={'type':{'type':Sequelize[_0x354f('0x1')](_0x354f('0x2'),_0x354f('0x3'),_0x354f('0x4'),'keyValue','picklist'),'defaultValue':_0x354f('0x2')},'content':{'type':Sequelize[_0x354f('0x5')]},'key':{'type':Sequelize[_0x354f('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x354f('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x354f('0x5')]},'idField':{'type':Sequelize[_0x354f('0x5')]},'nameField':{'type':Sequelize[_0x354f('0x5')]},'customField':{'type':Sequelize[_0x354f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x17ba=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x4e5d3c,_0x2cb988){var _0x49ea0d=function(_0x122dfe){while(--_0x122dfe){_0x4e5d3c['push'](_0x4e5d3c['shift']());}};_0x49ea0d(++_0x2cb988);}(_0x17ba,0xab));var _0xa17b=function(_0x276b4c,_0x3c706d){_0x276b4c=_0x276b4c-0x0;var _0x5332aa=_0x17ba[_0x276b4c];return _0x5332aa;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa17b('0x2'),_0xa17b('0x3'),_0xa17b('0x4'),_0xa17b('0x5'),_0xa17b('0x6')),'defaultValue':_0xa17b('0x2')},'content':{'type':Sequelize[_0xa17b('0x7')]},'key':{'type':Sequelize[_0xa17b('0x7')]},'keyType':{'type':Sequelize[_0xa17b('0x8')](_0xa17b('0x2'),_0xa17b('0x3'),_0xa17b('0x4'))},'keyContent':{'type':Sequelize[_0xa17b('0x7')]},'idField':{'type':Sequelize[_0xa17b('0x7')]},'nameField':{'type':Sequelize[_0xa17b('0x7')]},'customField':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa17b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index dc790e5..f781604 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 _0xbd48=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','reject','save','update','then','sendStatus','error','stack','index','ZendeskField','rawAttributes','type','key','map','keys','query','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','name','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbd48,0xc4));var _0x8bd4=function(_0x3798fe,_0x26cb12){_0x3798fe=_0x3798fe-0x0;var _0xd0313e=_0xbd48[_0x3798fe];return _0xd0313e;};'use strict';var emlformat=require(_0x8bd4('0x0'));var rimraf=require(_0x8bd4('0x1'));var zipdir=require(_0x8bd4('0x2'));var jsonpatch=require(_0x8bd4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8bd4('0x4'));var Mustache=require(_0x8bd4('0x5'));var util=require('util');var path=require(_0x8bd4('0x6'));var sox=require(_0x8bd4('0x7'));var csv=require(_0x8bd4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bd4('0x9'));var squel=require(_0x8bd4('0xa'));var crypto=require('crypto');var jsforce=require(_0x8bd4('0xb'));var deskjs=require(_0x8bd4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8bd4('0xd'));var Papa=require(_0x8bd4('0xe'));var Redis=require('ioredis');var authService=require(_0x8bd4('0xf'));var qs=require(_0x8bd4('0x10'));var as=require(_0x8bd4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8bd4('0x12'));var utils=require(_0x8bd4('0x13'));var config=require(_0x8bd4('0x14'));var licenseUtil=require(_0x8bd4('0x15'));var db=require(_0x8bd4('0x16'))['db'];function respondWithStatusCode(_0x30b6bd,_0x4fe826){_0x4fe826=_0x4fe826||0xcc;return function(_0x3e5266){if(_0x3e5266){return _0x30b6bd['sendStatus'](_0x4fe826);}return _0x30b6bd[_0x8bd4('0x17')](_0x4fe826)[_0x8bd4('0x18')]();};}function respondWithResult(_0x316cab,_0x596e16){_0x596e16=_0x596e16||0xc8;return function(_0x1cfffb){if(_0x1cfffb){return _0x316cab['status'](_0x596e16)[_0x8bd4('0x19')](_0x1cfffb);}};}function respondWithFilteredResult(_0x36e340,_0x37fbd2){return function(_0x1e881a){if(_0x1e881a){var _0x1fabae=typeof _0x37fbd2[_0x8bd4('0x1a')]==='undefined'&&typeof _0x37fbd2[_0x8bd4('0x1b')]===_0x8bd4('0x1c');var _0x3dcfee=_0x1e881a['count'];var _0x473f17=_0x1fabae?0x0:_0x37fbd2['offset'];var _0x269115=_0x1fabae?_0x1e881a[_0x8bd4('0x1d')]:_0x37fbd2['offset']+_0x37fbd2[_0x8bd4('0x1b')];var _0x28ea5b;if(_0x269115>=_0x3dcfee){_0x269115=_0x3dcfee;_0x28ea5b=0xc8;}else{_0x28ea5b=0xce;}_0x36e340[_0x8bd4('0x17')](_0x28ea5b);return _0x36e340['set']('Content-Range',_0x473f17+'-'+_0x269115+'/'+_0x3dcfee)[_0x8bd4('0x19')](_0x1e881a);}return null;};}function patchUpdates(_0x52cbf6){return function(_0x6de9d0){try{jsonpatch['apply'](_0x6de9d0,_0x52cbf6,!![]);}catch(_0x536e07){return BPromise[_0x8bd4('0x1e')](_0x536e07);}return _0x6de9d0[_0x8bd4('0x1f')]();};}function saveUpdates(_0x576a33,_0x3438af){return function(_0x37b71d){if(_0x37b71d){return _0x37b71d[_0x8bd4('0x20')](_0x576a33)[_0x8bd4('0x21')](function(_0x3f4656){return _0x3f4656;});}return null;};}function removeEntity(_0x575327,_0x38dcf9){return function(_0x443bf5){if(_0x443bf5){return _0x443bf5['destroy']()['then'](function(){_0x575327['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38f8c8,_0x40dd97){return function(_0xe821ab){if(!_0xe821ab){_0x38f8c8[_0x8bd4('0x22')](0x194);}return _0xe821ab;};}function handleError(_0xf936bb,_0x3aed05){_0x3aed05=_0x3aed05||0x1f4;return function(_0x37df06){logger[_0x8bd4('0x23')](_0x37df06[_0x8bd4('0x24')]);if(_0x37df06['name']){delete _0x37df06['name'];}_0xf936bb[_0x8bd4('0x17')](_0x3aed05)['send'](_0x37df06);};}exports[_0x8bd4('0x25')]=function(_0x517230,_0x1152dc){var _0x41eadb={},_0x1dc4d9={},_0x249d9e={'count':0x0,'rows':[]};var _0x38a586=_['map'](db[_0x8bd4('0x26')][_0x8bd4('0x27')],function(_0x151a7b){return{'name':_0x151a7b['fieldName'],'type':_0x151a7b[_0x8bd4('0x28')][_0x8bd4('0x29')]};});_0x1dc4d9['model']=_[_0x8bd4('0x2a')](_0x38a586,'name');_0x1dc4d9['query']=_[_0x8bd4('0x2b')](_0x517230[_0x8bd4('0x2c')]);_0x1dc4d9['filters']=_[_0x8bd4('0x2d')](_0x1dc4d9[_0x8bd4('0x2e')],_0x1dc4d9['query']);_0x41eadb[_0x8bd4('0x2f')]=_['intersection'](_0x1dc4d9[_0x8bd4('0x2e')],qs['fields'](_0x517230[_0x8bd4('0x2c')]['fields']));_0x41eadb[_0x8bd4('0x2f')]=_0x41eadb['attributes']['length']?_0x41eadb[_0x8bd4('0x2f')]:_0x1dc4d9[_0x8bd4('0x2e')];if(!_0x517230[_0x8bd4('0x2c')][_0x8bd4('0x30')](_0x8bd4('0x31'))){_0x41eadb[_0x8bd4('0x1b')]=qs[_0x8bd4('0x1b')](_0x517230['query']['limit']);_0x41eadb[_0x8bd4('0x1a')]=qs[_0x8bd4('0x1a')](_0x517230['query'][_0x8bd4('0x1a')]);}_0x41eadb[_0x8bd4('0x32')]=qs[_0x8bd4('0x33')](_0x517230[_0x8bd4('0x2c')][_0x8bd4('0x33')]);_0x41eadb[_0x8bd4('0x34')]=qs[_0x8bd4('0x35')](_[_0x8bd4('0x36')](_0x517230[_0x8bd4('0x2c')],_0x1dc4d9[_0x8bd4('0x35')]),_0x38a586);if(_0x517230[_0x8bd4('0x2c')][_0x8bd4('0x37')]){_0x41eadb['where']=_['merge'](_0x41eadb[_0x8bd4('0x34')],{'$or':_[_0x8bd4('0x2a')](_0x38a586,function(_0x18ffc3){if(_0x18ffc3['type']!=='VIRTUAL'){var _0x445b24={};_0x445b24[_0x18ffc3[_0x8bd4('0x38')]]={'$like':'%'+_0x517230[_0x8bd4('0x2c')][_0x8bd4('0x37')]+'%'};return _0x445b24;}})});}_0x41eadb=_[_0x8bd4('0x39')]({},_0x41eadb,_0x517230[_0x8bd4('0x3a')]);var _0x94d76e={'where':_0x41eadb[_0x8bd4('0x34')]};return db[_0x8bd4('0x26')]['count'](_0x94d76e)[_0x8bd4('0x21')](function(_0x2af017){_0x249d9e['count']=_0x2af017;if(_0x517230[_0x8bd4('0x2c')][_0x8bd4('0x3b')]){_0x41eadb[_0x8bd4('0x3c')]=[{'all':!![]}];}return db['ZendeskField'][_0x8bd4('0x3d')](_0x41eadb);})[_0x8bd4('0x21')](function(_0x32c885){_0x249d9e[_0x8bd4('0x3e')]=_0x32c885;return _0x249d9e;})['then'](respondWithFilteredResult(_0x1152dc,_0x41eadb))[_0x8bd4('0x3f')](handleError(_0x1152dc,null));};exports[_0x8bd4('0x40')]=function(_0x19342d,_0x3d0c74){var _0x10839={'raw':!![],'where':{'id':_0x19342d[_0x8bd4('0x41')]['id']}},_0x28279a={};_0x28279a[_0x8bd4('0x2e')]=_['keys'](db['ZendeskField'][_0x8bd4('0x27')]);_0x28279a[_0x8bd4('0x2c')]=_[_0x8bd4('0x2b')](_0x19342d[_0x8bd4('0x2c')]);_0x28279a[_0x8bd4('0x35')]=_[_0x8bd4('0x2d')](_0x28279a[_0x8bd4('0x2e')],_0x28279a[_0x8bd4('0x2c')]);_0x10839[_0x8bd4('0x2f')]=_['intersection'](_0x28279a[_0x8bd4('0x2e')],qs[_0x8bd4('0x42')](_0x19342d[_0x8bd4('0x2c')]['fields']));_0x10839[_0x8bd4('0x2f')]=_0x10839['attributes'][_0x8bd4('0x43')]?_0x10839[_0x8bd4('0x2f')]:_0x28279a['model'];if(_0x19342d['query'][_0x8bd4('0x3b')]){_0x10839[_0x8bd4('0x3c')]=[{'all':!![]}];}_0x10839=_[_0x8bd4('0x39')]({},_0x10839,_0x19342d[_0x8bd4('0x3a')]);return db[_0x8bd4('0x26')][_0x8bd4('0x44')](_0x10839)['then'](handleEntityNotFound(_0x3d0c74,null))[_0x8bd4('0x21')](respondWithResult(_0x3d0c74,null))[_0x8bd4('0x3f')](handleError(_0x3d0c74,null));};exports[_0x8bd4('0x45')]=function(_0x2e7a68,_0xd1bb70){return db['ZendeskField'][_0x8bd4('0x45')](_0x2e7a68[_0x8bd4('0x46')],{})[_0x8bd4('0x21')](respondWithResult(_0xd1bb70,0xc9))[_0x8bd4('0x3f')](handleError(_0xd1bb70,null));};exports['update']=function(_0x189a85,_0xf2f4bb){if(_0x189a85['body']['id']){delete _0x189a85[_0x8bd4('0x46')]['id'];}return db['ZendeskField'][_0x8bd4('0x44')]({'where':{'id':_0x189a85['params']['id']}})[_0x8bd4('0x21')](handleEntityNotFound(_0xf2f4bb,null))[_0x8bd4('0x21')](saveUpdates(_0x189a85['body'],null))[_0x8bd4('0x21')](respondWithResult(_0xf2f4bb,null))['catch'](handleError(_0xf2f4bb,null));};exports['destroy']=function(_0x36d30f,_0x44c4ee){return db[_0x8bd4('0x26')][_0x8bd4('0x44')]({'where':{'id':_0x36d30f[_0x8bd4('0x41')]['id']}})[_0x8bd4('0x21')](handleEntityNotFound(_0x44c4ee,null))['then'](removeEntity(_0x44c4ee,null))[_0x8bd4('0x3f')](handleError(_0x44c4ee,null));}; \ No newline at end of file +var _0xe2b1=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','catch','create','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ZendeskField','rawAttributes'];(function(_0x424a32,_0x3e5b62){var _0x404dfc=function(_0x3fad30){while(--_0x3fad30){_0x424a32['push'](_0x424a32['shift']());}};_0x404dfc(++_0x3e5b62);}(_0xe2b1,0x6c));var _0x1e2b=function(_0x34c4a1,_0x16f762){_0x34c4a1=_0x34c4a1-0x0;var _0x2156f8=_0xe2b1[_0x34c4a1];return _0x2156f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e2b('0x0'));var zipdir=require(_0x1e2b('0x1'));var jsonpatch=require(_0x1e2b('0x2'));var rp=require(_0x1e2b('0x3'));var moment=require(_0x1e2b('0x4'));var BPromise=require(_0x1e2b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1e2b('0x6'));var csv=require(_0x1e2b('0x7'));var ejs=require(_0x1e2b('0x8'));var fs=require('fs');var fs_extra=require(_0x1e2b('0x9'));var _=require(_0x1e2b('0xa'));var squel=require(_0x1e2b('0xb'));var crypto=require(_0x1e2b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1e2b('0xd'));var toCsv=require(_0x1e2b('0x7'));var querystring=require('querystring');var Papa=require(_0x1e2b('0xe'));var Redis=require('ioredis');var authService=require(_0x1e2b('0xf'));var qs=require(_0x1e2b('0x10'));var as=require(_0x1e2b('0x11'));var hardwareService=require(_0x1e2b('0x12'));var logger=require(_0x1e2b('0x13'))(_0x1e2b('0x14'));var utils=require(_0x1e2b('0x15'));var config=require(_0x1e2b('0x16'));var licenseUtil=require(_0x1e2b('0x17'));var db=require(_0x1e2b('0x18'))['db'];function respondWithStatusCode(_0xa16971,_0x2408c4){_0x2408c4=_0x2408c4||0xcc;return function(_0x48887b){if(_0x48887b){return _0xa16971['sendStatus'](_0x2408c4);}return _0xa16971[_0x1e2b('0x19')](_0x2408c4)[_0x1e2b('0x1a')]();};}function respondWithResult(_0x15a921,_0x23f179){_0x23f179=_0x23f179||0xc8;return function(_0xf8ddc4){if(_0xf8ddc4){return _0x15a921['status'](_0x23f179)[_0x1e2b('0x1b')](_0xf8ddc4);}};}function respondWithFilteredResult(_0x39d055,_0x1f05c8){return function(_0xc1c31f){if(_0xc1c31f){var _0x4d4cf6=typeof _0x1f05c8[_0x1e2b('0x1c')]===_0x1e2b('0x1d')&&typeof _0x1f05c8[_0x1e2b('0x1e')]==='undefined';var _0x3ee864=_0xc1c31f[_0x1e2b('0x1f')];var _0x4f85df=_0x4d4cf6?0x0:_0x1f05c8[_0x1e2b('0x1c')];var _0x596ec5=_0x4d4cf6?_0xc1c31f[_0x1e2b('0x1f')]:_0x1f05c8['offset']+_0x1f05c8['limit'];var _0x2ca1ed;if(_0x596ec5>=_0x3ee864){_0x596ec5=_0x3ee864;_0x2ca1ed=0xc8;}else{_0x2ca1ed=0xce;}_0x39d055[_0x1e2b('0x19')](_0x2ca1ed);return _0x39d055[_0x1e2b('0x20')](_0x1e2b('0x21'),_0x4f85df+'-'+_0x596ec5+'/'+_0x3ee864)['json'](_0xc1c31f);}return null;};}function patchUpdates(_0x3aa058){return function(_0x5d3da5){try{jsonpatch[_0x1e2b('0x22')](_0x5d3da5,_0x3aa058,!![]);}catch(_0x1e6620){return BPromise[_0x1e2b('0x23')](_0x1e6620);}return _0x5d3da5[_0x1e2b('0x24')]();};}function saveUpdates(_0x5b5a9d,_0x2e3346){return function(_0x1a048c){if(_0x1a048c){return _0x1a048c[_0x1e2b('0x25')](_0x5b5a9d)[_0x1e2b('0x26')](function(_0x5e9782){return _0x5e9782;});}return null;};}function removeEntity(_0x5b3917,_0x47ff05){return function(_0xc11145){if(_0xc11145){return _0xc11145['destroy']()[_0x1e2b('0x26')](function(){_0x5b3917[_0x1e2b('0x19')](0xcc)[_0x1e2b('0x1a')]();});}};}function handleEntityNotFound(_0x5c9ef2,_0x3d4544){return function(_0x27311c){if(!_0x27311c){_0x5c9ef2[_0x1e2b('0x27')](0x194);}return _0x27311c;};}function handleError(_0x5b88c8,_0x3d9698){_0x3d9698=_0x3d9698||0x1f4;return function(_0x7f1b8e){logger[_0x1e2b('0x28')](_0x7f1b8e[_0x1e2b('0x29')]);if(_0x7f1b8e[_0x1e2b('0x2a')]){delete _0x7f1b8e['name'];}_0x5b88c8[_0x1e2b('0x19')](_0x3d9698)[_0x1e2b('0x2b')](_0x7f1b8e);};}exports[_0x1e2b('0x2c')]=function(_0x1c0b60,_0x35b6cb){var _0x3e8b1f={},_0x113987={},_0x49b8fe={'count':0x0,'rows':[]};var _0x272c0f=_[_0x1e2b('0x2d')](db[_0x1e2b('0x2e')][_0x1e2b('0x2f')],function(_0x3cbb56){return{'name':_0x3cbb56[_0x1e2b('0x30')],'type':_0x3cbb56[_0x1e2b('0x31')][_0x1e2b('0x32')]};});_0x113987[_0x1e2b('0x33')]=_[_0x1e2b('0x2d')](_0x272c0f,_0x1e2b('0x2a'));_0x113987[_0x1e2b('0x34')]=_[_0x1e2b('0x35')](_0x1c0b60['query']);_0x113987[_0x1e2b('0x36')]=_[_0x1e2b('0x37')](_0x113987['model'],_0x113987[_0x1e2b('0x34')]);_0x3e8b1f[_0x1e2b('0x38')]=_[_0x1e2b('0x37')](_0x113987[_0x1e2b('0x33')],qs[_0x1e2b('0x39')](_0x1c0b60[_0x1e2b('0x34')][_0x1e2b('0x39')]));_0x3e8b1f[_0x1e2b('0x38')]=_0x3e8b1f[_0x1e2b('0x38')][_0x1e2b('0x3a')]?_0x3e8b1f[_0x1e2b('0x38')]:_0x113987['model'];if(!_0x1c0b60[_0x1e2b('0x34')][_0x1e2b('0x3b')](_0x1e2b('0x3c'))){_0x3e8b1f['limit']=qs[_0x1e2b('0x1e')](_0x1c0b60[_0x1e2b('0x34')]['limit']);_0x3e8b1f[_0x1e2b('0x1c')]=qs[_0x1e2b('0x1c')](_0x1c0b60[_0x1e2b('0x34')][_0x1e2b('0x1c')]);}_0x3e8b1f['order']=qs[_0x1e2b('0x3d')](_0x1c0b60['query'][_0x1e2b('0x3d')]);_0x3e8b1f[_0x1e2b('0x3e')]=qs[_0x1e2b('0x36')](_[_0x1e2b('0x3f')](_0x1c0b60[_0x1e2b('0x34')],_0x113987[_0x1e2b('0x36')]),_0x272c0f);if(_0x1c0b60[_0x1e2b('0x34')][_0x1e2b('0x40')]){_0x3e8b1f[_0x1e2b('0x3e')]=_['merge'](_0x3e8b1f[_0x1e2b('0x3e')],{'$or':_[_0x1e2b('0x2d')](_0x272c0f,function(_0x1a3180){if(_0x1a3180[_0x1e2b('0x31')]!==_0x1e2b('0x41')){var _0x495948={};_0x495948[_0x1a3180['name']]={'$like':'%'+_0x1c0b60[_0x1e2b('0x34')][_0x1e2b('0x40')]+'%'};return _0x495948;}})});}_0x3e8b1f=_[_0x1e2b('0x42')]({},_0x3e8b1f,_0x1c0b60[_0x1e2b('0x43')]);var _0x52277b={'where':_0x3e8b1f['where']};return db['ZendeskField'][_0x1e2b('0x1f')](_0x52277b)[_0x1e2b('0x26')](function(_0x567945){_0x49b8fe['count']=_0x567945;if(_0x1c0b60['query'][_0x1e2b('0x44')]){_0x3e8b1f[_0x1e2b('0x45')]=[{'all':!![]}];}return db['ZendeskField'][_0x1e2b('0x46')](_0x3e8b1f);})[_0x1e2b('0x26')](function(_0x1fca87){_0x49b8fe[_0x1e2b('0x47')]=_0x1fca87;return _0x49b8fe;})[_0x1e2b('0x26')](respondWithFilteredResult(_0x35b6cb,_0x3e8b1f))['catch'](handleError(_0x35b6cb,null));};exports['show']=function(_0x145fe1,_0x1308f4){var _0x2b1323={'raw':!![],'where':{'id':_0x145fe1[_0x1e2b('0x48')]['id']}},_0x44e83e={};_0x44e83e['model']=_[_0x1e2b('0x35')](db[_0x1e2b('0x2e')][_0x1e2b('0x2f')]);_0x44e83e[_0x1e2b('0x34')]=_['keys'](_0x145fe1[_0x1e2b('0x34')]);_0x44e83e['filters']=_['intersection'](_0x44e83e[_0x1e2b('0x33')],_0x44e83e[_0x1e2b('0x34')]);_0x2b1323[_0x1e2b('0x38')]=_[_0x1e2b('0x37')](_0x44e83e[_0x1e2b('0x33')],qs[_0x1e2b('0x39')](_0x145fe1['query'][_0x1e2b('0x39')]));_0x2b1323[_0x1e2b('0x38')]=_0x2b1323[_0x1e2b('0x38')][_0x1e2b('0x3a')]?_0x2b1323[_0x1e2b('0x38')]:_0x44e83e[_0x1e2b('0x33')];if(_0x145fe1[_0x1e2b('0x34')][_0x1e2b('0x44')]){_0x2b1323['include']=[{'all':!![]}];}_0x2b1323=_[_0x1e2b('0x42')]({},_0x2b1323,_0x145fe1[_0x1e2b('0x43')]);return db[_0x1e2b('0x2e')]['find'](_0x2b1323)[_0x1e2b('0x26')](handleEntityNotFound(_0x1308f4,null))[_0x1e2b('0x26')](respondWithResult(_0x1308f4,null))[_0x1e2b('0x49')](handleError(_0x1308f4,null));};exports[_0x1e2b('0x4a')]=function(_0x28134c,_0x4f3dd3){return db[_0x1e2b('0x2e')][_0x1e2b('0x4a')](_0x28134c['body'],{})[_0x1e2b('0x26')](respondWithResult(_0x4f3dd3,0xc9))[_0x1e2b('0x49')](handleError(_0x4f3dd3,null));};exports[_0x1e2b('0x25')]=function(_0x143c3e,_0x2449ab){if(_0x143c3e[_0x1e2b('0x4b')]['id']){delete _0x143c3e['body']['id'];}return db[_0x1e2b('0x2e')][_0x1e2b('0x4c')]({'where':{'id':_0x143c3e[_0x1e2b('0x48')]['id']}})[_0x1e2b('0x26')](handleEntityNotFound(_0x2449ab,null))[_0x1e2b('0x26')](saveUpdates(_0x143c3e[_0x1e2b('0x4b')],null))[_0x1e2b('0x26')](respondWithResult(_0x2449ab,null))[_0x1e2b('0x49')](handleError(_0x2449ab,null));};exports[_0x1e2b('0x4d')]=function(_0x33b7b2,_0x2ff079){return db['ZendeskField'][_0x1e2b('0x4c')]({'where':{'id':_0x33b7b2['params']['id']}})[_0x1e2b('0x26')](handleEntityNotFound(_0x2ff079,null))['then'](removeEntity(_0x2ff079,null))[_0x1e2b('0x49')](handleError(_0x2ff079,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 9eb5d76..bcd5214 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 _0x44d4=['ZendeskField','zendesk_unique_index','FieldId','lodash','moment','bluebird','../../config/environment','./intZendeskField.attributes','exports','define'];(function(_0x3b8af2,_0xc067b1){var _0x3eca35=function(_0x4ae133){while(--_0x4ae133){_0x3b8af2['push'](_0x3b8af2['shift']());}};_0x3eca35(++_0xc067b1);}(_0x44d4,0x161));var _0x444d=function(_0x251170,_0x32fb45){_0x251170=_0x251170-0x0;var _0x32583d=_0x44d4[_0x251170];return _0x32583d;};'use strict';var _=require(_0x444d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x444d('0x1'));var BPromise=require(_0x444d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x444d('0x3'));var attributes=require(_0x444d('0x4'));module[_0x444d('0x5')]=function(_0x24f601,_0x45dfdb){return _0x24f601[_0x444d('0x6')](_0x444d('0x7'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x444d('0x8'),'fields':['idField',_0x444d('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa12=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x49b098,_0x467730){var _0xf6dce6=function(_0x5827e8){while(--_0x5827e8){_0x49b098['push'](_0x49b098['shift']());}};_0xf6dce6(++_0x467730);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x4b06f7,_0x436bca){_0x4b06f7=_0x4b06f7-0x0;var _0x12af91=_0xfa12[_0x4b06f7];return _0x12af91;};'use strict';var _=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var logger=require('../../config/logger')(_0x2fa1('0x2'));var moment=require(_0x2fa1('0x3'));var BPromise=require(_0x2fa1('0x4'));var rp=require(_0x2fa1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fa1('0x6'));var config=require(_0x2fa1('0x7'));var attributes=require(_0x2fa1('0x8'));module[_0x2fa1('0x9')]=function(_0x4d61b0,_0x166949){return _0x4d61b0[_0x2fa1('0xa')]('ZendeskField',attributes,{'tableName':_0x2fa1('0xb'),'paranoid':![],'indexes':[{'name':_0x2fa1('0xc'),'fields':[_0x2fa1('0xd'),_0x2fa1('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index db49278..6bce69c 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 _0xa464=['stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s'];(function(_0x4d5b18,_0x542b2b){var _0xa25b8=function(_0xef9af2){while(--_0xef9af2){_0x4d5b18['push'](_0x4d5b18['shift']());}};_0xa25b8(++_0x542b2b);}(_0xa464,0xec));var _0x4a46=function(_0x42b5fe,_0x59ee80){_0x42b5fe=_0x42b5fe-0x0;var _0x4b7be2=_0xa464[_0x42b5fe];return _0x4b7be2;};'use strict';var _=require(_0x4a46('0x0'));var util=require(_0x4a46('0x1'));var moment=require(_0x4a46('0x2'));var BPromise=require(_0x4a46('0x3'));var rs=require(_0x4a46('0x4'));var fs=require('fs');var Redis=require(_0x4a46('0x5'));var db=require(_0x4a46('0x6'))['db'];var utils=require(_0x4a46('0x7'));var logger=require(_0x4a46('0x8'))(_0x4a46('0x9'));var config=require('../../config/environment');var jayson=require(_0x4a46('0xa'));var client=jayson[_0x4a46('0xb')][_0x4a46('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3302cd,_0x3dcf23,_0x46c1c6){return new BPromise(function(_0x3ceaba,_0x4695e0){return client['request'](_0x3302cd,_0x46c1c6)['then'](function(_0x56fdab){logger[_0x4a46('0xd')]('ZendeskField,\x20%s,\x20%s',_0x3dcf23,_0x4a46('0xe'));logger[_0x4a46('0xf')](_0x4a46('0x10'),_0x3dcf23,_0x4a46('0xe'),JSON[_0x4a46('0x11')](_0x56fdab));if(_0x56fdab['error']){if(_0x56fdab[_0x4a46('0x12')][_0x4a46('0x13')]===0x1f4){logger['error'](_0x4a46('0x14'),_0x3dcf23,_0x56fdab[_0x4a46('0x12')][_0x4a46('0x15')]);return _0x4695e0(_0x56fdab['error'][_0x4a46('0x15')]);}logger[_0x4a46('0x12')](_0x4a46('0x14'),_0x3dcf23,_0x56fdab[_0x4a46('0x12')][_0x4a46('0x15')]);return _0x3ceaba(_0x56fdab['error'][_0x4a46('0x15')]);}else{logger[_0x4a46('0xd')](_0x4a46('0x14'),_0x3dcf23,'request\x20sent');_0x3ceaba(_0x56fdab[_0x4a46('0x16')]['message']);}})['catch'](function(_0x245509){logger[_0x4a46('0x12')]('ZendeskField,\x20%s,\x20%s',_0x3dcf23,_0x245509);_0x4695e0(_0x245509);});});} \ No newline at end of file +var _0x917c=['ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','rpc','../../config/environment','jayson/promise','info','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x917c,0x1a7));var _0xc917=function(_0x1246bc,_0x18ca76){_0x1246bc=_0x1246bc-0x0;var _0x31ed98=_0x917c[_0x1246bc];return _0x31ed98;};'use strict';var _=require(_0xc917('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc917('0x1'));var fs=require('fs');var Redis=require(_0xc917('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc917('0x3'));var config=require(_0xc917('0x4'));var jayson=require(_0xc917('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4decf6,_0x2caaa2,_0x5a1b49){return new BPromise(function(_0x2b9924,_0x3369cf){return client['request'](_0x4decf6,_0x5a1b49)['then'](function(_0x3fb34e){logger[_0xc917('0x6')](_0xc917('0x7'),_0x2caaa2,_0xc917('0x8'));logger['debug'](_0xc917('0x9'),_0x2caaa2,_0xc917('0x8'),JSON[_0xc917('0xa')](_0x3fb34e));if(_0x3fb34e[_0xc917('0xb')]){if(_0x3fb34e[_0xc917('0xb')][_0xc917('0xc')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x2caaa2,_0x3fb34e[_0xc917('0xb')]['message']);return _0x3369cf(_0x3fb34e['error'][_0xc917('0xd')]);}logger[_0xc917('0xb')](_0xc917('0x7'),_0x2caaa2,_0x3fb34e[_0xc917('0xb')]['message']);return _0x2b9924(_0x3fb34e[_0xc917('0xb')][_0xc917('0xd')]);}else{logger['info'](_0xc917('0x7'),_0x2caaa2,_0xc917('0x8'));_0x2b9924(_0x3fb34e[_0xc917('0xe')][_0xc917('0xd')]);}})[_0xc917('0xf')](function(_0x2d9d9b){logger['error'](_0xc917('0x7'),_0x2caaa2,_0x2d9d9b);_0x3369cf(_0x2d9d9b);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 402dd59..3daaac5 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 _0x9ffc=['../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','update','delete','/:id','destroy','exports','multer','util','path','express'];(function(_0x26b607,_0x423c33){var _0x54cd27=function(_0x5b5485){while(--_0x5b5485){_0x26b607['push'](_0x26b607['shift']());}};_0x54cd27(++_0x423c33);}(_0x9ffc,0xd8));var _0xc9ff=function(_0x24ae03,_0x334660){_0x24ae03=_0x24ae03-0x0;var _0x38a29e=_0x9ffc[_0x24ae03];return _0x38a29e;};'use strict';var multer=require(_0xc9ff('0x0'));var util=require(_0xc9ff('0x1'));var path=require(_0xc9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xc9ff('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc9ff('0x4'));var interaction=require(_0xc9ff('0x5'));var config=require('../../config/environment');var controller=require(_0xc9ff('0x6'));router[_0xc9ff('0x7')]('/',auth[_0xc9ff('0x8')](),controller[_0xc9ff('0x9')]);router[_0xc9ff('0x7')]('/:id',auth[_0xc9ff('0x8')](),controller[_0xc9ff('0xa')]);router[_0xc9ff('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xc9ff('0xb'),auth[_0xc9ff('0x8')](),controller[_0xc9ff('0xc')]);router['post']('/',auth[_0xc9ff('0x8')](),controller[_0xc9ff('0xd')]);router[_0xc9ff('0xe')](_0xc9ff('0xf'),auth['isAuthenticated'](),controller[_0xc9ff('0x10')]);router['put']('/:id',auth[_0xc9ff('0x8')](),controller[_0xc9ff('0x11')]);router[_0xc9ff('0x12')](_0xc9ff('0x13'),auth[_0xc9ff('0x8')](),controller[_0xc9ff('0x14')]);module[_0xc9ff('0x15')]=router; \ No newline at end of file +var _0xb347=['exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb347,0x17b));var _0x7b34=function(_0x3409d4,_0x3874c0){_0x3409d4=_0x3409d4-0x0;var _0x18edc6=_0xb347[_0x3409d4];return _0x18edc6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b34('0x0'));var timeout=require(_0x7b34('0x1'));var express=require('express');var router=express[_0x7b34('0x2')]();var fs_extra=require(_0x7b34('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b34('0x4'));var config=require(_0x7b34('0x5'));var controller=require('./intZohoAccount.controller');router[_0x7b34('0x6')]('/',auth[_0x7b34('0x7')](),controller['index']);router[_0x7b34('0x6')](_0x7b34('0x8'),auth['isAuthenticated'](),controller[_0x7b34('0x9')]);router[_0x7b34('0x6')](_0x7b34('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x7b34('0x6')](_0x7b34('0xb'),auth[_0x7b34('0x7')](),controller[_0x7b34('0xc')]);router[_0x7b34('0xd')]('/',auth[_0x7b34('0x7')](),controller[_0x7b34('0xe')]);router[_0x7b34('0xd')](_0x7b34('0xa'),auth[_0x7b34('0x7')](),controller[_0x7b34('0xf')]);router[_0x7b34('0x10')](_0x7b34('0x8'),auth[_0x7b34('0x7')](),controller[_0x7b34('0x11')]);router[_0x7b34('0x12')]('/:id',auth[_0x7b34('0x7')](),controller[_0x7b34('0x13')]);module[_0x7b34('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 9bcee0d..05755f0 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 _0x6458=['STRING','exports'];(function(_0x1b46d2,_0x2ff780){var _0x31a401=function(_0x50a3f9){while(--_0x50a3f9){_0x1b46d2['push'](_0x1b46d2['shift']());}};_0x31a401(++_0x2ff780);}(_0x6458,0xbb));var _0x8645=function(_0x42fc3e,_0xdc5885){_0x42fc3e=_0x42fc3e-0x0;var _0x52e1fa=_0x6458[_0x42fc3e];return _0x52e1fa;};'use strict';var Sequelize=require('sequelize');module[_0x8645('0x0')]={'name':{'type':Sequelize[_0x8645('0x1')]},'description':{'type':Sequelize[_0x8645('0x1')]},'host':{'type':Sequelize[_0x8645('0x1')]},'zone':{'type':Sequelize[_0x8645('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x8645('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x8645('0x1')]},'refreshToken':{'type':Sequelize[_0x8645('0x1')]}}; \ No newline at end of file +var _0x4d5f=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d5f,0x82));var _0xf4d5=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x4d5f[_0x565c49];return _0x20ca34;};'use strict';var Sequelize=require(_0xf4d5('0x0'));module[_0xf4d5('0x1')]={'name':{'type':Sequelize[_0xf4d5('0x2')]},'description':{'type':Sequelize[_0xf4d5('0x2')]},'host':{'type':Sequelize[_0xf4d5('0x2')]},'zone':{'type':Sequelize[_0xf4d5('0x2')]},'clientId':{'type':Sequelize[_0xf4d5('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf4d5('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xf4d5('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 1f78f31..00bf84f 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 _0xb469=['create','body','getConfigurations','findOne','ZohoConfiguration','pick','length','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','getDescriptions','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','clientSecret','access_token','getFields','host','clientId','serverUrl','refreshToken','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','display_label','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb469,0x13b));var _0x9b46=function(_0x1683df,_0x25ae44){_0x1683df=_0x1683df-0x0;var _0x20acc4=_0xb469[_0x1683df];return _0x20acc4;};'use strict';var emlformat=require(_0x9b46('0x0'));var rimraf=require(_0x9b46('0x1'));var zipdir=require(_0x9b46('0x2'));var jsonpatch=require(_0x9b46('0x3'));var rp=require(_0x9b46('0x4'));var moment=require(_0x9b46('0x5'));var BPromise=require(_0x9b46('0x6'));var Mustache=require('mustache');var util=require(_0x9b46('0x7'));var path=require(_0x9b46('0x8'));var sox=require('sox');var csv=require(_0x9b46('0x9'));var ejs=require(_0x9b46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b46('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9b46('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9b46('0x9'));var querystring=require(_0x9b46('0xd'));var Papa=require(_0x9b46('0xe'));var Redis=require('ioredis');var authService=require(_0x9b46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9b46('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b46('0x11'))('api');var utils=require(_0x9b46('0x12'));var config=require(_0x9b46('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b46('0x14'))['db'];var integrations=require(_0x9b46('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x9b46('0x16')][_0x9b46('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3d9618,_0x467086,_0xa8f4ac,_0x35c5c1){return new BPromise(function(_0x2136bc,_0x2e70c3){var _0x3f2b28=_0x35c5c1||client;return _0x3f2b28[_0x9b46('0x18')](_0x3d9618,_0xa8f4ac)[_0x9b46('0x19')](function(_0x135cc2){logger[_0x9b46('0x1a')]('ZohoAccount,\x20%s,\x20%s',_0x467086,'request\x20sent');logger['debug'](_0x9b46('0x1b'),_0x467086,_0x9b46('0x1c'),JSON[_0x9b46('0x1d')](_0x135cc2));if(_0x135cc2['error']){if(_0x135cc2['error'][_0x9b46('0x1e')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x467086,_0x135cc2[_0x9b46('0x1f')][_0x9b46('0x20')]);return _0x2e70c3(_0x135cc2['error'][_0x9b46('0x20')]);}logger[_0x9b46('0x1f')]('ZohoAccount,\x20%s,\x20%s',_0x467086,_0x135cc2['error'][_0x9b46('0x20')]);return _0x2136bc(_0x135cc2[_0x9b46('0x1f')][_0x9b46('0x20')]);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x467086,_0x9b46('0x1c'));_0x2136bc(_0x135cc2['result'][_0x9b46('0x20')]);}})[_0x9b46('0x21')](function(_0x561408){logger[_0x9b46('0x1f')]('ZohoAccount,\x20%s,\x20%s',_0x467086,_0x561408);_0x2e70c3(_0x561408);});});}function respondWithStatusCode(_0x141cb6,_0x2b6f72){_0x2b6f72=_0x2b6f72||0xcc;return function(_0x4d3b1b){if(_0x4d3b1b){return _0x141cb6[_0x9b46('0x22')](_0x2b6f72);}return _0x141cb6[_0x9b46('0x23')](_0x2b6f72)[_0x9b46('0x24')]();};}function respondWithResult(_0x319930,_0x33ea06){_0x33ea06=_0x33ea06||0xc8;return function(_0x3e4899){if(_0x3e4899){return _0x319930[_0x9b46('0x23')](_0x33ea06)['json'](_0x3e4899);}};}function respondWithFilteredResult(_0xdd756c,_0x3ac37e){return function(_0x478105){if(_0x478105){var _0x268821=typeof _0x3ac37e[_0x9b46('0x25')]===_0x9b46('0x26')&&typeof _0x3ac37e[_0x9b46('0x27')]==='undefined';var _0x3bf5b9=_0x478105[_0x9b46('0x28')];var _0x3630bf=_0x268821?0x0:_0x3ac37e[_0x9b46('0x25')];var _0x28b289=_0x268821?_0x478105[_0x9b46('0x28')]:_0x3ac37e[_0x9b46('0x25')]+_0x3ac37e[_0x9b46('0x27')];var _0x163359;if(_0x28b289>=_0x3bf5b9){_0x28b289=_0x3bf5b9;_0x163359=0xc8;}else{_0x163359=0xce;}_0xdd756c[_0x9b46('0x23')](_0x163359);return _0xdd756c[_0x9b46('0x29')]('Content-Range',_0x3630bf+'-'+_0x28b289+'/'+_0x3bf5b9)[_0x9b46('0x2a')](_0x478105);}return null;};}function patchUpdates(_0x27f326){return function(_0x807f2){try{jsonpatch[_0x9b46('0x2b')](_0x807f2,_0x27f326,!![]);}catch(_0x442ae2){return BPromise[_0x9b46('0x2c')](_0x442ae2);}return _0x807f2[_0x9b46('0x2d')]();};}function saveUpdates(_0x3cafc4,_0x3ab49a){return function(_0x451e47){if(_0x451e47){return _0x451e47[_0x9b46('0x2e')](_0x3cafc4)['then'](function(_0xd891a9){return _0xd891a9;});}return null;};}function removeEntity(_0x5a5dca,_0x380737){return function(_0x3f3887){if(_0x3f3887){return _0x3f3887[_0x9b46('0x2f')]()['then'](function(){_0x5a5dca[_0x9b46('0x23')](0xcc)[_0x9b46('0x24')]();});}};}function handleEntityNotFound(_0x37de29,_0x1fa8cd){return function(_0xbc389b){if(!_0xbc389b){_0x37de29['sendStatus'](0x194);}return _0xbc389b;};}function handleError(_0x4e3ee1,_0x12eaf0){_0x12eaf0=_0x12eaf0||0x1f4;return function(_0x33f3f7){logger[_0x9b46('0x1f')](_0x33f3f7[_0x9b46('0x30')]);if(_0x33f3f7['name']){delete _0x33f3f7[_0x9b46('0x31')];}_0x4e3ee1['status'](_0x12eaf0)[_0x9b46('0x32')](_0x33f3f7);};}exports[_0x9b46('0x33')]=function(_0x127f86,_0x1ccba9){var _0x5645f2={},_0x1a96df={},_0x532086={'count':0x0,'rows':[]};var _0x28a9c3=_[_0x9b46('0x34')](db[_0x9b46('0x35')][_0x9b46('0x36')],function(_0x94c802){return{'name':_0x94c802[_0x9b46('0x37')],'type':_0x94c802[_0x9b46('0x38')][_0x9b46('0x39')]};});_0x1a96df[_0x9b46('0x3a')]=_[_0x9b46('0x34')](_0x28a9c3,_0x9b46('0x31'));_0x1a96df['query']=_[_0x9b46('0x3b')](_0x127f86['query']);_0x1a96df[_0x9b46('0x3c')]=_[_0x9b46('0x3d')](_0x1a96df['model'],_0x1a96df[_0x9b46('0x3e')]);_0x5645f2['attributes']=_[_0x9b46('0x3d')](_0x1a96df['model'],qs[_0x9b46('0x3f')](_0x127f86[_0x9b46('0x3e')][_0x9b46('0x3f')]));_0x5645f2[_0x9b46('0x40')]=_0x5645f2[_0x9b46('0x40')]['length']?_0x5645f2['attributes']:_0x1a96df[_0x9b46('0x3a')];if(!_0x127f86['query']['hasOwnProperty']('nolimit')){_0x5645f2['limit']=qs[_0x9b46('0x27')](_0x127f86['query'][_0x9b46('0x27')]);_0x5645f2['offset']=qs[_0x9b46('0x25')](_0x127f86[_0x9b46('0x3e')][_0x9b46('0x25')]);}_0x5645f2[_0x9b46('0x41')]=qs[_0x9b46('0x42')](_0x127f86[_0x9b46('0x3e')][_0x9b46('0x42')]);_0x5645f2[_0x9b46('0x43')]=qs[_0x9b46('0x3c')](_['pick'](_0x127f86[_0x9b46('0x3e')],_0x1a96df[_0x9b46('0x3c')]),_0x28a9c3);if(_0x127f86[_0x9b46('0x3e')][_0x9b46('0x44')]){_0x5645f2[_0x9b46('0x43')]=_[_0x9b46('0x45')](_0x5645f2[_0x9b46('0x43')],{'$or':_[_0x9b46('0x34')](_0x28a9c3,function(_0x13a1b5){if(_0x13a1b5[_0x9b46('0x38')]!==_0x9b46('0x46')){var _0x386587={};_0x386587[_0x13a1b5[_0x9b46('0x31')]]={'$like':'%'+_0x127f86[_0x9b46('0x3e')]['filter']+'%'};return _0x386587;}})});}_0x5645f2=_['merge']({},_0x5645f2,_0x127f86[_0x9b46('0x47')]);var _0x23df60={'where':_0x5645f2[_0x9b46('0x43')]};return db['ZohoAccount']['count'](_0x23df60)[_0x9b46('0x19')](function(_0x3eb90f){_0x532086[_0x9b46('0x28')]=_0x3eb90f;if(_0x127f86[_0x9b46('0x3e')][_0x9b46('0x48')]){_0x5645f2[_0x9b46('0x49')]=[{'all':!![]}];}return db['ZohoAccount'][_0x9b46('0x4a')](_0x5645f2);})[_0x9b46('0x19')](function(_0x11b732){_0x532086['rows']=_0x11b732;return _0x532086;})[_0x9b46('0x19')](respondWithFilteredResult(_0x1ccba9,_0x5645f2))['catch'](handleError(_0x1ccba9,null));};exports[_0x9b46('0x4b')]=function(_0x1aaf71,_0x16e6d8){var _0x566bad={'raw':![],'where':{'id':_0x1aaf71[_0x9b46('0x4c')]['id']}},_0x194979={};_0x194979[_0x9b46('0x3a')]=_[_0x9b46('0x3b')](db[_0x9b46('0x35')][_0x9b46('0x36')]);_0x194979['query']=_[_0x9b46('0x3b')](_0x1aaf71[_0x9b46('0x3e')]);_0x194979[_0x9b46('0x3c')]=_[_0x9b46('0x3d')](_0x194979[_0x9b46('0x3a')],_0x194979[_0x9b46('0x3e')]);_0x566bad['attributes']=_[_0x9b46('0x3d')](_0x194979['model'],qs[_0x9b46('0x3f')](_0x1aaf71[_0x9b46('0x3e')][_0x9b46('0x3f')]));_0x566bad[_0x9b46('0x40')]=_0x566bad[_0x9b46('0x40')]['length']?_0x566bad[_0x9b46('0x40')]:_0x194979[_0x9b46('0x3a')];if(_0x1aaf71[_0x9b46('0x3e')][_0x9b46('0x48')]){_0x566bad[_0x9b46('0x49')]=[{'all':!![]}];}_0x566bad=_[_0x9b46('0x45')]({},_0x566bad,_0x1aaf71[_0x9b46('0x47')]);return db[_0x9b46('0x35')][_0x9b46('0x4d')](_0x566bad)[_0x9b46('0x19')](handleEntityNotFound(_0x16e6d8,null))[_0x9b46('0x19')](respondWithResult(_0x16e6d8,null))['catch'](handleError(_0x16e6d8,null));};exports['create']=function(_0x496006,_0x7a092b){return db['ZohoAccount'][_0x9b46('0x4e')](_0x496006['body'],{})[_0x9b46('0x19')](respondWithResult(_0x7a092b,0xc9))['catch'](handleError(_0x7a092b,null));};exports[_0x9b46('0x2e')]=function(_0x443ccd,_0x15e3d6){if(_0x443ccd[_0x9b46('0x4f')]['id']){delete _0x443ccd[_0x9b46('0x4f')]['id'];}return db['ZohoAccount'][_0x9b46('0x4d')]({'where':{'id':_0x443ccd[_0x9b46('0x4c')]['id']}})[_0x9b46('0x19')](handleEntityNotFound(_0x15e3d6,null))[_0x9b46('0x19')](saveUpdates(_0x443ccd[_0x9b46('0x4f')],null))['then'](respondWithResult(_0x15e3d6,null))['catch'](handleError(_0x15e3d6,null));};exports[_0x9b46('0x2f')]=function(_0x86d818,_0x8935a9){return db[_0x9b46('0x35')][_0x9b46('0x4d')]({'where':{'id':_0x86d818[_0x9b46('0x4c')]['id']}})[_0x9b46('0x19')](handleEntityNotFound(_0x8935a9,null))[_0x9b46('0x19')](removeEntity(_0x8935a9,null))['catch'](handleError(_0x8935a9,null));};exports[_0x9b46('0x50')]=function(_0x149837,_0x1fd23b,_0x5d7971){var _0x46dffa={};var _0x145200={};var _0x1aa8c6;var _0x12d825;return db[_0x9b46('0x35')][_0x9b46('0x51')]({'where':{'id':_0x149837['params']['id']}})[_0x9b46('0x19')](handleEntityNotFound(_0x1fd23b,null))[_0x9b46('0x19')](function(_0x279530){if(_0x279530){_0x1aa8c6=_0x279530;_0x145200[_0x9b46('0x3a')]=_[_0x9b46('0x3b')](db[_0x9b46('0x52')]['rawAttributes']);_0x145200[_0x9b46('0x3e')]=_['keys'](_0x149837[_0x9b46('0x3e')]);_0x145200['filters']=_[_0x9b46('0x3d')](_0x145200[_0x9b46('0x3a')],_0x145200['query']);_0x46dffa[_0x9b46('0x40')]=_[_0x9b46('0x3d')](_0x145200[_0x9b46('0x3a')],qs[_0x9b46('0x3f')](_0x149837[_0x9b46('0x3e')]['fields']));_0x46dffa[_0x9b46('0x40')]=_0x46dffa[_0x9b46('0x40')]['length']?_0x46dffa['attributes']:_0x145200[_0x9b46('0x3a')];_0x46dffa[_0x9b46('0x41')]=qs[_0x9b46('0x42')](_0x149837[_0x9b46('0x3e')][_0x9b46('0x42')]);_0x46dffa[_0x9b46('0x43')]=qs[_0x9b46('0x3c')](_[_0x9b46('0x53')](_0x149837['query'],_0x145200['filters']));if(_0x149837[_0x9b46('0x3e')][_0x9b46('0x44')]){_0x46dffa['where']=_[_0x9b46('0x45')](_0x46dffa['where'],{'$or':_[_0x9b46('0x34')](_0x46dffa['attributes'],function(_0xf6f92){var _0x2a400e={};_0x2a400e[_0xf6f92]={'$like':'%'+_0x149837[_0x9b46('0x3e')]['filter']+'%'};return _0x2a400e;})});}_0x46dffa=_[_0x9b46('0x45')]({},_0x46dffa,_0x149837[_0x9b46('0x47')]);return _0x1aa8c6[_0x9b46('0x50')](_0x46dffa);}})['then'](function(_0x345ac6){if(_0x345ac6){_0x12d825=_0x345ac6[_0x9b46('0x54')];if(!_0x149837[_0x9b46('0x3e')][_0x9b46('0x55')](_0x9b46('0x56'))){_0x46dffa['limit']=qs['limit'](_0x149837['query']['limit']);_0x46dffa['offset']=qs[_0x9b46('0x25')](_0x149837[_0x9b46('0x3e')][_0x9b46('0x25')]);}return _0x1aa8c6[_0x9b46('0x50')](_0x46dffa);}})[_0x9b46('0x19')](function(_0x471ebf){if(_0x471ebf){return _0x471ebf?{'count':_0x12d825,'rows':_0x471ebf}:null;}})[_0x9b46('0x19')](respondWithResult(_0x1fd23b,null))[_0x9b46('0x21')](handleError(_0x1fd23b,null));};exports['addConfiguration']=function(_0x2c868b,_0x34ad37,_0x5c49c1){if(_0x2c868b[_0x9b46('0x4f')]['id']){delete _0x2c868b['body']['id'];}return db[_0x9b46('0x35')][_0x9b46('0x51')]({'where':{'id':_0x2c868b[_0x9b46('0x4c')]['id']}})[_0x9b46('0x19')](handleEntityNotFound(_0x34ad37,null))[_0x9b46('0x19')](function(_0x4b955d){if(_0x4b955d){_0x2c868b['body'][_0x9b46('0x57')]=_0x4b955d['id'];_0x2c868b['body'][_0x9b46('0x58')]=integrations[_0x9b46('0x59')](_0x2c868b['body']['channel'],_0x2c868b['body'][_0x9b46('0x38')]);_0x2c868b['body']['Descriptions']=integrations[_0x9b46('0x5a')](_0x2c868b[_0x9b46('0x4f')][_0x9b46('0x5b')],_0x2c868b[_0x9b46('0x4f')]['type']);return db[_0x9b46('0x52')][_0x9b46('0x4e')](_0x2c868b[_0x9b46('0x4f')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x9b46('0x5c')],'as':_0x9b46('0x5d')}]});}return null;})[_0x9b46('0x19')](respondWithResult(_0x34ad37,null))['catch'](handleError(_0x34ad37,null));};function getAccessToken(_0x2f60a3){return new Promise(function(_0x3a1e1e,_0x533afa){var _0x378879;switch(_0x2f60a3[_0x9b46('0x5e')]){case'US':_0x378879=_0x9b46('0x5f');break;case'AU':_0x378879=_0x9b46('0x60');break;case'EU':_0x378879='https://accounts.zoho.eu';break;case'IN':_0x378879='https://accounts.zoho.in';break;case'CN':_0x378879=_0x9b46('0x61');break;default:_0x378879='https://accounts.zoho.eu';break;}var _0x13688b={'method':_0x9b46('0x62'),'uri':_0x378879+'/oauth/v2/token','qs':{'refresh_token':_0x2f60a3['refreshToken'],'client_id':_0x2f60a3['clientId'],'client_secret':_0x2f60a3[_0x9b46('0x63')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x13688b)[_0x9b46('0x19')](function(_0x1dccca){if(_0x1dccca[_0x9b46('0x64')]){_0x3a1e1e(_0x1dccca[_0x9b46('0x64')]);}else{_0x533afa('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x9b46('0x21')](function(_0x217439){_0x533afa(_0x217439);});});}exports[_0x9b46('0x65')]=function(_0x195cf0,_0x1fc17e,_0x51786d){var _0x435d0d,_0x591820,_0x254c71,_0x1f49bf,_0x514124;return db[_0x9b46('0x35')][_0x9b46('0x51')]({'where':{'id':_0x195cf0[_0x9b46('0x4c')]['id']},'attributes':['id',_0x9b46('0x66'),'zone',_0x9b46('0x67'),'clientSecret',_0x9b46('0x68'),_0x9b46('0x1e'),_0x9b46('0x69')]})['then'](handleEntityNotFound(_0x1fc17e,null))[_0x9b46('0x19')](function(_0x8700c7){_0x514124=_0x8700c7;_0x435d0d=_0x514124[_0x9b46('0x66')];_0x591820=_0x435d0d===_0x9b46('0x6a')?'eu':'com';_0x254c71=_0x514124[_0x9b46('0x68')];var _0x4f5fe6=_0x254c71[_0x9b46('0x6b')](-0x1);if(_0x4f5fe6==='/'||_0x4f5fe6==='\x5c'||_0x4f5fe6===':'){_0x254c71=_0x254c71[_0x9b46('0x6c')](0x0,_0x254c71[_0x9b46('0x6d')](_0x4f5fe6));}if(!_0x514124[_0x9b46('0x69')]){throw new Error(_0x9b46('0x6e'));}return getAccessToken(_0x514124);})[_0x9b46('0x19')](function(_0x33db2d){if(_0x33db2d){return rp({'method':'GET','uri':util[_0x9b46('0x6f')](_0x9b46('0x70'),_0x591820),'qs':{'module':_0x9b46('0x71')},'headers':{'Authorization':_0x9b46('0x72')+_0x33db2d},'json':!![]});}})[_0x9b46('0x19')](function(_0x148b43){if(_0x148b43){if(_0x148b43[_0x9b46('0x73')]&&_0x148b43[_0x9b46('0x73')][_0x9b46('0x1f')]){throw new Error(_0x148b43[_0x9b46('0x73')][_0x9b46('0x1f')][_0x9b46('0x20')]);}var _0x35e108=[];var _0x189cb9=[];var _0x2078a8=[_0x9b46('0x74'),'Subject','Description',_0x9b46('0x75'),_0x9b46('0x76'),_0x9b46('0x77'),_0x9b46('0x78'),_0x9b46('0x79')];_0x189cb9=_[_0x9b46('0x7a')](_0x148b43[_0x9b46('0x3f')],function(_0x6e11dc){return _0x2078a8[_0x9b46('0x7b')](_0x6e11dc[_0x9b46('0x7c')]);});for(var _0x1d3cad=0x0;_0x1d3cad<_0x189cb9[_0x9b46('0x54')];_0x1d3cad++){if(_0x189cb9[_0x1d3cad]['system_mandatory']===![]){_0x35e108['push']({'id':_0x189cb9[_0x1d3cad]['id'],'name':_0x189cb9[_0x1d3cad][_0x9b46('0x7d')],'custom':_0x189cb9[_0x1d3cad]['custom_field'],'options':_0x189cb9[_0x1d3cad][_0x9b46('0x7e')]==='picklist'&&_0x189cb9[_0x1d3cad][_0x9b46('0x7f')][_0x9b46('0x54')]>-0x1?_[_0x9b46('0x34')](_0x189cb9[_0x1d3cad][_0x9b46('0x7f')],function(_0x335343){return{'name':_0x335343,'value':_0x335343};}):[]});}}return{'count':_0x35e108['length'],'rows':_0x35e108};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x1fc17e,null))[_0x9b46('0x21')](function(_0x263359){var _0x1ff19d=_0x195cf0[_0x9b46('0x3e')][_0x9b46('0x80')]?0x1f4:_0x263359[_0x9b46('0x81')]||0x1f4;logger[_0x9b46('0x1f')](_0x9b46('0x82'),'getFields',_0x1ff19d,JSON[_0x9b46('0x1d')](_0x263359));delete _0x263359[_0x9b46('0x31')];if(_0x1ff19d===0x191){_0x1ff19d=0x190;}_0x1fc17e[_0x9b46('0x23')](_0x1ff19d)[_0x9b46('0x32')](_0x195cf0[_0x9b46('0x3e')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x263359[_0x9b46('0x81')]}:_0x263359);});}; \ No newline at end of file +var _0x2750=['clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','slice','substring','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','includes','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','http','request','info','request\x20sent','debug','code','error','ZohoAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','show','params','find','body','update','getConfigurations','ZohoConfiguration','addConfiguration','findOne','Subjects','getSubjects','channel','create','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2750,0x13b));var _0x0275=function(_0x52d903,_0x45d2d2){_0x52d903=_0x52d903-0x0;var _0x148b2d=_0x2750[_0x52d903];return _0x148b2d;};'use strict';var emlformat=require(_0x0275('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0275('0x1'));var jsonpatch=require(_0x0275('0x2'));var rp=require(_0x0275('0x3'));var moment=require(_0x0275('0x4'));var BPromise=require(_0x0275('0x5'));var Mustache=require(_0x0275('0x6'));var util=require(_0x0275('0x7'));var path=require(_0x0275('0x8'));var sox=require(_0x0275('0x9'));var csv=require(_0x0275('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0275('0xb'));var _=require(_0x0275('0xc'));var squel=require(_0x0275('0xd'));var crypto=require(_0x0275('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0275('0xf'));var toCsv=require(_0x0275('0xa'));var querystring=require(_0x0275('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0275('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0275('0x12'));var hardwareService=require(_0x0275('0x13'));var logger=require(_0x0275('0x14'))(_0x0275('0x15'));var utils=require(_0x0275('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0275('0x17'));var db=require(_0x0275('0x18'))['db'];var integrations=require(_0x0275('0x19'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0275('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x395398,_0x37f809,_0x46a729,_0x28827b){return new BPromise(function(_0x36921c,_0x5910b5){var _0x3e0791=_0x28827b||client;return _0x3e0791[_0x0275('0x1b')](_0x395398,_0x46a729)['then'](function(_0x6344fc){logger[_0x0275('0x1c')]('ZohoAccount,\x20%s,\x20%s',_0x37f809,_0x0275('0x1d'));logger[_0x0275('0x1e')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x37f809,'request\x20sent',JSON['stringify'](_0x6344fc));if(_0x6344fc['error']){if(_0x6344fc['error'][_0x0275('0x1f')]===0x1f4){logger[_0x0275('0x20')](_0x0275('0x21'),_0x37f809,_0x6344fc['error'][_0x0275('0x22')]);return _0x5910b5(_0x6344fc[_0x0275('0x20')][_0x0275('0x22')]);}logger['error'](_0x0275('0x21'),_0x37f809,_0x6344fc[_0x0275('0x20')]['message']);return _0x36921c(_0x6344fc['error'][_0x0275('0x22')]);}else{logger[_0x0275('0x1c')](_0x0275('0x21'),_0x37f809,'request\x20sent');_0x36921c(_0x6344fc[_0x0275('0x23')]['message']);}})[_0x0275('0x24')](function(_0x5c75f1){logger[_0x0275('0x20')](_0x0275('0x21'),_0x37f809,_0x5c75f1);_0x5910b5(_0x5c75f1);});});}function respondWithStatusCode(_0x594321,_0x140a18){_0x140a18=_0x140a18||0xcc;return function(_0x3004bf){if(_0x3004bf){return _0x594321[_0x0275('0x25')](_0x140a18);}return _0x594321['status'](_0x140a18)[_0x0275('0x26')]();};}function respondWithResult(_0x44bbf8,_0x24c928){_0x24c928=_0x24c928||0xc8;return function(_0x15813f){if(_0x15813f){return _0x44bbf8[_0x0275('0x27')](_0x24c928)[_0x0275('0x28')](_0x15813f);}};}function respondWithFilteredResult(_0x56f26c,_0x35343c){return function(_0x14d7d8){if(_0x14d7d8){var _0x1d24b2=typeof _0x35343c[_0x0275('0x29')]===_0x0275('0x2a')&&typeof _0x35343c['limit']===_0x0275('0x2a');var _0xd59d69=_0x14d7d8[_0x0275('0x2b')];var _0xe9d730=_0x1d24b2?0x0:_0x35343c[_0x0275('0x29')];var _0x49e645=_0x1d24b2?_0x14d7d8[_0x0275('0x2b')]:_0x35343c[_0x0275('0x29')]+_0x35343c[_0x0275('0x2c')];var _0x489d7f;if(_0x49e645>=_0xd59d69){_0x49e645=_0xd59d69;_0x489d7f=0xc8;}else{_0x489d7f=0xce;}_0x56f26c['status'](_0x489d7f);return _0x56f26c[_0x0275('0x2d')](_0x0275('0x2e'),_0xe9d730+'-'+_0x49e645+'/'+_0xd59d69)['json'](_0x14d7d8);}return null;};}function patchUpdates(_0x7eff96){return function(_0x155a50){try{jsonpatch[_0x0275('0x2f')](_0x155a50,_0x7eff96,!![]);}catch(_0x4111fa){return BPromise['reject'](_0x4111fa);}return _0x155a50[_0x0275('0x30')]();};}function saveUpdates(_0x86940b,_0x3bba47){return function(_0x2002c2){if(_0x2002c2){return _0x2002c2['update'](_0x86940b)[_0x0275('0x31')](function(_0x55198e){return _0x55198e;});}return null;};}function removeEntity(_0x2cc5df,_0x4ead8e){return function(_0x26aae0){if(_0x26aae0){return _0x26aae0[_0x0275('0x32')]()['then'](function(){_0x2cc5df[_0x0275('0x27')](0xcc)[_0x0275('0x26')]();});}};}function handleEntityNotFound(_0x1575be,_0x24a1ee){return function(_0x487b97){if(!_0x487b97){_0x1575be[_0x0275('0x25')](0x194);}return _0x487b97;};}function handleError(_0x136cd2,_0xbe4741){_0xbe4741=_0xbe4741||0x1f4;return function(_0x1d872a){logger[_0x0275('0x20')](_0x1d872a['stack']);if(_0x1d872a[_0x0275('0x33')]){delete _0x1d872a[_0x0275('0x33')];}_0x136cd2[_0x0275('0x27')](_0xbe4741)[_0x0275('0x34')](_0x1d872a);};}exports[_0x0275('0x35')]=function(_0x430307,_0x28cf71){var _0x471fc7={},_0x3bf52d={},_0x234ac3={'count':0x0,'rows':[]};var _0xb3264e=_['map'](db[_0x0275('0x36')][_0x0275('0x37')],function(_0xc7d2fe){return{'name':_0xc7d2fe[_0x0275('0x38')],'type':_0xc7d2fe[_0x0275('0x39')][_0x0275('0x3a')]};});_0x3bf52d[_0x0275('0x3b')]=_[_0x0275('0x3c')](_0xb3264e,_0x0275('0x33'));_0x3bf52d[_0x0275('0x3d')]=_[_0x0275('0x3e')](_0x430307[_0x0275('0x3d')]);_0x3bf52d[_0x0275('0x3f')]=_[_0x0275('0x40')](_0x3bf52d['model'],_0x3bf52d[_0x0275('0x3d')]);_0x471fc7[_0x0275('0x41')]=_['intersection'](_0x3bf52d[_0x0275('0x3b')],qs[_0x0275('0x42')](_0x430307[_0x0275('0x3d')][_0x0275('0x42')]));_0x471fc7[_0x0275('0x41')]=_0x471fc7[_0x0275('0x41')][_0x0275('0x43')]?_0x471fc7['attributes']:_0x3bf52d[_0x0275('0x3b')];if(!_0x430307[_0x0275('0x3d')][_0x0275('0x44')](_0x0275('0x45'))){_0x471fc7['limit']=qs[_0x0275('0x2c')](_0x430307[_0x0275('0x3d')][_0x0275('0x2c')]);_0x471fc7[_0x0275('0x29')]=qs['offset'](_0x430307[_0x0275('0x3d')]['offset']);}_0x471fc7[_0x0275('0x46')]=qs[_0x0275('0x47')](_0x430307[_0x0275('0x3d')][_0x0275('0x47')]);_0x471fc7['where']=qs[_0x0275('0x3f')](_[_0x0275('0x48')](_0x430307['query'],_0x3bf52d[_0x0275('0x3f')]),_0xb3264e);if(_0x430307[_0x0275('0x3d')][_0x0275('0x49')]){_0x471fc7['where']=_[_0x0275('0x4a')](_0x471fc7[_0x0275('0x4b')],{'$or':_['map'](_0xb3264e,function(_0x1da178){if(_0x1da178[_0x0275('0x39')]!==_0x0275('0x4c')){var _0x437aa3={};_0x437aa3[_0x1da178[_0x0275('0x33')]]={'$like':'%'+_0x430307[_0x0275('0x3d')][_0x0275('0x49')]+'%'};return _0x437aa3;}})});}_0x471fc7=_[_0x0275('0x4a')]({},_0x471fc7,_0x430307[_0x0275('0x4d')]);var _0x2179da={'where':_0x471fc7[_0x0275('0x4b')]};return db['ZohoAccount'][_0x0275('0x2b')](_0x2179da)[_0x0275('0x31')](function(_0x350465){_0x234ac3[_0x0275('0x2b')]=_0x350465;if(_0x430307[_0x0275('0x3d')][_0x0275('0x4e')]){_0x471fc7[_0x0275('0x4f')]=[{'all':!![]}];}return db[_0x0275('0x36')][_0x0275('0x50')](_0x471fc7);})[_0x0275('0x31')](function(_0x348de0){_0x234ac3['rows']=_0x348de0;return _0x234ac3;})['then'](respondWithFilteredResult(_0x28cf71,_0x471fc7))[_0x0275('0x24')](handleError(_0x28cf71,null));};exports[_0x0275('0x51')]=function(_0x1566ef,_0x3bd019){var _0x310c6b={'raw':![],'where':{'id':_0x1566ef[_0x0275('0x52')]['id']}},_0x58b6c5={};_0x58b6c5['model']=_[_0x0275('0x3e')](db[_0x0275('0x36')][_0x0275('0x37')]);_0x58b6c5[_0x0275('0x3d')]=_['keys'](_0x1566ef[_0x0275('0x3d')]);_0x58b6c5['filters']=_['intersection'](_0x58b6c5['model'],_0x58b6c5[_0x0275('0x3d')]);_0x310c6b['attributes']=_[_0x0275('0x40')](_0x58b6c5[_0x0275('0x3b')],qs[_0x0275('0x42')](_0x1566ef[_0x0275('0x3d')][_0x0275('0x42')]));_0x310c6b[_0x0275('0x41')]=_0x310c6b[_0x0275('0x41')]['length']?_0x310c6b[_0x0275('0x41')]:_0x58b6c5['model'];if(_0x1566ef[_0x0275('0x3d')][_0x0275('0x4e')]){_0x310c6b[_0x0275('0x4f')]=[{'all':!![]}];}_0x310c6b=_[_0x0275('0x4a')]({},_0x310c6b,_0x1566ef[_0x0275('0x4d')]);return db[_0x0275('0x36')][_0x0275('0x53')](_0x310c6b)[_0x0275('0x31')](handleEntityNotFound(_0x3bd019,null))[_0x0275('0x31')](respondWithResult(_0x3bd019,null))[_0x0275('0x24')](handleError(_0x3bd019,null));};exports['create']=function(_0x5a25e4,_0x24fc20){return db['ZohoAccount']['create'](_0x5a25e4[_0x0275('0x54')],{})[_0x0275('0x31')](respondWithResult(_0x24fc20,0xc9))[_0x0275('0x24')](handleError(_0x24fc20,null));};exports[_0x0275('0x55')]=function(_0x35994c,_0xb1b696){if(_0x35994c['body']['id']){delete _0x35994c[_0x0275('0x54')]['id'];}return db[_0x0275('0x36')][_0x0275('0x53')]({'where':{'id':_0x35994c[_0x0275('0x52')]['id']}})[_0x0275('0x31')](handleEntityNotFound(_0xb1b696,null))[_0x0275('0x31')](saveUpdates(_0x35994c['body'],null))[_0x0275('0x31')](respondWithResult(_0xb1b696,null))[_0x0275('0x24')](handleError(_0xb1b696,null));};exports['destroy']=function(_0x19d33f,_0x5c588d){return db[_0x0275('0x36')][_0x0275('0x53')]({'where':{'id':_0x19d33f[_0x0275('0x52')]['id']}})[_0x0275('0x31')](handleEntityNotFound(_0x5c588d,null))[_0x0275('0x31')](removeEntity(_0x5c588d,null))[_0x0275('0x24')](handleError(_0x5c588d,null));};exports[_0x0275('0x56')]=function(_0x40511b,_0x3a37b8,_0x442a7a){var _0x1ec6b8={};var _0x53023a={};var _0x2845da;var _0x3697b0;return db[_0x0275('0x36')]['findOne']({'where':{'id':_0x40511b[_0x0275('0x52')]['id']}})[_0x0275('0x31')](handleEntityNotFound(_0x3a37b8,null))['then'](function(_0x27b4b8){if(_0x27b4b8){_0x2845da=_0x27b4b8;_0x53023a['model']=_[_0x0275('0x3e')](db[_0x0275('0x57')][_0x0275('0x37')]);_0x53023a[_0x0275('0x3d')]=_['keys'](_0x40511b[_0x0275('0x3d')]);_0x53023a[_0x0275('0x3f')]=_[_0x0275('0x40')](_0x53023a[_0x0275('0x3b')],_0x53023a['query']);_0x1ec6b8[_0x0275('0x41')]=_[_0x0275('0x40')](_0x53023a['model'],qs[_0x0275('0x42')](_0x40511b[_0x0275('0x3d')]['fields']));_0x1ec6b8['attributes']=_0x1ec6b8[_0x0275('0x41')][_0x0275('0x43')]?_0x1ec6b8['attributes']:_0x53023a['model'];_0x1ec6b8[_0x0275('0x46')]=qs[_0x0275('0x47')](_0x40511b[_0x0275('0x3d')][_0x0275('0x47')]);_0x1ec6b8[_0x0275('0x4b')]=qs[_0x0275('0x3f')](_[_0x0275('0x48')](_0x40511b[_0x0275('0x3d')],_0x53023a['filters']));if(_0x40511b[_0x0275('0x3d')][_0x0275('0x49')]){_0x1ec6b8[_0x0275('0x4b')]=_[_0x0275('0x4a')](_0x1ec6b8[_0x0275('0x4b')],{'$or':_[_0x0275('0x3c')](_0x1ec6b8['attributes'],function(_0x1a4b01){var _0x566ca4={};_0x566ca4[_0x1a4b01]={'$like':'%'+_0x40511b[_0x0275('0x3d')][_0x0275('0x49')]+'%'};return _0x566ca4;})});}_0x1ec6b8=_[_0x0275('0x4a')]({},_0x1ec6b8,_0x40511b[_0x0275('0x4d')]);return _0x2845da['getConfigurations'](_0x1ec6b8);}})[_0x0275('0x31')](function(_0x1369a2){if(_0x1369a2){_0x3697b0=_0x1369a2[_0x0275('0x43')];if(!_0x40511b[_0x0275('0x3d')][_0x0275('0x44')](_0x0275('0x45'))){_0x1ec6b8[_0x0275('0x2c')]=qs[_0x0275('0x2c')](_0x40511b[_0x0275('0x3d')]['limit']);_0x1ec6b8['offset']=qs['offset'](_0x40511b[_0x0275('0x3d')][_0x0275('0x29')]);}return _0x2845da[_0x0275('0x56')](_0x1ec6b8);}})['then'](function(_0x3b8e6a){if(_0x3b8e6a){return _0x3b8e6a?{'count':_0x3697b0,'rows':_0x3b8e6a}:null;}})[_0x0275('0x31')](respondWithResult(_0x3a37b8,null))[_0x0275('0x24')](handleError(_0x3a37b8,null));};exports[_0x0275('0x58')]=function(_0x342075,_0x55890d,_0x143e70){if(_0x342075['body']['id']){delete _0x342075[_0x0275('0x54')]['id'];}return db[_0x0275('0x36')][_0x0275('0x59')]({'where':{'id':_0x342075[_0x0275('0x52')]['id']}})['then'](handleEntityNotFound(_0x55890d,null))[_0x0275('0x31')](function(_0x3ddfa1){if(_0x3ddfa1){_0x342075[_0x0275('0x54')]['AccountId']=_0x3ddfa1['id'];_0x342075[_0x0275('0x54')][_0x0275('0x5a')]=integrations[_0x0275('0x5b')](_0x342075[_0x0275('0x54')][_0x0275('0x5c')],_0x342075[_0x0275('0x54')][_0x0275('0x39')]);_0x342075[_0x0275('0x54')]['Descriptions']=integrations['getDescriptions'](_0x342075['body'][_0x0275('0x5c')],_0x342075[_0x0275('0x54')][_0x0275('0x39')]);return db[_0x0275('0x57')][_0x0275('0x5d')](_0x342075['body'],{'include':[{'model':db[_0x0275('0x5e')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x0275('0x5f')}]});}return null;})['then'](respondWithResult(_0x55890d,null))[_0x0275('0x24')](handleError(_0x55890d,null));};function getAccessToken(_0x239611){return new Promise(function(_0x1fc777,_0x34f4b8){var _0x4207d5;switch(_0x239611[_0x0275('0x60')]){case'US':_0x4207d5=_0x0275('0x61');break;case'AU':_0x4207d5=_0x0275('0x62');break;case'EU':_0x4207d5=_0x0275('0x63');break;case'IN':_0x4207d5=_0x0275('0x64');break;case'CN':_0x4207d5=_0x0275('0x65');break;default:_0x4207d5=_0x0275('0x63');break;}var _0x473d09={'method':_0x0275('0x66'),'uri':_0x4207d5+_0x0275('0x67'),'qs':{'refresh_token':_0x239611[_0x0275('0x68')],'client_id':_0x239611[_0x0275('0x69')],'client_secret':_0x239611[_0x0275('0x6a')],'grant_type':_0x0275('0x6b')},'json':!![]};return rp(_0x473d09)[_0x0275('0x31')](function(_0x44010b){if(_0x44010b['access_token']){_0x1fc777(_0x44010b[_0x0275('0x6c')]);}else{_0x34f4b8(_0x0275('0x6d'));}})[_0x0275('0x24')](function(_0x1a9540){_0x34f4b8(_0x1a9540);});});}exports[_0x0275('0x6e')]=function(_0x60d12f,_0x5c1c96,_0x1a2ac3){var _0x9476a7,_0x52e15b,_0x14ca33,_0x111c75,_0x236039;return db[_0x0275('0x36')]['findOne']({'where':{'id':_0x60d12f[_0x0275('0x52')]['id']},'attributes':['id',_0x0275('0x6f'),'zone',_0x0275('0x69'),'clientSecret',_0x0275('0x70'),_0x0275('0x1f'),'refreshToken']})[_0x0275('0x31')](handleEntityNotFound(_0x5c1c96,null))[_0x0275('0x31')](function(_0x35a05c){_0x236039=_0x35a05c;_0x9476a7=_0x236039[_0x0275('0x6f')];_0x52e15b=_0x9476a7===_0x0275('0x71')?'eu':_0x0275('0x72');_0x14ca33=_0x236039[_0x0275('0x70')];var _0x569182=_0x14ca33[_0x0275('0x73')](-0x1);if(_0x569182==='/'||_0x569182==='\x5c'||_0x569182===':'){_0x14ca33=_0x14ca33[_0x0275('0x74')](0x0,_0x14ca33['lastIndexOf'](_0x569182));}if(!_0x236039[_0x0275('0x68')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x236039);})['then'](function(_0x9ace21){if(_0x9ace21){return rp({'method':'GET','uri':util[_0x0275('0x75')](_0x0275('0x76'),_0x52e15b),'qs':{'module':'Calls'},'headers':{'Authorization':_0x0275('0x77')+_0x9ace21},'json':!![]});}})[_0x0275('0x31')](function(_0x3da68a){if(_0x3da68a){if(_0x3da68a['response']&&_0x3da68a[_0x0275('0x78')]['error']){throw new Error(_0x3da68a[_0x0275('0x78')][_0x0275('0x20')][_0x0275('0x22')]);}var _0x4b8210=[];var _0xe71d5c=[];var _0x2a367d=[_0x0275('0x79'),_0x0275('0x7a'),_0x0275('0x7b'),_0x0275('0x7c'),'Call_Duration',_0x0275('0x7d'),_0x0275('0x7e'),_0x0275('0x7f')];_0xe71d5c=_['remove'](_0x3da68a[_0x0275('0x42')],function(_0x7e45fd){return _0x2a367d[_0x0275('0x80')](_0x7e45fd['api_name']);});for(var _0x7f2cd6=0x0;_0x7f2cd6<_0xe71d5c[_0x0275('0x43')];_0x7f2cd6++){if(_0xe71d5c[_0x7f2cd6][_0x0275('0x81')]===![]){_0x4b8210['push']({'id':_0xe71d5c[_0x7f2cd6]['id'],'name':_0xe71d5c[_0x7f2cd6][_0x0275('0x82')],'custom':_0xe71d5c[_0x7f2cd6][_0x0275('0x83')],'options':_0xe71d5c[_0x7f2cd6][_0x0275('0x84')]===_0x0275('0x85')&&_0xe71d5c[_0x7f2cd6][_0x0275('0x86')][_0x0275('0x43')]>-0x1?_[_0x0275('0x3c')](_0xe71d5c[_0x7f2cd6]['pick_list_values'],function(_0x5cfe9f){return{'name':_0x5cfe9f,'value':_0x5cfe9f};}):[]});}}return{'count':_0x4b8210[_0x0275('0x43')],'rows':_0x4b8210};}else{return{'count':0x0,'rows':[]};}})[_0x0275('0x31')](respondWithResult(_0x5c1c96,null))[_0x0275('0x24')](function(_0x370b06){var _0x65bf84=_0x60d12f[_0x0275('0x3d')][_0x0275('0x87')]?0x1f4:_0x370b06['statusCode']||0x1f4;logger[_0x0275('0x20')](_0x0275('0x88'),'getFields',_0x65bf84,JSON[_0x0275('0x89')](_0x370b06));delete _0x370b06['name'];if(_0x65bf84===0x191){_0x65bf84=0x190;}_0x5c1c96[_0x0275('0x27')](_0x65bf84)[_0x0275('0x34')](_0x60d12f[_0x0275('0x3d')][_0x0275('0x87')]?{'message':_0x0275('0x8a'),'statusCode':_0x370b06[_0x0275('0x8b')]}:_0x370b06);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 8a860a5..056332b 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 _0x3dd0=['refresh_token','format','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','application/x-www-form-urlencoded','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','parse','refreshToken'];(function(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0x3dd0,0xb6));var _0x03dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3dd0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x03dd('0x0'));var logger=require(_0x03dd('0x1'))(_0x03dd('0x2'));var moment=require(_0x03dd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x03dd('0x4'));var rimraf=require(_0x03dd('0x5'));var config=require(_0x03dd('0x6'));var attributes=require(_0x03dd('0x7'));var integrations=require(_0x03dd('0x8'));module[_0x03dd('0x9')]=function(_0x5f51ec,_0x35f27b){return _0x5f51ec['define'](_0x03dd('0xa'),attributes,{'tableName':_0x03dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2ac8bf,_0x2244c5,_0x50f2a1){if(_0x2ac8bf[_0x03dd('0xc')](_0x03dd('0xd'))||_0x2ac8bf[_0x03dd('0xc')](_0x03dd('0xe'))||_0x2ac8bf[_0x03dd('0xc')](_0x03dd('0xf'))||_0x2ac8bf['changed'](_0x03dd('0x10'))||_0x2ac8bf[_0x03dd('0xc')](_0x03dd('0x11'))||_0x2ac8bf[_0x03dd('0xc')](_0x03dd('0x12'))){var _0x51d3de,_0x5bb7a5;_0x51d3de=_0x2ac8bf[_0x03dd('0xe')];var _0x22e61f=_0x51d3de[_0x03dd('0x13')](-0x1);if(_0x22e61f==='/'||_0x22e61f==='\x5c'||_0x22e61f===':'){_0x51d3de=_0x51d3de[_0x03dd('0x14')](0x0,_0x51d3de[_0x03dd('0x15')](_0x22e61f));}switch(_0x2ac8bf[_0x03dd('0xd')]){case'US':_0x5bb7a5=_0x03dd('0x16');break;case'AU':_0x5bb7a5=_0x03dd('0x17');break;case'IN':_0x5bb7a5=_0x03dd('0x18');break;case'CN':_0x5bb7a5=_0x03dd('0x19');break;default:_0x5bb7a5=_0x03dd('0x1a');break;}var _0x1cef35={'method':_0x03dd('0x1b'),'uri':_0x5bb7a5+_0x03dd('0x1c'),'form':{'grant_type':_0x03dd('0x1d'),'client_id':_0x2ac8bf[_0x03dd('0xf')],'client_secret':_0x2ac8bf['clientSecret'],'redirect_uri':_0x2ac8bf[_0x03dd('0xe')],'code':_0x2ac8bf[_0x03dd('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1cef35)[_0x03dd('0x1e')](function(_0x7bdb7e){var _0x5f5a42=JSON[_0x03dd('0x1f')](_0x7bdb7e);if(_0x5f5a42['refresh_token']){_0x2ac8bf[_0x03dd('0x20')]=_0x5f5a42[_0x03dd('0x21')];logger['info'](util[_0x03dd('0x22')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2ac8bf['name'],_0x2ac8bf['id']));}else{logger[_0x03dd('0x23')](util[_0x03dd('0x22')](_0x03dd('0x24'),_0x2ac8bf[_0x03dd('0x25')],_0x2ac8bf['id']),util[_0x03dd('0x26')](_0x5f5a42,{'showHidden':![],'depth':null}));}return _0x50f2a1(null,_0x2244c5);})[_0x03dd('0x27')](function(_0x5f0d2b){logger[_0x03dd('0x23')](util['format'](_0x03dd('0x24'),_0x2ac8bf[_0x03dd('0x25')],_0x2ac8bf['id']),util[_0x03dd('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x50f2a1(_0x5f0d2b);});}else{return _0x50f2a1(null,_0x2244c5);}},'beforeUpdate':function(_0x12a714,_0x55763b,_0x1f1039){if(_0x12a714[_0x03dd('0xc')](_0x03dd('0xd'))||_0x12a714['changed'](_0x03dd('0xe'))||_0x12a714[_0x03dd('0xc')](_0x03dd('0xf'))||_0x12a714[_0x03dd('0xc')](_0x03dd('0x10'))||_0x12a714[_0x03dd('0xc')](_0x03dd('0x11'))||_0x12a714[_0x03dd('0xc')](_0x03dd('0x12'))){var _0xc487a3,_0x318bdb;_0xc487a3=_0x12a714[_0x03dd('0xe')];var _0x1f2ead=_0xc487a3[_0x03dd('0x13')](-0x1);if(_0x1f2ead==='/'||_0x1f2ead==='\x5c'||_0x1f2ead===':'){_0xc487a3=_0xc487a3[_0x03dd('0x14')](0x0,_0xc487a3['lastIndexOf'](_0x1f2ead));}switch(_0x12a714[_0x03dd('0xd')]){case'US':_0x318bdb=_0x03dd('0x16');break;case'AU':_0x318bdb=_0x03dd('0x17');break;case'IN':_0x318bdb=_0x03dd('0x18');break;case'CN':_0x318bdb=_0x03dd('0x19');break;default:_0x318bdb=_0x03dd('0x1a');break;}var _0x47334d={'method':'POST','uri':_0x318bdb+_0x03dd('0x1c'),'form':{'grant_type':_0x03dd('0x1d'),'client_id':_0x12a714[_0x03dd('0xf')],'client_secret':_0x12a714[_0x03dd('0x10')],'redirect_uri':_0x12a714[_0x03dd('0xe')],'code':_0x12a714[_0x03dd('0x11')]},'headers':{'Content-Type':_0x03dd('0x28')}};return rp(_0x47334d)[_0x03dd('0x1e')](function(_0x7fcd08){var _0x426cc1=JSON['parse'](_0x7fcd08);if(_0x426cc1['refresh_token']){_0x12a714[_0x03dd('0x20')]=_0x426cc1[_0x03dd('0x21')];logger[_0x03dd('0x29')](util[_0x03dd('0x22')](_0x03dd('0x2a'),_0x12a714['name'],_0x12a714['id']));}else{logger[_0x03dd('0x23')](util[_0x03dd('0x22')](_0x03dd('0x24'),_0x12a714[_0x03dd('0x25')],_0x12a714['id']),util[_0x03dd('0x26')](_0x426cc1,{'showHidden':![],'depth':null}));}return _0x1f1039(null,_0x55763b);})[_0x03dd('0x27')](function(_0x4982d8){logger[_0x03dd('0x23')](util['format'](_0x03dd('0x24'),_0x12a714[_0x03dd('0x25')],_0x12a714['id']),util[_0x03dd('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x1f1039(_0x4982d8);});}else{return _0x1f1039(null,_0x55763b);}}}});}; \ No newline at end of file +var _0x0b84=['format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','application/x-www-form-urlencoded','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','clientId','clientSecret','code','host','serverUrl','slice','substring','zone','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','then','parse','refresh_token','refreshToken','info'];(function(_0x500382,_0xacea4d){var _0x181397=function(_0x36fd70){while(--_0x36fd70){_0x500382['push'](_0x500382['shift']());}};_0x181397(++_0xacea4d);}(_0x0b84,0x1ba));var _0x40b8=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x0b84[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require('lodash');var util=require(_0x40b8('0x0'));var logger=require(_0x40b8('0x1'))(_0x40b8('0x2'));var moment=require(_0x40b8('0x3'));var BPromise=require(_0x40b8('0x4'));var rp=require(_0x40b8('0x5'));var fs=require('fs');var path=require(_0x40b8('0x6'));var rimraf=require(_0x40b8('0x7'));var config=require('../../config/environment');var attributes=require(_0x40b8('0x8'));var integrations=require(_0x40b8('0x9'));module[_0x40b8('0xa')]=function(_0x487494,_0x1fb47a){return _0x487494[_0x40b8('0xb')](_0x40b8('0xc'),attributes,{'tableName':_0x40b8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x113be1,_0x5a6685,_0x3dfa18){if(_0x113be1[_0x40b8('0xe')]('zone')||_0x113be1['changed']('serverUrl')||_0x113be1[_0x40b8('0xe')](_0x40b8('0xf'))||_0x113be1[_0x40b8('0xe')](_0x40b8('0x10'))||_0x113be1['changed'](_0x40b8('0x11'))||_0x113be1[_0x40b8('0xe')](_0x40b8('0x12'))){var _0x233d6b,_0x39f747;_0x233d6b=_0x113be1[_0x40b8('0x13')];var _0x310526=_0x233d6b[_0x40b8('0x14')](-0x1);if(_0x310526==='/'||_0x310526==='\x5c'||_0x310526===':'){_0x233d6b=_0x233d6b[_0x40b8('0x15')](0x0,_0x233d6b['lastIndexOf'](_0x310526));}switch(_0x113be1[_0x40b8('0x16')]){case'US':_0x39f747='https://accounts.zoho.com';break;case'AU':_0x39f747='https://accounts.zoho.com.au';break;case'IN':_0x39f747='https://accounts.zoho.in';break;case'CN':_0x39f747=_0x40b8('0x17');break;default:_0x39f747=_0x40b8('0x18');break;}var _0x3fee5d={'method':'POST','uri':_0x39f747+_0x40b8('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x113be1[_0x40b8('0xf')],'client_secret':_0x113be1[_0x40b8('0x10')],'redirect_uri':_0x113be1['serverUrl'],'code':_0x113be1[_0x40b8('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3fee5d)[_0x40b8('0x1a')](function(_0xd1792f){var _0x2c8a9e=JSON[_0x40b8('0x1b')](_0xd1792f);if(_0x2c8a9e[_0x40b8('0x1c')]){_0x113be1[_0x40b8('0x1d')]=_0x2c8a9e[_0x40b8('0x1c')];logger[_0x40b8('0x1e')](util[_0x40b8('0x1f')](_0x40b8('0x20'),_0x113be1['name'],_0x113be1['id']));}else{logger[_0x40b8('0x21')](util['format'](_0x40b8('0x22'),_0x113be1[_0x40b8('0x23')],_0x113be1['id']),util[_0x40b8('0x24')](_0x2c8a9e,{'showHidden':![],'depth':null}));}return _0x3dfa18(null,_0x5a6685);})[_0x40b8('0x25')](function(_0x45d137){logger[_0x40b8('0x21')](util[_0x40b8('0x1f')](_0x40b8('0x22'),_0x113be1['name'],_0x113be1['id']),util[_0x40b8('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x3dfa18(_0x45d137);});}else{return _0x3dfa18(null,_0x5a6685);}},'beforeUpdate':function(_0x3a35de,_0x18f952,_0x22adc5){if(_0x3a35de[_0x40b8('0xe')]('zone')||_0x3a35de[_0x40b8('0xe')](_0x40b8('0x13'))||_0x3a35de[_0x40b8('0xe')]('clientId')||_0x3a35de['changed'](_0x40b8('0x10'))||_0x3a35de[_0x40b8('0xe')](_0x40b8('0x11'))||_0x3a35de[_0x40b8('0xe')](_0x40b8('0x12'))){var _0x146aca,_0x2ff3ab;_0x146aca=_0x3a35de[_0x40b8('0x13')];var _0x4f7bc4=_0x146aca[_0x40b8('0x14')](-0x1);if(_0x4f7bc4==='/'||_0x4f7bc4==='\x5c'||_0x4f7bc4===':'){_0x146aca=_0x146aca['substring'](0x0,_0x146aca[_0x40b8('0x26')](_0x4f7bc4));}switch(_0x3a35de[_0x40b8('0x16')]){case'US':_0x2ff3ab='https://accounts.zoho.com';break;case'AU':_0x2ff3ab=_0x40b8('0x27');break;case'IN':_0x2ff3ab=_0x40b8('0x28');break;case'CN':_0x2ff3ab='https://accounts.zoho.com.cn';break;default:_0x2ff3ab=_0x40b8('0x18');break;}var _0x4b2a88={'method':_0x40b8('0x29'),'uri':_0x2ff3ab+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x3a35de[_0x40b8('0xf')],'client_secret':_0x3a35de[_0x40b8('0x10')],'redirect_uri':_0x3a35de['serverUrl'],'code':_0x3a35de[_0x40b8('0x11')]},'headers':{'Content-Type':_0x40b8('0x2a')}};return rp(_0x4b2a88)[_0x40b8('0x1a')](function(_0x3cfaae){var _0xa0905b=JSON['parse'](_0x3cfaae);if(_0xa0905b['refresh_token']){_0x3a35de[_0x40b8('0x1d')]=_0xa0905b[_0x40b8('0x1c')];logger[_0x40b8('0x1e')](util[_0x40b8('0x1f')](_0x40b8('0x20'),_0x3a35de['name'],_0x3a35de['id']));}else{logger[_0x40b8('0x21')](util[_0x40b8('0x1f')](_0x40b8('0x22'),_0x3a35de[_0x40b8('0x23')],_0x3a35de['id']),util[_0x40b8('0x24')](_0xa0905b,{'showHidden':![],'depth':null}));}return _0x22adc5(null,_0x18f952);})[_0x40b8('0x25')](function(_0xd0b8c8){logger[_0x40b8('0x21')](util[_0x40b8('0x1f')](_0x40b8('0x22'),_0x3a35de[_0x40b8('0x23')],_0x3a35de['id']),util[_0x40b8('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x22adc5(_0xd0b8c8);});}else{return _0x22adc5(null,_0x18f952);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2b70837..bc5ae17 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 _0x81d4=['client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','map','include','model','debug','GetZohoAccount','ShowZohoAccount','ZohoAccount','find','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x81d4,0xa7));var _0x481d=function(_0x1bada5,_0x5e12e7){_0x1bada5=_0x1bada5-0x0;var _0x278a1d=_0x81d4[_0x1bada5];return _0x278a1d;};'use strict';var _=require(_0x481d('0x0'));var util=require(_0x481d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x481d('0x2'));var fs=require('fs');var Redis=require(_0x481d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x481d('0x4'))(_0x481d('0x5'));var config=require(_0x481d('0x6'));var jayson=require(_0x481d('0x7'));var client=jayson[_0x481d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51c85c,_0x288c6d,_0x116f2f){return new BPromise(function(_0x15a9d2,_0x21980b){return client[_0x481d('0x9')](_0x51c85c,_0x116f2f)[_0x481d('0xa')](function(_0x45ba7f){logger[_0x481d('0xb')](_0x481d('0xc'),_0x288c6d,_0x481d('0xd'));logger['debug'](_0x481d('0xe'),_0x288c6d,_0x481d('0xd'),JSON[_0x481d('0xf')](_0x45ba7f));if(_0x45ba7f['error']){if(_0x45ba7f[_0x481d('0x10')][_0x481d('0x11')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x288c6d,_0x45ba7f[_0x481d('0x10')]['message']);return _0x21980b(_0x45ba7f[_0x481d('0x10')]['message']);}logger[_0x481d('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x288c6d,_0x45ba7f['error'][_0x481d('0x12')]);return _0x15a9d2(_0x45ba7f[_0x481d('0x10')][_0x481d('0x12')]);}else{logger['info'](_0x481d('0xc'),_0x288c6d,_0x481d('0xd'));_0x15a9d2(_0x45ba7f[_0x481d('0x13')][_0x481d('0x12')]);}})[_0x481d('0x14')](function(_0x2aa4dc){logger[_0x481d('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x288c6d,_0x2aa4dc);_0x21980b(_0x2aa4dc);});});}exports['GetZohoAccount']=function(_0x41db0a){var _0x7550a1=this;return new Promise(function(_0x1c4073,_0x1829b7){return db['ZohoAccount'][_0x481d('0x15')]({'raw':_0x41db0a[_0x481d('0x16')]?_0x41db0a[_0x481d('0x16')][_0x481d('0x17')]===undefined?!![]:![]:!![],'where':_0x41db0a['options']?_0x41db0a['options'][_0x481d('0x18')]||null:null,'attributes':_0x41db0a['options']?_0x41db0a[_0x481d('0x16')][_0x481d('0x19')]||null:null,'limit':_0x41db0a[_0x481d('0x16')]?_0x41db0a[_0x481d('0x16')][_0x481d('0x1a')]||null:null,'include':_0x41db0a[_0x481d('0x16')]?_0x41db0a[_0x481d('0x16')]['include']?_['map'](_0x41db0a[_0x481d('0x16')]['include'],function(_0x5f511d){return{'model':db[_0x5f511d['model']],'as':_0x5f511d['as'],'attributes':_0x5f511d[_0x481d('0x19')],'include':_0x5f511d['include']?_[_0x481d('0x1b')](_0x5f511d[_0x481d('0x1c')],function(_0x543484){return{'model':db[_0x543484[_0x481d('0x1d')]],'as':_0x543484['as'],'attributes':_0x543484[_0x481d('0x19')],'include':_0x543484['include']?_[_0x481d('0x1b')](_0x543484[_0x481d('0x1c')],function(_0x3d1cab){return{'model':db[_0x3d1cab['model']],'as':_0x3d1cab['as'],'attributes':_0x3d1cab[_0x481d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x481d('0xa')](function(_0x635c16){logger['info']('GetZohoAccount',_0x41db0a);logger[_0x481d('0x1e')](_0x481d('0x1f'),_0x41db0a,JSON[_0x481d('0xf')](_0x635c16));_0x1c4073(_0x635c16);})[_0x481d('0x14')](function(_0x171f1d){logger[_0x481d('0x10')]('GetZohoAccount',_0x171f1d[_0x481d('0x12')],_0x41db0a);_0x1829b7(_0x7550a1[_0x481d('0x10')](0x1f4,_0x171f1d[_0x481d('0x12')]));});});};exports[_0x481d('0x20')]=function(_0x5a8374){var _0x2fcf72=this;return new Promise(function(_0x26cfe9,_0x557ddb){return db[_0x481d('0x21')][_0x481d('0x22')]({'raw':_0x5a8374['options']?_0x5a8374[_0x481d('0x16')][_0x481d('0x17')]===undefined?!![]:![]:!![],'where':_0x5a8374[_0x481d('0x16')]?_0x5a8374[_0x481d('0x16')][_0x481d('0x18')]||null:null,'attributes':_0x5a8374['options']?_0x5a8374[_0x481d('0x16')][_0x481d('0x19')]||null:null,'include':_0x5a8374[_0x481d('0x16')]?_0x5a8374[_0x481d('0x16')]['include']?_['map'](_0x5a8374[_0x481d('0x16')]['include'],function(_0x3cf288){return{'model':db[_0x3cf288[_0x481d('0x1d')]],'as':_0x3cf288['as'],'attributes':_0x3cf288['attributes'],'include':_0x3cf288[_0x481d('0x1c')]?_[_0x481d('0x1b')](_0x3cf288[_0x481d('0x1c')],function(_0x3aa4ef){return{'model':db[_0x3aa4ef['model']],'as':_0x3aa4ef['as'],'attributes':_0x3aa4ef[_0x481d('0x19')],'include':_0x3aa4ef[_0x481d('0x1c')]?_[_0x481d('0x1b')](_0x3aa4ef[_0x481d('0x1c')],function(_0x12ad6e){return{'model':db[_0x12ad6e[_0x481d('0x1d')]],'as':_0x12ad6e['as'],'attributes':_0x12ad6e[_0x481d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x481d('0xa')](function(_0x56f5b4){logger['info'](_0x481d('0x20'),_0x5a8374);logger[_0x481d('0x1e')](_0x481d('0x20'),_0x5a8374,JSON[_0x481d('0xf')](_0x56f5b4));_0x26cfe9(_0x56f5b4);})[_0x481d('0x14')](function(_0x5b0a8a){logger[_0x481d('0x10')](_0x481d('0x20'),_0x5b0a8a[_0x481d('0x12')],_0x5a8374);_0x557ddb(_0x2fcf72[_0x481d('0x10')](0x1f4,_0x5b0a8a[_0x481d('0x12')]));});});}; \ No newline at end of file +var _0xefd8=['options','raw','attributes','limit','include','map','model','ShowZohoAccount','ZohoAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','findAll'];(function(_0x41a1c0,_0x3040e1){var _0x17d1d7=function(_0x210c50){while(--_0x210c50){_0x41a1c0['push'](_0x41a1c0['shift']());}};_0x17d1d7(++_0x3040e1);}(_0xefd8,0x1d3));var _0x8efd=function(_0x5e4a61,_0x403c59){_0x5e4a61=_0x5e4a61-0x0;var _0x1374aa=_0xefd8[_0x5e4a61];return _0x1374aa;};'use strict';var _=require(_0x8efd('0x0'));var util=require(_0x8efd('0x1'));var moment=require(_0x8efd('0x2'));var BPromise=require(_0x8efd('0x3'));var rs=require(_0x8efd('0x4'));var fs=require('fs');var Redis=require(_0x8efd('0x5'));var db=require(_0x8efd('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8efd('0x7'));var config=require(_0x8efd('0x8'));var jayson=require(_0x8efd('0x9'));var client=jayson[_0x8efd('0xa')][_0x8efd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15c022,_0x444658,_0x22544a){return new BPromise(function(_0x3ec9a0,_0x27ca31){return client[_0x8efd('0xc')](_0x15c022,_0x22544a)[_0x8efd('0xd')](function(_0x2dbd5a){logger[_0x8efd('0xe')](_0x8efd('0xf'),_0x444658,_0x8efd('0x10'));logger[_0x8efd('0x11')](_0x8efd('0x12'),_0x444658,'request\x20sent',JSON[_0x8efd('0x13')](_0x2dbd5a));if(_0x2dbd5a['error']){if(_0x2dbd5a[_0x8efd('0x14')][_0x8efd('0x15')]===0x1f4){logger[_0x8efd('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x444658,_0x2dbd5a[_0x8efd('0x14')][_0x8efd('0x16')]);return _0x27ca31(_0x2dbd5a[_0x8efd('0x14')][_0x8efd('0x16')]);}logger[_0x8efd('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x444658,_0x2dbd5a['error'][_0x8efd('0x16')]);return _0x3ec9a0(_0x2dbd5a[_0x8efd('0x14')][_0x8efd('0x16')]);}else{logger[_0x8efd('0xe')](_0x8efd('0xf'),_0x444658,_0x8efd('0x10'));_0x3ec9a0(_0x2dbd5a[_0x8efd('0x17')][_0x8efd('0x16')]);}})[_0x8efd('0x18')](function(_0x37f438){logger[_0x8efd('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x444658,_0x37f438);_0x27ca31(_0x37f438);});});}exports[_0x8efd('0x19')]=function(_0x21c794){var _0x2674a5=this;return new Promise(function(_0x52104a,_0x3d22d5){return db['ZohoAccount'][_0x8efd('0x1a')]({'raw':_0x21c794['options']?_0x21c794[_0x8efd('0x1b')][_0x8efd('0x1c')]===undefined?!![]:![]:!![],'where':_0x21c794[_0x8efd('0x1b')]?_0x21c794[_0x8efd('0x1b')]['where']||null:null,'attributes':_0x21c794[_0x8efd('0x1b')]?_0x21c794[_0x8efd('0x1b')][_0x8efd('0x1d')]||null:null,'limit':_0x21c794['options']?_0x21c794[_0x8efd('0x1b')][_0x8efd('0x1e')]||null:null,'include':_0x21c794['options']?_0x21c794[_0x8efd('0x1b')][_0x8efd('0x1f')]?_[_0x8efd('0x20')](_0x21c794['options'][_0x8efd('0x1f')],function(_0x512607){return{'model':db[_0x512607[_0x8efd('0x21')]],'as':_0x512607['as'],'attributes':_0x512607[_0x8efd('0x1d')],'include':_0x512607[_0x8efd('0x1f')]?_[_0x8efd('0x20')](_0x512607[_0x8efd('0x1f')],function(_0x3385da){return{'model':db[_0x3385da[_0x8efd('0x21')]],'as':_0x3385da['as'],'attributes':_0x3385da[_0x8efd('0x1d')],'include':_0x3385da[_0x8efd('0x1f')]?_[_0x8efd('0x20')](_0x3385da[_0x8efd('0x1f')],function(_0x53dc1e){return{'model':db[_0x53dc1e[_0x8efd('0x21')]],'as':_0x53dc1e['as'],'attributes':_0x53dc1e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x583e67){logger[_0x8efd('0xe')]('GetZohoAccount',_0x21c794);logger['debug']('GetZohoAccount',_0x21c794,JSON['stringify'](_0x583e67));_0x52104a(_0x583e67);})['catch'](function(_0x36a6cd){logger[_0x8efd('0x14')](_0x8efd('0x19'),_0x36a6cd[_0x8efd('0x16')],_0x21c794);_0x3d22d5(_0x2674a5[_0x8efd('0x14')](0x1f4,_0x36a6cd[_0x8efd('0x16')]));});});};exports[_0x8efd('0x22')]=function(_0x11285d){var _0x376a89=this;return new Promise(function(_0x5b69a8,_0x571af8){return db[_0x8efd('0x23')][_0x8efd('0x24')]({'raw':_0x11285d[_0x8efd('0x1b')]?_0x11285d[_0x8efd('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x11285d[_0x8efd('0x1b')]?_0x11285d['options'][_0x8efd('0x25')]||null:null,'attributes':_0x11285d['options']?_0x11285d[_0x8efd('0x1b')][_0x8efd('0x1d')]||null:null,'include':_0x11285d['options']?_0x11285d[_0x8efd('0x1b')][_0x8efd('0x1f')]?_[_0x8efd('0x20')](_0x11285d[_0x8efd('0x1b')][_0x8efd('0x1f')],function(_0x1b12bd){return{'model':db[_0x1b12bd[_0x8efd('0x21')]],'as':_0x1b12bd['as'],'attributes':_0x1b12bd[_0x8efd('0x1d')],'include':_0x1b12bd[_0x8efd('0x1f')]?_['map'](_0x1b12bd[_0x8efd('0x1f')],function(_0x50b002){return{'model':db[_0x50b002[_0x8efd('0x21')]],'as':_0x50b002['as'],'attributes':_0x50b002['attributes'],'include':_0x50b002[_0x8efd('0x1f')]?_[_0x8efd('0x20')](_0x50b002[_0x8efd('0x1f')],function(_0x406965){return{'model':db[_0x406965[_0x8efd('0x21')]],'as':_0x406965['as'],'attributes':_0x406965[_0x8efd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8efd('0xd')](function(_0x232191){logger[_0x8efd('0xe')](_0x8efd('0x22'),_0x11285d);logger[_0x8efd('0x11')]('ShowZohoAccount',_0x11285d,JSON['stringify'](_0x232191));_0x5b69a8(_0x232191);})[_0x8efd('0x18')](function(_0xd60c30){logger[_0x8efd('0x14')](_0x8efd('0x22'),_0xd60c30[_0x8efd('0x16')],_0x11285d);_0x571af8(_0x376a89[_0x8efd('0x14')](0x1f4,_0xd60c30[_0x8efd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 4512211..699efd6 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 _0x17a6=['/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x17a6,0xc2));var _0x617a=function(_0x2d77d6,_0x3d9270){_0x2d77d6=_0x2d77d6-0x0;var _0x408fc1=_0x17a6[_0x2d77d6];return _0x408fc1;};'use strict';var multer=require(_0x617a('0x0'));var util=require(_0x617a('0x1'));var path=require(_0x617a('0x2'));var timeout=require(_0x617a('0x3'));var express=require('express');var router=express[_0x617a('0x4')]();var fs_extra=require(_0x617a('0x5'));var auth=require(_0x617a('0x6'));var interaction=require(_0x617a('0x7'));var config=require(_0x617a('0x8'));var controller=require(_0x617a('0x9'));router[_0x617a('0xa')]('/',auth[_0x617a('0xb')](),controller[_0x617a('0xc')]);router[_0x617a('0xa')](_0x617a('0xd'),auth[_0x617a('0xb')](),controller['show']);router[_0x617a('0xa')](_0x617a('0xe'),auth['isAuthenticated'](),controller[_0x617a('0xf')]);router['get']('/:id/subjects',auth[_0x617a('0xb')](),controller[_0x617a('0x10')]);router[_0x617a('0xa')](_0x617a('0x11'),auth[_0x617a('0xb')](),controller[_0x617a('0x12')]);router[_0x617a('0x13')]('/',auth[_0x617a('0xb')](),controller['create']);router[_0x617a('0x14')](_0x617a('0xd'),auth[_0x617a('0xb')](),controller['update']);router[_0x617a('0x15')]('/:id',auth[_0x617a('0xb')](),controller[_0x617a('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf1fc=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','exports','util'];(function(_0x24e2dc,_0x384610){var _0x377fac=function(_0x3af823){while(--_0x3af823){_0x24e2dc['push'](_0x24e2dc['shift']());}};_0x377fac(++_0x384610);}(_0xf1fc,0x103));var _0xcf1f=function(_0x148b9b,_0x3f7aff){_0x148b9b=_0x148b9b-0x0;var _0x3b3023=_0xf1fc[_0x148b9b];return _0x3b3023;};'use strict';var multer=require('multer');var util=require(_0xcf1f('0x0'));var path=require(_0xcf1f('0x1'));var timeout=require(_0xcf1f('0x2'));var express=require(_0xcf1f('0x3'));var router=express['Router']();var fs_extra=require(_0xcf1f('0x4'));var auth=require(_0xcf1f('0x5'));var interaction=require(_0xcf1f('0x6'));var config=require(_0xcf1f('0x7'));var controller=require(_0xcf1f('0x8'));router[_0xcf1f('0x9')]('/',auth[_0xcf1f('0xa')](),controller[_0xcf1f('0xb')]);router[_0xcf1f('0x9')](_0xcf1f('0xc'),auth[_0xcf1f('0xa')](),controller['show']);router[_0xcf1f('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xcf1f('0xd')]);router['get']('/:id/subjects',auth[_0xcf1f('0xa')](),controller[_0xcf1f('0xe')]);router['get'](_0xcf1f('0xf'),auth[_0xcf1f('0xa')](),controller[_0xcf1f('0x10')]);router[_0xcf1f('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcf1f('0x12')](_0xcf1f('0xc'),auth[_0xcf1f('0xa')](),controller['update']);router['delete'](_0xcf1f('0xc'),auth[_0xcf1f('0xa')](),controller['destroy']);module[_0xcf1f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 0ff0c63..b6fd583 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 _0xce55=['ENUM','nothing','lead','contact_lead','STRING','sequelize'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xce55,0x77));var _0x5ce5=function(_0x5b71cb,_0x5d3de5){_0x5b71cb=_0x5b71cb-0x0;var _0x7b0184=_0xce55[_0x5b71cb];return _0x7b0184;};'use strict';var Sequelize=require(_0x5ce5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x5ce5('0x1')]('lead','contact',_0x5ce5('0x2')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x5ce5('0x1')]('contact_lead','contact',_0x5ce5('0x3')),'defaultValue':_0x5ce5('0x4')},'description':{'type':Sequelize[_0x5ce5('0x5')]}}; \ No newline at end of file +var _0x2750=['sequelize','exports','ENUM','lead','nothing','contact_lead','contact'];(function(_0x324ce6,_0x344395){var _0x345581=function(_0x2c3de1){while(--_0x2c3de1){_0x324ce6['push'](_0x324ce6['shift']());}};_0x345581(++_0x344395);}(_0x2750,0xd9));var _0x0275=function(_0x39d9c5,_0x3f07d2){_0x39d9c5=_0x39d9c5-0x0;var _0x1e7eb3=_0x2750[_0x39d9c5];return _0x1e7eb3;};'use strict';var Sequelize=require(_0x0275('0x0'));module[_0x0275('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x0275('0x2')](_0x0275('0x3'),'contact',_0x0275('0x4')),'defaultValue':_0x0275('0x3')},'moduleSearch':{'type':Sequelize[_0x0275('0x2')](_0x0275('0x5'),_0x0275('0x6'),_0x0275('0x3')),'defaultValue':_0x0275('0x5')},'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 f4d65e4..6e4f364 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 _0x8d0e=['getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','reject','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','VIRTUAL','merge','options','ZohoConfiguration','includeAll','include','findAll','rows','show','params','keys','create','body','find','getFields','ZohoField','hasOwnProperty','nolimit','limit','getSubjects','findOne'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5cd10b,_0x3fb0ef){_0x5cd10b=_0x5cd10b-0x0;var _0x22c62f=_0x8d0e[_0x5cd10b];return _0x22c62f;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8d0('0x1b')][_0xe8d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x533b42,_0x2b640d,_0x4cbd26,_0x59b4b7){return new BPromise(function(_0x90a1ea,_0x2aa906){var _0x1aa725=_0x59b4b7||client;return _0x1aa725[_0xe8d0('0x1d')](_0x533b42,_0x4cbd26)[_0xe8d0('0x1e')](function(_0x7151c6){logger['info'](_0xe8d0('0x1f'),_0x2b640d,'request\x20sent');logger[_0xe8d0('0x20')](_0xe8d0('0x21'),_0x2b640d,_0xe8d0('0x22'),JSON['stringify'](_0x7151c6));if(_0x7151c6['error']){if(_0x7151c6['error'][_0xe8d0('0x23')]===0x1f4){logger[_0xe8d0('0x24')](_0xe8d0('0x1f'),_0x2b640d,_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);return _0x2aa906(_0x7151c6['error'][_0xe8d0('0x25')]);}logger[_0xe8d0('0x24')]('ZohoConfiguration,\x20%s,\x20%s',_0x2b640d,_0x7151c6['error']['message']);return _0x90a1ea(_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);}else{logger[_0xe8d0('0x26')](_0xe8d0('0x1f'),_0x2b640d,_0xe8d0('0x22'));_0x90a1ea(_0x7151c6[_0xe8d0('0x27')][_0xe8d0('0x25')]);}})[_0xe8d0('0x28')](function(_0x32e39a){logger['error'](_0xe8d0('0x1f'),_0x2b640d,_0x32e39a);_0x2aa906(_0x32e39a);});});}function respondWithStatusCode(_0x9f747,_0x572c25){_0x572c25=_0x572c25||0xcc;return function(_0x106614){if(_0x106614){return _0x9f747[_0xe8d0('0x29')](_0x572c25);}return _0x9f747[_0xe8d0('0x2a')](_0x572c25)[_0xe8d0('0x2b')]();};}function respondWithResult(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0xc8;return function(_0x31519b){if(_0x31519b){return _0x146783[_0xe8d0('0x2a')](_0x149dfd)[_0xe8d0('0x2c')](_0x31519b);}};}function respondWithFilteredResult(_0x2dee67,_0x264de4){return function(_0x539548){if(_0x539548){var _0x24982c=typeof _0x264de4[_0xe8d0('0x2d')]===_0xe8d0('0x2e')&&typeof _0x264de4['limit']===_0xe8d0('0x2e');var _0x343b08=_0x539548['count'];var _0x1519e2=_0x24982c?0x0:_0x264de4[_0xe8d0('0x2d')];var _0x11fcf2=_0x24982c?_0x539548[_0xe8d0('0x2f')]:_0x264de4[_0xe8d0('0x2d')]+_0x264de4['limit'];var _0x3cc292;if(_0x11fcf2>=_0x343b08){_0x11fcf2=_0x343b08;_0x3cc292=0xc8;}else{_0x3cc292=0xce;}_0x2dee67['status'](_0x3cc292);return _0x2dee67['set']('Content-Range',_0x1519e2+'-'+_0x11fcf2+'/'+_0x343b08)[_0xe8d0('0x2c')](_0x539548);}return null;};}function patchUpdates(_0x13cd4c){return function(_0x36ccec){try{jsonpatch['apply'](_0x36ccec,_0x13cd4c,!![]);}catch(_0x57e375){return BPromise[_0xe8d0('0x30')](_0x57e375);}return _0x36ccec['save']();};}function saveUpdates(_0x3b5d31,_0x383084){return function(_0x327004){if(_0x327004){return _0x327004[_0xe8d0('0x31')](_0x3b5d31)[_0xe8d0('0x1e')](function(_0x5bbc9e){return _0x5bbc9e;});}return null;};}function removeEntity(_0x1bee61,_0x4db53c){return function(_0x402e90){if(_0x402e90){return _0x402e90[_0xe8d0('0x32')]()['then'](function(){_0x1bee61[_0xe8d0('0x2a')](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0x4c1347,_0x42c31f){return function(_0x51be84){if(!_0x51be84){_0x4c1347[_0xe8d0('0x29')](0x194);}return _0x51be84;};}function handleError(_0x5dc4ca,_0x197e01){_0x197e01=_0x197e01||0x1f4;return function(_0x531835){logger[_0xe8d0('0x24')](_0x531835[_0xe8d0('0x33')]);if(_0x531835[_0xe8d0('0x34')]){delete _0x531835[_0xe8d0('0x34')];}_0x5dc4ca['status'](_0x197e01)[_0xe8d0('0x35')](_0x531835);};}exports[_0xe8d0('0x36')]=function(_0x20eec5,_0x516243){var _0x2a66f8={},_0xa02b8d={},_0xdfc807={'count':0x0,'rows':[]};var _0x9cb99b=_[_0xe8d0('0x37')](db['ZohoConfiguration'][_0xe8d0('0x38')],function(_0x1828c5){return{'name':_0x1828c5[_0xe8d0('0x39')],'type':_0x1828c5[_0xe8d0('0x3a')][_0xe8d0('0x3b')]};});_0xa02b8d[_0xe8d0('0x3c')]=_[_0xe8d0('0x37')](_0x9cb99b,_0xe8d0('0x34'));_0xa02b8d['query']=_['keys'](_0x20eec5[_0xe8d0('0x3d')]);_0xa02b8d[_0xe8d0('0x3e')]=_[_0xe8d0('0x3f')](_0xa02b8d[_0xe8d0('0x3c')],_0xa02b8d[_0xe8d0('0x3d')]);_0x2a66f8['attributes']=_[_0xe8d0('0x3f')](_0xa02b8d['model'],qs[_0xe8d0('0x40')](_0x20eec5[_0xe8d0('0x3d')][_0xe8d0('0x40')]));_0x2a66f8['attributes']=_0x2a66f8[_0xe8d0('0x41')][_0xe8d0('0x42')]?_0x2a66f8[_0xe8d0('0x41')]:_0xa02b8d[_0xe8d0('0x3c')];if(!_0x20eec5[_0xe8d0('0x3d')]['hasOwnProperty']('nolimit')){_0x2a66f8['limit']=qs['limit'](_0x20eec5[_0xe8d0('0x3d')]['limit']);_0x2a66f8[_0xe8d0('0x2d')]=qs[_0xe8d0('0x2d')](_0x20eec5[_0xe8d0('0x3d')][_0xe8d0('0x2d')]);}_0x2a66f8[_0xe8d0('0x43')]=qs[_0xe8d0('0x44')](_0x20eec5[_0xe8d0('0x3d')][_0xe8d0('0x44')]);_0x2a66f8['where']=qs[_0xe8d0('0x3e')](_[_0xe8d0('0x45')](_0x20eec5['query'],_0xa02b8d['filters']),_0x9cb99b);if(_0x20eec5[_0xe8d0('0x3d')][_0xe8d0('0x46')]){_0x2a66f8[_0xe8d0('0x47')]=_['merge'](_0x2a66f8[_0xe8d0('0x47')],{'$or':_[_0xe8d0('0x37')](_0x9cb99b,function(_0x508140){if(_0x508140[_0xe8d0('0x3a')]!==_0xe8d0('0x48')){var _0x5370c9={};_0x5370c9[_0x508140[_0xe8d0('0x34')]]={'$like':'%'+_0x20eec5[_0xe8d0('0x3d')][_0xe8d0('0x46')]+'%'};return _0x5370c9;}})});}_0x2a66f8=_[_0xe8d0('0x49')]({},_0x2a66f8,_0x20eec5[_0xe8d0('0x4a')]);var _0x2a6760={'where':_0x2a66f8[_0xe8d0('0x47')]};return db[_0xe8d0('0x4b')]['count'](_0x2a6760)[_0xe8d0('0x1e')](function(_0x137722){_0xdfc807[_0xe8d0('0x2f')]=_0x137722;if(_0x20eec5[_0xe8d0('0x3d')][_0xe8d0('0x4c')]){_0x2a66f8[_0xe8d0('0x4d')]=[{'all':!![]}];}return db[_0xe8d0('0x4b')][_0xe8d0('0x4e')](_0x2a66f8);})[_0xe8d0('0x1e')](function(_0x2e2c05){_0xdfc807[_0xe8d0('0x4f')]=_0x2e2c05;return _0xdfc807;})[_0xe8d0('0x1e')](respondWithFilteredResult(_0x516243,_0x2a66f8))['catch'](handleError(_0x516243,null));};exports[_0xe8d0('0x50')]=function(_0x3ee019,_0x14b1ea){var _0xad7d94={'raw':![],'where':{'id':_0x3ee019[_0xe8d0('0x51')]['id']}},_0x34047c={};_0x34047c[_0xe8d0('0x3c')]=_['keys'](db[_0xe8d0('0x4b')][_0xe8d0('0x38')]);_0x34047c[_0xe8d0('0x3d')]=_[_0xe8d0('0x52')](_0x3ee019['query']);_0x34047c[_0xe8d0('0x3e')]=_['intersection'](_0x34047c[_0xe8d0('0x3c')],_0x34047c[_0xe8d0('0x3d')]);_0xad7d94[_0xe8d0('0x41')]=_[_0xe8d0('0x3f')](_0x34047c[_0xe8d0('0x3c')],qs[_0xe8d0('0x40')](_0x3ee019[_0xe8d0('0x3d')]['fields']));_0xad7d94[_0xe8d0('0x41')]=_0xad7d94['attributes']['length']?_0xad7d94[_0xe8d0('0x41')]:_0x34047c['model'];if(_0x3ee019[_0xe8d0('0x3d')]['includeAll']){_0xad7d94[_0xe8d0('0x4d')]=[{'all':!![]}];}_0xad7d94=_[_0xe8d0('0x49')]({},_0xad7d94,_0x3ee019[_0xe8d0('0x4a')]);return db[_0xe8d0('0x4b')]['find'](_0xad7d94)[_0xe8d0('0x1e')](handleEntityNotFound(_0x14b1ea,null))[_0xe8d0('0x1e')](respondWithResult(_0x14b1ea,null))[_0xe8d0('0x28')](handleError(_0x14b1ea,null));};exports[_0xe8d0('0x53')]=function(_0x18cc14,_0x57b77a){return db[_0xe8d0('0x4b')][_0xe8d0('0x53')](_0x18cc14[_0xe8d0('0x54')],{})['then'](respondWithResult(_0x57b77a,0xc9))[_0xe8d0('0x28')](handleError(_0x57b77a,null));};exports['update']=function(_0x56b4fa,_0x1bd329){if(_0x56b4fa[_0xe8d0('0x54')]['id']){delete _0x56b4fa['body']['id'];}return db[_0xe8d0('0x4b')][_0xe8d0('0x55')]({'where':{'id':_0x56b4fa['params']['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x1bd329,null))[_0xe8d0('0x1e')](saveUpdates(_0x56b4fa[_0xe8d0('0x54')],null))[_0xe8d0('0x1e')](respondWithResult(_0x1bd329,null))['catch'](handleError(_0x1bd329,null));};exports[_0xe8d0('0x32')]=function(_0x3737ca,_0x25e5ab){return db[_0xe8d0('0x4b')]['find']({'where':{'id':_0x3737ca[_0xe8d0('0x51')]['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x25e5ab,null))[_0xe8d0('0x1e')](removeEntity(_0x25e5ab,null))[_0xe8d0('0x28')](handleError(_0x25e5ab,null));};exports[_0xe8d0('0x56')]=function(_0x29667c,_0x595b24,_0x4fdca4){var _0x2bb54d={};var _0x5668db={};var _0x3cee4e;var _0x2c444f;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x29667c[_0xe8d0('0x51')]['id']}})['then'](handleEntityNotFound(_0x595b24,null))[_0xe8d0('0x1e')](function(_0x4c458a){if(_0x4c458a){_0x3cee4e=_0x4c458a;_0x5668db[_0xe8d0('0x3c')]=_[_0xe8d0('0x52')](db[_0xe8d0('0x57')]['rawAttributes']);_0x5668db[_0xe8d0('0x3d')]=_[_0xe8d0('0x52')](_0x29667c['query']);_0x5668db[_0xe8d0('0x3e')]=_['intersection'](_0x5668db[_0xe8d0('0x3c')],_0x5668db['query']);_0x2bb54d[_0xe8d0('0x41')]=_[_0xe8d0('0x3f')](_0x5668db[_0xe8d0('0x3c')],qs[_0xe8d0('0x40')](_0x29667c[_0xe8d0('0x3d')]['fields']));_0x2bb54d['attributes']=_0x2bb54d[_0xe8d0('0x41')]['length']?_0x2bb54d[_0xe8d0('0x41')]:_0x5668db[_0xe8d0('0x3c')];_0x2bb54d[_0xe8d0('0x43')]=qs[_0xe8d0('0x44')](_0x29667c[_0xe8d0('0x3d')][_0xe8d0('0x44')]);_0x2bb54d[_0xe8d0('0x47')]=qs[_0xe8d0('0x3e')](_[_0xe8d0('0x45')](_0x29667c[_0xe8d0('0x3d')],_0x5668db[_0xe8d0('0x3e')]));if(_0x29667c[_0xe8d0('0x3d')][_0xe8d0('0x46')]){_0x2bb54d[_0xe8d0('0x47')]=_[_0xe8d0('0x49')](_0x2bb54d['where'],{'$or':_[_0xe8d0('0x37')](_0x2bb54d[_0xe8d0('0x41')],function(_0x298403){var _0x41bca5={};_0x41bca5[_0x298403]={'$like':'%'+_0x29667c[_0xe8d0('0x3d')]['filter']+'%'};return _0x41bca5;})});}_0x2bb54d=_[_0xe8d0('0x49')]({},_0x2bb54d,_0x29667c[_0xe8d0('0x4a')]);return _0x3cee4e[_0xe8d0('0x56')](_0x2bb54d);}})[_0xe8d0('0x1e')](function(_0x360633){if(_0x360633){_0x2c444f=_0x360633[_0xe8d0('0x42')];if(!_0x29667c[_0xe8d0('0x3d')][_0xe8d0('0x58')](_0xe8d0('0x59'))){_0x2bb54d[_0xe8d0('0x5a')]=qs[_0xe8d0('0x5a')](_0x29667c[_0xe8d0('0x3d')]['limit']);_0x2bb54d['offset']=qs[_0xe8d0('0x2d')](_0x29667c['query'][_0xe8d0('0x2d')]);}return _0x3cee4e[_0xe8d0('0x56')](_0x2bb54d);}})['then'](function(_0x16a989){if(_0x16a989){return _0x16a989?{'count':_0x2c444f,'rows':_0x16a989}:null;}})[_0xe8d0('0x1e')](respondWithResult(_0x595b24,null))[_0xe8d0('0x28')](handleError(_0x595b24,null));};exports[_0xe8d0('0x5b')]=function(_0x1ed517,_0x1b5df8,_0x473e0b){var _0x235867={};var _0x400736={};var _0x115016;var _0xb078d8;return db[_0xe8d0('0x4b')][_0xe8d0('0x5c')]({'where':{'id':_0x1ed517[_0xe8d0('0x51')]['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x1b5df8,null))[_0xe8d0('0x1e')](function(_0xffd884){if(_0xffd884){_0x115016=_0xffd884;_0x400736[_0xe8d0('0x3c')]=_[_0xe8d0('0x52')](db['ZohoField'][_0xe8d0('0x38')]);_0x400736[_0xe8d0('0x3d')]=_[_0xe8d0('0x52')](_0x1ed517['query']);_0x400736[_0xe8d0('0x3e')]=_['intersection'](_0x400736[_0xe8d0('0x3c')],_0x400736[_0xe8d0('0x3d')]);_0x235867[_0xe8d0('0x41')]=_['intersection'](_0x400736[_0xe8d0('0x3c')],qs[_0xe8d0('0x40')](_0x1ed517[_0xe8d0('0x3d')][_0xe8d0('0x40')]));_0x235867[_0xe8d0('0x41')]=_0x235867['attributes'][_0xe8d0('0x42')]?_0x235867[_0xe8d0('0x41')]:_0x400736[_0xe8d0('0x3c')];_0x235867[_0xe8d0('0x43')]=qs[_0xe8d0('0x44')](_0x1ed517[_0xe8d0('0x3d')][_0xe8d0('0x44')]);_0x235867[_0xe8d0('0x47')]=qs['filters'](_[_0xe8d0('0x45')](_0x1ed517[_0xe8d0('0x3d')],_0x400736[_0xe8d0('0x3e')]));if(_0x1ed517[_0xe8d0('0x3d')]['filter']){_0x235867[_0xe8d0('0x47')]=_[_0xe8d0('0x49')](_0x235867[_0xe8d0('0x47')],{'$or':_['map'](_0x235867[_0xe8d0('0x41')],function(_0x52fbaa){var _0x32ef2a={};_0x32ef2a[_0x52fbaa]={'$like':'%'+_0x1ed517['query'][_0xe8d0('0x46')]+'%'};return _0x32ef2a;})});}_0x235867=_[_0xe8d0('0x49')]({},_0x235867,_0x1ed517[_0xe8d0('0x4a')]);return _0x115016[_0xe8d0('0x5b')](_0x235867);}})[_0xe8d0('0x1e')](function(_0x20a5fe){if(_0x20a5fe){_0xb078d8=_0x20a5fe[_0xe8d0('0x42')];if(!_0x1ed517[_0xe8d0('0x3d')][_0xe8d0('0x58')](_0xe8d0('0x59'))){_0x235867[_0xe8d0('0x5a')]=qs[_0xe8d0('0x5a')](_0x1ed517['query'][_0xe8d0('0x5a')]);_0x235867[_0xe8d0('0x2d')]=qs[_0xe8d0('0x2d')](_0x1ed517[_0xe8d0('0x3d')][_0xe8d0('0x2d')]);}return _0x115016[_0xe8d0('0x5b')](_0x235867);}})[_0xe8d0('0x1e')](function(_0x605b5f){if(_0x605b5f){return _0x605b5f?{'count':_0xb078d8,'rows':_0x605b5f}:null;}})[_0xe8d0('0x1e')](respondWithResult(_0x1b5df8,null))[_0xe8d0('0x28')](handleError(_0x1b5df8,null));};exports['getDescriptions']=function(_0x1ca1d0,_0x196777,_0x4125b5){var _0xebc89e={};var _0x255e4b={};var _0x550fe6;var _0x4c4ff0;return db[_0xe8d0('0x4b')]['findOne']({'where':{'id':_0x1ca1d0[_0xe8d0('0x51')]['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x196777,null))[_0xe8d0('0x1e')](function(_0x50e397){if(_0x50e397){_0x550fe6=_0x50e397;_0x255e4b[_0xe8d0('0x3c')]=_['keys'](db[_0xe8d0('0x57')][_0xe8d0('0x38')]);_0x255e4b[_0xe8d0('0x3d')]=_[_0xe8d0('0x52')](_0x1ca1d0[_0xe8d0('0x3d')]);_0x255e4b['filters']=_['intersection'](_0x255e4b[_0xe8d0('0x3c')],_0x255e4b[_0xe8d0('0x3d')]);_0xebc89e[_0xe8d0('0x41')]=_[_0xe8d0('0x3f')](_0x255e4b[_0xe8d0('0x3c')],qs[_0xe8d0('0x40')](_0x1ca1d0[_0xe8d0('0x3d')][_0xe8d0('0x40')]));_0xebc89e[_0xe8d0('0x41')]=_0xebc89e['attributes'][_0xe8d0('0x42')]?_0xebc89e[_0xe8d0('0x41')]:_0x255e4b[_0xe8d0('0x3c')];_0xebc89e[_0xe8d0('0x43')]=qs['sort'](_0x1ca1d0['query'][_0xe8d0('0x44')]);_0xebc89e[_0xe8d0('0x47')]=qs[_0xe8d0('0x3e')](_[_0xe8d0('0x45')](_0x1ca1d0[_0xe8d0('0x3d')],_0x255e4b[_0xe8d0('0x3e')]));if(_0x1ca1d0[_0xe8d0('0x3d')][_0xe8d0('0x46')]){_0xebc89e[_0xe8d0('0x47')]=_[_0xe8d0('0x49')](_0xebc89e['where'],{'$or':_[_0xe8d0('0x37')](_0xebc89e[_0xe8d0('0x41')],function(_0x2728b0){var _0x195a79={};_0x195a79[_0x2728b0]={'$like':'%'+_0x1ca1d0[_0xe8d0('0x3d')][_0xe8d0('0x46')]+'%'};return _0x195a79;})});}_0xebc89e=_[_0xe8d0('0x49')]({},_0xebc89e,_0x1ca1d0[_0xe8d0('0x4a')]);return _0x550fe6[_0xe8d0('0x5d')](_0xebc89e);}})['then'](function(_0x52aece){if(_0x52aece){_0x4c4ff0=_0x52aece[_0xe8d0('0x42')];if(!_0x1ca1d0[_0xe8d0('0x3d')]['hasOwnProperty'](_0xe8d0('0x59'))){_0xebc89e[_0xe8d0('0x5a')]=qs[_0xe8d0('0x5a')](_0x1ca1d0['query'][_0xe8d0('0x5a')]);_0xebc89e[_0xe8d0('0x2d')]=qs[_0xe8d0('0x2d')](_0x1ca1d0[_0xe8d0('0x3d')]['offset']);}return _0x550fe6['getDescriptions'](_0xebc89e);}})[_0xe8d0('0x1e')](function(_0x2fa4db){if(_0x2fa4db){return _0x2fa4db?{'count':_0x4c4ff0,'rows':_0x2fa4db}:null;}})['then'](respondWithResult(_0x196777,null))['catch'](handleError(_0x196777,null));}; \ No newline at end of file +var _0x8ef6=['request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','stack','name','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','nolimit','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x219cc1,_0x3d03b5){var _0x177034=function(_0x45e0fe){while(--_0x45e0fe){_0x219cc1['push'](_0x219cc1['shift']());}};_0x177034(++_0x3d03b5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4a8d3a,_0x439300){_0x4a8d3a=_0x4a8d3a-0x0;var _0x3d9df2=_0x8ef6[_0x4a8d3a];return _0x3d9df2;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){_0x2d1e9f[_0x68ef('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14581d,_0xab3c17){return function(_0x4973c2){if(!_0x4973c2){_0x14581d[_0x68ef('0x28')](0x194);}return _0x4973c2;};}function handleError(_0x4a0763,_0x38c2f8){_0x38c2f8=_0x38c2f8||0x1f4;return function(_0x575f43){logger[_0x68ef('0x24')](_0x575f43[_0x68ef('0x34')]);if(_0x575f43[_0x68ef('0x35')]){delete _0x575f43['name'];}_0x4a0763[_0x68ef('0x29')](_0x38c2f8)['send'](_0x575f43);};}exports[_0x68ef('0x36')]=function(_0x4c9506,_0x474ffa){var _0x362ef1={},_0x102df9={},_0x136f6b={'count':0x0,'rows':[]};var _0x2181d9=_[_0x68ef('0x37')](db['ZohoConfiguration'][_0x68ef('0x38')],function(_0x15a6ab){return{'name':_0x15a6ab[_0x68ef('0x39')],'type':_0x15a6ab['type'][_0x68ef('0x3a')]};});_0x102df9[_0x68ef('0x3b')]=_[_0x68ef('0x37')](_0x2181d9,'name');_0x102df9['query']=_[_0x68ef('0x3c')](_0x4c9506[_0x68ef('0x3d')]);_0x102df9[_0x68ef('0x3e')]=_[_0x68ef('0x3f')](_0x102df9[_0x68ef('0x3b')],_0x102df9[_0x68ef('0x3d')]);_0x362ef1[_0x68ef('0x40')]=_['intersection'](_0x102df9[_0x68ef('0x3b')],qs[_0x68ef('0x41')](_0x4c9506[_0x68ef('0x3d')][_0x68ef('0x41')]));_0x362ef1['attributes']=_0x362ef1[_0x68ef('0x40')][_0x68ef('0x42')]?_0x362ef1[_0x68ef('0x40')]:_0x102df9[_0x68ef('0x3b')];if(!_0x4c9506[_0x68ef('0x3d')][_0x68ef('0x43')]('nolimit')){_0x362ef1[_0x68ef('0x2e')]=qs[_0x68ef('0x2e')](_0x4c9506[_0x68ef('0x3d')][_0x68ef('0x2e')]);_0x362ef1[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x4c9506[_0x68ef('0x3d')][_0x68ef('0x2b')]);}_0x362ef1[_0x68ef('0x44')]=qs['sort'](_0x4c9506[_0x68ef('0x3d')][_0x68ef('0x45')]);_0x362ef1[_0x68ef('0x46')]=qs[_0x68ef('0x3e')](_[_0x68ef('0x47')](_0x4c9506[_0x68ef('0x3d')],_0x102df9[_0x68ef('0x3e')]),_0x2181d9);if(_0x4c9506['query'][_0x68ef('0x48')]){_0x362ef1['where']=_[_0x68ef('0x49')](_0x362ef1[_0x68ef('0x46')],{'$or':_[_0x68ef('0x37')](_0x2181d9,function(_0xfc08d5){if(_0xfc08d5['type']!==_0x68ef('0x4a')){var _0x5a8231={};_0x5a8231[_0xfc08d5[_0x68ef('0x35')]]={'$like':'%'+_0x4c9506['query'][_0x68ef('0x48')]+'%'};return _0x5a8231;}})});}_0x362ef1=_[_0x68ef('0x49')]({},_0x362ef1,_0x4c9506[_0x68ef('0x4b')]);var _0x5c4a66={'where':_0x362ef1['where']};return db[_0x68ef('0x4c')][_0x68ef('0x2d')](_0x5c4a66)['then'](function(_0x589688){_0x136f6b['count']=_0x589688;if(_0x4c9506[_0x68ef('0x3d')][_0x68ef('0x4d')]){_0x362ef1[_0x68ef('0x4e')]=[{'all':!![]}];}return db[_0x68ef('0x4c')][_0x68ef('0x4f')](_0x362ef1);})['then'](function(_0x55f385){_0x136f6b[_0x68ef('0x50')]=_0x55f385;return _0x136f6b;})[_0x68ef('0x1f')](respondWithFilteredResult(_0x474ffa,_0x362ef1))[_0x68ef('0x51')](handleError(_0x474ffa,null));};exports[_0x68ef('0x52')]=function(_0x4d16c9,_0x810685){var _0x474e5a={'raw':![],'where':{'id':_0x4d16c9[_0x68ef('0x53')]['id']}},_0x1c9b6f={};_0x1c9b6f['model']=_['keys'](db[_0x68ef('0x4c')][_0x68ef('0x38')]);_0x1c9b6f['query']=_[_0x68ef('0x3c')](_0x4d16c9[_0x68ef('0x3d')]);_0x1c9b6f[_0x68ef('0x3e')]=_[_0x68ef('0x3f')](_0x1c9b6f[_0x68ef('0x3b')],_0x1c9b6f['query']);_0x474e5a[_0x68ef('0x40')]=_[_0x68ef('0x3f')](_0x1c9b6f[_0x68ef('0x3b')],qs['fields'](_0x4d16c9[_0x68ef('0x3d')][_0x68ef('0x41')]));_0x474e5a[_0x68ef('0x40')]=_0x474e5a['attributes'][_0x68ef('0x42')]?_0x474e5a['attributes']:_0x1c9b6f['model'];if(_0x4d16c9[_0x68ef('0x3d')]['includeAll']){_0x474e5a[_0x68ef('0x4e')]=[{'all':!![]}];}_0x474e5a=_[_0x68ef('0x49')]({},_0x474e5a,_0x4d16c9[_0x68ef('0x4b')]);return db[_0x68ef('0x4c')][_0x68ef('0x54')](_0x474e5a)[_0x68ef('0x1f')](handleEntityNotFound(_0x810685,null))[_0x68ef('0x1f')](respondWithResult(_0x810685,null))[_0x68ef('0x51')](handleError(_0x810685,null));};exports[_0x68ef('0x55')]=function(_0x247915,_0x538db4){return db['ZohoConfiguration'][_0x68ef('0x55')](_0x247915[_0x68ef('0x56')],{})[_0x68ef('0x1f')](respondWithResult(_0x538db4,0xc9))[_0x68ef('0x51')](handleError(_0x538db4,null));};exports[_0x68ef('0x32')]=function(_0x1d11d7,_0x15400c){if(_0x1d11d7[_0x68ef('0x56')]['id']){delete _0x1d11d7[_0x68ef('0x56')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x1d11d7[_0x68ef('0x53')]['id']}})['then'](handleEntityNotFound(_0x15400c,null))[_0x68ef('0x1f')](saveUpdates(_0x1d11d7['body'],null))[_0x68ef('0x1f')](respondWithResult(_0x15400c,null))[_0x68ef('0x51')](handleError(_0x15400c,null));};exports['destroy']=function(_0xa42737,_0x4e097e){return db[_0x68ef('0x4c')][_0x68ef('0x54')]({'where':{'id':_0xa42737[_0x68ef('0x53')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x4e097e,null))[_0x68ef('0x1f')](removeEntity(_0x4e097e,null))[_0x68ef('0x51')](handleError(_0x4e097e,null));};exports['getFields']=function(_0x1cdaef,_0x1f770f,_0x3cfd89){var _0x20dc7f={};var _0x4107d3={};var _0x3d8f68;var _0x48e15a;return db[_0x68ef('0x4c')][_0x68ef('0x57')]({'where':{'id':_0x1cdaef['params']['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x1f770f,null))[_0x68ef('0x1f')](function(_0x3d3087){if(_0x3d3087){_0x3d8f68=_0x3d3087;_0x4107d3['model']=_[_0x68ef('0x3c')](db['ZohoField']['rawAttributes']);_0x4107d3[_0x68ef('0x3d')]=_['keys'](_0x1cdaef[_0x68ef('0x3d')]);_0x4107d3['filters']=_[_0x68ef('0x3f')](_0x4107d3[_0x68ef('0x3b')],_0x4107d3[_0x68ef('0x3d')]);_0x20dc7f[_0x68ef('0x40')]=_[_0x68ef('0x3f')](_0x4107d3[_0x68ef('0x3b')],qs['fields'](_0x1cdaef[_0x68ef('0x3d')]['fields']));_0x20dc7f[_0x68ef('0x40')]=_0x20dc7f['attributes'][_0x68ef('0x42')]?_0x20dc7f[_0x68ef('0x40')]:_0x4107d3[_0x68ef('0x3b')];_0x20dc7f[_0x68ef('0x44')]=qs[_0x68ef('0x45')](_0x1cdaef[_0x68ef('0x3d')][_0x68ef('0x45')]);_0x20dc7f['where']=qs[_0x68ef('0x3e')](_[_0x68ef('0x47')](_0x1cdaef[_0x68ef('0x3d')],_0x4107d3[_0x68ef('0x3e')]));if(_0x1cdaef[_0x68ef('0x3d')]['filter']){_0x20dc7f[_0x68ef('0x46')]=_['merge'](_0x20dc7f[_0x68ef('0x46')],{'$or':_['map'](_0x20dc7f['attributes'],function(_0x2a5871){var _0xbe9e39={};_0xbe9e39[_0x2a5871]={'$like':'%'+_0x1cdaef[_0x68ef('0x3d')][_0x68ef('0x48')]+'%'};return _0xbe9e39;})});}_0x20dc7f=_['merge']({},_0x20dc7f,_0x1cdaef[_0x68ef('0x4b')]);return _0x3d8f68['getFields'](_0x20dc7f);}})[_0x68ef('0x1f')](function(_0x2d916e){if(_0x2d916e){_0x48e15a=_0x2d916e[_0x68ef('0x42')];if(!_0x1cdaef['query']['hasOwnProperty'](_0x68ef('0x58'))){_0x20dc7f[_0x68ef('0x2e')]=qs[_0x68ef('0x2e')](_0x1cdaef[_0x68ef('0x3d')]['limit']);_0x20dc7f[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x1cdaef[_0x68ef('0x3d')][_0x68ef('0x2b')]);}return _0x3d8f68['getFields'](_0x20dc7f);}})[_0x68ef('0x1f')](function(_0x53a601){if(_0x53a601){return _0x53a601?{'count':_0x48e15a,'rows':_0x53a601}:null;}})[_0x68ef('0x1f')](respondWithResult(_0x1f770f,null))[_0x68ef('0x51')](handleError(_0x1f770f,null));};exports[_0x68ef('0x59')]=function(_0x3193c8,_0xed16d1,_0x52cb2a){var _0x24285={};var _0x2caed7={};var _0x147695;var _0x595e79;return db[_0x68ef('0x4c')]['findOne']({'where':{'id':_0x3193c8[_0x68ef('0x53')]['id']}})['then'](handleEntityNotFound(_0xed16d1,null))['then'](function(_0x100345){if(_0x100345){_0x147695=_0x100345;_0x2caed7[_0x68ef('0x3b')]=_[_0x68ef('0x3c')](db[_0x68ef('0x5a')]['rawAttributes']);_0x2caed7[_0x68ef('0x3d')]=_[_0x68ef('0x3c')](_0x3193c8[_0x68ef('0x3d')]);_0x2caed7['filters']=_[_0x68ef('0x3f')](_0x2caed7[_0x68ef('0x3b')],_0x2caed7[_0x68ef('0x3d')]);_0x24285[_0x68ef('0x40')]=_[_0x68ef('0x3f')](_0x2caed7[_0x68ef('0x3b')],qs[_0x68ef('0x41')](_0x3193c8[_0x68ef('0x3d')][_0x68ef('0x41')]));_0x24285[_0x68ef('0x40')]=_0x24285[_0x68ef('0x40')][_0x68ef('0x42')]?_0x24285['attributes']:_0x2caed7[_0x68ef('0x3b')];_0x24285[_0x68ef('0x44')]=qs['sort'](_0x3193c8['query'][_0x68ef('0x45')]);_0x24285['where']=qs[_0x68ef('0x3e')](_[_0x68ef('0x47')](_0x3193c8['query'],_0x2caed7['filters']));if(_0x3193c8[_0x68ef('0x3d')]['filter']){_0x24285[_0x68ef('0x46')]=_['merge'](_0x24285[_0x68ef('0x46')],{'$or':_['map'](_0x24285[_0x68ef('0x40')],function(_0x428c13){var _0x57e811={};_0x57e811[_0x428c13]={'$like':'%'+_0x3193c8[_0x68ef('0x3d')][_0x68ef('0x48')]+'%'};return _0x57e811;})});}_0x24285=_[_0x68ef('0x49')]({},_0x24285,_0x3193c8[_0x68ef('0x4b')]);return _0x147695['getSubjects'](_0x24285);}})[_0x68ef('0x1f')](function(_0x26bda2){if(_0x26bda2){_0x595e79=_0x26bda2['length'];if(!_0x3193c8[_0x68ef('0x3d')][_0x68ef('0x43')](_0x68ef('0x58'))){_0x24285['limit']=qs[_0x68ef('0x2e')](_0x3193c8['query'][_0x68ef('0x2e')]);_0x24285[_0x68ef('0x2b')]=qs['offset'](_0x3193c8['query']['offset']);}return _0x147695['getSubjects'](_0x24285);}})[_0x68ef('0x1f')](function(_0x28ad22){if(_0x28ad22){return _0x28ad22?{'count':_0x595e79,'rows':_0x28ad22}:null;}})[_0x68ef('0x1f')](respondWithResult(_0xed16d1,null))[_0x68ef('0x51')](handleError(_0xed16d1,null));};exports[_0x68ef('0x5b')]=function(_0x409516,_0x842cfe,_0x285744){var _0x24ba34={};var _0x3ae3e9={};var _0x17892c;var _0x108223;return db[_0x68ef('0x4c')]['findOne']({'where':{'id':_0x409516[_0x68ef('0x53')]['id']}})['then'](handleEntityNotFound(_0x842cfe,null))[_0x68ef('0x1f')](function(_0x5b39a8){if(_0x5b39a8){_0x17892c=_0x5b39a8;_0x3ae3e9['model']=_[_0x68ef('0x3c')](db[_0x68ef('0x5a')][_0x68ef('0x38')]);_0x3ae3e9[_0x68ef('0x3d')]=_['keys'](_0x409516['query']);_0x3ae3e9[_0x68ef('0x3e')]=_[_0x68ef('0x3f')](_0x3ae3e9[_0x68ef('0x3b')],_0x3ae3e9['query']);_0x24ba34[_0x68ef('0x40')]=_[_0x68ef('0x3f')](_0x3ae3e9[_0x68ef('0x3b')],qs[_0x68ef('0x41')](_0x409516['query'][_0x68ef('0x41')]));_0x24ba34[_0x68ef('0x40')]=_0x24ba34[_0x68ef('0x40')][_0x68ef('0x42')]?_0x24ba34[_0x68ef('0x40')]:_0x3ae3e9[_0x68ef('0x3b')];_0x24ba34['order']=qs[_0x68ef('0x45')](_0x409516['query'][_0x68ef('0x45')]);_0x24ba34[_0x68ef('0x46')]=qs[_0x68ef('0x3e')](_[_0x68ef('0x47')](_0x409516['query'],_0x3ae3e9[_0x68ef('0x3e')]));if(_0x409516['query'][_0x68ef('0x48')]){_0x24ba34[_0x68ef('0x46')]=_['merge'](_0x24ba34['where'],{'$or':_[_0x68ef('0x37')](_0x24ba34['attributes'],function(_0x46c4ba){var _0x54d37b={};_0x54d37b[_0x46c4ba]={'$like':'%'+_0x409516[_0x68ef('0x3d')][_0x68ef('0x48')]+'%'};return _0x54d37b;})});}_0x24ba34=_[_0x68ef('0x49')]({},_0x24ba34,_0x409516[_0x68ef('0x4b')]);return _0x17892c[_0x68ef('0x5b')](_0x24ba34);}})[_0x68ef('0x1f')](function(_0x51b8db){if(_0x51b8db){_0x108223=_0x51b8db[_0x68ef('0x42')];if(!_0x409516[_0x68ef('0x3d')][_0x68ef('0x43')](_0x68ef('0x58'))){_0x24ba34[_0x68ef('0x2e')]=qs[_0x68ef('0x2e')](_0x409516[_0x68ef('0x3d')]['limit']);_0x24ba34[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x409516[_0x68ef('0x3d')][_0x68ef('0x2b')]);}return _0x17892c[_0x68ef('0x5b')](_0x24ba34);}})[_0x68ef('0x1f')](function(_0x3e0d3d){if(_0x3e0d3d){return _0x3e0d3d?{'count':_0x108223,'rows':_0x3e0d3d}:null;}})[_0x68ef('0x1f')](respondWithResult(_0x842cfe,null))[_0x68ef('0x51')](handleError(_0x842cfe,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 8d657bb..a75a125 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 _0xfd8b=['../../config/environment','define','ZohoConfiguration','int_zoho_configurations','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xfd8b,0x1c6));var _0xbfd8=function(_0x2f235d,_0x1e2001){_0x2f235d=_0x2f235d-0x0;var _0x109737=_0xfd8b[_0x2f235d];return _0x109737;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbfd8('0x0'))(_0xbfd8('0x1'));var moment=require(_0xbfd8('0x2'));var BPromise=require(_0xbfd8('0x3'));var rp=require(_0xbfd8('0x4'));var fs=require('fs');var path=require(_0xbfd8('0x5'));var rimraf=require('rimraf');var config=require(_0xbfd8('0x6'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x2d9e76,_0x2b771a){return _0x2d9e76[_0xbfd8('0x7')](_0xbfd8('0x8'),attributes,{'tableName':_0xbfd8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf825=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./intZohoConfiguration.attributes'];(function(_0x40f57f,_0x2d0093){var _0x1c5eb0=function(_0x3b0907){while(--_0x3b0907){_0x40f57f['push'](_0x40f57f['shift']());}};_0x1c5eb0(++_0x2d0093);}(_0xf825,0x1a5));var _0x5f82=function(_0x3e87c2,_0x3aec75){_0x3e87c2=_0x3e87c2-0x0;var _0xa19c79=_0xf825[_0x3e87c2];return _0xa19c79;};'use strict';var _=require(_0x5f82('0x0'));var util=require(_0x5f82('0x1'));var logger=require(_0x5f82('0x2'))('api');var moment=require(_0x5f82('0x3'));var BPromise=require(_0x5f82('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f82('0x5'));var rimraf=require(_0x5f82('0x6'));var config=require('../../config/environment');var attributes=require(_0x5f82('0x7'));module['exports']=function(_0x987ace,_0x2bec78){return _0x987ace[_0x5f82('0x8')](_0x5f82('0x9'),attributes,{'tableName':_0x5f82('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 5a7cce6..8cd9f34 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 _0x42b2=['error','code','message','result','catch','lodash','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x544437,_0x191ae1){var _0x29c98e=function(_0x4002b7){while(--_0x4002b7){_0x544437['push'](_0x544437['shift']());}};_0x29c98e(++_0x191ae1);}(_0x42b2,0xfc));var _0x242b=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x42b2[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x242b('0x0'));var util=require('util');var moment=require(_0x242b('0x1'));var BPromise=require('bluebird');var rs=require(_0x242b('0x2'));var fs=require('fs');var Redis=require(_0x242b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x242b('0x4'));var config=require(_0x242b('0x5'));var jayson=require(_0x242b('0x6'));var client=jayson['client'][_0x242b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28cbc6,_0x2e060,_0x860838){return new BPromise(function(_0x259036,_0x2782f4){return client[_0x242b('0x8')](_0x28cbc6,_0x860838)['then'](function(_0x4770ff){logger[_0x242b('0x9')](_0x242b('0xa'),_0x2e060,_0x242b('0xb'));logger[_0x242b('0xc')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x2e060,_0x242b('0xb'),JSON[_0x242b('0xd')](_0x4770ff));if(_0x4770ff[_0x242b('0xe')]){if(_0x4770ff['error'][_0x242b('0xf')]===0x1f4){logger['error'](_0x242b('0xa'),_0x2e060,_0x4770ff[_0x242b('0xe')][_0x242b('0x10')]);return _0x2782f4(_0x4770ff[_0x242b('0xe')][_0x242b('0x10')]);}logger['error'](_0x242b('0xa'),_0x2e060,_0x4770ff[_0x242b('0xe')][_0x242b('0x10')]);return _0x259036(_0x4770ff[_0x242b('0xe')][_0x242b('0x10')]);}else{logger[_0x242b('0x9')](_0x242b('0xa'),_0x2e060,_0x242b('0xb'));_0x259036(_0x4770ff[_0x242b('0x11')][_0x242b('0x10')]);}})[_0x242b('0x12')](function(_0x2b250a){logger[_0x242b('0xe')](_0x242b('0xa'),_0x2e060,_0x2b250a);_0x2782f4(_0x2b250a);});});} \ No newline at end of file +var _0xe3db=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x69752e,_0x2579f6){var _0x506a36=function(_0x1793bc){while(--_0x1793bc){_0x69752e['push'](_0x69752e['shift']());}};_0x506a36(++_0x2579f6);}(_0xe3db,0x99));var _0xbe3d=function(_0x2288ef,_0x55a50d){_0x2288ef=_0x2288ef-0x0;var _0x419c7b=_0xe3db[_0x2288ef];return _0x419c7b;};'use strict';var _=require('lodash');var util=require(_0xbe3d('0x0'));var moment=require(_0xbe3d('0x1'));var BPromise=require('bluebird');var rs=require(_0xbe3d('0x2'));var fs=require('fs');var Redis=require(_0xbe3d('0x3'));var db=require(_0xbe3d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe3d('0x5'))(_0xbe3d('0x6'));var config=require(_0xbe3d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbe3d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2abc72,_0xf221a3,_0x3df526){return new BPromise(function(_0x18c31f,_0x15d3b8){return client[_0xbe3d('0x9')](_0x2abc72,_0x3df526)[_0xbe3d('0xa')](function(_0x5666f6){logger[_0xbe3d('0xb')](_0xbe3d('0xc'),_0xf221a3,'request\x20sent');logger[_0xbe3d('0xd')](_0xbe3d('0xe'),_0xf221a3,_0xbe3d('0xf'),JSON[_0xbe3d('0x10')](_0x5666f6));if(_0x5666f6['error']){if(_0x5666f6[_0xbe3d('0x11')][_0xbe3d('0x12')]===0x1f4){logger[_0xbe3d('0x11')](_0xbe3d('0xc'),_0xf221a3,_0x5666f6[_0xbe3d('0x11')][_0xbe3d('0x13')]);return _0x15d3b8(_0x5666f6[_0xbe3d('0x11')]['message']);}logger['error'](_0xbe3d('0xc'),_0xf221a3,_0x5666f6[_0xbe3d('0x11')][_0xbe3d('0x13')]);return _0x18c31f(_0x5666f6['error'][_0xbe3d('0x13')]);}else{logger['info'](_0xbe3d('0xc'),_0xf221a3,_0xbe3d('0xf'));_0x18c31f(_0x5666f6[_0xbe3d('0x14')][_0xbe3d('0x13')]);}})[_0xbe3d('0x15')](function(_0x3f8678){logger[_0xbe3d('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0xf221a3,_0x3f8678);_0x15d3b8(_0x3f8678);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index fda124e..ade9a95 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 _0x8768=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy'];(function(_0x257f6e,_0x3cac62){var _0x5112c3=function(_0x2ec4c2){while(--_0x2ec4c2){_0x257f6e['push'](_0x257f6e['shift']());}};_0x5112c3(++_0x3cac62);}(_0x8768,0xa1));var _0x8876=function(_0x3f0f5e,_0x42d73f){_0x3f0f5e=_0x3f0f5e-0x0;var _0x4fc506=_0x8768[_0x3f0f5e];return _0x4fc506;};'use strict';var multer=require(_0x8876('0x0'));var util=require(_0x8876('0x1'));var path=require(_0x8876('0x2'));var timeout=require(_0x8876('0x3'));var express=require(_0x8876('0x4'));var router=express[_0x8876('0x5')]();var fs_extra=require(_0x8876('0x6'));var auth=require(_0x8876('0x7'));var interaction=require(_0x8876('0x8'));var config=require(_0x8876('0x9'));var controller=require(_0x8876('0xa'));router[_0x8876('0xb')]('/',auth[_0x8876('0xc')](),controller['index']);router[_0x8876('0xb')](_0x8876('0xd'),auth[_0x8876('0xc')](),controller[_0x8876('0xe')]);router[_0x8876('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8876('0x10')](_0x8876('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x8876('0x11')](_0x8876('0xd'),auth[_0x8876('0xc')](),controller[_0x8876('0x12')]);module[_0x8876('0x13')]=router; \ No newline at end of file +var _0xc343=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get'];(function(_0xa66ac,_0x10f309){var _0x1937e8=function(_0x9e6fa){while(--_0x9e6fa){_0xa66ac['push'](_0xa66ac['shift']());}};_0x1937e8(++_0x10f309);}(_0xc343,0x173));var _0x3c34=function(_0x11f529,_0x2cc10b){_0x11f529=_0x11f529-0x0;var _0x36de51=_0xc343[_0x11f529];return _0x36de51;};'use strict';var multer=require(_0x3c34('0x0'));var util=require('util');var path=require(_0x3c34('0x1'));var timeout=require(_0x3c34('0x2'));var express=require(_0x3c34('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3c34('0x4'));var interaction=require(_0x3c34('0x5'));var config=require(_0x3c34('0x6'));var controller=require(_0x3c34('0x7'));router[_0x3c34('0x8')]('/',auth[_0x3c34('0x9')](),controller[_0x3c34('0xa')]);router[_0x3c34('0x8')](_0x3c34('0xb'),auth[_0x3c34('0x9')](),controller[_0x3c34('0xc')]);router[_0x3c34('0xd')]('/',auth[_0x3c34('0x9')](),controller[_0x3c34('0xe')]);router[_0x3c34('0xf')]('/:id',auth[_0x3c34('0x9')](),controller['update']);router[_0x3c34('0x10')]('/:id',auth[_0x3c34('0x9')](),controller[_0x3c34('0x11')]);module[_0x3c34('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 6062854..8265b3d 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 _0xa9e0=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','picklist','string'];(function(_0x203870,_0x4f1440){var _0x2adfb2=function(_0x3efeac){while(--_0x3efeac){_0x203870['push'](_0x203870['shift']());}};_0x2adfb2(++_0x4f1440);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('string','variable',_0x0a9e('0x3'),'keyValue',_0x0a9e('0x4')),'defaultValue':_0x0a9e('0x5')},'content':{'type':Sequelize[_0x0a9e('0x6')]},'key':{'type':Sequelize[_0x0a9e('0x6')]},'keyType':{'type':Sequelize[_0x0a9e('0x2')]('string',_0x0a9e('0x7'),_0x0a9e('0x3'))},'keyContent':{'type':Sequelize[_0x0a9e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4c6d=['picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x23994f,_0x19d489){var _0x4217fb=function(_0x50f84b){while(--_0x50f84b){_0x23994f['push'](_0x23994f['shift']());}};_0x4217fb(++_0x19d489);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x2fe880,_0x1ebd15){_0x2fe880=_0x2fe880-0x0;var _0x2a8dde=_0x4c6d[_0x2fe880];return _0x2a8dde;};'use strict';var Sequelize=require(_0xd4c6('0x0'));module[_0xd4c6('0x1')]={'type':{'type':Sequelize[_0xd4c6('0x2')](_0xd4c6('0x3'),_0xd4c6('0x4'),'customVariable',_0xd4c6('0x5'),_0xd4c6('0x6')),'defaultValue':_0xd4c6('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd4c6('0x7')]},'keyType':{'type':Sequelize[_0xd4c6('0x2')]('string',_0xd4c6('0x4'),_0xd4c6('0x8'))},'keyContent':{'type':Sequelize[_0xd4c6('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd4c6('0x7')]},'customField':{'type':Sequelize[_0xd4c6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd4c6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 4f5ff95..c13a2ac 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 _0xe855=['sendStatus','status','json','limit','undefined','count','offset','set','apply','update','then','destroy','name','send','index','ZohoField','rawAttributes','fieldName','key','map','query','keys','intersection','attributes','model','fields','length','sort','where','pick','filters','type','VIRTUAL','merge','includeAll','include','findAll','show','params','options','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x1967fa,_0x534ced){var _0x5f0173=function(_0x45146d){while(--_0x45146d){_0x1967fa['push'](_0x1967fa['shift']());}};_0x5f0173(++_0x534ced);}(_0xe855,0x130));var _0x5e85=function(_0x4e4f37,_0x4750c3){_0x4e4f37=_0x4e4f37-0x0;var _0x220b63=_0xe855[_0x4e4f37];return _0x220b63;};'use strict';var emlformat=require(_0x5e85('0x0'));var rimraf=require(_0x5e85('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e85('0x2'));var rp=require('request-promise');var moment=require(_0x5e85('0x3'));var BPromise=require(_0x5e85('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5e85('0x5'));var csv=require(_0x5e85('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e85('0x7'));var squel=require(_0x5e85('0x8'));var crypto=require('crypto');var jsforce=require(_0x5e85('0x9'));var deskjs=require(_0x5e85('0xa'));var toCsv=require(_0x5e85('0x6'));var querystring=require(_0x5e85('0xb'));var Papa=require(_0x5e85('0xc'));var Redis=require('ioredis');var authService=require(_0x5e85('0xd'));var qs=require(_0x5e85('0xe'));var as=require(_0x5e85('0xf'));var hardwareService=require(_0x5e85('0x10'));var logger=require(_0x5e85('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x5e85('0x12'));var licenseUtil=require(_0x5e85('0x13'));var db=require(_0x5e85('0x14'))['db'];function respondWithStatusCode(_0x19fab3,_0x5a2916){_0x5a2916=_0x5a2916||0xcc;return function(_0x3fda7b){if(_0x3fda7b){return _0x19fab3[_0x5e85('0x15')](_0x5a2916);}return _0x19fab3['status'](_0x5a2916)['end']();};}function respondWithResult(_0x583194,_0x364911){_0x364911=_0x364911||0xc8;return function(_0x2b0536){if(_0x2b0536){return _0x583194[_0x5e85('0x16')](_0x364911)[_0x5e85('0x17')](_0x2b0536);}};}function respondWithFilteredResult(_0x18f6f7,_0x47909c){return function(_0x183b3b){if(_0x183b3b){var _0x44eb2b=typeof _0x47909c['offset']==='undefined'&&typeof _0x47909c[_0x5e85('0x18')]===_0x5e85('0x19');var _0x386ea4=_0x183b3b[_0x5e85('0x1a')];var _0x3a811e=_0x44eb2b?0x0:_0x47909c['offset'];var _0x5dab85=_0x44eb2b?_0x183b3b[_0x5e85('0x1a')]:_0x47909c[_0x5e85('0x1b')]+_0x47909c['limit'];var _0x4590b4;if(_0x5dab85>=_0x386ea4){_0x5dab85=_0x386ea4;_0x4590b4=0xc8;}else{_0x4590b4=0xce;}_0x18f6f7[_0x5e85('0x16')](_0x4590b4);return _0x18f6f7[_0x5e85('0x1c')]('Content-Range',_0x3a811e+'-'+_0x5dab85+'/'+_0x386ea4)[_0x5e85('0x17')](_0x183b3b);}return null;};}function patchUpdates(_0x288c28){return function(_0x5f577e){try{jsonpatch[_0x5e85('0x1d')](_0x5f577e,_0x288c28,!![]);}catch(_0x5d9590){return BPromise['reject'](_0x5d9590);}return _0x5f577e['save']();};}function saveUpdates(_0x532973,_0x628064){return function(_0x2db049){if(_0x2db049){return _0x2db049[_0x5e85('0x1e')](_0x532973)[_0x5e85('0x1f')](function(_0x380468){return _0x380468;});}return null;};}function removeEntity(_0x41c4cf,_0x127c88){return function(_0x955a42){if(_0x955a42){return _0x955a42[_0x5e85('0x20')]()['then'](function(){_0x41c4cf[_0x5e85('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x292dbb,_0x1d4097){return function(_0xbc9434){if(!_0xbc9434){_0x292dbb[_0x5e85('0x15')](0x194);}return _0xbc9434;};}function handleError(_0x325a11,_0x6675df){_0x6675df=_0x6675df||0x1f4;return function(_0x3b34b1){logger['error'](_0x3b34b1['stack']);if(_0x3b34b1[_0x5e85('0x21')]){delete _0x3b34b1[_0x5e85('0x21')];}_0x325a11[_0x5e85('0x16')](_0x6675df)[_0x5e85('0x22')](_0x3b34b1);};}exports[_0x5e85('0x23')]=function(_0x427092,_0x4144b1){var _0x2a408d={},_0x1a71fd={},_0x5e48b2={'count':0x0,'rows':[]};var _0x51aea6=_['map'](db[_0x5e85('0x24')][_0x5e85('0x25')],function(_0x154d30){return{'name':_0x154d30[_0x5e85('0x26')],'type':_0x154d30['type'][_0x5e85('0x27')]};});_0x1a71fd['model']=_[_0x5e85('0x28')](_0x51aea6,_0x5e85('0x21'));_0x1a71fd[_0x5e85('0x29')]=_[_0x5e85('0x2a')](_0x427092[_0x5e85('0x29')]);_0x1a71fd['filters']=_[_0x5e85('0x2b')](_0x1a71fd['model'],_0x1a71fd[_0x5e85('0x29')]);_0x2a408d[_0x5e85('0x2c')]=_[_0x5e85('0x2b')](_0x1a71fd[_0x5e85('0x2d')],qs[_0x5e85('0x2e')](_0x427092[_0x5e85('0x29')][_0x5e85('0x2e')]));_0x2a408d[_0x5e85('0x2c')]=_0x2a408d[_0x5e85('0x2c')][_0x5e85('0x2f')]?_0x2a408d[_0x5e85('0x2c')]:_0x1a71fd[_0x5e85('0x2d')];if(!_0x427092[_0x5e85('0x29')]['hasOwnProperty']('nolimit')){_0x2a408d[_0x5e85('0x18')]=qs[_0x5e85('0x18')](_0x427092[_0x5e85('0x29')]['limit']);_0x2a408d[_0x5e85('0x1b')]=qs[_0x5e85('0x1b')](_0x427092[_0x5e85('0x29')]['offset']);}_0x2a408d['order']=qs[_0x5e85('0x30')](_0x427092['query']['sort']);_0x2a408d[_0x5e85('0x31')]=qs['filters'](_[_0x5e85('0x32')](_0x427092[_0x5e85('0x29')],_0x1a71fd[_0x5e85('0x33')]),_0x51aea6);if(_0x427092['query']['filter']){_0x2a408d[_0x5e85('0x31')]=_['merge'](_0x2a408d['where'],{'$or':_['map'](_0x51aea6,function(_0x3e95a4){if(_0x3e95a4[_0x5e85('0x34')]!==_0x5e85('0x35')){var _0x1fdc78={};_0x1fdc78[_0x3e95a4[_0x5e85('0x21')]]={'$like':'%'+_0x427092[_0x5e85('0x29')]['filter']+'%'};return _0x1fdc78;}})});}_0x2a408d=_[_0x5e85('0x36')]({},_0x2a408d,_0x427092['options']);var _0x3167ce={'where':_0x2a408d[_0x5e85('0x31')]};return db[_0x5e85('0x24')]['count'](_0x3167ce)['then'](function(_0x1cd094){_0x5e48b2[_0x5e85('0x1a')]=_0x1cd094;if(_0x427092['query'][_0x5e85('0x37')]){_0x2a408d[_0x5e85('0x38')]=[{'all':!![]}];}return db[_0x5e85('0x24')][_0x5e85('0x39')](_0x2a408d);})[_0x5e85('0x1f')](function(_0x4f6c2a){_0x5e48b2['rows']=_0x4f6c2a;return _0x5e48b2;})[_0x5e85('0x1f')](respondWithFilteredResult(_0x4144b1,_0x2a408d))['catch'](handleError(_0x4144b1,null));};exports[_0x5e85('0x3a')]=function(_0x5c6ac4,_0x3f0516){var _0x2bbae1={'raw':!![],'where':{'id':_0x5c6ac4[_0x5e85('0x3b')]['id']}},_0x3dab81={};_0x3dab81[_0x5e85('0x2d')]=_[_0x5e85('0x2a')](db['ZohoField'][_0x5e85('0x25')]);_0x3dab81[_0x5e85('0x29')]=_[_0x5e85('0x2a')](_0x5c6ac4[_0x5e85('0x29')]);_0x3dab81[_0x5e85('0x33')]=_[_0x5e85('0x2b')](_0x3dab81[_0x5e85('0x2d')],_0x3dab81[_0x5e85('0x29')]);_0x2bbae1[_0x5e85('0x2c')]=_[_0x5e85('0x2b')](_0x3dab81[_0x5e85('0x2d')],qs['fields'](_0x5c6ac4[_0x5e85('0x29')][_0x5e85('0x2e')]));_0x2bbae1[_0x5e85('0x2c')]=_0x2bbae1[_0x5e85('0x2c')]['length']?_0x2bbae1[_0x5e85('0x2c')]:_0x3dab81[_0x5e85('0x2d')];if(_0x5c6ac4[_0x5e85('0x29')][_0x5e85('0x37')]){_0x2bbae1[_0x5e85('0x38')]=[{'all':!![]}];}_0x2bbae1=_[_0x5e85('0x36')]({},_0x2bbae1,_0x5c6ac4[_0x5e85('0x3c')]);return db[_0x5e85('0x24')][_0x5e85('0x3d')](_0x2bbae1)[_0x5e85('0x1f')](handleEntityNotFound(_0x3f0516,null))[_0x5e85('0x1f')](respondWithResult(_0x3f0516,null))[_0x5e85('0x3e')](handleError(_0x3f0516,null));};exports[_0x5e85('0x3f')]=function(_0x2f50d2,_0x2c4631){return db[_0x5e85('0x24')]['create'](_0x2f50d2[_0x5e85('0x40')],{})['then'](respondWithResult(_0x2c4631,0xc9))['catch'](handleError(_0x2c4631,null));};exports[_0x5e85('0x1e')]=function(_0x30b618,_0x417571){if(_0x30b618[_0x5e85('0x40')]['id']){delete _0x30b618[_0x5e85('0x40')]['id'];}return db[_0x5e85('0x24')][_0x5e85('0x3d')]({'where':{'id':_0x30b618[_0x5e85('0x3b')]['id']}})[_0x5e85('0x1f')](handleEntityNotFound(_0x417571,null))[_0x5e85('0x1f')](saveUpdates(_0x30b618[_0x5e85('0x40')],null))[_0x5e85('0x1f')](respondWithResult(_0x417571,null))[_0x5e85('0x3e')](handleError(_0x417571,null));};exports[_0x5e85('0x20')]=function(_0x2ab582,_0x462945){return db[_0x5e85('0x24')][_0x5e85('0x3d')]({'where':{'id':_0x2ab582[_0x5e85('0x3b')]['id']}})[_0x5e85('0x1f')](handleEntityNotFound(_0x462945,null))[_0x5e85('0x1f')](removeEntity(_0x462945,null))['catch'](handleError(_0x462945,null));}; \ No newline at end of file +var _0x51e8=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','rawAttributes','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','ZohoField','includeAll','include','findAll','params','length','find','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4b09e6,_0xad19f3){var _0x538c05=function(_0x4f5294){while(--_0x4f5294){_0x4b09e6['push'](_0x4b09e6['shift']());}};_0x538c05(++_0xad19f3);}(_0x51e8,0x7f));var _0x851e=function(_0x1aca02,_0x1725f3){_0x1aca02=_0x1aca02-0x0;var _0x37020a=_0x51e8[_0x1aca02];return _0x37020a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x851e('0x0'));var zipdir=require(_0x851e('0x1'));var jsonpatch=require(_0x851e('0x2'));var rp=require(_0x851e('0x3'));var moment=require('moment');var BPromise=require(_0x851e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x851e('0x5'));var ejs=require(_0x851e('0x6'));var fs=require('fs');var fs_extra=require(_0x851e('0x7'));var _=require(_0x851e('0x8'));var squel=require(_0x851e('0x9'));var crypto=require(_0x851e('0xa'));var jsforce=require(_0x851e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x851e('0x5'));var querystring=require('querystring');var Papa=require(_0x851e('0xc'));var Redis=require('ioredis');var authService=require(_0x851e('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x851e('0xe'));var hardwareService=require(_0x851e('0xf'));var logger=require(_0x851e('0x10'))(_0x851e('0x11'));var utils=require(_0x851e('0x12'));var config=require(_0x851e('0x13'));var licenseUtil=require(_0x851e('0x14'));var db=require(_0x851e('0x15'))['db'];function respondWithStatusCode(_0x3edbfc,_0x1861c9){_0x1861c9=_0x1861c9||0xcc;return function(_0x36c746){if(_0x36c746){return _0x3edbfc[_0x851e('0x16')](_0x1861c9);}return _0x3edbfc[_0x851e('0x17')](_0x1861c9)[_0x851e('0x18')]();};}function respondWithResult(_0x706c34,_0x28f8a3){_0x28f8a3=_0x28f8a3||0xc8;return function(_0x24edaf){if(_0x24edaf){return _0x706c34[_0x851e('0x17')](_0x28f8a3)[_0x851e('0x19')](_0x24edaf);}};}function respondWithFilteredResult(_0x23cc58,_0x2a1b79){return function(_0x30a42e){if(_0x30a42e){var _0x412973=typeof _0x2a1b79[_0x851e('0x1a')]===_0x851e('0x1b')&&typeof _0x2a1b79[_0x851e('0x1c')]===_0x851e('0x1b');var _0x3ccdd7=_0x30a42e[_0x851e('0x1d')];var _0x4d44e3=_0x412973?0x0:_0x2a1b79[_0x851e('0x1a')];var _0x3c4e35=_0x412973?_0x30a42e[_0x851e('0x1d')]:_0x2a1b79[_0x851e('0x1a')]+_0x2a1b79[_0x851e('0x1c')];var _0x4fa544;if(_0x3c4e35>=_0x3ccdd7){_0x3c4e35=_0x3ccdd7;_0x4fa544=0xc8;}else{_0x4fa544=0xce;}_0x23cc58['status'](_0x4fa544);return _0x23cc58[_0x851e('0x1e')](_0x851e('0x1f'),_0x4d44e3+'-'+_0x3c4e35+'/'+_0x3ccdd7)[_0x851e('0x19')](_0x30a42e);}return null;};}function patchUpdates(_0x4cf2f1){return function(_0x36d91){try{jsonpatch[_0x851e('0x20')](_0x36d91,_0x4cf2f1,!![]);}catch(_0x2bcf10){return BPromise[_0x851e('0x21')](_0x2bcf10);}return _0x36d91[_0x851e('0x22')]();};}function saveUpdates(_0x1c7db7,_0xff0609){return function(_0x5966a0){if(_0x5966a0){return _0x5966a0[_0x851e('0x23')](_0x1c7db7)['then'](function(_0x2fa0ee){return _0x2fa0ee;});}return null;};}function removeEntity(_0x1af53a,_0x4ddfb3){return function(_0xb3e529){if(_0xb3e529){return _0xb3e529[_0x851e('0x24')]()[_0x851e('0x25')](function(){_0x1af53a[_0x851e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x160ea6,_0x5a0947){return function(_0x512c79){if(!_0x512c79){_0x160ea6['sendStatus'](0x194);}return _0x512c79;};}function handleError(_0x3220ac,_0x2eae07){_0x2eae07=_0x2eae07||0x1f4;return function(_0x507f2f){logger['error'](_0x507f2f[_0x851e('0x26')]);if(_0x507f2f[_0x851e('0x27')]){delete _0x507f2f[_0x851e('0x27')];}_0x3220ac[_0x851e('0x17')](_0x2eae07)[_0x851e('0x28')](_0x507f2f);};}exports['index']=function(_0x162159,_0x131a71){var _0x35aa58={},_0x44d898={},_0x3c0fc3={'count':0x0,'rows':[]};var _0x36f588=_['map'](db['ZohoField'][_0x851e('0x29')],function(_0x469e38){return{'name':_0x469e38['fieldName'],'type':_0x469e38['type'][_0x851e('0x2a')]};});_0x44d898['model']=_[_0x851e('0x2b')](_0x36f588,_0x851e('0x27'));_0x44d898[_0x851e('0x2c')]=_[_0x851e('0x2d')](_0x162159[_0x851e('0x2c')]);_0x44d898[_0x851e('0x2e')]=_['intersection'](_0x44d898[_0x851e('0x2f')],_0x44d898[_0x851e('0x2c')]);_0x35aa58[_0x851e('0x30')]=_[_0x851e('0x31')](_0x44d898[_0x851e('0x2f')],qs[_0x851e('0x32')](_0x162159[_0x851e('0x2c')][_0x851e('0x32')]));_0x35aa58[_0x851e('0x30')]=_0x35aa58[_0x851e('0x30')]['length']?_0x35aa58[_0x851e('0x30')]:_0x44d898[_0x851e('0x2f')];if(!_0x162159[_0x851e('0x2c')][_0x851e('0x33')](_0x851e('0x34'))){_0x35aa58[_0x851e('0x1c')]=qs[_0x851e('0x1c')](_0x162159[_0x851e('0x2c')][_0x851e('0x1c')]);_0x35aa58[_0x851e('0x1a')]=qs[_0x851e('0x1a')](_0x162159[_0x851e('0x2c')][_0x851e('0x1a')]);}_0x35aa58[_0x851e('0x35')]=qs[_0x851e('0x36')](_0x162159[_0x851e('0x2c')][_0x851e('0x36')]);_0x35aa58[_0x851e('0x37')]=qs[_0x851e('0x2e')](_[_0x851e('0x38')](_0x162159[_0x851e('0x2c')],_0x44d898[_0x851e('0x2e')]),_0x36f588);if(_0x162159['query'][_0x851e('0x39')]){_0x35aa58['where']=_[_0x851e('0x3a')](_0x35aa58[_0x851e('0x37')],{'$or':_[_0x851e('0x2b')](_0x36f588,function(_0xd96f4a){if(_0xd96f4a[_0x851e('0x3b')]!=='VIRTUAL'){var _0x1c4742={};_0x1c4742[_0xd96f4a['name']]={'$like':'%'+_0x162159[_0x851e('0x2c')]['filter']+'%'};return _0x1c4742;}})});}_0x35aa58=_[_0x851e('0x3a')]({},_0x35aa58,_0x162159[_0x851e('0x3c')]);var _0x50e138={'where':_0x35aa58[_0x851e('0x37')]};return db[_0x851e('0x3d')]['count'](_0x50e138)[_0x851e('0x25')](function(_0x25f7f8){_0x3c0fc3['count']=_0x25f7f8;if(_0x162159[_0x851e('0x2c')][_0x851e('0x3e')]){_0x35aa58[_0x851e('0x3f')]=[{'all':!![]}];}return db[_0x851e('0x3d')][_0x851e('0x40')](_0x35aa58);})[_0x851e('0x25')](function(_0x50eb1a){_0x3c0fc3['rows']=_0x50eb1a;return _0x3c0fc3;})['then'](respondWithFilteredResult(_0x131a71,_0x35aa58))['catch'](handleError(_0x131a71,null));};exports['show']=function(_0x24bf41,_0x12a3d7){var _0xf674ac={'raw':!![],'where':{'id':_0x24bf41[_0x851e('0x41')]['id']}},_0x333d99={};_0x333d99[_0x851e('0x2f')]=_[_0x851e('0x2d')](db['ZohoField']['rawAttributes']);_0x333d99[_0x851e('0x2c')]=_[_0x851e('0x2d')](_0x24bf41[_0x851e('0x2c')]);_0x333d99[_0x851e('0x2e')]=_[_0x851e('0x31')](_0x333d99[_0x851e('0x2f')],_0x333d99['query']);_0xf674ac[_0x851e('0x30')]=_[_0x851e('0x31')](_0x333d99[_0x851e('0x2f')],qs[_0x851e('0x32')](_0x24bf41[_0x851e('0x2c')]['fields']));_0xf674ac['attributes']=_0xf674ac[_0x851e('0x30')][_0x851e('0x42')]?_0xf674ac['attributes']:_0x333d99[_0x851e('0x2f')];if(_0x24bf41[_0x851e('0x2c')]['includeAll']){_0xf674ac[_0x851e('0x3f')]=[{'all':!![]}];}_0xf674ac=_[_0x851e('0x3a')]({},_0xf674ac,_0x24bf41['options']);return db[_0x851e('0x3d')][_0x851e('0x43')](_0xf674ac)[_0x851e('0x25')](handleEntityNotFound(_0x12a3d7,null))['then'](respondWithResult(_0x12a3d7,null))['catch'](handleError(_0x12a3d7,null));};exports[_0x851e('0x44')]=function(_0x27bc3c,_0x13cb7d){return db[_0x851e('0x3d')]['create'](_0x27bc3c[_0x851e('0x45')],{})[_0x851e('0x25')](respondWithResult(_0x13cb7d,0xc9))[_0x851e('0x46')](handleError(_0x13cb7d,null));};exports['update']=function(_0x50fd66,_0x1b932e){if(_0x50fd66['body']['id']){delete _0x50fd66[_0x851e('0x45')]['id'];}return db[_0x851e('0x3d')][_0x851e('0x43')]({'where':{'id':_0x50fd66['params']['id']}})['then'](handleEntityNotFound(_0x1b932e,null))['then'](saveUpdates(_0x50fd66[_0x851e('0x45')],null))[_0x851e('0x25')](respondWithResult(_0x1b932e,null))[_0x851e('0x46')](handleError(_0x1b932e,null));};exports['destroy']=function(_0x5c38a2,_0x122ce6){return db[_0x851e('0x3d')]['find']({'where':{'id':_0x5c38a2['params']['id']}})[_0x851e('0x25')](handleEntityNotFound(_0x122ce6,null))[_0x851e('0x25')](removeEntity(_0x122ce6,null))[_0x851e('0x46')](handleError(_0x122ce6,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 579de66..525f996 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 _0x4666=['path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x4666,0x162));var _0x6466=function(_0x53a2f2,_0x396930){_0x53a2f2=_0x53a2f2-0x0;var _0x29c11e=_0x4666[_0x53a2f2];return _0x29c11e;};'use strict';var _=require(_0x6466('0x0'));var util=require(_0x6466('0x1'));var logger=require(_0x6466('0x2'))(_0x6466('0x3'));var moment=require(_0x6466('0x4'));var BPromise=require('bluebird');var rp=require(_0x6466('0x5'));var fs=require('fs');var path=require(_0x6466('0x6'));var rimraf=require(_0x6466('0x7'));var config=require(_0x6466('0x8'));var attributes=require(_0x6466('0x9'));module[_0x6466('0xa')]=function(_0x5064bf,_0x494ce0){return _0x5064bf['define'](_0x6466('0xb'),attributes,{'tableName':_0x6466('0xc'),'paranoid':![],'indexes':[{'name':_0x6466('0xd'),'fields':[_0x6466('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ac2=['zoho_unique_index','idField','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','ZohoField','int_zoho_fields'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0x0ac2,0xf9));var _0x20ac=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0ac2[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x20ac('0x0'));var util=require(_0x20ac('0x1'));var logger=require('../../config/logger')(_0x20ac('0x2'));var moment=require(_0x20ac('0x3'));var BPromise=require(_0x20ac('0x4'));var rp=require(_0x20ac('0x5'));var fs=require('fs');var path=require(_0x20ac('0x6'));var rimraf=require(_0x20ac('0x7'));var config=require('../../config/environment');var attributes=require(_0x20ac('0x8'));module['exports']=function(_0xb63591,_0x5431d9){return _0xb63591['define'](_0x20ac('0x9'),attributes,{'tableName':_0x20ac('0xa'),'paranoid':![],'indexes':[{'name':_0x20ac('0xb'),'fields':[_0x20ac('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 98b0a77..806b3db 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x149ea0,_0x1da0d1){var _0x44d444=function(_0x52cf23){while(--_0x52cf23){_0x149ea0['push'](_0x149ea0['shift']());}};_0x44d444(++_0x1da0d1);}(_0xa41a,0x6b));var _0xaa41=function(_0xf6560c,_0x4a37b5){_0xf6560c=_0xf6560c-0x0;var _0x160ee0=_0xa41a[_0xf6560c];return _0x160ee0;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0xd0bb=['debug','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x39eaa7,_0x42cc09){var _0x50e10=function(_0x2a5881){while(--_0x2a5881){_0x39eaa7['push'](_0x39eaa7['shift']());}};_0x50e10(++_0x42cc09);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x40a73a,_0x4d3623){_0x40a73a=_0x40a73a-0x0;var _0x46e6cb=_0xd0bb[_0x40a73a];return _0x46e6cb;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('ZohoField,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index bbbc8d4..43e1d7a 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 _0x9c32=['util','path','express','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c32,0x15d));var _0x29c3=function(_0x496a10,_0x59b8a2){_0x496a10=_0x496a10-0x0;var _0x26f615=_0x9c32[_0x496a10];return _0x26f615;};'use strict';var multer=require(_0x29c3('0x0'));var util=require(_0x29c3('0x1'));var path=require(_0x29c3('0x2'));var timeout=require('connect-timeout');var express=require(_0x29c3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x29c3('0x4'));var interaction=require(_0x29c3('0x5'));var config=require('../../config/environment');module[_0x29c3('0x6')]=router; \ No newline at end of file +var _0x9173=['Router','../../components/auth/service','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x52bfa5,_0x42cf21){var _0x26f80b=function(_0x73c5b0){while(--_0x73c5b0){_0x52bfa5['push'](_0x52bfa5['shift']());}};_0x26f80b(++_0x42cf21);}(_0x9173,0xb4));var _0x3917=function(_0x4d8476,_0x47eb74){_0x4d8476=_0x4d8476-0x0;var _0x444cb8=_0x9173[_0x4d8476];return _0x444cb8;};'use strict';var multer=require(_0x3917('0x0'));var util=require(_0x3917('0x1'));var path=require('path');var timeout=require(_0x3917('0x2'));var express=require(_0x3917('0x3'));var router=express[_0x3917('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3917('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3917('0x6'));module[_0x3917('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 33352f2..a0d1960 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 _0x9b80=['exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x9b80,0x1d7));var _0x09b8=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0x9b80[_0x21c2c8];return _0x4dd745;};'use strict';var Sequelize=require(_0x09b8('0x0'));module[_0x09b8('0x1')]={'name':{'type':Sequelize[_0x09b8('0x2')],'allowNull':![],'unique':_0x09b8('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x09b8('0x3')},'main':{'type':Sequelize[_0x09b8('0x2')],'defaultValue':_0x09b8('0x4')},'filename':{'type':Sequelize[_0x09b8('0x2')]},'path':{'type':Sequelize[_0x09b8('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x09b8('0x5')]},'active':{'type':Sequelize[_0x09b8('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x09b8('0x2')]},'state':{'type':Sequelize[_0x09b8('0x2')],'unique':_0x09b8('0x7')},'description':{'type':Sequelize[_0x09b8('0x2')]},'title':{'type':Sequelize[_0x09b8('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x09b8('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xa3af=['unique_name_and_version','app.js','INTEGER','state','sequelize','exports','STRING'];(function(_0x16ad2a,_0x5929eb){var _0x486e3f=function(_0xfa6eeb){while(--_0xfa6eeb){_0x16ad2a['push'](_0x16ad2a['shift']());}};_0x486e3f(++_0x5929eb);}(_0xa3af,0x100));var _0xfa3a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa3af[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xfa3a('0x0'));module[_0xfa3a('0x1')]={'name':{'type':Sequelize[_0xfa3a('0x2')],'allowNull':![],'unique':_0xfa3a('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfa3a('0x3')},'main':{'type':Sequelize[_0xfa3a('0x2')],'defaultValue':_0xfa3a('0x4')},'filename':{'type':Sequelize[_0xfa3a('0x2')]},'path':{'type':Sequelize[_0xfa3a('0x2')]},'type':{'type':Sequelize[_0xfa3a('0x2')]},'size':{'type':Sequelize[_0xfa3a('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xfa3a('0x2')]},'logo':{'type':Sequelize[_0xfa3a('0x2')]},'state':{'type':Sequelize[_0xfa3a('0x2')],'unique':_0xfa3a('0x6')},'description':{'type':Sequelize[_0xfa3a('0x2')]},'title':{'type':Sequelize[_0xfa3a('0x2')]},'remoteUri':{'type':Sequelize[_0xfa3a('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 5629a02..efca5d8 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 _0x3c3b=['find','catch','create','body','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','findAll','rows','includeAll','include'];(function(_0x736599,_0x3fe8bb){var _0x3c5723=function(_0x58d468){while(--_0x58d468){_0x736599['push'](_0x736599['shift']());}};_0x3c5723(++_0x3fe8bb);}(_0x3c3b,0x1d9));var _0xb3c3=function(_0x3fe498,_0x287637){_0x3fe498=_0x3fe498-0x0;var _0x49c024=_0x3c3b[_0x3fe498];return _0x49c024;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3c3('0x0'));var zipdir=require(_0xb3c3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3c3('0x2'));var moment=require(_0xb3c3('0x3'));var BPromise=require(_0xb3c3('0x4'));var Mustache=require(_0xb3c3('0x5'));var util=require(_0xb3c3('0x6'));var path=require(_0xb3c3('0x7'));var sox=require(_0xb3c3('0x8'));var csv=require(_0xb3c3('0x9'));var ejs=require(_0xb3c3('0xa'));var fs=require('fs');var fs_extra=require(_0xb3c3('0xb'));var _=require(_0xb3c3('0xc'));var squel=require(_0xb3c3('0xd'));var crypto=require(_0xb3c3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb3c3('0xf'));var toCsv=require(_0xb3c3('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb3c3('0x10'));var authService=require(_0xb3c3('0x11'));var qs=require(_0xb3c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3c3('0x13'));var logger=require(_0xb3c3('0x14'))(_0xb3c3('0x15'));var utils=require(_0xb3c3('0x16'));var config=require(_0xb3c3('0x17'));var licenseUtil=require(_0xb3c3('0x18'));var db=require(_0xb3c3('0x19'))['db'];function respondWithStatusCode(_0x192695,_0x2a5c0e){_0x2a5c0e=_0x2a5c0e||0xcc;return function(_0x32c069){if(_0x32c069){return _0x192695[_0xb3c3('0x1a')](_0x2a5c0e);}return _0x192695[_0xb3c3('0x1b')](_0x2a5c0e)['end']();};}function respondWithResult(_0x4c644c,_0x33cb72){_0x33cb72=_0x33cb72||0xc8;return function(_0x26b89f){if(_0x26b89f){return _0x4c644c['status'](_0x33cb72)[_0xb3c3('0x1c')](_0x26b89f);}};}function respondWithFilteredResult(_0x519a0c,_0x17af84){return function(_0x49da1d){if(_0x49da1d){var _0x381910=typeof _0x17af84['offset']==='undefined'&&typeof _0x17af84[_0xb3c3('0x1d')]===_0xb3c3('0x1e');var _0x50e584=_0x49da1d[_0xb3c3('0x1f')];var _0x10cafa=_0x381910?0x0:_0x17af84[_0xb3c3('0x20')];var _0x2e2e92=_0x381910?_0x49da1d[_0xb3c3('0x1f')]:_0x17af84[_0xb3c3('0x20')]+_0x17af84[_0xb3c3('0x1d')];var _0x5b24ca;if(_0x2e2e92>=_0x50e584){_0x2e2e92=_0x50e584;_0x5b24ca=0xc8;}else{_0x5b24ca=0xce;}_0x519a0c[_0xb3c3('0x1b')](_0x5b24ca);return _0x519a0c[_0xb3c3('0x21')](_0xb3c3('0x22'),_0x10cafa+'-'+_0x2e2e92+'/'+_0x50e584)[_0xb3c3('0x1c')](_0x49da1d);}return null;};}function patchUpdates(_0x5df7f3){return function(_0x447716){try{jsonpatch[_0xb3c3('0x23')](_0x447716,_0x5df7f3,!![]);}catch(_0x292d5d){return BPromise[_0xb3c3('0x24')](_0x292d5d);}return _0x447716[_0xb3c3('0x25')]();};}function saveUpdates(_0xe4c81a,_0xf00ef9){return function(_0x264391){if(_0x264391){return _0x264391[_0xb3c3('0x26')](_0xe4c81a)[_0xb3c3('0x27')](function(_0x2a3ba9){return _0x2a3ba9;});}return null;};}function removeEntity(_0xf94c78,_0x3df62c){return function(_0x390df1){if(_0x390df1){return _0x390df1[_0xb3c3('0x28')]()[_0xb3c3('0x27')](function(){_0xf94c78[_0xb3c3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x449fb0,_0x189906){return function(_0x45b37d){if(!_0x45b37d){_0x449fb0[_0xb3c3('0x1a')](0x194);}return _0x45b37d;};}function handleError(_0x572127,_0x1497f4){_0x1497f4=_0x1497f4||0x1f4;return function(_0x4738c5){logger[_0xb3c3('0x29')](_0x4738c5[_0xb3c3('0x2a')]);if(_0x4738c5[_0xb3c3('0x2b')]){delete _0x4738c5['name'];}_0x572127[_0xb3c3('0x1b')](_0x1497f4)[_0xb3c3('0x2c')](_0x4738c5);};}exports[_0xb3c3('0x2d')]=function(_0x23074e,_0x3ebda5){var _0x205be8={},_0x1e6ef3={},_0x115615={'count':0x0,'rows':[]};var _0x4cdb27=_[_0xb3c3('0x2e')](db[_0xb3c3('0x2f')][_0xb3c3('0x30')],function(_0x436898){return{'name':_0x436898[_0xb3c3('0x31')],'type':_0x436898['type'][_0xb3c3('0x32')]};});_0x1e6ef3['model']=_[_0xb3c3('0x2e')](_0x4cdb27,'name');_0x1e6ef3[_0xb3c3('0x33')]=_[_0xb3c3('0x34')](_0x23074e[_0xb3c3('0x33')]);_0x1e6ef3[_0xb3c3('0x35')]=_[_0xb3c3('0x36')](_0x1e6ef3[_0xb3c3('0x37')],_0x1e6ef3['query']);_0x205be8[_0xb3c3('0x38')]=_[_0xb3c3('0x36')](_0x1e6ef3['model'],qs['fields'](_0x23074e['query'][_0xb3c3('0x39')]));_0x205be8[_0xb3c3('0x38')]=_0x205be8[_0xb3c3('0x38')][_0xb3c3('0x3a')]?_0x205be8['attributes']:_0x1e6ef3[_0xb3c3('0x37')];if(!_0x23074e[_0xb3c3('0x33')][_0xb3c3('0x3b')](_0xb3c3('0x3c'))){_0x205be8[_0xb3c3('0x1d')]=qs[_0xb3c3('0x1d')](_0x23074e[_0xb3c3('0x33')]['limit']);_0x205be8['offset']=qs['offset'](_0x23074e[_0xb3c3('0x33')][_0xb3c3('0x20')]);}_0x205be8[_0xb3c3('0x3d')]=qs[_0xb3c3('0x3e')](_0x23074e[_0xb3c3('0x33')]['sort']);_0x205be8[_0xb3c3('0x3f')]=qs[_0xb3c3('0x35')](_[_0xb3c3('0x40')](_0x23074e['query'],_0x1e6ef3['filters']),_0x4cdb27);if(_0x23074e['query']['filter']){_0x205be8['where']=_[_0xb3c3('0x41')](_0x205be8[_0xb3c3('0x3f')],{'$or':_['map'](_0x4cdb27,function(_0x88169d){if(_0x88169d[_0xb3c3('0x42')]!==_0xb3c3('0x43')){var _0x408fcd={};_0x408fcd[_0x88169d[_0xb3c3('0x2b')]]={'$like':'%'+_0x23074e[_0xb3c3('0x33')]['filter']+'%'};return _0x408fcd;}})});}_0x205be8=_['merge']({},_0x205be8,_0x23074e[_0xb3c3('0x44')]);var _0x590532={'where':_0x205be8[_0xb3c3('0x3f')]};return db['Integration'][_0xb3c3('0x1f')](_0x590532)[_0xb3c3('0x27')](function(_0xfe538d){_0x115615[_0xb3c3('0x1f')]=_0xfe538d;if(_0x23074e['query']['includeAll']){_0x205be8['include']=[{'all':!![]}];}return db[_0xb3c3('0x2f')][_0xb3c3('0x45')](_0x205be8);})['then'](function(_0x433451){_0x115615[_0xb3c3('0x46')]=_0x433451;return _0x115615;})['then'](respondWithFilteredResult(_0x3ebda5,_0x205be8))['catch'](handleError(_0x3ebda5,null));};exports['show']=function(_0x5de4c3,_0x250ce6){var _0x2012fc={'raw':![],'where':{'id':_0x5de4c3['params']['id']}},_0x4ff391={};_0x4ff391[_0xb3c3('0x37')]=_[_0xb3c3('0x34')](db[_0xb3c3('0x2f')][_0xb3c3('0x30')]);_0x4ff391[_0xb3c3('0x33')]=_[_0xb3c3('0x34')](_0x5de4c3[_0xb3c3('0x33')]);_0x4ff391[_0xb3c3('0x35')]=_[_0xb3c3('0x36')](_0x4ff391[_0xb3c3('0x37')],_0x4ff391['query']);_0x2012fc[_0xb3c3('0x38')]=_[_0xb3c3('0x36')](_0x4ff391[_0xb3c3('0x37')],qs['fields'](_0x5de4c3[_0xb3c3('0x33')][_0xb3c3('0x39')]));_0x2012fc[_0xb3c3('0x38')]=_0x2012fc[_0xb3c3('0x38')][_0xb3c3('0x3a')]?_0x2012fc['attributes']:_0x4ff391[_0xb3c3('0x37')];if(_0x5de4c3[_0xb3c3('0x33')][_0xb3c3('0x47')]){_0x2012fc[_0xb3c3('0x48')]=[{'all':!![]}];}_0x2012fc=_['merge']({},_0x2012fc,_0x5de4c3[_0xb3c3('0x44')]);return db[_0xb3c3('0x2f')][_0xb3c3('0x49')](_0x2012fc)['then'](handleEntityNotFound(_0x250ce6,null))[_0xb3c3('0x27')](respondWithResult(_0x250ce6,null))[_0xb3c3('0x4a')](handleError(_0x250ce6,null));};exports[_0xb3c3('0x4b')]=function(_0x42c9aa,_0x110d72){return db[_0xb3c3('0x2f')]['create'](_0x42c9aa[_0xb3c3('0x4c')],{})[_0xb3c3('0x27')](respondWithResult(_0x110d72,0xc9))[_0xb3c3('0x4a')](handleError(_0x110d72,null));};exports[_0xb3c3('0x26')]=function(_0x133aa6,_0x4b41cf){if(_0x133aa6[_0xb3c3('0x4c')]['id']){delete _0x133aa6[_0xb3c3('0x4c')]['id'];}return db[_0xb3c3('0x2f')][_0xb3c3('0x49')]({'where':{'id':_0x133aa6[_0xb3c3('0x4d')]['id']}})[_0xb3c3('0x27')](handleEntityNotFound(_0x4b41cf,null))[_0xb3c3('0x27')](saveUpdates(_0x133aa6['body'],null))[_0xb3c3('0x27')](respondWithResult(_0x4b41cf,null))['catch'](handleError(_0x4b41cf,null));};exports['destroy']=function(_0x40ca6a,_0x1ed1b4){return db[_0xb3c3('0x2f')][_0xb3c3('0x49')]({'where':{'id':_0x40ca6a[_0xb3c3('0x4d')]['id']}})[_0xb3c3('0x27')](handleEntityNotFound(_0x1ed1b4,null))['then'](removeEntity(_0x1ed1b4,null))[_0xb3c3('0x4a')](handleError(_0x1ed1b4,null));}; \ No newline at end of file +var _0x7a10=['fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','reject','update','then','destroy','error','name','send','index','Integration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','show','includeAll','find','create','body','catch','params','rimraf','zip-dir'];(function(_0x459ff5,_0x112d74){var _0x1ac7cb=function(_0x19ec9f){while(--_0x19ec9f){_0x459ff5['push'](_0x459ff5['shift']());}};_0x1ac7cb(++_0x112d74);}(_0x7a10,0x1ae));var _0x07a1=function(_0x484f88,_0x1a61b7){_0x484f88=_0x484f88-0x0;var _0x2a2a13=_0x7a10[_0x484f88];return _0x2a2a13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07a1('0x0'));var zipdir=require(_0x07a1('0x1'));var jsonpatch=require(_0x07a1('0x2'));var rp=require('request-promise');var moment=require(_0x07a1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x07a1('0x4'));var util=require(_0x07a1('0x5'));var path=require(_0x07a1('0x6'));var sox=require('sox');var csv=require(_0x07a1('0x7'));var ejs=require(_0x07a1('0x8'));var fs=require('fs');var fs_extra=require(_0x07a1('0x9'));var _=require(_0x07a1('0xa'));var squel=require('squel');var crypto=require(_0x07a1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x07a1('0xc'));var toCsv=require(_0x07a1('0x7'));var querystring=require(_0x07a1('0xd'));var Papa=require(_0x07a1('0xe'));var Redis=require(_0x07a1('0xf'));var authService=require(_0x07a1('0x10'));var qs=require(_0x07a1('0x11'));var as=require(_0x07a1('0x12'));var hardwareService=require(_0x07a1('0x13'));var logger=require(_0x07a1('0x14'))(_0x07a1('0x15'));var utils=require(_0x07a1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x07a1('0x17'));var db=require(_0x07a1('0x18'))['db'];function respondWithStatusCode(_0x3b7313,_0x7253e3){_0x7253e3=_0x7253e3||0xcc;return function(_0x569c8f){if(_0x569c8f){return _0x3b7313[_0x07a1('0x19')](_0x7253e3);}return _0x3b7313['status'](_0x7253e3)[_0x07a1('0x1a')]();};}function respondWithResult(_0x40644c,_0xfcd9eb){_0xfcd9eb=_0xfcd9eb||0xc8;return function(_0x3f86cb){if(_0x3f86cb){return _0x40644c[_0x07a1('0x1b')](_0xfcd9eb)[_0x07a1('0x1c')](_0x3f86cb);}};}function respondWithFilteredResult(_0x53b1fe,_0x3fd348){return function(_0x431081){if(_0x431081){var _0xa7bc1=typeof _0x3fd348[_0x07a1('0x1d')]===_0x07a1('0x1e')&&typeof _0x3fd348['limit']==='undefined';var _0x402aa9=_0x431081[_0x07a1('0x1f')];var _0x4ff397=_0xa7bc1?0x0:_0x3fd348['offset'];var _0x697b6f=_0xa7bc1?_0x431081['count']:_0x3fd348[_0x07a1('0x1d')]+_0x3fd348['limit'];var _0x5e85b3;if(_0x697b6f>=_0x402aa9){_0x697b6f=_0x402aa9;_0x5e85b3=0xc8;}else{_0x5e85b3=0xce;}_0x53b1fe[_0x07a1('0x1b')](_0x5e85b3);return _0x53b1fe['set']('Content-Range',_0x4ff397+'-'+_0x697b6f+'/'+_0x402aa9)[_0x07a1('0x1c')](_0x431081);}return null;};}function patchUpdates(_0x2e88a7){return function(_0x4e9ff5){try{jsonpatch['apply'](_0x4e9ff5,_0x2e88a7,!![]);}catch(_0x16bbbe){return BPromise[_0x07a1('0x20')](_0x16bbbe);}return _0x4e9ff5['save']();};}function saveUpdates(_0xc9f3fc,_0x522e13){return function(_0x3e6c33){if(_0x3e6c33){return _0x3e6c33[_0x07a1('0x21')](_0xc9f3fc)[_0x07a1('0x22')](function(_0x211f6c){return _0x211f6c;});}return null;};}function removeEntity(_0x2a8cf5,_0x5a6ca3){return function(_0x27c26e){if(_0x27c26e){return _0x27c26e[_0x07a1('0x23')]()[_0x07a1('0x22')](function(){_0x2a8cf5[_0x07a1('0x1b')](0xcc)[_0x07a1('0x1a')]();});}};}function handleEntityNotFound(_0x24a290,_0x329c0b){return function(_0x12ede3){if(!_0x12ede3){_0x24a290[_0x07a1('0x19')](0x194);}return _0x12ede3;};}function handleError(_0x27cdd9,_0x14ed4b){_0x14ed4b=_0x14ed4b||0x1f4;return function(_0x3dca39){logger[_0x07a1('0x24')](_0x3dca39['stack']);if(_0x3dca39['name']){delete _0x3dca39[_0x07a1('0x25')];}_0x27cdd9[_0x07a1('0x1b')](_0x14ed4b)[_0x07a1('0x26')](_0x3dca39);};}exports[_0x07a1('0x27')]=function(_0x42c424,_0x4ad149){var _0x472d80={},_0x17130a={},_0x161c94={'count':0x0,'rows':[]};var _0x3e539d=_['map'](db[_0x07a1('0x28')][_0x07a1('0x29')],function(_0x4c1856){return{'name':_0x4c1856[_0x07a1('0x2a')],'type':_0x4c1856[_0x07a1('0x2b')][_0x07a1('0x2c')]};});_0x17130a[_0x07a1('0x2d')]=_[_0x07a1('0x2e')](_0x3e539d,_0x07a1('0x25'));_0x17130a[_0x07a1('0x2f')]=_[_0x07a1('0x30')](_0x42c424['query']);_0x17130a[_0x07a1('0x31')]=_[_0x07a1('0x32')](_0x17130a['model'],_0x17130a[_0x07a1('0x2f')]);_0x472d80['attributes']=_[_0x07a1('0x32')](_0x17130a['model'],qs[_0x07a1('0x33')](_0x42c424[_0x07a1('0x2f')][_0x07a1('0x33')]));_0x472d80['attributes']=_0x472d80[_0x07a1('0x34')][_0x07a1('0x35')]?_0x472d80['attributes']:_0x17130a[_0x07a1('0x2d')];if(!_0x42c424[_0x07a1('0x2f')][_0x07a1('0x36')]('nolimit')){_0x472d80['limit']=qs[_0x07a1('0x37')](_0x42c424['query'][_0x07a1('0x37')]);_0x472d80[_0x07a1('0x1d')]=qs[_0x07a1('0x1d')](_0x42c424[_0x07a1('0x2f')][_0x07a1('0x1d')]);}_0x472d80[_0x07a1('0x38')]=qs[_0x07a1('0x39')](_0x42c424[_0x07a1('0x2f')][_0x07a1('0x39')]);_0x472d80[_0x07a1('0x3a')]=qs[_0x07a1('0x31')](_['pick'](_0x42c424['query'],_0x17130a[_0x07a1('0x31')]),_0x3e539d);if(_0x42c424[_0x07a1('0x2f')][_0x07a1('0x3b')]){_0x472d80['where']=_[_0x07a1('0x3c')](_0x472d80[_0x07a1('0x3a')],{'$or':_['map'](_0x3e539d,function(_0x51350e){if(_0x51350e[_0x07a1('0x2b')]!==_0x07a1('0x3d')){var _0x46791a={};_0x46791a[_0x51350e['name']]={'$like':'%'+_0x42c424[_0x07a1('0x2f')][_0x07a1('0x3b')]+'%'};return _0x46791a;}})});}_0x472d80=_[_0x07a1('0x3c')]({},_0x472d80,_0x42c424[_0x07a1('0x3e')]);var _0x43d5f6={'where':_0x472d80[_0x07a1('0x3a')]};return db[_0x07a1('0x28')]['count'](_0x43d5f6)[_0x07a1('0x22')](function(_0x5705a0){_0x161c94[_0x07a1('0x1f')]=_0x5705a0;if(_0x42c424[_0x07a1('0x2f')]['includeAll']){_0x472d80[_0x07a1('0x3f')]=[{'all':!![]}];}return db[_0x07a1('0x28')][_0x07a1('0x40')](_0x472d80);})[_0x07a1('0x22')](function(_0x42a039){_0x161c94['rows']=_0x42a039;return _0x161c94;})[_0x07a1('0x22')](respondWithFilteredResult(_0x4ad149,_0x472d80))['catch'](handleError(_0x4ad149,null));};exports[_0x07a1('0x41')]=function(_0x8622a8,_0x39f5a4){var _0x46effc={'raw':![],'where':{'id':_0x8622a8['params']['id']}},_0x3ec277={};_0x3ec277[_0x07a1('0x2d')]=_[_0x07a1('0x30')](db[_0x07a1('0x28')][_0x07a1('0x29')]);_0x3ec277[_0x07a1('0x2f')]=_['keys'](_0x8622a8[_0x07a1('0x2f')]);_0x3ec277[_0x07a1('0x31')]=_[_0x07a1('0x32')](_0x3ec277['model'],_0x3ec277[_0x07a1('0x2f')]);_0x46effc[_0x07a1('0x34')]=_['intersection'](_0x3ec277[_0x07a1('0x2d')],qs[_0x07a1('0x33')](_0x8622a8['query'][_0x07a1('0x33')]));_0x46effc[_0x07a1('0x34')]=_0x46effc[_0x07a1('0x34')]['length']?_0x46effc[_0x07a1('0x34')]:_0x3ec277[_0x07a1('0x2d')];if(_0x8622a8[_0x07a1('0x2f')][_0x07a1('0x42')]){_0x46effc['include']=[{'all':!![]}];}_0x46effc=_['merge']({},_0x46effc,_0x8622a8[_0x07a1('0x3e')]);return db[_0x07a1('0x28')][_0x07a1('0x43')](_0x46effc)[_0x07a1('0x22')](handleEntityNotFound(_0x39f5a4,null))[_0x07a1('0x22')](respondWithResult(_0x39f5a4,null))['catch'](handleError(_0x39f5a4,null));};exports[_0x07a1('0x44')]=function(_0x354352,_0x4ae1fe){return db['Integration']['create'](_0x354352[_0x07a1('0x45')],{})[_0x07a1('0x22')](respondWithResult(_0x4ae1fe,0xc9))[_0x07a1('0x46')](handleError(_0x4ae1fe,null));};exports[_0x07a1('0x21')]=function(_0x54d466,_0x5ec61a){if(_0x54d466['body']['id']){delete _0x54d466[_0x07a1('0x45')]['id'];}return db['Integration'][_0x07a1('0x43')]({'where':{'id':_0x54d466[_0x07a1('0x47')]['id']}})[_0x07a1('0x22')](handleEntityNotFound(_0x5ec61a,null))[_0x07a1('0x22')](saveUpdates(_0x54d466[_0x07a1('0x45')],null))[_0x07a1('0x22')](respondWithResult(_0x5ec61a,null))['catch'](handleError(_0x5ec61a,null));};exports['destroy']=function(_0x26d827,_0x1930ad){return db['Integration'][_0x07a1('0x43')]({'where':{'id':_0x26d827[_0x07a1('0x47')]['id']}})['then'](handleEntityNotFound(_0x1930ad,null))[_0x07a1('0x22')](removeEntity(_0x1930ad,null))[_0x07a1('0x46')](handleError(_0x1930ad,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 06b8b39..d156a13 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 _0xd9e2=['exports','Integration','integrations','../../config/logger','api','bluebird','rimraf','../../config/environment','./integration.attributes'];(function(_0x33e172,_0x2b4d45){var _0x31427f=function(_0x353e2a){while(--_0x353e2a){_0x33e172['push'](_0x33e172['shift']());}};_0x31427f(++_0x2b4d45);}(_0xd9e2,0xff));var _0x2d9e=function(_0x31717d,_0x3a530f){_0x31717d=_0x31717d-0x0;var _0x5a5f65=_0xd9e2[_0x31717d];return _0x5a5f65;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d9e('0x0'))(_0x2d9e('0x1'));var moment=require('moment');var BPromise=require(_0x2d9e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2d9e('0x3'));var config=require(_0x2d9e('0x4'));var attributes=require(_0x2d9e('0x5'));module[_0x2d9e('0x6')]=function(_0x4d1405,_0x14e992){return _0x4d1405['define'](_0x2d9e('0x7'),attributes,{'tableName':_0x2d9e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x297b=['request-promise','path','rimraf','../../config/environment','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x47409b,_0x32279e){var _0x417420=function(_0x477d3e){while(--_0x477d3e){_0x47409b['push'](_0x47409b['shift']());}};_0x417420(++_0x32279e);}(_0x297b,0x19f));var _0xb297=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x297b[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require(_0xb297('0x0'));var util=require(_0xb297('0x1'));var logger=require(_0xb297('0x2'))('api');var moment=require(_0xb297('0x3'));var BPromise=require(_0xb297('0x4'));var rp=require(_0xb297('0x5'));var fs=require('fs');var path=require(_0xb297('0x6'));var rimraf=require(_0xb297('0x7'));var config=require(_0xb297('0x8'));var attributes=require('./integration.attributes');module['exports']=function(_0x12d205,_0x4d16b4){return _0x12d205[_0xb297('0x9')]('Integration',attributes,{'tableName':'integrations','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 3b9957e..b577160 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 _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x7bae,0x13b));var _0xe7ba=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x7bae[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('Integration,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('Integration,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file +var _0xba2d=['catch','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug','error','code','message','result'];(function(_0xaa9ef6,_0x416959){var _0x5a638b=function(_0x1f5972){while(--_0x1f5972){_0xaa9ef6['push'](_0xaa9ef6['shift']());}};_0x5a638b(++_0x416959);}(_0xba2d,0xa3));var _0xdba2=function(_0x24769d,_0x125031){_0x24769d=_0x24769d-0x0;var _0x5b38eb=_0xba2d[_0x24769d];return _0x5b38eb;};'use strict';var _=require('lodash');var util=require(_0xdba2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdba2('0x1'));var logger=require(_0xdba2('0x2'))(_0xdba2('0x3'));var config=require(_0xdba2('0x4'));var jayson=require(_0xdba2('0x5'));var client=jayson[_0xdba2('0x6')][_0xdba2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x30328d,_0x4ead61,_0x3ab6cf){return new BPromise(function(_0x544945,_0x159887){return client[_0xdba2('0x8')](_0x30328d,_0x3ab6cf)[_0xdba2('0x9')](function(_0x3b1d25){logger[_0xdba2('0xa')](_0xdba2('0xb'),_0x4ead61,'request\x20sent');logger[_0xdba2('0xc')]('Integration,\x20%s,\x20%s,\x20%s',_0x4ead61,'request\x20sent',JSON['stringify'](_0x3b1d25));if(_0x3b1d25[_0xdba2('0xd')]){if(_0x3b1d25[_0xdba2('0xd')][_0xdba2('0xe')]===0x1f4){logger[_0xdba2('0xd')](_0xdba2('0xb'),_0x4ead61,_0x3b1d25[_0xdba2('0xd')][_0xdba2('0xf')]);return _0x159887(_0x3b1d25[_0xdba2('0xd')][_0xdba2('0xf')]);}logger[_0xdba2('0xd')](_0xdba2('0xb'),_0x4ead61,_0x3b1d25[_0xdba2('0xd')][_0xdba2('0xf')]);return _0x544945(_0x3b1d25[_0xdba2('0xd')][_0xdba2('0xf')]);}else{logger[_0xdba2('0xa')]('Integration,\x20%s,\x20%s',_0x4ead61,'request\x20sent');_0x544945(_0x3b1d25[_0xdba2('0x10')]['message']);}})[_0xdba2('0x11')](function(_0xc69b24){logger['error'](_0xdba2('0xb'),_0x4ead61,_0xc69b24);_0x159887(_0xc69b24);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index eb5e6d1..2d7ebb7 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 _0xa972=['../../config/environment','./integrationReport.controller','isAuthenticated','index','get','describe','/:id','show','post','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4b320f,_0x30ec35){var _0x5e35c2=function(_0x2c3c0e){while(--_0x2c3c0e){_0x4b320f['push'](_0x4b320f['shift']());}};_0x5e35c2(++_0x30ec35);}(_0xa972,0x1b4));var _0x2a97=function(_0x4454ed,_0x1c0d93){_0x4454ed=_0x4454ed-0x0;var _0x344c18=_0xa972[_0x4454ed];return _0x344c18;};'use strict';var multer=require(_0x2a97('0x0'));var util=require('util');var path=require(_0x2a97('0x1'));var timeout=require(_0x2a97('0x2'));var express=require('express');var router=express[_0x2a97('0x3')]();var fs_extra=require(_0x2a97('0x4'));var auth=require(_0x2a97('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2a97('0x6'));var controller=require(_0x2a97('0x7'));router['get']('/',auth[_0x2a97('0x8')](),controller[_0x2a97('0x9')]);router[_0x2a97('0xa')]('/describe',auth[_0x2a97('0x8')](),controller[_0x2a97('0xb')]);router[_0x2a97('0xa')](_0x2a97('0xc'),auth[_0x2a97('0x8')](),controller[_0x2a97('0xd')]);router[_0x2a97('0xe')]('/',auth[_0x2a97('0x8')](),controller['create']);router['put']('/:id',auth[_0x2a97('0x8')](),controller[_0x2a97('0xf')]);router['delete']('/:id',auth[_0x2a97('0x8')](),controller['destroy']);module[_0x2a97('0x10')]=router; \ No newline at end of file +var _0xd8bc=['describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0xd8bc,0x172));var _0xcd8b=function(_0x40a872,_0x41618a){_0x40a872=_0x40a872-0x0;var _0x5e75bb=_0xd8bc[_0x40a872];return _0x5e75bb;};'use strict';var multer=require(_0xcd8b('0x0'));var util=require(_0xcd8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcd8b('0x2'));var router=express['Router']();var fs_extra=require(_0xcd8b('0x3'));var auth=require(_0xcd8b('0x4'));var interaction=require(_0xcd8b('0x5'));var config=require(_0xcd8b('0x6'));var controller=require(_0xcd8b('0x7'));router[_0xcd8b('0x8')]('/',auth[_0xcd8b('0x9')](),controller['index']);router[_0xcd8b('0x8')]('/describe',auth[_0xcd8b('0x9')](),controller[_0xcd8b('0xa')]);router['get']('/:id',auth[_0xcd8b('0x9')](),controller['show']);router[_0xcd8b('0xb')]('/',auth[_0xcd8b('0x9')](),controller[_0xcd8b('0xc')]);router[_0xcd8b('0xd')](_0xcd8b('0xe'),auth[_0xcd8b('0x9')](),controller[_0xcd8b('0xf')]);router[_0xcd8b('0x10')](_0xcd8b('0xe'),auth[_0xcd8b('0x9')](),controller[_0xcd8b('0x11')]);module[_0xcd8b('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 eef09e2..77f010c 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 _0x8235=['DATE','BOOLEAN','TEXT','SENDING','FAILED','sequelize','exports','STRING','INTEGER'];(function(_0x11047f,_0x305247){var _0x22399e=function(_0x31a010){while(--_0x31a010){_0x11047f['push'](_0x11047f['shift']());}};_0x22399e(++_0x305247);}(_0x8235,0xf8));var _0x5823=function(_0x4bb5bd,_0x6c079a){_0x4bb5bd=_0x4bb5bd-0x0;var _0x4abc38=_0x8235[_0x4bb5bd];return _0x4abc38;};'use strict';var Sequelize=require(_0x5823('0x0'));module[_0x5823('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x5823('0x2')]},'exitStatus':{'type':Sequelize[_0x5823('0x2')]},'ticketId':{'type':Sequelize[_0x5823('0x2')]},'integrationId':{'type':Sequelize[_0x5823('0x3')]},'contacts':{'type':Sequelize[_0x5823('0x2')]},'uniqueid':{'type':Sequelize[_0x5823('0x2')]},'calleridnum':{'type':Sequelize[_0x5823('0x2')]},'calleridname':{'type':Sequelize[_0x5823('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x5823('0x2')]},'membername':{'type':Sequelize[_0x5823('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5823('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x5823('0x3')]},'agentcomplete':{'type':Sequelize[_0x5823('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5823('0x4')]},'talktime':{'type':Sequelize[_0x5823('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5823('0x3')]},'reason':{'type':Sequelize[_0x5823('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x5823('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x5823('0x4')]},'agentdump':{'type':Sequelize[_0x5823('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x5823('0x2')]},'channel':{'type':Sequelize[_0x5823('0x2')]},'channelstate':{'type':Sequelize[_0x5823('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5823('0x2')]},'connectedlinename':{'type':Sequelize[_0x5823('0x2')]},'language':{'type':Sequelize[_0x5823('0x2')]},'accountcode':{'type':Sequelize[_0x5823('0x2')]},'context':{'type':Sequelize[_0x5823('0x2')]},'exten':{'type':Sequelize[_0x5823('0x2')]},'priority':{'type':Sequelize[_0x5823('0x2')]},'destchannel':{'type':Sequelize[_0x5823('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x5823('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5823('0x2')]},'destcalleridname':{'type':Sequelize[_0x5823('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x5823('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x5823('0x2')]},'destlanguage':{'type':Sequelize[_0x5823('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x5823('0x2')]},'destpriority':{'type':Sequelize[_0x5823('0x2')]},'destuniqueid':{'type':Sequelize[_0x5823('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x5823('0x2')]},'subject':{'type':Sequelize[_0x5823('0x2')]},'from':{'type':Sequelize[_0x5823('0x2')]},'to':{'type':Sequelize[_0x5823('0x2')]},'cc':{'type':Sequelize[_0x5823('0x2')]},'attachment':{'type':Sequelize[_0x5823('0x6')]},'html':{'type':Sequelize[_0x5823('0x6')]},'text':{'type':Sequelize[_0x5823('0x6')]},'status':{'type':Sequelize['ENUM']('SENT',_0x5823('0x7'),'RECEIVED',_0x5823('0x8'))},'url':{'type':Sequelize[_0x5823('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x5823('0x2')]},'projectId':{'type':Sequelize[_0x5823('0x3')]}}; \ No newline at end of file +var _0x4777=['INTEGER','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE'];(function(_0x455788,_0x21454e){var _0x463b56=function(_0x1dfe9){while(--_0x1dfe9){_0x455788['push'](_0x455788['shift']());}};_0x463b56(++_0x21454e);}(_0x4777,0x80));var _0x7477=function(_0x52b24f,_0xca062d){_0x52b24f=_0x52b24f-0x0;var _0x46ea6b=_0x4777[_0x52b24f];return _0x46ea6b;};'use strict';var Sequelize=require(_0x7477('0x0'));module[_0x7477('0x1')]={'integration':{'type':Sequelize[_0x7477('0x2')]},'eventChannel':{'type':Sequelize[_0x7477('0x2')]},'exitStatus':{'type':Sequelize[_0x7477('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x7477('0x2')]},'uniqueid':{'type':Sequelize[_0x7477('0x2')]},'calleridnum':{'type':Sequelize[_0x7477('0x2')]},'calleridname':{'type':Sequelize[_0x7477('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7477('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7477('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7477('0x3')]},'holdtime':{'type':Sequelize[_0x7477('0x4')]},'agentcomplete':{'type':Sequelize[_0x7477('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7477('0x3')]},'talktime':{'type':Sequelize[_0x7477('0x4')]},'agentacw':{'type':Sequelize[_0x7477('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x7477('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7477('0x3')]},'agentdump':{'type':Sequelize[_0x7477('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7477('0x3')]},'lastevent':{'type':Sequelize[_0x7477('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7477('0x2')]},'language':{'type':Sequelize[_0x7477('0x2')]},'accountcode':{'type':Sequelize[_0x7477('0x2')]},'context':{'type':Sequelize[_0x7477('0x2')]},'exten':{'type':Sequelize[_0x7477('0x2')]},'priority':{'type':Sequelize[_0x7477('0x2')]},'destchannel':{'type':Sequelize[_0x7477('0x2')]},'destchannelstate':{'type':Sequelize[_0x7477('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7477('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x7477('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7477('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x7477('0x2')]},'destcontext':{'type':Sequelize[_0x7477('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7477('0x2')]},'destuniqueid':{'type':Sequelize[_0x7477('0x2')]},'messageId':{'type':Sequelize[_0x7477('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x7477('0x2')]},'from':{'type':Sequelize[_0x7477('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x7477('0x2')]},'attachment':{'type':Sequelize[_0x7477('0x6')]},'html':{'type':Sequelize[_0x7477('0x6')]},'text':{'type':Sequelize[_0x7477('0x6')]},'status':{'type':Sequelize['ENUM'](_0x7477('0x7'),_0x7477('0x8'),_0x7477('0x9'),_0x7477('0xa'))},'url':{'type':Sequelize[_0x7477('0x2')]},'app':{'type':Sequelize[_0x7477('0x2')]},'appdata':{'type':Sequelize[_0x7477('0x2')]},'projectId':{'type':Sequelize[_0x7477('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 91cf1b0..d138ee2 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 _0x7f05=['show','rawAttributes','attributes','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','IntegrationReport','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch'];(function(_0x19a5c9,_0x5c2e5c){var _0x5108b3=function(_0x1b2044){while(--_0x1b2044){_0x19a5c9['push'](_0x19a5c9['shift']());}};_0x5108b3(++_0x5c2e5c);}(_0x7f05,0xdc));var _0x57f0=function(_0x473d73,_0x5994f3){_0x473d73=_0x473d73-0x0;var _0x3ca15a=_0x7f05[_0x473d73];return _0x3ca15a;};'use strict';var emlformat=require(_0x57f0('0x0'));var rimraf=require(_0x57f0('0x1'));var zipdir=require(_0x57f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57f0('0x3'));var moment=require('moment');var BPromise=require(_0x57f0('0x4'));var Mustache=require(_0x57f0('0x5'));var util=require('util');var path=require(_0x57f0('0x6'));var sox=require(_0x57f0('0x7'));var csv=require('to-csv');var ejs=require(_0x57f0('0x8'));var fs=require('fs');var fs_extra=require(_0x57f0('0x9'));var _=require('lodash');var squel=require(_0x57f0('0xa'));var crypto=require(_0x57f0('0xb'));var jsforce=require(_0x57f0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x57f0('0xd'));var Papa=require('papaparse');var Redis=require(_0x57f0('0xe'));var authService=require(_0x57f0('0xf'));var qs=require(_0x57f0('0x10'));var as=require(_0x57f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x57f0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cd266,_0x5615ff){_0x5615ff=_0x5615ff||0xcc;return function(_0x1aa9c8){if(_0x1aa9c8){return _0x5cd266[_0x57f0('0x13')](_0x5615ff);}return _0x5cd266[_0x57f0('0x14')](_0x5615ff)[_0x57f0('0x15')]();};}function respondWithResult(_0x599a6b,_0x4d8d89){_0x4d8d89=_0x4d8d89||0xc8;return function(_0x471f97){if(_0x471f97){return _0x599a6b[_0x57f0('0x14')](_0x4d8d89)[_0x57f0('0x16')](_0x471f97);}};}function respondWithFilteredResult(_0x2e57df,_0x238245){return function(_0x2130ca){if(_0x2130ca){var _0x555e18=typeof _0x238245['offset']===_0x57f0('0x17')&&typeof _0x238245['limit']==='undefined';var _0x48eadd=_0x2130ca['count'];var _0x20d0ba=_0x555e18?0x0:_0x238245[_0x57f0('0x18')];var _0x124f9e=_0x555e18?_0x2130ca['count']:_0x238245[_0x57f0('0x18')]+_0x238245[_0x57f0('0x19')];var _0x3d0cf6;if(_0x124f9e>=_0x48eadd){_0x124f9e=_0x48eadd;_0x3d0cf6=0xc8;}else{_0x3d0cf6=0xce;}_0x2e57df['status'](_0x3d0cf6);return _0x2e57df[_0x57f0('0x1a')](_0x57f0('0x1b'),_0x20d0ba+'-'+_0x124f9e+'/'+_0x48eadd)['json'](_0x2130ca);}return null;};}function patchUpdates(_0x589c18){return function(_0x1f8483){try{jsonpatch[_0x57f0('0x1c')](_0x1f8483,_0x589c18,!![]);}catch(_0x599aa2){return BPromise[_0x57f0('0x1d')](_0x599aa2);}return _0x1f8483['save']();};}function saveUpdates(_0x3a5b6f,_0x9c498){return function(_0x426a09){if(_0x426a09){return _0x426a09[_0x57f0('0x1e')](_0x3a5b6f)['then'](function(_0x5d16a6){return _0x5d16a6;});}return null;};}function removeEntity(_0x43a679,_0x56ceb5){return function(_0x1279ae){if(_0x1279ae){return _0x1279ae[_0x57f0('0x1f')]()[_0x57f0('0x20')](function(){_0x43a679[_0x57f0('0x14')](0xcc)[_0x57f0('0x15')]();});}};}function handleEntityNotFound(_0x1c2cae,_0x4de0f5){return function(_0x941a03){if(!_0x941a03){_0x1c2cae['sendStatus'](0x194);}return _0x941a03;};}function handleError(_0x44a353,_0x5a176f){_0x5a176f=_0x5a176f||0x1f4;return function(_0x563fa5){logger[_0x57f0('0x21')](_0x563fa5['stack']);if(_0x563fa5[_0x57f0('0x22')]){delete _0x563fa5['name'];}_0x44a353['status'](_0x5a176f)[_0x57f0('0x23')](_0x563fa5);};}exports[_0x57f0('0x24')]=function(_0x16c711,_0x3ac9d3){var _0x1858ea={},_0x114b1d={},_0xb3ef4e={'count':0x0,'rows':[]};var _0x43699b=_[_0x57f0('0x25')](db[_0x57f0('0x26')]['rawAttributes'],function(_0x2c61af){return{'name':_0x2c61af[_0x57f0('0x27')],'type':_0x2c61af[_0x57f0('0x28')][_0x57f0('0x29')]};});_0x114b1d[_0x57f0('0x2a')]=_[_0x57f0('0x25')](_0x43699b,_0x57f0('0x22'));_0x114b1d[_0x57f0('0x2b')]=_[_0x57f0('0x2c')](_0x16c711[_0x57f0('0x2b')]);_0x114b1d[_0x57f0('0x2d')]=_[_0x57f0('0x2e')](_0x114b1d[_0x57f0('0x2a')],_0x114b1d[_0x57f0('0x2b')]);_0x1858ea['attributes']=_[_0x57f0('0x2e')](_0x114b1d[_0x57f0('0x2a')],qs[_0x57f0('0x2f')](_0x16c711[_0x57f0('0x2b')]['fields']));_0x1858ea['attributes']=_0x1858ea['attributes'][_0x57f0('0x30')]?_0x1858ea['attributes']:_0x114b1d[_0x57f0('0x2a')];if(!_0x16c711[_0x57f0('0x2b')][_0x57f0('0x31')]('nolimit')){_0x1858ea[_0x57f0('0x19')]=qs[_0x57f0('0x19')](_0x16c711[_0x57f0('0x2b')][_0x57f0('0x19')]);_0x1858ea[_0x57f0('0x18')]=qs[_0x57f0('0x18')](_0x16c711[_0x57f0('0x2b')][_0x57f0('0x18')]);}_0x1858ea[_0x57f0('0x32')]=qs[_0x57f0('0x33')](_0x16c711[_0x57f0('0x2b')][_0x57f0('0x33')]);_0x1858ea[_0x57f0('0x34')]=qs[_0x57f0('0x2d')](_[_0x57f0('0x35')](_0x16c711[_0x57f0('0x2b')],_0x114b1d[_0x57f0('0x2d')]),_0x43699b);if(_0x16c711[_0x57f0('0x2b')][_0x57f0('0x36')]){_0x1858ea['where']=_['merge'](_0x1858ea[_0x57f0('0x34')],{'$or':_[_0x57f0('0x25')](_0x43699b,function(_0x382436){if(_0x382436['type']!==_0x57f0('0x37')){var _0x294756={};_0x294756[_0x382436[_0x57f0('0x22')]]={'$like':'%'+_0x16c711[_0x57f0('0x2b')][_0x57f0('0x36')]+'%'};return _0x294756;}})});}_0x1858ea=_[_0x57f0('0x38')]({},_0x1858ea,_0x16c711[_0x57f0('0x39')]);var _0x2cf365={'where':_0x1858ea[_0x57f0('0x34')]};return db['IntegrationReport'][_0x57f0('0x3a')](_0x2cf365)[_0x57f0('0x20')](function(_0x44d630){_0xb3ef4e[_0x57f0('0x3a')]=_0x44d630;if(_0x16c711['query'][_0x57f0('0x3b')]){_0x1858ea[_0x57f0('0x3c')]=[{'all':!![]}];}return db['IntegrationReport'][_0x57f0('0x3d')](_0x1858ea);})[_0x57f0('0x20')](function(_0x2c3dbd){_0xb3ef4e[_0x57f0('0x3e')]=_0x2c3dbd;return _0xb3ef4e;})[_0x57f0('0x20')](respondWithFilteredResult(_0x3ac9d3,_0x1858ea))[_0x57f0('0x3f')](handleError(_0x3ac9d3,null));};exports[_0x57f0('0x40')]=function(_0x4f3271,_0x42379c){var _0x4e0abe={'raw':![],'where':{'id':_0x4f3271['params']['id']}},_0x3dd680={};_0x3dd680[_0x57f0('0x2a')]=_[_0x57f0('0x2c')](db[_0x57f0('0x26')][_0x57f0('0x41')]);_0x3dd680[_0x57f0('0x2b')]=_[_0x57f0('0x2c')](_0x4f3271[_0x57f0('0x2b')]);_0x3dd680[_0x57f0('0x2d')]=_[_0x57f0('0x2e')](_0x3dd680[_0x57f0('0x2a')],_0x3dd680[_0x57f0('0x2b')]);_0x4e0abe['attributes']=_[_0x57f0('0x2e')](_0x3dd680[_0x57f0('0x2a')],qs['fields'](_0x4f3271['query'][_0x57f0('0x2f')]));_0x4e0abe['attributes']=_0x4e0abe[_0x57f0('0x42')][_0x57f0('0x30')]?_0x4e0abe[_0x57f0('0x42')]:_0x3dd680['model'];if(_0x4f3271[_0x57f0('0x2b')][_0x57f0('0x3b')]){_0x4e0abe['include']=[{'all':!![]}];}_0x4e0abe=_[_0x57f0('0x38')]({},_0x4e0abe,_0x4f3271[_0x57f0('0x39')]);return db[_0x57f0('0x26')][_0x57f0('0x43')](_0x4e0abe)[_0x57f0('0x20')](handleEntityNotFound(_0x42379c,null))[_0x57f0('0x20')](respondWithResult(_0x42379c,null))['catch'](handleError(_0x42379c,null));};exports[_0x57f0('0x44')]=function(_0x390119,_0x4b93e5){return db[_0x57f0('0x26')]['create'](_0x390119[_0x57f0('0x45')],{})['then'](respondWithResult(_0x4b93e5,0xc9))[_0x57f0('0x3f')](handleError(_0x4b93e5,null));};exports['update']=function(_0x4c6eb1,_0x22abb2){if(_0x4c6eb1[_0x57f0('0x45')]['id']){delete _0x4c6eb1[_0x57f0('0x45')]['id'];}return db['IntegrationReport'][_0x57f0('0x43')]({'where':{'id':_0x4c6eb1[_0x57f0('0x46')]['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0x22abb2,null))[_0x57f0('0x20')](saveUpdates(_0x4c6eb1[_0x57f0('0x45')],null))[_0x57f0('0x20')](respondWithResult(_0x22abb2,null))[_0x57f0('0x3f')](handleError(_0x22abb2,null));};exports[_0x57f0('0x1f')]=function(_0x7f6cf5,_0x5bdd21){return db[_0x57f0('0x26')][_0x57f0('0x43')]({'where':{'id':_0x7f6cf5['params']['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0x5bdd21,null))[_0x57f0('0x20')](removeEntity(_0x5bdd21,null))['catch'](handleError(_0x5bdd21,null));};exports['describe']=function(_0x440fd8,_0x71081b){return db['IntegrationReport']['describe']()['then'](respondWithResult(_0x71081b,null))[_0x57f0('0x3f')](handleError(_0x71081b,null));}; \ No newline at end of file +var _0xf404=['eml-format','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','stack','name','send','index','IntegrationReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','VIRTUAL','filter','merge','includeAll','include','rows','show','params','find','create','body','catch','describe'];(function(_0x51f812,_0x36212c){var _0x1ad290=function(_0x1f03b7){while(--_0x1f03b7){_0x51f812['push'](_0x51f812['shift']());}};_0x1ad290(++_0x36212c);}(_0xf404,0x120));var _0x4f40=function(_0x14bd44,_0xac1d68){_0x14bd44=_0x14bd44-0x0;var _0x26b11d=_0xf404[_0x14bd44];return _0x26b11d;};'use strict';var emlformat=require(_0x4f40('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f40('0x1'));var rp=require(_0x4f40('0x2'));var moment=require(_0x4f40('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4f40('0x4'));var util=require('util');var path=require(_0x4f40('0x5'));var sox=require('sox');var csv=require(_0x4f40('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f40('0x7'));var _=require(_0x4f40('0x8'));var squel=require(_0x4f40('0x9'));var crypto=require(_0x4f40('0xa'));var jsforce=require(_0x4f40('0xb'));var deskjs=require(_0x4f40('0xc'));var toCsv=require(_0x4f40('0x6'));var querystring=require(_0x4f40('0xd'));var Papa=require(_0x4f40('0xe'));var Redis=require(_0x4f40('0xf'));var authService=require(_0x4f40('0x10'));var qs=require(_0x4f40('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f40('0x12'));var logger=require(_0x4f40('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f40('0x14'));var db=require(_0x4f40('0x15'))['db'];function respondWithStatusCode(_0x25dc9d,_0xa3d7dd){_0xa3d7dd=_0xa3d7dd||0xcc;return function(_0xdc08e4){if(_0xdc08e4){return _0x25dc9d[_0x4f40('0x16')](_0xa3d7dd);}return _0x25dc9d[_0x4f40('0x17')](_0xa3d7dd)[_0x4f40('0x18')]();};}function respondWithResult(_0xfe52d8,_0x1805b2){_0x1805b2=_0x1805b2||0xc8;return function(_0x29304b){if(_0x29304b){return _0xfe52d8[_0x4f40('0x17')](_0x1805b2)[_0x4f40('0x19')](_0x29304b);}};}function respondWithFilteredResult(_0x459cb6,_0x5f5ae1){return function(_0x2fb280){if(_0x2fb280){var _0x1107ac=typeof _0x5f5ae1['offset']===_0x4f40('0x1a')&&typeof _0x5f5ae1[_0x4f40('0x1b')]==='undefined';var _0x18cf4f=_0x2fb280[_0x4f40('0x1c')];var _0x2a8017=_0x1107ac?0x0:_0x5f5ae1[_0x4f40('0x1d')];var _0x20f34a=_0x1107ac?_0x2fb280['count']:_0x5f5ae1[_0x4f40('0x1d')]+_0x5f5ae1[_0x4f40('0x1b')];var _0x2113ca;if(_0x20f34a>=_0x18cf4f){_0x20f34a=_0x18cf4f;_0x2113ca=0xc8;}else{_0x2113ca=0xce;}_0x459cb6['status'](_0x2113ca);return _0x459cb6[_0x4f40('0x1e')]('Content-Range',_0x2a8017+'-'+_0x20f34a+'/'+_0x18cf4f)[_0x4f40('0x19')](_0x2fb280);}return null;};}function patchUpdates(_0x4809c8){return function(_0x14e23d){try{jsonpatch[_0x4f40('0x1f')](_0x14e23d,_0x4809c8,!![]);}catch(_0x3b58b3){return BPromise[_0x4f40('0x20')](_0x3b58b3);}return _0x14e23d['save']();};}function saveUpdates(_0x5694e0,_0x212ed3){return function(_0x4af431){if(_0x4af431){return _0x4af431[_0x4f40('0x21')](_0x5694e0)[_0x4f40('0x22')](function(_0x5da7fe){return _0x5da7fe;});}return null;};}function removeEntity(_0x5a1a95,_0x13dc13){return function(_0x48120e){if(_0x48120e){return _0x48120e[_0x4f40('0x23')]()[_0x4f40('0x22')](function(){_0x5a1a95[_0x4f40('0x17')](0xcc)[_0x4f40('0x18')]();});}};}function handleEntityNotFound(_0x295c55,_0xec4dd8){return function(_0x59df85){if(!_0x59df85){_0x295c55[_0x4f40('0x16')](0x194);}return _0x59df85;};}function handleError(_0x4453be,_0x1ca942){_0x1ca942=_0x1ca942||0x1f4;return function(_0x364ba5){logger[_0x4f40('0x24')](_0x364ba5[_0x4f40('0x25')]);if(_0x364ba5['name']){delete _0x364ba5[_0x4f40('0x26')];}_0x4453be[_0x4f40('0x17')](_0x1ca942)[_0x4f40('0x27')](_0x364ba5);};}exports[_0x4f40('0x28')]=function(_0x1a06c4,_0x53460a){var _0x1c9878={},_0x642341={},_0x375e4f={'count':0x0,'rows':[]};var _0x387b8a=_['map'](db[_0x4f40('0x29')][_0x4f40('0x2a')],function(_0x1ac793){return{'name':_0x1ac793['fieldName'],'type':_0x1ac793[_0x4f40('0x2b')][_0x4f40('0x2c')]};});_0x642341[_0x4f40('0x2d')]=_['map'](_0x387b8a,_0x4f40('0x26'));_0x642341[_0x4f40('0x2e')]=_[_0x4f40('0x2f')](_0x1a06c4['query']);_0x642341['filters']=_[_0x4f40('0x30')](_0x642341[_0x4f40('0x2d')],_0x642341[_0x4f40('0x2e')]);_0x1c9878[_0x4f40('0x31')]=_[_0x4f40('0x30')](_0x642341['model'],qs[_0x4f40('0x32')](_0x1a06c4['query'][_0x4f40('0x32')]));_0x1c9878[_0x4f40('0x31')]=_0x1c9878['attributes'][_0x4f40('0x33')]?_0x1c9878['attributes']:_0x642341[_0x4f40('0x2d')];if(!_0x1a06c4['query'][_0x4f40('0x34')](_0x4f40('0x35'))){_0x1c9878[_0x4f40('0x1b')]=qs[_0x4f40('0x1b')](_0x1a06c4['query'][_0x4f40('0x1b')]);_0x1c9878[_0x4f40('0x1d')]=qs['offset'](_0x1a06c4[_0x4f40('0x2e')][_0x4f40('0x1d')]);}_0x1c9878[_0x4f40('0x36')]=qs[_0x4f40('0x37')](_0x1a06c4[_0x4f40('0x2e')][_0x4f40('0x37')]);_0x1c9878['where']=qs['filters'](_[_0x4f40('0x38')](_0x1a06c4['query'],_0x642341[_0x4f40('0x39')]),_0x387b8a);if(_0x1a06c4['query']['filter']){_0x1c9878[_0x4f40('0x3a')]=_['merge'](_0x1c9878[_0x4f40('0x3a')],{'$or':_['map'](_0x387b8a,function(_0x4a1fa1){if(_0x4a1fa1[_0x4f40('0x2b')]!==_0x4f40('0x3b')){var _0x523413={};_0x523413[_0x4a1fa1[_0x4f40('0x26')]]={'$like':'%'+_0x1a06c4[_0x4f40('0x2e')][_0x4f40('0x3c')]+'%'};return _0x523413;}})});}_0x1c9878=_[_0x4f40('0x3d')]({},_0x1c9878,_0x1a06c4['options']);var _0x538b3f={'where':_0x1c9878[_0x4f40('0x3a')]};return db[_0x4f40('0x29')]['count'](_0x538b3f)[_0x4f40('0x22')](function(_0x29144a){_0x375e4f[_0x4f40('0x1c')]=_0x29144a;if(_0x1a06c4[_0x4f40('0x2e')][_0x4f40('0x3e')]){_0x1c9878[_0x4f40('0x3f')]=[{'all':!![]}];}return db[_0x4f40('0x29')]['findAll'](_0x1c9878);})[_0x4f40('0x22')](function(_0x4892b5){_0x375e4f[_0x4f40('0x40')]=_0x4892b5;return _0x375e4f;})['then'](respondWithFilteredResult(_0x53460a,_0x1c9878))['catch'](handleError(_0x53460a,null));};exports[_0x4f40('0x41')]=function(_0x37add7,_0xf95d39){var _0x3ccb72={'raw':![],'where':{'id':_0x37add7[_0x4f40('0x42')]['id']}},_0x28a6c5={};_0x28a6c5['model']=_[_0x4f40('0x2f')](db[_0x4f40('0x29')][_0x4f40('0x2a')]);_0x28a6c5[_0x4f40('0x2e')]=_[_0x4f40('0x2f')](_0x37add7['query']);_0x28a6c5[_0x4f40('0x39')]=_['intersection'](_0x28a6c5['model'],_0x28a6c5['query']);_0x3ccb72[_0x4f40('0x31')]=_[_0x4f40('0x30')](_0x28a6c5[_0x4f40('0x2d')],qs[_0x4f40('0x32')](_0x37add7[_0x4f40('0x2e')][_0x4f40('0x32')]));_0x3ccb72['attributes']=_0x3ccb72[_0x4f40('0x31')][_0x4f40('0x33')]?_0x3ccb72[_0x4f40('0x31')]:_0x28a6c5[_0x4f40('0x2d')];if(_0x37add7['query']['includeAll']){_0x3ccb72[_0x4f40('0x3f')]=[{'all':!![]}];}_0x3ccb72=_['merge']({},_0x3ccb72,_0x37add7['options']);return db[_0x4f40('0x29')][_0x4f40('0x43')](_0x3ccb72)[_0x4f40('0x22')](handleEntityNotFound(_0xf95d39,null))['then'](respondWithResult(_0xf95d39,null))['catch'](handleError(_0xf95d39,null));};exports[_0x4f40('0x44')]=function(_0x50db8d,_0x26610e){return db[_0x4f40('0x29')][_0x4f40('0x44')](_0x50db8d[_0x4f40('0x45')],{})[_0x4f40('0x22')](respondWithResult(_0x26610e,0xc9))[_0x4f40('0x46')](handleError(_0x26610e,null));};exports[_0x4f40('0x21')]=function(_0x1e63cd,_0x4ff137){if(_0x1e63cd[_0x4f40('0x45')]['id']){delete _0x1e63cd[_0x4f40('0x45')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x1e63cd[_0x4f40('0x42')]['id']}})[_0x4f40('0x22')](handleEntityNotFound(_0x4ff137,null))[_0x4f40('0x22')](saveUpdates(_0x1e63cd[_0x4f40('0x45')],null))['then'](respondWithResult(_0x4ff137,null))[_0x4f40('0x46')](handleError(_0x4ff137,null));};exports[_0x4f40('0x23')]=function(_0x1ee9c8,_0x54b9f8){return db[_0x4f40('0x29')][_0x4f40('0x43')]({'where':{'id':_0x1ee9c8['params']['id']}})[_0x4f40('0x22')](handleEntityNotFound(_0x54b9f8,null))[_0x4f40('0x22')](removeEntity(_0x54b9f8,null))['catch'](handleError(_0x54b9f8,null));};exports['describe']=function(_0xa87264,_0x383fb0){return db[_0x4f40('0x29')][_0x4f40('0x47')]()[_0x4f40('0x22')](respondWithResult(_0x383fb0,null))[_0x4f40('0x46')](handleError(_0x383fb0,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7667321..119ed08 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 _0xe44f=['../../config/logger','api','request-promise','../../config/environment','./integrationReport.attributes','define','report_integration','lodash','util'];(function(_0x1a0c00,_0x40e304){var _0xb02d2c=function(_0x2a5218){while(--_0x2a5218){_0x1a0c00['push'](_0x1a0c00['shift']());}};_0xb02d2c(++_0x40e304);}(_0xe44f,0x1ae));var _0xfe44=function(_0xb3deeb,_0x4413d6){_0xb3deeb=_0xb3deeb-0x0;var _0x482144=_0xe44f[_0xb3deeb];return _0x482144;};'use strict';var _=require(_0xfe44('0x0'));var util=require(_0xfe44('0x1'));var logger=require(_0xfe44('0x2'))(_0xfe44('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfe44('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfe44('0x5'));var attributes=require(_0xfe44('0x6'));module['exports']=function(_0x1f971a,_0xf2e720){return _0x1f971a[_0xfe44('0x7')]('IntegrationReport',attributes,{'tableName':_0xfe44('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd947=['request-promise','path','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xd947,0x120));var _0x7d94=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd947[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7d94('0x0'));var util=require(_0x7d94('0x1'));var logger=require(_0x7d94('0x2'))(_0x7d94('0x3'));var moment=require(_0x7d94('0x4'));var BPromise=require(_0x7d94('0x5'));var rp=require(_0x7d94('0x6'));var fs=require('fs');var path=require(_0x7d94('0x7'));var rimraf=require(_0x7d94('0x8'));var config=require('../../config/environment');var attributes=require(_0x7d94('0x9'));module[_0x7d94('0xa')]=function(_0x102db3,_0x2c6ca2){return _0x102db3[_0x7d94('0xb')](_0x7d94('0xc'),attributes,{'tableName':_0x7d94('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 1361e7d..27c6032 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 _0xb7e7=['IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x234543,_0x307361){var _0x88a990=function(_0x28b70b){while(--_0x28b70b){_0x234543['push'](_0x234543['shift']());}};_0x88a990(++_0x307361);}(_0xb7e7,0x121));var _0x7b7e=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xb7e7[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0xb3c33c,_0x4bfda8){var _0x4f70b6=function(_0x461ca6){while(--_0x461ca6){_0xb3c33c['push'](_0xb3c33c['shift']());}};_0x4f70b6(++_0x4bfda8);}(_0x2032,0xd9));var _0x2203=function(_0x26cff3,_0x56a5f3){_0x26cff3=_0x26cff3-0x0;var _0x3ffc6d=_0x2032[_0x26cff3];return _0x3ffc6d;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index f38109f..de4a5a0 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 _0x96fc=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96fc,0x1d1));var _0xc96f=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x96fc[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xc96f('0x0'));var util=require(_0xc96f('0x1'));var path=require(_0xc96f('0x2'));var timeout=require(_0xc96f('0x3'));var express=require(_0xc96f('0x4'));var router=express[_0xc96f('0x5')]();var fs_extra=require(_0xc96f('0x6'));var auth=require(_0xc96f('0x7'));var interaction=require(_0xc96f('0x8'));var config=require(_0xc96f('0x9'));var controller=require(_0xc96f('0xa'));router[_0xc96f('0xb')]('/',auth[_0xc96f('0xc')](),controller[_0xc96f('0xd')]);router['get'](_0xc96f('0xe'),auth[_0xc96f('0xc')](),controller[_0xc96f('0xf')]);router[_0xc96f('0xb')](_0xc96f('0x10'),auth[_0xc96f('0xc')](),controller['getIntervals']);router[_0xc96f('0x11')]('/',auth[_0xc96f('0xc')](),controller[_0xc96f('0x12')]);router[_0xc96f('0x11')](_0xc96f('0x10'),auth['isAuthenticated'](),controller[_0xc96f('0x13')]);router[_0xc96f('0x11')](_0xc96f('0x14'),auth[_0xc96f('0xc')](),controller[_0xc96f('0x15')]);router[_0xc96f('0x16')](_0xc96f('0xe'),auth[_0xc96f('0xc')](),controller[_0xc96f('0x17')]);router[_0xc96f('0x18')](_0xc96f('0xe'),auth[_0xc96f('0xc')](),controller[_0xc96f('0x19')]);module['exports']=router; \ No newline at end of file +var _0xf5be=['/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index'];(function(_0x571720,_0x344cea){var _0x55b384=function(_0x417491){while(--_0x417491){_0x571720['push'](_0x571720['shift']());}};_0x55b384(++_0x344cea);}(_0xf5be,0x107));var _0xef5b=function(_0x260f45,_0x1f9128){_0x260f45=_0x260f45-0x0;var _0x41f44d=_0xf5be[_0x260f45];return _0x41f44d;};'use strict';var multer=require(_0xef5b('0x0'));var util=require(_0xef5b('0x1'));var path=require(_0xef5b('0x2'));var timeout=require(_0xef5b('0x3'));var express=require(_0xef5b('0x4'));var router=express[_0xef5b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xef5b('0x6'));var interaction=require(_0xef5b('0x7'));var config=require(_0xef5b('0x8'));var controller=require(_0xef5b('0x9'));router[_0xef5b('0xa')]('/',auth[_0xef5b('0xb')](),controller[_0xef5b('0xc')]);router['get'](_0xef5b('0xd'),auth[_0xef5b('0xb')](),controller[_0xef5b('0xe')]);router[_0xef5b('0xa')](_0xef5b('0xf'),auth[_0xef5b('0xb')](),controller['getIntervals']);router[_0xef5b('0x10')]('/',auth[_0xef5b('0xb')](),controller['create']);router[_0xef5b('0x10')]('/:id/sub_intervals',auth[_0xef5b('0xb')](),controller[_0xef5b('0x11')]);router[_0xef5b('0x10')](_0xef5b('0x12'),auth[_0xef5b('0xb')](),controller[_0xef5b('0x13')]);router[_0xef5b('0x14')]('/:id',auth[_0xef5b('0xb')](),controller[_0xef5b('0x15')]);router['delete']('/:id',auth[_0xef5b('0xb')](),controller[_0xef5b('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index bb282b9..90f6199 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 _0xb77c=['sequelize','exports','STRING'];(function(_0x27667f,_0x5849ce){var _0x1d9ea2=function(_0x32e947){while(--_0x32e947){_0x27667f['push'](_0x27667f['shift']());}};_0x1d9ea2(++_0x5849ce);}(_0xb77c,0xed));var _0xcb77=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xb77c[_0x9cd4c3];return _0x4c9025;};'use strict';var Sequelize=require(_0xcb77('0x0'));module[_0xcb77('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcb77('0x2')]},'interval':{'type':Sequelize[_0xcb77('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x1c52=['STRING','exports'];(function(_0x1503ef,_0x28d2b0){var _0x2d2916=function(_0x1c562a){while(--_0x1c562a){_0x1503ef['push'](_0x1503ef['shift']());}};_0x2d2916(++_0x28d2b0);}(_0x1c52,0xf5));var _0x21c5=function(_0x2ecfe3,_0x53f5f9){_0x2ecfe3=_0x2ecfe3-0x0;var _0x1f3adf=_0x1c52[_0x2ecfe3];return _0x1f3adf;};'use strict';var Sequelize=require('sequelize');module[_0x21c5('0x0')]={'name':{'type':Sequelize[_0x21c5('0x1')]},'description':{'type':Sequelize[_0x21c5('0x1')]},'interval':{'type':Sequelize[_0x21c5('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 79f203d..f80061c 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 _0x5126=['include','rows','catch','show','rawAttributes','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','params','find','addInterval','IntervalId','getIntervals','findOne','pick','nolimit','addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','Intervals','UserProfileResource','end','error','stack','name','send','index','Interval','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','merge','filter','options'];(function(_0x7546c2,_0x13b76d){var _0x16fdf9=function(_0x5d8941){while(--_0x5d8941){_0x7546c2['push'](_0x7546c2['shift']());}};_0x16fdf9(++_0x13b76d);}(_0x5126,0x7c));var _0x6512=function(_0x40770f,_0x1fdbfd){_0x40770f=_0x40770f-0x0;var _0x599f75=_0x5126[_0x40770f];return _0x599f75;};'use strict';var emlformat=require(_0x6512('0x0'));var rimraf=require(_0x6512('0x1'));var zipdir=require(_0x6512('0x2'));var jsonpatch=require(_0x6512('0x3'));var rp=require(_0x6512('0x4'));var moment=require(_0x6512('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6512('0x6'));var util=require(_0x6512('0x7'));var path=require(_0x6512('0x8'));var sox=require(_0x6512('0x9'));var csv=require(_0x6512('0xa'));var ejs=require(_0x6512('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6512('0xc'));var squel=require(_0x6512('0xd'));var crypto=require(_0x6512('0xe'));var jsforce=require(_0x6512('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6512('0xa'));var querystring=require(_0x6512('0x10'));var Papa=require(_0x6512('0x11'));var Redis=require(_0x6512('0x12'));var authService=require(_0x6512('0x13'));var qs=require(_0x6512('0x14'));var as=require(_0x6512('0x15'));var hardwareService=require(_0x6512('0x16'));var logger=require('../../config/logger')(_0x6512('0x17'));var utils=require(_0x6512('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6512('0x19'));var db=require(_0x6512('0x1a'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x20f1b0,_0x1d96f8){_0x1d96f8=_0x1d96f8||0xcc;return function(_0x4036da){if(_0x4036da){return _0x20f1b0[_0x6512('0x1b')](_0x1d96f8);}return _0x20f1b0[_0x6512('0x1c')](_0x1d96f8)['end']();};}function respondWithResult(_0x37899e,_0xc88de4){_0xc88de4=_0xc88de4||0xc8;return function(_0x503e1f){if(_0x503e1f){return _0x37899e['status'](_0xc88de4)[_0x6512('0x1d')](_0x503e1f);}};}function respondWithFilteredResult(_0x3a9abc,_0x14184a){return function(_0x2067b3){if(_0x2067b3){var _0x4e5bfb=typeof _0x14184a[_0x6512('0x1e')]===_0x6512('0x1f')&&typeof _0x14184a[_0x6512('0x20')]===_0x6512('0x1f');var _0x266a60=_0x2067b3[_0x6512('0x21')];var _0x3a1a8a=_0x4e5bfb?0x0:_0x14184a[_0x6512('0x1e')];var _0x981c0b=_0x4e5bfb?_0x2067b3[_0x6512('0x21')]:_0x14184a[_0x6512('0x1e')]+_0x14184a['limit'];var _0x43bb1e;if(_0x981c0b>=_0x266a60){_0x981c0b=_0x266a60;_0x43bb1e=0xc8;}else{_0x43bb1e=0xce;}_0x3a9abc[_0x6512('0x1c')](_0x43bb1e);return _0x3a9abc[_0x6512('0x22')]('Content-Range',_0x3a1a8a+'-'+_0x981c0b+'/'+_0x266a60)['json'](_0x2067b3);}return null;};}function patchUpdates(_0x57007e){return function(_0x21b583){try{jsonpatch[_0x6512('0x23')](_0x21b583,_0x57007e,!![]);}catch(_0x22f571){return BPromise[_0x6512('0x24')](_0x22f571);}return _0x21b583[_0x6512('0x25')]();};}function saveUpdates(_0x656137,_0x305b2c){return function(_0x204078){if(_0x204078){return _0x204078['update'](_0x656137)[_0x6512('0x26')](function(_0x47e60e){return _0x47e60e;});}return null;};}function removeEntity(_0x42786e,_0x38cb33){return function(_0x4f49b7){if(_0x4f49b7){return _0x4f49b7[_0x6512('0x27')]()[_0x6512('0x26')](function(){var _0x1f2845=_0x4f49b7['get']({'plain':!![]});var _0x557942=_0x6512('0x28');return db[_0x6512('0x29')][_0x6512('0x27')]({'where':{'type':_0x557942,'resourceId':_0x1f2845['id']}})[_0x6512('0x26')](function(){return _0x4f49b7;});})[_0x6512('0x26')](function(){_0x42786e['status'](0xcc)[_0x6512('0x2a')]();});}};}function handleEntityNotFound(_0xbd5c06,_0x402c9a){return function(_0x2fe8a8){if(!_0x2fe8a8){_0xbd5c06[_0x6512('0x1b')](0x194);}return _0x2fe8a8;};}function handleError(_0x188d37,_0x262c24){_0x262c24=_0x262c24||0x1f4;return function(_0x3700e9){logger[_0x6512('0x2b')](_0x3700e9[_0x6512('0x2c')]);if(_0x3700e9[_0x6512('0x2d')]){delete _0x3700e9[_0x6512('0x2d')];}_0x188d37[_0x6512('0x1c')](_0x262c24)[_0x6512('0x2e')](_0x3700e9);};}exports[_0x6512('0x2f')]=function(_0x3fdf24,_0x34c081){var _0x2bff31={},_0x2915ca={},_0x4d18a1={'count':0x0,'rows':[]};var _0xb45fec=_['map'](db[_0x6512('0x30')]['rawAttributes'],function(_0x1e120b){return{'name':_0x1e120b[_0x6512('0x31')],'type':_0x1e120b[_0x6512('0x32')][_0x6512('0x33')]};});_0x2915ca['model']=_[_0x6512('0x34')](_0xb45fec,_0x6512('0x2d'));_0x2915ca[_0x6512('0x35')]=_[_0x6512('0x36')](_0x3fdf24[_0x6512('0x35')]);_0x2915ca[_0x6512('0x37')]=_[_0x6512('0x38')](_0x2915ca[_0x6512('0x39')],_0x2915ca['query']);_0x2bff31['attributes']=_['intersection'](_0x2915ca['model'],qs[_0x6512('0x3a')](_0x3fdf24[_0x6512('0x35')][_0x6512('0x3a')]));_0x2bff31[_0x6512('0x3b')]=_0x2bff31[_0x6512('0x3b')][_0x6512('0x3c')]?_0x2bff31['attributes']:_0x2915ca[_0x6512('0x39')];if(!_0x3fdf24[_0x6512('0x35')][_0x6512('0x3d')]('nolimit')){_0x2bff31[_0x6512('0x20')]=qs[_0x6512('0x20')](_0x3fdf24[_0x6512('0x35')][_0x6512('0x20')]);_0x2bff31[_0x6512('0x1e')]=qs[_0x6512('0x1e')](_0x3fdf24['query']['offset']);}_0x2bff31[_0x6512('0x3e')]=qs[_0x6512('0x3f')](_0x3fdf24[_0x6512('0x35')][_0x6512('0x3f')]);_0x2bff31[_0x6512('0x40')]=qs['filters'](_['pick'](_0x3fdf24[_0x6512('0x35')],_0x2915ca['filters']),_0xb45fec);if(_0x3fdf24[_0x6512('0x35')]['filter']){_0x2bff31['where']=_[_0x6512('0x41')](_0x2bff31[_0x6512('0x40')],{'$or':_[_0x6512('0x34')](_0xb45fec,function(_0x1dfa76){if(_0x1dfa76['type']!=='VIRTUAL'){var _0x4ba647={};_0x4ba647[_0x1dfa76[_0x6512('0x2d')]]={'$like':'%'+_0x3fdf24[_0x6512('0x35')][_0x6512('0x42')]+'%'};return _0x4ba647;}})});}_0x2bff31=_[_0x6512('0x41')]({},_0x2bff31,_0x3fdf24[_0x6512('0x43')]);var _0x3915da={'where':_0x2bff31[_0x6512('0x40')]};return db[_0x6512('0x30')]['count'](_0x3915da)[_0x6512('0x26')](function(_0x3c73a8){_0x4d18a1[_0x6512('0x21')]=_0x3c73a8;if(_0x3fdf24[_0x6512('0x35')]['includeAll']){_0x2bff31[_0x6512('0x44')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x2bff31);})[_0x6512('0x26')](function(_0x586997){_0x4d18a1[_0x6512('0x45')]=_0x586997;return _0x4d18a1;})[_0x6512('0x26')](respondWithFilteredResult(_0x34c081,_0x2bff31))[_0x6512('0x46')](handleError(_0x34c081,null));};exports[_0x6512('0x47')]=function(_0x5be34b,_0x4393d3){var _0x1f552c={'raw':!![],'where':{'id':_0x5be34b['params']['id']}},_0x5acb1d={};_0x5acb1d[_0x6512('0x39')]=_['keys'](db[_0x6512('0x30')][_0x6512('0x48')]);_0x5acb1d[_0x6512('0x35')]=_[_0x6512('0x36')](_0x5be34b[_0x6512('0x35')]);_0x5acb1d[_0x6512('0x37')]=_[_0x6512('0x38')](_0x5acb1d[_0x6512('0x39')],_0x5acb1d[_0x6512('0x35')]);_0x1f552c[_0x6512('0x3b')]=_[_0x6512('0x38')](_0x5acb1d[_0x6512('0x39')],qs[_0x6512('0x3a')](_0x5be34b[_0x6512('0x35')][_0x6512('0x3a')]));_0x1f552c[_0x6512('0x3b')]=_0x1f552c['attributes'][_0x6512('0x3c')]?_0x1f552c[_0x6512('0x3b')]:_0x5acb1d['model'];if(_0x5be34b[_0x6512('0x35')]['includeAll']){_0x1f552c[_0x6512('0x44')]=[{'all':!![]}];}_0x1f552c=_[_0x6512('0x41')]({},_0x1f552c,_0x5be34b['options']);return db[_0x6512('0x30')]['find'](_0x1f552c)[_0x6512('0x26')](handleEntityNotFound(_0x4393d3,null))['then'](respondWithResult(_0x4393d3,null))[_0x6512('0x46')](handleError(_0x4393d3,null));};exports['create']=function(_0x2fd199,_0x488a5d){return db[_0x6512('0x30')][_0x6512('0x49')](_0x2fd199[_0x6512('0x4a')],{})[_0x6512('0x26')](function(_0x110a27){var _0x24dd2a=_0x2fd199[_0x6512('0x4b')][_0x6512('0x4c')]({'plain':!![]});if(!_0x24dd2a)throw new Error(_0x6512('0x4d'));if(_0x24dd2a[_0x6512('0x4e')]==='user'){var _0x28a9e7=_0x110a27[_0x6512('0x4c')]({'plain':!![]});var _0x285a80=_0x6512('0x28');return db[_0x6512('0x4f')]['find']({'where':{'name':_0x285a80,'userProfileId':_0x24dd2a[_0x6512('0x50')]},'raw':!![]})[_0x6512('0x26')](function(_0x4205c7){if(_0x4205c7&&_0x4205c7[_0x6512('0x51')]===0x0){return db[_0x6512('0x29')][_0x6512('0x49')]({'name':_0x28a9e7[_0x6512('0x2d')],'resourceId':_0x28a9e7['id'],'type':_0x4205c7[_0x6512('0x2d')],'sectionId':_0x4205c7['id']},{})[_0x6512('0x26')](function(){return _0x110a27;});}else{return _0x110a27;}})[_0x6512('0x46')](function(_0x2eba5d){logger[_0x6512('0x2b')](_0x6512('0x52'),_0x2eba5d);throw _0x2eba5d;});}return _0x110a27;})[_0x6512('0x26')](respondWithResult(_0x488a5d,0xc9))[_0x6512('0x46')](handleError(_0x488a5d,null));};exports['update']=function(_0x2fbc3d,_0x70de9f){if(_0x2fbc3d['body']['id']){delete _0x2fbc3d[_0x6512('0x4a')]['id'];}return db[_0x6512('0x30')]['find']({'where':{'id':_0x2fbc3d[_0x6512('0x53')]['id']}})[_0x6512('0x26')](handleEntityNotFound(_0x70de9f,null))[_0x6512('0x26')](saveUpdates(_0x2fbc3d[_0x6512('0x4a')],null))[_0x6512('0x26')](respondWithResult(_0x70de9f,null))[_0x6512('0x46')](handleError(_0x70de9f,null));};exports[_0x6512('0x27')]=function(_0x3d77e5,_0x1b0e1e){return db[_0x6512('0x30')][_0x6512('0x54')]({'where':{'id':_0x3d77e5[_0x6512('0x53')]['id']}})[_0x6512('0x26')](handleEntityNotFound(_0x1b0e1e,null))[_0x6512('0x26')](removeEntity(_0x1b0e1e,null))[_0x6512('0x46')](handleError(_0x1b0e1e,null));};exports[_0x6512('0x55')]=function(_0x329763,_0x308960,_0x3c17cb){if(_0x329763[_0x6512('0x4a')]['id']){delete _0x329763[_0x6512('0x4a')]['id'];}return db[_0x6512('0x30')][_0x6512('0x54')]({'where':{'id':_0x329763[_0x6512('0x53')]['id']}})[_0x6512('0x26')](handleEntityNotFound(_0x308960,null))[_0x6512('0x26')](function(_0x598e9f){if(_0x598e9f){_0x329763[_0x6512('0x4a')][_0x6512('0x56')]=_0x598e9f['id'];return db[_0x6512('0x30')][_0x6512('0x49')](_0x329763[_0x6512('0x4a')]);}})['then'](respondWithResult(_0x308960,null))[_0x6512('0x46')](handleError(_0x308960,null));};exports[_0x6512('0x57')]=function(_0x89d854,_0x1dfe1b,_0x4e11ce){var _0x3fcd50={};var _0x4a4da1={};var _0x40e6b6;var _0x13a82d;return db[_0x6512('0x30')][_0x6512('0x58')]({'where':{'id':_0x89d854[_0x6512('0x53')]['id']}})[_0x6512('0x26')](handleEntityNotFound(_0x1dfe1b,null))[_0x6512('0x26')](function(_0x1563a3){if(_0x1563a3){_0x40e6b6=_0x1563a3;_0x4a4da1[_0x6512('0x39')]=_[_0x6512('0x36')](db['Interval'][_0x6512('0x48')]);_0x4a4da1[_0x6512('0x35')]=_[_0x6512('0x36')](_0x89d854[_0x6512('0x35')]);_0x4a4da1[_0x6512('0x37')]=_[_0x6512('0x38')](_0x4a4da1[_0x6512('0x39')],_0x4a4da1['query']);_0x3fcd50['attributes']=_['intersection'](_0x4a4da1['model'],qs[_0x6512('0x3a')](_0x89d854['query'][_0x6512('0x3a')]));_0x3fcd50[_0x6512('0x3b')]=_0x3fcd50['attributes'][_0x6512('0x3c')]?_0x3fcd50['attributes']:_0x4a4da1[_0x6512('0x39')];_0x3fcd50['order']=qs[_0x6512('0x3f')](_0x89d854['query'][_0x6512('0x3f')]);_0x3fcd50[_0x6512('0x40')]=qs['filters'](_[_0x6512('0x59')](_0x89d854[_0x6512('0x35')],_0x4a4da1['filters']));if(_0x89d854[_0x6512('0x35')][_0x6512('0x42')]){_0x3fcd50['where']=_[_0x6512('0x41')](_0x3fcd50[_0x6512('0x40')],{'$or':_[_0x6512('0x34')](_0x3fcd50[_0x6512('0x3b')],function(_0xdd8eec){var _0xa85053={};_0xa85053[_0xdd8eec]={'$like':'%'+_0x89d854[_0x6512('0x35')][_0x6512('0x42')]+'%'};return _0xa85053;})});}_0x3fcd50=_[_0x6512('0x41')]({},_0x3fcd50,_0x89d854['options']);return _0x40e6b6[_0x6512('0x57')](_0x3fcd50);}})[_0x6512('0x26')](function(_0x2f7649){if(_0x2f7649){_0x13a82d=_0x2f7649['length'];if(!_0x89d854['query']['hasOwnProperty'](_0x6512('0x5a'))){_0x3fcd50[_0x6512('0x20')]=qs[_0x6512('0x20')](_0x89d854['query'][_0x6512('0x20')]);_0x3fcd50['offset']=qs[_0x6512('0x1e')](_0x89d854[_0x6512('0x35')][_0x6512('0x1e')]);}return _0x40e6b6['getIntervals'](_0x3fcd50);}})[_0x6512('0x26')](function(_0x57ced7){if(_0x57ced7){return _0x57ced7?{'count':_0x13a82d,'rows':_0x57ced7}:null;}})[_0x6512('0x26')](respondWithResult(_0x1dfe1b,null))[_0x6512('0x46')](handleError(_0x1dfe1b,null));};exports[_0x6512('0x5b')]=function(_0x1db9ce,_0x1155b2,_0x40d796){return db[_0x6512('0x30')][_0x6512('0x58')]({'where':{'id':_0x1db9ce['params']['id']}})[_0x6512('0x26')](handleEntityNotFound(_0x1155b2,null))['then'](function(_0x15df8a){if(_0x15df8a){return db[_0x6512('0x5c')][_0x6512('0x5d')](function(_0x49099d){return db[_0x6512('0x30')][_0x6512('0x27')]({'where':{'IntervalId':_0x1db9ce[_0x6512('0x53')]['id']},'transaction':_0x49099d})[_0x6512('0x26')](function(_0x21392a){var _0x477aba=_['map'](_0x1db9ce[_0x6512('0x4a')],function(_0x46a020){delete _0x46a020['id'];_0x46a020[_0x6512('0x56')]=_0x1db9ce[_0x6512('0x53')]['id'];return _0x46a020;});return db[_0x6512('0x30')][_0x6512('0x5e')](_0x477aba,{'transaction':_0x49099d});});})[_0x6512('0x26')](function(){return db[_0x6512('0x30')][_0x6512('0x5f')]({'where':{'IntervalId':_0x1db9ce[_0x6512('0x53')]['id']}});});}})[_0x6512('0x26')](respondWithResult(_0x1155b2,null))[_0x6512('0x46')](handleError(_0x1155b2,null));}; \ No newline at end of file +var _0xb6a6=['model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','include','Interval','findAll','rows','catch','includeAll','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','IntervalId','getIntervals','findOne','nolimit','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','then','destroy','Intervals','UserProfileResource','error','stack','name','send','rawAttributes','type'];(function(_0x1d1e2e,_0x560855){var _0x22c325=function(_0x45b3b2){while(--_0x45b3b2){_0x1d1e2e['push'](_0x1d1e2e['shift']());}};_0x22c325(++_0x560855);}(_0xb6a6,0xe4));var _0x6b6a=function(_0x472953,_0x427012){_0x472953=_0x472953-0x0;var _0x1a29d4=_0xb6a6[_0x472953];return _0x1a29d4;};'use strict';var emlformat=require(_0x6b6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b6a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6b6a('0x2'));var BPromise=require(_0x6b6a('0x3'));var Mustache=require(_0x6b6a('0x4'));var util=require(_0x6b6a('0x5'));var path=require(_0x6b6a('0x6'));var sox=require(_0x6b6a('0x7'));var csv=require(_0x6b6a('0x8'));var ejs=require(_0x6b6a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b6a('0xa'));var squel=require('squel');var crypto=require(_0x6b6a('0xb'));var jsforce=require(_0x6b6a('0xc'));var deskjs=require(_0x6b6a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6b6a('0xe'));var Papa=require(_0x6b6a('0xf'));var Redis=require(_0x6b6a('0x10'));var authService=require(_0x6b6a('0x11'));var qs=require(_0x6b6a('0x12'));var as=require(_0x6b6a('0x13'));var hardwareService=require(_0x6b6a('0x14'));var logger=require(_0x6b6a('0x15'))(_0x6b6a('0x16'));var utils=require(_0x6b6a('0x17'));var config=require(_0x6b6a('0x18'));var licenseUtil=require(_0x6b6a('0x19'));var db=require('../../mysqldb')['db'];var extensions=require(_0x6b6a('0x1a'));function respondWithStatusCode(_0x2d1974,_0x1c631c){_0x1c631c=_0x1c631c||0xcc;return function(_0x29e876){if(_0x29e876){return _0x2d1974[_0x6b6a('0x1b')](_0x1c631c);}return _0x2d1974[_0x6b6a('0x1c')](_0x1c631c)[_0x6b6a('0x1d')]();};}function respondWithResult(_0x4c745b,_0x695a9e){_0x695a9e=_0x695a9e||0xc8;return function(_0x3509f6){if(_0x3509f6){return _0x4c745b[_0x6b6a('0x1c')](_0x695a9e)[_0x6b6a('0x1e')](_0x3509f6);}};}function respondWithFilteredResult(_0x285840,_0x4f9952){return function(_0x3d9ed0){if(_0x3d9ed0){var _0x12ad13=typeof _0x4f9952[_0x6b6a('0x1f')]==='undefined'&&typeof _0x4f9952[_0x6b6a('0x20')]===_0x6b6a('0x21');var _0x40541f=_0x3d9ed0[_0x6b6a('0x22')];var _0x29c9f0=_0x12ad13?0x0:_0x4f9952[_0x6b6a('0x1f')];var _0x1b6c46=_0x12ad13?_0x3d9ed0[_0x6b6a('0x22')]:_0x4f9952[_0x6b6a('0x1f')]+_0x4f9952[_0x6b6a('0x20')];var _0x25822a;if(_0x1b6c46>=_0x40541f){_0x1b6c46=_0x40541f;_0x25822a=0xc8;}else{_0x25822a=0xce;}_0x285840[_0x6b6a('0x1c')](_0x25822a);return _0x285840['set']('Content-Range',_0x29c9f0+'-'+_0x1b6c46+'/'+_0x40541f)[_0x6b6a('0x1e')](_0x3d9ed0);}return null;};}function patchUpdates(_0x2f6853){return function(_0x2e71c1){try{jsonpatch[_0x6b6a('0x23')](_0x2e71c1,_0x2f6853,!![]);}catch(_0x4b382d){return BPromise[_0x6b6a('0x24')](_0x4b382d);}return _0x2e71c1[_0x6b6a('0x25')]();};}function saveUpdates(_0x471c36,_0x8a3c06){return function(_0x81281d){if(_0x81281d){return _0x81281d['update'](_0x471c36)[_0x6b6a('0x26')](function(_0x3ba5f7){return _0x3ba5f7;});}return null;};}function removeEntity(_0x21f4be,_0x710343){return function(_0x22743e){if(_0x22743e){return _0x22743e[_0x6b6a('0x27')]()[_0x6b6a('0x26')](function(){var _0x553d7e=_0x22743e['get']({'plain':!![]});var _0x119edd=_0x6b6a('0x28');return db[_0x6b6a('0x29')][_0x6b6a('0x27')]({'where':{'type':_0x119edd,'resourceId':_0x553d7e['id']}})['then'](function(){return _0x22743e;});})['then'](function(){_0x21f4be[_0x6b6a('0x1c')](0xcc)[_0x6b6a('0x1d')]();});}};}function handleEntityNotFound(_0x278374,_0x3ca2da){return function(_0x1579ae){if(!_0x1579ae){_0x278374['sendStatus'](0x194);}return _0x1579ae;};}function handleError(_0x5cd97e,_0x53b3d1){_0x53b3d1=_0x53b3d1||0x1f4;return function(_0x100544){logger[_0x6b6a('0x2a')](_0x100544[_0x6b6a('0x2b')]);if(_0x100544['name']){delete _0x100544[_0x6b6a('0x2c')];}_0x5cd97e[_0x6b6a('0x1c')](_0x53b3d1)[_0x6b6a('0x2d')](_0x100544);};}exports['index']=function(_0x10199c,_0x144c81){var _0x3c09a3={},_0x4df0b9={},_0x58f6d5={'count':0x0,'rows':[]};var _0x43d12e=_['map'](db['Interval'][_0x6b6a('0x2e')],function(_0x4b6797){return{'name':_0x4b6797['fieldName'],'type':_0x4b6797[_0x6b6a('0x2f')]['key']};});_0x4df0b9[_0x6b6a('0x30')]=_[_0x6b6a('0x31')](_0x43d12e,_0x6b6a('0x2c'));_0x4df0b9[_0x6b6a('0x32')]=_[_0x6b6a('0x33')](_0x10199c[_0x6b6a('0x32')]);_0x4df0b9['filters']=_[_0x6b6a('0x34')](_0x4df0b9[_0x6b6a('0x30')],_0x4df0b9[_0x6b6a('0x32')]);_0x3c09a3['attributes']=_[_0x6b6a('0x34')](_0x4df0b9['model'],qs['fields'](_0x10199c[_0x6b6a('0x32')][_0x6b6a('0x35')]));_0x3c09a3['attributes']=_0x3c09a3[_0x6b6a('0x36')][_0x6b6a('0x37')]?_0x3c09a3[_0x6b6a('0x36')]:_0x4df0b9[_0x6b6a('0x30')];if(!_0x10199c['query'][_0x6b6a('0x38')]('nolimit')){_0x3c09a3[_0x6b6a('0x20')]=qs[_0x6b6a('0x20')](_0x10199c[_0x6b6a('0x32')][_0x6b6a('0x20')]);_0x3c09a3[_0x6b6a('0x1f')]=qs[_0x6b6a('0x1f')](_0x10199c[_0x6b6a('0x32')][_0x6b6a('0x1f')]);}_0x3c09a3[_0x6b6a('0x39')]=qs[_0x6b6a('0x3a')](_0x10199c['query'][_0x6b6a('0x3a')]);_0x3c09a3[_0x6b6a('0x3b')]=qs[_0x6b6a('0x3c')](_[_0x6b6a('0x3d')](_0x10199c[_0x6b6a('0x32')],_0x4df0b9[_0x6b6a('0x3c')]),_0x43d12e);if(_0x10199c[_0x6b6a('0x32')][_0x6b6a('0x3e')]){_0x3c09a3['where']=_[_0x6b6a('0x3f')](_0x3c09a3['where'],{'$or':_['map'](_0x43d12e,function(_0x1810fe){if(_0x1810fe[_0x6b6a('0x2f')]!=='VIRTUAL'){var _0x2d6a0a={};_0x2d6a0a[_0x1810fe['name']]={'$like':'%'+_0x10199c[_0x6b6a('0x32')][_0x6b6a('0x3e')]+'%'};return _0x2d6a0a;}})});}_0x3c09a3=_[_0x6b6a('0x3f')]({},_0x3c09a3,_0x10199c['options']);var _0x564ddd={'where':_0x3c09a3['where']};return db['Interval']['count'](_0x564ddd)['then'](function(_0x3c71c1){_0x58f6d5[_0x6b6a('0x22')]=_0x3c71c1;if(_0x10199c[_0x6b6a('0x32')]['includeAll']){_0x3c09a3[_0x6b6a('0x40')]=[{'all':!![]}];}return db[_0x6b6a('0x41')][_0x6b6a('0x42')](_0x3c09a3);})[_0x6b6a('0x26')](function(_0x3e4e4f){_0x58f6d5[_0x6b6a('0x43')]=_0x3e4e4f;return _0x58f6d5;})['then'](respondWithFilteredResult(_0x144c81,_0x3c09a3))[_0x6b6a('0x44')](handleError(_0x144c81,null));};exports['show']=function(_0x273211,_0x1a2e90){var _0x8534f8={'raw':!![],'where':{'id':_0x273211['params']['id']}},_0x30ee6a={};_0x30ee6a[_0x6b6a('0x30')]=_['keys'](db['Interval'][_0x6b6a('0x2e')]);_0x30ee6a[_0x6b6a('0x32')]=_[_0x6b6a('0x33')](_0x273211[_0x6b6a('0x32')]);_0x30ee6a[_0x6b6a('0x3c')]=_[_0x6b6a('0x34')](_0x30ee6a[_0x6b6a('0x30')],_0x30ee6a[_0x6b6a('0x32')]);_0x8534f8[_0x6b6a('0x36')]=_[_0x6b6a('0x34')](_0x30ee6a[_0x6b6a('0x30')],qs['fields'](_0x273211[_0x6b6a('0x32')]['fields']));_0x8534f8[_0x6b6a('0x36')]=_0x8534f8[_0x6b6a('0x36')]['length']?_0x8534f8[_0x6b6a('0x36')]:_0x30ee6a[_0x6b6a('0x30')];if(_0x273211[_0x6b6a('0x32')][_0x6b6a('0x45')]){_0x8534f8['include']=[{'all':!![]}];}_0x8534f8=_[_0x6b6a('0x3f')]({},_0x8534f8,_0x273211[_0x6b6a('0x46')]);return db[_0x6b6a('0x41')][_0x6b6a('0x47')](_0x8534f8)[_0x6b6a('0x26')](handleEntityNotFound(_0x1a2e90,null))[_0x6b6a('0x26')](respondWithResult(_0x1a2e90,null))['catch'](handleError(_0x1a2e90,null));};exports[_0x6b6a('0x48')]=function(_0x587be1,_0x31a3c3){return db[_0x6b6a('0x41')][_0x6b6a('0x48')](_0x587be1[_0x6b6a('0x49')],{})[_0x6b6a('0x26')](function(_0x20a43e){var _0x30bb6a=_0x587be1['user'][_0x6b6a('0x4a')]({'plain':!![]});if(!_0x30bb6a)throw new Error(_0x6b6a('0x4b'));if(_0x30bb6a[_0x6b6a('0x4c')]===_0x6b6a('0x4d')){var _0x392626=_0x20a43e[_0x6b6a('0x4a')]({'plain':!![]});var _0x51cf58=_0x6b6a('0x28');return db[_0x6b6a('0x4e')][_0x6b6a('0x47')]({'where':{'name':_0x51cf58,'userProfileId':_0x30bb6a['userProfileId']},'raw':!![]})[_0x6b6a('0x26')](function(_0xb22f30){if(_0xb22f30&&_0xb22f30[_0x6b6a('0x4f')]===0x0){return db[_0x6b6a('0x29')]['create']({'name':_0x392626[_0x6b6a('0x2c')],'resourceId':_0x392626['id'],'type':_0xb22f30['name'],'sectionId':_0xb22f30['id']},{})[_0x6b6a('0x26')](function(){return _0x20a43e;});}else{return _0x20a43e;}})['catch'](function(_0x53de6d){logger[_0x6b6a('0x2a')](_0x6b6a('0x50'),_0x53de6d);throw _0x53de6d;});}return _0x20a43e;})['then'](respondWithResult(_0x31a3c3,0xc9))[_0x6b6a('0x44')](handleError(_0x31a3c3,null));};exports[_0x6b6a('0x51')]=function(_0x5de7cd,_0x33967a){if(_0x5de7cd[_0x6b6a('0x49')]['id']){delete _0x5de7cd[_0x6b6a('0x49')]['id'];}return db[_0x6b6a('0x41')][_0x6b6a('0x47')]({'where':{'id':_0x5de7cd[_0x6b6a('0x52')]['id']}})[_0x6b6a('0x26')](handleEntityNotFound(_0x33967a,null))[_0x6b6a('0x26')](saveUpdates(_0x5de7cd[_0x6b6a('0x49')],null))[_0x6b6a('0x26')](respondWithResult(_0x33967a,null))[_0x6b6a('0x44')](handleError(_0x33967a,null));};exports[_0x6b6a('0x27')]=function(_0x138a21,_0x4eabd2){return db[_0x6b6a('0x41')][_0x6b6a('0x47')]({'where':{'id':_0x138a21['params']['id']}})[_0x6b6a('0x26')](handleEntityNotFound(_0x4eabd2,null))[_0x6b6a('0x26')](removeEntity(_0x4eabd2,null))['catch'](handleError(_0x4eabd2,null));};exports[_0x6b6a('0x53')]=function(_0x1c3fc2,_0x5636e5,_0xa9d8c5){if(_0x1c3fc2['body']['id']){delete _0x1c3fc2[_0x6b6a('0x49')]['id'];}return db[_0x6b6a('0x41')][_0x6b6a('0x47')]({'where':{'id':_0x1c3fc2['params']['id']}})[_0x6b6a('0x26')](handleEntityNotFound(_0x5636e5,null))[_0x6b6a('0x26')](function(_0x56e131){if(_0x56e131){_0x1c3fc2[_0x6b6a('0x49')][_0x6b6a('0x54')]=_0x56e131['id'];return db['Interval'][_0x6b6a('0x48')](_0x1c3fc2[_0x6b6a('0x49')]);}})[_0x6b6a('0x26')](respondWithResult(_0x5636e5,null))[_0x6b6a('0x44')](handleError(_0x5636e5,null));};exports[_0x6b6a('0x55')]=function(_0x52fd5e,_0x50df58,_0x3e4912){var _0x2ffe69={};var _0x117f5e={};var _0x269f98;var _0x5dab7a;return db[_0x6b6a('0x41')][_0x6b6a('0x56')]({'where':{'id':_0x52fd5e[_0x6b6a('0x52')]['id']}})[_0x6b6a('0x26')](handleEntityNotFound(_0x50df58,null))[_0x6b6a('0x26')](function(_0x2756fb){if(_0x2756fb){_0x269f98=_0x2756fb;_0x117f5e['model']=_[_0x6b6a('0x33')](db[_0x6b6a('0x41')]['rawAttributes']);_0x117f5e[_0x6b6a('0x32')]=_[_0x6b6a('0x33')](_0x52fd5e[_0x6b6a('0x32')]);_0x117f5e[_0x6b6a('0x3c')]=_[_0x6b6a('0x34')](_0x117f5e[_0x6b6a('0x30')],_0x117f5e[_0x6b6a('0x32')]);_0x2ffe69[_0x6b6a('0x36')]=_['intersection'](_0x117f5e['model'],qs[_0x6b6a('0x35')](_0x52fd5e['query'][_0x6b6a('0x35')]));_0x2ffe69['attributes']=_0x2ffe69[_0x6b6a('0x36')]['length']?_0x2ffe69[_0x6b6a('0x36')]:_0x117f5e[_0x6b6a('0x30')];_0x2ffe69[_0x6b6a('0x39')]=qs['sort'](_0x52fd5e[_0x6b6a('0x32')][_0x6b6a('0x3a')]);_0x2ffe69[_0x6b6a('0x3b')]=qs[_0x6b6a('0x3c')](_[_0x6b6a('0x3d')](_0x52fd5e[_0x6b6a('0x32')],_0x117f5e['filters']));if(_0x52fd5e[_0x6b6a('0x32')][_0x6b6a('0x3e')]){_0x2ffe69[_0x6b6a('0x3b')]=_[_0x6b6a('0x3f')](_0x2ffe69[_0x6b6a('0x3b')],{'$or':_[_0x6b6a('0x31')](_0x2ffe69[_0x6b6a('0x36')],function(_0x5012fc){var _0x1a5024={};_0x1a5024[_0x5012fc]={'$like':'%'+_0x52fd5e[_0x6b6a('0x32')][_0x6b6a('0x3e')]+'%'};return _0x1a5024;})});}_0x2ffe69=_['merge']({},_0x2ffe69,_0x52fd5e[_0x6b6a('0x46')]);return _0x269f98[_0x6b6a('0x55')](_0x2ffe69);}})[_0x6b6a('0x26')](function(_0x222d63){if(_0x222d63){_0x5dab7a=_0x222d63[_0x6b6a('0x37')];if(!_0x52fd5e[_0x6b6a('0x32')]['hasOwnProperty'](_0x6b6a('0x57'))){_0x2ffe69[_0x6b6a('0x20')]=qs[_0x6b6a('0x20')](_0x52fd5e[_0x6b6a('0x32')][_0x6b6a('0x20')]);_0x2ffe69[_0x6b6a('0x1f')]=qs[_0x6b6a('0x1f')](_0x52fd5e['query'][_0x6b6a('0x1f')]);}return _0x269f98[_0x6b6a('0x55')](_0x2ffe69);}})[_0x6b6a('0x26')](function(_0x7d0775){if(_0x7d0775){return _0x7d0775?{'count':_0x5dab7a,'rows':_0x7d0775}:null;}})[_0x6b6a('0x26')](respondWithResult(_0x50df58,null))[_0x6b6a('0x44')](handleError(_0x50df58,null));};exports[_0x6b6a('0x58')]=function(_0x3d4ac8,_0x5380cc,_0x4d5def){return db[_0x6b6a('0x41')][_0x6b6a('0x56')]({'where':{'id':_0x3d4ac8[_0x6b6a('0x52')]['id']}})['then'](handleEntityNotFound(_0x5380cc,null))[_0x6b6a('0x26')](function(_0x372bd1){if(_0x372bd1){return db[_0x6b6a('0x59')][_0x6b6a('0x5a')](function(_0xfdce2b){return db['Interval']['destroy']({'where':{'IntervalId':_0x3d4ac8['params']['id']},'transaction':_0xfdce2b})[_0x6b6a('0x26')](function(_0xb66bd6){var _0x5d9423=_[_0x6b6a('0x31')](_0x3d4ac8[_0x6b6a('0x49')],function(_0x5b7c62){delete _0x5b7c62['id'];_0x5b7c62['IntervalId']=_0x3d4ac8[_0x6b6a('0x52')]['id'];return _0x5b7c62;});return db['Interval'][_0x6b6a('0x5b')](_0x5d9423,{'transaction':_0xfdce2b});});})[_0x6b6a('0x26')](function(){return db[_0x6b6a('0x41')]['findAll']({'where':{'IntervalId':_0x3d4ac8[_0x6b6a('0x52')]['id']}});});}})[_0x6b6a('0x26')](respondWithResult(_0x5380cc,null))['catch'](handleError(_0x5380cc,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 88fa91d..ed50ed6 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 _0x8cc8=['rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x8cc8,0x177));var _0x88cc=function(_0x1d64ce,_0x4a9f9b){_0x1d64ce=_0x1d64ce-0x0;var _0x42b49e=_0x8cc8[_0x1d64ce];return _0x42b49e;};'use strict';var _=require(_0x88cc('0x0'));var util=require(_0x88cc('0x1'));var logger=require(_0x88cc('0x2'))(_0x88cc('0x3'));var moment=require(_0x88cc('0x4'));var BPromise=require(_0x88cc('0x5'));var rp=require(_0x88cc('0x6'));var fs=require('fs');var path=require(_0x88cc('0x7'));var rimraf=require(_0x88cc('0x8'));var config=require(_0x88cc('0x9'));var attributes=require(_0x88cc('0xa'));var extensions=require(_0x88cc('0xb'));module[_0x88cc('0xc')]=function(_0x525362,_0x58bdd5){return _0x525362[_0x88cc('0xd')](_0x88cc('0xe'),attributes,{'tableName':_0x88cc('0xf'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4471b0,_0x4b61a1){extensions[_0x88cc('0x10')](_0x525362,_0x4471b0);},'afterBulkCreate':function(_0x2e77ae,_0x574946,_0x349991){_0x349991();extensions['rewrite'](_0x525362,_0x2e77ae[0x0]);},'afterUpdate':function(_0x379c2a,_0x23aee8){extensions[_0x88cc('0x10')](_0x525362,_0x379c2a);},'afterDestroy':function(_0x3bfea7,_0x5a70a9){extensions[_0x88cc('0x10')](_0x525362,_0x3bfea7);}}});}; \ No newline at end of file +var _0xecf3=['./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3f61a2,_0x145ade){var _0xdb4ae8=function(_0x101ede){while(--_0x101ede){_0x3f61a2['push'](_0x3f61a2['shift']());}};_0xdb4ae8(++_0x145ade);}(_0xecf3,0x66));var _0x3ecf=function(_0x550fd9,_0x3c8ba6){_0x550fd9=_0x550fd9-0x0;var _0x50bda1=_0xecf3[_0x550fd9];return _0x50bda1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3ecf('0x0'))(_0x3ecf('0x1'));var moment=require(_0x3ecf('0x2'));var BPromise=require('bluebird');var rp=require(_0x3ecf('0x3'));var fs=require('fs');var path=require(_0x3ecf('0x4'));var rimraf=require(_0x3ecf('0x5'));var config=require('../../config/environment');var attributes=require(_0x3ecf('0x6'));var extensions=require(_0x3ecf('0x7'));module['exports']=function(_0xe52550,_0x4d13b8){return _0xe52550[_0x3ecf('0x8')](_0x3ecf('0x9'),attributes,{'tableName':_0x3ecf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d1eb2,_0x3dbfef){extensions[_0x3ecf('0xb')](_0xe52550,_0x3d1eb2);},'afterBulkCreate':function(_0x20de04,_0xbdacf6,_0x5e06e5){_0x5e06e5();extensions[_0x3ecf('0xb')](_0xe52550,_0x20de04[0x0]);},'afterUpdate':function(_0x449469,_0x59759e){extensions[_0x3ecf('0xb')](_0xe52550,_0x449469);},'afterDestroy':function(_0x2efbcc,_0x5072a8){extensions[_0x3ecf('0xb')](_0xe52550,_0x2efbcc);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 8fec5da..fd4848a 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 _0x7d01=['debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','Interval,\x20%s,\x20%s','message','result','catch','GetInterval','Interval','findAll','options','where','include','model','attributes','map','then','raw','ShowInterval','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x4a5e35,_0x15cfcd){var _0x326148=function(_0xda1b65){while(--_0xda1b65){_0x4a5e35['push'](_0x4a5e35['shift']());}};_0x326148(++_0x15cfcd);}(_0x7d01,0x1ac));var _0x17d0=function(_0x171c7c,_0x16f659){_0x171c7c=_0x171c7c-0x0;var _0x1749a8=_0x7d01[_0x171c7c];return _0x1749a8;};'use strict';var _=require(_0x17d0('0x0'));var util=require(_0x17d0('0x1'));var moment=require(_0x17d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x17d0('0x3'));var fs=require('fs');var Redis=require(_0x17d0('0x4'));var db=require(_0x17d0('0x5'))['db'];var utils=require(_0x17d0('0x6'));var logger=require(_0x17d0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x17d0('0x8'));var client=jayson[_0x17d0('0x9')][_0x17d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d43b9,_0x4e83ef,_0x235d6b){return new BPromise(function(_0x928f5a,_0x1124b7){return client[_0x17d0('0xb')](_0x3d43b9,_0x235d6b)['then'](function(_0x5825db){logger[_0x17d0('0xc')]('Interval,\x20%s,\x20%s',_0x4e83ef,_0x17d0('0xd'));logger[_0x17d0('0xe')](_0x17d0('0xf'),_0x4e83ef,_0x17d0('0xd'),JSON[_0x17d0('0x10')](_0x5825db));if(_0x5825db['error']){if(_0x5825db['error']['code']===0x1f4){logger[_0x17d0('0x11')](_0x17d0('0x12'),_0x4e83ef,_0x5825db['error'][_0x17d0('0x13')]);return _0x1124b7(_0x5825db[_0x17d0('0x11')][_0x17d0('0x13')]);}logger[_0x17d0('0x11')](_0x17d0('0x12'),_0x4e83ef,_0x5825db[_0x17d0('0x11')][_0x17d0('0x13')]);return _0x928f5a(_0x5825db[_0x17d0('0x11')]['message']);}else{logger[_0x17d0('0xc')](_0x17d0('0x12'),_0x4e83ef,_0x17d0('0xd'));_0x928f5a(_0x5825db[_0x17d0('0x14')][_0x17d0('0x13')]);}})[_0x17d0('0x15')](function(_0x2669d7){logger[_0x17d0('0x11')](_0x17d0('0x12'),_0x4e83ef,_0x2669d7);_0x1124b7(_0x2669d7);});});}exports[_0x17d0('0x16')]=function(_0x17a2e9){var _0x33bd19=this;return new Promise(function(_0x367a25,_0x487e36){return db[_0x17d0('0x17')][_0x17d0('0x18')]({'raw':_0x17a2e9[_0x17d0('0x19')]?_0x17a2e9['options']['raw']===undefined?!![]:![]:!![],'where':_0x17a2e9[_0x17d0('0x19')]?_0x17a2e9[_0x17d0('0x19')][_0x17d0('0x1a')]||null:null,'attributes':_0x17a2e9[_0x17d0('0x19')]?_0x17a2e9['options']['attributes']||null:null,'limit':_0x17a2e9[_0x17d0('0x19')]?_0x17a2e9[_0x17d0('0x19')]['limit']||null:null,'include':_0x17a2e9[_0x17d0('0x19')]?_0x17a2e9[_0x17d0('0x19')][_0x17d0('0x1b')]?_['map'](_0x17a2e9[_0x17d0('0x19')][_0x17d0('0x1b')],function(_0x447aa9){return{'model':db[_0x447aa9[_0x17d0('0x1c')]],'as':_0x447aa9['as'],'attributes':_0x447aa9[_0x17d0('0x1d')],'include':_0x447aa9[_0x17d0('0x1b')]?_[_0x17d0('0x1e')](_0x447aa9['include'],function(_0x315444){return{'model':db[_0x315444['model']],'as':_0x315444['as'],'attributes':_0x315444[_0x17d0('0x1d')],'include':_0x315444[_0x17d0('0x1b')]?_['map'](_0x315444[_0x17d0('0x1b')],function(_0x119449){return{'model':db[_0x119449['model']],'as':_0x119449['as'],'attributes':_0x119449[_0x17d0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x17d0('0x1f')](function(_0x1f4f31){logger[_0x17d0('0xc')](_0x17d0('0x16'),_0x17a2e9);logger[_0x17d0('0xe')]('GetInterval',_0x17a2e9,JSON[_0x17d0('0x10')](_0x1f4f31));_0x367a25(_0x1f4f31);})['catch'](function(_0x3a79a5){logger['error'](_0x17d0('0x16'),_0x3a79a5[_0x17d0('0x13')],_0x17a2e9);_0x487e36(_0x33bd19[_0x17d0('0x11')](0x1f4,_0x3a79a5[_0x17d0('0x13')]));});});};exports['ShowInterval']=function(_0x461735){var _0x395d97=this;return new Promise(function(_0x590867,_0x18c353){return db['Interval']['find']({'raw':_0x461735[_0x17d0('0x19')]?_0x461735[_0x17d0('0x19')][_0x17d0('0x20')]===undefined?!![]:![]:!![],'where':_0x461735['options']?_0x461735[_0x17d0('0x19')][_0x17d0('0x1a')]||null:null,'attributes':_0x461735[_0x17d0('0x19')]?_0x461735['options'][_0x17d0('0x1d')]||null:null,'include':_0x461735['options']?_0x461735[_0x17d0('0x19')][_0x17d0('0x1b')]?_[_0x17d0('0x1e')](_0x461735[_0x17d0('0x19')][_0x17d0('0x1b')],function(_0x224fc0){return{'model':db[_0x224fc0[_0x17d0('0x1c')]],'as':_0x224fc0['as'],'attributes':_0x224fc0[_0x17d0('0x1d')],'include':_0x224fc0['include']?_[_0x17d0('0x1e')](_0x224fc0[_0x17d0('0x1b')],function(_0x1d6363){return{'model':db[_0x1d6363[_0x17d0('0x1c')]],'as':_0x1d6363['as'],'attributes':_0x1d6363[_0x17d0('0x1d')],'include':_0x1d6363['include']?_['map'](_0x1d6363[_0x17d0('0x1b')],function(_0x5c1016){return{'model':db[_0x5c1016[_0x17d0('0x1c')]],'as':_0x5c1016['as'],'attributes':_0x5c1016[_0x17d0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x17d0('0x1f')](function(_0x198be5){logger[_0x17d0('0xc')](_0x17d0('0x21'),_0x461735);logger['debug'](_0x17d0('0x21'),_0x461735,JSON[_0x17d0('0x10')](_0x198be5));_0x590867(_0x198be5);})['catch'](function(_0x47b88f){logger[_0x17d0('0x11')]('ShowInterval',_0x47b88f[_0x17d0('0x13')],_0x461735);_0x18c353(_0x395d97[_0x17d0('0x11')](0x1f4,_0x47b88f['message']));});});}; \ No newline at end of file +var _0x5c37=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','error','code','Interval,\x20%s,\x20%s','message','catch','GetInterval','Interval','findAll','options','where','attributes','limit','include','map','model','stringify','ShowInterval','find','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x38d763,_0x4d5ab5){var _0x54e88e=function(_0x2cae35){while(--_0x2cae35){_0x38d763['push'](_0x38d763['shift']());}};_0x54e88e(++_0x4d5ab5);}(_0x5c37,0xf6));var _0x75c3=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0x5c37[_0x28f1de];return _0x5b5dad;};'use strict';var _=require(_0x75c3('0x0'));var util=require(_0x75c3('0x1'));var moment=require(_0x75c3('0x2'));var BPromise=require('bluebird');var rs=require(_0x75c3('0x3'));var fs=require('fs');var Redis=require(_0x75c3('0x4'));var db=require(_0x75c3('0x5'))['db'];var utils=require(_0x75c3('0x6'));var logger=require(_0x75c3('0x7'))(_0x75c3('0x8'));var config=require(_0x75c3('0x9'));var jayson=require(_0x75c3('0xa'));var client=jayson[_0x75c3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d963b,_0x1a5506,_0x4c805f){return new BPromise(function(_0x489480,_0x143e00){return client[_0x75c3('0xc')](_0x3d963b,_0x4c805f)[_0x75c3('0xd')](function(_0x48e2f7){logger[_0x75c3('0xe')]('Interval,\x20%s,\x20%s',_0x1a5506,_0x75c3('0xf'));logger['debug'](_0x75c3('0x10'),_0x1a5506,_0x75c3('0xf'),JSON['stringify'](_0x48e2f7));if(_0x48e2f7[_0x75c3('0x11')]){if(_0x48e2f7[_0x75c3('0x11')][_0x75c3('0x12')]===0x1f4){logger[_0x75c3('0x11')](_0x75c3('0x13'),_0x1a5506,_0x48e2f7[_0x75c3('0x11')]['message']);return _0x143e00(_0x48e2f7[_0x75c3('0x11')][_0x75c3('0x14')]);}logger['error']('Interval,\x20%s,\x20%s',_0x1a5506,_0x48e2f7[_0x75c3('0x11')][_0x75c3('0x14')]);return _0x489480(_0x48e2f7['error'][_0x75c3('0x14')]);}else{logger['info'](_0x75c3('0x13'),_0x1a5506,'request\x20sent');_0x489480(_0x48e2f7['result']['message']);}})[_0x75c3('0x15')](function(_0x3b9007){logger[_0x75c3('0x11')]('Interval,\x20%s,\x20%s',_0x1a5506,_0x3b9007);_0x143e00(_0x3b9007);});});}exports[_0x75c3('0x16')]=function(_0x3100cf){var _0x2b0cfd=this;return new Promise(function(_0xcb3e88,_0x2e0eee){return db[_0x75c3('0x17')][_0x75c3('0x18')]({'raw':_0x3100cf['options']?_0x3100cf[_0x75c3('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3100cf[_0x75c3('0x19')]?_0x3100cf[_0x75c3('0x19')][_0x75c3('0x1a')]||null:null,'attributes':_0x3100cf['options']?_0x3100cf[_0x75c3('0x19')][_0x75c3('0x1b')]||null:null,'limit':_0x3100cf[_0x75c3('0x19')]?_0x3100cf[_0x75c3('0x19')][_0x75c3('0x1c')]||null:null,'include':_0x3100cf['options']?_0x3100cf[_0x75c3('0x19')][_0x75c3('0x1d')]?_[_0x75c3('0x1e')](_0x3100cf[_0x75c3('0x19')][_0x75c3('0x1d')],function(_0x53e4f4){return{'model':db[_0x53e4f4[_0x75c3('0x1f')]],'as':_0x53e4f4['as'],'attributes':_0x53e4f4[_0x75c3('0x1b')],'include':_0x53e4f4[_0x75c3('0x1d')]?_[_0x75c3('0x1e')](_0x53e4f4[_0x75c3('0x1d')],function(_0x1dc3c2){return{'model':db[_0x1dc3c2[_0x75c3('0x1f')]],'as':_0x1dc3c2['as'],'attributes':_0x1dc3c2['attributes'],'include':_0x1dc3c2['include']?_[_0x75c3('0x1e')](_0x1dc3c2['include'],function(_0xec9b59){return{'model':db[_0xec9b59['model']],'as':_0xec9b59['as'],'attributes':_0xec9b59['attributes']};}):[]};}):[]};}):[]:[]})[_0x75c3('0xd')](function(_0x329b9d){logger[_0x75c3('0xe')](_0x75c3('0x16'),_0x3100cf);logger['debug'](_0x75c3('0x16'),_0x3100cf,JSON[_0x75c3('0x20')](_0x329b9d));_0xcb3e88(_0x329b9d);})[_0x75c3('0x15')](function(_0x4d5836){logger[_0x75c3('0x11')](_0x75c3('0x16'),_0x4d5836[_0x75c3('0x14')],_0x3100cf);_0x2e0eee(_0x2b0cfd['error'](0x1f4,_0x4d5836['message']));});});};exports[_0x75c3('0x21')]=function(_0x2fdc87){var _0x4b2867=this;return new Promise(function(_0x2d6fce,_0x314dc4){return db[_0x75c3('0x17')][_0x75c3('0x22')]({'raw':_0x2fdc87['options']?_0x2fdc87[_0x75c3('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2fdc87[_0x75c3('0x19')]?_0x2fdc87[_0x75c3('0x19')][_0x75c3('0x1a')]||null:null,'attributes':_0x2fdc87['options']?_0x2fdc87[_0x75c3('0x19')]['attributes']||null:null,'include':_0x2fdc87[_0x75c3('0x19')]?_0x2fdc87['options']['include']?_[_0x75c3('0x1e')](_0x2fdc87[_0x75c3('0x19')][_0x75c3('0x1d')],function(_0x1cb40c){return{'model':db[_0x1cb40c[_0x75c3('0x1f')]],'as':_0x1cb40c['as'],'attributes':_0x1cb40c[_0x75c3('0x1b')],'include':_0x1cb40c[_0x75c3('0x1d')]?_['map'](_0x1cb40c[_0x75c3('0x1d')],function(_0x35c241){return{'model':db[_0x35c241[_0x75c3('0x1f')]],'as':_0x35c241['as'],'attributes':_0x35c241[_0x75c3('0x1b')],'include':_0x35c241[_0x75c3('0x1d')]?_[_0x75c3('0x1e')](_0x35c241[_0x75c3('0x1d')],function(_0x2d6836){return{'model':db[_0x2d6836['model']],'as':_0x2d6836['as'],'attributes':_0x2d6836['attributes']};}):[]};}):[]};}):[]:[]})[_0x75c3('0xd')](function(_0x2ebb07){logger[_0x75c3('0xe')](_0x75c3('0x21'),_0x2fdc87);logger[_0x75c3('0x23')]('ShowInterval',_0x2fdc87,JSON[_0x75c3('0x20')](_0x2ebb07));_0x2d6fce(_0x2ebb07);})[_0x75c3('0x15')](function(_0x391144){logger['error'](_0x75c3('0x21'),_0x391144[_0x75c3('0x14')],_0x2fdc87);_0x314dc4(_0x4b2867[_0x75c3('0x11')](0x1f4,_0x391144['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index bc18ec1..59a114f 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 _0x2816=['isAuthenticated','send','express','Router','./jira.controller','post'];(function(_0x4a2f68,_0x2a864d){var _0x55f946=function(_0x50b711){while(--_0x50b711){_0x4a2f68['push'](_0x4a2f68['shift']());}};_0x55f946(++_0x2a864d);}(_0x2816,0xc2));var _0x6281=function(_0x123414,_0x4f85f6){_0x123414=_0x123414-0x0;var _0x50e83a=_0x2816[_0x123414];return _0x50e83a;};'use strict';var express=require(_0x6281('0x0'));var router=express[_0x6281('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6281('0x2'));router[_0x6281('0x3')]('/',auth[_0x6281('0x4')](),controller[_0x6281('0x5')]);module['exports']=router; \ No newline at end of file +var _0x46b5=['../../components/auth/service','./jira.controller','post','isAuthenticated','exports'];(function(_0x40b5cd,_0x5b455a){var _0x3e8ff8=function(_0x2bed81){while(--_0x2bed81){_0x40b5cd['push'](_0x40b5cd['shift']());}};_0x3e8ff8(++_0x5b455a);}(_0x46b5,0x168));var _0x546b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x46b5[_0x21a9d9];return _0x46adce;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x546b('0x0'));var controller=require(_0x546b('0x1'));router[_0x546b('0x2')]('/',auth[_0x546b('0x3')](),controller['send']);module[_0x546b('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 84687ba..eb60043 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 _0xfb96=['https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','customfield_11501','oldToken','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','request','data','parse','status','json','api.jira','write','end','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird'];(function(_0x19a593,_0x546cc0){var _0x439a07=function(_0x41c1b3){while(--_0x41c1b3){_0x19a593['push'](_0x19a593['shift']());}};_0x439a07(++_0x546cc0);}(_0xfb96,0x101));var _0x6fb9=function(_0x3eba4f,_0x51f6f4){_0x3eba4f=_0x3eba4f-0x0;var _0x56da1c=_0xfb96[_0x3eba4f];return _0x56da1c;};'use strict';var BPromise=require(_0x6fb9('0x0'));var https=require(_0x6fb9('0x1'));var logger=require(_0x6fb9('0x2'))(_0x6fb9('0x3'));var USERNAME=_0x6fb9('0x4');var PASSWORD=_0x6fb9('0x5');function openIssue(_0xe53aba,_0xfe0502){var _0x529e0a={'fields':{'project':{'key':_0xe53aba[_0x6fb9('0x6')]||_0x6fb9('0x7')},'summary':(_0xe53aba[_0x6fb9('0x8')]||_0x6fb9('0x9'))+_0x6fb9('0xa')+_0xe53aba['ip'],'description':_0xe53aba[_0x6fb9('0xb')]||JSON[_0x6fb9('0xc')](_0xe53aba),'issuetype':{'name':_0xe53aba[_0x6fb9('0xd')]||'Bug'}}};_0x529e0a[_0x6fb9('0xe')][_0x6fb9('0xf')]=_0xe53aba['email'];_0x529e0a[_0x6fb9('0xe')][_0x6fb9('0x10')]=_0xe53aba[_0x6fb9('0x11')];_0x529e0a['fields']['customfield_11502']=_0xe53aba[_0x6fb9('0x12')];_0x529e0a[_0x6fb9('0xe')][_0x6fb9('0x13')]=_0xe53aba['name'];_0x529e0a['fields'][_0x6fb9('0x14')]=_0xe53aba[_0x6fb9('0x15')];_0x529e0a[_0x6fb9('0xe')][_0x6fb9('0x16')]=_0xe53aba['ip'];var _0x590fb7={'host':_0x6fb9('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x6fb9('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x6fb9('0x19'),'Authorization':_0x6fb9('0x1a')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x6fb9('0x1b'))}};var _0x1511c3=JSON[_0x6fb9('0xc')](_0x529e0a);var _0x1d91a8=https[_0x6fb9('0x1c')](_0x590fb7,function(_0x3e0854){_0x3e0854['setEncoding']('utf8');var _0xc3c754='';_0x3e0854['on'](_0x6fb9('0x1d'),function(_0x5a2c12){_0xc3c754+=_0x5a2c12;});_0x3e0854['on']('end',function(){if(_0xfe0502){return _0xfe0502['status'](_0x3e0854['statusCode'])['json'](JSON[_0x6fb9('0x1e')](_0xc3c754));}});});_0x1d91a8['on']('error',function(_0x495268){if(_0xfe0502){return _0xfe0502[_0x6fb9('0x1f')](0x1f4)[_0x6fb9('0x20')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x6fb9('0x21')}]});}});_0x1d91a8[_0x6fb9('0x22')](_0x1511c3);_0x1d91a8[_0x6fb9('0x23')]();}exports['openIssue']=openIssue;exports[_0x6fb9('0x24')]=function(_0x3965db,_0x59973a){_0x3965db[_0x6fb9('0x25')]['ip']=_0x3965db[_0x6fb9('0x26')][_0x6fb9('0x27')]||_0x3965db[_0x6fb9('0x28')]['remoteAddress']||_0x3965db['socket'][_0x6fb9('0x29')]||_0x3965db[_0x6fb9('0x28')][_0x6fb9('0x2a')][_0x6fb9('0x29')];return openIssue(_0x3965db[_0x6fb9('0x25')],_0x59973a);}; \ No newline at end of file +var _0x6b50=['fields','email','customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','request','setEncoding','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','stringify','issuetype','Bug'];(function(_0x9b1656,_0x38c232){var _0x4ad5fb=function(_0x5f4cc9){while(--_0x5f4cc9){_0x9b1656['push'](_0x9b1656['shift']());}};_0x4ad5fb(++_0x38c232);}(_0x6b50,0x16e));var _0x06b5=function(_0x10f272,_0x45f491){_0x10f272=_0x10f272-0x0;var _0x7fd311=_0x6b50[_0x10f272];return _0x7fd311;};'use strict';var BPromise=require('bluebird');var https=require(_0x06b5('0x0'));var logger=require(_0x06b5('0x1'))(_0x06b5('0x2'));var USERNAME=_0x06b5('0x3');var PASSWORD=_0x06b5('0x4');function openIssue(_0x9364b8,_0x3dbfa8){var _0x29138f={'fields':{'project':{'key':_0x9364b8[_0x06b5('0x5')]||_0x06b5('0x6')},'summary':(_0x9364b8['summary']||_0x06b5('0x7'))+_0x06b5('0x8')+_0x9364b8['ip'],'description':_0x9364b8['description']||JSON[_0x06b5('0x9')](_0x9364b8),'issuetype':{'name':_0x9364b8[_0x06b5('0xa')]||_0x06b5('0xb')}}};_0x29138f[_0x06b5('0xc')]['customfield_11500']=_0x9364b8[_0x06b5('0xd')];_0x29138f[_0x06b5('0xc')][_0x06b5('0xe')]=_0x9364b8[_0x06b5('0xf')];_0x29138f[_0x06b5('0xc')][_0x06b5('0x10')]=_0x9364b8['newToken'];_0x29138f[_0x06b5('0xc')][_0x06b5('0x11')]=_0x9364b8[_0x06b5('0x12')];_0x29138f[_0x06b5('0xc')][_0x06b5('0x13')]=_0x9364b8[_0x06b5('0x14')];_0x29138f['fields'][_0x06b5('0x15')]=_0x9364b8['ip'];var _0x4678f7={'host':_0x06b5('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x06b5('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x06b5('0x18'),'Authorization':_0x06b5('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x06b5('0x1a')]('base64')}};var _0x469518=JSON['stringify'](_0x29138f);var _0x1f0896=https[_0x06b5('0x1b')](_0x4678f7,function(_0x5c97cd){_0x5c97cd[_0x06b5('0x1c')]('utf8');var _0xff3e86='';_0x5c97cd['on'](_0x06b5('0x1d'),function(_0x23fea1){_0xff3e86+=_0x23fea1;});_0x5c97cd['on'](_0x06b5('0x1e'),function(){if(_0x3dbfa8){return _0x3dbfa8[_0x06b5('0x1f')](_0x5c97cd[_0x06b5('0x20')])[_0x06b5('0x21')](JSON['parse'](_0xff3e86));}});});_0x1f0896['on'](_0x06b5('0x22'),function(_0x105fcf){if(_0x3dbfa8){return _0x3dbfa8['status'](0x1f4)[_0x06b5('0x21')]({'errors':[{'message':_0x06b5('0x23'),'type':_0x06b5('0x24')}]});}});_0x1f0896[_0x06b5('0x25')](_0x469518);_0x1f0896['end']();}exports['openIssue']=openIssue;exports['send']=function(_0x2ba436,_0x1f4af7){_0x2ba436['body']['ip']=_0x2ba436['headers'][_0x06b5('0x26')]||_0x2ba436[_0x06b5('0x27')][_0x06b5('0x28')]||_0x2ba436['socket'][_0x06b5('0x28')]||_0x2ba436[_0x06b5('0x27')][_0x06b5('0x29')][_0x06b5('0x28')];return openIssue(_0x2ba436['body'],_0x1f4af7);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 8431fcf..1839e2a 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 _0xa2ea=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','put','delete','multer','util','path','Router'];(function(_0x383965,_0x21c64f){var _0x1ca695=function(_0x520062){while(--_0x520062){_0x383965['push'](_0x383965['shift']());}};_0x1ca695(++_0x21c64f);}(_0xa2ea,0x7c));var _0xaa2e=function(_0xa86f0e,_0x48f50b){_0xa86f0e=_0xa86f0e-0x0;var _0x31815f=_0xa2ea[_0xa86f0e];return _0x31815f;};'use strict';var multer=require(_0xaa2e('0x0'));var util=require(_0xaa2e('0x1'));var path=require(_0xaa2e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaa2e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xaa2e('0x4'));var interaction=require(_0xaa2e('0x5'));var config=require(_0xaa2e('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0xaa2e('0x7')]('/',auth['isAuthenticated'](),controller[_0xaa2e('0x8')]);router['get'](_0xaa2e('0x9'),auth[_0xaa2e('0xa')](),controller[_0xaa2e('0xb')]);router['get'](_0xaa2e('0xc'),auth['isAuthenticated'](),controller[_0xaa2e('0xd')]);router['post']('/',auth[_0xaa2e('0xa')](),controller['create']);router[_0xaa2e('0xe')](_0xaa2e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xaa2e('0xf')](_0xaa2e('0xc'),auth[_0xaa2e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x33e6=['post','create','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x389794,_0x143ee0){var _0x389f2d=function(_0x59a9b8){while(--_0x59a9b8){_0x389794['push'](_0x389794['shift']());}};_0x389f2d(++_0x143ee0);}(_0x33e6,0x135));var _0x633e=function(_0x43f471,_0xf492ea){_0x43f471=_0x43f471-0x0;var _0x3863e7=_0x33e6[_0x43f471];return _0x3863e7;};'use strict';var multer=require(_0x633e('0x0'));var util=require(_0x633e('0x1'));var path=require('path');var timeout=require(_0x633e('0x2'));var express=require(_0x633e('0x3'));var router=express[_0x633e('0x4')]();var fs_extra=require(_0x633e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x633e('0x6'));router[_0x633e('0x7')]('/',auth[_0x633e('0x8')](),controller['index']);router[_0x633e('0x7')]('/describe',auth[_0x633e('0x8')](),controller[_0x633e('0x9')]);router['get'](_0x633e('0xa'),auth[_0x633e('0x8')](),controller['show']);router[_0x633e('0xb')]('/',auth[_0x633e('0x8')](),controller[_0x633e('0xc')]);router[_0x633e('0xd')](_0x633e('0xa'),auth[_0x633e('0x8')](),controller[_0x633e('0xe')]);router[_0x633e('0xf')](_0x633e('0xa'),auth[_0x633e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 50c85d3..8e27635 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 _0x9c00=['sequelize','exports','long','STRING'];(function(_0x3df042,_0x4ce182){var _0xe0ef6d=function(_0x5bbfed){while(--_0x5bbfed){_0x3df042['push'](_0x3df042['shift']());}};_0xe0ef6d(++_0x4ce182);}(_0x9c00,0x1a0));var _0x09c0=function(_0x1b7171,_0x533d9a){_0x1b7171=_0x1b7171-0x0;var _0x3c3db2=_0x9c00[_0x1b7171];return _0x3c3db2;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize['TEXT'](_0x09c0('0x2'))},'membername':{'type':Sequelize[_0x09c0('0x3')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x09c0('0x3')]},'uniqueid':{'type':Sequelize[_0x09c0('0x3')]},'calleridname':{'type':Sequelize[_0x09c0('0x3')]},'calleridnum':{'type':Sequelize[_0x09c0('0x3')]},'questionId':{'type':Sequelize[_0x09c0('0x3')]}}; \ No newline at end of file +var _0x536f=['sequelize','STRING'];(function(_0x2d6b9d,_0x6498e9){var _0x20ef02=function(_0x39eaee){while(--_0x39eaee){_0x2d6b9d['push'](_0x2d6b9d['shift']());}};_0x20ef02(++_0x6498e9);}(_0x536f,0x70));var _0xf536=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x536f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xf536('0x0'));module['exports']={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0xf536('0x1')]},'projectname':{'type':Sequelize[_0xf536('0x1')]},'queue':{'type':Sequelize[_0xf536('0x1')]},'uniqueid':{'type':Sequelize[_0xf536('0x1')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf536('0x1')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 6b4a100..660752e 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 _0xf385=['apply','reject','save','then','destroy','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','rows','params','includeAll','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf385,0x1df));var _0x5f38=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0xf385[_0x32729c];return _0x482cfd;};'use strict';var emlformat=require(_0x5f38('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f38('0x1'));var jsonpatch=require(_0x5f38('0x2'));var rp=require(_0x5f38('0x3'));var moment=require(_0x5f38('0x4'));var BPromise=require(_0x5f38('0x5'));var Mustache=require(_0x5f38('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5f38('0x7'));var csv=require(_0x5f38('0x8'));var ejs=require(_0x5f38('0x9'));var fs=require('fs');var fs_extra=require(_0x5f38('0xa'));var _=require(_0x5f38('0xb'));var squel=require(_0x5f38('0xc'));var crypto=require(_0x5f38('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5f38('0xe'));var toCsv=require(_0x5f38('0x8'));var querystring=require(_0x5f38('0xf'));var Papa=require('papaparse');var Redis=require(_0x5f38('0x10'));var authService=require(_0x5f38('0x11'));var qs=require(_0x5f38('0x12'));var as=require(_0x5f38('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5f38('0x14'));var config=require(_0x5f38('0x15'));var licenseUtil=require(_0x5f38('0x16'));var db=require(_0x5f38('0x17'))['db'];function respondWithStatusCode(_0x309507,_0x490a0b){_0x490a0b=_0x490a0b||0xcc;return function(_0x5cdb0d){if(_0x5cdb0d){return _0x309507['sendStatus'](_0x490a0b);}return _0x309507[_0x5f38('0x18')](_0x490a0b)[_0x5f38('0x19')]();};}function respondWithResult(_0x4bf027,_0x1e759c){_0x1e759c=_0x1e759c||0xc8;return function(_0x286aeb){if(_0x286aeb){return _0x4bf027[_0x5f38('0x18')](_0x1e759c)[_0x5f38('0x1a')](_0x286aeb);}};}function respondWithFilteredResult(_0x361208,_0x5b54a7){return function(_0x433422){if(_0x433422){var _0x27b127=typeof _0x5b54a7['offset']===_0x5f38('0x1b')&&typeof _0x5b54a7['limit']===_0x5f38('0x1b');var _0x4aef1e=_0x433422[_0x5f38('0x1c')];var _0x3a98a8=_0x27b127?0x0:_0x5b54a7[_0x5f38('0x1d')];var _0x203074=_0x27b127?_0x433422[_0x5f38('0x1c')]:_0x5b54a7[_0x5f38('0x1d')]+_0x5b54a7[_0x5f38('0x1e')];var _0x76a4c5;if(_0x203074>=_0x4aef1e){_0x203074=_0x4aef1e;_0x76a4c5=0xc8;}else{_0x76a4c5=0xce;}_0x361208[_0x5f38('0x18')](_0x76a4c5);return _0x361208[_0x5f38('0x1f')]('Content-Range',_0x3a98a8+'-'+_0x203074+'/'+_0x4aef1e)[_0x5f38('0x1a')](_0x433422);}return null;};}function patchUpdates(_0x9affcd){return function(_0x222af4){try{jsonpatch[_0x5f38('0x20')](_0x222af4,_0x9affcd,!![]);}catch(_0x46c0f4){return BPromise[_0x5f38('0x21')](_0x46c0f4);}return _0x222af4[_0x5f38('0x22')]();};}function saveUpdates(_0x48c81f,_0x52b4de){return function(_0x2329af){if(_0x2329af){return _0x2329af['update'](_0x48c81f)[_0x5f38('0x23')](function(_0x33a75b){return _0x33a75b;});}return null;};}function removeEntity(_0x55c97b,_0x35b9b4){return function(_0x45404f){if(_0x45404f){return _0x45404f[_0x5f38('0x24')]()['then'](function(){_0x55c97b['status'](0xcc)[_0x5f38('0x19')]();});}};}function handleEntityNotFound(_0x1b9532,_0x44af08){return function(_0xc1341b){if(!_0xc1341b){_0x1b9532['sendStatus'](0x194);}return _0xc1341b;};}function handleError(_0x5a8ec9,_0x3753bb){_0x3753bb=_0x3753bb||0x1f4;return function(_0x3b37ef){logger[_0x5f38('0x25')](_0x3b37ef[_0x5f38('0x26')]);if(_0x3b37ef[_0x5f38('0x27')]){delete _0x3b37ef[_0x5f38('0x27')];}_0x5a8ec9[_0x5f38('0x18')](_0x3753bb)['send'](_0x3b37ef);};}exports[_0x5f38('0x28')]=function(_0xb4ca34,_0x1ab410){var _0x12b584={},_0xf179eb={},_0x7cb96a={'count':0x0,'rows':[]};var _0x8633b0=_[_0x5f38('0x29')](db[_0x5f38('0x2a')][_0x5f38('0x2b')],function(_0x5cf25c){return{'name':_0x5cf25c[_0x5f38('0x2c')],'type':_0x5cf25c['type'][_0x5f38('0x2d')]};});_0xf179eb[_0x5f38('0x2e')]=_[_0x5f38('0x29')](_0x8633b0,_0x5f38('0x27'));_0xf179eb['query']=_[_0x5f38('0x2f')](_0xb4ca34[_0x5f38('0x30')]);_0xf179eb[_0x5f38('0x31')]=_[_0x5f38('0x32')](_0xf179eb[_0x5f38('0x2e')],_0xf179eb[_0x5f38('0x30')]);_0x12b584[_0x5f38('0x33')]=_['intersection'](_0xf179eb[_0x5f38('0x2e')],qs['fields'](_0xb4ca34[_0x5f38('0x30')][_0x5f38('0x34')]));_0x12b584['attributes']=_0x12b584['attributes'][_0x5f38('0x35')]?_0x12b584[_0x5f38('0x33')]:_0xf179eb[_0x5f38('0x2e')];if(!_0xb4ca34[_0x5f38('0x30')][_0x5f38('0x36')](_0x5f38('0x37'))){_0x12b584[_0x5f38('0x1e')]=qs[_0x5f38('0x1e')](_0xb4ca34[_0x5f38('0x30')][_0x5f38('0x1e')]);_0x12b584[_0x5f38('0x1d')]=qs[_0x5f38('0x1d')](_0xb4ca34[_0x5f38('0x30')][_0x5f38('0x1d')]);}_0x12b584[_0x5f38('0x38')]=qs[_0x5f38('0x39')](_0xb4ca34[_0x5f38('0x30')][_0x5f38('0x39')]);_0x12b584[_0x5f38('0x3a')]=qs[_0x5f38('0x31')](_[_0x5f38('0x3b')](_0xb4ca34[_0x5f38('0x30')],_0xf179eb[_0x5f38('0x31')]),_0x8633b0);if(_0xb4ca34[_0x5f38('0x30')][_0x5f38('0x3c')]){_0x12b584['where']=_[_0x5f38('0x3d')](_0x12b584[_0x5f38('0x3a')],{'$or':_['map'](_0x8633b0,function(_0x378703){if(_0x378703[_0x5f38('0x3e')]!==_0x5f38('0x3f')){var _0x4e8292={};_0x4e8292[_0x378703['name']]={'$like':'%'+_0xb4ca34[_0x5f38('0x30')][_0x5f38('0x3c')]+'%'};return _0x4e8292;}})});}_0x12b584=_['merge']({},_0x12b584,_0xb4ca34[_0x5f38('0x40')]);var _0x2c8040={'where':_0x12b584['where']};return db[_0x5f38('0x2a')][_0x5f38('0x1c')](_0x2c8040)[_0x5f38('0x23')](function(_0x200273){_0x7cb96a[_0x5f38('0x1c')]=_0x200273;if(_0xb4ca34[_0x5f38('0x30')]['includeAll']){_0x12b584['include']=[{'all':!![]}];}return db[_0x5f38('0x2a')]['findAll'](_0x12b584);})[_0x5f38('0x23')](function(_0x5ef88d){_0x7cb96a[_0x5f38('0x41')]=_0x5ef88d;return _0x7cb96a;})[_0x5f38('0x23')](respondWithFilteredResult(_0x1ab410,_0x12b584))['catch'](handleError(_0x1ab410,null));};exports['show']=function(_0x276973,_0x5dc46e){var _0x3de0c1={'raw':!![],'where':{'id':_0x276973[_0x5f38('0x42')]['id']}},_0x388a1d={};_0x388a1d[_0x5f38('0x2e')]=_[_0x5f38('0x2f')](db[_0x5f38('0x2a')][_0x5f38('0x2b')]);_0x388a1d[_0x5f38('0x30')]=_[_0x5f38('0x2f')](_0x276973[_0x5f38('0x30')]);_0x388a1d['filters']=_[_0x5f38('0x32')](_0x388a1d[_0x5f38('0x2e')],_0x388a1d['query']);_0x3de0c1['attributes']=_[_0x5f38('0x32')](_0x388a1d[_0x5f38('0x2e')],qs[_0x5f38('0x34')](_0x276973['query'][_0x5f38('0x34')]));_0x3de0c1[_0x5f38('0x33')]=_0x3de0c1[_0x5f38('0x33')][_0x5f38('0x35')]?_0x3de0c1[_0x5f38('0x33')]:_0x388a1d[_0x5f38('0x2e')];if(_0x276973['query'][_0x5f38('0x43')]){_0x3de0c1['include']=[{'all':!![]}];}_0x3de0c1=_[_0x5f38('0x3d')]({},_0x3de0c1,_0x276973['options']);return db[_0x5f38('0x2a')][_0x5f38('0x44')](_0x3de0c1)[_0x5f38('0x23')](handleEntityNotFound(_0x5dc46e,null))[_0x5f38('0x23')](respondWithResult(_0x5dc46e,null))[_0x5f38('0x45')](handleError(_0x5dc46e,null));};exports[_0x5f38('0x46')]=function(_0x33f55e,_0x2e8ac9){return db['JscriptyAnswerReport']['create'](_0x33f55e['body'],{})[_0x5f38('0x23')](respondWithResult(_0x2e8ac9,0xc9))['catch'](handleError(_0x2e8ac9,null));};exports['update']=function(_0x59578b,_0x4daf15){if(_0x59578b[_0x5f38('0x47')]['id']){delete _0x59578b[_0x5f38('0x47')]['id'];}return db[_0x5f38('0x2a')]['find']({'where':{'id':_0x59578b[_0x5f38('0x42')]['id']}})[_0x5f38('0x23')](handleEntityNotFound(_0x4daf15,null))[_0x5f38('0x23')](saveUpdates(_0x59578b[_0x5f38('0x47')],null))[_0x5f38('0x23')](respondWithResult(_0x4daf15,null))[_0x5f38('0x45')](handleError(_0x4daf15,null));};exports[_0x5f38('0x24')]=function(_0x1c560d,_0x59ccaa){return db[_0x5f38('0x2a')][_0x5f38('0x44')]({'where':{'id':_0x1c560d[_0x5f38('0x42')]['id']}})[_0x5f38('0x23')](handleEntityNotFound(_0x59ccaa,null))[_0x5f38('0x23')](removeEntity(_0x59ccaa,null))[_0x5f38('0x45')](handleError(_0x59ccaa,null));};exports[_0x5f38('0x48')]=function(_0x2a3fd7,_0x55f283){return db[_0x5f38('0x2a')][_0x5f38('0x48')]()[_0x5f38('0x23')](respondWithResult(_0x55f283,null))['catch'](handleError(_0x55f283,null));}; \ No newline at end of file +var _0x581a=['where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x581a,0x13a));var _0xa581=function(_0x5978c4,_0x3c9f3d){_0x5978c4=_0x5978c4-0x0;var _0x4a2d6f=_0x581a[_0x5978c4];return _0x4a2d6f;};'use strict';var emlformat=require(_0xa581('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa581('0x1'));var jsonpatch=require(_0xa581('0x2'));var rp=require(_0xa581('0x3'));var moment=require('moment');var BPromise=require(_0xa581('0x4'));var Mustache=require(_0xa581('0x5'));var util=require(_0xa581('0x6'));var path=require(_0xa581('0x7'));var sox=require(_0xa581('0x8'));var csv=require(_0xa581('0x9'));var ejs=require(_0xa581('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa581('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa581('0xc'));var deskjs=require(_0xa581('0xd'));var toCsv=require(_0xa581('0x9'));var querystring=require(_0xa581('0xe'));var Papa=require('papaparse');var Redis=require(_0xa581('0xf'));var authService=require(_0xa581('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa581('0x11'))(_0xa581('0x12'));var utils=require(_0xa581('0x13'));var config=require(_0xa581('0x14'));var licenseUtil=require(_0xa581('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b4dce,_0x36db83){_0x36db83=_0x36db83||0xcc;return function(_0xd7805a){if(_0xd7805a){return _0x1b4dce[_0xa581('0x16')](_0x36db83);}return _0x1b4dce[_0xa581('0x17')](_0x36db83)[_0xa581('0x18')]();};}function respondWithResult(_0x49947d,_0xae5da8){_0xae5da8=_0xae5da8||0xc8;return function(_0x2dcab1){if(_0x2dcab1){return _0x49947d[_0xa581('0x17')](_0xae5da8)[_0xa581('0x19')](_0x2dcab1);}};}function respondWithFilteredResult(_0x4dc721,_0x4269b6){return function(_0x4b3654){if(_0x4b3654){var _0x4a3b13=typeof _0x4269b6[_0xa581('0x1a')]===_0xa581('0x1b')&&typeof _0x4269b6[_0xa581('0x1c')]==='undefined';var _0x2d9015=_0x4b3654['count'];var _0x7efc10=_0x4a3b13?0x0:_0x4269b6[_0xa581('0x1a')];var _0x1e776d=_0x4a3b13?_0x4b3654[_0xa581('0x1d')]:_0x4269b6['offset']+_0x4269b6['limit'];var _0xc01126;if(_0x1e776d>=_0x2d9015){_0x1e776d=_0x2d9015;_0xc01126=0xc8;}else{_0xc01126=0xce;}_0x4dc721['status'](_0xc01126);return _0x4dc721[_0xa581('0x1e')](_0xa581('0x1f'),_0x7efc10+'-'+_0x1e776d+'/'+_0x2d9015)[_0xa581('0x19')](_0x4b3654);}return null;};}function patchUpdates(_0x19119d){return function(_0x43b954){try{jsonpatch[_0xa581('0x20')](_0x43b954,_0x19119d,!![]);}catch(_0x823f56){return BPromise[_0xa581('0x21')](_0x823f56);}return _0x43b954['save']();};}function saveUpdates(_0x34c071,_0x3b9106){return function(_0x2b8b33){if(_0x2b8b33){return _0x2b8b33[_0xa581('0x22')](_0x34c071)[_0xa581('0x23')](function(_0x4d643a){return _0x4d643a;});}return null;};}function removeEntity(_0x47fffd,_0x5433ad){return function(_0xb14540){if(_0xb14540){return _0xb14540[_0xa581('0x24')]()['then'](function(){_0x47fffd[_0xa581('0x17')](0xcc)[_0xa581('0x18')]();});}};}function handleEntityNotFound(_0x1e8918,_0x128726){return function(_0x19b448){if(!_0x19b448){_0x1e8918[_0xa581('0x16')](0x194);}return _0x19b448;};}function handleError(_0x484170,_0x9e604c){_0x9e604c=_0x9e604c||0x1f4;return function(_0x148930){logger[_0xa581('0x25')](_0x148930[_0xa581('0x26')]);if(_0x148930[_0xa581('0x27')]){delete _0x148930[_0xa581('0x27')];}_0x484170[_0xa581('0x17')](_0x9e604c)[_0xa581('0x28')](_0x148930);};}exports[_0xa581('0x29')]=function(_0x1058e5,_0xf1b932){var _0x1bd7cd={},_0x18272d={},_0x4055f3={'count':0x0,'rows':[]};var _0x2e1298=_[_0xa581('0x2a')](db[_0xa581('0x2b')]['rawAttributes'],function(_0x2617ad){return{'name':_0x2617ad[_0xa581('0x2c')],'type':_0x2617ad[_0xa581('0x2d')]['key']};});_0x18272d[_0xa581('0x2e')]=_[_0xa581('0x2a')](_0x2e1298,'name');_0x18272d[_0xa581('0x2f')]=_[_0xa581('0x30')](_0x1058e5[_0xa581('0x2f')]);_0x18272d['filters']=_[_0xa581('0x31')](_0x18272d[_0xa581('0x2e')],_0x18272d[_0xa581('0x2f')]);_0x1bd7cd[_0xa581('0x32')]=_[_0xa581('0x31')](_0x18272d[_0xa581('0x2e')],qs[_0xa581('0x33')](_0x1058e5[_0xa581('0x2f')][_0xa581('0x33')]));_0x1bd7cd[_0xa581('0x32')]=_0x1bd7cd[_0xa581('0x32')][_0xa581('0x34')]?_0x1bd7cd[_0xa581('0x32')]:_0x18272d[_0xa581('0x2e')];if(!_0x1058e5[_0xa581('0x2f')][_0xa581('0x35')]('nolimit')){_0x1bd7cd[_0xa581('0x1c')]=qs[_0xa581('0x1c')](_0x1058e5[_0xa581('0x2f')][_0xa581('0x1c')]);_0x1bd7cd['offset']=qs['offset'](_0x1058e5[_0xa581('0x2f')][_0xa581('0x1a')]);}_0x1bd7cd[_0xa581('0x36')]=qs[_0xa581('0x37')](_0x1058e5[_0xa581('0x2f')][_0xa581('0x37')]);_0x1bd7cd[_0xa581('0x38')]=qs['filters'](_[_0xa581('0x39')](_0x1058e5['query'],_0x18272d[_0xa581('0x3a')]),_0x2e1298);if(_0x1058e5[_0xa581('0x2f')][_0xa581('0x3b')]){_0x1bd7cd[_0xa581('0x38')]=_[_0xa581('0x3c')](_0x1bd7cd['where'],{'$or':_['map'](_0x2e1298,function(_0x56790e){if(_0x56790e[_0xa581('0x2d')]!==_0xa581('0x3d')){var _0x396b85={};_0x396b85[_0x56790e[_0xa581('0x27')]]={'$like':'%'+_0x1058e5[_0xa581('0x2f')][_0xa581('0x3b')]+'%'};return _0x396b85;}})});}_0x1bd7cd=_[_0xa581('0x3c')]({},_0x1bd7cd,_0x1058e5[_0xa581('0x3e')]);var _0x2a8119={'where':_0x1bd7cd[_0xa581('0x38')]};return db[_0xa581('0x2b')]['count'](_0x2a8119)[_0xa581('0x23')](function(_0x5e6bea){_0x4055f3[_0xa581('0x1d')]=_0x5e6bea;if(_0x1058e5[_0xa581('0x2f')][_0xa581('0x3f')]){_0x1bd7cd[_0xa581('0x40')]=[{'all':!![]}];}return db[_0xa581('0x2b')][_0xa581('0x41')](_0x1bd7cd);})[_0xa581('0x23')](function(_0xe08b27){_0x4055f3['rows']=_0xe08b27;return _0x4055f3;})[_0xa581('0x23')](respondWithFilteredResult(_0xf1b932,_0x1bd7cd))[_0xa581('0x42')](handleError(_0xf1b932,null));};exports[_0xa581('0x43')]=function(_0x307aa7,_0x19f4a5){var _0x26a97e={'raw':!![],'where':{'id':_0x307aa7[_0xa581('0x44')]['id']}},_0x48dc6f={};_0x48dc6f['model']=_['keys'](db[_0xa581('0x2b')][_0xa581('0x45')]);_0x48dc6f[_0xa581('0x2f')]=_[_0xa581('0x30')](_0x307aa7[_0xa581('0x2f')]);_0x48dc6f[_0xa581('0x3a')]=_[_0xa581('0x31')](_0x48dc6f[_0xa581('0x2e')],_0x48dc6f[_0xa581('0x2f')]);_0x26a97e['attributes']=_[_0xa581('0x31')](_0x48dc6f[_0xa581('0x2e')],qs[_0xa581('0x33')](_0x307aa7[_0xa581('0x2f')][_0xa581('0x33')]));_0x26a97e[_0xa581('0x32')]=_0x26a97e[_0xa581('0x32')]['length']?_0x26a97e[_0xa581('0x32')]:_0x48dc6f[_0xa581('0x2e')];if(_0x307aa7[_0xa581('0x2f')]['includeAll']){_0x26a97e['include']=[{'all':!![]}];}_0x26a97e=_['merge']({},_0x26a97e,_0x307aa7['options']);return db[_0xa581('0x2b')][_0xa581('0x46')](_0x26a97e)[_0xa581('0x23')](handleEntityNotFound(_0x19f4a5,null))[_0xa581('0x23')](respondWithResult(_0x19f4a5,null))[_0xa581('0x42')](handleError(_0x19f4a5,null));};exports[_0xa581('0x47')]=function(_0x16f25c,_0x2addce){return db[_0xa581('0x2b')][_0xa581('0x47')](_0x16f25c['body'],{})['then'](respondWithResult(_0x2addce,0xc9))[_0xa581('0x42')](handleError(_0x2addce,null));};exports[_0xa581('0x22')]=function(_0x254714,_0x40682d){if(_0x254714[_0xa581('0x48')]['id']){delete _0x254714[_0xa581('0x48')]['id'];}return db[_0xa581('0x2b')][_0xa581('0x46')]({'where':{'id':_0x254714['params']['id']}})[_0xa581('0x23')](handleEntityNotFound(_0x40682d,null))[_0xa581('0x23')](saveUpdates(_0x254714[_0xa581('0x48')],null))[_0xa581('0x23')](respondWithResult(_0x40682d,null))[_0xa581('0x42')](handleError(_0x40682d,null));};exports['destroy']=function(_0x264039,_0x278887){return db[_0xa581('0x2b')][_0xa581('0x46')]({'where':{'id':_0x264039[_0xa581('0x44')]['id']}})[_0xa581('0x23')](handleEntityNotFound(_0x278887,null))[_0xa581('0x23')](removeEntity(_0x278887,null))['catch'](handleError(_0x278887,null));};exports[_0xa581('0x49')]=function(_0x446fd0,_0x546d81){return db['JscriptyAnswerReport'][_0xa581('0x49')]()[_0xa581('0x23')](respondWithResult(_0x546d81,null))[_0xa581('0x42')](handleError(_0x546d81,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7753f8b..b3bfb50 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 _0x20be=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','lodash','../../config/logger','api'];(function(_0x25cf56,_0x42bb88){var _0x1a81fb=function(_0x2fb8a3){while(--_0x2fb8a3){_0x25cf56['push'](_0x25cf56['shift']());}};_0x1a81fb(++_0x42bb88);}(_0x20be,0x1dd));var _0xe20b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x20be[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xe20b('0x0'));var util=require('util');var logger=require(_0xe20b('0x1'))(_0xe20b('0x2'));var moment=require(_0xe20b('0x3'));var BPromise=require(_0xe20b('0x4'));var rp=require(_0xe20b('0x5'));var fs=require('fs');var path=require(_0xe20b('0x6'));var rimraf=require(_0xe20b('0x7'));var config=require(_0xe20b('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x2aec73,_0x13cb2b){return _0x2aec73[_0xe20b('0x9')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe276=['exports','JscriptyAnswerReport','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./jscriptyAnswerReport.attributes'];(function(_0x50abc4,_0x558d64){var _0x5a745d=function(_0x4e835b){while(--_0x4e835b){_0x50abc4['push'](_0x50abc4['shift']());}};_0x5a745d(++_0x558d64);}(_0xe276,0xac));var _0x6e27=function(_0x163157,_0x59eea5){_0x163157=_0x163157-0x0;var _0x3db535=_0xe276[_0x163157];return _0x3db535;};'use strict';var _=require('lodash');var util=require(_0x6e27('0x0'));var logger=require(_0x6e27('0x1'))(_0x6e27('0x2'));var moment=require(_0x6e27('0x3'));var BPromise=require(_0x6e27('0x4'));var rp=require(_0x6e27('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e27('0x6'));var config=require('../../config/environment');var attributes=require(_0x6e27('0x7'));module[_0x6e27('0x8')]=function(_0x4d1e55,_0x3e6647){return _0x4d1e55['define'](_0x6e27('0x9'),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 916aca5..8ea3d67 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 _0x927e=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','debug','request\x20sent','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','util'];(function(_0x33c562,_0x54f29c){var _0x4199e3=function(_0x433e55){while(--_0x433e55){_0x33c562['push'](_0x33c562['shift']());}};_0x4199e3(++_0x54f29c);}(_0x927e,0x13f));var _0xe927=function(_0x400096,_0x101dc3){_0x400096=_0x400096-0x0;var _0x31755a=_0x927e[_0x400096];return _0x31755a;};'use strict';var _=require('lodash');var util=require(_0xe927('0x0'));var moment=require('moment');var BPromise=require(_0xe927('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe927('0x2'));var db=require(_0xe927('0x3'))['db'];var utils=require(_0xe927('0x4'));var logger=require(_0xe927('0x5'))(_0xe927('0x6'));var config=require(_0xe927('0x7'));var jayson=require(_0xe927('0x8'));var client=jayson[_0xe927('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f4f06,_0x3682e9,_0x14351){return new BPromise(function(_0x5a3b50,_0x1f07cd){return client['request'](_0x4f4f06,_0x14351)[_0xe927('0xa')](function(_0x59fc4f){logger[_0xe927('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3682e9,'request\x20sent');logger[_0xe927('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x3682e9,_0xe927('0xd'),JSON['stringify'](_0x59fc4f));if(_0x59fc4f['error']){if(_0x59fc4f[_0xe927('0xe')][_0xe927('0xf')]===0x1f4){logger[_0xe927('0xe')](_0xe927('0x10'),_0x3682e9,_0x59fc4f[_0xe927('0xe')][_0xe927('0x11')]);return _0x1f07cd(_0x59fc4f['error'][_0xe927('0x11')]);}logger[_0xe927('0xe')](_0xe927('0x10'),_0x3682e9,_0x59fc4f[_0xe927('0xe')][_0xe927('0x11')]);return _0x5a3b50(_0x59fc4f[_0xe927('0xe')][_0xe927('0x11')]);}else{logger[_0xe927('0xb')](_0xe927('0x10'),_0x3682e9,_0xe927('0xd'));_0x5a3b50(_0x59fc4f[_0xe927('0x12')][_0xe927('0x11')]);}})[_0xe927('0x13')](function(_0x1f423f){logger[_0xe927('0xe')](_0xe927('0x10'),_0x3682e9,_0x1f423f);_0x1f07cd(_0x1f423f);});});} \ No newline at end of file +var _0x0877=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5534cd,_0x61c939){var _0x4123a9=function(_0x3c84d9){while(--_0x3c84d9){_0x5534cd['push'](_0x5534cd['shift']());}};_0x4123a9(++_0x61c939);}(_0x0877,0xd7));var _0x7087=function(_0x560589,_0x3889f0){_0x560589=_0x560589-0x0;var _0x386054=_0x0877[_0x560589];return _0x386054;};'use strict';var _=require('lodash');var util=require(_0x7087('0x0'));var moment=require(_0x7087('0x1'));var BPromise=require(_0x7087('0x2'));var rs=require(_0x7087('0x3'));var fs=require('fs');var Redis=require(_0x7087('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7087('0x5'));var logger=require('../../config/logger')(_0x7087('0x6'));var config=require(_0x7087('0x7'));var jayson=require(_0x7087('0x8'));var client=jayson[_0x7087('0x9')][_0x7087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45491f,_0x2bdbd6,_0x5b9869){return new BPromise(function(_0x57861a,_0xceb415){return client[_0x7087('0xb')](_0x45491f,_0x5b9869)['then'](function(_0x509ff1){logger['info'](_0x7087('0xc'),_0x2bdbd6,_0x7087('0xd'));logger[_0x7087('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x2bdbd6,'request\x20sent',JSON[_0x7087('0xf')](_0x509ff1));if(_0x509ff1[_0x7087('0x10')]){if(_0x509ff1[_0x7087('0x10')][_0x7087('0x11')]===0x1f4){logger[_0x7087('0x10')](_0x7087('0xc'),_0x2bdbd6,_0x509ff1['error']['message']);return _0xceb415(_0x509ff1[_0x7087('0x10')][_0x7087('0x12')]);}logger['error'](_0x7087('0xc'),_0x2bdbd6,_0x509ff1[_0x7087('0x10')][_0x7087('0x12')]);return _0x57861a(_0x509ff1[_0x7087('0x10')][_0x7087('0x12')]);}else{logger[_0x7087('0x13')](_0x7087('0xc'),_0x2bdbd6,'request\x20sent');_0x57861a(_0x509ff1[_0x7087('0x14')][_0x7087('0x12')]);}})[_0x7087('0x15')](function(_0x59f0d1){logger[_0x7087('0x10')](_0x7087('0xc'),_0x2bdbd6,_0x59f0d1);_0xceb415(_0x59f0d1);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 921ec91..918db01 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 _0x7096=['./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone','put','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7096,0x10c));var _0x6709=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7096[_0x56482c];return _0x5aae7a;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var fs_extra=require(_0x6709('0x3'));var auth=require(_0x6709('0x4'));var interaction=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var controller=require(_0x6709('0x7'));router[_0x6709('0x8')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xa')]);router[_0x6709('0x8')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0xc')]);router['get']('/:id/sessions',auth[_0x6709('0x9')](),controller[_0x6709('0xd')]);router[_0x6709('0x8')](_0x6709('0xe'),auth[_0x6709('0x9')](),controller[_0x6709('0xf')]);router['get']('/:id/summary',auth[_0x6709('0x9')](),timeout(_0x6709('0x10')),controller[_0x6709('0x11')]);router[_0x6709('0x12')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0x13')]);router[_0x6709('0x12')](_0x6709('0x14'),auth['isAuthenticated'](),controller[_0x6709('0x15')]);router[_0x6709('0x16')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller['update']);router[_0x6709('0x17')]('/:id',auth[_0x6709('0x9')](),controller['destroy']);module[_0x6709('0x18')]=router; \ No newline at end of file +var _0x2581=['post','/:id/clone','clone','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','getSummary'];(function(_0xb3e2d8,_0x218645){var _0x4a2c8e=function(_0x531147){while(--_0x531147){_0xb3e2d8['push'](_0xb3e2d8['shift']());}};_0x4a2c8e(++_0x218645);}(_0x2581,0xcb));var _0x1258=function(_0x22e34b,_0x150b0d){_0x22e34b=_0x22e34b-0x0;var _0x4cfa3b=_0x2581[_0x22e34b];return _0x4cfa3b;};'use strict';var multer=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var path=require(_0x1258('0x2'));var timeout=require(_0x1258('0x3'));var express=require(_0x1258('0x4'));var router=express['Router']();var fs_extra=require(_0x1258('0x5'));var auth=require(_0x1258('0x6'));var interaction=require(_0x1258('0x7'));var config=require(_0x1258('0x8'));var controller=require(_0x1258('0x9'));router[_0x1258('0xa')]('/',auth[_0x1258('0xb')](),controller[_0x1258('0xc')]);router['get'](_0x1258('0xd'),auth[_0x1258('0xb')](),controller[_0x1258('0xe')]);router[_0x1258('0xa')](_0x1258('0xf'),auth[_0x1258('0xb')](),controller[_0x1258('0x10')]);router['get']('/:id/answers',auth[_0x1258('0xb')](),controller[_0x1258('0x11')]);router[_0x1258('0xa')](_0x1258('0x12'),auth['isAuthenticated'](),timeout(_0x1258('0x13')),controller[_0x1258('0x14')]);router[_0x1258('0x15')]('/',auth[_0x1258('0xb')](),controller['create']);router[_0x1258('0x15')](_0x1258('0x16'),auth[_0x1258('0xb')](),controller[_0x1258('0x17')]);router[_0x1258('0x18')](_0x1258('0xd'),auth[_0x1258('0xb')](),controller['update']);router[_0x1258('0x19')]('/:id',auth[_0x1258('0xb')](),controller[_0x1258('0x1a')]);module[_0x1258('0x1b')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 64bccbc..2915cc4 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 _0xb531=['getDataValue','description','BOOLEAN','util','exports','STRING','name','TEXT','formData','stringify','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x5eea30,_0x3a1ed2){var _0x577c23=function(_0x371592){while(--_0x371592){_0x5eea30['push'](_0x5eea30['shift']());}};_0x577c23(++_0x3a1ed2);}(_0xb531,0x85));var _0x1b53=function(_0x4d56d2,_0x1579f2){_0x4d56d2=_0x4d56d2-0x0;var _0x5dbe59=_0xb531[_0x4d56d2];return _0x5dbe59;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x1b53('0x0'));module[_0x1b53('0x1')]={'name':{'type':Sequelize[_0x1b53('0x2')],'unique':_0x1b53('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x1b53('0x4')]('long'),'set':function(_0x21acbe){if(_['isObjectLike'](_0x21acbe)){this['setDataValue'](_0x1b53('0x5'),JSON[_0x1b53('0x6')](_0x21acbe));}else if(_['isString'](_0x21acbe)){this[_0x1b53('0x7')](_0x1b53('0x5'),_0x21acbe);}else{this[_0x1b53('0x7')](_0x1b53('0x5'),util[_0x1b53('0x8')](_0x1b53('0x9'),this['getDataValue'](_0x1b53('0x3'))||'',this[_0x1b53('0xa')](_0x1b53('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1b53('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1b53('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0xd5e8=['util','exports','STRING','name','TEXT','long','setDataValue','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','lodash'];(function(_0x1dda27,_0x23c0e6){var _0x1be7e7=function(_0x2f3629){while(--_0x2f3629){_0x1dda27['push'](_0x1dda27['shift']());}};_0x1be7e7(++_0x23c0e6);}(_0xd5e8,0x16b));var _0x8d5e=function(_0x5f4fdb,_0x3342d9){_0x5f4fdb=_0x5f4fdb-0x0;var _0x42ff8e=_0xd5e8[_0x5f4fdb];return _0x42ff8e;};'use strict';var Sequelize=require('sequelize');var _=require(_0x8d5e('0x0'));var util=require(_0x8d5e('0x1'));module[_0x8d5e('0x2')]={'name':{'type':Sequelize[_0x8d5e('0x3')],'unique':_0x8d5e('0x4')},'description':{'type':Sequelize[_0x8d5e('0x3')]},'formData':{'type':Sequelize[_0x8d5e('0x5')](_0x8d5e('0x6')),'set':function(_0x1eb84f){if(_['isObjectLike'](_0x1eb84f)){this[_0x8d5e('0x7')]('formData',JSON['stringify'](_0x1eb84f));}else if(_[_0x8d5e('0x8')](_0x1eb84f)){this['setDataValue'](_0x8d5e('0x9'),_0x1eb84f);}else{this[_0x8d5e('0x7')]('formData',util[_0x8d5e('0xa')](_0x8d5e('0xb'),this[_0x8d5e('0xc')](_0x8d5e('0x4'))||'',this[_0x8d5e('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8d5e('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 70d2031..d945079 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 _0xa9e0=['length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','Projects','UserProfileSection','params','getSessions','findOne','JscriptySessionReport','order','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','SessionId','answer','push','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','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','get','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields'];(function(_0x4fde6a,_0x24cee0){var _0x3ab632=function(_0x307472){while(--_0x307472){_0x4fde6a['push'](_0x4fde6a['shift']());}};_0x3ab632(++_0x24cee0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x24')]({'plain':!![]});var _0x16b1ca='Projects';return db['UserProfileResource'][_0x0a9e('0x23')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x22')](function(){return _0x2fb0e4;});})[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x25')](_0x25fba9[_0x0a9e('0x26')]);if(_0x25fba9[_0x0a9e('0x27')]){delete _0x25fba9[_0x0a9e('0x27')];}_0x1dc186[_0x0a9e('0x17')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x28')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x563b45){return{'name':_0x563b45[_0x0a9e('0x2c')],'type':_0x563b45[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x5c877d['model']=_[_0x0a9e('0x29')](_0x40e7a3,'name');_0x5c877d[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x468813[_0x0a9e('0x2f')]);_0x5c877d[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2f')]);_0x2ec755[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5c877d[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x2ec755[_0x0a9e('0x33')]=_0x2ec755['attributes'][_0x0a9e('0x36')]?_0x2ec755['attributes']:_0x5c877d[_0x0a9e('0x34')];if(!_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x37')](_0x0a9e('0x38'))){_0x2ec755['limit']=qs[_0x0a9e('0x1a')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x1a')]);_0x2ec755[_0x0a9e('0x1b')]=qs['offset'](_0x468813['query'][_0x0a9e('0x1b')]);}_0x2ec755['order']=qs[_0x0a9e('0x39')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x39')]);_0x2ec755[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3b')](_0x468813[_0x0a9e('0x2f')],_0x5c877d[_0x0a9e('0x31')]),_0x40e7a3);if(_0x468813['query'][_0x0a9e('0x3c')]){_0x2ec755[_0x0a9e('0x3a')]=_[_0x0a9e('0x3d')](_0x2ec755['where'],{'$or':_['map'](_0x40e7a3,function(_0x11b61d){if(_0x11b61d[_0x0a9e('0x2d')]!=='VIRTUAL'){var _0x2b814e={};_0x2b814e[_0x11b61d[_0x0a9e('0x27')]]={'$like':'%'+_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x2b814e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813['options']);var _0x15e37d={'where':_0x2ec755[_0x0a9e('0x3a')]};return db['JscriptyProject'][_0x0a9e('0x1c')](_0x15e37d)[_0x0a9e('0x22')](function(_0x1459bb){_0x15b200['count']=_0x1459bb;if(_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x3e')]){_0x2ec755[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x2ec755);})[_0x0a9e('0x22')](function(_0x2881b3){_0x15b200[_0x0a9e('0x41')]=_0x2881b3;return _0x15b200;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x148007,_0x1a7bce){var _0x11ca30={'raw':![],'where':{'id':_0x148007['params']['id']}},_0x37f6cc={};_0x37f6cc['model']=_[_0x0a9e('0x30')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x37f6cc[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x148007[_0x0a9e('0x2f')]);_0x37f6cc[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x37f6cc[_0x0a9e('0x34')],_0x37f6cc[_0x0a9e('0x2f')]);_0x11ca30[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x37f6cc['model'],qs[_0x0a9e('0x35')](_0x148007[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x11ca30[_0x0a9e('0x33')]=_0x11ca30[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x11ca30[_0x0a9e('0x33')]:_0x37f6cc[_0x0a9e('0x34')];if(_0x148007['query'][_0x0a9e('0x3e')]){_0x11ca30['include']=[{'all':!![]}];}_0x11ca30=_[_0x0a9e('0x3d')]({},_0x11ca30,_0x148007[_0x0a9e('0x44')]);return db[_0x0a9e('0x2a')]['find'](_0x11ca30)[_0x0a9e('0x22')](handleEntityNotFound(_0x1a7bce,null))[_0x0a9e('0x22')](respondWithResult(_0x1a7bce,null))[_0x0a9e('0x42')](handleError(_0x1a7bce,null));};exports[_0x0a9e('0x45')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x2a')]['create'](_0x45c845[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](function(_0x1b5e80){var _0x16f976=_0x45c845[_0x0a9e('0x47')][_0x0a9e('0x24')]({'plain':!![]});if(!_0x16f976)throw new Error(_0x0a9e('0x48'));if(_0x16f976[_0x0a9e('0x49')]===_0x0a9e('0x47')){var _0x58a5c2=_0x1b5e80[_0x0a9e('0x24')]({'plain':!![]});var _0x3fe430='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x3fe430,'userProfileId':_0x16f976[_0x0a9e('0x4a')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x37edaa){if(_0x37edaa&&_0x37edaa[_0x0a9e('0x4b')]===0x0){return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'name':_0x58a5c2[_0x0a9e('0x27')],'resourceId':_0x58a5c2['id'],'type':_0x37edaa[_0x0a9e('0x27')],'sectionId':_0x37edaa['id']},{})['then'](function(){return _0x1b5e80;});}else{return _0x1b5e80;}})['catch'](function(_0x53975a){logger[_0x0a9e('0x25')](_0x0a9e('0x4d'),_0x53975a);throw _0x53975a;});}return _0x1b5e80;})[_0x0a9e('0x22')](respondWithResult(_0x37be73,0xc9))['catch'](handleError(_0x37be73,null));};exports[_0x0a9e('0x4e')]=function(_0x161aa7,_0x53d113){var _0x5a88da={'where':{'id':_0x161aa7['params']['id']}},_0x2ef381={};_0x2ef381[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x5a88da[_0x0a9e('0x33')]=_['intersection'](_0x2ef381[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x161aa7['query']['fields']));_0x5a88da[_0x0a9e('0x33')]=_0x5a88da[_0x0a9e('0x33')]['length']?_0x5a88da[_0x0a9e('0x33')]:_0x2ef381['model'];if(_0x161aa7[_0x0a9e('0x2f')]['includeAll']){_0x5a88da[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x5a88da=_['merge']({},_0x5a88da,_0x161aa7['options']);return db['JscriptyProject'][_0x0a9e('0x4f')](_0x5a88da)['then'](handleEntityNotFound(_0x53d113,null))[_0x0a9e('0x22')](function(_0x65432){if(_0x65432){var _0x3cfd00=_0x65432[_0x0a9e('0x24')]({'plain':!![]});_0x3cfd00=qs[_0x0a9e('0x50')](_0x3cfd00,['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);_0x161aa7[_0x0a9e('0x46')]=_['omit'](_0x161aa7[_0x0a9e('0x46')],['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x45')](_[_0x0a9e('0x3d')](_0x3cfd00,_0x161aa7['body']),{'include':_0x161aa7[_0x0a9e('0x2f')][_0x0a9e('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x3649cc){var _0x5cc8fb=_0x161aa7[_0x0a9e('0x47')]['get']({'plain':!![]});if(!_0x5cc8fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc8fb['role']===_0x0a9e('0x47')){var _0x49d231=_0x3649cc[_0x0a9e('0x24')]({'plain':!![]});var _0x1fc70e=_0x0a9e('0x53');return db[_0x0a9e('0x54')][_0x0a9e('0x4f')]({'where':{'name':_0x1fc70e,'userProfileId':_0x5cc8fb[_0x0a9e('0x4a')]},'raw':!![]})['then'](function(_0x1627a7){if(_0x1627a7&&_0x1627a7['autoAssociation']===0x0){return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'name':_0x49d231[_0x0a9e('0x27')],'resourceId':_0x49d231['id'],'type':_0x1627a7['name'],'sectionId':_0x1627a7['id']},{})[_0x0a9e('0x22')](function(){return _0x3649cc;});}else{return _0x3649cc;}})[_0x0a9e('0x42')](function(_0x119677){logger[_0x0a9e('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x119677);throw _0x119677;});}return _0x3649cc;});}})[_0x0a9e('0x22')](respondWithResult(_0x53d113,0xc9))[_0x0a9e('0x42')](handleError(_0x53d113,null));};exports['update']=function(_0x797b45,_0x17e88c){if(_0x797b45[_0x0a9e('0x46')]['id']){delete _0x797b45[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x797b45[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x17e88c,null))[_0x0a9e('0x22')](saveUpdates(_0x797b45['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x17e88c,null))['catch'](handleError(_0x17e88c,null));};exports['destroy']=function(_0x242745,_0x4556c5){return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'id':_0x242745[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4556c5,null))[_0x0a9e('0x22')](removeEntity(_0x4556c5,null))[_0x0a9e('0x42')](handleError(_0x4556c5,null));};exports[_0x0a9e('0x56')]=function(_0x1cc4f3,_0x2e89b7,_0x19012b){var _0x2bbb86={'raw':!![],'where':{}};var _0x2b8192={};var _0x320898={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x57')]({'where':{'id':_0x1cc4f3[_0x0a9e('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e89b7,null))[_0x0a9e('0x22')](function(_0x295763){if(_0x295763){_0x2b8192[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x58')][_0x0a9e('0x2b')]);_0x2b8192['query']=_[_0x0a9e('0x30')](_0x1cc4f3[_0x0a9e('0x2f')]);_0x2b8192[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x2b8192[_0x0a9e('0x34')],_0x2b8192['query']);_0x2bbb86['attributes']=_['intersection'](_0x2b8192[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x2bbb86[_0x0a9e('0x33')]=_0x2bbb86[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x2bbb86[_0x0a9e('0x33')]:_0x2b8192['model'];if(!_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x37')](_0x0a9e('0x38'))){_0x2bbb86['limit']=qs[_0x0a9e('0x1a')](_0x1cc4f3['query'][_0x0a9e('0x1a')]);_0x2bbb86[_0x0a9e('0x1b')]=qs['offset'](_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x1b')]);}_0x2bbb86[_0x0a9e('0x59')]=qs[_0x0a9e('0x39')](_0x1cc4f3['query'][_0x0a9e('0x39')]);_0x2bbb86[_0x0a9e('0x3a')]=qs[_0x0a9e('0x31')](_[_0x0a9e('0x3b')](_0x1cc4f3['query'],_0x2b8192[_0x0a9e('0x31')]));_0x2bbb86[_0x0a9e('0x3a')][_0x0a9e('0x5a')]=_0x295763['id'];if(_0x1cc4f3[_0x0a9e('0x2f')]['filter']){_0x2bbb86[_0x0a9e('0x3a')]=_[_0x0a9e('0x3d')](_0x2bbb86[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x29')](_0x2bbb86[_0x0a9e('0x33')],function(_0xdb98ca){var _0x40fc56={};_0x40fc56[_0xdb98ca]={'$like':'%'+_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x40fc56;})});}_0x2bbb86=_[_0x0a9e('0x3d')]({},_0x2bbb86,_0x1cc4f3[_0x0a9e('0x44')]);return db[_0x0a9e('0x58')][_0x0a9e('0x1c')]({'where':_0x2bbb86[_0x0a9e('0x3a')]})['then'](function(_0xf4120f){_0x320898[_0x0a9e('0x1c')]=_0xf4120f;if(_0x1cc4f3[_0x0a9e('0x2f')]['includeAll']){_0x2bbb86[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x58')][_0x0a9e('0x40')](_0x2bbb86);})[_0x0a9e('0x22')](function(_0x56d650){_0x320898['rows']=_0x56d650;return _0x320898;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x2e89b7,_0x2bbb86))[_0x0a9e('0x42')](handleError(_0x2e89b7,null));};exports['getAnswers']=function(_0x45108c,_0x53a6a1,_0x260f4b){var _0x8ebf02={'raw':!![],'where':{}};var _0x5637a1={};var _0x28a942={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x57')]({'where':{'id':_0x45108c[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x53a6a1,null))[_0x0a9e('0x22')](function(_0x444f1f){if(_0x444f1f){_0x5637a1['model']=_[_0x0a9e('0x30')](db[_0x0a9e('0x5b')][_0x0a9e('0x2b')]);_0x5637a1[_0x0a9e('0x2f')]=_['keys'](_0x45108c[_0x0a9e('0x2f')]);_0x5637a1[_0x0a9e('0x31')]=_['intersection'](_0x5637a1[_0x0a9e('0x34')],_0x5637a1['query']);_0x8ebf02[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5637a1[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x45108c['query']['fields']));_0x8ebf02[_0x0a9e('0x33')]=_0x8ebf02[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x8ebf02['attributes']:_0x5637a1[_0x0a9e('0x34')];if(!_0x45108c[_0x0a9e('0x2f')]['hasOwnProperty']('nolimit')){_0x8ebf02[_0x0a9e('0x1a')]=qs['limit'](_0x45108c['query']['limit']);_0x8ebf02[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x1b')]);}_0x8ebf02[_0x0a9e('0x59')]=qs[_0x0a9e('0x39')](_0x45108c['query'][_0x0a9e('0x39')]);_0x8ebf02['where']=qs[_0x0a9e('0x31')](_[_0x0a9e('0x3b')](_0x45108c[_0x0a9e('0x2f')],_0x5637a1[_0x0a9e('0x31')]));_0x8ebf02['where'][_0x0a9e('0x5a')]=_0x444f1f['id'];if(_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]){_0x8ebf02['where']=_[_0x0a9e('0x3d')](_0x8ebf02[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x29')](_0x8ebf02[_0x0a9e('0x33')],function(_0x255e49){var _0x1910bf={};_0x1910bf[_0x255e49]={'$like':'%'+_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x1910bf;})});}_0x8ebf02=_['merge']({},_0x8ebf02,_0x45108c[_0x0a9e('0x44')]);return db[_0x0a9e('0x5b')]['count']({'where':_0x8ebf02[_0x0a9e('0x3a')]})[_0x0a9e('0x22')](function(_0x3a1974){_0x28a942['count']=_0x3a1974;if(_0x45108c[_0x0a9e('0x2f')]['includeAll']){_0x8ebf02[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5b')][_0x0a9e('0x40')](_0x8ebf02);})[_0x0a9e('0x22')](function(_0x842d6f){_0x28a942[_0x0a9e('0x41')]=_0x842d6f;return _0x28a942;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x53a6a1,_0x8ebf02))[_0x0a9e('0x42')](handleError(_0x53a6a1,null));};function char(_0x501050){return _0x0a9e('0x5c')===typeof _0x501050?String[_0x0a9e('0x5d')][_0x0a9e('0x1f')](null,arguments):_0x501050;}function needsEncapsulation(_0x30ef6e){return!!_0x30ef6e&&(_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0xd))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0xa))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0x2c))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x18273f){var _0x4989f9=char(0x22),_0xc81b64='\x5c'+char(0x22),_0x23e2bd=_0x18273f[_0x0a9e('0x5e')]()[_0x0a9e('0x60')](new RegExp(_0x4989f9,'g'),_0xc81b64);return _0x4989f9+_0x23e2bd+_0x4989f9;}exports[_0x0a9e('0x61')]=function(_0x5d9ddb,_0x3afc8c,_0x1756c7){var _0x5ce99d,_0x23b447;var _0x5e725e={'where':{'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id']}};if(_0x5d9ddb[_0x0a9e('0x2f')][_0x0a9e('0x62')]){_0x5e725e[_0x0a9e('0x3a')]['starttime']=JSON[_0x0a9e('0x63')](_0x5d9ddb['query'][_0x0a9e('0x62')]);}return db[_0x0a9e('0x58')]['findAll'](_0x5e725e)[_0x0a9e('0x22')](handleEntityNotFound(_0x3afc8c,null))[_0x0a9e('0x22')](function(_0x1dd541){if(_0x1dd541){_0x5ce99d=_0x1dd541;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x0a9e('0x29')](_0x5ce99d,'id')},'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id']},'order':_0x0a9e('0x64')});}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3afc8c,null))[_0x0a9e('0x22')](function(_0x2450a8){if(_0x2450a8){_0x23b447=_0x2450a8;var _0x17793e={};for(var _0x3c75b9=0x0,_0x3f8124=_0x23b447['length'];_0x3c75b9<_0x3f8124;_0x3c75b9++){if(!_0x17793e[_0x0a9e('0x37')](_0x23b447[_0x3c75b9]['questionId'])){_0x17793e[_0x23b447[_0x3c75b9][_0x0a9e('0x65')]]=needsEncapsulation(_0x23b447[_0x3c75b9][_0x0a9e('0x66')])?encapsulate(_0x23b447[_0x3c75b9][_0x0a9e('0x66')]):_0x23b447[_0x3c75b9][_0x0a9e('0x66')];}}var _0x1b61d5=[],_0x4e7273={};for(var _0x436313=0x0,_0x4667bf=_0x5ce99d[_0x0a9e('0x36')];_0x436313<_0x4667bf;_0x436313++){_0x4e7273={'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id'],'SessionId':_0x5ce99d[_0x436313]['id'],'StartTime':moment(_0x5ce99d[_0x436313][_0x0a9e('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x22a3cb=0x0,_0x583662=_0x23b447[_0x0a9e('0x36')];_0x22a3cb<_0x583662;_0x22a3cb++){if(_0x23b447[_0x22a3cb][_0x0a9e('0x68')]==_0x5ce99d[_0x436313]['id']&&_0x17793e[_0x0a9e('0x37')](_0x23b447[_0x22a3cb][_0x0a9e('0x65')])){_0x4e7273[_0x17793e[_0x23b447[_0x22a3cb][_0x0a9e('0x65')]]]=_0x23b447[_0x22a3cb][_0x0a9e('0x69')];}}for(var _0x596312 in _0x17793e){if(!_0x4e7273['hasOwnProperty'](_0x17793e[_0x596312])){_0x4e7273[_0x17793e[_0x596312]]=null;}}_0x1b61d5[_0x0a9e('0x6a')](_0x4e7273);}return _0x1b61d5;}})['then'](function(_0x2469d1){if(!_['isEmpty'](_0x2469d1)){var _0x427ccc=toCsv(_0x2469d1);var _0x564db2=Date['now']();fs[_0x0a9e('0x6b')](util[_0x0a9e('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb[_0x0a9e('0x55')]['id'],_0x564db2),_0x427ccc);_0x3afc8c[_0x0a9e('0x6d')](_0x0a9e('0x6e'),_0x0a9e('0x6f')+util[_0x0a9e('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb['params']['id'],_0x564db2));_0x3afc8c[_0x0a9e('0x6d')](_0x0a9e('0x70'),_0x0a9e('0x71'));return _0x3afc8c[_0x0a9e('0x72')](util[_0x0a9e('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb[_0x0a9e('0x55')]['id'],_0x564db2));}else{return _0x3afc8c[_0x0a9e('0x15')](0xcc);}})['catch'](handleError(_0x3afc8c,null));}; \ No newline at end of file +var _0xa9e0=['length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','Projects','UserProfileSection','params','getSessions','findOne','JscriptySessionReport','order','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','SessionId','answer','push','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','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','get','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields'];(function(_0x4cfdde,_0x568059){var _0x525397=function(_0x29d5f4){while(--_0x29d5f4){_0x4cfdde['push'](_0x4cfdde['shift']());}};_0x525397(++_0x568059);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x24')]({'plain':!![]});var _0x16b1ca='Projects';return db['UserProfileResource'][_0x0a9e('0x23')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x22')](function(){return _0x2fb0e4;});})[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x25')](_0x25fba9[_0x0a9e('0x26')]);if(_0x25fba9[_0x0a9e('0x27')]){delete _0x25fba9[_0x0a9e('0x27')];}_0x1dc186[_0x0a9e('0x17')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x28')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x563b45){return{'name':_0x563b45[_0x0a9e('0x2c')],'type':_0x563b45[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x5c877d['model']=_[_0x0a9e('0x29')](_0x40e7a3,'name');_0x5c877d[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x468813[_0x0a9e('0x2f')]);_0x5c877d[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2f')]);_0x2ec755[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5c877d[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x2ec755[_0x0a9e('0x33')]=_0x2ec755['attributes'][_0x0a9e('0x36')]?_0x2ec755['attributes']:_0x5c877d[_0x0a9e('0x34')];if(!_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x37')](_0x0a9e('0x38'))){_0x2ec755['limit']=qs[_0x0a9e('0x1a')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x1a')]);_0x2ec755[_0x0a9e('0x1b')]=qs['offset'](_0x468813['query'][_0x0a9e('0x1b')]);}_0x2ec755['order']=qs[_0x0a9e('0x39')](_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x39')]);_0x2ec755[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3b')](_0x468813[_0x0a9e('0x2f')],_0x5c877d[_0x0a9e('0x31')]),_0x40e7a3);if(_0x468813['query'][_0x0a9e('0x3c')]){_0x2ec755[_0x0a9e('0x3a')]=_[_0x0a9e('0x3d')](_0x2ec755['where'],{'$or':_['map'](_0x40e7a3,function(_0x11b61d){if(_0x11b61d[_0x0a9e('0x2d')]!=='VIRTUAL'){var _0x2b814e={};_0x2b814e[_0x11b61d[_0x0a9e('0x27')]]={'$like':'%'+_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x2b814e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813['options']);var _0x15e37d={'where':_0x2ec755[_0x0a9e('0x3a')]};return db['JscriptyProject'][_0x0a9e('0x1c')](_0x15e37d)[_0x0a9e('0x22')](function(_0x1459bb){_0x15b200['count']=_0x1459bb;if(_0x468813[_0x0a9e('0x2f')][_0x0a9e('0x3e')]){_0x2ec755[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x2ec755);})[_0x0a9e('0x22')](function(_0x2881b3){_0x15b200[_0x0a9e('0x41')]=_0x2881b3;return _0x15b200;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x148007,_0x1a7bce){var _0x11ca30={'raw':![],'where':{'id':_0x148007['params']['id']}},_0x37f6cc={};_0x37f6cc['model']=_[_0x0a9e('0x30')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x37f6cc[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x148007[_0x0a9e('0x2f')]);_0x37f6cc[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x37f6cc[_0x0a9e('0x34')],_0x37f6cc[_0x0a9e('0x2f')]);_0x11ca30[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x37f6cc['model'],qs[_0x0a9e('0x35')](_0x148007[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x11ca30[_0x0a9e('0x33')]=_0x11ca30[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x11ca30[_0x0a9e('0x33')]:_0x37f6cc[_0x0a9e('0x34')];if(_0x148007['query'][_0x0a9e('0x3e')]){_0x11ca30['include']=[{'all':!![]}];}_0x11ca30=_[_0x0a9e('0x3d')]({},_0x11ca30,_0x148007[_0x0a9e('0x44')]);return db[_0x0a9e('0x2a')]['find'](_0x11ca30)[_0x0a9e('0x22')](handleEntityNotFound(_0x1a7bce,null))[_0x0a9e('0x22')](respondWithResult(_0x1a7bce,null))[_0x0a9e('0x42')](handleError(_0x1a7bce,null));};exports[_0x0a9e('0x45')]=function(_0x45c845,_0x37be73){return db[_0x0a9e('0x2a')]['create'](_0x45c845[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](function(_0x1b5e80){var _0x16f976=_0x45c845[_0x0a9e('0x47')][_0x0a9e('0x24')]({'plain':!![]});if(!_0x16f976)throw new Error(_0x0a9e('0x48'));if(_0x16f976[_0x0a9e('0x49')]===_0x0a9e('0x47')){var _0x58a5c2=_0x1b5e80[_0x0a9e('0x24')]({'plain':!![]});var _0x3fe430='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x3fe430,'userProfileId':_0x16f976[_0x0a9e('0x4a')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x37edaa){if(_0x37edaa&&_0x37edaa[_0x0a9e('0x4b')]===0x0){return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'name':_0x58a5c2[_0x0a9e('0x27')],'resourceId':_0x58a5c2['id'],'type':_0x37edaa[_0x0a9e('0x27')],'sectionId':_0x37edaa['id']},{})['then'](function(){return _0x1b5e80;});}else{return _0x1b5e80;}})['catch'](function(_0x53975a){logger[_0x0a9e('0x25')](_0x0a9e('0x4d'),_0x53975a);throw _0x53975a;});}return _0x1b5e80;})[_0x0a9e('0x22')](respondWithResult(_0x37be73,0xc9))['catch'](handleError(_0x37be73,null));};exports[_0x0a9e('0x4e')]=function(_0x161aa7,_0x53d113){var _0x5a88da={'where':{'id':_0x161aa7['params']['id']}},_0x2ef381={};_0x2ef381[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x5a88da[_0x0a9e('0x33')]=_['intersection'](_0x2ef381[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x161aa7['query']['fields']));_0x5a88da[_0x0a9e('0x33')]=_0x5a88da[_0x0a9e('0x33')]['length']?_0x5a88da[_0x0a9e('0x33')]:_0x2ef381['model'];if(_0x161aa7[_0x0a9e('0x2f')]['includeAll']){_0x5a88da[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x5a88da=_['merge']({},_0x5a88da,_0x161aa7['options']);return db['JscriptyProject'][_0x0a9e('0x4f')](_0x5a88da)['then'](handleEntityNotFound(_0x53d113,null))[_0x0a9e('0x22')](function(_0x65432){if(_0x65432){var _0x3cfd00=_0x65432[_0x0a9e('0x24')]({'plain':!![]});_0x3cfd00=qs[_0x0a9e('0x50')](_0x3cfd00,['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);_0x161aa7[_0x0a9e('0x46')]=_['omit'](_0x161aa7[_0x0a9e('0x46')],['id',_0x0a9e('0x51'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x45')](_[_0x0a9e('0x3d')](_0x3cfd00,_0x161aa7['body']),{'include':_0x161aa7[_0x0a9e('0x2f')][_0x0a9e('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x3649cc){var _0x5cc8fb=_0x161aa7[_0x0a9e('0x47')]['get']({'plain':!![]});if(!_0x5cc8fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc8fb['role']===_0x0a9e('0x47')){var _0x49d231=_0x3649cc[_0x0a9e('0x24')]({'plain':!![]});var _0x1fc70e=_0x0a9e('0x53');return db[_0x0a9e('0x54')][_0x0a9e('0x4f')]({'where':{'name':_0x1fc70e,'userProfileId':_0x5cc8fb[_0x0a9e('0x4a')]},'raw':!![]})['then'](function(_0x1627a7){if(_0x1627a7&&_0x1627a7['autoAssociation']===0x0){return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'name':_0x49d231[_0x0a9e('0x27')],'resourceId':_0x49d231['id'],'type':_0x1627a7['name'],'sectionId':_0x1627a7['id']},{})[_0x0a9e('0x22')](function(){return _0x3649cc;});}else{return _0x3649cc;}})[_0x0a9e('0x42')](function(_0x119677){logger[_0x0a9e('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x119677);throw _0x119677;});}return _0x3649cc;});}})[_0x0a9e('0x22')](respondWithResult(_0x53d113,0xc9))[_0x0a9e('0x42')](handleError(_0x53d113,null));};exports['update']=function(_0x797b45,_0x17e88c){if(_0x797b45[_0x0a9e('0x46')]['id']){delete _0x797b45[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x797b45[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x17e88c,null))[_0x0a9e('0x22')](saveUpdates(_0x797b45['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x17e88c,null))['catch'](handleError(_0x17e88c,null));};exports['destroy']=function(_0x242745,_0x4556c5){return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'id':_0x242745[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4556c5,null))[_0x0a9e('0x22')](removeEntity(_0x4556c5,null))[_0x0a9e('0x42')](handleError(_0x4556c5,null));};exports[_0x0a9e('0x56')]=function(_0x1cc4f3,_0x2e89b7,_0x19012b){var _0x2bbb86={'raw':!![],'where':{}};var _0x2b8192={};var _0x320898={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x57')]({'where':{'id':_0x1cc4f3[_0x0a9e('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e89b7,null))[_0x0a9e('0x22')](function(_0x295763){if(_0x295763){_0x2b8192[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x58')][_0x0a9e('0x2b')]);_0x2b8192['query']=_[_0x0a9e('0x30')](_0x1cc4f3[_0x0a9e('0x2f')]);_0x2b8192[_0x0a9e('0x31')]=_[_0x0a9e('0x32')](_0x2b8192[_0x0a9e('0x34')],_0x2b8192['query']);_0x2bbb86['attributes']=_['intersection'](_0x2b8192[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x35')]));_0x2bbb86[_0x0a9e('0x33')]=_0x2bbb86[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x2bbb86[_0x0a9e('0x33')]:_0x2b8192['model'];if(!_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x37')](_0x0a9e('0x38'))){_0x2bbb86['limit']=qs[_0x0a9e('0x1a')](_0x1cc4f3['query'][_0x0a9e('0x1a')]);_0x2bbb86[_0x0a9e('0x1b')]=qs['offset'](_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x1b')]);}_0x2bbb86[_0x0a9e('0x59')]=qs[_0x0a9e('0x39')](_0x1cc4f3['query'][_0x0a9e('0x39')]);_0x2bbb86[_0x0a9e('0x3a')]=qs[_0x0a9e('0x31')](_[_0x0a9e('0x3b')](_0x1cc4f3['query'],_0x2b8192[_0x0a9e('0x31')]));_0x2bbb86[_0x0a9e('0x3a')][_0x0a9e('0x5a')]=_0x295763['id'];if(_0x1cc4f3[_0x0a9e('0x2f')]['filter']){_0x2bbb86[_0x0a9e('0x3a')]=_[_0x0a9e('0x3d')](_0x2bbb86[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x29')](_0x2bbb86[_0x0a9e('0x33')],function(_0xdb98ca){var _0x40fc56={};_0x40fc56[_0xdb98ca]={'$like':'%'+_0x1cc4f3[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x40fc56;})});}_0x2bbb86=_[_0x0a9e('0x3d')]({},_0x2bbb86,_0x1cc4f3[_0x0a9e('0x44')]);return db[_0x0a9e('0x58')][_0x0a9e('0x1c')]({'where':_0x2bbb86[_0x0a9e('0x3a')]})['then'](function(_0xf4120f){_0x320898[_0x0a9e('0x1c')]=_0xf4120f;if(_0x1cc4f3[_0x0a9e('0x2f')]['includeAll']){_0x2bbb86[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x58')][_0x0a9e('0x40')](_0x2bbb86);})[_0x0a9e('0x22')](function(_0x56d650){_0x320898['rows']=_0x56d650;return _0x320898;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x2e89b7,_0x2bbb86))[_0x0a9e('0x42')](handleError(_0x2e89b7,null));};exports['getAnswers']=function(_0x45108c,_0x53a6a1,_0x260f4b){var _0x8ebf02={'raw':!![],'where':{}};var _0x5637a1={};var _0x28a942={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x57')]({'where':{'id':_0x45108c[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x53a6a1,null))[_0x0a9e('0x22')](function(_0x444f1f){if(_0x444f1f){_0x5637a1['model']=_[_0x0a9e('0x30')](db[_0x0a9e('0x5b')][_0x0a9e('0x2b')]);_0x5637a1[_0x0a9e('0x2f')]=_['keys'](_0x45108c[_0x0a9e('0x2f')]);_0x5637a1[_0x0a9e('0x31')]=_['intersection'](_0x5637a1[_0x0a9e('0x34')],_0x5637a1['query']);_0x8ebf02[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5637a1[_0x0a9e('0x34')],qs[_0x0a9e('0x35')](_0x45108c['query']['fields']));_0x8ebf02[_0x0a9e('0x33')]=_0x8ebf02[_0x0a9e('0x33')][_0x0a9e('0x36')]?_0x8ebf02['attributes']:_0x5637a1[_0x0a9e('0x34')];if(!_0x45108c[_0x0a9e('0x2f')]['hasOwnProperty']('nolimit')){_0x8ebf02[_0x0a9e('0x1a')]=qs['limit'](_0x45108c['query']['limit']);_0x8ebf02[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x1b')]);}_0x8ebf02[_0x0a9e('0x59')]=qs[_0x0a9e('0x39')](_0x45108c['query'][_0x0a9e('0x39')]);_0x8ebf02['where']=qs[_0x0a9e('0x31')](_[_0x0a9e('0x3b')](_0x45108c[_0x0a9e('0x2f')],_0x5637a1[_0x0a9e('0x31')]));_0x8ebf02['where'][_0x0a9e('0x5a')]=_0x444f1f['id'];if(_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]){_0x8ebf02['where']=_[_0x0a9e('0x3d')](_0x8ebf02[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x29')](_0x8ebf02[_0x0a9e('0x33')],function(_0x255e49){var _0x1910bf={};_0x1910bf[_0x255e49]={'$like':'%'+_0x45108c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]+'%'};return _0x1910bf;})});}_0x8ebf02=_['merge']({},_0x8ebf02,_0x45108c[_0x0a9e('0x44')]);return db[_0x0a9e('0x5b')]['count']({'where':_0x8ebf02[_0x0a9e('0x3a')]})[_0x0a9e('0x22')](function(_0x3a1974){_0x28a942['count']=_0x3a1974;if(_0x45108c[_0x0a9e('0x2f')]['includeAll']){_0x8ebf02[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5b')][_0x0a9e('0x40')](_0x8ebf02);})[_0x0a9e('0x22')](function(_0x842d6f){_0x28a942[_0x0a9e('0x41')]=_0x842d6f;return _0x28a942;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x53a6a1,_0x8ebf02))[_0x0a9e('0x42')](handleError(_0x53a6a1,null));};function char(_0x501050){return _0x0a9e('0x5c')===typeof _0x501050?String[_0x0a9e('0x5d')][_0x0a9e('0x1f')](null,arguments):_0x501050;}function needsEncapsulation(_0x30ef6e){return!!_0x30ef6e&&(_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0xd))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0xa))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0x2c))>=0x0||_0x30ef6e[_0x0a9e('0x5e')]()[_0x0a9e('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x18273f){var _0x4989f9=char(0x22),_0xc81b64='\x5c'+char(0x22),_0x23e2bd=_0x18273f[_0x0a9e('0x5e')]()[_0x0a9e('0x60')](new RegExp(_0x4989f9,'g'),_0xc81b64);return _0x4989f9+_0x23e2bd+_0x4989f9;}exports[_0x0a9e('0x61')]=function(_0x5d9ddb,_0x3afc8c,_0x1756c7){var _0x5ce99d,_0x23b447;var _0x5e725e={'where':{'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id']}};if(_0x5d9ddb[_0x0a9e('0x2f')][_0x0a9e('0x62')]){_0x5e725e[_0x0a9e('0x3a')]['starttime']=JSON[_0x0a9e('0x63')](_0x5d9ddb['query'][_0x0a9e('0x62')]);}return db[_0x0a9e('0x58')]['findAll'](_0x5e725e)[_0x0a9e('0x22')](handleEntityNotFound(_0x3afc8c,null))[_0x0a9e('0x22')](function(_0x1dd541){if(_0x1dd541){_0x5ce99d=_0x1dd541;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x0a9e('0x29')](_0x5ce99d,'id')},'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id']},'order':_0x0a9e('0x64')});}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3afc8c,null))[_0x0a9e('0x22')](function(_0x2450a8){if(_0x2450a8){_0x23b447=_0x2450a8;var _0x17793e={};for(var _0x3c75b9=0x0,_0x3f8124=_0x23b447['length'];_0x3c75b9<_0x3f8124;_0x3c75b9++){if(!_0x17793e[_0x0a9e('0x37')](_0x23b447[_0x3c75b9]['questionId'])){_0x17793e[_0x23b447[_0x3c75b9][_0x0a9e('0x65')]]=needsEncapsulation(_0x23b447[_0x3c75b9][_0x0a9e('0x66')])?encapsulate(_0x23b447[_0x3c75b9][_0x0a9e('0x66')]):_0x23b447[_0x3c75b9][_0x0a9e('0x66')];}}var _0x1b61d5=[],_0x4e7273={};for(var _0x436313=0x0,_0x4667bf=_0x5ce99d[_0x0a9e('0x36')];_0x436313<_0x4667bf;_0x436313++){_0x4e7273={'ProjectId':_0x5d9ddb[_0x0a9e('0x55')]['id'],'SessionId':_0x5ce99d[_0x436313]['id'],'StartTime':moment(_0x5ce99d[_0x436313][_0x0a9e('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x22a3cb=0x0,_0x583662=_0x23b447[_0x0a9e('0x36')];_0x22a3cb<_0x583662;_0x22a3cb++){if(_0x23b447[_0x22a3cb][_0x0a9e('0x68')]==_0x5ce99d[_0x436313]['id']&&_0x17793e[_0x0a9e('0x37')](_0x23b447[_0x22a3cb][_0x0a9e('0x65')])){_0x4e7273[_0x17793e[_0x23b447[_0x22a3cb][_0x0a9e('0x65')]]]=_0x23b447[_0x22a3cb][_0x0a9e('0x69')];}}for(var _0x596312 in _0x17793e){if(!_0x4e7273['hasOwnProperty'](_0x17793e[_0x596312])){_0x4e7273[_0x17793e[_0x596312]]=null;}}_0x1b61d5[_0x0a9e('0x6a')](_0x4e7273);}return _0x1b61d5;}})['then'](function(_0x2469d1){if(!_['isEmpty'](_0x2469d1)){var _0x427ccc=toCsv(_0x2469d1);var _0x564db2=Date['now']();fs[_0x0a9e('0x6b')](util[_0x0a9e('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb[_0x0a9e('0x55')]['id'],_0x564db2),_0x427ccc);_0x3afc8c[_0x0a9e('0x6d')](_0x0a9e('0x6e'),_0x0a9e('0x6f')+util[_0x0a9e('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb['params']['id'],_0x564db2));_0x3afc8c[_0x0a9e('0x6d')](_0x0a9e('0x70'),_0x0a9e('0x71'));return _0x3afc8c[_0x0a9e('0x72')](util[_0x0a9e('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5d9ddb[_0x0a9e('0x55')]['id'],_0x564db2));}else{return _0x3afc8c[_0x0a9e('0x15')](0xcc);}})['catch'](handleError(_0x3afc8c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 1969dd1..c1a4afc 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 _0xe0a3=['path','rimraf','../../config/environment','exports','JscriptyProject','jscripty_projects','lodash','api','moment','request-promise'];(function(_0x55aab5,_0x270621){var _0x2b84c7=function(_0x56a2d9){while(--_0x56a2d9){_0x55aab5['push'](_0x55aab5['shift']());}};_0x2b84c7(++_0x270621);}(_0xe0a3,0x7e));var _0x3e0a=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xe0a3[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x3e0a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3e0a('0x1'));var moment=require(_0x3e0a('0x2'));var BPromise=require('bluebird');var rp=require(_0x3e0a('0x3'));var fs=require('fs');var path=require(_0x3e0a('0x4'));var rimraf=require(_0x3e0a('0x5'));var config=require(_0x3e0a('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0x3e0a('0x7')]=function(_0x1e9118,_0x41a0c8){return _0x1e9118['define'](_0x3e0a('0x8'),attributes,{'tableName':_0x3e0a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5a8=['rimraf','../../config/environment','exports','define','jscripty_projects','lodash','util','api','request-promise'];(function(_0x551bc1,_0x47cff3){var _0x12ea5e=function(_0x2d4c10){while(--_0x2d4c10){_0x551bc1['push'](_0x551bc1['shift']());}};_0x12ea5e(++_0x47cff3);}(_0xb5a8,0x101));var _0x8b5a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb5a8[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x8b5a('0x0'));var util=require(_0x8b5a('0x1'));var logger=require('../../config/logger')(_0x8b5a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8b5a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b5a('0x4'));var config=require(_0x8b5a('0x5'));var attributes=require('./jscriptyProject.attributes');module[_0x8b5a('0x6')]=function(_0x3c3ea9,_0x1c031b){return _0x3c3ea9[_0x8b5a('0x7')]('JscriptyProject',attributes,{'tableName':_0x8b5a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 58dd95e..4efc680 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 _0xe164=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util'];(function(_0xaca9d7,_0x4e6ebe){var _0x2f16fa=function(_0x56dba9){while(--_0x56dba9){_0xaca9d7['push'](_0xaca9d7['shift']());}};_0x2f16fa(++_0x4e6ebe);}(_0xe164,0xb3));var _0x4e16=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xe164[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require(_0x4e16('0x0'));var moment=require('moment');var BPromise=require(_0x4e16('0x1'));var rs=require(_0x4e16('0x2'));var fs=require('fs');var Redis=require(_0x4e16('0x3'));var db=require(_0x4e16('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e16('0x5'))(_0x4e16('0x6'));var config=require(_0x4e16('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e56c2,_0x2be427,_0x18ecd6){return new BPromise(function(_0x1f17ab,_0x45758f){return client[_0x4e16('0x8')](_0x4e56c2,_0x18ecd6)['then'](function(_0x109eb5){logger['info'](_0x4e16('0x9'),_0x2be427,_0x4e16('0xa'));logger[_0x4e16('0xb')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2be427,_0x4e16('0xa'),JSON['stringify'](_0x109eb5));if(_0x109eb5['error']){if(_0x109eb5[_0x4e16('0xc')][_0x4e16('0xd')]===0x1f4){logger[_0x4e16('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x2be427,_0x109eb5[_0x4e16('0xc')][_0x4e16('0xe')]);return _0x45758f(_0x109eb5['error'][_0x4e16('0xe')]);}logger[_0x4e16('0xc')](_0x4e16('0x9'),_0x2be427,_0x109eb5[_0x4e16('0xc')][_0x4e16('0xe')]);return _0x1f17ab(_0x109eb5[_0x4e16('0xc')][_0x4e16('0xe')]);}else{logger[_0x4e16('0xf')](_0x4e16('0x9'),_0x2be427,_0x4e16('0xa'));_0x1f17ab(_0x109eb5[_0x4e16('0x10')][_0x4e16('0xe')]);}})[_0x4e16('0x11')](function(_0x24ce15){logger[_0x4e16('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x2be427,_0x24ce15);_0x45758f(_0x24ce15);});});} \ No newline at end of file +var _0x47fd=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1fc8e3,_0x3aac76){var _0x254eb4=function(_0x267e67){while(--_0x267e67){_0x1fc8e3['push'](_0x1fc8e3['shift']());}};_0x254eb4(++_0x3aac76);}(_0x47fd,0x1a9));var _0xd47f=function(_0x462f2b,_0x337220){_0x462f2b=_0x462f2b-0x0;var _0x1308e7=_0x47fd[_0x462f2b];return _0x1308e7;};'use strict';var _=require(_0xd47f('0x0'));var util=require(_0xd47f('0x1'));var moment=require(_0xd47f('0x2'));var BPromise=require(_0xd47f('0x3'));var rs=require(_0xd47f('0x4'));var fs=require('fs');var Redis=require(_0xd47f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd47f('0x6'));var logger=require(_0xd47f('0x7'))('rpc');var config=require(_0xd47f('0x8'));var jayson=require(_0xd47f('0x9'));var client=jayson[_0xd47f('0xa')][_0xd47f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1819ec,_0x5caf88,_0x517894){return new BPromise(function(_0x11576c,_0x49ca62){return client[_0xd47f('0xc')](_0x1819ec,_0x517894)[_0xd47f('0xd')](function(_0xc728d0){logger[_0xd47f('0xe')]('JscriptyProject,\x20%s,\x20%s',_0x5caf88,_0xd47f('0xf'));logger['debug'](_0xd47f('0x10'),_0x5caf88,_0xd47f('0xf'),JSON[_0xd47f('0x11')](_0xc728d0));if(_0xc728d0[_0xd47f('0x12')]){if(_0xc728d0[_0xd47f('0x12')][_0xd47f('0x13')]===0x1f4){logger[_0xd47f('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x5caf88,_0xc728d0['error'][_0xd47f('0x14')]);return _0x49ca62(_0xc728d0[_0xd47f('0x12')][_0xd47f('0x14')]);}logger[_0xd47f('0x12')](_0xd47f('0x15'),_0x5caf88,_0xc728d0[_0xd47f('0x12')][_0xd47f('0x14')]);return _0x11576c(_0xc728d0[_0xd47f('0x12')][_0xd47f('0x14')]);}else{logger[_0xd47f('0xe')]('JscriptyProject,\x20%s,\x20%s',_0x5caf88,_0xd47f('0xf'));_0x11576c(_0xc728d0[_0xd47f('0x16')][_0xd47f('0x14')]);}})[_0xd47f('0x17')](function(_0x3cf306){logger['error'](_0xd47f('0x15'),_0x5caf88,_0x3cf306);_0x49ca62(_0x3cf306);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 464014a..182fef6 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 _0x4133=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','destroy','exports','multer','connect-timeout'];(function(_0xcfdadf,_0x50a875){var _0x3dd877=function(_0x31f5f1){while(--_0x31f5f1){_0xcfdadf['push'](_0xcfdadf['shift']());}};_0x3dd877(++_0x50a875);}(_0x4133,0x17a));var _0x3413=function(_0x48542f,_0x4f4496){_0x48542f=_0x48542f-0x0;var _0x520b28=_0x4133[_0x48542f];return _0x520b28;};'use strict';var multer=require(_0x3413('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3413('0x1'));var express=require(_0x3413('0x2'));var router=express[_0x3413('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3413('0x4'));var interaction=require(_0x3413('0x5'));var config=require(_0x3413('0x6'));var controller=require(_0x3413('0x7'));router[_0x3413('0x8')]('/',auth[_0x3413('0x9')](),controller[_0x3413('0xa')]);router[_0x3413('0x8')](_0x3413('0xb'),auth[_0x3413('0x9')](),controller[_0x3413('0xc')]);router[_0x3413('0x8')](_0x3413('0xd'),auth[_0x3413('0x9')](),controller[_0x3413('0xe')]);router[_0x3413('0xf')]('/',auth[_0x3413('0x9')](),controller[_0x3413('0x10')]);router['put'](_0x3413('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3413('0xd'),auth[_0x3413('0x9')](),controller[_0x3413('0x11')]);module[_0x3413('0x12')]=router; \ No newline at end of file +var _0x765e=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x765e,0x131));var _0xe765=function(_0x56842a,_0x54bf5d){_0x56842a=_0x56842a-0x0;var _0x11e71a=_0x765e[_0x56842a];return _0x11e71a;};'use strict';var multer=require(_0xe765('0x0'));var util=require(_0xe765('0x1'));var path=require(_0xe765('0x2'));var timeout=require(_0xe765('0x3'));var express=require(_0xe765('0x4'));var router=express[_0xe765('0x5')]();var fs_extra=require(_0xe765('0x6'));var auth=require(_0xe765('0x7'));var interaction=require(_0xe765('0x8'));var config=require(_0xe765('0x9'));var controller=require(_0xe765('0xa'));router[_0xe765('0xb')]('/',auth[_0xe765('0xc')](),controller[_0xe765('0xd')]);router[_0xe765('0xb')]('/describe',auth[_0xe765('0xc')](),controller[_0xe765('0xe')]);router[_0xe765('0xb')](_0xe765('0xf'),auth[_0xe765('0xc')](),controller[_0xe765('0x10')]);router[_0xe765('0x11')]('/',auth['isAuthenticated'](),controller[_0xe765('0x12')]);router[_0xe765('0x13')](_0xe765('0xf'),auth['isAuthenticated'](),controller[_0xe765('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe765('0x15')]);module[_0xe765('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 9976f26..dbc889b 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 _0x693f=['STRING','sequelize','exports','TEXT'];(function(_0x1caea0,_0x2e3a19){var _0x5478de=function(_0x4cd498){while(--_0x4cd498){_0x1caea0['push'](_0x1caea0['shift']());}};_0x5478de(++_0x2e3a19);}(_0x693f,0x9d));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xf693('0x0'));module[_0xf693('0x1')]={'question':{'type':Sequelize[_0xf693('0x2')]},'answer':{'type':Sequelize[_0xf693('0x2')]('long')},'membername':{'type':Sequelize[_0xf693('0x3')]},'projectname':{'type':Sequelize[_0xf693('0x3')]},'queue':{'type':Sequelize[_0xf693('0x3')]},'uniqueid':{'type':Sequelize[_0xf693('0x3')]},'calleridname':{'type':Sequelize[_0xf693('0x3')]},'calleridnum':{'type':Sequelize[_0xf693('0x3')]},'questionId':{'type':Sequelize[_0xf693('0x3')]}}; \ No newline at end of file +var _0x4b0f=['STRING','exports','TEXT'];(function(_0x46c952,_0x2b1b3f){var _0x3e98b4=function(_0x40eb16){while(--_0x40eb16){_0x46c952['push'](_0x46c952['shift']());}};_0x3e98b4(++_0x2b1b3f);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x577169,_0x42e882){_0x577169=_0x577169-0x0;var _0x41e5fb=_0x4b0f[_0x577169];return _0x41e5fb;};'use strict';var Sequelize=require('sequelize');module[_0xf4b0('0x0')]={'question':{'type':Sequelize[_0xf4b0('0x1')]},'answer':{'type':Sequelize[_0xf4b0('0x1')]('long')},'membername':{'type':Sequelize[_0xf4b0('0x2')]},'projectname':{'type':Sequelize[_0xf4b0('0x2')]},'queue':{'type':Sequelize[_0xf4b0('0x2')]},'uniqueid':{'type':Sequelize[_0xf4b0('0x2')]},'calleridname':{'type':Sequelize[_0xf4b0('0x2')]},'calleridnum':{'type':Sequelize[_0xf4b0('0x2')]},'questionId':{'type':Sequelize[_0xf4b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 7490b33..0db9985 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 _0x8603=['fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes'];(function(_0x2426bb,_0x201d0f){var _0x63b587=function(_0x8b21f5){while(--_0x8b21f5){_0x2426bb['push'](_0x2426bb['shift']());}};_0x63b587(++_0x201d0f);}(_0x8603,0x190));var _0x3860=function(_0x5bcd0a,_0x2a552d){_0x5bcd0a=_0x5bcd0a-0x0;var _0x5293a6=_0x8603[_0x5bcd0a];return _0x5293a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];function respondWithStatusCode(_0x8ad61d,_0x2428f6){_0x2428f6=_0x2428f6||0xcc;return function(_0x1ea619){if(_0x1ea619){return _0x8ad61d[_0x3860('0x15')](_0x2428f6);}return _0x8ad61d[_0x3860('0x16')](_0x2428f6)[_0x3860('0x17')]();};}function respondWithResult(_0x12b23b,_0x465d8d){_0x465d8d=_0x465d8d||0xc8;return function(_0x46264d){if(_0x46264d){return _0x12b23b['status'](_0x465d8d)[_0x3860('0x18')](_0x46264d);}};}function respondWithFilteredResult(_0x21eaf1,_0x122e40){return function(_0x37d9ab){if(_0x37d9ab){var _0x1055b3=typeof _0x122e40[_0x3860('0x19')]===_0x3860('0x1a')&&typeof _0x122e40[_0x3860('0x1b')]===_0x3860('0x1a');var _0x3c0d91=_0x37d9ab[_0x3860('0x1c')];var _0x45b799=_0x1055b3?0x0:_0x122e40['offset'];var _0x4863bd=_0x1055b3?_0x37d9ab[_0x3860('0x1c')]:_0x122e40[_0x3860('0x19')]+_0x122e40[_0x3860('0x1b')];var _0x53fc63;if(_0x4863bd>=_0x3c0d91){_0x4863bd=_0x3c0d91;_0x53fc63=0xc8;}else{_0x53fc63=0xce;}_0x21eaf1[_0x3860('0x16')](_0x53fc63);return _0x21eaf1[_0x3860('0x1d')](_0x3860('0x1e'),_0x45b799+'-'+_0x4863bd+'/'+_0x3c0d91)[_0x3860('0x18')](_0x37d9ab);}return null;};}function patchUpdates(_0x20a5b0){return function(_0x45081f){try{jsonpatch[_0x3860('0x1f')](_0x45081f,_0x20a5b0,!![]);}catch(_0x1f8891){return BPromise[_0x3860('0x20')](_0x1f8891);}return _0x45081f[_0x3860('0x21')]();};}function saveUpdates(_0xacd57f,_0x2e0b6e){return function(_0x280ea9){if(_0x280ea9){return _0x280ea9[_0x3860('0x22')](_0xacd57f)[_0x3860('0x23')](function(_0x564efd){return _0x564efd;});}return null;};}function removeEntity(_0xfc10a5,_0x133093){return function(_0x2b91f2){if(_0x2b91f2){return _0x2b91f2[_0x3860('0x24')]()[_0x3860('0x23')](function(){_0xfc10a5['status'](0xcc)[_0x3860('0x17')]();});}};}function handleEntityNotFound(_0x568515,_0x577750){return function(_0xfa9705){if(!_0xfa9705){_0x568515[_0x3860('0x15')](0x194);}return _0xfa9705;};}function handleError(_0x54b5ec,_0x4d9a90){_0x4d9a90=_0x4d9a90||0x1f4;return function(_0x5f42d5){logger[_0x3860('0x25')](_0x5f42d5[_0x3860('0x26')]);if(_0x5f42d5[_0x3860('0x27')]){delete _0x5f42d5[_0x3860('0x27')];}_0x54b5ec[_0x3860('0x16')](_0x4d9a90)[_0x3860('0x28')](_0x5f42d5);};}exports['index']=function(_0x4c4314,_0x389bd0){var _0x1f1809={},_0x5a9af2={},_0x2551f4={'count':0x0,'rows':[]};var _0x3d5143=_[_0x3860('0x29')](db[_0x3860('0x2a')][_0x3860('0x2b')],function(_0x4bbae9){return{'name':_0x4bbae9[_0x3860('0x2c')],'type':_0x4bbae9[_0x3860('0x2d')][_0x3860('0x2e')]};});_0x5a9af2['model']=_[_0x3860('0x29')](_0x3d5143,'name');_0x5a9af2[_0x3860('0x2f')]=_['keys'](_0x4c4314[_0x3860('0x2f')]);_0x5a9af2[_0x3860('0x30')]=_[_0x3860('0x31')](_0x5a9af2['model'],_0x5a9af2[_0x3860('0x2f')]);_0x1f1809[_0x3860('0x32')]=_['intersection'](_0x5a9af2[_0x3860('0x33')],qs['fields'](_0x4c4314[_0x3860('0x2f')][_0x3860('0x34')]));_0x1f1809[_0x3860('0x32')]=_0x1f1809[_0x3860('0x32')][_0x3860('0x35')]?_0x1f1809[_0x3860('0x32')]:_0x5a9af2[_0x3860('0x33')];if(!_0x4c4314['query'][_0x3860('0x36')](_0x3860('0x37'))){_0x1f1809['limit']=qs[_0x3860('0x1b')](_0x4c4314[_0x3860('0x2f')][_0x3860('0x1b')]);_0x1f1809['offset']=qs['offset'](_0x4c4314[_0x3860('0x2f')][_0x3860('0x19')]);}_0x1f1809[_0x3860('0x38')]=qs[_0x3860('0x39')](_0x4c4314['query']['sort']);_0x1f1809[_0x3860('0x3a')]=qs[_0x3860('0x30')](_[_0x3860('0x3b')](_0x4c4314[_0x3860('0x2f')],_0x5a9af2[_0x3860('0x30')]),_0x3d5143);if(_0x4c4314['query'][_0x3860('0x3c')]){_0x1f1809[_0x3860('0x3a')]=_['merge'](_0x1f1809['where'],{'$or':_[_0x3860('0x29')](_0x3d5143,function(_0x148914){if(_0x148914[_0x3860('0x2d')]!==_0x3860('0x3d')){var _0x2b35b2={};_0x2b35b2[_0x148914['name']]={'$like':'%'+_0x4c4314[_0x3860('0x2f')]['filter']+'%'};return _0x2b35b2;}})});}_0x1f1809=_[_0x3860('0x3e')]({},_0x1f1809,_0x4c4314[_0x3860('0x3f')]);var _0x53d443={'where':_0x1f1809[_0x3860('0x3a')]};return db[_0x3860('0x2a')]['count'](_0x53d443)[_0x3860('0x23')](function(_0xc7d34d){_0x2551f4[_0x3860('0x1c')]=_0xc7d34d;if(_0x4c4314[_0x3860('0x2f')]['includeAll']){_0x1f1809[_0x3860('0x40')]=[{'all':!![]}];}return db[_0x3860('0x2a')][_0x3860('0x41')](_0x1f1809);})['then'](function(_0x3a87e5){_0x2551f4['rows']=_0x3a87e5;return _0x2551f4;})[_0x3860('0x23')](respondWithFilteredResult(_0x389bd0,_0x1f1809))[_0x3860('0x42')](handleError(_0x389bd0,null));};exports[_0x3860('0x43')]=function(_0x3f613f,_0x2220c8){var _0x3f4216={'raw':!![],'where':{'id':_0x3f613f[_0x3860('0x44')]['id']}},_0x4e0a44={};_0x4e0a44[_0x3860('0x33')]=_['keys'](db['JscriptyQuestionReport'][_0x3860('0x2b')]);_0x4e0a44[_0x3860('0x2f')]=_['keys'](_0x3f613f[_0x3860('0x2f')]);_0x4e0a44[_0x3860('0x30')]=_['intersection'](_0x4e0a44[_0x3860('0x33')],_0x4e0a44[_0x3860('0x2f')]);_0x3f4216[_0x3860('0x32')]=_[_0x3860('0x31')](_0x4e0a44[_0x3860('0x33')],qs[_0x3860('0x34')](_0x3f613f[_0x3860('0x2f')][_0x3860('0x34')]));_0x3f4216[_0x3860('0x32')]=_0x3f4216[_0x3860('0x32')][_0x3860('0x35')]?_0x3f4216[_0x3860('0x32')]:_0x4e0a44[_0x3860('0x33')];if(_0x3f613f['query'][_0x3860('0x45')]){_0x3f4216['include']=[{'all':!![]}];}_0x3f4216=_[_0x3860('0x3e')]({},_0x3f4216,_0x3f613f[_0x3860('0x3f')]);return db[_0x3860('0x2a')][_0x3860('0x46')](_0x3f4216)[_0x3860('0x23')](handleEntityNotFound(_0x2220c8,null))[_0x3860('0x23')](respondWithResult(_0x2220c8,null))[_0x3860('0x42')](handleError(_0x2220c8,null));};exports[_0x3860('0x47')]=function(_0x5a91b2,_0x3cd575){return db[_0x3860('0x2a')][_0x3860('0x47')](_0x5a91b2['body'],{})[_0x3860('0x23')](respondWithResult(_0x3cd575,0xc9))[_0x3860('0x42')](handleError(_0x3cd575,null));};exports[_0x3860('0x22')]=function(_0x3dc957,_0x5ed2db){if(_0x3dc957['body']['id']){delete _0x3dc957[_0x3860('0x48')]['id'];}return db['JscriptyQuestionReport'][_0x3860('0x46')]({'where':{'id':_0x3dc957[_0x3860('0x44')]['id']}})[_0x3860('0x23')](handleEntityNotFound(_0x5ed2db,null))['then'](saveUpdates(_0x3dc957[_0x3860('0x48')],null))['then'](respondWithResult(_0x5ed2db,null))[_0x3860('0x42')](handleError(_0x5ed2db,null));};exports['destroy']=function(_0xf9edb4,_0x25d22f){return db[_0x3860('0x2a')]['find']({'where':{'id':_0xf9edb4['params']['id']}})[_0x3860('0x23')](handleEntityNotFound(_0x25d22f,null))[_0x3860('0x23')](removeEntity(_0x25d22f,null))['catch'](handleError(_0x25d22f,null));};exports[_0x3860('0x49')]=function(_0x58237e,_0x3b3bfe){return db[_0x3860('0x2a')][_0x3860('0x49')]()[_0x3860('0x23')](respondWithResult(_0x3b3bfe,null))[_0x3860('0x42')](handleError(_0x3b3bfe,null));}; \ No newline at end of file +var _0x0bb5=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','VIRTUAL','options','findAll','show','params','rawAttributes','includeAll','include','find','catch','create','body','update','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x5afdaf,_0x198409){var _0x1b2dc5=function(_0x1455c8){while(--_0x1455c8){_0x5afdaf['push'](_0x5afdaf['shift']());}};_0x1b2dc5(++_0x198409);}(_0x0bb5,0x148));var _0x50bb=function(_0x35089d,_0x429864){_0x35089d=_0x35089d-0x0;var _0x188b8f=_0x0bb5[_0x35089d];return _0x188b8f;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)[_0x50bb('0x26')]();});}};}function handleEntityNotFound(_0x284a76,_0x3462c1){return function(_0x5234d7){if(!_0x5234d7){_0x284a76[_0x50bb('0x19')](0x194);}return _0x5234d7;};}function handleError(_0x4d38f7,_0x55e87b){_0x55e87b=_0x55e87b||0x1f4;return function(_0x2befd9){logger['error'](_0x2befd9['stack']);if(_0x2befd9[_0x50bb('0x27')]){delete _0x2befd9[_0x50bb('0x27')];}_0x4d38f7[_0x50bb('0x1a')](_0x55e87b)[_0x50bb('0x28')](_0x2befd9);};}exports[_0x50bb('0x29')]=function(_0x269479,_0x41a8ad){var _0x41d479={},_0x4f7514={},_0x44ce86={'count':0x0,'rows':[]};var _0x461cf3=_[_0x50bb('0x2a')](db[_0x50bb('0x2b')]['rawAttributes'],function(_0x13dc3c){return{'name':_0x13dc3c[_0x50bb('0x2c')],'type':_0x13dc3c[_0x50bb('0x2d')][_0x50bb('0x2e')]};});_0x4f7514[_0x50bb('0x2f')]=_[_0x50bb('0x2a')](_0x461cf3,_0x50bb('0x27'));_0x4f7514[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x269479[_0x50bb('0x30')]);_0x4f7514[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x4f7514['model'],_0x4f7514[_0x50bb('0x30')]);_0x41d479[_0x50bb('0x34')]=_[_0x50bb('0x33')](_0x4f7514[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x269479[_0x50bb('0x30')][_0x50bb('0x35')]));_0x41d479[_0x50bb('0x34')]=_0x41d479[_0x50bb('0x34')][_0x50bb('0x36')]?_0x41d479[_0x50bb('0x34')]:_0x4f7514['model'];if(!_0x269479[_0x50bb('0x30')][_0x50bb('0x37')](_0x50bb('0x38'))){_0x41d479[_0x50bb('0x39')]=qs[_0x50bb('0x39')](_0x269479[_0x50bb('0x30')]['limit']);_0x41d479['offset']=qs[_0x50bb('0x1c')](_0x269479['query'][_0x50bb('0x1c')]);}_0x41d479[_0x50bb('0x3a')]=qs[_0x50bb('0x3b')](_0x269479[_0x50bb('0x30')][_0x50bb('0x3b')]);_0x41d479['where']=qs[_0x50bb('0x32')](_['pick'](_0x269479[_0x50bb('0x30')],_0x4f7514[_0x50bb('0x32')]),_0x461cf3);if(_0x269479[_0x50bb('0x30')]['filter']){_0x41d479['where']=_[_0x50bb('0x3c')](_0x41d479[_0x50bb('0x3d')],{'$or':_[_0x50bb('0x2a')](_0x461cf3,function(_0x21a180){if(_0x21a180['type']!==_0x50bb('0x3e')){var _0x4b75dc={};_0x4b75dc[_0x21a180['name']]={'$like':'%'+_0x269479[_0x50bb('0x30')]['filter']+'%'};return _0x4b75dc;}})});}_0x41d479=_[_0x50bb('0x3c')]({},_0x41d479,_0x269479[_0x50bb('0x3f')]);var _0x1ef231={'where':_0x41d479[_0x50bb('0x3d')]};return db[_0x50bb('0x2b')][_0x50bb('0x1e')](_0x1ef231)[_0x50bb('0x24')](function(_0x1cf782){_0x44ce86[_0x50bb('0x1e')]=_0x1cf782;if(_0x269479[_0x50bb('0x30')]['includeAll']){_0x41d479['include']=[{'all':!![]}];}return db[_0x50bb('0x2b')][_0x50bb('0x40')](_0x41d479);})[_0x50bb('0x24')](function(_0x1d929d){_0x44ce86['rows']=_0x1d929d;return _0x44ce86;})[_0x50bb('0x24')](respondWithFilteredResult(_0x41a8ad,_0x41d479))['catch'](handleError(_0x41a8ad,null));};exports[_0x50bb('0x41')]=function(_0x473a4c,_0x379944){var _0x40748d={'raw':!![],'where':{'id':_0x473a4c[_0x50bb('0x42')]['id']}},_0x1c438b={};_0x1c438b[_0x50bb('0x2f')]=_[_0x50bb('0x31')](db[_0x50bb('0x2b')][_0x50bb('0x43')]);_0x1c438b[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x473a4c[_0x50bb('0x30')]);_0x1c438b[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x1c438b[_0x50bb('0x2f')],_0x1c438b['query']);_0x40748d[_0x50bb('0x34')]=_['intersection'](_0x1c438b[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x473a4c[_0x50bb('0x30')][_0x50bb('0x35')]));_0x40748d[_0x50bb('0x34')]=_0x40748d[_0x50bb('0x34')][_0x50bb('0x36')]?_0x40748d[_0x50bb('0x34')]:_0x1c438b[_0x50bb('0x2f')];if(_0x473a4c[_0x50bb('0x30')][_0x50bb('0x44')]){_0x40748d[_0x50bb('0x45')]=[{'all':!![]}];}_0x40748d=_[_0x50bb('0x3c')]({},_0x40748d,_0x473a4c[_0x50bb('0x3f')]);return db['JscriptyQuestionReport'][_0x50bb('0x46')](_0x40748d)['then'](handleEntityNotFound(_0x379944,null))[_0x50bb('0x24')](respondWithResult(_0x379944,null))[_0x50bb('0x47')](handleError(_0x379944,null));};exports[_0x50bb('0x48')]=function(_0x35b440,_0x650e91){return db[_0x50bb('0x2b')][_0x50bb('0x48')](_0x35b440[_0x50bb('0x49')],{})['then'](respondWithResult(_0x650e91,0xc9))[_0x50bb('0x47')](handleError(_0x650e91,null));};exports[_0x50bb('0x4a')]=function(_0xf52a22,_0x13afe2){if(_0xf52a22[_0x50bb('0x49')]['id']){delete _0xf52a22['body']['id'];}return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0xf52a22[_0x50bb('0x42')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x13afe2,null))[_0x50bb('0x24')](saveUpdates(_0xf52a22['body'],null))['then'](respondWithResult(_0x13afe2,null))[_0x50bb('0x47')](handleError(_0x13afe2,null));};exports['destroy']=function(_0x357d08,_0x57ee0e){return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0x357d08[_0x50bb('0x42')]['id']}})['then'](handleEntityNotFound(_0x57ee0e,null))[_0x50bb('0x24')](removeEntity(_0x57ee0e,null))[_0x50bb('0x47')](handleError(_0x57ee0e,null));};exports['describe']=function(_0x184147,_0x1dff6a){return db[_0x50bb('0x2b')][_0x50bb('0x4b')]()['then'](respondWithResult(_0x1dff6a,null))[_0x50bb('0x47')](handleError(_0x1dff6a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index d6ee33e..0664ef5 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 _0xd585=['path','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','moment','request-promise'];(function(_0x1c0368,_0x3a6842){var _0x7e9ec4=function(_0x1cb075){while(--_0x1cb075){_0x1c0368['push'](_0x1c0368['shift']());}};_0x7e9ec4(++_0x3a6842);}(_0xd585,0x1eb));var _0x5d58=function(_0x5228c6,_0x267043){_0x5228c6=_0x5228c6-0x0;var _0x542731=_0xd585[_0x5228c6];return _0x542731;};'use strict';var _=require('lodash');var util=require(_0x5d58('0x0'));var logger=require(_0x5d58('0x1'))('api');var moment=require(_0x5d58('0x2'));var BPromise=require('bluebird');var rp=require(_0x5d58('0x3'));var fs=require('fs');var path=require(_0x5d58('0x4'));var rimraf=require(_0x5d58('0x5'));var config=require('../../config/environment');var attributes=require(_0x5d58('0x6'));module[_0x5d58('0x7')]=function(_0x209897,_0x62ddf5){return _0x209897[_0x5d58('0x8')](_0x5d58('0x9'),attributes,{'tableName':_0x5d58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba02=['exports','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x15d6af,_0x1a5884){var _0x3db16a=function(_0x57b274){while(--_0x57b274){_0x15d6af['push'](_0x15d6af['shift']());}};_0x3db16a(++_0x1a5884);}(_0xba02,0x163));var _0x2ba0=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xba02[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require(_0x2ba0('0x0'));var logger=require(_0x2ba0('0x1'))(_0x2ba0('0x2'));var moment=require(_0x2ba0('0x3'));var BPromise=require(_0x2ba0('0x4'));var rp=require(_0x2ba0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ba0('0x6'));var config=require(_0x2ba0('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x2ba0('0x8')]=function(_0x573924,_0x142175){return _0x573924['define'](_0x2ba0('0x9'),attributes,{'tableName':_0x2ba0('0xa'),'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 b02798c..23c8422 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 _0x612d=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x12f9e3,_0x3fadc1){var _0x2de0c8=function(_0x31b5c5){while(--_0x31b5c5){_0x12f9e3['push'](_0x12f9e3['shift']());}};_0x2de0c8(++_0x3fadc1);}(_0x612d,0xe9));var _0xd612=function(_0x4ef7bc,_0x1e8207){_0x4ef7bc=_0x4ef7bc-0x0;var _0x30a74f=_0x612d[_0x4ef7bc];return _0x30a74f;};'use strict';var _=require(_0xd612('0x0'));var util=require(_0xd612('0x1'));var moment=require(_0xd612('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd612('0x3'));var db=require(_0xd612('0x4'))['db'];var utils=require(_0xd612('0x5'));var logger=require(_0xd612('0x6'))(_0xd612('0x7'));var config=require(_0xd612('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd612('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32b89c,_0x1cf21d,_0x40d029){return new BPromise(function(_0x57f517,_0x1e6693){return client[_0xd612('0xa')](_0x32b89c,_0x40d029)['then'](function(_0x38d06a){logger[_0xd612('0xb')](_0xd612('0xc'),_0x1cf21d,_0xd612('0xd'));logger['debug'](_0xd612('0xe'),_0x1cf21d,_0xd612('0xd'),JSON[_0xd612('0xf')](_0x38d06a));if(_0x38d06a[_0xd612('0x10')]){if(_0x38d06a[_0xd612('0x10')][_0xd612('0x11')]===0x1f4){logger['error'](_0xd612('0xc'),_0x1cf21d,_0x38d06a[_0xd612('0x10')][_0xd612('0x12')]);return _0x1e6693(_0x38d06a[_0xd612('0x10')][_0xd612('0x12')]);}logger[_0xd612('0x10')](_0xd612('0xc'),_0x1cf21d,_0x38d06a[_0xd612('0x10')][_0xd612('0x12')]);return _0x57f517(_0x38d06a[_0xd612('0x10')][_0xd612('0x12')]);}else{logger['info'](_0xd612('0xc'),_0x1cf21d,_0xd612('0xd'));_0x57f517(_0x38d06a[_0xd612('0x13')][_0xd612('0x12')]);}})[_0xd612('0x14')](function(_0x53b296){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1cf21d,_0x53b296);_0x1e6693(_0x53b296);});});} \ No newline at end of file +var _0x16d9=['stringify','error','code','message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x16d9,0x93));var _0x916d=function(_0x3893da,_0x22bffb){_0x3893da=_0x3893da-0x0;var _0x1c3533=_0x16d9[_0x3893da];return _0x1c3533;};'use strict';var _=require('lodash');var util=require(_0x916d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x916d('0x1'));var fs=require('fs');var Redis=require(_0x916d('0x2'));var db=require(_0x916d('0x3'))['db'];var utils=require(_0x916d('0x4'));var logger=require(_0x916d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x916d('0x6'));var client=jayson[_0x916d('0x7')][_0x916d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27b977,_0x1ea219,_0x471ea0){return new BPromise(function(_0x2d0fc5,_0x3a3772){return client['request'](_0x27b977,_0x471ea0)['then'](function(_0x298970){logger['info'](_0x916d('0x9'),_0x1ea219,_0x916d('0xa'));logger[_0x916d('0xb')](_0x916d('0xc'),_0x1ea219,_0x916d('0xa'),JSON[_0x916d('0xd')](_0x298970));if(_0x298970['error']){if(_0x298970[_0x916d('0xe')][_0x916d('0xf')]===0x1f4){logger[_0x916d('0xe')](_0x916d('0x9'),_0x1ea219,_0x298970[_0x916d('0xe')][_0x916d('0x10')]);return _0x3a3772(_0x298970['error'][_0x916d('0x10')]);}logger[_0x916d('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1ea219,_0x298970[_0x916d('0xe')][_0x916d('0x10')]);return _0x2d0fc5(_0x298970[_0x916d('0xe')]['message']);}else{logger[_0x916d('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1ea219,'request\x20sent');_0x2d0fc5(_0x298970[_0x916d('0x12')][_0x916d('0x10')]);}})[_0x916d('0x13')](function(_0x415610){logger[_0x916d('0xe')](_0x916d('0x9'),_0x1ea219,_0x415610);_0x3a3772(_0x415610);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index eef8514..74ee8d8 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 _0x7fbe=['/describe','describe','/:id','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index'];(function(_0x5d8560,_0xe50b53){var _0x4cc42a=function(_0x47414f){while(--_0x47414f){_0x5d8560['push'](_0x5d8560['shift']());}};_0x4cc42a(++_0xe50b53);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1f2b50,_0x20b570){_0x1f2b50=_0x1f2b50-0x0;var _0x5675c1=_0x7fbe[_0x1f2b50];return _0x5675c1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['get'](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x11')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x13')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x15')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x16')]);module[_0xe7fb('0x17')]=router; \ No newline at end of file +var _0xeff8=['index','get','/describe','describe','/:id','/:id/questions','getQuestions','create','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated'];(function(_0x471f8f,_0x2eaaf8){var _0x31da61=function(_0x44d464){while(--_0x44d464){_0x471f8f['push'](_0x471f8f['shift']());}};_0x31da61(++_0x2eaaf8);}(_0xeff8,0x186));var _0x8eff=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xeff8[_0x1b5aea];return _0x15cfc6;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get']('/',auth[_0x8eff('0x9')](),controller[_0x8eff('0xa')]);router[_0x8eff('0xb')](_0x8eff('0xc'),auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xb')](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller['show']);router['get'](_0x8eff('0xf'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x10')]);router['post']('/',auth[_0x8eff('0x9')](),controller[_0x8eff('0x11')]);router['put'](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller['update']);router['delete'](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x12')]);module[_0x8eff('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 5ddc3c3..d63a369 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 _0x03c6=['BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','STRING'];(function(_0xef7c71,_0x4fc71c){var _0x41de8c=function(_0x41e09c){while(--_0x41e09c){_0xef7c71['push'](_0xef7c71['shift']());}};_0x41de8c(++_0x4fc71c);}(_0x03c6,0x155));var _0x603c=function(_0x3d78c9,_0x3a62c3){_0x3d78c9=_0x3d78c9-0x0;var _0x257079=_0x03c6[_0x3d78c9];return _0x257079;};'use strict';var moment=require(_0x603c('0x0'));var Sequelize=require(_0x603c('0x1'));module[_0x603c('0x2')]={'starttime':{'type':Sequelize[_0x603c('0x3')],'set':function(_0x480cf0){this[_0x603c('0x4')](_0x603c('0x5'),_0x480cf0);this['setDataValue'](_0x603c('0x6'),moment()[_0x603c('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x603c('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x603c('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x603c('0x8')]},'completed':{'type':Sequelize[_0x603c('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x8c1d=['setDataValue','starttime','endtime','format','STRING','BOOLEAN','sequelize','DATE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8c1d,0x66));var _0xd8c1=function(_0x11650b,_0x3bace5){_0x11650b=_0x11650b-0x0;var _0x489b22=_0x8c1d[_0x11650b];return _0x489b22;};'use strict';var moment=require('moment');var Sequelize=require(_0xd8c1('0x0'));module['exports']={'starttime':{'type':Sequelize[_0xd8c1('0x1')],'set':function(_0x1649b7){this[_0xd8c1('0x2')](_0xd8c1('0x3'),_0x1649b7);this['setDataValue'](_0xd8c1('0x4'),moment()[_0xd8c1('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xd8c1('0x1')]},'membername':{'type':Sequelize[_0xd8c1('0x6')]},'projectname':{'type':Sequelize[_0xd8c1('0x6')]},'queue':{'type':Sequelize[_0xd8c1('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd8c1('0x6')]},'calleridnum':{'type':Sequelize[_0xd8c1('0x6')]},'completed':{'type':Sequelize[_0xd8c1('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 2327844..7af802f 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 _0x506d=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','name','send','map','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','length','pick','SessionId','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2ce4d9,_0x47173f){var _0x3a802c=function(_0x13c969){while(--_0x13c969){_0x2ce4d9['push'](_0x2ce4d9['shift']());}};_0x3a802c(++_0x47173f);}(_0x506d,0xe2));var _0xd506=function(_0x56ba37,_0x4669e5){_0x56ba37=_0x56ba37-0x0;var _0x365e17=_0x506d[_0x56ba37];return _0x365e17;};'use strict';var emlformat=require(_0xd506('0x0'));var rimraf=require(_0xd506('0x1'));var zipdir=require(_0xd506('0x2'));var jsonpatch=require(_0xd506('0x3'));var rp=require(_0xd506('0x4'));var moment=require(_0xd506('0x5'));var BPromise=require(_0xd506('0x6'));var Mustache=require(_0xd506('0x7'));var util=require(_0xd506('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd506('0x9'));var ejs=require(_0xd506('0xa'));var fs=require('fs');var fs_extra=require(_0xd506('0xb'));var _=require(_0xd506('0xc'));var squel=require(_0xd506('0xd'));var crypto=require(_0xd506('0xe'));var jsforce=require(_0xd506('0xf'));var deskjs=require(_0xd506('0x10'));var toCsv=require(_0xd506('0x9'));var querystring=require(_0xd506('0x11'));var Papa=require(_0xd506('0x12'));var Redis=require(_0xd506('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd506('0x14'));var as=require(_0xd506('0x15'));var hardwareService=require(_0xd506('0x16'));var logger=require('../../config/logger')(_0xd506('0x17'));var utils=require(_0xd506('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd506('0x19'));var db=require(_0xd506('0x1a'))['db'];function respondWithStatusCode(_0x325e82,_0x2dddea){_0x2dddea=_0x2dddea||0xcc;return function(_0x444140){if(_0x444140){return _0x325e82[_0xd506('0x1b')](_0x2dddea);}return _0x325e82[_0xd506('0x1c')](_0x2dddea)['end']();};}function respondWithResult(_0x2eb53d,_0x5228f4){_0x5228f4=_0x5228f4||0xc8;return function(_0x9a6bbd){if(_0x9a6bbd){return _0x2eb53d[_0xd506('0x1c')](_0x5228f4)[_0xd506('0x1d')](_0x9a6bbd);}};}function respondWithFilteredResult(_0xebc85b,_0x1dad0a){return function(_0x1ac7de){if(_0x1ac7de){var _0x5a79eb=typeof _0x1dad0a[_0xd506('0x1e')]===_0xd506('0x1f')&&typeof _0x1dad0a['limit']===_0xd506('0x1f');var _0x371609=_0x1ac7de['count'];var _0xf37dfd=_0x5a79eb?0x0:_0x1dad0a[_0xd506('0x1e')];var _0x134854=_0x5a79eb?_0x1ac7de[_0xd506('0x20')]:_0x1dad0a[_0xd506('0x1e')]+_0x1dad0a[_0xd506('0x21')];var _0x314470;if(_0x134854>=_0x371609){_0x134854=_0x371609;_0x314470=0xc8;}else{_0x314470=0xce;}_0xebc85b[_0xd506('0x1c')](_0x314470);return _0xebc85b['set'](_0xd506('0x22'),_0xf37dfd+'-'+_0x134854+'/'+_0x371609)[_0xd506('0x1d')](_0x1ac7de);}return null;};}function patchUpdates(_0xfca9d0){return function(_0x578c6d){try{jsonpatch[_0xd506('0x23')](_0x578c6d,_0xfca9d0,!![]);}catch(_0x3674bb){return BPromise[_0xd506('0x24')](_0x3674bb);}return _0x578c6d[_0xd506('0x25')]();};}function saveUpdates(_0x5221b3,_0x2492c1){return function(_0x44be0c){if(_0x44be0c){return _0x44be0c['update'](_0x5221b3)[_0xd506('0x26')](function(_0x35ec2e){return _0x35ec2e;});}return null;};}function removeEntity(_0x3a9497,_0x4e6e01){return function(_0x2deecc){if(_0x2deecc){return _0x2deecc[_0xd506('0x27')]()['then'](function(){_0x3a9497[_0xd506('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x226fe6,_0x4d5b1b){return function(_0xb0061e){if(!_0xb0061e){_0x226fe6[_0xd506('0x1b')](0x194);}return _0xb0061e;};}function handleError(_0x11eba4,_0x352ebe){_0x352ebe=_0x352ebe||0x1f4;return function(_0x9d12f5){logger['error'](_0x9d12f5['stack']);if(_0x9d12f5[_0xd506('0x28')]){delete _0x9d12f5[_0xd506('0x28')];}_0x11eba4['status'](_0x352ebe)[_0xd506('0x29')](_0x9d12f5);};}exports['index']=function(_0x1d038e,_0x3b87a7){var _0x13d793={},_0x38f16a={},_0xc229b4={'count':0x0,'rows':[]};var _0x1c6988=_[_0xd506('0x2a')](db['JscriptySessionReport']['rawAttributes'],function(_0x2bed13){return{'name':_0x2bed13['fieldName'],'type':_0x2bed13[_0xd506('0x2b')]['key']};});_0x38f16a[_0xd506('0x2c')]=_[_0xd506('0x2a')](_0x1c6988,'name');_0x38f16a['query']=_[_0xd506('0x2d')](_0x1d038e[_0xd506('0x2e')]);_0x38f16a[_0xd506('0x2f')]=_[_0xd506('0x30')](_0x38f16a[_0xd506('0x2c')],_0x38f16a[_0xd506('0x2e')]);_0x13d793[_0xd506('0x31')]=_[_0xd506('0x30')](_0x38f16a['model'],qs['fields'](_0x1d038e[_0xd506('0x2e')][_0xd506('0x32')]));_0x13d793[_0xd506('0x31')]=_0x13d793['attributes']['length']?_0x13d793[_0xd506('0x31')]:_0x38f16a[_0xd506('0x2c')];if(!_0x1d038e[_0xd506('0x2e')][_0xd506('0x33')](_0xd506('0x34'))){_0x13d793[_0xd506('0x21')]=qs[_0xd506('0x21')](_0x1d038e[_0xd506('0x2e')][_0xd506('0x21')]);_0x13d793['offset']=qs[_0xd506('0x1e')](_0x1d038e[_0xd506('0x2e')]['offset']);}_0x13d793[_0xd506('0x35')]=qs[_0xd506('0x36')](_0x1d038e['query'][_0xd506('0x36')]);_0x13d793[_0xd506('0x37')]=qs[_0xd506('0x2f')](_['pick'](_0x1d038e[_0xd506('0x2e')],_0x38f16a['filters']),_0x1c6988);if(_0x1d038e[_0xd506('0x2e')][_0xd506('0x38')]){_0x13d793[_0xd506('0x37')]=_[_0xd506('0x39')](_0x13d793[_0xd506('0x37')],{'$or':_[_0xd506('0x2a')](_0x1c6988,function(_0x4603b0){if(_0x4603b0['type']!==_0xd506('0x3a')){var _0x17a213={};_0x17a213[_0x4603b0[_0xd506('0x28')]]={'$like':'%'+_0x1d038e[_0xd506('0x2e')][_0xd506('0x38')]+'%'};return _0x17a213;}})});}_0x13d793=_[_0xd506('0x39')]({},_0x13d793,_0x1d038e[_0xd506('0x3b')]);var _0x4d9201={'where':_0x13d793[_0xd506('0x37')]};return db[_0xd506('0x3c')][_0xd506('0x20')](_0x4d9201)['then'](function(_0x52199a){_0xc229b4[_0xd506('0x20')]=_0x52199a;if(_0x1d038e[_0xd506('0x2e')][_0xd506('0x3d')]){_0x13d793[_0xd506('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xd506('0x3f')](_0x13d793);})[_0xd506('0x26')](function(_0x4e0a7e){_0xc229b4['rows']=_0x4e0a7e;return _0xc229b4;})['then'](respondWithFilteredResult(_0x3b87a7,_0x13d793))[_0xd506('0x40')](handleError(_0x3b87a7,null));};exports[_0xd506('0x41')]=function(_0x43c1d7,_0x734180){var _0xa727fd={'raw':!![],'where':{'id':_0x43c1d7[_0xd506('0x42')]['id']}},_0x460a3e={};_0x460a3e['model']=_[_0xd506('0x2d')](db[_0xd506('0x3c')][_0xd506('0x43')]);_0x460a3e[_0xd506('0x2e')]=_[_0xd506('0x2d')](_0x43c1d7[_0xd506('0x2e')]);_0x460a3e[_0xd506('0x2f')]=_[_0xd506('0x30')](_0x460a3e[_0xd506('0x2c')],_0x460a3e[_0xd506('0x2e')]);_0xa727fd[_0xd506('0x31')]=_[_0xd506('0x30')](_0x460a3e[_0xd506('0x2c')],qs[_0xd506('0x32')](_0x43c1d7[_0xd506('0x2e')]['fields']));_0xa727fd[_0xd506('0x31')]=_0xa727fd[_0xd506('0x31')]['length']?_0xa727fd[_0xd506('0x31')]:_0x460a3e['model'];if(_0x43c1d7[_0xd506('0x2e')]['includeAll']){_0xa727fd[_0xd506('0x3e')]=[{'all':!![]}];}_0xa727fd=_[_0xd506('0x39')]({},_0xa727fd,_0x43c1d7[_0xd506('0x3b')]);return db[_0xd506('0x3c')][_0xd506('0x44')](_0xa727fd)[_0xd506('0x26')](handleEntityNotFound(_0x734180,null))[_0xd506('0x26')](respondWithResult(_0x734180,null))[_0xd506('0x40')](handleError(_0x734180,null));};exports[_0xd506('0x45')]=function(_0x994af3,_0x25ff1c){return db[_0xd506('0x3c')]['create'](_0x994af3[_0xd506('0x46')],{})[_0xd506('0x26')](respondWithResult(_0x25ff1c,0xc9))[_0xd506('0x40')](handleError(_0x25ff1c,null));};exports[_0xd506('0x47')]=function(_0x1b6818,_0x204bf6){if(_0x1b6818[_0xd506('0x46')]['id']){delete _0x1b6818[_0xd506('0x46')]['id'];}return db['JscriptySessionReport'][_0xd506('0x44')]({'where':{'id':_0x1b6818['params']['id']}})['then'](handleEntityNotFound(_0x204bf6,null))[_0xd506('0x26')](saveUpdates(_0x1b6818[_0xd506('0x46')],null))[_0xd506('0x26')](respondWithResult(_0x204bf6,null))['catch'](handleError(_0x204bf6,null));};exports[_0xd506('0x27')]=function(_0x23001f,_0x5ae60b){return db[_0xd506('0x3c')]['find']({'where':{'id':_0x23001f[_0xd506('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ae60b,null))[_0xd506('0x26')](removeEntity(_0x5ae60b,null))[_0xd506('0x40')](handleError(_0x5ae60b,null));};exports[_0xd506('0x48')]=function(_0x5e83ff,_0x2cedef){return db[_0xd506('0x3c')][_0xd506('0x48')]()['then'](respondWithResult(_0x2cedef,null))['catch'](handleError(_0x2cedef,null));};exports[_0xd506('0x49')]=function(_0x3cbe1e,_0x3b8202,_0x36eb2c){var _0x55c5f3={'raw':!![],'where':{}};var _0x26ea68={};var _0x23fa14={'count':0x0,'rows':[]};return db[_0xd506('0x3c')][_0xd506('0x4a')]({'where':{'id':_0x3cbe1e[_0xd506('0x42')]['id']}})[_0xd506('0x26')](handleEntityNotFound(_0x3b8202,null))[_0xd506('0x26')](function(_0x5c3f7e){if(_0x5c3f7e){_0x26ea68[_0xd506('0x2c')]=_[_0xd506('0x2d')](db[_0xd506('0x4b')][_0xd506('0x43')]);_0x26ea68['query']=_[_0xd506('0x2d')](_0x3cbe1e[_0xd506('0x2e')]);_0x26ea68[_0xd506('0x2f')]=_[_0xd506('0x30')](_0x26ea68[_0xd506('0x2c')],_0x26ea68[_0xd506('0x2e')]);_0x55c5f3[_0xd506('0x31')]=_[_0xd506('0x30')](_0x26ea68[_0xd506('0x2c')],qs[_0xd506('0x32')](_0x3cbe1e['query'][_0xd506('0x32')]));_0x55c5f3[_0xd506('0x31')]=_0x55c5f3[_0xd506('0x31')][_0xd506('0x4c')]?_0x55c5f3['attributes']:_0x26ea68[_0xd506('0x2c')];if(!_0x3cbe1e[_0xd506('0x2e')]['hasOwnProperty'](_0xd506('0x34'))){_0x55c5f3[_0xd506('0x21')]=qs[_0xd506('0x21')](_0x3cbe1e[_0xd506('0x2e')]['limit']);_0x55c5f3[_0xd506('0x1e')]=qs[_0xd506('0x1e')](_0x3cbe1e['query'][_0xd506('0x1e')]);}_0x55c5f3['order']=qs['sort'](_0x3cbe1e[_0xd506('0x2e')][_0xd506('0x36')]);_0x55c5f3['where']=qs[_0xd506('0x2f')](_[_0xd506('0x4d')](_0x3cbe1e['query'],_0x26ea68[_0xd506('0x2f')]));_0x55c5f3[_0xd506('0x37')][_0xd506('0x4e')]=_0x5c3f7e['id'];if(_0x3cbe1e[_0xd506('0x2e')][_0xd506('0x38')]){_0x55c5f3[_0xd506('0x37')]=_[_0xd506('0x39')](_0x55c5f3[_0xd506('0x37')],{'$or':_[_0xd506('0x2a')](_0x55c5f3[_0xd506('0x31')],function(_0x5dcb36){var _0x598045={};_0x598045[_0x5dcb36]={'$like':'%'+_0x3cbe1e['query'][_0xd506('0x38')]+'%'};return _0x598045;})});}_0x55c5f3=_['merge']({},_0x55c5f3,_0x3cbe1e['options']);return db[_0xd506('0x4b')][_0xd506('0x20')]({'where':_0x55c5f3[_0xd506('0x37')]})[_0xd506('0x26')](function(_0x18b54f){_0x23fa14['count']=_0x18b54f;if(_0x3cbe1e['query'][_0xd506('0x3d')]){_0x55c5f3[_0xd506('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd506('0x3f')](_0x55c5f3);})[_0xd506('0x26')](function(_0x59907e){_0x23fa14[_0xd506('0x4f')]=_0x59907e;return _0x23fa14;});}})[_0xd506('0x26')](respondWithFilteredResult(_0x3b8202,_0x55c5f3))[_0xd506('0x40')](handleError(_0x3b8202,null));}; \ No newline at end of file +var _0x0a0d=['body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptySessionReport','include','findAll','rows','show','params','length','find','catch','create'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0x0a0d,0xe7));var _0xd0a0=function(_0x405541,_0x2945cc){_0x405541=_0x405541-0x0;var _0x194a1e=_0x0a0d[_0x405541];return _0x194a1e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd0a0('0x0'));var rp=require(_0xd0a0('0x1'));var moment=require('moment');var BPromise=require(_0xd0a0('0x2'));var Mustache=require(_0xd0a0('0x3'));var util=require(_0xd0a0('0x4'));var path=require(_0xd0a0('0x5'));var sox=require(_0xd0a0('0x6'));var csv=require('to-csv');var ejs=require(_0xd0a0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd0a0('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xd0a0('0x9'));var querystring=require('querystring');var Papa=require(_0xd0a0('0xa'));var Redis=require(_0xd0a0('0xb'));var authService=require(_0xd0a0('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xd0a0('0xd'));var hardwareService=require(_0xd0a0('0xe'));var logger=require(_0xd0a0('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xd0a0('0x10'));var licenseUtil=require(_0xd0a0('0x11'));var db=require(_0xd0a0('0x12'))['db'];function respondWithStatusCode(_0x5e2494,_0x5ee0b0){_0x5ee0b0=_0x5ee0b0||0xcc;return function(_0x3c769a){if(_0x3c769a){return _0x5e2494[_0xd0a0('0x13')](_0x5ee0b0);}return _0x5e2494[_0xd0a0('0x14')](_0x5ee0b0)[_0xd0a0('0x15')]();};}function respondWithResult(_0x2c6e4a,_0x14bab8){_0x14bab8=_0x14bab8||0xc8;return function(_0x553001){if(_0x553001){return _0x2c6e4a['status'](_0x14bab8)[_0xd0a0('0x16')](_0x553001);}};}function respondWithFilteredResult(_0x18301a,_0x318b1e){return function(_0x32230b){if(_0x32230b){var _0x9a94d6=typeof _0x318b1e['offset']===_0xd0a0('0x17')&&typeof _0x318b1e[_0xd0a0('0x18')]==='undefined';var _0x2cedf0=_0x32230b[_0xd0a0('0x19')];var _0x38fb42=_0x9a94d6?0x0:_0x318b1e[_0xd0a0('0x1a')];var _0x5e097e=_0x9a94d6?_0x32230b[_0xd0a0('0x19')]:_0x318b1e[_0xd0a0('0x1a')]+_0x318b1e[_0xd0a0('0x18')];var _0x5e3fe2;if(_0x5e097e>=_0x2cedf0){_0x5e097e=_0x2cedf0;_0x5e3fe2=0xc8;}else{_0x5e3fe2=0xce;}_0x18301a[_0xd0a0('0x14')](_0x5e3fe2);return _0x18301a['set'](_0xd0a0('0x1b'),_0x38fb42+'-'+_0x5e097e+'/'+_0x2cedf0)[_0xd0a0('0x16')](_0x32230b);}return null;};}function patchUpdates(_0x310e96){return function(_0xf828de){try{jsonpatch[_0xd0a0('0x1c')](_0xf828de,_0x310e96,!![]);}catch(_0x40d564){return BPromise[_0xd0a0('0x1d')](_0x40d564);}return _0xf828de[_0xd0a0('0x1e')]();};}function saveUpdates(_0x23e9e3,_0x51816c){return function(_0x4b6893){if(_0x4b6893){return _0x4b6893[_0xd0a0('0x1f')](_0x23e9e3)[_0xd0a0('0x20')](function(_0x1d8b05){return _0x1d8b05;});}return null;};}function removeEntity(_0x234119,_0x3b33ec){return function(_0x1acd20){if(_0x1acd20){return _0x1acd20[_0xd0a0('0x21')]()[_0xd0a0('0x20')](function(){_0x234119[_0xd0a0('0x14')](0xcc)[_0xd0a0('0x15')]();});}};}function handleEntityNotFound(_0x6cf8f1,_0x2fac9c){return function(_0x491958){if(!_0x491958){_0x6cf8f1[_0xd0a0('0x13')](0x194);}return _0x491958;};}function handleError(_0x4fb34e,_0x134296){_0x134296=_0x134296||0x1f4;return function(_0x11421d){logger[_0xd0a0('0x22')](_0x11421d['stack']);if(_0x11421d[_0xd0a0('0x23')]){delete _0x11421d[_0xd0a0('0x23')];}_0x4fb34e['status'](_0x134296)[_0xd0a0('0x24')](_0x11421d);};}exports[_0xd0a0('0x25')]=function(_0x5b093f,_0x32ce9f){var _0x38d0e4={},_0x299e13={},_0x6c4983={'count':0x0,'rows':[]};var _0x5d06c8=_[_0xd0a0('0x26')](db['JscriptySessionReport'][_0xd0a0('0x27')],function(_0x39429f){return{'name':_0x39429f['fieldName'],'type':_0x39429f[_0xd0a0('0x28')][_0xd0a0('0x29')]};});_0x299e13['model']=_[_0xd0a0('0x26')](_0x5d06c8,'name');_0x299e13[_0xd0a0('0x2a')]=_[_0xd0a0('0x2b')](_0x5b093f[_0xd0a0('0x2a')]);_0x299e13[_0xd0a0('0x2c')]=_['intersection'](_0x299e13[_0xd0a0('0x2d')],_0x299e13['query']);_0x38d0e4[_0xd0a0('0x2e')]=_[_0xd0a0('0x2f')](_0x299e13[_0xd0a0('0x2d')],qs[_0xd0a0('0x30')](_0x5b093f[_0xd0a0('0x2a')][_0xd0a0('0x30')]));_0x38d0e4['attributes']=_0x38d0e4['attributes']['length']?_0x38d0e4[_0xd0a0('0x2e')]:_0x299e13[_0xd0a0('0x2d')];if(!_0x5b093f[_0xd0a0('0x2a')][_0xd0a0('0x31')](_0xd0a0('0x32'))){_0x38d0e4[_0xd0a0('0x18')]=qs[_0xd0a0('0x18')](_0x5b093f[_0xd0a0('0x2a')][_0xd0a0('0x18')]);_0x38d0e4['offset']=qs[_0xd0a0('0x1a')](_0x5b093f[_0xd0a0('0x2a')][_0xd0a0('0x1a')]);}_0x38d0e4[_0xd0a0('0x33')]=qs[_0xd0a0('0x34')](_0x5b093f[_0xd0a0('0x2a')][_0xd0a0('0x34')]);_0x38d0e4[_0xd0a0('0x35')]=qs[_0xd0a0('0x2c')](_[_0xd0a0('0x36')](_0x5b093f['query'],_0x299e13[_0xd0a0('0x2c')]),_0x5d06c8);if(_0x5b093f[_0xd0a0('0x2a')][_0xd0a0('0x37')]){_0x38d0e4[_0xd0a0('0x35')]=_[_0xd0a0('0x38')](_0x38d0e4[_0xd0a0('0x35')],{'$or':_[_0xd0a0('0x26')](_0x5d06c8,function(_0x3d3a28){if(_0x3d3a28[_0xd0a0('0x28')]!==_0xd0a0('0x39')){var _0x543c33={};_0x543c33[_0x3d3a28[_0xd0a0('0x23')]]={'$like':'%'+_0x5b093f[_0xd0a0('0x2a')][_0xd0a0('0x37')]+'%'};return _0x543c33;}})});}_0x38d0e4=_[_0xd0a0('0x38')]({},_0x38d0e4,_0x5b093f[_0xd0a0('0x3a')]);var _0x26a055={'where':_0x38d0e4[_0xd0a0('0x35')]};return db[_0xd0a0('0x3b')][_0xd0a0('0x19')](_0x26a055)['then'](function(_0x32464a){_0x6c4983['count']=_0x32464a;if(_0x5b093f[_0xd0a0('0x2a')]['includeAll']){_0x38d0e4[_0xd0a0('0x3c')]=[{'all':!![]}];}return db[_0xd0a0('0x3b')][_0xd0a0('0x3d')](_0x38d0e4);})[_0xd0a0('0x20')](function(_0x457504){_0x6c4983[_0xd0a0('0x3e')]=_0x457504;return _0x6c4983;})[_0xd0a0('0x20')](respondWithFilteredResult(_0x32ce9f,_0x38d0e4))['catch'](handleError(_0x32ce9f,null));};exports[_0xd0a0('0x3f')]=function(_0x52cc9e,_0x4d9a62){var _0x11d37b={'raw':!![],'where':{'id':_0x52cc9e[_0xd0a0('0x40')]['id']}},_0x595acc={};_0x595acc[_0xd0a0('0x2d')]=_[_0xd0a0('0x2b')](db[_0xd0a0('0x3b')][_0xd0a0('0x27')]);_0x595acc[_0xd0a0('0x2a')]=_[_0xd0a0('0x2b')](_0x52cc9e[_0xd0a0('0x2a')]);_0x595acc[_0xd0a0('0x2c')]=_['intersection'](_0x595acc['model'],_0x595acc[_0xd0a0('0x2a')]);_0x11d37b[_0xd0a0('0x2e')]=_['intersection'](_0x595acc[_0xd0a0('0x2d')],qs['fields'](_0x52cc9e['query'][_0xd0a0('0x30')]));_0x11d37b['attributes']=_0x11d37b[_0xd0a0('0x2e')][_0xd0a0('0x41')]?_0x11d37b[_0xd0a0('0x2e')]:_0x595acc[_0xd0a0('0x2d')];if(_0x52cc9e[_0xd0a0('0x2a')]['includeAll']){_0x11d37b['include']=[{'all':!![]}];}_0x11d37b=_[_0xd0a0('0x38')]({},_0x11d37b,_0x52cc9e[_0xd0a0('0x3a')]);return db['JscriptySessionReport'][_0xd0a0('0x42')](_0x11d37b)[_0xd0a0('0x20')](handleEntityNotFound(_0x4d9a62,null))[_0xd0a0('0x20')](respondWithResult(_0x4d9a62,null))[_0xd0a0('0x43')](handleError(_0x4d9a62,null));};exports[_0xd0a0('0x44')]=function(_0x144552,_0x37f06b){return db[_0xd0a0('0x3b')]['create'](_0x144552[_0xd0a0('0x45')],{})[_0xd0a0('0x20')](respondWithResult(_0x37f06b,0xc9))['catch'](handleError(_0x37f06b,null));};exports[_0xd0a0('0x1f')]=function(_0x27754d,_0x6a30e4){if(_0x27754d[_0xd0a0('0x45')]['id']){delete _0x27754d[_0xd0a0('0x45')]['id'];}return db[_0xd0a0('0x3b')][_0xd0a0('0x42')]({'where':{'id':_0x27754d['params']['id']}})['then'](handleEntityNotFound(_0x6a30e4,null))['then'](saveUpdates(_0x27754d[_0xd0a0('0x45')],null))[_0xd0a0('0x20')](respondWithResult(_0x6a30e4,null))[_0xd0a0('0x43')](handleError(_0x6a30e4,null));};exports[_0xd0a0('0x21')]=function(_0x4117a3,_0x58fb62){return db['JscriptySessionReport'][_0xd0a0('0x42')]({'where':{'id':_0x4117a3[_0xd0a0('0x40')]['id']}})[_0xd0a0('0x20')](handleEntityNotFound(_0x58fb62,null))[_0xd0a0('0x20')](removeEntity(_0x58fb62,null))[_0xd0a0('0x43')](handleError(_0x58fb62,null));};exports[_0xd0a0('0x46')]=function(_0x404dbc,_0x271214){return db[_0xd0a0('0x3b')][_0xd0a0('0x46')]()['then'](respondWithResult(_0x271214,null))[_0xd0a0('0x43')](handleError(_0x271214,null));};exports[_0xd0a0('0x47')]=function(_0xfcb3ec,_0x591266,_0x477e9f){var _0x23b92b={'raw':!![],'where':{}};var _0x1e6581={};var _0x5c3caf={'count':0x0,'rows':[]};return db[_0xd0a0('0x3b')][_0xd0a0('0x48')]({'where':{'id':_0xfcb3ec[_0xd0a0('0x40')]['id']}})[_0xd0a0('0x20')](handleEntityNotFound(_0x591266,null))[_0xd0a0('0x20')](function(_0x55feea){if(_0x55feea){_0x1e6581[_0xd0a0('0x2d')]=_['keys'](db[_0xd0a0('0x49')][_0xd0a0('0x27')]);_0x1e6581[_0xd0a0('0x2a')]=_[_0xd0a0('0x2b')](_0xfcb3ec[_0xd0a0('0x2a')]);_0x1e6581['filters']=_['intersection'](_0x1e6581[_0xd0a0('0x2d')],_0x1e6581['query']);_0x23b92b[_0xd0a0('0x2e')]=_[_0xd0a0('0x2f')](_0x1e6581[_0xd0a0('0x2d')],qs['fields'](_0xfcb3ec['query'][_0xd0a0('0x30')]));_0x23b92b[_0xd0a0('0x2e')]=_0x23b92b[_0xd0a0('0x2e')][_0xd0a0('0x41')]?_0x23b92b[_0xd0a0('0x2e')]:_0x1e6581['model'];if(!_0xfcb3ec[_0xd0a0('0x2a')][_0xd0a0('0x31')]('nolimit')){_0x23b92b[_0xd0a0('0x18')]=qs[_0xd0a0('0x18')](_0xfcb3ec[_0xd0a0('0x2a')][_0xd0a0('0x18')]);_0x23b92b[_0xd0a0('0x1a')]=qs[_0xd0a0('0x1a')](_0xfcb3ec[_0xd0a0('0x2a')]['offset']);}_0x23b92b['order']=qs[_0xd0a0('0x34')](_0xfcb3ec[_0xd0a0('0x2a')][_0xd0a0('0x34')]);_0x23b92b['where']=qs['filters'](_[_0xd0a0('0x36')](_0xfcb3ec['query'],_0x1e6581[_0xd0a0('0x2c')]));_0x23b92b['where'][_0xd0a0('0x4a')]=_0x55feea['id'];if(_0xfcb3ec[_0xd0a0('0x2a')][_0xd0a0('0x37')]){_0x23b92b[_0xd0a0('0x35')]=_[_0xd0a0('0x38')](_0x23b92b[_0xd0a0('0x35')],{'$or':_[_0xd0a0('0x26')](_0x23b92b[_0xd0a0('0x2e')],function(_0x392bb1){var _0x20d3c6={};_0x20d3c6[_0x392bb1]={'$like':'%'+_0xfcb3ec['query']['filter']+'%'};return _0x20d3c6;})});}_0x23b92b=_['merge']({},_0x23b92b,_0xfcb3ec[_0xd0a0('0x3a')]);return db[_0xd0a0('0x49')][_0xd0a0('0x19')]({'where':_0x23b92b[_0xd0a0('0x35')]})['then'](function(_0x10ffe1){_0x5c3caf[_0xd0a0('0x19')]=_0x10ffe1;if(_0xfcb3ec[_0xd0a0('0x2a')]['includeAll']){_0x23b92b[_0xd0a0('0x3c')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd0a0('0x3d')](_0x23b92b);})[_0xd0a0('0x20')](function(_0x20b6c8){_0x5c3caf[_0xd0a0('0x3e')]=_0x20b6c8;return _0x5c3caf;});}})[_0xd0a0('0x20')](respondWithFilteredResult(_0x591266,_0x23b92b))[_0xd0a0('0x43')](handleError(_0x591266,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 23fda89..fb8c85b 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 _0x3699=['moment','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x21481c,_0x1b51ba){var _0x5dd77a=function(_0x4ee13c){while(--_0x4ee13c){_0x21481c['push'](_0x21481c['shift']());}};_0x5dd77a(++_0x1b51ba);}(_0x3699,0x105));var _0x9369=function(_0x433b1b,_0x1391bb){_0x433b1b=_0x433b1b-0x0;var _0x77bc12=_0x3699[_0x433b1b];return _0x77bc12;};'use strict';var _=require(_0x9369('0x0'));var util=require(_0x9369('0x1'));var logger=require(_0x9369('0x2'))('api');var moment=require(_0x9369('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9369('0x4'));var rimraf=require(_0x9369('0x5'));var config=require(_0x9369('0x6'));var attributes=require(_0x9369('0x7'));module[_0x9369('0x8')]=function(_0x16c208,_0xbbe85){return _0x16c208[_0x9369('0x9')](_0x9369('0xa'),attributes,{'tableName':_0x9369('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb49=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./jscriptySessionReport.attributes','define','lodash','util'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xbb49,0x1de));var _0x9bb4=function(_0x140230,_0x495b63){_0x140230=_0x140230-0x0;var _0x4c39e9=_0xbb49[_0x140230];return _0x4c39e9;};'use strict';var _=require(_0x9bb4('0x0'));var util=require(_0x9bb4('0x1'));var logger=require(_0x9bb4('0x2'))(_0x9bb4('0x3'));var moment=require(_0x9bb4('0x4'));var BPromise=require(_0x9bb4('0x5'));var rp=require(_0x9bb4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9bb4('0x7'));var attributes=require(_0x9bb4('0x8'));module['exports']=function(_0x2845ca,_0x2e0f14){return _0x2845ca[_0x9bb4('0x9')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 269eb03..f197c1d 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 _0xd3a8=['code','error','message','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0xa58ca7,_0x27776b){var _0x1083ca=function(_0x208b66){while(--_0x208b66){_0xa58ca7['push'](_0xa58ca7['shift']());}};_0x1083ca(++_0x27776b);}(_0xd3a8,0x135));var _0x8d3a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xd3a8[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x8d3a('0x0'));var util=require('util');var moment=require(_0x8d3a('0x1'));var BPromise=require(_0x8d3a('0x2'));var rs=require(_0x8d3a('0x3'));var fs=require('fs');var Redis=require(_0x8d3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d3a('0x5'));var logger=require(_0x8d3a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8d3a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x588567,_0x179258,_0x19cd3e){return new BPromise(function(_0x28b131,_0x40bc92){return client[_0x8d3a('0x8')](_0x588567,_0x19cd3e)[_0x8d3a('0x9')](function(_0x3cd3e3){logger[_0x8d3a('0xa')](_0x8d3a('0xb'),_0x179258,_0x8d3a('0xc'));logger[_0x8d3a('0xd')](_0x8d3a('0xe'),_0x179258,_0x8d3a('0xc'),JSON['stringify'](_0x3cd3e3));if(_0x3cd3e3['error']){if(_0x3cd3e3['error'][_0x8d3a('0xf')]===0x1f4){logger[_0x8d3a('0x10')](_0x8d3a('0xb'),_0x179258,_0x3cd3e3[_0x8d3a('0x10')][_0x8d3a('0x11')]);return _0x40bc92(_0x3cd3e3[_0x8d3a('0x10')]['message']);}logger[_0x8d3a('0x10')](_0x8d3a('0xb'),_0x179258,_0x3cd3e3['error']['message']);return _0x28b131(_0x3cd3e3[_0x8d3a('0x10')]['message']);}else{logger[_0x8d3a('0xa')](_0x8d3a('0xb'),_0x179258,_0x8d3a('0xc'));_0x28b131(_0x3cd3e3['result'][_0x8d3a('0x11')]);}})['catch'](function(_0x10d8af){logger['error'](_0x8d3a('0xb'),_0x179258,_0x10d8af);_0x40bc92(_0x10d8af);});});} \ No newline at end of file +var _0xfb9a=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3a9d00,_0xdc8073){var _0x470f07=function(_0x40c371){while(--_0x40c371){_0x3a9d00['push'](_0x3a9d00['shift']());}};_0x470f07(++_0xdc8073);}(_0xfb9a,0x1f4));var _0xafb9=function(_0x1622d5,_0x3ef1d0){_0x1622d5=_0x1622d5-0x0;var _0x5c58b2=_0xfb9a[_0x1622d5];return _0x5c58b2;};'use strict';var _=require(_0xafb9('0x0'));var util=require(_0xafb9('0x1'));var moment=require(_0xafb9('0x2'));var BPromise=require(_0xafb9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafb9('0x4'));var db=require(_0xafb9('0x5'))['db'];var utils=require(_0xafb9('0x6'));var logger=require(_0xafb9('0x7'))(_0xafb9('0x8'));var config=require('../../config/environment');var jayson=require(_0xafb9('0x9'));var client=jayson[_0xafb9('0xa')][_0xafb9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b6048,_0x4fde55,_0x5708c0){return new BPromise(function(_0x808783,_0x4716ac){return client[_0xafb9('0xc')](_0x2b6048,_0x5708c0)[_0xafb9('0xd')](function(_0x2e94a8){logger[_0xafb9('0xe')](_0xafb9('0xf'),_0x4fde55,_0xafb9('0x10'));logger[_0xafb9('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4fde55,_0xafb9('0x10'),JSON['stringify'](_0x2e94a8));if(_0x2e94a8['error']){if(_0x2e94a8[_0xafb9('0x12')][_0xafb9('0x13')]===0x1f4){logger['error'](_0xafb9('0xf'),_0x4fde55,_0x2e94a8[_0xafb9('0x12')][_0xafb9('0x14')]);return _0x4716ac(_0x2e94a8['error'][_0xafb9('0x14')]);}logger[_0xafb9('0x12')](_0xafb9('0xf'),_0x4fde55,_0x2e94a8[_0xafb9('0x12')][_0xafb9('0x14')]);return _0x808783(_0x2e94a8[_0xafb9('0x12')]['message']);}else{logger[_0xafb9('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x4fde55,_0xafb9('0x10'));_0x808783(_0x2e94a8[_0xafb9('0x15')][_0xafb9('0x14')]);}})['catch'](function(_0x5ede7c){logger[_0xafb9('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4fde55,_0x5ede7c);_0x4716ac(_0x5ede7c);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 9b8e8d7..e4f9f3c 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 _0x66e3=['../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3367cc,_0x340e04){var _0x14ac39=function(_0x485ed8){while(--_0x485ed8){_0x3367cc['push'](_0x3367cc['shift']());}};_0x14ac39(++_0x340e04);}(_0x66e3,0x190));var _0x366e=function(_0x3082ca,_0x207702){_0x3082ca=_0x3082ca-0x0;var _0x5e2b63=_0x66e3[_0x3082ca];return _0x5e2b63;};'use strict';var multer=require('multer');var util=require(_0x366e('0x0'));var path=require('path');var timeout=require(_0x366e('0x1'));var express=require('express');var router=express[_0x366e('0x2')]();var fs_extra=require(_0x366e('0x3'));var auth=require(_0x366e('0x4'));var interaction=require(_0x366e('0x5'));var config=require(_0x366e('0x6'));var controller=require(_0x366e('0x7'));router[_0x366e('0x8')]('/',controller[_0x366e('0x9')]);router[_0x366e('0xa')](_0x366e('0xb'),auth[_0x366e('0xc')](),controller['update']);module[_0x366e('0xd')]=router; \ No newline at end of file +var _0x8b88=['index','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x8b88,0x135));var _0x88b8=function(_0x49d520,_0x5c4cc5){_0x49d520=_0x49d520-0x0;var _0x5d7404=_0x8b88[_0x49d520];return _0x5d7404;};'use strict';var multer=require(_0x88b8('0x0'));var util=require(_0x88b8('0x1'));var path=require(_0x88b8('0x2'));var timeout=require(_0x88b8('0x3'));var express=require(_0x88b8('0x4'));var router=express[_0x88b8('0x5')]();var fs_extra=require(_0x88b8('0x6'));var auth=require(_0x88b8('0x7'));var interaction=require(_0x88b8('0x8'));var config=require('../../config/environment');var controller=require(_0x88b8('0x9'));router[_0x88b8('0xa')]('/',controller[_0x88b8('0xb')]);router[_0x88b8('0xc')]('/:id',auth[_0x88b8('0xd')](),controller[_0x88b8('0xe')]);module[_0x88b8('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 423d5ab..e76a341 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 _0x187d=['TEXT','STRING','INTEGER','sequelize'];(function(_0x23ae9a,_0x591843){var _0x4ca542=function(_0x52f809){while(--_0x52f809){_0x23ae9a['push'](_0x23ae9a['shift']());}};_0x4ca542(++_0x591843);}(_0x187d,0x93));var _0xd187=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x187d[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0xd187('0x0'));module['exports']={'license':{'type':Sequelize[_0xd187('0x1')]},'data1':{'type':Sequelize[_0xd187('0x2')]},'data2':{'type':Sequelize[_0xd187('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd187('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x31f0=['TEXT','STRING','INTEGER','sequelize'];(function(_0x109b5b,_0x4a6a4f){var _0x18c24d=function(_0x126b4b){while(--_0x126b4b){_0x109b5b['push'](_0x109b5b['shift']());}};_0x18c24d(++_0x4a6a4f);}(_0x31f0,0xb7));var _0x031f=function(_0x6b3bf1,_0x5530fd){_0x6b3bf1=_0x6b3bf1-0x0;var _0x47947c=_0x31f0[_0x6b3bf1];return _0x47947c;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'license':{'type':Sequelize[_0x031f('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x031f('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x031f('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 28fcd75..d7a0b9a 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 _0xdf55=['model','License','query','keys','intersection','attributes','fields','length','merge','getLicense','catch','body','params','get','key','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0xdf55,0x83));var _0x5df5=function(_0xc67084,_0x3e2efc){_0xc67084=_0xc67084-0x0;var _0x4d06c6=_0xdf55[_0xc67084];return _0x4d06c6;};'use strict';var emlformat=require(_0x5df5('0x0'));var rimraf=require(_0x5df5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5df5('0x2'));var rp=require(_0x5df5('0x3'));var moment=require('moment');var BPromise=require(_0x5df5('0x4'));var Mustache=require(_0x5df5('0x5'));var util=require(_0x5df5('0x6'));var path=require('path');var sox=require(_0x5df5('0x7'));var csv=require(_0x5df5('0x8'));var ejs=require(_0x5df5('0x9'));var fs=require('fs');var fs_extra=require(_0x5df5('0xa'));var _=require(_0x5df5('0xb'));var squel=require(_0x5df5('0xc'));var crypto=require(_0x5df5('0xd'));var jsforce=require(_0x5df5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5df5('0x8'));var querystring=require(_0x5df5('0xf'));var Papa=require(_0x5df5('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5df5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5df5('0x12'));var logger=require(_0x5df5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5df5('0x14'));var licenseUtil=require(_0x5df5('0x15'));var db=require(_0x5df5('0x16'))['db'];function respondWithStatusCode(_0x4c3d6f,_0xe8bcd8){_0xe8bcd8=_0xe8bcd8||0xcc;return function(_0xb4a4fe){if(_0xb4a4fe){return _0x4c3d6f[_0x5df5('0x17')](_0xe8bcd8);}return _0x4c3d6f[_0x5df5('0x18')](_0xe8bcd8)[_0x5df5('0x19')]();};}function respondWithResult(_0x956317,_0x555d3f){_0x555d3f=_0x555d3f||0xc8;return function(_0x30fd32){if(_0x30fd32){return _0x956317['status'](_0x555d3f)[_0x5df5('0x1a')](_0x30fd32);}};}function respondWithFilteredResult(_0x33f818,_0x5b0ad9){return function(_0x3657c8){if(_0x3657c8){var _0x282d53=typeof _0x5b0ad9['offset']===_0x5df5('0x1b')&&typeof _0x5b0ad9[_0x5df5('0x1c')]==='undefined';var _0x9a52c9=_0x3657c8[_0x5df5('0x1d')];var _0xb7e1c2=_0x282d53?0x0:_0x5b0ad9[_0x5df5('0x1e')];var _0x215d59=_0x282d53?_0x3657c8['count']:_0x5b0ad9['offset']+_0x5b0ad9[_0x5df5('0x1c')];var _0x5d8dfd;if(_0x215d59>=_0x9a52c9){_0x215d59=_0x9a52c9;_0x5d8dfd=0xc8;}else{_0x5d8dfd=0xce;}_0x33f818[_0x5df5('0x18')](_0x5d8dfd);return _0x33f818[_0x5df5('0x1f')](_0x5df5('0x20'),_0xb7e1c2+'-'+_0x215d59+'/'+_0x9a52c9)[_0x5df5('0x1a')](_0x3657c8);}return null;};}function patchUpdates(_0x1deae7){return function(_0x4b4b57){try{jsonpatch[_0x5df5('0x21')](_0x4b4b57,_0x1deae7,!![]);}catch(_0x39d8a1){return BPromise[_0x5df5('0x22')](_0x39d8a1);}return _0x4b4b57[_0x5df5('0x23')]();};}function saveUpdates(_0x28efc8,_0x382999){return function(_0x59ff67){if(_0x59ff67){return _0x59ff67[_0x5df5('0x24')](_0x28efc8)[_0x5df5('0x25')](function(_0x8742a7){return _0x8742a7;});}return null;};}function removeEntity(_0x446bba,_0x5ca542){return function(_0x4358ba){if(_0x4358ba){return _0x4358ba[_0x5df5('0x26')]()[_0x5df5('0x25')](function(){_0x446bba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x532923,_0x357fb0){return function(_0x3ff82e){if(!_0x3ff82e){_0x532923[_0x5df5('0x17')](0x194);}return _0x3ff82e;};}function handleError(_0xa7f4b3,_0x1baf52){_0x1baf52=_0x1baf52||0x1f4;return function(_0x1fd83c){logger[_0x5df5('0x27')](_0x1fd83c[_0x5df5('0x28')]);if(_0x1fd83c['name']){delete _0x1fd83c[_0x5df5('0x29')];}_0xa7f4b3['status'](_0x1baf52)[_0x5df5('0x2a')](_0x1fd83c);};}var utilLicense=require(_0x5df5('0x15'));exports['index']=function(_0x3854d0,_0x4945c6){var _0xd2b213={'raw':!![],'where':{'id':0x1}},_0x4cccf1={};_0x4cccf1[_0x5df5('0x2b')]=_['keys'](db[_0x5df5('0x2c')]['rawAttributes']);_0x4cccf1[_0x5df5('0x2d')]=_[_0x5df5('0x2e')](_0x3854d0[_0x5df5('0x2d')]);_0x4cccf1['filters']=_[_0x5df5('0x2f')](_0x4cccf1[_0x5df5('0x2b')],_0x4cccf1[_0x5df5('0x2d')]);_0xd2b213[_0x5df5('0x30')]=_[_0x5df5('0x2f')](_0x4cccf1[_0x5df5('0x2b')],qs[_0x5df5('0x31')](_0x3854d0['query']['fields']));_0xd2b213[_0x5df5('0x30')]=_0xd2b213[_0x5df5('0x30')][_0x5df5('0x32')]?_0xd2b213[_0x5df5('0x30')]:_0x4cccf1[_0x5df5('0x2b')];_0xd2b213=_[_0x5df5('0x33')]({},_0xd2b213,_0x3854d0['options']);return utilLicense[_0x5df5('0x34')](_0xd2b213)[_0x5df5('0x25')](respondWithResult(_0x4945c6,null))[_0x5df5('0x35')](handleError(_0x4945c6,null));};exports[_0x5df5('0x24')]=function(_0x5e8d50,_0x14ee6b){if(_0x5e8d50['body']['id']){delete _0x5e8d50[_0x5df5('0x36')]['id'];}return db[_0x5df5('0x2c')]['find']({'where':{'id':_0x5e8d50[_0x5df5('0x37')]['id']}})['then'](handleEntityNotFound(_0x14ee6b,null))[_0x5df5('0x25')](function(_0x44a6d9){var _0x4697c2=_0x44a6d9[_0x5df5('0x38')]({'plain':!![]});return utilLicense['checkLicense'](_0x4697c2,_0x5e8d50[_0x5df5('0x36')][_0x5df5('0x39')]);})[_0x5df5('0x25')](function(_0x25b6ad){if(!_0x25b6ad['demo']){return saveUpdates(_0x5e8d50[_0x5df5('0x36')],null);}return _0x25b6ad;})[_0x5df5('0x25')](respondWithResult(_0x14ee6b,null))[_0x5df5('0x35')](handleError(_0x14ee6b,null));}; \ No newline at end of file +var _0xc0d7=['fields','attributes','merge','options','catch','body','find','params','get','key','demo','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','model','keys','License','rawAttributes','query','intersection'];(function(_0x5a264b,_0x1b2769){var _0xbb0c97=function(_0x574f52){while(--_0x574f52){_0x5a264b['push'](_0x5a264b['shift']());}};_0xbb0c97(++_0x1b2769);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x1f755f,_0x491226){_0x1f755f=_0x1f755f-0x0;var _0x291574=_0xc0d7[_0x1f755f];return _0x291574;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7c0d('0x0'));var rp=require(_0x7c0d('0x1'));var moment=require(_0x7c0d('0x2'));var BPromise=require(_0x7c0d('0x3'));var Mustache=require(_0x7c0d('0x4'));var util=require(_0x7c0d('0x5'));var path=require(_0x7c0d('0x6'));var sox=require(_0x7c0d('0x7'));var csv=require(_0x7c0d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c0d('0x9'));var _=require(_0x7c0d('0xa'));var squel=require(_0x7c0d('0xb'));var crypto=require(_0x7c0d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7c0d('0xd'));var toCsv=require(_0x7c0d('0x8'));var querystring=require(_0x7c0d('0xe'));var Papa=require(_0x7c0d('0xf'));var Redis=require('ioredis');var authService=require(_0x7c0d('0x10'));var qs=require(_0x7c0d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c0d('0x12'))(_0x7c0d('0x13'));var utils=require('../../config/utils');var config=require(_0x7c0d('0x14'));var licenseUtil=require(_0x7c0d('0x15'));var db=require(_0x7c0d('0x16'))['db'];function respondWithStatusCode(_0x198dde,_0x41236d){_0x41236d=_0x41236d||0xcc;return function(_0x34dccf){if(_0x34dccf){return _0x198dde['sendStatus'](_0x41236d);}return _0x198dde[_0x7c0d('0x17')](_0x41236d)[_0x7c0d('0x18')]();};}function respondWithResult(_0x2ee593,_0x25c4a8){_0x25c4a8=_0x25c4a8||0xc8;return function(_0x33dd94){if(_0x33dd94){return _0x2ee593[_0x7c0d('0x17')](_0x25c4a8)[_0x7c0d('0x19')](_0x33dd94);}};}function respondWithFilteredResult(_0x13f301,_0x4a5fb4){return function(_0x340937){if(_0x340937){var _0x4e9850=typeof _0x4a5fb4[_0x7c0d('0x1a')]==='undefined'&&typeof _0x4a5fb4[_0x7c0d('0x1b')]===_0x7c0d('0x1c');var _0x478100=_0x340937[_0x7c0d('0x1d')];var _0x2841e1=_0x4e9850?0x0:_0x4a5fb4[_0x7c0d('0x1a')];var _0x1418ee=_0x4e9850?_0x340937[_0x7c0d('0x1d')]:_0x4a5fb4[_0x7c0d('0x1a')]+_0x4a5fb4[_0x7c0d('0x1b')];var _0x111dbe;if(_0x1418ee>=_0x478100){_0x1418ee=_0x478100;_0x111dbe=0xc8;}else{_0x111dbe=0xce;}_0x13f301[_0x7c0d('0x17')](_0x111dbe);return _0x13f301[_0x7c0d('0x1e')](_0x7c0d('0x1f'),_0x2841e1+'-'+_0x1418ee+'/'+_0x478100)[_0x7c0d('0x19')](_0x340937);}return null;};}function patchUpdates(_0x12e19a){return function(_0x2f0ac0){try{jsonpatch[_0x7c0d('0x20')](_0x2f0ac0,_0x12e19a,!![]);}catch(_0x1308c6){return BPromise['reject'](_0x1308c6);}return _0x2f0ac0['save']();};}function saveUpdates(_0x5dae80,_0x54b14f){return function(_0x5872fe){if(_0x5872fe){return _0x5872fe[_0x7c0d('0x21')](_0x5dae80)[_0x7c0d('0x22')](function(_0x1c7b84){return _0x1c7b84;});}return null;};}function removeEntity(_0x2f657e,_0x1ef191){return function(_0x2a92ce){if(_0x2a92ce){return _0x2a92ce[_0x7c0d('0x23')]()['then'](function(){_0x2f657e[_0x7c0d('0x17')](0xcc)[_0x7c0d('0x18')]();});}};}function handleEntityNotFound(_0x5aa006,_0x540abc){return function(_0x357cca){if(!_0x357cca){_0x5aa006['sendStatus'](0x194);}return _0x357cca;};}function handleError(_0x236973,_0x305a3a){_0x305a3a=_0x305a3a||0x1f4;return function(_0x43ba3b){logger[_0x7c0d('0x24')](_0x43ba3b[_0x7c0d('0x25')]);if(_0x43ba3b['name']){delete _0x43ba3b[_0x7c0d('0x26')];}_0x236973[_0x7c0d('0x17')](_0x305a3a)[_0x7c0d('0x27')](_0x43ba3b);};}var utilLicense=require(_0x7c0d('0x15'));exports[_0x7c0d('0x28')]=function(_0x4aea76,_0x2b261){var _0x553627={'raw':!![],'where':{'id':0x1}},_0x3a8947={};_0x3a8947[_0x7c0d('0x29')]=_[_0x7c0d('0x2a')](db[_0x7c0d('0x2b')][_0x7c0d('0x2c')]);_0x3a8947[_0x7c0d('0x2d')]=_['keys'](_0x4aea76[_0x7c0d('0x2d')]);_0x3a8947['filters']=_[_0x7c0d('0x2e')](_0x3a8947[_0x7c0d('0x29')],_0x3a8947['query']);_0x553627['attributes']=_[_0x7c0d('0x2e')](_0x3a8947['model'],qs[_0x7c0d('0x2f')](_0x4aea76[_0x7c0d('0x2d')]['fields']));_0x553627['attributes']=_0x553627['attributes']['length']?_0x553627[_0x7c0d('0x30')]:_0x3a8947['model'];_0x553627=_[_0x7c0d('0x31')]({},_0x553627,_0x4aea76[_0x7c0d('0x32')]);return utilLicense['getLicense'](_0x553627)[_0x7c0d('0x22')](respondWithResult(_0x2b261,null))[_0x7c0d('0x33')](handleError(_0x2b261,null));};exports[_0x7c0d('0x21')]=function(_0x196803,_0x57638f){if(_0x196803[_0x7c0d('0x34')]['id']){delete _0x196803[_0x7c0d('0x34')]['id'];}return db[_0x7c0d('0x2b')][_0x7c0d('0x35')]({'where':{'id':_0x196803[_0x7c0d('0x36')]['id']}})[_0x7c0d('0x22')](handleEntityNotFound(_0x57638f,null))[_0x7c0d('0x22')](function(_0x150069){var _0x471ab1=_0x150069[_0x7c0d('0x37')]({'plain':!![]});return utilLicense['checkLicense'](_0x471ab1,_0x196803[_0x7c0d('0x34')][_0x7c0d('0x38')]);})['then'](function(_0x3ff97b){if(!_0x3ff97b[_0x7c0d('0x39')]){return saveUpdates(_0x196803[_0x7c0d('0x34')],null);}return _0x3ff97b;})[_0x7c0d('0x22')](respondWithResult(_0x57638f,null))[_0x7c0d('0x33')](handleError(_0x57638f,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 3ffc8e7..6c1502e 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 _0xbda9=['path','rimraf','./license.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbda9,0x101));var _0x9bda=function(_0x315aca,_0x2d2896){_0x315aca=_0x315aca-0x0;var _0x4483b9=_0xbda9[_0x315aca];return _0x4483b9;};'use strict';var _=require(_0x9bda('0x0'));var util=require(_0x9bda('0x1'));var logger=require(_0x9bda('0x2'))(_0x9bda('0x3'));var moment=require(_0x9bda('0x4'));var BPromise=require(_0x9bda('0x5'));var rp=require(_0x9bda('0x6'));var fs=require('fs');var path=require(_0x9bda('0x7'));var rimraf=require(_0x9bda('0x8'));var config=require('../../config/environment');var attributes=require(_0x9bda('0x9'));module[_0x9bda('0xa')]=function(_0x26544e,_0x4d2979){return _0x26544e[_0x9bda('0xb')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa4b=['moment','bluebird','request-promise','path','../../config/environment','exports','define','License','license','lodash','util','../../config/logger','api'];(function(_0x4a9f85,_0xab7276){var _0x1b7850=function(_0x1c3aa9){while(--_0x1c3aa9){_0x4a9f85['push'](_0x4a9f85['shift']());}};_0x1b7850(++_0xab7276);}(_0xfa4b,0x175));var _0xbfa4=function(_0x2c4bb3,_0x1e2c8e){_0x2c4bb3=_0x2c4bb3-0x0;var _0x6d826e=_0xfa4b[_0x2c4bb3];return _0x6d826e;};'use strict';var _=require(_0xbfa4('0x0'));var util=require(_0xbfa4('0x1'));var logger=require(_0xbfa4('0x2'))(_0xbfa4('0x3'));var moment=require(_0xbfa4('0x4'));var BPromise=require(_0xbfa4('0x5'));var rp=require(_0xbfa4('0x6'));var fs=require('fs');var path=require(_0xbfa4('0x7'));var rimraf=require('rimraf');var config=require(_0xbfa4('0x8'));var attributes=require('./license.attributes');module[_0xbfa4('0x9')]=function(_0x59fe5e,_0x6c54a6){return _0x59fe5e[_0xbfa4('0xa')](_0xbfa4('0xb'),attributes,{'tableName':_0xbfa4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 44978f4..a5b8952 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 _0xba47=['License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xba47,0x1ac));var _0x7ba4=function(_0x5ec731,_0x163578){_0x5ec731=_0x5ec731-0x0;var _0x68fac4=_0xba47[_0x5ec731];return _0x68fac4;};'use strict';var _=require(_0x7ba4('0x0'));var util=require(_0x7ba4('0x1'));var moment=require(_0x7ba4('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ba4('0x3'));var fs=require('fs');var Redis=require(_0x7ba4('0x4'));var db=require(_0x7ba4('0x5'))['db'];var utils=require(_0x7ba4('0x6'));var logger=require('../../config/logger')(_0x7ba4('0x7'));var config=require(_0x7ba4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7ba4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11ea18,_0x932508,_0x227abe){return new BPromise(function(_0x7963fa,_0x380790){return client[_0x7ba4('0xa')](_0x11ea18,_0x227abe)[_0x7ba4('0xb')](function(_0x48456d){logger['info'](_0x7ba4('0xc'),_0x932508,'request\x20sent');logger[_0x7ba4('0xd')](_0x7ba4('0xe'),_0x932508,_0x7ba4('0xf'),JSON[_0x7ba4('0x10')](_0x48456d));if(_0x48456d['error']){if(_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x12')]===0x1f4){logger['error'](_0x7ba4('0xc'),_0x932508,_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x13')]);return _0x380790(_0x48456d['error'][_0x7ba4('0x13')]);}logger[_0x7ba4('0x11')](_0x7ba4('0xc'),_0x932508,_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x13')]);return _0x7963fa(_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x13')]);}else{logger[_0x7ba4('0x14')](_0x7ba4('0xc'),_0x932508,'request\x20sent');_0x7963fa(_0x48456d['result'][_0x7ba4('0x13')]);}})[_0x7ba4('0x15')](function(_0x53c7b2){logger[_0x7ba4('0x11')](_0x7ba4('0xc'),_0x932508,_0x53c7b2);_0x380790(_0x53c7b2);});});} \ No newline at end of file +var _0x0f69=['then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x26e69c,_0x10be2f){var _0x680fa2=function(_0x484860){while(--_0x484860){_0x26e69c['push'](_0x26e69c['shift']());}};_0x680fa2(++_0x10be2f);}(_0x0f69,0x173));var _0x90f6=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x0f69[_0x1762b4];return _0x29beda;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x90f6('0x0'));var BPromise=require('bluebird');var rs=require(_0x90f6('0x1'));var fs=require('fs');var Redis=require(_0x90f6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x90f6('0x3'));var logger=require(_0x90f6('0x4'))('rpc');var config=require(_0x90f6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x90f6('0x6')][_0x90f6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45657d,_0x3b35a0,_0x3bc2eb){return new BPromise(function(_0x42044f,_0x488b53){return client[_0x90f6('0x8')](_0x45657d,_0x3bc2eb)[_0x90f6('0x9')](function(_0x3c8148){logger[_0x90f6('0xa')](_0x90f6('0xb'),_0x3b35a0,_0x90f6('0xc'));logger['debug'](_0x90f6('0xd'),_0x3b35a0,_0x90f6('0xc'),JSON['stringify'](_0x3c8148));if(_0x3c8148[_0x90f6('0xe')]){if(_0x3c8148['error'][_0x90f6('0xf')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x3b35a0,_0x3c8148[_0x90f6('0xe')]['message']);return _0x488b53(_0x3c8148[_0x90f6('0xe')][_0x90f6('0x10')]);}logger[_0x90f6('0xe')](_0x90f6('0xb'),_0x3b35a0,_0x3c8148['error'][_0x90f6('0x10')]);return _0x42044f(_0x3c8148['error']['message']);}else{logger[_0x90f6('0xa')]('License,\x20%s,\x20%s',_0x3b35a0,_0x90f6('0xc'));_0x42044f(_0x3c8148[_0x90f6('0x11')][_0x90f6('0x10')]);}})[_0x90f6('0x12')](function(_0x3b4d5d){logger[_0x90f6('0xe')](_0x90f6('0xb'),_0x3b35a0,_0x3b4d5d);_0x488b53(_0x3b4d5d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index a32b44b..d321feb 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 _0x6a6e=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getSmtp','/:id/interactions','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','addImap','/:id/out_servers','addSmtp','/:id/applications','addApplications','addAgents','put','update','delete','removeAnswers','/:id/in_servers','removeImap','destroy','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller'];(function(_0x130ddf,_0x513e68){var _0x5939bc=function(_0x103e81){while(--_0x103e81){_0x130ddf['push'](_0x130ddf['shift']());}};_0x5939bc(++_0x513e68);}(_0x6a6e,0xd3));var _0xe6a6=function(_0x367816,_0x35633c){_0x367816=_0x367816-0x0;var _0x2cdde2=_0x6a6e[_0x367816];return _0x2cdde2;};'use strict';var multer=require('multer');var util=require(_0xe6a6('0x0'));var path=require(_0xe6a6('0x1'));var timeout=require(_0xe6a6('0x2'));var express=require(_0xe6a6('0x3'));var router=express[_0xe6a6('0x4')]();var fs_extra=require(_0xe6a6('0x5'));var auth=require(_0xe6a6('0x6'));var interaction=require(_0xe6a6('0x7'));var config=require('../../config/environment');var controller=require(_0xe6a6('0x8'));router[_0xe6a6('0x9')]('/',auth[_0xe6a6('0xa')](),controller[_0xe6a6('0xb')]);router[_0xe6a6('0x9')](_0xe6a6('0xc'),auth[_0xe6a6('0xa')](),controller[_0xe6a6('0xd')]);router[_0xe6a6('0x9')](_0xe6a6('0xe'),auth[_0xe6a6('0xa')](),controller[_0xe6a6('0xf')]);router['get'](_0xe6a6('0x10'),auth[_0xe6a6('0xa')](),controller[_0xe6a6('0x11')]);router[_0xe6a6('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xe6a6('0x12')]);router[_0xe6a6('0x9')]('/:id/in_servers',auth[_0xe6a6('0xa')](),controller['getImap']);router['get']('/:id/out_servers',auth['isAuthenticated'](),controller[_0xe6a6('0x13')]);router['get'](_0xe6a6('0x14'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xe6a6('0x9')]('/:id/applications',auth[_0xe6a6('0xa')](),controller[_0xe6a6('0x15')]);router['get'](_0xe6a6('0x16'),auth[_0xe6a6('0xa')](),controller[_0xe6a6('0x17')]);router['get']('/:id/verify',auth[_0xe6a6('0xa')](),controller[_0xe6a6('0x18')]);router[_0xe6a6('0x9')](_0xe6a6('0x19'),auth[_0xe6a6('0xa')](),controller[_0xe6a6('0x1a')]);router[_0xe6a6('0x1b')]('/:id/dispositions',auth[_0xe6a6('0xa')](),controller['addDisposition']);router[_0xe6a6('0x1b')](_0xe6a6('0x1c'),auth[_0xe6a6('0xa')](),controller[_0xe6a6('0x1d')]);router['post']('/',auth[_0xe6a6('0xa')](),controller['create']);router[_0xe6a6('0x1b')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xe6a6('0x1e')]);router[_0xe6a6('0x1b')](_0xe6a6('0x1f'),auth[_0xe6a6('0xa')](),controller[_0xe6a6('0x20')]);router[_0xe6a6('0x1b')](_0xe6a6('0x14'),auth[_0xe6a6('0xa')](),controller['addInteraction']);router[_0xe6a6('0x1b')](_0xe6a6('0x21'),auth[_0xe6a6('0xa')](),controller[_0xe6a6('0x22')]);router[_0xe6a6('0x1b')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0xe6a6('0x1b')](_0xe6a6('0x19'),auth[_0xe6a6('0xa')](),controller[_0xe6a6('0x23')]);router[_0xe6a6('0x24')](_0xe6a6('0xe'),auth['isAuthenticated'](),controller[_0xe6a6('0x25')]);router[_0xe6a6('0x26')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xe6a6('0x1c'),auth[_0xe6a6('0xa')](),controller[_0xe6a6('0x27')]);router['delete'](_0xe6a6('0x28'),auth[_0xe6a6('0xa')](),controller[_0xe6a6('0x29')]);router['delete']('/:id/out_servers',auth[_0xe6a6('0xa')](),controller['removeSmtp']);router[_0xe6a6('0x26')](_0xe6a6('0xe'),auth[_0xe6a6('0xa')](),controller[_0xe6a6('0x2a')]);router[_0xe6a6('0x26')](_0xe6a6('0x19'),auth[_0xe6a6('0xa')](),controller[_0xe6a6('0x2b')]);module['exports']=router; \ No newline at end of file +var _0xbc42=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getInteractions','/:id/applications','getApplications','/:id/messages','verifySmtp','getAgents','post','addDisposition','addAnswer','create','addImap','/:id/interactions','addInteraction','send','update','removeDispositions','delete','removeSmtp','/:id','destroy','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x7dcad0,_0x417cb2){var _0x40dc00=function(_0x51a9d3){while(--_0x51a9d3){_0x7dcad0['push'](_0x7dcad0['shift']());}};_0x40dc00(++_0x417cb2);}(_0xbc42,0xa2));var _0x2bc4=function(_0x51c828,_0x4085e4){_0x51c828=_0x51c828-0x0;var _0x1d6970=_0xbc42[_0x51c828];return _0x1d6970;};'use strict';var multer=require('multer');var util=require(_0x2bc4('0x0'));var path=require(_0x2bc4('0x1'));var timeout=require(_0x2bc4('0x2'));var express=require(_0x2bc4('0x3'));var router=express[_0x2bc4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2bc4('0x5'));var interaction=require(_0x2bc4('0x6'));var config=require(_0x2bc4('0x7'));var controller=require('./mailAccount.controller');router[_0x2bc4('0x8')]('/',auth[_0x2bc4('0x9')](),controller[_0x2bc4('0xa')]);router[_0x2bc4('0x8')](_0x2bc4('0xb'),auth[_0x2bc4('0x9')](),controller['describe']);router[_0x2bc4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2bc4('0xc')]);router['get'](_0x2bc4('0xd'),auth['isAuthenticated'](),controller[_0x2bc4('0xe')]);router[_0x2bc4('0x8')](_0x2bc4('0xf'),auth['isAuthenticated'](),controller[_0x2bc4('0x10')]);router['get'](_0x2bc4('0x11'),auth['isAuthenticated'](),controller['getImap']);router[_0x2bc4('0x8')](_0x2bc4('0x12'),auth[_0x2bc4('0x9')](),controller['getSmtp']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x2bc4('0x13')]);router['get'](_0x2bc4('0x14'),auth[_0x2bc4('0x9')](),controller[_0x2bc4('0x15')]);router['get'](_0x2bc4('0x16'),auth[_0x2bc4('0x9')](),controller['getMessages']);router['get']('/:id/verify',auth[_0x2bc4('0x9')](),controller[_0x2bc4('0x17')]);router[_0x2bc4('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x2bc4('0x18')]);router[_0x2bc4('0x19')](_0x2bc4('0xd'),auth[_0x2bc4('0x9')](),controller[_0x2bc4('0x1a')]);router[_0x2bc4('0x19')](_0x2bc4('0xf'),auth[_0x2bc4('0x9')](),controller[_0x2bc4('0x1b')]);router[_0x2bc4('0x19')]('/',auth[_0x2bc4('0x9')](),controller[_0x2bc4('0x1c')]);router[_0x2bc4('0x19')](_0x2bc4('0x11'),auth['isAuthenticated'](),controller[_0x2bc4('0x1d')]);router[_0x2bc4('0x19')](_0x2bc4('0x12'),auth[_0x2bc4('0x9')](),controller['addSmtp']);router['post'](_0x2bc4('0x1e'),auth[_0x2bc4('0x9')](),controller[_0x2bc4('0x1f')]);router[_0x2bc4('0x19')](_0x2bc4('0x14'),auth[_0x2bc4('0x9')](),controller['addApplications']);router[_0x2bc4('0x19')]('/:id/send',auth[_0x2bc4('0x9')](),controller[_0x2bc4('0x20')]);router[_0x2bc4('0x19')]('/:id/users',auth[_0x2bc4('0x9')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2bc4('0x21')]);router['delete'](_0x2bc4('0xd'),auth[_0x2bc4('0x9')](),controller[_0x2bc4('0x22')]);router[_0x2bc4('0x23')](_0x2bc4('0xf'),auth[_0x2bc4('0x9')](),controller['removeAnswers']);router[_0x2bc4('0x23')]('/:id/in_servers',auth[_0x2bc4('0x9')](),controller['removeImap']);router['delete'](_0x2bc4('0x12'),auth[_0x2bc4('0x9')](),controller[_0x2bc4('0x24')]);router[_0x2bc4('0x23')](_0x2bc4('0x25'),auth[_0x2bc4('0x9')](),controller[_0x2bc4('0x26')]);router[_0x2bc4('0x23')](_0x2bc4('0x27'),auth['isAuthenticated'](),controller[_0x2bc4('0x28')]);module[_0x2bc4('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 11ac0bd..27287e2 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 _0x6799=['mandatoryDispositionPauseId','setDataValue','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x402d10,_0x373288){var _0x552efe=function(_0x376662){while(--_0x376662){_0x402d10['push'](_0x402d10['shift']());}};_0x552efe(++_0x373288);}(_0x6799,0x156));var _0x9679=function(_0x2c3a05,_0x552f45){_0x2c3a05=_0x2c3a05-0x0;var _0x441953=_0x6799[_0x2c3a05];return _0x441953;};'use strict';var Sequelize=require(_0x9679('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x9679('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x9679('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x9679('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9679('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9679('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x9679('0x3')]},'markAsUnread':{'type':Sequelize[_0x9679('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9679('0x1')],'allowNull':![],'defaultValue':_0x9679('0x4')},'fontSize':{'type':Sequelize[_0x9679('0x5')](0x2)[_0x9679('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9679('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x9679('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9679('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9679('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9679('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9679('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9679('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9679('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9679('0x7'),'set':function(_0x55c65c){if(!_0x55c65c)this['setDataValue'](_0x9679('0x8'),null);this[_0x9679('0x9')]('mandatoryDisposition',_0x55c65c);}}}; \ No newline at end of file +var _0x8f18=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x43d207,_0x170849){var _0x486867=function(_0x43507e){while(--_0x43507e){_0x43d207['push'](_0x43d207['shift']());}};_0x486867(++_0x170849);}(_0x8f18,0x1ee));var _0x88f1=function(_0xd3c80a,_0x1ac246){_0xd3c80a=_0xd3c80a-0x0;var _0x33c169=_0x8f18[_0xd3c80a];return _0x33c169;};'use strict';var Sequelize=require(_0x88f1('0x0'));module[_0x88f1('0x1')]={'description':{'type':Sequelize[_0x88f1('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x88f1('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x88f1('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x88f1('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x88f1('0x4')]},'markAsUnread':{'type':Sequelize[_0x88f1('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x88f1('0x2')],'allowNull':![],'defaultValue':_0x88f1('0x5')},'fontSize':{'type':Sequelize[_0x88f1('0x6')](0x2)[_0x88f1('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x88f1('0x4')],'defaultValue':function(){return _0x88f1('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x88f1('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x88f1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x88f1('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x88f1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x88f1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x88f1('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x88f1('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x88f1('0x3')],'defaultValue':![],'comment':_0x88f1('0xa'),'set':function(_0x400150){if(!_0x400150)this[_0x88f1('0xb')](_0x88f1('0xc'),null);this['setDataValue'](_0x88f1('0xd'),_0x400150);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index ec8c651..603cf4c 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 _0x3c8b=['List\x20not\x20found','List','ListId','messageId','attach','out','Interaction','verifySmtp','secure','authentication','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','removeAgents','emit','userMailAccount:remove','getAgents','User','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','juice','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./mailAccount.socket','register','jayson/promise','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','UserProfileResource','stack','name','index','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','Smtp','find','update','body','params','describe','addDisposition','create','getDispositions','findOne','Disposition','nolimit','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','isNil','description','cservice','cauthentication','user','cuser','password','pass','cpassword','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Owner','fullname','internal','Tags','tag','sequelize','MailApplication','bulkCreate','priority','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','Contacts','updatedAt','DESC','from','format','%s\x20<%s>','attachments','join','basename','auth','sendMail'];(function(_0x18d325,_0x10ba0d){var _0x489bb1=function(_0x53b784){while(--_0x53b784){_0x18d325['push'](_0x18d325['shift']());}};_0x489bb1(++_0x10ba0d);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x160cae,_0x44ab95){_0x160cae=_0x160cae-0x0;var _0xa3937c=_0x3c8b[_0x160cae];return _0xa3937c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3c8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3c8('0x1'));var rp=require(_0xb3c8('0x2'));var moment=require(_0xb3c8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb3c8('0x4'));var util=require(_0xb3c8('0x5'));var path=require(_0xb3c8('0x6'));var sox=require(_0xb3c8('0x7'));var csv=require(_0xb3c8('0x8'));var ejs=require(_0xb3c8('0x9'));var fs=require('fs');var fs_extra=require(_0xb3c8('0xa'));var _=require(_0xb3c8('0xb'));var squel=require('squel');var crypto=require(_0xb3c8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb3c8('0xd'));var toCsv=require(_0xb3c8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require('html-to-text');var juice=require(_0xb3c8('0xe'));var Redis=require(_0xb3c8('0xf'));var authService=require(_0xb3c8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb3c8('0x11'));var hardwareService=require(_0xb3c8('0x12'));var logger=require(_0xb3c8('0x13'))(_0xb3c8('0x14'));var utils=require('../../config/utils');var config=require(_0xb3c8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3c8('0x16'))['db'];config['redis']=_[_0xb3c8('0x17')](config[_0xb3c8('0x18')],{'host':_0xb3c8('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb3c8('0x1a'))[_0xb3c8('0x1b')](socket);var jayson=require(_0xb3c8('0x1c'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x89f267,_0x1ae662,_0x124ab6,_0x47edd7){return new BPromise(function(_0x2ecca3,_0x1fceae){var _0x385f8b=_0x47edd7||client;return _0x385f8b[_0xb3c8('0x1d')](_0x89f267,_0x124ab6)[_0xb3c8('0x1e')](function(_0x98399d){logger[_0xb3c8('0x1f')](_0xb3c8('0x20'),_0x1ae662,_0xb3c8('0x21'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x1ae662,_0xb3c8('0x21'),JSON['stringify'](_0x98399d));if(_0x98399d['error']){if(_0x98399d[_0xb3c8('0x22')]['code']===0x1f4){logger[_0xb3c8('0x22')]('MailAccount,\x20%s,\x20%s',_0x1ae662,_0x98399d['error'][_0xb3c8('0x23')]);return _0x1fceae(_0x98399d['error'][_0xb3c8('0x23')]);}logger[_0xb3c8('0x22')](_0xb3c8('0x20'),_0x1ae662,_0x98399d['error'][_0xb3c8('0x23')]);return _0x2ecca3(_0x98399d['error'][_0xb3c8('0x23')]);}else{logger[_0xb3c8('0x1f')](_0xb3c8('0x20'),_0x1ae662,_0xb3c8('0x21'));_0x2ecca3(_0x98399d[_0xb3c8('0x24')][_0xb3c8('0x23')]);}})[_0xb3c8('0x25')](function(_0x1e4dc0){logger[_0xb3c8('0x22')]('MailAccount,\x20%s,\x20%s',_0x1ae662,_0x1e4dc0);_0x1fceae(_0x1e4dc0);});});}function respondWithStatusCode(_0x4325e5,_0x5d941e){_0x5d941e=_0x5d941e||0xcc;return function(_0x1765b9){if(_0x1765b9){return _0x4325e5[_0xb3c8('0x26')](_0x5d941e);}return _0x4325e5[_0xb3c8('0x27')](_0x5d941e)[_0xb3c8('0x28')]();};}function respondWithResult(_0x49ab02,_0x446c77){_0x446c77=_0x446c77||0xc8;return function(_0x657ae1){if(_0x657ae1){return _0x49ab02[_0xb3c8('0x27')](_0x446c77)[_0xb3c8('0x29')](_0x657ae1);}};}function respondWithFilteredResult(_0x275312,_0x24de08){return function(_0x27c0e9){if(_0x27c0e9){var _0x58da10=typeof _0x24de08[_0xb3c8('0x2a')]===_0xb3c8('0x2b')&&typeof _0x24de08['limit']===_0xb3c8('0x2b');var _0xdc197e=_0x27c0e9[_0xb3c8('0x2c')];var _0x124ae2=_0x58da10?0x0:_0x24de08[_0xb3c8('0x2a')];var _0x2929a3=_0x58da10?_0x27c0e9[_0xb3c8('0x2c')]:_0x24de08['offset']+_0x24de08[_0xb3c8('0x2d')];var _0x29eb72;if(_0x2929a3>=_0xdc197e){_0x2929a3=_0xdc197e;_0x29eb72=0xc8;}else{_0x29eb72=0xce;}_0x275312[_0xb3c8('0x27')](_0x29eb72);return _0x275312[_0xb3c8('0x2e')](_0xb3c8('0x2f'),_0x124ae2+'-'+_0x2929a3+'/'+_0xdc197e)['json'](_0x27c0e9);}return null;};}function patchUpdates(_0x2369e5){return function(_0x427532){try{jsonpatch[_0xb3c8('0x30')](_0x427532,_0x2369e5,!![]);}catch(_0x17bd8e){return BPromise[_0xb3c8('0x31')](_0x17bd8e);}return _0x427532[_0xb3c8('0x32')]();};}function saveUpdates(_0x27432f,_0x2628de){return function(_0x1bb2f8){if(_0x1bb2f8){return _0x1bb2f8['update'](_0x27432f)[_0xb3c8('0x1e')](function(_0x5a6b15){return _0x5a6b15;});}return null;};}function removeEntity(_0x33e1eb,_0x114161){return function(_0x10588f){if(_0x10588f){return _0x10588f[_0xb3c8('0x33')]()[_0xb3c8('0x1e')](function(){var _0x34e73f=_0x10588f['get']({'plain':!![]});var _0x1fe1bb='MailAccounts';return db[_0xb3c8('0x34')][_0xb3c8('0x33')]({'where':{'type':_0x1fe1bb,'resourceId':_0x34e73f['id']}})[_0xb3c8('0x1e')](function(){return _0x10588f;});})[_0xb3c8('0x1e')](function(){_0x33e1eb['status'](0xcc)[_0xb3c8('0x28')]();});}};}function handleEntityNotFound(_0x344499,_0x1c8b1c){return function(_0x2b45ea){if(!_0x2b45ea){_0x344499[_0xb3c8('0x26')](0x194);}return _0x2b45ea;};}function handleError(_0xbbac70,_0x5dda67){_0x5dda67=_0x5dda67||0x1f4;return function(_0x11a06a){logger[_0xb3c8('0x22')](_0x11a06a[_0xb3c8('0x35')]);if(_0x11a06a[_0xb3c8('0x36')]){delete _0x11a06a[_0xb3c8('0x36')];}_0xbbac70['status'](_0x5dda67)['send'](_0x11a06a);};}exports[_0xb3c8('0x37')]=function(_0x1ecefb,_0xda87b1){var _0x59ec63={'include':[{'model':db[_0xb3c8('0x38')],'as':_0xb3c8('0x39')},{'model':db[_0xb3c8('0x3a')],'as':'Smtp'},{'model':db[_0xb3c8('0x3b')],'as':_0xb3c8('0x3c')}]},_0x3d9c08={},_0x593498={'count':0x0,'rows':[]};var _0x2737bd=_[_0xb3c8('0x3d')](db[_0xb3c8('0x3e')][_0xb3c8('0x3f')],function(_0x16eb85){return{'name':_0x16eb85[_0xb3c8('0x40')],'type':_0x16eb85[_0xb3c8('0x41')][_0xb3c8('0x42')]};});_0x3d9c08['model']=_[_0xb3c8('0x3d')](_0x2737bd,_0xb3c8('0x36'));_0x3d9c08[_0xb3c8('0x43')]=_[_0xb3c8('0x44')](_0x1ecefb['query']);_0x3d9c08['filters']=_[_0xb3c8('0x45')](_0x3d9c08[_0xb3c8('0x46')],_0x3d9c08[_0xb3c8('0x43')]);_0x59ec63['attributes']=_[_0xb3c8('0x45')](_0x3d9c08[_0xb3c8('0x46')],qs[_0xb3c8('0x47')](_0x1ecefb[_0xb3c8('0x43')][_0xb3c8('0x47')]));_0x59ec63['attributes']=_0x59ec63[_0xb3c8('0x48')][_0xb3c8('0x49')]?_0x59ec63[_0xb3c8('0x48')]:_0x3d9c08['model'];if(!_0x1ecefb['query'][_0xb3c8('0x4a')]('nolimit')){_0x59ec63[_0xb3c8('0x2d')]=qs[_0xb3c8('0x2d')](_0x1ecefb[_0xb3c8('0x43')][_0xb3c8('0x2d')]);_0x59ec63['offset']=qs['offset'](_0x1ecefb[_0xb3c8('0x43')][_0xb3c8('0x2a')]);}_0x59ec63[_0xb3c8('0x4b')]=qs[_0xb3c8('0x4c')](_0x1ecefb['query']['sort']);_0x59ec63['where']=qs[_0xb3c8('0x4d')](_[_0xb3c8('0x4e')](_0x1ecefb[_0xb3c8('0x43')],_0x3d9c08[_0xb3c8('0x4d')]),_0x2737bd);if(_0x1ecefb[_0xb3c8('0x43')]['filter']){_0x59ec63[_0xb3c8('0x4f')]=_[_0xb3c8('0x50')](_0x59ec63[_0xb3c8('0x4f')],{'$or':_[_0xb3c8('0x3d')](_0x2737bd,function(_0x237de6){if(_0x237de6[_0xb3c8('0x41')]!==_0xb3c8('0x51')){var _0x21a5ea={};_0x21a5ea[_0x237de6[_0xb3c8('0x36')]]={'$like':'%'+_0x1ecefb['query'][_0xb3c8('0x52')]+'%'};return _0x21a5ea;}})});}_0x59ec63=_[_0xb3c8('0x50')]({},_0x59ec63,_0x1ecefb[_0xb3c8('0x53')]);var _0x133ba7={'where':_0x59ec63[_0xb3c8('0x4f')]};return db['MailAccount'][_0xb3c8('0x2c')](_0x133ba7)['then'](function(_0x21f072){_0x593498[_0xb3c8('0x2c')]=_0x21f072;if(_0x1ecefb[_0xb3c8('0x43')][_0xb3c8('0x54')]){_0x59ec63[_0xb3c8('0x55')]=[{'all':!![]}];}return db[_0xb3c8('0x3e')][_0xb3c8('0x56')](_0x59ec63);})[_0xb3c8('0x1e')](function(_0x30cd22){_0x593498[_0xb3c8('0x57')]=_0x30cd22;return _0x593498;})[_0xb3c8('0x1e')](respondWithFilteredResult(_0xda87b1,_0x59ec63))[_0xb3c8('0x25')](handleError(_0xda87b1,null));};exports['show']=function(_0x7ff03f,_0x44b153){var _0x189bc0={'raw':![],'where':{'id':_0x7ff03f['params']['id']},'include':[{'model':db[_0xb3c8('0x38')],'as':'Imap'},{'model':db[_0xb3c8('0x3a')],'as':_0xb3c8('0x58')},{'model':db['Pause'],'as':_0xb3c8('0x3c')}]},_0x3b9db8={};_0x3b9db8['model']=_[_0xb3c8('0x44')](db[_0xb3c8('0x3e')][_0xb3c8('0x3f')]);_0x3b9db8[_0xb3c8('0x43')]=_[_0xb3c8('0x44')](_0x7ff03f[_0xb3c8('0x43')]);_0x3b9db8[_0xb3c8('0x4d')]=_[_0xb3c8('0x45')](_0x3b9db8['model'],_0x3b9db8[_0xb3c8('0x43')]);_0x189bc0[_0xb3c8('0x48')]=_[_0xb3c8('0x45')](_0x3b9db8[_0xb3c8('0x46')],qs[_0xb3c8('0x47')](_0x7ff03f[_0xb3c8('0x43')][_0xb3c8('0x47')]));_0x189bc0[_0xb3c8('0x48')]=_0x189bc0[_0xb3c8('0x48')]['length']?_0x189bc0[_0xb3c8('0x48')]:_0x3b9db8[_0xb3c8('0x46')];if(_0x7ff03f['query'][_0xb3c8('0x54')]){_0x189bc0[_0xb3c8('0x55')]=[{'all':!![]}];}_0x189bc0=_['merge']({},_0x189bc0,_0x7ff03f[_0xb3c8('0x53')]);return db[_0xb3c8('0x3e')][_0xb3c8('0x59')](_0x189bc0)[_0xb3c8('0x1e')](handleEntityNotFound(_0x44b153,null))[_0xb3c8('0x1e')](respondWithResult(_0x44b153,null))['catch'](handleError(_0x44b153,null));};exports[_0xb3c8('0x5a')]=function(_0x59b5f7,_0x9bf50d){if(_0x59b5f7[_0xb3c8('0x5b')]['id']){delete _0x59b5f7[_0xb3c8('0x5b')]['id'];}return db[_0xb3c8('0x3e')][_0xb3c8('0x59')]({'where':{'id':_0x59b5f7[_0xb3c8('0x5c')]['id']},'include':[{'model':db[_0xb3c8('0x38')],'as':_0xb3c8('0x39')},{'model':db[_0xb3c8('0x3a')],'as':_0xb3c8('0x58')},{'model':db[_0xb3c8('0x3b')],'as':_0xb3c8('0x3c')}]})[_0xb3c8('0x1e')](handleEntityNotFound(_0x9bf50d,null))[_0xb3c8('0x1e')](saveUpdates(_0x59b5f7['body'],null))[_0xb3c8('0x1e')](function(_0x2b52f4){if(_0x2b52f4&&_0x59b5f7[_0xb3c8('0x5b')]['Imap']){return db['MailServerIn'][_0xb3c8('0x5a')](_0x59b5f7[_0xb3c8('0x5b')][_0xb3c8('0x39')],{'where':{'MailAccountId':_0x2b52f4['id']}})[_0xb3c8('0x1e')](function(){return _0x2b52f4;});}return _0x2b52f4;})[_0xb3c8('0x1e')](function(_0x1e7303){if(_0x1e7303&&_0x59b5f7[_0xb3c8('0x5b')][_0xb3c8('0x58')]){return db['MailServerOut'][_0xb3c8('0x5a')](_0x59b5f7['body']['Smtp'],{'where':{'MailAccountId':_0x1e7303['id']}})[_0xb3c8('0x1e')](function(){return _0x1e7303;});}return _0x1e7303;})[_0xb3c8('0x1e')](respondWithResult(_0x9bf50d,null))[_0xb3c8('0x25')](handleError(_0x9bf50d,null));};exports[_0xb3c8('0x5d')]=function(_0x19e818,_0x2e05cc){return db[_0xb3c8('0x3e')][_0xb3c8('0x5d')]()['then'](respondWithResult(_0x2e05cc,null))[_0xb3c8('0x25')](handleError(_0x2e05cc,null));};exports[_0xb3c8('0x5e')]=function(_0x55ec2e,_0x65cc12,_0x5ea3ba){if(_0x55ec2e[_0xb3c8('0x5b')]['id']){delete _0x55ec2e[_0xb3c8('0x5b')]['id'];}return db[_0xb3c8('0x3e')]['find']({'where':{'id':_0x55ec2e['params']['id']}})['then'](handleEntityNotFound(_0x65cc12,null))[_0xb3c8('0x1e')](function(_0x100fd2){if(_0x100fd2){_0x55ec2e[_0xb3c8('0x5b')]['MailAccountId']=_0x100fd2['id'];return db['Disposition'][_0xb3c8('0x5f')](_0x55ec2e[_0xb3c8('0x5b')]);}})[_0xb3c8('0x1e')](respondWithResult(_0x65cc12,null))[_0xb3c8('0x25')](handleError(_0x65cc12,null));};exports[_0xb3c8('0x60')]=function(_0x10273b,_0x45996a,_0x1d754b){var _0x4950da={'raw':![],'where':{}};var _0x2e2991={};var _0x5f10af={'count':0x0,'rows':[]};return db['MailAccount'][_0xb3c8('0x61')]({'where':{'id':_0x10273b[_0xb3c8('0x5c')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x45996a,null))[_0xb3c8('0x1e')](function(_0x412280){if(_0x412280){_0x2e2991[_0xb3c8('0x46')]=_[_0xb3c8('0x44')](db[_0xb3c8('0x62')]['rawAttributes']);_0x2e2991[_0xb3c8('0x43')]=_[_0xb3c8('0x44')](_0x10273b[_0xb3c8('0x43')]);_0x2e2991[_0xb3c8('0x4d')]=_[_0xb3c8('0x45')](_0x2e2991[_0xb3c8('0x46')],_0x2e2991[_0xb3c8('0x43')]);_0x4950da['attributes']=_['intersection'](_0x2e2991[_0xb3c8('0x46')],qs[_0xb3c8('0x47')](_0x10273b[_0xb3c8('0x43')][_0xb3c8('0x47')]));_0x4950da['attributes']=_0x4950da[_0xb3c8('0x48')][_0xb3c8('0x49')]?_0x4950da[_0xb3c8('0x48')]:_0x2e2991['model'];if(!_0x10273b['query'][_0xb3c8('0x4a')](_0xb3c8('0x63'))){_0x4950da[_0xb3c8('0x2d')]=qs[_0xb3c8('0x2d')](_0x10273b[_0xb3c8('0x43')]['limit']);_0x4950da[_0xb3c8('0x2a')]=qs[_0xb3c8('0x2a')](_0x10273b[_0xb3c8('0x43')]['offset']);}_0x4950da[_0xb3c8('0x4b')]=qs['sort'](_0x10273b[_0xb3c8('0x43')][_0xb3c8('0x4c')]);_0x4950da[_0xb3c8('0x4f')]=qs[_0xb3c8('0x4d')](_[_0xb3c8('0x4e')](_0x10273b[_0xb3c8('0x43')],_0x2e2991[_0xb3c8('0x4d')]));_0x4950da[_0xb3c8('0x4f')][_0xb3c8('0x64')]=_0x412280['id'];if(_0x10273b[_0xb3c8('0x43')][_0xb3c8('0x52')]){_0x4950da['where']=_[_0xb3c8('0x50')](_0x4950da['where'],{'$or':_[_0xb3c8('0x3d')](_0x4950da['attributes'],function(_0x44667e){var _0x44c297={};_0x44c297[_0x44667e]={'$like':'%'+_0x10273b[_0xb3c8('0x43')][_0xb3c8('0x52')]+'%'};return _0x44c297;})});}_0x4950da=_[_0xb3c8('0x50')]({},_0x4950da,_0x10273b[_0xb3c8('0x53')]);return db[_0xb3c8('0x62')][_0xb3c8('0x2c')]({'where':_0x4950da[_0xb3c8('0x4f')]})[_0xb3c8('0x1e')](function(_0x533bcc){_0x5f10af[_0xb3c8('0x2c')]=_0x533bcc;if(_0x10273b['query']['includeAll']){_0x4950da['include']=[{'all':!![]}];}return db['Disposition'][_0xb3c8('0x56')](_0x4950da);})[_0xb3c8('0x1e')](function(_0x423452){_0x5f10af['rows']=_0x423452;return _0x5f10af;});}})['then'](respondWithFilteredResult(_0x45996a,_0x4950da))[_0xb3c8('0x25')](handleError(_0x45996a,null));};exports[_0xb3c8('0x65')]=function(_0x73eccd,_0x3f35f9,_0x269347){return db[_0xb3c8('0x3e')][_0xb3c8('0x59')]({'where':{'id':_0x73eccd['params']['id']}})['then'](handleEntityNotFound(_0x3f35f9,null))[_0xb3c8('0x1e')](function(_0x26c26b){if(_0x26c26b){return _0x26c26b[_0xb3c8('0x65')](_0x73eccd[_0xb3c8('0x43')][_0xb3c8('0x66')]);}})[_0xb3c8('0x1e')](respondWithStatusCode(_0x3f35f9,null))['catch'](handleError(_0x3f35f9,null));};exports[_0xb3c8('0x67')]=function(_0x4e984a,_0x38ffa0,_0x39b49b){if(_0x4e984a[_0xb3c8('0x5b')]['id']){delete _0x4e984a[_0xb3c8('0x5b')]['id'];}return db[_0xb3c8('0x3e')][_0xb3c8('0x59')]({'where':{'id':_0x4e984a[_0xb3c8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x38ffa0,null))[_0xb3c8('0x1e')](function(_0x191a60){if(_0x191a60){_0x4e984a[_0xb3c8('0x5b')][_0xb3c8('0x64')]=_0x191a60['id'];return db[_0xb3c8('0x68')][_0xb3c8('0x5f')](_0x4e984a[_0xb3c8('0x5b')]);}})[_0xb3c8('0x1e')](respondWithResult(_0x38ffa0,null))[_0xb3c8('0x25')](handleError(_0x38ffa0,null));};exports[_0xb3c8('0x69')]=function(_0x45fc7b,_0x76fda1,_0x1df6b4){var _0x4fcae3={'raw':![],'where':{}};var _0x5d3e89={};var _0x403e59={'count':0x0,'rows':[]};return db['MailAccount'][_0xb3c8('0x61')]({'where':{'id':_0x45fc7b[_0xb3c8('0x5c')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x76fda1,null))[_0xb3c8('0x1e')](function(_0x3fca4f){if(_0x3fca4f){_0x5d3e89['model']=_['keys'](db[_0xb3c8('0x68')][_0xb3c8('0x3f')]);_0x5d3e89[_0xb3c8('0x43')]=_[_0xb3c8('0x44')](_0x45fc7b['query']);_0x5d3e89[_0xb3c8('0x4d')]=_['intersection'](_0x5d3e89[_0xb3c8('0x46')],_0x5d3e89[_0xb3c8('0x43')]);_0x4fcae3['attributes']=_[_0xb3c8('0x45')](_0x5d3e89['model'],qs['fields'](_0x45fc7b['query'][_0xb3c8('0x47')]));_0x4fcae3[_0xb3c8('0x48')]=_0x4fcae3[_0xb3c8('0x48')][_0xb3c8('0x49')]?_0x4fcae3['attributes']:_0x5d3e89[_0xb3c8('0x46')];if(!_0x45fc7b[_0xb3c8('0x43')]['hasOwnProperty'](_0xb3c8('0x63'))){_0x4fcae3[_0xb3c8('0x2d')]=qs[_0xb3c8('0x2d')](_0x45fc7b[_0xb3c8('0x43')][_0xb3c8('0x2d')]);_0x4fcae3['offset']=qs[_0xb3c8('0x2a')](_0x45fc7b[_0xb3c8('0x43')][_0xb3c8('0x2a')]);}_0x4fcae3[_0xb3c8('0x4b')]=qs['sort'](_0x45fc7b['query'][_0xb3c8('0x4c')]);_0x4fcae3['where']=qs['filters'](_[_0xb3c8('0x4e')](_0x45fc7b[_0xb3c8('0x43')],_0x5d3e89[_0xb3c8('0x4d')]));_0x4fcae3[_0xb3c8('0x4f')][_0xb3c8('0x64')]=_0x3fca4f['id'];if(_0x45fc7b[_0xb3c8('0x43')][_0xb3c8('0x52')]){_0x4fcae3[_0xb3c8('0x4f')]=_[_0xb3c8('0x50')](_0x4fcae3[_0xb3c8('0x4f')],{'$or':_[_0xb3c8('0x3d')](_0x4fcae3[_0xb3c8('0x48')],function(_0x2714af){var _0x183e98={};_0x183e98[_0x2714af]={'$like':'%'+_0x45fc7b[_0xb3c8('0x43')]['filter']+'%'};return _0x183e98;})});}_0x4fcae3=_['merge']({},_0x4fcae3,_0x45fc7b[_0xb3c8('0x53')]);return db[_0xb3c8('0x68')]['count']({'where':_0x4fcae3['where']})[_0xb3c8('0x1e')](function(_0x21d8ee){_0x403e59[_0xb3c8('0x2c')]=_0x21d8ee;if(_0x45fc7b[_0xb3c8('0x43')][_0xb3c8('0x54')]){_0x4fcae3[_0xb3c8('0x55')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4fcae3);})[_0xb3c8('0x1e')](function(_0x1ecce2){_0x403e59[_0xb3c8('0x57')]=_0x1ecce2;return _0x403e59;});}})['then'](respondWithFilteredResult(_0x76fda1,_0x4fcae3))[_0xb3c8('0x25')](handleError(_0x76fda1,null));};exports[_0xb3c8('0x6a')]=function(_0x5b45e7,_0x3e3a2f,_0x4dee77){return db[_0xb3c8('0x3e')][_0xb3c8('0x59')]({'where':{'id':_0x5b45e7[_0xb3c8('0x5c')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x3e3a2f,null))[_0xb3c8('0x1e')](function(_0xbb83b){if(_0xbb83b){return _0xbb83b[_0xb3c8('0x6a')](_0x5b45e7[_0xb3c8('0x43')][_0xb3c8('0x66')]);}})[_0xb3c8('0x1e')](respondWithStatusCode(_0x3e3a2f,null))[_0xb3c8('0x25')](handleError(_0x3e3a2f,null));};exports[_0xb3c8('0x5f')]=function(_0x375c22,_0x59ba36){var _0x1db0c0={'name':_0x375c22[_0xb3c8('0x5b')][_0xb3c8('0x36')],'key':_0x375c22[_0xb3c8('0x5b')]['key'],'email':_0x375c22[_0xb3c8('0x5b')][_0xb3c8('0x6b')],'ListId':_0x375c22['body']['ListId'],'active':!_[_0xb3c8('0x6c')](_0x375c22[_0xb3c8('0x5b')]['active'])?_0x375c22[_0xb3c8('0x5b')]['active']:!![],'description':_0x375c22[_0xb3c8('0x5b')][_0xb3c8('0x6d')]||null,'Imap':{},'Smtp':{}};if(_[_0xb3c8('0x6c')](_0x375c22[_0xb3c8('0x5b')][_0xb3c8('0x6e')])){if(_0x375c22[_0xb3c8('0x5b')][_0xb3c8('0x6f')]){_0x1db0c0['Imap'][_0xb3c8('0x70')]=_0x1db0c0['Smtp'][_0xb3c8('0x70')]=_0x375c22[_0xb3c8('0x5b')][_0xb3c8('0x71')];_0x1db0c0[_0xb3c8('0x39')][_0xb3c8('0x72')]=_0x1db0c0[_0xb3c8('0x58')][_0xb3c8('0x73')]=_0x375c22[_0xb3c8('0x5b')][_0xb3c8('0x74')];}else{_0x1db0c0[_0xb3c8('0x39')]['authentication']=_0x1db0c0[_0xb3c8('0x58')]['authentication']=![];}_0x1db0c0[_0xb3c8('0x39')][_0xb3c8('0x75')]=_0x375c22[_0xb3c8('0x5b')][_0xb3c8('0x39')][_0xb3c8('0x75')];_0x1db0c0['Imap'][_0xb3c8('0x76')]=_0x375c22[_0xb3c8('0x5b')][_0xb3c8('0x39')][_0xb3c8('0x76')];_0x1db0c0[_0xb3c8('0x58')][_0xb3c8('0x75')]=_0x375c22[_0xb3c8('0x5b')]['Smtp'][_0xb3c8('0x75')];_0x1db0c0[_0xb3c8('0x58')][_0xb3c8('0x76')]=_0x375c22['body'][_0xb3c8('0x58')][_0xb3c8('0x76')];}else{_0x1db0c0[_0xb3c8('0x39')]['service']=_0x1db0c0[_0xb3c8('0x58')][_0xb3c8('0x77')]=_0x375c22['body'][_0xb3c8('0x6e')];_0x1db0c0['Imap'][_0xb3c8('0x70')]=_0x1db0c0[_0xb3c8('0x58')]['user']=_0x375c22['body'][_0xb3c8('0x71')];_0x1db0c0[_0xb3c8('0x39')][_0xb3c8('0x72')]=_0x1db0c0[_0xb3c8('0x58')][_0xb3c8('0x73')]=_0x375c22[_0xb3c8('0x5b')][_0xb3c8('0x74')];}return db[_0xb3c8('0x3e')][_0xb3c8('0x5f')](_0x1db0c0,{'include':[{'model':db[_0xb3c8('0x3a')],'as':_0xb3c8('0x58')},{'model':db['MailServerIn'],'as':_0xb3c8('0x39')}]})[_0xb3c8('0x1e')](function(_0x3709c4){var _0x52169b=_0x375c22[_0xb3c8('0x70')]['get']({'plain':!![]});if(!_0x52169b)throw new Error(_0xb3c8('0x78'));if(_0x52169b[_0xb3c8('0x79')]===_0xb3c8('0x70')){var _0x5f2809=_0x3709c4[_0xb3c8('0x7a')]({'plain':!![]});return db[_0xb3c8('0x7b')][_0xb3c8('0x59')]({'where':{'name':'MailAccounts','userProfileId':_0x52169b[_0xb3c8('0x7c')]},'raw':!![]})[_0xb3c8('0x1e')](function(_0x1d06ad){if(_0x1d06ad&&_0x1d06ad[_0xb3c8('0x7d')]===0x0){return db['UserProfileResource'][_0xb3c8('0x5f')]({'name':_0x5f2809['name'],'resourceId':_0x5f2809['id'],'type':_0x1d06ad[_0xb3c8('0x36')],'sectionId':_0x1d06ad['id']},{})[_0xb3c8('0x1e')](function(){return _0x3709c4;});}else{return _0x3709c4;}})[_0xb3c8('0x25')](function(_0x4387f7){logger[_0xb3c8('0x22')](_0xb3c8('0x7e'),_0x4387f7);throw _0x4387f7;});}return _0x3709c4;})['then'](respondWithResult(_0x59ba36,0xc9))['catch'](handleError(_0x59ba36,null));};exports[_0xb3c8('0x7f')]=function(_0x1f1b0c,_0x398b64,_0x527e77){return db[_0xb3c8('0x3e')]['findOne']({'where':{'id':_0x1f1b0c[_0xb3c8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x398b64,null))[_0xb3c8('0x1e')](function(_0x2fe578){if(_0x2fe578){return _0x2fe578[_0xb3c8('0x7f')]();}return null;})[_0xb3c8('0x1e')](respondWithResult(_0x398b64,null))[_0xb3c8('0x25')](handleError(_0x398b64,null));};exports[_0xb3c8('0x80')]=function(_0x4a9199,_0x35beb2,_0x339a8f){if(_0x4a9199['body']['id']){delete _0x4a9199['body']['id'];}return db['MailAccount'][_0xb3c8('0x59')]({'where':{'id':_0x4a9199[_0xb3c8('0x5c')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x35beb2,null))[_0xb3c8('0x1e')](function(_0x411966){if(_0x411966){_0x4a9199[_0xb3c8('0x5b')][_0xb3c8('0x64')]=_0x411966['id'];return db[_0xb3c8('0x38')][_0xb3c8('0x5f')](_0x4a9199['body']);}})[_0xb3c8('0x1e')](respondWithResult(_0x35beb2,null))[_0xb3c8('0x25')](handleError(_0x35beb2,null));};exports[_0xb3c8('0x81')]=function(_0xc92a42,_0x549b33,_0x210a3e){return db[_0xb3c8('0x3e')][_0xb3c8('0x61')]({'where':{'id':_0xc92a42[_0xb3c8('0x5c')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x549b33,null))[_0xb3c8('0x1e')](function(_0x41c91f){if(_0x41c91f){return _0x41c91f[_0xb3c8('0x82')](null);}return null;})['then'](respondWithStatusCode(_0x549b33,null))[_0xb3c8('0x25')](handleError(_0x549b33,null));};exports[_0xb3c8('0x83')]=function(_0x8b2ab7,_0x2bf58d,_0x3a0af8){return db['MailAccount'][_0xb3c8('0x61')]({'where':{'id':_0x8b2ab7[_0xb3c8('0x5c')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x2bf58d,null))[_0xb3c8('0x1e')](function(_0x350366){if(_0x350366){return _0x350366[_0xb3c8('0x83')]();}return null;})['then'](respondWithResult(_0x2bf58d,null))[_0xb3c8('0x25')](handleError(_0x2bf58d,null));};exports[_0xb3c8('0x84')]=function(_0x54fe3f,_0x52c478,_0x1f9b69){if(_0x54fe3f[_0xb3c8('0x5b')]['id']){delete _0x54fe3f[_0xb3c8('0x5b')]['id'];}return db['MailAccount'][_0xb3c8('0x59')]({'where':{'id':_0x54fe3f[_0xb3c8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x52c478,null))[_0xb3c8('0x1e')](function(_0x541226){if(_0x541226){_0x54fe3f['body']['MailAccountId']=_0x541226['id'];return db[_0xb3c8('0x3a')][_0xb3c8('0x5f')](_0x54fe3f[_0xb3c8('0x5b')]);}})[_0xb3c8('0x1e')](respondWithResult(_0x52c478,null))[_0xb3c8('0x25')](handleError(_0x52c478,null));};exports[_0xb3c8('0x85')]=function(_0x5b6e90,_0x22f3af,_0x2aace5){return db['MailAccount'][_0xb3c8('0x61')]({'where':{'id':_0x5b6e90[_0xb3c8('0x5c')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x22f3af,null))[_0xb3c8('0x1e')](function(_0x142595){if(_0x142595){return _0x142595[_0xb3c8('0x86')](null);}return null;})['then'](respondWithStatusCode(_0x22f3af,null))['catch'](handleError(_0x22f3af,null));};exports[_0xb3c8('0x87')]=function(_0x123cbe,_0x10951b,_0x4b7f67){return db[_0xb3c8('0x88')][_0xb3c8('0x59')]({'where':{'id':_0x123cbe[_0xb3c8('0x5c')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x10951b,null))['then'](function(_0x5ab533){if(_0x5ab533){return _0x5ab533[_0xb3c8('0x87')](_0x123cbe[_0xb3c8('0x5b')]['ids'],_['omit'](_0x123cbe['body'],[_0xb3c8('0x66'),'id'])||{});}})['then'](respondWithResult(_0x10951b,null))['catch'](handleError(_0x10951b,null));};exports[_0xb3c8('0x89')]=function(_0x1d976b,_0x288970,_0x56061e){var _0x5baf35={'raw':![],'where':{}};var _0x64d772={};var _0x53a5f8={'count':0x0,'rows':[]};return db['MailAccount'][_0xb3c8('0x61')]({'where':{'id':_0x1d976b[_0xb3c8('0x5c')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x288970,null))['then'](function(_0x480ddd){if(_0x480ddd){_0x64d772[_0xb3c8('0x46')]=_['keys'](db['MailInteraction'][_0xb3c8('0x3f')]);_0x64d772['query']=_[_0xb3c8('0x44')](_0x1d976b[_0xb3c8('0x43')]);_0x64d772[_0xb3c8('0x4d')]=_['intersection'](_0x64d772[_0xb3c8('0x46')],_0x64d772[_0xb3c8('0x43')]);_0x5baf35[_0xb3c8('0x48')]=_[_0xb3c8('0x45')](_0x64d772['model'],qs['fields'](_0x1d976b[_0xb3c8('0x43')][_0xb3c8('0x47')]));_0x5baf35[_0xb3c8('0x48')]=_0x5baf35[_0xb3c8('0x48')][_0xb3c8('0x49')]?_0x5baf35[_0xb3c8('0x48')]:_0x64d772[_0xb3c8('0x46')];if(!_0x1d976b[_0xb3c8('0x43')][_0xb3c8('0x4a')]('nolimit')){_0x5baf35[_0xb3c8('0x2d')]=qs[_0xb3c8('0x2d')](_0x1d976b[_0xb3c8('0x43')][_0xb3c8('0x2d')]);_0x5baf35[_0xb3c8('0x2a')]=qs[_0xb3c8('0x2a')](_0x1d976b[_0xb3c8('0x43')][_0xb3c8('0x2a')]);}_0x5baf35['order']=qs['sort'](_0x1d976b['query'][_0xb3c8('0x4c')]);_0x5baf35[_0xb3c8('0x4f')]=qs[_0xb3c8('0x4d')](_[_0xb3c8('0x4e')](_0x1d976b[_0xb3c8('0x43')],_0x64d772[_0xb3c8('0x4d')]));_0x5baf35[_0xb3c8('0x4f')]['MailAccountId']=_0x480ddd['id'];if(_0x1d976b[_0xb3c8('0x43')]['filter']){_0x5baf35[_0xb3c8('0x4f')]=_[_0xb3c8('0x50')](_0x5baf35[_0xb3c8('0x4f')],{'$or':_['map'](_0x5baf35['attributes'],function(_0x4f3c15){var _0x32bf93={};_0x32bf93[_0x4f3c15]={'$like':'%'+_0x1d976b[_0xb3c8('0x43')][_0xb3c8('0x52')]+'%'};return _0x32bf93;})});}_0x5baf35=_[_0xb3c8('0x50')]({},_0x5baf35,_0x1d976b['options']);return db[_0xb3c8('0x88')][_0xb3c8('0x2c')]({'where':_0x5baf35[_0xb3c8('0x4f')]})['then'](function(_0x292d11){_0x53a5f8[_0xb3c8('0x2c')]=_0x292d11;if(_0x1d976b['query'][_0xb3c8('0x54')]){_0x5baf35['include']=[{'model':db[_0xb3c8('0x8a')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xb3c8('0x8b'),'attributes':[_0xb3c8('0x36'),_0xb3c8('0x8c'),_0xb3c8('0x8d')],'required':![]},{'model':db['Tag'],'as':_0xb3c8('0x8e'),'attributes':['id',_0xb3c8('0x36'),'color'],'where':_0x1d976b[_0xb3c8('0x43')][_0xb3c8('0x8f')]?{'id':_0x1d976b[_0xb3c8('0x43')][_0xb3c8('0x8f')]}:undefined,'required':_0x1d976b[_0xb3c8('0x43')][_0xb3c8('0x8f')]?!![]:![]}];}return db['MailInteraction'][_0xb3c8('0x56')](_0x5baf35);})[_0xb3c8('0x1e')](function(_0xb793d3){_0x53a5f8[_0xb3c8('0x57')]=_0xb793d3;return _0x53a5f8;});}})[_0xb3c8('0x1e')](respondWithFilteredResult(_0x288970,_0x5baf35))['catch'](handleError(_0x288970,null));};exports['addApplications']=function(_0x5d54cc,_0x4af18,_0x2eb707){return db[_0xb3c8('0x3e')][_0xb3c8('0x61')]({'where':{'id':_0x5d54cc[_0xb3c8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4af18,null))[_0xb3c8('0x1e')](function(_0x1aa351){if(_0x1aa351){return db[_0xb3c8('0x90')]['transaction'](function(_0xceb712){return db[_0xb3c8('0x91')][_0xb3c8('0x33')]({'where':{'MailAccountId':_0x5d54cc[_0xb3c8('0x5c')]['id']},'transaction':_0xceb712})[_0xb3c8('0x1e')](function(_0x3a2f34){var _0x19816e=_[_0xb3c8('0x3d')](_0x5d54cc[_0xb3c8('0x5b')],function(_0x172b5c){_0x172b5c[_0xb3c8('0x64')]=_0x5d54cc[_0xb3c8('0x5c')]['id'];return _0x172b5c;});return db[_0xb3c8('0x91')][_0xb3c8('0x92')](_0x19816e,{'transaction':_0xceb712});});})[_0xb3c8('0x1e')](function(){return db[_0xb3c8('0x91')]['findAndCountAll']({'where':{'MailAccountId':_0x5d54cc['params']['id']},'order':_0xb3c8('0x93')});});}})[_0xb3c8('0x1e')](respondWithResult(_0x4af18,null))[_0xb3c8('0x25')](handleError(_0x4af18,null));};exports[_0xb3c8('0x94')]=function(_0x14c445,_0xa2bee2,_0x15024a){var _0x5c9473={};var _0x52b097={};var _0x20298f;var _0x123313;return db['MailAccount']['findOne']({'where':{'id':_0x14c445['params']['id']}})['then'](handleEntityNotFound(_0xa2bee2,null))[_0xb3c8('0x1e')](function(_0x17f9dc){if(_0x17f9dc){_0x20298f=_0x17f9dc;_0x52b097[_0xb3c8('0x46')]=_[_0xb3c8('0x44')](db[_0xb3c8('0x91')][_0xb3c8('0x3f')]);_0x52b097[_0xb3c8('0x43')]=_[_0xb3c8('0x44')](_0x14c445[_0xb3c8('0x43')]);_0x52b097[_0xb3c8('0x4d')]=_[_0xb3c8('0x45')](_0x52b097[_0xb3c8('0x46')],_0x52b097['query']);_0x5c9473[_0xb3c8('0x48')]=_[_0xb3c8('0x45')](_0x52b097[_0xb3c8('0x46')],qs['fields'](_0x14c445[_0xb3c8('0x43')][_0xb3c8('0x47')]));_0x5c9473[_0xb3c8('0x48')]=_0x5c9473[_0xb3c8('0x48')]['length']?_0x5c9473[_0xb3c8('0x48')]:_0x52b097['model'];_0x5c9473[_0xb3c8('0x4b')]=qs[_0xb3c8('0x4c')](_0x14c445[_0xb3c8('0x43')]['sort']);_0x5c9473[_0xb3c8('0x4f')]=qs[_0xb3c8('0x4d')](_[_0xb3c8('0x4e')](_0x14c445[_0xb3c8('0x43')],_0x52b097[_0xb3c8('0x4d')]));if(_0x14c445['query'][_0xb3c8('0x52')]){_0x5c9473[_0xb3c8('0x4f')]=_[_0xb3c8('0x50')](_0x5c9473[_0xb3c8('0x4f')],{'$or':_[_0xb3c8('0x3d')](_0x5c9473[_0xb3c8('0x48')],function(_0x3c6d6d){var _0x995e1f={};_0x995e1f[_0x3c6d6d]={'$like':'%'+_0x14c445[_0xb3c8('0x43')][_0xb3c8('0x52')]+'%'};return _0x995e1f;})});}_0x5c9473=_['merge']({},_0x5c9473,_0x14c445[_0xb3c8('0x53')]);return _0x20298f[_0xb3c8('0x94')](_0x5c9473);}})[_0xb3c8('0x1e')](function(_0x432556){if(_0x432556){_0x123313=_0x432556[_0xb3c8('0x49')];if(!_0x14c445[_0xb3c8('0x43')][_0xb3c8('0x4a')](_0xb3c8('0x63'))){_0x5c9473[_0xb3c8('0x2d')]=qs[_0xb3c8('0x2d')](_0x14c445[_0xb3c8('0x43')]['limit']);_0x5c9473['offset']=qs['offset'](_0x14c445[_0xb3c8('0x43')][_0xb3c8('0x2a')]);}return _0x20298f['getApplications'](_0x5c9473);}})[_0xb3c8('0x1e')](function(_0x2d8ee2){if(_0x2d8ee2){return _0x2d8ee2?{'count':_0x123313,'rows':_0x2d8ee2}:null;}})['then'](respondWithResult(_0xa2bee2,null))['catch'](handleError(_0xa2bee2,null));};exports['getMessages']=function(_0x4fdc7d,_0x4faa60,_0x46c6c4){var _0x156371={'raw':!![],'where':{}};var _0x2d9730={};var _0x18e71f={'count':0x0,'rows':[]};return db['MailAccount'][_0xb3c8('0x61')]({'where':{'id':_0x4fdc7d[_0xb3c8('0x5c')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x4faa60,null))[_0xb3c8('0x1e')](function(_0x321b62){if(_0x321b62){_0x2d9730[_0xb3c8('0x46')]=_[_0xb3c8('0x44')](db[_0xb3c8('0x95')][_0xb3c8('0x3f')]);_0x2d9730[_0xb3c8('0x43')]=_['keys'](_0x4fdc7d[_0xb3c8('0x43')]);_0x2d9730[_0xb3c8('0x4d')]=_[_0xb3c8('0x45')](_0x2d9730[_0xb3c8('0x46')],_0x2d9730['query']);_0x156371[_0xb3c8('0x48')]=_[_0xb3c8('0x45')](_0x2d9730[_0xb3c8('0x46')],qs['fields'](_0x4fdc7d[_0xb3c8('0x43')][_0xb3c8('0x47')]));_0x156371[_0xb3c8('0x48')]=_0x156371['attributes']['length']?_0x156371[_0xb3c8('0x48')]:_0x2d9730[_0xb3c8('0x46')];if(!_0x4fdc7d[_0xb3c8('0x43')][_0xb3c8('0x4a')](_0xb3c8('0x63'))){_0x156371['limit']=qs[_0xb3c8('0x2d')](_0x4fdc7d[_0xb3c8('0x43')][_0xb3c8('0x2d')]);_0x156371[_0xb3c8('0x2a')]=qs[_0xb3c8('0x2a')](_0x4fdc7d['query']['offset']);}_0x156371[_0xb3c8('0x4b')]=qs[_0xb3c8('0x4c')](_0x4fdc7d[_0xb3c8('0x43')][_0xb3c8('0x4c')]);_0x156371['where']=qs[_0xb3c8('0x4d')](_[_0xb3c8('0x4e')](_0x4fdc7d[_0xb3c8('0x43')],_0x2d9730[_0xb3c8('0x4d')]));_0x156371[_0xb3c8('0x4f')]['MailAccountId']=_0x321b62['id'];if(_0x4fdc7d['query'][_0xb3c8('0x52')]){_0x156371['where']=_['merge'](_0x156371[_0xb3c8('0x4f')],{'$or':_[_0xb3c8('0x3d')](_0x156371[_0xb3c8('0x48')],function(_0x18add5){var _0x448b24={};_0x448b24[_0x18add5]={'$like':'%'+_0x4fdc7d[_0xb3c8('0x43')]['filter']+'%'};return _0x448b24;})});}if(_0x4fdc7d[_0xb3c8('0x43')][_0xb3c8('0x96')]){var _0x519333=_0x4fdc7d['query'][_0xb3c8('0x96')][_0xb3c8('0x97')](',');var _0x5acd29={};_0x5acd29[_0x519333[0x0]]={'$gte':moment(_0x519333[0x1])['format'](_0xb3c8('0x98'))};_0x156371[_0xb3c8('0x4f')]=_[_0xb3c8('0x50')](_0x156371[_0xb3c8('0x4f')],_0x5acd29);}_0x156371=_[_0xb3c8('0x50')]({},_0x156371,_0x4fdc7d[_0xb3c8('0x53')]);return db[_0xb3c8('0x95')][_0xb3c8('0x2c')]({'where':_0x156371[_0xb3c8('0x4f')]})[_0xb3c8('0x1e')](function(_0x3d8b45){_0x18e71f[_0xb3c8('0x2c')]=_0x3d8b45;if(_0x4fdc7d[_0xb3c8('0x43')][_0xb3c8('0x54')]){_0x156371[_0xb3c8('0x55')]=[{'all':!![]}];}return db[_0xb3c8('0x95')][_0xb3c8('0x56')](_0x156371);})[_0xb3c8('0x1e')](function(_0x1a4275){if(_0x4fdc7d[_0xb3c8('0x43')][_0xb3c8('0x99')]==='true'){for(var _0xd464e3=0x0;_0xd464e3<_0x1a4275[_0xb3c8('0x49')];_0xd464e3++){_0x1a4275[_0xd464e3][_0xb3c8('0x5b')]=juice(_0x1a4275[_0xd464e3]['body']);}}_0x18e71f[_0xb3c8('0x57')]=_0x1a4275;return _0x18e71f;});}})['then'](respondWithFilteredResult(_0x4faa60,_0x156371))[_0xb3c8('0x25')](handleError(_0x4faa60,null));};exports['send']=function(_0x4ef495,_0x2b6fe6,_0x133cb7){var _0x5405af,_0x7cc56d={},_0x5613a4;if(_0x4ef495[_0xb3c8('0x5b')]['to']){_0x5613a4=_0x4ef495[_0xb3c8('0x5b')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xb3c8('0x59')]({'where':{'id':_0x4ef495[_0xb3c8('0x5c')]['id']},'include':[{'model':db[_0xb3c8('0x9a')],'as':'List','include':[{'model':db[_0xb3c8('0x8a')],'as':_0xb3c8('0x9b'),'where':{'email':_0x5613a4},'limit':0x1,'order':[[_0xb3c8('0x9c'),_0xb3c8('0x9d')]]}]},{'model':db[_0xb3c8('0x3a')],'as':'Smtp','raw':!![]}]})[_0xb3c8('0x1e')](handleEntityNotFound(_0x2b6fe6,null))['then'](function(_0x34ef0f){if(_0x34ef0f){_0x5405af=_0x34ef0f;if(_0x34ef0f[_0xb3c8('0x58')]){if(_[_0xb3c8('0x6c')](_0x4ef495[_0xb3c8('0x5b')][_0xb3c8('0x9e')])){_0x4ef495[_0xb3c8('0x5b')][_0xb3c8('0x9e')]=util[_0xb3c8('0x9f')](_0xb3c8('0xa0'),_0x34ef0f[_0xb3c8('0x36')],_0x34ef0f['email']||_0x34ef0f[_0xb3c8('0x58')][_0xb3c8('0x70')]);}if(_0x4ef495['body'][_0xb3c8('0xa1')]&&_0x4ef495[_0xb3c8('0x5b')][_0xb3c8('0xa1')][_0xb3c8('0x49')]){for(var _0x597386=0x0;_0x597386<_0x4ef495[_0xb3c8('0x5b')][_0xb3c8('0xa1')][_0xb3c8('0x49')];_0x597386+=0x1){_0x4ef495[_0xb3c8('0x5b')][_0xb3c8('0xa1')][_0x597386]={'filename':_0x4ef495[_0xb3c8('0x5b')][_0xb3c8('0xa1')][_0x597386][_0xb3c8('0x36')],'path':path[_0xb3c8('0xa2')](config['root'],'server/files/attachments',_0x4ef495[_0xb3c8('0x5b')][_0xb3c8('0xa1')][_0x597386][_0xb3c8('0xa3')])};}}var _0x3fc4a2={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x34ef0f[_0xb3c8('0x58')]['service'])){if(_0x34ef0f['Smtp']['authentication']){_0x3fc4a2[_0xb3c8('0xa4')]={'user':_0x34ef0f[_0xb3c8('0x58')]['user'],'pass':_0x34ef0f['Smtp'][_0xb3c8('0x73')]};}_0x3fc4a2[_0xb3c8('0x75')]=_0x34ef0f['Smtp'][_0xb3c8('0x75')];_0x3fc4a2[_0xb3c8('0x76')]=_0x34ef0f[_0xb3c8('0x58')][_0xb3c8('0x76')];_0x3fc4a2['secure']=_0x34ef0f[_0xb3c8('0x58')]['secure'];}else{_0x3fc4a2[_0xb3c8('0x77')]=_0x34ef0f[_0xb3c8('0x58')]['service'];_0x3fc4a2[_0xb3c8('0xa4')]={'user':_0x34ef0f['Smtp'][_0xb3c8('0x70')],'pass':_0x34ef0f[_0xb3c8('0x58')][_0xb3c8('0x73')]};}return respondWithRpcPromise('SendMail',_0xb3c8('0xa5'),{'account':_0x3fc4a2,'message':_0x4ef495[_0xb3c8('0x5b')]});}else{throw new Error(_0xb3c8('0xa6'));}}})[_0xb3c8('0x1e')](function(_0xeab068){if(_0xeab068){_0x7cc56d=_0xeab068;if(_0x5405af['List']){if(_0x5405af['List'][_0xb3c8('0x9b')][_0xb3c8('0x49')]){return _0x5405af[_0xb3c8('0xa7')][_0xb3c8('0x9b')][0x0];}else{return db['CmContact'][_0xb3c8('0x5f')](_['defaults'](_0x4ef495[_0xb3c8('0x5b')],{'firstName':_0x4ef495[_0xb3c8('0x5b')]['to'],'email':_0x4ef495['body']['to'],'phone':_0x4ef495[_0xb3c8('0x5b')]['to'],'ListId':_0x5405af[_0xb3c8('0xa8')]}));}}else{throw new Error(_0xb3c8('0xa6'));}}})[_0xb3c8('0x1e')](function(_0x51136f){if(_0x51136f){var _0x4de2e4={'UserId':_0x4ef495[_0xb3c8('0x70')]['id'],'ContactId':_0x51136f['id'],'MailAccountId':_0x5405af['id'],'inReplyTo':_0x7cc56d[_0xb3c8('0xa9')],'to':_0x4ef495[_0xb3c8('0x5b')][_0xb3c8('0x9e')],'cc':_0x4ef495[_0xb3c8('0x5b')]['cc'],'subject':_0x4ef495[_0xb3c8('0x5b')]['subject'],'attach':_0x4ef495[_0xb3c8('0x5b')][_0xb3c8('0xaa')],'firstMsgDirection':_0xb3c8('0xab'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_['merge'](_0x4ef495[_0xb3c8('0x5b')],{'messageId':_0x7cc56d['messageId'],'sentAt':moment()[_0xb3c8('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x5405af['id'],'UserId':_0x4ef495[_0xb3c8('0x70')]['id'],'ContactId':_0x51136f['id']})]};if(_0x4ef495[_0xb3c8('0x5b')]['Interaction']){_0x4de2e4=_['merge'](_0x4de2e4,_0x4ef495[_0xb3c8('0x5b')][_0xb3c8('0xac')]);}return db[_0xb3c8('0x88')][_0xb3c8('0x5f')](_0x4de2e4,{'include':[{'model':db[_0xb3c8('0x95')],'as':'Messages'}]});}})[_0xb3c8('0x1e')](respondWithResult(_0x2b6fe6,null))[_0xb3c8('0x25')](handleError(_0x2b6fe6,null));};exports[_0xb3c8('0xad')]=function(_0x429ea2,_0x48a234,_0x7865e1){return db['MailAccount'][_0xb3c8('0x59')]({'where':{'id':_0x429ea2[_0xb3c8('0x5c')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xb3c8('0x58'),'raw':!![]}]})[_0xb3c8('0x1e')](handleEntityNotFound(_0x48a234,null))[_0xb3c8('0x1e')](function(_0x25c1ea){if(_0x25c1ea&&_0x25c1ea[_0xb3c8('0x58')]){var _0x5e2677={'id':_0x25c1ea['id'],'tls':{'rejectUnauthorized':![]}};if(_0x25c1ea[_0xb3c8('0x58')][_0xb3c8('0x77')]){_0x5e2677[_0xb3c8('0x77')]=_0x25c1ea['Smtp'][_0xb3c8('0x77')];}else{_0x5e2677['host']=_0x25c1ea[_0xb3c8('0x58')]['host'];_0x5e2677[_0xb3c8('0x76')]=_0x25c1ea['Smtp'][_0xb3c8('0x76')];_0x5e2677[_0xb3c8('0xae')]=_0x25c1ea[_0xb3c8('0x58')][_0xb3c8('0xae')];}if(_0x25c1ea[_0xb3c8('0x58')][_0xb3c8('0xaf')]){_0x5e2677[_0xb3c8('0xa4')]={'user':_0x25c1ea['Smtp'][_0xb3c8('0x70')],'pass':_0x25c1ea[_0xb3c8('0x58')][_0xb3c8('0x73')]};}return respondWithRpcPromise(_0xb3c8('0xb0'),_0xb3c8('0xad'),{'account':_0x5e2677});}})['then'](respondWithResult(_0x48a234,null))[_0xb3c8('0x25')](handleError(_0x48a234,null));};exports[_0xb3c8('0x33')]=function(_0x2c0bf5,_0x6f9cb5){return db['MailAccount'][_0xb3c8('0x59')]({'where':{'id':_0x2c0bf5[_0xb3c8('0x5c')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x6f9cb5,null))['then'](function(_0x5839aa){if(_0x5839aa&&_0x5839aa[_0xb3c8('0x77')]){throw new db[(_0xb3c8('0xb1'))][(_0xb3c8('0xb2'))](_0xb3c8('0xb3'));}return _0x5839aa;})[_0xb3c8('0x1e')](removeEntity(_0x6f9cb5,null))[_0xb3c8('0x25')](handleError(_0x6f9cb5,null));};exports[_0xb3c8('0xb4')]=function(_0x4a4c23,_0x45763a,_0x224cb3){return db[_0xb3c8('0x3e')][_0xb3c8('0x59')]({'where':{'id':_0x4a4c23[_0xb3c8('0x5c')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x45763a,null))['then'](function(_0x29d7f1){if(_0x29d7f1){return _0x29d7f1[_0xb3c8('0xb4')](_0x4a4c23[_0xb3c8('0x5b')][_0xb3c8('0x66')],_[_0xb3c8('0xb5')](_0x4a4c23[_0xb3c8('0x5b')],['ids','id'])||{})['spread'](function(_0x480da1){for(var _0x2445a3=0x0;_0x2445a3<_0x4a4c23[_0xb3c8('0x5b')][_0xb3c8('0x66')][_0xb3c8('0x49')];_0x2445a3+=0x1){socket['emit']('userMailAccount:save',{'UserId':_0x4a4c23[_0xb3c8('0x5b')][_0xb3c8('0x66')][_0x2445a3],'MailAccountId':_0x4a4c23[_0xb3c8('0x5c')]['id']});}return _0x480da1;});}})[_0xb3c8('0x1e')](respondWithResult(_0x45763a,null))[_0xb3c8('0x25')](handleError(_0x45763a,null));};exports[_0xb3c8('0xb6')]=function(_0x545afd,_0x456568,_0x2b2897){return db[_0xb3c8('0x3e')]['find']({'where':{'id':_0x545afd['params']['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x456568,null))[_0xb3c8('0x1e')](function(_0x427ce3){if(_0x427ce3){return _0x427ce3['removeAgents'](_0x545afd['query'][_0xb3c8('0x66')])['then'](function(){if(_['isArray'](_0x545afd[_0xb3c8('0x43')][_0xb3c8('0x66')])){for(var _0x57cb02=0x0;_0x57cb02<_0x545afd['query'][_0xb3c8('0x66')]['length'];_0x57cb02+=0x1){socket[_0xb3c8('0xb7')](_0xb3c8('0xb8'),{'UserId':Number(_0x545afd[_0xb3c8('0x43')][_0xb3c8('0x66')][_0x57cb02]),'MailAccountId':Number(_0x545afd[_0xb3c8('0x5c')]['id'])});}}else{socket[_0xb3c8('0xb7')]('userMailAccount:remove',{'UserId':Number(_0x545afd[_0xb3c8('0x43')]['ids']),'MailAccountId':Number(_0x545afd[_0xb3c8('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x456568,null))[_0xb3c8('0x25')](handleError(_0x456568,null));};exports[_0xb3c8('0xb9')]=function(_0x2cc441,_0x955565,_0x4d3fb5){var _0x7dd296={};var _0x14e33c={};var _0x5d53c2;var _0x22a451;return db[_0xb3c8('0x3e')][_0xb3c8('0x61')]({'where':{'id':_0x2cc441[_0xb3c8('0x5c')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x955565,null))[_0xb3c8('0x1e')](function(_0x33e512){if(_0x33e512){_0x5d53c2=_0x33e512;_0x14e33c[_0xb3c8('0x46')]=_[_0xb3c8('0x44')](db[_0xb3c8('0xba')][_0xb3c8('0x3f')]);_0x14e33c[_0xb3c8('0x43')]=_[_0xb3c8('0x44')](_0x2cc441[_0xb3c8('0x43')]);_0x14e33c['filters']=_[_0xb3c8('0x45')](_0x14e33c[_0xb3c8('0x46')],_0x14e33c['query']);_0x7dd296[_0xb3c8('0x48')]=_[_0xb3c8('0x45')](_0x14e33c[_0xb3c8('0x46')],qs[_0xb3c8('0x47')](_0x2cc441[_0xb3c8('0x43')]['fields']));_0x7dd296['attributes']=_0x7dd296[_0xb3c8('0x48')][_0xb3c8('0x49')]?_0x7dd296[_0xb3c8('0x48')]:_0x14e33c[_0xb3c8('0x46')];_0x7dd296[_0xb3c8('0x4b')]=qs[_0xb3c8('0x4c')](_0x2cc441['query'][_0xb3c8('0x4c')]);_0x7dd296['where']=qs[_0xb3c8('0x4d')](_['pick'](_0x2cc441[_0xb3c8('0x43')],_0x14e33c['filters']));if(_0x2cc441[_0xb3c8('0x43')]['filter']){_0x7dd296['where']=_[_0xb3c8('0x50')](_0x7dd296[_0xb3c8('0x4f')],{'$or':_[_0xb3c8('0x3d')](_0x7dd296[_0xb3c8('0x48')],function(_0x4f70df){var _0x10d342={};_0x10d342[_0x4f70df]={'$like':'%'+_0x2cc441['query'][_0xb3c8('0x52')]+'%'};return _0x10d342;})});}_0x7dd296=_[_0xb3c8('0x50')]({},_0x7dd296,_0x2cc441['options']);return _0x5d53c2[_0xb3c8('0xb9')](_0x7dd296);}})['then'](function(_0x57b8a0){if(_0x57b8a0){_0x22a451=_0x57b8a0[_0xb3c8('0x49')];if(!_0x2cc441[_0xb3c8('0x43')]['hasOwnProperty']('nolimit')){_0x7dd296[_0xb3c8('0x2d')]=qs[_0xb3c8('0x2d')](_0x2cc441[_0xb3c8('0x43')][_0xb3c8('0x2d')]);_0x7dd296[_0xb3c8('0x2a')]=qs[_0xb3c8('0x2a')](_0x2cc441[_0xb3c8('0x43')][_0xb3c8('0x2a')]);}return _0x5d53c2['getAgents'](_0x7dd296);}})[_0xb3c8('0x1e')](function(_0x282faa){if(_0x282faa){return _0x282faa?{'count':_0x22a451,'rows':_0x282faa}:null;}})[_0xb3c8('0x1e')](respondWithResult(_0x955565,null))[_0xb3c8('0x25')](handleError(_0x955565,null));}; \ No newline at end of file +var _0xe354=['addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','zip-dir','fast-json-patch','moment','mustache','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','./mailAccount.socket','register','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','count','set','apply','reject','save','destroy','get','MailAccounts','UserProfileResource','sendStatus','stack','name','send','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','update','body','params','describe','addDisposition','MailAccountId','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','length','removeAnswers','create','key','email','ListId','isNil','active','description','cservice','cauthentication','user','pass','cpassword','authentication','host','port','service','cuser','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','addSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','server/files/attachments','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account'];(function(_0x1f46fd,_0x166f40){var _0x477cb1=function(_0x4c0e9a){while(--_0x4c0e9a){_0x1f46fd['push'](_0x1f46fd['shift']());}};_0x477cb1(++_0x166f40);}(_0xe354,0x187));var _0x4e35=function(_0x4552f6,_0x4c9dd2){_0x4552f6=_0x4552f6-0x0;var _0x4c4d14=_0xe354[_0x4552f6];return _0x4c4d14;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4e35('0x0'));var jsonpatch=require(_0x4e35('0x1'));var rp=require('request-promise');var moment=require(_0x4e35('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4e35('0x3'));var util=require(_0x4e35('0x4'));var path=require(_0x4e35('0x5'));var sox=require(_0x4e35('0x6'));var csv=require(_0x4e35('0x7'));var ejs=require(_0x4e35('0x8'));var fs=require('fs');var fs_extra=require(_0x4e35('0x9'));var _=require(_0x4e35('0xa'));var squel=require('squel');var crypto=require(_0x4e35('0xb'));var jsforce=require(_0x4e35('0xc'));var deskjs=require(_0x4e35('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4e35('0xe'));var htmlToText=require('html-to-text');var juice=require('juice');var Redis=require(_0x4e35('0xf'));var authService=require(_0x4e35('0x10'));var qs=require(_0x4e35('0x11'));var as=require(_0x4e35('0x12'));var hardwareService=require(_0x4e35('0x13'));var logger=require(_0x4e35('0x14'))(_0x4e35('0x15'));var utils=require(_0x4e35('0x16'));var config=require(_0x4e35('0x17'));var licenseUtil=require(_0x4e35('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4e35('0x19')](config[_0x4e35('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4e35('0x1a')]));require(_0x4e35('0x1b'))[_0x4e35('0x1c')](socket);var jayson=require(_0x4e35('0x1d'));var client=jayson[_0x4e35('0x1e')][_0x4e35('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0xfe9f0a,_0x579029,_0x307d65,_0x3377ec){return new BPromise(function(_0x4aa4c8,_0x112ecf){var _0x2a6103=_0x3377ec||client;return _0x2a6103['request'](_0xfe9f0a,_0x307d65)[_0x4e35('0x20')](function(_0x2270e4){logger[_0x4e35('0x21')]('MailAccount,\x20%s,\x20%s',_0x579029,'request\x20sent');logger[_0x4e35('0x22')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x579029,_0x4e35('0x23'),JSON[_0x4e35('0x24')](_0x2270e4));if(_0x2270e4[_0x4e35('0x25')]){if(_0x2270e4['error'][_0x4e35('0x26')]===0x1f4){logger[_0x4e35('0x25')](_0x4e35('0x27'),_0x579029,_0x2270e4[_0x4e35('0x25')]['message']);return _0x112ecf(_0x2270e4[_0x4e35('0x25')][_0x4e35('0x28')]);}logger[_0x4e35('0x25')](_0x4e35('0x27'),_0x579029,_0x2270e4[_0x4e35('0x25')][_0x4e35('0x28')]);return _0x4aa4c8(_0x2270e4[_0x4e35('0x25')][_0x4e35('0x28')]);}else{logger['info'](_0x4e35('0x27'),_0x579029,_0x4e35('0x23'));_0x4aa4c8(_0x2270e4[_0x4e35('0x29')][_0x4e35('0x28')]);}})[_0x4e35('0x2a')](function(_0x171533){logger['error']('MailAccount,\x20%s,\x20%s',_0x579029,_0x171533);_0x112ecf(_0x171533);});});}function respondWithStatusCode(_0x1c0bbb,_0x573d9d){_0x573d9d=_0x573d9d||0xcc;return function(_0x3e6805){if(_0x3e6805){return _0x1c0bbb['sendStatus'](_0x573d9d);}return _0x1c0bbb[_0x4e35('0x2b')](_0x573d9d)[_0x4e35('0x2c')]();};}function respondWithResult(_0x5e0a03,_0x1c0f71){_0x1c0f71=_0x1c0f71||0xc8;return function(_0x19a1b0){if(_0x19a1b0){return _0x5e0a03[_0x4e35('0x2b')](_0x1c0f71)[_0x4e35('0x2d')](_0x19a1b0);}};}function respondWithFilteredResult(_0x2b5505,_0x4689e7){return function(_0x1b89fa){if(_0x1b89fa){var _0x2afe93=typeof _0x4689e7[_0x4e35('0x2e')]==='undefined'&&typeof _0x4689e7[_0x4e35('0x2f')]==='undefined';var _0xef4db4=_0x1b89fa[_0x4e35('0x30')];var _0x32e07b=_0x2afe93?0x0:_0x4689e7[_0x4e35('0x2e')];var _0x49f217=_0x2afe93?_0x1b89fa['count']:_0x4689e7[_0x4e35('0x2e')]+_0x4689e7[_0x4e35('0x2f')];var _0x44637e;if(_0x49f217>=_0xef4db4){_0x49f217=_0xef4db4;_0x44637e=0xc8;}else{_0x44637e=0xce;}_0x2b5505[_0x4e35('0x2b')](_0x44637e);return _0x2b5505[_0x4e35('0x31')]('Content-Range',_0x32e07b+'-'+_0x49f217+'/'+_0xef4db4)[_0x4e35('0x2d')](_0x1b89fa);}return null;};}function patchUpdates(_0x2e4b5e){return function(_0x42154b){try{jsonpatch[_0x4e35('0x32')](_0x42154b,_0x2e4b5e,!![]);}catch(_0x2844af){return BPromise[_0x4e35('0x33')](_0x2844af);}return _0x42154b[_0x4e35('0x34')]();};}function saveUpdates(_0x516048,_0x138f27){return function(_0x3d4865){if(_0x3d4865){return _0x3d4865['update'](_0x516048)[_0x4e35('0x20')](function(_0x3cd9b3){return _0x3cd9b3;});}return null;};}function removeEntity(_0x102fb3,_0x24b672){return function(_0x4f45ad){if(_0x4f45ad){return _0x4f45ad[_0x4e35('0x35')]()[_0x4e35('0x20')](function(){var _0x44d792=_0x4f45ad[_0x4e35('0x36')]({'plain':!![]});var _0x39d19d=_0x4e35('0x37');return db[_0x4e35('0x38')][_0x4e35('0x35')]({'where':{'type':_0x39d19d,'resourceId':_0x44d792['id']}})[_0x4e35('0x20')](function(){return _0x4f45ad;});})['then'](function(){_0x102fb3['status'](0xcc)[_0x4e35('0x2c')]();});}};}function handleEntityNotFound(_0x3b52f7,_0x566b5e){return function(_0x31ef50){if(!_0x31ef50){_0x3b52f7[_0x4e35('0x39')](0x194);}return _0x31ef50;};}function handleError(_0x5dc260,_0x1bc142){_0x1bc142=_0x1bc142||0x1f4;return function(_0x14a2c7){logger['error'](_0x14a2c7[_0x4e35('0x3a')]);if(_0x14a2c7[_0x4e35('0x3b')]){delete _0x14a2c7['name'];}_0x5dc260[_0x4e35('0x2b')](_0x1bc142)[_0x4e35('0x3c')](_0x14a2c7);};}exports['index']=function(_0x43ed8d,_0x446ef0){var _0x24d17a={'include':[{'model':db[_0x4e35('0x3d')],'as':_0x4e35('0x3e')},{'model':db[_0x4e35('0x3f')],'as':_0x4e35('0x40')},{'model':db[_0x4e35('0x41')],'as':_0x4e35('0x42')}]},_0x48f526={},_0xd26f5b={'count':0x0,'rows':[]};var _0x17890c=_[_0x4e35('0x43')](db[_0x4e35('0x44')][_0x4e35('0x45')],function(_0x402236){return{'name':_0x402236['fieldName'],'type':_0x402236[_0x4e35('0x46')]['key']};});_0x48f526[_0x4e35('0x47')]=_[_0x4e35('0x43')](_0x17890c,_0x4e35('0x3b'));_0x48f526['query']=_[_0x4e35('0x48')](_0x43ed8d[_0x4e35('0x49')]);_0x48f526[_0x4e35('0x4a')]=_[_0x4e35('0x4b')](_0x48f526['model'],_0x48f526[_0x4e35('0x49')]);_0x24d17a[_0x4e35('0x4c')]=_[_0x4e35('0x4b')](_0x48f526[_0x4e35('0x47')],qs[_0x4e35('0x4d')](_0x43ed8d[_0x4e35('0x49')][_0x4e35('0x4d')]));_0x24d17a[_0x4e35('0x4c')]=_0x24d17a[_0x4e35('0x4c')]['length']?_0x24d17a['attributes']:_0x48f526[_0x4e35('0x47')];if(!_0x43ed8d['query']['hasOwnProperty'](_0x4e35('0x4e'))){_0x24d17a[_0x4e35('0x2f')]=qs['limit'](_0x43ed8d[_0x4e35('0x49')][_0x4e35('0x2f')]);_0x24d17a[_0x4e35('0x2e')]=qs[_0x4e35('0x2e')](_0x43ed8d['query'][_0x4e35('0x2e')]);}_0x24d17a[_0x4e35('0x4f')]=qs[_0x4e35('0x50')](_0x43ed8d[_0x4e35('0x49')][_0x4e35('0x50')]);_0x24d17a[_0x4e35('0x51')]=qs[_0x4e35('0x4a')](_[_0x4e35('0x52')](_0x43ed8d[_0x4e35('0x49')],_0x48f526[_0x4e35('0x4a')]),_0x17890c);if(_0x43ed8d[_0x4e35('0x49')][_0x4e35('0x53')]){_0x24d17a[_0x4e35('0x51')]=_[_0x4e35('0x54')](_0x24d17a['where'],{'$or':_[_0x4e35('0x43')](_0x17890c,function(_0x4d5391){if(_0x4d5391['type']!==_0x4e35('0x55')){var _0x3e84b4={};_0x3e84b4[_0x4d5391[_0x4e35('0x3b')]]={'$like':'%'+_0x43ed8d[_0x4e35('0x49')][_0x4e35('0x53')]+'%'};return _0x3e84b4;}})});}_0x24d17a=_[_0x4e35('0x54')]({},_0x24d17a,_0x43ed8d[_0x4e35('0x56')]);var _0x59bece={'where':_0x24d17a[_0x4e35('0x51')]};return db[_0x4e35('0x44')][_0x4e35('0x30')](_0x59bece)['then'](function(_0x549c17){_0xd26f5b[_0x4e35('0x30')]=_0x549c17;if(_0x43ed8d[_0x4e35('0x49')][_0x4e35('0x57')]){_0x24d17a[_0x4e35('0x58')]=[{'all':!![]}];}return db[_0x4e35('0x44')][_0x4e35('0x59')](_0x24d17a);})['then'](function(_0x295235){_0xd26f5b[_0x4e35('0x5a')]=_0x295235;return _0xd26f5b;})['then'](respondWithFilteredResult(_0x446ef0,_0x24d17a))[_0x4e35('0x2a')](handleError(_0x446ef0,null));};exports['show']=function(_0x35cd3d,_0x5d4c8e){var _0x1d4675={'raw':![],'where':{'id':_0x35cd3d['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x4e35('0x3e')},{'model':db['MailServerOut'],'as':_0x4e35('0x40')},{'model':db[_0x4e35('0x41')],'as':'mandatoryDispositionPause'}]},_0x246bff={};_0x246bff[_0x4e35('0x47')]=_[_0x4e35('0x48')](db[_0x4e35('0x44')]['rawAttributes']);_0x246bff['query']=_[_0x4e35('0x48')](_0x35cd3d[_0x4e35('0x49')]);_0x246bff[_0x4e35('0x4a')]=_[_0x4e35('0x4b')](_0x246bff[_0x4e35('0x47')],_0x246bff[_0x4e35('0x49')]);_0x1d4675[_0x4e35('0x4c')]=_['intersection'](_0x246bff[_0x4e35('0x47')],qs[_0x4e35('0x4d')](_0x35cd3d[_0x4e35('0x49')][_0x4e35('0x4d')]));_0x1d4675[_0x4e35('0x4c')]=_0x1d4675['attributes']['length']?_0x1d4675['attributes']:_0x246bff[_0x4e35('0x47')];if(_0x35cd3d[_0x4e35('0x49')][_0x4e35('0x57')]){_0x1d4675[_0x4e35('0x58')]=[{'all':!![]}];}_0x1d4675=_[_0x4e35('0x54')]({},_0x1d4675,_0x35cd3d[_0x4e35('0x56')]);return db[_0x4e35('0x44')][_0x4e35('0x5b')](_0x1d4675)[_0x4e35('0x20')](handleEntityNotFound(_0x5d4c8e,null))[_0x4e35('0x20')](respondWithResult(_0x5d4c8e,null))[_0x4e35('0x2a')](handleError(_0x5d4c8e,null));};exports[_0x4e35('0x5c')]=function(_0x2014de,_0xb592f7){if(_0x2014de[_0x4e35('0x5d')]['id']){delete _0x2014de[_0x4e35('0x5d')]['id'];}return db[_0x4e35('0x44')][_0x4e35('0x5b')]({'where':{'id':_0x2014de[_0x4e35('0x5e')]['id']},'include':[{'model':db[_0x4e35('0x3d')],'as':_0x4e35('0x3e')},{'model':db[_0x4e35('0x3f')],'as':_0x4e35('0x40')},{'model':db[_0x4e35('0x41')],'as':_0x4e35('0x42')}]})[_0x4e35('0x20')](handleEntityNotFound(_0xb592f7,null))['then'](saveUpdates(_0x2014de[_0x4e35('0x5d')],null))[_0x4e35('0x20')](function(_0x4775e8){if(_0x4775e8&&_0x2014de[_0x4e35('0x5d')][_0x4e35('0x3e')]){return db['MailServerIn'][_0x4e35('0x5c')](_0x2014de[_0x4e35('0x5d')][_0x4e35('0x3e')],{'where':{'MailAccountId':_0x4775e8['id']}})[_0x4e35('0x20')](function(){return _0x4775e8;});}return _0x4775e8;})[_0x4e35('0x20')](function(_0xe59808){if(_0xe59808&&_0x2014de[_0x4e35('0x5d')][_0x4e35('0x40')]){return db[_0x4e35('0x3f')][_0x4e35('0x5c')](_0x2014de[_0x4e35('0x5d')][_0x4e35('0x40')],{'where':{'MailAccountId':_0xe59808['id']}})[_0x4e35('0x20')](function(){return _0xe59808;});}return _0xe59808;})[_0x4e35('0x20')](respondWithResult(_0xb592f7,null))['catch'](handleError(_0xb592f7,null));};exports[_0x4e35('0x5f')]=function(_0x45e707,_0x28cfc1){return db[_0x4e35('0x44')]['describe']()[_0x4e35('0x20')](respondWithResult(_0x28cfc1,null))[_0x4e35('0x2a')](handleError(_0x28cfc1,null));};exports[_0x4e35('0x60')]=function(_0x4e36fe,_0x5a6114,_0x2bc88b){if(_0x4e36fe[_0x4e35('0x5d')]['id']){delete _0x4e36fe[_0x4e35('0x5d')]['id'];}return db[_0x4e35('0x44')]['find']({'where':{'id':_0x4e36fe[_0x4e35('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5a6114,null))[_0x4e35('0x20')](function(_0x51f832){if(_0x51f832){_0x4e36fe['body'][_0x4e35('0x61')]=_0x51f832['id'];return db['Disposition']['create'](_0x4e36fe[_0x4e35('0x5d')]);}})[_0x4e35('0x20')](respondWithResult(_0x5a6114,null))['catch'](handleError(_0x5a6114,null));};exports[_0x4e35('0x62')]=function(_0x902e8d,_0x193662,_0x3874f7){var _0x4ccf20={'raw':![],'where':{}};var _0x4cb411={};var _0x13570d={'count':0x0,'rows':[]};return db[_0x4e35('0x44')][_0x4e35('0x63')]({'where':{'id':_0x902e8d[_0x4e35('0x5e')]['id']}})[_0x4e35('0x20')](handleEntityNotFound(_0x193662,null))[_0x4e35('0x20')](function(_0x2fb95c){if(_0x2fb95c){_0x4cb411[_0x4e35('0x47')]=_[_0x4e35('0x48')](db['Disposition'][_0x4e35('0x45')]);_0x4cb411[_0x4e35('0x49')]=_['keys'](_0x902e8d[_0x4e35('0x49')]);_0x4cb411['filters']=_[_0x4e35('0x4b')](_0x4cb411[_0x4e35('0x47')],_0x4cb411[_0x4e35('0x49')]);_0x4ccf20[_0x4e35('0x4c')]=_[_0x4e35('0x4b')](_0x4cb411[_0x4e35('0x47')],qs[_0x4e35('0x4d')](_0x902e8d[_0x4e35('0x49')][_0x4e35('0x4d')]));_0x4ccf20[_0x4e35('0x4c')]=_0x4ccf20['attributes']['length']?_0x4ccf20[_0x4e35('0x4c')]:_0x4cb411[_0x4e35('0x47')];if(!_0x902e8d[_0x4e35('0x49')][_0x4e35('0x64')](_0x4e35('0x4e'))){_0x4ccf20[_0x4e35('0x2f')]=qs[_0x4e35('0x2f')](_0x902e8d[_0x4e35('0x49')][_0x4e35('0x2f')]);_0x4ccf20['offset']=qs['offset'](_0x902e8d[_0x4e35('0x49')][_0x4e35('0x2e')]);}_0x4ccf20[_0x4e35('0x4f')]=qs[_0x4e35('0x50')](_0x902e8d[_0x4e35('0x49')][_0x4e35('0x50')]);_0x4ccf20[_0x4e35('0x51')]=qs[_0x4e35('0x4a')](_[_0x4e35('0x52')](_0x902e8d[_0x4e35('0x49')],_0x4cb411['filters']));_0x4ccf20[_0x4e35('0x51')][_0x4e35('0x61')]=_0x2fb95c['id'];if(_0x902e8d[_0x4e35('0x49')][_0x4e35('0x53')]){_0x4ccf20['where']=_[_0x4e35('0x54')](_0x4ccf20[_0x4e35('0x51')],{'$or':_[_0x4e35('0x43')](_0x4ccf20[_0x4e35('0x4c')],function(_0x437c41){var _0x41ebc4={};_0x41ebc4[_0x437c41]={'$like':'%'+_0x902e8d[_0x4e35('0x49')][_0x4e35('0x53')]+'%'};return _0x41ebc4;})});}_0x4ccf20=_[_0x4e35('0x54')]({},_0x4ccf20,_0x902e8d[_0x4e35('0x56')]);return db['Disposition'][_0x4e35('0x30')]({'where':_0x4ccf20['where']})['then'](function(_0x2ae00e){_0x13570d[_0x4e35('0x30')]=_0x2ae00e;if(_0x902e8d[_0x4e35('0x49')][_0x4e35('0x57')]){_0x4ccf20['include']=[{'all':!![]}];}return db['Disposition'][_0x4e35('0x59')](_0x4ccf20);})[_0x4e35('0x20')](function(_0x266c9d){_0x13570d[_0x4e35('0x5a')]=_0x266c9d;return _0x13570d;});}})['then'](respondWithFilteredResult(_0x193662,_0x4ccf20))['catch'](handleError(_0x193662,null));};exports[_0x4e35('0x65')]=function(_0x1dbbd8,_0xae1451,_0x5c209f){return db[_0x4e35('0x44')][_0x4e35('0x5b')]({'where':{'id':_0x1dbbd8['params']['id']}})[_0x4e35('0x20')](handleEntityNotFound(_0xae1451,null))[_0x4e35('0x20')](function(_0x29005c){if(_0x29005c){return _0x29005c[_0x4e35('0x65')](_0x1dbbd8[_0x4e35('0x49')][_0x4e35('0x66')]);}})[_0x4e35('0x20')](respondWithStatusCode(_0xae1451,null))[_0x4e35('0x2a')](handleError(_0xae1451,null));};exports[_0x4e35('0x67')]=function(_0x20703a,_0x29cdc2,_0x2f85eb){if(_0x20703a[_0x4e35('0x5d')]['id']){delete _0x20703a['body']['id'];}return db[_0x4e35('0x44')][_0x4e35('0x5b')]({'where':{'id':_0x20703a[_0x4e35('0x5e')]['id']}})[_0x4e35('0x20')](handleEntityNotFound(_0x29cdc2,null))['then'](function(_0x181fc6){if(_0x181fc6){_0x20703a['body']['MailAccountId']=_0x181fc6['id'];return db[_0x4e35('0x68')]['create'](_0x20703a['body']);}})[_0x4e35('0x20')](respondWithResult(_0x29cdc2,null))[_0x4e35('0x2a')](handleError(_0x29cdc2,null));};exports[_0x4e35('0x69')]=function(_0xb8255c,_0x47a537,_0x53bd75){var _0x208e23={'raw':![],'where':{}};var _0x52f4be={};var _0x5db221={'count':0x0,'rows':[]};return db[_0x4e35('0x44')]['findOne']({'where':{'id':_0xb8255c['params']['id']}})['then'](handleEntityNotFound(_0x47a537,null))[_0x4e35('0x20')](function(_0x54fa0e){if(_0x54fa0e){_0x52f4be[_0x4e35('0x47')]=_[_0x4e35('0x48')](db['CannedAnswer'][_0x4e35('0x45')]);_0x52f4be[_0x4e35('0x49')]=_['keys'](_0xb8255c[_0x4e35('0x49')]);_0x52f4be['filters']=_[_0x4e35('0x4b')](_0x52f4be[_0x4e35('0x47')],_0x52f4be[_0x4e35('0x49')]);_0x208e23['attributes']=_[_0x4e35('0x4b')](_0x52f4be[_0x4e35('0x47')],qs[_0x4e35('0x4d')](_0xb8255c[_0x4e35('0x49')][_0x4e35('0x4d')]));_0x208e23[_0x4e35('0x4c')]=_0x208e23[_0x4e35('0x4c')][_0x4e35('0x6a')]?_0x208e23[_0x4e35('0x4c')]:_0x52f4be[_0x4e35('0x47')];if(!_0xb8255c['query'][_0x4e35('0x64')](_0x4e35('0x4e'))){_0x208e23[_0x4e35('0x2f')]=qs[_0x4e35('0x2f')](_0xb8255c['query'][_0x4e35('0x2f')]);_0x208e23['offset']=qs[_0x4e35('0x2e')](_0xb8255c[_0x4e35('0x49')][_0x4e35('0x2e')]);}_0x208e23['order']=qs[_0x4e35('0x50')](_0xb8255c['query'][_0x4e35('0x50')]);_0x208e23[_0x4e35('0x51')]=qs[_0x4e35('0x4a')](_[_0x4e35('0x52')](_0xb8255c[_0x4e35('0x49')],_0x52f4be['filters']));_0x208e23[_0x4e35('0x51')][_0x4e35('0x61')]=_0x54fa0e['id'];if(_0xb8255c[_0x4e35('0x49')]['filter']){_0x208e23[_0x4e35('0x51')]=_['merge'](_0x208e23['where'],{'$or':_[_0x4e35('0x43')](_0x208e23[_0x4e35('0x4c')],function(_0x2b68fb){var _0x5b0938={};_0x5b0938[_0x2b68fb]={'$like':'%'+_0xb8255c[_0x4e35('0x49')][_0x4e35('0x53')]+'%'};return _0x5b0938;})});}_0x208e23=_['merge']({},_0x208e23,_0xb8255c[_0x4e35('0x56')]);return db[_0x4e35('0x68')][_0x4e35('0x30')]({'where':_0x208e23[_0x4e35('0x51')]})[_0x4e35('0x20')](function(_0x95d5c4){_0x5db221[_0x4e35('0x30')]=_0x95d5c4;if(_0xb8255c[_0x4e35('0x49')][_0x4e35('0x57')]){_0x208e23['include']=[{'all':!![]}];}return db[_0x4e35('0x68')][_0x4e35('0x59')](_0x208e23);})[_0x4e35('0x20')](function(_0x229879){_0x5db221[_0x4e35('0x5a')]=_0x229879;return _0x5db221;});}})['then'](respondWithFilteredResult(_0x47a537,_0x208e23))[_0x4e35('0x2a')](handleError(_0x47a537,null));};exports[_0x4e35('0x6b')]=function(_0x44eb6a,_0x44bb10,_0x4a05c4){return db[_0x4e35('0x44')][_0x4e35('0x5b')]({'where':{'id':_0x44eb6a['params']['id']}})[_0x4e35('0x20')](handleEntityNotFound(_0x44bb10,null))[_0x4e35('0x20')](function(_0x2282ae){if(_0x2282ae){return _0x2282ae[_0x4e35('0x6b')](_0x44eb6a[_0x4e35('0x49')][_0x4e35('0x66')]);}})[_0x4e35('0x20')](respondWithStatusCode(_0x44bb10,null))[_0x4e35('0x2a')](handleError(_0x44bb10,null));};exports[_0x4e35('0x6c')]=function(_0x10a138,_0x2caf41){var _0x5ac864={'name':_0x10a138['body'][_0x4e35('0x3b')],'key':_0x10a138[_0x4e35('0x5d')][_0x4e35('0x6d')],'email':_0x10a138[_0x4e35('0x5d')][_0x4e35('0x6e')],'ListId':_0x10a138[_0x4e35('0x5d')][_0x4e35('0x6f')],'active':!_[_0x4e35('0x70')](_0x10a138[_0x4e35('0x5d')][_0x4e35('0x71')])?_0x10a138[_0x4e35('0x5d')][_0x4e35('0x71')]:!![],'description':_0x10a138[_0x4e35('0x5d')][_0x4e35('0x72')]||null,'Imap':{},'Smtp':{}};if(_[_0x4e35('0x70')](_0x10a138[_0x4e35('0x5d')][_0x4e35('0x73')])){if(_0x10a138[_0x4e35('0x5d')][_0x4e35('0x74')]){_0x5ac864[_0x4e35('0x3e')][_0x4e35('0x75')]=_0x5ac864[_0x4e35('0x40')][_0x4e35('0x75')]=_0x10a138[_0x4e35('0x5d')]['cuser'];_0x5ac864[_0x4e35('0x3e')]['password']=_0x5ac864[_0x4e35('0x40')][_0x4e35('0x76')]=_0x10a138[_0x4e35('0x5d')][_0x4e35('0x77')];}else{_0x5ac864[_0x4e35('0x3e')][_0x4e35('0x78')]=_0x5ac864['Smtp'][_0x4e35('0x78')]=![];}_0x5ac864[_0x4e35('0x3e')][_0x4e35('0x79')]=_0x10a138['body'][_0x4e35('0x3e')][_0x4e35('0x79')];_0x5ac864[_0x4e35('0x3e')][_0x4e35('0x7a')]=_0x10a138[_0x4e35('0x5d')][_0x4e35('0x3e')][_0x4e35('0x7a')];_0x5ac864[_0x4e35('0x40')]['host']=_0x10a138['body']['Smtp'][_0x4e35('0x79')];_0x5ac864[_0x4e35('0x40')][_0x4e35('0x7a')]=_0x10a138['body'][_0x4e35('0x40')][_0x4e35('0x7a')];}else{_0x5ac864[_0x4e35('0x3e')][_0x4e35('0x7b')]=_0x5ac864['Smtp']['service']=_0x10a138[_0x4e35('0x5d')][_0x4e35('0x73')];_0x5ac864[_0x4e35('0x3e')][_0x4e35('0x75')]=_0x5ac864['Smtp'][_0x4e35('0x75')]=_0x10a138[_0x4e35('0x5d')][_0x4e35('0x7c')];_0x5ac864[_0x4e35('0x3e')][_0x4e35('0x7d')]=_0x5ac864[_0x4e35('0x40')]['pass']=_0x10a138[_0x4e35('0x5d')]['cpassword'];}return db[_0x4e35('0x44')][_0x4e35('0x6c')](_0x5ac864,{'include':[{'model':db[_0x4e35('0x3f')],'as':_0x4e35('0x40')},{'model':db[_0x4e35('0x3d')],'as':_0x4e35('0x3e')}]})[_0x4e35('0x20')](function(_0x252a4d){var _0x5230ab=_0x10a138[_0x4e35('0x75')][_0x4e35('0x36')]({'plain':!![]});if(!_0x5230ab)throw new Error(_0x4e35('0x7e'));if(_0x5230ab[_0x4e35('0x7f')]==='user'){var _0x4355d1=_0x252a4d[_0x4e35('0x36')]({'plain':!![]});return db[_0x4e35('0x80')][_0x4e35('0x5b')]({'where':{'name':_0x4e35('0x37'),'userProfileId':_0x5230ab['userProfileId']},'raw':!![]})[_0x4e35('0x20')](function(_0x22199b){if(_0x22199b&&_0x22199b[_0x4e35('0x81')]===0x0){return db[_0x4e35('0x38')]['create']({'name':_0x4355d1[_0x4e35('0x3b')],'resourceId':_0x4355d1['id'],'type':_0x22199b[_0x4e35('0x3b')],'sectionId':_0x22199b['id']},{})['then'](function(){return _0x252a4d;});}else{return _0x252a4d;}})[_0x4e35('0x2a')](function(_0x531f92){logger[_0x4e35('0x25')](_0x4e35('0x82'),_0x531f92);throw _0x531f92;});}return _0x252a4d;})['then'](respondWithResult(_0x2caf41,0xc9))[_0x4e35('0x2a')](handleError(_0x2caf41,null));};exports[_0x4e35('0x83')]=function(_0x83c3a5,_0x33bb9a,_0x4a4d0c){return db['MailAccount'][_0x4e35('0x63')]({'where':{'id':_0x83c3a5['params']['id']}})['then'](handleEntityNotFound(_0x33bb9a,null))['then'](function(_0x237c2f){if(_0x237c2f){return _0x237c2f[_0x4e35('0x83')]();}return null;})[_0x4e35('0x20')](respondWithResult(_0x33bb9a,null))[_0x4e35('0x2a')](handleError(_0x33bb9a,null));};exports[_0x4e35('0x84')]=function(_0x5d0675,_0x28cca4,_0x26e18e){if(_0x5d0675[_0x4e35('0x5d')]['id']){delete _0x5d0675[_0x4e35('0x5d')]['id'];}return db['MailAccount'][_0x4e35('0x5b')]({'where':{'id':_0x5d0675[_0x4e35('0x5e')]['id']}})['then'](handleEntityNotFound(_0x28cca4,null))['then'](function(_0x118844){if(_0x118844){_0x5d0675[_0x4e35('0x5d')][_0x4e35('0x61')]=_0x118844['id'];return db[_0x4e35('0x3d')][_0x4e35('0x6c')](_0x5d0675[_0x4e35('0x5d')]);}})[_0x4e35('0x20')](respondWithResult(_0x28cca4,null))[_0x4e35('0x2a')](handleError(_0x28cca4,null));};exports[_0x4e35('0x85')]=function(_0xac9638,_0x4dc637,_0x100045){return db[_0x4e35('0x44')][_0x4e35('0x63')]({'where':{'id':_0xac9638[_0x4e35('0x5e')]['id']}})[_0x4e35('0x20')](handleEntityNotFound(_0x4dc637,null))[_0x4e35('0x20')](function(_0xc005e7){if(_0xc005e7){return _0xc005e7['setImap'](null);}return null;})[_0x4e35('0x20')](respondWithStatusCode(_0x4dc637,null))[_0x4e35('0x2a')](handleError(_0x4dc637,null));};exports['getSmtp']=function(_0x28b6d6,_0xe90ad7,_0xab6cd2){return db[_0x4e35('0x44')][_0x4e35('0x63')]({'where':{'id':_0x28b6d6[_0x4e35('0x5e')]['id']}})[_0x4e35('0x20')](handleEntityNotFound(_0xe90ad7,null))[_0x4e35('0x20')](function(_0x450259){if(_0x450259){return _0x450259['getSmtp']();}return null;})[_0x4e35('0x20')](respondWithResult(_0xe90ad7,null))[_0x4e35('0x2a')](handleError(_0xe90ad7,null));};exports[_0x4e35('0x86')]=function(_0x5903f9,_0x1647d4,_0x31cc3d){if(_0x5903f9[_0x4e35('0x5d')]['id']){delete _0x5903f9['body']['id'];}return db['MailAccount'][_0x4e35('0x5b')]({'where':{'id':_0x5903f9[_0x4e35('0x5e')]['id']}})[_0x4e35('0x20')](handleEntityNotFound(_0x1647d4,null))[_0x4e35('0x20')](function(_0x36ade7){if(_0x36ade7){_0x5903f9['body']['MailAccountId']=_0x36ade7['id'];return db[_0x4e35('0x3f')][_0x4e35('0x6c')](_0x5903f9[_0x4e35('0x5d')]);}})['then'](respondWithResult(_0x1647d4,null))[_0x4e35('0x2a')](handleError(_0x1647d4,null));};exports['removeSmtp']=function(_0x560e18,_0x1ab113,_0x5acbd9){return db[_0x4e35('0x44')]['findOne']({'where':{'id':_0x560e18[_0x4e35('0x5e')]['id']}})[_0x4e35('0x20')](handleEntityNotFound(_0x1ab113,null))[_0x4e35('0x20')](function(_0x3bb63a){if(_0x3bb63a){return _0x3bb63a[_0x4e35('0x87')](null);}return null;})[_0x4e35('0x20')](respondWithStatusCode(_0x1ab113,null))['catch'](handleError(_0x1ab113,null));};exports[_0x4e35('0x88')]=function(_0x18819a,_0x1dc488,_0x3939ce){return db[_0x4e35('0x89')]['find']({'where':{'id':_0x18819a[_0x4e35('0x5e')]['id']}})[_0x4e35('0x20')](handleEntityNotFound(_0x1dc488,null))[_0x4e35('0x20')](function(_0x54e952){if(_0x54e952){return _0x54e952[_0x4e35('0x88')](_0x18819a[_0x4e35('0x5d')][_0x4e35('0x66')],_['omit'](_0x18819a[_0x4e35('0x5d')],[_0x4e35('0x66'),'id'])||{});}})[_0x4e35('0x20')](respondWithResult(_0x1dc488,null))[_0x4e35('0x2a')](handleError(_0x1dc488,null));};exports[_0x4e35('0x8a')]=function(_0x18f9ae,_0x2a7b7f,_0x2fff17){var _0x543e13={'raw':![],'where':{}};var _0xe7754a={};var _0x17b224={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x18f9ae[_0x4e35('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2a7b7f,null))[_0x4e35('0x20')](function(_0x1b53eb){if(_0x1b53eb){_0xe7754a[_0x4e35('0x47')]=_[_0x4e35('0x48')](db[_0x4e35('0x89')][_0x4e35('0x45')]);_0xe7754a['query']=_[_0x4e35('0x48')](_0x18f9ae[_0x4e35('0x49')]);_0xe7754a['filters']=_[_0x4e35('0x4b')](_0xe7754a[_0x4e35('0x47')],_0xe7754a[_0x4e35('0x49')]);_0x543e13[_0x4e35('0x4c')]=_['intersection'](_0xe7754a[_0x4e35('0x47')],qs[_0x4e35('0x4d')](_0x18f9ae[_0x4e35('0x49')][_0x4e35('0x4d')]));_0x543e13['attributes']=_0x543e13[_0x4e35('0x4c')][_0x4e35('0x6a')]?_0x543e13['attributes']:_0xe7754a[_0x4e35('0x47')];if(!_0x18f9ae[_0x4e35('0x49')][_0x4e35('0x64')]('nolimit')){_0x543e13[_0x4e35('0x2f')]=qs[_0x4e35('0x2f')](_0x18f9ae[_0x4e35('0x49')][_0x4e35('0x2f')]);_0x543e13[_0x4e35('0x2e')]=qs['offset'](_0x18f9ae[_0x4e35('0x49')][_0x4e35('0x2e')]);}_0x543e13[_0x4e35('0x4f')]=qs['sort'](_0x18f9ae[_0x4e35('0x49')][_0x4e35('0x50')]);_0x543e13[_0x4e35('0x51')]=qs[_0x4e35('0x4a')](_['pick'](_0x18f9ae[_0x4e35('0x49')],_0xe7754a[_0x4e35('0x4a')]));_0x543e13[_0x4e35('0x51')][_0x4e35('0x61')]=_0x1b53eb['id'];if(_0x18f9ae[_0x4e35('0x49')]['filter']){_0x543e13[_0x4e35('0x51')]=_[_0x4e35('0x54')](_0x543e13['where'],{'$or':_[_0x4e35('0x43')](_0x543e13['attributes'],function(_0x115234){var _0x11676f={};_0x11676f[_0x115234]={'$like':'%'+_0x18f9ae[_0x4e35('0x49')][_0x4e35('0x53')]+'%'};return _0x11676f;})});}_0x543e13=_[_0x4e35('0x54')]({},_0x543e13,_0x18f9ae[_0x4e35('0x56')]);return db[_0x4e35('0x89')][_0x4e35('0x30')]({'where':_0x543e13[_0x4e35('0x51')]})[_0x4e35('0x20')](function(_0x3ba870){_0x17b224[_0x4e35('0x30')]=_0x3ba870;if(_0x18f9ae[_0x4e35('0x49')][_0x4e35('0x57')]){_0x543e13[_0x4e35('0x58')]=[{'model':db[_0x4e35('0x8b')],'as':_0x4e35('0x8c'),'required':![]},{'model':db[_0x4e35('0x8d')],'as':'Owner','attributes':[_0x4e35('0x3b'),_0x4e35('0x8e'),_0x4e35('0x8f')],'required':![]},{'model':db[_0x4e35('0x90')],'as':_0x4e35('0x91'),'attributes':['id','name',_0x4e35('0x92')],'where':_0x18f9ae[_0x4e35('0x49')][_0x4e35('0x93')]?{'id':_0x18f9ae[_0x4e35('0x49')][_0x4e35('0x93')]}:undefined,'required':_0x18f9ae[_0x4e35('0x49')][_0x4e35('0x93')]?!![]:![]}];}return db[_0x4e35('0x89')][_0x4e35('0x59')](_0x543e13);})[_0x4e35('0x20')](function(_0x324abc){_0x17b224[_0x4e35('0x5a')]=_0x324abc;return _0x17b224;});}})[_0x4e35('0x20')](respondWithFilteredResult(_0x2a7b7f,_0x543e13))[_0x4e35('0x2a')](handleError(_0x2a7b7f,null));};exports['addApplications']=function(_0x4e6461,_0x48490c,_0x41418b){return db[_0x4e35('0x44')][_0x4e35('0x63')]({'where':{'id':_0x4e6461[_0x4e35('0x5e')]['id']}})[_0x4e35('0x20')](handleEntityNotFound(_0x48490c,null))[_0x4e35('0x20')](function(_0x1683fa){if(_0x1683fa){return db[_0x4e35('0x94')]['transaction'](function(_0x45b0ca){return db[_0x4e35('0x95')][_0x4e35('0x35')]({'where':{'MailAccountId':_0x4e6461[_0x4e35('0x5e')]['id']},'transaction':_0x45b0ca})[_0x4e35('0x20')](function(_0x4bea3a){var _0x1c3b44=_[_0x4e35('0x43')](_0x4e6461[_0x4e35('0x5d')],function(_0xbe9241){_0xbe9241['MailAccountId']=_0x4e6461[_0x4e35('0x5e')]['id'];return _0xbe9241;});return db['MailApplication'][_0x4e35('0x96')](_0x1c3b44,{'transaction':_0x45b0ca});});})[_0x4e35('0x20')](function(){return db['MailApplication'][_0x4e35('0x97')]({'where':{'MailAccountId':_0x4e6461[_0x4e35('0x5e')]['id']},'order':_0x4e35('0x98')});});}})[_0x4e35('0x20')](respondWithResult(_0x48490c,null))[_0x4e35('0x2a')](handleError(_0x48490c,null));};exports['getApplications']=function(_0x45760d,_0x14b6d8,_0x2406c3){var _0x3b918f={};var _0x4009f5={};var _0x4c830c;var _0x484886;return db[_0x4e35('0x44')][_0x4e35('0x63')]({'where':{'id':_0x45760d[_0x4e35('0x5e')]['id']}})['then'](handleEntityNotFound(_0x14b6d8,null))[_0x4e35('0x20')](function(_0x362bd8){if(_0x362bd8){_0x4c830c=_0x362bd8;_0x4009f5[_0x4e35('0x47')]=_[_0x4e35('0x48')](db[_0x4e35('0x95')]['rawAttributes']);_0x4009f5['query']=_[_0x4e35('0x48')](_0x45760d[_0x4e35('0x49')]);_0x4009f5[_0x4e35('0x4a')]=_[_0x4e35('0x4b')](_0x4009f5[_0x4e35('0x47')],_0x4009f5[_0x4e35('0x49')]);_0x3b918f[_0x4e35('0x4c')]=_[_0x4e35('0x4b')](_0x4009f5[_0x4e35('0x47')],qs[_0x4e35('0x4d')](_0x45760d[_0x4e35('0x49')][_0x4e35('0x4d')]));_0x3b918f[_0x4e35('0x4c')]=_0x3b918f['attributes'][_0x4e35('0x6a')]?_0x3b918f[_0x4e35('0x4c')]:_0x4009f5[_0x4e35('0x47')];_0x3b918f['order']=qs[_0x4e35('0x50')](_0x45760d[_0x4e35('0x49')][_0x4e35('0x50')]);_0x3b918f[_0x4e35('0x51')]=qs[_0x4e35('0x4a')](_[_0x4e35('0x52')](_0x45760d['query'],_0x4009f5[_0x4e35('0x4a')]));if(_0x45760d['query'][_0x4e35('0x53')]){_0x3b918f[_0x4e35('0x51')]=_[_0x4e35('0x54')](_0x3b918f[_0x4e35('0x51')],{'$or':_['map'](_0x3b918f[_0x4e35('0x4c')],function(_0x111cab){var _0x406dd2={};_0x406dd2[_0x111cab]={'$like':'%'+_0x45760d[_0x4e35('0x49')][_0x4e35('0x53')]+'%'};return _0x406dd2;})});}_0x3b918f=_['merge']({},_0x3b918f,_0x45760d[_0x4e35('0x56')]);return _0x4c830c[_0x4e35('0x99')](_0x3b918f);}})[_0x4e35('0x20')](function(_0x12d6ed){if(_0x12d6ed){_0x484886=_0x12d6ed['length'];if(!_0x45760d[_0x4e35('0x49')]['hasOwnProperty'](_0x4e35('0x4e'))){_0x3b918f[_0x4e35('0x2f')]=qs[_0x4e35('0x2f')](_0x45760d[_0x4e35('0x49')][_0x4e35('0x2f')]);_0x3b918f[_0x4e35('0x2e')]=qs[_0x4e35('0x2e')](_0x45760d['query'][_0x4e35('0x2e')]);}return _0x4c830c['getApplications'](_0x3b918f);}})[_0x4e35('0x20')](function(_0x29ad6c){if(_0x29ad6c){return _0x29ad6c?{'count':_0x484886,'rows':_0x29ad6c}:null;}})['then'](respondWithResult(_0x14b6d8,null))[_0x4e35('0x2a')](handleError(_0x14b6d8,null));};exports[_0x4e35('0x9a')]=function(_0x2f57b8,_0x1eb692,_0x230fb8){var _0x197645={'raw':!![],'where':{}};var _0x3240d2={};var _0x1ce618={'count':0x0,'rows':[]};return db[_0x4e35('0x44')]['findOne']({'where':{'id':_0x2f57b8[_0x4e35('0x5e')]['id']}})[_0x4e35('0x20')](handleEntityNotFound(_0x1eb692,null))[_0x4e35('0x20')](function(_0x412546){if(_0x412546){_0x3240d2[_0x4e35('0x47')]=_[_0x4e35('0x48')](db[_0x4e35('0x9b')]['rawAttributes']);_0x3240d2[_0x4e35('0x49')]=_['keys'](_0x2f57b8[_0x4e35('0x49')]);_0x3240d2[_0x4e35('0x4a')]=_[_0x4e35('0x4b')](_0x3240d2[_0x4e35('0x47')],_0x3240d2[_0x4e35('0x49')]);_0x197645['attributes']=_['intersection'](_0x3240d2[_0x4e35('0x47')],qs[_0x4e35('0x4d')](_0x2f57b8[_0x4e35('0x49')][_0x4e35('0x4d')]));_0x197645['attributes']=_0x197645[_0x4e35('0x4c')][_0x4e35('0x6a')]?_0x197645[_0x4e35('0x4c')]:_0x3240d2[_0x4e35('0x47')];if(!_0x2f57b8[_0x4e35('0x49')][_0x4e35('0x64')](_0x4e35('0x4e'))){_0x197645[_0x4e35('0x2f')]=qs[_0x4e35('0x2f')](_0x2f57b8['query'][_0x4e35('0x2f')]);_0x197645[_0x4e35('0x2e')]=qs[_0x4e35('0x2e')](_0x2f57b8['query'][_0x4e35('0x2e')]);}_0x197645[_0x4e35('0x4f')]=qs['sort'](_0x2f57b8[_0x4e35('0x49')]['sort']);_0x197645[_0x4e35('0x51')]=qs[_0x4e35('0x4a')](_['pick'](_0x2f57b8[_0x4e35('0x49')],_0x3240d2[_0x4e35('0x4a')]));_0x197645[_0x4e35('0x51')][_0x4e35('0x61')]=_0x412546['id'];if(_0x2f57b8[_0x4e35('0x49')]['filter']){_0x197645['where']=_[_0x4e35('0x54')](_0x197645['where'],{'$or':_['map'](_0x197645[_0x4e35('0x4c')],function(_0x1b9c87){var _0x19575d={};_0x19575d[_0x1b9c87]={'$like':'%'+_0x2f57b8['query'][_0x4e35('0x53')]+'%'};return _0x19575d;})});}if(_0x2f57b8['query'][_0x4e35('0x9c')]){var _0x3b55e6=_0x2f57b8[_0x4e35('0x49')]['$gte'][_0x4e35('0x9d')](',');var _0x107563={};_0x107563[_0x3b55e6[0x0]]={'$gte':moment(_0x3b55e6[0x1])[_0x4e35('0x9e')](_0x4e35('0x9f'))};_0x197645[_0x4e35('0x51')]=_[_0x4e35('0x54')](_0x197645[_0x4e35('0x51')],_0x107563);}_0x197645=_[_0x4e35('0x54')]({},_0x197645,_0x2f57b8[_0x4e35('0x56')]);return db[_0x4e35('0x9b')][_0x4e35('0x30')]({'where':_0x197645[_0x4e35('0x51')]})['then'](function(_0x2374a6){_0x1ce618[_0x4e35('0x30')]=_0x2374a6;if(_0x2f57b8['query'][_0x4e35('0x57')]){_0x197645[_0x4e35('0x58')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x197645);})[_0x4e35('0x20')](function(_0x51d3c4){if(_0x2f57b8['query'][_0x4e35('0xa0')]===_0x4e35('0xa1')){for(var _0x120e60=0x0;_0x120e60<_0x51d3c4[_0x4e35('0x6a')];_0x120e60++){_0x51d3c4[_0x120e60]['body']=juice(_0x51d3c4[_0x120e60][_0x4e35('0x5d')]);}}_0x1ce618['rows']=_0x51d3c4;return _0x1ce618;});}})[_0x4e35('0x20')](respondWithFilteredResult(_0x1eb692,_0x197645))['catch'](handleError(_0x1eb692,null));};exports['send']=function(_0x592f81,_0x57c271,_0x735a49){var _0x218446,_0x551260={},_0x1fc8bf;if(_0x592f81[_0x4e35('0x5d')]['to']){_0x1fc8bf=_0x592f81[_0x4e35('0x5d')]['to'][_0x4e35('0x9d')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x592f81[_0x4e35('0x5e')]['id']},'include':[{'model':db[_0x4e35('0xa2')],'as':_0x4e35('0xa3'),'include':[{'model':db[_0x4e35('0x8b')],'as':_0x4e35('0xa4'),'where':{'email':_0x1fc8bf},'limit':0x1,'order':[[_0x4e35('0xa5'),_0x4e35('0xa6')]]}]},{'model':db[_0x4e35('0x3f')],'as':_0x4e35('0x40'),'raw':!![]}]})[_0x4e35('0x20')](handleEntityNotFound(_0x57c271,null))['then'](function(_0x4656e3){if(_0x4656e3){_0x218446=_0x4656e3;if(_0x4656e3[_0x4e35('0x40')]){if(_[_0x4e35('0x70')](_0x592f81[_0x4e35('0x5d')]['from'])){_0x592f81['body'][_0x4e35('0xa7')]=util[_0x4e35('0x9e')](_0x4e35('0xa8'),_0x4656e3[_0x4e35('0x3b')],_0x4656e3['email']||_0x4656e3[_0x4e35('0x40')][_0x4e35('0x75')]);}if(_0x592f81[_0x4e35('0x5d')]['attachments']&&_0x592f81[_0x4e35('0x5d')][_0x4e35('0xa9')][_0x4e35('0x6a')]){for(var _0x5b9c3e=0x0;_0x5b9c3e<_0x592f81['body'][_0x4e35('0xa9')][_0x4e35('0x6a')];_0x5b9c3e+=0x1){_0x592f81['body'][_0x4e35('0xa9')][_0x5b9c3e]={'filename':_0x592f81[_0x4e35('0x5d')][_0x4e35('0xa9')][_0x5b9c3e][_0x4e35('0x3b')],'path':path['join'](config['root'],_0x4e35('0xaa'),_0x592f81['body'][_0x4e35('0xa9')][_0x5b9c3e]['basename'])};}}var _0x2acc3f={'tls':{'rejectUnauthorized':![]}};if(_[_0x4e35('0x70')](_0x4656e3[_0x4e35('0x40')][_0x4e35('0x7b')])){if(_0x4656e3['Smtp']['authentication']){_0x2acc3f[_0x4e35('0xab')]={'user':_0x4656e3[_0x4e35('0x40')][_0x4e35('0x75')],'pass':_0x4656e3[_0x4e35('0x40')][_0x4e35('0x76')]};}_0x2acc3f['host']=_0x4656e3[_0x4e35('0x40')][_0x4e35('0x79')];_0x2acc3f[_0x4e35('0x7a')]=_0x4656e3['Smtp'][_0x4e35('0x7a')];_0x2acc3f[_0x4e35('0xac')]=_0x4656e3[_0x4e35('0x40')][_0x4e35('0xac')];}else{_0x2acc3f[_0x4e35('0x7b')]=_0x4656e3[_0x4e35('0x40')][_0x4e35('0x7b')];_0x2acc3f[_0x4e35('0xab')]={'user':_0x4656e3[_0x4e35('0x40')][_0x4e35('0x75')],'pass':_0x4656e3['Smtp'][_0x4e35('0x76')]};}return respondWithRpcPromise(_0x4e35('0xad'),_0x4e35('0xae'),{'account':_0x2acc3f,'message':_0x592f81[_0x4e35('0x5d')]});}else{throw new Error(_0x4e35('0xaf'));}}})['then'](function(_0x3631d7){if(_0x3631d7){_0x551260=_0x3631d7;if(_0x218446[_0x4e35('0xa3')]){if(_0x218446[_0x4e35('0xa3')][_0x4e35('0xa4')][_0x4e35('0x6a')]){return _0x218446[_0x4e35('0xa3')]['Contacts'][0x0];}else{return db[_0x4e35('0x8b')]['create'](_[_0x4e35('0x19')](_0x592f81[_0x4e35('0x5d')],{'firstName':_0x592f81[_0x4e35('0x5d')]['to'],'email':_0x592f81[_0x4e35('0x5d')]['to'],'phone':_0x592f81[_0x4e35('0x5d')]['to'],'ListId':_0x218446['ListId']}));}}else{throw new Error('List\x20not\x20found');}}})[_0x4e35('0x20')](function(_0x4253ab){if(_0x4253ab){var _0x4b4e4a={'UserId':_0x592f81['user']['id'],'ContactId':_0x4253ab['id'],'MailAccountId':_0x218446['id'],'inReplyTo':_0x551260[_0x4e35('0xb0')],'to':_0x592f81[_0x4e35('0x5d')]['from'],'cc':_0x592f81[_0x4e35('0x5d')]['cc'],'subject':_0x592f81['body'][_0x4e35('0xb1')],'attach':_0x592f81[_0x4e35('0x5d')][_0x4e35('0xb2')],'firstMsgDirection':_0x4e35('0xb3'),'lastMsgAt':moment()['format'](_0x4e35('0x9f')),'lastMsgDirection':_0x4e35('0xb3'),'Messages':[_[_0x4e35('0x54')](_0x592f81[_0x4e35('0x5d')],{'messageId':_0x551260[_0x4e35('0xb0')],'sentAt':moment()[_0x4e35('0x9e')](_0x4e35('0x9f')),'read':!![],'MailAccountId':_0x218446['id'],'UserId':_0x592f81[_0x4e35('0x75')]['id'],'ContactId':_0x4253ab['id']})]};if(_0x592f81[_0x4e35('0x5d')][_0x4e35('0xb4')]){_0x4b4e4a=_[_0x4e35('0x54')](_0x4b4e4a,_0x592f81[_0x4e35('0x5d')]['Interaction']);}return db['MailInteraction'][_0x4e35('0x6c')](_0x4b4e4a,{'include':[{'model':db[_0x4e35('0x9b')],'as':_0x4e35('0xb5')}]});}})[_0x4e35('0x20')](respondWithResult(_0x57c271,null))[_0x4e35('0x2a')](handleError(_0x57c271,null));};exports['verifySmtp']=function(_0x32b390,_0x3f9510,_0x299b58){return db[_0x4e35('0x44')][_0x4e35('0x5b')]({'where':{'id':_0x32b390[_0x4e35('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x4e35('0x40'),'raw':!![]}]})[_0x4e35('0x20')](handleEntityNotFound(_0x3f9510,null))[_0x4e35('0x20')](function(_0x2a9459){if(_0x2a9459&&_0x2a9459['Smtp']){var _0x133eb6={'id':_0x2a9459['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2a9459[_0x4e35('0x40')][_0x4e35('0x7b')]){_0x133eb6[_0x4e35('0x7b')]=_0x2a9459[_0x4e35('0x40')][_0x4e35('0x7b')];}else{_0x133eb6[_0x4e35('0x79')]=_0x2a9459[_0x4e35('0x40')][_0x4e35('0x79')];_0x133eb6['port']=_0x2a9459[_0x4e35('0x40')][_0x4e35('0x7a')];_0x133eb6[_0x4e35('0xac')]=_0x2a9459[_0x4e35('0x40')][_0x4e35('0xac')];}if(_0x2a9459[_0x4e35('0x40')][_0x4e35('0x78')]){_0x133eb6[_0x4e35('0xab')]={'user':_0x2a9459[_0x4e35('0x40')][_0x4e35('0x75')],'pass':_0x2a9459[_0x4e35('0x40')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0x4e35('0xb6'),{'account':_0x133eb6});}})[_0x4e35('0x20')](respondWithResult(_0x3f9510,null))[_0x4e35('0x2a')](handleError(_0x3f9510,null));};exports['destroy']=function(_0x42026f,_0x246326){return db['MailAccount'][_0x4e35('0x5b')]({'where':{'id':_0x42026f['params']['id']}})[_0x4e35('0x20')](handleEntityNotFound(_0x246326,null))[_0x4e35('0x20')](function(_0x5d8561){if(_0x5d8561&&_0x5d8561[_0x4e35('0x7b')]){throw new db['Sequelize'][(_0x4e35('0xb7'))](_0x4e35('0xb8'));}return _0x5d8561;})[_0x4e35('0x20')](removeEntity(_0x246326,null))[_0x4e35('0x2a')](handleError(_0x246326,null));};exports[_0x4e35('0xb9')]=function(_0x3097dd,_0x348013,_0x532dfc){return db['MailAccount']['find']({'where':{'id':_0x3097dd['params']['id']}})['then'](handleEntityNotFound(_0x348013,null))[_0x4e35('0x20')](function(_0x47428a){if(_0x47428a){return _0x47428a['addAgents'](_0x3097dd['body'][_0x4e35('0x66')],_['omit'](_0x3097dd[_0x4e35('0x5d')],[_0x4e35('0x66'),'id'])||{})[_0x4e35('0xba')](function(_0x5444ee){for(var _0x54f641=0x0;_0x54f641<_0x3097dd[_0x4e35('0x5d')][_0x4e35('0x66')][_0x4e35('0x6a')];_0x54f641+=0x1){socket[_0x4e35('0xbb')](_0x4e35('0xbc'),{'UserId':_0x3097dd['body'][_0x4e35('0x66')][_0x54f641],'MailAccountId':_0x3097dd[_0x4e35('0x5e')]['id']});}return _0x5444ee;});}})[_0x4e35('0x20')](respondWithResult(_0x348013,null))[_0x4e35('0x2a')](handleError(_0x348013,null));};exports[_0x4e35('0xbd')]=function(_0x83b8c2,_0xa6b837,_0x399783){return db[_0x4e35('0x44')][_0x4e35('0x5b')]({'where':{'id':_0x83b8c2[_0x4e35('0x5e')]['id']}})['then'](handleEntityNotFound(_0xa6b837,null))[_0x4e35('0x20')](function(_0x3d4bb2){if(_0x3d4bb2){return _0x3d4bb2[_0x4e35('0xbd')](_0x83b8c2[_0x4e35('0x49')][_0x4e35('0x66')])[_0x4e35('0x20')](function(){if(_['isArray'](_0x83b8c2['query'][_0x4e35('0x66')])){for(var _0x5bc1eb=0x0;_0x5bc1eb<_0x83b8c2[_0x4e35('0x49')]['ids'][_0x4e35('0x6a')];_0x5bc1eb+=0x1){socket[_0x4e35('0xbb')](_0x4e35('0xbe'),{'UserId':Number(_0x83b8c2[_0x4e35('0x49')][_0x4e35('0x66')][_0x5bc1eb]),'MailAccountId':Number(_0x83b8c2[_0x4e35('0x5e')]['id'])});}}else{socket['emit'](_0x4e35('0xbe'),{'UserId':Number(_0x83b8c2[_0x4e35('0x49')][_0x4e35('0x66')]),'MailAccountId':Number(_0x83b8c2['params']['id'])});}});}})[_0x4e35('0x20')](respondWithStatusCode(_0xa6b837,null))[_0x4e35('0x2a')](handleError(_0xa6b837,null));};exports[_0x4e35('0xbf')]=function(_0x28769b,_0xefb587,_0x4d9c81){var _0x4eb5d8={};var _0x278c5f={};var _0x1e1915;var _0x19a987;return db[_0x4e35('0x44')][_0x4e35('0x63')]({'where':{'id':_0x28769b[_0x4e35('0x5e')]['id']}})['then'](handleEntityNotFound(_0xefb587,null))[_0x4e35('0x20')](function(_0x4fdcae){if(_0x4fdcae){_0x1e1915=_0x4fdcae;_0x278c5f[_0x4e35('0x47')]=_['keys'](db[_0x4e35('0x8d')][_0x4e35('0x45')]);_0x278c5f['query']=_['keys'](_0x28769b[_0x4e35('0x49')]);_0x278c5f[_0x4e35('0x4a')]=_[_0x4e35('0x4b')](_0x278c5f['model'],_0x278c5f[_0x4e35('0x49')]);_0x4eb5d8['attributes']=_[_0x4e35('0x4b')](_0x278c5f['model'],qs[_0x4e35('0x4d')](_0x28769b['query'][_0x4e35('0x4d')]));_0x4eb5d8['attributes']=_0x4eb5d8['attributes']['length']?_0x4eb5d8[_0x4e35('0x4c')]:_0x278c5f[_0x4e35('0x47')];_0x4eb5d8[_0x4e35('0x4f')]=qs[_0x4e35('0x50')](_0x28769b[_0x4e35('0x49')][_0x4e35('0x50')]);_0x4eb5d8['where']=qs[_0x4e35('0x4a')](_[_0x4e35('0x52')](_0x28769b['query'],_0x278c5f[_0x4e35('0x4a')]));if(_0x28769b[_0x4e35('0x49')][_0x4e35('0x53')]){_0x4eb5d8[_0x4e35('0x51')]=_['merge'](_0x4eb5d8[_0x4e35('0x51')],{'$or':_[_0x4e35('0x43')](_0x4eb5d8[_0x4e35('0x4c')],function(_0x2fbd91){var _0x57f806={};_0x57f806[_0x2fbd91]={'$like':'%'+_0x28769b[_0x4e35('0x49')][_0x4e35('0x53')]+'%'};return _0x57f806;})});}_0x4eb5d8=_['merge']({},_0x4eb5d8,_0x28769b[_0x4e35('0x56')]);return _0x1e1915[_0x4e35('0xbf')](_0x4eb5d8);}})[_0x4e35('0x20')](function(_0x1ca785){if(_0x1ca785){_0x19a987=_0x1ca785['length'];if(!_0x28769b[_0x4e35('0x49')][_0x4e35('0x64')](_0x4e35('0x4e'))){_0x4eb5d8['limit']=qs['limit'](_0x28769b[_0x4e35('0x49')][_0x4e35('0x2f')]);_0x4eb5d8['offset']=qs[_0x4e35('0x2e')](_0x28769b[_0x4e35('0x49')][_0x4e35('0x2e')]);}return _0x1e1915[_0x4e35('0xbf')](_0x4eb5d8);}})['then'](function(_0x304c4c){if(_0x304c4c){return _0x304c4c?{'count':_0x19a987,'rows':_0x304c4c}:null;}})['then'](respondWithResult(_0xefb587,null))[_0x4e35('0x2a')](handleError(_0xefb587,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index df56b60..53b7c0f 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 _0x5897=['../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x430188,_0x1abd0f){var _0x460d3e=function(_0x2bce0b){while(--_0x2bce0b){_0x430188['push'](_0x430188['shift']());}};_0x460d3e(++_0x1abd0f);}(_0x5897,0x199));var _0x7589=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x5897[_0x2d4421];return _0x2d3b01;};'use strict';var EventEmitter=require(_0x7589('0x0'));var MailAccount=require(_0x7589('0x1'))['db'][_0x7589('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7589('0x3')](0x0);var events={'afterCreate':_0x7589('0x4'),'afterUpdate':_0x7589('0x5'),'afterDestroy':_0x7589('0x6')};function emitEvent(_0x29c9d9){return function(_0x380720,_0x1aa042,_0x2e068d){MailAccountEvents[_0x7589('0x7')](_0x29c9d9+':'+_0x380720['id'],_0x380720);MailAccountEvents[_0x7589('0x7')](_0x29c9d9,_0x380720);_0x2e068d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x7589('0x8')](e,emitEvent(event));}}module[_0x7589('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xc884=['save','update','emit','hasOwnProperty','hook','../../mysqldb','MailAccount'];(function(_0x3d83b9,_0x5da92b){var _0x47a7f7=function(_0x125748){while(--_0x125748){_0x3d83b9['push'](_0x3d83b9['shift']());}};_0x47a7f7(++_0x5da92b);}(_0xc884,0x1a2));var _0x4c88=function(_0x44b4e8,_0x39eed7){_0x44b4e8=_0x44b4e8-0x0;var _0xed3344=_0xc884[_0x44b4e8];return _0xed3344;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x4c88('0x0'))['db'][_0x4c88('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4c88('0x2'),'afterUpdate':_0x4c88('0x3'),'afterDestroy':'remove'};function emitEvent(_0x114cdb){return function(_0x411a13,_0xfab80c,_0x52bfd3){MailAccountEvents[_0x4c88('0x4')](_0x114cdb+':'+_0x411a13['id'],_0x411a13);MailAccountEvents['emit'](_0x114cdb,_0x411a13);_0x52bfd3(null);};}for(var e in events){if(events[_0x4c88('0x5')](e)){var event=events[e];MailAccount[_0x4c88('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 5ccc888..1b93965 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 _0x8ae1=['../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8ae1,0x1c8));var _0x18ae=function(_0x39ade7,_0x1fc7b0){_0x39ade7=_0x39ade7-0x0;var _0x5e0822=_0x8ae1[_0x39ade7];return _0x5e0822;};'use strict';var _=require(_0x18ae('0x0'));var util=require(_0x18ae('0x1'));var logger=require(_0x18ae('0x2'))(_0x18ae('0x3'));var moment=require(_0x18ae('0x4'));var BPromise=require(_0x18ae('0x5'));var rp=require(_0x18ae('0x6'));var fs=require('fs');var path=require(_0x18ae('0x7'));var rimraf=require(_0x18ae('0x8'));var config=require(_0x18ae('0x9'));var attributes=require(_0x18ae('0xa'));module[_0x18ae('0xb')]=function(_0x550625,_0x53d13c){return _0x550625[_0x18ae('0xc')](_0x18ae('0xd'),attributes,{'tableName':_0x18ae('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6de8=['request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','mail_accounts','util','moment','bluebird'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x6de8,0x126));var _0x86de=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x6de8[_0x4c445a];return _0x2f611c;};'use strict';var _=require('lodash');var util=require(_0x86de('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x86de('0x1'));var BPromise=require(_0x86de('0x2'));var rp=require(_0x86de('0x3'));var fs=require('fs');var path=require(_0x86de('0x4'));var rimraf=require(_0x86de('0x5'));var config=require(_0x86de('0x6'));var attributes=require(_0x86de('0x7'));module[_0x86de('0x8')]=function(_0x5b22ac,_0x5f2eca){return _0x5b22ac[_0x86de('0x9')]('MailAccount',attributes,{'tableName':_0x86de('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index de7140b..f8b20c7 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 _0x8337=['Attachments','UserId','unshift','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','MailAccount','findAll','options','raw','where','limit','map','include','model','attributes','GetMailAccount','catch','ShowMailAccount','find','debug','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','Contacts','MailApplication','Applications','MailServerOut','Smtp','List','omit','applications','orderBy','priority','asc','autoclose','push','length','close','ListId','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','format','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId'];(function(_0xd10651,_0x4b3446){var _0x322261=function(_0x5112b4){while(--_0x5112b4){_0xd10651['push'](_0xd10651['shift']());}};_0x322261(++_0x4b3446);}(_0x8337,0xd2));var _0x7833=function(_0x4fcc04,_0x270c27){_0x4fcc04=_0x4fcc04-0x0;var _0x389b78=_0x8337[_0x4fcc04];return _0x389b78;};'use strict';var _=require('lodash');var util=require(_0x7833('0x0'));var moment=require(_0x7833('0x1'));var BPromise=require(_0x7833('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7833('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7833('0x4'));var logger=require(_0x7833('0x5'))(_0x7833('0x6'));var config=require('../../config/environment');var jayson=require(_0x7833('0x7'));var client=jayson[_0x7833('0x8')]['http']({'port':0x232c});config['redis']=_[_0x7833('0x9')](config[_0x7833('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7833('0xa')]));require(_0x7833('0xb'))[_0x7833('0xc')](socket);function respondWithRpcPromise(_0x2786d7,_0xd07ac4,_0x2c5655){return new BPromise(function(_0x57bc48,_0xc64266){return client['request'](_0x2786d7,_0x2c5655)[_0x7833('0xd')](function(_0x21cb9a){logger[_0x7833('0xe')](_0x7833('0xf'),_0xd07ac4,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0xd07ac4,_0x7833('0x10'),JSON[_0x7833('0x11')](_0x21cb9a));if(_0x21cb9a['error']){if(_0x21cb9a[_0x7833('0x12')][_0x7833('0x13')]===0x1f4){logger[_0x7833('0x12')](_0x7833('0xf'),_0xd07ac4,_0x21cb9a[_0x7833('0x12')][_0x7833('0x14')]);return _0xc64266(_0x21cb9a['error'][_0x7833('0x14')]);}logger['error'](_0x7833('0xf'),_0xd07ac4,_0x21cb9a['error'][_0x7833('0x14')]);return _0x57bc48(_0x21cb9a['error'][_0x7833('0x14')]);}else{logger[_0x7833('0xe')](_0x7833('0xf'),_0xd07ac4,_0x7833('0x10'));_0x57bc48(_0x21cb9a[_0x7833('0x15')][_0x7833('0x14')]);}})['catch'](function(_0x410005){logger[_0x7833('0x12')](_0x7833('0xf'),_0xd07ac4,_0x410005);_0xc64266(_0x410005);});});}exports['GetMailAccount']=function(_0x1ad3f8){var _0x18f5d6=this;return new Promise(function(_0x19c366,_0x41a2e5){return db[_0x7833('0x16')][_0x7833('0x17')]({'raw':_0x1ad3f8['options']?_0x1ad3f8[_0x7833('0x18')][_0x7833('0x19')]===undefined?!![]:![]:!![],'where':_0x1ad3f8[_0x7833('0x18')]?_0x1ad3f8[_0x7833('0x18')][_0x7833('0x1a')]||null:null,'attributes':_0x1ad3f8[_0x7833('0x18')]?_0x1ad3f8[_0x7833('0x18')]['attributes']||null:null,'limit':_0x1ad3f8['options']?_0x1ad3f8[_0x7833('0x18')][_0x7833('0x1b')]||null:null,'include':_0x1ad3f8[_0x7833('0x18')]?_0x1ad3f8[_0x7833('0x18')]['include']?_[_0x7833('0x1c')](_0x1ad3f8['options'][_0x7833('0x1d')],function(_0x3912e4){return{'model':db[_0x3912e4[_0x7833('0x1e')]],'as':_0x3912e4['as'],'attributes':_0x3912e4[_0x7833('0x1f')],'include':_0x3912e4[_0x7833('0x1d')]?_[_0x7833('0x1c')](_0x3912e4[_0x7833('0x1d')],function(_0xbcf42){return{'model':db[_0xbcf42[_0x7833('0x1e')]],'as':_0xbcf42['as'],'attributes':_0xbcf42[_0x7833('0x1f')],'include':_0xbcf42[_0x7833('0x1d')]?_[_0x7833('0x1c')](_0xbcf42[_0x7833('0x1d')],function(_0x332a3a){return{'model':db[_0x332a3a[_0x7833('0x1e')]],'as':_0x332a3a['as'],'attributes':_0x332a3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7833('0xd')](function(_0x356374){logger['info'](_0x7833('0x20'),_0x1ad3f8);logger['debug'](_0x7833('0x20'),_0x1ad3f8,JSON[_0x7833('0x11')](_0x356374));_0x19c366(_0x356374);})[_0x7833('0x21')](function(_0x1fd866){logger['error']('GetMailAccount',_0x1fd866['message'],_0x1ad3f8);_0x41a2e5(_0x18f5d6[_0x7833('0x12')](0x1f4,_0x1fd866[_0x7833('0x14')]));});});};exports[_0x7833('0x22')]=function(_0x3b886a){var _0x5a91b0=this;return new Promise(function(_0xe20ef3,_0x36fe25){return db[_0x7833('0x16')][_0x7833('0x23')]({'raw':_0x3b886a[_0x7833('0x18')]?_0x3b886a[_0x7833('0x18')][_0x7833('0x19')]===undefined?!![]:![]:!![],'where':_0x3b886a[_0x7833('0x18')]?_0x3b886a[_0x7833('0x18')][_0x7833('0x1a')]||null:null,'attributes':_0x3b886a[_0x7833('0x18')]?_0x3b886a[_0x7833('0x18')][_0x7833('0x1f')]||null:null,'include':_0x3b886a[_0x7833('0x18')]?_0x3b886a[_0x7833('0x18')][_0x7833('0x1d')]?_[_0x7833('0x1c')](_0x3b886a[_0x7833('0x18')]['include'],function(_0x1d3c78){return{'model':db[_0x1d3c78[_0x7833('0x1e')]],'as':_0x1d3c78['as'],'attributes':_0x1d3c78[_0x7833('0x1f')],'include':_0x1d3c78[_0x7833('0x1d')]?_[_0x7833('0x1c')](_0x1d3c78[_0x7833('0x1d')],function(_0x455120){return{'model':db[_0x455120[_0x7833('0x1e')]],'as':_0x455120['as'],'attributes':_0x455120[_0x7833('0x1f')],'include':_0x455120[_0x7833('0x1d')]?_['map'](_0x455120[_0x7833('0x1d')],function(_0x5324a0){return{'model':db[_0x5324a0[_0x7833('0x1e')]],'as':_0x5324a0['as'],'attributes':_0x5324a0[_0x7833('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7833('0xd')](function(_0x2bd3ed){logger[_0x7833('0xe')](_0x7833('0x22'),_0x3b886a);logger[_0x7833('0x24')](_0x7833('0x22'),_0x3b886a,JSON[_0x7833('0x11')](_0x2bd3ed));_0xe20ef3(_0x2bd3ed);})[_0x7833('0x21')](function(_0x1ed7ef){logger['error'](_0x7833('0x22'),_0x1ed7ef['message'],_0x3b886a);_0x36fe25(_0x5a91b0[_0x7833('0x12')](0x1f4,_0x1ed7ef[_0x7833('0x14')]));});});};exports['NotifyMailAccount']=function(_0x4c0527){var _0x5bffa6=this;return new Promise(function(_0x1db759,_0x285614){var _0x57a040={'body':_0x4c0527[_0x7833('0x25')],'channel':_0x7833('0x26')};var _0x4e6c0a=_[_0x7833('0x27')](_[_0x7833('0x28')](db[_0x7833('0x29')][_0x7833('0x2a')]),['createdAt',_0x7833('0x2b'),'CompanyId','ListId']);var _0x144b09=![];if(_0x4c0527['body']['id']){delete _0x4c0527[_0x7833('0x25')]['id'];}if(_[_0x7833('0x2c')](_0x4c0527[_0x7833('0x25')][_0x7833('0x2d')])){return _0x285614(_0x5bffa6[_0x7833('0x12')](0x1f4,_0x7833('0x2e')));}if(_[_0x7833('0x2c')](_0x4c0527[_0x7833('0x25')][_0x7833('0x25')])||_0x4c0527[_0x7833('0x25')][_0x7833('0x25')]===''){return _0x285614(_0x5bffa6[_0x7833('0x12')](0x1f4,_0x7833('0x2f')));}if(_[_0x7833('0x2c')](_0x4c0527[_0x7833('0x25')][_0x7833('0x30')])){return _0x285614(_0x5bffa6[_0x7833('0x12')](0x1f4,_0x7833('0x31')+_0x4e6c0a));}if(!_[_0x7833('0x32')](_0x4e6c0a,_0x4c0527[_0x7833('0x25')][_0x7833('0x30')])){return _0x285614(_0x5bffa6[_0x7833('0x12')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e6c0a));}var _0x39d3d6={};_0x39d3d6[_0x4c0527['body']['mapKey']]=_0x4c0527[_0x7833('0x25')][_0x7833('0x2d')];return db[_0x7833('0x16')][_0x7833('0x23')]({'where':{'id':_0x4c0527[_0x7833('0x33')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x7833('0x34'),'where':_0x39d3d6,'limit':0x1,'order':[[_0x7833('0x2b'),'DESC']]}]},{'model':db[_0x7833('0x35')],'as':_0x7833('0x36')},{'model':db[_0x7833('0x37')],'as':_0x7833('0x38')}]})[_0x7833('0xd')](function(_0x594697){if(_0x594697&&_0x594697[_0x7833('0x39')]){var _0x594787=_0x594697['get']({'plain':!![]});_0x57a040['account']=_[_0x7833('0x3a')](_0x594787,[_0x7833('0x36'),'List']);_0x57a040[_0x7833('0x3b')]=_0x594787['Applications'];_0x57a040['list']=_0x594787[_0x7833('0x39')];_0x57a040['applications']=_[_0x7833('0x3c')](_0x57a040[_0x7833('0x3b')],[_0x7833('0x3d')],[_0x7833('0x3e')]);if(_0x57a040[_0x7833('0x33')]&&_0x57a040[_0x7833('0x33')][_0x7833('0x3f')]){_0x57a040[_0x7833('0x3b')][_0x7833('0x40')]({'id':0x0,'priority':_0x57a040[_0x7833('0x3b')][_0x7833('0x41')]+0x1,'app':_0x7833('0x42'),'appdata':_0x7833('0x3f'),'interval':'*,*,*,*'});}if(_0x57a040[_0x7833('0x33')][_0x7833('0x36')]){delete _0x57a040[_0x7833('0x33')][_0x7833('0x36')];}if(_0x57a040[_0x7833('0x33')][_0x7833('0x39')]){delete _0x57a040[_0x7833('0x33')][_0x7833('0x39')];}if(_0x594787[_0x7833('0x39')][_0x7833('0x34')][_0x7833('0x41')]){return _0x594787['List'][_0x7833('0x34')][0x0];}var _0x425072=_[_0x7833('0x9')](_0x4c0527[_0x7833('0x25')],{'firstName':_0x4c0527['body']['from'],'ListId':_0x594787[_0x7833('0x43')]});_0x425072[_0x4c0527[_0x7833('0x25')]['mapKey']]=_0x4c0527[_0x7833('0x25')]['from'];return db[_0x7833('0x29')]['create'](_0x425072);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x32c795){_0x57a040['contact']=_0x32c795;if(_0x32c795){if(!_0x4c0527[_0x7833('0x25')][_0x7833('0x14')][_0x7833('0x44')]){_0x4c0527['body'][_0x7833('0x14')][_0x7833('0x44')]=rs[_0x7833('0x45')]()+'\x20'+_0x4c0527['body'][_0x7833('0x14')][_0x7833('0x2d')];}var _0x35aa9f={'ContactId':_0x32c795['id'],'MailAccountId':_0x4c0527[_0x7833('0x33')]['id'],'inReplyTo':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')][_0x7833('0x44')],'to':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')]['from'],'cc':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')]['cc'],'subject':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')][_0x7833('0x46')],'attach':_0x4c0527['body'][_0x7833('0x14')][_0x7833('0x47')],'lastMsgAt':moment()['format'](_0x7833('0x48')),'lastMsgDirection':'in'};return db[_0x7833('0x49')]['find']({'where':{'closed':![],'MailAccountId':_0x4c0527['account']['id']},'include':[{'model':db[_0x7833('0x4a')],'as':_0x7833('0x4b'),'attributes':[_0x7833('0x44')],'where':{'messageId':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')][_0x7833('0x4c')]}}]})[_0x7833('0xd')](function(_0x38457e){if(_0x38457e){return[_0x38457e,![]];}return db['MailInteraction'][_0x7833('0x4d')](_0x35aa9f)['then'](function(_0x5eb2eb){return[_0x5eb2eb,!![]];});});}else{throw new Error(_0x7833('0x4e'));}})[_0x7833('0x4f')](function(_0x571858,_0x162962){if(_0x571858){_0x144b09=_0x162962;if(!_0x162962){return _0x571858[_0x7833('0x50')]({'inReplyTo':_0x4c0527['body']['message'][_0x7833('0x44')],'to':_0x4c0527['body'][_0x7833('0x14')][_0x7833('0x2d')],'cc':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')]['cc'],'subject':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')][_0x7833('0x46')],'attach':_0x571858[_0x7833('0x47')]?_0x571858['attach']:_0x4c0527[_0x7833('0x25')][_0x7833('0x14')][_0x7833('0x47')],'substatus':null,'substatusAt':moment()['format'](_0x7833('0x48')),'lastMsgAt':moment()[_0x7833('0x51')](_0x7833('0x48')),'lastMsgDirection':'in'});}else{return _0x571858;}}})[_0x7833('0xd')](function(_0x40f33f){_0x57a040[_0x7833('0x52')]=_0x40f33f['get']({'plain':!![]});_0x57a040['interaction'][_0x7833('0x53')]=_0x144b09;return db[_0x7833('0x4a')]['create']({'body':_0x4c0527[_0x7833('0x25')][_0x7833('0x25')],'MailAccountId':_0x4c0527[_0x7833('0x33')]['id'],'MailInteractionId':_0x40f33f['id'],'direction':'in','ContactId':_0x57a040[_0x7833('0x54')]['id'],'messageId':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')]['messageId'],'from':_0x4c0527['body'][_0x7833('0x14')][_0x7833('0x2d')],'to':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')]['to'],'cc':_0x4c0527[_0x7833('0x25')]['message']['cc'],'subject':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')][_0x7833('0x46')],'attach':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')][_0x7833('0x47')],'Attachments':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')][_0x7833('0x55')],'originTo':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')][_0x7833('0x56')],'originCc':_0x4c0527[_0x7833('0x25')]['message'][_0x7833('0x57')],'bcc':_0x4c0527['body'][_0x7833('0x14')][_0x7833('0x58')],'ChatWebsiteId':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')][_0x7833('0x59')]||null,'originChannel':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')][_0x7833('0x5a')]||_0x7833('0x5b'),'ChatOfflineMessageId':_0x4c0527[_0x7833('0x25')][_0x7833('0x14')][_0x7833('0x5c')]||null},{'include':[{'model':db['Attachment'],'as':_0x7833('0x5d')}]});})[_0x7833('0xd')](function(_0x8ea120){_0x57a040['message']=_0x8ea120;if(_0x57a040[_0x7833('0x52')][_0x7833('0x5e')]){return db['User'][_0x7833('0x23')]({'attributes':['id','name'],'where':{'id':_0x57a040[_0x7833('0x52')][_0x7833('0x5e')]}})[_0x7833('0xd')](function(_0x3b04ae){if(_0x3b04ae){_0x57a040[_0x7833('0x3b')][_0x7833('0x5f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3b04ae[_0x7833('0x60')]+','+(_0x57a040[_0x7833('0x33')][_0x7833('0x61')]||0xa),'interval':_0x7833('0x62')});}return respondWithRpcPromise(_0x7833('0x63'),'startRouting',_0x57a040);});}return respondWithRpcPromise(_0x7833('0x63'),_0x7833('0x64'),_0x57a040);})[_0x7833('0xd')](function(_0x58918e){_0x1db759(_0x58918e);})[_0x7833('0x21')](function(_0x33bdfd){_0x285614(_0x5bffa6['error'](0x1f4,_0x33bdfd[_0x7833('0x14')]));});});}; \ No newline at end of file +var _0x1135=['debug','ShowMailAccount','NotifyMailAccount','mail','difference','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','MailApplication','Applications','Smtp','get','applications','list','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','subject','format','interaction','created','originTo','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','info','MailAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','map','model','attributes','then'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x1135,0x177));var _0x5113=function(_0x2ead99,_0x22fcf8){_0x2ead99=_0x2ead99-0x0;var _0x2f0928=_0x1135[_0x2ead99];return _0x2f0928;};'use strict';var _=require(_0x5113('0x0'));var util=require(_0x5113('0x1'));var moment=require(_0x5113('0x2'));var BPromise=require('bluebird');var rs=require(_0x5113('0x3'));var fs=require('fs');var Redis=require(_0x5113('0x4'));var db=require(_0x5113('0x5'))['db'];var utils=require(_0x5113('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5113('0x7'));var jayson=require(_0x5113('0x8'));var client=jayson[_0x5113('0x9')]['http']({'port':0x232c});config[_0x5113('0xa')]=_[_0x5113('0xb')](config['redis'],{'host':_0x5113('0xc'),'port':0x18eb});var socket=require(_0x5113('0xd'))(new Redis(config[_0x5113('0xa')]));require('./mailAccount.socket')[_0x5113('0xe')](socket);function respondWithRpcPromise(_0x203ca8,_0xca2696,_0x4bc066){return new BPromise(function(_0x32c30f,_0x2acccd){return client[_0x5113('0xf')](_0x203ca8,_0x4bc066)['then'](function(_0x4dbe7e){logger[_0x5113('0x10')](_0x5113('0x11'),_0xca2696,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0xca2696,'request\x20sent',JSON[_0x5113('0x12')](_0x4dbe7e));if(_0x4dbe7e[_0x5113('0x13')]){if(_0x4dbe7e[_0x5113('0x13')][_0x5113('0x14')]===0x1f4){logger[_0x5113('0x13')]('MailAccount,\x20%s,\x20%s',_0xca2696,_0x4dbe7e['error']['message']);return _0x2acccd(_0x4dbe7e['error'][_0x5113('0x15')]);}logger['error'](_0x5113('0x11'),_0xca2696,_0x4dbe7e['error'][_0x5113('0x15')]);return _0x32c30f(_0x4dbe7e[_0x5113('0x13')][_0x5113('0x15')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0xca2696,_0x5113('0x16'));_0x32c30f(_0x4dbe7e[_0x5113('0x17')][_0x5113('0x15')]);}})[_0x5113('0x18')](function(_0x1ea115){logger[_0x5113('0x13')]('MailAccount,\x20%s,\x20%s',_0xca2696,_0x1ea115);_0x2acccd(_0x1ea115);});});}exports[_0x5113('0x19')]=function(_0xb6768a){var _0x1ffd72=this;return new Promise(function(_0x29da54,_0x3975ae){return db[_0x5113('0x1a')][_0x5113('0x1b')]({'raw':_0xb6768a[_0x5113('0x1c')]?_0xb6768a[_0x5113('0x1c')][_0x5113('0x1d')]===undefined?!![]:![]:!![],'where':_0xb6768a[_0x5113('0x1c')]?_0xb6768a['options'][_0x5113('0x1e')]||null:null,'attributes':_0xb6768a[_0x5113('0x1c')]?_0xb6768a[_0x5113('0x1c')]['attributes']||null:null,'limit':_0xb6768a[_0x5113('0x1c')]?_0xb6768a[_0x5113('0x1c')][_0x5113('0x1f')]||null:null,'include':_0xb6768a[_0x5113('0x1c')]?_0xb6768a[_0x5113('0x1c')][_0x5113('0x20')]?_[_0x5113('0x21')](_0xb6768a[_0x5113('0x1c')]['include'],function(_0xd381e1){return{'model':db[_0xd381e1[_0x5113('0x22')]],'as':_0xd381e1['as'],'attributes':_0xd381e1[_0x5113('0x23')],'include':_0xd381e1[_0x5113('0x20')]?_[_0x5113('0x21')](_0xd381e1['include'],function(_0x495972){return{'model':db[_0x495972['model']],'as':_0x495972['as'],'attributes':_0x495972['attributes'],'include':_0x495972[_0x5113('0x20')]?_[_0x5113('0x21')](_0x495972[_0x5113('0x20')],function(_0x6b526c){return{'model':db[_0x6b526c[_0x5113('0x22')]],'as':_0x6b526c['as'],'attributes':_0x6b526c[_0x5113('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5113('0x24')](function(_0x204e66){logger[_0x5113('0x10')]('GetMailAccount',_0xb6768a);logger[_0x5113('0x25')](_0x5113('0x19'),_0xb6768a,JSON['stringify'](_0x204e66));_0x29da54(_0x204e66);})['catch'](function(_0x2d995d){logger['error']('GetMailAccount',_0x2d995d[_0x5113('0x15')],_0xb6768a);_0x3975ae(_0x1ffd72['error'](0x1f4,_0x2d995d['message']));});});};exports[_0x5113('0x26')]=function(_0x1db1bf){var _0x576402=this;return new Promise(function(_0x564f42,_0x5da795){return db[_0x5113('0x1a')]['find']({'raw':_0x1db1bf['options']?_0x1db1bf[_0x5113('0x1c')][_0x5113('0x1d')]===undefined?!![]:![]:!![],'where':_0x1db1bf[_0x5113('0x1c')]?_0x1db1bf[_0x5113('0x1c')][_0x5113('0x1e')]||null:null,'attributes':_0x1db1bf[_0x5113('0x1c')]?_0x1db1bf[_0x5113('0x1c')][_0x5113('0x23')]||null:null,'include':_0x1db1bf[_0x5113('0x1c')]?_0x1db1bf[_0x5113('0x1c')]['include']?_[_0x5113('0x21')](_0x1db1bf[_0x5113('0x1c')][_0x5113('0x20')],function(_0x433ce8){return{'model':db[_0x433ce8['model']],'as':_0x433ce8['as'],'attributes':_0x433ce8[_0x5113('0x23')],'include':_0x433ce8[_0x5113('0x20')]?_[_0x5113('0x21')](_0x433ce8[_0x5113('0x20')],function(_0x151828){return{'model':db[_0x151828['model']],'as':_0x151828['as'],'attributes':_0x151828[_0x5113('0x23')],'include':_0x151828[_0x5113('0x20')]?_[_0x5113('0x21')](_0x151828[_0x5113('0x20')],function(_0xc9866b){return{'model':db[_0xc9866b[_0x5113('0x22')]],'as':_0xc9866b['as'],'attributes':_0xc9866b[_0x5113('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5113('0x24')](function(_0x3dc2ed){logger[_0x5113('0x10')](_0x5113('0x26'),_0x1db1bf);logger[_0x5113('0x25')](_0x5113('0x26'),_0x1db1bf,JSON[_0x5113('0x12')](_0x3dc2ed));_0x564f42(_0x3dc2ed);})[_0x5113('0x18')](function(_0xc44835){logger['error'](_0x5113('0x26'),_0xc44835[_0x5113('0x15')],_0x1db1bf);_0x5da795(_0x576402[_0x5113('0x13')](0x1f4,_0xc44835[_0x5113('0x15')]));});});};exports[_0x5113('0x27')]=function(_0x17e6ee){var _0x2c0d10=this;return new Promise(function(_0x4b4db3,_0x464c42){var _0x40c731={'body':_0x17e6ee['body'],'channel':_0x5113('0x28')};var _0x1270b4=_[_0x5113('0x29')](_['keys'](db[_0x5113('0x2a')][_0x5113('0x2b')]),[_0x5113('0x2c'),_0x5113('0x2d'),_0x5113('0x2e'),_0x5113('0x2f')]);var _0x4b80f2=![];if(_0x17e6ee[_0x5113('0x30')]['id']){delete _0x17e6ee[_0x5113('0x30')]['id'];}if(_[_0x5113('0x31')](_0x17e6ee[_0x5113('0x30')][_0x5113('0x32')])){return _0x464c42(_0x2c0d10[_0x5113('0x13')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x17e6ee[_0x5113('0x30')][_0x5113('0x30')])||_0x17e6ee['body']['body']===''){return _0x464c42(_0x2c0d10['error'](0x1f4,_0x5113('0x33')));}if(_[_0x5113('0x31')](_0x17e6ee[_0x5113('0x30')]['mapKey'])){return _0x464c42(_0x2c0d10['error'](0x1f4,_0x5113('0x34')+_0x1270b4));}if(!_[_0x5113('0x35')](_0x1270b4,_0x17e6ee[_0x5113('0x30')]['mapKey'])){return _0x464c42(_0x2c0d10[_0x5113('0x13')](0x1f4,_0x5113('0x36')+_0x1270b4));}var _0x120f61={};_0x120f61[_0x17e6ee['body']['mapKey']]=_0x17e6ee[_0x5113('0x30')][_0x5113('0x32')];return db[_0x5113('0x1a')]['find']({'where':{'id':_0x17e6ee[_0x5113('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x5113('0x38'),'include':[{'model':db['CmContact'],'as':_0x5113('0x39'),'where':_0x120f61,'limit':0x1,'order':[[_0x5113('0x2d'),_0x5113('0x3a')]]}]},{'model':db[_0x5113('0x3b')],'as':_0x5113('0x3c')},{'model':db['MailServerOut'],'as':_0x5113('0x3d')}]})[_0x5113('0x24')](function(_0x587f8f){if(_0x587f8f&&_0x587f8f[_0x5113('0x38')]){var _0x4a0458=_0x587f8f[_0x5113('0x3e')]({'plain':!![]});_0x40c731[_0x5113('0x37')]=_['omit'](_0x4a0458,[_0x5113('0x3c'),'List']);_0x40c731[_0x5113('0x3f')]=_0x4a0458[_0x5113('0x3c')];_0x40c731[_0x5113('0x40')]=_0x4a0458[_0x5113('0x38')];_0x40c731[_0x5113('0x3f')]=_[_0x5113('0x41')](_0x40c731[_0x5113('0x3f')],[_0x5113('0x42')],[_0x5113('0x43')]);if(_0x40c731[_0x5113('0x37')]&&_0x40c731[_0x5113('0x37')]['autoclose']){_0x40c731[_0x5113('0x3f')][_0x5113('0x44')]({'id':0x0,'priority':_0x40c731[_0x5113('0x3f')][_0x5113('0x45')]+0x1,'app':_0x5113('0x46'),'appdata':_0x5113('0x47'),'interval':_0x5113('0x48')});}if(_0x40c731[_0x5113('0x37')][_0x5113('0x3c')]){delete _0x40c731['account']['Applications'];}if(_0x40c731[_0x5113('0x37')]['List']){delete _0x40c731[_0x5113('0x37')][_0x5113('0x38')];}if(_0x4a0458[_0x5113('0x38')][_0x5113('0x39')][_0x5113('0x45')]){return _0x4a0458['List']['Contacts'][0x0];}var _0x379d77=_[_0x5113('0xb')](_0x17e6ee['body'],{'firstName':_0x17e6ee[_0x5113('0x30')][_0x5113('0x32')],'ListId':_0x4a0458[_0x5113('0x2f')]});_0x379d77[_0x17e6ee[_0x5113('0x30')]['mapKey']]=_0x17e6ee[_0x5113('0x30')][_0x5113('0x32')];return db[_0x5113('0x2a')][_0x5113('0x49')](_0x379d77);}else{throw new Error(_0x5113('0x4a'));}})[_0x5113('0x24')](function(_0x1c0973){_0x40c731[_0x5113('0x4b')]=_0x1c0973;if(_0x1c0973){if(!_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')][_0x5113('0x4c')]){_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')][_0x5113('0x4c')]=rs[_0x5113('0x4d')]()+'\x20'+_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')][_0x5113('0x32')];}var _0x17907f={'ContactId':_0x1c0973['id'],'MailAccountId':_0x17e6ee[_0x5113('0x37')]['id'],'inReplyTo':_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')]['messageId'],'to':_0x17e6ee['body'][_0x5113('0x15')][_0x5113('0x32')],'cc':_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')]['cc'],'subject':_0x17e6ee[_0x5113('0x30')]['message']['subject'],'attach':_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')][_0x5113('0x4e')],'lastMsgAt':moment()['format'](_0x5113('0x4f')),'lastMsgDirection':'in'};return db[_0x5113('0x50')]['find']({'where':{'closed':![],'MailAccountId':_0x17e6ee[_0x5113('0x37')]['id']},'include':[{'model':db[_0x5113('0x51')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x17e6ee['body'][_0x5113('0x15')][_0x5113('0x52')]}}]})[_0x5113('0x24')](function(_0x1c505d){if(_0x1c505d){return[_0x1c505d,![]];}return db['MailInteraction'][_0x5113('0x49')](_0x17907f)['then'](function(_0x5c387a){return[_0x5c387a,!![]];});});}else{throw new Error(_0x5113('0x53'));}})[_0x5113('0x54')](function(_0x2e7508,_0x276280){if(_0x2e7508){_0x4b80f2=_0x276280;if(!_0x276280){return _0x2e7508['update']({'inReplyTo':_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')][_0x5113('0x4c')],'to':_0x17e6ee[_0x5113('0x30')]['message'][_0x5113('0x32')],'cc':_0x17e6ee['body']['message']['cc'],'subject':_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')][_0x5113('0x55')],'attach':_0x2e7508[_0x5113('0x4e')]?_0x2e7508['attach']:_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')][_0x5113('0x4e')],'substatus':null,'substatusAt':moment()[_0x5113('0x56')](_0x5113('0x4f')),'lastMsgAt':moment()['format'](_0x5113('0x4f')),'lastMsgDirection':'in'});}else{return _0x2e7508;}}})[_0x5113('0x24')](function(_0x291cef){_0x40c731[_0x5113('0x57')]=_0x291cef[_0x5113('0x3e')]({'plain':!![]});_0x40c731[_0x5113('0x57')][_0x5113('0x58')]=_0x4b80f2;return db[_0x5113('0x51')][_0x5113('0x49')]({'body':_0x17e6ee['body'][_0x5113('0x30')],'MailAccountId':_0x17e6ee[_0x5113('0x37')]['id'],'MailInteractionId':_0x291cef['id'],'direction':'in','ContactId':_0x40c731[_0x5113('0x4b')]['id'],'messageId':_0x17e6ee['body']['message'][_0x5113('0x4c')],'from':_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')]['from'],'to':_0x17e6ee['body']['message']['to'],'cc':_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')]['cc'],'subject':_0x17e6ee['body'][_0x5113('0x15')][_0x5113('0x55')],'attach':_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')][_0x5113('0x4e')],'Attachments':_0x17e6ee['body']['message']['attachments'],'originTo':_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')][_0x5113('0x59')],'originCc':_0x17e6ee['body'][_0x5113('0x15')]['originCc'],'bcc':_0x17e6ee[_0x5113('0x30')]['message'][_0x5113('0x5a')],'ChatWebsiteId':_0x17e6ee['body'][_0x5113('0x15')][_0x5113('0x5b')]||null,'originChannel':_0x17e6ee[_0x5113('0x30')][_0x5113('0x15')][_0x5113('0x5c')]||'Email','ChatOfflineMessageId':_0x17e6ee[_0x5113('0x30')]['message'][_0x5113('0x5d')]||null},{'include':[{'model':db[_0x5113('0x5e')],'as':_0x5113('0x5f')}]});})[_0x5113('0x24')](function(_0x21d91f){_0x40c731[_0x5113('0x15')]=_0x21d91f;if(_0x40c731[_0x5113('0x57')][_0x5113('0x60')]){return db[_0x5113('0x61')]['find']({'attributes':['id',_0x5113('0x62')],'where':{'id':_0x40c731[_0x5113('0x57')][_0x5113('0x60')]}})[_0x5113('0x24')](function(_0x111fe9){if(_0x111fe9){_0x40c731['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x5113('0x63'),'appdata':_0x111fe9['name']+','+(_0x40c731[_0x5113('0x37')][_0x5113('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x5113('0x65'),_0x5113('0x66'),_0x40c731);});}return respondWithRpcPromise(_0x5113('0x65'),_0x5113('0x66'),_0x40c731);})[_0x5113('0x24')](function(_0x58dddc){_0x4b4db3(_0x58dddc);})[_0x5113('0x18')](function(_0x5d53c4){_0x464c42(_0x2c0d10[_0x5113('0x13')](0x1f4,_0x5d53c4[_0x5113('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f7c4c7b..2ad253b 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 _0x4819=['length','mailAccount:','save','remove','update','emit','removeListener'];(function(_0xc3c586,_0x1ae349){var _0x26e779=function(_0x6c9d9d){while(--_0x6c9d9d){_0xc3c586['push'](_0xc3c586['shift']());}};_0x26e779(++_0x1ae349);}(_0x4819,0xcd));var _0x9481=function(_0x38f3e9,_0x53ce92){_0x38f3e9=_0x38f3e9-0x0;var _0xe8ee0a=_0x4819[_0x38f3e9];return _0xe8ee0a;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x9481('0x0'),_0x9481('0x1'),_0x9481('0x2')];function createListener(_0x12a70c,_0x273a32){return function(_0xfb4034){_0x273a32[_0x9481('0x3')](_0x12a70c,_0xfb4034);};}function removeListener(_0x14dc10,_0xc39edf){return function(){MailAccountEvents[_0x9481('0x4')](_0x14dc10,_0xc39edf);};}exports['register']=function(_0x4d9e3a){for(var _0x5def07=0x0,_0x54cc78=events[_0x9481('0x5')];_0x5def07<_0x54cc78;_0x5def07++){var _0x6c6a08=events[_0x5def07];var _0x27c033=createListener(_0x9481('0x6')+_0x6c6a08,_0x4d9e3a);MailAccountEvents['on'](_0x6c6a08,_0x27c033);}}; \ No newline at end of file +var _0x03db=['remove','update','emit','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x401d97,_0x1b71c7){var _0xc51c79=function(_0x3cf9d1){while(--_0x3cf9d1){_0x401d97['push'](_0x401d97['shift']());}};_0xc51c79(++_0x1b71c7);}(_0x03db,0x156));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0xb03d('0x0'));var events=[_0xb03d('0x1'),_0xb03d('0x2'),_0xb03d('0x3')];function createListener(_0x552e4d,_0x312e63){return function(_0x262205){_0x312e63[_0xb03d('0x4')](_0x552e4d,_0x262205);};}function removeListener(_0x43f58e,_0xdc4440){return function(){MailAccountEvents['removeListener'](_0x43f58e,_0xdc4440);};}exports[_0xb03d('0x5')]=function(_0x1a01ba){for(var _0x9a0f36=0x0,_0x57a19b=events[_0xb03d('0x6')];_0x9a0f36<_0x57a19b;_0x9a0f36++){var _0x5f1238=events[_0x9a0f36];var _0x181291=createListener(_0xb03d('0x7')+_0x5f1238,_0x1a01ba);MailAccountEvents['on'](_0x5f1238,_0x181291);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index c6b2e86..0786c2b 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 _0x7a54=['isAuthenticated','put','/:id','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get'];(function(_0x51b33f,_0x3426b6){var _0x6d04fe=function(_0x57d747){while(--_0x57d747){_0x51b33f['push'](_0x51b33f['shift']());}};_0x6d04fe(++_0x3426b6);}(_0x7a54,0x106));var _0x47a5=function(_0x1def4a,_0xff221f){_0x1def4a=_0x1def4a-0x0;var _0x46dd17=_0x7a54[_0x1def4a];return _0x46dd17;};'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')]('/:id',auth[_0x47a5('0xa')](),controller['show']);router[_0x47a5('0xb')](_0x47a5('0xc'),auth['isAuthenticated'](),controller[_0x47a5('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','put','isAuthenticated','update','delete','destroy','exports'];(function(_0xa34fa6,_0x43bff6){var _0xc3250c=function(_0x370359){while(--_0x370359){_0xa34fa6['push'](_0xa34fa6['shift']());}};_0xc3250c(++_0x43bff6);}(_0x814b,0x1a2));var _0xb814=function(_0x27def7,_0x3f0835){_0x27def7=_0x27def7-0x0;var _0x581cbc=_0x814b[_0x27def7];return _0x581cbc;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')](_0xb814('0xb'),auth['isAuthenticated'](),controller[_0xb814('0xc')]);router[_0xb814('0xd')]('/:id',auth[_0xb814('0xe')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xb'),auth[_0xb814('0xe')](),controller[_0xb814('0x11')]);module[_0xb814('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index d19ec94..aeb5a6c 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 _0x64f9=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x1b7f71,_0x1bae43){var _0x57a977=function(_0x17bd58){while(--_0x17bd58){_0x1b7f71['push'](_0x1b7f71['shift']());}};_0x57a977(++_0x1bae43);}(_0x64f9,0x6c));var _0x964f=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x64f9[_0x28d18d];return _0x470640;};'use strict';var Sequelize=require(_0x964f('0x0'));module[_0x964f('0x1')]={'priority':{'type':Sequelize[_0x964f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x964f('0x3')],'allowNull':![],'defaultValue':_0x964f('0x4')},'appdata':{'type':Sequelize[_0x964f('0x5')]()},'description':{'type':Sequelize[_0x964f('0x3')]},'interval':{'type':Sequelize[_0x964f('0x3')],'defaultValue':_0x964f('0x6')}}; \ No newline at end of file +var _0x4e71=['TEXT','STRING','*,*,*,*','exports','INTEGER','noop'];(function(_0x3d263f,_0x571f49){var _0x332463=function(_0x96d048){while(--_0x96d048){_0x3d263f['push'](_0x3d263f['shift']());}};_0x332463(++_0x571f49);}(_0x4e71,0x195));var _0x14e7=function(_0xbc9228,_0x37b272){_0xbc9228=_0xbc9228-0x0;var _0x5f1300=_0x4e71[_0xbc9228];return _0x5f1300;};'use strict';var Sequelize=require('sequelize');module[_0x14e7('0x0')]={'priority':{'type':Sequelize[_0x14e7('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x14e7('0x2')},'appdata':{'type':Sequelize[_0x14e7('0x3')]()},'description':{'type':Sequelize[_0x14e7('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x14e7('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 4ffd25b..7df36ab 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 _0x1124=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','keys','MailApplication','rawAttributes','query','filters','intersection','model','attributes','fields','includeAll','include','merge','options','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','ejs','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x3bae37,_0x3deb16){var _0x1f94ac=function(_0x2aae06){while(--_0x2aae06){_0x3bae37['push'](_0x3bae37['shift']());}};_0x1f94ac(++_0x3deb16);}(_0x1124,0x18a));var _0x4112=function(_0x142411,_0x528036){_0x142411=_0x142411-0x0;var _0x151b6c=_0x1124[_0x142411];return _0x151b6c;};'use strict';var emlformat=require(_0x4112('0x0'));var rimraf=require(_0x4112('0x1'));var zipdir=require(_0x4112('0x2'));var jsonpatch=require(_0x4112('0x3'));var rp=require(_0x4112('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4112('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4112('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4112('0x7'));var crypto=require(_0x4112('0x8'));var jsforce=require(_0x4112('0x9'));var deskjs=require(_0x4112('0xa'));var toCsv=require(_0x4112('0xb'));var querystring=require(_0x4112('0xc'));var Papa=require(_0x4112('0xd'));var Redis=require(_0x4112('0xe'));var authService=require(_0x4112('0xf'));var qs=require(_0x4112('0x10'));var as=require(_0x4112('0x11'));var hardwareService=require(_0x4112('0x12'));var logger=require(_0x4112('0x13'))(_0x4112('0x14'));var utils=require(_0x4112('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4112('0x16'));var db=require(_0x4112('0x17'))['db'];function respondWithStatusCode(_0x106dd3,_0x1bc62d){_0x1bc62d=_0x1bc62d||0xcc;return function(_0x5cb153){if(_0x5cb153){return _0x106dd3[_0x4112('0x18')](_0x1bc62d);}return _0x106dd3[_0x4112('0x19')](_0x1bc62d)[_0x4112('0x1a')]();};}function respondWithResult(_0x4083a0,_0x374ce3){_0x374ce3=_0x374ce3||0xc8;return function(_0x34bb38){if(_0x34bb38){return _0x4083a0[_0x4112('0x19')](_0x374ce3)[_0x4112('0x1b')](_0x34bb38);}};}function respondWithFilteredResult(_0x466f5b,_0x2d6f93){return function(_0x3549cf){if(_0x3549cf){var _0x4a0d84=typeof _0x2d6f93[_0x4112('0x1c')]==='undefined'&&typeof _0x2d6f93[_0x4112('0x1d')]==='undefined';var _0x2b61e2=_0x3549cf[_0x4112('0x1e')];var _0x282bb0=_0x4a0d84?0x0:_0x2d6f93[_0x4112('0x1c')];var _0xbd42d9=_0x4a0d84?_0x3549cf[_0x4112('0x1e')]:_0x2d6f93[_0x4112('0x1c')]+_0x2d6f93['limit'];var _0x595686;if(_0xbd42d9>=_0x2b61e2){_0xbd42d9=_0x2b61e2;_0x595686=0xc8;}else{_0x595686=0xce;}_0x466f5b[_0x4112('0x19')](_0x595686);return _0x466f5b[_0x4112('0x1f')](_0x4112('0x20'),_0x282bb0+'-'+_0xbd42d9+'/'+_0x2b61e2)[_0x4112('0x1b')](_0x3549cf);}return null;};}function patchUpdates(_0x48e83){return function(_0x4e50be){try{jsonpatch[_0x4112('0x21')](_0x4e50be,_0x48e83,!![]);}catch(_0x11bd4c){return BPromise['reject'](_0x11bd4c);}return _0x4e50be[_0x4112('0x22')]();};}function saveUpdates(_0x331b0f,_0x475b51){return function(_0x17ff19){if(_0x17ff19){return _0x17ff19[_0x4112('0x23')](_0x331b0f)[_0x4112('0x24')](function(_0xb52e87){return _0xb52e87;});}return null;};}function removeEntity(_0x1e885,_0x43b57a){return function(_0x192174){if(_0x192174){return _0x192174[_0x4112('0x25')]()[_0x4112('0x24')](function(){_0x1e885[_0x4112('0x19')](0xcc)[_0x4112('0x1a')]();});}};}function handleEntityNotFound(_0x281894,_0x52526f){return function(_0x4e7744){if(!_0x4e7744){_0x281894[_0x4112('0x18')](0x194);}return _0x4e7744;};}function handleError(_0xc6d140,_0x316d50){_0x316d50=_0x316d50||0x1f4;return function(_0x5005d1){logger['error'](_0x5005d1[_0x4112('0x26')]);if(_0x5005d1[_0x4112('0x27')]){delete _0x5005d1[_0x4112('0x27')];}_0xc6d140[_0x4112('0x19')](_0x316d50)[_0x4112('0x28')](_0x5005d1);};}exports[_0x4112('0x29')]=function(_0x42062e,_0x762c63){var _0x22752d={'raw':!![],'where':{'id':_0x42062e['params']['id']}},_0x3990c8={};_0x3990c8['model']=_[_0x4112('0x2a')](db[_0x4112('0x2b')][_0x4112('0x2c')]);_0x3990c8[_0x4112('0x2d')]=_['keys'](_0x42062e[_0x4112('0x2d')]);_0x3990c8[_0x4112('0x2e')]=_[_0x4112('0x2f')](_0x3990c8[_0x4112('0x30')],_0x3990c8[_0x4112('0x2d')]);_0x22752d[_0x4112('0x31')]=_[_0x4112('0x2f')](_0x3990c8[_0x4112('0x30')],qs[_0x4112('0x32')](_0x42062e[_0x4112('0x2d')][_0x4112('0x32')]));_0x22752d[_0x4112('0x31')]=_0x22752d[_0x4112('0x31')]['length']?_0x22752d[_0x4112('0x31')]:_0x3990c8[_0x4112('0x30')];if(_0x42062e[_0x4112('0x2d')][_0x4112('0x33')]){_0x22752d[_0x4112('0x34')]=[{'all':!![]}];}_0x22752d=_[_0x4112('0x35')]({},_0x22752d,_0x42062e[_0x4112('0x36')]);return db[_0x4112('0x2b')][_0x4112('0x37')](_0x22752d)[_0x4112('0x24')](handleEntityNotFound(_0x762c63,null))[_0x4112('0x24')](respondWithResult(_0x762c63,null))['catch'](handleError(_0x762c63,null));};exports[_0x4112('0x23')]=function(_0x3d65c9,_0x390826){if(_0x3d65c9[_0x4112('0x38')]['id']){delete _0x3d65c9[_0x4112('0x38')]['id'];}return db[_0x4112('0x2b')]['find']({'where':{'id':_0x3d65c9[_0x4112('0x39')]['id']}})[_0x4112('0x24')](handleEntityNotFound(_0x390826,null))[_0x4112('0x24')](saveUpdates(_0x3d65c9[_0x4112('0x38')],null))['then'](respondWithResult(_0x390826,null))['catch'](handleError(_0x390826,null));};exports[_0x4112('0x25')]=function(_0x437742,_0x4f4f6c){return db[_0x4112('0x2b')]['find']({'where':{'id':_0x437742[_0x4112('0x39')]['id']}})[_0x4112('0x24')](handleEntityNotFound(_0x4f4f6c,null))[_0x4112('0x24')](removeEntity(_0x4f4f6c,null))['catch'](handleError(_0x4f4f6c,null));}; \ No newline at end of file +var _0x3d80=['reject','update','then','error','name','send','show','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','options','MailApplication','find','catch','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x3d80,0x87));var _0x03d8=function(_0x4418a3,_0x316056){_0x4418a3=_0x4418a3-0x0;var _0x5c5d16=_0x3d80[_0x4418a3];return _0x5c5d16;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x03d8('0x0'));var zipdir=require(_0x03d8('0x1'));var jsonpatch=require(_0x03d8('0x2'));var rp=require(_0x03d8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x03d8('0x4'));var util=require(_0x03d8('0x5'));var path=require(_0x03d8('0x6'));var sox=require(_0x03d8('0x7'));var csv=require(_0x03d8('0x8'));var ejs=require(_0x03d8('0x9'));var fs=require('fs');var fs_extra=require(_0x03d8('0xa'));var _=require(_0x03d8('0xb'));var squel=require('squel');var crypto=require(_0x03d8('0xc'));var jsforce=require(_0x03d8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x03d8('0x8'));var querystring=require(_0x03d8('0xe'));var Papa=require(_0x03d8('0xf'));var Redis=require('ioredis');var authService=require(_0x03d8('0x10'));var qs=require(_0x03d8('0x11'));var as=require(_0x03d8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x03d8('0x13'));var utils=require(_0x03d8('0x14'));var config=require(_0x03d8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x03d8('0x16'))['db'];function respondWithStatusCode(_0x56661c,_0x330ee7){_0x330ee7=_0x330ee7||0xcc;return function(_0x47c0dd){if(_0x47c0dd){return _0x56661c[_0x03d8('0x17')](_0x330ee7);}return _0x56661c[_0x03d8('0x18')](_0x330ee7)[_0x03d8('0x19')]();};}function respondWithResult(_0x41d9ef,_0x284250){_0x284250=_0x284250||0xc8;return function(_0x52fabb){if(_0x52fabb){return _0x41d9ef[_0x03d8('0x18')](_0x284250)['json'](_0x52fabb);}};}function respondWithFilteredResult(_0x2aa28a,_0x2fffaa){return function(_0x43bdf8){if(_0x43bdf8){var _0x1d3880=typeof _0x2fffaa[_0x03d8('0x1a')]==='undefined'&&typeof _0x2fffaa[_0x03d8('0x1b')]===_0x03d8('0x1c');var _0x500f2c=_0x43bdf8[_0x03d8('0x1d')];var _0x454363=_0x1d3880?0x0:_0x2fffaa['offset'];var _0xd37054=_0x1d3880?_0x43bdf8[_0x03d8('0x1d')]:_0x2fffaa['offset']+_0x2fffaa[_0x03d8('0x1b')];var _0x444d15;if(_0xd37054>=_0x500f2c){_0xd37054=_0x500f2c;_0x444d15=0xc8;}else{_0x444d15=0xce;}_0x2aa28a[_0x03d8('0x18')](_0x444d15);return _0x2aa28a[_0x03d8('0x1e')](_0x03d8('0x1f'),_0x454363+'-'+_0xd37054+'/'+_0x500f2c)['json'](_0x43bdf8);}return null;};}function patchUpdates(_0x4f5382){return function(_0x2c9962){try{jsonpatch[_0x03d8('0x20')](_0x2c9962,_0x4f5382,!![]);}catch(_0x47ae4c){return BPromise[_0x03d8('0x21')](_0x47ae4c);}return _0x2c9962['save']();};}function saveUpdates(_0x19c766,_0x53652d){return function(_0x692fce){if(_0x692fce){return _0x692fce[_0x03d8('0x22')](_0x19c766)[_0x03d8('0x23')](function(_0x387377){return _0x387377;});}return null;};}function removeEntity(_0x21aa35,_0x47286c){return function(_0x3b4309){if(_0x3b4309){return _0x3b4309['destroy']()[_0x03d8('0x23')](function(){_0x21aa35[_0x03d8('0x18')](0xcc)[_0x03d8('0x19')]();});}};}function handleEntityNotFound(_0x4ff172,_0x2883ca){return function(_0x2d8c60){if(!_0x2d8c60){_0x4ff172['sendStatus'](0x194);}return _0x2d8c60;};}function handleError(_0x64b0a2,_0x3d121d){_0x3d121d=_0x3d121d||0x1f4;return function(_0x5c1fc7){logger[_0x03d8('0x24')](_0x5c1fc7['stack']);if(_0x5c1fc7[_0x03d8('0x25')]){delete _0x5c1fc7[_0x03d8('0x25')];}_0x64b0a2[_0x03d8('0x18')](_0x3d121d)[_0x03d8('0x26')](_0x5c1fc7);};}exports[_0x03d8('0x27')]=function(_0x3fc4ba,_0x4bbc79){var _0x2deb62={'raw':!![],'where':{'id':_0x3fc4ba[_0x03d8('0x28')]['id']}},_0x4ffcd4={};_0x4ffcd4[_0x03d8('0x29')]=_[_0x03d8('0x2a')](db['MailApplication']['rawAttributes']);_0x4ffcd4[_0x03d8('0x2b')]=_[_0x03d8('0x2a')](_0x3fc4ba[_0x03d8('0x2b')]);_0x4ffcd4[_0x03d8('0x2c')]=_['intersection'](_0x4ffcd4[_0x03d8('0x29')],_0x4ffcd4[_0x03d8('0x2b')]);_0x2deb62['attributes']=_[_0x03d8('0x2d')](_0x4ffcd4[_0x03d8('0x29')],qs[_0x03d8('0x2e')](_0x3fc4ba['query'][_0x03d8('0x2e')]));_0x2deb62[_0x03d8('0x2f')]=_0x2deb62[_0x03d8('0x2f')][_0x03d8('0x30')]?_0x2deb62[_0x03d8('0x2f')]:_0x4ffcd4[_0x03d8('0x29')];if(_0x3fc4ba[_0x03d8('0x2b')][_0x03d8('0x31')]){_0x2deb62['include']=[{'all':!![]}];}_0x2deb62=_['merge']({},_0x2deb62,_0x3fc4ba[_0x03d8('0x32')]);return db[_0x03d8('0x33')][_0x03d8('0x34')](_0x2deb62)[_0x03d8('0x23')](handleEntityNotFound(_0x4bbc79,null))[_0x03d8('0x23')](respondWithResult(_0x4bbc79,null))[_0x03d8('0x35')](handleError(_0x4bbc79,null));};exports['update']=function(_0x41d283,_0x5a40dd){if(_0x41d283[_0x03d8('0x36')]['id']){delete _0x41d283['body']['id'];}return db[_0x03d8('0x33')][_0x03d8('0x34')]({'where':{'id':_0x41d283[_0x03d8('0x28')]['id']}})['then'](handleEntityNotFound(_0x5a40dd,null))['then'](saveUpdates(_0x41d283['body'],null))[_0x03d8('0x23')](respondWithResult(_0x5a40dd,null))[_0x03d8('0x35')](handleError(_0x5a40dd,null));};exports[_0x03d8('0x37')]=function(_0x4a7b66,_0x37ab03){return db[_0x03d8('0x33')][_0x03d8('0x34')]({'where':{'id':_0x4a7b66[_0x03d8('0x28')]['id']}})[_0x03d8('0x23')](handleEntityNotFound(_0x37ab03,null))[_0x03d8('0x23')](removeEntity(_0x37ab03,null))[_0x03d8('0x35')](handleError(_0x37ab03,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 324c160..7c9e3b5 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 _0xa064=['MailApplication','mail_applications','lodash','util','../../config/logger','api','moment','path','../../config/environment','./mailApplication.attributes'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0xa064,0x192));var _0x4a06=function(_0x39f794,_0x212dc5){_0x39f794=_0x39f794-0x0;var _0x180134=_0xa064[_0x39f794];return _0x180134;};'use strict';var _=require(_0x4a06('0x0'));var util=require(_0x4a06('0x1'));var logger=require(_0x4a06('0x2'))(_0x4a06('0x3'));var moment=require(_0x4a06('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a06('0x5'));var rimraf=require('rimraf');var config=require(_0x4a06('0x6'));var attributes=require(_0x4a06('0x7'));module['exports']=function(_0x3f2099,_0x54c9ed){return _0x3f2099['define'](_0x4a06('0x8'),attributes,{'tableName':_0x4a06('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd386=['path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd386,0x10c));var _0x6d38=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0xd386[_0x4d8a8f];return _0xfc4adc;};'use strict';var _=require(_0x6d38('0x0'));var util=require(_0x6d38('0x1'));var logger=require(_0x6d38('0x2'))('api');var moment=require(_0x6d38('0x3'));var BPromise=require(_0x6d38('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d38('0x5'));var rimraf=require(_0x6d38('0x6'));var config=require(_0x6d38('0x7'));var attributes=require(_0x6d38('0x8'));module['exports']=function(_0x1a54fa,_0x25eef5){return _0x1a54fa[_0x6d38('0x9')](_0x6d38('0xa'),attributes,{'tableName':_0x6d38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6d38('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index a6323aa..82e52dc 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 _0x6709=['message','info','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2c95e7,_0x32540a){var _0xe941b2=function(_0x2648b2){while(--_0x2648b2){_0x2c95e7['push'](_0x2c95e7['shift']());}};_0xe941b2(++_0x32540a);}(_0x6709,0xd5));var _0x9670=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x6709[_0x4ae625];return _0x31accf;};'use strict';var _=require(_0x9670('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9670('0x1'));var rs=require(_0x9670('0x2'));var fs=require('fs');var Redis=require(_0x9670('0x3'));var db=require(_0x9670('0x4'))['db'];var utils=require(_0x9670('0x5'));var logger=require(_0x9670('0x6'))(_0x9670('0x7'));var config=require(_0x9670('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9670('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3259e2,_0x229aa1,_0x3c4a84){return new BPromise(function(_0x1ad087,_0x5ae8cc){return client[_0x9670('0xa')](_0x3259e2,_0x3c4a84)[_0x9670('0xb')](function(_0xc2cef){logger['info'](_0x9670('0xc'),_0x229aa1,_0x9670('0xd'));logger[_0x9670('0xe')](_0x9670('0xf'),_0x229aa1,_0x9670('0xd'),JSON[_0x9670('0x10')](_0xc2cef));if(_0xc2cef[_0x9670('0x11')]){if(_0xc2cef[_0x9670('0x11')][_0x9670('0x12')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x229aa1,_0xc2cef[_0x9670('0x11')]['message']);return _0x5ae8cc(_0xc2cef[_0x9670('0x11')][_0x9670('0x13')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x229aa1,_0xc2cef[_0x9670('0x11')][_0x9670('0x13')]);return _0x1ad087(_0xc2cef[_0x9670('0x11')]['message']);}else{logger[_0x9670('0x14')]('MailApplication,\x20%s,\x20%s',_0x229aa1,_0x9670('0xd'));_0x1ad087(_0xc2cef['result'][_0x9670('0x13')]);}})[_0x9670('0x15')](function(_0x582f73){logger[_0x9670('0x11')](_0x9670('0xc'),_0x229aa1,_0x582f73);_0x5ae8cc(_0x582f73);});});}exports[_0x9670('0x16')]=function(_0x50c025){var _0x401c30=this;return new Promise(function(_0x385019,_0x42c7df){return db[_0x9670('0x17')][_0x9670('0x18')](_0x50c025[_0x9670('0x19')],{'raw':_0x50c025[_0x9670('0x1a')]?_0x50c025['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50c025[_0x9670('0x1a')]?_0x50c025[_0x9670('0x1a')][_0x9670('0x1b')]||null:null,'attributes':_0x50c025['options']?_0x50c025[_0x9670('0x1a')][_0x9670('0x1c')]||null:null,'limit':_0x50c025[_0x9670('0x1a')]?_0x50c025[_0x9670('0x1a')]['limit']||null:null})[_0x9670('0xb')](function(_0x2a73fc){logger['info'](_0x9670('0x16'),_0x50c025);logger[_0x9670('0xe')](_0x9670('0x16'),_0x50c025,JSON[_0x9670('0x10')](_0x2a73fc));_0x385019(_0x2a73fc);})['catch'](function(_0x25611f){logger[_0x9670('0x11')](_0x9670('0x16'),_0x25611f[_0x9670('0x13')],_0x50c025);_0x42c7df(_0x401c30[_0x9670('0x11')](0x1f4,_0x25611f['message']));});});}; \ No newline at end of file +var _0xad75=['code','message','info','catch','UpdateMailApplication','MailApplication','update','options','raw','where','attributes','limit','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0xad75,0xe6));var _0x5ad7=function(_0x587f63,_0x28204f){_0x587f63=_0x587f63-0x0;var _0x482a4f=_0xad75[_0x587f63];return _0x482a4f;};'use strict';var _=require('lodash');var util=require(_0x5ad7('0x0'));var moment=require(_0x5ad7('0x1'));var BPromise=require(_0x5ad7('0x2'));var rs=require(_0x5ad7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ad7('0x4'))['db'];var utils=require(_0x5ad7('0x5'));var logger=require(_0x5ad7('0x6'))(_0x5ad7('0x7'));var config=require(_0x5ad7('0x8'));var jayson=require(_0x5ad7('0x9'));var client=jayson[_0x5ad7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b24f9,_0x11064c,_0x5c85c3){return new BPromise(function(_0x4cb5f3,_0x463b96){return client[_0x5ad7('0xb')](_0x4b24f9,_0x5c85c3)['then'](function(_0x1cf2f9){logger['info'](_0x5ad7('0xc'),_0x11064c,_0x5ad7('0xd'));logger[_0x5ad7('0xe')](_0x5ad7('0xf'),_0x11064c,_0x5ad7('0xd'),JSON[_0x5ad7('0x10')](_0x1cf2f9));if(_0x1cf2f9[_0x5ad7('0x11')]){if(_0x1cf2f9[_0x5ad7('0x11')][_0x5ad7('0x12')]===0x1f4){logger['error'](_0x5ad7('0xc'),_0x11064c,_0x1cf2f9[_0x5ad7('0x11')][_0x5ad7('0x13')]);return _0x463b96(_0x1cf2f9['error']['message']);}logger[_0x5ad7('0x11')](_0x5ad7('0xc'),_0x11064c,_0x1cf2f9[_0x5ad7('0x11')]['message']);return _0x4cb5f3(_0x1cf2f9[_0x5ad7('0x11')][_0x5ad7('0x13')]);}else{logger[_0x5ad7('0x14')](_0x5ad7('0xc'),_0x11064c,_0x5ad7('0xd'));_0x4cb5f3(_0x1cf2f9['result']['message']);}})[_0x5ad7('0x15')](function(_0xc4d578){logger[_0x5ad7('0x11')](_0x5ad7('0xc'),_0x11064c,_0xc4d578);_0x463b96(_0xc4d578);});});}exports[_0x5ad7('0x16')]=function(_0x52ceec){var _0x249d7f=this;return new Promise(function(_0x26f2f0,_0xe8c116){return db[_0x5ad7('0x17')][_0x5ad7('0x18')](_0x52ceec['body'],{'raw':_0x52ceec['options']?_0x52ceec[_0x5ad7('0x19')][_0x5ad7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52ceec[_0x5ad7('0x19')]?_0x52ceec[_0x5ad7('0x19')][_0x5ad7('0x1b')]||null:null,'attributes':_0x52ceec[_0x5ad7('0x19')]?_0x52ceec[_0x5ad7('0x19')][_0x5ad7('0x1c')]||null:null,'limit':_0x52ceec[_0x5ad7('0x19')]?_0x52ceec[_0x5ad7('0x19')][_0x5ad7('0x1d')]||null:null})[_0x5ad7('0x1e')](function(_0x36856d){logger[_0x5ad7('0x14')](_0x5ad7('0x16'),_0x52ceec);logger[_0x5ad7('0xe')]('UpdateMailApplication',_0x52ceec,JSON[_0x5ad7('0x10')](_0x36856d));_0x26f2f0(_0x36856d);})['catch'](function(_0x2e150d){logger[_0x5ad7('0x11')](_0x5ad7('0x16'),_0x2e150d['message'],_0x52ceec);_0xe8c116(_0x249d7f['error'](0x1f4,_0x2e150d[_0x5ad7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index da2a664..93fba73 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 _0x5b10=['removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete'];(function(_0x1a0322,_0x2802d4){var _0x391779=function(_0x3d3c7c){while(--_0x3d3c7c){_0x1a0322['push'](_0x1a0322['shift']());}};_0x391779(++_0x2802d4);}(_0x5b10,0xfa));var _0x05b1=function(_0x29dd2f,_0x430781){_0x29dd2f=_0x29dd2f-0x0;var _0x24b827=_0x5b10[_0x29dd2f];return _0x24b827;};'use strict';var multer=require('multer');var util=require(_0x05b1('0x0'));var path=require(_0x05b1('0x1'));var timeout=require(_0x05b1('0x2'));var express=require(_0x05b1('0x3'));var router=express[_0x05b1('0x4')]();var fs_extra=require(_0x05b1('0x5'));var auth=require(_0x05b1('0x6'));var interaction=require(_0x05b1('0x7'));var config=require(_0x05b1('0x8'));var controller=require(_0x05b1('0x9'));router[_0x05b1('0xa')]('/',auth[_0x05b1('0xb')](),controller[_0x05b1('0xc')]);router[_0x05b1('0xa')](_0x05b1('0xd'),auth[_0x05b1('0xb')](),controller['describe']);router[_0x05b1('0xa')](_0x05b1('0xe'),auth[_0x05b1('0xb')](),controller[_0x05b1('0xf')]);router[_0x05b1('0xa')](_0x05b1('0x10'),auth[_0x05b1('0xb')](),controller[_0x05b1('0x11')]);router[_0x05b1('0xa')](_0x05b1('0x12'),auth[_0x05b1('0xb')](),controller['download']);router[_0x05b1('0x13')]('/',auth[_0x05b1('0xb')](),controller[_0x05b1('0x14')]);router[_0x05b1('0x13')](_0x05b1('0x10'),auth[_0x05b1('0xb')](),controller['addMessage']);router['post'](_0x05b1('0x15'),auth['isAuthenticated'](),interaction[_0x05b1('0x16')](_0x05b1('0x17'),_0x05b1('0x18')),controller[_0x05b1('0x19')]);router[_0x05b1('0x1a')](_0x05b1('0xe'),auth['isAuthenticated'](),interaction[_0x05b1('0x16')](_0x05b1('0x17'),'mailinteraction:update'),controller[_0x05b1('0x1b')]);router['delete']('/:id',auth[_0x05b1('0xb')](),interaction[_0x05b1('0x16')]('mail','mailinteraction:destroy'),controller['destroy']);router[_0x05b1('0x1c')]('/:id/tags',auth[_0x05b1('0xb')](),controller[_0x05b1('0x1d')]);module[_0x05b1('0x1e')]=router; \ No newline at end of file +var _0x2d59=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated'];(function(_0x6b23f3,_0x4189c9){var _0x473e8f=function(_0x2112c2){while(--_0x2112c2){_0x6b23f3['push'](_0x6b23f3['shift']());}};_0x473e8f(++_0x4189c9);}(_0x2d59,0xc0));var _0x92d5=function(_0x15bc3a,_0x5b152d){_0x15bc3a=_0x15bc3a-0x0;var _0xd76d9f=_0x2d59[_0x15bc3a];return _0xd76d9f;};'use strict';var multer=require(_0x92d5('0x0'));var util=require(_0x92d5('0x1'));var path=require(_0x92d5('0x2'));var timeout=require(_0x92d5('0x3'));var express=require('express');var router=express[_0x92d5('0x4')]();var fs_extra=require(_0x92d5('0x5'));var auth=require(_0x92d5('0x6'));var interaction=require(_0x92d5('0x7'));var config=require(_0x92d5('0x8'));var controller=require(_0x92d5('0x9'));router[_0x92d5('0xa')]('/',auth[_0x92d5('0xb')](),controller['index']);router['get'](_0x92d5('0xc'),auth[_0x92d5('0xb')](),controller[_0x92d5('0xd')]);router[_0x92d5('0xa')](_0x92d5('0xe'),auth[_0x92d5('0xb')](),controller[_0x92d5('0xf')]);router[_0x92d5('0xa')](_0x92d5('0x10'),auth[_0x92d5('0xb')](),controller[_0x92d5('0x11')]);router[_0x92d5('0xa')](_0x92d5('0x12'),auth[_0x92d5('0xb')](),controller[_0x92d5('0x13')]);router[_0x92d5('0x14')]('/',auth['isAuthenticated'](),controller[_0x92d5('0x15')]);router['post'](_0x92d5('0x10'),auth['isAuthenticated'](),controller[_0x92d5('0x16')]);router[_0x92d5('0x14')](_0x92d5('0x17'),auth[_0x92d5('0xb')](),interaction[_0x92d5('0x18')](_0x92d5('0x19'),'mailinteraction:addtags'),controller[_0x92d5('0x1a')]);router[_0x92d5('0x1b')](_0x92d5('0xe'),auth[_0x92d5('0xb')](),interaction[_0x92d5('0x18')](_0x92d5('0x19'),_0x92d5('0x1c')),controller[_0x92d5('0x1d')]);router[_0x92d5('0x1e')]('/:id',auth[_0x92d5('0xb')](),interaction[_0x92d5('0x18')]('mail','mailinteraction:destroy'),controller[_0x92d5('0x1f')]);router['delete'](_0x92d5('0x17'),auth['isAuthenticated'](),controller[_0x92d5('0x20')]);module[_0x92d5('0x21')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index b58be3c..c8f2edd 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 _0x9568=['iconv','exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out','sequelize'];(function(_0x5bbb2c,_0x182efa){var _0x4e60ef=function(_0x30e01c){while(--_0x30e01c){_0x5bbb2c['push'](_0x5bbb2c['shift']());}};_0x4e60ef(++_0x182efa);}(_0x9568,0xc7));var _0x8956=function(_0x2e846d,_0x370cd6){_0x2e846d=_0x2e846d-0x0;var _0x10a6ab=_0x9568[_0x2e846d];return _0x10a6ab;};'use strict';var Sequelize=require(_0x8956('0x0'));var iconv=require(_0x8956('0x1'));module[_0x8956('0x2')]={'closed':{'type':Sequelize[_0x8956('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8956('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8956('0x5')]},'note':{'type':Sequelize[_0x8956('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x8956('0x5')]},'cc':{'type':Sequelize['TEXT'](_0x8956('0x6'))},'subject':{'type':Sequelize[_0x8956('0x7')]()},'attach':{'type':Sequelize[_0x8956('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x8956('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8956('0x8')]('in',_0x8956('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8956('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8956('0x8')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3458=['BOOLEAN','DATE','STRING','TEXT','out','ENUM','exports'];(function(_0x5446ae,_0x307469){var _0x439daa=function(_0x2be902){while(--_0x2be902){_0x5446ae['push'](_0x5446ae['shift']());}};_0x439daa(++_0x307469);}(_0x3458,0x92));var _0x8345=function(_0x549369,_0x579e0c){_0x549369=_0x549369-0x0;var _0x312bb4=_0x3458[_0x549369];return _0x312bb4;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x8345('0x0')]={'closed':{'type':Sequelize[_0x8345('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8345('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8345('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8345('0x3')]},'note':{'type':Sequelize[_0x8345('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x8345('0x3')]},'cc':{'type':Sequelize[_0x8345('0x4')]('long')},'subject':{'type':Sequelize[_0x8345('0x4')]()},'attach':{'type':Sequelize[_0x8345('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x8345('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x8345('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8345('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8345('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8345('0x6')]('in',_0x8345('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 3fbb6f0..efd36ba 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 _0x0be0=['moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','desk.js','html-to-text','juice','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','name','send','Users','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','-id','plainBody','catch','index','map','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','type','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','MailInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','all','rows','show','keys','includeAll','include','options','create','body','params','destroy','describe','addMessage','omit','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','setTags','spread','Tag','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','bcc','subject','Messages','get','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','writeFileSync','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x0be0,0x1e4));var _0x00be=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x0be0[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require(_0x00be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x00be('0x1'));var jsonpatch=require(_0x00be('0x2'));var rp=require(_0x00be('0x3'));var moment=require(_0x00be('0x4'));var BPromise=require(_0x00be('0x5'));var Mustache=require(_0x00be('0x6'));var util=require(_0x00be('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x00be('0x8'));var ejs=require(_0x00be('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x00be('0xa'));var squel=require(_0x00be('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x00be('0xc'));var toCsv=require(_0x00be('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0x00be('0xd'));var juice=require(_0x00be('0xe'));var Redis=require('ioredis');var authService=require(_0x00be('0xf'));var qs=require(_0x00be('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x00be('0x11'))(_0x00be('0x12'));var utils=require(_0x00be('0x13'));var config=require(_0x00be('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x00be('0x15')]=_[_0x00be('0x16')](config[_0x00be('0x15')],{'host':_0x00be('0x17'),'port':0x18eb});var socket=require(_0x00be('0x18'))(new Redis(config[_0x00be('0x15')]));require(_0x00be('0x19'))[_0x00be('0x1a')](socket);function respondWithStatusCode(_0x2a2dbe,_0x14b8b3){_0x14b8b3=_0x14b8b3||0xcc;return function(_0x321dc1){if(_0x321dc1){return _0x2a2dbe[_0x00be('0x1b')](_0x14b8b3);}return _0x2a2dbe[_0x00be('0x1c')](_0x14b8b3)[_0x00be('0x1d')]();};}function respondWithResult(_0x59d8ad,_0x1ca855){_0x1ca855=_0x1ca855||0xc8;return function(_0x57ccc5){if(_0x57ccc5){return _0x59d8ad[_0x00be('0x1c')](_0x1ca855)[_0x00be('0x1e')](_0x57ccc5);}};}function respondWithFilteredResult(_0x269163,_0x5e44aa){return function(_0x3a78bf){if(_0x3a78bf){var _0x4ea7fe=typeof _0x5e44aa[_0x00be('0x1f')]===_0x00be('0x20')&&typeof _0x5e44aa[_0x00be('0x21')]===_0x00be('0x20');var _0x1ca475=_0x3a78bf[_0x00be('0x22')];var _0x195858=_0x4ea7fe?0x0:_0x5e44aa[_0x00be('0x1f')];var _0x339733=_0x4ea7fe?_0x3a78bf[_0x00be('0x22')]:_0x5e44aa[_0x00be('0x1f')]+_0x5e44aa[_0x00be('0x21')];var _0x1fade6;if(_0x339733>=_0x1ca475){_0x339733=_0x1ca475;_0x1fade6=0xc8;}else{_0x1fade6=0xce;}_0x269163[_0x00be('0x1c')](_0x1fade6);return _0x269163[_0x00be('0x23')](_0x00be('0x24'),_0x195858+'-'+_0x339733+'/'+_0x1ca475)[_0x00be('0x1e')](_0x3a78bf);}return null;};}function patchUpdates(_0x56dec4){return function(_0x5153f0){try{jsonpatch[_0x00be('0x25')](_0x5153f0,_0x56dec4,!![]);}catch(_0x1b467e){return BPromise['reject'](_0x1b467e);}return _0x5153f0[_0x00be('0x26')]();};}function saveUpdates(_0x9bebfc,_0x1d5047){return function(_0x53f1a3){if(_0x53f1a3){return _0x53f1a3[_0x00be('0x27')](_0x9bebfc)[_0x00be('0x28')](function(_0x5dd872){return _0x5dd872;});}return null;};}function removeEntity(_0x26b87a,_0x517ceb){return function(_0x3e4ec3){if(_0x3e4ec3){return _0x3e4ec3['destroy']()[_0x00be('0x28')](function(){_0x26b87a[_0x00be('0x1c')](0xcc)[_0x00be('0x1d')]();});}};}function handleEntityNotFound(_0x4535a3,_0x40f8b8){return function(_0x38df16){if(!_0x38df16){_0x4535a3[_0x00be('0x1b')](0x194);}return _0x38df16;};}function handleError(_0x1616df,_0x5a6f84){_0x5a6f84=_0x5a6f84||0x1f4;return function(_0x2c619e){logger[_0x00be('0x29')](_0x2c619e['stack']);if(_0x2c619e[_0x00be('0x2a')]){delete _0x2c619e[_0x00be('0x2a')];}_0x1616df['status'](_0x5a6f84)[_0x00be('0x2b')](_0x2c619e);};}function getInteractionUsers(_0x110ba7,_0x2430ca){return new BPromise(function(_0x2ee693,_0xc4c83d){try{if(_0x2430ca[_0x110ba7['id']]){_0x110ba7[_0x00be('0x2c')]=_['map'](_0x2430ca[_0x110ba7['id']],function(_0x17176f){return{'id':_0x17176f['id'],'fullname':_0x17176f['fullname']};});}}catch(_0x3c5b91){_0xc4c83d(_0x3c5b91);}_0x2ee693(_0x110ba7);});}function getInteractionTags(_0x39938e,_0x2a0e0e){return new BPromise(function(_0x58dd63,_0x59172d){try{if(_0x39938e[_0x00be('0x2d')]){_0x39938e[_0x00be('0x2e')]=[];_0x39938e['TagIds'][_0x00be('0x2f')](',')[_0x00be('0x30')](function(_0x54fcea){_0x39938e['Tags'][_0x00be('0x31')](_0x2a0e0e[_0x54fcea]);});}delete _0x39938e[_0x00be('0x2d')];}catch(_0x38af23){_0x59172d(_0x38af23);}_0x58dd63(_0x39938e);});}function getLastMessageText(_0x4a5485){return new BPromise(function(_0x1ef497,_0x4375e9){return db[_0x00be('0x32')][_0x00be('0x33')]({'where':{'$and':[{'MailInteractionId':_0x4a5485['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x00be('0x34')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x00be('0x35'),'raw':!![]})[_0x00be('0x28')](function(_0x17d819){if(_0x17d819&&_0x17d819[_0x00be('0x36')]){_0x4a5485['lastMsgText']=_['trimStart'](_0x17d819[_0x00be('0x36')]);}_0x1ef497(_0x4a5485);})[_0x00be('0x37')](function(_0x5c80d8){_0x4375e9(_0x5c80d8);});});}function updateMailInteraction(_0x24d3f1,_0x5bdc88,_0x5d200e,_0xd331ef){return new BPromise(function(_0x365b81,_0x2e9a41){return getInteractionUsers(_0x24d3f1,_0x5d200e)['then'](function(_0x1b7cfe){return getInteractionTags(_0x1b7cfe,_0x5bdc88);})[_0x00be('0x28')](function(_0x2bd6fb){if(_0xd331ef){_0x365b81(getLastMessageText(_0x2bd6fb));}else{_0x365b81(_0x2bd6fb);}})[_0x00be('0x37')](function(_0x38485d){_0x2e9a41(_0x38485d);});});}exports[_0x00be('0x38')]=function(_0x395b6e,_0x2a752f){var _0x2311d9={},_0x32347a={},_0x4c894a={'count':0x0,'rows':[]};var _0x2ab3b0=_[_0x00be('0x39')](db['MailInteraction'][_0x00be('0x3a')],function(_0x4ecd0b){return{'name':_0x4ecd0b['fieldName'],'type':_0x4ecd0b['type'][_0x00be('0x3b')]};});_0x32347a[_0x00be('0x3c')]=_[_0x00be('0x39')](_0x2ab3b0,_0x00be('0x2a'));_0x32347a[_0x00be('0x3d')]=_['keys'](_0x395b6e[_0x00be('0x3d')]);_0x32347a['filters']=_['intersection'](_0x32347a[_0x00be('0x3c')],_0x32347a[_0x00be('0x3d')]);_0x2311d9['attributes']=_[_0x00be('0x3e')](_0x32347a[_0x00be('0x3c')],qs[_0x00be('0x3f')](_0x395b6e[_0x00be('0x3d')]['fields']));_0x2311d9[_0x00be('0x40')]=_0x2311d9[_0x00be('0x40')][_0x00be('0x41')]?_0x2311d9[_0x00be('0x40')]:_0x32347a[_0x00be('0x3c')];if(!_0x395b6e['query'][_0x00be('0x42')](_0x00be('0x43'))){_0x2311d9['limit']=qs['limit'](_0x395b6e[_0x00be('0x3d')]['limit']);_0x2311d9['offset']=qs[_0x00be('0x1f')](_0x395b6e[_0x00be('0x3d')][_0x00be('0x1f')]);}_0x2311d9[_0x00be('0x44')]=qs[_0x00be('0x45')](_0x395b6e[_0x00be('0x3d')][_0x00be('0x45')]);_0x2311d9[_0x00be('0x46')]=qs[_0x00be('0x47')](_[_0x00be('0x48')](_0x395b6e[_0x00be('0x3d')],_0x32347a[_0x00be('0x47')]),_0x2ab3b0);var _0x56fdce=[];var _0x286206=squel[_0x00be('0x49')]()[_0x00be('0x4a')]('id')[_0x00be('0x4a')](_0x00be('0x2a'))[_0x00be('0x4a')](_0x00be('0x4b'))[_0x00be('0x4c')](_0x00be('0x4d'));var _0x3b0cef=squel[_0x00be('0x49')]()[_0x00be('0x4a')](_0x00be('0x4e'))[_0x00be('0x4a')](_0x00be('0x4f'))[_0x00be('0x4a')]('ui.MailInteractionId')[_0x00be('0x4c')](_0x00be('0x50'),'ui')[_0x00be('0x51')](_0x00be('0x52'),'u',_0x00be('0x53'));var _0x5e392e=squel[_0x00be('0x49')]()[_0x00be('0x4c')](_0x00be('0x54'),'i')[_0x00be('0x51')](_0x00be('0x55'),'c',_0x00be('0x56'))['left_join']('users','o',_0x00be('0x57'))[_0x00be('0x51')]('mail_accounts','a',_0x00be('0x58'))['left_join']('mail_messages','me',_0x00be('0x59'))[_0x00be('0x51')](_0x00be('0x5a'),'it',_0x00be('0x5b'))[_0x00be('0x51')](_0x00be('0x4d'),'t',_0x00be('0x5c'));var _0x3e2688=squel['expr']();var _0x89329f=[];var _0x5cdbef=squel[_0x00be('0x5d')]();var _0x578fa7;if(_0x395b6e['query'][_0x00be('0x5e')]){_0x578fa7=as['parseSearch'](_0x395b6e[_0x00be('0x3d')][_0x00be('0x5e')]);var _0x11a3af=_0x578fa7[_0x00be('0x5f')];for(var _0xbdc688=0x0;_0xbdc688<_0x578fa7[_0x00be('0x60')][_0x00be('0x41')];_0xbdc688++){var _0x113dcd=_0x578fa7[_0x00be('0x60')][_0xbdc688];var _0xada7c1='i';var _0x5493f4=_[_0x00be('0x61')](_0x2ab3b0,[_0x00be('0x2a'),_0x113dcd['field']]);if(!_0x5493f4){switch(_0x113dcd['field']){case _0x00be('0x62'):if(_0x113dcd['value']==0x1){_0x5e392e['having']('`'+_0x113dcd[_0x00be('0x4a')]+_0x00be('0x63'));}else{_0x5e392e[_0x00be('0x64')]('`'+_0x113dcd[_0x00be('0x4a')]+_0x00be('0x65'));}break;case _0x00be('0x66'):if(_0x113dcd[_0x00be('0x67')]===_0x00be('0x68')){if(_0x113dcd[_0x00be('0x69')][_0x00be('0x2f')]('\x20')[_0x00be('0x41')]>0x1){_0x3e2688[_0x11a3af](_0x00be('0x6a'),qs['getFullTextValue'](_0x113dcd[_0x00be('0x69')]),null);}else{var _0x5e9130='%'+_0x113dcd[_0x00be('0x69')]+'%';_0x3e2688[_0x11a3af]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5e9130,_0x5e9130,_0x5e9130);}}else{_0x5493f4=_['find'](_0x2ab3b0,[_0x00be('0x2a'),_0x00be('0x6b')]);_0x113dcd[_0x00be('0x4a')]=_0x00be('0x6b');_0x51e913=as[_0x00be('0x6c')](_0xada7c1,_0x5493f4[_0x00be('0x6d')],_0x113dcd);_0x3e2688[_0x11a3af](_0x51e913[_0x00be('0x6e')],_0x51e913[_0x00be('0x69')]['start'],_0x51e913[_0x00be('0x69')]['end']);}break;case'Tag':var _0x9d5ba=_0x113dcd[_0x00be('0x69')]['split'](',')[_0x00be('0x39')](function(_0x9b9106){return Number(_0x9b9106);});_0x9d5ba[_0x00be('0x30')](function(_0x1dcfe2){_0x5cdbef['or'](_0x00be('0x6f'),'%,'+_0x1dcfe2+',%');});_0x89329f=_[_0x00be('0x70')](_0x89329f,_0x9d5ba);break;case'User':if(_0x113dcd[_0x00be('0x67')]==='$substring'){_0x3e2688[_0x11a3af](_0x00be('0x71'),'%'+_0x113dcd[_0x00be('0x69')]+'%',null);}else{_0x5493f4=_[_0x00be('0x61')](_0x2ab3b0,[_0x00be('0x2a'),_0x00be('0x72')]);_0x113dcd[_0x00be('0x4a')]=_0x00be('0x72');_0x51e913=as['buildExpression'](_0xada7c1,_0x5493f4[_0x00be('0x6d')],_0x113dcd);_0x3e2688[_0x11a3af](_0x51e913[_0x00be('0x6e')],_0x51e913[_0x00be('0x69')]['start'],_0x51e913[_0x00be('0x69')]['end']);}break;case _0x00be('0x36'):_0x51e913=as['buildExpression']('me',null,_0x113dcd);_0x3e2688[_0x11a3af](_0x51e913[_0x00be('0x6e')],_0x51e913[_0x00be('0x69')][_0x00be('0x73')],_0x51e913[_0x00be('0x69')]['end']);break;}}else{var _0x51e913=as['buildExpression'](_0xada7c1,_0x5493f4[_0x00be('0x6d')],_0x113dcd);_0x3e2688[_0x11a3af](_0x51e913[_0x00be('0x6e')],_0x51e913[_0x00be('0x69')][_0x00be('0x73')],_0x51e913[_0x00be('0x69')][_0x00be('0x1d')]);}}}else{var _0x949f78=_(_0x395b6e['query'])['keys']()[_0x00be('0x39')](function(_0x10bc91){return _[_0x00be('0x74')](_0x2ab3b0,[_0x00be('0x2a'),_0x10bc91])?_0x10bc91:undefined;})[_0x00be('0x75')]()['value']();if(!_[_0x00be('0x76')](_0x949f78)){_0x949f78[_0x00be('0x30')](function(_0x405786){if(_0x405786===_0x00be('0x77')){_0x5e392e['where'](_0x00be('0x78'),[][_0x00be('0x79')](_0x395b6e[_0x00be('0x3d')][_0x405786]));}else if(_0x405786===_0x00be('0x7a')){var _0x5b200b=JSON[_0x00be('0x7b')](_0x395b6e[_0x00be('0x3d')][_0x405786])[_0x00be('0x7c')];var _0x8c7b31=JSON[_0x00be('0x7b')](_0x395b6e[_0x00be('0x3d')][_0x405786])[_0x00be('0x7d')];_0x5e392e[_0x00be('0x46')](_0x00be('0x7e'),_0x5b200b,_0x8c7b31);}else{if(_0x395b6e[_0x00be('0x3d')][_0x405786]===_0x00be('0x7f')){_0x5e392e['where']('i.'+_0x405786+_0x00be('0x80'));}else{_0x5e392e[_0x00be('0x46')]('i.'+_0x405786+_0x00be('0x81'),_0x395b6e[_0x00be('0x3d')][_0x405786]);}}});}if(_0x395b6e[_0x00be('0x3d')][_0x00be('0x82')]){if(_0x395b6e['query'][_0x00be('0x82')]==0x1){_0x5e392e[_0x00be('0x64')](_0x00be('0x83'));}else{_0x5e392e[_0x00be('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x395b6e[_0x00be('0x3d')][_0x00be('0x84')]){_0x89329f=_[_0x00be('0x85')](_0x395b6e[_0x00be('0x3d')]['tag'])?_0x395b6e[_0x00be('0x3d')][_0x00be('0x84')]:new Array(_0x395b6e[_0x00be('0x3d')][_0x00be('0x84')]);_0x89329f[_0x00be('0x30')](function(_0x8d651){_0x5cdbef['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x8d651+',%');});}if(_0x395b6e[_0x00be('0x3d')]['filter']){var _0x106cc8=_0x395b6e[_0x00be('0x3d')][_0x00be('0x86')][_0x00be('0x87')]('\x5c','\x5c\x5c')[_0x00be('0x87')](/'/g,'\x27\x27');if(qs[_0x00be('0x88')](_0x106cc8)){_0x3e2688['or'](_0x00be('0x89'),_0x106cc8+'%');}else if(qs[_0x00be('0x8a')](_0x106cc8)){_0x3e2688['or'](_0x00be('0x8b'),_0x106cc8+'%');}else{_0x3e2688['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x00be('0x8c')](_0x106cc8))['or'](_0x00be('0x8d'),qs[_0x00be('0x8c')](_0x106cc8));}}}_0x5e392e[_0x00be('0x46')](_0x3e2688);_0x5e392e['group'](_0x00be('0x8e'));var _0x46368a={'type':db[_0x00be('0x8f')][_0x00be('0x90')]['SELECT'],'raw':!![]};var _0x236ac4=_0x5e392e[_0x00be('0x91')]();_0x236ac4[_0x00be('0x4a')]('i.id');_0x236ac4[_0x00be('0x4a')](_0x00be('0x92'),_0x00be('0x62'));if(_0x2311d9[_0x00be('0x44')]){_0x2311d9[_0x00be('0x44')]['forEach'](function(_0x5b87ff){var _0xbdc037=_0x5b87ff[0x0]===_0x00be('0x93')?_0x5b87ff[0x0]:'i.'+_0x5b87ff[0x0];_0x5e392e['order'](_0xbdc037,_0x5b87ff[0x1]==='DESC'?![]:!![]);});}if(!_[_0x00be('0x76')](_0x89329f)){_0x5e392e['having'](_0x5cdbef);_0x236ac4[_0x00be('0x46')](_0x00be('0x94'),_0x89329f);}BPromise[_0x00be('0x95')]()['then'](function(){if(!_0x578fa7){if(_0x395b6e[_0x00be('0x3d')][_0x00be('0x77')])return;_0x236ac4['where'](_0x00be('0x96'));_0x5e392e[_0x00be('0x46')](_0x00be('0x96'));return;}if(_0x395b6e[_0x00be('0x97')][_0x00be('0x98')]!==_0x00be('0x99'))return;return _0x395b6e[_0x00be('0x97')][_0x00be('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x40490b){if(_[_0x00be('0x76')](_0x40490b)){_0x236ac4['where'](_0x00be('0x9b'));_0x5e392e[_0x00be('0x46')](_0x00be('0x9b'));}else{_0x236ac4[_0x00be('0x46')](_0x00be('0x78'),_['map'](_0x40490b,'id'));_0x5e392e[_0x00be('0x46')](_0x00be('0x78'),_['map'](_0x40490b,'id'));}});})[_0x00be('0x28')](function(){if(_0x395b6e['user']['role']===_0x00be('0x99')&&!_0x578fa7&&!_0x395b6e['query'][_0x00be('0x77')])return[];return db['sequelize'][_0x00be('0x3d')](_0x236ac4[_0x00be('0x9c')](),_0x46368a);})['then'](function(_0x1cce4b){_0x4c894a[_0x00be('0x22')]=_0x1cce4b[_0x00be('0x41')];if(_0x4c894a[_0x00be('0x22')]===0x0)return[];return db[_0x00be('0x9d')][_0x00be('0x3d')](_0x286206[_0x00be('0x9c')](),_0x46368a)[_0x00be('0x28')](function(_0x2fc504){_0x56fdce=_[_0x00be('0x9e')](_0x2fc504,'id');_0x46368a=_[_0x00be('0x9f')](_0x46368a,{'model':db[_0x00be('0xa0')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x395b6e[_0x00be('0x3d')]['fields']){_0x2311d9['attributes']['forEach'](function(_0x5813ff){_0x5e392e[_0x00be('0x4a')]('i.'+_0x5813ff);});}else{_0x5e392e[_0x00be('0x4a')](_0x00be('0x92'),_0x00be('0x62'));_0x5e392e[_0x00be('0x4a')]('a.key',_0x00be('0xa1'));_0x5e392e[_0x00be('0x4a')](_0x00be('0xa2'),_0x00be('0xa3'));_0x5e392e[_0x00be('0x4a')](_0x00be('0xa4'),_0x00be('0x93'));_0x5e392e['field'](_0x00be('0x8e'));_0x5e392e[_0x00be('0x4a')]('i.createdAt');_0x5e392e[_0x00be('0x4a')]('i.updatedAt');_0x5e392e[_0x00be('0x4a')](_0x00be('0xa5'));_0x5e392e['field'](_0x00be('0xa6'));_0x5e392e[_0x00be('0x4a')](_0x00be('0xa7'));_0x5e392e[_0x00be('0x4a')](_0x00be('0xa8'));_0x5e392e[_0x00be('0x4a')](_0x00be('0xa9'));_0x5e392e[_0x00be('0x4a')](_0x00be('0xaa'));_0x5e392e[_0x00be('0x4a')](_0x00be('0xab'));_0x5e392e[_0x00be('0x4a')](_0x00be('0xac'));_0x5e392e['field'](_0x00be('0xad'));_0x5e392e[_0x00be('0x4a')]('i.substatus');_0x5e392e[_0x00be('0x4a')](_0x00be('0xae'));_0x5e392e[_0x00be('0x4a')](_0x00be('0xaf'));_0x5e392e['field'](_0x00be('0xb0'));_0x5e392e['field']('i.UserId');_0x5e392e[_0x00be('0x4a')](_0x00be('0xb1'),'Contact.firstName');_0x5e392e['field'](_0x00be('0xb2'),_0x00be('0xb3'));_0x5e392e[_0x00be('0x4a')]('c.email',_0x00be('0xb4'));_0x5e392e['field'](_0x00be('0xb5'),_0x00be('0xb6'));_0x5e392e[_0x00be('0x4a')](_0x00be('0xb7'),_0x00be('0xb8'));_0x5e392e[_0x00be('0x4a')](_0x00be('0xb9'),'Contact.fax');_0x5e392e[_0x00be('0x4a')]('o.fullname',_0x00be('0xba'));_0x5e392e[_0x00be('0x4a')](_0x00be('0xbb'),_0x00be('0xbc'));_0x5e392e['field'](_0x00be('0xbd'),_0x00be('0x2d'));}if(_0x2311d9['limit'])_0x5e392e[_0x00be('0x21')](_0x2311d9[_0x00be('0x21')]);if(_0x2311d9[_0x00be('0x1f')])_0x5e392e['offset'](_0x2311d9[_0x00be('0x1f')]);return db[_0x00be('0x9d')][_0x00be('0x3d')](_0x5e392e['toString'](),_0x46368a);})[_0x00be('0x28')](function(_0x4a9a7a){if(_0x4a9a7a[_0x00be('0x41')]>0x0)_0x3b0cef[_0x00be('0x46')](_0x00be('0xbe'),_[_0x00be('0x39')](_0x4a9a7a,'id'));return db['sequelize'][_0x00be('0x3d')](_0x3b0cef[_0x00be('0x9c')](),_0x46368a)[_0x00be('0x28')](function(_0x55c022){var _0x51ee3f=_['groupBy'](_0x55c022,_0x00be('0xbf'));var _0x4a256e=[];return db[_0x00be('0xc0')][_0x00be('0x33')]({'attributes':[_0x00be('0xc1')],'raw':!![]})['then'](function(_0x13ffc3){var _0x1758f2=_0x13ffc3[_0x00be('0xc1')];_0x4a9a7a['forEach'](function(_0x4b9265){_0x4a256e[_0x00be('0x31')](updateMailInteraction(_0x4b9265,_0x56fdce,_0x51ee3f,_0x1758f2));});return BPromise[_0x00be('0xc2')](_0x4a256e);});});});})[_0x00be('0x28')](function(_0x250def){_0x4c894a[_0x00be('0xc3')]=_0x250def;return _0x4c894a;})[_0x00be('0x28')](respondWithFilteredResult(_0x2a752f,_0x2311d9))[_0x00be('0x37')](handleError(_0x2a752f,null));};exports[_0x00be('0xc4')]=function(_0x316980,_0x299a01){var _0x544dd6={'raw':![],'where':{'id':_0x316980['params']['id']}},_0x3e77d2={};_0x3e77d2[_0x00be('0x3c')]=_[_0x00be('0xc5')](db[_0x00be('0xa0')]['rawAttributes']);_0x3e77d2[_0x00be('0x3d')]=_[_0x00be('0xc5')](_0x316980[_0x00be('0x3d')]);_0x3e77d2['filters']=_[_0x00be('0x3e')](_0x3e77d2[_0x00be('0x3c')],_0x3e77d2['query']);_0x544dd6['attributes']=_['intersection'](_0x3e77d2[_0x00be('0x3c')],qs[_0x00be('0x3f')](_0x316980[_0x00be('0x3d')]['fields']));_0x544dd6[_0x00be('0x40')]=_0x544dd6[_0x00be('0x40')][_0x00be('0x41')]?_0x544dd6[_0x00be('0x40')]:_0x3e77d2[_0x00be('0x3c')];if(_0x316980[_0x00be('0x3d')][_0x00be('0xc6')]){_0x544dd6[_0x00be('0xc7')]=[{'all':!![]}];}_0x544dd6=_[_0x00be('0x9f')]({},_0x544dd6,_0x316980[_0x00be('0xc8')]);return db[_0x00be('0xa0')]['find'](_0x544dd6)[_0x00be('0x28')](handleEntityNotFound(_0x299a01,null))['then'](respondWithResult(_0x299a01,null))['catch'](handleError(_0x299a01,null));};exports[_0x00be('0xc9')]=function(_0x1e7e0f,_0x2a7a93){return db[_0x00be('0xa0')][_0x00be('0xc9')](_0x1e7e0f[_0x00be('0xca')],{})['then'](respondWithResult(_0x2a7a93,0xc9))[_0x00be('0x37')](handleError(_0x2a7a93,null));};exports[_0x00be('0x27')]=function(_0x5e0f3c,_0x56da70){if(_0x5e0f3c['body']['id']){delete _0x5e0f3c[_0x00be('0xca')]['id'];}return db['MailInteraction'][_0x00be('0x61')]({'where':{'id':_0x5e0f3c[_0x00be('0xcb')]['id']}})[_0x00be('0x28')](handleEntityNotFound(_0x56da70,null))[_0x00be('0x28')](saveUpdates(_0x5e0f3c[_0x00be('0xca')],null))[_0x00be('0x28')](respondWithResult(_0x56da70,null))['catch'](handleError(_0x56da70,null));};exports[_0x00be('0xcc')]=function(_0x128f94,_0x34da5d){return db[_0x00be('0xa0')][_0x00be('0x61')]({'where':{'id':_0x128f94[_0x00be('0xcb')]['id']}})[_0x00be('0x28')](handleEntityNotFound(_0x34da5d,null))['then'](removeEntity(_0x34da5d,null))[_0x00be('0x37')](handleError(_0x34da5d,null));};exports['describe']=function(_0x9f0d0b,_0x410222){return db[_0x00be('0xa0')][_0x00be('0xcd')]()['then'](respondWithResult(_0x410222,null))[_0x00be('0x37')](handleError(_0x410222,null));};exports[_0x00be('0xce')]=function(_0x4bedc7,_0x353766,_0x40f285){return db[_0x00be('0x32')]['find']({'where':{'id':_0x4bedc7['params']['id']}})[_0x00be('0x28')](handleEntityNotFound(_0x353766,null))[_0x00be('0x28')](function(_0xf2a0d6){if(_0xf2a0d6){return _0xf2a0d6['addMessage'](_0x4bedc7[_0x00be('0xca')]['ids'],_[_0x00be('0xcf')](_0x4bedc7['body'],[_0x00be('0xd0'),'id'])||{});}})[_0x00be('0x28')](respondWithResult(_0x353766,null))[_0x00be('0x37')](handleError(_0x353766,null));};exports[_0x00be('0xd1')]=function(_0x1746d9,_0x5a0f42,_0x3b10fd){var _0x7fc1c6={'raw':![],'where':{}};var _0x4db21d={};var _0x173d15={'count':0x0,'rows':[]};return db[_0x00be('0xa0')][_0x00be('0x33')]({'where':{'id':_0x1746d9[_0x00be('0xcb')]['id']}})[_0x00be('0x28')](handleEntityNotFound(_0x5a0f42,null))[_0x00be('0x28')](function(_0x36f1da){if(_0x36f1da){_0x4db21d[_0x00be('0x3c')]=_[_0x00be('0xc5')](db[_0x00be('0x32')][_0x00be('0x3a')]);_0x4db21d[_0x00be('0x3d')]=_[_0x00be('0xc5')](_0x1746d9[_0x00be('0x3d')]);_0x4db21d['filters']=_[_0x00be('0x3e')](_0x4db21d[_0x00be('0x3c')],_0x4db21d[_0x00be('0x3d')]);_0x7fc1c6[_0x00be('0x40')]=_[_0x00be('0x3e')](_0x4db21d[_0x00be('0x3c')],qs[_0x00be('0x3f')](_0x1746d9['query']['fields']));_0x7fc1c6['attributes']=_0x7fc1c6[_0x00be('0x40')][_0x00be('0x41')]?_0x7fc1c6[_0x00be('0x40')]:_0x4db21d['model'];if(!_0x1746d9[_0x00be('0x3d')][_0x00be('0x42')](_0x00be('0x43'))){_0x7fc1c6[_0x00be('0x21')]=qs[_0x00be('0x21')](_0x1746d9['query'][_0x00be('0x21')]);_0x7fc1c6[_0x00be('0x1f')]=qs[_0x00be('0x1f')](_0x1746d9['query'][_0x00be('0x1f')]);}_0x7fc1c6[_0x00be('0x44')]=qs['sort'](_0x1746d9[_0x00be('0x3d')]['sort']);_0x7fc1c6['where']=qs['filters'](_['pick'](_0x1746d9[_0x00be('0x3d')],_0x4db21d[_0x00be('0x47')]));_0x7fc1c6[_0x00be('0x46')][_0x00be('0xbf')]=_0x36f1da['id'];if(_0x1746d9[_0x00be('0x3d')]['filter']){_0x7fc1c6[_0x00be('0x46')]=_['merge'](_0x7fc1c6[_0x00be('0x46')],{'$or':_[_0x00be('0x39')](_0x7fc1c6[_0x00be('0x40')],function(_0x4778e0){var _0x489a37={};_0x489a37[_0x4778e0]={'$like':'%'+_0x1746d9[_0x00be('0x3d')][_0x00be('0x86')]+'%'};return _0x489a37;})});}if(_0x1746d9[_0x00be('0x3d')][_0x00be('0x7c')]){var _0x59901f=_0x1746d9[_0x00be('0x3d')][_0x00be('0x7c')][_0x00be('0x2f')](',');var _0x5b987e={};_0x5b987e[_0x59901f[0x0]]={'$gte':moment(_0x59901f[0x1])[_0x00be('0xd2')](_0x00be('0xd3'))};_0x7fc1c6[_0x00be('0x46')]=_[_0x00be('0x9f')](_0x7fc1c6['where'],_0x5b987e);}_0x7fc1c6=_[_0x00be('0x9f')]({},_0x7fc1c6,_0x1746d9['options']);return db[_0x00be('0x32')][_0x00be('0x22')]({'where':_0x7fc1c6[_0x00be('0x46')]})[_0x00be('0x28')](function(_0xeab1e7){_0x173d15[_0x00be('0x22')]=_0xeab1e7;if(_0x1746d9[_0x00be('0x3d')][_0x00be('0xc6')]){_0x7fc1c6['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x7fc1c6);})[_0x00be('0x28')](function(_0x365e1f){if(_0x1746d9[_0x00be('0x3d')][_0x00be('0xd4')]===_0x00be('0xd5')){for(var _0x2dc48f=0x0;_0x2dc48f<_0x365e1f['length'];_0x2dc48f++){_0x365e1f[_0x2dc48f][_0x00be('0xca')]=juice(_0x365e1f[_0x2dc48f]['body']);}}_0x173d15[_0x00be('0xc3')]=_0x365e1f;return _0x173d15;});}})[_0x00be('0x28')](respondWithFilteredResult(_0x5a0f42,_0x7fc1c6))['catch'](handleError(_0x5a0f42,null));};exports['addTags']=function(_0x21f550,_0x45682e,_0x3487a3){return db['MailInteraction'][_0x00be('0x61')]({'where':{'id':_0x21f550[_0x00be('0xcb')]['id']}})['then'](handleEntityNotFound(_0x45682e,null))[_0x00be('0x28')](function(_0x3c2fab){if(_0x3c2fab){return _0x3c2fab[_0x00be('0xd6')](_0x21f550[_0x00be('0xca')][_0x00be('0xd0')],_[_0x00be('0xcf')](_0x21f550[_0x00be('0xca')],[_0x00be('0xd0'),'id'])||{})[_0x00be('0xd7')](function(){return db[_0x00be('0xd8')][_0x00be('0xd9')]({'attributes':['id','name',_0x00be('0x4b')],'where':{'id':_0x21f550[_0x00be('0xca')][_0x00be('0xd0')]}});})[_0x00be('0x28')](function(_0x41b2fc){socket[_0x00be('0xda')](_0x00be('0xdb'),{'id':Number(_0x21f550[_0x00be('0xcb')]['id']),'tags':_0x41b2fc||[]});return{'id':Number(_0x21f550['params']['id']),'tags':_0x41b2fc||[]};});}})[_0x00be('0x28')](respondWithResult(_0x45682e,null))['catch'](handleError(_0x45682e,null));};exports[_0x00be('0xdc')]=function(_0x2a2c7e,_0x4af879,_0x30fc15){return db[_0x00be('0xa0')][_0x00be('0x61')]({'where':{'id':_0x2a2c7e['params']['id']}})[_0x00be('0x28')](handleEntityNotFound(_0x4af879,null))[_0x00be('0x28')](function(_0x26e51d){if(_0x26e51d){return _0x26e51d[_0x00be('0xdc')](_0x2a2c7e[_0x00be('0x3d')][_0x00be('0xd0')]);}})[_0x00be('0x28')](respondWithStatusCode(_0x4af879,null))[_0x00be('0x37')](handleError(_0x4af879,null));};exports[_0x00be('0xdd')]=function(_0x561afd,_0x1eec27){var _0x2da778=moment()[_0x00be('0xde')]()[_0x00be('0x9c')]();var _0x50256d=path[_0x00be('0xdf')](config[_0x00be('0xe0')],_0x00be('0xe1'),_0x00be('0xe2'),_0x00be('0xe3'));var _0x1cc7e5=path[_0x00be('0xdf')](config[_0x00be('0xe0')],_0x00be('0xe1'),_0x00be('0xe2'),'attachments');var _0x2ddf1e=path['join'](_0x50256d,_0x2da778);var _0x3e0abe=util[_0x00be('0xd2')](_0x00be('0xe4'),_0x561afd[_0x00be('0xcb')]['id'],_0x2da778);var _0x6729ba=path[_0x00be('0xdf')](_0x50256d,_0x3e0abe);var _0x5443e0=[];if(_0x561afd[_0x00be('0x3d')][_0x00be('0xe5')]){_0x5443e0['push']({'model':db[_0x00be('0xe6')],'as':_0x00be('0xe7'),'raw':!![]});}var _0x3d2c82=[{'model':db[_0x00be('0x32')],'as':'Messages','attributes':['id','body',_0x00be('0x4c'),'to','cc',_0x00be('0xe8'),_0x00be('0xe9'),'createdAt'],'where':{'secret':![]},'order':qs[_0x00be('0x45')]('id'),'include':_0x5443e0}];return db[_0x00be('0xa0')]['find']({'where':{'id':_0x561afd[_0x00be('0xcb')]['id']},'include':_0x3d2c82})[_0x00be('0x28')](handleEntityNotFound(_0x1eec27,null))[_0x00be('0x28')](function(_0x9898f7){if(_0x9898f7&&_0x9898f7[_0x00be('0xea')]){var _0x3f48f2=_0x9898f7[_0x00be('0xeb')]({'plain':!![]});fs[_0x00be('0xec')](_0x2ddf1e);return BPromise['each'](_0x3f48f2[_0x00be('0xea')],function(_0x527283,_0x2df2b6){var _0x1ece4a={'from':_0x527283[_0x00be('0x4c')],'to':_0x527283['to'],'subject':_0x527283['subject'],'html':_0x527283[_0x00be('0xca')],'headers':{'Date':moment(_0x527283[_0x00be('0x7a')])[_0x00be('0xd2')](_0x00be('0xed'))},'attachments':[]};if(_0x527283['cc']){_0x1ece4a[_0x00be('0xee')]['Cc']=_0x527283['cc'];}if(_0x527283[_0x00be('0xe8')]){_0x1ece4a[_0x00be('0xee')][_0x00be('0xef')]=_0x527283[_0x00be('0xe8')];}return new BPromise(function(_0x408cdd,_0x350fe3){if(_0x527283[_0x00be('0xe7')]){for(var _0x16db9a=0x0;_0x16db9a<_0x527283[_0x00be('0xe7')][_0x00be('0x41')];_0x16db9a++){var _0x25ec78=_0x527283[_0x00be('0xe7')][_0x16db9a];var _0x39977f=path[_0x00be('0xdf')](_0x1cc7e5,_0x25ec78['basename']);if(fs['existsSync'](_0x39977f)){_0x1ece4a[_0x00be('0xe5')][_0x00be('0x31')]({'name':_0x25ec78['name'],'contentType':_0x25ec78[_0x00be('0x6d')],'data':fs['readFileSync'](_0x39977f)});}}}emlformat['build'](_0x1ece4a,function(_0x1e158d,_0x46c567){if(_0x1e158d)return _0x350fe3(_0x1e158d);fs[_0x00be('0xf0')](path[_0x00be('0xdf')](_0x2ddf1e,util[_0x00be('0xd2')]('message%d.eml',_0x2df2b6)),_0x46c567);return _0x408cdd(_0x46c567);});});})[_0x00be('0x28')](function(){return new BPromise(function(_0x3d50f6,_0x3ed22f){zipdir(_0x2ddf1e,{'saveTo':_0x6729ba},function(_0xcb7959,_0x3306a7){if(_0xcb7959)return _0x3ed22f(_0xcb7959);return _0x3d50f6(_0x3306a7);});})[_0x00be('0x28')](function(){return new BPromise(function(_0x216d25,_0x158387){rimraf(_0x2ddf1e,function(_0x3fc81e){if(_0x3fc81e)_0x158387(_0x3fc81e);return _0x216d25();});});})[_0x00be('0x28')](function(){return _0x1eec27['download'](_0x6729ba,_0x3e0abe,function(_0x4b87bc){if(_0x4b87bc){console[_0x00be('0xf1')](_0x00be('0xf2'),_0x4b87bc);}else{fs[_0x00be('0xf3')](_0x6729ba);}});});});}else{return _0x1eec27[_0x00be('0x1b')](0xc8);}})['catch'](handleError(_0x1eec27,null));}; \ No newline at end of file +var _0x9cf3=['rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','split','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_mail_interactions','left_join','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','forEach','union','User','operator','UserId','text','start','end','some','compact','isEmpty','MailAccountId','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','include','options','create','body','params','describe','addMessage','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','setTags','omit','spread','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join','server','files','attachments','transcript-%d-%s.zip','Messages','bcc','subject','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','err','unlinkSync','eml-format'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x9cf3,0x1eb));var _0x39cf=function(_0x570764,_0x4c95db){_0x570764=_0x570764-0x0;var _0x20a0a7=_0x9cf3[_0x570764];return _0x20a0a7;};'use strict';var emlformat=require(_0x39cf('0x0'));var rimraf=require(_0x39cf('0x1'));var zipdir=require(_0x39cf('0x2'));var jsonpatch=require(_0x39cf('0x3'));var rp=require(_0x39cf('0x4'));var moment=require(_0x39cf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x39cf('0x6'));var path=require('path');var sox=require(_0x39cf('0x7'));var csv=require(_0x39cf('0x8'));var ejs=require(_0x39cf('0x9'));var fs=require('fs');var fs_extra=require(_0x39cf('0xa'));var _=require(_0x39cf('0xb'));var squel=require(_0x39cf('0xc'));var crypto=require(_0x39cf('0xd'));var jsforce=require(_0x39cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x39cf('0x8'));var querystring=require('querystring');var Papa=require(_0x39cf('0xf'));var htmlToText=require(_0x39cf('0x10'));var juice=require('juice');var Redis=require(_0x39cf('0x11'));var authService=require(_0x39cf('0x12'));var qs=require(_0x39cf('0x13'));var as=require(_0x39cf('0x14'));var hardwareService=require(_0x39cf('0x15'));var logger=require(_0x39cf('0x16'))(_0x39cf('0x17'));var utils=require('../../config/utils');var config=require(_0x39cf('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x39cf('0x19'))['db'];config[_0x39cf('0x1a')]=_['defaults'](config['redis'],{'host':_0x39cf('0x1b'),'port':0x18eb});var socket=require(_0x39cf('0x1c'))(new Redis(config[_0x39cf('0x1a')]));require(_0x39cf('0x1d'))[_0x39cf('0x1e')](socket);function respondWithStatusCode(_0x406c58,_0x6d7d89){_0x6d7d89=_0x6d7d89||0xcc;return function(_0x29e7b0){if(_0x29e7b0){return _0x406c58[_0x39cf('0x1f')](_0x6d7d89);}return _0x406c58[_0x39cf('0x20')](_0x6d7d89)['end']();};}function respondWithResult(_0x518b2c,_0x262e14){_0x262e14=_0x262e14||0xc8;return function(_0x33a050){if(_0x33a050){return _0x518b2c[_0x39cf('0x20')](_0x262e14)['json'](_0x33a050);}};}function respondWithFilteredResult(_0x2d24f8,_0x10f9bc){return function(_0x52a259){if(_0x52a259){var _0x240bfa=typeof _0x10f9bc[_0x39cf('0x21')]===_0x39cf('0x22')&&typeof _0x10f9bc[_0x39cf('0x23')]===_0x39cf('0x22');var _0x405bbe=_0x52a259['count'];var _0x7396ab=_0x240bfa?0x0:_0x10f9bc[_0x39cf('0x21')];var _0x4b6cf1=_0x240bfa?_0x52a259[_0x39cf('0x24')]:_0x10f9bc[_0x39cf('0x21')]+_0x10f9bc[_0x39cf('0x23')];var _0x52e04f;if(_0x4b6cf1>=_0x405bbe){_0x4b6cf1=_0x405bbe;_0x52e04f=0xc8;}else{_0x52e04f=0xce;}_0x2d24f8[_0x39cf('0x20')](_0x52e04f);return _0x2d24f8['set'](_0x39cf('0x25'),_0x7396ab+'-'+_0x4b6cf1+'/'+_0x405bbe)[_0x39cf('0x26')](_0x52a259);}return null;};}function patchUpdates(_0x836d7f){return function(_0x5de71c){try{jsonpatch[_0x39cf('0x27')](_0x5de71c,_0x836d7f,!![]);}catch(_0x5cd53a){return BPromise[_0x39cf('0x28')](_0x5cd53a);}return _0x5de71c[_0x39cf('0x29')]();};}function saveUpdates(_0x3623bd,_0x485eca){return function(_0x58be04){if(_0x58be04){return _0x58be04[_0x39cf('0x2a')](_0x3623bd)[_0x39cf('0x2b')](function(_0x69806c){return _0x69806c;});}return null;};}function removeEntity(_0x54c375,_0x272edd){return function(_0x23432f){if(_0x23432f){return _0x23432f[_0x39cf('0x2c')]()[_0x39cf('0x2b')](function(){_0x54c375[_0x39cf('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e4942,_0x1336f2){return function(_0x4e48fc){if(!_0x4e48fc){_0x4e4942[_0x39cf('0x1f')](0x194);}return _0x4e48fc;};}function handleError(_0x2e30c7,_0x2f7671){_0x2f7671=_0x2f7671||0x1f4;return function(_0x3418be){logger[_0x39cf('0x2d')](_0x3418be['stack']);if(_0x3418be[_0x39cf('0x2e')]){delete _0x3418be[_0x39cf('0x2e')];}_0x2e30c7[_0x39cf('0x20')](_0x2f7671)[_0x39cf('0x2f')](_0x3418be);};}function getInteractionUsers(_0xfc7071,_0x22a970){return new BPromise(function(_0x3601d1,_0x54811b){try{if(_0x22a970[_0xfc7071['id']]){_0xfc7071[_0x39cf('0x30')]=_[_0x39cf('0x31')](_0x22a970[_0xfc7071['id']],function(_0x35adde){return{'id':_0x35adde['id'],'fullname':_0x35adde[_0x39cf('0x32')]};});}}catch(_0x3019ec){_0x54811b(_0x3019ec);}_0x3601d1(_0xfc7071);});}function getInteractionTags(_0x1d1416,_0x237850){return new BPromise(function(_0x2b3826,_0x340aea){try{if(_0x1d1416[_0x39cf('0x33')]){_0x1d1416[_0x39cf('0x34')]=[];_0x1d1416['TagIds'][_0x39cf('0x35')](',')['forEach'](function(_0x46605b){_0x1d1416['Tags'][_0x39cf('0x36')](_0x237850[_0x46605b]);});}delete _0x1d1416[_0x39cf('0x33')];}catch(_0x1bb391){_0x340aea(_0x1bb391);}_0x2b3826(_0x1d1416);});}function getLastMessageText(_0x549755){return new BPromise(function(_0x50ac2c,_0x21d62e){return db[_0x39cf('0x37')][_0x39cf('0x38')]({'where':{'$and':[{'MailInteractionId':_0x549755['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x39cf('0x39')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x39cf('0x3a')],'order':_0x39cf('0x3b'),'raw':!![]})['then'](function(_0x3dcdf2){if(_0x3dcdf2&&_0x3dcdf2['plainBody']){_0x549755[_0x39cf('0x3c')]=_[_0x39cf('0x3d')](_0x3dcdf2[_0x39cf('0x3a')]);}_0x50ac2c(_0x549755);})['catch'](function(_0x489c5b){_0x21d62e(_0x489c5b);});});}function updateMailInteraction(_0x501a33,_0x474cf4,_0xbe26a3,_0x27bb1b){return new BPromise(function(_0x36fb4a,_0x13ca7a){return getInteractionUsers(_0x501a33,_0xbe26a3)['then'](function(_0x2d18a2){return getInteractionTags(_0x2d18a2,_0x474cf4);})[_0x39cf('0x2b')](function(_0x4f680b){if(_0x27bb1b){_0x36fb4a(getLastMessageText(_0x4f680b));}else{_0x36fb4a(_0x4f680b);}})[_0x39cf('0x3e')](function(_0x447801){_0x13ca7a(_0x447801);});});}exports[_0x39cf('0x3f')]=function(_0x192a8d,_0x19f102){var _0x29f8c8={},_0x5ef128={},_0x145edc={'count':0x0,'rows':[]};var _0xfe470b=_[_0x39cf('0x31')](db[_0x39cf('0x40')][_0x39cf('0x41')],function(_0x4583b1){return{'name':_0x4583b1[_0x39cf('0x42')],'type':_0x4583b1[_0x39cf('0x43')]['key']};});_0x5ef128[_0x39cf('0x44')]=_[_0x39cf('0x31')](_0xfe470b,'name');_0x5ef128[_0x39cf('0x45')]=_[_0x39cf('0x46')](_0x192a8d[_0x39cf('0x45')]);_0x5ef128[_0x39cf('0x47')]=_[_0x39cf('0x48')](_0x5ef128[_0x39cf('0x44')],_0x5ef128[_0x39cf('0x45')]);_0x29f8c8[_0x39cf('0x49')]=_[_0x39cf('0x48')](_0x5ef128[_0x39cf('0x44')],qs[_0x39cf('0x4a')](_0x192a8d[_0x39cf('0x45')]['fields']));_0x29f8c8['attributes']=_0x29f8c8[_0x39cf('0x49')][_0x39cf('0x4b')]?_0x29f8c8[_0x39cf('0x49')]:_0x5ef128['model'];if(!_0x192a8d['query'][_0x39cf('0x4c')](_0x39cf('0x4d'))){_0x29f8c8[_0x39cf('0x23')]=qs[_0x39cf('0x23')](_0x192a8d[_0x39cf('0x45')][_0x39cf('0x23')]);_0x29f8c8['offset']=qs[_0x39cf('0x21')](_0x192a8d['query'][_0x39cf('0x21')]);}_0x29f8c8['order']=qs[_0x39cf('0x4e')](_0x192a8d[_0x39cf('0x45')][_0x39cf('0x4e')]);_0x29f8c8[_0x39cf('0x4f')]=qs['filters'](_[_0x39cf('0x50')](_0x192a8d[_0x39cf('0x45')],_0x5ef128[_0x39cf('0x47')]),_0xfe470b);var _0x284919=[];var _0x1d9c5d=squel[_0x39cf('0x51')]()[_0x39cf('0x52')]('id')[_0x39cf('0x52')]('name')[_0x39cf('0x52')](_0x39cf('0x53'))[_0x39cf('0x54')](_0x39cf('0x55'));var _0x397c77=squel[_0x39cf('0x51')]()[_0x39cf('0x52')](_0x39cf('0x56'))['field'](_0x39cf('0x57'))[_0x39cf('0x52')]('ui.MailInteractionId')[_0x39cf('0x54')](_0x39cf('0x58'),'ui')[_0x39cf('0x59')]('users','u','u.id\x20=\x20ui.UserId');var _0xfd1464=squel[_0x39cf('0x51')]()[_0x39cf('0x54')](_0x39cf('0x5a'),'i')[_0x39cf('0x59')]('cm_contacts','c',_0x39cf('0x5b'))[_0x39cf('0x59')]('users','o',_0x39cf('0x5c'))['left_join'](_0x39cf('0x5d'),'a','a.id\x20=\x20i.MailAccountId')[_0x39cf('0x59')](_0x39cf('0x5e'),'me',_0x39cf('0x5f'))[_0x39cf('0x59')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')[_0x39cf('0x59')]('tools_tags','t',_0x39cf('0x60'));var _0x4e301e=squel['expr']();var _0x4530ec=[];var _0x511cdc=squel['expr']();var _0x2d8dd6;if(_0x192a8d[_0x39cf('0x45')]['search']){_0x2d8dd6=as['parseSearch'](_0x192a8d[_0x39cf('0x45')][_0x39cf('0x61')]);var _0x5a4dc0=_0x2d8dd6[_0x39cf('0x62')];for(var _0x29b343=0x0;_0x29b343<_0x2d8dd6[_0x39cf('0x63')][_0x39cf('0x4b')];_0x29b343++){var _0x25d034=_0x2d8dd6[_0x39cf('0x63')][_0x29b343];var _0x4c33eb='i';var _0x2736d1=_[_0x39cf('0x64')](_0xfe470b,[_0x39cf('0x2e'),_0x25d034[_0x39cf('0x52')]]);if(!_0x2736d1){switch(_0x25d034[_0x39cf('0x52')]){case _0x39cf('0x65'):if(_0x25d034[_0x39cf('0x66')]==0x1){_0xfd1464['having']('`'+_0x25d034[_0x39cf('0x52')]+_0x39cf('0x67'));}else{_0xfd1464[_0x39cf('0x68')]('`'+_0x25d034[_0x39cf('0x52')]+_0x39cf('0x69'));}break;case'Contact':if(_0x25d034['operator']==='$substring'){if(_0x25d034[_0x39cf('0x66')][_0x39cf('0x35')]('\x20')['length']>0x1){_0x4e301e[_0x5a4dc0](_0x39cf('0x6a'),qs[_0x39cf('0x6b')](_0x25d034[_0x39cf('0x66')]),null);}else{var _0x4459f5='%'+_0x25d034[_0x39cf('0x66')]+'%';_0x4e301e[_0x5a4dc0](_0x39cf('0x6c'),_0x4459f5,_0x4459f5,_0x4459f5);}}else{_0x2736d1=_[_0x39cf('0x64')](_0xfe470b,[_0x39cf('0x2e'),_0x39cf('0x6d')]);_0x25d034[_0x39cf('0x52')]=_0x39cf('0x6d');_0x13d2e5=as[_0x39cf('0x6e')](_0x4c33eb,_0x2736d1[_0x39cf('0x43')],_0x25d034);_0x4e301e[_0x5a4dc0](_0x13d2e5['text'],_0x13d2e5[_0x39cf('0x66')]['start'],_0x13d2e5[_0x39cf('0x66')]['end']);}break;case _0x39cf('0x6f'):var _0x21e721=_0x25d034[_0x39cf('0x66')]['split'](',')['map'](function(_0x3518db){return Number(_0x3518db);});_0x21e721[_0x39cf('0x70')](function(_0x3b8956){_0x511cdc['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3b8956+',%');});_0x4530ec=_[_0x39cf('0x71')](_0x4530ec,_0x21e721);break;case _0x39cf('0x72'):if(_0x25d034[_0x39cf('0x73')]==='$substring'){_0x4e301e[_0x5a4dc0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x25d034['value']+'%',null);}else{_0x2736d1=_['find'](_0xfe470b,[_0x39cf('0x2e'),_0x39cf('0x74')]);_0x25d034['field']=_0x39cf('0x74');_0x13d2e5=as[_0x39cf('0x6e')](_0x4c33eb,_0x2736d1[_0x39cf('0x43')],_0x25d034);_0x4e301e[_0x5a4dc0](_0x13d2e5[_0x39cf('0x75')],_0x13d2e5[_0x39cf('0x66')][_0x39cf('0x76')],_0x13d2e5['value']['end']);}break;case _0x39cf('0x3a'):_0x13d2e5=as['buildExpression']('me',null,_0x25d034);_0x4e301e[_0x5a4dc0](_0x13d2e5[_0x39cf('0x75')],_0x13d2e5[_0x39cf('0x66')][_0x39cf('0x76')],_0x13d2e5[_0x39cf('0x66')][_0x39cf('0x77')]);break;}}else{var _0x13d2e5=as[_0x39cf('0x6e')](_0x4c33eb,_0x2736d1[_0x39cf('0x43')],_0x25d034);_0x4e301e[_0x5a4dc0](_0x13d2e5['text'],_0x13d2e5['value']['start'],_0x13d2e5['value'][_0x39cf('0x77')]);}}}else{var _0x3da3ea=_(_0x192a8d[_0x39cf('0x45')])['keys']()['map'](function(_0x2fbbd1){return _[_0x39cf('0x78')](_0xfe470b,[_0x39cf('0x2e'),_0x2fbbd1])?_0x2fbbd1:undefined;})[_0x39cf('0x79')]()['value']();if(!_[_0x39cf('0x7a')](_0x3da3ea)){_0x3da3ea[_0x39cf('0x70')](function(_0xbb0106){if(_0xbb0106===_0x39cf('0x7b')){_0xfd1464[_0x39cf('0x4f')]('i.MailAccountId\x20IN\x20?',[][_0x39cf('0x7c')](_0x192a8d['query'][_0xbb0106]));}else if(_0xbb0106===_0x39cf('0x7d')){var _0x54df31=JSON['parse'](_0x192a8d[_0x39cf('0x45')][_0xbb0106])[_0x39cf('0x7e')];var _0x3f64d4=JSON['parse'](_0x192a8d[_0x39cf('0x45')][_0xbb0106])[_0x39cf('0x7f')];_0xfd1464['where'](_0x39cf('0x80'),_0x54df31,_0x3f64d4);}else{if(_0x192a8d[_0x39cf('0x45')][_0xbb0106]==='null'){_0xfd1464[_0x39cf('0x4f')]('i.'+_0xbb0106+_0x39cf('0x81'));}else{_0xfd1464[_0x39cf('0x4f')]('i.'+_0xbb0106+_0x39cf('0x82'),_0x192a8d['query'][_0xbb0106]);}}});}if(_0x192a8d[_0x39cf('0x45')]['read']){if(_0x192a8d[_0x39cf('0x45')][_0x39cf('0x83')]==0x1){_0xfd1464['having'](_0x39cf('0x84'));}else{_0xfd1464[_0x39cf('0x68')](_0x39cf('0x85'));}}if(_0x192a8d[_0x39cf('0x45')][_0x39cf('0x86')]){_0x4530ec=_[_0x39cf('0x87')](_0x192a8d[_0x39cf('0x45')]['tag'])?_0x192a8d[_0x39cf('0x45')][_0x39cf('0x86')]:new Array(_0x192a8d[_0x39cf('0x45')][_0x39cf('0x86')]);_0x4530ec[_0x39cf('0x70')](function(_0x1de70a){_0x511cdc['or'](_0x39cf('0x88'),'%,'+_0x1de70a+',%');});}if(_0x192a8d[_0x39cf('0x45')][_0x39cf('0x89')]){var _0x3d2207=_0x192a8d[_0x39cf('0x45')]['filter'][_0x39cf('0x8a')]('\x5c','\x5c\x5c')[_0x39cf('0x8a')](/'/g,'\x27\x27');if(qs[_0x39cf('0x8b')](_0x3d2207)){_0x4e301e['or'](_0x39cf('0x8c'),_0x3d2207+'%');}else if(qs[_0x39cf('0x8d')](_0x3d2207)){_0x4e301e['or']('c.email\x20LIKE\x20?',_0x3d2207+'%');}else{_0x4e301e['or'](_0x39cf('0x8e'),qs[_0x39cf('0x6b')](_0x3d2207))['or'](_0x39cf('0x8f'),qs[_0x39cf('0x6b')](_0x3d2207));}}}_0xfd1464['where'](_0x4e301e);_0xfd1464[_0x39cf('0x90')](_0x39cf('0x91'));var _0x46282c={'type':db[_0x39cf('0x92')][_0x39cf('0x93')][_0x39cf('0x94')],'raw':!![]};var _0x13eab5=_0xfd1464[_0x39cf('0x95')]();_0x13eab5[_0x39cf('0x52')](_0x39cf('0x91'));_0x13eab5[_0x39cf('0x52')](_0x39cf('0x96'),'unreadMessages');if(_0x29f8c8[_0x39cf('0x97')]){_0x29f8c8[_0x39cf('0x97')][_0x39cf('0x70')](function(_0x4586d0){var _0x35d35e=_0x4586d0[0x0]===_0x39cf('0x98')?_0x4586d0[0x0]:'i.'+_0x4586d0[0x0];_0xfd1464[_0x39cf('0x97')](_0x35d35e,_0x4586d0[0x1]===_0x39cf('0x99')?![]:!![]);});}if(!_[_0x39cf('0x7a')](_0x4530ec)){_0xfd1464[_0x39cf('0x68')](_0x511cdc);_0x13eab5[_0x39cf('0x4f')](_0x39cf('0x9a'),_0x4530ec);}BPromise[_0x39cf('0x9b')]()['then'](function(){if(!_0x2d8dd6){if(_0x192a8d['query']['MailAccountId'])return;_0x13eab5[_0x39cf('0x4f')](_0x39cf('0x9c'));_0xfd1464[_0x39cf('0x4f')](_0x39cf('0x9c'));return;}if(_0x192a8d['user'][_0x39cf('0x9d')]!==_0x39cf('0x9e'))return;return _0x192a8d[_0x39cf('0x9f')][_0x39cf('0xa0')]({'attributes':['id'],'raw':!![]})[_0x39cf('0x2b')](function(_0x44f0e9){if(_[_0x39cf('0x7a')](_0x44f0e9)){_0x13eab5['where'](_0x39cf('0xa1'));_0xfd1464['where'](_0x39cf('0xa1'));}else{_0x13eab5[_0x39cf('0x4f')]('i.MailAccountId\x20IN\x20?',_[_0x39cf('0x31')](_0x44f0e9,'id'));_0xfd1464[_0x39cf('0x4f')](_0x39cf('0xa2'),_[_0x39cf('0x31')](_0x44f0e9,'id'));}});})[_0x39cf('0x2b')](function(){if(_0x192a8d[_0x39cf('0x9f')][_0x39cf('0x9d')]==='agent'&&!_0x2d8dd6&&!_0x192a8d[_0x39cf('0x45')][_0x39cf('0x7b')])return[];return db[_0x39cf('0xa3')][_0x39cf('0x45')](_0x13eab5[_0x39cf('0xa4')](),_0x46282c);})[_0x39cf('0x2b')](function(_0x14e907){_0x145edc[_0x39cf('0x24')]=_0x14e907[_0x39cf('0x4b')];if(_0x145edc['count']===0x0)return[];return db['sequelize']['query'](_0x1d9c5d[_0x39cf('0xa4')](),_0x46282c)[_0x39cf('0x2b')](function(_0x2b96c6){_0x284919=_[_0x39cf('0xa5')](_0x2b96c6,'id');_0x46282c=_[_0x39cf('0xa6')](_0x46282c,{'model':db[_0x39cf('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x192a8d['query']['fields']){_0x29f8c8[_0x39cf('0x49')][_0x39cf('0x70')](function(_0x29503b){_0xfd1464[_0x39cf('0x52')]('i.'+_0x29503b);});}else{_0xfd1464[_0x39cf('0x52')](_0x39cf('0x96'),_0x39cf('0x65'));_0xfd1464['field'](_0x39cf('0xa7'),_0x39cf('0xa8'));_0xfd1464['field']('a.mandatoryDisposition',_0x39cf('0xa9'));_0xfd1464[_0x39cf('0x52')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x39cf('0x98'));_0xfd1464[_0x39cf('0x52')](_0x39cf('0x91'));_0xfd1464['field'](_0x39cf('0xaa'));_0xfd1464[_0x39cf('0x52')](_0x39cf('0xab'));_0xfd1464[_0x39cf('0x52')](_0x39cf('0xac'));_0xfd1464[_0x39cf('0x52')]('i.closedAt');_0xfd1464[_0x39cf('0x52')]('i.attach');_0xfd1464[_0x39cf('0x52')](_0x39cf('0xad'));_0xfd1464[_0x39cf('0x52')](_0x39cf('0xae'));_0xfd1464['field'](_0x39cf('0xaf'));_0xfd1464[_0x39cf('0x52')](_0x39cf('0xb0'));_0xfd1464[_0x39cf('0x52')](_0x39cf('0xb1'));_0xfd1464[_0x39cf('0x52')]('i.thirdDisposition');_0xfd1464['field'](_0x39cf('0xb2'));_0xfd1464[_0x39cf('0x52')](_0x39cf('0xb3'));_0xfd1464[_0x39cf('0x52')]('i.ContactId');_0xfd1464['field'](_0x39cf('0xb4'));_0xfd1464[_0x39cf('0x52')](_0x39cf('0xb5'));_0xfd1464[_0x39cf('0x52')]('c.firstName','Contact.firstName');_0xfd1464[_0x39cf('0x52')](_0x39cf('0xb6'),_0x39cf('0xb7'));_0xfd1464[_0x39cf('0x52')](_0x39cf('0xb8'),_0x39cf('0xb9'));_0xfd1464['field'](_0x39cf('0xba'),_0x39cf('0xbb'));_0xfd1464['field'](_0x39cf('0xbc'),'Contact.mobile');_0xfd1464[_0x39cf('0x52')]('c.fax',_0x39cf('0xbd'));_0xfd1464[_0x39cf('0x52')]('o.fullname',_0x39cf('0xbe'));_0xfd1464[_0x39cf('0x52')](_0x39cf('0xbf'),_0x39cf('0xc0'));_0xfd1464['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x39cf('0x33'));}if(_0x29f8c8['limit'])_0xfd1464[_0x39cf('0x23')](_0x29f8c8['limit']);if(_0x29f8c8[_0x39cf('0x21')])_0xfd1464[_0x39cf('0x21')](_0x29f8c8[_0x39cf('0x21')]);return db[_0x39cf('0xa3')]['query'](_0xfd1464[_0x39cf('0xa4')](),_0x46282c);})[_0x39cf('0x2b')](function(_0x2a4d6b){if(_0x2a4d6b[_0x39cf('0x4b')]>0x0)_0x397c77[_0x39cf('0x4f')](_0x39cf('0xc1'),_[_0x39cf('0x31')](_0x2a4d6b,'id'));return db[_0x39cf('0xa3')][_0x39cf('0x45')](_0x397c77['toString'](),_0x46282c)[_0x39cf('0x2b')](function(_0xba3f6e){var _0x54a2b8=_[_0x39cf('0xc2')](_0xba3f6e,_0x39cf('0xc3'));var _0x308788=[];return db[_0x39cf('0xc4')][_0x39cf('0x38')]({'attributes':[_0x39cf('0xc5')],'raw':!![]})['then'](function(_0x2e81c5){var _0x436a76=_0x2e81c5[_0x39cf('0xc5')];_0x2a4d6b[_0x39cf('0x70')](function(_0x3966db){_0x308788[_0x39cf('0x36')](updateMailInteraction(_0x3966db,_0x284919,_0x54a2b8,_0x436a76));});return BPromise[_0x39cf('0xc6')](_0x308788);});});});})[_0x39cf('0x2b')](function(_0x182b41){_0x145edc[_0x39cf('0xc7')]=_0x182b41;return _0x145edc;})['then'](respondWithFilteredResult(_0x19f102,_0x29f8c8))[_0x39cf('0x3e')](handleError(_0x19f102,null));};exports[_0x39cf('0xc8')]=function(_0x5c5d8f,_0x36252f){var _0x183224={'raw':![],'where':{'id':_0x5c5d8f['params']['id']}},_0x3c9d9b={};_0x3c9d9b[_0x39cf('0x44')]=_[_0x39cf('0x46')](db[_0x39cf('0x40')][_0x39cf('0x41')]);_0x3c9d9b['query']=_[_0x39cf('0x46')](_0x5c5d8f['query']);_0x3c9d9b[_0x39cf('0x47')]=_[_0x39cf('0x48')](_0x3c9d9b[_0x39cf('0x44')],_0x3c9d9b[_0x39cf('0x45')]);_0x183224[_0x39cf('0x49')]=_[_0x39cf('0x48')](_0x3c9d9b[_0x39cf('0x44')],qs[_0x39cf('0x4a')](_0x5c5d8f[_0x39cf('0x45')]['fields']));_0x183224[_0x39cf('0x49')]=_0x183224[_0x39cf('0x49')][_0x39cf('0x4b')]?_0x183224[_0x39cf('0x49')]:_0x3c9d9b['model'];if(_0x5c5d8f[_0x39cf('0x45')]['includeAll']){_0x183224[_0x39cf('0xc9')]=[{'all':!![]}];}_0x183224=_[_0x39cf('0xa6')]({},_0x183224,_0x5c5d8f[_0x39cf('0xca')]);return db[_0x39cf('0x40')][_0x39cf('0x64')](_0x183224)[_0x39cf('0x2b')](handleEntityNotFound(_0x36252f,null))[_0x39cf('0x2b')](respondWithResult(_0x36252f,null))[_0x39cf('0x3e')](handleError(_0x36252f,null));};exports[_0x39cf('0xcb')]=function(_0x4acb87,_0x100a52){return db[_0x39cf('0x40')][_0x39cf('0xcb')](_0x4acb87[_0x39cf('0xcc')],{})[_0x39cf('0x2b')](respondWithResult(_0x100a52,0xc9))[_0x39cf('0x3e')](handleError(_0x100a52,null));};exports['update']=function(_0x445e7d,_0x4f6064){if(_0x445e7d['body']['id']){delete _0x445e7d['body']['id'];}return db['MailInteraction'][_0x39cf('0x64')]({'where':{'id':_0x445e7d[_0x39cf('0xcd')]['id']}})[_0x39cf('0x2b')](handleEntityNotFound(_0x4f6064,null))['then'](saveUpdates(_0x445e7d[_0x39cf('0xcc')],null))[_0x39cf('0x2b')](respondWithResult(_0x4f6064,null))[_0x39cf('0x3e')](handleError(_0x4f6064,null));};exports[_0x39cf('0x2c')]=function(_0x4ccb75,_0x48c18b){return db['MailInteraction']['find']({'where':{'id':_0x4ccb75[_0x39cf('0xcd')]['id']}})[_0x39cf('0x2b')](handleEntityNotFound(_0x48c18b,null))[_0x39cf('0x2b')](removeEntity(_0x48c18b,null))['catch'](handleError(_0x48c18b,null));};exports[_0x39cf('0xce')]=function(_0xc17ada,_0x56ce6d){return db['MailInteraction']['describe']()[_0x39cf('0x2b')](respondWithResult(_0x56ce6d,null))[_0x39cf('0x3e')](handleError(_0x56ce6d,null));};exports[_0x39cf('0xcf')]=function(_0x2ea902,_0x2f33c6,_0x20fa2f){return db[_0x39cf('0x37')][_0x39cf('0x64')]({'where':{'id':_0x2ea902[_0x39cf('0xcd')]['id']}})[_0x39cf('0x2b')](handleEntityNotFound(_0x2f33c6,null))[_0x39cf('0x2b')](function(_0x2f2da9){if(_0x2f2da9){return _0x2f2da9['addMessage'](_0x2ea902[_0x39cf('0xcc')][_0x39cf('0xd0')],_['omit'](_0x2ea902[_0x39cf('0xcc')],[_0x39cf('0xd0'),'id'])||{});}})[_0x39cf('0x2b')](respondWithResult(_0x2f33c6,null))['catch'](handleError(_0x2f33c6,null));};exports[_0x39cf('0xd1')]=function(_0x4a2124,_0x1e9fb9,_0x37052e){var _0x569106={'raw':![],'where':{}};var _0x520253={};var _0x40a86e={'count':0x0,'rows':[]};return db[_0x39cf('0x40')][_0x39cf('0x38')]({'where':{'id':_0x4a2124[_0x39cf('0xcd')]['id']}})[_0x39cf('0x2b')](handleEntityNotFound(_0x1e9fb9,null))[_0x39cf('0x2b')](function(_0x36a116){if(_0x36a116){_0x520253[_0x39cf('0x44')]=_[_0x39cf('0x46')](db['MailMessage'][_0x39cf('0x41')]);_0x520253[_0x39cf('0x45')]=_['keys'](_0x4a2124[_0x39cf('0x45')]);_0x520253[_0x39cf('0x47')]=_[_0x39cf('0x48')](_0x520253[_0x39cf('0x44')],_0x520253[_0x39cf('0x45')]);_0x569106[_0x39cf('0x49')]=_[_0x39cf('0x48')](_0x520253['model'],qs[_0x39cf('0x4a')](_0x4a2124['query'][_0x39cf('0x4a')]));_0x569106[_0x39cf('0x49')]=_0x569106[_0x39cf('0x49')][_0x39cf('0x4b')]?_0x569106['attributes']:_0x520253[_0x39cf('0x44')];if(!_0x4a2124[_0x39cf('0x45')][_0x39cf('0x4c')](_0x39cf('0x4d'))){_0x569106[_0x39cf('0x23')]=qs[_0x39cf('0x23')](_0x4a2124[_0x39cf('0x45')][_0x39cf('0x23')]);_0x569106[_0x39cf('0x21')]=qs[_0x39cf('0x21')](_0x4a2124[_0x39cf('0x45')][_0x39cf('0x21')]);}_0x569106['order']=qs['sort'](_0x4a2124[_0x39cf('0x45')][_0x39cf('0x4e')]);_0x569106[_0x39cf('0x4f')]=qs[_0x39cf('0x47')](_[_0x39cf('0x50')](_0x4a2124[_0x39cf('0x45')],_0x520253[_0x39cf('0x47')]));_0x569106['where'][_0x39cf('0xc3')]=_0x36a116['id'];if(_0x4a2124[_0x39cf('0x45')][_0x39cf('0x89')]){_0x569106[_0x39cf('0x4f')]=_['merge'](_0x569106[_0x39cf('0x4f')],{'$or':_['map'](_0x569106[_0x39cf('0x49')],function(_0x3a6916){var _0x50d226={};_0x50d226[_0x3a6916]={'$like':'%'+_0x4a2124[_0x39cf('0x45')][_0x39cf('0x89')]+'%'};return _0x50d226;})});}if(_0x4a2124[_0x39cf('0x45')][_0x39cf('0x7e')]){var _0x447260=_0x4a2124[_0x39cf('0x45')][_0x39cf('0x7e')]['split'](',');var _0x1f9bdb={};_0x1f9bdb[_0x447260[0x0]]={'$gte':moment(_0x447260[0x1])[_0x39cf('0xd2')](_0x39cf('0xd3'))};_0x569106[_0x39cf('0x4f')]=_[_0x39cf('0xa6')](_0x569106[_0x39cf('0x4f')],_0x1f9bdb);}_0x569106=_[_0x39cf('0xa6')]({},_0x569106,_0x4a2124['options']);return db['MailMessage'][_0x39cf('0x24')]({'where':_0x569106[_0x39cf('0x4f')]})[_0x39cf('0x2b')](function(_0x3fd8f0){_0x40a86e[_0x39cf('0x24')]=_0x3fd8f0;if(_0x4a2124[_0x39cf('0x45')]['includeAll']){_0x569106[_0x39cf('0xc9')]=[{'all':!![]}];}return db[_0x39cf('0x37')]['findAll'](_0x569106);})[_0x39cf('0x2b')](function(_0x57349d){if(_0x4a2124['query'][_0x39cf('0xd4')]===_0x39cf('0xd5')){for(var _0x18104f=0x0;_0x18104f<_0x57349d[_0x39cf('0x4b')];_0x18104f++){_0x57349d[_0x18104f][_0x39cf('0xcc')]=juice(_0x57349d[_0x18104f][_0x39cf('0xcc')]);}}_0x40a86e[_0x39cf('0xc7')]=_0x57349d;return _0x40a86e;});}})[_0x39cf('0x2b')](respondWithFilteredResult(_0x1e9fb9,_0x569106))['catch'](handleError(_0x1e9fb9,null));};exports[_0x39cf('0xd6')]=function(_0x32a4a5,_0x38a3a4,_0x32d0ba){return db['MailInteraction'][_0x39cf('0x64')]({'where':{'id':_0x32a4a5[_0x39cf('0xcd')]['id']}})[_0x39cf('0x2b')](handleEntityNotFound(_0x38a3a4,null))[_0x39cf('0x2b')](function(_0x1bae23){if(_0x1bae23){return _0x1bae23[_0x39cf('0xd7')](_0x32a4a5[_0x39cf('0xcc')]['ids'],_[_0x39cf('0xd8')](_0x32a4a5[_0x39cf('0xcc')],[_0x39cf('0xd0'),'id'])||{})[_0x39cf('0xd9')](function(){return db[_0x39cf('0x6f')][_0x39cf('0xda')]({'attributes':['id',_0x39cf('0x2e'),'color'],'where':{'id':_0x32a4a5['body'][_0x39cf('0xd0')]}});})[_0x39cf('0x2b')](function(_0x849cb9){socket[_0x39cf('0xdb')](_0x39cf('0xdc'),{'id':Number(_0x32a4a5['params']['id']),'tags':_0x849cb9||[]});return{'id':Number(_0x32a4a5[_0x39cf('0xcd')]['id']),'tags':_0x849cb9||[]};});}})[_0x39cf('0x2b')](respondWithResult(_0x38a3a4,null))[_0x39cf('0x3e')](handleError(_0x38a3a4,null));};exports[_0x39cf('0xdd')]=function(_0x11a77a,_0x12752c,_0x24e23f){return db[_0x39cf('0x40')]['find']({'where':{'id':_0x11a77a[_0x39cf('0xcd')]['id']}})[_0x39cf('0x2b')](handleEntityNotFound(_0x12752c,null))[_0x39cf('0x2b')](function(_0x44fff3){if(_0x44fff3){return _0x44fff3[_0x39cf('0xdd')](_0x11a77a['query'][_0x39cf('0xd0')]);}})['then'](respondWithStatusCode(_0x12752c,null))[_0x39cf('0x3e')](handleError(_0x12752c,null));};exports[_0x39cf('0xde')]=function(_0x4a5412,_0x1204dd){var _0x5f4139=moment()[_0x39cf('0xdf')]()[_0x39cf('0xa4')]();var _0x2ce5d3=path[_0x39cf('0xe0')](config['root'],_0x39cf('0xe1'),_0x39cf('0xe2'),'tmp');var _0x541ee4=path[_0x39cf('0xe0')](config['root'],'server',_0x39cf('0xe2'),_0x39cf('0xe3'));var _0x2d68ee=path[_0x39cf('0xe0')](_0x2ce5d3,_0x5f4139);var _0x3f9782=util[_0x39cf('0xd2')](_0x39cf('0xe4'),_0x4a5412[_0x39cf('0xcd')]['id'],_0x5f4139);var _0xca6e05=path[_0x39cf('0xe0')](_0x2ce5d3,_0x3f9782);var _0x3c7490=[];if(_0x4a5412[_0x39cf('0x45')][_0x39cf('0xe3')]){_0x3c7490[_0x39cf('0x36')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x4e75be=[{'model':db[_0x39cf('0x37')],'as':_0x39cf('0xe5'),'attributes':['id',_0x39cf('0xcc'),'from','to','cc',_0x39cf('0xe6'),_0x39cf('0xe7'),'createdAt'],'where':{'secret':![]},'order':qs[_0x39cf('0x4e')]('id'),'include':_0x3c7490}];return db[_0x39cf('0x40')]['find']({'where':{'id':_0x4a5412['params']['id']},'include':_0x4e75be})[_0x39cf('0x2b')](handleEntityNotFound(_0x1204dd,null))[_0x39cf('0x2b')](function(_0x3f8b3f){if(_0x3f8b3f&&_0x3f8b3f[_0x39cf('0xe5')]){var _0xdf723f=_0x3f8b3f[_0x39cf('0xe8')]({'plain':!![]});fs[_0x39cf('0xe9')](_0x2d68ee);return BPromise[_0x39cf('0xea')](_0xdf723f[_0x39cf('0xe5')],function(_0x5c0246,_0x5ccb98){var _0x316bbe={'from':_0x5c0246[_0x39cf('0x54')],'to':_0x5c0246['to'],'subject':_0x5c0246[_0x39cf('0xe7')],'html':_0x5c0246[_0x39cf('0xcc')],'headers':{'Date':moment(_0x5c0246[_0x39cf('0x7d')])[_0x39cf('0xd2')](_0x39cf('0xeb'))},'attachments':[]};if(_0x5c0246['cc']){_0x316bbe[_0x39cf('0xec')]['Cc']=_0x5c0246['cc'];}if(_0x5c0246[_0x39cf('0xe6')]){_0x316bbe[_0x39cf('0xec')]['Bcc']=_0x5c0246['bcc'];}return new BPromise(function(_0x50837d,_0x3a50ec){if(_0x5c0246[_0x39cf('0xed')]){for(var _0x138ae6=0x0;_0x138ae6<_0x5c0246['Attachments'][_0x39cf('0x4b')];_0x138ae6++){var _0x512c0a=_0x5c0246[_0x39cf('0xed')][_0x138ae6];var _0x51c2cc=path[_0x39cf('0xe0')](_0x541ee4,_0x512c0a[_0x39cf('0xee')]);if(fs[_0x39cf('0xef')](_0x51c2cc)){_0x316bbe[_0x39cf('0xe3')][_0x39cf('0x36')]({'name':_0x512c0a[_0x39cf('0x2e')],'contentType':_0x512c0a['type'],'data':fs[_0x39cf('0xf0')](_0x51c2cc)});}}}emlformat[_0x39cf('0xf1')](_0x316bbe,function(_0x210f57,_0x1b9bb1){if(_0x210f57)return _0x3a50ec(_0x210f57);fs[_0x39cf('0xf2')](path[_0x39cf('0xe0')](_0x2d68ee,util[_0x39cf('0xd2')](_0x39cf('0xf3'),_0x5ccb98)),_0x1b9bb1);return _0x50837d(_0x1b9bb1);});});})[_0x39cf('0x2b')](function(){return new BPromise(function(_0xb5c402,_0x51df75){zipdir(_0x2d68ee,{'saveTo':_0xca6e05},function(_0x4f78e6,_0x1eadc7){if(_0x4f78e6)return _0x51df75(_0x4f78e6);return _0xb5c402(_0x1eadc7);});})[_0x39cf('0x2b')](function(){return new BPromise(function(_0x32bdaa,_0x191c4b){rimraf(_0x2d68ee,function(_0xecda71){if(_0xecda71)_0x191c4b(_0xecda71);return _0x32bdaa();});});})['then'](function(){return _0x1204dd['download'](_0xca6e05,_0x3f9782,function(_0x4ab39a){if(_0x4ab39a){console['log'](_0x39cf('0xf4'),_0x4ab39a);}else{fs[_0x39cf('0xf5')](_0xca6e05);}});});});}else{return _0x1204dd[_0x39cf('0x1f')](0xc8);}})[_0x39cf('0x3e')](handleError(_0x1204dd,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 69aa686..90a7edb 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 _0x2cc8=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','findAll','then','setDataValue','unreadMessages','emit','catch','hasOwnProperty'];(function(_0xc92ab5,_0x569d01){var _0x45c2ac=function(_0x2c6c66){while(--_0x2c6c66){_0xc92ab5['push'](_0xc92ab5['shift']());}};_0x45c2ac(++_0x569d01);}(_0x2cc8,0xf2));var _0x82cc=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x2cc8[_0x3ab9ee];return _0x82ee88;};'use strict';var EventEmitter=require(_0x82cc('0x0'));var MailInteraction=require(_0x82cc('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x82cc('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x82cc('0x3')](0x0);var events={'afterCreate':_0x82cc('0x4'),'afterUpdate':_0x82cc('0x5'),'afterDestroy':_0x82cc('0x6')};function emitEvent(_0xc2fc19){return function(_0xe91a7a,_0x274341,_0x12ec59){_0xe91a7a['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x49d951){_0xe91a7a['setDataValue']('Users',_0x49d951['map'](function(_0x7f0db6){return{'id':_0x7f0db6['id']};}));return MailMessage[_0x82cc('0x7')]({'where':{'MailInteractionId':_0xe91a7a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x82cc('0x8')](function(_0x147c76){_0xe91a7a[_0x82cc('0x9')](_0x82cc('0xa'),_0x147c76['length']);MailInteractionEvents[_0x82cc('0xb')](_0xc2fc19+':'+_0xe91a7a['id'],_0xe91a7a);MailInteractionEvents[_0x82cc('0xb')](_0xc2fc19,_0xe91a7a);_0x12ec59(null);})[_0x82cc('0xc')](_0x12ec59(null));};}for(var e in events){if(events[_0x82cc('0xd')](e)){var event=events[e];MailInteraction[_0x82cc('0xe')](e,emitEvent(event));}}module[_0x82cc('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0xede8=['MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction'];(function(_0x3f4989,_0x1f7e78){var _0x22b57c=function(_0x57a885){while(--_0x57a885){_0x3f4989['push'](_0x3f4989['shift']());}};_0x22b57c(++_0x1f7e78);}(_0xede8,0x1e3));var _0x8ede=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xede8[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x8ede('0x0'));var MailInteraction=require(_0x8ede('0x1'))['db'][_0x8ede('0x2')];var MailMessage=require(_0x8ede('0x1'))['db'][_0x8ede('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x8ede('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8ede('0x5'),'afterDestroy':_0x8ede('0x6')};function emitEvent(_0x3d9950){return function(_0x32fedb,_0x3098a1,_0x2edcff){_0x32fedb[_0x8ede('0x7')]({'attributes':['id'],'raw':!![]})[_0x8ede('0x8')](function(_0x26b647){_0x32fedb[_0x8ede('0x9')](_0x8ede('0xa'),_0x26b647[_0x8ede('0xb')](function(_0x272204){return{'id':_0x272204['id']};}));return MailMessage[_0x8ede('0xc')]({'where':{'MailInteractionId':_0x32fedb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8ede('0x8')](function(_0x484d02){_0x32fedb[_0x8ede('0x9')](_0x8ede('0xd'),_0x484d02['length']);MailInteractionEvents[_0x8ede('0xe')](_0x3d9950+':'+_0x32fedb['id'],_0x32fedb);MailInteractionEvents[_0x8ede('0xe')](_0x3d9950,_0x32fedb);_0x2edcff(null);})[_0x8ede('0xf')](_0x2edcff(null));};}for(var e in events){if(events[_0x8ede('0x10')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x8ede('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index cd98bb7..b5ad309 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 _0xdeee=['bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','closed','format','YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt','get','MailMessage','update','catch','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x228421,_0x37d646){var _0x471b4f=function(_0x2ad7a4){while(--_0x2ad7a4){_0x228421['push'](_0x228421['shift']());}};_0x471b4f(++_0x37d646);}(_0xdeee,0x10a));var _0xedee=function(_0x30bfc4,_0x45137e){_0x30bfc4=_0x30bfc4-0x0;var _0x46e5cf=_0xdeee[_0x30bfc4];return _0x46e5cf;};'use strict';var _=require('lodash');var util=require(_0xedee('0x0'));var logger=require(_0xedee('0x1'))(_0xedee('0x2'));var moment=require(_0xedee('0x3'));var BPromise=require(_0xedee('0x4'));var rp=require(_0xedee('0x5'));var fs=require('fs');var path=require(_0xedee('0x6'));var rimraf=require(_0xedee('0x7'));var config=require(_0xedee('0x8'));var attributes=require(_0xedee('0x9'));module[_0xedee('0xa')]=function(_0x16ee4b,_0x86834a){return _0x16ee4b[_0xedee('0xb')](_0xedee('0xc'),attributes,{'tableName':_0xedee('0xd'),'paranoid':![],'indexes':[{'name':_0xedee('0xe'),'fields':['subject','to'],'type':_0xedee('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xbf8d4b,_0x56680c,_0x2d9a9c){if(_0xbf8d4b[_0xedee('0x10')]){_0xbf8d4b['substatusAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0xbf8d4b[_0xedee('0x11')]){_0xbf8d4b['closedAt']=moment()[_0xedee('0x12')](_0xedee('0x13'));}_0x2d9a9c(null,_0x56680c);},'beforeUpdate':function(_0x2b7684,_0x4d434f,_0x2df4b8){if(_0x2b7684[_0xedee('0x14')](_0xedee('0x10'))){_0x2b7684[_0xedee('0x15')]=_0x2b7684[_0xedee('0x10')]?moment()['format'](_0xedee('0x13')):null;}if(_0x2b7684[_0xedee('0x14')](_0xedee('0x11'))){_0x2b7684['closedAt']=moment()[_0xedee('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b7684[_0xedee('0x10')]=null;_0x2b7684[_0xedee('0x15')]=null;}_0x2df4b8(null,_0x2b7684);},'afterUpdate':function(_0x4a81e3,_0x14a507,_0x25341d){var _0x42f59f=_0x16ee4b['models'];var _0x43e66b=_0x4a81e3[_0xedee('0x16')]({'plain':!![]});if(_0x43e66b['closed']){return _0x42f59f[_0xedee('0x17')][_0xedee('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x43e66b['id']}})['then'](function(){_0x25341d();})[_0xedee('0x19')](function(_0xef0bab){_0x25341d(_0xef0bab);});}else{_0x25341d();}}},'charset':'utf8mb4','collate':_0xedee('0x1a')});}; \ No newline at end of file +var _0xf0e8=['util','api','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','get','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1e1c28,_0x475577){var _0x1391d2=function(_0x226e7e){while(--_0x226e7e){_0x1e1c28['push'](_0x1e1c28['shift']());}};_0x1391d2(++_0x475577);}(_0xf0e8,0x81));var _0x8f0e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf0e8[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x8f0e('0x0'));var util=require(_0x8f0e('0x1'));var logger=require('../../config/logger')(_0x8f0e('0x2'));var moment=require('moment');var BPromise=require(_0x8f0e('0x3'));var rp=require(_0x8f0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f0e('0x5'));var config=require(_0x8f0e('0x6'));var attributes=require(_0x8f0e('0x7'));module[_0x8f0e('0x8')]=function(_0x42e77a,_0x492be0){return _0x42e77a['define'](_0x8f0e('0x9'),attributes,{'tableName':_0x8f0e('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x8f0e('0xb'),'to'],'type':_0x8f0e('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4139fe,_0x4986cd,_0x51db18){if(_0x4139fe[_0x8f0e('0xd')]){_0x4139fe[_0x8f0e('0xe')]=moment()['format'](_0x8f0e('0xf'));}if(_0x4139fe[_0x8f0e('0x10')]){_0x4139fe[_0x8f0e('0x11')]=moment()[_0x8f0e('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x51db18(null,_0x4986cd);},'beforeUpdate':function(_0x3db92b,_0x3ee208,_0x1ff7ad){if(_0x3db92b['changed'](_0x8f0e('0xd'))){_0x3db92b['substatusAt']=_0x3db92b[_0x8f0e('0xd')]?moment()[_0x8f0e('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x3db92b[_0x8f0e('0x13')](_0x8f0e('0x10'))){_0x3db92b[_0x8f0e('0x11')]=moment()[_0x8f0e('0x12')](_0x8f0e('0xf'));_0x3db92b[_0x8f0e('0xd')]=null;_0x3db92b['substatusAt']=null;}_0x1ff7ad(null,_0x3db92b);},'afterUpdate':function(_0x10d3e5,_0x119186,_0x5dad26){var _0x3c4073=_0x42e77a[_0x8f0e('0x14')];var _0x469f67=_0x10d3e5[_0x8f0e('0x15')]({'plain':!![]});if(_0x469f67['closed']){return _0x3c4073['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x469f67['id']}})[_0x8f0e('0x16')](function(){_0x5dad26();})[_0x8f0e('0x17')](function(_0x237f15){_0x5dad26(_0x237f15);});}else{_0x5dad26();}}},'charset':_0x8f0e('0x18'),'collate':_0x8f0e('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 0ca0859..a804791 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 _0xc7ea=['jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','catch','find','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3fad5a,_0x2d3b02){var _0x4ca713=function(_0x2abe58){while(--_0x2abe58){_0x3fad5a['push'](_0x3fad5a['shift']());}};_0x4ca713(++_0x2d3b02);}(_0xc7ea,0x171));var _0xac7e=function(_0x51b764,_0x527497){_0x51b764=_0x51b764-0x0;var _0x1d9607=_0xc7ea[_0x51b764];return _0x1d9607;};'use strict';var _=require(_0xac7e('0x0'));var util=require(_0xac7e('0x1'));var moment=require('moment');var BPromise=require(_0xac7e('0x2'));var rs=require(_0xac7e('0x3'));var fs=require('fs');var Redis=require(_0xac7e('0x4'));var db=require(_0xac7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac7e('0x6'))(_0xac7e('0x7'));var config=require(_0xac7e('0x8'));var jayson=require(_0xac7e('0x9'));var client=jayson[_0xac7e('0xa')][_0xac7e('0xb')]({'port':0x232a});config[_0xac7e('0xc')]=_[_0xac7e('0xd')](config[_0xac7e('0xc')],{'host':_0xac7e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac7e('0xc')]));require(_0xac7e('0xf'))[_0xac7e('0x10')](socket);function respondWithRpcPromise(_0x173b59,_0x39d2e3,_0x260889){return new BPromise(function(_0x10873d,_0x240869){return client[_0xac7e('0x11')](_0x173b59,_0x260889)[_0xac7e('0x12')](function(_0x404fc0){logger[_0xac7e('0x13')]('MailInteraction,\x20%s,\x20%s',_0x39d2e3,_0xac7e('0x14'));logger[_0xac7e('0x15')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x39d2e3,_0xac7e('0x14'),JSON[_0xac7e('0x16')](_0x404fc0));if(_0x404fc0[_0xac7e('0x17')]){if(_0x404fc0[_0xac7e('0x17')][_0xac7e('0x18')]===0x1f4){logger['error'](_0xac7e('0x19'),_0x39d2e3,_0x404fc0[_0xac7e('0x17')][_0xac7e('0x1a')]);return _0x240869(_0x404fc0[_0xac7e('0x17')][_0xac7e('0x1a')]);}logger[_0xac7e('0x17')](_0xac7e('0x19'),_0x39d2e3,_0x404fc0[_0xac7e('0x17')]['message']);return _0x10873d(_0x404fc0[_0xac7e('0x17')][_0xac7e('0x1a')]);}else{logger[_0xac7e('0x13')](_0xac7e('0x19'),_0x39d2e3,_0xac7e('0x14'));_0x10873d(_0x404fc0['result'][_0xac7e('0x1a')]);}})['catch'](function(_0xba3d01){logger['error'](_0xac7e('0x19'),_0x39d2e3,_0xba3d01);_0x240869(_0xba3d01);});});}exports[_0xac7e('0x1b')]=function(_0x231ab0){var _0x41ae40=this;return new Promise(function(_0x3be919,_0x2ad784){return db['MailInteraction'][_0xac7e('0x1c')](_0x231ab0[_0xac7e('0x1d')],{'raw':_0x231ab0['options']?_0x231ab0[_0xac7e('0x1e')][_0xac7e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x231ab0[_0xac7e('0x1e')]?_0x231ab0[_0xac7e('0x1e')][_0xac7e('0x20')]||null:null,'attributes':_0x231ab0[_0xac7e('0x1e')]?_0x231ab0[_0xac7e('0x1e')][_0xac7e('0x21')]||null:null,'limit':_0x231ab0[_0xac7e('0x1e')]?_0x231ab0[_0xac7e('0x1e')][_0xac7e('0x22')]||null:null})['then'](function(_0x57c945){logger[_0xac7e('0x13')](_0xac7e('0x1b'),_0x231ab0);logger[_0xac7e('0x15')]('UpdateMailInteraction',_0x231ab0,JSON[_0xac7e('0x16')](_0x57c945));_0x3be919(_0x57c945);})[_0xac7e('0x23')](function(_0x2cafcb){logger[_0xac7e('0x17')]('UpdateMailInteraction',_0x2cafcb['message'],_0x231ab0);_0x2ad784(_0x41ae40[_0xac7e('0x17')](0x1f4,_0x2cafcb['message']));});});};exports['AddTagsToMailInteraction']=function(_0x24fa95){return new Promise(function(_0x43eb5e,_0x3ecfc1){return db['MailInteraction'][_0xac7e('0x24')]({'where':_0x24fa95[_0xac7e('0x1e')]?_0x24fa95[_0xac7e('0x1e')][_0xac7e('0x20')]||null:null})['then'](function(_0x12450b){if(_0x12450b){return _0x12450b[_0xac7e('0x25')](_0x24fa95[_0xac7e('0x1d')]['ids'],_[_0xac7e('0x26')](_0x24fa95[_0xac7e('0x1d')],[_0xac7e('0x27'),'id'])||{});}})[_0xac7e('0x28')](function(_0x4b4dee){logger[_0xac7e('0x13')]('AddTags',_0x24fa95);logger[_0xac7e('0x15')](_0xac7e('0x29'),_0x24fa95,JSON[_0xac7e('0x16')](_0x4b4dee));_0x43eb5e(_0x4b4dee);})['catch'](function(_0x194465){logger[_0xac7e('0x17')]('AddTags',_0x194465['message'],_0x24fa95);_0x3ecfc1(_this[_0xac7e('0x17')](0x1f4,_0x194465[_0xac7e('0x1a')]));});});}; \ No newline at end of file +var _0x4065=['then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','UpdateMailInteraction','update','body','options','raw','where','AddTagsToMailInteraction','MailInteraction','addTags','ids','omit','spread','AddTags','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request'];(function(_0x1e5594,_0x2c5ef5){var _0x239896=function(_0x3b66d3){while(--_0x3b66d3){_0x1e5594['push'](_0x1e5594['shift']());}};_0x239896(++_0x2c5ef5);}(_0x4065,0xdc));var _0x5406=function(_0x4767db,_0x63a979){_0x4767db=_0x4767db-0x0;var _0x21baad=_0x4065[_0x4767db];return _0x21baad;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5406('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5406('0x1'));var db=require(_0x5406('0x2'))['db'];var utils=require(_0x5406('0x3'));var logger=require('../../config/logger')(_0x5406('0x4'));var config=require(_0x5406('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5406('0x6')][_0x5406('0x7')]({'port':0x232a});config[_0x5406('0x8')]=_[_0x5406('0x9')](config[_0x5406('0x8')],{'host':_0x5406('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5406('0x8')]));require(_0x5406('0xb'))[_0x5406('0xc')](socket);function respondWithRpcPromise(_0x266399,_0x154c09,_0x26fa0f){return new BPromise(function(_0x49398f,_0x2f7262){return client[_0x5406('0xd')](_0x266399,_0x26fa0f)[_0x5406('0xe')](function(_0x3981d5){logger[_0x5406('0xf')](_0x5406('0x10'),_0x154c09,'request\x20sent');logger[_0x5406('0x11')](_0x5406('0x12'),_0x154c09,'request\x20sent',JSON[_0x5406('0x13')](_0x3981d5));if(_0x3981d5[_0x5406('0x14')]){if(_0x3981d5[_0x5406('0x14')][_0x5406('0x15')]===0x1f4){logger[_0x5406('0x14')](_0x5406('0x10'),_0x154c09,_0x3981d5[_0x5406('0x14')][_0x5406('0x16')]);return _0x2f7262(_0x3981d5[_0x5406('0x14')]['message']);}logger[_0x5406('0x14')](_0x5406('0x10'),_0x154c09,_0x3981d5[_0x5406('0x14')][_0x5406('0x16')]);return _0x49398f(_0x3981d5['error'][_0x5406('0x16')]);}else{logger[_0x5406('0xf')](_0x5406('0x10'),_0x154c09,_0x5406('0x17'));_0x49398f(_0x3981d5[_0x5406('0x18')][_0x5406('0x16')]);}})[_0x5406('0x19')](function(_0x1355a1){logger['error'](_0x5406('0x10'),_0x154c09,_0x1355a1);_0x2f7262(_0x1355a1);});});}exports[_0x5406('0x1a')]=function(_0x498a7c){var _0x12abf3=this;return new Promise(function(_0x323442,_0x38253b){return db['MailInteraction'][_0x5406('0x1b')](_0x498a7c[_0x5406('0x1c')],{'raw':_0x498a7c[_0x5406('0x1d')]?_0x498a7c[_0x5406('0x1d')][_0x5406('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x498a7c[_0x5406('0x1d')]?_0x498a7c[_0x5406('0x1d')][_0x5406('0x1f')]||null:null,'attributes':_0x498a7c['options']?_0x498a7c[_0x5406('0x1d')]['attributes']||null:null,'limit':_0x498a7c[_0x5406('0x1d')]?_0x498a7c[_0x5406('0x1d')]['limit']||null:null})[_0x5406('0xe')](function(_0x371438){logger[_0x5406('0xf')](_0x5406('0x1a'),_0x498a7c);logger[_0x5406('0x11')](_0x5406('0x1a'),_0x498a7c,JSON[_0x5406('0x13')](_0x371438));_0x323442(_0x371438);})[_0x5406('0x19')](function(_0x48fe09){logger[_0x5406('0x14')](_0x5406('0x1a'),_0x48fe09[_0x5406('0x16')],_0x498a7c);_0x38253b(_0x12abf3[_0x5406('0x14')](0x1f4,_0x48fe09[_0x5406('0x16')]));});});};exports[_0x5406('0x20')]=function(_0x2fba2f){return new Promise(function(_0x21955b,_0x52822a){return db[_0x5406('0x21')]['find']({'where':_0x2fba2f[_0x5406('0x1d')]?_0x2fba2f['options'][_0x5406('0x1f')]||null:null})[_0x5406('0xe')](function(_0x3e0b7f){if(_0x3e0b7f){return _0x3e0b7f[_0x5406('0x22')](_0x2fba2f[_0x5406('0x1c')][_0x5406('0x23')],_[_0x5406('0x24')](_0x2fba2f[_0x5406('0x1c')],['ids','id'])||{});}})[_0x5406('0x25')](function(_0x375338){logger[_0x5406('0xf')]('AddTags',_0x2fba2f);logger[_0x5406('0x11')](_0x5406('0x26'),_0x2fba2f,JSON['stringify'](_0x375338));_0x21955b(_0x375338);})['catch'](function(_0x25b8ff){logger[_0x5406('0x14')](_0x5406('0x26'),_0x25b8ff[_0x5406('0x16')],_0x2fba2f);_0x52822a(_this[_0x5406('0x14')](0x1f4,_0x25b8ff['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 838c6c2..ac99925 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 _0x505c=['mailInteraction:','save','update','register','length'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x505c,0xec));var _0xc505=function(_0x1da42f,_0x23dc53){_0x1da42f=_0x1da42f-0x0;var _0x458c83=_0x505c[_0x1da42f];return _0x458c83;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xc505('0x0'),'remove',_0xc505('0x1')];function createListener(_0x40cb07,_0x3f06d0){return function(_0x7e47ba){_0x3f06d0['emit'](_0x40cb07,_0x7e47ba);};}function removeListener(_0x3ae49d,_0x131dcc){return function(){MailInteractionEvents['removeListener'](_0x3ae49d,_0x131dcc);};}exports[_0xc505('0x2')]=function(_0x2684a8){for(var _0x1dd2a3=0x0,_0xa4c960=events[_0xc505('0x3')];_0x1dd2a3<_0xa4c960;_0x1dd2a3++){var _0x24e809=events[_0x1dd2a3];var _0x12303f=createListener(_0xc505('0x4')+_0x24e809,_0x2684a8);MailInteractionEvents['on'](_0x24e809,_0x12303f);}}; \ No newline at end of file +var _0x5887=['length','mailInteraction:','./mailInteraction.events','save','remove','emit','removeListener','register'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5887,0x1a2));var _0x7588=function(_0x3d7365,_0x13ccfb){_0x3d7365=_0x3d7365-0x0;var _0x3d96ac=_0x5887[_0x3d7365];return _0x3d96ac;};'use strict';var MailInteractionEvents=require(_0x7588('0x0'));var events=[_0x7588('0x1'),_0x7588('0x2'),'update'];function createListener(_0x119c81,_0xbe1eef){return function(_0x329cdc){_0xbe1eef[_0x7588('0x3')](_0x119c81,_0x329cdc);};}function removeListener(_0x28b130,_0x3c6a8f){return function(){MailInteractionEvents[_0x7588('0x4')](_0x28b130,_0x3c6a8f);};}exports[_0x7588('0x5')]=function(_0x24802b){for(var _0x358d71=0x0,_0x54230d=events[_0x7588('0x6')];_0x358d71<_0x54230d;_0x358d71++){var _0x7137a3=events[_0x358d71];var _0x41e0d0=createListener(_0x7588('0x7')+_0x7137a3,_0x24802b);MailInteractionEvents['on'](_0x7137a3,_0x41e0d0);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6cdec31..401e79b 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 _0x30b1=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','mail','mailmessage:create','create','put','/:id/accept','accept','reject','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailMessage.controller'];(function(_0x133178,_0x30c7cf){var _0x53a051=function(_0x22b14b){while(--_0x22b14b){_0x133178['push'](_0x133178['shift']());}};_0x53a051(++_0x30c7cf);}(_0x30b1,0xa1));var _0x130b=function(_0x1a3a3f,_0x5dfbf6){_0x1a3a3f=_0x1a3a3f-0x0;var _0x4aa899=_0x30b1[_0x1a3a3f];return _0x4aa899;};'use strict';var multer=require('multer');var util=require(_0x130b('0x0'));var path=require('path');var timeout=require(_0x130b('0x1'));var express=require(_0x130b('0x2'));var router=express[_0x130b('0x3')]();var fs_extra=require(_0x130b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x130b('0x5'));var config=require('../../config/environment');var controller=require(_0x130b('0x6'));router[_0x130b('0x7')]('/',auth[_0x130b('0x8')](),controller[_0x130b('0x9')]);router['get'](_0x130b('0xa'),auth['isAuthenticated'](),controller[_0x130b('0xb')]);router['get'](_0x130b('0xc'),auth['isAuthenticated'](),controller[_0x130b('0xd')]);router[_0x130b('0x7')](_0x130b('0xe'),auth[_0x130b('0x8')](),controller['download']);router[_0x130b('0xf')]('/',auth[_0x130b('0x8')](),interaction['tracked'](_0x130b('0x10'),_0x130b('0x11')),controller[_0x130b('0x12')]);router[_0x130b('0x13')](_0x130b('0xc'),auth['isAuthenticated'](),controller['update']);router['put'](_0x130b('0x14'),auth[_0x130b('0x8')](),controller[_0x130b('0x15')]);router[_0x130b('0x13')]('/:id/reject',auth[_0x130b('0x8')](),controller[_0x130b('0x16')]);router['delete']('/:id',auth[_0x130b('0x8')](),controller['destroy']);module[_0x130b('0x17')]=router; \ No newline at end of file +var _0x94cf=['delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','describe','/:id','show','download','tracked','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94cf,0x92));var _0xf94c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94cf[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf94c('0x0'));var timeout=require(_0xf94c('0x1'));var express=require(_0xf94c('0x2'));var router=express[_0xf94c('0x3')]();var fs_extra=require(_0xf94c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf94c('0x5'));var config=require(_0xf94c('0x6'));var controller=require(_0xf94c('0x7'));router[_0xf94c('0x8')]('/',auth[_0xf94c('0x9')](),controller['index']);router[_0xf94c('0x8')]('/describe',auth[_0xf94c('0x9')](),controller[_0xf94c('0xa')]);router[_0xf94c('0x8')](_0xf94c('0xb'),auth[_0xf94c('0x9')](),controller[_0xf94c('0xc')]);router[_0xf94c('0x8')]('/:id/download',auth[_0xf94c('0x9')](),controller[_0xf94c('0xd')]);router['post']('/',auth[_0xf94c('0x9')](),interaction[_0xf94c('0xe')]('mail',_0xf94c('0xf')),controller[_0xf94c('0x10')]);router[_0xf94c('0x11')](_0xf94c('0xb'),auth[_0xf94c('0x9')](),controller['update']);router['put'](_0xf94c('0x12'),auth[_0xf94c('0x9')](),controller[_0xf94c('0x13')]);router[_0xf94c('0x11')](_0xf94c('0x14'),auth[_0xf94c('0x9')](),controller[_0xf94c('0x15')]);router[_0xf94c('0x16')](_0xf94c('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf94c('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1d90a5c..904a3f8 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 _0x8450=['exports','TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Email','lodash'];(function(_0x12e13a,_0x3f8461){var _0xf4cf3c=function(_0x54012f){while(--_0x54012f){_0x12e13a['push'](_0x12e13a['shift']());}};_0xf4cf3c(++_0x3f8461);}(_0x8450,0x1c7));var _0x0845=function(_0xdac768,_0x214a75){_0xdac768=_0xdac768-0x0;var _0x145350=_0x8450[_0xdac768];return _0x145350;};'use strict';var Sequelize=require('sequelize');var _=require(_0x0845('0x0'));module[_0x0845('0x1')]={'body':{'type':Sequelize[_0x0845('0x2')](_0x0845('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x0845('0x2')](_0x0845('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0845('0x5')]('in','out'),'defaultValue':_0x0845('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0845('0x7')](0x1fe)},'from':{'type':Sequelize[_0x0845('0x7')]},'to':{'type':Sequelize['TEXT'](_0x0845('0x3'))},'cc':{'type':Sequelize[_0x0845('0x2')](_0x0845('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0x0845('0x3'))},'subject':{'type':Sequelize[_0x0845('0x2')]},'sentAt':{'type':Sequelize[_0x0845('0x8')]},'attach':{'type':Sequelize[_0x0845('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x0845('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x0845('0x8')]},'originTo':{'type':Sequelize[_0x0845('0x2')](_0x0845('0x3'))},'originCc':{'type':Sequelize[_0x0845('0x2')](_0x0845('0x3'))},'originChannel':{'type':Sequelize[_0x0845('0x5')]('Email','Chat'),'defaultValue':_0x0845('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x05b6=['lodash','TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Email','sequelize'];(function(_0x48cb10,_0x343485){var _0x301ae0=function(_0x260de4){while(--_0x260de4){_0x48cb10['push'](_0x48cb10['shift']());}};_0x301ae0(++_0x343485);}(_0x05b6,0x1a3));var _0x605b=function(_0x44d4e9,_0x52d710){_0x44d4e9=_0x44d4e9-0x0;var _0x4c9bd2=_0x05b6[_0x44d4e9];return _0x4c9bd2;};'use strict';var Sequelize=require(_0x605b('0x0'));var _=require(_0x605b('0x1'));module['exports']={'body':{'type':Sequelize[_0x605b('0x2')](_0x605b('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x605b('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x605b('0x5')]('in','out'),'defaultValue':_0x605b('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x605b('0x7')]},'to':{'type':Sequelize[_0x605b('0x2')](_0x605b('0x3'))},'cc':{'type':Sequelize[_0x605b('0x2')]('long')},'bcc':{'type':Sequelize[_0x605b('0x2')](_0x605b('0x3'))},'subject':{'type':Sequelize[_0x605b('0x2')]},'sentAt':{'type':Sequelize[_0x605b('0x8')]},'attach':{'type':Sequelize[_0x605b('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x605b('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x605b('0x8')]},'originTo':{'type':Sequelize[_0x605b('0x2')](_0x605b('0x3'))},'originCc':{'type':Sequelize[_0x605b('0x2')](_0x605b('0x3'))},'originChannel':{'type':Sequelize['ENUM'](_0x605b('0xb'),'Chat'),'defaultValue':_0x605b('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 372f4b6..378a70d 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 _0x60bf=['channel','download','unix','server','tmp','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','build','writeFileSync','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./mailMessage.socket','register','client','http','request','then','request\x20sent','debug','error','code','MailMessage,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','map','MailMessage','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','catch','update','body','find','describe','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','updatedAt','DESC','Smtp','port','secure','authentication','pass','service','user','attachments','join','root','server/files/attachments','basename','List','Contacts','create','ListId','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','stringify','mail-interactions','mail','read','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','startsWith','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','manual','interface','SIP/%s','event','accept','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','cf_','SELECT'];(function(_0x46e427,_0xdad9a8){var _0x127b35=function(_0x21e292){while(--_0x21e292){_0x46e427['push'](_0x46e427['shift']());}};_0x127b35(++_0xdad9a8);}(_0x60bf,0xc8));var _0xf60b=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x60bf[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0xf60b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf60b('0x1'));var jsonpatch=require(_0xf60b('0x2'));var rp=require(_0xf60b('0x3'));var moment=require(_0xf60b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf60b('0x5'));var util=require(_0xf60b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf60b('0x7'));var ejs=require(_0xf60b('0x8'));var fs=require('fs');var fs_extra=require(_0xf60b('0x9'));var _=require(_0xf60b('0xa'));var squel=require(_0xf60b('0xb'));var crypto=require(_0xf60b('0xc'));var jsforce=require(_0xf60b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf60b('0x7'));var querystring=require(_0xf60b('0xe'));var Papa=require(_0xf60b('0xf'));var Redis=require('ioredis');var authService=require(_0xf60b('0x10'));var qs=require(_0xf60b('0x11'));var as=require(_0xf60b('0x12'));var hardwareService=require(_0xf60b('0x13'));var logger=require(_0xf60b('0x14'))('api');var utils=require(_0xf60b('0x15'));var config=require(_0xf60b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf60b('0x17')]=_[_0xf60b('0x18')](config[_0xf60b('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xf60b('0x19'))(new Redis(config['redis']));require(_0xf60b('0x1a'))[_0xf60b('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf60b('0x1c')][_0xf60b('0x1d')]({'port':0x232c});var client9003=jayson['client'][_0xf60b('0x1d')]({'port':0x232b});var client9002=jayson[_0xf60b('0x1c')][_0xf60b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x20b8ad,_0xb99c1a,_0x259125,_0x2abaf1){return new BPromise(function(_0x1e86ca,_0xef6c20){var _0x3d3102=_0x2abaf1||client;return _0x3d3102[_0xf60b('0x1e')](_0x20b8ad,_0x259125)[_0xf60b('0x1f')](function(_0x339803){logger['info']('MailMessage,\x20%s,\x20%s',_0xb99c1a,_0xf60b('0x20'));logger[_0xf60b('0x21')]('MailMessage,\x20%s,\x20%s,\x20%s',_0xb99c1a,'request\x20sent',JSON['stringify'](_0x339803));if(_0x339803[_0xf60b('0x22')]){if(_0x339803[_0xf60b('0x22')][_0xf60b('0x23')]===0x1f4){logger['error'](_0xf60b('0x24'),_0xb99c1a,_0x339803[_0xf60b('0x22')][_0xf60b('0x25')]);return _0xef6c20(_0x339803[_0xf60b('0x22')]['message']);}logger[_0xf60b('0x22')]('MailMessage,\x20%s,\x20%s',_0xb99c1a,_0x339803[_0xf60b('0x22')][_0xf60b('0x25')]);return _0x1e86ca(_0x339803[_0xf60b('0x22')]['message']);}else{logger[_0xf60b('0x26')](_0xf60b('0x24'),_0xb99c1a,_0xf60b('0x20'));_0x1e86ca(_0x339803[_0xf60b('0x27')][_0xf60b('0x25')]);}})['catch'](function(_0x4396be){logger[_0xf60b('0x22')](_0xf60b('0x24'),_0xb99c1a,_0x4396be);_0xef6c20(_0x4396be);});});}function respondWithStatusCode(_0x646c99,_0x1fc2d2){_0x1fc2d2=_0x1fc2d2||0xcc;return function(_0xca6f6f){if(_0xca6f6f){return _0x646c99[_0xf60b('0x28')](_0x1fc2d2);}return _0x646c99[_0xf60b('0x29')](_0x1fc2d2)[_0xf60b('0x2a')]();};}function respondWithResult(_0x5dd369,_0xf896a0){_0xf896a0=_0xf896a0||0xc8;return function(_0x3b5ca6){if(_0x3b5ca6){return _0x5dd369['status'](_0xf896a0)[_0xf60b('0x2b')](_0x3b5ca6);}};}function respondWithFilteredResult(_0x7e1367,_0x194e7b){return function(_0x5e34f1){if(_0x5e34f1){var _0x85c9c9=typeof _0x194e7b['offset']===_0xf60b('0x2c')&&typeof _0x194e7b[_0xf60b('0x2d')]===_0xf60b('0x2c');var _0x70cb47=_0x5e34f1[_0xf60b('0x2e')];var _0x2b7ab1=_0x85c9c9?0x0:_0x194e7b[_0xf60b('0x2f')];var _0x24c01b=_0x85c9c9?_0x5e34f1['count']:_0x194e7b[_0xf60b('0x2f')]+_0x194e7b[_0xf60b('0x2d')];var _0x10435e;if(_0x24c01b>=_0x70cb47){_0x24c01b=_0x70cb47;_0x10435e=0xc8;}else{_0x10435e=0xce;}_0x7e1367[_0xf60b('0x29')](_0x10435e);return _0x7e1367[_0xf60b('0x30')](_0xf60b('0x31'),_0x2b7ab1+'-'+_0x24c01b+'/'+_0x70cb47)['json'](_0x5e34f1);}return null;};}function patchUpdates(_0x4411e4){return function(_0x176cc9){try{jsonpatch[_0xf60b('0x32')](_0x176cc9,_0x4411e4,!![]);}catch(_0x67560d){return BPromise[_0xf60b('0x33')](_0x67560d);}return _0x176cc9[_0xf60b('0x34')]();};}function saveUpdates(_0x3b43b8,_0x2b6754){return function(_0x5e0eb8){if(_0x5e0eb8){return _0x5e0eb8['update'](_0x3b43b8)['then'](function(_0x1241f0){return _0x1241f0;});}return null;};}function removeEntity(_0x203bee,_0x5e72c4){return function(_0x28131c){if(_0x28131c){return _0x28131c[_0xf60b('0x35')]()[_0xf60b('0x1f')](function(){_0x203bee['status'](0xcc)[_0xf60b('0x2a')]();});}};}function handleEntityNotFound(_0x3356bd,_0x29ce4c){return function(_0x2c6ce4){if(!_0x2c6ce4){_0x3356bd[_0xf60b('0x28')](0x194);}return _0x2c6ce4;};}function handleError(_0x39e04c,_0x191bee){_0x191bee=_0x191bee||0x1f4;return function(_0x5ce326){logger[_0xf60b('0x22')](_0x5ce326[_0xf60b('0x36')]);if(_0x5ce326['name']){delete _0x5ce326[_0xf60b('0x37')];}_0x39e04c[_0xf60b('0x29')](_0x191bee)[_0xf60b('0x38')](_0x5ce326);};}exports['index']=function(_0x20ec39,_0x458213){var _0x466eea={},_0x35f3ea={},_0x857b13={'count':0x0,'rows':[]};var _0x462c28=_[_0xf60b('0x39')](db[_0xf60b('0x3a')]['rawAttributes'],function(_0x18235d){return{'name':_0x18235d[_0xf60b('0x3b')],'type':_0x18235d['type'][_0xf60b('0x3c')]};});_0x35f3ea[_0xf60b('0x3d')]=_[_0xf60b('0x39')](_0x462c28,_0xf60b('0x37'));_0x35f3ea['query']=_[_0xf60b('0x3e')](_0x20ec39[_0xf60b('0x3f')]);_0x35f3ea[_0xf60b('0x40')]=_[_0xf60b('0x41')](_0x35f3ea[_0xf60b('0x3d')],_0x35f3ea[_0xf60b('0x3f')]);_0x466eea['attributes']=_['intersection'](_0x35f3ea[_0xf60b('0x3d')],qs[_0xf60b('0x42')](_0x20ec39[_0xf60b('0x3f')][_0xf60b('0x42')]));_0x466eea[_0xf60b('0x43')]=_0x466eea[_0xf60b('0x43')][_0xf60b('0x44')]?_0x466eea[_0xf60b('0x43')]:_0x35f3ea[_0xf60b('0x3d')];if(!_0x20ec39['query'][_0xf60b('0x45')](_0xf60b('0x46'))){_0x466eea[_0xf60b('0x2d')]=qs['limit'](_0x20ec39[_0xf60b('0x3f')][_0xf60b('0x2d')]);_0x466eea['offset']=qs[_0xf60b('0x2f')](_0x20ec39[_0xf60b('0x3f')]['offset']);}_0x466eea[_0xf60b('0x47')]=qs[_0xf60b('0x48')](_0x20ec39['query'][_0xf60b('0x48')]);_0x466eea[_0xf60b('0x49')]=qs[_0xf60b('0x40')](_[_0xf60b('0x4a')](_0x20ec39[_0xf60b('0x3f')],_0x35f3ea[_0xf60b('0x40')]),_0x462c28);if(_0x20ec39[_0xf60b('0x3f')][_0xf60b('0x4b')]){_0x466eea[_0xf60b('0x49')]=_[_0xf60b('0x4c')](_0x466eea[_0xf60b('0x49')],{'$or':_[_0xf60b('0x39')](_0x462c28,function(_0x11401e){if(_0x11401e[_0xf60b('0x4d')]!==_0xf60b('0x4e')){var _0x175f54={};_0x175f54[_0x11401e[_0xf60b('0x37')]]={'$like':'%'+_0x20ec39[_0xf60b('0x3f')][_0xf60b('0x4b')]+'%'};return _0x175f54;}})});}_0x466eea=_[_0xf60b('0x4c')]({},_0x466eea,_0x20ec39[_0xf60b('0x4f')]);var _0x26a360={'where':_0x466eea[_0xf60b('0x49')]};return db['MailMessage']['count'](_0x26a360)[_0xf60b('0x1f')](function(_0x563aa3){_0x857b13[_0xf60b('0x2e')]=_0x563aa3;if(_0x20ec39[_0xf60b('0x3f')][_0xf60b('0x50')]){_0x466eea['include']=[{'all':!![]}];}return db['MailMessage'][_0xf60b('0x51')](_0x466eea);})[_0xf60b('0x1f')](function(_0x3b0001){_0x857b13[_0xf60b('0x52')]=_0x3b0001;return _0x857b13;})[_0xf60b('0x1f')](respondWithFilteredResult(_0x458213,_0x466eea))['catch'](handleError(_0x458213,null));};exports[_0xf60b('0x53')]=function(_0x59b750,_0x49a7ab){var _0x5131cd={'raw':!![],'where':{'id':_0x59b750[_0xf60b('0x54')]['id']}},_0x49e247={};_0x49e247[_0xf60b('0x3d')]=_[_0xf60b('0x3e')](db[_0xf60b('0x3a')][_0xf60b('0x55')]);_0x49e247[_0xf60b('0x3f')]=_['keys'](_0x59b750[_0xf60b('0x3f')]);_0x49e247[_0xf60b('0x40')]=_[_0xf60b('0x41')](_0x49e247[_0xf60b('0x3d')],_0x49e247['query']);_0x5131cd[_0xf60b('0x43')]=_[_0xf60b('0x41')](_0x49e247[_0xf60b('0x3d')],qs[_0xf60b('0x42')](_0x59b750['query'][_0xf60b('0x42')]));_0x5131cd[_0xf60b('0x43')]=_0x5131cd[_0xf60b('0x43')][_0xf60b('0x44')]?_0x5131cd[_0xf60b('0x43')]:_0x49e247[_0xf60b('0x3d')];if(_0x59b750[_0xf60b('0x3f')][_0xf60b('0x50')]){_0x5131cd['include']=[{'all':!![]}];}_0x5131cd=_['merge']({},_0x5131cd,_0x59b750[_0xf60b('0x4f')]);return db[_0xf60b('0x3a')]['find'](_0x5131cd)[_0xf60b('0x1f')](handleEntityNotFound(_0x49a7ab,null))[_0xf60b('0x1f')](respondWithResult(_0x49a7ab,null))[_0xf60b('0x56')](handleError(_0x49a7ab,null));};exports[_0xf60b('0x57')]=function(_0x55e9d7,_0x38cdc8){if(_0x55e9d7[_0xf60b('0x58')]['id']){delete _0x55e9d7[_0xf60b('0x58')]['id'];}return db[_0xf60b('0x3a')][_0xf60b('0x59')]({'where':{'id':_0x55e9d7[_0xf60b('0x54')]['id']}})['then'](handleEntityNotFound(_0x38cdc8,null))['then'](saveUpdates(_0x55e9d7[_0xf60b('0x58')],null))['then'](respondWithResult(_0x38cdc8,null))[_0xf60b('0x56')](handleError(_0x38cdc8,null));};exports['destroy']=function(_0x4151b2,_0x516326){return db[_0xf60b('0x3a')]['find']({'where':{'id':_0x4151b2[_0xf60b('0x54')]['id']}})['then'](handleEntityNotFound(_0x516326,null))['then'](removeEntity(_0x516326,null))[_0xf60b('0x56')](handleError(_0x516326,null));};exports[_0xf60b('0x5a')]=function(_0x2818ec,_0x2575d1){return db['MailMessage'][_0xf60b('0x5a')]()[_0xf60b('0x1f')](respondWithResult(_0x2575d1,null))[_0xf60b('0x56')](handleError(_0x2575d1,null));};exports['create']=function(_0x445086,_0x1c0dfe){return db[_0xf60b('0x3a')]['create'](_0x445086[_0xf60b('0x58')])[_0xf60b('0x1f')](function(_0x3d82ce){if(_0x3d82ce){if(_0x3d82ce[_0xf60b('0x5b')]===_0xf60b('0x5c')&&!_0x3d82ce[_0xf60b('0x5d')]){var _0x16efc1,_0x509287,_0x2f5a1a;if(_0x445086[_0xf60b('0x58')]['to']){_0x509287=_0x445086['body']['to'][_0xf60b('0x5e')](',')[0x0];}return db[_0xf60b('0x5f')][_0xf60b('0x60')]({'where':{'id':_0x3d82ce[_0xf60b('0x61')]},'include':[{'model':db[_0xf60b('0x62')],'as':'List','include':[{'model':db[_0xf60b('0x63')],'as':'Contacts','where':{'email':_0x509287},'limit':0x1,'order':[[_0xf60b('0x64'),_0xf60b('0x65')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})['then'](function(_0x57d966){_0x16efc1=_0x57d966;if(_0x16efc1&&_0x16efc1[_0xf60b('0x66')]){var _0x440a96={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x16efc1[_0xf60b('0x66')]['service'])){_0x440a96['host']=_0x16efc1[_0xf60b('0x66')]['host'];_0x440a96[_0xf60b('0x67')]=_0x16efc1['Smtp']['port'];_0x440a96['secure']=_0x16efc1['Smtp'][_0xf60b('0x68')];if(_0x16efc1[_0xf60b('0x66')][_0xf60b('0x69')]){_0x440a96['auth']={'user':_0x16efc1[_0xf60b('0x66')]['user'],'pass':_0x16efc1[_0xf60b('0x66')][_0xf60b('0x6a')]};}}else{_0x440a96[_0xf60b('0x6b')]=_0x16efc1['Smtp'][_0xf60b('0x6b')];_0x440a96['auth']={'user':_0x16efc1[_0xf60b('0x66')][_0xf60b('0x6c')],'pass':_0x16efc1[_0xf60b('0x66')]['pass']};_0x440a96[_0xf60b('0x68')]=_0x16efc1[_0xf60b('0x66')][_0xf60b('0x68')];}if(_0x445086['body'][_0xf60b('0x6d')]&&_0x445086[_0xf60b('0x58')][_0xf60b('0x6d')][_0xf60b('0x44')]){for(var _0x345995=0x0;_0x345995<_0x445086[_0xf60b('0x58')]['attachments'][_0xf60b('0x44')];_0x345995+=0x1){_0x445086['body']['attachments'][_0x345995]={'filename':_0x445086[_0xf60b('0x58')][_0xf60b('0x6d')][_0x345995][_0xf60b('0x37')],'path':path[_0xf60b('0x6e')](config[_0xf60b('0x6f')],_0xf60b('0x70'),_0x445086[_0xf60b('0x58')]['attachments'][_0x345995][_0xf60b('0x71')])};}}_0x2f5a1a={'account':_0x440a96,'message':_0x445086[_0xf60b('0x58')]};return;}})[_0xf60b('0x1f')](function(){if(_0x16efc1['List']){if(_0x16efc1[_0xf60b('0x72')][_0xf60b('0x73')][_0xf60b('0x44')]){return _0x16efc1[_0xf60b('0x72')][_0xf60b('0x73')][0x0];}else{return db[_0xf60b('0x63')][_0xf60b('0x74')](_[_0xf60b('0x18')](_0x445086[_0xf60b('0x58')],{'firstName':_0x445086[_0xf60b('0x58')]['to'],'email':_0x445086['body']['to'],'phone':_0x445086[_0xf60b('0x58')]['to'],'ListId':_0x16efc1[_0xf60b('0x75')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xf60b('0x1f')](function(){if(_0x2f5a1a){return respondWithRpcPromise('SendMail',_0xf60b('0x76'),_0x2f5a1a,client9003)[_0xf60b('0x1f')](function(_0x4032c7){return _0x3d82ce[_0xf60b('0x57')]({'read':!![],'messageId':_0x4032c7['messageId'],'sentAt':moment()[_0xf60b('0x77')](_0xf60b('0x78'))});})[_0xf60b('0x56')](function(_0x269097){logger[_0xf60b('0x22')]('%s',JSON[_0xf60b('0x79')](_0x269097));return _0x3d82ce;});}return _0x3d82ce;});}return _0x3d82ce;}})[_0xf60b('0x1f')](respondWithResult(_0x1c0dfe,0xc9))['catch'](handleError(_0x1c0dfe,null));};var interaction_log=require(_0xf60b('0x14'))(_0xf60b('0x7a'));exports['accept']=function(_0x2d2b57,_0x5b20d6,_0x179b1b){var _0x26291b={'agent':{},'channel':_0xf60b('0x7b')};if(_0x2d2b57['body']['id']){delete _0x2d2b57[_0xf60b('0x58')]['id'];}_0x2d2b57[_0xf60b('0x58')][_0xf60b('0x7c')]=!![];_0x2d2b57[_0xf60b('0x58')][_0xf60b('0x7d')]=moment()[_0xf60b('0x77')](_0xf60b('0x78'));_0x2d2b57['body'][_0xf60b('0x7e')]=_0x2d2b57[_0xf60b('0x58')]['UserId']||_0x2d2b57['user']['id'];_0x26291b['agent']['id']=_0x2d2b57[_0xf60b('0x58')][_0xf60b('0x7e')];return db['MailMessage'][_0xf60b('0x59')]({'where':{'id':_0x2d2b57['params']['id'],'UserId':null},'include':[{'model':db[_0xf60b('0x63')],'as':_0xf60b('0x7f')}]})[_0xf60b('0x1f')](handleEntityNotFound(_0x5b20d6,null))[_0xf60b('0x1f')](saveUpdates(_0x2d2b57[_0xf60b('0x58')],null))[_0xf60b('0x1f')](function(_0x35b72d){if(_0x35b72d){_0x26291b[_0xf60b('0x25')]=_0x35b72d[_0xf60b('0x80')]({'plain':!![]});return db[_0xf60b('0x81')][_0xf60b('0x59')]({'where':{'id':_0x35b72d[_0xf60b('0x82')]}});}return null;})[_0xf60b('0x1f')](handleEntityNotFound(_0x5b20d6,null))[_0xf60b('0x1f')](function(_0x53b3d1){if(_0x53b3d1){return _0x53b3d1['update']({'UserId':_0x2d2b57[_0xf60b('0x58')][_0xf60b('0x7e')],'read1stAt':_[_0xf60b('0x83')](_0x53b3d1[_0xf60b('0x84')])?moment()[_0xf60b('0x77')](_0xf60b('0x78')):undefined});}return null;})[_0xf60b('0x1f')](function(_0x1db358){if(_0x1db358){_0x26291b[_0xf60b('0x85')]=_0x1db358[_0xf60b('0x80')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2d2b57[_0xf60b('0x6c')]['id'],_0x2d2b57[_0xf60b('0x6c')][_0xf60b('0x37')],_0x2d2b57[_0xf60b('0x6c')][_0xf60b('0x86')],_0x26291b[_0xf60b('0x85')]['id'],_0x2d2b57[_0xf60b('0x58')]?JSON[_0xf60b('0x79')](_0x2d2b57[_0xf60b('0x58')]):_0xf60b('0x87'));return respondWithRpcPromise(_0xf60b('0x88'),'acceptMessage',_0x26291b);}return null;})['then'](function(_0x412d6d){return db[_0xf60b('0x63')][_0xf60b('0x5a')]()[_0xf60b('0x1f')](function(_0x4d0a9b){var _0x4ba64b=[];for(var _0x2cc847=0x0;_0x2cc847=_0xba783b){_0x44d84c=_0xba783b;_0x5b42ac=0xc8;}else{_0x5b42ac=0xce;}_0x353cb7[_0x013c('0x2a')](_0x5b42ac);return _0x353cb7[_0x013c('0x2f')](_0x013c('0x30'),_0x556bdc+'-'+_0x44d84c+'/'+_0xba783b)[_0x013c('0x31')](_0x16cdad);}return null;};}function patchUpdates(_0x4f5f6a){return function(_0x4da083){try{jsonpatch['apply'](_0x4da083,_0x4f5f6a,!![]);}catch(_0x469b9e){return BPromise[_0x013c('0x32')](_0x469b9e);}return _0x4da083[_0x013c('0x33')]();};}function saveUpdates(_0x443275,_0x437b50){return function(_0x22cfc5){if(_0x22cfc5){return _0x22cfc5[_0x013c('0x34')](_0x443275)[_0x013c('0x20')](function(_0x3b95d8){return _0x3b95d8;});}return null;};}function removeEntity(_0x12724e,_0xc69c3f){return function(_0x9f2811){if(_0x9f2811){return _0x9f2811['destroy']()['then'](function(){_0x12724e[_0x013c('0x2a')](0xcc)[_0x013c('0x35')]();});}};}function handleEntityNotFound(_0x245086,_0x14b67f){return function(_0x5dc406){if(!_0x5dc406){_0x245086[_0x013c('0x29')](0x194);}return _0x5dc406;};}function handleError(_0xefb24b,_0x4707d3){_0x4707d3=_0x4707d3||0x1f4;return function(_0x2c584e){logger['error'](_0x2c584e[_0x013c('0x36')]);if(_0x2c584e[_0x013c('0x37')]){delete _0x2c584e['name'];}_0xefb24b[_0x013c('0x2a')](_0x4707d3)['send'](_0x2c584e);};}exports[_0x013c('0x38')]=function(_0x2ff0bb,_0x447aae){var _0x2b090c={},_0x4eda00={},_0x3f2fda={'count':0x0,'rows':[]};var _0x39b6b3=_[_0x013c('0x39')](db[_0x013c('0x3a')][_0x013c('0x3b')],function(_0x1c998e){return{'name':_0x1c998e[_0x013c('0x3c')],'type':_0x1c998e[_0x013c('0x3d')][_0x013c('0x3e')]};});_0x4eda00['model']=_[_0x013c('0x39')](_0x39b6b3,_0x013c('0x37'));_0x4eda00['query']=_[_0x013c('0x3f')](_0x2ff0bb[_0x013c('0x40')]);_0x4eda00['filters']=_[_0x013c('0x41')](_0x4eda00[_0x013c('0x42')],_0x4eda00[_0x013c('0x40')]);_0x2b090c[_0x013c('0x43')]=_[_0x013c('0x41')](_0x4eda00['model'],qs[_0x013c('0x44')](_0x2ff0bb['query']['fields']));_0x2b090c['attributes']=_0x2b090c['attributes'][_0x013c('0x45')]?_0x2b090c[_0x013c('0x43')]:_0x4eda00[_0x013c('0x42')];if(!_0x2ff0bb['query'][_0x013c('0x46')](_0x013c('0x47'))){_0x2b090c[_0x013c('0x2d')]=qs[_0x013c('0x2d')](_0x2ff0bb[_0x013c('0x40')]['limit']);_0x2b090c[_0x013c('0x2b')]=qs[_0x013c('0x2b')](_0x2ff0bb['query']['offset']);}_0x2b090c['order']=qs['sort'](_0x2ff0bb[_0x013c('0x40')][_0x013c('0x48')]);_0x2b090c['where']=qs[_0x013c('0x49')](_[_0x013c('0x4a')](_0x2ff0bb['query'],_0x4eda00[_0x013c('0x49')]),_0x39b6b3);if(_0x2ff0bb[_0x013c('0x40')][_0x013c('0x4b')]){_0x2b090c[_0x013c('0x4c')]=_[_0x013c('0x4d')](_0x2b090c[_0x013c('0x4c')],{'$or':_[_0x013c('0x39')](_0x39b6b3,function(_0x7e44ac){if(_0x7e44ac['type']!==_0x013c('0x4e')){var _0x499f0d={};_0x499f0d[_0x7e44ac[_0x013c('0x37')]]={'$like':'%'+_0x2ff0bb['query']['filter']+'%'};return _0x499f0d;}})});}_0x2b090c=_[_0x013c('0x4d')]({},_0x2b090c,_0x2ff0bb['options']);var _0x21cc50={'where':_0x2b090c[_0x013c('0x4c')]};return db[_0x013c('0x3a')][_0x013c('0x2e')](_0x21cc50)['then'](function(_0x5185a3){_0x3f2fda['count']=_0x5185a3;if(_0x2ff0bb['query'][_0x013c('0x4f')]){_0x2b090c['include']=[{'all':!![]}];}return db[_0x013c('0x3a')][_0x013c('0x50')](_0x2b090c);})[_0x013c('0x20')](function(_0x3c717c){_0x3f2fda[_0x013c('0x51')]=_0x3c717c;return _0x3f2fda;})[_0x013c('0x20')](respondWithFilteredResult(_0x447aae,_0x2b090c))[_0x013c('0x28')](handleError(_0x447aae,null));};exports[_0x013c('0x52')]=function(_0x1069eb,_0x5ca070){var _0x250c89={'raw':!![],'where':{'id':_0x1069eb['params']['id']}},_0x5163d8={};_0x5163d8[_0x013c('0x42')]=_['keys'](db['MailMessage'][_0x013c('0x3b')]);_0x5163d8[_0x013c('0x40')]=_['keys'](_0x1069eb[_0x013c('0x40')]);_0x5163d8[_0x013c('0x49')]=_[_0x013c('0x41')](_0x5163d8['model'],_0x5163d8[_0x013c('0x40')]);_0x250c89[_0x013c('0x43')]=_[_0x013c('0x41')](_0x5163d8[_0x013c('0x42')],qs[_0x013c('0x44')](_0x1069eb['query'][_0x013c('0x44')]));_0x250c89[_0x013c('0x43')]=_0x250c89[_0x013c('0x43')][_0x013c('0x45')]?_0x250c89['attributes']:_0x5163d8[_0x013c('0x42')];if(_0x1069eb[_0x013c('0x40')][_0x013c('0x4f')]){_0x250c89[_0x013c('0x53')]=[{'all':!![]}];}_0x250c89=_[_0x013c('0x4d')]({},_0x250c89,_0x1069eb[_0x013c('0x54')]);return db[_0x013c('0x3a')][_0x013c('0x55')](_0x250c89)[_0x013c('0x20')](handleEntityNotFound(_0x5ca070,null))['then'](respondWithResult(_0x5ca070,null))[_0x013c('0x28')](handleError(_0x5ca070,null));};exports[_0x013c('0x34')]=function(_0x5c8cc9,_0x55bf4a){if(_0x5c8cc9[_0x013c('0x56')]['id']){delete _0x5c8cc9['body']['id'];}return db[_0x013c('0x3a')][_0x013c('0x55')]({'where':{'id':_0x5c8cc9[_0x013c('0x57')]['id']}})[_0x013c('0x20')](handleEntityNotFound(_0x55bf4a,null))['then'](saveUpdates(_0x5c8cc9[_0x013c('0x56')],null))[_0x013c('0x20')](respondWithResult(_0x55bf4a,null))[_0x013c('0x28')](handleError(_0x55bf4a,null));};exports['destroy']=function(_0x261819,_0x5e81a6){return db[_0x013c('0x3a')]['find']({'where':{'id':_0x261819[_0x013c('0x57')]['id']}})[_0x013c('0x20')](handleEntityNotFound(_0x5e81a6,null))[_0x013c('0x20')](removeEntity(_0x5e81a6,null))['catch'](handleError(_0x5e81a6,null));};exports['describe']=function(_0x4105f8,_0x2c7a42){return db[_0x013c('0x3a')][_0x013c('0x58')]()[_0x013c('0x20')](respondWithResult(_0x2c7a42,null))['catch'](handleError(_0x2c7a42,null));};exports[_0x013c('0x59')]=function(_0x3a3c8b,_0x201adc){return db['MailMessage']['create'](_0x3a3c8b[_0x013c('0x56')])[_0x013c('0x20')](function(_0x4edae2){if(_0x4edae2){if(_0x4edae2[_0x013c('0x5a')]===_0x013c('0x5b')&&!_0x4edae2[_0x013c('0x5c')]){var _0x1d375c,_0x5594eb,_0xa8036a;if(_0x3a3c8b[_0x013c('0x56')]['to']){_0x5594eb=_0x3a3c8b[_0x013c('0x56')]['to'][_0x013c('0x5d')](',')[0x0];}return db[_0x013c('0x5e')]['findOne']({'where':{'id':_0x4edae2['MailAccountId']},'include':[{'model':db[_0x013c('0x5f')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x5594eb},'limit':0x1,'order':[[_0x013c('0x60'),_0x013c('0x61')]]}]},{'model':db[_0x013c('0x62')],'as':'Smtp','raw':!![]}]})['then'](function(_0x37acc2){_0x1d375c=_0x37acc2;if(_0x1d375c&&_0x1d375c[_0x013c('0x63')]){var _0x319235={'tls':{'rejectUnauthorized':![]}};if(_[_0x013c('0x64')](_0x1d375c[_0x013c('0x63')]['service'])){_0x319235[_0x013c('0x65')]=_0x1d375c[_0x013c('0x63')][_0x013c('0x65')];_0x319235[_0x013c('0x66')]=_0x1d375c[_0x013c('0x63')][_0x013c('0x66')];_0x319235[_0x013c('0x67')]=_0x1d375c[_0x013c('0x63')][_0x013c('0x67')];if(_0x1d375c['Smtp'][_0x013c('0x68')]){_0x319235[_0x013c('0x69')]={'user':_0x1d375c[_0x013c('0x63')]['user'],'pass':_0x1d375c[_0x013c('0x63')][_0x013c('0x6a')]};}}else{_0x319235[_0x013c('0x6b')]=_0x1d375c[_0x013c('0x63')][_0x013c('0x6b')];_0x319235[_0x013c('0x69')]={'user':_0x1d375c[_0x013c('0x63')]['user'],'pass':_0x1d375c['Smtp'][_0x013c('0x6a')]};_0x319235[_0x013c('0x67')]=_0x1d375c[_0x013c('0x63')][_0x013c('0x67')];}if(_0x3a3c8b[_0x013c('0x56')][_0x013c('0x6c')]&&_0x3a3c8b[_0x013c('0x56')][_0x013c('0x6c')][_0x013c('0x45')]){for(var _0x54d6b9=0x0;_0x54d6b9<_0x3a3c8b['body']['attachments'][_0x013c('0x45')];_0x54d6b9+=0x1){_0x3a3c8b['body'][_0x013c('0x6c')][_0x54d6b9]={'filename':_0x3a3c8b[_0x013c('0x56')]['attachments'][_0x54d6b9][_0x013c('0x37')],'path':path[_0x013c('0x6d')](config[_0x013c('0x6e')],_0x013c('0x6f'),_0x3a3c8b[_0x013c('0x56')][_0x013c('0x6c')][_0x54d6b9][_0x013c('0x70')])};}}_0xa8036a={'account':_0x319235,'message':_0x3a3c8b[_0x013c('0x56')]};return;}})['then'](function(){if(_0x1d375c['List']){if(_0x1d375c[_0x013c('0x71')][_0x013c('0x72')][_0x013c('0x45')]){return _0x1d375c['List'][_0x013c('0x72')][0x0];}else{return db[_0x013c('0x73')][_0x013c('0x59')](_[_0x013c('0x18')](_0x3a3c8b['body'],{'firstName':_0x3a3c8b[_0x013c('0x56')]['to'],'email':_0x3a3c8b[_0x013c('0x56')]['to'],'phone':_0x3a3c8b['body']['to'],'ListId':_0x1d375c[_0x013c('0x74')]}));}}else{throw new Error(_0x013c('0x75'));}})[_0x013c('0x20')](function(){if(_0xa8036a){return respondWithRpcPromise(_0x013c('0x76'),'sendMail',_0xa8036a,client9003)[_0x013c('0x20')](function(_0x4a307e){return _0x4edae2[_0x013c('0x34')]({'read':!![],'messageId':_0x4a307e['messageId'],'sentAt':moment()[_0x013c('0x77')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x5cccbb){logger[_0x013c('0x25')]('%s',JSON[_0x013c('0x24')](_0x5cccbb));return _0x4edae2;});}return _0x4edae2;});}return _0x4edae2;}})[_0x013c('0x20')](respondWithResult(_0x201adc,0xc9))[_0x013c('0x28')](handleError(_0x201adc,null));};var interaction_log=require(_0x013c('0x13'))(_0x013c('0x78'));exports[_0x013c('0x79')]=function(_0x5a86b6,_0x1bf7b5,_0x1a3442){var _0x2a337e={'agent':{},'channel':'mail'};if(_0x5a86b6[_0x013c('0x56')]['id']){delete _0x5a86b6[_0x013c('0x56')]['id'];}_0x5a86b6[_0x013c('0x56')][_0x013c('0x7a')]=!![];_0x5a86b6[_0x013c('0x56')][_0x013c('0x7b')]=moment()[_0x013c('0x77')](_0x013c('0x7c'));_0x5a86b6[_0x013c('0x56')][_0x013c('0x7d')]=_0x5a86b6[_0x013c('0x56')][_0x013c('0x7d')]||_0x5a86b6[_0x013c('0x7e')]['id'];_0x2a337e[_0x013c('0x7f')]['id']=_0x5a86b6[_0x013c('0x56')][_0x013c('0x7d')];return db[_0x013c('0x3a')][_0x013c('0x55')]({'where':{'id':_0x5a86b6[_0x013c('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x013c('0x73')],'as':_0x013c('0x80')}]})[_0x013c('0x20')](handleEntityNotFound(_0x1bf7b5,null))[_0x013c('0x20')](saveUpdates(_0x5a86b6[_0x013c('0x56')],null))[_0x013c('0x20')](function(_0x52b563){if(_0x52b563){_0x2a337e[_0x013c('0x26')]=_0x52b563['get']({'plain':!![]});return db[_0x013c('0x81')]['find']({'where':{'id':_0x52b563[_0x013c('0x82')]}});}return null;})[_0x013c('0x20')](handleEntityNotFound(_0x1bf7b5,null))['then'](function(_0x3bd59c){if(_0x3bd59c){return _0x3bd59c[_0x013c('0x34')]({'UserId':_0x5a86b6[_0x013c('0x56')][_0x013c('0x7d')],'read1stAt':_['isNil'](_0x3bd59c['read1stAt'])?moment()['format'](_0x013c('0x7c')):undefined});}return null;})[_0x013c('0x20')](function(_0x257eb8){if(_0x257eb8){_0x2a337e[_0x013c('0x83')]=_0x257eb8[_0x013c('0x84')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5a86b6[_0x013c('0x7e')]['id'],_0x5a86b6['user'][_0x013c('0x37')],_0x5a86b6[_0x013c('0x7e')][_0x013c('0x85')],_0x2a337e[_0x013c('0x83')]['id'],_0x5a86b6['body']?JSON[_0x013c('0x24')](_0x5a86b6[_0x013c('0x56')]):_0x013c('0x86'));return respondWithRpcPromise(_0x013c('0x87'),_0x013c('0x88'),_0x2a337e);}return null;})['then'](function(_0x9258a4){return db['CmContact']['describe']()[_0x013c('0x20')](function(_0xb84df2){var _0x5890a8=[];for(var _0x522044=0x0;_0x522044=_0x19784b){_0x437195=_0x19784b;_0x3cfc45=0xc8;}else{_0x3cfc45=0xce;}_0x5d62b7['status'](_0x3cfc45);return _0x5d62b7[_0xe2ac('0x22')](_0xe2ac('0x23'),_0x3dd2ef+'-'+_0x437195+'/'+_0x19784b)[_0xe2ac('0x1f')](_0x3c8999);}return null;};}function patchUpdates(_0xe0a431){return function(_0x180261){try{jsonpatch[_0xe2ac('0x24')](_0x180261,_0xe0a431,!![]);}catch(_0x504ffd){return BPromise[_0xe2ac('0x25')](_0x504ffd);}return _0x180261[_0xe2ac('0x26')]();};}function saveUpdates(_0x4e7597,_0x5e27eb){return function(_0x2f6220){if(_0x2f6220){return _0x2f6220['update'](_0x4e7597)[_0xe2ac('0x27')](function(_0x3310c1){return _0x3310c1;});}return null;};}function removeEntity(_0x55711b,_0x192649){return function(_0x47b950){if(_0x47b950){return _0x47b950[_0xe2ac('0x28')]()[_0xe2ac('0x27')](function(){var _0x1000e6=_0x47b950['get']({'plain':!![]});var _0x2702cd=_0xe2ac('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x2702cd,'resourceId':_0x1000e6['id']}})[_0xe2ac('0x27')](function(){return _0x47b950;});})[_0xe2ac('0x27')](function(){_0x55711b[_0xe2ac('0x1d')](0xcc)[_0xe2ac('0x1e')]();});}};}function handleEntityNotFound(_0x486ee3,_0x2ccd98){return function(_0x5f32e8){if(!_0x5f32e8){_0x486ee3[_0xe2ac('0x1c')](0x194);}return _0x5f32e8;};}function handleError(_0x1d8031,_0x4479d6){_0x4479d6=_0x4479d6||0x1f4;return function(_0xbc6eed){logger[_0xe2ac('0x2a')](_0xbc6eed[_0xe2ac('0x2b')]);if(_0xbc6eed['name']){delete _0xbc6eed[_0xe2ac('0x2c')];}_0x1d8031['status'](_0x4479d6)['send'](_0xbc6eed);};}exports['index']=function(_0x2e4984,_0x298397){var _0x5d25d3={},_0xb07e8a={},_0x3b9938={'count':0x0,'rows':[]};var _0x4e7286=_[_0xe2ac('0x2d')](db[_0xe2ac('0x2e')]['rawAttributes'],function(_0x4b9e5e){return{'name':_0x4b9e5e[_0xe2ac('0x2f')],'type':_0x4b9e5e['type'][_0xe2ac('0x30')]};});_0xb07e8a[_0xe2ac('0x31')]=_[_0xe2ac('0x2d')](_0x4e7286,_0xe2ac('0x2c'));_0xb07e8a[_0xe2ac('0x32')]=_[_0xe2ac('0x33')](_0x2e4984[_0xe2ac('0x32')]);_0xb07e8a[_0xe2ac('0x34')]=_[_0xe2ac('0x35')](_0xb07e8a['model'],_0xb07e8a[_0xe2ac('0x32')]);_0x5d25d3[_0xe2ac('0x36')]=_[_0xe2ac('0x35')](_0xb07e8a[_0xe2ac('0x31')],qs[_0xe2ac('0x37')](_0x2e4984[_0xe2ac('0x32')]['fields']));_0x5d25d3[_0xe2ac('0x36')]=_0x5d25d3['attributes'][_0xe2ac('0x38')]?_0x5d25d3[_0xe2ac('0x36')]:_0xb07e8a[_0xe2ac('0x31')];if(!_0x2e4984[_0xe2ac('0x32')]['hasOwnProperty'](_0xe2ac('0x39'))){_0x5d25d3['limit']=qs['limit'](_0x2e4984['query']['limit']);_0x5d25d3[_0xe2ac('0x20')]=qs[_0xe2ac('0x20')](_0x2e4984['query'][_0xe2ac('0x20')]);}_0x5d25d3[_0xe2ac('0x3a')]=qs[_0xe2ac('0x3b')](_0x2e4984[_0xe2ac('0x32')][_0xe2ac('0x3b')]);_0x5d25d3[_0xe2ac('0x3c')]=qs[_0xe2ac('0x34')](_['pick'](_0x2e4984[_0xe2ac('0x32')],_0xb07e8a['filters']),_0x4e7286);if(_0x2e4984['query'][_0xe2ac('0x3d')]){_0x5d25d3[_0xe2ac('0x3c')]=_[_0xe2ac('0x3e')](_0x5d25d3[_0xe2ac('0x3c')],{'$or':_[_0xe2ac('0x2d')](_0x4e7286,function(_0x3a3c27){if(_0x3a3c27[_0xe2ac('0x3f')]!==_0xe2ac('0x40')){var _0x4aaf77={};_0x4aaf77[_0x3a3c27[_0xe2ac('0x2c')]]={'$like':'%'+_0x2e4984[_0xe2ac('0x32')][_0xe2ac('0x3d')]+'%'};return _0x4aaf77;}})});}_0x5d25d3=_[_0xe2ac('0x3e')]({},_0x5d25d3,_0x2e4984[_0xe2ac('0x41')]);var _0x52fc52={'where':_0x5d25d3[_0xe2ac('0x3c')]};return db[_0xe2ac('0x2e')]['count'](_0x52fc52)['then'](function(_0x3f95fd){_0x3b9938[_0xe2ac('0x21')]=_0x3f95fd;if(_0x2e4984[_0xe2ac('0x32')][_0xe2ac('0x42')]){_0x5d25d3[_0xe2ac('0x43')]=[{'all':!![]}];}return db['MailQueue'][_0xe2ac('0x44')](_0x5d25d3);})['then'](function(_0x13b100){_0x3b9938[_0xe2ac('0x45')]=_0x13b100;return _0x3b9938;})[_0xe2ac('0x27')](respondWithFilteredResult(_0x298397,_0x5d25d3))['catch'](handleError(_0x298397,null));};exports[_0xe2ac('0x46')]=function(_0x35264d,_0x2f3aa6){var _0xbb443a={'raw':!![],'where':{'id':_0x35264d[_0xe2ac('0x47')]['id']}},_0xfef752={};_0xfef752[_0xe2ac('0x31')]=_[_0xe2ac('0x33')](db['MailQueue'][_0xe2ac('0x48')]);_0xfef752['query']=_['keys'](_0x35264d[_0xe2ac('0x32')]);_0xfef752[_0xe2ac('0x34')]=_[_0xe2ac('0x35')](_0xfef752[_0xe2ac('0x31')],_0xfef752[_0xe2ac('0x32')]);_0xbb443a[_0xe2ac('0x36')]=_[_0xe2ac('0x35')](_0xfef752[_0xe2ac('0x31')],qs['fields'](_0x35264d[_0xe2ac('0x32')]['fields']));_0xbb443a[_0xe2ac('0x36')]=_0xbb443a[_0xe2ac('0x36')][_0xe2ac('0x38')]?_0xbb443a[_0xe2ac('0x36')]:_0xfef752[_0xe2ac('0x31')];if(_0x35264d[_0xe2ac('0x32')]['includeAll']){_0xbb443a['include']=[{'all':!![]}];}_0xbb443a=_['merge']({},_0xbb443a,_0x35264d[_0xe2ac('0x41')]);return db[_0xe2ac('0x2e')][_0xe2ac('0x49')](_0xbb443a)[_0xe2ac('0x27')](handleEntityNotFound(_0x2f3aa6,null))[_0xe2ac('0x27')](respondWithResult(_0x2f3aa6,null))['catch'](handleError(_0x2f3aa6,null));};exports['create']=function(_0x75d51e,_0x49cfbe){return db['MailQueue'][_0xe2ac('0x4a')](_0x75d51e[_0xe2ac('0x4b')],{})[_0xe2ac('0x27')](function(_0x1df6e1){var _0x1f8862=_0x75d51e[_0xe2ac('0x4c')][_0xe2ac('0x4d')]({'plain':!![]});if(!_0x1f8862)throw new Error(_0xe2ac('0x4e'));if(_0x1f8862[_0xe2ac('0x4f')]===_0xe2ac('0x4c')){var _0x5c8dd9=_0x1df6e1[_0xe2ac('0x4d')]({'plain':!![]});var _0x1a407f='MailQueues';return db[_0xe2ac('0x50')][_0xe2ac('0x49')]({'where':{'name':_0x1a407f,'userProfileId':_0x1f8862['userProfileId']},'raw':!![]})[_0xe2ac('0x27')](function(_0x60cbf2){if(_0x60cbf2&&_0x60cbf2['autoAssociation']===0x0){return db[_0xe2ac('0x51')][_0xe2ac('0x4a')]({'name':_0x5c8dd9['name'],'resourceId':_0x5c8dd9['id'],'type':_0x60cbf2[_0xe2ac('0x2c')],'sectionId':_0x60cbf2['id']},{})[_0xe2ac('0x27')](function(){return _0x1df6e1;});}else{return _0x1df6e1;}})[_0xe2ac('0x52')](function(_0x3f70a){logger['error'](_0xe2ac('0x53'),_0x3f70a);throw _0x3f70a;});}return _0x1df6e1;})['then'](respondWithResult(_0x49cfbe,0xc9))[_0xe2ac('0x52')](handleError(_0x49cfbe,null));};exports[_0xe2ac('0x54')]=function(_0x4aed54,_0xc50d68){if(_0x4aed54[_0xe2ac('0x4b')]['id']){delete _0x4aed54['body']['id'];}return db[_0xe2ac('0x2e')][_0xe2ac('0x49')]({'where':{'id':_0x4aed54[_0xe2ac('0x47')]['id']}})[_0xe2ac('0x27')](handleEntityNotFound(_0xc50d68,null))[_0xe2ac('0x27')](saveUpdates(_0x4aed54[_0xe2ac('0x4b')],null))['then'](respondWithResult(_0xc50d68,null))[_0xe2ac('0x52')](handleError(_0xc50d68,null));};exports[_0xe2ac('0x28')]=function(_0x3d9be6,_0x1add6e){return db[_0xe2ac('0x2e')][_0xe2ac('0x49')]({'where':{'id':_0x3d9be6[_0xe2ac('0x47')]['id']}})[_0xe2ac('0x27')](handleEntityNotFound(_0x1add6e,null))['then'](removeEntity(_0x1add6e,null))['catch'](handleError(_0x1add6e,null));};exports[_0xe2ac('0x55')]=function(_0x2dfe56,_0x4e2f55){return db[_0xe2ac('0x2e')][_0xe2ac('0x55')]()[_0xe2ac('0x27')](respondWithResult(_0x4e2f55,null))[_0xe2ac('0x52')](handleError(_0x4e2f55,null));};exports['getMembers']=function(_0x4a797a,_0x5533b0,_0xeef37d){var _0x142acf={'raw':!![],'where':{}},_0x1076ab={},_0x15916f;return db[_0xe2ac('0x2e')]['findOne']({'where':{'id':_0x4a797a[_0xe2ac('0x47')]['id']}})[_0xe2ac('0x27')](handleEntityNotFound(_0x5533b0,null))[_0xe2ac('0x27')](function(_0xdd18d){if(_0xdd18d){_0x15916f=_0xdd18d[_0xe2ac('0x4d')]({'plain':!![]});_0x1076ab[_0xe2ac('0x31')]=_[_0xe2ac('0x33')](db[_0xe2ac('0x56')][_0xe2ac('0x48')]);_0x1076ab[_0xe2ac('0x32')]=_['keys'](_0x4a797a[_0xe2ac('0x32')]);_0x1076ab[_0xe2ac('0x34')]=_['intersection'](_0x1076ab['model'],_0x1076ab['query']);_0x142acf[_0xe2ac('0x36')]=_[_0xe2ac('0x35')](_0x1076ab[_0xe2ac('0x31')],qs[_0xe2ac('0x37')](_0x4a797a[_0xe2ac('0x32')][_0xe2ac('0x37')]));_0x142acf[_0xe2ac('0x36')]=_0x142acf['attributes'][_0xe2ac('0x38')]?_0x142acf[_0xe2ac('0x36')]:_0x1076ab['model'];if(!_0x4a797a[_0xe2ac('0x32')][_0xe2ac('0x57')]('nolimit')){_0x142acf[_0xe2ac('0x58')]=qs[_0xe2ac('0x58')](_0x4a797a[_0xe2ac('0x32')][_0xe2ac('0x58')]);_0x142acf[_0xe2ac('0x20')]=qs['offset'](_0x4a797a[_0xe2ac('0x32')][_0xe2ac('0x20')]);}_0x142acf[_0xe2ac('0x3a')]=qs[_0xe2ac('0x3b')](_0x4a797a['query'][_0xe2ac('0x3b')]);_0x142acf[_0xe2ac('0x3c')]=qs[_0xe2ac('0x34')](_['pick'](_0x4a797a[_0xe2ac('0x32')],_0x1076ab[_0xe2ac('0x34')]));_0x142acf[_0xe2ac('0x3c')][_0xe2ac('0x59')]=_0xdd18d['id'];if(_0x4a797a[_0xe2ac('0x32')][_0xe2ac('0x3d')]){_0x142acf[_0xe2ac('0x3c')]=_['merge'](_0x142acf[_0xe2ac('0x3c')],{'$or':_[_0xe2ac('0x2d')](_0x142acf[_0xe2ac('0x36')],function(_0x59ab47){var _0x127c17={};_0x127c17[_0x59ab47]={'$like':'%'+_0x4a797a[_0xe2ac('0x32')]['filter']+'%'};return _0x127c17;})});}_0x142acf=_[_0xe2ac('0x3e')]({},_0x142acf,_0x4a797a['options']);return db['UserMailQueue']['findAll'](_0x142acf);}})[_0xe2ac('0x27')](function(_0x192dd0){if(_0x192dd0){return db['User'][_0xe2ac('0x5a')]({'where':{'id':_['map'](_0x192dd0,_0xe2ac('0x5b')),'role':_0xe2ac('0x5c')},'attributes':['id',_0xe2ac('0x2c'),_0xe2ac('0x5d'),'updatedAt',_0xe2ac('0x5e')]});}})[_0xe2ac('0x27')](function(_0x48fc16){if(_0x48fc16){return{'count':_0x48fc16[_0xe2ac('0x21')],'rows':_[_0xe2ac('0x2d')](_0x48fc16[_0xe2ac('0x45')],function(_0x478a83){return{'membername':_0x478a83[_0xe2ac('0x2c')],'UserId':_0x478a83['id'],'queue_name':_0x15916f['name'],'MailQueueId':_0x15916f['id'],'interface':util['format'](_0xe2ac('0x5f'),_0xe2ac('0x60'),_0x478a83[_0xe2ac('0x2c')]),'penalty':0x0,'paused':_0x478a83['mailPause'],'createdAt':_0x478a83['createdAt'],'updatedAt':_0x478a83['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe2ac('0x27')](respondWithFilteredResult(_0x5533b0,_0x142acf))[_0xe2ac('0x52')](handleError(_0x5533b0,null));};exports[_0xe2ac('0x61')]=function(_0xdb418d,_0x48e8b2,_0x3c0997){var _0x1f7bf2={};var _0x368ce8={};var _0x5f17eb;var _0x115745;return db[_0xe2ac('0x2e')][_0xe2ac('0x62')]({'where':{'id':_0xdb418d[_0xe2ac('0x47')]['id']}})[_0xe2ac('0x27')](handleEntityNotFound(_0x48e8b2,null))[_0xe2ac('0x27')](function(_0xb4c51f){if(_0xb4c51f){_0x5f17eb=_0xb4c51f;_0x368ce8[_0xe2ac('0x31')]=_[_0xe2ac('0x33')](db[_0xe2ac('0x63')]['rawAttributes']);_0x368ce8[_0xe2ac('0x32')]=_[_0xe2ac('0x33')](_0xdb418d[_0xe2ac('0x32')]);_0x368ce8['filters']=_[_0xe2ac('0x35')](_0x368ce8[_0xe2ac('0x31')],_0x368ce8[_0xe2ac('0x32')]);_0x1f7bf2['attributes']=_[_0xe2ac('0x35')](_0x368ce8[_0xe2ac('0x31')],qs[_0xe2ac('0x37')](_0xdb418d[_0xe2ac('0x32')][_0xe2ac('0x37')]));_0x1f7bf2[_0xe2ac('0x36')]=_0x1f7bf2[_0xe2ac('0x36')]['length']?_0x1f7bf2[_0xe2ac('0x36')]:_0x368ce8[_0xe2ac('0x31')];_0x1f7bf2['order']=qs[_0xe2ac('0x3b')](_0xdb418d[_0xe2ac('0x32')][_0xe2ac('0x3b')]);_0x1f7bf2[_0xe2ac('0x3c')]=qs[_0xe2ac('0x34')](_[_0xe2ac('0x64')](_0xdb418d[_0xe2ac('0x32')],_0x368ce8[_0xe2ac('0x34')]));if(_0xdb418d[_0xe2ac('0x32')]['filter']){_0x1f7bf2['where']=_['merge'](_0x1f7bf2['where'],{'$or':_[_0xe2ac('0x2d')](_0x1f7bf2[_0xe2ac('0x36')],function(_0x672d7c){var _0x17fe36={};_0x17fe36[_0x672d7c]={'$like':'%'+_0xdb418d[_0xe2ac('0x32')]['filter']+'%'};return _0x17fe36;})});}_0x1f7bf2=_[_0xe2ac('0x3e')]({},_0x1f7bf2,_0xdb418d['options']);return _0x5f17eb[_0xe2ac('0x61')](_0x1f7bf2);}})[_0xe2ac('0x27')](function(_0x1419c6){if(_0x1419c6){_0x115745=_0x1419c6[_0xe2ac('0x38')];if(!_0xdb418d['query'][_0xe2ac('0x57')]('nolimit')){_0x1f7bf2['limit']=qs[_0xe2ac('0x58')](_0xdb418d[_0xe2ac('0x32')][_0xe2ac('0x58')]);_0x1f7bf2[_0xe2ac('0x20')]=qs[_0xe2ac('0x20')](_0xdb418d[_0xe2ac('0x32')][_0xe2ac('0x20')]);}return _0x5f17eb['getTeams'](_0x1f7bf2);}})[_0xe2ac('0x27')](function(_0x107286){if(_0x107286){return _0x107286?{'count':_0x115745,'rows':_0x107286}:null;}})[_0xe2ac('0x27')](respondWithResult(_0x48e8b2,null))['catch'](handleError(_0x48e8b2,null));};exports[_0xe2ac('0x65')]=function(_0x555df4,_0x367d08,_0x22716c){var _0x4d28d6=_0x555df4['body'][_0xe2ac('0x66')];return db[_0xe2ac('0x63')][_0xe2ac('0x44')]({'where':{'id':_0x4d28d6},'attributes':['id'],'include':[{'model':db[_0xe2ac('0x67')],'as':_0xe2ac('0x68'),'attributes':['id',_0xe2ac('0x2c'),_0xe2ac('0x69'),_0xe2ac('0x6a'),_0xe2ac('0x6b')],'raw':!![]}]})[_0xe2ac('0x27')](function(_0x2813b5){if(_0x2813b5){var _0x739abb=_[_0xe2ac('0x6c')](_0x2813b5,function(_0x4cac40){var _0x57c99e=_0x4cac40[_0xe2ac('0x4d')]({'plain':!![]});return _0x57c99e[_0xe2ac('0x68')];});return db['MailQueue']['find']({'where':{'id':_0x555df4[_0xe2ac('0x47')]['id']}})['then'](function(_0x5076ae){return db[_0xe2ac('0x6d')][_0xe2ac('0x6e')](function(_0x56bce6){return _0x5076ae[_0xe2ac('0x65')](_0x4d28d6,{'transaction':_0x56bce6})[_0xe2ac('0x27')](function(){return BPromise[_0xe2ac('0x6f')](_0x739abb,function(_0x243353){return db[_0xe2ac('0x56')][_0xe2ac('0x70')]({'where':{'UserId':_0x243353['id'],'MailQueueId':_0x555df4['params']['id']},'transaction':_0x56bce6});});})[_0xe2ac('0x27')](function(){_0x739abb[_0xe2ac('0x71')](function(_0x3e139c){socket['emit']('userMailQueue:save',{'UserId':_0x3e139c['id'],'MailQueueId':_0x5076ae['id']});});});});});}})[_0xe2ac('0x27')](respondWithStatusCode(_0x367d08,null))['catch'](handleError(_0x367d08,null));};exports[_0xe2ac('0x72')]=function(_0x1886c8,_0x27931b,_0x7f0d5d){return db['Team']['findAll']({'where':{'id':_0x1886c8[_0xe2ac('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe2ac('0x67')],'as':_0xe2ac('0x68'),'attributes':['id'],'raw':!![]}]})[_0xe2ac('0x27')](handleEntityNotFound(_0x27931b,null))[_0xe2ac('0x27')](function(_0x1b2c37){var _0x5a6fc0=_[_0xe2ac('0x2d')](_0x1b2c37,'id');var _0x426f03=[];var _0x3640ad=[];var _0x3a0e35=squel[_0xe2ac('0x73')]();_0x3a0e35[_0xe2ac('0x74')](_0xe2ac('0x75'))[_0xe2ac('0x76')](_0xe2ac('0x77'),'tq')[_0xe2ac('0x78')](_0xe2ac('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe2ac('0x3c')](_0xe2ac('0x7a'),_0x1886c8[_0xe2ac('0x47')]['id']);for(var _0x160deb=0x0;_0x160deb<_0x1b2c37['length'];_0x160deb+=0x1){let _0x57485b=_0x1b2c37[_0x160deb];for(var _0x49ad2a=0x0;_0x49ad2a<_0x57485b[_0xe2ac('0x68')][_0xe2ac('0x38')];_0x49ad2a+=0x1){let _0xe7e7a2=_0x57485b[_0xe2ac('0x68')][_0x49ad2a];var _0x2fc96d=_0x3a0e35[_0xe2ac('0x7b')]();_0x2fc96d[_0xe2ac('0x3c')](_0xe2ac('0x7c'),_0xe7e7a2['id']);_0x3640ad[_0xe2ac('0x7d')](db['sequelize'][_0xe2ac('0x32')](_0x2fc96d[_0xe2ac('0x7e')](),{'type':db[_0xe2ac('0x6d')][_0xe2ac('0x7f')][_0xe2ac('0x80')]})[_0xe2ac('0x27')](function(_0x21b821){if(_0x21b821[_0xe2ac('0x38')]===0x1){return _0xe7e7a2['id'];}else{var _0x4c4081=_[_0xe2ac('0x81')](_['map'](_0x21b821,'TeamId'),function(_0x244f5d){return _[_0xe2ac('0x82')](_0x5a6fc0,_0x244f5d);});if(_0x4c4081){return _0xe7e7a2['id'];}}}));}}return BPromise[_0xe2ac('0x83')](_0x3640ad)[_0xe2ac('0x27')](function(_0x2e6f41){_0x426f03=_(_0x426f03)['union'](_0x2e6f41)[_0xe2ac('0x84')]()[_0xe2ac('0x85')]();return db[_0xe2ac('0x2e')]['find']({'where':{'id':_0x1886c8['params']['id']}})['then'](function(_0x1b3beb){return db[_0xe2ac('0x6d')][_0xe2ac('0x6e')](function(_0x17c69a){return _0x1b3beb[_0xe2ac('0x72')](_0x1886c8[_0xe2ac('0x32')][_0xe2ac('0x66')],{'transaction':_0x17c69a})['then'](function(){if(!_[_0xe2ac('0x86')](_0x426f03)){return _0x1b3beb['removeAgents'](_0x426f03,{'transaction':_0x17c69a});}})['then'](function(){_0x426f03[_0xe2ac('0x71')](function(_0x5bd1e0){socket['emit'](_0xe2ac('0x87'),{'UserId':_0x5bd1e0,'MailQueueId':_0x1b3beb['id']});});});});});});})['then'](respondWithStatusCode(_0x27931b,null))[_0xe2ac('0x52')](handleError(_0x27931b,null));};exports['addAgents']=function(_0x4a3ee9,_0x242ccd,_0x4bab98){return db[_0xe2ac('0x2e')][_0xe2ac('0x49')]({'where':{'id':_0x4a3ee9[_0xe2ac('0x47')]['id']}})[_0xe2ac('0x27')](handleEntityNotFound(_0x242ccd,null))[_0xe2ac('0x27')](function(_0xe279f6){if(_0xe279f6){return _0xe279f6['addAgents'](_0x4a3ee9[_0xe2ac('0x4b')]['ids'],_[_0xe2ac('0x88')](_0x4a3ee9[_0xe2ac('0x4b')],[_0xe2ac('0x66'),'id'])||{})[_0xe2ac('0x89')](function(_0x7b41d8){for(var _0x483e91=0x0;_0x483e91<_0x4a3ee9['body'][_0xe2ac('0x66')]['length'];_0x483e91+=0x1){socket[_0xe2ac('0x8a')](_0xe2ac('0x8b'),{'UserId':_0x4a3ee9[_0xe2ac('0x4b')][_0xe2ac('0x66')][_0x483e91],'MailQueueId':_0x4a3ee9[_0xe2ac('0x47')]['id']});}return _0x7b41d8;});}})[_0xe2ac('0x27')](respondWithResult(_0x242ccd,null))[_0xe2ac('0x52')](handleError(_0x242ccd,null));};exports[_0xe2ac('0x8c')]=function(_0x4fcba7,_0x1adbef,_0x1e96f7){return db['MailQueue'][_0xe2ac('0x49')]({'where':{'id':_0x4fcba7['params']['id']}})[_0xe2ac('0x27')](handleEntityNotFound(_0x1adbef,null))[_0xe2ac('0x27')](function(_0x16e7b8){if(_0x16e7b8){return _0x16e7b8[_0xe2ac('0x8c')](_0x4fcba7[_0xe2ac('0x32')][_0xe2ac('0x66')])[_0xe2ac('0x27')](function(){if(_['isArray'](_0x4fcba7['query'][_0xe2ac('0x66')])){for(var _0x36a78e=0x0;_0x36a78e<_0x4fcba7[_0xe2ac('0x32')]['ids'][_0xe2ac('0x38')];_0x36a78e+=0x1){socket[_0xe2ac('0x8a')](_0xe2ac('0x87'),{'UserId':Number(_0x4fcba7['query']['ids'][_0x36a78e]),'MailQueueId':Number(_0x4fcba7[_0xe2ac('0x47')]['id'])});}}else{socket[_0xe2ac('0x8a')](_0xe2ac('0x87'),{'UserId':Number(_0x4fcba7['query']['ids']),'MailQueueId':Number(_0x4fcba7[_0xe2ac('0x47')]['id'])});}});}})[_0xe2ac('0x27')](respondWithStatusCode(_0x1adbef,null))['catch'](handleError(_0x1adbef,null));};exports['getAgents']=function(_0x3a7b8d,_0x5d2714,_0x20244c){var _0x5d5dd7={};var _0x1280ea={};var _0x1e50f1;var _0x4c518d;return db['MailQueue']['findOne']({'where':{'id':_0x3a7b8d[_0xe2ac('0x47')]['id']}})[_0xe2ac('0x27')](handleEntityNotFound(_0x5d2714,null))[_0xe2ac('0x27')](function(_0x1a0076){if(_0x1a0076){_0x1e50f1=_0x1a0076;_0x1280ea[_0xe2ac('0x31')]=_['keys'](db['User'][_0xe2ac('0x48')]);_0x1280ea[_0xe2ac('0x32')]=_['keys'](_0x3a7b8d['query']);_0x1280ea[_0xe2ac('0x34')]=_[_0xe2ac('0x35')](_0x1280ea[_0xe2ac('0x31')],_0x1280ea[_0xe2ac('0x32')]);_0x5d5dd7['attributes']=_[_0xe2ac('0x35')](_0x1280ea[_0xe2ac('0x31')],qs[_0xe2ac('0x37')](_0x3a7b8d[_0xe2ac('0x32')]['fields']));_0x5d5dd7[_0xe2ac('0x36')]=_0x5d5dd7[_0xe2ac('0x36')][_0xe2ac('0x38')]?_0x5d5dd7[_0xe2ac('0x36')]:_0x1280ea[_0xe2ac('0x31')];_0x5d5dd7[_0xe2ac('0x3a')]=qs[_0xe2ac('0x3b')](_0x3a7b8d['query'][_0xe2ac('0x3b')]);_0x5d5dd7['where']=qs[_0xe2ac('0x34')](_[_0xe2ac('0x64')](_0x3a7b8d[_0xe2ac('0x32')],_0x1280ea[_0xe2ac('0x34')]));if(_0x3a7b8d[_0xe2ac('0x32')]['filter']){_0x5d5dd7[_0xe2ac('0x3c')]=_[_0xe2ac('0x3e')](_0x5d5dd7[_0xe2ac('0x3c')],{'$or':_[_0xe2ac('0x2d')](_0x5d5dd7[_0xe2ac('0x36')],function(_0x271ae7){var _0x1d5d3c={};_0x1d5d3c[_0x271ae7]={'$like':'%'+_0x3a7b8d['query'][_0xe2ac('0x3d')]+'%'};return _0x1d5d3c;})});}_0x5d5dd7=_[_0xe2ac('0x3e')]({},_0x5d5dd7,_0x3a7b8d[_0xe2ac('0x41')]);return _0x1e50f1[_0xe2ac('0x8d')](_0x5d5dd7);}})['then'](function(_0x36c6c0){if(_0x36c6c0){_0x4c518d=_0x36c6c0[_0xe2ac('0x38')];if(!_0x3a7b8d[_0xe2ac('0x32')]['hasOwnProperty']('nolimit')){_0x5d5dd7[_0xe2ac('0x58')]=qs['limit'](_0x3a7b8d[_0xe2ac('0x32')][_0xe2ac('0x58')]);_0x5d5dd7[_0xe2ac('0x20')]=qs[_0xe2ac('0x20')](_0x3a7b8d[_0xe2ac('0x32')][_0xe2ac('0x20')]);}return _0x1e50f1[_0xe2ac('0x8d')](_0x5d5dd7);}})[_0xe2ac('0x27')](function(_0x32f3b7){if(_0x32f3b7){return _0x32f3b7?{'count':_0x4c518d,'rows':_0x32f3b7}:null;}})['then'](respondWithResult(_0x5d2714,null))['catch'](handleError(_0x5d2714,null));}; \ No newline at end of file +var _0x3b63=['apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','MailQueue','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','MailQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x305bdf,_0x1fd2d7){var _0x4b8c73=function(_0x45289e){while(--_0x45289e){_0x305bdf['push'](_0x305bdf['shift']());}};_0x4b8c73(++_0x1fd2d7);}(_0x3b63,0x18d));var _0x33b6=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x3b63[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x33b6('0x0'));var rimraf=require(_0x33b6('0x1'));var zipdir=require(_0x33b6('0x2'));var jsonpatch=require(_0x33b6('0x3'));var rp=require(_0x33b6('0x4'));var moment=require(_0x33b6('0x5'));var BPromise=require(_0x33b6('0x6'));var Mustache=require(_0x33b6('0x7'));var util=require(_0x33b6('0x8'));var path=require('path');var sox=require(_0x33b6('0x9'));var csv=require(_0x33b6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33b6('0xb'));var _=require('lodash');var squel=require(_0x33b6('0xc'));var crypto=require(_0x33b6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x33b6('0xe'));var toCsv=require(_0x33b6('0xa'));var querystring=require(_0x33b6('0xf'));var Papa=require(_0x33b6('0x10'));var Redis=require(_0x33b6('0x11'));var authService=require(_0x33b6('0x12'));var qs=require(_0x33b6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x33b6('0x14'));var logger=require(_0x33b6('0x15'))(_0x33b6('0x16'));var utils=require(_0x33b6('0x17'));var config=require(_0x33b6('0x18'));var licenseUtil=require(_0x33b6('0x19'));var db=require(_0x33b6('0x1a'))['db'];config[_0x33b6('0x1b')]=_['defaults'](config[_0x33b6('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x33b6('0x1c'))(new Redis(config[_0x33b6('0x1b')]));require(_0x33b6('0x1d'))[_0x33b6('0x1e')](socket);function respondWithStatusCode(_0x3f3b85,_0x82a05d){_0x82a05d=_0x82a05d||0xcc;return function(_0x2b52eb){if(_0x2b52eb){return _0x3f3b85[_0x33b6('0x1f')](_0x82a05d);}return _0x3f3b85[_0x33b6('0x20')](_0x82a05d)[_0x33b6('0x21')]();};}function respondWithResult(_0x331064,_0xde25b0){_0xde25b0=_0xde25b0||0xc8;return function(_0x25919e){if(_0x25919e){return _0x331064[_0x33b6('0x20')](_0xde25b0)[_0x33b6('0x22')](_0x25919e);}};}function respondWithFilteredResult(_0x3166d6,_0x28615d){return function(_0x3eec12){if(_0x3eec12){var _0x3dbf60=typeof _0x28615d[_0x33b6('0x23')]===_0x33b6('0x24')&&typeof _0x28615d[_0x33b6('0x25')]==='undefined';var _0x3514ef=_0x3eec12[_0x33b6('0x26')];var _0x26ca6d=_0x3dbf60?0x0:_0x28615d[_0x33b6('0x23')];var _0x58ea2b=_0x3dbf60?_0x3eec12[_0x33b6('0x26')]:_0x28615d[_0x33b6('0x23')]+_0x28615d[_0x33b6('0x25')];var _0x2ef4bf;if(_0x58ea2b>=_0x3514ef){_0x58ea2b=_0x3514ef;_0x2ef4bf=0xc8;}else{_0x2ef4bf=0xce;}_0x3166d6[_0x33b6('0x20')](_0x2ef4bf);return _0x3166d6[_0x33b6('0x27')](_0x33b6('0x28'),_0x26ca6d+'-'+_0x58ea2b+'/'+_0x3514ef)['json'](_0x3eec12);}return null;};}function patchUpdates(_0x326054){return function(_0x248c23){try{jsonpatch[_0x33b6('0x29')](_0x248c23,_0x326054,!![]);}catch(_0x5d2754){return BPromise[_0x33b6('0x2a')](_0x5d2754);}return _0x248c23['save']();};}function saveUpdates(_0x17b6d8,_0x20705b){return function(_0xe433ef){if(_0xe433ef){return _0xe433ef[_0x33b6('0x2b')](_0x17b6d8)[_0x33b6('0x2c')](function(_0x7b2edb){return _0x7b2edb;});}return null;};}function removeEntity(_0x4f01fe,_0xe2801a){return function(_0x558ca1){if(_0x558ca1){return _0x558ca1[_0x33b6('0x2d')]()['then'](function(){var _0x597897=_0x558ca1[_0x33b6('0x2e')]({'plain':!![]});var _0x326fff='MailQueues';return db[_0x33b6('0x2f')][_0x33b6('0x2d')]({'where':{'type':_0x326fff,'resourceId':_0x597897['id']}})['then'](function(){return _0x558ca1;});})[_0x33b6('0x2c')](function(){_0x4f01fe[_0x33b6('0x20')](0xcc)[_0x33b6('0x21')]();});}};}function handleEntityNotFound(_0x14d2e1,_0x1a112f){return function(_0x169df3){if(!_0x169df3){_0x14d2e1['sendStatus'](0x194);}return _0x169df3;};}function handleError(_0x171a84,_0x493be9){_0x493be9=_0x493be9||0x1f4;return function(_0x4f43be){logger[_0x33b6('0x30')](_0x4f43be[_0x33b6('0x31')]);if(_0x4f43be[_0x33b6('0x32')]){delete _0x4f43be[_0x33b6('0x32')];}_0x171a84[_0x33b6('0x20')](_0x493be9)[_0x33b6('0x33')](_0x4f43be);};}exports['index']=function(_0x4a9c68,_0x51e7e0){var _0x8c84da={},_0x39f68d={},_0x2c1388={'count':0x0,'rows':[]};var _0x3f3ea1=_[_0x33b6('0x34')](db[_0x33b6('0x35')][_0x33b6('0x36')],function(_0xed1d36){return{'name':_0xed1d36[_0x33b6('0x37')],'type':_0xed1d36['type']['key']};});_0x39f68d[_0x33b6('0x38')]=_[_0x33b6('0x34')](_0x3f3ea1,'name');_0x39f68d[_0x33b6('0x39')]=_[_0x33b6('0x3a')](_0x4a9c68[_0x33b6('0x39')]);_0x39f68d[_0x33b6('0x3b')]=_['intersection'](_0x39f68d[_0x33b6('0x38')],_0x39f68d['query']);_0x8c84da[_0x33b6('0x3c')]=_[_0x33b6('0x3d')](_0x39f68d[_0x33b6('0x38')],qs[_0x33b6('0x3e')](_0x4a9c68[_0x33b6('0x39')]['fields']));_0x8c84da[_0x33b6('0x3c')]=_0x8c84da[_0x33b6('0x3c')][_0x33b6('0x3f')]?_0x8c84da['attributes']:_0x39f68d[_0x33b6('0x38')];if(!_0x4a9c68[_0x33b6('0x39')]['hasOwnProperty']('nolimit')){_0x8c84da[_0x33b6('0x25')]=qs[_0x33b6('0x25')](_0x4a9c68[_0x33b6('0x39')][_0x33b6('0x25')]);_0x8c84da[_0x33b6('0x23')]=qs[_0x33b6('0x23')](_0x4a9c68['query'][_0x33b6('0x23')]);}_0x8c84da[_0x33b6('0x40')]=qs[_0x33b6('0x41')](_0x4a9c68[_0x33b6('0x39')][_0x33b6('0x41')]);_0x8c84da[_0x33b6('0x42')]=qs[_0x33b6('0x3b')](_[_0x33b6('0x43')](_0x4a9c68[_0x33b6('0x39')],_0x39f68d[_0x33b6('0x3b')]),_0x3f3ea1);if(_0x4a9c68[_0x33b6('0x39')]['filter']){_0x8c84da[_0x33b6('0x42')]=_[_0x33b6('0x44')](_0x8c84da[_0x33b6('0x42')],{'$or':_[_0x33b6('0x34')](_0x3f3ea1,function(_0x367f00){if(_0x367f00[_0x33b6('0x45')]!==_0x33b6('0x46')){var _0x2d7c0b={};_0x2d7c0b[_0x367f00[_0x33b6('0x32')]]={'$like':'%'+_0x4a9c68[_0x33b6('0x39')][_0x33b6('0x47')]+'%'};return _0x2d7c0b;}})});}_0x8c84da=_[_0x33b6('0x44')]({},_0x8c84da,_0x4a9c68[_0x33b6('0x48')]);var _0x42da3a={'where':_0x8c84da[_0x33b6('0x42')]};return db[_0x33b6('0x35')]['count'](_0x42da3a)[_0x33b6('0x2c')](function(_0x1e8cdf){_0x2c1388[_0x33b6('0x26')]=_0x1e8cdf;if(_0x4a9c68[_0x33b6('0x39')][_0x33b6('0x49')]){_0x8c84da[_0x33b6('0x4a')]=[{'all':!![]}];}return db[_0x33b6('0x35')][_0x33b6('0x4b')](_0x8c84da);})['then'](function(_0x2b466d){_0x2c1388[_0x33b6('0x4c')]=_0x2b466d;return _0x2c1388;})['then'](respondWithFilteredResult(_0x51e7e0,_0x8c84da))[_0x33b6('0x4d')](handleError(_0x51e7e0,null));};exports[_0x33b6('0x4e')]=function(_0x49319b,_0x383264){var _0x36343f={'raw':!![],'where':{'id':_0x49319b[_0x33b6('0x4f')]['id']}},_0x493611={};_0x493611[_0x33b6('0x38')]=_['keys'](db[_0x33b6('0x35')][_0x33b6('0x36')]);_0x493611[_0x33b6('0x39')]=_['keys'](_0x49319b[_0x33b6('0x39')]);_0x493611[_0x33b6('0x3b')]=_[_0x33b6('0x3d')](_0x493611['model'],_0x493611['query']);_0x36343f[_0x33b6('0x3c')]=_['intersection'](_0x493611[_0x33b6('0x38')],qs[_0x33b6('0x3e')](_0x49319b[_0x33b6('0x39')][_0x33b6('0x3e')]));_0x36343f[_0x33b6('0x3c')]=_0x36343f[_0x33b6('0x3c')][_0x33b6('0x3f')]?_0x36343f[_0x33b6('0x3c')]:_0x493611[_0x33b6('0x38')];if(_0x49319b['query'][_0x33b6('0x49')]){_0x36343f['include']=[{'all':!![]}];}_0x36343f=_[_0x33b6('0x44')]({},_0x36343f,_0x49319b[_0x33b6('0x48')]);return db[_0x33b6('0x35')][_0x33b6('0x50')](_0x36343f)[_0x33b6('0x2c')](handleEntityNotFound(_0x383264,null))[_0x33b6('0x2c')](respondWithResult(_0x383264,null))['catch'](handleError(_0x383264,null));};exports[_0x33b6('0x51')]=function(_0x5dfaa6,_0x31daba){return db[_0x33b6('0x35')][_0x33b6('0x51')](_0x5dfaa6['body'],{})['then'](function(_0xdeb27b){var _0x2ea770=_0x5dfaa6['user'][_0x33b6('0x2e')]({'plain':!![]});if(!_0x2ea770)throw new Error(_0x33b6('0x52'));if(_0x2ea770['role']===_0x33b6('0x53')){var _0x4121b1=_0xdeb27b[_0x33b6('0x2e')]({'plain':!![]});var _0x394f86=_0x33b6('0x54');return db[_0x33b6('0x55')][_0x33b6('0x50')]({'where':{'name':_0x394f86,'userProfileId':_0x2ea770['userProfileId']},'raw':!![]})[_0x33b6('0x2c')](function(_0x6adbc){if(_0x6adbc&&_0x6adbc[_0x33b6('0x56')]===0x0){return db[_0x33b6('0x2f')][_0x33b6('0x51')]({'name':_0x4121b1['name'],'resourceId':_0x4121b1['id'],'type':_0x6adbc['name'],'sectionId':_0x6adbc['id']},{})[_0x33b6('0x2c')](function(){return _0xdeb27b;});}else{return _0xdeb27b;}})[_0x33b6('0x4d')](function(_0x307c77){logger[_0x33b6('0x30')](_0x33b6('0x57'),_0x307c77);throw _0x307c77;});}return _0xdeb27b;})[_0x33b6('0x2c')](respondWithResult(_0x31daba,0xc9))[_0x33b6('0x4d')](handleError(_0x31daba,null));};exports[_0x33b6('0x2b')]=function(_0x54607e,_0x5bc04d){if(_0x54607e['body']['id']){delete _0x54607e[_0x33b6('0x58')]['id'];}return db[_0x33b6('0x35')]['find']({'where':{'id':_0x54607e['params']['id']}})[_0x33b6('0x2c')](handleEntityNotFound(_0x5bc04d,null))['then'](saveUpdates(_0x54607e[_0x33b6('0x58')],null))[_0x33b6('0x2c')](respondWithResult(_0x5bc04d,null))['catch'](handleError(_0x5bc04d,null));};exports['destroy']=function(_0x251827,_0x3f3571){return db[_0x33b6('0x35')][_0x33b6('0x50')]({'where':{'id':_0x251827[_0x33b6('0x4f')]['id']}})[_0x33b6('0x2c')](handleEntityNotFound(_0x3f3571,null))[_0x33b6('0x2c')](removeEntity(_0x3f3571,null))[_0x33b6('0x4d')](handleError(_0x3f3571,null));};exports[_0x33b6('0x59')]=function(_0x3f26fa,_0x3b775f){return db[_0x33b6('0x35')][_0x33b6('0x59')]()[_0x33b6('0x2c')](respondWithResult(_0x3b775f,null))[_0x33b6('0x4d')](handleError(_0x3b775f,null));};exports[_0x33b6('0x5a')]=function(_0x5c1b29,_0x469ae1,_0xd01f15){var _0xeb10b2={'raw':!![],'where':{}},_0x3ce882={},_0x3f7e77;return db[_0x33b6('0x35')][_0x33b6('0x5b')]({'where':{'id':_0x5c1b29['params']['id']}})[_0x33b6('0x2c')](handleEntityNotFound(_0x469ae1,null))[_0x33b6('0x2c')](function(_0x41d9bb){if(_0x41d9bb){_0x3f7e77=_0x41d9bb[_0x33b6('0x2e')]({'plain':!![]});_0x3ce882[_0x33b6('0x38')]=_[_0x33b6('0x3a')](db[_0x33b6('0x5c')]['rawAttributes']);_0x3ce882[_0x33b6('0x39')]=_[_0x33b6('0x3a')](_0x5c1b29[_0x33b6('0x39')]);_0x3ce882[_0x33b6('0x3b')]=_[_0x33b6('0x3d')](_0x3ce882[_0x33b6('0x38')],_0x3ce882[_0x33b6('0x39')]);_0xeb10b2[_0x33b6('0x3c')]=_['intersection'](_0x3ce882[_0x33b6('0x38')],qs[_0x33b6('0x3e')](_0x5c1b29['query'][_0x33b6('0x3e')]));_0xeb10b2[_0x33b6('0x3c')]=_0xeb10b2[_0x33b6('0x3c')]['length']?_0xeb10b2['attributes']:_0x3ce882[_0x33b6('0x38')];if(!_0x5c1b29['query'][_0x33b6('0x5d')](_0x33b6('0x5e'))){_0xeb10b2[_0x33b6('0x25')]=qs['limit'](_0x5c1b29[_0x33b6('0x39')]['limit']);_0xeb10b2[_0x33b6('0x23')]=qs[_0x33b6('0x23')](_0x5c1b29[_0x33b6('0x39')][_0x33b6('0x23')]);}_0xeb10b2[_0x33b6('0x40')]=qs[_0x33b6('0x41')](_0x5c1b29[_0x33b6('0x39')][_0x33b6('0x41')]);_0xeb10b2['where']=qs[_0x33b6('0x3b')](_[_0x33b6('0x43')](_0x5c1b29[_0x33b6('0x39')],_0x3ce882[_0x33b6('0x3b')]));_0xeb10b2[_0x33b6('0x42')][_0x33b6('0x5f')]=_0x41d9bb['id'];if(_0x5c1b29[_0x33b6('0x39')][_0x33b6('0x47')]){_0xeb10b2[_0x33b6('0x42')]=_[_0x33b6('0x44')](_0xeb10b2[_0x33b6('0x42')],{'$or':_[_0x33b6('0x34')](_0xeb10b2[_0x33b6('0x3c')],function(_0x17286f){var _0x4936dc={};_0x4936dc[_0x17286f]={'$like':'%'+_0x5c1b29[_0x33b6('0x39')][_0x33b6('0x47')]+'%'};return _0x4936dc;})});}_0xeb10b2=_[_0x33b6('0x44')]({},_0xeb10b2,_0x5c1b29[_0x33b6('0x48')]);return db['UserMailQueue'][_0x33b6('0x4b')](_0xeb10b2);}})['then'](function(_0x2eca26){if(_0x2eca26){return db[_0x33b6('0x60')][_0x33b6('0x61')]({'where':{'id':_[_0x33b6('0x34')](_0x2eca26,_0x33b6('0x62')),'role':_0x33b6('0x63')},'attributes':['id',_0x33b6('0x32'),_0x33b6('0x64'),'updatedAt',_0x33b6('0x65')]});}})[_0x33b6('0x2c')](function(_0x54b55d){if(_0x54b55d){return{'count':_0x54b55d[_0x33b6('0x26')],'rows':_[_0x33b6('0x34')](_0x54b55d['rows'],function(_0x59f1e6){return{'membername':_0x59f1e6['name'],'UserId':_0x59f1e6['id'],'queue_name':_0x3f7e77[_0x33b6('0x32')],'MailQueueId':_0x3f7e77['id'],'interface':util[_0x33b6('0x66')](_0x33b6('0x67'),_0x33b6('0x68'),_0x59f1e6[_0x33b6('0x32')]),'penalty':0x0,'paused':_0x59f1e6[_0x33b6('0x64')],'createdAt':_0x59f1e6[_0x33b6('0x65')],'updatedAt':_0x59f1e6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x33b6('0x2c')](respondWithFilteredResult(_0x469ae1,_0xeb10b2))[_0x33b6('0x4d')](handleError(_0x469ae1,null));};exports['getTeams']=function(_0x312261,_0x11db61,_0x21f4de){var _0x1685ad={};var _0x71ee2a={};var _0x3421f5;var _0x191150;return db[_0x33b6('0x35')][_0x33b6('0x5b')]({'where':{'id':_0x312261['params']['id']}})[_0x33b6('0x2c')](handleEntityNotFound(_0x11db61,null))[_0x33b6('0x2c')](function(_0x4cbd7b){if(_0x4cbd7b){_0x3421f5=_0x4cbd7b;_0x71ee2a[_0x33b6('0x38')]=_[_0x33b6('0x3a')](db[_0x33b6('0x69')][_0x33b6('0x36')]);_0x71ee2a['query']=_[_0x33b6('0x3a')](_0x312261[_0x33b6('0x39')]);_0x71ee2a[_0x33b6('0x3b')]=_['intersection'](_0x71ee2a[_0x33b6('0x38')],_0x71ee2a[_0x33b6('0x39')]);_0x1685ad[_0x33b6('0x3c')]=_[_0x33b6('0x3d')](_0x71ee2a[_0x33b6('0x38')],qs[_0x33b6('0x3e')](_0x312261[_0x33b6('0x39')][_0x33b6('0x3e')]));_0x1685ad[_0x33b6('0x3c')]=_0x1685ad[_0x33b6('0x3c')][_0x33b6('0x3f')]?_0x1685ad[_0x33b6('0x3c')]:_0x71ee2a[_0x33b6('0x38')];_0x1685ad[_0x33b6('0x40')]=qs['sort'](_0x312261['query'][_0x33b6('0x41')]);_0x1685ad['where']=qs[_0x33b6('0x3b')](_[_0x33b6('0x43')](_0x312261[_0x33b6('0x39')],_0x71ee2a[_0x33b6('0x3b')]));if(_0x312261[_0x33b6('0x39')][_0x33b6('0x47')]){_0x1685ad[_0x33b6('0x42')]=_[_0x33b6('0x44')](_0x1685ad[_0x33b6('0x42')],{'$or':_['map'](_0x1685ad[_0x33b6('0x3c')],function(_0xb8e94){var _0x18c5e4={};_0x18c5e4[_0xb8e94]={'$like':'%'+_0x312261[_0x33b6('0x39')]['filter']+'%'};return _0x18c5e4;})});}_0x1685ad=_[_0x33b6('0x44')]({},_0x1685ad,_0x312261[_0x33b6('0x48')]);return _0x3421f5['getTeams'](_0x1685ad);}})[_0x33b6('0x2c')](function(_0x210d44){if(_0x210d44){_0x191150=_0x210d44[_0x33b6('0x3f')];if(!_0x312261[_0x33b6('0x39')][_0x33b6('0x5d')](_0x33b6('0x5e'))){_0x1685ad[_0x33b6('0x25')]=qs[_0x33b6('0x25')](_0x312261[_0x33b6('0x39')][_0x33b6('0x25')]);_0x1685ad['offset']=qs['offset'](_0x312261['query'][_0x33b6('0x23')]);}return _0x3421f5[_0x33b6('0x6a')](_0x1685ad);}})[_0x33b6('0x2c')](function(_0x47a9aa){if(_0x47a9aa){return _0x47a9aa?{'count':_0x191150,'rows':_0x47a9aa}:null;}})[_0x33b6('0x2c')](respondWithResult(_0x11db61,null))[_0x33b6('0x4d')](handleError(_0x11db61,null));};exports[_0x33b6('0x6b')]=function(_0x225083,_0x273755,_0x3db0cf){var _0x508542=_0x225083[_0x33b6('0x58')][_0x33b6('0x6c')];return db['Team'][_0x33b6('0x4b')]({'where':{'id':_0x508542},'attributes':['id'],'include':[{'model':db[_0x33b6('0x60')],'as':_0x33b6('0x6d'),'attributes':['id','name',_0x33b6('0x6e'),_0x33b6('0x6f'),_0x33b6('0x70')],'raw':!![]}]})[_0x33b6('0x2c')](function(_0x54f952){if(_0x54f952){var _0x427f63=_[_0x33b6('0x71')](_0x54f952,function(_0xbbd525){var _0x35ea71=_0xbbd525[_0x33b6('0x2e')]({'plain':!![]});return _0x35ea71[_0x33b6('0x6d')];});return db['MailQueue'][_0x33b6('0x50')]({'where':{'id':_0x225083[_0x33b6('0x4f')]['id']}})[_0x33b6('0x2c')](function(_0x4cda4f){return db[_0x33b6('0x72')][_0x33b6('0x73')](function(_0x4c7b44){return _0x4cda4f[_0x33b6('0x6b')](_0x508542,{'transaction':_0x4c7b44})[_0x33b6('0x2c')](function(){return BPromise[_0x33b6('0x74')](_0x427f63,function(_0x2d8de5){return db['UserMailQueue'][_0x33b6('0x75')]({'where':{'UserId':_0x2d8de5['id'],'MailQueueId':_0x225083[_0x33b6('0x4f')]['id']},'transaction':_0x4c7b44});});})['then'](function(){_0x427f63[_0x33b6('0x76')](function(_0x300930){socket[_0x33b6('0x77')](_0x33b6('0x78'),{'UserId':_0x300930['id'],'MailQueueId':_0x4cda4f['id']});});});});});}})[_0x33b6('0x2c')](respondWithStatusCode(_0x273755,null))[_0x33b6('0x4d')](handleError(_0x273755,null));};exports[_0x33b6('0x79')]=function(_0x698548,_0x178e19,_0x500a2e){return db[_0x33b6('0x69')]['findAll']({'where':{'id':_0x698548['query'][_0x33b6('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x33b6('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x33b6('0x2c')](handleEntityNotFound(_0x178e19,null))['then'](function(_0x266c2a){var _0x3635da=_[_0x33b6('0x34')](_0x266c2a,'id');var _0x2a7006=[];var _0xe83d2a=[];var _0x1178f4=squel[_0x33b6('0x7a')]();_0x1178f4['field'](_0x33b6('0x7b'))['from'](_0x33b6('0x7c'),'tq')[_0x33b6('0x7d')](_0x33b6('0x7e'),'ut',_0x33b6('0x7f'))['where'](_0x33b6('0x80'),_0x698548['params']['id']);for(var _0x3f41ce=0x0;_0x3f41ce<_0x266c2a[_0x33b6('0x3f')];_0x3f41ce+=0x1){let _0x26200d=_0x266c2a[_0x3f41ce];for(var _0x3f2baa=0x0;_0x3f2baa<_0x26200d['Agents']['length'];_0x3f2baa+=0x1){let _0x3dd111=_0x26200d[_0x33b6('0x6d')][_0x3f2baa];var _0x1b9a5d=_0x1178f4[_0x33b6('0x81')]();_0x1b9a5d[_0x33b6('0x42')](_0x33b6('0x82'),_0x3dd111['id']);_0xe83d2a[_0x33b6('0x83')](db['sequelize']['query'](_0x1b9a5d['toString'](),{'type':db[_0x33b6('0x72')][_0x33b6('0x84')]['SELECT']})[_0x33b6('0x2c')](function(_0x2c6c0d){if(_0x2c6c0d[_0x33b6('0x3f')]===0x1){return _0x3dd111['id'];}else{var _0x7a11ec=_[_0x33b6('0x85')](_[_0x33b6('0x34')](_0x2c6c0d,_0x33b6('0x86')),function(_0x1e9b4c){return _[_0x33b6('0x87')](_0x3635da,_0x1e9b4c);});if(_0x7a11ec){return _0x3dd111['id'];}}}));}}return BPromise[_0x33b6('0x88')](_0xe83d2a)[_0x33b6('0x2c')](function(_0x259a50){_0x2a7006=_(_0x2a7006)[_0x33b6('0x89')](_0x259a50)[_0x33b6('0x8a')]()[_0x33b6('0x8b')]();return db[_0x33b6('0x35')][_0x33b6('0x50')]({'where':{'id':_0x698548[_0x33b6('0x4f')]['id']}})[_0x33b6('0x2c')](function(_0x24fdbd){return db[_0x33b6('0x72')][_0x33b6('0x73')](function(_0x4dc0a7){return _0x24fdbd[_0x33b6('0x79')](_0x698548['query']['ids'],{'transaction':_0x4dc0a7})['then'](function(){if(!_[_0x33b6('0x8c')](_0x2a7006)){return _0x24fdbd[_0x33b6('0x8d')](_0x2a7006,{'transaction':_0x4dc0a7});}})[_0x33b6('0x2c')](function(){_0x2a7006['forEach'](function(_0x49e408){socket['emit'](_0x33b6('0x8e'),{'UserId':_0x49e408,'MailQueueId':_0x24fdbd['id']});});});});});});})[_0x33b6('0x2c')](respondWithStatusCode(_0x178e19,null))['catch'](handleError(_0x178e19,null));};exports[_0x33b6('0x8f')]=function(_0x1947a4,_0x4e0468,_0x26d6d2){return db[_0x33b6('0x35')][_0x33b6('0x50')]({'where':{'id':_0x1947a4[_0x33b6('0x4f')]['id']}})[_0x33b6('0x2c')](handleEntityNotFound(_0x4e0468,null))['then'](function(_0x235a94){if(_0x235a94){return _0x235a94[_0x33b6('0x8f')](_0x1947a4[_0x33b6('0x58')]['ids'],_['omit'](_0x1947a4[_0x33b6('0x58')],[_0x33b6('0x6c'),'id'])||{})['spread'](function(_0x20c1cc){for(var _0x38e76c=0x0;_0x38e76c<_0x1947a4[_0x33b6('0x58')][_0x33b6('0x6c')]['length'];_0x38e76c+=0x1){socket['emit'](_0x33b6('0x78'),{'UserId':_0x1947a4[_0x33b6('0x58')][_0x33b6('0x6c')][_0x38e76c],'MailQueueId':_0x1947a4[_0x33b6('0x4f')]['id']});}return _0x20c1cc;});}})[_0x33b6('0x2c')](respondWithResult(_0x4e0468,null))[_0x33b6('0x4d')](handleError(_0x4e0468,null));};exports[_0x33b6('0x8d')]=function(_0x591bab,_0x52252e,_0x14acd5){return db[_0x33b6('0x35')][_0x33b6('0x50')]({'where':{'id':_0x591bab[_0x33b6('0x4f')]['id']}})[_0x33b6('0x2c')](handleEntityNotFound(_0x52252e,null))[_0x33b6('0x2c')](function(_0x294710){if(_0x294710){return _0x294710['removeAgents'](_0x591bab[_0x33b6('0x39')][_0x33b6('0x6c')])[_0x33b6('0x2c')](function(){if(_[_0x33b6('0x90')](_0x591bab[_0x33b6('0x39')]['ids'])){for(var _0xd29b6b=0x0;_0xd29b6b<_0x591bab[_0x33b6('0x39')]['ids'][_0x33b6('0x3f')];_0xd29b6b+=0x1){socket[_0x33b6('0x77')](_0x33b6('0x8e'),{'UserId':Number(_0x591bab[_0x33b6('0x39')][_0x33b6('0x6c')][_0xd29b6b]),'MailQueueId':Number(_0x591bab[_0x33b6('0x4f')]['id'])});}}else{socket[_0x33b6('0x77')](_0x33b6('0x8e'),{'UserId':Number(_0x591bab[_0x33b6('0x39')]['ids']),'MailQueueId':Number(_0x591bab[_0x33b6('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x52252e,null))[_0x33b6('0x4d')](handleError(_0x52252e,null));};exports[_0x33b6('0x91')]=function(_0x55465c,_0x27ad8e,_0x32c573){var _0x2e9412={};var _0x3fee70={};var _0x5d46fa;var _0xe9144d;return db[_0x33b6('0x35')][_0x33b6('0x5b')]({'where':{'id':_0x55465c[_0x33b6('0x4f')]['id']}})[_0x33b6('0x2c')](handleEntityNotFound(_0x27ad8e,null))[_0x33b6('0x2c')](function(_0x4f688a){if(_0x4f688a){_0x5d46fa=_0x4f688a;_0x3fee70['model']=_[_0x33b6('0x3a')](db['User'][_0x33b6('0x36')]);_0x3fee70['query']=_[_0x33b6('0x3a')](_0x55465c['query']);_0x3fee70[_0x33b6('0x3b')]=_[_0x33b6('0x3d')](_0x3fee70[_0x33b6('0x38')],_0x3fee70[_0x33b6('0x39')]);_0x2e9412['attributes']=_['intersection'](_0x3fee70[_0x33b6('0x38')],qs['fields'](_0x55465c[_0x33b6('0x39')][_0x33b6('0x3e')]));_0x2e9412[_0x33b6('0x3c')]=_0x2e9412[_0x33b6('0x3c')][_0x33b6('0x3f')]?_0x2e9412[_0x33b6('0x3c')]:_0x3fee70[_0x33b6('0x38')];_0x2e9412['order']=qs[_0x33b6('0x41')](_0x55465c[_0x33b6('0x39')][_0x33b6('0x41')]);_0x2e9412[_0x33b6('0x42')]=qs['filters'](_[_0x33b6('0x43')](_0x55465c['query'],_0x3fee70[_0x33b6('0x3b')]));if(_0x55465c[_0x33b6('0x39')][_0x33b6('0x47')]){_0x2e9412[_0x33b6('0x42')]=_[_0x33b6('0x44')](_0x2e9412[_0x33b6('0x42')],{'$or':_[_0x33b6('0x34')](_0x2e9412[_0x33b6('0x3c')],function(_0x5c0667){var _0x3c5bed={};_0x3c5bed[_0x5c0667]={'$like':'%'+_0x55465c[_0x33b6('0x39')][_0x33b6('0x47')]+'%'};return _0x3c5bed;})});}_0x2e9412=_[_0x33b6('0x44')]({},_0x2e9412,_0x55465c[_0x33b6('0x48')]);return _0x5d46fa['getAgents'](_0x2e9412);}})['then'](function(_0x14f5eb){if(_0x14f5eb){_0xe9144d=_0x14f5eb[_0x33b6('0x3f')];if(!_0x55465c['query'][_0x33b6('0x5d')]('nolimit')){_0x2e9412['limit']=qs[_0x33b6('0x25')](_0x55465c['query'][_0x33b6('0x25')]);_0x2e9412['offset']=qs[_0x33b6('0x23')](_0x55465c[_0x33b6('0x39')][_0x33b6('0x23')]);}return _0x5d46fa['getAgents'](_0x2e9412);}})[_0x33b6('0x2c')](function(_0x471819){if(_0x471819){return _0x471819?{'count':_0xe9144d,'rows':_0x471819}:null;}})[_0x33b6('0x2c')](respondWithResult(_0x27ad8e,null))[_0x33b6('0x4d')](handleError(_0x27ad8e,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index ed28689..fb90260 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 _0x0f23=['events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4bf98d,_0xbe6c90){var _0x26cf71=function(_0x2ec7a9){while(--_0x2ec7a9){_0x4bf98d['push'](_0x4bf98d['shift']());}};_0x26cf71(++_0xbe6c90);}(_0x0f23,0xa5));var _0x30f2=function(_0x1196bd,_0xba4aea){_0x1196bd=_0x1196bd-0x0;var _0x26014f=_0x0f23[_0x1196bd];return _0x26014f;};'use strict';var EventEmitter=require(_0x30f2('0x0'));var MailQueue=require(_0x30f2('0x1'))['db'][_0x30f2('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x30f2('0x3')](0x0);var events={'afterCreate':_0x30f2('0x4'),'afterUpdate':_0x30f2('0x5'),'afterDestroy':_0x30f2('0x6')};function emitEvent(_0x3cfcdb){return function(_0x57b40f,_0x5694e0,_0x2f3329){MailQueueEvents[_0x30f2('0x7')](_0x3cfcdb+':'+_0x57b40f['id'],_0x57b40f);MailQueueEvents[_0x30f2('0x7')](_0x3cfcdb,_0x57b40f);_0x2f3329(null);};}for(var e in events){if(events[_0x30f2('0x8')](e)){var event=events[e];MailQueue[_0x30f2('0x9')](e,emitEvent(event));}}module[_0x30f2('0xa')]=MailQueueEvents; \ No newline at end of file +var _0xfa3b=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x17abe0,_0x1b8d80){var _0x2c14a1=function(_0x1ec6a2){while(--_0x1ec6a2){_0x17abe0['push'](_0x17abe0['shift']());}};_0x2c14a1(++_0x1b8d80);}(_0xfa3b,0x1b6));var _0xbfa3=function(_0x4f5fbc,_0x74cb4e){_0x4f5fbc=_0x4f5fbc-0x0;var _0x486e0e=_0xfa3b[_0x4f5fbc];return _0x486e0e;};'use strict';var EventEmitter=require(_0xbfa3('0x0'));var MailQueue=require(_0xbfa3('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbfa3('0x2'),'afterDestroy':_0xbfa3('0x3')};function emitEvent(_0x49cd88){return function(_0x5211c4,_0x58327f,_0x5812dd){MailQueueEvents['emit'](_0x49cd88+':'+_0x5211c4['id'],_0x5211c4);MailQueueEvents[_0xbfa3('0x4')](_0x49cd88,_0x5211c4);_0x5812dd(null);};}for(var e in events){if(events[_0xbfa3('0x5')](e)){var event=events[e];MailQueue[_0xbfa3('0x6')](e,emitEvent(event));}}module[_0xbfa3('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 9524236..d934963 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 _0x6539=['rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x540160,_0x24c6b6){var _0x476120=function(_0x28046c){while(--_0x28046c){_0x540160['push'](_0x540160['shift']());}};_0x476120(++_0x24c6b6);}(_0x6539,0x12f));var _0x9653=function(_0x56e0c3,_0x2b5363){_0x56e0c3=_0x56e0c3-0x0;var _0x47e3=_0x6539[_0x56e0c3];return _0x47e3;};'use strict';var _=require('lodash');var util=require(_0x9653('0x0'));var logger=require(_0x9653('0x1'))(_0x9653('0x2'));var moment=require(_0x9653('0x3'));var BPromise=require(_0x9653('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9653('0x5'));var config=require(_0x9653('0x6'));var attributes=require(_0x9653('0x7'));module['exports']=function(_0xa61a4d,_0x1f0896){return _0xa61a4d[_0x9653('0x8')](_0x9653('0x9'),attributes,{'tableName':_0x9653('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01e7=['path','rimraf','./mailQueue.attributes','exports','mail_queues','util','../../config/logger','api','bluebird'];(function(_0x205f68,_0x32c778){var _0x40ec64=function(_0x14657b){while(--_0x14657b){_0x205f68['push'](_0x205f68['shift']());}};_0x40ec64(++_0x32c778);}(_0x01e7,0x17f));var _0x701e=function(_0x59570b,_0x45a610){_0x59570b=_0x59570b-0x0;var _0x367e81=_0x01e7[_0x59570b];return _0x367e81;};'use strict';var _=require('lodash');var util=require(_0x701e('0x0'));var logger=require(_0x701e('0x1'))(_0x701e('0x2'));var moment=require('moment');var BPromise=require(_0x701e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x701e('0x4'));var rimraf=require(_0x701e('0x5'));var config=require('../../config/environment');var attributes=require(_0x701e('0x6'));module[_0x701e('0x7')]=function(_0x374924,_0x10e70d){return _0x374924['define']('MailQueue',attributes,{'tableName':_0x701e('0x8'),'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 a732f68..172a3b7 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 _0x3aa4=['stringify','error','code','message','result','GetMailQueue','MailQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ShowMailQueue','find','where','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x3aa4,0x11c));var _0x43aa=function(_0x385c0d,_0x5c60d9){_0x385c0d=_0x385c0d-0x0;var _0x54d818=_0x3aa4[_0x385c0d];return _0x54d818;};'use strict';var _=require('lodash');var util=require(_0x43aa('0x0'));var moment=require('moment');var BPromise=require(_0x43aa('0x1'));var rs=require(_0x43aa('0x2'));var fs=require('fs');var Redis=require(_0x43aa('0x3'));var db=require(_0x43aa('0x4'))['db'];var utils=require(_0x43aa('0x5'));var logger=require(_0x43aa('0x6'))(_0x43aa('0x7'));var config=require(_0x43aa('0x8'));var jayson=require(_0x43aa('0x9'));var client=jayson[_0x43aa('0xa')][_0x43aa('0xb')]({'port':0x232a});config[_0x43aa('0xc')]=_[_0x43aa('0xd')](config[_0x43aa('0xc')],{'host':_0x43aa('0xe'),'port':0x18eb});var socket=require(_0x43aa('0xf'))(new Redis(config[_0x43aa('0xc')]));require(_0x43aa('0x10'))[_0x43aa('0x11')](socket);function respondWithRpcPromise(_0x26eb77,_0x50c7c6,_0x49c6f5){return new BPromise(function(_0x55b951,_0x1e6b96){return client[_0x43aa('0x12')](_0x26eb77,_0x49c6f5)[_0x43aa('0x13')](function(_0x51549a){logger[_0x43aa('0x14')](_0x43aa('0x15'),_0x50c7c6,_0x43aa('0x16'));logger['debug'](_0x43aa('0x17'),_0x50c7c6,_0x43aa('0x16'),JSON[_0x43aa('0x18')](_0x51549a));if(_0x51549a[_0x43aa('0x19')]){if(_0x51549a[_0x43aa('0x19')][_0x43aa('0x1a')]===0x1f4){logger[_0x43aa('0x19')](_0x43aa('0x15'),_0x50c7c6,_0x51549a[_0x43aa('0x19')][_0x43aa('0x1b')]);return _0x1e6b96(_0x51549a[_0x43aa('0x19')][_0x43aa('0x1b')]);}logger[_0x43aa('0x19')]('MailQueue,\x20%s,\x20%s',_0x50c7c6,_0x51549a[_0x43aa('0x19')][_0x43aa('0x1b')]);return _0x55b951(_0x51549a[_0x43aa('0x19')][_0x43aa('0x1b')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x50c7c6,_0x43aa('0x16'));_0x55b951(_0x51549a[_0x43aa('0x1c')]['message']);}})['catch'](function(_0x9d2791){logger[_0x43aa('0x19')](_0x43aa('0x15'),_0x50c7c6,_0x9d2791);_0x1e6b96(_0x9d2791);});});}exports[_0x43aa('0x1d')]=function(_0x399af5){var _0x5c2a87=this;return new Promise(function(_0x2bd7e4,_0x4314ed){return db[_0x43aa('0x1e')][_0x43aa('0x1f')]({'raw':_0x399af5[_0x43aa('0x20')]?_0x399af5[_0x43aa('0x20')][_0x43aa('0x21')]===undefined?!![]:![]:!![],'where':_0x399af5['options']?_0x399af5[_0x43aa('0x20')]['where']||null:null,'attributes':_0x399af5[_0x43aa('0x20')]?_0x399af5[_0x43aa('0x20')][_0x43aa('0x22')]||null:null,'limit':_0x399af5['options']?_0x399af5[_0x43aa('0x20')][_0x43aa('0x23')]||null:null,'include':_0x399af5[_0x43aa('0x20')]?_0x399af5[_0x43aa('0x20')][_0x43aa('0x24')]?_[_0x43aa('0x25')](_0x399af5[_0x43aa('0x20')][_0x43aa('0x24')],function(_0x119846){return{'model':db[_0x119846['model']],'as':_0x119846['as'],'attributes':_0x119846[_0x43aa('0x22')],'include':_0x119846['include']?_['map'](_0x119846[_0x43aa('0x24')],function(_0x243aa9){return{'model':db[_0x243aa9['model']],'as':_0x243aa9['as'],'attributes':_0x243aa9[_0x43aa('0x22')],'include':_0x243aa9['include']?_[_0x43aa('0x25')](_0x243aa9['include'],function(_0x4e9f27){return{'model':db[_0x4e9f27[_0x43aa('0x26')]],'as':_0x4e9f27['as'],'attributes':_0x4e9f27['attributes']};}):[]};}):[]};}):[]:[]})[_0x43aa('0x13')](function(_0x7dcf8e){logger[_0x43aa('0x14')](_0x43aa('0x1d'),_0x399af5);logger['debug']('GetMailQueue',_0x399af5,JSON[_0x43aa('0x18')](_0x7dcf8e));_0x2bd7e4(_0x7dcf8e);})[_0x43aa('0x27')](function(_0xaa8e1c){logger[_0x43aa('0x19')](_0x43aa('0x1d'),_0xaa8e1c['message'],_0x399af5);_0x4314ed(_0x5c2a87[_0x43aa('0x19')](0x1f4,_0xaa8e1c[_0x43aa('0x1b')]));});});};exports[_0x43aa('0x28')]=function(_0x4fe93e){var _0x12c1e2=this;return new Promise(function(_0x138c10,_0x239d6d){return db[_0x43aa('0x1e')][_0x43aa('0x29')]({'raw':_0x4fe93e[_0x43aa('0x20')]?_0x4fe93e[_0x43aa('0x20')][_0x43aa('0x21')]===undefined?!![]:![]:!![],'where':_0x4fe93e[_0x43aa('0x20')]?_0x4fe93e['options'][_0x43aa('0x2a')]||null:null,'attributes':_0x4fe93e[_0x43aa('0x20')]?_0x4fe93e[_0x43aa('0x20')][_0x43aa('0x22')]||null:null,'include':_0x4fe93e['options']?_0x4fe93e[_0x43aa('0x20')][_0x43aa('0x24')]?_[_0x43aa('0x25')](_0x4fe93e[_0x43aa('0x20')][_0x43aa('0x24')],function(_0x32e7c7){return{'model':db[_0x32e7c7[_0x43aa('0x26')]],'as':_0x32e7c7['as'],'attributes':_0x32e7c7['attributes'],'include':_0x32e7c7['include']?_[_0x43aa('0x25')](_0x32e7c7[_0x43aa('0x24')],function(_0x99f8f6){return{'model':db[_0x99f8f6['model']],'as':_0x99f8f6['as'],'attributes':_0x99f8f6[_0x43aa('0x22')],'include':_0x99f8f6[_0x43aa('0x24')]?_[_0x43aa('0x25')](_0x99f8f6[_0x43aa('0x24')],function(_0x6bb6be){return{'model':db[_0x6bb6be[_0x43aa('0x26')]],'as':_0x6bb6be['as'],'attributes':_0x6bb6be[_0x43aa('0x22')]};}):[]};}):[]};}):[]:[]})[_0x43aa('0x13')](function(_0x9233fc){logger['info'](_0x43aa('0x28'),_0x4fe93e);logger[_0x43aa('0x2b')](_0x43aa('0x28'),_0x4fe93e,JSON[_0x43aa('0x18')](_0x9233fc));_0x138c10(_0x9233fc);})['catch'](function(_0x38777c){logger[_0x43aa('0x19')]('ShowMailQueue',_0x38777c[_0x43aa('0x1b')],_0x4fe93e);_0x239d6d(_0x12c1e2[_0x43aa('0x19')](0x1f4,_0x38777c[_0x43aa('0x1b')]));});});}; \ No newline at end of file +var _0x9c46=['then','info','request\x20sent','debug','stringify','error','MailQueue,\x20%s,\x20%s','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowMailQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','client','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request'];(function(_0x226a83,_0x1eec6d){var _0x363df=function(_0x38ac64){while(--_0x38ac64){_0x226a83['push'](_0x226a83['shift']());}};_0x363df(++_0x1eec6d);}(_0x9c46,0x10b));var _0x69c4=function(_0x101817,_0x222e0b){_0x101817=_0x101817-0x0;var _0x337c30=_0x9c46[_0x101817];return _0x337c30;};'use strict';var _=require(_0x69c4('0x0'));var util=require(_0x69c4('0x1'));var moment=require(_0x69c4('0x2'));var BPromise=require(_0x69c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69c4('0x4'));var db=require(_0x69c4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x69c4('0x6')]['http']({'port':0x232a});config[_0x69c4('0x7')]=_['defaults'](config[_0x69c4('0x7')],{'host':_0x69c4('0x8'),'port':0x18eb});var socket=require(_0x69c4('0x9'))(new Redis(config[_0x69c4('0x7')]));require(_0x69c4('0xa'))[_0x69c4('0xb')](socket);function respondWithRpcPromise(_0x23ca2b,_0x5c867b,_0x3494d0){return new BPromise(function(_0x22c3fd,_0x5ea2ae){return client[_0x69c4('0xc')](_0x23ca2b,_0x3494d0)[_0x69c4('0xd')](function(_0x137597){logger[_0x69c4('0xe')]('MailQueue,\x20%s,\x20%s',_0x5c867b,_0x69c4('0xf'));logger[_0x69c4('0x10')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x5c867b,_0x69c4('0xf'),JSON[_0x69c4('0x11')](_0x137597));if(_0x137597[_0x69c4('0x12')]){if(_0x137597['error']['code']===0x1f4){logger[_0x69c4('0x12')](_0x69c4('0x13'),_0x5c867b,_0x137597[_0x69c4('0x12')][_0x69c4('0x14')]);return _0x5ea2ae(_0x137597[_0x69c4('0x12')][_0x69c4('0x14')]);}logger[_0x69c4('0x12')]('MailQueue,\x20%s,\x20%s',_0x5c867b,_0x137597['error'][_0x69c4('0x14')]);return _0x22c3fd(_0x137597[_0x69c4('0x12')]['message']);}else{logger[_0x69c4('0xe')](_0x69c4('0x13'),_0x5c867b,_0x69c4('0xf'));_0x22c3fd(_0x137597['result'][_0x69c4('0x14')]);}})[_0x69c4('0x15')](function(_0x333b8b){logger[_0x69c4('0x12')](_0x69c4('0x13'),_0x5c867b,_0x333b8b);_0x5ea2ae(_0x333b8b);});});}exports[_0x69c4('0x16')]=function(_0x1aa359){var _0x3cb094=this;return new Promise(function(_0x24d965,_0x1d22fb){return db[_0x69c4('0x17')][_0x69c4('0x18')]({'raw':_0x1aa359['options']?_0x1aa359[_0x69c4('0x19')][_0x69c4('0x1a')]===undefined?!![]:![]:!![],'where':_0x1aa359['options']?_0x1aa359[_0x69c4('0x19')][_0x69c4('0x1b')]||null:null,'attributes':_0x1aa359[_0x69c4('0x19')]?_0x1aa359[_0x69c4('0x19')][_0x69c4('0x1c')]||null:null,'limit':_0x1aa359[_0x69c4('0x19')]?_0x1aa359[_0x69c4('0x19')][_0x69c4('0x1d')]||null:null,'include':_0x1aa359[_0x69c4('0x19')]?_0x1aa359['options']['include']?_['map'](_0x1aa359['options'][_0x69c4('0x1e')],function(_0x323049){return{'model':db[_0x323049[_0x69c4('0x1f')]],'as':_0x323049['as'],'attributes':_0x323049[_0x69c4('0x1c')],'include':_0x323049[_0x69c4('0x1e')]?_['map'](_0x323049['include'],function(_0x465ef2){return{'model':db[_0x465ef2[_0x69c4('0x1f')]],'as':_0x465ef2['as'],'attributes':_0x465ef2[_0x69c4('0x1c')],'include':_0x465ef2[_0x69c4('0x1e')]?_[_0x69c4('0x20')](_0x465ef2[_0x69c4('0x1e')],function(_0x3136c1){return{'model':db[_0x3136c1[_0x69c4('0x1f')]],'as':_0x3136c1['as'],'attributes':_0x3136c1[_0x69c4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x69c4('0xd')](function(_0x5bbc6a){logger[_0x69c4('0xe')](_0x69c4('0x16'),_0x1aa359);logger[_0x69c4('0x10')](_0x69c4('0x16'),_0x1aa359,JSON[_0x69c4('0x11')](_0x5bbc6a));_0x24d965(_0x5bbc6a);})['catch'](function(_0x14caac){logger[_0x69c4('0x12')](_0x69c4('0x16'),_0x14caac[_0x69c4('0x14')],_0x1aa359);_0x1d22fb(_0x3cb094['error'](0x1f4,_0x14caac[_0x69c4('0x14')]));});});};exports[_0x69c4('0x21')]=function(_0x55e398){var _0x375e07=this;return new Promise(function(_0x2fa8e5,_0x24cb6b){return db['MailQueue'][_0x69c4('0x22')]({'raw':_0x55e398[_0x69c4('0x19')]?_0x55e398[_0x69c4('0x19')][_0x69c4('0x1a')]===undefined?!![]:![]:!![],'where':_0x55e398['options']?_0x55e398[_0x69c4('0x19')][_0x69c4('0x1b')]||null:null,'attributes':_0x55e398[_0x69c4('0x19')]?_0x55e398['options'][_0x69c4('0x1c')]||null:null,'include':_0x55e398[_0x69c4('0x19')]?_0x55e398['options'][_0x69c4('0x1e')]?_[_0x69c4('0x20')](_0x55e398[_0x69c4('0x19')][_0x69c4('0x1e')],function(_0x1dddfd){return{'model':db[_0x1dddfd['model']],'as':_0x1dddfd['as'],'attributes':_0x1dddfd[_0x69c4('0x1c')],'include':_0x1dddfd[_0x69c4('0x1e')]?_[_0x69c4('0x20')](_0x1dddfd['include'],function(_0x5a3935){return{'model':db[_0x5a3935[_0x69c4('0x1f')]],'as':_0x5a3935['as'],'attributes':_0x5a3935[_0x69c4('0x1c')],'include':_0x5a3935[_0x69c4('0x1e')]?_[_0x69c4('0x20')](_0x5a3935['include'],function(_0x2ee67e){return{'model':db[_0x2ee67e[_0x69c4('0x1f')]],'as':_0x2ee67e['as'],'attributes':_0x2ee67e[_0x69c4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x69c4('0xd')](function(_0x17ab1e){logger[_0x69c4('0xe')]('ShowMailQueue',_0x55e398);logger[_0x69c4('0x10')]('ShowMailQueue',_0x55e398,JSON[_0x69c4('0x11')](_0x17ab1e));_0x2fa8e5(_0x17ab1e);})[_0x69c4('0x15')](function(_0x38c037){logger[_0x69c4('0x12')](_0x69c4('0x21'),_0x38c037[_0x69c4('0x14')],_0x55e398);_0x24cb6b(_0x375e07[_0x69c4('0x12')](0x1f4,_0x38c037[_0x69c4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 6481142..e89c9b1 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 _0x6bb6=['./mailQueue.events','save','remove','update','emit','removeListener','register','length','mailQueue:'];(function(_0x30f616,_0x46ab4b){var _0x2239c3=function(_0x14d372){while(--_0x14d372){_0x30f616['push'](_0x30f616['shift']());}};_0x2239c3(++_0x46ab4b);}(_0x6bb6,0xd8));var _0x66bb=function(_0x32e84e,_0x3ca72b){_0x32e84e=_0x32e84e-0x0;var _0x3356b8=_0x6bb6[_0x32e84e];return _0x3356b8;};'use strict';var MailQueueEvents=require(_0x66bb('0x0'));var events=[_0x66bb('0x1'),_0x66bb('0x2'),_0x66bb('0x3')];function createListener(_0x7e00ae,_0x359c75){return function(_0x3413d0){_0x359c75[_0x66bb('0x4')](_0x7e00ae,_0x3413d0);};}function removeListener(_0x391560,_0x33f7b3){return function(){MailQueueEvents[_0x66bb('0x5')](_0x391560,_0x33f7b3);};}exports[_0x66bb('0x6')]=function(_0x4db14d){for(var _0x547cca=0x0,_0x24d181=events[_0x66bb('0x7')];_0x547cca<_0x24d181;_0x547cca++){var _0xde7db7=events[_0x547cca];var _0x564c8c=createListener(_0x66bb('0x8')+_0xde7db7,_0x4db14d);MailQueueEvents['on'](_0xde7db7,_0x564c8c);}}; \ No newline at end of file +var _0xccc7=['length','mailQueue:','remove','update','emit','removeListener','register'];(function(_0x3c599d,_0x1395a2){var _0x1d6325=function(_0x540b37){while(--_0x540b37){_0x3c599d['push'](_0x3c599d['shift']());}};_0x1d6325(++_0x1395a2);}(_0xccc7,0x1a6));var _0x7ccc=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xccc7[_0x4dc7b9];return _0x3ab114;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x7ccc('0x0'),_0x7ccc('0x1')];function createListener(_0x484e8c,_0x45da88){return function(_0x46d353){_0x45da88[_0x7ccc('0x2')](_0x484e8c,_0x46d353);};}function removeListener(_0x2aaed0,_0x159310){return function(){MailQueueEvents[_0x7ccc('0x3')](_0x2aaed0,_0x159310);};}exports[_0x7ccc('0x4')]=function(_0x41fdfa){for(var _0x4c925b=0x0,_0x32b5ff=events[_0x7ccc('0x5')];_0x4c925b<_0x32b5ff;_0x4c925b++){var _0x106725=events[_0x4c925b];var _0x2c31ec=createListener(_0x7ccc('0x6')+_0x106725,_0x41fdfa);MailQueueEvents['on'](_0x106725,_0x2c31ec);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 17fcc28..f40cbe8 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 _0x871b=['update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','isAuthenticated','post','create','put','/:id'];(function(_0x133b33,_0x4683ba){var _0xbd298d=function(_0x3a6dc9){while(--_0x3a6dc9){_0x133b33['push'](_0x133b33['shift']());}};_0xbd298d(++_0x4683ba);}(_0x871b,0xe7));var _0xb871=function(_0x2175b9,_0x2ba530){_0x2175b9=_0x2175b9-0x0;var _0x32e195=_0x871b[_0x2175b9];return _0x32e195;};'use strict';var multer=require(_0xb871('0x0'));var util=require(_0xb871('0x1'));var path=require(_0xb871('0x2'));var timeout=require(_0xb871('0x3'));var express=require('express');var router=express[_0xb871('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb871('0x5'));var interaction=require(_0xb871('0x6'));var config=require(_0xb871('0x7'));var controller=require(_0xb871('0x8'));router[_0xb871('0x9')]('/',auth['isAuthenticated'](),controller[_0xb871('0xa')]);router[_0xb871('0x9')]('/describe',auth[_0xb871('0xb')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb871('0xc')]('/',auth['isAuthenticated'](),controller[_0xb871('0xd')]);router[_0xb871('0xe')](_0xb871('0xf'),auth[_0xb871('0xb')](),controller[_0xb871('0x10')]);router['delete'](_0xb871('0xf'),auth[_0xb871('0xb')](),controller[_0xb871('0x11')]);module[_0xb871('0x12')]=router; \ No newline at end of file +var _0x6343=['../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','exports','util','path','connect-timeout','fs-extra'];(function(_0x55611d,_0x4646f0){var _0x2d968a=function(_0x494740){while(--_0x494740){_0x55611d['push'](_0x55611d['shift']());}};_0x2d968a(++_0x4646f0);}(_0x6343,0x1e9));var _0x3634=function(_0x87dd67,_0x2e03c3){_0x87dd67=_0x87dd67-0x0;var _0x2d0086=_0x6343[_0x87dd67];return _0x2d0086;};'use strict';var multer=require('multer');var util=require(_0x3634('0x0'));var path=require(_0x3634('0x1'));var timeout=require(_0x3634('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3634('0x3'));var auth=require(_0x3634('0x4'));var interaction=require(_0x3634('0x5'));var config=require('../../config/environment');var controller=require(_0x3634('0x6'));router[_0x3634('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3634('0x8'),auth[_0x3634('0x9')](),controller[_0x3634('0xa')]);router[_0x3634('0x7')](_0x3634('0xb'),auth[_0x3634('0x9')](),controller[_0x3634('0xc')]);router[_0x3634('0xd')]('/',auth[_0x3634('0x9')](),controller[_0x3634('0xe')]);router[_0x3634('0xf')](_0x3634('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x3634('0x9')](),controller['destroy']);module[_0x3634('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 89f5625..1bcea50 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 _0xbc7e=['STRING','DATE','moment','sequelize'];(function(_0xd843b5,_0x919a41){var _0xe5d88b=function(_0x305d26){while(--_0x305d26){_0xd843b5['push'](_0xd843b5['shift']());}};_0xe5d88b(++_0x919a41);}(_0xbc7e,0x132));var _0xebc7=function(_0x334e39,_0x16f47f){_0x334e39=_0x334e39-0x0;var _0x158b6c=_0xbc7e[_0x334e39];return _0x158b6c;};'use strict';var moment=require(_0xebc7('0x0'));var Sequelize=require(_0xebc7('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xebc7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xebc7('0x2')]},'joinAt':{'type':Sequelize[_0xebc7('0x3')]},'leaveAt':{'type':Sequelize[_0xebc7('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xebc7('0x3')]},'reason':{'type':Sequelize[_0xebc7('0x2')]}}; \ No newline at end of file +var _0x4aa5=['STRING','DATE','sequelize','exports'];(function(_0x154a0a,_0x96977b){var _0x550392=function(_0xf5f946){while(--_0xf5f946){_0x154a0a['push'](_0x154a0a['shift']());}};_0x550392(++_0x96977b);}(_0x4aa5,0xae));var _0x54aa=function(_0x3db3ba,_0x462de6){_0x3db3ba=_0x3db3ba-0x0;var _0xd1a69f=_0x4aa5[_0x3db3ba];return _0xd1a69f;};'use strict';var moment=require('moment');var Sequelize=require(_0x54aa('0x0'));module[_0x54aa('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x54aa('0x2')]},'joinAt':{'type':Sequelize[_0x54aa('0x3')]},'leaveAt':{'type':Sequelize[_0x54aa('0x3')]},'acceptAt':{'type':Sequelize[_0x54aa('0x3')]},'exitAt':{'type':Sequelize[_0x54aa('0x3')]},'reason':{'type':Sequelize[_0x54aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 762e2ff..906ca04 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 _0x4a67=['status','end','json','offset','undefined','limit','count','save','then','destroy','sendStatus','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','keys','include','options','find','create','body','catch','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xcf74b2,_0x440d03){var _0xb99495=function(_0x58a7ff){while(--_0x58a7ff){_0xcf74b2['push'](_0xcf74b2['shift']());}};_0xb99495(++_0x440d03);}(_0x4a67,0x156));var _0x74a6=function(_0x3476f9,_0x5f2e45){_0x3476f9=_0x3476f9-0x0;var _0x522a28=_0x4a67[_0x3476f9];return _0x522a28;};'use strict';var emlformat=require(_0x74a6('0x0'));var rimraf=require(_0x74a6('0x1'));var zipdir=require(_0x74a6('0x2'));var jsonpatch=require(_0x74a6('0x3'));var rp=require('request-promise');var moment=require(_0x74a6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x74a6('0x5'));var util=require(_0x74a6('0x6'));var path=require(_0x74a6('0x7'));var sox=require(_0x74a6('0x8'));var csv=require('to-csv');var ejs=require(_0x74a6('0x9'));var fs=require('fs');var fs_extra=require(_0x74a6('0xa'));var _=require(_0x74a6('0xb'));var squel=require(_0x74a6('0xc'));var crypto=require(_0x74a6('0xd'));var jsforce=require(_0x74a6('0xe'));var deskjs=require(_0x74a6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x74a6('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x74a6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x74a6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74a6('0x13'))('api');var utils=require(_0x74a6('0x14'));var config=require(_0x74a6('0x15'));var licenseUtil=require(_0x74a6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x573de7,_0x58181d){_0x58181d=_0x58181d||0xcc;return function(_0x589fd3){if(_0x589fd3){return _0x573de7['sendStatus'](_0x58181d);}return _0x573de7[_0x74a6('0x17')](_0x58181d)[_0x74a6('0x18')]();};}function respondWithResult(_0x1ea4c5,_0x304653){_0x304653=_0x304653||0xc8;return function(_0x256720){if(_0x256720){return _0x1ea4c5['status'](_0x304653)[_0x74a6('0x19')](_0x256720);}};}function respondWithFilteredResult(_0x1c7057,_0x4e5ea9){return function(_0x14805c){if(_0x14805c){var _0x166044=typeof _0x4e5ea9[_0x74a6('0x1a')]===_0x74a6('0x1b')&&typeof _0x4e5ea9[_0x74a6('0x1c')]===_0x74a6('0x1b');var _0x49e26f=_0x14805c[_0x74a6('0x1d')];var _0x3178c5=_0x166044?0x0:_0x4e5ea9['offset'];var _0xbe9fb4=_0x166044?_0x14805c['count']:_0x4e5ea9['offset']+_0x4e5ea9[_0x74a6('0x1c')];var _0x1e0678;if(_0xbe9fb4>=_0x49e26f){_0xbe9fb4=_0x49e26f;_0x1e0678=0xc8;}else{_0x1e0678=0xce;}_0x1c7057['status'](_0x1e0678);return _0x1c7057['set']('Content-Range',_0x3178c5+'-'+_0xbe9fb4+'/'+_0x49e26f)[_0x74a6('0x19')](_0x14805c);}return null;};}function patchUpdates(_0x980d){return function(_0x3b14ed){try{jsonpatch['apply'](_0x3b14ed,_0x980d,!![]);}catch(_0x39404a){return BPromise['reject'](_0x39404a);}return _0x3b14ed[_0x74a6('0x1e')]();};}function saveUpdates(_0x5c4dec,_0x27b6f7){return function(_0x2435b8){if(_0x2435b8){return _0x2435b8['update'](_0x5c4dec)[_0x74a6('0x1f')](function(_0x419783){return _0x419783;});}return null;};}function removeEntity(_0x49102c,_0x433887){return function(_0x1f04f9){if(_0x1f04f9){return _0x1f04f9[_0x74a6('0x20')]()[_0x74a6('0x1f')](function(){_0x49102c['status'](0xcc)[_0x74a6('0x18')]();});}};}function handleEntityNotFound(_0x7e427c,_0x1fd02b){return function(_0x212b76){if(!_0x212b76){_0x7e427c[_0x74a6('0x21')](0x194);}return _0x212b76;};}function handleError(_0x1702c9,_0x53b6d5){_0x53b6d5=_0x53b6d5||0x1f4;return function(_0x452607){logger[_0x74a6('0x22')](_0x452607['stack']);if(_0x452607[_0x74a6('0x23')]){delete _0x452607['name'];}_0x1702c9[_0x74a6('0x17')](_0x53b6d5)[_0x74a6('0x24')](_0x452607);};}exports[_0x74a6('0x25')]=function(_0x27aa4e,_0x1721d7){var _0x3bffab={},_0x384f54={},_0x109c69={'count':0x0,'rows':[]};var _0x1894aa=_[_0x74a6('0x26')](db[_0x74a6('0x27')][_0x74a6('0x28')],function(_0x5bd67d){return{'name':_0x5bd67d[_0x74a6('0x29')],'type':_0x5bd67d[_0x74a6('0x2a')][_0x74a6('0x2b')]};});_0x384f54[_0x74a6('0x2c')]=_[_0x74a6('0x26')](_0x1894aa,'name');_0x384f54[_0x74a6('0x2d')]=_['keys'](_0x27aa4e[_0x74a6('0x2d')]);_0x384f54[_0x74a6('0x2e')]=_[_0x74a6('0x2f')](_0x384f54[_0x74a6('0x2c')],_0x384f54[_0x74a6('0x2d')]);_0x3bffab[_0x74a6('0x30')]=_[_0x74a6('0x2f')](_0x384f54['model'],qs[_0x74a6('0x31')](_0x27aa4e[_0x74a6('0x2d')][_0x74a6('0x31')]));_0x3bffab[_0x74a6('0x30')]=_0x3bffab[_0x74a6('0x30')]['length']?_0x3bffab[_0x74a6('0x30')]:_0x384f54[_0x74a6('0x2c')];if(!_0x27aa4e['query'][_0x74a6('0x32')](_0x74a6('0x33'))){_0x3bffab[_0x74a6('0x1c')]=qs[_0x74a6('0x1c')](_0x27aa4e['query'][_0x74a6('0x1c')]);_0x3bffab[_0x74a6('0x1a')]=qs['offset'](_0x27aa4e[_0x74a6('0x2d')]['offset']);}_0x3bffab[_0x74a6('0x34')]=qs[_0x74a6('0x35')](_0x27aa4e[_0x74a6('0x2d')]['sort']);_0x3bffab[_0x74a6('0x36')]=qs[_0x74a6('0x2e')](_[_0x74a6('0x37')](_0x27aa4e[_0x74a6('0x2d')],_0x384f54[_0x74a6('0x2e')]),_0x1894aa);if(_0x27aa4e['query'][_0x74a6('0x38')]){_0x3bffab[_0x74a6('0x36')]=_[_0x74a6('0x39')](_0x3bffab[_0x74a6('0x36')],{'$or':_[_0x74a6('0x26')](_0x1894aa,function(_0x332a49){if(_0x332a49[_0x74a6('0x2a')]!==_0x74a6('0x3a')){var _0x2be6fd={};_0x2be6fd[_0x332a49[_0x74a6('0x23')]]={'$like':'%'+_0x27aa4e[_0x74a6('0x2d')][_0x74a6('0x38')]+'%'};return _0x2be6fd;}})});}_0x3bffab=_[_0x74a6('0x39')]({},_0x3bffab,_0x27aa4e['options']);var _0x1e0fef={'where':_0x3bffab[_0x74a6('0x36')]};return db['MailQueueReport'][_0x74a6('0x1d')](_0x1e0fef)[_0x74a6('0x1f')](function(_0x2c2c2d){_0x109c69[_0x74a6('0x1d')]=_0x2c2c2d;if(_0x27aa4e['query'][_0x74a6('0x3b')]){_0x3bffab['include']=[{'all':!![]}];}return db['MailQueueReport'][_0x74a6('0x3c')](_0x3bffab);})[_0x74a6('0x1f')](function(_0x2b4ef9){_0x109c69[_0x74a6('0x3d')]=_0x2b4ef9;return _0x109c69;})['then'](respondWithFilteredResult(_0x1721d7,_0x3bffab))['catch'](handleError(_0x1721d7,null));};exports[_0x74a6('0x3e')]=function(_0x176342,_0x49d77){var _0x3f6fe6={'raw':!![],'where':{'id':_0x176342['params']['id']}},_0x5b0917={};_0x5b0917[_0x74a6('0x2c')]=_['keys'](db['MailQueueReport'][_0x74a6('0x28')]);_0x5b0917[_0x74a6('0x2d')]=_[_0x74a6('0x3f')](_0x176342[_0x74a6('0x2d')]);_0x5b0917[_0x74a6('0x2e')]=_[_0x74a6('0x2f')](_0x5b0917[_0x74a6('0x2c')],_0x5b0917['query']);_0x3f6fe6[_0x74a6('0x30')]=_['intersection'](_0x5b0917[_0x74a6('0x2c')],qs[_0x74a6('0x31')](_0x176342['query'][_0x74a6('0x31')]));_0x3f6fe6['attributes']=_0x3f6fe6[_0x74a6('0x30')]['length']?_0x3f6fe6[_0x74a6('0x30')]:_0x5b0917['model'];if(_0x176342['query'][_0x74a6('0x3b')]){_0x3f6fe6[_0x74a6('0x40')]=[{'all':!![]}];}_0x3f6fe6=_['merge']({},_0x3f6fe6,_0x176342[_0x74a6('0x41')]);return db[_0x74a6('0x27')][_0x74a6('0x42')](_0x3f6fe6)['then'](handleEntityNotFound(_0x49d77,null))[_0x74a6('0x1f')](respondWithResult(_0x49d77,null))['catch'](handleError(_0x49d77,null));};exports[_0x74a6('0x43')]=function(_0x4712b1,_0x3d30a3){return db[_0x74a6('0x27')][_0x74a6('0x43')](_0x4712b1[_0x74a6('0x44')],{})[_0x74a6('0x1f')](respondWithResult(_0x3d30a3,0xc9))[_0x74a6('0x45')](handleError(_0x3d30a3,null));};exports[_0x74a6('0x46')]=function(_0x18d6de,_0x8a964d){if(_0x18d6de['body']['id']){delete _0x18d6de[_0x74a6('0x44')]['id'];}return db['MailQueueReport'][_0x74a6('0x42')]({'where':{'id':_0x18d6de[_0x74a6('0x47')]['id']}})[_0x74a6('0x1f')](handleEntityNotFound(_0x8a964d,null))[_0x74a6('0x1f')](saveUpdates(_0x18d6de[_0x74a6('0x44')],null))['then'](respondWithResult(_0x8a964d,null))[_0x74a6('0x45')](handleError(_0x8a964d,null));};exports[_0x74a6('0x20')]=function(_0x595748,_0x15fc5a){return db[_0x74a6('0x27')][_0x74a6('0x42')]({'where':{'id':_0x595748[_0x74a6('0x47')]['id']}})[_0x74a6('0x1f')](handleEntityNotFound(_0x15fc5a,null))[_0x74a6('0x1f')](removeEntity(_0x15fc5a,null))[_0x74a6('0x45')](handleError(_0x15fc5a,null));};exports[_0x74a6('0x48')]=function(_0x29792b,_0x336b53){return db[_0x74a6('0x27')]['describe']()[_0x74a6('0x1f')](respondWithResult(_0x336b53,null))[_0x74a6('0x45')](handleError(_0x336b53,null));}; \ No newline at end of file +var _0x2ab7=['show','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','MailQueueReport','then','includeAll','include','findAll','rows','catch'];(function(_0x34ca51,_0x183a5b){var _0x25cfb9=function(_0x3c0b1e){while(--_0x3c0b1e){_0x34ca51['push'](_0x34ca51['shift']());}};_0x25cfb9(++_0x183a5b);}(_0x2ab7,0xe4));var _0x72ab=function(_0x56a7c6,_0x62ef87){_0x56a7c6=_0x56a7c6-0x0;var _0x4fef9a=_0x2ab7[_0x56a7c6];return _0x4fef9a;};'use strict';var emlformat=require(_0x72ab('0x0'));var rimraf=require(_0x72ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x72ab('0x3'));var Mustache=require(_0x72ab('0x4'));var util=require(_0x72ab('0x5'));var path=require(_0x72ab('0x6'));var sox=require(_0x72ab('0x7'));var csv=require(_0x72ab('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72ab('0x9'));var _=require(_0x72ab('0xa'));var squel=require('squel');var crypto=require(_0x72ab('0xb'));var jsforce=require(_0x72ab('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x72ab('0x8'));var querystring=require(_0x72ab('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x72ab('0xe'));var qs=require(_0x72ab('0xf'));var as=require(_0x72ab('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72ab('0x11'))(_0x72ab('0x12'));var utils=require('../../config/utils');var config=require(_0x72ab('0x13'));var licenseUtil=require(_0x72ab('0x14'));var db=require(_0x72ab('0x15'))['db'];function respondWithStatusCode(_0x176088,_0x3d3c83){_0x3d3c83=_0x3d3c83||0xcc;return function(_0x434a1b){if(_0x434a1b){return _0x176088[_0x72ab('0x16')](_0x3d3c83);}return _0x176088[_0x72ab('0x17')](_0x3d3c83)['end']();};}function respondWithResult(_0x92b818,_0x46adb2){_0x46adb2=_0x46adb2||0xc8;return function(_0x44b976){if(_0x44b976){return _0x92b818[_0x72ab('0x17')](_0x46adb2)[_0x72ab('0x18')](_0x44b976);}};}function respondWithFilteredResult(_0x4f8923,_0x3a5f89){return function(_0x583bef){if(_0x583bef){var _0x3f6096=typeof _0x3a5f89[_0x72ab('0x19')]===_0x72ab('0x1a')&&typeof _0x3a5f89['limit']===_0x72ab('0x1a');var _0x345efa=_0x583bef['count'];var _0xb6badf=_0x3f6096?0x0:_0x3a5f89[_0x72ab('0x19')];var _0x4a5010=_0x3f6096?_0x583bef[_0x72ab('0x1b')]:_0x3a5f89[_0x72ab('0x19')]+_0x3a5f89[_0x72ab('0x1c')];var _0x242676;if(_0x4a5010>=_0x345efa){_0x4a5010=_0x345efa;_0x242676=0xc8;}else{_0x242676=0xce;}_0x4f8923[_0x72ab('0x17')](_0x242676);return _0x4f8923[_0x72ab('0x1d')]('Content-Range',_0xb6badf+'-'+_0x4a5010+'/'+_0x345efa)[_0x72ab('0x18')](_0x583bef);}return null;};}function patchUpdates(_0x1ff8b8){return function(_0x419407){try{jsonpatch[_0x72ab('0x1e')](_0x419407,_0x1ff8b8,!![]);}catch(_0x1e3afb){return BPromise['reject'](_0x1e3afb);}return _0x419407[_0x72ab('0x1f')]();};}function saveUpdates(_0x1a8563,_0x1b0aa5){return function(_0x4f272a){if(_0x4f272a){return _0x4f272a[_0x72ab('0x20')](_0x1a8563)['then'](function(_0x2a4225){return _0x2a4225;});}return null;};}function removeEntity(_0x3d00cf,_0x3f2817){return function(_0x23109e){if(_0x23109e){return _0x23109e[_0x72ab('0x21')]()['then'](function(){_0x3d00cf[_0x72ab('0x17')](0xcc)[_0x72ab('0x22')]();});}};}function handleEntityNotFound(_0x118bdc,_0x1804bf){return function(_0x47417e){if(!_0x47417e){_0x118bdc['sendStatus'](0x194);}return _0x47417e;};}function handleError(_0x19a9d4,_0x19e73d){_0x19e73d=_0x19e73d||0x1f4;return function(_0x3def81){logger[_0x72ab('0x23')](_0x3def81[_0x72ab('0x24')]);if(_0x3def81[_0x72ab('0x25')]){delete _0x3def81[_0x72ab('0x25')];}_0x19a9d4[_0x72ab('0x17')](_0x19e73d)[_0x72ab('0x26')](_0x3def81);};}exports[_0x72ab('0x27')]=function(_0x27573b,_0x5a65ed){var _0x3ecf4a={},_0x260ff9={},_0x426907={'count':0x0,'rows':[]};var _0x4d0655=_[_0x72ab('0x28')](db['MailQueueReport'][_0x72ab('0x29')],function(_0x543bad){return{'name':_0x543bad[_0x72ab('0x2a')],'type':_0x543bad[_0x72ab('0x2b')][_0x72ab('0x2c')]};});_0x260ff9['model']=_[_0x72ab('0x28')](_0x4d0655,_0x72ab('0x25'));_0x260ff9[_0x72ab('0x2d')]=_[_0x72ab('0x2e')](_0x27573b[_0x72ab('0x2d')]);_0x260ff9[_0x72ab('0x2f')]=_[_0x72ab('0x30')](_0x260ff9[_0x72ab('0x31')],_0x260ff9[_0x72ab('0x2d')]);_0x3ecf4a[_0x72ab('0x32')]=_[_0x72ab('0x30')](_0x260ff9[_0x72ab('0x31')],qs[_0x72ab('0x33')](_0x27573b['query'][_0x72ab('0x33')]));_0x3ecf4a[_0x72ab('0x32')]=_0x3ecf4a[_0x72ab('0x32')]['length']?_0x3ecf4a[_0x72ab('0x32')]:_0x260ff9[_0x72ab('0x31')];if(!_0x27573b[_0x72ab('0x2d')][_0x72ab('0x34')](_0x72ab('0x35'))){_0x3ecf4a['limit']=qs['limit'](_0x27573b[_0x72ab('0x2d')]['limit']);_0x3ecf4a[_0x72ab('0x19')]=qs[_0x72ab('0x19')](_0x27573b['query'][_0x72ab('0x19')]);}_0x3ecf4a[_0x72ab('0x36')]=qs[_0x72ab('0x37')](_0x27573b[_0x72ab('0x2d')][_0x72ab('0x37')]);_0x3ecf4a[_0x72ab('0x38')]=qs[_0x72ab('0x2f')](_[_0x72ab('0x39')](_0x27573b[_0x72ab('0x2d')],_0x260ff9[_0x72ab('0x2f')]),_0x4d0655);if(_0x27573b[_0x72ab('0x2d')][_0x72ab('0x3a')]){_0x3ecf4a[_0x72ab('0x38')]=_[_0x72ab('0x3b')](_0x3ecf4a[_0x72ab('0x38')],{'$or':_[_0x72ab('0x28')](_0x4d0655,function(_0x3f8e38){if(_0x3f8e38[_0x72ab('0x2b')]!=='VIRTUAL'){var _0x597554={};_0x597554[_0x3f8e38[_0x72ab('0x25')]]={'$like':'%'+_0x27573b[_0x72ab('0x2d')][_0x72ab('0x3a')]+'%'};return _0x597554;}})});}_0x3ecf4a=_[_0x72ab('0x3b')]({},_0x3ecf4a,_0x27573b[_0x72ab('0x3c')]);var _0x500043={'where':_0x3ecf4a['where']};return db[_0x72ab('0x3d')]['count'](_0x500043)[_0x72ab('0x3e')](function(_0x435c10){_0x426907[_0x72ab('0x1b')]=_0x435c10;if(_0x27573b[_0x72ab('0x2d')][_0x72ab('0x3f')]){_0x3ecf4a[_0x72ab('0x40')]=[{'all':!![]}];}return db[_0x72ab('0x3d')][_0x72ab('0x41')](_0x3ecf4a);})[_0x72ab('0x3e')](function(_0x49b060){_0x426907[_0x72ab('0x42')]=_0x49b060;return _0x426907;})['then'](respondWithFilteredResult(_0x5a65ed,_0x3ecf4a))[_0x72ab('0x43')](handleError(_0x5a65ed,null));};exports[_0x72ab('0x44')]=function(_0x3bf1a2,_0x31f2f7){var _0x57733a={'raw':!![],'where':{'id':_0x3bf1a2[_0x72ab('0x45')]['id']}},_0x1f5d07={};_0x1f5d07[_0x72ab('0x31')]=_[_0x72ab('0x2e')](db[_0x72ab('0x3d')][_0x72ab('0x29')]);_0x1f5d07['query']=_[_0x72ab('0x2e')](_0x3bf1a2[_0x72ab('0x2d')]);_0x1f5d07[_0x72ab('0x2f')]=_[_0x72ab('0x30')](_0x1f5d07[_0x72ab('0x31')],_0x1f5d07[_0x72ab('0x2d')]);_0x57733a[_0x72ab('0x32')]=_[_0x72ab('0x30')](_0x1f5d07[_0x72ab('0x31')],qs[_0x72ab('0x33')](_0x3bf1a2['query'][_0x72ab('0x33')]));_0x57733a[_0x72ab('0x32')]=_0x57733a[_0x72ab('0x32')]['length']?_0x57733a[_0x72ab('0x32')]:_0x1f5d07[_0x72ab('0x31')];if(_0x3bf1a2[_0x72ab('0x2d')][_0x72ab('0x3f')]){_0x57733a[_0x72ab('0x40')]=[{'all':!![]}];}_0x57733a=_[_0x72ab('0x3b')]({},_0x57733a,_0x3bf1a2[_0x72ab('0x3c')]);return db[_0x72ab('0x3d')]['find'](_0x57733a)[_0x72ab('0x3e')](handleEntityNotFound(_0x31f2f7,null))[_0x72ab('0x3e')](respondWithResult(_0x31f2f7,null))[_0x72ab('0x43')](handleError(_0x31f2f7,null));};exports[_0x72ab('0x46')]=function(_0x4149ab,_0x37ff72){return db[_0x72ab('0x3d')][_0x72ab('0x46')](_0x4149ab[_0x72ab('0x47')],{})[_0x72ab('0x3e')](respondWithResult(_0x37ff72,0xc9))['catch'](handleError(_0x37ff72,null));};exports[_0x72ab('0x20')]=function(_0x1f7b81,_0x541173){if(_0x1f7b81[_0x72ab('0x47')]['id']){delete _0x1f7b81[_0x72ab('0x47')]['id'];}return db[_0x72ab('0x3d')][_0x72ab('0x48')]({'where':{'id':_0x1f7b81['params']['id']}})[_0x72ab('0x3e')](handleEntityNotFound(_0x541173,null))[_0x72ab('0x3e')](saveUpdates(_0x1f7b81[_0x72ab('0x47')],null))[_0x72ab('0x3e')](respondWithResult(_0x541173,null))['catch'](handleError(_0x541173,null));};exports[_0x72ab('0x21')]=function(_0x272f45,_0x84cb2){return db[_0x72ab('0x3d')][_0x72ab('0x48')]({'where':{'id':_0x272f45[_0x72ab('0x45')]['id']}})[_0x72ab('0x3e')](handleEntityNotFound(_0x84cb2,null))[_0x72ab('0x3e')](removeEntity(_0x84cb2,null))['catch'](handleError(_0x84cb2,null));};exports[_0x72ab('0x49')]=function(_0x5b16e2,_0x2aff93){return db[_0x72ab('0x3d')][_0x72ab('0x49')]()[_0x72ab('0x3e')](respondWithResult(_0x2aff93,null))[_0x72ab('0x43')](handleError(_0x2aff93,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 6c74d2c..0607513 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 _0x88eb=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1a2e7e,_0x3f00ad){var _0xcec975=function(_0x127b93){while(--_0x127b93){_0x1a2e7e['push'](_0x1a2e7e['shift']());}};_0xcec975(++_0x3f00ad);}(_0x88eb,0x76));var _0xb88e=function(_0x5e8d29,_0x18cb79){_0x5e8d29=_0x5e8d29-0x0;var _0x28596f=_0x88eb[_0x5e8d29];return _0x28596f;};'use strict';var _=require(_0xb88e('0x0'));var util=require(_0xb88e('0x1'));var logger=require(_0xb88e('0x2'))('api');var moment=require(_0xb88e('0x3'));var BPromise=require('bluebird');var rp=require(_0xb88e('0x4'));var fs=require('fs');var path=require(_0xb88e('0x5'));var rimraf=require(_0xb88e('0x6'));var config=require(_0xb88e('0x7'));var attributes=require(_0xb88e('0x8'));module[_0xb88e('0x9')]=function(_0x442da8,_0x14854b){return _0x442da8[_0xb88e('0xa')](_0xb88e('0xb'),attributes,{'tableName':_0xb88e('0xc'),'paranoid':![],'indexes':[{'name':_0xb88e('0xd'),'fields':[_0xb88e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xef3c=['./mailQueueReport.attributes','define','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xef3c,0x1b1));var _0xcef3=function(_0xd49b1,_0x26673b){_0xd49b1=_0xd49b1-0x0;var _0x4d13a7=_0xef3c[_0xd49b1];return _0x4d13a7;};'use strict';var _=require(_0xcef3('0x0'));var util=require(_0xcef3('0x1'));var logger=require(_0xcef3('0x2'))('api');var moment=require(_0xcef3('0x3'));var BPromise=require(_0xcef3('0x4'));var rp=require(_0xcef3('0x5'));var fs=require('fs');var path=require(_0xcef3('0x6'));var rimraf=require(_0xcef3('0x7'));var config=require(_0xcef3('0x8'));var attributes=require(_0xcef3('0x9'));module['exports']=function(_0x18e02c,_0x46b2d8){return _0x18e02c[_0xcef3('0xa')]('MailQueueReport',attributes,{'tableName':_0xcef3('0xb'),'paranoid':![],'indexes':[{'name':_0xcef3('0xc'),'fields':[_0xcef3('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 94c2e7b..1d23ceb 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 _0x73a1=['where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','then','UpdateMailQueueReport','update'];(function(_0xfcf298,_0x58f46e){var _0x4174b8=function(_0x37c5b5){while(--_0x37c5b5){_0xfcf298['push'](_0xfcf298['shift']());}};_0x4174b8(++_0x58f46e);}(_0x73a1,0xf1));var _0x173a=function(_0x143565,_0x54d887){_0x143565=_0x143565-0x0;var _0x4dc1d9=_0x73a1[_0x143565];return _0x4dc1d9;};'use strict';var _=require(_0x173a('0x0'));var util=require('util');var moment=require(_0x173a('0x1'));var BPromise=require('bluebird');var rs=require(_0x173a('0x2'));var fs=require('fs');var Redis=require(_0x173a('0x3'));var db=require(_0x173a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x173a('0x5'))(_0x173a('0x6'));var config=require(_0x173a('0x7'));var jayson=require(_0x173a('0x8'));var client=jayson[_0x173a('0x9')][_0x173a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57db2b,_0x36b42b,_0x3ff1c2){return new BPromise(function(_0x30cd06,_0x3185dd){return client['request'](_0x57db2b,_0x3ff1c2)['then'](function(_0x519e9a){logger[_0x173a('0xb')](_0x173a('0xc'),_0x36b42b,'request\x20sent');logger[_0x173a('0xd')](_0x173a('0xe'),_0x36b42b,_0x173a('0xf'),JSON[_0x173a('0x10')](_0x519e9a));if(_0x519e9a[_0x173a('0x11')]){if(_0x519e9a[_0x173a('0x11')][_0x173a('0x12')]===0x1f4){logger[_0x173a('0x11')](_0x173a('0xc'),_0x36b42b,_0x519e9a[_0x173a('0x11')][_0x173a('0x13')]);return _0x3185dd(_0x519e9a[_0x173a('0x11')]['message']);}logger[_0x173a('0x11')](_0x173a('0xc'),_0x36b42b,_0x519e9a[_0x173a('0x11')][_0x173a('0x13')]);return _0x30cd06(_0x519e9a[_0x173a('0x11')][_0x173a('0x13')]);}else{logger['info'](_0x173a('0xc'),_0x36b42b,'request\x20sent');_0x30cd06(_0x519e9a[_0x173a('0x14')][_0x173a('0x13')]);}})[_0x173a('0x15')](function(_0x1bb1ee){logger['error'](_0x173a('0xc'),_0x36b42b,_0x1bb1ee);_0x3185dd(_0x1bb1ee);});});}exports[_0x173a('0x16')]=function(_0x131172){var _0x15de53=this;return new Promise(function(_0x3e1e6d,_0x4beebc){return db[_0x173a('0x17')][_0x173a('0x18')](_0x131172[_0x173a('0x19')],{'raw':_0x131172[_0x173a('0x1a')]?_0x131172[_0x173a('0x1a')][_0x173a('0x1b')]===undefined?!![]:![]:!![]})[_0x173a('0x1c')](function(_0x124c9d){logger[_0x173a('0xb')](_0x173a('0x16'),_0x131172);logger[_0x173a('0xd')](_0x173a('0x16'),_0x131172,JSON[_0x173a('0x10')](_0x124c9d));_0x3e1e6d(_0x124c9d);})[_0x173a('0x15')](function(_0x531363){logger[_0x173a('0x11')](_0x173a('0x16'),_0x531363[_0x173a('0x13')],_0x131172);_0x4beebc(_0x15de53[_0x173a('0x11')](0x1f4,_0x531363[_0x173a('0x13')]));});});};exports[_0x173a('0x1d')]=function(_0x18b732){var _0x2e06b8=this;return new Promise(function(_0x15bfd5,_0x41e990){return db[_0x173a('0x17')][_0x173a('0x1e')](_0x18b732['body'],{'raw':_0x18b732[_0x173a('0x1a')]?_0x18b732[_0x173a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18b732[_0x173a('0x1a')]?_0x18b732[_0x173a('0x1a')][_0x173a('0x1f')]||null:null,'attributes':_0x18b732[_0x173a('0x1a')]?_0x18b732[_0x173a('0x1a')][_0x173a('0x20')]||null:null,'limit':_0x18b732['options']?_0x18b732[_0x173a('0x1a')][_0x173a('0x21')]||null:null})['then'](function(_0x13d6fc){logger['info'](_0x173a('0x1d'),_0x18b732);logger[_0x173a('0xd')](_0x173a('0x1d'),_0x18b732,JSON[_0x173a('0x10')](_0x13d6fc));_0x15bfd5(_0x13d6fc);})[_0x173a('0x15')](function(_0x4e147d){logger['error'](_0x173a('0x1d'),_0x4e147d['message'],_0x18b732);_0x41e990(_0x2e06b8['error'](0x1f4,_0x4e147d['message']));});});}; \ No newline at end of file +var _0xca9d=['client','http','request','then','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateMailQueueReport','create','body','options','raw','UpdateMailQueueReport','MailQueueReport','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x41d551,_0x16c3e2){var _0x1aa1ec=function(_0x511563){while(--_0x511563){_0x41d551['push'](_0x41d551['shift']());}};_0x1aa1ec(++_0x16c3e2);}(_0xca9d,0xde));var _0xdca9=function(_0x4d9cce,_0x1b76c2){_0x4d9cce=_0x4d9cce-0x0;var _0x3d971b=_0xca9d[_0x4d9cce];return _0x3d971b;};'use strict';var _=require(_0xdca9('0x0'));var util=require(_0xdca9('0x1'));var moment=require('moment');var BPromise=require(_0xdca9('0x2'));var rs=require(_0xdca9('0x3'));var fs=require('fs');var Redis=require(_0xdca9('0x4'));var db=require(_0xdca9('0x5'))['db'];var utils=require(_0xdca9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xdca9('0x7'));var jayson=require(_0xdca9('0x8'));var client=jayson[_0xdca9('0x9')][_0xdca9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e5c93,_0x35e650,_0x264d43){return new BPromise(function(_0x5190b0,_0x29bf4f){return client[_0xdca9('0xb')](_0x4e5c93,_0x264d43)[_0xdca9('0xc')](function(_0x4e5c2a){logger['info'](_0xdca9('0xd'),_0x35e650,'request\x20sent');logger[_0xdca9('0xe')](_0xdca9('0xf'),_0x35e650,_0xdca9('0x10'),JSON[_0xdca9('0x11')](_0x4e5c2a));if(_0x4e5c2a[_0xdca9('0x12')]){if(_0x4e5c2a[_0xdca9('0x12')][_0xdca9('0x13')]===0x1f4){logger[_0xdca9('0x12')](_0xdca9('0xd'),_0x35e650,_0x4e5c2a[_0xdca9('0x12')][_0xdca9('0x14')]);return _0x29bf4f(_0x4e5c2a['error'][_0xdca9('0x14')]);}logger[_0xdca9('0x12')]('MailQueueReport,\x20%s,\x20%s',_0x35e650,_0x4e5c2a[_0xdca9('0x12')][_0xdca9('0x14')]);return _0x5190b0(_0x4e5c2a[_0xdca9('0x12')]['message']);}else{logger[_0xdca9('0x15')](_0xdca9('0xd'),_0x35e650,_0xdca9('0x10'));_0x5190b0(_0x4e5c2a[_0xdca9('0x16')][_0xdca9('0x14')]);}})[_0xdca9('0x17')](function(_0x2215ab){logger[_0xdca9('0x12')]('MailQueueReport,\x20%s,\x20%s',_0x35e650,_0x2215ab);_0x29bf4f(_0x2215ab);});});}exports[_0xdca9('0x18')]=function(_0x1d7b98){var _0x1046ff=this;return new Promise(function(_0x7aa05c,_0x1a3e60){return db['MailQueueReport'][_0xdca9('0x19')](_0x1d7b98[_0xdca9('0x1a')],{'raw':_0x1d7b98['options']?_0x1d7b98[_0xdca9('0x1b')][_0xdca9('0x1c')]===undefined?!![]:![]:!![]})[_0xdca9('0xc')](function(_0x1f3f31){logger[_0xdca9('0x15')](_0xdca9('0x18'),_0x1d7b98);logger[_0xdca9('0xe')](_0xdca9('0x18'),_0x1d7b98,JSON[_0xdca9('0x11')](_0x1f3f31));_0x7aa05c(_0x1f3f31);})[_0xdca9('0x17')](function(_0x11d190){logger[_0xdca9('0x12')](_0xdca9('0x18'),_0x11d190[_0xdca9('0x14')],_0x1d7b98);_0x1a3e60(_0x1046ff['error'](0x1f4,_0x11d190[_0xdca9('0x14')]));});});};exports[_0xdca9('0x1d')]=function(_0x6da88d){var _0x1df2e7=this;return new Promise(function(_0x2c170f,_0x40b68d){return db[_0xdca9('0x1e')]['update'](_0x6da88d[_0xdca9('0x1a')],{'raw':_0x6da88d['options']?_0x6da88d[_0xdca9('0x1b')][_0xdca9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6da88d['options']?_0x6da88d[_0xdca9('0x1b')][_0xdca9('0x1f')]||null:null,'attributes':_0x6da88d[_0xdca9('0x1b')]?_0x6da88d[_0xdca9('0x1b')][_0xdca9('0x20')]||null:null,'limit':_0x6da88d['options']?_0x6da88d['options']['limit']||null:null})['then'](function(_0x5c80fc){logger[_0xdca9('0x15')](_0xdca9('0x1d'),_0x6da88d);logger['debug']('UpdateMailQueueReport',_0x6da88d,JSON[_0xdca9('0x11')](_0x5c80fc));_0x2c170f(_0x5c80fc);})['catch'](function(_0x20eab6){logger[_0xdca9('0x12')](_0xdca9('0x1d'),_0x20eab6[_0xdca9('0x14')],_0x6da88d);_0x40b68d(_0x1df2e7[_0xdca9('0x12')](0x1f4,_0x20eab6[_0xdca9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 4300528..fc3c6dc 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 _0xab40=['../../components/interaction/service','../../config/environment','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xab40,0xcd));var _0x0ab4=function(_0x1deed5,_0x435653){_0x1deed5=_0x1deed5-0x0;var _0x10d389=_0xab40[_0x1deed5];return _0x10d389;};'use strict';var multer=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ab4('0x2')]();var fs_extra=require(_0x0ab4('0x3'));var auth=require(_0x0ab4('0x4'));var interaction=require(_0x0ab4('0x5'));var config=require(_0x0ab4('0x6'));module['exports']=router; \ No newline at end of file +var _0x235b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports','multer','connect-timeout','express'];(function(_0x416333,_0x103db0){var _0x24d9c5=function(_0x1d73f2){while(--_0x1d73f2){_0x416333['push'](_0x416333['shift']());}};_0x24d9c5(++_0x103db0);}(_0x235b,0x1ed));var _0xb235=function(_0x473c78,_0x5d5b07){_0x473c78=_0x473c78-0x0;var _0x4b2d31=_0x235b[_0x473c78];return _0x4b2d31;};'use strict';var multer=require(_0xb235('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb235('0x1'));var express=require(_0xb235('0x2'));var router=express[_0xb235('0x3')]();var fs_extra=require(_0xb235('0x4'));var auth=require(_0xb235('0x5'));var interaction=require(_0xb235('0x6'));var config=require('../../config/environment');module[_0xb235('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 1fe20ec..a9f1be3 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 _0x1651=['sequelize','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x50b66d,_0x11c61c){var _0x41aa8e=function(_0x418a48){while(--_0x418a48){_0x50b66d['push'](_0x50b66d['shift']());}};_0x41aa8e(++_0x11c61c);}(_0x1651,0x1a4));var _0x1165=function(_0x3a8fff,_0x1ef5d){_0x3a8fff=_0x3a8fff-0x0;var _0x5611a7=_0x1651[_0x3a8fff];return _0x5611a7;};'use strict';var Sequelize=require(_0x1165('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1165('0x1')]},'authentication':{'type':Sequelize[_0x1165('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1165('0x1')]},'password':{'type':Sequelize[_0x1165('0x1')]},'port':{'type':Sequelize[_0x1165('0x3')]},'tls':{'type':Sequelize[_0x1165('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1165('0x1')],'defaultValue':_0x1165('0x4')},'connTimeout':{'type':Sequelize[_0x1165('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1165('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x1165('0x1')]}}; \ No newline at end of file +var _0x9230=['exports','STRING','INTEGER','BOOLEAN','INBOX','sequelize'];(function(_0x48497f,_0x536176){var _0x1b2f07=function(_0x458032){while(--_0x458032){_0x48497f['push'](_0x48497f['shift']());}};_0x1b2f07(++_0x536176);}(_0x9230,0xbf));var _0x0923=function(_0x2ba61f,_0x358b7f){_0x2ba61f=_0x2ba61f-0x0;var _0x4e9fbb=_0x9230[_0x2ba61f];return _0x4e9fbb;};'use strict';var Sequelize=require(_0x0923('0x0'));module[_0x0923('0x1')]={'description':{'type':Sequelize[_0x0923('0x2')]},'host':{'type':Sequelize[_0x0923('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0923('0x2')]},'port':{'type':Sequelize[_0x0923('0x3')]},'tls':{'type':Sequelize[_0x0923('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0923('0x2')],'defaultValue':_0x0923('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x0923('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x0923('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 0695361..7063f20 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 _0x536f=['lodash','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','define'];(function(_0x4d3d9b,_0x176412){var _0x130f69=function(_0x49b960){while(--_0x49b960){_0x4d3d9b['push'](_0x4d3d9b['shift']());}};_0x130f69(++_0x176412);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf536('0x1'));var rp=require(_0xf536('0x2'));var fs=require('fs');var path=require(_0xf536('0x3'));var rimraf=require(_0xf536('0x4'));var config=require('../../config/environment');var attributes=require(_0xf536('0x5'));module['exports']=function(_0xbe060e,_0x7e339b){return _0xbe060e[_0xf536('0x6')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfcc=['bluebird','request-promise','exports','define','mail_servers_in','lodash','api','moment'];(function(_0x351b46,_0x26b265){var _0x1515df=function(_0x22896a){while(--_0x22896a){_0x351b46['push'](_0x351b46['shift']());}};_0x1515df(++_0x26b265);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xbfcc[_0x373dee];return _0x46798f;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcbfc('0x1'));var moment=require(_0xcbfc('0x2'));var BPromise=require(_0xcbfc('0x3'));var rp=require(_0xcbfc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0xcbfc('0x5')]=function(_0x2dbb05,_0x537813){return _0x2dbb05[_0xcbfc('0x6')]('MailServerIn',attributes,{'tableName':_0xcbfc('0x7'),'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 9b8f011..688cda7 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 _0x7c7b=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','findAll','options','where','limit','include','map','model','attributes','debug','lodash','randomstring','../../mysqldb'];(function(_0x3cb8a0,_0x62c139){var _0x4b0d20=function(_0x23dff1){while(--_0x23dff1){_0x3cb8a0['push'](_0x3cb8a0['shift']());}};_0x4b0d20(++_0x62c139);}(_0x7c7b,0x1af));var _0xb7c7=function(_0xdf0c09,_0x8fbdd5){_0xdf0c09=_0xdf0c09-0x0;var _0x48f3c6=_0x7c7b[_0xdf0c09];return _0x48f3c6;};'use strict';var _=require(_0xb7c7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb7c7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7c7('0x2'))['db'];var utils=require(_0xb7c7('0x3'));var logger=require(_0xb7c7('0x4'))(_0xb7c7('0x5'));var config=require('../../config/environment');var jayson=require(_0xb7c7('0x6'));var client=jayson[_0xb7c7('0x7')][_0xb7c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x206265,_0x4d4b41,_0x56dcad){return new BPromise(function(_0x3fcd42,_0x2d14c6){return client[_0xb7c7('0x9')](_0x206265,_0x56dcad)[_0xb7c7('0xa')](function(_0x460ac7){logger[_0xb7c7('0xb')](_0xb7c7('0xc'),_0x4d4b41,_0xb7c7('0xd'));logger['debug'](_0xb7c7('0xe'),_0x4d4b41,_0xb7c7('0xd'),JSON[_0xb7c7('0xf')](_0x460ac7));if(_0x460ac7[_0xb7c7('0x10')]){if(_0x460ac7['error'][_0xb7c7('0x11')]===0x1f4){logger['error'](_0xb7c7('0xc'),_0x4d4b41,_0x460ac7[_0xb7c7('0x10')][_0xb7c7('0x12')]);return _0x2d14c6(_0x460ac7[_0xb7c7('0x10')][_0xb7c7('0x12')]);}logger['error'](_0xb7c7('0xc'),_0x4d4b41,_0x460ac7[_0xb7c7('0x10')][_0xb7c7('0x12')]);return _0x3fcd42(_0x460ac7[_0xb7c7('0x10')][_0xb7c7('0x12')]);}else{logger[_0xb7c7('0xb')](_0xb7c7('0xc'),_0x4d4b41,'request\x20sent');_0x3fcd42(_0x460ac7[_0xb7c7('0x13')][_0xb7c7('0x12')]);}})[_0xb7c7('0x14')](function(_0x3b6d65){logger[_0xb7c7('0x10')](_0xb7c7('0xc'),_0x4d4b41,_0x3b6d65);_0x2d14c6(_0x3b6d65);});});}exports[_0xb7c7('0x15')]=function(_0x4390e5){var _0x2257eb=this;return new Promise(function(_0xf68d64,_0x10269e){return db['MailServerIn'][_0xb7c7('0x16')]({'raw':_0x4390e5[_0xb7c7('0x17')]?_0x4390e5[_0xb7c7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4390e5[_0xb7c7('0x17')]?_0x4390e5['options'][_0xb7c7('0x18')]||null:null,'attributes':_0x4390e5[_0xb7c7('0x17')]?_0x4390e5[_0xb7c7('0x17')]['attributes']||null:null,'limit':_0x4390e5[_0xb7c7('0x17')]?_0x4390e5[_0xb7c7('0x17')][_0xb7c7('0x19')]||null:null,'include':_0x4390e5['options']?_0x4390e5[_0xb7c7('0x17')][_0xb7c7('0x1a')]?_[_0xb7c7('0x1b')](_0x4390e5[_0xb7c7('0x17')][_0xb7c7('0x1a')],function(_0x2f7ba6){return{'model':db[_0x2f7ba6[_0xb7c7('0x1c')]],'as':_0x2f7ba6['as'],'attributes':_0x2f7ba6['attributes'],'include':_0x2f7ba6['include']?_['map'](_0x2f7ba6['include'],function(_0x58bb10){return{'model':db[_0x58bb10[_0xb7c7('0x1c')]],'as':_0x58bb10['as'],'attributes':_0x58bb10[_0xb7c7('0x1d')],'include':_0x58bb10[_0xb7c7('0x1a')]?_[_0xb7c7('0x1b')](_0x58bb10[_0xb7c7('0x1a')],function(_0xbcc3aa){return{'model':db[_0xbcc3aa[_0xb7c7('0x1c')]],'as':_0xbcc3aa['as'],'attributes':_0xbcc3aa[_0xb7c7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb7c7('0xa')](function(_0x2f7c86){logger[_0xb7c7('0xb')](_0xb7c7('0x15'),_0x4390e5);logger[_0xb7c7('0x1e')](_0xb7c7('0x15'),_0x4390e5,JSON[_0xb7c7('0xf')](_0x2f7c86));_0xf68d64(_0x2f7c86);})['catch'](function(_0x3dc631){logger['error'](_0xb7c7('0x15'),_0x3dc631['message'],_0x4390e5);_0x10269e(_0x2257eb[_0xb7c7('0x10')](0x1f4,_0x3dc631[_0xb7c7('0x12')]));});});}; \ No newline at end of file +var _0x1b13=['../../config/logger','../../config/environment','jayson/promise','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x520676,_0xb60d3a){var _0x187e58=function(_0xd7ab5f){while(--_0xd7ab5f){_0x520676['push'](_0x520676['shift']());}};_0x187e58(++_0xb60d3a);}(_0x1b13,0x133));var _0x31b1=function(_0x5abaef,_0x20cfca){_0x5abaef=_0x5abaef-0x0;var _0x2c1127=_0x1b13[_0x5abaef];return _0x2c1127;};'use strict';var _=require(_0x31b1('0x0'));var util=require(_0x31b1('0x1'));var moment=require(_0x31b1('0x2'));var BPromise=require(_0x31b1('0x3'));var rs=require(_0x31b1('0x4'));var fs=require('fs');var Redis=require(_0x31b1('0x5'));var db=require(_0x31b1('0x6'))['db'];var utils=require(_0x31b1('0x7'));var logger=require(_0x31b1('0x8'))('rpc');var config=require(_0x31b1('0x9'));var jayson=require(_0x31b1('0xa'));var client=jayson['client'][_0x31b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25e13e,_0xca8207,_0x47266b){return new BPromise(function(_0x34ac49,_0x39df6e){return client[_0x31b1('0xc')](_0x25e13e,_0x47266b)['then'](function(_0x5a9945){logger[_0x31b1('0xd')](_0x31b1('0xe'),_0xca8207,_0x31b1('0xf'));logger['debug'](_0x31b1('0x10'),_0xca8207,_0x31b1('0xf'),JSON[_0x31b1('0x11')](_0x5a9945));if(_0x5a9945[_0x31b1('0x12')]){if(_0x5a9945['error'][_0x31b1('0x13')]===0x1f4){logger[_0x31b1('0x12')](_0x31b1('0xe'),_0xca8207,_0x5a9945[_0x31b1('0x12')][_0x31b1('0x14')]);return _0x39df6e(_0x5a9945[_0x31b1('0x12')][_0x31b1('0x14')]);}logger[_0x31b1('0x12')](_0x31b1('0xe'),_0xca8207,_0x5a9945[_0x31b1('0x12')][_0x31b1('0x14')]);return _0x34ac49(_0x5a9945[_0x31b1('0x12')]['message']);}else{logger['info'](_0x31b1('0xe'),_0xca8207,_0x31b1('0xf'));_0x34ac49(_0x5a9945[_0x31b1('0x15')][_0x31b1('0x14')]);}})[_0x31b1('0x16')](function(_0xc78723){logger[_0x31b1('0x12')](_0x31b1('0xe'),_0xca8207,_0xc78723);_0x39df6e(_0xc78723);});});}exports[_0x31b1('0x17')]=function(_0x2d8c7a){var _0x117628=this;return new Promise(function(_0x2af79a,_0x2f83bb){return db[_0x31b1('0x18')][_0x31b1('0x19')]({'raw':_0x2d8c7a[_0x31b1('0x1a')]?_0x2d8c7a[_0x31b1('0x1a')][_0x31b1('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d8c7a[_0x31b1('0x1a')]?_0x2d8c7a[_0x31b1('0x1a')][_0x31b1('0x1c')]||null:null,'attributes':_0x2d8c7a[_0x31b1('0x1a')]?_0x2d8c7a[_0x31b1('0x1a')]['attributes']||null:null,'limit':_0x2d8c7a[_0x31b1('0x1a')]?_0x2d8c7a['options'][_0x31b1('0x1d')]||null:null,'include':_0x2d8c7a['options']?_0x2d8c7a[_0x31b1('0x1a')][_0x31b1('0x1e')]?_[_0x31b1('0x1f')](_0x2d8c7a[_0x31b1('0x1a')][_0x31b1('0x1e')],function(_0x1924a7){return{'model':db[_0x1924a7[_0x31b1('0x20')]],'as':_0x1924a7['as'],'attributes':_0x1924a7['attributes'],'include':_0x1924a7[_0x31b1('0x1e')]?_[_0x31b1('0x1f')](_0x1924a7[_0x31b1('0x1e')],function(_0x51f82e){return{'model':db[_0x51f82e[_0x31b1('0x20')]],'as':_0x51f82e['as'],'attributes':_0x51f82e['attributes'],'include':_0x51f82e[_0x31b1('0x1e')]?_[_0x31b1('0x1f')](_0x51f82e[_0x31b1('0x1e')],function(_0x5b46bd){return{'model':db[_0x5b46bd['model']],'as':_0x5b46bd['as'],'attributes':_0x5b46bd[_0x31b1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x31b1('0x22')](function(_0x1bc88d){logger[_0x31b1('0xd')](_0x31b1('0x17'),_0x2d8c7a);logger['debug'](_0x31b1('0x17'),_0x2d8c7a,JSON['stringify'](_0x1bc88d));_0x2af79a(_0x1bc88d);})[_0x31b1('0x16')](function(_0x170836){logger[_0x31b1('0x12')](_0x31b1('0x17'),_0x170836[_0x31b1('0x14')],_0x2d8c7a);_0x2f83bb(_0x117628[_0x31b1('0x12')](0x1f4,_0x170836[_0x31b1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3a40e62..4d5ca5e 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 _0x81bd=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailServerOut.controller','isAuthenticated','index','get','show','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x1aae6a,_0x56bb19){var _0x297a71=function(_0x471e80){while(--_0x471e80){_0x1aae6a['push'](_0x1aae6a['shift']());}};_0x297a71(++_0x56bb19);}(_0x81bd,0x7c));var _0xd81b=function(_0x3541da,_0x5b2254){_0x3541da=_0x3541da-0x0;var _0xa24cff=_0x81bd[_0x3541da];return _0xa24cff;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var fs_extra=require(_0xd81b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var controller=require(_0xd81b('0x9'));router['get']('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0xb')]);router[_0xd81b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xd81b('0xd')]);router['post']('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0xe')]);router[_0xd81b('0xf')](_0xd81b('0x10'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x11')]);router[_0xd81b('0x12')](_0xd81b('0x10'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x13')]);module[_0xd81b('0x14')]=router; \ No newline at end of file +var _0x5b02=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x2515a8,_0x2ba676){_0x2515a8=_0x2515a8-0x0;var _0x1b39b7=_0x5b02[_0x2515a8];return _0x1b39b7;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x25b0('0xc')]);router[_0x25b0('0xd')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xe')]);router[_0x25b0('0xf')](_0x25b0('0xa'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x10')]);module[_0x25b0('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 9e7ec82..659074a 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 _0x3024=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x3024,0x64));var _0x4302=function(_0x16452d,_0x36f058){_0x16452d=_0x16452d-0x0;var _0x3579f9=_0x3024[_0x16452d];return _0x3579f9;};'use strict';var Sequelize=require(_0x4302('0x0'));module[_0x4302('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4302('0x2')]},'user':{'type':Sequelize[_0x4302('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x4302('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x4302('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x33af=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x2e1db7,_0x183a62){var _0x484312=function(_0x1e443e){while(--_0x1e443e){_0x2e1db7['push'](_0x2e1db7['shift']());}};_0x484312(++_0x183a62);}(_0x33af,0xec));var _0xf33a=function(_0x19cce8,_0x23a814){_0x19cce8=_0x19cce8-0x0;var _0x575f93=_0x33af[_0x19cce8];return _0x575f93;};'use strict';var Sequelize=require('sequelize');module[_0xf33a('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf33a('0x1')]},'user':{'type':Sequelize[_0xf33a('0x1')]},'pass':{'type':Sequelize[_0xf33a('0x1')]},'port':{'type':Sequelize[_0xf33a('0x2')]},'secure':{'type':Sequelize[_0xf33a('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xf33a('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 64872dd..67451a2 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 _0x48f5=['include','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','index','map','MailServerOut','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x1e1943,_0x1a6d54){var _0x4989a9=function(_0x4e1e58){while(--_0x4e1e58){_0x1e1943['push'](_0x1e1943['shift']());}};_0x4989a9(++_0x1a6d54);}(_0x48f5,0x1c1));var _0x548f=function(_0x51af64,_0x50c0c7){_0x51af64=_0x51af64-0x0;var _0x2ba7e9=_0x48f5[_0x51af64];return _0x2ba7e9;};'use strict';var emlformat=require(_0x548f('0x0'));var rimraf=require(_0x548f('0x1'));var zipdir=require(_0x548f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x548f('0x3'));var moment=require(_0x548f('0x4'));var BPromise=require(_0x548f('0x5'));var Mustache=require(_0x548f('0x6'));var util=require(_0x548f('0x7'));var path=require(_0x548f('0x8'));var sox=require(_0x548f('0x9'));var csv=require(_0x548f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x548f('0xb'));var squel=require('squel');var crypto=require(_0x548f('0xc'));var jsforce=require(_0x548f('0xd'));var deskjs=require(_0x548f('0xe'));var toCsv=require(_0x548f('0xa'));var querystring=require(_0x548f('0xf'));var Papa=require(_0x548f('0x10'));var Redis=require(_0x548f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x548f('0x12'));var as=require(_0x548f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x548f('0x14'));var utils=require(_0x548f('0x15'));var config=require(_0x548f('0x16'));var licenseUtil=require(_0x548f('0x17'));var db=require(_0x548f('0x18'))['db'];function respondWithStatusCode(_0xb38671,_0x337bf6){_0x337bf6=_0x337bf6||0xcc;return function(_0x109adb){if(_0x109adb){return _0xb38671[_0x548f('0x19')](_0x337bf6);}return _0xb38671['status'](_0x337bf6)[_0x548f('0x1a')]();};}function respondWithResult(_0x4043cd,_0x340607){_0x340607=_0x340607||0xc8;return function(_0x295beb){if(_0x295beb){return _0x4043cd[_0x548f('0x1b')](_0x340607)[_0x548f('0x1c')](_0x295beb);}};}function respondWithFilteredResult(_0x22a4aa,_0x52f66c){return function(_0x2d14c6){if(_0x2d14c6){var _0x65685e=typeof _0x52f66c[_0x548f('0x1d')]==='undefined'&&typeof _0x52f66c[_0x548f('0x1e')]===_0x548f('0x1f');var _0x529328=_0x2d14c6['count'];var _0xbccec9=_0x65685e?0x0:_0x52f66c[_0x548f('0x1d')];var _0x397ee7=_0x65685e?_0x2d14c6[_0x548f('0x20')]:_0x52f66c[_0x548f('0x1d')]+_0x52f66c[_0x548f('0x1e')];var _0x4e31fd;if(_0x397ee7>=_0x529328){_0x397ee7=_0x529328;_0x4e31fd=0xc8;}else{_0x4e31fd=0xce;}_0x22a4aa['status'](_0x4e31fd);return _0x22a4aa[_0x548f('0x21')](_0x548f('0x22'),_0xbccec9+'-'+_0x397ee7+'/'+_0x529328)[_0x548f('0x1c')](_0x2d14c6);}return null;};}function patchUpdates(_0x577dc9){return function(_0x1c9416){try{jsonpatch['apply'](_0x1c9416,_0x577dc9,!![]);}catch(_0x2c1f54){return BPromise[_0x548f('0x23')](_0x2c1f54);}return _0x1c9416[_0x548f('0x24')]();};}function saveUpdates(_0x35ef0b,_0x372fde){return function(_0x5bfede){if(_0x5bfede){return _0x5bfede[_0x548f('0x25')](_0x35ef0b)[_0x548f('0x26')](function(_0x44c147){return _0x44c147;});}return null;};}function removeEntity(_0x5830d1,_0x4c3a6e){return function(_0x4d508c){if(_0x4d508c){return _0x4d508c[_0x548f('0x27')]()[_0x548f('0x26')](function(){_0x5830d1['status'](0xcc)[_0x548f('0x1a')]();});}};}function handleEntityNotFound(_0x399946,_0x5a06f3){return function(_0x245558){if(!_0x245558){_0x399946[_0x548f('0x19')](0x194);}return _0x245558;};}function handleError(_0x1983b8,_0x1c0713){_0x1c0713=_0x1c0713||0x1f4;return function(_0x13c842){logger['error'](_0x13c842['stack']);if(_0x13c842['name']){delete _0x13c842['name'];}_0x1983b8[_0x548f('0x1b')](_0x1c0713)['send'](_0x13c842);};}exports[_0x548f('0x28')]=function(_0x41394b,_0x4178f5){var _0x5169ff={},_0x576a01={},_0x29c414={'count':0x0,'rows':[]};var _0x2b5fc4=_[_0x548f('0x29')](db[_0x548f('0x2a')][_0x548f('0x2b')],function(_0x4ee76c){return{'name':_0x4ee76c[_0x548f('0x2c')],'type':_0x4ee76c[_0x548f('0x2d')][_0x548f('0x2e')]};});_0x576a01['model']=_[_0x548f('0x29')](_0x2b5fc4,_0x548f('0x2f'));_0x576a01[_0x548f('0x30')]=_[_0x548f('0x31')](_0x41394b[_0x548f('0x30')]);_0x576a01[_0x548f('0x32')]=_[_0x548f('0x33')](_0x576a01[_0x548f('0x34')],_0x576a01[_0x548f('0x30')]);_0x5169ff[_0x548f('0x35')]=_[_0x548f('0x33')](_0x576a01['model'],qs[_0x548f('0x36')](_0x41394b[_0x548f('0x30')][_0x548f('0x36')]));_0x5169ff[_0x548f('0x35')]=_0x5169ff[_0x548f('0x35')][_0x548f('0x37')]?_0x5169ff[_0x548f('0x35')]:_0x576a01[_0x548f('0x34')];if(!_0x41394b[_0x548f('0x30')][_0x548f('0x38')]('nolimit')){_0x5169ff['limit']=qs['limit'](_0x41394b[_0x548f('0x30')][_0x548f('0x1e')]);_0x5169ff[_0x548f('0x1d')]=qs[_0x548f('0x1d')](_0x41394b[_0x548f('0x30')][_0x548f('0x1d')]);}_0x5169ff[_0x548f('0x39')]=qs[_0x548f('0x3a')](_0x41394b['query'][_0x548f('0x3a')]);_0x5169ff[_0x548f('0x3b')]=qs[_0x548f('0x32')](_['pick'](_0x41394b[_0x548f('0x30')],_0x576a01['filters']),_0x2b5fc4);if(_0x41394b['query'][_0x548f('0x3c')]){_0x5169ff['where']=_[_0x548f('0x3d')](_0x5169ff[_0x548f('0x3b')],{'$or':_[_0x548f('0x29')](_0x2b5fc4,function(_0x3b5943){if(_0x3b5943[_0x548f('0x2d')]!==_0x548f('0x3e')){var _0x41858d={};_0x41858d[_0x3b5943[_0x548f('0x2f')]]={'$like':'%'+_0x41394b[_0x548f('0x30')][_0x548f('0x3c')]+'%'};return _0x41858d;}})});}_0x5169ff=_[_0x548f('0x3d')]({},_0x5169ff,_0x41394b[_0x548f('0x3f')]);var _0x19fab8={'where':_0x5169ff[_0x548f('0x3b')]};return db[_0x548f('0x2a')][_0x548f('0x20')](_0x19fab8)[_0x548f('0x26')](function(_0x1bc3a1){_0x29c414[_0x548f('0x20')]=_0x1bc3a1;if(_0x41394b[_0x548f('0x30')][_0x548f('0x40')]){_0x5169ff['include']=[{'all':!![]}];}return db['MailServerOut'][_0x548f('0x41')](_0x5169ff);})[_0x548f('0x26')](function(_0x375f12){_0x29c414[_0x548f('0x42')]=_0x375f12;return _0x29c414;})['then'](respondWithFilteredResult(_0x4178f5,_0x5169ff))[_0x548f('0x43')](handleError(_0x4178f5,null));};exports[_0x548f('0x44')]=function(_0x9ed7da,_0x359f87){var _0x5440a1={'raw':!![],'where':{'id':_0x9ed7da['params']['id']}},_0x120d1c={};_0x120d1c[_0x548f('0x34')]=_[_0x548f('0x31')](db[_0x548f('0x2a')][_0x548f('0x2b')]);_0x120d1c[_0x548f('0x30')]=_[_0x548f('0x31')](_0x9ed7da[_0x548f('0x30')]);_0x120d1c['filters']=_['intersection'](_0x120d1c['model'],_0x120d1c[_0x548f('0x30')]);_0x5440a1[_0x548f('0x35')]=_['intersection'](_0x120d1c[_0x548f('0x34')],qs[_0x548f('0x36')](_0x9ed7da[_0x548f('0x30')][_0x548f('0x36')]));_0x5440a1[_0x548f('0x35')]=_0x5440a1['attributes'][_0x548f('0x37')]?_0x5440a1['attributes']:_0x120d1c[_0x548f('0x34')];if(_0x9ed7da[_0x548f('0x30')][_0x548f('0x40')]){_0x5440a1[_0x548f('0x45')]=[{'all':!![]}];}_0x5440a1=_[_0x548f('0x3d')]({},_0x5440a1,_0x9ed7da[_0x548f('0x3f')]);return db[_0x548f('0x2a')][_0x548f('0x46')](_0x5440a1)['then'](handleEntityNotFound(_0x359f87,null))[_0x548f('0x26')](respondWithResult(_0x359f87,null))[_0x548f('0x43')](handleError(_0x359f87,null));};exports['create']=function(_0x2e18d9,_0x3837f7){return db[_0x548f('0x2a')][_0x548f('0x47')](_0x2e18d9['body'],{})[_0x548f('0x26')](respondWithResult(_0x3837f7,0xc9))[_0x548f('0x43')](handleError(_0x3837f7,null));};exports[_0x548f('0x25')]=function(_0x4dd1e7,_0x545f){if(_0x4dd1e7[_0x548f('0x48')]['id']){delete _0x4dd1e7[_0x548f('0x48')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x4dd1e7[_0x548f('0x49')]['id']}})[_0x548f('0x26')](handleEntityNotFound(_0x545f,null))[_0x548f('0x26')](saveUpdates(_0x4dd1e7[_0x548f('0x48')],null))['then'](respondWithResult(_0x545f,null))['catch'](handleError(_0x545f,null));};exports[_0x548f('0x27')]=function(_0x267c68,_0x56847a){return db[_0x548f('0x2a')]['find']({'where':{'id':_0x267c68[_0x548f('0x49')]['id']}})[_0x548f('0x26')](handleEntityNotFound(_0x56847a,null))['then'](removeEntity(_0x56847a,null))[_0x548f('0x43')](handleError(_0x56847a,null));}; \ No newline at end of file +var _0x3d6b=['path','sox','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','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','index','map','MailServerOut','rawAttributes','model','name','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x1b0113,_0x258eb2){var _0x478cc3=function(_0x846e2a){while(--_0x846e2a){_0x1b0113['push'](_0x1b0113['shift']());}};_0x478cc3(++_0x258eb2);}(_0x3d6b,0x121));var _0xb3d6=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x3d6b[_0x4de586];return _0x46baf5;};'use strict';var emlformat=require(_0xb3d6('0x0'));var rimraf=require(_0xb3d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3d6('0x2'));var rp=require(_0xb3d6('0x3'));var moment=require(_0xb3d6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb3d6('0x5'));var util=require(_0xb3d6('0x6'));var path=require(_0xb3d6('0x7'));var sox=require(_0xb3d6('0x8'));var csv=require('to-csv');var ejs=require(_0xb3d6('0x9'));var fs=require('fs');var fs_extra=require(_0xb3d6('0xa'));var _=require(_0xb3d6('0xb'));var squel=require(_0xb3d6('0xc'));var crypto=require(_0xb3d6('0xd'));var jsforce=require(_0xb3d6('0xe'));var deskjs=require(_0xb3d6('0xf'));var toCsv=require(_0xb3d6('0x10'));var querystring=require(_0xb3d6('0x11'));var Papa=require(_0xb3d6('0x12'));var Redis=require('ioredis');var authService=require(_0xb3d6('0x13'));var qs=require(_0xb3d6('0x14'));var as=require(_0xb3d6('0x15'));var hardwareService=require(_0xb3d6('0x16'));var logger=require(_0xb3d6('0x17'))('api');var utils=require(_0xb3d6('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb3d6('0x19'))['db'];function respondWithStatusCode(_0x308515,_0x5264e7){_0x5264e7=_0x5264e7||0xcc;return function(_0x242676){if(_0x242676){return _0x308515[_0xb3d6('0x1a')](_0x5264e7);}return _0x308515['status'](_0x5264e7)[_0xb3d6('0x1b')]();};}function respondWithResult(_0x4ce386,_0x426022){_0x426022=_0x426022||0xc8;return function(_0xd7f7e2){if(_0xd7f7e2){return _0x4ce386[_0xb3d6('0x1c')](_0x426022)[_0xb3d6('0x1d')](_0xd7f7e2);}};}function respondWithFilteredResult(_0xae5ef0,_0x5da678){return function(_0x2895a9){if(_0x2895a9){var _0xa3f2e7=typeof _0x5da678[_0xb3d6('0x1e')]===_0xb3d6('0x1f')&&typeof _0x5da678[_0xb3d6('0x20')]==='undefined';var _0x4ad611=_0x2895a9[_0xb3d6('0x21')];var _0x30c025=_0xa3f2e7?0x0:_0x5da678[_0xb3d6('0x1e')];var _0x4aa489=_0xa3f2e7?_0x2895a9[_0xb3d6('0x21')]:_0x5da678['offset']+_0x5da678['limit'];var _0x46f130;if(_0x4aa489>=_0x4ad611){_0x4aa489=_0x4ad611;_0x46f130=0xc8;}else{_0x46f130=0xce;}_0xae5ef0[_0xb3d6('0x1c')](_0x46f130);return _0xae5ef0[_0xb3d6('0x22')](_0xb3d6('0x23'),_0x30c025+'-'+_0x4aa489+'/'+_0x4ad611)[_0xb3d6('0x1d')](_0x2895a9);}return null;};}function patchUpdates(_0x299a1d){return function(_0x3f54d7){try{jsonpatch['apply'](_0x3f54d7,_0x299a1d,!![]);}catch(_0x1c04ba){return BPromise[_0xb3d6('0x24')](_0x1c04ba);}return _0x3f54d7[_0xb3d6('0x25')]();};}function saveUpdates(_0x39c39d,_0x230e80){return function(_0x375973){if(_0x375973){return _0x375973[_0xb3d6('0x26')](_0x39c39d)['then'](function(_0x2cd665){return _0x2cd665;});}return null;};}function removeEntity(_0x38753a,_0xa10c4a){return function(_0x319d2b){if(_0x319d2b){return _0x319d2b[_0xb3d6('0x27')]()[_0xb3d6('0x28')](function(){_0x38753a[_0xb3d6('0x1c')](0xcc)[_0xb3d6('0x1b')]();});}};}function handleEntityNotFound(_0x43f79d,_0x4226b9){return function(_0x27972f){if(!_0x27972f){_0x43f79d['sendStatus'](0x194);}return _0x27972f;};}function handleError(_0x9874c1,_0x107d83){_0x107d83=_0x107d83||0x1f4;return function(_0x53c3af){logger[_0xb3d6('0x29')](_0x53c3af[_0xb3d6('0x2a')]);if(_0x53c3af['name']){delete _0x53c3af['name'];}_0x9874c1[_0xb3d6('0x1c')](_0x107d83)['send'](_0x53c3af);};}exports[_0xb3d6('0x2b')]=function(_0x444a01,_0xbe7f78){var _0x4c3297={},_0x40f501={},_0x1d0468={'count':0x0,'rows':[]};var _0x23c09b=_[_0xb3d6('0x2c')](db[_0xb3d6('0x2d')][_0xb3d6('0x2e')],function(_0x256934){return{'name':_0x256934['fieldName'],'type':_0x256934['type']['key']};});_0x40f501[_0xb3d6('0x2f')]=_[_0xb3d6('0x2c')](_0x23c09b,_0xb3d6('0x30'));_0x40f501['query']=_[_0xb3d6('0x31')](_0x444a01[_0xb3d6('0x32')]);_0x40f501['filters']=_[_0xb3d6('0x33')](_0x40f501[_0xb3d6('0x2f')],_0x40f501[_0xb3d6('0x32')]);_0x4c3297['attributes']=_[_0xb3d6('0x33')](_0x40f501[_0xb3d6('0x2f')],qs['fields'](_0x444a01[_0xb3d6('0x32')][_0xb3d6('0x34')]));_0x4c3297[_0xb3d6('0x35')]=_0x4c3297[_0xb3d6('0x35')][_0xb3d6('0x36')]?_0x4c3297[_0xb3d6('0x35')]:_0x40f501[_0xb3d6('0x2f')];if(!_0x444a01['query'][_0xb3d6('0x37')](_0xb3d6('0x38'))){_0x4c3297[_0xb3d6('0x20')]=qs[_0xb3d6('0x20')](_0x444a01[_0xb3d6('0x32')]['limit']);_0x4c3297[_0xb3d6('0x1e')]=qs['offset'](_0x444a01[_0xb3d6('0x32')][_0xb3d6('0x1e')]);}_0x4c3297['order']=qs['sort'](_0x444a01['query'][_0xb3d6('0x39')]);_0x4c3297[_0xb3d6('0x3a')]=qs[_0xb3d6('0x3b')](_[_0xb3d6('0x3c')](_0x444a01['query'],_0x40f501[_0xb3d6('0x3b')]),_0x23c09b);if(_0x444a01['query'][_0xb3d6('0x3d')]){_0x4c3297[_0xb3d6('0x3a')]=_[_0xb3d6('0x3e')](_0x4c3297[_0xb3d6('0x3a')],{'$or':_[_0xb3d6('0x2c')](_0x23c09b,function(_0xceb469){if(_0xceb469[_0xb3d6('0x3f')]!==_0xb3d6('0x40')){var _0x5e0eb4={};_0x5e0eb4[_0xceb469['name']]={'$like':'%'+_0x444a01['query']['filter']+'%'};return _0x5e0eb4;}})});}_0x4c3297=_[_0xb3d6('0x3e')]({},_0x4c3297,_0x444a01[_0xb3d6('0x41')]);var _0x151c61={'where':_0x4c3297['where']};return db[_0xb3d6('0x2d')][_0xb3d6('0x21')](_0x151c61)['then'](function(_0x4ccc48){_0x1d0468[_0xb3d6('0x21')]=_0x4ccc48;if(_0x444a01[_0xb3d6('0x32')][_0xb3d6('0x42')]){_0x4c3297[_0xb3d6('0x43')]=[{'all':!![]}];}return db[_0xb3d6('0x2d')][_0xb3d6('0x44')](_0x4c3297);})[_0xb3d6('0x28')](function(_0x47f775){_0x1d0468['rows']=_0x47f775;return _0x1d0468;})['then'](respondWithFilteredResult(_0xbe7f78,_0x4c3297))[_0xb3d6('0x45')](handleError(_0xbe7f78,null));};exports[_0xb3d6('0x46')]=function(_0x1faf04,_0x2f42f9){var _0x258e39={'raw':!![],'where':{'id':_0x1faf04[_0xb3d6('0x47')]['id']}},_0x3d1fc2={};_0x3d1fc2[_0xb3d6('0x2f')]=_[_0xb3d6('0x31')](db[_0xb3d6('0x2d')][_0xb3d6('0x2e')]);_0x3d1fc2[_0xb3d6('0x32')]=_[_0xb3d6('0x31')](_0x1faf04[_0xb3d6('0x32')]);_0x3d1fc2['filters']=_[_0xb3d6('0x33')](_0x3d1fc2[_0xb3d6('0x2f')],_0x3d1fc2[_0xb3d6('0x32')]);_0x258e39[_0xb3d6('0x35')]=_[_0xb3d6('0x33')](_0x3d1fc2['model'],qs[_0xb3d6('0x34')](_0x1faf04[_0xb3d6('0x32')][_0xb3d6('0x34')]));_0x258e39[_0xb3d6('0x35')]=_0x258e39[_0xb3d6('0x35')][_0xb3d6('0x36')]?_0x258e39[_0xb3d6('0x35')]:_0x3d1fc2[_0xb3d6('0x2f')];if(_0x1faf04['query'][_0xb3d6('0x42')]){_0x258e39['include']=[{'all':!![]}];}_0x258e39=_[_0xb3d6('0x3e')]({},_0x258e39,_0x1faf04[_0xb3d6('0x41')]);return db['MailServerOut']['find'](_0x258e39)[_0xb3d6('0x28')](handleEntityNotFound(_0x2f42f9,null))['then'](respondWithResult(_0x2f42f9,null))[_0xb3d6('0x45')](handleError(_0x2f42f9,null));};exports['create']=function(_0x57f40c,_0x109e33){return db['MailServerOut']['create'](_0x57f40c[_0xb3d6('0x48')],{})[_0xb3d6('0x28')](respondWithResult(_0x109e33,0xc9))[_0xb3d6('0x45')](handleError(_0x109e33,null));};exports[_0xb3d6('0x26')]=function(_0x107891,_0x2e3a3a){if(_0x107891['body']['id']){delete _0x107891[_0xb3d6('0x48')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x107891[_0xb3d6('0x47')]['id']}})[_0xb3d6('0x28')](handleEntityNotFound(_0x2e3a3a,null))[_0xb3d6('0x28')](saveUpdates(_0x107891[_0xb3d6('0x48')],null))[_0xb3d6('0x28')](respondWithResult(_0x2e3a3a,null))['catch'](handleError(_0x2e3a3a,null));};exports['destroy']=function(_0x546c54,_0x2e9e6a){return db[_0xb3d6('0x2d')][_0xb3d6('0x49')]({'where':{'id':_0x546c54[_0xb3d6('0x47')]['id']}})[_0xb3d6('0x28')](handleEntityNotFound(_0x2e9e6a,null))[_0xb3d6('0x28')](removeEntity(_0x2e9e6a,null))[_0xb3d6('0x45')](handleError(_0x2e9e6a,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 519cd31..2596547 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 _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x1b75bd,_0x3aaeee){var _0x166109=function(_0x2ef683){while(--_0x2ef683){_0x1b75bd['push'](_0x1b75bd['shift']());}};_0x166109(++_0x3aaeee);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x79e6ba,_0x26d419){_0x79e6ba=_0x79e6ba-0x0;var _0x24cd23=_0xdbf5[_0x79e6ba];return _0x24cd23;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['mail_servers_out','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','MailServerOut'];(function(_0x1aa69f,_0x2375ee){var _0x108ad5=function(_0xb86415){while(--_0xb86415){_0x1aa69f['push'](_0x1aa69f['shift']());}};_0x108ad5(++_0x2375ee);}(_0x4819,0xcd));var _0x9481=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x4819[_0x11005e];return _0x29338f;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 202e238..8e4b213 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 _0x22da=['code','message','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x30792a,_0x5087ee){var _0x156051=function(_0x1de772){while(--_0x1de772){_0x30792a['push'](_0x30792a['shift']());}};_0x156051(++_0x5087ee);}(_0x22da,0xea));var _0xa22d=function(_0x1d8e1e,_0x44fd8a){_0x1d8e1e=_0x1d8e1e-0x0;var _0x4f8bdc=_0x22da[_0x1d8e1e];return _0x4f8bdc;};'use strict';var _=require(_0xa22d('0x0'));var util=require(_0xa22d('0x1'));var moment=require(_0xa22d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa22d('0x3'))['db'];var utils=require(_0xa22d('0x4'));var logger=require(_0xa22d('0x5'))(_0xa22d('0x6'));var config=require(_0xa22d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa22d('0x8')][_0xa22d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26c51c,_0x1194fe,_0x3362da){return new BPromise(function(_0x4eebf1,_0x14994c){return client['request'](_0x26c51c,_0x3362da)[_0xa22d('0xa')](function(_0x2ad728){logger[_0xa22d('0xb')](_0xa22d('0xc'),_0x1194fe,_0xa22d('0xd'));logger[_0xa22d('0xe')](_0xa22d('0xf'),_0x1194fe,'request\x20sent',JSON[_0xa22d('0x10')](_0x2ad728));if(_0x2ad728['error']){if(_0x2ad728[_0xa22d('0x11')][_0xa22d('0x12')]===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x1194fe,_0x2ad728[_0xa22d('0x11')]['message']);return _0x14994c(_0x2ad728['error'][_0xa22d('0x13')]);}logger['error']('MailServerOut,\x20%s,\x20%s',_0x1194fe,_0x2ad728[_0xa22d('0x11')][_0xa22d('0x13')]);return _0x4eebf1(_0x2ad728['error'][_0xa22d('0x13')]);}else{logger[_0xa22d('0xb')](_0xa22d('0xc'),_0x1194fe,_0xa22d('0xd'));_0x4eebf1(_0x2ad728[_0xa22d('0x14')][_0xa22d('0x13')]);}})['catch'](function(_0x529944){logger['error'](_0xa22d('0xc'),_0x1194fe,_0x529944);_0x14994c(_0x529944);});});} \ No newline at end of file +var _0xbe77=['code','message','request\x20sent','result','catch','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','error'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0xbe77,0x9e));var _0x7be7=function(_0x4b66cc,_0x27aa90){_0x4b66cc=_0x4b66cc-0x0;var _0x59f1ce=_0xbe77[_0x4b66cc];return _0x59f1ce;};'use strict';var _=require('lodash');var util=require(_0x7be7('0x0'));var moment=require(_0x7be7('0x1'));var BPromise=require('bluebird');var rs=require(_0x7be7('0x2'));var fs=require('fs');var Redis=require(_0x7be7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7be7('0x4'))('rpc');var config=require(_0x7be7('0x5'));var jayson=require(_0x7be7('0x6'));var client=jayson['client'][_0x7be7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x30c2bd,_0x9a3d83,_0xdd437c){return new BPromise(function(_0x46625c,_0x376e51){return client['request'](_0x30c2bd,_0xdd437c)['then'](function(_0x5c478d){logger[_0x7be7('0x8')](_0x7be7('0x9'),_0x9a3d83,'request\x20sent');logger['debug'](_0x7be7('0xa'),_0x9a3d83,'request\x20sent',JSON['stringify'](_0x5c478d));if(_0x5c478d[_0x7be7('0xb')]){if(_0x5c478d['error'][_0x7be7('0xc')]===0x1f4){logger[_0x7be7('0xb')](_0x7be7('0x9'),_0x9a3d83,_0x5c478d['error']['message']);return _0x376e51(_0x5c478d['error']['message']);}logger[_0x7be7('0xb')]('MailServerOut,\x20%s,\x20%s',_0x9a3d83,_0x5c478d[_0x7be7('0xb')]['message']);return _0x46625c(_0x5c478d[_0x7be7('0xb')][_0x7be7('0xd')]);}else{logger[_0x7be7('0x8')](_0x7be7('0x9'),_0x9a3d83,_0x7be7('0xe'));_0x46625c(_0x5c478d[_0x7be7('0xf')][_0x7be7('0xd')]);}})[_0x7be7('0x10')](function(_0x20000e){logger[_0x7be7('0xb')](_0x7be7('0x9'),_0x9a3d83,_0x20000e);_0x376e51(_0x20000e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index b03d606..002fd8c 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 _0xbca8=['/:id','show','post','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0xc721f5,_0x42404b){var _0x1bc1bd=function(_0x2870fa){while(--_0x2870fa){_0xc721f5['push'](_0xc721f5['shift']());}};_0x1bc1bd(++_0x42404b);}(_0xbca8,0xcc));var _0x8bca=function(_0x304176,_0xe79b28){_0x304176=_0x304176-0x0;var _0x1120d3=_0xbca8[_0x304176];return _0x1120d3;};'use strict';var multer=require(_0x8bca('0x0'));var util=require(_0x8bca('0x1'));var path=require(_0x8bca('0x2'));var timeout=require(_0x8bca('0x3'));var express=require(_0x8bca('0x4'));var router=express['Router']();var fs_extra=require(_0x8bca('0x5'));var auth=require(_0x8bca('0x6'));var interaction=require(_0x8bca('0x7'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x8bca('0x8')]('/',auth[_0x8bca('0x9')](),controller[_0x8bca('0xa')]);router[_0x8bca('0x8')]('/describe',auth[_0x8bca('0x9')](),controller[_0x8bca('0xb')]);router[_0x8bca('0x8')](_0x8bca('0xc'),auth[_0x8bca('0x9')](),controller[_0x8bca('0xd')]);router[_0x8bca('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8bca('0xf')](_0x8bca('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8bca('0x10')]('/:id',auth[_0x8bca('0x9')](),controller[_0x8bca('0x11')]);module['exports']=router; \ No newline at end of file +var _0x117c=['exports','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','/:id','show','post','create','update','delete'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x117c,0x71));var _0xc117=function(_0x2db315,_0x58d720){_0x2db315=_0x2db315-0x0;var _0x12f9a2=_0x117c[_0x2db315];return _0x12f9a2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc117('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc117('0x1'));var auth=require(_0xc117('0x2'));var interaction=require(_0xc117('0x3'));var config=require(_0xc117('0x4'));var controller=require(_0xc117('0x5'));router[_0xc117('0x6')]('/',auth['isAuthenticated'](),controller[_0xc117('0x7')]);router[_0xc117('0x6')]('/describe',auth[_0xc117('0x8')](),controller['describe']);router[_0xc117('0x6')](_0xc117('0x9'),auth[_0xc117('0x8')](),controller[_0xc117('0xa')]);router[_0xc117('0xb')]('/',auth['isAuthenticated'](),controller[_0xc117('0xc')]);router['put'](_0xc117('0x9'),auth['isAuthenticated'](),controller[_0xc117('0xd')]);router[_0xc117('0xe')]('/:id',auth[_0xc117('0x8')](),controller['destroy']);module[_0xc117('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index dc9bb22..c2c9778 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 _0xd959=['STRING','sequelize','exports'];(function(_0x403c8d,_0x5e3825){var _0x4ca60d=function(_0x9326c1){while(--_0x9326c1){_0x403c8d['push'](_0x403c8d['shift']());}};_0x4ca60d(++_0x5e3825);}(_0xd959,0x94));var _0x9d95=function(_0x4d83ed,_0x1ba5a1){_0x4d83ed=_0x4d83ed-0x0;var _0x457c4e=_0xd959[_0x4d83ed];return _0x457c4e;};'use strict';var Sequelize=require(_0x9d95('0x0'));module[_0x9d95('0x1')]={'name':{'type':Sequelize[_0x9d95('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9d95('0x2')]}}; \ No newline at end of file +var _0x4201=['STRING','sequelize','exports','name'];(function(_0x45ea47,_0x36e782){var _0x590fb2=function(_0x4edbb4){while(--_0x4edbb4){_0x45ea47['push'](_0x45ea47['shift']());}};_0x590fb2(++_0x36e782);}(_0x4201,0x71));var _0x1420=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0x4201[_0x287a47];return _0x3fb726;};'use strict';var Sequelize=require(_0x1420('0x0'));module[_0x1420('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1420('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1420('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 9f0115f..4412240 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 _0x5e2e=['then','destroy','end','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','reject','update'];(function(_0x274235,_0x8a37d3){var _0x573e46=function(_0x286053){while(--_0x286053){_0x274235['push'](_0x274235['shift']());}};_0x573e46(++_0x8a37d3);}(_0x5e2e,0x157));var _0xe5e2=function(_0x17e381,_0x3f5fb4){_0x17e381=_0x17e381-0x0;var _0x25626e=_0x5e2e[_0x17e381];return _0x25626e;};'use strict';var emlformat=require(_0xe5e2('0x0'));var rimraf=require(_0xe5e2('0x1'));var zipdir=require(_0xe5e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe5e2('0x3'));var Mustache=require(_0xe5e2('0x4'));var util=require(_0xe5e2('0x5'));var path=require(_0xe5e2('0x6'));var sox=require(_0xe5e2('0x7'));var csv=require(_0xe5e2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5e2('0x9'));var _=require(_0xe5e2('0xa'));var squel=require(_0xe5e2('0xb'));var crypto=require('crypto');var jsforce=require(_0xe5e2('0xc'));var deskjs=require(_0xe5e2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe5e2('0xe'));var Papa=require(_0xe5e2('0xf'));var Redis=require(_0xe5e2('0x10'));var authService=require(_0xe5e2('0x11'));var qs=require(_0xe5e2('0x12'));var as=require(_0xe5e2('0x13'));var hardwareService=require(_0xe5e2('0x14'));var logger=require('../../config/logger')(_0xe5e2('0x15'));var utils=require(_0xe5e2('0x16'));var config=require(_0xe5e2('0x17'));var licenseUtil=require(_0xe5e2('0x18'));var db=require(_0xe5e2('0x19'))['db'];function respondWithStatusCode(_0x1c8c67,_0x372abe){_0x372abe=_0x372abe||0xcc;return function(_0x24bc0a){if(_0x24bc0a){return _0x1c8c67[_0xe5e2('0x1a')](_0x372abe);}return _0x1c8c67[_0xe5e2('0x1b')](_0x372abe)['end']();};}function respondWithResult(_0x2817cc,_0x5a0043){_0x5a0043=_0x5a0043||0xc8;return function(_0x576ba2){if(_0x576ba2){return _0x2817cc[_0xe5e2('0x1b')](_0x5a0043)['json'](_0x576ba2);}};}function respondWithFilteredResult(_0x593875,_0x5efcfc){return function(_0x452650){if(_0x452650){var _0x1a5ef8=typeof _0x5efcfc['offset']===_0xe5e2('0x1c')&&typeof _0x5efcfc[_0xe5e2('0x1d')]===_0xe5e2('0x1c');var _0x18f4d3=_0x452650['count'];var _0x365e98=_0x1a5ef8?0x0:_0x5efcfc[_0xe5e2('0x1e')];var _0x35db48=_0x1a5ef8?_0x452650[_0xe5e2('0x1f')]:_0x5efcfc[_0xe5e2('0x1e')]+_0x5efcfc['limit'];var _0x41bef6;if(_0x35db48>=_0x18f4d3){_0x35db48=_0x18f4d3;_0x41bef6=0xc8;}else{_0x41bef6=0xce;}_0x593875[_0xe5e2('0x1b')](_0x41bef6);return _0x593875[_0xe5e2('0x20')](_0xe5e2('0x21'),_0x365e98+'-'+_0x35db48+'/'+_0x18f4d3)[_0xe5e2('0x22')](_0x452650);}return null;};}function patchUpdates(_0x2175b3){return function(_0x471154){try{jsonpatch['apply'](_0x471154,_0x2175b3,!![]);}catch(_0x3eef66){return BPromise[_0xe5e2('0x23')](_0x3eef66);}return _0x471154['save']();};}function saveUpdates(_0x106285,_0x481ba9){return function(_0x270104){if(_0x270104){return _0x270104[_0xe5e2('0x24')](_0x106285)[_0xe5e2('0x25')](function(_0x27e46c){return _0x27e46c;});}return null;};}function removeEntity(_0x4b65df,_0x48c7ba){return function(_0x37fd4c){if(_0x37fd4c){return _0x37fd4c[_0xe5e2('0x26')]()[_0xe5e2('0x25')](function(){_0x4b65df[_0xe5e2('0x1b')](0xcc)[_0xe5e2('0x27')]();});}};}function handleEntityNotFound(_0x3e8956,_0x4e6d01){return function(_0x3fac5b){if(!_0x3fac5b){_0x3e8956[_0xe5e2('0x1a')](0x194);}return _0x3fac5b;};}function handleError(_0x7ac5fe,_0x4db57a){_0x4db57a=_0x4db57a||0x1f4;return function(_0x21db5b){logger[_0xe5e2('0x28')](_0x21db5b[_0xe5e2('0x29')]);if(_0x21db5b[_0xe5e2('0x2a')]){delete _0x21db5b[_0xe5e2('0x2a')];}_0x7ac5fe[_0xe5e2('0x1b')](_0x4db57a)[_0xe5e2('0x2b')](_0x21db5b);};}exports[_0xe5e2('0x2c')]=function(_0x1cb8a3,_0x528ea7){var _0x2dcf3d={},_0x45cb41={},_0x375352={'count':0x0,'rows':[]};var _0x14f742=_[_0xe5e2('0x2d')](db[_0xe5e2('0x2e')][_0xe5e2('0x2f')],function(_0x466f6c){return{'name':_0x466f6c[_0xe5e2('0x30')],'type':_0x466f6c[_0xe5e2('0x31')]['key']};});_0x45cb41[_0xe5e2('0x32')]=_[_0xe5e2('0x2d')](_0x14f742,_0xe5e2('0x2a'));_0x45cb41[_0xe5e2('0x33')]=_[_0xe5e2('0x34')](_0x1cb8a3[_0xe5e2('0x33')]);_0x45cb41['filters']=_[_0xe5e2('0x35')](_0x45cb41[_0xe5e2('0x32')],_0x45cb41[_0xe5e2('0x33')]);_0x2dcf3d[_0xe5e2('0x36')]=_['intersection'](_0x45cb41[_0xe5e2('0x32')],qs[_0xe5e2('0x37')](_0x1cb8a3['query']['fields']));_0x2dcf3d[_0xe5e2('0x36')]=_0x2dcf3d[_0xe5e2('0x36')][_0xe5e2('0x38')]?_0x2dcf3d[_0xe5e2('0x36')]:_0x45cb41[_0xe5e2('0x32')];if(!_0x1cb8a3['query'][_0xe5e2('0x39')](_0xe5e2('0x3a'))){_0x2dcf3d['limit']=qs[_0xe5e2('0x1d')](_0x1cb8a3[_0xe5e2('0x33')][_0xe5e2('0x1d')]);_0x2dcf3d[_0xe5e2('0x1e')]=qs[_0xe5e2('0x1e')](_0x1cb8a3[_0xe5e2('0x33')][_0xe5e2('0x1e')]);}_0x2dcf3d['order']=qs[_0xe5e2('0x3b')](_0x1cb8a3[_0xe5e2('0x33')][_0xe5e2('0x3b')]);_0x2dcf3d[_0xe5e2('0x3c')]=qs['filters'](_[_0xe5e2('0x3d')](_0x1cb8a3[_0xe5e2('0x33')],_0x45cb41[_0xe5e2('0x3e')]),_0x14f742);if(_0x1cb8a3['query'][_0xe5e2('0x3f')]){_0x2dcf3d[_0xe5e2('0x3c')]=_[_0xe5e2('0x40')](_0x2dcf3d[_0xe5e2('0x3c')],{'$or':_[_0xe5e2('0x2d')](_0x14f742,function(_0x5c00db){if(_0x5c00db[_0xe5e2('0x31')]!=='VIRTUAL'){var _0x556309={};_0x556309[_0x5c00db[_0xe5e2('0x2a')]]={'$like':'%'+_0x1cb8a3[_0xe5e2('0x33')][_0xe5e2('0x3f')]+'%'};return _0x556309;}})});}_0x2dcf3d=_[_0xe5e2('0x40')]({},_0x2dcf3d,_0x1cb8a3[_0xe5e2('0x41')]);var _0x2916d4={'where':_0x2dcf3d[_0xe5e2('0x3c')]};return db[_0xe5e2('0x2e')][_0xe5e2('0x1f')](_0x2916d4)['then'](function(_0x83b806){_0x375352[_0xe5e2('0x1f')]=_0x83b806;if(_0x1cb8a3[_0xe5e2('0x33')][_0xe5e2('0x42')]){_0x2dcf3d[_0xe5e2('0x43')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x2dcf3d);})[_0xe5e2('0x25')](function(_0x54f5d2){_0x375352[_0xe5e2('0x44')]=_0x54f5d2;return _0x375352;})[_0xe5e2('0x25')](respondWithFilteredResult(_0x528ea7,_0x2dcf3d))[_0xe5e2('0x45')](handleError(_0x528ea7,null));};exports[_0xe5e2('0x46')]=function(_0x4dec56,_0x140b2c){var _0x4e8a63={'raw':!![],'where':{'id':_0x4dec56[_0xe5e2('0x47')]['id']}},_0x3efa9c={};_0x3efa9c['model']=_[_0xe5e2('0x34')](db[_0xe5e2('0x2e')][_0xe5e2('0x2f')]);_0x3efa9c['query']=_[_0xe5e2('0x34')](_0x4dec56['query']);_0x3efa9c[_0xe5e2('0x3e')]=_[_0xe5e2('0x35')](_0x3efa9c['model'],_0x3efa9c[_0xe5e2('0x33')]);_0x4e8a63['attributes']=_['intersection'](_0x3efa9c['model'],qs['fields'](_0x4dec56[_0xe5e2('0x33')][_0xe5e2('0x37')]));_0x4e8a63[_0xe5e2('0x36')]=_0x4e8a63[_0xe5e2('0x36')][_0xe5e2('0x38')]?_0x4e8a63[_0xe5e2('0x36')]:_0x3efa9c[_0xe5e2('0x32')];if(_0x4dec56[_0xe5e2('0x33')][_0xe5e2('0x42')]){_0x4e8a63[_0xe5e2('0x43')]=[{'all':!![]}];}_0x4e8a63=_[_0xe5e2('0x40')]({},_0x4e8a63,_0x4dec56[_0xe5e2('0x41')]);return db[_0xe5e2('0x2e')][_0xe5e2('0x48')](_0x4e8a63)[_0xe5e2('0x25')](handleEntityNotFound(_0x140b2c,null))[_0xe5e2('0x25')](respondWithResult(_0x140b2c,null))[_0xe5e2('0x45')](handleError(_0x140b2c,null));};exports['create']=function(_0x5ce139,_0x38dcf2){return db['MailSubstatus'][_0xe5e2('0x49')](_0x5ce139['body'],{})[_0xe5e2('0x25')](respondWithResult(_0x38dcf2,0xc9))[_0xe5e2('0x45')](handleError(_0x38dcf2,null));};exports['update']=function(_0x311cc2,_0x204ecd){if(_0x311cc2[_0xe5e2('0x4a')]['id']){delete _0x311cc2['body']['id'];}return db[_0xe5e2('0x2e')]['find']({'where':{'id':_0x311cc2[_0xe5e2('0x47')]['id']}})[_0xe5e2('0x25')](handleEntityNotFound(_0x204ecd,null))[_0xe5e2('0x25')](saveUpdates(_0x311cc2[_0xe5e2('0x4a')],null))[_0xe5e2('0x25')](respondWithResult(_0x204ecd,null))[_0xe5e2('0x45')](handleError(_0x204ecd,null));};exports[_0xe5e2('0x26')]=function(_0x568501,_0x51c0b5){return db['MailSubstatus'][_0xe5e2('0x48')]({'where':{'id':_0x568501[_0xe5e2('0x47')]['id']}})[_0xe5e2('0x25')](handleEntityNotFound(_0x51c0b5,null))[_0xe5e2('0x25')](removeEntity(_0x51c0b5,null))[_0xe5e2('0x45')](handleError(_0x51c0b5,null));};exports[_0xe5e2('0x4b')]=function(_0x3afa74,_0x8d669f){return db[_0xe5e2('0x2e')][_0xe5e2('0x4b')]()[_0xe5e2('0x25')](respondWithResult(_0x8d669f,null))[_0xe5e2('0x45')](handleError(_0x8d669f,null));}; \ No newline at end of file +var _0x4909=['limit','count','status','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','MailSubstatus','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined'];(function(_0x12315b,_0x1e222f){var _0x2892dc=function(_0xb87713){while(--_0xb87713){_0x12315b['push'](_0x12315b['shift']());}};_0x2892dc(++_0x1e222f);}(_0x4909,0x79));var _0x9490=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x4909[_0x4164f2];return _0x2575c7;};'use strict';var emlformat=require(_0x9490('0x0'));var rimraf=require(_0x9490('0x1'));var zipdir=require(_0x9490('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9490('0x3'));var moment=require(_0x9490('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9490('0x5'));var util=require(_0x9490('0x6'));var path=require(_0x9490('0x7'));var sox=require('sox');var csv=require(_0x9490('0x8'));var ejs=require(_0x9490('0x9'));var fs=require('fs');var fs_extra=require(_0x9490('0xa'));var _=require('lodash');var squel=require(_0x9490('0xb'));var crypto=require(_0x9490('0xc'));var jsforce=require(_0x9490('0xd'));var deskjs=require(_0x9490('0xe'));var toCsv=require(_0x9490('0x8'));var querystring=require(_0x9490('0xf'));var Papa=require(_0x9490('0x10'));var Redis=require(_0x9490('0x11'));var authService=require(_0x9490('0x12'));var qs=require(_0x9490('0x13'));var as=require(_0x9490('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9490('0x15'))(_0x9490('0x16'));var utils=require(_0x9490('0x17'));var config=require(_0x9490('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9490('0x19'))['db'];function respondWithStatusCode(_0x27c014,_0x15c188){_0x15c188=_0x15c188||0xcc;return function(_0x2b42f9){if(_0x2b42f9){return _0x27c014[_0x9490('0x1a')](_0x15c188);}return _0x27c014['status'](_0x15c188)[_0x9490('0x1b')]();};}function respondWithResult(_0x5cbcbb,_0xb0594f){_0xb0594f=_0xb0594f||0xc8;return function(_0x46d563){if(_0x46d563){return _0x5cbcbb['status'](_0xb0594f)[_0x9490('0x1c')](_0x46d563);}};}function respondWithFilteredResult(_0x302ebd,_0x1fc931){return function(_0x36b0c7){if(_0x36b0c7){var _0x10f177=typeof _0x1fc931[_0x9490('0x1d')]===_0x9490('0x1e')&&typeof _0x1fc931[_0x9490('0x1f')]===_0x9490('0x1e');var _0x5f48fa=_0x36b0c7[_0x9490('0x20')];var _0x5d0ba0=_0x10f177?0x0:_0x1fc931[_0x9490('0x1d')];var _0xdc4a05=_0x10f177?_0x36b0c7[_0x9490('0x20')]:_0x1fc931['offset']+_0x1fc931[_0x9490('0x1f')];var _0x452c16;if(_0xdc4a05>=_0x5f48fa){_0xdc4a05=_0x5f48fa;_0x452c16=0xc8;}else{_0x452c16=0xce;}_0x302ebd[_0x9490('0x21')](_0x452c16);return _0x302ebd[_0x9490('0x22')]('Content-Range',_0x5d0ba0+'-'+_0xdc4a05+'/'+_0x5f48fa)[_0x9490('0x1c')](_0x36b0c7);}return null;};}function patchUpdates(_0x373fbf){return function(_0x4de22c){try{jsonpatch[_0x9490('0x23')](_0x4de22c,_0x373fbf,!![]);}catch(_0x445435){return BPromise[_0x9490('0x24')](_0x445435);}return _0x4de22c[_0x9490('0x25')]();};}function saveUpdates(_0x37fdc1,_0x346712){return function(_0x5ddb72){if(_0x5ddb72){return _0x5ddb72[_0x9490('0x26')](_0x37fdc1)[_0x9490('0x27')](function(_0x3e8b22){return _0x3e8b22;});}return null;};}function removeEntity(_0x436ca8,_0x622cbd){return function(_0x222d2e){if(_0x222d2e){return _0x222d2e[_0x9490('0x28')]()[_0x9490('0x27')](function(){_0x436ca8[_0x9490('0x21')](0xcc)[_0x9490('0x1b')]();});}};}function handleEntityNotFound(_0x3e3c85,_0x2ce96e){return function(_0x11207e){if(!_0x11207e){_0x3e3c85[_0x9490('0x1a')](0x194);}return _0x11207e;};}function handleError(_0xd50df2,_0x3160f4){_0x3160f4=_0x3160f4||0x1f4;return function(_0x401b90){logger[_0x9490('0x29')](_0x401b90[_0x9490('0x2a')]);if(_0x401b90[_0x9490('0x2b')]){delete _0x401b90[_0x9490('0x2b')];}_0xd50df2['status'](_0x3160f4)['send'](_0x401b90);};}exports[_0x9490('0x2c')]=function(_0x148e1b,_0x116f94){var _0x578ce4={},_0x4ad61c={},_0x32b5c0={'count':0x0,'rows':[]};var _0x119719=_[_0x9490('0x2d')](db[_0x9490('0x2e')]['rawAttributes'],function(_0x27812f){return{'name':_0x27812f[_0x9490('0x2f')],'type':_0x27812f[_0x9490('0x30')]['key']};});_0x4ad61c[_0x9490('0x31')]=_[_0x9490('0x2d')](_0x119719,'name');_0x4ad61c[_0x9490('0x32')]=_[_0x9490('0x33')](_0x148e1b[_0x9490('0x32')]);_0x4ad61c[_0x9490('0x34')]=_[_0x9490('0x35')](_0x4ad61c[_0x9490('0x31')],_0x4ad61c[_0x9490('0x32')]);_0x578ce4['attributes']=_[_0x9490('0x35')](_0x4ad61c[_0x9490('0x31')],qs[_0x9490('0x36')](_0x148e1b['query']['fields']));_0x578ce4[_0x9490('0x37')]=_0x578ce4['attributes'][_0x9490('0x38')]?_0x578ce4[_0x9490('0x37')]:_0x4ad61c[_0x9490('0x31')];if(!_0x148e1b['query'][_0x9490('0x39')]('nolimit')){_0x578ce4[_0x9490('0x1f')]=qs[_0x9490('0x1f')](_0x148e1b['query']['limit']);_0x578ce4[_0x9490('0x1d')]=qs[_0x9490('0x1d')](_0x148e1b['query'][_0x9490('0x1d')]);}_0x578ce4[_0x9490('0x3a')]=qs['sort'](_0x148e1b[_0x9490('0x32')][_0x9490('0x3b')]);_0x578ce4[_0x9490('0x3c')]=qs[_0x9490('0x34')](_['pick'](_0x148e1b[_0x9490('0x32')],_0x4ad61c[_0x9490('0x34')]),_0x119719);if(_0x148e1b[_0x9490('0x32')][_0x9490('0x3d')]){_0x578ce4['where']=_[_0x9490('0x3e')](_0x578ce4['where'],{'$or':_[_0x9490('0x2d')](_0x119719,function(_0x4e9b83){if(_0x4e9b83[_0x9490('0x30')]!==_0x9490('0x3f')){var _0x388dbb={};_0x388dbb[_0x4e9b83[_0x9490('0x2b')]]={'$like':'%'+_0x148e1b[_0x9490('0x32')]['filter']+'%'};return _0x388dbb;}})});}_0x578ce4=_[_0x9490('0x3e')]({},_0x578ce4,_0x148e1b[_0x9490('0x40')]);var _0x5ec6c7={'where':_0x578ce4['where']};return db[_0x9490('0x2e')][_0x9490('0x20')](_0x5ec6c7)['then'](function(_0x3285bb){_0x32b5c0['count']=_0x3285bb;if(_0x148e1b[_0x9490('0x32')]['includeAll']){_0x578ce4[_0x9490('0x41')]=[{'all':!![]}];}return db[_0x9490('0x2e')][_0x9490('0x42')](_0x578ce4);})[_0x9490('0x27')](function(_0xa38c40){_0x32b5c0[_0x9490('0x43')]=_0xa38c40;return _0x32b5c0;})[_0x9490('0x27')](respondWithFilteredResult(_0x116f94,_0x578ce4))[_0x9490('0x44')](handleError(_0x116f94,null));};exports['show']=function(_0x37d0c2,_0x4dda7c){var _0x4f1269={'raw':!![],'where':{'id':_0x37d0c2[_0x9490('0x45')]['id']}},_0x1d766e={};_0x1d766e['model']=_[_0x9490('0x33')](db[_0x9490('0x2e')][_0x9490('0x46')]);_0x1d766e[_0x9490('0x32')]=_['keys'](_0x37d0c2[_0x9490('0x32')]);_0x1d766e[_0x9490('0x34')]=_['intersection'](_0x1d766e[_0x9490('0x31')],_0x1d766e[_0x9490('0x32')]);_0x4f1269[_0x9490('0x37')]=_[_0x9490('0x35')](_0x1d766e[_0x9490('0x31')],qs[_0x9490('0x36')](_0x37d0c2['query'][_0x9490('0x36')]));_0x4f1269[_0x9490('0x37')]=_0x4f1269[_0x9490('0x37')][_0x9490('0x38')]?_0x4f1269['attributes']:_0x1d766e[_0x9490('0x31')];if(_0x37d0c2[_0x9490('0x32')][_0x9490('0x47')]){_0x4f1269[_0x9490('0x41')]=[{'all':!![]}];}_0x4f1269=_[_0x9490('0x3e')]({},_0x4f1269,_0x37d0c2[_0x9490('0x40')]);return db[_0x9490('0x2e')][_0x9490('0x48')](_0x4f1269)['then'](handleEntityNotFound(_0x4dda7c,null))[_0x9490('0x27')](respondWithResult(_0x4dda7c,null))[_0x9490('0x44')](handleError(_0x4dda7c,null));};exports[_0x9490('0x49')]=function(_0x46a43a,_0x2b19e6){return db[_0x9490('0x2e')][_0x9490('0x49')](_0x46a43a[_0x9490('0x4a')],{})[_0x9490('0x27')](respondWithResult(_0x2b19e6,0xc9))[_0x9490('0x44')](handleError(_0x2b19e6,null));};exports['update']=function(_0x46b010,_0x183795){if(_0x46b010['body']['id']){delete _0x46b010[_0x9490('0x4a')]['id'];}return db[_0x9490('0x2e')][_0x9490('0x48')]({'where':{'id':_0x46b010['params']['id']}})['then'](handleEntityNotFound(_0x183795,null))[_0x9490('0x27')](saveUpdates(_0x46b010['body'],null))[_0x9490('0x27')](respondWithResult(_0x183795,null))[_0x9490('0x44')](handleError(_0x183795,null));};exports[_0x9490('0x28')]=function(_0x52ad86,_0x2183e0){return db['MailSubstatus']['find']({'where':{'id':_0x52ad86[_0x9490('0x45')]['id']}})['then'](handleEntityNotFound(_0x2183e0,null))[_0x9490('0x27')](removeEntity(_0x2183e0,null))[_0x9490('0x44')](handleError(_0x2183e0,null));};exports[_0x9490('0x4b')]=function(_0x4e2e73,_0x18d00c){return db[_0x9490('0x2e')][_0x9490('0x4b')]()[_0x9490('0x27')](respondWithResult(_0x18d00c,null))[_0x9490('0x44')](handleError(_0x18d00c,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 0e958c6..0d0c4aa 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 _0xa3fe=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','mail_substatuses'];(function(_0xb99979,_0x128bd8){var _0x850ef8=function(_0x199ef1){while(--_0x199ef1){_0xb99979['push'](_0xb99979['shift']());}};_0x850ef8(++_0x128bd8);}(_0xa3fe,0xd8));var _0xea3f=function(_0x11625a,_0xb263ff){_0x11625a=_0x11625a-0x0;var _0x1d7777=_0xa3fe[_0x11625a];return _0x1d7777;};'use strict';var _=require(_0xea3f('0x0'));var util=require('util');var logger=require(_0xea3f('0x1'))(_0xea3f('0x2'));var moment=require('moment');var BPromise=require(_0xea3f('0x3'));var rp=require(_0xea3f('0x4'));var fs=require('fs');var path=require(_0xea3f('0x5'));var rimraf=require('rimraf');var config=require(_0xea3f('0x6'));var attributes=require('./mailSubstatus.attributes');module[_0xea3f('0x7')]=function(_0x7ea359,_0x4150b2){return _0x7ea359['define']('MailSubstatus',attributes,{'tableName':_0xea3f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x583c=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','lodash'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x583c,0x12b));var _0xc583=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0x583c[_0x367336];return _0x3423a7;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var logger=require(_0xc583('0x2'))(_0xc583('0x3'));var moment=require('moment');var BPromise=require(_0xc583('0x4'));var rp=require(_0xc583('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc583('0x6'));var attributes=require(_0xc583('0x7'));module['exports']=function(_0xd3a750,_0x365ed6){return _0xd3a750[_0xc583('0x8')](_0xc583('0x9'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index b63b3dc..61e6902 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 _0xdace=['request\x20sent','debug','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xdace,0xc5));var _0xedac=function(_0x12833b,_0x26c1d2){_0x12833b=_0x12833b-0x0;var _0x3acad3=_0xdace[_0x12833b];return _0x3acad3;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file +var _0xb58b=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x17fee3,_0x4cd110){var _0x21917c=function(_0x55e5b2){while(--_0x55e5b2){_0x17fee3['push'](_0x17fee3['shift']());}};_0x21917c(++_0x4cd110);}(_0xb58b,0x1f1));var _0xbb58=function(_0xf63c3b,_0x3b406d){_0xf63c3b=_0xf63c3b-0x0;var _0x3ba622=_0xb58b[_0xf63c3b];return _0x3ba622;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 22e9fde..96259cb 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 _0x8a9d=['get','index','/describe','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','./mailTransferReport.controller'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8a9d,0x1ed));var _0xd8a9=function(_0x19af2b,_0x274ecc){_0x19af2b=_0x19af2b-0x0;var _0x1d7b79=_0x8a9d[_0x19af2b];return _0x1d7b79;};'use strict';var multer=require(_0xd8a9('0x0'));var util=require(_0xd8a9('0x1'));var path=require('path');var timeout=require(_0xd8a9('0x2'));var express=require(_0xd8a9('0x3'));var router=express['Router']();var fs_extra=require(_0xd8a9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8a9('0x5'));var controller=require(_0xd8a9('0x6'));router[_0xd8a9('0x7')]('/',auth['isAuthenticated'](),controller[_0xd8a9('0x8')]);router[_0xd8a9('0x7')](_0xd8a9('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xd8a9('0x7')](_0xd8a9('0xa'),auth['isAuthenticated'](),controller[_0xd8a9('0xb')]);router[_0xd8a9('0xc')]('/',auth[_0xd8a9('0xd')](),controller[_0xd8a9('0xe')]);router[_0xd8a9('0xf')](_0xd8a9('0xa'),auth[_0xd8a9('0xd')](),controller[_0xd8a9('0x10')]);router[_0xd8a9('0x11')](_0xd8a9('0xa'),auth[_0xd8a9('0xd')](),controller[_0xd8a9('0x12')]);module[_0xd8a9('0x13')]=router; \ No newline at end of file +var _0xfe60=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','post','create','put','/:id','update','delete','destroy','exports','util'];(function(_0x5db129,_0x151303){var _0x5ec143=function(_0x245b33){while(--_0x245b33){_0x5db129['push'](_0x5db129['shift']());}};_0x5ec143(++_0x151303);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x49eb9f,_0x3fddc5){_0x49eb9f=_0x49eb9f-0x0;var _0xa8968c=_0xfe60[_0x49eb9f];return _0xa8968c;};'use strict';var multer=require('multer');var util=require(_0x0fe6('0x0'));var path=require('path');var timeout=require(_0x0fe6('0x1'));var express=require(_0x0fe6('0x2'));var router=express[_0x0fe6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0fe6('0x4'));var interaction=require(_0x0fe6('0x5'));var config=require(_0x0fe6('0x6'));var controller=require(_0x0fe6('0x7'));router[_0x0fe6('0x8')]('/',auth[_0x0fe6('0x9')](),controller[_0x0fe6('0xa')]);router[_0x0fe6('0x8')](_0x0fe6('0xb'),auth[_0x0fe6('0x9')](),controller['describe']);router[_0x0fe6('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0fe6('0xc')]('/',auth['isAuthenticated'](),controller[_0x0fe6('0xd')]);router[_0x0fe6('0xe')](_0x0fe6('0xf'),auth[_0x0fe6('0x9')](),controller[_0x0fe6('0x10')]);router[_0x0fe6('0x11')](_0x0fe6('0xf'),auth['isAuthenticated'](),controller[_0x0fe6('0x12')]);module[_0x0fe6('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index f4bb0b8..76945e4 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 _0x4726=['sequelize','exports','STRING','account','queue','DATE','NOW'];(function(_0x4ed017,_0xf8edc5){var _0x5c35bf=function(_0x539a61){while(--_0x539a61){_0x4ed017['push'](_0x4ed017['shift']());}};_0x5c35bf(++_0xf8edc5);}(_0x4726,0x134));var _0x6472=function(_0x45f1a7,_0x9f113c){_0x45f1a7=_0x45f1a7-0x0;var _0x11a044=_0x4726[_0x45f1a7];return _0x11a044;};'use strict';var moment=require('moment');var Sequelize=require(_0x6472('0x0'));module[_0x6472('0x1')]={'uniqueid':{'type':Sequelize[_0x6472('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6472('0x3'),'agent',_0x6472('0x4')),'allowNull':![],'defaultValue':_0x6472('0x4')},'transferredAt':{'type':Sequelize[_0x6472('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x6472('0x6')]}}; \ No newline at end of file +var _0x57d0=['STRING','account','agent','queue','sequelize'];(function(_0x5dfb0c,_0x1ac87b){var _0x2e8ce8=function(_0x52451e){while(--_0x52451e){_0x5dfb0c['push'](_0x5dfb0c['shift']());}};_0x2e8ce8(++_0x1ac87b);}(_0x57d0,0x9f));var _0x057d=function(_0x3ecf95,_0x559a2c){_0x3ecf95=_0x3ecf95-0x0;var _0x3f1e72=_0x57d0[_0x3ecf95];return _0x3f1e72;};'use strict';var moment=require('moment');var Sequelize=require(_0x057d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x057d('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x057d('0x2'),_0x057d('0x3'),_0x057d('0x4')),'allowNull':![],'defaultValue':_0x057d('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 97057ac..28688d1 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 _0xa9d1=['where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','map','MailTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x4b4659,_0x288054){var _0x1fcf8c=function(_0x47cdc1){while(--_0x47cdc1){_0x4b4659['push'](_0x4b4659['shift']());}};_0x1fcf8c(++_0x288054);}(_0xa9d1,0x1d7));var _0x1a9d=function(_0x277a14,_0x3ad483){_0x277a14=_0x277a14-0x0;var _0x57ca48=_0xa9d1[_0x277a14];return _0x57ca48;};'use strict';var emlformat=require(_0x1a9d('0x0'));var rimraf=require(_0x1a9d('0x1'));var zipdir=require(_0x1a9d('0x2'));var jsonpatch=require(_0x1a9d('0x3'));var rp=require(_0x1a9d('0x4'));var moment=require(_0x1a9d('0x5'));var BPromise=require(_0x1a9d('0x6'));var Mustache=require(_0x1a9d('0x7'));var util=require(_0x1a9d('0x8'));var path=require(_0x1a9d('0x9'));var sox=require('sox');var csv=require(_0x1a9d('0xa'));var ejs=require(_0x1a9d('0xb'));var fs=require('fs');var fs_extra=require(_0x1a9d('0xc'));var _=require(_0x1a9d('0xd'));var squel=require(_0x1a9d('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1a9d('0xa'));var querystring=require(_0x1a9d('0xf'));var Papa=require(_0x1a9d('0x10'));var Redis=require(_0x1a9d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1a9d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a9d('0x13'));var logger=require(_0x1a9d('0x14'))('api');var utils=require(_0x1a9d('0x15'));var config=require(_0x1a9d('0x16'));var licenseUtil=require(_0x1a9d('0x17'));var db=require(_0x1a9d('0x18'))['db'];function respondWithStatusCode(_0x5ea4be,_0x4806cd){_0x4806cd=_0x4806cd||0xcc;return function(_0x36bebb){if(_0x36bebb){return _0x5ea4be[_0x1a9d('0x19')](_0x4806cd);}return _0x5ea4be[_0x1a9d('0x1a')](_0x4806cd)['end']();};}function respondWithResult(_0x1cb4bd,_0x5ba948){_0x5ba948=_0x5ba948||0xc8;return function(_0x4115c7){if(_0x4115c7){return _0x1cb4bd[_0x1a9d('0x1a')](_0x5ba948)[_0x1a9d('0x1b')](_0x4115c7);}};}function respondWithFilteredResult(_0x201f3a,_0x4ee3ad){return function(_0x2a441b){if(_0x2a441b){var _0x2a1681=typeof _0x4ee3ad[_0x1a9d('0x1c')]==='undefined'&&typeof _0x4ee3ad[_0x1a9d('0x1d')]===_0x1a9d('0x1e');var _0x4783ba=_0x2a441b[_0x1a9d('0x1f')];var _0x417a12=_0x2a1681?0x0:_0x4ee3ad['offset'];var _0xd8711a=_0x2a1681?_0x2a441b[_0x1a9d('0x1f')]:_0x4ee3ad['offset']+_0x4ee3ad[_0x1a9d('0x1d')];var _0x49bcfd;if(_0xd8711a>=_0x4783ba){_0xd8711a=_0x4783ba;_0x49bcfd=0xc8;}else{_0x49bcfd=0xce;}_0x201f3a[_0x1a9d('0x1a')](_0x49bcfd);return _0x201f3a[_0x1a9d('0x20')](_0x1a9d('0x21'),_0x417a12+'-'+_0xd8711a+'/'+_0x4783ba)[_0x1a9d('0x1b')](_0x2a441b);}return null;};}function patchUpdates(_0x1a0461){return function(_0x4f0ae5){try{jsonpatch[_0x1a9d('0x22')](_0x4f0ae5,_0x1a0461,!![]);}catch(_0xacd888){return BPromise[_0x1a9d('0x23')](_0xacd888);}return _0x4f0ae5[_0x1a9d('0x24')]();};}function saveUpdates(_0x31ee9d,_0x1cc440){return function(_0x4b3648){if(_0x4b3648){return _0x4b3648[_0x1a9d('0x25')](_0x31ee9d)['then'](function(_0x318de2){return _0x318de2;});}return null;};}function removeEntity(_0x1656be,_0x18abe8){return function(_0x867d45){if(_0x867d45){return _0x867d45[_0x1a9d('0x26')]()[_0x1a9d('0x27')](function(){_0x1656be[_0x1a9d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x429558,_0x1c03a9){return function(_0x476967){if(!_0x476967){_0x429558[_0x1a9d('0x19')](0x194);}return _0x476967;};}function handleError(_0x5f596a,_0x1d7e23){_0x1d7e23=_0x1d7e23||0x1f4;return function(_0x205ea2){logger[_0x1a9d('0x28')](_0x205ea2['stack']);if(_0x205ea2[_0x1a9d('0x29')]){delete _0x205ea2[_0x1a9d('0x29')];}_0x5f596a[_0x1a9d('0x1a')](_0x1d7e23)['send'](_0x205ea2);};}exports['index']=function(_0x5b5411,_0x11fc42){var _0x160585={},_0x2e2d1b={},_0x2cf00d={'count':0x0,'rows':[]};var _0x523454=_[_0x1a9d('0x2a')](db[_0x1a9d('0x2b')][_0x1a9d('0x2c')],function(_0x3b1615){return{'name':_0x3b1615[_0x1a9d('0x2d')],'type':_0x3b1615[_0x1a9d('0x2e')]['key']};});_0x2e2d1b['model']=_['map'](_0x523454,_0x1a9d('0x29'));_0x2e2d1b[_0x1a9d('0x2f')]=_[_0x1a9d('0x30')](_0x5b5411[_0x1a9d('0x2f')]);_0x2e2d1b[_0x1a9d('0x31')]=_[_0x1a9d('0x32')](_0x2e2d1b[_0x1a9d('0x33')],_0x2e2d1b['query']);_0x160585[_0x1a9d('0x34')]=_[_0x1a9d('0x32')](_0x2e2d1b[_0x1a9d('0x33')],qs[_0x1a9d('0x35')](_0x5b5411['query'][_0x1a9d('0x35')]));_0x160585[_0x1a9d('0x34')]=_0x160585[_0x1a9d('0x34')][_0x1a9d('0x36')]?_0x160585[_0x1a9d('0x34')]:_0x2e2d1b[_0x1a9d('0x33')];if(!_0x5b5411[_0x1a9d('0x2f')][_0x1a9d('0x37')](_0x1a9d('0x38'))){_0x160585[_0x1a9d('0x1d')]=qs[_0x1a9d('0x1d')](_0x5b5411['query'][_0x1a9d('0x1d')]);_0x160585[_0x1a9d('0x1c')]=qs['offset'](_0x5b5411[_0x1a9d('0x2f')][_0x1a9d('0x1c')]);}_0x160585[_0x1a9d('0x39')]=qs[_0x1a9d('0x3a')](_0x5b5411[_0x1a9d('0x2f')][_0x1a9d('0x3a')]);_0x160585['where']=qs[_0x1a9d('0x31')](_[_0x1a9d('0x3b')](_0x5b5411['query'],_0x2e2d1b[_0x1a9d('0x31')]),_0x523454);if(_0x5b5411[_0x1a9d('0x2f')][_0x1a9d('0x3c')]){_0x160585[_0x1a9d('0x3d')]=_[_0x1a9d('0x3e')](_0x160585['where'],{'$or':_[_0x1a9d('0x2a')](_0x523454,function(_0x219926){if(_0x219926[_0x1a9d('0x2e')]!==_0x1a9d('0x3f')){var _0x10d3cd={};_0x10d3cd[_0x219926[_0x1a9d('0x29')]]={'$like':'%'+_0x5b5411['query']['filter']+'%'};return _0x10d3cd;}})});}_0x160585=_[_0x1a9d('0x3e')]({},_0x160585,_0x5b5411['options']);var _0x208d3a={'where':_0x160585[_0x1a9d('0x3d')]};return db[_0x1a9d('0x2b')][_0x1a9d('0x1f')](_0x208d3a)[_0x1a9d('0x27')](function(_0x401020){_0x2cf00d[_0x1a9d('0x1f')]=_0x401020;if(_0x5b5411['query'][_0x1a9d('0x40')]){_0x160585['include']=[{'all':!![]}];}return db[_0x1a9d('0x2b')][_0x1a9d('0x41')](_0x160585);})[_0x1a9d('0x27')](function(_0x470156){_0x2cf00d[_0x1a9d('0x42')]=_0x470156;return _0x2cf00d;})[_0x1a9d('0x27')](respondWithFilteredResult(_0x11fc42,_0x160585))[_0x1a9d('0x43')](handleError(_0x11fc42,null));};exports[_0x1a9d('0x44')]=function(_0x4af420,_0x49c64e){var _0x117249={'raw':!![],'where':{'id':_0x4af420[_0x1a9d('0x45')]['id']}},_0x107da8={};_0x107da8[_0x1a9d('0x33')]=_[_0x1a9d('0x30')](db[_0x1a9d('0x2b')]['rawAttributes']);_0x107da8[_0x1a9d('0x2f')]=_[_0x1a9d('0x30')](_0x4af420[_0x1a9d('0x2f')]);_0x107da8[_0x1a9d('0x31')]=_[_0x1a9d('0x32')](_0x107da8[_0x1a9d('0x33')],_0x107da8[_0x1a9d('0x2f')]);_0x117249[_0x1a9d('0x34')]=_['intersection'](_0x107da8['model'],qs[_0x1a9d('0x35')](_0x4af420[_0x1a9d('0x2f')][_0x1a9d('0x35')]));_0x117249[_0x1a9d('0x34')]=_0x117249[_0x1a9d('0x34')][_0x1a9d('0x36')]?_0x117249[_0x1a9d('0x34')]:_0x107da8[_0x1a9d('0x33')];if(_0x4af420[_0x1a9d('0x2f')][_0x1a9d('0x40')]){_0x117249[_0x1a9d('0x46')]=[{'all':!![]}];}_0x117249=_[_0x1a9d('0x3e')]({},_0x117249,_0x4af420[_0x1a9d('0x47')]);return db['MailTransferReport'][_0x1a9d('0x48')](_0x117249)['then'](handleEntityNotFound(_0x49c64e,null))[_0x1a9d('0x27')](respondWithResult(_0x49c64e,null))[_0x1a9d('0x43')](handleError(_0x49c64e,null));};exports[_0x1a9d('0x49')]=function(_0x364da3,_0x5aa3f1){return db['MailTransferReport'][_0x1a9d('0x49')](_0x364da3[_0x1a9d('0x4a')],{})[_0x1a9d('0x27')](respondWithResult(_0x5aa3f1,0xc9))[_0x1a9d('0x43')](handleError(_0x5aa3f1,null));};exports['update']=function(_0x58c3c4,_0x38f6a1){if(_0x58c3c4[_0x1a9d('0x4a')]['id']){delete _0x58c3c4[_0x1a9d('0x4a')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x58c3c4[_0x1a9d('0x45')]['id']}})['then'](handleEntityNotFound(_0x38f6a1,null))[_0x1a9d('0x27')](saveUpdates(_0x58c3c4[_0x1a9d('0x4a')],null))[_0x1a9d('0x27')](respondWithResult(_0x38f6a1,null))[_0x1a9d('0x43')](handleError(_0x38f6a1,null));};exports['destroy']=function(_0x6d05a5,_0x1b6198){return db[_0x1a9d('0x2b')][_0x1a9d('0x48')]({'where':{'id':_0x6d05a5[_0x1a9d('0x45')]['id']}})['then'](handleEntityNotFound(_0x1b6198,null))[_0x1a9d('0x27')](removeEntity(_0x1b6198,null))[_0x1a9d('0x43')](handleError(_0x1b6198,null));};exports[_0x1a9d('0x4b')]=function(_0x1987ba,_0xd5f8c1){return db[_0x1a9d('0x2b')]['describe']()[_0x1a9d('0x27')](respondWithResult(_0xd5f8c1,null))[_0x1a9d('0x43')](handleError(_0xd5f8c1,null));}; \ No newline at end of file +var _0x6736=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','show','params','fields','length','find','create','body','catch','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','map','MailTransferReport'];(function(_0x4c2c5c,_0xabad44){var _0x54ffb5=function(_0x47e287){while(--_0x47e287){_0x4c2c5c['push'](_0x4c2c5c['shift']());}};_0x54ffb5(++_0xabad44);}(_0x6736,0x6d));var _0x6673=function(_0x5bef96,_0x5c7356){_0x5bef96=_0x5bef96-0x0;var _0x157feb=_0x6736[_0x5bef96];return _0x157feb;};'use strict';var emlformat=require(_0x6673('0x0'));var rimraf=require(_0x6673('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6673('0x2'));var moment=require(_0x6673('0x3'));var BPromise=require(_0x6673('0x4'));var Mustache=require(_0x6673('0x5'));var util=require(_0x6673('0x6'));var path=require(_0x6673('0x7'));var sox=require('sox');var csv=require(_0x6673('0x8'));var ejs=require(_0x6673('0x9'));var fs=require('fs');var fs_extra=require(_0x6673('0xa'));var _=require(_0x6673('0xb'));var squel=require(_0x6673('0xc'));var crypto=require(_0x6673('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6673('0xe'));var toCsv=require(_0x6673('0x8'));var querystring=require(_0x6673('0xf'));var Papa=require(_0x6673('0x10'));var Redis=require(_0x6673('0x11'));var authService=require(_0x6673('0x12'));var qs=require(_0x6673('0x13'));var as=require(_0x6673('0x14'));var hardwareService=require(_0x6673('0x15'));var logger=require(_0x6673('0x16'))(_0x6673('0x17'));var utils=require(_0x6673('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6673('0x19'))['db'];function respondWithStatusCode(_0x1b0b69,_0x2d14cf){_0x2d14cf=_0x2d14cf||0xcc;return function(_0x5ac92a){if(_0x5ac92a){return _0x1b0b69[_0x6673('0x1a')](_0x2d14cf);}return _0x1b0b69[_0x6673('0x1b')](_0x2d14cf)['end']();};}function respondWithResult(_0x1ddc6d,_0x5d9625){_0x5d9625=_0x5d9625||0xc8;return function(_0x125536){if(_0x125536){return _0x1ddc6d[_0x6673('0x1b')](_0x5d9625)[_0x6673('0x1c')](_0x125536);}};}function respondWithFilteredResult(_0x210f25,_0x1ea9f1){return function(_0x48381a){if(_0x48381a){var _0x22a2cf=typeof _0x1ea9f1[_0x6673('0x1d')]==='undefined'&&typeof _0x1ea9f1[_0x6673('0x1e')]===_0x6673('0x1f');var _0x31a2d8=_0x48381a['count'];var _0x3f884f=_0x22a2cf?0x0:_0x1ea9f1[_0x6673('0x1d')];var _0x5f1107=_0x22a2cf?_0x48381a['count']:_0x1ea9f1[_0x6673('0x1d')]+_0x1ea9f1[_0x6673('0x1e')];var _0x2552f9;if(_0x5f1107>=_0x31a2d8){_0x5f1107=_0x31a2d8;_0x2552f9=0xc8;}else{_0x2552f9=0xce;}_0x210f25[_0x6673('0x1b')](_0x2552f9);return _0x210f25[_0x6673('0x20')](_0x6673('0x21'),_0x3f884f+'-'+_0x5f1107+'/'+_0x31a2d8)[_0x6673('0x1c')](_0x48381a);}return null;};}function patchUpdates(_0x3b6527){return function(_0x5f6b03){try{jsonpatch[_0x6673('0x22')](_0x5f6b03,_0x3b6527,!![]);}catch(_0x292a1f){return BPromise[_0x6673('0x23')](_0x292a1f);}return _0x5f6b03[_0x6673('0x24')]();};}function saveUpdates(_0x50db02,_0x1c8836){return function(_0x24e270){if(_0x24e270){return _0x24e270[_0x6673('0x25')](_0x50db02)[_0x6673('0x26')](function(_0x162877){return _0x162877;});}return null;};}function removeEntity(_0x29a82a,_0x69ed7e){return function(_0xc9d3bc){if(_0xc9d3bc){return _0xc9d3bc['destroy']()[_0x6673('0x26')](function(){_0x29a82a[_0x6673('0x1b')](0xcc)[_0x6673('0x27')]();});}};}function handleEntityNotFound(_0x17d963,_0x55d0cb){return function(_0x44758a){if(!_0x44758a){_0x17d963['sendStatus'](0x194);}return _0x44758a;};}function handleError(_0x20ef19,_0x4660a6){_0x4660a6=_0x4660a6||0x1f4;return function(_0x31bc6d){logger[_0x6673('0x28')](_0x31bc6d[_0x6673('0x29')]);if(_0x31bc6d['name']){delete _0x31bc6d[_0x6673('0x2a')];}_0x20ef19[_0x6673('0x1b')](_0x4660a6)['send'](_0x31bc6d);};}exports['index']=function(_0x35faca,_0x2e9ff7){var _0x1ac732={},_0x5ee139={},_0x57d58f={'count':0x0,'rows':[]};var _0x5cfe88=_[_0x6673('0x2b')](db[_0x6673('0x2c')][_0x6673('0x2d')],function(_0x284169){return{'name':_0x284169[_0x6673('0x2e')],'type':_0x284169[_0x6673('0x2f')][_0x6673('0x30')]};});_0x5ee139[_0x6673('0x31')]=_[_0x6673('0x2b')](_0x5cfe88,_0x6673('0x2a'));_0x5ee139[_0x6673('0x32')]=_[_0x6673('0x33')](_0x35faca[_0x6673('0x32')]);_0x5ee139[_0x6673('0x34')]=_[_0x6673('0x35')](_0x5ee139['model'],_0x5ee139[_0x6673('0x32')]);_0x1ac732['attributes']=_[_0x6673('0x35')](_0x5ee139[_0x6673('0x31')],qs['fields'](_0x35faca[_0x6673('0x32')]['fields']));_0x1ac732['attributes']=_0x1ac732[_0x6673('0x36')]['length']?_0x1ac732[_0x6673('0x36')]:_0x5ee139[_0x6673('0x31')];if(!_0x35faca[_0x6673('0x32')][_0x6673('0x37')](_0x6673('0x38'))){_0x1ac732['limit']=qs['limit'](_0x35faca[_0x6673('0x32')][_0x6673('0x1e')]);_0x1ac732[_0x6673('0x1d')]=qs[_0x6673('0x1d')](_0x35faca[_0x6673('0x32')][_0x6673('0x1d')]);}_0x1ac732['order']=qs[_0x6673('0x39')](_0x35faca[_0x6673('0x32')][_0x6673('0x39')]);_0x1ac732['where']=qs[_0x6673('0x34')](_[_0x6673('0x3a')](_0x35faca['query'],_0x5ee139['filters']),_0x5cfe88);if(_0x35faca[_0x6673('0x32')][_0x6673('0x3b')]){_0x1ac732[_0x6673('0x3c')]=_[_0x6673('0x3d')](_0x1ac732['where'],{'$or':_[_0x6673('0x2b')](_0x5cfe88,function(_0x5553df){if(_0x5553df['type']!==_0x6673('0x3e')){var _0x38b32c={};_0x38b32c[_0x5553df['name']]={'$like':'%'+_0x35faca[_0x6673('0x32')][_0x6673('0x3b')]+'%'};return _0x38b32c;}})});}_0x1ac732=_[_0x6673('0x3d')]({},_0x1ac732,_0x35faca[_0x6673('0x3f')]);var _0xc9e9cd={'where':_0x1ac732[_0x6673('0x3c')]};return db['MailTransferReport']['count'](_0xc9e9cd)[_0x6673('0x26')](function(_0xb2752f){_0x57d58f[_0x6673('0x40')]=_0xb2752f;if(_0x35faca[_0x6673('0x32')]['includeAll']){_0x1ac732[_0x6673('0x41')]=[{'all':!![]}];}return db[_0x6673('0x2c')][_0x6673('0x42')](_0x1ac732);})[_0x6673('0x26')](function(_0x3b0319){_0x57d58f['rows']=_0x3b0319;return _0x57d58f;})[_0x6673('0x26')](respondWithFilteredResult(_0x2e9ff7,_0x1ac732))['catch'](handleError(_0x2e9ff7,null));};exports[_0x6673('0x43')]=function(_0x112045,_0x470167){var _0x17fb0e={'raw':!![],'where':{'id':_0x112045[_0x6673('0x44')]['id']}},_0x380523={};_0x380523[_0x6673('0x31')]=_[_0x6673('0x33')](db[_0x6673('0x2c')]['rawAttributes']);_0x380523[_0x6673('0x32')]=_[_0x6673('0x33')](_0x112045['query']);_0x380523[_0x6673('0x34')]=_['intersection'](_0x380523[_0x6673('0x31')],_0x380523[_0x6673('0x32')]);_0x17fb0e[_0x6673('0x36')]=_[_0x6673('0x35')](_0x380523[_0x6673('0x31')],qs[_0x6673('0x45')](_0x112045[_0x6673('0x32')][_0x6673('0x45')]));_0x17fb0e[_0x6673('0x36')]=_0x17fb0e[_0x6673('0x36')][_0x6673('0x46')]?_0x17fb0e['attributes']:_0x380523[_0x6673('0x31')];if(_0x112045[_0x6673('0x32')]['includeAll']){_0x17fb0e[_0x6673('0x41')]=[{'all':!![]}];}_0x17fb0e=_[_0x6673('0x3d')]({},_0x17fb0e,_0x112045['options']);return db[_0x6673('0x2c')][_0x6673('0x47')](_0x17fb0e)[_0x6673('0x26')](handleEntityNotFound(_0x470167,null))[_0x6673('0x26')](respondWithResult(_0x470167,null))['catch'](handleError(_0x470167,null));};exports[_0x6673('0x48')]=function(_0x16acfc,_0x30fed9){return db[_0x6673('0x2c')]['create'](_0x16acfc[_0x6673('0x49')],{})[_0x6673('0x26')](respondWithResult(_0x30fed9,0xc9))[_0x6673('0x4a')](handleError(_0x30fed9,null));};exports['update']=function(_0xd862c6,_0x28de8a){if(_0xd862c6[_0x6673('0x49')]['id']){delete _0xd862c6['body']['id'];}return db[_0x6673('0x2c')][_0x6673('0x47')]({'where':{'id':_0xd862c6[_0x6673('0x44')]['id']}})[_0x6673('0x26')](handleEntityNotFound(_0x28de8a,null))[_0x6673('0x26')](saveUpdates(_0xd862c6[_0x6673('0x49')],null))[_0x6673('0x26')](respondWithResult(_0x28de8a,null))['catch'](handleError(_0x28de8a,null));};exports[_0x6673('0x4b')]=function(_0x537267,_0x1355ec){return db[_0x6673('0x2c')][_0x6673('0x47')]({'where':{'id':_0x537267[_0x6673('0x44')]['id']}})[_0x6673('0x26')](handleEntityNotFound(_0x1355ec,null))['then'](removeEntity(_0x1355ec,null))['catch'](handleError(_0x1355ec,null));};exports[_0x6673('0x4c')]=function(_0x54c0b8,_0x57c952){return db[_0x6673('0x2c')][_0x6673('0x4c')]()['then'](respondWithResult(_0x57c952,null))['catch'](handleError(_0x57c952,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 736bedb..fc1d432 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 _0x6770=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util'];(function(_0x28bf84,_0x4eab6b){var _0x7e7e41=function(_0x413466){while(--_0x413466){_0x28bf84['push'](_0x28bf84['shift']());}};_0x7e7e41(++_0x4eab6b);}(_0x6770,0x140));var _0x0677=function(_0x43a7c1,_0x11f43b){_0x43a7c1=_0x43a7c1-0x0;var _0x2ce53d=_0x6770[_0x43a7c1];return _0x2ce53d;};'use strict';var _=require(_0x0677('0x0'));var util=require(_0x0677('0x1'));var logger=require(_0x0677('0x2'))(_0x0677('0x3'));var moment=require(_0x0677('0x4'));var BPromise=require(_0x0677('0x5'));var rp=require(_0x0677('0x6'));var fs=require('fs');var path=require(_0x0677('0x7'));var rimraf=require(_0x0677('0x8'));var config=require('../../config/environment');var attributes=require(_0x0677('0x9'));module[_0x0677('0xa')]=function(_0x2fdd14,_0x2a85a7){return _0x2fdd14['define'](_0x0677('0xb'),attributes,{'tableName':_0x0677('0xc'),'paranoid':![],'indexes':[{'name':_0x0677('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5de5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','uniqueid'];(function(_0xab10b0,_0x39814e){var _0x5b7aea=function(_0x327e0e){while(--_0x327e0e){_0xab10b0['push'](_0xab10b0['shift']());}};_0x5b7aea(++_0x39814e);}(_0x5de5,0x120));var _0x55de=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5de5[_0x432682];return _0x463d05;};'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(_0x55de('0x5'));var rp=require(_0x55de('0x6'));var fs=require('fs');var path=require(_0x55de('0x7'));var rimraf=require(_0x55de('0x8'));var config=require(_0x55de('0x9'));var attributes=require(_0x55de('0xa'));module['exports']=function(_0x5947ec,_0x2a2cd5){return _0x5947ec['define']('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x55de('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 974b3f3..ffb1be8 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 _0xc08a=['error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3a6c9d,_0x2250e2){var _0x391b24=function(_0x435177){while(--_0x435177){_0x3a6c9d['push'](_0x3a6c9d['shift']());}};_0x391b24(++_0x2250e2);}(_0xc08a,0x132));var _0xac08=function(_0x447222,_0x541659){_0x447222=_0x447222-0x0;var _0x527e35=_0xc08a[_0x447222];return _0x527e35;};'use strict';var _=require(_0xac08('0x0'));var util=require(_0xac08('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac08('0x2'))['db'];var utils=require(_0xac08('0x3'));var logger=require(_0xac08('0x4'))('rpc');var config=require(_0xac08('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xac08('0x6')][_0xac08('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36c54d,_0x426355,_0x56fe3d){return new BPromise(function(_0x5d8219,_0xd6e77f){return client[_0xac08('0x8')](_0x36c54d,_0x56fe3d)[_0xac08('0x9')](function(_0x181ed0){logger[_0xac08('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x426355,_0xac08('0xb'));logger[_0xac08('0xc')](_0xac08('0xd'),_0x426355,'request\x20sent',JSON['stringify'](_0x181ed0));if(_0x181ed0[_0xac08('0xe')]){if(_0x181ed0[_0xac08('0xe')][_0xac08('0xf')]===0x1f4){logger[_0xac08('0xe')](_0xac08('0x10'),_0x426355,_0x181ed0[_0xac08('0xe')][_0xac08('0x11')]);return _0xd6e77f(_0x181ed0['error'][_0xac08('0x11')]);}logger[_0xac08('0xe')](_0xac08('0x10'),_0x426355,_0x181ed0[_0xac08('0xe')][_0xac08('0x11')]);return _0x5d8219(_0x181ed0[_0xac08('0xe')][_0xac08('0x11')]);}else{logger[_0xac08('0xa')](_0xac08('0x10'),_0x426355,_0xac08('0xb'));_0x5d8219(_0x181ed0[_0xac08('0x12')][_0xac08('0x11')]);}})[_0xac08('0x13')](function(_0x34c658){logger[_0xac08('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x426355,_0x34c658);_0xd6e77f(_0x34c658);});});} \ No newline at end of file +var _0x954d=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','MailTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0x954d,0x1ad));var _0xd954=function(_0x32e7d6,_0x682bc5){_0x32e7d6=_0x32e7d6-0x0;var _0x5427cf=_0x954d[_0x32e7d6];return _0x5427cf;};'use strict';var _=require(_0xd954('0x0'));var util=require(_0xd954('0x1'));var moment=require(_0xd954('0x2'));var BPromise=require(_0xd954('0x3'));var rs=require(_0xd954('0x4'));var fs=require('fs');var Redis=require(_0xd954('0x5'));var db=require(_0xd954('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd954('0x7'))(_0xd954('0x8'));var config=require(_0xd954('0x9'));var jayson=require(_0xd954('0xa'));var client=jayson[_0xd954('0xb')][_0xd954('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2925e7,_0xc5b6d7,_0x44d4c6){return new BPromise(function(_0x38ff26,_0x24f522){return client[_0xd954('0xd')](_0x2925e7,_0x44d4c6)[_0xd954('0xe')](function(_0x30509c){logger[_0xd954('0xf')]('MailTransferReport,\x20%s,\x20%s',_0xc5b6d7,_0xd954('0x10'));logger['debug'](_0xd954('0x11'),_0xc5b6d7,_0xd954('0x10'),JSON['stringify'](_0x30509c));if(_0x30509c[_0xd954('0x12')]){if(_0x30509c['error'][_0xd954('0x13')]===0x1f4){logger[_0xd954('0x12')]('MailTransferReport,\x20%s,\x20%s',_0xc5b6d7,_0x30509c['error']['message']);return _0x24f522(_0x30509c[_0xd954('0x12')]['message']);}logger[_0xd954('0x12')](_0xd954('0x14'),_0xc5b6d7,_0x30509c[_0xd954('0x12')]['message']);return _0x38ff26(_0x30509c['error']['message']);}else{logger[_0xd954('0xf')]('MailTransferReport,\x20%s,\x20%s',_0xc5b6d7,_0xd954('0x10'));_0x38ff26(_0x30509c[_0xd954('0x15')]['message']);}})[_0xd954('0x16')](function(_0x124194){logger[_0xd954('0x12')]('MailTransferReport,\x20%s,\x20%s',_0xc5b6d7,_0x124194);_0x24f522(_0x124194);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 16d9053..9ab7110 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 _0x1cf5=['/:id','post','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5b6d37,_0x486667){var _0x23a50e=function(_0x884c82){while(--_0x884c82){_0x5b6d37['push'](_0x5b6d37['shift']());}};_0x23a50e(++_0x486667);}(_0x1cf5,0x78));var _0x51cf=function(_0x3dad57,_0x1dd8b3){_0x3dad57=_0x3dad57-0x0;var _0x47a6b5=_0x1cf5[_0x3dad57];return _0x47a6b5;};'use strict';var multer=require('multer');var util=require(_0x51cf('0x0'));var path=require(_0x51cf('0x1'));var timeout=require(_0x51cf('0x2'));var express=require('express');var router=express[_0x51cf('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x51cf('0x4'));var interaction=require(_0x51cf('0x5'));var config=require(_0x51cf('0x6'));var controller=require(_0x51cf('0x7'));router[_0x51cf('0x8')]('/',auth[_0x51cf('0x9')](),controller[_0x51cf('0xa')]);router['get'](_0x51cf('0xb'),auth[_0x51cf('0x9')](),controller[_0x51cf('0xc')]);router['get'](_0x51cf('0xd'),auth[_0x51cf('0x9')](),controller['show']);router[_0x51cf('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x51cf('0xf')](_0x51cf('0xd'),auth[_0x51cf('0x9')](),controller[_0x51cf('0x10')]);router[_0x51cf('0x11')]('/:id',auth[_0x51cf('0x9')](),controller[_0x51cf('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe2dc=['get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x311aad,_0x54d658){var _0x1779bd=function(_0x2520fb){while(--_0x2520fb){_0x311aad['push'](_0x311aad['shift']());}};_0x1779bd(++_0x54d658);}(_0xe2dc,0x1c6));var _0xce2d=function(_0x134277,_0x23526e){_0x134277=_0x134277-0x0;var _0x29759c=_0xe2dc[_0x134277];return _0x29759c;};'use strict';var multer=require(_0xce2d('0x0'));var util=require(_0xce2d('0x1'));var path=require(_0xce2d('0x2'));var timeout=require(_0xce2d('0x3'));var express=require(_0xce2d('0x4'));var router=express['Router']();var fs_extra=require(_0xce2d('0x5'));var auth=require(_0xce2d('0x6'));var interaction=require(_0xce2d('0x7'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0xce2d('0x8')]('/',auth[_0xce2d('0x9')](),controller[_0xce2d('0xa')]);router[_0xce2d('0x8')]('/describe',auth[_0xce2d('0x9')](),controller[_0xce2d('0xb')]);router[_0xce2d('0x8')](_0xce2d('0xc'),auth[_0xce2d('0x9')](),controller[_0xce2d('0xd')]);router[_0xce2d('0xe')]('/',auth[_0xce2d('0x9')](),controller[_0xce2d('0xf')]);router[_0xce2d('0x10')](_0xce2d('0xc'),auth[_0xce2d('0x9')](),controller[_0xce2d('0x11')]);router[_0xce2d('0x12')](_0xce2d('0xc'),auth[_0xce2d('0x9')](),controller[_0xce2d('0x13')]);module[_0xce2d('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 34ccdfe..7f89293 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 _0x626c=['setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff'];(function(_0x1ed56c,_0xeb2128){var _0x586f3d=function(_0x2fb350){while(--_0x2fb350){_0x1ed56c['push'](_0x1ed56c['shift']());}};_0x586f3d(++_0xeb2128);}(_0x626c,0x15b));var _0xc626=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x626c[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require(_0xc626('0x0'));var moment=require(_0xc626('0x1'));module['exports']={'channel':{'type':Sequelize[_0xc626('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xc626('0x2')]},'type':{'type':Sequelize[_0xc626('0x2')],'defaultValue':_0xc626('0x3'),'comment':_0xc626('0x4')},'duration':{'type':Sequelize[_0xc626('0x5')]},'enterAt':{'type':Sequelize[_0xc626('0x6')]},'exitAt':{'type':Sequelize[_0xc626('0x6')],'set':function(_0x54548f){var _0x5bf088=moment(_0x54548f);var _0x2cc1ee=moment(this[_0xc626('0x7')](_0xc626('0x8')));var _0x47b9f1=_0x5bf088[_0xc626('0x9')](_0x2cc1ee,'seconds');this[_0xc626('0xa')]('exitAt',_0x54548f);this['setDataValue'](_0xc626('0xb'),_0x47b9f1||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xc626('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0xc626('0xd')},'data3':{'type':Sequelize[_0xc626('0x2')],'comment':_0xc626('0xe')},'data4':{'type':Sequelize[_0xc626('0x2')],'comment':_0xc626('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0xc626('0x10')},'role':{'type':Sequelize[_0xc626('0x2')]},'internal':{'type':Sequelize[_0xc626('0x5')]},'uniqueid':{'type':Sequelize[_0xc626('0x2')]}}; \ No newline at end of file +var _0x45bd=['seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','diff'];(function(_0x5439b9,_0x1a6e27){var _0x5489e1=function(_0x1ba03e){while(--_0x1ba03e){_0x5439b9['push'](_0x5439b9['shift']());}};_0x5489e1(++_0x1a6e27);}(_0x45bd,0x139));var _0xd45b=function(_0x2a6e7b,_0x267d60){_0x2a6e7b=_0x2a6e7b-0x0;var _0x186aa6=_0x45bd[_0x2a6e7b];return _0x186aa6;};'use strict';var Sequelize=require(_0xd45b('0x0'));var moment=require(_0xd45b('0x1'));module['exports']={'channel':{'type':Sequelize[_0xd45b('0x2')]},'membername':{'type':Sequelize[_0xd45b('0x2')]},'interface':{'type':Sequelize[_0xd45b('0x2')]},'type':{'type':Sequelize[_0xd45b('0x2')],'defaultValue':_0xd45b('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xd45b('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd45b('0x5')],'set':function(_0x2e8fd9){var _0x5b4cf7=moment(_0x2e8fd9);var _0x407c9c=moment(this['getDataValue']('enterAt'));var _0x3fe62b=_0x5b4cf7[_0xd45b('0x6')](_0x407c9c,_0xd45b('0x7'));this[_0xd45b('0x8')](_0xd45b('0x9'),_0x2e8fd9);this['setDataValue'](_0xd45b('0xa'),_0x3fe62b||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xd45b('0xb')},'data2':{'type':Sequelize[_0xd45b('0x2')],'comment':_0xd45b('0xc')},'data3':{'type':Sequelize[_0xd45b('0x2')],'comment':_0xd45b('0xd')},'data4':{'type':Sequelize[_0xd45b('0x2')],'comment':_0xd45b('0xe')},'data5':{'type':Sequelize[_0xd45b('0x2')],'comment':_0xd45b('0xf')},'role':{'type':Sequelize[_0xd45b('0x2')]},'internal':{'type':Sequelize[_0xd45b('0x4')]},'uniqueid':{'type':Sequelize[_0xd45b('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0d10e45..010c5f5 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 _0x4e96=['type','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','update','then','destroy','error','stack','map','MemberReport'];(function(_0x3d88af,_0x29cce6){var _0xcac881=function(_0x4964dc){while(--_0x4964dc){_0x3d88af['push'](_0x3d88af['shift']());}};_0xcac881(++_0x29cce6);}(_0x4e96,0xf4));var _0x64e9=function(_0x2ebd34,_0x218c0b){_0x2ebd34=_0x2ebd34-0x0;var _0x152db3=_0x4e96[_0x2ebd34];return _0x152db3;};'use strict';var emlformat=require(_0x64e9('0x0'));var rimraf=require(_0x64e9('0x1'));var zipdir=require(_0x64e9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x64e9('0x3'));var moment=require(_0x64e9('0x4'));var BPromise=require(_0x64e9('0x5'));var Mustache=require(_0x64e9('0x6'));var util=require(_0x64e9('0x7'));var path=require(_0x64e9('0x8'));var sox=require(_0x64e9('0x9'));var csv=require(_0x64e9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64e9('0xb'));var squel=require(_0x64e9('0xc'));var crypto=require(_0x64e9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x64e9('0xa'));var querystring=require(_0x64e9('0xe'));var Papa=require(_0x64e9('0xf'));var Redis=require(_0x64e9('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x64e9('0x11'));var hardwareService=require(_0x64e9('0x12'));var logger=require(_0x64e9('0x13'))(_0x64e9('0x14'));var utils=require(_0x64e9('0x15'));var config=require(_0x64e9('0x16'));var licenseUtil=require(_0x64e9('0x17'));var db=require(_0x64e9('0x18'))['db'];function respondWithStatusCode(_0x17473c,_0x21e342){_0x21e342=_0x21e342||0xcc;return function(_0x21ce62){if(_0x21ce62){return _0x17473c[_0x64e9('0x19')](_0x21e342);}return _0x17473c['status'](_0x21e342)[_0x64e9('0x1a')]();};}function respondWithResult(_0x47853a,_0x84bf9f){_0x84bf9f=_0x84bf9f||0xc8;return function(_0x1d3874){if(_0x1d3874){return _0x47853a[_0x64e9('0x1b')](_0x84bf9f)[_0x64e9('0x1c')](_0x1d3874);}};}function respondWithFilteredResult(_0x5e1625,_0x161037){return function(_0x343a53){if(_0x343a53){var _0x33983f=typeof _0x161037['offset']==='undefined'&&typeof _0x161037['limit']==='undefined';var _0x3fee05=_0x343a53[_0x64e9('0x1d')];var _0x24986c=_0x33983f?0x0:_0x161037['offset'];var _0x20691e=_0x33983f?_0x343a53[_0x64e9('0x1d')]:_0x161037[_0x64e9('0x1e')]+_0x161037[_0x64e9('0x1f')];var _0x10375a;if(_0x20691e>=_0x3fee05){_0x20691e=_0x3fee05;_0x10375a=0xc8;}else{_0x10375a=0xce;}_0x5e1625[_0x64e9('0x1b')](_0x10375a);return _0x5e1625['set']('Content-Range',_0x24986c+'-'+_0x20691e+'/'+_0x3fee05)[_0x64e9('0x1c')](_0x343a53);}return null;};}function patchUpdates(_0x30227c){return function(_0x45aae8){try{jsonpatch[_0x64e9('0x20')](_0x45aae8,_0x30227c,!![]);}catch(_0x5178bf){return BPromise['reject'](_0x5178bf);}return _0x45aae8['save']();};}function saveUpdates(_0x5a9600,_0x233d46){return function(_0x5363be){if(_0x5363be){return _0x5363be[_0x64e9('0x21')](_0x5a9600)[_0x64e9('0x22')](function(_0xdc781c){return _0xdc781c;});}return null;};}function removeEntity(_0x457349,_0x1001d4){return function(_0x118457){if(_0x118457){return _0x118457[_0x64e9('0x23')]()[_0x64e9('0x22')](function(){_0x457349[_0x64e9('0x1b')](0xcc)[_0x64e9('0x1a')]();});}};}function handleEntityNotFound(_0xa4999e,_0x7e5213){return function(_0x50fcf5){if(!_0x50fcf5){_0xa4999e['sendStatus'](0x194);}return _0x50fcf5;};}function handleError(_0x3a3fa7,_0x4123f3){_0x4123f3=_0x4123f3||0x1f4;return function(_0x199cad){logger[_0x64e9('0x24')](_0x199cad[_0x64e9('0x25')]);if(_0x199cad['name']){delete _0x199cad['name'];}_0x3a3fa7[_0x64e9('0x1b')](_0x4123f3)['send'](_0x199cad);};}exports['index']=function(_0x3018dc,_0x1e295c){var _0x435fe0={},_0x34395c={},_0x237e84={'count':0x0,'rows':[]};var _0x178683=_[_0x64e9('0x26')](db[_0x64e9('0x27')]['rawAttributes'],function(_0x217e73){return{'name':_0x217e73['fieldName'],'type':_0x217e73[_0x64e9('0x28')]['key']};});_0x34395c['model']=_['map'](_0x178683,_0x64e9('0x29'));_0x34395c[_0x64e9('0x2a')]=_['keys'](_0x3018dc[_0x64e9('0x2a')]);_0x34395c[_0x64e9('0x2b')]=_[_0x64e9('0x2c')](_0x34395c[_0x64e9('0x2d')],_0x34395c[_0x64e9('0x2a')]);_0x435fe0[_0x64e9('0x2e')]=_[_0x64e9('0x2c')](_0x34395c[_0x64e9('0x2d')],qs[_0x64e9('0x2f')](_0x3018dc[_0x64e9('0x2a')][_0x64e9('0x2f')]));_0x435fe0['attributes']=_0x435fe0[_0x64e9('0x2e')][_0x64e9('0x30')]?_0x435fe0[_0x64e9('0x2e')]:_0x34395c[_0x64e9('0x2d')];if(!_0x3018dc['query'][_0x64e9('0x31')](_0x64e9('0x32'))){_0x435fe0[_0x64e9('0x1f')]=qs[_0x64e9('0x1f')](_0x3018dc[_0x64e9('0x2a')][_0x64e9('0x1f')]);_0x435fe0[_0x64e9('0x1e')]=qs['offset'](_0x3018dc[_0x64e9('0x2a')][_0x64e9('0x1e')]);}_0x435fe0[_0x64e9('0x33')]=qs['sort'](_0x3018dc[_0x64e9('0x2a')][_0x64e9('0x34')]);_0x435fe0[_0x64e9('0x35')]=qs['filters'](_[_0x64e9('0x36')](_0x3018dc['query'],_0x34395c['filters']),_0x178683);if(_0x3018dc['query'][_0x64e9('0x37')]){_0x435fe0[_0x64e9('0x35')]=_['merge'](_0x435fe0[_0x64e9('0x35')],{'$or':_[_0x64e9('0x26')](_0x178683,function(_0x2f64f3){if(_0x2f64f3[_0x64e9('0x28')]!==_0x64e9('0x38')){var _0x28e334={};_0x28e334[_0x2f64f3['name']]={'$like':'%'+_0x3018dc[_0x64e9('0x2a')][_0x64e9('0x37')]+'%'};return _0x28e334;}})});}_0x435fe0=_[_0x64e9('0x39')]({},_0x435fe0,_0x3018dc[_0x64e9('0x3a')]);var _0x3cb498={'where':_0x435fe0[_0x64e9('0x35')]};return db[_0x64e9('0x27')][_0x64e9('0x1d')](_0x3cb498)[_0x64e9('0x22')](function(_0x296f08){_0x237e84[_0x64e9('0x1d')]=_0x296f08;if(_0x3018dc[_0x64e9('0x2a')][_0x64e9('0x3b')]){_0x435fe0['include']=[{'all':!![]}];}return db[_0x64e9('0x27')][_0x64e9('0x3c')](_0x435fe0);})[_0x64e9('0x22')](function(_0x382ad6){_0x237e84[_0x64e9('0x3d')]=_0x382ad6;return _0x237e84;})[_0x64e9('0x22')](respondWithFilteredResult(_0x1e295c,_0x435fe0))[_0x64e9('0x3e')](handleError(_0x1e295c,null));};exports['show']=function(_0x29c76e,_0x48447f){var _0x1e0504={'raw':!![],'where':{'id':_0x29c76e[_0x64e9('0x3f')]['id']}},_0x379757={};_0x379757['model']=_[_0x64e9('0x40')](db[_0x64e9('0x27')][_0x64e9('0x41')]);_0x379757[_0x64e9('0x2a')]=_[_0x64e9('0x40')](_0x29c76e[_0x64e9('0x2a')]);_0x379757['filters']=_[_0x64e9('0x2c')](_0x379757[_0x64e9('0x2d')],_0x379757[_0x64e9('0x2a')]);_0x1e0504[_0x64e9('0x2e')]=_['intersection'](_0x379757[_0x64e9('0x2d')],qs['fields'](_0x29c76e['query'][_0x64e9('0x2f')]));_0x1e0504[_0x64e9('0x2e')]=_0x1e0504[_0x64e9('0x2e')]['length']?_0x1e0504[_0x64e9('0x2e')]:_0x379757[_0x64e9('0x2d')];if(_0x29c76e[_0x64e9('0x2a')]['includeAll']){_0x1e0504[_0x64e9('0x42')]=[{'all':!![]}];}_0x1e0504=_[_0x64e9('0x39')]({},_0x1e0504,_0x29c76e[_0x64e9('0x3a')]);return db[_0x64e9('0x27')][_0x64e9('0x43')](_0x1e0504)['then'](handleEntityNotFound(_0x48447f,null))[_0x64e9('0x22')](respondWithResult(_0x48447f,null))[_0x64e9('0x3e')](handleError(_0x48447f,null));};exports['create']=function(_0x2e74cb,_0x51e40d){return db['MemberReport'][_0x64e9('0x44')](_0x2e74cb['body'],{})[_0x64e9('0x22')](respondWithResult(_0x51e40d,0xc9))[_0x64e9('0x3e')](handleError(_0x51e40d,null));};exports[_0x64e9('0x21')]=function(_0x209d11,_0x5e084d){if(_0x209d11['body']['id']){delete _0x209d11[_0x64e9('0x45')]['id'];}return db[_0x64e9('0x27')]['find']({'where':{'id':_0x209d11['params']['id']}})[_0x64e9('0x22')](handleEntityNotFound(_0x5e084d,null))[_0x64e9('0x22')](saveUpdates(_0x209d11[_0x64e9('0x45')],null))[_0x64e9('0x22')](respondWithResult(_0x5e084d,null))[_0x64e9('0x3e')](handleError(_0x5e084d,null));};exports[_0x64e9('0x23')]=function(_0x10e187,_0x14c03f){return db[_0x64e9('0x27')][_0x64e9('0x43')]({'where':{'id':_0x10e187[_0x64e9('0x3f')]['id']}})[_0x64e9('0x22')](handleEntityNotFound(_0x14c03f,null))[_0x64e9('0x22')](removeEntity(_0x14c03f,null))[_0x64e9('0x3e')](handleError(_0x14c03f,null));};exports[_0x64e9('0x46')]=function(_0x14cb92,_0x438b0e){return db['MemberReport']['describe']()[_0x64e9('0x22')](respondWithResult(_0x438b0e,null))['catch'](handleError(_0x438b0e,null));}; \ No newline at end of file +var _0x7e94=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','MemberReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse'];(function(_0x5a86a9,_0x49f269){var _0x3ab2cc=function(_0x28248f){while(--_0x28248f){_0x5a86a9['push'](_0x5a86a9['shift']());}};_0x3ab2cc(++_0x49f269);}(_0x7e94,0x1e8));var _0x47e9=function(_0x105530,_0x45421d){_0x105530=_0x105530-0x0;var _0x5e315f=_0x7e94[_0x105530];return _0x5e315f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x47e9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47e9('0x1'));var rp=require(_0x47e9('0x2'));var moment=require(_0x47e9('0x3'));var BPromise=require(_0x47e9('0x4'));var Mustache=require(_0x47e9('0x5'));var util=require(_0x47e9('0x6'));var path=require(_0x47e9('0x7'));var sox=require('sox');var csv=require(_0x47e9('0x8'));var ejs=require(_0x47e9('0x9'));var fs=require('fs');var fs_extra=require(_0x47e9('0xa'));var _=require(_0x47e9('0xb'));var squel=require(_0x47e9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x47e9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x47e9('0xe'));var Papa=require(_0x47e9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x47e9('0x10'));var as=require(_0x47e9('0x11'));var hardwareService=require(_0x47e9('0x12'));var logger=require('../../config/logger')(_0x47e9('0x13'));var utils=require('../../config/utils');var config=require(_0x47e9('0x14'));var licenseUtil=require(_0x47e9('0x15'));var db=require(_0x47e9('0x16'))['db'];function respondWithStatusCode(_0x55713b,_0x45f5b2){_0x45f5b2=_0x45f5b2||0xcc;return function(_0x4f3579){if(_0x4f3579){return _0x55713b[_0x47e9('0x17')](_0x45f5b2);}return _0x55713b[_0x47e9('0x18')](_0x45f5b2)[_0x47e9('0x19')]();};}function respondWithResult(_0x7f5477,_0x5ee09a){_0x5ee09a=_0x5ee09a||0xc8;return function(_0x4c598e){if(_0x4c598e){return _0x7f5477['status'](_0x5ee09a)[_0x47e9('0x1a')](_0x4c598e);}};}function respondWithFilteredResult(_0x18b892,_0x4e248a){return function(_0x3529e9){if(_0x3529e9){var _0x138179=typeof _0x4e248a[_0x47e9('0x1b')]==='undefined'&&typeof _0x4e248a['limit']==='undefined';var _0x4da541=_0x3529e9[_0x47e9('0x1c')];var _0x4675fe=_0x138179?0x0:_0x4e248a['offset'];var _0x5587bd=_0x138179?_0x3529e9[_0x47e9('0x1c')]:_0x4e248a[_0x47e9('0x1b')]+_0x4e248a[_0x47e9('0x1d')];var _0x375896;if(_0x5587bd>=_0x4da541){_0x5587bd=_0x4da541;_0x375896=0xc8;}else{_0x375896=0xce;}_0x18b892[_0x47e9('0x18')](_0x375896);return _0x18b892['set'](_0x47e9('0x1e'),_0x4675fe+'-'+_0x5587bd+'/'+_0x4da541)['json'](_0x3529e9);}return null;};}function patchUpdates(_0x210f19){return function(_0x4bf62b){try{jsonpatch[_0x47e9('0x1f')](_0x4bf62b,_0x210f19,!![]);}catch(_0x20d358){return BPromise[_0x47e9('0x20')](_0x20d358);}return _0x4bf62b[_0x47e9('0x21')]();};}function saveUpdates(_0x311094,_0x1255a3){return function(_0x2f781d){if(_0x2f781d){return _0x2f781d[_0x47e9('0x22')](_0x311094)[_0x47e9('0x23')](function(_0x1b6fcf){return _0x1b6fcf;});}return null;};}function removeEntity(_0x45c378,_0xd26148){return function(_0x2f8a13){if(_0x2f8a13){return _0x2f8a13[_0x47e9('0x24')]()[_0x47e9('0x23')](function(){_0x45c378['status'](0xcc)[_0x47e9('0x19')]();});}};}function handleEntityNotFound(_0x48389d,_0x4bd393){return function(_0x55f57d){if(!_0x55f57d){_0x48389d[_0x47e9('0x17')](0x194);}return _0x55f57d;};}function handleError(_0x5bc3c9,_0xfa0a95){_0xfa0a95=_0xfa0a95||0x1f4;return function(_0x920d6e){logger[_0x47e9('0x25')](_0x920d6e['stack']);if(_0x920d6e[_0x47e9('0x26')]){delete _0x920d6e[_0x47e9('0x26')];}_0x5bc3c9['status'](_0xfa0a95)[_0x47e9('0x27')](_0x920d6e);};}exports[_0x47e9('0x28')]=function(_0x352dfa,_0x27ed38){var _0x1a99f5={},_0x7e997d={},_0x5aac93={'count':0x0,'rows':[]};var _0x554802=_[_0x47e9('0x29')](db[_0x47e9('0x2a')][_0x47e9('0x2b')],function(_0x3bf9f5){return{'name':_0x3bf9f5['fieldName'],'type':_0x3bf9f5[_0x47e9('0x2c')][_0x47e9('0x2d')]};});_0x7e997d[_0x47e9('0x2e')]=_['map'](_0x554802,_0x47e9('0x26'));_0x7e997d[_0x47e9('0x2f')]=_[_0x47e9('0x30')](_0x352dfa['query']);_0x7e997d[_0x47e9('0x31')]=_['intersection'](_0x7e997d[_0x47e9('0x2e')],_0x7e997d[_0x47e9('0x2f')]);_0x1a99f5[_0x47e9('0x32')]=_[_0x47e9('0x33')](_0x7e997d[_0x47e9('0x2e')],qs['fields'](_0x352dfa[_0x47e9('0x2f')]['fields']));_0x1a99f5[_0x47e9('0x32')]=_0x1a99f5[_0x47e9('0x32')][_0x47e9('0x34')]?_0x1a99f5[_0x47e9('0x32')]:_0x7e997d['model'];if(!_0x352dfa['query']['hasOwnProperty'](_0x47e9('0x35'))){_0x1a99f5[_0x47e9('0x1d')]=qs[_0x47e9('0x1d')](_0x352dfa[_0x47e9('0x2f')][_0x47e9('0x1d')]);_0x1a99f5['offset']=qs[_0x47e9('0x1b')](_0x352dfa[_0x47e9('0x2f')][_0x47e9('0x1b')]);}_0x1a99f5[_0x47e9('0x36')]=qs[_0x47e9('0x37')](_0x352dfa[_0x47e9('0x2f')][_0x47e9('0x37')]);_0x1a99f5[_0x47e9('0x38')]=qs['filters'](_[_0x47e9('0x39')](_0x352dfa[_0x47e9('0x2f')],_0x7e997d[_0x47e9('0x31')]),_0x554802);if(_0x352dfa[_0x47e9('0x2f')]['filter']){_0x1a99f5[_0x47e9('0x38')]=_[_0x47e9('0x3a')](_0x1a99f5[_0x47e9('0x38')],{'$or':_[_0x47e9('0x29')](_0x554802,function(_0x4ce3c7){if(_0x4ce3c7[_0x47e9('0x2c')]!=='VIRTUAL'){var _0x501291={};_0x501291[_0x4ce3c7[_0x47e9('0x26')]]={'$like':'%'+_0x352dfa[_0x47e9('0x2f')][_0x47e9('0x3b')]+'%'};return _0x501291;}})});}_0x1a99f5=_['merge']({},_0x1a99f5,_0x352dfa[_0x47e9('0x3c')]);var _0x334a74={'where':_0x1a99f5[_0x47e9('0x38')]};return db['MemberReport'][_0x47e9('0x1c')](_0x334a74)['then'](function(_0x5f2c3c){_0x5aac93[_0x47e9('0x1c')]=_0x5f2c3c;if(_0x352dfa[_0x47e9('0x2f')][_0x47e9('0x3d')]){_0x1a99f5[_0x47e9('0x3e')]=[{'all':!![]}];}return db[_0x47e9('0x2a')][_0x47e9('0x3f')](_0x1a99f5);})[_0x47e9('0x23')](function(_0x154e86){_0x5aac93['rows']=_0x154e86;return _0x5aac93;})[_0x47e9('0x23')](respondWithFilteredResult(_0x27ed38,_0x1a99f5))[_0x47e9('0x40')](handleError(_0x27ed38,null));};exports[_0x47e9('0x41')]=function(_0x229757,_0x1903dc){var _0x21162c={'raw':!![],'where':{'id':_0x229757[_0x47e9('0x42')]['id']}},_0x3a0c94={};_0x3a0c94[_0x47e9('0x2e')]=_['keys'](db[_0x47e9('0x2a')][_0x47e9('0x2b')]);_0x3a0c94[_0x47e9('0x2f')]=_[_0x47e9('0x30')](_0x229757[_0x47e9('0x2f')]);_0x3a0c94[_0x47e9('0x31')]=_[_0x47e9('0x33')](_0x3a0c94[_0x47e9('0x2e')],_0x3a0c94[_0x47e9('0x2f')]);_0x21162c['attributes']=_[_0x47e9('0x33')](_0x3a0c94[_0x47e9('0x2e')],qs[_0x47e9('0x43')](_0x229757[_0x47e9('0x2f')][_0x47e9('0x43')]));_0x21162c['attributes']=_0x21162c[_0x47e9('0x32')][_0x47e9('0x34')]?_0x21162c['attributes']:_0x3a0c94[_0x47e9('0x2e')];if(_0x229757[_0x47e9('0x2f')]['includeAll']){_0x21162c[_0x47e9('0x3e')]=[{'all':!![]}];}_0x21162c=_[_0x47e9('0x3a')]({},_0x21162c,_0x229757[_0x47e9('0x3c')]);return db[_0x47e9('0x2a')][_0x47e9('0x44')](_0x21162c)[_0x47e9('0x23')](handleEntityNotFound(_0x1903dc,null))[_0x47e9('0x23')](respondWithResult(_0x1903dc,null))[_0x47e9('0x40')](handleError(_0x1903dc,null));};exports[_0x47e9('0x45')]=function(_0x197205,_0x268780){return db['MemberReport']['create'](_0x197205['body'],{})[_0x47e9('0x23')](respondWithResult(_0x268780,0xc9))[_0x47e9('0x40')](handleError(_0x268780,null));};exports['update']=function(_0x44fb0a,_0x3b7053){if(_0x44fb0a[_0x47e9('0x46')]['id']){delete _0x44fb0a[_0x47e9('0x46')]['id'];}return db[_0x47e9('0x2a')]['find']({'where':{'id':_0x44fb0a[_0x47e9('0x42')]['id']}})[_0x47e9('0x23')](handleEntityNotFound(_0x3b7053,null))['then'](saveUpdates(_0x44fb0a[_0x47e9('0x46')],null))['then'](respondWithResult(_0x3b7053,null))[_0x47e9('0x40')](handleError(_0x3b7053,null));};exports[_0x47e9('0x24')]=function(_0x5c8e23,_0x2e312b){return db[_0x47e9('0x2a')][_0x47e9('0x44')]({'where':{'id':_0x5c8e23['params']['id']}})[_0x47e9('0x23')](handleEntityNotFound(_0x2e312b,null))[_0x47e9('0x23')](removeEntity(_0x2e312b,null))[_0x47e9('0x40')](handleError(_0x2e312b,null));};exports[_0x47e9('0x47')]=function(_0x366324,_0x5b8a60){return db[_0x47e9('0x2a')]['describe']()[_0x47e9('0x23')](respondWithResult(_0x5b8a60,null))[_0x47e9('0x40')](handleError(_0x5b8a60,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 6f8c727..b259b0e 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 _0x2fe8=['membername','interface','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','membername_interface'];(function(_0x551776,_0x39d319){var _0x2302e1=function(_0x32ca8c){while(--_0x32ca8c){_0x551776['push'](_0x551776['shift']());}};_0x2302e1(++_0x39d319);}(_0x2fe8,0x106));var _0x82fe=function(_0x94a64e,_0x566677){_0x94a64e=_0x94a64e-0x0;var _0x6acb41=_0x2fe8[_0x94a64e];return _0x6acb41;};'use strict';var _=require('lodash');var util=require(_0x82fe('0x0'));var logger=require(_0x82fe('0x1'))('api');var moment=require(_0x82fe('0x2'));var BPromise=require(_0x82fe('0x3'));var rp=require(_0x82fe('0x4'));var fs=require('fs');var path=require(_0x82fe('0x5'));var rimraf=require('rimraf');var config=require(_0x82fe('0x6'));var attributes=require(_0x82fe('0x7'));module[_0x82fe('0x8')]=function(_0x5aa8f9,_0x84dfca){return _0x5aa8f9[_0x82fe('0x9')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x82fe('0xa'),'fields':[_0x82fe('0xb'),_0x82fe('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7737=['rimraf','../../config/environment','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x12672a,_0x57e78d){var _0x40e895=function(_0x1e275a){while(--_0x1e275a){_0x12672a['push'](_0x12672a['shift']());}};_0x40e895(++_0x57e78d);}(_0x7737,0xa9));var _0x7773=function(_0x34cc9f,_0x4d891a){_0x34cc9f=_0x34cc9f-0x0;var _0x1991d3=_0x7737[_0x34cc9f];return _0x1991d3;};'use strict';var _=require(_0x7773('0x0'));var util=require(_0x7773('0x1'));var logger=require(_0x7773('0x2'))(_0x7773('0x3'));var moment=require(_0x7773('0x4'));var BPromise=require('bluebird');var rp=require(_0x7773('0x5'));var fs=require('fs');var path=require(_0x7773('0x6'));var rimraf=require(_0x7773('0x7'));var config=require(_0x7773('0x8'));var attributes=require('./memberReport.attributes');module[_0x7773('0x9')]=function(_0x48fca2,_0x180fe9){return _0x48fca2[_0x7773('0xa')](_0x7773('0xb'),attributes,{'tableName':_0x7773('0xc'),'paranoid':![],'indexes':[{'name':_0x7773('0xd'),'fields':[_0x7773('0xe'),_0x7773('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index c3d215c..30a1bee 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 _0x276d=['rpc','../../config/environment','jayson/promise','client','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','map','include','model','then','info','debug','catch','CreateMemberReport','create','update','body','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x302efc,_0x1f8057){var _0x5284d5=function(_0x43783d){while(--_0x43783d){_0x302efc['push'](_0x302efc['shift']());}};_0x5284d5(++_0x1f8057);}(_0x276d,0x131));var _0xd276=function(_0x2634f7,_0x293c58){_0x2634f7=_0x2634f7-0x0;var _0x5a3d18=_0x276d[_0x2634f7];return _0x5a3d18;};'use strict';var _=require(_0xd276('0x0'));var util=require(_0xd276('0x1'));var moment=require(_0xd276('0x2'));var BPromise=require(_0xd276('0x3'));var rs=require(_0xd276('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd276('0x5'))['db'];var utils=require(_0xd276('0x6'));var logger=require('../../config/logger')(_0xd276('0x7'));var config=require(_0xd276('0x8'));var jayson=require(_0xd276('0x9'));var client=jayson[_0xd276('0xa')][_0xd276('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24e733,_0x39151a,_0x49d627){return new BPromise(function(_0x135eb9,_0x54d88a){return client[_0xd276('0xc')](_0x24e733,_0x49d627)['then'](function(_0x233f9c){logger['info'](_0xd276('0xd'),_0x39151a,_0xd276('0xe'));logger['debug'](_0xd276('0xf'),_0x39151a,_0xd276('0xe'),JSON[_0xd276('0x10')](_0x233f9c));if(_0x233f9c['error']){if(_0x233f9c[_0xd276('0x11')][_0xd276('0x12')]===0x1f4){logger[_0xd276('0x11')](_0xd276('0xd'),_0x39151a,_0x233f9c['error'][_0xd276('0x13')]);return _0x54d88a(_0x233f9c[_0xd276('0x11')][_0xd276('0x13')]);}logger['error'](_0xd276('0xd'),_0x39151a,_0x233f9c[_0xd276('0x11')][_0xd276('0x13')]);return _0x135eb9(_0x233f9c['error'][_0xd276('0x13')]);}else{logger['info'](_0xd276('0xd'),_0x39151a,_0xd276('0xe'));_0x135eb9(_0x233f9c['result'][_0xd276('0x13')]);}})['catch'](function(_0x37f576){logger[_0xd276('0x11')](_0xd276('0xd'),_0x39151a,_0x37f576);_0x54d88a(_0x37f576);});});}exports[_0xd276('0x14')]=function(_0x2247ea){var _0x2927ee=this;return new Promise(function(_0x3552a3,_0x22803d){return db[_0xd276('0x15')][_0xd276('0x16')]({'raw':_0x2247ea['options']?_0x2247ea[_0xd276('0x17')][_0xd276('0x18')]===undefined?!![]:![]:!![],'where':_0x2247ea[_0xd276('0x17')]?_0x2247ea['options'][_0xd276('0x19')]||null:null,'attributes':_0x2247ea[_0xd276('0x17')]?_0x2247ea[_0xd276('0x17')][_0xd276('0x1a')]||null:null,'limit':_0x2247ea['options']?_0x2247ea[_0xd276('0x17')]['limit']||null:null,'include':_0x2247ea['options']?_0x2247ea[_0xd276('0x17')]['include']?_[_0xd276('0x1b')](_0x2247ea[_0xd276('0x17')][_0xd276('0x1c')],function(_0x5df0d2){return{'model':db[_0x5df0d2[_0xd276('0x1d')]],'as':_0x5df0d2['as'],'attributes':_0x5df0d2[_0xd276('0x1a')],'include':_0x5df0d2[_0xd276('0x1c')]?_[_0xd276('0x1b')](_0x5df0d2[_0xd276('0x1c')],function(_0x4fcfbf){return{'model':db[_0x4fcfbf[_0xd276('0x1d')]],'as':_0x4fcfbf['as'],'attributes':_0x4fcfbf[_0xd276('0x1a')],'include':_0x4fcfbf[_0xd276('0x1c')]?_[_0xd276('0x1b')](_0x4fcfbf[_0xd276('0x1c')],function(_0x23bf56){return{'model':db[_0x23bf56[_0xd276('0x1d')]],'as':_0x23bf56['as'],'attributes':_0x23bf56[_0xd276('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd276('0x1e')](function(_0x551f39){logger[_0xd276('0x1f')](_0xd276('0x14'),_0x2247ea);logger[_0xd276('0x20')](_0xd276('0x14'),_0x2247ea,JSON[_0xd276('0x10')](_0x551f39));_0x3552a3(_0x551f39);})[_0xd276('0x21')](function(_0x2a1e23){logger[_0xd276('0x11')](_0xd276('0x14'),_0x2a1e23['message'],_0x2247ea);_0x22803d(_0x2927ee[_0xd276('0x11')](0x1f4,_0x2a1e23['message']));});});};exports[_0xd276('0x22')]=function(_0x4abcd7){var _0x4906a5=this;return new Promise(function(_0x291bfa,_0x21665b){return db[_0xd276('0x15')][_0xd276('0x23')](_0x4abcd7['body'],{'raw':_0x4abcd7[_0xd276('0x17')]?_0x4abcd7[_0xd276('0x17')][_0xd276('0x18')]===undefined?!![]:![]:!![]})[_0xd276('0x1e')](function(_0x5ae611){logger[_0xd276('0x1f')]('CreateMemberReport',_0x4abcd7);logger['debug'](_0xd276('0x22'),_0x4abcd7,JSON[_0xd276('0x10')](_0x5ae611));_0x291bfa(_0x5ae611);})[_0xd276('0x21')](function(_0x1b6c59){logger[_0xd276('0x11')](_0xd276('0x22'),_0x1b6c59[_0xd276('0x13')],_0x4abcd7);_0x21665b(_0x4906a5[_0xd276('0x11')](0x1f4,_0x1b6c59[_0xd276('0x13')]));});});};exports['UpdateMemberReport']=function(_0x569307){var _0x1271e5=this;return new Promise(function(_0x10b158,_0x16756d){return db[_0xd276('0x15')][_0xd276('0x24')](_0x569307[_0xd276('0x25')],{'raw':_0x569307[_0xd276('0x17')]?_0x569307['options'][_0xd276('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x569307[_0xd276('0x17')]?_0x569307[_0xd276('0x17')][_0xd276('0x19')]||null:null,'attributes':_0x569307[_0xd276('0x17')]?_0x569307['options'][_0xd276('0x1a')]||null:null,'limit':_0x569307[_0xd276('0x17')]?_0x569307[_0xd276('0x17')]['limit']||null:null})[_0xd276('0x1e')](function(_0x36ea59){logger[_0xd276('0x1f')]('UpdateMemberReport',_0x569307);logger[_0xd276('0x20')](_0xd276('0x26'),_0x569307,JSON[_0xd276('0x10')](_0x36ea59));_0x10b158(_0x36ea59);})['catch'](function(_0x4b6b68){logger[_0xd276('0x11')](_0xd276('0x26'),_0x4b6b68['message'],_0x569307);_0x16756d(_0x1271e5[_0xd276('0x11')](0x1f4,_0x4b6b68['message']));});});}; \ No newline at end of file +var _0x7be6=['rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','GetMemberReport','MemberReport','options','raw','attributes','limit','map','include','model','catch','CreateMemberReport','create','body','UpdateMemberReport','update','where','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1aad88,_0x551794){var _0x1bbfe9=function(_0x1636ed){while(--_0x1636ed){_0x1aad88['push'](_0x1aad88['shift']());}};_0x1bbfe9(++_0x551794);}(_0x7be6,0xaa));var _0x67be=function(_0x1b5896,_0x3803c8){_0x1b5896=_0x1b5896-0x0;var _0x3e40d7=_0x7be6[_0x1b5896];return _0x3e40d7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x67be('0x0'));var rs=require(_0x67be('0x1'));var fs=require('fs');var Redis=require(_0x67be('0x2'));var db=require(_0x67be('0x3'))['db'];var utils=require(_0x67be('0x4'));var logger=require('../../config/logger')(_0x67be('0x5'));var config=require(_0x67be('0x6'));var jayson=require(_0x67be('0x7'));var client=jayson[_0x67be('0x8')][_0x67be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2af7af,_0x5e4db9,_0x4f7ad3){return new BPromise(function(_0x5f579f,_0x707253){return client['request'](_0x2af7af,_0x4f7ad3)[_0x67be('0xa')](function(_0x17ed92){logger[_0x67be('0xb')](_0x67be('0xc'),_0x5e4db9,_0x67be('0xd'));logger[_0x67be('0xe')](_0x67be('0xf'),_0x5e4db9,'request\x20sent',JSON[_0x67be('0x10')](_0x17ed92));if(_0x17ed92[_0x67be('0x11')]){if(_0x17ed92[_0x67be('0x11')]['code']===0x1f4){logger['error'](_0x67be('0xc'),_0x5e4db9,_0x17ed92['error'][_0x67be('0x12')]);return _0x707253(_0x17ed92[_0x67be('0x11')][_0x67be('0x12')]);}logger[_0x67be('0x11')](_0x67be('0xc'),_0x5e4db9,_0x17ed92[_0x67be('0x11')][_0x67be('0x12')]);return _0x5f579f(_0x17ed92[_0x67be('0x11')][_0x67be('0x12')]);}else{logger[_0x67be('0xb')](_0x67be('0xc'),_0x5e4db9,_0x67be('0xd'));_0x5f579f(_0x17ed92['result'][_0x67be('0x12')]);}})['catch'](function(_0x5bd33f){logger[_0x67be('0x11')](_0x67be('0xc'),_0x5e4db9,_0x5bd33f);_0x707253(_0x5bd33f);});});}exports[_0x67be('0x13')]=function(_0x5bdd09){var _0x3b6f8e=this;return new Promise(function(_0x1e875e,_0x498435){return db[_0x67be('0x14')]['findAll']({'raw':_0x5bdd09['options']?_0x5bdd09[_0x67be('0x15')][_0x67be('0x16')]===undefined?!![]:![]:!![],'where':_0x5bdd09[_0x67be('0x15')]?_0x5bdd09[_0x67be('0x15')]['where']||null:null,'attributes':_0x5bdd09[_0x67be('0x15')]?_0x5bdd09[_0x67be('0x15')][_0x67be('0x17')]||null:null,'limit':_0x5bdd09[_0x67be('0x15')]?_0x5bdd09['options'][_0x67be('0x18')]||null:null,'include':_0x5bdd09[_0x67be('0x15')]?_0x5bdd09[_0x67be('0x15')]['include']?_[_0x67be('0x19')](_0x5bdd09['options'][_0x67be('0x1a')],function(_0x490cf4){return{'model':db[_0x490cf4[_0x67be('0x1b')]],'as':_0x490cf4['as'],'attributes':_0x490cf4[_0x67be('0x17')],'include':_0x490cf4[_0x67be('0x1a')]?_[_0x67be('0x19')](_0x490cf4[_0x67be('0x1a')],function(_0x495480){return{'model':db[_0x495480[_0x67be('0x1b')]],'as':_0x495480['as'],'attributes':_0x495480[_0x67be('0x17')],'include':_0x495480[_0x67be('0x1a')]?_[_0x67be('0x19')](_0x495480[_0x67be('0x1a')],function(_0x2540cc){return{'model':db[_0x2540cc[_0x67be('0x1b')]],'as':_0x2540cc['as'],'attributes':_0x2540cc[_0x67be('0x17')]};}):[]};}):[]};}):[]:[]})[_0x67be('0xa')](function(_0x757494){logger[_0x67be('0xb')](_0x67be('0x13'),_0x5bdd09);logger[_0x67be('0xe')](_0x67be('0x13'),_0x5bdd09,JSON[_0x67be('0x10')](_0x757494));_0x1e875e(_0x757494);})[_0x67be('0x1c')](function(_0x5115ca){logger['error'](_0x67be('0x13'),_0x5115ca[_0x67be('0x12')],_0x5bdd09);_0x498435(_0x3b6f8e[_0x67be('0x11')](0x1f4,_0x5115ca[_0x67be('0x12')]));});});};exports[_0x67be('0x1d')]=function(_0x47193d){var _0x5df549=this;return new Promise(function(_0x1c184e,_0xd77527){return db[_0x67be('0x14')][_0x67be('0x1e')](_0x47193d[_0x67be('0x1f')],{'raw':_0x47193d[_0x67be('0x15')]?_0x47193d[_0x67be('0x15')][_0x67be('0x16')]===undefined?!![]:![]:!![]})[_0x67be('0xa')](function(_0x3ab5a6){logger[_0x67be('0xb')](_0x67be('0x1d'),_0x47193d);logger[_0x67be('0xe')](_0x67be('0x1d'),_0x47193d,JSON[_0x67be('0x10')](_0x3ab5a6));_0x1c184e(_0x3ab5a6);})[_0x67be('0x1c')](function(_0x3ef2ec){logger['error'](_0x67be('0x1d'),_0x3ef2ec[_0x67be('0x12')],_0x47193d);_0xd77527(_0x5df549[_0x67be('0x11')](0x1f4,_0x3ef2ec[_0x67be('0x12')]));});});};exports[_0x67be('0x20')]=function(_0x1e79f3){var _0x64bc20=this;return new Promise(function(_0x404b93,_0x379916){return db[_0x67be('0x14')][_0x67be('0x21')](_0x1e79f3[_0x67be('0x1f')],{'raw':_0x1e79f3['options']?_0x1e79f3['options'][_0x67be('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e79f3[_0x67be('0x15')]?_0x1e79f3[_0x67be('0x15')][_0x67be('0x22')]||null:null,'attributes':_0x1e79f3[_0x67be('0x15')]?_0x1e79f3[_0x67be('0x15')][_0x67be('0x17')]||null:null,'limit':_0x1e79f3[_0x67be('0x15')]?_0x1e79f3[_0x67be('0x15')][_0x67be('0x18')]||null:null})['then'](function(_0x4d45e4){logger[_0x67be('0xb')](_0x67be('0x20'),_0x1e79f3);logger[_0x67be('0xe')](_0x67be('0x20'),_0x1e79f3,JSON[_0x67be('0x10')](_0x4d45e4));_0x404b93(_0x4d45e4);})[_0x67be('0x1c')](function(_0x8a1ab9){logger[_0x67be('0x11')](_0x67be('0x20'),_0x8a1ab9['message'],_0x1e79f3);_0x379916(_0x64bc20[_0x67be('0x11')](0x1f4,_0x8a1ab9['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index ab7b478..7d3935a 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 _0x7bae=['../../config/environment','./migration.controller','get','index','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x11657f,_0x71dd79){var _0x2f6f0b=function(_0x46cb7c){while(--_0x46cb7c){_0x11657f['push'](_0x11657f['shift']());}};_0x2f6f0b(++_0x71dd79);}(_0x7bae,0x13b));var _0xe7ba=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x7bae[_0x58dc25];return _0x21b0a7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',controller[_0xe7ba('0x8')]);module[_0xe7ba('0x9')]=router; \ No newline at end of file +var _0xa41a=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa41a,0x6b));var _0xaa41=function(_0xc06df3,_0x5f3ba7){_0xc06df3=_0xc06df3-0x0;var _0x4e5f28=_0xa41a[_0xc06df3];return _0x4e5f28;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var fs_extra=require(_0xaa41('0x5'));var auth=require(_0xaa41('0x6'));var interaction=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var controller=require(_0xaa41('0x9'));router['get']('/',controller[_0xaa41('0xa')]);module[_0xaa41('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 ce749c1..3f31b1f 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 _0x9dca=['sequelize','exports'];(function(_0x4d3b09,_0x25c3f2){var _0x32ac8b=function(_0x363b58){while(--_0x363b58){_0x4d3b09['push'](_0x4d3b09['shift']());}};_0x32ac8b(++_0x25c3f2);}(_0x9dca,0xc4));var _0xa9dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9dca[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa9dc('0x0'));module[_0xa9dc('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0xc1e2=['sequelize'];(function(_0x4282e1,_0x1ad91c){var _0x2be669=function(_0x42096f){while(--_0x42096f){_0x4282e1['push'](_0x4282e1['shift']());}};_0x2be669(++_0x1ad91c);}(_0xc1e2,0x17e));var _0x2c1e=function(_0x251966,_0x2565e6){_0x251966=_0x251966-0x0;var _0x17486e=_0xc1e2[_0x251966];return _0x17486e;};'use strict';var Sequelize=require(_0x2c1e('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 86c662f..352d889 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 _0xf249=['path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x3e2197,_0x49910e){var _0x35ff3b=function(_0x43fb95){while(--_0x43fb95){_0x3e2197['push'](_0x3e2197['shift']());}};_0x35ff3b(++_0x49910e);}(_0xf249,0x1d5));var _0x9f24=function(_0x14a3dd,_0x29320a){_0x14a3dd=_0x14a3dd-0x0;var _0x293676=_0xf249[_0x14a3dd];return _0x293676;};'use strict';var emlformat=require(_0x9f24('0x0'));var rimraf=require(_0x9f24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f24('0x2'));var rp=require(_0x9f24('0x3'));var moment=require('moment');var BPromise=require(_0x9f24('0x4'));var Mustache=require(_0x9f24('0x5'));var util=require(_0x9f24('0x6'));var path=require(_0x9f24('0x7'));var sox=require(_0x9f24('0x8'));var csv=require(_0x9f24('0x9'));var ejs=require(_0x9f24('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f24('0xb'));var squel=require(_0x9f24('0xc'));var crypto=require('crypto');var jsforce=require(_0x9f24('0xd'));var deskjs=require(_0x9f24('0xe'));var toCsv=require(_0x9f24('0x9'));var querystring=require(_0x9f24('0xf'));var Papa=require(_0x9f24('0x10'));var Redis=require('ioredis');var authService=require(_0x9f24('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9f24('0x12'));var hardwareService=require(_0x9f24('0x13'));var logger=require(_0x9f24('0x14'))(_0x9f24('0x15'));var utils=require('../../config/utils');var config=require(_0x9f24('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f24('0x17'))['db'];function respondWithStatusCode(_0x556877,_0x7d2984){_0x7d2984=_0x7d2984||0xcc;return function(_0x15f6ef){if(_0x15f6ef){return _0x556877[_0x9f24('0x18')](_0x7d2984);}return _0x556877['status'](_0x7d2984)[_0x9f24('0x19')]();};}function respondWithResult(_0x54b61d,_0x572d04){_0x572d04=_0x572d04||0xc8;return function(_0x7f3688){if(_0x7f3688){return _0x54b61d[_0x9f24('0x1a')](_0x572d04)[_0x9f24('0x1b')](_0x7f3688);}};}function respondWithFilteredResult(_0x2f2c31,_0x1b5607){return function(_0x1b8256){if(_0x1b8256){var _0x2bbc7a=typeof _0x1b5607[_0x9f24('0x1c')]===_0x9f24('0x1d')&&typeof _0x1b5607[_0x9f24('0x1e')]===_0x9f24('0x1d');var _0x5c45e5=_0x1b8256[_0x9f24('0x1f')];var _0x5518da=_0x2bbc7a?0x0:_0x1b5607[_0x9f24('0x1c')];var _0x54f984=_0x2bbc7a?_0x1b8256[_0x9f24('0x1f')]:_0x1b5607[_0x9f24('0x1c')]+_0x1b5607[_0x9f24('0x1e')];var _0x1dda98;if(_0x54f984>=_0x5c45e5){_0x54f984=_0x5c45e5;_0x1dda98=0xc8;}else{_0x1dda98=0xce;}_0x2f2c31[_0x9f24('0x1a')](_0x1dda98);return _0x2f2c31[_0x9f24('0x20')](_0x9f24('0x21'),_0x5518da+'-'+_0x54f984+'/'+_0x5c45e5)[_0x9f24('0x1b')](_0x1b8256);}return null;};}function patchUpdates(_0x5c4399){return function(_0x2b81d8){try{jsonpatch[_0x9f24('0x22')](_0x2b81d8,_0x5c4399,!![]);}catch(_0x35f538){return BPromise[_0x9f24('0x23')](_0x35f538);}return _0x2b81d8[_0x9f24('0x24')]();};}function saveUpdates(_0x480cac,_0x38bbd9){return function(_0x5efac1){if(_0x5efac1){return _0x5efac1[_0x9f24('0x25')](_0x480cac)[_0x9f24('0x26')](function(_0x45d7b2){return _0x45d7b2;});}return null;};}function removeEntity(_0x531163,_0x34232b){return function(_0x154af1){if(_0x154af1){return _0x154af1['destroy']()[_0x9f24('0x26')](function(){_0x531163[_0x9f24('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38767e,_0x1557f7){return function(_0x287688){if(!_0x287688){_0x38767e[_0x9f24('0x18')](0x194);}return _0x287688;};}function handleError(_0x28570e,_0x3f7fb2){_0x3f7fb2=_0x3f7fb2||0x1f4;return function(_0x359963){logger['error'](_0x359963[_0x9f24('0x27')]);if(_0x359963[_0x9f24('0x28')]){delete _0x359963[_0x9f24('0x28')];}_0x28570e[_0x9f24('0x1a')](_0x3f7fb2)['send'](_0x359963);};}exports[_0x9f24('0x29')]=function(_0x333841,_0x545f37){var _0x293703={},_0x312bf8={},_0x4e4dda={'count':0x0,'rows':[]};var _0x7b4814=_[_0x9f24('0x2a')](db[_0x9f24('0x2b')][_0x9f24('0x2c')],function(_0x5d49f1){return{'name':_0x5d49f1[_0x9f24('0x2d')],'type':_0x5d49f1[_0x9f24('0x2e')][_0x9f24('0x2f')]};});_0x312bf8[_0x9f24('0x30')]=_[_0x9f24('0x2a')](_0x7b4814,_0x9f24('0x28'));_0x312bf8[_0x9f24('0x31')]=_[_0x9f24('0x32')](_0x333841[_0x9f24('0x31')]);_0x312bf8[_0x9f24('0x33')]=_[_0x9f24('0x34')](_0x312bf8[_0x9f24('0x30')],_0x312bf8[_0x9f24('0x31')]);_0x293703[_0x9f24('0x35')]=_[_0x9f24('0x34')](_0x312bf8['model'],qs[_0x9f24('0x36')](_0x333841[_0x9f24('0x31')][_0x9f24('0x36')]));_0x293703['attributes']=_0x293703[_0x9f24('0x35')][_0x9f24('0x37')]?_0x293703[_0x9f24('0x35')]:_0x312bf8[_0x9f24('0x30')];if(!_0x333841[_0x9f24('0x31')][_0x9f24('0x38')]('nolimit')){_0x293703[_0x9f24('0x1e')]=qs[_0x9f24('0x1e')](_0x333841[_0x9f24('0x31')][_0x9f24('0x1e')]);_0x293703[_0x9f24('0x1c')]=qs[_0x9f24('0x1c')](_0x333841[_0x9f24('0x31')][_0x9f24('0x1c')]);}_0x293703[_0x9f24('0x39')]=qs[_0x9f24('0x3a')](_0x333841[_0x9f24('0x31')][_0x9f24('0x3a')]);_0x293703[_0x9f24('0x3b')]=qs[_0x9f24('0x33')](_[_0x9f24('0x3c')](_0x333841[_0x9f24('0x31')],_0x312bf8[_0x9f24('0x33')]),_0x7b4814);if(_0x333841[_0x9f24('0x31')][_0x9f24('0x3d')]){_0x293703[_0x9f24('0x3b')]=_[_0x9f24('0x3e')](_0x293703[_0x9f24('0x3b')],{'$or':_['map'](_0x7b4814,function(_0x2b120b){if(_0x2b120b[_0x9f24('0x2e')]!==_0x9f24('0x3f')){var _0x11cf3a={};_0x11cf3a[_0x2b120b[_0x9f24('0x28')]]={'$like':'%'+_0x333841[_0x9f24('0x31')][_0x9f24('0x3d')]+'%'};return _0x11cf3a;}})});}_0x293703=_['merge']({},_0x293703,_0x333841['options']);var _0x2f7131={'where':_0x293703['where']};return db[_0x9f24('0x2b')][_0x9f24('0x1f')](_0x2f7131)['then'](function(_0x27ffee){_0x4e4dda[_0x9f24('0x1f')]=_0x27ffee;if(_0x333841[_0x9f24('0x31')][_0x9f24('0x40')]){_0x293703['include']=[{'all':!![]}];}return db[_0x9f24('0x2b')][_0x9f24('0x41')](_0x293703);})[_0x9f24('0x26')](function(_0x3590f5){_0x4e4dda[_0x9f24('0x42')]=_0x3590f5;return _0x4e4dda;})['then'](respondWithFilteredResult(_0x545f37,_0x293703))[_0x9f24('0x43')](handleError(_0x545f37,null));}; \ No newline at end of file +var _0x887e=['merge','count','include','rows','catch','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','map','Migration','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x887e,0x1be));var _0xe887=function(_0x3946f1,_0x5008e5){_0x3946f1=_0x3946f1-0x0;var _0x1def20=_0x887e[_0x3946f1];return _0x1def20;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe887('0x0'));var jsonpatch=require(_0xe887('0x1'));var rp=require(_0xe887('0x2'));var moment=require('moment');var BPromise=require(_0xe887('0x3'));var Mustache=require(_0xe887('0x4'));var util=require(_0xe887('0x5'));var path=require(_0xe887('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe887('0x7'));var fs=require('fs');var fs_extra=require(_0xe887('0x8'));var _=require(_0xe887('0x9'));var squel=require(_0xe887('0xa'));var crypto=require('crypto');var jsforce=require(_0xe887('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe887('0xc'));var querystring=require('querystring');var Papa=require(_0xe887('0xd'));var Redis=require(_0xe887('0xe'));var authService=require(_0xe887('0xf'));var qs=require(_0xe887('0x10'));var as=require(_0xe887('0x11'));var hardwareService=require(_0xe887('0x12'));var logger=require(_0xe887('0x13'))('api');var utils=require(_0xe887('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe887('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41f741,_0x53d35a){_0x53d35a=_0x53d35a||0xcc;return function(_0x39821a){if(_0x39821a){return _0x41f741[_0xe887('0x16')](_0x53d35a);}return _0x41f741[_0xe887('0x17')](_0x53d35a)[_0xe887('0x18')]();};}function respondWithResult(_0x1a7ebe,_0x26c8c1){_0x26c8c1=_0x26c8c1||0xc8;return function(_0x4dbeae){if(_0x4dbeae){return _0x1a7ebe[_0xe887('0x17')](_0x26c8c1)[_0xe887('0x19')](_0x4dbeae);}};}function respondWithFilteredResult(_0x3e0180,_0x545962){return function(_0x55891e){if(_0x55891e){var _0x23cd41=typeof _0x545962[_0xe887('0x1a')]==='undefined'&&typeof _0x545962[_0xe887('0x1b')]===_0xe887('0x1c');var _0x401ec3=_0x55891e['count'];var _0x4f0cb8=_0x23cd41?0x0:_0x545962[_0xe887('0x1a')];var _0x150874=_0x23cd41?_0x55891e['count']:_0x545962[_0xe887('0x1a')]+_0x545962[_0xe887('0x1b')];var _0x1dd43e;if(_0x150874>=_0x401ec3){_0x150874=_0x401ec3;_0x1dd43e=0xc8;}else{_0x1dd43e=0xce;}_0x3e0180['status'](_0x1dd43e);return _0x3e0180[_0xe887('0x1d')](_0xe887('0x1e'),_0x4f0cb8+'-'+_0x150874+'/'+_0x401ec3)['json'](_0x55891e);}return null;};}function patchUpdates(_0x397ed8){return function(_0x564e9d){try{jsonpatch[_0xe887('0x1f')](_0x564e9d,_0x397ed8,!![]);}catch(_0x507320){return BPromise[_0xe887('0x20')](_0x507320);}return _0x564e9d['save']();};}function saveUpdates(_0x43aa81,_0x5e2f37){return function(_0x24ef03){if(_0x24ef03){return _0x24ef03[_0xe887('0x21')](_0x43aa81)[_0xe887('0x22')](function(_0x121b19){return _0x121b19;});}return null;};}function removeEntity(_0x582408,_0x1efce5){return function(_0x5e502b){if(_0x5e502b){return _0x5e502b[_0xe887('0x23')]()['then'](function(){_0x582408[_0xe887('0x17')](0xcc)[_0xe887('0x18')]();});}};}function handleEntityNotFound(_0x2e8ceb,_0x3500f4){return function(_0x4cc3a2){if(!_0x4cc3a2){_0x2e8ceb[_0xe887('0x16')](0x194);}return _0x4cc3a2;};}function handleError(_0x36219c,_0xbae784){_0xbae784=_0xbae784||0x1f4;return function(_0x13ba0d){logger[_0xe887('0x24')](_0x13ba0d[_0xe887('0x25')]);if(_0x13ba0d['name']){delete _0x13ba0d[_0xe887('0x26')];}_0x36219c[_0xe887('0x17')](_0xbae784)['send'](_0x13ba0d);};}exports['index']=function(_0x179afb,_0x404bc5){var _0xfb7bd9={},_0x2fc228={},_0x53e767={'count':0x0,'rows':[]};var _0x4749dc=_[_0xe887('0x27')](db[_0xe887('0x28')]['rawAttributes'],function(_0x5705bc){return{'name':_0x5705bc[_0xe887('0x29')],'type':_0x5705bc[_0xe887('0x2a')]['key']};});_0x2fc228[_0xe887('0x2b')]=_[_0xe887('0x27')](_0x4749dc,_0xe887('0x26'));_0x2fc228['query']=_[_0xe887('0x2c')](_0x179afb[_0xe887('0x2d')]);_0x2fc228[_0xe887('0x2e')]=_[_0xe887('0x2f')](_0x2fc228['model'],_0x2fc228[_0xe887('0x2d')]);_0xfb7bd9['attributes']=_['intersection'](_0x2fc228[_0xe887('0x2b')],qs[_0xe887('0x30')](_0x179afb['query'][_0xe887('0x30')]));_0xfb7bd9[_0xe887('0x31')]=_0xfb7bd9[_0xe887('0x31')][_0xe887('0x32')]?_0xfb7bd9[_0xe887('0x31')]:_0x2fc228[_0xe887('0x2b')];if(!_0x179afb[_0xe887('0x2d')][_0xe887('0x33')](_0xe887('0x34'))){_0xfb7bd9[_0xe887('0x1b')]=qs[_0xe887('0x1b')](_0x179afb['query']['limit']);_0xfb7bd9[_0xe887('0x1a')]=qs[_0xe887('0x1a')](_0x179afb[_0xe887('0x2d')][_0xe887('0x1a')]);}_0xfb7bd9['order']=qs[_0xe887('0x35')](_0x179afb['query'][_0xe887('0x35')]);_0xfb7bd9[_0xe887('0x36')]=qs['filters'](_[_0xe887('0x37')](_0x179afb[_0xe887('0x2d')],_0x2fc228[_0xe887('0x2e')]),_0x4749dc);if(_0x179afb[_0xe887('0x2d')][_0xe887('0x38')]){_0xfb7bd9[_0xe887('0x36')]=_['merge'](_0xfb7bd9[_0xe887('0x36')],{'$or':_[_0xe887('0x27')](_0x4749dc,function(_0xddd572){if(_0xddd572[_0xe887('0x2a')]!==_0xe887('0x39')){var _0x51cd77={};_0x51cd77[_0xddd572[_0xe887('0x26')]]={'$like':'%'+_0x179afb[_0xe887('0x2d')][_0xe887('0x38')]+'%'};return _0x51cd77;}})});}_0xfb7bd9=_[_0xe887('0x3a')]({},_0xfb7bd9,_0x179afb['options']);var _0x5e49a3={'where':_0xfb7bd9[_0xe887('0x36')]};return db[_0xe887('0x28')][_0xe887('0x3b')](_0x5e49a3)[_0xe887('0x22')](function(_0x44946b){_0x53e767[_0xe887('0x3b')]=_0x44946b;if(_0x179afb[_0xe887('0x2d')]['includeAll']){_0xfb7bd9[_0xe887('0x3c')]=[{'all':!![]}];}return db[_0xe887('0x28')]['findAll'](_0xfb7bd9);})['then'](function(_0x52ea86){_0x53e767[_0xe887('0x3d')]=_0x52ea86;return _0x53e767;})['then'](respondWithFilteredResult(_0x404bc5,_0xfb7bd9))[_0xe887('0x3e')](handleError(_0x404bc5,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index c2c1198..e0612c5 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 _0x4377=['request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','Migration','migrations','lodash','util','../../config/logger','api','moment'];(function(_0x494821,_0xc290d9){var _0xb840a2=function(_0x3155f4){while(--_0x3155f4){_0x494821['push'](_0x494821['shift']());}};_0xb840a2(++_0xc290d9);}(_0x4377,0xcb));var _0x7437=function(_0x13a712,_0x2dbc3b){_0x13a712=_0x13a712-0x0;var _0x3b390f=_0x4377[_0x13a712];return _0x3b390f;};'use strict';var _=require(_0x7437('0x0'));var util=require(_0x7437('0x1'));var logger=require(_0x7437('0x2'))(_0x7437('0x3'));var moment=require(_0x7437('0x4'));var BPromise=require('bluebird');var rp=require(_0x7437('0x5'));var fs=require('fs');var path=require(_0x7437('0x6'));var rimraf=require(_0x7437('0x7'));var config=require(_0x7437('0x8'));var attributes=require(_0x7437('0x9'));module[_0x7437('0xa')]=function(_0x6b212e,_0x3ce495){return _0x6b212e['define'](_0x7437('0xb'),attributes,{'tableName':_0x7437('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffee=['./migration.attributes','exports','define','Migration','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1795df,_0xcb261e){var _0x3f13c0=function(_0x52c5cf){while(--_0x52c5cf){_0x1795df['push'](_0x1795df['shift']());}};_0x3f13c0(++_0xcb261e);}(_0xffee,0x67));var _0xeffe=function(_0x74d8b8,_0xcace84){_0x74d8b8=_0x74d8b8-0x0;var _0x103aa3=_0xffee[_0x74d8b8];return _0x103aa3;};'use strict';var _=require('lodash');var util=require(_0xeffe('0x0'));var logger=require(_0xeffe('0x1'))(_0xeffe('0x2'));var moment=require('moment');var BPromise=require(_0xeffe('0x3'));var rp=require(_0xeffe('0x4'));var fs=require('fs');var path=require(_0xeffe('0x5'));var rimraf=require(_0xeffe('0x6'));var config=require('../../config/environment');var attributes=require(_0xeffe('0x7'));module[_0xeffe('0x8')]=function(_0x3a822e,_0x346db0){return _0x3a822e[_0xeffe('0x9')](_0xeffe('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 4d69d74..8d9883a 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 _0x77d6=['request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','code','error','Migration,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x77d6,0x17f));var _0x677d=function(_0x42ae69,_0x3bc904){_0x42ae69=_0x42ae69-0x0;var _0x61495a=_0x77d6[_0x42ae69];return _0x61495a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x677d('0x0'));var BPromise=require(_0x677d('0x1'));var rs=require(_0x677d('0x2'));var fs=require('fs');var Redis=require(_0x677d('0x3'));var db=require(_0x677d('0x4'))['db'];var utils=require(_0x677d('0x5'));var logger=require('../../config/logger')(_0x677d('0x6'));var config=require(_0x677d('0x7'));var jayson=require(_0x677d('0x8'));var client=jayson[_0x677d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30ceb1,_0x1e888f,_0x50e45b){return new BPromise(function(_0x11bdf3,_0x1d73d9){return client[_0x677d('0xa')](_0x30ceb1,_0x50e45b)[_0x677d('0xb')](function(_0x5b42b5){logger[_0x677d('0xc')]('Migration,\x20%s,\x20%s',_0x1e888f,_0x677d('0xd'));logger[_0x677d('0xe')](_0x677d('0xf'),_0x1e888f,'request\x20sent',JSON[_0x677d('0x10')](_0x5b42b5));if(_0x5b42b5['error']){if(_0x5b42b5['error'][_0x677d('0x11')]===0x1f4){logger[_0x677d('0x12')](_0x677d('0x13'),_0x1e888f,_0x5b42b5['error'][_0x677d('0x14')]);return _0x1d73d9(_0x5b42b5[_0x677d('0x12')][_0x677d('0x14')]);}logger['error']('Migration,\x20%s,\x20%s',_0x1e888f,_0x5b42b5[_0x677d('0x12')]['message']);return _0x11bdf3(_0x5b42b5['error'][_0x677d('0x14')]);}else{logger[_0x677d('0xc')](_0x677d('0x13'),_0x1e888f,_0x677d('0xd'));_0x11bdf3(_0x5b42b5['result'][_0x677d('0x14')]);}})[_0x677d('0x15')](function(_0x1e0d9a){logger[_0x677d('0x12')]('Migration,\x20%s,\x20%s',_0x1e888f,_0x1e0d9a);_0x1d73d9(_0x1e0d9a);});});} \ No newline at end of file +var _0x7cd0=['randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','debug','request\x20sent','error','message','result','lodash','moment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7cd0,0xb9));var _0x07cd=function(_0x4e63f1,_0x34a2db){_0x4e63f1=_0x4e63f1-0x0;var _0xdbd910=_0x7cd0[_0x4e63f1];return _0xdbd910;};'use strict';var _=require(_0x07cd('0x0'));var util=require('util');var moment=require(_0x07cd('0x1'));var BPromise=require('bluebird');var rs=require(_0x07cd('0x2'));var fs=require('fs');var Redis=require(_0x07cd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x07cd('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x07cd('0x5'));var client=jayson[_0x07cd('0x6')][_0x07cd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5768ee,_0x324451,_0x2b413d){return new BPromise(function(_0x53bee1,_0x3dd389){return client[_0x07cd('0x8')](_0x5768ee,_0x2b413d)[_0x07cd('0x9')](function(_0x413528){logger[_0x07cd('0xa')](_0x07cd('0xb'),_0x324451,'request\x20sent');logger[_0x07cd('0xc')]('Migration,\x20%s,\x20%s,\x20%s',_0x324451,_0x07cd('0xd'),JSON['stringify'](_0x413528));if(_0x413528[_0x07cd('0xe')]){if(_0x413528['error']['code']===0x1f4){logger[_0x07cd('0xe')](_0x07cd('0xb'),_0x324451,_0x413528[_0x07cd('0xe')]['message']);return _0x3dd389(_0x413528[_0x07cd('0xe')][_0x07cd('0xf')]);}logger[_0x07cd('0xe')]('Migration,\x20%s,\x20%s',_0x324451,_0x413528[_0x07cd('0xe')]['message']);return _0x53bee1(_0x413528[_0x07cd('0xe')][_0x07cd('0xf')]);}else{logger[_0x07cd('0xa')](_0x07cd('0xb'),_0x324451,_0x07cd('0xd'));_0x53bee1(_0x413528[_0x07cd('0x10')][_0x07cd('0xf')]);}})['catch'](function(_0x103ec4){logger['error'](_0x07cd('0xb'),_0x324451,_0x103ec4);_0x3dd389(_0x103ec4);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index a2bbdb5..9b0de5a 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 _0x6ec8=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','isAuthenticated','index','get','show','post','put','delete','/:id','destroy','multer','util','path','connect-timeout'];(function(_0x3b38d0,_0xf948c6){var _0x55ee0c=function(_0x466ab5){while(--_0x466ab5){_0x3b38d0['push'](_0x3b38d0['shift']());}};_0x55ee0c(++_0xf948c6);}(_0x6ec8,0x7a));var _0x86ec=function(_0x34c0bf,_0x3b8460){_0x34c0bf=_0x34c0bf-0x0;var _0x315559=_0x6ec8[_0x34c0bf];return _0x315559;};'use strict';var multer=require(_0x86ec('0x0'));var util=require(_0x86ec('0x1'));var path=require(_0x86ec('0x2'));var timeout=require(_0x86ec('0x3'));var express=require('express');var router=express[_0x86ec('0x4')]();var fs_extra=require(_0x86ec('0x5'));var auth=require(_0x86ec('0x6'));var interaction=require(_0x86ec('0x7'));var config=require('../../config/environment');var controller=require(_0x86ec('0x8'));router['get']('/',auth[_0x86ec('0x9')](),controller[_0x86ec('0xa')]);router[_0x86ec('0xb')]('/:id',auth[_0x86ec('0x9')](),controller[_0x86ec('0xc')]);router[_0x86ec('0xd')]('/',auth[_0x86ec('0x9')](),controller['create']);router[_0x86ec('0xe')]('/:id',auth[_0x86ec('0x9')](),controller['update']);router[_0x86ec('0xf')](_0x86ec('0x10'),auth[_0x86ec('0x9')](),controller[_0x86ec('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8143=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3bc299,_0x4fc0d2){var _0x3a71f5=function(_0x47e80c){while(--_0x47e80c){_0x3bc299['push'](_0x3bc299['shift']());}};_0x3a71f5(++_0x4fc0d2);}(_0x8143,0x1b4));var _0x3814=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8143[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x3814('0x0'));var util=require('util');var path=require(_0x3814('0x1'));var timeout=require(_0x3814('0x2'));var express=require(_0x3814('0x3'));var router=express[_0x3814('0x4')]();var fs_extra=require(_0x3814('0x5'));var auth=require(_0x3814('0x6'));var interaction=require(_0x3814('0x7'));var config=require(_0x3814('0x8'));var controller=require(_0x3814('0x9'));router[_0x3814('0xa')]('/',auth[_0x3814('0xb')](),controller[_0x3814('0xc')]);router[_0x3814('0xa')]('/:id',auth[_0x3814('0xb')](),controller[_0x3814('0xd')]);router[_0x3814('0xe')]('/',auth['isAuthenticated'](),controller[_0x3814('0xf')]);router['put']('/:id',auth[_0x3814('0xb')](),controller[_0x3814('0x10')]);router[_0x3814('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3814('0x12')]);module[_0x3814('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index ce57ea3..d9c45bb 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 _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x1f0f93,_0x29336c){var _0x15667f=function(_0x166840){while(--_0x166840){_0x1f0f93['push'](_0x1f0f93['shift']());}};_0x15667f(++_0x29336c);}(_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')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x343b59,_0x51f4f2){var _0x5366a5=function(_0xdee88d){while(--_0xdee88d){_0x343b59['push'](_0x343b59['shift']());}};_0x5366a5(++_0x51f4f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 385c5ff..4123291 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 _0xb927=['writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','join','server/files/templates/network.ejs','utf8','render','format','/etc/asterisk/sip_xcally_%s.conf','update','STUN','server/files/templates/stun_multiple.ejs','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','toLowerCase','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','Network,\x20%s,\x20%s','message','result','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','stack','name','index','Network','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','sequelize','transaction','body','readFileSync','root'];(function(_0x1f5f5e,_0x46322b){var _0x25f6aa=function(_0xede000){while(--_0xede000){_0x1f5f5e['push'](_0x1f5f5e['shift']());}};_0x25f6aa(++_0x46322b);}(_0xb927,0x80));var _0x7b92=function(_0x1467b3,_0x2bd11a){_0x1467b3=_0x1467b3-0x0;var _0x2e704a=_0xb927[_0x1467b3];return _0x2e704a;};'use strict';var emlformat=require(_0x7b92('0x0'));var rimraf=require(_0x7b92('0x1'));var zipdir=require(_0x7b92('0x2'));var jsonpatch=require(_0x7b92('0x3'));var rp=require('request-promise');var moment=require(_0x7b92('0x4'));var BPromise=require(_0x7b92('0x5'));var Mustache=require(_0x7b92('0x6'));var util=require(_0x7b92('0x7'));var path=require(_0x7b92('0x8'));var sox=require(_0x7b92('0x9'));var csv=require(_0x7b92('0xa'));var ejs=require(_0x7b92('0xb'));var fs=require('fs');var fs_extra=require(_0x7b92('0xc'));var _=require('lodash');var squel=require(_0x7b92('0xd'));var crypto=require(_0x7b92('0xe'));var jsforce=require(_0x7b92('0xf'));var deskjs=require(_0x7b92('0x10'));var toCsv=require(_0x7b92('0xa'));var querystring=require(_0x7b92('0x11'));var Papa=require(_0x7b92('0x12'));var Redis=require(_0x7b92('0x13'));var authService=require(_0x7b92('0x14'));var qs=require(_0x7b92('0x15'));var as=require(_0x7b92('0x16'));var hardwareService=require(_0x7b92('0x17'));var logger=require(_0x7b92('0x18'))('api');var utils=require(_0x7b92('0x19'));var config=require(_0x7b92('0x1a'));var licenseUtil=require(_0x7b92('0x1b'));var db=require(_0x7b92('0x1c'))['db'];var jayson=require(_0x7b92('0x1d'));var client=jayson['client'][_0x7b92('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x57d053,_0x35c3a2,_0x3f9072,_0x4782c6){return new BPromise(function(_0x225b3b,_0x13f84b){var _0x27b374=_0x4782c6||client;return _0x27b374[_0x7b92('0x1f')](_0x57d053,_0x3f9072)[_0x7b92('0x20')](function(_0x28bfd7){logger[_0x7b92('0x21')]('Network,\x20%s,\x20%s',_0x35c3a2,_0x7b92('0x22'));logger[_0x7b92('0x23')]('Network,\x20%s,\x20%s,\x20%s',_0x35c3a2,'request\x20sent',JSON[_0x7b92('0x24')](_0x28bfd7));if(_0x28bfd7[_0x7b92('0x25')]){if(_0x28bfd7['error']['code']===0x1f4){logger['error'](_0x7b92('0x26'),_0x35c3a2,_0x28bfd7[_0x7b92('0x25')]['message']);return _0x13f84b(_0x28bfd7[_0x7b92('0x25')][_0x7b92('0x27')]);}logger[_0x7b92('0x25')]('Network,\x20%s,\x20%s',_0x35c3a2,_0x28bfd7[_0x7b92('0x25')][_0x7b92('0x27')]);return _0x225b3b(_0x28bfd7[_0x7b92('0x25')][_0x7b92('0x27')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x35c3a2,'request\x20sent');_0x225b3b(_0x28bfd7[_0x7b92('0x28')][_0x7b92('0x27')]);}})['catch'](function(_0x46c0b1){logger[_0x7b92('0x25')](_0x7b92('0x26'),_0x35c3a2,_0x46c0b1);_0x13f84b(_0x46c0b1);});});}function respondWithStatusCode(_0x28bb52,_0xcbae40){_0xcbae40=_0xcbae40||0xcc;return function(_0x4bcf14){if(_0x4bcf14){return _0x28bb52[_0x7b92('0x29')](_0xcbae40);}return _0x28bb52['status'](_0xcbae40)[_0x7b92('0x2a')]();};}function respondWithResult(_0x4cb948,_0x5c2399){_0x5c2399=_0x5c2399||0xc8;return function(_0x38c738){if(_0x38c738){return _0x4cb948[_0x7b92('0x2b')](_0x5c2399)[_0x7b92('0x2c')](_0x38c738);}};}function respondWithFilteredResult(_0x198f75,_0x546172){return function(_0x19b60a){if(_0x19b60a){var _0x13285d=typeof _0x546172[_0x7b92('0x2d')]==='undefined'&&typeof _0x546172[_0x7b92('0x2e')]===_0x7b92('0x2f');var _0x21d3dc=_0x19b60a[_0x7b92('0x30')];var _0x14b02e=_0x13285d?0x0:_0x546172['offset'];var _0x44cf04=_0x13285d?_0x19b60a['count']:_0x546172[_0x7b92('0x2d')]+_0x546172[_0x7b92('0x2e')];var _0x231012;if(_0x44cf04>=_0x21d3dc){_0x44cf04=_0x21d3dc;_0x231012=0xc8;}else{_0x231012=0xce;}_0x198f75['status'](_0x231012);return _0x198f75[_0x7b92('0x31')](_0x7b92('0x32'),_0x14b02e+'-'+_0x44cf04+'/'+_0x21d3dc)['json'](_0x19b60a);}return null;};}function patchUpdates(_0x592a36){return function(_0x66a437){try{jsonpatch[_0x7b92('0x33')](_0x66a437,_0x592a36,!![]);}catch(_0x172493){return BPromise[_0x7b92('0x34')](_0x172493);}return _0x66a437['save']();};}function saveUpdates(_0x2bed58,_0x420d9b){return function(_0x58aa76){if(_0x58aa76){return _0x58aa76['update'](_0x2bed58)['then'](function(_0x376c5f){return _0x376c5f;});}return null;};}function removeEntity(_0x12fd01,_0x5bba96){return function(_0x2c3764){if(_0x2c3764){return _0x2c3764['destroy']()[_0x7b92('0x20')](function(){_0x12fd01[_0x7b92('0x2b')](0xcc)[_0x7b92('0x2a')]();});}};}function handleEntityNotFound(_0x2ef2b0,_0x1c4ded){return function(_0x253878){if(!_0x253878){_0x2ef2b0['sendStatus'](0x194);}return _0x253878;};}function handleError(_0xbc7277,_0x3594aa){_0x3594aa=_0x3594aa||0x1f4;return function(_0x262187){logger[_0x7b92('0x25')](_0x262187[_0x7b92('0x35')]);if(_0x262187[_0x7b92('0x36')]){delete _0x262187['name'];}_0xbc7277[_0x7b92('0x2b')](_0x3594aa)['send'](_0x262187);};}exports[_0x7b92('0x37')]=function(_0x4b05ab,_0x3128d2){var _0x52d387={},_0x56091a={},_0x2b2ba3={'count':0x0,'rows':[]};var _0x57166c=_['map'](db[_0x7b92('0x38')]['rawAttributes'],function(_0x464669){return{'name':_0x464669['fieldName'],'type':_0x464669[_0x7b92('0x39')][_0x7b92('0x3a')]};});_0x56091a[_0x7b92('0x3b')]=_[_0x7b92('0x3c')](_0x57166c,_0x7b92('0x36'));_0x56091a[_0x7b92('0x3d')]=_[_0x7b92('0x3e')](_0x4b05ab[_0x7b92('0x3d')]);_0x56091a[_0x7b92('0x3f')]=_['intersection'](_0x56091a[_0x7b92('0x3b')],_0x56091a[_0x7b92('0x3d')]);_0x52d387[_0x7b92('0x40')]=_[_0x7b92('0x41')](_0x56091a['model'],qs[_0x7b92('0x42')](_0x4b05ab[_0x7b92('0x3d')][_0x7b92('0x42')]));_0x52d387[_0x7b92('0x40')]=_0x52d387[_0x7b92('0x40')][_0x7b92('0x43')]?_0x52d387['attributes']:_0x56091a[_0x7b92('0x3b')];if(!_0x4b05ab[_0x7b92('0x3d')][_0x7b92('0x44')](_0x7b92('0x45'))){_0x52d387[_0x7b92('0x2e')]=qs[_0x7b92('0x2e')](_0x4b05ab[_0x7b92('0x3d')][_0x7b92('0x2e')]);_0x52d387[_0x7b92('0x2d')]=qs[_0x7b92('0x2d')](_0x4b05ab[_0x7b92('0x3d')][_0x7b92('0x2d')]);}_0x52d387['order']=qs[_0x7b92('0x46')](_0x4b05ab[_0x7b92('0x3d')][_0x7b92('0x46')]);_0x52d387[_0x7b92('0x47')]=qs[_0x7b92('0x3f')](_['pick'](_0x4b05ab[_0x7b92('0x3d')],_0x56091a[_0x7b92('0x3f')]),_0x57166c);if(_0x4b05ab['query']['filter']){_0x52d387['where']=_[_0x7b92('0x48')](_0x52d387[_0x7b92('0x47')],{'$or':_[_0x7b92('0x3c')](_0x57166c,function(_0x2ffc73){if(_0x2ffc73[_0x7b92('0x39')]!==_0x7b92('0x49')){var _0x5eb8fd={};_0x5eb8fd[_0x2ffc73[_0x7b92('0x36')]]={'$like':'%'+_0x4b05ab['query']['filter']+'%'};return _0x5eb8fd;}})});}_0x52d387=_[_0x7b92('0x48')]({},_0x52d387,_0x4b05ab[_0x7b92('0x4a')]);var _0x1d2b6a={'where':_0x52d387[_0x7b92('0x47')]};return db[_0x7b92('0x38')][_0x7b92('0x30')](_0x1d2b6a)['then'](function(_0x22cd9d){_0x2b2ba3[_0x7b92('0x30')]=_0x22cd9d;if(_0x4b05ab[_0x7b92('0x3d')][_0x7b92('0x4b')]){_0x52d387[_0x7b92('0x4c')]=[{'all':!![]}];}return db['Network'][_0x7b92('0x4d')](_0x52d387);})[_0x7b92('0x20')](function(_0x42373a){_0x2b2ba3[_0x7b92('0x4e')]=_0x42373a;return _0x2b2ba3;})['then'](respondWithFilteredResult(_0x3128d2,_0x52d387))[_0x7b92('0x4f')](handleError(_0x3128d2,null));};exports[_0x7b92('0x50')]=function(_0x477476,_0x56b466){var _0xcbbae0={'raw':!![],'where':{'id':_0x477476[_0x7b92('0x51')]['id']}},_0x321032={};_0x321032[_0x7b92('0x3b')]=_['keys'](db[_0x7b92('0x38')][_0x7b92('0x52')]);_0x321032['query']=_['keys'](_0x477476[_0x7b92('0x3d')]);_0x321032['filters']=_[_0x7b92('0x41')](_0x321032[_0x7b92('0x3b')],_0x321032['query']);_0xcbbae0['attributes']=_['intersection'](_0x321032[_0x7b92('0x3b')],qs[_0x7b92('0x42')](_0x477476[_0x7b92('0x3d')][_0x7b92('0x42')]));_0xcbbae0[_0x7b92('0x40')]=_0xcbbae0[_0x7b92('0x40')]['length']?_0xcbbae0['attributes']:_0x321032[_0x7b92('0x3b')];if(_0x477476[_0x7b92('0x3d')][_0x7b92('0x4b')]){_0xcbbae0[_0x7b92('0x4c')]=[{'all':!![]}];}_0xcbbae0=_[_0x7b92('0x48')]({},_0xcbbae0,_0x477476[_0x7b92('0x4a')]);return db['Network'][_0x7b92('0x53')](_0xcbbae0)[_0x7b92('0x20')](handleEntityNotFound(_0x56b466,null))[_0x7b92('0x20')](respondWithResult(_0x56b466,null))[_0x7b92('0x4f')](handleError(_0x56b466,null));};exports[_0x7b92('0x54')]=function(_0x1c929b,_0x32f3c2,_0x171d4c){var _0x30507a;return db[_0x7b92('0x55')][_0x7b92('0x56')](function(_0x5a2a49){return db[_0x7b92('0x38')]['create'](_0x1c929b[_0x7b92('0x57')],{'raw':!![]})[_0x7b92('0x20')](function(_0x3f8618){_0x30507a=_0x3f8618;return db[_0x7b92('0x38')][_0x7b92('0x4d')]({'where':{'type':_0x1c929b[_0x7b92('0x57')][_0x7b92('0x39')]},'raw':!![]});})[_0x7b92('0x20')](function(_0x1989e2){if(_0x30507a[_0x7b92('0x39')]['toUpperCase']()=='STUN'){var _0x51d9fc=fs[_0x7b92('0x58')](path['join'](config[_0x7b92('0x59')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x9194c9=ejs['render'](_0x51d9fc,{'networks':_0x1989e2||[]});fs[_0x7b92('0x5a')](_0x7b92('0x5b'),_0x9194c9);return respondWithRpcPromise(_0x7b92('0x5c'),_0x7b92('0x54'),{'module':_0x7b92('0x5d')});}else if(_0x30507a[_0x7b92('0x39')][_0x7b92('0x5e')]()=='TURN'){var _0x4da136=fs[_0x7b92('0x58')](path['join'](config[_0x7b92('0x59')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x49f671=ejs['render'](_0x4da136,{'networks':_0x1989e2||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x49f671);return respondWithRpcPromise('Reload',_0x7b92('0x54'),{'module':_0x7b92('0x5d')});}else{var _0x5d8886=fs['readFileSync'](path[_0x7b92('0x5f')](config[_0x7b92('0x59')],_0x7b92('0x60')),_0x7b92('0x61'));var _0x317881=ejs[_0x7b92('0x62')](_0x5d8886,{'networks':_0x1989e2||[]});fs[_0x7b92('0x5a')](util[_0x7b92('0x63')](_0x7b92('0x64'),_0x1c929b[_0x7b92('0x57')][_0x7b92('0x39')]['toLowerCase']()),_0x317881);return respondWithRpcPromise(_0x7b92('0x5c'),_0x7b92('0x54'),{'module':'chan_sip.so'});}return null;})[_0x7b92('0x20')](function(){return _0x30507a;});})[_0x7b92('0x20')](respondWithResult(_0x32f3c2,0xc9))['catch'](handleError(_0x32f3c2,null));};exports[_0x7b92('0x65')]=function(_0x1d4820,_0x5dab92,_0x1ae3c5){var _0x5a745d;return db[_0x7b92('0x55')][_0x7b92('0x56')](function(_0xa37e80){return db['Network'][_0x7b92('0x53')]({'where':{'id':_0x1d4820['params']['id']}})[_0x7b92('0x20')](handleEntityNotFound(_0x5dab92,null))['then'](saveUpdates(_0x1d4820['body'],null))['then'](function(_0x239b0c){if(_0x239b0c){_0x5a745d=_0x239b0c;return db[_0x7b92('0x38')]['findAll']({'where':{'type':_0x5a745d[_0x7b92('0x39')]},'raw':!![]});}return null;})['then'](function(_0x5c826a){if(_0x5a745d[_0x7b92('0x39')][_0x7b92('0x5e')]()==_0x7b92('0x66')){var _0x326dd0=fs[_0x7b92('0x58')](path['join'](config[_0x7b92('0x59')],_0x7b92('0x67')),_0x7b92('0x61'));var _0x4261ef=ejs[_0x7b92('0x62')](_0x326dd0,{'networks':_0x5c826a||[]});fs[_0x7b92('0x5a')](_0x7b92('0x5b'),_0x4261ef);return respondWithRpcPromise('Reload','update',{'module':_0x7b92('0x5d')});}else if(_0x5a745d[_0x7b92('0x39')][_0x7b92('0x5e')]()==_0x7b92('0x68')){var _0x5717db=fs['readFileSync'](path['join'](config[_0x7b92('0x59')],_0x7b92('0x69')),'utf8');var _0x4afd9a=ejs['render'](_0x5717db,{'networks':_0x5c826a||[]});fs[_0x7b92('0x5a')](_0x7b92('0x6a'),_0x4afd9a);return respondWithRpcPromise(_0x7b92('0x5c'),'update',{'module':_0x7b92('0x5d')});}else{var _0x59e4ff=fs[_0x7b92('0x58')](path['join'](config[_0x7b92('0x59')],_0x7b92('0x60')),_0x7b92('0x61'));var _0x2f549b=ejs[_0x7b92('0x62')](_0x59e4ff,{'networks':_0x5c826a||[]});fs['writeFileSync'](util[_0x7b92('0x63')](_0x7b92('0x64'),_0x1d4820[_0x7b92('0x57')][_0x7b92('0x39')][_0x7b92('0x6b')]()),_0x2f549b);return respondWithRpcPromise('Reload',_0x7b92('0x65'),{'module':_0x7b92('0x6c')});}return null;})['then'](function(_0x4647aa){if(_0x4647aa){return _0x5a745d;}return null;});})[_0x7b92('0x20')](respondWithResult(_0x5dab92,null))['catch'](handleError(_0x5dab92,null));};exports['destroy']=function(_0x465d9c,_0x1d6608,_0x620325){var _0x75e142;return db[_0x7b92('0x38')][_0x7b92('0x53')]({'where':{'id':_0x465d9c[_0x7b92('0x51')]['id']}})[_0x7b92('0x20')](function(_0x3176a9){_0x75e142=_0x3176a9;return _0x3176a9;})['then'](handleEntityNotFound(_0x1d6608,null))[_0x7b92('0x20')](removeEntity(_0x1d6608,null))['then'](function(){if(_0x75e142){return db[_0x7b92('0x38')][_0x7b92('0x4d')]({'where':{'type':_0x75e142[_0x7b92('0x39')]},'raw':!![]});}})[_0x7b92('0x20')](function(_0x229ed7){if(_0x75e142['type']['toUpperCase']()==_0x7b92('0x66')){var _0x37435e=fs[_0x7b92('0x58')](path[_0x7b92('0x5f')](config[_0x7b92('0x59')],_0x7b92('0x67')),'utf8');var _0x4c0cbc=ejs[_0x7b92('0x62')](_0x37435e,{'networks':_0x229ed7||[]});fs[_0x7b92('0x5a')](_0x7b92('0x5b'),_0x4c0cbc);return respondWithRpcPromise(_0x7b92('0x5c'),'destroy',{'module':_0x7b92('0x5d')});}else if(_0x75e142[_0x7b92('0x39')][_0x7b92('0x5e')]()=='TURN'){var _0x3d323c=fs['readFileSync'](path['join'](config['root'],_0x7b92('0x69')),_0x7b92('0x61'));var _0x3f949f=ejs['render'](_0x3d323c,{'networks':_0x229ed7||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x3f949f);return respondWithRpcPromise(_0x7b92('0x5c'),'destroy',{'module':_0x7b92('0x5d')});}else{var _0x32fae3=fs[_0x7b92('0x58')](path[_0x7b92('0x5f')](config[_0x7b92('0x59')],_0x7b92('0x60')),_0x7b92('0x61'));var _0x2f45b7=ejs['render'](_0x32fae3,{'networks':_0x229ed7||[]});fs[_0x7b92('0x5a')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x465d9c[_0x7b92('0x57')]['type'][_0x7b92('0x6b')]()),_0x2f45b7);return respondWithRpcPromise(_0x7b92('0x5c'),'destroy',{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x1d6608,null));}; \ No newline at end of file +var _0x6085=['toLowerCase','chan_sip.so','transaction','/etc/asterisk/sip_xcally_%s.conf','/etc/asterisk/stun_xcally.conf','TURN','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','error','code','Network,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','apply','save','update','destroy','stack','name','index','map','Network','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','toUpperCase','STUN','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','res_stun_monitor.so','readFileSync','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format'];(function(_0x27fdeb,_0x46ffef){var _0x57f4a6=function(_0x4d4b4a){while(--_0x4d4b4a){_0x27fdeb['push'](_0x27fdeb['shift']());}};_0x57f4a6(++_0x46ffef);}(_0x6085,0x1b2));var _0x5608=function(_0x38ae59,_0x2fd813){_0x38ae59=_0x38ae59-0x0;var _0x413cbd=_0x6085[_0x38ae59];return _0x413cbd;};'use strict';var emlformat=require(_0x5608('0x0'));var rimraf=require(_0x5608('0x1'));var zipdir=require(_0x5608('0x2'));var jsonpatch=require(_0x5608('0x3'));var rp=require(_0x5608('0x4'));var moment=require(_0x5608('0x5'));var BPromise=require(_0x5608('0x6'));var Mustache=require(_0x5608('0x7'));var util=require(_0x5608('0x8'));var path=require(_0x5608('0x9'));var sox=require(_0x5608('0xa'));var csv=require(_0x5608('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5608('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5608('0xd'));var jsforce=require(_0x5608('0xe'));var deskjs=require(_0x5608('0xf'));var toCsv=require(_0x5608('0xb'));var querystring=require(_0x5608('0x10'));var Papa=require(_0x5608('0x11'));var Redis=require(_0x5608('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5608('0x13'));var as=require(_0x5608('0x14'));var hardwareService=require(_0x5608('0x15'));var logger=require(_0x5608('0x16'))(_0x5608('0x17'));var utils=require(_0x5608('0x18'));var config=require(_0x5608('0x19'));var licenseUtil=require(_0x5608('0x1a'));var db=require(_0x5608('0x1b'))['db'];var jayson=require(_0x5608('0x1c'));var client=jayson[_0x5608('0x1d')][_0x5608('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xeee693,_0x12599a,_0x165224,_0x219ee5){return new BPromise(function(_0x3e5614,_0x20e93f){var _0x59d372=_0x219ee5||client;return _0x59d372[_0x5608('0x1f')](_0xeee693,_0x165224)[_0x5608('0x20')](function(_0x2016d5){logger[_0x5608('0x21')]('Network,\x20%s,\x20%s',_0x12599a,_0x5608('0x22'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x12599a,_0x5608('0x22'),JSON['stringify'](_0x2016d5));if(_0x2016d5[_0x5608('0x23')]){if(_0x2016d5[_0x5608('0x23')][_0x5608('0x24')]===0x1f4){logger[_0x5608('0x23')](_0x5608('0x25'),_0x12599a,_0x2016d5[_0x5608('0x23')][_0x5608('0x26')]);return _0x20e93f(_0x2016d5[_0x5608('0x23')][_0x5608('0x26')]);}logger[_0x5608('0x23')](_0x5608('0x25'),_0x12599a,_0x2016d5[_0x5608('0x23')][_0x5608('0x26')]);return _0x3e5614(_0x2016d5[_0x5608('0x23')][_0x5608('0x26')]);}else{logger[_0x5608('0x21')]('Network,\x20%s,\x20%s',_0x12599a,_0x5608('0x22'));_0x3e5614(_0x2016d5[_0x5608('0x27')][_0x5608('0x26')]);}})[_0x5608('0x28')](function(_0x380765){logger[_0x5608('0x23')](_0x5608('0x25'),_0x12599a,_0x380765);_0x20e93f(_0x380765);});});}function respondWithStatusCode(_0x2fc72b,_0x392a87){_0x392a87=_0x392a87||0xcc;return function(_0x3d3816){if(_0x3d3816){return _0x2fc72b[_0x5608('0x29')](_0x392a87);}return _0x2fc72b[_0x5608('0x2a')](_0x392a87)[_0x5608('0x2b')]();};}function respondWithResult(_0x2ce9a7,_0x55f644){_0x55f644=_0x55f644||0xc8;return function(_0x4c127b){if(_0x4c127b){return _0x2ce9a7[_0x5608('0x2a')](_0x55f644)['json'](_0x4c127b);}};}function respondWithFilteredResult(_0x3a6caa,_0x562425){return function(_0x4fe0f8){if(_0x4fe0f8){var _0x2da2fa=typeof _0x562425[_0x5608('0x2c')]===_0x5608('0x2d')&&typeof _0x562425['limit']===_0x5608('0x2d');var _0x493326=_0x4fe0f8[_0x5608('0x2e')];var _0x40d182=_0x2da2fa?0x0:_0x562425[_0x5608('0x2c')];var _0x5802ec=_0x2da2fa?_0x4fe0f8[_0x5608('0x2e')]:_0x562425[_0x5608('0x2c')]+_0x562425[_0x5608('0x2f')];var _0x301ce0;if(_0x5802ec>=_0x493326){_0x5802ec=_0x493326;_0x301ce0=0xc8;}else{_0x301ce0=0xce;}_0x3a6caa['status'](_0x301ce0);return _0x3a6caa['set']('Content-Range',_0x40d182+'-'+_0x5802ec+'/'+_0x493326)['json'](_0x4fe0f8);}return null;};}function patchUpdates(_0x3e5b2a){return function(_0x50e4c3){try{jsonpatch[_0x5608('0x30')](_0x50e4c3,_0x3e5b2a,!![]);}catch(_0x69e690){return BPromise['reject'](_0x69e690);}return _0x50e4c3[_0x5608('0x31')]();};}function saveUpdates(_0x84b21a,_0xc657b4){return function(_0xc21296){if(_0xc21296){return _0xc21296[_0x5608('0x32')](_0x84b21a)[_0x5608('0x20')](function(_0x420d92){return _0x420d92;});}return null;};}function removeEntity(_0x12210b,_0xcf59a2){return function(_0x287c89){if(_0x287c89){return _0x287c89[_0x5608('0x33')]()['then'](function(){_0x12210b['status'](0xcc)[_0x5608('0x2b')]();});}};}function handleEntityNotFound(_0x1b269d,_0x15e4c7){return function(_0x6af1b1){if(!_0x6af1b1){_0x1b269d['sendStatus'](0x194);}return _0x6af1b1;};}function handleError(_0x2332a9,_0x3aeb90){_0x3aeb90=_0x3aeb90||0x1f4;return function(_0x45f748){logger[_0x5608('0x23')](_0x45f748[_0x5608('0x34')]);if(_0x45f748[_0x5608('0x35')]){delete _0x45f748[_0x5608('0x35')];}_0x2332a9[_0x5608('0x2a')](_0x3aeb90)['send'](_0x45f748);};}exports[_0x5608('0x36')]=function(_0x758d7e,_0x57bba7){var _0x3420ba={},_0x93de30={},_0x23ac21={'count':0x0,'rows':[]};var _0x218204=_[_0x5608('0x37')](db[_0x5608('0x38')][_0x5608('0x39')],function(_0x4c154d){return{'name':_0x4c154d[_0x5608('0x3a')],'type':_0x4c154d[_0x5608('0x3b')][_0x5608('0x3c')]};});_0x93de30[_0x5608('0x3d')]=_[_0x5608('0x37')](_0x218204,'name');_0x93de30['query']=_[_0x5608('0x3e')](_0x758d7e['query']);_0x93de30[_0x5608('0x3f')]=_['intersection'](_0x93de30[_0x5608('0x3d')],_0x93de30[_0x5608('0x40')]);_0x3420ba['attributes']=_[_0x5608('0x41')](_0x93de30[_0x5608('0x3d')],qs[_0x5608('0x42')](_0x758d7e[_0x5608('0x40')]['fields']));_0x3420ba[_0x5608('0x43')]=_0x3420ba[_0x5608('0x43')]['length']?_0x3420ba[_0x5608('0x43')]:_0x93de30['model'];if(!_0x758d7e['query'][_0x5608('0x44')](_0x5608('0x45'))){_0x3420ba[_0x5608('0x2f')]=qs[_0x5608('0x2f')](_0x758d7e[_0x5608('0x40')]['limit']);_0x3420ba[_0x5608('0x2c')]=qs['offset'](_0x758d7e['query'][_0x5608('0x2c')]);}_0x3420ba[_0x5608('0x46')]=qs['sort'](_0x758d7e[_0x5608('0x40')]['sort']);_0x3420ba[_0x5608('0x47')]=qs[_0x5608('0x3f')](_['pick'](_0x758d7e['query'],_0x93de30[_0x5608('0x3f')]),_0x218204);if(_0x758d7e[_0x5608('0x40')][_0x5608('0x48')]){_0x3420ba[_0x5608('0x47')]=_[_0x5608('0x49')](_0x3420ba[_0x5608('0x47')],{'$or':_[_0x5608('0x37')](_0x218204,function(_0x2978b4){if(_0x2978b4[_0x5608('0x3b')]!==_0x5608('0x4a')){var _0x53d861={};_0x53d861[_0x2978b4[_0x5608('0x35')]]={'$like':'%'+_0x758d7e[_0x5608('0x40')]['filter']+'%'};return _0x53d861;}})});}_0x3420ba=_[_0x5608('0x49')]({},_0x3420ba,_0x758d7e[_0x5608('0x4b')]);var _0xfc743a={'where':_0x3420ba[_0x5608('0x47')]};return db[_0x5608('0x38')][_0x5608('0x2e')](_0xfc743a)[_0x5608('0x20')](function(_0x278466){_0x23ac21[_0x5608('0x2e')]=_0x278466;if(_0x758d7e[_0x5608('0x40')][_0x5608('0x4c')]){_0x3420ba[_0x5608('0x4d')]=[{'all':!![]}];}return db[_0x5608('0x38')][_0x5608('0x4e')](_0x3420ba);})[_0x5608('0x20')](function(_0x59cf60){_0x23ac21[_0x5608('0x4f')]=_0x59cf60;return _0x23ac21;})[_0x5608('0x20')](respondWithFilteredResult(_0x57bba7,_0x3420ba))[_0x5608('0x28')](handleError(_0x57bba7,null));};exports[_0x5608('0x50')]=function(_0x2a2a76,_0x3b6b63){var _0x385a43={'raw':!![],'where':{'id':_0x2a2a76[_0x5608('0x51')]['id']}},_0x4109bf={};_0x4109bf[_0x5608('0x3d')]=_[_0x5608('0x3e')](db[_0x5608('0x38')][_0x5608('0x39')]);_0x4109bf[_0x5608('0x40')]=_[_0x5608('0x3e')](_0x2a2a76['query']);_0x4109bf['filters']=_[_0x5608('0x41')](_0x4109bf[_0x5608('0x3d')],_0x4109bf['query']);_0x385a43[_0x5608('0x43')]=_[_0x5608('0x41')](_0x4109bf[_0x5608('0x3d')],qs[_0x5608('0x42')](_0x2a2a76[_0x5608('0x40')][_0x5608('0x42')]));_0x385a43[_0x5608('0x43')]=_0x385a43[_0x5608('0x43')][_0x5608('0x52')]?_0x385a43[_0x5608('0x43')]:_0x4109bf['model'];if(_0x2a2a76[_0x5608('0x40')]['includeAll']){_0x385a43[_0x5608('0x4d')]=[{'all':!![]}];}_0x385a43=_[_0x5608('0x49')]({},_0x385a43,_0x2a2a76[_0x5608('0x4b')]);return db[_0x5608('0x38')][_0x5608('0x53')](_0x385a43)[_0x5608('0x20')](handleEntityNotFound(_0x3b6b63,null))[_0x5608('0x20')](respondWithResult(_0x3b6b63,null))['catch'](handleError(_0x3b6b63,null));};exports[_0x5608('0x54')]=function(_0x345dd6,_0xb93ccf,_0x28c297){var _0x55e77d;return db['sequelize']['transaction'](function(_0x4d17eb){return db[_0x5608('0x38')]['create'](_0x345dd6[_0x5608('0x55')],{'raw':!![]})[_0x5608('0x20')](function(_0x59fc87){_0x55e77d=_0x59fc87;return db[_0x5608('0x38')][_0x5608('0x4e')]({'where':{'type':_0x345dd6[_0x5608('0x55')][_0x5608('0x3b')]},'raw':!![]});})[_0x5608('0x20')](function(_0x19171d){if(_0x55e77d[_0x5608('0x3b')][_0x5608('0x56')]()==_0x5608('0x57')){var _0x5891f4=fs['readFileSync'](path[_0x5608('0x58')](config['root'],_0x5608('0x59')),_0x5608('0x5a'));var _0x46a6f3=ejs[_0x5608('0x5b')](_0x5891f4,{'networks':_0x19171d||[]});fs[_0x5608('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x46a6f3);return respondWithRpcPromise(_0x5608('0x5d'),_0x5608('0x54'),{'module':_0x5608('0x5e')});}else if(_0x55e77d['type'][_0x5608('0x56')]()=='TURN'){var _0x3ed908=fs[_0x5608('0x5f')](path['join'](config[_0x5608('0x60')],_0x5608('0x61')),'utf8');var _0x1916aa=ejs[_0x5608('0x5b')](_0x3ed908,{'networks':_0x19171d||[]});fs[_0x5608('0x5c')](_0x5608('0x62'),_0x1916aa);return respondWithRpcPromise(_0x5608('0x5d'),_0x5608('0x54'),{'module':_0x5608('0x5e')});}else{var _0x16d9f3=fs[_0x5608('0x5f')](path[_0x5608('0x58')](config['root'],_0x5608('0x63')),'utf8');var _0x5da69f=ejs[_0x5608('0x5b')](_0x16d9f3,{'networks':_0x19171d||[]});fs['writeFileSync'](util[_0x5608('0x64')]('/etc/asterisk/sip_xcally_%s.conf',_0x345dd6[_0x5608('0x55')][_0x5608('0x3b')][_0x5608('0x65')]()),_0x5da69f);return respondWithRpcPromise('Reload','create',{'module':_0x5608('0x66')});}return null;})[_0x5608('0x20')](function(){return _0x55e77d;});})[_0x5608('0x20')](respondWithResult(_0xb93ccf,0xc9))[_0x5608('0x28')](handleError(_0xb93ccf,null));};exports[_0x5608('0x32')]=function(_0x16b91d,_0x5a48d4,_0x123799){var _0x302ded;return db['sequelize'][_0x5608('0x67')](function(_0x311d5c){return db['Network'][_0x5608('0x53')]({'where':{'id':_0x16b91d[_0x5608('0x51')]['id']}})[_0x5608('0x20')](handleEntityNotFound(_0x5a48d4,null))[_0x5608('0x20')](saveUpdates(_0x16b91d[_0x5608('0x55')],null))['then'](function(_0x579524){if(_0x579524){_0x302ded=_0x579524;return db[_0x5608('0x38')][_0x5608('0x4e')]({'where':{'type':_0x302ded[_0x5608('0x3b')]},'raw':!![]});}return null;})[_0x5608('0x20')](function(_0x4cf837){if(_0x302ded['type']['toUpperCase']()=='STUN'){var _0x2c479e=fs[_0x5608('0x5f')](path[_0x5608('0x58')](config[_0x5608('0x60')],_0x5608('0x59')),_0x5608('0x5a'));var _0xcc9177=ejs[_0x5608('0x5b')](_0x2c479e,{'networks':_0x4cf837||[]});fs[_0x5608('0x5c')]('/etc/asterisk/stun_xcally.conf',_0xcc9177);return respondWithRpcPromise('Reload',_0x5608('0x32'),{'module':_0x5608('0x5e')});}else if(_0x302ded[_0x5608('0x3b')][_0x5608('0x56')]()=='TURN'){var _0x5399d8=fs[_0x5608('0x5f')](path[_0x5608('0x58')](config['root'],_0x5608('0x61')),_0x5608('0x5a'));var _0x20f800=ejs['render'](_0x5399d8,{'networks':_0x4cf837||[]});fs[_0x5608('0x5c')](_0x5608('0x62'),_0x20f800);return respondWithRpcPromise(_0x5608('0x5d'),'update',{'module':'res_stun_monitor.so'});}else{var _0x5e255f=fs[_0x5608('0x5f')](path['join'](config[_0x5608('0x60')],_0x5608('0x63')),'utf8');var _0x485548=ejs[_0x5608('0x5b')](_0x5e255f,{'networks':_0x4cf837||[]});fs['writeFileSync'](util[_0x5608('0x64')](_0x5608('0x68'),_0x16b91d[_0x5608('0x55')][_0x5608('0x3b')]['toLowerCase']()),_0x485548);return respondWithRpcPromise(_0x5608('0x5d'),'update',{'module':'chan_sip.so'});}return null;})[_0x5608('0x20')](function(_0x17f0c3){if(_0x17f0c3){return _0x302ded;}return null;});})['then'](respondWithResult(_0x5a48d4,null))[_0x5608('0x28')](handleError(_0x5a48d4,null));};exports[_0x5608('0x33')]=function(_0x52ae06,_0x156366,_0xbb136d){var _0x285648;return db[_0x5608('0x38')]['find']({'where':{'id':_0x52ae06[_0x5608('0x51')]['id']}})[_0x5608('0x20')](function(_0x2ead33){_0x285648=_0x2ead33;return _0x2ead33;})['then'](handleEntityNotFound(_0x156366,null))[_0x5608('0x20')](removeEntity(_0x156366,null))[_0x5608('0x20')](function(){if(_0x285648){return db[_0x5608('0x38')][_0x5608('0x4e')]({'where':{'type':_0x285648[_0x5608('0x3b')]},'raw':!![]});}})['then'](function(_0x35c889){if(_0x285648[_0x5608('0x3b')][_0x5608('0x56')]()==_0x5608('0x57')){var _0x30be13=fs[_0x5608('0x5f')](path[_0x5608('0x58')](config[_0x5608('0x60')],_0x5608('0x59')),_0x5608('0x5a'));var _0x1dc418=ejs[_0x5608('0x5b')](_0x30be13,{'networks':_0x35c889||[]});fs['writeFileSync'](_0x5608('0x69'),_0x1dc418);return respondWithRpcPromise(_0x5608('0x5d'),_0x5608('0x33'),{'module':_0x5608('0x5e')});}else if(_0x285648['type'][_0x5608('0x56')]()==_0x5608('0x6a')){var _0xec25e7=fs[_0x5608('0x5f')](path['join'](config[_0x5608('0x60')],'server/files/templates/turn_multiple.ejs'),_0x5608('0x5a'));var _0x5ce692=ejs[_0x5608('0x5b')](_0xec25e7,{'networks':_0x35c889||[]});fs[_0x5608('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x5ce692);return respondWithRpcPromise(_0x5608('0x5d'),_0x5608('0x33'),{'module':_0x5608('0x5e')});}else{var _0x63b9ee=fs[_0x5608('0x5f')](path[_0x5608('0x58')](config[_0x5608('0x60')],_0x5608('0x63')),_0x5608('0x5a'));var _0x4e2fdc=ejs[_0x5608('0x5b')](_0x63b9ee,{'networks':_0x35c889||[]});fs[_0x5608('0x5c')](util['format'](_0x5608('0x68'),_0x52ae06[_0x5608('0x55')][_0x5608('0x3b')]['toLowerCase']()),_0x4e2fdc);return respondWithRpcPromise(_0x5608('0x5d'),_0x5608('0x33'),{'module':_0x5608('0x66')});}return null;})[_0x5608('0x28')](handleError(_0x156366,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 7d4d313..581b49e 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 _0xa2fc=['../../config/logger','moment','request-promise','../../config/environment','./network.attributes','exports','Network','network','lodash','util'];(function(_0x194036,_0x346e15){var _0x142677=function(_0x3d8bd5){while(--_0x3d8bd5){_0x194036['push'](_0x194036['shift']());}};_0x142677(++_0x346e15);}(_0xa2fc,0x1a2));var _0xca2f=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0xa2fc[_0x45d1fd];return _0xd0e542;};'use strict';var _=require(_0xca2f('0x0'));var util=require(_0xca2f('0x1'));var logger=require(_0xca2f('0x2'))('api');var moment=require(_0xca2f('0x3'));var BPromise=require('bluebird');var rp=require(_0xca2f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xca2f('0x5'));var attributes=require(_0xca2f('0x6'));module[_0xca2f('0x7')]=function(_0x4ab287,_0x5c4974){return _0x4ab287['define'](_0xca2f('0x8'),attributes,{'tableName':_0xca2f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0288=['../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','moment','bluebird','request-promise','path'];(function(_0x11642c,_0x27f91c){var _0x3274d3=function(_0x438b65){while(--_0x438b65){_0x11642c['push'](_0x11642c['shift']());}};_0x3274d3(++_0x27f91c);}(_0x0288,0x1b6));var _0x8028=function(_0xa03db6,_0x436e2c){_0xa03db6=_0xa03db6-0x0;var _0x1e7e80=_0x0288[_0xa03db6];return _0x1e7e80;};'use strict';var _=require(_0x8028('0x0'));var util=require(_0x8028('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8028('0x2'));var BPromise=require(_0x8028('0x3'));var rp=require(_0x8028('0x4'));var fs=require('fs');var path=require(_0x8028('0x5'));var rimraf=require('rimraf');var config=require(_0x8028('0x6'));var attributes=require(_0x8028('0x7'));module[_0x8028('0x8')]=function(_0x126f28,_0x5b4afd){return _0x126f28[_0x8028('0x9')](_0x8028('0xa'),attributes,{'tableName':_0x8028('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 85883f9..8eead66 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 _0x24c1=['../../config/utils','../../config/logger','jayson/promise','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','bluebird','../../mysqldb'];(function(_0x30605d,_0x414696){var _0x3b3145=function(_0x127d5e){while(--_0x127d5e){_0x30605d['push'](_0x30605d['shift']());}};_0x3b3145(++_0x414696);}(_0x24c1,0xc4));var _0x124c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x24c1[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x124c('0x0'));var moment=require(_0x124c('0x1'));var BPromise=require(_0x124c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x124c('0x3'))['db'];var utils=require(_0x124c('0x4'));var logger=require(_0x124c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x124c('0x6'));var client=jayson[_0x124c('0x7')][_0x124c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1afcce,_0x13828f,_0x450650){return new BPromise(function(_0xe434e0,_0xec84e5){return client['request'](_0x1afcce,_0x450650)[_0x124c('0x9')](function(_0x3add91){logger['info'](_0x124c('0xa'),_0x13828f,_0x124c('0xb'));logger[_0x124c('0xc')](_0x124c('0xd'),_0x13828f,_0x124c('0xb'),JSON[_0x124c('0xe')](_0x3add91));if(_0x3add91[_0x124c('0xf')]){if(_0x3add91['error'][_0x124c('0x10')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x13828f,_0x3add91[_0x124c('0xf')]['message']);return _0xec84e5(_0x3add91[_0x124c('0xf')][_0x124c('0x11')]);}logger['error'](_0x124c('0xa'),_0x13828f,_0x3add91['error'][_0x124c('0x11')]);return _0xe434e0(_0x3add91[_0x124c('0xf')][_0x124c('0x11')]);}else{logger[_0x124c('0x12')]('Network,\x20%s,\x20%s',_0x13828f,_0x124c('0xb'));_0xe434e0(_0x3add91[_0x124c('0x13')][_0x124c('0x11')]);}})['catch'](function(_0x2ed638){logger[_0x124c('0xf')]('Network,\x20%s,\x20%s',_0x13828f,_0x2ed638);_0xec84e5(_0x2ed638);});});} \ No newline at end of file +var _0xea68=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xea68,0x163));var _0x8ea6=function(_0x46b10f,_0x10a5a5){_0x46b10f=_0x46b10f-0x0;var _0x145625=_0xea68[_0x46b10f];return _0x145625;};'use strict';var _=require(_0x8ea6('0x0'));var util=require(_0x8ea6('0x1'));var moment=require('moment');var BPromise=require(_0x8ea6('0x2'));var rs=require(_0x8ea6('0x3'));var fs=require('fs');var Redis=require(_0x8ea6('0x4'));var db=require(_0x8ea6('0x5'))['db'];var utils=require(_0x8ea6('0x6'));var logger=require(_0x8ea6('0x7'))(_0x8ea6('0x8'));var config=require(_0x8ea6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8ea6('0xa')][_0x8ea6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x291c8a,_0x424821,_0x255658){return new BPromise(function(_0x4e05ac,_0x577c34){return client[_0x8ea6('0xc')](_0x291c8a,_0x255658)[_0x8ea6('0xd')](function(_0x1d4723){logger['info']('Network,\x20%s,\x20%s',_0x424821,_0x8ea6('0xe'));logger['debug'](_0x8ea6('0xf'),_0x424821,_0x8ea6('0xe'),JSON['stringify'](_0x1d4723));if(_0x1d4723['error']){if(_0x1d4723[_0x8ea6('0x10')][_0x8ea6('0x11')]===0x1f4){logger[_0x8ea6('0x10')](_0x8ea6('0x12'),_0x424821,_0x1d4723[_0x8ea6('0x10')][_0x8ea6('0x13')]);return _0x577c34(_0x1d4723[_0x8ea6('0x10')][_0x8ea6('0x13')]);}logger['error'](_0x8ea6('0x12'),_0x424821,_0x1d4723[_0x8ea6('0x10')][_0x8ea6('0x13')]);return _0x4e05ac(_0x1d4723[_0x8ea6('0x10')][_0x8ea6('0x13')]);}else{logger['info'](_0x8ea6('0x12'),_0x424821,_0x8ea6('0xe'));_0x4e05ac(_0x1d4723['result'][_0x8ea6('0x13')]);}})[_0x8ea6('0x14')](function(_0x5c1f54){logger[_0x8ea6('0x10')](_0x8ea6('0x12'),_0x424821,_0x5c1f54);_0x577c34(_0x5c1f54);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 39be96b..82a0aa5 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 _0x814b=['/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','notify','addAgents','/:id/send','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications'];(function(_0x4364fa,_0x375592){var _0x14a7d6=function(_0x476aea){while(--_0x476aea){_0x4364fa['push'](_0x4364fa['shift']());}};_0x14a7d6(++_0x375592);}(_0x814b,0x1a2));var _0xb814=function(_0x2498b5,_0x514ddb){_0x2498b5=_0x2498b5-0x0;var _0x5c48d8=_0x814b[_0x2498b5];return _0x5c48d8;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1a')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1c')]);router[_0xb814('0x1a')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller['addAnswer']);router[_0xb814('0x1a')]('/:id/notify',controller[_0xb814('0x1d')]);router[_0xb814('0x1a')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);router[_0xb814('0x1a')](_0xb814('0x1f'),auth['isAuthenticated'](),controller[_0xb814('0x20')]);router['put'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x21')]);router[_0xb814('0x22')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x23')]);router['delete'](_0xb814('0x10'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router[_0xb814('0x22')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x22')](_0xb814('0x18'),auth['isAuthenticated'](),controller[_0xb814('0x26')]);module[_0xb814('0x27')]=router; \ No newline at end of file +var _0xabce=['put','/:id','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','addAgents','send'];(function(_0x19a089,_0x10971b){var _0x5d4a35=function(_0x554577){while(--_0x554577){_0x19a089['push'](_0x19a089['shift']());}};_0x5d4a35(++_0x10971b);}(_0xabce,0x103));var _0xeabc=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xabce[_0x3ff085];return _0x2b68c3;};'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('./openchannelAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0xeabc('0x15')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post'](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller['addDisposition']);router['post'](_0xeabc('0xe'),auth['isAuthenticated'](),controller[_0xeabc('0x17')]);router[_0xeabc('0x15')](_0xeabc('0x18'),controller[_0xeabc('0x19')]);router[_0xeabc('0x15')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x1a')]);router['post'](_0xeabc('0x14'),auth['isAuthenticated'](),controller[_0xeabc('0x1b')]);router[_0xeabc('0x15')]('/:id/send',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1c')]);router[_0xeabc('0x1d')](_0xeabc('0x1e'),auth[_0xeabc('0x8')](),controller['update']);router[_0xeabc('0x1f')](_0xeabc('0x1e'),auth[_0xeabc('0x8')](),controller['destroy']);router[_0xeabc('0x1f')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x20')]);router['delete'](_0xeabc('0xe'),auth['isAuthenticated'](),controller[_0xeabc('0x21')]);router['delete'](_0xeabc('0x14'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x22')]);module[_0xeabc('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index fbc69e8..0816690 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 _0x950c=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0xc8f6a4,_0xdd45a){var _0x58b85c=function(_0x435e15){while(--_0x435e15){_0xc8f6a4['push'](_0xc8f6a4['shift']());}};_0x58b85c(++_0xdd45a);}(_0x950c,0x10b));var _0xc950=function(_0x37f7be,_0x220f4e){_0x37f7be=_0x37f7be-0x0;var _0x20ad42=_0x950c[_0x37f7be];return _0x20ad42;};'use strict';var Sequelize=require(_0xc950('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xc950('0x1')],'unique':_0xc950('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc950('0x1')]},'token':{'type':Sequelize[_0xc950('0x1')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xc950('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc950('0x3')],'defaultValue':function(){return _0xc950('0x4');}},'notificationSound':{'type':Sequelize[_0xc950('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc950('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xc950('0x1')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc950('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc950('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc950('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xc950('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc950('0x8'),'set':function(_0x3538d7){if(!_0x3538d7)this[_0xc950('0x9')](_0xc950('0xa'),null);this['setDataValue'](_0xc950('0xb'),_0x3538d7);}}}; \ No newline at end of file +var _0x6a73=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x345936,_0x162f7d){var _0x5ddf75=function(_0x318fd5){while(--_0x318fd5){_0x345936['push'](_0x345936['shift']());}};_0x5ddf75(++_0x162f7d);}(_0x6a73,0xe2));var _0x36a7=function(_0x158e3b,_0x4534b){_0x158e3b=_0x158e3b-0x0;var _0x551a1d=_0x6a73[_0x158e3b];return _0x551a1d;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x36a7('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x36a7('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x36a7('0x2')],'defaultValue':function(){return rs[_0x36a7('0x3')]();}},'replyUri':{'type':Sequelize[_0x36a7('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x36a7('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x36a7('0x4')],'defaultValue':function(){return _0x36a7('0x5');}},'notificationSound':{'type':Sequelize[_0x36a7('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x36a7('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x36a7('0x2')]},'queueTransfer':{'type':Sequelize[_0x36a7('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x36a7('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x36a7('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x36a7('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x36a7('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x36a7('0x9'),'set':function(_0x39a62a){if(!_0x39a62a)this[_0x36a7('0xa')](_0x36a7('0xb'),null);this[_0x36a7('0xa')](_0x36a7('0xc'),_0x39a62a);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index d51d1f7..2170cd9 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 _0xfd28=['error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','UserProfileResource','end','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','type','VIRTUAL','filter','merge','options','findAll','show','params','include','find','create','body','get','role','user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Pause','describe','Disposition','findOne','hasOwnProperty','order','pick','OpenchannelAccountId','includeAll','rows','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','notify','openchannel','no\x20available\x20attributes','createdAt','updatedAt','ListId','from','Sequelize','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','OpenchannelApplication','Applications','account','list','applications','priority','asc','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','DESC','Messages','push','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3c9b25,_0x1c2b24){var _0x211a60=function(_0xc146f8){while(--_0xc146f8){_0x3c9b25['push'](_0x3c9b25['shift']());}};_0x211a60(++_0x1c2b24);}(_0xfd28,0x148));var _0x8fd2=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0xfd28[_0x527824];return _0xc8b8ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8fd2('0x0'));var zipdir=require(_0x8fd2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8fd2('0x2'));var moment=require('moment');var BPromise=require(_0x8fd2('0x3'));var Mustache=require(_0x8fd2('0x4'));var util=require(_0x8fd2('0x5'));var path=require('path');var sox=require(_0x8fd2('0x6'));var csv=require(_0x8fd2('0x7'));var ejs=require(_0x8fd2('0x8'));var fs=require('fs');var fs_extra=require(_0x8fd2('0x9'));var _=require(_0x8fd2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8fd2('0xb'));var deskjs=require(_0x8fd2('0xc'));var toCsv=require(_0x8fd2('0x7'));var querystring=require('querystring');var Papa=require(_0x8fd2('0xd'));var Redis=require('ioredis');var authService=require(_0x8fd2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8fd2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fd2('0x10'))('api');var utils=require(_0x8fd2('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8fd2('0x12'));var db=require(_0x8fd2('0x13'))['db'];config[_0x8fd2('0x14')]=_[_0x8fd2('0x15')](config[_0x8fd2('0x14')],{'host':_0x8fd2('0x16'),'port':0x18eb});var socket=require(_0x8fd2('0x17'))(new Redis(config[_0x8fd2('0x14')]));require(_0x8fd2('0x18'))[_0x8fd2('0x19')](socket);var jayson=require(_0x8fd2('0x1a'));var client=jayson[_0x8fd2('0x1b')][_0x8fd2('0x1c')]({'port':0x232c});var client9002=jayson[_0x8fd2('0x1b')][_0x8fd2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x596639,_0x20daca,_0x5ef478,_0x4f0b17){return new BPromise(function(_0x56f75d,_0x3b79f3){var _0x530866=_0x4f0b17||client;return _0x530866[_0x8fd2('0x1d')](_0x596639,_0x5ef478)[_0x8fd2('0x1e')](function(_0x5c8b3c){logger[_0x8fd2('0x1f')](_0x8fd2('0x20'),_0x20daca,_0x8fd2('0x21'));logger[_0x8fd2('0x22')](_0x8fd2('0x23'),_0x20daca,'request\x20sent',JSON['stringify'](_0x5c8b3c));if(_0x5c8b3c[_0x8fd2('0x24')]){if(_0x5c8b3c['error'][_0x8fd2('0x25')]===0x1f4){logger['error'](_0x8fd2('0x20'),_0x20daca,_0x5c8b3c[_0x8fd2('0x24')]['message']);return _0x3b79f3(_0x5c8b3c[_0x8fd2('0x24')]['message']);}logger[_0x8fd2('0x24')](_0x8fd2('0x20'),_0x20daca,_0x5c8b3c['error'][_0x8fd2('0x26')]);return _0x56f75d(_0x5c8b3c[_0x8fd2('0x24')][_0x8fd2('0x26')]);}else{logger['info'](_0x8fd2('0x20'),_0x20daca,_0x8fd2('0x21'));_0x56f75d(_0x5c8b3c[_0x8fd2('0x27')][_0x8fd2('0x26')]);}})[_0x8fd2('0x28')](function(_0x25db4e){logger[_0x8fd2('0x24')](_0x8fd2('0x20'),_0x20daca,_0x25db4e);_0x3b79f3(_0x25db4e);});});}function respondWithStatusCode(_0x1456b4,_0xbc5945){_0xbc5945=_0xbc5945||0xcc;return function(_0x3392fb){if(_0x3392fb){return _0x1456b4[_0x8fd2('0x29')](_0xbc5945);}return _0x1456b4[_0x8fd2('0x2a')](_0xbc5945)['end']();};}function respondWithResult(_0x4c6af7,_0x345bc3){_0x345bc3=_0x345bc3||0xc8;return function(_0x1858a9){if(_0x1858a9){return _0x4c6af7[_0x8fd2('0x2a')](_0x345bc3)['json'](_0x1858a9);}};}function respondWithFilteredResult(_0x2f26ae,_0x7820e7){return function(_0x27b256){if(_0x27b256){var _0x960869=typeof _0x7820e7[_0x8fd2('0x2b')]===_0x8fd2('0x2c')&&typeof _0x7820e7[_0x8fd2('0x2d')]==='undefined';var _0xe76676=_0x27b256[_0x8fd2('0x2e')];var _0x818f61=_0x960869?0x0:_0x7820e7[_0x8fd2('0x2b')];var _0x313902=_0x960869?_0x27b256[_0x8fd2('0x2e')]:_0x7820e7[_0x8fd2('0x2b')]+_0x7820e7['limit'];var _0x5b992a;if(_0x313902>=_0xe76676){_0x313902=_0xe76676;_0x5b992a=0xc8;}else{_0x5b992a=0xce;}_0x2f26ae['status'](_0x5b992a);return _0x2f26ae[_0x8fd2('0x2f')](_0x8fd2('0x30'),_0x818f61+'-'+_0x313902+'/'+_0xe76676)[_0x8fd2('0x31')](_0x27b256);}return null;};}function patchUpdates(_0xe4987b){return function(_0x5a0b3b){try{jsonpatch['apply'](_0x5a0b3b,_0xe4987b,!![]);}catch(_0x3ebeab){return BPromise[_0x8fd2('0x32')](_0x3ebeab);}return _0x5a0b3b[_0x8fd2('0x33')]();};}function saveUpdates(_0x18fe4e,_0x121fd4){return function(_0x52c46b){if(_0x52c46b){return _0x52c46b[_0x8fd2('0x34')](_0x18fe4e)['then'](function(_0x20a9d0){return _0x20a9d0;});}return null;};}function removeEntity(_0x4ade8c,_0x445b67){return function(_0x4d9faa){if(_0x4d9faa){return _0x4d9faa[_0x8fd2('0x35')]()[_0x8fd2('0x1e')](function(){var _0x39092e=_0x4d9faa['get']({'plain':!![]});var _0x339291='OpenchannelAccounts';return db[_0x8fd2('0x36')][_0x8fd2('0x35')]({'where':{'type':_0x339291,'resourceId':_0x39092e['id']}})[_0x8fd2('0x1e')](function(){return _0x4d9faa;});})['then'](function(){_0x4ade8c[_0x8fd2('0x2a')](0xcc)[_0x8fd2('0x37')]();});}};}function handleEntityNotFound(_0x21adc6,_0x58ce31){return function(_0x11ef3b){if(!_0x11ef3b){_0x21adc6[_0x8fd2('0x29')](0x194);}return _0x11ef3b;};}function handleError(_0x3e9a67,_0x4adfa2){_0x4adfa2=_0x4adfa2||0x1f4;return function(_0x37a24b){logger[_0x8fd2('0x24')](_0x37a24b['stack']);if(_0x37a24b[_0x8fd2('0x38')]){delete _0x37a24b[_0x8fd2('0x38')];}_0x3e9a67[_0x8fd2('0x2a')](_0x4adfa2)[_0x8fd2('0x39')](_0x37a24b);};}exports[_0x8fd2('0x3a')]=function(_0x35cbec,_0x221022){var _0x5e6140={'include':[{'model':db['Pause'],'as':_0x8fd2('0x3b')}]},_0x7c60d={},_0x512b6c={'count':0x0,'rows':[]};var _0xb2c8cc=_[_0x8fd2('0x3c')](db[_0x8fd2('0x3d')][_0x8fd2('0x3e')],function(_0x129e0){return{'name':_0x129e0['fieldName'],'type':_0x129e0['type'][_0x8fd2('0x3f')]};});_0x7c60d['model']=_['map'](_0xb2c8cc,_0x8fd2('0x38'));_0x7c60d[_0x8fd2('0x40')]=_[_0x8fd2('0x41')](_0x35cbec[_0x8fd2('0x40')]);_0x7c60d['filters']=_[_0x8fd2('0x42')](_0x7c60d[_0x8fd2('0x43')],_0x7c60d[_0x8fd2('0x40')]);_0x5e6140[_0x8fd2('0x44')]=_[_0x8fd2('0x42')](_0x7c60d[_0x8fd2('0x43')],qs[_0x8fd2('0x45')](_0x35cbec['query'][_0x8fd2('0x45')]));_0x5e6140[_0x8fd2('0x44')]=_0x5e6140[_0x8fd2('0x44')][_0x8fd2('0x46')]?_0x5e6140[_0x8fd2('0x44')]:_0x7c60d[_0x8fd2('0x43')];if(!_0x35cbec[_0x8fd2('0x40')]['hasOwnProperty'](_0x8fd2('0x47'))){_0x5e6140[_0x8fd2('0x2d')]=qs[_0x8fd2('0x2d')](_0x35cbec[_0x8fd2('0x40')][_0x8fd2('0x2d')]);_0x5e6140[_0x8fd2('0x2b')]=qs[_0x8fd2('0x2b')](_0x35cbec['query'][_0x8fd2('0x2b')]);}_0x5e6140['order']=qs[_0x8fd2('0x48')](_0x35cbec['query'][_0x8fd2('0x48')]);_0x5e6140[_0x8fd2('0x49')]=qs[_0x8fd2('0x4a')](_['pick'](_0x35cbec[_0x8fd2('0x40')],_0x7c60d[_0x8fd2('0x4a')]),_0xb2c8cc);if(_0x35cbec[_0x8fd2('0x40')]['filter']){_0x5e6140[_0x8fd2('0x49')]=_['merge'](_0x5e6140[_0x8fd2('0x49')],{'$or':_[_0x8fd2('0x3c')](_0xb2c8cc,function(_0x3d408b){if(_0x3d408b[_0x8fd2('0x4b')]!==_0x8fd2('0x4c')){var _0x7984c9={};_0x7984c9[_0x3d408b[_0x8fd2('0x38')]]={'$like':'%'+_0x35cbec[_0x8fd2('0x40')][_0x8fd2('0x4d')]+'%'};return _0x7984c9;}})});}_0x5e6140=_[_0x8fd2('0x4e')]({},_0x5e6140,_0x35cbec[_0x8fd2('0x4f')]);var _0x34f3a2={'where':_0x5e6140[_0x8fd2('0x49')]};return db[_0x8fd2('0x3d')][_0x8fd2('0x2e')](_0x34f3a2)[_0x8fd2('0x1e')](function(_0x385a95){_0x512b6c[_0x8fd2('0x2e')]=_0x385a95;if(_0x35cbec[_0x8fd2('0x40')]['includeAll']){_0x5e6140['include']=[{'all':!![]}];}return db[_0x8fd2('0x3d')][_0x8fd2('0x50')](_0x5e6140);})[_0x8fd2('0x1e')](function(_0x5d79c3){_0x512b6c['rows']=_0x5d79c3;return _0x512b6c;})[_0x8fd2('0x1e')](respondWithFilteredResult(_0x221022,_0x5e6140))['catch'](handleError(_0x221022,null));};exports[_0x8fd2('0x51')]=function(_0x1295c4,_0xa537c9){var _0x5dc643={'raw':![],'where':{'id':_0x1295c4[_0x8fd2('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0x8fd2('0x3b')}]},_0x2251d9={};_0x2251d9[_0x8fd2('0x43')]=_[_0x8fd2('0x41')](db['OpenchannelAccount'][_0x8fd2('0x3e')]);_0x2251d9[_0x8fd2('0x40')]=_[_0x8fd2('0x41')](_0x1295c4[_0x8fd2('0x40')]);_0x2251d9[_0x8fd2('0x4a')]=_[_0x8fd2('0x42')](_0x2251d9['model'],_0x2251d9['query']);_0x5dc643[_0x8fd2('0x44')]=_[_0x8fd2('0x42')](_0x2251d9['model'],qs[_0x8fd2('0x45')](_0x1295c4['query']['fields']));_0x5dc643[_0x8fd2('0x44')]=_0x5dc643[_0x8fd2('0x44')][_0x8fd2('0x46')]?_0x5dc643[_0x8fd2('0x44')]:_0x2251d9[_0x8fd2('0x43')];if(_0x1295c4[_0x8fd2('0x40')]['includeAll']){_0x5dc643[_0x8fd2('0x53')]=[{'all':!![]}];}_0x5dc643=_[_0x8fd2('0x4e')]({},_0x5dc643,_0x1295c4[_0x8fd2('0x4f')]);return db[_0x8fd2('0x3d')][_0x8fd2('0x54')](_0x5dc643)['then'](handleEntityNotFound(_0xa537c9,null))['then'](respondWithResult(_0xa537c9,null))['catch'](handleError(_0xa537c9,null));};exports['create']=function(_0x57b8f6,_0x2a512b){return db[_0x8fd2('0x3d')][_0x8fd2('0x55')](_0x57b8f6[_0x8fd2('0x56')],{})[_0x8fd2('0x1e')](function(_0x25abdc){var _0x460f31=_0x57b8f6['user'][_0x8fd2('0x57')]({'plain':!![]});if(!_0x460f31)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x460f31[_0x8fd2('0x58')]===_0x8fd2('0x59')){var _0x478aad=_0x25abdc['get']({'plain':!![]});var _0x3baa83=_0x8fd2('0x5a');return db[_0x8fd2('0x5b')][_0x8fd2('0x54')]({'where':{'name':_0x3baa83,'userProfileId':_0x460f31[_0x8fd2('0x5c')]},'raw':!![]})['then'](function(_0x2196d3){if(_0x2196d3&&_0x2196d3[_0x8fd2('0x5d')]===0x0){return db[_0x8fd2('0x36')][_0x8fd2('0x55')]({'name':_0x478aad['name'],'resourceId':_0x478aad['id'],'type':_0x2196d3[_0x8fd2('0x38')],'sectionId':_0x2196d3['id']},{})[_0x8fd2('0x1e')](function(){return _0x25abdc;});}else{return _0x25abdc;}})[_0x8fd2('0x28')](function(_0x23c608){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23c608);throw _0x23c608;});}return _0x25abdc;})['then'](respondWithResult(_0x2a512b,0xc9))[_0x8fd2('0x28')](handleError(_0x2a512b,null));};exports[_0x8fd2('0x34')]=function(_0xb88ae7,_0x38fc47){if(_0xb88ae7[_0x8fd2('0x56')]['id']){delete _0xb88ae7['body']['id'];}return db[_0x8fd2('0x3d')][_0x8fd2('0x54')]({'where':{'id':_0xb88ae7['params']['id']},'include':[{'model':db[_0x8fd2('0x5e')],'as':_0x8fd2('0x3b')}]})[_0x8fd2('0x1e')](handleEntityNotFound(_0x38fc47,null))[_0x8fd2('0x1e')](saveUpdates(_0xb88ae7[_0x8fd2('0x56')],null))['then'](respondWithResult(_0x38fc47,null))[_0x8fd2('0x28')](handleError(_0x38fc47,null));};exports[_0x8fd2('0x35')]=function(_0x21f1a7,_0x4606f7){return db[_0x8fd2('0x3d')][_0x8fd2('0x54')]({'where':{'id':_0x21f1a7[_0x8fd2('0x52')]['id']}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x4606f7,null))[_0x8fd2('0x1e')](removeEntity(_0x4606f7,null))[_0x8fd2('0x28')](handleError(_0x4606f7,null));};exports[_0x8fd2('0x5f')]=function(_0x4d0402,_0x40ffd5){return db['OpenchannelAccount'][_0x8fd2('0x5f')]()[_0x8fd2('0x1e')](respondWithResult(_0x40ffd5,null))['catch'](handleError(_0x40ffd5,null));};exports['addDisposition']=function(_0x553fa1,_0x2bd1d0,_0x34a06a){if(_0x553fa1[_0x8fd2('0x56')]['id']){delete _0x553fa1[_0x8fd2('0x56')]['id'];}return db[_0x8fd2('0x3d')][_0x8fd2('0x54')]({'where':{'id':_0x553fa1['params']['id']}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x2bd1d0,null))[_0x8fd2('0x1e')](function(_0x510553){if(_0x510553){_0x553fa1[_0x8fd2('0x56')]['OpenchannelAccountId']=_0x510553['id'];return db[_0x8fd2('0x60')][_0x8fd2('0x55')](_0x553fa1[_0x8fd2('0x56')]);}})[_0x8fd2('0x1e')](respondWithResult(_0x2bd1d0,null))[_0x8fd2('0x28')](handleError(_0x2bd1d0,null));};exports['getDispositions']=function(_0x1a1b40,_0xfb0041,_0x4f92c0){var _0x2e0cc2={'raw':![],'where':{}};var _0x59582b={};var _0x50c6a6={'count':0x0,'rows':[]};return db[_0x8fd2('0x3d')][_0x8fd2('0x61')]({'where':{'id':_0x1a1b40['params']['id']}})[_0x8fd2('0x1e')](handleEntityNotFound(_0xfb0041,null))[_0x8fd2('0x1e')](function(_0x6c766c){if(_0x6c766c){_0x59582b['model']=_[_0x8fd2('0x41')](db[_0x8fd2('0x60')][_0x8fd2('0x3e')]);_0x59582b[_0x8fd2('0x40')]=_[_0x8fd2('0x41')](_0x1a1b40[_0x8fd2('0x40')]);_0x59582b[_0x8fd2('0x4a')]=_['intersection'](_0x59582b['model'],_0x59582b[_0x8fd2('0x40')]);_0x2e0cc2[_0x8fd2('0x44')]=_['intersection'](_0x59582b['model'],qs['fields'](_0x1a1b40['query']['fields']));_0x2e0cc2[_0x8fd2('0x44')]=_0x2e0cc2[_0x8fd2('0x44')][_0x8fd2('0x46')]?_0x2e0cc2[_0x8fd2('0x44')]:_0x59582b[_0x8fd2('0x43')];if(!_0x1a1b40['query'][_0x8fd2('0x62')](_0x8fd2('0x47'))){_0x2e0cc2[_0x8fd2('0x2d')]=qs['limit'](_0x1a1b40[_0x8fd2('0x40')][_0x8fd2('0x2d')]);_0x2e0cc2['offset']=qs[_0x8fd2('0x2b')](_0x1a1b40[_0x8fd2('0x40')][_0x8fd2('0x2b')]);}_0x2e0cc2[_0x8fd2('0x63')]=qs[_0x8fd2('0x48')](_0x1a1b40[_0x8fd2('0x40')][_0x8fd2('0x48')]);_0x2e0cc2['where']=qs[_0x8fd2('0x4a')](_[_0x8fd2('0x64')](_0x1a1b40[_0x8fd2('0x40')],_0x59582b[_0x8fd2('0x4a')]));_0x2e0cc2[_0x8fd2('0x49')][_0x8fd2('0x65')]=_0x6c766c['id'];if(_0x1a1b40[_0x8fd2('0x40')]['filter']){_0x2e0cc2[_0x8fd2('0x49')]=_[_0x8fd2('0x4e')](_0x2e0cc2['where'],{'$or':_[_0x8fd2('0x3c')](_0x2e0cc2[_0x8fd2('0x44')],function(_0x3f8baf){var _0x131ee8={};_0x131ee8[_0x3f8baf]={'$like':'%'+_0x1a1b40[_0x8fd2('0x40')][_0x8fd2('0x4d')]+'%'};return _0x131ee8;})});}_0x2e0cc2=_[_0x8fd2('0x4e')]({},_0x2e0cc2,_0x1a1b40[_0x8fd2('0x4f')]);return db['Disposition'][_0x8fd2('0x2e')]({'where':_0x2e0cc2['where']})['then'](function(_0x478c79){_0x50c6a6[_0x8fd2('0x2e')]=_0x478c79;if(_0x1a1b40['query'][_0x8fd2('0x66')]){_0x2e0cc2['include']=[{'all':!![]}];}return db['Disposition'][_0x8fd2('0x50')](_0x2e0cc2);})[_0x8fd2('0x1e')](function(_0x5e41b7){_0x50c6a6[_0x8fd2('0x67')]=_0x5e41b7;return _0x50c6a6;});}})[_0x8fd2('0x1e')](respondWithFilteredResult(_0xfb0041,_0x2e0cc2))[_0x8fd2('0x28')](handleError(_0xfb0041,null));};exports[_0x8fd2('0x68')]=function(_0x570b06,_0x4ff263,_0x3e3e9b){return db['OpenchannelAccount'][_0x8fd2('0x54')]({'where':{'id':_0x570b06[_0x8fd2('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ff263,null))[_0x8fd2('0x1e')](function(_0xc60005){if(_0xc60005){return _0xc60005[_0x8fd2('0x68')](_0x570b06[_0x8fd2('0x40')][_0x8fd2('0x69')]);}})[_0x8fd2('0x1e')](respondWithStatusCode(_0x4ff263,null))[_0x8fd2('0x28')](handleError(_0x4ff263,null));};exports['addAnswer']=function(_0x2f959a,_0x140c62,_0x116a67){if(_0x2f959a[_0x8fd2('0x56')]['id']){delete _0x2f959a['body']['id'];}return db[_0x8fd2('0x3d')][_0x8fd2('0x54')]({'where':{'id':_0x2f959a[_0x8fd2('0x52')]['id']}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x140c62,null))['then'](function(_0x4d229a){if(_0x4d229a){_0x2f959a[_0x8fd2('0x56')]['OpenchannelAccountId']=_0x4d229a['id'];return db['CannedAnswer'][_0x8fd2('0x55')](_0x2f959a['body']);}})['then'](respondWithResult(_0x140c62,null))[_0x8fd2('0x28')](handleError(_0x140c62,null));};exports[_0x8fd2('0x6a')]=function(_0x43f50d,_0x9b593a,_0x1a1daf){var _0x13b7c9={'raw':![],'where':{}};var _0x15df51={};var _0x5c8351={'count':0x0,'rows':[]};return db[_0x8fd2('0x3d')][_0x8fd2('0x61')]({'where':{'id':_0x43f50d[_0x8fd2('0x52')]['id']}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x9b593a,null))['then'](function(_0x2a62b0){if(_0x2a62b0){_0x15df51['model']=_['keys'](db[_0x8fd2('0x6b')][_0x8fd2('0x3e')]);_0x15df51[_0x8fd2('0x40')]=_[_0x8fd2('0x41')](_0x43f50d[_0x8fd2('0x40')]);_0x15df51[_0x8fd2('0x4a')]=_[_0x8fd2('0x42')](_0x15df51[_0x8fd2('0x43')],_0x15df51['query']);_0x13b7c9['attributes']=_[_0x8fd2('0x42')](_0x15df51[_0x8fd2('0x43')],qs[_0x8fd2('0x45')](_0x43f50d[_0x8fd2('0x40')]['fields']));_0x13b7c9[_0x8fd2('0x44')]=_0x13b7c9[_0x8fd2('0x44')]['length']?_0x13b7c9[_0x8fd2('0x44')]:_0x15df51[_0x8fd2('0x43')];if(!_0x43f50d['query'][_0x8fd2('0x62')](_0x8fd2('0x47'))){_0x13b7c9['limit']=qs[_0x8fd2('0x2d')](_0x43f50d[_0x8fd2('0x40')][_0x8fd2('0x2d')]);_0x13b7c9[_0x8fd2('0x2b')]=qs[_0x8fd2('0x2b')](_0x43f50d[_0x8fd2('0x40')]['offset']);}_0x13b7c9[_0x8fd2('0x63')]=qs[_0x8fd2('0x48')](_0x43f50d[_0x8fd2('0x40')][_0x8fd2('0x48')]);_0x13b7c9[_0x8fd2('0x49')]=qs[_0x8fd2('0x4a')](_[_0x8fd2('0x64')](_0x43f50d[_0x8fd2('0x40')],_0x15df51[_0x8fd2('0x4a')]));_0x13b7c9[_0x8fd2('0x49')][_0x8fd2('0x65')]=_0x2a62b0['id'];if(_0x43f50d['query']['filter']){_0x13b7c9[_0x8fd2('0x49')]=_['merge'](_0x13b7c9[_0x8fd2('0x49')],{'$or':_['map'](_0x13b7c9[_0x8fd2('0x44')],function(_0x5db816){var _0x4c0f4b={};_0x4c0f4b[_0x5db816]={'$like':'%'+_0x43f50d[_0x8fd2('0x40')][_0x8fd2('0x4d')]+'%'};return _0x4c0f4b;})});}_0x13b7c9=_[_0x8fd2('0x4e')]({},_0x13b7c9,_0x43f50d[_0x8fd2('0x4f')]);return db['CannedAnswer']['count']({'where':_0x13b7c9['where']})[_0x8fd2('0x1e')](function(_0x910cb0){_0x5c8351[_0x8fd2('0x2e')]=_0x910cb0;if(_0x43f50d['query'][_0x8fd2('0x66')]){_0x13b7c9[_0x8fd2('0x53')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x13b7c9);})[_0x8fd2('0x1e')](function(_0x5db477){_0x5c8351['rows']=_0x5db477;return _0x5c8351;});}})[_0x8fd2('0x1e')](respondWithFilteredResult(_0x9b593a,_0x13b7c9))[_0x8fd2('0x28')](handleError(_0x9b593a,null));};exports['removeAnswers']=function(_0x4c6451,_0x39be64,_0x232b1d){return db['OpenchannelAccount'][_0x8fd2('0x54')]({'where':{'id':_0x4c6451[_0x8fd2('0x52')]['id']}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x39be64,null))[_0x8fd2('0x1e')](function(_0x418240){if(_0x418240){return _0x418240[_0x8fd2('0x6c')](_0x4c6451['query'][_0x8fd2('0x69')]);}})[_0x8fd2('0x1e')](respondWithStatusCode(_0x39be64,null))[_0x8fd2('0x28')](handleError(_0x39be64,null));};exports[_0x8fd2('0x6d')]=function(_0x42bb94,_0x1c7dd9,_0x4b3f0c){var _0x4c4d17={'body':_0x42bb94[_0x8fd2('0x56')],'channel':_0x8fd2('0x6e')};var _0x67af8b=[];var _0x214be5=[];var _0xbf947={};var _0x4ec574=![];return db['CmContact'][_0x8fd2('0x5f')]()[_0x8fd2('0x1e')](function(_0x241dd1){if(!_0x241dd1){throw new db['Sequelize']['ValidationError'](_0x8fd2('0x6f'));}_0x67af8b=_['difference'](_[_0x8fd2('0x41')](_0x241dd1),[_0x8fd2('0x70'),'updatedAt']);_0x214be5=_['difference'](_[_0x8fd2('0x41')](_0x241dd1),['createdAt',_0x8fd2('0x71'),'CompanyId',_0x8fd2('0x72')]);if(_0x42bb94[_0x8fd2('0x56')]['id']){delete _0x42bb94['body']['id'];}if(_['isNil'](_0x42bb94['body'][_0x8fd2('0x73')])){throw new db[(_0x8fd2('0x74'))][(_0x8fd2('0x75'))](_0x8fd2('0x76'));}if(_[_0x8fd2('0x77')](_0x42bb94[_0x8fd2('0x56')]['body'])||_0x42bb94[_0x8fd2('0x56')][_0x8fd2('0x56')]===''){throw new db['Sequelize'][(_0x8fd2('0x75'))](_0x8fd2('0x78'));}if(_[_0x8fd2('0x77')](_0x42bb94['body'][_0x8fd2('0x79')])){throw new db['Sequelize'][(_0x8fd2('0x75'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x214be5);}if(!_[_0x8fd2('0x7a')](_0x214be5,_0x42bb94[_0x8fd2('0x56')][_0x8fd2('0x79')])){throw new db[(_0x8fd2('0x74'))][(_0x8fd2('0x75'))](_0x8fd2('0x7b')+_0x214be5);}_0xbf947[_0x42bb94['body'][_0x8fd2('0x79')]]=_0x42bb94[_0x8fd2('0x56')][_0x8fd2('0x73')];})[_0x8fd2('0x1e')](function(){return db['OpenchannelAccount'][_0x8fd2('0x54')]({'where':{'id':_0x42bb94[_0x8fd2('0x52')]['id']},'include':[{'model':db[_0x8fd2('0x7c')],'as':_0x8fd2('0x7d'),'include':[{'model':db[_0x8fd2('0x7e')],'as':_0x8fd2('0x7f'),'where':_0xbf947,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x8fd2('0x80')],'as':_0x8fd2('0x81')}]});})[_0x8fd2('0x1e')](handleEntityNotFound(_0x1c7dd9,null))[_0x8fd2('0x1e')](function(_0x3bfebe){if(_0x3bfebe&&_0x3bfebe[_0x8fd2('0x7d')]){_0x4c4d17[_0x8fd2('0x82')]=_0x3bfebe;_0x4c4d17['applications']=_0x3bfebe[_0x8fd2('0x81')];_0x4c4d17[_0x8fd2('0x83')]=_0x3bfebe[_0x8fd2('0x7d')];_0x4c4d17['applications']=_['orderBy'](_0x4c4d17[_0x8fd2('0x84')],[_0x8fd2('0x85')],[_0x8fd2('0x86')]);if(_0x4c4d17['account'][_0x8fd2('0x81')]){delete _0x4c4d17['account'][_0x8fd2('0x81')];}if(_0x4c4d17[_0x8fd2('0x82')]['List']&&_0x4c4d17[_0x8fd2('0x82')]['List'][_0x8fd2('0x7f')][_0x8fd2('0x46')]){return _0x4c4d17['account']['List']['Contacts'][0x0];}var _0x2d5340=_['defaults'](_0x42bb94[_0x8fd2('0x56')],{'firstName':_0x42bb94[_0x8fd2('0x56')][_0x8fd2('0x73')],'ListId':_0x3bfebe[_0x8fd2('0x72')]});_0x2d5340[_0x42bb94[_0x8fd2('0x56')][_0x8fd2('0x79')]]=_0x42bb94[_0x8fd2('0x56')][_0x8fd2('0x73')];return db[_0x8fd2('0x7e')][_0x8fd2('0x55')](_0x2d5340,{'fields':_0x67af8b,'raw':!![]});}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x1c7dd9,null))[_0x8fd2('0x1e')](function(_0x3a339f){_0x4c4d17['contact']=_0x3a339f;if(_0x3a339f){var _0x376f53={'ContactId':_0x3a339f['id'],'OpenchannelAccountId':_0x42bb94['params']['id'],'from':(_0x3a339f[_0x8fd2('0x87')]||'')+'\x20'+(_0x3a339f[_0x8fd2('0x88')]||'')};var _0x590070={'OpenchannelAccountId':_0x42bb94[_0x8fd2('0x52')]['id'],'closed':![]};if(_0x42bb94[_0x8fd2('0x56')][_0x8fd2('0x89')]){_0x590070[_0x8fd2('0x89')]=_0x42bb94[_0x8fd2('0x56')]['threadId'];return db[_0x8fd2('0x8a')][_0x8fd2('0x54')]({'where':_0x590070})[_0x8fd2('0x1e')](function(_0x1e2fd1){if(_0x1e2fd1){return[_0x1e2fd1,![]];}_0x376f53['threadId']=_0x42bb94[_0x8fd2('0x56')][_0x8fd2('0x89')];_0x376f53['externalUrl']=_0x42bb94[_0x8fd2('0x56')][_0x8fd2('0x8b')];return db[_0x8fd2('0x8a')][_0x8fd2('0x55')](_0x376f53)[_0x8fd2('0x1e')](function(_0x5e0860){return[_0x5e0860,!![]];});});}else{_0x590070['threadId']=null;}_0x590070[_0x8fd2('0x8c')]=_0x3a339f['id'];return db[_0x8fd2('0x8a')]['find']({'where':_0x590070})['then'](function(_0x5499c5){if(_0x5499c5){return[_0x5499c5,![]];}return db[_0x8fd2('0x8a')]['create'](_0x376f53)['then'](function(_0x5eea9a){return[_0x5eea9a,!![]];});});}})[_0x8fd2('0x8d')](function(_0x39eafd,_0x58496b){if(_0x39eafd){_0x4ec574=_0x58496b;if(!_0x58496b){var _0x25049c={'from':(_0x4c4d17[_0x8fd2('0x8e')][_0x8fd2('0x87')]||'')+'\x20'+(_0x4c4d17[_0x8fd2('0x8e')][_0x8fd2('0x88')]||'')};if(_0x42bb94[_0x8fd2('0x56')][_0x8fd2('0x89')]&&_0x42bb94[_0x8fd2('0x56')][_0x8fd2('0x8f')]&&_0x42bb94[_0x8fd2('0x56')][_0x8fd2('0x89')]!=_0x42bb94[_0x8fd2('0x56')][_0x8fd2('0x8f')]){_0x25049c[_0x8fd2('0x89')]=_0x42bb94['body']['messageId'];}return _0x39eafd[_0x8fd2('0x34')](_0x25049c);}else{return _0x39eafd;}}})[_0x8fd2('0x1e')](function(_0x3bad60){_0x4c4d17['interaction']=_0x3bad60[_0x8fd2('0x57')]({'plain':!![]});_0x4c4d17[_0x8fd2('0x90')][_0x8fd2('0x91')]=_0x4ec574;if(_0x4c4d17[_0x8fd2('0x90')]['created']){if(_0x4c4d17['account'][_0x8fd2('0x92')]){_0x4c4d17[_0x8fd2('0x84')]['push']({'id':0x0,'priority':_0x4c4d17['applications'][_0x8fd2('0x46')]+0x1,'app':'close','appdata':_0x8fd2('0x93'),'interval':'*,*,*,*'});}}return db[_0x8fd2('0x94')]['create']({'body':_0x42bb94[_0x8fd2('0x56')]['body'],'OpenchannelAccountId':_0x42bb94[_0x8fd2('0x52')]['id'],'OpenchannelInteractionId':_0x3bad60['id'],'direction':'in','ContactId':_0x4c4d17[_0x8fd2('0x8e')]['id'],'AttachmentId':_0x42bb94['body'][_0x8fd2('0x95')]});})[_0x8fd2('0x1e')](function(_0x4d4d9a){_0x4c4d17[_0x8fd2('0x26')]=_0x4d4d9a;if(_0x4c4d17[_0x8fd2('0x90')][_0x8fd2('0x96')]){return db[_0x8fd2('0x97')][_0x8fd2('0x54')]({'attributes':['id',_0x8fd2('0x38')],'where':{'id':_0x4c4d17[_0x8fd2('0x90')][_0x8fd2('0x96')]}})['then'](function(_0x45d054){if(_0x45d054){_0x4c4d17[_0x8fd2('0x84')][_0x8fd2('0x98')]({'id':0x0,'priority':0x0,'app':_0x8fd2('0x99'),'appdata':_0x45d054[_0x8fd2('0x38')]+','+(_0x4c4d17[_0x8fd2('0x82')]['waitForTheAssignedAgent']||0xa),'interval':_0x8fd2('0x9a')});_0x4c4d17[_0x8fd2('0x9b')]=![];}return respondWithRpcPromise('Start','startRouting',_0x4c4d17);});}return respondWithRpcPromise(_0x8fd2('0x9c'),_0x8fd2('0x9d'),_0x4c4d17);})[_0x8fd2('0x1e')](function(_0x48e2bb){respondWithRpcPromise(_0x8fd2('0x9e'),'EventManager',{'event':_0x8fd2('0x6d'),'message':_0x48e2bb},client9002);return _0x48e2bb;})[_0x8fd2('0x1e')](respondWithResult(_0x1c7dd9,null))[_0x8fd2('0x28')](handleError(_0x1c7dd9,null));};exports[_0x8fd2('0x9f')]=function(_0x9207e3,_0x2435e2,_0x4539fc){return db['OpenchannelAccount'][_0x8fd2('0x61')]({'where':{'id':_0x9207e3[_0x8fd2('0x52')]['id']}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x2435e2,null))[_0x8fd2('0x1e')](function(_0xb31e16){if(_0xb31e16){return db[_0x8fd2('0xa0')][_0x8fd2('0xa1')](function(_0x16c981){return db[_0x8fd2('0x80')][_0x8fd2('0x35')]({'where':{'OpenchannelAccountId':_0x9207e3[_0x8fd2('0x52')]['id']},'transaction':_0x16c981})[_0x8fd2('0x1e')](function(_0x1db969){var _0x505d44=_['map'](_0x9207e3[_0x8fd2('0x56')],function(_0x338fdf){_0x338fdf[_0x8fd2('0x65')]=_0x9207e3[_0x8fd2('0x52')]['id'];return _0x338fdf;});return db[_0x8fd2('0x80')][_0x8fd2('0xa2')](_0x505d44,{'transaction':_0x16c981});});})[_0x8fd2('0x1e')](function(){return db[_0x8fd2('0x80')][_0x8fd2('0xa3')]({'where':{'OpenchannelAccountId':_0x9207e3['params']['id']},'order':'priority'});});}})[_0x8fd2('0x1e')](respondWithResult(_0x2435e2,null))[_0x8fd2('0x28')](handleError(_0x2435e2,null));};exports[_0x8fd2('0xa4')]=function(_0x6e4d7,_0x5dd2d8,_0x2a216c){var _0xf07c7c={};var _0x17baff={};var _0x54b06b;var _0x1a2a5c;return db[_0x8fd2('0x3d')][_0x8fd2('0x61')]({'where':{'id':_0x6e4d7[_0x8fd2('0x52')]['id']}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x5dd2d8,null))[_0x8fd2('0x1e')](function(_0x4b0310){if(_0x4b0310){_0x54b06b=_0x4b0310;_0x17baff[_0x8fd2('0x43')]=_['keys'](db[_0x8fd2('0x80')]['rawAttributes']);_0x17baff[_0x8fd2('0x40')]=_['keys'](_0x6e4d7[_0x8fd2('0x40')]);_0x17baff['filters']=_[_0x8fd2('0x42')](_0x17baff['model'],_0x17baff[_0x8fd2('0x40')]);_0xf07c7c[_0x8fd2('0x44')]=_['intersection'](_0x17baff[_0x8fd2('0x43')],qs[_0x8fd2('0x45')](_0x6e4d7['query'][_0x8fd2('0x45')]));_0xf07c7c[_0x8fd2('0x44')]=_0xf07c7c[_0x8fd2('0x44')][_0x8fd2('0x46')]?_0xf07c7c[_0x8fd2('0x44')]:_0x17baff[_0x8fd2('0x43')];_0xf07c7c['order']=qs[_0x8fd2('0x48')](_0x6e4d7[_0x8fd2('0x40')][_0x8fd2('0x48')]);_0xf07c7c['where']=qs[_0x8fd2('0x4a')](_['pick'](_0x6e4d7[_0x8fd2('0x40')],_0x17baff['filters']));if(_0x6e4d7[_0x8fd2('0x40')][_0x8fd2('0x4d')]){_0xf07c7c[_0x8fd2('0x49')]=_[_0x8fd2('0x4e')](_0xf07c7c[_0x8fd2('0x49')],{'$or':_[_0x8fd2('0x3c')](_0xf07c7c[_0x8fd2('0x44')],function(_0x3709bc){var _0x1f2f56={};_0x1f2f56[_0x3709bc]={'$like':'%'+_0x6e4d7['query'][_0x8fd2('0x4d')]+'%'};return _0x1f2f56;})});}_0xf07c7c=_[_0x8fd2('0x4e')]({},_0xf07c7c,_0x6e4d7['options']);return _0x54b06b[_0x8fd2('0xa4')](_0xf07c7c);}})[_0x8fd2('0x1e')](function(_0x51cb47){if(_0x51cb47){_0x1a2a5c=_0x51cb47['length'];if(!_0x6e4d7['query'][_0x8fd2('0x62')](_0x8fd2('0x47'))){_0xf07c7c[_0x8fd2('0x2d')]=qs[_0x8fd2('0x2d')](_0x6e4d7[_0x8fd2('0x40')][_0x8fd2('0x2d')]);_0xf07c7c['offset']=qs[_0x8fd2('0x2b')](_0x6e4d7[_0x8fd2('0x40')][_0x8fd2('0x2b')]);}return _0x54b06b[_0x8fd2('0xa4')](_0xf07c7c);}})['then'](function(_0x214202){if(_0x214202){return _0x214202?{'count':_0x1a2a5c,'rows':_0x214202}:null;}})[_0x8fd2('0x1e')](respondWithResult(_0x5dd2d8,null))['catch'](handleError(_0x5dd2d8,null));};exports[_0x8fd2('0xa5')]=function(_0x2364ed,_0xfc3f07,_0xdffa1){var _0x33b0a0={'raw':![],'where':{}};var _0x245472={};var _0x1dd45d={'count':0x0,'rows':[]};return db[_0x8fd2('0x3d')][_0x8fd2('0x61')]({'where':{'id':_0x2364ed[_0x8fd2('0x52')]['id']}})[_0x8fd2('0x1e')](handleEntityNotFound(_0xfc3f07,null))[_0x8fd2('0x1e')](function(_0x27ea15){if(_0x27ea15){_0x245472['model']=_[_0x8fd2('0x41')](db[_0x8fd2('0x8a')][_0x8fd2('0x3e')]);_0x245472['query']=_[_0x8fd2('0x41')](_0x2364ed[_0x8fd2('0x40')]);_0x245472[_0x8fd2('0x4a')]=_['intersection'](_0x245472[_0x8fd2('0x43')],_0x245472[_0x8fd2('0x40')]);_0x33b0a0[_0x8fd2('0x44')]=_[_0x8fd2('0x42')](_0x245472[_0x8fd2('0x43')],qs[_0x8fd2('0x45')](_0x2364ed[_0x8fd2('0x40')][_0x8fd2('0x45')]));_0x33b0a0[_0x8fd2('0x44')]=_0x33b0a0[_0x8fd2('0x44')][_0x8fd2('0x46')]?_0x33b0a0[_0x8fd2('0x44')]:_0x245472['model'];if(!_0x2364ed[_0x8fd2('0x40')]['hasOwnProperty'](_0x8fd2('0x47'))){_0x33b0a0[_0x8fd2('0x2d')]=qs[_0x8fd2('0x2d')](_0x2364ed[_0x8fd2('0x40')][_0x8fd2('0x2d')]);_0x33b0a0['offset']=qs[_0x8fd2('0x2b')](_0x2364ed[_0x8fd2('0x40')]['offset']);}_0x33b0a0[_0x8fd2('0x63')]=qs[_0x8fd2('0x48')](_0x2364ed[_0x8fd2('0x40')][_0x8fd2('0x48')]);_0x33b0a0['where']=qs[_0x8fd2('0x4a')](_[_0x8fd2('0x64')](_0x2364ed[_0x8fd2('0x40')],_0x245472[_0x8fd2('0x4a')]));_0x33b0a0[_0x8fd2('0x49')][_0x8fd2('0x65')]=_0x27ea15['id'];if(_0x2364ed['query'][_0x8fd2('0x4d')]){_0x33b0a0[_0x8fd2('0x49')]=_[_0x8fd2('0x4e')](_0x33b0a0[_0x8fd2('0x49')],{'$or':_[_0x8fd2('0x3c')](_0x33b0a0['attributes'],function(_0x20a535){var _0x187217={};_0x187217[_0x20a535]={'$like':'%'+_0x2364ed[_0x8fd2('0x40')]['filter']+'%'};return _0x187217;})});}_0x33b0a0=_[_0x8fd2('0x4e')]({},_0x33b0a0,_0x2364ed[_0x8fd2('0x4f')]);return db[_0x8fd2('0x8a')][_0x8fd2('0x2e')]({'where':_0x33b0a0['where']})[_0x8fd2('0x1e')](function(_0x3756c5){_0x1dd45d[_0x8fd2('0x2e')]=_0x3756c5;if(_0x2364ed[_0x8fd2('0x40')][_0x8fd2('0x66')]){_0x33b0a0[_0x8fd2('0x53')]=[{'model':db[_0x8fd2('0x7e')],'as':_0x8fd2('0xa6'),'required':![]},{'model':db['User'],'as':_0x8fd2('0xa7'),'attributes':[_0x8fd2('0x38'),_0x8fd2('0xa8'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x8fd2('0xa9'),'attributes':['id',_0x8fd2('0x38'),_0x8fd2('0xaa')],'where':_0x2364ed[_0x8fd2('0x40')]['tag']?{'id':_0x2364ed['query'][_0x8fd2('0xab')]}:undefined,'required':_0x2364ed[_0x8fd2('0x40')][_0x8fd2('0xab')]?!![]:![]}];}return db[_0x8fd2('0x8a')][_0x8fd2('0x50')](_0x33b0a0);})[_0x8fd2('0x1e')](function(_0x5c79c7){_0x1dd45d[_0x8fd2('0x67')]=_0x5c79c7;return _0x1dd45d;});}})['then'](respondWithFilteredResult(_0xfc3f07,_0x33b0a0))['catch'](handleError(_0xfc3f07,null));};exports['addAgents']=function(_0x1d1c7a,_0x471afc,_0x5ca097){return db[_0x8fd2('0x3d')][_0x8fd2('0x54')]({'where':{'id':_0x1d1c7a[_0x8fd2('0x52')]['id']}})['then'](handleEntityNotFound(_0x471afc,null))[_0x8fd2('0x1e')](function(_0x142b4f){if(_0x142b4f){return _0x142b4f[_0x8fd2('0xac')](_0x1d1c7a[_0x8fd2('0x56')][_0x8fd2('0x69')],_[_0x8fd2('0xad')](_0x1d1c7a[_0x8fd2('0x56')],[_0x8fd2('0x69'),'id'])||{})['spread'](function(_0x32c1dd){for(var _0x452741=0x0;_0x452741<_0x1d1c7a['body'][_0x8fd2('0x69')][_0x8fd2('0x46')];_0x452741+=0x1){socket[_0x8fd2('0xae')](_0x8fd2('0xaf'),{'UserId':_0x1d1c7a[_0x8fd2('0x56')]['ids'][_0x452741],'OpenchannelAccountId':_0x1d1c7a['params']['id']});}return _0x32c1dd;});}})[_0x8fd2('0x1e')](respondWithResult(_0x471afc,null))[_0x8fd2('0x28')](handleError(_0x471afc,null));};exports[_0x8fd2('0xb0')]=function(_0x3f2e07,_0x4f145a,_0x267489){return db[_0x8fd2('0x3d')][_0x8fd2('0x54')]({'where':{'id':_0x3f2e07[_0x8fd2('0x52')]['id']}})['then'](handleEntityNotFound(_0x4f145a,null))[_0x8fd2('0x1e')](function(_0x5c8433){if(_0x5c8433){return _0x5c8433[_0x8fd2('0xb0')](_0x3f2e07[_0x8fd2('0x40')][_0x8fd2('0x69')])[_0x8fd2('0x1e')](function(){if(_['isArray'](_0x3f2e07['query']['ids'])){for(var _0x5cb9cc=0x0;_0x5cb9cc<_0x3f2e07['query'][_0x8fd2('0x69')]['length'];_0x5cb9cc+=0x1){socket[_0x8fd2('0xae')](_0x8fd2('0xb1'),{'UserId':Number(_0x3f2e07[_0x8fd2('0x40')][_0x8fd2('0x69')][_0x5cb9cc]),'OpenchannelAccountId':Number(_0x3f2e07[_0x8fd2('0x52')]['id'])});}}else{socket[_0x8fd2('0xae')](_0x8fd2('0xb1'),{'UserId':Number(_0x3f2e07[_0x8fd2('0x40')]['ids']),'OpenchannelAccountId':Number(_0x3f2e07[_0x8fd2('0x52')]['id'])});}});}})[_0x8fd2('0x1e')](respondWithStatusCode(_0x4f145a,null))[_0x8fd2('0x28')](handleError(_0x4f145a,null));};exports[_0x8fd2('0xb2')]=function(_0x2ac5c3,_0x5cc0da,_0x33f950){var _0x47861b={};var _0xea64dd={};var _0x1db8eb;var _0xd65e99;return db[_0x8fd2('0x3d')][_0x8fd2('0x61')]({'where':{'id':_0x2ac5c3[_0x8fd2('0x52')]['id']}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x5cc0da,null))['then'](function(_0xd2c314){if(_0xd2c314){_0x1db8eb=_0xd2c314;_0xea64dd['model']=_['keys'](db[_0x8fd2('0x97')][_0x8fd2('0x3e')]);_0xea64dd['query']=_[_0x8fd2('0x41')](_0x2ac5c3['query']);_0xea64dd[_0x8fd2('0x4a')]=_['intersection'](_0xea64dd[_0x8fd2('0x43')],_0xea64dd['query']);_0x47861b[_0x8fd2('0x44')]=_['intersection'](_0xea64dd[_0x8fd2('0x43')],qs[_0x8fd2('0x45')](_0x2ac5c3[_0x8fd2('0x40')]['fields']));_0x47861b[_0x8fd2('0x44')]=_0x47861b[_0x8fd2('0x44')][_0x8fd2('0x46')]?_0x47861b[_0x8fd2('0x44')]:_0xea64dd['model'];_0x47861b[_0x8fd2('0x63')]=qs[_0x8fd2('0x48')](_0x2ac5c3[_0x8fd2('0x40')][_0x8fd2('0x48')]);_0x47861b[_0x8fd2('0x49')]=qs[_0x8fd2('0x4a')](_['pick'](_0x2ac5c3[_0x8fd2('0x40')],_0xea64dd[_0x8fd2('0x4a')]));if(_0x2ac5c3[_0x8fd2('0x40')]['filter']){_0x47861b[_0x8fd2('0x49')]=_['merge'](_0x47861b[_0x8fd2('0x49')],{'$or':_[_0x8fd2('0x3c')](_0x47861b[_0x8fd2('0x44')],function(_0x289d1f){var _0x3d2717={};_0x3d2717[_0x289d1f]={'$like':'%'+_0x2ac5c3['query']['filter']+'%'};return _0x3d2717;})});}_0x47861b=_[_0x8fd2('0x4e')]({},_0x47861b,_0x2ac5c3[_0x8fd2('0x4f')]);return _0x1db8eb[_0x8fd2('0xb2')](_0x47861b);}})['then'](function(_0x57f78a){if(_0x57f78a){_0xd65e99=_0x57f78a['length'];if(!_0x2ac5c3[_0x8fd2('0x40')][_0x8fd2('0x62')](_0x8fd2('0x47'))){_0x47861b[_0x8fd2('0x2d')]=qs[_0x8fd2('0x2d')](_0x2ac5c3[_0x8fd2('0x40')]['limit']);_0x47861b[_0x8fd2('0x2b')]=qs[_0x8fd2('0x2b')](_0x2ac5c3[_0x8fd2('0x40')][_0x8fd2('0x2b')]);}return _0x1db8eb[_0x8fd2('0xb2')](_0x47861b);}})[_0x8fd2('0x1e')](function(_0x5ef679){if(_0x5ef679){return _0x5ef679?{'count':_0xd65e99,'rows':_0x5ef679}:null;}})['then'](respondWithResult(_0x5cc0da,null))['catch'](handleError(_0x5cc0da,null));};exports[_0x8fd2('0x39')]=function(_0x12d2d6,_0x462f6f,_0x5719bd){var _0x4b3d85,_0x3266ae,_0x3f564f;if(_[_0x8fd2('0x77')](_0x12d2d6[_0x8fd2('0x56')][_0x8fd2('0x56')])||_0x12d2d6[_0x8fd2('0x56')][_0x8fd2('0x56')]===''){throw new db['Sequelize'][(_0x8fd2('0x75'))](_0x8fd2('0x78'));}if(_[_0x8fd2('0x77')](_0x12d2d6['body']['to'])){}_0x4b3d85=_0x12d2d6[_0x8fd2('0x56')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x12d2d6[_0x8fd2('0x52')]['id']}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x462f6f,null))[_0x8fd2('0x1e')](function(_0x2104ab){if(_0x2104ab){return db[_0x8fd2('0x3d')][_0x8fd2('0x54')]({'where':{'id':_0x2104ab['id']},'include':[{'model':db['CmList'],'as':_0x8fd2('0x7d'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x2104ab[_0x8fd2('0x79')]]:_0x4b3d85},'limit':0x1,'order':[[_0x8fd2('0x71'),_0x8fd2('0xb3')]]}]}]})[_0x8fd2('0x1e')](handleEntityNotFound(_0x462f6f,null))[_0x8fd2('0x1e')](function(_0x17983a){if(_0x17983a&&_0x17983a[_0x8fd2('0x7d')]){_0x3266ae=_0x17983a['get']({'plain':!![]});if(_0x3266ae['List']&&_0x3266ae[_0x8fd2('0x7d')][_0x8fd2('0x7f')][_0x8fd2('0x46')]){return _0x3266ae[_0x8fd2('0x7d')][_0x8fd2('0x7f')][0x0];}return db['CmContact'][_0x8fd2('0x55')](_[_0x8fd2('0x15')](_0x12d2d6[_0x8fd2('0x56')],{'firstName':_0x4b3d85,[_0x17983a[_0x8fd2('0x79')]]:_0x4b3d85,'phone':_0x4b3d85,'ListId':_0x3266ae[_0x8fd2('0x72')]}));}})[_0x8fd2('0x1e')](handleEntityNotFound(_0x462f6f,null))[_0x8fd2('0x1e')](function(_0x3de369){if(_0x3de369){_0x3f564f=_0x3de369;return db[_0x8fd2('0x8a')][_0x8fd2('0x54')]({'where':{'ContactId':_0x3f564f['id'],'closed':![],'OpenchannelAccountId':_0x3266ae['id']}})['then'](function(_0x4a3721){if(_0x4a3721){return[_0x4a3721,![]];}return db[_0x8fd2('0x8a')]['create']({'UserId':_0x12d2d6['user']['id'],'ContactId':_0x3f564f['id'],'OpenchannelAccountId':_0x3266ae['id'],'lastMsgDirection':'out','Messages':[_[_0x8fd2('0x4e')](_0x12d2d6[_0x8fd2('0x56')],{'read':![],'body':_0x12d2d6[_0x8fd2('0x56')][_0x8fd2('0x56')],'OpenchannelAccountId':_0x3266ae['id'],'UserId':_0x12d2d6[_0x8fd2('0x59')]['id'],'ContactId':_0x3f564f['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})['then'](function(_0x34a0a9){return[_0x34a0a9,!![]];});});}})[_0x8fd2('0x8d')](function(_0x4e81dd,_0x40971c){if(_0x40971c){return _0x4e81dd;}return db[_0x8fd2('0x94')][_0x8fd2('0x55')](_[_0x8fd2('0x4e')](_0x12d2d6[_0x8fd2('0x56')],{'read':![],'body':_0x12d2d6[_0x8fd2('0x56')][_0x8fd2('0x56')],'OpenchannelAccountId':_0x3266ae['id'],'OpenchannelInteractionId':_0x4e81dd['id'],'UserId':_0x12d2d6[_0x8fd2('0x59')]['id'],'ContactId':_0x3f564f['id']}))['then'](function(_0x5391dc){_0x4e81dd['dataValues']['Messages']=[];_0x4e81dd['dataValues'][_0x8fd2('0xb4')][_0x8fd2('0xb5')](_0x5391dc['dataValues']);return _0x4e81dd;});});}})[_0x8fd2('0x1e')](respondWithResult(_0x462f6f,null))['catch'](handleError(_0x462f6f,null));}; \ No newline at end of file +var _0x851d=['show','keys','length','find','create','body','role','user','get','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','update','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','rawAttributes','pick','removeDispositions','ids','addAnswer','hasOwnProperty','CannedAnswer','rows','removeAnswers','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','applications','list','asc','account','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','notify','sequelize','transaction','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','findAll','addAgents','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','destroy','UserProfileResource','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','key','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include'];(function(_0x155c9d,_0x3dd022){var _0xacabfa=function(_0x3ebc16){while(--_0x3ebc16){_0x155c9d['push'](_0x155c9d['shift']());}};_0xacabfa(++_0x3dd022);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd851('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd851('0x1'));var jsonpatch=require(_0xd851('0x2'));var rp=require('request-promise');var moment=require(_0xd851('0x3'));var BPromise=require(_0xd851('0x4'));var Mustache=require(_0xd851('0x5'));var util=require(_0xd851('0x6'));var path=require(_0xd851('0x7'));var sox=require(_0xd851('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd851('0x9'));var _=require(_0xd851('0xa'));var squel=require(_0xd851('0xb'));var crypto=require(_0xd851('0xc'));var jsforce=require(_0xd851('0xd'));var deskjs=require(_0xd851('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd851('0xf'));var Papa=require('papaparse');var Redis=require(_0xd851('0x10'));var authService=require(_0xd851('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd851('0x12'));var hardwareService=require(_0xd851('0x13'));var logger=require(_0xd851('0x14'))(_0xd851('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd851('0x16'));var db=require(_0xd851('0x17'))['db'];config[_0xd851('0x18')]=_[_0xd851('0x19')](config['redis'],{'host':_0xd851('0x1a'),'port':0x18eb});var socket=require(_0xd851('0x1b'))(new Redis(config['redis']));require(_0xd851('0x1c'))[_0xd851('0x1d')](socket);var jayson=require(_0xd851('0x1e'));var client=jayson['client'][_0xd851('0x1f')]({'port':0x232c});var client9002=jayson[_0xd851('0x20')][_0xd851('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1e2ee7,_0x1b3d4c,_0xf011ee,_0x55d0ac){return new BPromise(function(_0x448e31,_0xc6d01){var _0x1f4f98=_0x55d0ac||client;return _0x1f4f98[_0xd851('0x21')](_0x1e2ee7,_0xf011ee)[_0xd851('0x22')](function(_0x2be9c9){logger[_0xd851('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x1b3d4c,'request\x20sent');logger[_0xd851('0x24')](_0xd851('0x25'),_0x1b3d4c,_0xd851('0x26'),JSON[_0xd851('0x27')](_0x2be9c9));if(_0x2be9c9[_0xd851('0x28')]){if(_0x2be9c9[_0xd851('0x28')][_0xd851('0x29')]===0x1f4){logger[_0xd851('0x28')](_0xd851('0x2a'),_0x1b3d4c,_0x2be9c9[_0xd851('0x28')][_0xd851('0x2b')]);return _0xc6d01(_0x2be9c9[_0xd851('0x28')][_0xd851('0x2b')]);}logger['error'](_0xd851('0x2a'),_0x1b3d4c,_0x2be9c9[_0xd851('0x28')]['message']);return _0x448e31(_0x2be9c9[_0xd851('0x28')][_0xd851('0x2b')]);}else{logger[_0xd851('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x1b3d4c,'request\x20sent');_0x448e31(_0x2be9c9['result'][_0xd851('0x2b')]);}})[_0xd851('0x2c')](function(_0x2f2009){logger[_0xd851('0x28')](_0xd851('0x2a'),_0x1b3d4c,_0x2f2009);_0xc6d01(_0x2f2009);});});}function respondWithStatusCode(_0x4d5229,_0xe1d3e9){_0xe1d3e9=_0xe1d3e9||0xcc;return function(_0x54b2ea){if(_0x54b2ea){return _0x4d5229[_0xd851('0x2d')](_0xe1d3e9);}return _0x4d5229[_0xd851('0x2e')](_0xe1d3e9)[_0xd851('0x2f')]();};}function respondWithResult(_0x36457c,_0x337da5){_0x337da5=_0x337da5||0xc8;return function(_0x30aa56){if(_0x30aa56){return _0x36457c['status'](_0x337da5)[_0xd851('0x30')](_0x30aa56);}};}function respondWithFilteredResult(_0x441c27,_0x1d68f9){return function(_0x3c3177){if(_0x3c3177){var _0x6c52fb=typeof _0x1d68f9[_0xd851('0x31')]===_0xd851('0x32')&&typeof _0x1d68f9[_0xd851('0x33')]===_0xd851('0x32');var _0x2ef08d=_0x3c3177[_0xd851('0x34')];var _0x132df8=_0x6c52fb?0x0:_0x1d68f9['offset'];var _0x15ce59=_0x6c52fb?_0x3c3177[_0xd851('0x34')]:_0x1d68f9[_0xd851('0x31')]+_0x1d68f9[_0xd851('0x33')];var _0x4f887e;if(_0x15ce59>=_0x2ef08d){_0x15ce59=_0x2ef08d;_0x4f887e=0xc8;}else{_0x4f887e=0xce;}_0x441c27[_0xd851('0x2e')](_0x4f887e);return _0x441c27['set']('Content-Range',_0x132df8+'-'+_0x15ce59+'/'+_0x2ef08d)[_0xd851('0x30')](_0x3c3177);}return null;};}function patchUpdates(_0x21cdd7){return function(_0x48a5b8){try{jsonpatch['apply'](_0x48a5b8,_0x21cdd7,!![]);}catch(_0x2b8b98){return BPromise[_0xd851('0x35')](_0x2b8b98);}return _0x48a5b8[_0xd851('0x36')]();};}function saveUpdates(_0x2028ec,_0x443c94){return function(_0x4c452e){if(_0x4c452e){return _0x4c452e['update'](_0x2028ec)[_0xd851('0x22')](function(_0x39311f){return _0x39311f;});}return null;};}function removeEntity(_0x1c5d66,_0x1f3d7e){return function(_0x1b382e){if(_0x1b382e){return _0x1b382e[_0xd851('0x37')]()[_0xd851('0x22')](function(){var _0xda5c1=_0x1b382e['get']({'plain':!![]});var _0x5535f1='OpenchannelAccounts';return db[_0xd851('0x38')][_0xd851('0x37')]({'where':{'type':_0x5535f1,'resourceId':_0xda5c1['id']}})[_0xd851('0x22')](function(){return _0x1b382e;});})[_0xd851('0x22')](function(){_0x1c5d66[_0xd851('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x189ec7,_0x1e4fae){return function(_0x5bcbc8){if(!_0x5bcbc8){_0x189ec7[_0xd851('0x2d')](0x194);}return _0x5bcbc8;};}function handleError(_0x10ce2d,_0x28499f){_0x28499f=_0x28499f||0x1f4;return function(_0x105718){logger['error'](_0x105718['stack']);if(_0x105718[_0xd851('0x39')]){delete _0x105718['name'];}_0x10ce2d[_0xd851('0x2e')](_0x28499f)[_0xd851('0x3a')](_0x105718);};}exports[_0xd851('0x3b')]=function(_0x56eb8b,_0x4ad910){var _0x483182={'include':[{'model':db['Pause'],'as':_0xd851('0x3c')}]},_0x11863e={},_0xd6e4e6={'count':0x0,'rows':[]};var _0x38b105=_[_0xd851('0x3d')](db[_0xd851('0x3e')]['rawAttributes'],function(_0x55c081){return{'name':_0x55c081[_0xd851('0x3f')],'type':_0x55c081[_0xd851('0x40')][_0xd851('0x41')]};});_0x11863e['model']=_[_0xd851('0x3d')](_0x38b105,_0xd851('0x39'));_0x11863e[_0xd851('0x42')]=_['keys'](_0x56eb8b[_0xd851('0x42')]);_0x11863e[_0xd851('0x43')]=_[_0xd851('0x44')](_0x11863e[_0xd851('0x45')],_0x11863e[_0xd851('0x42')]);_0x483182[_0xd851('0x46')]=_[_0xd851('0x44')](_0x11863e[_0xd851('0x45')],qs[_0xd851('0x47')](_0x56eb8b[_0xd851('0x42')][_0xd851('0x47')]));_0x483182[_0xd851('0x46')]=_0x483182['attributes']['length']?_0x483182['attributes']:_0x11863e[_0xd851('0x45')];if(!_0x56eb8b[_0xd851('0x42')]['hasOwnProperty'](_0xd851('0x48'))){_0x483182[_0xd851('0x33')]=qs[_0xd851('0x33')](_0x56eb8b[_0xd851('0x42')]['limit']);_0x483182[_0xd851('0x31')]=qs[_0xd851('0x31')](_0x56eb8b[_0xd851('0x42')][_0xd851('0x31')]);}_0x483182[_0xd851('0x49')]=qs['sort'](_0x56eb8b[_0xd851('0x42')][_0xd851('0x4a')]);_0x483182[_0xd851('0x4b')]=qs[_0xd851('0x43')](_['pick'](_0x56eb8b[_0xd851('0x42')],_0x11863e[_0xd851('0x43')]),_0x38b105);if(_0x56eb8b[_0xd851('0x42')][_0xd851('0x4c')]){_0x483182['where']=_['merge'](_0x483182[_0xd851('0x4b')],{'$or':_[_0xd851('0x3d')](_0x38b105,function(_0x1f9019){if(_0x1f9019[_0xd851('0x40')]!==_0xd851('0x4d')){var _0x2a916d={};_0x2a916d[_0x1f9019[_0xd851('0x39')]]={'$like':'%'+_0x56eb8b[_0xd851('0x42')][_0xd851('0x4c')]+'%'};return _0x2a916d;}})});}_0x483182=_[_0xd851('0x4e')]({},_0x483182,_0x56eb8b[_0xd851('0x4f')]);var _0x3bcd39={'where':_0x483182[_0xd851('0x4b')]};return db['OpenchannelAccount'][_0xd851('0x34')](_0x3bcd39)[_0xd851('0x22')](function(_0x212323){_0xd6e4e6[_0xd851('0x34')]=_0x212323;if(_0x56eb8b['query'][_0xd851('0x50')]){_0x483182[_0xd851('0x51')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x483182);})[_0xd851('0x22')](function(_0x2d9ecb){_0xd6e4e6['rows']=_0x2d9ecb;return _0xd6e4e6;})[_0xd851('0x22')](respondWithFilteredResult(_0x4ad910,_0x483182))[_0xd851('0x2c')](handleError(_0x4ad910,null));};exports[_0xd851('0x52')]=function(_0x4434ca,_0x28c5b7){var _0x5dff2c={'raw':![],'where':{'id':_0x4434ca['params']['id']},'include':[{'model':db['Pause'],'as':_0xd851('0x3c')}]},_0x10cf5b={};_0x10cf5b[_0xd851('0x45')]=_[_0xd851('0x53')](db[_0xd851('0x3e')]['rawAttributes']);_0x10cf5b['query']=_[_0xd851('0x53')](_0x4434ca[_0xd851('0x42')]);_0x10cf5b['filters']=_[_0xd851('0x44')](_0x10cf5b[_0xd851('0x45')],_0x10cf5b[_0xd851('0x42')]);_0x5dff2c[_0xd851('0x46')]=_['intersection'](_0x10cf5b[_0xd851('0x45')],qs[_0xd851('0x47')](_0x4434ca['query'][_0xd851('0x47')]));_0x5dff2c[_0xd851('0x46')]=_0x5dff2c[_0xd851('0x46')][_0xd851('0x54')]?_0x5dff2c[_0xd851('0x46')]:_0x10cf5b[_0xd851('0x45')];if(_0x4434ca[_0xd851('0x42')][_0xd851('0x50')]){_0x5dff2c[_0xd851('0x51')]=[{'all':!![]}];}_0x5dff2c=_['merge']({},_0x5dff2c,_0x4434ca[_0xd851('0x4f')]);return db['OpenchannelAccount'][_0xd851('0x55')](_0x5dff2c)[_0xd851('0x22')](handleEntityNotFound(_0x28c5b7,null))['then'](respondWithResult(_0x28c5b7,null))[_0xd851('0x2c')](handleError(_0x28c5b7,null));};exports[_0xd851('0x56')]=function(_0x1d9b9e,_0x5ee1e1){return db['OpenchannelAccount'][_0xd851('0x56')](_0x1d9b9e[_0xd851('0x57')],{})[_0xd851('0x22')](function(_0x5951de){var _0x290e08=_0x1d9b9e['user']['get']({'plain':!![]});if(!_0x290e08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x290e08[_0xd851('0x58')]===_0xd851('0x59')){var _0x2e5bc5=_0x5951de[_0xd851('0x5a')]({'plain':!![]});var _0x4ba5f5=_0xd851('0x5b');return db[_0xd851('0x5c')][_0xd851('0x55')]({'where':{'name':_0x4ba5f5,'userProfileId':_0x290e08[_0xd851('0x5d')]},'raw':!![]})[_0xd851('0x22')](function(_0x541e59){if(_0x541e59&&_0x541e59[_0xd851('0x5e')]===0x0){return db[_0xd851('0x38')][_0xd851('0x56')]({'name':_0x2e5bc5[_0xd851('0x39')],'resourceId':_0x2e5bc5['id'],'type':_0x541e59[_0xd851('0x39')],'sectionId':_0x541e59['id']},{})[_0xd851('0x22')](function(){return _0x5951de;});}else{return _0x5951de;}})[_0xd851('0x2c')](function(_0x4211a2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4211a2);throw _0x4211a2;});}return _0x5951de;})[_0xd851('0x22')](respondWithResult(_0x5ee1e1,0xc9))[_0xd851('0x2c')](handleError(_0x5ee1e1,null));};exports[_0xd851('0x5f')]=function(_0x14929a,_0x35f1ee){if(_0x14929a[_0xd851('0x57')]['id']){delete _0x14929a[_0xd851('0x57')]['id'];}return db[_0xd851('0x3e')][_0xd851('0x55')]({'where':{'id':_0x14929a[_0xd851('0x60')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xd851('0x22')](handleEntityNotFound(_0x35f1ee,null))['then'](saveUpdates(_0x14929a[_0xd851('0x57')],null))['then'](respondWithResult(_0x35f1ee,null))['catch'](handleError(_0x35f1ee,null));};exports[_0xd851('0x37')]=function(_0x13488e,_0x5388ba){return db['OpenchannelAccount'][_0xd851('0x55')]({'where':{'id':_0x13488e[_0xd851('0x60')]['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x5388ba,null))[_0xd851('0x22')](removeEntity(_0x5388ba,null))[_0xd851('0x2c')](handleError(_0x5388ba,null));};exports[_0xd851('0x61')]=function(_0x4c2c1d,_0x45adcf){return db[_0xd851('0x3e')][_0xd851('0x61')]()[_0xd851('0x22')](respondWithResult(_0x45adcf,null))['catch'](handleError(_0x45adcf,null));};exports[_0xd851('0x62')]=function(_0x40469b,_0x39a94c,_0x579c70){if(_0x40469b[_0xd851('0x57')]['id']){delete _0x40469b['body']['id'];}return db[_0xd851('0x3e')][_0xd851('0x55')]({'where':{'id':_0x40469b[_0xd851('0x60')]['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x39a94c,null))['then'](function(_0x24ea6d){if(_0x24ea6d){_0x40469b[_0xd851('0x57')][_0xd851('0x63')]=_0x24ea6d['id'];return db[_0xd851('0x64')][_0xd851('0x56')](_0x40469b[_0xd851('0x57')]);}})[_0xd851('0x22')](respondWithResult(_0x39a94c,null))[_0xd851('0x2c')](handleError(_0x39a94c,null));};exports[_0xd851('0x65')]=function(_0x1c7ce9,_0x39c7e5,_0x4d4705){var _0x5a19a6={'raw':![],'where':{}};var _0x381ace={};var _0x3a485a={'count':0x0,'rows':[]};return db[_0xd851('0x3e')][_0xd851('0x66')]({'where':{'id':_0x1c7ce9[_0xd851('0x60')]['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x39c7e5,null))[_0xd851('0x22')](function(_0x40f84){if(_0x40f84){_0x381ace[_0xd851('0x45')]=_[_0xd851('0x53')](db[_0xd851('0x64')][_0xd851('0x67')]);_0x381ace[_0xd851('0x42')]=_[_0xd851('0x53')](_0x1c7ce9[_0xd851('0x42')]);_0x381ace[_0xd851('0x43')]=_[_0xd851('0x44')](_0x381ace[_0xd851('0x45')],_0x381ace[_0xd851('0x42')]);_0x5a19a6[_0xd851('0x46')]=_[_0xd851('0x44')](_0x381ace[_0xd851('0x45')],qs[_0xd851('0x47')](_0x1c7ce9[_0xd851('0x42')][_0xd851('0x47')]));_0x5a19a6[_0xd851('0x46')]=_0x5a19a6[_0xd851('0x46')][_0xd851('0x54')]?_0x5a19a6['attributes']:_0x381ace[_0xd851('0x45')];if(!_0x1c7ce9[_0xd851('0x42')]['hasOwnProperty']('nolimit')){_0x5a19a6[_0xd851('0x33')]=qs[_0xd851('0x33')](_0x1c7ce9[_0xd851('0x42')][_0xd851('0x33')]);_0x5a19a6[_0xd851('0x31')]=qs[_0xd851('0x31')](_0x1c7ce9[_0xd851('0x42')][_0xd851('0x31')]);}_0x5a19a6[_0xd851('0x49')]=qs[_0xd851('0x4a')](_0x1c7ce9[_0xd851('0x42')][_0xd851('0x4a')]);_0x5a19a6[_0xd851('0x4b')]=qs['filters'](_[_0xd851('0x68')](_0x1c7ce9['query'],_0x381ace[_0xd851('0x43')]));_0x5a19a6[_0xd851('0x4b')][_0xd851('0x63')]=_0x40f84['id'];if(_0x1c7ce9[_0xd851('0x42')][_0xd851('0x4c')]){_0x5a19a6[_0xd851('0x4b')]=_['merge'](_0x5a19a6[_0xd851('0x4b')],{'$or':_[_0xd851('0x3d')](_0x5a19a6[_0xd851('0x46')],function(_0x484865){var _0x35eb7b={};_0x35eb7b[_0x484865]={'$like':'%'+_0x1c7ce9[_0xd851('0x42')][_0xd851('0x4c')]+'%'};return _0x35eb7b;})});}_0x5a19a6=_[_0xd851('0x4e')]({},_0x5a19a6,_0x1c7ce9[_0xd851('0x4f')]);return db['Disposition']['count']({'where':_0x5a19a6[_0xd851('0x4b')]})[_0xd851('0x22')](function(_0x2e3deb){_0x3a485a['count']=_0x2e3deb;if(_0x1c7ce9['query']['includeAll']){_0x5a19a6[_0xd851('0x51')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5a19a6);})[_0xd851('0x22')](function(_0x231d58){_0x3a485a['rows']=_0x231d58;return _0x3a485a;});}})[_0xd851('0x22')](respondWithFilteredResult(_0x39c7e5,_0x5a19a6))[_0xd851('0x2c')](handleError(_0x39c7e5,null));};exports[_0xd851('0x69')]=function(_0x4f86f9,_0x51d931,_0x1fcdc1){return db['OpenchannelAccount'][_0xd851('0x55')]({'where':{'id':_0x4f86f9['params']['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x51d931,null))[_0xd851('0x22')](function(_0x58b375){if(_0x58b375){return _0x58b375['removeDispositions'](_0x4f86f9[_0xd851('0x42')][_0xd851('0x6a')]);}})[_0xd851('0x22')](respondWithStatusCode(_0x51d931,null))[_0xd851('0x2c')](handleError(_0x51d931,null));};exports[_0xd851('0x6b')]=function(_0x5c5f37,_0x2db755,_0x4ac380){if(_0x5c5f37[_0xd851('0x57')]['id']){delete _0x5c5f37[_0xd851('0x57')]['id'];}return db[_0xd851('0x3e')]['find']({'where':{'id':_0x5c5f37[_0xd851('0x60')]['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x2db755,null))[_0xd851('0x22')](function(_0x354619){if(_0x354619){_0x5c5f37[_0xd851('0x57')][_0xd851('0x63')]=_0x354619['id'];return db['CannedAnswer'][_0xd851('0x56')](_0x5c5f37[_0xd851('0x57')]);}})['then'](respondWithResult(_0x2db755,null))[_0xd851('0x2c')](handleError(_0x2db755,null));};exports['getAnswers']=function(_0x19b967,_0x246fa5,_0x1a6096){var _0x252fca={'raw':![],'where':{}};var _0x4084b8={};var _0x5ddfb1={'count':0x0,'rows':[]};return db[_0xd851('0x3e')][_0xd851('0x66')]({'where':{'id':_0x19b967[_0xd851('0x60')]['id']}})['then'](handleEntityNotFound(_0x246fa5,null))[_0xd851('0x22')](function(_0x30039e){if(_0x30039e){_0x4084b8[_0xd851('0x45')]=_['keys'](db['CannedAnswer'][_0xd851('0x67')]);_0x4084b8[_0xd851('0x42')]=_[_0xd851('0x53')](_0x19b967[_0xd851('0x42')]);_0x4084b8['filters']=_[_0xd851('0x44')](_0x4084b8[_0xd851('0x45')],_0x4084b8['query']);_0x252fca['attributes']=_['intersection'](_0x4084b8[_0xd851('0x45')],qs[_0xd851('0x47')](_0x19b967[_0xd851('0x42')][_0xd851('0x47')]));_0x252fca[_0xd851('0x46')]=_0x252fca['attributes'][_0xd851('0x54')]?_0x252fca[_0xd851('0x46')]:_0x4084b8[_0xd851('0x45')];if(!_0x19b967[_0xd851('0x42')][_0xd851('0x6c')](_0xd851('0x48'))){_0x252fca[_0xd851('0x33')]=qs['limit'](_0x19b967[_0xd851('0x42')]['limit']);_0x252fca[_0xd851('0x31')]=qs[_0xd851('0x31')](_0x19b967[_0xd851('0x42')][_0xd851('0x31')]);}_0x252fca['order']=qs[_0xd851('0x4a')](_0x19b967[_0xd851('0x42')][_0xd851('0x4a')]);_0x252fca['where']=qs['filters'](_[_0xd851('0x68')](_0x19b967['query'],_0x4084b8[_0xd851('0x43')]));_0x252fca[_0xd851('0x4b')][_0xd851('0x63')]=_0x30039e['id'];if(_0x19b967[_0xd851('0x42')][_0xd851('0x4c')]){_0x252fca['where']=_[_0xd851('0x4e')](_0x252fca[_0xd851('0x4b')],{'$or':_[_0xd851('0x3d')](_0x252fca[_0xd851('0x46')],function(_0x4efab4){var _0x420314={};_0x420314[_0x4efab4]={'$like':'%'+_0x19b967[_0xd851('0x42')]['filter']+'%'};return _0x420314;})});}_0x252fca=_[_0xd851('0x4e')]({},_0x252fca,_0x19b967[_0xd851('0x4f')]);return db['CannedAnswer'][_0xd851('0x34')]({'where':_0x252fca['where']})[_0xd851('0x22')](function(_0x1fca06){_0x5ddfb1[_0xd851('0x34')]=_0x1fca06;if(_0x19b967[_0xd851('0x42')][_0xd851('0x50')]){_0x252fca[_0xd851('0x51')]=[{'all':!![]}];}return db[_0xd851('0x6d')]['findAll'](_0x252fca);})['then'](function(_0x108572){_0x5ddfb1[_0xd851('0x6e')]=_0x108572;return _0x5ddfb1;});}})['then'](respondWithFilteredResult(_0x246fa5,_0x252fca))['catch'](handleError(_0x246fa5,null));};exports[_0xd851('0x6f')]=function(_0x42c3c0,_0x223b4e,_0x105a42){return db['OpenchannelAccount'][_0xd851('0x55')]({'where':{'id':_0x42c3c0[_0xd851('0x60')]['id']}})['then'](handleEntityNotFound(_0x223b4e,null))[_0xd851('0x22')](function(_0x3dea59){if(_0x3dea59){return _0x3dea59[_0xd851('0x6f')](_0x42c3c0[_0xd851('0x42')][_0xd851('0x6a')]);}})['then'](respondWithStatusCode(_0x223b4e,null))['catch'](handleError(_0x223b4e,null));};exports['notify']=function(_0x34cd0c,_0x40dc4a,_0x2da7a9){var _0x3b3129={'body':_0x34cd0c[_0xd851('0x57')],'channel':'openchannel'};var _0x3dde26=[];var _0x307995=[];var _0x53fab9={};var _0x29d93d=![];return db[_0xd851('0x70')][_0xd851('0x61')]()['then'](function(_0x2ddffe){if(!_0x2ddffe){throw new db[(_0xd851('0x71'))][(_0xd851('0x72'))](_0xd851('0x73'));}_0x3dde26=_[_0xd851('0x74')](_['keys'](_0x2ddffe),[_0xd851('0x75'),_0xd851('0x76')]);_0x307995=_[_0xd851('0x74')](_[_0xd851('0x53')](_0x2ddffe),[_0xd851('0x75'),_0xd851('0x76'),'CompanyId',_0xd851('0x77')]);if(_0x34cd0c[_0xd851('0x57')]['id']){delete _0x34cd0c[_0xd851('0x57')]['id'];}if(_[_0xd851('0x78')](_0x34cd0c[_0xd851('0x57')]['from'])){throw new db[(_0xd851('0x71'))][(_0xd851('0x72'))](_0xd851('0x79'));}if(_[_0xd851('0x78')](_0x34cd0c[_0xd851('0x57')]['body'])||_0x34cd0c['body'][_0xd851('0x57')]===''){throw new db[(_0xd851('0x71'))][(_0xd851('0x72'))](_0xd851('0x7a'));}if(_['isNil'](_0x34cd0c[_0xd851('0x57')][_0xd851('0x7b')])){throw new db[(_0xd851('0x71'))]['ValidationError'](_0xd851('0x7c')+_0x307995);}if(!_[_0xd851('0x7d')](_0x307995,_0x34cd0c[_0xd851('0x57')][_0xd851('0x7b')])){throw new db[(_0xd851('0x71'))][(_0xd851('0x72'))](_0xd851('0x7e')+_0x307995);}_0x53fab9[_0x34cd0c[_0xd851('0x57')][_0xd851('0x7b')]]=_0x34cd0c[_0xd851('0x57')][_0xd851('0x7f')];})[_0xd851('0x22')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x34cd0c['params']['id']},'include':[{'model':db[_0xd851('0x80')],'as':'List','include':[{'model':db[_0xd851('0x70')],'as':_0xd851('0x81'),'where':_0x53fab9,'limit':0x1,'order':[[_0xd851('0x76'),_0xd851('0x82')]]}]},{'model':db[_0xd851('0x83')],'as':_0xd851('0x84')}]});})[_0xd851('0x22')](handleEntityNotFound(_0x40dc4a,null))[_0xd851('0x22')](function(_0x3d01e6){if(_0x3d01e6&&_0x3d01e6[_0xd851('0x85')]){_0x3b3129['account']=_0x3d01e6;_0x3b3129[_0xd851('0x86')]=_0x3d01e6[_0xd851('0x84')];_0x3b3129[_0xd851('0x87')]=_0x3d01e6[_0xd851('0x85')];_0x3b3129[_0xd851('0x86')]=_['orderBy'](_0x3b3129['applications'],['priority'],[_0xd851('0x88')]);if(_0x3b3129[_0xd851('0x89')][_0xd851('0x84')]){delete _0x3b3129[_0xd851('0x89')][_0xd851('0x84')];}if(_0x3b3129['account'][_0xd851('0x85')]&&_0x3b3129[_0xd851('0x89')][_0xd851('0x85')][_0xd851('0x81')][_0xd851('0x54')]){return _0x3b3129['account']['List'][_0xd851('0x81')][0x0];}var _0x4e35b4=_[_0xd851('0x19')](_0x34cd0c[_0xd851('0x57')],{'firstName':_0x34cd0c['body']['from'],'ListId':_0x3d01e6[_0xd851('0x77')]});_0x4e35b4[_0x34cd0c[_0xd851('0x57')][_0xd851('0x7b')]]=_0x34cd0c[_0xd851('0x57')]['from'];return db[_0xd851('0x70')]['create'](_0x4e35b4,{'fields':_0x3dde26,'raw':!![]});}})[_0xd851('0x22')](handleEntityNotFound(_0x40dc4a,null))[_0xd851('0x22')](function(_0x152523){_0x3b3129[_0xd851('0x8a')]=_0x152523;if(_0x152523){var _0x505a7={'ContactId':_0x152523['id'],'OpenchannelAccountId':_0x34cd0c[_0xd851('0x60')]['id'],'from':(_0x152523['firstName']||'')+'\x20'+(_0x152523[_0xd851('0x8b')]||'')};var _0x13f6ca={'OpenchannelAccountId':_0x34cd0c[_0xd851('0x60')]['id'],'closed':![]};if(_0x34cd0c[_0xd851('0x57')][_0xd851('0x8c')]){_0x13f6ca['threadId']=_0x34cd0c[_0xd851('0x57')]['threadId'];return db[_0xd851('0x8d')]['find']({'where':_0x13f6ca})[_0xd851('0x22')](function(_0x36389b){if(_0x36389b){return[_0x36389b,![]];}_0x505a7[_0xd851('0x8c')]=_0x34cd0c[_0xd851('0x57')][_0xd851('0x8c')];_0x505a7[_0xd851('0x8e')]=_0x34cd0c['body'][_0xd851('0x8e')];return db['OpenchannelInteraction'][_0xd851('0x56')](_0x505a7)['then'](function(_0x834eae){return[_0x834eae,!![]];});});}else{_0x13f6ca[_0xd851('0x8c')]=null;}_0x13f6ca[_0xd851('0x8f')]=_0x152523['id'];return db[_0xd851('0x8d')][_0xd851('0x55')]({'where':_0x13f6ca})[_0xd851('0x22')](function(_0x56b89d){if(_0x56b89d){return[_0x56b89d,![]];}return db[_0xd851('0x8d')][_0xd851('0x56')](_0x505a7)[_0xd851('0x22')](function(_0x21a8c7){return[_0x21a8c7,!![]];});});}})[_0xd851('0x90')](function(_0xe674f8,_0x4dfc48){if(_0xe674f8){_0x29d93d=_0x4dfc48;if(!_0x4dfc48){var _0x245e42={'from':(_0x3b3129[_0xd851('0x8a')][_0xd851('0x91')]||'')+'\x20'+(_0x3b3129['contact'][_0xd851('0x8b')]||'')};if(_0x34cd0c[_0xd851('0x57')][_0xd851('0x8c')]&&_0x34cd0c[_0xd851('0x57')][_0xd851('0x92')]&&_0x34cd0c[_0xd851('0x57')][_0xd851('0x8c')]!=_0x34cd0c[_0xd851('0x57')][_0xd851('0x92')]){_0x245e42['threadId']=_0x34cd0c[_0xd851('0x57')][_0xd851('0x92')];}return _0xe674f8[_0xd851('0x5f')](_0x245e42);}else{return _0xe674f8;}}})['then'](function(_0x494aef){_0x3b3129[_0xd851('0x93')]=_0x494aef[_0xd851('0x5a')]({'plain':!![]});_0x3b3129[_0xd851('0x93')][_0xd851('0x94')]=_0x29d93d;if(_0x3b3129['interaction'][_0xd851('0x94')]){if(_0x3b3129[_0xd851('0x89')]['autoclose']){_0x3b3129[_0xd851('0x86')][_0xd851('0x95')]({'id':0x0,'priority':_0x3b3129[_0xd851('0x86')][_0xd851('0x54')]+0x1,'app':'close','appdata':_0xd851('0x96'),'interval':_0xd851('0x97')});}}return db[_0xd851('0x98')][_0xd851('0x56')]({'body':_0x34cd0c[_0xd851('0x57')][_0xd851('0x57')],'OpenchannelAccountId':_0x34cd0c['params']['id'],'OpenchannelInteractionId':_0x494aef['id'],'direction':'in','ContactId':_0x3b3129[_0xd851('0x8a')]['id'],'AttachmentId':_0x34cd0c[_0xd851('0x57')][_0xd851('0x99')]});})[_0xd851('0x22')](function(_0x2db30d){_0x3b3129['message']=_0x2db30d;if(_0x3b3129[_0xd851('0x93')][_0xd851('0x9a')]){return db[_0xd851('0x9b')]['find']({'attributes':['id','name'],'where':{'id':_0x3b3129[_0xd851('0x93')][_0xd851('0x9a')]}})['then'](function(_0x50aa71){if(_0x50aa71){_0x3b3129[_0xd851('0x86')][_0xd851('0x9c')]({'id':0x0,'priority':0x0,'app':_0xd851('0x9d'),'appdata':_0x50aa71['name']+','+(_0x3b3129[_0xd851('0x89')]['waitForTheAssignedAgent']||0xa),'interval':_0xd851('0x97')});_0x3b3129[_0xd851('0x9e')]=![];}return respondWithRpcPromise(_0xd851('0x9f'),_0xd851('0xa0'),_0x3b3129);});}return respondWithRpcPromise(_0xd851('0x9f'),'startRouting',_0x3b3129);})[_0xd851('0x22')](function(_0x579f7b){respondWithRpcPromise(_0xd851('0xa1'),_0xd851('0xa1'),{'event':_0xd851('0xa2'),'message':_0x579f7b},client9002);return _0x579f7b;})[_0xd851('0x22')](respondWithResult(_0x40dc4a,null))[_0xd851('0x2c')](handleError(_0x40dc4a,null));};exports['addApplications']=function(_0x29285b,_0x4f79a0,_0x3541f8){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x29285b[_0xd851('0x60')]['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x4f79a0,null))[_0xd851('0x22')](function(_0x1fe1a7){if(_0x1fe1a7){return db[_0xd851('0xa3')][_0xd851('0xa4')](function(_0x418a39){return db[_0xd851('0x83')][_0xd851('0x37')]({'where':{'OpenchannelAccountId':_0x29285b[_0xd851('0x60')]['id']},'transaction':_0x418a39})[_0xd851('0x22')](function(_0x14cad9){var _0x338930=_[_0xd851('0x3d')](_0x29285b[_0xd851('0x57')],function(_0x433d9e){_0x433d9e['OpenchannelAccountId']=_0x29285b[_0xd851('0x60')]['id'];return _0x433d9e;});return db[_0xd851('0x83')]['bulkCreate'](_0x338930,{'transaction':_0x418a39});});})[_0xd851('0x22')](function(){return db[_0xd851('0x83')][_0xd851('0xa5')]({'where':{'OpenchannelAccountId':_0x29285b[_0xd851('0x60')]['id']},'order':_0xd851('0xa6')});});}})[_0xd851('0x22')](respondWithResult(_0x4f79a0,null))[_0xd851('0x2c')](handleError(_0x4f79a0,null));};exports[_0xd851('0xa7')]=function(_0xf3360a,_0x36636b,_0x1ba0ea){var _0x292771={};var _0x5eb410={};var _0x2c0857;var _0x358f16;return db[_0xd851('0x3e')][_0xd851('0x66')]({'where':{'id':_0xf3360a['params']['id']}})['then'](handleEntityNotFound(_0x36636b,null))['then'](function(_0x527537){if(_0x527537){_0x2c0857=_0x527537;_0x5eb410['model']=_[_0xd851('0x53')](db[_0xd851('0x83')][_0xd851('0x67')]);_0x5eb410['query']=_[_0xd851('0x53')](_0xf3360a[_0xd851('0x42')]);_0x5eb410[_0xd851('0x43')]=_[_0xd851('0x44')](_0x5eb410['model'],_0x5eb410['query']);_0x292771[_0xd851('0x46')]=_[_0xd851('0x44')](_0x5eb410[_0xd851('0x45')],qs[_0xd851('0x47')](_0xf3360a[_0xd851('0x42')][_0xd851('0x47')]));_0x292771['attributes']=_0x292771[_0xd851('0x46')][_0xd851('0x54')]?_0x292771[_0xd851('0x46')]:_0x5eb410[_0xd851('0x45')];_0x292771['order']=qs[_0xd851('0x4a')](_0xf3360a[_0xd851('0x42')]['sort']);_0x292771[_0xd851('0x4b')]=qs[_0xd851('0x43')](_[_0xd851('0x68')](_0xf3360a[_0xd851('0x42')],_0x5eb410[_0xd851('0x43')]));if(_0xf3360a[_0xd851('0x42')]['filter']){_0x292771[_0xd851('0x4b')]=_[_0xd851('0x4e')](_0x292771['where'],{'$or':_[_0xd851('0x3d')](_0x292771['attributes'],function(_0x1ef810){var _0x1603c1={};_0x1603c1[_0x1ef810]={'$like':'%'+_0xf3360a[_0xd851('0x42')][_0xd851('0x4c')]+'%'};return _0x1603c1;})});}_0x292771=_[_0xd851('0x4e')]({},_0x292771,_0xf3360a[_0xd851('0x4f')]);return _0x2c0857[_0xd851('0xa7')](_0x292771);}})[_0xd851('0x22')](function(_0x15660e){if(_0x15660e){_0x358f16=_0x15660e[_0xd851('0x54')];if(!_0xf3360a[_0xd851('0x42')]['hasOwnProperty'](_0xd851('0x48'))){_0x292771[_0xd851('0x33')]=qs[_0xd851('0x33')](_0xf3360a[_0xd851('0x42')][_0xd851('0x33')]);_0x292771[_0xd851('0x31')]=qs[_0xd851('0x31')](_0xf3360a[_0xd851('0x42')][_0xd851('0x31')]);}return _0x2c0857['getApplications'](_0x292771);}})[_0xd851('0x22')](function(_0x26ea15){if(_0x26ea15){return _0x26ea15?{'count':_0x358f16,'rows':_0x26ea15}:null;}})[_0xd851('0x22')](respondWithResult(_0x36636b,null))['catch'](handleError(_0x36636b,null));};exports[_0xd851('0xa8')]=function(_0x27a7d0,_0x3ca624,_0x1b3858){var _0x38a63b={'raw':![],'where':{}};var _0x59513d={};var _0x563a96={'count':0x0,'rows':[]};return db[_0xd851('0x3e')][_0xd851('0x66')]({'where':{'id':_0x27a7d0[_0xd851('0x60')]['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x3ca624,null))[_0xd851('0x22')](function(_0xaa92ca){if(_0xaa92ca){_0x59513d[_0xd851('0x45')]=_[_0xd851('0x53')](db[_0xd851('0x8d')][_0xd851('0x67')]);_0x59513d[_0xd851('0x42')]=_[_0xd851('0x53')](_0x27a7d0[_0xd851('0x42')]);_0x59513d['filters']=_[_0xd851('0x44')](_0x59513d[_0xd851('0x45')],_0x59513d[_0xd851('0x42')]);_0x38a63b['attributes']=_[_0xd851('0x44')](_0x59513d['model'],qs['fields'](_0x27a7d0[_0xd851('0x42')][_0xd851('0x47')]));_0x38a63b[_0xd851('0x46')]=_0x38a63b[_0xd851('0x46')][_0xd851('0x54')]?_0x38a63b['attributes']:_0x59513d['model'];if(!_0x27a7d0[_0xd851('0x42')][_0xd851('0x6c')](_0xd851('0x48'))){_0x38a63b[_0xd851('0x33')]=qs[_0xd851('0x33')](_0x27a7d0[_0xd851('0x42')][_0xd851('0x33')]);_0x38a63b[_0xd851('0x31')]=qs['offset'](_0x27a7d0['query'][_0xd851('0x31')]);}_0x38a63b[_0xd851('0x49')]=qs[_0xd851('0x4a')](_0x27a7d0[_0xd851('0x42')][_0xd851('0x4a')]);_0x38a63b['where']=qs['filters'](_['pick'](_0x27a7d0[_0xd851('0x42')],_0x59513d[_0xd851('0x43')]));_0x38a63b[_0xd851('0x4b')]['OpenchannelAccountId']=_0xaa92ca['id'];if(_0x27a7d0[_0xd851('0x42')][_0xd851('0x4c')]){_0x38a63b[_0xd851('0x4b')]=_[_0xd851('0x4e')](_0x38a63b['where'],{'$or':_[_0xd851('0x3d')](_0x38a63b[_0xd851('0x46')],function(_0x328eaa){var _0x5bb7a2={};_0x5bb7a2[_0x328eaa]={'$like':'%'+_0x27a7d0[_0xd851('0x42')][_0xd851('0x4c')]+'%'};return _0x5bb7a2;})});}_0x38a63b=_[_0xd851('0x4e')]({},_0x38a63b,_0x27a7d0['options']);return db['OpenchannelInteraction']['count']({'where':_0x38a63b[_0xd851('0x4b')]})[_0xd851('0x22')](function(_0x50ea35){_0x563a96['count']=_0x50ea35;if(_0x27a7d0[_0xd851('0x42')][_0xd851('0x50')]){_0x38a63b[_0xd851('0x51')]=[{'model':db[_0xd851('0x70')],'as':_0xd851('0xa9'),'required':![]},{'model':db['User'],'as':_0xd851('0xaa'),'attributes':[_0xd851('0x39'),_0xd851('0xab'),_0xd851('0xac')],'required':![]},{'model':db[_0xd851('0xad')],'as':_0xd851('0xae'),'attributes':['id',_0xd851('0x39'),_0xd851('0xaf')],'where':_0x27a7d0[_0xd851('0x42')][_0xd851('0xb0')]?{'id':_0x27a7d0[_0xd851('0x42')]['tag']}:undefined,'required':_0x27a7d0[_0xd851('0x42')][_0xd851('0xb0')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xd851('0xb1')](_0x38a63b);})['then'](function(_0x30a5ed){_0x563a96[_0xd851('0x6e')]=_0x30a5ed;return _0x563a96;});}})[_0xd851('0x22')](respondWithFilteredResult(_0x3ca624,_0x38a63b))[_0xd851('0x2c')](handleError(_0x3ca624,null));};exports[_0xd851('0xb2')]=function(_0x16a9b1,_0x562c16,_0x33ce21){return db[_0xd851('0x3e')]['find']({'where':{'id':_0x16a9b1[_0xd851('0x60')]['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x562c16,null))[_0xd851('0x22')](function(_0x1f2dbd){if(_0x1f2dbd){return _0x1f2dbd['addAgents'](_0x16a9b1['body'][_0xd851('0x6a')],_['omit'](_0x16a9b1[_0xd851('0x57')],[_0xd851('0x6a'),'id'])||{})[_0xd851('0x90')](function(_0x3b81cc){for(var _0x16bd66=0x0;_0x16bd66<_0x16a9b1['body'][_0xd851('0x6a')][_0xd851('0x54')];_0x16bd66+=0x1){socket[_0xd851('0xb3')](_0xd851('0xb4'),{'UserId':_0x16a9b1[_0xd851('0x57')][_0xd851('0x6a')][_0x16bd66],'OpenchannelAccountId':_0x16a9b1[_0xd851('0x60')]['id']});}return _0x3b81cc;});}})['then'](respondWithResult(_0x562c16,null))[_0xd851('0x2c')](handleError(_0x562c16,null));};exports[_0xd851('0xb5')]=function(_0x18d8d1,_0x1e8e77,_0x18f38e){return db[_0xd851('0x3e')][_0xd851('0x55')]({'where':{'id':_0x18d8d1['params']['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x1e8e77,null))['then'](function(_0x20277f){if(_0x20277f){return _0x20277f[_0xd851('0xb5')](_0x18d8d1['query'][_0xd851('0x6a')])[_0xd851('0x22')](function(){if(_['isArray'](_0x18d8d1[_0xd851('0x42')][_0xd851('0x6a')])){for(var _0x142438=0x0;_0x142438<_0x18d8d1[_0xd851('0x42')][_0xd851('0x6a')][_0xd851('0x54')];_0x142438+=0x1){socket['emit'](_0xd851('0xb6'),{'UserId':Number(_0x18d8d1['query'][_0xd851('0x6a')][_0x142438]),'OpenchannelAccountId':Number(_0x18d8d1[_0xd851('0x60')]['id'])});}}else{socket[_0xd851('0xb3')](_0xd851('0xb6'),{'UserId':Number(_0x18d8d1[_0xd851('0x42')][_0xd851('0x6a')]),'OpenchannelAccountId':Number(_0x18d8d1[_0xd851('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x1e8e77,null))[_0xd851('0x2c')](handleError(_0x1e8e77,null));};exports[_0xd851('0xb7')]=function(_0x4ab5c7,_0x223ca9,_0x4c366d){var _0x215780={};var _0x433f6a={};var _0x2eeede;var _0x597507;return db[_0xd851('0x3e')][_0xd851('0x66')]({'where':{'id':_0x4ab5c7[_0xd851('0x60')]['id']}})['then'](handleEntityNotFound(_0x223ca9,null))[_0xd851('0x22')](function(_0x29bd0d){if(_0x29bd0d){_0x2eeede=_0x29bd0d;_0x433f6a['model']=_[_0xd851('0x53')](db[_0xd851('0x9b')][_0xd851('0x67')]);_0x433f6a['query']=_[_0xd851('0x53')](_0x4ab5c7[_0xd851('0x42')]);_0x433f6a[_0xd851('0x43')]=_['intersection'](_0x433f6a[_0xd851('0x45')],_0x433f6a['query']);_0x215780['attributes']=_[_0xd851('0x44')](_0x433f6a[_0xd851('0x45')],qs[_0xd851('0x47')](_0x4ab5c7['query'][_0xd851('0x47')]));_0x215780['attributes']=_0x215780['attributes'][_0xd851('0x54')]?_0x215780[_0xd851('0x46')]:_0x433f6a[_0xd851('0x45')];_0x215780[_0xd851('0x49')]=qs['sort'](_0x4ab5c7['query'][_0xd851('0x4a')]);_0x215780[_0xd851('0x4b')]=qs[_0xd851('0x43')](_[_0xd851('0x68')](_0x4ab5c7['query'],_0x433f6a[_0xd851('0x43')]));if(_0x4ab5c7[_0xd851('0x42')][_0xd851('0x4c')]){_0x215780[_0xd851('0x4b')]=_[_0xd851('0x4e')](_0x215780[_0xd851('0x4b')],{'$or':_[_0xd851('0x3d')](_0x215780[_0xd851('0x46')],function(_0x3a6e28){var _0x24ce95={};_0x24ce95[_0x3a6e28]={'$like':'%'+_0x4ab5c7['query'][_0xd851('0x4c')]+'%'};return _0x24ce95;})});}_0x215780=_['merge']({},_0x215780,_0x4ab5c7['options']);return _0x2eeede['getAgents'](_0x215780);}})[_0xd851('0x22')](function(_0x352436){if(_0x352436){_0x597507=_0x352436[_0xd851('0x54')];if(!_0x4ab5c7[_0xd851('0x42')][_0xd851('0x6c')](_0xd851('0x48'))){_0x215780[_0xd851('0x33')]=qs[_0xd851('0x33')](_0x4ab5c7[_0xd851('0x42')][_0xd851('0x33')]);_0x215780[_0xd851('0x31')]=qs[_0xd851('0x31')](_0x4ab5c7[_0xd851('0x42')]['offset']);}return _0x2eeede[_0xd851('0xb7')](_0x215780);}})[_0xd851('0x22')](function(_0x299445){if(_0x299445){return _0x299445?{'count':_0x597507,'rows':_0x299445}:null;}})[_0xd851('0x22')](respondWithResult(_0x223ca9,null))[_0xd851('0x2c')](handleError(_0x223ca9,null));};exports[_0xd851('0x3a')]=function(_0x4f4637,_0x58cff7,_0xf666a6){var _0x526519,_0x2aa05d,_0x59834f;if(_[_0xd851('0x78')](_0x4f4637[_0xd851('0x57')][_0xd851('0x57')])||_0x4f4637[_0xd851('0x57')][_0xd851('0x57')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd851('0x78')](_0x4f4637[_0xd851('0x57')]['to'])){}_0x526519=_0x4f4637[_0xd851('0x57')]['to'];return db[_0xd851('0x3e')][_0xd851('0x66')]({'where':{'id':_0x4f4637[_0xd851('0x60')]['id']}})['then'](handleEntityNotFound(_0x58cff7,null))['then'](function(_0x3412b5){if(_0x3412b5){return db[_0xd851('0x3e')][_0xd851('0x55')]({'where':{'id':_0x3412b5['id']},'include':[{'model':db[_0xd851('0x80')],'as':'List','include':[{'model':db[_0xd851('0x70')],'as':_0xd851('0x81'),'where':{[_0x3412b5[_0xd851('0x7b')]]:_0x526519},'limit':0x1,'order':[['updatedAt',_0xd851('0x82')]]}]}]})[_0xd851('0x22')](handleEntityNotFound(_0x58cff7,null))[_0xd851('0x22')](function(_0x5eb28b){if(_0x5eb28b&&_0x5eb28b[_0xd851('0x85')]){_0x2aa05d=_0x5eb28b['get']({'plain':!![]});if(_0x2aa05d[_0xd851('0x85')]&&_0x2aa05d['List']['Contacts']['length']){return _0x2aa05d[_0xd851('0x85')][_0xd851('0x81')][0x0];}return db[_0xd851('0x70')][_0xd851('0x56')](_[_0xd851('0x19')](_0x4f4637['body'],{'firstName':_0x526519,[_0x5eb28b[_0xd851('0x7b')]]:_0x526519,'phone':_0x526519,'ListId':_0x2aa05d[_0xd851('0x77')]}));}})[_0xd851('0x22')](handleEntityNotFound(_0x58cff7,null))[_0xd851('0x22')](function(_0x5cb074){if(_0x5cb074){_0x59834f=_0x5cb074;return db[_0xd851('0x8d')][_0xd851('0x55')]({'where':{'ContactId':_0x59834f['id'],'closed':![],'OpenchannelAccountId':_0x2aa05d['id']}})['then'](function(_0x4d9430){if(_0x4d9430){return[_0x4d9430,![]];}return db[_0xd851('0x8d')][_0xd851('0x56')]({'UserId':_0x4f4637[_0xd851('0x59')]['id'],'ContactId':_0x59834f['id'],'OpenchannelAccountId':_0x2aa05d['id'],'lastMsgDirection':_0xd851('0xb8'),'Messages':[_[_0xd851('0x4e')](_0x4f4637[_0xd851('0x57')],{'read':![],'body':_0x4f4637[_0xd851('0x57')][_0xd851('0x57')],'OpenchannelAccountId':_0x2aa05d['id'],'UserId':_0x4f4637[_0xd851('0x59')]['id'],'ContactId':_0x59834f['id']})]},{'include':[{'model':db[_0xd851('0x98')],'as':_0xd851('0xb9')}]})[_0xd851('0x22')](function(_0x43f705){return[_0x43f705,!![]];});});}})['spread'](function(_0x4daf58,_0x53cd26){if(_0x53cd26){return _0x4daf58;}return db['OpenchannelMessage']['create'](_['merge'](_0x4f4637[_0xd851('0x57')],{'read':![],'body':_0x4f4637[_0xd851('0x57')][_0xd851('0x57')],'OpenchannelAccountId':_0x2aa05d['id'],'OpenchannelInteractionId':_0x4daf58['id'],'UserId':_0x4f4637[_0xd851('0x59')]['id'],'ContactId':_0x59834f['id']}))[_0xd851('0x22')](function(_0x5e323a){_0x4daf58[_0xd851('0xba')][_0xd851('0xb9')]=[];_0x4daf58[_0xd851('0xba')][_0xd851('0xb9')]['push'](_0x5e323a['dataValues']);return _0x4daf58;});});}})[_0xd851('0x22')](respondWithResult(_0x58cff7,null))[_0xd851('0x2c')](handleError(_0x58cff7,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index bdddf96..e8ac821 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 _0x961c=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4e837a,_0x272073){var _0x55735b=function(_0x3baaf8){while(--_0x3baaf8){_0x4e837a['push'](_0x4e837a['shift']());}};_0x55735b(++_0x272073);}(_0x961c,0x169));var _0xc961=function(_0x344a6b,_0x30b1eb){_0x344a6b=_0x344a6b-0x0;var _0xffab66=_0x961c[_0x344a6b];return _0xffab66;};'use strict';var EventEmitter=require(_0xc961('0x0'));var OpenchannelAccount=require(_0xc961('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xc961('0x2')](0x0);var events={'afterCreate':_0xc961('0x3'),'afterUpdate':_0xc961('0x4'),'afterDestroy':_0xc961('0x5')};function emitEvent(_0x139828){return function(_0x5e80a5,_0x46d1e8,_0x307118){OpenchannelAccountEvents[_0xc961('0x6')](_0x139828+':'+_0x5e80a5['id'],_0x5e80a5);OpenchannelAccountEvents['emit'](_0x139828,_0x5e80a5);_0x307118(null);};}for(var e in events){if(events[_0xc961('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xc961('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x18ba=['hasOwnProperty','hook','events','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x3823e7,_0x3911a6){var _0x43df7a=function(_0x4e0624){while(--_0x4e0624){_0x3823e7['push'](_0x3823e7['shift']());}};_0x43df7a(++_0x3911a6);}(_0x18ba,0x14f));var _0xa18b=function(_0x1e886c,_0x2d1e9c){_0x1e886c=_0x1e886c-0x0;var _0x4dfd89=_0x18ba[_0x1e886c];return _0x4dfd89;};'use strict';var EventEmitter=require(_0xa18b('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xa18b('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xa18b('0x2')](0x0);var events={'afterCreate':_0xa18b('0x3'),'afterUpdate':_0xa18b('0x4'),'afterDestroy':_0xa18b('0x5')};function emitEvent(_0xda17b9){return function(_0x4a1bf0,_0x27f6d7,_0x5385fd){OpenchannelAccountEvents[_0xa18b('0x6')](_0xda17b9+':'+_0x4a1bf0['id'],_0x4a1bf0);OpenchannelAccountEvents[_0xa18b('0x6')](_0xda17b9,_0x4a1bf0);_0x5385fd(null);};}for(var e in events){if(events[_0xa18b('0x7')](e)){var event=events[e];OpenchannelAccount[_0xa18b('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index a1c4659..4996a0b 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 _0x8906=['rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0x8906,0x179));var _0x6890=function(_0x254f92,_0x209f50){_0x254f92=_0x254f92-0x0;var _0x3a63d0=_0x8906[_0x254f92];return _0x3a63d0;};'use strict';var _=require(_0x6890('0x0'));var util=require(_0x6890('0x1'));var logger=require(_0x6890('0x2'))(_0x6890('0x3'));var moment=require(_0x6890('0x4'));var BPromise=require(_0x6890('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6890('0x6'));var rimraf=require(_0x6890('0x7'));var config=require(_0x6890('0x8'));var attributes=require(_0x6890('0x9'));module[_0x6890('0xa')]=function(_0x48fd33,_0x4f7a2e){return _0x48fd33[_0x6890('0xb')]('OpenchannelAccount',attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa753=['request-promise','path','rimraf','./openchannelAccount.attributes','exports','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1c38e5,_0x2d5a27){var _0x138462=function(_0x34362a){while(--_0x34362a){_0x1c38e5['push'](_0x1c38e5['shift']());}};_0x138462(++_0x2d5a27);}(_0xa753,0xa3));var _0x3a75=function(_0x33a3c1,_0x2feaa5){_0x33a3c1=_0x33a3c1-0x0;var _0x405063=_0xa753[_0x33a3c1];return _0x405063;};'use strict';var _=require(_0x3a75('0x0'));var util=require(_0x3a75('0x1'));var logger=require(_0x3a75('0x2'))('api');var moment=require(_0x3a75('0x3'));var BPromise=require(_0x3a75('0x4'));var rp=require(_0x3a75('0x5'));var fs=require('fs');var path=require(_0x3a75('0x6'));var rimraf=require(_0x3a75('0x7'));var config=require('../../config/environment');var attributes=require(_0x3a75('0x8'));module[_0x3a75('0x9')]=function(_0x4e3db4,_0x2af483){return _0x4e3db4['define'](_0x3a75('0xa'),attributes,{'tableName':_0x3a75('0xb'),'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 88abd92..eac99ed 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 _0x5f9e=['socket.io-emitter','redis','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults'];(function(_0x28ab59,_0x4bd86d){var _0x17078c=function(_0x199d7b){while(--_0x199d7b){_0x28ab59['push'](_0x28ab59['shift']());}};_0x17078c(++_0x4bd86d);}(_0x5f9e,0x167));var _0xe5f9=function(_0xefdc1c,_0x10f40b){_0xefdc1c=_0xefdc1c-0x0;var _0x48581c=_0x5f9e[_0xefdc1c];return _0x48581c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe5f9('0x0'));var rs=require(_0xe5f9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5f9('0x2'))['db'];var utils=require(_0xe5f9('0x3'));var logger=require(_0xe5f9('0x4'))(_0xe5f9('0x5'));var config=require(_0xe5f9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe5f9('0x7')]['http']({'port':0x232a});config['redis']=_[_0xe5f9('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe5f9('0x9'))(new Redis(config[_0xe5f9('0xa')]));require(_0xe5f9('0xb'))[_0xe5f9('0xc')](socket);function respondWithRpcPromise(_0x40ef6f,_0x15cc68,_0x5d1617){return new BPromise(function(_0x440769,_0x4be0d0){return client[_0xe5f9('0xd')](_0x40ef6f,_0x5d1617)[_0xe5f9('0xe')](function(_0x49c86a){logger['info'](_0xe5f9('0xf'),_0x15cc68,_0xe5f9('0x10'));logger[_0xe5f9('0x11')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x15cc68,'request\x20sent',JSON['stringify'](_0x49c86a));if(_0x49c86a[_0xe5f9('0x12')]){if(_0x49c86a[_0xe5f9('0x12')][_0xe5f9('0x13')]===0x1f4){logger[_0xe5f9('0x12')](_0xe5f9('0xf'),_0x15cc68,_0x49c86a[_0xe5f9('0x12')][_0xe5f9('0x14')]);return _0x4be0d0(_0x49c86a[_0xe5f9('0x12')]['message']);}logger[_0xe5f9('0x12')](_0xe5f9('0xf'),_0x15cc68,_0x49c86a[_0xe5f9('0x12')][_0xe5f9('0x14')]);return _0x440769(_0x49c86a['error'][_0xe5f9('0x14')]);}else{logger[_0xe5f9('0x15')](_0xe5f9('0xf'),_0x15cc68,'request\x20sent');_0x440769(_0x49c86a['result']['message']);}})[_0xe5f9('0x16')](function(_0x1e8c68){logger[_0xe5f9('0x12')](_0xe5f9('0xf'),_0x15cc68,_0x1e8c68);_0x4be0d0(_0x1e8c68);});});} \ No newline at end of file +var _0x4520=['OpenchannelAccount,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5682d9,_0x23cc44){var _0x556672=function(_0xd111af){while(--_0xd111af){_0x5682d9['push'](_0x5682d9['shift']());}};_0x556672(++_0x23cc44);}(_0x4520,0x98));var _0x0452=function(_0x491e60,_0x1f93fa){_0x491e60=_0x491e60-0x0;var _0x160591=_0x4520[_0x491e60];return _0x160591;};'use strict';var _=require(_0x0452('0x0'));var util=require(_0x0452('0x1'));var moment=require(_0x0452('0x2'));var BPromise=require(_0x0452('0x3'));var rs=require(_0x0452('0x4'));var fs=require('fs');var Redis=require(_0x0452('0x5'));var db=require(_0x0452('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0452('0x7'));var config=require(_0x0452('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0452('0x9')]({'port':0x232a});config[_0x0452('0xa')]=_[_0x0452('0xb')](config[_0x0452('0xa')],{'host':_0x0452('0xc'),'port':0x18eb});var socket=require(_0x0452('0xd'))(new Redis(config[_0x0452('0xa')]));require(_0x0452('0xe'))['register'](socket);function respondWithRpcPromise(_0x1e2f46,_0x52b0cd,_0x33fafc){return new BPromise(function(_0x2d43c3,_0x120cb6){return client['request'](_0x1e2f46,_0x33fafc)[_0x0452('0xf')](function(_0x139f0f){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x52b0cd,_0x0452('0x10'));logger[_0x0452('0x11')](_0x0452('0x12'),_0x52b0cd,_0x0452('0x10'),JSON[_0x0452('0x13')](_0x139f0f));if(_0x139f0f[_0x0452('0x14')]){if(_0x139f0f['error'][_0x0452('0x15')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x52b0cd,_0x139f0f[_0x0452('0x14')]['message']);return _0x120cb6(_0x139f0f[_0x0452('0x14')][_0x0452('0x16')]);}logger['error'](_0x0452('0x17'),_0x52b0cd,_0x139f0f[_0x0452('0x14')][_0x0452('0x16')]);return _0x2d43c3(_0x139f0f['error'][_0x0452('0x16')]);}else{logger['info'](_0x0452('0x17'),_0x52b0cd,_0x0452('0x10'));_0x2d43c3(_0x139f0f[_0x0452('0x18')][_0x0452('0x16')]);}})['catch'](function(_0x683364){logger['error'](_0x0452('0x17'),_0x52b0cd,_0x683364);_0x120cb6(_0x683364);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 5899386..55c560a 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 _0xf566=['save','remove','update','register','length','openchannelAccount:'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0xf566,0xc0));var _0x6f56=function(_0x115d1f,_0xc8262){_0x115d1f=_0x115d1f-0x0;var _0x357a9e=_0xf566[_0x115d1f];return _0x357a9e;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x6f56('0x0'),_0x6f56('0x1'),_0x6f56('0x2')];function createListener(_0x1e1708,_0x304180){return function(_0x3a9762){_0x304180['emit'](_0x1e1708,_0x3a9762);};}function removeListener(_0x4c068c,_0x5d13b2){return function(){OpenchannelAccountEvents['removeListener'](_0x4c068c,_0x5d13b2);};}exports[_0x6f56('0x3')]=function(_0x581bcd){for(var _0x38f1e1=0x0,_0x33cda4=events[_0x6f56('0x4')];_0x38f1e1<_0x33cda4;_0x38f1e1++){var _0xc67867=events[_0x38f1e1];var _0xceec78=createListener(_0x6f56('0x5')+_0xc67867,_0x581bcd);OpenchannelAccountEvents['on'](_0xc67867,_0xceec78);}}; \ No newline at end of file +var _0x0d7c=['update','emit','remove'];(function(_0x59bd64,_0x237f2b){var _0x378c0e=function(_0x24e2be){while(--_0x24e2be){_0x59bd64['push'](_0x59bd64['shift']());}};_0x378c0e(++_0x237f2b);}(_0x0d7c,0x1e5));var _0xc0d7=function(_0x57a50d,_0x2871f8){_0x57a50d=_0x57a50d-0x0;var _0x1b25b3=_0x0d7c[_0x57a50d];return _0x1b25b3;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xc0d7('0x0'),_0xc0d7('0x1')];function createListener(_0x53e17f,_0x549af7){return function(_0x49460e){_0x549af7[_0xc0d7('0x2')](_0x53e17f,_0x49460e);};}function removeListener(_0x41c9fe,_0x1bc4ab){return function(){OpenchannelAccountEvents['removeListener'](_0x41c9fe,_0x1bc4ab);};}exports['register']=function(_0x1dcffb){for(var _0x285f18=0x0,_0x1b47d9=events['length'];_0x285f18<_0x1b47d9;_0x285f18++){var _0x755318=events[_0x285f18];var _0x5c49a3=createListener('openchannelAccount:'+_0x755318,_0x1dcffb);OpenchannelAccountEvents['on'](_0x755318,_0x5c49a3);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 99b2839..7aa72e1 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 _0x38f8=['isAuthenticated','index','get','/:id','show','post','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller'];(function(_0x2669d1,_0x22ba27){var _0x819072=function(_0x16ed37){while(--_0x16ed37){_0x2669d1['push'](_0x2669d1['shift']());}};_0x819072(++_0x22ba27);}(_0x38f8,0xc8));var _0x838f=function(_0x2510d6,_0x130229){_0x2510d6=_0x2510d6-0x0;var _0x5854d2=_0x38f8[_0x2510d6];return _0x5854d2;};'use strict';var multer=require(_0x838f('0x0'));var util=require(_0x838f('0x1'));var path=require('path');var timeout=require(_0x838f('0x2'));var express=require('express');var router=express[_0x838f('0x3')]();var fs_extra=require(_0x838f('0x4'));var auth=require(_0x838f('0x5'));var interaction=require(_0x838f('0x6'));var config=require(_0x838f('0x7'));var controller=require(_0x838f('0x8'));router['get']('/',auth[_0x838f('0x9')](),controller[_0x838f('0xa')]);router[_0x838f('0xb')](_0x838f('0xc'),auth[_0x838f('0x9')](),controller[_0x838f('0xd')]);router[_0x838f('0xe')]('/',auth[_0x838f('0x9')](),controller['create']);router['put'](_0x838f('0xc'),auth[_0x838f('0x9')](),controller[_0x838f('0xf')]);router[_0x838f('0x10')](_0x838f('0xc'),auth[_0x838f('0x9')](),controller[_0x838f('0x11')]);module[_0x838f('0x12')]=router; \ No newline at end of file +var _0xc4f9=['post','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id'];(function(_0x15d13e,_0x19e126){var _0x2ee674=function(_0x5c2f4b){while(--_0x5c2f4b){_0x15d13e['push'](_0x15d13e['shift']());}};_0x2ee674(++_0x19e126);}(_0xc4f9,0xa0));var _0x9c4f=function(_0x106c90,_0x3ae3c9){_0x106c90=_0x106c90-0x0;var _0x332a2f=_0xc4f9[_0x106c90];return _0x332a2f;};'use strict';var multer=require(_0x9c4f('0x0'));var util=require(_0x9c4f('0x1'));var path=require(_0x9c4f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9c4f('0x3')]();var fs_extra=require(_0x9c4f('0x4'));var auth=require(_0x9c4f('0x5'));var interaction=require(_0x9c4f('0x6'));var config=require(_0x9c4f('0x7'));var controller=require('./openchannelApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9c4f('0x8')]);router['get'](_0x9c4f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x9c4f('0xa')]('/',auth[_0x9c4f('0xb')](),controller['create']);router[_0x9c4f('0xc')](_0x9c4f('0x9'),auth['isAuthenticated'](),controller[_0x9c4f('0xd')]);router[_0x9c4f('0xe')](_0x9c4f('0x9'),auth[_0x9c4f('0xb')](),controller[_0x9c4f('0xf')]);module[_0x9c4f('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 9135652..54e99dc 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 _0xef3c=['TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x224dda,_0x16d0f9){var _0x2987ac=function(_0x3b1033){while(--_0x3b1033){_0x224dda['push'](_0x224dda['shift']());}};_0x2987ac(++_0x16d0f9);}(_0xef3c,0x19d));var _0xcef3=function(_0x2da1e9,_0x2935cc){_0x2da1e9=_0x2da1e9-0x0;var _0x3d69c3=_0xef3c[_0x2da1e9];return _0x3d69c3;};'use strict';var Sequelize=require(_0xcef3('0x0'));module[_0xcef3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xcef3('0x2')]()},'description':{'type':Sequelize[_0xcef3('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xcef3('0x4')}}; \ No newline at end of file +var _0xaf7e=['INTEGER','STRING','TEXT','*,*,*,*','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xaf7e,0x14e));var _0xeaf7=function(_0x22cbaf,_0xb623e2){_0x22cbaf=_0x22cbaf-0x0;var _0x294b53=_0xaf7e[_0x22cbaf];return _0x294b53;};'use strict';var Sequelize=require('sequelize');module[_0xeaf7('0x0')]={'priority':{'type':Sequelize[_0xeaf7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xeaf7('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xeaf7('0x3')]()},'description':{'type':Sequelize[_0xeaf7('0x2')]},'interval':{'type':Sequelize[_0xeaf7('0x2')],'defaultValue':_0xeaf7('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 14bd24c..66b06bd 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 _0xf521=['params','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','error','name','send','index','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','OpenchannelApplication','includeAll','include','findAll','catch','show'];(function(_0x313e5e,_0x2aa96c){var _0x327721=function(_0x35e7ac){while(--_0x35e7ac){_0x313e5e['push'](_0x313e5e['shift']());}};_0x327721(++_0x2aa96c);}(_0xf521,0xe3));var _0x1f52=function(_0x3e23fd,_0x324cb8){_0x3e23fd=_0x3e23fd-0x0;var _0x23e70d=_0xf521[_0x3e23fd];return _0x23e70d;};'use strict';var emlformat=require(_0x1f52('0x0'));var rimraf=require(_0x1f52('0x1'));var zipdir=require(_0x1f52('0x2'));var jsonpatch=require(_0x1f52('0x3'));var rp=require(_0x1f52('0x4'));var moment=require(_0x1f52('0x5'));var BPromise=require(_0x1f52('0x6'));var Mustache=require(_0x1f52('0x7'));var util=require('util');var path=require('path');var sox=require(_0x1f52('0x8'));var csv=require(_0x1f52('0x9'));var ejs=require(_0x1f52('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1f52('0xb'));var crypto=require('crypto');var jsforce=require(_0x1f52('0xc'));var deskjs=require(_0x1f52('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1f52('0xe'));var Papa=require(_0x1f52('0xf'));var Redis=require(_0x1f52('0x10'));var authService=require(_0x1f52('0x11'));var qs=require(_0x1f52('0x12'));var as=require(_0x1f52('0x13'));var hardwareService=require(_0x1f52('0x14'));var logger=require(_0x1f52('0x15'))(_0x1f52('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1f52('0x17'));var db=require(_0x1f52('0x18'))['db'];function respondWithStatusCode(_0x2bc072,_0x50b8dc){_0x50b8dc=_0x50b8dc||0xcc;return function(_0x45f7a2){if(_0x45f7a2){return _0x2bc072[_0x1f52('0x19')](_0x50b8dc);}return _0x2bc072[_0x1f52('0x1a')](_0x50b8dc)[_0x1f52('0x1b')]();};}function respondWithResult(_0x139fc3,_0x1f02c4){_0x1f02c4=_0x1f02c4||0xc8;return function(_0x57e738){if(_0x57e738){return _0x139fc3[_0x1f52('0x1a')](_0x1f02c4)[_0x1f52('0x1c')](_0x57e738);}};}function respondWithFilteredResult(_0x8c202f,_0x46a1ef){return function(_0x4b4141){if(_0x4b4141){var _0x5d2094=typeof _0x46a1ef[_0x1f52('0x1d')]===_0x1f52('0x1e')&&typeof _0x46a1ef[_0x1f52('0x1f')]===_0x1f52('0x1e');var _0x479f6f=_0x4b4141['count'];var _0x4f6d55=_0x5d2094?0x0:_0x46a1ef[_0x1f52('0x1d')];var _0x35d98d=_0x5d2094?_0x4b4141[_0x1f52('0x20')]:_0x46a1ef[_0x1f52('0x1d')]+_0x46a1ef['limit'];var _0x5b5c99;if(_0x35d98d>=_0x479f6f){_0x35d98d=_0x479f6f;_0x5b5c99=0xc8;}else{_0x5b5c99=0xce;}_0x8c202f['status'](_0x5b5c99);return _0x8c202f[_0x1f52('0x21')](_0x1f52('0x22'),_0x4f6d55+'-'+_0x35d98d+'/'+_0x479f6f)['json'](_0x4b4141);}return null;};}function patchUpdates(_0x508638){return function(_0x5229f2){try{jsonpatch['apply'](_0x5229f2,_0x508638,!![]);}catch(_0x2bd299){return BPromise[_0x1f52('0x23')](_0x2bd299);}return _0x5229f2['save']();};}function saveUpdates(_0x2ce2a3,_0x5de1a){return function(_0x1acfc8){if(_0x1acfc8){return _0x1acfc8['update'](_0x2ce2a3)['then'](function(_0x551a44){return _0x551a44;});}return null;};}function removeEntity(_0x4c0147,_0x4ed73f){return function(_0x42fc37){if(_0x42fc37){return _0x42fc37[_0x1f52('0x24')]()[_0x1f52('0x25')](function(){_0x4c0147[_0x1f52('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c1af8,_0x576225){return function(_0x2563d8){if(!_0x2563d8){_0x2c1af8[_0x1f52('0x19')](0x194);}return _0x2563d8;};}function handleError(_0x69c54f,_0x3bc083){_0x3bc083=_0x3bc083||0x1f4;return function(_0x13f256){logger[_0x1f52('0x26')](_0x13f256['stack']);if(_0x13f256['name']){delete _0x13f256[_0x1f52('0x27')];}_0x69c54f[_0x1f52('0x1a')](_0x3bc083)[_0x1f52('0x28')](_0x13f256);};}exports[_0x1f52('0x29')]=function(_0x53cf35,_0x49b26b){var _0x24bd30={},_0x545aaf={},_0x47aeb8={'count':0x0,'rows':[]};var _0x1b233e=_['map'](db['OpenchannelApplication']['rawAttributes'],function(_0x54c35f){return{'name':_0x54c35f['fieldName'],'type':_0x54c35f['type'][_0x1f52('0x2a')]};});_0x545aaf[_0x1f52('0x2b')]=_[_0x1f52('0x2c')](_0x1b233e,'name');_0x545aaf[_0x1f52('0x2d')]=_[_0x1f52('0x2e')](_0x53cf35[_0x1f52('0x2d')]);_0x545aaf[_0x1f52('0x2f')]=_['intersection'](_0x545aaf[_0x1f52('0x2b')],_0x545aaf[_0x1f52('0x2d')]);_0x24bd30['attributes']=_[_0x1f52('0x30')](_0x545aaf[_0x1f52('0x2b')],qs[_0x1f52('0x31')](_0x53cf35[_0x1f52('0x2d')]['fields']));_0x24bd30['attributes']=_0x24bd30[_0x1f52('0x32')][_0x1f52('0x33')]?_0x24bd30[_0x1f52('0x32')]:_0x545aaf[_0x1f52('0x2b')];if(!_0x53cf35['query'][_0x1f52('0x34')](_0x1f52('0x35'))){_0x24bd30['limit']=qs[_0x1f52('0x1f')](_0x53cf35[_0x1f52('0x2d')][_0x1f52('0x1f')]);_0x24bd30['offset']=qs[_0x1f52('0x1d')](_0x53cf35[_0x1f52('0x2d')][_0x1f52('0x1d')]);}_0x24bd30[_0x1f52('0x36')]=qs[_0x1f52('0x37')](_0x53cf35[_0x1f52('0x2d')][_0x1f52('0x37')]);_0x24bd30['where']=qs[_0x1f52('0x2f')](_[_0x1f52('0x38')](_0x53cf35[_0x1f52('0x2d')],_0x545aaf['filters']),_0x1b233e);if(_0x53cf35[_0x1f52('0x2d')]['filter']){_0x24bd30[_0x1f52('0x39')]=_[_0x1f52('0x3a')](_0x24bd30[_0x1f52('0x39')],{'$or':_[_0x1f52('0x2c')](_0x1b233e,function(_0x4cc769){if(_0x4cc769[_0x1f52('0x3b')]!==_0x1f52('0x3c')){var _0x305ef5={};_0x305ef5[_0x4cc769[_0x1f52('0x27')]]={'$like':'%'+_0x53cf35[_0x1f52('0x2d')][_0x1f52('0x3d')]+'%'};return _0x305ef5;}})});}_0x24bd30=_['merge']({},_0x24bd30,_0x53cf35[_0x1f52('0x3e')]);var _0x2d410c={'where':_0x24bd30[_0x1f52('0x39')]};return db[_0x1f52('0x3f')][_0x1f52('0x20')](_0x2d410c)[_0x1f52('0x25')](function(_0xd4ae18){_0x47aeb8[_0x1f52('0x20')]=_0xd4ae18;if(_0x53cf35[_0x1f52('0x2d')][_0x1f52('0x40')]){_0x24bd30[_0x1f52('0x41')]=[{'all':!![]}];}return db[_0x1f52('0x3f')][_0x1f52('0x42')](_0x24bd30);})[_0x1f52('0x25')](function(_0x2f4a8d){_0x47aeb8['rows']=_0x2f4a8d;return _0x47aeb8;})[_0x1f52('0x25')](respondWithFilteredResult(_0x49b26b,_0x24bd30))[_0x1f52('0x43')](handleError(_0x49b26b,null));};exports[_0x1f52('0x44')]=function(_0x2e0edd,_0x480703){var _0x15bdfd={'raw':!![],'where':{'id':_0x2e0edd[_0x1f52('0x45')]['id']}},_0x2c241c={};_0x2c241c[_0x1f52('0x2b')]=_[_0x1f52('0x2e')](db[_0x1f52('0x3f')][_0x1f52('0x46')]);_0x2c241c[_0x1f52('0x2d')]=_[_0x1f52('0x2e')](_0x2e0edd[_0x1f52('0x2d')]);_0x2c241c[_0x1f52('0x2f')]=_[_0x1f52('0x30')](_0x2c241c[_0x1f52('0x2b')],_0x2c241c[_0x1f52('0x2d')]);_0x15bdfd[_0x1f52('0x32')]=_[_0x1f52('0x30')](_0x2c241c[_0x1f52('0x2b')],qs[_0x1f52('0x31')](_0x2e0edd[_0x1f52('0x2d')]['fields']));_0x15bdfd[_0x1f52('0x32')]=_0x15bdfd[_0x1f52('0x32')][_0x1f52('0x33')]?_0x15bdfd[_0x1f52('0x32')]:_0x2c241c[_0x1f52('0x2b')];if(_0x2e0edd['query'][_0x1f52('0x40')]){_0x15bdfd['include']=[{'all':!![]}];}_0x15bdfd=_['merge']({},_0x15bdfd,_0x2e0edd[_0x1f52('0x3e')]);return db['OpenchannelApplication']['find'](_0x15bdfd)[_0x1f52('0x25')](handleEntityNotFound(_0x480703,null))['then'](respondWithResult(_0x480703,null))['catch'](handleError(_0x480703,null));};exports[_0x1f52('0x47')]=function(_0x27565c,_0x500905){return db[_0x1f52('0x3f')]['create'](_0x27565c[_0x1f52('0x48')],{})[_0x1f52('0x25')](respondWithResult(_0x500905,0xc9))[_0x1f52('0x43')](handleError(_0x500905,null));};exports['update']=function(_0x508e1f,_0x23120f){if(_0x508e1f['body']['id']){delete _0x508e1f[_0x1f52('0x48')]['id'];}return db[_0x1f52('0x3f')]['find']({'where':{'id':_0x508e1f[_0x1f52('0x45')]['id']}})['then'](handleEntityNotFound(_0x23120f,null))['then'](saveUpdates(_0x508e1f['body'],null))[_0x1f52('0x25')](respondWithResult(_0x23120f,null))[_0x1f52('0x43')](handleError(_0x23120f,null));};exports['destroy']=function(_0x5f8d1e,_0x54faab){return db[_0x1f52('0x3f')][_0x1f52('0x49')]({'where':{'id':_0x5f8d1e['params']['id']}})[_0x1f52('0x25')](handleEntityNotFound(_0x54faab,null))[_0x1f52('0x25')](removeEntity(_0x54faab,null))[_0x1f52('0x43')](handleError(_0x54faab,null));}; \ No newline at end of file +var _0xbc01=['send','index','map','OpenchannelApplication','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name'];(function(_0x1d017e,_0x1ce499){var _0x1facde=function(_0x41df16){while(--_0x41df16){_0x1d017e['push'](_0x1d017e['shift']());}};_0x1facde(++_0x1ce499);}(_0xbc01,0x14c));var _0x1bc0=function(_0x3f6d4f,_0x3d35fa){_0x3f6d4f=_0x3f6d4f-0x0;var _0x58f155=_0xbc01[_0x3f6d4f];return _0x58f155;};'use strict';var emlformat=require(_0x1bc0('0x0'));var rimraf=require(_0x1bc0('0x1'));var zipdir=require(_0x1bc0('0x2'));var jsonpatch=require(_0x1bc0('0x3'));var rp=require(_0x1bc0('0x4'));var moment=require(_0x1bc0('0x5'));var BPromise=require(_0x1bc0('0x6'));var Mustache=require(_0x1bc0('0x7'));var util=require('util');var path=require(_0x1bc0('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1bc0('0x9'));var fs=require('fs');var fs_extra=require(_0x1bc0('0xa'));var _=require(_0x1bc0('0xb'));var squel=require(_0x1bc0('0xc'));var crypto=require('crypto');var jsforce=require(_0x1bc0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1bc0('0xe'));var querystring=require(_0x1bc0('0xf'));var Papa=require(_0x1bc0('0x10'));var Redis=require(_0x1bc0('0x11'));var authService=require(_0x1bc0('0x12'));var qs=require(_0x1bc0('0x13'));var as=require(_0x1bc0('0x14'));var hardwareService=require(_0x1bc0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x1bc0('0x16'));var config=require(_0x1bc0('0x17'));var licenseUtil=require(_0x1bc0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x598bdb,_0x5a8888){_0x5a8888=_0x5a8888||0xcc;return function(_0x2f8465){if(_0x2f8465){return _0x598bdb[_0x1bc0('0x19')](_0x5a8888);}return _0x598bdb[_0x1bc0('0x1a')](_0x5a8888)['end']();};}function respondWithResult(_0x37563e,_0x107025){_0x107025=_0x107025||0xc8;return function(_0x405930){if(_0x405930){return _0x37563e[_0x1bc0('0x1a')](_0x107025)['json'](_0x405930);}};}function respondWithFilteredResult(_0x10db17,_0x510aad){return function(_0x3c1067){if(_0x3c1067){var _0x39a9e6=typeof _0x510aad[_0x1bc0('0x1b')]==='undefined'&&typeof _0x510aad[_0x1bc0('0x1c')]===_0x1bc0('0x1d');var _0x573ef2=_0x3c1067[_0x1bc0('0x1e')];var _0x12618d=_0x39a9e6?0x0:_0x510aad[_0x1bc0('0x1b')];var _0x3b58fb=_0x39a9e6?_0x3c1067['count']:_0x510aad[_0x1bc0('0x1b')]+_0x510aad[_0x1bc0('0x1c')];var _0x3668ba;if(_0x3b58fb>=_0x573ef2){_0x3b58fb=_0x573ef2;_0x3668ba=0xc8;}else{_0x3668ba=0xce;}_0x10db17[_0x1bc0('0x1a')](_0x3668ba);return _0x10db17[_0x1bc0('0x1f')](_0x1bc0('0x20'),_0x12618d+'-'+_0x3b58fb+'/'+_0x573ef2)[_0x1bc0('0x21')](_0x3c1067);}return null;};}function patchUpdates(_0x38a1b9){return function(_0x111fda){try{jsonpatch[_0x1bc0('0x22')](_0x111fda,_0x38a1b9,!![]);}catch(_0x1cbb7d){return BPromise['reject'](_0x1cbb7d);}return _0x111fda[_0x1bc0('0x23')]();};}function saveUpdates(_0x2145ff,_0x116f32){return function(_0x199bd0){if(_0x199bd0){return _0x199bd0[_0x1bc0('0x24')](_0x2145ff)[_0x1bc0('0x25')](function(_0x40ef41){return _0x40ef41;});}return null;};}function removeEntity(_0x2f95ec,_0x557f4a){return function(_0xa1a47d){if(_0xa1a47d){return _0xa1a47d[_0x1bc0('0x26')]()[_0x1bc0('0x25')](function(){_0x2f95ec[_0x1bc0('0x1a')](0xcc)[_0x1bc0('0x27')]();});}};}function handleEntityNotFound(_0x143298,_0x48cb92){return function(_0x1c00b0){if(!_0x1c00b0){_0x143298[_0x1bc0('0x19')](0x194);}return _0x1c00b0;};}function handleError(_0xf59b0e,_0xf78340){_0xf78340=_0xf78340||0x1f4;return function(_0x209e11){logger[_0x1bc0('0x28')](_0x209e11[_0x1bc0('0x29')]);if(_0x209e11[_0x1bc0('0x2a')]){delete _0x209e11['name'];}_0xf59b0e[_0x1bc0('0x1a')](_0xf78340)[_0x1bc0('0x2b')](_0x209e11);};}exports[_0x1bc0('0x2c')]=function(_0x14438c,_0x678acc){var _0x35f42f={},_0x3e25c0={},_0x1e01fe={'count':0x0,'rows':[]};var _0x1bc62a=_[_0x1bc0('0x2d')](db[_0x1bc0('0x2e')]['rawAttributes'],function(_0x6b7e3d){return{'name':_0x6b7e3d['fieldName'],'type':_0x6b7e3d['type'][_0x1bc0('0x2f')]};});_0x3e25c0[_0x1bc0('0x30')]=_[_0x1bc0('0x2d')](_0x1bc62a,_0x1bc0('0x2a'));_0x3e25c0[_0x1bc0('0x31')]=_['keys'](_0x14438c[_0x1bc0('0x31')]);_0x3e25c0[_0x1bc0('0x32')]=_[_0x1bc0('0x33')](_0x3e25c0[_0x1bc0('0x30')],_0x3e25c0[_0x1bc0('0x31')]);_0x35f42f[_0x1bc0('0x34')]=_[_0x1bc0('0x33')](_0x3e25c0[_0x1bc0('0x30')],qs['fields'](_0x14438c[_0x1bc0('0x31')][_0x1bc0('0x35')]));_0x35f42f[_0x1bc0('0x34')]=_0x35f42f[_0x1bc0('0x34')][_0x1bc0('0x36')]?_0x35f42f['attributes']:_0x3e25c0[_0x1bc0('0x30')];if(!_0x14438c['query']['hasOwnProperty']('nolimit')){_0x35f42f[_0x1bc0('0x1c')]=qs[_0x1bc0('0x1c')](_0x14438c[_0x1bc0('0x31')]['limit']);_0x35f42f[_0x1bc0('0x1b')]=qs['offset'](_0x14438c['query'][_0x1bc0('0x1b')]);}_0x35f42f[_0x1bc0('0x37')]=qs[_0x1bc0('0x38')](_0x14438c[_0x1bc0('0x31')][_0x1bc0('0x38')]);_0x35f42f[_0x1bc0('0x39')]=qs[_0x1bc0('0x32')](_['pick'](_0x14438c[_0x1bc0('0x31')],_0x3e25c0[_0x1bc0('0x32')]),_0x1bc62a);if(_0x14438c[_0x1bc0('0x31')][_0x1bc0('0x3a')]){_0x35f42f[_0x1bc0('0x39')]=_['merge'](_0x35f42f[_0x1bc0('0x39')],{'$or':_[_0x1bc0('0x2d')](_0x1bc62a,function(_0x14e599){if(_0x14e599[_0x1bc0('0x3b')]!==_0x1bc0('0x3c')){var _0x4b8ee6={};_0x4b8ee6[_0x14e599[_0x1bc0('0x2a')]]={'$like':'%'+_0x14438c[_0x1bc0('0x31')][_0x1bc0('0x3a')]+'%'};return _0x4b8ee6;}})});}_0x35f42f=_[_0x1bc0('0x3d')]({},_0x35f42f,_0x14438c[_0x1bc0('0x3e')]);var _0x24dbbe={'where':_0x35f42f[_0x1bc0('0x39')]};return db[_0x1bc0('0x2e')][_0x1bc0('0x1e')](_0x24dbbe)['then'](function(_0x3963ea){_0x1e01fe[_0x1bc0('0x1e')]=_0x3963ea;if(_0x14438c[_0x1bc0('0x31')][_0x1bc0('0x3f')]){_0x35f42f[_0x1bc0('0x40')]=[{'all':!![]}];}return db[_0x1bc0('0x2e')][_0x1bc0('0x41')](_0x35f42f);})['then'](function(_0x404048){_0x1e01fe[_0x1bc0('0x42')]=_0x404048;return _0x1e01fe;})[_0x1bc0('0x25')](respondWithFilteredResult(_0x678acc,_0x35f42f))[_0x1bc0('0x43')](handleError(_0x678acc,null));};exports[_0x1bc0('0x44')]=function(_0x45fd30,_0x4c1541){var _0x18a4b9={'raw':!![],'where':{'id':_0x45fd30['params']['id']}},_0x22f8a0={};_0x22f8a0[_0x1bc0('0x30')]=_['keys'](db[_0x1bc0('0x2e')][_0x1bc0('0x45')]);_0x22f8a0['query']=_[_0x1bc0('0x46')](_0x45fd30['query']);_0x22f8a0[_0x1bc0('0x32')]=_[_0x1bc0('0x33')](_0x22f8a0['model'],_0x22f8a0['query']);_0x18a4b9['attributes']=_[_0x1bc0('0x33')](_0x22f8a0[_0x1bc0('0x30')],qs[_0x1bc0('0x35')](_0x45fd30[_0x1bc0('0x31')]['fields']));_0x18a4b9[_0x1bc0('0x34')]=_0x18a4b9[_0x1bc0('0x34')][_0x1bc0('0x36')]?_0x18a4b9['attributes']:_0x22f8a0[_0x1bc0('0x30')];if(_0x45fd30[_0x1bc0('0x31')][_0x1bc0('0x3f')]){_0x18a4b9[_0x1bc0('0x40')]=[{'all':!![]}];}_0x18a4b9=_[_0x1bc0('0x3d')]({},_0x18a4b9,_0x45fd30[_0x1bc0('0x3e')]);return db['OpenchannelApplication'][_0x1bc0('0x47')](_0x18a4b9)[_0x1bc0('0x25')](handleEntityNotFound(_0x4c1541,null))['then'](respondWithResult(_0x4c1541,null))[_0x1bc0('0x43')](handleError(_0x4c1541,null));};exports[_0x1bc0('0x48')]=function(_0x45ce49,_0x2839b7){return db['OpenchannelApplication']['create'](_0x45ce49[_0x1bc0('0x49')],{})[_0x1bc0('0x25')](respondWithResult(_0x2839b7,0xc9))['catch'](handleError(_0x2839b7,null));};exports[_0x1bc0('0x24')]=function(_0x5ab450,_0x42bfee){if(_0x5ab450[_0x1bc0('0x49')]['id']){delete _0x5ab450[_0x1bc0('0x49')]['id'];}return db[_0x1bc0('0x2e')][_0x1bc0('0x47')]({'where':{'id':_0x5ab450[_0x1bc0('0x4a')]['id']}})[_0x1bc0('0x25')](handleEntityNotFound(_0x42bfee,null))[_0x1bc0('0x25')](saveUpdates(_0x5ab450['body'],null))[_0x1bc0('0x25')](respondWithResult(_0x42bfee,null))[_0x1bc0('0x43')](handleError(_0x42bfee,null));};exports['destroy']=function(_0x334573,_0x23deda){return db['OpenchannelApplication'][_0x1bc0('0x47')]({'where':{'id':_0x334573[_0x1bc0('0x4a')]['id']}})[_0x1bc0('0x25')](handleEntityNotFound(_0x23deda,null))[_0x1bc0('0x25')](removeEntity(_0x23deda,null))[_0x1bc0('0x43')](handleError(_0x23deda,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index b8aeac7..5755f69 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 _0xe760=['OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','define'];(function(_0x4ce69b,_0x5ce999){var _0x21bb77=function(_0x291cc2){while(--_0x291cc2){_0x4ce69b['push'](_0x4ce69b['shift']());}};_0x21bb77(++_0x5ce999);}(_0xe760,0x1d1));var _0x0e76=function(_0x52b408,_0x22fe7e){_0x52b408=_0x52b408-0x0;var _0x403deb=_0xe760[_0x52b408];return _0x403deb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0e76('0x0'));var moment=require(_0x0e76('0x1'));var BPromise=require(_0x0e76('0x2'));var rp=require(_0x0e76('0x3'));var fs=require('fs');var path=require(_0x0e76('0x4'));var rimraf=require('rimraf');var config=require(_0x0e76('0x5'));var attributes=require(_0x0e76('0x6'));module['exports']=function(_0x141c77,_0x15a5c5){return _0x141c77[_0x0e76('0x7')](_0x0e76('0x8'),attributes,{'tableName':_0x0e76('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0e76('0xa')});}; \ No newline at end of file +var _0xfe6e=['openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define'];(function(_0x4a8858,_0x42b1ef){var _0x86cbb5=function(_0xdc5b04){while(--_0xdc5b04){_0x4a8858['push'](_0x4a8858['shift']());}};_0x86cbb5(++_0x42b1ef);}(_0xfe6e,0x161));var _0xefe6=function(_0x35549a,_0x282ba6){_0x35549a=_0x35549a-0x0;var _0x20579b=_0xfe6e[_0x35549a];return _0x20579b;};'use strict';var _=require(_0xefe6('0x0'));var util=require(_0xefe6('0x1'));var logger=require(_0xefe6('0x2'))(_0xefe6('0x3'));var moment=require('moment');var BPromise=require(_0xefe6('0x4'));var rp=require(_0xefe6('0x5'));var fs=require('fs');var path=require(_0xefe6('0x6'));var rimraf=require('rimraf');var config=require(_0xefe6('0x7'));var attributes=require(_0xefe6('0x8'));module[_0xefe6('0x9')]=function(_0x2f550f,_0x27058f){return _0x2f550f[_0xefe6('0xa')]('OpenchannelApplication',attributes,{'tableName':_0xefe6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xefe6('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 6e90854..6782ebf 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 _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x59350a,_0xb45aa5){var _0x4604ef=function(_0x1d0641){while(--_0x1d0641){_0x59350a['push'](_0x59350a['shift']());}};_0x4604ef(++_0xb45aa5);}(_0xb10b,0x12a));var _0xbb10=function(_0x556634,_0x520958){_0x556634=_0x556634-0x0;var _0x4429fd=_0xb10b[_0x556634];return _0x4429fd;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x2e1ff5,_0x210b04){var _0x6e071e=function(_0x2bfa0c){while(--_0x2bfa0c){_0x2e1ff5['push'](_0x2e1ff5['shift']());}};_0x6e071e(++_0x210b04);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0xb10b[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index ba8e443..5eec3c0 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 _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x4226d6,_0x3864ca){var _0x19655b=function(_0x1d43a1){while(--_0x1d43a1){_0x4226d6['push'](_0x4226d6['shift']());}};_0x19655b(++_0x3864ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file +var _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('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 6769d19..9b7db08 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 _0xd66d=['out','sequelize','BOOLEAN','STRING','DATE','ENUM'];(function(_0x4e8fed,_0x21e300){var _0x3372ab=function(_0xaf7092){while(--_0xaf7092){_0x4e8fed['push'](_0x4e8fed['shift']());}};_0x3372ab(++_0x21e300);}(_0xd66d,0x12d));var _0xdd66=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xd66d[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0xdd66('0x0'));module['exports']={'closed':{'type':Sequelize[_0xdd66('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xdd66('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xdd66('0x2')]},'read1stAt':{'type':Sequelize[_0xdd66('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xdd66('0x2')]},'lastMsgAt':{'type':Sequelize[_0xdd66('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xdd66('0x4')]('in',_0xdd66('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xdd66('0x2')]}}; \ No newline at end of file +var _0x01ad=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x1eda8f,_0x96bf2e){var _0x55fa2b=function(_0x36d6b3){while(--_0x36d6b3){_0x1eda8f['push'](_0x1eda8f['shift']());}};_0x55fa2b(++_0x96bf2e);}(_0x01ad,0x168));var _0xd01a=function(_0x4d452c,_0x1e69be){_0x4d452c=_0x4d452c-0x0;var _0x4bed65=_0x01ad[_0x4d452c];return _0x4bed65;};'use strict';var Sequelize=require(_0xd01a('0x0'));module[_0xd01a('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd01a('0x2')]},'disposition':{'type':Sequelize[_0xd01a('0x3')]},'secondDisposition':{'type':Sequelize[_0xd01a('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd01a('0x3')]},'note':{'type':Sequelize[_0xd01a('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xd01a('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xd01a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd01a('0x4')]('in',_0xd01a('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd01a('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 11ac907..d6444de 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 _0x3864=['ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','find','value','having','`\x20>\x200','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','OpenchannelAccountId','createdAt','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IN\x20?','toString','keyBy','merge','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','rows','params','rawAttributes','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','$gte','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','findAll','addTags','setTags','spread','emit','removeTags','unix','join','root','files','server','attachments','transcript-%d-%s.zip','User','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','format','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','createPdfFromHTML','download','log','err','zip-dir','moment','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','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','split','Tags','TagIds','catch','index','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','select','field','color','from','tools_tags','u.id'];(function(_0x18f6da,_0x122756){var _0x1cccbc=function(_0x1ac64b){while(--_0x1ac64b){_0x18f6da['push'](_0x18f6da['shift']());}};_0x1cccbc(++_0x122756);}(_0x3864,0xab));var _0x4386=function(_0x13dd44,_0x34aeb5){_0x13dd44=_0x13dd44-0x0;var _0x5920e2=_0x3864[_0x13dd44];return _0x5920e2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4386('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4386('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x4386('0x2'));var util=require('util');var path=require(_0x4386('0x3'));var sox=require('sox');var csv=require(_0x4386('0x4'));var ejs=require(_0x4386('0x5'));var fs=require('fs');var fs_extra=require(_0x4386('0x6'));var _=require(_0x4386('0x7'));var squel=require(_0x4386('0x8'));var crypto=require(_0x4386('0x9'));var jsforce=require(_0x4386('0xa'));var deskjs=require(_0x4386('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4386('0xc'));var Papa=require(_0x4386('0xd'));var Redis=require(_0x4386('0xe'));var authService=require(_0x4386('0xf'));var qs=require(_0x4386('0x10'));var as=require(_0x4386('0x11'));var pdf=require(_0x4386('0x12'));var hardwareService=require(_0x4386('0x13'));var logger=require(_0x4386('0x14'))(_0x4386('0x15'));var utils=require('../../config/utils');var config=require(_0x4386('0x16'));var licenseUtil=require(_0x4386('0x17'));var db=require(_0x4386('0x18'))['db'];config[_0x4386('0x19')]=_[_0x4386('0x1a')](config[_0x4386('0x19')],{'host':_0x4386('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4386('0x19')]));require(_0x4386('0x1c'))['register'](socket);function respondWithStatusCode(_0x37ba50,_0x325578){_0x325578=_0x325578||0xcc;return function(_0x410096){if(_0x410096){return _0x37ba50[_0x4386('0x1d')](_0x325578);}return _0x37ba50[_0x4386('0x1e')](_0x325578)[_0x4386('0x1f')]();};}function respondWithResult(_0x5d5d48,_0x4e5016){_0x4e5016=_0x4e5016||0xc8;return function(_0x31861d){if(_0x31861d){return _0x5d5d48['status'](_0x4e5016)[_0x4386('0x20')](_0x31861d);}};}function respondWithFilteredResult(_0x15901f,_0x424546){return function(_0x5be814){if(_0x5be814){var _0x45ac6e=typeof _0x424546['offset']===_0x4386('0x21')&&typeof _0x424546[_0x4386('0x22')]===_0x4386('0x21');var _0x5b637a=_0x5be814[_0x4386('0x23')];var _0x3fedc9=_0x45ac6e?0x0:_0x424546[_0x4386('0x24')];var _0x534103=_0x45ac6e?_0x5be814[_0x4386('0x23')]:_0x424546[_0x4386('0x24')]+_0x424546[_0x4386('0x22')];var _0x1d10e8;if(_0x534103>=_0x5b637a){_0x534103=_0x5b637a;_0x1d10e8=0xc8;}else{_0x1d10e8=0xce;}_0x15901f[_0x4386('0x1e')](_0x1d10e8);return _0x15901f['set'](_0x4386('0x25'),_0x3fedc9+'-'+_0x534103+'/'+_0x5b637a)[_0x4386('0x20')](_0x5be814);}return null;};}function patchUpdates(_0x2f30ae){return function(_0x2c8848){try{jsonpatch[_0x4386('0x26')](_0x2c8848,_0x2f30ae,!![]);}catch(_0x2a1afa){return BPromise[_0x4386('0x27')](_0x2a1afa);}return _0x2c8848[_0x4386('0x28')]();};}function saveUpdates(_0x44312e,_0x5331f7){return function(_0x4aa084){if(_0x4aa084){return _0x4aa084[_0x4386('0x29')](_0x44312e)[_0x4386('0x2a')](function(_0x3b5ac7){return _0x3b5ac7;});}return null;};}function removeEntity(_0x17ba52,_0x531b7d){return function(_0x430d15){if(_0x430d15){return _0x430d15[_0x4386('0x2b')]()[_0x4386('0x2a')](function(){_0x17ba52[_0x4386('0x1e')](0xcc)[_0x4386('0x1f')]();});}};}function handleEntityNotFound(_0x434d12,_0x263e4b){return function(_0x1c7416){if(!_0x1c7416){_0x434d12[_0x4386('0x1d')](0x194);}return _0x1c7416;};}function handleError(_0xc46a88,_0x514270){_0x514270=_0x514270||0x1f4;return function(_0x4c4ea5){logger[_0x4386('0x2c')](_0x4c4ea5[_0x4386('0x2d')]);if(_0x4c4ea5[_0x4386('0x2e')]){delete _0x4c4ea5['name'];}_0xc46a88[_0x4386('0x1e')](_0x514270)[_0x4386('0x2f')](_0x4c4ea5);};}function getInteractionUsers(_0x1ad37c,_0x5e8a28){return new BPromise(function(_0x3e8459,_0x56949b){try{if(_0x5e8a28[_0x1ad37c['id']]){_0x1ad37c[_0x4386('0x30')]=_[_0x4386('0x31')](_0x5e8a28[_0x1ad37c['id']],function(_0x1923e9){return{'id':_0x1923e9['id'],'fullname':_0x1923e9[_0x4386('0x32')]};});}}catch(_0xaf4074){_0x56949b(_0xaf4074);}_0x3e8459(_0x1ad37c);});}function getInteractionTags(_0x59ef52,_0x4e9507){return new BPromise(function(_0x2ba094,_0x11566f){try{if(_0x59ef52['TagIds']){_0x59ef52['Tags']=[];_0x59ef52['TagIds'][_0x4386('0x33')](',')['forEach'](function(_0xf17a9a){_0x59ef52[_0x4386('0x34')]['push'](_0x4e9507[_0xf17a9a]);});}delete _0x59ef52[_0x4386('0x35')];}catch(_0xe1b29e){_0x11566f(_0xe1b29e);}_0x2ba094(_0x59ef52);});}function updateOpenchannelInteraction(_0x414367,_0x12b553,_0x13fd5c){return new BPromise(function(_0x2eea51,_0x340d11){return getInteractionUsers(_0x414367,_0x13fd5c)['then'](function(_0x4c10bc){return getInteractionTags(_0x4c10bc,_0x12b553);})[_0x4386('0x2a')](function(_0x182054){_0x2eea51(_0x182054);})[_0x4386('0x36')](function(_0x2aa1f1){_0x340d11(_0x2aa1f1);});});}exports[_0x4386('0x37')]=function(_0x6dc57d,_0x29d03c){var _0x29e3ed={},_0x23da6f={},_0x57f6dd={'count':0x0,'rows':[]};var _0x35acf1=_[_0x4386('0x31')](db['OpenchannelInteraction']['rawAttributes'],function(_0x51a338){return{'name':_0x51a338[_0x4386('0x38')],'type':_0x51a338[_0x4386('0x39')]['key']};});_0x23da6f['model']=_['map'](_0x35acf1,_0x4386('0x2e'));_0x23da6f[_0x4386('0x3a')]=_[_0x4386('0x3b')](_0x6dc57d[_0x4386('0x3a')]);_0x23da6f[_0x4386('0x3c')]=_[_0x4386('0x3d')](_0x23da6f[_0x4386('0x3e')],_0x23da6f[_0x4386('0x3a')]);_0x29e3ed[_0x4386('0x3f')]=_[_0x4386('0x3d')](_0x23da6f[_0x4386('0x3e')],qs['fields'](_0x6dc57d['query'][_0x4386('0x40')]));_0x29e3ed[_0x4386('0x3f')]=_0x29e3ed[_0x4386('0x3f')]['length']?_0x29e3ed['attributes']:_0x23da6f[_0x4386('0x3e')];if(!_0x6dc57d['query'][_0x4386('0x41')](_0x4386('0x42'))){_0x29e3ed[_0x4386('0x22')]=qs[_0x4386('0x22')](_0x6dc57d[_0x4386('0x3a')][_0x4386('0x22')]);_0x29e3ed[_0x4386('0x24')]=qs[_0x4386('0x24')](_0x6dc57d[_0x4386('0x3a')][_0x4386('0x24')]);}_0x29e3ed['order']=qs['sort'](_0x6dc57d[_0x4386('0x3a')][_0x4386('0x43')]);_0x29e3ed['where']=qs[_0x4386('0x3c')](_[_0x4386('0x44')](_0x6dc57d['query'],_0x23da6f[_0x4386('0x3c')]),_0x35acf1);var _0x423116=[];var _0x5f2011=squel[_0x4386('0x45')]()[_0x4386('0x46')]('id')[_0x4386('0x46')](_0x4386('0x2e'))['field'](_0x4386('0x47'))[_0x4386('0x48')](_0x4386('0x49'));var _0x2d2d25=squel['select']()[_0x4386('0x46')](_0x4386('0x4a'))[_0x4386('0x46')]('u.fullname')[_0x4386('0x46')](_0x4386('0x4b'))[_0x4386('0x48')](_0x4386('0x4c'),'ui')[_0x4386('0x4d')](_0x4386('0x4e'),'u',_0x4386('0x4f'));var _0x1c0147=squel[_0x4386('0x45')]()['from'](_0x4386('0x50'),'i')[_0x4386('0x4d')](_0x4386('0x51'),'c',_0x4386('0x52'))[_0x4386('0x4d')](_0x4386('0x4e'),'o',_0x4386('0x53'))[_0x4386('0x4d')](_0x4386('0x54'),'a',_0x4386('0x55'))['left_join'](_0x4386('0x56'),'me',_0x4386('0x57'))[_0x4386('0x4d')](_0x4386('0x58'),'it',_0x4386('0x59'))['left_join'](_0x4386('0x49'),'t',_0x4386('0x5a'));var _0x2e7a24=squel[_0x4386('0x5b')]();var _0x112a72=[];var _0x4260cf=squel[_0x4386('0x5b')]();var _0x51e02c;if(_0x6dc57d[_0x4386('0x3a')][_0x4386('0x5c')]){_0x51e02c=as[_0x4386('0x5d')](_0x6dc57d[_0x4386('0x3a')]['search']);var _0x4c7bbc=_0x51e02c[_0x4386('0x5e')];for(var _0x490f90=0x0;_0x490f90<_0x51e02c['conditions'][_0x4386('0x5f')];_0x490f90++){var _0x341704=_0x51e02c[_0x4386('0x60')][_0x490f90];var _0x235de5='i';var _0x2f28e8=_[_0x4386('0x61')](_0x35acf1,['name',_0x341704[_0x4386('0x46')]]);if(!_0x2f28e8){switch(_0x341704[_0x4386('0x46')]){case'unreadMessages':if(_0x341704[_0x4386('0x62')]==0x1){_0x1c0147[_0x4386('0x63')]('`'+_0x341704['field']+'`\x20=\x200');}else{_0x1c0147['having']('`'+_0x341704[_0x4386('0x46')]+_0x4386('0x64'));}break;case _0x4386('0x65'):if(_0x341704['operator']===_0x4386('0x66')){if(_0x341704[_0x4386('0x62')]['split']('\x20')[_0x4386('0x5f')]>0x1){_0x2e7a24[_0x4c7bbc]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4386('0x67')](_0x341704['value']),null);}else{var _0x4c4c27='%'+_0x341704[_0x4386('0x62')]+'%';_0x2e7a24[_0x4c7bbc](_0x4386('0x68'),_0x4c4c27,_0x4c4c27,_0x4c4c27);}}else{_0x2f28e8=_[_0x4386('0x61')](_0x35acf1,[_0x4386('0x2e'),_0x4386('0x69')]);_0x341704[_0x4386('0x46')]=_0x4386('0x69');_0x17e565=as[_0x4386('0x6a')](_0x235de5,_0x2f28e8['type'],_0x341704);_0x2e7a24[_0x4c7bbc](_0x17e565[_0x4386('0x6b')],_0x17e565[_0x4386('0x62')][_0x4386('0x6c')],_0x17e565[_0x4386('0x62')][_0x4386('0x1f')]);}break;case _0x4386('0x6d'):var _0x43d5a1=_0x341704[_0x4386('0x62')][_0x4386('0x33')](',')['map'](function(_0x2117fe){return Number(_0x2117fe);});_0x43d5a1[_0x4386('0x6e')](function(_0x93ac32){_0x4260cf['or'](_0x4386('0x6f'),'%,'+_0x93ac32+',%');});_0x112a72=_[_0x4386('0x70')](_0x112a72,_0x43d5a1);break;case'User':if(_0x341704[_0x4386('0x71')]==='$substring'){_0x2e7a24[_0x4c7bbc](_0x4386('0x72'),'%'+_0x341704[_0x4386('0x62')]+'%',null);}else{_0x2f28e8=_[_0x4386('0x61')](_0x35acf1,[_0x4386('0x2e'),_0x4386('0x73')]);_0x341704['field']=_0x4386('0x73');_0x17e565=as['buildExpression'](_0x235de5,_0x2f28e8['type'],_0x341704);_0x2e7a24[_0x4c7bbc](_0x17e565[_0x4386('0x6b')],_0x17e565[_0x4386('0x62')]['start'],_0x17e565[_0x4386('0x62')][_0x4386('0x1f')]);}break;case _0x4386('0x74'):_0x17e565=as[_0x4386('0x6a')]('me',null,_0x341704);_0x2e7a24[_0x4c7bbc](_0x17e565[_0x4386('0x6b')],_0x17e565[_0x4386('0x62')]['start'],_0x17e565[_0x4386('0x62')][_0x4386('0x1f')]);break;}}else{var _0x17e565=as[_0x4386('0x6a')](_0x235de5,_0x2f28e8['type'],_0x341704);_0x2e7a24[_0x4c7bbc](_0x17e565[_0x4386('0x6b')],_0x17e565['value'][_0x4386('0x6c')],_0x17e565[_0x4386('0x62')][_0x4386('0x1f')]);}}}else{var _0x287b4a=_(_0x6dc57d[_0x4386('0x3a')])[_0x4386('0x3b')]()[_0x4386('0x31')](function(_0x263e41){return _[_0x4386('0x75')](_0x35acf1,[_0x4386('0x2e'),_0x263e41])?_0x263e41:undefined;})[_0x4386('0x76')]()[_0x4386('0x62')]();if(!_[_0x4386('0x77')](_0x287b4a)){_0x287b4a[_0x4386('0x6e')](function(_0x2967e8){if(_0x2967e8===_0x4386('0x78')){_0x1c0147['where']('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x6dc57d[_0x4386('0x3a')][_0x2967e8]));}else if(_0x2967e8===_0x4386('0x79')){var _0x1a0096=JSON[_0x4386('0x7a')](_0x6dc57d[_0x4386('0x3a')][_0x2967e8])['$gte'];var _0x1dee8a=JSON[_0x4386('0x7a')](_0x6dc57d[_0x4386('0x3a')][_0x2967e8])[_0x4386('0x7b')];_0x1c0147[_0x4386('0x7c')](_0x4386('0x7d'),_0x1a0096,_0x1dee8a);}else{if(_0x6dc57d[_0x4386('0x3a')][_0x2967e8]==='null'){_0x1c0147[_0x4386('0x7c')]('i.'+_0x2967e8+_0x4386('0x7e'));}else{_0x1c0147[_0x4386('0x7c')]('i.'+_0x2967e8+'\x20=\x20?',_0x6dc57d[_0x4386('0x3a')][_0x2967e8]);}}});}if(_0x6dc57d[_0x4386('0x3a')]['read']){if(_0x6dc57d[_0x4386('0x3a')][_0x4386('0x7f')]==0x1){_0x1c0147[_0x4386('0x63')](_0x4386('0x80'));}else{_0x1c0147[_0x4386('0x63')](_0x4386('0x81'));}}if(_0x6dc57d[_0x4386('0x3a')][_0x4386('0x82')]){_0x112a72=_[_0x4386('0x83')](_0x6dc57d[_0x4386('0x3a')]['tag'])?_0x6dc57d['query'][_0x4386('0x82')]:new Array(_0x6dc57d[_0x4386('0x3a')][_0x4386('0x82')]);_0x112a72['forEach'](function(_0x3bd38e){_0x4260cf['or'](_0x4386('0x6f'),'%,'+_0x3bd38e+',%');});}if(_0x6dc57d['query']['filter']){var _0x27ef45=_0x6dc57d['query'][_0x4386('0x84')][_0x4386('0x85')]('\x5c','\x5c\x5c')[_0x4386('0x85')](/'/g,'\x27\x27');if(qs[_0x4386('0x86')](_0x27ef45)){_0x2e7a24['or'](_0x4386('0x87'),_0x27ef45+'%');}else{_0x2e7a24['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4386('0x67')](_0x27ef45))['or'](_0x4386('0x88'),_0x27ef45+'%')['or'](_0x4386('0x89'),_0x27ef45+'%');}}}_0x1c0147[_0x4386('0x7c')](_0x2e7a24);_0x1c0147[_0x4386('0x8a')](_0x4386('0x8b'));var _0x19fb33={'type':db[_0x4386('0x8c')][_0x4386('0x8d')][_0x4386('0x8e')],'raw':!![]};var _0x3377b4=_0x1c0147[_0x4386('0x8f')]();_0x3377b4[_0x4386('0x46')](_0x4386('0x8b'));_0x3377b4[_0x4386('0x46')](_0x4386('0x90'),'unreadMessages');if(_0x29e3ed[_0x4386('0x91')]){_0x29e3ed[_0x4386('0x91')]['forEach'](function(_0x39e38d){var _0x59e2c8=_0x39e38d[0x0]===_0x4386('0x92')?_0x39e38d[0x0]:'i.'+_0x39e38d[0x0];_0x1c0147[_0x4386('0x91')](_0x59e2c8,_0x39e38d[0x1]===_0x4386('0x93')?![]:!![]);});}if(!_[_0x4386('0x77')](_0x112a72)){_0x1c0147[_0x4386('0x63')](_0x4260cf);_0x3377b4[_0x4386('0x7c')](_0x4386('0x94'),_0x112a72);}BPromise[_0x4386('0x95')]()[_0x4386('0x2a')](function(){if(!_0x51e02c){if(_0x6dc57d[_0x4386('0x3a')]['OpenchannelAccountId'])return;_0x3377b4[_0x4386('0x7c')](_0x4386('0x96'));_0x1c0147[_0x4386('0x7c')](_0x4386('0x96'));return;}if(_0x6dc57d[_0x4386('0x97')][_0x4386('0x98')]!==_0x4386('0x99'))return;return _0x6dc57d[_0x4386('0x97')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x4386('0x2a')](function(_0x44f62a){if(_['isEmpty'](_0x44f62a)){_0x3377b4['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x1c0147[_0x4386('0x7c')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x3377b4['where'](_0x4386('0x9a'),_['map'](_0x44f62a,'id'));_0x1c0147[_0x4386('0x7c')](_0x4386('0x9a'),_['map'](_0x44f62a,'id'));}});})[_0x4386('0x2a')](function(){if(_0x6dc57d['user'][_0x4386('0x98')]===_0x4386('0x99')&&!_0x51e02c&&!_0x6dc57d[_0x4386('0x3a')]['OpenchannelAccountId'])return[];return db['sequelize'][_0x4386('0x3a')](_0x3377b4[_0x4386('0x9b')](),_0x19fb33);})[_0x4386('0x2a')](function(_0x2873f5){_0x57f6dd[_0x4386('0x23')]=_0x2873f5['length'];if(_0x57f6dd[_0x4386('0x23')]===0x0)return[];return db['sequelize'][_0x4386('0x3a')](_0x5f2011['toString'](),_0x19fb33)['then'](function(_0x109448){_0x423116=_[_0x4386('0x9c')](_0x109448,'id');_0x19fb33=_[_0x4386('0x9d')](_0x19fb33,{'model':db[_0x4386('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6dc57d[_0x4386('0x3a')][_0x4386('0x40')]){_0x29e3ed[_0x4386('0x3f')][_0x4386('0x6e')](function(_0x52f67b){_0x1c0147[_0x4386('0x46')]('i.'+_0x52f67b);});}else{_0x1c0147[_0x4386('0x46')](_0x4386('0x90'),'unreadMessages');_0x1c0147[_0x4386('0x46')](_0x4386('0x9f'),_0x4386('0xa0'));_0x1c0147[_0x4386('0x46')](_0x4386('0xa1'),'Account.mandatoryDisposition');_0x1c0147[_0x4386('0x46')](_0x4386('0xa2'),_0x4386('0x92'));_0x1c0147['field'](_0x4386('0xa3'));_0x1c0147['field'](_0x4386('0xa4'),_0x4386('0xa5'));_0x1c0147['field']('c.lastName',_0x4386('0xa6'));_0x1c0147['field'](_0x4386('0xa7'),_0x4386('0xa8'));_0x1c0147[_0x4386('0x46')](_0x4386('0xa9'),_0x4386('0xaa'));_0x1c0147[_0x4386('0x46')](_0x4386('0xab'),_0x4386('0xac'));_0x1c0147[_0x4386('0x46')](_0x4386('0xad'),_0x4386('0xae'));_0x1c0147[_0x4386('0x46')](_0x4386('0xaf'),_0x4386('0xb0'));_0x1c0147[_0x4386('0x46')](_0x4386('0xb1'),_0x4386('0xb2'));_0x1c0147[_0x4386('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4386('0x35'));}if(_0x29e3ed[_0x4386('0x22')])_0x1c0147[_0x4386('0x22')](_0x29e3ed[_0x4386('0x22')]);if(_0x29e3ed[_0x4386('0x24')])_0x1c0147[_0x4386('0x24')](_0x29e3ed['offset']);return db[_0x4386('0xb3')]['query'](_0x1c0147[_0x4386('0x9b')](),_0x19fb33);})[_0x4386('0x2a')](function(_0x43c21e){if(_0x43c21e[_0x4386('0x5f')]>0x0)_0x2d2d25[_0x4386('0x7c')](_0x4386('0xb4'),_[_0x4386('0x31')](_0x43c21e,'id'));return db[_0x4386('0xb3')][_0x4386('0x3a')](_0x2d2d25[_0x4386('0x9b')](),_0x19fb33)[_0x4386('0x2a')](function(_0x141614){var _0x40f8d9=_[_0x4386('0xb5')](_0x141614,_0x4386('0xb6'));var _0x341927=[];_0x43c21e[_0x4386('0x6e')](function(_0x3621ed){_0x341927[_0x4386('0xb7')](updateOpenchannelInteraction(_0x3621ed,_0x423116,_0x40f8d9));});return BPromise[_0x4386('0xb8')](_0x341927);});});})[_0x4386('0x2a')](function(_0x41e79a){_0x57f6dd[_0x4386('0xb9')]=_0x41e79a;return _0x57f6dd;})[_0x4386('0x2a')](respondWithFilteredResult(_0x29d03c,_0x29e3ed))['catch'](handleError(_0x29d03c,null));};exports['show']=function(_0x36f405,_0x4803e0){var _0x40f85b={};if(_0x36f405[_0x4386('0x3a')][_0x4386('0x39')]&&_0x36f405[_0x4386('0x3a')][_0x4386('0x39')]===_0x4386('0x48')){_0x40f85b[_0x4386('0x48')]=_0x36f405[_0x4386('0xba')]['id'];}else{_0x40f85b['id']=_0x36f405[_0x4386('0xba')]['id'];}var _0x41ab98={'raw':![],'where':_0x40f85b},_0x10a3d5={};_0x10a3d5[_0x4386('0x3e')]=_['keys'](db['OpenchannelInteraction'][_0x4386('0xbb')]);_0x10a3d5[_0x4386('0x3a')]=_[_0x4386('0x3b')](_0x36f405[_0x4386('0x3a')]);_0x10a3d5[_0x4386('0x3c')]=_[_0x4386('0x3d')](_0x10a3d5[_0x4386('0x3e')],_0x10a3d5[_0x4386('0x3a')]);_0x41ab98[_0x4386('0x3f')]=_[_0x4386('0x3d')](_0x10a3d5[_0x4386('0x3e')],qs['fields'](_0x36f405[_0x4386('0x3a')][_0x4386('0x40')]));_0x41ab98['attributes']=_0x41ab98[_0x4386('0x3f')][_0x4386('0x5f')]?_0x41ab98[_0x4386('0x3f')]:_0x10a3d5['model'];if(_0x36f405[_0x4386('0x3a')][_0x4386('0xbc')]){_0x41ab98[_0x4386('0xbd')]=[{'all':!![]}];}_0x41ab98=_[_0x4386('0x9d')]({},_0x41ab98,_0x36f405[_0x4386('0xbe')]);return db[_0x4386('0x9e')]['find'](_0x41ab98)['then'](handleEntityNotFound(_0x4803e0,null))[_0x4386('0x2a')](respondWithResult(_0x4803e0,null))['catch'](handleError(_0x4803e0,null));};exports['create']=function(_0x41f30b,_0x292df1){return db[_0x4386('0x9e')][_0x4386('0xbf')](_0x41f30b['body'],{})[_0x4386('0x2a')](respondWithResult(_0x292df1,0xc9))[_0x4386('0x36')](handleError(_0x292df1,null));};exports[_0x4386('0x29')]=function(_0x493fe6,_0x3aee55){if(_0x493fe6[_0x4386('0x74')]['id']){delete _0x493fe6[_0x4386('0x74')]['id'];}return db['OpenchannelInteraction'][_0x4386('0x61')]({'where':{'id':_0x493fe6['params']['id']}})[_0x4386('0x2a')](handleEntityNotFound(_0x3aee55,null))[_0x4386('0x2a')](saveUpdates(_0x493fe6[_0x4386('0x74')],null))[_0x4386('0x2a')](respondWithResult(_0x3aee55,null))['catch'](handleError(_0x3aee55,null));};exports[_0x4386('0x2b')]=function(_0x41862b,_0x24109b){return db[_0x4386('0x9e')][_0x4386('0x61')]({'where':{'id':_0x41862b[_0x4386('0xba')]['id']}})[_0x4386('0x2a')](handleEntityNotFound(_0x24109b,null))[_0x4386('0x2a')](removeEntity(_0x24109b,null))[_0x4386('0x36')](handleError(_0x24109b,null));};exports['describe']=function(_0x33cbd4,_0x3da6c5){return db['OpenchannelInteraction'][_0x4386('0xc0')]()['then'](respondWithResult(_0x3da6c5,null))[_0x4386('0x36')](handleError(_0x3da6c5,null));};exports[_0x4386('0xc1')]=function(_0x33e361,_0x3fb790,_0x276898){return db['OpenchannelMessage'][_0x4386('0x61')]({'where':{'id':_0x33e361[_0x4386('0xba')]['id']}})[_0x4386('0x2a')](handleEntityNotFound(_0x3fb790,null))['then'](function(_0x234ed0){if(_0x234ed0){return _0x234ed0[_0x4386('0xc1')](_0x33e361[_0x4386('0x74')][_0x4386('0xc2')],_[_0x4386('0xc3')](_0x33e361[_0x4386('0x74')],[_0x4386('0xc2'),'id'])||{});}})[_0x4386('0x2a')](respondWithResult(_0x3fb790,null))[_0x4386('0x36')](handleError(_0x3fb790,null));};exports[_0x4386('0xc4')]=function(_0x35f1c7,_0x4751a4,_0x1adcbc){var _0x4e34b0={'raw':![],'where':{}};var _0x1d0963={};var _0x5726ed={'count':0x0,'rows':[]};return db[_0x4386('0x9e')][_0x4386('0xc5')]({'where':{'id':_0x35f1c7['params']['id']}})[_0x4386('0x2a')](handleEntityNotFound(_0x4751a4,null))[_0x4386('0x2a')](function(_0x1590ee){if(_0x1590ee){_0x1d0963[_0x4386('0x3e')]=_['keys'](db['OpenchannelMessage']['rawAttributes']);_0x1d0963[_0x4386('0x3a')]=_[_0x4386('0x3b')](_0x35f1c7[_0x4386('0x3a')]);_0x1d0963[_0x4386('0x3c')]=_[_0x4386('0x3d')](_0x1d0963[_0x4386('0x3e')],_0x1d0963[_0x4386('0x3a')]);_0x4e34b0[_0x4386('0x3f')]=_[_0x4386('0x3d')](_0x1d0963[_0x4386('0x3e')],qs[_0x4386('0x40')](_0x35f1c7[_0x4386('0x3a')]['fields']));_0x4e34b0[_0x4386('0x3f')]=_0x4e34b0[_0x4386('0x3f')][_0x4386('0x5f')]?_0x4e34b0[_0x4386('0x3f')]:_0x1d0963['model'];if(!_0x35f1c7[_0x4386('0x3a')]['hasOwnProperty'](_0x4386('0x42'))){_0x4e34b0[_0x4386('0x22')]=qs[_0x4386('0x22')](_0x35f1c7[_0x4386('0x3a')]['limit']);_0x4e34b0[_0x4386('0x24')]=qs['offset'](_0x35f1c7[_0x4386('0x3a')][_0x4386('0x24')]);}_0x4e34b0['order']=qs[_0x4386('0x43')](_0x35f1c7[_0x4386('0x3a')][_0x4386('0x43')]);_0x4e34b0[_0x4386('0x7c')]=qs[_0x4386('0x3c')](_['pick'](_0x35f1c7[_0x4386('0x3a')],_0x1d0963['filters']));_0x4e34b0[_0x4386('0x7c')][_0x4386('0xb6')]=_0x1590ee['id'];if(_0x35f1c7[_0x4386('0x3a')]['filter']){_0x4e34b0[_0x4386('0x7c')]=_[_0x4386('0x9d')](_0x4e34b0[_0x4386('0x7c')],{'$or':_['map'](_0x4e34b0[_0x4386('0x3f')],function(_0x4558b5){var _0x2eed46={};_0x2eed46[_0x4558b5]={'$like':'%'+_0x35f1c7[_0x4386('0x3a')][_0x4386('0x84')]+'%'};return _0x2eed46;})});}if(_0x35f1c7['query']['$gte']){var _0x54aa13=_0x35f1c7[_0x4386('0x3a')][_0x4386('0xc6')][_0x4386('0x33')](',');var _0x205c70={};_0x205c70[_0x54aa13[0x0]]={'$gte':moment(_0x54aa13[0x1])['format'](_0x4386('0xc7'))};_0x4e34b0[_0x4386('0x7c')]=_['merge'](_0x4e34b0['where'],_0x205c70);}_0x4e34b0=_[_0x4386('0x9d')]({},_0x4e34b0,_0x35f1c7[_0x4386('0xbe')]);return db[_0x4386('0xc8')][_0x4386('0x23')]({'where':_0x4e34b0[_0x4386('0x7c')]})[_0x4386('0x2a')](function(_0x21c087){_0x5726ed[_0x4386('0x23')]=_0x21c087;if(_0x35f1c7[_0x4386('0x3a')][_0x4386('0xbc')]){_0x4e34b0[_0x4386('0xbd')]=[{'all':!![]}];}return db[_0x4386('0xc8')][_0x4386('0xc9')](_0x4e34b0);})[_0x4386('0x2a')](function(_0x362233){_0x5726ed[_0x4386('0xb9')]=_0x362233;return _0x5726ed;});}})[_0x4386('0x2a')](respondWithFilteredResult(_0x4751a4,_0x4e34b0))[_0x4386('0x36')](handleError(_0x4751a4,null));};exports[_0x4386('0xca')]=function(_0x1247eb,_0x548817,_0x2cf522){return db[_0x4386('0x9e')][_0x4386('0x61')]({'where':{'id':_0x1247eb[_0x4386('0xba')]['id']}})[_0x4386('0x2a')](handleEntityNotFound(_0x548817,null))['then'](function(_0x4d29b1){if(_0x4d29b1){return _0x4d29b1[_0x4386('0xcb')](_0x1247eb['body']['ids'],_[_0x4386('0xc3')](_0x1247eb[_0x4386('0x74')],[_0x4386('0xc2'),'id'])||{})[_0x4386('0xcc')](function(){return db[_0x4386('0x6d')][_0x4386('0xc9')]({'attributes':['id',_0x4386('0x2e'),'color'],'where':{'id':_0x1247eb['body']['ids']}});})[_0x4386('0x2a')](function(_0x43b45a){socket[_0x4386('0xcd')]('openchannelInteractionTags:save',{'id':Number(_0x1247eb[_0x4386('0xba')]['id']),'tags':_0x43b45a||[]});return{'id':Number(_0x1247eb[_0x4386('0xba')]['id']),'tags':_0x43b45a||[]};});}})[_0x4386('0x2a')](respondWithResult(_0x548817,null))[_0x4386('0x36')](handleError(_0x548817,null));};exports['removeTags']=function(_0x3ef3ae,_0x9c1967,_0x24de3c){return db[_0x4386('0x9e')][_0x4386('0x61')]({'where':{'id':_0x3ef3ae[_0x4386('0xba')]['id']}})[_0x4386('0x2a')](handleEntityNotFound(_0x9c1967,null))[_0x4386('0x2a')](function(_0x988cf0){if(_0x988cf0){return _0x988cf0[_0x4386('0xce')](_0x3ef3ae[_0x4386('0x3a')][_0x4386('0xc2')]);}})['then'](respondWithStatusCode(_0x9c1967,null))[_0x4386('0x36')](handleError(_0x9c1967,null));};exports['download']=function(_0x2807f8,_0x2cdb9e){var _0x4893ba=moment()[_0x4386('0xcf')]()['toString']();var _0x4f94de=path[_0x4386('0xd0')](config[_0x4386('0xd1')],'server',_0x4386('0xd2'),'tmp');var _0x544b02=path[_0x4386('0xd0')](config['root'],_0x4386('0xd3'),'files',_0x4386('0xd4'));var _0x49c180=path[_0x4386('0xd0')](_0x4f94de,_0x4893ba);var _0x58f56e=util['format'](_0x4386('0xd5'),_0x2807f8[_0x4386('0xba')]['id'],_0x4893ba);var _0x3cf5cd=path[_0x4386('0xd0')](_0x4f94de,_0x58f56e);var _0x31b78e=[];_0x31b78e[_0x4386('0xb7')]({'model':db[_0x4386('0xd6')],'as':_0x4386('0xd6'),'attributes':['id',_0x4386('0x32')],'raw':!![]});_0x31b78e[_0x4386('0xb7')]({'model':db['CmContact'],'as':_0x4386('0x65'),'attributes':['id',_0x4386('0xd7'),_0x4386('0xd8')],'raw':!![]});if(_0x2807f8[_0x4386('0x3a')][_0x4386('0xd4')]){_0x31b78e[_0x4386('0xb7')]({'model':db[_0x4386('0xd9')],'as':_0x4386('0xd9'),'raw':!![]});}var _0x3a7b8e=[{'model':db['OpenchannelMessage'],'as':_0x4386('0xda'),'attributes':['id',_0x4386('0x74'),_0x4386('0x79'),_0x4386('0xdb'),_0x4386('0xdc'),_0x4386('0x7f')],'include':_0x31b78e}];_0x3a7b8e['push']({'model':db[_0x4386('0xdd')],'as':_0x4386('0xde'),'attributes':['id',_0x4386('0x2e')]});_0x3a7b8e[_0x4386('0xb7')]({'model':db['User'],'as':_0x4386('0xdf'),'attributes':['id',_0x4386('0x32')]});return db[_0x4386('0x9e')]['find']({'where':{'id':_0x2807f8[_0x4386('0xba')]['id']},'include':_0x3a7b8e})[_0x4386('0x2a')](handleEntityNotFound(_0x2cdb9e,null))['then'](function(_0x60d17f){if(_0x60d17f){var _0x1e8d36=_0x60d17f[_0x4386('0xe0')]({'plain':!![]});fs[_0x4386('0xe1')](_0x49c180);var _0x55a6c8={'channel':_0x4386('0xe2'),'account':_0x1e8d36[_0x4386('0xde')][_0x4386('0x2e')],'agent':_0x1e8d36[_0x4386('0xdf')]?_0x1e8d36['Owner'][_0x4386('0x32')]:_0x4386('0xe3'),'createdAt':moment(_0x1e8d36['createdAt'])[_0x4386('0xe4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4386('0x9b')](),'closedAt':_0x1e8d36['closed']?moment(_0x1e8d36[_0x4386('0xe5')])[_0x4386('0xe4')](_0x4386('0xc7'))['toString']():'','disposition':_0x1e8d36[_0x4386('0xe6')],'visibility':_0x1e8d36[_0x4386('0xe7')]?_0x4386('0xe8'):_0x4386('0xe9'),'messages':_(_0x1e8d36['Messages'])['filter']({'secret':![]})[_0x4386('0x31')](function(_0x25f6a6){if(_0x25f6a6[_0x4386('0xd9')]){var _0x4114c5=path[_0x4386('0xd0')](_0x544b02,_0x25f6a6['Attachment'][_0x4386('0xea')]);if(fs[_0x4386('0xeb')](_0x4114c5)){fs[_0x4386('0xec')](_0x4114c5)[_0x4386('0xed')](fs[_0x4386('0xee')](path[_0x4386('0xd0')](_0x49c180,_0x25f6a6[_0x4386('0xd9')][_0x4386('0xea')])));}}return{'date':moment(_0x25f6a6['createdAt'])[_0x4386('0xe4')](_0x4386('0xc7'))['toString'](),'sender':_0x25f6a6[_0x4386('0xdb')]===_0x4386('0xef')?_0x25f6a6[_0x4386('0xd6')]?_0x25f6a6[_0x4386('0xd6')][_0x4386('0x32')]:'System':_0x25f6a6[_0x4386('0x65')][_0x4386('0xd7')]+(_0x25f6a6[_0x4386('0x65')][_0x4386('0xd8')]?'\x20'+_0x25f6a6[_0x4386('0x65')]['lastName']:''),'body':_0x25f6a6['Attachment']?_0x25f6a6[_0x4386('0xd9')]['basename']:_0x25f6a6['body'],'direction':_0x25f6a6['direction']===_0x4386('0xef')?'A':'C','secret':_0x25f6a6[_0x4386('0xdc')],'read':_0x25f6a6['read'],'attachment':_0x25f6a6[_0x4386('0xd9')]};})['value']()};return ejs[_0x4386('0xf0')](path[_0x4386('0xd0')](config['root'],'server',_0x4386('0xf1'),'downloadInteraction.ejs'),{'interaction':_0x55a6c8})[_0x4386('0x2a')](function(_0x27dd0b){var _0xaee20d=path[_0x4386('0xd0')](_0x49c180,'transcript-'+_0x1e8d36['id']+'-'+_0x4893ba+'.pdf');var _0x40bc38={'path':_0xaee20d,'channel':_0x4386('0xe2'),'interactionId':_0x1e8d36['id']};return pdf[_0x4386('0xf2')](_0x27dd0b,_0x40bc38);})['then'](function(){return new BPromise(function(_0x281595,_0x24e1dd){zipdir(_0x49c180,{'saveTo':_0x3cf5cd},function(_0x35a919,_0x5bca39){if(_0x35a919)return _0x24e1dd(_0x35a919);return _0x281595(_0x5bca39);});})['then'](function(){return new BPromise(function(_0x9ccdee,_0x2df8cb){rimraf(_0x49c180,function(_0x2488ba){if(_0x2488ba)_0x2df8cb(_0x2488ba);return _0x9ccdee();});});})[_0x4386('0x2a')](function(){return _0x2cdb9e[_0x4386('0xf3')](_0x3cf5cd,_0x58f56e,function(_0x58ea4d){if(_0x58ea4d){console[_0x4386('0xf4')](_0x4386('0xf5'),_0x58ea4d);}else{fs['unlinkSync'](_0x3cf5cd);}});});});}else{return _0x2cdb9e[_0x4386('0x1d')](0xc8);}})[_0x4386('0x36')](handleError(_0x2cdb9e,null));}; \ No newline at end of file +var _0x6227=['lastName','out','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','catch','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','`\x20=\x200','having','`\x20>\x200','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','SELECT','clone','i.id','contactName','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','sequelize','toString','length','keyBy','merge','OpenchannelInteraction','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','rows','show','params','includeAll','options','create','body','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','$gte','findAll','addTags','setTags','emit','removeTags','download','unix','join','files','tmp','server','format','transcript-%d-%s.zip','firstName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Public','Private','pipe','createWriteStream','basename','System','Contact'];(function(_0xf2b2f6,_0x2f4adf){var _0x65d2ac=function(_0x422e08){while(--_0x422e08){_0xf2b2f6['push'](_0xf2b2f6['shift']());}};_0x65d2ac(++_0x2f4adf);}(_0x6227,0x1ee));var _0x7622=function(_0x4e1009,_0x5b1f40){_0x4e1009=_0x4e1009-0x0;var _0x51e19a=_0x6227[_0x4e1009];return _0x51e19a;};'use strict';var emlformat=require(_0x7622('0x0'));var rimraf=require(_0x7622('0x1'));var zipdir=require(_0x7622('0x2'));var jsonpatch=require(_0x7622('0x3'));var rp=require(_0x7622('0x4'));var moment=require(_0x7622('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7622('0x6'));var util=require(_0x7622('0x7'));var path=require(_0x7622('0x8'));var sox=require(_0x7622('0x9'));var csv=require(_0x7622('0xa'));var ejs=require(_0x7622('0xb'));var fs=require('fs');var fs_extra=require(_0x7622('0xc'));var _=require('lodash');var squel=require(_0x7622('0xd'));var crypto=require(_0x7622('0xe'));var jsforce=require(_0x7622('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7622('0xa'));var querystring=require(_0x7622('0x10'));var Papa=require(_0x7622('0x11'));var Redis=require(_0x7622('0x12'));var authService=require(_0x7622('0x13'));var qs=require(_0x7622('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x7622('0x15'));var logger=require(_0x7622('0x16'))(_0x7622('0x17'));var utils=require(_0x7622('0x18'));var config=require(_0x7622('0x19'));var licenseUtil=require(_0x7622('0x1a'));var db=require(_0x7622('0x1b'))['db'];config[_0x7622('0x1c')]=_['defaults'](config['redis'],{'host':_0x7622('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7622('0x1c')]));require(_0x7622('0x1e'))[_0x7622('0x1f')](socket);function respondWithStatusCode(_0x49dc62,_0xfb577a){_0xfb577a=_0xfb577a||0xcc;return function(_0x2c1448){if(_0x2c1448){return _0x49dc62[_0x7622('0x20')](_0xfb577a);}return _0x49dc62[_0x7622('0x21')](_0xfb577a)['end']();};}function respondWithResult(_0x4e11f9,_0x3e95a5){_0x3e95a5=_0x3e95a5||0xc8;return function(_0x111cba){if(_0x111cba){return _0x4e11f9[_0x7622('0x21')](_0x3e95a5)[_0x7622('0x22')](_0x111cba);}};}function respondWithFilteredResult(_0x3c93d8,_0x1a7f17){return function(_0x4e248d){if(_0x4e248d){var _0x34ccd2=typeof _0x1a7f17[_0x7622('0x23')]===_0x7622('0x24')&&typeof _0x1a7f17[_0x7622('0x25')]==='undefined';var _0x4fad82=_0x4e248d['count'];var _0x30101c=_0x34ccd2?0x0:_0x1a7f17[_0x7622('0x23')];var _0x1cb874=_0x34ccd2?_0x4e248d[_0x7622('0x26')]:_0x1a7f17['offset']+_0x1a7f17[_0x7622('0x25')];var _0xf0a109;if(_0x1cb874>=_0x4fad82){_0x1cb874=_0x4fad82;_0xf0a109=0xc8;}else{_0xf0a109=0xce;}_0x3c93d8['status'](_0xf0a109);return _0x3c93d8[_0x7622('0x27')](_0x7622('0x28'),_0x30101c+'-'+_0x1cb874+'/'+_0x4fad82)[_0x7622('0x22')](_0x4e248d);}return null;};}function patchUpdates(_0x359b32){return function(_0x5e1b16){try{jsonpatch[_0x7622('0x29')](_0x5e1b16,_0x359b32,!![]);}catch(_0x5a5642){return BPromise[_0x7622('0x2a')](_0x5a5642);}return _0x5e1b16['save']();};}function saveUpdates(_0x4e1872,_0x23e825){return function(_0x970681){if(_0x970681){return _0x970681[_0x7622('0x2b')](_0x4e1872)['then'](function(_0x246bca){return _0x246bca;});}return null;};}function removeEntity(_0x12be5f,_0x53939d){return function(_0x585cba){if(_0x585cba){return _0x585cba[_0x7622('0x2c')]()[_0x7622('0x2d')](function(){_0x12be5f[_0x7622('0x21')](0xcc)[_0x7622('0x2e')]();});}};}function handleEntityNotFound(_0x495066,_0x50ee6d){return function(_0x51e79f){if(!_0x51e79f){_0x495066[_0x7622('0x20')](0x194);}return _0x51e79f;};}function handleError(_0x583e98,_0x2b91c0){_0x2b91c0=_0x2b91c0||0x1f4;return function(_0x1a3789){logger['error'](_0x1a3789[_0x7622('0x2f')]);if(_0x1a3789['name']){delete _0x1a3789[_0x7622('0x30')];}_0x583e98[_0x7622('0x21')](_0x2b91c0)['send'](_0x1a3789);};}function getInteractionUsers(_0x4813a4,_0x19ba2a){return new BPromise(function(_0x5a617d,_0x208153){try{if(_0x19ba2a[_0x4813a4['id']]){_0x4813a4[_0x7622('0x31')]=_[_0x7622('0x32')](_0x19ba2a[_0x4813a4['id']],function(_0x2825de){return{'id':_0x2825de['id'],'fullname':_0x2825de[_0x7622('0x33')]};});}}catch(_0x2d5e2e){_0x208153(_0x2d5e2e);}_0x5a617d(_0x4813a4);});}function getInteractionTags(_0x4409de,_0x1e31d6){return new BPromise(function(_0x5bea3d,_0x108976){try{if(_0x4409de[_0x7622('0x34')]){_0x4409de[_0x7622('0x35')]=[];_0x4409de['TagIds'][_0x7622('0x36')](',')[_0x7622('0x37')](function(_0x7af186){_0x4409de[_0x7622('0x35')]['push'](_0x1e31d6[_0x7af186]);});}delete _0x4409de[_0x7622('0x34')];}catch(_0x5753ae){_0x108976(_0x5753ae);}_0x5bea3d(_0x4409de);});}function updateOpenchannelInteraction(_0x1ce957,_0x201578,_0x1efb5e){return new BPromise(function(_0x19d2f4,_0x43a407){return getInteractionUsers(_0x1ce957,_0x1efb5e)[_0x7622('0x2d')](function(_0x365ec7){return getInteractionTags(_0x365ec7,_0x201578);})[_0x7622('0x2d')](function(_0x177582){_0x19d2f4(_0x177582);})[_0x7622('0x38')](function(_0x67476d){_0x43a407(_0x67476d);});});}exports['index']=function(_0x1dc4ce,_0x4e11d6){var _0x199ac9={},_0x5348d6={},_0x2ba641={'count':0x0,'rows':[]};var _0xc2713b=_[_0x7622('0x32')](db['OpenchannelInteraction'][_0x7622('0x39')],function(_0x3b590b){return{'name':_0x3b590b[_0x7622('0x3a')],'type':_0x3b590b[_0x7622('0x3b')]['key']};});_0x5348d6[_0x7622('0x3c')]=_[_0x7622('0x32')](_0xc2713b,_0x7622('0x30'));_0x5348d6[_0x7622('0x3d')]=_[_0x7622('0x3e')](_0x1dc4ce[_0x7622('0x3d')]);_0x5348d6[_0x7622('0x3f')]=_[_0x7622('0x40')](_0x5348d6[_0x7622('0x3c')],_0x5348d6['query']);_0x199ac9['attributes']=_['intersection'](_0x5348d6[_0x7622('0x3c')],qs['fields'](_0x1dc4ce[_0x7622('0x3d')]['fields']));_0x199ac9[_0x7622('0x41')]=_0x199ac9[_0x7622('0x41')]['length']?_0x199ac9['attributes']:_0x5348d6['model'];if(!_0x1dc4ce['query'][_0x7622('0x42')]('nolimit')){_0x199ac9[_0x7622('0x25')]=qs[_0x7622('0x25')](_0x1dc4ce[_0x7622('0x3d')][_0x7622('0x25')]);_0x199ac9[_0x7622('0x23')]=qs[_0x7622('0x23')](_0x1dc4ce[_0x7622('0x3d')][_0x7622('0x23')]);}_0x199ac9[_0x7622('0x43')]=qs[_0x7622('0x44')](_0x1dc4ce[_0x7622('0x3d')][_0x7622('0x44')]);_0x199ac9['where']=qs['filters'](_[_0x7622('0x45')](_0x1dc4ce[_0x7622('0x3d')],_0x5348d6[_0x7622('0x3f')]),_0xc2713b);var _0x157dc2=[];var _0x1445ac=squel[_0x7622('0x46')]()['field']('id')[_0x7622('0x47')]('name')[_0x7622('0x47')](_0x7622('0x48'))[_0x7622('0x49')](_0x7622('0x4a'));var _0x3f9f7a=squel[_0x7622('0x46')]()[_0x7622('0x47')](_0x7622('0x4b'))[_0x7622('0x47')](_0x7622('0x4c'))[_0x7622('0x47')](_0x7622('0x4d'))[_0x7622('0x49')]('user_has_openchannel_interactions','ui')[_0x7622('0x4e')](_0x7622('0x4f'),'u',_0x7622('0x50'));var _0x10f9a4=squel[_0x7622('0x46')]()['from']('openchannel_interactions','i')[_0x7622('0x4e')](_0x7622('0x51'),'c',_0x7622('0x52'))[_0x7622('0x4e')](_0x7622('0x4f'),'o',_0x7622('0x53'))['left_join'](_0x7622('0x54'),'a',_0x7622('0x55'))[_0x7622('0x4e')]('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x7622('0x56'),'it',_0x7622('0x57'))[_0x7622('0x4e')](_0x7622('0x4a'),'t',_0x7622('0x58'));var _0x51a874=squel['expr']();var _0x57f785=[];var _0x9e5764=squel[_0x7622('0x59')]();var _0x1994f1;if(_0x1dc4ce[_0x7622('0x3d')]['search']){_0x1994f1=as[_0x7622('0x5a')](_0x1dc4ce['query'][_0x7622('0x5b')]);var _0x5342ce=_0x1994f1[_0x7622('0x5c')];for(var _0x111896=0x0;_0x111896<_0x1994f1[_0x7622('0x5d')]['length'];_0x111896++){var _0x59fc68=_0x1994f1[_0x7622('0x5d')][_0x111896];var _0x526760='i';var _0x5e72d7=_['find'](_0xc2713b,[_0x7622('0x30'),_0x59fc68[_0x7622('0x47')]]);if(!_0x5e72d7){switch(_0x59fc68[_0x7622('0x47')]){case _0x7622('0x5e'):if(_0x59fc68['value']==0x1){_0x10f9a4['having']('`'+_0x59fc68[_0x7622('0x47')]+_0x7622('0x5f'));}else{_0x10f9a4[_0x7622('0x60')]('`'+_0x59fc68['field']+_0x7622('0x61'));}break;case'Contact':if(_0x59fc68['operator']===_0x7622('0x62')){if(_0x59fc68[_0x7622('0x63')]['split']('\x20')['length']>0x1){_0x51a874[_0x5342ce](_0x7622('0x64'),qs[_0x7622('0x65')](_0x59fc68[_0x7622('0x63')]),null);}else{var _0x37446e='%'+_0x59fc68[_0x7622('0x63')]+'%';_0x51a874[_0x5342ce](_0x7622('0x66'),_0x37446e,_0x37446e,_0x37446e);}}else{_0x5e72d7=_[_0x7622('0x67')](_0xc2713b,[_0x7622('0x30'),_0x7622('0x68')]);_0x59fc68['field']=_0x7622('0x68');_0x18f54a=as[_0x7622('0x69')](_0x526760,_0x5e72d7[_0x7622('0x3b')],_0x59fc68);_0x51a874[_0x5342ce](_0x18f54a['text'],_0x18f54a[_0x7622('0x63')][_0x7622('0x6a')],_0x18f54a[_0x7622('0x63')][_0x7622('0x2e')]);}break;case _0x7622('0x6b'):var _0x2ead29=_0x59fc68[_0x7622('0x63')]['split'](',')[_0x7622('0x32')](function(_0x1d1b61){return Number(_0x1d1b61);});_0x2ead29[_0x7622('0x37')](function(_0x41ddfb){_0x9e5764['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x41ddfb+',%');});_0x57f785=_[_0x7622('0x6c')](_0x57f785,_0x2ead29);break;case _0x7622('0x6d'):if(_0x59fc68[_0x7622('0x6e')]===_0x7622('0x62')){_0x51a874[_0x5342ce](_0x7622('0x6f'),'%'+_0x59fc68[_0x7622('0x63')]+'%',null);}else{_0x5e72d7=_[_0x7622('0x67')](_0xc2713b,[_0x7622('0x30'),_0x7622('0x70')]);_0x59fc68[_0x7622('0x47')]=_0x7622('0x70');_0x18f54a=as[_0x7622('0x69')](_0x526760,_0x5e72d7[_0x7622('0x3b')],_0x59fc68);_0x51a874[_0x5342ce](_0x18f54a[_0x7622('0x71')],_0x18f54a[_0x7622('0x63')][_0x7622('0x6a')],_0x18f54a[_0x7622('0x63')][_0x7622('0x2e')]);}break;case'body':_0x18f54a=as['buildExpression']('me',null,_0x59fc68);_0x51a874[_0x5342ce](_0x18f54a[_0x7622('0x71')],_0x18f54a[_0x7622('0x63')]['start'],_0x18f54a[_0x7622('0x63')][_0x7622('0x2e')]);break;}}else{var _0x18f54a=as[_0x7622('0x69')](_0x526760,_0x5e72d7[_0x7622('0x3b')],_0x59fc68);_0x51a874[_0x5342ce](_0x18f54a[_0x7622('0x71')],_0x18f54a[_0x7622('0x63')][_0x7622('0x6a')],_0x18f54a[_0x7622('0x63')][_0x7622('0x2e')]);}}}else{var _0x2480b8=_(_0x1dc4ce[_0x7622('0x3d')])[_0x7622('0x3e')]()[_0x7622('0x32')](function(_0x1b374c){return _[_0x7622('0x72')](_0xc2713b,['name',_0x1b374c])?_0x1b374c:undefined;})[_0x7622('0x73')]()[_0x7622('0x63')]();if(!_[_0x7622('0x74')](_0x2480b8)){_0x2480b8[_0x7622('0x37')](function(_0x2eb2a8){if(_0x2eb2a8===_0x7622('0x75')){_0x10f9a4[_0x7622('0x76')](_0x7622('0x77'),[][_0x7622('0x78')](_0x1dc4ce[_0x7622('0x3d')][_0x2eb2a8]));}else if(_0x2eb2a8===_0x7622('0x79')){var _0x52cc07=JSON['parse'](_0x1dc4ce[_0x7622('0x3d')][_0x2eb2a8])['$gte'];var _0x287cb5=JSON[_0x7622('0x7a')](_0x1dc4ce[_0x7622('0x3d')][_0x2eb2a8])[_0x7622('0x7b')];_0x10f9a4[_0x7622('0x76')](_0x7622('0x7c'),_0x52cc07,_0x287cb5);}else{if(_0x1dc4ce['query'][_0x2eb2a8]==='null'){_0x10f9a4[_0x7622('0x76')]('i.'+_0x2eb2a8+_0x7622('0x7d'));}else{_0x10f9a4[_0x7622('0x76')]('i.'+_0x2eb2a8+'\x20=\x20?',_0x1dc4ce[_0x7622('0x3d')][_0x2eb2a8]);}}});}if(_0x1dc4ce[_0x7622('0x3d')][_0x7622('0x7e')]){if(_0x1dc4ce['query'][_0x7622('0x7e')]==0x1){_0x10f9a4[_0x7622('0x60')](_0x7622('0x7f'));}else{_0x10f9a4['having'](_0x7622('0x80'));}}if(_0x1dc4ce[_0x7622('0x3d')][_0x7622('0x81')]){_0x57f785=_[_0x7622('0x82')](_0x1dc4ce[_0x7622('0x3d')][_0x7622('0x81')])?_0x1dc4ce['query'][_0x7622('0x81')]:new Array(_0x1dc4ce['query']['tag']);_0x57f785[_0x7622('0x37')](function(_0x21110b){_0x9e5764['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x21110b+',%');});}if(_0x1dc4ce[_0x7622('0x3d')]['filter']){var _0x457d87=_0x1dc4ce['query'][_0x7622('0x83')][_0x7622('0x84')]('\x5c','\x5c\x5c')[_0x7622('0x84')](/'/g,'\x27\x27');if(qs[_0x7622('0x85')](_0x457d87)){_0x51a874['or'](_0x7622('0x86'),_0x457d87+'%');}else{_0x51a874['or'](_0x7622('0x87'),qs[_0x7622('0x65')](_0x457d87))['or'](_0x7622('0x88'),_0x457d87+'%')['or'](_0x7622('0x89'),_0x457d87+'%');}}}_0x10f9a4[_0x7622('0x76')](_0x51a874);_0x10f9a4['group']('i.id');var _0x3e1716={'type':db[_0x7622('0x8a')]['QueryTypes'][_0x7622('0x8b')],'raw':!![]};var _0xf04b82=_0x10f9a4[_0x7622('0x8c')]();_0xf04b82['field'](_0x7622('0x8d'));_0xf04b82['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7622('0x5e'));if(_0x199ac9['order']){_0x199ac9['order']['forEach'](function(_0x5138b3){var _0x51bc31=_0x5138b3[0x0]===_0x7622('0x8e')?_0x5138b3[0x0]:'i.'+_0x5138b3[0x0];_0x10f9a4[_0x7622('0x43')](_0x51bc31,_0x5138b3[0x1]===_0x7622('0x8f')?![]:!![]);});}if(!_[_0x7622('0x74')](_0x57f785)){_0x10f9a4[_0x7622('0x60')](_0x9e5764);_0xf04b82[_0x7622('0x76')]('t.id\x20IN\x20?',_0x57f785);}BPromise[_0x7622('0x90')]()['then'](function(){if(!_0x1994f1){if(_0x1dc4ce['query'][_0x7622('0x75')])return;_0xf04b82['where'](_0x7622('0x91'));_0x10f9a4[_0x7622('0x76')](_0x7622('0x91'));return;}if(_0x1dc4ce[_0x7622('0x92')]['role']!=='agent')return;return _0x1dc4ce[_0x7622('0x92')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x28ca26){if(_[_0x7622('0x74')](_0x28ca26)){_0xf04b82[_0x7622('0x76')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x10f9a4['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0xf04b82['where'](_0x7622('0x77'),_[_0x7622('0x32')](_0x28ca26,'id'));_0x10f9a4['where'](_0x7622('0x77'),_['map'](_0x28ca26,'id'));}});})['then'](function(){if(_0x1dc4ce['user'][_0x7622('0x93')]===_0x7622('0x94')&&!_0x1994f1&&!_0x1dc4ce[_0x7622('0x3d')][_0x7622('0x75')])return[];return db[_0x7622('0x95')][_0x7622('0x3d')](_0xf04b82[_0x7622('0x96')](),_0x3e1716);})[_0x7622('0x2d')](function(_0x194af4){_0x2ba641[_0x7622('0x26')]=_0x194af4[_0x7622('0x97')];if(_0x2ba641['count']===0x0)return[];return db[_0x7622('0x95')]['query'](_0x1445ac['toString'](),_0x3e1716)[_0x7622('0x2d')](function(_0x21925d){_0x157dc2=_[_0x7622('0x98')](_0x21925d,'id');_0x3e1716=_[_0x7622('0x99')](_0x3e1716,{'model':db[_0x7622('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1dc4ce[_0x7622('0x3d')][_0x7622('0x9b')]){_0x199ac9[_0x7622('0x41')][_0x7622('0x37')](function(_0x4ecae5){_0x10f9a4['field']('i.'+_0x4ecae5);});}else{_0x10f9a4['field'](_0x7622('0x9c'),_0x7622('0x5e'));_0x10f9a4[_0x7622('0x47')](_0x7622('0x9d'),_0x7622('0x9e'));_0x10f9a4[_0x7622('0x47')](_0x7622('0x9f'),_0x7622('0xa0'));_0x10f9a4[_0x7622('0x47')](_0x7622('0xa1'),'contactName');_0x10f9a4[_0x7622('0x47')](_0x7622('0xa2'));_0x10f9a4[_0x7622('0x47')](_0x7622('0xa3'),'Contact.firstName');_0x10f9a4[_0x7622('0x47')]('c.lastName',_0x7622('0xa4'));_0x10f9a4['field']('c.email',_0x7622('0xa5'));_0x10f9a4[_0x7622('0x47')](_0x7622('0xa6'),_0x7622('0xa7'));_0x10f9a4['field'](_0x7622('0xa8'),_0x7622('0xa9'));_0x10f9a4['field'](_0x7622('0xaa'),_0x7622('0xab'));_0x10f9a4[_0x7622('0x47')](_0x7622('0xac'),_0x7622('0xad'));_0x10f9a4[_0x7622('0x47')](_0x7622('0xae'),_0x7622('0xaf'));_0x10f9a4[_0x7622('0x47')](_0x7622('0xb0'),_0x7622('0x34'));}if(_0x199ac9[_0x7622('0x25')])_0x10f9a4[_0x7622('0x25')](_0x199ac9[_0x7622('0x25')]);if(_0x199ac9[_0x7622('0x23')])_0x10f9a4['offset'](_0x199ac9['offset']);return db[_0x7622('0x95')]['query'](_0x10f9a4[_0x7622('0x96')](),_0x3e1716);})[_0x7622('0x2d')](function(_0x2d4bab){if(_0x2d4bab['length']>0x0)_0x3f9f7a['where'](_0x7622('0xb1'),_['map'](_0x2d4bab,'id'));return db[_0x7622('0x95')][_0x7622('0x3d')](_0x3f9f7a[_0x7622('0x96')](),_0x3e1716)[_0x7622('0x2d')](function(_0x226cae){var _0xa3d305=_[_0x7622('0xb2')](_0x226cae,_0x7622('0xb3'));var _0x1d0c87=[];_0x2d4bab[_0x7622('0x37')](function(_0x3b65b6){_0x1d0c87[_0x7622('0xb4')](updateOpenchannelInteraction(_0x3b65b6,_0x157dc2,_0xa3d305));});return BPromise[_0x7622('0xb5')](_0x1d0c87);});});})[_0x7622('0x2d')](function(_0x1b506f){_0x2ba641[_0x7622('0xb6')]=_0x1b506f;return _0x2ba641;})[_0x7622('0x2d')](respondWithFilteredResult(_0x4e11d6,_0x199ac9))[_0x7622('0x38')](handleError(_0x4e11d6,null));};exports[_0x7622('0xb7')]=function(_0x446f0f,_0x2b5c43){var _0x340251={};if(_0x446f0f[_0x7622('0x3d')]['type']&&_0x446f0f['query'][_0x7622('0x3b')]===_0x7622('0x49')){_0x340251['from']=_0x446f0f[_0x7622('0xb8')]['id'];}else{_0x340251['id']=_0x446f0f[_0x7622('0xb8')]['id'];}var _0x9f1bb2={'raw':![],'where':_0x340251},_0x3dd0da={};_0x3dd0da['model']=_[_0x7622('0x3e')](db[_0x7622('0x9a')][_0x7622('0x39')]);_0x3dd0da[_0x7622('0x3d')]=_[_0x7622('0x3e')](_0x446f0f[_0x7622('0x3d')]);_0x3dd0da[_0x7622('0x3f')]=_[_0x7622('0x40')](_0x3dd0da[_0x7622('0x3c')],_0x3dd0da[_0x7622('0x3d')]);_0x9f1bb2[_0x7622('0x41')]=_['intersection'](_0x3dd0da['model'],qs[_0x7622('0x9b')](_0x446f0f[_0x7622('0x3d')][_0x7622('0x9b')]));_0x9f1bb2['attributes']=_0x9f1bb2[_0x7622('0x41')][_0x7622('0x97')]?_0x9f1bb2[_0x7622('0x41')]:_0x3dd0da[_0x7622('0x3c')];if(_0x446f0f['query'][_0x7622('0xb9')]){_0x9f1bb2['include']=[{'all':!![]}];}_0x9f1bb2=_[_0x7622('0x99')]({},_0x9f1bb2,_0x446f0f[_0x7622('0xba')]);return db[_0x7622('0x9a')][_0x7622('0x67')](_0x9f1bb2)[_0x7622('0x2d')](handleEntityNotFound(_0x2b5c43,null))[_0x7622('0x2d')](respondWithResult(_0x2b5c43,null))['catch'](handleError(_0x2b5c43,null));};exports[_0x7622('0xbb')]=function(_0x320947,_0x572a93){return db['OpenchannelInteraction'][_0x7622('0xbb')](_0x320947[_0x7622('0xbc')],{})['then'](respondWithResult(_0x572a93,0xc9))['catch'](handleError(_0x572a93,null));};exports[_0x7622('0x2b')]=function(_0x2cff86,_0x362d75){if(_0x2cff86[_0x7622('0xbc')]['id']){delete _0x2cff86['body']['id'];}return db[_0x7622('0x9a')][_0x7622('0x67')]({'where':{'id':_0x2cff86[_0x7622('0xb8')]['id']}})[_0x7622('0x2d')](handleEntityNotFound(_0x362d75,null))[_0x7622('0x2d')](saveUpdates(_0x2cff86[_0x7622('0xbc')],null))[_0x7622('0x2d')](respondWithResult(_0x362d75,null))[_0x7622('0x38')](handleError(_0x362d75,null));};exports['destroy']=function(_0x3c28b6,_0x5b6894){return db[_0x7622('0x9a')][_0x7622('0x67')]({'where':{'id':_0x3c28b6[_0x7622('0xb8')]['id']}})[_0x7622('0x2d')](handleEntityNotFound(_0x5b6894,null))[_0x7622('0x2d')](removeEntity(_0x5b6894,null))[_0x7622('0x38')](handleError(_0x5b6894,null));};exports[_0x7622('0xbd')]=function(_0x1d52cf,_0x4da447){return db['OpenchannelInteraction']['describe']()[_0x7622('0x2d')](respondWithResult(_0x4da447,null))[_0x7622('0x38')](handleError(_0x4da447,null));};exports[_0x7622('0xbe')]=function(_0x4dd18c,_0x14e144,_0x4c197a){return db[_0x7622('0xbf')]['find']({'where':{'id':_0x4dd18c[_0x7622('0xb8')]['id']}})[_0x7622('0x2d')](handleEntityNotFound(_0x14e144,null))['then'](function(_0x762020){if(_0x762020){return _0x762020[_0x7622('0xbe')](_0x4dd18c[_0x7622('0xbc')]['ids'],_[_0x7622('0xc0')](_0x4dd18c['body'],[_0x7622('0xc1'),'id'])||{});}})['then'](respondWithResult(_0x14e144,null))[_0x7622('0x38')](handleError(_0x14e144,null));};exports[_0x7622('0xc2')]=function(_0x1ca062,_0x8860e3,_0x4cca02){var _0x26fe84={'raw':![],'where':{}};var _0x4098f0={};var _0x4550d8={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x7622('0xc3')]({'where':{'id':_0x1ca062[_0x7622('0xb8')]['id']}})[_0x7622('0x2d')](handleEntityNotFound(_0x8860e3,null))[_0x7622('0x2d')](function(_0x590602){if(_0x590602){_0x4098f0[_0x7622('0x3c')]=_[_0x7622('0x3e')](db[_0x7622('0xbf')][_0x7622('0x39')]);_0x4098f0[_0x7622('0x3d')]=_[_0x7622('0x3e')](_0x1ca062[_0x7622('0x3d')]);_0x4098f0['filters']=_[_0x7622('0x40')](_0x4098f0[_0x7622('0x3c')],_0x4098f0[_0x7622('0x3d')]);_0x26fe84[_0x7622('0x41')]=_[_0x7622('0x40')](_0x4098f0[_0x7622('0x3c')],qs[_0x7622('0x9b')](_0x1ca062['query'][_0x7622('0x9b')]));_0x26fe84[_0x7622('0x41')]=_0x26fe84[_0x7622('0x41')][_0x7622('0x97')]?_0x26fe84['attributes']:_0x4098f0['model'];if(!_0x1ca062[_0x7622('0x3d')][_0x7622('0x42')]('nolimit')){_0x26fe84[_0x7622('0x25')]=qs['limit'](_0x1ca062['query']['limit']);_0x26fe84[_0x7622('0x23')]=qs['offset'](_0x1ca062[_0x7622('0x3d')][_0x7622('0x23')]);}_0x26fe84[_0x7622('0x43')]=qs[_0x7622('0x44')](_0x1ca062[_0x7622('0x3d')][_0x7622('0x44')]);_0x26fe84[_0x7622('0x76')]=qs[_0x7622('0x3f')](_['pick'](_0x1ca062[_0x7622('0x3d')],_0x4098f0[_0x7622('0x3f')]));_0x26fe84[_0x7622('0x76')]['OpenchannelInteractionId']=_0x590602['id'];if(_0x1ca062[_0x7622('0x3d')]['filter']){_0x26fe84[_0x7622('0x76')]=_[_0x7622('0x99')](_0x26fe84[_0x7622('0x76')],{'$or':_['map'](_0x26fe84[_0x7622('0x41')],function(_0x60ff7){var _0x31abad={};_0x31abad[_0x60ff7]={'$like':'%'+_0x1ca062[_0x7622('0x3d')][_0x7622('0x83')]+'%'};return _0x31abad;})});}if(_0x1ca062[_0x7622('0x3d')][_0x7622('0xc4')]){var _0x11b607=_0x1ca062[_0x7622('0x3d')]['$gte'][_0x7622('0x36')](',');var _0x2f5dde={};_0x2f5dde[_0x11b607[0x0]]={'$gte':moment(_0x11b607[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x26fe84['where']=_[_0x7622('0x99')](_0x26fe84[_0x7622('0x76')],_0x2f5dde);}_0x26fe84=_[_0x7622('0x99')]({},_0x26fe84,_0x1ca062['options']);return db[_0x7622('0xbf')][_0x7622('0x26')]({'where':_0x26fe84[_0x7622('0x76')]})['then'](function(_0x38f943){_0x4550d8[_0x7622('0x26')]=_0x38f943;if(_0x1ca062[_0x7622('0x3d')][_0x7622('0xb9')]){_0x26fe84['include']=[{'all':!![]}];}return db[_0x7622('0xbf')][_0x7622('0xc5')](_0x26fe84);})[_0x7622('0x2d')](function(_0x1209e3){_0x4550d8[_0x7622('0xb6')]=_0x1209e3;return _0x4550d8;});}})[_0x7622('0x2d')](respondWithFilteredResult(_0x8860e3,_0x26fe84))['catch'](handleError(_0x8860e3,null));};exports[_0x7622('0xc6')]=function(_0x3e6cf6,_0x33e26f,_0x1d0bc9){return db[_0x7622('0x9a')][_0x7622('0x67')]({'where':{'id':_0x3e6cf6['params']['id']}})[_0x7622('0x2d')](handleEntityNotFound(_0x33e26f,null))[_0x7622('0x2d')](function(_0x39c0bc){if(_0x39c0bc){return _0x39c0bc[_0x7622('0xc7')](_0x3e6cf6[_0x7622('0xbc')][_0x7622('0xc1')],_[_0x7622('0xc0')](_0x3e6cf6[_0x7622('0xbc')],[_0x7622('0xc1'),'id'])||{})['spread'](function(){return db['Tag'][_0x7622('0xc5')]({'attributes':['id','name',_0x7622('0x48')],'where':{'id':_0x3e6cf6[_0x7622('0xbc')][_0x7622('0xc1')]}});})[_0x7622('0x2d')](function(_0x1926e5){socket[_0x7622('0xc8')]('openchannelInteractionTags:save',{'id':Number(_0x3e6cf6['params']['id']),'tags':_0x1926e5||[]});return{'id':Number(_0x3e6cf6['params']['id']),'tags':_0x1926e5||[]};});}})[_0x7622('0x2d')](respondWithResult(_0x33e26f,null))[_0x7622('0x38')](handleError(_0x33e26f,null));};exports['removeTags']=function(_0x3f94e5,_0x592321,_0x160f7d){return db['OpenchannelInteraction']['find']({'where':{'id':_0x3f94e5['params']['id']}})[_0x7622('0x2d')](handleEntityNotFound(_0x592321,null))[_0x7622('0x2d')](function(_0x2572ae){if(_0x2572ae){return _0x2572ae[_0x7622('0xc9')](_0x3f94e5[_0x7622('0x3d')]['ids']);}})[_0x7622('0x2d')](respondWithStatusCode(_0x592321,null))[_0x7622('0x38')](handleError(_0x592321,null));};exports[_0x7622('0xca')]=function(_0x4ee48d,_0x28c135){var _0x47f43a=moment()[_0x7622('0xcb')]()[_0x7622('0x96')]();var _0x8f7814=path[_0x7622('0xcc')](config['root'],'server',_0x7622('0xcd'),_0x7622('0xce'));var _0xa1d8e7=path[_0x7622('0xcc')](config['root'],_0x7622('0xcf'),_0x7622('0xcd'),'attachments');var _0x41db3f=path['join'](_0x8f7814,_0x47f43a);var _0x2fd9c9=util[_0x7622('0xd0')](_0x7622('0xd1'),_0x4ee48d[_0x7622('0xb8')]['id'],_0x47f43a);var _0x44ab9e=path['join'](_0x8f7814,_0x2fd9c9);var _0x3cbe85=[];_0x3cbe85['push']({'model':db[_0x7622('0x6d')],'as':_0x7622('0x6d'),'attributes':['id',_0x7622('0x33')],'raw':!![]});_0x3cbe85[_0x7622('0xb4')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x7622('0xd2'),'lastName'],'raw':!![]});if(_0x4ee48d['query']['attachments']){_0x3cbe85[_0x7622('0xb4')]({'model':db[_0x7622('0xd3')],'as':'Attachment','raw':!![]});}var _0x9a7101=[{'model':db[_0x7622('0xbf')],'as':_0x7622('0xd4'),'attributes':['id','body',_0x7622('0x79'),_0x7622('0xd5'),_0x7622('0xd6'),_0x7622('0x7e')],'include':_0x3cbe85}];_0x9a7101[_0x7622('0xb4')]({'model':db[_0x7622('0xd7')],'as':_0x7622('0xd8'),'attributes':['id',_0x7622('0x30')]});_0x9a7101[_0x7622('0xb4')]({'model':db[_0x7622('0x6d')],'as':_0x7622('0xd9'),'attributes':['id','fullname']});return db[_0x7622('0x9a')][_0x7622('0x67')]({'where':{'id':_0x4ee48d[_0x7622('0xb8')]['id']},'include':_0x9a7101})['then'](handleEntityNotFound(_0x28c135,null))[_0x7622('0x2d')](function(_0x36a890){if(_0x36a890){var _0x198494=_0x36a890[_0x7622('0xda')]({'plain':!![]});fs[_0x7622('0xdb')](_0x41db3f);var _0x2b97f4={'channel':_0x7622('0xdc'),'account':_0x198494[_0x7622('0xd8')][_0x7622('0x30')],'agent':_0x198494['Owner']?_0x198494['Owner'][_0x7622('0x33')]:_0x7622('0xdd'),'createdAt':moment(_0x198494[_0x7622('0x79')])[_0x7622('0xd0')](_0x7622('0xde'))['toString'](),'closedAt':_0x198494[_0x7622('0xdf')]?moment(_0x198494['closedAt'])[_0x7622('0xd0')](_0x7622('0xde'))[_0x7622('0x96')]():'','disposition':_0x198494[_0x7622('0xe0')],'visibility':_0x198494['threadId']?_0x7622('0xe1'):_0x7622('0xe2'),'messages':_(_0x198494[_0x7622('0xd4')])['filter']({'secret':![]})[_0x7622('0x32')](function(_0x2e73ea){if(_0x2e73ea['Attachment']){var _0x8e69b9=path['join'](_0xa1d8e7,_0x2e73ea[_0x7622('0xd3')]['basename']);if(fs['existsSync'](_0x8e69b9)){fs['createReadStream'](_0x8e69b9)[_0x7622('0xe3')](fs[_0x7622('0xe4')](path['join'](_0x41db3f,_0x2e73ea[_0x7622('0xd3')][_0x7622('0xe5')])));}}return{'date':moment(_0x2e73ea['createdAt'])[_0x7622('0xd0')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7622('0x96')](),'sender':_0x2e73ea[_0x7622('0xd5')]==='out'?_0x2e73ea[_0x7622('0x6d')]?_0x2e73ea[_0x7622('0x6d')]['fullname']:_0x7622('0xe6'):_0x2e73ea[_0x7622('0xe7')][_0x7622('0xd2')]+(_0x2e73ea['Contact'][_0x7622('0xe8')]?'\x20'+_0x2e73ea[_0x7622('0xe7')]['lastName']:''),'body':_0x2e73ea[_0x7622('0xd3')]?_0x2e73ea['Attachment'][_0x7622('0xe5')]:_0x2e73ea['body'],'direction':_0x2e73ea['direction']===_0x7622('0xe9')?'A':'C','secret':_0x2e73ea['secret'],'read':_0x2e73ea[_0x7622('0x7e')],'attachment':_0x2e73ea['Attachment']};})[_0x7622('0x63')]()};return ejs['renderFile'](path[_0x7622('0xcc')](config[_0x7622('0xea')],'server',_0x7622('0xeb'),_0x7622('0xec')),{'interaction':_0x2b97f4})[_0x7622('0x2d')](function(_0x10e517){var _0x50af57=path[_0x7622('0xcc')](_0x41db3f,_0x7622('0xed')+_0x198494['id']+'-'+_0x47f43a+_0x7622('0xee'));var _0x167399={'path':_0x50af57,'channel':_0x7622('0xdc'),'interactionId':_0x198494['id']};return pdf[_0x7622('0xef')](_0x10e517,_0x167399);})[_0x7622('0x2d')](function(){return new BPromise(function(_0x2ce459,_0x3865e4){zipdir(_0x41db3f,{'saveTo':_0x44ab9e},function(_0x349839,_0x37b8e9){if(_0x349839)return _0x3865e4(_0x349839);return _0x2ce459(_0x37b8e9);});})[_0x7622('0x2d')](function(){return new BPromise(function(_0x2faffc,_0x4cb4dc){rimraf(_0x41db3f,function(_0x1b7560){if(_0x1b7560)_0x4cb4dc(_0x1b7560);return _0x2faffc();});});})['then'](function(){return _0x28c135['download'](_0x44ab9e,_0x2fd9c9,function(_0x364807){if(_0x364807){console['log'](_0x7622('0xf0'),_0x364807);}else{fs[_0x7622('0xf1')](_0x44ab9e);}});});});}else{return _0x28c135[_0x7622('0x20')](0xc8);}})[_0x7622('0x38')](handleError(_0x28c135,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 0e42761..ba4e299 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 _0x13dd=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','events','OpenchannelInteraction','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x22c293,_0x24fba9){var _0x1536d3=function(_0x109b36){while(--_0x109b36){_0x22c293['push'](_0x22c293['shift']());}};_0x1536d3(++_0x24fba9);}(_0x13dd,0x109));var _0xd13d=function(_0x193bfb,_0x57b53e){_0x193bfb=_0x193bfb-0x0;var _0xdb73de=_0x13dd[_0x193bfb];return _0xdb73de;};'use strict';var EventEmitter=require(_0xd13d('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xd13d('0x1')];var OpenchannelMessage=require(_0xd13d('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd13d('0x3')](0x0);var events={'afterCreate':_0xd13d('0x4'),'afterUpdate':_0xd13d('0x5'),'afterDestroy':_0xd13d('0x6')};function emitEvent(_0x76e520){return function(_0x6c2d8f,_0x1e96ba,_0x29057b){_0x6c2d8f[_0xd13d('0x7')]({'attributes':['id'],'raw':!![]})[_0xd13d('0x8')](function(_0x5a32ee){_0x6c2d8f[_0xd13d('0x9')](_0xd13d('0xa'),_0x5a32ee[_0xd13d('0xb')](function(_0x225ded){return{'id':_0x225ded['id']};}));return OpenchannelMessage[_0xd13d('0xc')]({'where':{'OpenchannelInteractionId':_0x6c2d8f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd13d('0x8')](function(_0x17c999){_0x6c2d8f[_0xd13d('0x9')](_0xd13d('0xd'),_0x17c999[_0xd13d('0xe')]);OpenchannelInteractionEvents[_0xd13d('0xf')](_0x76e520+':'+_0x6c2d8f['id'],_0x6c2d8f);OpenchannelInteractionEvents[_0xd13d('0xf')](_0x76e520,_0x6c2d8f);_0x29057b(null);})[_0xd13d('0x10')](_0x29057b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2a1b=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','remove','getUsers','setDataValue','map','findAll','then'];(function(_0x24be00,_0x5e79f8){var _0x52b938=function(_0x31fae8){while(--_0x31fae8){_0x24be00['push'](_0x24be00['shift']());}};_0x52b938(++_0x5e79f8);}(_0x2a1b,0x149));var _0xb2a1=function(_0x1e342c,_0x2c2d83){_0x1e342c=_0x1e342c-0x0;var _0x55ce78=_0x2a1b[_0x1e342c];return _0x55ce78;};'use strict';var EventEmitter=require(_0xb2a1('0x0'));var OpenchannelInteraction=require(_0xb2a1('0x1'))['db'][_0xb2a1('0x2')];var OpenchannelMessage=require(_0xb2a1('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb2a1('0x3')](0x0);var events={'afterCreate':_0xb2a1('0x4'),'afterUpdate':'update','afterDestroy':_0xb2a1('0x5')};function emitEvent(_0x43b90b){return function(_0x580322,_0x29186e,_0x7d38d2){_0x580322[_0xb2a1('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x32a1ab){_0x580322[_0xb2a1('0x7')]('Users',_0x32a1ab[_0xb2a1('0x8')](function(_0x22dc74){return{'id':_0x22dc74['id']};}));return OpenchannelMessage[_0xb2a1('0x9')]({'where':{'OpenchannelInteractionId':_0x580322['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb2a1('0xa')](function(_0x45055f){_0x580322[_0xb2a1('0x7')](_0xb2a1('0xb'),_0x45055f[_0xb2a1('0xc')]);OpenchannelInteractionEvents['emit'](_0x43b90b+':'+_0x580322['id'],_0x580322);OpenchannelInteractionEvents[_0xb2a1('0xd')](_0x43b90b,_0x580322);_0x7d38d2(null);})[_0xb2a1('0xe')](_0x7d38d2(null));};}for(var e in events){if(events[_0xb2a1('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xb2a1('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index ec1eb73..7a8ddb7 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 _0xab86=['path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird'];(function(_0x3cbd72,_0x384831){var _0x54eb7e=function(_0x241051){while(--_0x241051){_0x3cbd72['push'](_0x3cbd72['shift']());}};_0x54eb7e(++_0x384831);}(_0xab86,0x13e));var _0x6ab8=function(_0x2b0ee6,_0x528f7d){_0x2b0ee6=_0x2b0ee6-0x0;var _0x411283=_0xab86[_0x2b0ee6];return _0x411283;};'use strict';var _=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var logger=require(_0x6ab8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ab8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ab8('0x4'));var rimraf=require('rimraf');var config=require(_0x6ab8('0x5'));var attributes=require(_0x6ab8('0x6'));module[_0x6ab8('0x7')]=function(_0x154d17,_0x6f41f){return _0x154d17[_0x6ab8('0x8')](_0x6ab8('0x9'),attributes,{'tableName':_0x6ab8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x363c5e,_0x42c273,_0x2b429d){if(_0x363c5e[_0x6ab8('0xb')](_0x6ab8('0xc'))){_0x363c5e['closedAt']=moment()['format'](_0x6ab8('0xd'));}_0x2b429d(null,_0x363c5e);}}});}; \ No newline at end of file +var _0xf767=['api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','changed','closed','format','util','../../config/logger'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xf767,0x76));var _0x7f76=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0xf767[_0x4f2c3a];return _0x17d91c;};'use strict';var _=require('lodash');var util=require(_0x7f76('0x0'));var logger=require(_0x7f76('0x1'))(_0x7f76('0x2'));var moment=require(_0x7f76('0x3'));var BPromise=require(_0x7f76('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f76('0x5'));var rimraf=require(_0x7f76('0x6'));var config=require(_0x7f76('0x7'));var attributes=require(_0x7f76('0x8'));module['exports']=function(_0x23c243,_0x2f2588){return _0x23c243[_0x7f76('0x9')](_0x7f76('0xa'),attributes,{'tableName':_0x7f76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5acfee,_0x8b5dce,_0x109950){if(_0x5acfee[_0x7f76('0xc')](_0x7f76('0xd'))){_0x5acfee['closedAt']=moment()[_0x7f76('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x109950(null,_0x5acfee);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 49ced64..3860acd 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 _0xba6c=['AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','ids','omit','spread'];(function(_0x135904,_0x1e252b){var _0x1ce7d5=function(_0x25a721){while(--_0x25a721){_0x135904['push'](_0x135904['shift']());}};_0x1ce7d5(++_0x1e252b);}(_0xba6c,0xc4));var _0xcba6=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0xba6c[_0x9e0cb3];return _0x5926b7;};'use strict';var _=require(_0xcba6('0x0'));var util=require('util');var moment=require(_0xcba6('0x1'));var BPromise=require(_0xcba6('0x2'));var rs=require(_0xcba6('0x3'));var fs=require('fs');var Redis=require(_0xcba6('0x4'));var db=require(_0xcba6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcba6('0x6'))(_0xcba6('0x7'));var config=require(_0xcba6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcba6('0x9')][_0xcba6('0xa')]({'port':0x232a});config[_0xcba6('0xb')]=_[_0xcba6('0xc')](config[_0xcba6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcba6('0xd'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xcba6('0xe')](socket);function respondWithRpcPromise(_0x52d697,_0x5e8229,_0x441c62){return new BPromise(function(_0x5b8a10,_0x27bc82){return client[_0xcba6('0xf')](_0x52d697,_0x441c62)[_0xcba6('0x10')](function(_0x18a1fc){logger['info'](_0xcba6('0x11'),_0x5e8229,_0xcba6('0x12'));logger[_0xcba6('0x13')](_0xcba6('0x14'),_0x5e8229,_0xcba6('0x12'),JSON[_0xcba6('0x15')](_0x18a1fc));if(_0x18a1fc[_0xcba6('0x16')]){if(_0x18a1fc['error']['code']===0x1f4){logger[_0xcba6('0x16')](_0xcba6('0x11'),_0x5e8229,_0x18a1fc[_0xcba6('0x16')][_0xcba6('0x17')]);return _0x27bc82(_0x18a1fc[_0xcba6('0x16')][_0xcba6('0x17')]);}logger[_0xcba6('0x16')](_0xcba6('0x11'),_0x5e8229,_0x18a1fc[_0xcba6('0x16')][_0xcba6('0x17')]);return _0x5b8a10(_0x18a1fc[_0xcba6('0x16')][_0xcba6('0x17')]);}else{logger[_0xcba6('0x18')](_0xcba6('0x11'),_0x5e8229,_0xcba6('0x12'));_0x5b8a10(_0x18a1fc['result'][_0xcba6('0x17')]);}})['catch'](function(_0x3570f4){logger[_0xcba6('0x16')](_0xcba6('0x11'),_0x5e8229,_0x3570f4);_0x27bc82(_0x3570f4);});});}exports[_0xcba6('0x19')]=function(_0x5b0bc4){var _0x23f70e=this;return new Promise(function(_0x48629d,_0x51ffd2){return db[_0xcba6('0x1a')][_0xcba6('0x1b')](_0x5b0bc4[_0xcba6('0x1c')],{'raw':_0x5b0bc4[_0xcba6('0x1d')]?_0x5b0bc4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b0bc4[_0xcba6('0x1d')]?_0x5b0bc4[_0xcba6('0x1d')][_0xcba6('0x1e')]||null:null,'attributes':_0x5b0bc4[_0xcba6('0x1d')]?_0x5b0bc4['options'][_0xcba6('0x1f')]||null:null,'limit':_0x5b0bc4['options']?_0x5b0bc4[_0xcba6('0x1d')][_0xcba6('0x20')]||null:null})[_0xcba6('0x10')](function(_0x3d650a){logger['info'](_0xcba6('0x19'),_0x5b0bc4);logger[_0xcba6('0x13')]('UpdateOpenchannelInteraction',_0x5b0bc4,JSON[_0xcba6('0x15')](_0x3d650a));_0x48629d(_0x3d650a);})[_0xcba6('0x21')](function(_0x31872f){logger[_0xcba6('0x16')]('UpdateOpenchannelInteraction',_0x31872f[_0xcba6('0x17')],_0x5b0bc4);_0x51ffd2(_0x23f70e[_0xcba6('0x16')](0x1f4,_0x31872f['message']));});});};exports[_0xcba6('0x22')]=function(_0x1d34d6){return new Promise(function(_0x2f81f5,_0x56c264){return db[_0xcba6('0x1a')]['find']({'where':_0x1d34d6[_0xcba6('0x1d')]?_0x1d34d6[_0xcba6('0x1d')]['where']||null:null})[_0xcba6('0x10')](function(_0x570a5e){if(_0x570a5e){return _0x570a5e['addTags'](_0x1d34d6[_0xcba6('0x1c')][_0xcba6('0x23')],_[_0xcba6('0x24')](_0x1d34d6[_0xcba6('0x1c')],[_0xcba6('0x23'),'id'])||{});}})[_0xcba6('0x25')](function(_0x5d993f){logger['info'](_0xcba6('0x26'),_0x1d34d6);logger[_0xcba6('0x13')](_0xcba6('0x26'),_0x1d34d6,JSON[_0xcba6('0x15')](_0x5d993f));_0x2f81f5(_0x5d993f);})[_0xcba6('0x21')](function(_0x138703){logger['error'](_0xcba6('0x26'),_0x138703['message'],_0x1d34d6);_0x56c264(_this[_0xcba6('0x16')](0x1f4,_0x138703[_0xcba6('0x17')]));});});}; \ No newline at end of file +var _0x5bd2=['request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','update','body','options','raw','where','attributes','then','UpdateOpenchannelInteraction','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','spread','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0x44f219,_0x5ba966){var _0x17618=function(_0x4ca85f){while(--_0x4ca85f){_0x44f219['push'](_0x44f219['shift']());}};_0x17618(++_0x5ba966);}(_0x5bd2,0x1ad));var _0x25bd=function(_0x35d0d3,_0x1d1e05){_0x35d0d3=_0x35d0d3-0x0;var _0x19ee13=_0x5bd2[_0x35d0d3];return _0x19ee13;};'use strict';var _=require(_0x25bd('0x0'));var util=require(_0x25bd('0x1'));var moment=require(_0x25bd('0x2'));var BPromise=require(_0x25bd('0x3'));var rs=require(_0x25bd('0x4'));var fs=require('fs');var Redis=require(_0x25bd('0x5'));var db=require(_0x25bd('0x6'))['db'];var utils=require(_0x25bd('0x7'));var logger=require(_0x25bd('0x8'))(_0x25bd('0x9'));var config=require(_0x25bd('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x25bd('0xb')][_0x25bd('0xc')]({'port':0x232a});config[_0x25bd('0xd')]=_[_0x25bd('0xe')](config[_0x25bd('0xd')],{'host':_0x25bd('0xf'),'port':0x18eb});var socket=require(_0x25bd('0x10'))(new Redis(config[_0x25bd('0xd')]));require(_0x25bd('0x11'))['register'](socket);function respondWithRpcPromise(_0x24c931,_0x40f28e,_0x5e1d52){return new BPromise(function(_0x47b831,_0x9312b2){return client[_0x25bd('0x12')](_0x24c931,_0x5e1d52)['then'](function(_0x3402fe){logger[_0x25bd('0x13')](_0x25bd('0x14'),_0x40f28e,_0x25bd('0x15'));logger[_0x25bd('0x16')](_0x25bd('0x17'),_0x40f28e,_0x25bd('0x15'),JSON['stringify'](_0x3402fe));if(_0x3402fe[_0x25bd('0x18')]){if(_0x3402fe[_0x25bd('0x18')][_0x25bd('0x19')]===0x1f4){logger[_0x25bd('0x18')](_0x25bd('0x14'),_0x40f28e,_0x3402fe[_0x25bd('0x18')][_0x25bd('0x1a')]);return _0x9312b2(_0x3402fe[_0x25bd('0x18')][_0x25bd('0x1a')]);}logger[_0x25bd('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x40f28e,_0x3402fe[_0x25bd('0x18')]['message']);return _0x47b831(_0x3402fe['error'][_0x25bd('0x1a')]);}else{logger['info'](_0x25bd('0x14'),_0x40f28e,'request\x20sent');_0x47b831(_0x3402fe[_0x25bd('0x1b')][_0x25bd('0x1a')]);}})[_0x25bd('0x1c')](function(_0xf2d556){logger[_0x25bd('0x18')](_0x25bd('0x14'),_0x40f28e,_0xf2d556);_0x9312b2(_0xf2d556);});});}exports['UpdateOpenchannelInteraction']=function(_0x444873){var _0x1a1f28=this;return new Promise(function(_0x3c8ecb,_0x17e659){return db['OpenchannelInteraction'][_0x25bd('0x1d')](_0x444873[_0x25bd('0x1e')],{'raw':_0x444873[_0x25bd('0x1f')]?_0x444873[_0x25bd('0x1f')][_0x25bd('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x444873['options']?_0x444873['options'][_0x25bd('0x21')]||null:null,'attributes':_0x444873[_0x25bd('0x1f')]?_0x444873[_0x25bd('0x1f')][_0x25bd('0x22')]||null:null,'limit':_0x444873[_0x25bd('0x1f')]?_0x444873[_0x25bd('0x1f')]['limit']||null:null})[_0x25bd('0x23')](function(_0x24f503){logger['info'](_0x25bd('0x24'),_0x444873);logger[_0x25bd('0x16')](_0x25bd('0x24'),_0x444873,JSON[_0x25bd('0x25')](_0x24f503));_0x3c8ecb(_0x24f503);})['catch'](function(_0x1434b8){logger[_0x25bd('0x18')](_0x25bd('0x24'),_0x1434b8[_0x25bd('0x1a')],_0x444873);_0x17e659(_0x1a1f28[_0x25bd('0x18')](0x1f4,_0x1434b8[_0x25bd('0x1a')]));});});};exports[_0x25bd('0x26')]=function(_0x5bd354){return new Promise(function(_0x1db4b0,_0x5d67bc){return db[_0x25bd('0x27')][_0x25bd('0x28')]({'where':_0x5bd354['options']?_0x5bd354['options'][_0x25bd('0x21')]||null:null})[_0x25bd('0x23')](function(_0x16f9b1){if(_0x16f9b1){return _0x16f9b1[_0x25bd('0x29')](_0x5bd354[_0x25bd('0x1e')][_0x25bd('0x2a')],_[_0x25bd('0x2b')](_0x5bd354[_0x25bd('0x1e')],[_0x25bd('0x2a'),'id'])||{});}})[_0x25bd('0x2c')](function(_0x5d9545){logger[_0x25bd('0x13')]('AddTags',_0x5bd354);logger[_0x25bd('0x16')]('AddTags',_0x5bd354,JSON[_0x25bd('0x25')](_0x5d9545));_0x1db4b0(_0x5d9545);})[_0x25bd('0x1c')](function(_0x1ed308){logger['error']('AddTags',_0x1ed308[_0x25bd('0x1a')],_0x5bd354);_0x5d67bc(_this[_0x25bd('0x18')](0x1f4,_0x1ed308['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index e67567a..075bed3 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 _0x5b74=['openchannelInteraction:','./openchannelInteraction.events','save','update','emit','register','length'];(function(_0x3d355d,_0x2c293b){var _0x116871=function(_0x3010be){while(--_0x3010be){_0x3d355d['push'](_0x3d355d['shift']());}};_0x116871(++_0x2c293b);}(_0x5b74,0x14a));var _0x45b7=function(_0x25ab3a,_0x2471f6){_0x25ab3a=_0x25ab3a-0x0;var _0x2fc15e=_0x5b74[_0x25ab3a];return _0x2fc15e;};'use strict';var OpenchannelInteractionEvents=require(_0x45b7('0x0'));var events=[_0x45b7('0x1'),'remove',_0x45b7('0x2')];function createListener(_0x194ded,_0x16ab28){return function(_0xfcd51f){_0x16ab28[_0x45b7('0x3')](_0x194ded,_0xfcd51f);};}function removeListener(_0x29c1b6,_0x3b326a){return function(){OpenchannelInteractionEvents['removeListener'](_0x29c1b6,_0x3b326a);};}exports[_0x45b7('0x4')]=function(_0x34eee5){for(var _0x49b8d8=0x0,_0x346bd6=events[_0x45b7('0x5')];_0x49b8d8<_0x346bd6;_0x49b8d8++){var _0x1dfb28=events[_0x49b8d8];var _0x313197=createListener(_0x45b7('0x6')+_0x1dfb28,_0x34eee5);OpenchannelInteractionEvents['on'](_0x1dfb28,_0x313197);}}; \ No newline at end of file +var _0xf934=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','remove'];(function(_0x209695,_0x5b8a65){var _0x4fe699=function(_0x2ab66e){while(--_0x2ab66e){_0x209695['push'](_0x209695['shift']());}};_0x4fe699(++_0x5b8a65);}(_0xf934,0x108));var _0x4f93=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xf934[_0x45d3f0];return _0x314b79;};'use strict';var OpenchannelInteractionEvents=require(_0x4f93('0x0'));var events=['save',_0x4f93('0x1'),'update'];function createListener(_0x9fcd4a,_0x577f35){return function(_0x215668){_0x577f35[_0x4f93('0x2')](_0x9fcd4a,_0x215668);};}function removeListener(_0x4e68e9,_0xe15d68){return function(){OpenchannelInteractionEvents[_0x4f93('0x3')](_0x4e68e9,_0xe15d68);};}exports[_0x4f93('0x4')]=function(_0x29e86e){for(var _0x3e37f8=0x0,_0x5ca6da=events[_0x4f93('0x5')];_0x3e37f8<_0x5ca6da;_0x3e37f8++){var _0x209192=events[_0x3e37f8];var _0x12dcf7=createListener(_0x4f93('0x6')+_0x209192,_0x29e86e);OpenchannelInteractionEvents['on'](_0x209192,_0x12dcf7);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 26c663f..c2205a2 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 _0xa742=['put','/:id','update','/:id/accept','accept','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','show','post','tracked','openchannelmessage:create','create'];(function(_0x44a5fb,_0xbc78f6){var _0x92da28=function(_0x181a4e){while(--_0x181a4e){_0x44a5fb['push'](_0x44a5fb['shift']());}};_0x92da28(++_0xbc78f6);}(_0xa742,0x126));var _0x2a74=function(_0x5843f3,_0x3a6b52){_0x5843f3=_0x5843f3-0x0;var _0x30976c=_0xa742[_0x5843f3];return _0x30976c;};'use strict';var multer=require(_0x2a74('0x0'));var util=require(_0x2a74('0x1'));var path=require(_0x2a74('0x2'));var timeout=require(_0x2a74('0x3'));var express=require(_0x2a74('0x4'));var router=express[_0x2a74('0x5')]();var fs_extra=require(_0x2a74('0x6'));var auth=require(_0x2a74('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2a74('0x8'));var controller=require(_0x2a74('0x9'));router[_0x2a74('0xa')]('/',auth[_0x2a74('0xb')](),controller['index']);router['get'](_0x2a74('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x2a74('0xa')]('/:id',auth[_0x2a74('0xb')](),controller[_0x2a74('0xd')]);router[_0x2a74('0xe')]('/',auth['isAuthenticated'](),interaction[_0x2a74('0xf')]('openchannel',_0x2a74('0x10')),controller[_0x2a74('0x11')]);router[_0x2a74('0x12')](_0x2a74('0x13'),auth[_0x2a74('0xb')](),controller[_0x2a74('0x14')]);router[_0x2a74('0x12')](_0x2a74('0x15'),auth['isAuthenticated'](),controller[_0x2a74('0x16')]);router[_0x2a74('0x12')]('/:id/reject',auth[_0x2a74('0xb')](),controller[_0x2a74('0x17')]);router[_0x2a74('0x18')](_0x2a74('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x2a74('0x19')]=router; \ No newline at end of file +var _0x6d08=['put','update','accept','/:id/reject','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','tracked','openchannelmessage:create','create'];(function(_0x1452e1,_0x14804d){var _0x101e61=function(_0x1c64b8){while(--_0x1c64b8){_0x1452e1['push'](_0x1452e1['shift']());}};_0x101e61(++_0x14804d);}(_0x6d08,0x13d));var _0x86d0=function(_0x3b57fc,_0x1fbf22){_0x3b57fc=_0x3b57fc-0x0;var _0x146f10=_0x6d08[_0x3b57fc];return _0x146f10;};'use strict';var multer=require(_0x86d0('0x0'));var util=require(_0x86d0('0x1'));var path=require(_0x86d0('0x2'));var timeout=require(_0x86d0('0x3'));var express=require(_0x86d0('0x4'));var router=express[_0x86d0('0x5')]();var fs_extra=require(_0x86d0('0x6'));var auth=require(_0x86d0('0x7'));var interaction=require(_0x86d0('0x8'));var config=require(_0x86d0('0x9'));var controller=require(_0x86d0('0xa'));router['get']('/',auth[_0x86d0('0xb')](),controller[_0x86d0('0xc')]);router[_0x86d0('0xd')](_0x86d0('0xe'),auth[_0x86d0('0xb')](),controller[_0x86d0('0xf')]);router['get'](_0x86d0('0x10'),auth['isAuthenticated'](),controller[_0x86d0('0x11')]);router['post']('/',auth[_0x86d0('0xb')](),interaction[_0x86d0('0x12')]('openchannel',_0x86d0('0x13')),controller[_0x86d0('0x14')]);router[_0x86d0('0x15')](_0x86d0('0x10'),auth[_0x86d0('0xb')](),controller[_0x86d0('0x16')]);router[_0x86d0('0x15')]('/:id/accept',auth[_0x86d0('0xb')](),controller[_0x86d0('0x17')]);router[_0x86d0('0x15')](_0x86d0('0x18'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x86d0('0x10'),auth[_0x86d0('0xb')](),controller['destroy']);module[_0x86d0('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index c815e93..3131a96 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 _0xcead=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x592e69,_0x239a2a){var _0x2abe31=function(_0x506043){while(--_0x506043){_0x592e69['push'](_0x592e69['shift']());}};_0x2abe31(++_0x239a2a);}(_0xcead,0xe7));var _0xdcea=function(_0xc4598e,_0x24dc29){_0xc4598e=_0xc4598e-0x0;var _0x47ce48=_0xcead[_0xc4598e];return _0x47ce48;};'use strict';var Sequelize=require(_0xdcea('0x0'));module[_0xdcea('0x1')]={'body':{'type':Sequelize[_0xdcea('0x2')](_0xdcea('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdcea('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xdcea('0x5')]('in','out'),'defaultValue':_0xdcea('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xdcea('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4e1f=['TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x42548f,_0x2e00ff){var _0x2370eb=function(_0x413d7a){while(--_0x413d7a){_0x42548f['push'](_0x42548f['shift']());}};_0x2370eb(++_0x2e00ff);}(_0x4e1f,0x67));var _0xf4e1=function(_0x1e6c2a,_0x569ae7){_0x1e6c2a=_0x1e6c2a-0x0;var _0x25228e=_0x4e1f[_0x1e6c2a];return _0x25228e;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xf4e1('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0xf4e1('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf4e1('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf4e1('0x2')]('in',_0xf4e1('0x3')),'defaultValue':_0xf4e1('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xf4e1('0x4')]},'providerResponse':{'type':Sequelize[_0xf4e1('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 072ee78..188197f 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 _0x9ffd=['body','find','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','CmContact','startsWith','cf_','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','SELECT','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','OpenchannelMessage','include','findAll','catch','show','params','rawAttributes','includeAll','create'];(function(_0x1f7962,_0x181f16){var _0x3af491=function(_0x504ecf){while(--_0x504ecf){_0x1f7962['push'](_0x1f7962['shift']());}};_0x3af491(++_0x181f16);}(_0x9ffd,0xaa));var _0xd9ff=function(_0xe4a65,_0xa8a70a){_0xe4a65=_0xe4a65-0x0;var _0x6dab9f=_0x9ffd[_0xe4a65];return _0x6dab9f;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];config['redis']=_['defaults'](config[_0xd9ff('0x1a')],{'host':_0xd9ff('0x1b'),'port':0x18eb});var socket=require(_0xd9ff('0x1c'))(new Redis(config[_0xd9ff('0x1a')]));require(_0xd9ff('0x1d'))['register'](socket);var jayson=require(_0xd9ff('0x1e'));var client=jayson[_0xd9ff('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xd9ff('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ffe54,_0x547e28,_0x4c5718,_0x271287){return new BPromise(function(_0x4f9d6d,_0x35679e){var _0xa30fd2=_0x271287||client;return _0xa30fd2[_0xd9ff('0x20')](_0x4ffe54,_0x4c5718)[_0xd9ff('0x21')](function(_0x5f45c4){logger[_0xd9ff('0x22')](_0xd9ff('0x23'),_0x547e28,_0xd9ff('0x24'));logger[_0xd9ff('0x25')](_0xd9ff('0x26'),_0x547e28,_0xd9ff('0x24'),JSON[_0xd9ff('0x27')](_0x5f45c4));if(_0x5f45c4[_0xd9ff('0x28')]){if(_0x5f45c4['error']['code']===0x1f4){logger[_0xd9ff('0x28')](_0xd9ff('0x23'),_0x547e28,_0x5f45c4['error']['message']);return _0x35679e(_0x5f45c4['error']['message']);}logger[_0xd9ff('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x547e28,_0x5f45c4[_0xd9ff('0x28')][_0xd9ff('0x29')]);return _0x4f9d6d(_0x5f45c4[_0xd9ff('0x28')][_0xd9ff('0x29')]);}else{logger[_0xd9ff('0x22')](_0xd9ff('0x23'),_0x547e28,'request\x20sent');_0x4f9d6d(_0x5f45c4['result'][_0xd9ff('0x29')]);}})['catch'](function(_0x3ca906){logger['error'](_0xd9ff('0x23'),_0x547e28,_0x3ca906);_0x35679e(_0x3ca906);});});}function respondWithStatusCode(_0x5d45b3,_0x10cbdd){_0x10cbdd=_0x10cbdd||0xcc;return function(_0x159e56){if(_0x159e56){return _0x5d45b3[_0xd9ff('0x2a')](_0x10cbdd);}return _0x5d45b3[_0xd9ff('0x2b')](_0x10cbdd)['end']();};}function respondWithResult(_0x11a17b,_0xe11f88){_0xe11f88=_0xe11f88||0xc8;return function(_0x1c78c4){if(_0x1c78c4){return _0x11a17b[_0xd9ff('0x2b')](_0xe11f88)['json'](_0x1c78c4);}};}function respondWithFilteredResult(_0x1d3684,_0x3792d9){return function(_0x44b5a7){if(_0x44b5a7){var _0x45fb63=typeof _0x3792d9[_0xd9ff('0x2c')]===_0xd9ff('0x2d')&&typeof _0x3792d9[_0xd9ff('0x2e')]===_0xd9ff('0x2d');var _0x3dc443=_0x44b5a7['count'];var _0xcea5db=_0x45fb63?0x0:_0x3792d9['offset'];var _0x1d55fd=_0x45fb63?_0x44b5a7[_0xd9ff('0x2f')]:_0x3792d9[_0xd9ff('0x2c')]+_0x3792d9['limit'];var _0x2ba4d3;if(_0x1d55fd>=_0x3dc443){_0x1d55fd=_0x3dc443;_0x2ba4d3=0xc8;}else{_0x2ba4d3=0xce;}_0x1d3684[_0xd9ff('0x2b')](_0x2ba4d3);return _0x1d3684[_0xd9ff('0x30')](_0xd9ff('0x31'),_0xcea5db+'-'+_0x1d55fd+'/'+_0x3dc443)['json'](_0x44b5a7);}return null;};}function patchUpdates(_0x41adb1){return function(_0x5743de){try{jsonpatch[_0xd9ff('0x32')](_0x5743de,_0x41adb1,!![]);}catch(_0x2419f5){return BPromise[_0xd9ff('0x33')](_0x2419f5);}return _0x5743de[_0xd9ff('0x34')]();};}function saveUpdates(_0x20685b,_0xdf3947){return function(_0x2cc2ae){if(_0x2cc2ae){return _0x2cc2ae[_0xd9ff('0x35')](_0x20685b)[_0xd9ff('0x21')](function(_0x190fac){return _0x190fac;});}return null;};}function removeEntity(_0x4813a5,_0x34e9a9){return function(_0x4670e4){if(_0x4670e4){return _0x4670e4[_0xd9ff('0x36')]()['then'](function(){_0x4813a5[_0xd9ff('0x2b')](0xcc)[_0xd9ff('0x37')]();});}};}function handleEntityNotFound(_0x2bde85,_0x4ab10f){return function(_0x3d449d){if(!_0x3d449d){_0x2bde85['sendStatus'](0x194);}return _0x3d449d;};}function handleError(_0x3ae761,_0x4ae56b){_0x4ae56b=_0x4ae56b||0x1f4;return function(_0x20a021){logger['error'](_0x20a021[_0xd9ff('0x38')]);if(_0x20a021[_0xd9ff('0x39')]){delete _0x20a021[_0xd9ff('0x39')];}_0x3ae761['status'](_0x4ae56b)['send'](_0x20a021);};}exports['index']=function(_0x7ac3d1,_0x30fc5b){var _0x405c3b={},_0x107a9f={},_0x39f079={'count':0x0,'rows':[]};var _0x34daf6=_['map'](db['OpenchannelMessage']['rawAttributes'],function(_0x316d93){return{'name':_0x316d93[_0xd9ff('0x3a')],'type':_0x316d93[_0xd9ff('0x3b')][_0xd9ff('0x3c')]};});_0x107a9f['model']=_[_0xd9ff('0x3d')](_0x34daf6,'name');_0x107a9f[_0xd9ff('0x3e')]=_[_0xd9ff('0x3f')](_0x7ac3d1[_0xd9ff('0x3e')]);_0x107a9f[_0xd9ff('0x40')]=_['intersection'](_0x107a9f[_0xd9ff('0x41')],_0x107a9f[_0xd9ff('0x3e')]);_0x405c3b['attributes']=_[_0xd9ff('0x42')](_0x107a9f[_0xd9ff('0x41')],qs[_0xd9ff('0x43')](_0x7ac3d1[_0xd9ff('0x3e')][_0xd9ff('0x43')]));_0x405c3b[_0xd9ff('0x44')]=_0x405c3b['attributes'][_0xd9ff('0x45')]?_0x405c3b[_0xd9ff('0x44')]:_0x107a9f[_0xd9ff('0x41')];if(!_0x7ac3d1[_0xd9ff('0x3e')][_0xd9ff('0x46')]('nolimit')){_0x405c3b[_0xd9ff('0x2e')]=qs[_0xd9ff('0x2e')](_0x7ac3d1[_0xd9ff('0x3e')]['limit']);_0x405c3b['offset']=qs[_0xd9ff('0x2c')](_0x7ac3d1[_0xd9ff('0x3e')][_0xd9ff('0x2c')]);}_0x405c3b[_0xd9ff('0x47')]=qs[_0xd9ff('0x48')](_0x7ac3d1[_0xd9ff('0x3e')]['sort']);_0x405c3b[_0xd9ff('0x49')]=qs[_0xd9ff('0x40')](_['pick'](_0x7ac3d1[_0xd9ff('0x3e')],_0x107a9f[_0xd9ff('0x40')]),_0x34daf6);if(_0x7ac3d1[_0xd9ff('0x3e')][_0xd9ff('0x4a')]){_0x405c3b[_0xd9ff('0x49')]=_['merge'](_0x405c3b['where'],{'$or':_['map'](_0x34daf6,function(_0x301ebb){if(_0x301ebb['type']!==_0xd9ff('0x4b')){var _0x2580e0={};_0x2580e0[_0x301ebb[_0xd9ff('0x39')]]={'$like':'%'+_0x7ac3d1['query'][_0xd9ff('0x4a')]+'%'};return _0x2580e0;}})});}_0x405c3b=_[_0xd9ff('0x4c')]({},_0x405c3b,_0x7ac3d1['options']);var _0x5be7cf={'where':_0x405c3b[_0xd9ff('0x49')]};return db[_0xd9ff('0x4d')][_0xd9ff('0x2f')](_0x5be7cf)['then'](function(_0x38b5b6){_0x39f079['count']=_0x38b5b6;if(_0x7ac3d1[_0xd9ff('0x3e')]['includeAll']){_0x405c3b[_0xd9ff('0x4e')]=[{'all':!![]}];}return db[_0xd9ff('0x4d')][_0xd9ff('0x4f')](_0x405c3b);})[_0xd9ff('0x21')](function(_0xf21b7d){_0x39f079['rows']=_0xf21b7d;return _0x39f079;})[_0xd9ff('0x21')](respondWithFilteredResult(_0x30fc5b,_0x405c3b))[_0xd9ff('0x50')](handleError(_0x30fc5b,null));};exports[_0xd9ff('0x51')]=function(_0xa3f86d,_0x5c3e11){var _0x537282={'raw':!![],'where':{'id':_0xa3f86d[_0xd9ff('0x52')]['id']}},_0x4c22dc={};_0x4c22dc[_0xd9ff('0x41')]=_[_0xd9ff('0x3f')](db['OpenchannelMessage'][_0xd9ff('0x53')]);_0x4c22dc[_0xd9ff('0x3e')]=_[_0xd9ff('0x3f')](_0xa3f86d[_0xd9ff('0x3e')]);_0x4c22dc[_0xd9ff('0x40')]=_[_0xd9ff('0x42')](_0x4c22dc[_0xd9ff('0x41')],_0x4c22dc[_0xd9ff('0x3e')]);_0x537282[_0xd9ff('0x44')]=_[_0xd9ff('0x42')](_0x4c22dc[_0xd9ff('0x41')],qs[_0xd9ff('0x43')](_0xa3f86d[_0xd9ff('0x3e')]['fields']));_0x537282[_0xd9ff('0x44')]=_0x537282['attributes'][_0xd9ff('0x45')]?_0x537282['attributes']:_0x4c22dc[_0xd9ff('0x41')];if(_0xa3f86d['query'][_0xd9ff('0x54')]){_0x537282['include']=[{'all':!![]}];}_0x537282=_[_0xd9ff('0x4c')]({},_0x537282,_0xa3f86d['options']);return db[_0xd9ff('0x4d')]['find'](_0x537282)[_0xd9ff('0x21')](handleEntityNotFound(_0x5c3e11,null))['then'](respondWithResult(_0x5c3e11,null))[_0xd9ff('0x50')](handleError(_0x5c3e11,null));};exports[_0xd9ff('0x55')]=function(_0x122c9d,_0x35bd9a){return db['OpenchannelMessage'][_0xd9ff('0x55')](_0x122c9d[_0xd9ff('0x56')],{})[_0xd9ff('0x21')](respondWithResult(_0x35bd9a,0xc9))['catch'](handleError(_0x35bd9a,null));};exports[_0xd9ff('0x35')]=function(_0x32e1b9,_0x19b033){if(_0x32e1b9[_0xd9ff('0x56')]['id']){delete _0x32e1b9[_0xd9ff('0x56')]['id'];}return db['OpenchannelMessage'][_0xd9ff('0x57')]({'where':{'id':_0x32e1b9[_0xd9ff('0x52')]['id']}})[_0xd9ff('0x21')](handleEntityNotFound(_0x19b033,null))[_0xd9ff('0x21')](saveUpdates(_0x32e1b9[_0xd9ff('0x56')],null))[_0xd9ff('0x21')](respondWithResult(_0x19b033,null))[_0xd9ff('0x50')](handleError(_0x19b033,null));};exports['destroy']=function(_0x3be850,_0x11251f){return db['OpenchannelMessage'][_0xd9ff('0x57')]({'where':{'id':_0x3be850[_0xd9ff('0x52')]['id']}})['then'](handleEntityNotFound(_0x11251f,null))[_0xd9ff('0x21')](removeEntity(_0x11251f,null))[_0xd9ff('0x50')](handleError(_0x11251f,null));};exports[_0xd9ff('0x58')]=function(_0x54ea27,_0x4ea9c6){return db[_0xd9ff('0x4d')]['describe']()[_0xd9ff('0x21')](respondWithResult(_0x4ea9c6,null))[_0xd9ff('0x50')](handleError(_0x4ea9c6,null));};var interaction_log=require(_0xd9ff('0x14'))(_0xd9ff('0x59'));exports['accept']=function(_0x543f5f,_0x596036,_0x188b58){var _0x3a8b6a={'agent':{},'channel':_0xd9ff('0x5a')};if(_0x543f5f[_0xd9ff('0x56')]['id']){delete _0x543f5f[_0xd9ff('0x56')]['id'];}_0x543f5f['body'][_0xd9ff('0x5b')]=!![];_0x543f5f['body'][_0xd9ff('0x5c')]=moment()[_0xd9ff('0x5d')](_0xd9ff('0x5e'));_0x543f5f[_0xd9ff('0x56')][_0xd9ff('0x5f')]=_0x543f5f[_0xd9ff('0x56')][_0xd9ff('0x5f')]||_0x543f5f[_0xd9ff('0x60')]['id'];_0x3a8b6a['agent']['id']=_0x543f5f[_0xd9ff('0x56')][_0xd9ff('0x5f')];return db['OpenchannelMessage']['find']({'where':{'id':_0x543f5f[_0xd9ff('0x52')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xd9ff('0x61')}]})[_0xd9ff('0x21')](handleEntityNotFound(_0x596036,null))['then'](saveUpdates(_0x543f5f[_0xd9ff('0x56')],null))[_0xd9ff('0x21')](function(_0x54aca7){if(_0x54aca7){_0x3a8b6a[_0xd9ff('0x29')]=_0x54aca7[_0xd9ff('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0xd9ff('0x57')]({'where':{'id':_0x54aca7['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x596036,null))[_0xd9ff('0x21')](function(_0x14e5a5){if(_0x14e5a5){return _0x14e5a5[_0xd9ff('0x35')]({'UserId':_0x543f5f[_0xd9ff('0x56')]['UserId'],'read1stAt':_[_0xd9ff('0x63')](_0x14e5a5[_0xd9ff('0x64')])?moment()[_0xd9ff('0x5d')](_0xd9ff('0x5e')):undefined});}return null;})[_0xd9ff('0x21')](function(_0x255edf){if(_0x255edf){_0x3a8b6a[_0xd9ff('0x65')]=_0x255edf[_0xd9ff('0x62')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x543f5f['user']['id'],_0x543f5f[_0xd9ff('0x60')][_0xd9ff('0x39')],_0x543f5f['user'][_0xd9ff('0x66')],_0x3a8b6a[_0xd9ff('0x65')]['id'],_0x543f5f[_0xd9ff('0x56')]?JSON[_0xd9ff('0x27')](_0x543f5f[_0xd9ff('0x56')]):_0xd9ff('0x67'));return respondWithRpcPromise(_0xd9ff('0x68'),_0xd9ff('0x69'),_0x3a8b6a);}return null;})['then'](function(_0x1f9400){return db[_0xd9ff('0x6a')][_0xd9ff('0x58')]()['then'](function(_0x14e936){var _0x58c9c2=[];for(var _0xf40757=0x0;_0xf40757=_0x3dc443){_0x1d55fd=_0x3dc443;_0x2ba4d3=0xc8;}else{_0x2ba4d3=0xce;}_0x1d3684[_0xd9ff('0x2b')](_0x2ba4d3);return _0x1d3684[_0xd9ff('0x30')](_0xd9ff('0x31'),_0xcea5db+'-'+_0x1d55fd+'/'+_0x3dc443)['json'](_0x44b5a7);}return null;};}function patchUpdates(_0x41adb1){return function(_0x5743de){try{jsonpatch[_0xd9ff('0x32')](_0x5743de,_0x41adb1,!![]);}catch(_0x2419f5){return BPromise[_0xd9ff('0x33')](_0x2419f5);}return _0x5743de[_0xd9ff('0x34')]();};}function saveUpdates(_0x20685b,_0xdf3947){return function(_0x2cc2ae){if(_0x2cc2ae){return _0x2cc2ae[_0xd9ff('0x35')](_0x20685b)[_0xd9ff('0x21')](function(_0x190fac){return _0x190fac;});}return null;};}function removeEntity(_0x4813a5,_0x34e9a9){return function(_0x4670e4){if(_0x4670e4){return _0x4670e4[_0xd9ff('0x36')]()['then'](function(){_0x4813a5[_0xd9ff('0x2b')](0xcc)[_0xd9ff('0x37')]();});}};}function handleEntityNotFound(_0x2bde85,_0x4ab10f){return function(_0x3d449d){if(!_0x3d449d){_0x2bde85['sendStatus'](0x194);}return _0x3d449d;};}function handleError(_0x3ae761,_0x4ae56b){_0x4ae56b=_0x4ae56b||0x1f4;return function(_0x20a021){logger['error'](_0x20a021[_0xd9ff('0x38')]);if(_0x20a021[_0xd9ff('0x39')]){delete _0x20a021[_0xd9ff('0x39')];}_0x3ae761['status'](_0x4ae56b)['send'](_0x20a021);};}exports['index']=function(_0x7ac3d1,_0x30fc5b){var _0x405c3b={},_0x107a9f={},_0x39f079={'count':0x0,'rows':[]};var _0x34daf6=_['map'](db['OpenchannelMessage']['rawAttributes'],function(_0x316d93){return{'name':_0x316d93[_0xd9ff('0x3a')],'type':_0x316d93[_0xd9ff('0x3b')][_0xd9ff('0x3c')]};});_0x107a9f['model']=_[_0xd9ff('0x3d')](_0x34daf6,'name');_0x107a9f[_0xd9ff('0x3e')]=_[_0xd9ff('0x3f')](_0x7ac3d1[_0xd9ff('0x3e')]);_0x107a9f[_0xd9ff('0x40')]=_['intersection'](_0x107a9f[_0xd9ff('0x41')],_0x107a9f[_0xd9ff('0x3e')]);_0x405c3b['attributes']=_[_0xd9ff('0x42')](_0x107a9f[_0xd9ff('0x41')],qs[_0xd9ff('0x43')](_0x7ac3d1[_0xd9ff('0x3e')][_0xd9ff('0x43')]));_0x405c3b[_0xd9ff('0x44')]=_0x405c3b['attributes'][_0xd9ff('0x45')]?_0x405c3b[_0xd9ff('0x44')]:_0x107a9f[_0xd9ff('0x41')];if(!_0x7ac3d1[_0xd9ff('0x3e')][_0xd9ff('0x46')]('nolimit')){_0x405c3b[_0xd9ff('0x2e')]=qs[_0xd9ff('0x2e')](_0x7ac3d1[_0xd9ff('0x3e')]['limit']);_0x405c3b['offset']=qs[_0xd9ff('0x2c')](_0x7ac3d1[_0xd9ff('0x3e')][_0xd9ff('0x2c')]);}_0x405c3b[_0xd9ff('0x47')]=qs[_0xd9ff('0x48')](_0x7ac3d1[_0xd9ff('0x3e')]['sort']);_0x405c3b[_0xd9ff('0x49')]=qs[_0xd9ff('0x40')](_['pick'](_0x7ac3d1[_0xd9ff('0x3e')],_0x107a9f[_0xd9ff('0x40')]),_0x34daf6);if(_0x7ac3d1[_0xd9ff('0x3e')][_0xd9ff('0x4a')]){_0x405c3b[_0xd9ff('0x49')]=_['merge'](_0x405c3b['where'],{'$or':_['map'](_0x34daf6,function(_0x301ebb){if(_0x301ebb['type']!==_0xd9ff('0x4b')){var _0x2580e0={};_0x2580e0[_0x301ebb[_0xd9ff('0x39')]]={'$like':'%'+_0x7ac3d1['query'][_0xd9ff('0x4a')]+'%'};return _0x2580e0;}})});}_0x405c3b=_[_0xd9ff('0x4c')]({},_0x405c3b,_0x7ac3d1['options']);var _0x5be7cf={'where':_0x405c3b[_0xd9ff('0x49')]};return db[_0xd9ff('0x4d')][_0xd9ff('0x2f')](_0x5be7cf)['then'](function(_0x38b5b6){_0x39f079['count']=_0x38b5b6;if(_0x7ac3d1[_0xd9ff('0x3e')]['includeAll']){_0x405c3b[_0xd9ff('0x4e')]=[{'all':!![]}];}return db[_0xd9ff('0x4d')][_0xd9ff('0x4f')](_0x405c3b);})[_0xd9ff('0x21')](function(_0xf21b7d){_0x39f079['rows']=_0xf21b7d;return _0x39f079;})[_0xd9ff('0x21')](respondWithFilteredResult(_0x30fc5b,_0x405c3b))[_0xd9ff('0x50')](handleError(_0x30fc5b,null));};exports[_0xd9ff('0x51')]=function(_0xa3f86d,_0x5c3e11){var _0x537282={'raw':!![],'where':{'id':_0xa3f86d[_0xd9ff('0x52')]['id']}},_0x4c22dc={};_0x4c22dc[_0xd9ff('0x41')]=_[_0xd9ff('0x3f')](db['OpenchannelMessage'][_0xd9ff('0x53')]);_0x4c22dc[_0xd9ff('0x3e')]=_[_0xd9ff('0x3f')](_0xa3f86d[_0xd9ff('0x3e')]);_0x4c22dc[_0xd9ff('0x40')]=_[_0xd9ff('0x42')](_0x4c22dc[_0xd9ff('0x41')],_0x4c22dc[_0xd9ff('0x3e')]);_0x537282[_0xd9ff('0x44')]=_[_0xd9ff('0x42')](_0x4c22dc[_0xd9ff('0x41')],qs[_0xd9ff('0x43')](_0xa3f86d[_0xd9ff('0x3e')]['fields']));_0x537282[_0xd9ff('0x44')]=_0x537282['attributes'][_0xd9ff('0x45')]?_0x537282['attributes']:_0x4c22dc[_0xd9ff('0x41')];if(_0xa3f86d['query'][_0xd9ff('0x54')]){_0x537282['include']=[{'all':!![]}];}_0x537282=_[_0xd9ff('0x4c')]({},_0x537282,_0xa3f86d['options']);return db[_0xd9ff('0x4d')]['find'](_0x537282)[_0xd9ff('0x21')](handleEntityNotFound(_0x5c3e11,null))['then'](respondWithResult(_0x5c3e11,null))[_0xd9ff('0x50')](handleError(_0x5c3e11,null));};exports[_0xd9ff('0x55')]=function(_0x122c9d,_0x35bd9a){return db['OpenchannelMessage'][_0xd9ff('0x55')](_0x122c9d[_0xd9ff('0x56')],{})[_0xd9ff('0x21')](respondWithResult(_0x35bd9a,0xc9))['catch'](handleError(_0x35bd9a,null));};exports[_0xd9ff('0x35')]=function(_0x32e1b9,_0x19b033){if(_0x32e1b9[_0xd9ff('0x56')]['id']){delete _0x32e1b9[_0xd9ff('0x56')]['id'];}return db['OpenchannelMessage'][_0xd9ff('0x57')]({'where':{'id':_0x32e1b9[_0xd9ff('0x52')]['id']}})[_0xd9ff('0x21')](handleEntityNotFound(_0x19b033,null))[_0xd9ff('0x21')](saveUpdates(_0x32e1b9[_0xd9ff('0x56')],null))[_0xd9ff('0x21')](respondWithResult(_0x19b033,null))[_0xd9ff('0x50')](handleError(_0x19b033,null));};exports['destroy']=function(_0x3be850,_0x11251f){return db['OpenchannelMessage'][_0xd9ff('0x57')]({'where':{'id':_0x3be850[_0xd9ff('0x52')]['id']}})['then'](handleEntityNotFound(_0x11251f,null))[_0xd9ff('0x21')](removeEntity(_0x11251f,null))[_0xd9ff('0x50')](handleError(_0x11251f,null));};exports[_0xd9ff('0x58')]=function(_0x54ea27,_0x4ea9c6){return db[_0xd9ff('0x4d')]['describe']()[_0xd9ff('0x21')](respondWithResult(_0x4ea9c6,null))[_0xd9ff('0x50')](handleError(_0x4ea9c6,null));};var interaction_log=require(_0xd9ff('0x14'))(_0xd9ff('0x59'));exports['accept']=function(_0x543f5f,_0x596036,_0x188b58){var _0x3a8b6a={'agent':{},'channel':_0xd9ff('0x5a')};if(_0x543f5f[_0xd9ff('0x56')]['id']){delete _0x543f5f[_0xd9ff('0x56')]['id'];}_0x543f5f['body'][_0xd9ff('0x5b')]=!![];_0x543f5f['body'][_0xd9ff('0x5c')]=moment()[_0xd9ff('0x5d')](_0xd9ff('0x5e'));_0x543f5f[_0xd9ff('0x56')][_0xd9ff('0x5f')]=_0x543f5f[_0xd9ff('0x56')][_0xd9ff('0x5f')]||_0x543f5f[_0xd9ff('0x60')]['id'];_0x3a8b6a['agent']['id']=_0x543f5f[_0xd9ff('0x56')][_0xd9ff('0x5f')];return db['OpenchannelMessage']['find']({'where':{'id':_0x543f5f[_0xd9ff('0x52')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xd9ff('0x61')}]})[_0xd9ff('0x21')](handleEntityNotFound(_0x596036,null))['then'](saveUpdates(_0x543f5f[_0xd9ff('0x56')],null))[_0xd9ff('0x21')](function(_0x54aca7){if(_0x54aca7){_0x3a8b6a[_0xd9ff('0x29')]=_0x54aca7[_0xd9ff('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0xd9ff('0x57')]({'where':{'id':_0x54aca7['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x596036,null))[_0xd9ff('0x21')](function(_0x14e5a5){if(_0x14e5a5){return _0x14e5a5[_0xd9ff('0x35')]({'UserId':_0x543f5f[_0xd9ff('0x56')]['UserId'],'read1stAt':_[_0xd9ff('0x63')](_0x14e5a5[_0xd9ff('0x64')])?moment()[_0xd9ff('0x5d')](_0xd9ff('0x5e')):undefined});}return null;})[_0xd9ff('0x21')](function(_0x255edf){if(_0x255edf){_0x3a8b6a[_0xd9ff('0x65')]=_0x255edf[_0xd9ff('0x62')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x543f5f['user']['id'],_0x543f5f[_0xd9ff('0x60')][_0xd9ff('0x39')],_0x543f5f['user'][_0xd9ff('0x66')],_0x3a8b6a[_0xd9ff('0x65')]['id'],_0x543f5f[_0xd9ff('0x56')]?JSON[_0xd9ff('0x27')](_0x543f5f[_0xd9ff('0x56')]):_0xd9ff('0x67'));return respondWithRpcPromise(_0xd9ff('0x68'),_0xd9ff('0x69'),_0x3a8b6a);}return null;})['then'](function(_0x1f9400){return db[_0xd9ff('0x6a')][_0xd9ff('0x58')]()['then'](function(_0x14e936){var _0x58c9c2=[];for(var _0xf40757=0x0;_0xf40757=_0x195131){_0x1dce29=_0x195131;_0x29f12e=0xc8;}else{_0x29f12e=0xce;}_0x1e97fd[_0x5d37('0x1b')](_0x29f12e);return _0x1e97fd[_0x5d37('0x21')](_0x5d37('0x22'),_0x320409+'-'+_0x1dce29+'/'+_0x195131)[_0x5d37('0x1c')](_0x2d4a7b);}return null;};}function patchUpdates(_0xb1eebe){return function(_0x5abc27){try{jsonpatch['apply'](_0x5abc27,_0xb1eebe,!![]);}catch(_0x4c8460){return BPromise[_0x5d37('0x23')](_0x4c8460);}return _0x5abc27['save']();};}function saveUpdates(_0x85d997,_0x34ac9b){return function(_0x14e6f0){if(_0x14e6f0){return _0x14e6f0[_0x5d37('0x24')](_0x85d997)[_0x5d37('0x25')](function(_0x7c270c){return _0x7c270c;});}return null;};}function removeEntity(_0x5d783d,_0x3818c0){return function(_0x372ad4){if(_0x372ad4){return _0x372ad4[_0x5d37('0x26')]()[_0x5d37('0x25')](function(){var _0x72a153=_0x372ad4['get']({'plain':!![]});var _0x2552b6=_0x5d37('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x2552b6,'resourceId':_0x72a153['id']}})[_0x5d37('0x25')](function(){return _0x372ad4;});})['then'](function(){_0x5d783d[_0x5d37('0x1b')](0xcc)[_0x5d37('0x28')]();});}};}function handleEntityNotFound(_0x1f1e42,_0x435702){return function(_0x534ecb){if(!_0x534ecb){_0x1f1e42[_0x5d37('0x1a')](0x194);}return _0x534ecb;};}function handleError(_0xe8c70c,_0x1a5a81){_0x1a5a81=_0x1a5a81||0x1f4;return function(_0x29f433){logger['error'](_0x29f433[_0x5d37('0x29')]);if(_0x29f433['name']){delete _0x29f433[_0x5d37('0x2a')];}_0xe8c70c[_0x5d37('0x1b')](_0x1a5a81)['send'](_0x29f433);};}exports['index']=function(_0x3bdc2f,_0x36c463){var _0x2533b7={},_0x9c77fd={},_0x127b25={'count':0x0,'rows':[]};var _0x4c7d90=_['map'](db[_0x5d37('0x2b')][_0x5d37('0x2c')],function(_0x5ab779){return{'name':_0x5ab779['fieldName'],'type':_0x5ab779[_0x5d37('0x2d')][_0x5d37('0x2e')]};});_0x9c77fd[_0x5d37('0x2f')]=_[_0x5d37('0x30')](_0x4c7d90,_0x5d37('0x2a'));_0x9c77fd[_0x5d37('0x31')]=_[_0x5d37('0x32')](_0x3bdc2f[_0x5d37('0x31')]);_0x9c77fd[_0x5d37('0x33')]=_[_0x5d37('0x34')](_0x9c77fd['model'],_0x9c77fd[_0x5d37('0x31')]);_0x2533b7[_0x5d37('0x35')]=_[_0x5d37('0x34')](_0x9c77fd[_0x5d37('0x2f')],qs['fields'](_0x3bdc2f[_0x5d37('0x31')]['fields']));_0x2533b7['attributes']=_0x2533b7[_0x5d37('0x35')][_0x5d37('0x36')]?_0x2533b7['attributes']:_0x9c77fd[_0x5d37('0x2f')];if(!_0x3bdc2f[_0x5d37('0x31')][_0x5d37('0x37')](_0x5d37('0x38'))){_0x2533b7[_0x5d37('0x1e')]=qs['limit'](_0x3bdc2f[_0x5d37('0x31')][_0x5d37('0x1e')]);_0x2533b7[_0x5d37('0x20')]=qs['offset'](_0x3bdc2f['query'][_0x5d37('0x20')]);}_0x2533b7['order']=qs[_0x5d37('0x39')](_0x3bdc2f[_0x5d37('0x31')][_0x5d37('0x39')]);_0x2533b7[_0x5d37('0x3a')]=qs[_0x5d37('0x33')](_[_0x5d37('0x3b')](_0x3bdc2f[_0x5d37('0x31')],_0x9c77fd[_0x5d37('0x33')]),_0x4c7d90);if(_0x3bdc2f[_0x5d37('0x31')]['filter']){_0x2533b7[_0x5d37('0x3a')]=_['merge'](_0x2533b7[_0x5d37('0x3a')],{'$or':_[_0x5d37('0x30')](_0x4c7d90,function(_0x19b655){if(_0x19b655[_0x5d37('0x2d')]!==_0x5d37('0x3c')){var _0x15ff0f={};_0x15ff0f[_0x19b655[_0x5d37('0x2a')]]={'$like':'%'+_0x3bdc2f[_0x5d37('0x31')]['filter']+'%'};return _0x15ff0f;}})});}_0x2533b7=_[_0x5d37('0x3d')]({},_0x2533b7,_0x3bdc2f[_0x5d37('0x3e')]);var _0x22bf31={'where':_0x2533b7[_0x5d37('0x3a')]};return db[_0x5d37('0x2b')][_0x5d37('0x1f')](_0x22bf31)['then'](function(_0x1f7a41){_0x127b25[_0x5d37('0x1f')]=_0x1f7a41;if(_0x3bdc2f['query'][_0x5d37('0x3f')]){_0x2533b7[_0x5d37('0x40')]=[{'all':!![]}];}return db[_0x5d37('0x2b')][_0x5d37('0x41')](_0x2533b7);})[_0x5d37('0x25')](function(_0x5ec0f6){_0x127b25[_0x5d37('0x42')]=_0x5ec0f6;return _0x127b25;})[_0x5d37('0x25')](respondWithFilteredResult(_0x36c463,_0x2533b7))[_0x5d37('0x43')](handleError(_0x36c463,null));};exports['show']=function(_0x4c56b6,_0x1be74d){var _0x1f9fd1={'raw':!![],'where':{'id':_0x4c56b6['params']['id']}},_0x199f6e={};_0x199f6e[_0x5d37('0x2f')]=_[_0x5d37('0x32')](db[_0x5d37('0x2b')][_0x5d37('0x2c')]);_0x199f6e[_0x5d37('0x31')]=_[_0x5d37('0x32')](_0x4c56b6[_0x5d37('0x31')]);_0x199f6e[_0x5d37('0x33')]=_[_0x5d37('0x34')](_0x199f6e[_0x5d37('0x2f')],_0x199f6e['query']);_0x1f9fd1[_0x5d37('0x35')]=_[_0x5d37('0x34')](_0x199f6e[_0x5d37('0x2f')],qs[_0x5d37('0x44')](_0x4c56b6[_0x5d37('0x31')][_0x5d37('0x44')]));_0x1f9fd1['attributes']=_0x1f9fd1[_0x5d37('0x35')][_0x5d37('0x36')]?_0x1f9fd1[_0x5d37('0x35')]:_0x199f6e[_0x5d37('0x2f')];if(_0x4c56b6[_0x5d37('0x31')][_0x5d37('0x3f')]){_0x1f9fd1['include']=[{'all':!![]}];}_0x1f9fd1=_['merge']({},_0x1f9fd1,_0x4c56b6[_0x5d37('0x3e')]);return db[_0x5d37('0x2b')][_0x5d37('0x45')](_0x1f9fd1)[_0x5d37('0x25')](handleEntityNotFound(_0x1be74d,null))['then'](respondWithResult(_0x1be74d,null))[_0x5d37('0x43')](handleError(_0x1be74d,null));};exports['create']=function(_0x3b2c59,_0x381a66){return db[_0x5d37('0x2b')][_0x5d37('0x46')](_0x3b2c59[_0x5d37('0x47')],{})['then'](function(_0x3dc787){var _0x4e9924=_0x3b2c59[_0x5d37('0x48')][_0x5d37('0x49')]({'plain':!![]});if(!_0x4e9924)throw new Error(_0x5d37('0x4a'));if(_0x4e9924[_0x5d37('0x4b')]===_0x5d37('0x48')){var _0xa65a37=_0x3dc787[_0x5d37('0x49')]({'plain':!![]});var _0x1f0215=_0x5d37('0x27');return db[_0x5d37('0x4c')][_0x5d37('0x45')]({'where':{'name':_0x1f0215,'userProfileId':_0x4e9924[_0x5d37('0x4d')]},'raw':!![]})[_0x5d37('0x25')](function(_0x1d3fba){if(_0x1d3fba&&_0x1d3fba[_0x5d37('0x4e')]===0x0){return db[_0x5d37('0x4f')][_0x5d37('0x46')]({'name':_0xa65a37[_0x5d37('0x2a')],'resourceId':_0xa65a37['id'],'type':_0x1d3fba['name'],'sectionId':_0x1d3fba['id']},{})[_0x5d37('0x25')](function(){return _0x3dc787;});}else{return _0x3dc787;}})[_0x5d37('0x43')](function(_0x2dc482){logger[_0x5d37('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2dc482);throw _0x2dc482;});}return _0x3dc787;})[_0x5d37('0x25')](respondWithResult(_0x381a66,0xc9))[_0x5d37('0x43')](handleError(_0x381a66,null));};exports[_0x5d37('0x24')]=function(_0x5c01cf,_0x2d817a){if(_0x5c01cf[_0x5d37('0x47')]['id']){delete _0x5c01cf[_0x5d37('0x47')]['id'];}return db[_0x5d37('0x2b')][_0x5d37('0x45')]({'where':{'id':_0x5c01cf[_0x5d37('0x51')]['id']}})['then'](handleEntityNotFound(_0x2d817a,null))['then'](saveUpdates(_0x5c01cf[_0x5d37('0x47')],null))[_0x5d37('0x25')](respondWithResult(_0x2d817a,null))[_0x5d37('0x43')](handleError(_0x2d817a,null));};exports[_0x5d37('0x26')]=function(_0x1f14b3,_0x188454){return db[_0x5d37('0x2b')][_0x5d37('0x45')]({'where':{'id':_0x1f14b3['params']['id']}})[_0x5d37('0x25')](handleEntityNotFound(_0x188454,null))['then'](removeEntity(_0x188454,null))['catch'](handleError(_0x188454,null));};exports[_0x5d37('0x52')]=function(_0x5312bb,_0x3459fd){return db[_0x5d37('0x2b')][_0x5d37('0x52')]()['then'](respondWithResult(_0x3459fd,null))[_0x5d37('0x43')](handleError(_0x3459fd,null));};exports['getMembers']=function(_0x450783,_0x34b84e,_0x1d802a){var _0x620215={'raw':!![],'where':{}},_0x21f0c3={},_0x26e980;return db[_0x5d37('0x2b')][_0x5d37('0x53')]({'where':{'id':_0x450783[_0x5d37('0x51')]['id']}})['then'](handleEntityNotFound(_0x34b84e,null))[_0x5d37('0x25')](function(_0x4e8f29){if(_0x4e8f29){_0x26e980=_0x4e8f29[_0x5d37('0x49')]({'plain':!![]});_0x21f0c3[_0x5d37('0x2f')]=_[_0x5d37('0x32')](db[_0x5d37('0x54')]['rawAttributes']);_0x21f0c3['query']=_['keys'](_0x450783[_0x5d37('0x31')]);_0x21f0c3[_0x5d37('0x33')]=_[_0x5d37('0x34')](_0x21f0c3[_0x5d37('0x2f')],_0x21f0c3[_0x5d37('0x31')]);_0x620215[_0x5d37('0x35')]=_[_0x5d37('0x34')](_0x21f0c3['model'],qs[_0x5d37('0x44')](_0x450783[_0x5d37('0x31')][_0x5d37('0x44')]));_0x620215[_0x5d37('0x35')]=_0x620215['attributes'][_0x5d37('0x36')]?_0x620215[_0x5d37('0x35')]:_0x21f0c3[_0x5d37('0x2f')];if(!_0x450783[_0x5d37('0x31')][_0x5d37('0x37')](_0x5d37('0x38'))){_0x620215[_0x5d37('0x1e')]=qs[_0x5d37('0x1e')](_0x450783[_0x5d37('0x31')][_0x5d37('0x1e')]);_0x620215[_0x5d37('0x20')]=qs['offset'](_0x450783['query']['offset']);}_0x620215[_0x5d37('0x55')]=qs['sort'](_0x450783[_0x5d37('0x31')][_0x5d37('0x39')]);_0x620215[_0x5d37('0x3a')]=qs['filters'](_['pick'](_0x450783[_0x5d37('0x31')],_0x21f0c3[_0x5d37('0x33')]));_0x620215[_0x5d37('0x3a')][_0x5d37('0x56')]=_0x4e8f29['id'];if(_0x450783[_0x5d37('0x31')][_0x5d37('0x57')]){_0x620215[_0x5d37('0x3a')]=_['merge'](_0x620215[_0x5d37('0x3a')],{'$or':_[_0x5d37('0x30')](_0x620215[_0x5d37('0x35')],function(_0x3294f0){var _0x444ddf={};_0x444ddf[_0x3294f0]={'$like':'%'+_0x450783[_0x5d37('0x31')][_0x5d37('0x57')]+'%'};return _0x444ddf;})});}_0x620215=_[_0x5d37('0x3d')]({},_0x620215,_0x450783['options']);return db[_0x5d37('0x54')]['findAll'](_0x620215);}})[_0x5d37('0x25')](function(_0x1566fb){if(_0x1566fb){return db['User']['findAndCountAll']({'where':{'id':_[_0x5d37('0x30')](_0x1566fb,_0x5d37('0x58')),'role':'agent'},'attributes':['id','name',_0x5d37('0x59'),_0x5d37('0x5a'),_0x5d37('0x5b')]});}})[_0x5d37('0x25')](function(_0x4db988){if(_0x4db988){return{'count':_0x4db988['count'],'rows':_[_0x5d37('0x30')](_0x4db988[_0x5d37('0x42')],function(_0x342a98){return{'membername':_0x342a98['name'],'UserId':_0x342a98['id'],'queue_name':_0x26e980[_0x5d37('0x2a')],'OpenchannelQueueId':_0x26e980['id'],'interface':util[_0x5d37('0x5c')](_0x5d37('0x5d'),_0x5d37('0x5e'),_0x342a98['name']),'penalty':0x0,'paused':_0x342a98['openchannelPause'],'createdAt':_0x342a98[_0x5d37('0x5b')],'updatedAt':_0x342a98[_0x5d37('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x34b84e,_0x620215))[_0x5d37('0x43')](handleError(_0x34b84e,null));};exports['getTeams']=function(_0x164cdd,_0x29bb2f,_0x1a74fb){var _0x397f68={};var _0x7c51b8={};var _0x8ea258;var _0xa093f1;return db[_0x5d37('0x2b')][_0x5d37('0x53')]({'where':{'id':_0x164cdd['params']['id']}})[_0x5d37('0x25')](handleEntityNotFound(_0x29bb2f,null))[_0x5d37('0x25')](function(_0x54e888){if(_0x54e888){_0x8ea258=_0x54e888;_0x7c51b8['model']=_[_0x5d37('0x32')](db['Team'][_0x5d37('0x2c')]);_0x7c51b8[_0x5d37('0x31')]=_[_0x5d37('0x32')](_0x164cdd[_0x5d37('0x31')]);_0x7c51b8['filters']=_[_0x5d37('0x34')](_0x7c51b8[_0x5d37('0x2f')],_0x7c51b8['query']);_0x397f68[_0x5d37('0x35')]=_[_0x5d37('0x34')](_0x7c51b8[_0x5d37('0x2f')],qs[_0x5d37('0x44')](_0x164cdd[_0x5d37('0x31')][_0x5d37('0x44')]));_0x397f68[_0x5d37('0x35')]=_0x397f68['attributes'][_0x5d37('0x36')]?_0x397f68[_0x5d37('0x35')]:_0x7c51b8[_0x5d37('0x2f')];_0x397f68[_0x5d37('0x55')]=qs[_0x5d37('0x39')](_0x164cdd[_0x5d37('0x31')][_0x5d37('0x39')]);_0x397f68[_0x5d37('0x3a')]=qs['filters'](_['pick'](_0x164cdd[_0x5d37('0x31')],_0x7c51b8[_0x5d37('0x33')]));if(_0x164cdd[_0x5d37('0x31')][_0x5d37('0x57')]){_0x397f68[_0x5d37('0x3a')]=_[_0x5d37('0x3d')](_0x397f68[_0x5d37('0x3a')],{'$or':_[_0x5d37('0x30')](_0x397f68['attributes'],function(_0x1f3561){var _0x9fca93={};_0x9fca93[_0x1f3561]={'$like':'%'+_0x164cdd['query'][_0x5d37('0x57')]+'%'};return _0x9fca93;})});}_0x397f68=_[_0x5d37('0x3d')]({},_0x397f68,_0x164cdd[_0x5d37('0x3e')]);return _0x8ea258[_0x5d37('0x5f')](_0x397f68);}})[_0x5d37('0x25')](function(_0x5488b7){if(_0x5488b7){_0xa093f1=_0x5488b7['length'];if(!_0x164cdd['query'][_0x5d37('0x37')](_0x5d37('0x38'))){_0x397f68[_0x5d37('0x1e')]=qs['limit'](_0x164cdd[_0x5d37('0x31')]['limit']);_0x397f68[_0x5d37('0x20')]=qs['offset'](_0x164cdd[_0x5d37('0x31')][_0x5d37('0x20')]);}return _0x8ea258['getTeams'](_0x397f68);}})['then'](function(_0x5d7a65){if(_0x5d7a65){return _0x5d7a65?{'count':_0xa093f1,'rows':_0x5d7a65}:null;}})[_0x5d37('0x25')](respondWithResult(_0x29bb2f,null))['catch'](handleError(_0x29bb2f,null));};exports['addTeams']=function(_0x4d0f23,_0x23965c,_0xf7646c){var _0x3f314a=_0x4d0f23['body'][_0x5d37('0x60')];return db[_0x5d37('0x61')][_0x5d37('0x41')]({'where':{'id':_0x3f314a},'attributes':['id'],'include':[{'model':db[_0x5d37('0x62')],'as':'Agents','attributes':['id',_0x5d37('0x2a'),_0x5d37('0x63'),_0x5d37('0x64'),_0x5d37('0x65')],'raw':!![]}]})[_0x5d37('0x25')](function(_0x4976d1){if(_0x4976d1){var _0x241edb=_[_0x5d37('0x66')](_0x4976d1,function(_0x32d7b2){var _0x35068c=_0x32d7b2['get']({'plain':!![]});return _0x35068c[_0x5d37('0x67')];});return db[_0x5d37('0x2b')][_0x5d37('0x45')]({'where':{'id':_0x4d0f23[_0x5d37('0x51')]['id']}})[_0x5d37('0x25')](function(_0x57819d){return db[_0x5d37('0x68')]['transaction'](function(_0x5d090e){return _0x57819d[_0x5d37('0x69')](_0x3f314a,{'transaction':_0x5d090e})['then'](function(){return BPromise[_0x5d37('0x6a')](_0x241edb,function(_0x25430e){return db['UserOpenchannelQueue'][_0x5d37('0x6b')]({'where':{'UserId':_0x25430e['id'],'OpenchannelQueueId':_0x4d0f23[_0x5d37('0x51')]['id']},'transaction':_0x5d090e});});})[_0x5d37('0x25')](function(){_0x241edb[_0x5d37('0x6c')](function(_0x11841e){socket[_0x5d37('0x6d')](_0x5d37('0x6e'),{'UserId':_0x11841e['id'],'OpenchannelQueueId':_0x57819d['id']});});});});});}})[_0x5d37('0x25')](respondWithStatusCode(_0x23965c,null))[_0x5d37('0x43')](handleError(_0x23965c,null));};exports[_0x5d37('0x6f')]=function(_0x16c3b3,_0x2c1b3a,_0x490469){return db[_0x5d37('0x61')][_0x5d37('0x41')]({'where':{'id':_0x16c3b3[_0x5d37('0x31')][_0x5d37('0x60')]},'attributes':['id'],'include':[{'model':db[_0x5d37('0x62')],'as':_0x5d37('0x67'),'attributes':['id'],'raw':!![]}]})[_0x5d37('0x25')](handleEntityNotFound(_0x2c1b3a,null))[_0x5d37('0x25')](function(_0xed2aef){var _0x43c6d7=_[_0x5d37('0x30')](_0xed2aef,'id');var _0x4a8f4b=[];var _0x2263b5=[];var _0x313e16=squel[_0x5d37('0x70')]();_0x313e16[_0x5d37('0x71')]('tq.TeamId')['from'](_0x5d37('0x72'),'tq')[_0x5d37('0x73')](_0x5d37('0x74'),'ut',_0x5d37('0x75'))[_0x5d37('0x3a')](_0x5d37('0x76'),_0x16c3b3['params']['id']);for(var _0x3e52be=0x0;_0x3e52be<_0xed2aef[_0x5d37('0x36')];_0x3e52be+=0x1){let _0x260168=_0xed2aef[_0x3e52be];for(var _0x3c9da3=0x0;_0x3c9da3<_0x260168['Agents'][_0x5d37('0x36')];_0x3c9da3+=0x1){let _0x4e68e6=_0x260168[_0x5d37('0x67')][_0x3c9da3];var _0x1d4ba4=_0x313e16['clone']();_0x1d4ba4[_0x5d37('0x3a')](_0x5d37('0x77'),_0x4e68e6['id']);_0x2263b5['push'](db['sequelize'][_0x5d37('0x31')](_0x1d4ba4[_0x5d37('0x78')](),{'type':db[_0x5d37('0x68')][_0x5d37('0x79')][_0x5d37('0x7a')]})[_0x5d37('0x25')](function(_0x17e17d){if(_0x17e17d[_0x5d37('0x36')]===0x1){return _0x4e68e6['id'];}else{var _0x285a92=_[_0x5d37('0x7b')](_[_0x5d37('0x30')](_0x17e17d,_0x5d37('0x7c')),function(_0x21db4a){return _['includes'](_0x43c6d7,_0x21db4a);});if(_0x285a92){return _0x4e68e6['id'];}}}));}}return BPromise['all'](_0x2263b5)[_0x5d37('0x25')](function(_0x37cc21){_0x4a8f4b=_(_0x4a8f4b)['union'](_0x37cc21)[_0x5d37('0x7d')]()[_0x5d37('0x7e')]();return db[_0x5d37('0x2b')][_0x5d37('0x45')]({'where':{'id':_0x16c3b3[_0x5d37('0x51')]['id']}})[_0x5d37('0x25')](function(_0x421b52){return db[_0x5d37('0x68')]['transaction'](function(_0x4e79ef){return _0x421b52[_0x5d37('0x6f')](_0x16c3b3[_0x5d37('0x31')][_0x5d37('0x60')],{'transaction':_0x4e79ef})['then'](function(){if(!_[_0x5d37('0x7f')](_0x4a8f4b)){return _0x421b52['removeAgents'](_0x4a8f4b,{'transaction':_0x4e79ef});}})[_0x5d37('0x25')](function(){_0x4a8f4b[_0x5d37('0x6c')](function(_0x330a5e){socket['emit'](_0x5d37('0x80'),{'UserId':_0x330a5e,'OpenchannelQueueId':_0x421b52['id']});});});});});});})[_0x5d37('0x25')](respondWithStatusCode(_0x2c1b3a,null))[_0x5d37('0x43')](handleError(_0x2c1b3a,null));};exports[_0x5d37('0x81')]=function(_0x423a6e,_0x4f0bba,_0xd62b68){return db[_0x5d37('0x2b')][_0x5d37('0x45')]({'where':{'id':_0x423a6e['params']['id']}})[_0x5d37('0x25')](handleEntityNotFound(_0x4f0bba,null))[_0x5d37('0x25')](function(_0x5aa734){if(_0x5aa734){return _0x5aa734['addAgents'](_0x423a6e[_0x5d37('0x47')]['ids'],_[_0x5d37('0x82')](_0x423a6e[_0x5d37('0x47')],[_0x5d37('0x60'),'id'])||{})[_0x5d37('0x83')](function(_0x36407d){for(var _0x272ed6=0x0;_0x272ed6<_0x423a6e['body'][_0x5d37('0x60')][_0x5d37('0x36')];_0x272ed6+=0x1){socket[_0x5d37('0x6d')](_0x5d37('0x6e'),{'UserId':_0x423a6e[_0x5d37('0x47')]['ids'][_0x272ed6],'OpenchannelQueueId':_0x423a6e['params']['id']});}return _0x36407d;});}})['then'](respondWithResult(_0x4f0bba,null))[_0x5d37('0x43')](handleError(_0x4f0bba,null));};exports['removeAgents']=function(_0x47d444,_0x277be9,_0x58407e){return db[_0x5d37('0x2b')][_0x5d37('0x45')]({'where':{'id':_0x47d444[_0x5d37('0x51')]['id']}})[_0x5d37('0x25')](handleEntityNotFound(_0x277be9,null))[_0x5d37('0x25')](function(_0x1fcba0){if(_0x1fcba0){return _0x1fcba0[_0x5d37('0x84')](_0x47d444[_0x5d37('0x31')][_0x5d37('0x60')])[_0x5d37('0x25')](function(){if(_[_0x5d37('0x85')](_0x47d444[_0x5d37('0x31')][_0x5d37('0x60')])){for(var _0x57ee9a=0x0;_0x57ee9a<_0x47d444[_0x5d37('0x31')][_0x5d37('0x60')][_0x5d37('0x36')];_0x57ee9a+=0x1){socket['emit'](_0x5d37('0x80'),{'UserId':Number(_0x47d444[_0x5d37('0x31')][_0x5d37('0x60')][_0x57ee9a]),'OpenchannelQueueId':Number(_0x47d444[_0x5d37('0x51')]['id'])});}}else{socket[_0x5d37('0x6d')](_0x5d37('0x80'),{'UserId':Number(_0x47d444[_0x5d37('0x31')][_0x5d37('0x60')]),'OpenchannelQueueId':Number(_0x47d444[_0x5d37('0x51')]['id'])});}});}})[_0x5d37('0x25')](respondWithStatusCode(_0x277be9,null))['catch'](handleError(_0x277be9,null));};exports[_0x5d37('0x86')]=function(_0x139693,_0x11f290,_0x495203){var _0x801742={};var _0x52589e={};var _0x425564;var _0x1ff62b;return db[_0x5d37('0x2b')]['findOne']({'where':{'id':_0x139693[_0x5d37('0x51')]['id']}})['then'](handleEntityNotFound(_0x11f290,null))[_0x5d37('0x25')](function(_0x1c8056){if(_0x1c8056){_0x425564=_0x1c8056;_0x52589e['model']=_[_0x5d37('0x32')](db[_0x5d37('0x62')][_0x5d37('0x2c')]);_0x52589e[_0x5d37('0x31')]=_[_0x5d37('0x32')](_0x139693['query']);_0x52589e['filters']=_[_0x5d37('0x34')](_0x52589e[_0x5d37('0x2f')],_0x52589e[_0x5d37('0x31')]);_0x801742['attributes']=_[_0x5d37('0x34')](_0x52589e[_0x5d37('0x2f')],qs[_0x5d37('0x44')](_0x139693['query'][_0x5d37('0x44')]));_0x801742['attributes']=_0x801742['attributes'][_0x5d37('0x36')]?_0x801742['attributes']:_0x52589e[_0x5d37('0x2f')];_0x801742[_0x5d37('0x55')]=qs[_0x5d37('0x39')](_0x139693[_0x5d37('0x31')]['sort']);_0x801742['where']=qs[_0x5d37('0x33')](_[_0x5d37('0x3b')](_0x139693[_0x5d37('0x31')],_0x52589e[_0x5d37('0x33')]));if(_0x139693['query'][_0x5d37('0x57')]){_0x801742[_0x5d37('0x3a')]=_['merge'](_0x801742['where'],{'$or':_[_0x5d37('0x30')](_0x801742['attributes'],function(_0x3f28db){var _0x46a1e0={};_0x46a1e0[_0x3f28db]={'$like':'%'+_0x139693[_0x5d37('0x31')][_0x5d37('0x57')]+'%'};return _0x46a1e0;})});}_0x801742=_['merge']({},_0x801742,_0x139693[_0x5d37('0x3e')]);return _0x425564[_0x5d37('0x86')](_0x801742);}})[_0x5d37('0x25')](function(_0x3a6fa3){if(_0x3a6fa3){_0x1ff62b=_0x3a6fa3[_0x5d37('0x36')];if(!_0x139693[_0x5d37('0x31')][_0x5d37('0x37')](_0x5d37('0x38'))){_0x801742[_0x5d37('0x1e')]=qs[_0x5d37('0x1e')](_0x139693['query']['limit']);_0x801742[_0x5d37('0x20')]=qs['offset'](_0x139693[_0x5d37('0x31')][_0x5d37('0x20')]);}return _0x425564[_0x5d37('0x86')](_0x801742);}})[_0x5d37('0x25')](function(_0x2dbe16){if(_0x2dbe16){return _0x2dbe16?{'count':_0x1ff62b,'rows':_0x2dbe16}:null;}})[_0x5d37('0x25')](respondWithResult(_0x11f290,null))[_0x5d37('0x43')](handleError(_0x11f290,null));}; \ No newline at end of file +var _0x5cfa=['save','update','then','destroy','get','OpenchannelQueues','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','options','include','catch','show','keys','OpenchannelQueue','includeAll','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','params','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','order','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','nolimit','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','includes','all','compact','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject'];(function(_0x21723b,_0x16f0db){var _0x272832=function(_0x5aa922){while(--_0x5aa922){_0x21723b['push'](_0x21723b['shift']());}};_0x272832(++_0x16f0db);}(_0x5cfa,0x17b));var _0xa5cf=function(_0x23b525,_0x4de4d6){_0x23b525=_0x23b525-0x0;var _0x1db7d8=_0x5cfa[_0x23b525];return _0x1db7d8;};'use strict';var emlformat=require(_0xa5cf('0x0'));var rimraf=require(_0xa5cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa5cf('0x2'));var rp=require(_0xa5cf('0x3'));var moment=require(_0xa5cf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa5cf('0x5'));var util=require('util');var path=require(_0xa5cf('0x6'));var sox=require(_0xa5cf('0x7'));var csv=require(_0xa5cf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa5cf('0x9'));var crypto=require(_0xa5cf('0xa'));var jsforce=require(_0xa5cf('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa5cf('0xc'));var Papa=require(_0xa5cf('0xd'));var Redis=require(_0xa5cf('0xe'));var authService=require(_0xa5cf('0xf'));var qs=require(_0xa5cf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5cf('0x11'));var logger=require(_0xa5cf('0x12'))(_0xa5cf('0x13'));var utils=require(_0xa5cf('0x14'));var config=require(_0xa5cf('0x15'));var licenseUtil=require(_0xa5cf('0x16'));var db=require(_0xa5cf('0x17'))['db'];config[_0xa5cf('0x18')]=_[_0xa5cf('0x19')](config[_0xa5cf('0x18')],{'host':_0xa5cf('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5cf('0x18')]));require(_0xa5cf('0x1b'))[_0xa5cf('0x1c')](socket);function respondWithStatusCode(_0x4993a4,_0x2b56b6){_0x2b56b6=_0x2b56b6||0xcc;return function(_0xc985c3){if(_0xc985c3){return _0x4993a4[_0xa5cf('0x1d')](_0x2b56b6);}return _0x4993a4['status'](_0x2b56b6)[_0xa5cf('0x1e')]();};}function respondWithResult(_0x1a4fec,_0x2f7217){_0x2f7217=_0x2f7217||0xc8;return function(_0x236dd2){if(_0x236dd2){return _0x1a4fec[_0xa5cf('0x1f')](_0x2f7217)[_0xa5cf('0x20')](_0x236dd2);}};}function respondWithFilteredResult(_0x180844,_0x233e4a){return function(_0x594ace){if(_0x594ace){var _0x48d062=typeof _0x233e4a[_0xa5cf('0x21')]==='undefined'&&typeof _0x233e4a[_0xa5cf('0x22')]===_0xa5cf('0x23');var _0x1a6888=_0x594ace[_0xa5cf('0x24')];var _0x3af31a=_0x48d062?0x0:_0x233e4a[_0xa5cf('0x21')];var _0x11c20c=_0x48d062?_0x594ace[_0xa5cf('0x24')]:_0x233e4a[_0xa5cf('0x21')]+_0x233e4a[_0xa5cf('0x22')];var _0x233031;if(_0x11c20c>=_0x1a6888){_0x11c20c=_0x1a6888;_0x233031=0xc8;}else{_0x233031=0xce;}_0x180844[_0xa5cf('0x1f')](_0x233031);return _0x180844[_0xa5cf('0x25')](_0xa5cf('0x26'),_0x3af31a+'-'+_0x11c20c+'/'+_0x1a6888)[_0xa5cf('0x20')](_0x594ace);}return null;};}function patchUpdates(_0x229fb7){return function(_0xa8c837){try{jsonpatch[_0xa5cf('0x27')](_0xa8c837,_0x229fb7,!![]);}catch(_0x5d90b6){return BPromise[_0xa5cf('0x28')](_0x5d90b6);}return _0xa8c837[_0xa5cf('0x29')]();};}function saveUpdates(_0x31ad7d,_0x4f77dc){return function(_0x2c5ac5){if(_0x2c5ac5){return _0x2c5ac5[_0xa5cf('0x2a')](_0x31ad7d)[_0xa5cf('0x2b')](function(_0xc1b61d){return _0xc1b61d;});}return null;};}function removeEntity(_0x47e7ef,_0x5087e2){return function(_0x4a622d){if(_0x4a622d){return _0x4a622d[_0xa5cf('0x2c')]()[_0xa5cf('0x2b')](function(){var _0x456cd8=_0x4a622d[_0xa5cf('0x2d')]({'plain':!![]});var _0x3c9845=_0xa5cf('0x2e');return db['UserProfileResource'][_0xa5cf('0x2c')]({'where':{'type':_0x3c9845,'resourceId':_0x456cd8['id']}})[_0xa5cf('0x2b')](function(){return _0x4a622d;});})['then'](function(){_0x47e7ef[_0xa5cf('0x1f')](0xcc)[_0xa5cf('0x1e')]();});}};}function handleEntityNotFound(_0x3e53ef,_0x1635c1){return function(_0x5bc713){if(!_0x5bc713){_0x3e53ef['sendStatus'](0x194);}return _0x5bc713;};}function handleError(_0x57db52,_0x331124){_0x331124=_0x331124||0x1f4;return function(_0xd412f0){logger['error'](_0xd412f0[_0xa5cf('0x2f')]);if(_0xd412f0[_0xa5cf('0x30')]){delete _0xd412f0[_0xa5cf('0x30')];}_0x57db52[_0xa5cf('0x1f')](_0x331124)[_0xa5cf('0x31')](_0xd412f0);};}exports[_0xa5cf('0x32')]=function(_0x39c33f,_0x9c19a4){var _0x3a0892={},_0x43d880={},_0x563e96={'count':0x0,'rows':[]};var _0x46fb03=_[_0xa5cf('0x33')](db['OpenchannelQueue'][_0xa5cf('0x34')],function(_0x574334){return{'name':_0x574334[_0xa5cf('0x35')],'type':_0x574334[_0xa5cf('0x36')][_0xa5cf('0x37')]};});_0x43d880[_0xa5cf('0x38')]=_[_0xa5cf('0x33')](_0x46fb03,_0xa5cf('0x30'));_0x43d880[_0xa5cf('0x39')]=_['keys'](_0x39c33f['query']);_0x43d880[_0xa5cf('0x3a')]=_[_0xa5cf('0x3b')](_0x43d880[_0xa5cf('0x38')],_0x43d880['query']);_0x3a0892[_0xa5cf('0x3c')]=_[_0xa5cf('0x3b')](_0x43d880[_0xa5cf('0x38')],qs[_0xa5cf('0x3d')](_0x39c33f['query'][_0xa5cf('0x3d')]));_0x3a0892[_0xa5cf('0x3c')]=_0x3a0892[_0xa5cf('0x3c')][_0xa5cf('0x3e')]?_0x3a0892[_0xa5cf('0x3c')]:_0x43d880['model'];if(!_0x39c33f['query']['hasOwnProperty']('nolimit')){_0x3a0892[_0xa5cf('0x22')]=qs['limit'](_0x39c33f[_0xa5cf('0x39')][_0xa5cf('0x22')]);_0x3a0892[_0xa5cf('0x21')]=qs['offset'](_0x39c33f[_0xa5cf('0x39')][_0xa5cf('0x21')]);}_0x3a0892['order']=qs[_0xa5cf('0x3f')](_0x39c33f['query'][_0xa5cf('0x3f')]);_0x3a0892['where']=qs[_0xa5cf('0x3a')](_[_0xa5cf('0x40')](_0x39c33f['query'],_0x43d880['filters']),_0x46fb03);if(_0x39c33f[_0xa5cf('0x39')][_0xa5cf('0x41')]){_0x3a0892[_0xa5cf('0x42')]=_[_0xa5cf('0x43')](_0x3a0892[_0xa5cf('0x42')],{'$or':_[_0xa5cf('0x33')](_0x46fb03,function(_0x2e18e4){if(_0x2e18e4[_0xa5cf('0x36')]!=='VIRTUAL'){var _0xfbddf5={};_0xfbddf5[_0x2e18e4[_0xa5cf('0x30')]]={'$like':'%'+_0x39c33f['query'][_0xa5cf('0x41')]+'%'};return _0xfbddf5;}})});}_0x3a0892=_[_0xa5cf('0x43')]({},_0x3a0892,_0x39c33f[_0xa5cf('0x44')]);var _0x57ac92={'where':_0x3a0892[_0xa5cf('0x42')]};return db['OpenchannelQueue'][_0xa5cf('0x24')](_0x57ac92)[_0xa5cf('0x2b')](function(_0x242d18){_0x563e96[_0xa5cf('0x24')]=_0x242d18;if(_0x39c33f[_0xa5cf('0x39')]['includeAll']){_0x3a0892[_0xa5cf('0x45')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x3a0892);})[_0xa5cf('0x2b')](function(_0x9ed85f){_0x563e96['rows']=_0x9ed85f;return _0x563e96;})['then'](respondWithFilteredResult(_0x9c19a4,_0x3a0892))[_0xa5cf('0x46')](handleError(_0x9c19a4,null));};exports[_0xa5cf('0x47')]=function(_0x17f33f,_0x1e7fd4){var _0x13a221={'raw':!![],'where':{'id':_0x17f33f['params']['id']}},_0x355806={};_0x355806[_0xa5cf('0x38')]=_[_0xa5cf('0x48')](db[_0xa5cf('0x49')][_0xa5cf('0x34')]);_0x355806[_0xa5cf('0x39')]=_[_0xa5cf('0x48')](_0x17f33f['query']);_0x355806[_0xa5cf('0x3a')]=_[_0xa5cf('0x3b')](_0x355806[_0xa5cf('0x38')],_0x355806[_0xa5cf('0x39')]);_0x13a221[_0xa5cf('0x3c')]=_['intersection'](_0x355806[_0xa5cf('0x38')],qs['fields'](_0x17f33f[_0xa5cf('0x39')][_0xa5cf('0x3d')]));_0x13a221[_0xa5cf('0x3c')]=_0x13a221[_0xa5cf('0x3c')]['length']?_0x13a221[_0xa5cf('0x3c')]:_0x355806[_0xa5cf('0x38')];if(_0x17f33f[_0xa5cf('0x39')][_0xa5cf('0x4a')]){_0x13a221[_0xa5cf('0x45')]=[{'all':!![]}];}_0x13a221=_[_0xa5cf('0x43')]({},_0x13a221,_0x17f33f[_0xa5cf('0x44')]);return db[_0xa5cf('0x49')]['find'](_0x13a221)[_0xa5cf('0x2b')](handleEntityNotFound(_0x1e7fd4,null))[_0xa5cf('0x2b')](respondWithResult(_0x1e7fd4,null))[_0xa5cf('0x46')](handleError(_0x1e7fd4,null));};exports['create']=function(_0x36ba86,_0x4f2f13){return db[_0xa5cf('0x49')][_0xa5cf('0x4b')](_0x36ba86[_0xa5cf('0x4c')],{})['then'](function(_0x24189a){var _0x30cefd=_0x36ba86[_0xa5cf('0x4d')][_0xa5cf('0x2d')]({'plain':!![]});if(!_0x30cefd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30cefd[_0xa5cf('0x4e')]===_0xa5cf('0x4d')){var _0x531b9d=_0x24189a[_0xa5cf('0x2d')]({'plain':!![]});var _0x219c60=_0xa5cf('0x2e');return db[_0xa5cf('0x4f')][_0xa5cf('0x50')]({'where':{'name':_0x219c60,'userProfileId':_0x30cefd[_0xa5cf('0x51')]},'raw':!![]})['then'](function(_0x28d849){if(_0x28d849&&_0x28d849[_0xa5cf('0x52')]===0x0){return db[_0xa5cf('0x53')][_0xa5cf('0x4b')]({'name':_0x531b9d[_0xa5cf('0x30')],'resourceId':_0x531b9d['id'],'type':_0x28d849[_0xa5cf('0x30')],'sectionId':_0x28d849['id']},{})['then'](function(){return _0x24189a;});}else{return _0x24189a;}})[_0xa5cf('0x46')](function(_0x3bc582){logger[_0xa5cf('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bc582);throw _0x3bc582;});}return _0x24189a;})['then'](respondWithResult(_0x4f2f13,0xc9))[_0xa5cf('0x46')](handleError(_0x4f2f13,null));};exports[_0xa5cf('0x2a')]=function(_0x836ea,_0x59fa05){if(_0x836ea[_0xa5cf('0x4c')]['id']){delete _0x836ea[_0xa5cf('0x4c')]['id'];}return db[_0xa5cf('0x49')][_0xa5cf('0x50')]({'where':{'id':_0x836ea[_0xa5cf('0x55')]['id']}})[_0xa5cf('0x2b')](handleEntityNotFound(_0x59fa05,null))[_0xa5cf('0x2b')](saveUpdates(_0x836ea['body'],null))['then'](respondWithResult(_0x59fa05,null))[_0xa5cf('0x46')](handleError(_0x59fa05,null));};exports[_0xa5cf('0x2c')]=function(_0x570d18,_0xfd5073){return db[_0xa5cf('0x49')]['find']({'where':{'id':_0x570d18[_0xa5cf('0x55')]['id']}})[_0xa5cf('0x2b')](handleEntityNotFound(_0xfd5073,null))[_0xa5cf('0x2b')](removeEntity(_0xfd5073,null))['catch'](handleError(_0xfd5073,null));};exports[_0xa5cf('0x56')]=function(_0x162ea9,_0x2ba28f){return db[_0xa5cf('0x49')][_0xa5cf('0x56')]()['then'](respondWithResult(_0x2ba28f,null))[_0xa5cf('0x46')](handleError(_0x2ba28f,null));};exports[_0xa5cf('0x57')]=function(_0x3577b7,_0x56a256,_0x429371){var _0x389db1={'raw':!![],'where':{}},_0x134101={},_0x4e621f;return db[_0xa5cf('0x49')][_0xa5cf('0x58')]({'where':{'id':_0x3577b7[_0xa5cf('0x55')]['id']}})[_0xa5cf('0x2b')](handleEntityNotFound(_0x56a256,null))[_0xa5cf('0x2b')](function(_0x5bf1a3){if(_0x5bf1a3){_0x4e621f=_0x5bf1a3[_0xa5cf('0x2d')]({'plain':!![]});_0x134101['model']=_[_0xa5cf('0x48')](db[_0xa5cf('0x59')][_0xa5cf('0x34')]);_0x134101[_0xa5cf('0x39')]=_[_0xa5cf('0x48')](_0x3577b7[_0xa5cf('0x39')]);_0x134101['filters']=_['intersection'](_0x134101[_0xa5cf('0x38')],_0x134101[_0xa5cf('0x39')]);_0x389db1[_0xa5cf('0x3c')]=_[_0xa5cf('0x3b')](_0x134101[_0xa5cf('0x38')],qs[_0xa5cf('0x3d')](_0x3577b7[_0xa5cf('0x39')]['fields']));_0x389db1['attributes']=_0x389db1[_0xa5cf('0x3c')][_0xa5cf('0x3e')]?_0x389db1[_0xa5cf('0x3c')]:_0x134101[_0xa5cf('0x38')];if(!_0x3577b7[_0xa5cf('0x39')][_0xa5cf('0x5a')]('nolimit')){_0x389db1[_0xa5cf('0x22')]=qs[_0xa5cf('0x22')](_0x3577b7[_0xa5cf('0x39')][_0xa5cf('0x22')]);_0x389db1[_0xa5cf('0x21')]=qs[_0xa5cf('0x21')](_0x3577b7[_0xa5cf('0x39')][_0xa5cf('0x21')]);}_0x389db1[_0xa5cf('0x5b')]=qs[_0xa5cf('0x3f')](_0x3577b7['query'][_0xa5cf('0x3f')]);_0x389db1[_0xa5cf('0x42')]=qs[_0xa5cf('0x3a')](_[_0xa5cf('0x40')](_0x3577b7[_0xa5cf('0x39')],_0x134101['filters']));_0x389db1['where'][_0xa5cf('0x5c')]=_0x5bf1a3['id'];if(_0x3577b7[_0xa5cf('0x39')][_0xa5cf('0x41')]){_0x389db1[_0xa5cf('0x42')]=_['merge'](_0x389db1[_0xa5cf('0x42')],{'$or':_[_0xa5cf('0x33')](_0x389db1['attributes'],function(_0x18ce5e){var _0x36c750={};_0x36c750[_0x18ce5e]={'$like':'%'+_0x3577b7[_0xa5cf('0x39')]['filter']+'%'};return _0x36c750;})});}_0x389db1=_[_0xa5cf('0x43')]({},_0x389db1,_0x3577b7[_0xa5cf('0x44')]);return db[_0xa5cf('0x59')][_0xa5cf('0x5d')](_0x389db1);}})[_0xa5cf('0x2b')](function(_0x3f4b01){if(_0x3f4b01){return db[_0xa5cf('0x5e')][_0xa5cf('0x5f')]({'where':{'id':_[_0xa5cf('0x33')](_0x3f4b01,_0xa5cf('0x60')),'role':_0xa5cf('0x61')},'attributes':['id',_0xa5cf('0x30'),_0xa5cf('0x62'),_0xa5cf('0x63'),_0xa5cf('0x64')]});}})[_0xa5cf('0x2b')](function(_0x3ee1be){if(_0x3ee1be){return{'count':_0x3ee1be[_0xa5cf('0x24')],'rows':_[_0xa5cf('0x33')](_0x3ee1be['rows'],function(_0x4aad86){return{'membername':_0x4aad86['name'],'UserId':_0x4aad86['id'],'queue_name':_0x4e621f['name'],'OpenchannelQueueId':_0x4e621f['id'],'interface':util[_0xa5cf('0x65')]('%s/%s',_0xa5cf('0x66'),_0x4aad86[_0xa5cf('0x30')]),'penalty':0x0,'paused':_0x4aad86[_0xa5cf('0x62')],'createdAt':_0x4aad86[_0xa5cf('0x64')],'updatedAt':_0x4aad86['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa5cf('0x2b')](respondWithFilteredResult(_0x56a256,_0x389db1))[_0xa5cf('0x46')](handleError(_0x56a256,null));};exports[_0xa5cf('0x67')]=function(_0x39cf9b,_0x3ffdf4,_0x4aff63){var _0x2869e8={};var _0x5de784={};var _0xe11875;var _0x225174;return db['OpenchannelQueue'][_0xa5cf('0x58')]({'where':{'id':_0x39cf9b[_0xa5cf('0x55')]['id']}})[_0xa5cf('0x2b')](handleEntityNotFound(_0x3ffdf4,null))[_0xa5cf('0x2b')](function(_0x108533){if(_0x108533){_0xe11875=_0x108533;_0x5de784[_0xa5cf('0x38')]=_[_0xa5cf('0x48')](db[_0xa5cf('0x68')][_0xa5cf('0x34')]);_0x5de784[_0xa5cf('0x39')]=_[_0xa5cf('0x48')](_0x39cf9b['query']);_0x5de784[_0xa5cf('0x3a')]=_[_0xa5cf('0x3b')](_0x5de784[_0xa5cf('0x38')],_0x5de784[_0xa5cf('0x39')]);_0x2869e8[_0xa5cf('0x3c')]=_[_0xa5cf('0x3b')](_0x5de784[_0xa5cf('0x38')],qs[_0xa5cf('0x3d')](_0x39cf9b[_0xa5cf('0x39')]['fields']));_0x2869e8['attributes']=_0x2869e8[_0xa5cf('0x3c')][_0xa5cf('0x3e')]?_0x2869e8[_0xa5cf('0x3c')]:_0x5de784[_0xa5cf('0x38')];_0x2869e8[_0xa5cf('0x5b')]=qs['sort'](_0x39cf9b[_0xa5cf('0x39')][_0xa5cf('0x3f')]);_0x2869e8[_0xa5cf('0x42')]=qs['filters'](_[_0xa5cf('0x40')](_0x39cf9b[_0xa5cf('0x39')],_0x5de784[_0xa5cf('0x3a')]));if(_0x39cf9b['query'][_0xa5cf('0x41')]){_0x2869e8[_0xa5cf('0x42')]=_[_0xa5cf('0x43')](_0x2869e8['where'],{'$or':_[_0xa5cf('0x33')](_0x2869e8[_0xa5cf('0x3c')],function(_0x30af86){var _0x2c82b0={};_0x2c82b0[_0x30af86]={'$like':'%'+_0x39cf9b[_0xa5cf('0x39')][_0xa5cf('0x41')]+'%'};return _0x2c82b0;})});}_0x2869e8=_[_0xa5cf('0x43')]({},_0x2869e8,_0x39cf9b[_0xa5cf('0x44')]);return _0xe11875[_0xa5cf('0x67')](_0x2869e8);}})[_0xa5cf('0x2b')](function(_0x2389a6){if(_0x2389a6){_0x225174=_0x2389a6[_0xa5cf('0x3e')];if(!_0x39cf9b['query'][_0xa5cf('0x5a')](_0xa5cf('0x69'))){_0x2869e8['limit']=qs[_0xa5cf('0x22')](_0x39cf9b['query'][_0xa5cf('0x22')]);_0x2869e8['offset']=qs[_0xa5cf('0x21')](_0x39cf9b['query'][_0xa5cf('0x21')]);}return _0xe11875[_0xa5cf('0x67')](_0x2869e8);}})['then'](function(_0x69ef27){if(_0x69ef27){return _0x69ef27?{'count':_0x225174,'rows':_0x69ef27}:null;}})[_0xa5cf('0x2b')](respondWithResult(_0x3ffdf4,null))[_0xa5cf('0x46')](handleError(_0x3ffdf4,null));};exports[_0xa5cf('0x6a')]=function(_0x333c99,_0x4c2ca1,_0x12e735){var _0x401292=_0x333c99['body'][_0xa5cf('0x6b')];return db[_0xa5cf('0x68')][_0xa5cf('0x5d')]({'where':{'id':_0x401292},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xa5cf('0x30'),'online',_0xa5cf('0x6c'),_0xa5cf('0x6d')],'raw':!![]}]})[_0xa5cf('0x2b')](function(_0x50682b){if(_0x50682b){var _0x2e1b64=_[_0xa5cf('0x6e')](_0x50682b,function(_0x40cf0d){var _0x4c04c0=_0x40cf0d[_0xa5cf('0x2d')]({'plain':!![]});return _0x4c04c0[_0xa5cf('0x6f')];});return db[_0xa5cf('0x49')]['find']({'where':{'id':_0x333c99[_0xa5cf('0x55')]['id']}})[_0xa5cf('0x2b')](function(_0x4708cd){return db[_0xa5cf('0x70')][_0xa5cf('0x71')](function(_0x2b280d){return _0x4708cd[_0xa5cf('0x6a')](_0x401292,{'transaction':_0x2b280d})[_0xa5cf('0x2b')](function(){return BPromise[_0xa5cf('0x72')](_0x2e1b64,function(_0x3d86bc){return db[_0xa5cf('0x59')][_0xa5cf('0x73')]({'where':{'UserId':_0x3d86bc['id'],'OpenchannelQueueId':_0x333c99[_0xa5cf('0x55')]['id']},'transaction':_0x2b280d});});})[_0xa5cf('0x2b')](function(){_0x2e1b64[_0xa5cf('0x74')](function(_0xba4af3){socket[_0xa5cf('0x75')](_0xa5cf('0x76'),{'UserId':_0xba4af3['id'],'OpenchannelQueueId':_0x4708cd['id']});});});});});}})[_0xa5cf('0x2b')](respondWithStatusCode(_0x4c2ca1,null))[_0xa5cf('0x46')](handleError(_0x4c2ca1,null));};exports[_0xa5cf('0x77')]=function(_0x5e904f,_0x4916f3,_0x87fb51){return db[_0xa5cf('0x68')]['findAll']({'where':{'id':_0x5e904f[_0xa5cf('0x39')][_0xa5cf('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xa5cf('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4916f3,null))[_0xa5cf('0x2b')](function(_0x17c4ca){var _0x1b4102=_[_0xa5cf('0x33')](_0x17c4ca,'id');var _0x330834=[];var _0x297fac=[];var _0x304d9a=squel[_0xa5cf('0x78')]();_0x304d9a[_0xa5cf('0x79')](_0xa5cf('0x7a'))[_0xa5cf('0x7b')]('team_has_openchannel_queues','tq')[_0xa5cf('0x7c')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa5cf('0x42')](_0xa5cf('0x7d'),_0x5e904f[_0xa5cf('0x55')]['id']);for(var _0x21ee88=0x0;_0x21ee88<_0x17c4ca[_0xa5cf('0x3e')];_0x21ee88+=0x1){let _0x140ccf=_0x17c4ca[_0x21ee88];for(var _0x2cc1fc=0x0;_0x2cc1fc<_0x140ccf[_0xa5cf('0x6f')]['length'];_0x2cc1fc+=0x1){let _0x47cc51=_0x140ccf['Agents'][_0x2cc1fc];var _0xcd388a=_0x304d9a[_0xa5cf('0x7e')]();_0xcd388a[_0xa5cf('0x42')](_0xa5cf('0x7f'),_0x47cc51['id']);_0x297fac[_0xa5cf('0x80')](db['sequelize']['query'](_0xcd388a[_0xa5cf('0x81')](),{'type':db[_0xa5cf('0x70')]['QueryTypes'][_0xa5cf('0x82')]})[_0xa5cf('0x2b')](function(_0x11f0ea){if(_0x11f0ea[_0xa5cf('0x3e')]===0x1){return _0x47cc51['id'];}else{var _0x3ccee7=_['every'](_[_0xa5cf('0x33')](_0x11f0ea,'TeamId'),function(_0x2f22c5){return _[_0xa5cf('0x83')](_0x1b4102,_0x2f22c5);});if(_0x3ccee7){return _0x47cc51['id'];}}}));}}return BPromise[_0xa5cf('0x84')](_0x297fac)['then'](function(_0x256143){_0x330834=_(_0x330834)['union'](_0x256143)[_0xa5cf('0x85')]()['value']();return db['OpenchannelQueue']['find']({'where':{'id':_0x5e904f[_0xa5cf('0x55')]['id']}})[_0xa5cf('0x2b')](function(_0x1770cd){return db[_0xa5cf('0x70')][_0xa5cf('0x71')](function(_0x5a5f16){return _0x1770cd[_0xa5cf('0x77')](_0x5e904f[_0xa5cf('0x39')][_0xa5cf('0x6b')],{'transaction':_0x5a5f16})[_0xa5cf('0x2b')](function(){if(!_['isEmpty'](_0x330834)){return _0x1770cd[_0xa5cf('0x86')](_0x330834,{'transaction':_0x5a5f16});}})[_0xa5cf('0x2b')](function(){_0x330834['forEach'](function(_0x7fdb54){socket[_0xa5cf('0x75')](_0xa5cf('0x87'),{'UserId':_0x7fdb54,'OpenchannelQueueId':_0x1770cd['id']});});});});});});})[_0xa5cf('0x2b')](respondWithStatusCode(_0x4916f3,null))[_0xa5cf('0x46')](handleError(_0x4916f3,null));};exports[_0xa5cf('0x88')]=function(_0x530dd1,_0x2aeae2,_0x50a74e){return db[_0xa5cf('0x49')][_0xa5cf('0x50')]({'where':{'id':_0x530dd1[_0xa5cf('0x55')]['id']}})[_0xa5cf('0x2b')](handleEntityNotFound(_0x2aeae2,null))[_0xa5cf('0x2b')](function(_0x434f82){if(_0x434f82){return _0x434f82['addAgents'](_0x530dd1[_0xa5cf('0x4c')]['ids'],_[_0xa5cf('0x89')](_0x530dd1[_0xa5cf('0x4c')],['ids','id'])||{})[_0xa5cf('0x8a')](function(_0x109b4b){for(var _0x305c87=0x0;_0x305c87<_0x530dd1[_0xa5cf('0x4c')][_0xa5cf('0x6b')][_0xa5cf('0x3e')];_0x305c87+=0x1){socket['emit'](_0xa5cf('0x76'),{'UserId':_0x530dd1[_0xa5cf('0x4c')][_0xa5cf('0x6b')][_0x305c87],'OpenchannelQueueId':_0x530dd1[_0xa5cf('0x55')]['id']});}return _0x109b4b;});}})[_0xa5cf('0x2b')](respondWithResult(_0x2aeae2,null))[_0xa5cf('0x46')](handleError(_0x2aeae2,null));};exports[_0xa5cf('0x86')]=function(_0x1afab7,_0x1bd7b0,_0x3e67d2){return db[_0xa5cf('0x49')][_0xa5cf('0x50')]({'where':{'id':_0x1afab7[_0xa5cf('0x55')]['id']}})[_0xa5cf('0x2b')](handleEntityNotFound(_0x1bd7b0,null))['then'](function(_0xb3d43c){if(_0xb3d43c){return _0xb3d43c[_0xa5cf('0x86')](_0x1afab7[_0xa5cf('0x39')][_0xa5cf('0x6b')])[_0xa5cf('0x2b')](function(){if(_['isArray'](_0x1afab7[_0xa5cf('0x39')]['ids'])){for(var _0x1710c6=0x0;_0x1710c6<_0x1afab7['query'][_0xa5cf('0x6b')][_0xa5cf('0x3e')];_0x1710c6+=0x1){socket[_0xa5cf('0x75')](_0xa5cf('0x87'),{'UserId':Number(_0x1afab7['query'][_0xa5cf('0x6b')][_0x1710c6]),'OpenchannelQueueId':Number(_0x1afab7[_0xa5cf('0x55')]['id'])});}}else{socket[_0xa5cf('0x75')](_0xa5cf('0x87'),{'UserId':Number(_0x1afab7['query']['ids']),'OpenchannelQueueId':Number(_0x1afab7[_0xa5cf('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x1bd7b0,null))[_0xa5cf('0x46')](handleError(_0x1bd7b0,null));};exports[_0xa5cf('0x8b')]=function(_0x3267cf,_0x41804d,_0x49bbd9){var _0x129605={};var _0xb770ec={};var _0x2e0cdd;var _0x4ff6a8;return db[_0xa5cf('0x49')][_0xa5cf('0x58')]({'where':{'id':_0x3267cf[_0xa5cf('0x55')]['id']}})['then'](handleEntityNotFound(_0x41804d,null))[_0xa5cf('0x2b')](function(_0x1db8fb){if(_0x1db8fb){_0x2e0cdd=_0x1db8fb;_0xb770ec['model']=_[_0xa5cf('0x48')](db['User']['rawAttributes']);_0xb770ec[_0xa5cf('0x39')]=_[_0xa5cf('0x48')](_0x3267cf[_0xa5cf('0x39')]);_0xb770ec[_0xa5cf('0x3a')]=_['intersection'](_0xb770ec[_0xa5cf('0x38')],_0xb770ec['query']);_0x129605[_0xa5cf('0x3c')]=_[_0xa5cf('0x3b')](_0xb770ec[_0xa5cf('0x38')],qs[_0xa5cf('0x3d')](_0x3267cf[_0xa5cf('0x39')][_0xa5cf('0x3d')]));_0x129605[_0xa5cf('0x3c')]=_0x129605[_0xa5cf('0x3c')][_0xa5cf('0x3e')]?_0x129605[_0xa5cf('0x3c')]:_0xb770ec[_0xa5cf('0x38')];_0x129605[_0xa5cf('0x5b')]=qs[_0xa5cf('0x3f')](_0x3267cf['query'][_0xa5cf('0x3f')]);_0x129605[_0xa5cf('0x42')]=qs['filters'](_[_0xa5cf('0x40')](_0x3267cf[_0xa5cf('0x39')],_0xb770ec[_0xa5cf('0x3a')]));if(_0x3267cf['query'][_0xa5cf('0x41')]){_0x129605[_0xa5cf('0x42')]=_['merge'](_0x129605[_0xa5cf('0x42')],{'$or':_[_0xa5cf('0x33')](_0x129605[_0xa5cf('0x3c')],function(_0x1a41c5){var _0x3498fd={};_0x3498fd[_0x1a41c5]={'$like':'%'+_0x3267cf[_0xa5cf('0x39')][_0xa5cf('0x41')]+'%'};return _0x3498fd;})});}_0x129605=_[_0xa5cf('0x43')]({},_0x129605,_0x3267cf['options']);return _0x2e0cdd[_0xa5cf('0x8b')](_0x129605);}})['then'](function(_0x4470b1){if(_0x4470b1){_0x4ff6a8=_0x4470b1['length'];if(!_0x3267cf[_0xa5cf('0x39')][_0xa5cf('0x5a')](_0xa5cf('0x69'))){_0x129605[_0xa5cf('0x22')]=qs['limit'](_0x3267cf[_0xa5cf('0x39')][_0xa5cf('0x22')]);_0x129605[_0xa5cf('0x21')]=qs[_0xa5cf('0x21')](_0x3267cf[_0xa5cf('0x39')][_0xa5cf('0x21')]);}return _0x2e0cdd[_0xa5cf('0x8b')](_0x129605);}})[_0xa5cf('0x2b')](function(_0x1b5137){if(_0x1b5137){return _0x1b5137?{'count':_0x4ff6a8,'rows':_0x1b5137}:null;}})[_0xa5cf('0x2b')](respondWithResult(_0x41804d,null))[_0xa5cf('0x46')](handleError(_0x41804d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 09efb84..4ecf9cb 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 _0xb897=['OpenchannelQueue','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x264fd4,_0x2494f6){var _0x20885f=function(_0xdd751){while(--_0xdd751){_0x264fd4['push'](_0x264fd4['shift']());}};_0x20885f(++_0x2494f6);}(_0xb897,0x10c));var _0x7b89=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xb897[_0x9df060];return _0x338dfe;};'use strict';var EventEmitter=require(_0x7b89('0x0'));var OpenchannelQueue=require(_0x7b89('0x1'))['db'][_0x7b89('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1e9485){return function(_0x543fce,_0x5847bf,_0x3a9781){OpenchannelQueueEvents['emit'](_0x1e9485+':'+_0x543fce['id'],_0x543fce);OpenchannelQueueEvents['emit'](_0x1e9485,_0x543fce);_0x3a9781(null);};}for(var e in events){if(events[_0x7b89('0x3')](e)){var event=events[e];OpenchannelQueue[_0x7b89('0x4')](e,emitEvent(event));}}module[_0x7b89('0x5')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x3792=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x13ae71,_0x5384da){var _0x50dc57=function(_0x2255fc){while(--_0x2255fc){_0x13ae71['push'](_0x13ae71['shift']());}};_0x50dc57(++_0x5384da);}(_0x3792,0x1e1));var _0x2379=function(_0x4d2a29,_0x4fa94a){_0x4d2a29=_0x4d2a29-0x0;var _0x417589=_0x3792[_0x4d2a29];return _0x417589;};'use strict';var EventEmitter=require(_0x2379('0x0'));var OpenchannelQueue=require(_0x2379('0x1'))['db'][_0x2379('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2379('0x3')](0x0);var events={'afterCreate':_0x2379('0x4'),'afterUpdate':'update','afterDestroy':_0x2379('0x5')};function emitEvent(_0x2e1b8b){return function(_0x559542,_0x326d03,_0x1e363e){OpenchannelQueueEvents[_0x2379('0x6')](_0x2e1b8b+':'+_0x559542['id'],_0x559542);OpenchannelQueueEvents[_0x2379('0x6')](_0x2e1b8b,_0x559542);_0x1e363e(null);};}for(var e in events){if(events[_0x2379('0x7')](e)){var event=events[e];OpenchannelQueue[_0x2379('0x8')](e,emitEvent(event));}}module[_0x2379('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 2978dd1..496fe07 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 _0x69e6=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util'];(function(_0x5a69b5,_0x167340){var _0x33a7fe=function(_0x5dd843){while(--_0x5dd843){_0x5a69b5['push'](_0x5a69b5['shift']());}};_0x33a7fe(++_0x167340);}(_0x69e6,0x1e0));var _0x669e=function(_0x2b5177,_0x25811c){_0x2b5177=_0x2b5177-0x0;var _0x4f4cfc=_0x69e6[_0x2b5177];return _0x4f4cfc;};'use strict';var _=require('lodash');var util=require(_0x669e('0x0'));var logger=require(_0x669e('0x1'))(_0x669e('0x2'));var moment=require(_0x669e('0x3'));var BPromise=require(_0x669e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x669e('0x5'));var rimraf=require(_0x669e('0x6'));var config=require(_0x669e('0x7'));var attributes=require(_0x669e('0x8'));module[_0x669e('0x9')]=function(_0x1be88f,_0x28f1d9){return _0x1be88f[_0x669e('0xa')](_0x669e('0xb'),attributes,{'tableName':_0x669e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f2a=['../../config/environment','exports','define','OpenchannelQueue','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x0f2a,0x12d));var _0xa0f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0f2a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa0f2('0x0'));var util=require('util');var logger=require(_0xa0f2('0x1'))(_0xa0f2('0x2'));var moment=require(_0xa0f2('0x3'));var BPromise=require('bluebird');var rp=require(_0xa0f2('0x4'));var fs=require('fs');var path=require(_0xa0f2('0x5'));var rimraf=require(_0xa0f2('0x6'));var config=require(_0xa0f2('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0xa0f2('0x8')]=function(_0x29807f,_0x56be5b){return _0x29807f[_0xa0f2('0x9')](_0xa0f2('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index c95d18f..454b34d 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 _0xc865=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','limit','include','map','model','attributes','ShowOpenchannelQueue','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x4af01e,_0x543f5c){var _0x178c11=function(_0x2c2f76){while(--_0x2c2f76){_0x4af01e['push'](_0x4af01e['shift']());}};_0x178c11(++_0x543f5c);}(_0xc865,0xe1));var _0x5c86=function(_0x226d95,_0x40f111){_0x226d95=_0x226d95-0x0;var _0x30859f=_0xc865[_0x226d95];return _0x30859f;};'use strict';var _=require(_0x5c86('0x0'));var util=require(_0x5c86('0x1'));var moment=require(_0x5c86('0x2'));var BPromise=require(_0x5c86('0x3'));var rs=require(_0x5c86('0x4'));var fs=require('fs');var Redis=require(_0x5c86('0x5'));var db=require(_0x5c86('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5c86('0x7'));var config=require(_0x5c86('0x8'));var jayson=require(_0x5c86('0x9'));var client=jayson['client'][_0x5c86('0xa')]({'port':0x232a});config[_0x5c86('0xb')]=_[_0x5c86('0xc')](config[_0x5c86('0xb')],{'host':_0x5c86('0xd'),'port':0x18eb});var socket=require(_0x5c86('0xe'))(new Redis(config[_0x5c86('0xb')]));require(_0x5c86('0xf'))['register'](socket);function respondWithRpcPromise(_0x227c79,_0x192957,_0x38e176){return new BPromise(function(_0x538982,_0x1d2d33){return client['request'](_0x227c79,_0x38e176)[_0x5c86('0x10')](function(_0x38ad60){logger[_0x5c86('0x11')](_0x5c86('0x12'),_0x192957,_0x5c86('0x13'));logger[_0x5c86('0x14')](_0x5c86('0x15'),_0x192957,_0x5c86('0x13'),JSON[_0x5c86('0x16')](_0x38ad60));if(_0x38ad60[_0x5c86('0x17')]){if(_0x38ad60['error'][_0x5c86('0x18')]===0x1f4){logger['error'](_0x5c86('0x12'),_0x192957,_0x38ad60['error'][_0x5c86('0x19')]);return _0x1d2d33(_0x38ad60[_0x5c86('0x17')]['message']);}logger[_0x5c86('0x17')](_0x5c86('0x12'),_0x192957,_0x38ad60[_0x5c86('0x17')][_0x5c86('0x19')]);return _0x538982(_0x38ad60[_0x5c86('0x17')][_0x5c86('0x19')]);}else{logger[_0x5c86('0x11')](_0x5c86('0x12'),_0x192957,_0x5c86('0x13'));_0x538982(_0x38ad60[_0x5c86('0x1a')][_0x5c86('0x19')]);}})[_0x5c86('0x1b')](function(_0x38ef4f){logger[_0x5c86('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x192957,_0x38ef4f);_0x1d2d33(_0x38ef4f);});});}exports[_0x5c86('0x1c')]=function(_0x43ba81){var _0x3dd9ce=this;return new Promise(function(_0x2c6b47,_0x16fad5){return db[_0x5c86('0x1d')]['findAll']({'raw':_0x43ba81[_0x5c86('0x1e')]?_0x43ba81[_0x5c86('0x1e')][_0x5c86('0x1f')]===undefined?!![]:![]:!![],'where':_0x43ba81[_0x5c86('0x1e')]?_0x43ba81[_0x5c86('0x1e')]['where']||null:null,'attributes':_0x43ba81[_0x5c86('0x1e')]?_0x43ba81[_0x5c86('0x1e')]['attributes']||null:null,'limit':_0x43ba81['options']?_0x43ba81[_0x5c86('0x1e')][_0x5c86('0x20')]||null:null,'include':_0x43ba81[_0x5c86('0x1e')]?_0x43ba81[_0x5c86('0x1e')][_0x5c86('0x21')]?_[_0x5c86('0x22')](_0x43ba81[_0x5c86('0x1e')][_0x5c86('0x21')],function(_0x2788e6){return{'model':db[_0x2788e6[_0x5c86('0x23')]],'as':_0x2788e6['as'],'attributes':_0x2788e6[_0x5c86('0x24')],'include':_0x2788e6['include']?_[_0x5c86('0x22')](_0x2788e6[_0x5c86('0x21')],function(_0x3f87ed){return{'model':db[_0x3f87ed[_0x5c86('0x23')]],'as':_0x3f87ed['as'],'attributes':_0x3f87ed[_0x5c86('0x24')],'include':_0x3f87ed[_0x5c86('0x21')]?_[_0x5c86('0x22')](_0x3f87ed[_0x5c86('0x21')],function(_0x1a7952){return{'model':db[_0x1a7952['model']],'as':_0x1a7952['as'],'attributes':_0x1a7952[_0x5c86('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3be451){logger[_0x5c86('0x11')](_0x5c86('0x1c'),_0x43ba81);logger[_0x5c86('0x14')](_0x5c86('0x1c'),_0x43ba81,JSON['stringify'](_0x3be451));_0x2c6b47(_0x3be451);})[_0x5c86('0x1b')](function(_0x49be1e){logger[_0x5c86('0x17')](_0x5c86('0x1c'),_0x49be1e['message'],_0x43ba81);_0x16fad5(_0x3dd9ce[_0x5c86('0x17')](0x1f4,_0x49be1e['message']));});});};exports[_0x5c86('0x25')]=function(_0x4c82c4){var _0x2dba77=this;return new Promise(function(_0x12a0a5,_0x3bd7ad){return db[_0x5c86('0x1d')]['find']({'raw':_0x4c82c4['options']?_0x4c82c4[_0x5c86('0x1e')][_0x5c86('0x1f')]===undefined?!![]:![]:!![],'where':_0x4c82c4['options']?_0x4c82c4[_0x5c86('0x1e')][_0x5c86('0x26')]||null:null,'attributes':_0x4c82c4[_0x5c86('0x1e')]?_0x4c82c4[_0x5c86('0x1e')][_0x5c86('0x24')]||null:null,'include':_0x4c82c4[_0x5c86('0x1e')]?_0x4c82c4[_0x5c86('0x1e')][_0x5c86('0x21')]?_[_0x5c86('0x22')](_0x4c82c4[_0x5c86('0x1e')][_0x5c86('0x21')],function(_0x1f58fa){return{'model':db[_0x1f58fa[_0x5c86('0x23')]],'as':_0x1f58fa['as'],'attributes':_0x1f58fa[_0x5c86('0x24')],'include':_0x1f58fa[_0x5c86('0x21')]?_['map'](_0x1f58fa[_0x5c86('0x21')],function(_0x3d0ef8){return{'model':db[_0x3d0ef8[_0x5c86('0x23')]],'as':_0x3d0ef8['as'],'attributes':_0x3d0ef8[_0x5c86('0x24')],'include':_0x3d0ef8[_0x5c86('0x21')]?_[_0x5c86('0x22')](_0x3d0ef8[_0x5c86('0x21')],function(_0x5b4c15){return{'model':db[_0x5b4c15[_0x5c86('0x23')]],'as':_0x5b4c15['as'],'attributes':_0x5b4c15[_0x5c86('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5c86('0x10')](function(_0x169973){logger[_0x5c86('0x11')](_0x5c86('0x25'),_0x4c82c4);logger[_0x5c86('0x14')](_0x5c86('0x25'),_0x4c82c4,JSON[_0x5c86('0x16')](_0x169973));_0x12a0a5(_0x169973);})[_0x5c86('0x1b')](function(_0x356f2b){logger[_0x5c86('0x17')]('ShowOpenchannelQueue',_0x356f2b['message'],_0x4c82c4);_0x3bd7ad(_0x2dba77[_0x5c86('0x17')](0x1f4,_0x356f2b[_0x5c86('0x19')]));});});}; \ No newline at end of file +var _0x0dc2=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','limit','include','map','attributes','model','debug','find','raw','info','ShowOpenchannelQueue','lodash','util'];(function(_0x40e043,_0x2be727){var _0x358bad=function(_0x5c67bf){while(--_0x5c67bf){_0x40e043['push'](_0x40e043['shift']());}};_0x358bad(++_0x2be727);}(_0x0dc2,0x181));var _0x20dc=function(_0x57dc33,_0x4b63e7){_0x57dc33=_0x57dc33-0x0;var _0xb17647=_0x0dc2[_0x57dc33];return _0xb17647;};'use strict';var _=require(_0x20dc('0x0'));var util=require(_0x20dc('0x1'));var moment=require(_0x20dc('0x2'));var BPromise=require(_0x20dc('0x3'));var rs=require(_0x20dc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20dc('0x5'))['db'];var utils=require(_0x20dc('0x6'));var logger=require(_0x20dc('0x7'))(_0x20dc('0x8'));var config=require(_0x20dc('0x9'));var jayson=require(_0x20dc('0xa'));var client=jayson['client'][_0x20dc('0xb')]({'port':0x232a});config[_0x20dc('0xc')]=_[_0x20dc('0xd')](config[_0x20dc('0xc')],{'host':_0x20dc('0xe'),'port':0x18eb});var socket=require(_0x20dc('0xf'))(new Redis(config[_0x20dc('0xc')]));require(_0x20dc('0x10'))[_0x20dc('0x11')](socket);function respondWithRpcPromise(_0x38b8f4,_0x5d72a3,_0x5bff0b){return new BPromise(function(_0x3de1f6,_0x5bce2c){return client[_0x20dc('0x12')](_0x38b8f4,_0x5bff0b)[_0x20dc('0x13')](function(_0x393cec){logger['info'](_0x20dc('0x14'),_0x5d72a3,'request\x20sent');logger['debug'](_0x20dc('0x15'),_0x5d72a3,_0x20dc('0x16'),JSON[_0x20dc('0x17')](_0x393cec));if(_0x393cec[_0x20dc('0x18')]){if(_0x393cec[_0x20dc('0x18')][_0x20dc('0x19')]===0x1f4){logger['error'](_0x20dc('0x14'),_0x5d72a3,_0x393cec[_0x20dc('0x18')]['message']);return _0x5bce2c(_0x393cec[_0x20dc('0x18')][_0x20dc('0x1a')]);}logger[_0x20dc('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x5d72a3,_0x393cec[_0x20dc('0x18')]['message']);return _0x3de1f6(_0x393cec['error'][_0x20dc('0x1a')]);}else{logger['info'](_0x20dc('0x14'),_0x5d72a3,_0x20dc('0x16'));_0x3de1f6(_0x393cec['result']['message']);}})[_0x20dc('0x1b')](function(_0x1d96b0){logger[_0x20dc('0x18')](_0x20dc('0x14'),_0x5d72a3,_0x1d96b0);_0x5bce2c(_0x1d96b0);});});}exports[_0x20dc('0x1c')]=function(_0x1bf919){var _0x50b647=this;return new Promise(function(_0xbe82e7,_0x4ae37e){return db[_0x20dc('0x1d')][_0x20dc('0x1e')]({'raw':_0x1bf919[_0x20dc('0x1f')]?_0x1bf919['options']['raw']===undefined?!![]:![]:!![],'where':_0x1bf919[_0x20dc('0x1f')]?_0x1bf919[_0x20dc('0x1f')][_0x20dc('0x20')]||null:null,'attributes':_0x1bf919[_0x20dc('0x1f')]?_0x1bf919[_0x20dc('0x1f')]['attributes']||null:null,'limit':_0x1bf919[_0x20dc('0x1f')]?_0x1bf919[_0x20dc('0x1f')][_0x20dc('0x21')]||null:null,'include':_0x1bf919[_0x20dc('0x1f')]?_0x1bf919[_0x20dc('0x1f')][_0x20dc('0x22')]?_[_0x20dc('0x23')](_0x1bf919[_0x20dc('0x1f')][_0x20dc('0x22')],function(_0x394546){return{'model':db[_0x394546['model']],'as':_0x394546['as'],'attributes':_0x394546[_0x20dc('0x24')],'include':_0x394546['include']?_[_0x20dc('0x23')](_0x394546['include'],function(_0x3db681){return{'model':db[_0x3db681[_0x20dc('0x25')]],'as':_0x3db681['as'],'attributes':_0x3db681['attributes'],'include':_0x3db681[_0x20dc('0x22')]?_[_0x20dc('0x23')](_0x3db681[_0x20dc('0x22')],function(_0x3cf007){return{'model':db[_0x3cf007[_0x20dc('0x25')]],'as':_0x3cf007['as'],'attributes':_0x3cf007[_0x20dc('0x24')]};}):[]};}):[]};}):[]:[]})[_0x20dc('0x13')](function(_0x2d9006){logger['info'](_0x20dc('0x1c'),_0x1bf919);logger[_0x20dc('0x26')](_0x20dc('0x1c'),_0x1bf919,JSON[_0x20dc('0x17')](_0x2d9006));_0xbe82e7(_0x2d9006);})[_0x20dc('0x1b')](function(_0x38e103){logger[_0x20dc('0x18')](_0x20dc('0x1c'),_0x38e103[_0x20dc('0x1a')],_0x1bf919);_0x4ae37e(_0x50b647[_0x20dc('0x18')](0x1f4,_0x38e103[_0x20dc('0x1a')]));});});};exports['ShowOpenchannelQueue']=function(_0x168eb8){var _0x11da4d=this;return new Promise(function(_0x28de98,_0x3d9ce7){return db[_0x20dc('0x1d')][_0x20dc('0x27')]({'raw':_0x168eb8[_0x20dc('0x1f')]?_0x168eb8['options'][_0x20dc('0x28')]===undefined?!![]:![]:!![],'where':_0x168eb8[_0x20dc('0x1f')]?_0x168eb8[_0x20dc('0x1f')][_0x20dc('0x20')]||null:null,'attributes':_0x168eb8[_0x20dc('0x1f')]?_0x168eb8[_0x20dc('0x1f')][_0x20dc('0x24')]||null:null,'include':_0x168eb8[_0x20dc('0x1f')]?_0x168eb8[_0x20dc('0x1f')][_0x20dc('0x22')]?_[_0x20dc('0x23')](_0x168eb8[_0x20dc('0x1f')]['include'],function(_0x2c9156){return{'model':db[_0x2c9156[_0x20dc('0x25')]],'as':_0x2c9156['as'],'attributes':_0x2c9156[_0x20dc('0x24')],'include':_0x2c9156[_0x20dc('0x22')]?_[_0x20dc('0x23')](_0x2c9156[_0x20dc('0x22')],function(_0x1806ab){return{'model':db[_0x1806ab[_0x20dc('0x25')]],'as':_0x1806ab['as'],'attributes':_0x1806ab[_0x20dc('0x24')],'include':_0x1806ab[_0x20dc('0x22')]?_[_0x20dc('0x23')](_0x1806ab[_0x20dc('0x22')],function(_0x1dcf85){return{'model':db[_0x1dcf85['model']],'as':_0x1dcf85['as'],'attributes':_0x1dcf85[_0x20dc('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c817f){logger[_0x20dc('0x29')](_0x20dc('0x2a'),_0x168eb8);logger[_0x20dc('0x26')]('ShowOpenchannelQueue',_0x168eb8,JSON[_0x20dc('0x17')](_0x2c817f));_0x28de98(_0x2c817f);})[_0x20dc('0x1b')](function(_0x3e5a95){logger['error'](_0x20dc('0x2a'),_0x3e5a95[_0x20dc('0x1a')],_0x168eb8);_0x3d9ce7(_0x11da4d[_0x20dc('0x18')](0x1f4,_0x3e5a95[_0x20dc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 08adbe2..09d87e0 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 _0xb1f9=['remove','update','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0xb54a90,_0x126dfd){var _0x59ef06=function(_0x16f4f1){while(--_0x16f4f1){_0xb54a90['push'](_0xb54a90['shift']());}};_0x59ef06(++_0x126dfd);}(_0xb1f9,0x15e));var _0x9b1f=function(_0x559949,_0x4c124c){_0x559949=_0x559949-0x0;var _0x1e0b4c=_0xb1f9[_0x559949];return _0x1e0b4c;};'use strict';var OpenchannelQueueEvents=require(_0x9b1f('0x0'));var events=[_0x9b1f('0x1'),_0x9b1f('0x2'),_0x9b1f('0x3')];function createListener(_0x576ea8,_0x356c40){return function(_0x3775b5){_0x356c40['emit'](_0x576ea8,_0x3775b5);};}function removeListener(_0x563ba4,_0x38723f){return function(){OpenchannelQueueEvents[_0x9b1f('0x4')](_0x563ba4,_0x38723f);};}exports[_0x9b1f('0x5')]=function(_0x5843d3){for(var _0x3ec32f=0x0,_0x1e4ca8=events[_0x9b1f('0x6')];_0x3ec32f<_0x1e4ca8;_0x3ec32f++){var _0x5e7690=events[_0x3ec32f];var _0x403c02=createListener(_0x9b1f('0x7')+_0x5e7690,_0x5843d3);OpenchannelQueueEvents['on'](_0x5e7690,_0x403c02);}}; \ No newline at end of file +var _0x6c5c=['./openchannelQueue.events','emit','removeListener','register','openchannelQueue:'];(function(_0x48565d,_0x4a8173){var _0x4ecf91=function(_0x58c87e){while(--_0x58c87e){_0x48565d['push'](_0x48565d['shift']());}};_0x4ecf91(++_0x4a8173);}(_0x6c5c,0x168));var _0xc6c5=function(_0x3380dd,_0x2f7b93){_0x3380dd=_0x3380dd-0x0;var _0x257db9=_0x6c5c[_0x3380dd];return _0x257db9;};'use strict';var OpenchannelQueueEvents=require(_0xc6c5('0x0'));var events=['save','remove','update'];function createListener(_0x2f9781,_0x372bc1){return function(_0x1440fb){_0x372bc1[_0xc6c5('0x1')](_0x2f9781,_0x1440fb);};}function removeListener(_0x3fb0dd,_0x148301){return function(){OpenchannelQueueEvents[_0xc6c5('0x2')](_0x3fb0dd,_0x148301);};}exports[_0xc6c5('0x3')]=function(_0x375581){for(var _0x464c7f=0x0,_0x46988b=events['length'];_0x464c7f<_0x46988b;_0x464c7f++){var _0x4e9418=events[_0x464c7f];var _0x4ba775=createListener(_0xc6c5('0x4')+_0x4e9418,_0x375581);OpenchannelQueueEvents['on'](_0x4e9418,_0x4ba775);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 8522f30..abab00c 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 _0x6a63=['post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','get','show'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0x6a63,0xa2));var _0x36a6=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x6a63[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x36a6('0x0'));var util=require(_0x36a6('0x1'));var path=require(_0x36a6('0x2'));var timeout=require(_0x36a6('0x3'));var express=require('express');var router=express[_0x36a6('0x4')]();var fs_extra=require(_0x36a6('0x5'));var auth=require(_0x36a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x36a6('0x7'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x36a6('0x8')](),controller[_0x36a6('0x9')]);router['get'](_0x36a6('0xa'),auth[_0x36a6('0x8')](),controller[_0x36a6('0xb')]);router[_0x36a6('0xc')]('/:id',auth[_0x36a6('0x8')](),controller[_0x36a6('0xd')]);router[_0x36a6('0xe')]('/',auth[_0x36a6('0x8')](),controller[_0x36a6('0xf')]);router[_0x36a6('0x10')]('/:id',auth[_0x36a6('0x8')](),controller[_0x36a6('0x11')]);router[_0x36a6('0x12')](_0x36a6('0x13'),auth[_0x36a6('0x8')](),controller[_0x36a6('0x14')]);module[_0x36a6('0x15')]=router; \ No newline at end of file +var _0x3aa8=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xb6dc95,_0x237135){var _0x430917=function(_0x746612){while(--_0x746612){_0xb6dc95['push'](_0xb6dc95['shift']());}};_0x430917(++_0x237135);}(_0x3aa8,0x69));var _0x83aa=function(_0x3bb633,_0x1fe259){_0x3bb633=_0x3bb633-0x0;var _0x1a438b=_0x3aa8[_0x3bb633];return _0x1a438b;};'use strict';var multer=require('multer');var util=require(_0x83aa('0x0'));var path=require(_0x83aa('0x1'));var timeout=require(_0x83aa('0x2'));var express=require('express');var router=express[_0x83aa('0x3')]();var fs_extra=require(_0x83aa('0x4'));var auth=require(_0x83aa('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x83aa('0x6'));router[_0x83aa('0x7')]('/',auth[_0x83aa('0x8')](),controller[_0x83aa('0x9')]);router[_0x83aa('0x7')](_0x83aa('0xa'),auth[_0x83aa('0x8')](),controller[_0x83aa('0xb')]);router[_0x83aa('0x7')](_0x83aa('0xc'),auth['isAuthenticated'](),controller[_0x83aa('0xd')]);router[_0x83aa('0xe')]('/',auth['isAuthenticated'](),controller[_0x83aa('0xf')]);router[_0x83aa('0x10')]('/:id',auth[_0x83aa('0x8')](),controller[_0x83aa('0x11')]);router[_0x83aa('0x12')](_0x83aa('0xc'),auth[_0x83aa('0x8')](),controller[_0x83aa('0x13')]);module[_0x83aa('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index fb321a9..0fb708b 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 _0x844a=['DATE','moment','exports','STRING'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x844a,0x1a1));var _0xa844=function(_0x3edc20,_0xb713b8){_0x3edc20=_0x3edc20-0x0;var _0x4eb29f=_0x844a[_0x3edc20];return _0x4eb29f;};'use strict';var moment=require(_0xa844('0x0'));var Sequelize=require('sequelize');module[_0xa844('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa844('0x2')]},'joinAt':{'type':Sequelize[_0xa844('0x3')]},'leaveAt':{'type':Sequelize[_0xa844('0x3')]},'acceptAt':{'type':Sequelize[_0xa844('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa844('0x2')]}}; \ No newline at end of file +var _0xad0d=['moment','sequelize','exports','STRING','DATE'];(function(_0x41fed8,_0x168adf){var _0x5d6c66=function(_0x2d3fce){while(--_0x2d3fce){_0x41fed8['push'](_0x41fed8['shift']());}};_0x5d6c66(++_0x168adf);}(_0xad0d,0x14f));var _0xdad0=function(_0x1f7867,_0xdb5dcc){_0x1f7867=_0x1f7867-0x0;var _0x4f84cc=_0xad0d[_0x1f7867];return _0x4f84cc;};'use strict';var moment=require(_0xdad0('0x0'));var Sequelize=require(_0xdad0('0x1'));module[_0xdad0('0x2')]={'uniqueid':{'type':Sequelize[_0xdad0('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xdad0('0x4')]},'leaveAt':{'type':Sequelize[_0xdad0('0x4')]},'acceptAt':{'type':Sequelize[_0xdad0('0x4')]},'exitAt':{'type':Sequelize[_0xdad0('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 6c8561b..b12e321 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 _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0x1bb700,_0x5bb9f1){var _0x46e905=function(_0x35ef40){while(--_0x35ef40){_0x1bb700['push'](_0x1bb700['shift']());}};_0x46e905(++_0x5bb9f1);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['OpenchannelQueueReport']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':!![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['OpenchannelQueueReport']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file +var _0xeda8=['Content-Range','apply','reject','update','then','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','includeAll','include','rows','catch','show','params','keys','options','find','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xeda8,0x104));var _0x8eda=function(_0x48d7ee,_0x2d85ae){_0x48d7ee=_0x48d7ee-0x0;var _0x2342c3=_0xeda8[_0x48d7ee];return _0x2342c3;};'use strict';var emlformat=require(_0x8eda('0x0'));var rimraf=require(_0x8eda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eda('0x2'));var rp=require(_0x8eda('0x3'));var moment=require(_0x8eda('0x4'));var BPromise=require(_0x8eda('0x5'));var Mustache=require(_0x8eda('0x6'));var util=require(_0x8eda('0x7'));var path=require(_0x8eda('0x8'));var sox=require(_0x8eda('0x9'));var csv=require(_0x8eda('0xa'));var ejs=require(_0x8eda('0xb'));var fs=require('fs');var fs_extra=require(_0x8eda('0xc'));var _=require(_0x8eda('0xd'));var squel=require('squel');var crypto=require(_0x8eda('0xe'));var jsforce=require(_0x8eda('0xf'));var deskjs=require(_0x8eda('0x10'));var toCsv=require(_0x8eda('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8eda('0x11'));var as=require(_0x8eda('0x12'));var hardwareService=require(_0x8eda('0x13'));var logger=require('../../config/logger')(_0x8eda('0x14'));var utils=require('../../config/utils');var config=require(_0x8eda('0x15'));var licenseUtil=require(_0x8eda('0x16'));var db=require(_0x8eda('0x17'))['db'];function respondWithStatusCode(_0x1ad3df,_0x337573){_0x337573=_0x337573||0xcc;return function(_0x3af00c){if(_0x3af00c){return _0x1ad3df[_0x8eda('0x18')](_0x337573);}return _0x1ad3df[_0x8eda('0x19')](_0x337573)['end']();};}function respondWithResult(_0x500bd4,_0xe04d90){_0xe04d90=_0xe04d90||0xc8;return function(_0x223dcf){if(_0x223dcf){return _0x500bd4['status'](_0xe04d90)[_0x8eda('0x1a')](_0x223dcf);}};}function respondWithFilteredResult(_0x34b1ee,_0x123905){return function(_0x56ff8a){if(_0x56ff8a){var _0x3f2925=typeof _0x123905['offset']===_0x8eda('0x1b')&&typeof _0x123905['limit']===_0x8eda('0x1b');var _0x58023b=_0x56ff8a[_0x8eda('0x1c')];var _0x2a4d2b=_0x3f2925?0x0:_0x123905['offset'];var _0x5e44b7=_0x3f2925?_0x56ff8a[_0x8eda('0x1c')]:_0x123905[_0x8eda('0x1d')]+_0x123905[_0x8eda('0x1e')];var _0x41abfa;if(_0x5e44b7>=_0x58023b){_0x5e44b7=_0x58023b;_0x41abfa=0xc8;}else{_0x41abfa=0xce;}_0x34b1ee[_0x8eda('0x19')](_0x41abfa);return _0x34b1ee[_0x8eda('0x1f')](_0x8eda('0x20'),_0x2a4d2b+'-'+_0x5e44b7+'/'+_0x58023b)[_0x8eda('0x1a')](_0x56ff8a);}return null;};}function patchUpdates(_0x850cce){return function(_0x232786){try{jsonpatch[_0x8eda('0x21')](_0x232786,_0x850cce,!![]);}catch(_0x57f336){return BPromise[_0x8eda('0x22')](_0x57f336);}return _0x232786['save']();};}function saveUpdates(_0x45517e,_0x5183bc){return function(_0x1033d6){if(_0x1033d6){return _0x1033d6[_0x8eda('0x23')](_0x45517e)['then'](function(_0x58e54b){return _0x58e54b;});}return null;};}function removeEntity(_0x56dba4,_0x2a4c99){return function(_0x17cae8){if(_0x17cae8){return _0x17cae8['destroy']()[_0x8eda('0x24')](function(){_0x56dba4[_0x8eda('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e955,_0xfa57ca){return function(_0x24b1e1){if(!_0x24b1e1){_0x25e955[_0x8eda('0x18')](0x194);}return _0x24b1e1;};}function handleError(_0x2e42e4,_0x5c8488){_0x5c8488=_0x5c8488||0x1f4;return function(_0x41b5a9){logger['error'](_0x41b5a9[_0x8eda('0x25')]);if(_0x41b5a9[_0x8eda('0x26')]){delete _0x41b5a9[_0x8eda('0x26')];}_0x2e42e4['status'](_0x5c8488)[_0x8eda('0x27')](_0x41b5a9);};}exports[_0x8eda('0x28')]=function(_0x1dd12,_0x4cdd2e){var _0x1616ea={},_0x11a999={},_0x5dd315={'count':0x0,'rows':[]};var _0x27d2ce=_[_0x8eda('0x29')](db[_0x8eda('0x2a')][_0x8eda('0x2b')],function(_0x53274e){return{'name':_0x53274e['fieldName'],'type':_0x53274e['type'][_0x8eda('0x2c')]};});_0x11a999[_0x8eda('0x2d')]=_[_0x8eda('0x29')](_0x27d2ce,'name');_0x11a999['query']=_['keys'](_0x1dd12[_0x8eda('0x2e')]);_0x11a999[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x11a999['model'],_0x11a999['query']);_0x1616ea['attributes']=_[_0x8eda('0x30')](_0x11a999[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x31')]));_0x1616ea[_0x8eda('0x32')]=_0x1616ea[_0x8eda('0x32')][_0x8eda('0x33')]?_0x1616ea[_0x8eda('0x32')]:_0x11a999[_0x8eda('0x2d')];if(!_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x34')](_0x8eda('0x35'))){_0x1616ea[_0x8eda('0x1e')]=qs['limit'](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x1e')]);_0x1616ea[_0x8eda('0x1d')]=qs['offset'](_0x1dd12['query'][_0x8eda('0x1d')]);}_0x1616ea[_0x8eda('0x36')]=qs[_0x8eda('0x37')](_0x1dd12[_0x8eda('0x2e')]['sort']);_0x1616ea[_0x8eda('0x38')]=qs[_0x8eda('0x2f')](_[_0x8eda('0x39')](_0x1dd12[_0x8eda('0x2e')],_0x11a999[_0x8eda('0x2f')]),_0x27d2ce);if(_0x1dd12[_0x8eda('0x2e')]['filter']){_0x1616ea[_0x8eda('0x38')]=_[_0x8eda('0x3a')](_0x1616ea[_0x8eda('0x38')],{'$or':_[_0x8eda('0x29')](_0x27d2ce,function(_0x261e12){if(_0x261e12[_0x8eda('0x3b')]!=='VIRTUAL'){var _0x1067eb={};_0x1067eb[_0x261e12[_0x8eda('0x26')]]={'$like':'%'+_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3c')]+'%'};return _0x1067eb;}})});}_0x1616ea=_[_0x8eda('0x3a')]({},_0x1616ea,_0x1dd12['options']);var _0x17ee80={'where':_0x1616ea[_0x8eda('0x38')]};return db[_0x8eda('0x2a')]['count'](_0x17ee80)[_0x8eda('0x24')](function(_0x5d361e){_0x5dd315[_0x8eda('0x1c')]=_0x5d361e;if(_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3d')]){_0x1616ea[_0x8eda('0x3e')]=[{'all':!![]}];}return db[_0x8eda('0x2a')]['findAll'](_0x1616ea);})['then'](function(_0xbf14a1){_0x5dd315[_0x8eda('0x3f')]=_0xbf14a1;return _0x5dd315;})[_0x8eda('0x24')](respondWithFilteredResult(_0x4cdd2e,_0x1616ea))[_0x8eda('0x40')](handleError(_0x4cdd2e,null));};exports[_0x8eda('0x41')]=function(_0x13b3bc,_0x18b043){var _0xcb6164={'raw':!![],'where':{'id':_0x13b3bc[_0x8eda('0x42')]['id']}},_0x184590={};_0x184590[_0x8eda('0x2d')]=_[_0x8eda('0x43')](db[_0x8eda('0x2a')][_0x8eda('0x2b')]);_0x184590[_0x8eda('0x2e')]=_[_0x8eda('0x43')](_0x13b3bc[_0x8eda('0x2e')]);_0x184590[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x184590['model'],_0x184590[_0x8eda('0x2e')]);_0xcb6164[_0x8eda('0x32')]=_['intersection'](_0x184590[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x13b3bc['query'][_0x8eda('0x31')]));_0xcb6164[_0x8eda('0x32')]=_0xcb6164['attributes'][_0x8eda('0x33')]?_0xcb6164[_0x8eda('0x32')]:_0x184590[_0x8eda('0x2d')];if(_0x13b3bc['query'][_0x8eda('0x3d')]){_0xcb6164[_0x8eda('0x3e')]=[{'all':!![]}];}_0xcb6164=_[_0x8eda('0x3a')]({},_0xcb6164,_0x13b3bc[_0x8eda('0x44')]);return db[_0x8eda('0x2a')][_0x8eda('0x45')](_0xcb6164)[_0x8eda('0x24')](handleEntityNotFound(_0x18b043,null))['then'](respondWithResult(_0x18b043,null))[_0x8eda('0x40')](handleError(_0x18b043,null));};exports['create']=function(_0xcde3e,_0x52b026){return db[_0x8eda('0x2a')]['create'](_0xcde3e[_0x8eda('0x46')],{})['then'](respondWithResult(_0x52b026,0xc9))[_0x8eda('0x40')](handleError(_0x52b026,null));};exports[_0x8eda('0x23')]=function(_0xf445,_0x395f5a){if(_0xf445[_0x8eda('0x46')]['id']){delete _0xf445[_0x8eda('0x46')]['id'];}return db[_0x8eda('0x2a')][_0x8eda('0x45')]({'where':{'id':_0xf445[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x395f5a,null))[_0x8eda('0x24')](saveUpdates(_0xf445[_0x8eda('0x46')],null))['then'](respondWithResult(_0x395f5a,null))[_0x8eda('0x40')](handleError(_0x395f5a,null));};exports[_0x8eda('0x47')]=function(_0x25b1eb,_0x3259de){return db[_0x8eda('0x2a')][_0x8eda('0x45')]({'where':{'id':_0x25b1eb[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x3259de,null))[_0x8eda('0x24')](removeEntity(_0x3259de,null))[_0x8eda('0x40')](handleError(_0x3259de,null));};exports[_0x8eda('0x48')]=function(_0x370ec2,_0x1c5e12){return db[_0x8eda('0x2a')][_0x8eda('0x48')]()['then'](respondWithResult(_0x1c5e12,null))[_0x8eda('0x40')](handleError(_0x1c5e12,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 879b66c..ce54ebd 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 _0x3212=['../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x3212,0x6f));var _0x2321=function(_0x1a8656,_0xba0f33){_0x1a8656=_0x1a8656-0x0;var _0x33a1d1=_0x3212[_0x1a8656];return _0x33a1d1;};'use strict';var _=require(_0x2321('0x0'));var util=require(_0x2321('0x1'));var logger=require(_0x2321('0x2'))(_0x2321('0x3'));var moment=require(_0x2321('0x4'));var BPromise=require(_0x2321('0x5'));var rp=require(_0x2321('0x6'));var fs=require('fs');var path=require(_0x2321('0x7'));var rimraf=require(_0x2321('0x8'));var config=require(_0x2321('0x9'));var attributes=require(_0x2321('0xa'));module[_0x2321('0xb')]=function(_0x53d2e1,_0x14b94e){return _0x53d2e1[_0x2321('0xc')](_0x2321('0xd'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0x2321('0xe'),'fields':[_0x2321('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x319c=['moment','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','../../config/logger','api'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x319c,0x1d9));var _0xc319=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x319c[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0xc319('0x0'));var util=require('util');var logger=require(_0xc319('0x1'))(_0xc319('0x2'));var moment=require(_0xc319('0x3'));var BPromise=require('bluebird');var rp=require(_0xc319('0x4'));var fs=require('fs');var path=require(_0xc319('0x5'));var rimraf=require(_0xc319('0x6'));var config=require(_0xc319('0x7'));var attributes=require(_0xc319('0x8'));module[_0xc319('0x9')]=function(_0xd892a7,_0x1c6cc6){return _0xd892a7[_0xc319('0xa')](_0xc319('0xb'),attributes,{'tableName':_0xc319('0xc'),'paranoid':![],'indexes':[{'name':_0xc319('0xd'),'fields':[_0xc319('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index c1a63f1..bf093cf 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 _0x367e=['rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','CreateOpenchannelQueueReport','create','body','options','raw','info','catch','UpdateOpenchannelQueueReport','update','limit','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x20c029,_0xb35d89){var _0xa11ee=function(_0x37e0c8){while(--_0x37e0c8){_0x20c029['push'](_0x20c029['shift']());}};_0xa11ee(++_0xb35d89);}(_0x367e,0x12f));var _0xe367=function(_0x163000,_0x469ff4){_0x163000=_0x163000-0x0;var _0x3e8787=_0x367e[_0x163000];return _0x3e8787;};'use strict';var _=require(_0xe367('0x0'));var util=require('util');var moment=require(_0xe367('0x1'));var BPromise=require(_0xe367('0x2'));var rs=require(_0xe367('0x3'));var fs=require('fs');var Redis=require(_0xe367('0x4'));var db=require(_0xe367('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe367('0x6'))(_0xe367('0x7'));var config=require(_0xe367('0x8'));var jayson=require(_0xe367('0x9'));var client=jayson[_0xe367('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229f1d,_0x22b36d,_0x174d82){return new BPromise(function(_0x18f548,_0xc219ca){return client[_0xe367('0xb')](_0x229f1d,_0x174d82)['then'](function(_0x2c00ce){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x22b36d,_0xe367('0xc'));logger[_0xe367('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x22b36d,_0xe367('0xc'),JSON[_0xe367('0xe')](_0x2c00ce));if(_0x2c00ce[_0xe367('0xf')]){if(_0x2c00ce[_0xe367('0xf')][_0xe367('0x10')]===0x1f4){logger[_0xe367('0xf')](_0xe367('0x11'),_0x22b36d,_0x2c00ce[_0xe367('0xf')]['message']);return _0xc219ca(_0x2c00ce[_0xe367('0xf')]['message']);}logger[_0xe367('0xf')](_0xe367('0x11'),_0x22b36d,_0x2c00ce[_0xe367('0xf')]['message']);return _0x18f548(_0x2c00ce[_0xe367('0xf')][_0xe367('0x12')]);}else{logger['info'](_0xe367('0x11'),_0x22b36d,_0xe367('0xc'));_0x18f548(_0x2c00ce[_0xe367('0x13')][_0xe367('0x12')]);}})['catch'](function(_0x112a6f){logger[_0xe367('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x22b36d,_0x112a6f);_0xc219ca(_0x112a6f);});});}exports[_0xe367('0x14')]=function(_0xf501f5){var _0x3551f1=this;return new Promise(function(_0xf83e78,_0x4f84ff){return db['OpenchannelQueueReport'][_0xe367('0x15')](_0xf501f5[_0xe367('0x16')],{'raw':_0xf501f5[_0xe367('0x17')]?_0xf501f5[_0xe367('0x17')][_0xe367('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5e01d0){logger[_0xe367('0x19')](_0xe367('0x14'),_0xf501f5);logger[_0xe367('0xd')](_0xe367('0x14'),_0xf501f5,JSON[_0xe367('0xe')](_0x5e01d0));_0xf83e78(_0x5e01d0);})[_0xe367('0x1a')](function(_0x552d8e){logger[_0xe367('0xf')]('CreateOpenchannelQueueReport',_0x552d8e[_0xe367('0x12')],_0xf501f5);_0x4f84ff(_0x3551f1[_0xe367('0xf')](0x1f4,_0x552d8e[_0xe367('0x12')]));});});};exports[_0xe367('0x1b')]=function(_0x5ec549){var _0x5693d2=this;return new Promise(function(_0x22e565,_0x66d675){return db['OpenchannelQueueReport'][_0xe367('0x1c')](_0x5ec549[_0xe367('0x16')],{'raw':_0x5ec549[_0xe367('0x17')]?_0x5ec549[_0xe367('0x17')][_0xe367('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ec549[_0xe367('0x17')]?_0x5ec549['options']['where']||null:null,'attributes':_0x5ec549[_0xe367('0x17')]?_0x5ec549[_0xe367('0x17')]['attributes']||null:null,'limit':_0x5ec549['options']?_0x5ec549['options'][_0xe367('0x1d')]||null:null})[_0xe367('0x1e')](function(_0x19cb86){logger[_0xe367('0x19')](_0xe367('0x1b'),_0x5ec549);logger['debug'](_0xe367('0x1b'),_0x5ec549,JSON[_0xe367('0xe')](_0x19cb86));_0x22e565(_0x19cb86);})[_0xe367('0x1a')](function(_0x44223b){logger['error']('UpdateOpenchannelQueueReport',_0x44223b[_0xe367('0x12')],_0x5ec549);_0x66d675(_0x5693d2[_0xe367('0xf')](0x1f4,_0x44223b[_0xe367('0x12')]));});});}; \ No newline at end of file +var _0xff2d=['raw','info','stringify','options','where','limit','UpdateOpenchannelQueueReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body'];(function(_0x4b22a8,_0x197906){var _0x59ec2b=function(_0x5edc16){while(--_0x5edc16){_0x4b22a8['push'](_0x4b22a8['shift']());}};_0x59ec2b(++_0x197906);}(_0xff2d,0xe0));var _0xdff2=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xff2d[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0xdff2('0x0'));var util=require(_0xdff2('0x1'));var moment=require('moment');var BPromise=require(_0xdff2('0x2'));var rs=require(_0xdff2('0x3'));var fs=require('fs');var Redis=require(_0xdff2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdff2('0x5'));var logger=require(_0xdff2('0x6'))(_0xdff2('0x7'));var config=require('../../config/environment');var jayson=require(_0xdff2('0x8'));var client=jayson[_0xdff2('0x9')][_0xdff2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49fc9e,_0xe8d649,_0x2f10ce){return new BPromise(function(_0x3badc5,_0x1c8714){return client[_0xdff2('0xb')](_0x49fc9e,_0x2f10ce)[_0xdff2('0xc')](function(_0x5631e5){logger['info'](_0xdff2('0xd'),_0xe8d649,'request\x20sent');logger[_0xdff2('0xe')](_0xdff2('0xf'),_0xe8d649,_0xdff2('0x10'),JSON['stringify'](_0x5631e5));if(_0x5631e5[_0xdff2('0x11')]){if(_0x5631e5['error']['code']===0x1f4){logger[_0xdff2('0x11')](_0xdff2('0xd'),_0xe8d649,_0x5631e5[_0xdff2('0x11')][_0xdff2('0x12')]);return _0x1c8714(_0x5631e5['error'][_0xdff2('0x12')]);}logger[_0xdff2('0x11')](_0xdff2('0xd'),_0xe8d649,_0x5631e5[_0xdff2('0x11')]['message']);return _0x3badc5(_0x5631e5[_0xdff2('0x11')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0xe8d649,_0xdff2('0x10'));_0x3badc5(_0x5631e5['result'][_0xdff2('0x12')]);}})[_0xdff2('0x13')](function(_0x36cdd2){logger[_0xdff2('0x11')](_0xdff2('0xd'),_0xe8d649,_0x36cdd2);_0x1c8714(_0x36cdd2);});});}exports[_0xdff2('0x14')]=function(_0x3c226c){var _0x1f5da0=this;return new Promise(function(_0x548752,_0x5d0d4c){return db[_0xdff2('0x15')][_0xdff2('0x16')](_0x3c226c[_0xdff2('0x17')],{'raw':_0x3c226c['options']?_0x3c226c['options'][_0xdff2('0x18')]===undefined?!![]:![]:!![]})[_0xdff2('0xc')](function(_0xee6dc2){logger[_0xdff2('0x19')](_0xdff2('0x14'),_0x3c226c);logger['debug']('CreateOpenchannelQueueReport',_0x3c226c,JSON[_0xdff2('0x1a')](_0xee6dc2));_0x548752(_0xee6dc2);})[_0xdff2('0x13')](function(_0x44aec1){logger['error']('CreateOpenchannelQueueReport',_0x44aec1[_0xdff2('0x12')],_0x3c226c);_0x5d0d4c(_0x1f5da0[_0xdff2('0x11')](0x1f4,_0x44aec1[_0xdff2('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1e92b0){var _0x379050=this;return new Promise(function(_0x22e119,_0x6ea2b7){return db[_0xdff2('0x15')]['update'](_0x1e92b0['body'],{'raw':_0x1e92b0[_0xdff2('0x1b')]?_0x1e92b0['options'][_0xdff2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e92b0['options']?_0x1e92b0[_0xdff2('0x1b')][_0xdff2('0x1c')]||null:null,'attributes':_0x1e92b0['options']?_0x1e92b0[_0xdff2('0x1b')]['attributes']||null:null,'limit':_0x1e92b0[_0xdff2('0x1b')]?_0x1e92b0['options'][_0xdff2('0x1d')]||null:null})[_0xdff2('0xc')](function(_0x801c0){logger[_0xdff2('0x19')](_0xdff2('0x1e'),_0x1e92b0);logger[_0xdff2('0xe')](_0xdff2('0x1e'),_0x1e92b0,JSON[_0xdff2('0x1a')](_0x801c0));_0x22e119(_0x801c0);})[_0xdff2('0x13')](function(_0x3c9285){logger['error']('UpdateOpenchannelQueueReport',_0x3c9285[_0xdff2('0x12')],_0x1e92b0);_0x6ea2b7(_0x379050['error'](0x1f4,_0x3c9285[_0xdff2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 4349e41..a5d5350 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 _0x2aa8=['delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','isAuthenticated','index','get','describe','show','post','create','update'];(function(_0x5b45da,_0x52bb87){var _0x2327f7=function(_0x35c430){while(--_0x35c430){_0x5b45da['push'](_0x5b45da['shift']());}};_0x2327f7(++_0x52bb87);}(_0x2aa8,0xff));var _0x82aa=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2aa8[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x82aa('0x0'));var util=require(_0x82aa('0x1'));var path=require(_0x82aa('0x2'));var timeout=require(_0x82aa('0x3'));var express=require(_0x82aa('0x4'));var router=express[_0x82aa('0x5')]();var fs_extra=require(_0x82aa('0x6'));var auth=require(_0x82aa('0x7'));var interaction=require(_0x82aa('0x8'));var config=require('../../config/environment');var controller=require(_0x82aa('0x9'));router['get']('/',auth[_0x82aa('0xa')](),controller[_0x82aa('0xb')]);router[_0x82aa('0xc')]('/describe',auth[_0x82aa('0xa')](),controller[_0x82aa('0xd')]);router[_0x82aa('0xc')]('/:id',auth[_0x82aa('0xa')](),controller[_0x82aa('0xe')]);router[_0x82aa('0xf')]('/',auth[_0x82aa('0xa')](),controller[_0x82aa('0x10')]);router['put']('/:id',auth[_0x82aa('0xa')](),controller[_0x82aa('0x11')]);router[_0x82aa('0x12')](_0x82aa('0x13'),auth[_0x82aa('0xa')](),controller[_0x82aa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2f1f=['show','post','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe'];(function(_0xea1602,_0x370f29){var _0x1f17f0=function(_0x1db31a){while(--_0x1db31a){_0xea1602['push'](_0xea1602['shift']());}};_0x1f17f0(++_0x370f29);}(_0x2f1f,0x15f));var _0xf2f1=function(_0x26a2ec,_0x1a7004){_0x26a2ec=_0x26a2ec-0x0;var _0x40c4e2=_0x2f1f[_0x26a2ec];return _0x40c4e2;};'use strict';var multer=require('multer');var util=require(_0xf2f1('0x0'));var path=require('path');var timeout=require(_0xf2f1('0x1'));var express=require(_0xf2f1('0x2'));var router=express[_0xf2f1('0x3')]();var fs_extra=require(_0xf2f1('0x4'));var auth=require(_0xf2f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf2f1('0x6'));var controller=require('./openchannelTransferReport.controller');router[_0xf2f1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xf2f1('0x8')](),controller[_0xf2f1('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf2f1('0xa')]);router[_0xf2f1('0xb')]('/',auth[_0xf2f1('0x8')](),controller[_0xf2f1('0xc')]);router[_0xf2f1('0xd')](_0xf2f1('0xe'),auth[_0xf2f1('0x8')](),controller[_0xf2f1('0xf')]);router[_0xf2f1('0x10')](_0xf2f1('0xe'),auth[_0xf2f1('0x8')](),controller[_0xf2f1('0x11')]);module[_0xf2f1('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 29681cc..038c6cf 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 _0xc399=['STRING','account','agent','queue','DATE','NOW','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc399,0x1e9));var _0x9c39=function(_0x474486,_0x3d043e){_0x474486=_0x474486-0x0;var _0x539d0a=_0xc399[_0x474486];return _0x539d0a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9c39('0x0')]={'uniqueid':{'type':Sequelize[_0x9c39('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9c39('0x2'),_0x9c39('0x3'),_0x9c39('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x9c39('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x9c39('0x6')]}}; \ No newline at end of file +var _0xc8e8=['DATE','NOW','moment','sequelize','exports','ENUM','account','agent','queue'];(function(_0x372129,_0x539547){var _0x2385b4=function(_0x17969f){while(--_0x17969f){_0x372129['push'](_0x372129['shift']());}};_0x2385b4(++_0x539547);}(_0xc8e8,0x1a0));var _0x8c8e=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc8e8[_0x88cd7b];return _0x56fcc8;};'use strict';var moment=require(_0x8c8e('0x0'));var Sequelize=require(_0x8c8e('0x1'));module[_0x8c8e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8c8e('0x3')](_0x8c8e('0x4'),_0x8c8e('0x5'),_0x8c8e('0x6')),'allowNull':![],'defaultValue':_0x8c8e('0x6')},'transferredAt':{'type':Sequelize[_0x8c8e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8c8e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index bd84847..f4aca7a 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 _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','OpenchannelTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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['OpenchannelTransferReport'][_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','OpenchannelTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_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/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d82a44e..a038eb9 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 _0x2869=['define','report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports'];(function(_0x25a440,_0x2322a8){var _0x3ccb3f=function(_0x2268c6){while(--_0x2268c6){_0x25a440['push'](_0x25a440['shift']());}};_0x3ccb3f(++_0x2322a8);}(_0x2869,0xff));var _0x9286=function(_0x251319,_0x23bc6b){_0x251319=_0x251319-0x0;var _0xfc74e=_0x2869[_0x251319];return _0xfc74e;};'use strict';var _=require('lodash');var util=require(_0x9286('0x0'));var logger=require(_0x9286('0x1'))(_0x9286('0x2'));var moment=require(_0x9286('0x3'));var BPromise=require(_0x9286('0x4'));var rp=require(_0x9286('0x5'));var fs=require('fs');var path=require(_0x9286('0x6'));var rimraf=require(_0x9286('0x7'));var config=require(_0x9286('0x8'));var attributes=require(_0x9286('0x9'));module[_0x9286('0xa')]=function(_0xb7ecc0,_0x18c9e2){return _0xb7ecc0[_0x9286('0xb')]('OpenchannelTransferReport',attributes,{'tableName':_0x9286('0xc'),'paranoid':![],'indexes':[{'name':_0x9286('0xd'),'fields':[_0x9286('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x18f9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x3cabb7,_0x1bfd28){var _0x1db713=function(_0x42ab6c){while(--_0x42ab6c){_0x3cabb7['push'](_0x3cabb7['shift']());}};_0x1db713(++_0x1bfd28);}(_0x18f9,0x120));var _0x918f=function(_0x270a02,_0x223adb){_0x270a02=_0x270a02-0x0;var _0x3cd07b=_0x18f9[_0x270a02];return _0x3cd07b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x918f('0x0'))(_0x918f('0x1'));var moment=require(_0x918f('0x2'));var BPromise=require(_0x918f('0x3'));var rp=require(_0x918f('0x4'));var fs=require('fs');var path=require(_0x918f('0x5'));var rimraf=require(_0x918f('0x6'));var config=require(_0x918f('0x7'));var attributes=require(_0x918f('0x8'));module['exports']=function(_0x58931d,_0x25894e){return _0x58931d['define'](_0x918f('0x9'),attributes,{'tableName':_0x918f('0xa'),'paranoid':![],'indexes':[{'name':_0x918f('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 125970b..cf3a427 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 _0x97a7=['info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x1fc18b,_0x13d27d){var _0x16a351=function(_0x54a799){while(--_0x54a799){_0x1fc18b['push'](_0x1fc18b['shift']());}};_0x16a351(++_0x13d27d);}(_0x97a7,0x16a));var _0x797a=function(_0x58a4a7,_0xfdf680){_0x58a4a7=_0x58a4a7-0x0;var _0x3188fc=_0x97a7[_0x58a4a7];return _0x3188fc;};'use strict';var _=require(_0x797a('0x0'));var util=require(_0x797a('0x1'));var moment=require('moment');var BPromise=require(_0x797a('0x2'));var rs=require(_0x797a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x797a('0x4'))['db'];var utils=require(_0x797a('0x5'));var logger=require(_0x797a('0x6'))(_0x797a('0x7'));var config=require(_0x797a('0x8'));var jayson=require(_0x797a('0x9'));var client=jayson['client'][_0x797a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b62bd,_0x5c2d4c,_0x1ed192){return new BPromise(function(_0x12308a,_0x1931e9){return client[_0x797a('0xb')](_0x4b62bd,_0x1ed192)['then'](function(_0x945d24){logger[_0x797a('0xc')](_0x797a('0xd'),_0x5c2d4c,_0x797a('0xe'));logger[_0x797a('0xf')](_0x797a('0x10'),_0x5c2d4c,_0x797a('0xe'),JSON[_0x797a('0x11')](_0x945d24));if(_0x945d24[_0x797a('0x12')]){if(_0x945d24[_0x797a('0x12')][_0x797a('0x13')]===0x1f4){logger[_0x797a('0x12')](_0x797a('0xd'),_0x5c2d4c,_0x945d24[_0x797a('0x12')][_0x797a('0x14')]);return _0x1931e9(_0x945d24[_0x797a('0x12')]['message']);}logger[_0x797a('0x12')](_0x797a('0xd'),_0x5c2d4c,_0x945d24['error'][_0x797a('0x14')]);return _0x12308a(_0x945d24[_0x797a('0x12')][_0x797a('0x14')]);}else{logger[_0x797a('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5c2d4c,_0x797a('0xe'));_0x12308a(_0x945d24['result'][_0x797a('0x14')]);}})[_0x797a('0x15')](function(_0x2f5ea5){logger[_0x797a('0x12')](_0x797a('0xd'),_0x5c2d4c,_0x2f5ea5);_0x1931e9(_0x2f5ea5);});});} \ No newline at end of file +var _0x8477=['jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2b825d,_0x82056b){var _0x3ecd91=function(_0x262585){while(--_0x262585){_0x2b825d['push'](_0x2b825d['shift']());}};_0x3ecd91(++_0x82056b);}(_0x8477,0xea));var _0x7847=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0x8477[_0x4d40dd];return _0x1c51f2;};'use strict';var _=require(_0x7847('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7847('0x1'));var rs=require(_0x7847('0x2'));var fs=require('fs');var Redis=require(_0x7847('0x3'));var db=require(_0x7847('0x4'))['db'];var utils=require(_0x7847('0x5'));var logger=require(_0x7847('0x6'))('rpc');var config=require(_0x7847('0x7'));var jayson=require(_0x7847('0x8'));var client=jayson[_0x7847('0x9')][_0x7847('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5944d8,_0xaaa8f3,_0x15e8ba){return new BPromise(function(_0x39f63b,_0x2a50e3){return client[_0x7847('0xb')](_0x5944d8,_0x15e8ba)[_0x7847('0xc')](function(_0x3706cf){logger[_0x7847('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xaaa8f3,_0x7847('0xe'));logger[_0x7847('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0xaaa8f3,_0x7847('0xe'),JSON['stringify'](_0x3706cf));if(_0x3706cf['error']){if(_0x3706cf[_0x7847('0x10')][_0x7847('0x11')]===0x1f4){logger[_0x7847('0x10')](_0x7847('0x12'),_0xaaa8f3,_0x3706cf['error'][_0x7847('0x13')]);return _0x2a50e3(_0x3706cf[_0x7847('0x10')][_0x7847('0x13')]);}logger[_0x7847('0x10')](_0x7847('0x12'),_0xaaa8f3,_0x3706cf[_0x7847('0x10')][_0x7847('0x13')]);return _0x39f63b(_0x3706cf[_0x7847('0x10')][_0x7847('0x13')]);}else{logger[_0x7847('0xd')](_0x7847('0x12'),_0xaaa8f3,_0x7847('0xe'));_0x39f63b(_0x3706cf[_0x7847('0x14')][_0x7847('0x13')]);}})[_0x7847('0x15')](function(_0x1b7ee5){logger[_0x7847('0x10')](_0x7847('0x12'),_0xaaa8f3,_0x1b7ee5);_0x2a50e3(_0x1b7ee5);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 721548c..f7af56c 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 _0xdb8e=['express','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','create','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0xecbb53,_0x366eb5){var _0xe4356=function(_0x3576af){while(--_0x3576af){_0xecbb53['push'](_0xecbb53['shift']());}};_0xe4356(++_0x366eb5);}(_0xdb8e,0xb9));var _0xedb8=function(_0x5cabac,_0x5ccb08){_0x5cabac=_0x5cabac-0x0;var _0x5f47b8=_0xdb8e[_0x5cabac];return _0x5f47b8;};'use strict';var multer=require('multer');var util=require(_0xedb8('0x0'));var path=require('path');var timeout=require(_0xedb8('0x1'));var express=require(_0xedb8('0x2'));var router=express['Router']();var fs_extra=require(_0xedb8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xedb8('0x4'));var config=require(_0xedb8('0x5'));var controller=require(_0xedb8('0x6'));router['get']('/',auth[_0xedb8('0x7')](),controller[_0xedb8('0x8')]);router[_0xedb8('0x9')](_0xedb8('0xa'),auth[_0xedb8('0x7')](),controller['show']);router['post']('/',auth[_0xedb8('0x7')](),controller[_0xedb8('0xb')]);router[_0xedb8('0xc')](_0xedb8('0xa'),auth[_0xedb8('0x7')](),controller[_0xedb8('0xd')]);router[_0xedb8('0xe')](_0xedb8('0xa'),auth[_0xedb8('0x7')](),controller[_0xedb8('0xf')]);module[_0xedb8('0x10')]=router; \ No newline at end of file +var _0x1152=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x1152,0x177));var _0x2115=function(_0x36176e,_0x3719b7){_0x36176e=_0x36176e-0x0;var _0xbe79bc=_0x1152[_0x36176e];return _0xbe79bc;};'use strict';var multer=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var path=require(_0x2115('0x2'));var timeout=require(_0x2115('0x3'));var express=require(_0x2115('0x4'));var router=express['Router']();var fs_extra=require(_0x2115('0x5'));var auth=require(_0x2115('0x6'));var interaction=require(_0x2115('0x7'));var config=require(_0x2115('0x8'));var controller=require(_0x2115('0x9'));router[_0x2115('0xa')]('/',auth['isAuthenticated'](),controller[_0x2115('0xb')]);router[_0x2115('0xa')](_0x2115('0xc'),auth[_0x2115('0xd')](),controller[_0x2115('0xe')]);router[_0x2115('0xf')]('/',auth[_0x2115('0xd')](),controller[_0x2115('0x10')]);router[_0x2115('0x11')]('/:id',auth[_0x2115('0xd')](),controller[_0x2115('0x12')]);router[_0x2115('0x13')](_0x2115('0xc'),auth[_0x2115('0xd')](),controller[_0x2115('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 7110a31..2479689 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 _0xa42d=['name','sequelize','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa42d,0x1d5));var _0xda42=function(_0x5d1e84,_0x1349b5){_0x5d1e84=_0x5d1e84-0x0;var _0x3f77b1=_0xa42d[_0x5d1e84];return _0x3f77b1;};'use strict';var Sequelize=require(_0xda42('0x0'));module['exports']={'name':{'type':Sequelize[_0xda42('0x1')],'unique':_0xda42('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xda42('0x1')]}}; \ No newline at end of file +var _0x8351=['sequelize','exports','STRING','name'];(function(_0x1d81d4,_0x4542dc){var _0x1de8d9=function(_0x19c11c){while(--_0x19c11c){_0x1d81d4['push'](_0x1d81d4['shift']());}};_0x1de8d9(++_0x4542dc);}(_0x8351,0x12c));var _0x1835=function(_0x17e6cc,_0x515b67){_0x17e6cc=_0x17e6cc-0x0;var _0x1cf11b=_0x8351[_0x17e6cc];return _0x1cf11b;};'use strict';var Sequelize=require(_0x1835('0x0'));module[_0x1835('0x1')]={'name':{'type':Sequelize[_0x1835('0x2')],'unique':_0x1835('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1835('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index a552791..6751c12 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 _0xb95b=['sendStatus','stack','name','send','map','Pause','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','rawAttributes','includeAll','create','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','fast-json-patch','request-promise','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','status','json','offset','limit','count','set','apply','then','destroy','get','end'];(function(_0x21f220,_0x1c04c8){var _0x6ee233=function(_0x4b2f7b){while(--_0x4b2f7b){_0x21f220['push'](_0x21f220['shift']());}};_0x6ee233(++_0x1c04c8);}(_0xb95b,0xc5));var _0xbb95=function(_0x2b4675,_0x516de1){_0x2b4675=_0x2b4675-0x0;var _0x3932c9=_0xb95b[_0x2b4675];return _0x3932c9;};'use strict';var emlformat=require(_0xbb95('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbb95('0x1'));var rp=require(_0xbb95('0x2'));var moment=require(_0xbb95('0x3'));var BPromise=require(_0xbb95('0x4'));var Mustache=require('mustache');var util=require(_0xbb95('0x5'));var path=require(_0xbb95('0x6'));var sox=require(_0xbb95('0x7'));var csv=require(_0xbb95('0x8'));var ejs=require(_0xbb95('0x9'));var fs=require('fs');var fs_extra=require(_0xbb95('0xa'));var _=require(_0xbb95('0xb'));var squel=require(_0xbb95('0xc'));var crypto=require('crypto');var jsforce=require(_0xbb95('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbb95('0x8'));var querystring=require('querystring');var Papa=require(_0xbb95('0xe'));var Redis=require(_0xbb95('0xf'));var authService=require(_0xbb95('0x10'));var qs=require(_0xbb95('0x11'));var as=require(_0xbb95('0x12'));var hardwareService=require(_0xbb95('0x13'));var logger=require(_0xbb95('0x14'))(_0xbb95('0x15'));var utils=require(_0xbb95('0x16'));var config=require(_0xbb95('0x17'));var licenseUtil=require(_0xbb95('0x18'));var db=require(_0xbb95('0x19'))['db'];function respondWithStatusCode(_0x3f6aa3,_0x51c7e4){_0x51c7e4=_0x51c7e4||0xcc;return function(_0x2dd642){if(_0x2dd642){return _0x3f6aa3['sendStatus'](_0x51c7e4);}return _0x3f6aa3[_0xbb95('0x1a')](_0x51c7e4)['end']();};}function respondWithResult(_0x20dff4,_0x2311c7){_0x2311c7=_0x2311c7||0xc8;return function(_0x3727e3){if(_0x3727e3){return _0x20dff4[_0xbb95('0x1a')](_0x2311c7)[_0xbb95('0x1b')](_0x3727e3);}};}function respondWithFilteredResult(_0x209305,_0x23cb4c){return function(_0x33e30d){if(_0x33e30d){var _0x1a3e00=typeof _0x23cb4c[_0xbb95('0x1c')]==='undefined'&&typeof _0x23cb4c[_0xbb95('0x1d')]==='undefined';var _0x1d8339=_0x33e30d['count'];var _0x1e2087=_0x1a3e00?0x0:_0x23cb4c[_0xbb95('0x1c')];var _0x1dcc59=_0x1a3e00?_0x33e30d[_0xbb95('0x1e')]:_0x23cb4c[_0xbb95('0x1c')]+_0x23cb4c[_0xbb95('0x1d')];var _0x37e6ca;if(_0x1dcc59>=_0x1d8339){_0x1dcc59=_0x1d8339;_0x37e6ca=0xc8;}else{_0x37e6ca=0xce;}_0x209305[_0xbb95('0x1a')](_0x37e6ca);return _0x209305[_0xbb95('0x1f')]('Content-Range',_0x1e2087+'-'+_0x1dcc59+'/'+_0x1d8339)[_0xbb95('0x1b')](_0x33e30d);}return null;};}function patchUpdates(_0x3e724d){return function(_0x52f75f){try{jsonpatch[_0xbb95('0x20')](_0x52f75f,_0x3e724d,!![]);}catch(_0x151308){return BPromise['reject'](_0x151308);}return _0x52f75f['save']();};}function saveUpdates(_0x40ff85,_0x4ae17d){return function(_0x58775b){if(_0x58775b){return _0x58775b['update'](_0x40ff85)[_0xbb95('0x21')](function(_0x2b6200){return _0x2b6200;});}return null;};}function removeEntity(_0xdc0107,_0x5376ac){return function(_0x475bd7){if(_0x475bd7){return _0x475bd7[_0xbb95('0x22')]()['then'](function(){var _0x2ad70e=_0x475bd7[_0xbb95('0x23')]({'plain':!![]});var _0x3694c4='Pauses';return db['UserProfileResource'][_0xbb95('0x22')]({'where':{'type':_0x3694c4,'resourceId':_0x2ad70e['id']}})[_0xbb95('0x21')](function(){return _0x475bd7;});})['then'](function(){_0xdc0107[_0xbb95('0x1a')](0xcc)[_0xbb95('0x24')]();});}};}function handleEntityNotFound(_0x4db150,_0xa5cb08){return function(_0x2c62dc){if(!_0x2c62dc){_0x4db150[_0xbb95('0x25')](0x194);}return _0x2c62dc;};}function handleError(_0x21a8c7,_0x2c8e54){_0x2c8e54=_0x2c8e54||0x1f4;return function(_0x2e91fc){logger['error'](_0x2e91fc[_0xbb95('0x26')]);if(_0x2e91fc[_0xbb95('0x27')]){delete _0x2e91fc[_0xbb95('0x27')];}_0x21a8c7['status'](_0x2c8e54)[_0xbb95('0x28')](_0x2e91fc);};}exports['index']=function(_0x5822c6,_0x5a8886){var _0x3e7dba={},_0x5d40bd={},_0x396660={'count':0x0,'rows':[]};var _0x95f668=_[_0xbb95('0x29')](db[_0xbb95('0x2a')]['rawAttributes'],function(_0xae84d3){return{'name':_0xae84d3[_0xbb95('0x2b')],'type':_0xae84d3['type'][_0xbb95('0x2c')]};});_0x5d40bd[_0xbb95('0x2d')]=_[_0xbb95('0x29')](_0x95f668,'name');_0x5d40bd[_0xbb95('0x2e')]=_[_0xbb95('0x2f')](_0x5822c6[_0xbb95('0x2e')]);_0x5d40bd[_0xbb95('0x30')]=_[_0xbb95('0x31')](_0x5d40bd[_0xbb95('0x2d')],_0x5d40bd[_0xbb95('0x2e')]);_0x3e7dba[_0xbb95('0x32')]=_[_0xbb95('0x31')](_0x5d40bd[_0xbb95('0x2d')],qs['fields'](_0x5822c6[_0xbb95('0x2e')][_0xbb95('0x33')]));_0x3e7dba[_0xbb95('0x32')]=_0x3e7dba[_0xbb95('0x32')][_0xbb95('0x34')]?_0x3e7dba['attributes']:_0x5d40bd[_0xbb95('0x2d')];if(!_0x5822c6[_0xbb95('0x2e')][_0xbb95('0x35')]('nolimit')){_0x3e7dba[_0xbb95('0x1d')]=qs[_0xbb95('0x1d')](_0x5822c6['query'][_0xbb95('0x1d')]);_0x3e7dba[_0xbb95('0x1c')]=qs[_0xbb95('0x1c')](_0x5822c6['query'][_0xbb95('0x1c')]);}_0x3e7dba['order']=qs['sort'](_0x5822c6[_0xbb95('0x2e')][_0xbb95('0x36')]);_0x3e7dba[_0xbb95('0x37')]=qs[_0xbb95('0x30')](_[_0xbb95('0x38')](_0x5822c6['query'],_0x5d40bd[_0xbb95('0x30')]),_0x95f668);if(_0x5822c6[_0xbb95('0x2e')]['filter']){_0x3e7dba[_0xbb95('0x37')]=_['merge'](_0x3e7dba[_0xbb95('0x37')],{'$or':_[_0xbb95('0x29')](_0x95f668,function(_0x1df13f){if(_0x1df13f['type']!=='VIRTUAL'){var _0x13457e={};_0x13457e[_0x1df13f['name']]={'$like':'%'+_0x5822c6[_0xbb95('0x2e')][_0xbb95('0x39')]+'%'};return _0x13457e;}})});}_0x3e7dba=_[_0xbb95('0x3a')]({},_0x3e7dba,_0x5822c6[_0xbb95('0x3b')]);var _0x53c6fd={'where':_0x3e7dba[_0xbb95('0x37')]};return db[_0xbb95('0x2a')][_0xbb95('0x1e')](_0x53c6fd)['then'](function(_0x5c305f){_0x396660[_0xbb95('0x1e')]=_0x5c305f;if(_0x5822c6[_0xbb95('0x2e')]['includeAll']){_0x3e7dba[_0xbb95('0x3c')]=[{'all':!![]}];}return db['Pause'][_0xbb95('0x3d')](_0x3e7dba);})[_0xbb95('0x21')](function(_0xab94c6){_0x396660[_0xbb95('0x3e')]=_0xab94c6;return _0x396660;})[_0xbb95('0x21')](respondWithFilteredResult(_0x5a8886,_0x3e7dba))[_0xbb95('0x3f')](handleError(_0x5a8886,null));};exports['show']=function(_0x9f5c56,_0x2a7cae){var _0x180209={'raw':!![],'where':{'id':_0x9f5c56[_0xbb95('0x40')]['id']}},_0x2d9195={};_0x2d9195[_0xbb95('0x2d')]=_[_0xbb95('0x2f')](db[_0xbb95('0x2a')][_0xbb95('0x41')]);_0x2d9195[_0xbb95('0x2e')]=_[_0xbb95('0x2f')](_0x9f5c56[_0xbb95('0x2e')]);_0x2d9195[_0xbb95('0x30')]=_['intersection'](_0x2d9195[_0xbb95('0x2d')],_0x2d9195['query']);_0x180209[_0xbb95('0x32')]=_['intersection'](_0x2d9195[_0xbb95('0x2d')],qs[_0xbb95('0x33')](_0x9f5c56['query'][_0xbb95('0x33')]));_0x180209[_0xbb95('0x32')]=_0x180209[_0xbb95('0x32')][_0xbb95('0x34')]?_0x180209[_0xbb95('0x32')]:_0x2d9195['model'];if(_0x9f5c56[_0xbb95('0x2e')][_0xbb95('0x42')]){_0x180209[_0xbb95('0x3c')]=[{'all':!![]}];}_0x180209=_['merge']({},_0x180209,_0x9f5c56[_0xbb95('0x3b')]);return db['Pause']['find'](_0x180209)[_0xbb95('0x21')](handleEntityNotFound(_0x2a7cae,null))['then'](respondWithResult(_0x2a7cae,null))[_0xbb95('0x3f')](handleError(_0x2a7cae,null));};exports['create']=function(_0x5d5d61,_0x20dd16){return db[_0xbb95('0x2a')][_0xbb95('0x43')](_0x5d5d61['body'],{})['then'](function(_0x1e8e1a){var _0x5447e7=_0x5d5d61[_0xbb95('0x44')]['get']({'plain':!![]});if(!_0x5447e7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5447e7['role']===_0xbb95('0x44')){var _0x4494db=_0x1e8e1a[_0xbb95('0x23')]({'plain':!![]});var _0x5e30fd='Pauses';return db[_0xbb95('0x45')][_0xbb95('0x46')]({'where':{'name':_0x5e30fd,'userProfileId':_0x5447e7[_0xbb95('0x47')]},'raw':!![]})['then'](function(_0x2a219d){if(_0x2a219d&&_0x2a219d[_0xbb95('0x48')]===0x0){return db[_0xbb95('0x49')][_0xbb95('0x43')]({'name':_0x4494db['name'],'resourceId':_0x4494db['id'],'type':_0x2a219d[_0xbb95('0x27')],'sectionId':_0x2a219d['id']},{})[_0xbb95('0x21')](function(){return _0x1e8e1a;});}else{return _0x1e8e1a;}})['catch'](function(_0x1bf082){logger[_0xbb95('0x4a')](_0xbb95('0x4b'),_0x1bf082);throw _0x1bf082;});}return _0x1e8e1a;})['then'](respondWithResult(_0x20dd16,0xc9))[_0xbb95('0x3f')](handleError(_0x20dd16,null));};exports[_0xbb95('0x4c')]=function(_0x26cdc6,_0x1ec9b8){if(_0x26cdc6['body']['id']){delete _0x26cdc6['body']['id'];}return db['Pause']['find']({'where':{'id':_0x26cdc6[_0xbb95('0x40')]['id']}})[_0xbb95('0x21')](handleEntityNotFound(_0x1ec9b8,null))[_0xbb95('0x21')](saveUpdates(_0x26cdc6[_0xbb95('0x4d')],null))[_0xbb95('0x21')](respondWithResult(_0x1ec9b8,null))[_0xbb95('0x3f')](handleError(_0x1ec9b8,null));};exports['destroy']=function(_0x197fe4,_0x1d3d03){return db[_0xbb95('0x2a')][_0xbb95('0x46')]({'where':{'id':_0x197fe4[_0xbb95('0x40')]['id']}})[_0xbb95('0x21')](handleEntityNotFound(_0x1d3d03,null))[_0xbb95('0x21')](removeEntity(_0x1d3d03,null))[_0xbb95('0x3f')](handleError(_0x1d3d03,null));}; \ No newline at end of file +var _0xa334=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','Pause','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','zip-dir','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','limit','set','json','apply','save','update','then','get','Pauses','UserProfileResource','error','stack','name','send','map','fieldName','type','model'];(function(_0x51491a,_0x8858df){var _0x3f2b9d=function(_0x1239d3){while(--_0x1239d3){_0x51491a['push'](_0x51491a['shift']());}};_0x3f2b9d(++_0x8858df);}(_0xa334,0x1c4));var _0x4a33=function(_0x957079,_0x457ffe){_0x957079=_0x957079-0x0;var _0x9351f9=_0xa334[_0x957079];return _0x9351f9;};'use strict';var emlformat=require(_0x4a33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a33('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4a33('0x2'));var BPromise=require(_0x4a33('0x3'));var Mustache=require(_0x4a33('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4a33('0x5'));var csv=require('to-csv');var ejs=require(_0x4a33('0x6'));var fs=require('fs');var fs_extra=require(_0x4a33('0x7'));var _=require(_0x4a33('0x8'));var squel=require(_0x4a33('0x9'));var crypto=require(_0x4a33('0xa'));var jsforce=require(_0x4a33('0xb'));var deskjs=require(_0x4a33('0xc'));var toCsv=require(_0x4a33('0xd'));var querystring=require(_0x4a33('0xe'));var Papa=require(_0x4a33('0xf'));var Redis=require(_0x4a33('0x10'));var authService=require(_0x4a33('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a33('0x12'));var logger=require('../../config/logger')(_0x4a33('0x13'));var utils=require(_0x4a33('0x14'));var config=require(_0x4a33('0x15'));var licenseUtil=require(_0x4a33('0x16'));var db=require(_0x4a33('0x17'))['db'];function respondWithStatusCode(_0x225fcb,_0x59c1b2){_0x59c1b2=_0x59c1b2||0xcc;return function(_0x59b1a9){if(_0x59b1a9){return _0x225fcb[_0x4a33('0x18')](_0x59c1b2);}return _0x225fcb[_0x4a33('0x19')](_0x59c1b2)['end']();};}function respondWithResult(_0x2ed2ad,_0x21f7a6){_0x21f7a6=_0x21f7a6||0xc8;return function(_0x486350){if(_0x486350){return _0x2ed2ad[_0x4a33('0x19')](_0x21f7a6)['json'](_0x486350);}};}function respondWithFilteredResult(_0x29cc38,_0x5024c9){return function(_0x3b510a){if(_0x3b510a){var _0x1aecaa=typeof _0x5024c9['offset']==='undefined'&&typeof _0x5024c9['limit']===_0x4a33('0x1a');var _0x1f3f46=_0x3b510a[_0x4a33('0x1b')];var _0x48cbfa=_0x1aecaa?0x0:_0x5024c9['offset'];var _0x392468=_0x1aecaa?_0x3b510a[_0x4a33('0x1b')]:_0x5024c9['offset']+_0x5024c9[_0x4a33('0x1c')];var _0x4c1af3;if(_0x392468>=_0x1f3f46){_0x392468=_0x1f3f46;_0x4c1af3=0xc8;}else{_0x4c1af3=0xce;}_0x29cc38[_0x4a33('0x19')](_0x4c1af3);return _0x29cc38[_0x4a33('0x1d')]('Content-Range',_0x48cbfa+'-'+_0x392468+'/'+_0x1f3f46)[_0x4a33('0x1e')](_0x3b510a);}return null;};}function patchUpdates(_0x431b84){return function(_0x32ffb8){try{jsonpatch[_0x4a33('0x1f')](_0x32ffb8,_0x431b84,!![]);}catch(_0x44e130){return BPromise['reject'](_0x44e130);}return _0x32ffb8[_0x4a33('0x20')]();};}function saveUpdates(_0x347dac,_0x316f7e){return function(_0x5ab468){if(_0x5ab468){return _0x5ab468[_0x4a33('0x21')](_0x347dac)[_0x4a33('0x22')](function(_0xbc8627){return _0xbc8627;});}return null;};}function removeEntity(_0x3ae08b,_0x126d95){return function(_0x132c51){if(_0x132c51){return _0x132c51['destroy']()[_0x4a33('0x22')](function(){var _0x493018=_0x132c51[_0x4a33('0x23')]({'plain':!![]});var _0x324233=_0x4a33('0x24');return db[_0x4a33('0x25')]['destroy']({'where':{'type':_0x324233,'resourceId':_0x493018['id']}})[_0x4a33('0x22')](function(){return _0x132c51;});})['then'](function(){_0x3ae08b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x345c55,_0x1f6984){return function(_0x24a047){if(!_0x24a047){_0x345c55['sendStatus'](0x194);}return _0x24a047;};}function handleError(_0x128ea2,_0x152d0c){_0x152d0c=_0x152d0c||0x1f4;return function(_0x4086bc){logger[_0x4a33('0x26')](_0x4086bc[_0x4a33('0x27')]);if(_0x4086bc[_0x4a33('0x28')]){delete _0x4086bc['name'];}_0x128ea2[_0x4a33('0x19')](_0x152d0c)[_0x4a33('0x29')](_0x4086bc);};}exports['index']=function(_0x36f15f,_0x2807ac){var _0x4833c1={},_0x29bd31={},_0x5777d7={'count':0x0,'rows':[]};var _0x1c3905=_[_0x4a33('0x2a')](db['Pause']['rawAttributes'],function(_0x215750){return{'name':_0x215750[_0x4a33('0x2b')],'type':_0x215750[_0x4a33('0x2c')]['key']};});_0x29bd31[_0x4a33('0x2d')]=_[_0x4a33('0x2a')](_0x1c3905,_0x4a33('0x28'));_0x29bd31[_0x4a33('0x2e')]=_[_0x4a33('0x2f')](_0x36f15f[_0x4a33('0x2e')]);_0x29bd31[_0x4a33('0x30')]=_['intersection'](_0x29bd31['model'],_0x29bd31[_0x4a33('0x2e')]);_0x4833c1['attributes']=_[_0x4a33('0x31')](_0x29bd31['model'],qs[_0x4a33('0x32')](_0x36f15f[_0x4a33('0x2e')]['fields']));_0x4833c1[_0x4a33('0x33')]=_0x4833c1[_0x4a33('0x33')][_0x4a33('0x34')]?_0x4833c1[_0x4a33('0x33')]:_0x29bd31[_0x4a33('0x2d')];if(!_0x36f15f[_0x4a33('0x2e')][_0x4a33('0x35')](_0x4a33('0x36'))){_0x4833c1[_0x4a33('0x1c')]=qs[_0x4a33('0x1c')](_0x36f15f[_0x4a33('0x2e')][_0x4a33('0x1c')]);_0x4833c1[_0x4a33('0x37')]=qs[_0x4a33('0x37')](_0x36f15f[_0x4a33('0x2e')][_0x4a33('0x37')]);}_0x4833c1[_0x4a33('0x38')]=qs['sort'](_0x36f15f[_0x4a33('0x2e')][_0x4a33('0x39')]);_0x4833c1[_0x4a33('0x3a')]=qs[_0x4a33('0x30')](_[_0x4a33('0x3b')](_0x36f15f[_0x4a33('0x2e')],_0x29bd31[_0x4a33('0x30')]),_0x1c3905);if(_0x36f15f[_0x4a33('0x2e')][_0x4a33('0x3c')]){_0x4833c1[_0x4a33('0x3a')]=_[_0x4a33('0x3d')](_0x4833c1[_0x4a33('0x3a')],{'$or':_['map'](_0x1c3905,function(_0x1d90bf){if(_0x1d90bf[_0x4a33('0x2c')]!==_0x4a33('0x3e')){var _0x501775={};_0x501775[_0x1d90bf[_0x4a33('0x28')]]={'$like':'%'+_0x36f15f['query']['filter']+'%'};return _0x501775;}})});}_0x4833c1=_['merge']({},_0x4833c1,_0x36f15f['options']);var _0x2e8b14={'where':_0x4833c1['where']};return db[_0x4a33('0x3f')]['count'](_0x2e8b14)[_0x4a33('0x22')](function(_0x3dd378){_0x5777d7[_0x4a33('0x1b')]=_0x3dd378;if(_0x36f15f[_0x4a33('0x2e')][_0x4a33('0x40')]){_0x4833c1[_0x4a33('0x41')]=[{'all':!![]}];}return db['Pause'][_0x4a33('0x42')](_0x4833c1);})[_0x4a33('0x22')](function(_0x23b89c){_0x5777d7[_0x4a33('0x43')]=_0x23b89c;return _0x5777d7;})[_0x4a33('0x22')](respondWithFilteredResult(_0x2807ac,_0x4833c1))[_0x4a33('0x44')](handleError(_0x2807ac,null));};exports[_0x4a33('0x45')]=function(_0xe003f6,_0x2e6321){var _0x3030a6={'raw':!![],'where':{'id':_0xe003f6[_0x4a33('0x46')]['id']}},_0x49e96a={};_0x49e96a[_0x4a33('0x2d')]=_['keys'](db['Pause'][_0x4a33('0x47')]);_0x49e96a[_0x4a33('0x2e')]=_['keys'](_0xe003f6[_0x4a33('0x2e')]);_0x49e96a[_0x4a33('0x30')]=_['intersection'](_0x49e96a[_0x4a33('0x2d')],_0x49e96a[_0x4a33('0x2e')]);_0x3030a6[_0x4a33('0x33')]=_[_0x4a33('0x31')](_0x49e96a[_0x4a33('0x2d')],qs['fields'](_0xe003f6[_0x4a33('0x2e')][_0x4a33('0x32')]));_0x3030a6['attributes']=_0x3030a6['attributes'][_0x4a33('0x34')]?_0x3030a6[_0x4a33('0x33')]:_0x49e96a['model'];if(_0xe003f6[_0x4a33('0x2e')]['includeAll']){_0x3030a6[_0x4a33('0x41')]=[{'all':!![]}];}_0x3030a6=_[_0x4a33('0x3d')]({},_0x3030a6,_0xe003f6[_0x4a33('0x48')]);return db[_0x4a33('0x3f')][_0x4a33('0x49')](_0x3030a6)[_0x4a33('0x22')](handleEntityNotFound(_0x2e6321,null))[_0x4a33('0x22')](respondWithResult(_0x2e6321,null))['catch'](handleError(_0x2e6321,null));};exports[_0x4a33('0x4a')]=function(_0x46a0e6,_0xaa6468){return db[_0x4a33('0x3f')]['create'](_0x46a0e6[_0x4a33('0x4b')],{})[_0x4a33('0x22')](function(_0x38bcad){var _0xe06f38=_0x46a0e6['user']['get']({'plain':!![]});if(!_0xe06f38)throw new Error(_0x4a33('0x4c'));if(_0xe06f38[_0x4a33('0x4d')]===_0x4a33('0x4e')){var _0x508bf9=_0x38bcad['get']({'plain':!![]});var _0x488489=_0x4a33('0x24');return db[_0x4a33('0x4f')][_0x4a33('0x49')]({'where':{'name':_0x488489,'userProfileId':_0xe06f38[_0x4a33('0x50')]},'raw':!![]})[_0x4a33('0x22')](function(_0x430d12){if(_0x430d12&&_0x430d12['autoAssociation']===0x0){return db[_0x4a33('0x25')][_0x4a33('0x4a')]({'name':_0x508bf9[_0x4a33('0x28')],'resourceId':_0x508bf9['id'],'type':_0x430d12[_0x4a33('0x28')],'sectionId':_0x430d12['id']},{})[_0x4a33('0x22')](function(){return _0x38bcad;});}else{return _0x38bcad;}})[_0x4a33('0x44')](function(_0x488fdd){logger[_0x4a33('0x26')](_0x4a33('0x51'),_0x488fdd);throw _0x488fdd;});}return _0x38bcad;})[_0x4a33('0x22')](respondWithResult(_0xaa6468,0xc9))[_0x4a33('0x44')](handleError(_0xaa6468,null));};exports['update']=function(_0x5cc435,_0x2399bc){if(_0x5cc435[_0x4a33('0x4b')]['id']){delete _0x5cc435[_0x4a33('0x4b')]['id'];}return db[_0x4a33('0x3f')][_0x4a33('0x49')]({'where':{'id':_0x5cc435['params']['id']}})[_0x4a33('0x22')](handleEntityNotFound(_0x2399bc,null))[_0x4a33('0x22')](saveUpdates(_0x5cc435[_0x4a33('0x4b')],null))['then'](respondWithResult(_0x2399bc,null))[_0x4a33('0x44')](handleError(_0x2399bc,null));};exports[_0x4a33('0x52')]=function(_0x11e3d5,_0x134f27){return db[_0x4a33('0x3f')][_0x4a33('0x49')]({'where':{'id':_0x11e3d5[_0x4a33('0x46')]['id']}})[_0x4a33('0x22')](handleEntityNotFound(_0x134f27,null))[_0x4a33('0x22')](removeEntity(_0x134f27,null))['catch'](handleError(_0x134f27,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2d147d1..5bc06e9 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 _0x04d5=['moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','lodash','util','api'];(function(_0x150ad9,_0x5d74bd){var _0x28960b=function(_0x4c5009){while(--_0x4c5009){_0x150ad9['push'](_0x150ad9['shift']());}};_0x28960b(++_0x5d74bd);}(_0x04d5,0xe1));var _0x504d=function(_0x2f91ea,_0x9caf2c){_0x2f91ea=_0x2f91ea-0x0;var _0x3d27ed=_0x04d5[_0x2f91ea];return _0x3d27ed;};'use strict';var _=require(_0x504d('0x0'));var util=require(_0x504d('0x1'));var logger=require('../../config/logger')(_0x504d('0x2'));var moment=require(_0x504d('0x3'));var BPromise=require(_0x504d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x504d('0x5'));var rimraf=require(_0x504d('0x6'));var config=require(_0x504d('0x7'));var attributes=require(_0x504d('0x8'));module[_0x504d('0x9')]=function(_0x535671,_0x289d44){return _0x535671[_0x504d('0xa')](_0x504d('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3423=['Pause','tools_pauses','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define'];(function(_0x3d8243,_0x431106){var _0x140fb4=function(_0x1bde1f){while(--_0x1bde1f){_0x3d8243['push'](_0x3d8243['shift']());}};_0x140fb4(++_0x431106);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3342('0x0'))(_0x3342('0x1'));var moment=require(_0x3342('0x2'));var BPromise=require(_0x3342('0x3'));var rp=require(_0x3342('0x4'));var fs=require('fs');var path=require(_0x3342('0x5'));var rimraf=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var attributes=require(_0x3342('0x8'));module[_0x3342('0x9')]=function(_0x467453,_0x2ccbe0){return _0x467453[_0x3342('0xa')](_0x3342('0xb'),attributes,{'tableName':_0x3342('0xc'),'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 eccc3b8..1a0dea2 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 _0xd64b=['jayson/promise','client','request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','Pause','find','options','raw','include','attributes','map','model','ShowPause','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0xd64b,0x140));var _0xbd64=function(_0x45a91c,_0x56541f){_0x45a91c=_0x45a91c-0x0;var _0x587932=_0xd64b[_0x45a91c];return _0x587932;};'use strict';var _=require(_0xbd64('0x0'));var util=require(_0xbd64('0x1'));var moment=require('moment');var BPromise=require(_0xbd64('0x2'));var rs=require(_0xbd64('0x3'));var fs=require('fs');var Redis=require(_0xbd64('0x4'));var db=require(_0xbd64('0x5'))['db'];var utils=require(_0xbd64('0x6'));var logger=require(_0xbd64('0x7'))(_0xbd64('0x8'));var config=require(_0xbd64('0x9'));var jayson=require(_0xbd64('0xa'));var client=jayson[_0xbd64('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44c21e,_0x3cb854,_0x15a48f){return new BPromise(function(_0x54c68d,_0x1297bf){return client[_0xbd64('0xc')](_0x44c21e,_0x15a48f)[_0xbd64('0xd')](function(_0x3dffff){logger[_0xbd64('0xe')](_0xbd64('0xf'),_0x3cb854,'request\x20sent');logger[_0xbd64('0x10')](_0xbd64('0x11'),_0x3cb854,_0xbd64('0x12'),JSON[_0xbd64('0x13')](_0x3dffff));if(_0x3dffff['error']){if(_0x3dffff[_0xbd64('0x14')]['code']===0x1f4){logger[_0xbd64('0x14')]('Pause,\x20%s,\x20%s',_0x3cb854,_0x3dffff[_0xbd64('0x14')][_0xbd64('0x15')]);return _0x1297bf(_0x3dffff[_0xbd64('0x14')][_0xbd64('0x15')]);}logger[_0xbd64('0x14')](_0xbd64('0xf'),_0x3cb854,_0x3dffff[_0xbd64('0x14')][_0xbd64('0x15')]);return _0x54c68d(_0x3dffff[_0xbd64('0x14')]['message']);}else{logger[_0xbd64('0xe')](_0xbd64('0xf'),_0x3cb854,_0xbd64('0x12'));_0x54c68d(_0x3dffff[_0xbd64('0x16')][_0xbd64('0x15')]);}})['catch'](function(_0x445c26){logger[_0xbd64('0x14')](_0xbd64('0xf'),_0x3cb854,_0x445c26);_0x1297bf(_0x445c26);});});}exports['ShowPause']=function(_0x1bdafe){var _0x532bac=this;return new Promise(function(_0x30d3b6,_0x28aca2){return db[_0xbd64('0x17')][_0xbd64('0x18')]({'raw':_0x1bdafe['options']?_0x1bdafe[_0xbd64('0x19')][_0xbd64('0x1a')]===undefined?!![]:![]:!![],'where':_0x1bdafe[_0xbd64('0x19')]?_0x1bdafe[_0xbd64('0x19')]['where']||null:null,'attributes':_0x1bdafe[_0xbd64('0x19')]?_0x1bdafe[_0xbd64('0x19')]['attributes']||null:null,'include':_0x1bdafe[_0xbd64('0x19')]?_0x1bdafe[_0xbd64('0x19')]['include']?_['map'](_0x1bdafe[_0xbd64('0x19')][_0xbd64('0x1b')],function(_0x3bebb1){return{'model':db[_0x3bebb1['model']],'as':_0x3bebb1['as'],'attributes':_0x3bebb1[_0xbd64('0x1c')],'include':_0x3bebb1[_0xbd64('0x1b')]?_[_0xbd64('0x1d')](_0x3bebb1[_0xbd64('0x1b')],function(_0x405b36){return{'model':db[_0x405b36['model']],'as':_0x405b36['as'],'attributes':_0x405b36[_0xbd64('0x1c')],'include':_0x405b36['include']?_[_0xbd64('0x1d')](_0x405b36[_0xbd64('0x1b')],function(_0xca92d6){return{'model':db[_0xca92d6[_0xbd64('0x1e')]],'as':_0xca92d6['as'],'attributes':_0xca92d6[_0xbd64('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbd64('0xd')](function(_0x3e8d30){logger[_0xbd64('0xe')](_0xbd64('0x1f'),_0x1bdafe);logger[_0xbd64('0x10')](_0xbd64('0x1f'),_0x1bdafe,JSON['stringify'](_0x3e8d30));_0x30d3b6(_0x3e8d30);})[_0xbd64('0x20')](function(_0x3835af){logger['error'](_0xbd64('0x1f'),_0x3835af['message'],_0x1bdafe);_0x28aca2(_0x532bac[_0xbd64('0x14')](0x1f4,_0x3835af[_0xbd64('0x15')]));});});}; \ No newline at end of file +var _0xb009=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowPause','find','options','raw','include','map','model','attributes'];(function(_0x1af05b,_0x5134b5){var _0x5be7cc=function(_0x2d4ac0){while(--_0x2d4ac0){_0x1af05b['push'](_0x1af05b['shift']());}};_0x5be7cc(++_0x5134b5);}(_0xb009,0xe0));var _0x9b00=function(_0x4cdd4d,_0x3cce1e){_0x4cdd4d=_0x4cdd4d-0x0;var _0x1bbd06=_0xb009[_0x4cdd4d];return _0x1bbd06;};'use strict';var _=require(_0x9b00('0x0'));var util=require('util');var moment=require(_0x9b00('0x1'));var BPromise=require(_0x9b00('0x2'));var rs=require(_0x9b00('0x3'));var fs=require('fs');var Redis=require(_0x9b00('0x4'));var db=require(_0x9b00('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b00('0x6'))(_0x9b00('0x7'));var config=require(_0x9b00('0x8'));var jayson=require(_0x9b00('0x9'));var client=jayson[_0x9b00('0xa')][_0x9b00('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfd6773,_0x43054d,_0x36abec){return new BPromise(function(_0x1b0089,_0x44ae00){return client['request'](_0xfd6773,_0x36abec)[_0x9b00('0xc')](function(_0x3fbc6d){logger['info'](_0x9b00('0xd'),_0x43054d,_0x9b00('0xe'));logger[_0x9b00('0xf')](_0x9b00('0x10'),_0x43054d,_0x9b00('0xe'),JSON[_0x9b00('0x11')](_0x3fbc6d));if(_0x3fbc6d[_0x9b00('0x12')]){if(_0x3fbc6d[_0x9b00('0x12')][_0x9b00('0x13')]===0x1f4){logger[_0x9b00('0x12')](_0x9b00('0xd'),_0x43054d,_0x3fbc6d[_0x9b00('0x12')][_0x9b00('0x14')]);return _0x44ae00(_0x3fbc6d['error'][_0x9b00('0x14')]);}logger['error'](_0x9b00('0xd'),_0x43054d,_0x3fbc6d['error'][_0x9b00('0x14')]);return _0x1b0089(_0x3fbc6d[_0x9b00('0x12')][_0x9b00('0x14')]);}else{logger[_0x9b00('0x15')](_0x9b00('0xd'),_0x43054d,'request\x20sent');_0x1b0089(_0x3fbc6d[_0x9b00('0x16')]['message']);}})[_0x9b00('0x17')](function(_0x40c8aa){logger[_0x9b00('0x12')](_0x9b00('0xd'),_0x43054d,_0x40c8aa);_0x44ae00(_0x40c8aa);});});}exports[_0x9b00('0x18')]=function(_0xf6289c){var _0x946d52=this;return new Promise(function(_0x4e9f8a,_0x4067d8){return db['Pause'][_0x9b00('0x19')]({'raw':_0xf6289c[_0x9b00('0x1a')]?_0xf6289c[_0x9b00('0x1a')][_0x9b00('0x1b')]===undefined?!![]:![]:!![],'where':_0xf6289c[_0x9b00('0x1a')]?_0xf6289c[_0x9b00('0x1a')]['where']||null:null,'attributes':_0xf6289c[_0x9b00('0x1a')]?_0xf6289c[_0x9b00('0x1a')]['attributes']||null:null,'include':_0xf6289c[_0x9b00('0x1a')]?_0xf6289c[_0x9b00('0x1a')][_0x9b00('0x1c')]?_[_0x9b00('0x1d')](_0xf6289c[_0x9b00('0x1a')][_0x9b00('0x1c')],function(_0x2ae320){return{'model':db[_0x2ae320[_0x9b00('0x1e')]],'as':_0x2ae320['as'],'attributes':_0x2ae320[_0x9b00('0x1f')],'include':_0x2ae320['include']?_[_0x9b00('0x1d')](_0x2ae320['include'],function(_0x1f0a77){return{'model':db[_0x1f0a77[_0x9b00('0x1e')]],'as':_0x1f0a77['as'],'attributes':_0x1f0a77['attributes'],'include':_0x1f0a77[_0x9b00('0x1c')]?_[_0x9b00('0x1d')](_0x1f0a77[_0x9b00('0x1c')],function(_0x2cfc35){return{'model':db[_0x2cfc35[_0x9b00('0x1e')]],'as':_0x2cfc35['as'],'attributes':_0x2cfc35[_0x9b00('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9b00('0xc')](function(_0x13d0b2){logger[_0x9b00('0x15')](_0x9b00('0x18'),_0xf6289c);logger[_0x9b00('0xf')](_0x9b00('0x18'),_0xf6289c,JSON[_0x9b00('0x11')](_0x13d0b2));_0x4e9f8a(_0x13d0b2);})[_0x9b00('0x17')](function(_0x594e3a){logger[_0x9b00('0x12')]('ShowPause',_0x594e3a[_0x9b00('0x14')],_0xf6289c);_0x4067d8(_0x946d52['error'](0x1f4,_0x594e3a[_0x9b00('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index f2f701d..c5cfcd5 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 _0xef81=['post','single','file','upload','/webhook','webhookPost','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','now'];(function(_0xb9fd3c,_0x8f3b84){var _0x54a08a=function(_0x1bedd6){while(--_0x1bedd6){_0xb9fd3c['push'](_0xb9fd3c['shift']());}};_0x54a08a(++_0x8f3b84);}(_0xef81,0x1ad));var _0x1ef8=function(_0x4e29ec,_0x277199){_0x4e29ec=_0x4e29ec-0x0;var _0x2ceb89=_0xef81[_0x4e29ec];return _0x2ceb89;};'use strict';var multer=require(_0x1ef8('0x0'));var util=require(_0x1ef8('0x1'));var path=require('path');var timeout=require(_0x1ef8('0x2'));var express=require(_0x1ef8('0x3'));var router=express[_0x1ef8('0x4')]();var fs_extra=require(_0x1ef8('0x5'));var auth=require(_0x1ef8('0x6'));var interaction=require(_0x1ef8('0x7'));var config=require(_0x1ef8('0x8'));var controller=require(_0x1ef8('0x9'));router[_0x1ef8('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1ef8('0xa')]('/webhook',controller[_0x1ef8('0xb')]);router[_0x1ef8('0xa')](_0x1ef8('0xc'),auth[_0x1ef8('0xd')](),controller[_0x1ef8('0xe')]);router[_0x1ef8('0xa')](_0x1ef8('0xf'),auth[_0x1ef8('0xd')](),controller[_0x1ef8('0x10')]);var upload=multer({'storage':multer[_0x1ef8('0x11')]({'destination':function(_0x3b319d,_0x2e446c,_0x866b4e){_0x866b4e(null,path[_0x1ef8('0x12')](config[_0x1ef8('0x13')],_0x1ef8('0x14')));},'filename':function(_0x268da0,_0x5c892d,_0x212d51){_0x5c892d[_0x1ef8('0x15')]=_0x5c892d[_0x1ef8('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x212d51(null,util[_0x1ef8('0x16')](_0x1ef8('0x17'),path[_0x1ef8('0x18')](_0x5c892d[_0x1ef8('0x15')],path['extname'](_0x5c892d['originalname'])),Date[_0x1ef8('0x19')](),path['extname'](_0x5c892d[_0x1ef8('0x15')])));}})});router[_0x1ef8('0x1a')]('/',upload[_0x1ef8('0x1b')](_0x1ef8('0x1c')),controller[_0x1ef8('0x1d')]);router[_0x1ef8('0x1a')](_0x1ef8('0x1e'),controller[_0x1ef8('0x1f')]);router[_0x1ef8('0x20')](_0x1ef8('0xc'),auth[_0x1ef8('0xd')](),controller['update']);router[_0x1ef8('0x21')](_0x1ef8('0xc'),auth[_0x1ef8('0xd')](),controller['delete']);module[_0x1ef8('0x22')]=router; \ No newline at end of file +var _0x084a=['%s-%s%s','basename','extname','now','single','file','post','webhookPost','put','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','index','get','/webhook','webhookGet','/:id','isAuthenticated','/:id/download','download','diskStorage','join','originalname','replace','format'];(function(_0x286fdb,_0xf4f8bd){var _0xde751=function(_0x4095f9){while(--_0x4095f9){_0x286fdb['push'](_0x286fdb['shift']());}};_0xde751(++_0xf4f8bd);}(_0x084a,0xaa));var _0xa084=function(_0x13703d,_0x4376dd){_0x13703d=_0x13703d-0x0;var _0x41927d=_0x084a[_0x13703d];return _0x41927d;};'use strict';var multer=require(_0xa084('0x0'));var util=require(_0xa084('0x1'));var path=require('path');var timeout=require(_0xa084('0x2'));var express=require(_0xa084('0x3'));var router=express['Router']();var fs_extra=require(_0xa084('0x4'));var auth=require(_0xa084('0x5'));var interaction=require(_0xa084('0x6'));var config=require(_0xa084('0x7'));var controller=require(_0xa084('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa084('0x9')]);router[_0xa084('0xa')](_0xa084('0xb'),controller[_0xa084('0xc')]);router['get'](_0xa084('0xd'),auth[_0xa084('0xe')](),controller['show']);router[_0xa084('0xa')](_0xa084('0xf'),auth['isAuthenticated'](),controller[_0xa084('0x10')]);var upload=multer({'storage':multer[_0xa084('0x11')]({'destination':function(_0x2bd219,_0x44889f,_0xb7f94e){_0xb7f94e(null,path[_0xa084('0x12')](config['root'],'server/files/plugins'));},'filename':function(_0x23ace2,_0xfa3869,_0x13ec4a){_0xfa3869[_0xa084('0x13')]=_0xfa3869['originalname'][_0xa084('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x13ec4a(null,util[_0xa084('0x15')](_0xa084('0x16'),path[_0xa084('0x17')](_0xfa3869[_0xa084('0x13')],path[_0xa084('0x18')](_0xfa3869['originalname'])),Date[_0xa084('0x19')](),path[_0xa084('0x18')](_0xfa3869[_0xa084('0x13')])));}})});router['post']('/',upload[_0xa084('0x1a')](_0xa084('0x1b')),controller['upload']);router[_0xa084('0x1c')]('/webhook',controller[_0xa084('0x1d')]);router[_0xa084('0x1e')](_0xa084('0xd'),auth[_0xa084('0xe')](),controller['update']);router[_0xa084('0x1f')](_0xa084('0xd'),auth['isAuthenticated'](),controller[_0xa084('0x1f')]);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 5083281..c69858f 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 _0x5caa=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x1eb452,_0x489819){var _0x2a7e3f=function(_0x1f0aec){while(--_0x1f0aec){_0x1eb452['push'](_0x1eb452['shift']());}};_0x2a7e3f(++_0x489819);}(_0x5caa,0x95));var _0xa5ca=function(_0x57f345,_0x316929){_0x57f345=_0x57f345-0x0;var _0x255e43=_0x5caa[_0x57f345];return _0x255e43;};'use strict';var Sequelize=require('sequelize');module[_0xa5ca('0x0')]={'name':{'type':Sequelize[_0xa5ca('0x1')]},'type':{'type':Sequelize[_0xa5ca('0x2')](_0xa5ca('0x3'),_0xa5ca('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xa5ca('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0xa5ca('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa5ca('0x7')},'sidebar':{'type':Sequelize[_0xa5ca('0x2')]('adminOnly',_0xa5ca('0x8'),_0xa5ca('0x9'),_0xa5ca('0xa')),'defaultValue':_0xa5ca('0x9'),'comment':_0xa5ca('0xb')},'icon':{'type':Sequelize[_0xa5ca('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xa5ca('0x1')]},'scriptPath':{'type':Sequelize[_0xa5ca('0x1')]}}; \ No newline at end of file +var _0x07fc=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','exports','ENUM','TEXT'];(function(_0x5e934b,_0x467b2b){var _0x472a6f=function(_0x464b83){while(--_0x464b83){_0x5e934b['push'](_0x5e934b['shift']());}};_0x472a6f(++_0x467b2b);}(_0x07fc,0x100));var _0xc07f=function(_0x3dee09,_0x583fd6){_0x3dee09=_0x3dee09-0x0;var _0x3ee43d=_0x07fc[_0x3dee09];return _0x3ee43d;};'use strict';var Sequelize=require(_0xc07f('0x0'));module[_0xc07f('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc07f('0x2')]('html','script')},'description':{'type':Sequelize[_0xc07f('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0xc07f('0x4')},'active':{'type':Sequelize[_0xc07f('0x5')],'defaultValue':0x0,'comment':_0xc07f('0x6')},'sidebar':{'type':Sequelize[_0xc07f('0x2')](_0xc07f('0x7'),_0xc07f('0x8'),_0xc07f('0x9'),_0xc07f('0xa')),'defaultValue':_0xc07f('0x9'),'comment':_0xc07f('0xb')},'icon':{'type':Sequelize[_0xc07f('0xc')]},'adminUrl':{'type':Sequelize[_0xc07f('0xc')]},'agentUrl':{'type':Sequelize[_0xc07f('0xc')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index d0f05a6..d44ef8a 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 _0x1516=['\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Plugin','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','intersection','find','download','path','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','Temporary\x20file\x20removed','upload','basename','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','scriptName','scriptPath','create','body','userProfileId','user','UserProfileSection','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified'];(function(_0x383fa9,_0x120b57){var _0x1c0653=function(_0x5ab633){while(--_0x5ab633){_0x383fa9['push'](_0x383fa9['shift']());}};_0x1c0653(++_0x120b57);}(_0x1516,0xb0));var _0x6151=function(_0x2511cd,_0x9fed78){_0x2511cd=_0x2511cd-0x0;var _0x318afa=_0x1516[_0x2511cd];return _0x318afa;};'use strict';var emlformat=require(_0x6151('0x0'));var rimraf=require(_0x6151('0x1'));var zipdir=require(_0x6151('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6151('0x3'));var moment=require(_0x6151('0x4'));var BPromise=require(_0x6151('0x5'));var Mustache=require(_0x6151('0x6'));var util=require(_0x6151('0x7'));var path=require('path');var sox=require(_0x6151('0x8'));var csv=require('to-csv');var ejs=require(_0x6151('0x9'));var fs=require('fs');var fs_extra=require(_0x6151('0xa'));var _=require(_0x6151('0xb'));var squel=require(_0x6151('0xc'));var crypto=require(_0x6151('0xd'));var jsforce=require(_0x6151('0xe'));var deskjs=require(_0x6151('0xf'));var toCsv=require(_0x6151('0x10'));var querystring=require(_0x6151('0x11'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x6151('0x1'));var archiver=require(_0x6151('0x12'));var Redis=require(_0x6151('0x13'));var authService=require(_0x6151('0x14'));var qs=require(_0x6151('0x15'));var as=require(_0x6151('0x16'));var hardwareService=require(_0x6151('0x17'));var logger=require(_0x6151('0x18'))(_0x6151('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6151('0x1a'));var db=require(_0x6151('0x1b'))['db'];config[_0x6151('0x1c')]=_['defaults'](config[_0x6151('0x1c')],{'host':_0x6151('0x1d'),'port':0x18eb});var socket=require(_0x6151('0x1e'))(new Redis(config[_0x6151('0x1c')]));require('./plugin.socket')[_0x6151('0x1f')](socket);function respondWithStatusCode(_0x591057,_0x3c411e){_0x3c411e=_0x3c411e||0xcc;return function(_0x21fa5f){if(_0x21fa5f){return _0x591057[_0x6151('0x20')](_0x3c411e);}return _0x591057[_0x6151('0x21')](_0x3c411e)[_0x6151('0x22')]();};}function respondWithResult(_0x12524a,_0x3d95ef){_0x3d95ef=_0x3d95ef||0xc8;return function(_0x55ea64){if(_0x55ea64){return _0x12524a['status'](_0x3d95ef)[_0x6151('0x23')](_0x55ea64);}};}function respondWithFilteredResult(_0x7d5f8d,_0x504c4b){return function(_0x168b79){if(_0x168b79){var _0x24bfbd=typeof _0x504c4b[_0x6151('0x24')]===_0x6151('0x25')&&typeof _0x504c4b[_0x6151('0x26')]===_0x6151('0x25');var _0x38bcac=_0x168b79[_0x6151('0x27')];var _0x18a908=_0x24bfbd?0x0:_0x504c4b[_0x6151('0x24')];var _0x3e5660=_0x24bfbd?_0x168b79[_0x6151('0x27')]:_0x504c4b[_0x6151('0x24')]+_0x504c4b[_0x6151('0x26')];var _0x452035;if(_0x3e5660>=_0x38bcac){_0x3e5660=_0x38bcac;_0x452035=0xc8;}else{_0x452035=0xce;}_0x7d5f8d['status'](_0x452035);return _0x7d5f8d[_0x6151('0x28')](_0x6151('0x29'),_0x18a908+'-'+_0x3e5660+'/'+_0x38bcac)['json'](_0x168b79);}return null;};}function patchUpdates(_0x582c40){return function(_0x245340){try{jsonpatch[_0x6151('0x2a')](_0x245340,_0x582c40,!![]);}catch(_0x585ba8){return BPromise[_0x6151('0x2b')](_0x585ba8);}return _0x245340[_0x6151('0x2c')]();};}function saveUpdates(_0x4810dd,_0x30f34b){return function(_0x26676d){if(_0x26676d){return _0x26676d[_0x6151('0x2d')](_0x4810dd)[_0x6151('0x2e')](function(_0x550b3b){return _0x550b3b;});}return null;};}function removeEntity(_0x1aac71,_0x3e1739){return function(_0x431b75){if(_0x431b75){return _0x431b75[_0x6151('0x2f')]()['then'](function(){var _0x1a6fd2=_0x431b75[_0x6151('0x30')]({'plain':!![]});var _0x99ea9f='Plugins';return db[_0x6151('0x31')][_0x6151('0x2f')]({'where':{'type':_0x99ea9f,'resourceId':_0x1a6fd2['id']}})['then'](function(){return _0x431b75;});})[_0x6151('0x2e')](function(){_0x1aac71[_0x6151('0x21')](0xcc)[_0x6151('0x22')]();});}};}function handleEntityNotFound(_0xac79b6,_0x7532){return function(_0x44cd02){if(!_0x44cd02){_0xac79b6[_0x6151('0x20')](0x194);}return _0x44cd02;};}function handleError(_0x328e61,_0x168102){_0x168102=_0x168102||0x1f4;return function(_0x977323){logger[_0x6151('0x32')](_0x977323[_0x6151('0x33')]);if(_0x977323[_0x6151('0x34')]){delete _0x977323[_0x6151('0x34')];}_0x328e61[_0x6151('0x21')](_0x168102)[_0x6151('0x35')](_0x977323);};}exports[_0x6151('0x36')]=function(_0xb627b3,_0x47351e){var _0x257e2e={},_0x408225={},_0x4d5c86={'count':0x0,'rows':[]};var _0x23ac38=_['map'](db[_0x6151('0x37')][_0x6151('0x38')],function(_0x545242){return{'name':_0x545242[_0x6151('0x39')],'type':_0x545242['type'][_0x6151('0x3a')]};});_0x408225[_0x6151('0x3b')]=_[_0x6151('0x3c')](_0x23ac38,_0x6151('0x34'));_0x408225['query']=_[_0x6151('0x3d')](_0xb627b3[_0x6151('0x3e')]);_0x408225[_0x6151('0x3f')]=_['intersection'](_0x408225[_0x6151('0x3b')],_0x408225[_0x6151('0x3e')]);_0x257e2e[_0x6151('0x40')]=_['intersection'](_0x408225[_0x6151('0x3b')],qs[_0x6151('0x41')](_0xb627b3['query'][_0x6151('0x41')]));_0x257e2e[_0x6151('0x40')]=_0x257e2e[_0x6151('0x40')][_0x6151('0x42')]?_0x257e2e['attributes']:_0x408225['model'];if(!_0xb627b3[_0x6151('0x3e')]['hasOwnProperty'](_0x6151('0x43'))){_0x257e2e[_0x6151('0x26')]=qs[_0x6151('0x26')](_0xb627b3[_0x6151('0x3e')][_0x6151('0x26')]);_0x257e2e[_0x6151('0x24')]=qs['offset'](_0xb627b3[_0x6151('0x3e')][_0x6151('0x24')]);}_0x257e2e[_0x6151('0x44')]=qs[_0x6151('0x45')](_0xb627b3[_0x6151('0x3e')][_0x6151('0x45')]);_0x257e2e[_0x6151('0x46')]=qs[_0x6151('0x3f')](_[_0x6151('0x47')](_0xb627b3[_0x6151('0x3e')],_0x408225[_0x6151('0x3f')]),_0x23ac38);if(_0xb627b3['query']['filter']){_0x257e2e[_0x6151('0x46')]=_[_0x6151('0x48')](_0x257e2e[_0x6151('0x46')],{'$or':_[_0x6151('0x3c')](_0x23ac38,function(_0xbb0445){if(_0xbb0445['type']!=='VIRTUAL'){var _0x51ffd9={};_0x51ffd9[_0xbb0445['name']]={'$like':'%'+_0xb627b3[_0x6151('0x3e')][_0x6151('0x49')]+'%'};return _0x51ffd9;}})});}_0x257e2e=_[_0x6151('0x48')]({},_0x257e2e,_0xb627b3[_0x6151('0x4a')]);var _0x122c7f={'where':_0x257e2e[_0x6151('0x46')]};return db[_0x6151('0x37')]['count'](_0x122c7f)[_0x6151('0x2e')](function(_0x227235){_0x4d5c86[_0x6151('0x27')]=_0x227235;if(_0xb627b3[_0x6151('0x3e')][_0x6151('0x4b')]){_0x257e2e[_0x6151('0x4c')]=[{'all':!![]}];}return db['Plugin'][_0x6151('0x4d')](_0x257e2e);})['then'](function(_0x4586ce){_0x4d5c86[_0x6151('0x4e')]=_0x4586ce;return _0x4d5c86;})['then'](respondWithFilteredResult(_0x47351e,_0x257e2e))[_0x6151('0x4f')](handleError(_0x47351e,null));};exports['show']=function(_0x3b227f,_0x49a89f){var _0x35c331={'raw':!![],'where':{'id':_0x3b227f[_0x6151('0x50')]['id']}},_0x1d80fa={};_0x1d80fa[_0x6151('0x3b')]=_[_0x6151('0x3d')](db['Plugin']['rawAttributes']);_0x1d80fa[_0x6151('0x3e')]=_[_0x6151('0x3d')](_0x3b227f[_0x6151('0x3e')]);_0x1d80fa[_0x6151('0x3f')]=_['intersection'](_0x1d80fa[_0x6151('0x3b')],_0x1d80fa[_0x6151('0x3e')]);_0x35c331[_0x6151('0x40')]=_[_0x6151('0x51')](_0x1d80fa[_0x6151('0x3b')],qs[_0x6151('0x41')](_0x3b227f[_0x6151('0x3e')][_0x6151('0x41')]));_0x35c331[_0x6151('0x40')]=_0x35c331[_0x6151('0x40')][_0x6151('0x42')]?_0x35c331[_0x6151('0x40')]:_0x1d80fa[_0x6151('0x3b')];if(_0x3b227f['query']['includeAll']){_0x35c331['include']=[{'all':!![]}];}_0x35c331=_[_0x6151('0x48')]({},_0x35c331,_0x3b227f[_0x6151('0x4a')]);return db[_0x6151('0x37')][_0x6151('0x52')](_0x35c331)[_0x6151('0x2e')](handleEntityNotFound(_0x49a89f,null))[_0x6151('0x2e')](respondWithResult(_0x49a89f,null))['catch'](handleError(_0x49a89f,null));};exports[_0x6151('0x53')]=function(_0x2fe020,_0x43edb5,_0x45d5aa){return db['Plugin'][_0x6151('0x52')]({'where':{'id':_0x2fe020[_0x6151('0x50')]['id']},'attributes':['name',_0x6151('0x54')],'raw':!![]})[_0x6151('0x2e')](handleEntityNotFound(_0x43edb5,null))[_0x6151('0x2e')](function(_0x3ad7d4){if(_0x3ad7d4){var _0x1bc3d0=path[_0x6151('0x55')](config[_0x6151('0x56')],_0x6151('0x57'),util[_0x6151('0x58')](_0x6151('0x59'),path['basename'](_0x3ad7d4['path'])));var _0x86cb3b=fs[_0x6151('0x5a')](_0x1bc3d0);var _0x321a7f=archiver(_0x6151('0x5b'),{'zlib':{'level':0x9}});_0x321a7f['on'](_0x6151('0x5c'),function(_0x47c519){if(_0x47c519[_0x6151('0x5d')]===_0x6151('0x5e')){logger[_0x6151('0x32')](_0x47c519);}else{throw new db[(_0x6151('0x5f'))][(_0x6151('0x60'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x321a7f['on']('error',function(_0x350b0d){throw new db[(_0x6151('0x5f'))][(_0x6151('0x60'))](_0x6151('0x61'));});_0x321a7f[_0x6151('0x62')](_0x86cb3b);_0x321a7f['glob']('**/*',{'cwd':path[_0x6151('0x55')](config[_0x6151('0x56')],'server/files/plugins',path[_0x6151('0x63')](_0x3ad7d4['path'])),'ignore':[path[_0x6151('0x55')](path['basename'](_0x3ad7d4['path']),_0x6151('0x64')),path[_0x6151('0x55')](path['basename'](_0x3ad7d4['path']),_0x6151('0x65'))],'nodir':!![]})['finalize']();_0x86cb3b['on'](_0x6151('0x66'),function(){if(!fs[_0x6151('0x67')](_0x1bc3d0)){throw new db[(_0x6151('0x5f'))][(_0x6151('0x60'))](_0x6151('0x68'));}return _0x43edb5[_0x6151('0x53')](_0x1bc3d0,util[_0x6151('0x58')](_0x6151('0x59'),path['basename'](_0x3ad7d4[_0x6151('0x54')])),function(_0x4c34df){if(_0x4c34df){throw new db[(_0x6151('0x5f'))][(_0x6151('0x60'))](_0x6151('0x69'));}fs['unlinkSync'](_0x1bc3d0);logger['info'](_0x6151('0x6a'));logger[_0x6151('0x6b')](_0x6151('0x6c'));});});}return null;})[_0x6151('0x4f')](handleError(_0x43edb5,null));};exports[_0x6151('0x6d')]=function(_0x4089ff,_0x40907a,_0x1b0a1a){var _0x109334=path[_0x6151('0x6e')](_0x4089ff[_0x6151('0x6f')][_0x6151('0x70')],path[_0x6151('0x71')](_0x4089ff[_0x6151('0x6f')][_0x6151('0x70')]));var _0x4e5c18=path[_0x6151('0x55')](config['root'],_0x6151('0x57'),_0x4089ff[_0x6151('0x6f')][_0x6151('0x70')]);var _0x33ffbf=path[_0x6151('0x55')](config['root'],'server/files/plugins',_0x109334);logger[_0x6151('0x6b')]('Plugin\x20upload\x20filepath:\x20%s',_0x4e5c18);logger[_0x6151('0x6b')](_0x6151('0x72'),_0x33ffbf);try{fs[_0x6151('0x73')](_0x4e5c18,parseInt('0777',0x8));extract(_0x4e5c18,{'dir':_0x33ffbf},function(_0x167754){if(_0x167754){logger[_0x6151('0x32')](_0x167754);handleError(_0x167754,!![]);};var _0xe88b87=fs[_0x6151('0x74')](_0x33ffbf);if(_0xe88b87[_0x6151('0x42')]>0x1){removeReferences(_0x4e5c18,_0x33ffbf);logger[_0x6151('0x32')](_0x6151('0x75'));return _0x1b0a1a(new Error(_0x6151('0x75')));}var _0x452f3b=fs[_0x6151('0x76')](path['join'](_0x33ffbf,_0xe88b87[0x0]));if(_0x452f3b[_0x6151('0x77')]()){removeReferences(_0x4e5c18,_0x33ffbf);logger[_0x6151('0x32')](_0x6151('0x75'));return _0x1b0a1a(new Error(_0x6151('0x75')));}if(_0x452f3b[_0x6151('0x78')]()){var _0x3c47ca=fs[_0x6151('0x74')](path[_0x6151('0x55')](_0x33ffbf,_0xe88b87[0x0]));if(_0x3c47ca[_0x6151('0x42')]===0x0){removeReferences(_0x4e5c18,_0x33ffbf);logger['error'](_0x6151('0x75'));return _0x1b0a1a(new Error(_0x6151('0x75')));}var _0x43abbe=_0x3c47ca['some'](function(_0x2ea854){return _0x2ea854===_0x6151('0x79');});if(!_0x43abbe){return _0x1b0a1a(new Error(_0x6151('0x7a')));}var _0x113e58=fs['readFileSync'](path[_0x6151('0x55')](_0x33ffbf,_0xe88b87[0x0],'manifest.json'));var _0x7187ab=JSON[_0x6151('0x7b')](_0x113e58);if('undefined'==typeof _0x7187ab[_0x6151('0x34')]){return _0x1b0a1a(new Error(_0x6151('0x7c')));}if(_0x6151('0x25')==typeof _0x7187ab[_0x6151('0x7d')]){return _0x1b0a1a(new Error(_0x6151('0x7e')));}if(_0x6151('0x25')==typeof _0x7187ab[_0x6151('0x7f')]){return _0x1b0a1a(new Error(_0x6151('0x80')));}if(_0x6151('0x25')==typeof _0x7187ab[_0x6151('0x81')]){return _0x1b0a1a(new Error(_0x6151('0x82')));}if(_0x7187ab[_0x6151('0x7d')]===_0x6151('0x83')){if(_0x6151('0x25')==typeof _0x7187ab[_0x6151('0x81')][_0x6151('0x84')]){return _0x1b0a1a(new Error(_0x6151('0x85')));}if(_0x6151('0x25')==typeof _0x7187ab[_0x6151('0x81')][_0x6151('0x84')]['admin']&&_0x6151('0x25')==typeof _0x7187ab[_0x6151('0x81')][_0x6151('0x84')][_0x6151('0x86')]){return _0x1b0a1a(new Error(_0x6151('0x87')));}}else if(_0x7187ab[_0x6151('0x7d')]===_0x6151('0x88')){if(_0x6151('0x25')==typeof _0x7187ab['parameters']['scriptName']){return _0x1b0a1a(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x6151('0x25')==typeof _0x7187ab[_0x6151('0x81')]['scriptPath']){return _0x1b0a1a(new Error(_0x6151('0x89')));}}else{return _0x1b0a1a(new Error(_0x6151('0x8a')));}var _0x51de3e=_0x7187ab[_0x6151('0x34')];var _0x11ce53=_0x7187ab[_0x6151('0x8b')];var _0x1f9323=_0x7187ab[_0x6151('0x7d')];var _0x191ff3=_0x7187ab[_0x6151('0x8c')]?_0x7187ab[_0x6151('0x8c')]:'always';var _0x3c8183=_0x7187ab['icon']?_0x7187ab[_0x6151('0x8d')]:_0x6151('0x8e');var _0xa9b3f4='';var _0x2eda29='';var _0x3f0924='';var _0x2d672a='';var _0x4688eb=_0x7187ab[_0x6151('0x7f')];if(_0x1f9323===_0x6151('0x83')){if('undefined'!=typeof _0x7187ab[_0x6151('0x81')]['views'][_0x6151('0x8f')]){var _0x45472e=_0x7187ab[_0x6151('0x81')][_0x6151('0x84')][_0x6151('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x6151('0x90')](_0x45472e)){_0xa9b3f4=path[_0x6151('0x55')](_0x6151('0x91'),_0x109334,_0xe88b87[0x0],_0x45472e);}else{_0xa9b3f4=_0x45472e;}}else{logger['info'](_0x6151('0x92'));}if(_0x6151('0x25')!=typeof _0x7187ab['parameters'][_0x6151('0x84')][_0x6151('0x86')]){var _0x26fbe6=_0x7187ab[_0x6151('0x81')]['views'][_0x6151('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x6151('0x90')](_0x26fbe6)){_0x2eda29=path[_0x6151('0x55')](_0x6151('0x91'),_0x109334,_0xe88b87[0x0],_0x26fbe6);}else{_0x2eda29=_0x26fbe6;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x1f9323===_0x6151('0x88')){_0x3f0924=_0x7187ab[_0x6151('0x81')][_0x6151('0x93')];_0x2d672a=_0x7187ab['parameters'][_0x6151('0x94')];if(_0x6151('0x25')!=typeof _0x7187ab[_0x6151('0x81')][_0x6151('0x84')]){if('undefined'!=typeof _0x7187ab[_0x6151('0x81')][_0x6151('0x84')][_0x6151('0x8f')]){var _0x45472e=_0x7187ab['parameters'][_0x6151('0x84')][_0x6151('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x6151('0x90')](_0x45472e)){_0xa9b3f4=path[_0x6151('0x55')](_0x6151('0x91'),_0x109334,_0xe88b87[0x0],_0x45472e);}else{_0xa9b3f4=_0x45472e;}}if('undefined'!=typeof _0x7187ab['parameters']['views'][_0x6151('0x86')]){var _0x26fbe6=_0x7187ab[_0x6151('0x81')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x6151('0x90')](_0x26fbe6)){_0x2eda29=path[_0x6151('0x55')](_0x6151('0x91'),_0x109334,_0xe88b87[0x0],_0x26fbe6);}else{_0x2eda29=_0x26fbe6;}}}}var _0x222310={'name':_0x51de3e,'description':_0x11ce53,'path':path[_0x6151('0x55')](_0x109334,_0xe88b87[0x0]),'type':_0x1f9323,'sidebar':_0x191ff3,'icon':_0x3c8183,'adminUrl':_0xa9b3f4,'agentUrl':_0x2eda29,'scriptName':_0x3f0924,'scriptPath':_0x2d672a,'version':_0x4688eb};removeReferences(_0x4e5c18,null);return db[_0x6151('0x37')][_0x6151('0x95')](_0x222310)['then'](function(_0x53c9cc){var _0x797f07={'role':_0x4089ff[_0x6151('0x96')]['role'],'userProfileId':_0x4089ff['body'][_0x6151('0x97')]};if(!_0x797f07)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x797f07['role']===_0x6151('0x98')){var _0x49bce6=_0x53c9cc[_0x6151('0x30')]({'plain':!![]});return db[_0x6151('0x99')]['find']({'where':{'name':_0x6151('0x9a'),'userProfileId':_0x797f07[_0x6151('0x97')]},'raw':!![]})[_0x6151('0x2e')](function(_0x197711){if(_0x197711&&_0x197711['autoAssociation']===0x0){return db[_0x6151('0x31')][_0x6151('0x95')]({'name':_0x49bce6[_0x6151('0x34')],'resourceId':_0x49bce6['id'],'type':_0x197711[_0x6151('0x34')],'sectionId':_0x197711['id']},{})[_0x6151('0x2e')](function(){return _0x53c9cc;});}else{return _0x53c9cc;}})[_0x6151('0x4f')](function(_0x315bd8){logger[_0x6151('0x32')](_0x6151('0x9b'),_0x315bd8);throw _0x315bd8;});}return _0x53c9cc;})['then'](respondWithResult(_0x40907a,null))[_0x6151('0x4f')](handleError(_0x40907a,null));}});}catch(_0x47a176){_0x40907a['status'](0x1f4)[_0x6151('0x35')](_0x47a176);}};function removeReferences(_0x2194c5,_0x4bd8d7){try{if(_0x2194c5){fs[_0x6151('0x9c')](_0x2194c5);logger[_0x6151('0x6b')](_0x6151('0x9d'));}if(_0x4bd8d7){rimraf(_0x4bd8d7,function(){});logger[_0x6151('0x6b')](_0x6151('0x9e'));}}catch(_0x18bfb1){logger[_0x6151('0x32')](_0x18bfb1);}}exports[_0x6151('0x2d')]=function(_0xe70dea,_0x24249c,_0x131bb9){return db['Plugin'][_0x6151('0x52')]({'where':{'id':_0xe70dea['params']['id']}})[_0x6151('0x2e')](handleEntityNotFound(_0x24249c,null))['then'](saveUpdates(_0xe70dea[_0x6151('0x96')],null))[_0x6151('0x2e')](respondWithResult(_0x24249c,null))[_0x6151('0x4f')](handleError(_0x24249c,null));};exports['delete']=function(_0x41c3e8,_0x4db031,_0x4fe2a7){return db[_0x6151('0x37')]['find']({'where':{'id':_0x41c3e8[_0x6151('0x50')]['id']}})['then'](function(_0x54140d){if(_0x54140d){return _0x54140d[_0x6151('0x2f')]();}})['then'](function(_0x3e17a2){rimraf(path[_0x6151('0x55')](config['root'],_0x6151('0x57'),path[_0x6151('0x63')](_0x3e17a2['path'])),function(){});return _0x3e17a2;})['then'](handleEntityNotFound(_0x4db031,null))[_0x6151('0x2e')](respondWithStatusCode(_0x4db031,null))['catch'](handleError(_0x4db031,null));};exports[_0x6151('0x9f')]=function(_0x2fef19,_0x5e3d10,_0x11586d){return BPromise[_0x6151('0xa0')]()['then'](function(){if(!_0x2fef19[_0x6151('0x3e')][_0x6151('0x54')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2fef19[_0x6151('0x3e')][_0x6151('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x166d6c=_0x2fef19[_0x6151('0x3e')][_0x6151('0xa2')]?_0x2fef19[_0x6151('0x3e')][_0x6151('0xa2')]+':'+_0x2fef19[_0x6151('0x3e')]['port']:_0x6151('0xa3')+_0x2fef19[_0x6151('0x3e')][_0x6151('0xa1')];var _0xf14c7b=_0x2fef19['query'][_0x6151('0x23')]?_0x2fef19[_0x6151('0x3e')][_0x6151('0x23')]:!![];var _0x476284=_0x2fef19[_0x6151('0x3e')][_0x6151('0xa4')]?_0x2fef19[_0x6151('0x3e')][_0x6151('0xa4')]:null;var _0x1f36f7={'method':_0x2fef19[_0x6151('0xa5')],'uri':util[_0x6151('0x58')](_0x6151('0xa6'),_0x166d6c,_0x2fef19['query'][_0x6151('0x54')]),'json':_0xf14c7b,'resolveWithFullResponse':!![],'encoding':_0x476284,'qs':_0x2fef19[_0x6151('0x3e')]};if(_0x2fef19['headers']){_0x1f36f7[_0x6151('0xa7')]=_0x2fef19[_0x6151('0xa7')];if(_0x1f36f7['headers']['content-length']){delete _0x1f36f7[_0x6151('0xa7')][_0x6151('0xa8')];}}if(_0x1f36f7[_0x6151('0xa7')][_0x6151('0xa9')]){delete _0x1f36f7[_0x6151('0xa7')][_0x6151('0xa9')];}return rp(_0x1f36f7);})[_0x6151('0x2e')](function(_0x363956){if(_0x363956){_0x5e3d10['set'](_0x363956['headers']);logger[_0x6151('0x6b')](_0x363956[_0x6151('0x96')]);if(_[_0x6151('0xaa')](_0x2fef19[_0x6151('0x3e')][_0x6151('0x54')],'download')&&_0x363956[_0x6151('0xab')]==0x1f4){return _0x5e3d10[_0x6151('0x20')](_0x363956[_0x6151('0xab')]);}else{return _0x5e3d10[_0x6151('0x21')](_0x363956[_0x6151('0xab')])['send'](_0x363956['body']);}}else{return _0x5e3d10['sendStatus'](0xc8);}})['catch'](handleError(_0x5e3d10,null));};exports[_0x6151('0xac')]=function(_0x1a0b4c,_0x1552cb,_0x41a0dc){return BPromise[_0x6151('0xa0')]()['then'](function(){if(!_0x1a0b4c[_0x6151('0x3e')][_0x6151('0x54')]){throw new Error(_0x6151('0xad'));}if(!_0x1a0b4c[_0x6151('0x3e')]['port']){throw new Error(_0x6151('0xae'));}var _0x42dd67=_0x1a0b4c['query'][_0x6151('0xa2')]?_0x1a0b4c['query']['hostname']+':'+_0x1a0b4c[_0x6151('0x3e')][_0x6151('0xa1')]:_0x6151('0xa3')+_0x1a0b4c[_0x6151('0x3e')]['port'];var _0xcbd31e=_0x1a0b4c['query']['json']?_0x1a0b4c['query'][_0x6151('0x23')]:!![];var _0x1bb23a=_0x1a0b4c[_0x6151('0x3e')]['encoding']?_0x1a0b4c[_0x6151('0x3e')]['encoding']:null;var _0x361f96={'method':_0x1a0b4c[_0x6151('0xa5')],'uri':util[_0x6151('0x58')](_0x6151('0xa6'),_0x42dd67,_0x1a0b4c[_0x6151('0x3e')][_0x6151('0x54')]),'json':_0xcbd31e,'resolveWithFullResponse':!![],'encoding':_0x1bb23a,'body':_0x1a0b4c['body']};if(_0x1a0b4c['headers']){_0x361f96['headers']=_0x1a0b4c[_0x6151('0xa7')];if(_0x361f96[_0x6151('0xa7')][_0x6151('0xa8')]){delete _0x361f96[_0x6151('0xa7')][_0x6151('0xa8')];}}if(_0x361f96[_0x6151('0xa7')][_0x6151('0xa9')]){delete _0x361f96[_0x6151('0xa7')][_0x6151('0xa9')];}return rp(_0x361f96);})[_0x6151('0x2e')](function(_0x2c77bd){if(_0x2c77bd){_0x1552cb[_0x6151('0x28')](_0x2c77bd[_0x6151('0xa7')]);logger[_0x6151('0x6b')](_0x2c77bd[_0x6151('0x96')]);return _0x1552cb[_0x6151('0x21')](_0x2c77bd[_0x6151('0xab')])[_0x6151('0x35')](_0x2c77bd['body']);}else{return _0x1552cb['sendStatus'](0xc8);}})[_0x6151('0x4f')](handleError(_0x1552cb,null));}; \ No newline at end of file +var _0x98d8=['always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','scriptName','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','find','delete','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','port','http://localhost:','encoding','method','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','resolve','hostname','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','Plugins','UserProfileResource','sendStatus','name','send','Plugin','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','download','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','file','filename','chmodSync','0777','readdirSync','error','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','parameters','views','admin','script','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar'];(function(_0x5cbd30,_0x3870ec){var _0xce62fc=function(_0x223147){while(--_0x223147){_0x5cbd30['push'](_0x5cbd30['shift']());}};_0xce62fc(++_0x3870ec);}(_0x98d8,0xce));var _0x898d=function(_0x3fe30d,_0x469e48){_0x3fe30d=_0x3fe30d-0x0;var _0x37b3e1=_0x98d8[_0x3fe30d];return _0x37b3e1;};'use strict';var emlformat=require(_0x898d('0x0'));var rimraf=require(_0x898d('0x1'));var zipdir=require(_0x898d('0x2'));var jsonpatch=require(_0x898d('0x3'));var rp=require(_0x898d('0x4'));var moment=require(_0x898d('0x5'));var BPromise=require(_0x898d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x898d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x898d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898d('0x9'));var squel=require('squel');var crypto=require(_0x898d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x898d('0xb'));var toCsv=require(_0x898d('0xc'));var querystring=require(_0x898d('0xd'));var Papa=require(_0x898d('0xe'));var extract=require(_0x898d('0xf'));var rimraf=require(_0x898d('0x1'));var archiver=require(_0x898d('0x10'));var Redis=require(_0x898d('0x11'));var authService=require(_0x898d('0x12'));var qs=require(_0x898d('0x13'));var as=require(_0x898d('0x14'));var hardwareService=require(_0x898d('0x15'));var logger=require(_0x898d('0x16'))(_0x898d('0x17'));var utils=require(_0x898d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x898d('0x19'));var db=require(_0x898d('0x1a'))['db'];config['redis']=_[_0x898d('0x1b')](config[_0x898d('0x1c')],{'host':_0x898d('0x1d'),'port':0x18eb});var socket=require(_0x898d('0x1e'))(new Redis(config[_0x898d('0x1c')]));require(_0x898d('0x1f'))[_0x898d('0x20')](socket);function respondWithStatusCode(_0x50634f,_0x15fafc){_0x15fafc=_0x15fafc||0xcc;return function(_0xccd1a9){if(_0xccd1a9){return _0x50634f['sendStatus'](_0x15fafc);}return _0x50634f['status'](_0x15fafc)[_0x898d('0x21')]();};}function respondWithResult(_0x42a098,_0x1ff50b){_0x1ff50b=_0x1ff50b||0xc8;return function(_0x4202f0){if(_0x4202f0){return _0x42a098[_0x898d('0x22')](_0x1ff50b)[_0x898d('0x23')](_0x4202f0);}};}function respondWithFilteredResult(_0x514c47,_0x47c188){return function(_0x26be5a){if(_0x26be5a){var _0x3d040a=typeof _0x47c188[_0x898d('0x24')]===_0x898d('0x25')&&typeof _0x47c188[_0x898d('0x26')]===_0x898d('0x25');var _0x3db3a7=_0x26be5a[_0x898d('0x27')];var _0x12e72c=_0x3d040a?0x0:_0x47c188[_0x898d('0x24')];var _0x220d7b=_0x3d040a?_0x26be5a['count']:_0x47c188[_0x898d('0x24')]+_0x47c188[_0x898d('0x26')];var _0x7113ca;if(_0x220d7b>=_0x3db3a7){_0x220d7b=_0x3db3a7;_0x7113ca=0xc8;}else{_0x7113ca=0xce;}_0x514c47['status'](_0x7113ca);return _0x514c47['set'](_0x898d('0x28'),_0x12e72c+'-'+_0x220d7b+'/'+_0x3db3a7)[_0x898d('0x23')](_0x26be5a);}return null;};}function patchUpdates(_0xa4fc71){return function(_0x10290f){try{jsonpatch[_0x898d('0x29')](_0x10290f,_0xa4fc71,!![]);}catch(_0x3fc201){return BPromise[_0x898d('0x2a')](_0x3fc201);}return _0x10290f[_0x898d('0x2b')]();};}function saveUpdates(_0x30c415,_0x493a60){return function(_0x543fc3){if(_0x543fc3){return _0x543fc3[_0x898d('0x2c')](_0x30c415)[_0x898d('0x2d')](function(_0x308b13){return _0x308b13;});}return null;};}function removeEntity(_0x39b61e,_0x244d3a){return function(_0xef200a){if(_0xef200a){return _0xef200a[_0x898d('0x2e')]()['then'](function(){var _0x7873=_0xef200a['get']({'plain':!![]});var _0xaa0054=_0x898d('0x2f');return db[_0x898d('0x30')][_0x898d('0x2e')]({'where':{'type':_0xaa0054,'resourceId':_0x7873['id']}})[_0x898d('0x2d')](function(){return _0xef200a;});})[_0x898d('0x2d')](function(){_0x39b61e['status'](0xcc)[_0x898d('0x21')]();});}};}function handleEntityNotFound(_0xfcae2d,_0x1baec7){return function(_0x47ea99){if(!_0x47ea99){_0xfcae2d[_0x898d('0x31')](0x194);}return _0x47ea99;};}function handleError(_0x15b0fb,_0x417c8e){_0x417c8e=_0x417c8e||0x1f4;return function(_0x8e2e5b){logger['error'](_0x8e2e5b['stack']);if(_0x8e2e5b['name']){delete _0x8e2e5b[_0x898d('0x32')];}_0x15b0fb[_0x898d('0x22')](_0x417c8e)[_0x898d('0x33')](_0x8e2e5b);};}exports['index']=function(_0x3325bc,_0x252d3a){var _0x1b8eb2={},_0xf520fa={},_0x5e6df7={'count':0x0,'rows':[]};var _0x1a5dc2=_['map'](db[_0x898d('0x34')][_0x898d('0x35')],function(_0x30b5b0){return{'name':_0x30b5b0[_0x898d('0x36')],'type':_0x30b5b0[_0x898d('0x37')]['key']};});_0xf520fa['model']=_[_0x898d('0x38')](_0x1a5dc2,_0x898d('0x32'));_0xf520fa['query']=_[_0x898d('0x39')](_0x3325bc[_0x898d('0x3a')]);_0xf520fa[_0x898d('0x3b')]=_[_0x898d('0x3c')](_0xf520fa[_0x898d('0x3d')],_0xf520fa[_0x898d('0x3a')]);_0x1b8eb2['attributes']=_[_0x898d('0x3c')](_0xf520fa[_0x898d('0x3d')],qs[_0x898d('0x3e')](_0x3325bc['query'][_0x898d('0x3e')]));_0x1b8eb2[_0x898d('0x3f')]=_0x1b8eb2[_0x898d('0x3f')]['length']?_0x1b8eb2[_0x898d('0x3f')]:_0xf520fa[_0x898d('0x3d')];if(!_0x3325bc[_0x898d('0x3a')][_0x898d('0x40')](_0x898d('0x41'))){_0x1b8eb2[_0x898d('0x26')]=qs[_0x898d('0x26')](_0x3325bc['query']['limit']);_0x1b8eb2[_0x898d('0x24')]=qs[_0x898d('0x24')](_0x3325bc['query'][_0x898d('0x24')]);}_0x1b8eb2[_0x898d('0x42')]=qs[_0x898d('0x43')](_0x3325bc[_0x898d('0x3a')][_0x898d('0x43')]);_0x1b8eb2[_0x898d('0x44')]=qs[_0x898d('0x3b')](_[_0x898d('0x45')](_0x3325bc[_0x898d('0x3a')],_0xf520fa[_0x898d('0x3b')]),_0x1a5dc2);if(_0x3325bc[_0x898d('0x3a')][_0x898d('0x46')]){_0x1b8eb2[_0x898d('0x44')]=_[_0x898d('0x47')](_0x1b8eb2['where'],{'$or':_[_0x898d('0x38')](_0x1a5dc2,function(_0x23e87b){if(_0x23e87b['type']!==_0x898d('0x48')){var _0x1e77b2={};_0x1e77b2[_0x23e87b['name']]={'$like':'%'+_0x3325bc[_0x898d('0x3a')][_0x898d('0x46')]+'%'};return _0x1e77b2;}})});}_0x1b8eb2=_[_0x898d('0x47')]({},_0x1b8eb2,_0x3325bc[_0x898d('0x49')]);var _0x413b18={'where':_0x1b8eb2['where']};return db[_0x898d('0x34')][_0x898d('0x27')](_0x413b18)[_0x898d('0x2d')](function(_0x233c71){_0x5e6df7[_0x898d('0x27')]=_0x233c71;if(_0x3325bc[_0x898d('0x3a')][_0x898d('0x4a')]){_0x1b8eb2[_0x898d('0x4b')]=[{'all':!![]}];}return db['Plugin'][_0x898d('0x4c')](_0x1b8eb2);})['then'](function(_0x3b6b69){_0x5e6df7[_0x898d('0x4d')]=_0x3b6b69;return _0x5e6df7;})['then'](respondWithFilteredResult(_0x252d3a,_0x1b8eb2))[_0x898d('0x4e')](handleError(_0x252d3a,null));};exports[_0x898d('0x4f')]=function(_0x43ee93,_0x4634f7){var _0x41a746={'raw':!![],'where':{'id':_0x43ee93[_0x898d('0x50')]['id']}},_0x2f834b={};_0x2f834b[_0x898d('0x3d')]=_[_0x898d('0x39')](db[_0x898d('0x34')][_0x898d('0x35')]);_0x2f834b[_0x898d('0x3a')]=_[_0x898d('0x39')](_0x43ee93[_0x898d('0x3a')]);_0x2f834b[_0x898d('0x3b')]=_[_0x898d('0x3c')](_0x2f834b['model'],_0x2f834b[_0x898d('0x3a')]);_0x41a746['attributes']=_[_0x898d('0x3c')](_0x2f834b[_0x898d('0x3d')],qs[_0x898d('0x3e')](_0x43ee93[_0x898d('0x3a')][_0x898d('0x3e')]));_0x41a746[_0x898d('0x3f')]=_0x41a746['attributes'][_0x898d('0x51')]?_0x41a746[_0x898d('0x3f')]:_0x2f834b[_0x898d('0x3d')];if(_0x43ee93[_0x898d('0x3a')][_0x898d('0x4a')]){_0x41a746[_0x898d('0x4b')]=[{'all':!![]}];}_0x41a746=_[_0x898d('0x47')]({},_0x41a746,_0x43ee93[_0x898d('0x49')]);return db[_0x898d('0x34')]['find'](_0x41a746)['then'](handleEntityNotFound(_0x4634f7,null))['then'](respondWithResult(_0x4634f7,null))[_0x898d('0x4e')](handleError(_0x4634f7,null));};exports[_0x898d('0x52')]=function(_0x1d0905,_0x3badbe,_0x5ec4d6){return db[_0x898d('0x34')]['find']({'where':{'id':_0x1d0905[_0x898d('0x50')]['id']},'attributes':['name',_0x898d('0x7')],'raw':!![]})[_0x898d('0x2d')](handleEntityNotFound(_0x3badbe,null))['then'](function(_0x2f3514){if(_0x2f3514){var _0x44cbea=path[_0x898d('0x53')](config['root'],_0x898d('0x54'),util[_0x898d('0x55')](_0x898d('0x56'),path[_0x898d('0x57')](_0x2f3514['path'])));var _0x48679e=fs[_0x898d('0x58')](_0x44cbea);var _0x1858e5=archiver(_0x898d('0x59'),{'zlib':{'level':0x9}});_0x1858e5['on'](_0x898d('0x5a'),function(_0x497c85){if(_0x497c85[_0x898d('0x5b')]==='ENOENT'){logger['error'](_0x497c85);}else{throw new db[(_0x898d('0x5c'))][(_0x898d('0x5d'))](_0x898d('0x5e'));}});_0x1858e5['on']('error',function(_0x582387){throw new db['Sequelize'][(_0x898d('0x5d'))](_0x898d('0x5e'));});_0x1858e5[_0x898d('0x5f')](_0x48679e);_0x1858e5[_0x898d('0x60')](_0x898d('0x61'),{'cwd':path['join'](config[_0x898d('0x62')],_0x898d('0x54'),path[_0x898d('0x63')](_0x2f3514[_0x898d('0x7')])),'ignore':[path[_0x898d('0x53')](path[_0x898d('0x57')](_0x2f3514[_0x898d('0x7')]),_0x898d('0x64')),path['join'](path[_0x898d('0x57')](_0x2f3514['path']),_0x898d('0x65'))],'nodir':!![]})['finalize']();_0x48679e['on'](_0x898d('0x66'),function(){if(!fs[_0x898d('0x67')](_0x44cbea)){throw new db[(_0x898d('0x5c'))][(_0x898d('0x5d'))](_0x898d('0x68'));}return _0x3badbe[_0x898d('0x52')](_0x44cbea,util[_0x898d('0x55')](_0x898d('0x56'),path[_0x898d('0x57')](_0x2f3514[_0x898d('0x7')])),function(_0x4d7c14){if(_0x4d7c14){throw new db[(_0x898d('0x5c'))][(_0x898d('0x5d'))](_0x898d('0x69'));}fs[_0x898d('0x6a')](_0x44cbea);logger['info']('Download\x20completed');logger[_0x898d('0x6b')](_0x898d('0x6c'));});});}return null;})[_0x898d('0x4e')](handleError(_0x3badbe,null));};exports['upload']=function(_0x207bf8,_0x5741ae,_0x58c6cb){var _0x231b24=path['basename'](_0x207bf8[_0x898d('0x6d')]['filename'],path['extname'](_0x207bf8['file'][_0x898d('0x6e')]));var _0x3f45d6=path['join'](config[_0x898d('0x62')],_0x898d('0x54'),_0x207bf8[_0x898d('0x6d')][_0x898d('0x6e')]);var _0xf054d0=path[_0x898d('0x53')](config['root'],_0x898d('0x54'),_0x231b24);logger[_0x898d('0x6b')]('Plugin\x20upload\x20filepath:\x20%s',_0x3f45d6);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0xf054d0);try{fs[_0x898d('0x6f')](_0x3f45d6,parseInt(_0x898d('0x70'),0x8));extract(_0x3f45d6,{'dir':_0xf054d0},function(_0x3d4b93){if(_0x3d4b93){logger['error'](_0x3d4b93);handleError(_0x3d4b93,!![]);};var _0x15b803=fs[_0x898d('0x71')](_0xf054d0);if(_0x15b803[_0x898d('0x51')]>0x1){removeReferences(_0x3f45d6,_0xf054d0);logger[_0x898d('0x72')](_0x898d('0x73'));return _0x58c6cb(new Error('Invalid\x20plugin\x20structure'));}var _0x25b19c=fs[_0x898d('0x74')](path['join'](_0xf054d0,_0x15b803[0x0]));if(_0x25b19c[_0x898d('0x75')]()){removeReferences(_0x3f45d6,_0xf054d0);logger[_0x898d('0x72')](_0x898d('0x73'));return _0x58c6cb(new Error(_0x898d('0x73')));}if(_0x25b19c[_0x898d('0x76')]()){var _0x5cfd65=fs['readdirSync'](path[_0x898d('0x53')](_0xf054d0,_0x15b803[0x0]));if(_0x5cfd65[_0x898d('0x51')]===0x0){removeReferences(_0x3f45d6,_0xf054d0);logger[_0x898d('0x72')](_0x898d('0x73'));return _0x58c6cb(new Error('Invalid\x20plugin\x20structure'));}var _0x3fc14b=_0x5cfd65['some'](function(_0x19d7a6){return _0x19d7a6===_0x898d('0x77');});if(!_0x3fc14b){return _0x58c6cb(new Error('Plugin\x20manifest\x20missing'));}var _0x2db22c=fs['readFileSync'](path[_0x898d('0x53')](_0xf054d0,_0x15b803[0x0],_0x898d('0x77')));var _0x3fc2ab=JSON[_0x898d('0x78')](_0x2db22c);if(_0x898d('0x25')==typeof _0x3fc2ab['name']){return _0x58c6cb(new Error(_0x898d('0x79')));}if(_0x898d('0x25')==typeof _0x3fc2ab[_0x898d('0x37')]){return _0x58c6cb(new Error(_0x898d('0x7a')));}if(_0x898d('0x25')==typeof _0x3fc2ab['version']){return _0x58c6cb(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x898d('0x25')==typeof _0x3fc2ab['parameters']){return _0x58c6cb(new Error(_0x898d('0x7b')));}if(_0x3fc2ab[_0x898d('0x37')]==='html'){if(_0x898d('0x25')==typeof _0x3fc2ab['parameters']['views']){return _0x58c6cb(new Error(_0x898d('0x7c')));}if('undefined'==typeof _0x3fc2ab[_0x898d('0x7d')][_0x898d('0x7e')][_0x898d('0x7f')]&&_0x898d('0x25')==typeof _0x3fc2ab['parameters']['views']['agent']){return _0x58c6cb(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x3fc2ab[_0x898d('0x37')]===_0x898d('0x80')){if('undefined'==typeof _0x3fc2ab['parameters']['scriptName']){return _0x58c6cb(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x898d('0x25')==typeof _0x3fc2ab['parameters']['scriptPath']){return _0x58c6cb(new Error(_0x898d('0x81')));}}else{return _0x58c6cb(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x552f48=_0x3fc2ab['name'];var _0x603c47=_0x3fc2ab[_0x898d('0x82')];var _0xa652fb=_0x3fc2ab[_0x898d('0x37')];var _0xe969ad=_0x3fc2ab[_0x898d('0x83')]?_0x3fc2ab[_0x898d('0x83')]:_0x898d('0x84');var _0x28f535=_0x3fc2ab['icon']?_0x3fc2ab[_0x898d('0x85')]:'icon-apps';var _0x3c4f8d='';var _0x25d0ab='';var _0x323566='';var _0xd8bd46='';var _0x4228a3=_0x3fc2ab['version'];if(_0xa652fb==='html'){if(_0x898d('0x25')!=typeof _0x3fc2ab[_0x898d('0x7d')][_0x898d('0x7e')][_0x898d('0x7f')]){var _0x1e6513=_0x3fc2ab[_0x898d('0x7d')][_0x898d('0x7e')][_0x898d('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x898d('0x86')](_0x1e6513)){_0x3c4f8d=path[_0x898d('0x53')](_0x898d('0x87'),_0x231b24,_0x15b803[0x0],_0x1e6513);}else{_0x3c4f8d=_0x1e6513;}}else{logger['info'](_0x898d('0x88'));}if('undefined'!=typeof _0x3fc2ab['parameters']['views'][_0x898d('0x89')]){var _0xfa807b=_0x3fc2ab['parameters'][_0x898d('0x7e')][_0x898d('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x898d('0x86')](_0xfa807b)){_0x25d0ab=path[_0x898d('0x53')]('plugins',_0x231b24,_0x15b803[0x0],_0xfa807b);}else{_0x25d0ab=_0xfa807b;}}else{logger[_0x898d('0x6b')](_0x898d('0x8a'));}}else if(_0xa652fb===_0x898d('0x80')){_0x323566=_0x3fc2ab[_0x898d('0x7d')][_0x898d('0x8b')];_0xd8bd46=_0x3fc2ab[_0x898d('0x7d')][_0x898d('0x8c')];if(_0x898d('0x25')!=typeof _0x3fc2ab[_0x898d('0x7d')]['views']){if(_0x898d('0x25')!=typeof _0x3fc2ab[_0x898d('0x7d')]['views']['admin']){var _0x1e6513=_0x3fc2ab['parameters'][_0x898d('0x7e')][_0x898d('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x898d('0x86')](_0x1e6513)){_0x3c4f8d=path[_0x898d('0x53')](_0x898d('0x87'),_0x231b24,_0x15b803[0x0],_0x1e6513);}else{_0x3c4f8d=_0x1e6513;}}if(_0x898d('0x25')!=typeof _0x3fc2ab['parameters'][_0x898d('0x7e')]['agent']){var _0xfa807b=_0x3fc2ab[_0x898d('0x7d')][_0x898d('0x7e')][_0x898d('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x898d('0x86')](_0xfa807b)){_0x25d0ab=path[_0x898d('0x53')](_0x898d('0x87'),_0x231b24,_0x15b803[0x0],_0xfa807b);}else{_0x25d0ab=_0xfa807b;}}}}var _0x901ee8={'name':_0x552f48,'description':_0x603c47,'path':path[_0x898d('0x53')](_0x231b24,_0x15b803[0x0]),'type':_0xa652fb,'sidebar':_0xe969ad,'icon':_0x28f535,'adminUrl':_0x3c4f8d,'agentUrl':_0x25d0ab,'scriptName':_0x323566,'scriptPath':_0xd8bd46,'version':_0x4228a3};removeReferences(_0x3f45d6,null);return db[_0x898d('0x34')][_0x898d('0x8d')](_0x901ee8)['then'](function(_0x8c5d60){var _0xdc42bd={'role':_0x207bf8[_0x898d('0x8e')][_0x898d('0x8f')],'userProfileId':_0x207bf8[_0x898d('0x8e')][_0x898d('0x90')]};if(!_0xdc42bd)throw new Error(_0x898d('0x91'));if(_0xdc42bd[_0x898d('0x8f')]===_0x898d('0x92')){var _0x272fcb=_0x8c5d60['get']({'plain':!![]});return db[_0x898d('0x93')]['find']({'where':{'name':_0x898d('0x2f'),'userProfileId':_0xdc42bd[_0x898d('0x90')]},'raw':!![]})[_0x898d('0x2d')](function(_0x5eda97){if(_0x5eda97&&_0x5eda97[_0x898d('0x94')]===0x0){return db[_0x898d('0x30')]['create']({'name':_0x272fcb[_0x898d('0x32')],'resourceId':_0x272fcb['id'],'type':_0x5eda97[_0x898d('0x32')],'sectionId':_0x5eda97['id']},{})[_0x898d('0x2d')](function(){return _0x8c5d60;});}else{return _0x8c5d60;}})[_0x898d('0x4e')](function(_0xd17946){logger[_0x898d('0x72')](_0x898d('0x95'),_0xd17946);throw _0xd17946;});}return _0x8c5d60;})[_0x898d('0x2d')](respondWithResult(_0x5741ae,null))[_0x898d('0x4e')](handleError(_0x5741ae,null));}});}catch(_0xd0e3f0){_0x5741ae[_0x898d('0x22')](0x1f4)[_0x898d('0x33')](_0xd0e3f0);}};function removeReferences(_0x54f698,_0x5d70dd){try{if(_0x54f698){fs[_0x898d('0x6a')](_0x54f698);logger[_0x898d('0x6b')]('Zip\x20archive\x20removed');}if(_0x5d70dd){rimraf(_0x5d70dd,function(){});logger[_0x898d('0x6b')](_0x898d('0x96'));}}catch(_0x3a3cf7){logger[_0x898d('0x72')](_0x3a3cf7);}}exports[_0x898d('0x2c')]=function(_0x46813d,_0x29e07a,_0x2b7998){return db[_0x898d('0x34')][_0x898d('0x97')]({'where':{'id':_0x46813d['params']['id']}})[_0x898d('0x2d')](handleEntityNotFound(_0x29e07a,null))[_0x898d('0x2d')](saveUpdates(_0x46813d[_0x898d('0x8e')],null))[_0x898d('0x2d')](respondWithResult(_0x29e07a,null))[_0x898d('0x4e')](handleError(_0x29e07a,null));};exports[_0x898d('0x98')]=function(_0x58fd21,_0x1e488b,_0xb4d6d4){return db[_0x898d('0x34')][_0x898d('0x97')]({'where':{'id':_0x58fd21[_0x898d('0x50')]['id']}})[_0x898d('0x2d')](function(_0x2d75ca){if(_0x2d75ca){return _0x2d75ca[_0x898d('0x2e')]();}})['then'](function(_0x300421){rimraf(path['join'](config[_0x898d('0x62')],_0x898d('0x54'),path['dirname'](_0x300421['path'])),function(){});return _0x300421;})[_0x898d('0x2d')](handleEntityNotFound(_0x1e488b,null))[_0x898d('0x2d')](respondWithStatusCode(_0x1e488b,null))[_0x898d('0x4e')](handleError(_0x1e488b,null));};exports['webhookGet']=function(_0xeabbe5,_0x214256,_0x19b6fb){return BPromise['resolve']()[_0x898d('0x2d')](function(){if(!_0xeabbe5[_0x898d('0x3a')][_0x898d('0x7')]){throw new Error(_0x898d('0x99'));}if(!_0xeabbe5[_0x898d('0x3a')]['port']){throw new Error(_0x898d('0x9a'));}var _0xe10947=_0xeabbe5[_0x898d('0x3a')]['hostname']?_0xeabbe5['query']['hostname']+':'+_0xeabbe5[_0x898d('0x3a')][_0x898d('0x9b')]:_0x898d('0x9c')+_0xeabbe5[_0x898d('0x3a')][_0x898d('0x9b')];var _0x3ffebf=_0xeabbe5[_0x898d('0x3a')][_0x898d('0x23')]?_0xeabbe5[_0x898d('0x3a')][_0x898d('0x23')]:!![];var _0x44b39f=_0xeabbe5[_0x898d('0x3a')][_0x898d('0x9d')]?_0xeabbe5['query'][_0x898d('0x9d')]:null;var _0x509130={'method':_0xeabbe5[_0x898d('0x9e')],'uri':util['format']('%s%s',_0xe10947,_0xeabbe5[_0x898d('0x3a')][_0x898d('0x7')]),'json':_0x3ffebf,'resolveWithFullResponse':!![],'encoding':_0x44b39f,'qs':_0xeabbe5['query']};if(_0xeabbe5[_0x898d('0x9f')]){_0x509130[_0x898d('0x9f')]=_0xeabbe5[_0x898d('0x9f')];if(_0x509130['headers'][_0x898d('0xa0')]){delete _0x509130[_0x898d('0x9f')][_0x898d('0xa0')];}}if(_0x509130['headers']['content-type']){delete _0x509130['headers'][_0x898d('0xa1')];}return rp(_0x509130);})['then'](function(_0x214457){if(_0x214457){_0x214256[_0x898d('0xa2')](_0x214457[_0x898d('0x9f')]);logger[_0x898d('0x6b')](_0x214457[_0x898d('0x8e')]);if(_[_0x898d('0xa3')](_0xeabbe5[_0x898d('0x3a')][_0x898d('0x7')],_0x898d('0x52'))&&_0x214457[_0x898d('0xa4')]==0x1f4){return _0x214256[_0x898d('0x31')](_0x214457[_0x898d('0xa4')]);}else{return _0x214256[_0x898d('0x22')](_0x214457[_0x898d('0xa4')])[_0x898d('0x33')](_0x214457[_0x898d('0x8e')]);}}else{return _0x214256['sendStatus'](0xc8);}})[_0x898d('0x4e')](handleError(_0x214256,null));};exports[_0x898d('0xa5')]=function(_0x14d5e6,_0x17b478,_0x5dbf67){return BPromise[_0x898d('0xa6')]()[_0x898d('0x2d')](function(){if(!_0x14d5e6[_0x898d('0x3a')][_0x898d('0x7')]){throw new Error(_0x898d('0x99'));}if(!_0x14d5e6[_0x898d('0x3a')][_0x898d('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2ff95b=_0x14d5e6[_0x898d('0x3a')][_0x898d('0xa7')]?_0x14d5e6['query'][_0x898d('0xa7')]+':'+_0x14d5e6[_0x898d('0x3a')]['port']:_0x898d('0x9c')+_0x14d5e6['query'][_0x898d('0x9b')];var _0x304eb6=_0x14d5e6[_0x898d('0x3a')]['json']?_0x14d5e6[_0x898d('0x3a')][_0x898d('0x23')]:!![];var _0x3ffb85=_0x14d5e6['query'][_0x898d('0x9d')]?_0x14d5e6['query'][_0x898d('0x9d')]:null;var _0x103b84={'method':_0x14d5e6[_0x898d('0x9e')],'uri':util['format'](_0x898d('0xa8'),_0x2ff95b,_0x14d5e6[_0x898d('0x3a')][_0x898d('0x7')]),'json':_0x304eb6,'resolveWithFullResponse':!![],'encoding':_0x3ffb85,'body':_0x14d5e6[_0x898d('0x8e')]};if(_0x14d5e6['headers']){_0x103b84[_0x898d('0x9f')]=_0x14d5e6[_0x898d('0x9f')];if(_0x103b84[_0x898d('0x9f')][_0x898d('0xa0')]){delete _0x103b84[_0x898d('0x9f')][_0x898d('0xa0')];}}if(_0x103b84[_0x898d('0x9f')][_0x898d('0xa1')]){delete _0x103b84[_0x898d('0x9f')][_0x898d('0xa1')];}return rp(_0x103b84);})[_0x898d('0x2d')](function(_0x479b51){if(_0x479b51){_0x17b478['set'](_0x479b51[_0x898d('0x9f')]);logger[_0x898d('0x6b')](_0x479b51[_0x898d('0x8e')]);return _0x17b478[_0x898d('0x22')](_0x479b51[_0x898d('0xa4')])[_0x898d('0x33')](_0x479b51['body']);}else{return _0x17b478[_0x898d('0x31')](0xc8);}})['catch'](handleError(_0x17b478,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 7321e2f..b0c06ed 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 _0xe5af=['emit','exports','../../mysqldb','Plugin','save','update','remove'];(function(_0x5d72e7,_0xd5bd59){var _0x40dd45=function(_0x11c3e0){while(--_0x11c3e0){_0x5d72e7['push'](_0x5d72e7['shift']());}};_0x40dd45(++_0xd5bd59);}(_0xe5af,0x9c));var _0xfe5a=function(_0x132805,_0x2730d5){_0x132805=_0x132805-0x0;var _0x1d2244=_0xe5af[_0x132805];return _0x1d2244;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xfe5a('0x0'))['db'][_0xfe5a('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe5a('0x2'),'afterUpdate':_0xfe5a('0x3'),'afterDestroy':_0xfe5a('0x4')};function emitEvent(_0x4adbd1){return function(_0x1165e3,_0x48e3a7,_0x526677){PluginEvents[_0xfe5a('0x5')](_0x4adbd1+':'+_0x1165e3['id'],_0x1165e3);PluginEvents[_0xfe5a('0x5')](_0x4adbd1,_0x1165e3);_0x526677(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xfe5a('0x6')]=PluginEvents; \ No newline at end of file +var _0x9f0e=['Plugin','setMaxListeners','save','emit','hook','exports','events','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f0e,0x116));var _0xe9f0=function(_0x5c681d,_0x770ee7){_0x5c681d=_0x5c681d-0x0;var _0x1d5172=_0x9f0e[_0x5c681d];return _0x1d5172;};'use strict';var EventEmitter=require(_0xe9f0('0x0'));var Plugin=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xe9f0('0x3')](0x0);var events={'afterCreate':_0xe9f0('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2325c6){return function(_0x150a03,_0x3c589d,_0x202d69){PluginEvents[_0xe9f0('0x5')](_0x2325c6+':'+_0x150a03['id'],_0x150a03);PluginEvents['emit'](_0x2325c6,_0x150a03);_0x202d69(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xe9f0('0x6')](e,emitEvent(event));}}module[_0xe9f0('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index ca774d3..cc5d73c 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 _0x8958=['define','Plugin','plugins','util','request-promise','rimraf','../../config/environment','./plugin.attributes'];(function(_0x49e009,_0x556554){var _0x670ec0=function(_0x4b1103){while(--_0x4b1103){_0x49e009['push'](_0x49e009['shift']());}};_0x670ec0(++_0x556554);}(_0x8958,0x93));var _0x8895=function(_0x5b7b8e,_0x25e8b5){_0x5b7b8e=_0x5b7b8e-0x0;var _0x179029=_0x8958[_0x5b7b8e];return _0x179029;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));module['exports']=function(_0x22fa52,_0x2f03ad){return _0x22fa52[_0x8895('0x5')](_0x8895('0x6'),attributes,{'tableName':_0x8895('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d17=['define','plugins','lodash','util','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x3b441e,_0x15a2a2){var _0x36e9a6=function(_0x3e860d){while(--_0x3e860d){_0x3b441e['push'](_0x3b441e['shift']());}};_0x36e9a6(++_0x15a2a2);}(_0x2d17,0x17e));var _0x72d1=function(_0x123a1f,_0x4c1c29){_0x123a1f=_0x123a1f-0x0;var _0x175776=_0x2d17[_0x123a1f];return _0x175776;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var logger=require('../../config/logger')(_0x72d1('0x2'));var moment=require(_0x72d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d1('0x4'));var fs=require('fs');var path=require(_0x72d1('0x5'));var rimraf=require('rimraf');var config=require(_0x72d1('0x6'));var attributes=require('./plugin.attributes');module[_0x72d1('0x7')]=function(_0x50f551,_0x139ba0){return _0x50f551[_0x72d1('0x8')]('Plugin',attributes,{'tableName':_0x72d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index f713b2c..12a31e8 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 _0x5802=['error','code','message','result','CreatePlugin','Plugin','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x57b8f1,_0x596c03){var _0x326cfc=function(_0x35bced){while(--_0x35bced){_0x57b8f1['push'](_0x57b8f1['shift']());}};_0x326cfc(++_0x596c03);}(_0x5802,0xaf));var _0x2580=function(_0x18032f,_0x4f4e45){_0x18032f=_0x18032f-0x0;var _0xb0b2b8=_0x5802[_0x18032f];return _0xb0b2b8;};'use strict';var _=require(_0x2580('0x0'));var util=require(_0x2580('0x1'));var moment=require(_0x2580('0x2'));var BPromise=require(_0x2580('0x3'));var rs=require(_0x2580('0x4'));var fs=require('fs');var Redis=require(_0x2580('0x5'));var db=require(_0x2580('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2580('0x7'));var jayson=require(_0x2580('0x8'));var client=jayson[_0x2580('0x9')][_0x2580('0xa')]({'port':0x232a});config[_0x2580('0xb')]=_['defaults'](config[_0x2580('0xb')],{'host':_0x2580('0xc'),'port':0x18eb});var socket=require(_0x2580('0xd'))(new Redis(config[_0x2580('0xb')]));require(_0x2580('0xe'))[_0x2580('0xf')](socket);function respondWithRpcPromise(_0x21f6a8,_0x4cadac,_0x2629d8){return new BPromise(function(_0x30302c,_0x1d6e74){return client[_0x2580('0x10')](_0x21f6a8,_0x2629d8)[_0x2580('0x11')](function(_0x4475b1){logger[_0x2580('0x12')](_0x2580('0x13'),_0x4cadac,_0x2580('0x14'));logger['debug'](_0x2580('0x15'),_0x4cadac,'request\x20sent',JSON[_0x2580('0x16')](_0x4475b1));if(_0x4475b1[_0x2580('0x17')]){if(_0x4475b1[_0x2580('0x17')][_0x2580('0x18')]===0x1f4){logger[_0x2580('0x17')](_0x2580('0x13'),_0x4cadac,_0x4475b1[_0x2580('0x17')][_0x2580('0x19')]);return _0x1d6e74(_0x4475b1['error']['message']);}logger[_0x2580('0x17')](_0x2580('0x13'),_0x4cadac,_0x4475b1[_0x2580('0x17')]['message']);return _0x30302c(_0x4475b1[_0x2580('0x17')][_0x2580('0x19')]);}else{logger[_0x2580('0x12')](_0x2580('0x13'),_0x4cadac,_0x2580('0x14'));_0x30302c(_0x4475b1[_0x2580('0x1a')]['message']);}})['catch'](function(_0x2d86e2){logger['error'](_0x2580('0x13'),_0x4cadac,_0x2d86e2);_0x1d6e74(_0x2d86e2);});});}exports[_0x2580('0x1b')]=function(_0x45346a){var _0x42fee5=this;return new Promise(function(_0x4be8a7,_0x38f4e9){return db[_0x2580('0x1c')]['create'](_0x45346a['body'],{'raw':_0x45346a['options']?_0x45346a[_0x2580('0x1d')][_0x2580('0x1e')]===undefined?!![]:![]:!![]})[_0x2580('0x11')](function(_0x1630d0){logger[_0x2580('0x12')](_0x2580('0x1b'),_0x45346a);logger[_0x2580('0x1f')]('CreatePlugin',_0x45346a,JSON['stringify'](_0x1630d0));_0x4be8a7(_0x1630d0);})[_0x2580('0x20')](function(_0x434703){logger[_0x2580('0x17')](_0x2580('0x1b'),_0x434703[_0x2580('0x19')],_0x45346a);_0x38f4e9(_0x42fee5[_0x2580('0x17')](0x1f4,_0x434703[_0x2580('0x19')]));});});}; \ No newline at end of file +var _0xb30d=['socket.io-emitter','./plugin.socket','register','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','Plugin,\x20%s,\x20%s','message','catch','CreatePlugin','create','body','options','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost'];(function(_0x2b6c01,_0x4a1d39){var _0x4c051e=function(_0x3ef1ee){while(--_0x3ef1ee){_0x2b6c01['push'](_0x2b6c01['shift']());}};_0x4c051e(++_0x4a1d39);}(_0xb30d,0x120));var _0xdb30=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0xb30d[_0x382c73];return _0x1dd0bf;};'use strict';var _=require(_0xdb30('0x0'));var util=require(_0xdb30('0x1'));var moment=require(_0xdb30('0x2'));var BPromise=require(_0xdb30('0x3'));var rs=require(_0xdb30('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb30('0x5'));var logger=require(_0xdb30('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdb30('0x7'));var client=jayson['client'][_0xdb30('0x8')]({'port':0x232a});config['redis']=_[_0xdb30('0x9')](config[_0xdb30('0xa')],{'host':_0xdb30('0xb'),'port':0x18eb});var socket=require(_0xdb30('0xc'))(new Redis(config['redis']));require(_0xdb30('0xd'))[_0xdb30('0xe')](socket);function respondWithRpcPromise(_0x3948cc,_0x4e5e1b,_0x45f04e){return new BPromise(function(_0x2d093a,_0x37ebb6){return client[_0xdb30('0xf')](_0x3948cc,_0x45f04e)[_0xdb30('0x10')](function(_0x2e2826){logger[_0xdb30('0x11')]('Plugin,\x20%s,\x20%s',_0x4e5e1b,_0xdb30('0x12'));logger[_0xdb30('0x13')](_0xdb30('0x14'),_0x4e5e1b,_0xdb30('0x12'),JSON[_0xdb30('0x15')](_0x2e2826));if(_0x2e2826[_0xdb30('0x16')]){if(_0x2e2826[_0xdb30('0x16')]['code']===0x1f4){logger[_0xdb30('0x16')](_0xdb30('0x17'),_0x4e5e1b,_0x2e2826['error'][_0xdb30('0x18')]);return _0x37ebb6(_0x2e2826[_0xdb30('0x16')][_0xdb30('0x18')]);}logger[_0xdb30('0x16')](_0xdb30('0x17'),_0x4e5e1b,_0x2e2826[_0xdb30('0x16')][_0xdb30('0x18')]);return _0x2d093a(_0x2e2826[_0xdb30('0x16')][_0xdb30('0x18')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x4e5e1b,_0xdb30('0x12'));_0x2d093a(_0x2e2826['result'][_0xdb30('0x18')]);}})[_0xdb30('0x19')](function(_0x5879dd){logger[_0xdb30('0x16')](_0xdb30('0x17'),_0x4e5e1b,_0x5879dd);_0x37ebb6(_0x5879dd);});});}exports[_0xdb30('0x1a')]=function(_0xc95720){var _0x36fc81=this;return new Promise(function(_0x221538,_0x8406f6){return db['Plugin'][_0xdb30('0x1b')](_0xc95720[_0xdb30('0x1c')],{'raw':_0xc95720[_0xdb30('0x1d')]?_0xc95720['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4cebad){logger[_0xdb30('0x11')](_0xdb30('0x1a'),_0xc95720);logger['debug'](_0xdb30('0x1a'),_0xc95720,JSON['stringify'](_0x4cebad));_0x221538(_0x4cebad);})['catch'](function(_0x3a4a02){logger[_0xdb30('0x16')](_0xdb30('0x1a'),_0x3a4a02[_0xdb30('0x18')],_0xc95720);_0x8406f6(_0x36fc81[_0xdb30('0x16')](0x1f4,_0x3a4a02[_0xdb30('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 1938b25..9b0a8ab 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 _0x27de=['./plugin.events','save','update','emit','removeListener','plugin:'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x27de,0x1b0));var _0xe27d=function(_0x5d985f,_0x24ab93){_0x5d985f=_0x5d985f-0x0;var _0x4d015f=_0x27de[_0x5d985f];return _0x4d015f;};'use strict';var PluginEvents=require(_0xe27d('0x0'));var events=[_0xe27d('0x1'),'remove',_0xe27d('0x2')];function createListener(_0x555d04,_0x26e547){return function(_0x5b53e0){_0x26e547[_0xe27d('0x3')](_0x555d04,_0x5b53e0);};}function removeListener(_0x57b624,_0x5310c7){return function(){PluginEvents[_0xe27d('0x4')](_0x57b624,_0x5310c7);};}exports['register']=function(_0x3dfa8a){for(var _0x471ffc=0x0,_0x2efb72=events['length'];_0x471ffc<_0x2efb72;_0x471ffc++){var _0x373ae8=events[_0x471ffc];var _0x17f10d=createListener(_0xe27d('0x5')+_0x373ae8,_0x3dfa8a);PluginEvents['on'](_0x373ae8,_0x17f10d);}}; \ No newline at end of file +var _0x6a95=['register','length','plugin:','./plugin.events','save','remove','update','removeListener'];(function(_0x3ce6c1,_0x3ab7a7){var _0xecc97d=function(_0x4d06d7){while(--_0x4d06d7){_0x3ce6c1['push'](_0x3ce6c1['shift']());}};_0xecc97d(++_0x3ab7a7);}(_0x6a95,0x1db));var _0x56a9=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x6a95[_0x3054be];return _0x3df150;};'use strict';var PluginEvents=require(_0x56a9('0x0'));var events=[_0x56a9('0x1'),_0x56a9('0x2'),_0x56a9('0x3')];function createListener(_0x36f87a,_0x26e006){return function(_0x235917){_0x26e006['emit'](_0x36f87a,_0x235917);};}function removeListener(_0x512f52,_0x12cd60){return function(){PluginEvents[_0x56a9('0x4')](_0x512f52,_0x12cd60);};}exports[_0x56a9('0x5')]=function(_0x2eb132){for(var _0x3c15b6=0x0,_0x365093=events[_0x56a9('0x6')];_0x3c15b6<_0x365093;_0x3c15b6++){var _0x5d3e80=events[_0x3c15b6];var _0x5f0dcb=createListener(_0x56a9('0x7')+_0x5d3e80,_0x2eb132);PluginEvents['on'](_0x5d3e80,_0x5f0dcb);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 432f721..c55c42f 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 _0x9143=['destroy','express','Router','isAuthenticated','get','show','create','put','/:id','update','delete'];(function(_0x130be6,_0x4cd19a){var _0x534efa=function(_0x1e99f0){while(--_0x1e99f0){_0x130be6['push'](_0x130be6['shift']());}};_0x534efa(++_0x4cd19a);}(_0x9143,0x1c4));var _0x3914=function(_0xf1d18c,_0x17bc84){_0xf1d18c=_0xf1d18c-0x0;var _0x5042bf=_0x9143[_0xf1d18c];return _0x5042bf;};'use strict';var express=require(_0x3914('0x0'));var router=express[_0x3914('0x1')]();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router['get']('/',auth[_0x3914('0x2')](),controller['index']);router[_0x3914('0x3')]('/:id',auth[_0x3914('0x2')](),controller[_0x3914('0x4')]);router['post']('/',auth[_0x3914('0x2')](),controller[_0x3914('0x5')]);router[_0x3914('0x6')](_0x3914('0x7'),auth['isAuthenticated'](),controller[_0x3914('0x8')]);router[_0x3914('0x9')](_0x3914('0x7'),auth[_0x3914('0x2')](),controller[_0x3914('0xa')]);module['exports']=router; \ No newline at end of file +var _0x25a8=['exports','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy'];(function(_0x3331a8,_0x16c323){var _0x18cce7=function(_0x22c7bf){while(--_0x22c7bf){_0x3331a8['push'](_0x3331a8['shift']());}};_0x18cce7(++_0x16c323);}(_0x25a8,0x189));var _0x825a=function(_0x6219f4,_0x267703){_0x6219f4=_0x6219f4-0x0;var _0x3da434=_0x25a8[_0x6219f4];return _0x3da434;};'use strict';var express=require(_0x825a('0x0'));var router=express[_0x825a('0x1')]();var auth=require(_0x825a('0x2'));var controller=require(_0x825a('0x3'));router[_0x825a('0x4')]('/',auth[_0x825a('0x5')](),controller['index']);router[_0x825a('0x4')](_0x825a('0x6'),auth['isAuthenticated'](),controller[_0x825a('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x825a('0x8')]);router[_0x825a('0x9')](_0x825a('0x6'),auth[_0x825a('0x5')](),controller[_0x825a('0xa')]);router[_0x825a('0xb')](_0x825a('0x6'),auth[_0x825a('0x5')](),controller[_0x825a('0xc')]);module[_0x825a('0xd')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 00bf318..a252a4c 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 _0xc644=['length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then'];(function(_0x3aeee3,_0x7d1c0d){var _0x258db8=function(_0x16991e){while(--_0x16991e){_0x3aeee3['push'](_0x3aeee3['shift']());}};_0x258db8(++_0x7d1c0d);}(_0xc644,0x65));var _0x4c64=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0xc644[_0x4709c8];return _0x478cdd;};'use strict';var _=require(_0x4c64('0x0'));var pm2=require(_0x4c64('0x1'));var logger=require(_0x4c64('0x2'))(_0x4c64('0x3'));var path=require(_0x4c64('0x4'));var exec=require(_0x4c64('0x5'))[_0x4c64('0x6')];var BPromise=require('bluebird');function handleEntityNotFound(_0x4ed823,_0x271197){return function(_0x4b209c){if(!_0x4b209c){_0x4ed823[_0x4c64('0x7')](0x194);;}return _0x4b209c;};}function respondWithResult(_0x49fd09,_0x388f47){_0x388f47=_0x388f47||0xc8;return function(_0xb70c13){if(_0xb70c13){return _0x49fd09[_0x4c64('0x8')](_0x388f47)[_0x4c64('0x9')](_0xb70c13);}return null;};}function handleError(_0x3fc66a,_0x1abae3){_0x1abae3=_0x1abae3||0x1f4;return function(_0xf301d3){logger[_0x4c64('0xa')](_0xf301d3[_0x4c64('0xb')]);if(_0xf301d3['name']){delete _0xf301d3[_0x4c64('0xc')];}_0x3fc66a[_0x4c64('0x8')](_0x1abae3)[_0x4c64('0xd')](_0xf301d3);};}function execChildProcess(){return new BPromise(function(_0x50146d,_0x265c87){exec(_0x4c64('0xe'),function(_0x1236cb,_0x5875d1,_0x555a77){logger[_0x4c64('0xf')](_0x5875d1);logger[_0x4c64('0xf')](_0x555a77);if(_0x1236cb){logger['error'](_0x1236cb);return _0x265c87(_0x1236cb);}return _0x50146d(_0x5875d1);});});}exports[_0x4c64('0x10')]=function(_0x3ca383,_0x134d28){return pm2[_0x4c64('0x11')]()[_0x4c64('0x12')](function(_0x2d5a30){if(_0x2d5a30){var _0x343800=_['reject'](_0x2d5a30,function(_0x5532d0){return _0x5532d0['name']==='express'||_0x5532d0[_0x4c64('0xc')]==='motion2';});return{'rows':_0x343800,'count':_0x343800[_0x4c64('0x13')]};}return null;})[_0x4c64('0x12')](respondWithResult(_0x134d28,null))[_0x4c64('0x14')](handleError(_0x134d28,null));};exports[_0x4c64('0x15')]=function(_0xbcbae3,_0x1e8388){return pm2[_0x4c64('0x16')](_0xbcbae3[_0x4c64('0x17')]['id'])[_0x4c64('0x12')](respondWithResult(_0x1e8388,null))[_0x4c64('0x12')](handleEntityNotFound(_0x1e8388,null))[_0x4c64('0x14')](handleError(_0x1e8388,null));};exports[_0x4c64('0x18')]=function(_0x258be7,_0x228853){if(_0x258be7['body'][_0x4c64('0xc')]&&_0x258be7[_0x4c64('0x19')][_0x4c64('0x1a')]){var _0x4a688a=path[_0x4c64('0x1b')](__dirname,_0x4c64('0x1c'),_0x258be7[_0x4c64('0x19')]['script']);var _0x3903fd=process[_0x4c64('0x1d')]();process[_0x4c64('0x1e')](path[_0x4c64('0x1f')](_0x4a688a));return execChildProcess()[_0x4c64('0x12')](function(_0x1ebbcc){process['chdir'](_0x3903fd);return pm2['start']({'name':_0x258be7['body'][_0x4c64('0xc')],'script':_0x4a688a});})[_0x4c64('0x12')](function(_0x15c16b){pm2[_0x4c64('0x20')]();return _0x15c16b[0x0];})[_0x4c64('0x12')](respondWithResult(_0x228853,0xc9))[_0x4c64('0x14')](handleError(_0x228853,null));}else{return _0x228853[_0x4c64('0x8')](0x1f4)[_0x4c64('0xd')]({'message':_0x4c64('0x21')});}};exports[_0x4c64('0x22')]=function(_0xf2c3d6,_0x2e6567){if(_0xf2c3d6['body']['id']){delete _0xf2c3d6[_0x4c64('0x19')]['id'];}var _0x4cecd5={'online':_0x4c64('0x23'),'stopped':_0x4c64('0x24')};if(_0x4cecd5[_0x4c64('0x25')](_0xf2c3d6[_0x4c64('0x19')]['status'])){return pm2[_0x4cecd5[_0xf2c3d6[_0x4c64('0x19')][_0x4c64('0x8')]]](_0xf2c3d6[_0x4c64('0x17')]['id'])[_0x4c64('0x12')](respondWithResult(_0x2e6567,0xc8))[_0x4c64('0x14')](handleError(_0x2e6567,null));}else{return _0x2e6567[_0x4c64('0x8')](0x1f4)[_0x4c64('0xd')]({'message':'Unknown\x20status'});}};exports[_0x4c64('0x26')]=function(_0x4a9b4b,_0x5404b8){if(_0x4a9b4b['body']['id']){delete _0x4a9b4b[_0x4c64('0x19')]['id'];}if(_0x4a9b4b[_0x4c64('0x17')]['id']){return pm2['delete'](_0x4a9b4b[_0x4c64('0x17')]['id'])['then'](function(_0x53eef1){pm2[_0x4c64('0x20')]();return _0x53eef1[0x0];})[_0x4c64('0x12')](respondWithResult(_0x5404b8,null))['catch'](handleError(_0x5404b8,null));}else{return _0x5404b8['status'](0x1f4)[_0x4c64('0xd')]({'message':_0x4c64('0x27')});}}; \ No newline at end of file +var _0x32d6=['delete','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','sendStatus','status','json','name','send','npm\x20install','info','index','reject','express','motion2','then','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','hasOwnProperty'];(function(_0x4611b0,_0xcf69f1){var _0x1c4a23=function(_0x1478db){while(--_0x1478db){_0x4611b0['push'](_0x4611b0['shift']());}};_0x1c4a23(++_0xcf69f1);}(_0x32d6,0x1d6));var _0x632d=function(_0x46c0c2,_0x18ee19){_0x46c0c2=_0x46c0c2-0x0;var _0x3aae24=_0x32d6[_0x46c0c2];return _0x3aae24;};'use strict';var _=require(_0x632d('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x632d('0x1'))(_0x632d('0x2'));var path=require(_0x632d('0x3'));var exec=require(_0x632d('0x4'))[_0x632d('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x2ffc01,_0x469ba4){return function(_0x1b4eac){if(!_0x1b4eac){_0x2ffc01[_0x632d('0x6')](0x194);;}return _0x1b4eac;};}function respondWithResult(_0x2bb8c5,_0x39b792){_0x39b792=_0x39b792||0xc8;return function(_0x41bd0b){if(_0x41bd0b){return _0x2bb8c5[_0x632d('0x7')](_0x39b792)[_0x632d('0x8')](_0x41bd0b);}return null;};}function handleError(_0x15560e,_0x240303){_0x240303=_0x240303||0x1f4;return function(_0x2ee858){logger['error'](_0x2ee858['stack']);if(_0x2ee858[_0x632d('0x9')]){delete _0x2ee858[_0x632d('0x9')];}_0x15560e[_0x632d('0x7')](_0x240303)[_0x632d('0xa')](_0x2ee858);};}function execChildProcess(){return new BPromise(function(_0x1bb342,_0x3244c8){exec(_0x632d('0xb'),function(_0x36ee25,_0x552f84,_0x5aa73b){logger[_0x632d('0xc')](_0x552f84);logger[_0x632d('0xc')](_0x5aa73b);if(_0x36ee25){logger['error'](_0x36ee25);return _0x3244c8(_0x36ee25);}return _0x1bb342(_0x552f84);});});}exports[_0x632d('0xd')]=function(_0x28c79b,_0x4d2229){return pm2['list']()['then'](function(_0x5c40f4){if(_0x5c40f4){var _0x30d1a5=_[_0x632d('0xe')](_0x5c40f4,function(_0x1fc3ba){return _0x1fc3ba[_0x632d('0x9')]===_0x632d('0xf')||_0x1fc3ba[_0x632d('0x9')]===_0x632d('0x10');});return{'rows':_0x30d1a5,'count':_0x30d1a5['length']};}return null;})[_0x632d('0x11')](respondWithResult(_0x4d2229,null))[_0x632d('0x12')](handleError(_0x4d2229,null));};exports[_0x632d('0x13')]=function(_0x874f11,_0xb439c){return pm2[_0x632d('0x14')](_0x874f11[_0x632d('0x15')]['id'])[_0x632d('0x11')](respondWithResult(_0xb439c,null))[_0x632d('0x11')](handleEntityNotFound(_0xb439c,null))['catch'](handleError(_0xb439c,null));};exports['create']=function(_0xb8e6c7,_0x2e70dd){if(_0xb8e6c7[_0x632d('0x16')]['name']&&_0xb8e6c7['body'][_0x632d('0x17')]){var _0x17935d=path[_0x632d('0x18')](__dirname,_0x632d('0x19'),_0xb8e6c7[_0x632d('0x16')][_0x632d('0x17')]);var _0x5a60a8=process[_0x632d('0x1a')]();process[_0x632d('0x1b')](path[_0x632d('0x1c')](_0x17935d));return execChildProcess()['then'](function(_0x1d3053){process[_0x632d('0x1b')](_0x5a60a8);return pm2[_0x632d('0x1d')]({'name':_0xb8e6c7[_0x632d('0x16')]['name'],'script':_0x17935d});})['then'](function(_0x4d4fda){pm2[_0x632d('0x1e')]();return _0x4d4fda[0x0];})[_0x632d('0x11')](respondWithResult(_0x2e70dd,0xc9))[_0x632d('0x12')](handleError(_0x2e70dd,null));}else{return _0x2e70dd[_0x632d('0x7')](0x1f4)[_0x632d('0xa')]({'message':_0x632d('0x1f')});}};exports[_0x632d('0x20')]=function(_0x13e6b7,_0x321c5b){if(_0x13e6b7[_0x632d('0x16')]['id']){delete _0x13e6b7['body']['id'];}var _0x30dd31={'online':'restart','stopped':'stop'};if(_0x30dd31[_0x632d('0x21')](_0x13e6b7[_0x632d('0x16')]['status'])){return pm2[_0x30dd31[_0x13e6b7['body']['status']]](_0x13e6b7[_0x632d('0x15')]['id'])[_0x632d('0x11')](respondWithResult(_0x321c5b,0xc8))[_0x632d('0x12')](handleError(_0x321c5b,null));}else{return _0x321c5b[_0x632d('0x7')](0x1f4)[_0x632d('0xa')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x214996,_0x441e05){if(_0x214996[_0x632d('0x16')]['id']){delete _0x214996['body']['id'];}if(_0x214996[_0x632d('0x15')]['id']){return pm2[_0x632d('0x22')](_0x214996[_0x632d('0x15')]['id'])['then'](function(_0x1dc612){pm2[_0x632d('0x1e')]();return _0x1dc612[0x0];})['then'](respondWithResult(_0x441e05,null))['catch'](handleError(_0x441e05,null));}else{return _0x441e05['status'](0x1f4)['send']({'message':_0x632d('0x23')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 0656810..731b537 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 _0x6f54=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x20073b,_0x9c031e){var _0x428d14=function(_0x1c6d8b){while(--_0x1c6d8b){_0x20073b['push'](_0x20073b['shift']());}};_0x428d14(++_0x9c031e);}(_0x6f54,0xcf));var _0x46f5=function(_0x524b05,_0x445801){_0x524b05=_0x524b05-0x0;var _0x440764=_0x6f54[_0x524b05];return _0x440764;};'use strict';var multer=require(_0x46f5('0x0'));var util=require(_0x46f5('0x1'));var path=require(_0x46f5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x46f5('0x3')]();var fs_extra=require(_0x46f5('0x4'));var auth=require(_0x46f5('0x5'));var interaction=require(_0x46f5('0x6'));var config=require('../../config/environment');module[_0x46f5('0x7')]=router; \ No newline at end of file +var _0x7a52=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router'];(function(_0x536cc6,_0xaa7609){var _0x5c2dd7=function(_0x16215a){while(--_0x16215a){_0x536cc6['push'](_0x536cc6['shift']());}};_0x5c2dd7(++_0xaa7609);}(_0x7a52,0x1bd));var _0x27a5=function(_0x1465d0,_0x359b82){_0x1465d0=_0x1465d0-0x0;var _0x54850c=_0x7a52[_0x1465d0];return _0x54850c;};'use strict';var multer=require(_0x27a5('0x0'));var util=require('util');var path=require(_0x27a5('0x1'));var timeout=require(_0x27a5('0x2'));var express=require(_0x27a5('0x3'));var router=express[_0x27a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x27a5('0x5'));var interaction=require(_0x27a5('0x6'));var config=require(_0x27a5('0x7'));module[_0x27a5('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 0dc643d..d6131ac 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 _0xd32a=['STRING','DATE','INTEGER'];(function(_0x3bf4c3,_0x336610){var _0x434205=function(_0x1e5bac){while(--_0x1e5bac){_0x3bf4c3['push'](_0x3bf4c3['shift']());}};_0x434205(++_0x336610);}(_0xd32a,0xd4));var _0xad32=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xd32a[_0xe73080];return _0x12cbc4;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xad32('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xad32('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xad32('0x1')]},'starttime':{'type':Sequelize[_0xad32('0x2')]},'responsetime':{'type':Sequelize[_0xad32('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xad32('0x1')]},'campaigntype':{'type':Sequelize[_0xad32('0x1')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf5d8=['sequelize','INTEGER','STRING','DATE'];(function(_0x4b2981,_0x321db0){var _0x1ee2ab=function(_0x5c8169){while(--_0x5c8169){_0x4b2981['push'](_0x4b2981['shift']());}};_0x1ee2ab(++_0x321db0);}(_0xf5d8,0xfc));var _0x8f5d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf5d8[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x8f5d('0x0'));module['exports']={'state':{'type':Sequelize[_0x8f5d('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8f5d('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x8f5d('0x2')]},'starttime':{'type':Sequelize[_0x8f5d('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x8f5d('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8f5d('0x2')]},'membername':{'type':Sequelize[_0x8f5d('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0365cf0..1698cd1 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 _0x220f=['./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','util','api','bluebird','request-promise'];(function(_0x16f4bd,_0x3b10d7){var _0x3ac865=function(_0x2cdafc){while(--_0x2cdafc){_0x16f4bd['push'](_0x16f4bd['shift']());}};_0x3ac865(++_0x3b10d7);}(_0x220f,0x1c4));var _0xf220=function(_0x15bb39,_0x4d521c){_0x15bb39=_0x15bb39-0x0;var _0x18d2e4=_0x220f[_0x15bb39];return _0x18d2e4;};'use strict';var _=require('lodash');var util=require(_0xf220('0x0'));var logger=require('../../config/logger')(_0xf220('0x1'));var moment=require('moment');var BPromise=require(_0xf220('0x2'));var rp=require(_0xf220('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf220('0x4'));module['exports']=function(_0x579c02,_0x5493bb){return _0x579c02[_0xf220('0x5')](_0xf220('0x6'),attributes,{'tableName':_0xf220('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3d6=['bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment'];(function(_0xc864b2,_0x12662c){var _0x27bcb2=function(_0x3a4fae){while(--_0x3a4fae){_0xc864b2['push'](_0xc864b2['shift']());}};_0x27bcb2(++_0x12662c);}(_0xd3d6,0x79));var _0x6d3d=function(_0x36a7bf,_0x14cf09){_0x36a7bf=_0x36a7bf-0x0;var _0x33a6b6=_0xd3d6[_0x36a7bf];return _0x33a6b6;};'use strict';var _=require(_0x6d3d('0x0'));var util=require(_0x6d3d('0x1'));var logger=require(_0x6d3d('0x2'))(_0x6d3d('0x3'));var moment=require(_0x6d3d('0x4'));var BPromise=require(_0x6d3d('0x5'));var rp=require(_0x6d3d('0x6'));var fs=require('fs');var path=require(_0x6d3d('0x7'));var rimraf=require(_0x6d3d('0x8'));var config=require(_0x6d3d('0x9'));var attributes=require(_0x6d3d('0xa'));module[_0x6d3d('0xb')]=function(_0x2b6a9c,_0x54beea){return _0x2b6a9c['define'](_0x6d3d('0xc'),attributes,{'tableName':_0x6d3d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 1b8c9cd..5ebb941 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 _0xa151=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','result','CreateReportAgentPreview','create','options','raw','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dfec1,_0x412e3a){var _0x27c79f=function(_0xae9aec){while(--_0xae9aec){_0x3dfec1['push'](_0x3dfec1['shift']());}};_0x27c79f(++_0x412e3a);}(_0xa151,0x19f));var _0x1a15=function(_0x30e8f6,_0x4438d1){_0x30e8f6=_0x30e8f6-0x0;var _0x26a6be=_0xa151[_0x30e8f6];return _0x26a6be;};'use strict';var _=require(_0x1a15('0x0'));var util=require(_0x1a15('0x1'));var moment=require(_0x1a15('0x2'));var BPromise=require(_0x1a15('0x3'));var rs=require(_0x1a15('0x4'));var fs=require('fs');var Redis=require(_0x1a15('0x5'));var db=require(_0x1a15('0x6'))['db'];var utils=require(_0x1a15('0x7'));var logger=require('../../config/logger')(_0x1a15('0x8'));var config=require(_0x1a15('0x9'));var jayson=require(_0x1a15('0xa'));var client=jayson['client'][_0x1a15('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a9836,_0x569633,_0x1dbf52){return new BPromise(function(_0x3ce080,_0x5a9783){return client[_0x1a15('0xc')](_0x4a9836,_0x1dbf52)['then'](function(_0x41e456){logger[_0x1a15('0xd')](_0x1a15('0xe'),_0x569633,_0x1a15('0xf'));logger[_0x1a15('0x10')](_0x1a15('0x11'),_0x569633,_0x1a15('0xf'),JSON['stringify'](_0x41e456));if(_0x41e456[_0x1a15('0x12')]){if(_0x41e456['error']['code']===0x1f4){logger['error'](_0x1a15('0xe'),_0x569633,_0x41e456['error'][_0x1a15('0x13')]);return _0x5a9783(_0x41e456[_0x1a15('0x12')][_0x1a15('0x13')]);}logger[_0x1a15('0x12')](_0x1a15('0xe'),_0x569633,_0x41e456[_0x1a15('0x12')][_0x1a15('0x13')]);return _0x3ce080(_0x41e456[_0x1a15('0x12')][_0x1a15('0x13')]);}else{logger['info'](_0x1a15('0xe'),_0x569633,_0x1a15('0xf'));_0x3ce080(_0x41e456[_0x1a15('0x14')]['message']);}})['catch'](function(_0x230faa){logger[_0x1a15('0x12')](_0x1a15('0xe'),_0x569633,_0x230faa);_0x5a9783(_0x230faa);});});}exports[_0x1a15('0x15')]=function(_0x1ffa47){var _0x257e6c=this;return new Promise(function(_0x592632,_0x44f014){return db['ReportAgentPreview'][_0x1a15('0x16')](_0x1ffa47['body'],{'raw':_0x1ffa47[_0x1a15('0x17')]?_0x1ffa47[_0x1a15('0x17')][_0x1a15('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3f8762){logger[_0x1a15('0xd')](_0x1a15('0x15'),_0x1ffa47);logger[_0x1a15('0x10')](_0x1a15('0x15'),_0x1ffa47,JSON[_0x1a15('0x19')](_0x3f8762));_0x592632(_0x3f8762);})[_0x1a15('0x1a')](function(_0x2b1748){logger['error']('CreateReportAgentPreview',_0x2b1748[_0x1a15('0x13')],_0x1ffa47);_0x44f014(_0x257e6c['error'](0x1f4,_0x2b1748[_0x1a15('0x13')]));});});}; \ No newline at end of file +var _0x9a8f=['options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','create','body'];(function(_0x29536b,_0x3c950a){var _0x535773=function(_0x1246dc){while(--_0x1246dc){_0x29536b['push'](_0x29536b['shift']());}};_0x535773(++_0x3c950a);}(_0x9a8f,0x9e));var _0xf9a8=function(_0x16142f,_0x481283){_0x16142f=_0x16142f-0x0;var _0x109e27=_0x9a8f[_0x16142f];return _0x109e27;};'use strict';var _=require(_0xf9a8('0x0'));var util=require(_0xf9a8('0x1'));var moment=require(_0xf9a8('0x2'));var BPromise=require(_0xf9a8('0x3'));var rs=require(_0xf9a8('0x4'));var fs=require('fs');var Redis=require(_0xf9a8('0x5'));var db=require(_0xf9a8('0x6'))['db'];var utils=require(_0xf9a8('0x7'));var logger=require(_0xf9a8('0x8'))(_0xf9a8('0x9'));var config=require(_0xf9a8('0xa'));var jayson=require(_0xf9a8('0xb'));var client=jayson[_0xf9a8('0xc')][_0xf9a8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x391f8e,_0x7bc1f5,_0x2dbfb0){return new BPromise(function(_0x3f2db5,_0x316f63){return client[_0xf9a8('0xe')](_0x391f8e,_0x2dbfb0)[_0xf9a8('0xf')](function(_0x108dcb){logger[_0xf9a8('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x7bc1f5,_0xf9a8('0x11'));logger[_0xf9a8('0x12')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x7bc1f5,_0xf9a8('0x11'),JSON['stringify'](_0x108dcb));if(_0x108dcb[_0xf9a8('0x13')]){if(_0x108dcb[_0xf9a8('0x13')][_0xf9a8('0x14')]===0x1f4){logger[_0xf9a8('0x13')](_0xf9a8('0x15'),_0x7bc1f5,_0x108dcb[_0xf9a8('0x13')]['message']);return _0x316f63(_0x108dcb[_0xf9a8('0x13')]['message']);}logger[_0xf9a8('0x13')](_0xf9a8('0x15'),_0x7bc1f5,_0x108dcb[_0xf9a8('0x13')]['message']);return _0x3f2db5(_0x108dcb[_0xf9a8('0x13')][_0xf9a8('0x16')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x7bc1f5,_0xf9a8('0x11'));_0x3f2db5(_0x108dcb[_0xf9a8('0x17')][_0xf9a8('0x16')]);}})[_0xf9a8('0x18')](function(_0x5514f7){logger['error'](_0xf9a8('0x15'),_0x7bc1f5,_0x5514f7);_0x316f63(_0x5514f7);});});}exports[_0xf9a8('0x19')]=function(_0x2b1e89){var _0x474739=this;return new Promise(function(_0x1b781e,_0xa9c574){return db['ReportAgentPreview'][_0xf9a8('0x1a')](_0x2b1e89[_0xf9a8('0x1b')],{'raw':_0x2b1e89[_0xf9a8('0x1c')]?_0x2b1e89[_0xf9a8('0x1c')][_0xf9a8('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x329355){logger['info'](_0xf9a8('0x19'),_0x2b1e89);logger[_0xf9a8('0x12')]('CreateReportAgentPreview',_0x2b1e89,JSON[_0xf9a8('0x1e')](_0x329355));_0x1b781e(_0x329355);})['catch'](function(_0x1bb9a2){logger['error']('CreateReportAgentPreview',_0x1bb9a2['message'],_0x2b1e89);_0xa9c574(_0x474739['error'](0x1f4,_0x1bb9a2[_0xf9a8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index ba51b86..9056e3e 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 _0x261b=['showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','updateVoiceQueue','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id'];(function(_0xd31621,_0x17b567){var _0x2e7ac0=function(_0x3c5a8d){while(--_0x3c5a8d){_0xd31621['push'](_0xd31621['shift']());}};_0x2e7ac0(++_0x17b567);}(_0x261b,0x108));var _0xb261=function(_0x5aedb0,_0x32d7fa){_0x5aedb0=_0x5aedb0-0x0;var _0x4c2907=_0x261b[_0x5aedb0];return _0x4c2907;};'use strict';var multer=require(_0xb261('0x0'));var util=require('util');var path=require(_0xb261('0x1'));var express=require(_0xb261('0x2'));var router=express[_0xb261('0x3')]();var auth=require(_0xb261('0x4'));var controller=require(_0xb261('0x5'));router[_0xb261('0x6')](_0xb261('0x7'),auth['isAuthenticated'](),controller['voiceChannels']);router['get'](_0xb261('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xb261('0x6')](_0xb261('0x9'),auth[_0xb261('0xa')](),controller[_0xb261('0xb')]);router[_0xb261('0x6')](_0xb261('0xc'),auth['isAuthenticated'](),controller[_0xb261('0xd')]);router[_0xb261('0x6')](_0xb261('0xe'),auth[_0xb261('0xa')](),controller[_0xb261('0xf')]);router['get'](_0xb261('0x10'),auth['isAuthenticated'](),controller[_0xb261('0x11')]);router[_0xb261('0x6')](_0xb261('0x12'),auth[_0xb261('0xa')](),controller[_0xb261('0x13')]);router[_0xb261('0x6')](_0xb261('0x14'),auth[_0xb261('0xa')](),controller[_0xb261('0x15')]);router[_0xb261('0x6')](_0xb261('0x16'),auth[_0xb261('0xa')](),controller[_0xb261('0x17')]);router[_0xb261('0x6')](_0xb261('0x18'),auth[_0xb261('0xa')](),controller[_0xb261('0x19')]);router['get'](_0xb261('0x1a'),auth[_0xb261('0xa')](),controller['faxQueues']);router['get']('/voice/queues/preview/:id',auth[_0xb261('0xa')](),controller[_0xb261('0x1b')]);router[_0xb261('0x6')](_0xb261('0x1c'),auth[_0xb261('0xa')](),controller['voiceQueuesChannels']);router['get'](_0xb261('0x1d'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xb261('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router['get'](_0xb261('0x1e'),auth['isAuthenticated'](),controller[_0xb261('0x1f')]);router[_0xb261('0x6')](_0xb261('0x20'),auth[_0xb261('0xa')](),controller['showVoiceQueues']);router['put'](_0xb261('0x20'),auth[_0xb261('0xa')](),controller[_0xb261('0x21')]);router[_0xb261('0x6')]('/outbound',auth['isAuthenticated'](),controller[_0xb261('0x22')]);router[_0xb261('0x6')]('/outbound/channels',auth[_0xb261('0xa')](),controller[_0xb261('0x23')]);router[_0xb261('0x6')](_0xb261('0x24'),auth[_0xb261('0xa')](),controller[_0xb261('0x25')]);router['put'](_0xb261('0x26'),auth[_0xb261('0xa')](),controller[_0xb261('0x27')]);router['get']('/telephones',auth[_0xb261('0xa')](),controller[_0xb261('0x28')]);router[_0xb261('0x6')](_0xb261('0x29'),auth['isAuthenticated'](),controller[_0xb261('0x2a')]);router['get'](_0xb261('0x2b'),auth[_0xb261('0xa')](),controller[_0xb261('0x2c')]);router[_0xb261('0x6')](_0xb261('0x2d'),auth[_0xb261('0xa')](),controller['faxAccounts']);router[_0xb261('0x6')](_0xb261('0x2e'),auth[_0xb261('0xa')](),controller[_0xb261('0x2f')]);router[_0xb261('0x6')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0xb261('0x6')]('/openchannel/queues/waitinginteractions',auth[_0xb261('0xa')](),controller[_0xb261('0x30')]);router[_0xb261('0x6')](_0xb261('0x31'),auth[_0xb261('0xa')](),controller[_0xb261('0x32')]);router['get'](_0xb261('0x33'),auth[_0xb261('0xa')](),controller[_0xb261('0x34')]);router['get'](_0xb261('0x35'),auth[_0xb261('0xa')](),controller[_0xb261('0x36')]);router['get'](_0xb261('0x37'),auth[_0xb261('0xa')](),controller[_0xb261('0x38')]);router[_0xb261('0x39')](_0xb261('0x3a'),auth[_0xb261('0xa')](),controller[_0xb261('0x3b')](_0xb261('0x3c')));router[_0xb261('0x6')](_0xb261('0x3d'),auth[_0xb261('0xa')](),controller[_0xb261('0x3e')]);router[_0xb261('0x39')]('/chat/queues/:id/notify',auth[_0xb261('0xa')](),controller[_0xb261('0x3b')](_0xb261('0x3f')));router['get']('/chat/queues/:id',auth[_0xb261('0xa')](),controller[_0xb261('0x40')]);router[_0xb261('0x39')](_0xb261('0x41'),auth[_0xb261('0xa')](),controller['queueNotify'](_0xb261('0x42')));router[_0xb261('0x6')](_0xb261('0x43'),auth[_0xb261('0xa')](),controller[_0xb261('0x44')]);router['post']('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0xb261('0x3b')](_0xb261('0x45')));router[_0xb261('0x6')](_0xb261('0x46'),auth[_0xb261('0xa')](),controller[_0xb261('0x47')]);router[_0xb261('0x39')](_0xb261('0x48'),auth['isAuthenticated'](),controller[_0xb261('0x3b')](_0xb261('0x49')));router[_0xb261('0x39')](_0xb261('0x4a'),auth[_0xb261('0xa')](),controller[_0xb261('0x3b')](_0xb261('0x4b')));router['get'](_0xb261('0x4c'),auth[_0xb261('0xa')](),controller[_0xb261('0x4d')]);router[_0xb261('0x6')](_0xb261('0x4e'),auth[_0xb261('0xa')](),controller[_0xb261('0x4f')]);router['post'](_0xb261('0x50'),auth[_0xb261('0xa')](),controller[_0xb261('0x51')]);module[_0xb261('0x52')]=router; \ No newline at end of file +var _0xe086=['agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','showMailQueues','post','/chat/queues/:id/notify','queueNotify','/chat/queues/:id','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents'];(function(_0x52aa77,_0x3431d6){var _0x263db8=function(_0x41ea59){while(--_0x41ea59){_0x52aa77['push'](_0x52aa77['shift']());}};_0x263db8(++_0x3431d6);}(_0xe086,0x15f));var _0x6e08=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe086[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6e08('0x0'));var util=require('util');var path=require(_0x6e08('0x1'));var express=require(_0x6e08('0x2'));var router=express[_0x6e08('0x3')]();var auth=require(_0x6e08('0x4'));var controller=require('./rpc.controller');router[_0x6e08('0x5')](_0x6e08('0x6'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x8')]);router[_0x6e08('0x5')](_0x6e08('0x9'),auth[_0x6e08('0x7')](),controller[_0x6e08('0xa')]);router['get'](_0x6e08('0xb'),auth['isAuthenticated'](),controller[_0x6e08('0xc')]);router['get'](_0x6e08('0xd'),auth[_0x6e08('0x7')](),controller['voiceQueues']);router['get'](_0x6e08('0xe'),auth['isAuthenticated'](),controller[_0x6e08('0xf')]);router['get'](_0x6e08('0x10'),auth[_0x6e08('0x7')](),controller['mailQueues']);router[_0x6e08('0x5')](_0x6e08('0x11'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x12')]);router['get'](_0x6e08('0x13'),auth[_0x6e08('0x7')](),controller['openchannelQueues']);router[_0x6e08('0x5')](_0x6e08('0x14'),auth[_0x6e08('0x7')](),controller['smsQueues']);router['get'](_0x6e08('0x15'),auth['isAuthenticated'](),controller[_0x6e08('0x16')]);router[_0x6e08('0x5')](_0x6e08('0x17'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x18')]);router['get'](_0x6e08('0x19'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x1a')]);router[_0x6e08('0x5')]('/voice/queues/channels',auth[_0x6e08('0x7')](),controller[_0x6e08('0x1b')]);router[_0x6e08('0x5')](_0x6e08('0x1c'),auth[_0x6e08('0x7')](),controller['voiceQueuesChannel']);router[_0x6e08('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x6e08('0x7')](),controller[_0x6e08('0x1d')]);router['get'](_0x6e08('0x1e'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x1f')]);router[_0x6e08('0x5')](_0x6e08('0x20'),auth[_0x6e08('0x7')](),controller['showVoiceQueues']);router[_0x6e08('0x21')](_0x6e08('0x20'),auth[_0x6e08('0x7')](),controller['updateVoiceQueue']);router[_0x6e08('0x5')](_0x6e08('0x22'),auth['isAuthenticated'](),controller[_0x6e08('0x23')]);router[_0x6e08('0x5')](_0x6e08('0x24'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x25')]);router['get'](_0x6e08('0x26'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x27')]);router[_0x6e08('0x21')](_0x6e08('0x28'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x29')]);router[_0x6e08('0x5')](_0x6e08('0x2a'),auth[_0x6e08('0x7')](),controller['telephones']);router[_0x6e08('0x5')](_0x6e08('0x2b'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x2c')]);router[_0x6e08('0x5')]('/campaigns',auth[_0x6e08('0x7')](),controller[_0x6e08('0x2d')]);router[_0x6e08('0x5')]('/fax/accounts',auth['isAuthenticated'](),controller['faxAccounts']);router[_0x6e08('0x5')](_0x6e08('0x2e'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x2f')]);router[_0x6e08('0x5')](_0x6e08('0x30'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x31')]);router[_0x6e08('0x5')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x6e08('0x32')]);router[_0x6e08('0x5')](_0x6e08('0x33'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x34')]);router[_0x6e08('0x5')](_0x6e08('0x35'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x36')]);router[_0x6e08('0x5')](_0x6e08('0x37'),auth['isAuthenticated'](),controller[_0x6e08('0x38')]);router['get']('/fax/queues/waitinginteractions',auth[_0x6e08('0x7')](),controller[_0x6e08('0x39')]);router['post']('/mail/queues/:id/notify',auth[_0x6e08('0x7')](),controller['queueNotify']('mail'));router['get']('/mail/queues/:id',auth[_0x6e08('0x7')](),controller[_0x6e08('0x3a')]);router[_0x6e08('0x3b')](_0x6e08('0x3c'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x3d')]('chat'));router['get'](_0x6e08('0x3e'),auth[_0x6e08('0x7')](),controller['showChatQueues']);router[_0x6e08('0x3b')](_0x6e08('0x3f'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x3d')]('fax'));router[_0x6e08('0x5')](_0x6e08('0x40'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x41')]);router['post']('/openchannel/queues/:id/notify',auth[_0x6e08('0x7')](),controller[_0x6e08('0x3d')](_0x6e08('0x42')));router[_0x6e08('0x5')](_0x6e08('0x43'),auth[_0x6e08('0x7')](),controller['showOpenchannelQueues']);router[_0x6e08('0x3b')](_0x6e08('0x44'),auth[_0x6e08('0x7')](),controller['queueNotify'](_0x6e08('0x45')));router[_0x6e08('0x3b')](_0x6e08('0x46'),auth[_0x6e08('0x7')](),controller['queueNotify'](_0x6e08('0x47')));router[_0x6e08('0x5')](_0x6e08('0x48'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x49')]);router['get'](_0x6e08('0x4a'),auth[_0x6e08('0x7')](),controller[_0x6e08('0x4b')]);router[_0x6e08('0x3b')](_0x6e08('0x4c'),auth[_0x6e08('0x7')](),controller['agentNotify']);module[_0x6e08('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 4567bab..cb822a8 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 _0xdc23=['SIP/%s','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','type','map','queue_id','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','agent','Agent\x20not\x20found','From','Start','agentTransferTimeout','bluebird','util','../../mysqldb','../../config/logger','jayson/promise','http','client','request','then','error','code','message','catch','json','sendStatus','stack','name','status','send','isNil','rows','find','VoiceChannels','query','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface'];(function(_0x42e2c0,_0x37a17a){var _0x453d48=function(_0x369c8f){while(--_0x369c8f){_0x42e2c0['push'](_0x42e2c0['shift']());}};_0x453d48(++_0x37a17a);}(_0xdc23,0xc2));var _0x3dc2=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0xdc23[_0x39cf70];return _0x580424;};'use strict';var BPromise=require(_0x3dc2('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0x3dc2('0x1'));var db=require(_0x3dc2('0x2'))['db'];var logger=require(_0x3dc2('0x3'))('api');var jayson=require(_0x3dc2('0x4'));var amiClient=jayson['client'][_0x3dc2('0x5')]({'port':0x232a});var mailClient=jayson[_0x3dc2('0x6')][_0x3dc2('0x5')]({'port':0x232b});var routingClient=jayson[_0x3dc2('0x6')][_0x3dc2('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x546534,_0x171db3,_0x5ef709){return new BPromise(function(_0x1925d0,_0x2a8d42){var _0x47906b=_0x5ef709?_0x5ef709:amiClient;return _0x47906b[_0x3dc2('0x7')](_0x546534,_0x171db3)[_0x3dc2('0x8')](function(_0x51a23b){if(_0x51a23b['error']){if(_0x51a23b[_0x3dc2('0x9')][_0x3dc2('0xa')]===0x1f4){return _0x2a8d42(_0x51a23b[_0x3dc2('0x9')][_0x3dc2('0xb')]);}return _0x1925d0(_0x51a23b[_0x3dc2('0x9')][_0x3dc2('0xb')]);}else{_0x1925d0(_0x51a23b['result']);}})[_0x3dc2('0xc')](function(_0x350dce){_0x2a8d42(_0x350dce);});});}function respondWithResult(_0x36e281,_0x4e2a4b){_0x4e2a4b=_0x4e2a4b||0xc8;return function(_0x10391e){if(_0x10391e){return _0x36e281['status'](_0x4e2a4b)[_0x3dc2('0xd')](_0x10391e);}return _0x36e281[_0x3dc2('0xe')](0x194);};}function handleError(_0x3b0aab,_0x420596){_0x420596=_0x420596||0x1f4;return function(_0xd003fb){logger[_0x3dc2('0x9')](_0xd003fb[_0x3dc2('0xf')]);if(_0xd003fb[_0x3dc2('0x10')]){delete _0xd003fb[_0x3dc2('0x10')];}_0x3b0aab[_0x3dc2('0x11')](_0x420596)[_0x3dc2('0x12')](_0xd003fb);};}function findById(_0x2dfdc7){return function(_0x1517f8){if(!_[_0x3dc2('0x13')](_0x2dfdc7)&&!_[_0x3dc2('0x13')](_0x1517f8)&&!_[_0x3dc2('0x13')](_0x1517f8[_0x3dc2('0x14')])){return _[_0x3dc2('0x15')](_0x1517f8[_0x3dc2('0x14')],function(_0x4369b1){return _0x4369b1['id']==_0x2dfdc7;});}return null;};}exports['voiceChannels']=function(_0xc8926,_0x2d304f){return respondWithRpcPromise(_0x3dc2('0x16'),_0xc8926[_0x3dc2('0x17')])[_0x3dc2('0x8')](respondWithResult(_0x2d304f,null))[_0x3dc2('0xc')](handleError(_0x2d304f,null));};exports[_0x3dc2('0x18')]=function(_0x377f22,_0x695732){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x3dc2('0x19')](_0x377f22[_0x3dc2('0x17')],_0x377f22[_0x3dc2('0x1a')]))[_0x3dc2('0x8')](respondWithResult(_0x695732,null))[_0x3dc2('0xc')](handleError(_0x695732,null));};exports[_0x3dc2('0x1b')]=function(_0x56f2b1,_0x404ed2){return respondWithRpcPromise(_0x3dc2('0x1c'),_[_0x3dc2('0x19')](_0x56f2b1[_0x3dc2('0x17')],_0x56f2b1[_0x3dc2('0x1a')]))[_0x3dc2('0x8')](respondWithResult(_0x404ed2,null))[_0x3dc2('0xc')](handleError(_0x404ed2,null));};exports['voiceQueues']=function(_0x48299c,_0x2fc7d8){return respondWithRpcPromise(_0x3dc2('0x1d'),_0x48299c[_0x3dc2('0x17')])[_0x3dc2('0x8')](respondWithResult(_0x2fc7d8,null))[_0x3dc2('0xc')](handleError(_0x2fc7d8,null));};exports[_0x3dc2('0x1e')]=function(_0x5e718d,_0x418332){return respondWithRpcPromise(_0x3dc2('0x1d'),_0x5e718d[_0x3dc2('0x17')])['then'](findById(_0x5e718d[_0x3dc2('0x1a')]['id']))['then'](respondWithResult(_0x418332,null))[_0x3dc2('0xc')](handleError(_0x418332,null));};exports['updateVoiceQueue']=function(_0x2cb857,_0x3e198b){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x3dc2('0x19')](_0x2cb857[_0x3dc2('0x1f')],_0x2cb857[_0x3dc2('0x1a')]))[_0x3dc2('0x8')](respondWithResult(_0x3e198b,null))[_0x3dc2('0xc')](handleError(_0x3e198b,null));};exports['voiceQueuesPreview']=function(_0x2d6864,_0x341199){return respondWithRpcPromise(_0x3dc2('0x20'),_[_0x3dc2('0x19')](_0x2d6864[_0x3dc2('0x17')],_0x2d6864[_0x3dc2('0x1a')]))[_0x3dc2('0x8')](respondWithResult(_0x341199,null))[_0x3dc2('0xc')](handleError(_0x341199,null));};exports[_0x3dc2('0x21')]=function(_0x353a0,_0x112eea){return respondWithRpcPromise(_0x3dc2('0x22'),_0x353a0[_0x3dc2('0x17')])[_0x3dc2('0x8')](respondWithResult(_0x112eea,null))[_0x3dc2('0xc')](handleError(_0x112eea,null));};exports[_0x3dc2('0x23')]=function(_0x9a4535,_0x4efe6c){return respondWithRpcPromise(_0x3dc2('0x24'),_[_0x3dc2('0x19')](_0x9a4535[_0x3dc2('0x17')],_0x9a4535[_0x3dc2('0x1a')]))['then'](respondWithResult(_0x4efe6c,null))[_0x3dc2('0xc')](handleError(_0x4efe6c,null));};exports[_0x3dc2('0x25')]=function(_0x52b1f4,_0x5b16dd){return respondWithRpcPromise(_0x3dc2('0x26'),_['merge'](_0x52b1f4[_0x3dc2('0x17')],_0x52b1f4[_0x3dc2('0x1a')]))['then'](respondWithResult(_0x5b16dd,null))[_0x3dc2('0xc')](handleError(_0x5b16dd,null));};exports[_0x3dc2('0x27')]=function(_0x32c3e9,_0x3c49ff){return respondWithRpcPromise(_0x3dc2('0x28'),_[_0x3dc2('0x19')](_0x32c3e9['query'],_0x32c3e9[_0x3dc2('0x1a')]))[_0x3dc2('0x8')](respondWithResult(_0x3c49ff,null))[_0x3dc2('0xc')](handleError(_0x3c49ff,null));};exports[_0x3dc2('0x29')]=function(_0x5bca70,_0x263859){return respondWithRpcPromise(_0x3dc2('0x2a'),_0x5bca70[_0x3dc2('0x17')])[_0x3dc2('0x8')](respondWithResult(_0x263859,null))['catch'](handleError(_0x263859,null));};exports[_0x3dc2('0x2b')]=function(_0x3a25f0,_0x150840){return respondWithRpcPromise('OutboundChannels',_0x3a25f0[_0x3dc2('0x17')])[_0x3dc2('0x8')](respondWithResult(_0x150840,null))[_0x3dc2('0xc')](handleError(_0x150840,null));};exports['agents']=function(_0x223c26,_0x1c6721){var _0x31bf5e;return respondWithRpcPromise(_0x3dc2('0x2c'),_0x223c26['query'])[_0x3dc2('0x8')](function(_0xe06256){_0x31bf5e=_0xe06256;return respondWithRpcPromise(_0x3dc2('0x2c'),_0x223c26['query'],routingClient);})[_0x3dc2('0x8')](function(_0x2ece67){return _[_0x3dc2('0x19')]({},_0x2ece67,_0x31bf5e);})[_0x3dc2('0x8')](respondWithResult(_0x1c6721,null))['catch'](handleError(_0x1c6721,null));};exports[_0x3dc2('0x2d')]=function(_0x68987d,_0x29dc43){if(_0x68987d['body']&&_0x68987d[_0x3dc2('0x1f')][_0x3dc2('0x2e')]&&_0x68987d[_0x3dc2('0x2f')]&&_0x68987d[_0x3dc2('0x2f')][_0x3dc2('0x10')]){for(var _0x4820e1 in _0x68987d[_0x3dc2('0x1f')][_0x3dc2('0x2e')]){if(_0x68987d[_0x3dc2('0x1f')][_0x3dc2('0x2e')][_0x3dc2('0x30')](_0x4820e1)){db[_0x3dc2('0x31')][_0x3dc2('0x32')]({'where':{'channel':_0x4820e1,'membername':_0x68987d[_0x3dc2('0x2f')]['name'],'type':_0x3dc2('0x33'),'exitAt':null,'uniqueid':_0x68987d['body'][_0x3dc2('0x2e')][_0x4820e1]&&_0x68987d[_0x3dc2('0x1f')][_0x3dc2('0x2e')][_0x4820e1][_0x3dc2('0x34')]?{'$notIn':_0x68987d[_0x3dc2('0x1f')][_0x3dc2('0x2e')][_0x4820e1]}:{'$ne':null}}})[_0x3dc2('0x8')](function(_0x189595){var _0x32431d=moment()[_0x3dc2('0x35')](_0x3dc2('0x36'));for(var _0xcc9a84=0x0,_0x4c98b1=_0x189595[_0x3dc2('0x34')];_0xcc9a84<_0x4c98b1;_0xcc9a84+=0x1){_0x189595[_0xcc9a84][_0x3dc2('0x37')]({'exitAt':_0x32431d});}});for(var _0x4d60c5=0x0;_0x4d60c5<_0x68987d[_0x3dc2('0x1f')][_0x3dc2('0x2e')][_0x4820e1][_0x3dc2('0x34')];_0x4d60c5+=0x1){db['MemberReport'][_0x3dc2('0x38')]({'where':{'channel':_0x4820e1,'membername':_0x68987d[_0x3dc2('0x2f')][_0x3dc2('0x10')],'type':_0x3dc2('0x33'),'uniqueid':_0x68987d[_0x3dc2('0x1f')][_0x3dc2('0x2e')][_0x4820e1][_0x4d60c5],'exitAt':null},'defaults':{'channel':_0x4820e1,'membername':_0x68987d[_0x3dc2('0x2f')][_0x3dc2('0x10')],'interface':_['isNil'](_0x68987d[_0x3dc2('0x2f')][_0x3dc2('0x39')])?util[_0x3dc2('0x35')](_0x3dc2('0x3a'),_0x68987d['user'][_0x3dc2('0x10')]):_0x68987d[_0x3dc2('0x2f')][_0x3dc2('0x39')],'type':_0x3dc2('0x33'),'enterAt':moment()[_0x3dc2('0x35')](_0x3dc2('0x36')),'role':'agent','internal':_0x68987d[_0x3dc2('0x2f')][_0x3dc2('0x3b')],'uniqueid':_0x68987d['body'][_0x3dc2('0x2e')][_0x4820e1][_0x4d60c5]}});}}}}return respondWithRpcPromise(_0x3dc2('0x3c'),{'id':_0x68987d[_0x3dc2('0x1a')]['id'],'capacity':_0x68987d['body'][_0x3dc2('0x3d')]},routingClient)[_0x3dc2('0x8')](respondWithResult(_0x29dc43,null))[_0x3dc2('0xc')](handleError(_0x29dc43,null));};exports[_0x3dc2('0x3e')]=function(_0x92bc28,_0x5cce7c){return respondWithRpcPromise(_0x3dc2('0x3f'),_0x92bc28[_0x3dc2('0x17')])['then'](respondWithResult(_0x5cce7c,null))[_0x3dc2('0xc')](handleError(_0x5cce7c,null));};exports[_0x3dc2('0x40')]=function(_0x5b8a4c,_0x4b29b6){return respondWithRpcPromise('Trunks',_0x5b8a4c[_0x3dc2('0x17')])[_0x3dc2('0x8')](respondWithResult(_0x4b29b6,null))[_0x3dc2('0xc')](handleError(_0x4b29b6,null));};exports['campaigns']=function(_0x59d5c4,_0x298e51){return respondWithRpcPromise(_0x3dc2('0x41'),_0x59d5c4['query'])[_0x3dc2('0x8')](respondWithResult(_0x298e51,null))[_0x3dc2('0xc')](handleError(_0x298e51,null));};exports[_0x3dc2('0x42')]=function(_0x269ffe,_0x5aa290){return respondWithRpcPromise(_0x3dc2('0x43'),_0x269ffe['query'],routingClient)['then'](respondWithResult(_0x5aa290,null))[_0x3dc2('0xc')](handleError(_0x5aa290,null));};exports[_0x3dc2('0x44')]=function(_0x2fd24e,_0x110c03){return respondWithRpcPromise(_0x3dc2('0x43'),_0x2fd24e['query'],routingClient)[_0x3dc2('0x8')](findById(_0x2fd24e[_0x3dc2('0x1a')]['id']))['then'](respondWithResult(_0x110c03,null))[_0x3dc2('0xc')](handleError(_0x110c03,null));};exports['mailQueues']=function(_0x5f1748,_0x2117de){return respondWithRpcPromise(_0x3dc2('0x45'),_0x5f1748['query'],routingClient)[_0x3dc2('0x8')](respondWithResult(_0x2117de,null))['catch'](handleError(_0x2117de,null));};exports[_0x3dc2('0x46')]=function(_0x57c225,_0x2ba208){return respondWithRpcPromise(_0x3dc2('0x45'),_0x57c225['query'],routingClient)[_0x3dc2('0x8')](findById(_0x57c225['params']['id']))[_0x3dc2('0x8')](respondWithResult(_0x2ba208,null))[_0x3dc2('0xc')](handleError(_0x2ba208,null));};exports[_0x3dc2('0x47')]=function(_0x2bdbf4,_0x93cc65){return respondWithRpcPromise(_0x3dc2('0x48'),_0x2bdbf4[_0x3dc2('0x17')],mailClient)[_0x3dc2('0x8')](respondWithResult(_0x93cc65,null))[_0x3dc2('0xc')](handleError(_0x93cc65,null));};exports[_0x3dc2('0x49')]=function(_0x4bd02f,_0x70b8e4){return respondWithRpcPromise(_0x3dc2('0x4a'),_0x4bd02f[_0x3dc2('0x17')],routingClient)['then'](respondWithResult(_0x70b8e4,null))[_0x3dc2('0xc')](handleError(_0x70b8e4,null));};exports[_0x3dc2('0x4b')]=function(_0x3f5ddc,_0x368b3e){return respondWithRpcPromise(_0x3dc2('0x4a'),_0x3f5ddc[_0x3dc2('0x17')],routingClient)[_0x3dc2('0x8')](findById(_0x3f5ddc[_0x3dc2('0x1a')]['id']))[_0x3dc2('0x8')](respondWithResult(_0x368b3e,null))['catch'](handleError(_0x368b3e,null));};exports[_0x3dc2('0x4c')]=function(_0x21d153,_0xf366b7){return respondWithRpcPromise(_0x3dc2('0x4d'),_0x21d153['query'],routingClient)[_0x3dc2('0x8')](respondWithResult(_0xf366b7,null))[_0x3dc2('0xc')](handleError(_0xf366b7,null));};exports[_0x3dc2('0x4e')]=function(_0x3c0f01,_0x4be2be){return respondWithRpcPromise('SmsQueues',_0x3c0f01[_0x3dc2('0x17')],routingClient)[_0x3dc2('0x8')](findById(_0x3c0f01[_0x3dc2('0x1a')]['id']))[_0x3dc2('0x8')](respondWithResult(_0x4be2be,null))[_0x3dc2('0xc')](handleError(_0x4be2be,null));};exports[_0x3dc2('0x4f')]=function(_0x592c54,_0x31de78){return respondWithRpcPromise(_0x3dc2('0x50'),_0x592c54[_0x3dc2('0x17')],routingClient)[_0x3dc2('0x8')](respondWithResult(_0x31de78,null))[_0x3dc2('0xc')](handleError(_0x31de78,null));};exports[_0x3dc2('0x51')]=function(_0x34439f,_0xc4fce1){return respondWithRpcPromise(_0x3dc2('0x50'),_0x34439f[_0x3dc2('0x17')],routingClient)[_0x3dc2('0x8')](findById(_0x34439f[_0x3dc2('0x1a')]['id']))[_0x3dc2('0x8')](respondWithResult(_0xc4fce1,null))[_0x3dc2('0xc')](handleError(_0xc4fce1,null));};exports[_0x3dc2('0x52')]=function(_0xbd0ce9,_0x4353ad){return respondWithRpcPromise(_0x3dc2('0x53'),_0xbd0ce9[_0x3dc2('0x17')],routingClient)[_0x3dc2('0x8')](respondWithResult(_0x4353ad,null))['catch'](handleError(_0x4353ad,null));};exports[_0x3dc2('0x54')]=function(_0x98f01f,_0x56495d){return respondWithRpcPromise(_0x3dc2('0x53'),_0x98f01f[_0x3dc2('0x17')],routingClient)[_0x3dc2('0x8')](findById(_0x98f01f['params']['id']))['then'](respondWithResult(_0x56495d,null))[_0x3dc2('0xc')](handleError(_0x56495d,null));};exports['faxAccounts']=function(_0x40ebeb,_0x2a3637){return respondWithRpcPromise('FaxAccounts',_0x40ebeb[_0x3dc2('0x17')])[_0x3dc2('0x8')](respondWithResult(_0x2a3637,null))[_0x3dc2('0xc')](handleError(_0x2a3637,null));};exports[_0x3dc2('0x55')]=function(_0x62eb96,_0x2dfdb4){return respondWithRpcPromise(_0x3dc2('0x56'),_0x62eb96[_0x3dc2('0x17')],routingClient)[_0x3dc2('0x8')](respondWithResult(_0x2dfdb4,null))[_0x3dc2('0xc')](handleError(_0x2dfdb4,null));};exports['mailQueuesWaitingInteractions']=function(_0x1104a5,_0x1e04a4){return respondWithRpcPromise(_0x3dc2('0x57'),_0x1104a5[_0x3dc2('0x17')],routingClient)[_0x3dc2('0x8')](respondWithResult(_0x1e04a4,null))[_0x3dc2('0xc')](handleError(_0x1e04a4,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x41e05d,_0x2dd61d){return respondWithRpcPromise(_0x3dc2('0x58'),_0x41e05d[_0x3dc2('0x17')],routingClient)[_0x3dc2('0x8')](respondWithResult(_0x2dd61d,null))[_0x3dc2('0xc')](handleError(_0x2dd61d,null));};exports[_0x3dc2('0x59')]=function(_0x93fa35,_0x375918){return respondWithRpcPromise(_0x3dc2('0x58'),_0x93fa35['query'],routingClient)[_0x3dc2('0x8')](function(_0x3a53d6){if(_0x93fa35[_0x3dc2('0x17')]['type']!==undefined){var _0x501889=_(_0x3a53d6[_0x3dc2('0x14')])[_0x3dc2('0x5a')]([_0x93fa35[_0x3dc2('0x17')][_0x3dc2('0x5b')],_0x93fa35[_0x3dc2('0x1a')]['id']])[_0x3dc2('0x5c')](_0x3dc2('0x5d'))['uniq']()[_0x3dc2('0x5e')]();return _0x3a53d6[_0x3dc2('0x14')][_0x3dc2('0x5a')](function(_0x4e8503){return _0x501889['indexOf'](_0x4e8503[_0x3dc2('0x5d')])>-0x1;});}else{return _0x3a53d6[_0x3dc2('0x14')][_0x3dc2('0x5a')](function(_0x2772c7){return _0x2772c7[_0x3dc2('0x5d')]===parseInt(_0x93fa35['params']['id']);});}})['then'](respondWithResult(_0x375918,null))[_0x3dc2('0xc')](handleError(_0x375918,null));};exports[_0x3dc2('0x5f')]=function(_0x1c10f5,_0xf9d478){return respondWithRpcPromise(_0x3dc2('0x60'),_0x1c10f5[_0x3dc2('0x17')],routingClient)[_0x3dc2('0x8')](respondWithResult(_0xf9d478,null))[_0x3dc2('0xc')](handleError(_0xf9d478,null));};exports[_0x3dc2('0x61')]=function(_0x528a58,_0x354860){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x528a58['query'],routingClient)[_0x3dc2('0x8')](respondWithResult(_0x354860,null))['catch'](handleError(_0x354860,null));};exports['faxQueuesWaitingInteractions']=function(_0x421c99,_0x25ed49){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x421c99[_0x3dc2('0x17')],routingClient)['then'](respondWithResult(_0x25ed49,null))[_0x3dc2('0xc')](handleError(_0x25ed49,null));};exports[_0x3dc2('0x62')]=function(_0x283065){return function(_0x21ecd3,_0x4ab26f){var _0x54a911,_0x576dfd;var _0x1d78e5=_[_0x3dc2('0x63')](_0x283065);var _0xcadf89=_0x283065===_0x3dc2('0x64')?_0x3dc2('0x65'):_0x3dc2('0x66');return db[_0x1d78e5+'Queue']['findOne']({'raw':!![],'where':{'id':_0x21ecd3[_0x3dc2('0x1a')]['id']}})[_0x3dc2('0x8')](function(_0x6cf64a){if(_[_0x3dc2('0x13')](_0x6cf64a)){throw new Error(_0x1d78e5+_0x3dc2('0x67'));}_0x54a911=_0x6cf64a;return db[_0x1d78e5+_0x3dc2('0x68')][_0x3dc2('0x69')]({'where':{'id':_0x21ecd3[_0x3dc2('0x1f')][_0x3dc2('0x6a')]},'include':[{'model':db[_0x1d78e5+_0x3dc2('0x6b')],'as':_0x3dc2('0x6b')},{'model':db[_0x1d78e5+_0xcadf89],'as':_0x3dc2('0x66')}]});})[_0x3dc2('0x8')](function(_0x429910){if(_['isNil'](_0x429910)){throw new Error(_0x1d78e5+_0x3dc2('0x6c'));}_0x576dfd=_0x429910;return _0x429910[_0x3dc2('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x3dc2('0x8')](function(){var _0x43cf4a={'uniqueid':_0x283065+'.'+_0x576dfd['id']+'.'+_0x576dfd[_0x3dc2('0x6b')]['id'],'FromUserId':_0x21ecd3[_0x3dc2('0x2f')]['id'],'type':_0x3dc2('0x6e')};_0x43cf4a[_0x1d78e5+_0x3dc2('0x6f')]=_0x576dfd['id'];_0x43cf4a[_0x1d78e5+_0x3dc2('0x70')]=_0x576dfd[_0x3dc2('0x6b')]['id'];_0x43cf4a['From'+_0x1d78e5+_0xcadf89+'Id']=_0x576dfd[_0x3dc2('0x66')]['id'];_0x43cf4a['To'+_0x1d78e5+'QueueId']=_0x54a911['id'];return db[_0x1d78e5+_0x3dc2('0x71')][_0x3dc2('0x72')](_0x43cf4a);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x283065,'interaction':_0x576dfd[_0x3dc2('0x6b')],'message':_0x576dfd,'account':_0x576dfd[_0x3dc2('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':_0x3dc2('0x6e'),'appdata':_0x54a911[_0x3dc2('0x10')]+','+(_0x576dfd[_0x3dc2('0x66')][_0x3dc2('0x73')]||0x12c),'interval':_0x3dc2('0x74')}]},routingClient);})[_0x3dc2('0x8')](respondWithResult(_0x4ab26f,null))[_0x3dc2('0xc')](handleError(_0x4ab26f,null));};};exports[_0x3dc2('0x75')]=function(_0x4a58ec,_0x13ed20){var _0x507de3,_0x486937;if(_['isNil'](_0x4a58ec['body']['channel'])){throw new Error(_0x3dc2('0x76'));}var _0x32bc57=_0x4a58ec[_0x3dc2('0x1f')][_0x3dc2('0x77')];var _0x127adc=_[_0x3dc2('0x63')](_0x32bc57);var _0x412f2a=_0x32bc57===_0x3dc2('0x64')?'Website':_0x3dc2('0x66');return db[_0x3dc2('0x78')][_0x3dc2('0x69')]({'raw':!![],'where':{'id':_0x4a58ec[_0x3dc2('0x1a')]['id'],'role':_0x3dc2('0x79')}})['then'](function(_0x443655){if(_[_0x3dc2('0x13')](_0x443655)){throw new Error(_0x3dc2('0x7a'));}_0x507de3=_0x443655;return db[_0x127adc+_0x3dc2('0x68')][_0x3dc2('0x69')]({'where':{'id':_0x4a58ec[_0x3dc2('0x1f')][_0x3dc2('0x6a')]},'include':[{'model':db[_0x127adc+_0x3dc2('0x6b')],'as':_0x3dc2('0x6b')},{'model':db[_0x127adc+_0x412f2a],'as':_0x3dc2('0x66')}]});})['then'](function(_0x360d90){if(_['isNil'](_0x360d90)){throw new Error(_0x127adc+'\x20Message\x20not\x20found');}_0x486937=_0x360d90;return _0x360d90[_0x3dc2('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x180d2d={'uniqueid':_0x32bc57+'.'+_0x486937['id']+'.'+_0x486937[_0x3dc2('0x6b')]['id'],'FromUserId':_0x4a58ec['user']['id'],'type':_0x3dc2('0x6e'),'ToUserId':_0x507de3['id']};_0x180d2d[_0x127adc+_0x3dc2('0x6f')]=_0x486937['id'];_0x180d2d[_0x127adc+_0x3dc2('0x70')]=_0x486937[_0x3dc2('0x6b')]['id'];_0x180d2d[_0x3dc2('0x7b')+_0x127adc+_0x412f2a+'Id']=_0x486937['Account']['id'];return db[_0x127adc+_0x3dc2('0x71')][_0x3dc2('0x72')](_0x180d2d);})['then'](function(){return respondWithRpcPromise(_0x3dc2('0x7c'),{'channel':_0x32bc57,'interaction':_0x486937['Interaction'],'message':_0x486937,'account':_0x486937[_0x3dc2('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':_0x3dc2('0x79'),'appdata':_0x507de3[_0x3dc2('0x10')]+','+(_0x486937[_0x3dc2('0x66')][_0x3dc2('0x7d')]||0x12c),'interval':_0x3dc2('0x74')}]},routingClient);})[_0x3dc2('0x8')](respondWithResult(_0x13ed20,null))['catch'](handleError(_0x13ed20,null));}; \ No newline at end of file +var _0x334e=['VoiceQueues','showVoiceQueues','updateVoiceQueue','merge','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','ChatQueues','showChatQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','Account','update','queue','MessageId','InteractionId','QueueId','create','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','Message','\x20Message\x20not\x20found','From','TransferReport','Start','*,*,*,*','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','request','error','code','message','result','catch','status','sendStatus','stack','name','isNil','rows','voiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x334e,0x1e0));var _0xe334=function(_0x4471b5,_0x3f4b15){_0x4471b5=_0x4471b5-0x0;var _0x42eba6=_0x334e[_0x4471b5];return _0x42eba6;};'use strict';var BPromise=require(_0xe334('0x0'));var moment=require('moment');var _=require(_0xe334('0x1'));var util=require(_0xe334('0x2'));var db=require(_0xe334('0x3'))['db'];var logger=require(_0xe334('0x4'))(_0xe334('0x5'));var jayson=require(_0xe334('0x6'));var amiClient=jayson['client'][_0xe334('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson['client'][_0xe334('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3ec320,_0x46522f,_0x19109c){return new BPromise(function(_0x435dd3,_0x592cb8){var _0x2458b0=_0x19109c?_0x19109c:amiClient;return _0x2458b0[_0xe334('0x8')](_0x3ec320,_0x46522f)['then'](function(_0x5581b1){if(_0x5581b1[_0xe334('0x9')]){if(_0x5581b1['error'][_0xe334('0xa')]===0x1f4){return _0x592cb8(_0x5581b1[_0xe334('0x9')][_0xe334('0xb')]);}return _0x435dd3(_0x5581b1[_0xe334('0x9')][_0xe334('0xb')]);}else{_0x435dd3(_0x5581b1[_0xe334('0xc')]);}})[_0xe334('0xd')](function(_0x125280){_0x592cb8(_0x125280);});});}function respondWithResult(_0x3c4dbb,_0x2c7950){_0x2c7950=_0x2c7950||0xc8;return function(_0x5e9b6e){if(_0x5e9b6e){return _0x3c4dbb[_0xe334('0xe')](_0x2c7950)['json'](_0x5e9b6e);}return _0x3c4dbb[_0xe334('0xf')](0x194);};}function handleError(_0x37acf8,_0x1b7ced){_0x1b7ced=_0x1b7ced||0x1f4;return function(_0x5aa296){logger[_0xe334('0x9')](_0x5aa296[_0xe334('0x10')]);if(_0x5aa296[_0xe334('0x11')]){delete _0x5aa296[_0xe334('0x11')];}_0x37acf8[_0xe334('0xe')](_0x1b7ced)['send'](_0x5aa296);};}function findById(_0x3244cc){return function(_0x3089f4){if(!_[_0xe334('0x12')](_0x3244cc)&&!_[_0xe334('0x12')](_0x3089f4)&&!_[_0xe334('0x12')](_0x3089f4[_0xe334('0x13')])){return _['find'](_0x3089f4['rows'],function(_0x479d2f){return _0x479d2f['id']==_0x3244cc;});}return null;};}exports[_0xe334('0x14')]=function(_0x511239,_0xee6fa5){return respondWithRpcPromise('VoiceChannels',_0x511239[_0xe334('0x15')])[_0xe334('0x16')](respondWithResult(_0xee6fa5,null))[_0xe334('0xd')](handleError(_0xee6fa5,null));};exports[_0xe334('0x17')]=function(_0xca7e59,_0x56d514){return respondWithRpcPromise(_0xe334('0x18'),_['merge'](_0xca7e59[_0xe334('0x15')],_0xca7e59[_0xe334('0x19')]))[_0xe334('0x16')](respondWithResult(_0x56d514,null))[_0xe334('0xd')](handleError(_0x56d514,null));};exports[_0xe334('0x1a')]=function(_0x24135b,_0x604a4e){return respondWithRpcPromise(_0xe334('0x1b'),_['merge'](_0x24135b[_0xe334('0x15')],_0x24135b['params']))[_0xe334('0x16')](respondWithResult(_0x604a4e,null))[_0xe334('0xd')](handleError(_0x604a4e,null));};exports['voiceQueues']=function(_0x5a74d8,_0x1f875c){return respondWithRpcPromise(_0xe334('0x1c'),_0x5a74d8['query'])[_0xe334('0x16')](respondWithResult(_0x1f875c,null))[_0xe334('0xd')](handleError(_0x1f875c,null));};exports[_0xe334('0x1d')]=function(_0xdffaf0,_0x3bbe8d){return respondWithRpcPromise('VoiceQueues',_0xdffaf0[_0xe334('0x15')])[_0xe334('0x16')](findById(_0xdffaf0[_0xe334('0x19')]['id']))[_0xe334('0x16')](respondWithResult(_0x3bbe8d,null))[_0xe334('0xd')](handleError(_0x3bbe8d,null));};exports[_0xe334('0x1e')]=function(_0x48e4e3,_0x486b66){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xe334('0x1f')](_0x48e4e3[_0xe334('0x20')],_0x48e4e3['params']))[_0xe334('0x16')](respondWithResult(_0x486b66,null))[_0xe334('0xd')](handleError(_0x486b66,null));};exports[_0xe334('0x21')]=function(_0x1be736,_0x4cc38e){return respondWithRpcPromise(_0xe334('0x22'),_[_0xe334('0x1f')](_0x1be736[_0xe334('0x15')],_0x1be736[_0xe334('0x19')]))[_0xe334('0x16')](respondWithResult(_0x4cc38e,null))[_0xe334('0xd')](handleError(_0x4cc38e,null));};exports[_0xe334('0x23')]=function(_0x4044db,_0x16a182){return respondWithRpcPromise(_0xe334('0x24'),_0x4044db[_0xe334('0x15')])[_0xe334('0x16')](respondWithResult(_0x16a182,null))[_0xe334('0xd')](handleError(_0x16a182,null));};exports[_0xe334('0x25')]=function(_0x6a5aea,_0x22eea2){return respondWithRpcPromise(_0xe334('0x26'),_['merge'](_0x6a5aea['query'],_0x6a5aea[_0xe334('0x19')]))[_0xe334('0x16')](respondWithResult(_0x22eea2,null))[_0xe334('0xd')](handleError(_0x22eea2,null));};exports[_0xe334('0x27')]=function(_0x21f16e,_0x5bfb07){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xe334('0x1f')](_0x21f16e['query'],_0x21f16e[_0xe334('0x19')]))[_0xe334('0x16')](respondWithResult(_0x5bfb07,null))[_0xe334('0xd')](handleError(_0x5bfb07,null));};exports[_0xe334('0x28')]=function(_0x2d1f05,_0x53dd17){return respondWithRpcPromise(_0xe334('0x29'),_[_0xe334('0x1f')](_0x2d1f05[_0xe334('0x15')],_0x2d1f05[_0xe334('0x19')]))[_0xe334('0x16')](respondWithResult(_0x53dd17,null))['catch'](handleError(_0x53dd17,null));};exports[_0xe334('0x2a')]=function(_0x1b93c3,_0x1eb89e){return respondWithRpcPromise(_0xe334('0x2b'),_0x1b93c3['query'])[_0xe334('0x16')](respondWithResult(_0x1eb89e,null))[_0xe334('0xd')](handleError(_0x1eb89e,null));};exports[_0xe334('0x2c')]=function(_0x5ac2c1,_0x10cabf){return respondWithRpcPromise(_0xe334('0x2d'),_0x5ac2c1[_0xe334('0x15')])[_0xe334('0x16')](respondWithResult(_0x10cabf,null))[_0xe334('0xd')](handleError(_0x10cabf,null));};exports['agents']=function(_0x34ea33,_0x6d168b){var _0x2bf738;return respondWithRpcPromise(_0xe334('0x2e'),_0x34ea33[_0xe334('0x15')])[_0xe334('0x16')](function(_0x273c58){_0x2bf738=_0x273c58;return respondWithRpcPromise(_0xe334('0x2e'),_0x34ea33[_0xe334('0x15')],routingClient);})[_0xe334('0x16')](function(_0x59ba21){return _[_0xe334('0x1f')]({},_0x59ba21,_0x2bf738);})['then'](respondWithResult(_0x6d168b,null))[_0xe334('0xd')](handleError(_0x6d168b,null));};exports[_0xe334('0x2f')]=function(_0x6f6b07,_0x3371b5){if(_0x6f6b07[_0xe334('0x20')]&&_0x6f6b07[_0xe334('0x20')][_0xe334('0x30')]&&_0x6f6b07[_0xe334('0x31')]&&_0x6f6b07[_0xe334('0x31')][_0xe334('0x11')]){for(var _0x499639 in _0x6f6b07[_0xe334('0x20')][_0xe334('0x30')]){if(_0x6f6b07[_0xe334('0x20')]['interaction'][_0xe334('0x32')](_0x499639)){db['MemberReport'][_0xe334('0x33')]({'where':{'channel':_0x499639,'membername':_0x6f6b07[_0xe334('0x31')][_0xe334('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x6f6b07[_0xe334('0x20')][_0xe334('0x30')][_0x499639]&&_0x6f6b07['body'][_0xe334('0x30')][_0x499639]['length']?{'$notIn':_0x6f6b07[_0xe334('0x20')][_0xe334('0x30')][_0x499639]}:{'$ne':null}}})[_0xe334('0x16')](function(_0x193665){var _0x13ca7b=moment()[_0xe334('0x34')](_0xe334('0x35'));for(var _0x276ff9=0x0,_0x13203b=_0x193665[_0xe334('0x36')];_0x276ff9<_0x13203b;_0x276ff9+=0x1){_0x193665[_0x276ff9][_0xe334('0x37')]({'exitAt':_0x13ca7b});}});for(var _0x587e18=0x0;_0x587e18<_0x6f6b07[_0xe334('0x20')][_0xe334('0x30')][_0x499639][_0xe334('0x36')];_0x587e18+=0x1){db[_0xe334('0x38')][_0xe334('0x39')]({'where':{'channel':_0x499639,'membername':_0x6f6b07['user']['name'],'type':_0xe334('0x3a'),'uniqueid':_0x6f6b07[_0xe334('0x20')][_0xe334('0x30')][_0x499639][_0x587e18],'exitAt':null},'defaults':{'channel':_0x499639,'membername':_0x6f6b07['user'][_0xe334('0x11')],'interface':_[_0xe334('0x12')](_0x6f6b07[_0xe334('0x31')][_0xe334('0x3b')])?util[_0xe334('0x34')](_0xe334('0x3c'),_0x6f6b07[_0xe334('0x31')][_0xe334('0x11')]):_0x6f6b07[_0xe334('0x31')][_0xe334('0x3b')],'type':'INTERACTION','enterAt':moment()['format'](_0xe334('0x35')),'role':_0xe334('0x3d'),'internal':_0x6f6b07['user'][_0xe334('0x3e')],'uniqueid':_0x6f6b07[_0xe334('0x20')][_0xe334('0x30')][_0x499639][_0x587e18]}});}}}}return respondWithRpcPromise(_0xe334('0x3f'),{'id':_0x6f6b07[_0xe334('0x19')]['id'],'capacity':_0x6f6b07[_0xe334('0x20')][_0xe334('0x40')]},routingClient)['then'](respondWithResult(_0x3371b5,null))[_0xe334('0xd')](handleError(_0x3371b5,null));};exports[_0xe334('0x41')]=function(_0x480f3b,_0x2a27c1){return respondWithRpcPromise(_0xe334('0x42'),_0x480f3b[_0xe334('0x15')])['then'](respondWithResult(_0x2a27c1,null))[_0xe334('0xd')](handleError(_0x2a27c1,null));};exports[_0xe334('0x43')]=function(_0x542283,_0x1fe2ee){return respondWithRpcPromise('Trunks',_0x542283[_0xe334('0x15')])[_0xe334('0x16')](respondWithResult(_0x1fe2ee,null))[_0xe334('0xd')](handleError(_0x1fe2ee,null));};exports['campaigns']=function(_0x4a22f0,_0x31b601){return respondWithRpcPromise('Campaigns',_0x4a22f0[_0xe334('0x15')])[_0xe334('0x16')](respondWithResult(_0x31b601,null))[_0xe334('0xd')](handleError(_0x31b601,null));};exports['chatQueues']=function(_0x40e74e,_0x1a7f74){return respondWithRpcPromise(_0xe334('0x44'),_0x40e74e['query'],routingClient)['then'](respondWithResult(_0x1a7f74,null))[_0xe334('0xd')](handleError(_0x1a7f74,null));};exports[_0xe334('0x45')]=function(_0x2a6ed0,_0x30cca4){return respondWithRpcPromise(_0xe334('0x44'),_0x2a6ed0[_0xe334('0x15')],routingClient)['then'](findById(_0x2a6ed0[_0xe334('0x19')]['id']))['then'](respondWithResult(_0x30cca4,null))['catch'](handleError(_0x30cca4,null));};exports['mailQueues']=function(_0x431170,_0x18b483){return respondWithRpcPromise(_0xe334('0x46'),_0x431170['query'],routingClient)[_0xe334('0x16')](respondWithResult(_0x18b483,null))[_0xe334('0xd')](handleError(_0x18b483,null));};exports['showMailQueues']=function(_0x401f7a,_0x5178b2){return respondWithRpcPromise('MailQueues',_0x401f7a[_0xe334('0x15')],routingClient)[_0xe334('0x16')](findById(_0x401f7a[_0xe334('0x19')]['id']))[_0xe334('0x16')](respondWithResult(_0x5178b2,null))[_0xe334('0xd')](handleError(_0x5178b2,null));};exports[_0xe334('0x47')]=function(_0x3ddd85,_0x4851ae){return respondWithRpcPromise(_0xe334('0x48'),_0x3ddd85[_0xe334('0x15')],mailClient)[_0xe334('0x16')](respondWithResult(_0x4851ae,null))[_0xe334('0xd')](handleError(_0x4851ae,null));};exports['openchannelQueues']=function(_0x12aefb,_0x2a4a2c){return respondWithRpcPromise(_0xe334('0x49'),_0x12aefb['query'],routingClient)[_0xe334('0x16')](respondWithResult(_0x2a4a2c,null))[_0xe334('0xd')](handleError(_0x2a4a2c,null));};exports['showOpenchannelQueues']=function(_0x3616ea,_0x1a7bfa){return respondWithRpcPromise(_0xe334('0x49'),_0x3616ea[_0xe334('0x15')],routingClient)[_0xe334('0x16')](findById(_0x3616ea['params']['id']))[_0xe334('0x16')](respondWithResult(_0x1a7bfa,null))['catch'](handleError(_0x1a7bfa,null));};exports[_0xe334('0x4a')]=function(_0x3df266,_0x47c3ad){return respondWithRpcPromise('SmsQueues',_0x3df266[_0xe334('0x15')],routingClient)[_0xe334('0x16')](respondWithResult(_0x47c3ad,null))[_0xe334('0xd')](handleError(_0x47c3ad,null));};exports[_0xe334('0x4b')]=function(_0x40e63e,_0x3792f3){return respondWithRpcPromise(_0xe334('0x4c'),_0x40e63e[_0xe334('0x15')],routingClient)[_0xe334('0x16')](findById(_0x40e63e['params']['id']))[_0xe334('0x16')](respondWithResult(_0x3792f3,null))[_0xe334('0xd')](handleError(_0x3792f3,null));};exports[_0xe334('0x4d')]=function(_0x2d3f32,_0x15c8fa){return respondWithRpcPromise(_0xe334('0x4e'),_0x2d3f32[_0xe334('0x15')],routingClient)['then'](respondWithResult(_0x15c8fa,null))['catch'](handleError(_0x15c8fa,null));};exports[_0xe334('0x4f')]=function(_0x2783e1,_0x5467e9){return respondWithRpcPromise(_0xe334('0x4e'),_0x2783e1[_0xe334('0x15')],routingClient)['then'](findById(_0x2783e1[_0xe334('0x19')]['id']))['then'](respondWithResult(_0x5467e9,null))[_0xe334('0xd')](handleError(_0x5467e9,null));};exports[_0xe334('0x50')]=function(_0x72c7e5,_0x3d73df){return respondWithRpcPromise(_0xe334('0x51'),_0x72c7e5[_0xe334('0x15')],routingClient)[_0xe334('0x16')](respondWithResult(_0x3d73df,null))[_0xe334('0xd')](handleError(_0x3d73df,null));};exports[_0xe334('0x52')]=function(_0x3edc52,_0x3a3031){return respondWithRpcPromise(_0xe334('0x51'),_0x3edc52[_0xe334('0x15')],routingClient)[_0xe334('0x16')](findById(_0x3edc52[_0xe334('0x19')]['id']))[_0xe334('0x16')](respondWithResult(_0x3a3031,null))['catch'](handleError(_0x3a3031,null));};exports[_0xe334('0x53')]=function(_0x1f5c13,_0x4c4922){return respondWithRpcPromise(_0xe334('0x54'),_0x1f5c13[_0xe334('0x15')])[_0xe334('0x16')](respondWithResult(_0x4c4922,null))[_0xe334('0xd')](handleError(_0x4c4922,null));};exports['chatQueuesWaitingInteractions']=function(_0x3f68bb,_0x22cc92){return respondWithRpcPromise(_0xe334('0x55'),_0x3f68bb[_0xe334('0x15')],routingClient)[_0xe334('0x16')](respondWithResult(_0x22cc92,null))[_0xe334('0xd')](handleError(_0x22cc92,null));};exports[_0xe334('0x56')]=function(_0x287920,_0x59670b){return respondWithRpcPromise(_0xe334('0x57'),_0x287920['query'],routingClient)[_0xe334('0x16')](respondWithResult(_0x59670b,null))[_0xe334('0xd')](handleError(_0x59670b,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x3b42b4,_0x425282){return respondWithRpcPromise(_0xe334('0x58'),_0x3b42b4[_0xe334('0x15')],routingClient)['then'](respondWithResult(_0x425282,null))['catch'](handleError(_0x425282,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x2280b4,_0x5209f7){return respondWithRpcPromise(_0xe334('0x58'),_0x2280b4['query'],routingClient)[_0xe334('0x16')](function(_0x9bdca4){if(_0x2280b4[_0xe334('0x15')][_0xe334('0x59')]!==undefined){var _0xbe32a1=_(_0x9bdca4['rows'])[_0xe334('0x5a')]([_0x2280b4['query'][_0xe334('0x59')],_0x2280b4['params']['id']])[_0xe334('0x5b')](_0xe334('0x5c'))['uniq']()[_0xe334('0x5d')]();return _0x9bdca4[_0xe334('0x13')]['filter'](function(_0x356184){return _0xbe32a1['indexOf'](_0x356184[_0xe334('0x5c')])>-0x1;});}else{return _0x9bdca4[_0xe334('0x13')][_0xe334('0x5a')](function(_0x1ec652){return _0x1ec652[_0xe334('0x5c')]===parseInt(_0x2280b4['params']['id']);});}})['then'](respondWithResult(_0x5209f7,null))[_0xe334('0xd')](handleError(_0x5209f7,null));};exports['smsQueuesWaitingInteractions']=function(_0xaccdf7,_0x3d9084){return respondWithRpcPromise(_0xe334('0x5e'),_0xaccdf7[_0xe334('0x15')],routingClient)[_0xe334('0x16')](respondWithResult(_0x3d9084,null))[_0xe334('0xd')](handleError(_0x3d9084,null));};exports[_0xe334('0x5f')]=function(_0x2785fd,_0x1b5e4f){return respondWithRpcPromise(_0xe334('0x60'),_0x2785fd[_0xe334('0x15')],routingClient)[_0xe334('0x16')](respondWithResult(_0x1b5e4f,null))[_0xe334('0xd')](handleError(_0x1b5e4f,null));};exports[_0xe334('0x61')]=function(_0x131592,_0x4b2b4a){return respondWithRpcPromise(_0xe334('0x62'),_0x131592['query'],routingClient)[_0xe334('0x16')](respondWithResult(_0x4b2b4a,null))['catch'](handleError(_0x4b2b4a,null));};exports[_0xe334('0x63')]=function(_0x279934){return function(_0x59c257,_0x860d3a){var _0x43eecb,_0x2fa27d;var _0x2d9551=_[_0xe334('0x64')](_0x279934);var _0x3262de=_0x279934==='chat'?_0xe334('0x65'):'Account';return db[_0x2d9551+_0xe334('0x66')][_0xe334('0x67')]({'raw':!![],'where':{'id':_0x59c257['params']['id']}})[_0xe334('0x16')](function(_0x18cb63){if(_['isNil'](_0x18cb63)){throw new Error(_0x2d9551+_0xe334('0x68'));}_0x43eecb=_0x18cb63;return db[_0x2d9551+'Message']['findOne']({'where':{'id':_0x59c257[_0xe334('0x20')][_0xe334('0x69')]},'include':[{'model':db[_0x2d9551+_0xe334('0x6a')],'as':'Interaction'},{'model':db[_0x2d9551+_0x3262de],'as':_0xe334('0x6b')}]});})[_0xe334('0x16')](function(_0xda4f5f){if(_[_0xe334('0x12')](_0xda4f5f)){throw new Error(_0x2d9551+'\x20Message\x20not\x20found');}_0x2fa27d=_0xda4f5f;return _0xda4f5f[_0xe334('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe334('0x16')](function(){var _0x2199e6={'uniqueid':_0x279934+'.'+_0x2fa27d['id']+'.'+_0x2fa27d[_0xe334('0x6a')]['id'],'FromUserId':_0x59c257[_0xe334('0x31')]['id'],'type':_0xe334('0x6d')};_0x2199e6[_0x2d9551+_0xe334('0x6e')]=_0x2fa27d['id'];_0x2199e6[_0x2d9551+_0xe334('0x6f')]=_0x2fa27d[_0xe334('0x6a')]['id'];_0x2199e6['From'+_0x2d9551+_0x3262de+'Id']=_0x2fa27d[_0xe334('0x6b')]['id'];_0x2199e6['To'+_0x2d9551+_0xe334('0x70')]=_0x43eecb['id'];return db[_0x2d9551+'TransferReport'][_0xe334('0x71')](_0x2199e6);})[_0xe334('0x16')](function(){return respondWithRpcPromise('Start',{'channel':_0x279934,'interaction':_0x2fa27d['Interaction'],'message':_0x2fa27d,'account':_0x2fa27d['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x43eecb['name']+','+(_0x2fa27d[_0xe334('0x6b')][_0xe334('0x72')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x860d3a,null))[_0xe334('0xd')](handleError(_0x860d3a,null));};};exports[_0xe334('0x73')]=function(_0x260d9d,_0x1a9abe){var _0x29c0b3,_0x24ec05;if(_[_0xe334('0x12')](_0x260d9d[_0xe334('0x20')][_0xe334('0x74')])){throw new Error(_0xe334('0x75'));}var _0x862ffe=_0x260d9d[_0xe334('0x20')]['channel'];var _0x5c5bf5=_[_0xe334('0x64')](_0x862ffe);var _0x215664=_0x862ffe===_0xe334('0x76')?_0xe334('0x65'):_0xe334('0x6b');return db[_0xe334('0x77')][_0xe334('0x67')]({'raw':!![],'where':{'id':_0x260d9d[_0xe334('0x19')]['id'],'role':_0xe334('0x3d')}})[_0xe334('0x16')](function(_0x4bd631){if(_[_0xe334('0x12')](_0x4bd631)){throw new Error(_0xe334('0x78'));}_0x29c0b3=_0x4bd631;return db[_0x5c5bf5+_0xe334('0x79')][_0xe334('0x67')]({'where':{'id':_0x260d9d[_0xe334('0x20')][_0xe334('0x69')]},'include':[{'model':db[_0x5c5bf5+_0xe334('0x6a')],'as':_0xe334('0x6a')},{'model':db[_0x5c5bf5+_0x215664],'as':_0xe334('0x6b')}]});})[_0xe334('0x16')](function(_0x2a08d2){if(_[_0xe334('0x12')](_0x2a08d2)){throw new Error(_0x5c5bf5+_0xe334('0x7a'));}_0x24ec05=_0x2a08d2;return _0x2a08d2['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x745351={'uniqueid':_0x862ffe+'.'+_0x24ec05['id']+'.'+_0x24ec05['Interaction']['id'],'FromUserId':_0x260d9d[_0xe334('0x31')]['id'],'type':_0xe334('0x6d'),'ToUserId':_0x29c0b3['id']};_0x745351[_0x5c5bf5+_0xe334('0x6e')]=_0x24ec05['id'];_0x745351[_0x5c5bf5+_0xe334('0x6f')]=_0x24ec05[_0xe334('0x6a')]['id'];_0x745351[_0xe334('0x7b')+_0x5c5bf5+_0x215664+'Id']=_0x24ec05['Account']['id'];return db[_0x5c5bf5+_0xe334('0x7c')][_0xe334('0x71')](_0x745351);})[_0xe334('0x16')](function(){return respondWithRpcPromise(_0xe334('0x7d'),{'channel':_0x862ffe,'interaction':_0x24ec05[_0xe334('0x6a')],'message':_0x24ec05,'account':_0x24ec05[_0xe334('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x29c0b3[_0xe334('0x11')]+','+(_0x24ec05['Account']['agentTransferTimeout']||0x12c),'interval':_0xe334('0x7e')}]},routingClient);})[_0xe334('0x16')](respondWithResult(_0x1a9abe,null))[_0xe334('0xd')](handleError(_0x1a9abe,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 5c5cc1f..9b20354 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 _0x1cb2=['run','post','create','put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/run'];(function(_0x3375b2,_0x571d5a){var _0x3fbd8e=function(_0x472b8c){while(--_0x472b8c){_0x3375b2['push'](_0x3375b2['shift']());}};_0x3fbd8e(++_0x571d5a);}(_0x1cb2,0xeb));var _0x21cb=function(_0x26bbfd,_0x4dde15){_0x26bbfd=_0x26bbfd-0x0;var _0x3044da=_0x1cb2[_0x26bbfd];return _0x3044da;};'use strict';var multer=require(_0x21cb('0x0'));var util=require(_0x21cb('0x1'));var path=require(_0x21cb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x21cb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x21cb('0x4'));var interaction=require(_0x21cb('0x5'));var config=require(_0x21cb('0x6'));var controller=require('./schedule.controller');router[_0x21cb('0x7')]('/',auth[_0x21cb('0x8')](),controller[_0x21cb('0x9')]);router[_0x21cb('0x7')](_0x21cb('0xa'),auth[_0x21cb('0x8')](),controller['show']);router[_0x21cb('0x7')](_0x21cb('0xb'),auth[_0x21cb('0x8')](),controller[_0x21cb('0xc')]);router[_0x21cb('0xd')]('/',auth[_0x21cb('0x8')](),controller[_0x21cb('0xe')]);router[_0x21cb('0xf')](_0x21cb('0xa'),auth[_0x21cb('0x8')](),controller[_0x21cb('0x10')]);router['delete']('/:id',auth[_0x21cb('0x8')](),controller[_0x21cb('0x11')]);module[_0x21cb('0x12')]=router; \ No newline at end of file +var _0xc9f6=['create','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post'];(function(_0x12c250,_0x326ae8){var _0x5eb220=function(_0x4484d0){while(--_0x4484d0){_0x12c250['push'](_0x12c250['shift']());}};_0x5eb220(++_0x326ae8);}(_0xc9f6,0x180));var _0x6c9f=function(_0x147264,_0x5da1dc){_0x147264=_0x147264-0x0;var _0x2f397e=_0xc9f6[_0x147264];return _0x2f397e;};'use strict';var multer=require(_0x6c9f('0x0'));var util=require('util');var path=require(_0x6c9f('0x1'));var timeout=require(_0x6c9f('0x2'));var express=require(_0x6c9f('0x3'));var router=express['Router']();var fs_extra=require(_0x6c9f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6c9f('0x5'));var controller=require(_0x6c9f('0x6'));router[_0x6c9f('0x7')]('/',auth[_0x6c9f('0x8')](),controller[_0x6c9f('0x9')]);router[_0x6c9f('0x7')](_0x6c9f('0xa'),auth[_0x6c9f('0x8')](),controller[_0x6c9f('0xb')]);router[_0x6c9f('0x7')](_0x6c9f('0xc'),auth[_0x6c9f('0x8')](),controller[_0x6c9f('0xd')]);router[_0x6c9f('0xe')]('/',auth['isAuthenticated'](),controller[_0x6c9f('0xf')]);router['put'](_0x6c9f('0xa'),auth[_0x6c9f('0x8')](),controller[_0x6c9f('0x10')]);router[_0x6c9f('0x11')]('/:id',auth[_0x6c9f('0x8')](),controller[_0x6c9f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 16a9fd6..d90da79 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 _0x3f8a=['days','hours','minutes','csv','pdf','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks'];(function(_0x1d048f,_0xef47aa){var _0x4a090d=function(_0x6e2763){while(--_0x6e2763){_0x1d048f['push'](_0x1d048f['shift']());}};_0x4a090d(++_0xef47aa);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x244d6b,_0x5e0b1d){_0x244d6b=_0x244d6b-0x0;var _0x43364c=_0x3f8a[_0x244d6b];return _0x43364c;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3f8('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![],'defaultValue':_0xa3f8('0x3')},'startAt':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa3f8('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa3f8('0x6')](_0xa3f8('0x7'),_0xa3f8('0x8'),_0xa3f8('0x9'),_0xa3f8('0xa'),_0xa3f8('0xb'),_0xa3f8('0xc'),_0xa3f8('0xd')),'allowNull':![],'defaultValue':_0xa3f8('0xb')},'output':{'type':Sequelize[_0xa3f8('0x6')](_0xa3f8('0xe'),_0xa3f8('0xf'),'xlsx'),'allowNull':![],'defaultValue':_0xa3f8('0xe')},'type':{'type':Sequelize[_0xa3f8('0x6')](_0xa3f8('0x10'),_0xa3f8('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xa3f8('0x12')],'defaultValue':![]},'email':{'type':Sequelize[_0xa3f8('0x2')]},'cc':{'type':Sequelize[_0xa3f8('0x13')]},'bcc':{'type':Sequelize[_0xa3f8('0x13')]},'sendIfEmpty':{'type':Sequelize[_0xa3f8('0x12')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4fb4=['TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','minutes','csv','pdf','xlsx','custom','default'];(function(_0x1b4612,_0x3f557f){var _0x314526=function(_0x49b3ec){while(--_0x49b3ec){_0x1b4612['push'](_0x1b4612['shift']());}};_0x314526(++_0x3f557f);}(_0x4fb4,0x190));var _0x44fb=function(_0xa02c81,_0x17e2a0){_0xa02c81=_0xa02c81-0x0;var _0x584018=_0x4fb4[_0xa02c81];return _0x584018;};'use strict';var Sequelize=require('sequelize');module[_0x44fb('0x0')]={'name':{'type':Sequelize[_0x44fb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x44fb('0x1')]},'active':{'type':Sequelize[_0x44fb('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x44fb('0x1')],'allowNull':![],'defaultValue':_0x44fb('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x44fb('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x44fb('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x44fb('0x6')](_0x44fb('0x7'),_0x44fb('0x8'),_0x44fb('0x9'),_0x44fb('0xa'),_0x44fb('0xb'),'hours',_0x44fb('0xc')),'allowNull':![],'defaultValue':_0x44fb('0xb')},'output':{'type':Sequelize['ENUM'](_0x44fb('0xd'),_0x44fb('0xe'),_0x44fb('0xf')),'allowNull':![],'defaultValue':_0x44fb('0xd')},'type':{'type':Sequelize[_0x44fb('0x6')](_0x44fb('0x10'),_0x44fb('0x11')),'allowNull':![],'defaultValue':_0x44fb('0x10')},'sendMail':{'type':Sequelize[_0x44fb('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x44fb('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x44fb('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x44fb('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 95d6711..fa172cf 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 _0x5fc3=['run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Scheduler','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId'];(function(_0x14ca26,_0xf6f7c2){var _0x2061e9=function(_0x4883bc){while(--_0x4883bc){_0x14ca26['push'](_0x14ca26['shift']());}};_0x2061e9(++_0xf6f7c2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x5fc3[_0x420b24];return _0x4da552;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['Schedule'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['Schedule'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));};exports[_0x35fc('0x51')]=function(_0x46c59b,_0x538be0,_0x2d9d45){var _0x757aa6=require(_0x35fc('0x52'));return db['Schedule'][_0x35fc('0x4f')]({'where':{'id':_0x46c59b[_0x35fc('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x538be0,null))[_0x35fc('0x24')](function(){_0x757aa6[_0x35fc('0x51')](_0x46c59b[_0x35fc('0x47')]['id']);})[_0x35fc('0x24')](respondWithStatusCode(_0x538be0,null))[_0x35fc('0x45')](handleError(_0x538be0,null));}; \ No newline at end of file +var _0x98a8=['reject','save','update','then','destroy','get','UserProfileResource','sendStatus','name','send','index','map','Schedule','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Scheduler','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','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','../../mysqldb','end','status','json','undefined','count','offset','apply'];(function(_0xf75622,_0x2cae64){var _0x2d1cd1=function(_0x3438f1){while(--_0x3438f1){_0xf75622['push'](_0xf75622['shift']());}};_0x2d1cd1(++_0x2cae64);}(_0x98a8,0x12c));var _0x898a=function(_0x5ba1c9,_0x4fa605){_0x5ba1c9=_0x5ba1c9-0x0;var _0x466952=_0x98a8[_0x5ba1c9];return _0x466952;};'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'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){var _0x32eca5=_0x274cdf[_0x898a('0x25')]({'plain':!![]});var _0x1426e3='Scheduler';return db[_0x898a('0x26')]['destroy']({'where':{'type':_0x1426e3,'resourceId':_0x32eca5['id']}})['then'](function(){return _0x274cdf;});})['then'](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x420b25,_0x40b3db){return function(_0x28ae6a){if(!_0x28ae6a){_0x420b25[_0x898a('0x27')](0x194);}return _0x28ae6a;};}function handleError(_0x398e98,_0xac1fc4){_0xac1fc4=_0xac1fc4||0x1f4;return function(_0xd31922){logger['error'](_0xd31922['stack']);if(_0xd31922['name']){delete _0xd31922[_0x898a('0x28')];}_0x398e98[_0x898a('0x1a')](_0xac1fc4)[_0x898a('0x29')](_0xd31922);};}exports[_0x898a('0x2a')]=function(_0x34f447,_0x560000){var _0xe3c983={},_0xf74645={},_0x18773a={'count':0x0,'rows':[]};var _0x4287da=_[_0x898a('0x2b')](db[_0x898a('0x2c')]['rawAttributes'],function(_0x7a1eb5){return{'name':_0x7a1eb5[_0x898a('0x2d')],'type':_0x7a1eb5[_0x898a('0x2e')][_0x898a('0x2f')]};});_0xf74645[_0x898a('0x30')]=_['map'](_0x4287da,'name');_0xf74645[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34f447[_0x898a('0x31')]);_0xf74645['filters']=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],_0xf74645[_0x898a('0x31')]);_0xe3c983[_0x898a('0x34')]=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],qs[_0x898a('0x35')](_0x34f447[_0x898a('0x31')]['fields']));_0xe3c983[_0x898a('0x34')]=_0xe3c983['attributes']['length']?_0xe3c983[_0x898a('0x34')]:_0xf74645['model'];if(!_0x34f447[_0x898a('0x31')]['hasOwnProperty'](_0x898a('0x36'))){_0xe3c983['limit']=qs[_0x898a('0x37')](_0x34f447[_0x898a('0x31')][_0x898a('0x37')]);_0xe3c983['offset']=qs['offset'](_0x34f447['query'][_0x898a('0x1e')]);}_0xe3c983[_0x898a('0x38')]=qs['sort'](_0x34f447[_0x898a('0x31')][_0x898a('0x39')]);_0xe3c983[_0x898a('0x3a')]=qs[_0x898a('0x3b')](_['pick'](_0x34f447['query'],_0xf74645[_0x898a('0x3b')]),_0x4287da);if(_0x34f447[_0x898a('0x31')]['filter']){_0xe3c983['where']=_[_0x898a('0x3c')](_0xe3c983[_0x898a('0x3a')],{'$or':_[_0x898a('0x2b')](_0x4287da,function(_0xa45405){if(_0xa45405['type']!==_0x898a('0x3d')){var _0x369c02={};_0x369c02[_0xa45405['name']]={'$like':'%'+_0x34f447['query']['filter']+'%'};return _0x369c02;}})});}_0xe3c983=_[_0x898a('0x3c')]({},_0xe3c983,_0x34f447[_0x898a('0x3e')]);var _0x35d767={'where':_0xe3c983[_0x898a('0x3a')]};return db[_0x898a('0x2c')][_0x898a('0x1d')](_0x35d767)[_0x898a('0x23')](function(_0x1432ec){_0x18773a[_0x898a('0x1d')]=_0x1432ec;if(_0x34f447[_0x898a('0x31')][_0x898a('0x3f')]){_0xe3c983[_0x898a('0x40')]=[{'all':!![]}];}return db[_0x898a('0x2c')][_0x898a('0x41')](_0xe3c983);})[_0x898a('0x23')](function(_0x4c8628){_0x18773a[_0x898a('0x42')]=_0x4c8628;return _0x18773a;})[_0x898a('0x23')](respondWithFilteredResult(_0x560000,_0xe3c983))[_0x898a('0x43')](handleError(_0x560000,null));};exports['show']=function(_0x34029e,_0x2e5451){var _0x3a8663={'raw':![],'where':{'id':_0x34029e[_0x898a('0x44')]['id']}},_0x6ab441={};_0x6ab441[_0x898a('0x30')]=_[_0x898a('0x32')](db[_0x898a('0x2c')]['rawAttributes']);_0x6ab441[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34029e[_0x898a('0x31')]);_0x6ab441[_0x898a('0x3b')]=_['intersection'](_0x6ab441[_0x898a('0x30')],_0x6ab441[_0x898a('0x31')]);_0x3a8663['attributes']=_[_0x898a('0x33')](_0x6ab441['model'],qs[_0x898a('0x35')](_0x34029e['query']['fields']));_0x3a8663[_0x898a('0x34')]=_0x3a8663['attributes'][_0x898a('0x45')]?_0x3a8663[_0x898a('0x34')]:_0x6ab441['model'];if(_0x34029e[_0x898a('0x31')][_0x898a('0x3f')]){_0x3a8663['include']=[{'all':!![]}];}_0x3a8663=_[_0x898a('0x3c')]({},_0x3a8663,_0x34029e[_0x898a('0x3e')]);return db[_0x898a('0x2c')][_0x898a('0x46')](_0x3a8663)['then'](handleEntityNotFound(_0x2e5451,null))[_0x898a('0x23')](respondWithResult(_0x2e5451,null))[_0x898a('0x43')](handleError(_0x2e5451,null));};exports['create']=function(_0x25adcc,_0x1d8c16){return db['Schedule'][_0x898a('0x47')](_0x25adcc['body'],{})[_0x898a('0x23')](function(_0x41f291){var _0x32ccb9=_0x25adcc['user'][_0x898a('0x25')]({'plain':!![]});if(!_0x32ccb9)throw new Error(_0x898a('0x48'));if(_0x32ccb9[_0x898a('0x49')]===_0x898a('0x4a')){var _0x5a8a2c=_0x41f291[_0x898a('0x25')]({'plain':!![]});var _0x529d7c=_0x898a('0x4b');return db[_0x898a('0x4c')][_0x898a('0x46')]({'where':{'name':_0x529d7c,'userProfileId':_0x32ccb9['userProfileId']},'raw':!![]})[_0x898a('0x23')](function(_0x3c4db0){if(_0x3c4db0&&_0x3c4db0[_0x898a('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a8a2c[_0x898a('0x28')],'resourceId':_0x5a8a2c['id'],'type':_0x3c4db0[_0x898a('0x28')],'sectionId':_0x3c4db0['id']},{})[_0x898a('0x23')](function(){return _0x41f291;});}else{return _0x41f291;}})[_0x898a('0x43')](function(_0x28b8c9){logger[_0x898a('0x4e')](_0x898a('0x4f'),_0x28b8c9);throw _0x28b8c9;});}return _0x41f291;})[_0x898a('0x23')](respondWithResult(_0x1d8c16,0xc9))[_0x898a('0x43')](handleError(_0x1d8c16,null));};exports[_0x898a('0x22')]=function(_0x2382a9,_0x5e9329){if(_0x2382a9[_0x898a('0x50')]['id']){delete _0x2382a9[_0x898a('0x50')]['id'];}return db['Schedule'][_0x898a('0x46')]({'where':{'id':_0x2382a9['params']['id']}})['then'](handleEntityNotFound(_0x5e9329,null))[_0x898a('0x23')](saveUpdates(_0x2382a9[_0x898a('0x50')],null))[_0x898a('0x23')](respondWithResult(_0x5e9329,null))['catch'](handleError(_0x5e9329,null));};exports['destroy']=function(_0x11a07a,_0x1f5e4b){return db['Schedule'][_0x898a('0x46')]({'where':{'id':_0x11a07a[_0x898a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f5e4b,null))[_0x898a('0x23')](removeEntity(_0x1f5e4b,null))[_0x898a('0x43')](handleError(_0x1f5e4b,null));};exports[_0x898a('0x51')]=function(_0x54bc75,_0xf29714,_0x2ef2f1){var _0x9c25ee=require(_0x898a('0x52'));return db[_0x898a('0x2c')][_0x898a('0x46')]({'where':{'id':_0x54bc75['params']['id']},'raw':!![]})[_0x898a('0x23')](handleEntityNotFound(_0xf29714,null))['then'](function(){_0x9c25ee[_0x898a('0x51')](_0x54bc75[_0x898a('0x44')]['id']);})[_0x898a('0x23')](respondWithStatusCode(_0xf29714,null))[_0x898a('0x43')](handleError(_0xf29714,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 11da7d8..c6011c6 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 _0x576f=['../../config/logger','api','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util'];(function(_0x1fdc57,_0x2c74dc){var _0x1d25fa=function(_0x4937ed){while(--_0x4937ed){_0x1fdc57['push'](_0x1fdc57['shift']());}};_0x1d25fa(++_0x2c74dc);}(_0x576f,0x136));var _0xf576=function(_0xa8d94a,_0x275cca){_0xa8d94a=_0xa8d94a-0x0;var _0x4ef58f=_0x576f[_0xa8d94a];return _0x4ef58f;};'use strict';var _=require(_0xf576('0x0'));var util=require(_0xf576('0x1'));var logger=require(_0xf576('0x2'))(_0xf576('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf576('0x4'));var rimraf=require(_0xf576('0x5'));var config=require(_0xf576('0x6'));var attributes=require(_0xf576('0x7'));module[_0xf576('0x8')]=function(_0x569ccb,_0x20d589){return _0x569ccb[_0xf576('0x9')](_0xf576('0xa'),attributes,{'tableName':_0xf576('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dcb=['define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./schedule.attributes','exports'];(function(_0x41ad38,_0x160262){var _0x5c240b=function(_0x580d62){while(--_0x580d62){_0x41ad38['push'](_0x41ad38['shift']());}};_0x5c240b(++_0x160262);}(_0x5dcb,0xfa));var _0xb5dc=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x5dcb[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xb5dc('0x0'));var util=require(_0xb5dc('0x1'));var logger=require(_0xb5dc('0x2'))(_0xb5dc('0x3'));var moment=require(_0xb5dc('0x4'));var BPromise=require(_0xb5dc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb5dc('0x6'));var config=require(_0xb5dc('0x7'));var attributes=require(_0xb5dc('0x8'));module[_0xb5dc('0x9')]=function(_0x332d71,_0x4d36dd){return _0x332d71[_0xb5dc('0xa')](_0xb5dc('0xb'),attributes,{'tableName':_0xb5dc('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 419d9fc..ac95b95 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 _0x165f=['debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','Schedule,\x20%s,\x20%s','info','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request'];(function(_0xaa422b,_0x4cd3b6){var _0x2408f1=function(_0x1cfee8){while(--_0x1cfee8){_0xaa422b['push'](_0xaa422b['shift']());}};_0x2408f1(++_0x4cd3b6);}(_0x165f,0xbe));var _0xf165=function(_0x62d95e,_0x599d04){_0x62d95e=_0x62d95e-0x0;var _0x14ee47=_0x165f[_0x62d95e];return _0x14ee47;};'use strict';var _=require(_0xf165('0x0'));var util=require(_0xf165('0x1'));var moment=require(_0xf165('0x2'));var BPromise=require(_0xf165('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf165('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf165('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf165('0x6'));var jayson=require(_0xf165('0x7'));var client=jayson[_0xf165('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a814c,_0x3c54a3,_0x5cfeb6){return new BPromise(function(_0x127749,_0xea90fe){return client[_0xf165('0x9')](_0x1a814c,_0x5cfeb6)['then'](function(_0x301e94){logger['info']('Schedule,\x20%s,\x20%s',_0x3c54a3,'request\x20sent');logger[_0xf165('0xa')](_0xf165('0xb'),_0x3c54a3,'request\x20sent',JSON[_0xf165('0xc')](_0x301e94));if(_0x301e94[_0xf165('0xd')]){if(_0x301e94['error']['code']===0x1f4){logger[_0xf165('0xd')]('Schedule,\x20%s,\x20%s',_0x3c54a3,_0x301e94[_0xf165('0xd')][_0xf165('0xe')]);return _0xea90fe(_0x301e94[_0xf165('0xd')][_0xf165('0xe')]);}logger[_0xf165('0xd')](_0xf165('0xf'),_0x3c54a3,_0x301e94[_0xf165('0xd')][_0xf165('0xe')]);return _0x127749(_0x301e94['error'][_0xf165('0xe')]);}else{logger[_0xf165('0x10')](_0xf165('0xf'),_0x3c54a3,_0xf165('0x11'));_0x127749(_0x301e94[_0xf165('0x12')][_0xf165('0xe')]);}})[_0xf165('0x13')](function(_0xfddf4d){logger[_0xf165('0xd')](_0xf165('0xf'),_0x3c54a3,_0xfddf4d);_0xea90fe(_0xfddf4d);});});} \ No newline at end of file +var _0xb423=['../../config/logger','rpc','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','ioredis','../../config/utils'];(function(_0x206163,_0x241540){var _0x1f85ff=function(_0x2fba71){while(--_0x2fba71){_0x206163['push'](_0x206163['shift']());}};_0x1f85ff(++_0x241540);}(_0xb423,0x160));var _0x3b42=function(_0x113650,_0x4adb3e){_0x113650=_0x113650-0x0;var _0x10e2d6=_0xb423[_0x113650];return _0x10e2d6;};'use strict';var _=require(_0x3b42('0x0'));var util=require(_0x3b42('0x1'));var moment=require(_0x3b42('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b42('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b42('0x4'));var logger=require(_0x3b42('0x5'))(_0x3b42('0x6'));var config=require('../../config/environment');var jayson=require(_0x3b42('0x7'));var client=jayson[_0x3b42('0x8')][_0x3b42('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14bb1f,_0x337630,_0x18b5c0){return new BPromise(function(_0x1dc84a,_0xb87268){return client[_0x3b42('0xa')](_0x14bb1f,_0x18b5c0)[_0x3b42('0xb')](function(_0x5c3a62){logger['info'](_0x3b42('0xc'),_0x337630,_0x3b42('0xd'));logger['debug'](_0x3b42('0xe'),_0x337630,_0x3b42('0xd'),JSON[_0x3b42('0xf')](_0x5c3a62));if(_0x5c3a62[_0x3b42('0x10')]){if(_0x5c3a62[_0x3b42('0x10')][_0x3b42('0x11')]===0x1f4){logger[_0x3b42('0x10')](_0x3b42('0xc'),_0x337630,_0x5c3a62[_0x3b42('0x10')][_0x3b42('0x12')]);return _0xb87268(_0x5c3a62[_0x3b42('0x10')][_0x3b42('0x12')]);}logger[_0x3b42('0x10')](_0x3b42('0xc'),_0x337630,_0x5c3a62[_0x3b42('0x10')]['message']);return _0x1dc84a(_0x5c3a62['error'][_0x3b42('0x12')]);}else{logger[_0x3b42('0x13')](_0x3b42('0xc'),_0x337630,'request\x20sent');_0x1dc84a(_0x5c3a62[_0x3b42('0x14')][_0x3b42('0x12')]);}})['catch'](function(_0x59d299){logger[_0x3b42('0x10')]('Schedule,\x20%s,\x20%s',_0x337630,_0x59d299);_0xb87268(_0x59d299);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index d9504ba..671a1c9 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 _0x3636=['download','post','create','put','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0x4e9ad4,_0x1cfaa8){var _0x448197=function(_0x4e223d){while(--_0x4e223d){_0x4e9ad4['push'](_0x4e9ad4['shift']());}};_0x448197(++_0x1cfaa8);}(_0x3636,0x99));var _0x6363=function(_0x3f7ac5,_0x32fe36){_0x3f7ac5=_0x3f7ac5-0x0;var _0x2d37a6=_0x3636[_0x3f7ac5];return _0x2d37a6;};'use strict';var multer=require(_0x6363('0x0'));var util=require(_0x6363('0x1'));var path=require(_0x6363('0x2'));var timeout=require(_0x6363('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6363('0x4'));var auth=require(_0x6363('0x5'));var interaction=require(_0x6363('0x6'));var config=require(_0x6363('0x7'));var controller=require(_0x6363('0x8'));router[_0x6363('0x9')]('/',auth['isAuthenticated'](),controller[_0x6363('0xa')]);router[_0x6363('0x9')](_0x6363('0xb'),auth['isAuthenticated'](),controller[_0x6363('0xc')]);router[_0x6363('0x9')](_0x6363('0xd'),auth[_0x6363('0xe')](),controller['show']);router[_0x6363('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x6363('0xf')]);router[_0x6363('0x10')]('/',auth[_0x6363('0xe')](),controller[_0x6363('0x11')]);router[_0x6363('0x12')](_0x6363('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x6363('0x13')](_0x6363('0xd'),auth[_0x6363('0xe')](),controller[_0x6363('0x14')]);module['exports']=router; \ No newline at end of file +var _0x88b2=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','download','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x62067d,_0x12bc5f){var _0x2f33b1=function(_0x79e25b){while(--_0x79e25b){_0x62067d['push'](_0x62067d['shift']());}};_0x2f33b1(++_0x12bc5f);}(_0x88b2,0xde));var _0x288b=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x88b2[_0x5d80de];return _0x1c7556;};'use strict';var multer=require('multer');var util=require(_0x288b('0x0'));var path=require(_0x288b('0x1'));var timeout=require(_0x288b('0x2'));var express=require(_0x288b('0x3'));var router=express[_0x288b('0x4')]();var fs_extra=require(_0x288b('0x5'));var auth=require(_0x288b('0x6'));var interaction=require(_0x288b('0x7'));var config=require(_0x288b('0x8'));var controller=require('./screenRecording.controller');router[_0x288b('0x9')]('/',auth[_0x288b('0xa')](),controller['index']);router['get'](_0x288b('0xb'),auth['isAuthenticated'](),controller[_0x288b('0xc')]);router[_0x288b('0x9')](_0x288b('0xd'),auth[_0x288b('0xa')](),controller[_0x288b('0xe')]);router[_0x288b('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x288b('0xf')]);router[_0x288b('0x10')]('/',auth['isAuthenticated'](),controller[_0x288b('0x11')]);router[_0x288b('0x12')](_0x288b('0xd'),auth[_0x288b('0xa')](),controller[_0x288b('0x13')]);router[_0x288b('0x14')](_0x288b('0xd'),auth[_0x288b('0xa')](),controller[_0x288b('0x15')]);module[_0x288b('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index e799d9d..8361426 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 _0x9c5a=['value','INTEGER','startedAt','subtract','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','extname','STRING','setDataValue'];(function(_0x3b013e,_0x404d46){var _0xebb35=function(_0x365bf6){while(--_0x365bf6){_0x3b013e['push'](_0x3b013e['shift']());}};_0xebb35(++_0x404d46);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x29e11a,_0x4bab2b){_0x29e11a=_0x29e11a-0x0;var _0x2fbe88=_0x9c5a[_0x29e11a];return _0x2fbe88;};'use strict';var Sequelize=require(_0xa9c5('0x0'));var moment=require(_0xa9c5('0x1'));var path=require('path');var config=require(_0xa9c5('0x2'));module[_0xa9c5('0x3')]={'format':{'type':Sequelize[_0xa9c5('0x4')],'get':function(){return this[_0xa9c5('0x5')]('value')?path[_0xa9c5('0x6')](this[_0xa9c5('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xa9c5('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xa9c5('0x7')],'set':function(_0x3df556){var _0x4cb597=_0x3df556['replace'](/\\/g,'/');this[_0xa9c5('0x8')](_0xa9c5('0x9'),_0x4cb597);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa9c5('0xa')],'set':function(_0x97f9e2){this['setDataValue'](_0xa9c5('0xb'),moment()[_0xa9c5('0xc')](_0x97f9e2,'ms'));this['setDataValue']('closedAt',moment());this[_0xa9c5('0x8')](_0xa9c5('0xd'),_0x97f9e2);}},'startedAt':{'type':Sequelize[_0xa9c5('0xe')],'get':function(){return moment(this[_0xa9c5('0x5')](_0xa9c5('0xb')))[_0xa9c5('0xf')](_0xa9c5('0x10'))[_0xa9c5('0x11')]();}},'closedAt':{'type':Sequelize[_0xa9c5('0xe')],'get':function(){return moment(this[_0xa9c5('0x5')]('closedAt'))[_0xa9c5('0xf')](_0xa9c5('0x10'))[_0xa9c5('0x11')]();}},'createdAt':{'type':Sequelize[_0xa9c5('0xe')],'get':function(){return moment(this[_0xa9c5('0x5')](_0xa9c5('0x12')))[_0xa9c5('0xf')](_0xa9c5('0x10'))[_0xa9c5('0x11')]();}},'updatedAt':{'type':Sequelize[_0xa9c5('0xe')],'get':function(){return moment(this['getDataValue'](_0xa9c5('0x13')))[_0xa9c5('0xf')](_0xa9c5('0x10'))['toString']();}}}; \ No newline at end of file +var _0x5c12=['getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','moment','path','exports','VIRTUAL'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0x5c12,0x188));var _0x25c1=function(_0x311666,_0x17b07d){_0x311666=_0x311666-0x0;var _0x2bc692=_0x5c12[_0x311666];return _0x2bc692;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var config=require('../../config/environment');module[_0x25c1('0x2')]={'format':{'type':Sequelize[_0x25c1('0x3')],'get':function(){return this[_0x25c1('0x4')](_0x25c1('0x5'))?path[_0x25c1('0x6')](this[_0x25c1('0x4')](_0x25c1('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x25c1('0x7')]},'value':{'type':Sequelize[_0x25c1('0x7')],'set':function(_0x382922){var _0x4ab674=_0x382922['replace'](/\\/g,'/');this[_0x25c1('0x8')](_0x25c1('0x5'),_0x4ab674);}},'rating':{'type':Sequelize[_0x25c1('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x25c1('0x9')],'set':function(_0xf8363f){this['setDataValue'](_0x25c1('0xa'),moment()[_0x25c1('0xb')](_0xf8363f,'ms'));this[_0x25c1('0x8')](_0x25c1('0xc'),moment());this[_0x25c1('0x8')]('duration',_0xf8363f);}},'startedAt':{'type':Sequelize[_0x25c1('0xd')],'get':function(){return moment(this[_0x25c1('0x4')]('startedAt'))[_0x25c1('0xe')](_0x25c1('0xf'))[_0x25c1('0x10')]();}},'closedAt':{'type':Sequelize[_0x25c1('0xd')],'get':function(){return moment(this['getDataValue']('closedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x25c1('0x10')]();}},'createdAt':{'type':Sequelize[_0x25c1('0xd')],'get':function(){return moment(this[_0x25c1('0x4')](_0x25c1('0x11')))[_0x25c1('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x25c1('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0x25c1('0xe')](_0x25c1('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index e0d836f..4b4b59d 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 _0x4a6d=['unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','ScreenRecording','includeAll','include','findAll','catch','show','params','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','recording','ValidationError','extname','unlink','message','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4a6d,0x1ec));var _0xd4a6=function(_0x348e70,_0x299276){_0x348e70=_0x348e70-0x0;var _0x40497a=_0x4a6d[_0x348e70];return _0x40497a;};'use strict';var emlformat=require(_0xd4a6('0x0'));var rimraf=require(_0xd4a6('0x1'));var zipdir=require(_0xd4a6('0x2'));var jsonpatch=require(_0xd4a6('0x3'));var rp=require(_0xd4a6('0x4'));var moment=require(_0xd4a6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd4a6('0x6'));var util=require(_0xd4a6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd4a6('0x8'));var ejs=require(_0xd4a6('0x9'));var fs=require('fs');var fs_extra=require(_0xd4a6('0xa'));var _=require(_0xd4a6('0xb'));var squel=require(_0xd4a6('0xc'));var crypto=require('crypto');var jsforce=require(_0xd4a6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd4a6('0x8'));var querystring=require(_0xd4a6('0xe'));var Papa=require('papaparse');var Redis=require(_0xd4a6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd4a6('0x10'));var as=require(_0xd4a6('0x11'));var hardwareService=require(_0xd4a6('0x12'));var logger=require('../../config/logger')(_0xd4a6('0x13'));var utils=require(_0xd4a6('0x14'));var config=require(_0xd4a6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd4a6('0x16'))['db'];function respondWithStatusCode(_0x372037,_0x37724f){_0x37724f=_0x37724f||0xcc;return function(_0x5cbd7c){if(_0x5cbd7c){return _0x372037['sendStatus'](_0x37724f);}return _0x372037['status'](_0x37724f)[_0xd4a6('0x17')]();};}function respondWithResult(_0x5c995d,_0x3e9b7f){_0x3e9b7f=_0x3e9b7f||0xc8;return function(_0x5b51fb){if(_0x5b51fb){return _0x5c995d[_0xd4a6('0x18')](_0x3e9b7f)[_0xd4a6('0x19')](_0x5b51fb);}};}function respondWithFilteredResult(_0x28d154,_0x1078a6){return function(_0x854d5f){if(_0x854d5f){var _0x3284e7=typeof _0x1078a6[_0xd4a6('0x1a')]===_0xd4a6('0x1b')&&typeof _0x1078a6[_0xd4a6('0x1c')]==='undefined';var _0x475790=_0x854d5f[_0xd4a6('0x1d')];var _0x5b208b=_0x3284e7?0x0:_0x1078a6[_0xd4a6('0x1a')];var _0x48ce00=_0x3284e7?_0x854d5f[_0xd4a6('0x1d')]:_0x1078a6[_0xd4a6('0x1a')]+_0x1078a6[_0xd4a6('0x1c')];var _0xc1688f;if(_0x48ce00>=_0x475790){_0x48ce00=_0x475790;_0xc1688f=0xc8;}else{_0xc1688f=0xce;}_0x28d154[_0xd4a6('0x18')](_0xc1688f);return _0x28d154[_0xd4a6('0x1e')](_0xd4a6('0x1f'),_0x5b208b+'-'+_0x48ce00+'/'+_0x475790)[_0xd4a6('0x19')](_0x854d5f);}return null;};}function patchUpdates(_0xbcfc6f){return function(_0x130e94){try{jsonpatch[_0xd4a6('0x20')](_0x130e94,_0xbcfc6f,!![]);}catch(_0x3b26d6){return BPromise['reject'](_0x3b26d6);}return _0x130e94[_0xd4a6('0x21')]();};}function saveUpdates(_0x5a6c4b,_0x18fbeb){return function(_0x19618d){if(_0x19618d){return _0x19618d[_0xd4a6('0x22')](_0x5a6c4b)[_0xd4a6('0x23')](function(_0xdc4a13){return _0xdc4a13;});}return null;};}function removeEntity(_0x1fdf85,_0x2c7466){return function(_0x25f7e3){if(_0x25f7e3){return _0x25f7e3[_0xd4a6('0x24')]()[_0xd4a6('0x23')](function(){_0x1fdf85[_0xd4a6('0x18')](0xcc)[_0xd4a6('0x17')]();});}};}function handleEntityNotFound(_0x47c4f1,_0x454838){return function(_0x5c6af1){if(!_0x5c6af1){_0x47c4f1[_0xd4a6('0x25')](0x194);}return _0x5c6af1;};}function handleError(_0x52ca2f,_0x1a6ed1){_0x1a6ed1=_0x1a6ed1||0x1f4;return function(_0xde3ac7){logger['error'](_0xde3ac7[_0xd4a6('0x26')]);if(_0xde3ac7[_0xd4a6('0x27')]){delete _0xde3ac7[_0xd4a6('0x27')];}_0x52ca2f[_0xd4a6('0x18')](_0x1a6ed1)[_0xd4a6('0x28')](_0xde3ac7);};}exports[_0xd4a6('0x29')]=function(_0x192ccb,_0x1a41aa){var _0x5350f5={},_0x2dfc5b={},_0x4e2f6b={'count':0x0,'rows':[]};var _0x466ee7=_[_0xd4a6('0x2a')](db['ScreenRecording'][_0xd4a6('0x2b')],function(_0x11533a){return{'name':_0x11533a[_0xd4a6('0x2c')],'type':_0x11533a[_0xd4a6('0x2d')][_0xd4a6('0x2e')]};});_0x2dfc5b[_0xd4a6('0x2f')]=_['differenceBy'](_[_0xd4a6('0x2a')](_0x466ee7,_0xd4a6('0x27')),['format']);_0x2dfc5b['query']=_[_0xd4a6('0x30')](_0x192ccb[_0xd4a6('0x31')]);_0x2dfc5b[_0xd4a6('0x32')]=_[_0xd4a6('0x33')](_0x2dfc5b[_0xd4a6('0x2f')],_0x2dfc5b['query']);_0x5350f5[_0xd4a6('0x34')]=_[_0xd4a6('0x33')](_0x2dfc5b[_0xd4a6('0x2f')],qs[_0xd4a6('0x35')](_0x192ccb[_0xd4a6('0x31')][_0xd4a6('0x35')]));_0x5350f5['attributes']=_0x5350f5[_0xd4a6('0x34')][_0xd4a6('0x36')]?_0x5350f5[_0xd4a6('0x34')]:_0x2dfc5b[_0xd4a6('0x2f')];if(!_0x192ccb[_0xd4a6('0x31')][_0xd4a6('0x37')]('nolimit')){_0x5350f5[_0xd4a6('0x1c')]=qs['limit'](_0x192ccb[_0xd4a6('0x31')]['limit']);_0x5350f5[_0xd4a6('0x1a')]=qs[_0xd4a6('0x1a')](_0x192ccb[_0xd4a6('0x31')][_0xd4a6('0x1a')]);}_0x5350f5[_0xd4a6('0x38')]=qs['sort'](_0x192ccb['query']['sort']);_0x5350f5[_0xd4a6('0x39')]=qs['filters'](_['pick'](_0x192ccb[_0xd4a6('0x31')],_0x2dfc5b[_0xd4a6('0x32')]),_0x466ee7);if(_0x192ccb['query'][_0xd4a6('0x3a')]){_0x5350f5[_0xd4a6('0x39')]=_['merge'](_0x5350f5[_0xd4a6('0x39')],{'$or':_[_0xd4a6('0x2a')](_0x466ee7,function(_0x428f5e){if(_0x428f5e['type']!==_0xd4a6('0x3b')){var _0x51bd11={};_0x51bd11[_0x428f5e['name']]={'$like':'%'+_0x192ccb[_0xd4a6('0x31')]['filter']+'%'};return _0x51bd11;}})});}_0x5350f5=_[_0xd4a6('0x3c')]({},_0x5350f5,_0x192ccb[_0xd4a6('0x3d')]);var _0x5780db={'where':_0x5350f5[_0xd4a6('0x39')]};return db[_0xd4a6('0x3e')][_0xd4a6('0x1d')](_0x5780db)['then'](function(_0x105583){_0x4e2f6b[_0xd4a6('0x1d')]=_0x105583;if(_0x192ccb[_0xd4a6('0x31')][_0xd4a6('0x3f')]){_0x5350f5[_0xd4a6('0x40')]=[{'all':!![]}];}return db[_0xd4a6('0x3e')][_0xd4a6('0x41')](_0x5350f5);})[_0xd4a6('0x23')](function(_0x546f5f){_0x4e2f6b['rows']=_0x546f5f;return _0x4e2f6b;})[_0xd4a6('0x23')](respondWithFilteredResult(_0x1a41aa,_0x5350f5))[_0xd4a6('0x42')](handleError(_0x1a41aa,null));};exports[_0xd4a6('0x43')]=function(_0x347651,_0x5480f5){var _0x567d2d={'raw':![],'where':{'id':_0x347651[_0xd4a6('0x44')]['id']}},_0x29e652={};_0x29e652[_0xd4a6('0x2f')]=_['keys'](db[_0xd4a6('0x3e')][_0xd4a6('0x2b')]);_0x29e652['query']=_[_0xd4a6('0x30')](_0x347651[_0xd4a6('0x31')]);_0x29e652['filters']=_['intersection'](_0x29e652['model'],_0x29e652[_0xd4a6('0x31')]);_0x567d2d[_0xd4a6('0x34')]=_[_0xd4a6('0x33')](_0x29e652[_0xd4a6('0x2f')],qs[_0xd4a6('0x35')](_0x347651[_0xd4a6('0x31')][_0xd4a6('0x35')]));_0x567d2d[_0xd4a6('0x34')]=_0x567d2d[_0xd4a6('0x34')][_0xd4a6('0x36')]?_0x567d2d[_0xd4a6('0x34')]:_0x29e652['model'];if(_0x347651['query'][_0xd4a6('0x3f')]){_0x567d2d[_0xd4a6('0x40')]=[{'all':!![]}];}_0x567d2d=_['merge']({},_0x567d2d,_0x347651['options']);return db[_0xd4a6('0x3e')][_0xd4a6('0x45')](_0x567d2d)[_0xd4a6('0x23')](handleEntityNotFound(_0x5480f5,null))[_0xd4a6('0x23')](respondWithResult(_0x5480f5,null))[_0xd4a6('0x42')](handleError(_0x5480f5,null));};exports[_0xd4a6('0x46')]=function(_0x1347b1,_0x27fd46){return db[_0xd4a6('0x3e')][_0xd4a6('0x46')](_0x1347b1['body'],{})[_0xd4a6('0x23')](respondWithResult(_0x27fd46,0xc9))[_0xd4a6('0x42')](handleError(_0x27fd46,null));};exports['update']=function(_0x25468d,_0x1432e2){if(_0x25468d['body']['id']){delete _0x25468d[_0xd4a6('0x47')]['id'];}delete _0x25468d['body'][_0xd4a6('0x48')];delete _0x25468d['body'][_0xd4a6('0x49')];delete _0x25468d[_0xd4a6('0x47')][_0xd4a6('0x4a')];delete _0x25468d[_0xd4a6('0x47')][_0xd4a6('0x4b')];return db[_0xd4a6('0x3e')][_0xd4a6('0x45')]({'where':{'id':_0x25468d['params']['id']}})['then'](handleEntityNotFound(_0x1432e2,null))['then'](saveUpdates(_0x25468d['body'],null))['then'](respondWithResult(_0x1432e2,null))[_0xd4a6('0x42')](handleError(_0x1432e2,null));};exports[_0xd4a6('0x4c')]=function(_0x443ff8,_0x505400){return db[_0xd4a6('0x3e')]['describe']()[_0xd4a6('0x23')](respondWithResult(_0x505400,null))[_0xd4a6('0x42')](handleError(_0x505400,null));};exports[_0xd4a6('0x4d')]=function(_0x3ff29c,_0x1a4170,_0x18b7e7){var _0x11d76a=require(_0xd4a6('0x4e'));var _0x5d0f97=![];var _0x3aa48a={};if(_0x3ff29c[_0xd4a6('0x31')][_0xd4a6('0x2d')]&&_0x3ff29c[_0xd4a6('0x31')][_0xd4a6('0x2d')]===_0xd4a6('0x4f')){_0x3aa48a[_0xd4a6('0x4f')]=_0x3ff29c[_0xd4a6('0x44')]['id'];}else{_0x3aa48a['id']=_0x3ff29c[_0xd4a6('0x44')]['id'];}return db[_0xd4a6('0x3e')][_0xd4a6('0x45')]({'where':_0x3aa48a,'attributes':['id','value'],'raw':!![]})[_0xd4a6('0x23')](handleEntityNotFound(_0x1a4170,null))['then'](function(_0x2e9cb7){if(_0x2e9cb7){var _0x2c4ef4=path[_0xd4a6('0x50')](config[_0xd4a6('0x51')],_0xd4a6('0x52'),_0x2e9cb7[_0xd4a6('0x4b')]);var _0x54c2f2=util[_0xd4a6('0x53')](_0xd4a6('0x54'),_0x2c4ef4);if(fs[_0xd4a6('0x55')](_0x54c2f2)){_0x5d0f97=!![];return _0x11d76a['decryptFile'](_0x54c2f2,_0x2c4ef4,config['secrets'][_0xd4a6('0x56')])[_0xd4a6('0x23')](function(){return _0x2e9cb7;});}return _0x2e9cb7;}})[_0xd4a6('0x23')](function(_0x4924d0){if(_0x4924d0){var _0x1e2666=path[_0xd4a6('0x50')](config[_0xd4a6('0x51')],_0xd4a6('0x52'),_0x4924d0[_0xd4a6('0x4b')]);if(!fs[_0xd4a6('0x55')](_0x1e2666)){throw new db['Sequelize'][(_0xd4a6('0x57'))]('ScreenRecording\x20not\x20found');}if(_0x4924d0['filename']){return _0x1a4170[_0xd4a6('0x4d')](_0x1e2666,_0x4924d0['filename']+path[_0xd4a6('0x58')](_0x1e2666),function(){if(_0x5d0f97){fs[_0xd4a6('0x59')](_0x1e2666);}});}else{return _0x1a4170[_0xd4a6('0x4d')](_0x1e2666,function(_0x127861){if(_0x5d0f97){fs['unlink'](_0x1e2666);}});}}})['catch'](function(_0x6c3485){if(_0x6c3485[_0xd4a6('0x5a')]==='ScreenRecording\x20not\x20found'){_0x1a4170[_0xd4a6('0x18')](0x194)[_0xd4a6('0x28')]('Not\x20found');}else{return handleError(_0x1a4170,null);}});};exports[_0xd4a6('0x24')]=function(_0x2b7dfa,_0x447119){return db[_0xd4a6('0x3e')][_0xd4a6('0x45')]({'where':{'id':_0x2b7dfa[_0xd4a6('0x44')]['id']}})[_0xd4a6('0x23')](function(_0x502c57){if(_[_0xd4a6('0x5b')](_0x502c57)){throw new ReferenceError(_0xd4a6('0x5c'));}return _0x502c57;})[_0xd4a6('0x23')](function(_0x4859d2){var _0x1d6a4f=path['join'](config[_0xd4a6('0x51')],_0xd4a6('0x52'),_0x4859d2['value']);logger['info'](_0xd4a6('0x5d'),_0x1d6a4f);if(!_[_0xd4a6('0x5b')](_0x4859d2[_0xd4a6('0x4b')])&&fs['existsSync'](_0x1d6a4f)){logger[_0xd4a6('0x5e')]('File:\x20\x22'+_0x1d6a4f+_0xd4a6('0x5f'));fs[_0xd4a6('0x60')](_0x1d6a4f);}_0x1d6a4f=_0x1d6a4f+_0xd4a6('0x61');if(!_[_0xd4a6('0x5b')](_0x4859d2['value'])&&fs[_0xd4a6('0x55')](_0x1d6a4f)){logger[_0xd4a6('0x5e')]('File:\x20\x22'+_0x1d6a4f+_0xd4a6('0x5f'));fs['unlinkSync'](_0x1d6a4f);}return _0x4859d2;})[_0xd4a6('0x23')](function(_0x438f45){if(!_0x438f45)throw new InternalError();return _0x438f45['destroy']();})['then'](function(){_0x447119['status'](0xcc)['end']();})[_0xd4a6('0x42')](handleError(_0x447119,null));}; \ No newline at end of file +var _0x7c63=['../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','ScreenRecording','fieldName','type','key','format','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','keys','rawAttributes','options','create','body','duration','describe','download','uniqueid','params','find','server/files/screen_recordings','value','existsSync','secrets','join','root','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','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'];(function(_0x4cb88e,_0x5be15d){var _0x4738c5=function(_0x4d2d1b){while(--_0x4d2d1b){_0x4cb88e['push'](_0x4cb88e['shift']());}};_0x4738c5(++_0x5be15d);}(_0x7c63,0x112));var _0x37c6=function(_0x468224,_0x3ba21d){_0x468224=_0x468224-0x0;var _0x3db442=_0x7c63[_0x468224];return _0x3db442;};'use strict';var emlformat=require(_0x37c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x37c6('0x1'));var jsonpatch=require(_0x37c6('0x2'));var rp=require(_0x37c6('0x3'));var moment=require(_0x37c6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x37c6('0x5'));var util=require(_0x37c6('0x6'));var path=require(_0x37c6('0x7'));var sox=require(_0x37c6('0x8'));var csv=require(_0x37c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x37c6('0xa'));var _=require('lodash');var squel=require(_0x37c6('0xb'));var crypto=require('crypto');var jsforce=require(_0x37c6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x37c6('0x9'));var querystring=require(_0x37c6('0xd'));var Papa=require(_0x37c6('0xe'));var Redis=require('ioredis');var authService=require(_0x37c6('0xf'));var qs=require(_0x37c6('0x10'));var as=require(_0x37c6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x37c6('0x12'))(_0x37c6('0x13'));var utils=require(_0x37c6('0x14'));var config=require(_0x37c6('0x15'));var licenseUtil=require(_0x37c6('0x16'));var db=require(_0x37c6('0x17'))['db'];function respondWithStatusCode(_0x4915b7,_0x533fd8){_0x533fd8=_0x533fd8||0xcc;return function(_0x5b13e4){if(_0x5b13e4){return _0x4915b7[_0x37c6('0x18')](_0x533fd8);}return _0x4915b7[_0x37c6('0x19')](_0x533fd8)[_0x37c6('0x1a')]();};}function respondWithResult(_0x1fdfa1,_0x34572d){_0x34572d=_0x34572d||0xc8;return function(_0x1c6b12){if(_0x1c6b12){return _0x1fdfa1[_0x37c6('0x19')](_0x34572d)['json'](_0x1c6b12);}};}function respondWithFilteredResult(_0x5a5444,_0x5111f8){return function(_0x217e81){if(_0x217e81){var _0x36e259=typeof _0x5111f8[_0x37c6('0x1b')]==='undefined'&&typeof _0x5111f8['limit']===_0x37c6('0x1c');var _0x419fd5=_0x217e81[_0x37c6('0x1d')];var _0x5e76f2=_0x36e259?0x0:_0x5111f8['offset'];var _0x136ddb=_0x36e259?_0x217e81[_0x37c6('0x1d')]:_0x5111f8[_0x37c6('0x1b')]+_0x5111f8[_0x37c6('0x1e')];var _0x2b7d03;if(_0x136ddb>=_0x419fd5){_0x136ddb=_0x419fd5;_0x2b7d03=0xc8;}else{_0x2b7d03=0xce;}_0x5a5444[_0x37c6('0x19')](_0x2b7d03);return _0x5a5444[_0x37c6('0x1f')](_0x37c6('0x20'),_0x5e76f2+'-'+_0x136ddb+'/'+_0x419fd5)[_0x37c6('0x21')](_0x217e81);}return null;};}function patchUpdates(_0x6c51a9){return function(_0x1d6943){try{jsonpatch[_0x37c6('0x22')](_0x1d6943,_0x6c51a9,!![]);}catch(_0x3972db){return BPromise[_0x37c6('0x23')](_0x3972db);}return _0x1d6943[_0x37c6('0x24')]();};}function saveUpdates(_0xd0f47f,_0x2a523c){return function(_0x1ddc94){if(_0x1ddc94){return _0x1ddc94[_0x37c6('0x25')](_0xd0f47f)[_0x37c6('0x26')](function(_0x1261ee){return _0x1261ee;});}return null;};}function removeEntity(_0x328b58,_0x5f4108){return function(_0x4e7e83){if(_0x4e7e83){return _0x4e7e83[_0x37c6('0x27')]()[_0x37c6('0x26')](function(){_0x328b58[_0x37c6('0x19')](0xcc)[_0x37c6('0x1a')]();});}};}function handleEntityNotFound(_0x4a3328,_0x563aa1){return function(_0x621f78){if(!_0x621f78){_0x4a3328[_0x37c6('0x18')](0x194);}return _0x621f78;};}function handleError(_0x1d7898,_0x449947){_0x449947=_0x449947||0x1f4;return function(_0x59e17d){logger['error'](_0x59e17d[_0x37c6('0x28')]);if(_0x59e17d[_0x37c6('0x29')]){delete _0x59e17d[_0x37c6('0x29')];}_0x1d7898['status'](_0x449947)[_0x37c6('0x2a')](_0x59e17d);};}exports[_0x37c6('0x2b')]=function(_0x8c6839,_0x13e7d5){var _0x141888={},_0x48e040={},_0x37a234={'count':0x0,'rows':[]};var _0x5cdef5=_[_0x37c6('0x2c')](db[_0x37c6('0x2d')]['rawAttributes'],function(_0x2ff9a3){return{'name':_0x2ff9a3[_0x37c6('0x2e')],'type':_0x2ff9a3[_0x37c6('0x2f')][_0x37c6('0x30')]};});_0x48e040['model']=_['differenceBy'](_[_0x37c6('0x2c')](_0x5cdef5,_0x37c6('0x29')),[_0x37c6('0x31')]);_0x48e040['query']=_['keys'](_0x8c6839[_0x37c6('0x32')]);_0x48e040[_0x37c6('0x33')]=_['intersection'](_0x48e040[_0x37c6('0x34')],_0x48e040[_0x37c6('0x32')]);_0x141888[_0x37c6('0x35')]=_[_0x37c6('0x36')](_0x48e040[_0x37c6('0x34')],qs[_0x37c6('0x37')](_0x8c6839[_0x37c6('0x32')][_0x37c6('0x37')]));_0x141888[_0x37c6('0x35')]=_0x141888[_0x37c6('0x35')][_0x37c6('0x38')]?_0x141888[_0x37c6('0x35')]:_0x48e040['model'];if(!_0x8c6839['query'][_0x37c6('0x39')]('nolimit')){_0x141888['limit']=qs['limit'](_0x8c6839[_0x37c6('0x32')][_0x37c6('0x1e')]);_0x141888['offset']=qs[_0x37c6('0x1b')](_0x8c6839[_0x37c6('0x32')][_0x37c6('0x1b')]);}_0x141888['order']=qs[_0x37c6('0x3a')](_0x8c6839[_0x37c6('0x32')][_0x37c6('0x3a')]);_0x141888[_0x37c6('0x3b')]=qs['filters'](_[_0x37c6('0x3c')](_0x8c6839['query'],_0x48e040[_0x37c6('0x33')]),_0x5cdef5);if(_0x8c6839[_0x37c6('0x32')][_0x37c6('0x3d')]){_0x141888[_0x37c6('0x3b')]=_['merge'](_0x141888[_0x37c6('0x3b')],{'$or':_[_0x37c6('0x2c')](_0x5cdef5,function(_0x4bda6a){if(_0x4bda6a['type']!==_0x37c6('0x3e')){var _0x197a7c={};_0x197a7c[_0x4bda6a[_0x37c6('0x29')]]={'$like':'%'+_0x8c6839[_0x37c6('0x32')][_0x37c6('0x3d')]+'%'};return _0x197a7c;}})});}_0x141888=_[_0x37c6('0x3f')]({},_0x141888,_0x8c6839['options']);var _0x1cac17={'where':_0x141888[_0x37c6('0x3b')]};return db[_0x37c6('0x2d')]['count'](_0x1cac17)['then'](function(_0x415cd9){_0x37a234[_0x37c6('0x1d')]=_0x415cd9;if(_0x8c6839['query'][_0x37c6('0x40')]){_0x141888[_0x37c6('0x41')]=[{'all':!![]}];}return db[_0x37c6('0x2d')][_0x37c6('0x42')](_0x141888);})[_0x37c6('0x26')](function(_0xcff380){_0x37a234[_0x37c6('0x43')]=_0xcff380;return _0x37a234;})['then'](respondWithFilteredResult(_0x13e7d5,_0x141888))[_0x37c6('0x44')](handleError(_0x13e7d5,null));};exports['show']=function(_0x245dcf,_0x4ce12f){var _0x2dbdcb={'raw':![],'where':{'id':_0x245dcf['params']['id']}},_0x30756a={};_0x30756a[_0x37c6('0x34')]=_[_0x37c6('0x45')](db[_0x37c6('0x2d')][_0x37c6('0x46')]);_0x30756a[_0x37c6('0x32')]=_[_0x37c6('0x45')](_0x245dcf[_0x37c6('0x32')]);_0x30756a[_0x37c6('0x33')]=_[_0x37c6('0x36')](_0x30756a['model'],_0x30756a[_0x37c6('0x32')]);_0x2dbdcb[_0x37c6('0x35')]=_[_0x37c6('0x36')](_0x30756a[_0x37c6('0x34')],qs['fields'](_0x245dcf['query'][_0x37c6('0x37')]));_0x2dbdcb[_0x37c6('0x35')]=_0x2dbdcb[_0x37c6('0x35')][_0x37c6('0x38')]?_0x2dbdcb['attributes']:_0x30756a[_0x37c6('0x34')];if(_0x245dcf['query']['includeAll']){_0x2dbdcb[_0x37c6('0x41')]=[{'all':!![]}];}_0x2dbdcb=_[_0x37c6('0x3f')]({},_0x2dbdcb,_0x245dcf[_0x37c6('0x47')]);return db[_0x37c6('0x2d')]['find'](_0x2dbdcb)[_0x37c6('0x26')](handleEntityNotFound(_0x4ce12f,null))[_0x37c6('0x26')](respondWithResult(_0x4ce12f,null))[_0x37c6('0x44')](handleError(_0x4ce12f,null));};exports[_0x37c6('0x48')]=function(_0x1d2865,_0xbe380f){return db['ScreenRecording'][_0x37c6('0x48')](_0x1d2865[_0x37c6('0x49')],{})[_0x37c6('0x26')](respondWithResult(_0xbe380f,0xc9))[_0x37c6('0x44')](handleError(_0xbe380f,null));};exports[_0x37c6('0x25')]=function(_0x38ecce,_0xd8cd3e){if(_0x38ecce[_0x37c6('0x49')]['id']){delete _0x38ecce['body']['id'];}delete _0x38ecce[_0x37c6('0x49')][_0x37c6('0x4a')];delete _0x38ecce[_0x37c6('0x49')]['createdAt'];delete _0x38ecce[_0x37c6('0x49')]['closedAt'];delete _0x38ecce[_0x37c6('0x49')]['value'];return db['ScreenRecording']['find']({'where':{'id':_0x38ecce['params']['id']}})[_0x37c6('0x26')](handleEntityNotFound(_0xd8cd3e,null))[_0x37c6('0x26')](saveUpdates(_0x38ecce[_0x37c6('0x49')],null))[_0x37c6('0x26')](respondWithResult(_0xd8cd3e,null))[_0x37c6('0x44')](handleError(_0xd8cd3e,null));};exports[_0x37c6('0x4b')]=function(_0x38b397,_0x32bc35){return db[_0x37c6('0x2d')][_0x37c6('0x4b')]()['then'](respondWithResult(_0x32bc35,null))[_0x37c6('0x44')](handleError(_0x32bc35,null));};exports[_0x37c6('0x4c')]=function(_0x5e1eca,_0x5c166d,_0x5eaa27){var _0x54c8f5=require('../../components/encryptor');var _0x336227=![];var _0x35ea41={};if(_0x5e1eca[_0x37c6('0x32')][_0x37c6('0x2f')]&&_0x5e1eca['query'][_0x37c6('0x2f')]===_0x37c6('0x4d')){_0x35ea41[_0x37c6('0x4d')]=_0x5e1eca[_0x37c6('0x4e')]['id'];}else{_0x35ea41['id']=_0x5e1eca[_0x37c6('0x4e')]['id'];}return db['ScreenRecording'][_0x37c6('0x4f')]({'where':_0x35ea41,'attributes':['id','value'],'raw':!![]})[_0x37c6('0x26')](handleEntityNotFound(_0x5c166d,null))[_0x37c6('0x26')](function(_0x802dd3){if(_0x802dd3){var _0x2129bd=path['join'](config['root'],_0x37c6('0x50'),_0x802dd3[_0x37c6('0x51')]);var _0x2477a3=util[_0x37c6('0x31')]('%s.cypher',_0x2129bd);if(fs[_0x37c6('0x52')](_0x2477a3)){_0x336227=!![];return _0x54c8f5['decryptFile'](_0x2477a3,_0x2129bd,config[_0x37c6('0x53')]['recording'])[_0x37c6('0x26')](function(){return _0x802dd3;});}return _0x802dd3;}})['then'](function(_0x22cdfd){if(_0x22cdfd){var _0x5ef52f=path[_0x37c6('0x54')](config[_0x37c6('0x55')],'server/files/screen_recordings',_0x22cdfd[_0x37c6('0x51')]);if(!fs['existsSync'](_0x5ef52f)){throw new db['Sequelize'][(_0x37c6('0x56'))](_0x37c6('0x57'));}if(_0x22cdfd[_0x37c6('0x58')]){return _0x5c166d[_0x37c6('0x4c')](_0x5ef52f,_0x22cdfd[_0x37c6('0x58')]+path[_0x37c6('0x59')](_0x5ef52f),function(){if(_0x336227){fs[_0x37c6('0x5a')](_0x5ef52f);}});}else{return _0x5c166d[_0x37c6('0x4c')](_0x5ef52f,function(_0x311b2b){if(_0x336227){fs[_0x37c6('0x5a')](_0x5ef52f);}});}}})[_0x37c6('0x44')](function(_0x544628){if(_0x544628[_0x37c6('0x5b')]==='ScreenRecording\x20not\x20found'){_0x5c166d[_0x37c6('0x19')](0x194)[_0x37c6('0x2a')]('Not\x20found');}else{return handleError(_0x5c166d,null);}});};exports[_0x37c6('0x27')]=function(_0x4079d2,_0x33179c){return db[_0x37c6('0x2d')][_0x37c6('0x4f')]({'where':{'id':_0x4079d2[_0x37c6('0x4e')]['id']}})[_0x37c6('0x26')](function(_0x2fb611){if(_['isNil'](_0x2fb611)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2fb611;})['then'](function(_0x3856d0){var _0x40c388=path[_0x37c6('0x54')](config[_0x37c6('0x55')],_0x37c6('0x50'),_0x3856d0[_0x37c6('0x51')]);logger['info'](_0x37c6('0x5c'),_0x40c388);if(!_[_0x37c6('0x5d')](_0x3856d0[_0x37c6('0x51')])&&fs['existsSync'](_0x40c388)){logger[_0x37c6('0x5e')](_0x37c6('0x5f')+_0x40c388+_0x37c6('0x60'));fs[_0x37c6('0x61')](_0x40c388);}_0x40c388=_0x40c388+_0x37c6('0x62');if(!_[_0x37c6('0x5d')](_0x3856d0['value'])&&fs[_0x37c6('0x52')](_0x40c388)){logger[_0x37c6('0x5e')](_0x37c6('0x5f')+_0x40c388+_0x37c6('0x60'));fs['unlinkSync'](_0x40c388);}return _0x3856d0;})['then'](function(_0x2a3b09){if(!_0x2a3b09)throw new InternalError();return _0x2a3b09[_0x37c6('0x27')]();})[_0x37c6('0x26')](function(){_0x33179c[_0x37c6('0x19')](0xcc)['end']();})[_0x37c6('0x44')](handleError(_0x33179c,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index ff7f979..7c60a4f 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 _0x8792=['interactionid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','screen_recordings'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8792,0x1cd));var _0x2879=function(_0x4535e4,_0x46fc0c){_0x4535e4=_0x4535e4-0x0;var _0x3d2f9d=_0x8792[_0x4535e4];return _0x3d2f9d;};'use strict';var _=require(_0x2879('0x0'));var util=require('util');var logger=require(_0x2879('0x1'))('api');var moment=require(_0x2879('0x2'));var BPromise=require(_0x2879('0x3'));var rp=require(_0x2879('0x4'));var fs=require('fs');var path=require(_0x2879('0x5'));var rimraf=require(_0x2879('0x6'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0x2879('0x7')]=function(_0x340b54,_0x1fde53){return _0x340b54['define']('ScreenRecording',attributes,{'tableName':_0x2879('0x8'),'paranoid':![],'indexes':[{'name':_0x2879('0x9'),'fields':[_0x2879('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa98a=['util','moment','bluebird','path','rimraf','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa98a,0x133));var _0xaa98=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa98a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaa98('0x0'));var util=require(_0xaa98('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaa98('0x2'));var BPromise=require(_0xaa98('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa98('0x4'));var rimraf=require(_0xaa98('0x5'));var config=require('../../config/environment');var attributes=require(_0xaa98('0x6'));module[_0xaa98('0x7')]=function(_0x52e9d8,_0x2438e9){return _0x52e9d8['define'](_0xaa98('0x8'),attributes,{'tableName':_0xaa98('0x9'),'paranoid':![],'indexes':[{'name':_0xaa98('0xa'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index f8f6747..0b2fcbc 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 _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x15e6f6,_0xda0f0){var _0x3b3d96=function(_0x40a614){while(--_0x40a614){_0x15e6f6['push'](_0x15e6f6['shift']());}};_0x3b3d96(++_0xda0f0);}(_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 +var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x10dab3,_0x182e36){var _0x2aea3b=function(_0x179f23){while(--_0x179f23){_0x10dab3['push'](_0x10dab3['shift']());}};_0x2aea3b(++_0x182e36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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/setting/index.js b/server/api/setting/index.js index 259cbdb..6dee52e 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 _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x34daed,_0x20a680){var _0x5bcafa=function(_0x5b49c8){while(--_0x5b49c8){_0x34daed['push'](_0x34daed['shift']());}};_0x5bcafa(++_0x20a680);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0xbe41ba,_0x384563){var _0x2c2085=function(_0x146ee7){while(--_0x146ee7){_0xbe41ba['push'](_0xbe41ba['shift']());}};_0x2c2085(++_0x384563);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index c49b54a..0612619 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 _0x558c=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING'];(function(_0x1a48b8,_0x389cd6){var _0x347d75=function(_0x2afcd8){while(--_0x2afcd8){_0x1a48b8['push'](_0x1a48b8['shift']());}};_0x347d75(++_0x389cd6);}(_0x558c,0xaf));var _0xc558=function(_0x1ba726,_0x4af252){_0x1ba726=_0x1ba726-0x0;var _0x26380e=_0x558c[_0x1ba726];return _0x26380e;};'use strict';var Sequelize=require(_0xc558('0x0'));module[_0xc558('0x1')]={'min_internal':{'type':Sequelize[_0xc558('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xc558('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xc558('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xc558('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xc558('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xc558('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xc558('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xc558('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xc558('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xc558('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xc558('0x4')]},'turnaddr':{'type':Sequelize[_0xc558('0x4')]},'turnusername':{'type':Sequelize[_0xc558('0x4')]},'turnpassword':{'type':Sequelize[_0xc558('0x4')]},'pageTitle':{'type':Sequelize[_0xc558('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xc558('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xc558('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xc558('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xc558('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xc558('0x6')},'enableEmailPreview':{'type':Sequelize[_0xc558('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xc558('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xc558('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xc558('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xc558('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xc558('0x4')],'defaultValue':_0xc558('0x7')},'chatTimeout':{'type':Sequelize[_0xc558('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xc558('0x4')]},'defaultPreferred':{'type':Sequelize[_0xc558('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xc558('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xc558('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xc558('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xc558('0x4')]},'defaultFavicon':{'type':Sequelize[_0xc558('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xc558('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xc558('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xc558('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xc558('0x2')]},'transcribeRegion':{'type':Sequelize[_0xc558('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xc558('0x2')]},'sentimentRegion':{'type':Sequelize[_0xc558('0x4')]},'language':{'type':Sequelize[_0xc558('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xc558('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xc558('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xc558('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xc558('0x2')](0x2)[_0xc558('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xc558('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xc558('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xc558('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xc558('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xc558('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xc558('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xc558('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xeee7=['STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','INTEGER','min_internal','/var/opt/motion2/server/files/sounds/converted'];(function(_0x204ad4,_0x502841){var _0x50675f=function(_0x30ad49){while(--_0x30ad49){_0x204ad4['push'](_0x204ad4['shift']());}};_0x50675f(++_0x502841);}(_0xeee7,0x1ee));var _0x7eee=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xeee7[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x7eee('0x0')](0xb),'unique':_0x7eee('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x7eee('0x0')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x7eee('0x2')},'logo':{'type':Sequelize[_0x7eee('0x3')]},'defaultLogo':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x7eee('0x3')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7eee('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x7eee('0x3')]},'turnusername':{'type':Sequelize[_0x7eee('0x3')]},'turnpassword':{'type':Sequelize[_0x7eee('0x3')]},'pageTitle':{'type':Sequelize[_0x7eee('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x7eee('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7eee('0x3')],'defaultValue':_0x7eee('0x5')},'enableEmailPreview':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x7eee('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x7eee('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x7eee('0x3')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7eee('0x3')]},'defaultPreferred':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x7eee('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x7eee('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x7eee('0x3')]},'defaultFavicon':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x7eee('0x0')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x7eee('0x3')]},'language':{'type':Sequelize[_0x7eee('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x7eee('0x0')](0x2)[_0x7eee('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x7eee('0x0')](0x2)[_0x7eee('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x7eee('0x0')](0x2)[_0x7eee('0x6')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x7eee('0x0')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x7eee('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x7eee('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index f75381c..3da73a6 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 _0x5ada=['offset','undefined','limit','count','set','apply','reject','save','then','destroy','stack','name','send','index','Setting','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','find','update','body','addLogo','file','filename','loginLogo','getLogo','getLicense','logo','favicon','defaultLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','server/files/images/logos','preferred','defaultLoginLogo','default_loginLogo.svg','gdpr','addPreferred','getPreferred','existsSync','default','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json'];(function(_0x458c79,_0x44c4dd){var _0x3bc99d=function(_0x5f0327){while(--_0x5f0327){_0x458c79['push'](_0x458c79['shift']());}};_0x3bc99d(++_0x44c4dd);}(_0x5ada,0x146));var _0xa5ad=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0x5ada[_0x2d1971];return _0x4d7759;};'use strict';var emlformat=require(_0xa5ad('0x0'));var rimraf=require(_0xa5ad('0x1'));var zipdir=require(_0xa5ad('0x2'));var jsonpatch=require(_0xa5ad('0x3'));var rp=require(_0xa5ad('0x4'));var moment=require('moment');var BPromise=require(_0xa5ad('0x5'));var Mustache=require('mustache');var util=require(_0xa5ad('0x6'));var path=require(_0xa5ad('0x7'));var sox=require(_0xa5ad('0x8'));var csv=require('to-csv');var ejs=require(_0xa5ad('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5ad('0xa'));var squel=require(_0xa5ad('0xb'));var crypto=require(_0xa5ad('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa5ad('0xd'));var querystring=require(_0xa5ad('0xe'));var Papa=require(_0xa5ad('0xf'));var Redis=require(_0xa5ad('0x10'));var authService=require(_0xa5ad('0x11'));var qs=require(_0xa5ad('0x12'));var as=require(_0xa5ad('0x13'));var hardwareService=require(_0xa5ad('0x14'));var logger=require(_0xa5ad('0x15'))(_0xa5ad('0x16'));var utils=require('../../config/utils');var config=require(_0xa5ad('0x17'));var licenseUtil=require(_0xa5ad('0x18'));var db=require(_0xa5ad('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa5ad('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4108b9,_0x4212d8,_0x36f488,_0x36239a){return new BPromise(function(_0x2ee4d9,_0x20653f){var _0x1281cc=_0x36239a||client;return _0x1281cc[_0xa5ad('0x1b')](_0x4108b9,_0x36f488)['then'](function(_0x56ac32){logger[_0xa5ad('0x1c')](_0xa5ad('0x1d'),_0x4212d8,_0xa5ad('0x1e'));logger[_0xa5ad('0x1f')](_0xa5ad('0x20'),_0x4212d8,'request\x20sent',JSON[_0xa5ad('0x21')](_0x56ac32));if(_0x56ac32[_0xa5ad('0x22')]){if(_0x56ac32[_0xa5ad('0x22')][_0xa5ad('0x23')]===0x1f4){logger[_0xa5ad('0x22')](_0xa5ad('0x1d'),_0x4212d8,_0x56ac32[_0xa5ad('0x22')][_0xa5ad('0x24')]);return _0x20653f(_0x56ac32[_0xa5ad('0x22')]['message']);}logger[_0xa5ad('0x22')]('Setting,\x20%s,\x20%s',_0x4212d8,_0x56ac32[_0xa5ad('0x22')][_0xa5ad('0x24')]);return _0x2ee4d9(_0x56ac32[_0xa5ad('0x22')][_0xa5ad('0x24')]);}else{logger[_0xa5ad('0x1c')]('Setting,\x20%s,\x20%s',_0x4212d8,_0xa5ad('0x1e'));_0x2ee4d9(_0x56ac32[_0xa5ad('0x25')][_0xa5ad('0x24')]);}})[_0xa5ad('0x26')](function(_0x578815){logger[_0xa5ad('0x22')](_0xa5ad('0x1d'),_0x4212d8,_0x578815);_0x20653f(_0x578815);});});}function respondWithStatusCode(_0x25dd73,_0x491f5d){_0x491f5d=_0x491f5d||0xcc;return function(_0x4095c6){if(_0x4095c6){return _0x25dd73[_0xa5ad('0x27')](_0x491f5d);}return _0x25dd73[_0xa5ad('0x28')](_0x491f5d)[_0xa5ad('0x29')]();};}function respondWithResult(_0x41cbf0,_0x5dcff7){_0x5dcff7=_0x5dcff7||0xc8;return function(_0x124084){if(_0x124084){return _0x41cbf0[_0xa5ad('0x28')](_0x5dcff7)[_0xa5ad('0x2a')](_0x124084);}};}function respondWithFilteredResult(_0xe0a497,_0x3d57cc){return function(_0x28b2a1){if(_0x28b2a1){var _0x2b895f=typeof _0x3d57cc[_0xa5ad('0x2b')]===_0xa5ad('0x2c')&&typeof _0x3d57cc[_0xa5ad('0x2d')]===_0xa5ad('0x2c');var _0x5e626c=_0x28b2a1[_0xa5ad('0x2e')];var _0x1d77c3=_0x2b895f?0x0:_0x3d57cc[_0xa5ad('0x2b')];var _0x258250=_0x2b895f?_0x28b2a1['count']:_0x3d57cc[_0xa5ad('0x2b')]+_0x3d57cc['limit'];var _0x2f59f2;if(_0x258250>=_0x5e626c){_0x258250=_0x5e626c;_0x2f59f2=0xc8;}else{_0x2f59f2=0xce;}_0xe0a497[_0xa5ad('0x28')](_0x2f59f2);return _0xe0a497[_0xa5ad('0x2f')]('Content-Range',_0x1d77c3+'-'+_0x258250+'/'+_0x5e626c)['json'](_0x28b2a1);}return null;};}function patchUpdates(_0x23c96b){return function(_0x16d3c0){try{jsonpatch[_0xa5ad('0x30')](_0x16d3c0,_0x23c96b,!![]);}catch(_0xe6e89d){return BPromise[_0xa5ad('0x31')](_0xe6e89d);}return _0x16d3c0[_0xa5ad('0x32')]();};}function saveUpdates(_0x1ff0ec,_0x335e2e){return function(_0x10c4af){if(_0x10c4af){return _0x10c4af['update'](_0x1ff0ec)[_0xa5ad('0x33')](function(_0x8217b0){return _0x8217b0;});}return null;};}function removeEntity(_0x1d238e,_0x3252f0){return function(_0x32d595){if(_0x32d595){return _0x32d595[_0xa5ad('0x34')]()[_0xa5ad('0x33')](function(){_0x1d238e[_0xa5ad('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a0393,_0x449de7){return function(_0x1d3cda){if(!_0x1d3cda){_0x2a0393[_0xa5ad('0x27')](0x194);}return _0x1d3cda;};}function handleError(_0x2151cd,_0xaae350){_0xaae350=_0xaae350||0x1f4;return function(_0x2351d3){logger[_0xa5ad('0x22')](_0x2351d3[_0xa5ad('0x35')]);if(_0x2351d3['name']){delete _0x2351d3[_0xa5ad('0x36')];}_0x2151cd[_0xa5ad('0x28')](_0xaae350)[_0xa5ad('0x37')](_0x2351d3);};}exports[_0xa5ad('0x38')]=function(_0x3d702f,_0x15c912){var _0x530532={},_0x43d07a={},_0x3a31f4={'count':0x0,'rows':[]};var _0x313b96=_['map'](db[_0xa5ad('0x39')][_0xa5ad('0x3a')],function(_0x280ff0){return{'name':_0x280ff0['fieldName'],'type':_0x280ff0['type'][_0xa5ad('0x3b')]};});_0x43d07a[_0xa5ad('0x3c')]=_['map'](_0x313b96,'name');_0x43d07a[_0xa5ad('0x3d')]=_[_0xa5ad('0x3e')](_0x3d702f[_0xa5ad('0x3d')]);_0x43d07a['filters']=_[_0xa5ad('0x3f')](_0x43d07a[_0xa5ad('0x3c')],_0x43d07a['query']);_0x530532['attributes']=_[_0xa5ad('0x3f')](_0x43d07a[_0xa5ad('0x3c')],qs[_0xa5ad('0x40')](_0x3d702f[_0xa5ad('0x3d')]['fields']));_0x530532[_0xa5ad('0x41')]=_0x530532['attributes'][_0xa5ad('0x42')]?_0x530532['attributes']:_0x43d07a[_0xa5ad('0x3c')];if(!_0x3d702f['query'][_0xa5ad('0x43')](_0xa5ad('0x44'))){_0x530532[_0xa5ad('0x2d')]=qs[_0xa5ad('0x2d')](_0x3d702f[_0xa5ad('0x3d')]['limit']);_0x530532[_0xa5ad('0x2b')]=qs['offset'](_0x3d702f[_0xa5ad('0x3d')][_0xa5ad('0x2b')]);}_0x530532[_0xa5ad('0x45')]=qs['sort'](_0x3d702f['query'][_0xa5ad('0x46')]);_0x530532[_0xa5ad('0x47')]=qs[_0xa5ad('0x48')](_['pick'](_0x3d702f['query'],_0x43d07a['filters']),_0x313b96);if(_0x3d702f['query'][_0xa5ad('0x49')]){_0x530532[_0xa5ad('0x47')]=_[_0xa5ad('0x4a')](_0x530532[_0xa5ad('0x47')],{'$or':_['map'](_0x313b96,function(_0x14fdce){if(_0x14fdce['type']!==_0xa5ad('0x4b')){var _0x35a8d5={};_0x35a8d5[_0x14fdce[_0xa5ad('0x36')]]={'$like':'%'+_0x3d702f[_0xa5ad('0x3d')][_0xa5ad('0x49')]+'%'};return _0x35a8d5;}})});}_0x530532=_[_0xa5ad('0x4a')]({},_0x530532,_0x3d702f['options']);var _0x273ea8={'where':_0x530532[_0xa5ad('0x47')]};return db[_0xa5ad('0x39')]['count'](_0x273ea8)['then'](function(_0x2201c1){_0x3a31f4[_0xa5ad('0x2e')]=_0x2201c1;if(_0x3d702f[_0xa5ad('0x3d')][_0xa5ad('0x4c')]){_0x530532[_0xa5ad('0x4d')]=[{'all':!![]}];}return db[_0xa5ad('0x39')][_0xa5ad('0x4e')](_0x530532);})['then'](function(_0x475c49){_0x3a31f4[_0xa5ad('0x4f')]=_0x475c49;return _0x3a31f4;})[_0xa5ad('0x33')](respondWithFilteredResult(_0x15c912,_0x530532))[_0xa5ad('0x26')](handleError(_0x15c912,null));};exports['show']=function(_0x3151de,_0x3b0b8e){var _0x4dabd8={'raw':![],'where':{'id':_0x3151de[_0xa5ad('0x50')]['id']}},_0x3ea3b2={};_0x3ea3b2[_0xa5ad('0x3c')]=_[_0xa5ad('0x3e')](db['Setting']['rawAttributes']);_0x3ea3b2[_0xa5ad('0x3d')]=_[_0xa5ad('0x3e')](_0x3151de[_0xa5ad('0x3d')]);_0x3ea3b2[_0xa5ad('0x48')]=_[_0xa5ad('0x3f')](_0x3ea3b2[_0xa5ad('0x3c')],_0x3ea3b2[_0xa5ad('0x3d')]);_0x4dabd8[_0xa5ad('0x41')]=_[_0xa5ad('0x3f')](_0x3ea3b2['model'],qs[_0xa5ad('0x40')](_0x3151de[_0xa5ad('0x3d')][_0xa5ad('0x40')]));_0x4dabd8[_0xa5ad('0x41')]=_0x4dabd8['attributes']['length']?_0x4dabd8[_0xa5ad('0x41')]:_0x3ea3b2['model'];if(_0x3151de[_0xa5ad('0x3d')][_0xa5ad('0x4c')]){_0x4dabd8[_0xa5ad('0x4d')]=[{'all':!![]}];}_0x4dabd8=_[_0xa5ad('0x4a')]({},_0x4dabd8,_0x3151de['options']);return db[_0xa5ad('0x39')][_0xa5ad('0x51')](_0x4dabd8)[_0xa5ad('0x33')](handleEntityNotFound(_0x3b0b8e,null))[_0xa5ad('0x33')](respondWithResult(_0x3b0b8e,null))[_0xa5ad('0x26')](handleError(_0x3b0b8e,null));};exports[_0xa5ad('0x52')]=function(_0x3e00bf,_0x293ec6){if(_0x3e00bf['body']['id']){delete _0x3e00bf[_0xa5ad('0x53')]['id'];}return db['Setting'][_0xa5ad('0x51')]({'where':{'id':_0x3e00bf[_0xa5ad('0x50')]['id']}})[_0xa5ad('0x33')](handleEntityNotFound(_0x293ec6,null))[_0xa5ad('0x33')](saveUpdates(_0x3e00bf[_0xa5ad('0x53')],null))[_0xa5ad('0x33')](respondWithResult(_0x293ec6,null))[_0xa5ad('0x26')](handleError(_0x293ec6,null));};exports[_0xa5ad('0x54')]=function(_0x2d6dee,_0x99718c,_0x1f52e8){if(_0x2d6dee[_0xa5ad('0x55')]&&_0x2d6dee[_0xa5ad('0x55')]['filename']){_0x2d6dee['body']['logo']=_0x2d6dee[_0xa5ad('0x55')]['filename'];}return db['Setting'][_0xa5ad('0x51')]({'where':{'id':_0x2d6dee['params']['id']}})[_0xa5ad('0x33')](handleEntityNotFound(_0x99718c,null))[_0xa5ad('0x33')](saveUpdates(_0x2d6dee['body'],null))[_0xa5ad('0x33')](respondWithResult(_0x99718c,null))[_0xa5ad('0x26')](handleError(_0x99718c,null));};exports['addLogoLogin']=function(_0x7d86d6,_0x3c1f33,_0x432abb){if(_0x7d86d6['file']&&_0x7d86d6[_0xa5ad('0x55')][_0xa5ad('0x56')]){_0x7d86d6[_0xa5ad('0x53')][_0xa5ad('0x57')]=_0x7d86d6['file'][_0xa5ad('0x56')];}return db[_0xa5ad('0x39')][_0xa5ad('0x51')]({'where':{'id':_0x7d86d6['params']['id']}})['then'](handleEntityNotFound(_0x3c1f33,null))[_0xa5ad('0x33')](saveUpdates(_0x7d86d6['body'],null))[_0xa5ad('0x33')](respondWithResult(_0x3c1f33,null))['catch'](handleError(_0x3c1f33,null));};var utilLicense=require(_0xa5ad('0x18'));exports[_0xa5ad('0x58')]=function(_0x39db07,_0x3182f0,_0x47ce8a){var _0x56bd3c='server/files/images/logos';var _0x1b27f6={'custom':![]};return utilLicense[_0xa5ad('0x59')]()[_0xa5ad('0x33')](function(_0x2abac9){if(_0x2abac9){_0x1b27f6=_0x2abac9;}return db[_0xa5ad('0x39')]['find']({'where':{'id':_0x39db07[_0xa5ad('0x50')]['id']},'attributes':[_0xa5ad('0x5a'),_0xa5ad('0x57'),'preferred',_0xa5ad('0x5b'),_0xa5ad('0x5c'),'defaultLoginLogo',_0xa5ad('0x5d'),_0xa5ad('0x5e')],'raw':!![]});})[_0xa5ad('0x33')](handleEntityNotFound(_0x3182f0,null))['then'](function(_0x9380c2){if(_0x9380c2){var _0x20314f=_0x9380c2['logo']&&fs['existsSync'](path[_0xa5ad('0x5f')](config[_0xa5ad('0x60')],_0x56bd3c,_[_0xa5ad('0x61')](_0x9380c2[_0xa5ad('0x5a')])))?path[_0xa5ad('0x5f')](config['root'],_0x56bd3c,_[_0xa5ad('0x61')](_0x9380c2['logo'])):path[_0xa5ad('0x5f')](config[_0xa5ad('0x60')],_0x56bd3c,_[_0xa5ad('0x61')](_0xa5ad('0x62')));var _0x2ae775='default'+_[_0xa5ad('0x63')](_0xa5ad('0x5a'));if(_0x9380c2[_0x2ae775]||!_0x1b27f6[_0xa5ad('0x64')]){_0x20314f=path['join'](config[_0xa5ad('0x60')],_0x56bd3c,_['toLower'](_0xa5ad('0x62')));}if(!fs['existsSync'](_0x20314f)){throw new db[(_0xa5ad('0x65'))][(_0xa5ad('0x66'))](_['upperFirst']('logo')+_0xa5ad('0x67'));}return _0x3182f0[_0xa5ad('0x68')](_0x20314f);}})[_0xa5ad('0x26')](handleError(_0x3182f0,null));};var utilLicense=require('../../config/license/util');exports[_0xa5ad('0x69')]=function(_0x3d72fc,_0x4c276f,_0x55c502){var _0x295e60=_0xa5ad('0x6a');var _0x5953de={'custom':![]};return utilLicense[_0xa5ad('0x59')]()[_0xa5ad('0x33')](function(_0x2fcf26){if(_0x2fcf26){_0x5953de=_0x2fcf26;}return db[_0xa5ad('0x39')]['find']({'where':{'id':_0x3d72fc[_0xa5ad('0x50')]['id']},'attributes':[_0xa5ad('0x5a'),_0xa5ad('0x57'),_0xa5ad('0x6b'),_0xa5ad('0x5b'),_0xa5ad('0x5c'),_0xa5ad('0x6c'),_0xa5ad('0x5d'),_0xa5ad('0x5e')],'raw':!![]});})[_0xa5ad('0x33')](handleEntityNotFound(_0x4c276f,null))['then'](function(_0x652660){if(_0x652660){var _0x593d6e=_0x652660['loginLogo']&&fs['existsSync'](path[_0xa5ad('0x5f')](config[_0xa5ad('0x60')],_0x295e60,_[_0xa5ad('0x61')](_0x652660['loginLogo'])))?path['join'](config[_0xa5ad('0x60')],_0x295e60,_[_0xa5ad('0x61')](_0x652660['loginLogo'])):path[_0xa5ad('0x5f')](config[_0xa5ad('0x60')],_0x295e60,_['toLower'](_0xa5ad('0x6d')));var _0x5e1df8='default'+_['upperFirst'](_0xa5ad('0x57'));if(_0x652660[_0x5e1df8]||!_0x5953de[_0xa5ad('0x64')]){_0x593d6e=path[_0xa5ad('0x5f')](config['root'],_0x295e60,_[_0xa5ad('0x61')](_0xa5ad('0x6d')));}if(!fs['existsSync'](_0x593d6e)){throw new db[(_0xa5ad('0x65'))][(_0xa5ad('0x66'))](_[_0xa5ad('0x63')](_0xa5ad('0x57'))+'\x20not\x20found');}return _0x4c276f[_0xa5ad('0x68')](_0x593d6e);}})['catch'](handleError(_0x4c276f,null));};exports[_0xa5ad('0x6e')]=function(_0xad6e51,_0x9d2c61){return db['Setting'][_0xa5ad('0x51')]({'where':{'id':_0xad6e51[_0xa5ad('0x50')]['id']},'attributes':['securePassword']})[_0xa5ad('0x33')](respondWithResult(_0x9d2c61,null))['catch'](handleError(_0x9d2c61,null));};exports[_0xa5ad('0x6f')]=function(_0x13e39a,_0x2f3dbd,_0x11f11e){if(_0x13e39a[_0xa5ad('0x55')]&&_0x13e39a[_0xa5ad('0x55')][_0xa5ad('0x56')]){_0x13e39a[_0xa5ad('0x53')]['preferred']=_0x13e39a[_0xa5ad('0x55')][_0xa5ad('0x56')];}return db['Setting'][_0xa5ad('0x51')]({'where':{'id':_0x13e39a[_0xa5ad('0x50')]['id']}})[_0xa5ad('0x33')](handleEntityNotFound(_0x2f3dbd,null))['then'](saveUpdates(_0x13e39a[_0xa5ad('0x53')],null))['then'](respondWithResult(_0x2f3dbd,null))[_0xa5ad('0x26')](handleError(_0x2f3dbd,null));};var utilLicense=require(_0xa5ad('0x18'));exports[_0xa5ad('0x70')]=function(_0xf16cae,_0x2ae49d,_0x3637b3){var _0xc20502=_0xa5ad('0x6a');var _0x59ff4b={'custom':![]};return utilLicense[_0xa5ad('0x59')]()['then'](function(_0x4f6474){if(_0x4f6474){_0x59ff4b=_0x4f6474;}return db[_0xa5ad('0x39')]['find']({'where':{'id':_0xf16cae['params']['id']},'attributes':['logo',_0xa5ad('0x57'),'preferred',_0xa5ad('0x5b'),_0xa5ad('0x5c'),_0xa5ad('0x6c'),'defaultPreferred',_0xa5ad('0x5e')],'raw':!![]});})[_0xa5ad('0x33')](handleEntityNotFound(_0x2ae49d,null))['then'](function(_0x38fccb){if(_0x38fccb){var _0x28437b=_0x38fccb[_0xa5ad('0x6b')]&&fs[_0xa5ad('0x71')](path[_0xa5ad('0x5f')](config['root'],_0xc20502,_[_0xa5ad('0x61')](_0x38fccb[_0xa5ad('0x6b')])))?path[_0xa5ad('0x5f')](config[_0xa5ad('0x60')],_0xc20502,_[_0xa5ad('0x61')](_0x38fccb[_0xa5ad('0x6b')])):path['join'](config['root'],_0xc20502,_[_0xa5ad('0x61')]('default_preferred.png'));var _0x138eb0=_0xa5ad('0x72')+_[_0xa5ad('0x63')](_0xa5ad('0x6b'));if(_0x38fccb[_0x138eb0]||!_0x59ff4b['custom']||!_0x59ff4b[_0xa5ad('0x6b')]){_0x28437b=path[_0xa5ad('0x5f')](config[_0xa5ad('0x60')],_0xc20502,_['toLower'](_0xa5ad('0x73')));}if(!fs['existsSync'](_0x28437b)){throw new db[(_0xa5ad('0x65'))][(_0xa5ad('0x66'))](_[_0xa5ad('0x63')](_0xa5ad('0x6b'))+_0xa5ad('0x67'));}return _0x2ae49d[_0xa5ad('0x68')](_0x28437b);}})[_0xa5ad('0x26')](handleError(_0x2ae49d,null));};exports[_0xa5ad('0x74')]=function(_0x1dfffb,_0x19f6d0,_0x48a9e5){if(_0x1dfffb[_0xa5ad('0x55')]&&_0x1dfffb[_0xa5ad('0x55')][_0xa5ad('0x56')]){_0x1dfffb[_0xa5ad('0x53')][_0xa5ad('0x5b')]=_0x1dfffb['file'][_0xa5ad('0x56')];}return db[_0xa5ad('0x39')]['find']({'where':{'id':_0x1dfffb[_0xa5ad('0x50')]['id']}})[_0xa5ad('0x33')](handleEntityNotFound(_0x19f6d0,null))[_0xa5ad('0x33')](saveUpdates(_0x1dfffb['body'],null))['then'](respondWithResult(_0x19f6d0,null))[_0xa5ad('0x26')](handleError(_0x19f6d0,null));};var utilLicense=require(_0xa5ad('0x18'));exports['getFavicon']=function(_0x3222d8,_0x53aed6,_0x20cc46){var _0x5ba557=_0xa5ad('0x6a');var _0x594da7={'custom':![]};return utilLicense[_0xa5ad('0x59')]()['then'](function(_0x473f9d){if(_0x473f9d){_0x594da7=_0x473f9d;}return db[_0xa5ad('0x39')][_0xa5ad('0x51')]({'where':{'id':_0x3222d8[_0xa5ad('0x50')]['id']},'attributes':[_0xa5ad('0x5a'),_0xa5ad('0x57'),_0xa5ad('0x6b'),_0xa5ad('0x5b'),'defaultLogo',_0xa5ad('0x6c'),_0xa5ad('0x5d'),_0xa5ad('0x5e')],'raw':!![]});})[_0xa5ad('0x33')](handleEntityNotFound(_0x53aed6,null))[_0xa5ad('0x33')](function(_0x2afa4b){if(_0x2afa4b){var _0xcdfc02=_0x2afa4b['favicon']&&fs[_0xa5ad('0x71')](path[_0xa5ad('0x5f')](config[_0xa5ad('0x60')],_0x5ba557,_[_0xa5ad('0x61')](_0x2afa4b[_0xa5ad('0x5b')])))?path[_0xa5ad('0x5f')](config[_0xa5ad('0x60')],_0x5ba557,_[_0xa5ad('0x61')](_0x2afa4b[_0xa5ad('0x5b')])):path[_0xa5ad('0x5f')](config[_0xa5ad('0x60')],_0x5ba557,_[_0xa5ad('0x61')]('default_favicon.ico'));var _0xcec2bc=_0xa5ad('0x72')+_['upperFirst'](_0xa5ad('0x5b'));if(_0x2afa4b[_0xcec2bc]||!_0x594da7['custom']){_0xcdfc02=path['join'](config[_0xa5ad('0x60')],_0x5ba557,_[_0xa5ad('0x61')](_0xa5ad('0x75')));}if(!fs[_0xa5ad('0x71')](_0xcdfc02)){throw new db['Sequelize']['ValidationError'](_[_0xa5ad('0x63')](_0xa5ad('0x5b'))+_0xa5ad('0x67'));}return _0x53aed6[_0xa5ad('0x68')](_0xcdfc02);}})[_0xa5ad('0x26')](handleError(_0x53aed6,null));};exports[_0xa5ad('0x76')]=function(_0x2cea51,_0x587826){var _0x1ee96e={'offset':moment()[_0xa5ad('0x77')]()};_0x1ee96e[_0xa5ad('0x78')]=moment()[_0xa5ad('0x77')](_0x1ee96e['offset'])[_0xa5ad('0x79')](_0xa5ad('0x7a'));return _0x587826[_0xa5ad('0x28')](0xc8)[_0xa5ad('0x37')](_0x1ee96e);}; \ No newline at end of file +var _0x9bd6=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','findAll','rows','show','params','rawAttributes','length','includeAll','include','options','find','body','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','custom','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','Setting,\x20%s,\x20%s','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','name','send','map','Setting','fieldName','key','model','query'];(function(_0x51d79e,_0xc61f2f){var _0x12626c=function(_0x29cfff){while(--_0x29cfff){_0x51d79e['push'](_0x51d79e['shift']());}};_0x12626c(++_0xc61f2f);}(_0x9bd6,0x1a7));var _0x69bd=function(_0x742b01,_0x273cc3){_0x742b01=_0x742b01-0x0;var _0x1829f6=_0x9bd6[_0x742b01];return _0x1829f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69bd('0x0'));var zipdir=require(_0x69bd('0x1'));var jsonpatch=require(_0x69bd('0x2'));var rp=require('request-promise');var moment=require(_0x69bd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x69bd('0x4'));var util=require(_0x69bd('0x5'));var path=require('path');var sox=require(_0x69bd('0x6'));var csv=require('to-csv');var ejs=require(_0x69bd('0x7'));var fs=require('fs');var fs_extra=require(_0x69bd('0x8'));var _=require(_0x69bd('0x9'));var squel=require(_0x69bd('0xa'));var crypto=require(_0x69bd('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x69bd('0xc'));var Redis=require(_0x69bd('0xd'));var authService=require(_0x69bd('0xe'));var qs=require(_0x69bd('0xf'));var as=require(_0x69bd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x69bd('0x11'))(_0x69bd('0x12'));var utils=require(_0x69bd('0x13'));var config=require(_0x69bd('0x14'));var licenseUtil=require(_0x69bd('0x15'));var db=require(_0x69bd('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x69bd('0x17')][_0x69bd('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1e8810,_0x3b3c1c,_0x5066f8,_0x417432){return new BPromise(function(_0xd43b2b,_0x1eda7d){var _0x51b521=_0x417432||client;return _0x51b521['request'](_0x1e8810,_0x5066f8)[_0x69bd('0x19')](function(_0x257f3d){logger['info']('Setting,\x20%s,\x20%s',_0x3b3c1c,'request\x20sent');logger[_0x69bd('0x1a')](_0x69bd('0x1b'),_0x3b3c1c,_0x69bd('0x1c'),JSON['stringify'](_0x257f3d));if(_0x257f3d[_0x69bd('0x1d')]){if(_0x257f3d[_0x69bd('0x1d')][_0x69bd('0x1e')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x3b3c1c,_0x257f3d[_0x69bd('0x1d')][_0x69bd('0x1f')]);return _0x1eda7d(_0x257f3d[_0x69bd('0x1d')][_0x69bd('0x1f')]);}logger[_0x69bd('0x1d')]('Setting,\x20%s,\x20%s',_0x3b3c1c,_0x257f3d['error'][_0x69bd('0x1f')]);return _0xd43b2b(_0x257f3d[_0x69bd('0x1d')]['message']);}else{logger[_0x69bd('0x20')](_0x69bd('0x21'),_0x3b3c1c,_0x69bd('0x1c'));_0xd43b2b(_0x257f3d[_0x69bd('0x22')][_0x69bd('0x1f')]);}})[_0x69bd('0x23')](function(_0x25c83f){logger[_0x69bd('0x1d')]('Setting,\x20%s,\x20%s',_0x3b3c1c,_0x25c83f);_0x1eda7d(_0x25c83f);});});}function respondWithStatusCode(_0x2bc79f,_0x3badac){_0x3badac=_0x3badac||0xcc;return function(_0x2f0f62){if(_0x2f0f62){return _0x2bc79f[_0x69bd('0x24')](_0x3badac);}return _0x2bc79f[_0x69bd('0x25')](_0x3badac)['end']();};}function respondWithResult(_0x47c588,_0x4bd526){_0x4bd526=_0x4bd526||0xc8;return function(_0x539ca0){if(_0x539ca0){return _0x47c588[_0x69bd('0x25')](_0x4bd526)['json'](_0x539ca0);}};}function respondWithFilteredResult(_0x36e363,_0x328dd2){return function(_0x5e9afc){if(_0x5e9afc){var _0x781278=typeof _0x328dd2[_0x69bd('0x26')]===_0x69bd('0x27')&&typeof _0x328dd2[_0x69bd('0x28')]===_0x69bd('0x27');var _0x3128f9=_0x5e9afc[_0x69bd('0x29')];var _0x181de6=_0x781278?0x0:_0x328dd2[_0x69bd('0x26')];var _0x1e1e2e=_0x781278?_0x5e9afc[_0x69bd('0x29')]:_0x328dd2[_0x69bd('0x26')]+_0x328dd2[_0x69bd('0x28')];var _0x4d9ae2;if(_0x1e1e2e>=_0x3128f9){_0x1e1e2e=_0x3128f9;_0x4d9ae2=0xc8;}else{_0x4d9ae2=0xce;}_0x36e363[_0x69bd('0x25')](_0x4d9ae2);return _0x36e363[_0x69bd('0x2a')](_0x69bd('0x2b'),_0x181de6+'-'+_0x1e1e2e+'/'+_0x3128f9)[_0x69bd('0x2c')](_0x5e9afc);}return null;};}function patchUpdates(_0x550897){return function(_0x332a13){try{jsonpatch['apply'](_0x332a13,_0x550897,!![]);}catch(_0x52eb0f){return BPromise[_0x69bd('0x2d')](_0x52eb0f);}return _0x332a13[_0x69bd('0x2e')]();};}function saveUpdates(_0x1896df,_0x5ae539){return function(_0x3a2bcd){if(_0x3a2bcd){return _0x3a2bcd[_0x69bd('0x2f')](_0x1896df)['then'](function(_0x45b8df){return _0x45b8df;});}return null;};}function removeEntity(_0x55c44a,_0x400a45){return function(_0xc793a4){if(_0xc793a4){return _0xc793a4[_0x69bd('0x30')]()[_0x69bd('0x19')](function(){_0x55c44a[_0x69bd('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318397,_0x27ce93){return function(_0x3356b4){if(!_0x3356b4){_0x318397['sendStatus'](0x194);}return _0x3356b4;};}function handleError(_0x3165ab,_0x4e62bf){_0x4e62bf=_0x4e62bf||0x1f4;return function(_0x33528d){logger[_0x69bd('0x1d')](_0x33528d['stack']);if(_0x33528d[_0x69bd('0x31')]){delete _0x33528d[_0x69bd('0x31')];}_0x3165ab[_0x69bd('0x25')](_0x4e62bf)[_0x69bd('0x32')](_0x33528d);};}exports['index']=function(_0x32cee0,_0x1d4add){var _0x486a5f={},_0x53f373={},_0x4309ab={'count':0x0,'rows':[]};var _0x551b8d=_[_0x69bd('0x33')](db[_0x69bd('0x34')]['rawAttributes'],function(_0x57fe36){return{'name':_0x57fe36[_0x69bd('0x35')],'type':_0x57fe36['type'][_0x69bd('0x36')]};});_0x53f373[_0x69bd('0x37')]=_[_0x69bd('0x33')](_0x551b8d,_0x69bd('0x31'));_0x53f373[_0x69bd('0x38')]=_[_0x69bd('0x39')](_0x32cee0[_0x69bd('0x38')]);_0x53f373[_0x69bd('0x3a')]=_[_0x69bd('0x3b')](_0x53f373['model'],_0x53f373['query']);_0x486a5f[_0x69bd('0x3c')]=_[_0x69bd('0x3b')](_0x53f373[_0x69bd('0x37')],qs[_0x69bd('0x3d')](_0x32cee0[_0x69bd('0x38')][_0x69bd('0x3d')]));_0x486a5f['attributes']=_0x486a5f[_0x69bd('0x3c')]['length']?_0x486a5f[_0x69bd('0x3c')]:_0x53f373[_0x69bd('0x37')];if(!_0x32cee0[_0x69bd('0x38')][_0x69bd('0x3e')](_0x69bd('0x3f'))){_0x486a5f['limit']=qs['limit'](_0x32cee0['query'][_0x69bd('0x28')]);_0x486a5f[_0x69bd('0x26')]=qs['offset'](_0x32cee0['query'][_0x69bd('0x26')]);}_0x486a5f[_0x69bd('0x40')]=qs[_0x69bd('0x41')](_0x32cee0['query'][_0x69bd('0x41')]);_0x486a5f[_0x69bd('0x42')]=qs[_0x69bd('0x3a')](_['pick'](_0x32cee0['query'],_0x53f373['filters']),_0x551b8d);if(_0x32cee0['query'][_0x69bd('0x43')]){_0x486a5f[_0x69bd('0x42')]=_[_0x69bd('0x44')](_0x486a5f['where'],{'$or':_[_0x69bd('0x33')](_0x551b8d,function(_0x39666f){if(_0x39666f[_0x69bd('0x45')]!==_0x69bd('0x46')){var _0x141f1c={};_0x141f1c[_0x39666f[_0x69bd('0x31')]]={'$like':'%'+_0x32cee0[_0x69bd('0x38')][_0x69bd('0x43')]+'%'};return _0x141f1c;}})});}_0x486a5f=_[_0x69bd('0x44')]({},_0x486a5f,_0x32cee0['options']);var _0x1fa24c={'where':_0x486a5f[_0x69bd('0x42')]};return db[_0x69bd('0x34')][_0x69bd('0x29')](_0x1fa24c)[_0x69bd('0x19')](function(_0x5902b4){_0x4309ab[_0x69bd('0x29')]=_0x5902b4;if(_0x32cee0[_0x69bd('0x38')]['includeAll']){_0x486a5f['include']=[{'all':!![]}];}return db['Setting'][_0x69bd('0x47')](_0x486a5f);})['then'](function(_0x3f2ff2){_0x4309ab[_0x69bd('0x48')]=_0x3f2ff2;return _0x4309ab;})[_0x69bd('0x19')](respondWithFilteredResult(_0x1d4add,_0x486a5f))[_0x69bd('0x23')](handleError(_0x1d4add,null));};exports[_0x69bd('0x49')]=function(_0x2e95a2,_0x2d39d5){var _0x385c62={'raw':![],'where':{'id':_0x2e95a2[_0x69bd('0x4a')]['id']}},_0x54b12c={};_0x54b12c[_0x69bd('0x37')]=_[_0x69bd('0x39')](db[_0x69bd('0x34')][_0x69bd('0x4b')]);_0x54b12c[_0x69bd('0x38')]=_[_0x69bd('0x39')](_0x2e95a2[_0x69bd('0x38')]);_0x54b12c['filters']=_['intersection'](_0x54b12c[_0x69bd('0x37')],_0x54b12c[_0x69bd('0x38')]);_0x385c62[_0x69bd('0x3c')]=_[_0x69bd('0x3b')](_0x54b12c[_0x69bd('0x37')],qs[_0x69bd('0x3d')](_0x2e95a2[_0x69bd('0x38')]['fields']));_0x385c62[_0x69bd('0x3c')]=_0x385c62[_0x69bd('0x3c')][_0x69bd('0x4c')]?_0x385c62[_0x69bd('0x3c')]:_0x54b12c[_0x69bd('0x37')];if(_0x2e95a2['query'][_0x69bd('0x4d')]){_0x385c62[_0x69bd('0x4e')]=[{'all':!![]}];}_0x385c62=_[_0x69bd('0x44')]({},_0x385c62,_0x2e95a2[_0x69bd('0x4f')]);return db[_0x69bd('0x34')][_0x69bd('0x50')](_0x385c62)['then'](handleEntityNotFound(_0x2d39d5,null))[_0x69bd('0x19')](respondWithResult(_0x2d39d5,null))[_0x69bd('0x23')](handleError(_0x2d39d5,null));};exports[_0x69bd('0x2f')]=function(_0x5260f9,_0x1db683){if(_0x5260f9[_0x69bd('0x51')]['id']){delete _0x5260f9[_0x69bd('0x51')]['id'];}return db[_0x69bd('0x34')]['find']({'where':{'id':_0x5260f9[_0x69bd('0x4a')]['id']}})[_0x69bd('0x19')](handleEntityNotFound(_0x1db683,null))[_0x69bd('0x19')](saveUpdates(_0x5260f9[_0x69bd('0x51')],null))['then'](respondWithResult(_0x1db683,null))[_0x69bd('0x23')](handleError(_0x1db683,null));};exports[_0x69bd('0x52')]=function(_0x2ba684,_0x1a86d6,_0x484a4f){if(_0x2ba684['file']&&_0x2ba684[_0x69bd('0x53')]['filename']){_0x2ba684[_0x69bd('0x51')]['logo']=_0x2ba684[_0x69bd('0x53')][_0x69bd('0x54')];}return db[_0x69bd('0x34')][_0x69bd('0x50')]({'where':{'id':_0x2ba684[_0x69bd('0x4a')]['id']}})[_0x69bd('0x19')](handleEntityNotFound(_0x1a86d6,null))[_0x69bd('0x19')](saveUpdates(_0x2ba684[_0x69bd('0x51')],null))[_0x69bd('0x19')](respondWithResult(_0x1a86d6,null))[_0x69bd('0x23')](handleError(_0x1a86d6,null));};exports[_0x69bd('0x55')]=function(_0x4e1189,_0xe854e8,_0x122b9c){if(_0x4e1189[_0x69bd('0x53')]&&_0x4e1189[_0x69bd('0x53')][_0x69bd('0x54')]){_0x4e1189[_0x69bd('0x51')][_0x69bd('0x56')]=_0x4e1189[_0x69bd('0x53')][_0x69bd('0x54')];}return db['Setting'][_0x69bd('0x50')]({'where':{'id':_0x4e1189[_0x69bd('0x4a')]['id']}})['then'](handleEntityNotFound(_0xe854e8,null))[_0x69bd('0x19')](saveUpdates(_0x4e1189['body'],null))[_0x69bd('0x19')](respondWithResult(_0xe854e8,null))[_0x69bd('0x23')](handleError(_0xe854e8,null));};var utilLicense=require(_0x69bd('0x15'));exports[_0x69bd('0x57')]=function(_0x4e44ae,_0x1eba10,_0x5f594b){var _0x2034ff=_0x69bd('0x58');var _0x18828={'custom':![]};return utilLicense[_0x69bd('0x59')]()[_0x69bd('0x19')](function(_0x863de8){if(_0x863de8){_0x18828=_0x863de8;}return db['Setting'][_0x69bd('0x50')]({'where':{'id':_0x4e44ae[_0x69bd('0x4a')]['id']},'attributes':[_0x69bd('0x5a'),'loginLogo',_0x69bd('0x5b'),_0x69bd('0x5c'),_0x69bd('0x5d'),_0x69bd('0x5e'),_0x69bd('0x5f'),_0x69bd('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x1eba10,null))[_0x69bd('0x19')](function(_0xf0e189){if(_0xf0e189){var _0x4cf38c=_0xf0e189['logo']&&fs[_0x69bd('0x61')](path[_0x69bd('0x62')](config[_0x69bd('0x63')],_0x2034ff,_[_0x69bd('0x64')](_0xf0e189[_0x69bd('0x5a')])))?path[_0x69bd('0x62')](config['root'],_0x2034ff,_[_0x69bd('0x64')](_0xf0e189['logo'])):path[_0x69bd('0x62')](config[_0x69bd('0x63')],_0x2034ff,_[_0x69bd('0x64')](_0x69bd('0x65')));var _0x357fe4=_0x69bd('0x66')+_[_0x69bd('0x67')](_0x69bd('0x5a'));if(_0xf0e189[_0x357fe4]||!_0x18828['custom']){_0x4cf38c=path['join'](config[_0x69bd('0x63')],_0x2034ff,_[_0x69bd('0x64')](_0x69bd('0x65')));}if(!fs[_0x69bd('0x61')](_0x4cf38c)){throw new db[(_0x69bd('0x68'))][(_0x69bd('0x69'))](_[_0x69bd('0x67')](_0x69bd('0x5a'))+_0x69bd('0x6a'));}return _0x1eba10[_0x69bd('0x6b')](_0x4cf38c);}})['catch'](handleError(_0x1eba10,null));};var utilLicense=require('../../config/license/util');exports[_0x69bd('0x6c')]=function(_0x47c9ce,_0x724525,_0x269ad1){var _0xe28f81=_0x69bd('0x58');var _0x34023f={'custom':![]};return utilLicense[_0x69bd('0x59')]()['then'](function(_0x48920f){if(_0x48920f){_0x34023f=_0x48920f;}return db[_0x69bd('0x34')][_0x69bd('0x50')]({'where':{'id':_0x47c9ce[_0x69bd('0x4a')]['id']},'attributes':['logo',_0x69bd('0x56'),'preferred',_0x69bd('0x5c'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x69bd('0x60')],'raw':!![]});})[_0x69bd('0x19')](handleEntityNotFound(_0x724525,null))[_0x69bd('0x19')](function(_0x45865e){if(_0x45865e){var _0x115dba=_0x45865e[_0x69bd('0x56')]&&fs[_0x69bd('0x61')](path[_0x69bd('0x62')](config[_0x69bd('0x63')],_0xe28f81,_[_0x69bd('0x64')](_0x45865e[_0x69bd('0x56')])))?path[_0x69bd('0x62')](config['root'],_0xe28f81,_[_0x69bd('0x64')](_0x45865e[_0x69bd('0x56')])):path[_0x69bd('0x62')](config[_0x69bd('0x63')],_0xe28f81,_[_0x69bd('0x64')]('default_loginLogo.svg'));var _0x560c43=_0x69bd('0x66')+_[_0x69bd('0x67')](_0x69bd('0x56'));if(_0x45865e[_0x560c43]||!_0x34023f[_0x69bd('0x6d')]){_0x115dba=path[_0x69bd('0x62')](config[_0x69bd('0x63')],_0xe28f81,_[_0x69bd('0x64')]('default_loginLogo.svg'));}if(!fs[_0x69bd('0x61')](_0x115dba)){throw new db[(_0x69bd('0x68'))]['ValidationError'](_['upperFirst']('loginLogo')+_0x69bd('0x6a'));}return _0x724525['download'](_0x115dba);}})[_0x69bd('0x23')](handleError(_0x724525,null));};exports[_0x69bd('0x6e')]=function(_0x26cedd,_0x74fa26){return db[_0x69bd('0x34')][_0x69bd('0x50')]({'where':{'id':_0x26cedd['params']['id']},'attributes':[_0x69bd('0x6f')]})['then'](respondWithResult(_0x74fa26,null))[_0x69bd('0x23')](handleError(_0x74fa26,null));};exports[_0x69bd('0x70')]=function(_0x5d24c3,_0x4ff8bf,_0x19f5c9){if(_0x5d24c3['file']&&_0x5d24c3[_0x69bd('0x53')][_0x69bd('0x54')]){_0x5d24c3[_0x69bd('0x51')][_0x69bd('0x5b')]=_0x5d24c3[_0x69bd('0x53')][_0x69bd('0x54')];}return db[_0x69bd('0x34')][_0x69bd('0x50')]({'where':{'id':_0x5d24c3[_0x69bd('0x4a')]['id']}})[_0x69bd('0x19')](handleEntityNotFound(_0x4ff8bf,null))[_0x69bd('0x19')](saveUpdates(_0x5d24c3[_0x69bd('0x51')],null))[_0x69bd('0x19')](respondWithResult(_0x4ff8bf,null))[_0x69bd('0x23')](handleError(_0x4ff8bf,null));};var utilLicense=require(_0x69bd('0x15'));exports['getPreferred']=function(_0x388d48,_0x5d5521,_0xb46c3a){var _0x29ede9=_0x69bd('0x58');var _0x3e1392={'custom':![]};return utilLicense[_0x69bd('0x59')]()[_0x69bd('0x19')](function(_0x1ec5fc){if(_0x1ec5fc){_0x3e1392=_0x1ec5fc;}return db[_0x69bd('0x34')][_0x69bd('0x50')]({'where':{'id':_0x388d48[_0x69bd('0x4a')]['id']},'attributes':['logo',_0x69bd('0x56'),'preferred',_0x69bd('0x5c'),_0x69bd('0x5d'),'defaultLoginLogo',_0x69bd('0x5f'),_0x69bd('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x5d5521,null))[_0x69bd('0x19')](function(_0x595a5d){if(_0x595a5d){var _0x52cef3=_0x595a5d[_0x69bd('0x5b')]&&fs['existsSync'](path[_0x69bd('0x62')](config['root'],_0x29ede9,_[_0x69bd('0x64')](_0x595a5d[_0x69bd('0x5b')])))?path['join'](config[_0x69bd('0x63')],_0x29ede9,_[_0x69bd('0x64')](_0x595a5d[_0x69bd('0x5b')])):path[_0x69bd('0x62')](config[_0x69bd('0x63')],_0x29ede9,_[_0x69bd('0x64')](_0x69bd('0x71')));var _0x365c2c=_0x69bd('0x66')+_[_0x69bd('0x67')]('preferred');if(_0x595a5d[_0x365c2c]||!_0x3e1392[_0x69bd('0x6d')]||!_0x3e1392['preferred']){_0x52cef3=path[_0x69bd('0x62')](config['root'],_0x29ede9,_[_0x69bd('0x64')](_0x69bd('0x71')));}if(!fs[_0x69bd('0x61')](_0x52cef3)){throw new db[(_0x69bd('0x68'))][(_0x69bd('0x69'))](_[_0x69bd('0x67')]('preferred')+_0x69bd('0x6a'));}return _0x5d5521[_0x69bd('0x6b')](_0x52cef3);}})[_0x69bd('0x23')](handleError(_0x5d5521,null));};exports[_0x69bd('0x72')]=function(_0x519179,_0x5ab6d3,_0x23700d){if(_0x519179['file']&&_0x519179[_0x69bd('0x53')][_0x69bd('0x54')]){_0x519179[_0x69bd('0x51')]['favicon']=_0x519179[_0x69bd('0x53')][_0x69bd('0x54')];}return db[_0x69bd('0x34')][_0x69bd('0x50')]({'where':{'id':_0x519179['params']['id']}})[_0x69bd('0x19')](handleEntityNotFound(_0x5ab6d3,null))['then'](saveUpdates(_0x519179[_0x69bd('0x51')],null))[_0x69bd('0x19')](respondWithResult(_0x5ab6d3,null))[_0x69bd('0x23')](handleError(_0x5ab6d3,null));};var utilLicense=require(_0x69bd('0x15'));exports['getFavicon']=function(_0x3f5259,_0x26b8d2,_0x4e03bf){var _0x256e20=_0x69bd('0x58');var _0x338ae4={'custom':![]};return utilLicense['getLicense']()[_0x69bd('0x19')](function(_0x2cbc76){if(_0x2cbc76){_0x338ae4=_0x2cbc76;}return db['Setting'][_0x69bd('0x50')]({'where':{'id':_0x3f5259[_0x69bd('0x4a')]['id']},'attributes':[_0x69bd('0x5a'),_0x69bd('0x56'),_0x69bd('0x5b'),_0x69bd('0x5c'),'defaultLogo',_0x69bd('0x5e'),_0x69bd('0x5f'),_0x69bd('0x60')],'raw':!![]});})[_0x69bd('0x19')](handleEntityNotFound(_0x26b8d2,null))[_0x69bd('0x19')](function(_0x17320b){if(_0x17320b){var _0x20b856=_0x17320b[_0x69bd('0x5c')]&&fs[_0x69bd('0x61')](path[_0x69bd('0x62')](config[_0x69bd('0x63')],_0x256e20,_['toLower'](_0x17320b['favicon'])))?path[_0x69bd('0x62')](config['root'],_0x256e20,_[_0x69bd('0x64')](_0x17320b[_0x69bd('0x5c')])):path[_0x69bd('0x62')](config[_0x69bd('0x63')],_0x256e20,_[_0x69bd('0x64')](_0x69bd('0x73')));var _0xaf0d22=_0x69bd('0x66')+_[_0x69bd('0x67')](_0x69bd('0x5c'));if(_0x17320b[_0xaf0d22]||!_0x338ae4['custom']){_0x20b856=path[_0x69bd('0x62')](config[_0x69bd('0x63')],_0x256e20,_[_0x69bd('0x64')]('default_favicon.ico'));}if(!fs[_0x69bd('0x61')](_0x20b856)){throw new db[(_0x69bd('0x68'))][(_0x69bd('0x69'))](_[_0x69bd('0x67')](_0x69bd('0x5c'))+_0x69bd('0x6a'));}return _0x26b8d2['download'](_0x20b856);}})['catch'](handleError(_0x26b8d2,null));};exports['getDate']=function(_0x22cac5,_0x3fce35){var _0x5c9adb={'offset':moment()[_0x69bd('0x74')]()};_0x5c9adb[_0x69bd('0x75')]=moment()[_0x69bd('0x74')](_0x5c9adb[_0x69bd('0x26')])[_0x69bd('0x76')](_0x69bd('0x77'));return _0x3fce35[_0x69bd('0x25')](0xc8)[_0x69bd('0x32')](_0x5c9adb);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 7f662c7..b7b3e62 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 _0x6815=['./setting.attributes','exports','define','Setting','settings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x16ed50,_0x3944dc){var _0x1b6a01=function(_0x531005){while(--_0x531005){_0x16ed50['push'](_0x16ed50['shift']());}};_0x1b6a01(++_0x3944dc);}(_0x6815,0x1b8));var _0x5681=function(_0x11cedf,_0x3a23e3){_0x11cedf=_0x11cedf-0x0;var _0x10eeda=_0x6815[_0x11cedf];return _0x10eeda;};'use strict';var _=require(_0x5681('0x0'));var util=require(_0x5681('0x1'));var logger=require(_0x5681('0x2'))(_0x5681('0x3'));var moment=require(_0x5681('0x4'));var BPromise=require(_0x5681('0x5'));var rp=require(_0x5681('0x6'));var fs=require('fs');var path=require(_0x5681('0x7'));var rimraf=require(_0x5681('0x8'));var config=require(_0x5681('0x9'));var attributes=require(_0x5681('0xa'));module[_0x5681('0xb')]=function(_0xdfe78e,_0x46459a){return _0xdfe78e[_0x5681('0xc')](_0x5681('0xd'),attributes,{'tableName':_0x5681('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ab2=['../../config/logger','api','path','rimraf','Setting','settings','lodash','util'];(function(_0x248e6b,_0x875efe){var _0x5a533e=function(_0x353589){while(--_0x353589){_0x248e6b['push'](_0x248e6b['shift']());}};_0x5a533e(++_0x875efe);}(_0x0ab2,0x1ae));var _0x20ab=function(_0x4a664f,_0x2dee8e){_0x4a664f=_0x4a664f-0x0;var _0x3e6c15=_0x0ab2[_0x4a664f];return _0x3e6c15;};'use strict';var _=require(_0x20ab('0x0'));var util=require(_0x20ab('0x1'));var logger=require(_0x20ab('0x2'))(_0x20ab('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x20ab('0x4'));var rimraf=require(_0x20ab('0x5'));var config=require('../../config/environment');var attributes=require('./setting.attributes');module['exports']=function(_0x456bcb,_0x41d6aa){return _0x456bcb['define'](_0x20ab('0x6'),attributes,{'tableName':_0x20ab('0x7'),'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 1b91bd3..367d1f7 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 _0xe147=['stringify','error','code','message','result','catch','ShowSetting','Setting','options','raw','where','map','include','model','then','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x3dbe2a,_0x5830ed){var _0x52b4c2=function(_0x3e2dd3){while(--_0x3e2dd3){_0x3dbe2a['push'](_0x3dbe2a['shift']());}};_0x52b4c2(++_0x5830ed);}(_0xe147,0x17b));var _0x7e14=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe147[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7e14('0x0'));var util=require(_0x7e14('0x1'));var moment=require('moment');var BPromise=require(_0x7e14('0x2'));var rs=require(_0x7e14('0x3'));var fs=require('fs');var Redis=require(_0x7e14('0x4'));var db=require(_0x7e14('0x5'))['db'];var utils=require(_0x7e14('0x6'));var logger=require(_0x7e14('0x7'))(_0x7e14('0x8'));var config=require(_0x7e14('0x9'));var jayson=require(_0x7e14('0xa'));var client=jayson['client'][_0x7e14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2db3d4,_0x5536d4,_0x24e723){return new BPromise(function(_0x5ba73b,_0x350920){return client[_0x7e14('0xc')](_0x2db3d4,_0x24e723)['then'](function(_0x198f48){logger[_0x7e14('0xd')](_0x7e14('0xe'),_0x5536d4,_0x7e14('0xf'));logger['debug'](_0x7e14('0x10'),_0x5536d4,'request\x20sent',JSON[_0x7e14('0x11')](_0x198f48));if(_0x198f48[_0x7e14('0x12')]){if(_0x198f48[_0x7e14('0x12')][_0x7e14('0x13')]===0x1f4){logger[_0x7e14('0x12')](_0x7e14('0xe'),_0x5536d4,_0x198f48[_0x7e14('0x12')][_0x7e14('0x14')]);return _0x350920(_0x198f48[_0x7e14('0x12')][_0x7e14('0x14')]);}logger[_0x7e14('0x12')](_0x7e14('0xe'),_0x5536d4,_0x198f48[_0x7e14('0x12')][_0x7e14('0x14')]);return _0x5ba73b(_0x198f48[_0x7e14('0x12')]['message']);}else{logger[_0x7e14('0xd')]('Setting,\x20%s,\x20%s',_0x5536d4,_0x7e14('0xf'));_0x5ba73b(_0x198f48[_0x7e14('0x15')][_0x7e14('0x14')]);}})[_0x7e14('0x16')](function(_0xf5deb1){logger[_0x7e14('0x12')](_0x7e14('0xe'),_0x5536d4,_0xf5deb1);_0x350920(_0xf5deb1);});});}exports[_0x7e14('0x17')]=function(_0x4ec53f){var _0xf70f77=this;return new Promise(function(_0x2e4cd6,_0x46c5ed){return db[_0x7e14('0x18')]['find']({'raw':_0x4ec53f[_0x7e14('0x19')]?_0x4ec53f[_0x7e14('0x19')][_0x7e14('0x1a')]===undefined?!![]:![]:!![],'where':_0x4ec53f[_0x7e14('0x19')]?_0x4ec53f[_0x7e14('0x19')][_0x7e14('0x1b')]||null:null,'attributes':_0x4ec53f[_0x7e14('0x19')]?_0x4ec53f[_0x7e14('0x19')]['attributes']||null:null,'include':_0x4ec53f['options']?_0x4ec53f['options']['include']?_[_0x7e14('0x1c')](_0x4ec53f[_0x7e14('0x19')][_0x7e14('0x1d')],function(_0x6fc963){return{'model':db[_0x6fc963['model']],'as':_0x6fc963['as'],'attributes':_0x6fc963['attributes'],'include':_0x6fc963[_0x7e14('0x1d')]?_[_0x7e14('0x1c')](_0x6fc963[_0x7e14('0x1d')],function(_0x56df9e){return{'model':db[_0x56df9e['model']],'as':_0x56df9e['as'],'attributes':_0x56df9e['attributes'],'include':_0x56df9e['include']?_[_0x7e14('0x1c')](_0x56df9e[_0x7e14('0x1d')],function(_0x1ca3f4){return{'model':db[_0x1ca3f4[_0x7e14('0x1e')]],'as':_0x1ca3f4['as'],'attributes':_0x1ca3f4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7e14('0x1f')](function(_0x950f5c){logger[_0x7e14('0xd')]('ShowSetting',_0x4ec53f);logger[_0x7e14('0x20')](_0x7e14('0x17'),_0x4ec53f,JSON['stringify'](_0x950f5c));_0x2e4cd6(_0x950f5c);})[_0x7e14('0x16')](function(_0x1c989f){logger[_0x7e14('0x12')](_0x7e14('0x17'),_0x1c989f[_0x7e14('0x14')],_0x4ec53f);_0x46c5ed(_0xf70f77[_0x7e14('0x12')](0x1f4,_0x1c989f['message']));});});}; \ No newline at end of file +var _0x3331=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','debug','stringify','lodash','util','moment'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0x3331,0xfd));var _0x1333=function(_0x3654a2,_0x3eb58a){_0x3654a2=_0x3654a2-0x0;var _0x2720fd=_0x3331[_0x3654a2];return _0x2720fd;};'use strict';var _=require(_0x1333('0x0'));var util=require(_0x1333('0x1'));var moment=require(_0x1333('0x2'));var BPromise=require(_0x1333('0x3'));var rs=require(_0x1333('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1333('0x5'))['db'];var utils=require(_0x1333('0x6'));var logger=require(_0x1333('0x7'))(_0x1333('0x8'));var config=require('../../config/environment');var jayson=require(_0x1333('0x9'));var client=jayson['client'][_0x1333('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ccab,_0x4243d7,_0x35fe46){return new BPromise(function(_0x4b68e8,_0x2fa15e){return client['request'](_0x57ccab,_0x35fe46)[_0x1333('0xb')](function(_0x15b15b){logger[_0x1333('0xc')]('Setting,\x20%s,\x20%s',_0x4243d7,_0x1333('0xd'));logger['debug'](_0x1333('0xe'),_0x4243d7,'request\x20sent',JSON['stringify'](_0x15b15b));if(_0x15b15b[_0x1333('0xf')]){if(_0x15b15b[_0x1333('0xf')][_0x1333('0x10')]===0x1f4){logger['error'](_0x1333('0x11'),_0x4243d7,_0x15b15b[_0x1333('0xf')][_0x1333('0x12')]);return _0x2fa15e(_0x15b15b[_0x1333('0xf')][_0x1333('0x12')]);}logger[_0x1333('0xf')]('Setting,\x20%s,\x20%s',_0x4243d7,_0x15b15b[_0x1333('0xf')]['message']);return _0x4b68e8(_0x15b15b[_0x1333('0xf')][_0x1333('0x12')]);}else{logger[_0x1333('0xc')](_0x1333('0x11'),_0x4243d7,_0x1333('0xd'));_0x4b68e8(_0x15b15b['result'][_0x1333('0x12')]);}})[_0x1333('0x13')](function(_0x337637){logger['error'](_0x1333('0x11'),_0x4243d7,_0x337637);_0x2fa15e(_0x337637);});});}exports[_0x1333('0x14')]=function(_0x197fa8){var _0x15f27f=this;return new Promise(function(_0x4b972e,_0x8c17ae){return db[_0x1333('0x15')][_0x1333('0x16')]({'raw':_0x197fa8[_0x1333('0x17')]?_0x197fa8['options'][_0x1333('0x18')]===undefined?!![]:![]:!![],'where':_0x197fa8[_0x1333('0x17')]?_0x197fa8[_0x1333('0x17')][_0x1333('0x19')]||null:null,'attributes':_0x197fa8[_0x1333('0x17')]?_0x197fa8[_0x1333('0x17')][_0x1333('0x1a')]||null:null,'include':_0x197fa8['options']?_0x197fa8['options'][_0x1333('0x1b')]?_[_0x1333('0x1c')](_0x197fa8[_0x1333('0x17')]['include'],function(_0x55fee3){return{'model':db[_0x55fee3[_0x1333('0x1d')]],'as':_0x55fee3['as'],'attributes':_0x55fee3[_0x1333('0x1a')],'include':_0x55fee3[_0x1333('0x1b')]?_[_0x1333('0x1c')](_0x55fee3['include'],function(_0xd19508){return{'model':db[_0xd19508['model']],'as':_0xd19508['as'],'attributes':_0xd19508[_0x1333('0x1a')],'include':_0xd19508['include']?_['map'](_0xd19508[_0x1333('0x1b')],function(_0x1bd846){return{'model':db[_0x1bd846[_0x1333('0x1d')]],'as':_0x1bd846['as'],'attributes':_0x1bd846[_0x1333('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1333('0xb')](function(_0x2b2b58){logger[_0x1333('0xc')]('ShowSetting',_0x197fa8);logger[_0x1333('0x1e')](_0x1333('0x14'),_0x197fa8,JSON[_0x1333('0x1f')](_0x2b2b58));_0x4b972e(_0x2b2b58);})[_0x1333('0x13')](function(_0x4cfaa5){logger[_0x1333('0xf')](_0x1333('0x14'),_0x4cfaa5['message'],_0x197fa8);_0x8c17ae(_0x15f27f[_0x1333('0xf')](0x1f4,_0x4cfaa5[_0x1333('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index b74bb8d..9551ec6 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 _0xcd6d=['index','get','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','post','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAgents','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','isAuthenticated'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xcd6d,0x101));var _0xdcd6=function(_0x55ae5d,_0x41ac03){_0x55ae5d=_0x55ae5d-0x0;var _0x2f4fca=_0xcd6d[_0x55ae5d];return _0x2f4fca;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdcd6('0x0'));var timeout=require(_0xdcd6('0x1'));var express=require('express');var router=express[_0xdcd6('0x2')]();var fs_extra=require(_0xdcd6('0x3'));var auth=require(_0xdcd6('0x4'));var interaction=require(_0xdcd6('0x5'));var config=require(_0xdcd6('0x6'));var controller=require(_0xdcd6('0x7'));router['get']('/',auth[_0xdcd6('0x8')](),controller[_0xdcd6('0x9')]);router[_0xdcd6('0xa')](_0xdcd6('0xb'),auth[_0xdcd6('0x8')](),controller[_0xdcd6('0xc')]);router['get'](_0xdcd6('0xd'),auth[_0xdcd6('0x8')](),controller[_0xdcd6('0xe')]);router[_0xdcd6('0xa')](_0xdcd6('0xf'),auth[_0xdcd6('0x8')](),controller['getDispositions']);router['get'](_0xdcd6('0x10'),auth[_0xdcd6('0x8')](),controller[_0xdcd6('0x11')]);router[_0xdcd6('0xa')](_0xdcd6('0x12'),auth[_0xdcd6('0x8')](),controller['getApplications']);router['get'](_0xdcd6('0x13'),auth[_0xdcd6('0x8')](),controller['getInteractions']);router[_0xdcd6('0xa')](_0xdcd6('0x14'),controller[_0xdcd6('0x15')]);router['get'](_0xdcd6('0x16'),auth[_0xdcd6('0x8')](),controller[_0xdcd6('0x17')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/dispositions',auth[_0xdcd6('0x8')](),controller['addDisposition']);router[_0xdcd6('0x18')](_0xdcd6('0x10'),auth[_0xdcd6('0x8')](),controller[_0xdcd6('0x19')]);router['post'](_0xdcd6('0x1a'),controller[_0xdcd6('0x1b')]);router[_0xdcd6('0x18')](_0xdcd6('0x12'),auth['isAuthenticated'](),controller[_0xdcd6('0x1c')]);router[_0xdcd6('0x18')](_0xdcd6('0x1d'),auth[_0xdcd6('0x8')](),controller[_0xdcd6('0x1e')]);router['post'](_0xdcd6('0x14'),controller['status']);router['post']('/:id/users',auth[_0xdcd6('0x8')](),controller[_0xdcd6('0x1f')]);router[_0xdcd6('0x20')](_0xdcd6('0xd'),auth[_0xdcd6('0x8')](),controller[_0xdcd6('0x21')]);router[_0xdcd6('0x22')](_0xdcd6('0xd'),auth[_0xdcd6('0x8')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xdcd6('0x8')](),controller[_0xdcd6('0x23')]);router[_0xdcd6('0x22')](_0xdcd6('0x10'),auth[_0xdcd6('0x8')](),controller['removeAnswers']);router['delete'](_0xdcd6('0x16'),auth[_0xdcd6('0x8')](),controller[_0xdcd6('0x24')]);module[_0xdcd6('0x25')]=router; \ No newline at end of file +var _0x8513=['/:id/status','status','/:id/users','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','statusGet','getAgents','post','create','/:id/dispositions','addAnswer','notify'];(function(_0x2710ae,_0x2ae101){var _0x143a88=function(_0x1efeda){while(--_0x1efeda){_0x2710ae['push'](_0x2710ae['shift']());}};_0x143a88(++_0x2ae101);}(_0x8513,0xee));var _0x3851=function(_0x28eac5,_0xa97850){_0x28eac5=_0x28eac5-0x0;var _0x390702=_0x8513[_0x28eac5];return _0x390702;};'use strict';var multer=require(_0x3851('0x0'));var util=require('util');var path=require(_0x3851('0x1'));var timeout=require('connect-timeout');var express=require(_0x3851('0x2'));var router=express[_0x3851('0x3')]();var fs_extra=require(_0x3851('0x4'));var auth=require(_0x3851('0x5'));var interaction=require(_0x3851('0x6'));var config=require(_0x3851('0x7'));var controller=require('./smsAccount.controller');router[_0x3851('0x8')]('/',auth['isAuthenticated'](),controller[_0x3851('0x9')]);router[_0x3851('0x8')](_0x3851('0xa'),auth[_0x3851('0xb')](),controller[_0x3851('0xc')]);router['get'](_0x3851('0xd'),auth[_0x3851('0xb')](),controller[_0x3851('0xe')]);router['get']('/:id/dispositions',auth[_0x3851('0xb')](),controller[_0x3851('0xf')]);router[_0x3851('0x8')](_0x3851('0x10'),auth['isAuthenticated'](),controller[_0x3851('0x11')]);router[_0x3851('0x8')](_0x3851('0x12'),auth[_0x3851('0xb')](),controller[_0x3851('0x13')]);router[_0x3851('0x8')]('/:id/interactions',auth[_0x3851('0xb')](),controller[_0x3851('0x14')]);router['get']('/:id/status',controller[_0x3851('0x15')]);router[_0x3851('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x3851('0x16')]);router[_0x3851('0x17')]('/',auth[_0x3851('0xb')](),controller[_0x3851('0x18')]);router[_0x3851('0x17')](_0x3851('0x19'),auth[_0x3851('0xb')](),controller['addDisposition']);router[_0x3851('0x17')](_0x3851('0x10'),auth[_0x3851('0xb')](),controller[_0x3851('0x1a')]);router[_0x3851('0x17')]('/:id/notify',controller[_0x3851('0x1b')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x3851('0x17')]('/:id/send',auth[_0x3851('0xb')](),controller['send']);router[_0x3851('0x17')](_0x3851('0x1c'),controller[_0x3851('0x1d')]);router[_0x3851('0x17')](_0x3851('0x1e'),auth[_0x3851('0xb')](),controller['addAgents']);router[_0x3851('0x1f')](_0x3851('0xd'),auth[_0x3851('0xb')](),controller[_0x3851('0x20')]);router[_0x3851('0x21')]('/:id',auth[_0x3851('0xb')](),controller[_0x3851('0x22')]);router[_0x3851('0x21')](_0x3851('0x19'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x3851('0x10'),auth[_0x3851('0xb')](),controller[_0x3851('0x23')]);router[_0x3851('0x21')]('/:id/users',auth[_0x3851('0xb')](),controller[_0x3851('0x24')]);module[_0x3851('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 796f7c7..7354b8a 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 _0x7e05=['sequelize','randomstring','STRING','ENUM','twilio','skebby','clicksend','clickatell','bandwidth','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'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7e05,0x69));var _0x57e0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7e05[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x57e0('0x0'));var rs=require(_0x57e0('0x1'));module['exports']={'name':{'type':Sequelize[_0x57e0('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x57e0('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x57e0('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x57e0('0x2')]},'type':{'type':Sequelize[_0x57e0('0x3')](_0x57e0('0x4'),_0x57e0('0x5'),'connectel',_0x57e0('0x6'),'plivo',_0x57e0('0x7'),_0x57e0('0x8'),_0x57e0('0x9'),_0x57e0('0xa'),_0x57e0('0xb'))},'accountSid':{'type':Sequelize[_0x57e0('0x2')]},'authId':{'type':Sequelize[_0x57e0('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x57e0('0x3')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x57e0('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x57e0('0x2')]},'accountId':{'type':Sequelize[_0x57e0('0x2')]},'senderString':{'type':Sequelize[_0x57e0('0x2')]},'deliveryReport':{'type':Sequelize[_0x57e0('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x57e0('0x2')]},'notificationTemplate':{'type':Sequelize[_0x57e0('0xd')],'defaultValue':function(){return _0x57e0('0xe');}},'notificationSound':{'type':Sequelize[_0x57e0('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x57e0('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x57e0('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x57e0('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x57e0('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x57e0('0xf')],'comment':_0x57e0('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x57e0('0xc')],'defaultValue':![],'comment':_0x57e0('0x11'),'set':function(_0x304ec4){if(!_0x304ec4)this['setDataValue'](_0x57e0('0x12'),null);this[_0x57e0('0x13')](_0x57e0('0x14'),_0x304ec4);}}}; \ No newline at end of file +var _0x6b24=['mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','skebby','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x3e186f,_0x2eb7be){var _0x3595bf=function(_0x5cb578){while(--_0x5cb578){_0x3e186f['push'](_0x3e186f['shift']());}};_0x3595bf(++_0x2eb7be);}(_0x6b24,0x1ce));var _0x46b2=function(_0x3fcc96,_0x1c65d4){_0x3fcc96=_0x3fcc96-0x0;var _0x5caa7a=_0x6b24[_0x3fcc96];return _0x5caa7a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x46b2('0x0'));module[_0x46b2('0x1')]={'name':{'type':Sequelize[_0x46b2('0x2')],'unique':_0x46b2('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x46b2('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x46b2('0x5')]('twilio',_0x46b2('0x6'),'connectel','clicksend',_0x46b2('0x7'),_0x46b2('0x8'),_0x46b2('0x9'),_0x46b2('0xa'),_0x46b2('0xb'),_0x46b2('0xc'))},'accountSid':{'type':Sequelize[_0x46b2('0x2')]},'authId':{'type':Sequelize[_0x46b2('0x2')]},'authToken':{'type':Sequelize[_0x46b2('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x46b2('0x2')]},'apiKey':{'type':Sequelize[_0x46b2('0x2')]},'applicationId':{'type':Sequelize[_0x46b2('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x46b2('0x2')]},'deliveryReport':{'type':Sequelize[_0x46b2('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x46b2('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x46b2('0xe');}},'notificationSound':{'type':Sequelize[_0x46b2('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x46b2('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x46b2('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x46b2('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x46b2('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x46b2('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x46b2('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x46b2('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x46b2('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x46b2('0xd')],'defaultValue':![],'comment':_0x46b2('0x10'),'set':function(_0x49479c){if(!_0x49479c)this[_0x46b2('0x11')](_0x46b2('0x12'),null);this[_0x46b2('0x11')](_0x46b2('0x13'),_0x49479c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 06c070b..ca37a24 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 _0x601e=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','SmsAccounts','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','describe','addDisposition','SmsAccountId','Disposition','findOne','order','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','Applications','account','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','From','Body','messageId','skebby','text','connectel','from','clicksend','message_id','plivo','Text','results','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','interaction','autoclose','push','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','addApplications','sequelize','transaction','SmsApplication','priority','getApplications','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','infobip','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','state','message-id','csc','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x2da94a,_0x4ca1ac){var _0x1e6246=function(_0x1c35b8){while(--_0x1c35b8){_0x2da94a['push'](_0x2da94a['shift']());}};_0x1e6246(++_0x4ca1ac);}(_0x601e,0xce));var _0xe601=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x601e[_0x16de68];return _0x1c277e;};'use strict';var emlformat=require(_0xe601('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe601('0x1'));var jsonpatch=require(_0xe601('0x2'));var rp=require('request-promise');var moment=require(_0xe601('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe601('0x4'));var util=require(_0xe601('0x5'));var path=require(_0xe601('0x6'));var sox=require(_0xe601('0x7'));var csv=require(_0xe601('0x8'));var ejs=require(_0xe601('0x9'));var fs=require('fs');var fs_extra=require(_0xe601('0xa'));var _=require(_0xe601('0xb'));var squel=require(_0xe601('0xc'));var crypto=require('crypto');var jsforce=require(_0xe601('0xd'));var deskjs=require(_0xe601('0xe'));var toCsv=require(_0xe601('0x8'));var querystring=require('querystring');var Papa=require(_0xe601('0xf'));var Redis=require('ioredis');var authService=require(_0xe601('0x10'));var qs=require(_0xe601('0x11'));var as=require(_0xe601('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe601('0x13'))(_0xe601('0x14'));var utils=require(_0xe601('0x15'));var config=require(_0xe601('0x16'));var licenseUtil=require(_0xe601('0x17'));var db=require(_0xe601('0x18'))['db'];config[_0xe601('0x19')]=_['defaults'](config[_0xe601('0x19')],{'host':_0xe601('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);var jayson=require(_0xe601('0x1b'));var client=jayson[_0xe601('0x1c')][_0xe601('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x402135,_0x378d61,_0xda6910,_0x3ba087){return new BPromise(function(_0x5e5bf7,_0x2887ff){var _0x224245=_0x3ba087||client;return _0x224245['request'](_0x402135,_0xda6910)[_0xe601('0x1e')](function(_0x5178a2){logger[_0xe601('0x1f')](_0xe601('0x20'),_0x378d61,'request\x20sent');logger['debug'](_0xe601('0x21'),_0x378d61,_0xe601('0x22'),JSON[_0xe601('0x23')](_0x5178a2));if(_0x5178a2[_0xe601('0x24')]){if(_0x5178a2['error'][_0xe601('0x25')]===0x1f4){logger[_0xe601('0x24')](_0xe601('0x20'),_0x378d61,_0x5178a2[_0xe601('0x24')][_0xe601('0x26')]);return _0x2887ff(_0x5178a2[_0xe601('0x24')][_0xe601('0x26')]);}logger[_0xe601('0x24')](_0xe601('0x20'),_0x378d61,_0x5178a2[_0xe601('0x24')][_0xe601('0x26')]);return _0x5e5bf7(_0x5178a2[_0xe601('0x24')][_0xe601('0x26')]);}else{logger['info'](_0xe601('0x20'),_0x378d61,_0xe601('0x22'));_0x5e5bf7(_0x5178a2['result'][_0xe601('0x26')]);}})[_0xe601('0x27')](function(_0x11fc32){logger[_0xe601('0x24')](_0xe601('0x20'),_0x378d61,_0x11fc32);_0x2887ff(_0x11fc32);});});}function respondWithStatusCode(_0x2a3741,_0x313ced){_0x313ced=_0x313ced||0xcc;return function(_0x1c405a){if(_0x1c405a){return _0x2a3741[_0xe601('0x28')](_0x313ced);}return _0x2a3741[_0xe601('0x29')](_0x313ced)['end']();};}function respondWithResult(_0x2599f1,_0x4c990){_0x4c990=_0x4c990||0xc8;return function(_0x63857a){if(_0x63857a){return _0x2599f1[_0xe601('0x29')](_0x4c990)[_0xe601('0x2a')](_0x63857a);}};}function respondWithFilteredResult(_0x12c18f,_0x357adb){return function(_0x4efcbf){if(_0x4efcbf){var _0xf11e82=typeof _0x357adb['offset']===_0xe601('0x2b')&&typeof _0x357adb[_0xe601('0x2c')]===_0xe601('0x2b');var _0x518a4a=_0x4efcbf[_0xe601('0x2d')];var _0x778b62=_0xf11e82?0x0:_0x357adb[_0xe601('0x2e')];var _0x53e26e=_0xf11e82?_0x4efcbf['count']:_0x357adb[_0xe601('0x2e')]+_0x357adb[_0xe601('0x2c')];var _0xd0ecdc;if(_0x53e26e>=_0x518a4a){_0x53e26e=_0x518a4a;_0xd0ecdc=0xc8;}else{_0xd0ecdc=0xce;}_0x12c18f[_0xe601('0x29')](_0xd0ecdc);return _0x12c18f[_0xe601('0x2f')](_0xe601('0x30'),_0x778b62+'-'+_0x53e26e+'/'+_0x518a4a)['json'](_0x4efcbf);}return null;};}function patchUpdates(_0x200c7e){return function(_0x1dd8ac){try{jsonpatch[_0xe601('0x31')](_0x1dd8ac,_0x200c7e,!![]);}catch(_0x4785c5){return BPromise['reject'](_0x4785c5);}return _0x1dd8ac[_0xe601('0x32')]();};}function saveUpdates(_0x1706e4,_0x36c502){return function(_0x10727a){if(_0x10727a){return _0x10727a[_0xe601('0x33')](_0x1706e4)[_0xe601('0x1e')](function(_0x508b1c){return _0x508b1c;});}return null;};}function removeEntity(_0xf13dad,_0x3a637a){return function(_0x414126){if(_0x414126){return _0x414126[_0xe601('0x34')]()[_0xe601('0x1e')](function(){var _0x4d6e6d=_0x414126['get']({'plain':!![]});var _0x543043=_0xe601('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x543043,'resourceId':_0x4d6e6d['id']}})[_0xe601('0x1e')](function(){return _0x414126;});})['then'](function(){_0xf13dad[_0xe601('0x29')](0xcc)[_0xe601('0x36')]();});}};}function handleEntityNotFound(_0x16a078,_0xacb6c7){return function(_0x445c3d){if(!_0x445c3d){_0x16a078['sendStatus'](0x194);}return _0x445c3d;};}function handleError(_0xe7fc47,_0x4999b3){_0x4999b3=_0x4999b3||0x1f4;return function(_0x8f9d03){logger[_0xe601('0x24')](_0x8f9d03[_0xe601('0x37')]);if(_0x8f9d03[_0xe601('0x38')]){delete _0x8f9d03[_0xe601('0x38')];}_0xe7fc47[_0xe601('0x29')](_0x4999b3)[_0xe601('0x39')](_0x8f9d03);};}exports[_0xe601('0x3a')]=function(_0x5e5b04,_0x56a880){var _0x4f3a8f={'include':[{'model':db[_0xe601('0x3b')],'as':_0xe601('0x3c')}]},_0x67b0e2={},_0x3af5a1={'count':0x0,'rows':[]};var _0x3160be=_[_0xe601('0x3d')](db[_0xe601('0x3e')]['rawAttributes'],function(_0x7c452){return{'name':_0x7c452[_0xe601('0x3f')],'type':_0x7c452[_0xe601('0x40')][_0xe601('0x41')]};});_0x67b0e2[_0xe601('0x42')]=_[_0xe601('0x3d')](_0x3160be,'name');_0x67b0e2[_0xe601('0x43')]=_[_0xe601('0x44')](_0x5e5b04[_0xe601('0x43')]);_0x67b0e2[_0xe601('0x45')]=_[_0xe601('0x46')](_0x67b0e2['model'],_0x67b0e2['query']);_0x4f3a8f['attributes']=_[_0xe601('0x46')](_0x67b0e2[_0xe601('0x42')],qs[_0xe601('0x47')](_0x5e5b04[_0xe601('0x43')]['fields']));_0x4f3a8f[_0xe601('0x48')]=_0x4f3a8f[_0xe601('0x48')][_0xe601('0x49')]?_0x4f3a8f['attributes']:_0x67b0e2[_0xe601('0x42')];if(!_0x5e5b04['query'][_0xe601('0x4a')](_0xe601('0x4b'))){_0x4f3a8f[_0xe601('0x2c')]=qs[_0xe601('0x2c')](_0x5e5b04[_0xe601('0x43')][_0xe601('0x2c')]);_0x4f3a8f['offset']=qs['offset'](_0x5e5b04[_0xe601('0x43')]['offset']);}_0x4f3a8f['order']=qs[_0xe601('0x4c')](_0x5e5b04['query'][_0xe601('0x4c')]);_0x4f3a8f['where']=qs['filters'](_[_0xe601('0x4d')](_0x5e5b04[_0xe601('0x43')],_0x67b0e2['filters']),_0x3160be);if(_0x5e5b04[_0xe601('0x43')][_0xe601('0x4e')]){_0x4f3a8f['where']=_[_0xe601('0x4f')](_0x4f3a8f[_0xe601('0x50')],{'$or':_[_0xe601('0x3d')](_0x3160be,function(_0x1389dc){if(_0x1389dc[_0xe601('0x40')]!==_0xe601('0x51')){var _0x1c0a1d={};_0x1c0a1d[_0x1389dc[_0xe601('0x38')]]={'$like':'%'+_0x5e5b04[_0xe601('0x43')]['filter']+'%'};return _0x1c0a1d;}})});}_0x4f3a8f=_[_0xe601('0x4f')]({},_0x4f3a8f,_0x5e5b04[_0xe601('0x52')]);var _0x5df624={'where':_0x4f3a8f[_0xe601('0x50')]};return db[_0xe601('0x3e')][_0xe601('0x2d')](_0x5df624)[_0xe601('0x1e')](function(_0x3ec7f5){_0x3af5a1[_0xe601('0x2d')]=_0x3ec7f5;if(_0x5e5b04[_0xe601('0x43')][_0xe601('0x53')]){_0x4f3a8f['include']=[{'all':!![]}];}return db['SmsAccount'][_0xe601('0x54')](_0x4f3a8f);})[_0xe601('0x1e')](function(_0x4a6ffe){_0x3af5a1['rows']=_0x4a6ffe;return _0x3af5a1;})[_0xe601('0x1e')](respondWithFilteredResult(_0x56a880,_0x4f3a8f))[_0xe601('0x27')](handleError(_0x56a880,null));};exports[_0xe601('0x55')]=function(_0x585dd9,_0x3d0c1b){var _0x20f70c={'raw':![],'where':{'id':_0x585dd9[_0xe601('0x56')]['id']},'include':[{'model':db[_0xe601('0x3b')],'as':_0xe601('0x3c')}]},_0x57390c={};_0x57390c[_0xe601('0x42')]=_[_0xe601('0x44')](db[_0xe601('0x3e')][_0xe601('0x57')]);_0x57390c[_0xe601('0x43')]=_['keys'](_0x585dd9[_0xe601('0x43')]);_0x57390c[_0xe601('0x45')]=_[_0xe601('0x46')](_0x57390c['model'],_0x57390c['query']);_0x20f70c[_0xe601('0x48')]=_[_0xe601('0x46')](_0x57390c[_0xe601('0x42')],qs[_0xe601('0x47')](_0x585dd9[_0xe601('0x43')][_0xe601('0x47')]));_0x20f70c[_0xe601('0x48')]=_0x20f70c[_0xe601('0x48')][_0xe601('0x49')]?_0x20f70c[_0xe601('0x48')]:_0x57390c[_0xe601('0x42')];if(_0x585dd9[_0xe601('0x43')]['includeAll']){_0x20f70c[_0xe601('0x58')]=[{'all':!![]}];}_0x20f70c=_[_0xe601('0x4f')]({},_0x20f70c,_0x585dd9['options']);return db['SmsAccount'][_0xe601('0x59')](_0x20f70c)[_0xe601('0x1e')](handleEntityNotFound(_0x3d0c1b,null))[_0xe601('0x1e')](respondWithResult(_0x3d0c1b,null))[_0xe601('0x27')](handleError(_0x3d0c1b,null));};exports[_0xe601('0x5a')]=function(_0x5a3fa0,_0x103d57){return db['SmsAccount'][_0xe601('0x5a')](_0x5a3fa0[_0xe601('0x5b')],{})[_0xe601('0x1e')](function(_0x1cdb70){var _0x2a05dd=_0x5a3fa0[_0xe601('0x5c')][_0xe601('0x5d')]({'plain':!![]});if(!_0x2a05dd)throw new Error(_0xe601('0x5e'));if(_0x2a05dd[_0xe601('0x5f')]===_0xe601('0x5c')){var _0x3ba1e0=_0x1cdb70[_0xe601('0x5d')]({'plain':!![]});var _0x58a2a5=_0xe601('0x35');return db[_0xe601('0x60')][_0xe601('0x59')]({'where':{'name':_0x58a2a5,'userProfileId':_0x2a05dd['userProfileId']},'raw':!![]})[_0xe601('0x1e')](function(_0x2013b8){if(_0x2013b8&&_0x2013b8[_0xe601('0x61')]===0x0){return db[_0xe601('0x62')][_0xe601('0x5a')]({'name':_0x3ba1e0[_0xe601('0x38')],'resourceId':_0x3ba1e0['id'],'type':_0x2013b8['name'],'sectionId':_0x2013b8['id']},{})[_0xe601('0x1e')](function(){return _0x1cdb70;});}else{return _0x1cdb70;}})[_0xe601('0x27')](function(_0x13c59f){logger[_0xe601('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13c59f);throw _0x13c59f;});}return _0x1cdb70;})['then'](respondWithResult(_0x103d57,0xc9))['catch'](handleError(_0x103d57,null));};exports['update']=function(_0x4a9a3c,_0x2cb85e){if(_0x4a9a3c[_0xe601('0x5b')]['id']){delete _0x4a9a3c[_0xe601('0x5b')]['id'];}return db[_0xe601('0x3e')]['find']({'where':{'id':_0x4a9a3c[_0xe601('0x56')]['id']},'include':[{'model':db[_0xe601('0x3b')],'as':_0xe601('0x3c')}]})['then'](handleEntityNotFound(_0x2cb85e,null))[_0xe601('0x1e')](saveUpdates(_0x4a9a3c[_0xe601('0x5b')],null))[_0xe601('0x1e')](respondWithResult(_0x2cb85e,null))[_0xe601('0x27')](handleError(_0x2cb85e,null));};exports[_0xe601('0x34')]=function(_0x45ea83,_0x1495a6){return db[_0xe601('0x3e')][_0xe601('0x59')]({'where':{'id':_0x45ea83[_0xe601('0x56')]['id']}})['then'](handleEntityNotFound(_0x1495a6,null))['then'](removeEntity(_0x1495a6,null))[_0xe601('0x27')](handleError(_0x1495a6,null));};exports[_0xe601('0x63')]=function(_0x4bc325,_0x3bb852){return db[_0xe601('0x3e')][_0xe601('0x63')]()[_0xe601('0x1e')](respondWithResult(_0x3bb852,null))[_0xe601('0x27')](handleError(_0x3bb852,null));};exports[_0xe601('0x64')]=function(_0x579a65,_0x553dc9,_0x2a8d23){if(_0x579a65['body']['id']){delete _0x579a65[_0xe601('0x5b')]['id'];}return db['SmsAccount'][_0xe601('0x59')]({'where':{'id':_0x579a65[_0xe601('0x56')]['id']}})[_0xe601('0x1e')](handleEntityNotFound(_0x553dc9,null))[_0xe601('0x1e')](function(_0x32d01e){if(_0x32d01e){_0x579a65[_0xe601('0x5b')][_0xe601('0x65')]=_0x32d01e['id'];return db[_0xe601('0x66')][_0xe601('0x5a')](_0x579a65['body']);}})[_0xe601('0x1e')](respondWithResult(_0x553dc9,null))['catch'](handleError(_0x553dc9,null));};exports['getDispositions']=function(_0x4a4877,_0xb66be,_0x2f1d3e){var _0x423880={'raw':![],'where':{}};var _0x3c748f={};var _0x2df676={'count':0x0,'rows':[]};return db[_0xe601('0x3e')][_0xe601('0x67')]({'where':{'id':_0x4a4877[_0xe601('0x56')]['id']}})[_0xe601('0x1e')](handleEntityNotFound(_0xb66be,null))[_0xe601('0x1e')](function(_0x3aa6a9){if(_0x3aa6a9){_0x3c748f[_0xe601('0x42')]=_[_0xe601('0x44')](db[_0xe601('0x66')][_0xe601('0x57')]);_0x3c748f[_0xe601('0x43')]=_['keys'](_0x4a4877[_0xe601('0x43')]);_0x3c748f['filters']=_['intersection'](_0x3c748f[_0xe601('0x42')],_0x3c748f[_0xe601('0x43')]);_0x423880[_0xe601('0x48')]=_[_0xe601('0x46')](_0x3c748f[_0xe601('0x42')],qs[_0xe601('0x47')](_0x4a4877[_0xe601('0x43')]['fields']));_0x423880[_0xe601('0x48')]=_0x423880[_0xe601('0x48')]['length']?_0x423880[_0xe601('0x48')]:_0x3c748f[_0xe601('0x42')];if(!_0x4a4877[_0xe601('0x43')][_0xe601('0x4a')](_0xe601('0x4b'))){_0x423880[_0xe601('0x2c')]=qs[_0xe601('0x2c')](_0x4a4877[_0xe601('0x43')][_0xe601('0x2c')]);_0x423880[_0xe601('0x2e')]=qs[_0xe601('0x2e')](_0x4a4877[_0xe601('0x43')][_0xe601('0x2e')]);}_0x423880[_0xe601('0x68')]=qs['sort'](_0x4a4877[_0xe601('0x43')][_0xe601('0x4c')]);_0x423880['where']=qs[_0xe601('0x45')](_[_0xe601('0x4d')](_0x4a4877[_0xe601('0x43')],_0x3c748f[_0xe601('0x45')]));_0x423880[_0xe601('0x50')][_0xe601('0x65')]=_0x3aa6a9['id'];if(_0x4a4877['query'][_0xe601('0x4e')]){_0x423880[_0xe601('0x50')]=_['merge'](_0x423880[_0xe601('0x50')],{'$or':_[_0xe601('0x3d')](_0x423880[_0xe601('0x48')],function(_0x408c91){var _0x51e7f7={};_0x51e7f7[_0x408c91]={'$like':'%'+_0x4a4877['query']['filter']+'%'};return _0x51e7f7;})});}_0x423880=_[_0xe601('0x4f')]({},_0x423880,_0x4a4877[_0xe601('0x52')]);return db[_0xe601('0x66')][_0xe601('0x2d')]({'where':_0x423880['where']})[_0xe601('0x1e')](function(_0x289d21){_0x2df676['count']=_0x289d21;if(_0x4a4877['query'][_0xe601('0x53')]){_0x423880[_0xe601('0x58')]=[{'all':!![]}];}return db[_0xe601('0x66')][_0xe601('0x54')](_0x423880);})[_0xe601('0x1e')](function(_0x59de9c){_0x2df676[_0xe601('0x69')]=_0x59de9c;return _0x2df676;});}})[_0xe601('0x1e')](respondWithFilteredResult(_0xb66be,_0x423880))[_0xe601('0x27')](handleError(_0xb66be,null));};exports[_0xe601('0x6a')]=function(_0x508a9d,_0x5d1b8d,_0x3cab51){return db['SmsAccount'][_0xe601('0x59')]({'where':{'id':_0x508a9d[_0xe601('0x56')]['id']}})[_0xe601('0x1e')](handleEntityNotFound(_0x5d1b8d,null))[_0xe601('0x1e')](function(_0x318614){if(_0x318614){return _0x318614[_0xe601('0x6a')](_0x508a9d[_0xe601('0x43')]['ids']);}})[_0xe601('0x1e')](respondWithStatusCode(_0x5d1b8d,null))[_0xe601('0x27')](handleError(_0x5d1b8d,null));};exports['addAnswer']=function(_0x516c8f,_0x5deb1c,_0x3061dc){if(_0x516c8f[_0xe601('0x5b')]['id']){delete _0x516c8f[_0xe601('0x5b')]['id'];}return db[_0xe601('0x3e')][_0xe601('0x59')]({'where':{'id':_0x516c8f[_0xe601('0x56')]['id']}})[_0xe601('0x1e')](handleEntityNotFound(_0x5deb1c,null))[_0xe601('0x1e')](function(_0x2233f3){if(_0x2233f3){_0x516c8f['body']['SmsAccountId']=_0x2233f3['id'];return db[_0xe601('0x6b')]['create'](_0x516c8f['body']);}})[_0xe601('0x1e')](respondWithResult(_0x5deb1c,null))[_0xe601('0x27')](handleError(_0x5deb1c,null));};exports[_0xe601('0x6c')]=function(_0x4cb15e,_0x3471f9,_0x242711){var _0xc475db={'raw':![],'where':{}};var _0x455bd7={};var _0x417cb3={'count':0x0,'rows':[]};return db[_0xe601('0x3e')][_0xe601('0x67')]({'where':{'id':_0x4cb15e[_0xe601('0x56')]['id']}})[_0xe601('0x1e')](handleEntityNotFound(_0x3471f9,null))[_0xe601('0x1e')](function(_0x4a7aeb){if(_0x4a7aeb){_0x455bd7[_0xe601('0x42')]=_[_0xe601('0x44')](db[_0xe601('0x6b')][_0xe601('0x57')]);_0x455bd7[_0xe601('0x43')]=_['keys'](_0x4cb15e['query']);_0x455bd7[_0xe601('0x45')]=_[_0xe601('0x46')](_0x455bd7[_0xe601('0x42')],_0x455bd7[_0xe601('0x43')]);_0xc475db[_0xe601('0x48')]=_[_0xe601('0x46')](_0x455bd7[_0xe601('0x42')],qs[_0xe601('0x47')](_0x4cb15e['query']['fields']));_0xc475db[_0xe601('0x48')]=_0xc475db[_0xe601('0x48')][_0xe601('0x49')]?_0xc475db[_0xe601('0x48')]:_0x455bd7[_0xe601('0x42')];if(!_0x4cb15e[_0xe601('0x43')]['hasOwnProperty']('nolimit')){_0xc475db[_0xe601('0x2c')]=qs[_0xe601('0x2c')](_0x4cb15e[_0xe601('0x43')][_0xe601('0x2c')]);_0xc475db[_0xe601('0x2e')]=qs[_0xe601('0x2e')](_0x4cb15e[_0xe601('0x43')][_0xe601('0x2e')]);}_0xc475db[_0xe601('0x68')]=qs['sort'](_0x4cb15e[_0xe601('0x43')]['sort']);_0xc475db[_0xe601('0x50')]=qs[_0xe601('0x45')](_['pick'](_0x4cb15e[_0xe601('0x43')],_0x455bd7[_0xe601('0x45')]));_0xc475db['where']['SmsAccountId']=_0x4a7aeb['id'];if(_0x4cb15e[_0xe601('0x43')][_0xe601('0x4e')]){_0xc475db['where']=_[_0xe601('0x4f')](_0xc475db[_0xe601('0x50')],{'$or':_[_0xe601('0x3d')](_0xc475db[_0xe601('0x48')],function(_0x3e0abb){var _0x520bde={};_0x520bde[_0x3e0abb]={'$like':'%'+_0x4cb15e[_0xe601('0x43')][_0xe601('0x4e')]+'%'};return _0x520bde;})});}_0xc475db=_['merge']({},_0xc475db,_0x4cb15e[_0xe601('0x52')]);return db[_0xe601('0x6b')][_0xe601('0x2d')]({'where':_0xc475db['where']})['then'](function(_0x1e0e2f){_0x417cb3[_0xe601('0x2d')]=_0x1e0e2f;if(_0x4cb15e[_0xe601('0x43')][_0xe601('0x53')]){_0xc475db[_0xe601('0x58')]=[{'all':!![]}];}return db[_0xe601('0x6b')][_0xe601('0x54')](_0xc475db);})['then'](function(_0x77ee60){_0x417cb3[_0xe601('0x69')]=_0x77ee60;return _0x417cb3;});}})[_0xe601('0x1e')](respondWithFilteredResult(_0x3471f9,_0xc475db))['catch'](handleError(_0x3471f9,null));};exports[_0xe601('0x6d')]=function(_0x3b1704,_0x3e8108,_0x58ac2e){return db['SmsAccount'][_0xe601('0x59')]({'where':{'id':_0x3b1704[_0xe601('0x56')]['id']}})['then'](handleEntityNotFound(_0x3e8108,null))[_0xe601('0x1e')](function(_0x5b0be2){if(_0x5b0be2){return _0x5b0be2[_0xe601('0x6d')](_0x3b1704[_0xe601('0x43')][_0xe601('0x6e')]);}})[_0xe601('0x1e')](respondWithStatusCode(_0x3e8108,null))[_0xe601('0x27')](handleError(_0x3e8108,null));};exports[_0xe601('0x6f')]=function(_0x299982,_0xd9f962,_0x2cd698){var _0x5c3199={'channel':'sms'};var _0x398eec=[];var _0x43323c=[];var _0xf7aa3b={};return db['SmsAccount'][_0xe601('0x59')]({'where':{'id':_0x299982['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0xe601('0x70')}]})[_0xe601('0x1e')](handleEntityNotFound(_0xd9f962,null))['then'](function(_0x4cbe56){_0x5c3199[_0xe601('0x71')]=_0x4cbe56;_0x5c3199[_0xe601('0x72')]=_[_0xe601('0x73')](_0x4cbe56[_0xe601('0x70')],['priority'],[_0xe601('0x74')]);if(_0x5c3199[_0xe601('0x71')][_0xe601('0x70')]){delete _0x5c3199['account']['Applications'];}return db[_0xe601('0x75')][_0xe601('0x63')]();})[_0xe601('0x1e')](function(_0x36256e){if(!_0x36256e){throw new db['Sequelize'][(_0xe601('0x76'))](_0xe601('0x77'));}_0x398eec=_[_0xe601('0x78')](_['keys'](_0x36256e),[_0xe601('0x79'),_0xe601('0x7a')]);_0x43323c=_[_0xe601('0x78')](_[_0xe601('0x44')](_0x36256e),[_0xe601('0x79'),_0xe601('0x7a'),_0xe601('0x7b'),'ListId']);_0x5c3199[_0xe601('0x5b')]={'mapKey':_0xe601('0x7c')};if(_0x5c3199[_0xe601('0x71')][_0xe601('0x40')]){switch(_0x5c3199['account'][_0xe601('0x40')]){case _0xe601('0x7d'):_0x5c3199[_0xe601('0x5b')]['from']=_0x299982[_0xe601('0x5b')][_0xe601('0x7e')];_0x5c3199[_0xe601('0x5b')]['body']=_0x299982[_0xe601('0x5b')][_0xe601('0x7f')];_0x5c3199[_0xe601('0x5b')][_0xe601('0x80')]=_0x299982[_0xe601('0x5b')]['MessageSid'];break;case _0xe601('0x81'):_0x5c3199[_0xe601('0x5b')]['from']='+'+_0x299982[_0xe601('0x5b')]['sender'];_0x5c3199['body'][_0xe601('0x5b')]=_0x299982[_0xe601('0x5b')][_0xe601('0x82')];break;case _0xe601('0x83'):_0x5c3199[_0xe601('0x5b')]['from']=_0x299982['body'][_0xe601('0x84')];_0x5c3199[_0xe601('0x5b')][_0xe601('0x5b')]=_0x299982[_0xe601('0x5b')][_0xe601('0x26')];break;case _0xe601('0x85'):_0x5c3199[_0xe601('0x5b')][_0xe601('0x84')]=_0x299982[_0xe601('0x5b')]['from'];_0x5c3199[_0xe601('0x5b')][_0xe601('0x5b')]=_0x299982[_0xe601('0x5b')][_0xe601('0x5b')];_0x5c3199['body']['messageId']=_0x299982['body'][_0xe601('0x86')];break;case _0xe601('0x87'):_0x5c3199[_0xe601('0x5b')][_0xe601('0x84')]=_0x299982[_0xe601('0x5b')][_0xe601('0x7e')];_0x5c3199[_0xe601('0x5b')]['body']=_0x299982[_0xe601('0x5b')][_0xe601('0x88')];_0x5c3199['body'][_0xe601('0x80')]=_0x299982[_0xe601('0x5b')]['MessageUUID'];break;case'infobip':_0x5c3199['body']['from']='+'+_0x299982['body'][_0xe601('0x89')][0x0]['from'];_0x5c3199[_0xe601('0x5b')][_0xe601('0x5b')]=_0x299982[_0xe601('0x5b')][_0xe601('0x89')][0x0]['text'];_0x5c3199['body'][_0xe601('0x80')]=_0x299982['body'][_0xe601('0x89')][0x0]['messageId'];break;case'csc':_0x5c3199[_0xe601('0x5b')]['from']=_0x299982[_0xe601('0x5b')]['originatingAddress'];_0x5c3199[_0xe601('0x5b')][_0xe601('0x5b')]=_0x299982[_0xe601('0x5b')][_0xe601('0x8a')]['message'];break;case _0xe601('0x8b'):_0x5c3199[_0xe601('0x5b')][_0xe601('0x84')]=_0x299982[_0xe601('0x5b')][_0xe601('0x8c')];_0x5c3199['body'][_0xe601('0x5b')]=_0x299982[_0xe601('0x5b')][_0xe601('0x82')];_0x5c3199[_0xe601('0x5b')][_0xe601('0x80')]=_0x299982['body']['replyMessageId'];break;case _0xe601('0x8d'):_0x5c3199[_0xe601('0x5b')][_0xe601('0x80')]=_0x299982[_0xe601('0x5b')][0x0][_0xe601('0x26')]['id'];_0x5c3199[_0xe601('0x5b')][_0xe601('0x84')]=_0x299982['body'][0x0][_0xe601('0x26')][_0xe601('0x84')];_0x5c3199['body']['body']=_0x299982[_0xe601('0x5b')][0x0][_0xe601('0x26')]['text'];break;case _0xe601('0x8e'):_0x5c3199[_0xe601('0x5b')]['from']=_0x299982[_0xe601('0x5b')][_0xe601('0x84')];_0x5c3199[_0xe601('0x5b')][_0xe601('0x5b')]=_0x299982[_0xe601('0x5b')][_0xe601('0x26')];_0x5c3199[_0xe601('0x5b')][_0xe601('0x80')]=_0x299982[_0xe601('0x5b')][_0xe601('0x8f')];break;}}if(_0x5c3199[_0xe601('0x5b')]['id']){delete _0x5c3199[_0xe601('0x5b')]['id'];}if(_[_0xe601('0x90')](_0x5c3199[_0xe601('0x5b')][_0xe601('0x84')])){throw new db[(_0xe601('0x91'))]['ValidationError'](_0xe601('0x92'));}if(_['isNil'](_0x5c3199['body'][_0xe601('0x5b')])||_0x5c3199[_0xe601('0x5b')]['body']===''){throw new db[(_0xe601('0x91'))]['ValidationError'](_0xe601('0x93'));}if(_[_0xe601('0x90')](_0x5c3199[_0xe601('0x5b')][_0xe601('0x94')])){throw new db[(_0xe601('0x91'))][(_0xe601('0x76'))](_0xe601('0x95')+_0x43323c);}if(!_[_0xe601('0x96')](_0x43323c,_0x5c3199[_0xe601('0x5b')][_0xe601('0x94')])){throw new db['Sequelize'][(_0xe601('0x76'))](_0xe601('0x97')+_0x43323c);}_0xf7aa3b[_0x5c3199[_0xe601('0x5b')][_0xe601('0x94')]]=_0x5c3199[_0xe601('0x5b')][_0xe601('0x84')];return db[_0xe601('0x98')][_0xe601('0x59')]({'where':{'id':_0x5c3199['account']['ListId']},'include':[{'model':db['CmContact'],'as':_0xe601('0x99'),'where':_0xf7aa3b,'limit':0x1,'order':[[_0xe601('0x7a'),_0xe601('0x9a')]]}]});})[_0xe601('0x1e')](handleEntityNotFound(_0xd9f962,null))[_0xe601('0x1e')](function(_0x31a1f2){if(_0x31a1f2){_0x5c3199[_0xe601('0x9b')]=_[_0xe601('0x9c')](_0x31a1f2,[_0xe601('0x99')]);if(_0x31a1f2['Contacts'][_0xe601('0x49')]){return _0x31a1f2[_0xe601('0x99')][0x0];}var _0x358ef6=_[_0xe601('0x9d')](_0x5c3199['body'],{'firstName':_0x5c3199[_0xe601('0x5b')][_0xe601('0x84')],'ListId':_0x31a1f2['id']});_0x358ef6[_0x5c3199['body']['mapKey']]=_0x5c3199[_0xe601('0x5b')]['from'];return db[_0xe601('0x75')][_0xe601('0x5a')](_0x358ef6,{'fields':_0x398eec,'raw':!![]});}})[_0xe601('0x1e')](handleEntityNotFound(_0xd9f962,null))[_0xe601('0x1e')](function(_0x5baa96){if(_0x5baa96){_0x5c3199[_0xe601('0x9e')]=_0x5baa96;var _0x1d0199={'ContactId':_0x5baa96['id'],'phone':_0x5c3199['body'][_0xe601('0x84')],'SmsAccountId':_0x299982['params']['id']};var _0x1f4192={'ContactId':_0x5baa96['id'],'SmsAccountId':_0x299982['params']['id'],'closed':![]};return db[_0xe601('0x9f')][_0xe601('0x59')]({'where':_0x1f4192})[_0xe601('0x1e')](function(_0x81f68c){if(_0x81f68c){return[_0x81f68c,![]];}return db['SmsInteraction'][_0xe601('0x5a')](_0x1d0199)[_0xe601('0x1e')](function(_0x6d00c7){return[_0x6d00c7,!![]];});});}})['spread'](function(_0x32653b,_0x494223){_0x5c3199[_0xe601('0xa0')]=_0x32653b[_0xe601('0x5d')]({'plain':!![]});_0x5c3199[_0xe601('0xa0')]['created']=![];if(_0x494223){if(_0x5c3199['account'][_0xe601('0xa1')]){_0x5c3199['applications'][_0xe601('0xa2')]({'id':0x0,'priority':_0x5c3199[_0xe601('0x72')]['length']+0x1,'app':'close','appdata':_0xe601('0xa3'),'interval':_0xe601('0xa4')});}_0x5c3199[_0xe601('0xa0')]['created']=!![];}return db[_0xe601('0xa5')][_0xe601('0x5a')]({'phone':_0x5c3199[_0xe601('0x5b')]['from'],'messageId':_0x5c3199[_0xe601('0x5b')][_0xe601('0x80')],'body':_0x5c3199[_0xe601('0x5b')][_0xe601('0x5b')],'SmsAccountId':_0x299982[_0xe601('0x56')]['id'],'SmsInteractionId':_0x32653b['id'],'direction':'in','ContactId':_0x32653b[_0xe601('0xa6')],'AttachmentId':_0x5c3199['body'][_0xe601('0xa7')]});})[_0xe601('0x1e')](function(_0x496dac){_0x5c3199[_0xe601('0x26')]=_0x496dac;if(_0x5c3199['interaction']['UserId']){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x5c3199[_0xe601('0xa0')][_0xe601('0xa8')]}})[_0xe601('0x1e')](function(_0x3cfaf2){if(_0x3cfaf2){_0x5c3199[_0xe601('0x72')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3cfaf2[_0xe601('0x38')]+','+(_0x5c3199['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe601('0xa9'),_0xe601('0xaa'),_0x5c3199);});}return respondWithRpcPromise(_0xe601('0xa9'),'startRouting',_0x5c3199);})[_0xe601('0x1e')](function(_0x3c4543){if(_0x3c4543){var _0x39f78a=0xc8;var _0x514d77=_0xe601('0xab');logger['info'](_0xe601('0x21'),_0x514d77,_0x39f78a,_0xe601('0xac'));logger[_0xe601('0xad')](_0xe601('0xae'),_0x514d77,_0x39f78a,_0xe601('0xac'),JSON[_0xe601('0x23')](_0x3c4543));if(_0x5c3199[_0xe601('0x71')][_0xe601('0x40')]==='twilio'){return _0xd9f962[_0xe601('0x29')](_0x39f78a)['set'](_0xe601('0xaf'),'text/xml')['send'](_0xe601('0xb0'));}else{return _0xd9f962[_0xe601('0x29')](_0x39f78a)[_0xe601('0x2a')](_0x3c4543);}}})[_0xe601('0x27')](handleError(_0xd9f962,null));};exports[_0xe601('0xb1')]=function(_0x52448a,_0x427b17,_0x1f55d5){return db[_0xe601('0x3e')][_0xe601('0x67')]({'where':{'id':_0x52448a[_0xe601('0x56')]['id']}})[_0xe601('0x1e')](handleEntityNotFound(_0x427b17,null))[_0xe601('0x1e')](function(_0x41dcce){if(_0x41dcce){return db[_0xe601('0xb2')][_0xe601('0xb3')](function(_0x43e8a9){return db[_0xe601('0xb4')]['destroy']({'where':{'SmsAccountId':_0x52448a[_0xe601('0x56')]['id']},'transaction':_0x43e8a9})[_0xe601('0x1e')](function(_0x58b106){var _0x5023b6=_['map'](_0x52448a[_0xe601('0x5b')],function(_0x57e1b7){_0x57e1b7[_0xe601('0x65')]=_0x52448a['params']['id'];return _0x57e1b7;});return db['SmsApplication']['bulkCreate'](_0x5023b6,{'transaction':_0x43e8a9});});})[_0xe601('0x1e')](function(){return db[_0xe601('0xb4')]['findAndCountAll']({'where':{'SmsAccountId':_0x52448a['params']['id']},'order':_0xe601('0xb5')});});}})[_0xe601('0x1e')](respondWithResult(_0x427b17,null))[_0xe601('0x27')](handleError(_0x427b17,null));};exports[_0xe601('0xb6')]=function(_0x1c8182,_0x552d88,_0x2a542e){var _0x20bf57={};var _0x45a0d6={};var _0x42c0d2;var _0x3c6db2;return db['SmsAccount'][_0xe601('0x67')]({'where':{'id':_0x1c8182[_0xe601('0x56')]['id']}})['then'](handleEntityNotFound(_0x552d88,null))[_0xe601('0x1e')](function(_0x45a0df){if(_0x45a0df){_0x42c0d2=_0x45a0df;_0x45a0d6[_0xe601('0x42')]=_['keys'](db[_0xe601('0xb4')][_0xe601('0x57')]);_0x45a0d6[_0xe601('0x43')]=_[_0xe601('0x44')](_0x1c8182[_0xe601('0x43')]);_0x45a0d6[_0xe601('0x45')]=_[_0xe601('0x46')](_0x45a0d6[_0xe601('0x42')],_0x45a0d6[_0xe601('0x43')]);_0x20bf57[_0xe601('0x48')]=_[_0xe601('0x46')](_0x45a0d6['model'],qs[_0xe601('0x47')](_0x1c8182['query'][_0xe601('0x47')]));_0x20bf57[_0xe601('0x48')]=_0x20bf57['attributes'][_0xe601('0x49')]?_0x20bf57[_0xe601('0x48')]:_0x45a0d6[_0xe601('0x42')];_0x20bf57[_0xe601('0x68')]=qs[_0xe601('0x4c')](_0x1c8182[_0xe601('0x43')][_0xe601('0x4c')]);_0x20bf57['where']=qs[_0xe601('0x45')](_['pick'](_0x1c8182[_0xe601('0x43')],_0x45a0d6[_0xe601('0x45')]));if(_0x1c8182[_0xe601('0x43')]['filter']){_0x20bf57['where']=_[_0xe601('0x4f')](_0x20bf57[_0xe601('0x50')],{'$or':_[_0xe601('0x3d')](_0x20bf57['attributes'],function(_0x51e69c){var _0x5d87e9={};_0x5d87e9[_0x51e69c]={'$like':'%'+_0x1c8182[_0xe601('0x43')][_0xe601('0x4e')]+'%'};return _0x5d87e9;})});}_0x20bf57=_[_0xe601('0x4f')]({},_0x20bf57,_0x1c8182[_0xe601('0x52')]);return _0x42c0d2[_0xe601('0xb6')](_0x20bf57);}})[_0xe601('0x1e')](function(_0x438b75){if(_0x438b75){_0x3c6db2=_0x438b75[_0xe601('0x49')];if(!_0x1c8182[_0xe601('0x43')][_0xe601('0x4a')]('nolimit')){_0x20bf57[_0xe601('0x2c')]=qs[_0xe601('0x2c')](_0x1c8182[_0xe601('0x43')][_0xe601('0x2c')]);_0x20bf57['offset']=qs[_0xe601('0x2e')](_0x1c8182[_0xe601('0x43')]['offset']);}return _0x42c0d2[_0xe601('0xb6')](_0x20bf57);}})[_0xe601('0x1e')](function(_0x16f7b4){if(_0x16f7b4){return _0x16f7b4?{'count':_0x3c6db2,'rows':_0x16f7b4}:null;}})[_0xe601('0x1e')](respondWithResult(_0x552d88,null))[_0xe601('0x27')](handleError(_0x552d88,null));};exports[_0xe601('0xb7')]=function(_0x4be271,_0x53a741,_0x48e5c8){var _0x13a00e={'raw':![],'where':{}};var _0x43dc35={};var _0x5948c9={'count':0x0,'rows':[]};return db[_0xe601('0x3e')]['findOne']({'where':{'id':_0x4be271[_0xe601('0x56')]['id']}})[_0xe601('0x1e')](handleEntityNotFound(_0x53a741,null))[_0xe601('0x1e')](function(_0x49a29e){if(_0x49a29e){_0x43dc35['model']=_[_0xe601('0x44')](db[_0xe601('0x9f')][_0xe601('0x57')]);_0x43dc35[_0xe601('0x43')]=_[_0xe601('0x44')](_0x4be271[_0xe601('0x43')]);_0x43dc35['filters']=_[_0xe601('0x46')](_0x43dc35[_0xe601('0x42')],_0x43dc35[_0xe601('0x43')]);_0x13a00e[_0xe601('0x48')]=_['intersection'](_0x43dc35[_0xe601('0x42')],qs['fields'](_0x4be271[_0xe601('0x43')][_0xe601('0x47')]));_0x13a00e[_0xe601('0x48')]=_0x13a00e[_0xe601('0x48')]['length']?_0x13a00e[_0xe601('0x48')]:_0x43dc35[_0xe601('0x42')];if(!_0x4be271[_0xe601('0x43')][_0xe601('0x4a')](_0xe601('0x4b'))){_0x13a00e[_0xe601('0x2c')]=qs[_0xe601('0x2c')](_0x4be271[_0xe601('0x43')][_0xe601('0x2c')]);_0x13a00e[_0xe601('0x2e')]=qs[_0xe601('0x2e')](_0x4be271[_0xe601('0x43')][_0xe601('0x2e')]);}_0x13a00e['order']=qs[_0xe601('0x4c')](_0x4be271[_0xe601('0x43')][_0xe601('0x4c')]);_0x13a00e[_0xe601('0x50')]=qs[_0xe601('0x45')](_[_0xe601('0x4d')](_0x4be271[_0xe601('0x43')],_0x43dc35[_0xe601('0x45')]));_0x13a00e[_0xe601('0x50')]['SmsAccountId']=_0x49a29e['id'];if(_0x4be271[_0xe601('0x43')][_0xe601('0x4e')]){_0x13a00e[_0xe601('0x50')]=_[_0xe601('0x4f')](_0x13a00e[_0xe601('0x50')],{'$or':_['map'](_0x13a00e[_0xe601('0x48')],function(_0x5cea0f){var _0x59a665={};_0x59a665[_0x5cea0f]={'$like':'%'+_0x4be271[_0xe601('0x43')]['filter']+'%'};return _0x59a665;})});}_0x13a00e=_[_0xe601('0x4f')]({},_0x13a00e,_0x4be271[_0xe601('0x52')]);return db[_0xe601('0x9f')]['count']({'where':_0x13a00e[_0xe601('0x50')]})[_0xe601('0x1e')](function(_0x11e206){_0x5948c9[_0xe601('0x2d')]=_0x11e206;if(_0x4be271[_0xe601('0x43')]['includeAll']){_0x13a00e[_0xe601('0x58')]=[{'model':db[_0xe601('0x75')],'as':_0xe601('0xb8'),'required':![]},{'model':db[_0xe601('0xb9')],'as':_0xe601('0xba'),'attributes':[_0xe601('0x38'),_0xe601('0xbb'),'internal'],'required':![]},{'model':db[_0xe601('0xbc')],'as':_0xe601('0xbd'),'attributes':['id','name',_0xe601('0xbe')],'where':_0x4be271[_0xe601('0x43')]['tag']?{'id':_0x4be271['query']['tag']}:undefined,'required':_0x4be271['query'][_0xe601('0xbf')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x13a00e);})[_0xe601('0x1e')](function(_0x30e8fc){_0x5948c9[_0xe601('0x69')]=_0x30e8fc;return _0x5948c9;});}})['then'](respondWithFilteredResult(_0x53a741,_0x13a00e))[_0xe601('0x27')](handleError(_0x53a741,null));};exports[_0xe601('0x39')]=function(_0xdd359f,_0x57e45d,_0x20418f){var _0x9a15da,_0x394cd3,_0x563fad;if(_[_0xe601('0x90')](_0xdd359f[_0xe601('0x5b')]['body'])||_0xdd359f[_0xe601('0x5b')][_0xe601('0x5b')]===''){throw new db[(_0xe601('0x91'))][(_0xe601('0x76'))](_0xe601('0x93'));}if(_[_0xe601('0x90')](_0xdd359f[_0xe601('0x5b')]['to'])){throw new db[(_0xe601('0x91'))]['ValidationError'](_0xe601('0xc0'));}_0x9a15da=_0xdd359f[_0xe601('0x5b')]['to'];return db[_0xe601('0x3e')][_0xe601('0x59')]({'where':{'id':_0xdd359f[_0xe601('0x56')]['id']},'include':[{'model':db[_0xe601('0x98')],'as':_0xe601('0xc1'),'include':[{'model':db[_0xe601('0x75')],'as':_0xe601('0x99'),'where':{'mobile':_0x9a15da},'limit':0x1,'order':[[_0xe601('0x7a'),_0xe601('0x9a')]]}]}]})[_0xe601('0x1e')](handleEntityNotFound(_0x57e45d,null))[_0xe601('0x1e')](function(_0x330406){if(_0x330406&&_0x330406['List']){_0x394cd3=_0x330406['get']({'plain':!![]});if(_0x394cd3['List']&&_0x394cd3[_0xe601('0xc1')][_0xe601('0x99')][_0xe601('0x49')]){return _0x394cd3['List'][_0xe601('0x99')][0x0];}return db['CmContact'][_0xe601('0x5a')](_[_0xe601('0x9d')](_0xdd359f[_0xe601('0x5b')],{'firstName':_0x9a15da,'mobile':_0x9a15da,'phone':_0x9a15da,'ListId':_0x394cd3['ListId']}));}})[_0xe601('0x1e')](handleEntityNotFound(_0x57e45d,null))[_0xe601('0x1e')](function(_0x5caa2f){if(_0x5caa2f){_0x563fad=_0x5caa2f;return db[_0xe601('0x9f')][_0xe601('0x59')]({'where':{'ContactId':_0x563fad['id'],'closed':![],'SmsAccountId':_0x394cd3['id']}})[_0xe601('0x1e')](function(_0x33dae5){if(_0x33dae5){return[_0x33dae5,![]];}return db[_0xe601('0x9f')][_0xe601('0x5a')]({'UserId':_0xdd359f['user']['id'],'ContactId':_0x563fad['id'],'SmsAccountId':_0x394cd3['id'],'phone':_0x9a15da,'firstMsgDirection':_0xe601('0xc2'),'Messages':[_[_0xe601('0x4f')](_0xdd359f[_0xe601('0x5b')],{'read':![],'body':_0xdd359f[_0xe601('0x5b')][_0xe601('0x5b')],'phone':_0x9a15da,'SmsAccountId':_0x394cd3['id'],'UserId':_0xdd359f[_0xe601('0x5c')]['id'],'ContactId':_0x563fad['id']})]},{'include':[{'model':db[_0xe601('0xa5')],'as':_0xe601('0xc3')}]})[_0xe601('0x1e')](function(_0x1b7862){return[_0x1b7862,!![]];});});}})[_0xe601('0xc4')](function(_0xe71808,_0x4da085){if(_0x4da085){return _0xe71808;}return db[_0xe601('0xa5')][_0xe601('0x5a')](_[_0xe601('0x4f')](_0xdd359f[_0xe601('0x5b')],{'read':![],'body':_0xdd359f[_0xe601('0x5b')][_0xe601('0x5b')],'phone':_0x9a15da,'SmsAccountId':_0x394cd3['id'],'SmsInteractionId':_0xe71808['id'],'UserId':_0xdd359f[_0xe601('0x5c')]['id'],'ContactId':_0x563fad['id']}))['then'](function(_0x43fc06){_0xe71808[_0xe601('0xc5')]['Messages']=[];_0xe71808[_0xe601('0xc5')][_0xe601('0xc3')][_0xe601('0xa2')](_0x43fc06[_0xe601('0xc5')]);return _0xe71808;});})[_0xe601('0x1e')](respondWithResult(_0x57e45d,null))['catch'](handleError(_0x57e45d,null));};exports[_0xe601('0x29')]=function(_0x21576a,_0x38baf4,_0x2b4e66){if(_0x21576a['body']['id']){delete _0x21576a['body']['id'];}var _0x245efa,_0x3c31e1,_0x1eb17e;return db[_0xe601('0x3e')][_0xe601('0x59')]({'where':{'id':_0x21576a[_0xe601('0x56')]['id']}})['then'](handleEntityNotFound(_0x38baf4,null))[_0xe601('0x1e')](function(_0x494d63){if(_0x494d63){_0x1eb17e=_0x494d63;logger[_0xe601('0xad')](_0xe601('0x21'),'status',_0xe601('0xc6'),_0x494d63['type'],util[_0xe601('0xc7')](_0x21576a['body'],{'showHidden':![],'depth':null}));switch(_0x494d63[_0xe601('0x40')]){case _0xe601('0x81'):if(_0x21576a[_0xe601('0x5b')][_0xe601('0xc8')]&&_0x21576a[_0xe601('0x5b')][_0xe601('0x29')]){_0x3c31e1=_0x21576a['body'][_0xe601('0x29')];return db[_0xe601('0xa5')][_0xe601('0x59')]({'where':{'messageId':_0x21576a['body'][_0xe601('0xc8')]}});}break;case'connectel':if(_0x21576a[_0xe601('0x5b')]['requestid']&&_0x21576a[_0xe601('0x5b')][_0xe601('0xc9')]){_0x3c31e1=_0x21576a[_0xe601('0x5b')][_0xe601('0xc9')];return db['SmsMessage']['find']({'where':{'messageId':_0x21576a['body'][_0xe601('0xca')]}});}break;case _0xe601('0x85'):if(_0x21576a[_0xe601('0x5b')][_0xe601('0x86')]&&_0x21576a[_0xe601('0x5b')][_0xe601('0xcb')]){_0x3c31e1=_0x21576a[_0xe601('0x5b')][_0xe601('0xcb')];return db[_0xe601('0xa5')][_0xe601('0x59')]({'where':{'messageId':_0x21576a[_0xe601('0x5b')]['message_id']}});}break;case _0xe601('0xcc'):var _0x4a24ad=_0x21576a[_0xe601('0x5b')][_0xe601('0x89')][0x0];if(_0x4a24ad[_0xe601('0x80')]&&_0x4a24ad['status'][_0xe601('0xcd')]===_0xe601('0xce')){_0x3c31e1=_0x4a24ad[_0xe601('0x29')]['groupName'];return db[_0xe601('0xa5')][_0xe601('0x59')]({'where':{'messageId':_0x4a24ad[_0xe601('0x80')]}});}break;case _0xe601('0x8b'):if(_0x21576a[_0xe601('0x5b')]['messageId']&&_0x21576a[_0xe601('0x5b')][_0xe601('0x29')]){_0x3c31e1=_0x21576a[_0xe601('0x5b')][_0xe601('0x29')];return db[_0xe601('0xa5')][_0xe601('0x59')]({'where':{'messageId':_0x21576a[_0xe601('0x5b')][_0xe601('0x80')]}});}break;case _0xe601('0x8d'):if(_0x21576a['body'][0x0][_0xe601('0x26')]['id']){_0x3c31e1=_0x21576a[_0xe601('0x5b')][0x0][_0xe601('0x40')];return db[_0xe601('0xa5')][_0xe601('0x59')]({'where':{'messageId':_0x21576a['body'][0x0][_0xe601('0x26')]['id']}});}break;case _0xe601('0x8e'):if(_0x21576a[_0xe601('0x5b')]['redif']&&_0x21576a[_0xe601('0x5b')][_0xe601('0x29')]){_0x3c31e1=_0x21576a[_0xe601('0x5b')][_0xe601('0x29')];return db[_0xe601('0xa5')][_0xe601('0x59')]({'where':{'messageId':_0x21576a[_0xe601('0x5b')][_0xe601('0xcf')]}});}break;}}})['then'](handleEntityNotFound(_0x38baf4,null))[_0xe601('0x1e')](function(_0x55d4ee){if(_0x55d4ee){_0x245efa=_0x55d4ee;switch(_0x1eb17e[_0xe601('0x40')]){case _0xe601('0x81'):if(_0x3c31e1==='DELIVERED'){return _0x245efa[_0xe601('0x33')]({'read':!![]});}else{logger[_0xe601('0x24')](_0xe601('0x21'),_0xe601('0x29'),'skebby',util[_0xe601('0xc7')](_0x21576a[_0xe601('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe601('0x83'):if(_0x3c31e1==='1'){return _0x245efa['update']({'read':!![]});}else{logger[_0xe601('0x24')](_0xe601('0x21'),_0xe601('0x29'),_0xe601('0x81'),util['inspect'](_0x21576a[_0xe601('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe601('0x85'):if(!_0x21576a[_0xe601('0x5b')]['error_code']&&_0x3c31e1>=0xc8&&_0x3c31e1<=0xce){return _0x245efa[_0xe601('0x33')]({'read':!![]});}else{logger[_0xe601('0x24')](_0xe601('0x21'),_0xe601('0x29'),_0xe601('0x85'),util[_0xe601('0xc7')](_0x21576a[_0xe601('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe601('0xcc'):var _0x45d89c=_0x21576a[_0xe601('0x5b')]['results'][0x0];if(_0x45d89c[_0xe601('0x29')][_0xe601('0xcd')]==='DELIVERED'){return _0x245efa[_0xe601('0x33')]({'read':!![]});}else{logger[_0xe601('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe601('0x29'),_0xe601('0xcc'),util[_0xe601('0xc7')](_0x21576a[_0xe601('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe601('0x8b'):if(_0x3c31e1==_0xe601('0xd0')||_0x3c31e1==_0xe601('0xd1')){return _0x245efa['update']({'read':!![]});}else{logger[_0xe601('0x24')](_0xe601('0x21'),'status',_0xe601('0x8b'),util['inspect'](_0x21576a[_0xe601('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe601('0x8d'):if(_0x3c31e1=='message-delivered'){return _0x245efa[_0xe601('0x33')]({'read':!![]});}else{logger['error'](_0xe601('0x21'),'status',_0xe601('0x8d'),util[_0xe601('0xc7')](_0x21576a[_0xe601('0x5b')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3c31e1===_0xe601('0xd2')||_0x3c31e1===_0xe601('0xd3')){return _0x245efa[_0xe601('0x33')]({'read':!![]});}else{logger[_0xe601('0x24')](_0xe601('0x21'),_0xe601('0x29'),'intelepeer',util['inspect'](_0x21576a[_0xe601('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x245efa;}})['then'](respondWithResult(_0x38baf4,null))[_0xe601('0x27')](handleError(_0x38baf4,null));};exports['statusGet']=function(_0x4af8f0,_0x22d1b7,_0x1fb926){var _0x231f8c,_0xb91154,_0x50ba10;return db[_0xe601('0x3e')][_0xe601('0x59')]({'where':{'id':_0x4af8f0[_0xe601('0x56')]['id']}})[_0xe601('0x1e')](handleEntityNotFound(_0x22d1b7,null))[_0xe601('0x1e')](function(_0x4c77c1){if(_0x4c77c1){_0x50ba10=_0x4c77c1;logger[_0xe601('0xad')](_0xe601('0x21'),_0xe601('0x29'),_0xe601('0xc6'),_0x4c77c1[_0xe601('0x40')],util[_0xe601('0xc7')](_0x4af8f0[_0xe601('0x43')],{'showHidden':![],'depth':null}));switch(_0x4c77c1[_0xe601('0x40')]){case'csc':if(_0x4af8f0[_0xe601('0x43')]['message-id']&&_0x4af8f0[_0xe601('0x43')][_0xe601('0xd4')]){_0xb91154=_0x4af8f0[_0xe601('0x43')]['state'];return db[_0xe601('0xa5')][_0xe601('0x59')]({'where':{'messageId':_0x4af8f0[_0xe601('0x43')][_0xe601('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x22d1b7,null))['then'](function(_0x5af41c){if(_0x5af41c){_0x231f8c=_0x5af41c;switch(_0x50ba10[_0xe601('0x40')]){case _0xe601('0xd6'):if(_0xb91154==='2'||_0xb91154==='6'){return _0x231f8c[_0xe601('0x33')]({'read':!![]});}else{logger['error'](_0xe601('0x21'),_0xe601('0x29'),'csc',util[_0xe601('0xc7')](_0x4af8f0[_0xe601('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x231f8c;}})[_0xe601('0x1e')](respondWithResult(_0x22d1b7,null))[_0xe601('0x27')](handleError(_0x22d1b7,null));};exports[_0xe601('0xd7')]=function(_0x41c39a,_0x4486df,_0x37ed69){return db[_0xe601('0x3e')]['find']({'where':{'id':_0x41c39a[_0xe601('0x56')]['id']}})[_0xe601('0x1e')](handleEntityNotFound(_0x4486df,null))[_0xe601('0x1e')](function(_0x25d59d){if(_0x25d59d){return _0x25d59d[_0xe601('0xd7')](_0x41c39a[_0xe601('0x5b')][_0xe601('0x6e')],_[_0xe601('0x9c')](_0x41c39a[_0xe601('0x5b')],[_0xe601('0x6e'),'id'])||{})[_0xe601('0xc4')](function(_0x3088fa){for(var _0x43297f=0x0;_0x43297f<_0x41c39a[_0xe601('0x5b')][_0xe601('0x6e')]['length'];_0x43297f+=0x1){socket[_0xe601('0xd8')](_0xe601('0xd9'),{'UserId':_0x41c39a[_0xe601('0x5b')][_0xe601('0x6e')][_0x43297f],'SmsAccountId':_0x41c39a[_0xe601('0x56')]['id']});}return _0x3088fa;});}})['then'](respondWithResult(_0x4486df,null))[_0xe601('0x27')](handleError(_0x4486df,null));};exports[_0xe601('0xda')]=function(_0x13f8cd,_0x16f502,_0x18a0e6){return db['SmsAccount'][_0xe601('0x59')]({'where':{'id':_0x13f8cd[_0xe601('0x56')]['id']}})[_0xe601('0x1e')](handleEntityNotFound(_0x16f502,null))[_0xe601('0x1e')](function(_0x35faf4){if(_0x35faf4){return _0x35faf4[_0xe601('0xda')](_0x13f8cd[_0xe601('0x43')]['ids'])[_0xe601('0x1e')](function(){if(_[_0xe601('0xdb')](_0x13f8cd[_0xe601('0x43')]['ids'])){for(var _0x2e177b=0x0;_0x2e177b<_0x13f8cd[_0xe601('0x43')][_0xe601('0x6e')]['length'];_0x2e177b+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x13f8cd[_0xe601('0x43')][_0xe601('0x6e')][_0x2e177b]),'SmsAccountId':Number(_0x13f8cd[_0xe601('0x56')]['id'])});}}else{socket[_0xe601('0xd8')](_0xe601('0xdc'),{'UserId':Number(_0x13f8cd[_0xe601('0x43')][_0xe601('0x6e')]),'SmsAccountId':Number(_0x13f8cd['params']['id'])});}});}})[_0xe601('0x1e')](respondWithStatusCode(_0x16f502,null))[_0xe601('0x27')](handleError(_0x16f502,null));};exports[_0xe601('0xdd')]=function(_0x247f49,_0x5b958a,_0x4f7ecd){var _0x1cf9ec={};var _0x29a7ea={};var _0x3f2787;var _0x23d8de;return db['SmsAccount'][_0xe601('0x67')]({'where':{'id':_0x247f49['params']['id']}})[_0xe601('0x1e')](handleEntityNotFound(_0x5b958a,null))['then'](function(_0x279daf){if(_0x279daf){_0x3f2787=_0x279daf;_0x29a7ea[_0xe601('0x42')]=_[_0xe601('0x44')](db[_0xe601('0xb9')][_0xe601('0x57')]);_0x29a7ea['query']=_[_0xe601('0x44')](_0x247f49[_0xe601('0x43')]);_0x29a7ea[_0xe601('0x45')]=_['intersection'](_0x29a7ea[_0xe601('0x42')],_0x29a7ea[_0xe601('0x43')]);_0x1cf9ec[_0xe601('0x48')]=_[_0xe601('0x46')](_0x29a7ea[_0xe601('0x42')],qs[_0xe601('0x47')](_0x247f49[_0xe601('0x43')]['fields']));_0x1cf9ec[_0xe601('0x48')]=_0x1cf9ec['attributes'][_0xe601('0x49')]?_0x1cf9ec[_0xe601('0x48')]:_0x29a7ea[_0xe601('0x42')];_0x1cf9ec[_0xe601('0x68')]=qs['sort'](_0x247f49[_0xe601('0x43')][_0xe601('0x4c')]);_0x1cf9ec['where']=qs[_0xe601('0x45')](_[_0xe601('0x4d')](_0x247f49[_0xe601('0x43')],_0x29a7ea[_0xe601('0x45')]));if(_0x247f49['query'][_0xe601('0x4e')]){_0x1cf9ec[_0xe601('0x50')]=_['merge'](_0x1cf9ec[_0xe601('0x50')],{'$or':_[_0xe601('0x3d')](_0x1cf9ec[_0xe601('0x48')],function(_0x9677a9){var _0x182a40={};_0x182a40[_0x9677a9]={'$like':'%'+_0x247f49[_0xe601('0x43')]['filter']+'%'};return _0x182a40;})});}_0x1cf9ec=_[_0xe601('0x4f')]({},_0x1cf9ec,_0x247f49[_0xe601('0x52')]);return _0x3f2787[_0xe601('0xdd')](_0x1cf9ec);}})[_0xe601('0x1e')](function(_0x1a8c02){if(_0x1a8c02){_0x23d8de=_0x1a8c02['length'];if(!_0x247f49[_0xe601('0x43')]['hasOwnProperty']('nolimit')){_0x1cf9ec[_0xe601('0x2c')]=qs['limit'](_0x247f49[_0xe601('0x43')][_0xe601('0x2c')]);_0x1cf9ec[_0xe601('0x2e')]=qs[_0xe601('0x2e')](_0x247f49[_0xe601('0x43')]['offset']);}return _0x3f2787[_0xe601('0xdd')](_0x1cf9ec);}})[_0xe601('0x1e')](function(_0x29a5bb){if(_0x29a5bb){return _0x29a5bb?{'count':_0x23d8de,'rows':_0x29a5bb}:null;}})[_0xe601('0x1e')](respondWithResult(_0x5b958a,null))[_0xe601('0x27')](handleError(_0x5b958a,null));}; \ No newline at end of file +var _0xc874=['apply','reject','save','update','then','get','SmsAccounts','UserProfileResource','stack','name','index','Pause','SmsAccount','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','options','includeAll','include','rows','params','mandatoryDispositionPause','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','destroy','describe','addDisposition','Disposition','getDispositions','findAll','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','findOne','nolimit','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','From','Body','skebby','from','sender','text','connectel','messageId','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','send','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','localhost','redis','./smsAccount.socket','register','client','http','request','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xc874,0xb5));var _0x4c87=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0xc874[_0x16629d];return _0x56ccee;};'use strict';var emlformat=require(_0x4c87('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4c87('0x1'));var rp=require('request-promise');var moment=require(_0x4c87('0x2'));var BPromise=require(_0x4c87('0x3'));var Mustache=require(_0x4c87('0x4'));var util=require(_0x4c87('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4c87('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c87('0x7'));var _=require(_0x4c87('0x8'));var squel=require(_0x4c87('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c87('0xa'));var toCsv=require(_0x4c87('0x6'));var querystring=require(_0x4c87('0xb'));var Papa=require('papaparse');var Redis=require(_0x4c87('0xc'));var authService=require(_0x4c87('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x4c87('0xe'));var hardwareService=require(_0x4c87('0xf'));var logger=require(_0x4c87('0x10'))(_0x4c87('0x11'));var utils=require(_0x4c87('0x12'));var config=require(_0x4c87('0x13'));var licenseUtil=require(_0x4c87('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x4c87('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c87('0x16')]));require(_0x4c87('0x17'))[_0x4c87('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4c87('0x19')][_0x4c87('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x5a1892,_0x4630e3,_0x3aa6e5,_0x4e9cb7){return new BPromise(function(_0x1003bc,_0x461356){var _0x5cb997=_0x4e9cb7||client;return _0x5cb997[_0x4c87('0x1b')](_0x5a1892,_0x3aa6e5)['then'](function(_0x73ceb5){logger['info']('SmsAccount,\x20%s,\x20%s',_0x4630e3,_0x4c87('0x1c'));logger['debug'](_0x4c87('0x1d'),_0x4630e3,'request\x20sent',JSON[_0x4c87('0x1e')](_0x73ceb5));if(_0x73ceb5[_0x4c87('0x1f')]){if(_0x73ceb5[_0x4c87('0x1f')]['code']===0x1f4){logger[_0x4c87('0x1f')](_0x4c87('0x20'),_0x4630e3,_0x73ceb5[_0x4c87('0x1f')][_0x4c87('0x21')]);return _0x461356(_0x73ceb5[_0x4c87('0x1f')][_0x4c87('0x21')]);}logger[_0x4c87('0x1f')](_0x4c87('0x20'),_0x4630e3,_0x73ceb5[_0x4c87('0x1f')][_0x4c87('0x21')]);return _0x1003bc(_0x73ceb5[_0x4c87('0x1f')][_0x4c87('0x21')]);}else{logger[_0x4c87('0x22')](_0x4c87('0x20'),_0x4630e3,'request\x20sent');_0x1003bc(_0x73ceb5[_0x4c87('0x23')][_0x4c87('0x21')]);}})[_0x4c87('0x24')](function(_0x3ed839){logger['error'](_0x4c87('0x20'),_0x4630e3,_0x3ed839);_0x461356(_0x3ed839);});});}function respondWithStatusCode(_0x9da1b0,_0x202099){_0x202099=_0x202099||0xcc;return function(_0x4c7a3a){if(_0x4c7a3a){return _0x9da1b0[_0x4c87('0x25')](_0x202099);}return _0x9da1b0[_0x4c87('0x26')](_0x202099)[_0x4c87('0x27')]();};}function respondWithResult(_0x323368,_0x23b31f){_0x23b31f=_0x23b31f||0xc8;return function(_0x28c1c2){if(_0x28c1c2){return _0x323368['status'](_0x23b31f)[_0x4c87('0x28')](_0x28c1c2);}};}function respondWithFilteredResult(_0x500833,_0x46e8cf){return function(_0x2913ab){if(_0x2913ab){var _0x3f6049=typeof _0x46e8cf[_0x4c87('0x29')]===_0x4c87('0x2a')&&typeof _0x46e8cf[_0x4c87('0x2b')]===_0x4c87('0x2a');var _0x380feb=_0x2913ab[_0x4c87('0x2c')];var _0x4c8511=_0x3f6049?0x0:_0x46e8cf[_0x4c87('0x29')];var _0x3c9c94=_0x3f6049?_0x2913ab[_0x4c87('0x2c')]:_0x46e8cf[_0x4c87('0x29')]+_0x46e8cf['limit'];var _0x5e17c5;if(_0x3c9c94>=_0x380feb){_0x3c9c94=_0x380feb;_0x5e17c5=0xc8;}else{_0x5e17c5=0xce;}_0x500833[_0x4c87('0x26')](_0x5e17c5);return _0x500833[_0x4c87('0x2d')](_0x4c87('0x2e'),_0x4c8511+'-'+_0x3c9c94+'/'+_0x380feb)['json'](_0x2913ab);}return null;};}function patchUpdates(_0x6c404d){return function(_0x29e2a0){try{jsonpatch[_0x4c87('0x2f')](_0x29e2a0,_0x6c404d,!![]);}catch(_0x42c2cf){return BPromise[_0x4c87('0x30')](_0x42c2cf);}return _0x29e2a0[_0x4c87('0x31')]();};}function saveUpdates(_0x51bc08,_0x360680){return function(_0x2f68c1){if(_0x2f68c1){return _0x2f68c1[_0x4c87('0x32')](_0x51bc08)[_0x4c87('0x33')](function(_0x246f6c){return _0x246f6c;});}return null;};}function removeEntity(_0x5821c7,_0x1ab7c1){return function(_0x209bf8){if(_0x209bf8){return _0x209bf8['destroy']()['then'](function(){var _0x65f3ea=_0x209bf8[_0x4c87('0x34')]({'plain':!![]});var _0x4d27d4=_0x4c87('0x35');return db[_0x4c87('0x36')]['destroy']({'where':{'type':_0x4d27d4,'resourceId':_0x65f3ea['id']}})['then'](function(){return _0x209bf8;});})['then'](function(){_0x5821c7[_0x4c87('0x26')](0xcc)[_0x4c87('0x27')]();});}};}function handleEntityNotFound(_0x2536c6,_0x372c24){return function(_0x61127b){if(!_0x61127b){_0x2536c6['sendStatus'](0x194);}return _0x61127b;};}function handleError(_0x4b7575,_0x7bc1e7){_0x7bc1e7=_0x7bc1e7||0x1f4;return function(_0x1ec80b){logger[_0x4c87('0x1f')](_0x1ec80b[_0x4c87('0x37')]);if(_0x1ec80b[_0x4c87('0x38')]){delete _0x1ec80b[_0x4c87('0x38')];}_0x4b7575['status'](_0x7bc1e7)['send'](_0x1ec80b);};}exports[_0x4c87('0x39')]=function(_0x4a95d2,_0x44d8d2){var _0x358936={'include':[{'model':db[_0x4c87('0x3a')],'as':'mandatoryDispositionPause'}]},_0x28af5b={},_0x162615={'count':0x0,'rows':[]};var _0x126af9=_['map'](db[_0x4c87('0x3b')]['rawAttributes'],function(_0xbc294d){return{'name':_0xbc294d[_0x4c87('0x3c')],'type':_0xbc294d[_0x4c87('0x3d')][_0x4c87('0x3e')]};});_0x28af5b['model']=_['map'](_0x126af9,'name');_0x28af5b[_0x4c87('0x3f')]=_[_0x4c87('0x40')](_0x4a95d2[_0x4c87('0x3f')]);_0x28af5b['filters']=_[_0x4c87('0x41')](_0x28af5b['model'],_0x28af5b[_0x4c87('0x3f')]);_0x358936[_0x4c87('0x42')]=_[_0x4c87('0x41')](_0x28af5b[_0x4c87('0x43')],qs[_0x4c87('0x44')](_0x4a95d2['query']['fields']));_0x358936['attributes']=_0x358936[_0x4c87('0x42')][_0x4c87('0x45')]?_0x358936[_0x4c87('0x42')]:_0x28af5b[_0x4c87('0x43')];if(!_0x4a95d2[_0x4c87('0x3f')][_0x4c87('0x46')]('nolimit')){_0x358936[_0x4c87('0x2b')]=qs['limit'](_0x4a95d2[_0x4c87('0x3f')]['limit']);_0x358936[_0x4c87('0x29')]=qs['offset'](_0x4a95d2[_0x4c87('0x3f')]['offset']);}_0x358936[_0x4c87('0x47')]=qs[_0x4c87('0x48')](_0x4a95d2[_0x4c87('0x3f')][_0x4c87('0x48')]);_0x358936[_0x4c87('0x49')]=qs[_0x4c87('0x4a')](_[_0x4c87('0x4b')](_0x4a95d2[_0x4c87('0x3f')],_0x28af5b[_0x4c87('0x4a')]),_0x126af9);if(_0x4a95d2[_0x4c87('0x3f')]['filter']){_0x358936[_0x4c87('0x49')]=_['merge'](_0x358936['where'],{'$or':_[_0x4c87('0x4c')](_0x126af9,function(_0x3313f3){if(_0x3313f3[_0x4c87('0x3d')]!==_0x4c87('0x4d')){var _0x16fa75={};_0x16fa75[_0x3313f3[_0x4c87('0x38')]]={'$like':'%'+_0x4a95d2[_0x4c87('0x3f')][_0x4c87('0x4e')]+'%'};return _0x16fa75;}})});}_0x358936=_[_0x4c87('0x4f')]({},_0x358936,_0x4a95d2[_0x4c87('0x50')]);var _0x2d635e={'where':_0x358936[_0x4c87('0x49')]};return db[_0x4c87('0x3b')][_0x4c87('0x2c')](_0x2d635e)[_0x4c87('0x33')](function(_0x4cee07){_0x162615[_0x4c87('0x2c')]=_0x4cee07;if(_0x4a95d2['query'][_0x4c87('0x51')]){_0x358936[_0x4c87('0x52')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x358936);})['then'](function(_0x1bdd36){_0x162615[_0x4c87('0x53')]=_0x1bdd36;return _0x162615;})[_0x4c87('0x33')](respondWithFilteredResult(_0x44d8d2,_0x358936))[_0x4c87('0x24')](handleError(_0x44d8d2,null));};exports['show']=function(_0x3215c7,_0x499683){var _0xcceb04={'raw':![],'where':{'id':_0x3215c7[_0x4c87('0x54')]['id']},'include':[{'model':db[_0x4c87('0x3a')],'as':_0x4c87('0x55')}]},_0x5b4e54={};_0x5b4e54['model']=_[_0x4c87('0x40')](db['SmsAccount'][_0x4c87('0x56')]);_0x5b4e54[_0x4c87('0x3f')]=_[_0x4c87('0x40')](_0x3215c7[_0x4c87('0x3f')]);_0x5b4e54[_0x4c87('0x4a')]=_[_0x4c87('0x41')](_0x5b4e54[_0x4c87('0x43')],_0x5b4e54[_0x4c87('0x3f')]);_0xcceb04['attributes']=_[_0x4c87('0x41')](_0x5b4e54[_0x4c87('0x43')],qs[_0x4c87('0x44')](_0x3215c7[_0x4c87('0x3f')][_0x4c87('0x44')]));_0xcceb04[_0x4c87('0x42')]=_0xcceb04[_0x4c87('0x42')][_0x4c87('0x45')]?_0xcceb04[_0x4c87('0x42')]:_0x5b4e54[_0x4c87('0x43')];if(_0x3215c7[_0x4c87('0x3f')][_0x4c87('0x51')]){_0xcceb04[_0x4c87('0x52')]=[{'all':!![]}];}_0xcceb04=_[_0x4c87('0x4f')]({},_0xcceb04,_0x3215c7[_0x4c87('0x50')]);return db[_0x4c87('0x3b')][_0x4c87('0x57')](_0xcceb04)['then'](handleEntityNotFound(_0x499683,null))[_0x4c87('0x33')](respondWithResult(_0x499683,null))['catch'](handleError(_0x499683,null));};exports[_0x4c87('0x58')]=function(_0x5aff4c,_0x349228){return db['SmsAccount'][_0x4c87('0x58')](_0x5aff4c[_0x4c87('0x59')],{})[_0x4c87('0x33')](function(_0x3e05fb){var _0x4f4c6e=_0x5aff4c[_0x4c87('0x5a')][_0x4c87('0x34')]({'plain':!![]});if(!_0x4f4c6e)throw new Error(_0x4c87('0x5b'));if(_0x4f4c6e['role']===_0x4c87('0x5a')){var _0x2140da=_0x3e05fb['get']({'plain':!![]});var _0x3be73d=_0x4c87('0x35');return db[_0x4c87('0x5c')][_0x4c87('0x57')]({'where':{'name':_0x3be73d,'userProfileId':_0x4f4c6e['userProfileId']},'raw':!![]})[_0x4c87('0x33')](function(_0x4b5e1e){if(_0x4b5e1e&&_0x4b5e1e[_0x4c87('0x5d')]===0x0){return db[_0x4c87('0x36')][_0x4c87('0x58')]({'name':_0x2140da[_0x4c87('0x38')],'resourceId':_0x2140da['id'],'type':_0x4b5e1e[_0x4c87('0x38')],'sectionId':_0x4b5e1e['id']},{})[_0x4c87('0x33')](function(){return _0x3e05fb;});}else{return _0x3e05fb;}})[_0x4c87('0x24')](function(_0x489723){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x489723);throw _0x489723;});}return _0x3e05fb;})[_0x4c87('0x33')](respondWithResult(_0x349228,0xc9))[_0x4c87('0x24')](handleError(_0x349228,null));};exports['update']=function(_0x1edb24,_0x5d6e25){if(_0x1edb24['body']['id']){delete _0x1edb24[_0x4c87('0x59')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x1edb24[_0x4c87('0x54')]['id']},'include':[{'model':db[_0x4c87('0x3a')],'as':_0x4c87('0x55')}]})['then'](handleEntityNotFound(_0x5d6e25,null))[_0x4c87('0x33')](saveUpdates(_0x1edb24['body'],null))[_0x4c87('0x33')](respondWithResult(_0x5d6e25,null))[_0x4c87('0x24')](handleError(_0x5d6e25,null));};exports[_0x4c87('0x5e')]=function(_0x23ce0b,_0x2e378b){return db[_0x4c87('0x3b')]['find']({'where':{'id':_0x23ce0b[_0x4c87('0x54')]['id']}})[_0x4c87('0x33')](handleEntityNotFound(_0x2e378b,null))['then'](removeEntity(_0x2e378b,null))[_0x4c87('0x24')](handleError(_0x2e378b,null));};exports[_0x4c87('0x5f')]=function(_0x449d28,_0x578215){return db[_0x4c87('0x3b')][_0x4c87('0x5f')]()['then'](respondWithResult(_0x578215,null))[_0x4c87('0x24')](handleError(_0x578215,null));};exports[_0x4c87('0x60')]=function(_0x56519c,_0x1ecdb0,_0x122539){if(_0x56519c[_0x4c87('0x59')]['id']){delete _0x56519c['body']['id'];}return db['SmsAccount'][_0x4c87('0x57')]({'where':{'id':_0x56519c[_0x4c87('0x54')]['id']}})['then'](handleEntityNotFound(_0x1ecdb0,null))['then'](function(_0x370203){if(_0x370203){_0x56519c[_0x4c87('0x59')]['SmsAccountId']=_0x370203['id'];return db[_0x4c87('0x61')]['create'](_0x56519c[_0x4c87('0x59')]);}})[_0x4c87('0x33')](respondWithResult(_0x1ecdb0,null))[_0x4c87('0x24')](handleError(_0x1ecdb0,null));};exports[_0x4c87('0x62')]=function(_0x53e428,_0x1b55b8,_0x1f0555){var _0x22ce2b={'raw':![],'where':{}};var _0x390b94={};var _0x341154={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x53e428[_0x4c87('0x54')]['id']}})[_0x4c87('0x33')](handleEntityNotFound(_0x1b55b8,null))[_0x4c87('0x33')](function(_0x1cfe20){if(_0x1cfe20){_0x390b94[_0x4c87('0x43')]=_[_0x4c87('0x40')](db['Disposition'][_0x4c87('0x56')]);_0x390b94[_0x4c87('0x3f')]=_[_0x4c87('0x40')](_0x53e428[_0x4c87('0x3f')]);_0x390b94['filters']=_[_0x4c87('0x41')](_0x390b94[_0x4c87('0x43')],_0x390b94[_0x4c87('0x3f')]);_0x22ce2b[_0x4c87('0x42')]=_[_0x4c87('0x41')](_0x390b94['model'],qs[_0x4c87('0x44')](_0x53e428[_0x4c87('0x3f')][_0x4c87('0x44')]));_0x22ce2b[_0x4c87('0x42')]=_0x22ce2b['attributes'][_0x4c87('0x45')]?_0x22ce2b[_0x4c87('0x42')]:_0x390b94[_0x4c87('0x43')];if(!_0x53e428[_0x4c87('0x3f')][_0x4c87('0x46')]('nolimit')){_0x22ce2b[_0x4c87('0x2b')]=qs[_0x4c87('0x2b')](_0x53e428[_0x4c87('0x3f')][_0x4c87('0x2b')]);_0x22ce2b[_0x4c87('0x29')]=qs[_0x4c87('0x29')](_0x53e428[_0x4c87('0x3f')][_0x4c87('0x29')]);}_0x22ce2b['order']=qs[_0x4c87('0x48')](_0x53e428['query']['sort']);_0x22ce2b['where']=qs[_0x4c87('0x4a')](_[_0x4c87('0x4b')](_0x53e428['query'],_0x390b94['filters']));_0x22ce2b[_0x4c87('0x49')]['SmsAccountId']=_0x1cfe20['id'];if(_0x53e428['query'][_0x4c87('0x4e')]){_0x22ce2b['where']=_['merge'](_0x22ce2b[_0x4c87('0x49')],{'$or':_[_0x4c87('0x4c')](_0x22ce2b['attributes'],function(_0x4e6e3a){var _0x184fa1={};_0x184fa1[_0x4e6e3a]={'$like':'%'+_0x53e428['query']['filter']+'%'};return _0x184fa1;})});}_0x22ce2b=_[_0x4c87('0x4f')]({},_0x22ce2b,_0x53e428[_0x4c87('0x50')]);return db[_0x4c87('0x61')][_0x4c87('0x2c')]({'where':_0x22ce2b[_0x4c87('0x49')]})[_0x4c87('0x33')](function(_0x4e90ae){_0x341154[_0x4c87('0x2c')]=_0x4e90ae;if(_0x53e428['query'][_0x4c87('0x51')]){_0x22ce2b[_0x4c87('0x52')]=[{'all':!![]}];}return db[_0x4c87('0x61')][_0x4c87('0x63')](_0x22ce2b);})[_0x4c87('0x33')](function(_0x37441b){_0x341154[_0x4c87('0x53')]=_0x37441b;return _0x341154;});}})[_0x4c87('0x33')](respondWithFilteredResult(_0x1b55b8,_0x22ce2b))[_0x4c87('0x24')](handleError(_0x1b55b8,null));};exports[_0x4c87('0x64')]=function(_0xcb920e,_0x17a042,_0x107250){return db['SmsAccount'][_0x4c87('0x57')]({'where':{'id':_0xcb920e[_0x4c87('0x54')]['id']}})[_0x4c87('0x33')](handleEntityNotFound(_0x17a042,null))['then'](function(_0x8676c9){if(_0x8676c9){return _0x8676c9[_0x4c87('0x64')](_0xcb920e[_0x4c87('0x3f')][_0x4c87('0x65')]);}})[_0x4c87('0x33')](respondWithStatusCode(_0x17a042,null))['catch'](handleError(_0x17a042,null));};exports[_0x4c87('0x66')]=function(_0x298ec7,_0x229833,_0xe91c88){if(_0x298ec7[_0x4c87('0x59')]['id']){delete _0x298ec7[_0x4c87('0x59')]['id'];}return db[_0x4c87('0x3b')]['find']({'where':{'id':_0x298ec7[_0x4c87('0x54')]['id']}})[_0x4c87('0x33')](handleEntityNotFound(_0x229833,null))[_0x4c87('0x33')](function(_0x42d04d){if(_0x42d04d){_0x298ec7[_0x4c87('0x59')][_0x4c87('0x67')]=_0x42d04d['id'];return db[_0x4c87('0x68')][_0x4c87('0x58')](_0x298ec7[_0x4c87('0x59')]);}})[_0x4c87('0x33')](respondWithResult(_0x229833,null))[_0x4c87('0x24')](handleError(_0x229833,null));};exports['getAnswers']=function(_0x3962a4,_0x397d7d,_0x1a48b6){var _0x5ee3b5={'raw':![],'where':{}};var _0xdcc5={};var _0x47c9ce={'count':0x0,'rows':[]};return db[_0x4c87('0x3b')][_0x4c87('0x69')]({'where':{'id':_0x3962a4[_0x4c87('0x54')]['id']}})[_0x4c87('0x33')](handleEntityNotFound(_0x397d7d,null))['then'](function(_0x3f7cba){if(_0x3f7cba){_0xdcc5[_0x4c87('0x43')]=_['keys'](db[_0x4c87('0x68')][_0x4c87('0x56')]);_0xdcc5['query']=_['keys'](_0x3962a4[_0x4c87('0x3f')]);_0xdcc5[_0x4c87('0x4a')]=_[_0x4c87('0x41')](_0xdcc5['model'],_0xdcc5[_0x4c87('0x3f')]);_0x5ee3b5['attributes']=_[_0x4c87('0x41')](_0xdcc5['model'],qs['fields'](_0x3962a4[_0x4c87('0x3f')][_0x4c87('0x44')]));_0x5ee3b5[_0x4c87('0x42')]=_0x5ee3b5[_0x4c87('0x42')]['length']?_0x5ee3b5[_0x4c87('0x42')]:_0xdcc5[_0x4c87('0x43')];if(!_0x3962a4['query'][_0x4c87('0x46')](_0x4c87('0x6a'))){_0x5ee3b5['limit']=qs[_0x4c87('0x2b')](_0x3962a4[_0x4c87('0x3f')]['limit']);_0x5ee3b5[_0x4c87('0x29')]=qs[_0x4c87('0x29')](_0x3962a4[_0x4c87('0x3f')]['offset']);}_0x5ee3b5['order']=qs[_0x4c87('0x48')](_0x3962a4[_0x4c87('0x3f')][_0x4c87('0x48')]);_0x5ee3b5[_0x4c87('0x49')]=qs[_0x4c87('0x4a')](_[_0x4c87('0x4b')](_0x3962a4[_0x4c87('0x3f')],_0xdcc5[_0x4c87('0x4a')]));_0x5ee3b5[_0x4c87('0x49')][_0x4c87('0x67')]=_0x3f7cba['id'];if(_0x3962a4['query']['filter']){_0x5ee3b5['where']=_[_0x4c87('0x4f')](_0x5ee3b5['where'],{'$or':_[_0x4c87('0x4c')](_0x5ee3b5[_0x4c87('0x42')],function(_0xf8347a){var _0x283f39={};_0x283f39[_0xf8347a]={'$like':'%'+_0x3962a4[_0x4c87('0x3f')][_0x4c87('0x4e')]+'%'};return _0x283f39;})});}_0x5ee3b5=_['merge']({},_0x5ee3b5,_0x3962a4[_0x4c87('0x50')]);return db[_0x4c87('0x68')][_0x4c87('0x2c')]({'where':_0x5ee3b5[_0x4c87('0x49')]})[_0x4c87('0x33')](function(_0x44641d){_0x47c9ce[_0x4c87('0x2c')]=_0x44641d;if(_0x3962a4[_0x4c87('0x3f')][_0x4c87('0x51')]){_0x5ee3b5[_0x4c87('0x52')]=[{'all':!![]}];}return db[_0x4c87('0x68')][_0x4c87('0x63')](_0x5ee3b5);})[_0x4c87('0x33')](function(_0x344f5e){_0x47c9ce[_0x4c87('0x53')]=_0x344f5e;return _0x47c9ce;});}})[_0x4c87('0x33')](respondWithFilteredResult(_0x397d7d,_0x5ee3b5))['catch'](handleError(_0x397d7d,null));};exports['removeAnswers']=function(_0x28cfe2,_0x624510,_0x5d3bcd){return db[_0x4c87('0x3b')]['find']({'where':{'id':_0x28cfe2[_0x4c87('0x54')]['id']}})[_0x4c87('0x33')](handleEntityNotFound(_0x624510,null))['then'](function(_0x284a1a){if(_0x284a1a){return _0x284a1a[_0x4c87('0x6b')](_0x28cfe2[_0x4c87('0x3f')][_0x4c87('0x65')]);}})[_0x4c87('0x33')](respondWithStatusCode(_0x624510,null))[_0x4c87('0x24')](handleError(_0x624510,null));};exports['notify']=function(_0x304ffd,_0x4f3cab,_0x55e01c){var _0x489304={'channel':_0x4c87('0x6c')};var _0x1c8c75=[];var _0x1ba36b=[];var _0x4727f1={};return db[_0x4c87('0x3b')][_0x4c87('0x57')]({'where':{'id':_0x304ffd[_0x4c87('0x54')]['id']},'include':[{'model':db[_0x4c87('0x6d')],'as':_0x4c87('0x6e')}]})['then'](handleEntityNotFound(_0x4f3cab,null))[_0x4c87('0x33')](function(_0x3ea7e4){_0x489304[_0x4c87('0x6f')]=_0x3ea7e4;_0x489304[_0x4c87('0x70')]=_[_0x4c87('0x71')](_0x3ea7e4[_0x4c87('0x6e')],[_0x4c87('0x72')],[_0x4c87('0x73')]);if(_0x489304[_0x4c87('0x6f')][_0x4c87('0x6e')]){delete _0x489304[_0x4c87('0x6f')][_0x4c87('0x6e')];}return db[_0x4c87('0x74')][_0x4c87('0x5f')]();})[_0x4c87('0x33')](function(_0x3495e4){if(!_0x3495e4){throw new db[(_0x4c87('0x75'))][(_0x4c87('0x76'))](_0x4c87('0x77'));}_0x1c8c75=_[_0x4c87('0x78')](_[_0x4c87('0x40')](_0x3495e4),[_0x4c87('0x79'),_0x4c87('0x7a')]);_0x1ba36b=_[_0x4c87('0x78')](_[_0x4c87('0x40')](_0x3495e4),[_0x4c87('0x79'),_0x4c87('0x7a'),_0x4c87('0x7b'),'ListId']);_0x489304['body']={'mapKey':_0x4c87('0x7c')};if(_0x489304[_0x4c87('0x6f')][_0x4c87('0x3d')]){switch(_0x489304[_0x4c87('0x6f')][_0x4c87('0x3d')]){case'twilio':_0x489304[_0x4c87('0x59')]['from']=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x7d')];_0x489304[_0x4c87('0x59')][_0x4c87('0x59')]=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x7e')];_0x489304[_0x4c87('0x59')]['messageId']=_0x304ffd[_0x4c87('0x59')]['MessageSid'];break;case _0x4c87('0x7f'):_0x489304[_0x4c87('0x59')][_0x4c87('0x80')]='+'+_0x304ffd['body'][_0x4c87('0x81')];_0x489304['body'][_0x4c87('0x59')]=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x82')];break;case _0x4c87('0x83'):_0x489304[_0x4c87('0x59')][_0x4c87('0x80')]=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x80')];_0x489304[_0x4c87('0x59')][_0x4c87('0x59')]=_0x304ffd['body'][_0x4c87('0x21')];break;case'clicksend':_0x489304[_0x4c87('0x59')][_0x4c87('0x80')]=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x80')];_0x489304[_0x4c87('0x59')][_0x4c87('0x59')]=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x59')];_0x489304[_0x4c87('0x59')][_0x4c87('0x84')]=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x85')];break;case _0x4c87('0x86'):_0x489304[_0x4c87('0x59')][_0x4c87('0x80')]=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x7d')];_0x489304[_0x4c87('0x59')][_0x4c87('0x59')]=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x87')];_0x489304[_0x4c87('0x59')]['messageId']=_0x304ffd['body'][_0x4c87('0x88')];break;case _0x4c87('0x89'):_0x489304[_0x4c87('0x59')][_0x4c87('0x80')]='+'+_0x304ffd['body'][_0x4c87('0x8a')][0x0][_0x4c87('0x80')];_0x489304[_0x4c87('0x59')]['body']=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x8a')][0x0][_0x4c87('0x82')];_0x489304[_0x4c87('0x59')][_0x4c87('0x84')]=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x8a')][0x0][_0x4c87('0x84')];break;case _0x4c87('0x8b'):_0x489304['body'][_0x4c87('0x80')]=_0x304ffd['body'][_0x4c87('0x8c')];_0x489304[_0x4c87('0x59')][_0x4c87('0x59')]=_0x304ffd[_0x4c87('0x59')]['segmentedMessage'][_0x4c87('0x21')];break;case _0x4c87('0x8d'):_0x489304[_0x4c87('0x59')][_0x4c87('0x80')]=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x8e')];_0x489304[_0x4c87('0x59')][_0x4c87('0x59')]=_0x304ffd['body']['text'];_0x489304[_0x4c87('0x59')][_0x4c87('0x84')]=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x8f')];break;case _0x4c87('0x90'):_0x489304[_0x4c87('0x59')][_0x4c87('0x84')]=_0x304ffd[_0x4c87('0x59')][0x0]['message']['id'];_0x489304[_0x4c87('0x59')][_0x4c87('0x80')]=_0x304ffd[_0x4c87('0x59')][0x0][_0x4c87('0x21')][_0x4c87('0x80')];_0x489304[_0x4c87('0x59')][_0x4c87('0x59')]=_0x304ffd[_0x4c87('0x59')][0x0][_0x4c87('0x21')][_0x4c87('0x82')];break;case _0x4c87('0x91'):_0x489304[_0x4c87('0x59')][_0x4c87('0x80')]=_0x304ffd[_0x4c87('0x59')][_0x4c87('0x80')];_0x489304[_0x4c87('0x59')]['body']=_0x304ffd[_0x4c87('0x59')]['message'];_0x489304['body'][_0x4c87('0x84')]=_0x304ffd['body'][_0x4c87('0x92')];break;}}if(_0x489304['body']['id']){delete _0x489304[_0x4c87('0x59')]['id'];}if(_[_0x4c87('0x93')](_0x489304[_0x4c87('0x59')]['from'])){throw new db[(_0x4c87('0x75'))]['ValidationError'](_0x4c87('0x94'));}if(_[_0x4c87('0x93')](_0x489304['body'][_0x4c87('0x59')])||_0x489304[_0x4c87('0x59')]['body']===''){throw new db[(_0x4c87('0x75'))][(_0x4c87('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4c87('0x93')](_0x489304['body']['mapKey'])){throw new db[(_0x4c87('0x75'))][(_0x4c87('0x76'))](_0x4c87('0x95')+_0x1ba36b);}if(!_[_0x4c87('0x96')](_0x1ba36b,_0x489304['body'][_0x4c87('0x97')])){throw new db[(_0x4c87('0x75'))][(_0x4c87('0x76'))](_0x4c87('0x98')+_0x1ba36b);}_0x4727f1[_0x489304['body'][_0x4c87('0x97')]]=_0x489304[_0x4c87('0x59')][_0x4c87('0x80')];return db[_0x4c87('0x99')]['find']({'where':{'id':_0x489304[_0x4c87('0x6f')][_0x4c87('0x9a')]},'include':[{'model':db[_0x4c87('0x74')],'as':_0x4c87('0x9b'),'where':_0x4727f1,'limit':0x1,'order':[['updatedAt',_0x4c87('0x9c')]]}]});})[_0x4c87('0x33')](handleEntityNotFound(_0x4f3cab,null))['then'](function(_0x8c043f){if(_0x8c043f){_0x489304[_0x4c87('0x9d')]=_[_0x4c87('0x9e')](_0x8c043f,[_0x4c87('0x9b')]);if(_0x8c043f[_0x4c87('0x9b')][_0x4c87('0x45')]){return _0x8c043f[_0x4c87('0x9b')][0x0];}var _0x4fcef0=_['defaults'](_0x489304[_0x4c87('0x59')],{'firstName':_0x489304['body'][_0x4c87('0x80')],'ListId':_0x8c043f['id']});_0x4fcef0[_0x489304['body'][_0x4c87('0x97')]]=_0x489304[_0x4c87('0x59')][_0x4c87('0x80')];return db[_0x4c87('0x74')][_0x4c87('0x58')](_0x4fcef0,{'fields':_0x1c8c75,'raw':!![]});}})[_0x4c87('0x33')](handleEntityNotFound(_0x4f3cab,null))['then'](function(_0x3fb786){if(_0x3fb786){_0x489304['contact']=_0x3fb786;var _0x5545ad={'ContactId':_0x3fb786['id'],'phone':_0x489304[_0x4c87('0x59')][_0x4c87('0x80')],'SmsAccountId':_0x304ffd[_0x4c87('0x54')]['id']};var _0xa771dd={'ContactId':_0x3fb786['id'],'SmsAccountId':_0x304ffd[_0x4c87('0x54')]['id'],'closed':![]};return db[_0x4c87('0x9f')]['find']({'where':_0xa771dd})[_0x4c87('0x33')](function(_0x3574d2){if(_0x3574d2){return[_0x3574d2,![]];}return db['SmsInteraction'][_0x4c87('0x58')](_0x5545ad)[_0x4c87('0x33')](function(_0x17893b){return[_0x17893b,!![]];});});}})[_0x4c87('0xa0')](function(_0x1f4f73,_0x1d0de3){_0x489304['interaction']=_0x1f4f73[_0x4c87('0x34')]({'plain':!![]});_0x489304[_0x4c87('0xa1')][_0x4c87('0xa2')]=![];if(_0x1d0de3){if(_0x489304[_0x4c87('0x6f')]['autoclose']){_0x489304['applications'][_0x4c87('0xa3')]({'id':0x0,'priority':_0x489304[_0x4c87('0x70')]['length']+0x1,'app':_0x4c87('0xa4'),'appdata':_0x4c87('0xa5'),'interval':_0x4c87('0xa6')});}_0x489304[_0x4c87('0xa1')][_0x4c87('0xa2')]=!![];}return db[_0x4c87('0xa7')][_0x4c87('0x58')]({'phone':_0x489304[_0x4c87('0x59')][_0x4c87('0x80')],'messageId':_0x489304[_0x4c87('0x59')][_0x4c87('0x84')],'body':_0x489304['body'][_0x4c87('0x59')],'SmsAccountId':_0x304ffd[_0x4c87('0x54')]['id'],'SmsInteractionId':_0x1f4f73['id'],'direction':'in','ContactId':_0x1f4f73['ContactId'],'AttachmentId':_0x489304[_0x4c87('0x59')][_0x4c87('0xa8')]});})[_0x4c87('0x33')](function(_0x3b7ba8){_0x489304[_0x4c87('0x21')]=_0x3b7ba8;if(_0x489304[_0x4c87('0xa1')][_0x4c87('0xa9')]){return db[_0x4c87('0xaa')][_0x4c87('0x57')]({'attributes':['id',_0x4c87('0x38')],'where':{'id':_0x489304['interaction'][_0x4c87('0xa9')]}})[_0x4c87('0x33')](function(_0x21b5d4){if(_0x21b5d4){_0x489304[_0x4c87('0x70')][_0x4c87('0xab')]({'id':0x0,'priority':0x0,'app':_0x4c87('0xac'),'appdata':_0x21b5d4['name']+','+(_0x489304[_0x4c87('0x6f')][_0x4c87('0xad')]||0xa),'interval':_0x4c87('0xa6')});}return respondWithRpcPromise(_0x4c87('0xae'),_0x4c87('0xaf'),_0x489304);});}return respondWithRpcPromise('Start',_0x4c87('0xaf'),_0x489304);})[_0x4c87('0x33')](function(_0x181fdc){if(_0x181fdc){var _0x6e1944=0xc8;var _0x1c7276=_0x4c87('0xb0');logger[_0x4c87('0x22')](_0x4c87('0x1d'),_0x1c7276,_0x6e1944,_0x4c87('0xb1'));logger['debug'](_0x4c87('0xb2'),_0x1c7276,_0x6e1944,_0x4c87('0xb1'),JSON[_0x4c87('0x1e')](_0x181fdc));if(_0x489304[_0x4c87('0x6f')]['type']===_0x4c87('0xb3')){return _0x4f3cab[_0x4c87('0x26')](_0x6e1944)['set'](_0x4c87('0xb4'),_0x4c87('0xb5'))[_0x4c87('0xb6')]('\x0a');}else{return _0x4f3cab[_0x4c87('0x26')](_0x6e1944)[_0x4c87('0x28')](_0x181fdc);}}})[_0x4c87('0x24')](handleError(_0x4f3cab,null));};exports[_0x4c87('0xb7')]=function(_0x2f97ee,_0xcd4782,_0x3e47ba){return db[_0x4c87('0x3b')][_0x4c87('0x69')]({'where':{'id':_0x2f97ee[_0x4c87('0x54')]['id']}})[_0x4c87('0x33')](handleEntityNotFound(_0xcd4782,null))[_0x4c87('0x33')](function(_0x483896){if(_0x483896){return db[_0x4c87('0xb8')][_0x4c87('0xb9')](function(_0x49bdfa){return db[_0x4c87('0x6d')][_0x4c87('0x5e')]({'where':{'SmsAccountId':_0x2f97ee[_0x4c87('0x54')]['id']},'transaction':_0x49bdfa})[_0x4c87('0x33')](function(_0x38edd4){var _0x36820f=_[_0x4c87('0x4c')](_0x2f97ee[_0x4c87('0x59')],function(_0x207bb1){_0x207bb1[_0x4c87('0x67')]=_0x2f97ee[_0x4c87('0x54')]['id'];return _0x207bb1;});return db['SmsApplication'][_0x4c87('0xba')](_0x36820f,{'transaction':_0x49bdfa});});})[_0x4c87('0x33')](function(){return db['SmsApplication'][_0x4c87('0xbb')]({'where':{'SmsAccountId':_0x2f97ee[_0x4c87('0x54')]['id']},'order':'priority'});});}})[_0x4c87('0x33')](respondWithResult(_0xcd4782,null))[_0x4c87('0x24')](handleError(_0xcd4782,null));};exports[_0x4c87('0xbc')]=function(_0x4e8e13,_0x2de87b,_0x4835b6){var _0x327bd2={};var _0x31312b={};var _0x1e3392;var _0x1a24c3;return db['SmsAccount']['findOne']({'where':{'id':_0x4e8e13[_0x4c87('0x54')]['id']}})[_0x4c87('0x33')](handleEntityNotFound(_0x2de87b,null))[_0x4c87('0x33')](function(_0x97784){if(_0x97784){_0x1e3392=_0x97784;_0x31312b[_0x4c87('0x43')]=_[_0x4c87('0x40')](db['SmsApplication']['rawAttributes']);_0x31312b['query']=_[_0x4c87('0x40')](_0x4e8e13['query']);_0x31312b[_0x4c87('0x4a')]=_[_0x4c87('0x41')](_0x31312b['model'],_0x31312b[_0x4c87('0x3f')]);_0x327bd2[_0x4c87('0x42')]=_['intersection'](_0x31312b[_0x4c87('0x43')],qs[_0x4c87('0x44')](_0x4e8e13['query'][_0x4c87('0x44')]));_0x327bd2[_0x4c87('0x42')]=_0x327bd2[_0x4c87('0x42')][_0x4c87('0x45')]?_0x327bd2[_0x4c87('0x42')]:_0x31312b['model'];_0x327bd2[_0x4c87('0x47')]=qs[_0x4c87('0x48')](_0x4e8e13[_0x4c87('0x3f')]['sort']);_0x327bd2[_0x4c87('0x49')]=qs[_0x4c87('0x4a')](_[_0x4c87('0x4b')](_0x4e8e13[_0x4c87('0x3f')],_0x31312b['filters']));if(_0x4e8e13[_0x4c87('0x3f')]['filter']){_0x327bd2[_0x4c87('0x49')]=_[_0x4c87('0x4f')](_0x327bd2[_0x4c87('0x49')],{'$or':_['map'](_0x327bd2[_0x4c87('0x42')],function(_0x3d14dc){var _0x35b892={};_0x35b892[_0x3d14dc]={'$like':'%'+_0x4e8e13[_0x4c87('0x3f')][_0x4c87('0x4e')]+'%'};return _0x35b892;})});}_0x327bd2=_[_0x4c87('0x4f')]({},_0x327bd2,_0x4e8e13[_0x4c87('0x50')]);return _0x1e3392[_0x4c87('0xbc')](_0x327bd2);}})['then'](function(_0x3952cc){if(_0x3952cc){_0x1a24c3=_0x3952cc['length'];if(!_0x4e8e13[_0x4c87('0x3f')][_0x4c87('0x46')]('nolimit')){_0x327bd2['limit']=qs[_0x4c87('0x2b')](_0x4e8e13[_0x4c87('0x3f')][_0x4c87('0x2b')]);_0x327bd2[_0x4c87('0x29')]=qs[_0x4c87('0x29')](_0x4e8e13[_0x4c87('0x3f')][_0x4c87('0x29')]);}return _0x1e3392[_0x4c87('0xbc')](_0x327bd2);}})[_0x4c87('0x33')](function(_0x420c72){if(_0x420c72){return _0x420c72?{'count':_0x1a24c3,'rows':_0x420c72}:null;}})['then'](respondWithResult(_0x2de87b,null))[_0x4c87('0x24')](handleError(_0x2de87b,null));};exports[_0x4c87('0xbd')]=function(_0xb84bd8,_0x3c187b,_0x37d987){var _0x1f4b15={'raw':![],'where':{}};var _0x24bf05={};var _0x4493df={'count':0x0,'rows':[]};return db[_0x4c87('0x3b')][_0x4c87('0x69')]({'where':{'id':_0xb84bd8[_0x4c87('0x54')]['id']}})[_0x4c87('0x33')](handleEntityNotFound(_0x3c187b,null))[_0x4c87('0x33')](function(_0x34d3e8){if(_0x34d3e8){_0x24bf05[_0x4c87('0x43')]=_[_0x4c87('0x40')](db['SmsInteraction'][_0x4c87('0x56')]);_0x24bf05[_0x4c87('0x3f')]=_[_0x4c87('0x40')](_0xb84bd8[_0x4c87('0x3f')]);_0x24bf05['filters']=_[_0x4c87('0x41')](_0x24bf05[_0x4c87('0x43')],_0x24bf05['query']);_0x1f4b15['attributes']=_['intersection'](_0x24bf05['model'],qs['fields'](_0xb84bd8[_0x4c87('0x3f')]['fields']));_0x1f4b15[_0x4c87('0x42')]=_0x1f4b15['attributes'][_0x4c87('0x45')]?_0x1f4b15[_0x4c87('0x42')]:_0x24bf05['model'];if(!_0xb84bd8[_0x4c87('0x3f')]['hasOwnProperty'](_0x4c87('0x6a'))){_0x1f4b15[_0x4c87('0x2b')]=qs['limit'](_0xb84bd8[_0x4c87('0x3f')][_0x4c87('0x2b')]);_0x1f4b15[_0x4c87('0x29')]=qs[_0x4c87('0x29')](_0xb84bd8['query'][_0x4c87('0x29')]);}_0x1f4b15[_0x4c87('0x47')]=qs[_0x4c87('0x48')](_0xb84bd8[_0x4c87('0x3f')][_0x4c87('0x48')]);_0x1f4b15[_0x4c87('0x49')]=qs[_0x4c87('0x4a')](_[_0x4c87('0x4b')](_0xb84bd8[_0x4c87('0x3f')],_0x24bf05['filters']));_0x1f4b15[_0x4c87('0x49')][_0x4c87('0x67')]=_0x34d3e8['id'];if(_0xb84bd8['query']['filter']){_0x1f4b15[_0x4c87('0x49')]=_[_0x4c87('0x4f')](_0x1f4b15[_0x4c87('0x49')],{'$or':_[_0x4c87('0x4c')](_0x1f4b15[_0x4c87('0x42')],function(_0x33ece8){var _0x51bb23={};_0x51bb23[_0x33ece8]={'$like':'%'+_0xb84bd8[_0x4c87('0x3f')][_0x4c87('0x4e')]+'%'};return _0x51bb23;})});}_0x1f4b15=_[_0x4c87('0x4f')]({},_0x1f4b15,_0xb84bd8[_0x4c87('0x50')]);return db['SmsInteraction'][_0x4c87('0x2c')]({'where':_0x1f4b15[_0x4c87('0x49')]})[_0x4c87('0x33')](function(_0x41ed76){_0x4493df['count']=_0x41ed76;if(_0xb84bd8[_0x4c87('0x3f')][_0x4c87('0x51')]){_0x1f4b15['include']=[{'model':db[_0x4c87('0x74')],'as':_0x4c87('0xbe'),'required':![]},{'model':db[_0x4c87('0xaa')],'as':'Owner','attributes':[_0x4c87('0x38'),_0x4c87('0xbf'),_0x4c87('0xc0')],'required':![]},{'model':db[_0x4c87('0xc1')],'as':'Tags','attributes':['id',_0x4c87('0x38'),_0x4c87('0xc2')],'where':_0xb84bd8['query'][_0x4c87('0xc3')]?{'id':_0xb84bd8[_0x4c87('0x3f')][_0x4c87('0xc3')]}:undefined,'required':_0xb84bd8[_0x4c87('0x3f')][_0x4c87('0xc3')]?!![]:![]}];}return db[_0x4c87('0x9f')][_0x4c87('0x63')](_0x1f4b15);})[_0x4c87('0x33')](function(_0x15ae62){_0x4493df[_0x4c87('0x53')]=_0x15ae62;return _0x4493df;});}})[_0x4c87('0x33')](respondWithFilteredResult(_0x3c187b,_0x1f4b15))[_0x4c87('0x24')](handleError(_0x3c187b,null));};exports[_0x4c87('0xb6')]=function(_0xebc132,_0xe4b593,_0x102462){var _0x24adcf,_0x3b39bd,_0x9f084a;if(_[_0x4c87('0x93')](_0xebc132[_0x4c87('0x59')]['body'])||_0xebc132['body'][_0x4c87('0x59')]===''){throw new db[(_0x4c87('0x75'))][(_0x4c87('0x76'))](_0x4c87('0xc4'));}if(_[_0x4c87('0x93')](_0xebc132['body']['to'])){throw new db[(_0x4c87('0x75'))][(_0x4c87('0x76'))](_0x4c87('0xc5'));}_0x24adcf=_0xebc132[_0x4c87('0x59')]['to'];return db[_0x4c87('0x3b')][_0x4c87('0x57')]({'where':{'id':_0xebc132[_0x4c87('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x4c87('0xc6'),'include':[{'model':db[_0x4c87('0x74')],'as':_0x4c87('0x9b'),'where':{'mobile':_0x24adcf},'limit':0x1,'order':[[_0x4c87('0x7a'),_0x4c87('0x9c')]]}]}]})[_0x4c87('0x33')](handleEntityNotFound(_0xe4b593,null))[_0x4c87('0x33')](function(_0x536350){if(_0x536350&&_0x536350['List']){_0x3b39bd=_0x536350[_0x4c87('0x34')]({'plain':!![]});if(_0x3b39bd['List']&&_0x3b39bd[_0x4c87('0xc6')][_0x4c87('0x9b')][_0x4c87('0x45')]){return _0x3b39bd[_0x4c87('0xc6')][_0x4c87('0x9b')][0x0];}return db['CmContact'][_0x4c87('0x58')](_['defaults'](_0xebc132[_0x4c87('0x59')],{'firstName':_0x24adcf,'mobile':_0x24adcf,'phone':_0x24adcf,'ListId':_0x3b39bd['ListId']}));}})[_0x4c87('0x33')](handleEntityNotFound(_0xe4b593,null))[_0x4c87('0x33')](function(_0x370973){if(_0x370973){_0x9f084a=_0x370973;return db[_0x4c87('0x9f')][_0x4c87('0x57')]({'where':{'ContactId':_0x9f084a['id'],'closed':![],'SmsAccountId':_0x3b39bd['id']}})[_0x4c87('0x33')](function(_0x242cc9){if(_0x242cc9){return[_0x242cc9,![]];}return db[_0x4c87('0x9f')][_0x4c87('0x58')]({'UserId':_0xebc132[_0x4c87('0x5a')]['id'],'ContactId':_0x9f084a['id'],'SmsAccountId':_0x3b39bd['id'],'phone':_0x24adcf,'firstMsgDirection':_0x4c87('0xc7'),'Messages':[_[_0x4c87('0x4f')](_0xebc132['body'],{'read':![],'body':_0xebc132[_0x4c87('0x59')][_0x4c87('0x59')],'phone':_0x24adcf,'SmsAccountId':_0x3b39bd['id'],'UserId':_0xebc132[_0x4c87('0x5a')]['id'],'ContactId':_0x9f084a['id']})]},{'include':[{'model':db[_0x4c87('0xa7')],'as':_0x4c87('0xc8')}]})['then'](function(_0x237f44){return[_0x237f44,!![]];});});}})['spread'](function(_0x3ae185,_0x3a8422){if(_0x3a8422){return _0x3ae185;}return db[_0x4c87('0xa7')][_0x4c87('0x58')](_[_0x4c87('0x4f')](_0xebc132[_0x4c87('0x59')],{'read':![],'body':_0xebc132['body']['body'],'phone':_0x24adcf,'SmsAccountId':_0x3b39bd['id'],'SmsInteractionId':_0x3ae185['id'],'UserId':_0xebc132[_0x4c87('0x5a')]['id'],'ContactId':_0x9f084a['id']}))[_0x4c87('0x33')](function(_0x229e6a){_0x3ae185[_0x4c87('0xc9')][_0x4c87('0xc8')]=[];_0x3ae185[_0x4c87('0xc9')][_0x4c87('0xc8')][_0x4c87('0xa3')](_0x229e6a[_0x4c87('0xc9')]);return _0x3ae185;});})[_0x4c87('0x33')](respondWithResult(_0xe4b593,null))['catch'](handleError(_0xe4b593,null));};exports[_0x4c87('0x26')]=function(_0x143f7a,_0x3645cc,_0x2571ed){if(_0x143f7a[_0x4c87('0x59')]['id']){delete _0x143f7a[_0x4c87('0x59')]['id'];}var _0x4670a7,_0x28b753,_0x1a38eb;return db[_0x4c87('0x3b')][_0x4c87('0x57')]({'where':{'id':_0x143f7a[_0x4c87('0x54')]['id']}})[_0x4c87('0x33')](handleEntityNotFound(_0x3645cc,null))['then'](function(_0x36482d){if(_0x36482d){_0x1a38eb=_0x36482d;logger[_0x4c87('0xca')](_0x4c87('0x1d'),_0x4c87('0x26'),_0x4c87('0xcb'),_0x36482d[_0x4c87('0x3d')],util[_0x4c87('0xcc')](_0x143f7a['body'],{'showHidden':![],'depth':null}));switch(_0x36482d[_0x4c87('0x3d')]){case _0x4c87('0x7f'):if(_0x143f7a['body'][_0x4c87('0xcd')]&&_0x143f7a[_0x4c87('0x59')][_0x4c87('0x26')]){_0x28b753=_0x143f7a['body'][_0x4c87('0x26')];return db['SmsMessage'][_0x4c87('0x57')]({'where':{'messageId':_0x143f7a[_0x4c87('0x59')]['skebby_dispatch_id']}});}break;case _0x4c87('0x83'):if(_0x143f7a[_0x4c87('0x59')]['requestid']&&_0x143f7a[_0x4c87('0x59')][_0x4c87('0xce')]){_0x28b753=_0x143f7a[_0x4c87('0x59')][_0x4c87('0xce')];return db[_0x4c87('0xa7')][_0x4c87('0x57')]({'where':{'messageId':_0x143f7a[_0x4c87('0x59')][_0x4c87('0xcf')]}});}break;case _0x4c87('0xd0'):if(_0x143f7a[_0x4c87('0x59')][_0x4c87('0x85')]&&_0x143f7a[_0x4c87('0x59')][_0x4c87('0xd1')]){_0x28b753=_0x143f7a[_0x4c87('0x59')]['status_code'];return db[_0x4c87('0xa7')]['find']({'where':{'messageId':_0x143f7a[_0x4c87('0x59')][_0x4c87('0x85')]}});}break;case _0x4c87('0x89'):var _0x5c29e9=_0x143f7a[_0x4c87('0x59')][_0x4c87('0x8a')][0x0];if(_0x5c29e9[_0x4c87('0x84')]&&_0x5c29e9[_0x4c87('0x26')][_0x4c87('0xd2')]===_0x4c87('0xd3')){_0x28b753=_0x5c29e9[_0x4c87('0x26')][_0x4c87('0xd2')];return db[_0x4c87('0xa7')][_0x4c87('0x57')]({'where':{'messageId':_0x5c29e9['messageId']}});}break;case _0x4c87('0x8d'):if(_0x143f7a[_0x4c87('0x59')][_0x4c87('0x84')]&&_0x143f7a['body'][_0x4c87('0x26')]){_0x28b753=_0x143f7a[_0x4c87('0x59')]['status'];return db[_0x4c87('0xa7')]['find']({'where':{'messageId':_0x143f7a[_0x4c87('0x59')]['messageId']}});}break;case'bandwidth':if(_0x143f7a[_0x4c87('0x59')][0x0]['message']['id']){_0x28b753=_0x143f7a[_0x4c87('0x59')][0x0][_0x4c87('0x3d')];return db['SmsMessage'][_0x4c87('0x57')]({'where':{'messageId':_0x143f7a[_0x4c87('0x59')][0x0][_0x4c87('0x21')]['id']}});}break;case _0x4c87('0x91'):if(_0x143f7a['body'][_0x4c87('0xd4')]&&_0x143f7a[_0x4c87('0x59')][_0x4c87('0x26')]){_0x28b753=_0x143f7a[_0x4c87('0x59')][_0x4c87('0x26')];return db['SmsMessage'][_0x4c87('0x57')]({'where':{'messageId':_0x143f7a[_0x4c87('0x59')][_0x4c87('0xd4')]}});}break;}}})[_0x4c87('0x33')](handleEntityNotFound(_0x3645cc,null))[_0x4c87('0x33')](function(_0x3e1410){if(_0x3e1410){_0x4670a7=_0x3e1410;switch(_0x1a38eb[_0x4c87('0x3d')]){case'skebby':if(_0x28b753===_0x4c87('0xd3')){return _0x4670a7[_0x4c87('0x32')]({'read':!![]});}else{logger[_0x4c87('0x1f')](_0x4c87('0x1d'),_0x4c87('0x26'),_0x4c87('0x7f'),util[_0x4c87('0xcc')](_0x143f7a[_0x4c87('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4c87('0x83'):if(_0x28b753==='1'){return _0x4670a7[_0x4c87('0x32')]({'read':!![]});}else{logger[_0x4c87('0x1f')](_0x4c87('0x1d'),_0x4c87('0x26'),_0x4c87('0x7f'),util[_0x4c87('0xcc')](_0x143f7a[_0x4c87('0x59')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x143f7a[_0x4c87('0x59')][_0x4c87('0xd5')]&&_0x28b753>=0xc8&&_0x28b753<=0xce){return _0x4670a7[_0x4c87('0x32')]({'read':!![]});}else{logger[_0x4c87('0x1f')](_0x4c87('0x1d'),_0x4c87('0x26'),_0x4c87('0xd0'),util['inspect'](_0x143f7a['body'],{'showHidden':![],'depth':null}));}break;case _0x4c87('0x89'):var _0x5bbab6=_0x143f7a[_0x4c87('0x59')]['results'][0x0];if(_0x5bbab6[_0x4c87('0x26')]['groupName']===_0x4c87('0xd3')){return _0x4670a7[_0x4c87('0x32')]({'read':!![]});}else{logger['error'](_0x4c87('0x1d'),_0x4c87('0x26'),_0x4c87('0x89'),util[_0x4c87('0xcc')](_0x143f7a[_0x4c87('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4c87('0x8d'):if(_0x28b753==_0x4c87('0xd6')||_0x28b753==_0x4c87('0xd7')){return _0x4670a7[_0x4c87('0x32')]({'read':!![]});}else{logger['error'](_0x4c87('0x1d'),'status',_0x4c87('0x8d'),util[_0x4c87('0xcc')](_0x143f7a[_0x4c87('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4c87('0x90'):if(_0x28b753==_0x4c87('0xd8')){return _0x4670a7[_0x4c87('0x32')]({'read':!![]});}else{logger[_0x4c87('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4c87('0x26'),_0x4c87('0x90'),util[_0x4c87('0xcc')](_0x143f7a[_0x4c87('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4c87('0x91'):if(_0x28b753===_0x4c87('0xd9')||_0x28b753===_0x4c87('0xda')){return _0x4670a7[_0x4c87('0x32')]({'read':!![]});}else{logger[_0x4c87('0x1f')](_0x4c87('0x1d'),_0x4c87('0x26'),_0x4c87('0x91'),util[_0x4c87('0xcc')](_0x143f7a[_0x4c87('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x4670a7;}})[_0x4c87('0x33')](respondWithResult(_0x3645cc,null))[_0x4c87('0x24')](handleError(_0x3645cc,null));};exports['statusGet']=function(_0x232f7c,_0x5c37b6,_0x1a640a){var _0xf12e6e,_0x2cbc54,_0x2910c3;return db[_0x4c87('0x3b')]['find']({'where':{'id':_0x232f7c[_0x4c87('0x54')]['id']}})[_0x4c87('0x33')](handleEntityNotFound(_0x5c37b6,null))[_0x4c87('0x33')](function(_0x3eaacd){if(_0x3eaacd){_0x2910c3=_0x3eaacd;logger[_0x4c87('0xca')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4c87('0x26'),_0x4c87('0xcb'),_0x3eaacd['type'],util[_0x4c87('0xcc')](_0x232f7c[_0x4c87('0x3f')],{'showHidden':![],'depth':null}));switch(_0x3eaacd['type']){case _0x4c87('0x8b'):if(_0x232f7c['query'][_0x4c87('0xdb')]&&_0x232f7c['query']['state']){_0x2cbc54=_0x232f7c[_0x4c87('0x3f')][_0x4c87('0xdc')];return db[_0x4c87('0xa7')][_0x4c87('0x57')]({'where':{'messageId':_0x232f7c[_0x4c87('0x3f')]['message-id']}});}break;}}})[_0x4c87('0x33')](handleEntityNotFound(_0x5c37b6,null))['then'](function(_0x437558){if(_0x437558){_0xf12e6e=_0x437558;switch(_0x2910c3['type']){case _0x4c87('0x8b'):if(_0x2cbc54==='2'||_0x2cbc54==='6'){return _0xf12e6e['update']({'read':!![]});}else{logger['error'](_0x4c87('0x1d'),_0x4c87('0x26'),_0x4c87('0x8b'),util[_0x4c87('0xcc')](_0x232f7c[_0x4c87('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0xf12e6e;}})[_0x4c87('0x33')](respondWithResult(_0x5c37b6,null))['catch'](handleError(_0x5c37b6,null));};exports[_0x4c87('0xdd')]=function(_0x313857,_0x3f87bb,_0x36aae3){return db[_0x4c87('0x3b')][_0x4c87('0x57')]({'where':{'id':_0x313857['params']['id']}})['then'](handleEntityNotFound(_0x3f87bb,null))[_0x4c87('0x33')](function(_0x162ce2){if(_0x162ce2){return _0x162ce2['addAgents'](_0x313857[_0x4c87('0x59')][_0x4c87('0x65')],_[_0x4c87('0x9e')](_0x313857['body'],[_0x4c87('0x65'),'id'])||{})[_0x4c87('0xa0')](function(_0x3af10f){for(var _0x1c0e2c=0x0;_0x1c0e2c<_0x313857['body'][_0x4c87('0x65')][_0x4c87('0x45')];_0x1c0e2c+=0x1){socket[_0x4c87('0xde')](_0x4c87('0xdf'),{'UserId':_0x313857['body']['ids'][_0x1c0e2c],'SmsAccountId':_0x313857['params']['id']});}return _0x3af10f;});}})[_0x4c87('0x33')](respondWithResult(_0x3f87bb,null))[_0x4c87('0x24')](handleError(_0x3f87bb,null));};exports[_0x4c87('0xe0')]=function(_0x45c530,_0x4e5ad1,_0x58ba2d){return db['SmsAccount'][_0x4c87('0x57')]({'where':{'id':_0x45c530[_0x4c87('0x54')]['id']}})[_0x4c87('0x33')](handleEntityNotFound(_0x4e5ad1,null))['then'](function(_0x2d8cae){if(_0x2d8cae){return _0x2d8cae[_0x4c87('0xe0')](_0x45c530['query'][_0x4c87('0x65')])[_0x4c87('0x33')](function(){if(_[_0x4c87('0xe1')](_0x45c530[_0x4c87('0x3f')][_0x4c87('0x65')])){for(var _0x11c973=0x0;_0x11c973<_0x45c530['query'][_0x4c87('0x65')]['length'];_0x11c973+=0x1){socket['emit'](_0x4c87('0xe2'),{'UserId':Number(_0x45c530[_0x4c87('0x3f')][_0x4c87('0x65')][_0x11c973]),'SmsAccountId':Number(_0x45c530['params']['id'])});}}else{socket[_0x4c87('0xde')]('userSmsAccount:remove',{'UserId':Number(_0x45c530['query']['ids']),'SmsAccountId':Number(_0x45c530['params']['id'])});}});}})[_0x4c87('0x33')](respondWithStatusCode(_0x4e5ad1,null))[_0x4c87('0x24')](handleError(_0x4e5ad1,null));};exports['getAgents']=function(_0x56f2b0,_0x5d5750,_0x18abb1){var _0x581692={};var _0x4b85f6={};var _0x312224;var _0x53e0cf;return db[_0x4c87('0x3b')]['findOne']({'where':{'id':_0x56f2b0[_0x4c87('0x54')]['id']}})[_0x4c87('0x33')](handleEntityNotFound(_0x5d5750,null))[_0x4c87('0x33')](function(_0x5a4401){if(_0x5a4401){_0x312224=_0x5a4401;_0x4b85f6['model']=_[_0x4c87('0x40')](db[_0x4c87('0xaa')][_0x4c87('0x56')]);_0x4b85f6[_0x4c87('0x3f')]=_[_0x4c87('0x40')](_0x56f2b0[_0x4c87('0x3f')]);_0x4b85f6['filters']=_['intersection'](_0x4b85f6[_0x4c87('0x43')],_0x4b85f6['query']);_0x581692['attributes']=_[_0x4c87('0x41')](_0x4b85f6[_0x4c87('0x43')],qs['fields'](_0x56f2b0[_0x4c87('0x3f')][_0x4c87('0x44')]));_0x581692['attributes']=_0x581692[_0x4c87('0x42')][_0x4c87('0x45')]?_0x581692[_0x4c87('0x42')]:_0x4b85f6[_0x4c87('0x43')];_0x581692['order']=qs[_0x4c87('0x48')](_0x56f2b0['query']['sort']);_0x581692[_0x4c87('0x49')]=qs['filters'](_[_0x4c87('0x4b')](_0x56f2b0['query'],_0x4b85f6[_0x4c87('0x4a')]));if(_0x56f2b0['query'][_0x4c87('0x4e')]){_0x581692['where']=_[_0x4c87('0x4f')](_0x581692['where'],{'$or':_[_0x4c87('0x4c')](_0x581692[_0x4c87('0x42')],function(_0x438634){var _0x91488e={};_0x91488e[_0x438634]={'$like':'%'+_0x56f2b0[_0x4c87('0x3f')]['filter']+'%'};return _0x91488e;})});}_0x581692=_[_0x4c87('0x4f')]({},_0x581692,_0x56f2b0[_0x4c87('0x50')]);return _0x312224[_0x4c87('0xe3')](_0x581692);}})[_0x4c87('0x33')](function(_0x5b981e){if(_0x5b981e){_0x53e0cf=_0x5b981e[_0x4c87('0x45')];if(!_0x56f2b0['query']['hasOwnProperty'](_0x4c87('0x6a'))){_0x581692[_0x4c87('0x2b')]=qs['limit'](_0x56f2b0['query'][_0x4c87('0x2b')]);_0x581692[_0x4c87('0x29')]=qs[_0x4c87('0x29')](_0x56f2b0['query']['offset']);}return _0x312224[_0x4c87('0xe3')](_0x581692);}})[_0x4c87('0x33')](function(_0x405b04){if(_0x405b04){return _0x405b04?{'count':_0x53e0cf,'rows':_0x405b04}:null;}})[_0x4c87('0x33')](respondWithResult(_0x5d5750,null))[_0x4c87('0x24')](handleError(_0x5d5750,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index db77459..a315cfe 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 _0xa169=['SmsAccount','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x490d59,_0x54c356){var _0x5d198f=function(_0x5c9bcd){while(--_0x5c9bcd){_0x490d59['push'](_0x490d59['shift']());}};_0x5d198f(++_0x54c356);}(_0xa169,0x1c0));var _0x9a16=function(_0x43b931,_0x1e3549){_0x43b931=_0x43b931-0x0;var _0x2fb10b=_0xa169[_0x43b931];return _0x2fb10b;};'use strict';var EventEmitter=require(_0x9a16('0x0'));var SmsAccount=require(_0x9a16('0x1'))['db'][_0x9a16('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9a16('0x3')](0x0);var events={'afterCreate':_0x9a16('0x4'),'afterUpdate':_0x9a16('0x5'),'afterDestroy':_0x9a16('0x6')};function emitEvent(_0x29f555){return function(_0xb3e308,_0xa67a03,_0x5dc37c){SmsAccountEvents[_0x9a16('0x7')](_0x29f555+':'+_0xb3e308['id'],_0xb3e308);SmsAccountEvents[_0x9a16('0x7')](_0x29f555,_0xb3e308);_0x5dc37c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x9a16('0x8')](e,emitEvent(event));}}module[_0x9a16('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x6cff=['SmsAccount','setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb'];(function(_0xbac5aa,_0xb7631f){var _0x3f598b=function(_0x1145e8){while(--_0x1145e8){_0xbac5aa['push'](_0xbac5aa['shift']());}};_0x3f598b(++_0xb7631f);}(_0x6cff,0x85));var _0xf6cf=function(_0x3faaf8,_0x16d9ae){_0x3faaf8=_0x3faaf8-0x0;var _0x1a3527=_0x6cff[_0x3faaf8];return _0x1a3527;};'use strict';var EventEmitter=require(_0xf6cf('0x0'));var SmsAccount=require(_0xf6cf('0x1'))['db'][_0xf6cf('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xf6cf('0x3')](0x0);var events={'afterCreate':_0xf6cf('0x4'),'afterUpdate':_0xf6cf('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4fccda){return function(_0xa15580,_0x292764,_0x5629ed){SmsAccountEvents[_0xf6cf('0x6')](_0x4fccda+':'+_0xa15580['id'],_0xa15580);SmsAccountEvents['emit'](_0x4fccda,_0xa15580);_0x5629ed(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xf6cf('0x7')](e,emitEvent(event));}}module[_0xf6cf('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index fa2ff8c..1a5b382 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 _0x33f1=['define','SmsAccount','sms_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x33f1,0x199));var _0x133f=function(_0x2c3a88,_0x48637e){_0x2c3a88=_0x2c3a88-0x0;var _0x4a7925=_0x33f1[_0x2c3a88];return _0x4a7925;};'use strict';var _=require('lodash');var util=require(_0x133f('0x0'));var logger=require(_0x133f('0x1'))(_0x133f('0x2'));var moment=require(_0x133f('0x3'));var BPromise=require(_0x133f('0x4'));var rp=require(_0x133f('0x5'));var fs=require('fs');var path=require(_0x133f('0x6'));var rimraf=require(_0x133f('0x7'));var config=require(_0x133f('0x8'));var attributes=require(_0x133f('0x9'));module[_0x133f('0xa')]=function(_0x5639f1,_0x3e36e8){return _0x5639f1[_0x133f('0xb')](_0x133f('0xc'),attributes,{'tableName':_0x133f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc768=['sms_accounts','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsAccount'];(function(_0x328263,_0x1d66e7){var _0x3f19b7=function(_0x5adced){while(--_0x5adced){_0x328263['push'](_0x328263['shift']());}};_0x3f19b7(++_0x1d66e7);}(_0xc768,0xbf));var _0x8c76=function(_0x2be00f,_0x4d6459){_0x2be00f=_0x2be00f-0x0;var _0x358bbd=_0xc768[_0x2be00f];return _0x358bbd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8c76('0x0'))(_0x8c76('0x1'));var moment=require('moment');var BPromise=require(_0x8c76('0x2'));var rp=require(_0x8c76('0x3'));var fs=require('fs');var path=require(_0x8c76('0x4'));var rimraf=require(_0x8c76('0x5'));var config=require(_0x8c76('0x6'));var attributes=require('./smsAccount.attributes');module[_0x8c76('0x7')]=function(_0x5b3fca,_0x527ebd){return _0x5b3fca['define'](_0x8c76('0x8'),attributes,{'tableName':_0x8c76('0x9'),'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 b7bbce5..4f83fd7 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 _0x228b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SmsAccount','options','raw','attributes','include','map','model','then','ShowSmsAccount','debug','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5190dd,_0x7e717c){var _0x36cbfb=function(_0x3e3b79){while(--_0x3e3b79){_0x5190dd['push'](_0x5190dd['shift']());}};_0x36cbfb(++_0x7e717c);}(_0x228b,0x93));var _0xb228=function(_0x183927,_0x3b56c9){_0x183927=_0x183927-0x0;var _0x4ff375=_0x228b[_0x183927];return _0x4ff375;};'use strict';var _=require(_0xb228('0x0'));var util=require(_0xb228('0x1'));var moment=require(_0xb228('0x2'));var BPromise=require(_0xb228('0x3'));var rs=require(_0xb228('0x4'));var fs=require('fs');var Redis=require(_0xb228('0x5'));var db=require(_0xb228('0x6'))['db'];var utils=require(_0xb228('0x7'));var logger=require(_0xb228('0x8'))(_0xb228('0x9'));var config=require(_0xb228('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb228('0xb')][_0xb228('0xc')]({'port':0x232a});config['redis']=_[_0xb228('0xd')](config[_0xb228('0xe')],{'host':_0xb228('0xf'),'port':0x18eb});var socket=require(_0xb228('0x10'))(new Redis(config['redis']));require(_0xb228('0x11'))['register'](socket);function respondWithRpcPromise(_0x4856b6,_0xfcf311,_0x1d4de9){return new BPromise(function(_0x393578,_0x5570fd){return client[_0xb228('0x12')](_0x4856b6,_0x1d4de9)['then'](function(_0x4c6936){logger[_0xb228('0x13')](_0xb228('0x14'),_0xfcf311,_0xb228('0x15'));logger['debug'](_0xb228('0x16'),_0xfcf311,_0xb228('0x15'),JSON[_0xb228('0x17')](_0x4c6936));if(_0x4c6936['error']){if(_0x4c6936[_0xb228('0x18')]['code']===0x1f4){logger[_0xb228('0x18')](_0xb228('0x14'),_0xfcf311,_0x4c6936['error'][_0xb228('0x19')]);return _0x5570fd(_0x4c6936[_0xb228('0x18')][_0xb228('0x19')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0xfcf311,_0x4c6936['error'][_0xb228('0x19')]);return _0x393578(_0x4c6936[_0xb228('0x18')][_0xb228('0x19')]);}else{logger[_0xb228('0x13')](_0xb228('0x14'),_0xfcf311,_0xb228('0x15'));_0x393578(_0x4c6936[_0xb228('0x1a')][_0xb228('0x19')]);}})['catch'](function(_0x5dc70f){logger[_0xb228('0x18')](_0xb228('0x14'),_0xfcf311,_0x5dc70f);_0x5570fd(_0x5dc70f);});});}exports['ShowSmsAccount']=function(_0x561c52){var _0x160c44=this;return new Promise(function(_0x2088a5,_0xec8e0c){return db[_0xb228('0x1b')]['find']({'raw':_0x561c52['options']?_0x561c52[_0xb228('0x1c')][_0xb228('0x1d')]===undefined?!![]:![]:!![],'where':_0x561c52[_0xb228('0x1c')]?_0x561c52[_0xb228('0x1c')]['where']||null:null,'attributes':_0x561c52[_0xb228('0x1c')]?_0x561c52[_0xb228('0x1c')][_0xb228('0x1e')]||null:null,'include':_0x561c52['options']?_0x561c52[_0xb228('0x1c')][_0xb228('0x1f')]?_[_0xb228('0x20')](_0x561c52[_0xb228('0x1c')]['include'],function(_0x4d000a){return{'model':db[_0x4d000a[_0xb228('0x21')]],'as':_0x4d000a['as'],'attributes':_0x4d000a['attributes'],'include':_0x4d000a[_0xb228('0x1f')]?_[_0xb228('0x20')](_0x4d000a[_0xb228('0x1f')],function(_0x145738){return{'model':db[_0x145738['model']],'as':_0x145738['as'],'attributes':_0x145738[_0xb228('0x1e')],'include':_0x145738['include']?_['map'](_0x145738[_0xb228('0x1f')],function(_0x32ae21){return{'model':db[_0x32ae21[_0xb228('0x21')]],'as':_0x32ae21['as'],'attributes':_0x32ae21['attributes']};}):[]};}):[]};}):[]:[]})[_0xb228('0x22')](function(_0x595701){logger[_0xb228('0x13')](_0xb228('0x23'),_0x561c52);logger[_0xb228('0x24')]('ShowSmsAccount',_0x561c52,JSON[_0xb228('0x17')](_0x595701));_0x2088a5(_0x595701);})[_0xb228('0x25')](function(_0x5dbc7f){logger[_0xb228('0x18')](_0xb228('0x23'),_0x5dbc7f[_0xb228('0x19')],_0x561c52);_0xec8e0c(_0x160c44[_0xb228('0x18')](0x1f4,_0x5dbc7f[_0xb228('0x19')]));});});}; \ No newline at end of file +var _0x97a2=['ShowSmsAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','SmsAccount','find','options','where','attributes','include','map','model','then'];(function(_0x399e3b,_0x5dd3d2){var _0x28c6a4=function(_0x7d77c1){while(--_0x7d77c1){_0x399e3b['push'](_0x399e3b['shift']());}};_0x28c6a4(++_0x5dd3d2);}(_0x97a2,0x1d5));var _0x297a=function(_0x13fe66,_0x28dada){_0x13fe66=_0x13fe66-0x0;var _0x4ccfa9=_0x97a2[_0x13fe66];return _0x4ccfa9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x297a('0x0'));var BPromise=require(_0x297a('0x1'));var rs=require(_0x297a('0x2'));var fs=require('fs');var Redis=require(_0x297a('0x3'));var db=require(_0x297a('0x4'))['db'];var utils=require(_0x297a('0x5'));var logger=require(_0x297a('0x6'))('rpc');var config=require(_0x297a('0x7'));var jayson=require(_0x297a('0x8'));var client=jayson[_0x297a('0x9')][_0x297a('0xa')]({'port':0x232a});config[_0x297a('0xb')]=_[_0x297a('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x297a('0xd'))(new Redis(config[_0x297a('0xb')]));require('./smsAccount.socket')[_0x297a('0xe')](socket);function respondWithRpcPromise(_0x15620e,_0x52fec0,_0x19443b){return new BPromise(function(_0x52c9b1,_0x3fe67c){return client[_0x297a('0xf')](_0x15620e,_0x19443b)['then'](function(_0x435cfa){logger['info'](_0x297a('0x10'),_0x52fec0,_0x297a('0x11'));logger[_0x297a('0x12')](_0x297a('0x13'),_0x52fec0,_0x297a('0x11'),JSON[_0x297a('0x14')](_0x435cfa));if(_0x435cfa[_0x297a('0x15')]){if(_0x435cfa[_0x297a('0x15')][_0x297a('0x16')]===0x1f4){logger[_0x297a('0x15')](_0x297a('0x10'),_0x52fec0,_0x435cfa[_0x297a('0x15')][_0x297a('0x17')]);return _0x3fe67c(_0x435cfa['error'][_0x297a('0x17')]);}logger[_0x297a('0x15')](_0x297a('0x10'),_0x52fec0,_0x435cfa[_0x297a('0x15')]['message']);return _0x52c9b1(_0x435cfa[_0x297a('0x15')][_0x297a('0x17')]);}else{logger[_0x297a('0x18')](_0x297a('0x10'),_0x52fec0,_0x297a('0x11'));_0x52c9b1(_0x435cfa['result']['message']);}})[_0x297a('0x19')](function(_0x147d3f){logger[_0x297a('0x15')](_0x297a('0x10'),_0x52fec0,_0x147d3f);_0x3fe67c(_0x147d3f);});});}exports['ShowSmsAccount']=function(_0xd4909e){var _0x31b76c=this;return new Promise(function(_0x545536,_0x2d60f0){return db[_0x297a('0x1a')][_0x297a('0x1b')]({'raw':_0xd4909e[_0x297a('0x1c')]?_0xd4909e[_0x297a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xd4909e['options']?_0xd4909e['options'][_0x297a('0x1d')]||null:null,'attributes':_0xd4909e[_0x297a('0x1c')]?_0xd4909e[_0x297a('0x1c')][_0x297a('0x1e')]||null:null,'include':_0xd4909e['options']?_0xd4909e[_0x297a('0x1c')][_0x297a('0x1f')]?_[_0x297a('0x20')](_0xd4909e[_0x297a('0x1c')][_0x297a('0x1f')],function(_0x1d147e){return{'model':db[_0x1d147e[_0x297a('0x21')]],'as':_0x1d147e['as'],'attributes':_0x1d147e['attributes'],'include':_0x1d147e[_0x297a('0x1f')]?_['map'](_0x1d147e[_0x297a('0x1f')],function(_0x2003df){return{'model':db[_0x2003df[_0x297a('0x21')]],'as':_0x2003df['as'],'attributes':_0x2003df[_0x297a('0x1e')],'include':_0x2003df['include']?_[_0x297a('0x20')](_0x2003df[_0x297a('0x1f')],function(_0x59d962){return{'model':db[_0x59d962[_0x297a('0x21')]],'as':_0x59d962['as'],'attributes':_0x59d962[_0x297a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x297a('0x22')](function(_0x2d9ee0){logger['info'](_0x297a('0x23'),_0xd4909e);logger[_0x297a('0x12')](_0x297a('0x23'),_0xd4909e,JSON['stringify'](_0x2d9ee0));_0x545536(_0x2d9ee0);})['catch'](function(_0x3b9234){logger[_0x297a('0x15')](_0x297a('0x23'),_0x3b9234[_0x297a('0x17')],_0xd4909e);_0x2d60f0(_0x31b76c[_0x297a('0x15')](0x1f4,_0x3b9234[_0x297a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 8e0bd69..29bb599 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 _0x31d8=['length','./smsAccount.events','save','update','emit','removeListener'];(function(_0x3c45c0,_0x174511){var _0x3eafa0=function(_0x3012ad){while(--_0x3012ad){_0x3c45c0['push'](_0x3c45c0['shift']());}};_0x3eafa0(++_0x174511);}(_0x31d8,0xf7));var _0x831d=function(_0x329dd0,_0x47e04f){_0x329dd0=_0x329dd0-0x0;var _0x4f5b90=_0x31d8[_0x329dd0];return _0x4f5b90;};'use strict';var SmsAccountEvents=require(_0x831d('0x0'));var events=[_0x831d('0x1'),'remove',_0x831d('0x2')];function createListener(_0x40d6cd,_0x354d92){return function(_0x2b0079){_0x354d92[_0x831d('0x3')](_0x40d6cd,_0x2b0079);};}function removeListener(_0x34f965,_0x3cde9a){return function(){SmsAccountEvents[_0x831d('0x4')](_0x34f965,_0x3cde9a);};}exports['register']=function(_0x30fec8){for(var _0x255b00=0x0,_0x4b613b=events[_0x831d('0x5')];_0x255b00<_0x4b613b;_0x255b00++){var _0x20a97a=events[_0x255b00];var _0x38ac15=createListener('smsAccount:'+_0x20a97a,_0x30fec8);SmsAccountEvents['on'](_0x20a97a,_0x38ac15);}}; \ No newline at end of file +var _0x834b=['register','length','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x2bff4e,_0x28ef3e){var _0x1b5b65=function(_0x2d55e7){while(--_0x2d55e7){_0x2bff4e['push'](_0x2bff4e['shift']());}};_0x1b5b65(++_0x28ef3e);}(_0x834b,0x113));var _0xb834=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x834b[_0x501510];return _0x1e6ee5;};'use strict';var SmsAccountEvents=require(_0xb834('0x0'));var events=[_0xb834('0x1'),_0xb834('0x2'),'update'];function createListener(_0x368079,_0x151569){return function(_0x121b2e){_0x151569[_0xb834('0x3')](_0x368079,_0x121b2e);};}function removeListener(_0x3aaea9,_0x13fd8d){return function(){SmsAccountEvents[_0xb834('0x4')](_0x3aaea9,_0x13fd8d);};}exports[_0xb834('0x5')]=function(_0x78724c){for(var _0x340478=0x0,_0x39129f=events[_0xb834('0x6')];_0x340478<_0x39129f;_0x340478++){var _0x247903=events[_0x340478];var _0x4231ed=createListener('smsAccount:'+_0x247903,_0x78724c);SmsAccountEvents['on'](_0x247903,_0x4231ed);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 33e64c7..35fc643 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 _0x432d=['isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','./smsApplication.controller'];(function(_0x840140,_0x3ce00e){var _0x1bf80a=function(_0x2bb592){while(--_0x2bb592){_0x840140['push'](_0x840140['shift']());}};_0x1bf80a(++_0x3ce00e);}(_0x432d,0x19a));var _0xd432=function(_0x1bbb03,_0x18c084){_0x1bbb03=_0x1bbb03-0x0;var _0x1ae659=_0x432d[_0x1bbb03];return _0x1ae659;};'use strict';var multer=require(_0xd432('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd432('0x1'));var express=require(_0xd432('0x2'));var router=express['Router']();var fs_extra=require(_0xd432('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd432('0x4'));var config=require('../../config/environment');var controller=require(_0xd432('0x5'));router['get']('/',auth[_0xd432('0x6')](),controller['index']);router[_0xd432('0x7')](_0xd432('0x8'),auth['isAuthenticated'](),controller[_0xd432('0x9')]);router['post']('/',auth[_0xd432('0x6')](),controller[_0xd432('0xa')]);router[_0xd432('0xb')](_0xd432('0x8'),auth['isAuthenticated'](),controller[_0xd432('0xc')]);router[_0xd432('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xd432('0xe')]);module[_0xd432('0xf')]=router; \ No newline at end of file +var _0x1f3f=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','show','post','create','/:id','update','destroy','multer','util'];(function(_0x169a8a,_0x3526b1){var _0x2e8502=function(_0x4c37f3){while(--_0x4c37f3){_0x169a8a['push'](_0x169a8a['shift']());}};_0x2e8502(++_0x3526b1);}(_0x1f3f,0x75));var _0xf1f3=function(_0x1e50fc,_0x3d2684){_0x1e50fc=_0x1e50fc-0x0;var _0x497f51=_0x1f3f[_0x1e50fc];return _0x497f51;};'use strict';var multer=require(_0xf1f3('0x0'));var util=require(_0xf1f3('0x1'));var path=require(_0xf1f3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf1f3('0x3')]();var fs_extra=require(_0xf1f3('0x4'));var auth=require(_0xf1f3('0x5'));var interaction=require(_0xf1f3('0x6'));var config=require('../../config/environment');var controller=require(_0xf1f3('0x7'));router[_0xf1f3('0x8')]('/',auth[_0xf1f3('0x9')](),controller[_0xf1f3('0xa')]);router['get']('/:id',auth[_0xf1f3('0x9')](),controller[_0xf1f3('0xb')]);router[_0xf1f3('0xc')]('/',auth[_0xf1f3('0x9')](),controller[_0xf1f3('0xd')]);router['put'](_0xf1f3('0xe'),auth[_0xf1f3('0x9')](),controller[_0xf1f3('0xf')]);router['delete'](_0xf1f3('0xe'),auth[_0xf1f3('0x9')](),controller[_0xf1f3('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 7d736b2..2750149 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 _0xb1d2=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0xb5ae1c,_0x4cc974){var _0x1fa0cd=function(_0x1087b9){while(--_0x1087b9){_0xb5ae1c['push'](_0xb5ae1c['shift']());}};_0x1fa0cd(++_0x4cc974);}(_0xb1d2,0x192));var _0x2b1d=function(_0x360c59,_0x5c4ddd){_0x360c59=_0x360c59-0x0;var _0x233658=_0xb1d2[_0x360c59];return _0x233658;};'use strict';var Sequelize=require(_0x2b1d('0x0'));module[_0x2b1d('0x1')]={'priority':{'type':Sequelize[_0x2b1d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2b1d('0x3')],'allowNull':![],'defaultValue':_0x2b1d('0x4')},'appdata':{'type':Sequelize[_0x2b1d('0x5')]()},'description':{'type':Sequelize[_0x2b1d('0x3')]},'interval':{'type':Sequelize[_0x2b1d('0x3')],'defaultValue':_0x2b1d('0x6')}}; \ No newline at end of file +var _0x4492=['TEXT','STRING','sequelize','exports','INTEGER','noop'];(function(_0x3f045c,_0x2fdfc8){var _0x47433f=function(_0x514f1b){while(--_0x514f1b){_0x3f045c['push'](_0x3f045c['shift']());}};_0x47433f(++_0x2fdfc8);}(_0x4492,0x7a));var _0x2449=function(_0x4afe3b,_0x255e0d){_0x4afe3b=_0x4afe3b-0x0;var _0x2c22d1=_0x4492[_0x4afe3b];return _0x2c22d1;};'use strict';var Sequelize=require(_0x2449('0x0'));module[_0x2449('0x1')]={'priority':{'type':Sequelize[_0x2449('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2449('0x3')},'appdata':{'type':Sequelize[_0x2449('0x4')]()},'description':{'type':Sequelize[_0x2449('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index aea28a6..706eb8f 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 _0xffab=['api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','save','update','then','destroy','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','body','find','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xffab,0x149));var _0xbffa=function(_0x2d3bf9,_0x316601){_0x2d3bf9=_0x2d3bf9-0x0;var _0x150076=_0xffab[_0x2d3bf9];return _0x150076;};'use strict';var emlformat=require(_0xbffa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbffa('0x1'));var rp=require('request-promise');var moment=require(_0xbffa('0x2'));var BPromise=require(_0xbffa('0x3'));var Mustache=require(_0xbffa('0x4'));var util=require('util');var path=require(_0xbffa('0x5'));var sox=require(_0xbffa('0x6'));var csv=require(_0xbffa('0x7'));var ejs=require(_0xbffa('0x8'));var fs=require('fs');var fs_extra=require(_0xbffa('0x9'));var _=require(_0xbffa('0xa'));var squel=require(_0xbffa('0xb'));var crypto=require(_0xbffa('0xc'));var jsforce=require(_0xbffa('0xd'));var deskjs=require(_0xbffa('0xe'));var toCsv=require(_0xbffa('0x7'));var querystring=require('querystring');var Papa=require(_0xbffa('0xf'));var Redis=require(_0xbffa('0x10'));var authService=require(_0xbffa('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbffa('0x12'));var hardwareService=require(_0xbffa('0x13'));var logger=require(_0xbffa('0x14'))(_0xbffa('0x15'));var utils=require(_0xbffa('0x16'));var config=require(_0xbffa('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x504111,_0x4cc266){_0x4cc266=_0x4cc266||0xcc;return function(_0x3397c4){if(_0x3397c4){return _0x504111[_0xbffa('0x18')](_0x4cc266);}return _0x504111['status'](_0x4cc266)[_0xbffa('0x19')]();};}function respondWithResult(_0x2fe2dc,_0x33b5f0){_0x33b5f0=_0x33b5f0||0xc8;return function(_0x2e649d){if(_0x2e649d){return _0x2fe2dc[_0xbffa('0x1a')](_0x33b5f0)[_0xbffa('0x1b')](_0x2e649d);}};}function respondWithFilteredResult(_0x2d13e1,_0xf0b3dd){return function(_0x5d3b45){if(_0x5d3b45){var _0x41ffa8=typeof _0xf0b3dd[_0xbffa('0x1c')]===_0xbffa('0x1d')&&typeof _0xf0b3dd[_0xbffa('0x1e')]==='undefined';var _0x56ba3a=_0x5d3b45['count'];var _0x4ec2c5=_0x41ffa8?0x0:_0xf0b3dd[_0xbffa('0x1c')];var _0x3a2887=_0x41ffa8?_0x5d3b45[_0xbffa('0x1f')]:_0xf0b3dd[_0xbffa('0x1c')]+_0xf0b3dd[_0xbffa('0x1e')];var _0x3ffbb7;if(_0x3a2887>=_0x56ba3a){_0x3a2887=_0x56ba3a;_0x3ffbb7=0xc8;}else{_0x3ffbb7=0xce;}_0x2d13e1[_0xbffa('0x1a')](_0x3ffbb7);return _0x2d13e1[_0xbffa('0x20')]('Content-Range',_0x4ec2c5+'-'+_0x3a2887+'/'+_0x56ba3a)['json'](_0x5d3b45);}return null;};}function patchUpdates(_0x5341b9){return function(_0x4c5174){try{jsonpatch['apply'](_0x4c5174,_0x5341b9,!![]);}catch(_0x4c9d33){return BPromise['reject'](_0x4c9d33);}return _0x4c5174[_0xbffa('0x21')]();};}function saveUpdates(_0x14d417,_0x191de4){return function(_0x5b0657){if(_0x5b0657){return _0x5b0657[_0xbffa('0x22')](_0x14d417)[_0xbffa('0x23')](function(_0x307ae1){return _0x307ae1;});}return null;};}function removeEntity(_0x37cde5,_0x462c1e){return function(_0x4a6ac9){if(_0x4a6ac9){return _0x4a6ac9[_0xbffa('0x24')]()['then'](function(){_0x37cde5['status'](0xcc)[_0xbffa('0x19')]();});}};}function handleEntityNotFound(_0xcd1ef4,_0x3790cb){return function(_0x557f96){if(!_0x557f96){_0xcd1ef4[_0xbffa('0x18')](0x194);}return _0x557f96;};}function handleError(_0x5324a3,_0x5e5286){_0x5e5286=_0x5e5286||0x1f4;return function(_0x49d1d){logger[_0xbffa('0x25')](_0x49d1d['stack']);if(_0x49d1d[_0xbffa('0x26')]){delete _0x49d1d[_0xbffa('0x26')];}_0x5324a3[_0xbffa('0x1a')](_0x5e5286)[_0xbffa('0x27')](_0x49d1d);};}exports[_0xbffa('0x28')]=function(_0x1f7eca,_0x18a371){var _0x5684c8={},_0x21337e={},_0x1ff593={'count':0x0,'rows':[]};var _0x2fbd19=_[_0xbffa('0x29')](db[_0xbffa('0x2a')][_0xbffa('0x2b')],function(_0x3d18f0){return{'name':_0x3d18f0[_0xbffa('0x2c')],'type':_0x3d18f0[_0xbffa('0x2d')][_0xbffa('0x2e')]};});_0x21337e[_0xbffa('0x2f')]=_['map'](_0x2fbd19,_0xbffa('0x26'));_0x21337e['query']=_[_0xbffa('0x30')](_0x1f7eca[_0xbffa('0x31')]);_0x21337e[_0xbffa('0x32')]=_[_0xbffa('0x33')](_0x21337e[_0xbffa('0x2f')],_0x21337e[_0xbffa('0x31')]);_0x5684c8['attributes']=_[_0xbffa('0x33')](_0x21337e[_0xbffa('0x2f')],qs[_0xbffa('0x34')](_0x1f7eca[_0xbffa('0x31')]['fields']));_0x5684c8['attributes']=_0x5684c8[_0xbffa('0x35')][_0xbffa('0x36')]?_0x5684c8['attributes']:_0x21337e[_0xbffa('0x2f')];if(!_0x1f7eca[_0xbffa('0x31')][_0xbffa('0x37')]('nolimit')){_0x5684c8[_0xbffa('0x1e')]=qs['limit'](_0x1f7eca[_0xbffa('0x31')][_0xbffa('0x1e')]);_0x5684c8[_0xbffa('0x1c')]=qs[_0xbffa('0x1c')](_0x1f7eca['query'][_0xbffa('0x1c')]);}_0x5684c8[_0xbffa('0x38')]=qs['sort'](_0x1f7eca['query']['sort']);_0x5684c8[_0xbffa('0x39')]=qs[_0xbffa('0x32')](_['pick'](_0x1f7eca[_0xbffa('0x31')],_0x21337e['filters']),_0x2fbd19);if(_0x1f7eca[_0xbffa('0x31')]['filter']){_0x5684c8[_0xbffa('0x39')]=_[_0xbffa('0x3a')](_0x5684c8[_0xbffa('0x39')],{'$or':_[_0xbffa('0x29')](_0x2fbd19,function(_0x140e9a){if(_0x140e9a['type']!==_0xbffa('0x3b')){var _0x570542={};_0x570542[_0x140e9a[_0xbffa('0x26')]]={'$like':'%'+_0x1f7eca[_0xbffa('0x31')][_0xbffa('0x3c')]+'%'};return _0x570542;}})});}_0x5684c8=_[_0xbffa('0x3a')]({},_0x5684c8,_0x1f7eca[_0xbffa('0x3d')]);var _0x357b8a={'where':_0x5684c8[_0xbffa('0x39')]};return db[_0xbffa('0x2a')][_0xbffa('0x1f')](_0x357b8a)[_0xbffa('0x23')](function(_0x303bdf){_0x1ff593['count']=_0x303bdf;if(_0x1f7eca[_0xbffa('0x31')][_0xbffa('0x3e')]){_0x5684c8[_0xbffa('0x3f')]=[{'all':!![]}];}return db[_0xbffa('0x2a')][_0xbffa('0x40')](_0x5684c8);})['then'](function(_0x56e86d){_0x1ff593[_0xbffa('0x41')]=_0x56e86d;return _0x1ff593;})[_0xbffa('0x23')](respondWithFilteredResult(_0x18a371,_0x5684c8))[_0xbffa('0x42')](handleError(_0x18a371,null));};exports['show']=function(_0x41e3b0,_0x1a5254){var _0x53b244={'raw':!![],'where':{'id':_0x41e3b0[_0xbffa('0x43')]['id']}},_0x1b3ce5={};_0x1b3ce5['model']=_[_0xbffa('0x30')](db[_0xbffa('0x2a')][_0xbffa('0x2b')]);_0x1b3ce5['query']=_[_0xbffa('0x30')](_0x41e3b0['query']);_0x1b3ce5['filters']=_[_0xbffa('0x33')](_0x1b3ce5[_0xbffa('0x2f')],_0x1b3ce5[_0xbffa('0x31')]);_0x53b244['attributes']=_[_0xbffa('0x33')](_0x1b3ce5[_0xbffa('0x2f')],qs[_0xbffa('0x34')](_0x41e3b0['query']['fields']));_0x53b244[_0xbffa('0x35')]=_0x53b244[_0xbffa('0x35')][_0xbffa('0x36')]?_0x53b244['attributes']:_0x1b3ce5[_0xbffa('0x2f')];if(_0x41e3b0[_0xbffa('0x31')]['includeAll']){_0x53b244[_0xbffa('0x3f')]=[{'all':!![]}];}_0x53b244=_[_0xbffa('0x3a')]({},_0x53b244,_0x41e3b0['options']);return db[_0xbffa('0x2a')]['find'](_0x53b244)[_0xbffa('0x23')](handleEntityNotFound(_0x1a5254,null))[_0xbffa('0x23')](respondWithResult(_0x1a5254,null))[_0xbffa('0x42')](handleError(_0x1a5254,null));};exports['create']=function(_0x3582eb,_0x1fd367){return db[_0xbffa('0x2a')]['create'](_0x3582eb[_0xbffa('0x44')],{})['then'](respondWithResult(_0x1fd367,0xc9))[_0xbffa('0x42')](handleError(_0x1fd367,null));};exports[_0xbffa('0x22')]=function(_0x32b34b,_0x5ac53e){if(_0x32b34b[_0xbffa('0x44')]['id']){delete _0x32b34b[_0xbffa('0x44')]['id'];}return db['SmsApplication'][_0xbffa('0x45')]({'where':{'id':_0x32b34b[_0xbffa('0x43')]['id']}})['then'](handleEntityNotFound(_0x5ac53e,null))[_0xbffa('0x23')](saveUpdates(_0x32b34b[_0xbffa('0x44')],null))[_0xbffa('0x23')](respondWithResult(_0x5ac53e,null))['catch'](handleError(_0x5ac53e,null));};exports[_0xbffa('0x24')]=function(_0x45ba94,_0x47061c){return db[_0xbffa('0x2a')][_0xbffa('0x45')]({'where':{'id':_0x45ba94[_0xbffa('0x43')]['id']}})[_0xbffa('0x23')](handleEntityNotFound(_0x47061c,null))[_0xbffa('0x23')](removeEntity(_0x47061c,null))['catch'](handleError(_0x47061c,null));}; \ No newline at end of file +var _0xa487=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','SmsApplication','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x168c8f,_0x2fc190){var _0x2059c7=function(_0x27ddcc){while(--_0x27ddcc){_0x168c8f['push'](_0x168c8f['shift']());}};_0x2059c7(++_0x2fc190);}(_0xa487,0x124));var _0x7a48=function(_0xb0a019,_0x4c3735){_0xb0a019=_0xb0a019-0x0;var _0x2cd06c=_0xa487[_0xb0a019];return _0x2cd06c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a48('0x0'));var zipdir=require(_0x7a48('0x1'));var jsonpatch=require(_0x7a48('0x2'));var rp=require(_0x7a48('0x3'));var moment=require(_0x7a48('0x4'));var BPromise=require(_0x7a48('0x5'));var Mustache=require('mustache');var util=require(_0x7a48('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7a48('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a48('0x8'));var _=require(_0x7a48('0x9'));var squel=require(_0x7a48('0xa'));var crypto=require(_0x7a48('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7a48('0xc'));var toCsv=require(_0x7a48('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7a48('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x7a48('0xe'));var hardwareService=require(_0x7a48('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x7a48('0x10'));var config=require(_0x7a48('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x7a48('0x12'))['db'];function respondWithStatusCode(_0x191ceb,_0x327d2e){_0x327d2e=_0x327d2e||0xcc;return function(_0x22e0b8){if(_0x22e0b8){return _0x191ceb[_0x7a48('0x13')](_0x327d2e);}return _0x191ceb[_0x7a48('0x14')](_0x327d2e)[_0x7a48('0x15')]();};}function respondWithResult(_0x4c58f4,_0x374c9c){_0x374c9c=_0x374c9c||0xc8;return function(_0x5af488){if(_0x5af488){return _0x4c58f4[_0x7a48('0x14')](_0x374c9c)[_0x7a48('0x16')](_0x5af488);}};}function respondWithFilteredResult(_0x5c5a8b,_0x570fdf){return function(_0x547383){if(_0x547383){var _0x5ba1da=typeof _0x570fdf[_0x7a48('0x17')]==='undefined'&&typeof _0x570fdf[_0x7a48('0x18')]==='undefined';var _0x2c9d7d=_0x547383[_0x7a48('0x19')];var _0x7439f6=_0x5ba1da?0x0:_0x570fdf[_0x7a48('0x17')];var _0x435730=_0x5ba1da?_0x547383[_0x7a48('0x19')]:_0x570fdf[_0x7a48('0x17')]+_0x570fdf[_0x7a48('0x18')];var _0x1cde20;if(_0x435730>=_0x2c9d7d){_0x435730=_0x2c9d7d;_0x1cde20=0xc8;}else{_0x1cde20=0xce;}_0x5c5a8b[_0x7a48('0x14')](_0x1cde20);return _0x5c5a8b[_0x7a48('0x1a')](_0x7a48('0x1b'),_0x7439f6+'-'+_0x435730+'/'+_0x2c9d7d)[_0x7a48('0x16')](_0x547383);}return null;};}function patchUpdates(_0xa35efe){return function(_0x43fb7f){try{jsonpatch['apply'](_0x43fb7f,_0xa35efe,!![]);}catch(_0x39a489){return BPromise[_0x7a48('0x1c')](_0x39a489);}return _0x43fb7f[_0x7a48('0x1d')]();};}function saveUpdates(_0x4dad4e,_0x448438){return function(_0xa6480b){if(_0xa6480b){return _0xa6480b[_0x7a48('0x1e')](_0x4dad4e)[_0x7a48('0x1f')](function(_0x13a1ca){return _0x13a1ca;});}return null;};}function removeEntity(_0x2bd876,_0x419582){return function(_0x543342){if(_0x543342){return _0x543342[_0x7a48('0x20')]()[_0x7a48('0x1f')](function(){_0x2bd876[_0x7a48('0x14')](0xcc)[_0x7a48('0x15')]();});}};}function handleEntityNotFound(_0x11c97b,_0x3097b2){return function(_0x2a5a40){if(!_0x2a5a40){_0x11c97b[_0x7a48('0x13')](0x194);}return _0x2a5a40;};}function handleError(_0x4b2aef,_0x534984){_0x534984=_0x534984||0x1f4;return function(_0x3c6be0){logger[_0x7a48('0x21')](_0x3c6be0[_0x7a48('0x22')]);if(_0x3c6be0[_0x7a48('0x23')]){delete _0x3c6be0[_0x7a48('0x23')];}_0x4b2aef[_0x7a48('0x14')](_0x534984)[_0x7a48('0x24')](_0x3c6be0);};}exports[_0x7a48('0x25')]=function(_0x50ed18,_0x2d59bc){var _0x18466c={},_0x2823a8={},_0x24ba1e={'count':0x0,'rows':[]};var _0x35f0cd=_['map'](db[_0x7a48('0x26')][_0x7a48('0x27')],function(_0x3ff0b9){return{'name':_0x3ff0b9[_0x7a48('0x28')],'type':_0x3ff0b9[_0x7a48('0x29')]['key']};});_0x2823a8[_0x7a48('0x2a')]=_[_0x7a48('0x2b')](_0x35f0cd,'name');_0x2823a8[_0x7a48('0x2c')]=_[_0x7a48('0x2d')](_0x50ed18['query']);_0x2823a8[_0x7a48('0x2e')]=_[_0x7a48('0x2f')](_0x2823a8['model'],_0x2823a8[_0x7a48('0x2c')]);_0x18466c['attributes']=_[_0x7a48('0x2f')](_0x2823a8[_0x7a48('0x2a')],qs[_0x7a48('0x30')](_0x50ed18[_0x7a48('0x2c')]['fields']));_0x18466c[_0x7a48('0x31')]=_0x18466c[_0x7a48('0x31')][_0x7a48('0x32')]?_0x18466c[_0x7a48('0x31')]:_0x2823a8[_0x7a48('0x2a')];if(!_0x50ed18[_0x7a48('0x2c')][_0x7a48('0x33')](_0x7a48('0x34'))){_0x18466c['limit']=qs[_0x7a48('0x18')](_0x50ed18[_0x7a48('0x2c')][_0x7a48('0x18')]);_0x18466c['offset']=qs[_0x7a48('0x17')](_0x50ed18['query'][_0x7a48('0x17')]);}_0x18466c[_0x7a48('0x35')]=qs[_0x7a48('0x36')](_0x50ed18[_0x7a48('0x2c')]['sort']);_0x18466c[_0x7a48('0x37')]=qs[_0x7a48('0x2e')](_[_0x7a48('0x38')](_0x50ed18['query'],_0x2823a8[_0x7a48('0x2e')]),_0x35f0cd);if(_0x50ed18['query']['filter']){_0x18466c[_0x7a48('0x37')]=_[_0x7a48('0x39')](_0x18466c[_0x7a48('0x37')],{'$or':_[_0x7a48('0x2b')](_0x35f0cd,function(_0x4845c1){if(_0x4845c1[_0x7a48('0x29')]!==_0x7a48('0x3a')){var _0x4396ad={};_0x4396ad[_0x4845c1['name']]={'$like':'%'+_0x50ed18[_0x7a48('0x2c')][_0x7a48('0x3b')]+'%'};return _0x4396ad;}})});}_0x18466c=_[_0x7a48('0x39')]({},_0x18466c,_0x50ed18[_0x7a48('0x3c')]);var _0x2e1902={'where':_0x18466c[_0x7a48('0x37')]};return db[_0x7a48('0x26')][_0x7a48('0x19')](_0x2e1902)['then'](function(_0x89684f){_0x24ba1e[_0x7a48('0x19')]=_0x89684f;if(_0x50ed18['query'][_0x7a48('0x3d')]){_0x18466c[_0x7a48('0x3e')]=[{'all':!![]}];}return db[_0x7a48('0x26')][_0x7a48('0x3f')](_0x18466c);})[_0x7a48('0x1f')](function(_0x22d9dc){_0x24ba1e[_0x7a48('0x40')]=_0x22d9dc;return _0x24ba1e;})[_0x7a48('0x1f')](respondWithFilteredResult(_0x2d59bc,_0x18466c))[_0x7a48('0x41')](handleError(_0x2d59bc,null));};exports['show']=function(_0x54d0e9,_0x19c4bf){var _0x4d0679={'raw':!![],'where':{'id':_0x54d0e9[_0x7a48('0x42')]['id']}},_0x418db9={};_0x418db9['model']=_[_0x7a48('0x2d')](db[_0x7a48('0x26')][_0x7a48('0x27')]);_0x418db9['query']=_[_0x7a48('0x2d')](_0x54d0e9[_0x7a48('0x2c')]);_0x418db9[_0x7a48('0x2e')]=_[_0x7a48('0x2f')](_0x418db9['model'],_0x418db9[_0x7a48('0x2c')]);_0x4d0679[_0x7a48('0x31')]=_[_0x7a48('0x2f')](_0x418db9['model'],qs[_0x7a48('0x30')](_0x54d0e9[_0x7a48('0x2c')][_0x7a48('0x30')]));_0x4d0679[_0x7a48('0x31')]=_0x4d0679[_0x7a48('0x31')][_0x7a48('0x32')]?_0x4d0679[_0x7a48('0x31')]:_0x418db9[_0x7a48('0x2a')];if(_0x54d0e9[_0x7a48('0x2c')][_0x7a48('0x3d')]){_0x4d0679[_0x7a48('0x3e')]=[{'all':!![]}];}_0x4d0679=_[_0x7a48('0x39')]({},_0x4d0679,_0x54d0e9['options']);return db[_0x7a48('0x26')][_0x7a48('0x43')](_0x4d0679)[_0x7a48('0x1f')](handleEntityNotFound(_0x19c4bf,null))['then'](respondWithResult(_0x19c4bf,null))[_0x7a48('0x41')](handleError(_0x19c4bf,null));};exports['create']=function(_0x50f89f,_0x99fb3d){return db[_0x7a48('0x26')][_0x7a48('0x44')](_0x50f89f[_0x7a48('0x45')],{})['then'](respondWithResult(_0x99fb3d,0xc9))[_0x7a48('0x41')](handleError(_0x99fb3d,null));};exports[_0x7a48('0x1e')]=function(_0x2fde67,_0xb04162){if(_0x2fde67[_0x7a48('0x45')]['id']){delete _0x2fde67[_0x7a48('0x45')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x2fde67[_0x7a48('0x42')]['id']}})[_0x7a48('0x1f')](handleEntityNotFound(_0xb04162,null))[_0x7a48('0x1f')](saveUpdates(_0x2fde67[_0x7a48('0x45')],null))[_0x7a48('0x1f')](respondWithResult(_0xb04162,null))[_0x7a48('0x41')](handleError(_0xb04162,null));};exports[_0x7a48('0x20')]=function(_0x493edf,_0x2e81ad){return db[_0x7a48('0x26')][_0x7a48('0x43')]({'where':{'id':_0x493edf['params']['id']}})[_0x7a48('0x1f')](handleEntityNotFound(_0x2e81ad,null))[_0x7a48('0x1f')](removeEntity(_0x2e81ad,null))[_0x7a48('0x41')](handleError(_0x2e81ad,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b120c30..bda446f 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 _0xe3da=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x49c653,_0x390195){var _0x31e169=function(_0x3684ac){while(--_0x3684ac){_0x49c653['push'](_0x49c653['shift']());}};_0x31e169(++_0x390195);}(_0xe3da,0x1ef));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require('moment');var BPromise=require(_0xae3d('0x4'));var rp=require(_0xae3d('0x5'));var fs=require('fs');var path=require(_0xae3d('0x6'));var rimraf=require(_0xae3d('0x7'));var config=require(_0xae3d('0x8'));var attributes=require(_0xae3d('0x9'));module[_0xae3d('0xa')]=function(_0x1a46ea,_0x2a14ba){return _0x1a46ea[_0xae3d('0xb')](_0xae3d('0xc'),attributes,{'tableName':_0xae3d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xae3d('0xe'),'collate':_0xae3d('0xf')});}; \ No newline at end of file +var _0x1e77=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x56f816,_0x430cfb){var _0x2b05cf=function(_0x18128d){while(--_0x18128d){_0x56f816['push'](_0x56f816['shift']());}};_0x2b05cf(++_0x430cfb);}(_0x1e77,0xbe));var _0x71e7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1e77[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x71e7('0x0'));var util=require('util');var logger=require(_0x71e7('0x1'))(_0x71e7('0x2'));var moment=require(_0x71e7('0x3'));var BPromise=require(_0x71e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x71e7('0x5'));var attributes=require(_0x71e7('0x6'));module[_0x71e7('0x7')]=function(_0x25b53f,_0x7bf88b){return _0x25b53f[_0x71e7('0x8')](_0x71e7('0x9'),attributes,{'tableName':_0x71e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x71e7('0xb'),'collate':_0x71e7('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 08eb169..390197d 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 _0x92e0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','request\x20sent','error','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','moment'];(function(_0x2507e9,_0x17fd2b){var _0x4e05f3=function(_0x359355){while(--_0x359355){_0x2507e9['push'](_0x2507e9['shift']());}};_0x4e05f3(++_0x17fd2b);}(_0x92e0,0x154));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x092e('0x0'));var util=require('util');var moment=require(_0x092e('0x1'));var BPromise=require(_0x092e('0x2'));var rs=require(_0x092e('0x3'));var fs=require('fs');var Redis=require(_0x092e('0x4'));var db=require(_0x092e('0x5'))['db'];var utils=require(_0x092e('0x6'));var logger=require(_0x092e('0x7'))(_0x092e('0x8'));var config=require(_0x092e('0x9'));var jayson=require(_0x092e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f1f0b,_0x1ddace,_0x1af53d){return new BPromise(function(_0x4c73a9,_0x414a72){return client['request'](_0x2f1f0b,_0x1af53d)['then'](function(_0x2b4a69){logger[_0x092e('0xb')]('SmsApplication,\x20%s,\x20%s',_0x1ddace,_0x092e('0xc'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x1ddace,_0x092e('0xc'),JSON['stringify'](_0x2b4a69));if(_0x2b4a69[_0x092e('0xd')]){if(_0x2b4a69['error']['code']===0x1f4){logger[_0x092e('0xd')]('SmsApplication,\x20%s,\x20%s',_0x1ddace,_0x2b4a69[_0x092e('0xd')][_0x092e('0xe')]);return _0x414a72(_0x2b4a69[_0x092e('0xd')][_0x092e('0xe')]);}logger[_0x092e('0xd')]('SmsApplication,\x20%s,\x20%s',_0x1ddace,_0x2b4a69['error'][_0x092e('0xe')]);return _0x4c73a9(_0x2b4a69[_0x092e('0xd')]['message']);}else{logger[_0x092e('0xb')](_0x092e('0xf'),_0x1ddace,_0x092e('0xc'));_0x4c73a9(_0x2b4a69[_0x092e('0x10')]['message']);}})[_0x092e('0x11')](function(_0x13bdf1){logger[_0x092e('0xd')]('SmsApplication,\x20%s,\x20%s',_0x1ddace,_0x13bdf1);_0x414a72(_0x13bdf1);});});} \ No newline at end of file +var _0x6dd1=['debug','stringify','error','code','message','info','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0x6dd1,0x111));var _0x16dd=function(_0x32981b,_0x999ffe){_0x32981b=_0x32981b-0x0;var _0x3a60e1=_0x6dd1[_0x32981b];return _0x3a60e1;};'use strict';var _=require(_0x16dd('0x0'));var util=require('util');var moment=require(_0x16dd('0x1'));var BPromise=require(_0x16dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16dd('0x3'));var db=require(_0x16dd('0x4'))['db'];var utils=require(_0x16dd('0x5'));var logger=require(_0x16dd('0x6'))(_0x16dd('0x7'));var config=require(_0x16dd('0x8'));var jayson=require(_0x16dd('0x9'));var client=jayson[_0x16dd('0xa')][_0x16dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f532c,_0x589f69,_0x5ad29a){return new BPromise(function(_0x490566,_0x41bca0){return client[_0x16dd('0xc')](_0x4f532c,_0x5ad29a)[_0x16dd('0xd')](function(_0x19595a){logger['info'](_0x16dd('0xe'),_0x589f69,'request\x20sent');logger[_0x16dd('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x589f69,'request\x20sent',JSON[_0x16dd('0x10')](_0x19595a));if(_0x19595a[_0x16dd('0x11')]){if(_0x19595a['error'][_0x16dd('0x12')]===0x1f4){logger[_0x16dd('0x11')](_0x16dd('0xe'),_0x589f69,_0x19595a['error'][_0x16dd('0x13')]);return _0x41bca0(_0x19595a[_0x16dd('0x11')][_0x16dd('0x13')]);}logger[_0x16dd('0x11')](_0x16dd('0xe'),_0x589f69,_0x19595a['error']['message']);return _0x490566(_0x19595a[_0x16dd('0x11')]['message']);}else{logger[_0x16dd('0x14')](_0x16dd('0xe'),_0x589f69,_0x16dd('0x15'));_0x490566(_0x19595a[_0x16dd('0x16')][_0x16dd('0x13')]);}})[_0x16dd('0x17')](function(_0x17a646){logger[_0x16dd('0x11')]('SmsApplication,\x20%s,\x20%s',_0x589f69,_0x17a646);_0x41bca0(_0x17a646);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 49058e9..8d48693 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 _0xb1ad=['create','addMessage','/:id/tags','tracked','smsinteraction:addtags','addTags','put','sms','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','download','post'];(function(_0x1bd985,_0x4e3b7d){var _0x52df6a=function(_0x178ad0){while(--_0x178ad0){_0x1bd985['push'](_0x1bd985['shift']());}};_0x52df6a(++_0x4e3b7d);}(_0xb1ad,0x184));var _0xdb1a=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xb1ad[_0x1abb09];return _0xea1c07;};'use strict';var multer=require(_0xdb1a('0x0'));var util=require(_0xdb1a('0x1'));var path=require(_0xdb1a('0x2'));var timeout=require(_0xdb1a('0x3'));var express=require(_0xdb1a('0x4'));var router=express[_0xdb1a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdb1a('0x6'));var interaction=require(_0xdb1a('0x7'));var config=require(_0xdb1a('0x8'));var controller=require(_0xdb1a('0x9'));router[_0xdb1a('0xa')]('/',auth[_0xdb1a('0xb')](),controller[_0xdb1a('0xc')]);router[_0xdb1a('0xa')](_0xdb1a('0xd'),auth[_0xdb1a('0xb')](),controller[_0xdb1a('0xe')]);router[_0xdb1a('0xa')](_0xdb1a('0xf'),auth[_0xdb1a('0xb')](),controller[_0xdb1a('0x10')]);router['get'](_0xdb1a('0x11'),auth[_0xdb1a('0xb')](),controller['getMessages']);router['get']('/:id/download',auth[_0xdb1a('0xb')](),controller[_0xdb1a('0x12')]);router[_0xdb1a('0x13')]('/',auth[_0xdb1a('0xb')](),controller[_0xdb1a('0x14')]);router[_0xdb1a('0x13')](_0xdb1a('0x11'),auth[_0xdb1a('0xb')](),controller[_0xdb1a('0x15')]);router[_0xdb1a('0x13')](_0xdb1a('0x16'),auth[_0xdb1a('0xb')](),interaction[_0xdb1a('0x17')]('sms',_0xdb1a('0x18')),controller[_0xdb1a('0x19')]);router[_0xdb1a('0x1a')]('/:id',auth[_0xdb1a('0xb')](),interaction['tracked'](_0xdb1a('0x1b'),_0xdb1a('0x1c')),controller[_0xdb1a('0x1d')]);router['delete'](_0xdb1a('0xf'),auth[_0xdb1a('0xb')](),interaction[_0xdb1a('0x17')]('sms',_0xdb1a('0x1e')),controller[_0xdb1a('0x1f')]);router[_0xdb1a('0x20')](_0xdb1a('0x16'),auth[_0xdb1a('0xb')](),controller[_0xdb1a('0x21')]);module['exports']=router; \ No newline at end of file +var _0xc9c3=['../../config/environment','./smsInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post','create','sms','addTags','put','tracked','smsinteraction:destroy','destroy','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xb25555,_0x1fa9ca){var _0x4dac56=function(_0x20f001){while(--_0x20f001){_0xb25555['push'](_0xb25555['shift']());}};_0x4dac56(++_0x1fa9ca);}(_0xc9c3,0x96));var _0x3c9c=function(_0x47e90a,_0x5cf29f){_0x47e90a=_0x47e90a-0x0;var _0x58c4aa=_0xc9c3[_0x47e90a];return _0x58c4aa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3c9c('0x0'));var timeout=require('connect-timeout');var express=require(_0x3c9c('0x1'));var router=express[_0x3c9c('0x2')]();var fs_extra=require(_0x3c9c('0x3'));var auth=require(_0x3c9c('0x4'));var interaction=require(_0x3c9c('0x5'));var config=require(_0x3c9c('0x6'));var controller=require(_0x3c9c('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3c9c('0x8')](_0x3c9c('0x9'),auth[_0x3c9c('0xa')](),controller[_0x3c9c('0xb')]);router[_0x3c9c('0x8')](_0x3c9c('0xc'),auth[_0x3c9c('0xa')](),controller[_0x3c9c('0xd')]);router[_0x3c9c('0x8')](_0x3c9c('0xe'),auth['isAuthenticated'](),controller[_0x3c9c('0xf')]);router[_0x3c9c('0x8')]('/:id/download',auth[_0x3c9c('0xa')](),controller['download']);router[_0x3c9c('0x10')]('/',auth[_0x3c9c('0xa')](),controller[_0x3c9c('0x11')]);router[_0x3c9c('0x10')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x3c9c('0x10')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0x3c9c('0x12'),'smsinteraction:addtags'),controller[_0x3c9c('0x13')]);router[_0x3c9c('0x14')](_0x3c9c('0xc'),auth[_0x3c9c('0xa')](),interaction['tracked'](_0x3c9c('0x12'),'smsinteraction:update'),controller['update']);router['delete'](_0x3c9c('0xc'),auth[_0x3c9c('0xa')](),interaction[_0x3c9c('0x15')](_0x3c9c('0x12'),_0x3c9c('0x16')),controller[_0x3c9c('0x17')]);router[_0x3c9c('0x18')]('/:id/tags',auth[_0x3c9c('0xa')](),controller['removeTags']);module[_0x3c9c('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index bbddf0c..615e084 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 _0xc8fd=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x1a8b58,_0x2c6665){var _0x3fa938=function(_0xc93616){while(--_0xc93616){_0x1a8b58['push'](_0x1a8b58['shift']());}};_0x3fa938(++_0x2c6665);}(_0xc8fd,0xbf));var _0xdc8f=function(_0x1e7143,_0x2e72a){_0x1e7143=_0x1e7143-0x0;var _0x289b5e=_0xc8fd[_0x1e7143];return _0x289b5e;};'use strict';var Sequelize=require(_0xdc8f('0x0'));var moment=require(_0xdc8f('0x1'));module[_0xdc8f('0x2')]={'closed':{'type':Sequelize[_0xdc8f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdc8f('0x4')]},'disposition':{'type':Sequelize[_0xdc8f('0x5')]},'secondDisposition':{'type':Sequelize[_0xdc8f('0x5')]},'thirdDisposition':{'type':Sequelize[_0xdc8f('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xdc8f('0x5')]},'read1stAt':{'type':Sequelize[_0xdc8f('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xdc8f('0x6')]('in',_0xdc8f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdc8f('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xdc8f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x5a25=['STRING','ENUM','out','moment','exports','BOOLEAN','DATE'];(function(_0x302c72,_0x2958d4){var _0x581895=function(_0x5300f0){while(--_0x5300f0){_0x302c72['push'](_0x302c72['shift']());}};_0x581895(++_0x2958d4);}(_0x5a25,0x17d));var _0x55a2=function(_0x4e21ba,_0x18097f){_0x4e21ba=_0x4e21ba-0x0;var _0x55b94b=_0x5a25[_0x4e21ba];return _0x55b94b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x55a2('0x0'));module[_0x55a2('0x1')]={'closed':{'type':Sequelize[_0x55a2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x55a2('0x3')]},'disposition':{'type':Sequelize[_0x55a2('0x4')]},'secondDisposition':{'type':Sequelize[_0x55a2('0x4')]},'thirdDisposition':{'type':Sequelize[_0x55a2('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x55a2('0x4')]},'read1stAt':{'type':Sequelize[_0x55a2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x55a2('0x5')]('in',_0x55a2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x55a2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x55a2('0x5')]('in',_0x55a2('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 66980f1..2fd4a9e 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 _0x411d=['$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','all','show','params','includeAll','options','create','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','hasOwnProperty','pick','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','Tag','findAll','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','direction','secret','Account','mkdirSync','Sms','Owner','N.A.','closed','closedAt','Messages','out','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','fullname','Tags','TagIds','split','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','field','color','from','tools_tags','select','u.fullname','ui.SmsInteractionId','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','left_join','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','isEmpty','SmsAccountId','concat','createdAt','parse'];(function(_0x2645fe,_0x57501e){var _0x286085=function(_0x3345f5){while(--_0x3345f5){_0x2645fe['push'](_0x2645fe['shift']());}};_0x286085(++_0x57501e);}(_0x411d,0x150));var _0xd411=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x411d[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd411('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd411('0x1'));var moment=require(_0xd411('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd411('0x3'));var util=require(_0xd411('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xd411('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd411('0x6'));var _=require(_0xd411('0x7'));var squel=require(_0xd411('0x8'));var crypto=require(_0xd411('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd411('0xa'));var toCsv=require('to-csv');var querystring=require(_0xd411('0xb'));var Papa=require(_0xd411('0xc'));var Redis=require('ioredis');var authService=require(_0xd411('0xd'));var qs=require(_0xd411('0xe'));var as=require(_0xd411('0xf'));var pdf=require(_0xd411('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd411('0x11'))('api');var utils=require(_0xd411('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd411('0x13'))['db'];config[_0xd411('0x14')]=_[_0xd411('0x15')](config['redis'],{'host':_0xd411('0x16'),'port':0x18eb});var socket=require(_0xd411('0x17'))(new Redis(config[_0xd411('0x14')]));require('./smsInteraction.socket')[_0xd411('0x18')](socket);function respondWithStatusCode(_0x35cc9e,_0x54a200){_0x54a200=_0x54a200||0xcc;return function(_0x15fc6b){if(_0x15fc6b){return _0x35cc9e[_0xd411('0x19')](_0x54a200);}return _0x35cc9e[_0xd411('0x1a')](_0x54a200)[_0xd411('0x1b')]();};}function respondWithResult(_0x129ebc,_0x2edc6a){_0x2edc6a=_0x2edc6a||0xc8;return function(_0xaea418){if(_0xaea418){return _0x129ebc['status'](_0x2edc6a)['json'](_0xaea418);}};}function respondWithFilteredResult(_0x237e4c,_0x4f78e2){return function(_0x338689){if(_0x338689){var _0x311330=typeof _0x4f78e2[_0xd411('0x1c')]===_0xd411('0x1d')&&typeof _0x4f78e2['limit']===_0xd411('0x1d');var _0x2fbf37=_0x338689[_0xd411('0x1e')];var _0x7b41ae=_0x311330?0x0:_0x4f78e2[_0xd411('0x1c')];var _0x126158=_0x311330?_0x338689[_0xd411('0x1e')]:_0x4f78e2[_0xd411('0x1c')]+_0x4f78e2[_0xd411('0x1f')];var _0x301798;if(_0x126158>=_0x2fbf37){_0x126158=_0x2fbf37;_0x301798=0xc8;}else{_0x301798=0xce;}_0x237e4c[_0xd411('0x1a')](_0x301798);return _0x237e4c[_0xd411('0x20')](_0xd411('0x21'),_0x7b41ae+'-'+_0x126158+'/'+_0x2fbf37)['json'](_0x338689);}return null;};}function patchUpdates(_0x307139){return function(_0x29c6bb){try{jsonpatch[_0xd411('0x22')](_0x29c6bb,_0x307139,!![]);}catch(_0x556273){return BPromise[_0xd411('0x23')](_0x556273);}return _0x29c6bb[_0xd411('0x24')]();};}function saveUpdates(_0x4f6a9d,_0x126316){return function(_0x1bd3e8){if(_0x1bd3e8){return _0x1bd3e8[_0xd411('0x25')](_0x4f6a9d)[_0xd411('0x26')](function(_0x2ce333){return _0x2ce333;});}return null;};}function removeEntity(_0x33c115,_0x1f9ea){return function(_0x2875cf){if(_0x2875cf){return _0x2875cf[_0xd411('0x27')]()['then'](function(){_0x33c115[_0xd411('0x1a')](0xcc)[_0xd411('0x1b')]();});}};}function handleEntityNotFound(_0x290aca,_0xcd7b3c){return function(_0x3f5d7a){if(!_0x3f5d7a){_0x290aca['sendStatus'](0x194);}return _0x3f5d7a;};}function handleError(_0x2e63c6,_0x327ce5){_0x327ce5=_0x327ce5||0x1f4;return function(_0x3be395){logger[_0xd411('0x28')](_0x3be395['stack']);if(_0x3be395[_0xd411('0x29')]){delete _0x3be395[_0xd411('0x29')];}_0x2e63c6['status'](_0x327ce5)[_0xd411('0x2a')](_0x3be395);};}function getInteractionUsers(_0x2a27bd,_0x4c4add){return new BPromise(function(_0x1b9a4f,_0x5814bf){try{if(_0x4c4add[_0x2a27bd['id']]){_0x2a27bd['Users']=_[_0xd411('0x2b')](_0x4c4add[_0x2a27bd['id']],function(_0x3e252f){return{'id':_0x3e252f['id'],'fullname':_0x3e252f[_0xd411('0x2c')]};});}}catch(_0x28040a){_0x5814bf(_0x28040a);}_0x1b9a4f(_0x2a27bd);});}function getInteractionTags(_0x186f6b,_0x59f9c1){return new BPromise(function(_0x56143a,_0x9335bf){try{if(_0x186f6b['TagIds']){_0x186f6b[_0xd411('0x2d')]=[];_0x186f6b[_0xd411('0x2e')][_0xd411('0x2f')](',')[_0xd411('0x30')](function(_0x51c0b1){_0x186f6b[_0xd411('0x2d')][_0xd411('0x31')](_0x59f9c1[_0x51c0b1]);});}delete _0x186f6b[_0xd411('0x2e')];}catch(_0x18c145){_0x9335bf(_0x18c145);}_0x56143a(_0x186f6b);});}function updateSmsInteraction(_0x3715ba,_0x23b94d,_0x258956){return new BPromise(function(_0x5818b3,_0x4d32de){return getInteractionUsers(_0x3715ba,_0x258956)[_0xd411('0x26')](function(_0x31573b){return getInteractionTags(_0x31573b,_0x23b94d);})[_0xd411('0x26')](function(_0x2ad9fd){_0x5818b3(_0x2ad9fd);})[_0xd411('0x32')](function(_0x4b15cb){_0x4d32de(_0x4b15cb);});});}exports[_0xd411('0x33')]=function(_0x4e81c0,_0x5dbc90){var _0x1c327b={},_0x3c9469={},_0x2aa437={'count':0x0,'rows':[]};var _0x4e0b6f=_['map'](db[_0xd411('0x34')][_0xd411('0x35')],function(_0x4a4e71){return{'name':_0x4a4e71[_0xd411('0x36')],'type':_0x4a4e71[_0xd411('0x37')][_0xd411('0x38')]};});_0x3c9469[_0xd411('0x39')]=_[_0xd411('0x2b')](_0x4e0b6f,_0xd411('0x29'));_0x3c9469[_0xd411('0x3a')]=_['keys'](_0x4e81c0[_0xd411('0x3a')]);_0x3c9469[_0xd411('0x3b')]=_[_0xd411('0x3c')](_0x3c9469[_0xd411('0x39')],_0x3c9469[_0xd411('0x3a')]);_0x1c327b[_0xd411('0x3d')]=_[_0xd411('0x3c')](_0x3c9469[_0xd411('0x39')],qs['fields'](_0x4e81c0[_0xd411('0x3a')][_0xd411('0x3e')]));_0x1c327b[_0xd411('0x3d')]=_0x1c327b[_0xd411('0x3d')][_0xd411('0x3f')]?_0x1c327b[_0xd411('0x3d')]:_0x3c9469['model'];if(!_0x4e81c0['query']['hasOwnProperty'](_0xd411('0x40'))){_0x1c327b['limit']=qs[_0xd411('0x1f')](_0x4e81c0[_0xd411('0x3a')][_0xd411('0x1f')]);_0x1c327b[_0xd411('0x1c')]=qs[_0xd411('0x1c')](_0x4e81c0['query'][_0xd411('0x1c')]);}_0x1c327b[_0xd411('0x41')]=qs[_0xd411('0x42')](_0x4e81c0['query'][_0xd411('0x42')]);_0x1c327b[_0xd411('0x43')]=qs[_0xd411('0x3b')](_['pick'](_0x4e81c0[_0xd411('0x3a')],_0x3c9469[_0xd411('0x3b')]),_0x4e0b6f);var _0x3625f8=[];var _0x5490f5=squel['select']()[_0xd411('0x44')]('id')[_0xd411('0x44')]('name')['field'](_0xd411('0x45'))[_0xd411('0x46')](_0xd411('0x47'));var _0x4ae211=squel[_0xd411('0x48')]()['field']('u.id')['field'](_0xd411('0x49'))[_0xd411('0x44')](_0xd411('0x4a'))['from']('user_has_sms_interactions','ui')['left_join'](_0xd411('0x4b'),'u',_0xd411('0x4c'));var _0x7dbfd7=squel[_0xd411('0x48')]()[_0xd411('0x46')](_0xd411('0x4d'),'i')['left_join'](_0xd411('0x4e'),'c',_0xd411('0x4f'))['left_join'](_0xd411('0x4b'),'o',_0xd411('0x50'))[_0xd411('0x51')](_0xd411('0x52'),'a',_0xd411('0x53'))[_0xd411('0x51')]('sms_messages','me',_0xd411('0x54'))['left_join']('sms_interaction_has_tags','it',_0xd411('0x55'))[_0xd411('0x51')]('tools_tags','t',_0xd411('0x56'));var _0x27c086=squel[_0xd411('0x57')]();var _0x2eb0cd=[];var _0x68b028=squel[_0xd411('0x57')]();var _0x4a7855;if(_0x4e81c0[_0xd411('0x3a')][_0xd411('0x58')]){_0x4a7855=as[_0xd411('0x59')](_0x4e81c0[_0xd411('0x3a')]['search']);var _0x50771e=_0x4a7855[_0xd411('0x5a')];for(var _0x123670=0x0;_0x123670<_0x4a7855[_0xd411('0x5b')][_0xd411('0x3f')];_0x123670++){var _0x3e3230=_0x4a7855[_0xd411('0x5b')][_0x123670];var _0x463908='i';var _0x397c2a=_[_0xd411('0x5c')](_0x4e0b6f,[_0xd411('0x29'),_0x3e3230['field']]);if(!_0x397c2a){switch(_0x3e3230['field']){case _0xd411('0x5d'):if(_0x3e3230['value']==0x1){_0x7dbfd7[_0xd411('0x5e')]('`'+_0x3e3230[_0xd411('0x44')]+_0xd411('0x5f'));}else{_0x7dbfd7[_0xd411('0x5e')]('`'+_0x3e3230[_0xd411('0x44')]+_0xd411('0x60'));}break;case _0xd411('0x61'):if(_0x3e3230[_0xd411('0x62')]===_0xd411('0x63')){if(_0x3e3230['value'][_0xd411('0x2f')]('\x20')[_0xd411('0x3f')]>0x1){_0x27c086[_0x50771e](_0xd411('0x64'),qs[_0xd411('0x65')](_0x3e3230[_0xd411('0x66')]),null);}else{var _0x496b7e='%'+_0x3e3230[_0xd411('0x66')]+'%';_0x27c086[_0x50771e](_0xd411('0x67'),_0x496b7e,_0x496b7e,_0x496b7e);}}else{_0x397c2a=_['find'](_0x4e0b6f,[_0xd411('0x29'),_0xd411('0x68')]);_0x3e3230[_0xd411('0x44')]=_0xd411('0x68');_0x366288=as[_0xd411('0x69')](_0x463908,_0x397c2a[_0xd411('0x37')],_0x3e3230);_0x27c086[_0x50771e](_0x366288[_0xd411('0x6a')],_0x366288[_0xd411('0x66')][_0xd411('0x6b')],_0x366288[_0xd411('0x66')][_0xd411('0x1b')]);}break;case'Tag':var _0x326541=_0x3e3230[_0xd411('0x66')]['split'](',')[_0xd411('0x2b')](function(_0xdb4014){return Number(_0xdb4014);});_0x326541[_0xd411('0x30')](function(_0x1df7ec){_0x68b028['or'](_0xd411('0x6c'),'%,'+_0x1df7ec+',%');});_0x2eb0cd=_[_0xd411('0x6d')](_0x2eb0cd,_0x326541);break;case _0xd411('0x6e'):if(_0x3e3230[_0xd411('0x62')]===_0xd411('0x63')){_0x27c086[_0x50771e](_0xd411('0x6f'),'%'+_0x3e3230[_0xd411('0x66')]+'%',null);}else{_0x397c2a=_[_0xd411('0x5c')](_0x4e0b6f,[_0xd411('0x29'),_0xd411('0x70')]);_0x3e3230[_0xd411('0x44')]=_0xd411('0x70');_0x366288=as['buildExpression'](_0x463908,_0x397c2a[_0xd411('0x37')],_0x3e3230);_0x27c086[_0x50771e](_0x366288[_0xd411('0x6a')],_0x366288['value'][_0xd411('0x6b')],_0x366288[_0xd411('0x66')][_0xd411('0x1b')]);}break;case _0xd411('0x71'):_0x366288=as[_0xd411('0x69')]('me',null,_0x3e3230);_0x27c086[_0x50771e](_0x366288[_0xd411('0x6a')],_0x366288[_0xd411('0x66')]['start'],_0x366288['value'][_0xd411('0x1b')]);break;}}else{var _0x366288=as[_0xd411('0x69')](_0x463908,_0x397c2a['type'],_0x3e3230);_0x27c086[_0x50771e](_0x366288[_0xd411('0x6a')],_0x366288[_0xd411('0x66')]['start'],_0x366288[_0xd411('0x66')][_0xd411('0x1b')]);}}}else{var _0xbc6874=_(_0x4e81c0['query'])[_0xd411('0x72')]()[_0xd411('0x2b')](function(_0x5d686a){return _[_0xd411('0x73')](_0x4e0b6f,[_0xd411('0x29'),_0x5d686a])?_0x5d686a:undefined;})[_0xd411('0x74')]()['value']();if(!_[_0xd411('0x75')](_0xbc6874)){_0xbc6874[_0xd411('0x30')](function(_0x49cd60){if(_0x49cd60===_0xd411('0x76')){_0x7dbfd7[_0xd411('0x43')]('i.SmsAccountId\x20IN\x20?',[][_0xd411('0x77')](_0x4e81c0[_0xd411('0x3a')][_0x49cd60]));}else if(_0x49cd60===_0xd411('0x78')){var _0x227f96=JSON[_0xd411('0x79')](_0x4e81c0[_0xd411('0x3a')][_0x49cd60])[_0xd411('0x7a')];var _0x2a9405=JSON[_0xd411('0x79')](_0x4e81c0[_0xd411('0x3a')][_0x49cd60])[_0xd411('0x7b')];_0x7dbfd7['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x227f96,_0x2a9405);}else{if(_0x4e81c0[_0xd411('0x3a')][_0x49cd60]===_0xd411('0x7c')){_0x7dbfd7[_0xd411('0x43')]('i.'+_0x49cd60+_0xd411('0x7d'));}else{_0x7dbfd7[_0xd411('0x43')]('i.'+_0x49cd60+_0xd411('0x7e'),_0x4e81c0['query'][_0x49cd60]);}}});}if(_0x4e81c0['query']['read']){if(_0x4e81c0[_0xd411('0x3a')][_0xd411('0x7f')]==0x1){_0x7dbfd7[_0xd411('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x7dbfd7[_0xd411('0x5e')](_0xd411('0x80'));}}if(_0x4e81c0[_0xd411('0x3a')][_0xd411('0x81')]){_0x2eb0cd=_[_0xd411('0x82')](_0x4e81c0[_0xd411('0x3a')]['tag'])?_0x4e81c0[_0xd411('0x3a')][_0xd411('0x81')]:new Array(_0x4e81c0[_0xd411('0x3a')][_0xd411('0x81')]);_0x2eb0cd['forEach'](function(_0x24bbfc){_0x68b028['or'](_0xd411('0x6c'),'%,'+_0x24bbfc+',%');});}if(_0x4e81c0[_0xd411('0x3a')][_0xd411('0x83')]){var _0x469b2d=_0x4e81c0[_0xd411('0x3a')]['filter'][_0xd411('0x84')]('\x5c','\x5c\x5c')[_0xd411('0x84')](/'/g,'\x27\x27');if(qs[_0xd411('0x85')](_0x469b2d)){_0x27c086['or']('i.id\x20LIKE\x20?',_0x469b2d+'%')['or'](_0xd411('0x86'),_0x469b2d+'%');}else{_0x27c086['or'](_0xd411('0x87'),qs[_0xd411('0x65')](_0x469b2d))['or'](_0xd411('0x88'),_0x469b2d+'%');}}}_0x7dbfd7[_0xd411('0x43')](_0x27c086);_0x7dbfd7[_0xd411('0x89')](_0xd411('0x8a'));var _0x5cd24f={'type':db['Sequelize'][_0xd411('0x8b')][_0xd411('0x8c')],'raw':!![]};var _0x40d4db=_0x7dbfd7['clone']();_0x40d4db[_0xd411('0x44')](_0xd411('0x8a'));_0x40d4db[_0xd411('0x44')](_0xd411('0x8d'),_0xd411('0x5d'));if(_0x1c327b[_0xd411('0x41')]){_0x1c327b[_0xd411('0x41')][_0xd411('0x30')](function(_0x29cc95){var _0x5e4eb5=_0x29cc95[0x0]===_0xd411('0x8e')?_0x29cc95[0x0]:'i.'+_0x29cc95[0x0];_0x7dbfd7['order'](_0x5e4eb5,_0x29cc95[0x1]===_0xd411('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x2eb0cd)){_0x7dbfd7[_0xd411('0x5e')](_0x68b028);_0x40d4db['where']('t.id\x20IN\x20?',_0x2eb0cd);}BPromise['resolve']()[_0xd411('0x26')](function(){if(!_0x4a7855){if(_0x4e81c0[_0xd411('0x3a')][_0xd411('0x76')])return;_0x40d4db['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x7dbfd7[_0xd411('0x43')](_0xd411('0x90'));return;}if(_0x4e81c0[_0xd411('0x91')][_0xd411('0x92')]!==_0xd411('0x93'))return;return _0x4e81c0['user'][_0xd411('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3a8e66){if(_['isEmpty'](_0x3a8e66)){_0x40d4db[_0xd411('0x43')](_0xd411('0x95'));_0x7dbfd7[_0xd411('0x43')](_0xd411('0x95'));}else{_0x40d4db[_0xd411('0x43')]('i.SmsAccountId\x20IN\x20?',_[_0xd411('0x2b')](_0x3a8e66,'id'));_0x7dbfd7[_0xd411('0x43')](_0xd411('0x96'),_[_0xd411('0x2b')](_0x3a8e66,'id'));}});})[_0xd411('0x26')](function(){if(_0x4e81c0['user']['role']===_0xd411('0x93')&&!_0x4a7855&&!_0x4e81c0['query']['SmsAccountId'])return[];return db['sequelize'][_0xd411('0x3a')](_0x40d4db[_0xd411('0x97')](),_0x5cd24f);})[_0xd411('0x26')](function(_0xa6497e){_0x2aa437[_0xd411('0x1e')]=_0xa6497e[_0xd411('0x3f')];if(_0x2aa437['count']===0x0)return[];return db[_0xd411('0x98')][_0xd411('0x3a')](_0x5490f5[_0xd411('0x97')](),_0x5cd24f)['then'](function(_0x32f3bd){_0x3625f8=_[_0xd411('0x99')](_0x32f3bd,'id');_0x5cd24f=_[_0xd411('0x9a')](_0x5cd24f,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4e81c0[_0xd411('0x3a')]['fields']){_0x1c327b[_0xd411('0x3d')][_0xd411('0x30')](function(_0x4d9272){_0x7dbfd7[_0xd411('0x44')]('i.'+_0x4d9272);});}else{_0x7dbfd7[_0xd411('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd411('0x5d'));_0x7dbfd7[_0xd411('0x44')](_0xd411('0x9b'),_0xd411('0x9c'));_0x7dbfd7[_0xd411('0x44')](_0xd411('0x9d'),'Account.mandatoryDisposition');_0x7dbfd7['field'](_0xd411('0x9e'),_0xd411('0x8e'));_0x7dbfd7['field'](_0xd411('0x9f'));_0x7dbfd7[_0xd411('0x44')](_0xd411('0xa0'),_0xd411('0xa1'));_0x7dbfd7['field'](_0xd411('0xa2'),_0xd411('0xa3'));_0x7dbfd7[_0xd411('0x44')]('c.email',_0xd411('0xa4'));_0x7dbfd7[_0xd411('0x44')](_0xd411('0xa5'),_0xd411('0xa6'));_0x7dbfd7[_0xd411('0x44')](_0xd411('0xa7'),'Contact.mobile');_0x7dbfd7[_0xd411('0x44')](_0xd411('0xa8'),_0xd411('0xa9'));_0x7dbfd7[_0xd411('0x44')]('o.fullname','Owner.fullname');_0x7dbfd7['field']('o.internal','Owner.internal');_0x7dbfd7[_0xd411('0x44')](_0xd411('0xaa'),_0xd411('0x2e'));}if(_0x1c327b[_0xd411('0x1f')])_0x7dbfd7[_0xd411('0x1f')](_0x1c327b[_0xd411('0x1f')]);if(_0x1c327b['offset'])_0x7dbfd7[_0xd411('0x1c')](_0x1c327b[_0xd411('0x1c')]);return db[_0xd411('0x98')][_0xd411('0x3a')](_0x7dbfd7[_0xd411('0x97')](),_0x5cd24f);})[_0xd411('0x26')](function(_0x59b977){if(_0x59b977['length']>0x0)_0x4ae211[_0xd411('0x43')]('ui.SmsInteractionId\x20IN\x20?',_['map'](_0x59b977,'id'));return db[_0xd411('0x98')][_0xd411('0x3a')](_0x4ae211[_0xd411('0x97')](),_0x5cd24f)[_0xd411('0x26')](function(_0x1d9f06){var _0x330a09=_[_0xd411('0xab')](_0x1d9f06,_0xd411('0xac'));var _0x1e9d77=[];_0x59b977['forEach'](function(_0x4c63e1){_0x1e9d77[_0xd411('0x31')](updateSmsInteraction(_0x4c63e1,_0x3625f8,_0x330a09));});return BPromise[_0xd411('0xad')](_0x1e9d77);});});})[_0xd411('0x26')](function(_0x523527){_0x2aa437['rows']=_0x523527;return _0x2aa437;})[_0xd411('0x26')](respondWithFilteredResult(_0x5dbc90,_0x1c327b))[_0xd411('0x32')](handleError(_0x5dbc90,null));};exports[_0xd411('0xae')]=function(_0x5c0404,_0x37eebc){var _0x3b24b5={'raw':![],'where':{'id':_0x5c0404[_0xd411('0xaf')]['id']}},_0x49bcd4={};_0x49bcd4[_0xd411('0x39')]=_[_0xd411('0x72')](db[_0xd411('0x34')]['rawAttributes']);_0x49bcd4[_0xd411('0x3a')]=_[_0xd411('0x72')](_0x5c0404[_0xd411('0x3a')]);_0x49bcd4[_0xd411('0x3b')]=_[_0xd411('0x3c')](_0x49bcd4[_0xd411('0x39')],_0x49bcd4[_0xd411('0x3a')]);_0x3b24b5[_0xd411('0x3d')]=_[_0xd411('0x3c')](_0x49bcd4[_0xd411('0x39')],qs['fields'](_0x5c0404[_0xd411('0x3a')][_0xd411('0x3e')]));_0x3b24b5[_0xd411('0x3d')]=_0x3b24b5[_0xd411('0x3d')][_0xd411('0x3f')]?_0x3b24b5['attributes']:_0x49bcd4[_0xd411('0x39')];if(_0x5c0404[_0xd411('0x3a')][_0xd411('0xb0')]){_0x3b24b5['include']=[{'all':!![]}];}_0x3b24b5=_['merge']({},_0x3b24b5,_0x5c0404[_0xd411('0xb1')]);return db[_0xd411('0x34')][_0xd411('0x5c')](_0x3b24b5)[_0xd411('0x26')](handleEntityNotFound(_0x37eebc,null))[_0xd411('0x26')](respondWithResult(_0x37eebc,null))[_0xd411('0x32')](handleError(_0x37eebc,null));};exports['create']=function(_0x59ac2a,_0x326866){return db[_0xd411('0x34')][_0xd411('0xb2')](_0x59ac2a[_0xd411('0x71')],{})['then'](respondWithResult(_0x326866,0xc9))[_0xd411('0x32')](handleError(_0x326866,null));};exports['update']=function(_0x417352,_0x18f6b0){if(_0x417352[_0xd411('0x71')]['id']){delete _0x417352[_0xd411('0x71')]['id'];}return db[_0xd411('0x34')][_0xd411('0x5c')]({'where':{'id':_0x417352['params']['id']}})[_0xd411('0x26')](handleEntityNotFound(_0x18f6b0,null))[_0xd411('0x26')](saveUpdates(_0x417352[_0xd411('0x71')],null))[_0xd411('0x26')](respondWithResult(_0x18f6b0,null))[_0xd411('0x32')](handleError(_0x18f6b0,null));};exports[_0xd411('0x27')]=function(_0xc2daf8,_0x2fd2c2){return db['SmsInteraction'][_0xd411('0x5c')]({'where':{'id':_0xc2daf8['params']['id']}})[_0xd411('0x26')](handleEntityNotFound(_0x2fd2c2,null))[_0xd411('0x26')](removeEntity(_0x2fd2c2,null))[_0xd411('0x32')](handleError(_0x2fd2c2,null));};exports[_0xd411('0xb3')]=function(_0x11c6e7,_0x4ca3c9){return db[_0xd411('0x34')][_0xd411('0xb3')]()[_0xd411('0x26')](respondWithResult(_0x4ca3c9,null))[_0xd411('0x32')](handleError(_0x4ca3c9,null));};exports[_0xd411('0xb4')]=function(_0x4b0e69,_0x505a05,_0x44175b){return db[_0xd411('0xb5')][_0xd411('0x5c')]({'where':{'id':_0x4b0e69[_0xd411('0xaf')]['id']}})[_0xd411('0x26')](handleEntityNotFound(_0x505a05,null))[_0xd411('0x26')](function(_0x2ab0b9){if(_0x2ab0b9){return _0x2ab0b9[_0xd411('0xb4')](_0x4b0e69[_0xd411('0x71')]['ids'],_[_0xd411('0xb6')](_0x4b0e69[_0xd411('0x71')],[_0xd411('0xb7'),'id'])||{});}})[_0xd411('0x26')](respondWithResult(_0x505a05,null))[_0xd411('0x32')](handleError(_0x505a05,null));};exports[_0xd411('0xb8')]=function(_0x446b37,_0xdb3e77,_0x3a7d76){var _0x4b881f={'raw':![],'where':{}};var _0x4cbd1f={};var _0x18976b={'count':0x0,'rows':[]};return db[_0xd411('0x34')][_0xd411('0xb9')]({'where':{'id':_0x446b37[_0xd411('0xaf')]['id']}})['then'](handleEntityNotFound(_0xdb3e77,null))[_0xd411('0x26')](function(_0x11421d){if(_0x11421d){_0x4cbd1f[_0xd411('0x39')]=_[_0xd411('0x72')](db[_0xd411('0xb5')][_0xd411('0x35')]);_0x4cbd1f[_0xd411('0x3a')]=_[_0xd411('0x72')](_0x446b37['query']);_0x4cbd1f[_0xd411('0x3b')]=_[_0xd411('0x3c')](_0x4cbd1f[_0xd411('0x39')],_0x4cbd1f['query']);_0x4b881f['attributes']=_[_0xd411('0x3c')](_0x4cbd1f[_0xd411('0x39')],qs[_0xd411('0x3e')](_0x446b37[_0xd411('0x3a')]['fields']));_0x4b881f['attributes']=_0x4b881f[_0xd411('0x3d')]['length']?_0x4b881f[_0xd411('0x3d')]:_0x4cbd1f['model'];if(!_0x446b37[_0xd411('0x3a')][_0xd411('0xba')](_0xd411('0x40'))){_0x4b881f[_0xd411('0x1f')]=qs[_0xd411('0x1f')](_0x446b37['query'][_0xd411('0x1f')]);_0x4b881f[_0xd411('0x1c')]=qs[_0xd411('0x1c')](_0x446b37[_0xd411('0x3a')][_0xd411('0x1c')]);}_0x4b881f[_0xd411('0x41')]=qs['sort'](_0x446b37[_0xd411('0x3a')][_0xd411('0x42')]);_0x4b881f[_0xd411('0x43')]=qs[_0xd411('0x3b')](_[_0xd411('0xbb')](_0x446b37[_0xd411('0x3a')],_0x4cbd1f[_0xd411('0x3b')]));_0x4b881f['where']['SmsInteractionId']=_0x11421d['id'];if(_0x446b37[_0xd411('0x3a')]['filter']){_0x4b881f[_0xd411('0x43')]=_['merge'](_0x4b881f[_0xd411('0x43')],{'$or':_['map'](_0x4b881f[_0xd411('0x3d')],function(_0x102864){var _0x46c540={};_0x46c540[_0x102864]={'$like':'%'+_0x446b37[_0xd411('0x3a')][_0xd411('0x83')]+'%'};return _0x46c540;})});}if(_0x446b37[_0xd411('0x3a')]['$gte']){var _0x2f9b0c=_0x446b37[_0xd411('0x3a')]['$gte'][_0xd411('0x2f')](',');var _0x73d927={};_0x73d927[_0x2f9b0c[0x0]]={'$gte':moment(_0x2f9b0c[0x1])['format'](_0xd411('0xbc'))};_0x4b881f[_0xd411('0x43')]=_[_0xd411('0x9a')](_0x4b881f[_0xd411('0x43')],_0x73d927);}_0x4b881f=_['merge']({},_0x4b881f,_0x446b37[_0xd411('0xb1')]);return db[_0xd411('0xb5')][_0xd411('0x1e')]({'where':_0x4b881f[_0xd411('0x43')]})[_0xd411('0x26')](function(_0x239888){_0x18976b[_0xd411('0x1e')]=_0x239888;if(_0x446b37[_0xd411('0x3a')][_0xd411('0xb0')]){_0x4b881f[_0xd411('0xbd')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x4b881f);})['then'](function(_0x43fc7c){_0x18976b['rows']=_0x43fc7c;return _0x18976b;});}})[_0xd411('0x26')](respondWithFilteredResult(_0xdb3e77,_0x4b881f))['catch'](handleError(_0xdb3e77,null));};exports[_0xd411('0xbe')]=function(_0x524b52,_0x54e4d4,_0x42a8a9){return db[_0xd411('0x34')]['find']({'where':{'id':_0x524b52[_0xd411('0xaf')]['id']}})[_0xd411('0x26')](handleEntityNotFound(_0x54e4d4,null))[_0xd411('0x26')](function(_0x25ae8d){if(_0x25ae8d){return _0x25ae8d[_0xd411('0xbf')](_0x524b52[_0xd411('0x71')]['ids'],_[_0xd411('0xb6')](_0x524b52['body'],[_0xd411('0xb7'),'id'])||{})['spread'](function(){return db[_0xd411('0xc0')][_0xd411('0xc1')]({'attributes':['id',_0xd411('0x29'),_0xd411('0x45')],'where':{'id':_0x524b52[_0xd411('0x71')][_0xd411('0xb7')]}});})[_0xd411('0x26')](function(_0x317c32){socket[_0xd411('0xc2')](_0xd411('0xc3'),{'id':Number(_0x524b52[_0xd411('0xaf')]['id']),'tags':_0x317c32||[]});return{'id':Number(_0x524b52[_0xd411('0xaf')]['id']),'tags':_0x317c32||[]};});}})[_0xd411('0x26')](respondWithResult(_0x54e4d4,null))[_0xd411('0x32')](handleError(_0x54e4d4,null));};exports[_0xd411('0xc4')]=function(_0x5059a6,_0x2a2db9,_0x5564e1){return db[_0xd411('0x34')][_0xd411('0x5c')]({'where':{'id':_0x5059a6[_0xd411('0xaf')]['id']}})['then'](handleEntityNotFound(_0x2a2db9,null))[_0xd411('0x26')](function(_0x5f4615){if(_0x5f4615){return _0x5f4615[_0xd411('0xc4')](_0x5059a6[_0xd411('0x3a')]['ids']);}})[_0xd411('0x26')](respondWithStatusCode(_0x2a2db9,null))[_0xd411('0x32')](handleError(_0x2a2db9,null));};exports[_0xd411('0xc5')]=function(_0x491ff4,_0x19246b){var _0xee4397=moment()[_0xd411('0xc6')]()[_0xd411('0x97')]();var _0x4aac4c=path[_0xd411('0xc7')](config[_0xd411('0xc8')],_0xd411('0xc9'),_0xd411('0xca'),_0xd411('0xcb'));var _0x233007=path[_0xd411('0xc7')](config[_0xd411('0xc8')],_0xd411('0xc9'),_0xd411('0xca'),_0xd411('0xcc'));var _0x370581=path[_0xd411('0xc7')](_0x4aac4c,_0xee4397);var _0x268ffd=util[_0xd411('0xcd')](_0xd411('0xce'),_0x491ff4['params']['id'],_0xee4397);var _0x2b2ad0=path[_0xd411('0xc7')](_0x4aac4c,_0x268ffd);var _0x2aeb96=[];_0x2aeb96['push']({'model':db[_0xd411('0x6e')],'as':_0xd411('0x6e'),'attributes':['id',_0xd411('0x2c')],'raw':!![]});_0x2aeb96[_0xd411('0x31')]({'model':db[_0xd411('0xcf')],'as':_0xd411('0x61'),'attributes':['id',_0xd411('0xd0'),_0xd411('0xd1')],'raw':!![]});var _0x33b5bf=[{'model':db[_0xd411('0xb5')],'as':'Messages','attributes':['id',_0xd411('0x71'),'createdAt',_0xd411('0xd2'),_0xd411('0xd3'),_0xd411('0x7f')],'include':_0x2aeb96}];_0x33b5bf[_0xd411('0x31')]({'model':db['SmsAccount'],'as':_0xd411('0xd4'),'attributes':['id',_0xd411('0x29')]});_0x33b5bf[_0xd411('0x31')]({'model':db[_0xd411('0x6e')],'as':'Owner','attributes':['id',_0xd411('0x2c')]});return db['SmsInteraction'][_0xd411('0x5c')]({'where':{'id':_0x491ff4[_0xd411('0xaf')]['id']},'include':_0x33b5bf})[_0xd411('0x26')](handleEntityNotFound(_0x19246b,null))[_0xd411('0x26')](function(_0x5192cc){if(_0x5192cc){var _0x4f9976=_0x5192cc['get']({'plain':!![]});fs[_0xd411('0xd5')](_0x370581);var _0x3bf90a={'channel':_0xd411('0xd6'),'account':_0x4f9976[_0xd411('0xd4')][_0xd411('0x29')],'agent':_0x4f9976[_0xd411('0xd7')]?_0x4f9976[_0xd411('0xd7')][_0xd411('0x2c')]:_0xd411('0xd8'),'createdAt':moment(_0x4f9976[_0xd411('0x78')])[_0xd411('0xcd')](_0xd411('0xbc'))[_0xd411('0x97')](),'closedAt':_0x4f9976[_0xd411('0xd9')]?moment(_0x4f9976[_0xd411('0xda')])[_0xd411('0xcd')](_0xd411('0xbc'))[_0xd411('0x97')]():'','disposition':_0x4f9976['disposition'],'messages':_(_0x4f9976[_0xd411('0xdb')])[_0xd411('0x83')]({'secret':![]})['map'](function(_0x74978b){return{'date':moment(_0x74978b[_0xd411('0x78')])[_0xd411('0xcd')](_0xd411('0xbc'))['toString'](),'sender':_0x74978b['direction']===_0xd411('0xdc')?_0x74978b[_0xd411('0x6e')]?_0x74978b[_0xd411('0x6e')][_0xd411('0x2c')]:_0xd411('0xdd'):_0x74978b[_0xd411('0x61')][_0xd411('0xd0')]+(_0x74978b[_0xd411('0x61')][_0xd411('0xd1')]?'\x20'+_0x74978b[_0xd411('0x61')]['lastName']:''),'body':_0x74978b[_0xd411('0x71')],'direction':_0x74978b[_0xd411('0xd2')]==='out'?'A':'C','secret':_0x74978b[_0xd411('0xd3')],'read':_0x74978b[_0xd411('0x7f')]};})[_0xd411('0x66')]()};return ejs[_0xd411('0xde')](path[_0xd411('0xc7')](config[_0xd411('0xc8')],_0xd411('0xc9'),'views',_0xd411('0xdf')),{'interaction':_0x3bf90a})[_0xd411('0x26')](function(_0x427be1){var _0x41d7ad=path[_0xd411('0xc7')](_0x370581,_0xd411('0xe0')+_0x4f9976['id']+'-'+_0xee4397+_0xd411('0xe1'));var _0x493224={'path':_0x41d7ad,'channel':_0xd411('0xd6'),'interactionId':_0x4f9976['id']};return pdf[_0xd411('0xe2')](_0x427be1,_0x493224);})[_0xd411('0x26')](function(){return new BPromise(function(_0xd93a15,_0x48a91d){zipdir(_0x370581,{'saveTo':_0x2b2ad0},function(_0x330f08,_0x12120c){if(_0x330f08)return _0x48a91d(_0x330f08);return _0xd93a15(_0x12120c);});})[_0xd411('0x26')](function(){return new BPromise(function(_0x31eee0,_0x4b5d61){rimraf(_0x370581,function(_0x3b400f){if(_0x3b400f)_0x4b5d61(_0x3b400f);return _0x31eee0();});});})[_0xd411('0x26')](function(){return _0x19246b['download'](_0x2b2ad0,_0x268ffd,function(_0x3ccb2e){if(_0x3ccb2e){console[_0xd411('0xe3')](_0xd411('0xe4'),_0x3ccb2e);}else{fs['unlinkSync'](_0x2b2ad0);}});});});}else{return _0x19246b[_0xd411('0x19')](0xc8);}})['catch'](handleError(_0x19246b,null));}; \ No newline at end of file +var _0xfdca=['reject','save','update','destroy','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','then','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','select','field','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','users','sms_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','push','all','rows','show','params','includeAll','include','merge','SmsInteraction','create','body','describe','addMessage','SmsMessage','ids','omit','nolimit','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','findAll','color','emit','smsInteractionTags:save','removeTags','download','join','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','closedAt','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','apply'];(function(_0x1eeb8a,_0x46868c){var _0x72b600=function(_0x7a475){while(--_0x7a475){_0x1eeb8a['push'](_0x1eeb8a['shift']());}};_0x72b600(++_0x46868c);}(_0xfdca,0x1a6));var _0xafdc=function(_0x5382f1,_0x317faf){_0x5382f1=_0x5382f1-0x0;var _0x2d006d=_0xfdca[_0x5382f1];return _0x2d006d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xafdc('0x0'));var rp=require(_0xafdc('0x1'));var moment=require(_0xafdc('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xafdc('0x3'));var util=require(_0xafdc('0x4'));var path=require(_0xafdc('0x5'));var sox=require(_0xafdc('0x6'));var csv=require(_0xafdc('0x7'));var ejs=require(_0xafdc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xafdc('0x9'));var squel=require('squel');var crypto=require(_0xafdc('0xa'));var jsforce=require(_0xafdc('0xb'));var deskjs=require(_0xafdc('0xc'));var toCsv=require(_0xafdc('0x7'));var querystring=require(_0xafdc('0xd'));var Papa=require(_0xafdc('0xe'));var Redis=require(_0xafdc('0xf'));var authService=require(_0xafdc('0x10'));var qs=require(_0xafdc('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0xafdc('0x12'));var logger=require(_0xafdc('0x13'))('api');var utils=require(_0xafdc('0x14'));var config=require(_0xafdc('0x15'));var licenseUtil=require(_0xafdc('0x16'));var db=require(_0xafdc('0x17'))['db'];config[_0xafdc('0x18')]=_[_0xafdc('0x19')](config[_0xafdc('0x18')],{'host':_0xafdc('0x1a'),'port':0x18eb});var socket=require(_0xafdc('0x1b'))(new Redis(config[_0xafdc('0x18')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4a98dc,_0x33d886){_0x33d886=_0x33d886||0xcc;return function(_0x27a024){if(_0x27a024){return _0x4a98dc[_0xafdc('0x1c')](_0x33d886);}return _0x4a98dc[_0xafdc('0x1d')](_0x33d886)['end']();};}function respondWithResult(_0x5b5c57,_0x241c79){_0x241c79=_0x241c79||0xc8;return function(_0x88eeb3){if(_0x88eeb3){return _0x5b5c57[_0xafdc('0x1d')](_0x241c79)[_0xafdc('0x1e')](_0x88eeb3);}};}function respondWithFilteredResult(_0x37ae92,_0x3a4f6f){return function(_0x350c63){if(_0x350c63){var _0x518003=typeof _0x3a4f6f[_0xafdc('0x1f')]===_0xafdc('0x20')&&typeof _0x3a4f6f[_0xafdc('0x21')]===_0xafdc('0x20');var _0x49af85=_0x350c63[_0xafdc('0x22')];var _0x5092ae=_0x518003?0x0:_0x3a4f6f[_0xafdc('0x1f')];var _0x335dcb=_0x518003?_0x350c63[_0xafdc('0x22')]:_0x3a4f6f['offset']+_0x3a4f6f['limit'];var _0x129377;if(_0x335dcb>=_0x49af85){_0x335dcb=_0x49af85;_0x129377=0xc8;}else{_0x129377=0xce;}_0x37ae92[_0xafdc('0x1d')](_0x129377);return _0x37ae92['set']('Content-Range',_0x5092ae+'-'+_0x335dcb+'/'+_0x49af85)[_0xafdc('0x1e')](_0x350c63);}return null;};}function patchUpdates(_0x3fcdca){return function(_0x36b065){try{jsonpatch[_0xafdc('0x23')](_0x36b065,_0x3fcdca,!![]);}catch(_0x254748){return BPromise[_0xafdc('0x24')](_0x254748);}return _0x36b065[_0xafdc('0x25')]();};}function saveUpdates(_0x4fcf19,_0x35fe5c){return function(_0x4215a2){if(_0x4215a2){return _0x4215a2[_0xafdc('0x26')](_0x4fcf19)['then'](function(_0x4b140f){return _0x4b140f;});}return null;};}function removeEntity(_0x2b8c16,_0x1c6af9){return function(_0x7284e0){if(_0x7284e0){return _0x7284e0[_0xafdc('0x27')]()['then'](function(){_0x2b8c16[_0xafdc('0x1d')](0xcc)[_0xafdc('0x28')]();});}};}function handleEntityNotFound(_0x17b5bf,_0x31be53){return function(_0x257559){if(!_0x257559){_0x17b5bf[_0xafdc('0x1c')](0x194);}return _0x257559;};}function handleError(_0x368d86,_0x4bd970){_0x4bd970=_0x4bd970||0x1f4;return function(_0x18378c){logger[_0xafdc('0x29')](_0x18378c[_0xafdc('0x2a')]);if(_0x18378c['name']){delete _0x18378c[_0xafdc('0x2b')];}_0x368d86[_0xafdc('0x1d')](_0x4bd970)[_0xafdc('0x2c')](_0x18378c);};}function getInteractionUsers(_0x55a252,_0x2e74ec){return new BPromise(function(_0x5b1f27,_0x4fd1aa){try{if(_0x2e74ec[_0x55a252['id']]){_0x55a252[_0xafdc('0x2d')]=_[_0xafdc('0x2e')](_0x2e74ec[_0x55a252['id']],function(_0x3a94f2){return{'id':_0x3a94f2['id'],'fullname':_0x3a94f2[_0xafdc('0x2f')]};});}}catch(_0x4599ed){_0x4fd1aa(_0x4599ed);}_0x5b1f27(_0x55a252);});}function getInteractionTags(_0x12a201,_0x237a7b){return new BPromise(function(_0x4c3f19,_0x43839d){try{if(_0x12a201[_0xafdc('0x30')]){_0x12a201[_0xafdc('0x31')]=[];_0x12a201[_0xafdc('0x30')][_0xafdc('0x32')](',')['forEach'](function(_0xc83bda){_0x12a201[_0xafdc('0x31')]['push'](_0x237a7b[_0xc83bda]);});}delete _0x12a201[_0xafdc('0x30')];}catch(_0x126ac2){_0x43839d(_0x126ac2);}_0x4c3f19(_0x12a201);});}function updateSmsInteraction(_0x1ba0c0,_0x43a3ca,_0x3e7629){return new BPromise(function(_0x131fcc,_0xe5198a){return getInteractionUsers(_0x1ba0c0,_0x3e7629)[_0xafdc('0x33')](function(_0x19d7e7){return getInteractionTags(_0x19d7e7,_0x43a3ca);})[_0xafdc('0x33')](function(_0x5d672e){_0x131fcc(_0x5d672e);})[_0xafdc('0x34')](function(_0x10c9b0){_0xe5198a(_0x10c9b0);});});}exports[_0xafdc('0x35')]=function(_0xd8bedb,_0x5450cf){var _0x5f416c={},_0x17c1d0={},_0x451f8f={'count':0x0,'rows':[]};var _0x399d47=_[_0xafdc('0x2e')](db['SmsInteraction'][_0xafdc('0x36')],function(_0x54f117){return{'name':_0x54f117[_0xafdc('0x37')],'type':_0x54f117[_0xafdc('0x38')][_0xafdc('0x39')]};});_0x17c1d0[_0xafdc('0x3a')]=_['map'](_0x399d47,_0xafdc('0x2b'));_0x17c1d0[_0xafdc('0x3b')]=_[_0xafdc('0x3c')](_0xd8bedb[_0xafdc('0x3b')]);_0x17c1d0['filters']=_[_0xafdc('0x3d')](_0x17c1d0['model'],_0x17c1d0[_0xafdc('0x3b')]);_0x5f416c[_0xafdc('0x3e')]=_[_0xafdc('0x3d')](_0x17c1d0[_0xafdc('0x3a')],qs['fields'](_0xd8bedb[_0xafdc('0x3b')][_0xafdc('0x3f')]));_0x5f416c[_0xafdc('0x3e')]=_0x5f416c['attributes'][_0xafdc('0x40')]?_0x5f416c['attributes']:_0x17c1d0['model'];if(!_0xd8bedb['query'][_0xafdc('0x41')]('nolimit')){_0x5f416c[_0xafdc('0x21')]=qs[_0xafdc('0x21')](_0xd8bedb['query'][_0xafdc('0x21')]);_0x5f416c['offset']=qs[_0xafdc('0x1f')](_0xd8bedb[_0xafdc('0x3b')][_0xafdc('0x1f')]);}_0x5f416c['order']=qs[_0xafdc('0x42')](_0xd8bedb['query'][_0xafdc('0x42')]);_0x5f416c['where']=qs['filters'](_[_0xafdc('0x43')](_0xd8bedb[_0xafdc('0x3b')],_0x17c1d0[_0xafdc('0x44')]),_0x399d47);var _0x4da9ef=[];var _0x396253=squel[_0xafdc('0x45')]()[_0xafdc('0x46')]('id')[_0xafdc('0x46')](_0xafdc('0x2b'))[_0xafdc('0x46')]('color')[_0xafdc('0x47')](_0xafdc('0x48'));var _0x36a800=squel[_0xafdc('0x45')]()[_0xafdc('0x46')](_0xafdc('0x49'))['field'](_0xafdc('0x4a'))[_0xafdc('0x46')]('ui.SmsInteractionId')[_0xafdc('0x47')](_0xafdc('0x4b'),'ui')['left_join'](_0xafdc('0x4c'),'u','u.id\x20=\x20ui.UserId');var _0x10fbb7=squel['select']()[_0xafdc('0x47')](_0xafdc('0x4d'),'i')[_0xafdc('0x4e')](_0xafdc('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xafdc('0x4e')](_0xafdc('0x4c'),'o',_0xafdc('0x50'))[_0xafdc('0x4e')]('sms_accounts','a',_0xafdc('0x51'))['left_join']('sms_messages','me',_0xafdc('0x52'))[_0xafdc('0x4e')](_0xafdc('0x53'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xafdc('0x4e')](_0xafdc('0x48'),'t',_0xafdc('0x54'));var _0x594b36=squel[_0xafdc('0x55')]();var _0x23f553=[];var _0x5bd44c=squel[_0xafdc('0x55')]();var _0x32d9ed;if(_0xd8bedb[_0xafdc('0x3b')][_0xafdc('0x56')]){_0x32d9ed=as[_0xafdc('0x57')](_0xd8bedb[_0xafdc('0x3b')][_0xafdc('0x56')]);var _0x2da41e=_0x32d9ed[_0xafdc('0x58')];for(var _0x222e71=0x0;_0x222e71<_0x32d9ed[_0xafdc('0x59')][_0xafdc('0x40')];_0x222e71++){var _0x52956c=_0x32d9ed[_0xafdc('0x59')][_0x222e71];var _0x42a48c='i';var _0x301bd7=_['find'](_0x399d47,[_0xafdc('0x2b'),_0x52956c[_0xafdc('0x46')]]);if(!_0x301bd7){switch(_0x52956c[_0xafdc('0x46')]){case _0xafdc('0x5a'):if(_0x52956c[_0xafdc('0x5b')]==0x1){_0x10fbb7['having']('`'+_0x52956c[_0xafdc('0x46')]+'`\x20=\x200');}else{_0x10fbb7[_0xafdc('0x5c')]('`'+_0x52956c[_0xafdc('0x46')]+_0xafdc('0x5d'));}break;case _0xafdc('0x5e'):if(_0x52956c[_0xafdc('0x5f')]===_0xafdc('0x60')){if(_0x52956c['value']['split']('\x20')[_0xafdc('0x40')]>0x1){_0x594b36[_0x2da41e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xafdc('0x61')](_0x52956c[_0xafdc('0x5b')]),null);}else{var _0x5ae3e6='%'+_0x52956c[_0xafdc('0x5b')]+'%';_0x594b36[_0x2da41e](_0xafdc('0x62'),_0x5ae3e6,_0x5ae3e6,_0x5ae3e6);}}else{_0x301bd7=_[_0xafdc('0x63')](_0x399d47,[_0xafdc('0x2b'),'ContactId']);_0x52956c[_0xafdc('0x46')]=_0xafdc('0x64');_0x2e94b0=as[_0xafdc('0x65')](_0x42a48c,_0x301bd7[_0xafdc('0x38')],_0x52956c);_0x594b36[_0x2da41e](_0x2e94b0[_0xafdc('0x66')],_0x2e94b0[_0xafdc('0x5b')]['start'],_0x2e94b0['value'][_0xafdc('0x28')]);}break;case _0xafdc('0x67'):var _0x47637c=_0x52956c['value'][_0xafdc('0x32')](',')['map'](function(_0x5d3ce1){return Number(_0x5d3ce1);});_0x47637c[_0xafdc('0x68')](function(_0xf608cb){_0x5bd44c['or'](_0xafdc('0x69'),'%,'+_0xf608cb+',%');});_0x23f553=_[_0xafdc('0x6a')](_0x23f553,_0x47637c);break;case _0xafdc('0x6b'):if(_0x52956c[_0xafdc('0x5f')]==='$substring'){_0x594b36[_0x2da41e](_0xafdc('0x6c'),'%'+_0x52956c[_0xafdc('0x5b')]+'%',null);}else{_0x301bd7=_[_0xafdc('0x63')](_0x399d47,['name',_0xafdc('0x6d')]);_0x52956c[_0xafdc('0x46')]='UserId';_0x2e94b0=as[_0xafdc('0x65')](_0x42a48c,_0x301bd7[_0xafdc('0x38')],_0x52956c);_0x594b36[_0x2da41e](_0x2e94b0['text'],_0x2e94b0[_0xafdc('0x5b')][_0xafdc('0x6e')],_0x2e94b0[_0xafdc('0x5b')]['end']);}break;case'body':_0x2e94b0=as[_0xafdc('0x65')]('me',null,_0x52956c);_0x594b36[_0x2da41e](_0x2e94b0[_0xafdc('0x66')],_0x2e94b0[_0xafdc('0x5b')]['start'],_0x2e94b0['value']['end']);break;}}else{var _0x2e94b0=as['buildExpression'](_0x42a48c,_0x301bd7[_0xafdc('0x38')],_0x52956c);_0x594b36[_0x2da41e](_0x2e94b0[_0xafdc('0x66')],_0x2e94b0['value'][_0xafdc('0x6e')],_0x2e94b0[_0xafdc('0x5b')][_0xafdc('0x28')]);}}}else{var _0x43a655=_(_0xd8bedb[_0xafdc('0x3b')])[_0xafdc('0x3c')]()[_0xafdc('0x2e')](function(_0x4a0369){return _[_0xafdc('0x6f')](_0x399d47,[_0xafdc('0x2b'),_0x4a0369])?_0x4a0369:undefined;})[_0xafdc('0x70')]()[_0xafdc('0x5b')]();if(!_[_0xafdc('0x71')](_0x43a655)){_0x43a655[_0xafdc('0x68')](function(_0x125c79){if(_0x125c79===_0xafdc('0x72')){_0x10fbb7['where'](_0xafdc('0x73'),[]['concat'](_0xd8bedb[_0xafdc('0x3b')][_0x125c79]));}else if(_0x125c79===_0xafdc('0x74')){var _0x436ef9=JSON[_0xafdc('0x75')](_0xd8bedb[_0xafdc('0x3b')][_0x125c79])[_0xafdc('0x76')];var _0x41486c=JSON[_0xafdc('0x75')](_0xd8bedb[_0xafdc('0x3b')][_0x125c79])[_0xafdc('0x77')];_0x10fbb7[_0xafdc('0x78')](_0xafdc('0x79'),_0x436ef9,_0x41486c);}else{if(_0xd8bedb['query'][_0x125c79]===_0xafdc('0x7a')){_0x10fbb7[_0xafdc('0x78')]('i.'+_0x125c79+'\x20IS\x20NULL');}else{_0x10fbb7[_0xafdc('0x78')]('i.'+_0x125c79+_0xafdc('0x7b'),_0xd8bedb[_0xafdc('0x3b')][_0x125c79]);}}});}if(_0xd8bedb[_0xafdc('0x3b')][_0xafdc('0x7c')]){if(_0xd8bedb[_0xafdc('0x3b')][_0xafdc('0x7c')]==0x1){_0x10fbb7[_0xafdc('0x5c')]('`unreadMessages`\x20=\x200');}else{_0x10fbb7[_0xafdc('0x5c')](_0xafdc('0x7d'));}}if(_0xd8bedb[_0xafdc('0x3b')][_0xafdc('0x7e')]){_0x23f553=_[_0xafdc('0x7f')](_0xd8bedb[_0xafdc('0x3b')]['tag'])?_0xd8bedb[_0xafdc('0x3b')][_0xafdc('0x7e')]:new Array(_0xd8bedb[_0xafdc('0x3b')][_0xafdc('0x7e')]);_0x23f553[_0xafdc('0x68')](function(_0x4a883a){_0x5bd44c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4a883a+',%');});}if(_0xd8bedb[_0xafdc('0x3b')]['filter']){var _0x2d88c3=_0xd8bedb[_0xafdc('0x3b')][_0xafdc('0x80')][_0xafdc('0x81')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xafdc('0x82')](_0x2d88c3)){_0x594b36['or']('i.id\x20LIKE\x20?',_0x2d88c3+'%')['or'](_0xafdc('0x83'),_0x2d88c3+'%');}else{_0x594b36['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xafdc('0x61')](_0x2d88c3))['or'](_0xafdc('0x84'),_0x2d88c3+'%');}}}_0x10fbb7['where'](_0x594b36);_0x10fbb7['group'](_0xafdc('0x85'));var _0x2a5eb4={'type':db[_0xafdc('0x86')][_0xafdc('0x87')][_0xafdc('0x88')],'raw':!![]};var _0x4c58b1=_0x10fbb7[_0xafdc('0x89')]();_0x4c58b1[_0xafdc('0x46')](_0xafdc('0x85'));_0x4c58b1['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xafdc('0x5a'));if(_0x5f416c[_0xafdc('0x8a')]){_0x5f416c[_0xafdc('0x8a')][_0xafdc('0x68')](function(_0x305840){var _0x356435=_0x305840[0x0]==='contactName'?_0x305840[0x0]:'i.'+_0x305840[0x0];_0x10fbb7[_0xafdc('0x8a')](_0x356435,_0x305840[0x1]===_0xafdc('0x8b')?![]:!![]);});}if(!_['isEmpty'](_0x23f553)){_0x10fbb7[_0xafdc('0x5c')](_0x5bd44c);_0x4c58b1[_0xafdc('0x78')](_0xafdc('0x8c'),_0x23f553);}BPromise[_0xafdc('0x8d')]()['then'](function(){if(!_0x32d9ed){if(_0xd8bedb[_0xafdc('0x3b')]['SmsAccountId'])return;_0x4c58b1[_0xafdc('0x78')](_0xafdc('0x8e'));_0x10fbb7[_0xafdc('0x78')](_0xafdc('0x8e'));return;}if(_0xd8bedb[_0xafdc('0x8f')][_0xafdc('0x90')]!==_0xafdc('0x91'))return;return _0xd8bedb[_0xafdc('0x8f')][_0xafdc('0x92')]({'attributes':['id'],'raw':!![]})[_0xafdc('0x33')](function(_0xb66efb){if(_['isEmpty'](_0xb66efb)){_0x4c58b1['where'](_0xafdc('0x93'));_0x10fbb7[_0xafdc('0x78')](_0xafdc('0x93'));}else{_0x4c58b1[_0xafdc('0x78')]('i.SmsAccountId\x20IN\x20?',_['map'](_0xb66efb,'id'));_0x10fbb7[_0xafdc('0x78')](_0xafdc('0x73'),_[_0xafdc('0x2e')](_0xb66efb,'id'));}});})['then'](function(){if(_0xd8bedb[_0xafdc('0x8f')][_0xafdc('0x90')]==='agent'&&!_0x32d9ed&&!_0xd8bedb[_0xafdc('0x3b')][_0xafdc('0x72')])return[];return db[_0xafdc('0x94')][_0xafdc('0x3b')](_0x4c58b1[_0xafdc('0x95')](),_0x2a5eb4);})['then'](function(_0x4a5431){_0x451f8f[_0xafdc('0x22')]=_0x4a5431[_0xafdc('0x40')];if(_0x451f8f['count']===0x0)return[];return db[_0xafdc('0x94')][_0xafdc('0x3b')](_0x396253[_0xafdc('0x95')](),_0x2a5eb4)[_0xafdc('0x33')](function(_0x270fef){_0x4da9ef=_[_0xafdc('0x96')](_0x270fef,'id');_0x2a5eb4=_['merge'](_0x2a5eb4,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xd8bedb[_0xafdc('0x3b')][_0xafdc('0x3f')]){_0x5f416c['attributes'][_0xafdc('0x68')](function(_0x187da4){_0x10fbb7[_0xafdc('0x46')]('i.'+_0x187da4);});}else{_0x10fbb7[_0xafdc('0x46')](_0xafdc('0x97'),_0xafdc('0x5a'));_0x10fbb7[_0xafdc('0x46')](_0xafdc('0x98'),_0xafdc('0x99'));_0x10fbb7[_0xafdc('0x46')](_0xafdc('0x9a'),_0xafdc('0x9b'));_0x10fbb7[_0xafdc('0x46')](_0xafdc('0x9c'),_0xafdc('0x9d'));_0x10fbb7[_0xafdc('0x46')]('i.*');_0x10fbb7['field']('c.firstName',_0xafdc('0x9e'));_0x10fbb7['field'](_0xafdc('0x9f'),'Contact.lastName');_0x10fbb7[_0xafdc('0x46')](_0xafdc('0xa0'),_0xafdc('0xa1'));_0x10fbb7[_0xafdc('0x46')](_0xafdc('0xa2'),_0xafdc('0xa3'));_0x10fbb7[_0xafdc('0x46')](_0xafdc('0xa4'),_0xafdc('0xa5'));_0x10fbb7[_0xafdc('0x46')](_0xafdc('0xa6'),_0xafdc('0xa7'));_0x10fbb7[_0xafdc('0x46')]('o.fullname',_0xafdc('0xa8'));_0x10fbb7[_0xafdc('0x46')](_0xafdc('0xa9'),'Owner.internal');_0x10fbb7[_0xafdc('0x46')](_0xafdc('0xaa'),_0xafdc('0x30'));}if(_0x5f416c[_0xafdc('0x21')])_0x10fbb7[_0xafdc('0x21')](_0x5f416c['limit']);if(_0x5f416c[_0xafdc('0x1f')])_0x10fbb7[_0xafdc('0x1f')](_0x5f416c['offset']);return db['sequelize']['query'](_0x10fbb7[_0xafdc('0x95')](),_0x2a5eb4);})[_0xafdc('0x33')](function(_0x5c60be){if(_0x5c60be[_0xafdc('0x40')]>0x0)_0x36a800[_0xafdc('0x78')](_0xafdc('0xab'),_[_0xafdc('0x2e')](_0x5c60be,'id'));return db[_0xafdc('0x94')][_0xafdc('0x3b')](_0x36a800[_0xafdc('0x95')](),_0x2a5eb4)[_0xafdc('0x33')](function(_0x3a547a){var _0x70f23c=_[_0xafdc('0xac')](_0x3a547a,'SmsInteractionId');var _0x589230=[];_0x5c60be[_0xafdc('0x68')](function(_0x4abc2d){_0x589230[_0xafdc('0xad')](updateSmsInteraction(_0x4abc2d,_0x4da9ef,_0x70f23c));});return BPromise[_0xafdc('0xae')](_0x589230);});});})[_0xafdc('0x33')](function(_0x16d151){_0x451f8f[_0xafdc('0xaf')]=_0x16d151;return _0x451f8f;})['then'](respondWithFilteredResult(_0x5450cf,_0x5f416c))[_0xafdc('0x34')](handleError(_0x5450cf,null));};exports[_0xafdc('0xb0')]=function(_0x24a86c,_0xa1d7d4){var _0x5c353e={'raw':![],'where':{'id':_0x24a86c[_0xafdc('0xb1')]['id']}},_0x425fb0={};_0x425fb0[_0xafdc('0x3a')]=_[_0xafdc('0x3c')](db['SmsInteraction'][_0xafdc('0x36')]);_0x425fb0[_0xafdc('0x3b')]=_['keys'](_0x24a86c[_0xafdc('0x3b')]);_0x425fb0[_0xafdc('0x44')]=_[_0xafdc('0x3d')](_0x425fb0[_0xafdc('0x3a')],_0x425fb0[_0xafdc('0x3b')]);_0x5c353e[_0xafdc('0x3e')]=_['intersection'](_0x425fb0[_0xafdc('0x3a')],qs[_0xafdc('0x3f')](_0x24a86c['query'][_0xafdc('0x3f')]));_0x5c353e['attributes']=_0x5c353e[_0xafdc('0x3e')][_0xafdc('0x40')]?_0x5c353e[_0xafdc('0x3e')]:_0x425fb0['model'];if(_0x24a86c[_0xafdc('0x3b')][_0xafdc('0xb2')]){_0x5c353e[_0xafdc('0xb3')]=[{'all':!![]}];}_0x5c353e=_[_0xafdc('0xb4')]({},_0x5c353e,_0x24a86c['options']);return db[_0xafdc('0xb5')]['find'](_0x5c353e)[_0xafdc('0x33')](handleEntityNotFound(_0xa1d7d4,null))[_0xafdc('0x33')](respondWithResult(_0xa1d7d4,null))[_0xafdc('0x34')](handleError(_0xa1d7d4,null));};exports[_0xafdc('0xb6')]=function(_0x437502,_0x227973){return db[_0xafdc('0xb5')][_0xafdc('0xb6')](_0x437502[_0xafdc('0xb7')],{})[_0xafdc('0x33')](respondWithResult(_0x227973,0xc9))['catch'](handleError(_0x227973,null));};exports[_0xafdc('0x26')]=function(_0x52113f,_0x41e25b){if(_0x52113f[_0xafdc('0xb7')]['id']){delete _0x52113f[_0xafdc('0xb7')]['id'];}return db['SmsInteraction'][_0xafdc('0x63')]({'where':{'id':_0x52113f[_0xafdc('0xb1')]['id']}})['then'](handleEntityNotFound(_0x41e25b,null))[_0xafdc('0x33')](saveUpdates(_0x52113f['body'],null))['then'](respondWithResult(_0x41e25b,null))[_0xafdc('0x34')](handleError(_0x41e25b,null));};exports[_0xafdc('0x27')]=function(_0x594dd2,_0x430b47){return db[_0xafdc('0xb5')][_0xafdc('0x63')]({'where':{'id':_0x594dd2[_0xafdc('0xb1')]['id']}})[_0xafdc('0x33')](handleEntityNotFound(_0x430b47,null))['then'](removeEntity(_0x430b47,null))['catch'](handleError(_0x430b47,null));};exports[_0xafdc('0xb8')]=function(_0xa583a9,_0x18247d){return db['SmsInteraction'][_0xafdc('0xb8')]()[_0xafdc('0x33')](respondWithResult(_0x18247d,null))[_0xafdc('0x34')](handleError(_0x18247d,null));};exports[_0xafdc('0xb9')]=function(_0x378e80,_0x27f904,_0x95f442){return db[_0xafdc('0xba')]['find']({'where':{'id':_0x378e80[_0xafdc('0xb1')]['id']}})[_0xafdc('0x33')](handleEntityNotFound(_0x27f904,null))[_0xafdc('0x33')](function(_0x5b267d){if(_0x5b267d){return _0x5b267d[_0xafdc('0xb9')](_0x378e80[_0xafdc('0xb7')][_0xafdc('0xbb')],_[_0xafdc('0xbc')](_0x378e80['body'],[_0xafdc('0xbb'),'id'])||{});}})[_0xafdc('0x33')](respondWithResult(_0x27f904,null))[_0xafdc('0x34')](handleError(_0x27f904,null));};exports['getMessages']=function(_0x2218aa,_0x28f04d,_0x363b92){var _0xb18493={'raw':![],'where':{}};var _0x2b287c={};var _0x13fb0d={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x2218aa[_0xafdc('0xb1')]['id']}})[_0xafdc('0x33')](handleEntityNotFound(_0x28f04d,null))['then'](function(_0x1510b2){if(_0x1510b2){_0x2b287c['model']=_[_0xafdc('0x3c')](db[_0xafdc('0xba')]['rawAttributes']);_0x2b287c[_0xafdc('0x3b')]=_[_0xafdc('0x3c')](_0x2218aa[_0xafdc('0x3b')]);_0x2b287c[_0xafdc('0x44')]=_['intersection'](_0x2b287c['model'],_0x2b287c['query']);_0xb18493[_0xafdc('0x3e')]=_['intersection'](_0x2b287c['model'],qs[_0xafdc('0x3f')](_0x2218aa[_0xafdc('0x3b')][_0xafdc('0x3f')]));_0xb18493[_0xafdc('0x3e')]=_0xb18493[_0xafdc('0x3e')][_0xafdc('0x40')]?_0xb18493[_0xafdc('0x3e')]:_0x2b287c[_0xafdc('0x3a')];if(!_0x2218aa[_0xafdc('0x3b')][_0xafdc('0x41')](_0xafdc('0xbd'))){_0xb18493[_0xafdc('0x21')]=qs[_0xafdc('0x21')](_0x2218aa['query']['limit']);_0xb18493[_0xafdc('0x1f')]=qs[_0xafdc('0x1f')](_0x2218aa[_0xafdc('0x3b')][_0xafdc('0x1f')]);}_0xb18493[_0xafdc('0x8a')]=qs['sort'](_0x2218aa[_0xafdc('0x3b')]['sort']);_0xb18493['where']=qs[_0xafdc('0x44')](_[_0xafdc('0x43')](_0x2218aa[_0xafdc('0x3b')],_0x2b287c['filters']));_0xb18493[_0xafdc('0x78')][_0xafdc('0xbe')]=_0x1510b2['id'];if(_0x2218aa[_0xafdc('0x3b')][_0xafdc('0x80')]){_0xb18493[_0xafdc('0x78')]=_[_0xafdc('0xb4')](_0xb18493['where'],{'$or':_['map'](_0xb18493[_0xafdc('0x3e')],function(_0x42ec7d){var _0x3a0dff={};_0x3a0dff[_0x42ec7d]={'$like':'%'+_0x2218aa['query'][_0xafdc('0x80')]+'%'};return _0x3a0dff;})});}if(_0x2218aa[_0xafdc('0x3b')][_0xafdc('0x76')]){var _0x5dbcd5=_0x2218aa[_0xafdc('0x3b')]['$gte'][_0xafdc('0x32')](',');var _0x47b135={};_0x47b135[_0x5dbcd5[0x0]]={'$gte':moment(_0x5dbcd5[0x1])[_0xafdc('0xbf')](_0xafdc('0xc0'))};_0xb18493[_0xafdc('0x78')]=_[_0xafdc('0xb4')](_0xb18493[_0xafdc('0x78')],_0x47b135);}_0xb18493=_[_0xafdc('0xb4')]({},_0xb18493,_0x2218aa[_0xafdc('0xc1')]);return db['SmsMessage'][_0xafdc('0x22')]({'where':_0xb18493[_0xafdc('0x78')]})[_0xafdc('0x33')](function(_0x5814ac){_0x13fb0d[_0xafdc('0x22')]=_0x5814ac;if(_0x2218aa[_0xafdc('0x3b')][_0xafdc('0xb2')]){_0xb18493[_0xafdc('0xb3')]=[{'all':!![]}];}return db[_0xafdc('0xba')]['findAll'](_0xb18493);})[_0xafdc('0x33')](function(_0xbfe24e){_0x13fb0d['rows']=_0xbfe24e;return _0x13fb0d;});}})[_0xafdc('0x33')](respondWithFilteredResult(_0x28f04d,_0xb18493))[_0xafdc('0x34')](handleError(_0x28f04d,null));};exports[_0xafdc('0xc2')]=function(_0x15bfed,_0x2a3020,_0x892210){return db[_0xafdc('0xb5')][_0xafdc('0x63')]({'where':{'id':_0x15bfed['params']['id']}})[_0xafdc('0x33')](handleEntityNotFound(_0x2a3020,null))[_0xafdc('0x33')](function(_0x2169e0){if(_0x2169e0){return _0x2169e0[_0xafdc('0xc3')](_0x15bfed[_0xafdc('0xb7')][_0xafdc('0xbb')],_['omit'](_0x15bfed['body'],[_0xafdc('0xbb'),'id'])||{})['spread'](function(){return db['Tag'][_0xafdc('0xc4')]({'attributes':['id',_0xafdc('0x2b'),_0xafdc('0xc5')],'where':{'id':_0x15bfed['body']['ids']}});})[_0xafdc('0x33')](function(_0x2dd2b6){socket[_0xafdc('0xc6')](_0xafdc('0xc7'),{'id':Number(_0x15bfed[_0xafdc('0xb1')]['id']),'tags':_0x2dd2b6||[]});return{'id':Number(_0x15bfed['params']['id']),'tags':_0x2dd2b6||[]};});}})['then'](respondWithResult(_0x2a3020,null))[_0xafdc('0x34')](handleError(_0x2a3020,null));};exports[_0xafdc('0xc8')]=function(_0x50d04a,_0xe80dfa,_0x9a03ff){return db[_0xafdc('0xb5')][_0xafdc('0x63')]({'where':{'id':_0x50d04a[_0xafdc('0xb1')]['id']}})['then'](handleEntityNotFound(_0xe80dfa,null))['then'](function(_0x31fd05){if(_0x31fd05){return _0x31fd05[_0xafdc('0xc8')](_0x50d04a[_0xafdc('0x3b')]['ids']);}})[_0xafdc('0x33')](respondWithStatusCode(_0xe80dfa,null))[_0xafdc('0x34')](handleError(_0xe80dfa,null));};exports[_0xafdc('0xc9')]=function(_0x1f0861,_0x4e4565){var _0x21d721=moment()['unix']()[_0xafdc('0x95')]();var _0x49428c=path[_0xafdc('0xca')](config['root'],_0xafdc('0xcb'),_0xafdc('0xcc'),_0xafdc('0xcd'));var _0x486b99=path[_0xafdc('0xca')](config['root'],_0xafdc('0xcb'),'files',_0xafdc('0xce'));var _0x516e9a=path['join'](_0x49428c,_0x21d721);var _0x3d868f=util['format'](_0xafdc('0xcf'),_0x1f0861['params']['id'],_0x21d721);var _0x3be61c=path[_0xafdc('0xca')](_0x49428c,_0x3d868f);var _0x53e953=[];_0x53e953[_0xafdc('0xad')]({'model':db['User'],'as':_0xafdc('0x6b'),'attributes':['id',_0xafdc('0x2f')],'raw':!![]});_0x53e953[_0xafdc('0xad')]({'model':db['CmContact'],'as':_0xafdc('0x5e'),'attributes':['id',_0xafdc('0xd0'),_0xafdc('0xd1')],'raw':!![]});var _0xb0bad0=[{'model':db[_0xafdc('0xba')],'as':_0xafdc('0xd2'),'attributes':['id',_0xafdc('0xb7'),_0xafdc('0x74'),_0xafdc('0xd3'),_0xafdc('0xd4'),_0xafdc('0x7c')],'include':_0x53e953}];_0xb0bad0['push']({'model':db[_0xafdc('0xd5')],'as':_0xafdc('0xd6'),'attributes':['id',_0xafdc('0x2b')]});_0xb0bad0[_0xafdc('0xad')]({'model':db[_0xafdc('0x6b')],'as':_0xafdc('0xd7'),'attributes':['id',_0xafdc('0x2f')]});return db[_0xafdc('0xb5')][_0xafdc('0x63')]({'where':{'id':_0x1f0861[_0xafdc('0xb1')]['id']},'include':_0xb0bad0})[_0xafdc('0x33')](handleEntityNotFound(_0x4e4565,null))[_0xafdc('0x33')](function(_0x3e977a){if(_0x3e977a){var _0x251de0=_0x3e977a['get']({'plain':!![]});fs[_0xafdc('0xd8')](_0x516e9a);var _0xb86c7e={'channel':_0xafdc('0xd9'),'account':_0x251de0[_0xafdc('0xd6')][_0xafdc('0x2b')],'agent':_0x251de0[_0xafdc('0xd7')]?_0x251de0[_0xafdc('0xd7')][_0xafdc('0x2f')]:_0xafdc('0xda'),'createdAt':moment(_0x251de0[_0xafdc('0x74')])[_0xafdc('0xbf')](_0xafdc('0xc0'))[_0xafdc('0x95')](),'closedAt':_0x251de0['closed']?moment(_0x251de0[_0xafdc('0xdb')])['format'](_0xafdc('0xc0'))[_0xafdc('0x95')]():'','disposition':_0x251de0['disposition'],'messages':_(_0x251de0[_0xafdc('0xd2')])[_0xafdc('0x80')]({'secret':![]})['map'](function(_0x25eb0d){return{'date':moment(_0x25eb0d[_0xafdc('0x74')])[_0xafdc('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0xafdc('0x95')](),'sender':_0x25eb0d[_0xafdc('0xd3')]===_0xafdc('0xdc')?_0x25eb0d[_0xafdc('0x6b')]?_0x25eb0d[_0xafdc('0x6b')][_0xafdc('0x2f')]:'System':_0x25eb0d[_0xafdc('0x5e')][_0xafdc('0xd0')]+(_0x25eb0d[_0xafdc('0x5e')][_0xafdc('0xd1')]?'\x20'+_0x25eb0d[_0xafdc('0x5e')][_0xafdc('0xd1')]:''),'body':_0x25eb0d[_0xafdc('0xb7')],'direction':_0x25eb0d['direction']===_0xafdc('0xdc')?'A':'C','secret':_0x25eb0d[_0xafdc('0xd4')],'read':_0x25eb0d[_0xafdc('0x7c')]};})[_0xafdc('0x5b')]()};return ejs[_0xafdc('0xdd')](path[_0xafdc('0xca')](config['root'],_0xafdc('0xcb'),_0xafdc('0xde'),_0xafdc('0xdf')),{'interaction':_0xb86c7e})[_0xafdc('0x33')](function(_0x2e28cd){var _0x4ddfab=path['join'](_0x516e9a,_0xafdc('0xe0')+_0x251de0['id']+'-'+_0x21d721+_0xafdc('0xe1'));var _0x4c5f44={'path':_0x4ddfab,'channel':_0xafdc('0xd9'),'interactionId':_0x251de0['id']};return pdf[_0xafdc('0xe2')](_0x2e28cd,_0x4c5f44);})['then'](function(){return new BPromise(function(_0x4df673,_0x2145e0){zipdir(_0x516e9a,{'saveTo':_0x3be61c},function(_0x37aa69,_0x22ca19){if(_0x37aa69)return _0x2145e0(_0x37aa69);return _0x4df673(_0x22ca19);});})[_0xafdc('0x33')](function(){return new BPromise(function(_0x33c6a3,_0x323b4e){rimraf(_0x516e9a,function(_0x16fc38){if(_0x16fc38)_0x323b4e(_0x16fc38);return _0x33c6a3();});});})[_0xafdc('0x33')](function(){return _0x4e4565[_0xafdc('0xc9')](_0x3be61c,_0x3d868f,function(_0x3f1eb6){if(_0x3f1eb6){console[_0xafdc('0xe3')]('err',_0x3f1eb6);}else{fs[_0xafdc('0xe4')](_0x3be61c);}});});});}else{return _0x4e4565['sendStatus'](0xc8);}})[_0xafdc('0x34')](handleError(_0x4e4565,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 072bfac..39f0059 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 _0x8ef6=['emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','remove','then','setDataValue','map','findAll','unreadMessages','length'];(function(_0x5a39f9,_0x48e6fa){var _0x3bbce2=function(_0x2cbf33){while(--_0x2cbf33){_0x5a39f9['push'](_0x5a39f9['shift']());}};_0x3bbce2(++_0x48e6fa);}(_0x8ef6,0xf2));var _0x68ef=function(_0x42b71f,_0x47e9e2){_0x42b71f=_0x42b71f-0x0;var _0x2fc85e=_0x8ef6[_0x42b71f];return _0x2fc85e;};'use strict';var EventEmitter=require(_0x68ef('0x0'));var SmsInteraction=require(_0x68ef('0x1'))['db'][_0x68ef('0x2')];var SmsMessage=require(_0x68ef('0x1'))['db'][_0x68ef('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x68ef('0x4')](0x0);var events={'afterCreate':_0x68ef('0x5'),'afterUpdate':'update','afterDestroy':_0x68ef('0x6')};function emitEvent(_0x129ce){return function(_0xbab618,_0x2ac782,_0x4d26e3){_0xbab618['getUsers']({'attributes':['id'],'raw':!![]})[_0x68ef('0x7')](function(_0x4740e8){_0xbab618[_0x68ef('0x8')]('Users',_0x4740e8[_0x68ef('0x9')](function(_0x31007e){return{'id':_0x31007e['id']};}));return SmsMessage[_0x68ef('0xa')]({'where':{'SmsInteractionId':_0xbab618['id'],'direction':'in','read':![]},'raw':!![]});})[_0x68ef('0x7')](function(_0x112b18){_0xbab618[_0x68ef('0x8')](_0x68ef('0xb'),_0x112b18[_0x68ef('0xc')]);SmsInteractionEvents[_0x68ef('0xd')](_0x129ce+':'+_0xbab618['id'],_0xbab618);SmsInteractionEvents[_0x68ef('0xd')](_0x129ce,_0xbab618);_0x4d26e3(null);})[_0x68ef('0xe')](_0x4d26e3(null));};}for(var e in events){if(events[_0x68ef('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x68ef('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x7118=['SmsInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','emit','catch','exports'];(function(_0x2f8ba5,_0x557e3b){var _0x430815=function(_0x40fd90){while(--_0x40fd90){_0x2f8ba5['push'](_0x2f8ba5['shift']());}};_0x430815(++_0x557e3b);}(_0x7118,0x159));var _0x8711=function(_0x37d8c5,_0x378cd6){_0x37d8c5=_0x37d8c5-0x0;var _0x59c3e1=_0x7118[_0x37d8c5];return _0x59c3e1;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x8711('0x0')];var SmsMessage=require(_0x8711('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8711('0x2')](0x0);var events={'afterCreate':_0x8711('0x3'),'afterUpdate':_0x8711('0x4'),'afterDestroy':_0x8711('0x5')};function emitEvent(_0x12496b){return function(_0x68e2a8,_0x206b82,_0x54885e){_0x68e2a8[_0x8711('0x6')]({'attributes':['id'],'raw':!![]})[_0x8711('0x7')](function(_0x1f23a9){_0x68e2a8[_0x8711('0x8')](_0x8711('0x9'),_0x1f23a9[_0x8711('0xa')](function(_0x7f7ca7){return{'id':_0x7f7ca7['id']};}));return SmsMessage[_0x8711('0xb')]({'where':{'SmsInteractionId':_0x68e2a8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8711('0x7')](function(_0x180954){_0x68e2a8[_0x8711('0x8')]('unreadMessages',_0x180954['length']);SmsInteractionEvents[_0x8711('0xc')](_0x12496b+':'+_0x68e2a8['id'],_0x68e2a8);SmsInteractionEvents[_0x8711('0xc')](_0x12496b,_0x68e2a8);_0x54885e(null);})[_0x8711('0xd')](_0x54885e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x8711('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index b31af1e..ad47441 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 _0x0fd5=['rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x0fd5,0x1e6));var _0x50fd=function(_0x514dfd,_0x7a00b2){_0x514dfd=_0x514dfd-0x0;var _0x34b8ef=_0x0fd5[_0x514dfd];return _0x34b8ef;};'use strict';var _=require(_0x50fd('0x0'));var util=require(_0x50fd('0x1'));var logger=require(_0x50fd('0x2'))(_0x50fd('0x3'));var moment=require(_0x50fd('0x4'));var BPromise=require(_0x50fd('0x5'));var rp=require(_0x50fd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x50fd('0x7'));var config=require(_0x50fd('0x8'));var attributes=require(_0x50fd('0x9'));module[_0x50fd('0xa')]=function(_0x2b19e9,_0x2fd5be){return _0x2b19e9[_0x50fd('0xb')]('SmsInteraction',attributes,{'tableName':_0x50fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x39ed96,_0x1557ea,_0x6866ea){if(_0x39ed96[_0x50fd('0xd')](_0x50fd('0xe'))){_0x39ed96[_0x50fd('0xf')]=moment()[_0x50fd('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x6866ea(null,_0x39ed96);}}});}; \ No newline at end of file +var _0x7111=['../../config/environment','./smsInteraction.attributes','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','request-promise','rimraf'];(function(_0x3a9468,_0x2b6266){var _0x1d2345=function(_0x499728){while(--_0x499728){_0x3a9468['push'](_0x3a9468['shift']());}};_0x1d2345(++_0x2b6266);}(_0x7111,0x14d));var _0x1711=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7111[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x1711('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1711('0x1'));var moment=require(_0x1711('0x2'));var BPromise=require('bluebird');var rp=require(_0x1711('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1711('0x4'));var config=require(_0x1711('0x5'));var attributes=require(_0x1711('0x6'));module['exports']=function(_0x430253,_0x5a133e){return _0x430253['define'](_0x1711('0x7'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xbb677a,_0x1b4e51,_0x3a8100){if(_0xbb677a[_0x1711('0x8')](_0x1711('0x9'))){_0xbb677a[_0x1711('0xa')]=moment()[_0x1711('0xb')](_0x1711('0xc'));}_0x3a8100(null,_0xbb677a);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index eb2ddf9..0e88378 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 _0xbc7b=['redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToSmsInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xbc7b,0x7d));var _0xbbc7=function(_0x2aae85,_0x33eaee){_0x2aae85=_0x2aae85-0x0;var _0x26ba50=_0xbc7b[_0x2aae85];return _0x26ba50;};'use strict';var _=require(_0xbbc7('0x0'));var util=require(_0xbbc7('0x1'));var moment=require(_0xbbc7('0x2'));var BPromise=require(_0xbbc7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbc7('0x4'));var db=require(_0xbbc7('0x5'))['db'];var utils=require(_0xbbc7('0x6'));var logger=require(_0xbbc7('0x7'))(_0xbbc7('0x8'));var config=require(_0xbbc7('0x9'));var jayson=require(_0xbbc7('0xa'));var client=jayson[_0xbbc7('0xb')][_0xbbc7('0xc')]({'port':0x232a});config[_0xbbc7('0xd')]=_['defaults'](config[_0xbbc7('0xd')],{'host':_0xbbc7('0xe'),'port':0x18eb});var socket=require(_0xbbc7('0xf'))(new Redis(config[_0xbbc7('0xd')]));require(_0xbbc7('0x10'))[_0xbbc7('0x11')](socket);function respondWithRpcPromise(_0xf4710d,_0x270f58,_0x4303c6){return new BPromise(function(_0x5e48c9,_0x18a113){return client[_0xbbc7('0x12')](_0xf4710d,_0x4303c6)['then'](function(_0x2317c6){logger[_0xbbc7('0x13')](_0xbbc7('0x14'),_0x270f58,'request\x20sent');logger[_0xbbc7('0x15')](_0xbbc7('0x16'),_0x270f58,_0xbbc7('0x17'),JSON[_0xbbc7('0x18')](_0x2317c6));if(_0x2317c6[_0xbbc7('0x19')]){if(_0x2317c6['error'][_0xbbc7('0x1a')]===0x1f4){logger['error'](_0xbbc7('0x14'),_0x270f58,_0x2317c6['error']['message']);return _0x18a113(_0x2317c6[_0xbbc7('0x19')][_0xbbc7('0x1b')]);}logger[_0xbbc7('0x19')](_0xbbc7('0x14'),_0x270f58,_0x2317c6[_0xbbc7('0x19')][_0xbbc7('0x1b')]);return _0x5e48c9(_0x2317c6[_0xbbc7('0x19')][_0xbbc7('0x1b')]);}else{logger[_0xbbc7('0x13')](_0xbbc7('0x14'),_0x270f58,_0xbbc7('0x17'));_0x5e48c9(_0x2317c6[_0xbbc7('0x1c')]['message']);}})[_0xbbc7('0x1d')](function(_0x3c4db8){logger[_0xbbc7('0x19')](_0xbbc7('0x14'),_0x270f58,_0x3c4db8);_0x18a113(_0x3c4db8);});});}exports[_0xbbc7('0x1e')]=function(_0x4977da){var _0x4b02ab=this;return new Promise(function(_0x465076,_0x21fc75){return db[_0xbbc7('0x1f')][_0xbbc7('0x20')](_0x4977da[_0xbbc7('0x21')],{'raw':_0x4977da[_0xbbc7('0x22')]?_0x4977da[_0xbbc7('0x22')][_0xbbc7('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4977da[_0xbbc7('0x22')]?_0x4977da[_0xbbc7('0x22')][_0xbbc7('0x24')]||null:null,'attributes':_0x4977da[_0xbbc7('0x22')]?_0x4977da[_0xbbc7('0x22')][_0xbbc7('0x25')]||null:null,'limit':_0x4977da[_0xbbc7('0x22')]?_0x4977da[_0xbbc7('0x22')][_0xbbc7('0x26')]||null:null})[_0xbbc7('0x27')](function(_0x589929){logger[_0xbbc7('0x13')](_0xbbc7('0x1e'),_0x4977da);logger[_0xbbc7('0x15')](_0xbbc7('0x1e'),_0x4977da,JSON[_0xbbc7('0x18')](_0x589929));_0x465076(_0x589929);})[_0xbbc7('0x1d')](function(_0x15c18d){logger[_0xbbc7('0x19')](_0xbbc7('0x1e'),_0x15c18d[_0xbbc7('0x1b')],_0x4977da);_0x21fc75(_0x4b02ab[_0xbbc7('0x19')](0x1f4,_0x15c18d['message']));});});};exports[_0xbbc7('0x28')]=function(_0xc277ac){return new Promise(function(_0x3eee26,_0x448b88){return db[_0xbbc7('0x1f')][_0xbbc7('0x29')]({'where':_0xc277ac[_0xbbc7('0x22')]?_0xc277ac[_0xbbc7('0x22')][_0xbbc7('0x24')]||null:null})[_0xbbc7('0x27')](function(_0x16d245){if(_0x16d245){return _0x16d245[_0xbbc7('0x2a')](_0xc277ac['body'][_0xbbc7('0x2b')],_['omit'](_0xc277ac[_0xbbc7('0x21')],[_0xbbc7('0x2b'),'id'])||{});}})[_0xbbc7('0x2c')](function(_0x4a4475){logger[_0xbbc7('0x13')](_0xbbc7('0x2d'),_0xc277ac);logger[_0xbbc7('0x15')](_0xbbc7('0x2d'),_0xc277ac,JSON[_0xbbc7('0x18')](_0x4a4475));_0x3eee26(_0x4a4475);})[_0xbbc7('0x1d')](function(_0x4baaf6){logger[_0xbbc7('0x19')](_0xbbc7('0x2d'),_0x4baaf6[_0xbbc7('0x1b')],_0xc277ac);_0x448b88(_this[_0xbbc7('0x19')](0x1f4,_0x4baaf6['message']));});});}; \ No newline at end of file +var _0xdd79=['jayson/promise','client','redis','defaults','localhost','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','info','AddTagsToSmsInteraction','find','ids','omit','debug','AddTags','util','moment','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xdd79,0x19c));var _0x9dd7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdd79[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x9dd7('0x0'));var moment=require(_0x9dd7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dd7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9dd7('0x3'));var logger=require('../../config/logger')(_0x9dd7('0x4'));var config=require(_0x9dd7('0x5'));var jayson=require(_0x9dd7('0x6'));var client=jayson[_0x9dd7('0x7')]['http']({'port':0x232a});config[_0x9dd7('0x8')]=_[_0x9dd7('0x9')](config[_0x9dd7('0x8')],{'host':_0x9dd7('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9dd7('0x8')]));require('./smsInteraction.socket')[_0x9dd7('0xb')](socket);function respondWithRpcPromise(_0x373dca,_0x11cefe,_0x52b06d){return new BPromise(function(_0x9f4a24,_0x2d3264){return client[_0x9dd7('0xc')](_0x373dca,_0x52b06d)[_0x9dd7('0xd')](function(_0x31541c){logger['info'](_0x9dd7('0xe'),_0x11cefe,_0x9dd7('0xf'));logger['debug'](_0x9dd7('0x10'),_0x11cefe,'request\x20sent',JSON[_0x9dd7('0x11')](_0x31541c));if(_0x31541c['error']){if(_0x31541c[_0x9dd7('0x12')][_0x9dd7('0x13')]===0x1f4){logger[_0x9dd7('0x12')](_0x9dd7('0xe'),_0x11cefe,_0x31541c['error'][_0x9dd7('0x14')]);return _0x2d3264(_0x31541c[_0x9dd7('0x12')][_0x9dd7('0x14')]);}logger[_0x9dd7('0x12')](_0x9dd7('0xe'),_0x11cefe,_0x31541c[_0x9dd7('0x12')][_0x9dd7('0x14')]);return _0x9f4a24(_0x31541c[_0x9dd7('0x12')][_0x9dd7('0x14')]);}else{logger['info'](_0x9dd7('0xe'),_0x11cefe,'request\x20sent');_0x9f4a24(_0x31541c[_0x9dd7('0x15')][_0x9dd7('0x14')]);}})[_0x9dd7('0x16')](function(_0x48da8a){logger[_0x9dd7('0x12')](_0x9dd7('0xe'),_0x11cefe,_0x48da8a);_0x2d3264(_0x48da8a);});});}exports[_0x9dd7('0x17')]=function(_0x2cfbf8){var _0x1414ca=this;return new Promise(function(_0x188feb,_0x26f817){return db[_0x9dd7('0x18')]['update'](_0x2cfbf8[_0x9dd7('0x19')],{'raw':_0x2cfbf8[_0x9dd7('0x1a')]?_0x2cfbf8['options'][_0x9dd7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cfbf8[_0x9dd7('0x1a')]?_0x2cfbf8[_0x9dd7('0x1a')][_0x9dd7('0x1c')]||null:null,'attributes':_0x2cfbf8[_0x9dd7('0x1a')]?_0x2cfbf8[_0x9dd7('0x1a')][_0x9dd7('0x1d')]||null:null,'limit':_0x2cfbf8[_0x9dd7('0x1a')]?_0x2cfbf8[_0x9dd7('0x1a')][_0x9dd7('0x1e')]||null:null})['then'](function(_0x5be52b){logger[_0x9dd7('0x1f')](_0x9dd7('0x17'),_0x2cfbf8);logger['debug'](_0x9dd7('0x17'),_0x2cfbf8,JSON[_0x9dd7('0x11')](_0x5be52b));_0x188feb(_0x5be52b);})['catch'](function(_0x4908ef){logger['error'](_0x9dd7('0x17'),_0x4908ef[_0x9dd7('0x14')],_0x2cfbf8);_0x26f817(_0x1414ca['error'](0x1f4,_0x4908ef['message']));});});};exports[_0x9dd7('0x20')]=function(_0x4700b3){return new Promise(function(_0x2fd46e,_0x485a58){return db[_0x9dd7('0x18')][_0x9dd7('0x21')]({'where':_0x4700b3['options']?_0x4700b3[_0x9dd7('0x1a')][_0x9dd7('0x1c')]||null:null})[_0x9dd7('0xd')](function(_0xb69e12){if(_0xb69e12){return _0xb69e12['addTags'](_0x4700b3[_0x9dd7('0x19')][_0x9dd7('0x22')],_[_0x9dd7('0x23')](_0x4700b3[_0x9dd7('0x19')],[_0x9dd7('0x22'),'id'])||{});}})['spread'](function(_0x13c332){logger[_0x9dd7('0x1f')]('AddTags',_0x4700b3);logger[_0x9dd7('0x24')]('AddTags',_0x4700b3,JSON['stringify'](_0x13c332));_0x2fd46e(_0x13c332);})['catch'](function(_0x37c88d){logger[_0x9dd7('0x12')](_0x9dd7('0x25'),_0x37c88d[_0x9dd7('0x14')],_0x4700b3);_0x485a58(_this[_0x9dd7('0x12')](0x1f4,_0x37c88d[_0x9dd7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 80d6246..605d4ce 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 _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0x2032,0xd9));var _0x2203=function(_0xd9c0db,_0x1d1116){_0xd9c0db=_0xd9c0db-0x0;var _0x1cf526=_0x2032[_0xd9c0db];return _0x1cf526;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file +var _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x2aefb6,_0x1bd384){var _0x202772=function(_0x507d3f){while(--_0x507d3f){_0x2aefb6['push'](_0x2aefb6['shift']());}};_0x202772(++_0x1bd384);}(_0x2032,0xd9));var _0x2203=function(_0x2e01a8,_0x493c12){_0x2e01a8=_0x2e01a8-0x0;var _0x3d5572=_0x2032[_0x2e01a8];return _0x3d5572;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 9fa3e0a..24be85c 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 _0x234f=['tracked','sms','smsmessage:create','create','/:id/status','status','put','update','accept','reject','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','/describe','describe','/:id','isAuthenticated','show','post'];(function(_0x5cbd77,_0x224307){var _0x5dfd12=function(_0x4459da){while(--_0x4459da){_0x5cbd77['push'](_0x5cbd77['shift']());}};_0x5dfd12(++_0x224307);}(_0x234f,0x186));var _0xf234=function(_0x21975d,_0x4b5ad6){_0x21975d=_0x21975d-0x0;var _0x25b1bd=_0x234f[_0x21975d];return _0x25b1bd;};'use strict';var multer=require('multer');var util=require(_0xf234('0x0'));var path=require('path');var timeout=require(_0xf234('0x1'));var express=require(_0xf234('0x2'));var router=express[_0xf234('0x3')]();var fs_extra=require(_0xf234('0x4'));var auth=require(_0xf234('0x5'));var interaction=require(_0xf234('0x6'));var config=require(_0xf234('0x7'));var controller=require(_0xf234('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf234('0x9'),auth['isAuthenticated'](),controller[_0xf234('0xa')]);router['get'](_0xf234('0xb'),auth[_0xf234('0xc')](),controller[_0xf234('0xd')]);router[_0xf234('0xe')]('/',auth[_0xf234('0xc')](),interaction[_0xf234('0xf')](_0xf234('0x10'),_0xf234('0x11')),controller[_0xf234('0x12')]);router['post'](_0xf234('0x13'),controller[_0xf234('0x14')]);router[_0xf234('0x15')](_0xf234('0xb'),auth[_0xf234('0xc')](),controller[_0xf234('0x16')]);router['put']('/:id/accept',auth[_0xf234('0xc')](),controller[_0xf234('0x17')]);router[_0xf234('0x15')]('/:id/reject',auth['isAuthenticated'](),controller[_0xf234('0x18')]);router[_0xf234('0x19')](_0xf234('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf234('0x1a')]=router; \ No newline at end of file +var _0x486b=['put','update','/:id/accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','tracked','smsmessage:create','create','/:id/status','status'];(function(_0x5c0a45,_0x4fe66d){var _0x76c83f=function(_0x23e9e6){while(--_0x23e9e6){_0x5c0a45['push'](_0x5c0a45['shift']());}};_0x76c83f(++_0x4fe66d);}(_0x486b,0x115));var _0xb486=function(_0x4434e5,_0xa0fbae){_0x4434e5=_0x4434e5-0x0;var _0x423751=_0x486b[_0x4434e5];return _0x423751;};'use strict';var multer=require(_0xb486('0x0'));var util=require(_0xb486('0x1'));var path=require(_0xb486('0x2'));var timeout=require(_0xb486('0x3'));var express=require('express');var router=express[_0xb486('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb486('0x5'));var config=require(_0xb486('0x6'));var controller=require(_0xb486('0x7'));router['get']('/',auth[_0xb486('0x8')](),controller[_0xb486('0x9')]);router[_0xb486('0xa')](_0xb486('0xb'),auth[_0xb486('0x8')](),controller[_0xb486('0xc')]);router[_0xb486('0xa')](_0xb486('0xd'),auth[_0xb486('0x8')](),controller['show']);router[_0xb486('0xe')]('/',auth[_0xb486('0x8')](),interaction[_0xb486('0xf')]('sms',_0xb486('0x10')),controller[_0xb486('0x11')]);router['post'](_0xb486('0x12'),controller[_0xb486('0x13')]);router[_0xb486('0x14')](_0xb486('0xd'),auth[_0xb486('0x8')](),controller[_0xb486('0x15')]);router[_0xb486('0x14')](_0xb486('0x16'),auth[_0xb486('0x8')](),controller['accept']);router['put']('/:id/reject',auth[_0xb486('0x8')](),controller[_0xb486('0x17')]);router[_0xb486('0x18')](_0xb486('0xd'),auth[_0xb486('0x8')](),controller[_0xb486('0x19')]);module[_0xb486('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index fe5ee50..e6c6263 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 _0xb1f8=['DATE','sequelize','TEXT','BOOLEAN','out','STRING'];(function(_0x5ee582,_0x5c1898){var _0x176a90=function(_0x302057){while(--_0x302057){_0x5ee582['push'](_0x5ee582['shift']());}};_0x176a90(++_0x5c1898);}(_0xb1f8,0xeb));var _0x8b1f=function(_0x1ed82f,_0x368702){_0x1ed82f=_0x1ed82f-0x0;var _0x2029cc=_0xb1f8[_0x1ed82f];return _0x2029cc;};'use strict';var Sequelize=require(_0x8b1f('0x0'));module['exports']={'body':{'type':Sequelize[_0x8b1f('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8b1f('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8b1f('0x3')),'defaultValue':_0x8b1f('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x8b1f('0x4')]},'readAt':{'type':Sequelize[_0x8b1f('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x8b1f('0x1')]}}; \ No newline at end of file +var _0x94fc=['medium','out','STRING','sequelize','exports'];(function(_0x19915f,_0x243508){var _0x1367d2=function(_0x306d2d){while(--_0x306d2d){_0x19915f['push'](_0x19915f['shift']());}};_0x1367d2(++_0x243508);}(_0x94fc,0x1b6));var _0xc94f=function(_0x120c53,_0x5e4614){_0x120c53=_0x120c53-0x0;var _0x25a012=_0x94fc[_0x120c53];return _0x25a012;};'use strict';var Sequelize=require(_0xc94f('0x0'));module[_0xc94f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc94f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc94f('0x3')),'defaultValue':_0xc94f('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc94f('0x4')](0xbe)},'phone':{'type':Sequelize[_0xc94f('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc94f('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 354f726..40d9303 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 _0x7472=['code','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','create','body','describe','accept','format','UserId','agent','CmContact','Contact','get','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','user','role','null','AcceptMessage','acceptMessage','keys','startsWith','cf_','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','sms','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','push','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','DELIVERED','infobip','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x21e97b,_0x65a77f){var _0x10ba44=function(_0x239ef2){while(--_0x239ef2){_0x21e97b['push'](_0x21e97b['shift']());}};_0x10ba44(++_0x65a77f);}(_0x7472,0x189));var _0x2747=function(_0x573e33,_0xea7dd9){_0x573e33=_0x573e33-0x0;var _0x1b20b5=_0x7472[_0x573e33];return _0x1b20b5;};'use strict';var emlformat=require(_0x2747('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2747('0x1'));var jsonpatch=require(_0x2747('0x2'));var rp=require('request-promise');var moment=require(_0x2747('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2747('0x4'));var util=require(_0x2747('0x5'));var path=require(_0x2747('0x6'));var sox=require(_0x2747('0x7'));var csv=require(_0x2747('0x8'));var ejs=require(_0x2747('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2747('0xa'));var crypto=require(_0x2747('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2747('0xc'));var toCsv=require(_0x2747('0x8'));var querystring=require('querystring');var Papa=require(_0x2747('0xd'));var Redis=require(_0x2747('0xe'));var authService=require(_0x2747('0xf'));var qs=require(_0x2747('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2747('0x11'));var logger=require(_0x2747('0x12'))(_0x2747('0x13'));var utils=require(_0x2747('0x14'));var config=require(_0x2747('0x15'));var licenseUtil=require(_0x2747('0x16'));var db=require(_0x2747('0x17'))['db'];config[_0x2747('0x18')]=_[_0x2747('0x19')](config[_0x2747('0x18')],{'host':_0x2747('0x1a'),'port':0x18eb});var socket=require(_0x2747('0x1b'))(new Redis(config[_0x2747('0x18')]));require('./smsMessage.socket')[_0x2747('0x1c')](socket);var jayson=require(_0x2747('0x1d'));var client=jayson[_0x2747('0x1e')][_0x2747('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x2747('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x479d57,_0x2ceef4,_0x564ac3,_0xb6b069){return new BPromise(function(_0x2565bc,_0x1b90d1){var _0xfa675f=_0xb6b069||client;return _0xfa675f[_0x2747('0x20')](_0x479d57,_0x564ac3)[_0x2747('0x21')](function(_0x23e99e){logger[_0x2747('0x22')](_0x2747('0x23'),_0x2ceef4,_0x2747('0x24'));logger[_0x2747('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2ceef4,_0x2747('0x24'),JSON['stringify'](_0x23e99e));if(_0x23e99e[_0x2747('0x26')]){if(_0x23e99e[_0x2747('0x26')][_0x2747('0x27')]===0x1f4){logger[_0x2747('0x26')](_0x2747('0x23'),_0x2ceef4,_0x23e99e['error'][_0x2747('0x28')]);return _0x1b90d1(_0x23e99e['error']['message']);}logger['error'](_0x2747('0x23'),_0x2ceef4,_0x23e99e[_0x2747('0x26')][_0x2747('0x28')]);return _0x2565bc(_0x23e99e[_0x2747('0x26')]['message']);}else{logger['info'](_0x2747('0x23'),_0x2ceef4,_0x2747('0x24'));_0x2565bc(_0x23e99e['result']['message']);}})[_0x2747('0x29')](function(_0x4b8220){logger[_0x2747('0x26')](_0x2747('0x23'),_0x2ceef4,_0x4b8220);_0x1b90d1(_0x4b8220);});});}function respondWithStatusCode(_0x438168,_0x16d19f){_0x16d19f=_0x16d19f||0xcc;return function(_0x4165b4){if(_0x4165b4){return _0x438168[_0x2747('0x2a')](_0x16d19f);}return _0x438168['status'](_0x16d19f)[_0x2747('0x2b')]();};}function respondWithResult(_0x27568d,_0x911b14){_0x911b14=_0x911b14||0xc8;return function(_0x36999f){if(_0x36999f){return _0x27568d[_0x2747('0x2c')](_0x911b14)[_0x2747('0x2d')](_0x36999f);}};}function respondWithFilteredResult(_0x1176d8,_0x7d88a6){return function(_0x4fa0d8){if(_0x4fa0d8){var _0x4c1ec8=typeof _0x7d88a6[_0x2747('0x2e')]===_0x2747('0x2f')&&typeof _0x7d88a6[_0x2747('0x30')]==='undefined';var _0x28c585=_0x4fa0d8[_0x2747('0x31')];var _0x916dd3=_0x4c1ec8?0x0:_0x7d88a6[_0x2747('0x2e')];var _0x4ad164=_0x4c1ec8?_0x4fa0d8[_0x2747('0x31')]:_0x7d88a6[_0x2747('0x2e')]+_0x7d88a6[_0x2747('0x30')];var _0x4c4ee7;if(_0x4ad164>=_0x28c585){_0x4ad164=_0x28c585;_0x4c4ee7=0xc8;}else{_0x4c4ee7=0xce;}_0x1176d8['status'](_0x4c4ee7);return _0x1176d8['set'](_0x2747('0x32'),_0x916dd3+'-'+_0x4ad164+'/'+_0x28c585)['json'](_0x4fa0d8);}return null;};}function patchUpdates(_0x19382d){return function(_0x3eb1be){try{jsonpatch[_0x2747('0x33')](_0x3eb1be,_0x19382d,!![]);}catch(_0x214371){return BPromise[_0x2747('0x34')](_0x214371);}return _0x3eb1be['save']();};}function saveUpdates(_0xc9b3e3,_0x1ecb27){return function(_0x399689){if(_0x399689){return _0x399689[_0x2747('0x35')](_0xc9b3e3)['then'](function(_0x1e3c02){return _0x1e3c02;});}return null;};}function removeEntity(_0x2f856c,_0x1373a0){return function(_0x5ea083){if(_0x5ea083){return _0x5ea083[_0x2747('0x36')]()[_0x2747('0x21')](function(){_0x2f856c[_0x2747('0x2c')](0xcc)[_0x2747('0x2b')]();});}};}function handleEntityNotFound(_0x7b44b4,_0xfb39de){return function(_0x1ffe73){if(!_0x1ffe73){_0x7b44b4[_0x2747('0x2a')](0x194);}return _0x1ffe73;};}function handleError(_0x3a7bef,_0x4da8bb){_0x4da8bb=_0x4da8bb||0x1f4;return function(_0x4786cf){logger[_0x2747('0x26')](_0x4786cf[_0x2747('0x37')]);if(_0x4786cf['name']){delete _0x4786cf[_0x2747('0x38')];}_0x3a7bef[_0x2747('0x2c')](_0x4da8bb)[_0x2747('0x39')](_0x4786cf);};}exports[_0x2747('0x3a')]=function(_0x25609a,_0x1675f1){var _0x8aa068={},_0x1cc0b9={},_0x5f1f45={'count':0x0,'rows':[]};var _0x447d27=_[_0x2747('0x3b')](db[_0x2747('0x3c')][_0x2747('0x3d')],function(_0x4d7b4f){return{'name':_0x4d7b4f[_0x2747('0x3e')],'type':_0x4d7b4f[_0x2747('0x3f')][_0x2747('0x40')]};});_0x1cc0b9['model']=_['map'](_0x447d27,'name');_0x1cc0b9[_0x2747('0x41')]=_['keys'](_0x25609a[_0x2747('0x41')]);_0x1cc0b9[_0x2747('0x42')]=_['intersection'](_0x1cc0b9[_0x2747('0x43')],_0x1cc0b9[_0x2747('0x41')]);_0x8aa068['attributes']=_[_0x2747('0x44')](_0x1cc0b9[_0x2747('0x43')],qs[_0x2747('0x45')](_0x25609a[_0x2747('0x41')][_0x2747('0x45')]));_0x8aa068[_0x2747('0x46')]=_0x8aa068[_0x2747('0x46')][_0x2747('0x47')]?_0x8aa068[_0x2747('0x46')]:_0x1cc0b9[_0x2747('0x43')];if(!_0x25609a[_0x2747('0x41')][_0x2747('0x48')](_0x2747('0x49'))){_0x8aa068[_0x2747('0x30')]=qs['limit'](_0x25609a[_0x2747('0x41')]['limit']);_0x8aa068[_0x2747('0x2e')]=qs[_0x2747('0x2e')](_0x25609a['query'][_0x2747('0x2e')]);}_0x8aa068[_0x2747('0x4a')]=qs[_0x2747('0x4b')](_0x25609a[_0x2747('0x41')][_0x2747('0x4b')]);_0x8aa068[_0x2747('0x4c')]=qs['filters'](_['pick'](_0x25609a['query'],_0x1cc0b9['filters']),_0x447d27);if(_0x25609a[_0x2747('0x41')][_0x2747('0x4d')]){_0x8aa068[_0x2747('0x4c')]=_[_0x2747('0x4e')](_0x8aa068[_0x2747('0x4c')],{'$or':_[_0x2747('0x3b')](_0x447d27,function(_0x3672b7){if(_0x3672b7[_0x2747('0x3f')]!==_0x2747('0x4f')){var _0x1d7f55={};_0x1d7f55[_0x3672b7[_0x2747('0x38')]]={'$like':'%'+_0x25609a['query'][_0x2747('0x4d')]+'%'};return _0x1d7f55;}})});}_0x8aa068=_[_0x2747('0x4e')]({},_0x8aa068,_0x25609a['options']);var _0x13f7da={'where':_0x8aa068['where']};return db[_0x2747('0x3c')][_0x2747('0x31')](_0x13f7da)[_0x2747('0x21')](function(_0x130ffa){_0x5f1f45[_0x2747('0x31')]=_0x130ffa;if(_0x25609a[_0x2747('0x41')][_0x2747('0x50')]){_0x8aa068[_0x2747('0x51')]=[{'all':!![]}];}return db[_0x2747('0x3c')][_0x2747('0x52')](_0x8aa068);})['then'](function(_0x19619e){_0x5f1f45['rows']=_0x19619e;return _0x5f1f45;})[_0x2747('0x21')](respondWithFilteredResult(_0x1675f1,_0x8aa068))['catch'](handleError(_0x1675f1,null));};exports[_0x2747('0x53')]=function(_0x3036a0,_0x14b482){var _0x1bc2be={'raw':!![],'where':{'id':_0x3036a0[_0x2747('0x54')]['id']}},_0x547364={};_0x547364[_0x2747('0x43')]=_['keys'](db[_0x2747('0x3c')][_0x2747('0x3d')]);_0x547364[_0x2747('0x41')]=_['keys'](_0x3036a0['query']);_0x547364['filters']=_[_0x2747('0x44')](_0x547364[_0x2747('0x43')],_0x547364[_0x2747('0x41')]);_0x1bc2be['attributes']=_[_0x2747('0x44')](_0x547364[_0x2747('0x43')],qs[_0x2747('0x45')](_0x3036a0['query'][_0x2747('0x45')]));_0x1bc2be[_0x2747('0x46')]=_0x1bc2be[_0x2747('0x46')][_0x2747('0x47')]?_0x1bc2be[_0x2747('0x46')]:_0x547364[_0x2747('0x43')];if(_0x3036a0['query'][_0x2747('0x50')]){_0x1bc2be[_0x2747('0x51')]=[{'all':!![]}];}_0x1bc2be=_[_0x2747('0x4e')]({},_0x1bc2be,_0x3036a0[_0x2747('0x55')]);return db[_0x2747('0x3c')][_0x2747('0x56')](_0x1bc2be)['then'](handleEntityNotFound(_0x14b482,null))[_0x2747('0x21')](respondWithResult(_0x14b482,null))[_0x2747('0x29')](handleError(_0x14b482,null));};exports['create']=function(_0xf542fc,_0x10a339){return db[_0x2747('0x3c')][_0x2747('0x57')](_0xf542fc[_0x2747('0x58')],{})[_0x2747('0x21')](respondWithResult(_0x10a339,0xc9))[_0x2747('0x29')](handleError(_0x10a339,null));};exports[_0x2747('0x35')]=function(_0x121468,_0x4c7245){if(_0x121468['body']['id']){delete _0x121468[_0x2747('0x58')]['id'];}return db[_0x2747('0x3c')][_0x2747('0x56')]({'where':{'id':_0x121468[_0x2747('0x54')]['id']}})[_0x2747('0x21')](handleEntityNotFound(_0x4c7245,null))[_0x2747('0x21')](saveUpdates(_0x121468[_0x2747('0x58')],null))[_0x2747('0x21')](respondWithResult(_0x4c7245,null))[_0x2747('0x29')](handleError(_0x4c7245,null));};exports[_0x2747('0x36')]=function(_0x5addb1,_0x51919c){return db[_0x2747('0x3c')]['find']({'where':{'id':_0x5addb1['params']['id']}})[_0x2747('0x21')](handleEntityNotFound(_0x51919c,null))[_0x2747('0x21')](removeEntity(_0x51919c,null))[_0x2747('0x29')](handleError(_0x51919c,null));};exports[_0x2747('0x59')]=function(_0x18796b,_0x4a935a){return db['SmsMessage']['describe']()[_0x2747('0x21')](respondWithResult(_0x4a935a,null))[_0x2747('0x29')](handleError(_0x4a935a,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x2747('0x5a')]=function(_0x1d6aa0,_0x1f3442,_0x2c2ba5){var _0x33362f={'agent':{},'channel':'sms'};if(_0x1d6aa0['body']['id']){delete _0x1d6aa0['body']['id'];}_0x1d6aa0[_0x2747('0x58')]['read']=!![];_0x1d6aa0[_0x2747('0x58')]['readAt']=moment()[_0x2747('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d6aa0[_0x2747('0x58')]['UserId']=_0x1d6aa0[_0x2747('0x58')][_0x2747('0x5c')]||_0x1d6aa0['user']['id'];_0x33362f[_0x2747('0x5d')]['id']=_0x1d6aa0[_0x2747('0x58')][_0x2747('0x5c')];return db[_0x2747('0x3c')]['find']({'where':{'id':_0x1d6aa0[_0x2747('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x2747('0x5e')],'as':_0x2747('0x5f')}]})[_0x2747('0x21')](handleEntityNotFound(_0x1f3442,null))['then'](saveUpdates(_0x1d6aa0[_0x2747('0x58')],null))[_0x2747('0x21')](function(_0x4e4338){if(_0x4e4338){_0x33362f[_0x2747('0x28')]=_0x4e4338[_0x2747('0x60')]({'plain':!![]});return db['SmsInteraction'][_0x2747('0x56')]({'where':{'id':_0x4e4338['SmsInteractionId']}});}return null;})[_0x2747('0x21')](handleEntityNotFound(_0x1f3442,null))['then'](function(_0x11664a){if(_0x11664a){return _0x11664a['update']({'UserId':_0x1d6aa0['body'][_0x2747('0x5c')],'read1stAt':_['isNil'](_0x11664a[_0x2747('0x61')])?moment()[_0x2747('0x5b')](_0x2747('0x62')):undefined});}return null;})['then'](function(_0x57830f){if(_0x57830f){_0x33362f[_0x2747('0x63')]=_0x57830f[_0x2747('0x60')]({'plain':!![]});interaction_log[_0x2747('0x22')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1d6aa0[_0x2747('0x64')]['id'],_0x1d6aa0[_0x2747('0x64')][_0x2747('0x38')],_0x1d6aa0[_0x2747('0x64')][_0x2747('0x65')],_0x33362f['interaction']['id'],_0x1d6aa0['body']?JSON['stringify'](_0x1d6aa0['body']):_0x2747('0x66'));return respondWithRpcPromise(_0x2747('0x67'),_0x2747('0x68'),_0x33362f);}return null;})[_0x2747('0x21')](function(_0x51fd47){return db[_0x2747('0x5e')][_0x2747('0x59')]()[_0x2747('0x21')](function(_0x3dcf81){var _0x2d3b04=[];for(var _0x47ff10=0x0;_0x47ff10=0x0){return _0x19a9c8[_0x2747('0x35')]({'read':!![]});}else{logger[_0x2747('0x26')](_0x2747('0x85'),'status',_0x2747('0x8d'),util[_0x2747('0x86')](_0x2e3e39['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1af7a7=_0x2e3e39['body']['results'][0x0];if(_0x1af7a7[_0x2747('0x2c')]['groupName']===_0x2747('0x8e')){return _0x19a9c8[_0x2747('0x35')]({'read':!![]});}else{logger[_0x2747('0x26')](_0x2747('0x85'),_0x2747('0x2c'),_0x2747('0x8f'),util[_0x2747('0x86')](_0x2e3e39[_0x2747('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x19a9c8;}})[_0x2747('0x21')](respondWithResult(_0x414739,null))[_0x2747('0x29')](handleError(_0x414739,null));}; \ No newline at end of file +var _0x74b7=['SELECT','contact','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','SmsInteraction','RejectMessage','push','sequelize','rejectmessage','SmsAccount','debug','received\x20delivery\x20report\x20from','inspect','twilio','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','send','map','SmsMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','find','create','body','params','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','format','UserId','user','YYYY-MM-DD\x20HH:mm:ss','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','CmContact','startsWith','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes'];(function(_0x5158c5,_0x2f27bb){var _0x44ef87=function(_0x3115b7){while(--_0x3115b7){_0x5158c5['push'](_0x5158c5['shift']());}};_0x44ef87(++_0x2f27bb);}(_0x74b7,0xa7));var _0x774b=function(_0x5ab7ec,_0x1edb9f){_0x5ab7ec=_0x5ab7ec-0x0;var _0x33ffd1=_0x74b7[_0x5ab7ec];return _0x33ffd1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x774b('0x0'));var zipdir=require(_0x774b('0x1'));var jsonpatch=require(_0x774b('0x2'));var rp=require(_0x774b('0x3'));var moment=require('moment');var BPromise=require(_0x774b('0x4'));var Mustache=require('mustache');var util=require(_0x774b('0x5'));var path=require(_0x774b('0x6'));var sox=require(_0x774b('0x7'));var csv=require(_0x774b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x774b('0x9'));var crypto=require(_0x774b('0xa'));var jsforce=require(_0x774b('0xb'));var deskjs=require(_0x774b('0xc'));var toCsv=require(_0x774b('0x8'));var querystring=require(_0x774b('0xd'));var Papa=require(_0x774b('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x774b('0xf'));var as=require(_0x774b('0x10'));var hardwareService=require(_0x774b('0x11'));var logger=require('../../config/logger')(_0x774b('0x12'));var utils=require(_0x774b('0x13'));var config=require(_0x774b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x774b('0x15'))['db'];config[_0x774b('0x16')]=_[_0x774b('0x17')](config[_0x774b('0x16')],{'host':_0x774b('0x18'),'port':0x18eb});var socket=require(_0x774b('0x19'))(new Redis(config[_0x774b('0x16')]));require('./smsMessage.socket')[_0x774b('0x1a')](socket);var jayson=require(_0x774b('0x1b'));var client=jayson[_0x774b('0x1c')][_0x774b('0x1d')]({'port':0x232c});var client9002=jayson[_0x774b('0x1c')][_0x774b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4951f7,_0x56a7fd,_0xef64e7,_0x551f8f){return new BPromise(function(_0x3e9710,_0x37800a){var _0x34e64e=_0x551f8f||client;return _0x34e64e['request'](_0x4951f7,_0xef64e7)[_0x774b('0x1e')](function(_0x39c2ca){logger[_0x774b('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x56a7fd,_0x774b('0x20'));logger['debug'](_0x774b('0x21'),_0x56a7fd,_0x774b('0x20'),JSON[_0x774b('0x22')](_0x39c2ca));if(_0x39c2ca['error']){if(_0x39c2ca[_0x774b('0x23')][_0x774b('0x24')]===0x1f4){logger[_0x774b('0x23')](_0x774b('0x25'),_0x56a7fd,_0x39c2ca[_0x774b('0x23')]['message']);return _0x37800a(_0x39c2ca[_0x774b('0x23')]['message']);}logger[_0x774b('0x23')](_0x774b('0x25'),_0x56a7fd,_0x39c2ca[_0x774b('0x23')][_0x774b('0x26')]);return _0x3e9710(_0x39c2ca[_0x774b('0x23')][_0x774b('0x26')]);}else{logger[_0x774b('0x1f')](_0x774b('0x25'),_0x56a7fd,_0x774b('0x20'));_0x3e9710(_0x39c2ca[_0x774b('0x27')][_0x774b('0x26')]);}})[_0x774b('0x28')](function(_0x3d5f8c){logger[_0x774b('0x23')](_0x774b('0x25'),_0x56a7fd,_0x3d5f8c);_0x37800a(_0x3d5f8c);});});}function respondWithStatusCode(_0x43857b,_0x2045da){_0x2045da=_0x2045da||0xcc;return function(_0x553655){if(_0x553655){return _0x43857b['sendStatus'](_0x2045da);}return _0x43857b[_0x774b('0x29')](_0x2045da)['end']();};}function respondWithResult(_0x5dc0fd,_0x3a84fd){_0x3a84fd=_0x3a84fd||0xc8;return function(_0x30e973){if(_0x30e973){return _0x5dc0fd[_0x774b('0x29')](_0x3a84fd)[_0x774b('0x2a')](_0x30e973);}};}function respondWithFilteredResult(_0x398696,_0x2093ac){return function(_0x568b06){if(_0x568b06){var _0x51eed9=typeof _0x2093ac[_0x774b('0x2b')]===_0x774b('0x2c')&&typeof _0x2093ac[_0x774b('0x2d')]===_0x774b('0x2c');var _0x50bd07=_0x568b06[_0x774b('0x2e')];var _0x3cab3f=_0x51eed9?0x0:_0x2093ac[_0x774b('0x2b')];var _0x562726=_0x51eed9?_0x568b06[_0x774b('0x2e')]:_0x2093ac['offset']+_0x2093ac['limit'];var _0x2a0614;if(_0x562726>=_0x50bd07){_0x562726=_0x50bd07;_0x2a0614=0xc8;}else{_0x2a0614=0xce;}_0x398696['status'](_0x2a0614);return _0x398696[_0x774b('0x2f')]('Content-Range',_0x3cab3f+'-'+_0x562726+'/'+_0x50bd07)[_0x774b('0x2a')](_0x568b06);}return null;};}function patchUpdates(_0x2b8754){return function(_0x48814f){try{jsonpatch[_0x774b('0x30')](_0x48814f,_0x2b8754,!![]);}catch(_0x1e388f){return BPromise[_0x774b('0x31')](_0x1e388f);}return _0x48814f[_0x774b('0x32')]();};}function saveUpdates(_0x187010,_0x41600a){return function(_0x5aab1f){if(_0x5aab1f){return _0x5aab1f[_0x774b('0x33')](_0x187010)[_0x774b('0x1e')](function(_0x1ec249){return _0x1ec249;});}return null;};}function removeEntity(_0x1b4aac,_0x7c3f52){return function(_0x501cb4){if(_0x501cb4){return _0x501cb4[_0x774b('0x34')]()[_0x774b('0x1e')](function(){_0x1b4aac[_0x774b('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a5f5e,_0x441378){return function(_0x520e61){if(!_0x520e61){_0x3a5f5e['sendStatus'](0x194);}return _0x520e61;};}function handleError(_0x9f5679,_0x136c26){_0x136c26=_0x136c26||0x1f4;return function(_0x33f2eb){logger['error'](_0x33f2eb[_0x774b('0x35')]);if(_0x33f2eb['name']){delete _0x33f2eb[_0x774b('0x36')];}_0x9f5679[_0x774b('0x29')](_0x136c26)[_0x774b('0x37')](_0x33f2eb);};}exports['index']=function(_0x196df8,_0x1c0144){var _0x2a28cf={},_0x49dd17={},_0x28df4c={'count':0x0,'rows':[]};var _0x11e1d5=_[_0x774b('0x38')](db[_0x774b('0x39')][_0x774b('0x3a')],function(_0x53439f){return{'name':_0x53439f['fieldName'],'type':_0x53439f[_0x774b('0x3b')][_0x774b('0x3c')]};});_0x49dd17[_0x774b('0x3d')]=_[_0x774b('0x38')](_0x11e1d5,_0x774b('0x36'));_0x49dd17[_0x774b('0x3e')]=_[_0x774b('0x3f')](_0x196df8['query']);_0x49dd17[_0x774b('0x40')]=_['intersection'](_0x49dd17[_0x774b('0x3d')],_0x49dd17['query']);_0x2a28cf['attributes']=_[_0x774b('0x41')](_0x49dd17['model'],qs['fields'](_0x196df8[_0x774b('0x3e')][_0x774b('0x42')]));_0x2a28cf[_0x774b('0x43')]=_0x2a28cf[_0x774b('0x43')][_0x774b('0x44')]?_0x2a28cf[_0x774b('0x43')]:_0x49dd17[_0x774b('0x3d')];if(!_0x196df8[_0x774b('0x3e')]['hasOwnProperty'](_0x774b('0x45'))){_0x2a28cf['limit']=qs[_0x774b('0x2d')](_0x196df8[_0x774b('0x3e')]['limit']);_0x2a28cf['offset']=qs[_0x774b('0x2b')](_0x196df8[_0x774b('0x3e')]['offset']);}_0x2a28cf[_0x774b('0x46')]=qs['sort'](_0x196df8[_0x774b('0x3e')][_0x774b('0x47')]);_0x2a28cf[_0x774b('0x48')]=qs[_0x774b('0x40')](_[_0x774b('0x49')](_0x196df8[_0x774b('0x3e')],_0x49dd17[_0x774b('0x40')]),_0x11e1d5);if(_0x196df8['query'][_0x774b('0x4a')]){_0x2a28cf[_0x774b('0x48')]=_[_0x774b('0x4b')](_0x2a28cf[_0x774b('0x48')],{'$or':_[_0x774b('0x38')](_0x11e1d5,function(_0x187395){if(_0x187395['type']!==_0x774b('0x4c')){var _0x40e7e7={};_0x40e7e7[_0x187395['name']]={'$like':'%'+_0x196df8[_0x774b('0x3e')]['filter']+'%'};return _0x40e7e7;}})});}_0x2a28cf=_[_0x774b('0x4b')]({},_0x2a28cf,_0x196df8['options']);var _0x2541e0={'where':_0x2a28cf[_0x774b('0x48')]};return db[_0x774b('0x39')]['count'](_0x2541e0)[_0x774b('0x1e')](function(_0x305bea){_0x28df4c[_0x774b('0x2e')]=_0x305bea;if(_0x196df8['query'][_0x774b('0x4d')]){_0x2a28cf['include']=[{'all':!![]}];}return db[_0x774b('0x39')][_0x774b('0x4e')](_0x2a28cf);})[_0x774b('0x1e')](function(_0x2dbe73){_0x28df4c[_0x774b('0x4f')]=_0x2dbe73;return _0x28df4c;})[_0x774b('0x1e')](respondWithFilteredResult(_0x1c0144,_0x2a28cf))[_0x774b('0x28')](handleError(_0x1c0144,null));};exports[_0x774b('0x50')]=function(_0x87a608,_0x358bea){var _0x48d71c={'raw':!![],'where':{'id':_0x87a608['params']['id']}},_0x18388c={};_0x18388c[_0x774b('0x3d')]=_[_0x774b('0x3f')](db[_0x774b('0x39')][_0x774b('0x3a')]);_0x18388c[_0x774b('0x3e')]=_['keys'](_0x87a608[_0x774b('0x3e')]);_0x18388c[_0x774b('0x40')]=_[_0x774b('0x41')](_0x18388c[_0x774b('0x3d')],_0x18388c[_0x774b('0x3e')]);_0x48d71c['attributes']=_[_0x774b('0x41')](_0x18388c[_0x774b('0x3d')],qs[_0x774b('0x42')](_0x87a608[_0x774b('0x3e')]['fields']));_0x48d71c[_0x774b('0x43')]=_0x48d71c[_0x774b('0x43')][_0x774b('0x44')]?_0x48d71c[_0x774b('0x43')]:_0x18388c[_0x774b('0x3d')];if(_0x87a608[_0x774b('0x3e')][_0x774b('0x4d')]){_0x48d71c['include']=[{'all':!![]}];}_0x48d71c=_[_0x774b('0x4b')]({},_0x48d71c,_0x87a608['options']);return db[_0x774b('0x39')][_0x774b('0x51')](_0x48d71c)[_0x774b('0x1e')](handleEntityNotFound(_0x358bea,null))[_0x774b('0x1e')](respondWithResult(_0x358bea,null))['catch'](handleError(_0x358bea,null));};exports[_0x774b('0x52')]=function(_0x18f7ef,_0x5589db){return db['SmsMessage'][_0x774b('0x52')](_0x18f7ef['body'],{})[_0x774b('0x1e')](respondWithResult(_0x5589db,0xc9))['catch'](handleError(_0x5589db,null));};exports[_0x774b('0x33')]=function(_0x41e24c,_0x1c3f44){if(_0x41e24c[_0x774b('0x53')]['id']){delete _0x41e24c['body']['id'];}return db[_0x774b('0x39')][_0x774b('0x51')]({'where':{'id':_0x41e24c[_0x774b('0x54')]['id']}})[_0x774b('0x1e')](handleEntityNotFound(_0x1c3f44,null))[_0x774b('0x1e')](saveUpdates(_0x41e24c['body'],null))[_0x774b('0x1e')](respondWithResult(_0x1c3f44,null))[_0x774b('0x28')](handleError(_0x1c3f44,null));};exports[_0x774b('0x34')]=function(_0x2ebc71,_0x4fd732){return db['SmsMessage'][_0x774b('0x51')]({'where':{'id':_0x2ebc71[_0x774b('0x54')]['id']}})[_0x774b('0x1e')](handleEntityNotFound(_0x4fd732,null))[_0x774b('0x1e')](removeEntity(_0x4fd732,null))['catch'](handleError(_0x4fd732,null));};exports[_0x774b('0x55')]=function(_0x4f9e2a,_0x5473c8){return db[_0x774b('0x39')][_0x774b('0x55')]()['then'](respondWithResult(_0x5473c8,null))[_0x774b('0x28')](handleError(_0x5473c8,null));};var interaction_log=require(_0x774b('0x56'))(_0x774b('0x57'));exports[_0x774b('0x58')]=function(_0x2d0295,_0x1e5e69,_0x261e1a){var _0x101af6={'agent':{},'channel':_0x774b('0x59')};if(_0x2d0295[_0x774b('0x53')]['id']){delete _0x2d0295[_0x774b('0x53')]['id'];}_0x2d0295[_0x774b('0x53')][_0x774b('0x5a')]=!![];_0x2d0295[_0x774b('0x53')][_0x774b('0x5b')]=moment()[_0x774b('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x2d0295['body'][_0x774b('0x5d')]=_0x2d0295[_0x774b('0x53')][_0x774b('0x5d')]||_0x2d0295[_0x774b('0x5e')]['id'];_0x101af6['agent']['id']=_0x2d0295['body'][_0x774b('0x5d')];return db[_0x774b('0x39')]['find']({'where':{'id':_0x2d0295[_0x774b('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x774b('0x1e')](handleEntityNotFound(_0x1e5e69,null))[_0x774b('0x1e')](saveUpdates(_0x2d0295[_0x774b('0x53')],null))[_0x774b('0x1e')](function(_0x294cc8){if(_0x294cc8){_0x101af6['message']=_0x294cc8['get']({'plain':!![]});return db['SmsInteraction'][_0x774b('0x51')]({'where':{'id':_0x294cc8['SmsInteractionId']}});}return null;})[_0x774b('0x1e')](handleEntityNotFound(_0x1e5e69,null))[_0x774b('0x1e')](function(_0x64738d){if(_0x64738d){return _0x64738d[_0x774b('0x33')]({'UserId':_0x2d0295['body'][_0x774b('0x5d')],'read1stAt':_['isNil'](_0x64738d['read1stAt'])?moment()[_0x774b('0x5c')](_0x774b('0x5f')):undefined});}return null;})[_0x774b('0x1e')](function(_0x593fde){if(_0x593fde){_0x101af6['interaction']=_0x593fde[_0x774b('0x60')]({'plain':!![]});interaction_log['info'](_0x774b('0x61'),_0x2d0295[_0x774b('0x5e')]['id'],_0x2d0295['user'][_0x774b('0x36')],_0x2d0295[_0x774b('0x5e')][_0x774b('0x62')],_0x101af6[_0x774b('0x63')]['id'],_0x2d0295[_0x774b('0x53')]?JSON[_0x774b('0x22')](_0x2d0295[_0x774b('0x53')]):_0x774b('0x64'));return respondWithRpcPromise(_0x774b('0x65'),'acceptMessage',_0x101af6);}return null;})[_0x774b('0x1e')](function(_0x29a6b1){return db[_0x774b('0x66')][_0x774b('0x55')]()[_0x774b('0x1e')](function(_0x3190eb){var _0x28769c=[];for(var _0x3deb17=0x0;_0x3deb17=0x0){return _0x2f65e0[_0x774b('0x33')]({'read':!![]});}else{logger[_0x774b('0x23')](_0x774b('0x7f'),_0x774b('0x29'),_0x774b('0x85'),util[_0x774b('0x7c')](_0x4fbbfc[_0x774b('0x53')],{'showHidden':![],'depth':null}));}break;case _0x774b('0x86'):var _0x41a02f=_0x4fbbfc[_0x774b('0x53')]['results'][0x0];if(_0x41a02f[_0x774b('0x29')][_0x774b('0x87')]===_0x774b('0x88')){return _0x2f65e0[_0x774b('0x33')]({'read':!![]});}else{logger['error'](_0x774b('0x7f'),_0x774b('0x29'),_0x774b('0x86'),util['inspect'](_0x4fbbfc['body'],{'showHidden':![],'depth':null}));}break;}return _0x2f65e0;}})[_0x774b('0x1e')](respondWithResult(_0x293531,null))[_0x774b('0x28')](handleError(_0x293531,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index cc3efd0..edf631b 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 _0xa517=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xa517,0x10d));var _0x7a51=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0xa517[_0x24f326];return _0x488e2d;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x7a51('0x0'))['db'][_0x7a51('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7a51('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7a51('0x3')};function emitEvent(_0x3bff7b){return function(_0x41bcbb,_0x478bd0,_0x1f044d){SmsMessageEvents[_0x7a51('0x4')](_0x3bff7b+':'+_0x41bcbb['id'],_0x41bcbb);SmsMessageEvents[_0x7a51('0x4')](_0x3bff7b,_0x41bcbb);_0x1f044d(null);};}for(var e in events){if(events[_0x7a51('0x5')](e)){var event=events[e];SmsMessage[_0x7a51('0x6')](e,emitEvent(event));}}module[_0x7a51('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xe364=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5dcb2f,_0x402ca3){var _0x2cf625=function(_0x3792e4){while(--_0x3792e4){_0x5dcb2f['push'](_0x5dcb2f['shift']());}};_0x2cf625(++_0x402ca3);}(_0xe364,0xbc));var _0x4e36=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xe364[_0x4c0622];return _0x1799d8;};'use strict';var EventEmitter=require(_0x4e36('0x0'));var SmsMessage=require(_0x4e36('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4e36('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4e36('0x3'),'afterDestroy':_0x4e36('0x4')};function emitEvent(_0x114cc6){return function(_0x2ce212,_0x5351f4,_0x8a5229){SmsMessageEvents[_0x4e36('0x5')](_0x114cc6+':'+_0x2ce212['id'],_0x2ce212);SmsMessageEvents[_0x4e36('0x5')](_0x114cc6,_0x2ce212);_0x8a5229(null);};}for(var e in events){if(events[_0x4e36('0x6')](e)){var event=events[e];SmsMessage[_0x4e36('0x7')](e,emitEvent(event));}}module[_0x4e36('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 02b0bca..fa9af44 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 _0x7f35=['path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','update','createdAt','catch','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','sid','SmsMessage,\x20%s,\x20%s,\x20%s','error','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','xCALLY\x20Motion','%s:%s','format','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','remote','token','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/api/sms/messages/','/status?token=','application/json','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','apiKey','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4b2e4e,_0x33c7d7){var _0x50b8a1=function(_0x35796f){while(--_0x35796f){_0x4b2e4e['push'](_0x4b2e4e['shift']());}};_0x50b8a1(++_0x33c7d7);}(_0x7f35,0x7a));var _0x57f3=function(_0x18c155,_0x3878e7){_0x18c155=_0x18c155-0x0;var _0x442786=_0x7f35[_0x18c155];return _0x442786;};'use strict';var _=require(_0x57f3('0x0'));var util=require(_0x57f3('0x1'));var logger=require('../../config/logger')(_0x57f3('0x2'));var moment=require(_0x57f3('0x3'));var BPromise=require(_0x57f3('0x4'));var rp=require(_0x57f3('0x5'));var fs=require('fs');var path=require(_0x57f3('0x6'));var rimraf=require(_0x57f3('0x7'));var config=require(_0x57f3('0x8'));var attributes=require(_0x57f3('0x9'));module[_0x57f3('0xa')]=function(_0x1c9952,_0x564345){return _0x1c9952[_0x57f3('0xb')](_0x57f3('0xc'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x57f3('0xd')]},{'name':_0x57f3('0xe'),'fields':[_0x57f3('0xf')],'type':_0x57f3('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2907ae,_0x2899c1,_0x409d5d){var _0x11f49a=_0x1c9952[_0x57f3('0x11')];var _0x5bd59d=_0x2907ae[_0x57f3('0x12')]({'plain':!![]});if(_0x5bd59d[_0x57f3('0x13')][_0x57f3('0x14')]()==='in'||_0x5bd59d['direction'][_0x57f3('0x14')]()===_0x57f3('0x15')&&!_0x5bd59d[_0x57f3('0x16')]&&!_[_0x57f3('0x17')](_0x5bd59d[_0x57f3('0x18')])){_0x11f49a[_0x57f3('0x19')]['findOne']({'where':{'id':_0x5bd59d[_0x57f3('0x1a')]}})['then'](function(_0x66e0c2){if(_0x66e0c2){_0x66e0c2[_0x57f3('0x1b')]({'lastMsgAt':_0x5bd59d[_0x57f3('0x1c')],'lastMsgDirection':_0x5bd59d['direction'][_0x57f3('0x14')]()});}})[_0x57f3('0x1d')](function(_0x310d3d){console['error'](_0x310d3d);});}if(_0x5bd59d[_0x57f3('0x13')]===_0x57f3('0x15')&&!_0x5bd59d[_0x57f3('0x16')]){var _0x38c542;_0x11f49a[_0x57f3('0x1e')][_0x57f3('0x1f')]({'where':{'id':_0x5bd59d[_0x57f3('0x20')]},'raw':!![]})[_0x57f3('0x21')](function(_0x4c8a27){_0x38c542=_0x4c8a27;if(_0x38c542&&_0x38c542[_0x57f3('0x22')]){switch(_0x38c542[_0x57f3('0x22')]){case _0x57f3('0x23'):var _0xf57303=require(_0x57f3('0x23'));if(_0x38c542[_0x57f3('0x24')]&&_0x38c542[_0x57f3('0x25')]&&_0x38c542[_0x57f3('0x26')]){var _0x4501fa=new _0xf57303(_0x38c542[_0x57f3('0x24')],_0x38c542[_0x57f3('0x25')]);_0x4501fa['messages']['create']({'body':_0x5bd59d[_0x57f3('0xf')],'to':_0x5bd59d[_0x57f3('0x26')],'from':_0x38c542['phone'],'statusCallback':_0x38c542['remote']+'/api/sms/messages/'+_0x5bd59d['id']+'/status?token='+_0x38c542['token']})['then'](function(_0x190574){if(_0x190574[_0x57f3('0x27')]){return _0x2907ae['update']({'messageId':_0x190574['sid']});}})[_0x57f3('0x1d')](function(_0xfff2fe){logger['error'](_0x57f3('0x28'),'afterCreate',_0x57f3('0x23'),util['inspect'](_0xfff2fe,{'showHidden':![],'depth':null}));});}else{logger[_0x57f3('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x57f3('0x2a'),_0x57f3('0x23'),_0x57f3('0x2b'));}break;case _0x57f3('0x2c'):var _0x2a7091=_0x57f3('0x2d');if(_0x38c542[_0x57f3('0x2e')]&&_0x38c542[_0x57f3('0x2f')]){var _0x1f0823={'recipient':[_0x5bd59d['phone']],'message':_0x5bd59d['body'],'message_type':_0x38c542[_0x57f3('0x30')]};if(_0x38c542[_0x57f3('0x30')]&&_0x38c542[_0x57f3('0x30')]!=='SI'){_0x1f0823[_0x57f3('0x31')]=_0x38c542[_0x57f3('0x26')];}var _0x1baea2={'url':_0x2a7091+_0x57f3('0x32')+_0x38c542['username']+_0x57f3('0x33')+_0x38c542[_0x57f3('0x2f')],'method':'GET'};rp(_0x1baea2)['then'](function(_0x205d66){var _0x1f479c=_0x205d66[_0x57f3('0x34')](';');var _0x381644={'user_key':_0x1f479c[0x0],'session_key':_0x1f479c[0x1]};_0x1baea2={'url':_0x2a7091+_0x57f3('0x35'),'method':_0x57f3('0x36'),'headers':{'user_key':_0x381644[_0x57f3('0x37')],'Session_key':_0x381644[_0x57f3('0x38')]},'json':!![],'body':_0x1f0823};return rp(_0x1baea2);})[_0x57f3('0x21')](function(_0xbd62a1){if(_0xbd62a1[_0x57f3('0x39')]>=0x1){var _0xc77100={'messageId':_0xbd62a1[_0x57f3('0x3a')]};if(_0x38c542[_0x57f3('0x30')]!=='GP'||!_0x38c542[_0x57f3('0x3b')]){_0xc77100[_0x57f3('0x3c')]=!![];}return _0x2907ae['update'](_0xc77100);}else{return logger[_0x57f3('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x57f3('0x2a'),_0x57f3('0x2c'),util[_0x57f3('0x3d')](_0xbd62a1,{'showHidden':![],'depth':null}));}})[_0x57f3('0x1d')](function(_0x2892ab){return logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),_0x57f3('0x2c'),util[_0x57f3('0x3d')](_0x2892ab,{'showHidden':![],'depth':null}));});}else{logger[_0x57f3('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',_0x57f3('0x3e'));}break;case _0x57f3('0x3f'):if(_0x38c542[_0x57f3('0x25')]){var _0x2bd132={'recipient':_0x5bd59d['phone'],'message':_0x5bd59d['body'],'sender':_0x38c542[_0x57f3('0x40')]||_0x38c542['phone'],'authorization':_0x38c542[_0x57f3('0x25')]};var _0x2899c1={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x2bd132,'json':!![]};rp(_0x2899c1)[_0x57f3('0x21')](function(_0x2d7810){var _0x55fe19={'messageId':_0x2d7810[_0x57f3('0x41')]};if(!_0x38c542['deliveryReport']){_0x55fe19[_0x57f3('0x3c')]=!![];}return _0x2907ae[_0x57f3('0x1b')](_0x55fe19);})[_0x57f3('0x1d')](function(_0x2f1fe6){logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),_0x57f3('0x3f'),util[_0x57f3('0x3d')](_0x2f1fe6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x57f3('0x28'),_0x57f3('0x2a'),_0x57f3('0x3f'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x38c542['username']&&_0x38c542[_0x57f3('0x2f')]){var _0x2bd132={'messages':[{'source':_0x57f3('0x42'),'to':_0x5bd59d[_0x57f3('0x26')],'body':_0x5bd59d['body'],'from':_0x38c542[_0x57f3('0x40')]||_0x38c542[_0x57f3('0x26')]}]};var _0x2d4daa=util['format'](_0x57f3('0x43'),_0x38c542[_0x57f3('0x2e')],_0x38c542[_0x57f3('0x2f')]);var _0x2899c1={'method':_0x57f3('0x36'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x2bd132,'headers':{'Authorization':util[_0x57f3('0x44')]('Basic\x20%s',new Buffer(_0x2d4daa)['toString'](_0x57f3('0x45')))},'json':!![]};rp(_0x2899c1)['then'](function(_0x5856dc){if(_0x5856dc[_0x57f3('0x46')]>=0xc8&&_0x5856dc[_0x57f3('0x46')]<=0xce){if(_0x5856dc[_0x57f3('0x47')]&&_0x5856dc[_0x57f3('0x47')][_0x57f3('0x48')]>0x0){var _0x5b8169=_[_0x57f3('0x49')](_0x5856dc['data'][_0x57f3('0x4a')]);var _0xf2ca6a={'messageId':_0x5b8169[_0x57f3('0x4b')]};if(!_0x38c542[_0x57f3('0x3b')]){_0xf2ca6a[_0x57f3('0x3c')]=!![];}return _0x2907ae[_0x57f3('0x1b')](_0xf2ca6a);}else{logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),_0x57f3('0x4c'),util[_0x57f3('0x3d')](_0x5856dc,{'showHidden':![],'depth':null}));}}else{logger[_0x57f3('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x57f3('0x2a'),_0x57f3('0x4c'),util[_0x57f3('0x3d')](_0x5856dc,{'showHidden':![],'depth':null}));}})['catch'](function(_0x24ea5f){logger[_0x57f3('0x29')](_0x57f3('0x28'),'afterCreate',_0x57f3('0x4c'),util[_0x57f3('0x3d')](_0x24ea5f,{'showHidden':![],'depth':null}));});}else{logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),_0x57f3('0x4c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x57f3('0x4d'):if(_0x38c542[_0x57f3('0x4e')]&&_0x38c542[_0x57f3('0x25')]){var _0x2bd132={'dst':_0x5bd59d[_0x57f3('0x26')],'text':_0x5bd59d[_0x57f3('0xf')],'src':_0x38c542[_0x57f3('0x40')]||_0x38c542[_0x57f3('0x26')],'url':_0x38c542[_0x57f3('0x4f')]+'/api/sms/messages/'+_0x5bd59d['id']+'/status?token='+_0x38c542[_0x57f3('0x50')]};var _0x2d4daa=util[_0x57f3('0x44')](_0x57f3('0x43'),_0x38c542['authId'],_0x38c542[_0x57f3('0x25')]);var _0x2899c1={'method':_0x57f3('0x36'),'uri':util[_0x57f3('0x44')](_0x57f3('0x51'),_0x38c542[_0x57f3('0x4e')]),'body':_0x2bd132,'headers':{'Authorization':util['format'](_0x57f3('0x52'),new Buffer(_0x2d4daa)[_0x57f3('0x53')](_0x57f3('0x45')))},'json':!![]};rp(_0x2899c1)[_0x57f3('0x21')](function(_0x2ac286){var _0x177898={'messageId':_0x2ac286[_0x57f3('0x54')][0x0]};return _0x2907ae[_0x57f3('0x1b')](_0x177898);})[_0x57f3('0x1d')](function(_0x569d08){logger['error'](_0x57f3('0x28'),_0x57f3('0x2a'),'plivo',util[_0x57f3('0x3d')](_0x569d08,{'showHidden':![],'depth':null}));});}else{logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),'plivo',_0x57f3('0x55'));}break;case _0x57f3('0x56'):if(_0x38c542['username']&&_0x38c542[_0x57f3('0x2f')]){if(_0x38c542['baseUrl']){var _0x282969={'method':'POST','uri':_0x38c542[_0x57f3('0x57')]+_0x57f3('0x58'),'body':{'username':_0x38c542[_0x57f3('0x2e')],'password':_0x38c542['password']},'json':!![]};return rp(_0x282969)[_0x57f3('0x21')](function(_0x2a6e52){var _0x596894={'method':_0x57f3('0x36'),'uri':_0x38c542['baseUrl']+_0x57f3('0x59'),'body':{'messages':[{'from':_0x38c542[_0x57f3('0x26')],'destinations':[{'to':_0x5bd59d[_0x57f3('0x26')]}],'text':_0x5bd59d[_0x57f3('0xf')],'notifyUrl':_0x38c542[_0x57f3('0x4f')]+_0x57f3('0x5a')+_0x5bd59d['id']+_0x57f3('0x5b')+_0x38c542[_0x57f3('0x50')],'notifyContentType':_0x57f3('0x5c'),'callbackData':_0x38c542[_0x57f3('0x26')]+';'+_0x5bd59d[_0x57f3('0xf')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x2a6e52[_0x57f3('0x50')]},'json':!![]};return rp(_0x596894)[_0x57f3('0x21')](function(_0x268c0d){if(_0x268c0d['messages']){var _0x377db0={'messageId':_0x268c0d[_0x57f3('0x4a')][0x0][_0x57f3('0xd')]};if(!_0x38c542[_0x57f3('0x3b')]){_0x377db0[_0x57f3('0x3c')]=!![];}return _0x2907ae['update'](_0x377db0);}else{return logger[_0x57f3('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x57f3('0x2a'),_0x57f3('0x56'),util[_0x57f3('0x3d')](_0x268c0d,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x536f9d){return logger[_0x57f3('0x29')](_0x57f3('0x28'),'afterCreate','infobip',util[_0x57f3('0x3d')](_0x536f9d,{'showHidden':![],'depth':null}));});}else{logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),'infobip',_0x57f3('0x5d'));}}else{logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),_0x57f3('0x56'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x57f3('0x5e'):var _0x3a1d38=require(_0x57f3('0x5f'));if(_0x38c542['apiKey']){var _0x42d668={};_0x42d668[_0x57f3('0x60')]=_0x38c542[_0x57f3('0x2e')];_0x42d668[_0x57f3('0x26')]=_0x5bd59d[_0x57f3('0x26')];_0x42d668[_0x57f3('0x31')]=_0x38c542['phone'];_0x42d668[_0x57f3('0x61')]=_0x5bd59d[_0x57f3('0xf')];_0x42d668[_0x57f3('0x62')]=+new Date();var _0x406fc2='';var _0x4c6156='';var _0x1fb50e=Object[_0x57f3('0x63')](_0x42d668);_0x1fb50e[_0x57f3('0x64')]();for(var _0x48ff23=0x0;_0x48ff23<_0x1fb50e[_0x57f3('0x65')];_0x48ff23++){if(_0x406fc2!=''){_0x406fc2+='&';}_0x406fc2+=_0x1fb50e[_0x48ff23]+'='+encodeURIComponent(_0x42d668[_0x1fb50e[_0x48ff23]]);_0x4c6156+=_0x42d668[_0x1fb50e[_0x48ff23]];}_0x4c6156+=_0x38c542['apiKey'];_0x4c6156=_0x3a1d38[_0x57f3('0x66')](_0x57f3('0x67'))['update'](_0x4c6156)[_0x57f3('0x68')](_0x57f3('0x69'));if(_0x406fc2!==''){_0x406fc2+='&';}_0x406fc2+=_0x57f3('0x6a')+_0x4c6156;var _0x1baea2={'method':_0x57f3('0x6b'),'uri':_0x38c542[_0x57f3('0x57')]+_0x57f3('0x6c')+_0x406fc2,'json':!![]};return rp(_0x1baea2)[_0x57f3('0x21')](function(_0xc7b135){var _0x3c4986=Object[_0x57f3('0x63')](_0xc7b135);if(_0xc7b135[_0x3c4986[0x0]][_0x57f3('0x29')]&&parseInt(_0xc7b135[_0x3c4986[0x0]]['error'])===0x0){var _0x12a8f8={'messageId':_0xc7b135[_0x3c4986[0x0]][_0x57f3('0x6d')]};if(!_0x38c542['deliveryReport']){_0x12a8f8[_0x57f3('0x3c')]=!![];}return _0x2907ae[_0x57f3('0x1b')](_0x12a8f8);}else{return logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),_0x57f3('0x5e'),util[_0x57f3('0x3d')](_0xc7b135[_0x57f3('0x29')],{'showHidden':![],'depth':null}));}})[_0x57f3('0x1d')](function(_0x4f9b12){return logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),_0x57f3('0x5e'),util[_0x57f3('0x3d')](_0x4f9b12,{'showHidden':![],'depth':null}));});}else{logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),_0x57f3('0x5e'),_0x57f3('0x6e'));}break;case _0x57f3('0x6f'):if(_0x38c542['apiKey']){var _0x4d5c22={'method':_0x57f3('0x36'),'uri':_0x57f3('0x70'),'headers':{'Authorization':_0x38c542[_0x57f3('0x71')]},'body':{'content':_0x5bd59d[_0x57f3('0xf')],'to':[_0x5bd59d['phone']],'from':_0x38c542['phone'],'binary':![],'clientMessageId':_0x57f3('0x72'),'charset':_0x57f3('0x73')},'json':!![]};rp(_0x4d5c22)[_0x57f3('0x21')](function(_0x2ed230){if(!_0x2ed230[_0x57f3('0x29')]){var _0x5f497a={'messageId':_0x2ed230['messages'][0x0][_0x57f3('0x74')]};if(!_0x38c542[_0x57f3('0x3b')]){_0x5f497a[_0x57f3('0x3c')]=!![];}return _0x2907ae['update'](_0x5f497a);}else{return logger[_0x57f3('0x29')](_0x57f3('0x28'),'afterCreate',_0x57f3('0x6f'),util[_0x57f3('0x3d')](_0x2ed230[_0x57f3('0x29')],{'showHidden':![],'depth':null}));}})[_0x57f3('0x1d')](function(_0xb91a62){return logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),_0x57f3('0x6f'),util[_0x57f3('0x3d')](_0xb91a62,{'showHidden':![],'depth':null}));});}else{logger[_0x57f3('0x29')](_0x57f3('0x28'),'afterCreate',_0x57f3('0x6f'),_0x57f3('0x6e'));}break;case _0x57f3('0x75'):if(_0x38c542[_0x57f3('0x2e')]&&_0x38c542[_0x57f3('0x2f')]){var _0x2d4daa=util[_0x57f3('0x44')](_0x57f3('0x43'),_0x38c542['username'],_0x38c542['password']);var _0x2899c1={'method':_0x57f3('0x36'),'uri':_0x57f3('0x76')+_0x38c542['accountId']+'/messages','body':{'to':[_0x5bd59d[_0x57f3('0x26')]],'text':_0x5bd59d[_0x57f3('0xf')],'from':_0x38c542[_0x57f3('0x26')],'applicationId':_0x38c542['applicationId']},'headers':{'Authorization':util[_0x57f3('0x44')](_0x57f3('0x52'),new Buffer(_0x2d4daa)['toString'](_0x57f3('0x45')))},'json':!![]};rp(_0x2899c1)[_0x57f3('0x21')](function(_0x37e48d){if(_0x37e48d['id']){var _0x4c8e37={'messageId':_0x37e48d['id']};return _0x2907ae[_0x57f3('0x1b')](_0x4c8e37);}else{logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),_0x57f3('0x75'),util[_0x57f3('0x3d')](_0x37e48d,{'showHidden':![],'depth':null}));}})[_0x57f3('0x1d')](function(_0x47167c){logger[_0x57f3('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x57f3('0x2a'),_0x57f3('0x75'),util[_0x57f3('0x3d')](_0x47167c,{'showHidden':![],'depth':null}));});}else{logger[_0x57f3('0x29')](_0x57f3('0x28'),'afterCreate','bandwidth',_0x57f3('0x3e'));}break;case _0x57f3('0x77'):if(_0x38c542['apiKey']){var _0x4c865e={};var _0x1baea2={'method':_0x57f3('0x36'),'uri':_0x57f3('0x78'),'headers':{'Authorization':_0x57f3('0x79')+_0x38c542['apiKey'],'Content-Type':_0x57f3('0x5c')},'body':{'from':_0x38c542[_0x57f3('0x26')],'to':_0x5bd59d[_0x57f3('0x26')],'text':_0x5bd59d[_0x57f3('0xf')]},'json':!![]};return rp(_0x1baea2)[_0x57f3('0x21')](function(_0x351e46){if(_0x351e46['code']==0xca){_0x4c865e[_0x57f3('0x7a')]=_0x351e46;var _0x28e94e={'method':_0x57f3('0x36'),'uri':_0x57f3('0x7b'),'headers':{'Authorization':_0x57f3('0x79')+_0x38c542[_0x57f3('0x71')],'Content-Type':_0x57f3('0x5c')},'body':{'refid':_0x4c865e[_0x57f3('0x7a')][_0x57f3('0x7c')]},'json':!![]};return rp(_0x28e94e)[_0x57f3('0x21')](function(_0x11cfd7){_0x4c865e['status']=_0x11cfd7;var _0x5970e9={'messageId':_0x4c865e['message'][_0x57f3('0x7c')],'read':!![]};return _0x2907ae['update'](_0x5970e9);});}else{return logger[_0x57f3('0x29')](_0x57f3('0x28'),'afterCreate',_0x57f3('0x77'),util[_0x57f3('0x3d')](_0x351e46,{'showHidden':![],'depth':null}));}})[_0x57f3('0x1d')](function(_0x683ec5){return logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),_0x57f3('0x77'),util[_0x57f3('0x3d')](_0x683ec5,{'showHidden':![],'depth':null}));});}else{return logger[_0x57f3('0x29')](_0x57f3('0x28'),_0x57f3('0x2a'),_0x57f3('0x77'),_0x57f3('0x7d'));}break;}}})[_0x57f3('0x7e')](function(){_0x409d5d();});}else{_0x409d5d();}}},'charset':'utf8mb4','collate':_0x57f3('0x7f')});}; \ No newline at end of file +var _0xba17=['../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','createdAt','catch','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','update','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','skebby','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','login','text','timestamp','keys','sort','length','apiKey','createHash','digest','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise'];(function(_0x2f571d,_0x34fe1d){var _0x3ad445=function(_0x11ed6e){while(--_0x11ed6e){_0x2f571d['push'](_0x2f571d['shift']());}};_0x3ad445(++_0x34fe1d);}(_0xba17,0x1e0));var _0x7ba1=function(_0x5c1a9c,_0x36f2c5){_0x5c1a9c=_0x5c1a9c-0x0;var _0x3e16d3=_0xba17[_0x5c1a9c];return _0x3e16d3;};'use strict';var _=require(_0x7ba1('0x0'));var util=require(_0x7ba1('0x1'));var logger=require('../../config/logger')(_0x7ba1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7ba1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7ba1('0x4'));var attributes=require(_0x7ba1('0x5'));module[_0x7ba1('0x6')]=function(_0xb3d457,_0x26d659){return _0xb3d457[_0x7ba1('0x7')]('SmsMessage',attributes,{'tableName':_0x7ba1('0x8'),'paranoid':![],'indexes':[{'name':_0x7ba1('0x9'),'fields':[_0x7ba1('0x9')]},{'name':_0x7ba1('0xa'),'fields':[_0x7ba1('0xb')],'type':_0x7ba1('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x323108,_0x44ac6b,_0x34b598){var _0x563330=_0xb3d457[_0x7ba1('0xd')];var _0x5cbad6=_0x323108[_0x7ba1('0xe')]({'plain':!![]});if(_0x5cbad6[_0x7ba1('0xf')][_0x7ba1('0x10')]()==='in'||_0x5cbad6[_0x7ba1('0xf')][_0x7ba1('0x10')]()==='out'&&!_0x5cbad6[_0x7ba1('0x11')]&&!_[_0x7ba1('0x12')](_0x5cbad6[_0x7ba1('0x13')])){_0x563330[_0x7ba1('0x14')][_0x7ba1('0x15')]({'where':{'id':_0x5cbad6[_0x7ba1('0x16')]}})[_0x7ba1('0x17')](function(_0x42e645){if(_0x42e645){_0x42e645['update']({'lastMsgAt':_0x5cbad6[_0x7ba1('0x18')],'lastMsgDirection':_0x5cbad6[_0x7ba1('0xf')][_0x7ba1('0x10')]()});}})[_0x7ba1('0x19')](function(_0x157482){console[_0x7ba1('0x1a')](_0x157482);});}if(_0x5cbad6[_0x7ba1('0xf')]===_0x7ba1('0x1b')&&!_0x5cbad6[_0x7ba1('0x11')]){var _0x207d0e;_0x563330[_0x7ba1('0x1c')][_0x7ba1('0x1d')]({'where':{'id':_0x5cbad6[_0x7ba1('0x1e')]},'raw':!![]})['then'](function(_0x3ed220){_0x207d0e=_0x3ed220;if(_0x207d0e&&_0x207d0e[_0x7ba1('0x1f')]){switch(_0x207d0e['type']){case _0x7ba1('0x20'):var _0x1a4ec7=require(_0x7ba1('0x20'));if(_0x207d0e[_0x7ba1('0x21')]&&_0x207d0e[_0x7ba1('0x22')]&&_0x207d0e[_0x7ba1('0x23')]){var _0xb38903=new _0x1a4ec7(_0x207d0e[_0x7ba1('0x21')],_0x207d0e['authToken']);_0xb38903[_0x7ba1('0x24')][_0x7ba1('0x25')]({'body':_0x5cbad6[_0x7ba1('0xb')],'to':_0x5cbad6['phone'],'from':_0x207d0e[_0x7ba1('0x23')],'statusCallback':_0x207d0e[_0x7ba1('0x26')]+_0x7ba1('0x27')+_0x5cbad6['id']+_0x7ba1('0x28')+_0x207d0e[_0x7ba1('0x29')]})[_0x7ba1('0x17')](function(_0x4138c2){if(_0x4138c2['sid']){return _0x323108[_0x7ba1('0x2a')]({'messageId':_0x4138c2[_0x7ba1('0x2b')]});}})[_0x7ba1('0x19')](function(_0x3f3a48){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7ba1('0x2c'),'twilio',util[_0x7ba1('0x2d')](_0x3f3a48,{'showHidden':![],'depth':null}));});}else{logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x1e57b1=_0x7ba1('0x2f');if(_0x207d0e['username']&&_0x207d0e[_0x7ba1('0x30')]){var _0x2b4c82={'recipient':[_0x5cbad6[_0x7ba1('0x23')]],'message':_0x5cbad6[_0x7ba1('0xb')],'message_type':_0x207d0e[_0x7ba1('0x31')]};if(_0x207d0e[_0x7ba1('0x31')]&&_0x207d0e[_0x7ba1('0x31')]!=='SI'){_0x2b4c82[_0x7ba1('0x32')]=_0x207d0e[_0x7ba1('0x23')];}var _0xa92840={'url':_0x1e57b1+_0x7ba1('0x33')+_0x207d0e[_0x7ba1('0x34')]+'&password='+_0x207d0e[_0x7ba1('0x30')],'method':_0x7ba1('0x35')};rp(_0xa92840)[_0x7ba1('0x17')](function(_0x3a53c0){var _0x584cb4=_0x3a53c0[_0x7ba1('0x36')](';');var _0xdaa7b4={'user_key':_0x584cb4[0x0],'session_key':_0x584cb4[0x1]};_0xa92840={'url':_0x1e57b1+_0x7ba1('0x37'),'method':_0x7ba1('0x38'),'headers':{'user_key':_0xdaa7b4[_0x7ba1('0x39')],'Session_key':_0xdaa7b4['session_key']},'json':!![],'body':_0x2b4c82};return rp(_0xa92840);})[_0x7ba1('0x17')](function(_0x5478af){if(_0x5478af[_0x7ba1('0x3a')]>=0x1){var _0x4e7868={'messageId':_0x5478af[_0x7ba1('0x3b')]};if(_0x207d0e['smsMethod']!=='GP'||!_0x207d0e[_0x7ba1('0x3c')]){_0x4e7868['read']=!![];}return _0x323108['update'](_0x4e7868);}else{return logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x3d'),util[_0x7ba1('0x2d')](_0x5478af,{'showHidden':![],'depth':null}));}})[_0x7ba1('0x19')](function(_0x1a7ae9){return logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x3d'),util[_0x7ba1('0x2d')](_0x1a7ae9,{'showHidden':![],'depth':null}));});}else{logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x3d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x7ba1('0x3e'):if(_0x207d0e[_0x7ba1('0x22')]){var _0x4fc26d={'recipient':_0x5cbad6[_0x7ba1('0x23')],'message':_0x5cbad6[_0x7ba1('0xb')],'sender':_0x207d0e[_0x7ba1('0x3f')]||_0x207d0e['phone'],'authorization':_0x207d0e[_0x7ba1('0x22')]};var _0x44ac6b={'method':_0x7ba1('0x38'),'uri':_0x7ba1('0x40'),'body':_0x4fc26d,'json':!![]};rp(_0x44ac6b)[_0x7ba1('0x17')](function(_0x2514ec){var _0x3c395f={'messageId':_0x2514ec[_0x7ba1('0x41')]};if(!_0x207d0e[_0x7ba1('0x3c')]){_0x3c395f[_0x7ba1('0x42')]=!![];}return _0x323108[_0x7ba1('0x2a')](_0x3c395f);})['catch'](function(_0x3d9420){logger[_0x7ba1('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7ba1('0x2c'),'connectel',util['inspect'](_0x3d9420,{'showHidden':![],'depth':null}));});}else{logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x3e'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x207d0e[_0x7ba1('0x34')]&&_0x207d0e[_0x7ba1('0x30')]){var _0x4fc26d={'messages':[{'source':_0x7ba1('0x43'),'to':_0x5cbad6['phone'],'body':_0x5cbad6['body'],'from':_0x207d0e['senderString']||_0x207d0e[_0x7ba1('0x23')]}]};var _0x27d421=util[_0x7ba1('0x44')](_0x7ba1('0x45'),_0x207d0e[_0x7ba1('0x34')],_0x207d0e[_0x7ba1('0x30')]);var _0x44ac6b={'method':_0x7ba1('0x38'),'uri':_0x7ba1('0x46'),'body':_0x4fc26d,'headers':{'Authorization':util[_0x7ba1('0x44')](_0x7ba1('0x47'),new Buffer(_0x27d421)[_0x7ba1('0x48')]('base64'))},'json':!![]};rp(_0x44ac6b)['then'](function(_0x5b23c4){if(_0x5b23c4[_0x7ba1('0x49')]>=0xc8&&_0x5b23c4['http_code']<=0xce){if(_0x5b23c4[_0x7ba1('0x4a')]&&_0x5b23c4[_0x7ba1('0x4a')]['queued_count']>0x0){var _0x1b214d=_['head'](_0x5b23c4['data']['messages']);var _0x46dfcd={'messageId':_0x1b214d[_0x7ba1('0x4b')]};if(!_0x207d0e[_0x7ba1('0x3c')]){_0x46dfcd[_0x7ba1('0x42')]=!![];}return _0x323108[_0x7ba1('0x2a')](_0x46dfcd);}else{logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x4c'),util[_0x7ba1('0x2d')](_0x5b23c4,{'showHidden':![],'depth':null}));}}else{logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x4c'),util[_0x7ba1('0x2d')](_0x5b23c4,{'showHidden':![],'depth':null}));}})['catch'](function(_0x162e00){logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x4c'),util[_0x7ba1('0x2d')](_0x162e00,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7ba1('0x2c'),_0x7ba1('0x4c'),_0x7ba1('0x4d'));}break;case _0x7ba1('0x4e'):if(_0x207d0e[_0x7ba1('0x4f')]&&_0x207d0e[_0x7ba1('0x22')]){var _0x4fc26d={'dst':_0x5cbad6[_0x7ba1('0x23')],'text':_0x5cbad6['body'],'src':_0x207d0e[_0x7ba1('0x3f')]||_0x207d0e[_0x7ba1('0x23')],'url':_0x207d0e[_0x7ba1('0x26')]+_0x7ba1('0x27')+_0x5cbad6['id']+_0x7ba1('0x28')+_0x207d0e['token']};var _0x27d421=util['format'](_0x7ba1('0x45'),_0x207d0e['authId'],_0x207d0e['authToken']);var _0x44ac6b={'method':_0x7ba1('0x38'),'uri':util[_0x7ba1('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x207d0e[_0x7ba1('0x4f')]),'body':_0x4fc26d,'headers':{'Authorization':util[_0x7ba1('0x44')]('Basic\x20%s',new Buffer(_0x27d421)[_0x7ba1('0x48')](_0x7ba1('0x50')))},'json':!![]};rp(_0x44ac6b)[_0x7ba1('0x17')](function(_0x1b07f5){var _0x5c9dda={'messageId':_0x1b07f5[_0x7ba1('0x51')][0x0]};return _0x323108[_0x7ba1('0x2a')](_0x5c9dda);})[_0x7ba1('0x19')](function(_0x2da1ff){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7ba1('0x2c'),_0x7ba1('0x4e'),util[_0x7ba1('0x2d')](_0x2da1ff,{'showHidden':![],'depth':null}));});}else{logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),'plivo',_0x7ba1('0x52'));}break;case _0x7ba1('0x53'):if(_0x207d0e[_0x7ba1('0x34')]&&_0x207d0e[_0x7ba1('0x30')]){if(_0x207d0e[_0x7ba1('0x54')]){var _0x58b08e={'method':_0x7ba1('0x38'),'uri':_0x207d0e[_0x7ba1('0x54')]+_0x7ba1('0x55'),'body':{'username':_0x207d0e[_0x7ba1('0x34')],'password':_0x207d0e[_0x7ba1('0x30')]},'json':!![]};return rp(_0x58b08e)[_0x7ba1('0x17')](function(_0x58971b){var _0x23d1a6={'method':_0x7ba1('0x38'),'uri':_0x207d0e[_0x7ba1('0x54')]+_0x7ba1('0x56'),'body':{'messages':[{'from':_0x207d0e['phone'],'destinations':[{'to':_0x5cbad6[_0x7ba1('0x23')]}],'text':_0x5cbad6['body'],'notifyUrl':_0x207d0e[_0x7ba1('0x26')]+_0x7ba1('0x27')+_0x5cbad6['id']+_0x7ba1('0x28')+_0x207d0e[_0x7ba1('0x29')],'notifyContentType':_0x7ba1('0x57'),'callbackData':_0x207d0e[_0x7ba1('0x23')]+';'+_0x5cbad6[_0x7ba1('0xb')]}]},'headers':{'Authorization':_0x7ba1('0x58')+_0x58971b[_0x7ba1('0x29')]},'json':!![]};return rp(_0x23d1a6)[_0x7ba1('0x17')](function(_0x4ae743){if(_0x4ae743[_0x7ba1('0x24')]){var _0x8e49d1={'messageId':_0x4ae743[_0x7ba1('0x24')][0x0][_0x7ba1('0x9')]};if(!_0x207d0e[_0x7ba1('0x3c')]){_0x8e49d1[_0x7ba1('0x42')]=!![];}return _0x323108['update'](_0x8e49d1);}else{return logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x53'),util[_0x7ba1('0x2d')](_0x4ae743,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x2f09d0){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7ba1('0x2c'),_0x7ba1('0x53'),util[_0x7ba1('0x2d')](_0x2f09d0,{'showHidden':![],'depth':null}));});}else{logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x53'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),'infobip',_0x7ba1('0x4d'));}break;case _0x7ba1('0x59'):var _0x485348=require(_0x7ba1('0x5a'));if(_0x207d0e['apiKey']){var _0x2bc4ad={};_0x2bc4ad[_0x7ba1('0x5b')]=_0x207d0e[_0x7ba1('0x34')];_0x2bc4ad[_0x7ba1('0x23')]=_0x5cbad6['phone'];_0x2bc4ad['sender']=_0x207d0e[_0x7ba1('0x23')];_0x2bc4ad[_0x7ba1('0x5c')]=_0x5cbad6[_0x7ba1('0xb')];_0x2bc4ad[_0x7ba1('0x5d')]=+new Date();var _0x7bda08='';var _0x562945='';var _0x50f92d=Object[_0x7ba1('0x5e')](_0x2bc4ad);_0x50f92d[_0x7ba1('0x5f')]();for(var _0x143d5c=0x0;_0x143d5c<_0x50f92d[_0x7ba1('0x60')];_0x143d5c++){if(_0x7bda08!=''){_0x7bda08+='&';}_0x7bda08+=_0x50f92d[_0x143d5c]+'='+encodeURIComponent(_0x2bc4ad[_0x50f92d[_0x143d5c]]);_0x562945+=_0x2bc4ad[_0x50f92d[_0x143d5c]];}_0x562945+=_0x207d0e[_0x7ba1('0x61')];_0x562945=_0x485348[_0x7ba1('0x62')]('md5')[_0x7ba1('0x2a')](_0x562945)[_0x7ba1('0x63')]('hex');if(_0x7bda08!==''){_0x7bda08+='&';}_0x7bda08+=_0x7ba1('0x64')+_0x562945;var _0xa92840={'method':_0x7ba1('0x35'),'uri':_0x207d0e[_0x7ba1('0x54')]+_0x7ba1('0x65')+_0x7bda08,'json':!![]};return rp(_0xa92840)['then'](function(_0x1e17cc){var _0xd879f6=Object[_0x7ba1('0x5e')](_0x1e17cc);if(_0x1e17cc[_0xd879f6[0x0]][_0x7ba1('0x1a')]&&parseInt(_0x1e17cc[_0xd879f6[0x0]]['error'])===0x0){var _0x441b38={'messageId':_0x1e17cc[_0xd879f6[0x0]]['id_sms']};if(!_0x207d0e[_0x7ba1('0x3c')]){_0x441b38['read']=!![];}return _0x323108[_0x7ba1('0x2a')](_0x441b38);}else{return logger['error'](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x59'),util[_0x7ba1('0x2d')](_0x1e17cc[_0x7ba1('0x1a')],{'showHidden':![],'depth':null}));}})[_0x7ba1('0x19')](function(_0x215358){return logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),'afterCreate',_0x7ba1('0x59'),util[_0x7ba1('0x2d')](_0x215358,{'showHidden':![],'depth':null}));});}else{logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),'afterCreate',_0x7ba1('0x59'),_0x7ba1('0x66'));}break;case'clickatell':if(_0x207d0e[_0x7ba1('0x61')]){var _0x230f6a={'method':_0x7ba1('0x38'),'uri':_0x7ba1('0x67'),'headers':{'Authorization':_0x207d0e[_0x7ba1('0x61')]},'body':{'content':_0x5cbad6[_0x7ba1('0xb')],'to':[_0x5cbad6[_0x7ba1('0x23')]],'from':_0x207d0e[_0x7ba1('0x23')],'binary':![],'clientMessageId':_0x7ba1('0x68'),'charset':_0x7ba1('0x69')},'json':!![]};rp(_0x230f6a)[_0x7ba1('0x17')](function(_0x4adb13){if(!_0x4adb13[_0x7ba1('0x1a')]){var _0x29955d={'messageId':_0x4adb13[_0x7ba1('0x24')][0x0][_0x7ba1('0x6a')]};if(!_0x207d0e[_0x7ba1('0x3c')]){_0x29955d[_0x7ba1('0x42')]=!![];}return _0x323108[_0x7ba1('0x2a')](_0x29955d);}else{return logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x6b'),util['inspect'](_0x4adb13[_0x7ba1('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e853f){return logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),'clickatell',util[_0x7ba1('0x2d')](_0x1e853f,{'showHidden':![],'depth':null}));});}else{logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x6b'),_0x7ba1('0x66'));}break;case _0x7ba1('0x6c'):if(_0x207d0e['username']&&_0x207d0e[_0x7ba1('0x30')]){var _0x27d421=util['format'](_0x7ba1('0x45'),_0x207d0e['username'],_0x207d0e['password']);var _0x44ac6b={'method':_0x7ba1('0x38'),'uri':_0x7ba1('0x6d')+_0x207d0e['accountId']+_0x7ba1('0x6e'),'body':{'to':[_0x5cbad6['phone']],'text':_0x5cbad6[_0x7ba1('0xb')],'from':_0x207d0e[_0x7ba1('0x23')],'applicationId':_0x207d0e[_0x7ba1('0x6f')]},'headers':{'Authorization':util[_0x7ba1('0x44')](_0x7ba1('0x47'),new Buffer(_0x27d421)[_0x7ba1('0x48')](_0x7ba1('0x50')))},'json':!![]};rp(_0x44ac6b)[_0x7ba1('0x17')](function(_0x58dc86){if(_0x58dc86['id']){var _0x37d614={'messageId':_0x58dc86['id']};return _0x323108[_0x7ba1('0x2a')](_0x37d614);}else{logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),'bandwidth',util[_0x7ba1('0x2d')](_0x58dc86,{'showHidden':![],'depth':null}));}})[_0x7ba1('0x19')](function(_0x5dc10e){logger[_0x7ba1('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7ba1('0x6c'),util[_0x7ba1('0x2d')](_0x5dc10e,{'showHidden':![],'depth':null}));});}else{logger[_0x7ba1('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7ba1('0x2c'),_0x7ba1('0x6c'),_0x7ba1('0x4d'));}break;case _0x7ba1('0x70'):if(_0x207d0e[_0x7ba1('0x61')]){var _0x1a67d8={};var _0xa92840={'method':_0x7ba1('0x38'),'uri':_0x7ba1('0x71'),'headers':{'Authorization':'Bearer\x20'+_0x207d0e[_0x7ba1('0x61')],'Content-Type':_0x7ba1('0x57')},'body':{'from':_0x207d0e[_0x7ba1('0x23')],'to':_0x5cbad6['phone'],'text':_0x5cbad6[_0x7ba1('0xb')]},'json':!![]};return rp(_0xa92840)[_0x7ba1('0x17')](function(_0x58f119){if(_0x58f119[_0x7ba1('0x72')]==0xca){_0x1a67d8[_0x7ba1('0x73')]=_0x58f119;var _0x2cd5ec={'method':_0x7ba1('0x38'),'uri':_0x7ba1('0x74'),'headers':{'Authorization':'Bearer\x20'+_0x207d0e[_0x7ba1('0x61')],'Content-Type':'application/json'},'body':{'refid':_0x1a67d8[_0x7ba1('0x73')][_0x7ba1('0x75')]},'json':!![]};return rp(_0x2cd5ec)['then'](function(_0x453561){_0x1a67d8['status']=_0x453561;var _0x49bfe0={'messageId':_0x1a67d8[_0x7ba1('0x73')][_0x7ba1('0x75')],'read':!![]};return _0x323108['update'](_0x49bfe0);});}else{return logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x70'),util[_0x7ba1('0x2d')](_0x58f119,{'showHidden':![],'depth':null}));}})[_0x7ba1('0x19')](function(_0x40156b){return logger[_0x7ba1('0x1a')](_0x7ba1('0x2e'),_0x7ba1('0x2c'),_0x7ba1('0x70'),util[_0x7ba1('0x2d')](_0x40156b,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x7ba1('0x2e'),'afterCreate',_0x7ba1('0x70'),_0x7ba1('0x76'));}break;}}})['finally'](function(){_0x34b598();});}else{_0x34b598();}}},'charset':_0x7ba1('0x77'),'collate':_0x7ba1('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index b450245..3cb381f 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 _0x88d9=['../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','CreateSmsMessage','SmsMessage','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x306a22,_0x2e94a0){var _0x33c184=function(_0x4417de){while(--_0x4417de){_0x306a22['push'](_0x306a22['shift']());}};_0x33c184(++_0x2e94a0);}(_0x88d9,0x95));var _0x988d=function(_0x1628a0,_0xee0659){_0x1628a0=_0x1628a0-0x0;var _0x21374f=_0x88d9[_0x1628a0];return _0x21374f;};'use strict';var _=require('lodash');var util=require(_0x988d('0x0'));var moment=require(_0x988d('0x1'));var BPromise=require(_0x988d('0x2'));var rs=require(_0x988d('0x3'));var fs=require('fs');var Redis=require(_0x988d('0x4'));var db=require(_0x988d('0x5'))['db'];var utils=require(_0x988d('0x6'));var logger=require('../../config/logger')(_0x988d('0x7'));var config=require(_0x988d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x988d('0x9')][_0x988d('0xa')]({'port':0x232a});config[_0x988d('0xb')]=_[_0x988d('0xc')](config['redis'],{'host':_0x988d('0xd'),'port':0x18eb});var socket=require(_0x988d('0xe'))(new Redis(config[_0x988d('0xb')]));require('./smsMessage.socket')[_0x988d('0xf')](socket);function respondWithRpcPromise(_0x1567db,_0x475a4a,_0x4899e0){return new BPromise(function(_0xc276bd,_0x4aa424){return client[_0x988d('0x10')](_0x1567db,_0x4899e0)['then'](function(_0x429568){logger['info'](_0x988d('0x11'),_0x475a4a,_0x988d('0x12'));logger[_0x988d('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x475a4a,'request\x20sent',JSON[_0x988d('0x14')](_0x429568));if(_0x429568[_0x988d('0x15')]){if(_0x429568[_0x988d('0x15')][_0x988d('0x16')]===0x1f4){logger[_0x988d('0x15')](_0x988d('0x11'),_0x475a4a,_0x429568[_0x988d('0x15')][_0x988d('0x17')]);return _0x4aa424(_0x429568[_0x988d('0x15')][_0x988d('0x17')]);}logger[_0x988d('0x15')](_0x988d('0x11'),_0x475a4a,_0x429568['error'][_0x988d('0x17')]);return _0xc276bd(_0x429568['error']['message']);}else{logger[_0x988d('0x18')]('SmsMessage,\x20%s,\x20%s',_0x475a4a,_0x988d('0x12'));_0xc276bd(_0x429568['result']['message']);}})['catch'](function(_0x30b773){logger['error'](_0x988d('0x11'),_0x475a4a,_0x30b773);_0x4aa424(_0x30b773);});});}exports[_0x988d('0x19')]=function(_0x6c09e5){var _0x4a7058=this;return new Promise(function(_0x5a4ff9,_0x554aa2){return db[_0x988d('0x1a')]['create'](_0x6c09e5[_0x988d('0x1b')],{'raw':_0x6c09e5['options']?_0x6c09e5[_0x988d('0x1c')][_0x988d('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x26f865){logger[_0x988d('0x18')](_0x988d('0x19'),_0x6c09e5);logger[_0x988d('0x13')](_0x988d('0x19'),_0x6c09e5,JSON[_0x988d('0x14')](_0x26f865));_0x5a4ff9(_0x26f865);})[_0x988d('0x1e')](function(_0x3d288a){logger[_0x988d('0x15')](_0x988d('0x19'),_0x3d288a[_0x988d('0x17')],_0x6c09e5);_0x554aa2(_0x4a7058['error'](0x1f4,_0x3d288a[_0x988d('0x17')]));});});}; \ No newline at end of file +var _0x4248=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2126f3,_0x986c61){var _0x35079b=function(_0x5e8b2c){while(--_0x5e8b2c){_0x2126f3['push'](_0x2126f3['shift']());}};_0x35079b(++_0x986c61);}(_0x4248,0x14c));var _0x8424=function(_0x4624c4,_0x2620c9){_0x4624c4=_0x4624c4-0x0;var _0x3c0d60=_0x4248[_0x4624c4];return _0x3c0d60;};'use strict';var _=require('lodash');var util=require(_0x8424('0x0'));var moment=require(_0x8424('0x1'));var BPromise=require(_0x8424('0x2'));var rs=require(_0x8424('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8424('0x4'))['db'];var utils=require(_0x8424('0x5'));var logger=require(_0x8424('0x6'))(_0x8424('0x7'));var config=require(_0x8424('0x8'));var jayson=require(_0x8424('0x9'));var client=jayson[_0x8424('0xa')][_0x8424('0xb')]({'port':0x232a});config[_0x8424('0xc')]=_[_0x8424('0xd')](config[_0x8424('0xc')],{'host':_0x8424('0xe'),'port':0x18eb});var socket=require(_0x8424('0xf'))(new Redis(config['redis']));require(_0x8424('0x10'))['register'](socket);function respondWithRpcPromise(_0x56d7f3,_0x4d5bd0,_0xc28c15){return new BPromise(function(_0x383e6,_0x323327){return client[_0x8424('0x11')](_0x56d7f3,_0xc28c15)['then'](function(_0x2bdac7){logger[_0x8424('0x12')](_0x8424('0x13'),_0x4d5bd0,_0x8424('0x14'));logger[_0x8424('0x15')](_0x8424('0x16'),_0x4d5bd0,_0x8424('0x14'),JSON[_0x8424('0x17')](_0x2bdac7));if(_0x2bdac7['error']){if(_0x2bdac7[_0x8424('0x18')]['code']===0x1f4){logger[_0x8424('0x18')](_0x8424('0x13'),_0x4d5bd0,_0x2bdac7['error'][_0x8424('0x19')]);return _0x323327(_0x2bdac7[_0x8424('0x18')][_0x8424('0x19')]);}logger[_0x8424('0x18')](_0x8424('0x13'),_0x4d5bd0,_0x2bdac7['error']['message']);return _0x383e6(_0x2bdac7[_0x8424('0x18')]['message']);}else{logger['info'](_0x8424('0x13'),_0x4d5bd0,_0x8424('0x14'));_0x383e6(_0x2bdac7[_0x8424('0x1a')][_0x8424('0x19')]);}})[_0x8424('0x1b')](function(_0x575a53){logger[_0x8424('0x18')](_0x8424('0x13'),_0x4d5bd0,_0x575a53);_0x323327(_0x575a53);});});}exports['CreateSmsMessage']=function(_0x57b259){var _0x20d688=this;return new Promise(function(_0x2a3912,_0x5cdcf5){return db[_0x8424('0x1c')][_0x8424('0x1d')](_0x57b259[_0x8424('0x1e')],{'raw':_0x57b259['options']?_0x57b259[_0x8424('0x1f')][_0x8424('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x310b55){logger[_0x8424('0x12')](_0x8424('0x21'),_0x57b259);logger['debug'](_0x8424('0x21'),_0x57b259,JSON['stringify'](_0x310b55));_0x2a3912(_0x310b55);})[_0x8424('0x1b')](function(_0x23b96f){logger[_0x8424('0x18')](_0x8424('0x21'),_0x23b96f[_0x8424('0x19')],_0x57b259);_0x5cdcf5(_0x20d688['error'](0x1f4,_0x23b96f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 22258d0..0cf32a7 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 _0xeb2b=['emit','removeListener','register','length','smsMessage:','./smsMessage.events'];(function(_0x2efb96,_0x40a4ce){var _0x50d38d=function(_0x22eaa9){while(--_0x22eaa9){_0x2efb96['push'](_0x2efb96['shift']());}};_0x50d38d(++_0x40a4ce);}(_0xeb2b,0x191));var _0xbeb2=function(_0x21a9fe,_0x304223){_0x21a9fe=_0x21a9fe-0x0;var _0x41ea26=_0xeb2b[_0x21a9fe];return _0x41ea26;};'use strict';var SmsMessageEvents=require(_0xbeb2('0x0'));var events=['save','remove','update'];function createListener(_0x1bd210,_0x182eb0){return function(_0x30bc6b){_0x182eb0[_0xbeb2('0x1')](_0x1bd210,_0x30bc6b);};}function removeListener(_0x176a41,_0x26e983){return function(){SmsMessageEvents[_0xbeb2('0x2')](_0x176a41,_0x26e983);};}exports[_0xbeb2('0x3')]=function(_0x56d331){for(var _0x18a05a=0x0,_0x23446c=events[_0xbeb2('0x4')];_0x18a05a<_0x23446c;_0x18a05a++){var _0x209041=events[_0x18a05a];var _0x531ad7=createListener(_0xbeb2('0x5')+_0x209041,_0x56d331);SmsMessageEvents['on'](_0x209041,_0x531ad7);}}; \ No newline at end of file +var _0xd249=['register','smsMessage:','./smsMessage.events','save','remove','update','removeListener'];(function(_0x20c4e0,_0x2a95c){var _0x1d7b02=function(_0x1bde03){while(--_0x1bde03){_0x20c4e0['push'](_0x20c4e0['shift']());}};_0x1d7b02(++_0x2a95c);}(_0xd249,0x18a));var _0x9d24=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0xd249[_0x30033a];return _0x5e3518;};'use strict';var SmsMessageEvents=require(_0x9d24('0x0'));var events=[_0x9d24('0x1'),_0x9d24('0x2'),_0x9d24('0x3')];function createListener(_0x2882fa,_0x208757){return function(_0x244181){_0x208757['emit'](_0x2882fa,_0x244181);};}function removeListener(_0xed7d94,_0xa794ad){return function(){SmsMessageEvents[_0x9d24('0x4')](_0xed7d94,_0xa794ad);};}exports[_0x9d24('0x5')]=function(_0x38ce4c){for(var _0x4ef659=0x0,_0x13ab75=events['length'];_0x4ef659<_0x13ab75;_0x4ef659++){var _0x2b8bec=events[_0x4ef659];var _0x597c03=createListener(_0x9d24('0x6')+_0x2b8bec,_0x38ce4c);SmsMessageEvents['on'](_0x2b8bec,_0x597c03);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e0f2412..7aa02e2 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 _0x51ac=['getTeams','/:id/users','getAgents','create','post','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams'];(function(_0x1328cd,_0x1b6578){var _0x2afd03=function(_0x2f3470){while(--_0x2f3470){_0x1328cd['push'](_0x1328cd['shift']());}};_0x2afd03(++_0x1b6578);}(_0x51ac,0xfd));var _0xc51a=function(_0x2a039c,_0x35fab3){_0x2a039c=_0x2a039c-0x0;var _0x3e28f8=_0x51ac[_0x2a039c];return _0x3e28f8;};'use strict';var multer=require(_0xc51a('0x0'));var util=require(_0xc51a('0x1'));var path=require(_0xc51a('0x2'));var timeout=require('connect-timeout');var express=require(_0xc51a('0x3'));var router=express[_0xc51a('0x4')]();var fs_extra=require(_0xc51a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc51a('0x6'));var config=require(_0xc51a('0x7'));var controller=require('./smsQueue.controller');router[_0xc51a('0x8')]('/',auth['isAuthenticated'](),controller[_0xc51a('0x9')]);router[_0xc51a('0x8')](_0xc51a('0xa'),auth[_0xc51a('0xb')](),controller[_0xc51a('0xc')]);router[_0xc51a('0x8')]('/:id',auth[_0xc51a('0xb')](),controller[_0xc51a('0xd')]);router[_0xc51a('0x8')](_0xc51a('0xe'),auth[_0xc51a('0xb')](),controller[_0xc51a('0xf')]);router[_0xc51a('0x8')](_0xc51a('0x10'),auth['isAuthenticated'](),controller[_0xc51a('0x11')]);router[_0xc51a('0x8')](_0xc51a('0x12'),auth[_0xc51a('0xb')](),controller[_0xc51a('0x13')]);router['post']('/',auth[_0xc51a('0xb')](),controller[_0xc51a('0x14')]);router['post'](_0xc51a('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0xc51a('0x15')](_0xc51a('0x12'),auth[_0xc51a('0xb')](),controller[_0xc51a('0x16')]);router[_0xc51a('0x17')](_0xc51a('0x18'),auth[_0xc51a('0xb')](),controller[_0xc51a('0x19')]);router[_0xc51a('0x1a')](_0xc51a('0x18'),auth[_0xc51a('0xb')](),controller[_0xc51a('0x1b')]);router[_0xc51a('0x1a')]('/:id/teams',auth[_0xc51a('0xb')](),controller['removeTeams']);router[_0xc51a('0x1a')](_0xc51a('0x12'),auth[_0xc51a('0xb')](),controller[_0xc51a('0x1c')]);module[_0xc51a('0x1d')]=router; \ No newline at end of file +var _0xfa9c=['isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','delete','destroy','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0x340112,_0x2af42e){var _0x523a84=function(_0x211164){while(--_0x211164){_0x340112['push'](_0x340112['shift']());}};_0x523a84(++_0x2af42e);}(_0xfa9c,0x11e));var _0xcfa9=function(_0x463f5d,_0x50aa05){_0x463f5d=_0x463f5d-0x0;var _0x35fa33=_0xfa9c[_0x463f5d];return _0x35fa33;};'use strict';var multer=require(_0xcfa9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcfa9('0x1'));var express=require(_0xcfa9('0x2'));var router=express[_0xcfa9('0x3')]();var fs_extra=require(_0xcfa9('0x4'));var auth=require(_0xcfa9('0x5'));var interaction=require(_0xcfa9('0x6'));var config=require(_0xcfa9('0x7'));var controller=require('./smsQueue.controller');router[_0xcfa9('0x8')]('/',auth['isAuthenticated'](),controller[_0xcfa9('0x9')]);router[_0xcfa9('0x8')](_0xcfa9('0xa'),auth[_0xcfa9('0xb')](),controller[_0xcfa9('0xc')]);router[_0xcfa9('0x8')](_0xcfa9('0xd'),auth[_0xcfa9('0xb')](),controller[_0xcfa9('0xe')]);router['get'](_0xcfa9('0xf'),auth[_0xcfa9('0xb')](),controller['getMembers']);router[_0xcfa9('0x8')](_0xcfa9('0x10'),auth[_0xcfa9('0xb')](),controller[_0xcfa9('0x11')]);router[_0xcfa9('0x8')](_0xcfa9('0x12'),auth[_0xcfa9('0xb')](),controller[_0xcfa9('0x13')]);router[_0xcfa9('0x14')]('/',auth[_0xcfa9('0xb')](),controller['create']);router[_0xcfa9('0x14')](_0xcfa9('0x10'),auth[_0xcfa9('0xb')](),controller[_0xcfa9('0x15')]);router[_0xcfa9('0x14')](_0xcfa9('0x12'),auth[_0xcfa9('0xb')](),controller[_0xcfa9('0x16')]);router['put'](_0xcfa9('0xd'),auth[_0xcfa9('0xb')](),controller['update']);router[_0xcfa9('0x17')](_0xcfa9('0xd'),auth[_0xcfa9('0xb')](),controller[_0xcfa9('0x18')]);router[_0xcfa9('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0xcfa9('0x19')]);router[_0xcfa9('0x17')]('/:id/users',auth[_0xcfa9('0xb')](),controller['removeAgents']);module[_0xcfa9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index b88accd..ab9d917 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 _0xe735=['sequelize','name','STRING','INTEGER','ENUM','beepall','roundrobin'];(function(_0x372b07,_0x6af854){var _0x4ec305=function(_0x310c41){while(--_0x310c41){_0x372b07['push'](_0x372b07['shift']());}};_0x4ec305(++_0x6af854);}(_0xe735,0xc4));var _0x5e73=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xe735[_0x51c819];return _0x15c5d2;};'use strict';var Sequelize=require(_0x5e73('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5e73('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5e73('0x2')]},'timeout':{'type':Sequelize[_0x5e73('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5e73('0x4')]('rrmemory',_0x5e73('0x5'),_0x5e73('0x6'))}}; \ No newline at end of file +var _0x6ad7=['exports','STRING','rrmemory'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x6ad7,0x132));var _0x76ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ad7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x76ad('0x0')]={'name':{'type':Sequelize[_0x76ad('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x76ad('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x76ad('0x2'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 5ff0d76..452a2fa 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 _0xdeac=['userSmsQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','keys','length','find','create','body','user','role','SmsQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserSmsQueue','findAll','agent','smsPause','updatedAt','format','%s/%s','SIP','getTeams','Team','pick','User','Agents','online','voicePause','interface','flatMap','addTeams','findOrCreate','emit','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','addAgents','omit','spread'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xdeac,0x93));var _0xcdea=function(_0x7b8bfc,_0x8fc8f4){_0x7b8bfc=_0x7b8bfc-0x0;var _0x47dc7a=_0xdeac[_0x7b8bfc];return _0x47dc7a;};'use strict';var emlformat=require(_0xcdea('0x0'));var rimraf=require(_0xcdea('0x1'));var zipdir=require(_0xcdea('0x2'));var jsonpatch=require(_0xcdea('0x3'));var rp=require('request-promise');var moment=require(_0xcdea('0x4'));var BPromise=require(_0xcdea('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcdea('0x6'));var sox=require(_0xcdea('0x7'));var csv=require(_0xcdea('0x8'));var ejs=require(_0xcdea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcdea('0xa'));var squel=require(_0xcdea('0xb'));var crypto=require('crypto');var jsforce=require(_0xcdea('0xc'));var deskjs=require(_0xcdea('0xd'));var toCsv=require(_0xcdea('0x8'));var querystring=require(_0xcdea('0xe'));var Papa=require(_0xcdea('0xf'));var Redis=require(_0xcdea('0x10'));var authService=require(_0xcdea('0x11'));var qs=require(_0xcdea('0x12'));var as=require(_0xcdea('0x13'));var hardwareService=require(_0xcdea('0x14'));var logger=require(_0xcdea('0x15'))(_0xcdea('0x16'));var utils=require(_0xcdea('0x17'));var config=require(_0xcdea('0x18'));var licenseUtil=require(_0xcdea('0x19'));var db=require(_0xcdea('0x1a'))['db'];config[_0xcdea('0x1b')]=_[_0xcdea('0x1c')](config[_0xcdea('0x1b')],{'host':_0xcdea('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcdea('0x1b')]));require(_0xcdea('0x1e'))[_0xcdea('0x1f')](socket);function respondWithStatusCode(_0x461ad3,_0x26e3a8){_0x26e3a8=_0x26e3a8||0xcc;return function(_0x352b12){if(_0x352b12){return _0x461ad3[_0xcdea('0x20')](_0x26e3a8);}return _0x461ad3[_0xcdea('0x21')](_0x26e3a8)['end']();};}function respondWithResult(_0x4a0f20,_0x3e8691){_0x3e8691=_0x3e8691||0xc8;return function(_0x16e0af){if(_0x16e0af){return _0x4a0f20[_0xcdea('0x21')](_0x3e8691)[_0xcdea('0x22')](_0x16e0af);}};}function respondWithFilteredResult(_0x9abb7d,_0x524511){return function(_0x44c033){if(_0x44c033){var _0x3cffe9=typeof _0x524511[_0xcdea('0x23')]===_0xcdea('0x24')&&typeof _0x524511[_0xcdea('0x25')]===_0xcdea('0x24');var _0xf40519=_0x44c033['count'];var _0x5342cf=_0x3cffe9?0x0:_0x524511[_0xcdea('0x23')];var _0x537752=_0x3cffe9?_0x44c033['count']:_0x524511[_0xcdea('0x23')]+_0x524511[_0xcdea('0x25')];var _0x701299;if(_0x537752>=_0xf40519){_0x537752=_0xf40519;_0x701299=0xc8;}else{_0x701299=0xce;}_0x9abb7d[_0xcdea('0x21')](_0x701299);return _0x9abb7d[_0xcdea('0x26')](_0xcdea('0x27'),_0x5342cf+'-'+_0x537752+'/'+_0xf40519)[_0xcdea('0x22')](_0x44c033);}return null;};}function patchUpdates(_0x86f20){return function(_0x571814){try{jsonpatch[_0xcdea('0x28')](_0x571814,_0x86f20,!![]);}catch(_0x4b592c){return BPromise[_0xcdea('0x29')](_0x4b592c);}return _0x571814[_0xcdea('0x2a')]();};}function saveUpdates(_0x105824,_0x6776be){return function(_0x4461df){if(_0x4461df){return _0x4461df[_0xcdea('0x2b')](_0x105824)[_0xcdea('0x2c')](function(_0x1fca5d){return _0x1fca5d;});}return null;};}function removeEntity(_0x1cd0b8,_0x8235c4){return function(_0x434d11){if(_0x434d11){return _0x434d11[_0xcdea('0x2d')]()[_0xcdea('0x2c')](function(){var _0x241ef2=_0x434d11[_0xcdea('0x2e')]({'plain':!![]});var _0x10d429='SmsQueues';return db[_0xcdea('0x2f')][_0xcdea('0x2d')]({'where':{'type':_0x10d429,'resourceId':_0x241ef2['id']}})[_0xcdea('0x2c')](function(){return _0x434d11;});})[_0xcdea('0x2c')](function(){_0x1cd0b8[_0xcdea('0x21')](0xcc)[_0xcdea('0x30')]();});}};}function handleEntityNotFound(_0x2f02aa,_0x2e7251){return function(_0x40fe41){if(!_0x40fe41){_0x2f02aa[_0xcdea('0x20')](0x194);}return _0x40fe41;};}function handleError(_0x40bbd1,_0x46ac54){_0x46ac54=_0x46ac54||0x1f4;return function(_0x56ddb6){logger['error'](_0x56ddb6[_0xcdea('0x31')]);if(_0x56ddb6[_0xcdea('0x32')]){delete _0x56ddb6[_0xcdea('0x32')];}_0x40bbd1['status'](_0x46ac54)['send'](_0x56ddb6);};}exports[_0xcdea('0x33')]=function(_0x364b4d,_0x4923fc){var _0x5f0084={},_0x2972d5={},_0x13a951={'count':0x0,'rows':[]};var _0x5ea028=_[_0xcdea('0x34')](db[_0xcdea('0x35')][_0xcdea('0x36')],function(_0x2f0f56){return{'name':_0x2f0f56[_0xcdea('0x37')],'type':_0x2f0f56[_0xcdea('0x38')][_0xcdea('0x39')]};});_0x2972d5[_0xcdea('0x3a')]=_[_0xcdea('0x34')](_0x5ea028,_0xcdea('0x32'));_0x2972d5[_0xcdea('0x3b')]=_['keys'](_0x364b4d[_0xcdea('0x3b')]);_0x2972d5['filters']=_[_0xcdea('0x3c')](_0x2972d5[_0xcdea('0x3a')],_0x2972d5['query']);_0x5f0084['attributes']=_[_0xcdea('0x3c')](_0x2972d5[_0xcdea('0x3a')],qs[_0xcdea('0x3d')](_0x364b4d[_0xcdea('0x3b')][_0xcdea('0x3d')]));_0x5f0084[_0xcdea('0x3e')]=_0x5f0084[_0xcdea('0x3e')]['length']?_0x5f0084[_0xcdea('0x3e')]:_0x2972d5[_0xcdea('0x3a')];if(!_0x364b4d['query'][_0xcdea('0x3f')](_0xcdea('0x40'))){_0x5f0084['limit']=qs[_0xcdea('0x25')](_0x364b4d[_0xcdea('0x3b')][_0xcdea('0x25')]);_0x5f0084[_0xcdea('0x23')]=qs[_0xcdea('0x23')](_0x364b4d[_0xcdea('0x3b')][_0xcdea('0x23')]);}_0x5f0084[_0xcdea('0x41')]=qs[_0xcdea('0x42')](_0x364b4d[_0xcdea('0x3b')]['sort']);_0x5f0084[_0xcdea('0x43')]=qs[_0xcdea('0x44')](_['pick'](_0x364b4d['query'],_0x2972d5[_0xcdea('0x44')]),_0x5ea028);if(_0x364b4d[_0xcdea('0x3b')][_0xcdea('0x45')]){_0x5f0084[_0xcdea('0x43')]=_[_0xcdea('0x46')](_0x5f0084[_0xcdea('0x43')],{'$or':_[_0xcdea('0x34')](_0x5ea028,function(_0x5c3d0b){if(_0x5c3d0b['type']!==_0xcdea('0x47')){var _0x3f5e64={};_0x3f5e64[_0x5c3d0b[_0xcdea('0x32')]]={'$like':'%'+_0x364b4d[_0xcdea('0x3b')][_0xcdea('0x45')]+'%'};return _0x3f5e64;}})});}_0x5f0084=_[_0xcdea('0x46')]({},_0x5f0084,_0x364b4d[_0xcdea('0x48')]);var _0x371ba9={'where':_0x5f0084[_0xcdea('0x43')]};return db[_0xcdea('0x35')][_0xcdea('0x49')](_0x371ba9)[_0xcdea('0x2c')](function(_0x1a33e1){_0x13a951[_0xcdea('0x49')]=_0x1a33e1;if(_0x364b4d[_0xcdea('0x3b')][_0xcdea('0x4a')]){_0x5f0084['include']=[{'all':!![]}];}return db[_0xcdea('0x35')]['findAll'](_0x5f0084);})[_0xcdea('0x2c')](function(_0x22d231){_0x13a951[_0xcdea('0x4b')]=_0x22d231;return _0x13a951;})[_0xcdea('0x2c')](respondWithFilteredResult(_0x4923fc,_0x5f0084))[_0xcdea('0x4c')](handleError(_0x4923fc,null));};exports[_0xcdea('0x4d')]=function(_0x37edd8,_0x627fd8){var _0x1cb703={'raw':!![],'where':{'id':_0x37edd8['params']['id']}},_0x424cdb={};_0x424cdb[_0xcdea('0x3a')]=_[_0xcdea('0x4e')](db[_0xcdea('0x35')][_0xcdea('0x36')]);_0x424cdb[_0xcdea('0x3b')]=_['keys'](_0x37edd8[_0xcdea('0x3b')]);_0x424cdb[_0xcdea('0x44')]=_[_0xcdea('0x3c')](_0x424cdb['model'],_0x424cdb[_0xcdea('0x3b')]);_0x1cb703['attributes']=_[_0xcdea('0x3c')](_0x424cdb['model'],qs[_0xcdea('0x3d')](_0x37edd8[_0xcdea('0x3b')]['fields']));_0x1cb703[_0xcdea('0x3e')]=_0x1cb703['attributes'][_0xcdea('0x4f')]?_0x1cb703[_0xcdea('0x3e')]:_0x424cdb[_0xcdea('0x3a')];if(_0x37edd8[_0xcdea('0x3b')]['includeAll']){_0x1cb703['include']=[{'all':!![]}];}_0x1cb703=_[_0xcdea('0x46')]({},_0x1cb703,_0x37edd8[_0xcdea('0x48')]);return db[_0xcdea('0x35')][_0xcdea('0x50')](_0x1cb703)[_0xcdea('0x2c')](handleEntityNotFound(_0x627fd8,null))[_0xcdea('0x2c')](respondWithResult(_0x627fd8,null))[_0xcdea('0x4c')](handleError(_0x627fd8,null));};exports[_0xcdea('0x51')]=function(_0x353c1c,_0x52b618){return db[_0xcdea('0x35')]['create'](_0x353c1c[_0xcdea('0x52')],{})[_0xcdea('0x2c')](function(_0x137f80){var _0x2e916e=_0x353c1c[_0xcdea('0x53')][_0xcdea('0x2e')]({'plain':!![]});if(!_0x2e916e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e916e[_0xcdea('0x54')]===_0xcdea('0x53')){var _0x8956e0=_0x137f80['get']({'plain':!![]});var _0x2301f0=_0xcdea('0x55');return db[_0xcdea('0x56')][_0xcdea('0x50')]({'where':{'name':_0x2301f0,'userProfileId':_0x2e916e[_0xcdea('0x57')]},'raw':!![]})['then'](function(_0x376605){if(_0x376605&&_0x376605['autoAssociation']===0x0){return db[_0xcdea('0x2f')][_0xcdea('0x51')]({'name':_0x8956e0[_0xcdea('0x32')],'resourceId':_0x8956e0['id'],'type':_0x376605[_0xcdea('0x32')],'sectionId':_0x376605['id']},{})['then'](function(){return _0x137f80;});}else{return _0x137f80;}})[_0xcdea('0x4c')](function(_0x466064){logger['error'](_0xcdea('0x58'),_0x466064);throw _0x466064;});}return _0x137f80;})[_0xcdea('0x2c')](respondWithResult(_0x52b618,0xc9))[_0xcdea('0x4c')](handleError(_0x52b618,null));};exports[_0xcdea('0x2b')]=function(_0x52d64d,_0x7de8b8){if(_0x52d64d[_0xcdea('0x52')]['id']){delete _0x52d64d[_0xcdea('0x52')]['id'];}return db[_0xcdea('0x35')][_0xcdea('0x50')]({'where':{'id':_0x52d64d[_0xcdea('0x59')]['id']}})['then'](handleEntityNotFound(_0x7de8b8,null))['then'](saveUpdates(_0x52d64d[_0xcdea('0x52')],null))[_0xcdea('0x2c')](respondWithResult(_0x7de8b8,null))[_0xcdea('0x4c')](handleError(_0x7de8b8,null));};exports[_0xcdea('0x2d')]=function(_0xcf9b04,_0x536d5c){return db['SmsQueue'][_0xcdea('0x50')]({'where':{'id':_0xcf9b04['params']['id']}})['then'](handleEntityNotFound(_0x536d5c,null))[_0xcdea('0x2c')](removeEntity(_0x536d5c,null))[_0xcdea('0x4c')](handleError(_0x536d5c,null));};exports[_0xcdea('0x5a')]=function(_0x2da1ef,_0x220fe6){return db[_0xcdea('0x35')]['describe']()[_0xcdea('0x2c')](respondWithResult(_0x220fe6,null))[_0xcdea('0x4c')](handleError(_0x220fe6,null));};exports[_0xcdea('0x5b')]=function(_0x55e271,_0x2bb01a,_0x28872c){var _0x2162f2={'raw':!![],'where':{}},_0x3011d9={},_0x1ff445;return db['SmsQueue'][_0xcdea('0x5c')]({'where':{'id':_0x55e271[_0xcdea('0x59')]['id']}})[_0xcdea('0x2c')](handleEntityNotFound(_0x2bb01a,null))[_0xcdea('0x2c')](function(_0x199481){if(_0x199481){_0x1ff445=_0x199481[_0xcdea('0x2e')]({'plain':!![]});_0x3011d9[_0xcdea('0x3a')]=_['keys'](db[_0xcdea('0x5d')][_0xcdea('0x36')]);_0x3011d9['query']=_[_0xcdea('0x4e')](_0x55e271['query']);_0x3011d9['filters']=_[_0xcdea('0x3c')](_0x3011d9[_0xcdea('0x3a')],_0x3011d9[_0xcdea('0x3b')]);_0x2162f2[_0xcdea('0x3e')]=_[_0xcdea('0x3c')](_0x3011d9[_0xcdea('0x3a')],qs['fields'](_0x55e271['query']['fields']));_0x2162f2[_0xcdea('0x3e')]=_0x2162f2[_0xcdea('0x3e')][_0xcdea('0x4f')]?_0x2162f2[_0xcdea('0x3e')]:_0x3011d9[_0xcdea('0x3a')];if(!_0x55e271[_0xcdea('0x3b')][_0xcdea('0x3f')](_0xcdea('0x40'))){_0x2162f2['limit']=qs[_0xcdea('0x25')](_0x55e271['query'][_0xcdea('0x25')]);_0x2162f2[_0xcdea('0x23')]=qs[_0xcdea('0x23')](_0x55e271[_0xcdea('0x3b')][_0xcdea('0x23')]);}_0x2162f2[_0xcdea('0x41')]=qs['sort'](_0x55e271['query']['sort']);_0x2162f2[_0xcdea('0x43')]=qs['filters'](_['pick'](_0x55e271['query'],_0x3011d9[_0xcdea('0x44')]));_0x2162f2['where']['SmsQueueId']=_0x199481['id'];if(_0x55e271[_0xcdea('0x3b')][_0xcdea('0x45')]){_0x2162f2[_0xcdea('0x43')]=_[_0xcdea('0x46')](_0x2162f2[_0xcdea('0x43')],{'$or':_[_0xcdea('0x34')](_0x2162f2[_0xcdea('0x3e')],function(_0x2aeb1e){var _0x5a982f={};_0x5a982f[_0x2aeb1e]={'$like':'%'+_0x55e271[_0xcdea('0x3b')][_0xcdea('0x45')]+'%'};return _0x5a982f;})});}_0x2162f2=_[_0xcdea('0x46')]({},_0x2162f2,_0x55e271[_0xcdea('0x48')]);return db[_0xcdea('0x5d')][_0xcdea('0x5e')](_0x2162f2);}})['then'](function(_0xfecb30){if(_0xfecb30){return db['User']['findAndCountAll']({'where':{'id':_[_0xcdea('0x34')](_0xfecb30,'UserId'),'role':_0xcdea('0x5f')},'attributes':['id','name',_0xcdea('0x60'),_0xcdea('0x61'),'createdAt']});}})[_0xcdea('0x2c')](function(_0xd7c910){if(_0xd7c910){return{'count':_0xd7c910[_0xcdea('0x49')],'rows':_[_0xcdea('0x34')](_0xd7c910['rows'],function(_0x5ecad3){return{'membername':_0x5ecad3['name'],'UserId':_0x5ecad3['id'],'queue_name':_0x1ff445[_0xcdea('0x32')],'SmsQueueId':_0x1ff445['id'],'interface':util[_0xcdea('0x62')](_0xcdea('0x63'),_0xcdea('0x64'),_0x5ecad3[_0xcdea('0x32')]),'penalty':0x0,'paused':_0x5ecad3[_0xcdea('0x60')],'createdAt':_0x5ecad3['createdAt'],'updatedAt':_0x5ecad3[_0xcdea('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2bb01a,_0x2162f2))['catch'](handleError(_0x2bb01a,null));};exports[_0xcdea('0x65')]=function(_0x23e7e9,_0x58c610,_0x54a47b){var _0x3e4026={};var _0x267ebf={};var _0x3bbd07;var _0x201514;return db[_0xcdea('0x35')][_0xcdea('0x5c')]({'where':{'id':_0x23e7e9[_0xcdea('0x59')]['id']}})[_0xcdea('0x2c')](handleEntityNotFound(_0x58c610,null))[_0xcdea('0x2c')](function(_0x1fb687){if(_0x1fb687){_0x3bbd07=_0x1fb687;_0x267ebf['model']=_[_0xcdea('0x4e')](db[_0xcdea('0x66')][_0xcdea('0x36')]);_0x267ebf[_0xcdea('0x3b')]=_[_0xcdea('0x4e')](_0x23e7e9[_0xcdea('0x3b')]);_0x267ebf[_0xcdea('0x44')]=_[_0xcdea('0x3c')](_0x267ebf[_0xcdea('0x3a')],_0x267ebf[_0xcdea('0x3b')]);_0x3e4026[_0xcdea('0x3e')]=_['intersection'](_0x267ebf[_0xcdea('0x3a')],qs[_0xcdea('0x3d')](_0x23e7e9[_0xcdea('0x3b')][_0xcdea('0x3d')]));_0x3e4026[_0xcdea('0x3e')]=_0x3e4026[_0xcdea('0x3e')][_0xcdea('0x4f')]?_0x3e4026[_0xcdea('0x3e')]:_0x267ebf[_0xcdea('0x3a')];_0x3e4026[_0xcdea('0x41')]=qs['sort'](_0x23e7e9['query']['sort']);_0x3e4026[_0xcdea('0x43')]=qs[_0xcdea('0x44')](_[_0xcdea('0x67')](_0x23e7e9[_0xcdea('0x3b')],_0x267ebf[_0xcdea('0x44')]));if(_0x23e7e9[_0xcdea('0x3b')][_0xcdea('0x45')]){_0x3e4026[_0xcdea('0x43')]=_[_0xcdea('0x46')](_0x3e4026['where'],{'$or':_[_0xcdea('0x34')](_0x3e4026['attributes'],function(_0x19e7d8){var _0x136e2f={};_0x136e2f[_0x19e7d8]={'$like':'%'+_0x23e7e9['query'][_0xcdea('0x45')]+'%'};return _0x136e2f;})});}_0x3e4026=_['merge']({},_0x3e4026,_0x23e7e9[_0xcdea('0x48')]);return _0x3bbd07['getTeams'](_0x3e4026);}})[_0xcdea('0x2c')](function(_0x2287fb){if(_0x2287fb){_0x201514=_0x2287fb[_0xcdea('0x4f')];if(!_0x23e7e9[_0xcdea('0x3b')][_0xcdea('0x3f')](_0xcdea('0x40'))){_0x3e4026[_0xcdea('0x25')]=qs[_0xcdea('0x25')](_0x23e7e9[_0xcdea('0x3b')][_0xcdea('0x25')]);_0x3e4026[_0xcdea('0x23')]=qs[_0xcdea('0x23')](_0x23e7e9['query'][_0xcdea('0x23')]);}return _0x3bbd07[_0xcdea('0x65')](_0x3e4026);}})[_0xcdea('0x2c')](function(_0x1a813c){if(_0x1a813c){return _0x1a813c?{'count':_0x201514,'rows':_0x1a813c}:null;}})['then'](respondWithResult(_0x58c610,null))[_0xcdea('0x4c')](handleError(_0x58c610,null));};exports['addTeams']=function(_0xee55d0,_0x30db93,_0x5a0c12){var _0x3abfb7=_0xee55d0[_0xcdea('0x52')]['ids'];return db[_0xcdea('0x66')][_0xcdea('0x5e')]({'where':{'id':_0x3abfb7},'attributes':['id'],'include':[{'model':db[_0xcdea('0x68')],'as':_0xcdea('0x69'),'attributes':['id','name',_0xcdea('0x6a'),_0xcdea('0x6b'),_0xcdea('0x6c')],'raw':!![]}]})[_0xcdea('0x2c')](function(_0x432bb9){if(_0x432bb9){var _0x5488a2=_[_0xcdea('0x6d')](_0x432bb9,function(_0x2ddde5){var _0x68e856=_0x2ddde5[_0xcdea('0x2e')]({'plain':!![]});return _0x68e856['Agents'];});return db['SmsQueue'][_0xcdea('0x50')]({'where':{'id':_0xee55d0[_0xcdea('0x59')]['id']}})[_0xcdea('0x2c')](function(_0x1dac60){return db['sequelize']['transaction'](function(_0x5bf895){return _0x1dac60[_0xcdea('0x6e')](_0x3abfb7,{'transaction':_0x5bf895})[_0xcdea('0x2c')](function(){return BPromise['each'](_0x5488a2,function(_0xab4ee){return db[_0xcdea('0x5d')][_0xcdea('0x6f')]({'where':{'UserId':_0xab4ee['id'],'SmsQueueId':_0xee55d0[_0xcdea('0x59')]['id']},'transaction':_0x5bf895});});})['then'](function(){_0x5488a2['forEach'](function(_0x23d6bc){socket[_0xcdea('0x70')]('userSmsQueue:save',{'UserId':_0x23d6bc['id'],'SmsQueueId':_0x1dac60['id']});});});});});}})[_0xcdea('0x2c')](respondWithStatusCode(_0x30db93,null))[_0xcdea('0x4c')](handleError(_0x30db93,null));};exports['removeTeams']=function(_0x30bb57,_0xbcd1fc,_0x27b5c4){return db['Team'][_0xcdea('0x5e')]({'where':{'id':_0x30bb57['query'][_0xcdea('0x71')]},'attributes':['id'],'include':[{'model':db[_0xcdea('0x68')],'as':_0xcdea('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xbcd1fc,null))['then'](function(_0x59c09b){var _0x2fab73=_[_0xcdea('0x34')](_0x59c09b,'id');var _0x5d7692=[];var _0x21ae44=[];var _0x1b9c0b=squel[_0xcdea('0x72')]();_0x1b9c0b[_0xcdea('0x73')](_0xcdea('0x74'))[_0xcdea('0x75')]('team_has_sms_queues','tq')['join'](_0xcdea('0x76'),'ut',_0xcdea('0x77'))['where'](_0xcdea('0x78'),_0x30bb57[_0xcdea('0x59')]['id']);for(var _0x250a81=0x0;_0x250a81<_0x59c09b[_0xcdea('0x4f')];_0x250a81+=0x1){let _0x4ffa29=_0x59c09b[_0x250a81];for(var _0x4cfee3=0x0;_0x4cfee3<_0x4ffa29[_0xcdea('0x69')][_0xcdea('0x4f')];_0x4cfee3+=0x1){let _0x454f1c=_0x4ffa29[_0xcdea('0x69')][_0x4cfee3];var _0x1d28fe=_0x1b9c0b[_0xcdea('0x79')]();_0x1d28fe[_0xcdea('0x43')](_0xcdea('0x7a'),_0x454f1c['id']);_0x21ae44[_0xcdea('0x7b')](db['sequelize'][_0xcdea('0x3b')](_0x1d28fe[_0xcdea('0x7c')](),{'type':db[_0xcdea('0x7d')][_0xcdea('0x7e')][_0xcdea('0x7f')]})[_0xcdea('0x2c')](function(_0x157e34){if(_0x157e34[_0xcdea('0x4f')]===0x1){return _0x454f1c['id'];}else{var _0x393b2c=_[_0xcdea('0x80')](_['map'](_0x157e34,'TeamId'),function(_0x4bce02){return _[_0xcdea('0x81')](_0x2fab73,_0x4bce02);});if(_0x393b2c){return _0x454f1c['id'];}}}));}}return BPromise[_0xcdea('0x82')](_0x21ae44)['then'](function(_0x5a77b5){_0x5d7692=_(_0x5d7692)[_0xcdea('0x83')](_0x5a77b5)[_0xcdea('0x84')]()[_0xcdea('0x85')]();return db[_0xcdea('0x35')][_0xcdea('0x50')]({'where':{'id':_0x30bb57[_0xcdea('0x59')]['id']}})['then'](function(_0x39f979){return db[_0xcdea('0x7d')][_0xcdea('0x86')](function(_0x52c486){return _0x39f979['removeTeams'](_0x30bb57[_0xcdea('0x3b')][_0xcdea('0x71')],{'transaction':_0x52c486})['then'](function(){if(!_[_0xcdea('0x87')](_0x5d7692)){return _0x39f979[_0xcdea('0x88')](_0x5d7692,{'transaction':_0x52c486});}})[_0xcdea('0x2c')](function(){_0x5d7692[_0xcdea('0x89')](function(_0x493907){socket['emit']('userSmsQueue:remove',{'UserId':_0x493907,'SmsQueueId':_0x39f979['id']});});});});});});})['then'](respondWithStatusCode(_0xbcd1fc,null))[_0xcdea('0x4c')](handleError(_0xbcd1fc,null));};exports[_0xcdea('0x8a')]=function(_0x94738a,_0x58f545,_0x3f820b){return db[_0xcdea('0x35')]['find']({'where':{'id':_0x94738a[_0xcdea('0x59')]['id']}})[_0xcdea('0x2c')](handleEntityNotFound(_0x58f545,null))[_0xcdea('0x2c')](function(_0x49ffac){if(_0x49ffac){return _0x49ffac[_0xcdea('0x8a')](_0x94738a[_0xcdea('0x52')]['ids'],_[_0xcdea('0x8b')](_0x94738a[_0xcdea('0x52')],['ids','id'])||{})[_0xcdea('0x8c')](function(_0x35b62f){for(var _0x3f3923=0x0;_0x3f3923<_0x94738a[_0xcdea('0x52')]['ids']['length'];_0x3f3923+=0x1){socket[_0xcdea('0x70')](_0xcdea('0x8d'),{'UserId':_0x94738a[_0xcdea('0x52')]['ids'][_0x3f3923],'SmsQueueId':_0x94738a[_0xcdea('0x59')]['id']});}return _0x35b62f;});}})[_0xcdea('0x2c')](respondWithResult(_0x58f545,null))['catch'](handleError(_0x58f545,null));};exports[_0xcdea('0x88')]=function(_0x2c5d93,_0x40b332,_0x440000){return db[_0xcdea('0x35')][_0xcdea('0x50')]({'where':{'id':_0x2c5d93[_0xcdea('0x59')]['id']}})['then'](handleEntityNotFound(_0x40b332,null))[_0xcdea('0x2c')](function(_0x4f4b45){if(_0x4f4b45){return _0x4f4b45[_0xcdea('0x88')](_0x2c5d93[_0xcdea('0x3b')][_0xcdea('0x71')])['then'](function(){if(_[_0xcdea('0x8e')](_0x2c5d93['query']['ids'])){for(var _0x2a1a37=0x0;_0x2a1a37<_0x2c5d93[_0xcdea('0x3b')][_0xcdea('0x71')][_0xcdea('0x4f')];_0x2a1a37+=0x1){socket[_0xcdea('0x70')]('userSmsQueue:remove',{'UserId':Number(_0x2c5d93[_0xcdea('0x3b')][_0xcdea('0x71')][_0x2a1a37]),'SmsQueueId':Number(_0x2c5d93[_0xcdea('0x59')]['id'])});}}else{socket[_0xcdea('0x70')]('userSmsQueue:remove',{'UserId':Number(_0x2c5d93[_0xcdea('0x3b')][_0xcdea('0x71')]),'SmsQueueId':Number(_0x2c5d93[_0xcdea('0x59')]['id'])});}});}})[_0xcdea('0x2c')](respondWithStatusCode(_0x40b332,null))['catch'](handleError(_0x40b332,null));};exports[_0xcdea('0x8f')]=function(_0xeb819a,_0x3212ec,_0x229799){var _0x348726={};var _0x4635b5={};var _0x71fe24;var _0x16b28b;return db[_0xcdea('0x35')][_0xcdea('0x5c')]({'where':{'id':_0xeb819a[_0xcdea('0x59')]['id']}})['then'](handleEntityNotFound(_0x3212ec,null))['then'](function(_0x1b7a57){if(_0x1b7a57){_0x71fe24=_0x1b7a57;_0x4635b5[_0xcdea('0x3a')]=_[_0xcdea('0x4e')](db[_0xcdea('0x68')][_0xcdea('0x36')]);_0x4635b5[_0xcdea('0x3b')]=_[_0xcdea('0x4e')](_0xeb819a[_0xcdea('0x3b')]);_0x4635b5[_0xcdea('0x44')]=_[_0xcdea('0x3c')](_0x4635b5[_0xcdea('0x3a')],_0x4635b5[_0xcdea('0x3b')]);_0x348726['attributes']=_[_0xcdea('0x3c')](_0x4635b5[_0xcdea('0x3a')],qs[_0xcdea('0x3d')](_0xeb819a[_0xcdea('0x3b')][_0xcdea('0x3d')]));_0x348726[_0xcdea('0x3e')]=_0x348726[_0xcdea('0x3e')][_0xcdea('0x4f')]?_0x348726['attributes']:_0x4635b5[_0xcdea('0x3a')];_0x348726['order']=qs[_0xcdea('0x42')](_0xeb819a[_0xcdea('0x3b')]['sort']);_0x348726[_0xcdea('0x43')]=qs[_0xcdea('0x44')](_[_0xcdea('0x67')](_0xeb819a[_0xcdea('0x3b')],_0x4635b5['filters']));if(_0xeb819a['query']['filter']){_0x348726['where']=_['merge'](_0x348726[_0xcdea('0x43')],{'$or':_['map'](_0x348726['attributes'],function(_0x2c2227){var _0x3c0bbb={};_0x3c0bbb[_0x2c2227]={'$like':'%'+_0xeb819a[_0xcdea('0x3b')][_0xcdea('0x45')]+'%'};return _0x3c0bbb;})});}_0x348726=_['merge']({},_0x348726,_0xeb819a['options']);return _0x71fe24[_0xcdea('0x8f')](_0x348726);}})[_0xcdea('0x2c')](function(_0x1a2806){if(_0x1a2806){_0x16b28b=_0x1a2806[_0xcdea('0x4f')];if(!_0xeb819a[_0xcdea('0x3b')][_0xcdea('0x3f')](_0xcdea('0x40'))){_0x348726[_0xcdea('0x25')]=qs[_0xcdea('0x25')](_0xeb819a[_0xcdea('0x3b')][_0xcdea('0x25')]);_0x348726['offset']=qs[_0xcdea('0x23')](_0xeb819a[_0xcdea('0x3b')][_0xcdea('0x23')]);}return _0x71fe24[_0xcdea('0x8f')](_0x348726);}})[_0xcdea('0x2c')](function(_0x3e6295){if(_0x3e6295){return _0x3e6295?{'count':_0x16b28b,'rows':_0x3e6295}:null;}})['then'](respondWithResult(_0x3212ec,null))[_0xcdea('0x4c')](handleError(_0x3212ec,null));}; \ No newline at end of file +var _0x14ba=['Content-Range','apply','reject','save','update','then','destroy','get','error','name','send','index','map','SmsQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsQueues','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','body','describe','findOne','UserSmsQueue','pick','SmsQueueId','findAndCountAll','UserId','smsPause','updatedAt','createdAt','%s/%s','getTeams','addTeams','ids','Team','User','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','emit','select','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','all','compact','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x332869,_0x39c6da){var _0x50d621=function(_0x21b51d){while(--_0x21b51d){_0x332869['push'](_0x332869['shift']());}};_0x50d621(++_0x39c6da);}(_0x14ba,0xe8));var _0xa14b=function(_0x17f54d,_0x576372){_0x17f54d=_0x17f54d-0x0;var _0x487aed=_0x14ba[_0x17f54d];return _0x487aed;};'use strict';var emlformat=require(_0xa14b('0x0'));var rimraf=require(_0xa14b('0x1'));var zipdir=require(_0xa14b('0x2'));var jsonpatch=require(_0xa14b('0x3'));var rp=require(_0xa14b('0x4'));var moment=require(_0xa14b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa14b('0x6'));var util=require(_0xa14b('0x7'));var path=require(_0xa14b('0x8'));var sox=require(_0xa14b('0x9'));var csv=require(_0xa14b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa14b('0xb'));var squel=require(_0xa14b('0xc'));var crypto=require(_0xa14b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa14b('0xe'));var toCsv=require(_0xa14b('0xa'));var querystring=require(_0xa14b('0xf'));var Papa=require(_0xa14b('0x10'));var Redis=require(_0xa14b('0x11'));var authService=require(_0xa14b('0x12'));var qs=require(_0xa14b('0x13'));var as=require(_0xa14b('0x14'));var hardwareService=require(_0xa14b('0x15'));var logger=require(_0xa14b('0x16'))(_0xa14b('0x17'));var utils=require(_0xa14b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa14b('0x19'));var db=require(_0xa14b('0x1a'))['db'];config[_0xa14b('0x1b')]=_[_0xa14b('0x1c')](config[_0xa14b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xa14b('0x1d'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xa14b('0x1e')](socket);function respondWithStatusCode(_0x1a74b6,_0x302f26){_0x302f26=_0x302f26||0xcc;return function(_0x421267){if(_0x421267){return _0x1a74b6[_0xa14b('0x1f')](_0x302f26);}return _0x1a74b6[_0xa14b('0x20')](_0x302f26)[_0xa14b('0x21')]();};}function respondWithResult(_0x10421a,_0x4edfee){_0x4edfee=_0x4edfee||0xc8;return function(_0x213c92){if(_0x213c92){return _0x10421a[_0xa14b('0x20')](_0x4edfee)[_0xa14b('0x22')](_0x213c92);}};}function respondWithFilteredResult(_0x1e1779,_0x129f00){return function(_0x53ce9d){if(_0x53ce9d){var _0xd48c4e=typeof _0x129f00[_0xa14b('0x23')]===_0xa14b('0x24')&&typeof _0x129f00['limit']==='undefined';var _0x4fcb5b=_0x53ce9d[_0xa14b('0x25')];var _0x15e05d=_0xd48c4e?0x0:_0x129f00['offset'];var _0x21c47d=_0xd48c4e?_0x53ce9d[_0xa14b('0x25')]:_0x129f00[_0xa14b('0x23')]+_0x129f00[_0xa14b('0x26')];var _0x3fe398;if(_0x21c47d>=_0x4fcb5b){_0x21c47d=_0x4fcb5b;_0x3fe398=0xc8;}else{_0x3fe398=0xce;}_0x1e1779[_0xa14b('0x20')](_0x3fe398);return _0x1e1779[_0xa14b('0x27')](_0xa14b('0x28'),_0x15e05d+'-'+_0x21c47d+'/'+_0x4fcb5b)[_0xa14b('0x22')](_0x53ce9d);}return null;};}function patchUpdates(_0x54ec42){return function(_0x2bdb51){try{jsonpatch[_0xa14b('0x29')](_0x2bdb51,_0x54ec42,!![]);}catch(_0x223014){return BPromise[_0xa14b('0x2a')](_0x223014);}return _0x2bdb51[_0xa14b('0x2b')]();};}function saveUpdates(_0x462f1d,_0x26406e){return function(_0x22cd37){if(_0x22cd37){return _0x22cd37[_0xa14b('0x2c')](_0x462f1d)[_0xa14b('0x2d')](function(_0x37305f){return _0x37305f;});}return null;};}function removeEntity(_0x484509,_0x1b8da2){return function(_0x4d7745){if(_0x4d7745){return _0x4d7745[_0xa14b('0x2e')]()[_0xa14b('0x2d')](function(){var _0x51edb7=_0x4d7745[_0xa14b('0x2f')]({'plain':!![]});var _0x58306f='SmsQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x58306f,'resourceId':_0x51edb7['id']}})[_0xa14b('0x2d')](function(){return _0x4d7745;});})[_0xa14b('0x2d')](function(){_0x484509['status'](0xcc)[_0xa14b('0x21')]();});}};}function handleEntityNotFound(_0xa3131d,_0x42c95f){return function(_0x1643db){if(!_0x1643db){_0xa3131d[_0xa14b('0x1f')](0x194);}return _0x1643db;};}function handleError(_0x4eca5a,_0x2dbdc0){_0x2dbdc0=_0x2dbdc0||0x1f4;return function(_0x5908c1){logger[_0xa14b('0x30')](_0x5908c1['stack']);if(_0x5908c1[_0xa14b('0x31')]){delete _0x5908c1[_0xa14b('0x31')];}_0x4eca5a[_0xa14b('0x20')](_0x2dbdc0)[_0xa14b('0x32')](_0x5908c1);};}exports[_0xa14b('0x33')]=function(_0x414947,_0x36dd27){var _0x1064d4={},_0x2e8b17={},_0x41630d={'count':0x0,'rows':[]};var _0x35ecf0=_[_0xa14b('0x34')](db[_0xa14b('0x35')][_0xa14b('0x36')],function(_0x192aa5){return{'name':_0x192aa5['fieldName'],'type':_0x192aa5['type'][_0xa14b('0x37')]};});_0x2e8b17[_0xa14b('0x38')]=_[_0xa14b('0x34')](_0x35ecf0,_0xa14b('0x31'));_0x2e8b17[_0xa14b('0x39')]=_[_0xa14b('0x3a')](_0x414947[_0xa14b('0x39')]);_0x2e8b17[_0xa14b('0x3b')]=_[_0xa14b('0x3c')](_0x2e8b17['model'],_0x2e8b17['query']);_0x1064d4[_0xa14b('0x3d')]=_[_0xa14b('0x3c')](_0x2e8b17[_0xa14b('0x38')],qs[_0xa14b('0x3e')](_0x414947[_0xa14b('0x39')][_0xa14b('0x3e')]));_0x1064d4[_0xa14b('0x3d')]=_0x1064d4[_0xa14b('0x3d')]['length']?_0x1064d4[_0xa14b('0x3d')]:_0x2e8b17[_0xa14b('0x38')];if(!_0x414947[_0xa14b('0x39')][_0xa14b('0x3f')](_0xa14b('0x40'))){_0x1064d4['limit']=qs[_0xa14b('0x26')](_0x414947[_0xa14b('0x39')][_0xa14b('0x26')]);_0x1064d4[_0xa14b('0x23')]=qs['offset'](_0x414947['query']['offset']);}_0x1064d4[_0xa14b('0x41')]=qs[_0xa14b('0x42')](_0x414947[_0xa14b('0x39')][_0xa14b('0x42')]);_0x1064d4['where']=qs[_0xa14b('0x3b')](_['pick'](_0x414947[_0xa14b('0x39')],_0x2e8b17[_0xa14b('0x3b')]),_0x35ecf0);if(_0x414947[_0xa14b('0x39')][_0xa14b('0x43')]){_0x1064d4['where']=_[_0xa14b('0x44')](_0x1064d4[_0xa14b('0x45')],{'$or':_['map'](_0x35ecf0,function(_0x11b177){if(_0x11b177['type']!==_0xa14b('0x46')){var _0x1d3c7a={};_0x1d3c7a[_0x11b177[_0xa14b('0x31')]]={'$like':'%'+_0x414947['query'][_0xa14b('0x43')]+'%'};return _0x1d3c7a;}})});}_0x1064d4=_[_0xa14b('0x44')]({},_0x1064d4,_0x414947[_0xa14b('0x47')]);var _0x7d89ab={'where':_0x1064d4[_0xa14b('0x45')]};return db['SmsQueue'][_0xa14b('0x25')](_0x7d89ab)[_0xa14b('0x2d')](function(_0x3f41f5){_0x41630d[_0xa14b('0x25')]=_0x3f41f5;if(_0x414947[_0xa14b('0x39')][_0xa14b('0x48')]){_0x1064d4[_0xa14b('0x49')]=[{'all':!![]}];}return db['SmsQueue'][_0xa14b('0x4a')](_0x1064d4);})['then'](function(_0x9a7efb){_0x41630d[_0xa14b('0x4b')]=_0x9a7efb;return _0x41630d;})[_0xa14b('0x2d')](respondWithFilteredResult(_0x36dd27,_0x1064d4))['catch'](handleError(_0x36dd27,null));};exports[_0xa14b('0x4c')]=function(_0x42e1f7,_0x5c3507){var _0x298fa8={'raw':!![],'where':{'id':_0x42e1f7[_0xa14b('0x4d')]['id']}},_0x183f8b={};_0x183f8b[_0xa14b('0x38')]=_[_0xa14b('0x3a')](db['SmsQueue'][_0xa14b('0x36')]);_0x183f8b['query']=_[_0xa14b('0x3a')](_0x42e1f7[_0xa14b('0x39')]);_0x183f8b['filters']=_['intersection'](_0x183f8b[_0xa14b('0x38')],_0x183f8b['query']);_0x298fa8[_0xa14b('0x3d')]=_[_0xa14b('0x3c')](_0x183f8b[_0xa14b('0x38')],qs[_0xa14b('0x3e')](_0x42e1f7[_0xa14b('0x39')][_0xa14b('0x3e')]));_0x298fa8[_0xa14b('0x3d')]=_0x298fa8['attributes'][_0xa14b('0x4e')]?_0x298fa8[_0xa14b('0x3d')]:_0x183f8b['model'];if(_0x42e1f7[_0xa14b('0x39')][_0xa14b('0x48')]){_0x298fa8['include']=[{'all':!![]}];}_0x298fa8=_[_0xa14b('0x44')]({},_0x298fa8,_0x42e1f7[_0xa14b('0x47')]);return db[_0xa14b('0x35')]['find'](_0x298fa8)[_0xa14b('0x2d')](handleEntityNotFound(_0x5c3507,null))[_0xa14b('0x2d')](respondWithResult(_0x5c3507,null))['catch'](handleError(_0x5c3507,null));};exports['create']=function(_0x51538f,_0x569b1a){return db['SmsQueue'][_0xa14b('0x4f')](_0x51538f['body'],{})['then'](function(_0x2460b0){var _0x27f5a5=_0x51538f[_0xa14b('0x50')][_0xa14b('0x2f')]({'plain':!![]});if(!_0x27f5a5)throw new Error(_0xa14b('0x51'));if(_0x27f5a5['role']===_0xa14b('0x50')){var _0x3f72ea=_0x2460b0[_0xa14b('0x2f')]({'plain':!![]});var _0x277ee8=_0xa14b('0x52');return db[_0xa14b('0x53')][_0xa14b('0x54')]({'where':{'name':_0x277ee8,'userProfileId':_0x27f5a5[_0xa14b('0x55')]},'raw':!![]})['then'](function(_0x457ed2){if(_0x457ed2&&_0x457ed2[_0xa14b('0x56')]===0x0){return db[_0xa14b('0x57')][_0xa14b('0x4f')]({'name':_0x3f72ea[_0xa14b('0x31')],'resourceId':_0x3f72ea['id'],'type':_0x457ed2[_0xa14b('0x31')],'sectionId':_0x457ed2['id']},{})['then'](function(){return _0x2460b0;});}else{return _0x2460b0;}})['catch'](function(_0x2ffc57){logger[_0xa14b('0x30')](_0xa14b('0x58'),_0x2ffc57);throw _0x2ffc57;});}return _0x2460b0;})[_0xa14b('0x2d')](respondWithResult(_0x569b1a,0xc9))[_0xa14b('0x59')](handleError(_0x569b1a,null));};exports[_0xa14b('0x2c')]=function(_0x4063da,_0x41a7f6){if(_0x4063da[_0xa14b('0x5a')]['id']){delete _0x4063da['body']['id'];}return db['SmsQueue']['find']({'where':{'id':_0x4063da[_0xa14b('0x4d')]['id']}})[_0xa14b('0x2d')](handleEntityNotFound(_0x41a7f6,null))['then'](saveUpdates(_0x4063da[_0xa14b('0x5a')],null))[_0xa14b('0x2d')](respondWithResult(_0x41a7f6,null))['catch'](handleError(_0x41a7f6,null));};exports[_0xa14b('0x2e')]=function(_0x3811ce,_0x29de6f){return db[_0xa14b('0x35')][_0xa14b('0x54')]({'where':{'id':_0x3811ce[_0xa14b('0x4d')]['id']}})[_0xa14b('0x2d')](handleEntityNotFound(_0x29de6f,null))[_0xa14b('0x2d')](removeEntity(_0x29de6f,null))[_0xa14b('0x59')](handleError(_0x29de6f,null));};exports[_0xa14b('0x5b')]=function(_0x27c2ef,_0x742977){return db[_0xa14b('0x35')]['describe']()['then'](respondWithResult(_0x742977,null))[_0xa14b('0x59')](handleError(_0x742977,null));};exports['getMembers']=function(_0x567ee6,_0x3fec35,_0x5ce4e5){var _0x37eddd={'raw':!![],'where':{}},_0x4e7bc8={},_0x51a0b0;return db['SmsQueue'][_0xa14b('0x5c')]({'where':{'id':_0x567ee6[_0xa14b('0x4d')]['id']}})[_0xa14b('0x2d')](handleEntityNotFound(_0x3fec35,null))[_0xa14b('0x2d')](function(_0xc1ae85){if(_0xc1ae85){_0x51a0b0=_0xc1ae85[_0xa14b('0x2f')]({'plain':!![]});_0x4e7bc8[_0xa14b('0x38')]=_[_0xa14b('0x3a')](db[_0xa14b('0x5d')][_0xa14b('0x36')]);_0x4e7bc8[_0xa14b('0x39')]=_[_0xa14b('0x3a')](_0x567ee6[_0xa14b('0x39')]);_0x4e7bc8[_0xa14b('0x3b')]=_[_0xa14b('0x3c')](_0x4e7bc8[_0xa14b('0x38')],_0x4e7bc8[_0xa14b('0x39')]);_0x37eddd[_0xa14b('0x3d')]=_[_0xa14b('0x3c')](_0x4e7bc8['model'],qs['fields'](_0x567ee6[_0xa14b('0x39')][_0xa14b('0x3e')]));_0x37eddd[_0xa14b('0x3d')]=_0x37eddd[_0xa14b('0x3d')][_0xa14b('0x4e')]?_0x37eddd[_0xa14b('0x3d')]:_0x4e7bc8['model'];if(!_0x567ee6[_0xa14b('0x39')]['hasOwnProperty'](_0xa14b('0x40'))){_0x37eddd['limit']=qs['limit'](_0x567ee6[_0xa14b('0x39')][_0xa14b('0x26')]);_0x37eddd['offset']=qs[_0xa14b('0x23')](_0x567ee6[_0xa14b('0x39')][_0xa14b('0x23')]);}_0x37eddd[_0xa14b('0x41')]=qs[_0xa14b('0x42')](_0x567ee6[_0xa14b('0x39')]['sort']);_0x37eddd[_0xa14b('0x45')]=qs[_0xa14b('0x3b')](_[_0xa14b('0x5e')](_0x567ee6[_0xa14b('0x39')],_0x4e7bc8[_0xa14b('0x3b')]));_0x37eddd[_0xa14b('0x45')][_0xa14b('0x5f')]=_0xc1ae85['id'];if(_0x567ee6[_0xa14b('0x39')][_0xa14b('0x43')]){_0x37eddd[_0xa14b('0x45')]=_[_0xa14b('0x44')](_0x37eddd[_0xa14b('0x45')],{'$or':_[_0xa14b('0x34')](_0x37eddd[_0xa14b('0x3d')],function(_0x36c6c4){var _0x498959={};_0x498959[_0x36c6c4]={'$like':'%'+_0x567ee6[_0xa14b('0x39')][_0xa14b('0x43')]+'%'};return _0x498959;})});}_0x37eddd=_['merge']({},_0x37eddd,_0x567ee6[_0xa14b('0x47')]);return db['UserSmsQueue']['findAll'](_0x37eddd);}})[_0xa14b('0x2d')](function(_0x6ddf95){if(_0x6ddf95){return db['User'][_0xa14b('0x60')]({'where':{'id':_[_0xa14b('0x34')](_0x6ddf95,_0xa14b('0x61')),'role':'agent'},'attributes':['id','name',_0xa14b('0x62'),_0xa14b('0x63'),_0xa14b('0x64')]});}})['then'](function(_0x385e29){if(_0x385e29){return{'count':_0x385e29[_0xa14b('0x25')],'rows':_[_0xa14b('0x34')](_0x385e29[_0xa14b('0x4b')],function(_0x37c5c4){return{'membername':_0x37c5c4[_0xa14b('0x31')],'UserId':_0x37c5c4['id'],'queue_name':_0x51a0b0[_0xa14b('0x31')],'SmsQueueId':_0x51a0b0['id'],'interface':util['format'](_0xa14b('0x65'),'SIP',_0x37c5c4['name']),'penalty':0x0,'paused':_0x37c5c4[_0xa14b('0x62')],'createdAt':_0x37c5c4[_0xa14b('0x64')],'updatedAt':_0x37c5c4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa14b('0x2d')](respondWithFilteredResult(_0x3fec35,_0x37eddd))[_0xa14b('0x59')](handleError(_0x3fec35,null));};exports[_0xa14b('0x66')]=function(_0x4754c5,_0x1d14d2,_0x122713){var _0x3b7841={};var _0x5b034c={};var _0x180ded;var _0x4d5777;return db[_0xa14b('0x35')][_0xa14b('0x5c')]({'where':{'id':_0x4754c5['params']['id']}})[_0xa14b('0x2d')](handleEntityNotFound(_0x1d14d2,null))[_0xa14b('0x2d')](function(_0x38527f){if(_0x38527f){_0x180ded=_0x38527f;_0x5b034c[_0xa14b('0x38')]=_[_0xa14b('0x3a')](db['Team']['rawAttributes']);_0x5b034c['query']=_[_0xa14b('0x3a')](_0x4754c5[_0xa14b('0x39')]);_0x5b034c[_0xa14b('0x3b')]=_[_0xa14b('0x3c')](_0x5b034c['model'],_0x5b034c['query']);_0x3b7841[_0xa14b('0x3d')]=_[_0xa14b('0x3c')](_0x5b034c[_0xa14b('0x38')],qs['fields'](_0x4754c5[_0xa14b('0x39')]['fields']));_0x3b7841['attributes']=_0x3b7841['attributes'][_0xa14b('0x4e')]?_0x3b7841['attributes']:_0x5b034c[_0xa14b('0x38')];_0x3b7841[_0xa14b('0x41')]=qs['sort'](_0x4754c5['query'][_0xa14b('0x42')]);_0x3b7841[_0xa14b('0x45')]=qs[_0xa14b('0x3b')](_[_0xa14b('0x5e')](_0x4754c5['query'],_0x5b034c[_0xa14b('0x3b')]));if(_0x4754c5[_0xa14b('0x39')][_0xa14b('0x43')]){_0x3b7841['where']=_['merge'](_0x3b7841['where'],{'$or':_[_0xa14b('0x34')](_0x3b7841[_0xa14b('0x3d')],function(_0x2d8691){var _0x1f987f={};_0x1f987f[_0x2d8691]={'$like':'%'+_0x4754c5[_0xa14b('0x39')]['filter']+'%'};return _0x1f987f;})});}_0x3b7841=_[_0xa14b('0x44')]({},_0x3b7841,_0x4754c5['options']);return _0x180ded['getTeams'](_0x3b7841);}})[_0xa14b('0x2d')](function(_0x154b05){if(_0x154b05){_0x4d5777=_0x154b05[_0xa14b('0x4e')];if(!_0x4754c5['query'][_0xa14b('0x3f')](_0xa14b('0x40'))){_0x3b7841[_0xa14b('0x26')]=qs[_0xa14b('0x26')](_0x4754c5[_0xa14b('0x39')]['limit']);_0x3b7841[_0xa14b('0x23')]=qs[_0xa14b('0x23')](_0x4754c5[_0xa14b('0x39')]['offset']);}return _0x180ded[_0xa14b('0x66')](_0x3b7841);}})[_0xa14b('0x2d')](function(_0x2c771a){if(_0x2c771a){return _0x2c771a?{'count':_0x4d5777,'rows':_0x2c771a}:null;}})[_0xa14b('0x2d')](respondWithResult(_0x1d14d2,null))[_0xa14b('0x59')](handleError(_0x1d14d2,null));};exports[_0xa14b('0x67')]=function(_0xed0904,_0x5476d8,_0x5c8296){var _0x2b7ffa=_0xed0904[_0xa14b('0x5a')][_0xa14b('0x68')];return db[_0xa14b('0x69')]['findAll']({'where':{'id':_0x2b7ffa},'attributes':['id'],'include':[{'model':db[_0xa14b('0x6a')],'as':_0xa14b('0x6b'),'attributes':['id','name',_0xa14b('0x6c'),_0xa14b('0x6d'),_0xa14b('0x6e')],'raw':!![]}]})[_0xa14b('0x2d')](function(_0x532390){if(_0x532390){var _0x50dc86=_['flatMap'](_0x532390,function(_0x593086){var _0x42688a=_0x593086[_0xa14b('0x2f')]({'plain':!![]});return _0x42688a[_0xa14b('0x6b')];});return db[_0xa14b('0x35')][_0xa14b('0x54')]({'where':{'id':_0xed0904[_0xa14b('0x4d')]['id']}})[_0xa14b('0x2d')](function(_0x52ab30){return db[_0xa14b('0x6f')][_0xa14b('0x70')](function(_0x40effb){return _0x52ab30[_0xa14b('0x67')](_0x2b7ffa,{'transaction':_0x40effb})[_0xa14b('0x2d')](function(){return BPromise[_0xa14b('0x71')](_0x50dc86,function(_0x478d30){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x478d30['id'],'SmsQueueId':_0xed0904[_0xa14b('0x4d')]['id']},'transaction':_0x40effb});});})['then'](function(){_0x50dc86[_0xa14b('0x72')](function(_0x5ccd9a){socket[_0xa14b('0x73')]('userSmsQueue:save',{'UserId':_0x5ccd9a['id'],'SmsQueueId':_0x52ab30['id']});});});});});}})['then'](respondWithStatusCode(_0x5476d8,null))['catch'](handleError(_0x5476d8,null));};exports['removeTeams']=function(_0x1e4205,_0x24364a,_0x33b1a4){return db[_0xa14b('0x69')][_0xa14b('0x4a')]({'where':{'id':_0x1e4205[_0xa14b('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa14b('0x6a')],'as':_0xa14b('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xa14b('0x2d')](handleEntityNotFound(_0x24364a,null))[_0xa14b('0x2d')](function(_0x2d8ebf){var _0x532eee=_['map'](_0x2d8ebf,'id');var _0x1d45a3=[];var _0x54cfbc=[];var _0x87ab74=squel[_0xa14b('0x74')]();_0x87ab74['field'](_0xa14b('0x75'))[_0xa14b('0x76')](_0xa14b('0x77'),'tq')[_0xa14b('0x78')](_0xa14b('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa14b('0x45')](_0xa14b('0x7a'),_0x1e4205['params']['id']);for(var _0x42b534=0x0;_0x42b534<_0x2d8ebf['length'];_0x42b534+=0x1){let _0x2e0e14=_0x2d8ebf[_0x42b534];for(var _0x527bc2=0x0;_0x527bc2<_0x2e0e14[_0xa14b('0x6b')][_0xa14b('0x4e')];_0x527bc2+=0x1){let _0xb752b9=_0x2e0e14[_0xa14b('0x6b')][_0x527bc2];var _0x193f54=_0x87ab74['clone']();_0x193f54[_0xa14b('0x45')](_0xa14b('0x7b'),_0xb752b9['id']);_0x54cfbc['push'](db[_0xa14b('0x6f')][_0xa14b('0x39')](_0x193f54['toString'](),{'type':db['sequelize'][_0xa14b('0x7c')][_0xa14b('0x7d')]})[_0xa14b('0x2d')](function(_0x5d800d){if(_0x5d800d[_0xa14b('0x4e')]===0x1){return _0xb752b9['id'];}else{var _0x4ce0fe=_['every'](_[_0xa14b('0x34')](_0x5d800d,_0xa14b('0x7e')),function(_0x3cc4ed){return _['includes'](_0x532eee,_0x3cc4ed);});if(_0x4ce0fe){return _0xb752b9['id'];}}}));}}return BPromise[_0xa14b('0x7f')](_0x54cfbc)['then'](function(_0x2aa0d7){_0x1d45a3=_(_0x1d45a3)['union'](_0x2aa0d7)[_0xa14b('0x80')]()['value']();return db[_0xa14b('0x35')]['find']({'where':{'id':_0x1e4205['params']['id']}})[_0xa14b('0x2d')](function(_0x37cd56){return db[_0xa14b('0x6f')][_0xa14b('0x70')](function(_0x361e98){return _0x37cd56['removeTeams'](_0x1e4205['query'][_0xa14b('0x68')],{'transaction':_0x361e98})[_0xa14b('0x2d')](function(){if(!_[_0xa14b('0x81')](_0x1d45a3)){return _0x37cd56[_0xa14b('0x82')](_0x1d45a3,{'transaction':_0x361e98});}})[_0xa14b('0x2d')](function(){_0x1d45a3[_0xa14b('0x72')](function(_0xddbf59){socket['emit'](_0xa14b('0x83'),{'UserId':_0xddbf59,'SmsQueueId':_0x37cd56['id']});});});});});});})[_0xa14b('0x2d')](respondWithStatusCode(_0x24364a,null))[_0xa14b('0x59')](handleError(_0x24364a,null));};exports[_0xa14b('0x84')]=function(_0x173c35,_0x1fc07c,_0x4b3c7a){return db[_0xa14b('0x35')][_0xa14b('0x54')]({'where':{'id':_0x173c35[_0xa14b('0x4d')]['id']}})[_0xa14b('0x2d')](handleEntityNotFound(_0x1fc07c,null))[_0xa14b('0x2d')](function(_0x324153){if(_0x324153){return _0x324153[_0xa14b('0x84')](_0x173c35['body'][_0xa14b('0x68')],_['omit'](_0x173c35[_0xa14b('0x5a')],[_0xa14b('0x68'),'id'])||{})[_0xa14b('0x85')](function(_0x5dcad0){for(var _0x89d253=0x0;_0x89d253<_0x173c35[_0xa14b('0x5a')][_0xa14b('0x68')][_0xa14b('0x4e')];_0x89d253+=0x1){socket[_0xa14b('0x73')]('userSmsQueue:save',{'UserId':_0x173c35[_0xa14b('0x5a')][_0xa14b('0x68')][_0x89d253],'SmsQueueId':_0x173c35[_0xa14b('0x4d')]['id']});}return _0x5dcad0;});}})['then'](respondWithResult(_0x1fc07c,null))[_0xa14b('0x59')](handleError(_0x1fc07c,null));};exports[_0xa14b('0x82')]=function(_0x4898e5,_0x3fcc94,_0x445a99){return db[_0xa14b('0x35')][_0xa14b('0x54')]({'where':{'id':_0x4898e5[_0xa14b('0x4d')]['id']}})[_0xa14b('0x2d')](handleEntityNotFound(_0x3fcc94,null))[_0xa14b('0x2d')](function(_0x12a9d7){if(_0x12a9d7){return _0x12a9d7['removeAgents'](_0x4898e5['query'][_0xa14b('0x68')])[_0xa14b('0x2d')](function(){if(_[_0xa14b('0x86')](_0x4898e5[_0xa14b('0x39')][_0xa14b('0x68')])){for(var _0x35e21c=0x0;_0x35e21c<_0x4898e5[_0xa14b('0x39')]['ids'][_0xa14b('0x4e')];_0x35e21c+=0x1){socket[_0xa14b('0x73')](_0xa14b('0x83'),{'UserId':Number(_0x4898e5['query'][_0xa14b('0x68')][_0x35e21c]),'SmsQueueId':Number(_0x4898e5['params']['id'])});}}else{socket['emit'](_0xa14b('0x83'),{'UserId':Number(_0x4898e5['query']['ids']),'SmsQueueId':Number(_0x4898e5['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3fcc94,null))[_0xa14b('0x59')](handleError(_0x3fcc94,null));};exports[_0xa14b('0x87')]=function(_0x2dca84,_0x5e8673,_0x28bc86){var _0x5d8e7f={};var _0x4366d5={};var _0xd182f1;var _0x73a4c9;return db[_0xa14b('0x35')][_0xa14b('0x5c')]({'where':{'id':_0x2dca84[_0xa14b('0x4d')]['id']}})[_0xa14b('0x2d')](handleEntityNotFound(_0x5e8673,null))[_0xa14b('0x2d')](function(_0x4a07fc){if(_0x4a07fc){_0xd182f1=_0x4a07fc;_0x4366d5[_0xa14b('0x38')]=_[_0xa14b('0x3a')](db[_0xa14b('0x6a')][_0xa14b('0x36')]);_0x4366d5[_0xa14b('0x39')]=_[_0xa14b('0x3a')](_0x2dca84[_0xa14b('0x39')]);_0x4366d5['filters']=_[_0xa14b('0x3c')](_0x4366d5[_0xa14b('0x38')],_0x4366d5[_0xa14b('0x39')]);_0x5d8e7f[_0xa14b('0x3d')]=_[_0xa14b('0x3c')](_0x4366d5[_0xa14b('0x38')],qs[_0xa14b('0x3e')](_0x2dca84[_0xa14b('0x39')][_0xa14b('0x3e')]));_0x5d8e7f[_0xa14b('0x3d')]=_0x5d8e7f[_0xa14b('0x3d')][_0xa14b('0x4e')]?_0x5d8e7f[_0xa14b('0x3d')]:_0x4366d5[_0xa14b('0x38')];_0x5d8e7f[_0xa14b('0x41')]=qs[_0xa14b('0x42')](_0x2dca84[_0xa14b('0x39')]['sort']);_0x5d8e7f[_0xa14b('0x45')]=qs[_0xa14b('0x3b')](_[_0xa14b('0x5e')](_0x2dca84[_0xa14b('0x39')],_0x4366d5[_0xa14b('0x3b')]));if(_0x2dca84[_0xa14b('0x39')][_0xa14b('0x43')]){_0x5d8e7f[_0xa14b('0x45')]=_[_0xa14b('0x44')](_0x5d8e7f['where'],{'$or':_[_0xa14b('0x34')](_0x5d8e7f['attributes'],function(_0x9aca12){var _0xa67625={};_0xa67625[_0x9aca12]={'$like':'%'+_0x2dca84[_0xa14b('0x39')][_0xa14b('0x43')]+'%'};return _0xa67625;})});}_0x5d8e7f=_[_0xa14b('0x44')]({},_0x5d8e7f,_0x2dca84[_0xa14b('0x47')]);return _0xd182f1[_0xa14b('0x87')](_0x5d8e7f);}})[_0xa14b('0x2d')](function(_0x4c1420){if(_0x4c1420){_0x73a4c9=_0x4c1420[_0xa14b('0x4e')];if(!_0x2dca84[_0xa14b('0x39')]['hasOwnProperty'](_0xa14b('0x40'))){_0x5d8e7f[_0xa14b('0x26')]=qs[_0xa14b('0x26')](_0x2dca84[_0xa14b('0x39')]['limit']);_0x5d8e7f[_0xa14b('0x23')]=qs[_0xa14b('0x23')](_0x2dca84[_0xa14b('0x39')]['offset']);}return _0xd182f1[_0xa14b('0x87')](_0x5d8e7f);}})['then'](function(_0x99b8cb){if(_0x99b8cb){return _0x99b8cb?{'count':_0x73a4c9,'rows':_0x99b8cb}:null;}})['then'](respondWithResult(_0x5e8673,null))[_0xa14b('0x59')](handleError(_0x5e8673,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 8ead658..7479087 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 _0xf492=['setMaxListeners','remove','hasOwnProperty','exports','events','SmsQueue'];(function(_0x4f4c11,_0xdb6add){var _0x4dfd33=function(_0x163cfe){while(--_0x163cfe){_0x4f4c11['push'](_0x4f4c11['shift']());}};_0x4dfd33(++_0xdb6add);}(_0xf492,0xb2));var _0x2f49=function(_0x11c25d,_0xdc8a12){_0x11c25d=_0x11c25d-0x0;var _0x2805b1=_0xf492[_0x11c25d];return _0x2805b1;};'use strict';var EventEmitter=require(_0x2f49('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x2f49('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2f49('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2f49('0x3')};function emitEvent(_0x3b0006){return function(_0x2c6e38,_0xc4e27,_0x4d325c){SmsQueueEvents['emit'](_0x3b0006+':'+_0x2c6e38['id'],_0x2c6e38);SmsQueueEvents['emit'](_0x3b0006,_0x2c6e38);_0x4d325c(null);};}for(var e in events){if(events[_0x2f49('0x4')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x2f49('0x5')]=SmsQueueEvents; \ No newline at end of file +var _0xda51=['remove','emit','hook','../../mysqldb'];(function(_0x2cc0a0,_0x2305d1){var _0x5046e1=function(_0x442491){while(--_0x442491){_0x2cc0a0['push'](_0x2cc0a0['shift']());}};_0x5046e1(++_0x2305d1);}(_0xda51,0x7f));var _0x1da5=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0xda51[_0xb65e77];return _0x38134b;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x1da5('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1da5('0x1')};function emitEvent(_0x2344ad){return function(_0x27d095,_0x43f993,_0xfc6209){SmsQueueEvents[_0x1da5('0x2')](_0x2344ad+':'+_0x27d095['id'],_0x27d095);SmsQueueEvents[_0x1da5('0x2')](_0x2344ad,_0x27d095);_0xfc6209(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x1da5('0x3')](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 3c0c9f3..8910cc0 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 _0xbb6b=['rimraf','../../config/environment','./smsQueue.attributes','SmsQueue','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0xbb6b,0xea));var _0xbbb6=function(_0x1c53d1,_0x4fa82b){_0x1c53d1=_0x1c53d1-0x0;var _0x24f9a4=_0xbb6b[_0x1c53d1];return _0x24f9a4;};'use strict';var _=require('lodash');var util=require(_0xbbb6('0x0'));var logger=require(_0xbbb6('0x1'))('api');var moment=require(_0xbbb6('0x2'));var BPromise=require(_0xbbb6('0x3'));var rp=require(_0xbbb6('0x4'));var fs=require('fs');var path=require(_0xbbb6('0x5'));var rimraf=require(_0xbbb6('0x6'));var config=require(_0xbbb6('0x7'));var attributes=require(_0xbbb6('0x8'));module['exports']=function(_0x45d31e,_0x1b7052){return _0x45d31e['define'](_0xbbb6('0x9'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7a3=['../../config/logger','bluebird','../../config/environment','define','sms_queues','lodash'];(function(_0x51f408,_0x4b5d14){var _0x946a12=function(_0x26d7c8){while(--_0x26d7c8){_0x51f408['push'](_0x51f408['shift']());}};_0x946a12(++_0x4b5d14);}(_0xc7a3,0x143));var _0x3c7a=function(_0x1aec86,_0x17e395){_0x1aec86=_0x1aec86-0x0;var _0x10fcb4=_0xc7a3[_0x1aec86];return _0x10fcb4;};'use strict';var _=require(_0x3c7a('0x0'));var util=require('util');var logger=require(_0x3c7a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3c7a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3c7a('0x3'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x15b40c,_0x28f0de){return _0x15b40c[_0x3c7a('0x4')]('SmsQueue',attributes,{'tableName':_0x3c7a('0x5'),'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 df96be0..aef0d9c 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 _0x2b4f=['http','redis','localhost','socket.io-emitter','./smsQueue.socket','request','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetSmsQueue','options','raw','where','attributes','limit','include','model','map','then','debug','ShowSmsQueue','SmsQueue','find','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0x2b4f,0x1f1));var _0xf2b4=function(_0x22507b,_0x35628b){_0x22507b=_0x22507b-0x0;var _0x201e12=_0x2b4f[_0x22507b];return _0x201e12;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf2b4('0x0'));var fs=require('fs');var Redis=require(_0xf2b4('0x1'));var db=require(_0xf2b4('0x2'))['db'];var utils=require(_0xf2b4('0x3'));var logger=require(_0xf2b4('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf2b4('0x5'));var client=jayson[_0xf2b4('0x6')][_0xf2b4('0x7')]({'port':0x232a});config[_0xf2b4('0x8')]=_['defaults'](config[_0xf2b4('0x8')],{'host':_0xf2b4('0x9'),'port':0x18eb});var socket=require(_0xf2b4('0xa'))(new Redis(config[_0xf2b4('0x8')]));require(_0xf2b4('0xb'))['register'](socket);function respondWithRpcPromise(_0x2f5f11,_0x308dbb,_0x47e295){return new BPromise(function(_0x58b36b,_0x5c64ac){return client[_0xf2b4('0xc')](_0x2f5f11,_0x47e295)['then'](function(_0x30ba53){logger['info'](_0xf2b4('0xd'),_0x308dbb,_0xf2b4('0xe'));logger['debug'](_0xf2b4('0xf'),_0x308dbb,'request\x20sent',JSON[_0xf2b4('0x10')](_0x30ba53));if(_0x30ba53[_0xf2b4('0x11')]){if(_0x30ba53[_0xf2b4('0x11')][_0xf2b4('0x12')]===0x1f4){logger[_0xf2b4('0x11')](_0xf2b4('0xd'),_0x308dbb,_0x30ba53[_0xf2b4('0x11')][_0xf2b4('0x13')]);return _0x5c64ac(_0x30ba53[_0xf2b4('0x11')][_0xf2b4('0x13')]);}logger[_0xf2b4('0x11')](_0xf2b4('0xd'),_0x308dbb,_0x30ba53['error'][_0xf2b4('0x13')]);return _0x58b36b(_0x30ba53[_0xf2b4('0x11')][_0xf2b4('0x13')]);}else{logger[_0xf2b4('0x14')](_0xf2b4('0xd'),_0x308dbb,'request\x20sent');_0x58b36b(_0x30ba53['result'][_0xf2b4('0x13')]);}})[_0xf2b4('0x15')](function(_0xab65cb){logger[_0xf2b4('0x11')](_0xf2b4('0xd'),_0x308dbb,_0xab65cb);_0x5c64ac(_0xab65cb);});});}exports[_0xf2b4('0x16')]=function(_0x43147d){var _0x1aefef=this;return new Promise(function(_0x5469fe,_0x5d9815){return db['SmsQueue']['findAll']({'raw':_0x43147d[_0xf2b4('0x17')]?_0x43147d[_0xf2b4('0x17')][_0xf2b4('0x18')]===undefined?!![]:![]:!![],'where':_0x43147d[_0xf2b4('0x17')]?_0x43147d['options'][_0xf2b4('0x19')]||null:null,'attributes':_0x43147d[_0xf2b4('0x17')]?_0x43147d['options'][_0xf2b4('0x1a')]||null:null,'limit':_0x43147d['options']?_0x43147d[_0xf2b4('0x17')][_0xf2b4('0x1b')]||null:null,'include':_0x43147d[_0xf2b4('0x17')]?_0x43147d[_0xf2b4('0x17')]['include']?_['map'](_0x43147d[_0xf2b4('0x17')][_0xf2b4('0x1c')],function(_0x1adbdf){return{'model':db[_0x1adbdf[_0xf2b4('0x1d')]],'as':_0x1adbdf['as'],'attributes':_0x1adbdf[_0xf2b4('0x1a')],'include':_0x1adbdf[_0xf2b4('0x1c')]?_[_0xf2b4('0x1e')](_0x1adbdf[_0xf2b4('0x1c')],function(_0x1f789d){return{'model':db[_0x1f789d['model']],'as':_0x1f789d['as'],'attributes':_0x1f789d[_0xf2b4('0x1a')],'include':_0x1f789d[_0xf2b4('0x1c')]?_['map'](_0x1f789d[_0xf2b4('0x1c')],function(_0x8593eb){return{'model':db[_0x8593eb['model']],'as':_0x8593eb['as'],'attributes':_0x8593eb[_0xf2b4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf2b4('0x1f')](function(_0xb899e5){logger[_0xf2b4('0x14')]('GetSmsQueue',_0x43147d);logger[_0xf2b4('0x20')](_0xf2b4('0x16'),_0x43147d,JSON['stringify'](_0xb899e5));_0x5469fe(_0xb899e5);})[_0xf2b4('0x15')](function(_0x138208){logger['error'](_0xf2b4('0x16'),_0x138208[_0xf2b4('0x13')],_0x43147d);_0x5d9815(_0x1aefef['error'](0x1f4,_0x138208[_0xf2b4('0x13')]));});});};exports[_0xf2b4('0x21')]=function(_0x11ce02){var _0x83835c=this;return new Promise(function(_0x132cfe,_0x32b3e3){return db[_0xf2b4('0x22')][_0xf2b4('0x23')]({'raw':_0x11ce02[_0xf2b4('0x17')]?_0x11ce02[_0xf2b4('0x17')][_0xf2b4('0x18')]===undefined?!![]:![]:!![],'where':_0x11ce02[_0xf2b4('0x17')]?_0x11ce02[_0xf2b4('0x17')][_0xf2b4('0x19')]||null:null,'attributes':_0x11ce02[_0xf2b4('0x17')]?_0x11ce02[_0xf2b4('0x17')]['attributes']||null:null,'include':_0x11ce02[_0xf2b4('0x17')]?_0x11ce02[_0xf2b4('0x17')]['include']?_[_0xf2b4('0x1e')](_0x11ce02[_0xf2b4('0x17')][_0xf2b4('0x1c')],function(_0x530500){return{'model':db[_0x530500[_0xf2b4('0x1d')]],'as':_0x530500['as'],'attributes':_0x530500[_0xf2b4('0x1a')],'include':_0x530500[_0xf2b4('0x1c')]?_[_0xf2b4('0x1e')](_0x530500['include'],function(_0x429ff3){return{'model':db[_0x429ff3[_0xf2b4('0x1d')]],'as':_0x429ff3['as'],'attributes':_0x429ff3[_0xf2b4('0x1a')],'include':_0x429ff3['include']?_[_0xf2b4('0x1e')](_0x429ff3['include'],function(_0x944272){return{'model':db[_0x944272[_0xf2b4('0x1d')]],'as':_0x944272['as'],'attributes':_0x944272[_0xf2b4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd9bef1){logger[_0xf2b4('0x14')]('ShowSmsQueue',_0x11ce02);logger[_0xf2b4('0x20')](_0xf2b4('0x21'),_0x11ce02,JSON[_0xf2b4('0x10')](_0xd9bef1));_0x132cfe(_0xd9bef1);})['catch'](function(_0x203505){logger[_0xf2b4('0x11')](_0xf2b4('0x21'),_0x203505[_0xf2b4('0x13')],_0x11ce02);_0x32b3e3(_0x83835c['error'](0x1f4,_0x203505[_0xf2b4('0x13')]));});});}; \ No newline at end of file +var _0x5b34=['findAll','options','where','attributes','limit','map','model','include','ShowSmsQueue','find','raw','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','info','result','catch','GetSmsQueue','SmsQueue'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5b34,0x1c3));var _0x45b3=function(_0x404f73,_0x1275d1){_0x404f73=_0x404f73-0x0;var _0x2de7fa=_0x5b34[_0x404f73];return _0x2de7fa;};'use strict';var _=require('lodash');var util=require(_0x45b3('0x0'));var moment=require(_0x45b3('0x1'));var BPromise=require('bluebird');var rs=require(_0x45b3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45b3('0x3'))['db'];var utils=require(_0x45b3('0x4'));var logger=require('../../config/logger')(_0x45b3('0x5'));var config=require('../../config/environment');var jayson=require(_0x45b3('0x6'));var client=jayson[_0x45b3('0x7')][_0x45b3('0x8')]({'port':0x232a});config[_0x45b3('0x9')]=_[_0x45b3('0xa')](config[_0x45b3('0x9')],{'host':_0x45b3('0xb'),'port':0x18eb});var socket=require(_0x45b3('0xc'))(new Redis(config[_0x45b3('0x9')]));require('./smsQueue.socket')[_0x45b3('0xd')](socket);function respondWithRpcPromise(_0x2f33d2,_0x48ff2c,_0xfe40f2){return new BPromise(function(_0x2d6e7d,_0xdb50e2){return client[_0x45b3('0xe')](_0x2f33d2,_0xfe40f2)[_0x45b3('0xf')](function(_0x532fe2){logger['info']('SmsQueue,\x20%s,\x20%s',_0x48ff2c,_0x45b3('0x10'));logger[_0x45b3('0x11')](_0x45b3('0x12'),_0x48ff2c,_0x45b3('0x10'),JSON[_0x45b3('0x13')](_0x532fe2));if(_0x532fe2['error']){if(_0x532fe2[_0x45b3('0x14')][_0x45b3('0x15')]===0x1f4){logger[_0x45b3('0x14')](_0x45b3('0x16'),_0x48ff2c,_0x532fe2[_0x45b3('0x14')][_0x45b3('0x17')]);return _0xdb50e2(_0x532fe2['error'][_0x45b3('0x17')]);}logger['error'](_0x45b3('0x16'),_0x48ff2c,_0x532fe2[_0x45b3('0x14')]['message']);return _0x2d6e7d(_0x532fe2[_0x45b3('0x14')][_0x45b3('0x17')]);}else{logger[_0x45b3('0x18')](_0x45b3('0x16'),_0x48ff2c,_0x45b3('0x10'));_0x2d6e7d(_0x532fe2[_0x45b3('0x19')][_0x45b3('0x17')]);}})[_0x45b3('0x1a')](function(_0x255acd){logger[_0x45b3('0x14')](_0x45b3('0x16'),_0x48ff2c,_0x255acd);_0xdb50e2(_0x255acd);});});}exports[_0x45b3('0x1b')]=function(_0x35d209){var _0x7a98eb=this;return new Promise(function(_0x2d5d6c,_0x574dbc){return db[_0x45b3('0x1c')][_0x45b3('0x1d')]({'raw':_0x35d209[_0x45b3('0x1e')]?_0x35d209['options']['raw']===undefined?!![]:![]:!![],'where':_0x35d209[_0x45b3('0x1e')]?_0x35d209[_0x45b3('0x1e')][_0x45b3('0x1f')]||null:null,'attributes':_0x35d209[_0x45b3('0x1e')]?_0x35d209[_0x45b3('0x1e')][_0x45b3('0x20')]||null:null,'limit':_0x35d209['options']?_0x35d209[_0x45b3('0x1e')][_0x45b3('0x21')]||null:null,'include':_0x35d209[_0x45b3('0x1e')]?_0x35d209[_0x45b3('0x1e')]['include']?_[_0x45b3('0x22')](_0x35d209[_0x45b3('0x1e')]['include'],function(_0x58523a){return{'model':db[_0x58523a[_0x45b3('0x23')]],'as':_0x58523a['as'],'attributes':_0x58523a[_0x45b3('0x20')],'include':_0x58523a[_0x45b3('0x24')]?_['map'](_0x58523a[_0x45b3('0x24')],function(_0x9022cb){return{'model':db[_0x9022cb[_0x45b3('0x23')]],'as':_0x9022cb['as'],'attributes':_0x9022cb[_0x45b3('0x20')],'include':_0x9022cb[_0x45b3('0x24')]?_['map'](_0x9022cb[_0x45b3('0x24')],function(_0x37d99d){return{'model':db[_0x37d99d[_0x45b3('0x23')]],'as':_0x37d99d['as'],'attributes':_0x37d99d[_0x45b3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x45b3('0xf')](function(_0x33b43c){logger['info'](_0x45b3('0x1b'),_0x35d209);logger[_0x45b3('0x11')](_0x45b3('0x1b'),_0x35d209,JSON[_0x45b3('0x13')](_0x33b43c));_0x2d5d6c(_0x33b43c);})[_0x45b3('0x1a')](function(_0x5da1c5){logger[_0x45b3('0x14')](_0x45b3('0x1b'),_0x5da1c5[_0x45b3('0x17')],_0x35d209);_0x574dbc(_0x7a98eb[_0x45b3('0x14')](0x1f4,_0x5da1c5[_0x45b3('0x17')]));});});};exports[_0x45b3('0x25')]=function(_0x12cd2e){var _0x3ac171=this;return new Promise(function(_0x1d982e,_0x271ec9){return db['SmsQueue'][_0x45b3('0x26')]({'raw':_0x12cd2e[_0x45b3('0x1e')]?_0x12cd2e[_0x45b3('0x1e')][_0x45b3('0x27')]===undefined?!![]:![]:!![],'where':_0x12cd2e['options']?_0x12cd2e[_0x45b3('0x1e')][_0x45b3('0x1f')]||null:null,'attributes':_0x12cd2e[_0x45b3('0x1e')]?_0x12cd2e[_0x45b3('0x1e')][_0x45b3('0x20')]||null:null,'include':_0x12cd2e[_0x45b3('0x1e')]?_0x12cd2e[_0x45b3('0x1e')][_0x45b3('0x24')]?_[_0x45b3('0x22')](_0x12cd2e[_0x45b3('0x1e')][_0x45b3('0x24')],function(_0x1f7ce8){return{'model':db[_0x1f7ce8[_0x45b3('0x23')]],'as':_0x1f7ce8['as'],'attributes':_0x1f7ce8['attributes'],'include':_0x1f7ce8[_0x45b3('0x24')]?_[_0x45b3('0x22')](_0x1f7ce8[_0x45b3('0x24')],function(_0x42006a){return{'model':db[_0x42006a[_0x45b3('0x23')]],'as':_0x42006a['as'],'attributes':_0x42006a['attributes'],'include':_0x42006a[_0x45b3('0x24')]?_[_0x45b3('0x22')](_0x42006a[_0x45b3('0x24')],function(_0x3ba32f){return{'model':db[_0x3ba32f[_0x45b3('0x23')]],'as':_0x3ba32f['as'],'attributes':_0x3ba32f[_0x45b3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x45b3('0xf')](function(_0x4a174){logger[_0x45b3('0x18')](_0x45b3('0x25'),_0x12cd2e);logger[_0x45b3('0x11')](_0x45b3('0x25'),_0x12cd2e,JSON[_0x45b3('0x13')](_0x4a174));_0x1d982e(_0x4a174);})['catch'](function(_0xac1dac){logger[_0x45b3('0x14')](_0x45b3('0x25'),_0xac1dac[_0x45b3('0x17')],_0x12cd2e);_0x271ec9(_0x3ac171['error'](0x1f4,_0xac1dac[_0x45b3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index acedeb5..9aaaeeb 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 _0x2e8c=['emit','removeListener','register','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x2cb766,_0x1096f1){var _0x3edc14=function(_0x309e2f){while(--_0x309e2f){_0x2cb766['push'](_0x2cb766['shift']());}};_0x3edc14(++_0x1096f1);}(_0x2e8c,0xcc));var _0xc2e8=function(_0x5408ee,_0x545804){_0x5408ee=_0x5408ee-0x0;var _0x19b8ca=_0x2e8c[_0x5408ee];return _0x19b8ca;};'use strict';var SmsQueueEvents=require(_0xc2e8('0x0'));var events=[_0xc2e8('0x1'),_0xc2e8('0x2'),_0xc2e8('0x3')];function createListener(_0x1fc9a8,_0x2feecf){return function(_0x335564){_0x2feecf[_0xc2e8('0x4')](_0x1fc9a8,_0x335564);};}function removeListener(_0x5c070d,_0x182368){return function(){SmsQueueEvents[_0xc2e8('0x5')](_0x5c070d,_0x182368);};}exports[_0xc2e8('0x6')]=function(_0x1e0cf6){for(var _0x5d53f1=0x0,_0x1bd54b=events['length'];_0x5d53f1<_0x1bd54b;_0x5d53f1++){var _0x5345f4=events[_0x5d53f1];var _0x38e46e=createListener(_0xc2e8('0x7')+_0x5345f4,_0x1e0cf6);SmsQueueEvents['on'](_0x5345f4,_0x38e46e);}}; \ No newline at end of file +var _0x4aa2=['remove','removeListener','length','smsQueue:','./smsQueue.events','save'];(function(_0x3d0047,_0x4a4959){var _0x1cc253=function(_0x5b6369){while(--_0x5b6369){_0x3d0047['push'](_0x3d0047['shift']());}};_0x1cc253(++_0x4a4959);}(_0x4aa2,0xfa));var _0x24aa=function(_0x3eaf49,_0x4b6ca1){_0x3eaf49=_0x3eaf49-0x0;var _0x1b6d5c=_0x4aa2[_0x3eaf49];return _0x1b6d5c;};'use strict';var SmsQueueEvents=require(_0x24aa('0x0'));var events=[_0x24aa('0x1'),_0x24aa('0x2'),'update'];function createListener(_0x188923,_0x302e5a){return function(_0x405975){_0x302e5a['emit'](_0x188923,_0x405975);};}function removeListener(_0x2abcc6,_0x46518a){return function(){SmsQueueEvents[_0x24aa('0x3')](_0x2abcc6,_0x46518a);};}exports['register']=function(_0x4f05cd){for(var _0x369876=0x0,_0x17626b=events[_0x24aa('0x4')];_0x369876<_0x17626b;_0x369876++){var _0x200f82=events[_0x369876];var _0x51057d=createListener(_0x24aa('0x5')+_0x200f82,_0x4f05cd);SmsQueueEvents['on'](_0x200f82,_0x51057d);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 18577a7..4d3b260 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 _0xe017=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0xe017,0x18e));var _0x7e01=function(_0x27a4b7,_0x1d45c7){_0x27a4b7=_0x27a4b7-0x0;var _0x422a17=_0xe017[_0x27a4b7];return _0x422a17;};'use strict';var multer=require('multer');var util=require(_0x7e01('0x0'));var path=require('path');var timeout=require(_0x7e01('0x1'));var express=require(_0x7e01('0x2'));var router=express[_0x7e01('0x3')]();var fs_extra=require(_0x7e01('0x4'));var auth=require(_0x7e01('0x5'));var interaction=require(_0x7e01('0x6'));var config=require('../../config/environment');var controller=require(_0x7e01('0x7'));router[_0x7e01('0x8')]('/',auth[_0x7e01('0x9')](),controller[_0x7e01('0xa')]);router[_0x7e01('0x8')]('/describe',auth[_0x7e01('0x9')](),controller[_0x7e01('0xb')]);router[_0x7e01('0x8')](_0x7e01('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7e01('0xd')]('/',auth[_0x7e01('0x9')](),controller[_0x7e01('0xe')]);router[_0x7e01('0xf')](_0x7e01('0xc'),auth[_0x7e01('0x9')](),controller[_0x7e01('0x10')]);router[_0x7e01('0x11')](_0x7e01('0xc'),auth[_0x7e01('0x9')](),controller[_0x7e01('0x12')]);module[_0x7e01('0x13')]=router; \ No newline at end of file +var _0xc0d9=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x5b28a5,_0x1904e2){var _0xcdaca2=function(_0x12bbc6){while(--_0x12bbc6){_0x5b28a5['push'](_0x5b28a5['shift']());}};_0xcdaca2(++_0x1904e2);}(_0xc0d9,0x192));var _0x9c0d=function(_0x58cfee,_0x232310){_0x58cfee=_0x58cfee-0x0;var _0x4fbc1e=_0xc0d9[_0x58cfee];return _0x4fbc1e;};'use strict';var multer=require(_0x9c0d('0x0'));var util=require(_0x9c0d('0x1'));var path=require(_0x9c0d('0x2'));var timeout=require(_0x9c0d('0x3'));var express=require('express');var router=express[_0x9c0d('0x4')]();var fs_extra=require(_0x9c0d('0x5'));var auth=require(_0x9c0d('0x6'));var interaction=require(_0x9c0d('0x7'));var config=require(_0x9c0d('0x8'));var controller=require(_0x9c0d('0x9'));router[_0x9c0d('0xa')]('/',auth[_0x9c0d('0xb')](),controller['index']);router[_0x9c0d('0xa')]('/describe',auth[_0x9c0d('0xb')](),controller['describe']);router['get'](_0x9c0d('0xc'),auth[_0x9c0d('0xb')](),controller[_0x9c0d('0xd')]);router[_0x9c0d('0xe')]('/',auth[_0x9c0d('0xb')](),controller[_0x9c0d('0xf')]);router['put'](_0x9c0d('0xc'),auth[_0x9c0d('0xb')](),controller['update']);router[_0x9c0d('0x10')](_0x9c0d('0xc'),auth['isAuthenticated'](),controller[_0x9c0d('0x11')]);module[_0x9c0d('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 235add0..d53f383 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 _0xe3a0=['exports','STRING','DATE','moment','sequelize'];(function(_0x558d75,_0x8239fb){var _0x2684c3=function(_0x3321af){while(--_0x3321af){_0x558d75['push'](_0x558d75['shift']());}};_0x2684c3(++_0x8239fb);}(_0xe3a0,0x125));var _0x0e3a=function(_0x38aba8,_0x42c77b){_0x38aba8=_0x38aba8-0x0;var _0x472fd0=_0xe3a0[_0x38aba8];return _0x472fd0;};'use strict';var moment=require(_0x0e3a('0x0'));var Sequelize=require(_0x0e3a('0x1'));module[_0x0e3a('0x2')]={'uniqueid':{'type':Sequelize[_0x0e3a('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0e3a('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0e3a('0x3')]}}; \ No newline at end of file +var _0xd2b6=['moment','sequelize','exports','STRING','DATE'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd2b6,0x14f));var _0x6d2b=function(_0xe6ba7b,_0x4b3ae4){_0xe6ba7b=_0xe6ba7b-0x0;var _0x594e65=_0xd2b6[_0xe6ba7b];return _0x594e65;};'use strict';var moment=require(_0x6d2b('0x0'));var Sequelize=require(_0x6d2b('0x1'));module[_0x6d2b('0x2')]={'uniqueid':{'type':Sequelize[_0x6d2b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6d2b('0x3')]},'joinAt':{'type':Sequelize[_0x6d2b('0x4')]},'leaveAt':{'type':Sequelize[_0x6d2b('0x4')]},'acceptAt':{'type':Sequelize[_0x6d2b('0x4')]},'exitAt':{'type':Sequelize[_0x6d2b('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 410aa8b..7ae893d 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 _0x51c0=['fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','SmsQueueReport','includeAll','include','findAll','catch','params','fields','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs'];(function(_0x24b283,_0x510549){var _0x23d8a1=function(_0xc309f){while(--_0xc309f){_0x24b283['push'](_0x24b283['shift']());}};_0x23d8a1(++_0x510549);}(_0x51c0,0x1ad));var _0x051c=function(_0x32f80e,_0x520089){_0x32f80e=_0x32f80e-0x0;var _0x15c58c=_0x51c0[_0x32f80e];return _0x15c58c;};'use strict';var emlformat=require(_0x051c('0x0'));var rimraf=require(_0x051c('0x1'));var zipdir=require(_0x051c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x051c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x051c('0x4'));var util=require(_0x051c('0x5'));var path=require('path');var sox=require(_0x051c('0x6'));var csv=require(_0x051c('0x7'));var ejs=require(_0x051c('0x8'));var fs=require('fs');var fs_extra=require(_0x051c('0x9'));var _=require('lodash');var squel=require(_0x051c('0xa'));var crypto=require(_0x051c('0xb'));var jsforce=require(_0x051c('0xc'));var deskjs=require(_0x051c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x051c('0xe'));var Redis=require(_0x051c('0xf'));var authService=require(_0x051c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x051c('0x11'));var hardwareService=require(_0x051c('0x12'));var logger=require(_0x051c('0x13'))(_0x051c('0x14'));var utils=require('../../config/utils');var config=require(_0x051c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x051c('0x16'))['db'];function respondWithStatusCode(_0x1f0796,_0x44382e){_0x44382e=_0x44382e||0xcc;return function(_0x573c5a){if(_0x573c5a){return _0x1f0796[_0x051c('0x17')](_0x44382e);}return _0x1f0796[_0x051c('0x18')](_0x44382e)[_0x051c('0x19')]();};}function respondWithResult(_0x21cbbb,_0x353a68){_0x353a68=_0x353a68||0xc8;return function(_0x17ecb8){if(_0x17ecb8){return _0x21cbbb[_0x051c('0x18')](_0x353a68)[_0x051c('0x1a')](_0x17ecb8);}};}function respondWithFilteredResult(_0x25a96a,_0x43e2a9){return function(_0x17e043){if(_0x17e043){var _0x68e693=typeof _0x43e2a9[_0x051c('0x1b')]===_0x051c('0x1c')&&typeof _0x43e2a9['limit']===_0x051c('0x1c');var _0x4207b0=_0x17e043[_0x051c('0x1d')];var _0x5dd259=_0x68e693?0x0:_0x43e2a9[_0x051c('0x1b')];var _0x5988ae=_0x68e693?_0x17e043[_0x051c('0x1d')]:_0x43e2a9[_0x051c('0x1b')]+_0x43e2a9[_0x051c('0x1e')];var _0x3835eb;if(_0x5988ae>=_0x4207b0){_0x5988ae=_0x4207b0;_0x3835eb=0xc8;}else{_0x3835eb=0xce;}_0x25a96a[_0x051c('0x18')](_0x3835eb);return _0x25a96a[_0x051c('0x1f')](_0x051c('0x20'),_0x5dd259+'-'+_0x5988ae+'/'+_0x4207b0)[_0x051c('0x1a')](_0x17e043);}return null;};}function patchUpdates(_0x2dd6b8){return function(_0x4e8a9d){try{jsonpatch['apply'](_0x4e8a9d,_0x2dd6b8,!![]);}catch(_0x315245){return BPromise[_0x051c('0x21')](_0x315245);}return _0x4e8a9d[_0x051c('0x22')]();};}function saveUpdates(_0x58324e,_0x3f18ff){return function(_0x7c9a34){if(_0x7c9a34){return _0x7c9a34[_0x051c('0x23')](_0x58324e)[_0x051c('0x24')](function(_0x1f858e){return _0x1f858e;});}return null;};}function removeEntity(_0x547de3,_0x1740d0){return function(_0xaff9da){if(_0xaff9da){return _0xaff9da[_0x051c('0x25')]()['then'](function(){_0x547de3[_0x051c('0x18')](0xcc)[_0x051c('0x19')]();});}};}function handleEntityNotFound(_0x105d70,_0x32e9ce){return function(_0x2432a6){if(!_0x2432a6){_0x105d70[_0x051c('0x17')](0x194);}return _0x2432a6;};}function handleError(_0x23ccbf,_0x5e9e2e){_0x5e9e2e=_0x5e9e2e||0x1f4;return function(_0x2e8c91){logger['error'](_0x2e8c91[_0x051c('0x26')]);if(_0x2e8c91['name']){delete _0x2e8c91[_0x051c('0x27')];}_0x23ccbf[_0x051c('0x18')](_0x5e9e2e)[_0x051c('0x28')](_0x2e8c91);};}exports[_0x051c('0x29')]=function(_0x2b9401,_0x5ba2fc){var _0x4003d3={},_0x630014={},_0x222284={'count':0x0,'rows':[]};var _0x3d34c2=_['map'](db['SmsQueueReport'][_0x051c('0x2a')],function(_0x39284d){return{'name':_0x39284d[_0x051c('0x2b')],'type':_0x39284d[_0x051c('0x2c')][_0x051c('0x2d')]};});_0x630014[_0x051c('0x2e')]=_[_0x051c('0x2f')](_0x3d34c2,_0x051c('0x27'));_0x630014[_0x051c('0x30')]=_[_0x051c('0x31')](_0x2b9401[_0x051c('0x30')]);_0x630014[_0x051c('0x32')]=_[_0x051c('0x33')](_0x630014['model'],_0x630014[_0x051c('0x30')]);_0x4003d3[_0x051c('0x34')]=_[_0x051c('0x33')](_0x630014[_0x051c('0x2e')],qs['fields'](_0x2b9401[_0x051c('0x30')]['fields']));_0x4003d3[_0x051c('0x34')]=_0x4003d3[_0x051c('0x34')][_0x051c('0x35')]?_0x4003d3['attributes']:_0x630014[_0x051c('0x2e')];if(!_0x2b9401[_0x051c('0x30')][_0x051c('0x36')]('nolimit')){_0x4003d3[_0x051c('0x1e')]=qs[_0x051c('0x1e')](_0x2b9401[_0x051c('0x30')][_0x051c('0x1e')]);_0x4003d3[_0x051c('0x1b')]=qs['offset'](_0x2b9401[_0x051c('0x30')]['offset']);}_0x4003d3[_0x051c('0x37')]=qs[_0x051c('0x38')](_0x2b9401[_0x051c('0x30')][_0x051c('0x38')]);_0x4003d3['where']=qs[_0x051c('0x32')](_[_0x051c('0x39')](_0x2b9401['query'],_0x630014[_0x051c('0x32')]),_0x3d34c2);if(_0x2b9401[_0x051c('0x30')]['filter']){_0x4003d3[_0x051c('0x3a')]=_[_0x051c('0x3b')](_0x4003d3[_0x051c('0x3a')],{'$or':_[_0x051c('0x2f')](_0x3d34c2,function(_0x20d601){if(_0x20d601[_0x051c('0x2c')]!==_0x051c('0x3c')){var _0x38fc06={};_0x38fc06[_0x20d601[_0x051c('0x27')]]={'$like':'%'+_0x2b9401[_0x051c('0x30')][_0x051c('0x3d')]+'%'};return _0x38fc06;}})});}_0x4003d3=_[_0x051c('0x3b')]({},_0x4003d3,_0x2b9401['options']);var _0x2105c5={'where':_0x4003d3['where']};return db[_0x051c('0x3e')][_0x051c('0x1d')](_0x2105c5)[_0x051c('0x24')](function(_0x3ce30c){_0x222284[_0x051c('0x1d')]=_0x3ce30c;if(_0x2b9401[_0x051c('0x30')][_0x051c('0x3f')]){_0x4003d3[_0x051c('0x40')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x051c('0x41')](_0x4003d3);})[_0x051c('0x24')](function(_0x224796){_0x222284['rows']=_0x224796;return _0x222284;})[_0x051c('0x24')](respondWithFilteredResult(_0x5ba2fc,_0x4003d3))[_0x051c('0x42')](handleError(_0x5ba2fc,null));};exports['show']=function(_0x1d29d6,_0x34e4ef){var _0x1f6b88={'raw':!![],'where':{'id':_0x1d29d6[_0x051c('0x43')]['id']}},_0x42a1c0={};_0x42a1c0[_0x051c('0x2e')]=_[_0x051c('0x31')](db[_0x051c('0x3e')]['rawAttributes']);_0x42a1c0[_0x051c('0x30')]=_[_0x051c('0x31')](_0x1d29d6[_0x051c('0x30')]);_0x42a1c0[_0x051c('0x32')]=_[_0x051c('0x33')](_0x42a1c0[_0x051c('0x2e')],_0x42a1c0['query']);_0x1f6b88[_0x051c('0x34')]=_[_0x051c('0x33')](_0x42a1c0[_0x051c('0x2e')],qs['fields'](_0x1d29d6['query'][_0x051c('0x44')]));_0x1f6b88[_0x051c('0x34')]=_0x1f6b88[_0x051c('0x34')][_0x051c('0x35')]?_0x1f6b88[_0x051c('0x34')]:_0x42a1c0[_0x051c('0x2e')];if(_0x1d29d6[_0x051c('0x30')]['includeAll']){_0x1f6b88[_0x051c('0x40')]=[{'all':!![]}];}_0x1f6b88=_[_0x051c('0x3b')]({},_0x1f6b88,_0x1d29d6[_0x051c('0x45')]);return db[_0x051c('0x3e')][_0x051c('0x46')](_0x1f6b88)['then'](handleEntityNotFound(_0x34e4ef,null))[_0x051c('0x24')](respondWithResult(_0x34e4ef,null))['catch'](handleError(_0x34e4ef,null));};exports[_0x051c('0x47')]=function(_0x59c04b,_0x2c8b34){return db['SmsQueueReport'][_0x051c('0x47')](_0x59c04b['body'],{})[_0x051c('0x24')](respondWithResult(_0x2c8b34,0xc9))[_0x051c('0x42')](handleError(_0x2c8b34,null));};exports[_0x051c('0x23')]=function(_0x2e75bb,_0x298ffb){if(_0x2e75bb['body']['id']){delete _0x2e75bb[_0x051c('0x48')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x2e75bb['params']['id']}})[_0x051c('0x24')](handleEntityNotFound(_0x298ffb,null))[_0x051c('0x24')](saveUpdates(_0x2e75bb[_0x051c('0x48')],null))[_0x051c('0x24')](respondWithResult(_0x298ffb,null))['catch'](handleError(_0x298ffb,null));};exports[_0x051c('0x25')]=function(_0x3760c4,_0x15215f){return db[_0x051c('0x3e')]['find']({'where':{'id':_0x3760c4[_0x051c('0x43')]['id']}})['then'](handleEntityNotFound(_0x15215f,null))[_0x051c('0x24')](removeEntity(_0x15215f,null))['catch'](handleError(_0x15215f,null));};exports['describe']=function(_0x2be055,_0x20f45e){return db[_0x051c('0x3e')]['describe']()['then'](respondWithResult(_0x20f45e,null))[_0x051c('0x42')](handleError(_0x20f45e,null));}; \ No newline at end of file +var _0x2188=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','rows','params','include','find','catch','create','SmsQueueReport','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse'];(function(_0x5b64ff,_0x49dc70){var _0x3745f5=function(_0x55125a){while(--_0x55125a){_0x5b64ff['push'](_0x5b64ff['shift']());}};_0x3745f5(++_0x49dc70);}(_0x2188,0xce));var _0x8218=function(_0x30ea11,_0x4f679d){_0x30ea11=_0x30ea11-0x0;var _0x88f80f=_0x2188[_0x30ea11];return _0x88f80f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8218('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8218('0x1'));var rp=require('request-promise');var moment=require(_0x8218('0x2'));var BPromise=require(_0x8218('0x3'));var Mustache=require(_0x8218('0x4'));var util=require(_0x8218('0x5'));var path=require(_0x8218('0x6'));var sox=require('sox');var csv=require(_0x8218('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8218('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8218('0x9'));var jsforce=require(_0x8218('0xa'));var deskjs=require(_0x8218('0xb'));var toCsv=require(_0x8218('0x7'));var querystring=require('querystring');var Papa=require(_0x8218('0xc'));var Redis=require('ioredis');var authService=require(_0x8218('0xd'));var qs=require(_0x8218('0xe'));var as=require(_0x8218('0xf'));var hardwareService=require(_0x8218('0x10'));var logger=require(_0x8218('0x11'))(_0x8218('0x12'));var utils=require(_0x8218('0x13'));var config=require(_0x8218('0x14'));var licenseUtil=require(_0x8218('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cfbe6,_0x5748db){_0x5748db=_0x5748db||0xcc;return function(_0x4a6275){if(_0x4a6275){return _0x2cfbe6[_0x8218('0x16')](_0x5748db);}return _0x2cfbe6[_0x8218('0x17')](_0x5748db)[_0x8218('0x18')]();};}function respondWithResult(_0x5b8b86,_0xac83e3){_0xac83e3=_0xac83e3||0xc8;return function(_0x4a9841){if(_0x4a9841){return _0x5b8b86['status'](_0xac83e3)[_0x8218('0x19')](_0x4a9841);}};}function respondWithFilteredResult(_0x45bc82,_0x2492af){return function(_0x33cb02){if(_0x33cb02){var _0x4e1e17=typeof _0x2492af['offset']===_0x8218('0x1a')&&typeof _0x2492af[_0x8218('0x1b')]===_0x8218('0x1a');var _0x1f8c67=_0x33cb02[_0x8218('0x1c')];var _0xc564c0=_0x4e1e17?0x0:_0x2492af[_0x8218('0x1d')];var _0x125f2e=_0x4e1e17?_0x33cb02[_0x8218('0x1c')]:_0x2492af['offset']+_0x2492af[_0x8218('0x1b')];var _0x2b2755;if(_0x125f2e>=_0x1f8c67){_0x125f2e=_0x1f8c67;_0x2b2755=0xc8;}else{_0x2b2755=0xce;}_0x45bc82[_0x8218('0x17')](_0x2b2755);return _0x45bc82[_0x8218('0x1e')](_0x8218('0x1f'),_0xc564c0+'-'+_0x125f2e+'/'+_0x1f8c67)[_0x8218('0x19')](_0x33cb02);}return null;};}function patchUpdates(_0x2fcd85){return function(_0x59a409){try{jsonpatch[_0x8218('0x20')](_0x59a409,_0x2fcd85,!![]);}catch(_0x25bcab){return BPromise[_0x8218('0x21')](_0x25bcab);}return _0x59a409[_0x8218('0x22')]();};}function saveUpdates(_0xf1de83,_0x144809){return function(_0x2a101b){if(_0x2a101b){return _0x2a101b[_0x8218('0x23')](_0xf1de83)['then'](function(_0x24c3b5){return _0x24c3b5;});}return null;};}function removeEntity(_0x554416,_0x57e83b){return function(_0x2c3eea){if(_0x2c3eea){return _0x2c3eea[_0x8218('0x24')]()['then'](function(){_0x554416[_0x8218('0x17')](0xcc)[_0x8218('0x18')]();});}};}function handleEntityNotFound(_0x5de0a1,_0x56dbd8){return function(_0x54dce1){if(!_0x54dce1){_0x5de0a1[_0x8218('0x16')](0x194);}return _0x54dce1;};}function handleError(_0x4ac4cb,_0x4eecee){_0x4eecee=_0x4eecee||0x1f4;return function(_0x16cb81){logger[_0x8218('0x25')](_0x16cb81[_0x8218('0x26')]);if(_0x16cb81['name']){delete _0x16cb81['name'];}_0x4ac4cb[_0x8218('0x17')](_0x4eecee)[_0x8218('0x27')](_0x16cb81);};}exports[_0x8218('0x28')]=function(_0x55cc25,_0x547d46){var _0x383583={},_0x328cf5={},_0x3eee10={'count':0x0,'rows':[]};var _0x4c628d=_[_0x8218('0x29')](db['SmsQueueReport'][_0x8218('0x2a')],function(_0x23cdb2){return{'name':_0x23cdb2[_0x8218('0x2b')],'type':_0x23cdb2[_0x8218('0x2c')]['key']};});_0x328cf5[_0x8218('0x2d')]=_[_0x8218('0x29')](_0x4c628d,_0x8218('0x2e'));_0x328cf5[_0x8218('0x2f')]=_[_0x8218('0x30')](_0x55cc25[_0x8218('0x2f')]);_0x328cf5[_0x8218('0x31')]=_[_0x8218('0x32')](_0x328cf5[_0x8218('0x2d')],_0x328cf5[_0x8218('0x2f')]);_0x383583[_0x8218('0x33')]=_[_0x8218('0x32')](_0x328cf5[_0x8218('0x2d')],qs[_0x8218('0x34')](_0x55cc25[_0x8218('0x2f')][_0x8218('0x34')]));_0x383583[_0x8218('0x33')]=_0x383583[_0x8218('0x33')][_0x8218('0x35')]?_0x383583[_0x8218('0x33')]:_0x328cf5[_0x8218('0x2d')];if(!_0x55cc25['query']['hasOwnProperty'](_0x8218('0x36'))){_0x383583[_0x8218('0x1b')]=qs[_0x8218('0x1b')](_0x55cc25[_0x8218('0x2f')][_0x8218('0x1b')]);_0x383583['offset']=qs[_0x8218('0x1d')](_0x55cc25['query'][_0x8218('0x1d')]);}_0x383583[_0x8218('0x37')]=qs[_0x8218('0x38')](_0x55cc25[_0x8218('0x2f')][_0x8218('0x38')]);_0x383583[_0x8218('0x39')]=qs['filters'](_[_0x8218('0x3a')](_0x55cc25['query'],_0x328cf5[_0x8218('0x31')]),_0x4c628d);if(_0x55cc25[_0x8218('0x2f')]['filter']){_0x383583[_0x8218('0x39')]=_[_0x8218('0x3b')](_0x383583[_0x8218('0x39')],{'$or':_['map'](_0x4c628d,function(_0x725700){if(_0x725700[_0x8218('0x2c')]!==_0x8218('0x3c')){var _0x519ee5={};_0x519ee5[_0x725700[_0x8218('0x2e')]]={'$like':'%'+_0x55cc25[_0x8218('0x2f')][_0x8218('0x3d')]+'%'};return _0x519ee5;}})});}_0x383583=_['merge']({},_0x383583,_0x55cc25[_0x8218('0x3e')]);var _0x30869a={'where':_0x383583[_0x8218('0x39')]};return db['SmsQueueReport']['count'](_0x30869a)[_0x8218('0x3f')](function(_0x4a3d39){_0x3eee10[_0x8218('0x1c')]=_0x4a3d39;if(_0x55cc25[_0x8218('0x2f')]['includeAll']){_0x383583['include']=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x383583);})[_0x8218('0x3f')](function(_0x349a50){_0x3eee10[_0x8218('0x40')]=_0x349a50;return _0x3eee10;})[_0x8218('0x3f')](respondWithFilteredResult(_0x547d46,_0x383583))['catch'](handleError(_0x547d46,null));};exports['show']=function(_0x4d7067,_0x1416ca){var _0x5ec054={'raw':!![],'where':{'id':_0x4d7067[_0x8218('0x41')]['id']}},_0x3cdf16={};_0x3cdf16[_0x8218('0x2d')]=_['keys'](db['SmsQueueReport'][_0x8218('0x2a')]);_0x3cdf16['query']=_[_0x8218('0x30')](_0x4d7067[_0x8218('0x2f')]);_0x3cdf16['filters']=_[_0x8218('0x32')](_0x3cdf16[_0x8218('0x2d')],_0x3cdf16[_0x8218('0x2f')]);_0x5ec054['attributes']=_[_0x8218('0x32')](_0x3cdf16[_0x8218('0x2d')],qs[_0x8218('0x34')](_0x4d7067[_0x8218('0x2f')][_0x8218('0x34')]));_0x5ec054[_0x8218('0x33')]=_0x5ec054[_0x8218('0x33')][_0x8218('0x35')]?_0x5ec054['attributes']:_0x3cdf16[_0x8218('0x2d')];if(_0x4d7067[_0x8218('0x2f')]['includeAll']){_0x5ec054[_0x8218('0x42')]=[{'all':!![]}];}_0x5ec054=_[_0x8218('0x3b')]({},_0x5ec054,_0x4d7067['options']);return db['SmsQueueReport'][_0x8218('0x43')](_0x5ec054)['then'](handleEntityNotFound(_0x1416ca,null))['then'](respondWithResult(_0x1416ca,null))[_0x8218('0x44')](handleError(_0x1416ca,null));};exports[_0x8218('0x45')]=function(_0x2076e1,_0x16b5d1){return db[_0x8218('0x46')]['create'](_0x2076e1[_0x8218('0x47')],{})[_0x8218('0x3f')](respondWithResult(_0x16b5d1,0xc9))[_0x8218('0x44')](handleError(_0x16b5d1,null));};exports[_0x8218('0x23')]=function(_0x4ee830,_0x93df1a){if(_0x4ee830[_0x8218('0x47')]['id']){delete _0x4ee830[_0x8218('0x47')]['id'];}return db[_0x8218('0x46')][_0x8218('0x43')]({'where':{'id':_0x4ee830['params']['id']}})['then'](handleEntityNotFound(_0x93df1a,null))[_0x8218('0x3f')](saveUpdates(_0x4ee830[_0x8218('0x47')],null))[_0x8218('0x3f')](respondWithResult(_0x93df1a,null))[_0x8218('0x44')](handleError(_0x93df1a,null));};exports[_0x8218('0x24')]=function(_0x48ca94,_0xe00b1){return db[_0x8218('0x46')][_0x8218('0x43')]({'where':{'id':_0x48ca94[_0x8218('0x41')]['id']}})[_0x8218('0x3f')](handleEntityNotFound(_0xe00b1,null))['then'](removeEntity(_0xe00b1,null))[_0x8218('0x44')](handleError(_0xe00b1,null));};exports[_0x8218('0x48')]=function(_0x2c6ab9,_0x16ed04){return db[_0x8218('0x46')][_0x8218('0x48')]()[_0x8218('0x3f')](respondWithResult(_0x16ed04,null))['catch'](handleError(_0x16ed04,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 516593c..2d9f2dc 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 _0x9bc7=['api','moment','bluebird','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger'];(function(_0x3ad6bd,_0x4aef2c){var _0x27f188=function(_0x18a2fa){while(--_0x18a2fa){_0x3ad6bd['push'](_0x3ad6bd['shift']());}};_0x27f188(++_0x4aef2c);}(_0x9bc7,0x177));var _0x79bc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9bc7[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x79bc('0x0'));var logger=require(_0x79bc('0x1'))(_0x79bc('0x2'));var moment=require(_0x79bc('0x3'));var BPromise=require(_0x79bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x79bc('0x5'));var config=require(_0x79bc('0x6'));var attributes=require(_0x79bc('0x7'));module[_0x79bc('0x8')]=function(_0x57c80d,_0x101b5a){return _0x57c80d[_0x79bc('0x9')](_0x79bc('0xa'),attributes,{'tableName':_0x79bc('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x79bc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa403=['exports','define','report_sms_queue','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes'];(function(_0x3d1ed4,_0x2a10bf){var _0x4406f5=function(_0xa63253){while(--_0xa63253){_0x3d1ed4['push'](_0x3d1ed4['shift']());}};_0x4406f5(++_0x2a10bf);}(_0xa403,0x1f2));var _0x3a40=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xa403[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require(_0x3a40('0x0'));var logger=require(_0x3a40('0x1'))('api');var moment=require(_0x3a40('0x2'));var BPromise=require(_0x3a40('0x3'));var rp=require(_0x3a40('0x4'));var fs=require('fs');var path=require(_0x3a40('0x5'));var rimraf=require(_0x3a40('0x6'));var config=require(_0x3a40('0x7'));var attributes=require(_0x3a40('0x8'));module[_0x3a40('0x9')]=function(_0x21e880,_0x5880f9){return _0x21e880[_0x3a40('0xa')]('SmsQueueReport',attributes,{'tableName':_0x3a40('0xb'),'paranoid':![],'indexes':[{'name':_0x3a40('0xc'),'fields':[_0x3a40('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 885a343..4449d96 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 _0xd6ba=['error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then','stringify','UpdateSmsQueueReport','update','attributes','limit','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd6ba,0xf7));var _0xad6b=function(_0x82fcc8,_0x54ecc6){_0x82fcc8=_0x82fcc8-0x0;var _0x4b8a3c=_0xd6ba[_0x82fcc8];return _0x4b8a3c;};'use strict';var _=require(_0xad6b('0x0'));var util=require('util');var moment=require(_0xad6b('0x1'));var BPromise=require('bluebird');var rs=require(_0xad6b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad6b('0x3'))['db'];var utils=require(_0xad6b('0x4'));var logger=require(_0xad6b('0x5'))(_0xad6b('0x6'));var config=require(_0xad6b('0x7'));var jayson=require(_0xad6b('0x8'));var client=jayson[_0xad6b('0x9')][_0xad6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27bf93,_0x3bb39f,_0x6eaf3e){return new BPromise(function(_0x463678,_0x3eefc8){return client[_0xad6b('0xb')](_0x27bf93,_0x6eaf3e)['then'](function(_0x5c02c0){logger[_0xad6b('0xc')](_0xad6b('0xd'),_0x3bb39f,'request\x20sent');logger[_0xad6b('0xe')](_0xad6b('0xf'),_0x3bb39f,_0xad6b('0x10'),JSON['stringify'](_0x5c02c0));if(_0x5c02c0[_0xad6b('0x11')]){if(_0x5c02c0['error'][_0xad6b('0x12')]===0x1f4){logger[_0xad6b('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x3bb39f,_0x5c02c0['error']['message']);return _0x3eefc8(_0x5c02c0['error']['message']);}logger[_0xad6b('0x11')](_0xad6b('0xd'),_0x3bb39f,_0x5c02c0[_0xad6b('0x11')][_0xad6b('0x13')]);return _0x463678(_0x5c02c0[_0xad6b('0x11')][_0xad6b('0x13')]);}else{logger[_0xad6b('0xc')](_0xad6b('0xd'),_0x3bb39f,'request\x20sent');_0x463678(_0x5c02c0['result'][_0xad6b('0x13')]);}})[_0xad6b('0x14')](function(_0x3cb0f0){logger[_0xad6b('0x11')](_0xad6b('0xd'),_0x3bb39f,_0x3cb0f0);_0x3eefc8(_0x3cb0f0);});});}exports[_0xad6b('0x15')]=function(_0x409c00){var _0x4e7eeb=this;return new Promise(function(_0x1cff82,_0x2a5a99){return db[_0xad6b('0x16')][_0xad6b('0x17')](_0x409c00[_0xad6b('0x18')],{'raw':_0x409c00[_0xad6b('0x19')]?_0x409c00['options'][_0xad6b('0x1a')]===undefined?!![]:![]:!![]})[_0xad6b('0x1b')](function(_0x58f005){logger[_0xad6b('0xc')](_0xad6b('0x15'),_0x409c00);logger[_0xad6b('0xe')](_0xad6b('0x15'),_0x409c00,JSON[_0xad6b('0x1c')](_0x58f005));_0x1cff82(_0x58f005);})[_0xad6b('0x14')](function(_0x56d248){logger['error'](_0xad6b('0x15'),_0x56d248['message'],_0x409c00);_0x2a5a99(_0x4e7eeb[_0xad6b('0x11')](0x1f4,_0x56d248[_0xad6b('0x13')]));});});};exports[_0xad6b('0x1d')]=function(_0x59371e){var _0x5118a2=this;return new Promise(function(_0x486c99,_0x3b442e){return db[_0xad6b('0x16')][_0xad6b('0x1e')](_0x59371e[_0xad6b('0x18')],{'raw':_0x59371e[_0xad6b('0x19')]?_0x59371e['options'][_0xad6b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59371e['options']?_0x59371e['options']['where']||null:null,'attributes':_0x59371e[_0xad6b('0x19')]?_0x59371e['options'][_0xad6b('0x1f')]||null:null,'limit':_0x59371e['options']?_0x59371e[_0xad6b('0x19')][_0xad6b('0x20')]||null:null})['then'](function(_0x169662){logger[_0xad6b('0xc')](_0xad6b('0x1d'),_0x59371e);logger['debug'](_0xad6b('0x1d'),_0x59371e,JSON[_0xad6b('0x1c')](_0x169662));_0x486c99(_0x169662);})['catch'](function(_0x1d0d86){logger[_0xad6b('0x11')](_0xad6b('0x1d'),_0x1d0d86[_0xad6b('0x13')],_0x59371e);_0x3b442e(_0x5118a2[_0xad6b('0x11')](0x1f4,_0x1d0d86[_0xad6b('0x13')]));});});}; \ No newline at end of file +var _0xb24c=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','update','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x35126e,_0x51fd10){var _0x397a09=function(_0x2345a1){while(--_0x2345a1){_0x35126e['push'](_0x35126e['shift']());}};_0x397a09(++_0x51fd10);}(_0xb24c,0x133));var _0xcb24=function(_0x3c3842,_0x24d84d){_0x3c3842=_0x3c3842-0x0;var _0x1f5ddc=_0xb24c[_0x3c3842];return _0x1f5ddc;};'use strict';var _=require(_0xcb24('0x0'));var util=require(_0xcb24('0x1'));var moment=require(_0xcb24('0x2'));var BPromise=require(_0xcb24('0x3'));var rs=require(_0xcb24('0x4'));var fs=require('fs');var Redis=require(_0xcb24('0x5'));var db=require(_0xcb24('0x6'))['db'];var utils=require(_0xcb24('0x7'));var logger=require(_0xcb24('0x8'))(_0xcb24('0x9'));var config=require('../../config/environment');var jayson=require(_0xcb24('0xa'));var client=jayson[_0xcb24('0xb')][_0xcb24('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1acaa6,_0xc50eb7,_0x37479e){return new BPromise(function(_0x56cd17,_0x42f3a4){return client[_0xcb24('0xd')](_0x1acaa6,_0x37479e)[_0xcb24('0xe')](function(_0x442519){logger[_0xcb24('0xf')](_0xcb24('0x10'),_0xc50eb7,_0xcb24('0x11'));logger['debug'](_0xcb24('0x12'),_0xc50eb7,_0xcb24('0x11'),JSON[_0xcb24('0x13')](_0x442519));if(_0x442519['error']){if(_0x442519[_0xcb24('0x14')][_0xcb24('0x15')]===0x1f4){logger[_0xcb24('0x14')](_0xcb24('0x10'),_0xc50eb7,_0x442519['error']['message']);return _0x42f3a4(_0x442519[_0xcb24('0x14')][_0xcb24('0x16')]);}logger[_0xcb24('0x14')](_0xcb24('0x10'),_0xc50eb7,_0x442519[_0xcb24('0x14')][_0xcb24('0x16')]);return _0x56cd17(_0x442519[_0xcb24('0x14')][_0xcb24('0x16')]);}else{logger[_0xcb24('0xf')](_0xcb24('0x10'),_0xc50eb7,_0xcb24('0x11'));_0x56cd17(_0x442519[_0xcb24('0x17')][_0xcb24('0x16')]);}})[_0xcb24('0x18')](function(_0x5376f0){logger['error'](_0xcb24('0x10'),_0xc50eb7,_0x5376f0);_0x42f3a4(_0x5376f0);});});}exports[_0xcb24('0x19')]=function(_0x19d146){var _0x3aae84=this;return new Promise(function(_0xe81582,_0x2867a0){return db[_0xcb24('0x1a')][_0xcb24('0x1b')](_0x19d146['body'],{'raw':_0x19d146[_0xcb24('0x1c')]?_0x19d146['options'][_0xcb24('0x1d')]===undefined?!![]:![]:!![]})[_0xcb24('0xe')](function(_0x4522da){logger[_0xcb24('0xf')](_0xcb24('0x19'),_0x19d146);logger['debug'](_0xcb24('0x19'),_0x19d146,JSON['stringify'](_0x4522da));_0xe81582(_0x4522da);})[_0xcb24('0x18')](function(_0x53bcb4){logger[_0xcb24('0x14')]('CreateSmsQueueReport',_0x53bcb4['message'],_0x19d146);_0x2867a0(_0x3aae84['error'](0x1f4,_0x53bcb4[_0xcb24('0x16')]));});});};exports[_0xcb24('0x1e')]=function(_0xd5eb7f){var _0x3b2f71=this;return new Promise(function(_0x48556e,_0x1d629a){return db[_0xcb24('0x1a')][_0xcb24('0x1f')](_0xd5eb7f['body'],{'raw':_0xd5eb7f[_0xcb24('0x1c')]?_0xd5eb7f[_0xcb24('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd5eb7f[_0xcb24('0x1c')]?_0xd5eb7f[_0xcb24('0x1c')]['where']||null:null,'attributes':_0xd5eb7f[_0xcb24('0x1c')]?_0xd5eb7f[_0xcb24('0x1c')][_0xcb24('0x20')]||null:null,'limit':_0xd5eb7f['options']?_0xd5eb7f[_0xcb24('0x1c')][_0xcb24('0x21')]||null:null})[_0xcb24('0xe')](function(_0x1610b4){logger[_0xcb24('0xf')](_0xcb24('0x1e'),_0xd5eb7f);logger[_0xcb24('0x22')]('UpdateSmsQueueReport',_0xd5eb7f,JSON[_0xcb24('0x13')](_0x1610b4));_0x48556e(_0x1610b4);})[_0xcb24('0x18')](function(_0x4d355b){logger[_0xcb24('0x14')]('UpdateSmsQueueReport',_0x4d355b[_0xcb24('0x16')],_0xd5eb7f);_0x1d629a(_0x3b2f71[_0xcb24('0x14')](0x1f4,_0x4d355b[_0xcb24('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ebff55b..e1b30ba 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 _0x56ea=['/:id','show','post','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x28107d,_0x2ec8b3){var _0x2b1cbe=function(_0x5b06ad){while(--_0x5b06ad){_0x28107d['push'](_0x28107d['shift']());}};_0x2b1cbe(++_0x2ec8b3);}(_0x56ea,0xc4));var _0xa56e=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0x56ea[_0x142020];return _0x40da8f;};'use strict';var multer=require(_0xa56e('0x0'));var util=require(_0xa56e('0x1'));var path=require(_0xa56e('0x2'));var timeout=require(_0xa56e('0x3'));var express=require(_0xa56e('0x4'));var router=express[_0xa56e('0x5')]();var fs_extra=require(_0xa56e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa56e('0x7'));var config=require('../../config/environment');var controller=require(_0xa56e('0x8'));router[_0xa56e('0x9')]('/',auth[_0xa56e('0xa')](),controller['index']);router['get'](_0xa56e('0xb'),auth['isAuthenticated'](),controller[_0xa56e('0xc')]);router[_0xa56e('0x9')](_0xa56e('0xd'),auth[_0xa56e('0xa')](),controller[_0xa56e('0xe')]);router[_0xa56e('0xf')]('/',auth[_0xa56e('0xa')](),controller['create']);router[_0xa56e('0x10')]('/:id',auth[_0xa56e('0xa')](),controller['update']);router[_0xa56e('0x11')](_0xa56e('0xd'),auth[_0xa56e('0xa')](),controller[_0xa56e('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa5c4=['isAuthenticated','index','get','/describe','describe','show','create','/:id','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller'];(function(_0x12cff1,_0x23757b){var _0x151e8e=function(_0x702b11){while(--_0x702b11){_0x12cff1['push'](_0x12cff1['shift']());}};_0x151e8e(++_0x23757b);}(_0xa5c4,0x199));var _0x4a5c=function(_0x55cc58,_0x5ce0af){_0x55cc58=_0x55cc58-0x0;var _0x26062e=_0xa5c4[_0x55cc58];return _0x26062e;};'use strict';var multer=require(_0x4a5c('0x0'));var util=require(_0x4a5c('0x1'));var path=require(_0x4a5c('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a5c('0x3'));var router=express[_0x4a5c('0x4')]();var fs_extra=require(_0x4a5c('0x5'));var auth=require(_0x4a5c('0x6'));var interaction=require(_0x4a5c('0x7'));var config=require('../../config/environment');var controller=require(_0x4a5c('0x8'));router['get']('/',auth[_0x4a5c('0x9')](),controller[_0x4a5c('0xa')]);router[_0x4a5c('0xb')](_0x4a5c('0xc'),auth[_0x4a5c('0x9')](),controller[_0x4a5c('0xd')]);router[_0x4a5c('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x4a5c('0xe')]);router['post']('/',auth[_0x4a5c('0x9')](),controller[_0x4a5c('0xf')]);router['put'](_0x4a5c('0x10'),auth[_0x4a5c('0x9')](),controller[_0x4a5c('0x11')]);router['delete'](_0x4a5c('0x10'),auth[_0x4a5c('0x9')](),controller[_0x4a5c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 55b53c6..5a98612 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 _0x329b=['queue','exports','STRING','account','agent'];(function(_0x3471c7,_0x1c23fa){var _0x4d3108=function(_0x402d82){while(--_0x402d82){_0x3471c7['push'](_0x3471c7['shift']());}};_0x4d3108(++_0x1c23fa);}(_0x329b,0x1b4));var _0xb329=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0x329b[_0x144b30];return _0x1bb7bc;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xb329('0x0')]={'uniqueid':{'type':Sequelize[_0xb329('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb329('0x2'),_0xb329('0x3'),'queue'),'allowNull':![],'defaultValue':_0xb329('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x1331=['NOW','exports','STRING','agent','queue'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1331,0xd8));var _0x1133=function(_0x3aad52,_0x45d6c6){_0x3aad52=_0x3aad52-0x0;var _0x48bdf0=_0x1331[_0x3aad52];return _0x48bdf0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1133('0x0')]={'uniqueid':{'type':Sequelize[_0x1133('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x1133('0x2'),_0x1133('0x3')),'allowNull':![],'defaultValue':_0x1133('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1133('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 280a3ef..173d63f 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 _0xe29d=['index','map','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','merge','where','type','filter','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','name','send'];(function(_0xff5403,_0x2bd404){var _0x2185d2=function(_0xc8aa93){while(--_0xc8aa93){_0xff5403['push'](_0xff5403['shift']());}};_0x2185d2(++_0x2bd404);}(_0xe29d,0x1a7));var _0xde29=function(_0x2d0db1,_0x5d0e34){_0x2d0db1=_0x2d0db1-0x0;var _0x1356c6=_0xe29d[_0x2d0db1];return _0x1356c6;};'use strict';var emlformat=require(_0xde29('0x0'));var rimraf=require(_0xde29('0x1'));var zipdir=require(_0xde29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde29('0x3'));var moment=require('moment');var BPromise=require(_0xde29('0x4'));var Mustache=require(_0xde29('0x5'));var util=require(_0xde29('0x6'));var path=require('path');var sox=require(_0xde29('0x7'));var csv=require('to-csv');var ejs=require(_0xde29('0x8'));var fs=require('fs');var fs_extra=require(_0xde29('0x9'));var _=require(_0xde29('0xa'));var squel=require(_0xde29('0xb'));var crypto=require(_0xde29('0xc'));var jsforce=require(_0xde29('0xd'));var deskjs=require(_0xde29('0xe'));var toCsv=require(_0xde29('0xf'));var querystring=require(_0xde29('0x10'));var Papa=require(_0xde29('0x11'));var Redis=require(_0xde29('0x12'));var authService=require(_0xde29('0x13'));var qs=require(_0xde29('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde29('0x15'));var logger=require(_0xde29('0x16'))(_0xde29('0x17'));var utils=require(_0xde29('0x18'));var config=require(_0xde29('0x19'));var licenseUtil=require(_0xde29('0x1a'));var db=require(_0xde29('0x1b'))['db'];function respondWithStatusCode(_0x53c8dd,_0x4202b3){_0x4202b3=_0x4202b3||0xcc;return function(_0xfa1642){if(_0xfa1642){return _0x53c8dd[_0xde29('0x1c')](_0x4202b3);}return _0x53c8dd[_0xde29('0x1d')](_0x4202b3)['end']();};}function respondWithResult(_0x484a0b,_0xf1d587){_0xf1d587=_0xf1d587||0xc8;return function(_0x5f38e0){if(_0x5f38e0){return _0x484a0b[_0xde29('0x1d')](_0xf1d587)[_0xde29('0x1e')](_0x5f38e0);}};}function respondWithFilteredResult(_0x1bf145,_0x1451d4){return function(_0x37d997){if(_0x37d997){var _0x4f5db5=typeof _0x1451d4[_0xde29('0x1f')]===_0xde29('0x20')&&typeof _0x1451d4[_0xde29('0x21')]===_0xde29('0x20');var _0x26e1c0=_0x37d997[_0xde29('0x22')];var _0x41f259=_0x4f5db5?0x0:_0x1451d4[_0xde29('0x1f')];var _0x3f6a49=_0x4f5db5?_0x37d997[_0xde29('0x22')]:_0x1451d4[_0xde29('0x1f')]+_0x1451d4[_0xde29('0x21')];var _0x23a707;if(_0x3f6a49>=_0x26e1c0){_0x3f6a49=_0x26e1c0;_0x23a707=0xc8;}else{_0x23a707=0xce;}_0x1bf145[_0xde29('0x1d')](_0x23a707);return _0x1bf145[_0xde29('0x23')](_0xde29('0x24'),_0x41f259+'-'+_0x3f6a49+'/'+_0x26e1c0)['json'](_0x37d997);}return null;};}function patchUpdates(_0x4e45f0){return function(_0x45731a){try{jsonpatch[_0xde29('0x25')](_0x45731a,_0x4e45f0,!![]);}catch(_0x9fece2){return BPromise[_0xde29('0x26')](_0x9fece2);}return _0x45731a[_0xde29('0x27')]();};}function saveUpdates(_0x1e4e57,_0x481c9c){return function(_0x88f6dd){if(_0x88f6dd){return _0x88f6dd[_0xde29('0x28')](_0x1e4e57)[_0xde29('0x29')](function(_0x56bc3b){return _0x56bc3b;});}return null;};}function removeEntity(_0x2ffabb,_0x43bde9){return function(_0x4c6020){if(_0x4c6020){return _0x4c6020['destroy']()[_0xde29('0x29')](function(){_0x2ffabb['status'](0xcc)[_0xde29('0x2a')]();});}};}function handleEntityNotFound(_0x2b146f,_0x2b5e1e){return function(_0x52f118){if(!_0x52f118){_0x2b146f[_0xde29('0x1c')](0x194);}return _0x52f118;};}function handleError(_0x5f411f,_0x30d993){_0x30d993=_0x30d993||0x1f4;return function(_0x70c2b2){logger['error'](_0x70c2b2['stack']);if(_0x70c2b2[_0xde29('0x2b')]){delete _0x70c2b2[_0xde29('0x2b')];}_0x5f411f['status'](_0x30d993)[_0xde29('0x2c')](_0x70c2b2);};}exports[_0xde29('0x2d')]=function(_0xd1b4c8,_0x2a11ee){var _0x39a4ce={},_0x213ea5={},_0x1b0029={'count':0x0,'rows':[]};var _0x271594=_[_0xde29('0x2e')](db[_0xde29('0x2f')][_0xde29('0x30')],function(_0xd00e14){return{'name':_0xd00e14[_0xde29('0x31')],'type':_0xd00e14['type'][_0xde29('0x32')]};});_0x213ea5[_0xde29('0x33')]=_[_0xde29('0x2e')](_0x271594,'name');_0x213ea5[_0xde29('0x34')]=_[_0xde29('0x35')](_0xd1b4c8['query']);_0x213ea5[_0xde29('0x36')]=_[_0xde29('0x37')](_0x213ea5[_0xde29('0x33')],_0x213ea5['query']);_0x39a4ce[_0xde29('0x38')]=_[_0xde29('0x37')](_0x213ea5[_0xde29('0x33')],qs[_0xde29('0x39')](_0xd1b4c8['query'][_0xde29('0x39')]));_0x39a4ce['attributes']=_0x39a4ce[_0xde29('0x38')]['length']?_0x39a4ce[_0xde29('0x38')]:_0x213ea5[_0xde29('0x33')];if(!_0xd1b4c8[_0xde29('0x34')]['hasOwnProperty'](_0xde29('0x3a'))){_0x39a4ce['limit']=qs['limit'](_0xd1b4c8['query'][_0xde29('0x21')]);_0x39a4ce[_0xde29('0x1f')]=qs['offset'](_0xd1b4c8[_0xde29('0x34')][_0xde29('0x1f')]);}_0x39a4ce['order']=qs['sort'](_0xd1b4c8[_0xde29('0x34')][_0xde29('0x3b')]);_0x39a4ce['where']=qs['filters'](_[_0xde29('0x3c')](_0xd1b4c8[_0xde29('0x34')],_0x213ea5[_0xde29('0x36')]),_0x271594);if(_0xd1b4c8[_0xde29('0x34')]['filter']){_0x39a4ce['where']=_[_0xde29('0x3d')](_0x39a4ce[_0xde29('0x3e')],{'$or':_[_0xde29('0x2e')](_0x271594,function(_0x2a98ca){if(_0x2a98ca[_0xde29('0x3f')]!=='VIRTUAL'){var _0x2f3eb1={};_0x2f3eb1[_0x2a98ca[_0xde29('0x2b')]]={'$like':'%'+_0xd1b4c8[_0xde29('0x34')][_0xde29('0x40')]+'%'};return _0x2f3eb1;}})});}_0x39a4ce=_[_0xde29('0x3d')]({},_0x39a4ce,_0xd1b4c8['options']);var _0x1b036d={'where':_0x39a4ce[_0xde29('0x3e')]};return db[_0xde29('0x2f')][_0xde29('0x22')](_0x1b036d)['then'](function(_0x28c9c1){_0x1b0029[_0xde29('0x22')]=_0x28c9c1;if(_0xd1b4c8['query'][_0xde29('0x41')]){_0x39a4ce[_0xde29('0x42')]=[{'all':!![]}];}return db[_0xde29('0x2f')][_0xde29('0x43')](_0x39a4ce);})[_0xde29('0x29')](function(_0x5eb6a8){_0x1b0029[_0xde29('0x44')]=_0x5eb6a8;return _0x1b0029;})['then'](respondWithFilteredResult(_0x2a11ee,_0x39a4ce))[_0xde29('0x45')](handleError(_0x2a11ee,null));};exports[_0xde29('0x46')]=function(_0x20d567,_0x30a038){var _0x278fff={'raw':!![],'where':{'id':_0x20d567[_0xde29('0x47')]['id']}},_0x4eb9af={};_0x4eb9af['model']=_[_0xde29('0x35')](db[_0xde29('0x2f')][_0xde29('0x30')]);_0x4eb9af['query']=_[_0xde29('0x35')](_0x20d567['query']);_0x4eb9af['filters']=_[_0xde29('0x37')](_0x4eb9af[_0xde29('0x33')],_0x4eb9af['query']);_0x278fff[_0xde29('0x38')]=_[_0xde29('0x37')](_0x4eb9af[_0xde29('0x33')],qs[_0xde29('0x39')](_0x20d567['query'][_0xde29('0x39')]));_0x278fff[_0xde29('0x38')]=_0x278fff[_0xde29('0x38')][_0xde29('0x48')]?_0x278fff[_0xde29('0x38')]:_0x4eb9af[_0xde29('0x33')];if(_0x20d567['query']['includeAll']){_0x278fff[_0xde29('0x42')]=[{'all':!![]}];}_0x278fff=_[_0xde29('0x3d')]({},_0x278fff,_0x20d567[_0xde29('0x49')]);return db[_0xde29('0x2f')][_0xde29('0x4a')](_0x278fff)[_0xde29('0x29')](handleEntityNotFound(_0x30a038,null))[_0xde29('0x29')](respondWithResult(_0x30a038,null))[_0xde29('0x45')](handleError(_0x30a038,null));};exports[_0xde29('0x4b')]=function(_0x4c32dc,_0x1acc3b){return db['SmsTransferReport'][_0xde29('0x4b')](_0x4c32dc['body'],{})[_0xde29('0x29')](respondWithResult(_0x1acc3b,0xc9))['catch'](handleError(_0x1acc3b,null));};exports['update']=function(_0x27e4f0,_0x112a40){if(_0x27e4f0[_0xde29('0x4c')]['id']){delete _0x27e4f0[_0xde29('0x4c')]['id'];}return db[_0xde29('0x2f')][_0xde29('0x4a')]({'where':{'id':_0x27e4f0[_0xde29('0x47')]['id']}})[_0xde29('0x29')](handleEntityNotFound(_0x112a40,null))['then'](saveUpdates(_0x27e4f0['body'],null))[_0xde29('0x29')](respondWithResult(_0x112a40,null))[_0xde29('0x45')](handleError(_0x112a40,null));};exports['destroy']=function(_0x359a86,_0x146454){return db[_0xde29('0x2f')][_0xde29('0x4a')]({'where':{'id':_0x359a86[_0xde29('0x47')]['id']}})['then'](handleEntityNotFound(_0x146454,null))[_0xde29('0x29')](removeEntity(_0x146454,null))[_0xde29('0x45')](handleError(_0x146454,null));};exports[_0xde29('0x4d')]=function(_0x1eacec,_0x41d4cb){return db[_0xde29('0x2f')][_0xde29('0x4d')]()[_0xde29('0x29')](respondWithResult(_0x41d4cb,null))['catch'](handleError(_0x41d4cb,null));}; \ No newline at end of file +var _0x65ff=['undefined','limit','count','set','reject','save','update','then','end','error','stack','name','send','index','SmsTransferReport','type','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset'];(function(_0xee8670,_0x2c2cd8){var _0x54e3f2=function(_0x4f6ae3){while(--_0x4f6ae3){_0xee8670['push'](_0xee8670['shift']());}};_0x54e3f2(++_0x2c2cd8);}(_0x65ff,0x1dd));var _0xf65f=function(_0x4df671,_0x12b67f){_0x4df671=_0x4df671-0x0;var _0x3f9658=_0x65ff[_0x4df671];return _0x3f9658;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf65f('0x0'));var zipdir=require(_0xf65f('0x1'));var jsonpatch=require(_0xf65f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf65f('0x3'));var Mustache=require(_0xf65f('0x4'));var util=require(_0xf65f('0x5'));var path=require('path');var sox=require(_0xf65f('0x6'));var csv=require('to-csv');var ejs=require(_0xf65f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf65f('0x8'));var squel=require('squel');var crypto=require(_0xf65f('0x9'));var jsforce=require(_0xf65f('0xa'));var deskjs=require(_0xf65f('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf65f('0xc'));var Papa=require(_0xf65f('0xd'));var Redis=require(_0xf65f('0xe'));var authService=require(_0xf65f('0xf'));var qs=require(_0xf65f('0x10'));var as=require(_0xf65f('0x11'));var hardwareService=require(_0xf65f('0x12'));var logger=require(_0xf65f('0x13'))(_0xf65f('0x14'));var utils=require(_0xf65f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf65f('0x16'))['db'];function respondWithStatusCode(_0x9e13b7,_0x16406b){_0x16406b=_0x16406b||0xcc;return function(_0x532fcf){if(_0x532fcf){return _0x9e13b7[_0xf65f('0x17')](_0x16406b);}return _0x9e13b7[_0xf65f('0x18')](_0x16406b)['end']();};}function respondWithResult(_0xb775d6,_0x3e502a){_0x3e502a=_0x3e502a||0xc8;return function(_0x23967b){if(_0x23967b){return _0xb775d6[_0xf65f('0x18')](_0x3e502a)[_0xf65f('0x19')](_0x23967b);}};}function respondWithFilteredResult(_0x11f785,_0x193830){return function(_0x3c4b18){if(_0x3c4b18){var _0x3b0dfc=typeof _0x193830[_0xf65f('0x1a')]===_0xf65f('0x1b')&&typeof _0x193830[_0xf65f('0x1c')]===_0xf65f('0x1b');var _0x455d34=_0x3c4b18[_0xf65f('0x1d')];var _0x4be03c=_0x3b0dfc?0x0:_0x193830[_0xf65f('0x1a')];var _0x293a30=_0x3b0dfc?_0x3c4b18[_0xf65f('0x1d')]:_0x193830[_0xf65f('0x1a')]+_0x193830[_0xf65f('0x1c')];var _0x2f5bf5;if(_0x293a30>=_0x455d34){_0x293a30=_0x455d34;_0x2f5bf5=0xc8;}else{_0x2f5bf5=0xce;}_0x11f785[_0xf65f('0x18')](_0x2f5bf5);return _0x11f785[_0xf65f('0x1e')]('Content-Range',_0x4be03c+'-'+_0x293a30+'/'+_0x455d34)['json'](_0x3c4b18);}return null;};}function patchUpdates(_0x1881b6){return function(_0x3f8dd0){try{jsonpatch['apply'](_0x3f8dd0,_0x1881b6,!![]);}catch(_0x285251){return BPromise[_0xf65f('0x1f')](_0x285251);}return _0x3f8dd0[_0xf65f('0x20')]();};}function saveUpdates(_0x59d056,_0x3134ce){return function(_0x198f8a){if(_0x198f8a){return _0x198f8a[_0xf65f('0x21')](_0x59d056)[_0xf65f('0x22')](function(_0xf1e7de){return _0xf1e7de;});}return null;};}function removeEntity(_0x364c6f,_0x38098e){return function(_0x1584ba){if(_0x1584ba){return _0x1584ba['destroy']()[_0xf65f('0x22')](function(){_0x364c6f[_0xf65f('0x18')](0xcc)[_0xf65f('0x23')]();});}};}function handleEntityNotFound(_0x42bc73,_0xfb2389){return function(_0x6583){if(!_0x6583){_0x42bc73[_0xf65f('0x17')](0x194);}return _0x6583;};}function handleError(_0x5aafc,_0x48cd69){_0x48cd69=_0x48cd69||0x1f4;return function(_0x1a9053){logger[_0xf65f('0x24')](_0x1a9053[_0xf65f('0x25')]);if(_0x1a9053[_0xf65f('0x26')]){delete _0x1a9053[_0xf65f('0x26')];}_0x5aafc['status'](_0x48cd69)[_0xf65f('0x27')](_0x1a9053);};}exports[_0xf65f('0x28')]=function(_0x112d3e,_0x5073c6){var _0x2263f0={},_0x56340e={},_0x25f50e={'count':0x0,'rows':[]};var _0x59c15e=_['map'](db[_0xf65f('0x29')]['rawAttributes'],function(_0x241df4){return{'name':_0x241df4['fieldName'],'type':_0x241df4[_0xf65f('0x2a')]['key']};});_0x56340e[_0xf65f('0x2b')]=_[_0xf65f('0x2c')](_0x59c15e,_0xf65f('0x26'));_0x56340e[_0xf65f('0x2d')]=_[_0xf65f('0x2e')](_0x112d3e['query']);_0x56340e[_0xf65f('0x2f')]=_[_0xf65f('0x30')](_0x56340e[_0xf65f('0x2b')],_0x56340e[_0xf65f('0x2d')]);_0x2263f0[_0xf65f('0x31')]=_[_0xf65f('0x30')](_0x56340e[_0xf65f('0x2b')],qs['fields'](_0x112d3e[_0xf65f('0x2d')][_0xf65f('0x32')]));_0x2263f0['attributes']=_0x2263f0['attributes'][_0xf65f('0x33')]?_0x2263f0[_0xf65f('0x31')]:_0x56340e[_0xf65f('0x2b')];if(!_0x112d3e[_0xf65f('0x2d')]['hasOwnProperty']('nolimit')){_0x2263f0['limit']=qs[_0xf65f('0x1c')](_0x112d3e[_0xf65f('0x2d')][_0xf65f('0x1c')]);_0x2263f0[_0xf65f('0x1a')]=qs[_0xf65f('0x1a')](_0x112d3e[_0xf65f('0x2d')]['offset']);}_0x2263f0[_0xf65f('0x34')]=qs['sort'](_0x112d3e['query'][_0xf65f('0x35')]);_0x2263f0['where']=qs[_0xf65f('0x2f')](_[_0xf65f('0x36')](_0x112d3e[_0xf65f('0x2d')],_0x56340e[_0xf65f('0x2f')]),_0x59c15e);if(_0x112d3e[_0xf65f('0x2d')]['filter']){_0x2263f0[_0xf65f('0x37')]=_[_0xf65f('0x38')](_0x2263f0[_0xf65f('0x37')],{'$or':_[_0xf65f('0x2c')](_0x59c15e,function(_0x55486e){if(_0x55486e[_0xf65f('0x2a')]!==_0xf65f('0x39')){var _0x25d85e={};_0x25d85e[_0x55486e[_0xf65f('0x26')]]={'$like':'%'+_0x112d3e[_0xf65f('0x2d')][_0xf65f('0x3a')]+'%'};return _0x25d85e;}})});}_0x2263f0=_[_0xf65f('0x38')]({},_0x2263f0,_0x112d3e[_0xf65f('0x3b')]);var _0x3a22ee={'where':_0x2263f0[_0xf65f('0x37')]};return db[_0xf65f('0x29')][_0xf65f('0x1d')](_0x3a22ee)[_0xf65f('0x22')](function(_0x551844){_0x25f50e[_0xf65f('0x1d')]=_0x551844;if(_0x112d3e[_0xf65f('0x2d')]['includeAll']){_0x2263f0[_0xf65f('0x3c')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x2263f0);})[_0xf65f('0x22')](function(_0x4121ca){_0x25f50e[_0xf65f('0x3d')]=_0x4121ca;return _0x25f50e;})[_0xf65f('0x22')](respondWithFilteredResult(_0x5073c6,_0x2263f0))[_0xf65f('0x3e')](handleError(_0x5073c6,null));};exports[_0xf65f('0x3f')]=function(_0x4dfa70,_0xdb17e4){var _0x4b24f4={'raw':!![],'where':{'id':_0x4dfa70[_0xf65f('0x40')]['id']}},_0x1d8903={};_0x1d8903[_0xf65f('0x2b')]=_[_0xf65f('0x2e')](db[_0xf65f('0x29')][_0xf65f('0x41')]);_0x1d8903[_0xf65f('0x2d')]=_[_0xf65f('0x2e')](_0x4dfa70[_0xf65f('0x2d')]);_0x1d8903['filters']=_[_0xf65f('0x30')](_0x1d8903[_0xf65f('0x2b')],_0x1d8903[_0xf65f('0x2d')]);_0x4b24f4[_0xf65f('0x31')]=_['intersection'](_0x1d8903[_0xf65f('0x2b')],qs[_0xf65f('0x32')](_0x4dfa70['query']['fields']));_0x4b24f4[_0xf65f('0x31')]=_0x4b24f4[_0xf65f('0x31')][_0xf65f('0x33')]?_0x4b24f4['attributes']:_0x1d8903[_0xf65f('0x2b')];if(_0x4dfa70[_0xf65f('0x2d')][_0xf65f('0x42')]){_0x4b24f4['include']=[{'all':!![]}];}_0x4b24f4=_[_0xf65f('0x38')]({},_0x4b24f4,_0x4dfa70['options']);return db['SmsTransferReport'][_0xf65f('0x43')](_0x4b24f4)['then'](handleEntityNotFound(_0xdb17e4,null))[_0xf65f('0x22')](respondWithResult(_0xdb17e4,null))[_0xf65f('0x3e')](handleError(_0xdb17e4,null));};exports[_0xf65f('0x44')]=function(_0x185fa2,_0x93c2f1){return db[_0xf65f('0x29')]['create'](_0x185fa2[_0xf65f('0x45')],{})[_0xf65f('0x22')](respondWithResult(_0x93c2f1,0xc9))[_0xf65f('0x3e')](handleError(_0x93c2f1,null));};exports[_0xf65f('0x21')]=function(_0x389cb6,_0x574c0a){if(_0x389cb6[_0xf65f('0x45')]['id']){delete _0x389cb6[_0xf65f('0x45')]['id'];}return db[_0xf65f('0x29')]['find']({'where':{'id':_0x389cb6[_0xf65f('0x40')]['id']}})[_0xf65f('0x22')](handleEntityNotFound(_0x574c0a,null))[_0xf65f('0x22')](saveUpdates(_0x389cb6[_0xf65f('0x45')],null))[_0xf65f('0x22')](respondWithResult(_0x574c0a,null))[_0xf65f('0x3e')](handleError(_0x574c0a,null));};exports[_0xf65f('0x46')]=function(_0x406e84,_0x3d723d){return db[_0xf65f('0x29')][_0xf65f('0x43')]({'where':{'id':_0x406e84[_0xf65f('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d723d,null))[_0xf65f('0x22')](removeEntity(_0x3d723d,null))['catch'](handleError(_0x3d723d,null));};exports[_0xf65f('0x47')]=function(_0x3edcf0,_0x4a078d){return db[_0xf65f('0x29')]['describe']()[_0xf65f('0x22')](respondWithResult(_0x4a078d,null))['catch'](handleError(_0x4a078d,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index f5d3fe5..fe642ca 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 _0x8ace=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','lodash','util','../../config/logger','api'];(function(_0x11eec9,_0x23a664){var _0x5edaa2=function(_0x46d07c){while(--_0x46d07c){_0x11eec9['push'](_0x11eec9['shift']());}};_0x5edaa2(++_0x23a664);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x5a3c7b,_0x3fad44){_0x5a3c7b=_0x5a3c7b-0x0;var _0x5763f5=_0x8ace[_0x5a3c7b];return _0x5763f5;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var logger=require(_0xe8ac('0x2'))(_0xe8ac('0x3'));var moment=require(_0xe8ac('0x4'));var BPromise=require(_0xe8ac('0x5'));var rp=require(_0xe8ac('0x6'));var fs=require('fs');var path=require(_0xe8ac('0x7'));var rimraf=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var attributes=require(_0xe8ac('0xa'));module[_0xe8ac('0xb')]=function(_0x170e14,_0x2b48ec){return _0x170e14['define'](_0xe8ac('0xc'),attributes,{'tableName':_0xe8ac('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1db9=['api','moment','bluebird','path','rimraf','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0xc35695,_0x2c1a6c){var _0x21fb4f=function(_0x5b6d79){while(--_0x5b6d79){_0xc35695['push'](_0xc35695['shift']());}};_0x21fb4f(++_0x2c1a6c);}(_0x1db9,0x176));var _0x91db=function(_0x185590,_0x11a691){_0x185590=_0x185590-0x0;var _0x56f9ce=_0x1db9[_0x185590];return _0x56f9ce;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var logger=require(_0x91db('0x2'))(_0x91db('0x3'));var moment=require(_0x91db('0x4'));var BPromise=require(_0x91db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91db('0x6'));var rimraf=require(_0x91db('0x7'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0x91db('0x8')]=function(_0x4b3f5c,_0x5e69d9){return _0x4b3f5c[_0x91db('0x9')](_0x91db('0xa'),attributes,{'tableName':_0x91db('0xb'),'paranoid':![],'indexes':[{'name':_0x91db('0xc'),'fields':[_0x91db('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 4aba6b7..9f9c33c 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 _0xf79e=['bluebird','../../config/logger','rpc','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x51a164,_0x1e9155){var _0x5f53de=function(_0x2037d4){while(--_0x2037d4){_0x51a164['push'](_0x51a164['shift']());}};_0x5f53de(++_0x1e9155);}(_0xf79e,0x165));var _0xef79=function(_0x6fc282,_0xed83a0){_0x6fc282=_0x6fc282-0x0;var _0x11d36e=_0xf79e[_0x6fc282];return _0x11d36e;};'use strict';var _=require(_0xef79('0x0'));var util=require(_0xef79('0x1'));var moment=require(_0xef79('0x2'));var BPromise=require(_0xef79('0x3'));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(_0xef79('0x4'))(_0xef79('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xef79('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54a9e9,_0x46c175,_0x3722de){return new BPromise(function(_0x43fb3b,_0xef653e){return client[_0xef79('0x7')](_0x54a9e9,_0x3722de)[_0xef79('0x8')](function(_0x164b20){logger[_0xef79('0x9')](_0xef79('0xa'),_0x46c175,_0xef79('0xb'));logger['debug'](_0xef79('0xc'),_0x46c175,_0xef79('0xb'),JSON[_0xef79('0xd')](_0x164b20));if(_0x164b20[_0xef79('0xe')]){if(_0x164b20[_0xef79('0xe')][_0xef79('0xf')]===0x1f4){logger[_0xef79('0xe')](_0xef79('0xa'),_0x46c175,_0x164b20[_0xef79('0xe')]['message']);return _0xef653e(_0x164b20['error']['message']);}logger[_0xef79('0xe')](_0xef79('0xa'),_0x46c175,_0x164b20['error'][_0xef79('0x10')]);return _0x43fb3b(_0x164b20['error'][_0xef79('0x10')]);}else{logger['info'](_0xef79('0xa'),_0x46c175,_0xef79('0xb'));_0x43fb3b(_0x164b20['result']['message']);}})[_0xef79('0x11')](function(_0x383a67){logger[_0xef79('0xe')](_0xef79('0xa'),_0x46c175,_0x383a67);_0xef653e(_0x383a67);});});} \ No newline at end of file +var _0x723a=['request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x81b612,_0x42f042){var _0x476ed5=function(_0x12721a){while(--_0x12721a){_0x81b612['push'](_0x81b612['shift']());}};_0x476ed5(++_0x42f042);}(_0x723a,0xbf));var _0xa723=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x723a[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0xa723('0x0'));var util=require('util');var moment=require(_0xa723('0x1'));var BPromise=require(_0xa723('0x2'));var rs=require(_0xa723('0x3'));var fs=require('fs');var Redis=require(_0xa723('0x4'));var db=require(_0xa723('0x5'))['db'];var utils=require(_0xa723('0x6'));var logger=require('../../config/logger')(_0xa723('0x7'));var config=require(_0xa723('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa723('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9afb,_0x215d45,_0x10ba53){return new BPromise(function(_0x121a55,_0x20d6c5){return client[_0xa723('0xa')](_0x2c9afb,_0x10ba53)[_0xa723('0xb')](function(_0x408036){logger[_0xa723('0xc')](_0xa723('0xd'),_0x215d45,'request\x20sent');logger[_0xa723('0xe')](_0xa723('0xf'),_0x215d45,_0xa723('0x10'),JSON[_0xa723('0x11')](_0x408036));if(_0x408036['error']){if(_0x408036[_0xa723('0x12')][_0xa723('0x13')]===0x1f4){logger[_0xa723('0x12')](_0xa723('0xd'),_0x215d45,_0x408036['error'][_0xa723('0x14')]);return _0x20d6c5(_0x408036[_0xa723('0x12')]['message']);}logger[_0xa723('0x12')](_0xa723('0xd'),_0x215d45,_0x408036[_0xa723('0x12')][_0xa723('0x14')]);return _0x121a55(_0x408036[_0xa723('0x12')]['message']);}else{logger[_0xa723('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x215d45,'request\x20sent');_0x121a55(_0x408036[_0xa723('0x15')][_0xa723('0x14')]);}})[_0xa723('0x16')](function(_0x17e0f6){logger[_0xa723('0x12')](_0xa723('0xd'),_0x215d45,_0x17e0f6);_0x20d6c5(_0x17e0f6);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 2874c07..31b3470 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 _0x0492=['format','%s-%s%s','basename','extname','single','create','put','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace'];(function(_0xd9f52,_0x4e7441){var _0x3d67a9=function(_0x30376f){while(--_0x30376f){_0xd9f52['push'](_0xd9f52['shift']());}};_0x3d67a9(++_0x4e7441);}(_0x0492,0x1bb));var _0x2049=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x0492[_0x11c573];return _0x6b72de;};'use strict';var multer=require(_0x2049('0x0'));var util=require(_0x2049('0x1'));var path=require('path');var timeout=require(_0x2049('0x2'));var express=require(_0x2049('0x3'));var router=express[_0x2049('0x4')]();var fs_extra=require(_0x2049('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2049('0x6'));var config=require(_0x2049('0x7'));var controller=require(_0x2049('0x8'));router[_0x2049('0x9')]('/',auth['isAuthenticated'](),controller[_0x2049('0xa')]);router[_0x2049('0x9')](_0x2049('0xb'),auth[_0x2049('0xc')](),controller[_0x2049('0xd')]);router[_0x2049('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x2049('0xe')]);var upload=multer({'storage':multer[_0x2049('0xf')]({'destination':function(_0x2d205e,_0xf69001,_0x15f8c9){_0x15f8c9(null,path[_0x2049('0x10')](config[_0x2049('0x11')],_0x2049('0x12')));},'filename':function(_0x33e47d,_0x2e5f71,_0xd135a4){_0x2e5f71[_0x2049('0x13')]=_0x2e5f71['originalname'][_0x2049('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xd135a4(null,util[_0x2049('0x15')](_0x2049('0x16'),path[_0x2049('0x17')](_0x2e5f71[_0x2049('0x13')],path[_0x2049('0x18')](_0x2e5f71[_0x2049('0x13')])),Date['now'](),path['extname'](_0x2e5f71[_0x2049('0x13')])));}})});router['post']('/',upload[_0x2049('0x19')]('file'),controller[_0x2049('0x1a')]);router[_0x2049('0x1b')](_0x2049('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2049('0x1c')](_0x2049('0xb'),auth[_0x2049('0xc')](),controller[_0x2049('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x130f=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','single','file','put','update','delete','exports'];(function(_0x27220f,_0x244c67){var _0x5a6a5c=function(_0x1efb52){while(--_0x1efb52){_0x27220f['push'](_0x27220f['shift']());}};_0x5a6a5c(++_0x244c67);}(_0x130f,0x96));var _0xf130=function(_0x4d10db,_0x97fe34){_0x4d10db=_0x4d10db-0x0;var _0x672342=_0x130f[_0x4d10db];return _0x672342;};'use strict';var multer=require(_0xf130('0x0'));var util=require(_0xf130('0x1'));var path=require(_0xf130('0x2'));var timeout=require(_0xf130('0x3'));var express=require('express');var router=express[_0xf130('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf130('0x5'));var interaction=require(_0xf130('0x6'));var config=require(_0xf130('0x7'));var controller=require(_0xf130('0x8'));router[_0xf130('0x9')]('/',auth[_0xf130('0xa')](),controller['index']);router[_0xf130('0x9')](_0xf130('0xb'),auth['isAuthenticated'](),controller[_0xf130('0xc')]);router[_0xf130('0x9')](_0xf130('0xd'),auth[_0xf130('0xa')](),controller[_0xf130('0xe')]);var upload=multer({'storage':multer[_0xf130('0xf')]({'destination':function(_0x18f2b4,_0x429212,_0x599b75){_0x599b75(null,path[_0xf130('0x10')](config['root'],_0xf130('0x11')));},'filename':function(_0x163fe2,_0x3f1f72,_0x57a83b){_0x3f1f72[_0xf130('0x12')]=_0x3f1f72[_0xf130('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57a83b(null,util[_0xf130('0x13')](_0xf130('0x14'),path[_0xf130('0x15')](_0x3f1f72[_0xf130('0x12')],path[_0xf130('0x16')](_0x3f1f72[_0xf130('0x12')])),Date[_0xf130('0x17')](),path[_0xf130('0x16')](_0x3f1f72['originalname'])));}})});router['post']('/',upload[_0xf130('0x18')](_0xf130('0x19')),controller['create']);router[_0xf130('0x1a')](_0xf130('0xb'),auth['isAuthenticated'](),controller[_0xf130('0x1b')]);router[_0xf130('0x1c')](_0xf130('0xb'),auth[_0xf130('0xa')](),controller[_0xf130('0x1c')]);module[_0xf130('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index cefbc14..8720894 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 _0x0ec4=['INTEGER','sequelize','STRING','name','FLOAT','BIGINT'];(function(_0x229281,_0x3bf91b){var _0x15bc0a=function(_0x2a0890){while(--_0x2a0890){_0x229281['push'](_0x229281['shift']());}};_0x15bc0a(++_0x3bf91b);}(_0x0ec4,0x73));var _0x40ec=function(_0x1b62e1,_0x2e9a5b){_0x1b62e1=_0x1b62e1-0x0;var _0x2da6ba=_0x0ec4[_0x1b62e1];return _0x2da6ba;};'use strict';var Sequelize=require(_0x40ec('0x0'));module['exports']={'name':{'type':Sequelize[_0x40ec('0x1')],'unique':_0x40ec('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x40ec('0x1')]},'display_name':{'type':Sequelize[_0x40ec('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x40ec('0x1')]},'original_format':{'type':Sequelize[_0x40ec('0x1')]},'original_duration':{'type':Sequelize[_0x40ec('0x3')]},'original_sampleCount':{'type':Sequelize[_0x40ec('0x4')]},'original_channelCount':{'type':Sequelize[_0x40ec('0x5')]},'original_bitRate':{'type':Sequelize[_0x40ec('0x4')]},'original_sampleRate':{'type':Sequelize[_0x40ec('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x40ec('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x40ec('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x40ec('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x40ec('0x5')]}}; \ No newline at end of file +var _0x463a=['name','STRING','FLOAT','INTEGER','BIGINT','sequelize','exports'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0x463a,0x155));var _0xa463=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x463a[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0xa463('0x0'));module[_0xa463('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa463('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa463('0x3')]},'display_name':{'type':Sequelize[_0xa463('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0xa463('0x3')]},'original_format':{'type':Sequelize[_0xa463('0x3')]},'original_duration':{'type':Sequelize[_0xa463('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xa463('0x5')]},'original_bitRate':{'type':Sequelize[_0xa463('0x6')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xa463('0x3')]},'converted_duration':{'type':Sequelize[_0xa463('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xa463('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xa463('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 4eb7e85..4fb79f6 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 _0x6aeb=['where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','download','find','params','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','format','%s.%s','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','0777','role','body','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','delete','unlinkSync','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','map','Sound','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5f0669,_0x1e35d7){var _0x50aa83=function(_0x269453){while(--_0x269453){_0x5f0669['push'](_0x5f0669['shift']());}};_0x50aa83(++_0x1e35d7);}(_0x6aeb,0x1ac));var _0xb6ae=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0x6aeb[_0x199c03];return _0x11a7d4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb6ae('0x0'));var rp=require('request-promise');var moment=require(_0xb6ae('0x1'));var BPromise=require(_0xb6ae('0x2'));var Mustache=require('mustache');var util=require(_0xb6ae('0x3'));var path=require(_0xb6ae('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb6ae('0x5'));var fs=require('fs');var fs_extra=require(_0xb6ae('0x6'));var _=require(_0xb6ae('0x7'));var squel=require(_0xb6ae('0x8'));var crypto=require('crypto');var jsforce=require(_0xb6ae('0x9'));var deskjs=require(_0xb6ae('0xa'));var toCsv=require('to-csv');var querystring=require(_0xb6ae('0xb'));var Papa=require(_0xb6ae('0xc'));var Redis=require(_0xb6ae('0xd'));var authService=require(_0xb6ae('0xe'));var qs=require(_0xb6ae('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6ae('0x10'));var logger=require(_0xb6ae('0x11'))(_0xb6ae('0x12'));var utils=require(_0xb6ae('0x13'));var config=require(_0xb6ae('0x14'));var licenseUtil=require(_0xb6ae('0x15'));var db=require(_0xb6ae('0x16'))['db'];function respondWithStatusCode(_0x4e02b8,_0x5ef064){_0x5ef064=_0x5ef064||0xcc;return function(_0x427173){if(_0x427173){return _0x4e02b8[_0xb6ae('0x17')](_0x5ef064);}return _0x4e02b8[_0xb6ae('0x18')](_0x5ef064)[_0xb6ae('0x19')]();};}function respondWithResult(_0x596d8a,_0x18f1b5){_0x18f1b5=_0x18f1b5||0xc8;return function(_0x960025){if(_0x960025){return _0x596d8a[_0xb6ae('0x18')](_0x18f1b5)['json'](_0x960025);}};}function respondWithFilteredResult(_0x234fb2,_0x555a7c){return function(_0x5d3447){if(_0x5d3447){var _0x3f0b00=typeof _0x555a7c[_0xb6ae('0x1a')]===_0xb6ae('0x1b')&&typeof _0x555a7c[_0xb6ae('0x1c')]===_0xb6ae('0x1b');var _0x428d5b=_0x5d3447[_0xb6ae('0x1d')];var _0x436a0a=_0x3f0b00?0x0:_0x555a7c[_0xb6ae('0x1a')];var _0x5eea73=_0x3f0b00?_0x5d3447[_0xb6ae('0x1d')]:_0x555a7c[_0xb6ae('0x1a')]+_0x555a7c[_0xb6ae('0x1c')];var _0x152cc1;if(_0x5eea73>=_0x428d5b){_0x5eea73=_0x428d5b;_0x152cc1=0xc8;}else{_0x152cc1=0xce;}_0x234fb2['status'](_0x152cc1);return _0x234fb2[_0xb6ae('0x1e')]('Content-Range',_0x436a0a+'-'+_0x5eea73+'/'+_0x428d5b)[_0xb6ae('0x1f')](_0x5d3447);}return null;};}function patchUpdates(_0x517f0b){return function(_0x1edcd6){try{jsonpatch[_0xb6ae('0x20')](_0x1edcd6,_0x517f0b,!![]);}catch(_0x3bfa41){return BPromise[_0xb6ae('0x21')](_0x3bfa41);}return _0x1edcd6[_0xb6ae('0x22')]();};}function saveUpdates(_0x376a93,_0x1faf8f){return function(_0x4008f6){if(_0x4008f6){return _0x4008f6['update'](_0x376a93)[_0xb6ae('0x23')](function(_0x52c7e4){return _0x52c7e4;});}return null;};}function removeEntity(_0x52e89e,_0x4c1ad7){return function(_0x2c90f8){if(_0x2c90f8){return _0x2c90f8[_0xb6ae('0x24')]()['then'](function(){var _0x35d0ee=_0x2c90f8[_0xb6ae('0x25')]({'plain':!![]});var _0x1ece10=_0xb6ae('0x26');return db[_0xb6ae('0x27')][_0xb6ae('0x24')]({'where':{'type':_0x1ece10,'resourceId':_0x35d0ee['id']}})[_0xb6ae('0x23')](function(){return _0x2c90f8;});})[_0xb6ae('0x23')](function(){_0x52e89e[_0xb6ae('0x18')](0xcc)[_0xb6ae('0x19')]();});}};}function handleEntityNotFound(_0x30be5d,_0x5ed50e){return function(_0x265164){if(!_0x265164){_0x30be5d[_0xb6ae('0x17')](0x194);}return _0x265164;};}function handleError(_0x437a5e,_0xa052bf){_0xa052bf=_0xa052bf||0x1f4;return function(_0x1f967a){logger[_0xb6ae('0x28')](_0x1f967a[_0xb6ae('0x29')]);if(_0x1f967a[_0xb6ae('0x2a')]){delete _0x1f967a[_0xb6ae('0x2a')];}_0x437a5e[_0xb6ae('0x18')](_0xa052bf)[_0xb6ae('0x2b')](_0x1f967a);};}exports['index']=function(_0x1d574b,_0x4d216a){var _0x4b0041={},_0x46bc58={},_0x550734={'count':0x0,'rows':[]};var _0x164cd0=_[_0xb6ae('0x2c')](db[_0xb6ae('0x2d')][_0xb6ae('0x2e')],function(_0x58a4bd){return{'name':_0x58a4bd['fieldName'],'type':_0x58a4bd[_0xb6ae('0x2f')]['key']};});_0x46bc58[_0xb6ae('0x30')]=_[_0xb6ae('0x2c')](_0x164cd0,'name');_0x46bc58[_0xb6ae('0x31')]=_[_0xb6ae('0x32')](_0x1d574b[_0xb6ae('0x31')]);_0x46bc58[_0xb6ae('0x33')]=_[_0xb6ae('0x34')](_0x46bc58['model'],_0x46bc58[_0xb6ae('0x31')]);_0x4b0041['attributes']=_[_0xb6ae('0x34')](_0x46bc58['model'],qs[_0xb6ae('0x35')](_0x1d574b['query'][_0xb6ae('0x35')]));_0x4b0041[_0xb6ae('0x36')]=_0x4b0041[_0xb6ae('0x36')][_0xb6ae('0x37')]?_0x4b0041[_0xb6ae('0x36')]:_0x46bc58[_0xb6ae('0x30')];if(!_0x1d574b[_0xb6ae('0x31')][_0xb6ae('0x38')](_0xb6ae('0x39'))){_0x4b0041[_0xb6ae('0x1c')]=qs[_0xb6ae('0x1c')](_0x1d574b[_0xb6ae('0x31')]['limit']);_0x4b0041[_0xb6ae('0x1a')]=qs['offset'](_0x1d574b[_0xb6ae('0x31')][_0xb6ae('0x1a')]);}_0x4b0041[_0xb6ae('0x3a')]=qs['sort'](_0x1d574b[_0xb6ae('0x31')][_0xb6ae('0x3b')]);_0x4b0041[_0xb6ae('0x3c')]=qs[_0xb6ae('0x33')](_[_0xb6ae('0x3d')](_0x1d574b[_0xb6ae('0x31')],_0x46bc58[_0xb6ae('0x33')]),_0x164cd0);if(_0x1d574b[_0xb6ae('0x31')][_0xb6ae('0x3e')]){_0x4b0041[_0xb6ae('0x3c')]=_[_0xb6ae('0x3f')](_0x4b0041[_0xb6ae('0x3c')],{'$or':_['map'](_0x164cd0,function(_0x3eb3c0){if(_0x3eb3c0[_0xb6ae('0x2f')]!==_0xb6ae('0x40')){var _0x209f98={};_0x209f98[_0x3eb3c0[_0xb6ae('0x2a')]]={'$like':'%'+_0x1d574b[_0xb6ae('0x31')]['filter']+'%'};return _0x209f98;}})});}_0x4b0041=_[_0xb6ae('0x3f')]({},_0x4b0041,_0x1d574b['options']);var _0x30cdb6={'where':_0x4b0041[_0xb6ae('0x3c')]};return db[_0xb6ae('0x2d')]['count'](_0x30cdb6)[_0xb6ae('0x23')](function(_0x307399){_0x550734[_0xb6ae('0x1d')]=_0x307399;if(_0x1d574b[_0xb6ae('0x31')][_0xb6ae('0x41')]){_0x4b0041[_0xb6ae('0x42')]=[{'all':!![]}];}return db['Sound'][_0xb6ae('0x43')](_0x4b0041);})['then'](function(_0x59d943){_0x550734[_0xb6ae('0x44')]=_0x59d943;return _0x550734;})[_0xb6ae('0x23')](respondWithFilteredResult(_0x4d216a,_0x4b0041))[_0xb6ae('0x45')](handleError(_0x4d216a,null));};exports[_0xb6ae('0x46')]=function(_0x5b32a3,_0x4ff647){var _0x27bceb={'raw':!![],'where':{'id':_0x5b32a3['params']['id']}},_0x399ba4={};_0x399ba4[_0xb6ae('0x30')]=_[_0xb6ae('0x32')](db['Sound'][_0xb6ae('0x2e')]);_0x399ba4[_0xb6ae('0x31')]=_[_0xb6ae('0x32')](_0x5b32a3[_0xb6ae('0x31')]);_0x399ba4[_0xb6ae('0x33')]=_[_0xb6ae('0x34')](_0x399ba4[_0xb6ae('0x30')],_0x399ba4[_0xb6ae('0x31')]);_0x27bceb['attributes']=_['intersection'](_0x399ba4['model'],qs[_0xb6ae('0x35')](_0x5b32a3[_0xb6ae('0x31')][_0xb6ae('0x35')]));_0x27bceb['attributes']=_0x27bceb[_0xb6ae('0x36')][_0xb6ae('0x37')]?_0x27bceb[_0xb6ae('0x36')]:_0x399ba4[_0xb6ae('0x30')];if(_0x5b32a3[_0xb6ae('0x31')][_0xb6ae('0x41')]){_0x27bceb['include']=[{'all':!![]}];}_0x27bceb=_[_0xb6ae('0x3f')]({},_0x27bceb,_0x5b32a3[_0xb6ae('0x47')]);return db[_0xb6ae('0x2d')]['find'](_0x27bceb)[_0xb6ae('0x23')](handleEntityNotFound(_0x4ff647,null))[_0xb6ae('0x23')](respondWithResult(_0x4ff647,null))[_0xb6ae('0x45')](handleError(_0x4ff647,null));};exports[_0xb6ae('0x48')]=function(_0x2f8bae,_0x345f55,_0x1ca52e){return db['Sound'][_0xb6ae('0x49')]({'where':{'id':_0x2f8bae[_0xb6ae('0x4a')]['id']},'attributes':[_0xb6ae('0x2a'),'save_name',_0xb6ae('0x4b')],'raw':!![]})[_0xb6ae('0x23')](handleEntityNotFound(_0x345f55,null))['then'](function(_0x1ca903){if(_0x1ca903){if(!fs[_0xb6ae('0x4c')](path[_0xb6ae('0x4d')](config[_0xb6ae('0x4e')],_0xb6ae('0x4f'),_0x1ca903[_0xb6ae('0x50')]+'.'+_0x1ca903[_0xb6ae('0x4b')]))){throw new db[(_0xb6ae('0x51'))][(_0xb6ae('0x52'))]('Sound\x20not\x20found');}return _0x345f55['download'](path[_0xb6ae('0x4d')](config[_0xb6ae('0x4e')],_0xb6ae('0x4f'),util[_0xb6ae('0x53')](_0xb6ae('0x54'),_0x1ca903[_0xb6ae('0x50')],_0x1ca903['converted_format'])),util['format'](_0xb6ae('0x54'),_0x1ca903[_0xb6ae('0x2a')],_0x1ca903[_0xb6ae('0x4b')]));}return null;})[_0xb6ae('0x45')](handleError(_0x345f55,null));};exports[_0xb6ae('0x55')]=function(_0x2a804a,_0xab6547,_0x4c8a94){var _0x574317={'name':path[_0xb6ae('0x56')](_0x2a804a[_0xb6ae('0x57')][_0xb6ae('0x58')],path[_0xb6ae('0x59')](_0x2a804a['file'][_0xb6ae('0x58')])),'save_name':path[_0xb6ae('0x56')](_0x2a804a[_0xb6ae('0x57')]['filename'],path[_0xb6ae('0x59')](_0x2a804a[_0xb6ae('0x57')][_0xb6ae('0x5a')])),'original_format':path['extname'](_0x2a804a['file'][_0xb6ae('0x58')])['substring'](0x1),'converted_format':_0xb6ae('0x5b')};var _0x20aae6=path[_0xb6ae('0x4d')](config['root'],_0xb6ae('0x5c'),_0x2a804a['file'][_0xb6ae('0x5a')]);var _0x4306f0=path[_0xb6ae('0x4d')](config[_0xb6ae('0x4e')],'server/files/sounds/converted',util['format'](_0xb6ae('0x54'),path['basename'](_0x2a804a[_0xb6ae('0x57')]['filename'],path['extname'](_0x2a804a[_0xb6ae('0x57')][_0xb6ae('0x5a')])),_0x574317[_0xb6ae('0x4b')]));logger[_0xb6ae('0x5d')](_0xb6ae('0x5e'),_0x20aae6);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x4306f0);try{fs[_0xb6ae('0x5f')](_0x20aae6,parseInt('0777',0x8));var _0x2502f8=sox[_0xb6ae('0x60')](_0x20aae6,_0x4306f0,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2502f8['on'](_0xb6ae('0x28'),function(_0x2c583a){fs['unlinkSync'](_0x20aae6);_0xab6547['status'](0x1f4)['send'](_0x2c583a);});_0x2502f8['on'](_0xb6ae('0x61'),function(_0x431fc6){_0x574317[_0xb6ae('0x62')]=isNaN(_0x431fc6[_0xb6ae('0x63')])?null:_0x431fc6[_0xb6ae('0x63')]*0x3e8;_0x574317['original_sampleCount']=isNaN(_0x431fc6['sampleCount'])?null:_0x431fc6[_0xb6ae('0x64')];_0x574317[_0xb6ae('0x65')]=isNaN(_0x431fc6['channelCount'])?null:_0x431fc6[_0xb6ae('0x66')];_0x574317[_0xb6ae('0x67')]=isNaN(_0x431fc6['bitRate'])?null:_0x431fc6['bitRate'];_0x574317[_0xb6ae('0x68')]=isNaN(_0x431fc6[_0xb6ae('0x69')])?null:_0x431fc6['sampleRate'];});_0x2502f8['on'](_0xb6ae('0x6a'),function(_0x337a88){_0x574317['converted_duration']=isNaN(_0x337a88['duration'])?null:_0x337a88[_0xb6ae('0x63')]*0x3e8;_0x574317['converted_sampleCount']=isNaN(_0x337a88[_0xb6ae('0x64')])?null:_0x337a88[_0xb6ae('0x64')];_0x574317[_0xb6ae('0x6b')]=isNaN(_0x337a88[_0xb6ae('0x66')])?null:_0x337a88[_0xb6ae('0x66')];_0x574317[_0xb6ae('0x6c')]=isNaN(_0x337a88[_0xb6ae('0x6d')])?null:_0x337a88['bitRate'];_0x574317[_0xb6ae('0x6e')]=isNaN(_0x337a88[_0xb6ae('0x69')])?null:_0x337a88[_0xb6ae('0x69')];});_0x2502f8['on']('end',function(){fs[_0xb6ae('0x5f')](_0x4306f0,parseInt(_0xb6ae('0x6f'),0x8));return db['Sound'][_0xb6ae('0x55')](_0x574317)[_0xb6ae('0x23')](function(_0x2bea26){var _0x4980bc={'role':_0x2a804a['body'][_0xb6ae('0x70')],'userProfileId':_0x2a804a[_0xb6ae('0x71')][_0xb6ae('0x72')]};if(!_0x4980bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4980bc['role']===_0xb6ae('0x73')){var _0x3ba00e=_0x2bea26[_0xb6ae('0x25')]({'plain':!![]});return db[_0xb6ae('0x74')]['find']({'where':{'name':_0xb6ae('0x26'),'userProfileId':_0x4980bc[_0xb6ae('0x72')]},'raw':!![]})[_0xb6ae('0x23')](function(_0x142917){if(_0x142917&&_0x142917[_0xb6ae('0x75')]===0x0){return db[_0xb6ae('0x27')][_0xb6ae('0x55')]({'name':_0x3ba00e[_0xb6ae('0x2a')],'resourceId':_0x3ba00e['id'],'type':_0x142917[_0xb6ae('0x2a')],'sectionId':_0x142917['id']},{})['then'](function(){return _0x2bea26;});}else{return _0x2bea26;}})[_0xb6ae('0x45')](function(_0x273326){logger[_0xb6ae('0x28')](_0xb6ae('0x76'),_0x273326);throw _0x273326;});}return _0x2bea26;})[_0xb6ae('0x23')](respondWithResult(_0xab6547,null))[_0xb6ae('0x45')](handleError(_0xab6547,null));});_0x2502f8['start']();}catch(_0x29a7fd){_0xab6547[_0xb6ae('0x18')](0x1f4)[_0xb6ae('0x2b')](_0x29a7fd);}};exports[_0xb6ae('0x77')]=function(_0x217309,_0x1d8278,_0x351f9a){return db[_0xb6ae('0x2d')][_0xb6ae('0x49')]({'where':{'id':_0x217309[_0xb6ae('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d8278,null))[_0xb6ae('0x23')](saveUpdates(_[_0xb6ae('0x3d')](_0x217309[_0xb6ae('0x71')],[_0xb6ae('0x2a'),'description']),null))['then'](respondWithResult(_0x1d8278,null))[_0xb6ae('0x45')](handleError(_0x1d8278,null));};exports[_0xb6ae('0x78')]=function(_0x4d0643,_0x5ae5d2,_0x9b7734){return db[_0xb6ae('0x2d')][_0xb6ae('0x49')]({'where':{'id':_0x4d0643['params']['id']}})[_0xb6ae('0x23')](function(_0x2ff863){if(_0x2ff863){return _0x2ff863[_0xb6ae('0x24')]();}})[_0xb6ae('0x23')](function(_0x3b2bbb){var _0x1dcb91=path[_0xb6ae('0x4d')](config[_0xb6ae('0x4e')],_0xb6ae('0x5c'),util[_0xb6ae('0x53')](_0xb6ae('0x54'),_0x3b2bbb['save_name'],_0x3b2bbb['original_format']));var _0x41c9ee=path[_0xb6ae('0x4d')](config[_0xb6ae('0x4e')],_0xb6ae('0x4f'),util[_0xb6ae('0x53')](_0xb6ae('0x54'),_0x3b2bbb[_0xb6ae('0x50')],_0x3b2bbb['converted_format']));fs[_0xb6ae('0x79')](_0x1dcb91);fs[_0xb6ae('0x79')](_0x41c9ee);return _0x3b2bbb;})[_0xb6ae('0x23')](function(_0x2191f6){if(_0x2191f6){return _0x5ae5d2[_0xb6ae('0x18')](0xcc)[_0xb6ae('0x19')]();}})[_0xb6ae('0x23')](handleEntityNotFound(_0x5ae5d2,null))[_0xb6ae('0x45')](handleError(_0x5ae5d2,null));}; \ No newline at end of file +var _0xf75d=['type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','Sound\x20not\x20found','%s.%s','create','file','originalname','extname','basename','filename','substring','server/files/sounds/original','format','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','send','src','original_duration','duration','original_sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','start','description','delete','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','save','update','destroy','then','get','Sounds','UserProfileResource','sendStatus','stack','name','index','map','Sound','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','filter','where'];(function(_0x2e3aa0,_0x233e59){var _0x19d4ee=function(_0x4d5257){while(--_0x4d5257){_0x2e3aa0['push'](_0x2e3aa0['shift']());}};_0x19d4ee(++_0x233e59);}(_0xf75d,0x13e));var _0xdf75=function(_0x8c2e66,_0xf79589){_0x8c2e66=_0x8c2e66-0x0;var _0x31492f=_0xf75d[_0x8c2e66];return _0x31492f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf75('0x0'));var zipdir=require(_0xdf75('0x1'));var jsonpatch=require(_0xdf75('0x2'));var rp=require(_0xdf75('0x3'));var moment=require(_0xdf75('0x4'));var BPromise=require(_0xdf75('0x5'));var Mustache=require(_0xdf75('0x6'));var util=require(_0xdf75('0x7'));var path=require(_0xdf75('0x8'));var sox=require('sox');var csv=require(_0xdf75('0x9'));var ejs=require(_0xdf75('0xa'));var fs=require('fs');var fs_extra=require(_0xdf75('0xb'));var _=require(_0xdf75('0xc'));var squel=require('squel');var crypto=require(_0xdf75('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdf75('0x9'));var querystring=require(_0xdf75('0xe'));var Papa=require('papaparse');var Redis=require(_0xdf75('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf75('0x10'));var hardwareService=require(_0xdf75('0x11'));var logger=require(_0xdf75('0x12'))('api');var utils=require(_0xdf75('0x13'));var config=require(_0xdf75('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf75('0x15'))['db'];function respondWithStatusCode(_0x1a7c9b,_0x16d7d1){_0x16d7d1=_0x16d7d1||0xcc;return function(_0x910e29){if(_0x910e29){return _0x1a7c9b['sendStatus'](_0x16d7d1);}return _0x1a7c9b[_0xdf75('0x16')](_0x16d7d1)[_0xdf75('0x17')]();};}function respondWithResult(_0x347a82,_0x3831b1){_0x3831b1=_0x3831b1||0xc8;return function(_0x4923e6){if(_0x4923e6){return _0x347a82[_0xdf75('0x16')](_0x3831b1)['json'](_0x4923e6);}};}function respondWithFilteredResult(_0x3b92f7,_0x32b714){return function(_0x51e01f){if(_0x51e01f){var _0xeb922a=typeof _0x32b714[_0xdf75('0x18')]===_0xdf75('0x19')&&typeof _0x32b714['limit']==='undefined';var _0x533756=_0x51e01f[_0xdf75('0x1a')];var _0x2915b0=_0xeb922a?0x0:_0x32b714[_0xdf75('0x18')];var _0x4a074d=_0xeb922a?_0x51e01f[_0xdf75('0x1a')]:_0x32b714['offset']+_0x32b714['limit'];var _0x871058;if(_0x4a074d>=_0x533756){_0x4a074d=_0x533756;_0x871058=0xc8;}else{_0x871058=0xce;}_0x3b92f7['status'](_0x871058);return _0x3b92f7[_0xdf75('0x1b')](_0xdf75('0x1c'),_0x2915b0+'-'+_0x4a074d+'/'+_0x533756)[_0xdf75('0x1d')](_0x51e01f);}return null;};}function patchUpdates(_0x1d70be){return function(_0x562a06){try{jsonpatch[_0xdf75('0x1e')](_0x562a06,_0x1d70be,!![]);}catch(_0x3a616e){return BPromise['reject'](_0x3a616e);}return _0x562a06[_0xdf75('0x1f')]();};}function saveUpdates(_0x4fbf88,_0x5e95d1){return function(_0x215948){if(_0x215948){return _0x215948[_0xdf75('0x20')](_0x4fbf88)['then'](function(_0x28d994){return _0x28d994;});}return null;};}function removeEntity(_0x3e074b,_0x6ea4a7){return function(_0x2726ec){if(_0x2726ec){return _0x2726ec[_0xdf75('0x21')]()[_0xdf75('0x22')](function(){var _0x884b28=_0x2726ec[_0xdf75('0x23')]({'plain':!![]});var _0x9d0344=_0xdf75('0x24');return db[_0xdf75('0x25')]['destroy']({'where':{'type':_0x9d0344,'resourceId':_0x884b28['id']}})[_0xdf75('0x22')](function(){return _0x2726ec;});})[_0xdf75('0x22')](function(){_0x3e074b[_0xdf75('0x16')](0xcc)[_0xdf75('0x17')]();});}};}function handleEntityNotFound(_0x39cc55,_0x7b12f1){return function(_0x164461){if(!_0x164461){_0x39cc55[_0xdf75('0x26')](0x194);}return _0x164461;};}function handleError(_0x2e4255,_0x40e769){_0x40e769=_0x40e769||0x1f4;return function(_0x20a685){logger['error'](_0x20a685[_0xdf75('0x27')]);if(_0x20a685['name']){delete _0x20a685[_0xdf75('0x28')];}_0x2e4255['status'](_0x40e769)['send'](_0x20a685);};}exports[_0xdf75('0x29')]=function(_0x19a825,_0xde5ef9){var _0x124736={},_0x5970be={},_0x3fe711={'count':0x0,'rows':[]};var _0x40aada=_[_0xdf75('0x2a')](db[_0xdf75('0x2b')]['rawAttributes'],function(_0x1f6228){return{'name':_0x1f6228[_0xdf75('0x2c')],'type':_0x1f6228['type'][_0xdf75('0x2d')]};});_0x5970be[_0xdf75('0x2e')]=_['map'](_0x40aada,_0xdf75('0x28'));_0x5970be[_0xdf75('0x2f')]=_[_0xdf75('0x30')](_0x19a825[_0xdf75('0x2f')]);_0x5970be[_0xdf75('0x31')]=_[_0xdf75('0x32')](_0x5970be[_0xdf75('0x2e')],_0x5970be[_0xdf75('0x2f')]);_0x124736['attributes']=_['intersection'](_0x5970be[_0xdf75('0x2e')],qs[_0xdf75('0x33')](_0x19a825[_0xdf75('0x2f')]['fields']));_0x124736[_0xdf75('0x34')]=_0x124736[_0xdf75('0x34')][_0xdf75('0x35')]?_0x124736[_0xdf75('0x34')]:_0x5970be[_0xdf75('0x2e')];if(!_0x19a825[_0xdf75('0x2f')][_0xdf75('0x36')]('nolimit')){_0x124736[_0xdf75('0x37')]=qs[_0xdf75('0x37')](_0x19a825[_0xdf75('0x2f')][_0xdf75('0x37')]);_0x124736[_0xdf75('0x18')]=qs['offset'](_0x19a825['query'][_0xdf75('0x18')]);}_0x124736['order']=qs['sort'](_0x19a825['query'][_0xdf75('0x38')]);_0x124736['where']=qs[_0xdf75('0x31')](_[_0xdf75('0x39')](_0x19a825[_0xdf75('0x2f')],_0x5970be['filters']),_0x40aada);if(_0x19a825[_0xdf75('0x2f')][_0xdf75('0x3a')]){_0x124736[_0xdf75('0x3b')]=_['merge'](_0x124736[_0xdf75('0x3b')],{'$or':_['map'](_0x40aada,function(_0x5af496){if(_0x5af496[_0xdf75('0x3c')]!==_0xdf75('0x3d')){var _0x965f60={};_0x965f60[_0x5af496[_0xdf75('0x28')]]={'$like':'%'+_0x19a825[_0xdf75('0x2f')]['filter']+'%'};return _0x965f60;}})});}_0x124736=_['merge']({},_0x124736,_0x19a825[_0xdf75('0x3e')]);var _0xa2f890={'where':_0x124736[_0xdf75('0x3b')]};return db['Sound']['count'](_0xa2f890)[_0xdf75('0x22')](function(_0x174058){_0x3fe711[_0xdf75('0x1a')]=_0x174058;if(_0x19a825[_0xdf75('0x2f')][_0xdf75('0x3f')]){_0x124736[_0xdf75('0x40')]=[{'all':!![]}];}return db['Sound'][_0xdf75('0x41')](_0x124736);})[_0xdf75('0x22')](function(_0xa5ddbd){_0x3fe711[_0xdf75('0x42')]=_0xa5ddbd;return _0x3fe711;})[_0xdf75('0x22')](respondWithFilteredResult(_0xde5ef9,_0x124736))[_0xdf75('0x43')](handleError(_0xde5ef9,null));};exports['show']=function(_0x438d58,_0x182c54){var _0x18198c={'raw':!![],'where':{'id':_0x438d58[_0xdf75('0x44')]['id']}},_0x569030={};_0x569030['model']=_[_0xdf75('0x30')](db['Sound'][_0xdf75('0x45')]);_0x569030[_0xdf75('0x2f')]=_[_0xdf75('0x30')](_0x438d58['query']);_0x569030[_0xdf75('0x31')]=_[_0xdf75('0x32')](_0x569030[_0xdf75('0x2e')],_0x569030[_0xdf75('0x2f')]);_0x18198c[_0xdf75('0x34')]=_[_0xdf75('0x32')](_0x569030[_0xdf75('0x2e')],qs[_0xdf75('0x33')](_0x438d58[_0xdf75('0x2f')][_0xdf75('0x33')]));_0x18198c[_0xdf75('0x34')]=_0x18198c[_0xdf75('0x34')]['length']?_0x18198c[_0xdf75('0x34')]:_0x569030[_0xdf75('0x2e')];if(_0x438d58[_0xdf75('0x2f')][_0xdf75('0x3f')]){_0x18198c[_0xdf75('0x40')]=[{'all':!![]}];}_0x18198c=_['merge']({},_0x18198c,_0x438d58[_0xdf75('0x3e')]);return db[_0xdf75('0x2b')][_0xdf75('0x46')](_0x18198c)['then'](handleEntityNotFound(_0x182c54,null))['then'](respondWithResult(_0x182c54,null))[_0xdf75('0x43')](handleError(_0x182c54,null));};exports[_0xdf75('0x47')]=function(_0x44fb3a,_0x2d8ef3,_0x5af38a){return db[_0xdf75('0x2b')][_0xdf75('0x46')]({'where':{'id':_0x44fb3a['params']['id']},'attributes':[_0xdf75('0x28'),_0xdf75('0x48'),'converted_format'],'raw':!![]})[_0xdf75('0x22')](handleEntityNotFound(_0x2d8ef3,null))[_0xdf75('0x22')](function(_0x3618bf){if(_0x3618bf){if(!fs[_0xdf75('0x49')](path[_0xdf75('0x4a')](config[_0xdf75('0x4b')],_0xdf75('0x4c'),_0x3618bf[_0xdf75('0x48')]+'.'+_0x3618bf[_0xdf75('0x4d')]))){throw new db[(_0xdf75('0x4e'))]['ValidationError'](_0xdf75('0x4f'));}return _0x2d8ef3['download'](path['join'](config[_0xdf75('0x4b')],_0xdf75('0x4c'),util['format'](_0xdf75('0x50'),_0x3618bf[_0xdf75('0x48')],_0x3618bf[_0xdf75('0x4d')])),util['format'](_0xdf75('0x50'),_0x3618bf[_0xdf75('0x28')],_0x3618bf['converted_format']));}return null;})[_0xdf75('0x43')](handleError(_0x2d8ef3,null));};exports[_0xdf75('0x51')]=function(_0x356188,_0x513dba,_0x287888){var _0x3da4e1={'name':path['basename'](_0x356188[_0xdf75('0x52')][_0xdf75('0x53')],path[_0xdf75('0x54')](_0x356188[_0xdf75('0x52')][_0xdf75('0x53')])),'save_name':path[_0xdf75('0x55')](_0x356188[_0xdf75('0x52')][_0xdf75('0x56')],path[_0xdf75('0x54')](_0x356188[_0xdf75('0x52')]['filename'])),'original_format':path[_0xdf75('0x54')](_0x356188[_0xdf75('0x52')][_0xdf75('0x53')])[_0xdf75('0x57')](0x1),'converted_format':'wav'};var _0x860f5=path[_0xdf75('0x4a')](config[_0xdf75('0x4b')],_0xdf75('0x58'),_0x356188['file'][_0xdf75('0x56')]);var _0x33c289=path['join'](config[_0xdf75('0x4b')],'server/files/sounds/converted',util[_0xdf75('0x59')](_0xdf75('0x50'),path[_0xdf75('0x55')](_0x356188[_0xdf75('0x52')][_0xdf75('0x56')],path[_0xdf75('0x54')](_0x356188[_0xdf75('0x52')]['filename'])),_0x3da4e1['converted_format']));logger[_0xdf75('0x5a')](_0xdf75('0x5b'),_0x860f5);logger['info'](_0xdf75('0x5c'),_0x33c289);try{fs[_0xdf75('0x5d')](_0x860f5,parseInt(_0xdf75('0x5e'),0x8));var _0x56282d=sox[_0xdf75('0x5f')](_0x860f5,_0x33c289,{'sampleRate':0x1f40,'format':_0xdf75('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x56282d['on'](_0xdf75('0x61'),function(_0x13fdb2){fs[_0xdf75('0x62')](_0x860f5);_0x513dba['status'](0x1f4)[_0xdf75('0x63')](_0x13fdb2);});_0x56282d['on'](_0xdf75('0x64'),function(_0x370878){_0x3da4e1[_0xdf75('0x65')]=isNaN(_0x370878[_0xdf75('0x66')])?null:_0x370878['duration']*0x3e8;_0x3da4e1[_0xdf75('0x67')]=isNaN(_0x370878['sampleCount'])?null:_0x370878['sampleCount'];_0x3da4e1['original_channelCount']=isNaN(_0x370878[_0xdf75('0x68')])?null:_0x370878[_0xdf75('0x68')];_0x3da4e1[_0xdf75('0x69')]=isNaN(_0x370878[_0xdf75('0x6a')])?null:_0x370878['bitRate'];_0x3da4e1[_0xdf75('0x6b')]=isNaN(_0x370878[_0xdf75('0x6c')])?null:_0x370878[_0xdf75('0x6c')];});_0x56282d['on'](_0xdf75('0x6d'),function(_0x20fd55){_0x3da4e1[_0xdf75('0x6e')]=isNaN(_0x20fd55['duration'])?null:_0x20fd55[_0xdf75('0x66')]*0x3e8;_0x3da4e1[_0xdf75('0x6f')]=isNaN(_0x20fd55[_0xdf75('0x70')])?null:_0x20fd55['sampleCount'];_0x3da4e1[_0xdf75('0x71')]=isNaN(_0x20fd55[_0xdf75('0x68')])?null:_0x20fd55[_0xdf75('0x68')];_0x3da4e1[_0xdf75('0x72')]=isNaN(_0x20fd55[_0xdf75('0x6a')])?null:_0x20fd55[_0xdf75('0x6a')];_0x3da4e1[_0xdf75('0x73')]=isNaN(_0x20fd55[_0xdf75('0x6c')])?null:_0x20fd55[_0xdf75('0x6c')];});_0x56282d['on'](_0xdf75('0x17'),function(){fs[_0xdf75('0x5d')](_0x33c289,parseInt(_0xdf75('0x5e'),0x8));return db['Sound'][_0xdf75('0x51')](_0x3da4e1)[_0xdf75('0x22')](function(_0x1566e9){var _0x1dc2d3={'role':_0x356188[_0xdf75('0x74')]['role'],'userProfileId':_0x356188[_0xdf75('0x74')][_0xdf75('0x75')]};if(!_0x1dc2d3)throw new Error(_0xdf75('0x76'));if(_0x1dc2d3[_0xdf75('0x77')]===_0xdf75('0x78')){var _0x217a03=_0x1566e9[_0xdf75('0x23')]({'plain':!![]});return db[_0xdf75('0x79')][_0xdf75('0x46')]({'where':{'name':_0xdf75('0x24'),'userProfileId':_0x1dc2d3[_0xdf75('0x75')]},'raw':!![]})['then'](function(_0x525b72){if(_0x525b72&&_0x525b72['autoAssociation']===0x0){return db[_0xdf75('0x25')][_0xdf75('0x51')]({'name':_0x217a03[_0xdf75('0x28')],'resourceId':_0x217a03['id'],'type':_0x525b72['name'],'sectionId':_0x525b72['id']},{})[_0xdf75('0x22')](function(){return _0x1566e9;});}else{return _0x1566e9;}})[_0xdf75('0x43')](function(_0x25595d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25595d);throw _0x25595d;});}return _0x1566e9;})[_0xdf75('0x22')](respondWithResult(_0x513dba,null))[_0xdf75('0x43')](handleError(_0x513dba,null));});_0x56282d[_0xdf75('0x7a')]();}catch(_0x56b3ff){_0x513dba[_0xdf75('0x16')](0x1f4)['send'](_0x56b3ff);}};exports[_0xdf75('0x20')]=function(_0xd16a3b,_0x4842f3,_0x5f4945){return db['Sound']['find']({'where':{'id':_0xd16a3b['params']['id']}})[_0xdf75('0x22')](handleEntityNotFound(_0x4842f3,null))[_0xdf75('0x22')](saveUpdates(_[_0xdf75('0x39')](_0xd16a3b[_0xdf75('0x74')],[_0xdf75('0x28'),_0xdf75('0x7b')]),null))[_0xdf75('0x22')](respondWithResult(_0x4842f3,null))[_0xdf75('0x43')](handleError(_0x4842f3,null));};exports[_0xdf75('0x7c')]=function(_0x2af273,_0xb67add,_0x3392cf){return db[_0xdf75('0x2b')]['find']({'where':{'id':_0x2af273[_0xdf75('0x44')]['id']}})[_0xdf75('0x22')](function(_0x1a6100){if(_0x1a6100){return _0x1a6100[_0xdf75('0x21')]();}})['then'](function(_0x2d04f9){var _0x4f8ca8=path['join'](config['root'],'server/files/sounds/original',util[_0xdf75('0x59')](_0xdf75('0x50'),_0x2d04f9[_0xdf75('0x48')],_0x2d04f9[_0xdf75('0x7d')]));var _0x59261d=path[_0xdf75('0x4a')](config[_0xdf75('0x4b')],_0xdf75('0x4c'),util[_0xdf75('0x59')](_0xdf75('0x50'),_0x2d04f9[_0xdf75('0x48')],_0x2d04f9[_0xdf75('0x4d')]));fs[_0xdf75('0x62')](_0x4f8ca8);fs[_0xdf75('0x62')](_0x59261d);return _0x2d04f9;})[_0xdf75('0x22')](function(_0x482f09){if(_0x482f09){return _0xb67add[_0xdf75('0x16')](0xcc)[_0xdf75('0x17')]();}})[_0xdf75('0x22')](handleEntityNotFound(_0xb67add,null))[_0xdf75('0x43')](handleError(_0xb67add,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index bb10a2e..3f6fa2e 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 _0x2bae=['moment','bluebird','path','../../config/environment','exports','define','Sound','lodash','util','api'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x2bae,0x1c9));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe2ba('0x0'));var util=require(_0xe2ba('0x1'));var logger=require('../../config/logger')(_0xe2ba('0x2'));var moment=require(_0xe2ba('0x3'));var BPromise=require(_0xe2ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2ba('0x5'));var rimraf=require('rimraf');var config=require(_0xe2ba('0x6'));var attributes=require('./sound.attributes');module[_0xe2ba('0x7')]=function(_0x2f153e,_0x1dd522){return _0x2f153e[_0xe2ba('0x8')](_0xe2ba('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaff1=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash'];(function(_0x2f8b0f,_0x2654eb){var _0x384196=function(_0x5a7991){while(--_0x5a7991){_0x2f8b0f['push'](_0x2f8b0f['shift']());}};_0x384196(++_0x2654eb);}(_0xaff1,0x187));var _0x1aff=function(_0x48bf54,_0x1b18f6){_0x48bf54=_0x48bf54-0x0;var _0xd69386=_0xaff1[_0x48bf54];return _0xd69386;};'use strict';var _=require(_0x1aff('0x0'));var util=require(_0x1aff('0x1'));var logger=require(_0x1aff('0x2'))(_0x1aff('0x3'));var moment=require(_0x1aff('0x4'));var BPromise=require(_0x1aff('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1aff('0x6'));var rimraf=require(_0x1aff('0x7'));var config=require(_0x1aff('0x8'));var attributes=require(_0x1aff('0x9'));module[_0x1aff('0xa')]=function(_0x477de5,_0x536384){return _0x477de5[_0x1aff('0xb')](_0x1aff('0xc'),attributes,{'tableName':_0x1aff('0xd'),'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 35778be..1536990 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 _0xcee2=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','ShowSound','find','options','raw','where','map','include','model','attributes','catch','lodash','moment'];(function(_0x14490c,_0x50e8ab){var _0x2f6825=function(_0x477b03){while(--_0x477b03){_0x14490c['push'](_0x14490c['shift']());}};_0x2f6825(++_0x50e8ab);}(_0xcee2,0x1ce));var _0x2cee=function(_0x10d3fb,_0xeb7447){_0x10d3fb=_0x10d3fb-0x0;var _0xba9e47=_0xcee2[_0x10d3fb];return _0xba9e47;};'use strict';var _=require(_0x2cee('0x0'));var util=require('util');var moment=require(_0x2cee('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cee('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2cee('0x3'));var logger=require(_0x2cee('0x4'))(_0x2cee('0x5'));var config=require(_0x2cee('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2cee('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43ce76,_0x27d825,_0x28a1f5){return new BPromise(function(_0x58b9e9,_0x4a7a93){return client[_0x2cee('0x8')](_0x43ce76,_0x28a1f5)[_0x2cee('0x9')](function(_0x34bcb2){logger['info'](_0x2cee('0xa'),_0x27d825,_0x2cee('0xb'));logger[_0x2cee('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x27d825,_0x2cee('0xb'),JSON[_0x2cee('0xd')](_0x34bcb2));if(_0x34bcb2[_0x2cee('0xe')]){if(_0x34bcb2[_0x2cee('0xe')][_0x2cee('0xf')]===0x1f4){logger[_0x2cee('0xe')](_0x2cee('0xa'),_0x27d825,_0x34bcb2[_0x2cee('0xe')]['message']);return _0x4a7a93(_0x34bcb2['error'][_0x2cee('0x10')]);}logger[_0x2cee('0xe')](_0x2cee('0xa'),_0x27d825,_0x34bcb2[_0x2cee('0xe')]['message']);return _0x58b9e9(_0x34bcb2[_0x2cee('0xe')][_0x2cee('0x10')]);}else{logger[_0x2cee('0x11')]('Sound,\x20%s,\x20%s',_0x27d825,_0x2cee('0xb'));_0x58b9e9(_0x34bcb2[_0x2cee('0x12')][_0x2cee('0x10')]);}})['catch'](function(_0x5afa88){logger[_0x2cee('0xe')](_0x2cee('0xa'),_0x27d825,_0x5afa88);_0x4a7a93(_0x5afa88);});});}exports[_0x2cee('0x13')]=function(_0x4f401e){var _0x5210f9=this;return new Promise(function(_0x58b92,_0x59c7dc){return db['Sound'][_0x2cee('0x14')]({'raw':_0x4f401e[_0x2cee('0x15')]?_0x4f401e[_0x2cee('0x15')][_0x2cee('0x16')]===undefined?!![]:![]:!![],'where':_0x4f401e['options']?_0x4f401e[_0x2cee('0x15')][_0x2cee('0x17')]||null:null,'attributes':_0x4f401e[_0x2cee('0x15')]?_0x4f401e[_0x2cee('0x15')]['attributes']||null:null,'include':_0x4f401e[_0x2cee('0x15')]?_0x4f401e[_0x2cee('0x15')]['include']?_[_0x2cee('0x18')](_0x4f401e[_0x2cee('0x15')][_0x2cee('0x19')],function(_0x16f746){return{'model':db[_0x16f746[_0x2cee('0x1a')]],'as':_0x16f746['as'],'attributes':_0x16f746[_0x2cee('0x1b')],'include':_0x16f746[_0x2cee('0x19')]?_[_0x2cee('0x18')](_0x16f746[_0x2cee('0x19')],function(_0xf37bea){return{'model':db[_0xf37bea[_0x2cee('0x1a')]],'as':_0xf37bea['as'],'attributes':_0xf37bea[_0x2cee('0x1b')],'include':_0xf37bea['include']?_[_0x2cee('0x18')](_0xf37bea[_0x2cee('0x19')],function(_0x5c2389){return{'model':db[_0x5c2389[_0x2cee('0x1a')]],'as':_0x5c2389['as'],'attributes':_0x5c2389[_0x2cee('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2cee('0x9')](function(_0x114398){logger[_0x2cee('0x11')](_0x2cee('0x13'),_0x4f401e);logger[_0x2cee('0xc')](_0x2cee('0x13'),_0x4f401e,JSON[_0x2cee('0xd')](_0x114398));_0x58b92(_0x114398);})[_0x2cee('0x1c')](function(_0x338356){logger['error'](_0x2cee('0x13'),_0x338356[_0x2cee('0x10')],_0x4f401e);_0x59c7dc(_0x5210f9['error'](0x1f4,_0x338356[_0x2cee('0x10')]));});});}; \ No newline at end of file +var _0xd19b=['Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','ShowSound','Sound','find','options','raw','where','include','map','model','attributes','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x16493d,_0x48280d){var _0x529b52=function(_0x18e185){while(--_0x18e185){_0x16493d['push'](_0x16493d['shift']());}};_0x529b52(++_0x48280d);}(_0xd19b,0xec));var _0xbd19=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xd19b[_0x55d8c5];return _0x225ae5;};'use strict';var _=require(_0xbd19('0x0'));var util=require('util');var moment=require(_0xbd19('0x1'));var BPromise=require(_0xbd19('0x2'));var rs=require(_0xbd19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd19('0x4'));var logger=require(_0xbd19('0x5'))(_0xbd19('0x6'));var config=require(_0xbd19('0x7'));var jayson=require(_0xbd19('0x8'));var client=jayson[_0xbd19('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30412a,_0x1391d5,_0x456064){return new BPromise(function(_0x542ddf,_0x4f0736){return client[_0xbd19('0xa')](_0x30412a,_0x456064)[_0xbd19('0xb')](function(_0xda11fa){logger['info'](_0xbd19('0xc'),_0x1391d5,_0xbd19('0xd'));logger[_0xbd19('0xe')](_0xbd19('0xf'),_0x1391d5,_0xbd19('0xd'),JSON[_0xbd19('0x10')](_0xda11fa));if(_0xda11fa[_0xbd19('0x11')]){if(_0xda11fa[_0xbd19('0x11')]['code']===0x1f4){logger[_0xbd19('0x11')](_0xbd19('0xc'),_0x1391d5,_0xda11fa[_0xbd19('0x11')][_0xbd19('0x12')]);return _0x4f0736(_0xda11fa['error']['message']);}logger[_0xbd19('0x11')](_0xbd19('0xc'),_0x1391d5,_0xda11fa[_0xbd19('0x11')]['message']);return _0x542ddf(_0xda11fa[_0xbd19('0x11')][_0xbd19('0x12')]);}else{logger[_0xbd19('0x13')]('Sound,\x20%s,\x20%s',_0x1391d5,'request\x20sent');_0x542ddf(_0xda11fa['result'][_0xbd19('0x12')]);}})[_0xbd19('0x14')](function(_0x30c6b7){logger[_0xbd19('0x11')](_0xbd19('0xc'),_0x1391d5,_0x30c6b7);_0x4f0736(_0x30c6b7);});});}exports[_0xbd19('0x15')]=function(_0x86a841){var _0x29a790=this;return new Promise(function(_0x644cfd,_0x438196){return db[_0xbd19('0x16')][_0xbd19('0x17')]({'raw':_0x86a841[_0xbd19('0x18')]?_0x86a841[_0xbd19('0x18')][_0xbd19('0x19')]===undefined?!![]:![]:!![],'where':_0x86a841['options']?_0x86a841[_0xbd19('0x18')][_0xbd19('0x1a')]||null:null,'attributes':_0x86a841['options']?_0x86a841[_0xbd19('0x18')]['attributes']||null:null,'include':_0x86a841['options']?_0x86a841[_0xbd19('0x18')]['include']?_['map'](_0x86a841[_0xbd19('0x18')][_0xbd19('0x1b')],function(_0xd878f7){return{'model':db[_0xd878f7['model']],'as':_0xd878f7['as'],'attributes':_0xd878f7['attributes'],'include':_0xd878f7['include']?_[_0xbd19('0x1c')](_0xd878f7[_0xbd19('0x1b')],function(_0x49b557){return{'model':db[_0x49b557[_0xbd19('0x1d')]],'as':_0x49b557['as'],'attributes':_0x49b557[_0xbd19('0x1e')],'include':_0x49b557[_0xbd19('0x1b')]?_['map'](_0x49b557[_0xbd19('0x1b')],function(_0x3a6a00){return{'model':db[_0x3a6a00[_0xbd19('0x1d')]],'as':_0x3a6a00['as'],'attributes':_0x3a6a00[_0xbd19('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbd19('0xb')](function(_0xc93b8){logger[_0xbd19('0x13')](_0xbd19('0x15'),_0x86a841);logger['debug'](_0xbd19('0x15'),_0x86a841,JSON[_0xbd19('0x10')](_0xc93b8));_0x644cfd(_0xc93b8);})[_0xbd19('0x14')](function(_0x1414b4){logger[_0xbd19('0x11')](_0xbd19('0x15'),_0x1414b4[_0xbd19('0x12')],_0x86a841);_0x438196(_0x29a790['error'](0x1f4,_0x1414b4[_0xbd19('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 04e0d4e..88842f3 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 _0xf481=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x4736dc,_0x237d41){var _0x519148=function(_0x67a7b3){while(--_0x67a7b3){_0x4736dc['push'](_0x4736dc['shift']());}};_0x519148(++_0x237d41);}(_0xf481,0x18a));var _0x1f48=function(_0x428dbd,_0x30eeb5){_0x428dbd=_0x428dbd-0x0;var _0xc411d8=_0xf481[_0x428dbd];return _0xc411d8;};'use strict';var multer=require(_0x1f48('0x0'));var util=require(_0x1f48('0x1'));var path=require(_0x1f48('0x2'));var timeout=require(_0x1f48('0x3'));var express=require('express');var router=express[_0x1f48('0x4')]();var fs_extra=require(_0x1f48('0x5'));var auth=require(_0x1f48('0x6'));var interaction=require(_0x1f48('0x7'));var config=require(_0x1f48('0x8'));var controller=require(_0x1f48('0x9'));router[_0x1f48('0xa')]('/',auth[_0x1f48('0xb')](),controller[_0x1f48('0xc')]);router[_0x1f48('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1f48('0xd')]);router['post']('/',auth[_0x1f48('0xb')](),controller[_0x1f48('0xe')]);router[_0x1f48('0xf')](_0x1f48('0x10'),auth[_0x1f48('0xb')](),controller[_0x1f48('0x11')]);router[_0x1f48('0x12')](_0x1f48('0x10'),auth[_0x1f48('0xb')](),controller[_0x1f48('0x13')]);module[_0x1f48('0x14')]=router; \ No newline at end of file +var _0x7cc7=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x2f2afd,_0x3d33ae){var _0x12683a=function(_0x15b7f6){while(--_0x15b7f6){_0x2f2afd['push'](_0x2f2afd['shift']());}};_0x12683a(++_0x3d33ae);}(_0x7cc7,0x17d));var _0x77cc=function(_0x4013b1,_0x24bfeb){_0x4013b1=_0x4013b1-0x0;var _0x64a485=_0x7cc7[_0x4013b1];return _0x64a485;};'use strict';var multer=require(_0x77cc('0x0'));var util=require(_0x77cc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x77cc('0x2'));var router=express[_0x77cc('0x3')]();var fs_extra=require(_0x77cc('0x4'));var auth=require(_0x77cc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x77cc('0x6'));var controller=require(_0x77cc('0x7'));router['get']('/',auth[_0x77cc('0x8')](),controller[_0x77cc('0x9')]);router[_0x77cc('0xa')](_0x77cc('0xb'),auth[_0x77cc('0x8')](),controller[_0x77cc('0xc')]);router[_0x77cc('0xd')]('/',auth[_0x77cc('0x8')](),controller[_0x77cc('0xe')]);router[_0x77cc('0xf')](_0x77cc('0xb'),auth[_0x77cc('0x8')](),controller[_0x77cc('0x10')]);router[_0x77cc('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x77cc('0x12')]);module[_0x77cc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index ec0c272..1d3f152 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 _0x3937=['out','sequelize','STRING','TEXT','ENUM'];(function(_0x2bfe52,_0x43946e){var _0x1cf649=function(_0xc8300c){while(--_0xc8300c){_0x2bfe52['push'](_0x2bfe52['shift']());}};_0x1cf649(++_0x43946e);}(_0x3937,0xbf));var _0x7393=function(_0x15bea3,_0x5852d0){_0x15bea3=_0x15bea3-0x0;var _0xa0c18d=_0x3937[_0x15bea3];return _0xa0c18d;};'use strict';var Sequelize=require(_0x7393('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7393('0x1')]},'body':{'type':Sequelize[_0x7393('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x7393('0x3')]('in','out'),'defaultValue':_0x7393('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7393('0x2')]}}; \ No newline at end of file +var _0x57d4=['STRING','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x595c4c,_0x60a378){var _0xa42183=function(_0x154949){while(--_0x154949){_0x595c4c['push'](_0x595c4c['shift']());}};_0xa42183(++_0x60a378);}(_0x57d4,0x78));var _0x457d=function(_0x56aac4,_0x44454f){_0x56aac4=_0x56aac4-0x0;var _0x38fce8=_0x57d4[_0x56aac4];return _0x38fce8;};'use strict';var Sequelize=require(_0x457d('0x0'));module[_0x457d('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x457d('0x2')](_0x457d('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x457d('0x4')]('in',_0x457d('0x5')),'defaultValue':_0x457d('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x457d('0x6')]},'providerResponse':{'type':Sequelize[_0x457d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 8b6659c..f727e6b 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 _0xc15a=['hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','index','map','SquareMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x517fce,_0x159bcd){var _0x2a32ca=function(_0x4eb983){while(--_0x4eb983){_0x517fce['push'](_0x517fce['shift']());}};_0x2a32ca(++_0x159bcd);}(_0xc15a,0x18f));var _0xac15=function(_0x63a2a1,_0x2ec35e){_0x63a2a1=_0x63a2a1-0x0;var _0x5417e3=_0xc15a[_0x63a2a1];return _0x5417e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac15('0x0'));var zipdir=require(_0xac15('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac15('0x2'));var moment=require(_0xac15('0x3'));var BPromise=require(_0xac15('0x4'));var Mustache=require(_0xac15('0x5'));var util=require(_0xac15('0x6'));var path=require(_0xac15('0x7'));var sox=require(_0xac15('0x8'));var csv=require(_0xac15('0x9'));var ejs=require(_0xac15('0xa'));var fs=require('fs');var fs_extra=require(_0xac15('0xb'));var _=require(_0xac15('0xc'));var squel=require(_0xac15('0xd'));var crypto=require('crypto');var jsforce=require(_0xac15('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xac15('0xf'));var Papa=require('papaparse');var Redis=require(_0xac15('0x10'));var authService=require(_0xac15('0x11'));var qs=require(_0xac15('0x12'));var as=require(_0xac15('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac15('0x14'))(_0xac15('0x15'));var utils=require('../../config/utils');var config=require(_0xac15('0x16'));var licenseUtil=require(_0xac15('0x17'));var db=require(_0xac15('0x18'))['db'];function respondWithStatusCode(_0x254fda,_0x339a6b){_0x339a6b=_0x339a6b||0xcc;return function(_0x4dd2e9){if(_0x4dd2e9){return _0x254fda[_0xac15('0x19')](_0x339a6b);}return _0x254fda['status'](_0x339a6b)[_0xac15('0x1a')]();};}function respondWithResult(_0x91939e,_0x229264){_0x229264=_0x229264||0xc8;return function(_0x14f407){if(_0x14f407){return _0x91939e[_0xac15('0x1b')](_0x229264)[_0xac15('0x1c')](_0x14f407);}};}function respondWithFilteredResult(_0x17fed8,_0x28bcba){return function(_0x1a747d){if(_0x1a747d){var _0x1c94b6=typeof _0x28bcba[_0xac15('0x1d')]===_0xac15('0x1e')&&typeof _0x28bcba[_0xac15('0x1f')]===_0xac15('0x1e');var _0x9d839f=_0x1a747d[_0xac15('0x20')];var _0x581694=_0x1c94b6?0x0:_0x28bcba[_0xac15('0x1d')];var _0x370872=_0x1c94b6?_0x1a747d[_0xac15('0x20')]:_0x28bcba['offset']+_0x28bcba['limit'];var _0x438fef;if(_0x370872>=_0x9d839f){_0x370872=_0x9d839f;_0x438fef=0xc8;}else{_0x438fef=0xce;}_0x17fed8[_0xac15('0x1b')](_0x438fef);return _0x17fed8[_0xac15('0x21')](_0xac15('0x22'),_0x581694+'-'+_0x370872+'/'+_0x9d839f)[_0xac15('0x1c')](_0x1a747d);}return null;};}function patchUpdates(_0x566f86){return function(_0x45900e){try{jsonpatch[_0xac15('0x23')](_0x45900e,_0x566f86,!![]);}catch(_0x50aa49){return BPromise[_0xac15('0x24')](_0x50aa49);}return _0x45900e[_0xac15('0x25')]();};}function saveUpdates(_0x63fbf3,_0x80869f){return function(_0x4eb336){if(_0x4eb336){return _0x4eb336[_0xac15('0x26')](_0x63fbf3)['then'](function(_0x54ce6f){return _0x54ce6f;});}return null;};}function removeEntity(_0x816b2a,_0x3cec31){return function(_0x41f48e){if(_0x41f48e){return _0x41f48e[_0xac15('0x27')]()[_0xac15('0x28')](function(){_0x816b2a[_0xac15('0x1b')](0xcc)[_0xac15('0x1a')]();});}};}function handleEntityNotFound(_0x5986f9,_0x2383e4){return function(_0x4ddec7){if(!_0x4ddec7){_0x5986f9[_0xac15('0x19')](0x194);}return _0x4ddec7;};}function handleError(_0xf8a7ae,_0x157653){_0x157653=_0x157653||0x1f4;return function(_0x1153f1){logger[_0xac15('0x29')](_0x1153f1['stack']);if(_0x1153f1[_0xac15('0x2a')]){delete _0x1153f1['name'];}_0xf8a7ae[_0xac15('0x1b')](_0x157653)['send'](_0x1153f1);};}exports[_0xac15('0x2b')]=function(_0xa7bf8,_0x25d2cb){var _0x4484af={},_0x4a07b8={},_0x1db6d7={'count':0x0,'rows':[]};var _0x53d267=_[_0xac15('0x2c')](db[_0xac15('0x2d')]['rawAttributes'],function(_0x50967b){return{'name':_0x50967b[_0xac15('0x2e')],'type':_0x50967b[_0xac15('0x2f')][_0xac15('0x30')]};});_0x4a07b8[_0xac15('0x31')]=_[_0xac15('0x2c')](_0x53d267,_0xac15('0x2a'));_0x4a07b8[_0xac15('0x32')]=_[_0xac15('0x33')](_0xa7bf8[_0xac15('0x32')]);_0x4a07b8[_0xac15('0x34')]=_[_0xac15('0x35')](_0x4a07b8[_0xac15('0x31')],_0x4a07b8[_0xac15('0x32')]);_0x4484af[_0xac15('0x36')]=_[_0xac15('0x35')](_0x4a07b8[_0xac15('0x31')],qs[_0xac15('0x37')](_0xa7bf8['query'][_0xac15('0x37')]));_0x4484af[_0xac15('0x36')]=_0x4484af[_0xac15('0x36')][_0xac15('0x38')]?_0x4484af[_0xac15('0x36')]:_0x4a07b8['model'];if(!_0xa7bf8[_0xac15('0x32')][_0xac15('0x39')](_0xac15('0x3a'))){_0x4484af['limit']=qs[_0xac15('0x1f')](_0xa7bf8['query']['limit']);_0x4484af[_0xac15('0x1d')]=qs['offset'](_0xa7bf8['query'][_0xac15('0x1d')]);}_0x4484af['order']=qs[_0xac15('0x3b')](_0xa7bf8[_0xac15('0x32')]['sort']);_0x4484af[_0xac15('0x3c')]=qs[_0xac15('0x34')](_['pick'](_0xa7bf8[_0xac15('0x32')],_0x4a07b8[_0xac15('0x34')]),_0x53d267);if(_0xa7bf8['query']['filter']){_0x4484af[_0xac15('0x3c')]=_[_0xac15('0x3d')](_0x4484af[_0xac15('0x3c')],{'$or':_[_0xac15('0x2c')](_0x53d267,function(_0x4668b8){if(_0x4668b8['type']!==_0xac15('0x3e')){var _0x2c4da1={};_0x2c4da1[_0x4668b8[_0xac15('0x2a')]]={'$like':'%'+_0xa7bf8[_0xac15('0x32')][_0xac15('0x3f')]+'%'};return _0x2c4da1;}})});}_0x4484af=_['merge']({},_0x4484af,_0xa7bf8[_0xac15('0x40')]);var _0x1478e5={'where':_0x4484af['where']};return db['SquareMessage'][_0xac15('0x20')](_0x1478e5)[_0xac15('0x28')](function(_0x142317){_0x1db6d7[_0xac15('0x20')]=_0x142317;if(_0xa7bf8[_0xac15('0x32')]['includeAll']){_0x4484af['include']=[{'all':!![]}];}return db[_0xac15('0x2d')][_0xac15('0x41')](_0x4484af);})['then'](function(_0x5a933b){_0x1db6d7[_0xac15('0x42')]=_0x5a933b;return _0x1db6d7;})[_0xac15('0x28')](respondWithFilteredResult(_0x25d2cb,_0x4484af))[_0xac15('0x43')](handleError(_0x25d2cb,null));};exports[_0xac15('0x44')]=function(_0x5c4a98,_0x49cd40){var _0x3ba802={'raw':!![],'where':{'id':_0x5c4a98[_0xac15('0x45')]['id']}},_0x192a83={};_0x192a83[_0xac15('0x31')]=_[_0xac15('0x33')](db[_0xac15('0x2d')][_0xac15('0x46')]);_0x192a83[_0xac15('0x32')]=_[_0xac15('0x33')](_0x5c4a98[_0xac15('0x32')]);_0x192a83[_0xac15('0x34')]=_[_0xac15('0x35')](_0x192a83[_0xac15('0x31')],_0x192a83[_0xac15('0x32')]);_0x3ba802[_0xac15('0x36')]=_['intersection'](_0x192a83['model'],qs[_0xac15('0x37')](_0x5c4a98[_0xac15('0x32')][_0xac15('0x37')]));_0x3ba802['attributes']=_0x3ba802[_0xac15('0x36')][_0xac15('0x38')]?_0x3ba802[_0xac15('0x36')]:_0x192a83[_0xac15('0x31')];if(_0x5c4a98[_0xac15('0x32')][_0xac15('0x47')]){_0x3ba802[_0xac15('0x48')]=[{'all':!![]}];}_0x3ba802=_['merge']({},_0x3ba802,_0x5c4a98[_0xac15('0x40')]);return db[_0xac15('0x2d')][_0xac15('0x49')](_0x3ba802)[_0xac15('0x28')](handleEntityNotFound(_0x49cd40,null))[_0xac15('0x28')](respondWithResult(_0x49cd40,null))[_0xac15('0x43')](handleError(_0x49cd40,null));};exports[_0xac15('0x4a')]=function(_0x38c80f,_0x54e686){return db[_0xac15('0x2d')][_0xac15('0x4a')](_0x38c80f['body'],{})[_0xac15('0x28')](respondWithResult(_0x54e686,0xc9))['catch'](handleError(_0x54e686,null));};exports['update']=function(_0x4b0054,_0x476fdc){if(_0x4b0054[_0xac15('0x4b')]['id']){delete _0x4b0054[_0xac15('0x4b')]['id'];}return db[_0xac15('0x2d')]['find']({'where':{'id':_0x4b0054[_0xac15('0x45')]['id']}})[_0xac15('0x28')](handleEntityNotFound(_0x476fdc,null))[_0xac15('0x28')](saveUpdates(_0x4b0054['body'],null))[_0xac15('0x28')](respondWithResult(_0x476fdc,null))[_0xac15('0x43')](handleError(_0x476fdc,null));};exports[_0xac15('0x27')]=function(_0x479fd5,_0x4e0d6e){return db[_0xac15('0x2d')]['find']({'where':{'id':_0x479fd5['params']['id']}})['then'](handleEntityNotFound(_0x4e0d6e,null))[_0xac15('0x28')](removeEntity(_0x4e0d6e,null))[_0xac15('0x43')](handleError(_0x4e0d6e,null));}; \ No newline at end of file +var _0x98b7=['json','undefined','limit','count','offset','status','set','reject','save','then','error','stack','name','map','SquareMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','params','includeAll','include','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x418fa5,_0x13dc30){var _0xd340b5=function(_0x1bd6a5){while(--_0x1bd6a5){_0x418fa5['push'](_0x418fa5['shift']());}};_0xd340b5(++_0x13dc30);}(_0x98b7,0x10a));var _0x798b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x98b7[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x798b('0x0'));var rimraf=require(_0x798b('0x1'));var zipdir=require(_0x798b('0x2'));var jsonpatch=require(_0x798b('0x3'));var rp=require(_0x798b('0x4'));var moment=require(_0x798b('0x5'));var BPromise=require(_0x798b('0x6'));var Mustache=require('mustache');var util=require(_0x798b('0x7'));var path=require(_0x798b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x798b('0x9'));var fs=require('fs');var fs_extra=require(_0x798b('0xa'));var _=require(_0x798b('0xb'));var squel=require(_0x798b('0xc'));var crypto=require(_0x798b('0xd'));var jsforce=require(_0x798b('0xe'));var deskjs=require(_0x798b('0xf'));var toCsv=require(_0x798b('0x10'));var querystring=require(_0x798b('0x11'));var Papa=require(_0x798b('0x12'));var Redis=require(_0x798b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x798b('0x14'));var as=require(_0x798b('0x15'));var hardwareService=require(_0x798b('0x16'));var logger=require(_0x798b('0x17'))(_0x798b('0x18'));var utils=require(_0x798b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x798b('0x1a'));var db=require(_0x798b('0x1b'))['db'];function respondWithStatusCode(_0xfa1122,_0x27ee6d){_0x27ee6d=_0x27ee6d||0xcc;return function(_0x332c95){if(_0x332c95){return _0xfa1122[_0x798b('0x1c')](_0x27ee6d);}return _0xfa1122['status'](_0x27ee6d)[_0x798b('0x1d')]();};}function respondWithResult(_0x1cce59,_0x32fa64){_0x32fa64=_0x32fa64||0xc8;return function(_0x146cc5){if(_0x146cc5){return _0x1cce59['status'](_0x32fa64)[_0x798b('0x1e')](_0x146cc5);}};}function respondWithFilteredResult(_0x5f4faf,_0x4baae2){return function(_0x34b061){if(_0x34b061){var _0x3be7ea=typeof _0x4baae2['offset']===_0x798b('0x1f')&&typeof _0x4baae2[_0x798b('0x20')]===_0x798b('0x1f');var _0x154431=_0x34b061[_0x798b('0x21')];var _0x10aa94=_0x3be7ea?0x0:_0x4baae2[_0x798b('0x22')];var _0x340fb5=_0x3be7ea?_0x34b061[_0x798b('0x21')]:_0x4baae2[_0x798b('0x22')]+_0x4baae2['limit'];var _0x125412;if(_0x340fb5>=_0x154431){_0x340fb5=_0x154431;_0x125412=0xc8;}else{_0x125412=0xce;}_0x5f4faf[_0x798b('0x23')](_0x125412);return _0x5f4faf[_0x798b('0x24')]('Content-Range',_0x10aa94+'-'+_0x340fb5+'/'+_0x154431)[_0x798b('0x1e')](_0x34b061);}return null;};}function patchUpdates(_0x482785){return function(_0x7ae55e){try{jsonpatch['apply'](_0x7ae55e,_0x482785,!![]);}catch(_0x4356e1){return BPromise[_0x798b('0x25')](_0x4356e1);}return _0x7ae55e[_0x798b('0x26')]();};}function saveUpdates(_0x214707,_0x1a77f3){return function(_0xb396ca){if(_0xb396ca){return _0xb396ca['update'](_0x214707)[_0x798b('0x27')](function(_0x33b646){return _0x33b646;});}return null;};}function removeEntity(_0x43db41,_0x24c694){return function(_0x1b29aa){if(_0x1b29aa){return _0x1b29aa['destroy']()[_0x798b('0x27')](function(){_0x43db41[_0x798b('0x23')](0xcc)[_0x798b('0x1d')]();});}};}function handleEntityNotFound(_0xf7c55b,_0x4eb03d){return function(_0x3487ff){if(!_0x3487ff){_0xf7c55b['sendStatus'](0x194);}return _0x3487ff;};}function handleError(_0x38987b,_0x590103){_0x590103=_0x590103||0x1f4;return function(_0x224cbf){logger[_0x798b('0x28')](_0x224cbf[_0x798b('0x29')]);if(_0x224cbf[_0x798b('0x2a')]){delete _0x224cbf[_0x798b('0x2a')];}_0x38987b[_0x798b('0x23')](_0x590103)['send'](_0x224cbf);};}exports['index']=function(_0x539e83,_0x10e0ab){var _0x352865={},_0x239e1d={},_0x11fb81={'count':0x0,'rows':[]};var _0x3e9f1b=_[_0x798b('0x2b')](db[_0x798b('0x2c')][_0x798b('0x2d')],function(_0x4cb6cf){return{'name':_0x4cb6cf['fieldName'],'type':_0x4cb6cf[_0x798b('0x2e')]['key']};});_0x239e1d[_0x798b('0x2f')]=_['map'](_0x3e9f1b,'name');_0x239e1d[_0x798b('0x30')]=_[_0x798b('0x31')](_0x539e83[_0x798b('0x30')]);_0x239e1d[_0x798b('0x32')]=_[_0x798b('0x33')](_0x239e1d[_0x798b('0x2f')],_0x239e1d[_0x798b('0x30')]);_0x352865[_0x798b('0x34')]=_['intersection'](_0x239e1d[_0x798b('0x2f')],qs['fields'](_0x539e83[_0x798b('0x30')][_0x798b('0x35')]));_0x352865[_0x798b('0x34')]=_0x352865[_0x798b('0x34')][_0x798b('0x36')]?_0x352865[_0x798b('0x34')]:_0x239e1d[_0x798b('0x2f')];if(!_0x539e83[_0x798b('0x30')][_0x798b('0x37')](_0x798b('0x38'))){_0x352865[_0x798b('0x20')]=qs[_0x798b('0x20')](_0x539e83[_0x798b('0x30')][_0x798b('0x20')]);_0x352865['offset']=qs[_0x798b('0x22')](_0x539e83[_0x798b('0x30')][_0x798b('0x22')]);}_0x352865[_0x798b('0x39')]=qs[_0x798b('0x3a')](_0x539e83[_0x798b('0x30')][_0x798b('0x3a')]);_0x352865[_0x798b('0x3b')]=qs[_0x798b('0x32')](_['pick'](_0x539e83[_0x798b('0x30')],_0x239e1d['filters']),_0x3e9f1b);if(_0x539e83[_0x798b('0x30')][_0x798b('0x3c')]){_0x352865[_0x798b('0x3b')]=_[_0x798b('0x3d')](_0x352865['where'],{'$or':_[_0x798b('0x2b')](_0x3e9f1b,function(_0x7614da){if(_0x7614da[_0x798b('0x2e')]!==_0x798b('0x3e')){var _0x29342b={};_0x29342b[_0x7614da['name']]={'$like':'%'+_0x539e83[_0x798b('0x30')]['filter']+'%'};return _0x29342b;}})});}_0x352865=_[_0x798b('0x3d')]({},_0x352865,_0x539e83[_0x798b('0x3f')]);var _0x2b0ef3={'where':_0x352865[_0x798b('0x3b')]};return db['SquareMessage'][_0x798b('0x21')](_0x2b0ef3)['then'](function(_0x5b5f88){_0x11fb81[_0x798b('0x21')]=_0x5b5f88;if(_0x539e83['query']['includeAll']){_0x352865['include']=[{'all':!![]}];}return db[_0x798b('0x2c')]['findAll'](_0x352865);})['then'](function(_0x240bf2){_0x11fb81[_0x798b('0x40')]=_0x240bf2;return _0x11fb81;})['then'](respondWithFilteredResult(_0x10e0ab,_0x352865))['catch'](handleError(_0x10e0ab,null));};exports['show']=function(_0x33c535,_0x58b219){var _0x26b8aa={'raw':!![],'where':{'id':_0x33c535[_0x798b('0x41')]['id']}},_0x262d80={};_0x262d80['model']=_[_0x798b('0x31')](db[_0x798b('0x2c')][_0x798b('0x2d')]);_0x262d80[_0x798b('0x30')]=_['keys'](_0x33c535['query']);_0x262d80['filters']=_[_0x798b('0x33')](_0x262d80[_0x798b('0x2f')],_0x262d80[_0x798b('0x30')]);_0x26b8aa[_0x798b('0x34')]=_[_0x798b('0x33')](_0x262d80[_0x798b('0x2f')],qs['fields'](_0x33c535['query'][_0x798b('0x35')]));_0x26b8aa[_0x798b('0x34')]=_0x26b8aa[_0x798b('0x34')][_0x798b('0x36')]?_0x26b8aa[_0x798b('0x34')]:_0x262d80[_0x798b('0x2f')];if(_0x33c535[_0x798b('0x30')][_0x798b('0x42')]){_0x26b8aa[_0x798b('0x43')]=[{'all':!![]}];}_0x26b8aa=_[_0x798b('0x3d')]({},_0x26b8aa,_0x33c535['options']);return db['SquareMessage'][_0x798b('0x44')](_0x26b8aa)[_0x798b('0x27')](handleEntityNotFound(_0x58b219,null))['then'](respondWithResult(_0x58b219,null))[_0x798b('0x45')](handleError(_0x58b219,null));};exports['create']=function(_0x63c90a,_0x5bafd0){return db[_0x798b('0x2c')][_0x798b('0x46')](_0x63c90a[_0x798b('0x47')],{})[_0x798b('0x27')](respondWithResult(_0x5bafd0,0xc9))[_0x798b('0x45')](handleError(_0x5bafd0,null));};exports[_0x798b('0x48')]=function(_0x409dea,_0x20a6ad){if(_0x409dea[_0x798b('0x47')]['id']){delete _0x409dea[_0x798b('0x47')]['id'];}return db[_0x798b('0x2c')][_0x798b('0x44')]({'where':{'id':_0x409dea[_0x798b('0x41')]['id']}})[_0x798b('0x27')](handleEntityNotFound(_0x20a6ad,null))[_0x798b('0x27')](saveUpdates(_0x409dea[_0x798b('0x47')],null))[_0x798b('0x27')](respondWithResult(_0x20a6ad,null))[_0x798b('0x45')](handleError(_0x20a6ad,null));};exports[_0x798b('0x49')]=function(_0x4f8b47,_0x25ffcc){return db[_0x798b('0x2c')][_0x798b('0x44')]({'where':{'id':_0x4f8b47[_0x798b('0x41')]['id']}})[_0x798b('0x27')](handleEntityNotFound(_0x25ffcc,null))[_0x798b('0x27')](removeEntity(_0x25ffcc,null))[_0x798b('0x45')](handleError(_0x25ffcc,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 4ce31a3..e6d3745 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 _0xf0a5=['path','rimraf','../../config/environment','define','util','bluebird','request-promise'];(function(_0x578a80,_0x412698){var _0x4b4ba8=function(_0x4ff947){while(--_0x4ff947){_0x578a80['push'](_0x578a80['shift']());}};_0x4b4ba8(++_0x412698);}(_0xf0a5,0x1b6));var _0x5f0a=function(_0x58a32f,_0x592229){_0x58a32f=_0x58a32f-0x0;var _0xaf6639=_0xf0a5[_0x58a32f];return _0xaf6639;};'use strict';var _=require('lodash');var util=require(_0x5f0a('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5f0a('0x1'));var rp=require(_0x5f0a('0x2'));var fs=require('fs');var path=require(_0x5f0a('0x3'));var rimraf=require(_0x5f0a('0x4'));var config=require(_0x5f0a('0x5'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x5e4c43,_0x4fc390){return _0x5e4c43[_0x5f0a('0x6')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f39=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareMessage.attributes','exports','define','square_messages','util'];(function(_0x24ff05,_0x312f08){var _0x3d8b7a=function(_0x5589d4){while(--_0x5589d4){_0x24ff05['push'](_0x24ff05['shift']());}};_0x3d8b7a(++_0x312f08);}(_0x4f39,0x143));var _0x94f3=function(_0x3a1cfa,_0x3c778a){_0x3a1cfa=_0x3a1cfa-0x0;var _0x35f753=_0x4f39[_0x3a1cfa];return _0x35f753;};'use strict';var _=require('lodash');var util=require(_0x94f3('0x0'));var logger=require(_0x94f3('0x1'))(_0x94f3('0x2'));var moment=require(_0x94f3('0x3'));var BPromise=require(_0x94f3('0x4'));var rp=require(_0x94f3('0x5'));var fs=require('fs');var path=require(_0x94f3('0x6'));var rimraf=require(_0x94f3('0x7'));var config=require('../../config/environment');var attributes=require(_0x94f3('0x8'));module[_0x94f3('0x9')]=function(_0x54847e,_0x35f847){return _0x54847e[_0x94f3('0xa')]('SquareMessage',attributes,{'tableName':_0x94f3('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 bd6af95..96a4154 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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0xda547,_0x3f2823){var _0x1cd48b=function(_0x498236){while(--_0x498236){_0xda547['push'](_0xda547['shift']());}};_0x1cd48b(++_0x3f2823);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x576d47,_0x133b2e){var _0x3f38bf=function(_0x4734f0){while(--_0x4734f0){_0x576d47['push'](_0x576d47['shift']());}};_0x3f38bf(++_0x133b2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 2651536..b221b2a 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 _0xd1b4=['post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','show','/:id/test','15s','test'];(function(_0x3ac83e,_0x5e584e){var _0x1fc751=function(_0x198920){while(--_0x198920){_0x3ac83e['push'](_0x3ac83e['shift']());}};_0x1fc751(++_0x5e584e);}(_0xd1b4,0xc7));var _0x4d1b=function(_0x3ddb59,_0x3d46a0){_0x3ddb59=_0x3ddb59-0x0;var _0x5dbc50=_0xd1b4[_0x3ddb59];return _0x5dbc50;};'use strict';var multer=require(_0x4d1b('0x0'));var util=require(_0x4d1b('0x1'));var path=require('path');var timeout=require(_0x4d1b('0x2'));var express=require(_0x4d1b('0x3'));var router=express[_0x4d1b('0x4')]();var fs_extra=require(_0x4d1b('0x5'));var auth=require(_0x4d1b('0x6'));var interaction=require(_0x4d1b('0x7'));var config=require(_0x4d1b('0x8'));var controller=require(_0x4d1b('0x9'));router['get']('/',auth[_0x4d1b('0xa')](),controller[_0x4d1b('0xb')]);router[_0x4d1b('0xc')]('/:id',auth[_0x4d1b('0xa')](),controller[_0x4d1b('0xd')]);router[_0x4d1b('0xc')](_0x4d1b('0xe'),auth[_0x4d1b('0xa')](),timeout(_0x4d1b('0xf')),controller[_0x4d1b('0x10')]);router[_0x4d1b('0x11')]('/',auth[_0x4d1b('0xa')](),controller[_0x4d1b('0x12')]);router[_0x4d1b('0x13')](_0x4d1b('0x14'),auth[_0x4d1b('0xa')](),controller[_0x4d1b('0x15')]);router[_0x4d1b('0x16')](_0x4d1b('0x14'),auth['isAuthenticated'](),controller[_0x4d1b('0x17')]);module['exports']=router; \ No newline at end of file +var _0xc9e3=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','15s','post','create','update','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3c9a89,_0x378778){var _0x1eb47b=function(_0x57998a){while(--_0x57998a){_0x3c9a89['push'](_0x3c9a89['shift']());}};_0x1eb47b(++_0x378778);}(_0xc9e3,0xb7));var _0x3c9e=function(_0x4d559a,_0x499a7b){_0x4d559a=_0x4d559a-0x0;var _0x3a9bd0=_0xc9e3[_0x4d559a];return _0x3a9bd0;};'use strict';var multer=require(_0x3c9e('0x0'));var util=require(_0x3c9e('0x1'));var path=require(_0x3c9e('0x2'));var timeout=require('connect-timeout');var express=require(_0x3c9e('0x3'));var router=express[_0x3c9e('0x4')]();var fs_extra=require(_0x3c9e('0x5'));var auth=require(_0x3c9e('0x6'));var interaction=require(_0x3c9e('0x7'));var config=require(_0x3c9e('0x8'));var controller=require('./squareOdbc.controller');router[_0x3c9e('0x9')]('/',auth[_0x3c9e('0xa')](),controller[_0x3c9e('0xb')]);router[_0x3c9e('0x9')](_0x3c9e('0xc'),auth['isAuthenticated'](),controller[_0x3c9e('0xd')]);router[_0x3c9e('0x9')](_0x3c9e('0xe'),auth['isAuthenticated'](),timeout(_0x3c9e('0xf')),controller['test']);router[_0x3c9e('0x10')]('/',auth[_0x3c9e('0xa')](),controller[_0x3c9e('0x11')]);router['put']('/:id',auth[_0x3c9e('0xa')](),controller[_0x3c9e('0x12')]);router[_0x3c9e('0x13')](_0x3c9e('0xc'),auth[_0x3c9e('0xa')](),controller['destroy']);module[_0x3c9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5ca6eaf..e9aa06f 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 _0xd732=['sequelize','exports','STRING','name'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xd732,0x98));var _0x2d73=function(_0x3f9d7a,_0xfbf498){_0x3f9d7a=_0x3f9d7a-0x0;var _0x330568=_0xd732[_0x3f9d7a];return _0x330568;};'use strict';var Sequelize=require(_0x2d73('0x0'));module[_0x2d73('0x1')]={'name':{'type':Sequelize[_0x2d73('0x2')],'unique':_0x2d73('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2d73('0x2')]},'description':{'type':Sequelize[_0x2d73('0x2')]}}; \ No newline at end of file +var _0x8c4b=['STRING','name','sequelize','exports'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x8c4b,0x126));var _0xb8c4=function(_0x3456fe,_0x4e21b6){_0x3456fe=_0x3456fe-0x0;var _0x46fdcb=_0x8c4b[_0x3456fe];return _0x46fdcb;};'use strict';var Sequelize=require(_0xb8c4('0x0'));module[_0xb8c4('0x1')]={'name':{'type':Sequelize[_0xb8c4('0x2')],'unique':_0xb8c4('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xb8c4('0x2')]},'description':{'type':Sequelize[_0xb8c4('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 17b4379..61ab5e8 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 _0xd65f=['role','user','UserProfileSection','find','userProfileId','test','dsn','odbc','openSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','ODBC','UserProfileResource','sendStatus','error','stack','name','send','index','SquareOdbc','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','params','length','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd65f,0x105));var _0xfd65=function(_0x27b9a7,_0x215ec2){_0x27b9a7=_0x27b9a7-0x0;var _0x3c38dd=_0xd65f[_0x27b9a7];return _0x3c38dd;};'use strict';var emlformat=require(_0xfd65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd65('0x1'));var jsonpatch=require(_0xfd65('0x2'));var rp=require(_0xfd65('0x3'));var moment=require('moment');var BPromise=require(_0xfd65('0x4'));var Mustache=require(_0xfd65('0x5'));var util=require('util');var path=require('path');var sox=require(_0xfd65('0x6'));var csv=require(_0xfd65('0x7'));var ejs=require(_0xfd65('0x8'));var fs=require('fs');var fs_extra=require(_0xfd65('0x9'));var _=require(_0xfd65('0xa'));var squel=require(_0xfd65('0xb'));var crypto=require('crypto');var jsforce=require(_0xfd65('0xc'));var deskjs=require(_0xfd65('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfd65('0xe'));var Papa=require(_0xfd65('0xf'));var Redis=require(_0xfd65('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfd65('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd65('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xfd65('0x13'));var config=require(_0xfd65('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd65('0x15'))['db'];function respondWithStatusCode(_0x1c2d27,_0x2222ec){_0x2222ec=_0x2222ec||0xcc;return function(_0xdaf5d6){if(_0xdaf5d6){return _0x1c2d27['sendStatus'](_0x2222ec);}return _0x1c2d27[_0xfd65('0x16')](_0x2222ec)[_0xfd65('0x17')]();};}function respondWithResult(_0x349116,_0x579259){_0x579259=_0x579259||0xc8;return function(_0x50b956){if(_0x50b956){return _0x349116['status'](_0x579259)[_0xfd65('0x18')](_0x50b956);}};}function respondWithFilteredResult(_0x4ce495,_0x4c1507){return function(_0x37c708){if(_0x37c708){var _0x173165=typeof _0x4c1507[_0xfd65('0x19')]===_0xfd65('0x1a')&&typeof _0x4c1507[_0xfd65('0x1b')]==='undefined';var _0x21a40e=_0x37c708['count'];var _0x53b1df=_0x173165?0x0:_0x4c1507[_0xfd65('0x19')];var _0x3f0a4c=_0x173165?_0x37c708[_0xfd65('0x1c')]:_0x4c1507[_0xfd65('0x19')]+_0x4c1507[_0xfd65('0x1b')];var _0x1067ba;if(_0x3f0a4c>=_0x21a40e){_0x3f0a4c=_0x21a40e;_0x1067ba=0xc8;}else{_0x1067ba=0xce;}_0x4ce495[_0xfd65('0x16')](_0x1067ba);return _0x4ce495[_0xfd65('0x1d')]('Content-Range',_0x53b1df+'-'+_0x3f0a4c+'/'+_0x21a40e)[_0xfd65('0x18')](_0x37c708);}return null;};}function patchUpdates(_0x29bdda){return function(_0x3c38bd){try{jsonpatch[_0xfd65('0x1e')](_0x3c38bd,_0x29bdda,!![]);}catch(_0x325365){return BPromise['reject'](_0x325365);}return _0x3c38bd[_0xfd65('0x1f')]();};}function saveUpdates(_0x31df58,_0x28a62b){return function(_0x3b6c4e){if(_0x3b6c4e){return _0x3b6c4e[_0xfd65('0x20')](_0x31df58)[_0xfd65('0x21')](function(_0x1affc3){return _0x1affc3;});}return null;};}function removeEntity(_0x2c85d3,_0x4e80be){return function(_0x1e0b0a){if(_0x1e0b0a){return _0x1e0b0a[_0xfd65('0x22')]()['then'](function(){var _0x416fdd=_0x1e0b0a[_0xfd65('0x23')]({'plain':!![]});var _0x1cb696=_0xfd65('0x24');return db[_0xfd65('0x25')][_0xfd65('0x22')]({'where':{'type':_0x1cb696,'resourceId':_0x416fdd['id']}})[_0xfd65('0x21')](function(){return _0x1e0b0a;});})['then'](function(){_0x2c85d3[_0xfd65('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a0753,_0x4deca3){return function(_0x4a085f){if(!_0x4a085f){_0x5a0753[_0xfd65('0x26')](0x194);}return _0x4a085f;};}function handleError(_0x2dfd61,_0x37c376){_0x37c376=_0x37c376||0x1f4;return function(_0x1355c8){logger[_0xfd65('0x27')](_0x1355c8[_0xfd65('0x28')]);if(_0x1355c8[_0xfd65('0x29')]){delete _0x1355c8[_0xfd65('0x29')];}_0x2dfd61['status'](_0x37c376)[_0xfd65('0x2a')](_0x1355c8);};}exports[_0xfd65('0x2b')]=function(_0x499034,_0x4a6b7f){var _0x123094={},_0x216506={},_0x721e46={'count':0x0,'rows':[]};var _0x2bf084=_['map'](db[_0xfd65('0x2c')][_0xfd65('0x2d')],function(_0x1b041b){return{'name':_0x1b041b['fieldName'],'type':_0x1b041b[_0xfd65('0x2e')][_0xfd65('0x2f')]};});_0x216506[_0xfd65('0x30')]=_[_0xfd65('0x31')](_0x2bf084,'name');_0x216506['query']=_[_0xfd65('0x32')](_0x499034[_0xfd65('0x33')]);_0x216506[_0xfd65('0x34')]=_[_0xfd65('0x35')](_0x216506[_0xfd65('0x30')],_0x216506[_0xfd65('0x33')]);_0x123094[_0xfd65('0x36')]=_[_0xfd65('0x35')](_0x216506[_0xfd65('0x30')],qs[_0xfd65('0x37')](_0x499034['query']['fields']));_0x123094['attributes']=_0x123094[_0xfd65('0x36')]['length']?_0x123094[_0xfd65('0x36')]:_0x216506[_0xfd65('0x30')];if(!_0x499034['query'][_0xfd65('0x38')](_0xfd65('0x39'))){_0x123094[_0xfd65('0x1b')]=qs[_0xfd65('0x1b')](_0x499034[_0xfd65('0x33')]['limit']);_0x123094['offset']=qs['offset'](_0x499034[_0xfd65('0x33')][_0xfd65('0x19')]);}_0x123094['order']=qs['sort'](_0x499034[_0xfd65('0x33')][_0xfd65('0x3a')]);_0x123094['where']=qs[_0xfd65('0x34')](_[_0xfd65('0x3b')](_0x499034[_0xfd65('0x33')],_0x216506['filters']),_0x2bf084);if(_0x499034[_0xfd65('0x33')][_0xfd65('0x3c')]){_0x123094[_0xfd65('0x3d')]=_['merge'](_0x123094[_0xfd65('0x3d')],{'$or':_[_0xfd65('0x31')](_0x2bf084,function(_0x5a87c1){if(_0x5a87c1['type']!==_0xfd65('0x3e')){var _0x266213={};_0x266213[_0x5a87c1[_0xfd65('0x29')]]={'$like':'%'+_0x499034[_0xfd65('0x33')][_0xfd65('0x3c')]+'%'};return _0x266213;}})});}_0x123094=_[_0xfd65('0x3f')]({},_0x123094,_0x499034[_0xfd65('0x40')]);var _0x349b27={'where':_0x123094[_0xfd65('0x3d')]};return db[_0xfd65('0x2c')][_0xfd65('0x1c')](_0x349b27)[_0xfd65('0x21')](function(_0x13793f){_0x721e46[_0xfd65('0x1c')]=_0x13793f;if(_0x499034['query'][_0xfd65('0x41')]){_0x123094[_0xfd65('0x42')]=[{'all':!![]}];}return db[_0xfd65('0x2c')]['findAll'](_0x123094);})[_0xfd65('0x21')](function(_0x5c0705){_0x721e46[_0xfd65('0x43')]=_0x5c0705;return _0x721e46;})[_0xfd65('0x21')](respondWithFilteredResult(_0x4a6b7f,_0x123094))['catch'](handleError(_0x4a6b7f,null));};exports[_0xfd65('0x44')]=function(_0x154e36,_0x2442f4){var _0x408a6f={'raw':!![],'where':{'id':_0x154e36[_0xfd65('0x45')]['id']}},_0x39bef4={};_0x39bef4['model']=_['keys'](db[_0xfd65('0x2c')]['rawAttributes']);_0x39bef4[_0xfd65('0x33')]=_[_0xfd65('0x32')](_0x154e36[_0xfd65('0x33')]);_0x39bef4['filters']=_['intersection'](_0x39bef4['model'],_0x39bef4['query']);_0x408a6f[_0xfd65('0x36')]=_['intersection'](_0x39bef4[_0xfd65('0x30')],qs['fields'](_0x154e36[_0xfd65('0x33')][_0xfd65('0x37')]));_0x408a6f[_0xfd65('0x36')]=_0x408a6f[_0xfd65('0x36')][_0xfd65('0x46')]?_0x408a6f['attributes']:_0x39bef4[_0xfd65('0x30')];if(_0x154e36[_0xfd65('0x33')][_0xfd65('0x41')]){_0x408a6f[_0xfd65('0x42')]=[{'all':!![]}];}_0x408a6f=_[_0xfd65('0x3f')]({},_0x408a6f,_0x154e36[_0xfd65('0x40')]);return db[_0xfd65('0x2c')]['find'](_0x408a6f)[_0xfd65('0x21')](handleEntityNotFound(_0x2442f4,null))[_0xfd65('0x21')](respondWithResult(_0x2442f4,null))[_0xfd65('0x47')](handleError(_0x2442f4,null));};exports[_0xfd65('0x48')]=function(_0x2761ad,_0x35f386){return db['SquareOdbc'][_0xfd65('0x48')](_0x2761ad[_0xfd65('0x49')],{})['then'](function(_0x5ed5dc){var _0x44fad2=_0x2761ad['user'][_0xfd65('0x23')]({'plain':!![]});if(!_0x44fad2)throw new Error(_0xfd65('0x4a'));if(_0x44fad2[_0xfd65('0x4b')]===_0xfd65('0x4c')){var _0x1dc41f=_0x5ed5dc['get']({'plain':!![]});var _0x42bb9b=_0xfd65('0x24');return db[_0xfd65('0x4d')][_0xfd65('0x4e')]({'where':{'name':_0x42bb9b,'userProfileId':_0x44fad2[_0xfd65('0x4f')]},'raw':!![]})[_0xfd65('0x21')](function(_0x2ddbde){if(_0x2ddbde&&_0x2ddbde['autoAssociation']===0x0){return db[_0xfd65('0x25')][_0xfd65('0x48')]({'name':_0x1dc41f['name'],'resourceId':_0x1dc41f['id'],'type':_0x2ddbde['name'],'sectionId':_0x2ddbde['id']},{})[_0xfd65('0x21')](function(){return _0x5ed5dc;});}else{return _0x5ed5dc;}})['catch'](function(_0x30a297){logger[_0xfd65('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30a297);throw _0x30a297;});}return _0x5ed5dc;})['then'](respondWithResult(_0x35f386,0xc9))[_0xfd65('0x47')](handleError(_0x35f386,null));};exports['update']=function(_0x375513,_0x1f7cae){if(_0x375513[_0xfd65('0x49')]['id']){delete _0x375513[_0xfd65('0x49')]['id'];}return db[_0xfd65('0x2c')][_0xfd65('0x4e')]({'where':{'id':_0x375513['params']['id']}})[_0xfd65('0x21')](handleEntityNotFound(_0x1f7cae,null))['then'](saveUpdates(_0x375513[_0xfd65('0x49')],null))[_0xfd65('0x21')](respondWithResult(_0x1f7cae,null))['catch'](handleError(_0x1f7cae,null));};exports[_0xfd65('0x22')]=function(_0x55f9c3,_0x358717){return db[_0xfd65('0x2c')][_0xfd65('0x4e')]({'where':{'id':_0x55f9c3['params']['id']}})['then'](handleEntityNotFound(_0x358717,null))[_0xfd65('0x21')](removeEntity(_0x358717,null))[_0xfd65('0x47')](handleError(_0x358717,null));};exports[_0xfd65('0x50')]=function(_0xfff8ca,_0x2368c3,_0x6a40ad){var _0x12eb62;return db[_0xfd65('0x2c')][_0xfd65('0x4e')]({'where':{'id':_0xfff8ca[_0xfd65('0x45')]['id']},'attributes':['id',_0xfd65('0x51')]})['then'](handleEntityNotFound(_0x2368c3,null))[_0xfd65('0x21')](function(_0x27bc31){if(_0x27bc31){var _0x14ea14=require(_0xfd65('0x52'))();_0x14ea14[_0xfd65('0x53')](_0x27bc31['dsn']);_0x14ea14['closeSync']();return _0x27bc31;}})['then'](respondWithResult(_0x2368c3,null))['catch'](handleError(_0x2368c3,null));}; \ No newline at end of file +var _0x6b0b=['get','ODBC','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SquareOdbc','include','findAll','rows','show','find','catch','create','body','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x5c8f84,_0x2af7fd){var _0x1ac9d2=function(_0x5ccf06){while(--_0x5ccf06){_0x5c8f84['push'](_0x5c8f84['shift']());}};_0x1ac9d2(++_0x2af7fd);}(_0x6b0b,0xd5));var _0xb6b0=function(_0x3d6292,_0x341127){_0x3d6292=_0x3d6292-0x0;var _0x54da21=_0x6b0b[_0x3d6292];return _0x54da21;};'use strict';var emlformat=require(_0xb6b0('0x0'));var rimraf=require(_0xb6b0('0x1'));var zipdir=require(_0xb6b0('0x2'));var jsonpatch=require(_0xb6b0('0x3'));var rp=require(_0xb6b0('0x4'));var moment=require(_0xb6b0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb6b0('0x6'));var util=require(_0xb6b0('0x7'));var path=require('path');var sox=require(_0xb6b0('0x8'));var csv=require(_0xb6b0('0x9'));var ejs=require(_0xb6b0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb6b0('0xb'));var crypto=require(_0xb6b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb6b0('0xd'));var toCsv=require(_0xb6b0('0x9'));var querystring=require(_0xb6b0('0xe'));var Papa=require(_0xb6b0('0xf'));var Redis=require('ioredis');var authService=require(_0xb6b0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb6b0('0x11'));var hardwareService=require(_0xb6b0('0x12'));var logger=require(_0xb6b0('0x13'))(_0xb6b0('0x14'));var utils=require(_0xb6b0('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb6b0('0x16'))['db'];function respondWithStatusCode(_0x3f279a,_0x3a4554){_0x3a4554=_0x3a4554||0xcc;return function(_0x495cd3){if(_0x495cd3){return _0x3f279a[_0xb6b0('0x17')](_0x3a4554);}return _0x3f279a[_0xb6b0('0x18')](_0x3a4554)[_0xb6b0('0x19')]();};}function respondWithResult(_0x5157ce,_0x321b04){_0x321b04=_0x321b04||0xc8;return function(_0xfcd7b){if(_0xfcd7b){return _0x5157ce['status'](_0x321b04)[_0xb6b0('0x1a')](_0xfcd7b);}};}function respondWithFilteredResult(_0x2939ac,_0x516f1a){return function(_0x27da80){if(_0x27da80){var _0x4e0301=typeof _0x516f1a[_0xb6b0('0x1b')]===_0xb6b0('0x1c')&&typeof _0x516f1a['limit']===_0xb6b0('0x1c');var _0x44abe7=_0x27da80[_0xb6b0('0x1d')];var _0x34a24c=_0x4e0301?0x0:_0x516f1a[_0xb6b0('0x1b')];var _0x29c4c2=_0x4e0301?_0x27da80[_0xb6b0('0x1d')]:_0x516f1a['offset']+_0x516f1a[_0xb6b0('0x1e')];var _0x3e7efb;if(_0x29c4c2>=_0x44abe7){_0x29c4c2=_0x44abe7;_0x3e7efb=0xc8;}else{_0x3e7efb=0xce;}_0x2939ac[_0xb6b0('0x18')](_0x3e7efb);return _0x2939ac[_0xb6b0('0x1f')](_0xb6b0('0x20'),_0x34a24c+'-'+_0x29c4c2+'/'+_0x44abe7)[_0xb6b0('0x1a')](_0x27da80);}return null;};}function patchUpdates(_0x49fcd2){return function(_0x2dbb77){try{jsonpatch[_0xb6b0('0x21')](_0x2dbb77,_0x49fcd2,!![]);}catch(_0x28a80c){return BPromise[_0xb6b0('0x22')](_0x28a80c);}return _0x2dbb77[_0xb6b0('0x23')]();};}function saveUpdates(_0x578a07,_0x147a1d){return function(_0x337b22){if(_0x337b22){return _0x337b22[_0xb6b0('0x24')](_0x578a07)[_0xb6b0('0x25')](function(_0x56a9cd){return _0x56a9cd;});}return null;};}function removeEntity(_0x55461e,_0x51b497){return function(_0x278f60){if(_0x278f60){return _0x278f60[_0xb6b0('0x26')]()[_0xb6b0('0x25')](function(){var _0x4f1cc5=_0x278f60[_0xb6b0('0x27')]({'plain':!![]});var _0x624a40=_0xb6b0('0x28');return db[_0xb6b0('0x29')][_0xb6b0('0x26')]({'where':{'type':_0x624a40,'resourceId':_0x4f1cc5['id']}})[_0xb6b0('0x25')](function(){return _0x278f60;});})[_0xb6b0('0x25')](function(){_0x55461e['status'](0xcc)[_0xb6b0('0x19')]();});}};}function handleEntityNotFound(_0x292cc6,_0x59ccc2){return function(_0x3e66d6){if(!_0x3e66d6){_0x292cc6['sendStatus'](0x194);}return _0x3e66d6;};}function handleError(_0x366740,_0x277856){_0x277856=_0x277856||0x1f4;return function(_0x50a7a6){logger[_0xb6b0('0x2a')](_0x50a7a6[_0xb6b0('0x2b')]);if(_0x50a7a6['name']){delete _0x50a7a6[_0xb6b0('0x2c')];}_0x366740[_0xb6b0('0x18')](_0x277856)[_0xb6b0('0x2d')](_0x50a7a6);};}exports[_0xb6b0('0x2e')]=function(_0x49e428,_0x5f2653){var _0x5c31d4={},_0x566f2={},_0x24e053={'count':0x0,'rows':[]};var _0x2cb968=_[_0xb6b0('0x2f')](db['SquareOdbc'][_0xb6b0('0x30')],function(_0x467223){return{'name':_0x467223['fieldName'],'type':_0x467223[_0xb6b0('0x31')][_0xb6b0('0x32')]};});_0x566f2[_0xb6b0('0x33')]=_['map'](_0x2cb968,_0xb6b0('0x2c'));_0x566f2[_0xb6b0('0x34')]=_[_0xb6b0('0x35')](_0x49e428[_0xb6b0('0x34')]);_0x566f2[_0xb6b0('0x36')]=_[_0xb6b0('0x37')](_0x566f2[_0xb6b0('0x33')],_0x566f2['query']);_0x5c31d4[_0xb6b0('0x38')]=_[_0xb6b0('0x37')](_0x566f2[_0xb6b0('0x33')],qs[_0xb6b0('0x39')](_0x49e428[_0xb6b0('0x34')][_0xb6b0('0x39')]));_0x5c31d4[_0xb6b0('0x38')]=_0x5c31d4[_0xb6b0('0x38')][_0xb6b0('0x3a')]?_0x5c31d4[_0xb6b0('0x38')]:_0x566f2['model'];if(!_0x49e428['query']['hasOwnProperty'](_0xb6b0('0x3b'))){_0x5c31d4[_0xb6b0('0x1e')]=qs[_0xb6b0('0x1e')](_0x49e428[_0xb6b0('0x34')][_0xb6b0('0x1e')]);_0x5c31d4[_0xb6b0('0x1b')]=qs[_0xb6b0('0x1b')](_0x49e428[_0xb6b0('0x34')][_0xb6b0('0x1b')]);}_0x5c31d4[_0xb6b0('0x3c')]=qs[_0xb6b0('0x3d')](_0x49e428[_0xb6b0('0x34')]['sort']);_0x5c31d4[_0xb6b0('0x3e')]=qs['filters'](_['pick'](_0x49e428[_0xb6b0('0x34')],_0x566f2[_0xb6b0('0x36')]),_0x2cb968);if(_0x49e428[_0xb6b0('0x34')][_0xb6b0('0x3f')]){_0x5c31d4[_0xb6b0('0x3e')]=_[_0xb6b0('0x40')](_0x5c31d4[_0xb6b0('0x3e')],{'$or':_['map'](_0x2cb968,function(_0x226405){if(_0x226405['type']!==_0xb6b0('0x41')){var _0x275f57={};_0x275f57[_0x226405[_0xb6b0('0x2c')]]={'$like':'%'+_0x49e428[_0xb6b0('0x34')][_0xb6b0('0x3f')]+'%'};return _0x275f57;}})});}_0x5c31d4=_[_0xb6b0('0x40')]({},_0x5c31d4,_0x49e428[_0xb6b0('0x42')]);var _0xa699a3={'where':_0x5c31d4[_0xb6b0('0x3e')]};return db[_0xb6b0('0x43')][_0xb6b0('0x1d')](_0xa699a3)[_0xb6b0('0x25')](function(_0x5a23a0){_0x24e053['count']=_0x5a23a0;if(_0x49e428[_0xb6b0('0x34')]['includeAll']){_0x5c31d4[_0xb6b0('0x44')]=[{'all':!![]}];}return db[_0xb6b0('0x43')][_0xb6b0('0x45')](_0x5c31d4);})[_0xb6b0('0x25')](function(_0x1de2d5){_0x24e053[_0xb6b0('0x46')]=_0x1de2d5;return _0x24e053;})[_0xb6b0('0x25')](respondWithFilteredResult(_0x5f2653,_0x5c31d4))['catch'](handleError(_0x5f2653,null));};exports[_0xb6b0('0x47')]=function(_0x492f32,_0x514e42){var _0x166080={'raw':!![],'where':{'id':_0x492f32['params']['id']}},_0x33e1c1={};_0x33e1c1[_0xb6b0('0x33')]=_[_0xb6b0('0x35')](db[_0xb6b0('0x43')]['rawAttributes']);_0x33e1c1['query']=_[_0xb6b0('0x35')](_0x492f32[_0xb6b0('0x34')]);_0x33e1c1[_0xb6b0('0x36')]=_[_0xb6b0('0x37')](_0x33e1c1[_0xb6b0('0x33')],_0x33e1c1[_0xb6b0('0x34')]);_0x166080[_0xb6b0('0x38')]=_[_0xb6b0('0x37')](_0x33e1c1[_0xb6b0('0x33')],qs[_0xb6b0('0x39')](_0x492f32[_0xb6b0('0x34')]['fields']));_0x166080[_0xb6b0('0x38')]=_0x166080[_0xb6b0('0x38')]['length']?_0x166080[_0xb6b0('0x38')]:_0x33e1c1[_0xb6b0('0x33')];if(_0x492f32['query']['includeAll']){_0x166080[_0xb6b0('0x44')]=[{'all':!![]}];}_0x166080=_[_0xb6b0('0x40')]({},_0x166080,_0x492f32[_0xb6b0('0x42')]);return db[_0xb6b0('0x43')][_0xb6b0('0x48')](_0x166080)['then'](handleEntityNotFound(_0x514e42,null))[_0xb6b0('0x25')](respondWithResult(_0x514e42,null))[_0xb6b0('0x49')](handleError(_0x514e42,null));};exports[_0xb6b0('0x4a')]=function(_0x1a6b22,_0x163519){return db[_0xb6b0('0x43')][_0xb6b0('0x4a')](_0x1a6b22[_0xb6b0('0x4b')],{})[_0xb6b0('0x25')](function(_0x418c75){var _0x59e7cd=_0x1a6b22[_0xb6b0('0x4c')][_0xb6b0('0x27')]({'plain':!![]});if(!_0x59e7cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59e7cd['role']==='user'){var _0xbb032b=_0x418c75[_0xb6b0('0x27')]({'plain':!![]});var _0x465c98='ODBC';return db['UserProfileSection']['find']({'where':{'name':_0x465c98,'userProfileId':_0x59e7cd['userProfileId']},'raw':!![]})[_0xb6b0('0x25')](function(_0x4f40f2){if(_0x4f40f2&&_0x4f40f2[_0xb6b0('0x4d')]===0x0){return db[_0xb6b0('0x29')][_0xb6b0('0x4a')]({'name':_0xbb032b[_0xb6b0('0x2c')],'resourceId':_0xbb032b['id'],'type':_0x4f40f2[_0xb6b0('0x2c')],'sectionId':_0x4f40f2['id']},{})[_0xb6b0('0x25')](function(){return _0x418c75;});}else{return _0x418c75;}})[_0xb6b0('0x49')](function(_0x5631c6){logger[_0xb6b0('0x2a')](_0xb6b0('0x4e'),_0x5631c6);throw _0x5631c6;});}return _0x418c75;})[_0xb6b0('0x25')](respondWithResult(_0x163519,0xc9))[_0xb6b0('0x49')](handleError(_0x163519,null));};exports[_0xb6b0('0x24')]=function(_0x58423a,_0x1997c9){if(_0x58423a[_0xb6b0('0x4b')]['id']){delete _0x58423a[_0xb6b0('0x4b')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x58423a[_0xb6b0('0x4f')]['id']}})[_0xb6b0('0x25')](handleEntityNotFound(_0x1997c9,null))['then'](saveUpdates(_0x58423a['body'],null))[_0xb6b0('0x25')](respondWithResult(_0x1997c9,null))['catch'](handleError(_0x1997c9,null));};exports[_0xb6b0('0x26')]=function(_0x46a7ac,_0x1f6097){return db['SquareOdbc']['find']({'where':{'id':_0x46a7ac[_0xb6b0('0x4f')]['id']}})[_0xb6b0('0x25')](handleEntityNotFound(_0x1f6097,null))[_0xb6b0('0x25')](removeEntity(_0x1f6097,null))[_0xb6b0('0x49')](handleError(_0x1f6097,null));};exports['test']=function(_0x52c2bd,_0xc6d556,_0xfa2d02){var _0x11bab0;return db[_0xb6b0('0x43')][_0xb6b0('0x48')]({'where':{'id':_0x52c2bd[_0xb6b0('0x4f')]['id']},'attributes':['id',_0xb6b0('0x50')]})[_0xb6b0('0x25')](handleEntityNotFound(_0xc6d556,null))[_0xb6b0('0x25')](function(_0x2549ea){if(_0x2549ea){var _0x5af129=require(_0xb6b0('0x51'))();_0x5af129[_0xb6b0('0x52')](_0x2549ea[_0xb6b0('0x50')]);_0x5af129[_0xb6b0('0x53')]();return _0x2549ea;}})[_0xb6b0('0x25')](respondWithResult(_0xc6d556,null))[_0xb6b0('0x49')](handleError(_0xc6d556,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index af2d4cb..a92655c 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 _0xc900=['api','moment','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','../../config/logger'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0xc900,0xb3));var _0x0c90=function(_0x552e1b,_0x481074){_0x552e1b=_0x552e1b-0x0;var _0x3ca52f=_0xc900[_0x552e1b];return _0x3ca52f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c90('0x0'))(_0x0c90('0x1'));var moment=require(_0x0c90('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c90('0x3'));var fs=require('fs');var path=require(_0x0c90('0x4'));var rimraf=require('rimraf');var config=require(_0x0c90('0x5'));var attributes=require(_0x0c90('0x6'));module[_0x0c90('0x7')]=function(_0x718a5c,_0x42f9a3){return _0x718a5c[_0x0c90('0x8')]('SquareOdbc',attributes,{'tableName':_0x0c90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb158=['util','api','bluebird','request-promise','path','rimraf','./squareOdbc.attributes','exports','define','square_odbc','lodash'];(function(_0x3c99d9,_0x596a94){var _0x3c4042=function(_0x3c505a){while(--_0x3c505a){_0x3c99d9['push'](_0x3c99d9['shift']());}};_0x3c4042(++_0x596a94);}(_0xb158,0xfc));var _0x8b15=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xb158[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x8b15('0x0'));var util=require(_0x8b15('0x1'));var logger=require('../../config/logger')(_0x8b15('0x2'));var moment=require('moment');var BPromise=require(_0x8b15('0x3'));var rp=require(_0x8b15('0x4'));var fs=require('fs');var path=require(_0x8b15('0x5'));var rimraf=require(_0x8b15('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b15('0x7'));module[_0x8b15('0x8')]=function(_0x38e917,_0x263ccb){return _0x38e917[_0x8b15('0x9')]('SquareOdbc',attributes,{'tableName':_0x8b15('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 d79b3ce..c8d8aba 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0x1c2ea4,_0x16ac04){var _0x575866=function(_0x47272b){while(--_0x47272b){_0x1c2ea4['push'](_0x1c2ea4['shift']());}};_0x575866(++_0x16ac04);}(_0x55ca,0x126));var _0xa55c=function(_0x1a8a79,_0x57182d){_0x1a8a79=_0x1a8a79-0x0;var _0x436f4c=_0x55ca[_0x1a8a79];return _0x436f4c;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x5236a7,_0x410673){var _0x55831a=function(_0x5ea8ab){while(--_0x5ea8ab){_0x5236a7['push'](_0x5236a7['shift']());}};_0x55831a(++_0x410673);}(_0x008c,0x188));var _0xc008=function(_0x26641c,_0x1ba2a5){_0x26641c=_0x26641c-0x0;var _0x42c01a=_0x008c[_0x26641c];return _0x42c01a;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 5c23875..6ddf3ad 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 _0x1724=['destroy','removeUsers','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','getUsers','create','post','/:id/users','addUsers','put','delete','/:id'];(function(_0x17b65d,_0x35658c){var _0x303473=function(_0x266dad){while(--_0x266dad){_0x17b65d['push'](_0x17b65d['shift']());}};_0x303473(++_0x35658c);}(_0x1724,0x1b8));var _0x4172=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x1724[_0x311c35];return _0x5cc50c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4172('0x0'));var timeout=require(_0x4172('0x1'));var express=require(_0x4172('0x2'));var router=express[_0x4172('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4172('0x4'));var interaction=require(_0x4172('0x5'));var config=require(_0x4172('0x6'));var controller=require(_0x4172('0x7'));router[_0x4172('0x8')]('/',auth[_0x4172('0x9')](),controller[_0x4172('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4172('0xb')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x4172('0xc')]);router['post']('/',auth[_0x4172('0x9')](),controller[_0x4172('0xd')]);router[_0x4172('0xe')](_0x4172('0xf'),auth[_0x4172('0x9')](),controller[_0x4172('0x10')]);router[_0x4172('0x11')]('/:id',auth[_0x4172('0x9')](),controller['update']);router[_0x4172('0x12')](_0x4172('0x13'),auth[_0x4172('0x9')](),controller[_0x4172('0x14')]);router[_0x4172('0x12')]('/:id/users',auth[_0x4172('0x9')](),controller[_0x4172('0x15')]);module[_0x4172('0x16')]=router; \ No newline at end of file +var _0x0057=['delete','removeUsers','exports','multer','path','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','get','/:id','show','/:id/users','post','put','update'];(function(_0x50fc9a,_0x484cbf){var _0x198924=function(_0x4b6bd1){while(--_0x4b6bd1){_0x50fc9a['push'](_0x50fc9a['shift']());}};_0x198924(++_0x484cbf);}(_0x0057,0x168));var _0x7005=function(_0x54b366,_0x232cf1){_0x54b366=_0x54b366-0x0;var _0x448686=_0x0057[_0x54b366];return _0x448686;};'use strict';var multer=require(_0x7005('0x0'));var util=require('util');var path=require(_0x7005('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7005('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x7005('0x3'));var config=require(_0x7005('0x4'));var controller=require(_0x7005('0x5'));router['get']('/',auth[_0x7005('0x6')](),controller['index']);router[_0x7005('0x7')](_0x7005('0x8'),auth[_0x7005('0x6')](),controller[_0x7005('0x9')]);router[_0x7005('0x7')](_0x7005('0xa'),auth[_0x7005('0x6')](),controller['getUsers']);router[_0x7005('0xb')]('/',auth[_0x7005('0x6')](),controller['create']);router[_0x7005('0xb')]('/:id/users',auth[_0x7005('0x6')](),controller['addUsers']);router[_0x7005('0xc')](_0x7005('0x8'),auth[_0x7005('0x6')](),controller[_0x7005('0xd')]);router[_0x7005('0xe')](_0x7005('0x8'),auth[_0x7005('0x6')](),controller['destroy']);router[_0x7005('0xe')](_0x7005('0xa'),auth['isAuthenticated'](),controller[_0x7005('0xf')]);module[_0x7005('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 0815adf..13eb528 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 _0xd5c2=['getDataValue','preproduction','toString','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd5c2,0xb9));var _0x2d5c=function(_0x370e92,_0x118142){_0x370e92=_0x370e92-0x0;var _0x5ae928=_0xd5c2[_0x370e92];return _0x5ae928;};'use strict';var Sequelize=require(_0x2d5c('0x0'));module[_0x2d5c('0x1')]={'name':{'type':Sequelize[_0x2d5c('0x2')],'unique':_0x2d5c('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x2d5c('0x4')]},'preproduction':{'type':Sequelize[_0x2d5c('0x5')](_0x2d5c('0x6')),'get':function(){if(this[_0x2d5c('0x7')]('preproduction')){return this['getDataValue'](_0x2d5c('0x8'))[_0x2d5c('0x9')]('utf8');}}},'production':{'type':Sequelize[_0x2d5c('0x5')](_0x2d5c('0x6')),'get':function(){if(this[_0x2d5c('0x7')](_0x2d5c('0xa'))){return this[_0x2d5c('0x7')]('production')[_0x2d5c('0x9')]('utf8');}}},'savedAt':{'type':Sequelize[_0x2d5c('0xb')]},'publishedAt':{'type':Sequelize[_0x2d5c('0xb')]}}; \ No newline at end of file +var _0xa067=['DATE','sequelize','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','utf8','production','toString'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xa067,0x15d));var _0x7a06=function(_0x4bb40e,_0x4f17dd){_0x4bb40e=_0x4bb40e-0x0;var _0x580cbd=_0xa067[_0x4bb40e];return _0x580cbd;};'use strict';var Sequelize=require(_0x7a06('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a06('0x1')],'unique':_0x7a06('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7a06('0x1')]},'notes':{'type':Sequelize[_0x7a06('0x3')]},'preproduction':{'type':Sequelize[_0x7a06('0x4')](_0x7a06('0x5')),'get':function(){if(this[_0x7a06('0x6')]('preproduction')){return this['getDataValue'](_0x7a06('0x7'))['toString'](_0x7a06('0x8'));}}},'production':{'type':Sequelize[_0x7a06('0x4')](_0x7a06('0x5')),'get':function(){if(this['getDataValue']('production')){return this[_0x7a06('0x6')](_0x7a06('0x9'))[_0x7a06('0xa')]('utf8');}}},'savedAt':{'type':Sequelize[_0x7a06('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1b6c7b0..dbcf817 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 _0x2e48=['json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','get','SquareProjects','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','update','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','getUsers','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','sendStatus','status','end'];(function(_0x5d7972,_0x30e010){var _0x161fbf=function(_0x1f4082){while(--_0x1f4082){_0x5d7972['push'](_0x5d7972['shift']());}};_0x161fbf(++_0x30e010);}(_0x2e48,0x1ce));var _0x82e4=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0x2e48[_0x30f07a];return _0xb38461;};'use strict';var emlformat=require(_0x82e4('0x0'));var rimraf=require(_0x82e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x82e4('0x2'));var rp=require(_0x82e4('0x3'));var moment=require(_0x82e4('0x4'));var BPromise=require(_0x82e4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x82e4('0x6'));var sox=require('sox');var csv=require(_0x82e4('0x7'));var ejs=require(_0x82e4('0x8'));var fs=require('fs');var fs_extra=require(_0x82e4('0x9'));var _=require(_0x82e4('0xa'));var squel=require(_0x82e4('0xb'));var crypto=require(_0x82e4('0xc'));var jsforce=require(_0x82e4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x82e4('0x7'));var querystring=require(_0x82e4('0xe'));var Papa=require(_0x82e4('0xf'));var Redis=require('ioredis');var authService=require(_0x82e4('0x10'));var qs=require(_0x82e4('0x11'));var as=require(_0x82e4('0x12'));var hardwareService=require(_0x82e4('0x13'));var logger=require(_0x82e4('0x14'))(_0x82e4('0x15'));var utils=require(_0x82e4('0x16'));var config=require(_0x82e4('0x17'));var licenseUtil=require(_0x82e4('0x18'));var db=require(_0x82e4('0x19'))['db'];config[_0x82e4('0x1a')]=_[_0x82e4('0x1b')](config['redis'],{'host':_0x82e4('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x82e4('0x1d'))['register'](socket);function respondWithStatusCode(_0x1782c4,_0x45b538){_0x45b538=_0x45b538||0xcc;return function(_0x13a0c6){if(_0x13a0c6){return _0x1782c4[_0x82e4('0x1e')](_0x45b538);}return _0x1782c4[_0x82e4('0x1f')](_0x45b538)[_0x82e4('0x20')]();};}function respondWithResult(_0x392a51,_0x75e3fa){_0x75e3fa=_0x75e3fa||0xc8;return function(_0x41675e){if(_0x41675e){return _0x392a51[_0x82e4('0x1f')](_0x75e3fa)[_0x82e4('0x21')](_0x41675e);}};}function respondWithFilteredResult(_0x1d9745,_0x303bca){return function(_0x3c560d){if(_0x3c560d){var _0x5f1202=typeof _0x303bca[_0x82e4('0x22')]===_0x82e4('0x23')&&typeof _0x303bca['limit']===_0x82e4('0x23');var _0xae0798=_0x3c560d[_0x82e4('0x24')];var _0x3751a1=_0x5f1202?0x0:_0x303bca[_0x82e4('0x22')];var _0x2be53e=_0x5f1202?_0x3c560d[_0x82e4('0x24')]:_0x303bca['offset']+_0x303bca[_0x82e4('0x25')];var _0x3b7171;if(_0x2be53e>=_0xae0798){_0x2be53e=_0xae0798;_0x3b7171=0xc8;}else{_0x3b7171=0xce;}_0x1d9745[_0x82e4('0x1f')](_0x3b7171);return _0x1d9745['set'](_0x82e4('0x26'),_0x3751a1+'-'+_0x2be53e+'/'+_0xae0798)[_0x82e4('0x21')](_0x3c560d);}return null;};}function patchUpdates(_0x24ec01){return function(_0x300f62){try{jsonpatch[_0x82e4('0x27')](_0x300f62,_0x24ec01,!![]);}catch(_0x2af196){return BPromise[_0x82e4('0x28')](_0x2af196);}return _0x300f62[_0x82e4('0x29')]();};}function saveUpdates(_0x359576,_0x25f680){return function(_0x405bb2){if(_0x405bb2){return _0x405bb2['update'](_0x359576)[_0x82e4('0x2a')](function(_0x18d2c6){return _0x18d2c6;});}return null;};}function removeEntity(_0x56c03c,_0x331d13){return function(_0x3cad76){if(_0x3cad76){return _0x3cad76[_0x82e4('0x2b')]()[_0x82e4('0x2a')](function(){var _0x48ea4a=_0x3cad76[_0x82e4('0x2c')]({'plain':!![]});var _0x19778e=_0x82e4('0x2d');return db['UserProfileResource'][_0x82e4('0x2b')]({'where':{'type':_0x19778e,'resourceId':_0x48ea4a['id']}})[_0x82e4('0x2a')](function(){return _0x3cad76;});})[_0x82e4('0x2a')](function(){_0x56c03c[_0x82e4('0x1f')](0xcc)[_0x82e4('0x20')]();});}};}function handleEntityNotFound(_0x2f3ff5,_0x189d73){return function(_0x51f8c1){if(!_0x51f8c1){_0x2f3ff5[_0x82e4('0x1e')](0x194);}return _0x51f8c1;};}function handleError(_0x22a4c9,_0x56d969){_0x56d969=_0x56d969||0x1f4;return function(_0x51455d){logger[_0x82e4('0x2e')](_0x51455d[_0x82e4('0x2f')]);if(_0x51455d[_0x82e4('0x30')]){delete _0x51455d['name'];}_0x22a4c9[_0x82e4('0x1f')](_0x56d969)[_0x82e4('0x31')](_0x51455d);};}exports['index']=function(_0x1f5844,_0x4350d0){var _0x20b3bf={},_0xd238e6={},_0x41da71={'count':0x0,'rows':[]};var _0x518944=_[_0x82e4('0x32')](db[_0x82e4('0x33')][_0x82e4('0x34')],function(_0x105efc){return{'name':_0x105efc[_0x82e4('0x35')],'type':_0x105efc[_0x82e4('0x36')][_0x82e4('0x37')]};});_0xd238e6[_0x82e4('0x38')]=_['map'](_0x518944,_0x82e4('0x30'));_0xd238e6[_0x82e4('0x39')]=_[_0x82e4('0x3a')](_0x1f5844['query']);_0xd238e6[_0x82e4('0x3b')]=_['intersection'](_0xd238e6[_0x82e4('0x38')],_0xd238e6[_0x82e4('0x39')]);_0x20b3bf[_0x82e4('0x3c')]=_[_0x82e4('0x3d')](_0xd238e6[_0x82e4('0x38')],qs['fields'](_0x1f5844['query'][_0x82e4('0x3e')]));_0x20b3bf[_0x82e4('0x3c')]=_0x20b3bf['attributes'][_0x82e4('0x3f')]?_0x20b3bf[_0x82e4('0x3c')]:_0xd238e6[_0x82e4('0x38')];if(!_0x1f5844[_0x82e4('0x39')][_0x82e4('0x40')](_0x82e4('0x41'))){_0x20b3bf[_0x82e4('0x25')]=qs[_0x82e4('0x25')](_0x1f5844[_0x82e4('0x39')][_0x82e4('0x25')]);_0x20b3bf[_0x82e4('0x22')]=qs[_0x82e4('0x22')](_0x1f5844[_0x82e4('0x39')][_0x82e4('0x22')]);}_0x20b3bf[_0x82e4('0x42')]=qs[_0x82e4('0x43')](_0x1f5844['query']['sort']);_0x20b3bf[_0x82e4('0x44')]=qs[_0x82e4('0x3b')](_[_0x82e4('0x45')](_0x1f5844[_0x82e4('0x39')],_0xd238e6['filters']),_0x518944);if(_0x1f5844[_0x82e4('0x39')][_0x82e4('0x46')]){_0x20b3bf[_0x82e4('0x44')]=_[_0x82e4('0x47')](_0x20b3bf['where'],{'$or':_['map'](_0x518944,function(_0xb87109){if(_0xb87109[_0x82e4('0x36')]!==_0x82e4('0x48')){var _0x26afc2={};_0x26afc2[_0xb87109[_0x82e4('0x30')]]={'$like':'%'+_0x1f5844['query'][_0x82e4('0x46')]+'%'};return _0x26afc2;}})});}_0x20b3bf=_[_0x82e4('0x47')]({},_0x20b3bf,_0x1f5844['options']);var _0x12e1a5={'where':_0x20b3bf['where']};return db['SquareProject']['count'](_0x12e1a5)[_0x82e4('0x2a')](function(_0x37a60d){_0x41da71['count']=_0x37a60d;if(_0x1f5844[_0x82e4('0x39')]['includeAll']){_0x20b3bf[_0x82e4('0x49')]=[{'all':!![]}];}return db['SquareProject'][_0x82e4('0x4a')](_0x20b3bf);})[_0x82e4('0x2a')](function(_0x39f9fd){_0x41da71[_0x82e4('0x4b')]=_0x39f9fd;return _0x41da71;})[_0x82e4('0x2a')](respondWithFilteredResult(_0x4350d0,_0x20b3bf))[_0x82e4('0x4c')](handleError(_0x4350d0,null));};exports[_0x82e4('0x4d')]=function(_0x7c27,_0x4503e5){var _0x198b5a={'raw':![],'where':{'id':_0x7c27[_0x82e4('0x4e')]['id']}},_0x1f9d3d={};_0x1f9d3d[_0x82e4('0x38')]=_['keys'](db[_0x82e4('0x33')]['rawAttributes']);_0x1f9d3d[_0x82e4('0x39')]=_[_0x82e4('0x3a')](_0x7c27[_0x82e4('0x39')]);_0x1f9d3d[_0x82e4('0x3b')]=_[_0x82e4('0x3d')](_0x1f9d3d[_0x82e4('0x38')],_0x1f9d3d['query']);_0x198b5a[_0x82e4('0x3c')]=_[_0x82e4('0x3d')](_0x1f9d3d['model'],qs['fields'](_0x7c27['query'][_0x82e4('0x3e')]));_0x198b5a[_0x82e4('0x3c')]=_0x198b5a['attributes'][_0x82e4('0x3f')]?_0x198b5a['attributes']:_0x1f9d3d[_0x82e4('0x38')];if(_0x7c27[_0x82e4('0x39')]['includeAll']){_0x198b5a[_0x82e4('0x49')]=[{'all':!![]}];}_0x198b5a=_['merge']({},_0x198b5a,_0x7c27[_0x82e4('0x4f')]);return db['SquareProject'][_0x82e4('0x50')](_0x198b5a)['then'](handleEntityNotFound(_0x4503e5,null))['then'](respondWithResult(_0x4503e5,null))[_0x82e4('0x4c')](handleError(_0x4503e5,null));};exports['create']=function(_0x577ca3,_0x4232dd){return db[_0x82e4('0x33')][_0x82e4('0x51')](_0x577ca3[_0x82e4('0x52')],{})[_0x82e4('0x2a')](function(_0x228297){var _0x36d404=_0x577ca3[_0x82e4('0x53')][_0x82e4('0x2c')]({'plain':!![]});if(!_0x36d404)throw new Error(_0x82e4('0x54'));if(_0x36d404[_0x82e4('0x55')]===_0x82e4('0x53')){var _0x12ba0d=_0x228297['get']({'plain':!![]});var _0x1d2147='SquareProjects';return db[_0x82e4('0x56')]['find']({'where':{'name':_0x1d2147,'userProfileId':_0x36d404['userProfileId']},'raw':!![]})[_0x82e4('0x2a')](function(_0x399bd5){if(_0x399bd5&&_0x399bd5['autoAssociation']===0x0){return db[_0x82e4('0x57')]['create']({'name':_0x12ba0d[_0x82e4('0x30')],'resourceId':_0x12ba0d['id'],'type':_0x399bd5[_0x82e4('0x30')],'sectionId':_0x399bd5['id']},{})[_0x82e4('0x2a')](function(){return _0x228297;});}else{return _0x228297;}})[_0x82e4('0x4c')](function(_0x4711da){logger[_0x82e4('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4711da);throw _0x4711da;});}return _0x228297;})[_0x82e4('0x2a')](respondWithResult(_0x4232dd,0xc9))[_0x82e4('0x4c')](handleError(_0x4232dd,null));};exports[_0x82e4('0x58')]=function(_0x46bdf9,_0x43cb77){if(_0x46bdf9[_0x82e4('0x52')]['id']){delete _0x46bdf9[_0x82e4('0x52')]['id'];}return db[_0x82e4('0x33')][_0x82e4('0x50')]({'where':{'id':_0x46bdf9[_0x82e4('0x4e')]['id']}})[_0x82e4('0x2a')](handleEntityNotFound(_0x43cb77,null))[_0x82e4('0x2a')](saveUpdates(_0x46bdf9[_0x82e4('0x52')],null))[_0x82e4('0x2a')](respondWithResult(_0x43cb77,null))[_0x82e4('0x4c')](handleError(_0x43cb77,null));};exports[_0x82e4('0x2b')]=function(_0x5dd0a5,_0x1f6f1e){return db['SquareProject']['find']({'where':{'id':_0x5dd0a5[_0x82e4('0x4e')]['id']}})[_0x82e4('0x2a')](handleEntityNotFound(_0x1f6f1e,null))[_0x82e4('0x2a')](removeEntity(_0x1f6f1e,null))[_0x82e4('0x4c')](handleError(_0x1f6f1e,null));};exports[_0x82e4('0x59')]=function(_0x4860b3,_0x1a6019,_0x2b04f4){return db[_0x82e4('0x33')][_0x82e4('0x50')]({'where':{'id':_0x4860b3[_0x82e4('0x4e')]['id']}})[_0x82e4('0x2a')](handleEntityNotFound(_0x1a6019,null))[_0x82e4('0x2a')](function(_0xae06d1){if(_0xae06d1){return _0xae06d1[_0x82e4('0x59')](_0x4860b3[_0x82e4('0x52')][_0x82e4('0x5a')],_[_0x82e4('0x5b')](_0x4860b3[_0x82e4('0x52')],[_0x82e4('0x5a'),'id'])||{});}})[_0x82e4('0x2a')](respondWithResult(_0x1a6019,null))[_0x82e4('0x4c')](handleError(_0x1a6019,null));};exports[_0x82e4('0x5c')]=function(_0x511b35,_0x19a9ab,_0x3c83eb){return db[_0x82e4('0x33')][_0x82e4('0x50')]({'where':{'id':_0x511b35['params']['id']}})[_0x82e4('0x2a')](handleEntityNotFound(_0x19a9ab,null))[_0x82e4('0x2a')](function(_0x1350da){if(_0x1350da){return _0x1350da[_0x82e4('0x5c')](_0x511b35[_0x82e4('0x39')][_0x82e4('0x5a')])[_0x82e4('0x2a')](function(){if(_[_0x82e4('0x5d')](_0x511b35[_0x82e4('0x39')][_0x82e4('0x5a')])){for(var _0xad1595=0x0;_0xad1595<_0x511b35[_0x82e4('0x39')][_0x82e4('0x5a')][_0x82e4('0x3f')];_0xad1595+=0x1){socket[_0x82e4('0x5e')](_0x82e4('0x5f'),{'UserId':Number(_0x511b35['query'][_0x82e4('0x5a')][_0xad1595]),'SquareProjectId':Number(_0x511b35[_0x82e4('0x4e')]['id'])});}}else{socket[_0x82e4('0x5e')]('userSquareProject:remove',{'UserId':Number(_0x511b35[_0x82e4('0x39')]['ids']),'SquareProjectId':Number(_0x511b35[_0x82e4('0x4e')]['id'])});}});}})[_0x82e4('0x2a')](respondWithStatusCode(_0x19a9ab,null))[_0x82e4('0x4c')](handleError(_0x19a9ab,null));};exports['getUsers']=function(_0x164bf8,_0x155728,_0x62d1d9){var _0x30f3a3={};var _0xc9a5b8={};var _0x24ec84;var _0x54300b;return db[_0x82e4('0x33')][_0x82e4('0x60')]({'where':{'id':_0x164bf8['params']['id']}})['then'](handleEntityNotFound(_0x155728,null))[_0x82e4('0x2a')](function(_0x4069af){if(_0x4069af){_0x24ec84=_0x4069af;_0xc9a5b8[_0x82e4('0x38')]=_[_0x82e4('0x3a')](db[_0x82e4('0x61')][_0x82e4('0x34')]);_0xc9a5b8[_0x82e4('0x39')]=_['keys'](_0x164bf8[_0x82e4('0x39')]);_0xc9a5b8[_0x82e4('0x3b')]=_[_0x82e4('0x3d')](_0xc9a5b8[_0x82e4('0x38')],_0xc9a5b8['query']);_0x30f3a3['attributes']=_[_0x82e4('0x3d')](_0xc9a5b8['model'],qs['fields'](_0x164bf8[_0x82e4('0x39')][_0x82e4('0x3e')]));_0x30f3a3[_0x82e4('0x3c')]=_0x30f3a3[_0x82e4('0x3c')]['length']?_0x30f3a3[_0x82e4('0x3c')]:_0xc9a5b8[_0x82e4('0x38')];_0x30f3a3[_0x82e4('0x42')]=qs[_0x82e4('0x43')](_0x164bf8[_0x82e4('0x39')]['sort']);_0x30f3a3[_0x82e4('0x44')]=qs[_0x82e4('0x3b')](_['pick'](_0x164bf8[_0x82e4('0x39')],_0xc9a5b8[_0x82e4('0x3b')]));if(_0x164bf8['query'][_0x82e4('0x46')]){_0x30f3a3[_0x82e4('0x44')]=_['merge'](_0x30f3a3['where'],{'$or':_[_0x82e4('0x32')](_0x30f3a3[_0x82e4('0x3c')],function(_0x103f5f){var _0x4b174a={};_0x4b174a[_0x103f5f]={'$like':'%'+_0x164bf8[_0x82e4('0x39')][_0x82e4('0x46')]+'%'};return _0x4b174a;})});}_0x30f3a3=_[_0x82e4('0x47')]({},_0x30f3a3,_0x164bf8[_0x82e4('0x4f')]);return _0x24ec84[_0x82e4('0x62')](_0x30f3a3);}})[_0x82e4('0x2a')](function(_0x309992){if(_0x309992){_0x54300b=_0x309992[_0x82e4('0x3f')];if(!_0x164bf8[_0x82e4('0x39')][_0x82e4('0x40')](_0x82e4('0x41'))){_0x30f3a3[_0x82e4('0x25')]=qs[_0x82e4('0x25')](_0x164bf8[_0x82e4('0x39')][_0x82e4('0x25')]);_0x30f3a3['offset']=qs[_0x82e4('0x22')](_0x164bf8[_0x82e4('0x39')][_0x82e4('0x22')]);}return _0x24ec84[_0x82e4('0x62')](_0x30f3a3);}})['then'](function(_0xab4cee){if(_0xab4cee){return _0xab4cee?{'count':_0x54300b,'rows':_0xab4cee}:null;}})[_0x82e4('0x2a')](respondWithResult(_0x155728,null))['catch'](handleError(_0x155728,null));}; \ No newline at end of file +var _0xaee8=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','end','json','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','stack','name','send','map','SquareProject','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','SquareProjects','find','userProfileId','autoAssociation','error','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xaee8,0x16b));var _0x8aee=function(_0x5a889c,_0x1d7328){_0x5a889c=_0x5a889c-0x0;var _0xa9ef9a=_0xaee8[_0x5a889c];return _0xa9ef9a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8aee('0x0'));var jsonpatch=require(_0x8aee('0x1'));var rp=require(_0x8aee('0x2'));var moment=require(_0x8aee('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8aee('0x4'));var util=require('util');var path=require(_0x8aee('0x5'));var sox=require(_0x8aee('0x6'));var csv=require(_0x8aee('0x7'));var ejs=require(_0x8aee('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8aee('0x9'));var squel=require('squel');var crypto=require(_0x8aee('0xa'));var jsforce=require(_0x8aee('0xb'));var deskjs=require(_0x8aee('0xc'));var toCsv=require(_0x8aee('0x7'));var querystring=require(_0x8aee('0xd'));var Papa=require(_0x8aee('0xe'));var Redis=require(_0x8aee('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8aee('0x10'));var as=require(_0x8aee('0x11'));var hardwareService=require(_0x8aee('0x12'));var logger=require(_0x8aee('0x13'))(_0x8aee('0x14'));var utils=require(_0x8aee('0x15'));var config=require(_0x8aee('0x16'));var licenseUtil=require(_0x8aee('0x17'));var db=require(_0x8aee('0x18'))['db'];config[_0x8aee('0x19')]=_[_0x8aee('0x1a')](config[_0x8aee('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x8aee('0x1b'))(new Redis(config[_0x8aee('0x19')]));require(_0x8aee('0x1c'))[_0x8aee('0x1d')](socket);function respondWithStatusCode(_0x80cedf,_0x47389e){_0x47389e=_0x47389e||0xcc;return function(_0x27ae2c){if(_0x27ae2c){return _0x80cedf['sendStatus'](_0x47389e);}return _0x80cedf[_0x8aee('0x1e')](_0x47389e)[_0x8aee('0x1f')]();};}function respondWithResult(_0x5c9f4e,_0x497b29){_0x497b29=_0x497b29||0xc8;return function(_0x750cb3){if(_0x750cb3){return _0x5c9f4e[_0x8aee('0x1e')](_0x497b29)[_0x8aee('0x20')](_0x750cb3);}};}function respondWithFilteredResult(_0x1b3c89,_0x4961a3){return function(_0x501f3e){if(_0x501f3e){var _0x34e03a=typeof _0x4961a3['offset']==='undefined'&&typeof _0x4961a3[_0x8aee('0x21')]===_0x8aee('0x22');var _0x28dfdc=_0x501f3e[_0x8aee('0x23')];var _0x45b579=_0x34e03a?0x0:_0x4961a3['offset'];var _0x54587c=_0x34e03a?_0x501f3e['count']:_0x4961a3['offset']+_0x4961a3['limit'];var _0x1feeaa;if(_0x54587c>=_0x28dfdc){_0x54587c=_0x28dfdc;_0x1feeaa=0xc8;}else{_0x1feeaa=0xce;}_0x1b3c89[_0x8aee('0x1e')](_0x1feeaa);return _0x1b3c89[_0x8aee('0x24')](_0x8aee('0x25'),_0x45b579+'-'+_0x54587c+'/'+_0x28dfdc)['json'](_0x501f3e);}return null;};}function patchUpdates(_0x2a69aa){return function(_0x524dda){try{jsonpatch[_0x8aee('0x26')](_0x524dda,_0x2a69aa,!![]);}catch(_0x38a699){return BPromise[_0x8aee('0x27')](_0x38a699);}return _0x524dda['save']();};}function saveUpdates(_0x2c6e11,_0x2c2bf4){return function(_0x2011e9){if(_0x2011e9){return _0x2011e9[_0x8aee('0x28')](_0x2c6e11)[_0x8aee('0x29')](function(_0x270d28){return _0x270d28;});}return null;};}function removeEntity(_0x5f4156,_0x2e19de){return function(_0x494011){if(_0x494011){return _0x494011[_0x8aee('0x2a')]()[_0x8aee('0x29')](function(){var _0x31f683=_0x494011['get']({'plain':!![]});var _0x25b8c7='SquareProjects';return db[_0x8aee('0x2b')][_0x8aee('0x2a')]({'where':{'type':_0x25b8c7,'resourceId':_0x31f683['id']}})[_0x8aee('0x29')](function(){return _0x494011;});})[_0x8aee('0x29')](function(){_0x5f4156['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d1b1c,_0x335112){return function(_0x22a696){if(!_0x22a696){_0x2d1b1c['sendStatus'](0x194);}return _0x22a696;};}function handleError(_0x5d7af,_0x243dca){_0x243dca=_0x243dca||0x1f4;return function(_0x4210ca){logger['error'](_0x4210ca[_0x8aee('0x2c')]);if(_0x4210ca['name']){delete _0x4210ca[_0x8aee('0x2d')];}_0x5d7af[_0x8aee('0x1e')](_0x243dca)[_0x8aee('0x2e')](_0x4210ca);};}exports['index']=function(_0x229e85,_0x52f984){var _0x4ccd43={},_0x31c22b={},_0x1d209d={'count':0x0,'rows':[]};var _0xb937ac=_[_0x8aee('0x2f')](db[_0x8aee('0x30')]['rawAttributes'],function(_0x44e6fa){return{'name':_0x44e6fa[_0x8aee('0x31')],'type':_0x44e6fa[_0x8aee('0x32')][_0x8aee('0x33')]};});_0x31c22b['model']=_[_0x8aee('0x2f')](_0xb937ac,'name');_0x31c22b['query']=_[_0x8aee('0x34')](_0x229e85[_0x8aee('0x35')]);_0x31c22b[_0x8aee('0x36')]=_['intersection'](_0x31c22b[_0x8aee('0x37')],_0x31c22b[_0x8aee('0x35')]);_0x4ccd43[_0x8aee('0x38')]=_[_0x8aee('0x39')](_0x31c22b['model'],qs[_0x8aee('0x3a')](_0x229e85[_0x8aee('0x35')][_0x8aee('0x3a')]));_0x4ccd43['attributes']=_0x4ccd43[_0x8aee('0x38')][_0x8aee('0x3b')]?_0x4ccd43['attributes']:_0x31c22b[_0x8aee('0x37')];if(!_0x229e85[_0x8aee('0x35')][_0x8aee('0x3c')](_0x8aee('0x3d'))){_0x4ccd43[_0x8aee('0x21')]=qs[_0x8aee('0x21')](_0x229e85[_0x8aee('0x35')][_0x8aee('0x21')]);_0x4ccd43[_0x8aee('0x3e')]=qs[_0x8aee('0x3e')](_0x229e85['query'][_0x8aee('0x3e')]);}_0x4ccd43[_0x8aee('0x3f')]=qs[_0x8aee('0x40')](_0x229e85['query'][_0x8aee('0x40')]);_0x4ccd43['where']=qs['filters'](_[_0x8aee('0x41')](_0x229e85[_0x8aee('0x35')],_0x31c22b[_0x8aee('0x36')]),_0xb937ac);if(_0x229e85[_0x8aee('0x35')][_0x8aee('0x42')]){_0x4ccd43[_0x8aee('0x43')]=_[_0x8aee('0x44')](_0x4ccd43[_0x8aee('0x43')],{'$or':_[_0x8aee('0x2f')](_0xb937ac,function(_0x23acfd){if(_0x23acfd['type']!==_0x8aee('0x45')){var _0x1b414c={};_0x1b414c[_0x23acfd[_0x8aee('0x2d')]]={'$like':'%'+_0x229e85[_0x8aee('0x35')][_0x8aee('0x42')]+'%'};return _0x1b414c;}})});}_0x4ccd43=_['merge']({},_0x4ccd43,_0x229e85[_0x8aee('0x46')]);var _0x13ff18={'where':_0x4ccd43[_0x8aee('0x43')]};return db[_0x8aee('0x30')]['count'](_0x13ff18)[_0x8aee('0x29')](function(_0x303197){_0x1d209d[_0x8aee('0x23')]=_0x303197;if(_0x229e85[_0x8aee('0x35')][_0x8aee('0x47')]){_0x4ccd43[_0x8aee('0x48')]=[{'all':!![]}];}return db['SquareProject'][_0x8aee('0x49')](_0x4ccd43);})[_0x8aee('0x29')](function(_0x2ddd4a){_0x1d209d[_0x8aee('0x4a')]=_0x2ddd4a;return _0x1d209d;})['then'](respondWithFilteredResult(_0x52f984,_0x4ccd43))[_0x8aee('0x4b')](handleError(_0x52f984,null));};exports[_0x8aee('0x4c')]=function(_0x19866d,_0x3f3598){var _0x3f5598={'raw':![],'where':{'id':_0x19866d[_0x8aee('0x4d')]['id']}},_0x416849={};_0x416849[_0x8aee('0x37')]=_[_0x8aee('0x34')](db[_0x8aee('0x30')][_0x8aee('0x4e')]);_0x416849[_0x8aee('0x35')]=_[_0x8aee('0x34')](_0x19866d[_0x8aee('0x35')]);_0x416849[_0x8aee('0x36')]=_['intersection'](_0x416849[_0x8aee('0x37')],_0x416849['query']);_0x3f5598[_0x8aee('0x38')]=_['intersection'](_0x416849[_0x8aee('0x37')],qs[_0x8aee('0x3a')](_0x19866d[_0x8aee('0x35')][_0x8aee('0x3a')]));_0x3f5598['attributes']=_0x3f5598[_0x8aee('0x38')][_0x8aee('0x3b')]?_0x3f5598['attributes']:_0x416849[_0x8aee('0x37')];if(_0x19866d[_0x8aee('0x35')][_0x8aee('0x47')]){_0x3f5598['include']=[{'all':!![]}];}_0x3f5598=_[_0x8aee('0x44')]({},_0x3f5598,_0x19866d['options']);return db[_0x8aee('0x30')]['find'](_0x3f5598)['then'](handleEntityNotFound(_0x3f3598,null))[_0x8aee('0x29')](respondWithResult(_0x3f3598,null))[_0x8aee('0x4b')](handleError(_0x3f3598,null));};exports['create']=function(_0x359a87,_0x4a57fc){return db[_0x8aee('0x30')]['create'](_0x359a87[_0x8aee('0x4f')],{})['then'](function(_0x4784b2){var _0x1e587b=_0x359a87[_0x8aee('0x50')]['get']({'plain':!![]});if(!_0x1e587b)throw new Error(_0x8aee('0x51'));if(_0x1e587b['role']===_0x8aee('0x50')){var _0x226c13=_0x4784b2[_0x8aee('0x52')]({'plain':!![]});var _0x24c710=_0x8aee('0x53');return db['UserProfileSection'][_0x8aee('0x54')]({'where':{'name':_0x24c710,'userProfileId':_0x1e587b[_0x8aee('0x55')]},'raw':!![]})['then'](function(_0x108ad8){if(_0x108ad8&&_0x108ad8[_0x8aee('0x56')]===0x0){return db[_0x8aee('0x2b')]['create']({'name':_0x226c13['name'],'resourceId':_0x226c13['id'],'type':_0x108ad8['name'],'sectionId':_0x108ad8['id']},{})[_0x8aee('0x29')](function(){return _0x4784b2;});}else{return _0x4784b2;}})[_0x8aee('0x4b')](function(_0x56cdf1){logger[_0x8aee('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56cdf1);throw _0x56cdf1;});}return _0x4784b2;})[_0x8aee('0x29')](respondWithResult(_0x4a57fc,0xc9))[_0x8aee('0x4b')](handleError(_0x4a57fc,null));};exports[_0x8aee('0x28')]=function(_0x5211d5,_0x1d6c46){if(_0x5211d5[_0x8aee('0x4f')]['id']){delete _0x5211d5['body']['id'];}return db['SquareProject']['find']({'where':{'id':_0x5211d5['params']['id']}})[_0x8aee('0x29')](handleEntityNotFound(_0x1d6c46,null))[_0x8aee('0x29')](saveUpdates(_0x5211d5[_0x8aee('0x4f')],null))[_0x8aee('0x29')](respondWithResult(_0x1d6c46,null))['catch'](handleError(_0x1d6c46,null));};exports[_0x8aee('0x2a')]=function(_0x595d4a,_0x5d1c71){return db[_0x8aee('0x30')][_0x8aee('0x54')]({'where':{'id':_0x595d4a['params']['id']}})[_0x8aee('0x29')](handleEntityNotFound(_0x5d1c71,null))[_0x8aee('0x29')](removeEntity(_0x5d1c71,null))[_0x8aee('0x4b')](handleError(_0x5d1c71,null));};exports[_0x8aee('0x58')]=function(_0x15dd3d,_0x8ba25b,_0x259dfa){return db['SquareProject'][_0x8aee('0x54')]({'where':{'id':_0x15dd3d[_0x8aee('0x4d')]['id']}})['then'](handleEntityNotFound(_0x8ba25b,null))[_0x8aee('0x29')](function(_0x56c41e){if(_0x56c41e){return _0x56c41e[_0x8aee('0x58')](_0x15dd3d[_0x8aee('0x4f')][_0x8aee('0x59')],_['omit'](_0x15dd3d['body'],['ids','id'])||{});}})[_0x8aee('0x29')](respondWithResult(_0x8ba25b,null))[_0x8aee('0x4b')](handleError(_0x8ba25b,null));};exports['removeUsers']=function(_0x42bae1,_0x327028,_0x151f64){return db[_0x8aee('0x30')][_0x8aee('0x54')]({'where':{'id':_0x42bae1[_0x8aee('0x4d')]['id']}})['then'](handleEntityNotFound(_0x327028,null))['then'](function(_0x128b1a){if(_0x128b1a){return _0x128b1a[_0x8aee('0x5a')](_0x42bae1['query'][_0x8aee('0x59')])[_0x8aee('0x29')](function(){if(_[_0x8aee('0x5b')](_0x42bae1[_0x8aee('0x35')][_0x8aee('0x59')])){for(var _0x41b141=0x0;_0x41b141<_0x42bae1[_0x8aee('0x35')][_0x8aee('0x59')][_0x8aee('0x3b')];_0x41b141+=0x1){socket[_0x8aee('0x5c')](_0x8aee('0x5d'),{'UserId':Number(_0x42bae1[_0x8aee('0x35')][_0x8aee('0x59')][_0x41b141]),'SquareProjectId':Number(_0x42bae1[_0x8aee('0x4d')]['id'])});}}else{socket[_0x8aee('0x5c')]('userSquareProject:remove',{'UserId':Number(_0x42bae1['query'][_0x8aee('0x59')]),'SquareProjectId':Number(_0x42bae1[_0x8aee('0x4d')]['id'])});}});}})[_0x8aee('0x29')](respondWithStatusCode(_0x327028,null))[_0x8aee('0x4b')](handleError(_0x327028,null));};exports['getUsers']=function(_0x42a70c,_0x132390,_0xa784e6){var _0x505186={};var _0x5daa3e={};var _0x43eb45;var _0x8ed9cc;return db[_0x8aee('0x30')][_0x8aee('0x5e')]({'where':{'id':_0x42a70c['params']['id']}})[_0x8aee('0x29')](handleEntityNotFound(_0x132390,null))['then'](function(_0x46ca34){if(_0x46ca34){_0x43eb45=_0x46ca34;_0x5daa3e['model']=_[_0x8aee('0x34')](db[_0x8aee('0x5f')][_0x8aee('0x4e')]);_0x5daa3e['query']=_[_0x8aee('0x34')](_0x42a70c[_0x8aee('0x35')]);_0x5daa3e['filters']=_[_0x8aee('0x39')](_0x5daa3e['model'],_0x5daa3e[_0x8aee('0x35')]);_0x505186[_0x8aee('0x38')]=_[_0x8aee('0x39')](_0x5daa3e[_0x8aee('0x37')],qs[_0x8aee('0x3a')](_0x42a70c[_0x8aee('0x35')]['fields']));_0x505186[_0x8aee('0x38')]=_0x505186[_0x8aee('0x38')][_0x8aee('0x3b')]?_0x505186[_0x8aee('0x38')]:_0x5daa3e[_0x8aee('0x37')];_0x505186[_0x8aee('0x3f')]=qs[_0x8aee('0x40')](_0x42a70c[_0x8aee('0x35')]['sort']);_0x505186[_0x8aee('0x43')]=qs[_0x8aee('0x36')](_['pick'](_0x42a70c[_0x8aee('0x35')],_0x5daa3e[_0x8aee('0x36')]));if(_0x42a70c[_0x8aee('0x35')][_0x8aee('0x42')]){_0x505186[_0x8aee('0x43')]=_[_0x8aee('0x44')](_0x505186[_0x8aee('0x43')],{'$or':_[_0x8aee('0x2f')](_0x505186[_0x8aee('0x38')],function(_0x1899e4){var _0x2cff4f={};_0x2cff4f[_0x1899e4]={'$like':'%'+_0x42a70c[_0x8aee('0x35')][_0x8aee('0x42')]+'%'};return _0x2cff4f;})});}_0x505186=_[_0x8aee('0x44')]({},_0x505186,_0x42a70c[_0x8aee('0x46')]);return _0x43eb45['getUsers'](_0x505186);}})[_0x8aee('0x29')](function(_0x4cd5a0){if(_0x4cd5a0){_0x8ed9cc=_0x4cd5a0[_0x8aee('0x3b')];if(!_0x42a70c[_0x8aee('0x35')][_0x8aee('0x3c')](_0x8aee('0x3d'))){_0x505186['limit']=qs[_0x8aee('0x21')](_0x42a70c[_0x8aee('0x35')][_0x8aee('0x21')]);_0x505186[_0x8aee('0x3e')]=qs[_0x8aee('0x3e')](_0x42a70c[_0x8aee('0x35')][_0x8aee('0x3e')]);}return _0x43eb45['getUsers'](_0x505186);}})['then'](function(_0xc98270){if(_0xc98270){return _0xc98270?{'count':_0x8ed9cc,'rows':_0xc98270}:null;}})[_0x8aee('0x29')](respondWithResult(_0x132390,null))[_0x8aee('0x4b')](handleError(_0x132390,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index d60c79d..a2ad27d 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 _0x61a1=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','save','remove'];(function(_0x16e345,_0x2ffa7d){var _0x28c20c=function(_0x8d0d03){while(--_0x8d0d03){_0x16e345['push'](_0x16e345['shift']());}};_0x28c20c(++_0x2ffa7d);}(_0x61a1,0x1ab));var _0x161a=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0x61a1[_0x29e35f];return _0x266b74;};'use strict';var EventEmitter=require(_0x161a('0x0'));var SquareProject=require(_0x161a('0x1'))['db'][_0x161a('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x161a('0x3'),'afterUpdate':'update','afterDestroy':_0x161a('0x4')};function emitEvent(_0x411237){return function(_0x578209,_0x527f0c,_0x469db0){SquareProjectEvents['emit'](_0x411237+':'+_0x578209['id'],_0x578209);SquareProjectEvents[_0x161a('0x5')](_0x411237,_0x578209);_0x469db0(null);};}for(var e in events){if(events[_0x161a('0x6')](e)){var event=events[e];SquareProject[_0x161a('0x7')](e,emitEvent(event));}}module[_0x161a('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x19b9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','save','update','remove'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x19b9,0xea));var _0x919b=function(_0x40b9ed,_0x17c3ed){_0x40b9ed=_0x40b9ed-0x0;var _0x4e8424=_0x19b9[_0x40b9ed];return _0x4e8424;};'use strict';var EventEmitter=require(_0x919b('0x0'));var SquareProject=require(_0x919b('0x1'))['db'][_0x919b('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x919b('0x3'),'afterUpdate':_0x919b('0x4'),'afterDestroy':_0x919b('0x5')};function emitEvent(_0x4fbabd){return function(_0x4038e6,_0x776f44,_0x1a6be5){SquareProjectEvents[_0x919b('0x6')](_0x4fbabd+':'+_0x4038e6['id'],_0x4038e6);SquareProjectEvents[_0x919b('0x6')](_0x4fbabd,_0x4038e6);_0x1a6be5(null);};}for(var e in events){if(events[_0x919b('0x7')](e)){var event=events[e];SquareProject[_0x919b('0x8')](e,emitEvent(event));}}module[_0x919b('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b9e958c..f190a9f 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 _0x255f=['api','moment','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','changed','preproduction','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x1acf64,_0x2b4be8){var _0x28d5f8=function(_0x1d98fe){while(--_0x1d98fe){_0x1acf64['push'](_0x1acf64['shift']());}};_0x28d5f8(++_0x2b4be8);}(_0x255f,0x185));var _0xf255=function(_0x257c00,_0x4c1f3f){_0x257c00=_0x257c00-0x0;var _0x124bc6=_0x255f[_0x257c00];return _0x124bc6;};'use strict';var _=require(_0xf255('0x0'));var util=require('util');var logger=require(_0xf255('0x1'))(_0xf255('0x2'));var moment=require(_0xf255('0x3'));var BPromise=require('bluebird');var rp=require(_0xf255('0x4'));var fs=require('fs');var path=require(_0xf255('0x5'));var rimraf=require(_0xf255('0x6'));var config=require(_0xf255('0x7'));var attributes=require(_0xf255('0x8'));module[_0xf255('0x9')]=function(_0xc1d19f,_0x5bbed0){return _0xc1d19f[_0xf255('0xa')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4a533f,_0x3cc3fc,_0x4f0b20){if(_0x4a533f[_0xf255('0xb')](_0xf255('0xc'))){_0x4a533f['savedAt']=moment()[_0xf255('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4a533f[_0xf255('0xb')](_0xf255('0xe'))){_0x4a533f[_0xf255('0xf')]=moment()[_0xf255('0xd')](_0xf255('0x10'));}_0x4f0b20(null,_0x4a533f);}}});}; \ No newline at end of file +var _0x8832=['savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','moment','bluebird','request-promise','rimraf','./squareProject.attributes','exports','define','square_projects','changed','preproduction'];(function(_0x2e771f,_0x5f28a5){var _0x1f2302=function(_0x5125a3){while(--_0x5125a3){_0x2e771f['push'](_0x2e771f['shift']());}};_0x1f2302(++_0x5f28a5);}(_0x8832,0x1f4));var _0x2883=function(_0x33b5be,_0xd913b){_0x33b5be=_0x33b5be-0x0;var _0x13c01c=_0x8832[_0x33b5be];return _0x13c01c;};'use strict';var _=require(_0x2883('0x0'));var util=require(_0x2883('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2883('0x2'));var BPromise=require(_0x2883('0x3'));var rp=require(_0x2883('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2883('0x5'));var config=require('../../config/environment');var attributes=require(_0x2883('0x6'));module[_0x2883('0x7')]=function(_0x278026,_0x556903){return _0x278026[_0x2883('0x8')]('SquareProject',attributes,{'tableName':_0x2883('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ddf10,_0x4f6237,_0x519679){if(_0x3ddf10[_0x2883('0xa')](_0x2883('0xb'))){_0x3ddf10[_0x2883('0xc')]=moment()[_0x2883('0xd')](_0x2883('0xe'));}if(_0x3ddf10['changed']('production')){_0x3ddf10[_0x2883('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x519679(null,_0x3ddf10);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 3c3eb20..74e3e52 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 _0xab99=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','then','request\x20sent','debug','stringify','error','code','SquareProject,\x20%s,\x20%s','message','info','result','catch','SquareProject','find','options','raw','where','attributes','include','map','model','ShowSquareProject','lodash'];(function(_0x494986,_0x9f6e60){var _0x108342=function(_0x28f6cc){while(--_0x28f6cc){_0x494986['push'](_0x494986['shift']());}};_0x108342(++_0x9f6e60);}(_0xab99,0x17b));var _0x9ab9=function(_0x17cf8c,_0xa4bf94){_0x17cf8c=_0x17cf8c-0x0;var _0x1f68e3=_0xab99[_0x17cf8c];return _0x1f68e3;};'use strict';var _=require(_0x9ab9('0x0'));var util=require(_0x9ab9('0x1'));var moment=require(_0x9ab9('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ab9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ab9('0x4'))['db'];var utils=require(_0x9ab9('0x5'));var logger=require(_0x9ab9('0x6'))('rpc');var config=require(_0x9ab9('0x7'));var jayson=require(_0x9ab9('0x8'));var client=jayson[_0x9ab9('0x9')][_0x9ab9('0xa')]({'port':0x232a});config[_0x9ab9('0xb')]=_['defaults'](config[_0x9ab9('0xb')],{'host':_0x9ab9('0xc'),'port':0x18eb});var socket=require(_0x9ab9('0xd'))(new Redis(config[_0x9ab9('0xb')]));require(_0x9ab9('0xe'))[_0x9ab9('0xf')](socket);function respondWithRpcPromise(_0x4e4b6b,_0x1b2e78,_0x226087){return new BPromise(function(_0x1fc5ba,_0x25e2da){return client[_0x9ab9('0x10')](_0x4e4b6b,_0x226087)[_0x9ab9('0x11')](function(_0x463592){logger['info']('SquareProject,\x20%s,\x20%s',_0x1b2e78,_0x9ab9('0x12'));logger[_0x9ab9('0x13')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x1b2e78,_0x9ab9('0x12'),JSON[_0x9ab9('0x14')](_0x463592));if(_0x463592[_0x9ab9('0x15')]){if(_0x463592[_0x9ab9('0x15')][_0x9ab9('0x16')]===0x1f4){logger[_0x9ab9('0x15')](_0x9ab9('0x17'),_0x1b2e78,_0x463592[_0x9ab9('0x15')][_0x9ab9('0x18')]);return _0x25e2da(_0x463592[_0x9ab9('0x15')][_0x9ab9('0x18')]);}logger['error'](_0x9ab9('0x17'),_0x1b2e78,_0x463592[_0x9ab9('0x15')][_0x9ab9('0x18')]);return _0x1fc5ba(_0x463592['error']['message']);}else{logger[_0x9ab9('0x19')](_0x9ab9('0x17'),_0x1b2e78,_0x9ab9('0x12'));_0x1fc5ba(_0x463592[_0x9ab9('0x1a')][_0x9ab9('0x18')]);}})[_0x9ab9('0x1b')](function(_0x53c5b2){logger[_0x9ab9('0x15')](_0x9ab9('0x17'),_0x1b2e78,_0x53c5b2);_0x25e2da(_0x53c5b2);});});}exports['ShowSquareProject']=function(_0x1bbb98){var _0x85a2a7=this;return new Promise(function(_0x5d6e19,_0x406c1c){return db[_0x9ab9('0x1c')][_0x9ab9('0x1d')]({'raw':_0x1bbb98[_0x9ab9('0x1e')]?_0x1bbb98[_0x9ab9('0x1e')][_0x9ab9('0x1f')]===undefined?!![]:![]:!![],'where':_0x1bbb98[_0x9ab9('0x1e')]?_0x1bbb98[_0x9ab9('0x1e')][_0x9ab9('0x20')]||null:null,'attributes':_0x1bbb98[_0x9ab9('0x1e')]?_0x1bbb98[_0x9ab9('0x1e')][_0x9ab9('0x21')]||null:null,'include':_0x1bbb98[_0x9ab9('0x1e')]?_0x1bbb98[_0x9ab9('0x1e')][_0x9ab9('0x22')]?_[_0x9ab9('0x23')](_0x1bbb98['options'][_0x9ab9('0x22')],function(_0x278696){return{'model':db[_0x278696['model']],'as':_0x278696['as'],'attributes':_0x278696[_0x9ab9('0x21')],'include':_0x278696['include']?_['map'](_0x278696[_0x9ab9('0x22')],function(_0x456f9d){return{'model':db[_0x456f9d[_0x9ab9('0x24')]],'as':_0x456f9d['as'],'attributes':_0x456f9d['attributes'],'include':_0x456f9d[_0x9ab9('0x22')]?_[_0x9ab9('0x23')](_0x456f9d[_0x9ab9('0x22')],function(_0x45bb20){return{'model':db[_0x45bb20['model']],'as':_0x45bb20['as'],'attributes':_0x45bb20[_0x9ab9('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x212e2d){logger[_0x9ab9('0x19')]('ShowSquareProject',_0x1bbb98);logger[_0x9ab9('0x13')](_0x9ab9('0x25'),_0x1bbb98,JSON[_0x9ab9('0x14')](_0x212e2d));_0x5d6e19(_0x212e2d);})[_0x9ab9('0x1b')](function(_0x3b89a4){logger[_0x9ab9('0x15')](_0x9ab9('0x25'),_0x3b89a4[_0x9ab9('0x18')],_0x1bbb98);_0x406c1c(_0x85a2a7['error'](0x1f4,_0x3b89a4[_0x9ab9('0x18')]));});});}; \ No newline at end of file +var _0x0fdb=['ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./squareProject.socket','register','request','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0fdb,0xf5));var _0xb0fd=function(_0x931b59,_0x455da1){_0x931b59=_0x931b59-0x0;var _0x49d207=_0x0fdb[_0x931b59];return _0x49d207;};'use strict';var _=require('lodash');var util=require(_0xb0fd('0x0'));var moment=require(_0xb0fd('0x1'));var BPromise=require(_0xb0fd('0x2'));var rs=require(_0xb0fd('0x3'));var fs=require('fs');var Redis=require(_0xb0fd('0x4'));var db=require(_0xb0fd('0x5'))['db'];var utils=require(_0xb0fd('0x6'));var logger=require(_0xb0fd('0x7'))(_0xb0fd('0x8'));var config=require(_0xb0fd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb0fd('0xa')][_0xb0fd('0xb')]({'port':0x232a});config[_0xb0fd('0xc')]=_[_0xb0fd('0xd')](config[_0xb0fd('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb0fd('0xc')]));require(_0xb0fd('0xe'))[_0xb0fd('0xf')](socket);function respondWithRpcPromise(_0x159327,_0x1af4a3,_0x3d6717){return new BPromise(function(_0x3e6e3f,_0x2794d6){return client[_0xb0fd('0x10')](_0x159327,_0x3d6717)['then'](function(_0xa1696c){logger[_0xb0fd('0x11')](_0xb0fd('0x12'),_0x1af4a3,'request\x20sent');logger[_0xb0fd('0x13')](_0xb0fd('0x14'),_0x1af4a3,'request\x20sent',JSON[_0xb0fd('0x15')](_0xa1696c));if(_0xa1696c[_0xb0fd('0x16')]){if(_0xa1696c[_0xb0fd('0x16')][_0xb0fd('0x17')]===0x1f4){logger[_0xb0fd('0x16')](_0xb0fd('0x12'),_0x1af4a3,_0xa1696c['error']['message']);return _0x2794d6(_0xa1696c[_0xb0fd('0x16')][_0xb0fd('0x18')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x1af4a3,_0xa1696c[_0xb0fd('0x16')][_0xb0fd('0x18')]);return _0x3e6e3f(_0xa1696c['error']['message']);}else{logger[_0xb0fd('0x11')](_0xb0fd('0x12'),_0x1af4a3,_0xb0fd('0x19'));_0x3e6e3f(_0xa1696c[_0xb0fd('0x1a')][_0xb0fd('0x18')]);}})[_0xb0fd('0x1b')](function(_0x4cbffb){logger[_0xb0fd('0x16')](_0xb0fd('0x12'),_0x1af4a3,_0x4cbffb);_0x2794d6(_0x4cbffb);});});}exports[_0xb0fd('0x1c')]=function(_0x2b7629){var _0x125b81=this;return new Promise(function(_0x1c08ed,_0xf4e7d0){return db[_0xb0fd('0x1d')][_0xb0fd('0x1e')]({'raw':_0x2b7629['options']?_0x2b7629[_0xb0fd('0x1f')][_0xb0fd('0x20')]===undefined?!![]:![]:!![],'where':_0x2b7629[_0xb0fd('0x1f')]?_0x2b7629[_0xb0fd('0x1f')][_0xb0fd('0x21')]||null:null,'attributes':_0x2b7629['options']?_0x2b7629['options'][_0xb0fd('0x22')]||null:null,'include':_0x2b7629[_0xb0fd('0x1f')]?_0x2b7629['options'][_0xb0fd('0x23')]?_[_0xb0fd('0x24')](_0x2b7629[_0xb0fd('0x1f')][_0xb0fd('0x23')],function(_0x38a711){return{'model':db[_0x38a711[_0xb0fd('0x25')]],'as':_0x38a711['as'],'attributes':_0x38a711[_0xb0fd('0x22')],'include':_0x38a711[_0xb0fd('0x23')]?_[_0xb0fd('0x24')](_0x38a711[_0xb0fd('0x23')],function(_0x2bd680){return{'model':db[_0x2bd680[_0xb0fd('0x25')]],'as':_0x2bd680['as'],'attributes':_0x2bd680['attributes'],'include':_0x2bd680['include']?_[_0xb0fd('0x24')](_0x2bd680[_0xb0fd('0x23')],function(_0xcbb80d){return{'model':db[_0xcbb80d['model']],'as':_0xcbb80d['as'],'attributes':_0xcbb80d[_0xb0fd('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb0fd('0x26')](function(_0x466b5b){logger[_0xb0fd('0x11')]('ShowSquareProject',_0x2b7629);logger[_0xb0fd('0x13')](_0xb0fd('0x1c'),_0x2b7629,JSON[_0xb0fd('0x15')](_0x466b5b));_0x1c08ed(_0x466b5b);})[_0xb0fd('0x1b')](function(_0x5cf7fc){logger[_0xb0fd('0x16')](_0xb0fd('0x1c'),_0x5cf7fc['message'],_0x2b7629);_0xf4e7d0(_0x125b81[_0xb0fd('0x16')](0x1f4,_0x5cf7fc[_0xb0fd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index b576435..4a36ae9 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 _0x33af=['emit','removeListener','register','length','squareProject:','save','update'];(function(_0x25d3d7,_0x8d72ff){var _0x15d562=function(_0x10683a){while(--_0x10683a){_0x25d3d7['push'](_0x25d3d7['shift']());}};_0x15d562(++_0x8d72ff);}(_0x33af,0xec));var _0xf33a=function(_0x558472,_0x27ffcf){_0x558472=_0x558472-0x0;var _0x37e917=_0x33af[_0x558472];return _0x37e917;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xf33a('0x0'),'remove',_0xf33a('0x1')];function createListener(_0x1111c6,_0x267057){return function(_0x4303f1){_0x267057[_0xf33a('0x2')](_0x1111c6,_0x4303f1);};}function removeListener(_0x25f156,_0x4c734e){return function(){SquareProjectEvents[_0xf33a('0x3')](_0x25f156,_0x4c734e);};}exports[_0xf33a('0x4')]=function(_0x583e54){for(var _0xc0dd13=0x0,_0x384b14=events[_0xf33a('0x5')];_0xc0dd13<_0x384b14;_0xc0dd13++){var _0x2f3730=events[_0xc0dd13];var _0x2baabb=createListener(_0xf33a('0x6')+_0x2f3730,_0x583e54);SquareProjectEvents['on'](_0x2f3730,_0x2baabb);}}; \ No newline at end of file +var _0x4137=['emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove','update'];(function(_0x10df1e,_0xf56f85){var _0x3e24fb=function(_0x5cdb59){while(--_0x5cdb59){_0x10df1e['push'](_0x10df1e['shift']());}};_0x3e24fb(++_0xf56f85);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var SquareProjectEvents=require(_0x7413('0x0'));var events=[_0x7413('0x1'),_0x7413('0x2'),_0x7413('0x3')];function createListener(_0x392ebc,_0x410971){return function(_0x2e6df7){_0x410971[_0x7413('0x4')](_0x392ebc,_0x2e6df7);};}function removeListener(_0x258255,_0x3dc48a){return function(){SquareProjectEvents[_0x7413('0x5')](_0x258255,_0x3dc48a);};}exports[_0x7413('0x6')]=function(_0x4fbade){for(var _0xc808cd=0x0,_0x188d89=events[_0x7413('0x7')];_0xc808cd<_0x188d89;_0xc808cd++){var _0x15af0d=events[_0xc808cd];var _0x5f4cd0=createListener(_0x7413('0x8')+_0x15af0d,_0x4fbade);SquareProjectEvents['on'](_0x15af0d,_0x5f4cd0);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 2737e8d..7970fd0 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 _0xcd7f=['post','create','put','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated','index','get','/:id','/:id/download','download'];(function(_0x24697b,_0x2eb072){var _0x585b99=function(_0x261980){while(--_0x261980){_0x24697b['push'](_0x24697b['shift']());}};_0x585b99(++_0x2eb072);}(_0xcd7f,0x16e));var _0xfcd7=function(_0x414d9f,_0x11b943){_0x414d9f=_0x414d9f-0x0;var _0xa4f0de=_0xcd7f[_0x414d9f];return _0xa4f0de;};'use strict';var multer=require(_0xfcd7('0x0'));var util=require(_0xfcd7('0x1'));var path=require(_0xfcd7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfcd7('0x3'));var auth=require(_0xfcd7('0x4'));var interaction=require(_0xfcd7('0x5'));var config=require(_0xfcd7('0x6'));var controller=require(_0xfcd7('0x7'));router['get']('/',auth[_0xfcd7('0x8')](),controller[_0xfcd7('0x9')]);router[_0xfcd7('0xa')](_0xfcd7('0xb'),auth[_0xfcd7('0x8')](),controller['show']);router['get'](_0xfcd7('0xc'),auth[_0xfcd7('0x8')](),controller[_0xfcd7('0xd')]);router[_0xfcd7('0xe')]('/',auth[_0xfcd7('0x8')](),controller[_0xfcd7('0xf')]);router[_0xfcd7('0x10')](_0xfcd7('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xfcd7('0x11')](_0xfcd7('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xfcd7('0x12')]=router; \ No newline at end of file +var _0x9582=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','put','update','delete'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x9582,0x95));var _0x2958=function(_0x3c027f,_0x48d7ce){_0x3c027f=_0x3c027f-0x0;var _0x318439=_0x9582[_0x3c027f];return _0x318439;};'use strict';var multer=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var path=require(_0x2958('0x2'));var timeout=require(_0x2958('0x3'));var express=require(_0x2958('0x4'));var router=express[_0x2958('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2958('0x6'));var interaction=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var controller=require(_0x2958('0x9'));router[_0x2958('0xa')]('/',auth[_0x2958('0xb')](),controller[_0x2958('0xc')]);router[_0x2958('0xa')](_0x2958('0xd'),auth[_0x2958('0xb')](),controller['show']);router['get'](_0x2958('0xe'),auth['isAuthenticated'](),controller[_0x2958('0xf')]);router['post']('/',auth[_0x2958('0xb')](),controller['create']);router[_0x2958('0x10')](_0x2958('0xd'),auth[_0x2958('0xb')](),controller[_0x2958('0x11')]);router[_0x2958('0x12')]('/:id',auth[_0x2958('0xb')](),controller[_0x2958('0x13')]);module[_0x2958('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 236320f..d8202b0 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 _0xab64=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x505234,_0x26d0d6){var _0x51ed53=function(_0x1cf8d0){while(--_0x1cf8d0){_0x505234['push'](_0x505234['shift']());}};_0x51ed53(++_0x26d0d6);}(_0xab64,0xa0));var _0x4ab6=function(_0x4aa253,_0xcfb870){_0x4aa253=_0x4aa253-0x0;var _0x2a179d=_0xab64[_0x4aa253];return _0x2a179d;};'use strict';var Sequelize=require(_0x4ab6('0x0'));module[_0x4ab6('0x1')]={'uniqueid':{'type':Sequelize[_0x4ab6('0x2')]},'callerid':{'type':Sequelize[_0x4ab6('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4ab6('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4ab6('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x4ab6('0x2')]},'projectName':{'type':Sequelize[_0x4ab6('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x4ab6('0x2')]},'savePath':{'type':Sequelize[_0x4ab6('0x2')]},'format':{'type':Sequelize[_0x4ab6('0x3')],'get':function(){var _0x4e57c2='';var _0x270961=this[_0x4ab6('0x4')](_0x4ab6('0x5'));if(_0x270961){_0x4e57c2=_0x270961[_0x4ab6('0x6')](_0x270961[_0x4ab6('0x7')]('.'));}return _0x4e57c2;}}}; \ No newline at end of file +var _0x847d=['substring','lastIndexOf','exports','STRING','VIRTUAL','savePath'];(function(_0x2293af,_0xbbd799){var _0x3456a2=function(_0x531ae6){while(--_0x531ae6){_0x2293af['push'](_0x2293af['shift']());}};_0x3456a2(++_0xbbd799);}(_0x847d,0xf8));var _0xd847=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0x847d[_0x5f46e7];return _0x567e95;};'use strict';var Sequelize=require('sequelize');module[_0xd847('0x0')]={'uniqueid':{'type':Sequelize[_0xd847('0x1')]},'callerid':{'type':Sequelize[_0xd847('0x1')]},'calleridname':{'type':Sequelize[_0xd847('0x1')]},'context':{'type':Sequelize[_0xd847('0x1')]},'extension':{'type':Sequelize[_0xd847('0x1')]},'priority':{'type':Sequelize[_0xd847('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xd847('0x1')]},'projectName':{'type':Sequelize[_0xd847('0x1')]},'saveName':{'type':Sequelize[_0xd847('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xd847('0x1')]},'format':{'type':Sequelize[_0xd847('0x2')],'get':function(){var _0x4a9556='';var _0xb65371=this['getDataValue'](_0xd847('0x3'));if(_0xb65371){_0x4a9556=_0xb65371[_0xd847('0x4')](_0xb65371[_0xd847('0x5')]('.'));}return _0x4a9556;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 725ec10..e4a0d9f 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 _0x3349=['query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','message','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','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','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model'];(function(_0x3da6d1,_0x1de4d5){var _0x42cdca=function(_0xd931b8){while(--_0xd931b8){_0x3da6d1['push'](_0x3da6d1['shift']());}};_0x42cdca(++_0x1de4d5);}(_0x3349,0x149));var _0x9334=function(_0x46433a,_0x5ee08d){_0x46433a=_0x46433a-0x0;var _0x5204eb=_0x3349[_0x46433a];return _0x5204eb;};'use strict';var emlformat=require(_0x9334('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9334('0x1'));var jsonpatch=require(_0x9334('0x2'));var rp=require('request-promise');var moment=require(_0x9334('0x3'));var BPromise=require(_0x9334('0x4'));var Mustache=require(_0x9334('0x5'));var util=require(_0x9334('0x6'));var path=require(_0x9334('0x7'));var sox=require('sox');var csv=require(_0x9334('0x8'));var ejs=require(_0x9334('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9334('0xa'));var crypto=require(_0x9334('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9334('0xc'));var authService=require(_0x9334('0xd'));var qs=require(_0x9334('0xe'));var as=require(_0x9334('0xf'));var hardwareService=require(_0x9334('0x10'));var logger=require(_0x9334('0x11'))(_0x9334('0x12'));var utils=require(_0x9334('0x13'));var config=require(_0x9334('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9334('0x15'))['db'];function respondWithStatusCode(_0x2c2c12,_0x58ed38){_0x58ed38=_0x58ed38||0xcc;return function(_0x1421b7){if(_0x1421b7){return _0x2c2c12[_0x9334('0x16')](_0x58ed38);}return _0x2c2c12[_0x9334('0x17')](_0x58ed38)[_0x9334('0x18')]();};}function respondWithResult(_0x5a52a4,_0x138212){_0x138212=_0x138212||0xc8;return function(_0x5cab0d){if(_0x5cab0d){return _0x5a52a4[_0x9334('0x17')](_0x138212)[_0x9334('0x19')](_0x5cab0d);}};}function respondWithFilteredResult(_0x38636e,_0x477d38){return function(_0x22ab76){if(_0x22ab76){var _0x42ed54=typeof _0x477d38[_0x9334('0x1a')]==='undefined'&&typeof _0x477d38[_0x9334('0x1b')]==='undefined';var _0x781f5f=_0x22ab76['count'];var _0x5a9866=_0x42ed54?0x0:_0x477d38[_0x9334('0x1a')];var _0x434354=_0x42ed54?_0x22ab76[_0x9334('0x1c')]:_0x477d38[_0x9334('0x1a')]+_0x477d38[_0x9334('0x1b')];var _0x37126c;if(_0x434354>=_0x781f5f){_0x434354=_0x781f5f;_0x37126c=0xc8;}else{_0x37126c=0xce;}_0x38636e[_0x9334('0x17')](_0x37126c);return _0x38636e[_0x9334('0x1d')](_0x9334('0x1e'),_0x5a9866+'-'+_0x434354+'/'+_0x781f5f)[_0x9334('0x19')](_0x22ab76);}return null;};}function patchUpdates(_0x576a05){return function(_0x6445e7){try{jsonpatch['apply'](_0x6445e7,_0x576a05,!![]);}catch(_0x34e3de){return BPromise[_0x9334('0x1f')](_0x34e3de);}return _0x6445e7[_0x9334('0x20')]();};}function saveUpdates(_0x56a79a,_0x293138){return function(_0x556c25){if(_0x556c25){return _0x556c25[_0x9334('0x21')](_0x56a79a)[_0x9334('0x22')](function(_0x5d8f65){return _0x5d8f65;});}return null;};}function removeEntity(_0x46d1a6,_0x29b13d){return function(_0x4b6210){if(_0x4b6210){return _0x4b6210['destroy']()[_0x9334('0x22')](function(){_0x46d1a6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15b48a,_0xa90c93){return function(_0x55b349){if(!_0x55b349){_0x15b48a['sendStatus'](0x194);}return _0x55b349;};}function handleError(_0x213dad,_0x44c2c9){_0x44c2c9=_0x44c2c9||0x1f4;return function(_0x1f5718){logger[_0x9334('0x23')](_0x1f5718[_0x9334('0x24')]);if(_0x1f5718[_0x9334('0x25')]){delete _0x1f5718['name'];}_0x213dad[_0x9334('0x17')](_0x44c2c9)[_0x9334('0x26')](_0x1f5718);};}exports[_0x9334('0x27')]=function(_0x4e924a,_0x4c6d3b){var _0x3b6c44={},_0x7d854b={},_0xbb628f={'count':0x0,'rows':[]};var _0x4b2437=_[_0x9334('0x28')](db[_0x9334('0x29')][_0x9334('0x2a')],function(_0x5dfc31){return{'name':_0x5dfc31[_0x9334('0x2b')],'type':_0x5dfc31[_0x9334('0x2c')][_0x9334('0x2d')]};});_0x7d854b[_0x9334('0x2e')]=_['map'](_0x4b2437,_0x9334('0x25'));_0x7d854b[_0x9334('0x2f')]=_['keys'](_0x4e924a['query']);_0x7d854b[_0x9334('0x30')]=_['intersection'](_0x7d854b['model'],_0x7d854b[_0x9334('0x2f')]);_0x3b6c44[_0x9334('0x31')]=_['intersection'](_0x7d854b[_0x9334('0x2e')],qs['fields'](_0x4e924a['query'][_0x9334('0x32')]));_0x3b6c44[_0x9334('0x31')]=_0x3b6c44[_0x9334('0x31')][_0x9334('0x33')]?_0x3b6c44['attributes']:_0x7d854b[_0x9334('0x2e')];if(!_0x4e924a['query'][_0x9334('0x34')](_0x9334('0x35'))){_0x3b6c44[_0x9334('0x1b')]=qs[_0x9334('0x1b')](_0x4e924a[_0x9334('0x2f')][_0x9334('0x1b')]);_0x3b6c44[_0x9334('0x1a')]=qs['offset'](_0x4e924a[_0x9334('0x2f')]['offset']);}_0x3b6c44['order']=qs['sort'](_0x4e924a[_0x9334('0x2f')][_0x9334('0x36')]);_0x3b6c44['where']=qs[_0x9334('0x30')](_[_0x9334('0x37')](_0x4e924a['query'],_0x7d854b['filters']),_0x4b2437);if(_0x4e924a[_0x9334('0x2f')][_0x9334('0x38')]){_0x3b6c44['where']=_[_0x9334('0x39')](_0x3b6c44['where'],{'$or':_[_0x9334('0x28')](_0x4b2437,function(_0x5bb997){if(_0x5bb997[_0x9334('0x2c')]!==_0x9334('0x3a')){var _0x1e4e26={};_0x1e4e26[_0x5bb997['name']]={'$like':'%'+_0x4e924a[_0x9334('0x2f')][_0x9334('0x38')]+'%'};return _0x1e4e26;}})});}_0x3b6c44=_[_0x9334('0x39')]({},_0x3b6c44,_0x4e924a['options']);var _0x1849f3={'where':_0x3b6c44['where']};return db[_0x9334('0x29')][_0x9334('0x1c')](_0x1849f3)[_0x9334('0x22')](function(_0x73e173){_0xbb628f[_0x9334('0x1c')]=_0x73e173;if(_0x4e924a['query'][_0x9334('0x3b')]){_0x3b6c44[_0x9334('0x3c')]=[{'all':!![]}];}return db[_0x9334('0x29')][_0x9334('0x3d')](_0x3b6c44);})['then'](function(_0x429d29){_0xbb628f[_0x9334('0x3e')]=_0x429d29;return _0xbb628f;})[_0x9334('0x22')](respondWithFilteredResult(_0x4c6d3b,_0x3b6c44))['catch'](handleError(_0x4c6d3b,null));};exports[_0x9334('0x3f')]=function(_0x14b22c,_0x3ab1c8){var _0x30bdcd={'raw':!![],'where':{'id':_0x14b22c[_0x9334('0x40')]['id']}},_0x30d6c8={};_0x30d6c8[_0x9334('0x2e')]=_[_0x9334('0x41')](db['SquareRecording'][_0x9334('0x2a')]);_0x30d6c8[_0x9334('0x2f')]=_[_0x9334('0x41')](_0x14b22c[_0x9334('0x2f')]);_0x30d6c8[_0x9334('0x30')]=_['intersection'](_0x30d6c8['model'],_0x30d6c8[_0x9334('0x2f')]);_0x30bdcd[_0x9334('0x31')]=_['intersection'](_0x30d6c8['model'],qs[_0x9334('0x32')](_0x14b22c[_0x9334('0x2f')][_0x9334('0x32')]));_0x30bdcd[_0x9334('0x31')]=_0x30bdcd[_0x9334('0x31')]['length']?_0x30bdcd[_0x9334('0x31')]:_0x30d6c8[_0x9334('0x2e')];if(_0x14b22c[_0x9334('0x2f')][_0x9334('0x3b')]){_0x30bdcd[_0x9334('0x3c')]=[{'all':!![]}];}_0x30bdcd=_['merge']({},_0x30bdcd,_0x14b22c[_0x9334('0x42')]);return db[_0x9334('0x29')][_0x9334('0x43')](_0x30bdcd)[_0x9334('0x22')](handleEntityNotFound(_0x3ab1c8,null))[_0x9334('0x22')](respondWithResult(_0x3ab1c8,null))[_0x9334('0x44')](handleError(_0x3ab1c8,null));};exports[_0x9334('0x45')]=function(_0x2bcb56,_0x3e888c){return db['SquareRecording'][_0x9334('0x45')](_0x2bcb56[_0x9334('0x46')],{})['then'](respondWithResult(_0x3e888c,0xc9))[_0x9334('0x44')](handleError(_0x3e888c,null));};exports[_0x9334('0x21')]=function(_0x21054c,_0x3038ce){if(_0x21054c[_0x9334('0x46')]['id']){delete _0x21054c[_0x9334('0x46')]['id'];}return db[_0x9334('0x29')]['find']({'where':{'id':_0x21054c['params']['id']}})['then'](handleEntityNotFound(_0x3038ce,null))[_0x9334('0x22')](saveUpdates(_0x21054c[_0x9334('0x46')],null))[_0x9334('0x22')](respondWithResult(_0x3038ce,null))[_0x9334('0x44')](handleError(_0x3038ce,null));};exports[_0x9334('0x47')]=function(_0x52bfc0,_0x9acaf6,_0x2d0b8a){var _0x54c221=require(_0x9334('0x48'));var _0x1292bb=![];var _0x23b8f2={};if(_0x52bfc0['query']['type']&&_0x52bfc0['query']['type']===_0x9334('0x49')){_0x23b8f2[_0x9334('0x49')]=_0x52bfc0[_0x9334('0x40')]['id'];}else{_0x23b8f2['id']=_0x52bfc0[_0x9334('0x40')]['id'];}return db['SquareRecording'][_0x9334('0x43')]({'where':_0x23b8f2,'attributes':['id',_0x9334('0x4a'),_0x9334('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x9acaf6,null))['then'](function(_0x4e9df3){if(_0x4e9df3){var _0x187861=_0x4e9df3[_0x9334('0x4a')];var _0x263399=util[_0x9334('0x4c')]('%s.cypher',_0x187861);if(fs[_0x9334('0x4d')](_0x263399)){_0x1292bb=!![];return _0x54c221[_0x9334('0x4e')](_0x263399,_0x187861,config[_0x9334('0x4f')][_0x9334('0x50')])[_0x9334('0x22')](function(){return _0x4e9df3;});}return _0x4e9df3;}})[_0x9334('0x22')](function(_0x27e72b){if(_0x27e72b){var _0x312428=_0x27e72b[_0x9334('0x4a')];if(!fs['existsSync'](_0x312428)){throw new db[(_0x9334('0x51'))]['ValidationError'](_0x9334('0x52'));}if(_0x27e72b[_0x9334('0x4b')]){return _0x9acaf6['download'](_0x312428,_0x27e72b[_0x9334('0x4b')]+path[_0x9334('0x53')](_0x312428),function(){if(_0x1292bb){fs['unlink'](_0x312428);}});}else{return _0x9acaf6['download'](_0x312428,function(_0x31eea9){if(_0x1292bb){fs['unlink'](_0x312428);}});}}})[_0x9334('0x44')](function(_0x2fad76){if(_0x2fad76[_0x9334('0x54')]==='SquareRecording\x20not\x20found'){_0x9acaf6[_0x9334('0x17')](0x194)[_0x9334('0x26')](_0x9334('0x55'));}else{return handleError(_0x9acaf6,null);}});};exports['destroy']=function(_0x1c0e99,_0x6f3836){return db[_0x9334('0x29')][_0x9334('0x43')]({'where':{'id':_0x1c0e99['params']['id']}})['then'](function(_0xa708a){if(_['isNil'](_0xa708a)){throw new ReferenceError(_0x9334('0x56'));}return _0xa708a;})['then'](function(_0x498c13){var _0x598d72=_0x498c13[_0x9334('0x4a')];logger['info'](_0x9334('0x57'),_0x598d72);if(!_['isNil'](_0x498c13[_0x9334('0x4a')])&&fs[_0x9334('0x4d')](_0x598d72)){logger[_0x9334('0x58')](_0x9334('0x59')+_0x598d72+_0x9334('0x5a'));fs['unlinkSync'](_0x598d72);}_0x598d72=_0x598d72+_0x9334('0x5b');if(!_['isNil'](_0x498c13[_0x9334('0x4a')])&&fs[_0x9334('0x4d')](_0x598d72)){logger[_0x9334('0x58')](_0x9334('0x59')+_0x598d72+_0x9334('0x5a'));fs[_0x9334('0x5c')](_0x598d72);}return _0x498c13;})[_0x9334('0x22')](function(_0x154cd3){if(!_0x154cd3)throw new InternalError();return _0x154cd3[_0x9334('0x5d')]();})[_0x9334('0x22')](function(){_0x6f3836[_0x9334('0x17')](0xcc)[_0x9334('0x18')]();})['catch'](handleError(_0x6f3836,null));}; \ No newline at end of file +var _0xbdb5=['options','include','catch','show','params','keys','includeAll','find','create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','extname','unlink','message','send','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x5681c1,_0x324f4b){var _0x44f37b=function(_0x5114e0){while(--_0x5114e0){_0x5681c1['push'](_0x5681c1['shift']());}};_0x44f37b(++_0x324f4b);}(_0xbdb5,0x80));var _0x5bdb=function(_0xe05a2a,_0x430781){_0xe05a2a=_0xe05a2a-0x0;var _0x6c1b8e=_0xbdb5[_0xe05a2a];return _0x6c1b8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5bdb('0x0'));var zipdir=require(_0x5bdb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5bdb('0x2'));var BPromise=require(_0x5bdb('0x3'));var Mustache=require(_0x5bdb('0x4'));var util=require(_0x5bdb('0x5'));var path=require(_0x5bdb('0x6'));var sox=require(_0x5bdb('0x7'));var csv=require(_0x5bdb('0x8'));var ejs=require(_0x5bdb('0x9'));var fs=require('fs');var fs_extra=require(_0x5bdb('0xa'));var _=require(_0x5bdb('0xb'));var squel=require(_0x5bdb('0xc'));var crypto=require('crypto');var jsforce=require(_0x5bdb('0xd'));var deskjs=require(_0x5bdb('0xe'));var toCsv=require(_0x5bdb('0x8'));var querystring=require(_0x5bdb('0xf'));var Papa=require(_0x5bdb('0x10'));var Redis=require(_0x5bdb('0x11'));var authService=require(_0x5bdb('0x12'));var qs=require(_0x5bdb('0x13'));var as=require(_0x5bdb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bdb('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5bdb('0x16'));var licenseUtil=require(_0x5bdb('0x17'));var db=require(_0x5bdb('0x18'))['db'];function respondWithStatusCode(_0x41d4bd,_0x2194e5){_0x2194e5=_0x2194e5||0xcc;return function(_0xcccdaa){if(_0xcccdaa){return _0x41d4bd[_0x5bdb('0x19')](_0x2194e5);}return _0x41d4bd[_0x5bdb('0x1a')](_0x2194e5)['end']();};}function respondWithResult(_0x2b7251,_0x166e29){_0x166e29=_0x166e29||0xc8;return function(_0x76a3cb){if(_0x76a3cb){return _0x2b7251[_0x5bdb('0x1a')](_0x166e29)[_0x5bdb('0x1b')](_0x76a3cb);}};}function respondWithFilteredResult(_0x390370,_0x34d59b){return function(_0x335a04){if(_0x335a04){var _0x2320d7=typeof _0x34d59b[_0x5bdb('0x1c')]==='undefined'&&typeof _0x34d59b[_0x5bdb('0x1d')]===_0x5bdb('0x1e');var _0x46c78f=_0x335a04[_0x5bdb('0x1f')];var _0x5d5780=_0x2320d7?0x0:_0x34d59b[_0x5bdb('0x1c')];var _0x21dfb5=_0x2320d7?_0x335a04[_0x5bdb('0x1f')]:_0x34d59b[_0x5bdb('0x1c')]+_0x34d59b[_0x5bdb('0x1d')];var _0x417234;if(_0x21dfb5>=_0x46c78f){_0x21dfb5=_0x46c78f;_0x417234=0xc8;}else{_0x417234=0xce;}_0x390370['status'](_0x417234);return _0x390370[_0x5bdb('0x20')](_0x5bdb('0x21'),_0x5d5780+'-'+_0x21dfb5+'/'+_0x46c78f)[_0x5bdb('0x1b')](_0x335a04);}return null;};}function patchUpdates(_0x24dd73){return function(_0x407a2b){try{jsonpatch[_0x5bdb('0x22')](_0x407a2b,_0x24dd73,!![]);}catch(_0x302009){return BPromise[_0x5bdb('0x23')](_0x302009);}return _0x407a2b[_0x5bdb('0x24')]();};}function saveUpdates(_0x410d98,_0x1d975f){return function(_0x4ce6db){if(_0x4ce6db){return _0x4ce6db[_0x5bdb('0x25')](_0x410d98)[_0x5bdb('0x26')](function(_0x17711f){return _0x17711f;});}return null;};}function removeEntity(_0x167b11,_0x1d2f94){return function(_0x4aaf94){if(_0x4aaf94){return _0x4aaf94[_0x5bdb('0x27')]()[_0x5bdb('0x26')](function(){_0x167b11[_0x5bdb('0x1a')](0xcc)[_0x5bdb('0x28')]();});}};}function handleEntityNotFound(_0x290c9a,_0x51fbf5){return function(_0x173c5b){if(!_0x173c5b){_0x290c9a[_0x5bdb('0x19')](0x194);}return _0x173c5b;};}function handleError(_0x381d48,_0x181442){_0x181442=_0x181442||0x1f4;return function(_0x46cc4a){logger[_0x5bdb('0x29')](_0x46cc4a[_0x5bdb('0x2a')]);if(_0x46cc4a[_0x5bdb('0x2b')]){delete _0x46cc4a[_0x5bdb('0x2b')];}_0x381d48['status'](_0x181442)['send'](_0x46cc4a);};}exports[_0x5bdb('0x2c')]=function(_0x5c03dd,_0xa29b4){var _0x1faa32={},_0x41eddf={},_0x585f8d={'count':0x0,'rows':[]};var _0x1dcd44=_['map'](db[_0x5bdb('0x2d')][_0x5bdb('0x2e')],function(_0x180abc){return{'name':_0x180abc[_0x5bdb('0x2f')],'type':_0x180abc[_0x5bdb('0x30')][_0x5bdb('0x31')]};});_0x41eddf[_0x5bdb('0x32')]=_[_0x5bdb('0x33')](_0x1dcd44,_0x5bdb('0x2b'));_0x41eddf[_0x5bdb('0x34')]=_['keys'](_0x5c03dd[_0x5bdb('0x34')]);_0x41eddf[_0x5bdb('0x35')]=_[_0x5bdb('0x36')](_0x41eddf[_0x5bdb('0x32')],_0x41eddf[_0x5bdb('0x34')]);_0x1faa32[_0x5bdb('0x37')]=_[_0x5bdb('0x36')](_0x41eddf[_0x5bdb('0x32')],qs[_0x5bdb('0x38')](_0x5c03dd['query'][_0x5bdb('0x38')]));_0x1faa32[_0x5bdb('0x37')]=_0x1faa32[_0x5bdb('0x37')]['length']?_0x1faa32[_0x5bdb('0x37')]:_0x41eddf['model'];if(!_0x5c03dd[_0x5bdb('0x34')]['hasOwnProperty'](_0x5bdb('0x39'))){_0x1faa32[_0x5bdb('0x1d')]=qs['limit'](_0x5c03dd['query']['limit']);_0x1faa32['offset']=qs[_0x5bdb('0x1c')](_0x5c03dd[_0x5bdb('0x34')][_0x5bdb('0x1c')]);}_0x1faa32['order']=qs[_0x5bdb('0x3a')](_0x5c03dd['query'][_0x5bdb('0x3a')]);_0x1faa32['where']=qs[_0x5bdb('0x35')](_[_0x5bdb('0x3b')](_0x5c03dd[_0x5bdb('0x34')],_0x41eddf['filters']),_0x1dcd44);if(_0x5c03dd[_0x5bdb('0x34')][_0x5bdb('0x3c')]){_0x1faa32[_0x5bdb('0x3d')]=_[_0x5bdb('0x3e')](_0x1faa32[_0x5bdb('0x3d')],{'$or':_[_0x5bdb('0x33')](_0x1dcd44,function(_0x533158){if(_0x533158['type']!==_0x5bdb('0x3f')){var _0x146c3a={};_0x146c3a[_0x533158[_0x5bdb('0x2b')]]={'$like':'%'+_0x5c03dd[_0x5bdb('0x34')][_0x5bdb('0x3c')]+'%'};return _0x146c3a;}})});}_0x1faa32=_[_0x5bdb('0x3e')]({},_0x1faa32,_0x5c03dd[_0x5bdb('0x40')]);var _0x378328={'where':_0x1faa32[_0x5bdb('0x3d')]};return db[_0x5bdb('0x2d')]['count'](_0x378328)[_0x5bdb('0x26')](function(_0x4d19ca){_0x585f8d['count']=_0x4d19ca;if(_0x5c03dd['query']['includeAll']){_0x1faa32[_0x5bdb('0x41')]=[{'all':!![]}];}return db[_0x5bdb('0x2d')]['findAll'](_0x1faa32);})['then'](function(_0x188d4d){_0x585f8d['rows']=_0x188d4d;return _0x585f8d;})[_0x5bdb('0x26')](respondWithFilteredResult(_0xa29b4,_0x1faa32))[_0x5bdb('0x42')](handleError(_0xa29b4,null));};exports[_0x5bdb('0x43')]=function(_0x2aedfe,_0xa2822e){var _0x4f6bcd={'raw':!![],'where':{'id':_0x2aedfe[_0x5bdb('0x44')]['id']}},_0x590489={};_0x590489[_0x5bdb('0x32')]=_[_0x5bdb('0x45')](db[_0x5bdb('0x2d')][_0x5bdb('0x2e')]);_0x590489['query']=_[_0x5bdb('0x45')](_0x2aedfe[_0x5bdb('0x34')]);_0x590489[_0x5bdb('0x35')]=_[_0x5bdb('0x36')](_0x590489[_0x5bdb('0x32')],_0x590489[_0x5bdb('0x34')]);_0x4f6bcd[_0x5bdb('0x37')]=_[_0x5bdb('0x36')](_0x590489[_0x5bdb('0x32')],qs[_0x5bdb('0x38')](_0x2aedfe['query'][_0x5bdb('0x38')]));_0x4f6bcd[_0x5bdb('0x37')]=_0x4f6bcd['attributes']['length']?_0x4f6bcd[_0x5bdb('0x37')]:_0x590489[_0x5bdb('0x32')];if(_0x2aedfe[_0x5bdb('0x34')][_0x5bdb('0x46')]){_0x4f6bcd[_0x5bdb('0x41')]=[{'all':!![]}];}_0x4f6bcd=_[_0x5bdb('0x3e')]({},_0x4f6bcd,_0x2aedfe[_0x5bdb('0x40')]);return db[_0x5bdb('0x2d')][_0x5bdb('0x47')](_0x4f6bcd)[_0x5bdb('0x26')](handleEntityNotFound(_0xa2822e,null))[_0x5bdb('0x26')](respondWithResult(_0xa2822e,null))[_0x5bdb('0x42')](handleError(_0xa2822e,null));};exports[_0x5bdb('0x48')]=function(_0x277cfd,_0x111b97){return db[_0x5bdb('0x2d')]['create'](_0x277cfd['body'],{})['then'](respondWithResult(_0x111b97,0xc9))[_0x5bdb('0x42')](handleError(_0x111b97,null));};exports[_0x5bdb('0x25')]=function(_0x48e9a7,_0xac27be){if(_0x48e9a7[_0x5bdb('0x49')]['id']){delete _0x48e9a7['body']['id'];}return db['SquareRecording']['find']({'where':{'id':_0x48e9a7[_0x5bdb('0x44')]['id']}})[_0x5bdb('0x26')](handleEntityNotFound(_0xac27be,null))[_0x5bdb('0x26')](saveUpdates(_0x48e9a7[_0x5bdb('0x49')],null))[_0x5bdb('0x26')](respondWithResult(_0xac27be,null))['catch'](handleError(_0xac27be,null));};exports[_0x5bdb('0x4a')]=function(_0x4f59be,_0x233b97,_0x26ebcf){var _0x3da492=require('../../components/encryptor');var _0x373b4c=![];var _0x2a6341={};if(_0x4f59be[_0x5bdb('0x34')]['type']&&_0x4f59be['query']['type']===_0x5bdb('0x4b')){_0x2a6341[_0x5bdb('0x4b')]=_0x4f59be[_0x5bdb('0x44')]['id'];}else{_0x2a6341['id']=_0x4f59be[_0x5bdb('0x44')]['id'];}return db[_0x5bdb('0x2d')][_0x5bdb('0x47')]({'where':_0x2a6341,'attributes':['id',_0x5bdb('0x4c'),_0x5bdb('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x233b97,null))[_0x5bdb('0x26')](function(_0x119c51){if(_0x119c51){var _0x568de9=_0x119c51[_0x5bdb('0x4c')];var _0x5d4a37=util[_0x5bdb('0x4e')](_0x5bdb('0x4f'),_0x568de9);if(fs[_0x5bdb('0x50')](_0x5d4a37)){_0x373b4c=!![];return _0x3da492[_0x5bdb('0x51')](_0x5d4a37,_0x568de9,config[_0x5bdb('0x52')]['recording'])['then'](function(){return _0x119c51;});}return _0x119c51;}})[_0x5bdb('0x26')](function(_0x4beeae){if(_0x4beeae){var _0x4bb93c=_0x4beeae[_0x5bdb('0x4c')];if(!fs['existsSync'](_0x4bb93c)){throw new db[(_0x5bdb('0x53'))][(_0x5bdb('0x54'))]('SquareRecording\x20not\x20found');}if(_0x4beeae['filename']){return _0x233b97[_0x5bdb('0x4a')](_0x4bb93c,_0x4beeae[_0x5bdb('0x4d')]+path[_0x5bdb('0x55')](_0x4bb93c),function(){if(_0x373b4c){fs[_0x5bdb('0x56')](_0x4bb93c);}});}else{return _0x233b97[_0x5bdb('0x4a')](_0x4bb93c,function(_0x227cf8){if(_0x373b4c){fs[_0x5bdb('0x56')](_0x4bb93c);}});}}})[_0x5bdb('0x42')](function(_0x31ec52){if(_0x31ec52[_0x5bdb('0x57')]==='SquareRecording\x20not\x20found'){_0x233b97['status'](0x194)[_0x5bdb('0x58')](_0x5bdb('0x59'));}else{return handleError(_0x233b97,null);}});};exports[_0x5bdb('0x27')]=function(_0x10ff6f,_0x4023d1){return db[_0x5bdb('0x2d')][_0x5bdb('0x47')]({'where':{'id':_0x10ff6f[_0x5bdb('0x44')]['id']}})['then'](function(_0x1914a8){if(_[_0x5bdb('0x5a')](_0x1914a8)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1914a8;})[_0x5bdb('0x26')](function(_0x21325e){var _0x4978cc=_0x21325e[_0x5bdb('0x4c')];logger['info'](_0x5bdb('0x5b'),_0x4978cc);if(!_[_0x5bdb('0x5a')](_0x21325e[_0x5bdb('0x4c')])&&fs['existsSync'](_0x4978cc)){logger['info'](_0x5bdb('0x5c')+_0x4978cc+_0x5bdb('0x5d'));fs[_0x5bdb('0x5e')](_0x4978cc);}_0x4978cc=_0x4978cc+_0x5bdb('0x5f');if(!_['isNil'](_0x21325e['savePath'])&&fs[_0x5bdb('0x50')](_0x4978cc)){logger['info'](_0x5bdb('0x5c')+_0x4978cc+_0x5bdb('0x5d'));fs['unlinkSync'](_0x4978cc);}return _0x21325e;})[_0x5bdb('0x26')](function(_0x528185){if(!_0x528185)throw new InternalError();return _0x528185[_0x5bdb('0x27')]();})['then'](function(){_0x4023d1['status'](0xcc)['end']();})['catch'](handleError(_0x4023d1,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index d7345f7..9bb7f43 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 _0x6947=['./squareRecording.attributes','exports','define','square_recordings','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x1a80c9,_0xdddeea){var _0x92bce5=function(_0x2ed1bb){while(--_0x2ed1bb){_0x1a80c9['push'](_0x1a80c9['shift']());}};_0x92bce5(++_0xdddeea);}(_0x6947,0x72));var _0x7694=function(_0x3941e8,_0x359bad){_0x3941e8=_0x3941e8-0x0;var _0x49dc13=_0x6947[_0x3941e8];return _0x49dc13;};'use strict';var _=require('lodash');var util=require(_0x7694('0x0'));var logger=require('../../config/logger')(_0x7694('0x1'));var moment=require(_0x7694('0x2'));var BPromise=require(_0x7694('0x3'));var rp=require(_0x7694('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7694('0x5'));var attributes=require(_0x7694('0x6'));module[_0x7694('0x7')]=function(_0x5730,_0x36776b){return _0x5730[_0x7694('0x8')]('SquareRecording',attributes,{'tableName':_0x7694('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd6e=['request-promise','path','rimraf','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird'];(function(_0x5806b9,_0x3e6668){var _0x3c987b=function(_0x3a86c7){while(--_0x3a86c7){_0x5806b9['push'](_0x5806b9['shift']());}};_0x3c987b(++_0x3e6668);}(_0xdd6e,0xa5));var _0xedd6=function(_0x407725,_0x608186){_0x407725=_0x407725-0x0;var _0x29c867=_0xdd6e[_0x407725];return _0x29c867;};'use strict';var _=require(_0xedd6('0x0'));var util=require(_0xedd6('0x1'));var logger=require(_0xedd6('0x2'))(_0xedd6('0x3'));var moment=require('moment');var BPromise=require(_0xedd6('0x4'));var rp=require(_0xedd6('0x5'));var fs=require('fs');var path=require(_0xedd6('0x6'));var rimraf=require(_0xedd6('0x7'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module['exports']=function(_0x3430b2,_0x27b159){return _0x3430b2['define'](_0xedd6('0x8'),attributes,{'tableName':_0xedd6('0x9'),'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 1075cff..78aca66 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 _0x73a1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73a1,0x98));var _0x173a=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0x73a1[_0x3a1ea5];return _0xfac9b2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x173a('0x0'));var rs=require(_0x173a('0x1'));var fs=require('fs');var Redis=require(_0x173a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x173a('0x3'));var logger=require(_0x173a('0x4'))(_0x173a('0x5'));var config=require(_0x173a('0x6'));var jayson=require(_0x173a('0x7'));var client=jayson[_0x173a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x375422,_0x458017,_0x1090ac){return new BPromise(function(_0x536521,_0x3d5e25){return client['request'](_0x375422,_0x1090ac)[_0x173a('0x9')](function(_0x336dc8){logger[_0x173a('0xa')](_0x173a('0xb'),_0x458017,_0x173a('0xc'));logger[_0x173a('0xd')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x458017,_0x173a('0xc'),JSON[_0x173a('0xe')](_0x336dc8));if(_0x336dc8[_0x173a('0xf')]){if(_0x336dc8[_0x173a('0xf')][_0x173a('0x10')]===0x1f4){logger[_0x173a('0xf')]('SquareRecording,\x20%s,\x20%s',_0x458017,_0x336dc8[_0x173a('0xf')][_0x173a('0x11')]);return _0x3d5e25(_0x336dc8[_0x173a('0xf')][_0x173a('0x11')]);}logger[_0x173a('0xf')](_0x173a('0xb'),_0x458017,_0x336dc8[_0x173a('0xf')][_0x173a('0x11')]);return _0x536521(_0x336dc8[_0x173a('0xf')][_0x173a('0x11')]);}else{logger[_0x173a('0xa')](_0x173a('0xb'),_0x458017,'request\x20sent');_0x536521(_0x336dc8[_0x173a('0x12')][_0x173a('0x11')]);}})[_0x173a('0x13')](function(_0x482998){logger[_0x173a('0xf')](_0x173a('0xb'),_0x458017,_0x482998);_0x3d5e25(_0x482998);});});}exports[_0x173a('0x14')]=function(_0x379b3b){var _0x2a917a=this;return new Promise(function(_0x57c622,_0x33a4f0){return db[_0x173a('0x15')][_0x173a('0x16')](_0x379b3b[_0x173a('0x17')],{'raw':_0x379b3b[_0x173a('0x18')]?_0x379b3b['options'][_0x173a('0x19')]===undefined?!![]:![]:!![]})[_0x173a('0x9')](function(_0x1b8b08){logger[_0x173a('0xa')](_0x173a('0x14'),_0x379b3b);logger['debug'](_0x173a('0x14'),_0x379b3b,JSON['stringify'](_0x1b8b08));_0x57c622(_0x1b8b08);})[_0x173a('0x13')](function(_0x2bf189){logger[_0x173a('0xf')](_0x173a('0x14'),_0x2bf189[_0x173a('0x11')],_0x379b3b);_0x33a4f0(_0x2a917a[_0x173a('0xf')](0x1f4,_0x2bf189[_0x173a('0x11')]));});});}; \ No newline at end of file +var _0xffe4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5e42ec,_0x3fff70){var _0x35d324=function(_0x2bf651){while(--_0x2bf651){_0x5e42ec['push'](_0x5e42ec['shift']());}};_0x35d324(++_0x3fff70);}(_0xffe4,0xfa));var _0x4ffe=function(_0x2d4ff4,_0x3f6eea){_0x2d4ff4=_0x2d4ff4-0x0;var _0x467254=_0xffe4[_0x2d4ff4];return _0x467254;};'use strict';var _=require(_0x4ffe('0x0'));var util=require(_0x4ffe('0x1'));var moment=require(_0x4ffe('0x2'));var BPromise=require(_0x4ffe('0x3'));var rs=require(_0x4ffe('0x4'));var fs=require('fs');var Redis=require(_0x4ffe('0x5'));var db=require(_0x4ffe('0x6'))['db'];var utils=require(_0x4ffe('0x7'));var logger=require(_0x4ffe('0x8'))(_0x4ffe('0x9'));var config=require(_0x4ffe('0xa'));var jayson=require(_0x4ffe('0xb'));var client=jayson[_0x4ffe('0xc')][_0x4ffe('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3b44a0,_0x286a89,_0x533597){return new BPromise(function(_0x20c4ef,_0x3748b1){return client['request'](_0x3b44a0,_0x533597)[_0x4ffe('0xe')](function(_0x1894a8){logger[_0x4ffe('0xf')]('SquareRecording,\x20%s,\x20%s',_0x286a89,'request\x20sent');logger['debug'](_0x4ffe('0x10'),_0x286a89,_0x4ffe('0x11'),JSON['stringify'](_0x1894a8));if(_0x1894a8[_0x4ffe('0x12')]){if(_0x1894a8[_0x4ffe('0x12')][_0x4ffe('0x13')]===0x1f4){logger[_0x4ffe('0x12')](_0x4ffe('0x14'),_0x286a89,_0x1894a8[_0x4ffe('0x12')][_0x4ffe('0x15')]);return _0x3748b1(_0x1894a8[_0x4ffe('0x12')][_0x4ffe('0x15')]);}logger['error'](_0x4ffe('0x14'),_0x286a89,_0x1894a8[_0x4ffe('0x12')]['message']);return _0x20c4ef(_0x1894a8[_0x4ffe('0x12')][_0x4ffe('0x15')]);}else{logger[_0x4ffe('0xf')](_0x4ffe('0x14'),_0x286a89,_0x4ffe('0x11'));_0x20c4ef(_0x1894a8[_0x4ffe('0x16')]['message']);}})[_0x4ffe('0x17')](function(_0x27bcff){logger[_0x4ffe('0x12')](_0x4ffe('0x14'),_0x286a89,_0x27bcff);_0x3748b1(_0x27bcff);});});}exports['CreateSquareRecording']=function(_0x3f3aa1){var _0x811a1b=this;return new Promise(function(_0x36decc,_0x3bd06b){return db[_0x4ffe('0x18')][_0x4ffe('0x19')](_0x3f3aa1[_0x4ffe('0x1a')],{'raw':_0x3f3aa1[_0x4ffe('0x1b')]?_0x3f3aa1[_0x4ffe('0x1b')][_0x4ffe('0x1c')]===undefined?!![]:![]:!![]})[_0x4ffe('0xe')](function(_0x40fcfd){logger['info'](_0x4ffe('0x1d'),_0x3f3aa1);logger[_0x4ffe('0x1e')](_0x4ffe('0x1d'),_0x3f3aa1,JSON[_0x4ffe('0x1f')](_0x40fcfd));_0x36decc(_0x40fcfd);})['catch'](function(_0x23e302){logger[_0x4ffe('0x12')](_0x4ffe('0x1d'),_0x23e302[_0x4ffe('0x15')],_0x3f3aa1);_0x3bd06b(_0x811a1b[_0x4ffe('0x12')](0x1f4,_0x23e302[_0x4ffe('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index cc931f4..c9dc802 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 _0xa38f=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4cc4e3,_0x2c551d){var _0x3326f0=function(_0x51a192){while(--_0x51a192){_0x4cc4e3['push'](_0x4cc4e3['shift']());}};_0x3326f0(++_0x2c551d);}(_0xa38f,0xea));var _0xfa38=function(_0x4c9e3a,_0x4b6ed8){_0x4c9e3a=_0x4c9e3a-0x0;var _0x350387=_0xa38f[_0x4c9e3a];return _0x350387;};'use strict';var multer=require(_0xfa38('0x0'));var util=require(_0xfa38('0x1'));var path=require('path');var timeout=require(_0xfa38('0x2'));var express=require('express');var router=express[_0xfa38('0x3')]();var fs_extra=require(_0xfa38('0x4'));var auth=require(_0xfa38('0x5'));var interaction=require(_0xfa38('0x6'));var config=require(_0xfa38('0x7'));var controller=require(_0xfa38('0x8'));router[_0xfa38('0x9')]('/',auth[_0xfa38('0xa')](),controller[_0xfa38('0xb')]);router[_0xfa38('0x9')](_0xfa38('0xc'),auth[_0xfa38('0xa')](),controller[_0xfa38('0xd')]);router[_0xfa38('0x9')](_0xfa38('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xfa38('0xf')]('/',auth[_0xfa38('0xa')](),controller[_0xfa38('0x10')]);router[_0xfa38('0x11')](_0xfa38('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xfa38('0x12')](_0xfa38('0xe'),auth[_0xfa38('0xa')](),controller[_0xfa38('0x13')]);module['exports']=router; \ No newline at end of file +var _0xab36=['index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xab36,0xdc));var _0x6ab3=function(_0x28c292,_0x511d22){_0x28c292=_0x28c292-0x0;var _0xac0161=_0xab36[_0x28c292];return _0xac0161;};'use strict';var multer=require(_0x6ab3('0x0'));var util=require(_0x6ab3('0x1'));var path=require(_0x6ab3('0x2'));var timeout=require(_0x6ab3('0x3'));var express=require(_0x6ab3('0x4'));var router=express[_0x6ab3('0x5')]();var fs_extra=require(_0x6ab3('0x6'));var auth=require(_0x6ab3('0x7'));var interaction=require(_0x6ab3('0x8'));var config=require('../../config/environment');var controller=require('./squareReport.controller');router[_0x6ab3('0x9')]('/',auth[_0x6ab3('0xa')](),controller[_0x6ab3('0xb')]);router[_0x6ab3('0x9')](_0x6ab3('0xc'),auth[_0x6ab3('0xa')](),controller[_0x6ab3('0xd')]);router[_0x6ab3('0x9')](_0x6ab3('0xe'),auth[_0x6ab3('0xa')](),controller[_0x6ab3('0xf')]);router[_0x6ab3('0x10')]('/',auth[_0x6ab3('0xa')](),controller['create']);router[_0x6ab3('0x11')](_0x6ab3('0xe'),auth[_0x6ab3('0xa')](),controller[_0x6ab3('0x12')]);router[_0x6ab3('0x13')](_0x6ab3('0xe'),auth[_0x6ab3('0xa')](),controller['destroy']);module[_0x6ab3('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 88380b6..3f0004d 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 _0x67c7=['DATE','exports','STRING'];(function(_0x14363e,_0x4f0e0d){var _0x17c56d=function(_0x1c7bac){while(--_0x1c7bac){_0x14363e['push'](_0x14363e['shift']());}};_0x17c56d(++_0x4f0e0d);}(_0x67c7,0x8e));var _0x767c=function(_0x512e72,_0x49ffe1){_0x512e72=_0x512e72-0x0;var _0x143086=_0x67c7[_0x512e72];return _0x143086;};'use strict';var Sequelize=require('sequelize');module[_0x767c('0x0')]={'network':{'type':Sequelize[_0x767c('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x767c('0x1')]},'channel':{'type':Sequelize[_0x767c('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x767c('0x1')]},'uniqueid':{'type':Sequelize[_0x767c('0x1')]},'version':{'type':Sequelize[_0x767c('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x767c('0x1')]},'callington':{'type':Sequelize[_0x767c('0x1')]},'callingtns':{'type':Sequelize[_0x767c('0x1')]},'dnid':{'type':Sequelize[_0x767c('0x1')]},'rdnis':{'type':Sequelize[_0x767c('0x1')]},'context':{'type':Sequelize[_0x767c('0x1')]},'extension':{'type':Sequelize[_0x767c('0x1')]},'priority':{'type':Sequelize[_0x767c('0x1')]},'enhanced':{'type':Sequelize[_0x767c('0x1')]},'accountcode':{'type':Sequelize[_0x767c('0x1')]},'threadid':{'type':Sequelize[_0x767c('0x1')]},'project_name':{'type':Sequelize[_0x767c('0x1')]},'joinAt':{'type':Sequelize[_0x767c('0x2')]},'leaveAt':{'type':Sequelize[_0x767c('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa45b=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x3a2935,_0x4b46e4){var _0x997093=function(_0x5c8cfc){while(--_0x5c8cfc){_0x3a2935['push'](_0x3a2935['shift']());}};_0x997093(++_0x4b46e4);}(_0xa45b,0x7b));var _0xba45=function(_0x31d7a3,_0x3eec3f){_0x31d7a3=_0x31d7a3-0x0;var _0x369774=_0xa45b[_0x31d7a3];return _0x369774;};'use strict';var Sequelize=require(_0xba45('0x0'));module[_0xba45('0x1')]={'network':{'type':Sequelize[_0xba45('0x2')]},'network_script':{'type':Sequelize[_0xba45('0x2')]},'request':{'type':Sequelize[_0xba45('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xba45('0x2')]},'calleridname':{'type':Sequelize[_0xba45('0x2')]},'callingpres':{'type':Sequelize[_0xba45('0x2')]},'callingani2':{'type':Sequelize[_0xba45('0x2')]},'callington':{'type':Sequelize[_0xba45('0x2')]},'callingtns':{'type':Sequelize[_0xba45('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xba45('0x2')]},'context':{'type':Sequelize[_0xba45('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xba45('0x2')]},'accountcode':{'type':Sequelize[_0xba45('0x2')]},'threadid':{'type':Sequelize[_0xba45('0x2')]},'project_name':{'type':Sequelize[_0xba45('0x2')]},'joinAt':{'type':Sequelize[_0xba45('0x3')]},'leaveAt':{'type':Sequelize[_0xba45('0x3')]},'bot':{'type':Sequelize[_0xba45('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index feae826..17e1a28 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 _0xe3da=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x461f60,_0x26eaca){var _0x1f140b=function(_0x5785fd){while(--_0x5785fd){_0x461f60['push'](_0x461f60['shift']());}};_0x1f140b(++_0x26eaca);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':!![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));};exports['describe']=function(_0x4f4694,_0x4c6dab){return db[_0xae3d('0x2f')][_0xae3d('0x50')]()['then'](respondWithResult(_0x4c6dab,null))[_0xae3d('0x48')](handleError(_0x4c6dab,null));}; \ No newline at end of file +var _0x8952=['filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','includeAll','include','catch','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','map','SquareReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x8952,0x17e));var _0x2895=function(_0x201f83,_0x2f2b51){_0x201f83=_0x201f83-0x0;var _0x23a7e9=_0x8952[_0x201f83];return _0x23a7e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=typeof _0x1ae013[_0x2895('0x18')]===_0x2895('0x19')&&typeof _0x1ae013[_0x2895('0x1a')]===_0x2895('0x19');var _0x10a1bf=_0x1d3659[_0x2895('0x1b')];var _0xbf8b63=_0x2627e6?0x0:_0x1ae013[_0x2895('0x18')];var _0x155124=_0x2627e6?_0x1d3659[_0x2895('0x1b')]:_0x1ae013[_0x2895('0x18')]+_0x1ae013[_0x2895('0x1a')];var _0x5a8eab;if(_0x155124>=_0x10a1bf){_0x155124=_0x10a1bf;_0x5a8eab=0xc8;}else{_0x5a8eab=0xce;}_0x27b50e['status'](_0x5a8eab);return _0x27b50e['set'](_0x2895('0x1c'),_0xbf8b63+'-'+_0x155124+'/'+_0x10a1bf)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x3ec4da){return function(_0x593e47){try{jsonpatch[_0x2895('0x1d')](_0x593e47,_0x3ec4da,!![]);}catch(_0x190b79){return BPromise[_0x2895('0x1e')](_0x190b79);}return _0x593e47[_0x2895('0x1f')]();};}function saveUpdates(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x20')](_0x8b75e0)['then'](function(_0x142e58){return _0x142e58;});}return null;};}function removeEntity(_0x384357,_0x6f8ad4){return function(_0x511286){if(_0x511286){return _0x511286['destroy']()[_0x2895('0x21')](function(){_0x384357[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x4a21cf,_0x3d3320){return function(_0x3690ce){if(!_0x3690ce){_0x4a21cf['sendStatus'](0x194);}return _0x3690ce;};}function handleError(_0x293ad3,_0x127540){_0x127540=_0x127540||0x1f4;return function(_0x2cd4df){logger['error'](_0x2cd4df[_0x2895('0x23')]);if(_0x2cd4df[_0x2895('0x24')]){delete _0x2cd4df['name'];}_0x293ad3[_0x2895('0x16')](_0x127540)['send'](_0x2cd4df);};}exports['index']=function(_0x18a935,_0x4ee2cc){var _0xfa4f85={},_0x381538={},_0x4fdd94={'count':0x0,'rows':[]};var _0x5574bf=_[_0x2895('0x25')](db[_0x2895('0x26')][_0x2895('0x27')],function(_0x14e343){return{'name':_0x14e343[_0x2895('0x28')],'type':_0x14e343[_0x2895('0x29')][_0x2895('0x2a')]};});_0x381538['model']=_[_0x2895('0x25')](_0x5574bf,_0x2895('0x24'));_0x381538[_0x2895('0x2b')]=_['keys'](_0x18a935[_0x2895('0x2b')]);_0x381538[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],_0x381538['query']);_0xfa4f85[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x18a935[_0x2895('0x2b')]['fields']));_0xfa4f85['attributes']=_0xfa4f85[_0x2895('0x2f')][_0x2895('0x31')]?_0xfa4f85['attributes']:_0x381538[_0x2895('0x2e')];if(!_0x18a935['query'][_0x2895('0x32')](_0x2895('0x33'))){_0xfa4f85['limit']=qs[_0x2895('0x1a')](_0x18a935['query'][_0x2895('0x1a')]);_0xfa4f85['offset']=qs['offset'](_0x18a935[_0x2895('0x2b')][_0x2895('0x18')]);}_0xfa4f85[_0x2895('0x34')]=qs['sort'](_0x18a935[_0x2895('0x2b')][_0x2895('0x35')]);_0xfa4f85[_0x2895('0x36')]=qs[_0x2895('0x2c')](_[_0x2895('0x37')](_0x18a935[_0x2895('0x2b')],_0x381538[_0x2895('0x2c')]),_0x5574bf);if(_0x18a935[_0x2895('0x2b')][_0x2895('0x38')]){_0xfa4f85[_0x2895('0x36')]=_['merge'](_0xfa4f85[_0x2895('0x36')],{'$or':_[_0x2895('0x25')](_0x5574bf,function(_0x47413d){if(_0x47413d[_0x2895('0x29')]!==_0x2895('0x39')){var _0x12d7d8={};_0x12d7d8[_0x47413d[_0x2895('0x24')]]={'$like':'%'+_0x18a935['query']['filter']+'%'};return _0x12d7d8;}})});}_0xfa4f85=_[_0x2895('0x3a')]({},_0xfa4f85,_0x18a935[_0x2895('0x3b')]);var _0x24b9e0={'where':_0xfa4f85[_0x2895('0x36')]};return db[_0x2895('0x26')][_0x2895('0x1b')](_0x24b9e0)['then'](function(_0x5d18ef){_0x4fdd94[_0x2895('0x1b')]=_0x5d18ef;if(_0x18a935[_0x2895('0x2b')]['includeAll']){_0xfa4f85['include']=[{'all':!![]}];}return db[_0x2895('0x26')][_0x2895('0x3c')](_0xfa4f85);})[_0x2895('0x21')](function(_0x28967f){_0x4fdd94[_0x2895('0x3d')]=_0x28967f;return _0x4fdd94;})[_0x2895('0x21')](respondWithFilteredResult(_0x4ee2cc,_0xfa4f85))['catch'](handleError(_0x4ee2cc,null));};exports[_0x2895('0x3e')]=function(_0x2cfb24,_0x18ca24){var _0x1537fd={'raw':!![],'where':{'id':_0x2cfb24[_0x2895('0x3f')]['id']}},_0x4af6d6={};_0x4af6d6[_0x2895('0x2e')]=_[_0x2895('0x40')](db[_0x2895('0x26')]['rawAttributes']);_0x4af6d6['query']=_[_0x2895('0x40')](_0x2cfb24[_0x2895('0x2b')]);_0x4af6d6[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],_0x4af6d6['query']);_0x1537fd['attributes']=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x2cfb24[_0x2895('0x2b')][_0x2895('0x30')]));_0x1537fd[_0x2895('0x2f')]=_0x1537fd[_0x2895('0x2f')]['length']?_0x1537fd[_0x2895('0x2f')]:_0x4af6d6[_0x2895('0x2e')];if(_0x2cfb24[_0x2895('0x2b')][_0x2895('0x41')]){_0x1537fd[_0x2895('0x42')]=[{'all':!![]}];}_0x1537fd=_[_0x2895('0x3a')]({},_0x1537fd,_0x2cfb24[_0x2895('0x3b')]);return db[_0x2895('0x26')]['find'](_0x1537fd)[_0x2895('0x21')](handleEntityNotFound(_0x18ca24,null))[_0x2895('0x21')](respondWithResult(_0x18ca24,null))[_0x2895('0x43')](handleError(_0x18ca24,null));};exports['create']=function(_0xc85aa1,_0x5307a9){return db['SquareReport'][_0x2895('0x44')](_0xc85aa1[_0x2895('0x45')],{})[_0x2895('0x21')](respondWithResult(_0x5307a9,0xc9))[_0x2895('0x43')](handleError(_0x5307a9,null));};exports[_0x2895('0x20')]=function(_0x3cc331,_0x11e53a){if(_0x3cc331['body']['id']){delete _0x3cc331[_0x2895('0x45')]['id'];}return db[_0x2895('0x26')]['find']({'where':{'id':_0x3cc331['params']['id']}})['then'](handleEntityNotFound(_0x11e53a,null))[_0x2895('0x21')](saveUpdates(_0x3cc331[_0x2895('0x45')],null))[_0x2895('0x21')](respondWithResult(_0x11e53a,null))[_0x2895('0x43')](handleError(_0x11e53a,null));};exports[_0x2895('0x46')]=function(_0x3c5261,_0xaca46c){return db[_0x2895('0x26')][_0x2895('0x47')]({'where':{'id':_0x3c5261[_0x2895('0x3f')]['id']}})[_0x2895('0x21')](handleEntityNotFound(_0xaca46c,null))[_0x2895('0x21')](removeEntity(_0xaca46c,null))[_0x2895('0x43')](handleError(_0xaca46c,null));};exports[_0x2895('0x48')]=function(_0x356d35,_0x3c1135){return db[_0x2895('0x26')][_0x2895('0x48')]()[_0x2895('0x21')](respondWithResult(_0x3c1135,null))[_0x2895('0x43')](handleError(_0x3c1135,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 9b98b47..93facbe 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 _0xb538=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash'];(function(_0x1d2f68,_0x280a21){var _0x3cbf0a=function(_0x304f91){while(--_0x304f91){_0x1d2f68['push'](_0x1d2f68['shift']());}};_0x3cbf0a(++_0x280a21);}(_0xb538,0x1af));var _0x8b53=function(_0x280605,_0x222c80){_0x280605=_0x280605-0x0;var _0x1093d5=_0xb538[_0x280605];return _0x1093d5;};'use strict';var _=require(_0x8b53('0x0'));var util=require(_0x8b53('0x1'));var logger=require('../../config/logger')(_0x8b53('0x2'));var moment=require('moment');var BPromise=require(_0x8b53('0x3'));var rp=require(_0x8b53('0x4'));var fs=require('fs');var path=require(_0x8b53('0x5'));var rimraf=require(_0x8b53('0x6'));var config=require(_0x8b53('0x7'));var attributes=require(_0x8b53('0x8'));module[_0x8b53('0x9')]=function(_0x3b76a0,_0x4dcfa2){return _0x3b76a0[_0x8b53('0xa')](_0x8b53('0xb'),attributes,{'tableName':_0x8b53('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x8b53('0xd'),_0x8b53('0xe')]},{'name':_0x8b53('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc9a=['api','moment','request-promise','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','leaveAt','util','../../config/logger'];(function(_0x1d30a3,_0x5f428c){var _0x32bba1=function(_0x5a60cc){while(--_0x5a60cc){_0x1d30a3['push'](_0x1d30a3['shift']());}};_0x32bba1(++_0x5f428c);}(_0xbc9a,0x73));var _0xabc9=function(_0x18f396,_0x174d17){_0x18f396=_0x18f396-0x0;var _0x3ba532=_0xbc9a[_0x18f396];return _0x3ba532;};'use strict';var _=require('lodash');var util=require(_0xabc9('0x0'));var logger=require(_0xabc9('0x1'))(_0xabc9('0x2'));var moment=require(_0xabc9('0x3'));var BPromise=require('bluebird');var rp=require(_0xabc9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xabc9('0x5'));var attributes=require(_0xabc9('0x6'));module[_0xabc9('0x7')]=function(_0x4d5a32,_0x1dd14d){return _0x4d5a32['define'](_0xabc9('0x8'),attributes,{'tableName':_0xabc9('0x9'),'paranoid':![],'indexes':[{'name':_0xabc9('0xa'),'fields':[_0xabc9('0xb'),'project_name']},{'name':_0xabc9('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index ceb4d31..826213b 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 _0x1cb9=['options','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareReport','SquareReport','body','raw','then','UpdateSquareReport','update'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2a4a33,_0x19131f){_0x2a4a33=_0x2a4a33-0x0;var _0x496f5c=_0x1cb9[_0x2a4a33];return _0x496f5c;};'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')]('SquareReport,\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')]['create'](_0x1cd34b[_0x91cb('0x18')],{'raw':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]===undefined?!![]:![]:!![]})[_0x91cb('0x1a')](function(_0x56e409){logger['info']('CreateSquareReport',_0x1cd34b);logger[_0x91cb('0xf')](_0x91cb('0x16'),_0x1cd34b,JSON[_0x91cb('0x11')](_0x56e409));_0x5cc1c3(_0x56e409);})[_0x91cb('0x15')](function(_0x5c6a15){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x5c6a15[_0x91cb('0x13')],_0x1cd34b);_0x3fba4f(_0xcd1a78['error'](0x1f4,_0x5c6a15[_0x91cb('0x13')]));});});};exports[_0x91cb('0x1b')]=function(_0x2447e7){var _0x422d14=this;return new Promise(function(_0x3ca500,_0x7ad361){return db[_0x91cb('0x17')][_0x91cb('0x1c')](_0x2447e7[_0x91cb('0x18')],{'raw':_0x2447e7['options']?_0x2447e7['options'][_0x91cb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2447e7['options']?_0x2447e7[_0x91cb('0x1d')][_0x91cb('0x1e')]||null:null,'attributes':_0x2447e7[_0x91cb('0x1d')]?_0x2447e7['options'][_0x91cb('0x1f')]||null:null,'limit':_0x2447e7['options']?_0x2447e7[_0x91cb('0x1d')][_0x91cb('0x20')]||null:null})[_0x91cb('0x1a')](function(_0x2fb473){logger[_0x91cb('0xc')]('UpdateSquareReport',_0x2447e7);logger[_0x91cb('0xf')]('UpdateSquareReport',_0x2447e7,JSON[_0x91cb('0x11')](_0x2fb473));_0x3ca500(_0x2fb473);})[_0x91cb('0x15')](function(_0x445fe1){logger['error'](_0x91cb('0x1b'),_0x445fe1[_0x91cb('0x13')],_0x2447e7);_0x7ad361(_0x422d14[_0x91cb('0x12')](0x1f4,_0x445fe1[_0x91cb('0x13')]));});});}; \ No newline at end of file +var _0x9c5a=['stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0xa3400,_0x3a980a){var _0x33dba2=function(_0x5e988b){while(--_0x5e988b){_0xa3400['push'](_0xa3400['shift']());}};_0x33dba2(++_0x3a980a);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x56364e,_0x12fb9a){_0x56364e=_0x56364e-0x0;var _0x453a8b=_0x9c5a[_0x56364e];return _0x453a8b;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){return client['request'](_0x3df556,_0x4b6db6)[_0xa9c5('0xa')](function(_0x97f9e2){logger['info'](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x4cb597,_0xa9c5('0xc'),JSON[_0xa9c5('0xd')](_0x97f9e2));if(_0x97f9e2[_0xa9c5('0xe')]){if(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0xf')]===0x1f4){logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x16f331(_0x97f9e2[_0xa9c5('0xe')]['message']);}logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x3d6b50(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);}else{logger[_0xa9c5('0x11')](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));_0x3d6b50(_0x97f9e2[_0xa9c5('0x12')]['message']);}})[_0xa9c5('0x13')](function(_0xd85c32){logger[_0xa9c5('0xe')]('SquareReport,\x20%s,\x20%s',_0x4cb597,_0xd85c32);_0x16f331(_0xd85c32);});});}exports[_0xa9c5('0x14')]=function(_0x1142d9){var _0x2b9ac5=this;return new Promise(function(_0x3b8cf7,_0x452a9b){return db[_0xa9c5('0x15')][_0xa9c5('0x16')](_0x1142d9[_0xa9c5('0x17')],{'raw':_0x1142d9[_0xa9c5('0x18')]?_0x1142d9[_0xa9c5('0x18')][_0xa9c5('0x19')]===undefined?!![]:![]:!![]})[_0xa9c5('0xa')](function(_0x54f8b9){logger[_0xa9c5('0x11')](_0xa9c5('0x14'),_0x1142d9);logger['debug']('CreateSquareReport',_0x1142d9,JSON[_0xa9c5('0xd')](_0x54f8b9));_0x3b8cf7(_0x54f8b9);})[_0xa9c5('0x13')](function(_0x10b208){logger[_0xa9c5('0xe')](_0xa9c5('0x14'),_0x10b208[_0xa9c5('0x10')],_0x1142d9);_0x452a9b(_0x2b9ac5['error'](0x1f4,_0x10b208['message']));});});};exports[_0xa9c5('0x1a')]=function(_0x11d395){var _0x4b0f05=this;return new Promise(function(_0x6819b3,_0x424b4c){return db[_0xa9c5('0x15')][_0xa9c5('0x1b')](_0x11d395[_0xa9c5('0x17')],{'raw':_0x11d395[_0xa9c5('0x18')]?_0x11d395[_0xa9c5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d395['options']?_0x11d395[_0xa9c5('0x18')]['where']||null:null,'attributes':_0x11d395[_0xa9c5('0x18')]?_0x11d395[_0xa9c5('0x18')]['attributes']||null:null,'limit':_0x11d395[_0xa9c5('0x18')]?_0x11d395[_0xa9c5('0x18')]['limit']||null:null})[_0xa9c5('0xa')](function(_0x32baf9){logger[_0xa9c5('0x11')](_0xa9c5('0x1a'),_0x11d395);logger[_0xa9c5('0x1c')]('UpdateSquareReport',_0x11d395,JSON[_0xa9c5('0xd')](_0x32baf9));_0x6819b3(_0x32baf9);})['catch'](function(_0x3c3da7){logger[_0xa9c5('0xe')](_0xa9c5('0x1a'),_0x3c3da7['message'],_0x11d395);_0x424b4c(_0x4b0f05[_0xa9c5('0xe')](0x1f4,_0x3c3da7[_0xa9c5('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 8377d55..708eec3 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 _0x259c=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x45ce4e,_0x3a367c){var _0x4a105a=function(_0x52f8bb){while(--_0x52f8bb){_0x45ce4e['push'](_0x45ce4e['shift']());}};_0x4a105a(++_0x3a367c);}(_0x259c,0x16e));var _0xc259=function(_0x11be69,_0x361293){_0x11be69=_0x11be69-0x0;var _0x49af8b=_0x259c[_0x11be69];return _0x49af8b;};'use strict';var multer=require(_0xc259('0x0'));var util=require(_0xc259('0x1'));var path=require(_0xc259('0x2'));var timeout=require(_0xc259('0x3'));var express=require(_0xc259('0x4'));var router=express['Router']();var fs_extra=require(_0xc259('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc259('0x6'));router[_0xc259('0x7')]('/',auth[_0xc259('0x8')](),controller[_0xc259('0x9')]);router['get'](_0xc259('0xa'),auth['isAuthenticated'](),controller[_0xc259('0xb')]);router[_0xc259('0x7')](_0xc259('0xc'),auth[_0xc259('0x8')](),controller[_0xc259('0xd')]);router[_0xc259('0xe')]('/',auth[_0xc259('0x8')](),controller[_0xc259('0xf')]);router[_0xc259('0x10')](_0xc259('0xc'),auth[_0xc259('0x8')](),controller[_0xc259('0x11')]);router[_0xc259('0x12')](_0xc259('0xc'),auth[_0xc259('0x8')](),controller[_0xc259('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf3f6=['create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x323731,_0x361227){var _0x23cfdd=function(_0x3bda73){while(--_0x3bda73){_0x323731['push'](_0x323731['shift']());}};_0x23cfdd(++_0x361227);}(_0xf3f6,0xd5));var _0x6f3f=function(_0x337805,_0x2a0ed5){_0x337805=_0x337805-0x0;var _0x89b004=_0xf3f6[_0x337805];return _0x89b004;};'use strict';var multer=require(_0x6f3f('0x0'));var util=require(_0x6f3f('0x1'));var path=require(_0x6f3f('0x2'));var timeout=require(_0x6f3f('0x3'));var express=require('express');var router=express[_0x6f3f('0x4')]();var fs_extra=require(_0x6f3f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f3f('0x6'));var controller=require(_0x6f3f('0x7'));router[_0x6f3f('0x8')]('/',auth[_0x6f3f('0x9')](),controller[_0x6f3f('0xa')]);router[_0x6f3f('0x8')]('/describe',auth[_0x6f3f('0x9')](),controller[_0x6f3f('0xb')]);router['get'](_0x6f3f('0xc'),auth[_0x6f3f('0x9')](),controller[_0x6f3f('0xd')]);router[_0x6f3f('0xe')]('/',auth[_0x6f3f('0x9')](),controller[_0x6f3f('0xf')]);router[_0x6f3f('0x10')](_0x6f3f('0xc'),auth[_0x6f3f('0x9')](),controller[_0x6f3f('0x11')]);router['delete'](_0x6f3f('0xc'),auth[_0x6f3f('0x9')](),controller['destroy']);module[_0x6f3f('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c79f289..4855885 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 _0x5486=['sequelize','exports','STRING','TEXT'];(function(_0x26f8f4,_0x4b1006){var _0x4aade5=function(_0x2768e4){while(--_0x2768e4){_0x26f8f4['push'](_0x26f8f4['shift']());}};_0x4aade5(++_0x4b1006);}(_0x5486,0x198));var _0x6548=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5486[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6548('0x0'));module[_0x6548('0x1')]={'uniqueid':{'type':Sequelize[_0x6548('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x6548('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6548('0x2')]}}; \ No newline at end of file +var _0xca83=['TEXT','sequelize','STRING'];(function(_0x1d04ac,_0x1575a2){var _0x21ad0d=function(_0x42ab07){while(--_0x42ab07){_0x1d04ac['push'](_0x1d04ac['shift']());}};_0x21ad0d(++_0x1575a2);}(_0xca83,0x1ab));var _0x3ca8=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xca83[_0x2adbeb];return _0x5e18a6;};'use strict';var Sequelize=require(_0x3ca8('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3ca8('0x1')]},'node':{'type':Sequelize[_0x3ca8('0x1')]},'application':{'type':Sequelize[_0x3ca8('0x1')]},'data':{'type':Sequelize[_0x3ca8('0x2')]},'project_name':{'type':Sequelize[_0x3ca8('0x1')]},'callerid':{'type':Sequelize[_0x3ca8('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 906d66c..59c9dc5 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 _0xf7f2=['apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','filters','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set'];(function(_0x358b33,_0x1a059b){var _0x54af99=function(_0x263e7e){while(--_0x263e7e){_0x358b33['push'](_0x358b33['shift']());}};_0x54af99(++_0x1a059b);}(_0xf7f2,0xba));var _0x2f7f=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0xf7f2[_0x49e584];return _0x58b1be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f7f('0x0'));var zipdir=require(_0x2f7f('0x1'));var jsonpatch=require(_0x2f7f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2f7f('0x3'));var csv=require(_0x2f7f('0x4'));var ejs=require(_0x2f7f('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f7f('0x6'));var squel=require(_0x2f7f('0x7'));var crypto=require(_0x2f7f('0x8'));var jsforce=require(_0x2f7f('0x9'));var deskjs=require(_0x2f7f('0xa'));var toCsv=require(_0x2f7f('0x4'));var querystring=require(_0x2f7f('0xb'));var Papa=require(_0x2f7f('0xc'));var Redis=require('ioredis');var authService=require(_0x2f7f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x2f7f('0xe'));var hardwareService=require(_0x2f7f('0xf'));var logger=require(_0x2f7f('0x10'))(_0x2f7f('0x11'));var utils=require(_0x2f7f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2f7f('0x13'));var db=require(_0x2f7f('0x14'))['db'];function respondWithStatusCode(_0x214fb2,_0x1815f7){_0x1815f7=_0x1815f7||0xcc;return function(_0x199512){if(_0x199512){return _0x214fb2[_0x2f7f('0x15')](_0x1815f7);}return _0x214fb2['status'](_0x1815f7)[_0x2f7f('0x16')]();};}function respondWithResult(_0x12356b,_0x388c9a){_0x388c9a=_0x388c9a||0xc8;return function(_0x5ebe46){if(_0x5ebe46){return _0x12356b[_0x2f7f('0x17')](_0x388c9a)[_0x2f7f('0x18')](_0x5ebe46);}};}function respondWithFilteredResult(_0x3cb8df,_0x142575){return function(_0xfbd81c){if(_0xfbd81c){var _0x5e7467=typeof _0x142575[_0x2f7f('0x19')]===_0x2f7f('0x1a')&&typeof _0x142575['limit']===_0x2f7f('0x1a');var _0x11081f=_0xfbd81c[_0x2f7f('0x1b')];var _0x1a5745=_0x5e7467?0x0:_0x142575[_0x2f7f('0x19')];var _0x20eeb9=_0x5e7467?_0xfbd81c[_0x2f7f('0x1b')]:_0x142575[_0x2f7f('0x19')]+_0x142575[_0x2f7f('0x1c')];var _0x222a81;if(_0x20eeb9>=_0x11081f){_0x20eeb9=_0x11081f;_0x222a81=0xc8;}else{_0x222a81=0xce;}_0x3cb8df['status'](_0x222a81);return _0x3cb8df[_0x2f7f('0x1d')]('Content-Range',_0x1a5745+'-'+_0x20eeb9+'/'+_0x11081f)['json'](_0xfbd81c);}return null;};}function patchUpdates(_0x268072){return function(_0xd2d7ba){try{jsonpatch[_0x2f7f('0x1e')](_0xd2d7ba,_0x268072,!![]);}catch(_0x14e573){return BPromise[_0x2f7f('0x1f')](_0x14e573);}return _0xd2d7ba[_0x2f7f('0x20')]();};}function saveUpdates(_0x3ccb01,_0x5ba24a){return function(_0x20363e){if(_0x20363e){return _0x20363e[_0x2f7f('0x21')](_0x3ccb01)[_0x2f7f('0x22')](function(_0x210fd3){return _0x210fd3;});}return null;};}function removeEntity(_0x130828,_0x4b30d7){return function(_0x55b217){if(_0x55b217){return _0x55b217[_0x2f7f('0x23')]()[_0x2f7f('0x22')](function(){_0x130828[_0x2f7f('0x17')](0xcc)[_0x2f7f('0x16')]();});}};}function handleEntityNotFound(_0x14f382,_0x414f38){return function(_0x841322){if(!_0x841322){_0x14f382[_0x2f7f('0x15')](0x194);}return _0x841322;};}function handleError(_0x49cf1c,_0x208ba9){_0x208ba9=_0x208ba9||0x1f4;return function(_0x1ad981){logger[_0x2f7f('0x24')](_0x1ad981[_0x2f7f('0x25')]);if(_0x1ad981[_0x2f7f('0x26')]){delete _0x1ad981[_0x2f7f('0x26')];}_0x49cf1c['status'](_0x208ba9)[_0x2f7f('0x27')](_0x1ad981);};}exports[_0x2f7f('0x28')]=function(_0x20b03e,_0x47fbd0){var _0x3f540b={},_0x2d0303={},_0x2c5ad3={'count':0x0,'rows':[]};var _0x13e5ff=_[_0x2f7f('0x29')](db[_0x2f7f('0x2a')][_0x2f7f('0x2b')],function(_0x20ed16){return{'name':_0x20ed16[_0x2f7f('0x2c')],'type':_0x20ed16['type'][_0x2f7f('0x2d')]};});_0x2d0303[_0x2f7f('0x2e')]=_['map'](_0x13e5ff,_0x2f7f('0x26'));_0x2d0303[_0x2f7f('0x2f')]=_[_0x2f7f('0x30')](_0x20b03e[_0x2f7f('0x2f')]);_0x2d0303['filters']=_['intersection'](_0x2d0303[_0x2f7f('0x2e')],_0x2d0303[_0x2f7f('0x2f')]);_0x3f540b[_0x2f7f('0x31')]=_[_0x2f7f('0x32')](_0x2d0303[_0x2f7f('0x2e')],qs[_0x2f7f('0x33')](_0x20b03e['query'][_0x2f7f('0x33')]));_0x3f540b['attributes']=_0x3f540b[_0x2f7f('0x31')][_0x2f7f('0x34')]?_0x3f540b['attributes']:_0x2d0303[_0x2f7f('0x2e')];if(!_0x20b03e[_0x2f7f('0x2f')]['hasOwnProperty'](_0x2f7f('0x35'))){_0x3f540b['limit']=qs[_0x2f7f('0x1c')](_0x20b03e['query'][_0x2f7f('0x1c')]);_0x3f540b['offset']=qs[_0x2f7f('0x19')](_0x20b03e[_0x2f7f('0x2f')][_0x2f7f('0x19')]);}_0x3f540b['order']=qs[_0x2f7f('0x36')](_0x20b03e[_0x2f7f('0x2f')][_0x2f7f('0x36')]);_0x3f540b['where']=qs[_0x2f7f('0x37')](_['pick'](_0x20b03e[_0x2f7f('0x2f')],_0x2d0303[_0x2f7f('0x37')]),_0x13e5ff);if(_0x20b03e[_0x2f7f('0x2f')]['filter']){_0x3f540b[_0x2f7f('0x38')]=_[_0x2f7f('0x39')](_0x3f540b[_0x2f7f('0x38')],{'$or':_[_0x2f7f('0x29')](_0x13e5ff,function(_0x148b46){if(_0x148b46[_0x2f7f('0x3a')]!==_0x2f7f('0x3b')){var _0x44f06f={};_0x44f06f[_0x148b46['name']]={'$like':'%'+_0x20b03e[_0x2f7f('0x2f')]['filter']+'%'};return _0x44f06f;}})});}_0x3f540b=_[_0x2f7f('0x39')]({},_0x3f540b,_0x20b03e['options']);var _0x3e0284={'where':_0x3f540b[_0x2f7f('0x38')]};return db[_0x2f7f('0x2a')][_0x2f7f('0x1b')](_0x3e0284)[_0x2f7f('0x22')](function(_0x52ea8c){_0x2c5ad3[_0x2f7f('0x1b')]=_0x52ea8c;if(_0x20b03e[_0x2f7f('0x2f')][_0x2f7f('0x3c')]){_0x3f540b[_0x2f7f('0x3d')]=[{'all':!![]}];}return db[_0x2f7f('0x2a')][_0x2f7f('0x3e')](_0x3f540b);})[_0x2f7f('0x22')](function(_0xabb530){_0x2c5ad3[_0x2f7f('0x3f')]=_0xabb530;return _0x2c5ad3;})['then'](respondWithFilteredResult(_0x47fbd0,_0x3f540b))[_0x2f7f('0x40')](handleError(_0x47fbd0,null));};exports[_0x2f7f('0x41')]=function(_0x1e35d0,_0x12dcae){var _0x4e83f6={'raw':!![],'where':{'id':_0x1e35d0[_0x2f7f('0x42')]['id']}},_0x80d0ce={};_0x80d0ce[_0x2f7f('0x2e')]=_['keys'](db['SquareDetailsReport'][_0x2f7f('0x2b')]);_0x80d0ce['query']=_[_0x2f7f('0x30')](_0x1e35d0[_0x2f7f('0x2f')]);_0x80d0ce[_0x2f7f('0x37')]=_[_0x2f7f('0x32')](_0x80d0ce[_0x2f7f('0x2e')],_0x80d0ce[_0x2f7f('0x2f')]);_0x4e83f6[_0x2f7f('0x31')]=_[_0x2f7f('0x32')](_0x80d0ce[_0x2f7f('0x2e')],qs[_0x2f7f('0x33')](_0x1e35d0['query'][_0x2f7f('0x33')]));_0x4e83f6[_0x2f7f('0x31')]=_0x4e83f6[_0x2f7f('0x31')]['length']?_0x4e83f6[_0x2f7f('0x31')]:_0x80d0ce[_0x2f7f('0x2e')];if(_0x1e35d0[_0x2f7f('0x2f')]['includeAll']){_0x4e83f6[_0x2f7f('0x3d')]=[{'all':!![]}];}_0x4e83f6=_[_0x2f7f('0x39')]({},_0x4e83f6,_0x1e35d0[_0x2f7f('0x43')]);return db[_0x2f7f('0x2a')][_0x2f7f('0x44')](_0x4e83f6)[_0x2f7f('0x22')](handleEntityNotFound(_0x12dcae,null))[_0x2f7f('0x22')](respondWithResult(_0x12dcae,null))[_0x2f7f('0x40')](handleError(_0x12dcae,null));};exports[_0x2f7f('0x45')]=function(_0x4688cd,_0x4edc8d){return db[_0x2f7f('0x2a')][_0x2f7f('0x45')](_0x4688cd[_0x2f7f('0x46')],{})[_0x2f7f('0x22')](respondWithResult(_0x4edc8d,0xc9))['catch'](handleError(_0x4edc8d,null));};exports[_0x2f7f('0x21')]=function(_0x57fee0,_0x530e5c){if(_0x57fee0['body']['id']){delete _0x57fee0[_0x2f7f('0x46')]['id'];}return db[_0x2f7f('0x2a')]['find']({'where':{'id':_0x57fee0[_0x2f7f('0x42')]['id']}})['then'](handleEntityNotFound(_0x530e5c,null))[_0x2f7f('0x22')](saveUpdates(_0x57fee0[_0x2f7f('0x46')],null))['then'](respondWithResult(_0x530e5c,null))[_0x2f7f('0x40')](handleError(_0x530e5c,null));};exports[_0x2f7f('0x23')]=function(_0x2118d6,_0x49e779){return db[_0x2f7f('0x2a')][_0x2f7f('0x44')]({'where':{'id':_0x2118d6['params']['id']}})['then'](handleEntityNotFound(_0x49e779,null))[_0x2f7f('0x22')](removeEntity(_0x49e779,null))[_0x2f7f('0x40')](handleError(_0x49e779,null));};exports[_0x2f7f('0x47')]=function(_0x3d3ced,_0x3a1179){return db[_0x2f7f('0x2a')][_0x2f7f('0x47')]()[_0x2f7f('0x22')](respondWithResult(_0x3a1179,null))[_0x2f7f('0x40')](handleError(_0x3a1179,null));}; \ No newline at end of file +var _0x27a2=['reject','save','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','key','keys','query','filters','intersection','attributes','model','length','nolimit','order','sort','pick','filter','where','merge','type','options','rows','catch','show','fields','includeAll','include','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x27a2,0x14c));var _0x227a=function(_0x54662c,_0x46e31e){_0x54662c=_0x54662c-0x0;var _0x4e7ddb=_0x27a2[_0x54662c];return _0x4e7ddb;};'use strict';var emlformat=require(_0x227a('0x0'));var rimraf=require(_0x227a('0x1'));var zipdir=require(_0x227a('0x2'));var jsonpatch=require(_0x227a('0x3'));var rp=require(_0x227a('0x4'));var moment=require(_0x227a('0x5'));var BPromise=require(_0x227a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x227a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x227a('0x8'));var _=require(_0x227a('0x9'));var squel=require(_0x227a('0xa'));var crypto=require(_0x227a('0xb'));var jsforce=require(_0x227a('0xc'));var deskjs=require(_0x227a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x227a('0xe'));var qs=require(_0x227a('0xf'));var as=require(_0x227a('0x10'));var hardwareService=require(_0x227a('0x11'));var logger=require(_0x227a('0x12'))(_0x227a('0x13'));var utils=require(_0x227a('0x14'));var config=require(_0x227a('0x15'));var licenseUtil=require(_0x227a('0x16'));var db=require(_0x227a('0x17'))['db'];function respondWithStatusCode(_0x460497,_0x1ed04e){_0x1ed04e=_0x1ed04e||0xcc;return function(_0x5f1d69){if(_0x5f1d69){return _0x460497[_0x227a('0x18')](_0x1ed04e);}return _0x460497[_0x227a('0x19')](_0x1ed04e)[_0x227a('0x1a')]();};}function respondWithResult(_0x2027a3,_0x1f8591){_0x1f8591=_0x1f8591||0xc8;return function(_0xb589a6){if(_0xb589a6){return _0x2027a3[_0x227a('0x19')](_0x1f8591)[_0x227a('0x1b')](_0xb589a6);}};}function respondWithFilteredResult(_0xc2e6ea,_0x393568){return function(_0x520529){if(_0x520529){var _0x21f714=typeof _0x393568[_0x227a('0x1c')]===_0x227a('0x1d')&&typeof _0x393568[_0x227a('0x1e')]===_0x227a('0x1d');var _0xdfd715=_0x520529['count'];var _0x36574e=_0x21f714?0x0:_0x393568[_0x227a('0x1c')];var _0x4c6484=_0x21f714?_0x520529[_0x227a('0x1f')]:_0x393568[_0x227a('0x1c')]+_0x393568[_0x227a('0x1e')];var _0x11abdb;if(_0x4c6484>=_0xdfd715){_0x4c6484=_0xdfd715;_0x11abdb=0xc8;}else{_0x11abdb=0xce;}_0xc2e6ea[_0x227a('0x19')](_0x11abdb);return _0xc2e6ea['set']('Content-Range',_0x36574e+'-'+_0x4c6484+'/'+_0xdfd715)[_0x227a('0x1b')](_0x520529);}return null;};}function patchUpdates(_0x4dd997){return function(_0x4ca805){try{jsonpatch[_0x227a('0x20')](_0x4ca805,_0x4dd997,!![]);}catch(_0x56970e){return BPromise[_0x227a('0x21')](_0x56970e);}return _0x4ca805[_0x227a('0x22')]();};}function saveUpdates(_0xdb0a38,_0x376dc4){return function(_0x53b81e){if(_0x53b81e){return _0x53b81e[_0x227a('0x23')](_0xdb0a38)[_0x227a('0x24')](function(_0x1d2603){return _0x1d2603;});}return null;};}function removeEntity(_0x2a7f60,_0x3b7d9e){return function(_0x5b0de8){if(_0x5b0de8){return _0x5b0de8[_0x227a('0x25')]()[_0x227a('0x24')](function(){_0x2a7f60[_0x227a('0x19')](0xcc)[_0x227a('0x1a')]();});}};}function handleEntityNotFound(_0x574a4c,_0x19a8d7){return function(_0x84973){if(!_0x84973){_0x574a4c[_0x227a('0x18')](0x194);}return _0x84973;};}function handleError(_0x57e7fb,_0x4f0832){_0x4f0832=_0x4f0832||0x1f4;return function(_0x3cb337){logger[_0x227a('0x26')](_0x3cb337[_0x227a('0x27')]);if(_0x3cb337[_0x227a('0x28')]){delete _0x3cb337[_0x227a('0x28')];}_0x57e7fb[_0x227a('0x19')](_0x4f0832)[_0x227a('0x29')](_0x3cb337);};}exports[_0x227a('0x2a')]=function(_0x1062c8,_0x42de13){var _0x58a7f={},_0x2a6867={},_0x500e38={'count':0x0,'rows':[]};var _0x2e68e3=_[_0x227a('0x2b')](db[_0x227a('0x2c')]['rawAttributes'],function(_0x5cc069){return{'name':_0x5cc069['fieldName'],'type':_0x5cc069['type'][_0x227a('0x2d')]};});_0x2a6867['model']=_['map'](_0x2e68e3,_0x227a('0x28'));_0x2a6867['query']=_[_0x227a('0x2e')](_0x1062c8[_0x227a('0x2f')]);_0x2a6867[_0x227a('0x30')]=_[_0x227a('0x31')](_0x2a6867['model'],_0x2a6867['query']);_0x58a7f[_0x227a('0x32')]=_[_0x227a('0x31')](_0x2a6867[_0x227a('0x33')],qs['fields'](_0x1062c8[_0x227a('0x2f')]['fields']));_0x58a7f[_0x227a('0x32')]=_0x58a7f[_0x227a('0x32')][_0x227a('0x34')]?_0x58a7f[_0x227a('0x32')]:_0x2a6867['model'];if(!_0x1062c8[_0x227a('0x2f')]['hasOwnProperty'](_0x227a('0x35'))){_0x58a7f[_0x227a('0x1e')]=qs[_0x227a('0x1e')](_0x1062c8[_0x227a('0x2f')][_0x227a('0x1e')]);_0x58a7f['offset']=qs[_0x227a('0x1c')](_0x1062c8[_0x227a('0x2f')]['offset']);}_0x58a7f[_0x227a('0x36')]=qs[_0x227a('0x37')](_0x1062c8[_0x227a('0x2f')]['sort']);_0x58a7f['where']=qs[_0x227a('0x30')](_[_0x227a('0x38')](_0x1062c8['query'],_0x2a6867[_0x227a('0x30')]),_0x2e68e3);if(_0x1062c8[_0x227a('0x2f')][_0x227a('0x39')]){_0x58a7f[_0x227a('0x3a')]=_[_0x227a('0x3b')](_0x58a7f['where'],{'$or':_['map'](_0x2e68e3,function(_0x24c74a){if(_0x24c74a[_0x227a('0x3c')]!=='VIRTUAL'){var _0x3863b4={};_0x3863b4[_0x24c74a[_0x227a('0x28')]]={'$like':'%'+_0x1062c8[_0x227a('0x2f')][_0x227a('0x39')]+'%'};return _0x3863b4;}})});}_0x58a7f=_['merge']({},_0x58a7f,_0x1062c8[_0x227a('0x3d')]);var _0x586272={'where':_0x58a7f['where']};return db[_0x227a('0x2c')]['count'](_0x586272)[_0x227a('0x24')](function(_0x1707ee){_0x500e38[_0x227a('0x1f')]=_0x1707ee;if(_0x1062c8['query']['includeAll']){_0x58a7f['include']=[{'all':!![]}];}return db[_0x227a('0x2c')]['findAll'](_0x58a7f);})[_0x227a('0x24')](function(_0x1f5966){_0x500e38[_0x227a('0x3e')]=_0x1f5966;return _0x500e38;})[_0x227a('0x24')](respondWithFilteredResult(_0x42de13,_0x58a7f))[_0x227a('0x3f')](handleError(_0x42de13,null));};exports[_0x227a('0x40')]=function(_0x247597,_0x2cb376){var _0xdf56b0={'raw':!![],'where':{'id':_0x247597['params']['id']}},_0x6d7e4f={};_0x6d7e4f['model']=_[_0x227a('0x2e')](db['SquareDetailsReport']['rawAttributes']);_0x6d7e4f[_0x227a('0x2f')]=_['keys'](_0x247597[_0x227a('0x2f')]);_0x6d7e4f[_0x227a('0x30')]=_[_0x227a('0x31')](_0x6d7e4f['model'],_0x6d7e4f[_0x227a('0x2f')]);_0xdf56b0[_0x227a('0x32')]=_[_0x227a('0x31')](_0x6d7e4f['model'],qs['fields'](_0x247597[_0x227a('0x2f')][_0x227a('0x41')]));_0xdf56b0['attributes']=_0xdf56b0[_0x227a('0x32')][_0x227a('0x34')]?_0xdf56b0[_0x227a('0x32')]:_0x6d7e4f['model'];if(_0x247597[_0x227a('0x2f')][_0x227a('0x42')]){_0xdf56b0[_0x227a('0x43')]=[{'all':!![]}];}_0xdf56b0=_[_0x227a('0x3b')]({},_0xdf56b0,_0x247597['options']);return db[_0x227a('0x2c')]['find'](_0xdf56b0)[_0x227a('0x24')](handleEntityNotFound(_0x2cb376,null))['then'](respondWithResult(_0x2cb376,null))[_0x227a('0x3f')](handleError(_0x2cb376,null));};exports[_0x227a('0x44')]=function(_0x2a6a3d,_0xb9689d){return db[_0x227a('0x2c')][_0x227a('0x44')](_0x2a6a3d['body'],{})[_0x227a('0x24')](respondWithResult(_0xb9689d,0xc9))[_0x227a('0x3f')](handleError(_0xb9689d,null));};exports[_0x227a('0x23')]=function(_0x47ac83,_0x1840fb){if(_0x47ac83[_0x227a('0x45')]['id']){delete _0x47ac83[_0x227a('0x45')]['id'];}return db[_0x227a('0x2c')][_0x227a('0x46')]({'where':{'id':_0x47ac83[_0x227a('0x47')]['id']}})[_0x227a('0x24')](handleEntityNotFound(_0x1840fb,null))[_0x227a('0x24')](saveUpdates(_0x47ac83['body'],null))['then'](respondWithResult(_0x1840fb,null))[_0x227a('0x3f')](handleError(_0x1840fb,null));};exports[_0x227a('0x25')]=function(_0x5b7140,_0x29968a){return db[_0x227a('0x2c')][_0x227a('0x46')]({'where':{'id':_0x5b7140[_0x227a('0x47')]['id']}})[_0x227a('0x24')](handleEntityNotFound(_0x29968a,null))[_0x227a('0x24')](removeEntity(_0x29968a,null))['catch'](handleError(_0x29968a,null));};exports[_0x227a('0x48')]=function(_0x448717,_0x2dee22){return db[_0x227a('0x2c')]['describe']()[_0x227a('0x24')](respondWithResult(_0x2dee22,null))['catch'](handleError(_0x2dee22,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b1d80b2..56c6416 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 _0x7484=['report_square_details','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x7484,0x90));var _0x4748=function(_0x18daeb,_0x1b8ff3){_0x18daeb=_0x18daeb-0x0;var _0x425a30=_0x7484[_0x18daeb];return _0x425a30;};'use strict';var _=require('lodash');var util=require(_0x4748('0x0'));var logger=require(_0x4748('0x1'))(_0x4748('0x2'));var moment=require(_0x4748('0x3'));var BPromise=require('bluebird');var rp=require(_0x4748('0x4'));var fs=require('fs');var path=require(_0x4748('0x5'));var rimraf=require(_0x4748('0x6'));var config=require(_0x4748('0x7'));var attributes=require(_0x4748('0x8'));module[_0x4748('0x9')]=function(_0x54d64d,_0x3c9813){return _0x54d64d['define']('SquareDetailsReport',attributes,{'tableName':_0x4748('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff54=['rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x372814,_0x56bb08){var _0x5372bb=function(_0x352dcf){while(--_0x352dcf){_0x372814['push'](_0x372814['shift']());}};_0x5372bb(++_0x56bb08);}(_0xff54,0x1b9));var _0x4ff5=function(_0x4547b4,_0x12ead2){_0x4547b4=_0x4547b4-0x0;var _0x86458a=_0xff54[_0x4547b4];return _0x86458a;};'use strict';var _=require(_0x4ff5('0x0'));var util=require(_0x4ff5('0x1'));var logger=require(_0x4ff5('0x2'))(_0x4ff5('0x3'));var moment=require(_0x4ff5('0x4'));var BPromise=require('bluebird');var rp=require(_0x4ff5('0x5'));var fs=require('fs');var path=require(_0x4ff5('0x6'));var rimraf=require(_0x4ff5('0x7'));var config=require(_0x4ff5('0x8'));var attributes=require(_0x4ff5('0x9'));module[_0x4ff5('0xa')]=function(_0x3a809e,_0x1d9bd8){return _0x3a809e[_0x4ff5('0xb')](_0x4ff5('0xc'),attributes,{'tableName':_0x4ff5('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 8d6a768..ab8a067 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 _0x395c=['stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s'];(function(_0x57df1a,_0x56541f){var _0x3ade9d=function(_0x30efbe){while(--_0x30efbe){_0x57df1a['push'](_0x57df1a['shift']());}};_0x3ade9d(++_0x56541f);}(_0x395c,0x1f2));var _0xc395=function(_0x2cbb77,_0x54ec25){_0x2cbb77=_0x2cbb77-0x0;var _0xd3cd30=_0x395c[_0x2cbb77];return _0xd3cd30;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc395('0x0'));var BPromise=require('bluebird');var rs=require(_0xc395('0x1'));var fs=require('fs');var Redis=require(_0xc395('0x2'));var db=require(_0xc395('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc395('0x4'))(_0xc395('0x5'));var config=require(_0xc395('0x6'));var jayson=require(_0xc395('0x7'));var client=jayson[_0xc395('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa28ef7,_0x23a73c,_0x58dee7){return new BPromise(function(_0x2933fd,_0x5a10d5){return client[_0xc395('0x9')](_0xa28ef7,_0x58dee7)[_0xc395('0xa')](function(_0xa2d29e){logger[_0xc395('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x23a73c,_0xc395('0xc'));logger[_0xc395('0xd')](_0xc395('0xe'),_0x23a73c,_0xc395('0xc'),JSON[_0xc395('0xf')](_0xa2d29e));if(_0xa2d29e[_0xc395('0x10')]){if(_0xa2d29e[_0xc395('0x10')][_0xc395('0x11')]===0x1f4){logger[_0xc395('0x10')](_0xc395('0x12'),_0x23a73c,_0xa2d29e['error'][_0xc395('0x13')]);return _0x5a10d5(_0xa2d29e[_0xc395('0x10')][_0xc395('0x13')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x23a73c,_0xa2d29e['error'][_0xc395('0x13')]);return _0x2933fd(_0xa2d29e['error'][_0xc395('0x13')]);}else{logger[_0xc395('0xb')](_0xc395('0x12'),_0x23a73c,_0xc395('0xc'));_0x2933fd(_0xa2d29e[_0xc395('0x14')]['message']);}})['catch'](function(_0x10eea6){logger[_0xc395('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x23a73c,_0x10eea6);_0x5a10d5(_0x10eea6);});});}exports[_0xc395('0x15')]=function(_0x2586bd){var _0x40e6fe=this;return new Promise(function(_0xae8ffa,_0xd26725){return db[_0xc395('0x16')][_0xc395('0x17')](_0x2586bd[_0xc395('0x18')],{'raw':_0x2586bd[_0xc395('0x19')]?_0x2586bd[_0xc395('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x43779e){logger[_0xc395('0xb')](_0xc395('0x15'),_0x2586bd);logger[_0xc395('0xd')](_0xc395('0x15'),_0x2586bd,JSON[_0xc395('0xf')](_0x43779e));_0xae8ffa(_0x43779e);})[_0xc395('0x1a')](function(_0x449e03){logger['error']('CreateSquareDetailsReport',_0x449e03[_0xc395('0x13')],_0x2586bd);_0xd26725(_0x40e6fe[_0xc395('0x10')](0x1f4,_0x449e03['message']));});});}; \ No newline at end of file +var _0xe8e9=['message','catch','CreateSquareDetailsReport','create','body','options','raw','debug','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4d139e,_0xf3a49f){var _0x129301=function(_0x5e308a){while(--_0x5e308a){_0x4d139e['push'](_0x4d139e['shift']());}};_0x129301(++_0xf3a49f);}(_0xe8e9,0xaa));var _0x9e8e=function(_0x14b3e1,_0x5a5514){_0x14b3e1=_0x14b3e1-0x0;var _0x4cb831=_0xe8e9[_0x14b3e1];return _0x4cb831;};'use strict';var _=require(_0x9e8e('0x0'));var util=require(_0x9e8e('0x1'));var moment=require(_0x9e8e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e8e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9e8e('0x4'))(_0x9e8e('0x5'));var config=require(_0x9e8e('0x6'));var jayson=require(_0x9e8e('0x7'));var client=jayson[_0x9e8e('0x8')][_0x9e8e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b5df7,_0xc84796,_0x205f55){return new BPromise(function(_0x28dc93,_0x421041){return client[_0x9e8e('0xa')](_0x5b5df7,_0x205f55)[_0x9e8e('0xb')](function(_0x3cf2bd){logger[_0x9e8e('0xc')](_0x9e8e('0xd'),_0xc84796,_0x9e8e('0xe'));logger['debug'](_0x9e8e('0xf'),_0xc84796,_0x9e8e('0xe'),JSON[_0x9e8e('0x10')](_0x3cf2bd));if(_0x3cf2bd[_0x9e8e('0x11')]){if(_0x3cf2bd[_0x9e8e('0x11')][_0x9e8e('0x12')]===0x1f4){logger[_0x9e8e('0x11')](_0x9e8e('0xd'),_0xc84796,_0x3cf2bd[_0x9e8e('0x11')][_0x9e8e('0x13')]);return _0x421041(_0x3cf2bd[_0x9e8e('0x11')][_0x9e8e('0x13')]);}logger[_0x9e8e('0x11')](_0x9e8e('0xd'),_0xc84796,_0x3cf2bd[_0x9e8e('0x11')][_0x9e8e('0x13')]);return _0x28dc93(_0x3cf2bd['error']['message']);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0xc84796,'request\x20sent');_0x28dc93(_0x3cf2bd['result'][_0x9e8e('0x13')]);}})[_0x9e8e('0x14')](function(_0x28ec20){logger[_0x9e8e('0x11')](_0x9e8e('0xd'),_0xc84796,_0x28ec20);_0x421041(_0x28ec20);});});}exports[_0x9e8e('0x15')]=function(_0x259b88){var _0x1d1624=this;return new Promise(function(_0x5618ac,_0x2d5d73){return db['SquareDetailsReport'][_0x9e8e('0x16')](_0x259b88[_0x9e8e('0x17')],{'raw':_0x259b88[_0x9e8e('0x18')]?_0x259b88[_0x9e8e('0x18')][_0x9e8e('0x19')]===undefined?!![]:![]:!![]})[_0x9e8e('0xb')](function(_0x3ef2a2){logger['info']('CreateSquareDetailsReport',_0x259b88);logger[_0x9e8e('0x1a')]('CreateSquareDetailsReport',_0x259b88,JSON['stringify'](_0x3ef2a2));_0x5618ac(_0x3ef2a2);})[_0x9e8e('0x14')](function(_0x1e5e11){logger['error']('CreateSquareDetailsReport',_0x1e5e11[_0x9e8e('0x13')],_0x259b88);_0x2d5d73(_0x1d1624[_0x9e8e('0x11')](0x1f4,_0x1e5e11[_0x9e8e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 26d35e5..f29ffbe 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 _0xeeaf=['killProcess','express','Router','../../components/auth/service','./system.controller','isAuthenticated','index','get'];(function(_0x4e52cb,_0x2beb23){var _0x3c002f=function(_0x204a63){while(--_0x204a63){_0x4e52cb['push'](_0x4e52cb['shift']());}};_0x3c002f(++_0x2beb23);}(_0xeeaf,0x159));var _0xfeea=function(_0x22fc33,_0x421e9e){_0x22fc33=_0x22fc33-0x0;var _0x33a1c9=_0xeeaf[_0x22fc33];return _0x33a1c9;};'use strict';var express=require(_0xfeea('0x0'));var router=express[_0xfeea('0x1')]();var auth=require(_0xfeea('0x2'));var controller=require(_0xfeea('0x3'));router['get']('/',auth[_0xfeea('0x4')](),controller[_0xfeea('0x5')]);router[_0xfeea('0x6')]('/process/:pid/kill',auth[_0xfeea('0x4')](),controller[_0xfeea('0x7')]);module['exports']=router; \ No newline at end of file +var _0xa283=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0xa283,0x8e));var _0x3a28=function(_0x1ebac8,_0x3ee47c){_0x1ebac8=_0x1ebac8-0x0;var _0x423080=_0xa283[_0x1ebac8];return _0x423080;};'use strict';var express=require(_0x3a28('0x0'));var router=express[_0x3a28('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x3a28('0x2'));router[_0x3a28('0x3')]('/',auth[_0x3a28('0x4')](),controller[_0x3a28('0x5')]);router[_0x3a28('0x3')](_0x3a28('0x6'),auth['isAuthenticated'](),controller[_0x3a28('0x7')]);module[_0x3a28('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 942ac22..bc3586e 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 _0x4f52=['status','send','index','getAllData','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','then','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name'];(function(_0x4d2a51,_0x4b208c){var _0x7d9ab2=function(_0x4face1){while(--_0x4face1){_0x4d2a51['push'](_0x4d2a51['shift']());}};_0x7d9ab2(++_0x4b208c);}(_0x4f52,0x18c));var _0x24f5=function(_0x50fec9,_0x28c6cb){_0x50fec9=_0x50fec9-0x0;var _0x1f6e32=_0x4f52[_0x50fec9];return _0x1f6e32;};'use strict';var info=require(_0x24f5('0x0'));var exec=require(_0x24f5('0x1'))[_0x24f5('0x2')];var logger=require('../../config/logger')(_0x24f5('0x3'));var util=require('util');var BPromise=require(_0x24f5('0x4'));var _=require(_0x24f5('0x5'));function handleError(_0x35e255,_0x4f0417,_0x298102){_0x4f0417=_0x4f0417||0x1f4;return function(_0x1ceb8b){logger[_0x24f5('0x6')](_0x24f5('0x7'),_0x298102,_0x4f0417,util['inspect'](_0x1ceb8b,{'showHidden':![],'depth':null}));delete _0x1ceb8b[_0x24f5('0x8')];_0x35e255[_0x24f5('0x9')](_0x4f0417)[_0x24f5('0xa')](_0x1ceb8b);};}exports[_0x24f5('0xb')]=function(_0x7df5f1,_0x2b83b7){return info[_0x24f5('0xc')]()['then'](function(_0x3bcb3e){return _0x2b83b7[_0x24f5('0x9')](0xc8)[_0x24f5('0xd')](_0x3bcb3e);})['catch'](function(_0x14f87a){return _0x2b83b7[_0x24f5('0x9')](0x1f4)[_0x24f5('0xd')](_0x14f87a);});};exports[_0x24f5('0xe')]=function(_0x407a3a,_0x4014cd){var _0x125a08=[_0x24f5('0xf')];return new BPromise(function(_0x3b01dd,_0x1ea8eb){return exec(util[_0x24f5('0x10')](_0x24f5('0x11'),_0x407a3a['params']['pid']),function(_0x4e0bda,_0x1589d0,_0x6ba3da){if(_0x4e0bda){return _0x1ea8eb(_0x4e0bda);}return _0x3b01dd(_0x1589d0);});})[_0x24f5('0x12')](function(_0x1d48b8){var _0x23191c=![];var _0x25f32d=_0x1d48b8[_0x24f5('0x13')](/\n/);for(var _0x279e62=0x0,_0x1c9e76=_0x125a08[_0x24f5('0x14')];_0x279e62<_0x1c9e76,_0x23191c===![];_0x279e62+=0x1){if(_0x1d48b8['indexOf'](_0x125a08[_0x279e62])>=0x0){_0x23191c=!![];}}if(!_0x23191c){throw new Error(util[_0x24f5('0x10')](_0x24f5('0x15'),_0x407a3a['params'][_0x24f5('0x16')]));}process[_0x24f5('0x17')](_0x407a3a[_0x24f5('0x18')]['pid'],_0x24f5('0x19'));return _0x4014cd[_0x24f5('0x9')](0xc8)[_0x24f5('0xd')]({'message':util[_0x24f5('0x10')](_0x24f5('0x1a'),_0x407a3a[_0x24f5('0x18')]['pid'])});})['catch'](handleError(_0x4014cd,null,_0x24f5('0xe')));}; \ No newline at end of file +var _0x3f19=['Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','exec','../../config/logger','api','util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','json','catch','format','params','pid','then','length','indexOf'];(function(_0x15a099,_0x4eb0c1){var _0x8f248c=function(_0x4e4153){while(--_0x4e4153){_0x15a099['push'](_0x15a099['shift']());}};_0x8f248c(++_0x4eb0c1);}(_0x3f19,0x157));var _0x93f1=function(_0x265e81,_0x514eff){_0x265e81=_0x265e81-0x0;var _0x55b6b7=_0x3f19[_0x265e81];return _0x55b6b7;};'use strict';var info=require(_0x93f1('0x0'));var exec=require(_0x93f1('0x1'))[_0x93f1('0x2')];var logger=require(_0x93f1('0x3'))(_0x93f1('0x4'));var util=require(_0x93f1('0x5'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0xfe1dd2,_0x4bbaec,_0x508fb3){_0x4bbaec=_0x4bbaec||0x1f4;return function(_0x497da9){logger[_0x93f1('0x6')](_0x93f1('0x7'),_0x508fb3,_0x4bbaec,util[_0x93f1('0x8')](_0x497da9,{'showHidden':![],'depth':null}));delete _0x497da9['name'];_0xfe1dd2[_0x93f1('0x9')](_0x4bbaec)[_0x93f1('0xa')](_0x497da9);};}exports[_0x93f1('0xb')]=function(_0x777192,_0x3f2c53){return info[_0x93f1('0xc')]()['then'](function(_0x47762e){return _0x3f2c53[_0x93f1('0x9')](0xc8)[_0x93f1('0xd')](_0x47762e);})[_0x93f1('0xe')](function(_0x2e3a49){return _0x3f2c53[_0x93f1('0x9')](0x1f4)[_0x93f1('0xd')](_0x2e3a49);});};exports['killProcess']=function(_0x55b644,_0x4750b5){var _0x1eca00=['components/import/cm'];return new BPromise(function(_0x2d6e80,_0x413ab2){return exec(util[_0x93f1('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x55b644[_0x93f1('0x10')][_0x93f1('0x11')]),function(_0x70b802,_0x814e22,_0xc27431){if(_0x70b802){return _0x413ab2(_0x70b802);}return _0x2d6e80(_0x814e22);});})[_0x93f1('0x12')](function(_0x45e086){var _0x35e29a=![];var _0xf0ba1e=_0x45e086['split'](/\n/);for(var _0xc6a5d2=0x0,_0x5374a5=_0x1eca00[_0x93f1('0x13')];_0xc6a5d2<_0x5374a5,_0x35e29a===![];_0xc6a5d2+=0x1){if(_0x45e086[_0x93f1('0x14')](_0x1eca00[_0xc6a5d2])>=0x0){_0x35e29a=!![];}}if(!_0x35e29a){throw new Error(util[_0x93f1('0xf')](_0x93f1('0x15'),_0x55b644[_0x93f1('0x10')][_0x93f1('0x11')]));}process[_0x93f1('0x16')](_0x55b644['params'][_0x93f1('0x11')],_0x93f1('0x17'));return _0x4750b5[_0x93f1('0x9')](0xc8)['json']({'message':util[_0x93f1('0xf')](_0x93f1('0x18'),_0x55b644[_0x93f1('0x10')][_0x93f1('0x11')])});})['catch'](handleError(_0x4750b5,null,_0x93f1('0x19')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 55812eb..76d8f56 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 _0x0141=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index'];(function(_0x2df7c7,_0x5ec3eb){var _0x42995b=function(_0x294b44){while(--_0x294b44){_0x2df7c7['push'](_0x2df7c7['shift']());}};_0x42995b(++_0x5ec3eb);}(_0x0141,0xbe));var _0x1014=function(_0x60b050,_0x3d2b9d){_0x60b050=_0x60b050-0x0;var _0x1d1e58=_0x0141[_0x60b050];return _0x1d1e58;};'use strict';var multer=require('multer');var util=require(_0x1014('0x0'));var path=require('path');var timeout=require(_0x1014('0x1'));var express=require(_0x1014('0x2'));var router=express['Router']();var fs_extra=require(_0x1014('0x3'));var auth=require(_0x1014('0x4'));var interaction=require(_0x1014('0x5'));var config=require(_0x1014('0x6'));var controller=require(_0x1014('0x7'));router[_0x1014('0x8')]('/',auth['isAuthenticated'](),controller[_0x1014('0x9')]);router['get'](_0x1014('0xa'),auth[_0x1014('0xb')](),controller[_0x1014('0xc')]);router[_0x1014('0xd')]('/',auth[_0x1014('0xb')](),controller[_0x1014('0xe')]);router[_0x1014('0xf')]('/:id',auth[_0x1014('0xb')](),controller[_0x1014('0x10')]);router[_0x1014('0x11')](_0x1014('0xa'),auth[_0x1014('0xb')](),controller[_0x1014('0x12')]);module[_0x1014('0x13')]=router; \ No newline at end of file +var _0xbacf=['express','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0xc0b7f7,_0x3eb5e5){var _0x48ab14=function(_0x51d6a0){while(--_0x51d6a0){_0xc0b7f7['push'](_0xc0b7f7['shift']());}};_0x48ab14(++_0x3eb5e5);}(_0xbacf,0xf9));var _0xfbac=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xbacf[_0x4e4f0e];return _0x1a7219;};'use strict';var multer=require('multer');var util=require(_0xfbac('0x0'));var path=require(_0xfbac('0x1'));var timeout=require(_0xfbac('0x2'));var express=require(_0xfbac('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfbac('0x4'));var config=require(_0xfbac('0x5'));var controller=require(_0xfbac('0x6'));router[_0xfbac('0x7')]('/',auth[_0xfbac('0x8')](),controller[_0xfbac('0x9')]);router[_0xfbac('0x7')](_0xfbac('0xa'),auth['isAuthenticated'](),controller[_0xfbac('0xb')]);router[_0xfbac('0xc')]('/',auth[_0xfbac('0x8')](),controller[_0xfbac('0xd')]);router[_0xfbac('0xe')](_0xfbac('0xa'),auth[_0xfbac('0x8')](),controller['update']);router[_0xfbac('0xf')](_0xfbac('0xa'),auth[_0xfbac('0x8')](),controller[_0xfbac('0x10')]);module[_0xfbac('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9436a0b..83691b3 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 _0x5eb8=['name','#0091EA','STRING'];(function(_0x98a27a,_0x274d8e){var _0x3e9725=function(_0x2bcef7){while(--_0x2bcef7){_0x98a27a['push'](_0x98a27a['shift']());}};_0x3e9725(++_0x274d8e);}(_0x5eb8,0xb0));var _0x85eb=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x5eb8[_0x44bcb0];return _0xfaf881;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'unique':_0x85eb('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':_0x85eb('0x2')},'description':{'type':Sequelize[_0x85eb('0x0')]}}; \ No newline at end of file +var _0xd8b0=['STRING','sequelize','exports','#0091EA'];(function(_0x51302c,_0x376113){var _0x20f6c1=function(_0x530cb3){while(--_0x530cb3){_0x51302c['push'](_0x51302c['shift']());}};_0x20f6c1(++_0x376113);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0x2')},'description':{'type':Sequelize[_0x0d8b('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 83907a5..e89de97 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 _0x0594=['merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x0594,0xb6));var _0x4059=function(_0x557091,_0x46054f){_0x557091=_0x557091-0x0;var _0x24f766=_0x0594[_0x557091];return _0x24f766;};'use strict';var emlformat=require(_0x4059('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4059('0x1'));var rp=require(_0x4059('0x2'));var moment=require(_0x4059('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4059('0x4'));var util=require(_0x4059('0x5'));var path=require('path');var sox=require(_0x4059('0x6'));var csv=require('to-csv');var ejs=require(_0x4059('0x7'));var fs=require('fs');var fs_extra=require(_0x4059('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4059('0x9'));var jsforce=require(_0x4059('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4059('0xb'));var querystring=require(_0x4059('0xc'));var Papa=require(_0x4059('0xd'));var Redis=require(_0x4059('0xe'));var authService=require(_0x4059('0xf'));var qs=require(_0x4059('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4059('0x11'))(_0x4059('0x12'));var utils=require(_0x4059('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c157f,_0x4db84f){_0x4db84f=_0x4db84f||0xcc;return function(_0x5dcee6){if(_0x5dcee6){return _0x2c157f[_0x4059('0x14')](_0x4db84f);}return _0x2c157f[_0x4059('0x15')](_0x4db84f)['end']();};}function respondWithResult(_0x37a237,_0x2a4c97){_0x2a4c97=_0x2a4c97||0xc8;return function(_0x2e837e){if(_0x2e837e){return _0x37a237[_0x4059('0x15')](_0x2a4c97)['json'](_0x2e837e);}};}function respondWithFilteredResult(_0x4c3935,_0x437f00){return function(_0x54ecc5){if(_0x54ecc5){var _0x58fc24=typeof _0x437f00[_0x4059('0x16')]===_0x4059('0x17')&&typeof _0x437f00['limit']===_0x4059('0x17');var _0x4dedb9=_0x54ecc5['count'];var _0x49b26d=_0x58fc24?0x0:_0x437f00[_0x4059('0x16')];var _0x2fc392=_0x58fc24?_0x54ecc5[_0x4059('0x18')]:_0x437f00[_0x4059('0x16')]+_0x437f00[_0x4059('0x19')];var _0x3fd3bb;if(_0x2fc392>=_0x4dedb9){_0x2fc392=_0x4dedb9;_0x3fd3bb=0xc8;}else{_0x3fd3bb=0xce;}_0x4c3935[_0x4059('0x15')](_0x3fd3bb);return _0x4c3935[_0x4059('0x1a')](_0x4059('0x1b'),_0x49b26d+'-'+_0x2fc392+'/'+_0x4dedb9)['json'](_0x54ecc5);}return null;};}function patchUpdates(_0x231cc7){return function(_0x3c676f){try{jsonpatch[_0x4059('0x1c')](_0x3c676f,_0x231cc7,!![]);}catch(_0x46f43f){return BPromise[_0x4059('0x1d')](_0x46f43f);}return _0x3c676f[_0x4059('0x1e')]();};}function saveUpdates(_0x21ac3b,_0x49f85d){return function(_0x303bbf){if(_0x303bbf){return _0x303bbf[_0x4059('0x1f')](_0x21ac3b)[_0x4059('0x20')](function(_0x29e3f5){return _0x29e3f5;});}return null;};}function removeEntity(_0x5c118d,_0x4a8845){return function(_0x52a3e6){if(_0x52a3e6){return _0x52a3e6[_0x4059('0x21')]()[_0x4059('0x20')](function(){var _0x9ebf79=_0x52a3e6[_0x4059('0x22')]({'plain':!![]});var _0x19be15='Tags';return db['UserProfileResource'][_0x4059('0x21')]({'where':{'type':_0x19be15,'resourceId':_0x9ebf79['id']}})[_0x4059('0x20')](function(){return _0x52a3e6;});})[_0x4059('0x20')](function(){_0x5c118d[_0x4059('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2379de,_0x2c7844){return function(_0x44c030){if(!_0x44c030){_0x2379de[_0x4059('0x14')](0x194);}return _0x44c030;};}function handleError(_0x1d5b77,_0x30e474){_0x30e474=_0x30e474||0x1f4;return function(_0x1b3998){logger[_0x4059('0x23')](_0x1b3998[_0x4059('0x24')]);if(_0x1b3998['name']){delete _0x1b3998[_0x4059('0x25')];}_0x1d5b77[_0x4059('0x15')](_0x30e474)[_0x4059('0x26')](_0x1b3998);};}exports['index']=function(_0x55e310,_0x445527){var _0x14d352={},_0xc73b78={},_0x5e62cf={'count':0x0,'rows':[]};var _0x26cc7d=_[_0x4059('0x27')](db[_0x4059('0x28')][_0x4059('0x29')],function(_0x4598c2){return{'name':_0x4598c2[_0x4059('0x2a')],'type':_0x4598c2[_0x4059('0x2b')][_0x4059('0x2c')]};});_0xc73b78['model']=_[_0x4059('0x27')](_0x26cc7d,_0x4059('0x25'));_0xc73b78[_0x4059('0x2d')]=_['keys'](_0x55e310[_0x4059('0x2d')]);_0xc73b78[_0x4059('0x2e')]=_['intersection'](_0xc73b78['model'],_0xc73b78[_0x4059('0x2d')]);_0x14d352[_0x4059('0x2f')]=_[_0x4059('0x30')](_0xc73b78[_0x4059('0x31')],qs['fields'](_0x55e310[_0x4059('0x2d')]['fields']));_0x14d352[_0x4059('0x2f')]=_0x14d352[_0x4059('0x2f')][_0x4059('0x32')]?_0x14d352['attributes']:_0xc73b78[_0x4059('0x31')];if(!_0x55e310[_0x4059('0x2d')][_0x4059('0x33')](_0x4059('0x34'))){_0x14d352[_0x4059('0x19')]=qs[_0x4059('0x19')](_0x55e310['query'][_0x4059('0x19')]);_0x14d352[_0x4059('0x16')]=qs[_0x4059('0x16')](_0x55e310[_0x4059('0x2d')][_0x4059('0x16')]);}_0x14d352[_0x4059('0x35')]=qs['sort'](_0x55e310[_0x4059('0x2d')][_0x4059('0x36')]);_0x14d352[_0x4059('0x37')]=qs[_0x4059('0x2e')](_[_0x4059('0x38')](_0x55e310[_0x4059('0x2d')],_0xc73b78[_0x4059('0x2e')]),_0x26cc7d);if(_0x55e310[_0x4059('0x2d')][_0x4059('0x39')]){_0x14d352[_0x4059('0x37')]=_[_0x4059('0x3a')](_0x14d352[_0x4059('0x37')],{'$or':_[_0x4059('0x27')](_0x26cc7d,function(_0x288305){if(_0x288305[_0x4059('0x2b')]!=='VIRTUAL'){var _0x18b6d1={};_0x18b6d1[_0x288305[_0x4059('0x25')]]={'$like':'%'+_0x55e310[_0x4059('0x2d')][_0x4059('0x39')]+'%'};return _0x18b6d1;}})});}_0x14d352=_[_0x4059('0x3a')]({},_0x14d352,_0x55e310[_0x4059('0x3b')]);var _0x17aac2={'where':_0x14d352[_0x4059('0x37')]};return db[_0x4059('0x28')][_0x4059('0x18')](_0x17aac2)[_0x4059('0x20')](function(_0x5d18f3){_0x5e62cf[_0x4059('0x18')]=_0x5d18f3;if(_0x55e310[_0x4059('0x2d')][_0x4059('0x3c')]){_0x14d352[_0x4059('0x3d')]=[{'all':!![]}];}return db[_0x4059('0x28')][_0x4059('0x3e')](_0x14d352);})['then'](function(_0x37dafd){_0x5e62cf[_0x4059('0x3f')]=_0x37dafd;return _0x5e62cf;})['then'](respondWithFilteredResult(_0x445527,_0x14d352))[_0x4059('0x40')](handleError(_0x445527,null));};exports[_0x4059('0x41')]=function(_0x446867,_0x5253f1){var _0x11ac24={'raw':!![],'where':{'id':_0x446867[_0x4059('0x42')]['id']}},_0x575e7d={};_0x575e7d[_0x4059('0x31')]=_[_0x4059('0x43')](db[_0x4059('0x28')][_0x4059('0x29')]);_0x575e7d[_0x4059('0x2d')]=_[_0x4059('0x43')](_0x446867[_0x4059('0x2d')]);_0x575e7d['filters']=_[_0x4059('0x30')](_0x575e7d[_0x4059('0x31')],_0x575e7d[_0x4059('0x2d')]);_0x11ac24[_0x4059('0x2f')]=_[_0x4059('0x30')](_0x575e7d[_0x4059('0x31')],qs['fields'](_0x446867['query'][_0x4059('0x44')]));_0x11ac24[_0x4059('0x2f')]=_0x11ac24['attributes'][_0x4059('0x32')]?_0x11ac24[_0x4059('0x2f')]:_0x575e7d[_0x4059('0x31')];if(_0x446867['query']['includeAll']){_0x11ac24[_0x4059('0x3d')]=[{'all':!![]}];}_0x11ac24=_[_0x4059('0x3a')]({},_0x11ac24,_0x446867['options']);return db[_0x4059('0x28')][_0x4059('0x45')](_0x11ac24)[_0x4059('0x20')](handleEntityNotFound(_0x5253f1,null))[_0x4059('0x20')](respondWithResult(_0x5253f1,null))[_0x4059('0x40')](handleError(_0x5253f1,null));};exports[_0x4059('0x46')]=function(_0x519cbb,_0x1ab6a5){return db[_0x4059('0x28')][_0x4059('0x46')](_0x519cbb[_0x4059('0x47')],{})[_0x4059('0x20')](function(_0x1ab7c0){var _0x1c6b55=_0x519cbb[_0x4059('0x48')][_0x4059('0x22')]({'plain':!![]});if(!_0x1c6b55)throw new Error(_0x4059('0x49'));if(_0x1c6b55[_0x4059('0x4a')]==='user'){var _0x31fd7d=_0x1ab7c0['get']({'plain':!![]});var _0x595c10='Tags';return db[_0x4059('0x4b')][_0x4059('0x45')]({'where':{'name':_0x595c10,'userProfileId':_0x1c6b55[_0x4059('0x4c')]},'raw':!![]})['then'](function(_0x5be75b){if(_0x5be75b&&_0x5be75b[_0x4059('0x4d')]===0x0){return db[_0x4059('0x4e')][_0x4059('0x46')]({'name':_0x31fd7d[_0x4059('0x25')],'resourceId':_0x31fd7d['id'],'type':_0x5be75b[_0x4059('0x25')],'sectionId':_0x5be75b['id']},{})[_0x4059('0x20')](function(){return _0x1ab7c0;});}else{return _0x1ab7c0;}})[_0x4059('0x40')](function(_0x2f0201){logger['error'](_0x4059('0x4f'),_0x2f0201);throw _0x2f0201;});}return _0x1ab7c0;})[_0x4059('0x20')](respondWithResult(_0x1ab6a5,0xc9))[_0x4059('0x40')](handleError(_0x1ab6a5,null));};exports[_0x4059('0x1f')]=function(_0x16e749,_0x369bc8){if(_0x16e749[_0x4059('0x47')]['id']){delete _0x16e749[_0x4059('0x47')]['id'];}return db[_0x4059('0x28')][_0x4059('0x45')]({'where':{'id':_0x16e749['params']['id']}})[_0x4059('0x20')](handleEntityNotFound(_0x369bc8,null))['then'](saveUpdates(_0x16e749[_0x4059('0x47')],null))[_0x4059('0x20')](respondWithResult(_0x369bc8,null))[_0x4059('0x40')](handleError(_0x369bc8,null));};exports[_0x4059('0x21')]=function(_0x55652f,_0x331262){return db[_0x4059('0x28')][_0x4059('0x45')]({'where':{'id':_0x55652f[_0x4059('0x42')]['id']}})['then'](handleEntityNotFound(_0x331262,null))[_0x4059('0x20')](removeEntity(_0x331262,null))['catch'](handleError(_0x331262,null));}; \ No newline at end of file +var _0xef08=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','update','then','get','Tags','UserProfileResource','destroy','end','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto'];(function(_0x7f041d,_0x4a28a7){var _0x5daef0=function(_0x4e59ba){while(--_0x4e59ba){_0x7f041d['push'](_0x7f041d['shift']());}};_0x5daef0(++_0x4a28a7);}(_0xef08,0x146));var _0x8ef0=function(_0x3e856b,_0x25d5e9){_0x3e856b=_0x3e856b-0x0;var _0x5eadf3=_0xef08[_0x3e856b];return _0x5eadf3;};'use strict';var emlformat=require(_0x8ef0('0x0'));var rimraf=require(_0x8ef0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ef0('0x2'));var rp=require(_0x8ef0('0x3'));var moment=require(_0x8ef0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8ef0('0x5'));var util=require(_0x8ef0('0x6'));var path=require(_0x8ef0('0x7'));var sox=require(_0x8ef0('0x8'));var csv=require('to-csv');var ejs=require(_0x8ef0('0x9'));var fs=require('fs');var fs_extra=require(_0x8ef0('0xa'));var _=require(_0x8ef0('0xb'));var squel=require(_0x8ef0('0xc'));var crypto=require(_0x8ef0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8ef0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8ef0('0xf'));var Papa=require(_0x8ef0('0x10'));var Redis=require(_0x8ef0('0x11'));var authService=require(_0x8ef0('0x12'));var qs=require(_0x8ef0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ef0('0x14'));var logger=require(_0x8ef0('0x15'))(_0x8ef0('0x16'));var utils=require(_0x8ef0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8ef0('0x18'));var db=require(_0x8ef0('0x19'))['db'];function respondWithStatusCode(_0x2245f7,_0x2f474d){_0x2f474d=_0x2f474d||0xcc;return function(_0x255d82){if(_0x255d82){return _0x2245f7[_0x8ef0('0x1a')](_0x2f474d);}return _0x2245f7[_0x8ef0('0x1b')](_0x2f474d)['end']();};}function respondWithResult(_0x510ce6,_0x25bb41){_0x25bb41=_0x25bb41||0xc8;return function(_0x34e16e){if(_0x34e16e){return _0x510ce6[_0x8ef0('0x1b')](_0x25bb41)['json'](_0x34e16e);}};}function respondWithFilteredResult(_0x45e37b,_0x35dc15){return function(_0x5ba28a){if(_0x5ba28a){var _0x50e9cc=typeof _0x35dc15[_0x8ef0('0x1c')]===_0x8ef0('0x1d')&&typeof _0x35dc15['limit']===_0x8ef0('0x1d');var _0x219645=_0x5ba28a[_0x8ef0('0x1e')];var _0x462927=_0x50e9cc?0x0:_0x35dc15['offset'];var _0x449f16=_0x50e9cc?_0x5ba28a[_0x8ef0('0x1e')]:_0x35dc15['offset']+_0x35dc15[_0x8ef0('0x1f')];var _0x3fef9f;if(_0x449f16>=_0x219645){_0x449f16=_0x219645;_0x3fef9f=0xc8;}else{_0x3fef9f=0xce;}_0x45e37b[_0x8ef0('0x1b')](_0x3fef9f);return _0x45e37b[_0x8ef0('0x20')]('Content-Range',_0x462927+'-'+_0x449f16+'/'+_0x219645)[_0x8ef0('0x21')](_0x5ba28a);}return null;};}function patchUpdates(_0x12aa39){return function(_0x51dc07){try{jsonpatch[_0x8ef0('0x22')](_0x51dc07,_0x12aa39,!![]);}catch(_0x3d999d){return BPromise[_0x8ef0('0x23')](_0x3d999d);}return _0x51dc07['save']();};}function saveUpdates(_0x1a068e,_0x141bb1){return function(_0x3a00b){if(_0x3a00b){return _0x3a00b[_0x8ef0('0x24')](_0x1a068e)[_0x8ef0('0x25')](function(_0x2ffde5){return _0x2ffde5;});}return null;};}function removeEntity(_0x568f0c,_0x4ac317){return function(_0x51d07f){if(_0x51d07f){return _0x51d07f['destroy']()['then'](function(){var _0x4f0305=_0x51d07f[_0x8ef0('0x26')]({'plain':!![]});var _0x4117bf=_0x8ef0('0x27');return db[_0x8ef0('0x28')][_0x8ef0('0x29')]({'where':{'type':_0x4117bf,'resourceId':_0x4f0305['id']}})['then'](function(){return _0x51d07f;});})['then'](function(){_0x568f0c[_0x8ef0('0x1b')](0xcc)[_0x8ef0('0x2a')]();});}};}function handleEntityNotFound(_0x5d91e1,_0x20a391){return function(_0x3daecd){if(!_0x3daecd){_0x5d91e1[_0x8ef0('0x1a')](0x194);}return _0x3daecd;};}function handleError(_0x23d00e,_0x1b96fa){_0x1b96fa=_0x1b96fa||0x1f4;return function(_0x32e9d5){logger['error'](_0x32e9d5[_0x8ef0('0x2b')]);if(_0x32e9d5[_0x8ef0('0x2c')]){delete _0x32e9d5[_0x8ef0('0x2c')];}_0x23d00e[_0x8ef0('0x1b')](_0x1b96fa)['send'](_0x32e9d5);};}exports[_0x8ef0('0x2d')]=function(_0x1335d1,_0x3ba249){var _0x4ab92d={},_0x3527cc={},_0x558196={'count':0x0,'rows':[]};var _0x16f087=_[_0x8ef0('0x2e')](db[_0x8ef0('0x2f')][_0x8ef0('0x30')],function(_0x456202){return{'name':_0x456202[_0x8ef0('0x31')],'type':_0x456202[_0x8ef0('0x32')][_0x8ef0('0x33')]};});_0x3527cc[_0x8ef0('0x34')]=_[_0x8ef0('0x2e')](_0x16f087,'name');_0x3527cc[_0x8ef0('0x35')]=_[_0x8ef0('0x36')](_0x1335d1[_0x8ef0('0x35')]);_0x3527cc['filters']=_[_0x8ef0('0x37')](_0x3527cc[_0x8ef0('0x34')],_0x3527cc[_0x8ef0('0x35')]);_0x4ab92d['attributes']=_[_0x8ef0('0x37')](_0x3527cc[_0x8ef0('0x34')],qs[_0x8ef0('0x38')](_0x1335d1[_0x8ef0('0x35')][_0x8ef0('0x38')]));_0x4ab92d[_0x8ef0('0x39')]=_0x4ab92d['attributes']['length']?_0x4ab92d[_0x8ef0('0x39')]:_0x3527cc[_0x8ef0('0x34')];if(!_0x1335d1[_0x8ef0('0x35')][_0x8ef0('0x3a')](_0x8ef0('0x3b'))){_0x4ab92d['limit']=qs[_0x8ef0('0x1f')](_0x1335d1[_0x8ef0('0x35')][_0x8ef0('0x1f')]);_0x4ab92d[_0x8ef0('0x1c')]=qs[_0x8ef0('0x1c')](_0x1335d1['query'][_0x8ef0('0x1c')]);}_0x4ab92d[_0x8ef0('0x3c')]=qs['sort'](_0x1335d1[_0x8ef0('0x35')][_0x8ef0('0x3d')]);_0x4ab92d[_0x8ef0('0x3e')]=qs['filters'](_[_0x8ef0('0x3f')](_0x1335d1['query'],_0x3527cc[_0x8ef0('0x40')]),_0x16f087);if(_0x1335d1[_0x8ef0('0x35')][_0x8ef0('0x41')]){_0x4ab92d[_0x8ef0('0x3e')]=_[_0x8ef0('0x42')](_0x4ab92d[_0x8ef0('0x3e')],{'$or':_[_0x8ef0('0x2e')](_0x16f087,function(_0x48e7b0){if(_0x48e7b0[_0x8ef0('0x32')]!==_0x8ef0('0x43')){var _0x3b4c78={};_0x3b4c78[_0x48e7b0[_0x8ef0('0x2c')]]={'$like':'%'+_0x1335d1[_0x8ef0('0x35')][_0x8ef0('0x41')]+'%'};return _0x3b4c78;}})});}_0x4ab92d=_['merge']({},_0x4ab92d,_0x1335d1[_0x8ef0('0x44')]);var _0x1f0e47={'where':_0x4ab92d['where']};return db['Tag'][_0x8ef0('0x1e')](_0x1f0e47)[_0x8ef0('0x25')](function(_0x202bd6){_0x558196[_0x8ef0('0x1e')]=_0x202bd6;if(_0x1335d1[_0x8ef0('0x35')][_0x8ef0('0x45')]){_0x4ab92d[_0x8ef0('0x46')]=[{'all':!![]}];}return db[_0x8ef0('0x2f')][_0x8ef0('0x47')](_0x4ab92d);})[_0x8ef0('0x25')](function(_0x2d1b05){_0x558196[_0x8ef0('0x48')]=_0x2d1b05;return _0x558196;})[_0x8ef0('0x25')](respondWithFilteredResult(_0x3ba249,_0x4ab92d))[_0x8ef0('0x49')](handleError(_0x3ba249,null));};exports[_0x8ef0('0x4a')]=function(_0x34c07f,_0x4cb5ef){var _0x4595e3={'raw':!![],'where':{'id':_0x34c07f['params']['id']}},_0x49c736={};_0x49c736[_0x8ef0('0x34')]=_[_0x8ef0('0x36')](db[_0x8ef0('0x2f')][_0x8ef0('0x30')]);_0x49c736[_0x8ef0('0x35')]=_[_0x8ef0('0x36')](_0x34c07f[_0x8ef0('0x35')]);_0x49c736[_0x8ef0('0x40')]=_[_0x8ef0('0x37')](_0x49c736[_0x8ef0('0x34')],_0x49c736['query']);_0x4595e3[_0x8ef0('0x39')]=_[_0x8ef0('0x37')](_0x49c736[_0x8ef0('0x34')],qs[_0x8ef0('0x38')](_0x34c07f[_0x8ef0('0x35')][_0x8ef0('0x38')]));_0x4595e3[_0x8ef0('0x39')]=_0x4595e3[_0x8ef0('0x39')][_0x8ef0('0x4b')]?_0x4595e3[_0x8ef0('0x39')]:_0x49c736[_0x8ef0('0x34')];if(_0x34c07f['query'][_0x8ef0('0x45')]){_0x4595e3[_0x8ef0('0x46')]=[{'all':!![]}];}_0x4595e3=_['merge']({},_0x4595e3,_0x34c07f[_0x8ef0('0x44')]);return db[_0x8ef0('0x2f')]['find'](_0x4595e3)[_0x8ef0('0x25')](handleEntityNotFound(_0x4cb5ef,null))[_0x8ef0('0x25')](respondWithResult(_0x4cb5ef,null))['catch'](handleError(_0x4cb5ef,null));};exports[_0x8ef0('0x4c')]=function(_0x3ffeaa,_0x56fed2){return db['Tag'][_0x8ef0('0x4c')](_0x3ffeaa[_0x8ef0('0x4d')],{})[_0x8ef0('0x25')](function(_0x7edb10){var _0x4a7c1d=_0x3ffeaa[_0x8ef0('0x4e')]['get']({'plain':!![]});if(!_0x4a7c1d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a7c1d[_0x8ef0('0x4f')]===_0x8ef0('0x4e')){var _0x12bdf9=_0x7edb10[_0x8ef0('0x26')]({'plain':!![]});var _0x243527=_0x8ef0('0x27');return db['UserProfileSection'][_0x8ef0('0x50')]({'where':{'name':_0x243527,'userProfileId':_0x4a7c1d[_0x8ef0('0x51')]},'raw':!![]})[_0x8ef0('0x25')](function(_0xdb5248){if(_0xdb5248&&_0xdb5248[_0x8ef0('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x12bdf9[_0x8ef0('0x2c')],'resourceId':_0x12bdf9['id'],'type':_0xdb5248['name'],'sectionId':_0xdb5248['id']},{})[_0x8ef0('0x25')](function(){return _0x7edb10;});}else{return _0x7edb10;}})[_0x8ef0('0x49')](function(_0xbd0a3b){logger['error'](_0x8ef0('0x53'),_0xbd0a3b);throw _0xbd0a3b;});}return _0x7edb10;})[_0x8ef0('0x25')](respondWithResult(_0x56fed2,0xc9))['catch'](handleError(_0x56fed2,null));};exports[_0x8ef0('0x24')]=function(_0x1f9a4,_0x44b09a){if(_0x1f9a4[_0x8ef0('0x4d')]['id']){delete _0x1f9a4[_0x8ef0('0x4d')]['id'];}return db[_0x8ef0('0x2f')]['find']({'where':{'id':_0x1f9a4[_0x8ef0('0x54')]['id']}})[_0x8ef0('0x25')](handleEntityNotFound(_0x44b09a,null))[_0x8ef0('0x25')](saveUpdates(_0x1f9a4[_0x8ef0('0x4d')],null))[_0x8ef0('0x25')](respondWithResult(_0x44b09a,null))['catch'](handleError(_0x44b09a,null));};exports[_0x8ef0('0x29')]=function(_0x3381dd,_0x4a9811){return db[_0x8ef0('0x2f')][_0x8ef0('0x50')]({'where':{'id':_0x3381dd['params']['id']}})[_0x8ef0('0x25')](handleEntityNotFound(_0x4a9811,null))[_0x8ef0('0x25')](removeEntity(_0x4a9811,null))['catch'](handleError(_0x4a9811,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 05ca34d..4896004 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 _0x8aad=['api','bluebird','request-promise','../../config/environment','define','tools_tags','lodash','util'];(function(_0x2ecee5,_0x53b6e2){var _0x4ddb49=function(_0x554494){while(--_0x554494){_0x2ecee5['push'](_0x2ecee5['shift']());}};_0x4ddb49(++_0x53b6e2);}(_0x8aad,0x146));var _0xd8aa=function(_0x140972,_0x197e68){_0x140972=_0x140972-0x0;var _0xec8d41=_0x8aad[_0x140972];return _0xec8d41;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var logger=require('../../config/logger')(_0xd8aa('0x2'));var moment=require('moment');var BPromise=require(_0xd8aa('0x3'));var rp=require(_0xd8aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd8aa('0x5'));var attributes=require('./tag.attributes');module['exports']=function(_0x16b648,_0x43ddeb){return _0x16b648[_0xd8aa('0x6')]('Tag',attributes,{'tableName':_0xd8aa('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c89=['rimraf','../../config/environment','exports','define','Tag','tools_tags','lodash','util','api','moment','bluebird'];(function(_0x10fd3c,_0x52fc99){var _0x4e062e=function(_0x42beb1){while(--_0x42beb1){_0x10fd3c['push'](_0x10fd3c['shift']());}};_0x4e062e(++_0x52fc99);}(_0x5c89,0x69));var _0x95c8=function(_0x1e9398,_0x5400c4){_0x1e9398=_0x1e9398-0x0;var _0x549c4e=_0x5c89[_0x1e9398];return _0x549c4e;};'use strict';var _=require(_0x95c8('0x0'));var util=require(_0x95c8('0x1'));var logger=require('../../config/logger')(_0x95c8('0x2'));var moment=require(_0x95c8('0x3'));var BPromise=require(_0x95c8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95c8('0x5'));var config=require(_0x95c8('0x6'));var attributes=require('./tag.attributes');module[_0x95c8('0x7')]=function(_0x5bdd8b,_0x42529c){return _0x5bdd8b[_0x95c8('0x8')](_0x95c8('0x9'),attributes,{'tableName':_0x95c8('0xa'),'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 7962b7a..94f294c 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 _0x7072=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x35ba71,_0xa2fbbd){var _0x5f04f4=function(_0x30a04f){while(--_0x30a04f){_0x35ba71['push'](_0x35ba71['shift']());}};_0x5f04f4(++_0xa2fbbd);}(_0x7072,0x138));var _0x2707=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x7072[_0x6cf19c];return _0xce14f3;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd8ff,_0x128205,_0x21b0a0){return new BPromise(function(_0x745cfd,_0x4062b6){return client[_0x2707('0xa')](_0x2fd8ff,_0x21b0a0)['then'](function(_0x597ff9){logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));logger[_0x2707('0xe')](_0x2707('0xf'),_0x128205,_0x2707('0xd'),JSON[_0x2707('0x10')](_0x597ff9));if(_0x597ff9[_0x2707('0x11')]){if(_0x597ff9[_0x2707('0x11')][_0x2707('0x12')]===0x1f4){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')]['message']);return _0x4062b6(_0x597ff9[_0x2707('0x11')]['message']);}logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')][_0x2707('0x13')]);return _0x745cfd(_0x597ff9[_0x2707('0x11')]['message']);}else{logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));_0x745cfd(_0x597ff9['result'][_0x2707('0x13')]);}})[_0x2707('0x14')](function(_0x1a979e){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x1a979e);_0x4062b6(_0x1a979e);});});} \ No newline at end of file +var _0x2e54=['rpc','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x2e54,0x1dd));var _0x42e5=function(_0x2203af,_0x15503b){_0x2203af=_0x2203af-0x0;var _0x27ece6=_0x2e54[_0x2203af];return _0x27ece6;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed10,_0x2af5bb,_0x56be20){return new BPromise(function(_0x335b92,_0x490b99){return client[_0x42e5('0xb')](_0x4bed10,_0x56be20)[_0x42e5('0xc')](function(_0x10ee5a){logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));logger[_0x42e5('0x10')](_0x42e5('0x11'),_0x2af5bb,_0x42e5('0xf'),JSON['stringify'](_0x10ee5a));if(_0x10ee5a[_0x42e5('0x12')]){if(_0x10ee5a[_0x42e5('0x12')]['code']===0x1f4){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x490b99(_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);}logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x335b92(_0x10ee5a['error'][_0x42e5('0x13')]);}else{logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));_0x335b92(_0x10ee5a[_0x42e5('0x14')][_0x42e5('0x13')]);}})[_0x42e5('0x15')](function(_0x3abe3d){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x3abe3d);_0x490b99(_0x3abe3d);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 909c3f0..4f33435 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 _0x4af6=['/:id','isAuthenticated','show','/:id/queues','getQueues','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeQueues','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','./team.controller','get'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x4af6,0xf5));var _0x64af=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4af6[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x64af('0x0'));var util=require('util');var path=require(_0x64af('0x1'));var timeout=require('connect-timeout');var express=require(_0x64af('0x2'));var router=express[_0x64af('0x3')]();var fs_extra=require(_0x64af('0x4'));var auth=require(_0x64af('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x64af('0x6'));router[_0x64af('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x64af('0x7')](_0x64af('0x8'),auth[_0x64af('0x9')](),controller[_0x64af('0xa')]);router[_0x64af('0x7')](_0x64af('0xb'),auth[_0x64af('0x9')](),controller[_0x64af('0xc')]);router[_0x64af('0x7')](_0x64af('0xd'),auth[_0x64af('0x9')](),controller[_0x64af('0xe')]);router[_0x64af('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x64af('0xf')]('/:id/queues',auth[_0x64af('0x9')](),controller['addQueues']);router[_0x64af('0xf')]('/:id/users',auth[_0x64af('0x9')](),controller[_0x64af('0x10')]);router[_0x64af('0x11')](_0x64af('0x8'),auth[_0x64af('0x9')](),controller[_0x64af('0x12')]);router[_0x64af('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x64af('0x14')]);router['delete']('/:id/queues',auth[_0x64af('0x9')](),controller[_0x64af('0x15')]);router[_0x64af('0x13')](_0x64af('0xd'),auth[_0x64af('0x9')](),controller[_0x64af('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1bb8=['create','/:id/queues','addAgents','put','delete','destroy','removeQueues','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','index','get','/:id','isAuthenticated','show','getQueues','/:id/users','getAgents','post'];(function(_0x5381bd,_0x31bafa){var _0x57890d=function(_0x366b33){while(--_0x366b33){_0x5381bd['push'](_0x5381bd['shift']());}};_0x57890d(++_0x31bafa);}(_0x1bb8,0x159));var _0x81bb=function(_0x39ba6a,_0x1b968b){_0x39ba6a=_0x39ba6a-0x0;var _0x364f4a=_0x1bb8[_0x39ba6a];return _0x364f4a;};'use strict';var multer=require(_0x81bb('0x0'));var util=require('util');var path=require(_0x81bb('0x1'));var timeout=require(_0x81bb('0x2'));var express=require(_0x81bb('0x3'));var router=express[_0x81bb('0x4')]();var fs_extra=require(_0x81bb('0x5'));var auth=require(_0x81bb('0x6'));var interaction=require(_0x81bb('0x7'));var config=require(_0x81bb('0x8'));var controller=require(_0x81bb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x81bb('0xa')]);router[_0x81bb('0xb')](_0x81bb('0xc'),auth[_0x81bb('0xd')](),controller[_0x81bb('0xe')]);router[_0x81bb('0xb')]('/:id/queues',auth['isAuthenticated'](),controller[_0x81bb('0xf')]);router[_0x81bb('0xb')](_0x81bb('0x10'),auth[_0x81bb('0xd')](),controller[_0x81bb('0x11')]);router[_0x81bb('0x12')]('/',auth[_0x81bb('0xd')](),controller[_0x81bb('0x13')]);router[_0x81bb('0x12')](_0x81bb('0x14'),auth[_0x81bb('0xd')](),controller['addQueues']);router[_0x81bb('0x12')](_0x81bb('0x10'),auth[_0x81bb('0xd')](),controller[_0x81bb('0x15')]);router[_0x81bb('0x16')](_0x81bb('0xc'),auth[_0x81bb('0xd')](),controller['update']);router[_0x81bb('0x17')](_0x81bb('0xc'),auth[_0x81bb('0xd')](),controller[_0x81bb('0x18')]);router[_0x81bb('0x17')](_0x81bb('0x14'),auth[_0x81bb('0xd')](),controller[_0x81bb('0x19')]);router[_0x81bb('0x17')]('/:id/users',auth[_0x81bb('0xd')](),controller[_0x81bb('0x1a')]);module[_0x81bb('0x1b')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index a1f8975..dbe1854 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 _0x1c49=['sequelize','exports','name','STRING'];(function(_0x15e6cb,_0xee2818){var _0x2a356c=function(_0x4c0eab){while(--_0x4c0eab){_0x15e6cb['push'](_0x15e6cb['shift']());}};_0x2a356c(++_0xee2818);}(_0x1c49,0x138));var _0x91c4=function(_0x494e72,_0x5f1178){_0x494e72=_0x494e72-0x0;var _0x2d3947=_0x1c49[_0x494e72];return _0x2d3947;};'use strict';var Sequelize=require(_0x91c4('0x0'));module[_0x91c4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x91c4('0x2')},'description':{'type':Sequelize[_0x91c4('0x3')]}}; \ No newline at end of file +var _0xf27f=['exports','STRING','name','sequelize'];(function(_0x4506c1,_0x21d85b){var _0x121bde=function(_0x2af2f9){while(--_0x2af2f9){_0x4506c1['push'](_0x4506c1['shift']());}};_0x121bde(++_0x21d85b);}(_0xf27f,0xa7));var _0xff27=function(_0x170b27,_0x318397){_0x170b27=_0x170b27-0x0;var _0x23ec6c=_0xf27f[_0x170b27];return _0x23ec6c;};'use strict';var Sequelize=require(_0xff27('0x0'));module[_0xff27('0x1')]={'name':{'type':Sequelize[_0xff27('0x2')],'allowNull':![],'unique':_0xff27('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 03c79da..f18499f 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 _0x2032=['update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Team','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','capitalize','toLowerCase','Queue','sort','Queues','addQueues','Unknown\x20channel','add','ids','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','through','penalty','QueueId','findOrCreate','User','voicePause','interface','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','spread','removeAgents','parse','Queue:remove','getAgents','nolimit','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','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','sendStatus','status','end','offset','limit','count','set','json','apply','save'];(function(_0x3f807d,_0x32a3b1){var _0x45ad62=function(_0x32b5d9){while(--_0x32b5d9){_0x3f807d['push'](_0x3f807d['shift']());}};_0x45ad62(++_0x32a3b1);}(_0x2032,0xd9));var _0x2203=function(_0x179afb,_0x24e247){_0x179afb=_0x179afb-0x0;var _0x4de45f=_0x2032[_0x179afb];return _0x4de45f;};'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'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2203('0x18')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x21a3af,_0x472265){_0x472265=_0x472265||0xcc;return function(_0x1c1ead){if(_0x1c1ead){return _0x21a3af[_0x2203('0x19')](_0x472265);}return _0x21a3af[_0x2203('0x1a')](_0x472265)[_0x2203('0x1b')]();};}function respondWithResult(_0x2c36e6,_0x2c085c){_0x2c085c=_0x2c085c||0xc8;return function(_0xdf9d0b){if(_0xdf9d0b){return _0x2c36e6[_0x2203('0x1a')](_0x2c085c)['json'](_0xdf9d0b);}};}function respondWithFilteredResult(_0x280eda,_0x2ee127){return function(_0x4893ff){if(_0x4893ff){var _0x3f9ef6=typeof _0x2ee127[_0x2203('0x1c')]==='undefined'&&typeof _0x2ee127[_0x2203('0x1d')]==='undefined';var _0x2904ba=_0x4893ff[_0x2203('0x1e')];var _0x3c8c34=_0x3f9ef6?0x0:_0x2ee127[_0x2203('0x1c')];var _0x15cb1a=_0x3f9ef6?_0x4893ff[_0x2203('0x1e')]:_0x2ee127['offset']+_0x2ee127[_0x2203('0x1d')];var _0x50822b;if(_0x15cb1a>=_0x2904ba){_0x15cb1a=_0x2904ba;_0x50822b=0xc8;}else{_0x50822b=0xce;}_0x280eda['status'](_0x50822b);return _0x280eda[_0x2203('0x1f')]('Content-Range',_0x3c8c34+'-'+_0x15cb1a+'/'+_0x2904ba)[_0x2203('0x20')](_0x4893ff);}return null;};}function patchUpdates(_0x5bfe61){return function(_0x5d4c4e){try{jsonpatch[_0x2203('0x21')](_0x5d4c4e,_0x5bfe61,!![]);}catch(_0x5e29cd){return BPromise['reject'](_0x5e29cd);}return _0x5d4c4e[_0x2203('0x22')]();};}function saveUpdates(_0x2718f5,_0x21f930){return function(_0xfd0970){if(_0xfd0970){return _0xfd0970[_0x2203('0x23')](_0x2718f5)[_0x2203('0x24')](function(_0x49c12){return _0x49c12;});}return null;};}function removeEntity(_0x250349,_0x576378){return function(_0x143f41){if(_0x143f41){return _0x143f41[_0x2203('0x25')]()[_0x2203('0x24')](function(){var _0x5f11bf=_0x143f41[_0x2203('0x26')]({'plain':!![]});var _0x1cec17='Teams';return db[_0x2203('0x27')][_0x2203('0x25')]({'where':{'type':_0x1cec17,'resourceId':_0x5f11bf['id']}})[_0x2203('0x24')](function(){return _0x143f41;});})[_0x2203('0x24')](function(){_0x250349[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x9c53f,_0x5a95c1){return function(_0x34b8ba){if(!_0x34b8ba){_0x9c53f[_0x2203('0x19')](0x194);}return _0x34b8ba;};}function handleError(_0x406ce9,_0x74f035){_0x74f035=_0x74f035||0x1f4;return function(_0x52a426){logger[_0x2203('0x28')](_0x52a426[_0x2203('0x29')]);if(_0x52a426[_0x2203('0x2a')]){delete _0x52a426[_0x2203('0x2a')];}_0x406ce9['status'](_0x74f035)[_0x2203('0x2b')](_0x52a426);};}exports[_0x2203('0x2c')]=function(_0x5e6560,_0x5c0157){var _0x1d5f74={},_0x52fafc={},_0x58b44d={'count':0x0,'rows':[]};var _0x125dfc=_[_0x2203('0x2d')](db[_0x2203('0x2e')][_0x2203('0x2f')],function(_0xf2801d){return{'name':_0xf2801d['fieldName'],'type':_0xf2801d[_0x2203('0x30')][_0x2203('0x31')]};});_0x52fafc['model']=_[_0x2203('0x2d')](_0x125dfc,_0x2203('0x2a'));_0x52fafc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5e6560[_0x2203('0x32')]);_0x52fafc[_0x2203('0x34')]=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],_0x52fafc[_0x2203('0x32')]);_0x1d5f74['attributes']=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],qs['fields'](_0x5e6560['query'][_0x2203('0x37')]));_0x1d5f74['attributes']=_0x1d5f74[_0x2203('0x38')][_0x2203('0x39')]?_0x1d5f74[_0x2203('0x38')]:_0x52fafc['model'];if(!_0x5e6560['query'][_0x2203('0x3a')]('nolimit')){_0x1d5f74[_0x2203('0x1d')]=qs['limit'](_0x5e6560[_0x2203('0x32')]['limit']);_0x1d5f74[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x5e6560[_0x2203('0x32')][_0x2203('0x1c')]);}_0x1d5f74[_0x2203('0x3b')]=qs['sort'](_0x5e6560['query']['sort']);_0x1d5f74[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x5e6560[_0x2203('0x32')],_0x52fafc[_0x2203('0x34')]),_0x125dfc);if(_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]){_0x1d5f74['where']=_[_0x2203('0x3f')](_0x1d5f74[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x125dfc,function(_0x26be74){if(_0x26be74['type']!=='VIRTUAL'){var _0x3ddfe0={};_0x3ddfe0[_0x26be74['name']]={'$like':'%'+_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3ddfe0;}})});}_0x1d5f74=_[_0x2203('0x3f')]({},_0x1d5f74,_0x5e6560['options']);var _0x5bba52={'where':_0x1d5f74[_0x2203('0x3c')]};return db[_0x2203('0x2e')][_0x2203('0x1e')](_0x5bba52)[_0x2203('0x24')](function(_0x372709){_0x58b44d[_0x2203('0x1e')]=_0x372709;if(_0x5e6560['query'][_0x2203('0x40')]){_0x1d5f74[_0x2203('0x41')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x42')](_0x1d5f74);})[_0x2203('0x24')](function(_0x36b99f){_0x58b44d[_0x2203('0x43')]=_0x36b99f;return _0x58b44d;})[_0x2203('0x24')](respondWithFilteredResult(_0x5c0157,_0x1d5f74))[_0x2203('0x44')](handleError(_0x5c0157,null));};exports[_0x2203('0x45')]=function(_0x595281,_0x2e2ca5){var _0x24e773={'raw':![],'where':{'id':_0x595281[_0x2203('0x46')]['id']}},_0x4aab80={};_0x4aab80['model']=_['keys'](db[_0x2203('0x2e')]['rawAttributes']);_0x4aab80[_0x2203('0x32')]=_[_0x2203('0x33')](_0x595281[_0x2203('0x32')]);_0x4aab80[_0x2203('0x34')]=_['intersection'](_0x4aab80[_0x2203('0x36')],_0x4aab80[_0x2203('0x32')]);_0x24e773['attributes']=_[_0x2203('0x35')](_0x4aab80[_0x2203('0x36')],qs[_0x2203('0x37')](_0x595281[_0x2203('0x32')]['fields']));_0x24e773['attributes']=_0x24e773[_0x2203('0x38')]['length']?_0x24e773['attributes']:_0x4aab80[_0x2203('0x36')];if(_0x595281[_0x2203('0x32')][_0x2203('0x40')]){_0x24e773['include']=[{'all':!![]}];}_0x24e773=_['merge']({},_0x24e773,_0x595281[_0x2203('0x47')]);return db[_0x2203('0x2e')][_0x2203('0x48')](_0x24e773)[_0x2203('0x24')](handleEntityNotFound(_0x2e2ca5,null))[_0x2203('0x24')](respondWithResult(_0x2e2ca5,null))[_0x2203('0x44')](handleError(_0x2e2ca5,null));};exports['create']=function(_0x747dce,_0x557659){return db[_0x2203('0x2e')][_0x2203('0x49')](_0x747dce[_0x2203('0x4a')],{})[_0x2203('0x24')](function(_0x58b9bb){var _0x506795=_0x747dce[_0x2203('0x4b')][_0x2203('0x26')]({'plain':!![]});if(!_0x506795)throw new Error(_0x2203('0x4c'));if(_0x506795[_0x2203('0x4d')]==='user'){var _0x4de47a=_0x58b9bb['get']({'plain':!![]});var _0x4064d5=_0x2203('0x4e');return db['UserProfileSection'][_0x2203('0x48')]({'where':{'name':_0x4064d5,'userProfileId':_0x506795[_0x2203('0x4f')]},'raw':!![]})['then'](function(_0x32b1db){if(_0x32b1db&&_0x32b1db[_0x2203('0x50')]===0x0){return db[_0x2203('0x27')][_0x2203('0x49')]({'name':_0x4de47a['name'],'resourceId':_0x4de47a['id'],'type':_0x32b1db[_0x2203('0x2a')],'sectionId':_0x32b1db['id']},{})['then'](function(){return _0x58b9bb;});}else{return _0x58b9bb;}})[_0x2203('0x44')](function(_0x1de713){logger['error'](_0x2203('0x51'),_0x1de713);throw _0x1de713;});}return _0x58b9bb;})[_0x2203('0x24')](respondWithResult(_0x557659,0xc9))[_0x2203('0x44')](handleError(_0x557659,null));};exports[_0x2203('0x23')]=function(_0x3f335a,_0x161e9d){if(_0x3f335a['body']['id']){delete _0x3f335a['body']['id'];}return db[_0x2203('0x2e')]['find']({'where':{'id':_0x3f335a['params']['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x161e9d,null))[_0x2203('0x24')](saveUpdates(_0x3f335a[_0x2203('0x4a')],null))['then'](respondWithResult(_0x161e9d,null))[_0x2203('0x44')](handleError(_0x161e9d,null));};exports['destroy']=function(_0x5ddf9e,_0xeb6b44){return db['Team']['find']({'where':{'id':_0x5ddf9e['params']['id']}})[_0x2203('0x24')](handleEntityNotFound(_0xeb6b44,null))[_0x2203('0x24')](removeEntity(_0xeb6b44,null))[_0x2203('0x44')](handleError(_0xeb6b44,null));};exports[_0x2203('0x52')]=function(_0x26d3d9,_0x32f593,_0x2baea2){return db[_0x2203('0x2e')][_0x2203('0x53')]({'where':{'id':_0x26d3d9[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x32f593,null))[_0x2203('0x24')](function(_0x58ff57){if(!_0x26d3d9['query'][_0x2203('0x54')]||!utils[_0x2203('0x55')](_0x26d3d9[_0x2203('0x32')][_0x2203('0x54')])){throw new db[(_0x2203('0x56'))][(_0x2203('0x57'))]('Unknown\x20channel');}var _0x5486f9={};var _0xb49120={};_0xb49120[_0x2203('0x36')]=_[_0x2203('0x33')](db[_[_0x2203('0x58')](_0x26d3d9[_0x2203('0x32')][_0x2203('0x54')][_0x2203('0x59')]())+_0x2203('0x5a')][_0x2203('0x2f')]);_0xb49120[_0x2203('0x32')]=_[_0x2203('0x33')](_0x26d3d9['query']);_0xb49120[_0x2203('0x34')]=_[_0x2203('0x35')](_0xb49120[_0x2203('0x36')],_0xb49120[_0x2203('0x32')]);_0x5486f9[_0x2203('0x38')]=_[_0x2203('0x35')](_0xb49120[_0x2203('0x36')],qs[_0x2203('0x37')](_0x26d3d9[_0x2203('0x32')][_0x2203('0x37')]));_0x5486f9[_0x2203('0x38')]=_0x5486f9[_0x2203('0x38')][_0x2203('0x39')]?_0x5486f9[_0x2203('0x38')]:_0xb49120[_0x2203('0x36')];_0x5486f9[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x26d3d9[_0x2203('0x32')][_0x2203('0x1d')]);_0x5486f9[_0x2203('0x1c')]=qs['offset'](_0x26d3d9[_0x2203('0x32')][_0x2203('0x1c')]);_0x5486f9[_0x2203('0x3b')]=qs['sort'](_0x26d3d9[_0x2203('0x32')][_0x2203('0x5b')]);_0x5486f9[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x26d3d9['query'],_0xb49120[_0x2203('0x34')]));_0x5486f9=_[_0x2203('0x3f')]({},_0x5486f9,_0x26d3d9[_0x2203('0x47')]);return _0x58ff57['get'+_['capitalize'](_0x26d3d9['query']['channel']['toLowerCase']())+_0x2203('0x5c')](_0x5486f9);})[_0x2203('0x24')](respondWithResult(_0x32f593,null))[_0x2203('0x44')](handleError(_0x32f593,null));};exports[_0x2203('0x5d')]=function(_0x4287f4,_0x169845,_0x3f7926){return db[_0x2203('0x2e')]['findOne']({'where':{'id':_0x4287f4['params']['id']}})[_0x2203('0x24')](function(_0x8f8648){if(_0x8f8648){if(!_0x4287f4[_0x2203('0x4a')][_0x2203('0x54')]||!utils[_0x2203('0x55')](_0x4287f4[_0x2203('0x4a')][_0x2203('0x54')])){throw new db[(_0x2203('0x56'))][(_0x2203('0x57'))](_0x2203('0x5e'));}return _0x8f8648[_0x2203('0x5f')+_[_0x2203('0x58')](_0x4287f4[_0x2203('0x4a')][_0x2203('0x54')][_0x2203('0x59')]())+_0x2203('0x5c')](_0x4287f4[_0x2203('0x4a')][_0x2203('0x60')]);}return null;})[_0x2203('0x24')](handleEntityNotFound(_0x169845,null))['then'](respondWithStatusCode(_0x169845,null))[_0x2203('0x44')](handleError(_0x169845,null));};exports['removeQueues']=function(_0x3382b7,_0x55ecbb,_0x5ba500){return db[_0x2203('0x2e')][_0x2203('0x53')]({'where':{'id':_0x3382b7[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x35bbad){if(_0x35bbad){if(!_0x3382b7[_0x2203('0x32')][_0x2203('0x54')]||!utils['isValidChannel'](_0x3382b7['query'][_0x2203('0x54')])){throw new db[(_0x2203('0x56'))][(_0x2203('0x57'))]('Unknown\x20channel');}return _0x35bbad['remove'+_['capitalize'](_0x3382b7[_0x2203('0x32')][_0x2203('0x54')][_0x2203('0x59')]())+_0x2203('0x5c')](_0x3382b7['query'][_0x2203('0x60')]);}return null;})['then'](handleEntityNotFound(_0x55ecbb,null))[_0x2203('0x24')](respondWithStatusCode(_0x55ecbb,null))[_0x2203('0x44')](handleError(_0x55ecbb,null));};exports[_0x2203('0x61')]=function(_0x36106b,_0xf8584f){return db['Team'][_0x2203('0x48')]({'where':{'id':_0x36106b[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0xf8584f,null))['then'](function(_0x181d93){if(_0x181d93){var _0x45d235=[_0x2203('0x62'),_0x2203('0x63'),_0x2203('0x64'),_0x2203('0x65'),_0x2203('0x66'),_0x2203('0x67'),_0x2203('0x68')];return db[_0x2203('0x69')][_0x2203('0x6a')](function(_0x5db33f){var _0x1adfa6=_[_0x2203('0x2d')](_0x45d235,function(_0x21b755){var _0x2da37c={'attributes':['id',_0x2203('0x2a')]};if(_0x21b755===_0x2203('0x62')){_0x2da37c[_0x2203('0x6b')]={'attributes':[_0x2203('0x6c')]};}return _0x181d93[_0x2203('0x26')+_0x21b755+_0x2203('0x5c')](_0x2da37c)[_0x2203('0x24')](function(_0x1cc668){var _0x4c332f=_['map'](_0x1cc668,function(_0x26cfd7){var _0x3a1c63=_[_0x2203('0x2d')](_0x36106b[_0x2203('0x4a')][_0x2203('0x60')],function(_0x4fd029){var _0x16e518={'where':{'UserId':_0x4fd029,[_0x21b755+_0x2203('0x6d')]:_0x26cfd7['id']},'transaction':_0x5db33f};if(_0x21b755==='Voice'){_0x16e518['defaults']={'penalty':_0x26cfd7['TeamVoiceQueue']['penalty']};}return db['User'+_0x21b755+_0x2203('0x5a')][_0x2203('0x6e')](_0x16e518)[_0x2203('0x24')](function(){socket['emit']('user'+_0x21b755+'Queue:save',{'UserId':_0x4fd029,[_0x21b755+_0x2203('0x6d')]:_0x26cfd7['id']});if(_0x21b755!==_0x2203('0x62'))return;return db[_0x2203('0x6f')][_0x2203('0x42')]({'where':{'id':_0x36106b[_0x2203('0x4a')][_0x2203('0x60')],'online':0x1},'attributes':['id',_0x2203('0x2a'),'online',_0x2203('0x70'),_0x2203('0x71')],'raw':!![]})[_0x2203('0x24')](function(_0x3c3bb4){var _0x35ff6b=_[_0x2203('0x2d')](_0x3c3bb4,function(_0x13e11f){return db['UserVoiceQueueRt'][_0x2203('0x72')]({'membername':_0x13e11f['name'],'UserId':_0x13e11f['id'],'queue_name':_0x26cfd7['name'],'VoiceQueueId':_0x26cfd7['id'],'interface':_[_0x2203('0x73')](_0x13e11f['interface'])?util[_0x2203('0x74')](_0x2203('0x75'),_0x13e11f['name']):_0x13e11f[_0x2203('0x71')],'paused':_0x13e11f[_0x2203('0x70')]||![],'penalty':_0x26cfd7[_0x2203('0x76')][_0x2203('0x6c')]},{'transaction':_0x5db33f});});return Promise[_0x2203('0x77')](_0x35ff6b);});});});return Promise[_0x2203('0x77')](_0x3a1c63);});return Promise['all'](_0x4c332f);});});return Promise[_0x2203('0x77')](_0x1adfa6)[_0x2203('0x24')](function(){return _0x181d93['addAgents'](_0x36106b['body'][_0x2203('0x60')],{'transaction':_0x5db33f})[_0x2203('0x78')](function(_0x383d3e){return _0x383d3e;});});});}})[_0x2203('0x24')](respondWithResult(_0xf8584f,null))[_0x2203('0x44')](handleError(_0xf8584f,null));};exports[_0x2203('0x79')]=function(_0x430ea4,_0x3c41bf){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x430ea4[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x3c41bf,null))[_0x2203('0x24')](function(_0x51b0a4){if(_0x51b0a4){var _0x7589a7=[_0x2203('0x62'),'Chat','Mail',_0x2203('0x65'),_0x2203('0x66'),'Openchannel',_0x2203('0x68')];return db[_0x2203('0x69')]['transaction'](function(_0x54014d){var _0x2f499d=_['map'](_0x7589a7,function(_0x21f357){var _0x10c65a={'attributes':['id','name']};return _0x51b0a4[_0x2203('0x26')+_0x21f357+_0x2203('0x5c')](_0x10c65a)[_0x2203('0x24')](function(_0x1596f7){var _0x4c735c=_['map'](_0x1596f7,function(_0x2df837){return _0x2df837[_0x2203('0x79')](_0x430ea4[_0x2203('0x32')]['ids'],{'transaction':_0x54014d})['then'](function(){var _0x8df62d=JSON[_0x2203('0x7a')]('['+_0x430ea4[_0x2203('0x32')]['ids']+']');var _0x54dd79=_[_0x2203('0x2d')](_0x8df62d,function(_0x348ce6){socket['emit'](_0x2203('0x4b')+_0x21f357+_0x2203('0x7b'),{'UserId':Number(_0x348ce6),[_0x21f357+'QueueId']:_0x2df837['id']});if(_0x21f357!==_0x2203('0x62'))return;return db['UserVoiceQueueRt'][_0x2203('0x25')]({'where':{'VoiceQueueId':_0x2df837['id'],'UserId':_0x348ce6},'transaction':_0x54014d});});return Promise['all'](_0x54dd79);});});return Promise['all'](_0x4c735c);});});return Promise['all'](_0x2f499d)[_0x2203('0x24')](function(){return _0x51b0a4[_0x2203('0x79')](_0x430ea4['query'][_0x2203('0x60')],{'transaction':_0x54014d});});});}})[_0x2203('0x24')](respondWithStatusCode(_0x3c41bf,null))[_0x2203('0x44')](handleError(_0x3c41bf,null));};exports['getAgents']=function(_0x28f2a6,_0x4deb18,_0x3f31e0){var _0x3edb38={};var _0x486563={};var _0x4358c1;var _0x4096f4;return db['Team'][_0x2203('0x53')]({'where':{'id':_0x28f2a6[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x4deb18,null))[_0x2203('0x24')](function(_0x34c8aa){if(_0x34c8aa){_0x4358c1=_0x34c8aa;_0x486563['model']=_[_0x2203('0x33')](db[_0x2203('0x6f')][_0x2203('0x2f')]);_0x486563[_0x2203('0x32')]=_[_0x2203('0x33')](_0x28f2a6[_0x2203('0x32')]);_0x486563['filters']=_[_0x2203('0x35')](_0x486563[_0x2203('0x36')],_0x486563['query']);_0x3edb38[_0x2203('0x38')]=_['intersection'](_0x486563[_0x2203('0x36')],qs[_0x2203('0x37')](_0x28f2a6[_0x2203('0x32')]['fields']));_0x3edb38[_0x2203('0x38')]=_0x3edb38[_0x2203('0x38')][_0x2203('0x39')]?_0x3edb38[_0x2203('0x38')]:_0x486563[_0x2203('0x36')];_0x3edb38[_0x2203('0x3b')]=qs[_0x2203('0x5b')](_0x28f2a6['query']['sort']);_0x3edb38[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x28f2a6[_0x2203('0x32')],_0x486563[_0x2203('0x34')]));if(_0x28f2a6[_0x2203('0x32')][_0x2203('0x3e')]){_0x3edb38['where']=_[_0x2203('0x3f')](_0x3edb38[_0x2203('0x3c')],{'$or':_['map'](_0x3edb38[_0x2203('0x38')],function(_0x53b134){var _0xc3dac5={};_0xc3dac5[_0x53b134]={'$like':'%'+_0x28f2a6[_0x2203('0x32')]['filter']+'%'};return _0xc3dac5;})});}_0x3edb38=_[_0x2203('0x3f')]({},_0x3edb38,_0x28f2a6[_0x2203('0x47')]);return _0x4358c1[_0x2203('0x7c')](_0x3edb38);}})[_0x2203('0x24')](function(_0x34a160){if(_0x34a160){_0x4096f4=_0x34a160[_0x2203('0x39')];if(!_0x28f2a6[_0x2203('0x32')][_0x2203('0x3a')](_0x2203('0x7d'))){_0x3edb38[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28f2a6[_0x2203('0x32')]['limit']);_0x3edb38[_0x2203('0x1c')]=qs['offset'](_0x28f2a6[_0x2203('0x32')][_0x2203('0x1c')]);}return _0x4358c1[_0x2203('0x7c')](_0x3edb38);}})[_0x2203('0x24')](function(_0x145a72){if(_0x145a72){return _0x145a72?{'count':_0x4096f4,'rows':_0x145a72}:null;}})[_0x2203('0x24')](respondWithResult(_0x4deb18,null))[_0x2203('0x44')](handleError(_0x4deb18,null));}; \ No newline at end of file +var _0x8603=['Whatsapp','parse','Queue:remove','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','Teams','UserProfileResource','destroy','stack','name','send','map','Team','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','getQueues','channel','isValidChannel','Sequelize','toLowerCase','Queue','Queues','findOne','add','capitalize','removeQueues','ValidationError','Unknown\x20channel','remove','ids','addAgents','Voice','Chat','Mail','Openchannel','sequelize','transaction','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','removeAgents','Sms','Fax'];(function(_0x315de3,_0x47fb12){var _0x1d1889=function(_0x54b385){while(--_0x54b385){_0x315de3['push'](_0x315de3['shift']());}};_0x1d1889(++_0x47fb12);}(_0x8603,0x190));var _0x3860=function(_0x535c9e,_0x1344b0){_0x535c9e=_0x535c9e-0x0;var _0x2f426e=_0x8603[_0x535c9e];return _0x2f426e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];config[_0x3860('0x15')]=_[_0x3860('0x16')](config[_0x3860('0x15')],{'host':_0x3860('0x17'),'port':0x18eb});var socket=require(_0x3860('0x18'))(new Redis(config[_0x3860('0x15')]));require(_0x3860('0x19'))[_0x3860('0x1a')](socket);function respondWithStatusCode(_0x46264d,_0x54dbc3){_0x54dbc3=_0x54dbc3||0xcc;return function(_0x3d861d){if(_0x3d861d){return _0x46264d[_0x3860('0x1b')](_0x54dbc3);}return _0x46264d[_0x3860('0x1c')](_0x54dbc3)[_0x3860('0x1d')]();};}function respondWithResult(_0x1055b3,_0xfa0c9a){_0xfa0c9a=_0xfa0c9a||0xc8;return function(_0x2d8a3a){if(_0x2d8a3a){return _0x1055b3[_0x3860('0x1c')](_0xfa0c9a)[_0x3860('0x1e')](_0x2d8a3a);}};}function respondWithFilteredResult(_0x3c0d91,_0x3e51b4){return function(_0x45b799){if(_0x45b799){var _0x4b6b15=typeof _0x3e51b4['offset']===_0x3860('0x1f')&&typeof _0x3e51b4[_0x3860('0x20')]===_0x3860('0x1f');var _0x53fc63=_0x45b799[_0x3860('0x21')];var _0x145b26=_0x4b6b15?0x0:_0x3e51b4[_0x3860('0x22')];var _0x3af33a=_0x4b6b15?_0x45b799[_0x3860('0x21')]:_0x3e51b4[_0x3860('0x22')]+_0x3e51b4[_0x3860('0x20')];var _0x1f8891;if(_0x3af33a>=_0x53fc63){_0x3af33a=_0x53fc63;_0x1f8891=0xc8;}else{_0x1f8891=0xce;}_0x3c0d91[_0x3860('0x1c')](_0x1f8891);return _0x3c0d91[_0x3860('0x23')](_0x3860('0x24'),_0x145b26+'-'+_0x3af33a+'/'+_0x53fc63)[_0x3860('0x1e')](_0x45b799);}return null;};}function patchUpdates(_0x280ea9){return function(_0x9eaaa1){try{jsonpatch[_0x3860('0x25')](_0x9eaaa1,_0x280ea9,!![]);}catch(_0x564efd){return BPromise[_0x3860('0x26')](_0x564efd);}return _0x9eaaa1[_0x3860('0x27')]();};}function saveUpdates(_0x2b91f2,_0x301e03){return function(_0x20bb1e){if(_0x20bb1e){return _0x20bb1e['update'](_0x2b91f2)[_0x3860('0x28')](function(_0x568515){return _0x568515;});}return null;};}function removeEntity(_0x577750,_0xfa9705){return function(_0x1c4bbc){if(_0x1c4bbc){return _0x1c4bbc['destroy']()['then'](function(){var _0x5f42d5=_0x1c4bbc[_0x3860('0x29')]({'plain':!![]});var _0x3ebc5b=_0x3860('0x2a');return db[_0x3860('0x2b')][_0x3860('0x2c')]({'where':{'type':_0x3ebc5b,'resourceId':_0x5f42d5['id']}})[_0x3860('0x28')](function(){return _0x1c4bbc;});})['then'](function(){_0x577750['status'](0xcc)[_0x3860('0x1d')]();});}};}function handleEntityNotFound(_0x1f1809,_0x5a9af2){return function(_0x2551f4){if(!_0x2551f4){_0x1f1809[_0x3860('0x1b')](0x194);}return _0x2551f4;};}function handleError(_0x10d9e4,_0x426e6c){_0x426e6c=_0x426e6c||0x1f4;return function(_0x3628f7){logger['error'](_0x3628f7[_0x3860('0x2d')]);if(_0x3628f7[_0x3860('0x2e')]){delete _0x3628f7[_0x3860('0x2e')];}_0x10d9e4['status'](_0x426e6c)[_0x3860('0x2f')](_0x3628f7);};}exports['index']=function(_0x294b3a,_0x4825f0){var _0x1c498c={},_0x2e542a={},_0x24cf39={'count':0x0,'rows':[]};var _0x47e350=_[_0x3860('0x30')](db[_0x3860('0x31')]['rawAttributes'],function(_0x1c94cc){return{'name':_0x1c94cc['fieldName'],'type':_0x1c94cc[_0x3860('0x32')][_0x3860('0x33')]};});_0x2e542a[_0x3860('0x34')]=_[_0x3860('0x30')](_0x47e350,_0x3860('0x2e'));_0x2e542a[_0x3860('0x35')]=_[_0x3860('0x36')](_0x294b3a['query']);_0x2e542a[_0x3860('0x37')]=_[_0x3860('0x38')](_0x2e542a['model'],_0x2e542a[_0x3860('0x35')]);_0x1c498c[_0x3860('0x39')]=_[_0x3860('0x38')](_0x2e542a['model'],qs['fields'](_0x294b3a[_0x3860('0x35')][_0x3860('0x3a')]));_0x1c498c[_0x3860('0x39')]=_0x1c498c[_0x3860('0x39')]['length']?_0x1c498c['attributes']:_0x2e542a[_0x3860('0x34')];if(!_0x294b3a[_0x3860('0x35')][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1c498c[_0x3860('0x20')]=qs['limit'](_0x294b3a[_0x3860('0x35')][_0x3860('0x20')]);_0x1c498c['offset']=qs['offset'](_0x294b3a[_0x3860('0x35')][_0x3860('0x22')]);}_0x1c498c[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x294b3a[_0x3860('0x35')]['sort']);_0x1c498c[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x294b3a[_0x3860('0x35')],_0x2e542a['filters']),_0x47e350);if(_0x294b3a[_0x3860('0x35')][_0x3860('0x41')]){_0x1c498c['where']=_[_0x3860('0x42')](_0x1c498c[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x47e350,function(_0xf346e){if(_0xf346e['type']!==_0x3860('0x43')){var _0x47141b={};_0x47141b[_0xf346e[_0x3860('0x2e')]]={'$like':'%'+_0x294b3a['query'][_0x3860('0x41')]+'%'};return _0x47141b;}})});}_0x1c498c=_['merge']({},_0x1c498c,_0x294b3a[_0x3860('0x44')]);var _0x424801={'where':_0x1c498c[_0x3860('0x3f')]};return db[_0x3860('0x31')][_0x3860('0x21')](_0x424801)[_0x3860('0x28')](function(_0x4e0a44){_0x24cf39[_0x3860('0x21')]=_0x4e0a44;if(_0x294b3a[_0x3860('0x35')]['includeAll']){_0x1c498c['include']=[{'all':!![]}];}return db[_0x3860('0x31')][_0x3860('0x45')](_0x1c498c);})['then'](function(_0x164a77){_0x24cf39[_0x3860('0x46')]=_0x164a77;return _0x24cf39;})['then'](respondWithFilteredResult(_0x4825f0,_0x1c498c))[_0x3860('0x47')](handleError(_0x4825f0,null));};exports[_0x3860('0x48')]=function(_0x392dc3,_0x37e5c3){var _0x14f5b2={'raw':![],'where':{'id':_0x392dc3[_0x3860('0x49')]['id']}},_0x3fa282={};_0x3fa282[_0x3860('0x34')]=_[_0x3860('0x36')](db[_0x3860('0x31')][_0x3860('0x4a')]);_0x3fa282[_0x3860('0x35')]=_[_0x3860('0x36')](_0x392dc3['query']);_0x3fa282[_0x3860('0x37')]=_['intersection'](_0x3fa282[_0x3860('0x34')],_0x3fa282[_0x3860('0x35')]);_0x14f5b2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x3fa282[_0x3860('0x34')],qs[_0x3860('0x3a')](_0x392dc3[_0x3860('0x35')][_0x3860('0x3a')]));_0x14f5b2['attributes']=_0x14f5b2[_0x3860('0x39')][_0x3860('0x4b')]?_0x14f5b2[_0x3860('0x39')]:_0x3fa282['model'];if(_0x392dc3[_0x3860('0x35')][_0x3860('0x4c')]){_0x14f5b2[_0x3860('0x4d')]=[{'all':!![]}];}_0x14f5b2=_[_0x3860('0x42')]({},_0x14f5b2,_0x392dc3['options']);return db['Team'][_0x3860('0x4e')](_0x14f5b2)['then'](handleEntityNotFound(_0x37e5c3,null))[_0x3860('0x28')](respondWithResult(_0x37e5c3,null))[_0x3860('0x47')](handleError(_0x37e5c3,null));};exports[_0x3860('0x4f')]=function(_0x52456e,_0x29c52d){return db['Team'][_0x3860('0x4f')](_0x52456e['body'],{})[_0x3860('0x28')](function(_0x25d22f){var _0x39b2e0=_0x52456e['user']['get']({'plain':!![]});if(!_0x39b2e0)throw new Error(_0x3860('0x50'));if(_0x39b2e0[_0x3860('0x51')]==='user'){var _0x3910f5=_0x25d22f['get']({'plain':!![]});var _0x3b3bfe=_0x3860('0x2a');return db[_0x3860('0x52')][_0x3860('0x4e')]({'where':{'name':_0x3b3bfe,'userProfileId':_0x39b2e0[_0x3860('0x53')]},'raw':!![]})[_0x3860('0x28')](function(_0x3fad85){if(_0x3fad85&&_0x3fad85['autoAssociation']===0x0){return db[_0x3860('0x2b')][_0x3860('0x4f')]({'name':_0x3910f5[_0x3860('0x2e')],'resourceId':_0x3910f5['id'],'type':_0x3fad85[_0x3860('0x2e')],'sectionId':_0x3fad85['id']},{})[_0x3860('0x28')](function(){return _0x25d22f;});}else{return _0x25d22f;}})[_0x3860('0x47')](function(_0x47ff99){logger[_0x3860('0x54')](_0x3860('0x55'),_0x47ff99);throw _0x47ff99;});}return _0x25d22f;})[_0x3860('0x28')](respondWithResult(_0x29c52d,0xc9))[_0x3860('0x47')](handleError(_0x29c52d,null));};exports[_0x3860('0x56')]=function(_0x1e2b5d,_0xe2b761){if(_0x1e2b5d[_0x3860('0x57')]['id']){delete _0x1e2b5d['body']['id'];}return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x1e2b5d['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0xe2b761,null))[_0x3860('0x28')](saveUpdates(_0x1e2b5d[_0x3860('0x57')],null))['then'](respondWithResult(_0xe2b761,null))[_0x3860('0x47')](handleError(_0xe2b761,null));};exports['destroy']=function(_0xa83da3,_0x214a19){return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0xa83da3[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x214a19,null))[_0x3860('0x28')](removeEntity(_0x214a19,null))[_0x3860('0x47')](handleError(_0x214a19,null));};exports[_0x3860('0x58')]=function(_0x151492,_0x3ba9a1,_0x2bac24){return db['Team']['findOne']({'where':{'id':_0x151492['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x3ba9a1,null))['then'](function(_0x5a2c1c){if(!_0x151492[_0x3860('0x35')][_0x3860('0x59')]||!utils[_0x3860('0x5a')](_0x151492[_0x3860('0x35')][_0x3860('0x59')])){throw new db[(_0x3860('0x5b'))]['ValidationError']('Unknown\x20channel');}var _0x4df47b={};var _0x1d6c70={};_0x1d6c70[_0x3860('0x34')]=_[_0x3860('0x36')](db[_['capitalize'](_0x151492[_0x3860('0x35')]['channel'][_0x3860('0x5c')]())+_0x3860('0x5d')]['rawAttributes']);_0x1d6c70[_0x3860('0x35')]=_[_0x3860('0x36')](_0x151492[_0x3860('0x35')]);_0x1d6c70[_0x3860('0x37')]=_['intersection'](_0x1d6c70[_0x3860('0x34')],_0x1d6c70[_0x3860('0x35')]);_0x4df47b[_0x3860('0x39')]=_['intersection'](_0x1d6c70['model'],qs[_0x3860('0x3a')](_0x151492[_0x3860('0x35')][_0x3860('0x3a')]));_0x4df47b[_0x3860('0x39')]=_0x4df47b[_0x3860('0x39')][_0x3860('0x4b')]?_0x4df47b['attributes']:_0x1d6c70[_0x3860('0x34')];_0x4df47b[_0x3860('0x20')]=qs['limit'](_0x151492[_0x3860('0x35')][_0x3860('0x20')]);_0x4df47b[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x151492[_0x3860('0x35')][_0x3860('0x22')]);_0x4df47b['order']=qs[_0x3860('0x3e')](_0x151492[_0x3860('0x35')][_0x3860('0x3e')]);_0x4df47b[_0x3860('0x3f')]=qs[_0x3860('0x37')](_[_0x3860('0x40')](_0x151492['query'],_0x1d6c70[_0x3860('0x37')]));_0x4df47b=_[_0x3860('0x42')]({},_0x4df47b,_0x151492[_0x3860('0x44')]);return _0x5a2c1c['get'+_['capitalize'](_0x151492[_0x3860('0x35')][_0x3860('0x59')][_0x3860('0x5c')]())+_0x3860('0x5e')](_0x4df47b);})[_0x3860('0x28')](respondWithResult(_0x3ba9a1,null))['catch'](handleError(_0x3ba9a1,null));};exports['addQueues']=function(_0x2db53f,_0x393bc4,_0x47e144){return db['Team'][_0x3860('0x5f')]({'where':{'id':_0x2db53f[_0x3860('0x49')]['id']}})['then'](function(_0x304b18){if(_0x304b18){if(!_0x2db53f[_0x3860('0x57')][_0x3860('0x59')]||!utils[_0x3860('0x5a')](_0x2db53f['body'][_0x3860('0x59')])){throw new db[(_0x3860('0x5b'))]['ValidationError']('Unknown\x20channel');}return _0x304b18[_0x3860('0x60')+_[_0x3860('0x61')](_0x2db53f['body'][_0x3860('0x59')]['toLowerCase']())+_0x3860('0x5e')](_0x2db53f['body']['ids']);}return null;})[_0x3860('0x28')](handleEntityNotFound(_0x393bc4,null))['then'](respondWithStatusCode(_0x393bc4,null))[_0x3860('0x47')](handleError(_0x393bc4,null));};exports[_0x3860('0x62')]=function(_0x29eb2c,_0x2fd2f4,_0x19f717){return db[_0x3860('0x31')]['findOne']({'where':{'id':_0x29eb2c[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x3b5b6f){if(_0x3b5b6f){if(!_0x29eb2c['query'][_0x3860('0x59')]||!utils['isValidChannel'](_0x29eb2c[_0x3860('0x35')][_0x3860('0x59')])){throw new db['Sequelize'][(_0x3860('0x63'))](_0x3860('0x64'));}return _0x3b5b6f[_0x3860('0x65')+_['capitalize'](_0x29eb2c['query']['channel']['toLowerCase']())+_0x3860('0x5e')](_0x29eb2c[_0x3860('0x35')][_0x3860('0x66')]);}return null;})[_0x3860('0x28')](handleEntityNotFound(_0x2fd2f4,null))['then'](respondWithStatusCode(_0x2fd2f4,null))['catch'](handleError(_0x2fd2f4,null));};exports[_0x3860('0x67')]=function(_0x32e503,_0x1b0e46){return db[_0x3860('0x31')]['find']({'where':{'id':_0x32e503[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x1b0e46,null))['then'](function(_0x583c3a){if(_0x583c3a){var _0x32cbe8=[_0x3860('0x68'),_0x3860('0x69'),_0x3860('0x6a'),'Sms','Fax',_0x3860('0x6b'),'Whatsapp'];return db[_0x3860('0x6c')][_0x3860('0x6d')](function(_0x4b948a){var _0x4e7713=_['map'](_0x32cbe8,function(_0x2d6eab){var _0x36116e={'attributes':['id','name']};if(_0x2d6eab===_0x3860('0x68')){_0x36116e[_0x3860('0x6e')]={'attributes':[_0x3860('0x6f')]};}return _0x583c3a[_0x3860('0x29')+_0x2d6eab+_0x3860('0x5e')](_0x36116e)['then'](function(_0x1426c4){var _0x31e791=_[_0x3860('0x30')](_0x1426c4,function(_0x35a2b1){var _0x355924=_['map'](_0x32e503[_0x3860('0x57')][_0x3860('0x66')],function(_0x2f3759){var _0x41ee6f={'where':{'UserId':_0x2f3759,[_0x2d6eab+_0x3860('0x70')]:_0x35a2b1['id']},'transaction':_0x4b948a};if(_0x2d6eab==='Voice'){_0x41ee6f['defaults']={'penalty':_0x35a2b1[_0x3860('0x71')][_0x3860('0x6f')]};}return db[_0x3860('0x72')+_0x2d6eab+_0x3860('0x5d')][_0x3860('0x73')](_0x41ee6f)[_0x3860('0x28')](function(){socket[_0x3860('0x74')]('user'+_0x2d6eab+_0x3860('0x75'),{'UserId':_0x2f3759,[_0x2d6eab+_0x3860('0x70')]:_0x35a2b1['id']});if(_0x2d6eab!=='Voice')return;return db[_0x3860('0x72')][_0x3860('0x45')]({'where':{'id':_0x32e503[_0x3860('0x57')]['ids'],'online':0x1},'attributes':['id',_0x3860('0x2e'),_0x3860('0x76'),'voicePause',_0x3860('0x77')],'raw':!![]})['then'](function(_0x22963a){var _0x34d583=_['map'](_0x22963a,function(_0x330fd0){return db[_0x3860('0x78')][_0x3860('0x79')]({'membername':_0x330fd0[_0x3860('0x2e')],'UserId':_0x330fd0['id'],'queue_name':_0x35a2b1[_0x3860('0x2e')],'VoiceQueueId':_0x35a2b1['id'],'interface':_['isNil'](_0x330fd0[_0x3860('0x77')])?util[_0x3860('0x7a')](_0x3860('0x7b'),_0x330fd0[_0x3860('0x2e')]):_0x330fd0[_0x3860('0x77')],'paused':_0x330fd0['voicePause']||![],'penalty':_0x35a2b1['TeamVoiceQueue'][_0x3860('0x6f')]},{'transaction':_0x4b948a});});return Promise[_0x3860('0x7c')](_0x34d583);});});});return Promise['all'](_0x355924);});return Promise[_0x3860('0x7c')](_0x31e791);});});return Promise[_0x3860('0x7c')](_0x4e7713)[_0x3860('0x28')](function(){return _0x583c3a[_0x3860('0x67')](_0x32e503['body'][_0x3860('0x66')],{'transaction':_0x4b948a})['spread'](function(_0x1a0768){return _0x1a0768;});});});}})[_0x3860('0x28')](respondWithResult(_0x1b0e46,null))[_0x3860('0x47')](handleError(_0x1b0e46,null));};exports[_0x3860('0x7d')]=function(_0x279488,_0x449262){return db[_0x3860('0x31')]['find']({'where':{'id':_0x279488[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x449262,null))['then'](function(_0x486127){if(_0x486127){var _0x5337f0=['Voice',_0x3860('0x69'),_0x3860('0x6a'),_0x3860('0x7e'),_0x3860('0x7f'),_0x3860('0x6b'),_0x3860('0x80')];return db['sequelize'][_0x3860('0x6d')](function(_0x5e2959){var _0x355f56=_[_0x3860('0x30')](_0x5337f0,function(_0x897ea0){var _0x221229={'attributes':['id',_0x3860('0x2e')]};return _0x486127[_0x3860('0x29')+_0x897ea0+_0x3860('0x5e')](_0x221229)[_0x3860('0x28')](function(_0xcd4bd3){var _0x6ce7e7=_[_0x3860('0x30')](_0xcd4bd3,function(_0x5bdd94){return _0x5bdd94[_0x3860('0x7d')](_0x279488[_0x3860('0x35')][_0x3860('0x66')],{'transaction':_0x5e2959})['then'](function(){var _0xf370f9=JSON[_0x3860('0x81')]('['+_0x279488[_0x3860('0x35')][_0x3860('0x66')]+']');var _0x4a3e1a=_[_0x3860('0x30')](_0xf370f9,function(_0x19ace1){socket[_0x3860('0x74')]('user'+_0x897ea0+_0x3860('0x82'),{'UserId':Number(_0x19ace1),[_0x897ea0+_0x3860('0x70')]:_0x5bdd94['id']});if(_0x897ea0!==_0x3860('0x68'))return;return db['UserVoiceQueueRt'][_0x3860('0x2c')]({'where':{'VoiceQueueId':_0x5bdd94['id'],'UserId':_0x19ace1},'transaction':_0x5e2959});});return Promise[_0x3860('0x7c')](_0x4a3e1a);});});return Promise[_0x3860('0x7c')](_0x6ce7e7);});});return Promise['all'](_0x355f56)[_0x3860('0x28')](function(){return _0x486127[_0x3860('0x7d')](_0x279488[_0x3860('0x35')]['ids'],{'transaction':_0x5e2959});});});}})[_0x3860('0x28')](respondWithStatusCode(_0x449262,null))[_0x3860('0x47')](handleError(_0x449262,null));};exports[_0x3860('0x83')]=function(_0x49bd84,_0x213c8f,_0x59a7c5){var _0x2e836e={};var _0x581e7b={};var _0x256156;var _0x418bb1;return db[_0x3860('0x31')][_0x3860('0x5f')]({'where':{'id':_0x49bd84[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x213c8f,null))[_0x3860('0x28')](function(_0x3c9ccc){if(_0x3c9ccc){_0x256156=_0x3c9ccc;_0x581e7b[_0x3860('0x34')]=_[_0x3860('0x36')](db[_0x3860('0x72')][_0x3860('0x4a')]);_0x581e7b[_0x3860('0x35')]=_[_0x3860('0x36')](_0x49bd84[_0x3860('0x35')]);_0x581e7b[_0x3860('0x37')]=_[_0x3860('0x38')](_0x581e7b[_0x3860('0x34')],_0x581e7b['query']);_0x2e836e[_0x3860('0x39')]=_[_0x3860('0x38')](_0x581e7b[_0x3860('0x34')],qs[_0x3860('0x3a')](_0x49bd84[_0x3860('0x35')][_0x3860('0x3a')]));_0x2e836e[_0x3860('0x39')]=_0x2e836e[_0x3860('0x39')][_0x3860('0x4b')]?_0x2e836e[_0x3860('0x39')]:_0x581e7b[_0x3860('0x34')];_0x2e836e['order']=qs[_0x3860('0x3e')](_0x49bd84[_0x3860('0x35')][_0x3860('0x3e')]);_0x2e836e[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x49bd84[_0x3860('0x35')],_0x581e7b[_0x3860('0x37')]));if(_0x49bd84[_0x3860('0x35')]['filter']){_0x2e836e[_0x3860('0x3f')]=_['merge'](_0x2e836e['where'],{'$or':_[_0x3860('0x30')](_0x2e836e[_0x3860('0x39')],function(_0x44cadf){var _0x1a994b={};_0x1a994b[_0x44cadf]={'$like':'%'+_0x49bd84[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x1a994b;})});}_0x2e836e=_[_0x3860('0x42')]({},_0x2e836e,_0x49bd84[_0x3860('0x44')]);return _0x256156[_0x3860('0x83')](_0x2e836e);}})[_0x3860('0x28')](function(_0x4677b0){if(_0x4677b0){_0x418bb1=_0x4677b0[_0x3860('0x4b')];if(!_0x49bd84[_0x3860('0x35')]['hasOwnProperty'](_0x3860('0x3c'))){_0x2e836e['limit']=qs[_0x3860('0x20')](_0x49bd84[_0x3860('0x35')]['limit']);_0x2e836e[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x49bd84[_0x3860('0x35')][_0x3860('0x22')]);}return _0x256156[_0x3860('0x83')](_0x2e836e);}})[_0x3860('0x28')](function(_0x12296a){if(_0x12296a){return _0x12296a?{'count':_0x418bb1,'rows':_0x12296a}:null;}})['then'](respondWithResult(_0x213c8f,null))[_0x3860('0x47')](handleError(_0x213c8f,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 0c2e191..bad4a2f 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 _0xbe63=['events','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4b3422,_0x4f8861){var _0x24e316=function(_0x569b74){while(--_0x569b74){_0x4b3422['push'](_0x4b3422['shift']());}};_0x24e316(++_0x4f8861);}(_0xbe63,0xa2));var _0x3be6=function(_0x1e081a,_0x482d6b){_0x1e081a=_0x1e081a-0x0;var _0x428209=_0xbe63[_0x1e081a];return _0x428209;};'use strict';var EventEmitter=require(_0x3be6('0x0'));var Team=require('../../mysqldb')['db'][_0x3be6('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x3be6('0x2')](0x0);var events={'afterCreate':_0x3be6('0x3'),'afterUpdate':_0x3be6('0x4'),'afterDestroy':_0x3be6('0x5')};function emitEvent(_0x48b346){return function(_0x32d6bc,_0x519ea3,_0x4f105b){TeamEvents[_0x3be6('0x6')](_0x48b346+':'+_0x32d6bc['id'],_0x32d6bc);TeamEvents[_0x3be6('0x6')](_0x48b346,_0x32d6bc);_0x4f105b(null);};}for(var e in events){if(events[_0x3be6('0x7')](e)){var event=events[e];Team[_0x3be6('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x528a=['Team','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x1c6f3e,_0x9d03c8){var _0x42e52d=function(_0x1433de){while(--_0x1433de){_0x1c6f3e['push'](_0x1c6f3e['shift']());}};_0x42e52d(++_0x9d03c8);}(_0x528a,0xf7));var _0xa528=function(_0x40b291,_0x39c8de){_0x40b291=_0x40b291-0x0;var _0x13bb6e=_0x528a[_0x40b291];return _0x13bb6e;};'use strict';var EventEmitter=require(_0xa528('0x0'));var Team=require('../../mysqldb')['db'][_0xa528('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa528('0x2'),'afterUpdate':_0xa528('0x3'),'afterDestroy':_0xa528('0x4')};function emitEvent(_0x14d6d3){return function(_0x2413bc,_0x5eb41a,_0x4f62ce){TeamEvents[_0xa528('0x5')](_0x14d6d3+':'+_0x2413bc['id'],_0x2413bc);TeamEvents[_0xa528('0x5')](_0x14d6d3,_0x2413bc);_0x4f62ce(null);};}for(var e in events){if(events[_0xa528('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xa528('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index b08eebe..f8d6c77 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 _0x731d=['bluebird','rimraf','./team.attributes','exports','Team','teams','lodash','util','api','moment'];(function(_0x237aab,_0x523604){var _0x55b525=function(_0x2336f1){while(--_0x2336f1){_0x237aab['push'](_0x237aab['shift']());}};_0x55b525(++_0x523604);}(_0x731d,0x114));var _0xd731=function(_0x563a09,_0x4d41c9){_0x563a09=_0x563a09-0x0;var _0x25eb15=_0x731d[_0x563a09];return _0x25eb15;};'use strict';var _=require(_0xd731('0x0'));var util=require(_0xd731('0x1'));var logger=require('../../config/logger')(_0xd731('0x2'));var moment=require(_0xd731('0x3'));var BPromise=require(_0xd731('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd731('0x5'));var config=require('../../config/environment');var attributes=require(_0xd731('0x6'));module[_0xd731('0x7')]=function(_0x44ea52,_0xdc4eb3){return _0x44ea52['define'](_0xd731('0x8'),attributes,{'tableName':_0xd731('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf967=['define','teams','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./team.attributes'];(function(_0x2e1645,_0x4cc157){var _0x580ad9=function(_0x3de0d9){while(--_0x3de0d9){_0x2e1645['push'](_0x2e1645['shift']());}};_0x580ad9(++_0x4cc157);}(_0xf967,0x120));var _0x7f96=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf967[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x7f96('0x0'));var util=require(_0x7f96('0x1'));var logger=require(_0x7f96('0x2'))('api');var moment=require(_0x7f96('0x3'));var BPromise=require(_0x7f96('0x4'));var rp=require(_0x7f96('0x5'));var fs=require('fs');var path=require(_0x7f96('0x6'));var rimraf=require(_0x7f96('0x7'));var config=require('../../config/environment');var attributes=require(_0x7f96('0x8'));module['exports']=function(_0x2baf6b,_0x121882){return _0x2baf6b[_0x7f96('0x9')]('Team',attributes,{'tableName':_0x7f96('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 522d121..966032d 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 _0xaee6=['request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','http','redis','defaults','localhost','./team.socket','register'];(function(_0x1ed707,_0x500ed8){var _0x3048aa=function(_0xbdf6ae){while(--_0xbdf6ae){_0x1ed707['push'](_0x1ed707['shift']());}};_0x3048aa(++_0x500ed8);}(_0xaee6,0x1eb));var _0x6aee=function(_0x54bd99,_0x2b83be){_0x54bd99=_0x54bd99-0x0;var _0x29ee4c=_0xaee6[_0x54bd99];return _0x29ee4c;};'use strict';var _=require(_0x6aee('0x0'));var util=require('util');var moment=require(_0x6aee('0x1'));var BPromise=require(_0x6aee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6aee('0x3'));var db=require(_0x6aee('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6aee('0x5'));var config=require(_0x6aee('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6aee('0x7')]({'port':0x232a});config[_0x6aee('0x8')]=_[_0x6aee('0x9')](config[_0x6aee('0x8')],{'host':_0x6aee('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6aee('0x8')]));require(_0x6aee('0xb'))[_0x6aee('0xc')](socket);function respondWithRpcPromise(_0x5ec100,_0x446b3a,_0x1f7afa){return new BPromise(function(_0x5b5f39,_0x1690bb){return client[_0x6aee('0xd')](_0x5ec100,_0x1f7afa)[_0x6aee('0xe')](function(_0xc77d09){logger[_0x6aee('0xf')](_0x6aee('0x10'),_0x446b3a,'request\x20sent');logger[_0x6aee('0x11')](_0x6aee('0x12'),_0x446b3a,_0x6aee('0x13'),JSON[_0x6aee('0x14')](_0xc77d09));if(_0xc77d09['error']){if(_0xc77d09[_0x6aee('0x15')][_0x6aee('0x16')]===0x1f4){logger[_0x6aee('0x15')](_0x6aee('0x10'),_0x446b3a,_0xc77d09['error'][_0x6aee('0x17')]);return _0x1690bb(_0xc77d09[_0x6aee('0x15')]['message']);}logger[_0x6aee('0x15')](_0x6aee('0x10'),_0x446b3a,_0xc77d09[_0x6aee('0x15')]['message']);return _0x5b5f39(_0xc77d09[_0x6aee('0x15')][_0x6aee('0x17')]);}else{logger[_0x6aee('0xf')]('Team,\x20%s,\x20%s',_0x446b3a,_0x6aee('0x13'));_0x5b5f39(_0xc77d09['result'][_0x6aee('0x17')]);}})['catch'](function(_0x4cd581){logger[_0x6aee('0x15')](_0x6aee('0x10'),_0x446b3a,_0x4cd581);_0x1690bb(_0x4cd581);});});} \ No newline at end of file +var _0x8b8c=['register','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5c4dc0,_0x4561e7){var _0xa7f222=function(_0x21ed2a){while(--_0x21ed2a){_0x5c4dc0['push'](_0x5c4dc0['shift']());}};_0xa7f222(++_0x4561e7);}(_0x8b8c,0x19c));var _0xc8b8=function(_0x5c6baf,_0xa4b45c){_0x5c6baf=_0x5c6baf-0x0;var _0x41de5d=_0x8b8c[_0x5c6baf];return _0x41de5d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc8b8('0x0'));var BPromise=require('bluebird');var rs=require(_0xc8b8('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8b8('0x2'))['db'];var utils=require(_0xc8b8('0x3'));var logger=require(_0xc8b8('0x4'))(_0xc8b8('0x5'));var config=require(_0xc8b8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc8b8('0x7')][_0xc8b8('0x8')]({'port':0x232a});config[_0xc8b8('0x9')]=_[_0xc8b8('0xa')](config[_0xc8b8('0x9')],{'host':_0xc8b8('0xb'),'port':0x18eb});var socket=require(_0xc8b8('0xc'))(new Redis(config[_0xc8b8('0x9')]));require('./team.socket')[_0xc8b8('0xd')](socket);function respondWithRpcPromise(_0xb13b83,_0x534b5a,_0x36d1f6){return new BPromise(function(_0x46d9b4,_0x42f308){return client['request'](_0xb13b83,_0x36d1f6)[_0xc8b8('0xe')](function(_0x50bd7a){logger[_0xc8b8('0xf')](_0xc8b8('0x10'),_0x534b5a,_0xc8b8('0x11'));logger['debug'](_0xc8b8('0x12'),_0x534b5a,_0xc8b8('0x11'),JSON[_0xc8b8('0x13')](_0x50bd7a));if(_0x50bd7a[_0xc8b8('0x14')]){if(_0x50bd7a[_0xc8b8('0x14')][_0xc8b8('0x15')]===0x1f4){logger[_0xc8b8('0x14')](_0xc8b8('0x10'),_0x534b5a,_0x50bd7a[_0xc8b8('0x14')][_0xc8b8('0x16')]);return _0x42f308(_0x50bd7a[_0xc8b8('0x14')][_0xc8b8('0x16')]);}logger['error']('Team,\x20%s,\x20%s',_0x534b5a,_0x50bd7a['error'][_0xc8b8('0x16')]);return _0x46d9b4(_0x50bd7a[_0xc8b8('0x14')][_0xc8b8('0x16')]);}else{logger[_0xc8b8('0xf')](_0xc8b8('0x10'),_0x534b5a,'request\x20sent');_0x46d9b4(_0x50bd7a[_0xc8b8('0x17')]['message']);}})[_0xc8b8('0x18')](function(_0xda9cc5){logger[_0xc8b8('0x14')](_0xc8b8('0x10'),_0x534b5a,_0xda9cc5);_0x42f308(_0xda9cc5);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index edef772..4cc2e32 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 _0x1574=['removeListener','register','length','team:','./team.events','save','remove','update','emit'];(function(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0x1574,0x148));var _0x4157=function(_0x31e365,_0x2fbb0c){_0x31e365=_0x31e365-0x0;var _0xfdb21a=_0x1574[_0x31e365];return _0xfdb21a;};'use strict';var TeamEvents=require(_0x4157('0x0'));var events=[_0x4157('0x1'),_0x4157('0x2'),_0x4157('0x3')];function createListener(_0x56ee53,_0x31fa4d){return function(_0x3bdabb){_0x31fa4d[_0x4157('0x4')](_0x56ee53,_0x3bdabb);};}function removeListener(_0x1759d6,_0x2f0766){return function(){TeamEvents[_0x4157('0x5')](_0x1759d6,_0x2f0766);};}exports[_0x4157('0x6')]=function(_0x43c6dc){for(var _0xbd0cf7=0x0,_0x1ece73=events[_0x4157('0x7')];_0xbd0cf7<_0x1ece73;_0xbd0cf7++){var _0x213c67=events[_0xbd0cf7];var _0x17a9ec=createListener(_0x4157('0x8')+_0x213c67,_0x43c6dc);TeamEvents['on'](_0x213c67,_0x17a9ec);}}; \ No newline at end of file +var _0x1410=['./team.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2d48bb,_0x448b76){var _0x2bc82f=function(_0x213313){while(--_0x213313){_0x2d48bb['push'](_0x2d48bb['shift']());}};_0x2bc82f(++_0x448b76);}(_0x1410,0x130));var _0x0141=function(_0x28b21d,_0x509832){_0x28b21d=_0x28b21d-0x0;var _0x2fb319=_0x1410[_0x28b21d];return _0x2fb319;};'use strict';var TeamEvents=require(_0x0141('0x0'));var events=[_0x0141('0x1'),_0x0141('0x2'),_0x0141('0x3')];function createListener(_0x52fda3,_0x3bb980){return function(_0x4f3258){_0x3bb980[_0x0141('0x4')](_0x52fda3,_0x4f3258);};}function removeListener(_0x5d2855,_0x194c72){return function(){TeamEvents[_0x0141('0x5')](_0x5d2855,_0x194c72);};}exports[_0x0141('0x6')]=function(_0x2aa85f){for(var _0x17e0c6=0x0,_0x24f701=events[_0x0141('0x7')];_0x17e0c6<_0x24f701;_0x17e0c6++){var _0x25511f=events[_0x17e0c6];var _0x2d8f15=createListener('team:'+_0x25511f,_0x2aa85f);TeamEvents['on'](_0x25511f,_0x2d8f15);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d9accef..1ccc476 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 _0xc06d=['Router','fs-extra','../../config/environment','multer','util','path','connect-timeout'];(function(_0x47ee8c,_0x1eaa34){var _0x10682f=function(_0x270d9b){while(--_0x270d9b){_0x47ee8c['push'](_0x47ee8c['shift']());}};_0x10682f(++_0x1eaa34);}(_0xc06d,0x15a));var _0xdc06=function(_0x54e539,_0x3be39e){_0x54e539=_0x54e539-0x0;var _0x1a14b8=_0xc06d[_0x54e539];return _0x1a14b8;};'use strict';var multer=require(_0xdc06('0x0'));var util=require(_0xdc06('0x1'));var path=require(_0xdc06('0x2'));var timeout=require(_0xdc06('0x3'));var express=require('express');var router=express[_0xdc06('0x4')]();var fs_extra=require(_0xdc06('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdc06('0x6'));module['exports']=router; \ No newline at end of file +var _0x0b0e=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','express','Router','fs-extra'];(function(_0x470e4f,_0x52b62b){var _0x3e4d21=function(_0x4425c8){while(--_0x4425c8){_0x470e4f['push'](_0x470e4f['shift']());}};_0x3e4d21(++_0x52b62b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0x0b0e[_0x48ec91];return _0x22766c;};'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'));module[_0xe0b0('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index bac457e..7e5429b 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 _0xbaf0=['exports','INTEGER'];(function(_0x313927,_0x2b3a6d){var _0x545b28=function(_0x1be96e){while(--_0x1be96e){_0x313927['push'](_0x313927['shift']());}};_0x545b28(++_0x2b3a6d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x45512f,_0xc21fc9){var _0x24a9f8=function(_0x5ee2ed){while(--_0x5ee2ed){_0x45512f['push'](_0x45512f['shift']());}};_0x24a9f8(++_0xc21fc9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index a3f11b1..ff5e723 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 _0x3347=['request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','api','moment','bluebird'];(function(_0x4a29a9,_0x58cd04){var _0x386570=function(_0x1d2d09){while(--_0x1d2d09){_0x4a29a9['push'](_0x4a29a9['shift']());}};_0x386570(++_0x58cd04);}(_0x3347,0xc8));var _0x7334=function(_0x5e07f6,_0x26f599){_0x5e07f6=_0x5e07f6-0x0;var _0x220f5c=_0x3347[_0x5e07f6];return _0x220f5c;};'use strict';var _=require(_0x7334('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7334('0x1'));var moment=require(_0x7334('0x2'));var BPromise=require(_0x7334('0x3'));var rp=require(_0x7334('0x4'));var fs=require('fs');var path=require(_0x7334('0x5'));var rimraf=require(_0x7334('0x6'));var config=require(_0x7334('0x7'));var attributes=require(_0x7334('0x8'));module['exports']=function(_0x1e05c4,_0x40a013){return _0x1e05c4[_0x7334('0x9')](_0x7334('0xa'),attributes,{'tableName':_0x7334('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dda=['lodash','util','../../config/logger','request-promise','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0x5a51c9,_0x1215cf){var _0x339613=function(_0x519865){while(--_0x519865){_0x5a51c9['push'](_0x5a51c9['shift']());}};_0x339613(++_0x1215cf);}(_0x9dda,0x14d));var _0xa9dd=function(_0x41a70a,_0x2396ef){_0x41a70a=_0x41a70a-0x0;var _0x3ad241=_0x9dda[_0x41a70a];return _0x3ad241;};'use strict';var _=require(_0xa9dd('0x0'));var util=require(_0xa9dd('0x1'));var logger=require(_0xa9dd('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa9dd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa9dd('0x4'));var attributes=require(_0xa9dd('0x5'));module[_0xa9dd('0x6')]=function(_0x223af4,_0x19fad4){return _0x223af4[_0xa9dd('0x7')](_0xa9dd('0x8'),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 34bd771..59741ff 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 _0x0eed=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x26fe8f,_0x160206){var _0x507ee2=function(_0x32f54c){while(--_0x32f54c){_0x26fe8f['push'](_0x26fe8f['shift']());}};_0x507ee2(++_0x160206);}(_0x0eed,0xbb));var _0xd0ee=function(_0xa2bf54,_0x5150bb){_0xa2bf54=_0xa2bf54-0x0;var _0x212615=_0x0eed[_0xa2bf54];return _0x212615;};'use strict';var _=require(_0xd0ee('0x0'));var util=require(_0xd0ee('0x1'));var moment=require(_0xd0ee('0x2'));var BPromise=require(_0xd0ee('0x3'));var rs=require(_0xd0ee('0x4'));var fs=require('fs');var Redis=require(_0xd0ee('0x5'));var db=require(_0xd0ee('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd0ee('0x7'));var jayson=require(_0xd0ee('0x8'));var client=jayson[_0xd0ee('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f5aab,_0x87dccb,_0x420689){return new BPromise(function(_0x8e7c52,_0x48e3be){return client[_0xd0ee('0xa')](_0x5f5aab,_0x420689)['then'](function(_0x130d33){logger['info'](_0xd0ee('0xb'),_0x87dccb,_0xd0ee('0xc'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x87dccb,_0xd0ee('0xc'),JSON[_0xd0ee('0xd')](_0x130d33));if(_0x130d33[_0xd0ee('0xe')]){if(_0x130d33['error']['code']===0x1f4){logger[_0xd0ee('0xe')](_0xd0ee('0xb'),_0x87dccb,_0x130d33[_0xd0ee('0xe')][_0xd0ee('0xf')]);return _0x48e3be(_0x130d33[_0xd0ee('0xe')]['message']);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x87dccb,_0x130d33[_0xd0ee('0xe')][_0xd0ee('0xf')]);return _0x8e7c52(_0x130d33[_0xd0ee('0xe')][_0xd0ee('0xf')]);}else{logger[_0xd0ee('0x10')](_0xd0ee('0xb'),_0x87dccb,_0xd0ee('0xc'));_0x8e7c52(_0x130d33[_0xd0ee('0x11')]['message']);}})[_0xd0ee('0x12')](function(_0x39606e){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x87dccb,_0x39606e);_0x48e3be(_0x39606e);});});} \ No newline at end of file +var _0x5337=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x3ed6ba,_0x3736c5){var _0x563ea5=function(_0x447cba){while(--_0x447cba){_0x3ed6ba['push'](_0x3ed6ba['shift']());}};_0x563ea5(++_0x3736c5);}(_0x5337,0x1c9));var _0x7533=function(_0x761b6d,_0x7c7fa8){_0x761b6d=_0x761b6d-0x0;var _0x3a1639=_0x5337[_0x761b6d];return _0x3a1639;};'use strict';var _=require(_0x7533('0x0'));var util=require(_0x7533('0x1'));var moment=require(_0x7533('0x2'));var BPromise=require(_0x7533('0x3'));var rs=require(_0x7533('0x4'));var fs=require('fs');var Redis=require(_0x7533('0x5'));var db=require(_0x7533('0x6'))['db'];var utils=require(_0x7533('0x7'));var logger=require(_0x7533('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7533('0x9'));var client=jayson[_0x7533('0xa')][_0x7533('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf04bd8,_0x547dc6,_0x419db9){return new BPromise(function(_0x4241ee,_0xdfa5d5){return client[_0x7533('0xc')](_0xf04bd8,_0x419db9)['then'](function(_0x45462e){logger[_0x7533('0xd')](_0x7533('0xe'),_0x547dc6,_0x7533('0xf'));logger['debug'](_0x7533('0x10'),_0x547dc6,_0x7533('0xf'),JSON[_0x7533('0x11')](_0x45462e));if(_0x45462e[_0x7533('0x12')]){if(_0x45462e[_0x7533('0x12')][_0x7533('0x13')]===0x1f4){logger['error'](_0x7533('0xe'),_0x547dc6,_0x45462e[_0x7533('0x12')][_0x7533('0x14')]);return _0xdfa5d5(_0x45462e[_0x7533('0x12')]['message']);}logger[_0x7533('0x12')](_0x7533('0xe'),_0x547dc6,_0x45462e[_0x7533('0x12')][_0x7533('0x14')]);return _0x4241ee(_0x45462e[_0x7533('0x12')][_0x7533('0x14')]);}else{logger['info'](_0x7533('0xe'),_0x547dc6,_0x7533('0xf'));_0x4241ee(_0x45462e[_0x7533('0x15')][_0x7533('0x14')]);}})[_0x7533('0x16')](function(_0x4bde07){logger[_0x7533('0x12')](_0x7533('0xe'),_0x547dc6,_0x4bde07);_0xdfa5d5(_0x4bde07);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index c20d92a..d46d6ef 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 _0x814b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x538be0,_0x4926f3){var _0x18ca1e=function(_0x3fe598){while(--_0x3fe598){_0x538be0['push'](_0x538be0['shift']());}};_0x18ca1e(++_0x4926f3);}(_0x814b,0x1a2));var _0xb814=function(_0x1c08f6,_0x14c077){_0x1c08f6=_0x1c08f6-0x0;var _0xbc156a=_0x814b[_0x1c08f6];return _0xbc156a;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xe')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['destroy']);module[_0xb814('0x13')]=router; \ No newline at end of file +var _0x3f8a=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show'];(function(_0xdb951d,_0x1dc42b){var _0x5e789e=function(_0x1056cd){while(--_0x1056cd){_0xdb951d['push'](_0xdb951d['shift']());}};_0x5e789e(++_0x1dc42b);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x38a045,_0x402d6b){_0x38a045=_0x38a045-0x0;var _0x45c34c=_0x3f8a[_0x38a045];return _0x45c34c;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xa')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xf')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router[_0xa3f8('0x11')]('/:id',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x12')]);router[_0xa3f8('0x13')](_0xa3f8('0xd'),auth['isAuthenticated'](),controller[_0xa3f8('0x14')]);module[_0xa3f8('0x15')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 01049de..7861fc3 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 _0xe1a9=['TEXT','sequelize','exports','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe1a9,0x17d));var _0x9e1a=function(_0x42c23e,_0x340d6b){_0x42c23e=_0x42c23e-0x0;var _0x3f59a0=_0xe1a9[_0x42c23e];return _0x3f59a0;};'use strict';var Sequelize=require(_0x9e1a('0x0'));module[_0x9e1a('0x1')]={'name':{'type':Sequelize[_0x9e1a('0x2')]},'description':{'type':Sequelize[_0x9e1a('0x2')]},'html':{'type':Sequelize[_0x9e1a('0x3')]}}; \ No newline at end of file +var _0x5c46=['TEXT','STRING'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x5c46,0x71));var _0x65c4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c46[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x65c4('0x0')]},'description':{'type':Sequelize[_0x65c4('0x0')]},'html':{'type':Sequelize[_0x65c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index cba82b8..a9fa39f 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 _0x987b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','Templates','sendStatus','name','send','index','map','Template','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','catch','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4fa87b,_0xdb6adc){var _0x4130d9=function(_0x5052f8){while(--_0x5052f8){_0x4fa87b['push'](_0x4fa87b['shift']());}};_0x4130d9(++_0xdb6adc);}(_0x987b,0x94));var _0xb987=function(_0x4d9142,_0x75ad4a){_0x4d9142=_0x4d9142-0x0;var _0x3d3139=_0x987b[_0x4d9142];return _0x3d3139;};'use strict';var emlformat=require(_0xb987('0x0'));var rimraf=require(_0xb987('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb987('0x2'));var rp=require(_0xb987('0x3'));var moment=require(_0xb987('0x4'));var BPromise=require(_0xb987('0x5'));var Mustache=require('mustache');var util=require(_0xb987('0x6'));var path=require(_0xb987('0x7'));var sox=require(_0xb987('0x8'));var csv=require(_0xb987('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb987('0xa'));var _=require(_0xb987('0xb'));var squel=require(_0xb987('0xc'));var crypto=require(_0xb987('0xd'));var jsforce=require(_0xb987('0xe'));var deskjs=require(_0xb987('0xf'));var toCsv=require(_0xb987('0x9'));var querystring=require(_0xb987('0x10'));var Papa=require(_0xb987('0x11'));var Redis=require(_0xb987('0x12'));var authService=require(_0xb987('0x13'));var qs=require(_0xb987('0x14'));var as=require(_0xb987('0x15'));var hardwareService=require(_0xb987('0x16'));var logger=require(_0xb987('0x17'))(_0xb987('0x18'));var utils=require(_0xb987('0x19'));var config=require(_0xb987('0x1a'));var licenseUtil=require(_0xb987('0x1b'));var db=require(_0xb987('0x1c'))['db'];function respondWithStatusCode(_0x2d72b3,_0x492994){_0x492994=_0x492994||0xcc;return function(_0x42186d){if(_0x42186d){return _0x2d72b3['sendStatus'](_0x492994);}return _0x2d72b3[_0xb987('0x1d')](_0x492994)[_0xb987('0x1e')]();};}function respondWithResult(_0x51cdc3,_0x13e75e){_0x13e75e=_0x13e75e||0xc8;return function(_0x71e09d){if(_0x71e09d){return _0x51cdc3[_0xb987('0x1d')](_0x13e75e)[_0xb987('0x1f')](_0x71e09d);}};}function respondWithFilteredResult(_0x57f701,_0x5c54ea){return function(_0x29f25d){if(_0x29f25d){var _0xea7823=typeof _0x5c54ea[_0xb987('0x20')]==='undefined'&&typeof _0x5c54ea['limit']===_0xb987('0x21');var _0xd17947=_0x29f25d[_0xb987('0x22')];var _0xbebc84=_0xea7823?0x0:_0x5c54ea['offset'];var _0x2a8983=_0xea7823?_0x29f25d[_0xb987('0x22')]:_0x5c54ea[_0xb987('0x20')]+_0x5c54ea[_0xb987('0x23')];var _0x214786;if(_0x2a8983>=_0xd17947){_0x2a8983=_0xd17947;_0x214786=0xc8;}else{_0x214786=0xce;}_0x57f701[_0xb987('0x1d')](_0x214786);return _0x57f701[_0xb987('0x24')](_0xb987('0x25'),_0xbebc84+'-'+_0x2a8983+'/'+_0xd17947)[_0xb987('0x1f')](_0x29f25d);}return null;};}function patchUpdates(_0x2fddf3){return function(_0x341e6b){try{jsonpatch[_0xb987('0x26')](_0x341e6b,_0x2fddf3,!![]);}catch(_0xd9edf6){return BPromise[_0xb987('0x27')](_0xd9edf6);}return _0x341e6b['save']();};}function saveUpdates(_0x2ba922,_0x309e3e){return function(_0x551c2b){if(_0x551c2b){return _0x551c2b[_0xb987('0x28')](_0x2ba922)[_0xb987('0x29')](function(_0x456ce7){return _0x456ce7;});}return null;};}function removeEntity(_0x5b1ea0,_0x28bcd6){return function(_0x493e43){if(_0x493e43){return _0x493e43[_0xb987('0x2a')]()[_0xb987('0x29')](function(){var _0x3d9f46=_0x493e43[_0xb987('0x2b')]({'plain':!![]});var _0x355ee7=_0xb987('0x2c');return db['UserProfileResource'][_0xb987('0x2a')]({'where':{'type':_0x355ee7,'resourceId':_0x3d9f46['id']}})[_0xb987('0x29')](function(){return _0x493e43;});})[_0xb987('0x29')](function(){_0x5b1ea0[_0xb987('0x1d')](0xcc)[_0xb987('0x1e')]();});}};}function handleEntityNotFound(_0x4fb6f6,_0x13e768){return function(_0x44f76b){if(!_0x44f76b){_0x4fb6f6[_0xb987('0x2d')](0x194);}return _0x44f76b;};}function handleError(_0x22db1d,_0x24b3d9){_0x24b3d9=_0x24b3d9||0x1f4;return function(_0x1d4b23){logger['error'](_0x1d4b23['stack']);if(_0x1d4b23[_0xb987('0x2e')]){delete _0x1d4b23['name'];}_0x22db1d[_0xb987('0x1d')](_0x24b3d9)[_0xb987('0x2f')](_0x1d4b23);};}exports[_0xb987('0x30')]=function(_0x1ff6a5,_0x57ea31){var _0x112204={},_0xbe078c={},_0x1b7dfa={'count':0x0,'rows':[]};var _0x5b253b=_[_0xb987('0x31')](db[_0xb987('0x32')]['rawAttributes'],function(_0x58d9ba){return{'name':_0x58d9ba[_0xb987('0x33')],'type':_0x58d9ba[_0xb987('0x34')][_0xb987('0x35')]};});_0xbe078c['model']=_['map'](_0x5b253b,_0xb987('0x2e'));_0xbe078c[_0xb987('0x36')]=_[_0xb987('0x37')](_0x1ff6a5[_0xb987('0x36')]);_0xbe078c[_0xb987('0x38')]=_[_0xb987('0x39')](_0xbe078c[_0xb987('0x3a')],_0xbe078c['query']);_0x112204[_0xb987('0x3b')]=_[_0xb987('0x39')](_0xbe078c[_0xb987('0x3a')],qs[_0xb987('0x3c')](_0x1ff6a5[_0xb987('0x36')][_0xb987('0x3c')]));_0x112204['attributes']=_0x112204[_0xb987('0x3b')][_0xb987('0x3d')]?_0x112204[_0xb987('0x3b')]:_0xbe078c[_0xb987('0x3a')];if(!_0x1ff6a5['query'][_0xb987('0x3e')](_0xb987('0x3f'))){_0x112204[_0xb987('0x23')]=qs[_0xb987('0x23')](_0x1ff6a5['query'][_0xb987('0x23')]);_0x112204['offset']=qs[_0xb987('0x20')](_0x1ff6a5[_0xb987('0x36')][_0xb987('0x20')]);}_0x112204['order']=qs[_0xb987('0x40')](_0x1ff6a5['query'][_0xb987('0x40')]);_0x112204[_0xb987('0x41')]=qs[_0xb987('0x38')](_['pick'](_0x1ff6a5['query'],_0xbe078c['filters']),_0x5b253b);if(_0x1ff6a5[_0xb987('0x36')][_0xb987('0x42')]){_0x112204[_0xb987('0x41')]=_[_0xb987('0x43')](_0x112204[_0xb987('0x41')],{'$or':_[_0xb987('0x31')](_0x5b253b,function(_0x173ae3){if(_0x173ae3[_0xb987('0x34')]!==_0xb987('0x44')){var _0x42266f={};_0x42266f[_0x173ae3['name']]={'$like':'%'+_0x1ff6a5['query'][_0xb987('0x42')]+'%'};return _0x42266f;}})});}_0x112204=_['merge']({},_0x112204,_0x1ff6a5['options']);var _0x3c0df6={'where':_0x112204['where']};return db[_0xb987('0x32')][_0xb987('0x22')](_0x3c0df6)[_0xb987('0x29')](function(_0x35f045){_0x1b7dfa[_0xb987('0x22')]=_0x35f045;if(_0x1ff6a5[_0xb987('0x36')][_0xb987('0x45')]){_0x112204['include']=[{'all':!![]}];}return db['Template'][_0xb987('0x46')](_0x112204);})[_0xb987('0x29')](function(_0x3779b7){_0x1b7dfa[_0xb987('0x47')]=_0x3779b7;return _0x1b7dfa;})['then'](respondWithFilteredResult(_0x57ea31,_0x112204))['catch'](handleError(_0x57ea31,null));};exports[_0xb987('0x48')]=function(_0x458baf,_0x1d20e1){var _0xd09267={'raw':!![],'where':{'id':_0x458baf['params']['id']}},_0x3118b5={};_0x3118b5[_0xb987('0x3a')]=_[_0xb987('0x37')](db[_0xb987('0x32')]['rawAttributes']);_0x3118b5[_0xb987('0x36')]=_[_0xb987('0x37')](_0x458baf[_0xb987('0x36')]);_0x3118b5[_0xb987('0x38')]=_[_0xb987('0x39')](_0x3118b5[_0xb987('0x3a')],_0x3118b5[_0xb987('0x36')]);_0xd09267['attributes']=_[_0xb987('0x39')](_0x3118b5['model'],qs[_0xb987('0x3c')](_0x458baf[_0xb987('0x36')][_0xb987('0x3c')]));_0xd09267[_0xb987('0x3b')]=_0xd09267[_0xb987('0x3b')][_0xb987('0x3d')]?_0xd09267['attributes']:_0x3118b5[_0xb987('0x3a')];if(_0x458baf[_0xb987('0x36')][_0xb987('0x45')]){_0xd09267[_0xb987('0x49')]=[{'all':!![]}];}_0xd09267=_[_0xb987('0x43')]({},_0xd09267,_0x458baf[_0xb987('0x4a')]);return db['Template'][_0xb987('0x4b')](_0xd09267)[_0xb987('0x29')](handleEntityNotFound(_0x1d20e1,null))[_0xb987('0x29')](respondWithResult(_0x1d20e1,null))['catch'](handleError(_0x1d20e1,null));};exports['create']=function(_0x4dc6a1,_0x1b3dbd){return db[_0xb987('0x32')][_0xb987('0x4c')](_0x4dc6a1[_0xb987('0x4d')],{})['then'](function(_0xb0ab36){var _0x532e52=_0x4dc6a1[_0xb987('0x4e')][_0xb987('0x2b')]({'plain':!![]});if(!_0x532e52)throw new Error(_0xb987('0x4f'));if(_0x532e52[_0xb987('0x50')]==='user'){var _0x2e612c=_0xb0ab36[_0xb987('0x2b')]({'plain':!![]});var _0x1938d7=_0xb987('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x1938d7,'userProfileId':_0x532e52['userProfileId']},'raw':!![]})[_0xb987('0x29')](function(_0x119b16){if(_0x119b16&&_0x119b16['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2e612c[_0xb987('0x2e')],'resourceId':_0x2e612c['id'],'type':_0x119b16['name'],'sectionId':_0x119b16['id']},{})[_0xb987('0x29')](function(){return _0xb0ab36;});}else{return _0xb0ab36;}})[_0xb987('0x51')](function(_0x2fdec4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fdec4);throw _0x2fdec4;});}return _0xb0ab36;})['then'](respondWithResult(_0x1b3dbd,0xc9))[_0xb987('0x51')](handleError(_0x1b3dbd,null));};exports[_0xb987('0x28')]=function(_0x4faaaf,_0x245d75){if(_0x4faaaf[_0xb987('0x4d')]['id']){delete _0x4faaaf[_0xb987('0x4d')]['id'];}return db[_0xb987('0x32')][_0xb987('0x4b')]({'where':{'id':_0x4faaaf['params']['id']}})[_0xb987('0x29')](handleEntityNotFound(_0x245d75,null))[_0xb987('0x29')](saveUpdates(_0x4faaaf[_0xb987('0x4d')],null))[_0xb987('0x29')](respondWithResult(_0x245d75,null))[_0xb987('0x51')](handleError(_0x245d75,null));};exports[_0xb987('0x2a')]=function(_0x5c58d3,_0x27b50b){return db[_0xb987('0x32')][_0xb987('0x4b')]({'where':{'id':_0x5c58d3[_0xb987('0x52')]['id']}})[_0xb987('0x29')](handleEntityNotFound(_0x27b50b,null))[_0xb987('0x29')](removeEntity(_0x27b50b,null))[_0xb987('0x51')](handleError(_0x27b50b,null));}; \ No newline at end of file +var _0x6940=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','length','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x53d3b0,_0x62aa42){var _0x44f608=function(_0x47f276){while(--_0x47f276){_0x53d3b0['push'](_0x53d3b0['shift']());}};_0x44f608(++_0x62aa42);}(_0x6940,0x154));var _0x0694=function(_0x1af8d9,_0x83c6a0){_0x1af8d9=_0x1af8d9-0x0;var _0x2ba783=_0x6940[_0x1af8d9];return _0x2ba783;};'use strict';var emlformat=require(_0x0694('0x0'));var rimraf=require(_0x0694('0x1'));var zipdir=require(_0x0694('0x2'));var jsonpatch=require(_0x0694('0x3'));var rp=require(_0x0694('0x4'));var moment=require(_0x0694('0x5'));var BPromise=require(_0x0694('0x6'));var Mustache=require(_0x0694('0x7'));var util=require(_0x0694('0x8'));var path=require('path');var sox=require(_0x0694('0x9'));var csv=require(_0x0694('0xa'));var ejs=require(_0x0694('0xb'));var fs=require('fs');var fs_extra=require(_0x0694('0xc'));var _=require(_0x0694('0xd'));var squel=require('squel');var crypto=require(_0x0694('0xe'));var jsforce=require(_0x0694('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0694('0xa'));var querystring=require(_0x0694('0x10'));var Papa=require(_0x0694('0x11'));var Redis=require(_0x0694('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0694('0x13'));var as=require(_0x0694('0x14'));var hardwareService=require(_0x0694('0x15'));var logger=require(_0x0694('0x16'))(_0x0694('0x17'));var utils=require('../../config/utils');var config=require(_0x0694('0x18'));var licenseUtil=require(_0x0694('0x19'));var db=require(_0x0694('0x1a'))['db'];function respondWithStatusCode(_0x45c3fc,_0x5809bf){_0x5809bf=_0x5809bf||0xcc;return function(_0x3d89e4){if(_0x3d89e4){return _0x45c3fc[_0x0694('0x1b')](_0x5809bf);}return _0x45c3fc[_0x0694('0x1c')](_0x5809bf)[_0x0694('0x1d')]();};}function respondWithResult(_0xf39edb,_0x52ac54){_0x52ac54=_0x52ac54||0xc8;return function(_0x444941){if(_0x444941){return _0xf39edb[_0x0694('0x1c')](_0x52ac54)['json'](_0x444941);}};}function respondWithFilteredResult(_0x11a000,_0x3e58d3){return function(_0x23b49c){if(_0x23b49c){var _0x18d920=typeof _0x3e58d3[_0x0694('0x1e')]==='undefined'&&typeof _0x3e58d3[_0x0694('0x1f')]===_0x0694('0x20');var _0x35b061=_0x23b49c[_0x0694('0x21')];var _0x2dcc70=_0x18d920?0x0:_0x3e58d3[_0x0694('0x1e')];var _0x54ca49=_0x18d920?_0x23b49c[_0x0694('0x21')]:_0x3e58d3[_0x0694('0x1e')]+_0x3e58d3['limit'];var _0x16f41e;if(_0x54ca49>=_0x35b061){_0x54ca49=_0x35b061;_0x16f41e=0xc8;}else{_0x16f41e=0xce;}_0x11a000[_0x0694('0x1c')](_0x16f41e);return _0x11a000[_0x0694('0x22')](_0x0694('0x23'),_0x2dcc70+'-'+_0x54ca49+'/'+_0x35b061)[_0x0694('0x24')](_0x23b49c);}return null;};}function patchUpdates(_0x1a307f){return function(_0x11189e){try{jsonpatch[_0x0694('0x25')](_0x11189e,_0x1a307f,!![]);}catch(_0x4f2223){return BPromise[_0x0694('0x26')](_0x4f2223);}return _0x11189e[_0x0694('0x27')]();};}function saveUpdates(_0x149e78,_0x51c678){return function(_0x561096){if(_0x561096){return _0x561096['update'](_0x149e78)[_0x0694('0x28')](function(_0x2b58e0){return _0x2b58e0;});}return null;};}function removeEntity(_0x40ef06,_0x5dce26){return function(_0x3db1e4){if(_0x3db1e4){return _0x3db1e4[_0x0694('0x29')]()['then'](function(){var _0x154a16=_0x3db1e4[_0x0694('0x2a')]({'plain':!![]});var _0x122369=_0x0694('0x2b');return db[_0x0694('0x2c')][_0x0694('0x29')]({'where':{'type':_0x122369,'resourceId':_0x154a16['id']}})[_0x0694('0x28')](function(){return _0x3db1e4;});})[_0x0694('0x28')](function(){_0x40ef06[_0x0694('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454ad3,_0x10ea91){return function(_0x1a78a8){if(!_0x1a78a8){_0x454ad3[_0x0694('0x1b')](0x194);}return _0x1a78a8;};}function handleError(_0x5486d6,_0x3e6d7f){_0x3e6d7f=_0x3e6d7f||0x1f4;return function(_0x68ab16){logger[_0x0694('0x2d')](_0x68ab16[_0x0694('0x2e')]);if(_0x68ab16['name']){delete _0x68ab16[_0x0694('0x2f')];}_0x5486d6['status'](_0x3e6d7f)[_0x0694('0x30')](_0x68ab16);};}exports[_0x0694('0x31')]=function(_0x3b2888,_0x2cf8ce){var _0x51873f={},_0x1d1b0e={},_0x1b44c5={'count':0x0,'rows':[]};var _0x43ff2d=_[_0x0694('0x32')](db[_0x0694('0x33')][_0x0694('0x34')],function(_0x543677){return{'name':_0x543677[_0x0694('0x35')],'type':_0x543677[_0x0694('0x36')]['key']};});_0x1d1b0e['model']=_[_0x0694('0x32')](_0x43ff2d,_0x0694('0x2f'));_0x1d1b0e[_0x0694('0x37')]=_[_0x0694('0x38')](_0x3b2888[_0x0694('0x37')]);_0x1d1b0e[_0x0694('0x39')]=_['intersection'](_0x1d1b0e[_0x0694('0x3a')],_0x1d1b0e[_0x0694('0x37')]);_0x51873f[_0x0694('0x3b')]=_[_0x0694('0x3c')](_0x1d1b0e['model'],qs['fields'](_0x3b2888[_0x0694('0x37')]['fields']));_0x51873f[_0x0694('0x3b')]=_0x51873f[_0x0694('0x3b')][_0x0694('0x3d')]?_0x51873f[_0x0694('0x3b')]:_0x1d1b0e[_0x0694('0x3a')];if(!_0x3b2888[_0x0694('0x37')]['hasOwnProperty']('nolimit')){_0x51873f[_0x0694('0x1f')]=qs[_0x0694('0x1f')](_0x3b2888[_0x0694('0x37')][_0x0694('0x1f')]);_0x51873f[_0x0694('0x1e')]=qs[_0x0694('0x1e')](_0x3b2888[_0x0694('0x37')][_0x0694('0x1e')]);}_0x51873f[_0x0694('0x3e')]=qs[_0x0694('0x3f')](_0x3b2888[_0x0694('0x37')][_0x0694('0x3f')]);_0x51873f['where']=qs[_0x0694('0x39')](_['pick'](_0x3b2888['query'],_0x1d1b0e[_0x0694('0x39')]),_0x43ff2d);if(_0x3b2888[_0x0694('0x37')][_0x0694('0x40')]){_0x51873f['where']=_[_0x0694('0x41')](_0x51873f[_0x0694('0x42')],{'$or':_['map'](_0x43ff2d,function(_0x2c45e3){if(_0x2c45e3['type']!==_0x0694('0x43')){var _0xd9c9f7={};_0xd9c9f7[_0x2c45e3[_0x0694('0x2f')]]={'$like':'%'+_0x3b2888[_0x0694('0x37')]['filter']+'%'};return _0xd9c9f7;}})});}_0x51873f=_[_0x0694('0x41')]({},_0x51873f,_0x3b2888[_0x0694('0x44')]);var _0x5c7460={'where':_0x51873f['where']};return db[_0x0694('0x33')][_0x0694('0x21')](_0x5c7460)['then'](function(_0x3b51ad){_0x1b44c5[_0x0694('0x21')]=_0x3b51ad;if(_0x3b2888[_0x0694('0x37')][_0x0694('0x45')]){_0x51873f[_0x0694('0x46')]=[{'all':!![]}];}return db[_0x0694('0x33')][_0x0694('0x47')](_0x51873f);})['then'](function(_0x1b0e31){_0x1b44c5['rows']=_0x1b0e31;return _0x1b44c5;})['then'](respondWithFilteredResult(_0x2cf8ce,_0x51873f))[_0x0694('0x48')](handleError(_0x2cf8ce,null));};exports[_0x0694('0x49')]=function(_0x56c94c,_0x9e3f5c){var _0xd0bde2={'raw':!![],'where':{'id':_0x56c94c[_0x0694('0x4a')]['id']}},_0x495c27={};_0x495c27['model']=_['keys'](db['Template'][_0x0694('0x34')]);_0x495c27[_0x0694('0x37')]=_[_0x0694('0x38')](_0x56c94c[_0x0694('0x37')]);_0x495c27['filters']=_[_0x0694('0x3c')](_0x495c27[_0x0694('0x3a')],_0x495c27[_0x0694('0x37')]);_0xd0bde2[_0x0694('0x3b')]=_[_0x0694('0x3c')](_0x495c27[_0x0694('0x3a')],qs['fields'](_0x56c94c[_0x0694('0x37')][_0x0694('0x4b')]));_0xd0bde2[_0x0694('0x3b')]=_0xd0bde2[_0x0694('0x3b')][_0x0694('0x3d')]?_0xd0bde2[_0x0694('0x3b')]:_0x495c27[_0x0694('0x3a')];if(_0x56c94c[_0x0694('0x37')]['includeAll']){_0xd0bde2[_0x0694('0x46')]=[{'all':!![]}];}_0xd0bde2=_[_0x0694('0x41')]({},_0xd0bde2,_0x56c94c[_0x0694('0x44')]);return db[_0x0694('0x33')][_0x0694('0x4c')](_0xd0bde2)[_0x0694('0x28')](handleEntityNotFound(_0x9e3f5c,null))['then'](respondWithResult(_0x9e3f5c,null))[_0x0694('0x48')](handleError(_0x9e3f5c,null));};exports[_0x0694('0x4d')]=function(_0x52fb60,_0x418ab9){return db['Template'][_0x0694('0x4d')](_0x52fb60['body'],{})[_0x0694('0x28')](function(_0x236085){var _0x4f5d0d=_0x52fb60[_0x0694('0x4e')][_0x0694('0x2a')]({'plain':!![]});if(!_0x4f5d0d)throw new Error(_0x0694('0x4f'));if(_0x4f5d0d['role']==='user'){var _0x3a633f=_0x236085[_0x0694('0x2a')]({'plain':!![]});var _0x284cdd=_0x0694('0x2b');return db['UserProfileSection'][_0x0694('0x4c')]({'where':{'name':_0x284cdd,'userProfileId':_0x4f5d0d['userProfileId']},'raw':!![]})['then'](function(_0x1e93a9){if(_0x1e93a9&&_0x1e93a9[_0x0694('0x50')]===0x0){return db['UserProfileResource'][_0x0694('0x4d')]({'name':_0x3a633f[_0x0694('0x2f')],'resourceId':_0x3a633f['id'],'type':_0x1e93a9[_0x0694('0x2f')],'sectionId':_0x1e93a9['id']},{})[_0x0694('0x28')](function(){return _0x236085;});}else{return _0x236085;}})['catch'](function(_0x1e2bcf){logger['error'](_0x0694('0x51'),_0x1e2bcf);throw _0x1e2bcf;});}return _0x236085;})['then'](respondWithResult(_0x418ab9,0xc9))['catch'](handleError(_0x418ab9,null));};exports[_0x0694('0x52')]=function(_0x1eeb8e,_0x48ece7){if(_0x1eeb8e[_0x0694('0x53')]['id']){delete _0x1eeb8e[_0x0694('0x53')]['id'];}return db['Template'][_0x0694('0x4c')]({'where':{'id':_0x1eeb8e[_0x0694('0x4a')]['id']}})[_0x0694('0x28')](handleEntityNotFound(_0x48ece7,null))['then'](saveUpdates(_0x1eeb8e['body'],null))[_0x0694('0x28')](respondWithResult(_0x48ece7,null))[_0x0694('0x48')](handleError(_0x48ece7,null));};exports['destroy']=function(_0x300a1e,_0x3ac928){return db[_0x0694('0x33')][_0x0694('0x4c')]({'where':{'id':_0x300a1e[_0x0694('0x4a')]['id']}})[_0x0694('0x28')](handleEntityNotFound(_0x3ac928,null))[_0x0694('0x28')](removeEntity(_0x3ac928,null))[_0x0694('0x48')](handleError(_0x3ac928,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index fdd6a03..abc0130 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 _0xd310=['path','../../config/environment','./template.attributes','define','tools_templates','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0xd310,0x1c8));var _0x0d31=function(_0x56d6c9,_0x4ec621){_0x56d6c9=_0x56d6c9-0x0;var _0x5166ca=_0xd310[_0x56d6c9];return _0x5166ca;};'use strict';var _=require(_0x0d31('0x0'));var util=require(_0x0d31('0x1'));var logger=require(_0x0d31('0x2'))(_0x0d31('0x3'));var moment=require(_0x0d31('0x4'));var BPromise=require('bluebird');var rp=require(_0x0d31('0x5'));var fs=require('fs');var path=require(_0x0d31('0x6'));var rimraf=require('rimraf');var config=require(_0x0d31('0x7'));var attributes=require(_0x0d31('0x8'));module['exports']=function(_0x342d19,_0x5d8ae1){return _0x342d19[_0x0d31('0x9')]('Template',attributes,{'tableName':_0x0d31('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a90=['api','moment','request-promise','path','rimraf','exports','define','Template','tools_templates','lodash','util','../../config/logger'];(function(_0x1ed8fc,_0xe6d93f){var _0x4bed67=function(_0x444e45){while(--_0x444e45){_0x1ed8fc['push'](_0x1ed8fc['shift']());}};_0x4bed67(++_0xe6d93f);}(_0x1a90,0x8d));var _0x01a9=function(_0x563e95,_0x280898){_0x563e95=_0x563e95-0x0;var _0x4e08ff=_0x1a90[_0x563e95];return _0x4e08ff;};'use strict';var _=require(_0x01a9('0x0'));var util=require(_0x01a9('0x1'));var logger=require(_0x01a9('0x2'))(_0x01a9('0x3'));var moment=require(_0x01a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x01a9('0x5'));var fs=require('fs');var path=require(_0x01a9('0x6'));var rimraf=require(_0x01a9('0x7'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0x01a9('0x8')]=function(_0x464176,_0xe0b08d){return _0x464176[_0x01a9('0x9')](_0x01a9('0xa'),attributes,{'tableName':_0x01a9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index ee608e5..90a55b5 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 _0x2c64=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','message','result','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch'];(function(_0x260390,_0x5840c8){var _0x21da18=function(_0x1c1c27){while(--_0x1c1c27){_0x260390['push'](_0x260390['shift']());}};_0x21da18(++_0x5840c8);}(_0x2c64,0x100));var _0x42c6=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x2c64[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x42c6('0x0'));var util=require(_0x42c6('0x1'));var moment=require(_0x42c6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42c6('0x3'));var db=require(_0x42c6('0x4'))['db'];var utils=require(_0x42c6('0x5'));var logger=require(_0x42c6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x42c6('0x7')][_0x42c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27d7ed,_0x1d8935,_0x570528){return new BPromise(function(_0x133d48,_0x23618c){return client[_0x42c6('0x9')](_0x27d7ed,_0x570528)[_0x42c6('0xa')](function(_0x357a84){logger[_0x42c6('0xb')](_0x42c6('0xc'),_0x1d8935,_0x42c6('0xd'));logger[_0x42c6('0xe')](_0x42c6('0xf'),_0x1d8935,_0x42c6('0xd'),JSON['stringify'](_0x357a84));if(_0x357a84[_0x42c6('0x10')]){if(_0x357a84[_0x42c6('0x10')]['code']===0x1f4){logger['error'](_0x42c6('0xc'),_0x1d8935,_0x357a84[_0x42c6('0x10')]['message']);return _0x23618c(_0x357a84[_0x42c6('0x10')]['message']);}logger[_0x42c6('0x10')](_0x42c6('0xc'),_0x1d8935,_0x357a84[_0x42c6('0x10')][_0x42c6('0x11')]);return _0x133d48(_0x357a84[_0x42c6('0x10')][_0x42c6('0x11')]);}else{logger['info'](_0x42c6('0xc'),_0x1d8935,_0x42c6('0xd'));_0x133d48(_0x357a84[_0x42c6('0x12')][_0x42c6('0x11')]);}})['catch'](function(_0x1b74f6){logger[_0x42c6('0x10')](_0x42c6('0xc'),_0x1d8935,_0x1b74f6);_0x23618c(_0x1b74f6);});});}exports[_0x42c6('0x13')]=function(_0x26b084){var _0x2f6fbb=this;return new Promise(function(_0x499b63,_0x2c4abe){return db[_0x42c6('0x14')][_0x42c6('0x15')]({'raw':_0x26b084[_0x42c6('0x16')]?_0x26b084[_0x42c6('0x16')][_0x42c6('0x17')]===undefined?!![]:![]:!![],'where':_0x26b084['options']?_0x26b084[_0x42c6('0x16')][_0x42c6('0x18')]||null:null,'attributes':_0x26b084[_0x42c6('0x16')]?_0x26b084[_0x42c6('0x16')][_0x42c6('0x19')]||null:null,'limit':_0x26b084['options']?_0x26b084[_0x42c6('0x16')][_0x42c6('0x1a')]||null:null,'include':_0x26b084['options']?_0x26b084[_0x42c6('0x16')][_0x42c6('0x1b')]?_['map'](_0x26b084[_0x42c6('0x16')][_0x42c6('0x1b')],function(_0x6e9972){return{'model':db[_0x6e9972['model']],'as':_0x6e9972['as'],'attributes':_0x6e9972[_0x42c6('0x19')],'include':_0x6e9972[_0x42c6('0x1b')]?_[_0x42c6('0x1c')](_0x6e9972[_0x42c6('0x1b')],function(_0x2cac92){return{'model':db[_0x2cac92[_0x42c6('0x1d')]],'as':_0x2cac92['as'],'attributes':_0x2cac92[_0x42c6('0x19')],'include':_0x2cac92[_0x42c6('0x1b')]?_['map'](_0x2cac92[_0x42c6('0x1b')],function(_0x2f5e5b){return{'model':db[_0x2f5e5b[_0x42c6('0x1d')]],'as':_0x2f5e5b['as'],'attributes':_0x2f5e5b['attributes']};}):[]};}):[]};}):[]:[]})[_0x42c6('0xa')](function(_0x30e0d0){logger[_0x42c6('0xb')](_0x42c6('0x13'),_0x26b084);logger[_0x42c6('0xe')](_0x42c6('0x13'),_0x26b084,JSON[_0x42c6('0x1e')](_0x30e0d0));_0x499b63(_0x30e0d0);})[_0x42c6('0x1f')](function(_0xbe970a){logger[_0x42c6('0x10')](_0x42c6('0x13'),_0xbe970a[_0x42c6('0x11')],_0x26b084);_0x2c4abe(_0x2f6fbb[_0x42c6('0x10')](0x1f4,_0xbe970a[_0x42c6('0x11')]));});});}; \ No newline at end of file +var _0x0901=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','Template,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','GetTemplate','findAll','options','where','attributes','include','map','model','lodash'];(function(_0x26c19d,_0x3f7b9b){var _0x37d676=function(_0x4d091e){while(--_0x4d091e){_0x26c19d['push'](_0x26c19d['shift']());}};_0x37d676(++_0x3f7b9b);}(_0x0901,0x195));var _0x1090=function(_0x19b7e4,_0x511c97){_0x19b7e4=_0x19b7e4-0x0;var _0x46eaf7=_0x0901[_0x19b7e4];return _0x46eaf7;};'use strict';var _=require(_0x1090('0x0'));var util=require(_0x1090('0x1'));var moment=require(_0x1090('0x2'));var BPromise=require(_0x1090('0x3'));var rs=require(_0x1090('0x4'));var fs=require('fs');var Redis=require(_0x1090('0x5'));var db=require(_0x1090('0x6'))['db'];var utils=require(_0x1090('0x7'));var logger=require('../../config/logger')(_0x1090('0x8'));var config=require('../../config/environment');var jayson=require(_0x1090('0x9'));var client=jayson['client'][_0x1090('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f1124,_0x4a000e,_0x2c5258){return new BPromise(function(_0x3ef839,_0x282f2f){return client['request'](_0x2f1124,_0x2c5258)[_0x1090('0xb')](function(_0x540463){logger[_0x1090('0xc')](_0x1090('0xd'),_0x4a000e,'request\x20sent');logger[_0x1090('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x4a000e,'request\x20sent',JSON[_0x1090('0xf')](_0x540463));if(_0x540463[_0x1090('0x10')]){if(_0x540463[_0x1090('0x10')][_0x1090('0x11')]===0x1f4){logger[_0x1090('0x10')](_0x1090('0xd'),_0x4a000e,_0x540463[_0x1090('0x10')][_0x1090('0x12')]);return _0x282f2f(_0x540463['error'][_0x1090('0x12')]);}logger[_0x1090('0x10')](_0x1090('0xd'),_0x4a000e,_0x540463['error'][_0x1090('0x12')]);return _0x3ef839(_0x540463[_0x1090('0x10')]['message']);}else{logger['info'](_0x1090('0xd'),_0x4a000e,_0x1090('0x13'));_0x3ef839(_0x540463[_0x1090('0x14')][_0x1090('0x12')]);}})['catch'](function(_0x2c8dd8){logger[_0x1090('0x10')]('Template,\x20%s,\x20%s',_0x4a000e,_0x2c8dd8);_0x282f2f(_0x2c8dd8);});});}exports[_0x1090('0x15')]=function(_0x31a2a8){var _0x103f5e=this;return new Promise(function(_0x5947c2,_0x58ed19){return db['Template'][_0x1090('0x16')]({'raw':_0x31a2a8[_0x1090('0x17')]?_0x31a2a8[_0x1090('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x31a2a8[_0x1090('0x17')]?_0x31a2a8[_0x1090('0x17')][_0x1090('0x18')]||null:null,'attributes':_0x31a2a8['options']?_0x31a2a8[_0x1090('0x17')][_0x1090('0x19')]||null:null,'limit':_0x31a2a8[_0x1090('0x17')]?_0x31a2a8['options']['limit']||null:null,'include':_0x31a2a8[_0x1090('0x17')]?_0x31a2a8[_0x1090('0x17')][_0x1090('0x1a')]?_[_0x1090('0x1b')](_0x31a2a8[_0x1090('0x17')]['include'],function(_0x43c971){return{'model':db[_0x43c971['model']],'as':_0x43c971['as'],'attributes':_0x43c971[_0x1090('0x19')],'include':_0x43c971[_0x1090('0x1a')]?_[_0x1090('0x1b')](_0x43c971[_0x1090('0x1a')],function(_0x24bda9){return{'model':db[_0x24bda9[_0x1090('0x1c')]],'as':_0x24bda9['as'],'attributes':_0x24bda9[_0x1090('0x19')],'include':_0x24bda9[_0x1090('0x1a')]?_['map'](_0x24bda9[_0x1090('0x1a')],function(_0x5a1b7c){return{'model':db[_0x5a1b7c[_0x1090('0x1c')]],'as':_0x5a1b7c['as'],'attributes':_0x5a1b7c[_0x1090('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1090('0xb')](function(_0x69d3cd){logger[_0x1090('0xc')](_0x1090('0x15'),_0x31a2a8);logger[_0x1090('0xe')](_0x1090('0x15'),_0x31a2a8,JSON['stringify'](_0x69d3cd));_0x5947c2(_0x69d3cd);})['catch'](function(_0x207df2){logger[_0x1090('0x10')](_0x1090('0x15'),_0x207df2[_0x1090('0x12')],_0x31a2a8);_0x58ed19(_0x103f5e[_0x1090('0x10')](0x1f4,_0x207df2['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 40fc4e4..58de1cc 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 _0x830e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x830e,0x1b6));var _0xe830=function(_0x271ab8,_0x5eacaf){_0x271ab8=_0x271ab8-0x0;var _0x146d10=_0x830e[_0x271ab8];return _0x146d10;};'use strict';var multer=require(_0xe830('0x0'));var util=require(_0xe830('0x1'));var path=require(_0xe830('0x2'));var timeout=require(_0xe830('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe830('0x4'));var auth=require(_0xe830('0x5'));var interaction=require(_0xe830('0x6'));var config=require(_0xe830('0x7'));var controller=require(_0xe830('0x8'));router[_0xe830('0x9')]('/',auth[_0xe830('0xa')](),controller[_0xe830('0xb')]);router[_0xe830('0x9')](_0xe830('0xc'),auth[_0xe830('0xa')](),controller[_0xe830('0xd')]);router[_0xe830('0x9')](_0xe830('0xe'),auth[_0xe830('0xa')](),controller['getAllConditions']);router[_0xe830('0x9')](_0xe830('0xf'),auth[_0xe830('0xa')](),controller[_0xe830('0x10')]);router['get'](_0xe830('0x11'),auth[_0xe830('0xa')](),controller[_0xe830('0x12')]);router[_0xe830('0x13')]('/',auth[_0xe830('0xa')](),controller['create']);router[_0xe830('0x13')](_0xe830('0xe'),auth[_0xe830('0xa')](),controller[_0xe830('0x14')]);router['post'](_0xe830('0xf'),auth[_0xe830('0xa')](),controller[_0xe830('0x15')]);router['post']('/:id/actions',auth[_0xe830('0xa')](),controller['addAction']);router[_0xe830('0x16')](_0xe830('0xc'),auth[_0xe830('0xa')](),controller[_0xe830('0x17')]);router[_0xe830('0x18')]('/:id',auth[_0xe830('0xa')](),controller[_0xe830('0x19')]);module['exports']=router; \ No newline at end of file +var _0x0233=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','exports'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x0233,0x68));var _0x3023=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x0233[_0x7e2eb0];return _0xd92de4;};'use strict';var multer=require(_0x3023('0x0'));var util=require(_0x3023('0x1'));var path=require('path');var timeout=require(_0x3023('0x2'));var express=require(_0x3023('0x3'));var router=express[_0x3023('0x4')]();var fs_extra=require(_0x3023('0x5'));var auth=require(_0x3023('0x6'));var interaction=require(_0x3023('0x7'));var config=require(_0x3023('0x8'));var controller=require(_0x3023('0x9'));router[_0x3023('0xa')]('/',auth[_0x3023('0xb')](),controller['index']);router[_0x3023('0xa')](_0x3023('0xc'),auth[_0x3023('0xb')](),controller[_0x3023('0xd')]);router[_0x3023('0xa')](_0x3023('0xe'),auth[_0x3023('0xb')](),controller[_0x3023('0xf')]);router[_0x3023('0xa')](_0x3023('0x10'),auth['isAuthenticated'](),controller[_0x3023('0x11')]);router[_0x3023('0xa')](_0x3023('0x12'),auth[_0x3023('0xb')](),controller[_0x3023('0x13')]);router[_0x3023('0x14')]('/',auth[_0x3023('0xb')](),controller[_0x3023('0x15')]);router[_0x3023('0x14')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x3023('0x16')]);router[_0x3023('0x14')](_0x3023('0x10'),auth['isAuthenticated'](),controller[_0x3023('0x17')]);router[_0x3023('0x14')](_0x3023('0x12'),auth[_0x3023('0xb')](),controller[_0x3023('0x18')]);router['put'](_0x3023('0xc'),auth[_0x3023('0xb')](),controller['update']);router['delete'](_0x3023('0xc'),auth[_0x3023('0xb')](),controller['destroy']);module[_0x3023('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 47def02..e4b3123 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 _0xea3f=['sequelize','STRING','BOOLEAN'];(function(_0x122481,_0x4ab9ec){var _0x8f8026=function(_0x146f26){while(--_0x146f26){_0x122481['push'](_0x122481['shift']());}};_0x8f8026(++_0x4ab9ec);}(_0xea3f,0x177));var _0xfea3=function(_0x3c1b2d,_0x23b1b9){_0x3c1b2d=_0x3c1b2d-0x0;var _0x412475=_0xea3f[_0x3c1b2d];return _0x412475;};'use strict';var Sequelize=require(_0xfea3('0x0'));module['exports']={'name':{'type':Sequelize[_0xfea3('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfea3('0x1')]},'status':{'type':Sequelize[_0xfea3('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9689=['BOOLEAN','sequelize','STRING'];(function(_0x5c7f61,_0x1a2a16){var _0x4c5ec0=function(_0x2acd0a){while(--_0x2acd0a){_0x5c7f61['push'](_0x5c7f61['shift']());}};_0x4c5ec0(++_0x1a2a16);}(_0x9689,0xd3));var _0x9968=function(_0x2cbf32,_0x31b44d){_0x2cbf32=_0x2cbf32-0x0;var _0xfbc19e=_0x9689[_0x2cbf32];return _0xfbc19e;};'use strict';var Sequelize=require(_0x9968('0x0'));module['exports']={'name':{'type':Sequelize[_0x9968('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9968('0x1')]},'status':{'type':Sequelize[_0x9968('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 899b4bb..6b5a23d 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 _0x90e3=['UserProfileResource','status','end','stack','name','send','index','Trigger','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','length','getAnyConditions','TriggerId','Action','getActions','rimraf','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','get'];(function(_0x35b76f,_0x324c48){var _0x582906=function(_0x5e4a7b){while(--_0x5e4a7b){_0x35b76f['push'](_0x35b76f['shift']());}};_0x582906(++_0x324c48);}(_0x90e3,0x98));var _0x390e=function(_0x4ee695,_0x5a579b){_0x4ee695=_0x4ee695-0x0;var _0x165508=_0x90e3[_0x4ee695];return _0x165508;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x390e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x390e('0x1'));var util=require('util');var path=require('path');var sox=require(_0x390e('0x2'));var csv=require(_0x390e('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x390e('0x4'));var squel=require(_0x390e('0x5'));var crypto=require(_0x390e('0x6'));var jsforce=require(_0x390e('0x7'));var deskjs=require(_0x390e('0x8'));var toCsv=require('to-csv');var querystring=require(_0x390e('0x9'));var Papa=require(_0x390e('0xa'));var Redis=require(_0x390e('0xb'));var authService=require(_0x390e('0xc'));var qs=require(_0x390e('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x390e('0xe'));var logger=require('../../config/logger')(_0x390e('0xf'));var utils=require(_0x390e('0x10'));var config=require(_0x390e('0x11'));var licenseUtil=require(_0x390e('0x12'));var db=require(_0x390e('0x13'))['db'];function respondWithStatusCode(_0x292b83,_0x20f08b){_0x20f08b=_0x20f08b||0xcc;return function(_0x56b3c4){if(_0x56b3c4){return _0x292b83[_0x390e('0x14')](_0x20f08b);}return _0x292b83['status'](_0x20f08b)['end']();};}function respondWithResult(_0x3f696b,_0x4d8ac4){_0x4d8ac4=_0x4d8ac4||0xc8;return function(_0x5d7d9c){if(_0x5d7d9c){return _0x3f696b['status'](_0x4d8ac4)['json'](_0x5d7d9c);}};}function respondWithFilteredResult(_0x4e2258,_0x39e39a){return function(_0x74a8b6){if(_0x74a8b6){var _0x2aafb1=typeof _0x39e39a[_0x390e('0x15')]==='undefined'&&typeof _0x39e39a[_0x390e('0x16')]===_0x390e('0x17');var _0x1fe97a=_0x74a8b6[_0x390e('0x18')];var _0x1dd96e=_0x2aafb1?0x0:_0x39e39a[_0x390e('0x15')];var _0x1601a7=_0x2aafb1?_0x74a8b6[_0x390e('0x18')]:_0x39e39a[_0x390e('0x15')]+_0x39e39a[_0x390e('0x16')];var _0x568e4b;if(_0x1601a7>=_0x1fe97a){_0x1601a7=_0x1fe97a;_0x568e4b=0xc8;}else{_0x568e4b=0xce;}_0x4e2258['status'](_0x568e4b);return _0x4e2258[_0x390e('0x19')](_0x390e('0x1a'),_0x1dd96e+'-'+_0x1601a7+'/'+_0x1fe97a)[_0x390e('0x1b')](_0x74a8b6);}return null;};}function patchUpdates(_0x469bf0){return function(_0x118bb2){try{jsonpatch['apply'](_0x118bb2,_0x469bf0,!![]);}catch(_0x5b3c81){return BPromise[_0x390e('0x1c')](_0x5b3c81);}return _0x118bb2[_0x390e('0x1d')]();};}function saveUpdates(_0x5623fe,_0x2d9158){return function(_0x2b5123){if(_0x2b5123){return _0x2b5123[_0x390e('0x1e')](_0x5623fe)[_0x390e('0x1f')](function(_0x163116){return _0x163116;});}return null;};}function removeEntity(_0x4ed603,_0x1c5a55){return function(_0x1c890f){if(_0x1c890f){return _0x1c890f[_0x390e('0x20')]()[_0x390e('0x1f')](function(){var _0x45a9e3=_0x1c890f[_0x390e('0x21')]({'plain':!![]});var _0xf238bc='Triggers';return db[_0x390e('0x22')]['destroy']({'where':{'type':_0xf238bc,'resourceId':_0x45a9e3['id']}})[_0x390e('0x1f')](function(){return _0x1c890f;});})[_0x390e('0x1f')](function(){_0x4ed603[_0x390e('0x23')](0xcc)[_0x390e('0x24')]();});}};}function handleEntityNotFound(_0x1432c2,_0x4d71e4){return function(_0x563947){if(!_0x563947){_0x1432c2[_0x390e('0x14')](0x194);}return _0x563947;};}function handleError(_0x4314f5,_0x50e6dc){_0x50e6dc=_0x50e6dc||0x1f4;return function(_0x3b8a65){logger['error'](_0x3b8a65[_0x390e('0x25')]);if(_0x3b8a65['name']){delete _0x3b8a65[_0x390e('0x26')];}_0x4314f5[_0x390e('0x23')](_0x50e6dc)[_0x390e('0x27')](_0x3b8a65);};}exports[_0x390e('0x28')]=function(_0x42a8ac,_0x330c51){var _0x7336ac={},_0x43801a={},_0x14d848={'count':0x0,'rows':[]};var _0x3e7af8=_['map'](db[_0x390e('0x29')]['rawAttributes'],function(_0x3de504){return{'name':_0x3de504[_0x390e('0x2a')],'type':_0x3de504['type'][_0x390e('0x2b')]};});_0x43801a[_0x390e('0x2c')]=_[_0x390e('0x2d')](_0x3e7af8,_0x390e('0x26'));_0x43801a[_0x390e('0x2e')]=_[_0x390e('0x2f')](_0x42a8ac[_0x390e('0x2e')]);_0x43801a[_0x390e('0x30')]=_[_0x390e('0x31')](_0x43801a[_0x390e('0x2c')],_0x43801a['query']);_0x7336ac[_0x390e('0x32')]=_[_0x390e('0x31')](_0x43801a[_0x390e('0x2c')],qs[_0x390e('0x33')](_0x42a8ac[_0x390e('0x2e')][_0x390e('0x33')]));_0x7336ac['attributes']=_0x7336ac[_0x390e('0x32')]['length']?_0x7336ac[_0x390e('0x32')]:_0x43801a[_0x390e('0x2c')];if(!_0x42a8ac[_0x390e('0x2e')][_0x390e('0x34')](_0x390e('0x35'))){_0x7336ac[_0x390e('0x16')]=qs[_0x390e('0x16')](_0x42a8ac['query'][_0x390e('0x16')]);_0x7336ac[_0x390e('0x15')]=qs[_0x390e('0x15')](_0x42a8ac[_0x390e('0x2e')]['offset']);}_0x7336ac[_0x390e('0x36')]=qs['sort'](_0x42a8ac[_0x390e('0x2e')][_0x390e('0x37')]);_0x7336ac['where']=qs[_0x390e('0x30')](_[_0x390e('0x38')](_0x42a8ac['query'],_0x43801a[_0x390e('0x30')]),_0x3e7af8);if(_0x42a8ac[_0x390e('0x2e')][_0x390e('0x39')]){_0x7336ac[_0x390e('0x3a')]=_[_0x390e('0x3b')](_0x7336ac[_0x390e('0x3a')],{'$or':_[_0x390e('0x2d')](_0x3e7af8,function(_0x328d3d){if(_0x328d3d[_0x390e('0x3c')]!==_0x390e('0x3d')){var _0x9a67b4={};_0x9a67b4[_0x328d3d[_0x390e('0x26')]]={'$like':'%'+_0x42a8ac[_0x390e('0x2e')][_0x390e('0x39')]+'%'};return _0x9a67b4;}})});}_0x7336ac=_['merge']({},_0x7336ac,_0x42a8ac[_0x390e('0x3e')]);var _0x479b22={'where':_0x7336ac[_0x390e('0x3a')]};return db[_0x390e('0x29')]['count'](_0x479b22)[_0x390e('0x1f')](function(_0x43b70f){_0x14d848[_0x390e('0x18')]=_0x43b70f;if(_0x42a8ac[_0x390e('0x2e')][_0x390e('0x3f')]){_0x7336ac['include']=[{'all':!![]}];}return db[_0x390e('0x29')][_0x390e('0x40')](_0x7336ac);})[_0x390e('0x1f')](function(_0x2ebfb7){_0x14d848[_0x390e('0x41')]=_0x2ebfb7;return _0x14d848;})['then'](respondWithFilteredResult(_0x330c51,_0x7336ac))[_0x390e('0x42')](handleError(_0x330c51,null));};exports[_0x390e('0x43')]=function(_0x4b9876,_0xe075c6){var _0x2179a4={'raw':![],'where':{'id':_0x4b9876[_0x390e('0x44')]['id']}},_0x173e63={};_0x173e63[_0x390e('0x2c')]=_[_0x390e('0x2f')](db[_0x390e('0x29')][_0x390e('0x45')]);_0x173e63[_0x390e('0x2e')]=_[_0x390e('0x2f')](_0x4b9876['query']);_0x173e63[_0x390e('0x30')]=_[_0x390e('0x31')](_0x173e63['model'],_0x173e63[_0x390e('0x2e')]);_0x2179a4[_0x390e('0x32')]=_[_0x390e('0x31')](_0x173e63['model'],qs[_0x390e('0x33')](_0x4b9876[_0x390e('0x2e')][_0x390e('0x33')]));_0x2179a4[_0x390e('0x32')]=_0x2179a4['attributes']['length']?_0x2179a4[_0x390e('0x32')]:_0x173e63[_0x390e('0x2c')];if(_0x4b9876[_0x390e('0x2e')][_0x390e('0x3f')]){_0x2179a4[_0x390e('0x46')]=[{'all':!![]}];}_0x2179a4=_[_0x390e('0x3b')]({},_0x2179a4,_0x4b9876['options']);return db['Trigger'][_0x390e('0x47')](_0x2179a4)[_0x390e('0x1f')](handleEntityNotFound(_0xe075c6,null))['then'](respondWithResult(_0xe075c6,null))[_0x390e('0x42')](handleError(_0xe075c6,null));};exports[_0x390e('0x48')]=function(_0x502ff6,_0x244fed){return db[_0x390e('0x29')]['create'](_0x502ff6[_0x390e('0x49')],{})[_0x390e('0x1f')](function(_0x1810a1){var _0x114138=_0x502ff6[_0x390e('0x4a')]['get']({'plain':!![]});if(!_0x114138)throw new Error(_0x390e('0x4b'));if(_0x114138[_0x390e('0x4c')]==='user'){var _0xd03a05=_0x1810a1[_0x390e('0x21')]({'plain':!![]});var _0x57ebd2=_0x390e('0x4d');return db[_0x390e('0x4e')][_0x390e('0x47')]({'where':{'name':_0x57ebd2,'userProfileId':_0x114138[_0x390e('0x4f')]},'raw':!![]})[_0x390e('0x1f')](function(_0x717c56){if(_0x717c56&&_0x717c56[_0x390e('0x50')]===0x0){return db[_0x390e('0x22')][_0x390e('0x48')]({'name':_0xd03a05[_0x390e('0x26')],'resourceId':_0xd03a05['id'],'type':_0x717c56['name'],'sectionId':_0x717c56['id']},{})[_0x390e('0x1f')](function(){return _0x1810a1;});}else{return _0x1810a1;}})[_0x390e('0x42')](function(_0x5a17ac){logger[_0x390e('0x51')](_0x390e('0x52'),_0x5a17ac);throw _0x5a17ac;});}return _0x1810a1;})['then'](respondWithResult(_0x244fed,0xc9))[_0x390e('0x42')](handleError(_0x244fed,null));};exports[_0x390e('0x1e')]=function(_0x331f65,_0x1484f8){if(_0x331f65['body']['id']){delete _0x331f65[_0x390e('0x49')]['id'];}return db[_0x390e('0x29')]['find']({'where':{'id':_0x331f65[_0x390e('0x44')]['id']}})[_0x390e('0x1f')](handleEntityNotFound(_0x1484f8,null))[_0x390e('0x1f')](saveUpdates(_0x331f65[_0x390e('0x49')],null))[_0x390e('0x1f')](respondWithResult(_0x1484f8,null))[_0x390e('0x42')](handleError(_0x1484f8,null));};exports[_0x390e('0x20')]=function(_0x1d477d,_0x41fdd5){return db[_0x390e('0x29')][_0x390e('0x47')]({'where':{'id':_0x1d477d[_0x390e('0x44')]['id']}})[_0x390e('0x1f')](handleEntityNotFound(_0x41fdd5,null))[_0x390e('0x1f')](removeEntity(_0x41fdd5,null))[_0x390e('0x42')](handleError(_0x41fdd5,null));};exports[_0x390e('0x53')]=function(_0xbfb502,_0x13dbc7,_0x2db997){if(_0xbfb502['body']['id']){delete _0xbfb502[_0x390e('0x49')]['id'];}return db[_0x390e('0x29')][_0x390e('0x47')]({'where':{'id':_0xbfb502[_0x390e('0x44')]['id']}})[_0x390e('0x1f')](handleEntityNotFound(_0x13dbc7,null))[_0x390e('0x1f')](function(_0xd6c4e2){if(_0xd6c4e2){_0xbfb502[_0x390e('0x49')][_0x390e('0x54')]=_0xd6c4e2['id'];return db[_0x390e('0x55')][_0x390e('0x48')](_0xbfb502[_0x390e('0x49')]);}})['then'](respondWithResult(_0x13dbc7,null))[_0x390e('0x42')](handleError(_0x13dbc7,null));};exports['addAnyCondition']=function(_0x19309e,_0x540c61,_0x3c10e6){if(_0x19309e[_0x390e('0x49')]['id']){delete _0x19309e[_0x390e('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0x19309e[_0x390e('0x44')]['id']}})[_0x390e('0x1f')](handleEntityNotFound(_0x540c61,null))[_0x390e('0x1f')](function(_0x5af618){if(_0x5af618){_0x19309e['body'][_0x390e('0x56')]=_0x5af618['id'];return db['Condition'][_0x390e('0x48')](_0x19309e['body']);}})[_0x390e('0x1f')](respondWithResult(_0x540c61,null))[_0x390e('0x42')](handleError(_0x540c61,null));};exports[_0x390e('0x57')]=function(_0x4495a3,_0x3db9c3,_0x157c24){var _0x332226={};var _0x3a1184={};var _0x4ef72b;var _0x5915f1;return db[_0x390e('0x29')]['findOne']({'where':{'id':_0x4495a3[_0x390e('0x44')]['id']}})[_0x390e('0x1f')](handleEntityNotFound(_0x3db9c3,null))[_0x390e('0x1f')](function(_0x1d460c){if(_0x1d460c){_0x4ef72b=_0x1d460c;_0x3a1184[_0x390e('0x2c')]=_[_0x390e('0x2f')](db[_0x390e('0x55')][_0x390e('0x45')]);_0x3a1184[_0x390e('0x2e')]=_[_0x390e('0x2f')](_0x4495a3['query']);_0x3a1184['filters']=_[_0x390e('0x31')](_0x3a1184[_0x390e('0x2c')],_0x3a1184[_0x390e('0x2e')]);_0x332226[_0x390e('0x32')]=_[_0x390e('0x31')](_0x3a1184[_0x390e('0x2c')],qs['fields'](_0x4495a3[_0x390e('0x2e')][_0x390e('0x33')]));_0x332226[_0x390e('0x32')]=_0x332226[_0x390e('0x32')][_0x390e('0x58')]?_0x332226[_0x390e('0x32')]:_0x3a1184[_0x390e('0x2c')];_0x332226[_0x390e('0x36')]=qs[_0x390e('0x37')](_0x4495a3[_0x390e('0x2e')]['sort']);_0x332226['where']=qs[_0x390e('0x30')](_[_0x390e('0x38')](_0x4495a3[_0x390e('0x2e')],_0x3a1184[_0x390e('0x30')]));if(_0x4495a3['query'][_0x390e('0x39')]){_0x332226[_0x390e('0x3a')]=_[_0x390e('0x3b')](_0x332226[_0x390e('0x3a')],{'$or':_[_0x390e('0x2d')](_0x332226[_0x390e('0x32')],function(_0x355479){var _0x5a5e25={};_0x5a5e25[_0x355479]={'$like':'%'+_0x4495a3[_0x390e('0x2e')][_0x390e('0x39')]+'%'};return _0x5a5e25;})});}_0x332226=_[_0x390e('0x3b')]({},_0x332226,_0x4495a3[_0x390e('0x3e')]);return _0x4ef72b[_0x390e('0x57')](_0x332226);}})['then'](function(_0x5e74dc){if(_0x5e74dc){_0x5915f1=_0x5e74dc['length'];if(!_0x4495a3[_0x390e('0x2e')][_0x390e('0x34')](_0x390e('0x35'))){_0x332226[_0x390e('0x16')]=qs['limit'](_0x4495a3[_0x390e('0x2e')][_0x390e('0x16')]);_0x332226[_0x390e('0x15')]=qs[_0x390e('0x15')](_0x4495a3[_0x390e('0x2e')]['offset']);}return _0x4ef72b[_0x390e('0x57')](_0x332226);}})[_0x390e('0x1f')](function(_0x490441){if(_0x490441){return _0x490441?{'count':_0x5915f1,'rows':_0x490441}:null;}})[_0x390e('0x1f')](respondWithResult(_0x3db9c3,null))[_0x390e('0x42')](handleError(_0x3db9c3,null));};exports['getAnyConditions']=function(_0x30813b,_0x4f0477,_0x8debac){var _0xe12d66={};var _0x233663={};var _0x4b245d;var _0xe6abca;return db['Trigger']['findOne']({'where':{'id':_0x30813b[_0x390e('0x44')]['id']}})[_0x390e('0x1f')](handleEntityNotFound(_0x4f0477,null))[_0x390e('0x1f')](function(_0x4365f9){if(_0x4365f9){_0x4b245d=_0x4365f9;_0x233663[_0x390e('0x2c')]=_[_0x390e('0x2f')](db[_0x390e('0x55')][_0x390e('0x45')]);_0x233663[_0x390e('0x2e')]=_[_0x390e('0x2f')](_0x30813b[_0x390e('0x2e')]);_0x233663[_0x390e('0x30')]=_['intersection'](_0x233663[_0x390e('0x2c')],_0x233663['query']);_0xe12d66[_0x390e('0x32')]=_[_0x390e('0x31')](_0x233663['model'],qs[_0x390e('0x33')](_0x30813b['query'][_0x390e('0x33')]));_0xe12d66['attributes']=_0xe12d66[_0x390e('0x32')]['length']?_0xe12d66[_0x390e('0x32')]:_0x233663[_0x390e('0x2c')];_0xe12d66[_0x390e('0x36')]=qs['sort'](_0x30813b[_0x390e('0x2e')][_0x390e('0x37')]);_0xe12d66[_0x390e('0x3a')]=qs[_0x390e('0x30')](_['pick'](_0x30813b[_0x390e('0x2e')],_0x233663[_0x390e('0x30')]));if(_0x30813b[_0x390e('0x2e')][_0x390e('0x39')]){_0xe12d66[_0x390e('0x3a')]=_[_0x390e('0x3b')](_0xe12d66[_0x390e('0x3a')],{'$or':_[_0x390e('0x2d')](_0xe12d66[_0x390e('0x32')],function(_0x2eea59){var _0x53228b={};_0x53228b[_0x2eea59]={'$like':'%'+_0x30813b['query'][_0x390e('0x39')]+'%'};return _0x53228b;})});}_0xe12d66=_['merge']({},_0xe12d66,_0x30813b[_0x390e('0x3e')]);return _0x4b245d[_0x390e('0x59')](_0xe12d66);}})[_0x390e('0x1f')](function(_0x353c4b){if(_0x353c4b){_0xe6abca=_0x353c4b[_0x390e('0x58')];if(!_0x30813b[_0x390e('0x2e')][_0x390e('0x34')](_0x390e('0x35'))){_0xe12d66[_0x390e('0x16')]=qs[_0x390e('0x16')](_0x30813b[_0x390e('0x2e')][_0x390e('0x16')]);_0xe12d66[_0x390e('0x15')]=qs[_0x390e('0x15')](_0x30813b[_0x390e('0x2e')][_0x390e('0x15')]);}return _0x4b245d[_0x390e('0x59')](_0xe12d66);}})[_0x390e('0x1f')](function(_0x361b27){if(_0x361b27){return _0x361b27?{'count':_0xe6abca,'rows':_0x361b27}:null;}})[_0x390e('0x1f')](respondWithResult(_0x4f0477,null))[_0x390e('0x42')](handleError(_0x4f0477,null));};exports['addAction']=function(_0x1e3a78,_0x4b1f15,_0x92a7a7){if(_0x1e3a78[_0x390e('0x49')]['id']){delete _0x1e3a78[_0x390e('0x49')]['id'];}return db['Trigger'][_0x390e('0x47')]({'where':{'id':_0x1e3a78[_0x390e('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b1f15,null))[_0x390e('0x1f')](function(_0x5a71bd){if(_0x5a71bd){_0x1e3a78[_0x390e('0x49')][_0x390e('0x5a')]=_0x5a71bd['id'];return db[_0x390e('0x5b')]['create'](_0x1e3a78['body']);}})[_0x390e('0x1f')](respondWithResult(_0x4b1f15,null))[_0x390e('0x42')](handleError(_0x4b1f15,null));};exports['getActions']=function(_0x59ee07,_0x356113,_0x591815){var _0x436879={};var _0x260510={};var _0x367b33;var _0x10a617;return db['Trigger']['findOne']({'where':{'id':_0x59ee07[_0x390e('0x44')]['id']}})[_0x390e('0x1f')](handleEntityNotFound(_0x356113,null))['then'](function(_0x159354){if(_0x159354){_0x367b33=_0x159354;_0x260510['model']=_['keys'](db[_0x390e('0x5b')][_0x390e('0x45')]);_0x260510[_0x390e('0x2e')]=_[_0x390e('0x2f')](_0x59ee07[_0x390e('0x2e')]);_0x260510[_0x390e('0x30')]=_[_0x390e('0x31')](_0x260510[_0x390e('0x2c')],_0x260510[_0x390e('0x2e')]);_0x436879['attributes']=_[_0x390e('0x31')](_0x260510['model'],qs['fields'](_0x59ee07[_0x390e('0x2e')]['fields']));_0x436879[_0x390e('0x32')]=_0x436879[_0x390e('0x32')][_0x390e('0x58')]?_0x436879[_0x390e('0x32')]:_0x260510[_0x390e('0x2c')];_0x436879[_0x390e('0x36')]=qs['sort'](_0x59ee07[_0x390e('0x2e')][_0x390e('0x37')]);_0x436879['where']=qs['filters'](_['pick'](_0x59ee07['query'],_0x260510[_0x390e('0x30')]));if(_0x59ee07[_0x390e('0x2e')]['filter']){_0x436879[_0x390e('0x3a')]=_[_0x390e('0x3b')](_0x436879['where'],{'$or':_['map'](_0x436879[_0x390e('0x32')],function(_0x55bf2e){var _0xa4b979={};_0xa4b979[_0x55bf2e]={'$like':'%'+_0x59ee07[_0x390e('0x2e')][_0x390e('0x39')]+'%'};return _0xa4b979;})});}_0x436879=_['merge']({},_0x436879,_0x59ee07[_0x390e('0x3e')]);return _0x367b33[_0x390e('0x5c')](_0x436879);}})[_0x390e('0x1f')](function(_0x5486eb){if(_0x5486eb){_0x10a617=_0x5486eb['length'];if(!_0x59ee07['query'][_0x390e('0x34')](_0x390e('0x35'))){_0x436879[_0x390e('0x16')]=qs[_0x390e('0x16')](_0x59ee07[_0x390e('0x2e')][_0x390e('0x16')]);_0x436879[_0x390e('0x15')]=qs[_0x390e('0x15')](_0x59ee07[_0x390e('0x2e')][_0x390e('0x15')]);}return _0x367b33[_0x390e('0x5c')](_0x436879);}})[_0x390e('0x1f')](function(_0x1c467b){if(_0x1c467b){return _0x1c467b?{'count':_0x10a617,'rows':_0x1c467b}:null;}})[_0x390e('0x1f')](respondWithResult(_0x356113,null))[_0x390e('0x42')](handleError(_0x356113,null));}; \ No newline at end of file +var _0x469d=['getAnyConditions','findOne','TriggerId','Action','getActions','eml-format','zip-dir','request-promise','moment','util','path','sox','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','Trigger','includeAll','include','findAll','rows','catch','params','merge','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','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','pick'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x469d,0xbd));var _0xd469=function(_0x36f4f8,_0x102058){_0x36f4f8=_0x36f4f8-0x0;var _0x42e150=_0x469d[_0x36f4f8];return _0x42e150;};'use strict';var emlformat=require(_0xd469('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd469('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd469('0x2'));var moment=require(_0xd469('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd469('0x4'));var path=require(_0xd469('0x5'));var sox=require(_0xd469('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd469('0x7'));var _=require(_0xd469('0x8'));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(_0xd469('0x9'));var Papa=require('papaparse');var Redis=require(_0xd469('0xa'));var authService=require(_0xd469('0xb'));var qs=require(_0xd469('0xc'));var as=require(_0xd469('0xd'));var hardwareService=require(_0xd469('0xe'));var logger=require(_0xd469('0xf'))(_0xd469('0x10'));var utils=require(_0xd469('0x11'));var config=require(_0xd469('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xd469('0x13'))['db'];function respondWithStatusCode(_0x3ea75f,_0x43694e){_0x43694e=_0x43694e||0xcc;return function(_0x3b985c){if(_0x3b985c){return _0x3ea75f['sendStatus'](_0x43694e);}return _0x3ea75f[_0xd469('0x14')](_0x43694e)[_0xd469('0x15')]();};}function respondWithResult(_0x139f74,_0x357a6e){_0x357a6e=_0x357a6e||0xc8;return function(_0x365494){if(_0x365494){return _0x139f74[_0xd469('0x14')](_0x357a6e)[_0xd469('0x16')](_0x365494);}};}function respondWithFilteredResult(_0x1225a3,_0x4c0b8a){return function(_0x1d5ae4){if(_0x1d5ae4){var _0x3272ff=typeof _0x4c0b8a[_0xd469('0x17')]===_0xd469('0x18')&&typeof _0x4c0b8a[_0xd469('0x19')]===_0xd469('0x18');var _0x3102d7=_0x1d5ae4[_0xd469('0x1a')];var _0x529e56=_0x3272ff?0x0:_0x4c0b8a['offset'];var _0x5a370f=_0x3272ff?_0x1d5ae4[_0xd469('0x1a')]:_0x4c0b8a[_0xd469('0x17')]+_0x4c0b8a[_0xd469('0x19')];var _0x6db089;if(_0x5a370f>=_0x3102d7){_0x5a370f=_0x3102d7;_0x6db089=0xc8;}else{_0x6db089=0xce;}_0x1225a3[_0xd469('0x14')](_0x6db089);return _0x1225a3[_0xd469('0x1b')](_0xd469('0x1c'),_0x529e56+'-'+_0x5a370f+'/'+_0x3102d7)['json'](_0x1d5ae4);}return null;};}function patchUpdates(_0x543c99){return function(_0x5bc773){try{jsonpatch[_0xd469('0x1d')](_0x5bc773,_0x543c99,!![]);}catch(_0x2da21a){return BPromise[_0xd469('0x1e')](_0x2da21a);}return _0x5bc773[_0xd469('0x1f')]();};}function saveUpdates(_0x255d14,_0x2c3774){return function(_0x1fb002){if(_0x1fb002){return _0x1fb002[_0xd469('0x20')](_0x255d14)[_0xd469('0x21')](function(_0x45d134){return _0x45d134;});}return null;};}function removeEntity(_0x5af1f4,_0x41e630){return function(_0x55cece){if(_0x55cece){return _0x55cece[_0xd469('0x22')]()['then'](function(){var _0x31b473=_0x55cece[_0xd469('0x23')]({'plain':!![]});var _0x53bb2c=_0xd469('0x24');return db[_0xd469('0x25')][_0xd469('0x22')]({'where':{'type':_0x53bb2c,'resourceId':_0x31b473['id']}})[_0xd469('0x21')](function(){return _0x55cece;});})['then'](function(){_0x5af1f4[_0xd469('0x14')](0xcc)[_0xd469('0x15')]();});}};}function handleEntityNotFound(_0x20ef31,_0x35a4f0){return function(_0x486ce9){if(!_0x486ce9){_0x20ef31['sendStatus'](0x194);}return _0x486ce9;};}function handleError(_0x3444cf,_0x403b14){_0x403b14=_0x403b14||0x1f4;return function(_0x1eb9c4){logger[_0xd469('0x26')](_0x1eb9c4[_0xd469('0x27')]);if(_0x1eb9c4[_0xd469('0x28')]){delete _0x1eb9c4[_0xd469('0x28')];}_0x3444cf['status'](_0x403b14)[_0xd469('0x29')](_0x1eb9c4);};}exports[_0xd469('0x2a')]=function(_0x739b7b,_0x2fe344){var _0xef9080={},_0x32e23d={},_0x22ca5d={'count':0x0,'rows':[]};var _0x2b0b0e=_[_0xd469('0x2b')](db['Trigger'][_0xd469('0x2c')],function(_0x2596b9){return{'name':_0x2596b9[_0xd469('0x2d')],'type':_0x2596b9['type'][_0xd469('0x2e')]};});_0x32e23d['model']=_['map'](_0x2b0b0e,_0xd469('0x28'));_0x32e23d['query']=_[_0xd469('0x2f')](_0x739b7b['query']);_0x32e23d[_0xd469('0x30')]=_[_0xd469('0x31')](_0x32e23d[_0xd469('0x32')],_0x32e23d['query']);_0xef9080[_0xd469('0x33')]=_[_0xd469('0x31')](_0x32e23d['model'],qs[_0xd469('0x34')](_0x739b7b['query'][_0xd469('0x34')]));_0xef9080['attributes']=_0xef9080[_0xd469('0x33')][_0xd469('0x35')]?_0xef9080[_0xd469('0x33')]:_0x32e23d[_0xd469('0x32')];if(!_0x739b7b[_0xd469('0x36')][_0xd469('0x37')](_0xd469('0x38'))){_0xef9080[_0xd469('0x19')]=qs['limit'](_0x739b7b[_0xd469('0x36')][_0xd469('0x19')]);_0xef9080[_0xd469('0x17')]=qs['offset'](_0x739b7b[_0xd469('0x36')][_0xd469('0x17')]);}_0xef9080[_0xd469('0x39')]=qs[_0xd469('0x3a')](_0x739b7b['query'][_0xd469('0x3a')]);_0xef9080[_0xd469('0x3b')]=qs[_0xd469('0x30')](_['pick'](_0x739b7b[_0xd469('0x36')],_0x32e23d[_0xd469('0x30')]),_0x2b0b0e);if(_0x739b7b[_0xd469('0x36')][_0xd469('0x3c')]){_0xef9080[_0xd469('0x3b')]=_['merge'](_0xef9080[_0xd469('0x3b')],{'$or':_[_0xd469('0x2b')](_0x2b0b0e,function(_0x8df8e9){if(_0x8df8e9['type']!==_0xd469('0x3d')){var _0x2ff345={};_0x2ff345[_0x8df8e9['name']]={'$like':'%'+_0x739b7b[_0xd469('0x36')]['filter']+'%'};return _0x2ff345;}})});}_0xef9080=_['merge']({},_0xef9080,_0x739b7b[_0xd469('0x3e')]);var _0x70210b={'where':_0xef9080[_0xd469('0x3b')]};return db[_0xd469('0x3f')][_0xd469('0x1a')](_0x70210b)['then'](function(_0xa67ca3){_0x22ca5d[_0xd469('0x1a')]=_0xa67ca3;if(_0x739b7b['query'][_0xd469('0x40')]){_0xef9080[_0xd469('0x41')]=[{'all':!![]}];}return db['Trigger'][_0xd469('0x42')](_0xef9080);})[_0xd469('0x21')](function(_0x379e7d){_0x22ca5d[_0xd469('0x43')]=_0x379e7d;return _0x22ca5d;})[_0xd469('0x21')](respondWithFilteredResult(_0x2fe344,_0xef9080))[_0xd469('0x44')](handleError(_0x2fe344,null));};exports['show']=function(_0x53ff1f,_0x442e0a){var _0x3d1bde={'raw':![],'where':{'id':_0x53ff1f[_0xd469('0x45')]['id']}},_0x299faf={};_0x299faf[_0xd469('0x32')]=_[_0xd469('0x2f')](db[_0xd469('0x3f')][_0xd469('0x2c')]);_0x299faf[_0xd469('0x36')]=_[_0xd469('0x2f')](_0x53ff1f[_0xd469('0x36')]);_0x299faf[_0xd469('0x30')]=_[_0xd469('0x31')](_0x299faf[_0xd469('0x32')],_0x299faf[_0xd469('0x36')]);_0x3d1bde[_0xd469('0x33')]=_[_0xd469('0x31')](_0x299faf[_0xd469('0x32')],qs[_0xd469('0x34')](_0x53ff1f[_0xd469('0x36')][_0xd469('0x34')]));_0x3d1bde[_0xd469('0x33')]=_0x3d1bde[_0xd469('0x33')][_0xd469('0x35')]?_0x3d1bde[_0xd469('0x33')]:_0x299faf[_0xd469('0x32')];if(_0x53ff1f[_0xd469('0x36')][_0xd469('0x40')]){_0x3d1bde[_0xd469('0x41')]=[{'all':!![]}];}_0x3d1bde=_[_0xd469('0x46')]({},_0x3d1bde,_0x53ff1f[_0xd469('0x3e')]);return db[_0xd469('0x3f')][_0xd469('0x47')](_0x3d1bde)[_0xd469('0x21')](handleEntityNotFound(_0x442e0a,null))[_0xd469('0x21')](respondWithResult(_0x442e0a,null))[_0xd469('0x44')](handleError(_0x442e0a,null));};exports[_0xd469('0x48')]=function(_0x37ccea,_0x3ca2ec){return db[_0xd469('0x3f')][_0xd469('0x48')](_0x37ccea[_0xd469('0x49')],{})['then'](function(_0x48d3db){var _0x1b0169=_0x37ccea[_0xd469('0x4a')][_0xd469('0x23')]({'plain':!![]});if(!_0x1b0169)throw new Error(_0xd469('0x4b'));if(_0x1b0169[_0xd469('0x4c')]===_0xd469('0x4a')){var _0x494020=_0x48d3db[_0xd469('0x23')]({'plain':!![]});var _0x218ba3=_0xd469('0x24');return db[_0xd469('0x4d')][_0xd469('0x47')]({'where':{'name':_0x218ba3,'userProfileId':_0x1b0169[_0xd469('0x4e')]},'raw':!![]})[_0xd469('0x21')](function(_0x45af3a){if(_0x45af3a&&_0x45af3a[_0xd469('0x4f')]===0x0){return db[_0xd469('0x25')]['create']({'name':_0x494020[_0xd469('0x28')],'resourceId':_0x494020['id'],'type':_0x45af3a[_0xd469('0x28')],'sectionId':_0x45af3a['id']},{})[_0xd469('0x21')](function(){return _0x48d3db;});}else{return _0x48d3db;}})['catch'](function(_0x58d139){logger[_0xd469('0x26')](_0xd469('0x50'),_0x58d139);throw _0x58d139;});}return _0x48d3db;})['then'](respondWithResult(_0x3ca2ec,0xc9))[_0xd469('0x44')](handleError(_0x3ca2ec,null));};exports[_0xd469('0x20')]=function(_0x2c937d,_0x4d4bf8){if(_0x2c937d['body']['id']){delete _0x2c937d[_0xd469('0x49')]['id'];}return db[_0xd469('0x3f')][_0xd469('0x47')]({'where':{'id':_0x2c937d[_0xd469('0x45')]['id']}})[_0xd469('0x21')](handleEntityNotFound(_0x4d4bf8,null))[_0xd469('0x21')](saveUpdates(_0x2c937d['body'],null))[_0xd469('0x21')](respondWithResult(_0x4d4bf8,null))[_0xd469('0x44')](handleError(_0x4d4bf8,null));};exports[_0xd469('0x22')]=function(_0x593e29,_0x9911b0){return db[_0xd469('0x3f')][_0xd469('0x47')]({'where':{'id':_0x593e29[_0xd469('0x45')]['id']}})[_0xd469('0x21')](handleEntityNotFound(_0x9911b0,null))[_0xd469('0x21')](removeEntity(_0x9911b0,null))[_0xd469('0x44')](handleError(_0x9911b0,null));};exports['addAllCondition']=function(_0x317462,_0x2d2b37,_0x42ed51){if(_0x317462[_0xd469('0x49')]['id']){delete _0x317462['body']['id'];}return db['Trigger'][_0xd469('0x47')]({'where':{'id':_0x317462[_0xd469('0x45')]['id']}})[_0xd469('0x21')](handleEntityNotFound(_0x2d2b37,null))['then'](function(_0x2cc0e0){if(_0x2cc0e0){_0x317462[_0xd469('0x49')][_0xd469('0x51')]=_0x2cc0e0['id'];return db['Condition'][_0xd469('0x48')](_0x317462[_0xd469('0x49')]);}})['then'](respondWithResult(_0x2d2b37,null))[_0xd469('0x44')](handleError(_0x2d2b37,null));};exports[_0xd469('0x52')]=function(_0xc8797c,_0x23b965,_0x12b405){if(_0xc8797c[_0xd469('0x49')]['id']){delete _0xc8797c[_0xd469('0x49')]['id'];}return db[_0xd469('0x3f')]['find']({'where':{'id':_0xc8797c['params']['id']}})[_0xd469('0x21')](handleEntityNotFound(_0x23b965,null))[_0xd469('0x21')](function(_0x3112ad){if(_0x3112ad){_0xc8797c[_0xd469('0x49')][_0xd469('0x53')]=_0x3112ad['id'];return db[_0xd469('0x54')][_0xd469('0x48')](_0xc8797c[_0xd469('0x49')]);}})[_0xd469('0x21')](respondWithResult(_0x23b965,null))[_0xd469('0x44')](handleError(_0x23b965,null));};exports[_0xd469('0x55')]=function(_0x1d9024,_0x1cb5a2,_0x3ba440){var _0x2b490e={};var _0x52a6ab={};var _0x54801e;var _0x296742;return db['Trigger']['findOne']({'where':{'id':_0x1d9024[_0xd469('0x45')]['id']}})[_0xd469('0x21')](handleEntityNotFound(_0x1cb5a2,null))[_0xd469('0x21')](function(_0x491534){if(_0x491534){_0x54801e=_0x491534;_0x52a6ab[_0xd469('0x32')]=_['keys'](db['Condition']['rawAttributes']);_0x52a6ab[_0xd469('0x36')]=_['keys'](_0x1d9024[_0xd469('0x36')]);_0x52a6ab[_0xd469('0x30')]=_[_0xd469('0x31')](_0x52a6ab[_0xd469('0x32')],_0x52a6ab[_0xd469('0x36')]);_0x2b490e[_0xd469('0x33')]=_[_0xd469('0x31')](_0x52a6ab['model'],qs[_0xd469('0x34')](_0x1d9024[_0xd469('0x36')][_0xd469('0x34')]));_0x2b490e[_0xd469('0x33')]=_0x2b490e[_0xd469('0x33')]['length']?_0x2b490e[_0xd469('0x33')]:_0x52a6ab[_0xd469('0x32')];_0x2b490e['order']=qs[_0xd469('0x3a')](_0x1d9024[_0xd469('0x36')][_0xd469('0x3a')]);_0x2b490e[_0xd469('0x3b')]=qs['filters'](_[_0xd469('0x56')](_0x1d9024[_0xd469('0x36')],_0x52a6ab[_0xd469('0x30')]));if(_0x1d9024[_0xd469('0x36')][_0xd469('0x3c')]){_0x2b490e[_0xd469('0x3b')]=_[_0xd469('0x46')](_0x2b490e[_0xd469('0x3b')],{'$or':_['map'](_0x2b490e[_0xd469('0x33')],function(_0x749bb0){var _0x37f52b={};_0x37f52b[_0x749bb0]={'$like':'%'+_0x1d9024[_0xd469('0x36')][_0xd469('0x3c')]+'%'};return _0x37f52b;})});}_0x2b490e=_[_0xd469('0x46')]({},_0x2b490e,_0x1d9024[_0xd469('0x3e')]);return _0x54801e[_0xd469('0x55')](_0x2b490e);}})['then'](function(_0x1cc8e4){if(_0x1cc8e4){_0x296742=_0x1cc8e4[_0xd469('0x35')];if(!_0x1d9024[_0xd469('0x36')][_0xd469('0x37')](_0xd469('0x38'))){_0x2b490e[_0xd469('0x19')]=qs[_0xd469('0x19')](_0x1d9024[_0xd469('0x36')][_0xd469('0x19')]);_0x2b490e[_0xd469('0x17')]=qs[_0xd469('0x17')](_0x1d9024[_0xd469('0x36')][_0xd469('0x17')]);}return _0x54801e['getAllConditions'](_0x2b490e);}})[_0xd469('0x21')](function(_0x3eb1c1){if(_0x3eb1c1){return _0x3eb1c1?{'count':_0x296742,'rows':_0x3eb1c1}:null;}})[_0xd469('0x21')](respondWithResult(_0x1cb5a2,null))[_0xd469('0x44')](handleError(_0x1cb5a2,null));};exports[_0xd469('0x57')]=function(_0x338b43,_0x1a23a0,_0x423b9c){var _0x33b7db={};var _0x56b096={};var _0x3a3b24;var _0x56760c;return db[_0xd469('0x3f')][_0xd469('0x58')]({'where':{'id':_0x338b43[_0xd469('0x45')]['id']}})[_0xd469('0x21')](handleEntityNotFound(_0x1a23a0,null))[_0xd469('0x21')](function(_0x3acc9c){if(_0x3acc9c){_0x3a3b24=_0x3acc9c;_0x56b096[_0xd469('0x32')]=_[_0xd469('0x2f')](db[_0xd469('0x54')]['rawAttributes']);_0x56b096['query']=_['keys'](_0x338b43['query']);_0x56b096['filters']=_[_0xd469('0x31')](_0x56b096[_0xd469('0x32')],_0x56b096[_0xd469('0x36')]);_0x33b7db[_0xd469('0x33')]=_[_0xd469('0x31')](_0x56b096['model'],qs['fields'](_0x338b43[_0xd469('0x36')][_0xd469('0x34')]));_0x33b7db['attributes']=_0x33b7db['attributes']['length']?_0x33b7db[_0xd469('0x33')]:_0x56b096['model'];_0x33b7db[_0xd469('0x39')]=qs[_0xd469('0x3a')](_0x338b43[_0xd469('0x36')][_0xd469('0x3a')]);_0x33b7db['where']=qs[_0xd469('0x30')](_['pick'](_0x338b43['query'],_0x56b096[_0xd469('0x30')]));if(_0x338b43[_0xd469('0x36')][_0xd469('0x3c')]){_0x33b7db['where']=_[_0xd469('0x46')](_0x33b7db[_0xd469('0x3b')],{'$or':_[_0xd469('0x2b')](_0x33b7db[_0xd469('0x33')],function(_0x1f1be1){var _0x5bfbc5={};_0x5bfbc5[_0x1f1be1]={'$like':'%'+_0x338b43['query']['filter']+'%'};return _0x5bfbc5;})});}_0x33b7db=_[_0xd469('0x46')]({},_0x33b7db,_0x338b43[_0xd469('0x3e')]);return _0x3a3b24['getAnyConditions'](_0x33b7db);}})['then'](function(_0x17d514){if(_0x17d514){_0x56760c=_0x17d514[_0xd469('0x35')];if(!_0x338b43[_0xd469('0x36')]['hasOwnProperty'](_0xd469('0x38'))){_0x33b7db['limit']=qs[_0xd469('0x19')](_0x338b43['query']['limit']);_0x33b7db[_0xd469('0x17')]=qs[_0xd469('0x17')](_0x338b43[_0xd469('0x36')][_0xd469('0x17')]);}return _0x3a3b24[_0xd469('0x57')](_0x33b7db);}})[_0xd469('0x21')](function(_0x207ea4){if(_0x207ea4){return _0x207ea4?{'count':_0x56760c,'rows':_0x207ea4}:null;}})[_0xd469('0x21')](respondWithResult(_0x1a23a0,null))[_0xd469('0x44')](handleError(_0x1a23a0,null));};exports['addAction']=function(_0x26e0ab,_0x7bb196,_0x3e448d){if(_0x26e0ab[_0xd469('0x49')]['id']){delete _0x26e0ab[_0xd469('0x49')]['id'];}return db[_0xd469('0x3f')][_0xd469('0x47')]({'where':{'id':_0x26e0ab[_0xd469('0x45')]['id']}})[_0xd469('0x21')](handleEntityNotFound(_0x7bb196,null))['then'](function(_0x538193){if(_0x538193){_0x26e0ab[_0xd469('0x49')][_0xd469('0x59')]=_0x538193['id'];return db[_0xd469('0x5a')][_0xd469('0x48')](_0x26e0ab[_0xd469('0x49')]);}})['then'](respondWithResult(_0x7bb196,null))[_0xd469('0x44')](handleError(_0x7bb196,null));};exports[_0xd469('0x5b')]=function(_0x3ac7de,_0x31271a,_0xe93a20){var _0x562c74={};var _0xf19dba={};var _0x3c4376;var _0xfcf7ca;return db[_0xd469('0x3f')]['findOne']({'where':{'id':_0x3ac7de[_0xd469('0x45')]['id']}})[_0xd469('0x21')](handleEntityNotFound(_0x31271a,null))[_0xd469('0x21')](function(_0xbd59b1){if(_0xbd59b1){_0x3c4376=_0xbd59b1;_0xf19dba[_0xd469('0x32')]=_[_0xd469('0x2f')](db[_0xd469('0x5a')][_0xd469('0x2c')]);_0xf19dba[_0xd469('0x36')]=_[_0xd469('0x2f')](_0x3ac7de[_0xd469('0x36')]);_0xf19dba[_0xd469('0x30')]=_[_0xd469('0x31')](_0xf19dba[_0xd469('0x32')],_0xf19dba[_0xd469('0x36')]);_0x562c74[_0xd469('0x33')]=_[_0xd469('0x31')](_0xf19dba[_0xd469('0x32')],qs['fields'](_0x3ac7de[_0xd469('0x36')]['fields']));_0x562c74[_0xd469('0x33')]=_0x562c74[_0xd469('0x33')][_0xd469('0x35')]?_0x562c74['attributes']:_0xf19dba[_0xd469('0x32')];_0x562c74[_0xd469('0x39')]=qs[_0xd469('0x3a')](_0x3ac7de[_0xd469('0x36')][_0xd469('0x3a')]);_0x562c74[_0xd469('0x3b')]=qs[_0xd469('0x30')](_[_0xd469('0x56')](_0x3ac7de[_0xd469('0x36')],_0xf19dba['filters']));if(_0x3ac7de[_0xd469('0x36')][_0xd469('0x3c')]){_0x562c74[_0xd469('0x3b')]=_[_0xd469('0x46')](_0x562c74['where'],{'$or':_['map'](_0x562c74[_0xd469('0x33')],function(_0xdb8f18){var _0x2801af={};_0x2801af[_0xdb8f18]={'$like':'%'+_0x3ac7de[_0xd469('0x36')][_0xd469('0x3c')]+'%'};return _0x2801af;})});}_0x562c74=_['merge']({},_0x562c74,_0x3ac7de['options']);return _0x3c4376[_0xd469('0x5b')](_0x562c74);}})[_0xd469('0x21')](function(_0x43bcb5){if(_0x43bcb5){_0xfcf7ca=_0x43bcb5['length'];if(!_0x3ac7de[_0xd469('0x36')][_0xd469('0x37')]('nolimit')){_0x562c74[_0xd469('0x19')]=qs[_0xd469('0x19')](_0x3ac7de[_0xd469('0x36')]['limit']);_0x562c74[_0xd469('0x17')]=qs['offset'](_0x3ac7de[_0xd469('0x36')][_0xd469('0x17')]);}return _0x3c4376['getActions'](_0x562c74);}})[_0xd469('0x21')](function(_0x1ea2ec){if(_0x1ea2ec){return _0x1ea2ec?{'count':_0xfcf7ca,'rows':_0x1ea2ec}:null;}})[_0xd469('0x21')](respondWithResult(_0x31271a,null))[_0xd469('0x44')](handleError(_0x31271a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d0bce83..dbe2c22 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 _0x2f46=['bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','define','tools_triggers','lodash','util','../../config/logger','api','moment'];(function(_0x3278da,_0x220b2f){var _0x1dda14=function(_0x58f969){while(--_0x58f969){_0x3278da['push'](_0x3278da['shift']());}};_0x1dda14(++_0x220b2f);}(_0x2f46,0x1cf));var _0x62f4=function(_0x5dd5de,_0x1ea0ea){_0x5dd5de=_0x5dd5de-0x0;var _0x28003f=_0x2f46[_0x5dd5de];return _0x28003f;};'use strict';var _=require(_0x62f4('0x0'));var util=require(_0x62f4('0x1'));var logger=require(_0x62f4('0x2'))(_0x62f4('0x3'));var moment=require(_0x62f4('0x4'));var BPromise=require(_0x62f4('0x5'));var rp=require(_0x62f4('0x6'));var fs=require('fs');var path=require(_0x62f4('0x7'));var rimraf=require('rimraf');var config=require(_0x62f4('0x8'));var attributes=require(_0x62f4('0x9'));module[_0x62f4('0xa')]=function(_0x5bf248,_0x1e7282){return _0x5bf248[_0x62f4('0xb')]('Trigger',attributes,{'tableName':_0x62f4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9087=['../../config/environment','./trigger.attributes','define','tools_triggers','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x13f9c3,_0x2036c0){var _0x22185a=function(_0x36a7e6){while(--_0x36a7e6){_0x13f9c3['push'](_0x13f9c3['shift']());}};_0x22185a(++_0x2036c0);}(_0x9087,0x143));var _0x7908=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9087[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7908('0x0'));var util=require(_0x7908('0x1'));var logger=require('../../config/logger')(_0x7908('0x2'));var moment=require(_0x7908('0x3'));var BPromise=require('bluebird');var rp=require(_0x7908('0x4'));var fs=require('fs');var path=require(_0x7908('0x5'));var rimraf=require(_0x7908('0x6'));var config=require(_0x7908('0x7'));var attributes=require(_0x7908('0x8'));module['exports']=function(_0xf0aee6,_0x26b396){return _0xf0aee6[_0x7908('0x9')]('Trigger',attributes,{'tableName':_0x7908('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 2c9b492..cb1c3ff 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 _0x6e6c=['where','limit','include','map','attributes','model','GetTrigger','ShowTrigger','find','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Trigger','findAll','options','raw'];(function(_0x2f5e7a,_0x140d70){var _0x454aef=function(_0x37413b){while(--_0x37413b){_0x2f5e7a['push'](_0x2f5e7a['shift']());}};_0x454aef(++_0x140d70);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var moment=require('moment');var BPromise=require(_0xc6e6('0x2'));var rs=require(_0xc6e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6e6('0x4'));var logger=require('../../config/logger')(_0xc6e6('0x5'));var config=require('../../config/environment');var jayson=require(_0xc6e6('0x6'));var client=jayson[_0xc6e6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301f55,_0x30a10b,_0x4da7bd){return new BPromise(function(_0x324706,_0x15d268){return client['request'](_0x301f55,_0x4da7bd)[_0xc6e6('0x8')](function(_0x481799){logger[_0xc6e6('0x9')](_0xc6e6('0xa'),_0x30a10b,_0xc6e6('0xb'));logger[_0xc6e6('0xc')](_0xc6e6('0xd'),_0x30a10b,_0xc6e6('0xb'),JSON[_0xc6e6('0xe')](_0x481799));if(_0x481799[_0xc6e6('0xf')]){if(_0x481799[_0xc6e6('0xf')]['code']===0x1f4){logger[_0xc6e6('0xf')]('Trigger,\x20%s,\x20%s',_0x30a10b,_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);return _0x15d268(_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);}logger['error'](_0xc6e6('0xa'),_0x30a10b,_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);return _0x324706(_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);}else{logger['info'](_0xc6e6('0xa'),_0x30a10b,_0xc6e6('0xb'));_0x324706(_0x481799['result'][_0xc6e6('0x10')]);}})[_0xc6e6('0x11')](function(_0xedf127){logger['error']('Trigger,\x20%s,\x20%s',_0x30a10b,_0xedf127);_0x15d268(_0xedf127);});});}exports['GetTrigger']=function(_0x3a1ccc){var _0x554262=this;return new Promise(function(_0x46e58f,_0x2069e4){return db[_0xc6e6('0x12')][_0xc6e6('0x13')]({'raw':_0x3a1ccc[_0xc6e6('0x14')]?_0x3a1ccc[_0xc6e6('0x14')][_0xc6e6('0x15')]===undefined?!![]:![]:!![],'where':_0x3a1ccc[_0xc6e6('0x14')]?_0x3a1ccc[_0xc6e6('0x14')][_0xc6e6('0x16')]||null:null,'attributes':_0x3a1ccc['options']?_0x3a1ccc[_0xc6e6('0x14')]['attributes']||null:null,'limit':_0x3a1ccc[_0xc6e6('0x14')]?_0x3a1ccc[_0xc6e6('0x14')][_0xc6e6('0x17')]||null:null,'include':_0x3a1ccc[_0xc6e6('0x14')]?_0x3a1ccc['options'][_0xc6e6('0x18')]?_[_0xc6e6('0x19')](_0x3a1ccc[_0xc6e6('0x14')][_0xc6e6('0x18')],function(_0x107561){return{'model':db[_0x107561['model']],'as':_0x107561['as'],'attributes':_0x107561[_0xc6e6('0x1a')],'include':_0x107561['include']?_[_0xc6e6('0x19')](_0x107561[_0xc6e6('0x18')],function(_0x2e5e0e){return{'model':db[_0x2e5e0e[_0xc6e6('0x1b')]],'as':_0x2e5e0e['as'],'attributes':_0x2e5e0e['attributes'],'include':_0x2e5e0e[_0xc6e6('0x18')]?_['map'](_0x2e5e0e[_0xc6e6('0x18')],function(_0x534745){return{'model':db[_0x534745[_0xc6e6('0x1b')]],'as':_0x534745['as'],'attributes':_0x534745[_0xc6e6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc6e6('0x8')](function(_0x41e7c2){logger[_0xc6e6('0x9')]('GetTrigger',_0x3a1ccc);logger[_0xc6e6('0xc')](_0xc6e6('0x1c'),_0x3a1ccc,JSON[_0xc6e6('0xe')](_0x41e7c2));_0x46e58f(_0x41e7c2);})[_0xc6e6('0x11')](function(_0x4d1284){logger[_0xc6e6('0xf')]('GetTrigger',_0x4d1284[_0xc6e6('0x10')],_0x3a1ccc);_0x2069e4(_0x554262[_0xc6e6('0xf')](0x1f4,_0x4d1284[_0xc6e6('0x10')]));});});};exports[_0xc6e6('0x1d')]=function(_0xd3b63){var _0x402598=this;return new Promise(function(_0x43ff9c,_0x337442){return db[_0xc6e6('0x12')][_0xc6e6('0x1e')]({'raw':_0xd3b63[_0xc6e6('0x14')]?_0xd3b63[_0xc6e6('0x14')][_0xc6e6('0x15')]===undefined?!![]:![]:!![],'where':_0xd3b63[_0xc6e6('0x14')]?_0xd3b63[_0xc6e6('0x14')][_0xc6e6('0x16')]||null:null,'attributes':_0xd3b63[_0xc6e6('0x14')]?_0xd3b63['options'][_0xc6e6('0x1a')]||null:null,'include':_0xd3b63[_0xc6e6('0x14')]?_0xd3b63['options']['include']?_[_0xc6e6('0x19')](_0xd3b63[_0xc6e6('0x14')][_0xc6e6('0x18')],function(_0x152e45){return{'model':db[_0x152e45[_0xc6e6('0x1b')]],'as':_0x152e45['as'],'attributes':_0x152e45[_0xc6e6('0x1a')],'include':_0x152e45['include']?_[_0xc6e6('0x19')](_0x152e45[_0xc6e6('0x18')],function(_0x1fff39){return{'model':db[_0x1fff39['model']],'as':_0x1fff39['as'],'attributes':_0x1fff39['attributes'],'include':_0x1fff39[_0xc6e6('0x18')]?_[_0xc6e6('0x19')](_0x1fff39[_0xc6e6('0x18')],function(_0x2db0a2){return{'model':db[_0x2db0a2['model']],'as':_0x2db0a2['as'],'attributes':_0x2db0a2['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6e6('0x8')](function(_0x4e94ea){logger[_0xc6e6('0x9')]('ShowTrigger',_0xd3b63);logger[_0xc6e6('0xc')](_0xc6e6('0x1d'),_0xd3b63,JSON[_0xc6e6('0xe')](_0x4e94ea));_0x43ff9c(_0x4e94ea);})[_0xc6e6('0x11')](function(_0x58b972){logger['error'](_0xc6e6('0x1d'),_0x58b972[_0xc6e6('0x10')],_0xd3b63);_0x337442(_0x402598[_0xc6e6('0xf')](0x1f4,_0x58b972[_0xc6e6('0x10')]));});});}; \ No newline at end of file +var _0x69d3=['debug','stringify','error','code','message','result','catch','Trigger','options','raw','attributes','limit','include','model','map','then','GetTrigger','ShowTrigger','find','where','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x28630c,_0x438228){var _0x3f16fb=function(_0x1c769a){while(--_0x1c769a){_0x28630c['push'](_0x28630c['shift']());}};_0x3f16fb(++_0x438228);}(_0x69d3,0xda));var _0x369d=function(_0x2dd177,_0x1313be){_0x2dd177=_0x2dd177-0x0;var _0x2c2b59=_0x69d3[_0x2dd177];return _0x2c2b59;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var moment=require(_0x369d('0x2'));var BPromise=require('bluebird');var rs=require(_0x369d('0x3'));var fs=require('fs');var Redis=require(_0x369d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x369d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x369d('0x6'));var client=jayson[_0x369d('0x7')][_0x369d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x424d8c,_0x1bd94c,_0x186302){return new BPromise(function(_0x3adb26,_0x2ac0ec){return client[_0x369d('0x9')](_0x424d8c,_0x186302)['then'](function(_0x5d2ded){logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,_0x369d('0xc'));logger[_0x369d('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x1bd94c,'request\x20sent',JSON[_0x369d('0xe')](_0x5d2ded));if(_0x5d2ded[_0x369d('0xf')]){if(_0x5d2ded[_0x369d('0xf')][_0x369d('0x10')]===0x1f4){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error'][_0x369d('0x11')]);return _0x2ac0ec(_0x5d2ded[_0x369d('0xf')][_0x369d('0x11')]);}logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error']['message']);return _0x3adb26(_0x5d2ded['error'][_0x369d('0x11')]);}else{logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,'request\x20sent');_0x3adb26(_0x5d2ded[_0x369d('0x12')][_0x369d('0x11')]);}})[_0x369d('0x13')](function(_0x4e234e){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x4e234e);_0x2ac0ec(_0x4e234e);});});}exports['GetTrigger']=function(_0x572513){var _0x597b67=this;return new Promise(function(_0x2946be,_0x4494b3){return db[_0x369d('0x14')]['findAll']({'raw':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x16')]===undefined?!![]:![]:!![],'where':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['where']||null:null,'attributes':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x17')]||null:null,'limit':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x18')]||null:null,'include':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['include']?_['map'](_0x572513[_0x369d('0x15')][_0x369d('0x19')],function(_0xf7bc3a){return{'model':db[_0xf7bc3a[_0x369d('0x1a')]],'as':_0xf7bc3a['as'],'attributes':_0xf7bc3a[_0x369d('0x17')],'include':_0xf7bc3a[_0x369d('0x19')]?_[_0x369d('0x1b')](_0xf7bc3a['include'],function(_0x4dfe83){return{'model':db[_0x4dfe83[_0x369d('0x1a')]],'as':_0x4dfe83['as'],'attributes':_0x4dfe83[_0x369d('0x17')],'include':_0x4dfe83[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x4dfe83[_0x369d('0x19')],function(_0x41e0cf){return{'model':db[_0x41e0cf[_0x369d('0x1a')]],'as':_0x41e0cf['as'],'attributes':_0x41e0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xe95742){logger[_0x369d('0xa')](_0x369d('0x1d'),_0x572513);logger[_0x369d('0xd')](_0x369d('0x1d'),_0x572513,JSON[_0x369d('0xe')](_0xe95742));_0x2946be(_0xe95742);})['catch'](function(_0x157291){logger['error']('GetTrigger',_0x157291[_0x369d('0x11')],_0x572513);_0x4494b3(_0x597b67[_0x369d('0xf')](0x1f4,_0x157291['message']));});});};exports[_0x369d('0x1e')]=function(_0x5a14ce){var _0x37274f=this;return new Promise(function(_0x39d656,_0xe45219){return db[_0x369d('0x14')][_0x369d('0x1f')]({'raw':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x20')]||null:null,'attributes':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x17')]||null:null,'include':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['include']?_[_0x369d('0x1b')](_0x5a14ce[_0x369d('0x15')][_0x369d('0x19')],function(_0x1b4453){return{'model':db[_0x1b4453[_0x369d('0x1a')]],'as':_0x1b4453['as'],'attributes':_0x1b4453['attributes'],'include':_0x1b4453[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x1b4453[_0x369d('0x19')],function(_0x3a0277){return{'model':db[_0x3a0277[_0x369d('0x1a')]],'as':_0x3a0277['as'],'attributes':_0x3a0277[_0x369d('0x17')],'include':_0x3a0277['include']?_[_0x369d('0x1b')](_0x3a0277[_0x369d('0x19')],function(_0x40afb2){return{'model':db[_0x40afb2[_0x369d('0x1a')]],'as':_0x40afb2['as'],'attributes':_0x40afb2[_0x369d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xfa13da){logger[_0x369d('0xa')](_0x369d('0x1e'),_0x5a14ce);logger[_0x369d('0xd')](_0x369d('0x1e'),_0x5a14ce,JSON[_0x369d('0xe')](_0xfa13da));_0x39d656(_0xfa13da);})[_0x369d('0x13')](function(_0x43d734){logger[_0x369d('0xf')](_0x369d('0x1e'),_0x43d734[_0x369d('0x11')],_0x5a14ce);_0xe45219(_0x37274f[_0x369d('0xf')](0x1f4,_0x43d734[_0x369d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 4d1e229..cdf0ca1 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 _0xa944=['./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','post','create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3dd691,_0x556f37){var _0x1ece22=function(_0x470115){while(--_0x470115){_0x3dd691['push'](_0x3dd691['shift']());}};_0x1ece22(++_0x556f37);}(_0xa944,0x1c3));var _0x4a94=function(_0x36afc7,_0x3ef03f){_0x36afc7=_0x36afc7-0x0;var _0x13ab17=_0xa944[_0x36afc7];return _0x13ab17;};'use strict';var multer=require(_0x4a94('0x0'));var util=require(_0x4a94('0x1'));var path=require(_0x4a94('0x2'));var timeout=require(_0x4a94('0x3'));var express=require(_0x4a94('0x4'));var router=express[_0x4a94('0x5')]();var fs_extra=require(_0x4a94('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4a94('0x7'));var config=require(_0x4a94('0x8'));var controller=require(_0x4a94('0x9'));router[_0x4a94('0xa')]('/',auth[_0x4a94('0xb')](),controller[_0x4a94('0xc')]);router[_0x4a94('0xa')](_0x4a94('0xd'),auth[_0x4a94('0xb')](),controller[_0x4a94('0xe')]);router['post'](_0x4a94('0xf'),auth[_0x4a94('0xb')](),controller['clone']);router[_0x4a94('0x10')]('/',auth[_0x4a94('0xb')](),controller[_0x4a94('0x11')]);router[_0x4a94('0x12')](_0x4a94('0xd'),auth[_0x4a94('0xb')](),controller[_0x4a94('0x13')]);router['delete'](_0x4a94('0xd'),auth[_0x4a94('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x704c=['path','express','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','show','post','clone','put','/:id','update','delete','destroy','exports','multer'];(function(_0x2f42f4,_0x5bddce){var _0x3c1c51=function(_0x292f14){while(--_0x292f14){_0x2f42f4['push'](_0x2f42f4['shift']());}};_0x3c1c51(++_0x5bddce);}(_0x704c,0x143));var _0xc704=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x704c[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0xc704('0x0'));var util=require('util');var path=require(_0xc704('0x1'));var timeout=require('connect-timeout');var express=require(_0xc704('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc704('0x3'));var interaction=require(_0xc704('0x4'));var config=require('../../config/environment');var controller=require(_0xc704('0x5'));router[_0xc704('0x6')]('/',auth[_0xc704('0x7')](),controller[_0xc704('0x8')]);router[_0xc704('0x6')]('/:id',auth[_0xc704('0x7')](),controller[_0xc704('0x9')]);router[_0xc704('0xa')]('/:id/clone',auth[_0xc704('0x7')](),controller[_0xc704('0xb')]);router[_0xc704('0xa')]('/',auth[_0xc704('0x7')](),controller['create']);router[_0xc704('0xc')](_0xc704('0xd'),auth['isAuthenticated'](),controller[_0xc704('0xe')]);router[_0xc704('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc704('0x10')]);module[_0xc704('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 3677147..504da7d 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 _0x6ea0=['dynamic','BOOLEAN','sequelize','exports','STRING','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','info','shortinfo','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','certificate','active','passive','actpass'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6ea0,0x106));var _0x06ea=function(_0x14e5c1,_0x155120){_0x14e5c1=_0x14e5c1-0x0;var _0x2abf30=_0x6ea0[_0x14e5c1];return _0x2abf30;};'use strict';var Sequelize=require(_0x06ea('0x0'));module[_0x06ea('0x1')]={'name':{'type':Sequelize[_0x06ea('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x4'),_0x06ea('0x5'),_0x06ea('0x6')),'allowNull':![],'defaultValue':_0x06ea('0x4')},'context':{'type':Sequelize[_0x06ea('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x7'),_0x06ea('0x8'),_0x06ea('0x9'),_0x06ea('0xa'),_0x06ea('0xb'),_0x06ea('0xc'),_0x06ea('0xd'),_0x06ea('0xe'))},'deny':{'type':Sequelize[_0x06ea('0x2')]},'permit':{'type':Sequelize[_0x06ea('0x2')]},'secret':{'type':Sequelize[_0x06ea('0x2')]},'md5secret':{'type':Sequelize[_0x06ea('0x2')]},'remotesecret':{'type':Sequelize[_0x06ea('0x2')]},'transport':{'type':Sequelize[_0x06ea('0x2')],'defaultValue':'udp','set':function(_0x273b37){this[_0x06ea('0xf')](_0x06ea('0x10'),_0x273b37?_0x273b37[_0x06ea('0x11')](','):null);},'get':function(){return this[_0x06ea('0x12')](_0x06ea('0x10'))?this['getDataValue'](_0x06ea('0x10'))[_0x06ea('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x06ea('0x3')]('rfc2833',_0x06ea('0x14'),_0x06ea('0x15'),'inband',_0x06ea('0x16')),'defaultValue':_0x06ea('0x17')},'directmedia':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no',_0x06ea('0x19'),_0x06ea('0x1a'),_0x06ea('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x06ea('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x06ea('0x2')]},'directmediadeny':{'type':Sequelize[_0x06ea('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x06ea('0x1c'),'set':function(_0x30c3a2){this[_0x06ea('0xf')](_0x06ea('0x1d'),_0x30c3a2?_0x30c3a2['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x06ea('0x12')](_0x06ea('0x1d'))[_0x06ea('0x13')](','):null;},'comment':_0x06ea('0x1e')},'callgroup':{'type':Sequelize[_0x06ea('0x2')]},'namedcallgroup':{'type':Sequelize[_0x06ea('0x2')]},'pickupgroup':{'type':Sequelize[_0x06ea('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x06ea('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x06ea('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x06ea('0x2')],'defaultValue':_0x06ea('0x1f')},'allow':{'type':Sequelize[_0x06ea('0x2')],'allowNull':![],'defaultValue':_0x06ea('0x20'),'set':function(_0x24dc58){this[_0x06ea('0xf')](_0x06ea('0x21'),_0x24dc58?_0x24dc58['join'](';'):_0x06ea('0x20'));},'get':function(){return this[_0x06ea('0x12')]('allow')?this[_0x06ea('0x12')](_0x06ea('0x21'))[_0x06ea('0x13')](';'):null;},'comment':_0x06ea('0x22')},'autoframing':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no')},'insecure':{'type':Sequelize[_0x06ea('0x2')],'defaultValue':_0x06ea('0x23'),'set':function(_0x343efa){this[_0x06ea('0xf')](_0x06ea('0x24'),_0x343efa?_0x343efa[_0x06ea('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x06ea('0x24'))?this[_0x06ea('0x12')](_0x06ea('0x24'))[_0x06ea('0x13')](','):null;},'comment':_0x06ea('0x25')},'trustrpid':{'type':Sequelize['ENUM'](_0x06ea('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x06ea('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no')},'accountcode':{'type':Sequelize[_0x06ea('0x26')](0xb)},'setvar':{'type':Sequelize[_0x06ea('0x2')]},'callerid':{'type':Sequelize[_0x06ea('0x2')],'defaultValue':_0x06ea('0x27')},'amaflags':{'type':Sequelize[_0x06ea('0x2')]},'callcounter':{'type':Sequelize[_0x06ea('0x3')]('yes','no'),'defaultValue':_0x06ea('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x06ea('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x06ea('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no',_0x06ea('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x06ea('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x06ea('0x3')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM']('accept',_0x06ea('0x29'),_0x06ea('0x2a'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x06ea('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x2b'),'uas'),'defaultValue':_0x06ea('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x06ea('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x06ea('0x2')]},'fromuser':{'type':Sequelize[_0x06ea('0x2')]},'port':{'type':Sequelize[_0x06ea('0x26')](0x5)},'qualify':{'type':Sequelize[_0x06ea('0x3')]('yes','no'),'defaultValue':_0x06ea('0x18')},'keepalive':{'type':Sequelize[_0x06ea('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x06ea('0x2')]},'defaultuser':{'type':Sequelize[_0x06ea('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x06ea('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x06ea('0x3')]('yes','no',_0x06ea('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x06ea('0x2')]},'callbackextension':{'type':Sequelize[_0x06ea('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x06ea('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x06ea('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x06ea('0x2')]},'contactdeny':{'type':Sequelize[_0x06ea('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x06ea('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x06ea('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x06ea('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x06ea('0x3')]('yes','no')},'force_avp':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no')},'icesupport':{'type':Sequelize[_0x06ea('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no','fingerprint',_0x06ea('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x06ea('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x06ea('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x06ea('0x2')]},'dtlscafile':{'type':Sequelize[_0x06ea('0x2')]},'dtlscapath':{'type':Sequelize[_0x06ea('0x2')]},'dtlssetup':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x2f'),_0x06ea('0x30'),_0x06ea('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x06ea('0x2')]},'usereqphone':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x06ea('0x2')]},'recordofffeature':{'type':Sequelize[_0x06ea('0x2')]},'call_limit':{'type':Sequelize[_0x06ea('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x06ea('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x06ea('0x3')](_0x06ea('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x06ea('0x2')]},'mohsuggest':{'type':Sequelize[_0x06ea('0x2')]},'parkinglot':{'type':Sequelize[_0x06ea('0x2')]},'description':{'type':Sequelize[_0x06ea('0x2')]},'host':{'type':Sequelize[_0x06ea('0x2')],'defaultValue':_0x06ea('0x32')},'canreinvite':{'type':Sequelize[_0x06ea('0x3')]('yes','no',_0x06ea('0x19'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x06ea('0x2')]},'active':{'type':Sequelize[_0x06ea('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x06ea('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xad08=['INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','STRING','from-voip-provider','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','nonat','force_rport,comedia','setDataValue','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','yes','port,invite','insecure','never'];(function(_0x256279,_0x10e2e6){var _0x523804=function(_0x2923a5){while(--_0x2923a5){_0x256279['push'](_0x256279['shift']());}};_0x523804(++_0x10e2e6);}(_0xad08,0x1c0));var _0x8ad0=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xad08[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x8ad0('0x0'));module[_0x8ad0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8ad0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x4'),'user','peer'),'allowNull':![],'defaultValue':_0x8ad0('0x4')},'context':{'type':Sequelize[_0x8ad0('0x5')],'allowNull':![],'defaultValue':_0x8ad0('0x6')},'callingpres':{'type':Sequelize[_0x8ad0('0x3')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x8ad0('0x7'),_0x8ad0('0x8'),_0x8ad0('0x9'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x8ad0('0x5')]},'secret':{'type':Sequelize[_0x8ad0('0x5')]},'md5secret':{'type':Sequelize[_0x8ad0('0x5')]},'remotesecret':{'type':Sequelize[_0x8ad0('0x5')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x8ad0('0xa'),'set':function(_0x416a36){this['setDataValue'](_0x8ad0('0xb'),_0x416a36?_0x416a36['join'](','):null);},'get':function(){return this[_0x8ad0('0xc')](_0x8ad0('0xb'))?this['getDataValue'](_0x8ad0('0xb'))[_0x8ad0('0xd')](','):null;},'comment':_0x8ad0('0xe')},'dtmfmode':{'type':Sequelize['ENUM'](_0x8ad0('0xf'),'info',_0x8ad0('0x10'),_0x8ad0('0x11'),_0x8ad0('0x12')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x8ad0('0x13'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8ad0('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8ad0('0x5')]},'directmediadeny':{'type':Sequelize[_0x8ad0('0x5')]},'nat':{'type':Sequelize[_0x8ad0('0x5')],'defaultValue':_0x8ad0('0x14'),'set':function(_0x363ef3){this[_0x8ad0('0x15')](_0x8ad0('0x16'),_0x363ef3?_0x363ef3[_0x8ad0('0x17')](','):null);},'get':function(){return this[_0x8ad0('0xc')](_0x8ad0('0x16'))?this[_0x8ad0('0xc')](_0x8ad0('0x16'))[_0x8ad0('0xd')](','):null;},'comment':_0x8ad0('0x18')},'callgroup':{'type':Sequelize[_0x8ad0('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x8ad0('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8ad0('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x8ad0('0x5')],'allowNull':![],'defaultValue':_0x8ad0('0x19'),'set':function(_0x25fd1e){this[_0x8ad0('0x15')]('allow',_0x25fd1e?_0x25fd1e[_0x8ad0('0x17')](';'):_0x8ad0('0x19'));},'get':function(){return this['getDataValue'](_0x8ad0('0x1a'))?this[_0x8ad0('0xc')](_0x8ad0('0x1a'))[_0x8ad0('0xd')](';'):null;},'comment':_0x8ad0('0x1b')},'autoframing':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no')},'insecure':{'type':Sequelize[_0x8ad0('0x5')],'defaultValue':_0x8ad0('0x1d'),'set':function(_0x33243c){this[_0x8ad0('0x15')]('insecure',_0x33243c?_0x33243c[_0x8ad0('0x17')](','):null);},'get':function(){return this[_0x8ad0('0xc')](_0x8ad0('0x1e'))?this[_0x8ad0('0xc')]('insecure')[_0x8ad0('0xd')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x8ad0('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8ad0('0x3')]('yes','no',_0x8ad0('0x1f'))},'promiscredir':{'type':Sequelize['ENUM'](_0x8ad0('0x1c'),'no')},'useclientcode':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no')},'accountcode':{'type':Sequelize[_0x8ad0('0x20')](0xb)},'setvar':{'type':Sequelize[_0x8ad0('0x5')]},'callerid':{'type':Sequelize[_0x8ad0('0x5')],'defaultValue':_0x8ad0('0x21')},'amaflags':{'type':Sequelize[_0x8ad0('0x5')]},'callcounter':{'type':Sequelize['ENUM'](_0x8ad0('0x1c'),'no'),'defaultValue':_0x8ad0('0x1c')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no')},'allowsubscribe':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no')},'allowtransfer':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no')},'ignoresdpversion':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no')},'subscribecontext':{'type':Sequelize[_0x8ad0('0x5')]},'template':{'type':Sequelize[_0x8ad0('0x5')]},'videosupport':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no',_0x8ad0('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM']('accept',_0x8ad0('0x23'),_0x8ad0('0x24'))},'session_expires':{'type':Sequelize[_0x8ad0('0x20')](0xb)},'session_minse':{'type':Sequelize[_0x8ad0('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x25'),'uas'),'defaultValue':_0x8ad0('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0x8ad0('0x5')]},'regexten':{'type':Sequelize[_0x8ad0('0x5')]},'fromdomain':{'type':Sequelize[_0x8ad0('0x5')]},'fromuser':{'type':Sequelize[_0x8ad0('0x5')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x8ad0('0x1c'),'no'),'defaultValue':_0x8ad0('0x1c')},'keepalive':{'type':Sequelize[_0x8ad0('0x20')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x8ad0('0x5')]},'rtptimeout':{'type':Sequelize[_0x8ad0('0x20')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8ad0('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no',_0x8ad0('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x8ad0('0x5')]},'timert1':{'type':Sequelize[_0x8ad0('0x20')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x8ad0('0x20')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x8ad0('0x5')]},'contactacl':{'type':Sequelize[_0x8ad0('0x5')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x8ad0('0x5')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x8ad0('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8ad0('0x3')]('yes','no')},'force_avp':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no')},'icesupport':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no')},'dtlsenable':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no')},'dtlsverify':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no',_0x8ad0('0x28'),_0x8ad0('0x29'))},'dtlsrekey':{'type':Sequelize[_0x8ad0('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x8ad0('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0x8ad0('0x5')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x8ad0('0x5')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x2a'),_0x8ad0('0x2b'),_0x8ad0('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8ad0('0x5')]},'usereqphone':{'type':Sequelize[_0x8ad0('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8ad0('0x5')]},'recordofffeature':{'type':Sequelize[_0x8ad0('0x5')]},'call_limit':{'type':Sequelize[_0x8ad0('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x1c'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x8ad0('0x5')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x8ad0('0x5')]},'parkinglot':{'type':Sequelize[_0x8ad0('0x5')]},'description':{'type':Sequelize[_0x8ad0('0x5')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x8ad0('0x2d')},'canreinvite':{'type':Sequelize['ENUM'](_0x8ad0('0x1c'),'no','nonat','update',_0x8ad0('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8ad0('0x5')]},'otherFields':{'type':Sequelize[_0x8ad0('0x5')]},'active':{'type':Sequelize[_0x8ad0('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8ad0('0x5')],'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 7ace5c3..75de5d6 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 _0x2a16=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','update','server/files/templates/trunk.ejs','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','get','Trunks','UserProfileResource','stack','name','send','map','Trunk','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','clone','find','omit','body','updatedAt','create','role','UserProfileSection','userProfileId'];(function(_0x37517f,_0x26dbd7){var _0x59a524=function(_0x4a95d8){while(--_0x4a95d8){_0x37517f['push'](_0x37517f['shift']());}};_0x59a524(++_0x26dbd7);}(_0x2a16,0xea));var _0x62a1=function(_0x48549e,_0x36728b){_0x48549e=_0x48549e-0x0;var _0x835379=_0x2a16[_0x48549e];return _0x835379;};'use strict';var emlformat=require(_0x62a1('0x0'));var rimraf=require(_0x62a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x62a1('0x2'));var rp=require(_0x62a1('0x3'));var moment=require(_0x62a1('0x4'));var BPromise=require(_0x62a1('0x5'));var Mustache=require(_0x62a1('0x6'));var util=require(_0x62a1('0x7'));var path=require('path');var sox=require(_0x62a1('0x8'));var csv=require(_0x62a1('0x9'));var ejs=require(_0x62a1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62a1('0xb'));var squel=require('squel');var crypto=require(_0x62a1('0xc'));var jsforce=require(_0x62a1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x62a1('0x9'));var querystring=require(_0x62a1('0xe'));var Papa=require(_0x62a1('0xf'));var Redis=require(_0x62a1('0x10'));var authService=require(_0x62a1('0x11'));var qs=require(_0x62a1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62a1('0x13'));var logger=require(_0x62a1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x62a1('0x15'));var licenseUtil=require(_0x62a1('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x62a1('0x17'));var client=jayson[_0x62a1('0x18')][_0x62a1('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5f0fc3,_0x4940ce,_0x3c9d8d,_0x4052bf){return new BPromise(function(_0x407edc,_0x1fe570){var _0xfd5650=_0x4052bf||client;return _0xfd5650[_0x62a1('0x1a')](_0x5f0fc3,_0x3c9d8d)[_0x62a1('0x1b')](function(_0x1ea27f){logger[_0x62a1('0x1c')]('Trunk,\x20%s,\x20%s',_0x4940ce,_0x62a1('0x1d'));logger[_0x62a1('0x1e')]('Trunk,\x20%s,\x20%s,\x20%s',_0x4940ce,_0x62a1('0x1d'),JSON['stringify'](_0x1ea27f));if(_0x1ea27f[_0x62a1('0x1f')]){if(_0x1ea27f[_0x62a1('0x1f')]['code']===0x1f4){logger['error'](_0x62a1('0x20'),_0x4940ce,_0x1ea27f['error'][_0x62a1('0x21')]);return _0x1fe570(_0x1ea27f[_0x62a1('0x1f')][_0x62a1('0x21')]);}logger[_0x62a1('0x1f')](_0x62a1('0x20'),_0x4940ce,_0x1ea27f[_0x62a1('0x1f')][_0x62a1('0x21')]);return _0x407edc(_0x1ea27f['error'][_0x62a1('0x21')]);}else{logger[_0x62a1('0x1c')](_0x62a1('0x20'),_0x4940ce,_0x62a1('0x1d'));_0x407edc(_0x1ea27f[_0x62a1('0x22')][_0x62a1('0x21')]);}})[_0x62a1('0x23')](function(_0x4a2d05){logger[_0x62a1('0x1f')](_0x62a1('0x20'),_0x4940ce,_0x4a2d05);_0x1fe570(_0x4a2d05);});});}function respondWithStatusCode(_0x36b28b,_0x4b0602){_0x4b0602=_0x4b0602||0xcc;return function(_0x19272b){if(_0x19272b){return _0x36b28b[_0x62a1('0x24')](_0x4b0602);}return _0x36b28b[_0x62a1('0x25')](_0x4b0602)[_0x62a1('0x26')]();};}function respondWithResult(_0x1f962c,_0x3a1966){_0x3a1966=_0x3a1966||0xc8;return function(_0x2e6b69){if(_0x2e6b69){return _0x1f962c[_0x62a1('0x25')](_0x3a1966)[_0x62a1('0x27')](_0x2e6b69);}};}function respondWithFilteredResult(_0x131b8e,_0x240605){return function(_0x1067a1){if(_0x1067a1){var _0x4723c2=typeof _0x240605[_0x62a1('0x28')]===_0x62a1('0x29')&&typeof _0x240605[_0x62a1('0x2a')]===_0x62a1('0x29');var _0x4b2f0b=_0x1067a1[_0x62a1('0x2b')];var _0x5c3b00=_0x4723c2?0x0:_0x240605['offset'];var _0x103efa=_0x4723c2?_0x1067a1[_0x62a1('0x2b')]:_0x240605[_0x62a1('0x28')]+_0x240605[_0x62a1('0x2a')];var _0x59f48c;if(_0x103efa>=_0x4b2f0b){_0x103efa=_0x4b2f0b;_0x59f48c=0xc8;}else{_0x59f48c=0xce;}_0x131b8e[_0x62a1('0x25')](_0x59f48c);return _0x131b8e[_0x62a1('0x2c')](_0x62a1('0x2d'),_0x5c3b00+'-'+_0x103efa+'/'+_0x4b2f0b)[_0x62a1('0x27')](_0x1067a1);}return null;};}function patchUpdates(_0xf851ff){return function(_0x1e51a0){try{jsonpatch[_0x62a1('0x2e')](_0x1e51a0,_0xf851ff,!![]);}catch(_0x4ef637){return BPromise[_0x62a1('0x2f')](_0x4ef637);}return _0x1e51a0[_0x62a1('0x30')]();};}function saveUpdates(_0x51a935,_0x4be52d){return function(_0x4f29bd){if(_0x4f29bd){return _0x4f29bd['update'](_0x51a935)[_0x62a1('0x1b')](function(_0x4e5e86){return _0x4e5e86;});}return null;};}function removeEntity(_0xde028b,_0x1480fb){return function(_0x4c13f6){if(_0x4c13f6){return _0x4c13f6['destroy']()['then'](function(){var _0x4c25c4=_0x4c13f6[_0x62a1('0x31')]({'plain':!![]});var _0x1a4d56=_0x62a1('0x32');return db[_0x62a1('0x33')]['destroy']({'where':{'type':_0x1a4d56,'resourceId':_0x4c25c4['id']}})['then'](function(){return _0x4c13f6;});})[_0x62a1('0x1b')](function(){_0xde028b['status'](0xcc)[_0x62a1('0x26')]();});}};}function handleEntityNotFound(_0x182ece,_0x4f4b83){return function(_0x16457d){if(!_0x16457d){_0x182ece['sendStatus'](0x194);}return _0x16457d;};}function handleError(_0x3e4478,_0x55f9b2){_0x55f9b2=_0x55f9b2||0x1f4;return function(_0xf920fa){logger[_0x62a1('0x1f')](_0xf920fa[_0x62a1('0x34')]);if(_0xf920fa[_0x62a1('0x35')]){delete _0xf920fa['name'];}_0x3e4478[_0x62a1('0x25')](_0x55f9b2)[_0x62a1('0x36')](_0xf920fa);};}exports['index']=function(_0x4a13e3,_0x387d35){var _0x2e27e3={},_0x57f506={},_0x123a63={'count':0x0,'rows':[]};var _0x453149=_[_0x62a1('0x37')](db[_0x62a1('0x38')][_0x62a1('0x39')],function(_0x5c952f){return{'name':_0x5c952f['fieldName'],'type':_0x5c952f[_0x62a1('0x3a')][_0x62a1('0x3b')]};});_0x57f506[_0x62a1('0x3c')]=_[_0x62a1('0x37')](_0x453149,_0x62a1('0x35'));_0x57f506[_0x62a1('0x3d')]=_[_0x62a1('0x3e')](_0x4a13e3[_0x62a1('0x3d')]);_0x57f506[_0x62a1('0x3f')]=_[_0x62a1('0x40')](_0x57f506[_0x62a1('0x3c')],_0x57f506[_0x62a1('0x3d')]);_0x2e27e3[_0x62a1('0x41')]=_['intersection'](_0x57f506[_0x62a1('0x3c')],qs[_0x62a1('0x42')](_0x4a13e3[_0x62a1('0x3d')][_0x62a1('0x42')]));_0x2e27e3[_0x62a1('0x41')]=_0x2e27e3['attributes'][_0x62a1('0x43')]?_0x2e27e3['attributes']:_0x57f506[_0x62a1('0x3c')];if(!_0x4a13e3[_0x62a1('0x3d')][_0x62a1('0x44')]('nolimit')){_0x2e27e3[_0x62a1('0x2a')]=qs[_0x62a1('0x2a')](_0x4a13e3['query'][_0x62a1('0x2a')]);_0x2e27e3[_0x62a1('0x28')]=qs['offset'](_0x4a13e3[_0x62a1('0x3d')]['offset']);}_0x2e27e3[_0x62a1('0x45')]=qs['sort'](_0x4a13e3[_0x62a1('0x3d')][_0x62a1('0x46')]);_0x2e27e3['where']=qs[_0x62a1('0x3f')](_[_0x62a1('0x47')](_0x4a13e3[_0x62a1('0x3d')],_0x57f506['filters']),_0x453149);if(_0x4a13e3[_0x62a1('0x3d')]['filter']){_0x2e27e3[_0x62a1('0x48')]=_[_0x62a1('0x49')](_0x2e27e3['where'],{'$or':_['map'](_0x453149,function(_0x38ccd7){if(_0x38ccd7[_0x62a1('0x3a')]!==_0x62a1('0x4a')){var _0x5269c9={};_0x5269c9[_0x38ccd7[_0x62a1('0x35')]]={'$like':'%'+_0x4a13e3[_0x62a1('0x3d')]['filter']+'%'};return _0x5269c9;}})});}_0x2e27e3=_[_0x62a1('0x49')]({},_0x2e27e3,_0x4a13e3[_0x62a1('0x4b')]);var _0x5bbb35={'where':_0x2e27e3[_0x62a1('0x48')]};return db['Trunk']['count'](_0x5bbb35)[_0x62a1('0x1b')](function(_0x2f260c){_0x123a63[_0x62a1('0x2b')]=_0x2f260c;if(_0x4a13e3[_0x62a1('0x3d')][_0x62a1('0x4c')]){_0x2e27e3[_0x62a1('0x4d')]=[{'all':!![]}];}return db['Trunk'][_0x62a1('0x4e')](_0x2e27e3);})['then'](function(_0xfde65a){_0x123a63['rows']=_0xfde65a;return _0x123a63;})[_0x62a1('0x1b')](respondWithFilteredResult(_0x387d35,_0x2e27e3))[_0x62a1('0x23')](handleError(_0x387d35,null));};exports[_0x62a1('0x4f')]=function(_0x41f0a6,_0xa727b0){var _0x313a5e={'raw':![],'where':{'id':_0x41f0a6[_0x62a1('0x50')]['id']}},_0x2045eb={};_0x2045eb[_0x62a1('0x3c')]=_[_0x62a1('0x3e')](db['Trunk'][_0x62a1('0x39')]);_0x2045eb[_0x62a1('0x3d')]=_[_0x62a1('0x3e')](_0x41f0a6[_0x62a1('0x3d')]);_0x2045eb['filters']=_['intersection'](_0x2045eb[_0x62a1('0x3c')],_0x2045eb[_0x62a1('0x3d')]);_0x313a5e[_0x62a1('0x41')]=_[_0x62a1('0x40')](_0x2045eb[_0x62a1('0x3c')],qs[_0x62a1('0x42')](_0x41f0a6[_0x62a1('0x3d')][_0x62a1('0x42')]));_0x313a5e[_0x62a1('0x41')]=_0x313a5e['attributes']['length']?_0x313a5e[_0x62a1('0x41')]:_0x2045eb['model'];if(_0x41f0a6[_0x62a1('0x3d')][_0x62a1('0x4c')]){_0x313a5e[_0x62a1('0x4d')]=[{'all':!![]}];}_0x313a5e=_[_0x62a1('0x49')]({},_0x313a5e,_0x41f0a6[_0x62a1('0x4b')]);return db[_0x62a1('0x38')]['find'](_0x313a5e)[_0x62a1('0x1b')](handleEntityNotFound(_0xa727b0,null))[_0x62a1('0x1b')](respondWithResult(_0xa727b0,null))[_0x62a1('0x23')](handleError(_0xa727b0,null));};exports[_0x62a1('0x51')]=function(_0x40de20,_0x524c9b){var _0x3471f4={'where':{'id':_0x40de20[_0x62a1('0x50')]['id']}},_0x56a716={};_0x56a716[_0x62a1('0x3c')]=_[_0x62a1('0x3e')](db['Trunk'][_0x62a1('0x39')]);_0x3471f4[_0x62a1('0x41')]=_['intersection'](_0x56a716[_0x62a1('0x3c')],qs[_0x62a1('0x42')](_0x40de20[_0x62a1('0x3d')][_0x62a1('0x42')]));_0x3471f4[_0x62a1('0x41')]=_0x3471f4[_0x62a1('0x41')][_0x62a1('0x43')]?_0x3471f4['attributes']:_0x56a716[_0x62a1('0x3c')];if(_0x40de20[_0x62a1('0x3d')][_0x62a1('0x4c')]){_0x3471f4[_0x62a1('0x4d')]=[{'all':!![]}];}_0x3471f4=_[_0x62a1('0x49')]({},_0x3471f4,_0x40de20[_0x62a1('0x4b')]);return db['Trunk'][_0x62a1('0x52')](_0x3471f4)['then'](handleEntityNotFound(_0x524c9b,null))[_0x62a1('0x1b')](function(_0x368550){if(_0x368550){var _0x550695=_0x368550['get']({'plain':!![]});_0x550695=qs[_0x62a1('0x53')](_0x550695,['id','createdAt','updatedAt']);_0x40de20[_0x62a1('0x54')]=_['omit'](_0x40de20[_0x62a1('0x54')],['id','createdAt',_0x62a1('0x55')]);return db[_0x62a1('0x38')][_0x62a1('0x56')](_[_0x62a1('0x49')](_0x550695,_0x40de20['body']),{'include':_0x40de20[_0x62a1('0x3d')][_0x62a1('0x4c')]?[{'all':!![]}]:undefined})[_0x62a1('0x1b')](function(_0x783067){var _0x25a846=_0x40de20['user'][_0x62a1('0x31')]({'plain':!![]});if(!_0x25a846)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25a846[_0x62a1('0x57')]==='user'){var _0x4e68b8=_0x783067['get']({'plain':!![]});var _0x53e6b3='Trunks';return db[_0x62a1('0x58')][_0x62a1('0x52')]({'where':{'name':_0x53e6b3,'userProfileId':_0x25a846[_0x62a1('0x59')]},'raw':!![]})[_0x62a1('0x1b')](function(_0x4c8dac){if(_0x4c8dac&&_0x4c8dac['autoAssociation']===0x0){return db['UserProfileResource'][_0x62a1('0x56')]({'name':_0x4e68b8[_0x62a1('0x35')],'resourceId':_0x4e68b8['id'],'type':_0x4c8dac[_0x62a1('0x35')],'sectionId':_0x4c8dac['id']},{})['then'](function(){return _0x783067;});}else{return _0x783067;}})[_0x62a1('0x23')](function(_0x5ebfe0){logger[_0x62a1('0x1f')](_0x62a1('0x5a'),_0x5ebfe0);throw _0x5ebfe0;});}return _0x783067;});}})['then'](respondWithResult(_0x524c9b,0xc9))[_0x62a1('0x23')](handleError(_0x524c9b,null));};exports[_0x62a1('0x56')]=function(_0x5bcdad,_0x40fca1,_0x4d90d4){var _0x500197;return db[_0x62a1('0x38')][_0x62a1('0x56')](_0x5bcdad[_0x62a1('0x54')],{'raw':!![]})[_0x62a1('0x1b')](function(_0x4bd6f3){_0x500197=_0x4bd6f3;return db[_0x62a1('0x38')][_0x62a1('0x4e')]({'raw':!![]});})[_0x62a1('0x1b')](function(_0x541205){var _0x2eb9d2=fs[_0x62a1('0x5b')](path[_0x62a1('0x5c')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0xc163d3=fs['readFileSync'](path[_0x62a1('0x5c')](config[_0x62a1('0x5d')],_0x62a1('0x5e')),_0x62a1('0x5f'));var _0x44cae4=ejs[_0x62a1('0x60')](_0x2eb9d2,{'trunks':_0x541205||[]});fs[_0x62a1('0x61')](_0x62a1('0x62'),_0x44cae4);if(_0x500197['registry']){var _0x2aab63=ejs[_0x62a1('0x60')](_0xc163d3,{'trunks':_0x541205||[]});fs[_0x62a1('0x61')](_0x62a1('0x63'),_0x2aab63);}})[_0x62a1('0x1b')](function(){return respondWithRpcPromise(_0x62a1('0x64'),_0x62a1('0x56'),{'module':_0x62a1('0x65')});})['then'](function(){var _0x52b0b6=_0x5bcdad[_0x62a1('0x66')][_0x62a1('0x31')]({'plain':!![]});if(!_0x52b0b6)throw new Error(_0x62a1('0x67'));if(_0x52b0b6['role']===_0x62a1('0x66')){var _0x309ac6=_0x500197['get']({'plain':!![]});return db[_0x62a1('0x58')][_0x62a1('0x52')]({'where':{'name':_0x62a1('0x32'),'userProfileId':_0x52b0b6[_0x62a1('0x59')]},'raw':!![]})[_0x62a1('0x1b')](function(_0x1e72bb){if(_0x1e72bb&&_0x1e72bb[_0x62a1('0x68')]===0x0){return db['UserProfileResource'][_0x62a1('0x56')]({'name':_0x309ac6[_0x62a1('0x35')],'resourceId':_0x309ac6['id'],'type':_0x1e72bb[_0x62a1('0x35')],'sectionId':_0x1e72bb['id']},{})[_0x62a1('0x1b')](function(){return _0x500197;});}else{return _0x500197;}})[_0x62a1('0x23')](function(_0x26f77a){logger[_0x62a1('0x1f')](_0x62a1('0x5a'),_0x26f77a);throw _0x26f77a;});}return _0x500197;})[_0x62a1('0x1b')](respondWithResult(_0x40fca1,0xc9))['catch'](handleError(_0x40fca1,null));};exports[_0x62a1('0x69')]=function(_0x3229a9,_0x267fe0,_0x51325a){var _0x362685;return db[_0x62a1('0x38')][_0x62a1('0x52')]({'where':{'id':_0x3229a9[_0x62a1('0x50')]['id']}})['then'](handleEntityNotFound(_0x267fe0,null))[_0x62a1('0x1b')](saveUpdates(_0x3229a9['body'],null))['then'](function(_0x45e6fe){if(_0x45e6fe){_0x362685=_0x45e6fe;return db[_0x62a1('0x38')]['findAll']({'raw':!![]});}})['then'](function(_0x1a7102){if(_0x1a7102){var _0x1c1af4=fs['readFileSync'](path[_0x62a1('0x5c')](config[_0x62a1('0x5d')],_0x62a1('0x6a')),_0x62a1('0x5f'));var _0x1bbb51=fs[_0x62a1('0x5b')](path[_0x62a1('0x5c')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x4f798e=ejs[_0x62a1('0x60')](_0x1c1af4,{'trunks':_0x1a7102||[]});fs['writeFileSync'](_0x62a1('0x62'),_0x4f798e);var _0x2bfb58=ejs[_0x62a1('0x60')](_0x1bbb51,{'trunks':_0x1a7102||[]});fs[_0x62a1('0x61')](_0x62a1('0x63'),_0x2bfb58);return respondWithRpcPromise(_0x62a1('0x64'),'update',{'module':_0x62a1('0x65')});}return null;})[_0x62a1('0x1b')](function(_0x405f7d){if(_0x405f7d){return _0x362685;}})[_0x62a1('0x1b')](respondWithResult(_0x267fe0,null))[_0x62a1('0x23')](handleError(_0x267fe0,null));};exports[_0x62a1('0x6b')]=function(_0x33de7b,_0x49e9c0,_0x288312){var _0x83bfa6;return db[_0x62a1('0x38')]['find']({'where':{'id':_0x33de7b[_0x62a1('0x50')]['id']}})[_0x62a1('0x1b')](handleEntityNotFound(_0x49e9c0,null))[_0x62a1('0x1b')](removeEntity(_0x49e9c0,null))[_0x62a1('0x1b')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x62a1('0x1b')](function(_0x114b8d){var _0x4c0a6b=fs[_0x62a1('0x5b')](path[_0x62a1('0x5c')](config['root'],'server/files/templates/trunk.ejs'),_0x62a1('0x5f'));var _0x1b9df6=fs['readFileSync'](path[_0x62a1('0x5c')](config[_0x62a1('0x5d')],_0x62a1('0x5e')),_0x62a1('0x5f'));var _0xbbe93b=ejs['render'](_0x4c0a6b,{'trunks':_0x114b8d});var _0x55747e=ejs['render'](_0x1b9df6,{'trunks':_0x114b8d});fs['writeFileSync'](_0x62a1('0x62'),_0xbbe93b);fs[_0x62a1('0x61')](_0x62a1('0x63'),_0x55747e);return respondWithRpcPromise(_0x62a1('0x64'),_0x62a1('0x6b'),{'module':'chan_sip.so'});})[_0x62a1('0x23')](handleError(_0x49e9c0,null));}; \ No newline at end of file +var _0x536b=['/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileResource','server/files/templates/trunk.ejs','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','destroy','end','sendStatus','stack','name','send','index','Trunk','rawAttributes','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','includeAll','show','params','keys','length','include','options','find','clone','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','utf8','join','server/files/templates/registry.ejs','render','writeFileSync'];(function(_0x110212,_0x3fa4c2){var _0x233d8b=function(_0x347792){while(--_0x347792){_0x110212['push'](_0x110212['shift']());}};_0x233d8b(++_0x3fa4c2);}(_0x536b,0x15d));var _0xb536=function(_0x219987,_0x2eccf6){_0x219987=_0x219987-0x0;var _0xfe118=_0x536b[_0x219987];return _0xfe118;};'use strict';var emlformat=require(_0xb536('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb536('0x1'));var jsonpatch=require(_0xb536('0x2'));var rp=require(_0xb536('0x3'));var moment=require(_0xb536('0x4'));var BPromise=require(_0xb536('0x5'));var Mustache=require(_0xb536('0x6'));var util=require(_0xb536('0x7'));var path=require(_0xb536('0x8'));var sox=require(_0xb536('0x9'));var csv=require(_0xb536('0xa'));var ejs=require(_0xb536('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb536('0xc'));var squel=require(_0xb536('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb536('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb536('0xf'));var Papa=require(_0xb536('0x10'));var Redis=require(_0xb536('0x11'));var authService=require(_0xb536('0x12'));var qs=require(_0xb536('0x13'));var as=require(_0xb536('0x14'));var hardwareService=require(_0xb536('0x15'));var logger=require(_0xb536('0x16'))(_0xb536('0x17'));var utils=require('../../config/utils');var config=require(_0xb536('0x18'));var licenseUtil=require(_0xb536('0x19'));var db=require(_0xb536('0x1a'))['db'];var jayson=require(_0xb536('0x1b'));var client=jayson[_0xb536('0x1c')][_0xb536('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x31c95a,_0x9f173,_0x140edb,_0x22f63c){return new BPromise(function(_0x48cb87,_0x359ed1){var _0x765144=_0x22f63c||client;return _0x765144['request'](_0x31c95a,_0x140edb)[_0xb536('0x1e')](function(_0x3eceae){logger[_0xb536('0x1f')]('Trunk,\x20%s,\x20%s',_0x9f173,_0xb536('0x20'));logger[_0xb536('0x21')](_0xb536('0x22'),_0x9f173,_0xb536('0x20'),JSON[_0xb536('0x23')](_0x3eceae));if(_0x3eceae['error']){if(_0x3eceae['error'][_0xb536('0x24')]===0x1f4){logger['error'](_0xb536('0x25'),_0x9f173,_0x3eceae[_0xb536('0x26')]['message']);return _0x359ed1(_0x3eceae[_0xb536('0x26')][_0xb536('0x27')]);}logger[_0xb536('0x26')]('Trunk,\x20%s,\x20%s',_0x9f173,_0x3eceae[_0xb536('0x26')][_0xb536('0x27')]);return _0x48cb87(_0x3eceae[_0xb536('0x26')]['message']);}else{logger['info'](_0xb536('0x25'),_0x9f173,_0xb536('0x20'));_0x48cb87(_0x3eceae['result'][_0xb536('0x27')]);}})[_0xb536('0x28')](function(_0x5d93a8){logger[_0xb536('0x26')](_0xb536('0x25'),_0x9f173,_0x5d93a8);_0x359ed1(_0x5d93a8);});});}function respondWithStatusCode(_0x1a9a19,_0x333349){_0x333349=_0x333349||0xcc;return function(_0x35278c){if(_0x35278c){return _0x1a9a19['sendStatus'](_0x333349);}return _0x1a9a19['status'](_0x333349)['end']();};}function respondWithResult(_0x18c5c6,_0xa07a59){_0xa07a59=_0xa07a59||0xc8;return function(_0x3873fd){if(_0x3873fd){return _0x18c5c6[_0xb536('0x29')](_0xa07a59)[_0xb536('0x2a')](_0x3873fd);}};}function respondWithFilteredResult(_0x84503e,_0x469da7){return function(_0x158a49){if(_0x158a49){var _0xe457b7=typeof _0x469da7[_0xb536('0x2b')]===_0xb536('0x2c')&&typeof _0x469da7[_0xb536('0x2d')]==='undefined';var _0x408f19=_0x158a49['count'];var _0x531867=_0xe457b7?0x0:_0x469da7[_0xb536('0x2b')];var _0x1396ec=_0xe457b7?_0x158a49[_0xb536('0x2e')]:_0x469da7[_0xb536('0x2b')]+_0x469da7[_0xb536('0x2d')];var _0x3624c9;if(_0x1396ec>=_0x408f19){_0x1396ec=_0x408f19;_0x3624c9=0xc8;}else{_0x3624c9=0xce;}_0x84503e[_0xb536('0x29')](_0x3624c9);return _0x84503e[_0xb536('0x2f')](_0xb536('0x30'),_0x531867+'-'+_0x1396ec+'/'+_0x408f19)['json'](_0x158a49);}return null;};}function patchUpdates(_0x3bebbc){return function(_0x10e6f4){try{jsonpatch[_0xb536('0x31')](_0x10e6f4,_0x3bebbc,!![]);}catch(_0x5214e0){return BPromise[_0xb536('0x32')](_0x5214e0);}return _0x10e6f4[_0xb536('0x33')]();};}function saveUpdates(_0x79b24d,_0x372e1c){return function(_0x2fc4ad){if(_0x2fc4ad){return _0x2fc4ad[_0xb536('0x34')](_0x79b24d)[_0xb536('0x1e')](function(_0x19facc){return _0x19facc;});}return null;};}function removeEntity(_0x2bb430,_0x45178a){return function(_0x45dcd2){if(_0x45dcd2){return _0x45dcd2['destroy']()['then'](function(){var _0xa5b60c=_0x45dcd2[_0xb536('0x35')]({'plain':!![]});var _0x355015=_0xb536('0x36');return db['UserProfileResource'][_0xb536('0x37')]({'where':{'type':_0x355015,'resourceId':_0xa5b60c['id']}})['then'](function(){return _0x45dcd2;});})[_0xb536('0x1e')](function(){_0x2bb430[_0xb536('0x29')](0xcc)[_0xb536('0x38')]();});}};}function handleEntityNotFound(_0x3eedee,_0x48eff7){return function(_0x59cdac){if(!_0x59cdac){_0x3eedee[_0xb536('0x39')](0x194);}return _0x59cdac;};}function handleError(_0x131d23,_0x550328){_0x550328=_0x550328||0x1f4;return function(_0x5b56d9){logger[_0xb536('0x26')](_0x5b56d9[_0xb536('0x3a')]);if(_0x5b56d9[_0xb536('0x3b')]){delete _0x5b56d9[_0xb536('0x3b')];}_0x131d23[_0xb536('0x29')](_0x550328)[_0xb536('0x3c')](_0x5b56d9);};}exports[_0xb536('0x3d')]=function(_0x33abf7,_0x48c241){var _0x3e20a1={},_0x707930={},_0xd1dc81={'count':0x0,'rows':[]};var _0x32666b=_['map'](db[_0xb536('0x3e')][_0xb536('0x3f')],function(_0x55a240){return{'name':_0x55a240['fieldName'],'type':_0x55a240[_0xb536('0x40')][_0xb536('0x41')]};});_0x707930[_0xb536('0x42')]=_[_0xb536('0x43')](_0x32666b,_0xb536('0x3b'));_0x707930[_0xb536('0x44')]=_['keys'](_0x33abf7[_0xb536('0x44')]);_0x707930['filters']=_[_0xb536('0x45')](_0x707930[_0xb536('0x42')],_0x707930['query']);_0x3e20a1[_0xb536('0x46')]=_[_0xb536('0x45')](_0x707930['model'],qs['fields'](_0x33abf7[_0xb536('0x44')][_0xb536('0x47')]));_0x3e20a1[_0xb536('0x46')]=_0x3e20a1[_0xb536('0x46')]['length']?_0x3e20a1[_0xb536('0x46')]:_0x707930[_0xb536('0x42')];if(!_0x33abf7[_0xb536('0x44')][_0xb536('0x48')](_0xb536('0x49'))){_0x3e20a1[_0xb536('0x2d')]=qs[_0xb536('0x2d')](_0x33abf7[_0xb536('0x44')]['limit']);_0x3e20a1[_0xb536('0x2b')]=qs[_0xb536('0x2b')](_0x33abf7[_0xb536('0x44')][_0xb536('0x2b')]);}_0x3e20a1['order']=qs['sort'](_0x33abf7[_0xb536('0x44')]['sort']);_0x3e20a1[_0xb536('0x4a')]=qs[_0xb536('0x4b')](_[_0xb536('0x4c')](_0x33abf7[_0xb536('0x44')],_0x707930[_0xb536('0x4b')]),_0x32666b);if(_0x33abf7['query'][_0xb536('0x4d')]){_0x3e20a1[_0xb536('0x4a')]=_[_0xb536('0x4e')](_0x3e20a1[_0xb536('0x4a')],{'$or':_[_0xb536('0x43')](_0x32666b,function(_0x343c47){if(_0x343c47[_0xb536('0x40')]!==_0xb536('0x4f')){var _0x2440f4={};_0x2440f4[_0x343c47[_0xb536('0x3b')]]={'$like':'%'+_0x33abf7[_0xb536('0x44')]['filter']+'%'};return _0x2440f4;}})});}_0x3e20a1=_[_0xb536('0x4e')]({},_0x3e20a1,_0x33abf7['options']);var _0x45f4f7={'where':_0x3e20a1[_0xb536('0x4a')]};return db[_0xb536('0x3e')][_0xb536('0x2e')](_0x45f4f7)[_0xb536('0x1e')](function(_0xde9a75){_0xd1dc81[_0xb536('0x2e')]=_0xde9a75;if(_0x33abf7['query'][_0xb536('0x50')]){_0x3e20a1['include']=[{'all':!![]}];}return db['Trunk']['findAll'](_0x3e20a1);})[_0xb536('0x1e')](function(_0x405f1b){_0xd1dc81['rows']=_0x405f1b;return _0xd1dc81;})[_0xb536('0x1e')](respondWithFilteredResult(_0x48c241,_0x3e20a1))[_0xb536('0x28')](handleError(_0x48c241,null));};exports[_0xb536('0x51')]=function(_0x28aafb,_0x494af6){var _0x13418c={'raw':![],'where':{'id':_0x28aafb[_0xb536('0x52')]['id']}},_0x23a0c2={};_0x23a0c2[_0xb536('0x42')]=_['keys'](db['Trunk'][_0xb536('0x3f')]);_0x23a0c2[_0xb536('0x44')]=_[_0xb536('0x53')](_0x28aafb['query']);_0x23a0c2[_0xb536('0x4b')]=_[_0xb536('0x45')](_0x23a0c2[_0xb536('0x42')],_0x23a0c2[_0xb536('0x44')]);_0x13418c['attributes']=_['intersection'](_0x23a0c2[_0xb536('0x42')],qs[_0xb536('0x47')](_0x28aafb[_0xb536('0x44')][_0xb536('0x47')]));_0x13418c['attributes']=_0x13418c[_0xb536('0x46')][_0xb536('0x54')]?_0x13418c[_0xb536('0x46')]:_0x23a0c2[_0xb536('0x42')];if(_0x28aafb[_0xb536('0x44')][_0xb536('0x50')]){_0x13418c[_0xb536('0x55')]=[{'all':!![]}];}_0x13418c=_[_0xb536('0x4e')]({},_0x13418c,_0x28aafb[_0xb536('0x56')]);return db[_0xb536('0x3e')][_0xb536('0x57')](_0x13418c)[_0xb536('0x1e')](handleEntityNotFound(_0x494af6,null))[_0xb536('0x1e')](respondWithResult(_0x494af6,null))[_0xb536('0x28')](handleError(_0x494af6,null));};exports[_0xb536('0x58')]=function(_0x294f23,_0x4d9f8d){var _0x311d9f={'where':{'id':_0x294f23[_0xb536('0x52')]['id']}},_0x149436={};_0x149436[_0xb536('0x42')]=_[_0xb536('0x53')](db[_0xb536('0x3e')][_0xb536('0x3f')]);_0x311d9f['attributes']=_['intersection'](_0x149436[_0xb536('0x42')],qs[_0xb536('0x47')](_0x294f23[_0xb536('0x44')][_0xb536('0x47')]));_0x311d9f['attributes']=_0x311d9f[_0xb536('0x46')][_0xb536('0x54')]?_0x311d9f[_0xb536('0x46')]:_0x149436[_0xb536('0x42')];if(_0x294f23['query'][_0xb536('0x50')]){_0x311d9f[_0xb536('0x55')]=[{'all':!![]}];}_0x311d9f=_[_0xb536('0x4e')]({},_0x311d9f,_0x294f23['options']);return db[_0xb536('0x3e')][_0xb536('0x57')](_0x311d9f)[_0xb536('0x1e')](handleEntityNotFound(_0x4d9f8d,null))[_0xb536('0x1e')](function(_0x454aa8){if(_0x454aa8){var _0x24c1c9=_0x454aa8[_0xb536('0x35')]({'plain':!![]});_0x24c1c9=qs[_0xb536('0x59')](_0x24c1c9,['id',_0xb536('0x5a'),_0xb536('0x5b')]);_0x294f23[_0xb536('0x5c')]=_[_0xb536('0x59')](_0x294f23[_0xb536('0x5c')],['id','createdAt','updatedAt']);return db[_0xb536('0x3e')][_0xb536('0x5d')](_['merge'](_0x24c1c9,_0x294f23[_0xb536('0x5c')]),{'include':_0x294f23[_0xb536('0x44')][_0xb536('0x50')]?[{'all':!![]}]:undefined})['then'](function(_0x45c11a){var _0x4531fd=_0x294f23['user'][_0xb536('0x35')]({'plain':!![]});if(!_0x4531fd)throw new Error(_0xb536('0x5e'));if(_0x4531fd['role']===_0xb536('0x5f')){var _0x108a73=_0x45c11a[_0xb536('0x35')]({'plain':!![]});var _0x4dbdfc=_0xb536('0x36');return db[_0xb536('0x60')]['find']({'where':{'name':_0x4dbdfc,'userProfileId':_0x4531fd[_0xb536('0x61')]},'raw':!![]})['then'](function(_0x1f2795){if(_0x1f2795&&_0x1f2795[_0xb536('0x62')]===0x0){return db['UserProfileResource'][_0xb536('0x5d')]({'name':_0x108a73[_0xb536('0x3b')],'resourceId':_0x108a73['id'],'type':_0x1f2795[_0xb536('0x3b')],'sectionId':_0x1f2795['id']},{})['then'](function(){return _0x45c11a;});}else{return _0x45c11a;}})[_0xb536('0x28')](function(_0x265f47){logger[_0xb536('0x26')](_0xb536('0x63'),_0x265f47);throw _0x265f47;});}return _0x45c11a;});}})[_0xb536('0x1e')](respondWithResult(_0x4d9f8d,0xc9))[_0xb536('0x28')](handleError(_0x4d9f8d,null));};exports[_0xb536('0x5d')]=function(_0x52b7bf,_0xf24c7e,_0x94e1de){var _0x543d5f;return db[_0xb536('0x3e')]['create'](_0x52b7bf['body'],{'raw':!![]})['then'](function(_0x42428d){_0x543d5f=_0x42428d;return db[_0xb536('0x3e')]['findAll']({'raw':!![]});})[_0xb536('0x1e')](function(_0x50d1fe){var _0xd2195a=fs[_0xb536('0x64')](path['join'](config[_0xb536('0x65')],'server/files/templates/trunk.ejs'),_0xb536('0x66'));var _0x29a164=fs[_0xb536('0x64')](path[_0xb536('0x67')](config['root'],_0xb536('0x68')),_0xb536('0x66'));var _0x1c1a2e=ejs[_0xb536('0x69')](_0xd2195a,{'trunks':_0x50d1fe||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x1c1a2e);if(_0x543d5f['registry']){var _0x1e1829=ejs[_0xb536('0x69')](_0x29a164,{'trunks':_0x50d1fe||[]});fs[_0xb536('0x6a')](_0xb536('0x6b'),_0x1e1829);}})[_0xb536('0x1e')](function(){return respondWithRpcPromise(_0xb536('0x6c'),_0xb536('0x5d'),{'module':_0xb536('0x6d')});})[_0xb536('0x1e')](function(){var _0x4f30a7=_0x52b7bf['user'][_0xb536('0x35')]({'plain':!![]});if(!_0x4f30a7)throw new Error(_0xb536('0x5e'));if(_0x4f30a7[_0xb536('0x6e')]===_0xb536('0x5f')){var _0x4fe416=_0x543d5f['get']({'plain':!![]});return db[_0xb536('0x60')][_0xb536('0x57')]({'where':{'name':_0xb536('0x36'),'userProfileId':_0x4f30a7[_0xb536('0x61')]},'raw':!![]})['then'](function(_0x11a83b){if(_0x11a83b&&_0x11a83b[_0xb536('0x62')]===0x0){return db[_0xb536('0x6f')][_0xb536('0x5d')]({'name':_0x4fe416['name'],'resourceId':_0x4fe416['id'],'type':_0x11a83b[_0xb536('0x3b')],'sectionId':_0x11a83b['id']},{})[_0xb536('0x1e')](function(){return _0x543d5f;});}else{return _0x543d5f;}})[_0xb536('0x28')](function(_0x205029){logger[_0xb536('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x205029);throw _0x205029;});}return _0x543d5f;})[_0xb536('0x1e')](respondWithResult(_0xf24c7e,0xc9))[_0xb536('0x28')](handleError(_0xf24c7e,null));};exports[_0xb536('0x34')]=function(_0xd0eddb,_0x50190d,_0x352fee){var _0x3ac3db;return db[_0xb536('0x3e')][_0xb536('0x57')]({'where':{'id':_0xd0eddb[_0xb536('0x52')]['id']}})['then'](handleEntityNotFound(_0x50190d,null))[_0xb536('0x1e')](saveUpdates(_0xd0eddb[_0xb536('0x5c')],null))[_0xb536('0x1e')](function(_0x19d115){if(_0x19d115){_0x3ac3db=_0x19d115;return db[_0xb536('0x3e')]['findAll']({'raw':!![]});}})[_0xb536('0x1e')](function(_0x440cbe){if(_0x440cbe){var _0x14cd73=fs[_0xb536('0x64')](path[_0xb536('0x67')](config[_0xb536('0x65')],_0xb536('0x70')),'utf8');var _0x2ab435=fs[_0xb536('0x64')](path[_0xb536('0x67')](config[_0xb536('0x65')],_0xb536('0x68')),_0xb536('0x66'));var _0x533818=ejs[_0xb536('0x69')](_0x14cd73,{'trunks':_0x440cbe||[]});fs[_0xb536('0x6a')](_0xb536('0x71'),_0x533818);var _0x14b73d=ejs[_0xb536('0x69')](_0x2ab435,{'trunks':_0x440cbe||[]});fs[_0xb536('0x6a')](_0xb536('0x6b'),_0x14b73d);return respondWithRpcPromise('Reload',_0xb536('0x34'),{'module':_0xb536('0x6d')});}return null;})[_0xb536('0x1e')](function(_0x5ba44a){if(_0x5ba44a){return _0x3ac3db;}})['then'](respondWithResult(_0x50190d,null))[_0xb536('0x28')](handleError(_0x50190d,null));};exports[_0xb536('0x37')]=function(_0x46a0b8,_0x31049c,_0x44e1d4){var _0x93dbd;return db[_0xb536('0x3e')]['find']({'where':{'id':_0x46a0b8[_0xb536('0x52')]['id']}})['then'](handleEntityNotFound(_0x31049c,null))[_0xb536('0x1e')](removeEntity(_0x31049c,null))['then'](function(){return db[_0xb536('0x3e')]['findAll']({'raw':!![]});})[_0xb536('0x1e')](function(_0x49dd1d){var _0x175bc8=fs[_0xb536('0x64')](path['join'](config['root'],_0xb536('0x70')),'utf8');var _0x254981=fs[_0xb536('0x64')](path[_0xb536('0x67')](config[_0xb536('0x65')],'server/files/templates/registry.ejs'),_0xb536('0x66'));var _0x2fc678=ejs['render'](_0x175bc8,{'trunks':_0x49dd1d});var _0x2f923a=ejs[_0xb536('0x69')](_0x254981,{'trunks':_0x49dd1d});fs[_0xb536('0x6a')]('/etc/asterisk/sip_xcally_trunks.conf',_0x2fc678);fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2f923a);return respondWithRpcPromise('Reload',_0xb536('0x37'),{'module':'chan_sip.so'});})['catch'](handleError(_0x31049c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index a1ebfc8..f723fbf 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 _0x70a8=['rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5af812,_0x43d252){var _0x1489f2=function(_0x1c7fa9){while(--_0x1c7fa9){_0x5af812['push'](_0x5af812['shift']());}};_0x1489f2(++_0x43d252);}(_0x70a8,0xa0));var _0x870a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x70a8[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x870a('0x0'));var util=require(_0x870a('0x1'));var logger=require(_0x870a('0x2'))(_0x870a('0x3'));var moment=require(_0x870a('0x4'));var BPromise=require(_0x870a('0x5'));var rp=require(_0x870a('0x6'));var fs=require('fs');var path=require(_0x870a('0x7'));var rimraf=require(_0x870a('0x8'));var config=require(_0x870a('0x9'));var attributes=require(_0x870a('0xa'));module[_0x870a('0xb')]=function(_0x489516,_0x4e7696){return _0x489516['define'](_0x870a('0xc'),attributes,{'tableName':_0x870a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9686=['exports','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x9686,0x179));var _0x6968=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9686[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6968('0x0'));var util=require(_0x6968('0x1'));var logger=require(_0x6968('0x2'))(_0x6968('0x3'));var moment=require(_0x6968('0x4'));var BPromise=require(_0x6968('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6968('0x6'));var rimraf=require('rimraf');var config=require(_0x6968('0x7'));var attributes=require('./trunk.attributes');module[_0x6968('0x8')]=function(_0x4b5cbc,_0x4555b7){return _0x4b5cbc['define'](_0x6968('0x9'),attributes,{'tableName':_0x6968('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 1c13917..c8786e0 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 _0x5f66=['debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetTrunk','findAll','options','attributes','limit','include','model','map','ShowTrunk','Trunk','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x5eca91,_0x3fd8be){var _0x466c7c=function(_0x3fbd25){while(--_0x3fbd25){_0x5eca91['push'](_0x5eca91['shift']());}};_0x466c7c(++_0x3fd8be);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Trunk,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['Trunk'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowTrunk',_0x144e55);logger[_0x65f6('0xd')]('ShowTrunk',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowTrunk',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file +var _0x8603=['result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrunk','debug','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x4ef194,_0x46636f){var _0x3f615c=function(_0x5dff96){while(--_0x5dff96){_0x4ef194['push'](_0x4ef194['shift']());}};_0x3f615c(++_0x46636f);}(_0x8603,0x190));var _0x3860=function(_0x251fa4,_0x3d5860){_0x251fa4=_0x251fa4-0x0;var _0x453047=_0x8603[_0x251fa4];return _0x453047;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')]({'raw':_0x45b799['options']?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x17')]||null:null,'attributes':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x18')]||null:null,'limit':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x19')]||null:null,'include':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x45b799['options'][_0x3860('0x1a')],function(_0x133093){return{'model':db[_0x133093[_0x3860('0x1c')]],'as':_0x133093['as'],'attributes':_0x133093[_0x3860('0x18')],'include':_0x133093[_0x3860('0x1a')]?_['map'](_0x133093[_0x3860('0x1a')],function(_0x568515){return{'model':db[_0x568515['model']],'as':_0x568515['as'],'attributes':_0x568515[_0x3860('0x18')],'include':_0x568515[_0x3860('0x1a')]?_['map'](_0x568515['include'],function(_0x5f42d5){return{'model':db[_0x5f42d5[_0x3860('0x1c')]],'as':_0x5f42d5['as'],'attributes':_0x5f42d5[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x371f3a){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger['debug']('GetTrunk',_0x45b799,JSON[_0x3860('0x1d')](_0x371f3a));_0x4863bd(_0x371f3a);})[_0x3860('0x11')](function(_0x5a9af2){logger[_0x3860('0xd')](_0x3860('0x12'),_0x5a9af2[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15[_0x3860('0xd')](0x1f4,_0x5a9af2[_0x3860('0xe')]));});});};exports['ShowTrunk']=function(_0x36ae2b){var _0xf624ba=this;return new Promise(function(_0x367b14,_0x4bd90c){return db[_0x3860('0x13')]['find']({'raw':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['where']||null:null,'attributes':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['attributes']||null:null,'include':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x36ae2b[_0x3860('0x15')][_0x3860('0x1a')],function(_0x30dc2a){return{'model':db[_0x30dc2a[_0x3860('0x1c')]],'as':_0x30dc2a['as'],'attributes':_0x30dc2a[_0x3860('0x18')],'include':_0x30dc2a['include']?_[_0x3860('0x1b')](_0x30dc2a[_0x3860('0x1a')],function(_0x4d62e9){return{'model':db[_0x4d62e9[_0x3860('0x1c')]],'as':_0x4d62e9['as'],'attributes':_0x4d62e9[_0x3860('0x18')],'include':_0x4d62e9[_0x3860('0x1a')]?_['map'](_0x4d62e9['include'],function(_0x285b1b){return{'model':db[_0x285b1b[_0x3860('0x1c')]],'as':_0x285b1b['as'],'attributes':_0x285b1b[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x59271f){logger['info'](_0x3860('0x1e'),_0x36ae2b);logger[_0x3860('0x1f')](_0x3860('0x1e'),_0x36ae2b,JSON[_0x3860('0x1d')](_0x59271f));_0x367b14(_0x59271f);})[_0x3860('0x11')](function(_0x4df2a9){logger[_0x3860('0xd')](_0x3860('0x1e'),_0x4df2a9['message'],_0x36ae2b);_0x4bd90c(_0xf624ba['error'](0x1f4,_0x4df2a9[_0x3860('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 993b0ea..dfb39b8 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 _0xd6d2=['/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getApiKey','post','addContacts','/create_many','bulkCreate','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','/:id/api_key','put','/:id/password','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','/:id/sms_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','/:id/queues_rt','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions'];(function(_0x11d780,_0x26f70c){var _0x25007c=function(_0x3d6987){while(--_0x3d6987){_0x11d780['push'](_0x11d780['shift']());}};_0x25007c(++_0x26f70c);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x1c0c2c,_0x1f9606){_0x1c0c2c=_0x1c0c2c-0x0;var _0x59e86f=_0xd6d2[_0x1c0c2c];return _0x59e86f;};'use strict';var multer=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var path=require('path');var timeout=require(_0x2d6d('0x2'));var express=require(_0x2d6d('0x3'));var router=express['Router']();var fs_extra=require(_0x2d6d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2d6d('0x5'));var config=require(_0x2d6d('0x6'));var controller=require(_0x2d6d('0x7'));router['get']('/',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x9')]);router[_0x2d6d('0xa')](_0x2d6d('0xb'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0xc')]);router[_0x2d6d('0xa')](_0x2d6d('0xd'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0xe')]);router[_0x2d6d('0xa')]('/presence',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0xf')]);router[_0x2d6d('0xa')](_0x2d6d('0x10'),auth[_0x2d6d('0x8')](),controller['show']);router[_0x2d6d('0xa')](_0x2d6d('0x11'),controller[_0x2d6d('0x12')]);router[_0x2d6d('0xa')](_0x2d6d('0x13'),auth['isAuthenticated'](),controller[_0x2d6d('0x14')]);router[_0x2d6d('0xa')](_0x2d6d('0x15'),auth[_0x2d6d('0x8')](),controller['getContacts']);router[_0x2d6d('0xa')](_0x2d6d('0x16'),auth['isAuthenticated'](),controller['getQueues']);router[_0x2d6d('0xa')](_0x2d6d('0x17'),auth[_0x2d6d('0x8')](),controller['getVoiceQueuesRt']);router[_0x2d6d('0xa')]('/:id/groups',auth['isAuthenticated'](),controller['getGroups']);router[_0x2d6d('0xa')](_0x2d6d('0x18'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x19')]);router[_0x2d6d('0xa')](_0x2d6d('0x1a'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x1b')]);router[_0x2d6d('0xa')]('/:id/chat/interactions',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x1c')]);router['get'](_0x2d6d('0x1d'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x1e')]);router[_0x2d6d('0xa')](_0x2d6d('0x1f'),auth[_0x2d6d('0x8')](),controller['getMailInteractions']);router[_0x2d6d('0xa')](_0x2d6d('0x20'),auth[_0x2d6d('0x8')](),controller['getSmsInteractions']);router['get'](_0x2d6d('0x21'),auth['isAuthenticated'](),controller['getFaxInteractions']);router['get'](_0x2d6d('0x22'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x23')]);router[_0x2d6d('0xa')](_0x2d6d('0x24'),auth['isAuthenticated'](),controller[_0x2d6d('0x25')]);router[_0x2d6d('0xa')](_0x2d6d('0x26'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x27')]);router[_0x2d6d('0xa')](_0x2d6d('0x28'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x29')]);router['get'](_0x2d6d('0x2a'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x2b')]);router[_0x2d6d('0xa')]('/:id/fax_accounts',auth[_0x2d6d('0x8')](),controller['getFaxAccounts']);router[_0x2d6d('0xa')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x2d6d('0x2c')]);router['get'](_0x2d6d('0x2d'),auth[_0x2d6d('0x8')](),controller['getOpenchannelAccounts']);router[_0x2d6d('0xa')]('/:id/sms_accounts',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x2e')]);router[_0x2d6d('0xa')](_0x2d6d('0x2f'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x30')]);router[_0x2d6d('0xa')](_0x2d6d('0x31'),auth['isAuthenticated'](),controller[_0x2d6d('0x32')]);router[_0x2d6d('0xa')]('/:id/square_projects',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x33')]);router[_0x2d6d('0xa')](_0x2d6d('0x34'),auth[_0x2d6d('0x8')](),controller['getScheduledCalls']);router['get']('/:id/api_key',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x35')]);router[_0x2d6d('0x36')]('/:id/contacts',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x37')]);router[_0x2d6d('0x36')]('/',auth[_0x2d6d('0x8')](),controller['create']);router[_0x2d6d('0x36')](_0x2d6d('0x38'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x39')]);router[_0x2d6d('0x36')](_0x2d6d('0x16'),auth[_0x2d6d('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0x2d6d('0x3a')]({'destination':function(_0x9b47f8,_0x134388,_0x3d4723){_0x3d4723(null,path[_0x2d6d('0x3b')](config['root'],_0x2d6d('0x3c')));},'filename':function(_0x10efc8,_0x352ca9,_0x4616df){_0x4616df(null,util[_0x2d6d('0x3d')](_0x2d6d('0x3e'),Date[_0x2d6d('0x3f')](),_0x352ca9[_0x2d6d('0x40')]));}})});router[_0x2d6d('0x36')](_0x2d6d('0x11'),upload[_0x2d6d('0x41')](_0x2d6d('0x42')),controller[_0x2d6d('0x43')]);router[_0x2d6d('0x36')](_0x2d6d('0x44'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x45')]);router['post'](_0x2d6d('0x46'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x47')]);router[_0x2d6d('0x36')](_0x2d6d('0x48'),auth['isAuthenticated'](),controller[_0x2d6d('0x49')]);router[_0x2d6d('0x36')](_0x2d6d('0x4a'),auth[_0x2d6d('0x8')](),controller['unpause']);router[_0x2d6d('0x36')](_0x2d6d('0x24'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x4b')]);router[_0x2d6d('0x36')]('/:id/chat_interactions',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x4c')]);router['post'](_0x2d6d('0x4d'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x4e')]);router['post'](_0x2d6d('0x4f'),auth[_0x2d6d('0x8')](),controller['addFaxInteractions']);router['post']('/:id/sms_interactions',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x50')]);router['post'](_0x2d6d('0x51'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x52')]);router[_0x2d6d('0x36')]('/:id/whatsapp_interactions',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x53')]);router['post'](_0x2d6d('0x54'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x55')]);router[_0x2d6d('0x36')](_0x2d6d('0x56'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x57')]);router['post'](_0x2d6d('0x2d'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x58')]);router['post']('/:id/sms_accounts',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x59')]);router[_0x2d6d('0x36')]('/:id/chat_websites',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x5a')]);router['post'](_0x2d6d('0x31'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x5b')]);router[_0x2d6d('0x36')](_0x2d6d('0x5c'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x5d')]);router[_0x2d6d('0x36')](_0x2d6d('0x5e'),auth[_0x2d6d('0x8')](),controller['createApiKey']);router[_0x2d6d('0x5f')](_0x2d6d('0x10'),auth[_0x2d6d('0x8')](),controller['update']);router[_0x2d6d('0x5f')](_0x2d6d('0x60'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x61')]);router[_0x2d6d('0x62')](_0x2d6d('0x16'),auth[_0x2d6d('0x8')](),controller['removeQueues']);router[_0x2d6d('0x62')](_0x2d6d('0x24'),auth['isAuthenticated'](),controller[_0x2d6d('0x63')]);router[_0x2d6d('0x62')]('/:id',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x64')]);router['delete'](_0x2d6d('0x65'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x66')]);router[_0x2d6d('0x62')](_0x2d6d('0x4d'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x67')]);router['delete']('/:id/fax_interactions',auth[_0x2d6d('0x8')](),controller['removeFaxInteractions']);router[_0x2d6d('0x62')](_0x2d6d('0x68'),auth[_0x2d6d('0x8')](),controller['removeSmsInteractions']);router[_0x2d6d('0x62')]('/:id/openchannel_interactions',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x69')]);router[_0x2d6d('0x62')](_0x2d6d('0x6a'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x6b')]);router[_0x2d6d('0x62')](_0x2d6d('0x54'),auth['isAuthenticated'](),controller[_0x2d6d('0x6c')]);router[_0x2d6d('0x62')](_0x2d6d('0x56'),auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete'](_0x2d6d('0x2d'),auth['isAuthenticated'](),controller[_0x2d6d('0x6d')]);router[_0x2d6d('0x62')](_0x2d6d('0x6e'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x6f')]);router[_0x2d6d('0x62')]('/:id/chat_websites',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x70')]);router[_0x2d6d('0x62')](_0x2d6d('0x31'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x71')]);router['delete'](_0x2d6d('0x5c'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x72')]);router[_0x2d6d('0x62')]('/:id/api_key',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x73')]);module[_0x2d6d('0x74')]=router; \ No newline at end of file +var _0x9491=['/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','bulkCreate','addQueues','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','/:id/password','changePassword','removeQueues','delete','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getWhatsappInteractions'];(function(_0x36b8be,_0x13fad7){var _0x59a68f=function(_0x5b4542){while(--_0x5b4542){_0x36b8be['push'](_0x36b8be['shift']());}};_0x59a68f(++_0x13fad7);}(_0x9491,0xb6));var _0x1949=function(_0x480a3b,_0x29630e){_0x480a3b=_0x480a3b-0x0;var _0x1815cf=_0x9491[_0x480a3b];return _0x1815cf;};'use strict';var multer=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var path=require(_0x1949('0x2'));var timeout=require(_0x1949('0x3'));var express=require(_0x1949('0x4'));var router=express[_0x1949('0x5')]();var fs_extra=require(_0x1949('0x6'));var auth=require(_0x1949('0x7'));var interaction=require(_0x1949('0x8'));var config=require(_0x1949('0x9'));var controller=require('./user.controller');router[_0x1949('0xa')]('/',auth['isAuthenticated'](),controller[_0x1949('0xb')]);router[_0x1949('0xa')]('/describe',auth[_0x1949('0xc')](),controller[_0x1949('0xd')]);router[_0x1949('0xa')](_0x1949('0xe'),auth[_0x1949('0xc')](),controller[_0x1949('0xf')]);router[_0x1949('0xa')](_0x1949('0x10'),auth[_0x1949('0xc')](),controller[_0x1949('0x11')]);router[_0x1949('0xa')]('/:id',auth[_0x1949('0xc')](),controller[_0x1949('0x12')]);router[_0x1949('0xa')](_0x1949('0x13'),controller[_0x1949('0x14')]);router[_0x1949('0xa')]('/:id/open_tabs',auth[_0x1949('0xc')](),controller['getOpenTabs']);router['get'](_0x1949('0x15'),auth[_0x1949('0xc')](),controller[_0x1949('0x16')]);router['get'](_0x1949('0x17'),auth[_0x1949('0xc')](),controller[_0x1949('0x18')]);router['get']('/:id/queues_rt',auth[_0x1949('0xc')](),controller[_0x1949('0x19')]);router[_0x1949('0xa')]('/:id/groups',auth[_0x1949('0xc')](),controller[_0x1949('0x1a')]);router['get'](_0x1949('0x1b'),auth[_0x1949('0xc')](),controller[_0x1949('0x1c')]);router[_0x1949('0xa')](_0x1949('0x1d'),auth[_0x1949('0xc')](),controller[_0x1949('0x1e')]);router[_0x1949('0xa')](_0x1949('0x1f'),auth['isAuthenticated'](),controller[_0x1949('0x20')]);router['get']('/:id/openchannel/interactions',auth[_0x1949('0xc')](),controller['getOpenchannelInteractions']);router[_0x1949('0xa')](_0x1949('0x21'),auth['isAuthenticated'](),controller[_0x1949('0x22')]);router['get'](_0x1949('0x23'),auth[_0x1949('0xc')](),controller[_0x1949('0x24')]);router[_0x1949('0xa')]('/:id/fax/interactions',auth[_0x1949('0xc')](),controller['getFaxInteractions']);router[_0x1949('0xa')]('/:id/whatsapp/interactions',auth[_0x1949('0xc')](),controller[_0x1949('0x25')]);router['get'](_0x1949('0x26'),auth['isAuthenticated'](),controller[_0x1949('0x27')]);router[_0x1949('0xa')](_0x1949('0x28'),auth[_0x1949('0xc')](),controller['getLists']);router['get'](_0x1949('0x29'),auth[_0x1949('0xc')](),controller[_0x1949('0x2a')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0x1949('0x2b')]);router['get']('/:id/fax_accounts',auth[_0x1949('0xc')](),controller[_0x1949('0x2c')]);router[_0x1949('0xa')](_0x1949('0x2d'),auth[_0x1949('0xc')](),controller[_0x1949('0x2e')]);router[_0x1949('0xa')](_0x1949('0x2f'),auth['isAuthenticated'](),controller[_0x1949('0x30')]);router['get'](_0x1949('0x31'),auth[_0x1949('0xc')](),controller['getSmsAccounts']);router[_0x1949('0xa')](_0x1949('0x32'),auth[_0x1949('0xc')](),controller[_0x1949('0x33')]);router[_0x1949('0xa')](_0x1949('0x34'),auth[_0x1949('0xc')](),controller[_0x1949('0x35')]);router['get'](_0x1949('0x36'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0x1949('0xa')](_0x1949('0x37'),auth[_0x1949('0xc')](),controller[_0x1949('0x38')]);router[_0x1949('0xa')](_0x1949('0x39'),auth[_0x1949('0xc')](),controller[_0x1949('0x3a')]);router[_0x1949('0x3b')](_0x1949('0x15'),auth[_0x1949('0xc')](),controller[_0x1949('0x3c')]);router[_0x1949('0x3b')]('/',auth[_0x1949('0xc')](),controller['create']);router[_0x1949('0x3b')]('/create_many',auth[_0x1949('0xc')](),controller[_0x1949('0x3d')]);router[_0x1949('0x3b')]('/:id/queues',auth[_0x1949('0xc')](),controller[_0x1949('0x3e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4a4c60,_0x1a0d67,_0x109873){_0x109873(null,path[_0x1949('0x3f')](config[_0x1949('0x40')],_0x1949('0x41')));},'filename':function(_0x1c777a,_0xc66db1,_0x412855){_0x412855(null,util[_0x1949('0x42')](_0x1949('0x43'),Date[_0x1949('0x44')](),_0xc66db1[_0x1949('0x45')]));}})});router[_0x1949('0x3b')](_0x1949('0x13'),upload[_0x1949('0x46')](_0x1949('0x47')),controller['addAvatar']);router['post'](_0x1949('0x48'),auth[_0x1949('0xc')](),controller[_0x1949('0x49')]);router[_0x1949('0x3b')](_0x1949('0x4a'),auth[_0x1949('0xc')](),controller[_0x1949('0x4b')]);router[_0x1949('0x3b')](_0x1949('0x4c'),auth['isAuthenticated'](),controller['pause']);router['post'](_0x1949('0x4d'),auth[_0x1949('0xc')](),controller[_0x1949('0x4e')]);router[_0x1949('0x3b')](_0x1949('0x26'),auth[_0x1949('0xc')](),controller[_0x1949('0x4f')]);router[_0x1949('0x3b')](_0x1949('0x50'),auth['isAuthenticated'](),controller[_0x1949('0x51')]);router['post'](_0x1949('0x52'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x1949('0x3b')](_0x1949('0x53'),auth[_0x1949('0xc')](),controller['addFaxInteractions']);router[_0x1949('0x3b')](_0x1949('0x54'),auth[_0x1949('0xc')](),controller['addSmsInteractions']);router['post'](_0x1949('0x55'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0x1949('0x3b')](_0x1949('0x56'),auth[_0x1949('0xc')](),controller[_0x1949('0x57')]);router['post']('/:id/fax_accounts',auth[_0x1949('0xc')](),controller['addFaxAccounts']);router[_0x1949('0x3b')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x1949('0x58')]);router[_0x1949('0x3b')](_0x1949('0x2f'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x1949('0x3b')](_0x1949('0x31'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x1949('0x3b')](_0x1949('0x32'),auth[_0x1949('0xc')](),controller[_0x1949('0x59')]);router[_0x1949('0x3b')](_0x1949('0x34'),auth[_0x1949('0xc')](),controller[_0x1949('0x5a')]);router[_0x1949('0x3b')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x1949('0x5b')]);router['post']('/:id/api_key',auth[_0x1949('0xc')](),controller[_0x1949('0x5c')]);router[_0x1949('0x5d')](_0x1949('0x5e'),auth[_0x1949('0xc')](),controller['update']);router[_0x1949('0x5d')](_0x1949('0x5f'),auth[_0x1949('0xc')](),controller[_0x1949('0x60')]);router['delete'](_0x1949('0x17'),auth[_0x1949('0xc')](),controller[_0x1949('0x61')]);router[_0x1949('0x62')](_0x1949('0x26'),auth[_0x1949('0xc')](),controller[_0x1949('0x63')]);router[_0x1949('0x62')](_0x1949('0x5e'),auth[_0x1949('0xc')](),controller['destroy']);router[_0x1949('0x62')](_0x1949('0x50'),auth['isAuthenticated'](),controller[_0x1949('0x64')]);router['delete'](_0x1949('0x52'),auth['isAuthenticated'](),controller[_0x1949('0x65')]);router['delete'](_0x1949('0x53'),auth[_0x1949('0xc')](),controller[_0x1949('0x66')]);router[_0x1949('0x62')](_0x1949('0x54'),auth['isAuthenticated'](),controller[_0x1949('0x67')]);router[_0x1949('0x62')](_0x1949('0x55'),auth[_0x1949('0xc')](),controller['removeOpenchannelInteractions']);router[_0x1949('0x62')](_0x1949('0x56'),auth[_0x1949('0xc')](),controller['removeWhatsappInteractions']);router[_0x1949('0x62')]('/:id/fax_accounts',auth[_0x1949('0xc')](),controller[_0x1949('0x68')]);router['delete']('/:id/mail_accounts',auth[_0x1949('0xc')](),controller['removeMailAccounts']);router[_0x1949('0x62')](_0x1949('0x2f'),auth[_0x1949('0xc')](),controller[_0x1949('0x69')]);router['delete'](_0x1949('0x31'),auth[_0x1949('0xc')](),controller[_0x1949('0x6a')]);router[_0x1949('0x62')](_0x1949('0x32'),auth[_0x1949('0xc')](),controller[_0x1949('0x6b')]);router[_0x1949('0x62')]('/:id/whatsapp_accounts',auth[_0x1949('0xc')](),controller['removeWhatsappAccounts']);router['delete']('/:id/square_projects',auth[_0x1949('0xc')](),controller['removeSquareProjects']);router['delete'](_0x1949('0x39'),auth[_0x1949('0xc')](),controller[_0x1949('0x6c')]);module[_0x1949('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index ac6c533..5494fd6 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 _0x9eb5=['internal','email','ENUM','user','telephone','local','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','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','split','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','encryption','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue'];(function(_0x50ca21,_0x530d37){var _0x375487=function(_0x32d336){while(--_0x32d336){_0x50ca21['push'](_0x50ca21['shift']());}};_0x375487(++_0x530d37);}(_0x9eb5,0x15f));var _0x59eb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9eb5[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x59eb('0x0'));var util=require(_0x59eb('0x1'));var _=require(_0x59eb('0x2'));module[_0x59eb('0x3')]={'name':{'type':Sequelize[_0x59eb('0x4')],'allowNull':![],'unique':_0x59eb('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5afddf){this[_0x59eb('0x6')](_0x59eb('0x5'),_0x5afddf);this['setDataValue'](_0x59eb('0x7'),_0x5afddf);},'comment':_0x59eb('0x8')},'fullname':{'type':Sequelize[_0x59eb('0x4')],'allowNull':![],'set':function(_0x18843c){this[_0x59eb('0x6')](_0x59eb('0x9'),_0x18843c);this['setDataValue'](_0x59eb('0xa'),util['format'](_0x59eb('0xb'),_0x18843c,this[_0x59eb('0xc')](_0x59eb('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x59eb('0xe'),'validate':{'isEmail':!![]},'set':function(_0x39f5a7){if(_0x39f5a7){this[_0x59eb('0x6')](_0x59eb('0xe'),_0x39f5a7['toLowerCase']());}}},'role':{'type':Sequelize[_0x59eb('0xf')]('admin',_0x59eb('0x10'),'agent',_0x59eb('0x11')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x59eb('0x4')],'defaultValue':_0x59eb('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x59eb('0xd'),'set':function(_0x204b78){this[_0x59eb('0x6')](_0x59eb('0xd'),_0x204b78);this[_0x59eb('0x6')](_0x59eb('0x13'),_0x204b78);this[_0x59eb('0x6')](_0x59eb('0xa'),util['format'](_0x59eb('0xb'),this[_0x59eb('0xc')](_0x59eb('0x9')),_0x204b78));}},'salt':{'type':Sequelize[_0x59eb('0x4')]},'phone':{'type':Sequelize[_0x59eb('0x4')]},'mobile':{'type':Sequelize[_0x59eb('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x59eb('0x4')]},'userpic':{'type':Sequelize[_0x59eb('0x4')]},'city':{'type':Sequelize[_0x59eb('0x4')]},'country':{'type':Sequelize[_0x59eb('0x4')]},'online':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x59eb('0x15')]},'voicePause':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x59eb('0x4')],'defaultValue':_0x59eb('0x16')},'lastPauseAt':{'type':Sequelize[_0x59eb('0x15')]},'chatCapacity':{'type':Sequelize[_0x59eb('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x59eb('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x59eb('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x59eb('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x59eb('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x59eb('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![],'defaultValue':_0x59eb('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x19'),'user',_0x59eb('0x1a')),'allowNull':!![],'defaultValue':_0x59eb('0x19')},'context':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x1b'),_0x59eb('0x1c'),_0x59eb('0x1d'),_0x59eb('0x1e'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x59eb('0x1f'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![],'defaultValue':_0x59eb('0x20'),'set':function(_0x20cf06){this['setDataValue']('transport',_0x20cf06?_0x20cf06[_0x59eb('0x21')](','):null);},'get':function(){return this[_0x59eb('0xc')](_0x59eb('0x22'))?this[_0x59eb('0xc')](_0x59eb('0x22'))['split'](','):null;},'comment':_0x59eb('0x23')},'dtmfmode':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x24'),_0x59eb('0x25'),_0x59eb('0x26'),'inband',_0x59eb('0x27')),'allowNull':!![],'defaultValue':_0x59eb('0x24')},'directmedia':{'type':Sequelize['ENUM'](_0x59eb('0x28'),'no',_0x59eb('0x29'),_0x59eb('0x2a'),_0x59eb('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![],'defaultValue':_0x59eb('0x2c'),'set':function(_0x1b4b7e){this[_0x59eb('0x6')]('nat',_0x1b4b7e?_0x1b4b7e[_0x59eb('0x21')](','):null);},'get':function(){return this[_0x59eb('0xc')](_0x59eb('0x2d'))?this[_0x59eb('0xc')](_0x59eb('0x2d'))['split'](','):null;},'comment':_0x59eb('0x2e')},'callgroup':{'type':Sequelize[_0x59eb('0x4')]},'namedcallgroup':{'type':Sequelize[_0x59eb('0x4')]},'pickupgroup':{'type':Sequelize[_0x59eb('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x59eb('0x4')]},'language':{'type':Sequelize[_0x59eb('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x59eb('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x59eb('0x4')],'allowNull':![],'defaultValue':_0x59eb('0x2f'),'set':function(_0x123cc2){this['setDataValue'](_0x59eb('0x30'),_0x123cc2?_0x123cc2[_0x59eb('0x21')](';'):_0x59eb('0x2f'));},'get':function(){return this[_0x59eb('0xc')](_0x59eb('0x30'))?this[_0x59eb('0xc')](_0x59eb('0x30'))[_0x59eb('0x31')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x59eb('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![],'set':function(_0xe536fd){this[_0x59eb('0x6')](_0x59eb('0x32'),_0xe536fd?_0xe536fd[_0x59eb('0x21')](','):null);},'get':function(){return this[_0x59eb('0xc')](_0x59eb('0x32'))?this['getDataValue'](_0x59eb('0x32'))['split'](','):null;},'comment':_0x59eb('0x33')},'trustrpid':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x59eb('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x59eb('0xf')]('yes','no',_0x59eb('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x59eb('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![],'defaultValue':_0x59eb('0x35')},'amaflags':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![],'defaultValue':_0x59eb('0x28')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x59eb('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x59eb('0x28'),'no',_0x59eb('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x59eb('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x37'),_0x59eb('0x38'),_0x59eb('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x59eb('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x59eb('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x3a'),_0x59eb('0x3b')),'allowNull':!![],'defaultValue':_0x59eb('0x3b')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![],'defaultValue':_0x59eb('0x28')},'keepalive':{'type':Sequelize[_0x59eb('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x59eb('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x59eb('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x59eb('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x59eb('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x59eb('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x59eb('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x59eb('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x59eb('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x59eb('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x59eb('0x28'),'no','fingerprint',_0x59eb('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x59eb('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x59eb('0x3d'),_0x59eb('0x3e'),_0x59eb('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x59eb('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x59eb('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x59eb('0xf')]('yes','no','nonat',_0x59eb('0x2a'),_0x59eb('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x59eb('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x59eb('0x15')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x59eb('0x41')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x5802d3){this[_0x59eb('0x6')](_0x59eb('0x42'),_0x5802d3);var _0x5c254c=this[_0x59eb('0x43')]({'plain':!![]});switch(_0x5802d3){case 0x0:case 0x1:var _0x56ec3c=_0x5c254c['transport']?_[_0x59eb('0x44')](_0x5c254c[_0x59eb('0x22')])?_0x5c254c['transport'][_0x59eb('0x21')]():_0x5c254c[_0x59eb('0x22')]:_0x59eb('0x20');if(_0x56ec3c===_0x59eb('0x45')){_0x56ec3c='udp';}this['setDataValue'](_0x59eb('0x22'),_0x56ec3c);this[_0x59eb('0x6')]('encryption','no');this[_0x59eb('0x6')](_0x59eb('0x46'),null);this[_0x59eb('0x6')](_0x59eb('0x47'),null);this[_0x59eb('0x6')]('icesupport',null);this[_0x59eb('0x6')](_0x59eb('0x48'),null);this[_0x59eb('0x6')](_0x59eb('0x49'),null);this[_0x59eb('0x6')](_0x59eb('0x4a'),null);this[_0x59eb('0x6')]('dtlscertfile',null);this[_0x59eb('0x6')](_0x59eb('0x4b'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x59eb('0x22'),_0x59eb('0x45'));this[_0x59eb('0x6')](_0x59eb('0x4c'),'yes');this[_0x59eb('0x6')]('avpf','yes');this['setDataValue'](_0x59eb('0x47'),_0x59eb('0x28'));this[_0x59eb('0x6')]('icesupport',_0x59eb('0x28'));this[_0x59eb('0x6')]('dtlsenable',_0x59eb('0x28'));this['setDataValue'](_0x59eb('0x49'),'no');this[_0x59eb('0x6')](_0x59eb('0x4a'),_0x59eb('0x3f'));this[_0x59eb('0x6')](_0x59eb('0x4d'),_0x5c254c[_0x59eb('0x4d')]||_0x59eb('0x4e'));this['setDataValue']('dtlsprivatekey',_0x5c254c[_0x59eb('0x4b')]||_0x59eb('0x4f'));this['setDataValue'](_0x59eb('0x50'),_0x59eb('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x59eb('0x41')],'set':function(_0x4e9581){this['setDataValue']('permissions',_0x4e9581?_0x4e9581['join'](','):[]);},'get':function(){return this[_0x59eb('0xc')](_0x59eb('0x51'))?_[_0x59eb('0x52')](this[_0x59eb('0xc')](_0x59eb('0x51'))[_0x59eb('0x31')](','),function(_0x4256d7){return parseInt(_0x4256d7,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x59eb('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x59eb('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x59eb('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x59eb('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x59eb('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x59eb('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x59eb('0xf')](_0x59eb('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x59eb('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x59eb('0x53')],'get':function(){return this[_0x59eb('0xc')](_0x59eb('0x54'))?this['getDataValue'](_0x59eb('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x59eb('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3b7287){if(typeof _0x3b7287==='string'){var _0x4f26d7=_0x3b7287==='1'?!![]:_0x3b7287==='0'?![]:_0x3b7287===_0x59eb('0x55')?!![]:_0x3b7287===_0x59eb('0x56')?![]:![];this[_0x59eb('0x6')]('screenrecording',_0x4f26d7);}else{this[_0x59eb('0x6')](_0x59eb('0x57'),_0x3b7287);}}},'blocked':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![],'set':function(_0x3e0e59){this[_0x59eb('0x6')](_0x59eb('0x58'),_0x3e0e59);if(_0x3e0e59===!![]){this[_0x59eb('0x6')](_0x59eb('0x59'),moment());this[_0x59eb('0x6')]('loginAttempts',0x0);}else{this[_0x59eb('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x59eb('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x59eb('0x17')](0x5)[_0x59eb('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x59eb('0x14')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7c20=['dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','util','lodash','STRING','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','getDataValue','internal','email','toLowerCase','ENUM','agent','local','INTEGER','accountcode','format','\x22%s\x22\x20<%s>','BOOLEAN','dynamic','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','rfc2833','info','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','uas','fingerprint','certificate','active','passive','actpass','update,nonat','DATE','TEXT','showWebBar','get','isArray','wss','avpf','force_avp','icesupport','dtlsenable','dtlssetup','encryption','dtlsverify'];(function(_0x16d06e,_0x4b70c1){var _0x1aba53=function(_0x11008f){while(--_0x11008f){_0x16d06e['push'](_0x16d06e['shift']());}};_0x1aba53(++_0x4b70c1);}(_0x7c20,0x177));var _0x07c2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7c20[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x07c2('0x0'));var moment=require('moment');var util=require(_0x07c2('0x1'));var _=require(_0x07c2('0x2'));module['exports']={'name':{'type':Sequelize[_0x07c2('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xea87a9){this[_0x07c2('0x4')]('name',_0xea87a9);this[_0x07c2('0x4')](_0x07c2('0x5'),_0xea87a9);},'comment':_0x07c2('0x6')},'fullname':{'type':Sequelize[_0x07c2('0x3')],'allowNull':![],'set':function(_0x490d36){this[_0x07c2('0x4')](_0x07c2('0x7'),_0x490d36);this[_0x07c2('0x4')](_0x07c2('0x8'),util['format']('\x22%s\x22\x20<%s>',_0x490d36,this[_0x07c2('0x9')](_0x07c2('0xa'))));}},'alias':{'type':Sequelize[_0x07c2('0x3')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x07c2('0xb'),'validate':{'isEmail':!![]},'set':function(_0x51b9d0){if(_0x51b9d0){this[_0x07c2('0x4')](_0x07c2('0xb'),_0x51b9d0[_0x07c2('0xc')]());}}},'role':{'type':Sequelize[_0x07c2('0xd')]('admin','user',_0x07c2('0xe'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x07c2('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x07c2('0x3')],'defaultValue':_0x07c2('0xf')},'internal':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':![],'unique':_0x07c2('0xa'),'set':function(_0x11b6aa){this['setDataValue'](_0x07c2('0xa'),_0x11b6aa);this[_0x07c2('0x4')](_0x07c2('0x11'),_0x11b6aa);this[_0x07c2('0x4')](_0x07c2('0x8'),util[_0x07c2('0x12')](_0x07c2('0x13'),this[_0x07c2('0x9')](_0x07c2('0x7')),_0x11b6aa));}},'salt':{'type':Sequelize[_0x07c2('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x07c2('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x07c2('0x3')]},'userpic':{'type':Sequelize[_0x07c2('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x07c2('0x3')]},'online':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x07c2('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x07c2('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x07c2('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x07c2('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x07c2('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x07c2('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x07c2('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x07c2('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![],'defaultValue':_0x07c2('0x15')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x07c2('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x16'),_0x07c2('0x17'),_0x07c2('0x18')),'allowNull':!![],'defaultValue':_0x07c2('0x16')},'context':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM'](_0x07c2('0x19'),_0x07c2('0x1a'),_0x07c2('0x1b'),_0x07c2('0x1c'),_0x07c2('0x1d'),_0x07c2('0x1e'),_0x07c2('0x1f'),_0x07c2('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![],'defaultValue':_0x07c2('0x21'),'set':function(_0x3949df){this['setDataValue']('transport',_0x3949df?_0x3949df[_0x07c2('0x22')](','):null);},'get':function(){return this[_0x07c2('0x9')](_0x07c2('0x23'))?this['getDataValue'](_0x07c2('0x23'))[_0x07c2('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x07c2('0x25'),_0x07c2('0x26'),'shortinfo','inband','auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x07c2('0x27'),'no',_0x07c2('0x28'),_0x07c2('0x29'),_0x07c2('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![],'defaultValue':_0x07c2('0x2b'),'set':function(_0x319f1f){this[_0x07c2('0x4')](_0x07c2('0x2c'),_0x319f1f?_0x319f1f['join'](','):null);},'get':function(){return this[_0x07c2('0x9')](_0x07c2('0x2c'))?this[_0x07c2('0x9')](_0x07c2('0x2c'))[_0x07c2('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x07c2('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x07c2('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x07c2('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x07c2('0x3')],'allowNull':![],'defaultValue':_0x07c2('0x2d')},'allow':{'type':Sequelize[_0x07c2('0x3')],'allowNull':![],'defaultValue':_0x07c2('0x2e'),'set':function(_0x46f962){this[_0x07c2('0x4')](_0x07c2('0x2f'),_0x46f962?_0x46f962['join'](';'):_0x07c2('0x2e'));},'get':function(){return this[_0x07c2('0x9')](_0x07c2('0x2f'))?this['getDataValue'](_0x07c2('0x2f'))[_0x07c2('0x24')](';'):null;},'comment':_0x07c2('0x30')},'autoframing':{'type':Sequelize['ENUM'](_0x07c2('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![],'set':function(_0x1a6077){this[_0x07c2('0x4')](_0x07c2('0x31'),_0x1a6077?_0x1a6077['join'](','):null);},'get':function(){return this[_0x07c2('0x9')]('insecure')?this[_0x07c2('0x9')](_0x07c2('0x31'))[_0x07c2('0x24')](','):null;},'comment':_0x07c2('0x32')},'trustrpid':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x07c2('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no',_0x07c2('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x07c2('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![],'defaultValue':_0x07c2('0x34')},'amaflags':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x07c2('0x27'),'no'),'allowNull':!![],'defaultValue':_0x07c2('0x27')},'busylevel':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x07c2('0xd')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x07c2('0x27'),'no',_0x07c2('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x07c2('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x36'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x07c2('0x37')),'allowNull':!![],'defaultValue':_0x07c2('0x37')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x07c2('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x07c2('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x07c2('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x07c2('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no',_0x07c2('0x38'),_0x07c2('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x3a'),_0x07c2('0x3b'),_0x07c2('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x07c2('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x07c2('0x27'),'no',_0x07c2('0x28'),_0x07c2('0x29'),_0x07c2('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x07c2('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x07c2('0x3e')]},'passwordResetAt':{'type':Sequelize[_0x07c2('0x3e')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x07c2('0x3f')]},'showWebBar':{'type':Sequelize[_0x07c2('0x10')],'defaultValue':0x0,'set':function(_0x282329){this[_0x07c2('0x4')](_0x07c2('0x40'),_0x282329);var _0x240128=this[_0x07c2('0x41')]({'plain':!![]});switch(_0x282329){case 0x0:case 0x1:var _0x2e99e4=_0x240128[_0x07c2('0x23')]?_[_0x07c2('0x42')](_0x240128[_0x07c2('0x23')])?_0x240128[_0x07c2('0x23')]['join']():_0x240128['transport']:_0x07c2('0x21');if(_0x2e99e4===_0x07c2('0x43')){_0x2e99e4=_0x07c2('0x21');}this[_0x07c2('0x4')](_0x07c2('0x23'),_0x2e99e4);this[_0x07c2('0x4')]('encryption','no');this[_0x07c2('0x4')](_0x07c2('0x44'),null);this[_0x07c2('0x4')](_0x07c2('0x45'),null);this['setDataValue'](_0x07c2('0x46'),null);this[_0x07c2('0x4')](_0x07c2('0x47'),null);this[_0x07c2('0x4')]('dtlsverify',null);this['setDataValue'](_0x07c2('0x48'),null);this[_0x07c2('0x4')]('dtlscertfile',null);this[_0x07c2('0x4')]('dtlsprivatekey',null);this[_0x07c2('0x4')]('rtcp_mux','no');break;case 0x2:this[_0x07c2('0x4')]('transport',_0x07c2('0x43'));this[_0x07c2('0x4')](_0x07c2('0x49'),'yes');this[_0x07c2('0x4')]('avpf','yes');this[_0x07c2('0x4')](_0x07c2('0x45'),_0x07c2('0x27'));this[_0x07c2('0x4')](_0x07c2('0x46'),_0x07c2('0x27'));this['setDataValue']('dtlsenable','yes');this[_0x07c2('0x4')](_0x07c2('0x4a'),'no');this['setDataValue'](_0x07c2('0x48'),'actpass');this[_0x07c2('0x4')]('dtlscertfile',_0x240128[_0x07c2('0x4b')]||_0x07c2('0x4c'));this[_0x07c2('0x4')](_0x07c2('0x4d'),_0x240128['dtlsprivatekey']||_0x07c2('0x4e'));this[_0x07c2('0x4')]('rtcp_mux',_0x07c2('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0x07c2('0x3f')],'set':function(_0x1173d1){this[_0x07c2('0x4')](_0x07c2('0x4f'),_0x1173d1?_0x1173d1[_0x07c2('0x22')](','):[]);},'get':function(){return this[_0x07c2('0x9')](_0x07c2('0x4f'))?_['map'](this[_0x07c2('0x9')](_0x07c2('0x4f'))[_0x07c2('0x24')](','),function(_0x23feaa){return parseInt(_0x23feaa,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x07c2('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x07c2('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x07c2('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x07c2('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x07c2('0xd')](_0x07c2('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x07c2('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x07c2('0x50')],'get':function(){return this[_0x07c2('0x9')](_0x07c2('0x51'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x07c2('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![],'set':function(_0x3791e9){if(typeof _0x3791e9===_0x07c2('0x52')){var _0x1bbcd9=_0x3791e9==='1'?!![]:_0x3791e9==='0'?![]:_0x3791e9===_0x07c2('0x53')?!![]:_0x3791e9===_0x07c2('0x54')?![]:![];this[_0x07c2('0x4')]('screenrecording',_0x1bbcd9);}else{this[_0x07c2('0x4')](_0x07c2('0x55'),_0x3791e9);}}},'blocked':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![],'set':function(_0x4d161c){this['setDataValue'](_0x07c2('0x56'),_0x4d161c);if(_0x4d161c===!![]){this['setDataValue'](_0x07c2('0x57'),moment());this[_0x07c2('0x4')](_0x07c2('0x58'),0x0);}else{this[_0x07c2('0x4')](_0x07c2('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x07c2('0x3e')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x07c2('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x07c2('0x10')](0x5)[_0x07c2('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x07c2('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'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 d79faa8..65a4c08 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 _0xdecd=['Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','format','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','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','device','PAUSE','concat','LOGININPAUSE','isMiddleware','logout','pause','QueuePause','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','manual','%s%s','Pause','getTeams','Team','getVoiceQueues','setDataValue','Voice','Mail','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','getChatQueues','Chat','getSmsQueues','Fax','removeAgent','online','Queue:remove','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$lte','$eq','$not','$between','$notBetween','$in','$iLike','$notILike','$like','$overlap','$contains','$any','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','resolve','teams','queues','inbound','col','toString','asc','substring','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','unknown','voiceStatus','busy','slice','charAt','QueryTypes','select','field','ui.','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./user.socket','register','jayson/promise','http','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','destroy','get','role','Users','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','find','name','UserProfileResource','stack','send','User','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','sequelize','lower','options','count','includeAll','includes','findAll','rows','openTabs','true','push','chat','dataValues','sms','mail','openchannel','whatsapp','rawAttributes','password','include','fax','body','params','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','104','105','106','107','108','109','100','111','114','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','all','each','isEmpty','oldPassword','newPassword','ValidationError','authenticate','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','channel','loginInPause','isValidChannel','Unknown\x20channel','add','capitalize','spread','toLowerCase','QueueId','voice','VoiceQueue','interface','SIP/%s','voicePause','penalty','UserVoiceQueueRt','upsert','removeQueues','remove','Queues','emit','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','getContacts','CmContact','CmList','List','Tag','Tags','color','tag'];(function(_0x541fe9,_0x459c5f){var _0x4033b8=function(_0x25db63){while(--_0x25db63){_0x541fe9['push'](_0x541fe9['shift']());}};_0x4033b8(++_0x459c5f);}(_0xdecd,0xc5));var _0xddec=function(_0x416ace,_0x475a3c){_0x416ace=_0x416ace-0x0;var _0x474085=_0xdecd[_0x416ace];return _0x474085;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xddec('0x0'));var zipdir=require(_0xddec('0x1'));var jsonpatch=require(_0xddec('0x2'));var rp=require('request-promise');var moment=require(_0xddec('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xddec('0x4'));var util=require(_0xddec('0x5'));var path=require(_0xddec('0x6'));var sox=require(_0xddec('0x7'));var csv=require('to-csv');var ejs=require(_0xddec('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xddec('0x9'));var crypto=require(_0xddec('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xddec('0xb'));var querystring=require(_0xddec('0xc'));var Papa=require(_0xddec('0xd'));var Redis=require(_0xddec('0xe'));var values;var authService=require('../../components/auth/service');var qs=require(_0xddec('0xf'));var as=require(_0xddec('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xddec('0x11'));var config=require(_0xddec('0x12'));var licenseUtil=require(_0xddec('0x13'));var db=require(_0xddec('0x14'))['db'];config[_0xddec('0x15')]=_[_0xddec('0x16')](config['redis'],{'host':_0xddec('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xddec('0x15')]));require(_0xddec('0x18'))[_0xddec('0x19')](socket);var jayson=require(_0xddec('0x1a'));var client=jayson['client'][_0xddec('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x57ea58,_0xd2c445,_0x4abfbc,_0x55a33e){return new BPromise(function(_0xd96ca,_0x2d7f9e){var _0x36f90a=_0x55a33e||client;return _0x36f90a['request'](_0x57ea58,_0x4abfbc)[_0xddec('0x1c')](function(_0x3527cb){logger[_0xddec('0x1d')](_0xddec('0x1e'),_0xd2c445,_0xddec('0x1f'));logger[_0xddec('0x20')]('User,\x20%s,\x20%s,\x20%s',_0xd2c445,'request\x20sent',JSON[_0xddec('0x21')](_0x3527cb));if(_0x3527cb[_0xddec('0x22')]){if(_0x3527cb[_0xddec('0x22')][_0xddec('0x23')]===0x1f4){logger[_0xddec('0x22')](_0xddec('0x1e'),_0xd2c445,_0x3527cb['error'][_0xddec('0x24')]);return _0x2d7f9e(_0x3527cb[_0xddec('0x22')]['message']);}logger[_0xddec('0x22')]('User,\x20%s,\x20%s',_0xd2c445,_0x3527cb['error']['message']);return _0xd96ca(_0x3527cb['error']['message']);}else{logger['info'](_0xddec('0x1e'),_0xd2c445,_0xddec('0x1f'));_0xd96ca(_0x3527cb['result'][_0xddec('0x24')]);}})[_0xddec('0x25')](function(_0x2dc56c){logger[_0xddec('0x22')](_0xddec('0x1e'),_0xd2c445,_0x2dc56c);_0x2d7f9e(_0x2dc56c);});});}function respondWithStatusCode(_0xbf068,_0xcb1eb0){_0xcb1eb0=_0xcb1eb0||0xcc;return function(_0x45b3bf){if(_0x45b3bf){return _0xbf068[_0xddec('0x26')](_0xcb1eb0);}return _0xbf068[_0xddec('0x27')](_0xcb1eb0)[_0xddec('0x28')]();};}function respondWithResult(_0x480cc7,_0x145cab){_0x145cab=_0x145cab||0xc8;return function(_0x373fe9){if(_0x373fe9){return _0x480cc7[_0xddec('0x27')](_0x145cab)[_0xddec('0x29')](_0x373fe9);}};}function respondWithFilteredResult(_0x23f310,_0x44b1c9){return function(_0x59b574){if(_0x59b574){var _0x394772=typeof _0x44b1c9[_0xddec('0x2a')]===_0xddec('0x2b')&&typeof _0x44b1c9[_0xddec('0x2c')]===_0xddec('0x2b');var _0x579c2c=_0x59b574['count'];var _0x469651=_0x394772?0x0:_0x44b1c9[_0xddec('0x2a')];var _0x3d0ad3=_0x394772?_0x59b574['count']:_0x44b1c9[_0xddec('0x2a')]+_0x44b1c9[_0xddec('0x2c')];var _0x5fb0ed;if(_0x3d0ad3>=_0x579c2c){_0x3d0ad3=_0x579c2c;_0x5fb0ed=0xc8;}else{_0x5fb0ed=0xce;}_0x23f310[_0xddec('0x27')](_0x5fb0ed);return _0x23f310[_0xddec('0x2d')]('Content-Range',_0x469651+'-'+_0x3d0ad3+'/'+_0x579c2c)[_0xddec('0x29')](_0x59b574);}return null;};}function patchUpdates(_0x891700){return function(_0x4a837d){try{jsonpatch[_0xddec('0x2e')](_0x4a837d,_0x891700,!![]);}catch(_0x39934b){return BPromise['reject'](_0x39934b);}return _0x4a837d[_0xddec('0x2f')]();};}function saveUpdates(_0x4a35e1,_0x1f1e68){return function(_0x54802c){if(_0x54802c){return _0x54802c[_0xddec('0x30')](_0x4a35e1)[_0xddec('0x1c')](function(_0x5cca58){return _0x5cca58;});}return null;};}function removeEntity(_0x1e3b03,_0x4aab8b){return function(_0x5b3590){if(_0x5b3590){return _0x5b3590[_0xddec('0x31')]()['then'](function(){var _0x1d4fba=_0x5b3590[_0xddec('0x32')]({'plain':!![]});if(_0x1d4fba[_0xddec('0x33')]==='admin')return;var _0x546a73=[{'name':_0xddec('0x34'),'value':_0xddec('0x35'),'ignore':!![]},{'name':_0xddec('0x36'),'value':_0xddec('0x37'),'ignore':![]},{'name':_0xddec('0x38'),'value':_0xddec('0x39'),'ignore':![]}];var _0x59a397=_(_0x546a73)[_0xddec('0x3a')](_0xddec('0x3b'))[_0xddec('0x3c')]('value')[_0xddec('0x3d')]();if(_['includes'](_0x59a397,_0x1d4fba[_0xddec('0x33')])){return;}var _0x43c0ef=_[_0xddec('0x3e')](_0x546a73,[_0xddec('0x3d'),_0x1d4fba['role']])[_0xddec('0x3f')];return db[_0xddec('0x40')]['destroy']({'where':{'type':_0x43c0ef,'resourceId':_0x1d4fba['id']}})[_0xddec('0x1c')](function(){return _0x5b3590;});})[_0xddec('0x1c')](function(){_0x1e3b03[_0xddec('0x27')](0xcc)[_0xddec('0x28')]();});}};}function handleEntityNotFound(_0x1fdeb5,_0x10bad3){return function(_0x4a43eb){if(!_0x4a43eb){_0x1fdeb5[_0xddec('0x26')](0x194);}return _0x4a43eb;};}function handleError(_0x460f22,_0x44dc26){_0x44dc26=_0x44dc26||0x1f4;return function(_0x7da8b0){logger['error'](_0x7da8b0[_0xddec('0x41')]);if(_0x7da8b0[_0xddec('0x3f')]){delete _0x7da8b0[_0xddec('0x3f')];}_0x460f22[_0xddec('0x27')](_0x44dc26)[_0xddec('0x42')](_0x7da8b0);};}exports['index']=function(_0x253270,_0x4beed7){var _0x4f6b53={},_0x32c750={},_0x2d8ff6={'count':0x0,'rows':[]};var _0x483f6a=_[_0xddec('0x3c')](db[_0xddec('0x43')]['rawAttributes'],function(_0x4cfec0){return{'name':_0x4cfec0[_0xddec('0x44')],'type':_0x4cfec0['type'][_0xddec('0x45')]};});_0x32c750[_0xddec('0x46')]=_[_0xddec('0x47')](_[_0xddec('0x3c')](_0x483f6a,_0xddec('0x3f')),['password','salt']);_0x32c750[_0xddec('0x48')]=_[_0xddec('0x49')](_0x253270[_0xddec('0x48')]);_0x32c750[_0xddec('0x4a')]=_[_0xddec('0x4b')](_0x32c750['model'],_0x32c750[_0xddec('0x48')]);_0x4f6b53[_0xddec('0x4c')]=_['intersection'](_0x32c750['model'],qs[_0xddec('0x4d')](_0x253270[_0xddec('0x48')][_0xddec('0x4d')]));_0x4f6b53[_0xddec('0x4c')]=_0x4f6b53['attributes'][_0xddec('0x4e')]?_0x4f6b53[_0xddec('0x4c')]:_0x32c750[_0xddec('0x46')];if(!_0x253270[_0xddec('0x48')][_0xddec('0x4f')](_0xddec('0x50'))){_0x4f6b53['limit']=qs[_0xddec('0x2c')](_0x253270[_0xddec('0x48')][_0xddec('0x2c')]);_0x4f6b53[_0xddec('0x2a')]=qs[_0xddec('0x2a')](_0x253270[_0xddec('0x48')][_0xddec('0x2a')]);}_0x4f6b53[_0xddec('0x51')]=qs['sort'](_0x253270[_0xddec('0x48')][_0xddec('0x52')]);_0x4f6b53[_0xddec('0x53')]=qs[_0xddec('0x4a')](_[_0xddec('0x54')](_0x253270[_0xddec('0x48')],_0x32c750[_0xddec('0x4a')]),_0x483f6a);if(_0x253270[_0xddec('0x48')][_0xddec('0x3a')]){_0x4f6b53[_0xddec('0x53')]=_[_0xddec('0x55')](_0x4f6b53[_0xddec('0x53')],{'$or':_[_0xddec('0x3c')](_0x483f6a,function(_0x125819){if(_0x125819[_0xddec('0x56')]!==_0xddec('0x57')){return db['sequelize'][_0xddec('0x53')](db['sequelize']['fn']('lower',db[_0xddec('0x58')]['col'](_0x125819['name'])),{'$like':db[_0xddec('0x58')]['fn'](_0xddec('0x59'),'%'+_0x253270[_0xddec('0x48')][_0xddec('0x3a')]+'%')});}})});}_0x4f6b53=_[_0xddec('0x55')]({},_0x4f6b53,_0x253270[_0xddec('0x5a')]);var _0x3cfae9={'where':_0x4f6b53[_0xddec('0x53')]};return db[_0xddec('0x43')][_0xddec('0x5b')](_0x3cfae9)['then'](function(_0x3f5176){_0x2d8ff6[_0xddec('0x5b')]=_0x3f5176;if(_0x253270[_0xddec('0x48')][_0xddec('0x5c')]){_0x4f6b53['include']=[{'all':!![]}];}if(!_[_0xddec('0x5d')](_0x4f6b53[_0xddec('0x4c')],'id')){_0x4f6b53['attributes']['push']('id');}return db[_0xddec('0x43')][_0xddec('0x5e')](_0x4f6b53);})['then'](function(_0x52594d){_0x2d8ff6[_0xddec('0x5f')]=_0x52594d;if(_0x253270['query'][_0xddec('0x60')]===_0xddec('0x61')){var _0x5def95=[];for(var _0x219534=0x0;_0x219534<_0x2d8ff6['rows'][_0xddec('0x4e')];_0x219534++){_0x5def95[_0xddec('0x62')](get_open_tabs(_0xddec('0x63'),_0x2d8ff6[_0xddec('0x5f')][_0x219534][_0xddec('0x64')]));_0x5def95[_0xddec('0x62')](get_open_tabs(_0xddec('0x65'),_0x2d8ff6[_0xddec('0x5f')][_0x219534][_0xddec('0x64')]));_0x5def95[_0xddec('0x62')](get_open_tabs('fax',_0x2d8ff6[_0xddec('0x5f')][_0x219534][_0xddec('0x64')]));_0x5def95['push'](get_open_tabs(_0xddec('0x66'),_0x2d8ff6['rows'][_0x219534][_0xddec('0x64')]));_0x5def95['push'](get_open_tabs(_0xddec('0x67'),_0x2d8ff6[_0xddec('0x5f')][_0x219534]['dataValues']));_0x5def95['push'](get_open_tabs(_0xddec('0x68'),_0x2d8ff6[_0xddec('0x5f')][_0x219534]['dataValues']));}return BPromise['all'](_0x5def95)[_0xddec('0x1c')](function(_0x3ccb62){return _0x2d8ff6;});}else{return _0x2d8ff6;}})[_0xddec('0x1c')](respondWithFilteredResult(_0x4beed7,_0x4f6b53))[_0xddec('0x25')](handleError(_0x4beed7,null));};exports['show']=function(_0x44b5b2,_0x25b142){var _0x3fcde4={'raw':![],'where':{'id':_0x44b5b2['params']['id']}},_0x240199={};_0x240199[_0xddec('0x46')]=_[_0xddec('0x47')](_['keys'](db['User'][_0xddec('0x69')]),[_0xddec('0x6a'),'salt']);_0x240199[_0xddec('0x48')]=_['keys'](_0x44b5b2[_0xddec('0x48')]);_0x240199[_0xddec('0x4a')]=_[_0xddec('0x4b')](_0x240199['model'],_0x240199['query']);_0x3fcde4[_0xddec('0x4c')]=_[_0xddec('0x4b')](_0x240199['model'],qs['fields'](_0x44b5b2[_0xddec('0x48')][_0xddec('0x4d')]));_0x3fcde4[_0xddec('0x4c')]=_0x3fcde4[_0xddec('0x4c')]['length']?_0x3fcde4[_0xddec('0x4c')]:_0x240199[_0xddec('0x46')];if(_0x44b5b2['query'][_0xddec('0x5c')]){_0x3fcde4[_0xddec('0x6b')]=[{'all':!![]}];}_0x3fcde4=_[_0xddec('0x55')]({},_0x3fcde4,_0x44b5b2[_0xddec('0x5a')]);if(!_[_0xddec('0x5d')](_0x3fcde4[_0xddec('0x4c')],'id')){_0x3fcde4[_0xddec('0x4c')]['push']('id');}return db[_0xddec('0x43')][_0xddec('0x3e')](_0x3fcde4)['then'](handleEntityNotFound(_0x25b142,null))[_0xddec('0x1c')](function(_0x2a1c1c){var _0xa4bd64=[];values=_0x2a1c1c;if(_0x44b5b2['query'][_0xddec('0x60')]==='true'){_0xa4bd64[_0xddec('0x62')](get_open_tabs('chat',_0x2a1c1c[_0xddec('0x64')]));_0xa4bd64[_0xddec('0x62')](get_open_tabs('sms',_0x2a1c1c['dataValues']));_0xa4bd64[_0xddec('0x62')](get_open_tabs(_0xddec('0x67'),_0x2a1c1c['dataValues']));_0xa4bd64['push'](get_open_tabs(_0xddec('0x68'),_0x2a1c1c[_0xddec('0x64')]));_0xa4bd64[_0xddec('0x62')](get_open_tabs(_0xddec('0x6c'),_0x2a1c1c[_0xddec('0x64')]));_0xa4bd64[_0xddec('0x62')](get_open_tabs(_0xddec('0x66'),_0x2a1c1c[_0xddec('0x64')]));return BPromise['all'](_0xa4bd64);}else{return values;}})[_0xddec('0x1c')](function(_0xbd18db){return values;})['then'](respondWithResult(_0x25b142,null))[_0xddec('0x25')](handleError(_0x25b142,null));};exports['update']=function(_0x4c2f5a,_0x1f51bf){if(_0x4c2f5a[_0xddec('0x6d')]['id']){delete _0x4c2f5a[_0xddec('0x6d')]['id'];}delete _0x4c2f5a['body'][_0xddec('0x33')];return db[_0xddec('0x43')]['find']({'where':{'id':_0x4c2f5a[_0xddec('0x6e')]['id']}})['then'](handleEntityNotFound(_0x1f51bf,null))[_0xddec('0x1c')](saveUpdates(_0x4c2f5a[_0xddec('0x6d')],null))[_0xddec('0x1c')](respondWithResult(_0x1f51bf,null))[_0xddec('0x25')](handleError(_0x1f51bf,null));};exports['describe']=function(_0x441667,_0x5c1c6e){return db[_0xddec('0x43')][_0xddec('0x6f')]()[_0xddec('0x1c')](respondWithResult(_0x5c1c6e,null))[_0xddec('0x25')](handleError(_0x5c1c6e,null));};exports[_0xddec('0x70')]=function(_0x205cca,_0x4c291e,_0x3c13ee){return db[_0xddec('0x43')][_0xddec('0x3e')]({'where':{'id':_0x205cca['params']['id']}})['then'](handleEntityNotFound(_0x4c291e,null))[_0xddec('0x1c')](function(_0xea7ba3){if(_0xea7ba3){return _0xea7ba3[_0xddec('0x70')](_0x205cca['body'][_0xddec('0x71')],_[_0xddec('0x72')](_0x205cca[_0xddec('0x6d')],['ids','id'])||{});}})['then'](respondWithResult(_0x4c291e,null))[_0xddec('0x25')](handleError(_0x4c291e,null));};function validateUser(_0x4b9a60){return new BPromise(function(_0x4c1813,_0x15f4df){if(_0x4b9a60[_0xddec('0x73')])return _0x4c1813(_0x4b9a60);return db[_0xddec('0x74')]['findById'](0x1)[_0xddec('0x1c')](function(_0x441b60){if(_0x441b60[_0xddec('0x75')])authService[_0xddec('0x76')](_0x4b9a60[_0xddec('0x6a')]);db['User'][_0xddec('0x77')](_0xddec('0x73'))[_0xddec('0x1c')](function(_0x2f972b){if(_[_0xddec('0x78')](_0x2f972b)){_0x4b9a60['internal']=_0x441b60[_0xddec('0x79')]||0x1;return;}if(_[_0xddec('0x78')](_0x441b60[_0xddec('0x79')])||_0x441b60['min_internal']===_0x2f972b){_0x4b9a60['internal']=_0x2f972b+0x1;return;}if(_0x441b60[_0xddec('0x79')]>_0x2f972b){_0x4b9a60[_0xddec('0x73')]=_0x441b60[_0xddec('0x79')];return;}return db[_0xddec('0x58')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize']['QueryTypes'][_0xddec('0x7a')]})[_0xddec('0x1c')](function(_0x11a54d){if(_0x11a54d&&_0x11a54d['length']){for(var _0x49a6ff=0x0,_0x57ac3f=_0x11a54d['length'];_0x49a6ff<_0x57ac3f&&_[_0xddec('0x78')](_0x4b9a60[_0xddec('0x73')]);_0x49a6ff++){if(_0x441b60[_0xddec('0x79')]<=_0x11a54d[_0x49a6ff][_0xddec('0x7b')]){_0x4b9a60['internal']=_0x11a54d[_0x49a6ff][_0xddec('0x7b')];}else if(_0x441b60['min_internal']>_0x11a54d[_0x49a6ff][_0xddec('0x7b')]&&_0x441b60[_0xddec('0x79')]<=_0x11a54d[_0x49a6ff]['to']){_0x4b9a60['internal']=_0x441b60[_0xddec('0x79')];}}}if(_[_0xddec('0x78')](_0x4b9a60[_0xddec('0x73')])){_0x4b9a60['internal']=_0x2f972b+0x1;}return _0x4c1813(_0x4b9a60);});});})[_0xddec('0x25')](function(_0x2df847){_0x15f4df(_0x2df847);});});}function updateUser(_0x562957){return new BPromise(function(_0x8cb8a5,_0x3843e3){try{if(_0x562957[_0xddec('0x7c')]){_0x562957[_0xddec('0x7d')]=_0x562957[_0xddec('0x73')];_0x562957[_0xddec('0x7e')]={'mailbox':_0x562957[_0xddec('0x73')],'password':_0x562957[_0xddec('0x6a')],'fullname':_0x562957[_0xddec('0x7f')],'email':_0x562957[_0xddec('0x80')]};}if(_0x562957[_0xddec('0x33')]===_0xddec('0x37')){if(!_0x562957[_0xddec('0x81')])_0x562957[_0xddec('0x81')]=[_0xddec('0x82'),_0xddec('0x83'),_0xddec('0x84'),'113','110',_0xddec('0x85'),_0xddec('0x86'),_0xddec('0x87'),_0xddec('0x88'),_0xddec('0x89'),_0xddec('0x8a'),_0xddec('0x8b'),_0xddec('0x8c'),_0xddec('0x8d'),'115'];}_0x8cb8a5(_0x562957);}catch(_0x3c87d5){_0x3843e3(_0x3c87d5);}});}exports[_0xddec('0x8e')]=function(_0x3e29ee,_0x342a7a){if(_0x3e29ee[_0xddec('0x35')][_0xddec('0x33')]===_0xddec('0x37'))throw new Error(_0xddec('0x8f'));if(_0x3e29ee[_0xddec('0x6d')][_0xddec('0x33')]===_0xddec('0x35')&&_0x3e29ee[_0xddec('0x35')]['role']!=='admin'){throw new Error(_0xddec('0x90'));}if(_0x3e29ee[_0xddec('0x6d')][_0xddec('0x33')]===_0xddec('0x91')&&_0x3e29ee['user'][_0xddec('0x33')]!==_0xddec('0x91')){throw new Error(_0xddec('0x92'));}return licenseUtil[_0xddec('0x93')]([_0x3e29ee[_0xddec('0x6d')]])[_0xddec('0x1c')](function(){return validateUser(_0x3e29ee[_0xddec('0x6d')]);})[_0xddec('0x1c')](function(_0x51891a){return updateUser(_0x51891a)[_0xddec('0x1c')](function(_0x513ccb){if(_0x513ccb[_0xddec('0x33')]===_0xddec('0x91')){_0x513ccb[_0xddec('0x94')]=_0x3e29ee[_0xddec('0x35')]['settingsEnabled'];delete _0x513ccb[_0xddec('0x95')];}return _0x513ccb;});})['then'](function(_0x474e2f){return db[_0xddec('0x43')][_0xddec('0x8e')](_0x474e2f,{'include':[{'model':db[_0xddec('0x7e')],'as':_0xddec('0x7e')}]});})[_0xddec('0x1c')](function(_0x169493){if(_0x3e29ee[_0xddec('0x6d')][_0xddec('0x33')]===_0xddec('0x35'))return _0x169493;if(_0x3e29ee[_0xddec('0x35')][_0xddec('0x33')]!==_0xddec('0x35'))return _0x169493;return db[_0xddec('0x96')][_0xddec('0x3e')]({'where':{'name':_0x169493[_0xddec('0x33')]==='agent'?_0xddec('0x36'):_0xddec('0x38'),'userProfileId':_0x3e29ee[_0xddec('0x35')][_0xddec('0x95')]},'raw':!![]})[_0xddec('0x1c')](function(_0x375b4e){if(!_0x375b4e||_0x375b4e[_0xddec('0x97')]!=0x0)return _0x169493;return db['UserProfileResource']['create']({'name':_0x169493[_0xddec('0x3f')],'resourceId':_0x169493['id'],'type':_0x375b4e[_0xddec('0x3f')],'sectionId':_0x375b4e['id']},{})[_0xddec('0x1c')](function(){return _0x169493;});})['catch'](function(_0x6d3d73){logger[_0xddec('0x22')](_0xddec('0x98'),_0x6d3d73);throw _0x6d3d73;});})[_0xddec('0x1c')](respondWithResult(_0x342a7a,0xc9))['catch'](handleError(_0x342a7a,null));};exports[_0xddec('0x99')]=function(_0xf82290,_0xdc8a50){var _0x584efd=_0xf82290[_0xddec('0x6d')];var _0x5266c3=[];if(_0xf82290[_0xddec('0x35')]['role']===_0xddec('0x37'))throw new Error(_0xddec('0x8f'));if(_[_0xddec('0x9a')](_0x584efd,[_0xddec('0x33'),_0xddec('0x35')])&&_0xf82290[_0xddec('0x35')][_0xddec('0x33')]!==_0xddec('0x91')){throw new Error(_0xddec('0x90'));}if(_['some'](_0x584efd,[_0xddec('0x33'),_0xddec('0x91')])&&_0xf82290[_0xddec('0x35')][_0xddec('0x33')]!==_0xddec('0x91')){throw new Error(_0xddec('0x9b'));}return licenseUtil[_0xddec('0x93')](_0x584efd)[_0xddec('0x1c')](function(){return validateUser(_0x584efd[0x0]);})[_0xddec('0x1c')](function(){for(var _0x218366=0x1;_0x218366<_0x584efd['length'];_0x218366++){var _0x142567=_0x584efd[_0x218366-0x1][_0xddec('0x73')];if(!_0x584efd[_0x218366][_0xddec('0x73')])_0x584efd[_0x218366][_0xddec('0x73')]=_0x142567+0x1;_0x5266c3[_0xddec('0x62')](validateUser(_0x584efd[_0x218366]));}return BPromise[_0xddec('0x9c')](_0x5266c3);})[_0xddec('0x1c')](function(){_0x5266c3=[];for(var _0x4e5732=0x0;_0x4e5732<_0x584efd[_0xddec('0x4e')];_0x4e5732++){_0x5266c3[_0xddec('0x62')](updateUser(_0x584efd[_0x4e5732]));}return BPromise[_0xddec('0x9c')](_0x5266c3);})['then'](function(){return BPromise[_0xddec('0x9d')](_0x584efd,function(_0x1c4cd4){return db['User']['create'](_0x1c4cd4,{'include':[{'model':db[_0xddec('0x7e')],'as':_0xddec('0x7e')}]})[_0xddec('0x1c')](function(_0xabad54){_0x1c4cd4['id']=_0xabad54['id'];return _0x1c4cd4;});});})[_0xddec('0x1c')](function(_0x40b793){if(_0xf82290[_0xddec('0x6d')][_0xddec('0x33')]===_0xddec('0x35'))return _0x40b793;if(_0xf82290[_0xddec('0x35')][_0xddec('0x33')]!=='user')return _0x40b793;var _0x3a7709=_[_0xddec('0x9a')](_0x40b793,function(_0xfb76ea){return _0xfb76ea[_0xddec('0x33')]===_0xddec('0x37')||_0xfb76ea[_0xddec('0x33')]===_0xddec('0x39');});if(!_0x3a7709)return _0x40b793;return db['UserProfileSection'][_0xddec('0x5e')]({'where':{'name':{'$or':['Agents',_0xddec('0x38')]},'userProfileId':_0xf82290[_0xddec('0x35')][_0xddec('0x95')]},'raw':!![]})[_0xddec('0x1c')](function(_0x588555){if(_[_0xddec('0x9e')](_0x588555)||!_[_0xddec('0x9a')](_0x588555,[_0xddec('0x97'),0x0]))return _0x40b793;_0x5266c3=[];var _0x3a4a06=_(_0x588555)[_0xddec('0x3c')](function(_0x5668c9){if(_0x5668c9[_0xddec('0x97')]===0x1)return;return _0x5668c9[_0xddec('0x3f')]===_0xddec('0x36')?_0xddec('0x37'):_0xddec('0x39');})['compact']()[_0xddec('0x3d')]();for(var _0x4c13a1=0x0;_0x4c13a1<_0x40b793[_0xddec('0x4e')];_0x4c13a1++){if(!_[_0xddec('0x5d')](_0x3a4a06,_0x40b793[_0x4c13a1][_0xddec('0x33')]))return;var _0x271324=_0x40b793[_0x4c13a1]['role']===_0xddec('0x37')?_0xddec('0x36'):_0xddec('0x38');_0x5266c3[_0xddec('0x62')](db['UserProfileResource'][_0xddec('0x8e')]({'name':_0x40b793[_0x4c13a1]['name'],'resourceId':_0x40b793[_0x4c13a1]['id'],'type':_0x271324,'sectionId':_['find'](_0x588555,[_0xddec('0x3f'),_0x271324])['id']},{}));}return BPromise['all'](_0x5266c3);});})['then'](respondWithResult(_0xdc8a50,0xc9))[_0xddec('0x25')](handleError(_0xdc8a50,null));};exports['changePassword']=function(_0x585bba,_0x3dc52f,_0x12e28c){if(_0x585bba[_0xddec('0x6d')]['id']){delete _0x585bba[_0xddec('0x6d')]['id'];}return db[_0xddec('0x43')][_0xddec('0x3e')]({'where':{'id':_0x585bba['params']['id']}})[_0xddec('0x1c')](function(_0x22e24d){if(!_0x22e24d)return null;if(_0x22e24d['id']===_0x585bba[_0xddec('0x35')]['id']){if(!_0x585bba[_0xddec('0x6d')][_0xddec('0x9f')]||!_0x585bba['body'][_0xddec('0xa0')]){throw new db['Sequelize'][(_0xddec('0xa1'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x22e24d[_0xddec('0xa2')](_0x585bba[_0xddec('0x6d')][_0xddec('0x9f')])){throw new db[(_0xddec('0xa3'))][(_0xddec('0xa1'))](_0xddec('0xa4'));}if(_0x585bba[_0xddec('0x6d')][_0xddec('0x9f')]===_0x585bba[_0xddec('0x6d')]['newPassword']){throw new db[(_0xddec('0xa3'))][(_0xddec('0xa1'))](_0xddec('0xa5'));}}else if(_0x585bba['user']['role']==='admin'){if(!_0x585bba['body'][_0xddec('0xa0')]){throw new db[(_0xddec('0xa3'))][(_0xddec('0xa1'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x585bba['user'][_0xddec('0x33')]==='user'){if(!_0x585bba[_0xddec('0x6d')][_0xddec('0xa0')]){throw new db[(_0xddec('0xa3'))][(_0xddec('0xa1'))](_0xddec('0xa6'));}if(_0x22e24d['role']!==_0xddec('0x37')){throw new db[(_0xddec('0xa3'))][(_0xddec('0xa1'))](_0xddec('0x8f'));}}else{throw new db[(_0xddec('0xa3'))][(_0xddec('0xa1'))]('Unauthorized');}return _0x22e24d;})[_0xddec('0x1c')](handleEntityNotFound(_0x3dc52f,null))['then'](function(_0x488cd8){return db[_0xddec('0x74')][_0xddec('0xa7')]({'attributes':['id',_0xddec('0x75'),_0xddec('0xa8'),_0xddec('0xa9')]})[_0xddec('0x1c')](function(_0x2e19b0){if(_0x2e19b0[_0xddec('0x75')])authService[_0xddec('0x76')](_0x585bba['body'][_0xddec('0xa0')]);if(!_0x2e19b0[_0xddec('0xa8')]||!_0x488cd8['previousPasswords'])return _0x488cd8;authService['validatePasswordHistory'](_0x585bba[_0xddec('0x6d')][_0xddec('0xa0')],_0x488cd8[_0xddec('0xaa')],_0x2e19b0[_0xddec('0xa9')]);return _0x488cd8;})[_0xddec('0x1c')](saveUpdates({'password':_0x585bba[_0xddec('0x6d')]['newPassword'],'passwordResetAt':_0x585bba[_0xddec('0x35')]['id']==_0x585bba['params']['id']?moment():null,'previousPasswords':authService[_0xddec('0xab')](_0x585bba[_0xddec('0x6d')][_0xddec('0xa0')],_0x488cd8[_0xddec('0xaa')])},null));})[_0xddec('0x1c')](respondWithResult(_0x3dc52f,null))['catch'](handleError(_0x3dc52f,null));};exports[_0xddec('0xac')]=function(_0x672f90,_0x2095c8,_0x29b0f2){var _0x3c277d=_0x672f90[_0xddec('0x6d')][_0xddec('0xad')];return db[_0xddec('0x43')][_0xddec('0x3e')]({'where':{'id':_0x672f90[_0xddec('0x6e')]['id']},'attributes':['id',_0xddec('0x3f'),_0xddec('0x33'),'online',_0xddec('0xae'),'voicePause','interface']})['then'](handleEntityNotFound(_0x2095c8,null))[_0xddec('0x1c')](function(_0x482ed2){if(_0x482ed2){if(!utils[_0xddec('0xaf')](_0x3c277d)){throw new db[(_0xddec('0xa3'))][(_0xddec('0xa1'))](_0xddec('0xb0'));}return _0x482ed2[_0xddec('0xb1')+_[_0xddec('0xb2')](_0x3c277d['toLowerCase']())+'Queues'](_0x672f90[_0xddec('0x6d')][_0xddec('0x71')],{'penalty':_0x672f90['body']['penalty']||0x0})[_0xddec('0xb3')](function(_0x10f4dc){for(var _0x5b2d90=0x0;_0x5b2d90<_0x672f90[_0xddec('0x6d')]['ids'][_0xddec('0x4e')];_0x5b2d90+=0x1){var _0x302c72={'UserId':_0x672f90[_0xddec('0x6e')]['id']};_0x302c72[_[_0xddec('0xb2')](_0x3c277d[_0xddec('0xb4')]())+_0xddec('0xb5')]=_0x672f90[_0xddec('0x6d')][_0xddec('0x71')][_0x5b2d90];socket['emit']('user'+_['capitalize'](_0x3c277d[_0xddec('0xb4')]())+'Queue:save',_0x302c72);}return _0x10f4dc;})[_0xddec('0x1c')](function(){if(_0x3c277d===_0xddec('0xb6')){return db[_0xddec('0xb7')][_0xddec('0x5e')]({'where':{'id':_0x672f90[_0xddec('0x6d')][_0xddec('0x71')]||[]},'raw':!![],'attributes':['id',_0xddec('0x3f')]});}})[_0xddec('0x1c')](function(_0x79c150){var _0x16ff46=_0x482ed2[_0xddec('0x32')]({'plain':!![]});var _0x2b1fe9=[];if(_0x3c277d==='voice'&&_0x16ff46[_0xddec('0x33')]===_0xddec('0x37')&&_0x16ff46['online']){for(var _0x5a64e3=0x0;_0x5a64e3<_0x79c150[_0xddec('0x4e')];_0x5a64e3+=0x1){_0x2b1fe9[_0xddec('0x62')]({'membername':_0x16ff46['name'],'UserId':_0x16ff46['id'],'queue_name':_0x79c150[_0x5a64e3][_0xddec('0x3f')],'VoiceQueueId':_0x79c150[_0x5a64e3]['id'],'interface':_[_0xddec('0x78')](_0x16ff46[_0xddec('0xb8')])?util['format'](_0xddec('0xb9'),_0x16ff46[_0xddec('0x3f')]):_0x16ff46[_0xddec('0xb8')],'paused':_0x16ff46[_0xddec('0xba')]||![],'penalty':_0x672f90[_0xddec('0x6d')][_0xddec('0xbb')]||0x0});}return BPromise[_0xddec('0x9d')](_0x2b1fe9,function(_0x5e0fbe){return db[_0xddec('0xbc')][_0xddec('0xbd')](_0x5e0fbe);});}return _0x482ed2;});}})[_0xddec('0x1c')](respondWithStatusCode(_0x2095c8,null))['catch'](handleError(_0x2095c8,null));};exports[_0xddec('0xbe')]=function(_0x537528,_0x38b182,_0x21b028){var _0x5e53cc;return db['User'][_0xddec('0x3e')]({'where':{'id':_0x537528[_0xddec('0x6e')]['id']},'attributes':['id','name',_0xddec('0x33')]})['then'](handleEntityNotFound(_0x38b182,null))['then'](function(_0x275d32){if(_0x275d32){_0x5e53cc=_0x275d32;if(!_0x537528[_0xddec('0x48')]['channel']||!utils[_0xddec('0xaf')](_0x537528[_0xddec('0x48')][_0xddec('0xad')])){throw new db['Sequelize'][(_0xddec('0xa1'))]('Unknown\x20channel');}return _0x275d32[_0xddec('0xbf')+_[_0xddec('0xb2')](_0x537528[_0xddec('0x48')][_0xddec('0xad')]['toLowerCase']())+_0xddec('0xc0')](_0x537528['query'][_0xddec('0x71')]);}})[_0xddec('0x1c')](function(_0xb95b3b){for(var _0x39735c=0x0;_0x39735c<_0x537528[_0xddec('0x48')][_0xddec('0x71')][_0xddec('0x4e')];_0x39735c+=0x1){var _0x580393={'UserId':_0x537528[_0xddec('0x6e')]['id']};_0x580393[_[_0xddec('0xb2')](_0x537528[_0xddec('0x48')]['channel'][_0xddec('0xb4')]())+'QueueId']=_0x537528[_0xddec('0x48')][_0xddec('0x71')][_0x39735c];socket[_0xddec('0xc1')](_0xddec('0x35')+_['capitalize'](_0x537528['query'][_0xddec('0xad')][_0xddec('0xb4')]())+'Queue:remove',_0x580393);}return _0xb95b3b;})[_0xddec('0x1c')](function(){if(_0x537528['query'][_0xddec('0xad')]===_0xddec('0xb6')){return db[_0xddec('0xbc')][_0xddec('0x31')]({'where':{'UserId':_0x537528[_0xddec('0x6e')]['id'],'VoiceQueueId':_0x537528[_0xddec('0x48')][_0xddec('0x71')]},'individualHooks':!![]})[_0xddec('0x1c')](function(){return _0x5e53cc;});}return _0x5e53cc;})[_0xddec('0x1c')](respondWithStatusCode(_0x38b182,null))['catch'](handleError(_0x38b182,null));};exports['addAvatar']=function(_0x3c84b9,_0x53357d,_0x4b1ba1){_0x3c84b9[_0xddec('0x6d')]['userpic']=_0x3c84b9[_0xddec('0xc2')][_0xddec('0xc3')];return db['User'][_0xddec('0x3e')]({'where':{'id':_0x3c84b9[_0xddec('0x6e')]['id']}})['then'](handleEntityNotFound(_0x53357d,null))[_0xddec('0x1c')](saveUpdates(_0x3c84b9[_0xddec('0x6d')],null))['then'](respondWithResult(_0x53357d,null))['catch'](handleError(_0x53357d,null));};exports[_0xddec('0xc4')]=function(_0x982465,_0x278073,_0x3cf1ef){var _0x4e94c1=path[_0xddec('0xc5')](config[_0xddec('0xc6')],_0xddec('0xc7'));return db[_0xddec('0x43')][_0xddec('0x3e')]({'where':{'id':_0x982465[_0xddec('0x6e')]['id']},'attributes':['id',_0xddec('0xc8')],'raw':!![]})[_0xddec('0x1c')](handleEntityNotFound(_0x278073,null))[_0xddec('0x1c')](function(_0x3a6a84){if(_0x3a6a84){if(_[_0xddec('0x78')](_0x3a6a84[_0xddec('0xc8')])){return _0x278073[_0xddec('0xc9')](_0x4e94c1);}else{if(!fs[_0xddec('0xca')](path['join'](config['root'],_0xddec('0xcb'),_0x3a6a84['userpic']))){return _0x278073['download'](_0x4e94c1);}return _0x278073['download'](path[_0xddec('0xc5')](config[_0xddec('0xc6')],_0xddec('0xcb'),_0x3a6a84[_0xddec('0xc8')]));}}})[_0xddec('0x25')](handleError(_0x278073,null));};exports[_0xddec('0xcc')]=function(_0x1d4d55,_0x366622,_0x5571d6){return db[_0xddec('0x43')][_0xddec('0x3e')]({'where':{'id':_0x1d4d55[_0xddec('0x6e')]['id']},'attributes':['id']})[_0xddec('0x1c')](handleEntityNotFound(_0x366622,null))[_0xddec('0x1c')](function(_0x34dfe9){var _0x5add03=[];values=_0x34dfe9[_0xddec('0x64')];_0x5add03[_0xddec('0x62')](get_open_tabs(_0xddec('0x63'),_0x34dfe9[_0xddec('0x64')]));_0x5add03['push'](get_open_tabs(_0xddec('0x65'),_0x34dfe9[_0xddec('0x64')]));_0x5add03[_0xddec('0x62')](get_open_tabs(_0xddec('0x67'),_0x34dfe9['dataValues']));_0x5add03['push'](get_open_tabs(_0xddec('0x68'),_0x34dfe9['dataValues']));_0x5add03[_0xddec('0x62')](get_open_tabs(_0xddec('0x6c'),_0x34dfe9[_0xddec('0x64')]));_0x5add03[_0xddec('0x62')](get_open_tabs(_0xddec('0x66'),_0x34dfe9[_0xddec('0x64')]));return BPromise[_0xddec('0x9c')](_0x5add03);})['then'](function(_0xbd96ad){var _0x816407=[];if(_0xbd96ad){for(var _0x2c7964=0x0;_0x2c7964=_0x558a2c){_0x5b6685=_0x558a2c;_0x38a089=0xc8;}else{_0x38a089=0xce;}_0x156b1f['status'](_0x38a089);return _0x156b1f['set']('Content-Range',_0x1fcf64+'-'+_0x5b6685+'/'+_0x558a2c)[_0xdcc2('0x2f')](_0x18b6c4);}return null;};}function patchUpdates(_0x127e1e){return function(_0x30afd5){try{jsonpatch['apply'](_0x30afd5,_0x127e1e,!![]);}catch(_0xcf67ba){return BPromise['reject'](_0xcf67ba);}return _0x30afd5['save']();};}function saveUpdates(_0x299f5c,_0xb189c9){return function(_0x4d94ae){if(_0x4d94ae){return _0x4d94ae[_0xdcc2('0x30')](_0x299f5c)['then'](function(_0x4a23e8){return _0x4a23e8;});}return null;};}function removeEntity(_0x14f0bc,_0x1cecec){return function(_0x2da06b){if(_0x2da06b){return _0x2da06b[_0xdcc2('0x31')]()[_0xdcc2('0x1f')](function(){var _0x1c2874=_0x2da06b[_0xdcc2('0x32')]({'plain':!![]});if(_0x1c2874[_0xdcc2('0x33')]===_0xdcc2('0x34'))return;var _0x2b7c43=[{'name':'Users','value':_0xdcc2('0x35'),'ignore':!![]},{'name':_0xdcc2('0x36'),'value':'agent','ignore':![]},{'name':_0xdcc2('0x37'),'value':'telephone','ignore':![]}];var _0x33049d=_(_0x2b7c43)[_0xdcc2('0x38')](_0xdcc2('0x39'))[_0xdcc2('0x3a')](_0xdcc2('0x3b'))[_0xdcc2('0x3b')]();if(_['includes'](_0x33049d,_0x1c2874[_0xdcc2('0x33')])){return;}var _0x4bdf25=_[_0xdcc2('0x3c')](_0x2b7c43,[_0xdcc2('0x3b'),_0x1c2874[_0xdcc2('0x33')]])[_0xdcc2('0x3d')];return db[_0xdcc2('0x3e')][_0xdcc2('0x31')]({'where':{'type':_0x4bdf25,'resourceId':_0x1c2874['id']}})['then'](function(){return _0x2da06b;});})[_0xdcc2('0x1f')](function(){_0x14f0bc[_0xdcc2('0x29')](0xcc)[_0xdcc2('0x2a')]();});}};}function handleEntityNotFound(_0x138b70,_0x1c6130){return function(_0x140960){if(!_0x140960){_0x138b70[_0xdcc2('0x28')](0x194);}return _0x140960;};}function handleError(_0x3e1e37,_0xb5e5a5){_0xb5e5a5=_0xb5e5a5||0x1f4;return function(_0x1817cf){logger[_0xdcc2('0x23')](_0x1817cf['stack']);if(_0x1817cf[_0xdcc2('0x3d')]){delete _0x1817cf['name'];}_0x3e1e37[_0xdcc2('0x29')](_0xb5e5a5)[_0xdcc2('0x3f')](_0x1817cf);};}exports[_0xdcc2('0x40')]=function(_0x4bcfe7,_0x9e4832){var _0x310987={},_0x3af115={},_0x28f943={'count':0x0,'rows':[]};var _0x1040b7=_['map'](db[_0xdcc2('0x41')][_0xdcc2('0x42')],function(_0x564824){return{'name':_0x564824[_0xdcc2('0x43')],'type':_0x564824[_0xdcc2('0x44')]['key']};});_0x3af115['model']=_[_0xdcc2('0x45')](_['map'](_0x1040b7,'name'),[_0xdcc2('0x46'),_0xdcc2('0x47')]);_0x3af115['query']=_[_0xdcc2('0x48')](_0x4bcfe7[_0xdcc2('0x49')]);_0x3af115['filters']=_[_0xdcc2('0x4a')](_0x3af115[_0xdcc2('0x4b')],_0x3af115['query']);_0x310987['attributes']=_[_0xdcc2('0x4a')](_0x3af115[_0xdcc2('0x4b')],qs[_0xdcc2('0x4c')](_0x4bcfe7[_0xdcc2('0x49')]['fields']));_0x310987['attributes']=_0x310987[_0xdcc2('0x4d')][_0xdcc2('0x4e')]?_0x310987['attributes']:_0x3af115[_0xdcc2('0x4b')];if(!_0x4bcfe7[_0xdcc2('0x49')][_0xdcc2('0x4f')](_0xdcc2('0x50'))){_0x310987[_0xdcc2('0x2c')]=qs[_0xdcc2('0x2c')](_0x4bcfe7[_0xdcc2('0x49')][_0xdcc2('0x2c')]);_0x310987[_0xdcc2('0x2b')]=qs['offset'](_0x4bcfe7[_0xdcc2('0x49')][_0xdcc2('0x2b')]);}_0x310987['order']=qs[_0xdcc2('0x51')](_0x4bcfe7[_0xdcc2('0x49')][_0xdcc2('0x51')]);_0x310987['where']=qs[_0xdcc2('0x52')](_[_0xdcc2('0x53')](_0x4bcfe7[_0xdcc2('0x49')],_0x3af115[_0xdcc2('0x52')]),_0x1040b7);if(_0x4bcfe7[_0xdcc2('0x49')][_0xdcc2('0x38')]){_0x310987[_0xdcc2('0x54')]=_[_0xdcc2('0x55')](_0x310987[_0xdcc2('0x54')],{'$or':_[_0xdcc2('0x3a')](_0x1040b7,function(_0x4c6139){if(_0x4c6139[_0xdcc2('0x44')]!=='VIRTUAL'){return db[_0xdcc2('0x56')][_0xdcc2('0x54')](db[_0xdcc2('0x56')]['fn']('lower',db[_0xdcc2('0x56')]['col'](_0x4c6139[_0xdcc2('0x3d')])),{'$like':db['sequelize']['fn'](_0xdcc2('0x57'),'%'+_0x4bcfe7[_0xdcc2('0x49')][_0xdcc2('0x38')]+'%')});}})});}_0x310987=_[_0xdcc2('0x55')]({},_0x310987,_0x4bcfe7[_0xdcc2('0x58')]);var _0x4042c7={'where':_0x310987[_0xdcc2('0x54')]};return db[_0xdcc2('0x41')]['count'](_0x4042c7)[_0xdcc2('0x1f')](function(_0x14c496){_0x28f943['count']=_0x14c496;if(_0x4bcfe7[_0xdcc2('0x49')][_0xdcc2('0x59')]){_0x310987[_0xdcc2('0x5a')]=[{'all':!![]}];}if(!_[_0xdcc2('0x5b')](_0x310987['attributes'],'id')){_0x310987[_0xdcc2('0x4d')][_0xdcc2('0x5c')]('id');}return db[_0xdcc2('0x41')][_0xdcc2('0x5d')](_0x310987);})[_0xdcc2('0x1f')](function(_0x2585b7){_0x28f943[_0xdcc2('0x5e')]=_0x2585b7;if(_0x4bcfe7[_0xdcc2('0x49')][_0xdcc2('0x5f')]===_0xdcc2('0x60')){var _0x54c63b=[];for(var _0x272c8c=0x0;_0x272c8c<_0x28f943[_0xdcc2('0x5e')]['length'];_0x272c8c++){_0x54c63b[_0xdcc2('0x5c')](get_open_tabs(_0xdcc2('0x61'),_0x28f943['rows'][_0x272c8c][_0xdcc2('0x62')]));_0x54c63b['push'](get_open_tabs('sms',_0x28f943[_0xdcc2('0x5e')][_0x272c8c][_0xdcc2('0x62')]));_0x54c63b[_0xdcc2('0x5c')](get_open_tabs(_0xdcc2('0x63'),_0x28f943['rows'][_0x272c8c][_0xdcc2('0x62')]));_0x54c63b[_0xdcc2('0x5c')](get_open_tabs(_0xdcc2('0x64'),_0x28f943['rows'][_0x272c8c]['dataValues']));_0x54c63b[_0xdcc2('0x5c')](get_open_tabs(_0xdcc2('0x65'),_0x28f943[_0xdcc2('0x5e')][_0x272c8c]['dataValues']));_0x54c63b['push'](get_open_tabs(_0xdcc2('0x66'),_0x28f943['rows'][_0x272c8c][_0xdcc2('0x62')]));}return BPromise['all'](_0x54c63b)[_0xdcc2('0x1f')](function(_0x5cc31a){return _0x28f943;});}else{return _0x28f943;}})['then'](respondWithFilteredResult(_0x9e4832,_0x310987))[_0xdcc2('0x27')](handleError(_0x9e4832,null));};exports[_0xdcc2('0x67')]=function(_0x3540cf,_0x166021){var _0x48d6b2={'raw':![],'where':{'id':_0x3540cf[_0xdcc2('0x68')]['id']}},_0x249332={};_0x249332['model']=_[_0xdcc2('0x45')](_[_0xdcc2('0x48')](db['User'][_0xdcc2('0x42')]),['password',_0xdcc2('0x47')]);_0x249332['query']=_['keys'](_0x3540cf[_0xdcc2('0x49')]);_0x249332['filters']=_[_0xdcc2('0x4a')](_0x249332[_0xdcc2('0x4b')],_0x249332['query']);_0x48d6b2[_0xdcc2('0x4d')]=_[_0xdcc2('0x4a')](_0x249332[_0xdcc2('0x4b')],qs[_0xdcc2('0x4c')](_0x3540cf['query'][_0xdcc2('0x4c')]));_0x48d6b2['attributes']=_0x48d6b2[_0xdcc2('0x4d')]['length']?_0x48d6b2[_0xdcc2('0x4d')]:_0x249332[_0xdcc2('0x4b')];if(_0x3540cf['query'][_0xdcc2('0x59')]){_0x48d6b2[_0xdcc2('0x5a')]=[{'all':!![]}];}_0x48d6b2=_[_0xdcc2('0x55')]({},_0x48d6b2,_0x3540cf[_0xdcc2('0x58')]);if(!_[_0xdcc2('0x5b')](_0x48d6b2['attributes'],'id')){_0x48d6b2['attributes'][_0xdcc2('0x5c')]('id');}return db[_0xdcc2('0x41')][_0xdcc2('0x3c')](_0x48d6b2)[_0xdcc2('0x1f')](handleEntityNotFound(_0x166021,null))[_0xdcc2('0x1f')](function(_0x279d7a){var _0x5e9640=[];values=_0x279d7a;if(_0x3540cf[_0xdcc2('0x49')]['openTabs']===_0xdcc2('0x60')){_0x5e9640['push'](get_open_tabs('chat',_0x279d7a[_0xdcc2('0x62')]));_0x5e9640[_0xdcc2('0x5c')](get_open_tabs(_0xdcc2('0x69'),_0x279d7a[_0xdcc2('0x62')]));_0x5e9640[_0xdcc2('0x5c')](get_open_tabs(_0xdcc2('0x65'),_0x279d7a[_0xdcc2('0x62')]));_0x5e9640[_0xdcc2('0x5c')](get_open_tabs(_0xdcc2('0x66'),_0x279d7a['dataValues']));_0x5e9640[_0xdcc2('0x5c')](get_open_tabs(_0xdcc2('0x63'),_0x279d7a[_0xdcc2('0x62')]));_0x5e9640[_0xdcc2('0x5c')](get_open_tabs('mail',_0x279d7a[_0xdcc2('0x62')]));return BPromise[_0xdcc2('0x6a')](_0x5e9640);}else{return values;}})[_0xdcc2('0x1f')](function(_0x45a162){return values;})[_0xdcc2('0x1f')](respondWithResult(_0x166021,null))['catch'](handleError(_0x166021,null));};exports['update']=function(_0x578bdb,_0x38681c){if(_0x578bdb[_0xdcc2('0x6b')]['id']){delete _0x578bdb['body']['id'];}delete _0x578bdb[_0xdcc2('0x6b')][_0xdcc2('0x33')];return db[_0xdcc2('0x41')][_0xdcc2('0x3c')]({'where':{'id':_0x578bdb[_0xdcc2('0x68')]['id']}})[_0xdcc2('0x1f')](handleEntityNotFound(_0x38681c,null))[_0xdcc2('0x1f')](saveUpdates(_0x578bdb[_0xdcc2('0x6b')],null))['then'](respondWithResult(_0x38681c,null))[_0xdcc2('0x27')](handleError(_0x38681c,null));};exports[_0xdcc2('0x6c')]=function(_0x487d0d,_0x2cbf7b){return db[_0xdcc2('0x41')][_0xdcc2('0x6c')]()[_0xdcc2('0x1f')](respondWithResult(_0x2cbf7b,null))[_0xdcc2('0x27')](handleError(_0x2cbf7b,null));};exports[_0xdcc2('0x6d')]=function(_0x4b5780,_0x498e31,_0x1ba9e2){return db[_0xdcc2('0x41')][_0xdcc2('0x3c')]({'where':{'id':_0x4b5780['params']['id']}})[_0xdcc2('0x1f')](handleEntityNotFound(_0x498e31,null))[_0xdcc2('0x1f')](function(_0x4d4544){if(_0x4d4544){return _0x4d4544['addContacts'](_0x4b5780['body']['ids'],_['omit'](_0x4b5780[_0xdcc2('0x6b')],[_0xdcc2('0x6e'),'id'])||{});}})[_0xdcc2('0x1f')](respondWithResult(_0x498e31,null))[_0xdcc2('0x27')](handleError(_0x498e31,null));};function validateUser(_0x464380){return new BPromise(function(_0x152a7e,_0xa86aac){if(_0x464380[_0xdcc2('0x6f')])return _0x152a7e(_0x464380);return db[_0xdcc2('0x70')][_0xdcc2('0x71')](0x1)[_0xdcc2('0x1f')](function(_0x32cb41){if(_0x32cb41[_0xdcc2('0x72')])authService[_0xdcc2('0x73')](_0x464380[_0xdcc2('0x46')]);db[_0xdcc2('0x41')][_0xdcc2('0x74')]('internal')[_0xdcc2('0x1f')](function(_0x19f9b0){if(_[_0xdcc2('0x75')](_0x19f9b0)){_0x464380[_0xdcc2('0x6f')]=_0x32cb41[_0xdcc2('0x76')]||0x1;return;}if(_['isNil'](_0x32cb41[_0xdcc2('0x76')])||_0x32cb41['min_internal']===_0x19f9b0){_0x464380[_0xdcc2('0x6f')]=_0x19f9b0+0x1;return;}if(_0x32cb41['min_internal']>_0x19f9b0){_0x464380[_0xdcc2('0x6f')]=_0x32cb41[_0xdcc2('0x76')];return;}return db[_0xdcc2('0x56')][_0xdcc2('0x49')](_0xdcc2('0x77'),{'type':db[_0xdcc2('0x56')][_0xdcc2('0x78')]['SELECT']})['then'](function(_0x7dd73c){if(_0x7dd73c&&_0x7dd73c[_0xdcc2('0x4e')]){for(var _0x4aa124=0x0,_0x5a9a18=_0x7dd73c[_0xdcc2('0x4e')];_0x4aa124<_0x5a9a18&&_['isNil'](_0x464380[_0xdcc2('0x6f')]);_0x4aa124++){if(_0x32cb41['min_internal']<=_0x7dd73c[_0x4aa124][_0xdcc2('0x79')]){_0x464380[_0xdcc2('0x6f')]=_0x7dd73c[_0x4aa124][_0xdcc2('0x79')];}else if(_0x32cb41[_0xdcc2('0x76')]>_0x7dd73c[_0x4aa124][_0xdcc2('0x79')]&&_0x32cb41[_0xdcc2('0x76')]<=_0x7dd73c[_0x4aa124]['to']){_0x464380[_0xdcc2('0x6f')]=_0x32cb41[_0xdcc2('0x76')];}}}if(_['isNil'](_0x464380[_0xdcc2('0x6f')])){_0x464380[_0xdcc2('0x6f')]=_0x19f9b0+0x1;}return _0x152a7e(_0x464380);});});})['catch'](function(_0x16db05){_0xa86aac(_0x16db05);});});}function updateUser(_0x17df29){return new BPromise(function(_0x177daf,_0x7ab5e7){try{if(_0x17df29[_0xdcc2('0x7a')]){_0x17df29[_0xdcc2('0x7b')]=_0x17df29[_0xdcc2('0x6f')];_0x17df29[_0xdcc2('0x7c')]={'mailbox':_0x17df29[_0xdcc2('0x6f')],'password':_0x17df29[_0xdcc2('0x46')],'fullname':_0x17df29[_0xdcc2('0x7d')],'email':_0x17df29[_0xdcc2('0x7e')]};}if(_0x17df29[_0xdcc2('0x33')]===_0xdcc2('0x7f')){if(!_0x17df29[_0xdcc2('0x80')])_0x17df29[_0xdcc2('0x80')]=['101','102','103',_0xdcc2('0x81'),_0xdcc2('0x82'),_0xdcc2('0x83'),_0xdcc2('0x84'),_0xdcc2('0x85'),_0xdcc2('0x86'),_0xdcc2('0x87'),_0xdcc2('0x88'),'100',_0xdcc2('0x89'),'114',_0xdcc2('0x8a')];}_0x177daf(_0x17df29);}catch(_0x1e7a38){_0x7ab5e7(_0x1e7a38);}});}exports[_0xdcc2('0x8b')]=function(_0x5c68d9,_0x175f66){if(_0x5c68d9['user'][_0xdcc2('0x33')]===_0xdcc2('0x7f'))throw new Error(_0xdcc2('0x8c'));if(_0x5c68d9[_0xdcc2('0x6b')][_0xdcc2('0x33')]==='user'&&_0x5c68d9[_0xdcc2('0x35')][_0xdcc2('0x33')]!==_0xdcc2('0x34')){throw new Error(_0xdcc2('0x8d'));}if(_0x5c68d9['body']['role']===_0xdcc2('0x34')&&_0x5c68d9[_0xdcc2('0x35')]['role']!==_0xdcc2('0x34')){throw new Error(_0xdcc2('0x8e'));}return licenseUtil['checkUserLimits']([_0x5c68d9[_0xdcc2('0x6b')]])['then'](function(){return validateUser(_0x5c68d9[_0xdcc2('0x6b')]);})[_0xdcc2('0x1f')](function(_0x42b38c){return updateUser(_0x42b38c)[_0xdcc2('0x1f')](function(_0x58315a){if(_0x58315a[_0xdcc2('0x33')]===_0xdcc2('0x34')){_0x58315a[_0xdcc2('0x8f')]=_0x5c68d9[_0xdcc2('0x35')][_0xdcc2('0x8f')];delete _0x58315a[_0xdcc2('0x90')];}return _0x58315a;});})[_0xdcc2('0x1f')](function(_0x1b1278){return db[_0xdcc2('0x41')][_0xdcc2('0x8b')](_0x1b1278,{'include':[{'model':db[_0xdcc2('0x7c')],'as':'VoiceMail'}]});})[_0xdcc2('0x1f')](function(_0x5c29f0){if(_0x5c68d9[_0xdcc2('0x6b')][_0xdcc2('0x33')]===_0xdcc2('0x35'))return _0x5c29f0;if(_0x5c68d9[_0xdcc2('0x35')][_0xdcc2('0x33')]!==_0xdcc2('0x35'))return _0x5c29f0;return db[_0xdcc2('0x91')]['find']({'where':{'name':_0x5c29f0[_0xdcc2('0x33')]===_0xdcc2('0x7f')?_0xdcc2('0x36'):_0xdcc2('0x37'),'userProfileId':_0x5c68d9['user'][_0xdcc2('0x90')]},'raw':!![]})['then'](function(_0x552ae3){if(!_0x552ae3||_0x552ae3[_0xdcc2('0x92')]!=0x0)return _0x5c29f0;return db[_0xdcc2('0x3e')][_0xdcc2('0x8b')]({'name':_0x5c29f0[_0xdcc2('0x3d')],'resourceId':_0x5c29f0['id'],'type':_0x552ae3[_0xdcc2('0x3d')],'sectionId':_0x552ae3['id']},{})[_0xdcc2('0x1f')](function(){return _0x5c29f0;});})[_0xdcc2('0x27')](function(_0x35ce7e){logger[_0xdcc2('0x23')](_0xdcc2('0x93'),_0x35ce7e);throw _0x35ce7e;});})['then'](respondWithResult(_0x175f66,0xc9))[_0xdcc2('0x27')](handleError(_0x175f66,null));};exports[_0xdcc2('0x94')]=function(_0x28ad8c,_0x12cc4d){var _0x48028f=_0x28ad8c['body'];var _0x5ba57e=[];if(_0x28ad8c['user'][_0xdcc2('0x33')]===_0xdcc2('0x7f'))throw new Error(_0xdcc2('0x8c'));if(_[_0xdcc2('0x95')](_0x48028f,[_0xdcc2('0x33'),_0xdcc2('0x35')])&&_0x28ad8c[_0xdcc2('0x35')][_0xdcc2('0x33')]!=='admin'){throw new Error(_0xdcc2('0x8d'));}if(_[_0xdcc2('0x95')](_0x48028f,[_0xdcc2('0x33'),_0xdcc2('0x34')])&&_0x28ad8c['user'][_0xdcc2('0x33')]!==_0xdcc2('0x34')){throw new Error(_0xdcc2('0x96'));}return licenseUtil[_0xdcc2('0x97')](_0x48028f)[_0xdcc2('0x1f')](function(){return validateUser(_0x48028f[0x0]);})[_0xdcc2('0x1f')](function(){for(var _0x161145=0x1;_0x161145<_0x48028f['length'];_0x161145++){var _0x317640=_0x48028f[_0x161145-0x1][_0xdcc2('0x6f')];if(!_0x48028f[_0x161145]['internal'])_0x48028f[_0x161145][_0xdcc2('0x6f')]=_0x317640+0x1;_0x5ba57e['push'](validateUser(_0x48028f[_0x161145]));}return BPromise[_0xdcc2('0x6a')](_0x5ba57e);})[_0xdcc2('0x1f')](function(){_0x5ba57e=[];for(var _0x4bd7f8=0x0;_0x4bd7f8<_0x48028f[_0xdcc2('0x4e')];_0x4bd7f8++){_0x5ba57e['push'](updateUser(_0x48028f[_0x4bd7f8]));}return BPromise['all'](_0x5ba57e);})[_0xdcc2('0x1f')](function(){return BPromise['each'](_0x48028f,function(_0x56e111){return db[_0xdcc2('0x41')][_0xdcc2('0x8b')](_0x56e111,{'include':[{'model':db[_0xdcc2('0x7c')],'as':_0xdcc2('0x7c')}]})['then'](function(_0x50f7cd){_0x56e111['id']=_0x50f7cd['id'];return _0x56e111;});});})[_0xdcc2('0x1f')](function(_0x23c921){if(_0x28ad8c['body'][_0xdcc2('0x33')]===_0xdcc2('0x35'))return _0x23c921;if(_0x28ad8c[_0xdcc2('0x35')][_0xdcc2('0x33')]!=='user')return _0x23c921;var _0x30c80f=_[_0xdcc2('0x95')](_0x23c921,function(_0x7e0ace){return _0x7e0ace['role']===_0xdcc2('0x7f')||_0x7e0ace[_0xdcc2('0x33')]===_0xdcc2('0x98');});if(!_0x30c80f)return _0x23c921;return db[_0xdcc2('0x91')]['findAll']({'where':{'name':{'$or':[_0xdcc2('0x36'),'Telephones']},'userProfileId':_0x28ad8c[_0xdcc2('0x35')][_0xdcc2('0x90')]},'raw':!![]})[_0xdcc2('0x1f')](function(_0x254e6a){if(_['isEmpty'](_0x254e6a)||!_[_0xdcc2('0x95')](_0x254e6a,[_0xdcc2('0x92'),0x0]))return _0x23c921;_0x5ba57e=[];var _0x37bb64=_(_0x254e6a)[_0xdcc2('0x3a')](function(_0x4c3430){if(_0x4c3430[_0xdcc2('0x92')]===0x1)return;return _0x4c3430['name']==='Agents'?_0xdcc2('0x7f'):_0xdcc2('0x98');})['compact']()[_0xdcc2('0x3b')]();for(var _0x369b05=0x0;_0x369b05<_0x23c921['length'];_0x369b05++){if(!_[_0xdcc2('0x5b')](_0x37bb64,_0x23c921[_0x369b05][_0xdcc2('0x33')]))return;var _0x14d19d=_0x23c921[_0x369b05][_0xdcc2('0x33')]==='agent'?_0xdcc2('0x36'):_0xdcc2('0x37');_0x5ba57e['push'](db[_0xdcc2('0x3e')][_0xdcc2('0x8b')]({'name':_0x23c921[_0x369b05][_0xdcc2('0x3d')],'resourceId':_0x23c921[_0x369b05]['id'],'type':_0x14d19d,'sectionId':_[_0xdcc2('0x3c')](_0x254e6a,[_0xdcc2('0x3d'),_0x14d19d])['id']},{}));}return BPromise['all'](_0x5ba57e);});})['then'](respondWithResult(_0x12cc4d,0xc9))[_0xdcc2('0x27')](handleError(_0x12cc4d,null));};exports[_0xdcc2('0x99')]=function(_0x41998d,_0x5d05a8,_0x292072){if(_0x41998d[_0xdcc2('0x6b')]['id']){delete _0x41998d[_0xdcc2('0x6b')]['id'];}return db[_0xdcc2('0x41')]['find']({'where':{'id':_0x41998d[_0xdcc2('0x68')]['id']}})[_0xdcc2('0x1f')](function(_0x2a3b57){if(!_0x2a3b57)return null;if(_0x2a3b57['id']===_0x41998d['user']['id']){if(!_0x41998d[_0xdcc2('0x6b')][_0xdcc2('0x9a')]||!_0x41998d[_0xdcc2('0x6b')][_0xdcc2('0x9b')]){throw new db[(_0xdcc2('0x9c'))][(_0xdcc2('0x9d'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x2a3b57[_0xdcc2('0x9e')](_0x41998d[_0xdcc2('0x6b')][_0xdcc2('0x9a')])){throw new db['Sequelize'][(_0xdcc2('0x9d'))](_0xdcc2('0x9f'));}if(_0x41998d[_0xdcc2('0x6b')][_0xdcc2('0x9a')]===_0x41998d['body'][_0xdcc2('0x9b')]){throw new db[(_0xdcc2('0x9c'))][(_0xdcc2('0x9d'))](_0xdcc2('0xa0'));}}else if(_0x41998d[_0xdcc2('0x35')][_0xdcc2('0x33')]===_0xdcc2('0x34')){if(!_0x41998d[_0xdcc2('0x6b')][_0xdcc2('0x9b')]){throw new db[(_0xdcc2('0x9c'))][(_0xdcc2('0x9d'))](_0xdcc2('0xa1'));}}else if(_0x41998d[_0xdcc2('0x35')]['role']==='user'){if(!_0x41998d['body'][_0xdcc2('0x9b')]){throw new db[(_0xdcc2('0x9c'))][(_0xdcc2('0x9d'))](_0xdcc2('0xa1'));}if(_0x2a3b57[_0xdcc2('0x33')]!==_0xdcc2('0x7f')){throw new db['Sequelize']['ValidationError'](_0xdcc2('0x8c'));}}else{throw new db['Sequelize']['ValidationError'](_0xdcc2('0x8c'));}return _0x2a3b57;})[_0xdcc2('0x1f')](handleEntityNotFound(_0x5d05a8,null))[_0xdcc2('0x1f')](function(_0x3d1c91){return db[_0xdcc2('0x70')][_0xdcc2('0xa2')]({'attributes':['id',_0xdcc2('0x72'),'enforcePasswordHistory',_0xdcc2('0xa3')]})[_0xdcc2('0x1f')](function(_0x4ad1fa){if(_0x4ad1fa[_0xdcc2('0x72')])authService['validatePasswordPattern'](_0x41998d['body']['newPassword']);if(!_0x4ad1fa[_0xdcc2('0xa4')]||!_0x3d1c91['previousPasswords'])return _0x3d1c91;authService['validatePasswordHistory'](_0x41998d[_0xdcc2('0x6b')][_0xdcc2('0x9b')],_0x3d1c91[_0xdcc2('0xa5')],_0x4ad1fa['passwordHistoryLimit']);return _0x3d1c91;})[_0xdcc2('0x1f')](saveUpdates({'password':_0x41998d[_0xdcc2('0x6b')][_0xdcc2('0x9b')],'passwordResetAt':_0x41998d['user']['id']==_0x41998d[_0xdcc2('0x68')]['id']?moment():null,'previousPasswords':authService[_0xdcc2('0xa6')](_0x41998d[_0xdcc2('0x6b')]['newPassword'],_0x3d1c91[_0xdcc2('0xa5')])},null));})[_0xdcc2('0x1f')](respondWithResult(_0x5d05a8,null))[_0xdcc2('0x27')](handleError(_0x5d05a8,null));};exports[_0xdcc2('0xa7')]=function(_0x507aa7,_0x45d603,_0x40b775){var _0x4654bd=_0x507aa7[_0xdcc2('0x6b')]['channel'];return db[_0xdcc2('0x41')][_0xdcc2('0x3c')]({'where':{'id':_0x507aa7[_0xdcc2('0x68')]['id']},'attributes':['id','name',_0xdcc2('0x33'),'online',_0xdcc2('0xa8'),_0xdcc2('0xa9'),_0xdcc2('0xaa')]})[_0xdcc2('0x1f')](handleEntityNotFound(_0x45d603,null))[_0xdcc2('0x1f')](function(_0x284feb){if(_0x284feb){if(!utils[_0xdcc2('0xab')](_0x4654bd)){throw new db[(_0xdcc2('0x9c'))]['ValidationError'](_0xdcc2('0xac'));}return _0x284feb[_0xdcc2('0xad')+_[_0xdcc2('0xae')](_0x4654bd[_0xdcc2('0xaf')]())+_0xdcc2('0xb0')](_0x507aa7[_0xdcc2('0x6b')]['ids'],{'penalty':_0x507aa7['body']['penalty']||0x0})[_0xdcc2('0xb1')](function(_0xeea87){for(var _0x47ab7a=0x0;_0x47ab7a<_0x507aa7['body'][_0xdcc2('0x6e')][_0xdcc2('0x4e')];_0x47ab7a+=0x1){var _0xe299d8={'UserId':_0x507aa7[_0xdcc2('0x68')]['id']};_0xe299d8[_['capitalize'](_0x4654bd[_0xdcc2('0xaf')]())+_0xdcc2('0xb2')]=_0x507aa7[_0xdcc2('0x6b')][_0xdcc2('0x6e')][_0x47ab7a];socket['emit'](_0xdcc2('0x35')+_[_0xdcc2('0xae')](_0x4654bd[_0xdcc2('0xaf')]())+'Queue:save',_0xe299d8);}return _0xeea87;})['then'](function(){if(_0x4654bd===_0xdcc2('0xb3')){return db[_0xdcc2('0xb4')]['findAll']({'where':{'id':_0x507aa7[_0xdcc2('0x6b')][_0xdcc2('0x6e')]||[]},'raw':!![],'attributes':['id',_0xdcc2('0x3d')]});}})[_0xdcc2('0x1f')](function(_0x546e34){var _0x2a30e2=_0x284feb[_0xdcc2('0x32')]({'plain':!![]});var _0x2053e6=[];if(_0x4654bd===_0xdcc2('0xb3')&&_0x2a30e2[_0xdcc2('0x33')]===_0xdcc2('0x7f')&&_0x2a30e2[_0xdcc2('0xb5')]){for(var _0x201043=0x0;_0x201043<_0x546e34[_0xdcc2('0x4e')];_0x201043+=0x1){_0x2053e6[_0xdcc2('0x5c')]({'membername':_0x2a30e2[_0xdcc2('0x3d')],'UserId':_0x2a30e2['id'],'queue_name':_0x546e34[_0x201043][_0xdcc2('0x3d')],'VoiceQueueId':_0x546e34[_0x201043]['id'],'interface':_[_0xdcc2('0x75')](_0x2a30e2[_0xdcc2('0xaa')])?util[_0xdcc2('0xb6')](_0xdcc2('0xb7'),_0x2a30e2[_0xdcc2('0x3d')]):_0x2a30e2['interface'],'paused':_0x2a30e2['voicePause']||![],'penalty':_0x507aa7[_0xdcc2('0x6b')]['penalty']||0x0});}return BPromise[_0xdcc2('0xb8')](_0x2053e6,function(_0x4b3bf8){return db[_0xdcc2('0xb9')][_0xdcc2('0xba')](_0x4b3bf8);});}return _0x284feb;});}})[_0xdcc2('0x1f')](respondWithStatusCode(_0x45d603,null))[_0xdcc2('0x27')](handleError(_0x45d603,null));};exports['removeQueues']=function(_0x4fc3a8,_0x2d90c8,_0x494c0e){var _0x57801e;return db[_0xdcc2('0x41')][_0xdcc2('0x3c')]({'where':{'id':_0x4fc3a8['params']['id']},'attributes':['id',_0xdcc2('0x3d'),_0xdcc2('0x33')]})['then'](handleEntityNotFound(_0x2d90c8,null))[_0xdcc2('0x1f')](function(_0x20f3d1){if(_0x20f3d1){_0x57801e=_0x20f3d1;if(!_0x4fc3a8[_0xdcc2('0x49')]['channel']||!utils['isValidChannel'](_0x4fc3a8[_0xdcc2('0x49')]['channel'])){throw new db[(_0xdcc2('0x9c'))][(_0xdcc2('0x9d'))](_0xdcc2('0xac'));}return _0x20f3d1[_0xdcc2('0xbb')+_[_0xdcc2('0xae')](_0x4fc3a8['query']['channel'][_0xdcc2('0xaf')]())+_0xdcc2('0xb0')](_0x4fc3a8[_0xdcc2('0x49')][_0xdcc2('0x6e')]);}})[_0xdcc2('0x1f')](function(_0x564c8e){for(var _0x47a184=0x0;_0x47a184<_0x4fc3a8[_0xdcc2('0x49')][_0xdcc2('0x6e')][_0xdcc2('0x4e')];_0x47a184+=0x1){var _0x45ea54={'UserId':_0x4fc3a8[_0xdcc2('0x68')]['id']};_0x45ea54[_[_0xdcc2('0xae')](_0x4fc3a8[_0xdcc2('0x49')][_0xdcc2('0xbc')][_0xdcc2('0xaf')]())+_0xdcc2('0xb2')]=_0x4fc3a8[_0xdcc2('0x49')][_0xdcc2('0x6e')][_0x47a184];socket[_0xdcc2('0xbd')]('user'+_[_0xdcc2('0xae')](_0x4fc3a8[_0xdcc2('0x49')][_0xdcc2('0xbc')][_0xdcc2('0xaf')]())+'Queue:remove',_0x45ea54);}return _0x564c8e;})['then'](function(){if(_0x4fc3a8['query'][_0xdcc2('0xbc')]===_0xdcc2('0xb3')){return db[_0xdcc2('0xb9')]['destroy']({'where':{'UserId':_0x4fc3a8[_0xdcc2('0x68')]['id'],'VoiceQueueId':_0x4fc3a8[_0xdcc2('0x49')][_0xdcc2('0x6e')]},'individualHooks':!![]})[_0xdcc2('0x1f')](function(){return _0x57801e;});}return _0x57801e;})[_0xdcc2('0x1f')](respondWithStatusCode(_0x2d90c8,null))['catch'](handleError(_0x2d90c8,null));};exports['addAvatar']=function(_0xbe9935,_0x400ed8,_0x261500){_0xbe9935[_0xdcc2('0x6b')][_0xdcc2('0xbe')]=_0xbe9935[_0xdcc2('0xbf')][_0xdcc2('0xc0')];return db['User']['find']({'where':{'id':_0xbe9935[_0xdcc2('0x68')]['id']}})[_0xdcc2('0x1f')](handleEntityNotFound(_0x400ed8,null))['then'](saveUpdates(_0xbe9935['body'],null))['then'](respondWithResult(_0x400ed8,null))['catch'](handleError(_0x400ed8,null));};exports[_0xdcc2('0xc1')]=function(_0x203bef,_0x59dcca,_0x3c5b1c){var _0x2ff0d1=path['join'](config[_0xdcc2('0xc2')],_0xdcc2('0xc3'));return db[_0xdcc2('0x41')][_0xdcc2('0x3c')]({'where':{'id':_0x203bef['params']['id']},'attributes':['id',_0xdcc2('0xbe')],'raw':!![]})[_0xdcc2('0x1f')](handleEntityNotFound(_0x59dcca,null))[_0xdcc2('0x1f')](function(_0x3c0a26){if(_0x3c0a26){if(_['isNil'](_0x3c0a26['userpic'])){return _0x59dcca[_0xdcc2('0xc4')](_0x2ff0d1);}else{if(!fs[_0xdcc2('0xc5')](path[_0xdcc2('0xc6')](config[_0xdcc2('0xc2')],_0xdcc2('0xc7'),_0x3c0a26[_0xdcc2('0xbe')]))){return _0x59dcca[_0xdcc2('0xc4')](_0x2ff0d1);}return _0x59dcca[_0xdcc2('0xc4')](path[_0xdcc2('0xc6')](config[_0xdcc2('0xc2')],'server/files/images/',_0x3c0a26[_0xdcc2('0xbe')]));}}})['catch'](handleError(_0x59dcca,null));};exports[_0xdcc2('0xc8')]=function(_0x1abef3,_0x4f805e,_0x29b27a){return db['User']['find']({'where':{'id':_0x1abef3[_0xdcc2('0x68')]['id']},'attributes':['id']})[_0xdcc2('0x1f')](handleEntityNotFound(_0x4f805e,null))[_0xdcc2('0x1f')](function(_0x2ff5f0){var _0x5ccb4c=[];values=_0x2ff5f0[_0xdcc2('0x62')];_0x5ccb4c[_0xdcc2('0x5c')](get_open_tabs(_0xdcc2('0x61'),_0x2ff5f0[_0xdcc2('0x62')]));_0x5ccb4c[_0xdcc2('0x5c')](get_open_tabs(_0xdcc2('0x69'),_0x2ff5f0[_0xdcc2('0x62')]));_0x5ccb4c[_0xdcc2('0x5c')](get_open_tabs('openchannel',_0x2ff5f0[_0xdcc2('0x62')]));_0x5ccb4c['push'](get_open_tabs(_0xdcc2('0x66'),_0x2ff5f0['dataValues']));_0x5ccb4c[_0xdcc2('0x5c')](get_open_tabs(_0xdcc2('0x63'),_0x2ff5f0[_0xdcc2('0x62')]));_0x5ccb4c[_0xdcc2('0x5c')](get_open_tabs(_0xdcc2('0x64'),_0x2ff5f0[_0xdcc2('0x62')]));return BPromise['all'](_0x5ccb4c);})[_0xdcc2('0x1f')](function(_0x5478d4){var _0x3256f7=[];if(_0x5478d4){for(var _0x31dfcf=0x0;_0x31dfcf=_0x32cba6[_0xa3e7('0x4f')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xa3e7('0xf')](function(){if(_0x407c39){return db[_0xa3e7('0x28')][_0xa3e7('0x46')]({'where':{'membername':_0x407c39[_0xa3e7('0x25')]},'individualHooks':!![]});}})[_0xa3e7('0xf')](function(){if(_0x407c39){return _0x407c39[_0xa3e7('0x50')]({'raw':!![]});}})[_0xa3e7('0xf')](function(_0xbaf1a2){if(_0x407c39){if(_0xbaf1a2){var _0x38e7db=[];_0x27371f=_0xbaf1a2;if(_0x27371f['length']){for(var _0x3e5949=0x0;_0x3e5949<_0x27371f[_0xa3e7('0x2b')];_0x3e5949++){_0x38e7db[_0xa3e7('0x44')](db[_0xa3e7('0x28')][_0xa3e7('0x51')]({'membername':_0x407c39[_0xa3e7('0x25')],'UserId':_0x407c39['id'],'queue_name':_0x27371f[_0x3e5949][_0xa3e7('0x25')],'VoiceQueueId':_0x27371f[_0x3e5949]['id'],'interface':_0x473709,'paused':_0x407c39['loginInPause']||![],'penalty':_0x27371f[_0x3e5949][_0xa3e7('0x52')]||0x0}));}return BPromise[_0xa3e7('0x45')](_0x38e7db);}}}})[_0xa3e7('0xf')](function(){if(_0x407c39){return db['MemberReport'][_0xa3e7('0x2a')]({'where':{'membername':_0x407c39['name'],'exitAt':null}});}})['then'](function(_0x204dd3){if(_0x407c39){if(_0x204dd3&&_0x204dd3[_0xa3e7('0x2b')]){var _0x5e45d8=[];_0x204dd3[_0xa3e7('0x2f')](function(_0x53ad4f){_0x5e45d8[_0xa3e7('0x44')](_0x53ad4f['update']({'exitAt':moment()[_0xa3e7('0x32')](_0xa3e7('0x2c'))}));});return BPromise[_0xa3e7('0x45')](_0x5e45d8);}}})[_0xa3e7('0xf')](function(_0x234e9f){if(_0x407c39){var _0x4653f7=[];var _0x219a61=[];var _0x50a4a4=utils['getChannels']();var _0x28f438={'membername':_0x407c39[_0xa3e7('0x25')],'interface':_0x473709,'enterAt':moment()[_0xa3e7('0x32')](_0xa3e7('0x2c')),'role':_0x407c39[_0xa3e7('0x26')],'internal':_0x407c39[_0xa3e7('0x36')]};_0x50a4a4['forEach'](function(_0x4f4461){_0x4653f7[_0xa3e7('0x44')](_[_0xa3e7('0x53')]({'channel':_0x4f4461,'type':'LOGIN','data1':_0xa3e7('0x54'),'data2':_0x473709},_0x28f438));if(_0x407c39['loginInPause']){_0x219a61[_0xa3e7('0x44')](_[_0xa3e7('0x53')]({'channel':_0x4f4461,'type':'PAUSE','data1':_0xa3e7('0x55')},_0x28f438));}});return db[_0xa3e7('0x3b')][_0xa3e7('0x56')](_0x4653f7[_0xa3e7('0x57')](_0x219a61),{'individualHooks':!![]});}})['then'](function(){if(_0x407c39){return _0x407c39[_0xa3e7('0x29')]({'online':!![],'lastLoginAt':moment()[_0xa3e7('0x32')](_0xa3e7('0x2c')),'voicePause':_0x407c39[_0xa3e7('0x4a')]||![],'mailPause':_0x407c39[_0xa3e7('0x4a')]||![],'chatPause':_0x407c39[_0xa3e7('0x4a')]||![],'faxPause':_0x407c39[_0xa3e7('0x4a')]||![],'smsPause':_0x407c39[_0xa3e7('0x4a')]||![],'openchannelPause':_0x407c39[_0xa3e7('0x4a')]||![],'pauseType':_0x407c39[_0xa3e7('0x4a')]?_0xa3e7('0x55'):null,'lastPauseAt':moment()[_0xa3e7('0x32')](_0xa3e7('0x2c')),'interface':_0x473709});}})[_0xa3e7('0xf')](function(_0x4bc90d){_0x4aed8a(_0x4bc90d);})[_0xa3e7('0x18')](function(_0x153146){_0x16b6f5(_0x36ff8f[_0xa3e7('0x16')](0x1f4,_0x153146[_0xa3e7('0x17')]));});});}; \ No newline at end of file +var _0x9151=['count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','merge','callysquare','LOGININPAUSE','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./user.socket','register','request','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetUser','User','options','raw','where','attributes','limit','include','model','map','then','ShowUser','find','PauseUser','name','role','internal','update','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','push','interface','PAUSE','body','type','DEFAULT\x20PAUSE','uniqueid','MemberReport','bulkCreate','channel','isValidChannel','system','mail','chat','fax','sms','openchannel','whatsapp','%s%s','Pause','UserVoiceQueueRt','forEach','LogoutUser','findOne','destroy','all','LoginUser','mobile','loginInPause','SIP/%s'];(function(_0x342753,_0x505c4f){var _0x3b3940=function(_0x2c89fd){while(--_0x2c89fd){_0x342753['push'](_0x342753['shift']());}};_0x3b3940(++_0x505c4f);}(_0x9151,0x115));var _0x1915=function(_0x45cea1,_0x45db40){_0x45cea1=_0x45cea1-0x0;var _0xda8ddd=_0x9151[_0x45cea1];return _0xda8ddd;};'use strict';var _=require(_0x1915('0x0'));var util=require('util');var moment=require(_0x1915('0x1'));var BPromise=require(_0x1915('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1915('0x3'))['db'];var utils=require(_0x1915('0x4'));var logger=require(_0x1915('0x5'))(_0x1915('0x6'));var config=require(_0x1915('0x7'));var jayson=require(_0x1915('0x8'));var client=jayson['client'][_0x1915('0x9')]({'port':0x232a});config['redis']=_[_0x1915('0xa')](config[_0x1915('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1915('0xc'))(new Redis(config[_0x1915('0xb')]));require(_0x1915('0xd'))[_0x1915('0xe')](socket);function respondWithRpcPromise(_0x42bf0a,_0x3fb9ca,_0x11b1dd){return new BPromise(function(_0x4e5f4e,_0x2858ac){return client[_0x1915('0xf')](_0x42bf0a,_0x11b1dd)['then'](function(_0x5bc786){logger[_0x1915('0x10')](_0x1915('0x11'),_0x3fb9ca,'request\x20sent');logger[_0x1915('0x12')](_0x1915('0x13'),_0x3fb9ca,_0x1915('0x14'),JSON[_0x1915('0x15')](_0x5bc786));if(_0x5bc786[_0x1915('0x16')]){if(_0x5bc786[_0x1915('0x16')]['code']===0x1f4){logger[_0x1915('0x16')]('User,\x20%s,\x20%s',_0x3fb9ca,_0x5bc786[_0x1915('0x16')][_0x1915('0x17')]);return _0x2858ac(_0x5bc786[_0x1915('0x16')][_0x1915('0x17')]);}logger[_0x1915('0x16')](_0x1915('0x11'),_0x3fb9ca,_0x5bc786[_0x1915('0x16')][_0x1915('0x17')]);return _0x4e5f4e(_0x5bc786[_0x1915('0x16')]['message']);}else{logger[_0x1915('0x10')](_0x1915('0x11'),_0x3fb9ca,_0x1915('0x14'));_0x4e5f4e(_0x5bc786[_0x1915('0x18')][_0x1915('0x17')]);}})[_0x1915('0x19')](function(_0x186f9b){logger[_0x1915('0x16')](_0x1915('0x11'),_0x3fb9ca,_0x186f9b);_0x2858ac(_0x186f9b);});});}exports[_0x1915('0x1a')]=function(_0x1b01a1){var _0xc546ee=this;return new Promise(function(_0x4ea75d,_0x2984ef){return db[_0x1915('0x1b')]['findAll']({'raw':_0x1b01a1[_0x1915('0x1c')]?_0x1b01a1[_0x1915('0x1c')][_0x1915('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b01a1[_0x1915('0x1c')]?_0x1b01a1[_0x1915('0x1c')][_0x1915('0x1e')]||null:null,'attributes':_0x1b01a1[_0x1915('0x1c')]?_0x1b01a1[_0x1915('0x1c')][_0x1915('0x1f')]||null:null,'limit':_0x1b01a1['options']?_0x1b01a1[_0x1915('0x1c')][_0x1915('0x20')]||null:null,'include':_0x1b01a1[_0x1915('0x1c')]?_0x1b01a1['options'][_0x1915('0x21')]?_['map'](_0x1b01a1[_0x1915('0x1c')][_0x1915('0x21')],function(_0x4002d4){return{'model':db[_0x4002d4[_0x1915('0x22')]],'as':_0x4002d4['as'],'attributes':_0x4002d4[_0x1915('0x1f')],'include':_0x4002d4[_0x1915('0x21')]?_[_0x1915('0x23')](_0x4002d4[_0x1915('0x21')],function(_0x5c8183){return{'model':db[_0x5c8183['model']],'as':_0x5c8183['as'],'attributes':_0x5c8183[_0x1915('0x1f')],'include':_0x5c8183['include']?_[_0x1915('0x23')](_0x5c8183[_0x1915('0x21')],function(_0x2d8d0f){return{'model':db[_0x2d8d0f['model']],'as':_0x2d8d0f['as'],'attributes':_0x2d8d0f[_0x1915('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1915('0x24')](function(_0x4d1fdc){logger[_0x1915('0x10')](_0x1915('0x1a'),_0x1b01a1);logger['debug']('GetUser',_0x1b01a1,JSON[_0x1915('0x15')](_0x4d1fdc));_0x4ea75d(_0x4d1fdc);})['catch'](function(_0x398577){logger['error'](_0x1915('0x1a'),_0x398577[_0x1915('0x17')],_0x1b01a1);_0x2984ef(_0xc546ee[_0x1915('0x16')](0x1f4,_0x398577['message']));});});};exports[_0x1915('0x25')]=function(_0x25a9b4){var _0x428018=this;return new Promise(function(_0x255479,_0x386d14){return db[_0x1915('0x1b')][_0x1915('0x26')]({'raw':_0x25a9b4['options']?_0x25a9b4[_0x1915('0x1c')][_0x1915('0x1d')]===undefined?!![]:![]:!![],'where':_0x25a9b4[_0x1915('0x1c')]?_0x25a9b4[_0x1915('0x1c')][_0x1915('0x1e')]||null:null,'attributes':_0x25a9b4['options']?_0x25a9b4[_0x1915('0x1c')][_0x1915('0x1f')]||null:null,'include':_0x25a9b4['options']?_0x25a9b4['options'][_0x1915('0x21')]?_[_0x1915('0x23')](_0x25a9b4[_0x1915('0x1c')]['include'],function(_0x43137a){return{'model':db[_0x43137a[_0x1915('0x22')]],'as':_0x43137a['as'],'attributes':_0x43137a['attributes'],'include':_0x43137a[_0x1915('0x21')]?_[_0x1915('0x23')](_0x43137a[_0x1915('0x21')],function(_0x27b61d){return{'model':db[_0x27b61d[_0x1915('0x22')]],'as':_0x27b61d['as'],'attributes':_0x27b61d[_0x1915('0x1f')],'include':_0x27b61d['include']?_[_0x1915('0x23')](_0x27b61d[_0x1915('0x21')],function(_0x34d9bc){return{'model':db[_0x34d9bc[_0x1915('0x22')]],'as':_0x34d9bc['as'],'attributes':_0x34d9bc[_0x1915('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1915('0x24')](function(_0x35a55b){logger[_0x1915('0x10')]('ShowUser',_0x25a9b4);logger[_0x1915('0x12')](_0x1915('0x25'),_0x25a9b4,JSON[_0x1915('0x15')](_0x35a55b));_0x255479(_0x35a55b);})[_0x1915('0x19')](function(_0x42d390){logger[_0x1915('0x16')](_0x1915('0x25'),_0x42d390['message'],_0x25a9b4);_0x386d14(_0x428018[_0x1915('0x16')](0x1f4,_0x42d390['message']));});});};exports[_0x1915('0x27')]=function(_0x497ff7){var _0x1532ef=this;return new Promise(function(_0x1a354e,_0x26ade0){var _0x23bbf5;return db[_0x1915('0x1b')][_0x1915('0x26')]({'where':_0x497ff7['options']['where']||{},'attributes':['id',_0x1915('0x28'),_0x1915('0x29'),_0x1915('0x2a'),'interface']})[_0x1915('0x24')](function(_0x4f1638){if(_0x4f1638){_0x23bbf5=_0x4f1638;return db['UserVoiceQueueRt'][_0x1915('0x2b')]({'paused':0x1},{'where':{'UserId':_0x23bbf5['id']},'individualHooks':!![]});}})[_0x1915('0x24')](function(){if(_0x23bbf5){return db['MemberReport'][_0x1915('0x2c')]({'where':{'membername':_0x23bbf5[_0x1915('0x28')],'type':'PAUSE','exitAt':null}});}})[_0x1915('0x24')](function(_0x3377d6){if(_0x23bbf5){if(_0x3377d6&&_0x3377d6[_0x1915('0x2d')]){var _0x488bdc=moment()[_0x1915('0x2e')](_0x1915('0x2f'));for(var _0x5d44bb=0x0,_0x393385=_0x3377d6['length'];_0x5d44bb<_0x393385;_0x5d44bb++){_0x3377d6[_0x5d44bb]['updateAttributes']({'exitAt':_0x488bdc});}}}})[_0x1915('0x24')](function(){if(_0x23bbf5){var _0x3acf2f=[];var _0x3c02ee=utils[_0x1915('0x30')]();_0x3c02ee['forEach'](function(_0x23ea9c){_0x3acf2f[_0x1915('0x31')]({'channel':_0x23ea9c,'membername':_0x23bbf5[_0x1915('0x28')],'interface':_['isNil'](_0x23bbf5[_0x1915('0x32')])?util['format']('SIP/%s',_0x23bbf5[_0x1915('0x28')]):_0x23bbf5[_0x1915('0x32')],'type':_0x1915('0x33'),'enterAt':moment()[_0x1915('0x2e')](_0x1915('0x2f')),'data1':_0x497ff7[_0x1915('0x34')][_0x1915('0x35')]||_0x1915('0x36'),'role':_0x23bbf5[_0x1915('0x29')],'internal':_0x23bbf5[_0x1915('0x2a')],'uniqueid':_0x497ff7[_0x1915('0x34')][_0x1915('0x37')]||null});});return db[_0x1915('0x38')][_0x1915('0x39')](_0x3acf2f,{'individualHooks':!![]});}})[_0x1915('0x24')](function(){if(_0x23bbf5){return _0x23bbf5[_0x1915('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x497ff7[_0x1915('0x34')][_0x1915('0x35')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x1915('0x2e')](_0x1915('0x2f'))});}})[_0x1915('0x24')](function(_0x50c347){_0x1a354e(_0x50c347);})['catch'](function(_0x25ee3e){_0x26ade0(_0x1532ef['error'](0x1f4,_0x25ee3e['message']));});});};exports['UnpauseUser']=function(_0x159a42){var _0x167546=this;return new Promise(function(_0x3c3f1a,_0x2d1e4b){var _0x5aa434;return db['User']['findOne']({'where':_0x159a42[_0x1915('0x1c')][_0x1915('0x1e')]||{},'attributes':['id','name']})[_0x1915('0x24')](function(_0x15ab17){if(_0x15ab17){_0x5aa434=_0x15ab17;if(_0x159a42[_0x1915('0x34')][_0x1915('0x3a')]&&!utils[_0x1915('0x3b')](_0x159a42[_0x1915('0x34')][_0x1915('0x3a')])){throw new Error('Unknown\x20channel');}switch(_0x159a42['body'][_0x1915('0x3a')]){case'voice':return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x5aa434['id']}})[_0x1915('0x24')](function(){return db[_0x1915('0x38')]['find']({'where':{'channel':_0x159a42['body'][_0x1915('0x3a')],'membername':_0x5aa434[_0x1915('0x28')],'type':_0x1915('0x33'),'exitAt':null}});})[_0x1915('0x24')](function(_0x312fcc){if(_0x312fcc){return _0x312fcc[_0x1915('0x2b')]({'exitAt':moment()[_0x1915('0x2e')](_0x1915('0x2f')),'data2':_0x1915('0x3c')},{'individualHooks':!![]});}return null;})[_0x1915('0x24')](function(){return _0x5aa434[_0x1915('0x2b')]({'voicePause':![]});});case _0x1915('0x3d'):case _0x1915('0x3e'):case _0x1915('0x3f'):case _0x1915('0x40'):case _0x1915('0x41'):case _0x1915('0x42'):return db[_0x1915('0x38')][_0x1915('0x26')]({'where':{'channel':_0x159a42['body'][_0x1915('0x3a')],'membername':_0x5aa434[_0x1915('0x28')],'type':'PAUSE','exitAt':null}})['then'](function(_0x2d88d2){return _0x2d88d2[_0x1915('0x2b')]({'exitAt':moment()['format'](_0x1915('0x2f')),'data2':_0x1915('0x3c')},{'individualHooks':!![]});})['then'](function(){var _0x26f7a8={};_['set'](_0x26f7a8,util['format'](_0x1915('0x43'),_0x159a42[_0x1915('0x34')][_0x1915('0x3a')],_0x1915('0x44')),![]);return _0x5aa434[_0x1915('0x2b')](_0x26f7a8);});default:return db[_0x1915('0x45')]['update']({'paused':0x0},{'where':{'UserId':_0x5aa434['id']}})[_0x1915('0x24')](function(){return db[_0x1915('0x38')][_0x1915('0x2c')]({'where':{'membername':_0x5aa434[_0x1915('0x28')],'type':_0x1915('0x33'),'exitAt':null}});})[_0x1915('0x24')](function(_0x2bf540){var _0x385d41=[];_0x2bf540[_0x1915('0x46')](function(_0x18a25e){_0x385d41['push'](_0x18a25e['update']({'exitAt':moment()[_0x1915('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'}));});return BPromise['all'](_0x385d41);})[_0x1915('0x24')](function(){return _0x5aa434[_0x1915('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x1915('0x24')](function(_0x1c4e4b){_0x3c3f1a(_0x1c4e4b);})[_0x1915('0x19')](function(_0xbeb19d){_0x2d1e4b(_0x167546[_0x1915('0x16')](0x1f4,_0xbeb19d[_0x1915('0x17')]));});});};exports[_0x1915('0x47')]=function(_0xcc56bc){var _0x328adc=this;return new Promise(function(_0xc9f6a3,_0x26c48a){var _0x5f295b;return db[_0x1915('0x1b')][_0x1915('0x48')]({'where':_0xcc56bc['options'][_0x1915('0x1e')]||{},'attributes':['id','name']})['then'](function(_0x6f08d1){if(_0x6f08d1){_0x5f295b=_0x6f08d1;return db[_0x1915('0x45')][_0x1915('0x49')]({'where':{'membername':_0x5f295b[_0x1915('0x28')]},'individualHooks':!![]});}})[_0x1915('0x24')](function(){if(_0x5f295b){return db[_0x1915('0x38')][_0x1915('0x2c')]({'where':{'membername':_0x5f295b[_0x1915('0x28')],'exitAt':null}});}})[_0x1915('0x24')](function(_0x3f88a6){if(_0x5f295b){if(_0x3f88a6&&_0x3f88a6['length']){var _0x3eaf22=[];_0x3f88a6[_0x1915('0x46')](function(_0x519cfa){_0x3eaf22[_0x1915('0x31')](_0x519cfa[_0x1915('0x2b')]({'exitAt':moment()['format'](_0x1915('0x2f'))}));});return BPromise[_0x1915('0x4a')](_0x3eaf22);}}})[_0x1915('0x24')](function(){if(_0x5f295b){return _0x5f295b['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x1915('0x24')](function(_0x56cde2){_0xc9f6a3(_0x56cde2);})[_0x1915('0x19')](function(_0x5eaa03){_0x26c48a(_0x328adc[_0x1915('0x16')](0x1f4,_0x5eaa03[_0x1915('0x17')]));});});};exports[_0x1915('0x4b')]=function(_0x5464ab){var _0xa00f1f=this;return new Promise(function(_0x15b171,_0x257a4b){var _0x3e3c18;var _0x2c3b20;var _0x4b7fe0;var _0x5c9e30;return db[_0x1915('0x1b')][_0x1915('0x48')]({'where':_0x5464ab[_0x1915('0x1c')][_0x1915('0x1e')]||{},'attributes':['id',_0x1915('0x28'),'role',_0x1915('0x4c'),'phone','internal',_0x1915('0x4d'),'interface']})[_0x1915('0x24')](function(_0x2d812b){if(_0x2d812b){_0x3e3c18=_0x2d812b;_0x5c9e30=_0x5464ab['body'][_0x1915('0x32')]?_0x5464ab[_0x1915('0x34')][_0x1915('0x32')]:util[_0x1915('0x2e')](_0x1915('0x4e'),_0x3e3c18[_0x1915('0x28')]);return db['User'][_0x1915('0x4f')]({'where':{'role':_0x1915('0x50'),'online':!![],'id':{'$ne':_0x3e3c18['id']}}});}})[_0x1915('0x24')](function(_0x4a30f6){if(_0x4a30f6){_0x4b7fe0=_0x4a30f6;return require(_0x1915('0x51'))[_0x1915('0x52')]();}})[_0x1915('0x24')](function(_0x29fa7a){if(_0x29fa7a&&_0x29fa7a[_0x1915('0x53')]&&_0x4b7fe0>=_0x29fa7a[_0x1915('0x53')]){throw new Error(_0x1915('0x54'));}})[_0x1915('0x24')](function(){if(_0x3e3c18){return db['UserVoiceQueueRt'][_0x1915('0x49')]({'where':{'membername':_0x3e3c18[_0x1915('0x28')]},'individualHooks':!![]});}})[_0x1915('0x24')](function(){if(_0x3e3c18){return _0x3e3c18[_0x1915('0x55')]({'raw':!![]});}})['then'](function(_0x4fd630){if(_0x3e3c18){if(_0x4fd630){var _0x5902d0=[];_0x2c3b20=_0x4fd630;if(_0x2c3b20[_0x1915('0x2d')]){for(var _0x317dfd=0x0;_0x317dfd<_0x2c3b20['length'];_0x317dfd++){_0x5902d0[_0x1915('0x31')](db[_0x1915('0x45')]['upsert']({'membername':_0x3e3c18['name'],'UserId':_0x3e3c18['id'],'queue_name':_0x2c3b20[_0x317dfd]['name'],'VoiceQueueId':_0x2c3b20[_0x317dfd]['id'],'interface':_0x5c9e30,'paused':_0x3e3c18['loginInPause']||![],'penalty':_0x2c3b20[_0x317dfd]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x5902d0);}}}})[_0x1915('0x24')](function(){if(_0x3e3c18){return db['MemberReport'][_0x1915('0x2c')]({'where':{'membername':_0x3e3c18[_0x1915('0x28')],'exitAt':null}});}})['then'](function(_0x3350fe){if(_0x3e3c18){if(_0x3350fe&&_0x3350fe['length']){var _0x2020a4=[];_0x3350fe[_0x1915('0x46')](function(_0x4f05f3){_0x2020a4[_0x1915('0x31')](_0x4f05f3[_0x1915('0x2b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x2020a4);}}})[_0x1915('0x24')](function(_0x36c80d){if(_0x3e3c18){var _0x3fb730=[];var _0x52c241=[];var _0x87eaba=utils[_0x1915('0x30')]();var _0x17514b={'membername':_0x3e3c18[_0x1915('0x28')],'interface':_0x5c9e30,'enterAt':moment()['format'](_0x1915('0x2f')),'role':_0x3e3c18[_0x1915('0x29')],'internal':_0x3e3c18[_0x1915('0x2a')]};_0x87eaba[_0x1915('0x46')](function(_0x9e1786){_0x3fb730['push'](_[_0x1915('0x56')]({'channel':_0x9e1786,'type':'LOGIN','data1':_0x1915('0x57'),'data2':_0x5c9e30},_0x17514b));if(_0x3e3c18['loginInPause']){_0x52c241[_0x1915('0x31')](_['merge']({'channel':_0x9e1786,'type':'PAUSE','data1':_0x1915('0x58')},_0x17514b));}});return db[_0x1915('0x38')][_0x1915('0x39')](_0x3fb730['concat'](_0x52c241),{'individualHooks':!![]});}})[_0x1915('0x24')](function(){if(_0x3e3c18){return _0x3e3c18['update']({'online':!![],'lastLoginAt':moment()[_0x1915('0x2e')](_0x1915('0x2f')),'voicePause':_0x3e3c18['loginInPause']||![],'mailPause':_0x3e3c18[_0x1915('0x4d')]||![],'chatPause':_0x3e3c18['loginInPause']||![],'faxPause':_0x3e3c18['loginInPause']||![],'smsPause':_0x3e3c18['loginInPause']||![],'openchannelPause':_0x3e3c18['loginInPause']||![],'pauseType':_0x3e3c18[_0x1915('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x1915('0x2e')](_0x1915('0x2f')),'interface':_0x5c9e30});}})[_0x1915('0x24')](function(_0x50aeef){_0x15b171(_0x50aeef);})[_0x1915('0x19')](function(_0x2098ee){_0x257a4b(_0xa00f1f[_0x1915('0x16')](0x1f4,_0x2098ee[_0x1915('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 884a899..c872ceb 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 _0xb9f1=['user:','remove','update','removeListener','register','length'];(function(_0x2799c9,_0x1e0606){var _0x6786b3=function(_0x324f89){while(--_0x324f89){_0x2799c9['push'](_0x2799c9['shift']());}};_0x6786b3(++_0x1e0606);}(_0xb9f1,0x1cf));var _0x1b9f=function(_0x1ba26d,_0x53aa69){_0x1ba26d=_0x1ba26d-0x0;var _0x1398eb=_0xb9f1[_0x1ba26d];return _0x1398eb;};'use strict';var UserEvents=require('./user.events');var events=['save',_0x1b9f('0x0'),_0x1b9f('0x1')];function createListener(_0xd4e256,_0x886f66){return function(_0xacb7dd){_0x886f66['emit'](_0xd4e256,_0xacb7dd);};}function removeListener(_0x276932,_0xa1636e){return function(){UserEvents[_0x1b9f('0x2')](_0x276932,_0xa1636e);};}exports[_0x1b9f('0x3')]=function(_0xa518db){for(var _0x4f2879=0x0,_0x5ca7f2=events[_0x1b9f('0x4')];_0x4f2879<_0x5ca7f2;_0x4f2879++){var _0x3b200c=events[_0x4f2879];var _0x340bb=createListener(_0x1b9f('0x5')+_0x3b200c,_0xa518db);UserEvents['on'](_0x3b200c,_0x340bb);}}; \ No newline at end of file +var _0xcd0a=['./user.events','save','update','register','user:'];(function(_0x15b31e,_0x157139){var _0x5970f6=function(_0x275218){while(--_0x275218){_0x15b31e['push'](_0x15b31e['shift']());}};_0x5970f6(++_0x157139);}(_0xcd0a,0x109));var _0xacd0=function(_0x43f1b5,_0xcee793){_0x43f1b5=_0x43f1b5-0x0;var _0x3e01a9=_0xcd0a[_0x43f1b5];return _0x3e01a9;};'use strict';var UserEvents=require(_0xacd0('0x0'));var events=[_0xacd0('0x1'),'remove',_0xacd0('0x2')];function createListener(_0x4cd8b8,_0x366928){return function(_0x3c1a27){_0x366928['emit'](_0x4cd8b8,_0x3c1a27);};}function removeListener(_0x4b9ce8,_0x38a79f){return function(){UserEvents['removeListener'](_0x4b9ce8,_0x38a79f);};}exports[_0xacd0('0x3')]=function(_0x2f1d5e){for(var _0x2d8d90=0x0,_0x411052=events['length'];_0x2d8d90<_0x411052;_0x2d8d90++){var _0x2f3bc7=events[_0x2d8d90];var _0x58c174=createListener(_0xacd0('0x4')+_0x2f3bc7,_0x2f1d5e);UserEvents['on'](_0x2f3bc7,_0x58c174);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 3e0e6a7..c10682c 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 _0x5bc5=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x119b96,_0x587acd){var _0x516cbf=function(_0x5d4b36){while(--_0x5d4b36){_0x119b96['push'](_0x119b96['shift']());}};_0x516cbf(++_0x587acd);}(_0x5bc5,0xb2));var _0x55bc=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0x5bc5[_0x571a17];return _0x3ef337;};'use strict';var multer=require(_0x55bc('0x0'));var util=require(_0x55bc('0x1'));var path=require(_0x55bc('0x2'));var timeout=require(_0x55bc('0x3'));var express=require(_0x55bc('0x4'));var router=express[_0x55bc('0x5')]();var fs_extra=require(_0x55bc('0x6'));var auth=require(_0x55bc('0x7'));var interaction=require(_0x55bc('0x8'));var config=require(_0x55bc('0x9'));module[_0x55bc('0xa')]=router; \ No newline at end of file +var _0xa693=['exports','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa693,0xf1));var _0x3a69=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xa693[_0x40bffc];return _0x3007e9;};'use strict';var multer=require(_0x3a69('0x0'));var util=require(_0x3a69('0x1'));var path=require(_0x3a69('0x2'));var timeout=require(_0x3a69('0x3'));var express=require(_0x3a69('0x4'));var router=express[_0x3a69('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3a69('0x6'));module[_0x3a69('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index c21ecf7..3f2c409 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x5a9e99,_0x7fec4e){var _0x55960e=function(_0x957994){while(--_0x957994){_0x5a9e99['push'](_0x5a9e99['shift']());}};_0x55960e(++_0x7fec4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x4b3300,_0x1137f1){var _0x2d26d3=function(_0x4678b5){while(--_0x4678b5){_0x4b3300['push'](_0x4b3300['shift']());}};_0x2d26d3(++_0x1137f1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('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 d738bc6..3859656 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 _0x08b7=['moment','request-promise','path','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x08b7,0xce));var _0x708b=function(_0x49fcef,_0x4c7dd7){_0x49fcef=_0x49fcef-0x0;var _0xba68e8=_0x08b7[_0x49fcef];return _0xba68e8;};'use strict';var _=require(_0x708b('0x0'));var util=require(_0x708b('0x1'));var logger=require(_0x708b('0x2'))('api');var moment=require(_0x708b('0x3'));var BPromise=require('bluebird');var rp=require(_0x708b('0x4'));var fs=require('fs');var path=require(_0x708b('0x5'));var rimraf=require('rimraf');var config=require(_0x708b('0x6'));var attributes=require('./userChatQueue.attributes');module[_0x708b('0x7')]=function(_0x2cca99,_0x4a6edc){return _0x2cca99[_0x708b('0x8')](_0x708b('0x9'),attributes,{'tableName':_0x708b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00bb=['path','../../config/environment','define','UserChatQueue','lodash','api','moment','bluebird'];(function(_0x561458,_0x225481){var _0x1a8d5f=function(_0x4fe001){while(--_0x4fe001){_0x561458['push'](_0x561458['shift']());}};_0x1a8d5f(++_0x225481);}(_0x00bb,0x1bc));var _0xb00b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x00bb[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xb00b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require(_0xb00b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb00b('0x4'));var rimraf=require('rimraf');var config=require(_0xb00b('0x5'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x52f448,_0x3861b9){return _0x52f448[_0xb00b('0x6')](_0xb00b('0x7'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index d517e73..b4cc985 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 _0x6e9a=['result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x33b0ac,_0x385378){var _0x888a0a=function(_0xd4151e){while(--_0xd4151e){_0x33b0ac['push'](_0x33b0ac['shift']());}};_0x888a0a(++_0x385378);}(_0x6e9a,0x105));var _0xa6e9=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0x6e9a[_0x1f7839];return _0x36b42e;};'use strict';var _=require('lodash');var util=require(_0xa6e9('0x0'));var moment=require(_0xa6e9('0x1'));var BPromise=require(_0xa6e9('0x2'));var rs=require(_0xa6e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa6e9('0x4'));var logger=require(_0xa6e9('0x5'))(_0xa6e9('0x6'));var config=require(_0xa6e9('0x7'));var jayson=require(_0xa6e9('0x8'));var client=jayson[_0xa6e9('0x9')][_0xa6e9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b32d9,_0x112dce,_0x412e31){return new BPromise(function(_0x419190,_0x54c86a){return client[_0xa6e9('0xb')](_0x4b32d9,_0x412e31)['then'](function(_0x215844){logger[_0xa6e9('0xc')](_0xa6e9('0xd'),_0x112dce,_0xa6e9('0xe'));logger['debug'](_0xa6e9('0xf'),_0x112dce,'request\x20sent',JSON['stringify'](_0x215844));if(_0x215844['error']){if(_0x215844[_0xa6e9('0x10')][_0xa6e9('0x11')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x112dce,_0x215844[_0xa6e9('0x10')][_0xa6e9('0x12')]);return _0x54c86a(_0x215844[_0xa6e9('0x10')][_0xa6e9('0x12')]);}logger[_0xa6e9('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x112dce,_0x215844['error']['message']);return _0x419190(_0x215844[_0xa6e9('0x10')][_0xa6e9('0x12')]);}else{logger[_0xa6e9('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x112dce,'request\x20sent');_0x419190(_0x215844[_0xa6e9('0x13')][_0xa6e9('0x12')]);}})['catch'](function(_0x46f16e){logger[_0xa6e9('0x10')](_0xa6e9('0xd'),_0x112dce,_0x46f16e);_0x54c86a(_0x46f16e);});});} \ No newline at end of file +var _0x8bcc=['../../config/logger','../../config/environment','jayson/promise','client','http','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils'];(function(_0x2962b3,_0x21c7cd){var _0x3af541=function(_0x42efab){while(--_0x42efab){_0x2962b3['push'](_0x2962b3['shift']());}};_0x3af541(++_0x21c7cd);}(_0x8bcc,0x9b));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8bc('0x0'));var util=require('util');var moment=require(_0xc8bc('0x1'));var BPromise=require('bluebird');var rs=require(_0xc8bc('0x2'));var fs=require('fs');var Redis=require(_0xc8bc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8bc('0x4'));var logger=require(_0xc8bc('0x5'))('rpc');var config=require(_0xc8bc('0x6'));var jayson=require(_0xc8bc('0x7'));var client=jayson[_0xc8bc('0x8')][_0xc8bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x108d73,_0x3c5056,_0x3a0e4d){return new BPromise(function(_0x191d97,_0x3f4fcd){return client['request'](_0x108d73,_0x3a0e4d)['then'](function(_0x1fa155){logger[_0xc8bc('0xa')](_0xc8bc('0xb'),_0x3c5056,_0xc8bc('0xc'));logger[_0xc8bc('0xd')](_0xc8bc('0xe'),_0x3c5056,'request\x20sent',JSON[_0xc8bc('0xf')](_0x1fa155));if(_0x1fa155['error']){if(_0x1fa155[_0xc8bc('0x10')][_0xc8bc('0x11')]===0x1f4){logger[_0xc8bc('0x10')](_0xc8bc('0xb'),_0x3c5056,_0x1fa155[_0xc8bc('0x10')][_0xc8bc('0x12')]);return _0x3f4fcd(_0x1fa155['error'][_0xc8bc('0x12')]);}logger[_0xc8bc('0x10')](_0xc8bc('0xb'),_0x3c5056,_0x1fa155[_0xc8bc('0x10')][_0xc8bc('0x12')]);return _0x191d97(_0x1fa155[_0xc8bc('0x10')][_0xc8bc('0x12')]);}else{logger[_0xc8bc('0xa')](_0xc8bc('0xb'),_0x3c5056,_0xc8bc('0xc'));_0x191d97(_0x1fa155[_0xc8bc('0x13')][_0xc8bc('0x12')]);}})['catch'](function(_0x505d8b){logger[_0xc8bc('0x10')](_0xc8bc('0xb'),_0x3c5056,_0x505d8b);_0x3f4fcd(_0x505d8b);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 5fdab5c..45022a8 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 _0x57ef=['../../components/auth/service','../../config/environment','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x11262c,_0x20d80b){var _0x23977b=function(_0x273f88){while(--_0x273f88){_0x11262c['push'](_0x11262c['shift']());}};_0x23977b(++_0x20d80b);}(_0x57ef,0xdb));var _0xf57e=function(_0x335c22,_0x196f28){_0x335c22=_0x335c22-0x0;var _0x17c27f=_0x57ef[_0x335c22];return _0x17c27f;};'use strict';var multer=require('multer');var util=require(_0xf57e('0x0'));var path=require(_0xf57e('0x1'));var timeout=require(_0xf57e('0x2'));var express=require(_0xf57e('0x3'));var router=express[_0xf57e('0x4')]();var fs_extra=require(_0xf57e('0x5'));var auth=require(_0xf57e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf57e('0x7'));module[_0xf57e('0x8')]=router; \ No newline at end of file +var _0x5713=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1e2843,_0x51fde1){var _0x43130c=function(_0x2c11cf){while(--_0x2c11cf){_0x1e2843['push'](_0x1e2843['shift']());}};_0x43130c(++_0x51fde1);}(_0x5713,0x1c7));var _0x3571=function(_0x48242b,_0x29a02a){_0x48242b=_0x48242b-0x0;var _0x421547=_0x5713[_0x48242b];return _0x421547;};'use strict';var multer=require(_0x3571('0x0'));var util=require(_0x3571('0x1'));var path=require('path');var timeout=require(_0x3571('0x2'));var express=require('express');var router=express[_0x3571('0x3')]();var fs_extra=require(_0x3571('0x4'));var auth=require(_0x3571('0x5'));var interaction=require(_0x3571('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 2258219..5bd8df7 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 _0xef0f=['sequelize','INTEGER','STRING'];(function(_0x1d8aa8,_0x516d5c){var _0x341198=function(_0x393cce){while(--_0x393cce){_0x1d8aa8['push'](_0x1d8aa8['shift']());}};_0x341198(++_0x516d5c);}(_0xef0f,0x168));var _0xfef0=function(_0x1f14f0,_0x3c0777){_0x1f14f0=_0x1f14f0-0x0;var _0x8993ee=_0xef0f[_0x1f14f0];return _0x8993ee;};'use strict';var Sequelize=require(_0xfef0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xfef0('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xfef0('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfef0('0x2')]}}; \ No newline at end of file +var _0x3266=['INTEGER','STRING','sequelize','exports'];(function(_0x28fcdd,_0x285b05){var _0x9ba030=function(_0x51b5f9){while(--_0x51b5f9){_0x28fcdd['push'](_0x28fcdd['shift']());}};_0x9ba030(++_0x285b05);}(_0x3266,0x6a));var _0x6326=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x3266[_0xef8146];return _0x5a6cb0;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'penalty':{'type':Sequelize[_0x6326('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6326('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6326('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 94fb248..fa80d92 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 _0x9d9b=['rimraf','./userFaxQueue.attributes','UserFaxQueue','user_has_fax_queues','util','../../config/logger','moment','request-promise','path'];(function(_0x5c37c6,_0x91f386){var _0x3f9108=function(_0x56f38b){while(--_0x56f38b){_0x5c37c6['push'](_0x5c37c6['shift']());}};_0x3f9108(++_0x91f386);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x425530,_0x34e60a){_0x425530=_0x425530-0x0;var _0x44f21a=_0x9d9b[_0x425530];return _0x44f21a;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var logger=require(_0xb9d9('0x1'))('api');var moment=require(_0xb9d9('0x2'));var BPromise=require('bluebird');var rp=require(_0xb9d9('0x3'));var fs=require('fs');var path=require(_0xb9d9('0x4'));var rimraf=require(_0xb9d9('0x5'));var config=require('../../config/environment');var attributes=require(_0xb9d9('0x6'));module['exports']=function(_0x1b1f3c,_0x32cf18){return _0x1b1f3c['define'](_0xb9d9('0x7'),attributes,{'tableName':_0xb9d9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88de=['UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','path','rimraf','./userFaxQueue.attributes','define'];(function(_0x50fde6,_0x2f0179){var _0x3ae544=function(_0x11b657){while(--_0x11b657){_0x50fde6['push'](_0x50fde6['shift']());}};_0x3ae544(++_0x2f0179);}(_0x88de,0x19c));var _0xe88d=function(_0x2cc855,_0x2b73a8){_0x2cc855=_0x2cc855-0x0;var _0x2409d7=_0x88de[_0x2cc855];return _0x2409d7;};'use strict';var _=require(_0xe88d('0x0'));var util=require(_0xe88d('0x1'));var logger=require(_0xe88d('0x2'))(_0xe88d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe88d('0x4'));var rimraf=require(_0xe88d('0x5'));var config=require('../../config/environment');var attributes=require(_0xe88d('0x6'));module['exports']=function(_0x33ce64,_0x1b94dc){return _0x33ce64[_0xe88d('0x7')](_0xe88d('0x8'),attributes,{'tableName':_0xe88d('0x9'),'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 9174f5b..469d29b 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 _0xb714=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','message','UserFaxQueue,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5ba63a,_0x5d1460){var _0xeb082f=function(_0x111d3a){while(--_0x111d3a){_0x5ba63a['push'](_0x5ba63a['shift']());}};_0xeb082f(++_0x5d1460);}(_0xb714,0xa9));var _0x4b71=function(_0x38b257,_0x505a1e){_0x38b257=_0x38b257-0x0;var _0x30791d=_0xb714[_0x38b257];return _0x30791d;};'use strict';var _=require('lodash');var util=require(_0x4b71('0x0'));var moment=require(_0x4b71('0x1'));var BPromise=require(_0x4b71('0x2'));var rs=require(_0x4b71('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b71('0x4'))['db'];var utils=require(_0x4b71('0x5'));var logger=require(_0x4b71('0x6'))(_0x4b71('0x7'));var config=require(_0x4b71('0x8'));var jayson=require(_0x4b71('0x9'));var client=jayson[_0x4b71('0xa')][_0x4b71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9826fc,_0x7c66bb,_0x1383c5){return new BPromise(function(_0x5b82bb,_0x5c20cc){return client[_0x4b71('0xc')](_0x9826fc,_0x1383c5)['then'](function(_0x20cc09){logger[_0x4b71('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x7c66bb,_0x4b71('0xe'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x7c66bb,_0x4b71('0xe'),JSON[_0x4b71('0xf')](_0x20cc09));if(_0x20cc09['error']){if(_0x20cc09[_0x4b71('0x10')][_0x4b71('0x11')]===0x1f4){logger[_0x4b71('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x7c66bb,_0x20cc09['error'][_0x4b71('0x12')]);return _0x5c20cc(_0x20cc09[_0x4b71('0x10')][_0x4b71('0x12')]);}logger[_0x4b71('0x10')](_0x4b71('0x13'),_0x7c66bb,_0x20cc09[_0x4b71('0x10')][_0x4b71('0x12')]);return _0x5b82bb(_0x20cc09[_0x4b71('0x10')][_0x4b71('0x12')]);}else{logger[_0x4b71('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x7c66bb,'request\x20sent');_0x5b82bb(_0x20cc09[_0x4b71('0x14')]['message']);}})[_0x4b71('0x15')](function(_0x49ee1c){logger[_0x4b71('0x10')](_0x4b71('0x13'),_0x7c66bb,_0x49ee1c);_0x5c20cc(_0x49ee1c);});});} \ No newline at end of file +var _0xc8a4=['UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc8a4,0x99));var _0x4c8a=function(_0x35391f,_0x1644fe){_0x35391f=_0x35391f-0x0;var _0x243a7d=_0xc8a4[_0x35391f];return _0x243a7d;};'use strict';var _=require(_0x4c8a('0x0'));var util=require(_0x4c8a('0x1'));var moment=require(_0x4c8a('0x2'));var BPromise=require(_0x4c8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c8a('0x4'));var db=require(_0x4c8a('0x5'))['db'];var utils=require(_0x4c8a('0x6'));var logger=require(_0x4c8a('0x7'))(_0x4c8a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4c8a('0x9')][_0x4c8a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c4840,_0x978125,_0x150534){return new BPromise(function(_0x4c2b34,_0x1293ca){return client['request'](_0x4c4840,_0x150534)[_0x4c8a('0xb')](function(_0x372e3a){logger['info'](_0x4c8a('0xc'),_0x978125,_0x4c8a('0xd'));logger[_0x4c8a('0xe')](_0x4c8a('0xf'),_0x978125,_0x4c8a('0xd'),JSON['stringify'](_0x372e3a));if(_0x372e3a['error']){if(_0x372e3a[_0x4c8a('0x10')][_0x4c8a('0x11')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x978125,_0x372e3a[_0x4c8a('0x10')][_0x4c8a('0x12')]);return _0x1293ca(_0x372e3a['error'][_0x4c8a('0x12')]);}logger['error'](_0x4c8a('0xc'),_0x978125,_0x372e3a[_0x4c8a('0x10')][_0x4c8a('0x12')]);return _0x4c2b34(_0x372e3a[_0x4c8a('0x10')][_0x4c8a('0x12')]);}else{logger['info'](_0x4c8a('0xc'),_0x978125,_0x4c8a('0xd'));_0x4c2b34(_0x372e3a[_0x4c8a('0x13')][_0x4c8a('0x12')]);}})[_0x4c8a('0x14')](function(_0x43aa10){logger[_0x4c8a('0x10')](_0x4c8a('0xc'),_0x978125,_0x43aa10);_0x1293ca(_0x43aa10);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index a274c7e..2f269b2 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 _0x5d31=['../../config/environment','exports','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x43ec69,_0x209500){var _0x1e0fcb=function(_0x50283c){while(--_0x50283c){_0x43ec69['push'](_0x43ec69['shift']());}};_0x1e0fcb(++_0x209500);}(_0x5d31,0xf7));var _0x15d3=function(_0xff7c05,_0x2456ca){_0xff7c05=_0xff7c05-0x0;var _0x1c1ab9=_0x5d31[_0xff7c05];return _0x1c1ab9;};'use strict';var multer=require('multer');var util=require(_0x15d3('0x0'));var path=require(_0x15d3('0x1'));var timeout=require(_0x15d3('0x2'));var express=require('express');var router=express[_0x15d3('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x15d3('0x4'));var config=require(_0x15d3('0x5'));module[_0x15d3('0x6')]=router; \ No newline at end of file +var _0xa321=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0x24c0d3,_0x1f43d5){var _0x18d947=function(_0x483085){while(--_0x483085){_0x24c0d3['push'](_0x24c0d3['shift']());}};_0x18d947(++_0x1f43d5);}(_0xa321,0x9d));var _0x1a32=function(_0x44606e,_0x2bf244){_0x44606e=_0x44606e-0x0;var _0xe68388=_0xa321[_0x44606e];return _0xe68388;};'use strict';var multer=require(_0x1a32('0x0'));var util=require(_0x1a32('0x1'));var path=require(_0x1a32('0x2'));var timeout=require(_0x1a32('0x3'));var express=require('express');var router=express[_0x1a32('0x4')]();var fs_extra=require(_0x1a32('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1a32('0x6'));var config=require(_0x1a32('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 77185bb..0156915 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x376dba,_0x481693){var _0x3b1b75=function(_0x2019ea){while(--_0x2019ea){_0x376dba['push'](_0x376dba['shift']());}};_0x3b1b75(++_0x481693);}(_0xe706,0xa3));var _0x6e70=function(_0x132ea3,_0x40b0a3){_0x132ea3=_0x132ea3-0x0;var _0x4400bf=_0xe706[_0x132ea3];return _0x4400bf;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x585376,_0x4e8f6c){var _0x979309=function(_0x43f424){while(--_0x43f424){_0x585376['push'](_0x585376['shift']());}};_0x979309(++_0x4e8f6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('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 d6844b9..dfd54e8 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x4d089e,_0x33fb0e){var _0x14115d=function(_0x1c7638){while(--_0x1c7638){_0x4d089e['push'](_0x4d089e['shift']());}};_0x14115d(++_0x33fb0e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','../../config/logger','api'];(function(_0xbee655,_0x511e7c){var _0x115073=function(_0x27ff6a){while(--_0x27ff6a){_0xbee655['push'](_0xbee655['shift']());}};_0x115073(++_0x511e7c);}(_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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index e681b81..b2b9a4d 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 _0x124a=['then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x552b95,_0x5f100e){var _0x203cc4=function(_0x476a64){while(--_0x476a64){_0x552b95['push'](_0x552b95['shift']());}};_0x203cc4(++_0x5f100e);}(_0x124a,0x171));var _0xa124=function(_0x33298b,_0x42f55f){_0x33298b=_0x33298b-0x0;var _0x49bc13=_0x124a[_0x33298b];return _0x49bc13;};'use strict';var _=require(_0xa124('0x0'));var util=require(_0xa124('0x1'));var moment=require(_0xa124('0x2'));var BPromise=require(_0xa124('0x3'));var rs=require(_0xa124('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa124('0x5'));var logger=require(_0xa124('0x6'))('rpc');var config=require(_0xa124('0x7'));var jayson=require(_0xa124('0x8'));var client=jayson[_0xa124('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x421685,_0x4d1d7f,_0x3ab306){return new BPromise(function(_0x2802bf,_0x442d4f){return client[_0xa124('0xa')](_0x421685,_0x3ab306)[_0xa124('0xb')](function(_0x253ef8){logger[_0xa124('0xc')](_0xa124('0xd'),_0x4d1d7f,_0xa124('0xe'));logger[_0xa124('0xf')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x4d1d7f,_0xa124('0xe'),JSON[_0xa124('0x10')](_0x253ef8));if(_0x253ef8[_0xa124('0x11')]){if(_0x253ef8[_0xa124('0x11')]['code']===0x1f4){logger['error'](_0xa124('0xd'),_0x4d1d7f,_0x253ef8[_0xa124('0x11')][_0xa124('0x12')]);return _0x442d4f(_0x253ef8[_0xa124('0x11')]['message']);}logger[_0xa124('0x11')](_0xa124('0xd'),_0x4d1d7f,_0x253ef8[_0xa124('0x11')]['message']);return _0x2802bf(_0x253ef8[_0xa124('0x11')][_0xa124('0x12')]);}else{logger[_0xa124('0xc')](_0xa124('0xd'),_0x4d1d7f,'request\x20sent');_0x2802bf(_0x253ef8[_0xa124('0x13')][_0xa124('0x12')]);}})['catch'](function(_0x44db8c){logger[_0xa124('0x11')](_0xa124('0xd'),_0x4d1d7f,_0x44db8c);_0x442d4f(_0x44db8c);});});} \ No newline at end of file +var _0x2eb2=['request','then','info','request\x20sent','error','UserMailQueue,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x540b9a,_0x20f601){var _0x3cd853=function(_0x4f9016){while(--_0x4f9016){_0x540b9a['push'](_0x540b9a['shift']());}};_0x3cd853(++_0x20f601);}(_0x2eb2,0x19f));var _0x22eb=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x2eb2[_0x3de8a4];return _0x4635cf;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 7b5259e..a49e484 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 _0x6e2f=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x7801b5,_0x4e5612){var _0x3cae8f=function(_0x351e59){while(--_0x351e59){_0x7801b5['push'](_0x7801b5['shift']());}};_0x3cae8f(++_0x4e5612);}(_0x6e2f,0x1a1));var _0xf6e2=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x6e2f[_0x15bc81];return _0x59440e;};'use strict';var multer=require(_0xf6e2('0x0'));var util=require(_0xf6e2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf6e2('0x2'));var router=express[_0xf6e2('0x3')]();var fs_extra=require(_0xf6e2('0x4'));var auth=require(_0xf6e2('0x5'));var interaction=require(_0xf6e2('0x6'));var config=require(_0xf6e2('0x7'));var controller=require(_0xf6e2('0x8'));router[_0xf6e2('0x9')]('/',auth[_0xf6e2('0xa')](),controller[_0xf6e2('0xb')]);module[_0xf6e2('0xc')]=router; \ No newline at end of file +var _0xab02=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x3dd164,_0x1e1866){var _0x4c1bdb=function(_0x592c1c){while(--_0x592c1c){_0x3dd164['push'](_0x3dd164['shift']());}};_0x4c1bdb(++_0x1e1866);}(_0xab02,0x1c9));var _0x2ab0=function(_0x45043b,_0x574c62){_0x45043b=_0x45043b-0x0;var _0x1428b0=_0xab02[_0x45043b];return _0x1428b0;};'use strict';var multer=require(_0x2ab0('0x0'));var util=require('util');var path=require(_0x2ab0('0x1'));var timeout=require(_0x2ab0('0x2'));var express=require(_0x2ab0('0x3'));var router=express[_0x2ab0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2ab0('0x5'));var config=require(_0x2ab0('0x6'));var controller=require(_0x2ab0('0x7'));router[_0x2ab0('0x8')]('/',auth[_0x2ab0('0x9')](),controller[_0x2ab0('0xa')]);module[_0x2ab0('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 32fc4f6..ca414f3 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 _0x2d9e=['exports','TEXT','BOOLEAN','sequelize'];(function(_0x5a44f0,_0x38817e){var _0x16bad2=function(_0x4c64ab){while(--_0x4c64ab){_0x5a44f0['push'](_0x5a44f0['shift']());}};_0x16bad2(++_0x38817e);}(_0x2d9e,0x12f));var _0xe2d9=function(_0x21d627,_0x4e52f9){_0x21d627=_0x21d627-0x0;var _0x2f3d99=_0x2d9e[_0x21d627];return _0x2f3d99;};'use strict';var Sequelize=require(_0xe2d9('0x0'));module[_0xe2d9('0x1')]={'body':{'type':Sequelize[_0xe2d9('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xe2d9('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xe2d9('0x3')]}}; \ No newline at end of file +var _0x951a=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4ac1a2,_0x96a48e){var _0x15c199=function(_0x226120){while(--_0x226120){_0x4ac1a2['push'](_0x4ac1a2['shift']());}};_0x15c199(++_0x96a48e);}(_0x951a,0x140));var _0xa951=function(_0x8e68a5,_0x3e88b1){_0x8e68a5=_0x8e68a5-0x0;var _0x103742=_0x951a[_0x8e68a5];return _0x103742;};'use strict';var Sequelize=require(_0xa951('0x0'));module[_0xa951('0x1')]={'body':{'type':Sequelize[_0xa951('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xa951('0x3')]},'beep':{'type':Sequelize[_0xa951('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 0389d39..4eaa276 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 _0xb5b5=['recipient','emit','userNotification:send','catch','Template','findOne','html','render','forEach','model','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','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','../../mysqldb','defaults','redis','./userNotification.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','sequelize','transaction','UserNotification'];(function(_0x246366,_0x56178a){var _0x3effd4=function(_0x11d64e){while(--_0x11d64e){_0x246366['push'](_0x246366['shift']());}};_0x3effd4(++_0x56178a);}(_0xb5b5,0x138));var _0x5b5b=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0xb5b5[_0x2ac5f8];return _0x3b8229;};'use strict';var emlformat=require(_0x5b5b('0x0'));var rimraf=require(_0x5b5b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b5b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5b5b('0x3'));var util=require(_0x5b5b('0x4'));var path=require(_0x5b5b('0x5'));var sox=require(_0x5b5b('0x6'));var csv=require('to-csv');var ejs=require(_0x5b5b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b5b('0x8'));var squel=require(_0x5b5b('0x9'));var crypto=require(_0x5b5b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5b5b('0xb'));var toCsv=require(_0x5b5b('0xc'));var querystring=require(_0x5b5b('0xd'));var Papa=require('papaparse');var Redis=require(_0x5b5b('0xe'));var authService=require(_0x5b5b('0xf'));var qs=require(_0x5b5b('0x10'));var as=require(_0x5b5b('0x11'));var hardwareService=require(_0x5b5b('0x12'));var logger=require('../../config/logger')(_0x5b5b('0x13'));var utils=require(_0x5b5b('0x14'));var config=require(_0x5b5b('0x15'));var licenseUtil=require(_0x5b5b('0x16'));var db=require(_0x5b5b('0x17'))['db'];config['redis']=_[_0x5b5b('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b5b('0x19')]));require(_0x5b5b('0x1a'))['register'](socket);function respondWithStatusCode(_0x4a06bf,_0x296955){_0x296955=_0x296955||0xcc;return function(_0x5a3b6d){if(_0x5a3b6d){return _0x4a06bf[_0x5b5b('0x1b')](_0x296955);}return _0x4a06bf[_0x5b5b('0x1c')](_0x296955)[_0x5b5b('0x1d')]();};}function respondWithResult(_0x36bec3,_0x4bdc7f){_0x4bdc7f=_0x4bdc7f||0xc8;return function(_0xb24083){if(_0xb24083){return _0x36bec3['status'](_0x4bdc7f)[_0x5b5b('0x1e')](_0xb24083);}};}function respondWithFilteredResult(_0x4ef055,_0x412f15){return function(_0xd8c8e3){if(_0xd8c8e3){var _0x529491=typeof _0x412f15[_0x5b5b('0x1f')]===_0x5b5b('0x20')&&typeof _0x412f15['limit']===_0x5b5b('0x20');var _0x39db66=_0xd8c8e3[_0x5b5b('0x21')];var _0x5aed6b=_0x529491?0x0:_0x412f15[_0x5b5b('0x1f')];var _0x57bda0=_0x529491?_0xd8c8e3[_0x5b5b('0x21')]:_0x412f15[_0x5b5b('0x1f')]+_0x412f15[_0x5b5b('0x22')];var _0x268226;if(_0x57bda0>=_0x39db66){_0x57bda0=_0x39db66;_0x268226=0xc8;}else{_0x268226=0xce;}_0x4ef055[_0x5b5b('0x1c')](_0x268226);return _0x4ef055[_0x5b5b('0x23')]('Content-Range',_0x5aed6b+'-'+_0x57bda0+'/'+_0x39db66)[_0x5b5b('0x1e')](_0xd8c8e3);}return null;};}function patchUpdates(_0x1d28ab){return function(_0x42120b){try{jsonpatch['apply'](_0x42120b,_0x1d28ab,!![]);}catch(_0x45b791){return BPromise[_0x5b5b('0x24')](_0x45b791);}return _0x42120b[_0x5b5b('0x25')]();};}function saveUpdates(_0x17c8a0,_0x278650){return function(_0x909b24){if(_0x909b24){return _0x909b24[_0x5b5b('0x26')](_0x17c8a0)[_0x5b5b('0x27')](function(_0x3d121e){return _0x3d121e;});}return null;};}function removeEntity(_0x4886ac,_0x4cdff1){return function(_0x251c72){if(_0x251c72){return _0x251c72[_0x5b5b('0x28')]()[_0x5b5b('0x27')](function(){_0x4886ac[_0x5b5b('0x1c')](0xcc)[_0x5b5b('0x1d')]();});}};}function handleEntityNotFound(_0x561084,_0x245cd1){return function(_0x2237bd){if(!_0x2237bd){_0x561084['sendStatus'](0x194);}return _0x2237bd;};}function handleError(_0x40b659,_0x2595e3){_0x2595e3=_0x2595e3||0x1f4;return function(_0x3729c8){logger[_0x5b5b('0x29')](_0x3729c8[_0x5b5b('0x2a')]);if(_0x3729c8[_0x5b5b('0x2b')]){delete _0x3729c8[_0x5b5b('0x2b')];}_0x40b659[_0x5b5b('0x1c')](_0x2595e3)['send'](_0x3729c8);};}exports[_0x5b5b('0x2c')]=function(_0x1dd179,_0x4e1948,_0x320e8b){if(!_0x1dd179[_0x5b5b('0x2d')][_0x5b5b('0x2e')](_0x5b5b('0x2f'))&&!_0x1dd179[_0x5b5b('0x2d')][_0x5b5b('0x2e')](_0x5b5b('0x30'))){throw new db[(_0x5b5b('0x31'))][(_0x5b5b('0x32'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x1dd179[_0x5b5b('0x2d')][_0x5b5b('0x2e')]('TemplateId')&&!_0x1dd179[_0x5b5b('0x2d')][_0x5b5b('0x2e')](_0x5b5b('0x33'))){throw new db[(_0x5b5b('0x31'))][(_0x5b5b('0x32'))](_0x5b5b('0x34'));}if(!_0x1dd179[_0x5b5b('0x2d')][_0x5b5b('0x2e')]('recipients')){throw new db[(_0x5b5b('0x31'))][(_0x5b5b('0x32'))](_0x5b5b('0x35'));}else{try{var _0x160138=JSON[_0x5b5b('0x36')](_0x1dd179['body']['recipients']);}catch(_0x57fd4a){logger[_0x5b5b('0x29')](_0x57fd4a);throw new db[(_0x5b5b('0x31'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x5aeecc=[_0x5b5b('0x37'),_0x5b5b('0x38'),_0x5b5b('0x39'),_0x5b5b('0x3a'),_0x5b5b('0x3b'),'voicequeue',_0x5b5b('0x3c'),_0x5b5b('0x3d'),_0x5b5b('0x3e')];if(_[_0x5b5b('0x3f')](_0x160138,function(_0xef0434){return!_[_0x5b5b('0x40')](_0x5aeecc,_0xef0434['model']['toLowerCase']());})){throw new db[(_0x5b5b('0x31'))][(_0x5b5b('0x32'))](_0x5b5b('0x41'));}}}var _0x35f153={};_0x35f153[_0x5b5b('0x42')]=_0x1dd179[_0x5b5b('0x2d')]['hasOwnProperty'](_0x5b5b('0x42'))?_0x1dd179['body'][_0x5b5b('0x42')]:_0x1dd179[_0x5b5b('0x3e')][_0x5b5b('0x43')];_0x35f153[_0x5b5b('0x44')]=_[_0x5b5b('0x45')](_0x1dd179[_0x5b5b('0x2d')]['recipientsDescription'])?null:_0x1dd179['body'][_0x5b5b('0x44')];_0x35f153[_0x5b5b('0x46')]=_0x1dd179[_0x5b5b('0x2d')][_0x5b5b('0x46')]||![];_0x35f153[_0x5b5b('0x47')]=_0x1dd179['user']['id'];return getContent(_0x1dd179[_0x5b5b('0x2d')])[_0x5b5b('0x27')](function(_0x2f08ea){_0x35f153[_0x5b5b('0x2d')]=_0x2f08ea;return getRecipients(_0x160138);})[_0x5b5b('0x27')](function(_0x483847){_0x35f153['recipientsId']=_[_0x5b5b('0x48')](_0x483847)['join'](',');return db[_0x5b5b('0x49')][_0x5b5b('0x4a')](function(_0x16bce0){return db[_0x5b5b('0x4b')]['create'](_0x35f153,{'raw':!![],'transaction':_0x16bce0})[_0x5b5b('0x27')](function(_0x2125b3){var _0x1a32f5={'sender':_0x35f153['senderName'],'description':_0x35f153['recipientsDescription'],'content':_0x35f153[_0x5b5b('0x2d')],'beep':_0x35f153[_0x5b5b('0x46')]};_0x483847['forEach'](function(_0x1fe360){_0x1a32f5[_0x5b5b('0x4c')]=_0x1fe360;socket[_0x5b5b('0x4d')](_0x5b5b('0x4e'),_0x1a32f5);});return _0x2125b3;});});})['then'](respondWithResult(_0x4e1948,0xc9))[_0x5b5b('0x4f')](handleError(_0x4e1948,null));};function getContent(_0x1fb1bf){return new BPromise(function(_0x208a65,_0x1decb4){if(_0x1fb1bf[_0x5b5b('0x2f')]){_0x208a65(_0x1fb1bf[_0x5b5b('0x2f')]);return;}return db[_0x5b5b('0x50')][_0x5b5b('0x51')]({'attributes':[_0x5b5b('0x52')],'where':{'id':_0x1fb1bf[_0x5b5b('0x30')]},'raw':!![]})['then'](function(_0x41d1ac){if(!_0x41d1ac)throw new db[(_0x5b5b('0x31'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3778b9=Mustache[_0x5b5b('0x53')](_0x41d1ac[_0x5b5b('0x52')],_0x1fb1bf['view']);_0x208a65(_0x3778b9);})[_0x5b5b('0x4f')](function(_0x5a6ec8){_0x1decb4(_0x5a6ec8);});});}function getRecipients(_0x1f03f0){return new BPromise(function(_0x45527f,_0x1c9064){var _0x3f02c7=[];var _0x463e7d=[];_0x1f03f0[_0x5b5b('0x54')](function(_0x2d50a2){var _0x5e93c0=_['startCase'](_0x2d50a2[_0x5b5b('0x55')]['toLowerCase']());if(_0x5e93c0===_0x5b5b('0x56')){_0x3f02c7=_[_0x5b5b('0x57')](_0x3f02c7,_0x2d50a2[_0x5b5b('0x58')]);}else{if(_[_0x5b5b('0x40')](_0x5e93c0,_0x5b5b('0x59')))_0x5e93c0=_0x5e93c0[_0x5b5b('0x5a')](_0x5b5b('0x59'),_0x5b5b('0x5b'));_0x2d50a2[_0x5b5b('0x58')]['forEach'](function(_0x3037b6){_0x463e7d[_0x5b5b('0x5c')](getAgents(_0x5e93c0,_0x3037b6));});}});return BPromise[_0x5b5b('0x5d')](_0x463e7d)[_0x5b5b('0x27')](function(_0xecb3ee){_0x3f02c7=_[_0x5b5b('0x57')](_0x3f02c7,_[_0x5b5b('0x5e')](_0xecb3ee));_0x45527f(_0x3f02c7);})[_0x5b5b('0x4f')](function(_0x4daf4c){_0x1c9064(_0x4daf4c);});});}function getAgents(_0x5dd99c,_0x40824d){return new BPromise(function(_0x131055,_0x2ff934){return db[_0x5dd99c][_0x5b5b('0x51')]({'where':{'id':_0x40824d}})[_0x5b5b('0x27')](function(_0x2fe8d7){return _0x2fe8d7[_0x5b5b('0x5f')]({'attributes':['id'],'raw':!![]})[_0x5b5b('0x27')](function(_0x1d1648){var _0x43938b=_[_0x5b5b('0x60')](_0x1d1648,'id');_0x131055(_0x43938b);});})[_0x5b5b('0x4f')](function(_0x45ead4){_0x2ff934(_0x45ead4);});});} \ No newline at end of file +var _0x6953=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','view','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','UserNotification','forEach','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','catch','startCase','model','User','union','ids','includes','push','all','flatten','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x423fc2,_0x2d61d8){var _0x214140=function(_0x671ba4){while(--_0x671ba4){_0x423fc2['push'](_0x423fc2['shift']());}};_0x214140(++_0x2d61d8);}(_0x6953,0xc0));var _0x3695=function(_0x1171eb,_0x43e2fd){_0x1171eb=_0x1171eb-0x0;var _0x3363e3=_0x6953[_0x1171eb];return _0x3363e3;};'use strict';var emlformat=require(_0x3695('0x0'));var rimraf=require(_0x3695('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3695('0x2'));var rp=require(_0x3695('0x3'));var moment=require(_0x3695('0x4'));var BPromise=require(_0x3695('0x5'));var Mustache=require('mustache');var util=require(_0x3695('0x6'));var path=require(_0x3695('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3695('0x8'));var fs=require('fs');var fs_extra=require(_0x3695('0x9'));var _=require(_0x3695('0xa'));var squel=require(_0x3695('0xb'));var crypto=require(_0x3695('0xc'));var jsforce=require(_0x3695('0xd'));var deskjs=require(_0x3695('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3695('0xf'));var Papa=require(_0x3695('0x10'));var Redis=require(_0x3695('0x11'));var authService=require(_0x3695('0x12'));var qs=require(_0x3695('0x13'));var as=require(_0x3695('0x14'));var hardwareService=require(_0x3695('0x15'));var logger=require(_0x3695('0x16'))(_0x3695('0x17'));var utils=require(_0x3695('0x18'));var config=require(_0x3695('0x19'));var licenseUtil=require(_0x3695('0x1a'));var db=require(_0x3695('0x1b'))['db'];config[_0x3695('0x1c')]=_[_0x3695('0x1d')](config[_0x3695('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x3695('0x1e'))(new Redis(config[_0x3695('0x1c')]));require(_0x3695('0x1f'))[_0x3695('0x20')](socket);function respondWithStatusCode(_0x354ddd,_0x106ebc){_0x106ebc=_0x106ebc||0xcc;return function(_0x9adace){if(_0x9adace){return _0x354ddd[_0x3695('0x21')](_0x106ebc);}return _0x354ddd[_0x3695('0x22')](_0x106ebc)[_0x3695('0x23')]();};}function respondWithResult(_0x572347,_0x437d73){_0x437d73=_0x437d73||0xc8;return function(_0x29c0b3){if(_0x29c0b3){return _0x572347['status'](_0x437d73)['json'](_0x29c0b3);}};}function respondWithFilteredResult(_0x540327,_0x2fe8c0){return function(_0x1c57bb){if(_0x1c57bb){var _0x239614=typeof _0x2fe8c0[_0x3695('0x24')]===_0x3695('0x25')&&typeof _0x2fe8c0['limit']==='undefined';var _0x222105=_0x1c57bb[_0x3695('0x26')];var _0x283409=_0x239614?0x0:_0x2fe8c0[_0x3695('0x24')];var _0x7d0334=_0x239614?_0x1c57bb[_0x3695('0x26')]:_0x2fe8c0['offset']+_0x2fe8c0[_0x3695('0x27')];var _0x24de2a;if(_0x7d0334>=_0x222105){_0x7d0334=_0x222105;_0x24de2a=0xc8;}else{_0x24de2a=0xce;}_0x540327[_0x3695('0x22')](_0x24de2a);return _0x540327[_0x3695('0x28')](_0x3695('0x29'),_0x283409+'-'+_0x7d0334+'/'+_0x222105)[_0x3695('0x2a')](_0x1c57bb);}return null;};}function patchUpdates(_0x20f69f){return function(_0x5463cb){try{jsonpatch[_0x3695('0x2b')](_0x5463cb,_0x20f69f,!![]);}catch(_0x20e7e6){return BPromise['reject'](_0x20e7e6);}return _0x5463cb[_0x3695('0x2c')]();};}function saveUpdates(_0xe8e259,_0xe9b1e6){return function(_0x4ffd35){if(_0x4ffd35){return _0x4ffd35['update'](_0xe8e259)[_0x3695('0x2d')](function(_0x5596dc){return _0x5596dc;});}return null;};}function removeEntity(_0x4afd21,_0x48a35d){return function(_0x4ba3a0){if(_0x4ba3a0){return _0x4ba3a0[_0x3695('0x2e')]()[_0x3695('0x2d')](function(){_0x4afd21[_0x3695('0x22')](0xcc)[_0x3695('0x23')]();});}};}function handleEntityNotFound(_0x22e494,_0x504e61){return function(_0x4f471d){if(!_0x4f471d){_0x22e494[_0x3695('0x21')](0x194);}return _0x4f471d;};}function handleError(_0x5c49b5,_0x122f52){_0x122f52=_0x122f52||0x1f4;return function(_0x328e0e){logger[_0x3695('0x2f')](_0x328e0e[_0x3695('0x30')]);if(_0x328e0e[_0x3695('0x31')]){delete _0x328e0e[_0x3695('0x31')];}_0x5c49b5[_0x3695('0x22')](_0x122f52)[_0x3695('0x32')](_0x328e0e);};}exports[_0x3695('0x33')]=function(_0x5b3383,_0xf63131,_0x1c1ddc){if(!_0x5b3383[_0x3695('0x34')][_0x3695('0x35')]('text')&&!_0x5b3383[_0x3695('0x34')][_0x3695('0x35')](_0x3695('0x36'))){throw new db[(_0x3695('0x37'))][(_0x3695('0x38'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x5b3383[_0x3695('0x34')][_0x3695('0x35')]('TemplateId')&&!_0x5b3383[_0x3695('0x34')][_0x3695('0x35')](_0x3695('0x39'))){throw new db['Sequelize']['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x5b3383[_0x3695('0x34')][_0x3695('0x35')](_0x3695('0x3a'))){throw new db[(_0x3695('0x37'))][(_0x3695('0x38'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x3e57c0=JSON[_0x3695('0x3b')](_0x5b3383[_0x3695('0x34')]['recipients']);}catch(_0x279c6f){logger[_0x3695('0x2f')](_0x279c6f);throw new db[(_0x3695('0x37'))][(_0x3695('0x38'))](_0x3695('0x3c'));}var _0x491856=[_0x3695('0x3d'),_0x3695('0x3e'),_0x3695('0x3f'),_0x3695('0x40'),_0x3695('0x41'),_0x3695('0x42'),_0x3695('0x43'),_0x3695('0x44'),_0x3695('0x45')];if(_[_0x3695('0x46')](_0x3e57c0,function(_0x173684){return!_['includes'](_0x491856,_0x173684['model'][_0x3695('0x47')]());})){throw new db[(_0x3695('0x37'))][(_0x3695('0x38'))](_0x3695('0x48'));}}}var _0x1568e4={};_0x1568e4[_0x3695('0x49')]=_0x5b3383[_0x3695('0x34')]['hasOwnProperty']('senderName')?_0x5b3383[_0x3695('0x34')][_0x3695('0x49')]:_0x5b3383[_0x3695('0x45')][_0x3695('0x4a')];_0x1568e4[_0x3695('0x4b')]=_[_0x3695('0x4c')](_0x5b3383[_0x3695('0x34')]['recipientsDescription'])?null:_0x5b3383['body'][_0x3695('0x4b')];_0x1568e4[_0x3695('0x4d')]=_0x5b3383[_0x3695('0x34')][_0x3695('0x4d')]||![];_0x1568e4[_0x3695('0x4e')]=_0x5b3383[_0x3695('0x45')]['id'];return getContent(_0x5b3383[_0x3695('0x34')])[_0x3695('0x2d')](function(_0x51f52f){_0x1568e4[_0x3695('0x34')]=_0x51f52f;return getRecipients(_0x3e57c0);})[_0x3695('0x2d')](function(_0x41ce22){_0x1568e4[_0x3695('0x4f')]=_[_0x3695('0x50')](_0x41ce22)['join'](',');return db[_0x3695('0x51')]['transaction'](function(_0x508479){return db[_0x3695('0x52')]['create'](_0x1568e4,{'raw':!![],'transaction':_0x508479})[_0x3695('0x2d')](function(_0x48ccc3){var _0x598636={'sender':_0x1568e4['senderName'],'description':_0x1568e4[_0x3695('0x4b')],'content':_0x1568e4[_0x3695('0x34')],'beep':_0x1568e4[_0x3695('0x4d')]};_0x41ce22[_0x3695('0x53')](function(_0x1135dd){_0x598636['recipient']=_0x1135dd;socket['emit'](_0x3695('0x54'),_0x598636);});return _0x48ccc3;});});})[_0x3695('0x2d')](respondWithResult(_0xf63131,0xc9))['catch'](handleError(_0xf63131,null));};function getContent(_0x389005){return new BPromise(function(_0x2fc30e,_0xb01f90){if(_0x389005['text']){_0x2fc30e(_0x389005[_0x3695('0x55')]);return;}return db[_0x3695('0x56')][_0x3695('0x57')]({'attributes':[_0x3695('0x58')],'where':{'id':_0x389005[_0x3695('0x36')]},'raw':!![]})[_0x3695('0x2d')](function(_0xaf6984){if(!_0xaf6984)throw new db['Sequelize']['ValidationError'](_0x3695('0x59'));var _0x5d2a46=Mustache['render'](_0xaf6984['html'],_0x389005[_0x3695('0x39')]);_0x2fc30e(_0x5d2a46);})[_0x3695('0x5a')](function(_0x122949){_0xb01f90(_0x122949);});});}function getRecipients(_0x6f6831){return new BPromise(function(_0x259296,_0x5100d2){var _0x1866c0=[];var _0x7e522f=[];_0x6f6831[_0x3695('0x53')](function(_0x32c64){var _0x38592a=_[_0x3695('0x5b')](_0x32c64[_0x3695('0x5c')][_0x3695('0x47')]());if(_0x38592a===_0x3695('0x5d')){_0x1866c0=_[_0x3695('0x5e')](_0x1866c0,_0x32c64[_0x3695('0x5f')]);}else{if(_[_0x3695('0x60')](_0x38592a,'queue'))_0x38592a=_0x38592a['replace']('queue','Queue');_0x32c64[_0x3695('0x5f')][_0x3695('0x53')](function(_0x3e2784){_0x7e522f[_0x3695('0x61')](getAgents(_0x38592a,_0x3e2784));});}});return BPromise[_0x3695('0x62')](_0x7e522f)['then'](function(_0xc45635){_0x1866c0=_[_0x3695('0x5e')](_0x1866c0,_[_0x3695('0x63')](_0xc45635));_0x259296(_0x1866c0);})[_0x3695('0x5a')](function(_0x20ff66){_0x5100d2(_0x20ff66);});});}function getAgents(_0x4d23b4,_0x2f586c){return new BPromise(function(_0x4b2b39,_0x3993b5){return db[_0x4d23b4][_0x3695('0x57')]({'where':{'id':_0x2f586c}})[_0x3695('0x2d')](function(_0x11d6a6){return _0x11d6a6['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x3aa60d){var _0x2b5734=_['map'](_0x3aa60d,'id');_0x4b2b39(_0x2b5734);});})[_0x3695('0x5a')](function(_0x5be983){_0x3993b5(_0x5be983);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 00f9ecb..8fb7c5b 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 _0x207c=['hook','exports','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x1e2aae,_0x2349e3){var _0x4d8a43=function(_0x305d4c){while(--_0x305d4c){_0x1e2aae['push'](_0x1e2aae['shift']());}};_0x4d8a43(++_0x2349e3);}(_0x207c,0x1e8));var _0xc207=function(_0x2e11d3,_0x26a29a){_0x2e11d3=_0x2e11d3-0x0;var _0x3f7f7f=_0x207c[_0x2e11d3];return _0x3f7f7f;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xc207('0x0'))['db'][_0xc207('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xc207('0x2')](0x0);var events={'afterCreate':_0xc207('0x3'),'afterUpdate':_0xc207('0x4'),'afterDestroy':_0xc207('0x5')};function emitEvent(_0x1dd107){return function(_0x4b9daa,_0x38ff02,_0x59bc89){UserNotificationEvents['emit'](_0x1dd107+':'+_0x4b9daa['id'],_0x4b9daa);UserNotificationEvents['emit'](_0x1dd107,_0x4b9daa);_0x59bc89(null);};}for(var e in events){if(events[_0xc207('0x6')](e)){var event=events[e];UserNotification[_0xc207('0x7')](e,emitEvent(event));}}module[_0xc207('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x6737=['emit','hasOwnProperty','../../mysqldb','UserNotification','save','update','remove'];(function(_0x429941,_0x24306c){var _0x47c477=function(_0x163ae8){while(--_0x163ae8){_0x429941['push'](_0x429941['shift']());}};_0x47c477(++_0x24306c);}(_0x6737,0xe2));var _0x7673=function(_0x1e8980,_0x290eeb){_0x1e8980=_0x1e8980-0x0;var _0x5a9e79=_0x6737[_0x1e8980];return _0x5a9e79;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x7673('0x0'))['db'][_0x7673('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7673('0x2'),'afterUpdate':_0x7673('0x3'),'afterDestroy':_0x7673('0x4')};function emitEvent(_0x12efff){return function(_0x54002e,_0x32e6f2,_0x22ce8d){UserNotificationEvents['emit'](_0x12efff+':'+_0x54002e['id'],_0x54002e);UserNotificationEvents[_0x7673('0x5')](_0x12efff,_0x54002e);_0x22ce8d(null);};}for(var e in events){if(events[_0x7673('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index ce0743d..46f18db 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 _0x1c8a=['request-promise','rimraf','../../config/environment','./userNotification.attributes','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c8a,0x140));var _0xa1c8=function(_0x4fae5d,_0x8c58a){_0x4fae5d=_0x4fae5d-0x0;var _0x13a8a3=_0x1c8a[_0x4fae5d];return _0x13a8a3;};'use strict';var _=require(_0xa1c8('0x0'));var util=require(_0xa1c8('0x1'));var logger=require(_0xa1c8('0x2'))(_0xa1c8('0x3'));var moment=require(_0xa1c8('0x4'));var BPromise=require('bluebird');var rp=require(_0xa1c8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1c8('0x6'));var config=require(_0xa1c8('0x7'));var attributes=require(_0xa1c8('0x8'));module['exports']=function(_0x331282,_0x14b85c){return _0x331282[_0xa1c8('0x9')]('UserNotification',attributes,{'tableName':_0xa1c8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa1c8('0xb'),'collate':_0xa1c8('0xc')});}; \ No newline at end of file +var _0x87d9=['api','moment','bluebird','request-promise','rimraf','./userNotification.attributes','exports','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87d9,0x143));var _0x987d=function(_0x254caa,_0x454b80){_0x254caa=_0x254caa-0x0;var _0x1f9aac=_0x87d9[_0x254caa];return _0x1f9aac;};'use strict';var _=require(_0x987d('0x0'));var util=require('util');var logger=require(_0x987d('0x1'))(_0x987d('0x2'));var moment=require(_0x987d('0x3'));var BPromise=require(_0x987d('0x4'));var rp=require(_0x987d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x987d('0x6'));var config=require('../../config/environment');var attributes=require(_0x987d('0x7'));module[_0x987d('0x8')]=function(_0x4b7afc,_0x2abb89){return _0x4b7afc[_0x987d('0x9')]('UserNotification',attributes,{'tableName':_0x987d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x987d('0xb'),'collate':_0x987d('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index b1a2177..4d441ae 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 _0x96aa=['client','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','UserNotification,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x438253,_0x2e7553){var _0x33aca2=function(_0x2a7ca9){while(--_0x2a7ca9){_0x438253['push'](_0x438253['shift']());}};_0x33aca2(++_0x2e7553);}(_0x96aa,0x1a5));var _0xa96a=function(_0x4303fe,_0x2cda11){_0x4303fe=_0x4303fe-0x0;var _0xf61867=_0x96aa[_0x4303fe];return _0xf61867;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var moment=require(_0xa96a('0x2'));var BPromise=require(_0xa96a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa96a('0x4'));var db=require(_0xa96a('0x5'))['db'];var utils=require(_0xa96a('0x6'));var logger=require(_0xa96a('0x7'))(_0xa96a('0x8'));var config=require(_0xa96a('0x9'));var jayson=require(_0xa96a('0xa'));var client=jayson[_0xa96a('0xb')]['http']({'port':0x232a});config[_0xa96a('0xc')]=_['defaults'](config[_0xa96a('0xc')],{'host':_0xa96a('0xd'),'port':0x18eb});var socket=require(_0xa96a('0xe'))(new Redis(config[_0xa96a('0xc')]));require(_0xa96a('0xf'))[_0xa96a('0x10')](socket);function respondWithRpcPromise(_0x58032a,_0x11e6bb,_0x14c19e){return new BPromise(function(_0x35fab6,_0x1174fb){return client[_0xa96a('0x11')](_0x58032a,_0x14c19e)['then'](function(_0x4249f5){logger['info']('UserNotification,\x20%s,\x20%s',_0x11e6bb,_0xa96a('0x12'));logger['debug'](_0xa96a('0x13'),_0x11e6bb,_0xa96a('0x12'),JSON[_0xa96a('0x14')](_0x4249f5));if(_0x4249f5[_0xa96a('0x15')]){if(_0x4249f5[_0xa96a('0x15')]['code']===0x1f4){logger[_0xa96a('0x15')](_0xa96a('0x16'),_0x11e6bb,_0x4249f5[_0xa96a('0x15')]['message']);return _0x1174fb(_0x4249f5[_0xa96a('0x15')][_0xa96a('0x17')]);}logger[_0xa96a('0x15')](_0xa96a('0x16'),_0x11e6bb,_0x4249f5[_0xa96a('0x15')][_0xa96a('0x17')]);return _0x35fab6(_0x4249f5[_0xa96a('0x15')][_0xa96a('0x17')]);}else{logger[_0xa96a('0x18')](_0xa96a('0x16'),_0x11e6bb,_0xa96a('0x12'));_0x35fab6(_0x4249f5[_0xa96a('0x19')][_0xa96a('0x17')]);}})[_0xa96a('0x1a')](function(_0x334fbb){logger[_0xa96a('0x15')]('UserNotification,\x20%s,\x20%s',_0x11e6bb,_0x334fbb);_0x1174fb(_0x334fbb);});});} \ No newline at end of file +var _0x6f52=['client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6f52,0xa6));var _0x26f5=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6f52[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x26f5('0x0'));var moment=require('moment');var BPromise=require(_0x26f5('0x1'));var rs=require(_0x26f5('0x2'));var fs=require('fs');var Redis=require(_0x26f5('0x3'));var db=require(_0x26f5('0x4'))['db'];var utils=require(_0x26f5('0x5'));var logger=require(_0x26f5('0x6'))(_0x26f5('0x7'));var config=require(_0x26f5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x26f5('0x9')][_0x26f5('0xa')]({'port':0x232a});config[_0x26f5('0xb')]=_[_0x26f5('0xc')](config['redis'],{'host':_0x26f5('0xd'),'port':0x18eb});var socket=require(_0x26f5('0xe'))(new Redis(config[_0x26f5('0xb')]));require(_0x26f5('0xf'))['register'](socket);function respondWithRpcPromise(_0x1c7acf,_0x2784fd,_0x1ea681){return new BPromise(function(_0x2c74e1,_0x29768e){return client[_0x26f5('0x10')](_0x1c7acf,_0x1ea681)[_0x26f5('0x11')](function(_0x337a97){logger[_0x26f5('0x12')](_0x26f5('0x13'),_0x2784fd,_0x26f5('0x14'));logger[_0x26f5('0x15')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x2784fd,_0x26f5('0x14'),JSON['stringify'](_0x337a97));if(_0x337a97[_0x26f5('0x16')]){if(_0x337a97['error']['code']===0x1f4){logger['error'](_0x26f5('0x13'),_0x2784fd,_0x337a97[_0x26f5('0x16')]['message']);return _0x29768e(_0x337a97['error'][_0x26f5('0x17')]);}logger['error'](_0x26f5('0x13'),_0x2784fd,_0x337a97[_0x26f5('0x16')][_0x26f5('0x17')]);return _0x2c74e1(_0x337a97['error'][_0x26f5('0x17')]);}else{logger[_0x26f5('0x12')](_0x26f5('0x13'),_0x2784fd,_0x26f5('0x14'));_0x2c74e1(_0x337a97['result'][_0x26f5('0x17')]);}})[_0x26f5('0x18')](function(_0x41e5d4){logger[_0x26f5('0x16')](_0x26f5('0x13'),_0x2784fd,_0x41e5d4);_0x29768e(_0x41e5d4);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index f49c7fb..9af9749 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 _0x2e8a=['remove','emit','userNotification:','save'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x46eb27,_0x57ff9f){_0x46eb27=_0x46eb27-0x0;var _0x4b3b90=_0x2e8a[_0x46eb27];return _0x4b3b90;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xa2e8('0x0'),_0xa2e8('0x1'),'update'];function createListener(_0x3a9fbd,_0x2b63d9){return function(_0x4b770c){_0x2b63d9[_0xa2e8('0x2')](_0x3a9fbd,_0x4b770c);};}function removeListener(_0x522e76,_0x492531){return function(){UserNotificationEvents['removeListener'](_0x522e76,_0x492531);};}exports['register']=function(_0x4593d2){for(var _0x32fb35=0x0,_0x4d31a8=events['length'];_0x32fb35<_0x4d31a8;_0x32fb35++){var _0x99f433=events[_0x32fb35];var _0x3b6834=createListener(_0xa2e8('0x3')+_0x99f433,_0x4593d2);UserNotificationEvents['on'](_0x99f433,_0x3b6834);}}; \ No newline at end of file +var _0x9485=['removeListener','register','userNotification:','./userNotification.events','save','remove','update','emit'];(function(_0x1715a2,_0x13d1d3){var _0x447fc1=function(_0x4ba3e4){while(--_0x4ba3e4){_0x1715a2['push'](_0x1715a2['shift']());}};_0x447fc1(++_0x13d1d3);}(_0x9485,0x8b));var _0x5948=function(_0x55cca0,_0x2d0a31){_0x55cca0=_0x55cca0-0x0;var _0x2e69a2=_0x9485[_0x55cca0];return _0x2e69a2;};'use strict';var UserNotificationEvents=require(_0x5948('0x0'));var events=[_0x5948('0x1'),_0x5948('0x2'),_0x5948('0x3')];function createListener(_0x5ca17a,_0x42393d){return function(_0xc057c8){_0x42393d[_0x5948('0x4')](_0x5ca17a,_0xc057c8);};}function removeListener(_0x47b3f3,_0xcfd4b6){return function(){UserNotificationEvents[_0x5948('0x5')](_0x47b3f3,_0xcfd4b6);};}exports[_0x5948('0x6')]=function(_0x4312a8){for(var _0x19ccdd=0x0,_0x283a13=events['length'];_0x19ccdd<_0x283a13;_0x19ccdd++){var _0x2cf314=events[_0x19ccdd];var _0x4e7f15=createListener(_0x5948('0x7')+_0x2cf314,_0x4312a8);UserNotificationEvents['on'](_0x2cf314,_0x4e7f15);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 3868f6c..772d5ef 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(_0x31da8f,_0x8be558){var _0x2a77ab=function(_0x3a17c3){while(--_0x3a17c3){_0x31da8f['push'](_0x31da8f['shift']());}};_0x2a77ab(++_0x8be558);}(_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 _0x4cdf=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','path'];(function(_0x456334,_0x18df0f){var _0x1665ba=function(_0x54bda6){while(--_0x54bda6){_0x456334['push'](_0x456334['shift']());}};_0x1665ba(++_0x18df0f);}(_0x4cdf,0x180));var _0xf4cd=function(_0x15758a,_0x593ab4){_0x15758a=_0x15758a-0x0;var _0x9a365=_0x4cdf[_0x15758a];return _0x9a365;};'use strict';var multer=require(_0xf4cd('0x0'));var util=require(_0xf4cd('0x1'));var path=require(_0xf4cd('0x2'));var timeout=require(_0xf4cd('0x3'));var express=require(_0xf4cd('0x4'));var router=express[_0xf4cd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf4cd('0x6'));var interaction=require(_0xf4cd('0x7'));var config=require('../../config/environment');module[_0xf4cd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 1866b7f..8736a73 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x380d35,_0x4676fc){var _0x1ece69=function(_0x4e64e8){while(--_0x4e64e8){_0x380d35['push'](_0x380d35['shift']());}};_0x1ece69(++_0x4676fc);}(_0xe706,0xa3));var _0x6e70=function(_0x45964b,_0xe849e5){_0x45964b=_0x45964b-0x0;var _0x4dc863=_0xe706[_0x45964b];return _0x4dc863;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x147e4d,_0x2cba83){var _0x188b0a=function(_0x2e21e4){while(--_0x2e21e4){_0x147e4d['push'](_0x147e4d['shift']());}};_0x188b0a(++_0x2cba83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 994e01e..5db5d2a 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 _0x777b=['../../config/environment','define','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x777b,0x174));var _0xb777=function(_0x521f98,_0x3ca958){_0x521f98=_0x521f98-0x0;var _0x444edf=_0x777b[_0x521f98];return _0x444edf;};'use strict';var _=require(_0xb777('0x0'));var util=require(_0xb777('0x1'));var logger=require('../../config/logger')(_0xb777('0x2'));var moment=require(_0xb777('0x3'));var BPromise=require(_0xb777('0x4'));var rp=require(_0xb777('0x5'));var fs=require('fs');var path=require(_0xb777('0x6'));var rimraf=require(_0xb777('0x7'));var config=require(_0xb777('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x1c697a,_0x46de9c){return _0x1c697a[_0xb777('0x9')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a23=['api','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x5a23,0x147));var _0x35a2=function(_0x30ce05,_0xb0c8f8){_0x30ce05=_0x30ce05-0x0;var _0x3eeaa2=_0x5a23[_0x30ce05];return _0x3eeaa2;};'use strict';var _=require(_0x35a2('0x0'));var util=require(_0x35a2('0x1'));var logger=require(_0x35a2('0x2'))(_0x35a2('0x3'));var moment=require('moment');var BPromise=require(_0x35a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x35a2('0x5'));var rimraf=require(_0x35a2('0x6'));var config=require(_0x35a2('0x7'));var attributes=require(_0x35a2('0x8'));module[_0x35a2('0x9')]=function(_0x2d5929,_0x1e423b){return _0x2d5929[_0x35a2('0xa')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','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 3f7d034..4e0d2dd 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 _0x74d0=['http','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x5ac0cc,_0x2339fa){var _0xf83dac=function(_0x840336){while(--_0x840336){_0x5ac0cc['push'](_0x5ac0cc['shift']());}};_0xf83dac(++_0x2339fa);}(_0x74d0,0x1c5));var _0x074d=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x74d0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require('lodash');var util=require(_0x074d('0x0'));var moment=require(_0x074d('0x1'));var BPromise=require(_0x074d('0x2'));var rs=require(_0x074d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x074d('0x4'))['db'];var utils=require(_0x074d('0x5'));var logger=require('../../config/logger')(_0x074d('0x6'));var config=require('../../config/environment');var jayson=require(_0x074d('0x7'));var client=jayson[_0x074d('0x8')][_0x074d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53a7ea,_0x2d12a1,_0x2df384){return new BPromise(function(_0xc86d56,_0x397a1a){return client['request'](_0x53a7ea,_0x2df384)['then'](function(_0x494fc4){logger['info'](_0x074d('0xa'),_0x2d12a1,_0x074d('0xb'));logger[_0x074d('0xc')](_0x074d('0xd'),_0x2d12a1,'request\x20sent',JSON[_0x074d('0xe')](_0x494fc4));if(_0x494fc4[_0x074d('0xf')]){if(_0x494fc4['error'][_0x074d('0x10')]===0x1f4){logger[_0x074d('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2d12a1,_0x494fc4[_0x074d('0xf')][_0x074d('0x11')]);return _0x397a1a(_0x494fc4[_0x074d('0xf')][_0x074d('0x11')]);}logger[_0x074d('0xf')](_0x074d('0xa'),_0x2d12a1,_0x494fc4['error'][_0x074d('0x11')]);return _0xc86d56(_0x494fc4[_0x074d('0xf')][_0x074d('0x11')]);}else{logger[_0x074d('0x12')](_0x074d('0xa'),_0x2d12a1,_0x074d('0xb'));_0xc86d56(_0x494fc4[_0x074d('0x13')][_0x074d('0x11')]);}})[_0x074d('0x14')](function(_0x254b73){logger[_0x074d('0xf')](_0x074d('0xa'),_0x2d12a1,_0x254b73);_0x397a1a(_0x254b73);});});} \ No newline at end of file +var _0xcf27=['jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x486b24,_0x8e65bb){var _0x306326=function(_0xcfe844){while(--_0xcfe844){_0x486b24['push'](_0x486b24['shift']());}};_0x306326(++_0x8e65bb);}(_0xcf27,0x147));var _0x7cf2=function(_0x49ba3a,_0x43e4d8){_0x49ba3a=_0x49ba3a-0x0;var _0x30f602=_0xcf27[_0x49ba3a];return _0x30f602;};'use strict';var _=require(_0x7cf2('0x0'));var util=require(_0x7cf2('0x1'));var moment=require('moment');var BPromise=require(_0x7cf2('0x2'));var rs=require(_0x7cf2('0x3'));var fs=require('fs');var Redis=require(_0x7cf2('0x4'));var db=require(_0x7cf2('0x5'))['db'];var utils=require(_0x7cf2('0x6'));var logger=require(_0x7cf2('0x7'))('rpc');var config=require(_0x7cf2('0x8'));var jayson=require(_0x7cf2('0x9'));var client=jayson[_0x7cf2('0xa')][_0x7cf2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x342cd0,_0x3f204a,_0x521a96){return new BPromise(function(_0x20ac00,_0x169391){return client['request'](_0x342cd0,_0x521a96)[_0x7cf2('0xc')](function(_0x9de0d4){logger[_0x7cf2('0xd')](_0x7cf2('0xe'),_0x3f204a,_0x7cf2('0xf'));logger[_0x7cf2('0x10')](_0x7cf2('0x11'),_0x3f204a,'request\x20sent',JSON[_0x7cf2('0x12')](_0x9de0d4));if(_0x9de0d4[_0x7cf2('0x13')]){if(_0x9de0d4[_0x7cf2('0x13')][_0x7cf2('0x14')]===0x1f4){logger['error'](_0x7cf2('0xe'),_0x3f204a,_0x9de0d4[_0x7cf2('0x13')][_0x7cf2('0x15')]);return _0x169391(_0x9de0d4[_0x7cf2('0x13')][_0x7cf2('0x15')]);}logger[_0x7cf2('0x13')](_0x7cf2('0xe'),_0x3f204a,_0x9de0d4[_0x7cf2('0x13')][_0x7cf2('0x15')]);return _0x20ac00(_0x9de0d4['error'][_0x7cf2('0x15')]);}else{logger[_0x7cf2('0xd')](_0x7cf2('0xe'),_0x3f204a,_0x7cf2('0xf'));_0x20ac00(_0x9de0d4[_0x7cf2('0x16')][_0x7cf2('0x15')]);}})[_0x7cf2('0x17')](function(_0x2a61cd){logger['error'](_0x7cf2('0xe'),_0x3f204a,_0x2a61cd);_0x169391(_0x2a61cd);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 16e6798..607c3ca 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 _0x9f62=['isAuthenticated','describe','/:id/sections','/:id/resources','getResources','post','clone','addSections','addResources','put','/:id','update','delete','removeSections','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe'];(function(_0xaf0374,_0x122ef9){var _0x1e8510=function(_0x3c2e87){while(--_0x3c2e87){_0xaf0374['push'](_0xaf0374['shift']());}};_0x1e8510(++_0x122ef9);}(_0x9f62,0x154));var _0x29f6=function(_0x286ac4,_0x37d511){_0x286ac4=_0x286ac4-0x0;var _0x2b9400=_0x9f62[_0x286ac4];return _0x2b9400;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var controller=require(_0x29f6('0x6'));router[_0x29f6('0x7')]('/',auth['isAuthenticated'](),controller[_0x29f6('0x8')]);router[_0x29f6('0x7')](_0x29f6('0x9'),auth[_0x29f6('0xa')](),controller[_0x29f6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x29f6('0x7')](_0x29f6('0xc'),auth['isAuthenticated'](),controller['getSections']);router[_0x29f6('0x7')](_0x29f6('0xd'),auth['isAuthenticated'](),controller[_0x29f6('0xe')]);router[_0x29f6('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/clone',auth[_0x29f6('0xa')](),controller[_0x29f6('0x10')]);router[_0x29f6('0xf')](_0x29f6('0xc'),auth[_0x29f6('0xa')](),controller[_0x29f6('0x11')]);router[_0x29f6('0xf')](_0x29f6('0xd'),auth[_0x29f6('0xa')](),controller[_0x29f6('0x12')]);router[_0x29f6('0x13')](_0x29f6('0x14'),auth[_0x29f6('0xa')](),controller[_0x29f6('0x15')]);router[_0x29f6('0x16')](_0x29f6('0x14'),auth[_0x29f6('0xa')](),controller['destroy']);router['delete'](_0x29f6('0xc'),auth[_0x29f6('0xa')](),controller[_0x29f6('0x17')]);router['delete'](_0x29f6('0xd'),auth[_0x29f6('0xa')](),controller['removeResources']);module[_0x29f6('0x18')]=router; \ No newline at end of file +var _0x42b0=['/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addResources','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x41f374,_0x56b76b){var _0x4eb25f=function(_0x1500bd){while(--_0x1500bd){_0x41f374['push'](_0x41f374['shift']());}};_0x4eb25f(++_0x56b76b);}(_0x42b0,0xbc));var _0x042b=function(_0x4f6272,_0x53b79c){_0x4f6272=_0x4f6272-0x0;var _0x1b5ae5=_0x42b0[_0x4f6272];return _0x1b5ae5;};'use strict';var multer=require(_0x042b('0x0'));var util=require(_0x042b('0x1'));var path=require('path');var timeout=require(_0x042b('0x2'));var express=require('express');var router=express[_0x042b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x042b('0x4'));var config=require(_0x042b('0x5'));var controller=require(_0x042b('0x6'));router[_0x042b('0x7')]('/',auth[_0x042b('0x8')](),controller['index']);router['get'](_0x042b('0x9'),auth[_0x042b('0x8')](),controller['describe']);router['get'](_0x042b('0xa'),auth['isAuthenticated'](),controller[_0x042b('0xb')]);router['get'](_0x042b('0xc'),auth[_0x042b('0x8')](),controller[_0x042b('0xd')]);router[_0x042b('0x7')](_0x042b('0xe'),auth[_0x042b('0x8')](),controller[_0x042b('0xf')]);router[_0x042b('0x10')]('/',auth[_0x042b('0x8')](),controller[_0x042b('0x11')]);router[_0x042b('0x10')](_0x042b('0x12'),auth[_0x042b('0x8')](),controller['clone']);router[_0x042b('0x10')]('/:id/sections',auth[_0x042b('0x8')](),controller['addSections']);router[_0x042b('0x10')](_0x042b('0xe'),auth[_0x042b('0x8')](),controller[_0x042b('0x13')]);router[_0x042b('0x14')](_0x042b('0xa'),auth['isAuthenticated'](),controller[_0x042b('0x15')]);router[_0x042b('0x16')](_0x042b('0xa'),auth[_0x042b('0x8')](),controller[_0x042b('0x17')]);router['delete'](_0x042b('0xc'),auth[_0x042b('0x8')](),controller['removeSections']);router['delete'](_0x042b('0xe'),auth[_0x042b('0x8')](),controller['removeResources']);module[_0x042b('0x18')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 1d715e8..3308202 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 _0x97c1=['split','STRING','BOOLEAN','sequelize','exports','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x15b967,_0x44dc28){var _0x46fcc2=function(_0x20af34){while(--_0x20af34){_0x15b967['push'](_0x15b967['shift']());}};_0x46fcc2(++_0x44dc28);}(_0x97c1,0xdf));var _0x197c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x97c1[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x197c('0x0'));module[_0x197c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x197c('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x49520b){this[_0x197c('0x3')](_0x197c('0x4'),_0x49520b?_0x49520b[_0x197c('0x5')](''):[]);},'get':function(){return this[_0x197c('0x6')](_0x197c('0x4'))?this['getDataValue']('crudPermissions')[_0x197c('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x197c('0x8')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x197c('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x197c('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x197c('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x197c('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x197c('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x63a5=['STRING','setDataValue','crudPermissions','join','getDataValue','BOOLEAN','sequelize','exports'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0x63a5,0x18e));var _0x563a=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x63a5[_0x11c573];return _0x6b72de;};'use strict';var Sequelize=require(_0x563a('0x0'));module[_0x563a('0x1')]={'name':{'type':Sequelize[_0x563a('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x563a('0x2')],'set':function(_0x493973){this[_0x563a('0x3')](_0x563a('0x4'),_0x493973?_0x493973[_0x563a('0x5')](''):[]);},'get':function(){return this[_0x563a('0x6')]('crudPermissions')?this['getDataValue'](_0x563a('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x563a('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x563a('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x563a('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x563a('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x563a('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x563a('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x563a('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 b892e7e..9241f08 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 _0x23c8=['Plugin','push','resourceId','addResources','bulkCreate','removeResources','ValidationError','mergeResources','Sequelize','Invalid\x20section\x20\x27','all','union','ignore','childModel','pick','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','custom','reportId','CustomReports','rows','CmContact','Tag','Tags','color','tag','Agents','openTabs','chat','sms','dataValues','mail','openchannel','whatsapp','charAt','toUpperCase','slice','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','ui.UserId\x20=\x20?','OpenTabs','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxAccount','inboundroutes','internalroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','role','agent','Telephones','membername','User','telephone','VoiceQueues','queue','QueueCampaigns','VoiceQueue','VoiceMusicOnHold','chanspies','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','CannedAnswer','dispositions','Disposition','intervals','pauses','scheduler','Schedule','sounds','Sound','tags','templates','Template','Trigger','trunks','variables','plugins','Reports','AnalyticMetric','whatsappaccounts','screenrecordings','ScreenRecording','UserId','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','clone','merge','get','createdAt','omit','updatedAt','sequelize','transaction','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','each','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','Dashboard','forEach'];(function(_0x4c8924,_0x1dbad4){var _0x2b4117=function(_0x107426){while(--_0x107426){_0x4c8924['push'](_0x4c8924['shift']());}};_0x2b4117(++_0x1dbad4);}(_0x23c8,0x99));var _0x823c=function(_0x35084a,_0x304836){_0x35084a=_0x35084a-0x0;var _0x15eb98=_0x23c8[_0x35084a];return _0x15eb98;};'use strict';var emlformat=require(_0x823c('0x0'));var rimraf=require(_0x823c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x823c('0x2'));var rp=require('request-promise');var moment=require(_0x823c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x823c('0x4'));var util=require(_0x823c('0x5'));var path=require('path');var sox=require(_0x823c('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x823c('0x7'));var _=require(_0x823c('0x8'));var squel=require(_0x823c('0x9'));var crypto=require(_0x823c('0xa'));var jsforce=require(_0x823c('0xb'));var deskjs=require(_0x823c('0xc'));var toCsv=require(_0x823c('0xd'));var querystring=require('querystring');var Papa=require(_0x823c('0xe'));var Redis=require(_0x823c('0xf'));var authService=require(_0x823c('0x10'));var qs=require(_0x823c('0x11'));var as=require(_0x823c('0x12'));var hardwareService=require(_0x823c('0x13'));var logger=require(_0x823c('0x14'))(_0x823c('0x15'));var utils=require(_0x823c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x823c('0x17'));var db=require('../../mysqldb')['db'];config[_0x823c('0x18')]=_['defaults'](config[_0x823c('0x18')],{'host':_0x823c('0x19'),'port':0x18eb});var socket=require(_0x823c('0x1a'))(new Redis(config[_0x823c('0x18')]));require(_0x823c('0x1b'))['register'](socket);function respondWithStatusCode(_0x216aac,_0x5654d9){_0x5654d9=_0x5654d9||0xcc;return function(_0x2ec392){if(_0x2ec392){return _0x216aac[_0x823c('0x1c')](_0x5654d9);}return _0x216aac[_0x823c('0x1d')](_0x5654d9)[_0x823c('0x1e')]();};}function respondWithResult(_0x42c6e7,_0x3fcb45){_0x3fcb45=_0x3fcb45||0xc8;return function(_0x199d73){if(_0x199d73){return _0x42c6e7[_0x823c('0x1d')](_0x3fcb45)[_0x823c('0x1f')](_0x199d73);}};}function respondWithFilteredResult(_0x88b5c8,_0xb2913d){return function(_0x435280){if(_0x435280){var _0xb1b6f7=typeof _0xb2913d[_0x823c('0x20')]===_0x823c('0x21')&&typeof _0xb2913d['limit']===_0x823c('0x21');var _0x387a77=_0x435280['count'];var _0xe6fb04=_0xb1b6f7?0x0:_0xb2913d[_0x823c('0x20')];var _0x55bdc9=_0xb1b6f7?_0x435280[_0x823c('0x22')]:_0xb2913d[_0x823c('0x20')]+_0xb2913d['limit'];var _0x417f6d;if(_0x55bdc9>=_0x387a77){_0x55bdc9=_0x387a77;_0x417f6d=0xc8;}else{_0x417f6d=0xce;}_0x88b5c8['status'](_0x417f6d);return _0x88b5c8[_0x823c('0x23')](_0x823c('0x24'),_0xe6fb04+'-'+_0x55bdc9+'/'+_0x387a77)[_0x823c('0x1f')](_0x435280);}return null;};}function patchUpdates(_0x54f2d7){return function(_0x5a88e5){try{jsonpatch[_0x823c('0x25')](_0x5a88e5,_0x54f2d7,!![]);}catch(_0x2ba749){return BPromise[_0x823c('0x26')](_0x2ba749);}return _0x5a88e5['save']();};}function saveUpdates(_0x171403,_0x36e99b){return function(_0x13ccf6){if(_0x13ccf6){return _0x13ccf6[_0x823c('0x27')](_0x171403)[_0x823c('0x28')](function(_0x5a70ab){return _0x5a70ab;});}return null;};}function removeEntity(_0x24a88d,_0x26f556){return function(_0xc2de49){if(_0xc2de49){return _0xc2de49[_0x823c('0x29')]()[_0x823c('0x28')](function(){_0x24a88d['status'](0xcc)[_0x823c('0x1e')]();});}};}function handleEntityNotFound(_0x2fa13a,_0x50f7eb){return function(_0x357ce3){if(!_0x357ce3){_0x2fa13a[_0x823c('0x1c')](0x194);}return _0x357ce3;};}function handleError(_0x174d23,_0x2946fd){_0x2946fd=_0x2946fd||0x1f4;return function(_0x5b738a){logger[_0x823c('0x2a')](_0x5b738a[_0x823c('0x2b')]);if(_0x5b738a[_0x823c('0x2c')]){delete _0x5b738a['name'];}_0x174d23['status'](_0x2946fd)[_0x823c('0x2d')](_0x5b738a);};}exports[_0x823c('0x2e')]=function(_0x2c990e,_0x26858c){var _0x163056={},_0x235dbe={},_0x3a6cb3={'count':0x0,'rows':[]};var _0x3f4144=_['map'](db[_0x823c('0x2f')][_0x823c('0x30')],function(_0x267e56){return{'name':_0x267e56[_0x823c('0x31')],'type':_0x267e56[_0x823c('0x32')][_0x823c('0x33')]};});_0x235dbe['model']=_[_0x823c('0x34')](_0x3f4144,_0x823c('0x2c'));_0x235dbe[_0x823c('0x35')]=_[_0x823c('0x36')](_0x2c990e[_0x823c('0x35')]);_0x235dbe[_0x823c('0x37')]=_[_0x823c('0x38')](_0x235dbe[_0x823c('0x39')],_0x235dbe[_0x823c('0x35')]);_0x163056['attributes']=_['intersection'](_0x235dbe[_0x823c('0x39')],qs['fields'](_0x2c990e['query'][_0x823c('0x3a')]));_0x163056[_0x823c('0x3b')]=_0x163056['attributes'][_0x823c('0x3c')]?_0x163056[_0x823c('0x3b')]:_0x235dbe[_0x823c('0x39')];if(!_0x2c990e[_0x823c('0x35')][_0x823c('0x3d')](_0x823c('0x3e'))){_0x163056[_0x823c('0x3f')]=qs['limit'](_0x2c990e['query'][_0x823c('0x3f')]);_0x163056[_0x823c('0x20')]=qs[_0x823c('0x20')](_0x2c990e['query'][_0x823c('0x20')]);}_0x163056[_0x823c('0x40')]=qs[_0x823c('0x41')](_0x2c990e[_0x823c('0x35')]['sort']);_0x163056[_0x823c('0x42')]=qs[_0x823c('0x37')](_['pick'](_0x2c990e[_0x823c('0x35')],_0x235dbe[_0x823c('0x37')]),_0x3f4144);if(_0x2c990e[_0x823c('0x35')][_0x823c('0x43')]){_0x163056['where']=_['merge'](_0x163056[_0x823c('0x42')],{'$or':_[_0x823c('0x34')](_0x3f4144,function(_0x53a634){if(_0x53a634[_0x823c('0x32')]!=='VIRTUAL'){var _0xa58579={};_0xa58579[_0x53a634[_0x823c('0x2c')]]={'$like':'%'+_0x2c990e[_0x823c('0x35')][_0x823c('0x43')]+'%'};return _0xa58579;}})});}_0x163056=_['merge']({},_0x163056,_0x2c990e[_0x823c('0x44')]);var _0x87eae2={'where':_0x163056['where']};return db[_0x823c('0x2f')][_0x823c('0x22')](_0x87eae2)[_0x823c('0x28')](function(_0x399439){_0x3a6cb3['count']=_0x399439;if(_0x2c990e['query'][_0x823c('0x45')]){_0x163056[_0x823c('0x46')]=[{'all':!![]}];}return db[_0x823c('0x2f')][_0x823c('0x47')](_0x163056);})[_0x823c('0x28')](function(_0x3212b9){_0x3a6cb3['rows']=_0x3212b9;return _0x3a6cb3;})[_0x823c('0x28')](respondWithFilteredResult(_0x26858c,_0x163056))[_0x823c('0x48')](handleError(_0x26858c,null));};exports[_0x823c('0x49')]=function(_0x265e78,_0x754d31){var _0x14573a={'raw':![],'where':{'id':_0x265e78[_0x823c('0x4a')]['id']}},_0x7daa48={};_0x7daa48['model']=_['keys'](db[_0x823c('0x2f')]['rawAttributes']);_0x7daa48['query']=_['keys'](_0x265e78['query']);_0x7daa48['filters']=_['intersection'](_0x7daa48[_0x823c('0x39')],_0x7daa48[_0x823c('0x35')]);_0x14573a[_0x823c('0x3b')]=_[_0x823c('0x38')](_0x7daa48[_0x823c('0x39')],qs[_0x823c('0x3a')](_0x265e78['query'][_0x823c('0x3a')]));_0x14573a['attributes']=_0x14573a['attributes'][_0x823c('0x3c')]?_0x14573a['attributes']:_0x7daa48[_0x823c('0x39')];if(_0x265e78[_0x823c('0x35')][_0x823c('0x45')]){_0x14573a[_0x823c('0x46')]=[{'all':!![]}];}_0x14573a=_['merge']({},_0x14573a,_0x265e78[_0x823c('0x44')]);return db[_0x823c('0x2f')][_0x823c('0x4b')](_0x14573a)['then'](handleEntityNotFound(_0x754d31,null))[_0x823c('0x28')](respondWithResult(_0x754d31,null))['catch'](handleError(_0x754d31,null));};exports['create']=function(_0x2b05bf,_0x3788b5){return db[_0x823c('0x2f')][_0x823c('0x4c')](_0x2b05bf[_0x823c('0x4d')],{})[_0x823c('0x28')](respondWithResult(_0x3788b5,0xc9))[_0x823c('0x48')](handleError(_0x3788b5,null));};exports[_0x823c('0x4e')]=function(_0x4124dc,_0x5bf828){var _0x413270={'where':{'id':_0x4124dc[_0x823c('0x4a')]['id']}},_0x33ec28={};_0x33ec28[_0x823c('0x39')]=_[_0x823c('0x36')](db[_0x823c('0x2f')][_0x823c('0x30')]);_0x413270['attributes']=_['intersection'](_0x33ec28[_0x823c('0x39')],qs[_0x823c('0x3a')](_0x4124dc['query'][_0x823c('0x3a')]));_0x413270[_0x823c('0x3b')]=_0x413270[_0x823c('0x3b')]['length']?_0x413270[_0x823c('0x3b')]:_0x33ec28[_0x823c('0x39')];if(_0x4124dc[_0x823c('0x35')][_0x823c('0x45')]){_0x413270[_0x823c('0x46')]=[{'all':!![]}];}_0x413270=_[_0x823c('0x4f')]({},_0x413270,_0x4124dc[_0x823c('0x44')]);return db[_0x823c('0x2f')][_0x823c('0x4b')](_0x413270)[_0x823c('0x28')](handleEntityNotFound(_0x5bf828,null))[_0x823c('0x28')](function(_0x219c10){if(_0x219c10){var _0x23d74c=_0x219c10[_0x823c('0x50')]({'plain':!![]});_0x23d74c=qs['omit'](_0x23d74c,['id',_0x823c('0x51'),'updatedAt','crudPermissions']);_0x4124dc['body']=_[_0x823c('0x52')](_0x4124dc[_0x823c('0x4d')],['id',_0x823c('0x51'),_0x823c('0x53')]);return db[_0x823c('0x54')][_0x823c('0x55')](function(_0x797a94){return db[_0x823c('0x2f')]['create'](_[_0x823c('0x4f')](_0x23d74c,_0x4124dc[_0x823c('0x4d')]),{'include':_0x4124dc[_0x823c('0x35')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x797a94})['then'](function(_0x29bfe8){var _0x32f362=_0x29bfe8[_0x823c('0x50')]({'plain':!![]});return db['UserProfileSection'][_0x823c('0x47')]({'where':{'userProfileId':_0x4124dc['params']['id']},'raw':!![]})[_0x823c('0x28')](function(_0x4bd885){if(_0x4bd885){return BPromise['each'](_0x4bd885,function(_0x452069){return new BPromise(function(_0x24dedd,_0x3e43ae){if(_0x452069['autoAssociation']===null||_0x452069[_0x823c('0x56')]===0x1)_0x24dedd(null);return db[_0x823c('0x57')][_0x823c('0x47')]({'where':{'sectionId':_0x452069['id']},'raw':!![]})['then'](function(_0x5ed5c4){var _0x3402c8=_[_0x823c('0x34')](_0x5ed5c4,function(_0x178066){return qs[_0x823c('0x52')](_0x178066,['id',_0x823c('0x51'),_0x823c('0x53'),_0x823c('0x58')]);});_0x24dedd(_0x3402c8);})[_0x823c('0x48')](function(_0x1d5174){_0x3e43ae(_0x1d5174);});})[_0x823c('0x28')](function(_0x4af16e){var _0x1e22e1=qs[_0x823c('0x52')](_0x452069,['id','createdAt','updatedAt']);_0x1e22e1[_0x823c('0x59')]=_0x32f362['id'];if(_0x4af16e)_0x1e22e1[_0x823c('0x5a')]=_0x4af16e;return _0x1e22e1;})[_0x823c('0x28')](function(_0x101000){return db[_0x823c('0x5b')][_0x823c('0x4c')](_0x101000,{'include':[{'model':db[_0x823c('0x57')],'as':_0x823c('0x5a')}],'raw':!![],'transaction':_0x797a94});});})[_0x823c('0x28')](function(){return _0x32f362;});}});});});}})[_0x823c('0x28')](respondWithResult(_0x5bf828,0xc9))[_0x823c('0x48')](handleError(_0x5bf828,null));};exports[_0x823c('0x27')]=function(_0x3b0a8d,_0x4f133c){if(_0x3b0a8d['body']['id']){delete _0x3b0a8d['body']['id'];}return db[_0x823c('0x2f')][_0x823c('0x4b')]({'where':{'id':_0x3b0a8d['params']['id']}})['then'](handleEntityNotFound(_0x4f133c,null))[_0x823c('0x28')](saveUpdates(_0x3b0a8d['body'],null))[_0x823c('0x28')](respondWithResult(_0x4f133c,null))['catch'](handleError(_0x4f133c,null));};exports[_0x823c('0x29')]=function(_0x2dbe6f,_0x3bd3ca){return db['UserProfile']['find']({'where':{'id':_0x2dbe6f[_0x823c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3bd3ca,null))[_0x823c('0x28')](removeEntity(_0x3bd3ca,null))[_0x823c('0x48')](handleError(_0x3bd3ca,null));};exports[_0x823c('0x5c')]=function(_0x1fd8b2,_0x2a5454){return db[_0x823c('0x2f')][_0x823c('0x5c')]()[_0x823c('0x28')](respondWithResult(_0x2a5454,null))[_0x823c('0x48')](handleError(_0x2a5454,null));};exports[_0x823c('0x5d')]=function(_0x282aa3,_0x3a4ace){var _0x321738=_0x282aa3[_0x823c('0x4d')];return db[_0x823c('0x2f')][_0x823c('0x4b')]({'where':{'id':_0x282aa3[_0x823c('0x4a')]['id']}})[_0x823c('0x28')](handleEntityNotFound(_0x3a4ace,null))[_0x823c('0x28')](function(_0x1e6075){if(_0x1e6075){return db['sequelize']['transaction'](function(_0x587494){return db[_0x823c('0x5b')][_0x823c('0x29')]({'where':{'userProfileId':_0x282aa3[_0x823c('0x4a')]['id'],'sectionId':_[_0x823c('0x34')](_0x321738,function(_0x14a77f){return _0x14a77f['sectionId'];})},'transaction':_0x587494})['then'](function(){var _0x73fd6b=_[_0x823c('0x34')](_0x321738,function(_0x369743){_0x369743[_0x823c('0x59')]=_0x282aa3[_0x823c('0x4a')]['id'];return _0x369743;});var _0x5e760f=[];return BPromise[_0x823c('0x5e')](_0x73fd6b,function(_0x4be18b){return db[_0x823c('0x5b')]['create'](_0x4be18b,{'include':[{'model':db[_0x823c('0x57')],'as':_0x823c('0x5a')}],'raw':!![],'transaction':_0x587494})[_0x823c('0x28')](function(_0x3ed239){_0x5e760f['push'](_0x3ed239[_0x823c('0x50')]({'plain':!![]}));});})[_0x823c('0x28')](function(){return _0x5e760f;});});});}})[_0x823c('0x28')](function(_0x5d79dc){return _0x5d79dc;})[_0x823c('0x28')](respondWithResult(_0x3a4ace,null))[_0x823c('0x48')](handleError(_0x3a4ace,null));};exports[_0x823c('0x5f')]=function(_0xbdc27e,_0x1e2888){var _0x4b1ad3;return db[_0x823c('0x2f')][_0x823c('0x4b')]({'where':{'id':_0xbdc27e[_0x823c('0x4a')]['id']},'attributes':['id',_0x823c('0x2c')]})[_0x823c('0x28')](handleEntityNotFound(_0x1e2888,null))[_0x823c('0x28')](function(_0x5d7df5){if(_0x5d7df5){_0x4b1ad3=_0x5d7df5;return db['UserProfileSection'][_0x823c('0x29')]({'where':{'userProfileId':_0xbdc27e[_0x823c('0x4a')]['id'],'sectionId':_0xbdc27e[_0x823c('0x35')][_0x823c('0x60')]}});}})[_0x823c('0x28')](function(){return _0x4b1ad3;})['then'](respondWithStatusCode(_0x1e2888,null))['catch'](handleError(_0x1e2888,null));};exports[_0x823c('0x61')]=function(_0x5c13fd,_0x517301){var _0x3bd13b=[];var _0x4cf81b=[];return db[_0x823c('0x5b')]['findAll']({'where':{'userProfileId':_0x5c13fd[_0x823c('0x4a')]['id']},'raw':!![]})[_0x823c('0x28')](function(_0x436273){_0x3bd13b=_[_0x823c('0x43')](_0x436273,function(_0x167b1f){return _0x167b1f[_0x823c('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x167b1f['sectionId']);});if(!_[_0x823c('0x63')](_0x3bd13b)){return _[_0x823c('0x34')](_0x3bd13b,function(_0x4dbd71){return _0x4dbd71[_0x823c('0x58')];});}else{return;}})[_0x823c('0x28')](function(_0xa7efe3){if(_0xa7efe3)_0x4cf81b=_0xa7efe3;if(_[_0x823c('0x64')](_0x4cf81b,0x64)){var _0x150dc8=_[_0x823c('0x4b')](_0x3bd13b,{'sectionId':0x64});return hasDefaultDashboard(_0x150dc8)[_0x823c('0x28')](function(_0x3ac6b9){return _[_0x823c('0x34')](_0x3bd13b,function(_0x5e910d){if(_0x5e910d[_0x823c('0x58')]===0x64){_0x5e910d['subsections']=_0x3ac6b9;}return _0x5e910d;});});}else{return;}})[_0x823c('0x28')](function(_0x4e2cf3){if(_0x4e2cf3)_0x3bd13b=_0x4e2cf3;if(_[_0x823c('0x64')](_0x4cf81b,0x3eb)){var _0x543031=_[_0x823c('0x4b')](_0x3bd13b,{'sectionId':0x3eb});return getCustomDashboards(_0x543031)[_0x823c('0x28')](function(_0x272536){return _['map'](_0x3bd13b,function(_0x11b0c5){if(_0x543031[_0x823c('0x62')]){if(_0x11b0c5['sectionId']===0x3eb){_0x11b0c5[_0x823c('0x65')]=_0x272536;}}else{if(_0x11b0c5[_0x823c('0x58')]===0x64){_0x11b0c5[_0x823c('0x65')]=_0x272536;}}return _0x11b0c5;});});}else{return;}})[_0x823c('0x28')](function(_0x1c2507){if(_0x1c2507)_0x3bd13b=_0x1c2507;if(_[_0x823c('0x64')](_0x4cf81b,0x709)){var _0x5d3d85=_[_0x823c('0x4b')](_0x3bd13b,{'sectionId':0x709});return getPlugins(_0x5d3d85)[_0x823c('0x28')](function(_0x1d2cbc){if(_0x5d3d85[_0x823c('0x62')]){return _[_0x823c('0x34')](_0x3bd13b,function(_0x540333){if(_0x540333[_0x823c('0x58')]===0x709){_0x540333[_0x823c('0x65')]=_0x1d2cbc;}return _0x540333;});}else{var _0x2a3e17={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1d2cbc};var _0x1957a7=_[_0x823c('0x34')](_0x3bd13b);_0x1957a7['push'](_0x2a3e17);return _0x1957a7;}});}else{return;}})[_0x823c('0x28')](function(_0x223aec){if(_0x223aec)_0x3bd13b=_0x223aec;return _[_0x823c('0x43')](_0x3bd13b,[_0x823c('0x62'),0x1]);})['then'](respondWithResult(_0x517301,null))['catch'](handleError(_0x517301,null));};function hasDefaultDashboard(_0x154b50){var _0x489e36=[0x65];return new BPromise(function(_0x4a2719,_0x534d1b){try{if(_0x154b50[_0x823c('0x56')]){_0x4a2719(_0x489e36);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x154b50['id']},'raw':!![]})[_0x823c('0x28')](function(_0x160896){_0x160896?_0x4a2719(_0x489e36):_0x4a2719();});}}catch(_0x32ca5c){_0x534d1b(_0x32ca5c);}});}function getCustomDashboards(_0x57c85e){var _0x5bbe50=[];return new BPromise(function(_0xb6cc9e,_0x6cd9b8){try{if(_0x57c85e[_0x823c('0x56')]){return db[_0x823c('0x66')][_0x823c('0x47')]({'raw':!![]})[_0x823c('0x28')](function(_0x136091){_0x136091[_0x823c('0x67')](function(_0x315e04){_0x5bbe50['push'](_0x315e04['id']+0x1869f);});_0xb6cc9e(_0x5bbe50);});}else{return db[_0x823c('0x57')][_0x823c('0x47')]({'where':{'sectionId':_0x57c85e['id']},'raw':!![]})[_0x823c('0x28')](function(_0x522091){_0x522091[_0x823c('0x67')](function(_0x5da076){_0x5bbe50['push'](_0x5da076['resourceId']+0x1869f);});_0xb6cc9e(_0x5bbe50);});}}catch(_0x275f69){_0x6cd9b8(_0x275f69);}});}function getPlugins(_0x3967b2){var _0x34b481=[];return new BPromise(function(_0x2a24f3,_0x3ca52c){try{if(_0x3967b2[_0x823c('0x56')]){return db[_0x823c('0x68')][_0x823c('0x47')]({'raw':!![]})[_0x823c('0x28')](function(_0x5707d3){_0x5707d3['forEach'](function(_0x798851){_0x34b481[_0x823c('0x69')](_0x798851['id']+0x15b38);});_0x2a24f3(_0x34b481);});}else{return db[_0x823c('0x57')][_0x823c('0x47')]({'where':{'sectionId':_0x3967b2['id']},'raw':!![]})[_0x823c('0x28')](function(_0x19e003){_0x19e003['forEach'](function(_0x4675c3){_0x34b481[_0x823c('0x69')](_0x4675c3[_0x823c('0x6a')]+0x15b38);});_0x2a24f3(_0x34b481);});}}catch(_0x5a36a0){_0x3ca52c(_0x5a36a0);}});}exports[_0x823c('0x6b')]=function(_0x1891f7,_0x13add1){return db[_0x823c('0x2f')][_0x823c('0x4b')]({'where':{'id':_0x1891f7[_0x823c('0x4a')]['id']}})[_0x823c('0x28')](handleEntityNotFound(_0x13add1,null))['then'](function(_0x1d1a65){if(_0x1d1a65){return db[_0x823c('0x54')]['transaction'](function(_0x198c51){return db[_0x823c('0x5b')][_0x823c('0x47')]({'where':{'userProfileId':_0x1891f7[_0x823c('0x4a')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x352d23){if(_0x352d23){return db[_0x823c('0x5b')]['destroy']({'where':{'userProfileId':_0x1891f7['params']['id'],'id':_[_0x823c('0x34')](_0x352d23,function(_0x9f9bfb){return _0x9f9bfb['id'];})},'transaction':_0x198c51});}})[_0x823c('0x28')](function(_0xaf581d){var _0x5c2ee0=_['map'](_0x1891f7[_0x823c('0x4d')],function(_0x2fd174){_0x2fd174[_0x823c('0x59')]=_0x1891f7['params']['id'];return _0x2fd174;});return db[_0x823c('0x5b')][_0x823c('0x6c')](_0x5c2ee0,{'raw':!![],'transaction':_0x198c51});})[_0x823c('0x28')](function(_0x53a125){var _0x18087b=_[_0x823c('0x43')](_[_0x823c('0x34')](_0x53a125,function(_0x50cbac){return _0x50cbac[_0x823c('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x18087b){return db['UserProfileSection'][_0x823c('0x47')]({'where':{'userProfileId':_0x1891f7[_0x823c('0x4a')]['id'],'sectionId':_[_0x823c('0x34')](_0x18087b,function(_0x483c20){return _0x483c20['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x823c('0x28')](function(_0xf2d720){var _0xdbd022=_['map'](_0x1891f7[_0x823c('0x4d')],function(_0x4ec33c){_0x4ec33c[_0x823c('0x59')]=_0x1891f7['params']['id'];return _0x4ec33c;});return db[_0x823c('0x57')]['bulkCreate'](_0xdbd022,{'raw':!![],'transaction':_0x198c51});});}})[_0x823c('0x48')](handleError(_0x13add1,null));});}})[_0x823c('0x28')](function(_0x3ef7fd){var _0x4213b3=_[_0x823c('0x34')](_0x3ef7fd,function(_0x298aeb){return _0x298aeb[_0x823c('0x50')]({'plain':!![]});});})[_0x823c('0x28')](respondWithResult(_0x13add1,null))[_0x823c('0x48')](handleError(_0x13add1,null));};exports[_0x823c('0x6d')]=function(_0x25c381,_0x89a06f,_0x4555fa){return db[_0x823c('0x2f')][_0x823c('0x4b')]({'where':{'id':_0x25c381[_0x823c('0x4a')]['id']}})[_0x823c('0x28')](handleEntityNotFound(_0x89a06f,null))['then'](function(_0x140f01){if(_0x140f01){return _0x140f01[_0x823c('0x6d')](_0x25c381[_0x823c('0x35')][_0x823c('0x60')]);}})[_0x823c('0x28')](respondWithStatusCode(_0x89a06f,null))[_0x823c('0x48')](handleError(_0x89a06f,null));};exports['getResources']=function(_0xf63ff6,_0x113ce9){var _0xb62a11={'raw':![],'where':{}};var _0x574c10={};var _0x25c586={'count':0x0,'rows':[]};var _0x1f54a3=_0xf63ff6[_0x823c('0x35')]['section'];if(typeof _0x1f54a3===_0x823c('0x21')){throw new db['Sequelize'][(_0x823c('0x6e'))]('Unknown\x20section');}var _0x26ca3e=_0xf63ff6[_0x823c('0x35')][_0x823c('0x6f')]||![];var _0x5b3757=getQueryModels(_0x1f54a3,_0x26ca3e);if(typeof _0x5b3757['childModel']===_0x823c('0x21')){throw new db[(_0x823c('0x70'))]['ValidationError'](_0x823c('0x71')+_0x1f54a3+'\x27');}var _0xcb5c4e=[];if(!_[_0x823c('0x63')](_0x5b3757['parentSections'])){_0xcb5c4e=_0x5b3757['parentSections'];}else{_0xcb5c4e=[{'name':_0x1f54a3}];}return db['UserProfile']['findOne']({'where':{'id':_0xf63ff6['params']['id']}})[_0x823c('0x28')](handleEntityNotFound(_0x113ce9,null))[_0x823c('0x28')](function(_0x4ea8bd){if(_0x4ea8bd){var _0x22432b=[];for(var _0x68bf76=0x0;_0x68bf76<_0xcb5c4e[_0x823c('0x3c')];_0x68bf76++){_0x22432b[_0x823c('0x69')](db[_0x823c('0x5b')]['findOne']({'where':{'userProfileId':_0x4ea8bd['id'],'name':_0xcb5c4e[_0x68bf76][_0x823c('0x2c')]},'raw':!![]}));}return BPromise[_0x823c('0x72')](_0x22432b);}})[_0x823c('0x28')](function(_0x4bc3c5){var _0x392ba2=_['filter'](_0x4bc3c5,function(_0x3c79f4){return _0x3c79f4?_0x3c79f4:undefined;});var _0x2be8ea=_[_0x823c('0x43')](_0xcb5c4e,['ignore',!![]]);var _0x13a306=_[_0x823c('0x63')](_0x392ba2)&&_['isEmpty'](_0x2be8ea)?null:_[_0x823c('0x73')](_0x2be8ea,_0x392ba2);if(_0x13a306){var _0x4c2c28=[];for(var _0xe4e764=0x0;_0xe4e764<_0x13a306[_0x823c('0x3c')];_0xe4e764++){var _0x30d8fb=_[_0x823c('0x4b')](_0xcb5c4e,function(_0x2936aa){return _0x13a306[_0xe4e764]?_0x2936aa['name']===_0x13a306[_0xe4e764][_0x823c('0x2c')]:null;});if(_0x30d8fb){if(_0x13a306[_0xe4e764][_0x823c('0x74')]){_0x4c2c28[_0x823c('0x69')](getAllResources(_0x5b3757[_0x823c('0x75')],_0x13a306[_0xe4e764]));}else{if(!_0x13a306[_0xe4e764][_0x823c('0x56')]){_0x4c2c28[_0x823c('0x69')](getAllowedResources(_0x30d8fb,_0x13a306[_0xe4e764],_0x5b3757[_0x823c('0x75')]));}else{if(_0x30d8fb[_0x823c('0x39')]){_0x4c2c28['push'](getAllFilteredResources(_0x30d8fb,_0x13a306[_0xe4e764]));}}}}}return BPromise[_0x823c('0x72')](_0x4c2c28);}else{return null;}})[_0x823c('0x28')](function(_0x20edc3){var _0x512b3e=_0x20edc3;var _0x5756c4=null;if(_0x512b3e){_0x5756c4=_0x512b3e['length']===0x1?_0x512b3e[0x0]:null;}if(_0x5756c4||_0x512b3e){var _0x5b73a9=db[_0x5b3757[_0x823c('0x75')]][_0x823c('0x30')];_0x574c10[_0x823c('0x39')]=_[_0x823c('0x36')](_0x5b73a9);_0x574c10['query']=_['keys'](_0xf63ff6[_0x823c('0x35')]);_0x574c10[_0x823c('0x37')]=_[_0x823c('0x38')](_0x574c10[_0x823c('0x39')],_0x574c10['query']);_0xb62a11[_0x823c('0x3b')]=_[_0x823c('0x38')](_0x574c10[_0x823c('0x39')],qs[_0x823c('0x3a')](_0xf63ff6[_0x823c('0x35')]['fields']));_0xb62a11['attributes']=_0xb62a11['attributes']['length']?_0xb62a11[_0x823c('0x3b')]:_0x574c10['model'];if(!_0xf63ff6[_0x823c('0x35')][_0x823c('0x3d')]('nolimit')){_0xb62a11[_0x823c('0x3f')]=qs[_0x823c('0x3f')](_0xf63ff6['query']['limit']);_0xb62a11[_0x823c('0x20')]=qs[_0x823c('0x20')](_0xf63ff6[_0x823c('0x35')][_0x823c('0x20')]);}_0xb62a11[_0x823c('0x40')]=qs[_0x823c('0x41')](_0xf63ff6[_0x823c('0x35')][_0x823c('0x41')]);_0xb62a11['where']=qs['filters'](_[_0x823c('0x76')](_0xf63ff6[_0x823c('0x35')],_0x574c10[_0x823c('0x37')]));if(_0xf63ff6['query'][_0x823c('0x43')]){_0xb62a11[_0x823c('0x42')]=_[_0x823c('0x4f')](_0xb62a11[_0x823c('0x42')],{'$or':_[_0x823c('0x34')](_0x5b73a9,function(_0x5b169a){if(_0x5b169a[_0x823c('0x32')][_0x823c('0x33')]!==_0x823c('0x77')){var _0x64bdef={};_0x64bdef[_0x5b169a[_0x823c('0x78')]]={'$like':'%'+_0xf63ff6['query'][_0x823c('0x43')]+'%'};return _0x64bdef;}})});}var _0x9137c2=[];if(_0x5756c4){var _0x24fc66=_['find'](_0xcb5c4e,['name',_0x5756c4[_0x823c('0x2c')]]);if(_0x24fc66[_0x823c('0x78')]){var _0x467d87={};if(_0x5b3757[_0x823c('0x75')]===_0x823c('0x79')){_0x467d87[_0x24fc66[_0x823c('0x7a')]]=_['map'](_0x5756c4['associatedResources'],'id');}else{_0x467d87[_0x24fc66['foreignKey']]=_0x5756c4['associatedResources'];}_0x9137c2[_0x823c('0x69')](_0x467d87);}else{_0xb62a11[_0x823c('0x42')]['id']=_0x5756c4[_0x823c('0x7b')];}}else{for(var _0xf8435f=0x0;_0xf8435f<_0x512b3e[_0x823c('0x3c')];_0xf8435f++){var _0x24fc66=_['find'](_0xcb5c4e,['name',_0x512b3e[_0xf8435f][_0x823c('0x2c')]]);if(_0x24fc66[_0x823c('0x78')]){var _0x467d87={};_0x467d87[_0x24fc66[_0x823c('0x7a')]]=_0x512b3e[_0xf8435f][_0x823c('0x7b')];_0x9137c2[_0x823c('0x69')](_0x467d87);}else{if(!_0xb62a11[_0x823c('0x42')]['id'])_0xb62a11[_0x823c('0x42')]['id']=[];_0x512b3e[_0xf8435f]['associatedResources']['forEach'](function(_0x35543a){_0xb62a11[_0x823c('0x42')]['id'][_0x823c('0x69')](_0x35543a);});}}}if(!_[_0x823c('0x63')](_0x9137c2)){_0xb62a11[_0x823c('0x42')]=_['merge'](_0xb62a11[_0x823c('0x42')],{'$and':{'$or':_0x9137c2}});}_0xb62a11=_['merge']({},_0xb62a11,_0xf63ff6[_0x823c('0x44')]);if(_0x5756c4&&!_0x5756c4[_0x823c('0x56')]&&_0x5b3757[_0x823c('0x75')]===_0x823c('0x79')){if(_0xf63ff6['query'][_0x823c('0x45')]){_0xb62a11[_0x823c('0x46')]=[{'all':!![]}];}return db[_0x5b3757[_0x823c('0x75')]][_0x823c('0x47')](_0xb62a11)[_0x823c('0x28')](function(_0x3d9070){var _0x3e0b05=[];_0x3d9070['forEach'](function(_0x313aa3){var _0x45b986;switch(_0x313aa3[_0x823c('0x7c')]){case _0x823c('0x7d'):_0x45b986=_[_0x823c('0x4b')](_0x5756c4[_0x823c('0x7b')],function(_0x2c2218){return _0x2c2218['id']===_0x313aa3['reportId']&&_0x2c2218['type']===_0x823c('0x7e');});break;case _0x823c('0x7f'):_0x45b986=_['find'](_0x5756c4[_0x823c('0x7b')],function(_0x50d88a){return _0x50d88a['id']===_0x313aa3[_0x823c('0x80')]&&_0x50d88a[_0x823c('0x32')]===_0x823c('0x81');});break;}if(_0x45b986)_0x3e0b05[_0x823c('0x69')](_0x313aa3);});_0x25c586[_0x823c('0x22')]=_0x3e0b05[_0x823c('0x3c')];_0x25c586[_0x823c('0x82')]=_0x3e0b05;return _0x25c586;});}else{return db[_0x5b3757[_0x823c('0x75')]][_0x823c('0x22')]({'where':_0xb62a11[_0x823c('0x42')]})[_0x823c('0x28')](function(_0x59b8bf){_0x25c586[_0x823c('0x22')]=_0x59b8bf;if(_0xf63ff6['query'][_0x823c('0x45')]){if(_0x5b3757[_0x823c('0x75')]===_0x823c('0x83')){_0xb62a11[_0x823c('0x46')]=[{'model':db[_0x823c('0x84')],'as':_0x823c('0x85'),'attributes':['id',_0x823c('0x2c'),_0x823c('0x86')],'required':_0xf63ff6[_0x823c('0x35')]['tag']?!![]:![]},{'model':db[_0x823c('0x84')],'as':'ThroughTags','attributes':['id',_0x823c('0x2c'),_0x823c('0x86')],'through':_0xf63ff6[_0x823c('0x35')][_0x823c('0x87')]?{'attributes':[],'where':{'TagId':_0xf63ff6['query'][_0x823c('0x87')]||undefined}}:{},'required':_0xf63ff6[_0x823c('0x35')][_0x823c('0x87')]?!![]:![]}];}else{_0xb62a11[_0x823c('0x46')]=[{'all':!![]}];}}return db[_0x5b3757['childModel']][_0x823c('0x47')](_0xb62a11);})[_0x823c('0x28')](function(_0x5b9f2b){_0x25c586[_0x823c('0x82')]=_0x5b9f2b;if(_0x1f54a3===_0x823c('0x88')&&_0xf63ff6['query'][_0x823c('0x89')]==='true'){var _0x16c2e9=[];for(var _0x190c6a=0x0;_0x190c6a<_0x25c586[_0x823c('0x82')]['length'];_0x190c6a++){_0x16c2e9['push'](getOpenTabs(_0x823c('0x8a'),_0x25c586[_0x823c('0x82')][_0x190c6a]['dataValues']));_0x16c2e9[_0x823c('0x69')](getOpenTabs(_0x823c('0x8b'),_0x25c586[_0x823c('0x82')][_0x190c6a][_0x823c('0x8c')]));_0x16c2e9[_0x823c('0x69')](getOpenTabs('fax',_0x25c586[_0x823c('0x82')][_0x190c6a]['dataValues']));_0x16c2e9[_0x823c('0x69')](getOpenTabs(_0x823c('0x8d'),_0x25c586[_0x823c('0x82')][_0x190c6a][_0x823c('0x8c')]));_0x16c2e9[_0x823c('0x69')](getOpenTabs(_0x823c('0x8e'),_0x25c586[_0x823c('0x82')][_0x190c6a][_0x823c('0x8c')]));_0x16c2e9[_0x823c('0x69')](getOpenTabs(_0x823c('0x8f'),_0x25c586[_0x823c('0x82')][_0x190c6a]['dataValues']));}return Promise[_0x823c('0x72')](_0x16c2e9)[_0x823c('0x28')](function(){return _0x25c586;});}return _0x25c586;});}}else{return _0x25c586;}})['then'](respondWithFilteredResult(_0x113ce9,_0xb62a11))[_0x823c('0x48')](handleError(_0x113ce9,null));};function getOpenTabs(_0xb18da9,_0x179584){var _0x28be22=_0xb18da9[_0x823c('0x90')](0x0)[_0x823c('0x91')]()+_0xb18da9[_0x823c('0x92')](0x1);var _0x189867={'type':db[_0x823c('0x70')][_0x823c('0x93')][_0x823c('0x94')],'raw':!![]};return new BPromise(function(_0x119174,_0x389078){var _0x303f30=squel['select']()[_0x823c('0x78')](_0x823c('0x95')+_0x28be22+_0x823c('0x96'),'id')['field'](_0x823c('0x97'))[_0x823c('0x98')](_0x823c('0x99')+_0xb18da9+'_interactions','ui')[_0x823c('0x42')](_0x823c('0x9a'),_0x179584['id']);return db['sequelize'][_0x823c('0x35')](_0x303f30['toString'](),_0x189867)['then'](function(_0x54eb15){_0x179584[_0x28be22+_0x823c('0x9b')]=_0x54eb15;_0x119174(_0x54eb15);})[_0x823c('0x48')](function(_0x4b82ad){_0x389078(_0x4b82ad);});});}function getAllResources(_0x4fb8b9,_0x13ea74){return new BPromise(function(_0x12b1c2,_0x675fb1){if(_0x13ea74){var _0x46cb16=_0x13ea74[_0x823c('0x43')]?{[_0x13ea74[_0x823c('0x43')][_0x823c('0x78')]]:_0x13ea74['filter'][_0x823c('0x9c')]}:undefined;return db[_0x4fb8b9][_0x823c('0x47')]({'where':_0x46cb16,'raw':!![]})[_0x823c('0x28')](function(_0x46d62e){_0x13ea74[_0x823c('0x7b')]=_[_0x823c('0x34')](_0x46d62e,'id');_0x12b1c2(_0x13ea74);})[_0x823c('0x48')](function(_0x4f8636){_0x675fb1(_0x4f8636);});}else{_0x12b1c2(null);}});}function getAllFilteredResources(_0x542489,_0x1ad2f2){return new BPromise(function(_0x8fc29a,_0x3dec92){var _0xbb168c=_0x542489[_0x823c('0x43')]?{[_0x542489['filter']['field']]:_0x542489[_0x823c('0x43')][_0x823c('0x9c')]}:undefined;return db[_0x542489[_0x823c('0x39')]][_0x823c('0x47')]({'where':_0xbb168c,'raw':!![]})[_0x823c('0x28')](function(_0x58acb4){_0x1ad2f2[_0x823c('0x7b')]=_['map'](_0x58acb4,function(_0x5666d5){return _0x542489[_0x823c('0x78')]?_0x5666d5[_0x542489[_0x823c('0x78')]]:_0x5666d5['name'];});_0x8fc29a(_0x1ad2f2);})[_0x823c('0x48')](function(_0x4b89cd){_0x3dec92(_0x4b89cd);});});}function getAllowedResources(_0x42abeb,_0x2d3cf9,_0x544efa){return new BPromise(function(_0xda0085,_0x4216b7){if(_0x2d3cf9){return db[_0x823c('0x57')][_0x823c('0x47')]({'where':{'sectionId':_0x2d3cf9['id']},'raw':!![]})[_0x823c('0x28')](function(_0xe290f6){if(_0x42abeb[_0x823c('0x78')]&&_0x42abeb[_0x823c('0x78')]!=='id'){_0x2d3cf9[_0x823c('0x7b')]=_[_0x823c('0x34')](_0xe290f6,function(_0x63bb28){return _0x63bb28[_0x42abeb[_0x823c('0x78')]];});}else{if(_0x544efa===_0x823c('0x79')){_0x2d3cf9['associatedResources']=_[_0x823c('0x34')](_0xe290f6,function(_0x2f034c){return{'id':_0x2f034c['resourceId'],'type':_0x2f034c[_0x823c('0x32')]};});}else{_0x2d3cf9[_0x823c('0x7b')]=_[_0x823c('0x34')](_0xe290f6,function(_0x217b74){return _0x217b74[_0x823c('0x6a')];});}}_0xda0085(_0x2d3cf9);})[_0x823c('0x48')](function(_0x170bb5){_0x4216b7(_0x170bb5);});}else{_0xda0085(null);}});}function getQueryModels(_0x4c5bf8,_0x55e09a){var _0x436e38=_0x4c5bf8[_0x823c('0x9d')]();var _0x27c18d={'childModel':undefined,'parentSections':[]};switch(_0x436e38){case _0x823c('0x9e'):_0x27c18d[_0x823c('0x75')]=_0x823c('0x9f');break;case _0x823c('0xa0'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xa1');break;case _0x823c('0xa2'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xa3');_0x27c18d[_0x823c('0xa4')]=[{'name':_0x823c('0xa5'),'field':_0x823c('0x2c'),'foreignKey':'projectName'}];break;case _0x823c('0xa6'):_0x27c18d['childModel']=_0x823c('0xa7');break;case _0x823c('0xa8'):_0x27c18d[_0x823c('0x75')]=_0x823c('0x83');_0x27c18d['parentSections']=[{'name':_0x823c('0xa9'),'field':'id','foreignKey':_0x823c('0xaa')}];break;case _0x823c('0xab'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xac');break;case _0x823c('0xad'):_0x27c18d['childModel']=_0x823c('0xae');break;case'globalcustomfields':_0x27c18d[_0x823c('0x75')]=_0x823c('0xaf');break;case _0x823c('0xb0'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xb1');break;case _0x823c('0xb2'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xb3');break;case _0x823c('0xb4'):_0x27c18d[_0x823c('0x75')]='FaxQueue';break;case'faxaccounts':_0x27c18d[_0x823c('0x75')]=_0x823c('0xb5');break;case _0x823c('0xb6'):case _0x823c('0xb7'):case'outboundroutes':_0x27c18d['childModel']='VoiceExtension';break;case _0x823c('0xb8'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xb9');break;case _0x823c('0xba'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xbb');break;case _0x823c('0xbc'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xbd');_0x27c18d[_0x823c('0xa4')]=[{'name':'Agents','field':_0x823c('0x2c'),'foreignKey':'membername','model':'User','filter':{'field':_0x823c('0xbe'),'value':[_0x823c('0xbf')]}},{'name':_0x823c('0xc0'),'field':_0x823c('0x2c'),'foreignKey':_0x823c('0xc1'),'model':_0x823c('0xc2'),'filter':{'field':_0x823c('0xbe'),'value':[_0x823c('0xc3')]}},{'name':_0x823c('0xc4'),'field':_0x823c('0x2c'),'foreignKey':_0x823c('0xc5'),'model':'VoiceQueue','filter':{'field':_0x823c('0x32'),'value':['inbound']}},{'name':_0x823c('0xc6'),'field':_0x823c('0x2c'),'foreignKey':_0x823c('0xc5'),'model':_0x823c('0xc7'),'filter':{'field':_0x823c('0x32'),'value':['outbound']}}];break;case'musiconholds':_0x27c18d['childModel']=_0x823c('0xc8');break;case _0x823c('0xc9'):_0x27c18d[_0x823c('0x75')]='VoiceChanSpy';break;case _0x823c('0xca'):_0x27c18d[_0x823c('0x75')]='VoicePrefix';break;case _0x823c('0xcb'):_0x27c18d[_0x823c('0x75')]='Campaign';break;case _0x823c('0xcc'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xcd');break;case _0x823c('0xce'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xcf');break;case _0x823c('0xd0'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xd1');break;case _0x823c('0xd2'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xd3');break;case _0x823c('0xd4'):_0x27c18d[_0x823c('0x75')]='OpenchannelAccount';break;case _0x823c('0xd5'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xd6');break;case _0x823c('0xd7'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xd8');break;case _0x823c('0xd9'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xda');break;case _0x823c('0xdb'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xdc');break;case _0x823c('0xdd'):case _0x823c('0xde'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xc7');if(_0x55e09a){_0x27c18d[_0x823c('0xa4')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case'users':case _0x823c('0xdf'):case _0x823c('0xe0'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xc2');if(_0x55e09a){_0x27c18d[_0x823c('0xa4')]=[{'name':_0x823c('0xe1'),'filter':{'field':_0x823c('0xbe'),'value':[_0x823c('0xe2'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0x823c('0xc0')}];}break;case _0x823c('0xe3'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xe4');break;case'salesforceaccounts':_0x27c18d['childModel']='SalesforceAccount';break;case _0x823c('0xe5'):_0x27c18d['childModel']=_0x823c('0xe6');break;case _0x823c('0xe7'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xe8');break;case'deskaccounts':_0x27c18d['childModel']=_0x823c('0xe9');break;case _0x823c('0xea'):_0x27c18d['childModel']='ZohoAccount';break;case'vtigeraccounts':_0x27c18d[_0x823c('0x75')]=_0x823c('0xc2');break;case'cannedanswers':_0x27c18d[_0x823c('0x75')]=_0x823c('0xeb');break;case _0x823c('0xec'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xed');break;case'customdashboards':_0x27c18d[_0x823c('0x75')]=_0x823c('0x66');break;case _0x823c('0xee'):_0x27c18d['childModel']='Interval';break;case _0x823c('0xef'):_0x27c18d[_0x823c('0x75')]='Pause';break;case _0x823c('0xf0'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xf1');break;case _0x823c('0xf2'):_0x27c18d['childModel']=_0x823c('0xf3');break;case _0x823c('0xf4'):_0x27c18d[_0x823c('0x75')]='Tag';break;case _0x823c('0xf5'):_0x27c18d['childModel']=_0x823c('0xf6');break;case'triggers':_0x27c18d[_0x823c('0x75')]=_0x823c('0xf7');break;case _0x823c('0xf8'):_0x27c18d[_0x823c('0x75')]='Trunk';break;case _0x823c('0xf9'):_0x27c18d[_0x823c('0x75')]='Variable';break;case _0x823c('0xfa'):_0x27c18d['childModel']=_0x823c('0x68');break;case'extractedreports':_0x27c18d['childModel']=_0x823c('0x79');_0x27c18d['parentSections']=[{'name':_0x823c('0xfb'),'field':'id','foreignKey':_0x823c('0x80')}];break;case'metrics':_0x27c18d['childModel']=_0x823c('0xfc');break;case _0x823c('0xfd'):_0x27c18d[_0x823c('0x75')]='WhatsappAccount';break;case _0x823c('0xfe'):_0x27c18d[_0x823c('0x75')]=_0x823c('0xff');_0x27c18d[_0x823c('0xa4')]=[{'name':'Agents','field':'id','foreignKey':'UserId','model':_0x823c('0xc2'),'filter':{'field':_0x823c('0xbe'),'value':[_0x823c('0xbf')]}},{'name':'Telephones','field':'id','foreignKey':_0x823c('0x100'),'model':'User','filter':{'field':'role','value':[_0x823c('0xc3')]}}];break;default:return _0x27c18d;}return _0x27c18d;} \ No newline at end of file +var _0x144f=['squareprojects','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','MailAccount','mailsubstatuses','openchannelqueues','openchannelaccounts','OpenchannelAccount','SmsQueue','whatsappqueues','WhatsappQueue','teams','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','deskaccounts','zohoaccounts','dispositions','Disposition','customdashboards','intervals','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Trigger','trunks','variables','Variable','extractedreports','Reports','AnalyticMetric','whatsappaccounts','WhatsappAccount','screenrecordings','ScreenRecording','UserId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','destroy','then','sendStatus','stack','name','send','UserProfile','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','clone','get','omit','createdAt','body','updatedAt','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','push','ids','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','mergeResources','parentSections','all','ignore','union','childModel','pick','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','reportId','DefaultReports','CustomReports','CmContact','Tag','color','tag','ThroughTags','Agents','openTabs','true','chat','dataValues','fax','mail','openchannel','whatsapp','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','_interactions','toString','OpenTabs','value','toLowerCase'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x144f,0x15f));var _0xf144=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x144f[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf144('0x0'));var zipdir=require(_0xf144('0x1'));var jsonpatch=require(_0xf144('0x2'));var rp=require(_0xf144('0x3'));var moment=require(_0xf144('0x4'));var BPromise=require(_0xf144('0x5'));var Mustache=require(_0xf144('0x6'));var util=require(_0xf144('0x7'));var path=require('path');var sox=require(_0xf144('0x8'));var csv=require(_0xf144('0x9'));var ejs=require(_0xf144('0xa'));var fs=require('fs');var fs_extra=require(_0xf144('0xb'));var _=require('lodash');var squel=require(_0xf144('0xc'));var crypto=require('crypto');var jsforce=require(_0xf144('0xd'));var deskjs=require(_0xf144('0xe'));var toCsv=require(_0xf144('0x9'));var querystring=require(_0xf144('0xf'));var Papa=require(_0xf144('0x10'));var Redis=require(_0xf144('0x11'));var authService=require(_0xf144('0x12'));var qs=require(_0xf144('0x13'));var as=require(_0xf144('0x14'));var hardwareService=require(_0xf144('0x15'));var logger=require(_0xf144('0x16'))('api');var utils=require(_0xf144('0x17'));var config=require(_0xf144('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf144('0x19'))['db'];config[_0xf144('0x1a')]=_['defaults'](config[_0xf144('0x1a')],{'host':_0xf144('0x1b'),'port':0x18eb});var socket=require(_0xf144('0x1c'))(new Redis(config['redis']));require(_0xf144('0x1d'))[_0xf144('0x1e')](socket);function respondWithStatusCode(_0x8bc355,_0x55cc44){_0x55cc44=_0x55cc44||0xcc;return function(_0x5f26d0){if(_0x5f26d0){return _0x8bc355['sendStatus'](_0x55cc44);}return _0x8bc355['status'](_0x55cc44)[_0xf144('0x1f')]();};}function respondWithResult(_0x3503b4,_0x2d53fa){_0x2d53fa=_0x2d53fa||0xc8;return function(_0x49c039){if(_0x49c039){return _0x3503b4[_0xf144('0x20')](_0x2d53fa)[_0xf144('0x21')](_0x49c039);}};}function respondWithFilteredResult(_0x1f2693,_0x47bea8){return function(_0x13a142){if(_0x13a142){var _0x48bcc6=typeof _0x47bea8[_0xf144('0x22')]===_0xf144('0x23')&&typeof _0x47bea8['limit']===_0xf144('0x23');var _0x23954b=_0x13a142['count'];var _0x23ac2a=_0x48bcc6?0x0:_0x47bea8[_0xf144('0x22')];var _0x4f258b=_0x48bcc6?_0x13a142['count']:_0x47bea8[_0xf144('0x22')]+_0x47bea8[_0xf144('0x24')];var _0x23b955;if(_0x4f258b>=_0x23954b){_0x4f258b=_0x23954b;_0x23b955=0xc8;}else{_0x23b955=0xce;}_0x1f2693['status'](_0x23b955);return _0x1f2693[_0xf144('0x25')](_0xf144('0x26'),_0x23ac2a+'-'+_0x4f258b+'/'+_0x23954b)[_0xf144('0x21')](_0x13a142);}return null;};}function patchUpdates(_0x406e56){return function(_0x1b2588){try{jsonpatch[_0xf144('0x27')](_0x1b2588,_0x406e56,!![]);}catch(_0xaea821){return BPromise[_0xf144('0x28')](_0xaea821);}return _0x1b2588['save']();};}function saveUpdates(_0x4352a9,_0x1a0c14){return function(_0x4adab2){if(_0x4adab2){return _0x4adab2['update'](_0x4352a9)['then'](function(_0x31e1e9){return _0x31e1e9;});}return null;};}function removeEntity(_0x5fdbef,_0x249fa0){return function(_0x30ef2e){if(_0x30ef2e){return _0x30ef2e[_0xf144('0x29')]()[_0xf144('0x2a')](function(){_0x5fdbef[_0xf144('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b71fb,_0x439a80){return function(_0x3c1830){if(!_0x3c1830){_0x2b71fb[_0xf144('0x2b')](0x194);}return _0x3c1830;};}function handleError(_0x8b632a,_0x40a2da){_0x40a2da=_0x40a2da||0x1f4;return function(_0x4a247c){logger['error'](_0x4a247c[_0xf144('0x2c')]);if(_0x4a247c[_0xf144('0x2d')]){delete _0x4a247c[_0xf144('0x2d')];}_0x8b632a['status'](_0x40a2da)[_0xf144('0x2e')](_0x4a247c);};}exports['index']=function(_0x434a09,_0x284689){var _0x4768ec={},_0xcb85c1={},_0x2611ef={'count':0x0,'rows':[]};var _0x103294=_['map'](db[_0xf144('0x2f')][_0xf144('0x30')],function(_0x1d4926){return{'name':_0x1d4926[_0xf144('0x31')],'type':_0x1d4926['type'][_0xf144('0x32')]};});_0xcb85c1[_0xf144('0x33')]=_[_0xf144('0x34')](_0x103294,_0xf144('0x2d'));_0xcb85c1['query']=_[_0xf144('0x35')](_0x434a09[_0xf144('0x36')]);_0xcb85c1[_0xf144('0x37')]=_[_0xf144('0x38')](_0xcb85c1['model'],_0xcb85c1[_0xf144('0x36')]);_0x4768ec['attributes']=_['intersection'](_0xcb85c1[_0xf144('0x33')],qs[_0xf144('0x39')](_0x434a09[_0xf144('0x36')][_0xf144('0x39')]));_0x4768ec['attributes']=_0x4768ec[_0xf144('0x3a')][_0xf144('0x3b')]?_0x4768ec['attributes']:_0xcb85c1[_0xf144('0x33')];if(!_0x434a09[_0xf144('0x36')][_0xf144('0x3c')](_0xf144('0x3d'))){_0x4768ec['limit']=qs[_0xf144('0x24')](_0x434a09['query'][_0xf144('0x24')]);_0x4768ec[_0xf144('0x22')]=qs[_0xf144('0x22')](_0x434a09[_0xf144('0x36')]['offset']);}_0x4768ec[_0xf144('0x3e')]=qs[_0xf144('0x3f')](_0x434a09[_0xf144('0x36')][_0xf144('0x3f')]);_0x4768ec[_0xf144('0x40')]=qs[_0xf144('0x37')](_['pick'](_0x434a09[_0xf144('0x36')],_0xcb85c1[_0xf144('0x37')]),_0x103294);if(_0x434a09[_0xf144('0x36')][_0xf144('0x41')]){_0x4768ec[_0xf144('0x40')]=_['merge'](_0x4768ec[_0xf144('0x40')],{'$or':_[_0xf144('0x34')](_0x103294,function(_0x581f0d){if(_0x581f0d[_0xf144('0x42')]!=='VIRTUAL'){var _0x320434={};_0x320434[_0x581f0d[_0xf144('0x2d')]]={'$like':'%'+_0x434a09[_0xf144('0x36')][_0xf144('0x41')]+'%'};return _0x320434;}})});}_0x4768ec=_[_0xf144('0x43')]({},_0x4768ec,_0x434a09[_0xf144('0x44')]);var _0x109c09={'where':_0x4768ec['where']};return db[_0xf144('0x2f')]['count'](_0x109c09)[_0xf144('0x2a')](function(_0x2711f7){_0x2611ef[_0xf144('0x45')]=_0x2711f7;if(_0x434a09[_0xf144('0x36')]['includeAll']){_0x4768ec[_0xf144('0x46')]=[{'all':!![]}];}return db['UserProfile'][_0xf144('0x47')](_0x4768ec);})[_0xf144('0x2a')](function(_0xb612aa){_0x2611ef[_0xf144('0x48')]=_0xb612aa;return _0x2611ef;})[_0xf144('0x2a')](respondWithFilteredResult(_0x284689,_0x4768ec))[_0xf144('0x49')](handleError(_0x284689,null));};exports[_0xf144('0x4a')]=function(_0x1e1999,_0x2f0598){var _0xab1246={'raw':![],'where':{'id':_0x1e1999[_0xf144('0x4b')]['id']}},_0x228a9a={};_0x228a9a[_0xf144('0x33')]=_[_0xf144('0x35')](db[_0xf144('0x2f')][_0xf144('0x30')]);_0x228a9a[_0xf144('0x36')]=_['keys'](_0x1e1999[_0xf144('0x36')]);_0x228a9a['filters']=_[_0xf144('0x38')](_0x228a9a[_0xf144('0x33')],_0x228a9a[_0xf144('0x36')]);_0xab1246[_0xf144('0x3a')]=_['intersection'](_0x228a9a[_0xf144('0x33')],qs[_0xf144('0x39')](_0x1e1999['query'][_0xf144('0x39')]));_0xab1246[_0xf144('0x3a')]=_0xab1246[_0xf144('0x3a')]['length']?_0xab1246[_0xf144('0x3a')]:_0x228a9a[_0xf144('0x33')];if(_0x1e1999[_0xf144('0x36')][_0xf144('0x4c')]){_0xab1246[_0xf144('0x46')]=[{'all':!![]}];}_0xab1246=_['merge']({},_0xab1246,_0x1e1999[_0xf144('0x44')]);return db[_0xf144('0x2f')][_0xf144('0x4d')](_0xab1246)[_0xf144('0x2a')](handleEntityNotFound(_0x2f0598,null))[_0xf144('0x2a')](respondWithResult(_0x2f0598,null))[_0xf144('0x49')](handleError(_0x2f0598,null));};exports[_0xf144('0x4e')]=function(_0x2b3bc8,_0x5154ba){return db[_0xf144('0x2f')][_0xf144('0x4e')](_0x2b3bc8['body'],{})['then'](respondWithResult(_0x5154ba,0xc9))['catch'](handleError(_0x5154ba,null));};exports[_0xf144('0x4f')]=function(_0x2f32c7,_0x2aa959){var _0x3e79e0={'where':{'id':_0x2f32c7['params']['id']}},_0x38e2e1={};_0x38e2e1['model']=_['keys'](db[_0xf144('0x2f')][_0xf144('0x30')]);_0x3e79e0[_0xf144('0x3a')]=_['intersection'](_0x38e2e1[_0xf144('0x33')],qs[_0xf144('0x39')](_0x2f32c7[_0xf144('0x36')][_0xf144('0x39')]));_0x3e79e0['attributes']=_0x3e79e0['attributes'][_0xf144('0x3b')]?_0x3e79e0[_0xf144('0x3a')]:_0x38e2e1[_0xf144('0x33')];if(_0x2f32c7[_0xf144('0x36')]['includeAll']){_0x3e79e0[_0xf144('0x46')]=[{'all':!![]}];}_0x3e79e0=_[_0xf144('0x43')]({},_0x3e79e0,_0x2f32c7[_0xf144('0x44')]);return db[_0xf144('0x2f')][_0xf144('0x4d')](_0x3e79e0)[_0xf144('0x2a')](handleEntityNotFound(_0x2aa959,null))[_0xf144('0x2a')](function(_0x383c7a){if(_0x383c7a){var _0x241f74=_0x383c7a[_0xf144('0x50')]({'plain':!![]});_0x241f74=qs[_0xf144('0x51')](_0x241f74,['id',_0xf144('0x52'),'updatedAt','crudPermissions']);_0x2f32c7[_0xf144('0x53')]=_['omit'](_0x2f32c7[_0xf144('0x53')],['id',_0xf144('0x52'),_0xf144('0x54')]);return db[_0xf144('0x55')][_0xf144('0x56')](function(_0x599ce8){return db[_0xf144('0x2f')][_0xf144('0x4e')](_[_0xf144('0x43')](_0x241f74,_0x2f32c7['body']),{'include':_0x2f32c7[_0xf144('0x36')][_0xf144('0x4c')]?[{'all':!![]}]:undefined,'transaction':_0x599ce8})[_0xf144('0x2a')](function(_0x2253e4){var _0x1075a5=_0x2253e4['get']({'plain':!![]});return db['UserProfileSection'][_0xf144('0x47')]({'where':{'userProfileId':_0x2f32c7[_0xf144('0x4b')]['id']},'raw':!![]})[_0xf144('0x2a')](function(_0x50b74b){if(_0x50b74b){return BPromise[_0xf144('0x57')](_0x50b74b,function(_0x453862){return new BPromise(function(_0xccc957,_0x1de874){if(_0x453862[_0xf144('0x58')]===null||_0x453862['autoAssociation']===0x1)_0xccc957(null);return db[_0xf144('0x59')][_0xf144('0x47')]({'where':{'sectionId':_0x453862['id']},'raw':!![]})[_0xf144('0x2a')](function(_0x3aed22){var _0x213cce=_[_0xf144('0x34')](_0x3aed22,function(_0x2066df){return qs[_0xf144('0x51')](_0x2066df,['id',_0xf144('0x52'),_0xf144('0x54'),_0xf144('0x5a')]);});_0xccc957(_0x213cce);})[_0xf144('0x49')](function(_0x28ad12){_0x1de874(_0x28ad12);});})[_0xf144('0x2a')](function(_0x5f3027){var _0x39bb4c=qs[_0xf144('0x51')](_0x453862,['id',_0xf144('0x52'),_0xf144('0x54')]);_0x39bb4c[_0xf144('0x5b')]=_0x1075a5['id'];if(_0x5f3027)_0x39bb4c[_0xf144('0x5c')]=_0x5f3027;return _0x39bb4c;})[_0xf144('0x2a')](function(_0x467a77){return db[_0xf144('0x5d')][_0xf144('0x4e')](_0x467a77,{'include':[{'model':db['UserProfileResource'],'as':_0xf144('0x5c')}],'raw':!![],'transaction':_0x599ce8});});})['then'](function(){return _0x1075a5;});}});});});}})['then'](respondWithResult(_0x2aa959,0xc9))[_0xf144('0x49')](handleError(_0x2aa959,null));};exports['update']=function(_0x142ab5,_0x2aab29){if(_0x142ab5[_0xf144('0x53')]['id']){delete _0x142ab5[_0xf144('0x53')]['id'];}return db[_0xf144('0x2f')][_0xf144('0x4d')]({'where':{'id':_0x142ab5[_0xf144('0x4b')]['id']}})[_0xf144('0x2a')](handleEntityNotFound(_0x2aab29,null))[_0xf144('0x2a')](saveUpdates(_0x142ab5[_0xf144('0x53')],null))['then'](respondWithResult(_0x2aab29,null))['catch'](handleError(_0x2aab29,null));};exports[_0xf144('0x29')]=function(_0x2d463c,_0x15a51f){return db[_0xf144('0x2f')][_0xf144('0x4d')]({'where':{'id':_0x2d463c[_0xf144('0x4b')]['id']}})['then'](handleEntityNotFound(_0x15a51f,null))[_0xf144('0x2a')](removeEntity(_0x15a51f,null))[_0xf144('0x49')](handleError(_0x15a51f,null));};exports['describe']=function(_0x2be478,_0x561361){return db[_0xf144('0x2f')][_0xf144('0x5e')]()['then'](respondWithResult(_0x561361,null))[_0xf144('0x49')](handleError(_0x561361,null));};exports[_0xf144('0x5f')]=function(_0x2522b2,_0x13a300){var _0x3971bc=_0x2522b2[_0xf144('0x53')];return db['UserProfile'][_0xf144('0x4d')]({'where':{'id':_0x2522b2[_0xf144('0x4b')]['id']}})[_0xf144('0x2a')](handleEntityNotFound(_0x13a300,null))[_0xf144('0x2a')](function(_0x1ca49c){if(_0x1ca49c){return db[_0xf144('0x55')]['transaction'](function(_0x39eef1){return db[_0xf144('0x5d')][_0xf144('0x29')]({'where':{'userProfileId':_0x2522b2[_0xf144('0x4b')]['id'],'sectionId':_[_0xf144('0x34')](_0x3971bc,function(_0x2bb546){return _0x2bb546[_0xf144('0x5a')];})},'transaction':_0x39eef1})['then'](function(){var _0x34815c=_['map'](_0x3971bc,function(_0xd2655f){_0xd2655f[_0xf144('0x5b')]=_0x2522b2[_0xf144('0x4b')]['id'];return _0xd2655f;});var _0x196336=[];return BPromise[_0xf144('0x57')](_0x34815c,function(_0x2636a6){return db[_0xf144('0x5d')][_0xf144('0x4e')](_0x2636a6,{'include':[{'model':db[_0xf144('0x59')],'as':_0xf144('0x5c')}],'raw':!![],'transaction':_0x39eef1})[_0xf144('0x2a')](function(_0x579a07){_0x196336[_0xf144('0x60')](_0x579a07['get']({'plain':!![]}));});})[_0xf144('0x2a')](function(){return _0x196336;});});});}})[_0xf144('0x2a')](function(_0x5c2471){return _0x5c2471;})[_0xf144('0x2a')](respondWithResult(_0x13a300,null))[_0xf144('0x49')](handleError(_0x13a300,null));};exports['removeSections']=function(_0x3b949a,_0x5f2498){var _0x2d4bf7;return db['UserProfile'][_0xf144('0x4d')]({'where':{'id':_0x3b949a['params']['id']},'attributes':['id','name']})[_0xf144('0x2a')](handleEntityNotFound(_0x5f2498,null))[_0xf144('0x2a')](function(_0x2fc16a){if(_0x2fc16a){_0x2d4bf7=_0x2fc16a;return db[_0xf144('0x5d')][_0xf144('0x29')]({'where':{'userProfileId':_0x3b949a[_0xf144('0x4b')]['id'],'sectionId':_0x3b949a[_0xf144('0x36')][_0xf144('0x61')]}});}})[_0xf144('0x2a')](function(){return _0x2d4bf7;})['then'](respondWithStatusCode(_0x5f2498,null))[_0xf144('0x49')](handleError(_0x5f2498,null));};exports['getSections']=function(_0x3253de,_0x14b2e0){var _0x36d1ed=[];var _0x5a25e7=[];return db[_0xf144('0x5d')][_0xf144('0x47')]({'where':{'userProfileId':_0x3253de[_0xf144('0x4b')]['id']},'raw':!![]})['then'](function(_0x148dfc){_0x36d1ed=_[_0xf144('0x41')](_0x148dfc,function(_0x3accaf){return _0x3accaf[_0xf144('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x3accaf[_0xf144('0x5a')]);});if(!_[_0xf144('0x63')](_0x36d1ed)){return _['map'](_0x36d1ed,function(_0x1c4735){return _0x1c4735['sectionId'];});}else{return;}})[_0xf144('0x2a')](function(_0x4da97f){if(_0x4da97f)_0x5a25e7=_0x4da97f;if(_[_0xf144('0x64')](_0x5a25e7,0x64)){var _0x41896d=_[_0xf144('0x4d')](_0x36d1ed,{'sectionId':0x64});return hasDefaultDashboard(_0x41896d)[_0xf144('0x2a')](function(_0x34a00c){return _[_0xf144('0x34')](_0x36d1ed,function(_0x13b78c){if(_0x13b78c[_0xf144('0x5a')]===0x64){_0x13b78c[_0xf144('0x65')]=_0x34a00c;}return _0x13b78c;});});}else{return;}})[_0xf144('0x2a')](function(_0x1ba5c7){if(_0x1ba5c7)_0x36d1ed=_0x1ba5c7;if(_[_0xf144('0x64')](_0x5a25e7,0x3eb)){var _0xb6ea2d=_[_0xf144('0x4d')](_0x36d1ed,{'sectionId':0x3eb});return getCustomDashboards(_0xb6ea2d)['then'](function(_0x499357){return _['map'](_0x36d1ed,function(_0x226622){if(_0xb6ea2d['enabled']){if(_0x226622[_0xf144('0x5a')]===0x3eb){_0x226622[_0xf144('0x65')]=_0x499357;}}else{if(_0x226622[_0xf144('0x5a')]===0x64){_0x226622[_0xf144('0x65')]=_0x499357;}}return _0x226622;});});}else{return;}})[_0xf144('0x2a')](function(_0x1f5633){if(_0x1f5633)_0x36d1ed=_0x1f5633;if(_[_0xf144('0x64')](_0x5a25e7,0x709)){var _0xeabfc6=_[_0xf144('0x4d')](_0x36d1ed,{'sectionId':0x709});return getPlugins(_0xeabfc6)[_0xf144('0x2a')](function(_0x2ddef6){if(_0xeabfc6[_0xf144('0x62')]){return _['map'](_0x36d1ed,function(_0x149072){if(_0x149072[_0xf144('0x5a')]===0x709){_0x149072[_0xf144('0x65')]=_0x2ddef6;}return _0x149072;});}else{var _0x49d607={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2ddef6};var _0x196d38=_[_0xf144('0x34')](_0x36d1ed);_0x196d38[_0xf144('0x60')](_0x49d607);return _0x196d38;}});}else{return;}})['then'](function(_0x598771){if(_0x598771)_0x36d1ed=_0x598771;return _[_0xf144('0x41')](_0x36d1ed,[_0xf144('0x62'),0x1]);})[_0xf144('0x2a')](respondWithResult(_0x14b2e0,null))[_0xf144('0x49')](handleError(_0x14b2e0,null));};function hasDefaultDashboard(_0x374a75){var _0xca7859=[0x65];return new BPromise(function(_0x1faf98,_0x580024){try{if(_0x374a75[_0xf144('0x58')]){_0x1faf98(_0xca7859);}else{return db[_0xf144('0x59')][_0xf144('0x66')]({'where':{'sectionId':_0x374a75['id']},'raw':!![]})[_0xf144('0x2a')](function(_0x4eaffb){_0x4eaffb?_0x1faf98(_0xca7859):_0x1faf98();});}}catch(_0x56533f){_0x580024(_0x56533f);}});}function getCustomDashboards(_0x7eac63){var _0x278dde=[];return new BPromise(function(_0x514377,_0x48c587){try{if(_0x7eac63[_0xf144('0x58')]){return db[_0xf144('0x67')]['findAll']({'raw':!![]})['then'](function(_0x48f35e){_0x48f35e[_0xf144('0x68')](function(_0x44f8c9){_0x278dde[_0xf144('0x60')](_0x44f8c9['id']+0x1869f);});_0x514377(_0x278dde);});}else{return db[_0xf144('0x59')]['findAll']({'where':{'sectionId':_0x7eac63['id']},'raw':!![]})['then'](function(_0x5721c9){_0x5721c9[_0xf144('0x68')](function(_0xe6a0c0){_0x278dde['push'](_0xe6a0c0[_0xf144('0x69')]+0x1869f);});_0x514377(_0x278dde);});}}catch(_0x120dda){_0x48c587(_0x120dda);}});}function getPlugins(_0x2e1dd7){var _0x2b6f61=[];return new BPromise(function(_0x4b1c5b,_0x2d740d){try{if(_0x2e1dd7[_0xf144('0x58')]){return db[_0xf144('0x6a')][_0xf144('0x47')]({'raw':!![]})[_0xf144('0x2a')](function(_0x4e6cfa){_0x4e6cfa[_0xf144('0x68')](function(_0x5b34d2){_0x2b6f61[_0xf144('0x60')](_0x5b34d2['id']+0x15b38);});_0x4b1c5b(_0x2b6f61);});}else{return db[_0xf144('0x59')][_0xf144('0x47')]({'where':{'sectionId':_0x2e1dd7['id']},'raw':!![]})[_0xf144('0x2a')](function(_0x21c7e6){_0x21c7e6[_0xf144('0x68')](function(_0xfebd80){_0x2b6f61[_0xf144('0x60')](_0xfebd80[_0xf144('0x69')]+0x15b38);});_0x4b1c5b(_0x2b6f61);});}}catch(_0x21035e){_0x2d740d(_0x21035e);}});}exports[_0xf144('0x6b')]=function(_0x11ef31,_0x370e5f){return db['UserProfile']['find']({'where':{'id':_0x11ef31[_0xf144('0x4b')]['id']}})['then'](handleEntityNotFound(_0x370e5f,null))[_0xf144('0x2a')](function(_0x5e7321){if(_0x5e7321){return db[_0xf144('0x55')][_0xf144('0x56')](function(_0x25295f){return db[_0xf144('0x5d')][_0xf144('0x47')]({'where':{'userProfileId':_0x11ef31[_0xf144('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0xf144('0x2a')](function(_0x10e3a2){if(_0x10e3a2){return db[_0xf144('0x5d')][_0xf144('0x29')]({'where':{'userProfileId':_0x11ef31[_0xf144('0x4b')]['id'],'id':_['map'](_0x10e3a2,function(_0x53836c){return _0x53836c['id'];})},'transaction':_0x25295f});}})['then'](function(_0x49c836){var _0x18e2d3=_[_0xf144('0x34')](_0x11ef31[_0xf144('0x53')],function(_0x29a56e){_0x29a56e[_0xf144('0x5b')]=_0x11ef31[_0xf144('0x4b')]['id'];return _0x29a56e;});return db['UserProfileSection'][_0xf144('0x6c')](_0x18e2d3,{'raw':!![],'transaction':_0x25295f});})[_0xf144('0x2a')](function(_0x43150b){var _0x4d7629=_[_0xf144('0x41')](_['map'](_0x43150b,function(_0x49d58c){return _0x49d58c[_0xf144('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x4d7629){return db[_0xf144('0x5d')][_0xf144('0x47')]({'where':{'userProfileId':_0x11ef31[_0xf144('0x4b')]['id'],'sectionId':_['map'](_0x4d7629,function(_0x440b25){return _0x440b25[_0xf144('0x5a')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x5b4740){var _0x15c95b=_[_0xf144('0x34')](_0x11ef31[_0xf144('0x53')],function(_0x507a6c){_0x507a6c['userProfileId']=_0x11ef31[_0xf144('0x4b')]['id'];return _0x507a6c;});return db[_0xf144('0x59')][_0xf144('0x6c')](_0x15c95b,{'raw':!![],'transaction':_0x25295f});});}})[_0xf144('0x49')](handleError(_0x370e5f,null));});}})[_0xf144('0x2a')](function(_0x346619){var _0x100069=_[_0xf144('0x34')](_0x346619,function(_0x3eafbf){return _0x3eafbf[_0xf144('0x50')]({'plain':!![]});});})[_0xf144('0x2a')](respondWithResult(_0x370e5f,null))[_0xf144('0x49')](handleError(_0x370e5f,null));};exports[_0xf144('0x6d')]=function(_0x481c46,_0x245932,_0x9f3464){return db['UserProfile'][_0xf144('0x4d')]({'where':{'id':_0x481c46[_0xf144('0x4b')]['id']}})[_0xf144('0x2a')](handleEntityNotFound(_0x245932,null))[_0xf144('0x2a')](function(_0x1b7a4e){if(_0x1b7a4e){return _0x1b7a4e[_0xf144('0x6d')](_0x481c46['query']['ids']);}})[_0xf144('0x2a')](respondWithStatusCode(_0x245932,null))[_0xf144('0x49')](handleError(_0x245932,null));};exports[_0xf144('0x6e')]=function(_0xe97675,_0x16719e){var _0x13cd8a={'raw':![],'where':{}};var _0x3e0994={};var _0x3bb1e4={'count':0x0,'rows':[]};var _0x49c40f=_0xe97675[_0xf144('0x36')][_0xf144('0x6f')];if(typeof _0x49c40f===_0xf144('0x23')){throw new db[(_0xf144('0x70'))][(_0xf144('0x71'))]('Unknown\x20section');}var _0x44f45b=_0xe97675['query'][_0xf144('0x72')]||![];var _0x3bf614=getQueryModels(_0x49c40f,_0x44f45b);if(typeof _0x3bf614['childModel']===_0xf144('0x23')){throw new db['Sequelize']['ValidationError']('Invalid\x20section\x20\x27'+_0x49c40f+'\x27');}var _0x22e835=[];if(!_[_0xf144('0x63')](_0x3bf614[_0xf144('0x73')])){_0x22e835=_0x3bf614[_0xf144('0x73')];}else{_0x22e835=[{'name':_0x49c40f}];}return db['UserProfile'][_0xf144('0x66')]({'where':{'id':_0xe97675[_0xf144('0x4b')]['id']}})['then'](handleEntityNotFound(_0x16719e,null))['then'](function(_0x307179){if(_0x307179){var _0x301102=[];for(var _0x373f56=0x0;_0x373f56<_0x22e835[_0xf144('0x3b')];_0x373f56++){_0x301102[_0xf144('0x60')](db[_0xf144('0x5d')][_0xf144('0x66')]({'where':{'userProfileId':_0x307179['id'],'name':_0x22e835[_0x373f56][_0xf144('0x2d')]},'raw':!![]}));}return BPromise[_0xf144('0x74')](_0x301102);}})[_0xf144('0x2a')](function(_0x31c096){var _0x4ce121=_[_0xf144('0x41')](_0x31c096,function(_0x4ecc45){return _0x4ecc45?_0x4ecc45:undefined;});var _0x3a33af=_['filter'](_0x22e835,[_0xf144('0x75'),!![]]);var _0x5c11ca=_[_0xf144('0x63')](_0x4ce121)&&_[_0xf144('0x63')](_0x3a33af)?null:_[_0xf144('0x76')](_0x3a33af,_0x4ce121);if(_0x5c11ca){var _0x559fe6=[];for(var _0x4d6261=0x0;_0x4d6261<_0x5c11ca[_0xf144('0x3b')];_0x4d6261++){var _0x587e9e=_[_0xf144('0x4d')](_0x22e835,function(_0x3520d4){return _0x5c11ca[_0x4d6261]?_0x3520d4[_0xf144('0x2d')]===_0x5c11ca[_0x4d6261][_0xf144('0x2d')]:null;});if(_0x587e9e){if(_0x5c11ca[_0x4d6261][_0xf144('0x75')]){_0x559fe6[_0xf144('0x60')](getAllResources(_0x3bf614[_0xf144('0x77')],_0x5c11ca[_0x4d6261]));}else{if(!_0x5c11ca[_0x4d6261][_0xf144('0x58')]){_0x559fe6[_0xf144('0x60')](getAllowedResources(_0x587e9e,_0x5c11ca[_0x4d6261],_0x3bf614['childModel']));}else{if(_0x587e9e[_0xf144('0x33')]){_0x559fe6[_0xf144('0x60')](getAllFilteredResources(_0x587e9e,_0x5c11ca[_0x4d6261]));}}}}}return BPromise['all'](_0x559fe6);}else{return null;}})[_0xf144('0x2a')](function(_0x2d8f77){var _0x3eb5ec=_0x2d8f77;var _0x2c3ab0=null;if(_0x3eb5ec){_0x2c3ab0=_0x3eb5ec[_0xf144('0x3b')]===0x1?_0x3eb5ec[0x0]:null;}if(_0x2c3ab0||_0x3eb5ec){var _0x34a11a=db[_0x3bf614[_0xf144('0x77')]][_0xf144('0x30')];_0x3e0994[_0xf144('0x33')]=_[_0xf144('0x35')](_0x34a11a);_0x3e0994[_0xf144('0x36')]=_[_0xf144('0x35')](_0xe97675[_0xf144('0x36')]);_0x3e0994[_0xf144('0x37')]=_[_0xf144('0x38')](_0x3e0994[_0xf144('0x33')],_0x3e0994[_0xf144('0x36')]);_0x13cd8a[_0xf144('0x3a')]=_[_0xf144('0x38')](_0x3e0994[_0xf144('0x33')],qs[_0xf144('0x39')](_0xe97675[_0xf144('0x36')][_0xf144('0x39')]));_0x13cd8a[_0xf144('0x3a')]=_0x13cd8a[_0xf144('0x3a')][_0xf144('0x3b')]?_0x13cd8a[_0xf144('0x3a')]:_0x3e0994['model'];if(!_0xe97675[_0xf144('0x36')][_0xf144('0x3c')]('nolimit')){_0x13cd8a[_0xf144('0x24')]=qs[_0xf144('0x24')](_0xe97675['query']['limit']);_0x13cd8a[_0xf144('0x22')]=qs[_0xf144('0x22')](_0xe97675[_0xf144('0x36')][_0xf144('0x22')]);}_0x13cd8a[_0xf144('0x3e')]=qs['sort'](_0xe97675[_0xf144('0x36')][_0xf144('0x3f')]);_0x13cd8a[_0xf144('0x40')]=qs['filters'](_[_0xf144('0x78')](_0xe97675[_0xf144('0x36')],_0x3e0994['filters']));if(_0xe97675[_0xf144('0x36')][_0xf144('0x41')]){_0x13cd8a[_0xf144('0x40')]=_['merge'](_0x13cd8a[_0xf144('0x40')],{'$or':_[_0xf144('0x34')](_0x34a11a,function(_0x56856d){if(_0x56856d[_0xf144('0x42')][_0xf144('0x32')]!==_0xf144('0x79')){var _0x5ac44e={};_0x5ac44e[_0x56856d[_0xf144('0x7a')]]={'$like':'%'+_0xe97675['query'][_0xf144('0x41')]+'%'};return _0x5ac44e;}})});}var _0x4aac6f=[];if(_0x2c3ab0){var _0x39e72e=_[_0xf144('0x4d')](_0x22e835,[_0xf144('0x2d'),_0x2c3ab0[_0xf144('0x2d')]]);if(_0x39e72e[_0xf144('0x7a')]){var _0x4a3a80={};if(_0x3bf614[_0xf144('0x77')]===_0xf144('0x7b')){_0x4a3a80[_0x39e72e[_0xf144('0x7c')]]=_[_0xf144('0x34')](_0x2c3ab0['associatedResources'],'id');}else{_0x4a3a80[_0x39e72e[_0xf144('0x7c')]]=_0x2c3ab0[_0xf144('0x7d')];}_0x4aac6f[_0xf144('0x60')](_0x4a3a80);}else{_0x13cd8a['where']['id']=_0x2c3ab0['associatedResources'];}}else{for(var _0x565ffc=0x0;_0x565ffc<_0x3eb5ec['length'];_0x565ffc++){var _0x39e72e=_['find'](_0x22e835,[_0xf144('0x2d'),_0x3eb5ec[_0x565ffc]['name']]);if(_0x39e72e[_0xf144('0x7a')]){var _0x4a3a80={};_0x4a3a80[_0x39e72e['foreignKey']]=_0x3eb5ec[_0x565ffc][_0xf144('0x7d')];_0x4aac6f[_0xf144('0x60')](_0x4a3a80);}else{if(!_0x13cd8a[_0xf144('0x40')]['id'])_0x13cd8a[_0xf144('0x40')]['id']=[];_0x3eb5ec[_0x565ffc][_0xf144('0x7d')]['forEach'](function(_0x5f3571){_0x13cd8a[_0xf144('0x40')]['id'][_0xf144('0x60')](_0x5f3571);});}}}if(!_[_0xf144('0x63')](_0x4aac6f)){_0x13cd8a[_0xf144('0x40')]=_[_0xf144('0x43')](_0x13cd8a[_0xf144('0x40')],{'$and':{'$or':_0x4aac6f}});}_0x13cd8a=_[_0xf144('0x43')]({},_0x13cd8a,_0xe97675[_0xf144('0x44')]);if(_0x2c3ab0&&!_0x2c3ab0[_0xf144('0x58')]&&_0x3bf614['childModel']==='AnalyticExtractedReport'){if(_0xe97675[_0xf144('0x36')]['includeAll']){_0x13cd8a[_0xf144('0x46')]=[{'all':!![]}];}return db[_0x3bf614['childModel']][_0xf144('0x47')](_0x13cd8a)[_0xf144('0x2a')](function(_0x39a168){var _0x21d7b1=[];_0x39a168[_0xf144('0x68')](function(_0x5363b5){var _0x198af9;switch(_0x5363b5[_0xf144('0x7e')]){case'default':_0x198af9=_[_0xf144('0x4d')](_0x2c3ab0[_0xf144('0x7d')],function(_0x1cdf4b){return _0x1cdf4b['id']===_0x5363b5[_0xf144('0x7f')]&&_0x1cdf4b[_0xf144('0x42')]===_0xf144('0x80');});break;case'custom':_0x198af9=_[_0xf144('0x4d')](_0x2c3ab0[_0xf144('0x7d')],function(_0x4a1223){return _0x4a1223['id']===_0x5363b5['reportId']&&_0x4a1223['type']===_0xf144('0x81');});break;}if(_0x198af9)_0x21d7b1[_0xf144('0x60')](_0x5363b5);});_0x3bb1e4['count']=_0x21d7b1[_0xf144('0x3b')];_0x3bb1e4[_0xf144('0x48')]=_0x21d7b1;return _0x3bb1e4;});}else{return db[_0x3bf614[_0xf144('0x77')]][_0xf144('0x45')]({'where':_0x13cd8a[_0xf144('0x40')]})[_0xf144('0x2a')](function(_0xe8bd0f){_0x3bb1e4[_0xf144('0x45')]=_0xe8bd0f;if(_0xe97675[_0xf144('0x36')][_0xf144('0x4c')]){if(_0x3bf614[_0xf144('0x77')]===_0xf144('0x82')){_0x13cd8a[_0xf144('0x46')]=[{'model':db[_0xf144('0x83')],'as':'Tags','attributes':['id',_0xf144('0x2d'),_0xf144('0x84')],'required':_0xe97675['query'][_0xf144('0x85')]?!![]:![]},{'model':db[_0xf144('0x83')],'as':_0xf144('0x86'),'attributes':['id',_0xf144('0x2d'),'color'],'through':_0xe97675[_0xf144('0x36')][_0xf144('0x85')]?{'attributes':[],'where':{'TagId':_0xe97675[_0xf144('0x36')]['tag']||undefined}}:{},'required':_0xe97675[_0xf144('0x36')][_0xf144('0x85')]?!![]:![]}];}else{_0x13cd8a[_0xf144('0x46')]=[{'all':!![]}];}}return db[_0x3bf614[_0xf144('0x77')]]['findAll'](_0x13cd8a);})[_0xf144('0x2a')](function(_0x3e83db){_0x3bb1e4['rows']=_0x3e83db;if(_0x49c40f===_0xf144('0x87')&&_0xe97675[_0xf144('0x36')][_0xf144('0x88')]===_0xf144('0x89')){var _0x4c306f=[];for(var _0x24935e=0x0;_0x24935e<_0x3bb1e4[_0xf144('0x48')][_0xf144('0x3b')];_0x24935e++){_0x4c306f[_0xf144('0x60')](getOpenTabs(_0xf144('0x8a'),_0x3bb1e4[_0xf144('0x48')][_0x24935e][_0xf144('0x8b')]));_0x4c306f[_0xf144('0x60')](getOpenTabs('sms',_0x3bb1e4[_0xf144('0x48')][_0x24935e][_0xf144('0x8b')]));_0x4c306f['push'](getOpenTabs(_0xf144('0x8c'),_0x3bb1e4[_0xf144('0x48')][_0x24935e][_0xf144('0x8b')]));_0x4c306f[_0xf144('0x60')](getOpenTabs(_0xf144('0x8d'),_0x3bb1e4[_0xf144('0x48')][_0x24935e][_0xf144('0x8b')]));_0x4c306f[_0xf144('0x60')](getOpenTabs(_0xf144('0x8e'),_0x3bb1e4['rows'][_0x24935e][_0xf144('0x8b')]));_0x4c306f['push'](getOpenTabs(_0xf144('0x8f'),_0x3bb1e4[_0xf144('0x48')][_0x24935e]['dataValues']));}return Promise['all'](_0x4c306f)[_0xf144('0x2a')](function(){return _0x3bb1e4;});}return _0x3bb1e4;});}}else{return _0x3bb1e4;}})[_0xf144('0x2a')](respondWithFilteredResult(_0x16719e,_0x13cd8a))[_0xf144('0x49')](handleError(_0x16719e,null));};function getOpenTabs(_0x495ad7,_0x1c7f36){var _0x21e78e=_0x495ad7[_0xf144('0x90')](0x0)[_0xf144('0x91')]()+_0x495ad7[_0xf144('0x92')](0x1);var _0x36a641={'type':db['Sequelize'][_0xf144('0x93')][_0xf144('0x94')],'raw':!![]};return new BPromise(function(_0x57122b,_0x45ad97){var _0x1b3d16=squel[_0xf144('0x95')]()[_0xf144('0x7a')](_0xf144('0x96')+_0x21e78e+_0xf144('0x97'),'id')[_0xf144('0x7a')]('ui.createdAt')[_0xf144('0x98')](_0xf144('0x99')+_0x495ad7+_0xf144('0x9a'),'ui')[_0xf144('0x40')]('ui.UserId\x20=\x20?',_0x1c7f36['id']);return db[_0xf144('0x55')][_0xf144('0x36')](_0x1b3d16[_0xf144('0x9b')](),_0x36a641)[_0xf144('0x2a')](function(_0x4edd88){_0x1c7f36[_0x21e78e+_0xf144('0x9c')]=_0x4edd88;_0x57122b(_0x4edd88);})[_0xf144('0x49')](function(_0x1a19b8){_0x45ad97(_0x1a19b8);});});}function getAllResources(_0x2ccca9,_0x19f63e){return new BPromise(function(_0x37d81f,_0x4ccb30){if(_0x19f63e){var _0x111c25=_0x19f63e['filter']?{[_0x19f63e[_0xf144('0x41')][_0xf144('0x7a')]]:_0x19f63e['filter'][_0xf144('0x9d')]}:undefined;return db[_0x2ccca9][_0xf144('0x47')]({'where':_0x111c25,'raw':!![]})['then'](function(_0x35b1c5){_0x19f63e[_0xf144('0x7d')]=_[_0xf144('0x34')](_0x35b1c5,'id');_0x37d81f(_0x19f63e);})[_0xf144('0x49')](function(_0x25cdfd){_0x4ccb30(_0x25cdfd);});}else{_0x37d81f(null);}});}function getAllFilteredResources(_0x44b2ef,_0x4bafce){return new BPromise(function(_0x547c30,_0x3c1ad7){var _0x5c6058=_0x44b2ef[_0xf144('0x41')]?{[_0x44b2ef[_0xf144('0x41')][_0xf144('0x7a')]]:_0x44b2ef['filter'][_0xf144('0x9d')]}:undefined;return db[_0x44b2ef[_0xf144('0x33')]][_0xf144('0x47')]({'where':_0x5c6058,'raw':!![]})[_0xf144('0x2a')](function(_0x59ab53){_0x4bafce[_0xf144('0x7d')]=_[_0xf144('0x34')](_0x59ab53,function(_0x117212){return _0x44b2ef['field']?_0x117212[_0x44b2ef[_0xf144('0x7a')]]:_0x117212['name'];});_0x547c30(_0x4bafce);})[_0xf144('0x49')](function(_0x4036c5){_0x3c1ad7(_0x4036c5);});});}function getAllowedResources(_0x2fb6f4,_0x95502b,_0x2c693b){return new BPromise(function(_0x4af798,_0x7d2533){if(_0x95502b){return db['UserProfileResource'][_0xf144('0x47')]({'where':{'sectionId':_0x95502b['id']},'raw':!![]})[_0xf144('0x2a')](function(_0x235c94){if(_0x2fb6f4[_0xf144('0x7a')]&&_0x2fb6f4['field']!=='id'){_0x95502b[_0xf144('0x7d')]=_[_0xf144('0x34')](_0x235c94,function(_0x3867bc){return _0x3867bc[_0x2fb6f4[_0xf144('0x7a')]];});}else{if(_0x2c693b===_0xf144('0x7b')){_0x95502b[_0xf144('0x7d')]=_[_0xf144('0x34')](_0x235c94,function(_0x4b7591){return{'id':_0x4b7591[_0xf144('0x69')],'type':_0x4b7591[_0xf144('0x42')]};});}else{_0x95502b[_0xf144('0x7d')]=_[_0xf144('0x34')](_0x235c94,function(_0x197c32){return _0x197c32[_0xf144('0x69')];});}}_0x4af798(_0x95502b);})['catch'](function(_0x29d6d5){_0x7d2533(_0x29d6d5);});}else{_0x4af798(null);}});}function getQueryModels(_0x549f51,_0x27b18c){var _0x592305=_0x549f51[_0xf144('0x9e')]();var _0x546bf1={'childModel':undefined,'parentSections':[]};switch(_0x592305){case _0xf144('0x9f'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xa0');break;case _0xf144('0xa1'):_0x546bf1[_0xf144('0x77')]='SquareOdbc';break;case _0xf144('0xa2'):_0x546bf1['childModel']=_0xf144('0xa3');_0x546bf1['parentSections']=[{'name':_0xf144('0xa4'),'field':_0xf144('0x2d'),'foreignKey':_0xf144('0xa5')}];break;case _0xf144('0xa6'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xa7');break;case _0xf144('0xa8'):_0x546bf1[_0xf144('0x77')]='CmContact';_0x546bf1[_0xf144('0x73')]=[{'name':_0xf144('0xa9'),'field':'id','foreignKey':_0xf144('0xaa')}];break;case _0xf144('0xab'):_0x546bf1['childModel']=_0xf144('0xac');break;case _0xf144('0xad'):_0x546bf1[_0xf144('0x77')]='CmCompany';break;case _0xf144('0xae'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xaf');break;case'chatqueues':_0x546bf1[_0xf144('0x77')]='ChatQueue';break;case'chatwebsites':_0x546bf1[_0xf144('0x77')]=_0xf144('0xb0');break;case _0xf144('0xb1'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xb2');break;case _0xf144('0xb3'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xb4');break;case'inboundroutes':case _0xf144('0xb5'):case _0xf144('0xb6'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xb7');break;case _0xf144('0xb8'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xb9');break;case _0xf144('0xba'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xbb');break;case _0xf144('0xbc'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xbd');_0x546bf1[_0xf144('0x73')]=[{'name':_0xf144('0x87'),'field':_0xf144('0x2d'),'foreignKey':_0xf144('0xbe'),'model':_0xf144('0xbf'),'filter':{'field':_0xf144('0xc0'),'value':[_0xf144('0xc1')]}},{'name':_0xf144('0xc2'),'field':'name','foreignKey':_0xf144('0xbe'),'model':_0xf144('0xbf'),'filter':{'field':_0xf144('0xc0'),'value':[_0xf144('0xc3')]}},{'name':'VoiceQueues','field':_0xf144('0x2d'),'foreignKey':'queue','model':_0xf144('0xc4'),'filter':{'field':_0xf144('0x42'),'value':[_0xf144('0xc5')]}},{'name':'QueueCampaigns','field':_0xf144('0x2d'),'foreignKey':'queue','model':_0xf144('0xc4'),'filter':{'field':'type','value':[_0xf144('0xc6')]}}];break;case _0xf144('0xc7'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xc8');break;case'chanspies':_0x546bf1['childModel']=_0xf144('0xc9');break;case _0xf144('0xca'):_0x546bf1['childModel']=_0xf144('0xcb');break;case _0xf144('0xcc'):_0x546bf1[_0xf144('0x77')]='Campaign';break;case'mailqueues':_0x546bf1[_0xf144('0x77')]=_0xf144('0xcd');break;case'mailaccounts':_0x546bf1[_0xf144('0x77')]=_0xf144('0xce');break;case _0xf144('0xcf'):_0x546bf1[_0xf144('0x77')]='MailSubstatus';break;case _0xf144('0xd0'):_0x546bf1[_0xf144('0x77')]='OpenchannelQueue';break;case _0xf144('0xd1'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xd2');break;case'smsqueues':_0x546bf1['childModel']=_0xf144('0xd3');break;case'smsaccounts':_0x546bf1[_0xf144('0x77')]='SmsAccount';break;case _0xf144('0xd4'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xd5');break;case _0xf144('0xd6'):_0x546bf1[_0xf144('0x77')]='Team';break;case _0xf144('0xd7'):case _0xf144('0xd8'):_0x546bf1['childModel']=_0xf144('0xc4');if(_0x27b18c){_0x546bf1[_0xf144('0x73')]=[{'name':'VoiceQueues'},{'name':_0xf144('0xd9')}];}break;case _0xf144('0xda'):case _0xf144('0xdb'):case _0xf144('0xdc'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xbf');if(_0x27b18c){_0x546bf1[_0xf144('0x73')]=[{'name':_0xf144('0xdd'),'filter':{'field':_0xf144('0xc0'),'value':[_0xf144('0xde'),_0xf144('0xdf')]},'ignore':!![]},{'name':_0xf144('0x87')},{'name':_0xf144('0xc2')}];}break;case _0xf144('0xe0'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xe1');break;case _0xf144('0xe2'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xe3');break;case _0xf144('0xe4'):_0x546bf1['childModel']='FreshdeskAccount';break;case _0xf144('0xe5'):_0x546bf1[_0xf144('0x77')]='SugarcrmAccount';break;case _0xf144('0xe6'):_0x546bf1[_0xf144('0x77')]='DeskAccount';break;case _0xf144('0xe7'):_0x546bf1[_0xf144('0x77')]='ZohoAccount';break;case'vtigeraccounts':_0x546bf1[_0xf144('0x77')]=_0xf144('0xbf');break;case'cannedanswers':_0x546bf1[_0xf144('0x77')]='CannedAnswer';break;case _0xf144('0xe8'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xe9');break;case _0xf144('0xea'):_0x546bf1[_0xf144('0x77')]=_0xf144('0x67');break;case _0xf144('0xeb'):_0x546bf1[_0xf144('0x77')]='Interval';break;case _0xf144('0xec'):_0x546bf1['childModel']=_0xf144('0xed');break;case _0xf144('0xee'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xef');break;case _0xf144('0xf0'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xf1');break;case _0xf144('0xf2'):_0x546bf1[_0xf144('0x77')]=_0xf144('0x83');break;case'templates':_0x546bf1[_0xf144('0x77')]='Template';break;case'triggers':_0x546bf1[_0xf144('0x77')]=_0xf144('0xf3');break;case _0xf144('0xf4'):_0x546bf1['childModel']='Trunk';break;case _0xf144('0xf5'):_0x546bf1['childModel']=_0xf144('0xf6');break;case'plugins':_0x546bf1[_0xf144('0x77')]=_0xf144('0x6a');break;case _0xf144('0xf7'):_0x546bf1[_0xf144('0x77')]=_0xf144('0x7b');_0x546bf1[_0xf144('0x73')]=[{'name':_0xf144('0xf8'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x546bf1[_0xf144('0x77')]=_0xf144('0xf9');break;case _0xf144('0xfa'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xfb');break;case _0xf144('0xfc'):_0x546bf1[_0xf144('0x77')]=_0xf144('0xfd');_0x546bf1[_0xf144('0x73')]=[{'name':_0xf144('0x87'),'field':'id','foreignKey':_0xf144('0xfe'),'model':'User','filter':{'field':_0xf144('0xc0'),'value':[_0xf144('0xc1')]}},{'name':_0xf144('0xc2'),'field':'id','foreignKey':_0xf144('0xfe'),'model':_0xf144('0xbf'),'filter':{'field':'role','value':['telephone']}}];break;default:return _0x546bf1;}return _0x546bf1;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 57cc85b..d2d4350 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 _0x4649=['exports','events','../../mysqldb','UserProfile','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x5cd4ff,_0x4eb321){var _0x1124eb=function(_0x3b67a6){while(--_0x3b67a6){_0x5cd4ff['push'](_0x5cd4ff['shift']());}};_0x1124eb(++_0x4eb321);}(_0x4649,0x1e7));var _0x9464=function(_0x472a07,_0x45bf49){_0x472a07=_0x472a07-0x0;var _0x2706f0=_0x4649[_0x472a07];return _0x2706f0;};'use strict';var EventEmitter=require(_0x9464('0x0'));var UserProfile=require(_0x9464('0x1'))['db'][_0x9464('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9464('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9464('0x4')};function emitEvent(_0x46e2cf){return function(_0xef81f6,_0x50fc6b,_0xa37525){UserProfileEvents[_0x9464('0x5')](_0x46e2cf+':'+_0xef81f6['id'],_0xef81f6);UserProfileEvents[_0x9464('0x5')](_0x46e2cf,_0xef81f6);_0xa37525(null);};}for(var e in events){if(events[_0x9464('0x6')](e)){var event=events[e];UserProfile[_0x9464('0x7')](e,emitEvent(event));}}module[_0x9464('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xbcee=['exports','setMaxListeners','save','update','remove','emit','hook'];(function(_0x442408,_0xad4811){var _0x368770=function(_0x27420c){while(--_0x27420c){_0x442408['push'](_0x442408['shift']());}};_0x368770(++_0xad4811);}(_0xbcee,0x19e));var _0xebce=function(_0x381363,_0x3a2e29){_0x381363=_0x381363-0x0;var _0x81466a=_0xbcee[_0x381363];return _0x81466a;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xebce('0x0')](0x0);var events={'afterCreate':_0xebce('0x1'),'afterUpdate':_0xebce('0x2'),'afterDestroy':_0xebce('0x3')};function emitEvent(_0x1a16da){return function(_0x20ac8a,_0x48fa1a,_0x1d0ba2){UserProfileEvents[_0xebce('0x4')](_0x1a16da+':'+_0x20ac8a['id'],_0x20ac8a);UserProfileEvents[_0xebce('0x4')](_0x1a16da,_0x20ac8a);_0x1d0ba2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xebce('0x5')](e,emitEvent(event));}}module[_0xebce('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 3b519fc..536553c 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 _0xd9dc=['request-promise','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','models','User','update','privacyEnabled','then','catch','util','../../config/logger','moment','bluebird'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x3aece7,_0x4facb6){_0x3aece7=_0x3aece7-0x0;var _0x32803b=_0xd9dc[_0x3aece7];return _0x32803b;};'use strict';var _=require('lodash');var util=require(_0xcd9d('0x0'));var logger=require(_0xcd9d('0x1'))('api');var moment=require(_0xcd9d('0x2'));var BPromise=require(_0xcd9d('0x3'));var rp=require(_0xcd9d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd9d('0x5'));var config=require(_0xcd9d('0x6'));var attributes=require(_0xcd9d('0x7'));module[_0xcd9d('0x8')]=function(_0x8cc2e4,_0x50f1e2){return _0x8cc2e4[_0xcd9d('0x9')](_0xcd9d('0xa'),attributes,{'tableName':_0xcd9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x285e75,_0x45130c,_0x549558){var _0x1e6612=_0x8cc2e4[_0xcd9d('0xc')];_0x1e6612[_0xcd9d('0xd')][_0xcd9d('0xe')]({'privacyEnabled':_0x285e75[_0xcd9d('0xf')]},{'where':{'UserProfileId':_0x285e75['id']}})[_0xcd9d('0x10')](function(){_0x549558();})[_0xcd9d('0x11')](function(_0x257586){_0x549558(_0x257586);});}}});}; \ No newline at end of file +var _0x3f8c=['../../config/logger','api','moment','bluebird','exports','define','UserProfile','user_profiles','models','User','update','privacyEnabled','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f8c,0x104));var _0xc3f8=function(_0x59bb8a,_0x40b902){_0x59bb8a=_0x59bb8a-0x0;var _0xc5c5a2=_0x3f8c[_0x59bb8a];return _0xc5c5a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3f8('0x0'))(_0xc3f8('0x1'));var moment=require(_0xc3f8('0x2'));var BPromise=require(_0xc3f8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfile.attributes');module[_0xc3f8('0x4')]=function(_0x1a6976,_0x3a4e2f){return _0x1a6976[_0xc3f8('0x5')](_0xc3f8('0x6'),attributes,{'tableName':_0xc3f8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x51093a,_0x28397e,_0x315dff){var _0x15cb3b=_0x1a6976[_0xc3f8('0x8')];_0x15cb3b[_0xc3f8('0x9')][_0xc3f8('0xa')]({'privacyEnabled':_0x51093a[_0xc3f8('0xb')]},{'where':{'UserProfileId':_0x51093a['id']}})['then'](function(){_0x315dff();})[_0xc3f8('0xc')](function(_0x1075a6){_0x315dff(_0x1075a6);});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ff11a5d..9663bbe 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 _0x3eea=['UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','redis','register','request','then'];(function(_0x48ead4,_0x509b4a){var _0x3410b3=function(_0x2529ab){while(--_0x2529ab){_0x48ead4['push'](_0x48ead4['shift']());}};_0x3410b3(++_0x509b4a);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x1253f1,_0x4c039e){_0x1253f1=_0x1253f1-0x0;var _0x9e14cf=_0x3eea[_0x1253f1];return _0x9e14cf;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var moment=require(_0xa3ee('0x1'));var BPromise=require(_0xa3ee('0x2'));var rs=require(_0xa3ee('0x3'));var fs=require('fs');var Redis=require(_0xa3ee('0x4'));var db=require(_0xa3ee('0x5'))['db'];var utils=require(_0xa3ee('0x6'));var logger=require(_0xa3ee('0x7'))(_0xa3ee('0x8'));var config=require(_0xa3ee('0x9'));var jayson=require(_0xa3ee('0xa'));var client=jayson[_0xa3ee('0xb')]['http']({'port':0x232a});config['redis']=_[_0xa3ee('0xc')](config['redis'],{'host':_0xa3ee('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3ee('0xe')]));require('./userProfile.socket')[_0xa3ee('0xf')](socket);function respondWithRpcPromise(_0x5ef236,_0x28aeb1,_0x1a3ab0){return new BPromise(function(_0x188966,_0x50f5e6){return client[_0xa3ee('0x10')](_0x5ef236,_0x1a3ab0)[_0xa3ee('0x11')](function(_0x4dc361){logger['info'](_0xa3ee('0x12'),_0x28aeb1,_0xa3ee('0x13'));logger[_0xa3ee('0x14')](_0xa3ee('0x15'),_0x28aeb1,'request\x20sent',JSON[_0xa3ee('0x16')](_0x4dc361));if(_0x4dc361['error']){if(_0x4dc361[_0xa3ee('0x17')][_0xa3ee('0x18')]===0x1f4){logger[_0xa3ee('0x17')](_0xa3ee('0x12'),_0x28aeb1,_0x4dc361['error'][_0xa3ee('0x19')]);return _0x50f5e6(_0x4dc361[_0xa3ee('0x17')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x28aeb1,_0x4dc361[_0xa3ee('0x17')][_0xa3ee('0x19')]);return _0x188966(_0x4dc361[_0xa3ee('0x17')][_0xa3ee('0x19')]);}else{logger['info'](_0xa3ee('0x12'),_0x28aeb1,_0xa3ee('0x13'));_0x188966(_0x4dc361[_0xa3ee('0x1a')][_0xa3ee('0x19')]);}})[_0xa3ee('0x1b')](function(_0x4aac0e){logger[_0xa3ee('0x17')](_0xa3ee('0x12'),_0x28aeb1,_0x4aac0e);_0x50f5e6(_0x4aac0e);});});} \ No newline at end of file +var _0x6f47=['UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info'];(function(_0x5587e4,_0x3238a0){var _0x2645a3=function(_0x3c50d6){while(--_0x3c50d6){_0x5587e4['push'](_0x5587e4['shift']());}};_0x2645a3(++_0x3238a0);}(_0x6f47,0xc7));var _0x76f4=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x6f47[_0x68ee8b];return _0x5148f7;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var moment=require(_0x76f4('0x1'));var BPromise=require('bluebird');var rs=require(_0x76f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76f4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x76f4('0x4'))(_0x76f4('0x5'));var config=require(_0x76f4('0x6'));var jayson=require(_0x76f4('0x7'));var client=jayson['client'][_0x76f4('0x8')]({'port':0x232a});config[_0x76f4('0x9')]=_[_0x76f4('0xa')](config['redis'],{'host':_0x76f4('0xb'),'port':0x18eb});var socket=require(_0x76f4('0xc'))(new Redis(config[_0x76f4('0x9')]));require(_0x76f4('0xd'))[_0x76f4('0xe')](socket);function respondWithRpcPromise(_0x4c6b5c,_0x5367d6,_0x3347ef){return new BPromise(function(_0x18e41a,_0x5af83c){return client['request'](_0x4c6b5c,_0x3347ef)[_0x76f4('0xf')](function(_0x458c22){logger[_0x76f4('0x10')](_0x76f4('0x11'),_0x5367d6,_0x76f4('0x12'));logger[_0x76f4('0x13')](_0x76f4('0x14'),_0x5367d6,_0x76f4('0x12'),JSON[_0x76f4('0x15')](_0x458c22));if(_0x458c22['error']){if(_0x458c22[_0x76f4('0x16')][_0x76f4('0x17')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x5367d6,_0x458c22['error'][_0x76f4('0x18')]);return _0x5af83c(_0x458c22[_0x76f4('0x16')][_0x76f4('0x18')]);}logger[_0x76f4('0x16')](_0x76f4('0x11'),_0x5367d6,_0x458c22[_0x76f4('0x16')][_0x76f4('0x18')]);return _0x18e41a(_0x458c22[_0x76f4('0x16')][_0x76f4('0x18')]);}else{logger[_0x76f4('0x10')](_0x76f4('0x11'),_0x5367d6,_0x76f4('0x12'));_0x18e41a(_0x458c22[_0x76f4('0x19')][_0x76f4('0x18')]);}})[_0x76f4('0x1a')](function(_0x397360){logger[_0x76f4('0x16')](_0x76f4('0x11'),_0x5367d6,_0x397360);_0x5af83c(_0x397360);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index d1dcc68..b01db04 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 _0x93a4=['emit','register','length','userProfile:','update'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x93a4,0xea));var _0x493a=function(_0x408e3e,_0xe98b57){_0x408e3e=_0x408e3e-0x0;var _0x387832=_0x93a4[_0x408e3e];return _0x387832;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save','remove',_0x493a('0x0')];function createListener(_0x2e9956,_0x32ea53){return function(_0x57f558){_0x32ea53[_0x493a('0x1')](_0x2e9956,_0x57f558);};}function removeListener(_0x318833,_0x2156ad){return function(){UserProfileEvents['removeListener'](_0x318833,_0x2156ad);};}exports[_0x493a('0x2')]=function(_0x2f211e){for(var _0x269ee8=0x0,_0x57840f=events[_0x493a('0x3')];_0x269ee8<_0x57840f;_0x269ee8++){var _0x47c50b=events[_0x269ee8];var _0x2891cc=createListener(_0x493a('0x4')+_0x47c50b,_0x2f211e);UserProfileEvents['on'](_0x47c50b,_0x2891cc);}}; \ No newline at end of file +var _0x81ae=['emit','length','userProfile:'];(function(_0x123440,_0x4ce436){var _0x543c52=function(_0x8623){while(--_0x8623){_0x123440['push'](_0x123440['shift']());}};_0x543c52(++_0x4ce436);}(_0x81ae,0x1c2));var _0xe81a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x81ae[_0x465a0c];return _0x1e202e;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save','remove','update'];function createListener(_0x73fff5,_0x4f118b){return function(_0x312db3){_0x4f118b[_0xe81a('0x0')](_0x73fff5,_0x312db3);};}function removeListener(_0x4e2815,_0x37763a){return function(){UserProfileEvents['removeListener'](_0x4e2815,_0x37763a);};}exports['register']=function(_0x7e4aa8){for(var _0x1bffd1=0x0,_0x2b5627=events[_0xe81a('0x1')];_0x1bffd1<_0x2b5627;_0x1bffd1++){var _0x1b21e4=events[_0x1bffd1];var _0x3f353d=createListener(_0xe81a('0x2')+_0x1b21e4,_0x7e4aa8);UserProfileEvents['on'](_0x1b21e4,_0x3f353d);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index e3f7f11..b74e9f5 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 _0x014b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','exports','multer','util','path'];(function(_0x4e0240,_0x25565d){var _0x465aee=function(_0xdb0e53){while(--_0xdb0e53){_0x4e0240['push'](_0x4e0240['shift']());}};_0x465aee(++_0x25565d);}(_0x014b,0x105));var _0xb014=function(_0x14b418,_0x37e5fa){_0x14b418=_0x14b418-0x0;var _0x1b8982=_0x014b[_0x14b418];return _0x1b8982;};'use strict';var multer=require(_0xb014('0x0'));var util=require(_0xb014('0x1'));var path=require(_0xb014('0x2'));var timeout=require('connect-timeout');var express=require(_0xb014('0x3'));var router=express[_0xb014('0x4')]();var fs_extra=require(_0xb014('0x5'));var auth=require(_0xb014('0x6'));var interaction=require(_0xb014('0x7'));var config=require(_0xb014('0x8'));var controller=require(_0xb014('0x9'));router[_0xb014('0xa')]('/',auth[_0xb014('0xb')](),controller[_0xb014('0xc')]);router[_0xb014('0xa')](_0xb014('0xd'),auth['isAuthenticated'](),controller[_0xb014('0xe')]);router[_0xb014('0xa')](_0xb014('0xf'),auth[_0xb014('0xb')](),controller['show']);router[_0xb014('0x10')]('/',auth[_0xb014('0xb')](),controller[_0xb014('0x11')]);router[_0xb014('0x12')](_0xb014('0xf'),auth['isAuthenticated'](),controller[_0xb014('0x13')]);router[_0xb014('0x14')](_0xb014('0xf'),auth[_0xb014('0xb')](),controller['destroy']);module[_0xb014('0x15')]=router; \ No newline at end of file +var _0x7a38=['fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x572ae2,_0x1cc8cf){var _0x48b139=function(_0x3d3263){while(--_0x3d3263){_0x572ae2['push'](_0x572ae2['shift']());}};_0x48b139(++_0x1cc8cf);}(_0x7a38,0x119));var _0x87a3=function(_0x1250a2,_0x3b2643){_0x1250a2=_0x1250a2-0x0;var _0xf23be7=_0x7a38[_0x1250a2];return _0xf23be7;};'use strict';var multer=require(_0x87a3('0x0'));var util=require(_0x87a3('0x1'));var path=require(_0x87a3('0x2'));var timeout=require('connect-timeout');var express=require(_0x87a3('0x3'));var router=express[_0x87a3('0x4')]();var fs_extra=require(_0x87a3('0x5'));var auth=require(_0x87a3('0x6'));var interaction=require(_0x87a3('0x7'));var config=require('../../config/environment');var controller=require(_0x87a3('0x8'));router[_0x87a3('0x9')]('/',auth[_0x87a3('0xa')](),controller[_0x87a3('0xb')]);router[_0x87a3('0x9')](_0x87a3('0xc'),auth[_0x87a3('0xa')](),controller[_0x87a3('0xd')]);router[_0x87a3('0x9')](_0x87a3('0xe'),auth['isAuthenticated'](),controller[_0x87a3('0xf')]);router[_0x87a3('0x10')]('/',auth[_0x87a3('0xa')](),controller[_0x87a3('0x11')]);router['put'](_0x87a3('0xe'),auth[_0x87a3('0xa')](),controller[_0x87a3('0x12')]);router[_0x87a3('0x13')](_0x87a3('0xe'),auth[_0x87a3('0xa')](),controller[_0x87a3('0x14')]);module[_0x87a3('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index f6993eb..cdce84a 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 _0xf529=['exports','STRING','INTEGER'];(function(_0x52d28a,_0xcea297){var _0x3ad972=function(_0x3bbcfe){while(--_0x3bbcfe){_0x52d28a['push'](_0x52d28a['shift']());}};_0x3ad972(++_0xcea297);}(_0xf529,0x120));var _0x9f52=function(_0x35c6ed,_0x4c1373){_0x35c6ed=_0x35c6ed-0x0;var _0x558eaf=_0xf529[_0x35c6ed];return _0x558eaf;};'use strict';var Sequelize=require('sequelize');module[_0x9f52('0x0')]={'name':{'type':Sequelize[_0x9f52('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9f52('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9f52('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x9fb9=['STRING','INTEGER','sequelize','exports'];(function(_0x4c63ef,_0x1b91e1){var _0x23d649=function(_0x3f0d57){while(--_0x3f0d57){_0x4c63ef['push'](_0x4c63ef['shift']());}};_0x23d649(++_0x1b91e1);}(_0x9fb9,0x9e));var _0x99fb=function(_0xa038b8,_0x5d0d83){_0xa038b8=_0xa038b8-0x0;var _0x308730=_0x9fb9[_0xa038b8];return _0x308730;};'use strict';var Sequelize=require(_0x99fb('0x0'));module[_0x99fb('0x1')]={'name':{'type':Sequelize[_0x99fb('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x99fb('0x3')],'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 6de6e2c..3963325 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 _0xe35d=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','length','includeAll','find','catch','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe35d,0xd5));var _0xde35=function(_0x12eb01,_0x4f5361){_0x12eb01=_0x12eb01-0x0;var _0x5c872a=_0xe35d[_0x12eb01];return _0x5c872a;};'use strict';var emlformat=require(_0xde35('0x0'));var rimraf=require(_0xde35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xde35('0x2'));var moment=require(_0xde35('0x3'));var BPromise=require(_0xde35('0x4'));var Mustache=require(_0xde35('0x5'));var util=require(_0xde35('0x6'));var path=require(_0xde35('0x7'));var sox=require(_0xde35('0x8'));var csv=require(_0xde35('0x9'));var ejs=require(_0xde35('0xa'));var fs=require('fs');var fs_extra=require(_0xde35('0xb'));var _=require('lodash');var squel=require(_0xde35('0xc'));var crypto=require(_0xde35('0xd'));var jsforce=require(_0xde35('0xe'));var deskjs=require(_0xde35('0xf'));var toCsv=require(_0xde35('0x9'));var querystring=require('querystring');var Papa=require(_0xde35('0x10'));var Redis=require(_0xde35('0x11'));var authService=require(_0xde35('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde35('0x13'));var hardwareService=require(_0xde35('0x14'));var logger=require('../../config/logger')(_0xde35('0x15'));var utils=require('../../config/utils');var config=require(_0xde35('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xde35('0x17'))['db'];function respondWithStatusCode(_0x50b021,_0x51370b){_0x51370b=_0x51370b||0xcc;return function(_0x530552){if(_0x530552){return _0x50b021['sendStatus'](_0x51370b);}return _0x50b021['status'](_0x51370b)[_0xde35('0x18')]();};}function respondWithResult(_0x292a13,_0x4f58b1){_0x4f58b1=_0x4f58b1||0xc8;return function(_0x560d70){if(_0x560d70){return _0x292a13[_0xde35('0x19')](_0x4f58b1)[_0xde35('0x1a')](_0x560d70);}};}function respondWithFilteredResult(_0x1f318f,_0x2771fd){return function(_0x121717){if(_0x121717){var _0x5d8c6e=typeof _0x2771fd[_0xde35('0x1b')]===_0xde35('0x1c')&&typeof _0x2771fd[_0xde35('0x1d')]===_0xde35('0x1c');var _0x1f7d7f=_0x121717[_0xde35('0x1e')];var _0x19ec9e=_0x5d8c6e?0x0:_0x2771fd['offset'];var _0x3c912a=_0x5d8c6e?_0x121717['count']:_0x2771fd['offset']+_0x2771fd['limit'];var _0x408829;if(_0x3c912a>=_0x1f7d7f){_0x3c912a=_0x1f7d7f;_0x408829=0xc8;}else{_0x408829=0xce;}_0x1f318f['status'](_0x408829);return _0x1f318f[_0xde35('0x1f')](_0xde35('0x20'),_0x19ec9e+'-'+_0x3c912a+'/'+_0x1f7d7f)[_0xde35('0x1a')](_0x121717);}return null;};}function patchUpdates(_0x3d66d6){return function(_0x104a3b){try{jsonpatch[_0xde35('0x21')](_0x104a3b,_0x3d66d6,!![]);}catch(_0x441657){return BPromise[_0xde35('0x22')](_0x441657);}return _0x104a3b[_0xde35('0x23')]();};}function saveUpdates(_0x5cd6b2,_0x48c253){return function(_0x560c11){if(_0x560c11){return _0x560c11['update'](_0x5cd6b2)[_0xde35('0x24')](function(_0x394129){return _0x394129;});}return null;};}function removeEntity(_0x519035,_0x13ff99){return function(_0x126248){if(_0x126248){return _0x126248[_0xde35('0x25')]()['then'](function(){_0x519035[_0xde35('0x19')](0xcc)[_0xde35('0x18')]();});}};}function handleEntityNotFound(_0x740ab8,_0x3af90d){return function(_0x256277){if(!_0x256277){_0x740ab8[_0xde35('0x26')](0x194);}return _0x256277;};}function handleError(_0x2e4e79,_0x4a29a2){_0x4a29a2=_0x4a29a2||0x1f4;return function(_0x31a61d){logger['error'](_0x31a61d[_0xde35('0x27')]);if(_0x31a61d[_0xde35('0x28')]){delete _0x31a61d[_0xde35('0x28')];}_0x2e4e79[_0xde35('0x19')](_0x4a29a2)['send'](_0x31a61d);};}exports[_0xde35('0x29')]=function(_0x2fcc94,_0x10533a){var _0x17da4e={},_0x459d29={},_0x45ca01={'count':0x0,'rows':[]};var _0x2b50e4=_['map'](db[_0xde35('0x2a')][_0xde35('0x2b')],function(_0x459a50){return{'name':_0x459a50[_0xde35('0x2c')],'type':_0x459a50[_0xde35('0x2d')][_0xde35('0x2e')]};});_0x459d29[_0xde35('0x2f')]=_[_0xde35('0x30')](_0x2b50e4,'name');_0x459d29[_0xde35('0x31')]=_[_0xde35('0x32')](_0x2fcc94[_0xde35('0x31')]);_0x459d29[_0xde35('0x33')]=_['intersection'](_0x459d29['model'],_0x459d29[_0xde35('0x31')]);_0x17da4e[_0xde35('0x34')]=_[_0xde35('0x35')](_0x459d29['model'],qs[_0xde35('0x36')](_0x2fcc94[_0xde35('0x31')][_0xde35('0x36')]));_0x17da4e[_0xde35('0x34')]=_0x17da4e[_0xde35('0x34')]['length']?_0x17da4e[_0xde35('0x34')]:_0x459d29[_0xde35('0x2f')];if(!_0x2fcc94['query'][_0xde35('0x37')](_0xde35('0x38'))){_0x17da4e[_0xde35('0x1d')]=qs[_0xde35('0x1d')](_0x2fcc94[_0xde35('0x31')][_0xde35('0x1d')]);_0x17da4e['offset']=qs['offset'](_0x2fcc94[_0xde35('0x31')][_0xde35('0x1b')]);}_0x17da4e[_0xde35('0x39')]=qs['sort'](_0x2fcc94[_0xde35('0x31')][_0xde35('0x3a')]);_0x17da4e['where']=qs[_0xde35('0x33')](_[_0xde35('0x3b')](_0x2fcc94[_0xde35('0x31')],_0x459d29['filters']),_0x2b50e4);if(_0x2fcc94[_0xde35('0x31')][_0xde35('0x3c')]){_0x17da4e[_0xde35('0x3d')]=_[_0xde35('0x3e')](_0x17da4e[_0xde35('0x3d')],{'$or':_[_0xde35('0x30')](_0x2b50e4,function(_0x2a683a){if(_0x2a683a['type']!==_0xde35('0x3f')){var _0x472a23={};_0x472a23[_0x2a683a[_0xde35('0x28')]]={'$like':'%'+_0x2fcc94[_0xde35('0x31')]['filter']+'%'};return _0x472a23;}})});}_0x17da4e=_[_0xde35('0x3e')]({},_0x17da4e,_0x2fcc94[_0xde35('0x40')]);var _0x1e5051={'where':_0x17da4e[_0xde35('0x3d')]};return db['UserProfileResource'][_0xde35('0x1e')](_0x1e5051)[_0xde35('0x24')](function(_0x45a82a){_0x45ca01[_0xde35('0x1e')]=_0x45a82a;if(_0x2fcc94[_0xde35('0x31')]['includeAll']){_0x17da4e[_0xde35('0x41')]=[{'all':!![]}];}return db[_0xde35('0x2a')][_0xde35('0x42')](_0x17da4e);})[_0xde35('0x24')](function(_0x32e61d){_0x45ca01['rows']=_0x32e61d;return _0x45ca01;})['then'](respondWithFilteredResult(_0x10533a,_0x17da4e))['catch'](handleError(_0x10533a,null));};exports[_0xde35('0x43')]=function(_0x4792d0,_0x13c077){var _0x298eaf={'raw':![],'where':{'id':_0x4792d0[_0xde35('0x44')]['id']}},_0x4adfbf={};_0x4adfbf[_0xde35('0x2f')]=_[_0xde35('0x32')](db['UserProfileResource'][_0xde35('0x2b')]);_0x4adfbf[_0xde35('0x31')]=_[_0xde35('0x32')](_0x4792d0[_0xde35('0x31')]);_0x4adfbf[_0xde35('0x33')]=_[_0xde35('0x35')](_0x4adfbf[_0xde35('0x2f')],_0x4adfbf[_0xde35('0x31')]);_0x298eaf[_0xde35('0x34')]=_[_0xde35('0x35')](_0x4adfbf[_0xde35('0x2f')],qs[_0xde35('0x36')](_0x4792d0['query'][_0xde35('0x36')]));_0x298eaf[_0xde35('0x34')]=_0x298eaf[_0xde35('0x34')][_0xde35('0x45')]?_0x298eaf[_0xde35('0x34')]:_0x4adfbf[_0xde35('0x2f')];if(_0x4792d0['query'][_0xde35('0x46')]){_0x298eaf['include']=[{'all':!![]}];}_0x298eaf=_['merge']({},_0x298eaf,_0x4792d0['options']);return db[_0xde35('0x2a')][_0xde35('0x47')](_0x298eaf)[_0xde35('0x24')](handleEntityNotFound(_0x13c077,null))[_0xde35('0x24')](respondWithResult(_0x13c077,null))[_0xde35('0x48')](handleError(_0x13c077,null));};exports[_0xde35('0x49')]=function(_0x1fd567,_0x4ade5d){return db[_0xde35('0x2a')][_0xde35('0x49')](_0x1fd567['body'],{})[_0xde35('0x24')](respondWithResult(_0x4ade5d,0xc9))[_0xde35('0x48')](handleError(_0x4ade5d,null));};exports['update']=function(_0x243f76,_0x5d178b){if(_0x243f76[_0xde35('0x4a')]['id']){delete _0x243f76[_0xde35('0x4a')]['id'];}return db[_0xde35('0x2a')][_0xde35('0x47')]({'where':{'id':_0x243f76['params']['id']}})[_0xde35('0x24')](handleEntityNotFound(_0x5d178b,null))[_0xde35('0x24')](saveUpdates(_0x243f76['body'],null))[_0xde35('0x24')](respondWithResult(_0x5d178b,null))[_0xde35('0x48')](handleError(_0x5d178b,null));};exports[_0xde35('0x25')]=function(_0x17340b,_0x453f0b){return db['UserProfileResource']['find']({'where':{'id':_0x17340b[_0xde35('0x44')]['id']}})[_0xde35('0x24')](handleEntityNotFound(_0x453f0b,null))[_0xde35('0x24')](removeEntity(_0x453f0b,null))['catch'](handleError(_0x453f0b,null));};exports[_0xde35('0x4b')]=function(_0xb83d1e,_0x4afdc0){return db[_0xde35('0x2a')][_0xde35('0x4b')]()[_0xde35('0x24')](respondWithResult(_0x4afdc0,null))['catch'](handleError(_0x4afdc0,null));}; \ No newline at end of file +var _0x4ad3=['then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','fields','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update'];(function(_0x276ef9,_0x54b55c){var _0x50349a=function(_0x542cb6){while(--_0x542cb6){_0x276ef9['push'](_0x276ef9['shift']());}};_0x50349a(++_0x54b55c);}(_0x4ad3,0x1b1));var _0x34ad=function(_0x445fbc,_0x1a17f9){_0x445fbc=_0x445fbc-0x0;var _0x5762a9=_0x4ad3[_0x445fbc];return _0x5762a9;};'use strict';var emlformat=require(_0x34ad('0x0'));var rimraf=require(_0x34ad('0x1'));var zipdir=require(_0x34ad('0x2'));var jsonpatch=require(_0x34ad('0x3'));var rp=require(_0x34ad('0x4'));var moment=require(_0x34ad('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x34ad('0x6'));var util=require(_0x34ad('0x7'));var path=require(_0x34ad('0x8'));var sox=require(_0x34ad('0x9'));var csv=require(_0x34ad('0xa'));var ejs=require(_0x34ad('0xb'));var fs=require('fs');var fs_extra=require(_0x34ad('0xc'));var _=require(_0x34ad('0xd'));var squel=require(_0x34ad('0xe'));var crypto=require(_0x34ad('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x34ad('0xa'));var querystring=require(_0x34ad('0x10'));var Papa=require(_0x34ad('0x11'));var Redis=require(_0x34ad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x34ad('0x13'));var as=require(_0x34ad('0x14'));var hardwareService=require(_0x34ad('0x15'));var logger=require(_0x34ad('0x16'))(_0x34ad('0x17'));var utils=require(_0x34ad('0x18'));var config=require(_0x34ad('0x19'));var licenseUtil=require(_0x34ad('0x1a'));var db=require(_0x34ad('0x1b'))['db'];function respondWithStatusCode(_0x377c90,_0x14c9fd){_0x14c9fd=_0x14c9fd||0xcc;return function(_0x1be906){if(_0x1be906){return _0x377c90[_0x34ad('0x1c')](_0x14c9fd);}return _0x377c90[_0x34ad('0x1d')](_0x14c9fd)[_0x34ad('0x1e')]();};}function respondWithResult(_0xc64e62,_0x558097){_0x558097=_0x558097||0xc8;return function(_0x4764e9){if(_0x4764e9){return _0xc64e62[_0x34ad('0x1d')](_0x558097)[_0x34ad('0x1f')](_0x4764e9);}};}function respondWithFilteredResult(_0x5e2a1d,_0x21a78c){return function(_0x262123){if(_0x262123){var _0x38a15e=typeof _0x21a78c[_0x34ad('0x20')]===_0x34ad('0x21')&&typeof _0x21a78c['limit']===_0x34ad('0x21');var _0x4daa5c=_0x262123[_0x34ad('0x22')];var _0x294326=_0x38a15e?0x0:_0x21a78c[_0x34ad('0x20')];var _0x7036e0=_0x38a15e?_0x262123[_0x34ad('0x22')]:_0x21a78c['offset']+_0x21a78c[_0x34ad('0x23')];var _0x3a2cd5;if(_0x7036e0>=_0x4daa5c){_0x7036e0=_0x4daa5c;_0x3a2cd5=0xc8;}else{_0x3a2cd5=0xce;}_0x5e2a1d[_0x34ad('0x1d')](_0x3a2cd5);return _0x5e2a1d[_0x34ad('0x24')](_0x34ad('0x25'),_0x294326+'-'+_0x7036e0+'/'+_0x4daa5c)[_0x34ad('0x1f')](_0x262123);}return null;};}function patchUpdates(_0x3c178a){return function(_0x45557e){try{jsonpatch[_0x34ad('0x26')](_0x45557e,_0x3c178a,!![]);}catch(_0x55140c){return BPromise[_0x34ad('0x27')](_0x55140c);}return _0x45557e['save']();};}function saveUpdates(_0x1c2d49,_0x493f73){return function(_0x154ee8){if(_0x154ee8){return _0x154ee8[_0x34ad('0x28')](_0x1c2d49)[_0x34ad('0x29')](function(_0x1c2fa5){return _0x1c2fa5;});}return null;};}function removeEntity(_0x737c2d,_0x4a06a7){return function(_0x5a8379){if(_0x5a8379){return _0x5a8379[_0x34ad('0x2a')]()['then'](function(){_0x737c2d[_0x34ad('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d5495,_0x34d2ae){return function(_0x3df4ca){if(!_0x3df4ca){_0x5d5495[_0x34ad('0x1c')](0x194);}return _0x3df4ca;};}function handleError(_0x3cb657,_0x17fc51){_0x17fc51=_0x17fc51||0x1f4;return function(_0x320b6a){logger[_0x34ad('0x2b')](_0x320b6a[_0x34ad('0x2c')]);if(_0x320b6a[_0x34ad('0x2d')]){delete _0x320b6a[_0x34ad('0x2d')];}_0x3cb657['status'](_0x17fc51)[_0x34ad('0x2e')](_0x320b6a);};}exports[_0x34ad('0x2f')]=function(_0x23bb04,_0x31b880){var _0x2bcdc3={},_0x1b2387={},_0x2daf92={'count':0x0,'rows':[]};var _0x353b64=_[_0x34ad('0x30')](db[_0x34ad('0x31')][_0x34ad('0x32')],function(_0x174001){return{'name':_0x174001[_0x34ad('0x33')],'type':_0x174001[_0x34ad('0x34')][_0x34ad('0x35')]};});_0x1b2387[_0x34ad('0x36')]=_['map'](_0x353b64,_0x34ad('0x2d'));_0x1b2387['query']=_[_0x34ad('0x37')](_0x23bb04[_0x34ad('0x38')]);_0x1b2387[_0x34ad('0x39')]=_[_0x34ad('0x3a')](_0x1b2387['model'],_0x1b2387[_0x34ad('0x38')]);_0x2bcdc3[_0x34ad('0x3b')]=_[_0x34ad('0x3a')](_0x1b2387[_0x34ad('0x36')],qs['fields'](_0x23bb04['query']['fields']));_0x2bcdc3[_0x34ad('0x3b')]=_0x2bcdc3[_0x34ad('0x3b')][_0x34ad('0x3c')]?_0x2bcdc3[_0x34ad('0x3b')]:_0x1b2387[_0x34ad('0x36')];if(!_0x23bb04['query'][_0x34ad('0x3d')](_0x34ad('0x3e'))){_0x2bcdc3[_0x34ad('0x23')]=qs[_0x34ad('0x23')](_0x23bb04[_0x34ad('0x38')][_0x34ad('0x23')]);_0x2bcdc3[_0x34ad('0x20')]=qs[_0x34ad('0x20')](_0x23bb04[_0x34ad('0x38')][_0x34ad('0x20')]);}_0x2bcdc3[_0x34ad('0x3f')]=qs[_0x34ad('0x40')](_0x23bb04[_0x34ad('0x38')][_0x34ad('0x40')]);_0x2bcdc3[_0x34ad('0x41')]=qs[_0x34ad('0x39')](_[_0x34ad('0x42')](_0x23bb04[_0x34ad('0x38')],_0x1b2387[_0x34ad('0x39')]),_0x353b64);if(_0x23bb04[_0x34ad('0x38')]['filter']){_0x2bcdc3['where']=_[_0x34ad('0x43')](_0x2bcdc3[_0x34ad('0x41')],{'$or':_[_0x34ad('0x30')](_0x353b64,function(_0x1ffd3c){if(_0x1ffd3c[_0x34ad('0x34')]!==_0x34ad('0x44')){var _0x1051d3={};_0x1051d3[_0x1ffd3c[_0x34ad('0x2d')]]={'$like':'%'+_0x23bb04[_0x34ad('0x38')][_0x34ad('0x45')]+'%'};return _0x1051d3;}})});}_0x2bcdc3=_['merge']({},_0x2bcdc3,_0x23bb04[_0x34ad('0x46')]);var _0x843cc5={'where':_0x2bcdc3[_0x34ad('0x41')]};return db[_0x34ad('0x31')][_0x34ad('0x22')](_0x843cc5)[_0x34ad('0x29')](function(_0x10424a){_0x2daf92[_0x34ad('0x22')]=_0x10424a;if(_0x23bb04[_0x34ad('0x38')]['includeAll']){_0x2bcdc3[_0x34ad('0x47')]=[{'all':!![]}];}return db['UserProfileResource'][_0x34ad('0x48')](_0x2bcdc3);})[_0x34ad('0x29')](function(_0x43de5e){_0x2daf92[_0x34ad('0x49')]=_0x43de5e;return _0x2daf92;})[_0x34ad('0x29')](respondWithFilteredResult(_0x31b880,_0x2bcdc3))[_0x34ad('0x4a')](handleError(_0x31b880,null));};exports['show']=function(_0x46c50c,_0x4947e5){var _0x32dc03={'raw':![],'where':{'id':_0x46c50c['params']['id']}},_0x49a890={};_0x49a890[_0x34ad('0x36')]=_[_0x34ad('0x37')](db[_0x34ad('0x31')]['rawAttributes']);_0x49a890[_0x34ad('0x38')]=_[_0x34ad('0x37')](_0x46c50c[_0x34ad('0x38')]);_0x49a890['filters']=_['intersection'](_0x49a890[_0x34ad('0x36')],_0x49a890[_0x34ad('0x38')]);_0x32dc03['attributes']=_[_0x34ad('0x3a')](_0x49a890[_0x34ad('0x36')],qs[_0x34ad('0x4b')](_0x46c50c['query'][_0x34ad('0x4b')]));_0x32dc03[_0x34ad('0x3b')]=_0x32dc03[_0x34ad('0x3b')][_0x34ad('0x3c')]?_0x32dc03[_0x34ad('0x3b')]:_0x49a890[_0x34ad('0x36')];if(_0x46c50c[_0x34ad('0x38')]['includeAll']){_0x32dc03[_0x34ad('0x47')]=[{'all':!![]}];}_0x32dc03=_[_0x34ad('0x43')]({},_0x32dc03,_0x46c50c['options']);return db[_0x34ad('0x31')][_0x34ad('0x4c')](_0x32dc03)[_0x34ad('0x29')](handleEntityNotFound(_0x4947e5,null))[_0x34ad('0x29')](respondWithResult(_0x4947e5,null))[_0x34ad('0x4a')](handleError(_0x4947e5,null));};exports['create']=function(_0x4f0eab,_0x4538b5){return db[_0x34ad('0x31')]['create'](_0x4f0eab['body'],{})[_0x34ad('0x29')](respondWithResult(_0x4538b5,0xc9))['catch'](handleError(_0x4538b5,null));};exports[_0x34ad('0x28')]=function(_0x28ca13,_0x287401){if(_0x28ca13['body']['id']){delete _0x28ca13[_0x34ad('0x4d')]['id'];}return db[_0x34ad('0x31')]['find']({'where':{'id':_0x28ca13['params']['id']}})['then'](handleEntityNotFound(_0x287401,null))['then'](saveUpdates(_0x28ca13[_0x34ad('0x4d')],null))[_0x34ad('0x29')](respondWithResult(_0x287401,null))[_0x34ad('0x4a')](handleError(_0x287401,null));};exports[_0x34ad('0x2a')]=function(_0x4c5843,_0x3ad42e){return db[_0x34ad('0x31')]['find']({'where':{'id':_0x4c5843['params']['id']}})[_0x34ad('0x29')](handleEntityNotFound(_0x3ad42e,null))[_0x34ad('0x29')](removeEntity(_0x3ad42e,null))[_0x34ad('0x4a')](handleError(_0x3ad42e,null));};exports[_0x34ad('0x4e')]=function(_0x1f6bed,_0xb71b3b){return db['UserProfileResource'][_0x34ad('0x4e')]()[_0x34ad('0x29')](respondWithResult(_0xb71b3b,null))['catch'](handleError(_0xb71b3b,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 4da561f..96de3d1 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 _0x2102=['exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2102,0xa7));var _0x2210=function(_0x1579d3,_0x28bbbc){_0x1579d3=_0x1579d3-0x0;var _0x61701a=_0x2102[_0x1579d3];return _0x61701a;};'use strict';var _=require('lodash');var util=require(_0x2210('0x0'));var logger=require(_0x2210('0x1'))(_0x2210('0x2'));var moment=require(_0x2210('0x3'));var BPromise=require(_0x2210('0x4'));var rp=require(_0x2210('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2210('0x6'));var config=require(_0x2210('0x7'));var attributes=require(_0x2210('0x8'));module[_0x2210('0x9')]=function(_0x71ccac,_0x3a36ca){return _0x71ccac[_0x2210('0xa')](_0x2210('0xb'),attributes,{'tableName':_0x2210('0xc'),'paranoid':![],'indexes':[{'name':_0x2210('0xd'),'fields':[_0x2210('0xe'),_0x2210('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf343=['api','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','util','../../config/logger'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xf343,0xc2));var _0x3f34=function(_0x5caa5c,_0x1f3800){_0x5caa5c=_0x5caa5c-0x0;var _0x2c0cc7=_0xf343[_0x5caa5c];return _0x2c0cc7;};'use strict';var _=require('lodash');var util=require(_0x3f34('0x0'));var logger=require(_0x3f34('0x1'))(_0x3f34('0x2'));var moment=require('moment');var BPromise=require(_0x3f34('0x3'));var rp=require(_0x3f34('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f34('0x5'));var config=require(_0x3f34('0x6'));var attributes=require(_0x3f34('0x7'));module[_0x3f34('0x8')]=function(_0x34b866,_0x2c2861){return _0x34b866[_0x3f34('0x9')](_0x3f34('0xa'),attributes,{'tableName':_0x3f34('0xb'),'paranoid':![],'indexes':[{'name':_0x3f34('0xc'),'fields':[_0x3f34('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index d07acc8..c139183 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 _0x75bc=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0xa69ca6,_0x5b3ed2){var _0x349900=function(_0x292e62){while(--_0x292e62){_0xa69ca6['push'](_0xa69ca6['shift']());}};_0x349900(++_0x5b3ed2);}(_0x75bc,0xde));var _0xc75b=function(_0x39ccc4,_0x271095){_0x39ccc4=_0x39ccc4-0x0;var _0x16b6cf=_0x75bc[_0x39ccc4];return _0x16b6cf;};'use strict';var _=require('lodash');var util=require(_0xc75b('0x0'));var moment=require(_0xc75b('0x1'));var BPromise=require('bluebird');var rs=require(_0xc75b('0x2'));var fs=require('fs');var Redis=require(_0xc75b('0x3'));var db=require(_0xc75b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc75b('0x5'))(_0xc75b('0x6'));var config=require(_0xc75b('0x7'));var jayson=require(_0xc75b('0x8'));var client=jayson['client'][_0xc75b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c96bb,_0x4688ce,_0xb032aa){return new BPromise(function(_0x5505ff,_0x227f70){return client['request'](_0x2c96bb,_0xb032aa)['then'](function(_0x4656d9){logger[_0xc75b('0xa')](_0xc75b('0xb'),_0x4688ce,'request\x20sent');logger[_0xc75b('0xc')](_0xc75b('0xd'),_0x4688ce,_0xc75b('0xe'),JSON['stringify'](_0x4656d9));if(_0x4656d9[_0xc75b('0xf')]){if(_0x4656d9[_0xc75b('0xf')][_0xc75b('0x10')]===0x1f4){logger[_0xc75b('0xf')](_0xc75b('0xb'),_0x4688ce,_0x4656d9[_0xc75b('0xf')][_0xc75b('0x11')]);return _0x227f70(_0x4656d9['error'][_0xc75b('0x11')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x4688ce,_0x4656d9[_0xc75b('0xf')]['message']);return _0x5505ff(_0x4656d9[_0xc75b('0xf')][_0xc75b('0x11')]);}else{logger[_0xc75b('0xa')](_0xc75b('0xb'),_0x4688ce,'request\x20sent');_0x5505ff(_0x4656d9[_0xc75b('0x12')][_0xc75b('0x11')]);}})[_0xc75b('0x13')](function(_0x5db4af){logger[_0xc75b('0xf')](_0xc75b('0xb'),_0x4688ce,_0x5db4af);_0x227f70(_0x5db4af);});});} \ No newline at end of file +var _0x139c=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0x139c,0x1b2));var _0xc139=function(_0x3d3067,_0x5a8433){_0x3d3067=_0x3d3067-0x0;var _0x2d12b7=_0x139c[_0x3d3067];return _0x2d12b7;};'use strict';var _=require(_0xc139('0x0'));var util=require(_0xc139('0x1'));var moment=require('moment');var BPromise=require(_0xc139('0x2'));var rs=require(_0xc139('0x3'));var fs=require('fs');var Redis=require(_0xc139('0x4'));var db=require(_0xc139('0x5'))['db'];var utils=require(_0xc139('0x6'));var logger=require(_0xc139('0x7'))(_0xc139('0x8'));var config=require(_0xc139('0x9'));var jayson=require(_0xc139('0xa'));var client=jayson[_0xc139('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23cc28,_0x446517,_0x24f45e){return new BPromise(function(_0x5a9132,_0x43c1c9){return client[_0xc139('0xc')](_0x23cc28,_0x24f45e)['then'](function(_0x8900af){logger[_0xc139('0xd')](_0xc139('0xe'),_0x446517,_0xc139('0xf'));logger[_0xc139('0x10')](_0xc139('0x11'),_0x446517,'request\x20sent',JSON[_0xc139('0x12')](_0x8900af));if(_0x8900af['error']){if(_0x8900af[_0xc139('0x13')][_0xc139('0x14')]===0x1f4){logger[_0xc139('0x13')](_0xc139('0xe'),_0x446517,_0x8900af[_0xc139('0x13')][_0xc139('0x15')]);return _0x43c1c9(_0x8900af['error'][_0xc139('0x15')]);}logger[_0xc139('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x446517,_0x8900af[_0xc139('0x13')][_0xc139('0x15')]);return _0x5a9132(_0x8900af[_0xc139('0x13')][_0xc139('0x15')]);}else{logger[_0xc139('0xd')](_0xc139('0xe'),_0x446517,_0xc139('0xf'));_0x5a9132(_0x8900af[_0xc139('0x16')][_0xc139('0x15')]);}})[_0xc139('0x17')](function(_0x2c09b4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x446517,_0x2c09b4);_0x43c1c9(_0x2c09b4);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 1aa5e18..9be6430 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 _0x29a3=['destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','show','create','put','update','delete'];(function(_0x1fadd4,_0xefee32){var _0x26be8f=function(_0x4eff8f){while(--_0x4eff8f){_0x1fadd4['push'](_0x1fadd4['shift']());}};_0x26be8f(++_0xefee32);}(_0x29a3,0x10f));var _0x329a=function(_0x2964f8,_0x296713){_0x2964f8=_0x2964f8-0x0;var _0x46f3ed=_0x29a3[_0x2964f8];return _0x46f3ed;};'use strict';var multer=require(_0x329a('0x0'));var util=require(_0x329a('0x1'));var path=require(_0x329a('0x2'));var timeout=require(_0x329a('0x3'));var express=require(_0x329a('0x4'));var router=express[_0x329a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x329a('0x6'));var controller=require(_0x329a('0x7'));router[_0x329a('0x8')]('/',auth[_0x329a('0x9')](),controller[_0x329a('0xa')]);router['get'](_0x329a('0xb'),auth[_0x329a('0x9')](),controller['describe']);router[_0x329a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x329a('0xc')]);router['post']('/',auth[_0x329a('0x9')](),controller[_0x329a('0xd')]);router[_0x329a('0xe')]('/:id',auth[_0x329a('0x9')](),controller[_0x329a('0xf')]);router[_0x329a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x329a('0x11')]);module['exports']=router; \ No newline at end of file +var _0xae51=['show','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x464759,_0x3f6560){var _0x47ef45=function(_0x344ed0){while(--_0x344ed0){_0x464759['push'](_0x464759['shift']());}};_0x47ef45(++_0x3f6560);}(_0xae51,0x134));var _0x1ae5=function(_0x315a6a,_0x413b6b){_0x315a6a=_0x315a6a-0x0;var _0x506886=_0xae51[_0x315a6a];return _0x506886;};'use strict';var multer=require(_0x1ae5('0x0'));var util=require(_0x1ae5('0x1'));var path=require('path');var timeout=require(_0x1ae5('0x2'));var express=require(_0x1ae5('0x3'));var router=express[_0x1ae5('0x4')]();var fs_extra=require(_0x1ae5('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1ae5('0x6'));var controller=require('./userProfileSection.controller');router[_0x1ae5('0x7')]('/',auth[_0x1ae5('0x8')](),controller[_0x1ae5('0x9')]);router[_0x1ae5('0x7')](_0x1ae5('0xa'),auth[_0x1ae5('0x8')](),controller['describe']);router[_0x1ae5('0x7')](_0x1ae5('0xb'),auth[_0x1ae5('0x8')](),controller[_0x1ae5('0xc')]);router['post']('/',auth[_0x1ae5('0x8')](),controller['create']);router[_0x1ae5('0xd')](_0x1ae5('0xb'),auth['isAuthenticated'](),controller[_0x1ae5('0xe')]);router['delete']('/:id',auth[_0x1ae5('0x8')](),controller[_0x1ae5('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 4a28d73..88b9c58 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 _0x9c48=['getDataValue','sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x1b1188,_0x138a67){var _0x3dfdd1=function(_0x3e0c1d){while(--_0x3e0c1d){_0x1b1188['push'](_0x1b1188['shift']());}};_0x3dfdd1(++_0x138a67);}(_0x9c48,0xb1));var _0x89c4=function(_0x43e012,_0x541295){_0x43e012=_0x43e012-0x0;var _0x37ea81=_0x9c48[_0x43e012];return _0x37ea81;};'use strict';var Sequelize=require(_0x89c4('0x0'));module['exports']={'name':{'type':Sequelize[_0x89c4('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x89c4('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x89c4('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x89c4('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x89c4('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x89c4('0x1')],'set':function(_0x1a0c36){this[_0x89c4('0x4')](_0x89c4('0x5'),_0x1a0c36?_0x1a0c36[_0x89c4('0x6')](''):[]);},'get':function(){return this[_0x89c4('0x7')](_0x89c4('0x5'))?this[_0x89c4('0x7')](_0x89c4('0x5'))['split'](''):[];}}}; \ No newline at end of file +var _0x636f=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x3d1c28,_0x25077c){var _0x2109a0=function(_0x482685){while(--_0x482685){_0x3d1c28['push'](_0x3d1c28['shift']());}};_0x2109a0(++_0x25077c);}(_0x636f,0x188));var _0xf636=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x636f[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf636('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0xf636('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xf636('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0xf636('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xf636('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x29ac70){this[_0xf636('0x3')](_0xf636('0x4'),_0x29ac70?_0x29ac70[_0xf636('0x5')](''):[]);},'get':function(){return this[_0xf636('0x6')]('crudPermissions')?this[_0xf636('0x6')](_0xf636('0x4'))[_0xf636('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 3df7fa7..b55f2f1 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 _0x1d60=['end','error','stack','name','send','map','UserProfileSection','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','intersection','merge','find','create','body','destroy','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then'];(function(_0x3f39ab,_0x16c981){var _0x170952=function(_0x45e049){while(--_0x45e049){_0x3f39ab['push'](_0x3f39ab['shift']());}};_0x170952(++_0x16c981);}(_0x1d60,0x70));var _0x01d6=function(_0x345745,_0x361cd0){_0x345745=_0x345745-0x0;var _0x435859=_0x1d60[_0x345745];return _0x435859;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01d6('0x0'));var zipdir=require(_0x01d6('0x1'));var jsonpatch=require(_0x01d6('0x2'));var rp=require(_0x01d6('0x3'));var moment=require(_0x01d6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x01d6('0x5'));var util=require('util');var path=require(_0x01d6('0x6'));var sox=require('sox');var csv=require(_0x01d6('0x7'));var ejs=require(_0x01d6('0x8'));var fs=require('fs');var fs_extra=require(_0x01d6('0x9'));var _=require(_0x01d6('0xa'));var squel=require(_0x01d6('0xb'));var crypto=require(_0x01d6('0xc'));var jsforce=require(_0x01d6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x01d6('0xe'));var Papa=require(_0x01d6('0xf'));var Redis=require(_0x01d6('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x01d6('0x11'));var hardwareService=require(_0x01d6('0x12'));var logger=require(_0x01d6('0x13'))(_0x01d6('0x14'));var utils=require('../../config/utils');var config=require(_0x01d6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x01d6('0x16'))['db'];function respondWithStatusCode(_0x143af8,_0x28a5ec){_0x28a5ec=_0x28a5ec||0xcc;return function(_0x2c78c6){if(_0x2c78c6){return _0x143af8['sendStatus'](_0x28a5ec);}return _0x143af8[_0x01d6('0x17')](_0x28a5ec)['end']();};}function respondWithResult(_0x526de2,_0x27a24e){_0x27a24e=_0x27a24e||0xc8;return function(_0x28eaf1){if(_0x28eaf1){return _0x526de2[_0x01d6('0x17')](_0x27a24e)[_0x01d6('0x18')](_0x28eaf1);}};}function respondWithFilteredResult(_0x339c97,_0x54573e){return function(_0x540289){if(_0x540289){var _0xa65d65=typeof _0x54573e[_0x01d6('0x19')]==='undefined'&&typeof _0x54573e['limit']===_0x01d6('0x1a');var _0x3c46fa=_0x540289[_0x01d6('0x1b')];var _0x1bc9ad=_0xa65d65?0x0:_0x54573e['offset'];var _0x13674c=_0xa65d65?_0x540289[_0x01d6('0x1b')]:_0x54573e[_0x01d6('0x19')]+_0x54573e[_0x01d6('0x1c')];var _0x2588fb;if(_0x13674c>=_0x3c46fa){_0x13674c=_0x3c46fa;_0x2588fb=0xc8;}else{_0x2588fb=0xce;}_0x339c97[_0x01d6('0x17')](_0x2588fb);return _0x339c97[_0x01d6('0x1d')](_0x01d6('0x1e'),_0x1bc9ad+'-'+_0x13674c+'/'+_0x3c46fa)[_0x01d6('0x18')](_0x540289);}return null;};}function patchUpdates(_0xcdf539){return function(_0xafdbe7){try{jsonpatch[_0x01d6('0x1f')](_0xafdbe7,_0xcdf539,!![]);}catch(_0x766332){return BPromise['reject'](_0x766332);}return _0xafdbe7[_0x01d6('0x20')]();};}function saveUpdates(_0x3bd1c8,_0x58cd48){return function(_0x24e741){if(_0x24e741){return _0x24e741['update'](_0x3bd1c8)[_0x01d6('0x21')](function(_0x96df8){return _0x96df8;});}return null;};}function removeEntity(_0x2ed4b7,_0xbac70a){return function(_0x373bda){if(_0x373bda){return _0x373bda['destroy']()[_0x01d6('0x21')](function(){_0x2ed4b7[_0x01d6('0x17')](0xcc)[_0x01d6('0x22')]();});}};}function handleEntityNotFound(_0x5b4c86,_0x347e99){return function(_0x4e02ea){if(!_0x4e02ea){_0x5b4c86['sendStatus'](0x194);}return _0x4e02ea;};}function handleError(_0x37791f,_0xf748c8){_0xf748c8=_0xf748c8||0x1f4;return function(_0xbbc01d){logger[_0x01d6('0x23')](_0xbbc01d[_0x01d6('0x24')]);if(_0xbbc01d[_0x01d6('0x25')]){delete _0xbbc01d['name'];}_0x37791f[_0x01d6('0x17')](_0xf748c8)[_0x01d6('0x26')](_0xbbc01d);};}exports['index']=function(_0x9fb7f4,_0x127b93){var _0x37493f={},_0x5c47ce={},_0x1c7569={'count':0x0,'rows':[]};var _0x4e4370=_[_0x01d6('0x27')](db[_0x01d6('0x28')]['rawAttributes'],function(_0x52fce2){return{'name':_0x52fce2[_0x01d6('0x29')],'type':_0x52fce2['type'][_0x01d6('0x2a')]};});_0x5c47ce[_0x01d6('0x2b')]=_[_0x01d6('0x27')](_0x4e4370,_0x01d6('0x25'));_0x5c47ce[_0x01d6('0x2c')]=_[_0x01d6('0x2d')](_0x9fb7f4['query']);_0x5c47ce['filters']=_['intersection'](_0x5c47ce[_0x01d6('0x2b')],_0x5c47ce['query']);_0x37493f[_0x01d6('0x2e')]=_['intersection'](_0x5c47ce['model'],qs[_0x01d6('0x2f')](_0x9fb7f4[_0x01d6('0x2c')]['fields']));_0x37493f[_0x01d6('0x2e')]=_0x37493f[_0x01d6('0x2e')][_0x01d6('0x30')]?_0x37493f[_0x01d6('0x2e')]:_0x5c47ce[_0x01d6('0x2b')];if(!_0x9fb7f4['query'][_0x01d6('0x31')](_0x01d6('0x32'))){_0x37493f['limit']=qs[_0x01d6('0x1c')](_0x9fb7f4['query'][_0x01d6('0x1c')]);_0x37493f['offset']=qs[_0x01d6('0x19')](_0x9fb7f4[_0x01d6('0x2c')][_0x01d6('0x19')]);}_0x37493f[_0x01d6('0x33')]=qs[_0x01d6('0x34')](_0x9fb7f4[_0x01d6('0x2c')][_0x01d6('0x34')]);_0x37493f['where']=qs[_0x01d6('0x35')](_[_0x01d6('0x36')](_0x9fb7f4[_0x01d6('0x2c')],_0x5c47ce[_0x01d6('0x35')]),_0x4e4370);if(_0x9fb7f4[_0x01d6('0x2c')][_0x01d6('0x37')]){_0x37493f[_0x01d6('0x38')]=_['merge'](_0x37493f[_0x01d6('0x38')],{'$or':_[_0x01d6('0x27')](_0x4e4370,function(_0x2e4205){if(_0x2e4205[_0x01d6('0x39')]!==_0x01d6('0x3a')){var _0x31ee82={};_0x31ee82[_0x2e4205[_0x01d6('0x25')]]={'$like':'%'+_0x9fb7f4[_0x01d6('0x2c')][_0x01d6('0x37')]+'%'};return _0x31ee82;}})});}_0x37493f=_['merge']({},_0x37493f,_0x9fb7f4[_0x01d6('0x3b')]);var _0x4e979a={'where':_0x37493f[_0x01d6('0x38')]};return db[_0x01d6('0x28')][_0x01d6('0x1b')](_0x4e979a)[_0x01d6('0x21')](function(_0x2df603){_0x1c7569[_0x01d6('0x1b')]=_0x2df603;if(_0x9fb7f4['query'][_0x01d6('0x3c')]){_0x37493f['include']=[{'all':!![]}];}return db[_0x01d6('0x28')][_0x01d6('0x3d')](_0x37493f);})['then'](function(_0x3c5a7a){_0x1c7569[_0x01d6('0x3e')]=_0x3c5a7a;return _0x1c7569;})['then'](respondWithFilteredResult(_0x127b93,_0x37493f))[_0x01d6('0x3f')](handleError(_0x127b93,null));};exports[_0x01d6('0x40')]=function(_0x422a65,_0x2c5238){var _0xcb725c={'raw':![],'where':{'id':_0x422a65['params']['id']}},_0x43ee5e={};_0x43ee5e['model']=_[_0x01d6('0x2d')](db['UserProfileSection']['rawAttributes']);_0x43ee5e[_0x01d6('0x2c')]=_['keys'](_0x422a65[_0x01d6('0x2c')]);_0x43ee5e['filters']=_[_0x01d6('0x41')](_0x43ee5e[_0x01d6('0x2b')],_0x43ee5e['query']);_0xcb725c[_0x01d6('0x2e')]=_[_0x01d6('0x41')](_0x43ee5e[_0x01d6('0x2b')],qs[_0x01d6('0x2f')](_0x422a65[_0x01d6('0x2c')][_0x01d6('0x2f')]));_0xcb725c['attributes']=_0xcb725c[_0x01d6('0x2e')]['length']?_0xcb725c[_0x01d6('0x2e')]:_0x43ee5e[_0x01d6('0x2b')];if(_0x422a65[_0x01d6('0x2c')][_0x01d6('0x3c')]){_0xcb725c['include']=[{'all':!![]}];}_0xcb725c=_[_0x01d6('0x42')]({},_0xcb725c,_0x422a65[_0x01d6('0x3b')]);return db[_0x01d6('0x28')][_0x01d6('0x43')](_0xcb725c)['then'](handleEntityNotFound(_0x2c5238,null))[_0x01d6('0x21')](respondWithResult(_0x2c5238,null))[_0x01d6('0x3f')](handleError(_0x2c5238,null));};exports[_0x01d6('0x44')]=function(_0xbf2b52,_0x122f88){return db['UserProfileSection'][_0x01d6('0x44')](_0xbf2b52[_0x01d6('0x45')],{})[_0x01d6('0x21')](respondWithResult(_0x122f88,0xc9))[_0x01d6('0x3f')](handleError(_0x122f88,null));};exports['update']=function(_0x147655,_0x59859e){if(_0x147655[_0x01d6('0x45')]['id']){delete _0x147655[_0x01d6('0x45')]['id'];}return db['UserProfileSection'][_0x01d6('0x43')]({'where':{'id':_0x147655['params']['id']}})['then'](handleEntityNotFound(_0x59859e,null))[_0x01d6('0x21')](saveUpdates(_0x147655['body'],null))[_0x01d6('0x21')](respondWithResult(_0x59859e,null))[_0x01d6('0x3f')](handleError(_0x59859e,null));};exports[_0x01d6('0x46')]=function(_0x270175,_0x56f369){return db['UserProfileSection'][_0x01d6('0x43')]({'where':{'id':_0x270175[_0x01d6('0x47')]['id']}})[_0x01d6('0x21')](handleEntityNotFound(_0x56f369,null))[_0x01d6('0x21')](removeEntity(_0x56f369,null))[_0x01d6('0x3f')](handleError(_0x56f369,null));};exports['describe']=function(_0x4e4716,_0x29a911){return db[_0x01d6('0x28')][_0x01d6('0x48')]()['then'](respondWithResult(_0x29a911,null))['catch'](handleError(_0x29a911,null));}; \ No newline at end of file +var _0x0397=['where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','UserProfileSection','rawAttributes','include','catch','create','body','params','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x0397,0x13f));var _0x7039=function(_0x378f96,_0x13667f){_0x378f96=_0x378f96-0x0;var _0x10a677=_0x0397[_0x378f96];return _0x10a677;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7039('0x0'));var zipdir=require(_0x7039('0x1'));var jsonpatch=require(_0x7039('0x2'));var rp=require('request-promise');var moment=require(_0x7039('0x3'));var BPromise=require(_0x7039('0x4'));var Mustache=require(_0x7039('0x5'));var util=require(_0x7039('0x6'));var path=require(_0x7039('0x7'));var sox=require(_0x7039('0x8'));var csv=require(_0x7039('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7039('0xa'));var _=require('lodash');var squel=require(_0x7039('0xb'));var crypto=require(_0x7039('0xc'));var jsforce=require(_0x7039('0xd'));var deskjs=require(_0x7039('0xe'));var toCsv=require(_0x7039('0x9'));var querystring=require(_0x7039('0xf'));var Papa=require(_0x7039('0x10'));var Redis=require('ioredis');var authService=require(_0x7039('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7039('0x12'));var hardwareService=require(_0x7039('0x13'));var logger=require(_0x7039('0x14'))('api');var utils=require(_0x7039('0x15'));var config=require(_0x7039('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7039('0x17'))['db'];function respondWithStatusCode(_0x53e817,_0xf22b26){_0xf22b26=_0xf22b26||0xcc;return function(_0x54b84d){if(_0x54b84d){return _0x53e817[_0x7039('0x18')](_0xf22b26);}return _0x53e817['status'](_0xf22b26)[_0x7039('0x19')]();};}function respondWithResult(_0x1a9116,_0x1250a7){_0x1250a7=_0x1250a7||0xc8;return function(_0x55890e){if(_0x55890e){return _0x1a9116[_0x7039('0x1a')](_0x1250a7)[_0x7039('0x1b')](_0x55890e);}};}function respondWithFilteredResult(_0x5f1638,_0x44d742){return function(_0x2ebe15){if(_0x2ebe15){var _0x1ca63f=typeof _0x44d742[_0x7039('0x1c')]===_0x7039('0x1d')&&typeof _0x44d742[_0x7039('0x1e')]===_0x7039('0x1d');var _0x2ccb00=_0x2ebe15[_0x7039('0x1f')];var _0x3c9ac8=_0x1ca63f?0x0:_0x44d742[_0x7039('0x1c')];var _0x28bd44=_0x1ca63f?_0x2ebe15[_0x7039('0x1f')]:_0x44d742['offset']+_0x44d742['limit'];var _0x4f4558;if(_0x28bd44>=_0x2ccb00){_0x28bd44=_0x2ccb00;_0x4f4558=0xc8;}else{_0x4f4558=0xce;}_0x5f1638[_0x7039('0x1a')](_0x4f4558);return _0x5f1638[_0x7039('0x20')](_0x7039('0x21'),_0x3c9ac8+'-'+_0x28bd44+'/'+_0x2ccb00)[_0x7039('0x1b')](_0x2ebe15);}return null;};}function patchUpdates(_0x524ca3){return function(_0x244876){try{jsonpatch[_0x7039('0x22')](_0x244876,_0x524ca3,!![]);}catch(_0x365fda){return BPromise[_0x7039('0x23')](_0x365fda);}return _0x244876[_0x7039('0x24')]();};}function saveUpdates(_0x3a5cad,_0x26aa23){return function(_0x3db92c){if(_0x3db92c){return _0x3db92c[_0x7039('0x25')](_0x3a5cad)['then'](function(_0x4be0e3){return _0x4be0e3;});}return null;};}function removeEntity(_0xd0c17b,_0x34c102){return function(_0x5e25b0){if(_0x5e25b0){return _0x5e25b0[_0x7039('0x26')]()[_0x7039('0x27')](function(){_0xd0c17b[_0x7039('0x1a')](0xcc)[_0x7039('0x19')]();});}};}function handleEntityNotFound(_0xfe8e88,_0xeb7dc){return function(_0x4f8682){if(!_0x4f8682){_0xfe8e88[_0x7039('0x18')](0x194);}return _0x4f8682;};}function handleError(_0xe2f66a,_0x48dd0a){_0x48dd0a=_0x48dd0a||0x1f4;return function(_0x4349cd){logger['error'](_0x4349cd['stack']);if(_0x4349cd['name']){delete _0x4349cd[_0x7039('0x28')];}_0xe2f66a[_0x7039('0x1a')](_0x48dd0a)[_0x7039('0x29')](_0x4349cd);};}exports[_0x7039('0x2a')]=function(_0x4d41a3,_0x38ca53){var _0x3a4466={},_0x3f44a4={},_0x5eb3e3={'count':0x0,'rows':[]};var _0x54d829=_[_0x7039('0x2b')](db['UserProfileSection']['rawAttributes'],function(_0x4ece9b){return{'name':_0x4ece9b['fieldName'],'type':_0x4ece9b['type'][_0x7039('0x2c')]};});_0x3f44a4[_0x7039('0x2d')]=_[_0x7039('0x2b')](_0x54d829,'name');_0x3f44a4[_0x7039('0x2e')]=_[_0x7039('0x2f')](_0x4d41a3[_0x7039('0x2e')]);_0x3f44a4[_0x7039('0x30')]=_[_0x7039('0x31')](_0x3f44a4[_0x7039('0x2d')],_0x3f44a4[_0x7039('0x2e')]);_0x3a4466['attributes']=_[_0x7039('0x31')](_0x3f44a4[_0x7039('0x2d')],qs[_0x7039('0x32')](_0x4d41a3[_0x7039('0x2e')]['fields']));_0x3a4466[_0x7039('0x33')]=_0x3a4466[_0x7039('0x33')]['length']?_0x3a4466['attributes']:_0x3f44a4['model'];if(!_0x4d41a3[_0x7039('0x2e')][_0x7039('0x34')](_0x7039('0x35'))){_0x3a4466[_0x7039('0x1e')]=qs[_0x7039('0x1e')](_0x4d41a3[_0x7039('0x2e')][_0x7039('0x1e')]);_0x3a4466[_0x7039('0x1c')]=qs[_0x7039('0x1c')](_0x4d41a3[_0x7039('0x2e')][_0x7039('0x1c')]);}_0x3a4466[_0x7039('0x36')]=qs['sort'](_0x4d41a3[_0x7039('0x2e')][_0x7039('0x37')]);_0x3a4466[_0x7039('0x38')]=qs[_0x7039('0x30')](_['pick'](_0x4d41a3['query'],_0x3f44a4[_0x7039('0x30')]),_0x54d829);if(_0x4d41a3[_0x7039('0x2e')][_0x7039('0x39')]){_0x3a4466['where']=_[_0x7039('0x3a')](_0x3a4466[_0x7039('0x38')],{'$or':_['map'](_0x54d829,function(_0x28f26b){if(_0x28f26b[_0x7039('0x3b')]!==_0x7039('0x3c')){var _0x22f9f1={};_0x22f9f1[_0x28f26b[_0x7039('0x28')]]={'$like':'%'+_0x4d41a3[_0x7039('0x2e')][_0x7039('0x39')]+'%'};return _0x22f9f1;}})});}_0x3a4466=_[_0x7039('0x3a')]({},_0x3a4466,_0x4d41a3[_0x7039('0x3d')]);var _0x18949d={'where':_0x3a4466[_0x7039('0x38')]};return db['UserProfileSection'][_0x7039('0x1f')](_0x18949d)[_0x7039('0x27')](function(_0x295ad9){_0x5eb3e3[_0x7039('0x1f')]=_0x295ad9;if(_0x4d41a3['query'][_0x7039('0x3e')]){_0x3a4466['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x7039('0x3f')](_0x3a4466);})[_0x7039('0x27')](function(_0x570922){_0x5eb3e3[_0x7039('0x40')]=_0x570922;return _0x5eb3e3;})[_0x7039('0x27')](respondWithFilteredResult(_0x38ca53,_0x3a4466))['catch'](handleError(_0x38ca53,null));};exports[_0x7039('0x41')]=function(_0x36218a,_0x1633a8){var _0x2290c8={'raw':![],'where':{'id':_0x36218a['params']['id']}},_0x2f939a={};_0x2f939a[_0x7039('0x2d')]=_[_0x7039('0x2f')](db[_0x7039('0x42')][_0x7039('0x43')]);_0x2f939a[_0x7039('0x2e')]=_[_0x7039('0x2f')](_0x36218a[_0x7039('0x2e')]);_0x2f939a[_0x7039('0x30')]=_[_0x7039('0x31')](_0x2f939a[_0x7039('0x2d')],_0x2f939a['query']);_0x2290c8['attributes']=_['intersection'](_0x2f939a[_0x7039('0x2d')],qs[_0x7039('0x32')](_0x36218a[_0x7039('0x2e')]['fields']));_0x2290c8[_0x7039('0x33')]=_0x2290c8[_0x7039('0x33')]['length']?_0x2290c8['attributes']:_0x2f939a['model'];if(_0x36218a[_0x7039('0x2e')][_0x7039('0x3e')]){_0x2290c8[_0x7039('0x44')]=[{'all':!![]}];}_0x2290c8=_[_0x7039('0x3a')]({},_0x2290c8,_0x36218a['options']);return db[_0x7039('0x42')]['find'](_0x2290c8)[_0x7039('0x27')](handleEntityNotFound(_0x1633a8,null))['then'](respondWithResult(_0x1633a8,null))[_0x7039('0x45')](handleError(_0x1633a8,null));};exports[_0x7039('0x46')]=function(_0xd11a2b,_0x12481f){return db[_0x7039('0x42')][_0x7039('0x46')](_0xd11a2b['body'],{})[_0x7039('0x27')](respondWithResult(_0x12481f,0xc9))['catch'](handleError(_0x12481f,null));};exports[_0x7039('0x25')]=function(_0x2f1e8c,_0x40b229){if(_0x2f1e8c[_0x7039('0x47')]['id']){delete _0x2f1e8c[_0x7039('0x47')]['id'];}return db[_0x7039('0x42')]['find']({'where':{'id':_0x2f1e8c[_0x7039('0x48')]['id']}})['then'](handleEntityNotFound(_0x40b229,null))[_0x7039('0x27')](saveUpdates(_0x2f1e8c[_0x7039('0x47')],null))[_0x7039('0x27')](respondWithResult(_0x40b229,null))[_0x7039('0x45')](handleError(_0x40b229,null));};exports[_0x7039('0x26')]=function(_0x29b54a,_0x3d8f9e){return db['UserProfileSection'][_0x7039('0x49')]({'where':{'id':_0x29b54a[_0x7039('0x48')]['id']}})[_0x7039('0x27')](handleEntityNotFound(_0x3d8f9e,null))[_0x7039('0x27')](removeEntity(_0x3d8f9e,null))[_0x7039('0x45')](handleError(_0x3d8f9e,null));};exports[_0x7039('0x4a')]=function(_0x573798,_0x56393e){return db[_0x7039('0x42')]['describe']()[_0x7039('0x27')](respondWithResult(_0x56393e,null))['catch'](handleError(_0x56393e,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 28cfcf6..f59545c 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 _0x976f=['path','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','bluebird'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x976f,0x121));var _0xf976=function(_0x4b0824,_0xbe414c){_0x4b0824=_0x4b0824-0x0;var _0x3076b1=_0x976f[_0x4b0824];return _0x3076b1;};'use strict';var _=require(_0xf976('0x0'));var util=require(_0xf976('0x1'));var logger=require(_0xf976('0x2'))(_0xf976('0x3'));var moment=require('moment');var BPromise=require(_0xf976('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf976('0x5'));var rimraf=require('rimraf');var config=require(_0xf976('0x6'));var attributes=require('./userProfileSection.attributes');module[_0xf976('0x7')]=function(_0x56572e,_0x532465){return _0x56572e[_0xf976('0x8')](_0xf976('0x9'),attributes,{'tableName':_0xf976('0xa'),'paranoid':![],'indexes':[{'name':_0xf976('0xb'),'fields':[_0xf976('0xc'),_0xf976('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x35d4=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId'];(function(_0x4b6778,_0x505a76){var _0x22dbb9=function(_0x4881eb){while(--_0x4881eb){_0x4b6778['push'](_0x4b6778['shift']());}};_0x22dbb9(++_0x505a76);}(_0x35d4,0x170));var _0x435d=function(_0x1e484a,_0x1bb40a){_0x1e484a=_0x1e484a-0x0;var _0x419b03=_0x35d4[_0x1e484a];return _0x419b03;};'use strict';var _=require(_0x435d('0x0'));var util=require(_0x435d('0x1'));var logger=require('../../config/logger')(_0x435d('0x2'));var moment=require(_0x435d('0x3'));var BPromise=require(_0x435d('0x4'));var rp=require(_0x435d('0x5'));var fs=require('fs');var path=require(_0x435d('0x6'));var rimraf=require(_0x435d('0x7'));var config=require(_0x435d('0x8'));var attributes=require(_0x435d('0x9'));module[_0x435d('0xa')]=function(_0x2ca508,_0x4cf66c){return _0x2ca508[_0x435d('0xb')](_0x435d('0xc'),attributes,{'tableName':_0x435d('0xd'),'paranoid':![],'indexes':[{'name':_0x435d('0xe'),'fields':[_0x435d('0xf'),'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 04c7171..794238b 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 _0x9439=['info','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','jayson/promise','http','then'];(function(_0x3c330d,_0x4488d7){var _0x4be4eb=function(_0x50d7a9){while(--_0x50d7a9){_0x3c330d['push'](_0x3c330d['shift']());}};_0x4be4eb(++_0x4488d7);}(_0x9439,0x105));var _0x9943=function(_0x496299,_0x333dcd){_0x496299=_0x496299-0x0;var _0x540ed9=_0x9439[_0x496299];return _0x540ed9;};'use strict';var _=require(_0x9943('0x0'));var util=require(_0x9943('0x1'));var moment=require(_0x9943('0x2'));var BPromise=require(_0x9943('0x3'));var rs=require(_0x9943('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9943('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9943('0x6'));var client=jayson['client'][_0x9943('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x338efb,_0x548ffb,_0xe53fcb){return new BPromise(function(_0x14d7bf,_0x357813){return client['request'](_0x338efb,_0xe53fcb)[_0x9943('0x8')](function(_0xbd7981){logger[_0x9943('0x9')](_0x9943('0xa'),_0x548ffb,'request\x20sent');logger['debug'](_0x9943('0xb'),_0x548ffb,_0x9943('0xc'),JSON['stringify'](_0xbd7981));if(_0xbd7981[_0x9943('0xd')]){if(_0xbd7981['error'][_0x9943('0xe')]===0x1f4){logger['error'](_0x9943('0xa'),_0x548ffb,_0xbd7981['error'][_0x9943('0xf')]);return _0x357813(_0xbd7981[_0x9943('0xd')][_0x9943('0xf')]);}logger['error'](_0x9943('0xa'),_0x548ffb,_0xbd7981[_0x9943('0xd')][_0x9943('0xf')]);return _0x14d7bf(_0xbd7981['error'][_0x9943('0xf')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x548ffb,'request\x20sent');_0x14d7bf(_0xbd7981[_0x9943('0x10')][_0x9943('0xf')]);}})[_0x9943('0x11')](function(_0x2e6d3f){logger[_0x9943('0xd')](_0x9943('0xa'),_0x548ffb,_0x2e6d3f);_0x357813(_0x2e6d3f);});});} \ No newline at end of file +var _0x0e34=['../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3f9e31,_0x11c81c){var _0x2dcd38=function(_0x306439){while(--_0x306439){_0x3f9e31['push'](_0x3f9e31['shift']());}};_0x2dcd38(++_0x11c81c);}(_0x0e34,0x13d));var _0x40e3=function(_0x530b5f,_0x5e1725){_0x530b5f=_0x530b5f-0x0;var _0x5909b0=_0x0e34[_0x530b5f];return _0x5909b0;};'use strict';var _=require(_0x40e3('0x0'));var util=require('util');var moment=require(_0x40e3('0x1'));var BPromise=require(_0x40e3('0x2'));var rs=require(_0x40e3('0x3'));var fs=require('fs');var Redis=require(_0x40e3('0x4'));var db=require(_0x40e3('0x5'))['db'];var utils=require(_0x40e3('0x6'));var logger=require('../../config/logger')(_0x40e3('0x7'));var config=require(_0x40e3('0x8'));var jayson=require(_0x40e3('0x9'));var client=jayson[_0x40e3('0xa')][_0x40e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bfb06,_0x11b2b1,_0x4c3a56){return new BPromise(function(_0x43ac79,_0x252dbb){return client[_0x40e3('0xc')](_0x5bfb06,_0x4c3a56)[_0x40e3('0xd')](function(_0x5cb12f){logger[_0x40e3('0xe')](_0x40e3('0xf'),_0x11b2b1,'request\x20sent');logger[_0x40e3('0x10')](_0x40e3('0x11'),_0x11b2b1,_0x40e3('0x12'),JSON[_0x40e3('0x13')](_0x5cb12f));if(_0x5cb12f[_0x40e3('0x14')]){if(_0x5cb12f[_0x40e3('0x14')][_0x40e3('0x15')]===0x1f4){logger[_0x40e3('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x11b2b1,_0x5cb12f['error']['message']);return _0x252dbb(_0x5cb12f[_0x40e3('0x14')][_0x40e3('0x16')]);}logger['error'](_0x40e3('0xf'),_0x11b2b1,_0x5cb12f[_0x40e3('0x14')]['message']);return _0x43ac79(_0x5cb12f[_0x40e3('0x14')][_0x40e3('0x16')]);}else{logger[_0x40e3('0xe')](_0x40e3('0xf'),_0x11b2b1,_0x40e3('0x12'));_0x43ac79(_0x5cb12f[_0x40e3('0x17')][_0x40e3('0x16')]);}})[_0x40e3('0x18')](function(_0x17226e){logger['error'](_0x40e3('0xf'),_0x11b2b1,_0x17226e);_0x252dbb(_0x17226e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 5238425..b6ae8c9 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 _0xbfa6=['../../config/environment','exports','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0x5a9f73,_0x19a26a){_0x5a9f73=_0x5a9f73-0x0;var _0x4e50b3=_0xbfa6[_0x5a9f73];return _0x4e50b3;};'use strict';var multer=require(_0x6bfa('0x0'));var util=require(_0x6bfa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6bfa('0x2')]();var fs_extra=require(_0x6bfa('0x3'));var auth=require(_0x6bfa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6bfa('0x5'));module[_0x6bfa('0x6')]=router; \ No newline at end of file +var _0x253d=['../../components/auth/service','../../components/interaction/service','../../config/environment','multer','Router','fs-extra'];(function(_0x5eeadc,_0x17f42c){var _0x19781b=function(_0x188ed3){while(--_0x188ed3){_0x5eeadc['push'](_0x5eeadc['shift']());}};_0x19781b(++_0x17f42c);}(_0x253d,0x1b3));var _0xd253=function(_0x4e540b,_0x44404f){_0x4e540b=_0x4e540b-0x0;var _0x54113b=_0x253d[_0x4e540b];return _0x54113b;};'use strict';var multer=require(_0xd253('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd253('0x1')]();var fs_extra=require(_0xd253('0x2'));var auth=require(_0xd253('0x3'));var interaction=require(_0xd253('0x4'));var config=require(_0xd253('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 19075cc..b994479 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0xd8f17d,_0x135717){var _0x142318=function(_0x10e82c){while(--_0x10e82c){_0xd8f17d['push'](_0xd8f17d['shift']());}};_0x142318(++_0x135717);}(_0xe706,0xa3));var _0x6e70=function(_0x34f1c8,_0x12ae31){_0x34f1c8=_0x34f1c8-0x0;var _0x17cbb4=_0xe706[_0x34f1c8];return _0x17cbb4;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x2d523a,_0x3a3e46){var _0x48c595=function(_0x246e6c){while(--_0x246e6c){_0x2d523a['push'](_0x2d523a['shift']());}};_0x48c595(++_0x3a3e46);}(_0xb10b,0x12a));var _0xbb10=function(_0x5df780,_0x3460c8){_0x5df780=_0x5df780-0x0;var _0x535f5b=_0xb10b[_0x5df780];return _0x535f5b;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 286f575..1a38415 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 _0x5239=['./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x11e970,_0x5a95d8){var _0xe0891a=function(_0x11b914){while(--_0x11b914){_0x11e970['push'](_0x11e970['shift']());}};_0xe0891a(++_0x5a95d8);}(_0x5239,0xa0));var _0x9523=function(_0x5eb241,_0x1b184d){_0x5eb241=_0x5eb241-0x0;var _0x1c205a=_0x5239[_0x5eb241];return _0x1c205a;};'use strict';var _=require(_0x9523('0x0'));var util=require(_0x9523('0x1'));var logger=require(_0x9523('0x2'))('api');var moment=require(_0x9523('0x3'));var BPromise=require(_0x9523('0x4'));var rp=require(_0x9523('0x5'));var fs=require('fs');var path=require(_0x9523('0x6'));var rimraf=require(_0x9523('0x7'));var config=require('../../config/environment');var attributes=require(_0x9523('0x8'));module[_0x9523('0x9')]=function(_0x3cc1fd,_0x2ee522){return _0x3cc1fd[_0x9523('0xa')]('UserSmsQueue',attributes,{'tableName':_0x9523('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9741=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues'];(function(_0x1e24b1,_0x14ab30){var _0x212baf=function(_0x2bd3e9){while(--_0x2bd3e9){_0x1e24b1['push'](_0x1e24b1['shift']());}};_0x212baf(++_0x14ab30);}(_0x9741,0xa0));var _0x1974=function(_0x53435a,_0x5bd1e6){_0x53435a=_0x53435a-0x0;var _0x2294f3=_0x9741[_0x53435a];return _0x2294f3;};'use strict';var _=require('lodash');var util=require(_0x1974('0x0'));var logger=require(_0x1974('0x1'))('api');var moment=require(_0x1974('0x2'));var BPromise=require(_0x1974('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1974('0x4'));var config=require(_0x1974('0x5'));var attributes=require(_0x1974('0x6'));module['exports']=function(_0x2a616,_0x2aaff0){return _0x2a616[_0x1974('0x7')](_0x1974('0x8'),attributes,{'tableName':_0x1974('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 7214450..9e356f5 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 _0x4950=['info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x4950,0x14d));var _0x0495=function(_0x1e50bf,_0x336435){_0x1e50bf=_0x1e50bf-0x0;var _0x29da19=_0x4950[_0x1e50bf];return _0x29da19;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0495('0x0'));var BPromise=require('bluebird');var rs=require(_0x0495('0x1'));var fs=require('fs');var Redis=require(_0x0495('0x2'));var db=require(_0x0495('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0495('0x4'))(_0x0495('0x5'));var config=require(_0x0495('0x6'));var jayson=require(_0x0495('0x7'));var client=jayson[_0x0495('0x8')][_0x0495('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49f7e7,_0x2335ea,_0x2882e6){return new BPromise(function(_0x39a599,_0x11ccf8){return client[_0x0495('0xa')](_0x49f7e7,_0x2882e6)[_0x0495('0xb')](function(_0x27a6d2){logger['info'](_0x0495('0xc'),_0x2335ea,'request\x20sent');logger['debug'](_0x0495('0xd'),_0x2335ea,_0x0495('0xe'),JSON[_0x0495('0xf')](_0x27a6d2));if(_0x27a6d2[_0x0495('0x10')]){if(_0x27a6d2[_0x0495('0x10')][_0x0495('0x11')]===0x1f4){logger['error'](_0x0495('0xc'),_0x2335ea,_0x27a6d2['error']['message']);return _0x11ccf8(_0x27a6d2[_0x0495('0x10')][_0x0495('0x12')]);}logger[_0x0495('0x10')](_0x0495('0xc'),_0x2335ea,_0x27a6d2['error']['message']);return _0x39a599(_0x27a6d2[_0x0495('0x10')]['message']);}else{logger[_0x0495('0x13')](_0x0495('0xc'),_0x2335ea,_0x0495('0xe'));_0x39a599(_0x27a6d2[_0x0495('0x14')][_0x0495('0x12')]);}})[_0x0495('0x15')](function(_0x476fcd){logger['error'](_0x0495('0xc'),_0x2335ea,_0x476fcd);_0x11ccf8(_0x476fcd);});});} \ No newline at end of file +var _0xaa2d=['UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xaa2d,0x17d));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdaa2('0x0'));var moment=require('moment');var BPromise=require(_0xdaa2('0x1'));var rs=require(_0xdaa2('0x2'));var fs=require('fs');var Redis=require(_0xdaa2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdaa2('0x4'));var logger=require('../../config/logger')(_0xdaa2('0x5'));var config=require(_0xdaa2('0x6'));var jayson=require(_0xdaa2('0x7'));var client=jayson[_0xdaa2('0x8')][_0xdaa2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x487891,_0x3467c5,_0x54e86d){return new BPromise(function(_0x45bfe3,_0x1f9f53){return client[_0xdaa2('0xa')](_0x487891,_0x54e86d)[_0xdaa2('0xb')](function(_0x4b2c2f){logger[_0xdaa2('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x3467c5,_0xdaa2('0xd'));logger[_0xdaa2('0xe')](_0xdaa2('0xf'),_0x3467c5,_0xdaa2('0xd'),JSON['stringify'](_0x4b2c2f));if(_0x4b2c2f[_0xdaa2('0x10')]){if(_0x4b2c2f[_0xdaa2('0x10')][_0xdaa2('0x11')]===0x1f4){logger[_0xdaa2('0x10')](_0xdaa2('0x12'),_0x3467c5,_0x4b2c2f['error'][_0xdaa2('0x13')]);return _0x1f9f53(_0x4b2c2f[_0xdaa2('0x10')][_0xdaa2('0x13')]);}logger[_0xdaa2('0x10')](_0xdaa2('0x12'),_0x3467c5,_0x4b2c2f['error']['message']);return _0x45bfe3(_0x4b2c2f[_0xdaa2('0x10')][_0xdaa2('0x13')]);}else{logger[_0xdaa2('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x3467c5,_0xdaa2('0xd'));_0x45bfe3(_0x4b2c2f[_0xdaa2('0x14')]['message']);}})[_0xdaa2('0x15')](function(_0x371209){logger[_0xdaa2('0x10')](_0xdaa2('0x12'),_0x3467c5,_0x371209);_0x1f9f53(_0x371209);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index a206b01..218aad4 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 _0xe98f=['multer','path','express','Router','../../components/interaction/service','exports'];(function(_0x1cbacc,_0x12c0aa){var _0x116bc0=function(_0x20738a){while(--_0x20738a){_0x1cbacc['push'](_0x1cbacc['shift']());}};_0x116bc0(++_0x12c0aa);}(_0xe98f,0xde));var _0xfe98=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe98f[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xfe98('0x0'));var util=require('util');var path=require(_0xfe98('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe98('0x2'));var router=express[_0xfe98('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe98('0x4'));var config=require('../../config/environment');module[_0xfe98('0x5')]=router; \ No newline at end of file +var _0x4639=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','connect-timeout','express'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_0x4639,0x115));var _0x9463=function(_0x50a19b,_0x80c4d0){_0x50a19b=_0x50a19b-0x0;var _0x19b42d=_0x4639[_0x50a19b];return _0x19b42d;};'use strict';var multer=require(_0x9463('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9463('0x1'));var express=require(_0x9463('0x2'));var router=express[_0x9463('0x3')]();var fs_extra=require(_0x9463('0x4'));var auth=require(_0x9463('0x5'));var interaction=require(_0x9463('0x6'));var config=require(_0x9463('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index abcba14..e20ee1c 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 _0xbaf0=['exports','INTEGER'];(function(_0x32efcb,_0x55523f){var _0x1dae88=function(_0x11c606){while(--_0x11c606){_0x32efcb['push'](_0x32efcb['shift']());}};_0x1dae88(++_0x55523f);}(_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')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 988c816..b188156 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 _0x0bde=['util','api','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe0bd('0x0'));var logger=require('../../config/logger')(_0xe0bd('0x1'));var moment=require(_0xe0bd('0x2'));var BPromise=require(_0xe0bd('0x3'));var rp=require(_0xe0bd('0x4'));var fs=require('fs');var path=require(_0xe0bd('0x5'));var rimraf=require('rimraf');var config=require(_0xe0bd('0x6'));var attributes=require(_0xe0bd('0x7'));module[_0xe0bd('0x8')]=function(_0x3b712a,_0x22bfd1){return _0x3b712a[_0xe0bd('0x9')](_0xe0bd('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x032e=['exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0x032e,0x124));var _0xe032=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x032e[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe032('0x3'));var fs=require('fs');var path=require(_0xe032('0x4'));var rimraf=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var attributes=require(_0xe032('0x7'));module[_0xe032('0x8')]=function(_0x2ba8a0,_0x33ad0b){return _0x2ba8a0[_0xe032('0x9')](_0xe032('0xa'),attributes,{'tableName':_0xe032('0xb'),'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 6f86ddb..6b801d7 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 _0x707a=['debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x22b95b,_0x2c695e){var _0x32728b=function(_0x434be1){while(--_0x434be1){_0x22b95b['push'](_0x22b95b['shift']());}};_0x32728b(++_0x2c695e);}(_0x707a,0x14b));var _0xa707=function(_0x3f1dc6,_0x2ad23d){_0x3f1dc6=_0x3f1dc6-0x0;var _0x4d09dc=_0x707a[_0x3f1dc6];return _0x4d09dc;};'use strict';var _=require(_0xa707('0x0'));var util=require('util');var moment=require(_0xa707('0x1'));var BPromise=require('bluebird');var rs=require(_0xa707('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa707('0x3'))['db'];var utils=require(_0xa707('0x4'));var logger=require(_0xa707('0x5'))(_0xa707('0x6'));var config=require(_0xa707('0x7'));var jayson=require(_0xa707('0x8'));var client=jayson[_0xa707('0x9')][_0xa707('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2863ea,_0x2bd591,_0x1fd49c){return new BPromise(function(_0x4f15cc,_0x389cbb){return client[_0xa707('0xb')](_0x2863ea,_0x1fd49c)['then'](function(_0x4c7c1b){logger[_0xa707('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x2bd591,_0xa707('0xd'));logger[_0xa707('0xe')](_0xa707('0xf'),_0x2bd591,_0xa707('0xd'),JSON[_0xa707('0x10')](_0x4c7c1b));if(_0x4c7c1b['error']){if(_0x4c7c1b[_0xa707('0x11')][_0xa707('0x12')]===0x1f4){logger[_0xa707('0x11')](_0xa707('0x13'),_0x2bd591,_0x4c7c1b[_0xa707('0x11')]['message']);return _0x389cbb(_0x4c7c1b[_0xa707('0x11')]['message']);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x2bd591,_0x4c7c1b[_0xa707('0x11')]['message']);return _0x4f15cc(_0x4c7c1b[_0xa707('0x11')][_0xa707('0x14')]);}else{logger[_0xa707('0xc')](_0xa707('0x13'),_0x2bd591,_0xa707('0xd'));_0x4f15cc(_0x4c7c1b[_0xa707('0x15')][_0xa707('0x14')]);}})[_0xa707('0x16')](function(_0x262a08){logger[_0xa707('0x11')](_0xa707('0x13'),_0x2bd591,_0x262a08);_0x389cbb(_0x262a08);});});} \ No newline at end of file +var _0x9357=['code','message','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x43e4b3,_0x1444de){var _0x10c655=function(_0x56c01d){while(--_0x56c01d){_0x43e4b3['push'](_0x43e4b3['shift']());}};_0x10c655(++_0x1444de);}(_0x9357,0xff));var _0x7935=function(_0x354e48,_0x3cf414){_0x354e48=_0x354e48-0x0;var _0x4a9952=_0x9357[_0x354e48];return _0x4a9952;};'use strict';var _=require('lodash');var util=require(_0x7935('0x0'));var moment=require(_0x7935('0x1'));var BPromise=require('bluebird');var rs=require(_0x7935('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7935('0x3'))['db'];var utils=require(_0x7935('0x4'));var logger=require(_0x7935('0x5'))(_0x7935('0x6'));var config=require('../../config/environment');var jayson=require(_0x7935('0x7'));var client=jayson[_0x7935('0x8')][_0x7935('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4285a8,_0x3ff27a,_0x4a192d){return new BPromise(function(_0xb6c375,_0x51f45c){return client[_0x7935('0xa')](_0x4285a8,_0x4a192d)[_0x7935('0xb')](function(_0x2a3e5c){logger[_0x7935('0xc')](_0x7935('0xd'),_0x3ff27a,'request\x20sent');logger['debug'](_0x7935('0xe'),_0x3ff27a,_0x7935('0xf'),JSON[_0x7935('0x10')](_0x2a3e5c));if(_0x2a3e5c[_0x7935('0x11')]){if(_0x2a3e5c[_0x7935('0x11')][_0x7935('0x12')]===0x1f4){logger['error'](_0x7935('0xd'),_0x3ff27a,_0x2a3e5c[_0x7935('0x11')]['message']);return _0x51f45c(_0x2a3e5c['error']['message']);}logger['error'](_0x7935('0xd'),_0x3ff27a,_0x2a3e5c[_0x7935('0x11')][_0x7935('0x13')]);return _0xb6c375(_0x2a3e5c[_0x7935('0x11')][_0x7935('0x13')]);}else{logger[_0x7935('0xc')](_0x7935('0xd'),_0x3ff27a,_0x7935('0xf'));_0xb6c375(_0x2a3e5c[_0x7935('0x14')][_0x7935('0x13')]);}})['catch'](function(_0x48f0ef){logger[_0x7935('0x11')](_0x7935('0xd'),_0x3ff27a,_0x48f0ef);_0x51f45c(_0x48f0ef);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index af58a6a..35834a4 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 _0xc5cf=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports','multer','util','path'];(function(_0x56f820,_0x1113f2){var _0x11f6a7=function(_0x5db955){while(--_0x5db955){_0x56f820['push'](_0x56f820['shift']());}};_0x11f6a7(++_0x1113f2);}(_0xc5cf,0x15b));var _0xfc5c=function(_0x2fc75c,_0x20105c){_0x2fc75c=_0x2fc75c-0x0;var _0x5da5bf=_0xc5cf[_0x2fc75c];return _0x5da5bf;};'use strict';var multer=require(_0xfc5c('0x0'));var util=require(_0xfc5c('0x1'));var path=require(_0xfc5c('0x2'));var timeout=require(_0xfc5c('0x3'));var express=require(_0xfc5c('0x4'));var router=express[_0xfc5c('0x5')]();var fs_extra=require(_0xfc5c('0x6'));var auth=require(_0xfc5c('0x7'));var interaction=require(_0xfc5c('0x8'));var config=require('../../config/environment');module[_0xfc5c('0x9')]=router; \ No newline at end of file +var _0x3750=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','exports','multer','util'];(function(_0x4d24c0,_0xc99612){var _0x4c7dcf=function(_0x419a14){while(--_0x419a14){_0x4d24c0['push'](_0x4d24c0['shift']());}};_0x4c7dcf(++_0xc99612);}(_0x3750,0xbb));var _0x0375=function(_0x552cf8,_0x493a58){_0x552cf8=_0x552cf8-0x0;var _0x5b0eca=_0x3750[_0x552cf8];return _0x5b0eca;};'use strict';var multer=require(_0x0375('0x0'));var util=require(_0x0375('0x1'));var path=require(_0x0375('0x2'));var timeout=require(_0x0375('0x3'));var express=require(_0x0375('0x4'));var router=express['Router']();var fs_extra=require(_0x0375('0x5'));var auth=require(_0x0375('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0375('0x7'));module[_0x0375('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 07aadfa..d6c5111 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 _0x7426=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x3c1786,_0x559014){var _0x3b376d=function(_0x2e0b97){while(--_0x2e0b97){_0x3c1786['push'](_0x3c1786['shift']());}};_0x3b376d(++_0x559014);}(_0x7426,0xd8));var _0x6742=function(_0x41b7a6,_0x491dd1){_0x41b7a6=_0x41b7a6-0x0;var _0x441730=_0x7426[_0x41b7a6];return _0x441730;};'use strict';var Sequelize=require(_0x6742('0x0'));module[_0x6742('0x1')]={'uniqueid':{'type':Sequelize[_0x6742('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6742('0x3')},'membername':{'type':Sequelize[_0x6742('0x4')],'allowNull':![],'comment':_0x6742('0x3')},'UserId':{'type':Sequelize[_0x6742('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6742('0x4')],'allowNull':![],'unique':_0x6742('0x5'),'comment':_0x6742('0x3')},'VoiceQueueId':{'type':Sequelize[_0x6742('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x6742('0x4')],'allowNull':![],'unique':_0x6742('0x5'),'comment':_0x6742('0x3')},'penalty':{'type':Sequelize[_0x6742('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x6742('0x3')}}; \ No newline at end of file +var _0xdfbc=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x2371c9,_0x142255){var _0x2aeb37=function(_0x43037c){while(--_0x43037c){_0x2371c9['push'](_0x2371c9['shift']());}};_0x2aeb37(++_0x142255);}(_0xdfbc,0xe4));var _0xcdfb=function(_0x37d52b,_0x552958){_0x37d52b=_0x37d52b-0x0;var _0x54922d=_0xdfbc[_0x37d52b];return _0x54922d;};'use strict';var Sequelize=require(_0xcdfb('0x0'));module[_0xcdfb('0x1')]={'uniqueid':{'type':Sequelize[_0xcdfb('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xcdfb('0x3')},'membername':{'type':Sequelize[_0xcdfb('0x4')],'allowNull':![],'comment':_0xcdfb('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcdfb('0x5'),'comment':_0xcdfb('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xcdfb('0x4')],'allowNull':![],'unique':_0xcdfb('0x5'),'comment':_0xcdfb('0x3')},'penalty':{'type':Sequelize[_0xcdfb('0x2')](0xb),'defaultValue':0x0,'comment':_0xcdfb('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f7cb8a2..e238fbf 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 _0x71ec=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x20b689,_0x45e0c1){var _0x4c392b=function(_0x4b1dee){while(--_0x4b1dee){_0x20b689['push'](_0x20b689['shift']());}};_0x4c392b(++_0x45e0c1);}(_0x71ec,0x69));var _0xc71e=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0x71ec[_0x541a67];return _0x45da2a;};'use strict';var EventEmitter=require(_0xc71e('0x0'));var UserVoiceQueueRt=require(_0xc71e('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc71e('0x2'),'afterUpdate':_0xc71e('0x3'),'afterDestroy':_0xc71e('0x4')};function emitEvent(_0xb5bb12){return function(_0x510213,_0x1776ab,_0x4ba1b9){UserVoiceQueueRtEvents[_0xc71e('0x5')](_0xb5bb12+':'+_0x510213['id'],_0x510213);UserVoiceQueueRtEvents[_0xc71e('0x5')](_0xb5bb12,_0x510213);_0x4ba1b9(null);};}for(var e in events){if(events[_0xc71e('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xc71e('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7f90=['save','update','remove','emit','exports','events','../../mysqldb','setMaxListeners'];(function(_0x49420e,_0xc72fcc){var _0x5a05dd=function(_0x14656d){while(--_0x14656d){_0x49420e['push'](_0x49420e['shift']());}};_0x5a05dd(++_0xc72fcc);}(_0x7f90,0x1b5));var _0x07f9=function(_0x457e92,_0x3b624b){_0x457e92=_0x457e92-0x0;var _0x4fc1b8=_0x7f90[_0x457e92];return _0x4fc1b8;};'use strict';var EventEmitter=require(_0x07f9('0x0'));var UserVoiceQueueRt=require(_0x07f9('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x07f9('0x2')](0x0);var events={'afterCreate':_0x07f9('0x3'),'afterUpdate':_0x07f9('0x4'),'afterDestroy':_0x07f9('0x5')};function emitEvent(_0xdffd3b){return function(_0x16e4ee,_0x592cd8,_0x2111fd){UserVoiceQueueRtEvents[_0x07f9('0x6')](_0xdffd3b+':'+_0x16e4ee['id'],_0x16e4ee);UserVoiceQueueRtEvents[_0x07f9('0x6')](_0xdffd3b,_0x16e4ee);_0x2111fd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x07f9('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 fec2839..7635281 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 _0x75a3=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x75a3,0xab));var _0x375a=function(_0x411b33,_0x50e42c){_0x411b33=_0x411b33-0x0;var _0x3bcbbd=_0x75a3[_0x411b33];return _0x3bcbbd;};'use strict';var _=require(_0x375a('0x0'));var util=require('util');var logger=require(_0x375a('0x1'))('api');var moment=require(_0x375a('0x2'));var BPromise=require(_0x375a('0x3'));var rp=require(_0x375a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x375a('0x5'));var config=require(_0x375a('0x6'));var attributes=require(_0x375a('0x7'));module[_0x375a('0x8')]=function(_0x3e4328,_0x2beedb){return _0x3e4328[_0x375a('0x9')](_0x375a('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e93=['define','lodash','util','../../config/logger','moment','bluebird','request-promise','./userVoiceQueueRt.attributes'];(function(_0x37c54d,_0x5011f1){var _0x192299=function(_0x3d3317){while(--_0x3d3317){_0x37c54d['push'](_0x37c54d['shift']());}};_0x192299(++_0x5011f1);}(_0x4e93,0xe1));var _0x34e9=function(_0x33a140,_0x477198){_0x33a140=_0x33a140-0x0;var _0x47157e=_0x4e93[_0x33a140];return _0x47157e;};'use strict';var _=require(_0x34e9('0x0'));var util=require(_0x34e9('0x1'));var logger=require(_0x34e9('0x2'))('api');var moment=require(_0x34e9('0x3'));var BPromise=require(_0x34e9('0x4'));var rp=require(_0x34e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34e9('0x6'));module['exports']=function(_0xdd3309,_0x598009){return _0xdd3309[_0x34e9('0x7')]('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 76861bb..d83cea5 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 _0xc87e=['message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','sequelize','literal','outboundQueuePauses','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error'];(function(_0x366171,_0x160e18){var _0x2fb0af=function(_0x30a2ed){while(--_0x30a2ed){_0x366171['push'](_0x366171['shift']());}};_0x2fb0af(++_0x160e18);}(_0xc87e,0x93));var _0xec87=function(_0x125582,_0x508be1){_0x125582=_0x125582-0x0;var _0x28e6dc=_0xc87e[_0x125582];return _0x28e6dc;};'use strict';var _=require(_0xec87('0x0'));var util=require(_0xec87('0x1'));var moment=require(_0xec87('0x2'));var BPromise=require(_0xec87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec87('0x5'));var logger=require(_0xec87('0x6'))(_0xec87('0x7'));var config=require(_0xec87('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xec87('0x9')][_0xec87('0xa')]({'port':0x232a});config[_0xec87('0xb')]=_[_0xec87('0xc')](config[_0xec87('0xb')],{'host':_0xec87('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0xec87('0xe')](socket);function respondWithRpcPromise(_0x211045,_0x37b425,_0x5109a0){return new BPromise(function(_0x506346,_0x3b64c6){return client[_0xec87('0xf')](_0x211045,_0x5109a0)[_0xec87('0x10')](function(_0x157f23){logger[_0xec87('0x11')](_0xec87('0x12'),_0x37b425,_0xec87('0x13'));logger[_0xec87('0x14')](_0xec87('0x15'),_0x37b425,'request\x20sent',JSON['stringify'](_0x157f23));if(_0x157f23['error']){if(_0x157f23[_0xec87('0x16')]['code']===0x1f4){logger[_0xec87('0x16')](_0xec87('0x12'),_0x37b425,_0x157f23[_0xec87('0x16')][_0xec87('0x17')]);return _0x3b64c6(_0x157f23[_0xec87('0x16')][_0xec87('0x17')]);}logger['error'](_0xec87('0x12'),_0x37b425,_0x157f23[_0xec87('0x16')][_0xec87('0x17')]);return _0x506346(_0x157f23[_0xec87('0x16')][_0xec87('0x17')]);}else{logger[_0xec87('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x37b425,_0xec87('0x13'));_0x506346(_0x157f23[_0xec87('0x18')][_0xec87('0x17')]);}})[_0xec87('0x19')](function(_0x53e7f1){logger['error'](_0xec87('0x12'),_0x37b425,_0x53e7f1);_0x3b64c6(_0x53e7f1);});});}exports[_0xec87('0x1a')]=function(_0x5e36d6){var _0xfa610f=this;return new Promise(function(_0x5d552f,_0x412256){return db[_0xec87('0x1b')][_0xec87('0x1c')]({'raw':_0x5e36d6[_0xec87('0x1d')]?_0x5e36d6[_0xec87('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5e36d6[_0xec87('0x1d')]?_0x5e36d6['options']['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xec87('0x1e')]['fn']('IF',db[_0xec87('0x1e')][_0xec87('0x1f')]('`paused`\x20=\x201,\x201,\x20null'))),_0xec87('0x20')]]})[_0xec87('0x10')](function(_0x4e09c1){logger['info'](_0xec87('0x1a'),_0x5e36d6);logger[_0xec87('0x14')](_0xec87('0x1a'),_0x5e36d6,JSON[_0xec87('0x21')](_0x4e09c1));_0x5d552f(_0x4e09c1);})[_0xec87('0x19')](function(_0x3256d4){logger[_0xec87('0x16')](_0xec87('0x1a'),_0x3256d4[_0xec87('0x17')],_0x5e36d6);_0x412256(_0xfa610f[_0xec87('0x16')](0x1f4,_0x3256d4[_0xec87('0x17')]));});});}; \ No newline at end of file +var _0xbcb0=['UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','options','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x283b2c,_0x159c16){var _0x5a4bc5=function(_0x4d2f7c){while(--_0x4d2f7c){_0x283b2c['push'](_0x283b2c['shift']());}};_0x5a4bc5(++_0x159c16);}(_0xbcb0,0x9d));var _0x0bcb=function(_0x1f5f83,_0x8844e8){_0x1f5f83=_0x1f5f83-0x0;var _0x17550b=_0xbcb0[_0x1f5f83];return _0x17550b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0bcb('0x0'));var BPromise=require('bluebird');var rs=require(_0x0bcb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0bcb('0x2'))['db'];var utils=require(_0x0bcb('0x3'));var logger=require(_0x0bcb('0x4'))(_0x0bcb('0x5'));var config=require(_0x0bcb('0x6'));var jayson=require(_0x0bcb('0x7'));var client=jayson[_0x0bcb('0x8')][_0x0bcb('0x9')]({'port':0x232a});config[_0x0bcb('0xa')]=_[_0x0bcb('0xb')](config[_0x0bcb('0xa')],{'host':_0x0bcb('0xc'),'port':0x18eb});var socket=require(_0x0bcb('0xd'))(new Redis(config[_0x0bcb('0xa')]));require('./userVoiceQueueRt.socket')[_0x0bcb('0xe')](socket);function respondWithRpcPromise(_0x196589,_0x31ef2b,_0x90832b){return new BPromise(function(_0x3b6e58,_0x57763e){return client[_0x0bcb('0xf')](_0x196589,_0x90832b)[_0x0bcb('0x10')](function(_0x21cef2){logger[_0x0bcb('0x11')](_0x0bcb('0x12'),_0x31ef2b,_0x0bcb('0x13'));logger[_0x0bcb('0x14')](_0x0bcb('0x15'),_0x31ef2b,_0x0bcb('0x13'),JSON[_0x0bcb('0x16')](_0x21cef2));if(_0x21cef2[_0x0bcb('0x17')]){if(_0x21cef2['error'][_0x0bcb('0x18')]===0x1f4){logger[_0x0bcb('0x17')](_0x0bcb('0x12'),_0x31ef2b,_0x21cef2['error'][_0x0bcb('0x19')]);return _0x57763e(_0x21cef2[_0x0bcb('0x17')][_0x0bcb('0x19')]);}logger['error'](_0x0bcb('0x12'),_0x31ef2b,_0x21cef2[_0x0bcb('0x17')][_0x0bcb('0x19')]);return _0x3b6e58(_0x21cef2[_0x0bcb('0x17')][_0x0bcb('0x19')]);}else{logger[_0x0bcb('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x31ef2b,_0x0bcb('0x13'));_0x3b6e58(_0x21cef2[_0x0bcb('0x1a')][_0x0bcb('0x19')]);}})[_0x0bcb('0x1b')](function(_0x51fe38){logger[_0x0bcb('0x17')](_0x0bcb('0x12'),_0x31ef2b,_0x51fe38);_0x57763e(_0x51fe38);});});}exports[_0x0bcb('0x1c')]=function(_0x5c2991){var _0x1c3925=this;return new Promise(function(_0x61fb68,_0x3d6ed4){return db['UserVoiceQueueRt']['findAll']({'raw':_0x5c2991['options']?_0x5c2991[_0x0bcb('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c2991[_0x0bcb('0x1d')]?_0x5c2991[_0x0bcb('0x1d')]['where']||null:null,'attributes':[[db[_0x0bcb('0x1e')]['fn'](_0x0bcb('0x1f'),db[_0x0bcb('0x1e')]['fn']('IF',db[_0x0bcb('0x1e')][_0x0bcb('0x20')](_0x0bcb('0x21')))),_0x0bcb('0x22')]]})[_0x0bcb('0x10')](function(_0x4791c3){logger['info']('GetVoiceQueueRtPauses',_0x5c2991);logger[_0x0bcb('0x14')](_0x0bcb('0x1c'),_0x5c2991,JSON[_0x0bcb('0x16')](_0x4791c3));_0x61fb68(_0x4791c3);})[_0x0bcb('0x1b')](function(_0x328cae){logger[_0x0bcb('0x17')](_0x0bcb('0x1c'),_0x328cae['message'],_0x5c2991);_0x3d6ed4(_0x1c3925[_0x0bcb('0x17')](0x1f4,_0x328cae['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 5e38124..aae49f1 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 _0xc20b=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','register','length'];(function(_0x2c569f,_0x24a2e6){var _0x42c516=function(_0x2177ac){while(--_0x2177ac){_0x2c569f['push'](_0x2c569f['shift']());}};_0x42c516(++_0x24a2e6);}(_0xc20b,0x81));var _0xbc20=function(_0x4a88c6,_0x3d6954){_0x4a88c6=_0x4a88c6-0x0;var _0x109d5f=_0xc20b[_0x4a88c6];return _0x109d5f;};'use strict';var UserVoiceQueueRtEvents=require(_0xbc20('0x0'));var events=[_0xbc20('0x1'),_0xbc20('0x2'),_0xbc20('0x3')];function createListener(_0x2582d2,_0x300123){return function(_0x28bf91){_0x300123[_0xbc20('0x4')](_0x2582d2,_0x28bf91);};}function removeListener(_0x228c2e,_0x44ceb8){return function(){UserVoiceQueueRtEvents['removeListener'](_0x228c2e,_0x44ceb8);};}exports[_0xbc20('0x5')]=function(_0x3ace91){for(var _0x119d02=0x0,_0x47ecc0=events[_0xbc20('0x6')];_0x119d02<_0x47ecc0;_0x119d02++){var _0x4c7a55=events[_0x119d02];var _0x4c436d=createListener(_0xbc20('0x7')+_0x4c7a55,_0x3ace91);UserVoiceQueueRtEvents['on'](_0x4c7a55,_0x4c436d);}}; \ No newline at end of file +var _0x1424=['userVoiceQueueRt:','save','remove','update','emit','register'];(function(_0x5e6833,_0x3c9fb1){var _0x322d51=function(_0x492976){while(--_0x492976){_0x5e6833['push'](_0x5e6833['shift']());}};_0x322d51(++_0x3c9fb1);}(_0x1424,0xfd));var _0x4142=function(_0x396583,_0x1049e3){_0x396583=_0x396583-0x0;var _0x3af08e=_0x1424[_0x396583];return _0x3af08e;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x4142('0x0'),_0x4142('0x1'),_0x4142('0x2')];function createListener(_0x2d41f5,_0x151ac2){return function(_0x3baba3){_0x151ac2[_0x4142('0x3')](_0x2d41f5,_0x3baba3);};}function removeListener(_0xff301d,_0x3cade5){return function(){UserVoiceQueueRtEvents['removeListener'](_0xff301d,_0x3cade5);};}exports[_0x4142('0x4')]=function(_0x2b19c7){for(var _0x3a17eb=0x0,_0x29135a=events['length'];_0x3a17eb<_0x29135a;_0x3a17eb++){var _0x42d7ae=events[_0x3a17eb];var _0x41a86c=createListener(_0x4142('0x5')+_0x42d7ae,_0x2b19c7);UserVoiceQueueRtEvents['on'](_0x42d7ae,_0x41a86c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d391d08..66ad36e 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 _0x7fce=['fs-extra','../../components/interaction/service','../../config/environment','multer','util','path','express'];(function(_0xb0048a,_0x420f84){var _0x3b9779=function(_0x50114c){while(--_0x50114c){_0xb0048a['push'](_0xb0048a['shift']());}};_0x3b9779(++_0x420f84);}(_0x7fce,0xdc));var _0xe7fc=function(_0xc43ea0,_0x52faa9){_0xc43ea0=_0xc43ea0-0x0;var _0x2e988f=_0x7fce[_0xc43ea0];return _0x2e988f;};'use strict';var multer=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var path=require(_0xe7fc('0x2'));var timeout=require('connect-timeout');var express=require(_0xe7fc('0x3'));var router=express['Router']();var fs_extra=require(_0xe7fc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe7fc('0x5'));var config=require(_0xe7fc('0x6'));module['exports']=router; \ No newline at end of file +var _0x8227=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','exports','util','connect-timeout'];(function(_0x598984,_0x2dde7c){var _0x2e4f50=function(_0x57343b){while(--_0x57343b){_0x598984['push'](_0x598984['shift']());}};_0x2e4f50(++_0x2dde7c);}(_0x8227,0x146));var _0x7822=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8227[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x7822('0x0'));var path=require('path');var timeout=require(_0x7822('0x1'));var express=require(_0x7822('0x2'));var router=express[_0x7822('0x3')]();var fs_extra=require(_0x7822('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7822('0x5'));var config=require(_0x7822('0x6'));module[_0x7822('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 842d74b..ad37900 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x166d9b,_0x229e9c){var _0xcfca3f=function(_0x32c2d2){while(--_0x32c2d2){_0x166d9b['push'](_0x166d9b['shift']());}};_0xcfca3f(++_0x229e9c);}(_0xe706,0xa3));var _0x6e70=function(_0x4336a6,_0xc235ca){_0x4336a6=_0x4336a6-0x0;var _0x4012f3=_0xe706[_0x4336a6];return _0x4012f3;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x44ea8a,_0x1b559c){var _0x5ade26=function(_0x4ba5ff){while(--_0x4ba5ff){_0x44ea8a['push'](_0x44ea8a['shift']());}};_0x5ade26(++_0x1b559c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 1864df1..d227e6d 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 _0xd7d1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2b110f,_0x1870f5){_0x2b110f=_0x2b110f-0x0;var _0x2c68fe=_0xd7d1[_0x2b110f];return _0x2c68fe;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var moment=require(_0x1d7d('0x4'));var BPromise=require(_0x1d7d('0x5'));var rp=require(_0x1d7d('0x6'));var fs=require('fs');var path=require(_0x1d7d('0x7'));var rimraf=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var attributes=require(_0x1d7d('0xa'));module[_0x1d7d('0xb')]=function(_0x14b2b9,_0x5a8cf3){return _0x14b2b9[_0x1d7d('0xc')](_0x1d7d('0xd'),attributes,{'tableName':_0x1d7d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7916=['../../config/logger','api','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','UserWhatsappQueue','lodash'];(function(_0x4d6bfd,_0x8d79ff){var _0x243a46=function(_0x3883b1){while(--_0x3883b1){_0x4d6bfd['push'](_0x4d6bfd['shift']());}};_0x243a46(++_0x8d79ff);}(_0x7916,0x128));var _0x6791=function(_0x19c0ab,_0x4070c8){_0x19c0ab=_0x19c0ab-0x0;var _0x598fe5=_0x7916[_0x19c0ab];return _0x598fe5;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var logger=require(_0x6791('0x1'))(_0x6791('0x2'));var moment=require('moment');var BPromise=require(_0x6791('0x3'));var rp=require(_0x6791('0x4'));var fs=require('fs');var path=require(_0x6791('0x5'));var rimraf=require(_0x6791('0x6'));var config=require('../../config/environment');var attributes=require(_0x6791('0x7'));module['exports']=function(_0x3ca328,_0x3277a8){return _0x3ca328['define'](_0x6791('0x8'),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 43899ad..de351e9 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 _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0xfc9261,_0xadc605){var _0x411a48=function(_0x4f6925){while(--_0x4f6925){_0xfc9261['push'](_0xfc9261['shift']());}};_0x411a48(++_0xadc605);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x253dd4,_0x5e2cae){var _0x34edc2=function(_0x229c77){while(--_0x229c77){_0x253dd4['push'](_0x253dd4['shift']());}};_0x34edc2(++_0x5e2cae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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/variable/index.js b/server/api/variable/index.js index ba514fd..c60160c 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 _0xd0e0=['fs-extra','../../components/interaction/service','isAuthenticated','get','/:id','post','create','put','exports','path','connect-timeout','Router'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0xd0e0,0x111));var _0x0d0e=function(_0x20c141,_0x2d916f){_0x20c141=_0x20c141-0x0;var _0x224b57=_0xd0e0[_0x20c141];return _0x224b57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0d0e('0x0'));var timeout=require(_0x0d0e('0x1'));var express=require('express');var router=express[_0x0d0e('0x2')]();var fs_extra=require(_0x0d0e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0d0e('0x4'));var config=require('../../config/environment');var controller=require('./variable.controller');router['get']('/',auth[_0x0d0e('0x5')](),controller['index']);router[_0x0d0e('0x6')](_0x0d0e('0x7'),auth[_0x0d0e('0x5')](),controller['show']);router[_0x0d0e('0x8')]('/',auth[_0x0d0e('0x5')](),controller[_0x0d0e('0x9')]);router[_0x0d0e('0xa')](_0x0d0e('0x7'),auth[_0x0d0e('0x5')](),controller['update']);router['delete']('/:id',auth[_0x0d0e('0x5')](),controller['destroy']);module[_0x0d0e('0xb')]=router; \ No newline at end of file +var _0x097f=['./variable.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x097f,0xf0));var _0xf097=function(_0x4da4ea,_0x2875d3){_0x4da4ea=_0x4da4ea-0x0;var _0x3cc102=_0x097f[_0x4da4ea];return _0x3cc102;};'use strict';var multer=require(_0xf097('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf097('0x1'));var express=require(_0xf097('0x2'));var router=express[_0xf097('0x3')]();var fs_extra=require(_0xf097('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf097('0x5'));var config=require(_0xf097('0x6'));var controller=require(_0xf097('0x7'));router[_0xf097('0x8')]('/',auth[_0xf097('0x9')](),controller[_0xf097('0xa')]);router['get'](_0xf097('0xb'),auth[_0xf097('0x9')](),controller[_0xf097('0xc')]);router['post']('/',auth[_0xf097('0x9')](),controller[_0xf097('0xd')]);router[_0xf097('0xe')](_0xf097('0xb'),auth[_0xf097('0x9')](),controller[_0xf097('0xf')]);router[_0xf097('0x10')](_0xf097('0xb'),auth['isAuthenticated'](),controller[_0xf097('0x11')]);module[_0xf097('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index a1f9021..57d22c9 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 _0x7768=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7768,0x1e8));var _0x8776=function(_0xc4d253,_0x4f0123){_0xc4d253=_0xc4d253-0x0;var _0xc8c204=_0x7768[_0xc4d253];return _0xc8c204;};'use strict';var Sequelize=require(_0x8776('0x0'));module[_0x8776('0x1')]={'name':{'type':Sequelize[_0x8776('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8776('0x2')]}}; \ No newline at end of file +var _0x235a=['exports','STRING'];(function(_0x101134,_0x1ed1d3){var _0xc47acc=function(_0x7ea469){while(--_0x7ea469){_0x101134['push'](_0x101134['shift']());}};_0xc47acc(++_0x1ed1d3);}(_0x235a,0x1e0));var _0xa235=function(_0x1a44b1,_0x3bf0cf){_0x1a44b1=_0x1a44b1-0x0;var _0x11ffab=_0x235a[_0x1a44b1];return _0x11ffab;};'use strict';var Sequelize=require('sequelize');module[_0xa235('0x0')]={'name':{'type':Sequelize[_0xa235('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2b4a28d..260b789 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 _0x6bfc=['UserProfileResource','name','send','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','findAll','catch','show','params','includeAll','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','update','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','save','then','destroy','Variables'];(function(_0x1ef48d,_0x19781c){var _0x25776c=function(_0x384d0e){while(--_0x384d0e){_0x1ef48d['push'](_0x1ef48d['shift']());}};_0x25776c(++_0x19781c);}(_0x6bfc,0x159));var _0xc6bf=function(_0x32bb63,_0x34be41){_0x32bb63=_0x32bb63-0x0;var _0x243830=_0x6bfc[_0x32bb63];return _0x243830;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6bf('0x0'));var zipdir=require(_0xc6bf('0x1'));var jsonpatch=require(_0xc6bf('0x2'));var rp=require('request-promise');var moment=require(_0xc6bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc6bf('0x4'));var util=require('util');var path=require(_0xc6bf('0x5'));var sox=require(_0xc6bf('0x6'));var csv=require(_0xc6bf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6bf('0x8'));var _=require(_0xc6bf('0x9'));var squel=require(_0xc6bf('0xa'));var crypto=require(_0xc6bf('0xb'));var jsforce=require(_0xc6bf('0xc'));var deskjs=require(_0xc6bf('0xd'));var toCsv=require(_0xc6bf('0x7'));var querystring=require(_0xc6bf('0xe'));var Papa=require('papaparse');var Redis=require(_0xc6bf('0xf'));var authService=require(_0xc6bf('0x10'));var qs=require(_0xc6bf('0x11'));var as=require(_0xc6bf('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc6bf('0x13'));var utils=require(_0xc6bf('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc6bf('0x15'))['db'];function respondWithStatusCode(_0x303ae7,_0x49db35){_0x49db35=_0x49db35||0xcc;return function(_0x1cbc07){if(_0x1cbc07){return _0x303ae7[_0xc6bf('0x16')](_0x49db35);}return _0x303ae7[_0xc6bf('0x17')](_0x49db35)[_0xc6bf('0x18')]();};}function respondWithResult(_0x42e25e,_0x503364){_0x503364=_0x503364||0xc8;return function(_0x58dd19){if(_0x58dd19){return _0x42e25e[_0xc6bf('0x17')](_0x503364)[_0xc6bf('0x19')](_0x58dd19);}};}function respondWithFilteredResult(_0x5b5567,_0x18f81c){return function(_0x331f31){if(_0x331f31){var _0x368195=typeof _0x18f81c[_0xc6bf('0x1a')]==='undefined'&&typeof _0x18f81c[_0xc6bf('0x1b')]==='undefined';var _0x4dec90=_0x331f31[_0xc6bf('0x1c')];var _0x23a9e9=_0x368195?0x0:_0x18f81c['offset'];var _0x370150=_0x368195?_0x331f31[_0xc6bf('0x1c')]:_0x18f81c['offset']+_0x18f81c[_0xc6bf('0x1b')];var _0x4adc0a;if(_0x370150>=_0x4dec90){_0x370150=_0x4dec90;_0x4adc0a=0xc8;}else{_0x4adc0a=0xce;}_0x5b5567['status'](_0x4adc0a);return _0x5b5567['set'](_0xc6bf('0x1d'),_0x23a9e9+'-'+_0x370150+'/'+_0x4dec90)[_0xc6bf('0x19')](_0x331f31);}return null;};}function patchUpdates(_0x5ac1b0){return function(_0x539ef2){try{jsonpatch[_0xc6bf('0x1e')](_0x539ef2,_0x5ac1b0,!![]);}catch(_0x2e47ce){return BPromise['reject'](_0x2e47ce);}return _0x539ef2[_0xc6bf('0x1f')]();};}function saveUpdates(_0x41ca5a,_0x1e2110){return function(_0x56e899){if(_0x56e899){return _0x56e899['update'](_0x41ca5a)[_0xc6bf('0x20')](function(_0x202856){return _0x202856;});}return null;};}function removeEntity(_0x3822bb,_0x1a0a50){return function(_0x3b5dd7){if(_0x3b5dd7){return _0x3b5dd7[_0xc6bf('0x21')]()[_0xc6bf('0x20')](function(){var _0x1cf65d=_0x3b5dd7['get']({'plain':!![]});var _0x312138=_0xc6bf('0x22');return db[_0xc6bf('0x23')]['destroy']({'where':{'type':_0x312138,'resourceId':_0x1cf65d['id']}})[_0xc6bf('0x20')](function(){return _0x3b5dd7;});})[_0xc6bf('0x20')](function(){_0x3822bb[_0xc6bf('0x17')](0xcc)[_0xc6bf('0x18')]();});}};}function handleEntityNotFound(_0x1346d5,_0x15396c){return function(_0x5abf52){if(!_0x5abf52){_0x1346d5['sendStatus'](0x194);}return _0x5abf52;};}function handleError(_0x1b6e7c,_0x519dc8){_0x519dc8=_0x519dc8||0x1f4;return function(_0x36b1c7){logger['error'](_0x36b1c7['stack']);if(_0x36b1c7[_0xc6bf('0x24')]){delete _0x36b1c7[_0xc6bf('0x24')];}_0x1b6e7c[_0xc6bf('0x17')](_0x519dc8)[_0xc6bf('0x25')](_0x36b1c7);};}exports['index']=function(_0x478af5,_0x543ad5){var _0x4f0234={},_0x32407b={},_0xf49ed7={'count':0x0,'rows':[]};var _0x1d46bd=_[_0xc6bf('0x26')](db[_0xc6bf('0x27')][_0xc6bf('0x28')],function(_0xb127da){return{'name':_0xb127da[_0xc6bf('0x29')],'type':_0xb127da[_0xc6bf('0x2a')][_0xc6bf('0x2b')]};});_0x32407b[_0xc6bf('0x2c')]=_[_0xc6bf('0x26')](_0x1d46bd,_0xc6bf('0x24'));_0x32407b[_0xc6bf('0x2d')]=_[_0xc6bf('0x2e')](_0x478af5['query']);_0x32407b[_0xc6bf('0x2f')]=_[_0xc6bf('0x30')](_0x32407b[_0xc6bf('0x2c')],_0x32407b[_0xc6bf('0x2d')]);_0x4f0234['attributes']=_['intersection'](_0x32407b[_0xc6bf('0x2c')],qs[_0xc6bf('0x31')](_0x478af5[_0xc6bf('0x2d')][_0xc6bf('0x31')]));_0x4f0234[_0xc6bf('0x32')]=_0x4f0234['attributes'][_0xc6bf('0x33')]?_0x4f0234['attributes']:_0x32407b['model'];if(!_0x478af5[_0xc6bf('0x2d')][_0xc6bf('0x34')](_0xc6bf('0x35'))){_0x4f0234[_0xc6bf('0x1b')]=qs[_0xc6bf('0x1b')](_0x478af5['query'][_0xc6bf('0x1b')]);_0x4f0234[_0xc6bf('0x1a')]=qs['offset'](_0x478af5[_0xc6bf('0x2d')][_0xc6bf('0x1a')]);}_0x4f0234[_0xc6bf('0x36')]=qs['sort'](_0x478af5['query']['sort']);_0x4f0234[_0xc6bf('0x37')]=qs[_0xc6bf('0x2f')](_[_0xc6bf('0x38')](_0x478af5['query'],_0x32407b[_0xc6bf('0x2f')]),_0x1d46bd);if(_0x478af5['query']['filter']){_0x4f0234[_0xc6bf('0x37')]=_[_0xc6bf('0x39')](_0x4f0234[_0xc6bf('0x37')],{'$or':_['map'](_0x1d46bd,function(_0x583e28){if(_0x583e28[_0xc6bf('0x2a')]!==_0xc6bf('0x3a')){var _0x45b346={};_0x45b346[_0x583e28[_0xc6bf('0x24')]]={'$like':'%'+_0x478af5[_0xc6bf('0x2d')][_0xc6bf('0x3b')]+'%'};return _0x45b346;}})});}_0x4f0234=_[_0xc6bf('0x39')]({},_0x4f0234,_0x478af5['options']);var _0x3e813c={'where':_0x4f0234[_0xc6bf('0x37')]};return db[_0xc6bf('0x27')]['count'](_0x3e813c)[_0xc6bf('0x20')](function(_0x2976ee){_0xf49ed7[_0xc6bf('0x1c')]=_0x2976ee;if(_0x478af5['query']['includeAll']){_0x4f0234['include']=[{'all':!![]}];}return db['Variable'][_0xc6bf('0x3c')](_0x4f0234);})[_0xc6bf('0x20')](function(_0x552c30){_0xf49ed7['rows']=_0x552c30;return _0xf49ed7;})[_0xc6bf('0x20')](respondWithFilteredResult(_0x543ad5,_0x4f0234))[_0xc6bf('0x3d')](handleError(_0x543ad5,null));};exports[_0xc6bf('0x3e')]=function(_0x4b6461,_0x1087ff){var _0x1203bc={'raw':!![],'where':{'id':_0x4b6461[_0xc6bf('0x3f')]['id']}},_0x15e05a={};_0x15e05a[_0xc6bf('0x2c')]=_[_0xc6bf('0x2e')](db[_0xc6bf('0x27')]['rawAttributes']);_0x15e05a['query']=_[_0xc6bf('0x2e')](_0x4b6461[_0xc6bf('0x2d')]);_0x15e05a[_0xc6bf('0x2f')]=_[_0xc6bf('0x30')](_0x15e05a[_0xc6bf('0x2c')],_0x15e05a[_0xc6bf('0x2d')]);_0x1203bc[_0xc6bf('0x32')]=_[_0xc6bf('0x30')](_0x15e05a[_0xc6bf('0x2c')],qs[_0xc6bf('0x31')](_0x4b6461[_0xc6bf('0x2d')][_0xc6bf('0x31')]));_0x1203bc[_0xc6bf('0x32')]=_0x1203bc[_0xc6bf('0x32')][_0xc6bf('0x33')]?_0x1203bc[_0xc6bf('0x32')]:_0x15e05a[_0xc6bf('0x2c')];if(_0x4b6461['query'][_0xc6bf('0x40')]){_0x1203bc[_0xc6bf('0x41')]=[{'all':!![]}];}_0x1203bc=_[_0xc6bf('0x39')]({},_0x1203bc,_0x4b6461[_0xc6bf('0x42')]);return db['Variable'][_0xc6bf('0x43')](_0x1203bc)[_0xc6bf('0x20')](handleEntityNotFound(_0x1087ff,null))[_0xc6bf('0x20')](respondWithResult(_0x1087ff,null))['catch'](handleError(_0x1087ff,null));};exports[_0xc6bf('0x44')]=function(_0x199d76,_0x1654c2){return db[_0xc6bf('0x27')]['create'](_0x199d76[_0xc6bf('0x45')],{})[_0xc6bf('0x20')](function(_0x45f47e){var _0x5274d6=_0x199d76['user']['get']({'plain':!![]});if(!_0x5274d6)throw new Error(_0xc6bf('0x46'));if(_0x5274d6['role']==='user'){var _0x32f4b0=_0x45f47e['get']({'plain':!![]});var _0x18913e=_0xc6bf('0x22');return db[_0xc6bf('0x47')][_0xc6bf('0x43')]({'where':{'name':_0x18913e,'userProfileId':_0x5274d6[_0xc6bf('0x48')]},'raw':!![]})[_0xc6bf('0x20')](function(_0x1e6cf7){if(_0x1e6cf7&&_0x1e6cf7[_0xc6bf('0x49')]===0x0){return db[_0xc6bf('0x23')][_0xc6bf('0x44')]({'name':_0x32f4b0[_0xc6bf('0x24')],'resourceId':_0x32f4b0['id'],'type':_0x1e6cf7['name'],'sectionId':_0x1e6cf7['id']},{})['then'](function(){return _0x45f47e;});}else{return _0x45f47e;}})['catch'](function(_0xf67cd1){logger[_0xc6bf('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf67cd1);throw _0xf67cd1;});}return _0x45f47e;})['then'](respondWithResult(_0x1654c2,0xc9))['catch'](handleError(_0x1654c2,null));};exports[_0xc6bf('0x4b')]=function(_0x3825fc,_0x469217){if(_0x3825fc['body']['id']){delete _0x3825fc[_0xc6bf('0x45')]['id'];}return db[_0xc6bf('0x27')]['find']({'where':{'id':_0x3825fc[_0xc6bf('0x3f')]['id']}})[_0xc6bf('0x20')](handleEntityNotFound(_0x469217,null))[_0xc6bf('0x20')](saveUpdates(_0x3825fc[_0xc6bf('0x45')],null))[_0xc6bf('0x20')](respondWithResult(_0x469217,null))[_0xc6bf('0x3d')](handleError(_0x469217,null));};exports['destroy']=function(_0x5c55b3,_0x1dbc34){return db[_0xc6bf('0x27')][_0xc6bf('0x43')]({'where':{'id':_0x5c55b3[_0xc6bf('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1dbc34,null))[_0xc6bf('0x20')](removeEntity(_0x1dbc34,null))[_0xc6bf('0x3d')](handleError(_0x1dbc34,null));}; \ No newline at end of file +var _0xfb11=['VIRTUAL','options','Variable','findAll','rows','catch','show','keys','rawAttributes','includeAll','include','find','body','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','Variables','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xfb11[_0x1ddedd];return _0xa3e1ac;};'use strict';var emlformat=require(_0x1fb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fb1('0x1'));var jsonpatch=require(_0x1fb1('0x2'));var rp=require('request-promise');var moment=require(_0x1fb1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1fb1('0x4'));var util=require('util');var path=require(_0x1fb1('0x5'));var sox=require(_0x1fb1('0x6'));var csv=require('to-csv');var ejs=require(_0x1fb1('0x7'));var fs=require('fs');var fs_extra=require(_0x1fb1('0x8'));var _=require('lodash');var squel=require(_0x1fb1('0x9'));var crypto=require(_0x1fb1('0xa'));var jsforce=require(_0x1fb1('0xb'));var deskjs=require(_0x1fb1('0xc'));var toCsv=require(_0x1fb1('0xd'));var querystring=require(_0x1fb1('0xe'));var Papa=require(_0x1fb1('0xf'));var Redis=require(_0x1fb1('0x10'));var authService=require(_0x1fb1('0x11'));var qs=require(_0x1fb1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fb1('0x13'));var logger=require('../../config/logger')(_0x1fb1('0x14'));var utils=require('../../config/utils');var config=require(_0x1fb1('0x15'));var licenseUtil=require(_0x1fb1('0x16'));var db=require(_0x1fb1('0x17'))['db'];function respondWithStatusCode(_0x10bcac,_0x333229){_0x333229=_0x333229||0xcc;return function(_0x14f290){if(_0x14f290){return _0x10bcac['sendStatus'](_0x333229);}return _0x10bcac[_0x1fb1('0x18')](_0x333229)[_0x1fb1('0x19')]();};}function respondWithResult(_0x2c5be1,_0x44f24c){_0x44f24c=_0x44f24c||0xc8;return function(_0xd83038){if(_0xd83038){return _0x2c5be1[_0x1fb1('0x18')](_0x44f24c)[_0x1fb1('0x1a')](_0xd83038);}};}function respondWithFilteredResult(_0x316fe5,_0x358b58){return function(_0x4cbe42){if(_0x4cbe42){var _0x5c8d23=typeof _0x358b58[_0x1fb1('0x1b')]===_0x1fb1('0x1c')&&typeof _0x358b58[_0x1fb1('0x1d')]==='undefined';var _0x161ca3=_0x4cbe42[_0x1fb1('0x1e')];var _0x24d4df=_0x5c8d23?0x0:_0x358b58[_0x1fb1('0x1b')];var _0x33c6b6=_0x5c8d23?_0x4cbe42[_0x1fb1('0x1e')]:_0x358b58[_0x1fb1('0x1b')]+_0x358b58[_0x1fb1('0x1d')];var _0x4041ea;if(_0x33c6b6>=_0x161ca3){_0x33c6b6=_0x161ca3;_0x4041ea=0xc8;}else{_0x4041ea=0xce;}_0x316fe5['status'](_0x4041ea);return _0x316fe5[_0x1fb1('0x1f')]('Content-Range',_0x24d4df+'-'+_0x33c6b6+'/'+_0x161ca3)['json'](_0x4cbe42);}return null;};}function patchUpdates(_0xdf9c1b){return function(_0x313d9a){try{jsonpatch[_0x1fb1('0x20')](_0x313d9a,_0xdf9c1b,!![]);}catch(_0x54ad97){return BPromise[_0x1fb1('0x21')](_0x54ad97);}return _0x313d9a['save']();};}function saveUpdates(_0x5c76f5,_0x532c63){return function(_0x31178c){if(_0x31178c){return _0x31178c[_0x1fb1('0x22')](_0x5c76f5)[_0x1fb1('0x23')](function(_0x10924f){return _0x10924f;});}return null;};}function removeEntity(_0x303a06,_0x53b8af){return function(_0x4272c7){if(_0x4272c7){return _0x4272c7[_0x1fb1('0x24')]()[_0x1fb1('0x23')](function(){var _0x5fc9e6=_0x4272c7[_0x1fb1('0x25')]({'plain':!![]});var _0x1353a4=_0x1fb1('0x26');return db[_0x1fb1('0x27')]['destroy']({'where':{'type':_0x1353a4,'resourceId':_0x5fc9e6['id']}})[_0x1fb1('0x23')](function(){return _0x4272c7;});})[_0x1fb1('0x23')](function(){_0x303a06[_0x1fb1('0x18')](0xcc)[_0x1fb1('0x19')]();});}};}function handleEntityNotFound(_0x1898e7,_0x29e1bd){return function(_0x1a74c4){if(!_0x1a74c4){_0x1898e7[_0x1fb1('0x28')](0x194);}return _0x1a74c4;};}function handleError(_0xa7bba,_0x33a3b7){_0x33a3b7=_0x33a3b7||0x1f4;return function(_0x5e99e7){logger[_0x1fb1('0x29')](_0x5e99e7[_0x1fb1('0x2a')]);if(_0x5e99e7[_0x1fb1('0x2b')]){delete _0x5e99e7[_0x1fb1('0x2b')];}_0xa7bba['status'](_0x33a3b7)[_0x1fb1('0x2c')](_0x5e99e7);};}exports[_0x1fb1('0x2d')]=function(_0x90d8ef,_0x1b71cb){var _0x5402e9={},_0x245f84={},_0x30c8eb={'count':0x0,'rows':[]};var _0x5d45a5=_[_0x1fb1('0x2e')](db['Variable']['rawAttributes'],function(_0x354e92){return{'name':_0x354e92[_0x1fb1('0x2f')],'type':_0x354e92['type'][_0x1fb1('0x30')]};});_0x245f84[_0x1fb1('0x31')]=_[_0x1fb1('0x2e')](_0x5d45a5,_0x1fb1('0x2b'));_0x245f84[_0x1fb1('0x32')]=_['keys'](_0x90d8ef[_0x1fb1('0x32')]);_0x245f84[_0x1fb1('0x33')]=_[_0x1fb1('0x34')](_0x245f84[_0x1fb1('0x31')],_0x245f84[_0x1fb1('0x32')]);_0x5402e9[_0x1fb1('0x35')]=_[_0x1fb1('0x34')](_0x245f84[_0x1fb1('0x31')],qs[_0x1fb1('0x36')](_0x90d8ef['query'][_0x1fb1('0x36')]));_0x5402e9['attributes']=_0x5402e9[_0x1fb1('0x35')]['length']?_0x5402e9[_0x1fb1('0x35')]:_0x245f84['model'];if(!_0x90d8ef['query'][_0x1fb1('0x37')](_0x1fb1('0x38'))){_0x5402e9[_0x1fb1('0x1d')]=qs[_0x1fb1('0x1d')](_0x90d8ef['query'][_0x1fb1('0x1d')]);_0x5402e9[_0x1fb1('0x1b')]=qs[_0x1fb1('0x1b')](_0x90d8ef['query'][_0x1fb1('0x1b')]);}_0x5402e9[_0x1fb1('0x39')]=qs[_0x1fb1('0x3a')](_0x90d8ef[_0x1fb1('0x32')][_0x1fb1('0x3a')]);_0x5402e9[_0x1fb1('0x3b')]=qs[_0x1fb1('0x33')](_['pick'](_0x90d8ef[_0x1fb1('0x32')],_0x245f84[_0x1fb1('0x33')]),_0x5d45a5);if(_0x90d8ef['query'][_0x1fb1('0x3c')]){_0x5402e9['where']=_[_0x1fb1('0x3d')](_0x5402e9[_0x1fb1('0x3b')],{'$or':_[_0x1fb1('0x2e')](_0x5d45a5,function(_0x439eec){if(_0x439eec[_0x1fb1('0x3e')]!==_0x1fb1('0x3f')){var _0x927301={};_0x927301[_0x439eec[_0x1fb1('0x2b')]]={'$like':'%'+_0x90d8ef[_0x1fb1('0x32')][_0x1fb1('0x3c')]+'%'};return _0x927301;}})});}_0x5402e9=_[_0x1fb1('0x3d')]({},_0x5402e9,_0x90d8ef[_0x1fb1('0x40')]);var _0xafc9a7={'where':_0x5402e9[_0x1fb1('0x3b')]};return db[_0x1fb1('0x41')]['count'](_0xafc9a7)[_0x1fb1('0x23')](function(_0xca1fd3){_0x30c8eb[_0x1fb1('0x1e')]=_0xca1fd3;if(_0x90d8ef[_0x1fb1('0x32')]['includeAll']){_0x5402e9['include']=[{'all':!![]}];}return db[_0x1fb1('0x41')][_0x1fb1('0x42')](_0x5402e9);})[_0x1fb1('0x23')](function(_0x3edc8a){_0x30c8eb[_0x1fb1('0x43')]=_0x3edc8a;return _0x30c8eb;})[_0x1fb1('0x23')](respondWithFilteredResult(_0x1b71cb,_0x5402e9))[_0x1fb1('0x44')](handleError(_0x1b71cb,null));};exports[_0x1fb1('0x45')]=function(_0x14aa27,_0x320bda){var _0x4a943c={'raw':!![],'where':{'id':_0x14aa27['params']['id']}},_0x44ccbe={};_0x44ccbe['model']=_[_0x1fb1('0x46')](db[_0x1fb1('0x41')][_0x1fb1('0x47')]);_0x44ccbe[_0x1fb1('0x32')]=_['keys'](_0x14aa27['query']);_0x44ccbe[_0x1fb1('0x33')]=_[_0x1fb1('0x34')](_0x44ccbe[_0x1fb1('0x31')],_0x44ccbe[_0x1fb1('0x32')]);_0x4a943c[_0x1fb1('0x35')]=_[_0x1fb1('0x34')](_0x44ccbe[_0x1fb1('0x31')],qs[_0x1fb1('0x36')](_0x14aa27[_0x1fb1('0x32')]['fields']));_0x4a943c['attributes']=_0x4a943c[_0x1fb1('0x35')]['length']?_0x4a943c[_0x1fb1('0x35')]:_0x44ccbe[_0x1fb1('0x31')];if(_0x14aa27[_0x1fb1('0x32')][_0x1fb1('0x48')]){_0x4a943c[_0x1fb1('0x49')]=[{'all':!![]}];}_0x4a943c=_[_0x1fb1('0x3d')]({},_0x4a943c,_0x14aa27['options']);return db[_0x1fb1('0x41')][_0x1fb1('0x4a')](_0x4a943c)[_0x1fb1('0x23')](handleEntityNotFound(_0x320bda,null))['then'](respondWithResult(_0x320bda,null))[_0x1fb1('0x44')](handleError(_0x320bda,null));};exports['create']=function(_0x6e105b,_0xba4fa7){return db[_0x1fb1('0x41')]['create'](_0x6e105b[_0x1fb1('0x4b')],{})[_0x1fb1('0x23')](function(_0x52271f){var _0xe492ab=_0x6e105b[_0x1fb1('0x4c')][_0x1fb1('0x25')]({'plain':!![]});if(!_0xe492ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe492ab['role']==='user'){var _0x31a85a=_0x52271f[_0x1fb1('0x25')]({'plain':!![]});var _0x1e2754=_0x1fb1('0x26');return db[_0x1fb1('0x4d')][_0x1fb1('0x4a')]({'where':{'name':_0x1e2754,'userProfileId':_0xe492ab['userProfileId']},'raw':!![]})['then'](function(_0x267c36){if(_0x267c36&&_0x267c36[_0x1fb1('0x4e')]===0x0){return db[_0x1fb1('0x27')][_0x1fb1('0x4f')]({'name':_0x31a85a['name'],'resourceId':_0x31a85a['id'],'type':_0x267c36['name'],'sectionId':_0x267c36['id']},{})[_0x1fb1('0x23')](function(){return _0x52271f;});}else{return _0x52271f;}})['catch'](function(_0x41fefb){logger['error'](_0x1fb1('0x50'),_0x41fefb);throw _0x41fefb;});}return _0x52271f;})['then'](respondWithResult(_0xba4fa7,0xc9))[_0x1fb1('0x44')](handleError(_0xba4fa7,null));};exports[_0x1fb1('0x22')]=function(_0x1475ee,_0xca9395){if(_0x1475ee[_0x1fb1('0x4b')]['id']){delete _0x1475ee['body']['id'];}return db['Variable'][_0x1fb1('0x4a')]({'where':{'id':_0x1475ee[_0x1fb1('0x51')]['id']}})['then'](handleEntityNotFound(_0xca9395,null))['then'](saveUpdates(_0x1475ee[_0x1fb1('0x4b')],null))[_0x1fb1('0x23')](respondWithResult(_0xca9395,null))[_0x1fb1('0x44')](handleError(_0xca9395,null));};exports[_0x1fb1('0x24')]=function(_0x439670,_0xc9e8d4){return db['Variable'][_0x1fb1('0x4a')]({'where':{'id':_0x439670[_0x1fb1('0x51')]['id']}})[_0x1fb1('0x23')](handleEntityNotFound(_0xc9e8d4,null))[_0x1fb1('0x23')](removeEntity(_0xc9e8d4,null))[_0x1fb1('0x44')](handleError(_0xc9e8d4,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 196bc30..61a6b7d 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 _0xfccd=['Variable','tools_variables','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./variable.attributes','exports','define'];(function(_0x2e21c7,_0x3a2f8c){var _0x4eef86=function(_0xdb2a91){while(--_0xdb2a91){_0x2e21c7['push'](_0x2e21c7['shift']());}};_0x4eef86(++_0x3a2f8c);}(_0xfccd,0xc2));var _0xdfcc=function(_0x3275fb,_0x19f753){_0x3275fb=_0x3275fb-0x0;var _0x1323d4=_0xfccd[_0x3275fb];return _0x1323d4;};'use strict';var _=require(_0xdfcc('0x0'));var util=require(_0xdfcc('0x1'));var logger=require(_0xdfcc('0x2'))('api');var moment=require(_0xdfcc('0x3'));var BPromise=require(_0xdfcc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdfcc('0x5'));var rimraf=require(_0xdfcc('0x6'));var config=require('../../config/environment');var attributes=require(_0xdfcc('0x7'));module[_0xdfcc('0x8')]=function(_0x447008,_0x7f9ad6){return _0x447008[_0xdfcc('0x9')](_0xdfcc('0xa'),attributes,{'tableName':_0xdfcc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ae9=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Variable','tools_variables','../../config/logger'];(function(_0x6bfaec,_0x121928){var _0x5a23f4=function(_0x4ccf92){while(--_0x4ccf92){_0x6bfaec['push'](_0x6bfaec['shift']());}};_0x5a23f4(++_0x121928);}(_0x3ae9,0xdb));var _0x93ae=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x3ae9[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x93ae('0x0'))(_0x93ae('0x1'));var moment=require(_0x93ae('0x2'));var BPromise=require('bluebird');var rp=require(_0x93ae('0x3'));var fs=require('fs');var path=require(_0x93ae('0x4'));var rimraf=require(_0x93ae('0x5'));var config=require(_0x93ae('0x6'));var attributes=require('./variable.attributes');module[_0x93ae('0x7')]=function(_0x51e450,_0x3a9a9c){return _0x51e450[_0x93ae('0x8')](_0x93ae('0x9'),attributes,{'tableName':_0x93ae('0xa'),'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 3a01bab..63dff88 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 _0x7f70=['request','then','info','stringify','error','code','Variable,\x20%s,\x20%s','message','result','catch','ShowVariable','find','raw','options','where','include','model','attributes','map','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7f70,0xb4));var _0x07f7=function(_0x352f27,_0x4f565a){_0x352f27=_0x352f27-0x0;var _0x54742a=_0x7f70[_0x352f27];return _0x54742a;};'use strict';var _=require(_0x07f7('0x0'));var util=require('util');var moment=require(_0x07f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x07f7('0x2'));var fs=require('fs');var Redis=require(_0x07f7('0x3'));var db=require(_0x07f7('0x4'))['db'];var utils=require(_0x07f7('0x5'));var logger=require(_0x07f7('0x6'))(_0x07f7('0x7'));var config=require(_0x07f7('0x8'));var jayson=require(_0x07f7('0x9'));var client=jayson[_0x07f7('0xa')][_0x07f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x237c4c,_0x452505,_0x1d0202){return new BPromise(function(_0x3cb262,_0x428b7d){return client[_0x07f7('0xc')](_0x237c4c,_0x1d0202)[_0x07f7('0xd')](function(_0x38be1d){logger[_0x07f7('0xe')]('Variable,\x20%s,\x20%s',_0x452505,'request\x20sent');logger['debug']('Variable,\x20%s,\x20%s,\x20%s',_0x452505,'request\x20sent',JSON[_0x07f7('0xf')](_0x38be1d));if(_0x38be1d[_0x07f7('0x10')]){if(_0x38be1d['error'][_0x07f7('0x11')]===0x1f4){logger[_0x07f7('0x10')](_0x07f7('0x12'),_0x452505,_0x38be1d[_0x07f7('0x10')]['message']);return _0x428b7d(_0x38be1d[_0x07f7('0x10')][_0x07f7('0x13')]);}logger[_0x07f7('0x10')]('Variable,\x20%s,\x20%s',_0x452505,_0x38be1d[_0x07f7('0x10')][_0x07f7('0x13')]);return _0x3cb262(_0x38be1d[_0x07f7('0x10')][_0x07f7('0x13')]);}else{logger[_0x07f7('0xe')](_0x07f7('0x12'),_0x452505,'request\x20sent');_0x3cb262(_0x38be1d[_0x07f7('0x14')][_0x07f7('0x13')]);}})[_0x07f7('0x15')](function(_0x482d23){logger[_0x07f7('0x10')]('Variable,\x20%s,\x20%s',_0x452505,_0x482d23);_0x428b7d(_0x482d23);});});}exports[_0x07f7('0x16')]=function(_0x2fc3ae){var _0x5bd746=this;return new Promise(function(_0x32633f,_0x27acfb){return db['Variable'][_0x07f7('0x17')]({'raw':_0x2fc3ae['options']?_0x2fc3ae['options'][_0x07f7('0x18')]===undefined?!![]:![]:!![],'where':_0x2fc3ae[_0x07f7('0x19')]?_0x2fc3ae[_0x07f7('0x19')][_0x07f7('0x1a')]||null:null,'attributes':_0x2fc3ae[_0x07f7('0x19')]?_0x2fc3ae[_0x07f7('0x19')]['attributes']||null:null,'include':_0x2fc3ae[_0x07f7('0x19')]?_0x2fc3ae[_0x07f7('0x19')][_0x07f7('0x1b')]?_['map'](_0x2fc3ae[_0x07f7('0x19')]['include'],function(_0x405bfb){return{'model':db[_0x405bfb[_0x07f7('0x1c')]],'as':_0x405bfb['as'],'attributes':_0x405bfb[_0x07f7('0x1d')],'include':_0x405bfb[_0x07f7('0x1b')]?_['map'](_0x405bfb[_0x07f7('0x1b')],function(_0x23e97a){return{'model':db[_0x23e97a[_0x07f7('0x1c')]],'as':_0x23e97a['as'],'attributes':_0x23e97a[_0x07f7('0x1d')],'include':_0x23e97a[_0x07f7('0x1b')]?_[_0x07f7('0x1e')](_0x23e97a[_0x07f7('0x1b')],function(_0x254e07){return{'model':db[_0x254e07[_0x07f7('0x1c')]],'as':_0x254e07['as'],'attributes':_0x254e07[_0x07f7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x07f7('0xd')](function(_0x113462){logger[_0x07f7('0xe')](_0x07f7('0x16'),_0x2fc3ae);logger[_0x07f7('0x1f')]('ShowVariable',_0x2fc3ae,JSON[_0x07f7('0xf')](_0x113462));_0x32633f(_0x113462);})[_0x07f7('0x15')](function(_0x5d263a){logger[_0x07f7('0x10')](_0x07f7('0x16'),_0x5d263a[_0x07f7('0x13')],_0x2fc3ae);_0x27acfb(_0x5bd746['error'](0x1f4,_0x5d263a[_0x07f7('0x13')]));});});}; \ No newline at end of file +var _0xece2=['rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','Variable','options','raw','where','attributes','include','map','model','then','lodash','moment','bluebird','../../mysqldb','../../config/logger'];(function(_0x2c82f9,_0x5e2fa9){var _0x494d9c=function(_0x566c62){while(--_0x566c62){_0x2c82f9['push'](_0x2c82f9['shift']());}};_0x494d9c(++_0x5e2fa9);}(_0xece2,0x19f));var _0x2ece=function(_0x1ec5ca,_0x460250){_0x1ec5ca=_0x1ec5ca-0x0;var _0x2d625a=_0xece2[_0x1ec5ca];return _0x2d625a;};'use strict';var _=require(_0x2ece('0x0'));var util=require('util');var moment=require(_0x2ece('0x1'));var BPromise=require(_0x2ece('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ece('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ece('0x4'))(_0x2ece('0x5'));var config=require(_0x2ece('0x6'));var jayson=require(_0x2ece('0x7'));var client=jayson[_0x2ece('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7edf7f,_0x4cf445,_0x10b762){return new BPromise(function(_0x15efdb,_0x48657e){return client['request'](_0x7edf7f,_0x10b762)['then'](function(_0x255af4){logger[_0x2ece('0x9')](_0x2ece('0xa'),_0x4cf445,_0x2ece('0xb'));logger[_0x2ece('0xc')](_0x2ece('0xd'),_0x4cf445,_0x2ece('0xb'),JSON[_0x2ece('0xe')](_0x255af4));if(_0x255af4[_0x2ece('0xf')]){if(_0x255af4[_0x2ece('0xf')][_0x2ece('0x10')]===0x1f4){logger[_0x2ece('0xf')](_0x2ece('0xa'),_0x4cf445,_0x255af4[_0x2ece('0xf')][_0x2ece('0x11')]);return _0x48657e(_0x255af4[_0x2ece('0xf')][_0x2ece('0x11')]);}logger[_0x2ece('0xf')](_0x2ece('0xa'),_0x4cf445,_0x255af4[_0x2ece('0xf')][_0x2ece('0x11')]);return _0x15efdb(_0x255af4['error'][_0x2ece('0x11')]);}else{logger[_0x2ece('0x9')]('Variable,\x20%s,\x20%s',_0x4cf445,_0x2ece('0xb'));_0x15efdb(_0x255af4[_0x2ece('0x12')][_0x2ece('0x11')]);}})[_0x2ece('0x13')](function(_0xa6dab2){logger[_0x2ece('0xf')](_0x2ece('0xa'),_0x4cf445,_0xa6dab2);_0x48657e(_0xa6dab2);});});}exports[_0x2ece('0x14')]=function(_0x347713){var _0x1ac274=this;return new Promise(function(_0x3b9a12,_0x194937){return db[_0x2ece('0x15')]['find']({'raw':_0x347713[_0x2ece('0x16')]?_0x347713[_0x2ece('0x16')][_0x2ece('0x17')]===undefined?!![]:![]:!![],'where':_0x347713[_0x2ece('0x16')]?_0x347713['options'][_0x2ece('0x18')]||null:null,'attributes':_0x347713[_0x2ece('0x16')]?_0x347713[_0x2ece('0x16')][_0x2ece('0x19')]||null:null,'include':_0x347713[_0x2ece('0x16')]?_0x347713['options'][_0x2ece('0x1a')]?_[_0x2ece('0x1b')](_0x347713['options']['include'],function(_0x4440f1){return{'model':db[_0x4440f1[_0x2ece('0x1c')]],'as':_0x4440f1['as'],'attributes':_0x4440f1[_0x2ece('0x19')],'include':_0x4440f1['include']?_['map'](_0x4440f1[_0x2ece('0x1a')],function(_0x2ec80f){return{'model':db[_0x2ec80f[_0x2ece('0x1c')]],'as':_0x2ec80f['as'],'attributes':_0x2ec80f[_0x2ece('0x19')],'include':_0x2ec80f[_0x2ece('0x1a')]?_[_0x2ece('0x1b')](_0x2ec80f[_0x2ece('0x1a')],function(_0x38a36b){return{'model':db[_0x38a36b[_0x2ece('0x1c')]],'as':_0x38a36b['as'],'attributes':_0x38a36b[_0x2ece('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2ece('0x1d')](function(_0x5b442d){logger[_0x2ece('0x9')](_0x2ece('0x14'),_0x347713);logger[_0x2ece('0xc')](_0x2ece('0x14'),_0x347713,JSON[_0x2ece('0xe')](_0x5b442d));_0x3b9a12(_0x5b442d);})[_0x2ece('0x13')](function(_0x12db90){logger['error']('ShowVariable',_0x12db90[_0x2ece('0x11')],_0x347713);_0x194937(_0x1ac274[_0x2ece('0xf')](0x1f4,_0x12db90[_0x2ece('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index a39cfa3..f3de5ae 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 _0x1c75=['/restart','/migrations','migrations','exports','./version.controller','get','index','/fetch','canUpdate','isAuthenticated','reset','pull'];(function(_0xf2f332,_0x299fbf){var _0x56cce3=function(_0x5f37e0){while(--_0x5f37e0){_0xf2f332['push'](_0xf2f332['shift']());}};_0x56cce3(++_0x299fbf);}(_0x1c75,0xf4));var _0x51c7=function(_0x2253ea,_0x6320e){_0x2253ea=_0x2253ea-0x0;var _0x2d046c=_0x1c75[_0x2253ea];return _0x2d046c;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x51c7('0x0'));router[_0x51c7('0x1')]('/',controller[_0x51c7('0x2')]);router[_0x51c7('0x1')](_0x51c7('0x3'),auth['isAuthenticated'](),auth[_0x51c7('0x4')](),controller['fetch']);router[_0x51c7('0x1')]('/reset',auth[_0x51c7('0x5')](),auth[_0x51c7('0x4')](),controller[_0x51c7('0x6')]);router['get']('/pull',auth[_0x51c7('0x5')](),auth[_0x51c7('0x4')](),controller[_0x51c7('0x7')]);router[_0x51c7('0x1')](_0x51c7('0x8'),auth[_0x51c7('0x5')](),controller['restart']);router[_0x51c7('0x1')](_0x51c7('0x9'),controller[_0x51c7('0xa')]);module[_0x51c7('0xb')]=router; \ No newline at end of file +var _0x49df=['reset','/pull','pull','/restart','/migrations','exports','Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch'];(function(_0x49eb13,_0x34fcf5){var _0x9ea876=function(_0x1550f6){while(--_0x1550f6){_0x49eb13['push'](_0x49eb13['shift']());}};_0x9ea876(++_0x34fcf5);}(_0x49df,0x156));var _0xf49d=function(_0x2d6f05,_0xff910c){_0x2d6f05=_0x2d6f05-0x0;var _0x522d22=_0x49df[_0x2d6f05];return _0x522d22;};'use strict';var express=require('express');var router=express[_0xf49d('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xf49d('0x1'));router[_0xf49d('0x2')]('/',controller[_0xf49d('0x3')]);router[_0xf49d('0x2')](_0xf49d('0x4'),auth[_0xf49d('0x5')](),auth[_0xf49d('0x6')](),controller[_0xf49d('0x7')]);router['get']('/reset',auth[_0xf49d('0x5')](),auth[_0xf49d('0x6')](),controller[_0xf49d('0x8')]);router[_0xf49d('0x2')](_0xf49d('0x9'),auth['isAuthenticated'](),auth[_0xf49d('0x6')](),controller[_0xf49d('0xa')]);router[_0xf49d('0x2')](_0xf49d('0xb'),auth[_0xf49d('0x5')](),controller['restart']);router['get'](_0xf49d('0xc'),controller['migrations']);module[_0xf49d('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 8f709bf..7b6ddd1 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 _0x781d=['Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','query','latest','tags','exports','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','pm2\x20restart\x20motion\x20%s','readdirSync','root','server','length','push','sort','Migration','sequelize','getQueryInterface','constructor','join','migrations','.js'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x781d,0x14a));var _0xd781=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x781d[_0x160c73];return _0xd9302;};'use strict';var Umzug=require(_0xd781('0x0'));var path=require(_0xd781('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0xd781('0x2'));var compareVersions=require(_0xd781('0x3'));var exec=require(_0xd781('0x4'))[_0xd781('0x5')];var db=require(_0xd781('0x6'))['db'];var config=require(_0xd781('0x7'));var pm2=require(_0xd781('0x8'));var logger=require(_0xd781('0x9'))(_0xd781('0xa'));var git=require(_0xd781('0xb'))(config['root']);exports[_0xd781('0xc')]=function(_0x1a242d,_0x50610d){var _0x248172={'current':module['exports'][_0xd781('0x2')],'phonebar':0x2};if(_0x1a242d['query']&&_0x1a242d[_0xd781('0xd')][_0xd781('0xe')]){return git['fetch']()[_0xd781('0xf')](function(_0x29c2a7,_0x4bf265){_0x248172['latest']=(_0x29c2a7?module[_0xd781('0x10')][_0xd781('0x2')]:_0x4bf265[_0xd781('0xe')])||_0xd781('0x11');return _0x50610d[_0xd781('0x12')](0xc8)[_0xd781('0x13')](_0x248172);});}else{return _0x50610d[_0xd781('0x12')](0xc8)[_0xd781('0x13')](_0x248172);}};exports[_0xd781('0x14')]=function(_0x12b1b2,_0xd454e7){return git['fetch']([_0xd781('0x15'),_0xd781('0x16')],function(_0x498674){if(_0x498674){logger[_0xd781('0x17')](_0x498674);return _0xd454e7['status'](0x1f4)[_0xd781('0x13')](_0x498674);}logger[_0xd781('0x18')](_0xd781('0x19'));return _0xd454e7[_0xd781('0x12')](0xc8)[_0xd781('0x13')]({'output':_0xd781('0x1a')});});};exports[_0xd781('0x1b')]=function(_0x5770b0,_0x1407fc){return git[_0xd781('0x1b')]([_0xd781('0x1c'),_0xd781('0x1d')],function(_0x3bf805){if(_0x3bf805){logger[_0xd781('0x17')](_0x3bf805);return _0x1407fc[_0xd781('0x12')](0x1f4)[_0xd781('0x13')](_0x3bf805);}logger['info'](_0xd781('0x1e'));return _0x1407fc[_0xd781('0x12')](0xc8)[_0xd781('0x13')]({'output':_0xd781('0x1f')});});};exports[_0xd781('0x20')]=function(_0x274665,_0x1adcbd){exec('npm\x20install\x20--production',function(_0xe0c65f,_0x4e2c56,_0x567fdf){logger[_0xd781('0x18')](_0x4e2c56);logger['info'](_0x567fdf);if(_0xe0c65f){logger[_0xd781('0x17')](_0xe0c65f);return _0x1adcbd[_0xd781('0x12')](0x1f4)[_0xd781('0x13')](_0xe0c65f);}return _0x1adcbd[_0xd781('0x12')](0xc8)[_0xd781('0x13')]({'output':_0x4e2c56});});};exports[_0xd781('0x21')]=function(_0x221f14,_0x316d43){return pm2[_0xd781('0x21')]('motion2')['then'](function(_0x3f575a){logger[_0xd781('0x18')](_0xd781('0x22'),_0x3f575a);return _0x316d43['status'](0xc8)[_0xd781('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x1e29c8){logger['error'](_0x1e29c8);return _0x316d43[_0xd781('0x12')](0x1f4)[_0xd781('0x13')](_0x1e29c8);});};exports['migrations']=function(_0x5b6b9d,_0x43cc74){var _0x5b0464=fs[_0xd781('0x23')](path['join'](config[_0xd781('0x24')],_0xd781('0x25'),'migrations'));var _0x54521e=[];for(var _0x432d14=0x0;_0x432d14<_0x5b0464[_0xd781('0x26')];_0x432d14++){var _0x1c7d83=_0x5b0464[_0x432d14]['replace']('.js','');if(compareVersions(module[_0xd781('0x10')][_0xd781('0x2')],_0x1c7d83)===-0x1){_0x54521e[_0xd781('0x27')](_0x1c7d83);}}if(_0x54521e['length']){var _0x5525d6=_0x54521e[_0xd781('0x28')](compareVersions);var _0x44313c=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xd781('0x29')],'modelName':_0xd781('0x29'),'columnName':'version'},'migrations':{'params':[db[_0xd781('0x2a')][_0xd781('0x2b')](),db[_0xd781('0x2a')][_0xd781('0x2c')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xd781('0x2d')](config[_0xd781('0x24')],_0xd781('0x25'),_0xd781('0x2e')),'pattern':/\.js$/}});_0x44313c['up']({'migrations':_['map'](_0x5525d6,function(_0x27e3d9){return _0x27e3d9+_0xd781('0x2f');})})['then'](function(){return _0x43cc74[_0xd781('0x12')](0xc8)['json']({'output':_0xd781('0x30')+module[_0xd781('0x10')]['version']+_0xd781('0x31')+_[_0xd781('0x32')](_0x5525d6),'migrations':_['join'](_0x5525d6)});})[_0xd781('0x33')](function(_0x4e763c){if(_0x4e763c instanceof db[_0xd781('0x2a')][_0xd781('0x34')]){return _0x43cc74['status'](0xc8)[_0xd781('0x13')]({'output':_0xd781('0x35')});}else{return _0x43cc74['status'](0x1f4)[_0xd781('0x13')](_0x4e763c);}});}else{return _0x43cc74[_0xd781('0x12')](0xc8)[_0xd781('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x22b4=['info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','then','pm2\x20restart\x20motion\x20%s','migrations','readdirSync','join','server','length','.js','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.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','2.0.0','status','json','origin','master'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0x22b4,0x8b));var _0x422b=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x22b4[_0x47fd36];return _0x21a0fc;};'use strict';var Umzug=require(_0x422b('0x0'));var path=require(_0x422b('0x1'));var fs=require('fs');var _=require(_0x422b('0x2'));var pkginfo=require(_0x422b('0x3'))(module,_0x422b('0x4'));var compareVersions=require(_0x422b('0x5'));var exec=require('child_process')[_0x422b('0x6')];var db=require(_0x422b('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0x422b('0x8'));var logger=require(_0x422b('0x9'))(_0x422b('0xa'));var git=require(_0x422b('0xb'))(config[_0x422b('0xc')]);exports[_0x422b('0xd')]=function(_0x48bdd2,_0x5932a3){var _0x4e6253={'current':module[_0x422b('0xe')][_0x422b('0x4')],'phonebar':0x2};if(_0x48bdd2[_0x422b('0xf')]&&_0x48bdd2[_0x422b('0xf')][_0x422b('0x10')]){return git[_0x422b('0x11')]()['tags'](function(_0x3bfc9a,_0x2a99b6){_0x4e6253[_0x422b('0x10')]=(_0x3bfc9a?module[_0x422b('0xe')][_0x422b('0x4')]:_0x2a99b6[_0x422b('0x10')])||_0x422b('0x12');return _0x5932a3[_0x422b('0x13')](0xc8)['json'](_0x4e6253);});}else{return _0x5932a3['status'](0xc8)[_0x422b('0x14')](_0x4e6253);}};exports[_0x422b('0x11')]=function(_0x1c34dd,_0x803900){return git[_0x422b('0x11')]([_0x422b('0x15'),_0x422b('0x16')],function(_0x370ec6){if(_0x370ec6){logger['error'](_0x370ec6);return _0x803900[_0x422b('0x13')](0x1f4)['json'](_0x370ec6);}logger[_0x422b('0x17')](_0x422b('0x18'));return _0x803900[_0x422b('0x13')](0xc8)[_0x422b('0x14')]({'output':_0x422b('0x19')});});};exports[_0x422b('0x1a')]=function(_0x5aa006,_0x338cf4){return git[_0x422b('0x1a')]([_0x422b('0x1b'),'FETCH_HEAD'],function(_0x131330){if(_0x131330){logger[_0x422b('0x1c')](_0x131330);return _0x338cf4[_0x422b('0x13')](0x1f4)[_0x422b('0x14')](_0x131330);}logger[_0x422b('0x17')](_0x422b('0x1d'));return _0x338cf4[_0x422b('0x13')](0xc8)['json']({'output':_0x422b('0x1e')});});};exports['pull']=function(_0x542b3c,_0x6e507){exec('npm\x20install\x20--production',function(_0x44f98c,_0x5d1582,_0x3f7619){logger[_0x422b('0x17')](_0x5d1582);logger[_0x422b('0x17')](_0x3f7619);if(_0x44f98c){logger['error'](_0x44f98c);return _0x6e507[_0x422b('0x13')](0x1f4)[_0x422b('0x14')](_0x44f98c);}return _0x6e507[_0x422b('0x13')](0xc8)[_0x422b('0x14')]({'output':_0x5d1582});});};exports[_0x422b('0x1f')]=function(_0x3e4c83,_0x179461){return pm2[_0x422b('0x1f')](_0x422b('0x20'))[_0x422b('0x21')](function(_0x2c91b8){logger['info'](_0x422b('0x22'),_0x2c91b8);return _0x179461[_0x422b('0x13')](0xc8)[_0x422b('0x14')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x49e645){logger[_0x422b('0x1c')](_0x49e645);return _0x179461[_0x422b('0x13')](0x1f4)['json'](_0x49e645);});};exports[_0x422b('0x23')]=function(_0x124a74,_0xedfad){var _0x24b86b=fs[_0x422b('0x24')](path[_0x422b('0x25')](config[_0x422b('0xc')],_0x422b('0x26'),'migrations'));var _0x55779d=[];for(var _0xb8eaaa=0x0;_0xb8eaaa<_0x24b86b[_0x422b('0x27')];_0xb8eaaa++){var _0x1a73c6=_0x24b86b[_0xb8eaaa]['replace'](_0x422b('0x28'),'');if(compareVersions(module[_0x422b('0xe')]['version'],_0x1a73c6)===-0x1){_0x55779d[_0x422b('0x29')](_0x1a73c6);}}if(_0x55779d[_0x422b('0x27')]){var _0x3597d1=_0x55779d[_0x422b('0x2a')](compareVersions);var _0x402fea=new Umzug({'storage':_0x422b('0x2b'),'storageOptions':{'model':db[_0x422b('0x2c')],'modelName':_0x422b('0x2c'),'columnName':_0x422b('0x4')},'migrations':{'params':[db[_0x422b('0x2b')][_0x422b('0x2d')](),db[_0x422b('0x2b')]['constructor'],function(){throw new Error(_0x422b('0x2e'));}],'path':path[_0x422b('0x25')](config['root'],_0x422b('0x26'),_0x422b('0x23')),'pattern':/\.js$/}});_0x402fea['up']({'migrations':_[_0x422b('0x2f')](_0x3597d1,function(_0x107b1f){return _0x107b1f+_0x422b('0x28');})})[_0x422b('0x21')](function(){return _0xedfad[_0x422b('0x13')](0xc8)[_0x422b('0x14')]({'output':_0x422b('0x30')+module[_0x422b('0xe')]['version']+_0x422b('0x31')+_[_0x422b('0x32')](_0x3597d1),'migrations':_[_0x422b('0x25')](_0x3597d1)});})[_0x422b('0x33')](function(_0x27254c){if(_0x27254c instanceof db[_0x422b('0x2b')][_0x422b('0x34')]){return _0xedfad[_0x422b('0x13')](0xc8)[_0x422b('0x14')]({'output':_0x422b('0x35')});}else{return _0xedfad['status'](0x1f4)[_0x422b('0x14')](_0x27254c);}});}else{return _0xedfad[_0x422b('0x13')](0xc8)[_0x422b('0x14')]({'output':_0x422b('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 276e997..4ab7d0c 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x17b51e,_0x55b509){var _0x31de9a=function(_0x1c13c5){while(--_0x1c13c5){_0x17b51e['push'](_0x17b51e['shift']());}};_0x31de9a(++_0x55b509);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x196ddc,_0x514491){var _0x5d15f2=function(_0x5bcf05){while(--_0x5bcf05){_0x196ddc['push'](_0x196ddc['shift']());}};_0x5d15f2(++_0x514491);}(_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('./voiceAgentReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index b9f524b..360f8e5 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 _0xdbf5=['BOOLEAN','exports','STRING','DATE','INTEGER'];(function(_0x1ded0f,_0x2c82a9){var _0x1ad47a=function(_0x5b745b){while(--_0x5b745b){_0x1ded0f['push'](_0x1ded0f['shift']());}};_0x1ad47a(++_0x2c82a9);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x453021,_0x1930ed){_0x453021=_0x453021-0x0;var _0x2a2624=_0xdbf5[_0x453021];return _0x2a2624;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5dbf('0x1')]},'calleridname':{'type':Sequelize[_0x5dbf('0x1')]},'queue':{'type':Sequelize[_0x5dbf('0x1')]},'interface':{'type':Sequelize[_0x5dbf('0x1')]},'membername':{'type':Sequelize[_0x5dbf('0x1')]},'agentcalledAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentconnectAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentdumpAt':{'type':Sequelize[_0x5dbf('0x2')]},'holdtime':{'type':Sequelize[_0x5dbf('0x3')]},'agentcomplete':{'type':Sequelize[_0x5dbf('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x5dbf('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5dbf('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5dbf('0x3')]},'reason':{'type':Sequelize[_0x5dbf('0x1')]},'lastevent':{'type':Sequelize[_0x5dbf('0x1')]},'channel':{'type':Sequelize[_0x5dbf('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x5dbf('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5dbf('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5dbf('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x5dbf('0x1')]},'destchannelstate':{'type':Sequelize[_0x5dbf('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5dbf('0x1')]},'destcalleridnum':{'type':Sequelize[_0x5dbf('0x1')]},'destcalleridname':{'type':Sequelize[_0x5dbf('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5dbf('0x1')]},'destaccountcode':{'type':Sequelize[_0x5dbf('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x5dbf('0x1')]},'destpriority':{'type':Sequelize[_0x5dbf('0x1')]},'destuniqueid':{'type':Sequelize[_0x5dbf('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x5dbf('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x5dbf('0x1')]},'transfer':{'type':Sequelize[_0x5dbf('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5dbf('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x5dbf('0x1')]},'agententerreason':{'type':Sequelize[_0x5dbf('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4819=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4819,0xcd));var _0x9481=function(_0x5c7ff5,_0x50506a){_0x5c7ff5=_0x5c7ff5-0x0;var _0x29824c=_0x4819[_0x5c7ff5];return _0x29824c;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'type':{'type':Sequelize[_0x9481('0x1')]},'uniqueid':{'type':Sequelize[_0x9481('0x1')]},'calleridnum':{'type':Sequelize[_0x9481('0x1')]},'calleridname':{'type':Sequelize[_0x9481('0x1')]},'queue':{'type':Sequelize[_0x9481('0x1')]},'interface':{'type':Sequelize[_0x9481('0x1')]},'membername':{'type':Sequelize[_0x9481('0x1')]},'agentcalledAt':{'type':Sequelize[_0x9481('0x2')]},'agentconnectAt':{'type':Sequelize[_0x9481('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x9481('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9481('0x4')]},'agentacw':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x9481('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9481('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x9481('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9481('0x1')]},'connectedlinename':{'type':Sequelize[_0x9481('0x1')]},'language':{'type':Sequelize[_0x9481('0x1')]},'accountcode':{'type':Sequelize[_0x9481('0x1')]},'context':{'type':Sequelize[_0x9481('0x1')]},'exten':{'type':Sequelize[_0x9481('0x1')]},'priority':{'type':Sequelize[_0x9481('0x1')]},'destchannel':{'type':Sequelize[_0x9481('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x9481('0x1')]},'destcalleridname':{'type':Sequelize[_0x9481('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x9481('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x9481('0x1')]},'destlanguage':{'type':Sequelize[_0x9481('0x1')]},'destaccountcode':{'type':Sequelize[_0x9481('0x1')]},'destcontext':{'type':Sequelize[_0x9481('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x9481('0x1')]},'destuniqueid':{'type':Sequelize[_0x9481('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x9481('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9481('0x1')],'comment':_0x9481('0x5')},'transferexten':{'type':Sequelize[_0x9481('0x1')]},'transferuniqueid':{'type':Sequelize[_0x9481('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 6dc5ea0..43648f4 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 _0xfb82=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceAgentReport','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','show','params','rawAttributes','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x1d5e93,_0x20a7bf){var _0x13da05=function(_0x4ea4ac){while(--_0x4ea4ac){_0x1d5e93['push'](_0x1d5e93['shift']());}};_0x13da05(++_0x20a7bf);}(_0xfb82,0x17f));var _0x2fb8=function(_0x2b283a,_0xe621c1){_0x2b283a=_0x2b283a-0x0;var _0x20157c=_0xfb82[_0x2b283a];return _0x20157c;};'use strict';var emlformat=require(_0x2fb8('0x0'));var rimraf=require(_0x2fb8('0x1'));var zipdir=require(_0x2fb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fb8('0x3'));var moment=require(_0x2fb8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2fb8('0x5'));var util=require(_0x2fb8('0x6'));var path=require(_0x2fb8('0x7'));var sox=require(_0x2fb8('0x8'));var csv=require(_0x2fb8('0x9'));var ejs=require(_0x2fb8('0xa'));var fs=require('fs');var fs_extra=require(_0x2fb8('0xb'));var _=require(_0x2fb8('0xc'));var squel=require(_0x2fb8('0xd'));var crypto=require(_0x2fb8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2fb8('0xf'));var toCsv=require(_0x2fb8('0x9'));var querystring=require(_0x2fb8('0x10'));var Papa=require(_0x2fb8('0x11'));var Redis=require(_0x2fb8('0x12'));var authService=require(_0x2fb8('0x13'));var qs=require(_0x2fb8('0x14'));var as=require(_0x2fb8('0x15'));var hardwareService=require(_0x2fb8('0x16'));var logger=require(_0x2fb8('0x17'))(_0x2fb8('0x18'));var utils=require('../../config/utils');var config=require(_0x2fb8('0x19'));var licenseUtil=require(_0x2fb8('0x1a'));var db=require(_0x2fb8('0x1b'))['db'];function respondWithStatusCode(_0xab96fc,_0x54cc1d){_0x54cc1d=_0x54cc1d||0xcc;return function(_0x58d8ff){if(_0x58d8ff){return _0xab96fc[_0x2fb8('0x1c')](_0x54cc1d);}return _0xab96fc['status'](_0x54cc1d)[_0x2fb8('0x1d')]();};}function respondWithResult(_0x4e70f9,_0x5cb3ec){_0x5cb3ec=_0x5cb3ec||0xc8;return function(_0x222e0d){if(_0x222e0d){return _0x4e70f9[_0x2fb8('0x1e')](_0x5cb3ec)['json'](_0x222e0d);}};}function respondWithFilteredResult(_0x59f271,_0x205dd8){return function(_0x392d31){if(_0x392d31){var _0x3fa923=typeof _0x205dd8[_0x2fb8('0x1f')]==='undefined'&&typeof _0x205dd8[_0x2fb8('0x20')]===_0x2fb8('0x21');var _0x48296c=_0x392d31[_0x2fb8('0x22')];var _0x40d128=_0x3fa923?0x0:_0x205dd8[_0x2fb8('0x1f')];var _0x524c14=_0x3fa923?_0x392d31['count']:_0x205dd8[_0x2fb8('0x1f')]+_0x205dd8[_0x2fb8('0x20')];var _0x428292;if(_0x524c14>=_0x48296c){_0x524c14=_0x48296c;_0x428292=0xc8;}else{_0x428292=0xce;}_0x59f271[_0x2fb8('0x1e')](_0x428292);return _0x59f271['set'](_0x2fb8('0x23'),_0x40d128+'-'+_0x524c14+'/'+_0x48296c)[_0x2fb8('0x24')](_0x392d31);}return null;};}function patchUpdates(_0x1aa17e){return function(_0x18f5ed){try{jsonpatch[_0x2fb8('0x25')](_0x18f5ed,_0x1aa17e,!![]);}catch(_0x5ea296){return BPromise[_0x2fb8('0x26')](_0x5ea296);}return _0x18f5ed[_0x2fb8('0x27')]();};}function saveUpdates(_0x3890f3,_0x564fb3){return function(_0x4a4576){if(_0x4a4576){return _0x4a4576[_0x2fb8('0x28')](_0x3890f3)[_0x2fb8('0x29')](function(_0x1ea35b){return _0x1ea35b;});}return null;};}function removeEntity(_0x2f8cc9,_0x475883){return function(_0x4d6a94){if(_0x4d6a94){return _0x4d6a94[_0x2fb8('0x2a')]()[_0x2fb8('0x29')](function(){_0x2f8cc9[_0x2fb8('0x1e')](0xcc)[_0x2fb8('0x1d')]();});}};}function handleEntityNotFound(_0x3bfc46,_0x119445){return function(_0x2babf4){if(!_0x2babf4){_0x3bfc46['sendStatus'](0x194);}return _0x2babf4;};}function handleError(_0x42143a,_0x550787){_0x550787=_0x550787||0x1f4;return function(_0x3bee6c){logger[_0x2fb8('0x2b')](_0x3bee6c[_0x2fb8('0x2c')]);if(_0x3bee6c[_0x2fb8('0x2d')]){delete _0x3bee6c[_0x2fb8('0x2d')];}_0x42143a[_0x2fb8('0x1e')](_0x550787)[_0x2fb8('0x2e')](_0x3bee6c);};}exports[_0x2fb8('0x2f')]=function(_0x4f9adf,_0xc644b7){var _0x1fcd42={},_0x245078={},_0x462937={'count':0x0,'rows':[]};var _0x3ddafb=_[_0x2fb8('0x30')](db[_0x2fb8('0x31')]['rawAttributes'],function(_0x50d06c){return{'name':_0x50d06c[_0x2fb8('0x32')],'type':_0x50d06c[_0x2fb8('0x33')]['key']};});_0x245078['model']=_[_0x2fb8('0x30')](_0x3ddafb,'name');_0x245078['query']=_[_0x2fb8('0x34')](_0x4f9adf[_0x2fb8('0x35')]);_0x245078[_0x2fb8('0x36')]=_[_0x2fb8('0x37')](_0x245078[_0x2fb8('0x38')],_0x245078[_0x2fb8('0x35')]);_0x1fcd42[_0x2fb8('0x39')]=_[_0x2fb8('0x37')](_0x245078['model'],qs['fields'](_0x4f9adf[_0x2fb8('0x35')][_0x2fb8('0x3a')]));_0x1fcd42[_0x2fb8('0x39')]=_0x1fcd42[_0x2fb8('0x39')][_0x2fb8('0x3b')]?_0x1fcd42[_0x2fb8('0x39')]:_0x245078[_0x2fb8('0x38')];if(!_0x4f9adf['query'][_0x2fb8('0x3c')](_0x2fb8('0x3d'))){_0x1fcd42[_0x2fb8('0x20')]=qs[_0x2fb8('0x20')](_0x4f9adf[_0x2fb8('0x35')][_0x2fb8('0x20')]);_0x1fcd42[_0x2fb8('0x1f')]=qs['offset'](_0x4f9adf[_0x2fb8('0x35')][_0x2fb8('0x1f')]);}_0x1fcd42[_0x2fb8('0x3e')]=qs['sort'](_0x4f9adf[_0x2fb8('0x35')][_0x2fb8('0x3f')]);_0x1fcd42[_0x2fb8('0x40')]=qs[_0x2fb8('0x36')](_[_0x2fb8('0x41')](_0x4f9adf['query'],_0x245078[_0x2fb8('0x36')]),_0x3ddafb);if(_0x4f9adf[_0x2fb8('0x35')]['filter']){_0x1fcd42['where']=_[_0x2fb8('0x42')](_0x1fcd42[_0x2fb8('0x40')],{'$or':_[_0x2fb8('0x30')](_0x3ddafb,function(_0x566618){if(_0x566618[_0x2fb8('0x33')]!=='VIRTUAL'){var _0x3e82c2={};_0x3e82c2[_0x566618[_0x2fb8('0x2d')]]={'$like':'%'+_0x4f9adf[_0x2fb8('0x35')][_0x2fb8('0x43')]+'%'};return _0x3e82c2;}})});}_0x1fcd42=_[_0x2fb8('0x42')]({},_0x1fcd42,_0x4f9adf[_0x2fb8('0x44')]);var _0x50dea4={'where':_0x1fcd42['where']};return db[_0x2fb8('0x31')][_0x2fb8('0x22')](_0x50dea4)[_0x2fb8('0x29')](function(_0x3d6e61){_0x462937[_0x2fb8('0x22')]=_0x3d6e61;if(_0x4f9adf[_0x2fb8('0x35')]['includeAll']){_0x1fcd42[_0x2fb8('0x45')]=[{'all':!![]}];}return db[_0x2fb8('0x31')][_0x2fb8('0x46')](_0x1fcd42);})[_0x2fb8('0x29')](function(_0x1585c8){_0x462937['rows']=_0x1585c8;return _0x462937;})['then'](respondWithFilteredResult(_0xc644b7,_0x1fcd42))['catch'](handleError(_0xc644b7,null));};exports[_0x2fb8('0x47')]=function(_0x5ba17a,_0x38b3c4){var _0x48700c={'raw':![],'where':{'id':_0x5ba17a[_0x2fb8('0x48')]['id']}},_0x381bb9={};_0x381bb9[_0x2fb8('0x38')]=_[_0x2fb8('0x34')](db['VoiceAgentReport'][_0x2fb8('0x49')]);_0x381bb9[_0x2fb8('0x35')]=_['keys'](_0x5ba17a[_0x2fb8('0x35')]);_0x381bb9[_0x2fb8('0x36')]=_[_0x2fb8('0x37')](_0x381bb9['model'],_0x381bb9[_0x2fb8('0x35')]);_0x48700c[_0x2fb8('0x39')]=_['intersection'](_0x381bb9[_0x2fb8('0x38')],qs[_0x2fb8('0x3a')](_0x5ba17a[_0x2fb8('0x35')][_0x2fb8('0x3a')]));_0x48700c[_0x2fb8('0x39')]=_0x48700c[_0x2fb8('0x39')][_0x2fb8('0x3b')]?_0x48700c['attributes']:_0x381bb9[_0x2fb8('0x38')];if(_0x5ba17a['query'][_0x2fb8('0x4a')]){_0x48700c[_0x2fb8('0x45')]=[{'all':!![]}];}_0x48700c=_[_0x2fb8('0x42')]({},_0x48700c,_0x5ba17a['options']);return db[_0x2fb8('0x31')][_0x2fb8('0x4b')](_0x48700c)[_0x2fb8('0x29')](handleEntityNotFound(_0x38b3c4,null))[_0x2fb8('0x29')](respondWithResult(_0x38b3c4,null))[_0x2fb8('0x4c')](handleError(_0x38b3c4,null));};exports[_0x2fb8('0x4d')]=function(_0x139190,_0x321520){return db[_0x2fb8('0x31')][_0x2fb8('0x4d')](_0x139190[_0x2fb8('0x4e')],{})[_0x2fb8('0x29')](respondWithResult(_0x321520,0xc9))[_0x2fb8('0x4c')](handleError(_0x321520,null));};exports[_0x2fb8('0x28')]=function(_0x1f0d7a,_0x166090){if(_0x1f0d7a[_0x2fb8('0x4e')]['id']){delete _0x1f0d7a['body']['id'];}return db[_0x2fb8('0x31')][_0x2fb8('0x4b')]({'where':{'id':_0x1f0d7a[_0x2fb8('0x48')]['id']}})[_0x2fb8('0x29')](handleEntityNotFound(_0x166090,null))['then'](saveUpdates(_0x1f0d7a[_0x2fb8('0x4e')],null))[_0x2fb8('0x29')](respondWithResult(_0x166090,null))['catch'](handleError(_0x166090,null));};exports[_0x2fb8('0x2a')]=function(_0x5d7f08,_0xa1e62a){return db[_0x2fb8('0x31')][_0x2fb8('0x4b')]({'where':{'id':_0x5d7f08[_0x2fb8('0x48')]['id']}})[_0x2fb8('0x29')](handleEntityNotFound(_0xa1e62a,null))[_0x2fb8('0x29')](removeEntity(_0xa1e62a,null))['catch'](handleError(_0xa1e62a,null));};exports['describe']=function(_0x6b13c2,_0x598355){return db[_0x2fb8('0x31')][_0x2fb8('0x4f')]()[_0x2fb8('0x29')](respondWithResult(_0x598355,null))['catch'](handleError(_0x598355,null));}; \ No newline at end of file +var _0x4944=['map','VoiceAgentReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','params','keys','includeAll','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','then','stack','name','send','index'];(function(_0x855231,_0x519018){var _0x14af41=function(_0x3e1308){while(--_0x3e1308){_0x855231['push'](_0x855231['shift']());}};_0x14af41(++_0x519018);}(_0x4944,0x6d));var _0x4494=function(_0x37fa51,_0x57c7cf){_0x37fa51=_0x37fa51-0x0;var _0x32cf77=_0x4944[_0x37fa51];return _0x32cf77;};'use strict';var emlformat=require(_0x4494('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4494('0x1'));var jsonpatch=require(_0x4494('0x2'));var rp=require(_0x4494('0x3'));var moment=require(_0x4494('0x4'));var BPromise=require(_0x4494('0x5'));var Mustache=require('mustache');var util=require(_0x4494('0x6'));var path=require('path');var sox=require(_0x4494('0x7'));var csv=require(_0x4494('0x8'));var ejs=require(_0x4494('0x9'));var fs=require('fs');var fs_extra=require(_0x4494('0xa'));var _=require(_0x4494('0xb'));var squel=require(_0x4494('0xc'));var crypto=require(_0x4494('0xd'));var jsforce=require(_0x4494('0xe'));var deskjs=require(_0x4494('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4494('0x10'));var Papa=require(_0x4494('0x11'));var Redis=require(_0x4494('0x12'));var authService=require(_0x4494('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4494('0x14'));var logger=require(_0x4494('0x15'))(_0x4494('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4494('0x17'));var db=require(_0x4494('0x18'))['db'];function respondWithStatusCode(_0x221a1d,_0x1c9750){_0x1c9750=_0x1c9750||0xcc;return function(_0x40ee8d){if(_0x40ee8d){return _0x221a1d[_0x4494('0x19')](_0x1c9750);}return _0x221a1d['status'](_0x1c9750)[_0x4494('0x1a')]();};}function respondWithResult(_0x2325f4,_0x45825c){_0x45825c=_0x45825c||0xc8;return function(_0x259e03){if(_0x259e03){return _0x2325f4[_0x4494('0x1b')](_0x45825c)[_0x4494('0x1c')](_0x259e03);}};}function respondWithFilteredResult(_0x3847d6,_0x53fed5){return function(_0x2caa38){if(_0x2caa38){var _0x5a0985=typeof _0x53fed5['offset']===_0x4494('0x1d')&&typeof _0x53fed5[_0x4494('0x1e')]==='undefined';var _0x49350a=_0x2caa38[_0x4494('0x1f')];var _0x574fbb=_0x5a0985?0x0:_0x53fed5[_0x4494('0x20')];var _0x42880b=_0x5a0985?_0x2caa38['count']:_0x53fed5[_0x4494('0x20')]+_0x53fed5['limit'];var _0x37d435;if(_0x42880b>=_0x49350a){_0x42880b=_0x49350a;_0x37d435=0xc8;}else{_0x37d435=0xce;}_0x3847d6[_0x4494('0x1b')](_0x37d435);return _0x3847d6['set']('Content-Range',_0x574fbb+'-'+_0x42880b+'/'+_0x49350a)[_0x4494('0x1c')](_0x2caa38);}return null;};}function patchUpdates(_0x1768c3){return function(_0x17a2bf){try{jsonpatch[_0x4494('0x21')](_0x17a2bf,_0x1768c3,!![]);}catch(_0x194577){return BPromise[_0x4494('0x22')](_0x194577);}return _0x17a2bf[_0x4494('0x23')]();};}function saveUpdates(_0xae958d,_0x4cd309){return function(_0x4f427a){if(_0x4f427a){return _0x4f427a['update'](_0xae958d)['then'](function(_0x197da5){return _0x197da5;});}return null;};}function removeEntity(_0x8b6c21,_0x1b3630){return function(_0x470b2f){if(_0x470b2f){return _0x470b2f['destroy']()[_0x4494('0x24')](function(){_0x8b6c21[_0x4494('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10b231,_0x115520){return function(_0x87d98){if(!_0x87d98){_0x10b231['sendStatus'](0x194);}return _0x87d98;};}function handleError(_0xfc1631,_0x5926fc){_0x5926fc=_0x5926fc||0x1f4;return function(_0x3af50b){logger['error'](_0x3af50b[_0x4494('0x25')]);if(_0x3af50b[_0x4494('0x26')]){delete _0x3af50b[_0x4494('0x26')];}_0xfc1631['status'](_0x5926fc)[_0x4494('0x27')](_0x3af50b);};}exports[_0x4494('0x28')]=function(_0x491027,_0x268f14){var _0x303321={},_0x3efe5d={},_0x57c34f={'count':0x0,'rows':[]};var _0x96cdbb=_[_0x4494('0x29')](db[_0x4494('0x2a')][_0x4494('0x2b')],function(_0x5a8a5b){return{'name':_0x5a8a5b[_0x4494('0x2c')],'type':_0x5a8a5b[_0x4494('0x2d')][_0x4494('0x2e')]};});_0x3efe5d['model']=_[_0x4494('0x29')](_0x96cdbb,_0x4494('0x26'));_0x3efe5d[_0x4494('0x2f')]=_['keys'](_0x491027[_0x4494('0x2f')]);_0x3efe5d[_0x4494('0x30')]=_[_0x4494('0x31')](_0x3efe5d[_0x4494('0x32')],_0x3efe5d[_0x4494('0x2f')]);_0x303321[_0x4494('0x33')]=_[_0x4494('0x31')](_0x3efe5d['model'],qs[_0x4494('0x34')](_0x491027[_0x4494('0x2f')][_0x4494('0x34')]));_0x303321[_0x4494('0x33')]=_0x303321[_0x4494('0x33')][_0x4494('0x35')]?_0x303321['attributes']:_0x3efe5d[_0x4494('0x32')];if(!_0x491027[_0x4494('0x2f')][_0x4494('0x36')](_0x4494('0x37'))){_0x303321[_0x4494('0x1e')]=qs['limit'](_0x491027[_0x4494('0x2f')][_0x4494('0x1e')]);_0x303321['offset']=qs[_0x4494('0x20')](_0x491027['query']['offset']);}_0x303321['order']=qs[_0x4494('0x38')](_0x491027[_0x4494('0x2f')][_0x4494('0x38')]);_0x303321['where']=qs['filters'](_[_0x4494('0x39')](_0x491027[_0x4494('0x2f')],_0x3efe5d[_0x4494('0x30')]),_0x96cdbb);if(_0x491027[_0x4494('0x2f')][_0x4494('0x3a')]){_0x303321[_0x4494('0x3b')]=_[_0x4494('0x3c')](_0x303321[_0x4494('0x3b')],{'$or':_[_0x4494('0x29')](_0x96cdbb,function(_0x2498bc){if(_0x2498bc[_0x4494('0x2d')]!==_0x4494('0x3d')){var _0x27d93f={};_0x27d93f[_0x2498bc['name']]={'$like':'%'+_0x491027[_0x4494('0x2f')][_0x4494('0x3a')]+'%'};return _0x27d93f;}})});}_0x303321=_[_0x4494('0x3c')]({},_0x303321,_0x491027[_0x4494('0x3e')]);var _0x20b267={'where':_0x303321[_0x4494('0x3b')]};return db[_0x4494('0x2a')][_0x4494('0x1f')](_0x20b267)[_0x4494('0x24')](function(_0x47f55c){_0x57c34f['count']=_0x47f55c;if(_0x491027[_0x4494('0x2f')]['includeAll']){_0x303321[_0x4494('0x3f')]=[{'all':!![]}];}return db[_0x4494('0x2a')][_0x4494('0x40')](_0x303321);})[_0x4494('0x24')](function(_0x18b713){_0x57c34f['rows']=_0x18b713;return _0x57c34f;})['then'](respondWithFilteredResult(_0x268f14,_0x303321))[_0x4494('0x41')](handleError(_0x268f14,null));};exports['show']=function(_0x3bba39,_0x2e6168){var _0x124d0a={'raw':![],'where':{'id':_0x3bba39[_0x4494('0x42')]['id']}},_0x2d10f4={};_0x2d10f4[_0x4494('0x32')]=_[_0x4494('0x43')](db['VoiceAgentReport'][_0x4494('0x2b')]);_0x2d10f4[_0x4494('0x2f')]=_['keys'](_0x3bba39[_0x4494('0x2f')]);_0x2d10f4[_0x4494('0x30')]=_[_0x4494('0x31')](_0x2d10f4['model'],_0x2d10f4[_0x4494('0x2f')]);_0x124d0a[_0x4494('0x33')]=_[_0x4494('0x31')](_0x2d10f4[_0x4494('0x32')],qs['fields'](_0x3bba39['query'][_0x4494('0x34')]));_0x124d0a[_0x4494('0x33')]=_0x124d0a[_0x4494('0x33')]['length']?_0x124d0a['attributes']:_0x2d10f4[_0x4494('0x32')];if(_0x3bba39[_0x4494('0x2f')][_0x4494('0x44')]){_0x124d0a['include']=[{'all':!![]}];}_0x124d0a=_[_0x4494('0x3c')]({},_0x124d0a,_0x3bba39[_0x4494('0x3e')]);return db['VoiceAgentReport'][_0x4494('0x45')](_0x124d0a)[_0x4494('0x24')](handleEntityNotFound(_0x2e6168,null))[_0x4494('0x24')](respondWithResult(_0x2e6168,null))[_0x4494('0x41')](handleError(_0x2e6168,null));};exports[_0x4494('0x46')]=function(_0x4f9eb9,_0x802d47){return db[_0x4494('0x2a')][_0x4494('0x46')](_0x4f9eb9[_0x4494('0x47')],{})[_0x4494('0x24')](respondWithResult(_0x802d47,0xc9))[_0x4494('0x41')](handleError(_0x802d47,null));};exports[_0x4494('0x48')]=function(_0x904f3,_0x102010){if(_0x904f3[_0x4494('0x47')]['id']){delete _0x904f3['body']['id'];}return db[_0x4494('0x2a')]['find']({'where':{'id':_0x904f3[_0x4494('0x42')]['id']}})[_0x4494('0x24')](handleEntityNotFound(_0x102010,null))[_0x4494('0x24')](saveUpdates(_0x904f3[_0x4494('0x47')],null))[_0x4494('0x24')](respondWithResult(_0x102010,null))['catch'](handleError(_0x102010,null));};exports[_0x4494('0x49')]=function(_0x4eb660,_0x5e3294){return db['VoiceAgentReport']['find']({'where':{'id':_0x4eb660['params']['id']}})[_0x4494('0x24')](handleEntityNotFound(_0x5e3294,null))[_0x4494('0x24')](removeEntity(_0x5e3294,null))[_0x4494('0x41')](handleError(_0x5e3294,null));};exports[_0x4494('0x4a')]=function(_0x1b76a4,_0x2a82c5){return db[_0x4494('0x2a')]['describe']()['then'](respondWithResult(_0x2a82c5,null))['catch'](handleError(_0x2a82c5,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index da7f3b6..7ac43c4 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 _0x6565=['report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','VoiceAgentReport'];(function(_0x1c63dd,_0x197f28){var _0x3517a7=function(_0x50eb5b){while(--_0x50eb5b){_0x1c63dd['push'](_0x1c63dd['shift']());}};_0x3517a7(++_0x197f28);}(_0x6565,0x115));var _0x5656=function(_0xf97eb0,_0x1578b7){_0xf97eb0=_0xf97eb0-0x0;var _0xea70f4=_0x6565[_0xf97eb0];return _0xea70f4;};'use strict';var _=require(_0x5656('0x0'));var util=require(_0x5656('0x1'));var logger=require(_0x5656('0x2'))(_0x5656('0x3'));var moment=require(_0x5656('0x4'));var BPromise=require('bluebird');var rp=require(_0x5656('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5656('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0x5656('0x7')]=function(_0x434d3c,_0xba3606){return _0x434d3c['define'](_0x5656('0x8'),attributes,{'tableName':_0x5656('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x5656('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd324=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid'];(function(_0x1704d6,_0x2c4c8d){var _0x1651a6=function(_0x46c435){while(--_0x46c435){_0x1704d6['push'](_0x1704d6['shift']());}};_0x1651a6(++_0x2c4c8d);}(_0xd324,0xa5));var _0x4d32=function(_0x8b1a5e,_0x2744eb){_0x8b1a5e=_0x8b1a5e-0x0;var _0x1146b1=_0xd324[_0x8b1a5e];return _0x1146b1;};'use strict';var _=require(_0x4d32('0x0'));var util=require(_0x4d32('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4d32('0x2'));var BPromise=require(_0x4d32('0x3'));var rp=require(_0x4d32('0x4'));var fs=require('fs');var path=require(_0x4d32('0x5'));var rimraf=require(_0x4d32('0x6'));var config=require(_0x4d32('0x7'));var attributes=require(_0x4d32('0x8'));module[_0x4d32('0x9')]=function(_0x5dfc92,_0x44de96){return _0x5dfc92[_0x4d32('0xa')](_0x4d32('0xb'),attributes,{'tableName':_0x4d32('0xc'),'paranoid':![],'indexes':[{'fields':[_0x4d32('0xd'),_0x4d32('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 10802ce..62de411 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 _0xee88=['limit','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','attributes'];(function(_0x3859fb,_0x316c6d){var _0x1d30f6=function(_0x3e7664){while(--_0x3e7664){_0x3859fb['push'](_0x3859fb['shift']());}};_0x1d30f6(++_0x316c6d);}(_0xee88,0x1a1));var _0x8ee8=function(_0x59e8fc,_0x1452d8){_0x59e8fc=_0x59e8fc-0x0;var _0x443a83=_0xee88[_0x59e8fc];return _0x443a83;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8ee8('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8ee8('0x1'));var logger=require(_0x8ee8('0x2'))(_0x8ee8('0x3'));var config=require(_0x8ee8('0x4'));var jayson=require(_0x8ee8('0x5'));var client=jayson[_0x8ee8('0x6')][_0x8ee8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1508a4,_0x30e1d9,_0xd3e985){return new BPromise(function(_0x59c9e9,_0x4d9dc3){return client[_0x8ee8('0x8')](_0x1508a4,_0xd3e985)[_0x8ee8('0x9')](function(_0x8d420c){logger[_0x8ee8('0xa')](_0x8ee8('0xb'),_0x30e1d9,_0x8ee8('0xc'));logger[_0x8ee8('0xd')](_0x8ee8('0xe'),_0x30e1d9,_0x8ee8('0xc'),JSON[_0x8ee8('0xf')](_0x8d420c));if(_0x8d420c['error']){if(_0x8d420c[_0x8ee8('0x10')][_0x8ee8('0x11')]===0x1f4){logger[_0x8ee8('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x30e1d9,_0x8d420c[_0x8ee8('0x10')][_0x8ee8('0x12')]);return _0x4d9dc3(_0x8d420c['error'][_0x8ee8('0x12')]);}logger[_0x8ee8('0x10')](_0x8ee8('0xb'),_0x30e1d9,_0x8d420c[_0x8ee8('0x10')][_0x8ee8('0x12')]);return _0x59c9e9(_0x8d420c[_0x8ee8('0x10')][_0x8ee8('0x12')]);}else{logger[_0x8ee8('0xa')](_0x8ee8('0xb'),_0x30e1d9,_0x8ee8('0xc'));_0x59c9e9(_0x8d420c[_0x8ee8('0x13')][_0x8ee8('0x12')]);}})[_0x8ee8('0x14')](function(_0x45e357){logger[_0x8ee8('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x30e1d9,_0x45e357);_0x4d9dc3(_0x45e357);});});}exports[_0x8ee8('0x15')]=function(_0x56895c){var _0x331873=this;return new Promise(function(_0xc692a3,_0x40f9c0){return db[_0x8ee8('0x16')][_0x8ee8('0x17')](_0x56895c[_0x8ee8('0x18')],{'raw':_0x56895c[_0x8ee8('0x19')]?_0x56895c[_0x8ee8('0x19')][_0x8ee8('0x1a')]===undefined?!![]:![]:!![]})[_0x8ee8('0x9')](function(_0x3c9c40){logger['info'](_0x8ee8('0x15'),_0x56895c);logger[_0x8ee8('0xd')](_0x8ee8('0x15'),_0x56895c,JSON[_0x8ee8('0xf')](_0x3c9c40));_0xc692a3(_0x3c9c40);})[_0x8ee8('0x14')](function(_0x341a81){logger[_0x8ee8('0x10')](_0x8ee8('0x15'),_0x341a81[_0x8ee8('0x12')],_0x56895c);_0x40f9c0(_0x331873[_0x8ee8('0x10')](0x1f4,_0x341a81['message']));});});};exports[_0x8ee8('0x1b')]=function(_0x5a4a2b){var _0x35b816=this;return new Promise(function(_0x292dd6,_0x49d96f){return db[_0x8ee8('0x16')][_0x8ee8('0x1c')](_0x5a4a2b[_0x8ee8('0x18')],{'raw':_0x5a4a2b[_0x8ee8('0x19')]?_0x5a4a2b[_0x8ee8('0x19')][_0x8ee8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a4a2b[_0x8ee8('0x19')]?_0x5a4a2b[_0x8ee8('0x19')][_0x8ee8('0x1d')]||null:null,'attributes':_0x5a4a2b['options']?_0x5a4a2b[_0x8ee8('0x19')][_0x8ee8('0x1e')]||null:null,'limit':_0x5a4a2b[_0x8ee8('0x19')]?_0x5a4a2b[_0x8ee8('0x19')][_0x8ee8('0x1f')]||null:null})[_0x8ee8('0x9')](function(_0x1a7bca){logger[_0x8ee8('0xa')](_0x8ee8('0x1b'),_0x5a4a2b);logger[_0x8ee8('0xd')]('UpdateVoiceAgentReport',_0x5a4a2b,JSON[_0x8ee8('0xf')](_0x1a7bca));_0x292dd6(_0x1a7bca);})[_0x8ee8('0x14')](function(_0x573d4f){logger[_0x8ee8('0x10')](_0x8ee8('0x1b'),_0x573d4f[_0x8ee8('0x12')],_0x5a4a2b);_0x49d96f(_0x35b816[_0x8ee8('0x10')](0x1f4,_0x573d4f['message']));});});}; \ No newline at end of file +var _0x8ee1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','UpdateVoiceAgentReport','update','raw','limit','util','bluebird','randomstring'];(function(_0x2c8823,_0x3fa601){var _0x543484=function(_0x5abada){while(--_0x5abada){_0x2c8823['push'](_0x2c8823['shift']());}};_0x543484(++_0x3fa601);}(_0x8ee1,0xcf));var _0x18ee=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0x8ee1[_0x380307];return _0x9ea14b;};'use strict';var _=require('lodash');var util=require(_0x18ee('0x0'));var moment=require('moment');var BPromise=require(_0x18ee('0x1'));var rs=require(_0x18ee('0x2'));var fs=require('fs');var Redis=require(_0x18ee('0x3'));var db=require(_0x18ee('0x4'))['db'];var utils=require(_0x18ee('0x5'));var logger=require(_0x18ee('0x6'))('rpc');var config=require(_0x18ee('0x7'));var jayson=require(_0x18ee('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x42140c,_0x2e5470,_0x48b5d3){return new BPromise(function(_0x5d0852,_0x3bf691){return client['request'](_0x42140c,_0x48b5d3)[_0x18ee('0x9')](function(_0x48d358){logger[_0x18ee('0xa')](_0x18ee('0xb'),_0x2e5470,_0x18ee('0xc'));logger[_0x18ee('0xd')](_0x18ee('0xe'),_0x2e5470,'request\x20sent',JSON[_0x18ee('0xf')](_0x48d358));if(_0x48d358[_0x18ee('0x10')]){if(_0x48d358[_0x18ee('0x10')][_0x18ee('0x11')]===0x1f4){logger[_0x18ee('0x10')](_0x18ee('0xb'),_0x2e5470,_0x48d358['error']['message']);return _0x3bf691(_0x48d358[_0x18ee('0x10')][_0x18ee('0x12')]);}logger[_0x18ee('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x2e5470,_0x48d358[_0x18ee('0x10')][_0x18ee('0x12')]);return _0x5d0852(_0x48d358[_0x18ee('0x10')][_0x18ee('0x12')]);}else{logger['info'](_0x18ee('0xb'),_0x2e5470,_0x18ee('0xc'));_0x5d0852(_0x48d358[_0x18ee('0x13')][_0x18ee('0x12')]);}})[_0x18ee('0x14')](function(_0x5e291e){logger['error'](_0x18ee('0xb'),_0x2e5470,_0x5e291e);_0x3bf691(_0x5e291e);});});}exports[_0x18ee('0x15')]=function(_0x31e51c){var _0x193555=this;return new Promise(function(_0x331a2a,_0x28323e){return db[_0x18ee('0x16')][_0x18ee('0x17')](_0x31e51c[_0x18ee('0x18')],{'raw':_0x31e51c[_0x18ee('0x19')]?_0x31e51c['options']['raw']===undefined?!![]:![]:!![]})[_0x18ee('0x9')](function(_0xfda5e4){logger[_0x18ee('0xa')](_0x18ee('0x15'),_0x31e51c);logger[_0x18ee('0xd')]('CreateVoiceAgentReport',_0x31e51c,JSON[_0x18ee('0xf')](_0xfda5e4));_0x331a2a(_0xfda5e4);})[_0x18ee('0x14')](function(_0x293b1e){logger[_0x18ee('0x10')](_0x18ee('0x15'),_0x293b1e['message'],_0x31e51c);_0x28323e(_0x193555[_0x18ee('0x10')](0x1f4,_0x293b1e['message']));});});};exports[_0x18ee('0x1a')]=function(_0x8e03a7){var _0x133b35=this;return new Promise(function(_0x307df2,_0x2da2bb){return db[_0x18ee('0x16')][_0x18ee('0x1b')](_0x8e03a7[_0x18ee('0x18')],{'raw':_0x8e03a7['options']?_0x8e03a7[_0x18ee('0x19')][_0x18ee('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8e03a7[_0x18ee('0x19')]?_0x8e03a7['options']['where']||null:null,'attributes':_0x8e03a7['options']?_0x8e03a7[_0x18ee('0x19')]['attributes']||null:null,'limit':_0x8e03a7[_0x18ee('0x19')]?_0x8e03a7[_0x18ee('0x19')][_0x18ee('0x1d')]||null:null})['then'](function(_0x513251){logger[_0x18ee('0xa')](_0x18ee('0x1a'),_0x8e03a7);logger['debug']('UpdateVoiceAgentReport',_0x8e03a7,JSON[_0x18ee('0xf')](_0x513251));_0x307df2(_0x513251);})['catch'](function(_0x1a4aba){logger[_0x18ee('0x10')]('UpdateVoiceAgentReport',_0x1a4aba[_0x18ee('0x12')],_0x8e03a7);_0x2da2bb(_0x133b35[_0x18ee('0x10')](0x1f4,_0x1a4aba[_0x18ee('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 0f9f425..2f951e1 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 1b5904c..fc609d2 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 _0x3831=['DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound','outbound-fax','TEXT'];(function(_0x2423d7,_0xe6ec57){var _0x151d17=function(_0x559e15){while(--_0x559e15){_0x2423d7['push'](_0x2423d7['shift']());}};_0x151d17(++_0xe6ec57);}(_0x3831,0x14c));var _0x1383=function(_0x5d6238,_0xe6992b){_0x5d6238=_0x5d6238-0x0;var _0x46ac6b=_0x3831[_0x5d6238];return _0x46ac6b;};'use strict';var Sequelize=require(_0x1383('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1383('0x1')]},'type':{'type':Sequelize[_0x1383('0x2')](_0x1383('0x3'),_0x1383('0x4'),_0x1383('0x5'),'inbound-fax',_0x1383('0x6'),'dialer')},'tag':{'type':Sequelize[_0x1383('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x1383('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1383('0x1')]},'destinationchannel':{'type':Sequelize[_0x1383('0x1')]},'lastapplication':{'type':Sequelize[_0x1383('0x1')]},'lastdata':{'type':Sequelize[_0x1383('0x7')]},'starttime':{'type':Sequelize[_0x1383('0x8')]},'systemanswertime':{'type':Sequelize[_0x1383('0x8')]},'answertime':{'type':Sequelize[_0x1383('0x8')]},'endtime':{'type':Sequelize[_0x1383('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x1383('0x9')]},'mohtime':{'type':Sequelize[_0x1383('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1383('0x1')]},'amaflags':{'type':Sequelize[_0x1383('0x1')]},'userfield':{'type':Sequelize[_0x1383('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x1383('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x1383('0x1')]},'note':{'type':Sequelize[_0x1383('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x1383('0x1')]}}; \ No newline at end of file +var _0xf072=['TEXT','DATE','INTEGER','sequelize','exports','STRING','inbound','outbound','inbound-fax','outbound-fax'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xf072,0x1cf));var _0x2f07=function(_0x52872a,_0x65faec){_0x52872a=_0x52872a-0x0;var _0x1a785a=_0xf072[_0x52872a];return _0x1a785a;};'use strict';var Sequelize=require(_0x2f07('0x0'));module[_0x2f07('0x1')]={'uniqueid':{'type':Sequelize[_0x2f07('0x2')]},'type':{'type':Sequelize['ENUM'](_0x2f07('0x3'),'internal',_0x2f07('0x4'),_0x2f07('0x5'),_0x2f07('0x6'),'dialer')},'tag':{'type':Sequelize[_0x2f07('0x2')]},'accountcode':{'type':Sequelize[_0x2f07('0x2')]},'source':{'type':Sequelize[_0x2f07('0x2')]},'destination':{'type':Sequelize[_0x2f07('0x2')]},'destinationcontext':{'type':Sequelize[_0x2f07('0x2')]},'callerid':{'type':Sequelize[_0x2f07('0x2')]},'channel':{'type':Sequelize[_0x2f07('0x2')]},'destinationchannel':{'type':Sequelize[_0x2f07('0x2')]},'lastapplication':{'type':Sequelize[_0x2f07('0x2')]},'lastdata':{'type':Sequelize[_0x2f07('0x7')]},'starttime':{'type':Sequelize[_0x2f07('0x8')]},'systemanswertime':{'type':Sequelize[_0x2f07('0x8')]},'answertime':{'type':Sequelize[_0x2f07('0x8')]},'endtime':{'type':Sequelize[_0x2f07('0x8')]},'duration':{'type':Sequelize[_0x2f07('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2f07('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2f07('0x2')]},'amaflags':{'type':Sequelize[_0x2f07('0x2')]},'userfield':{'type':Sequelize[_0x2f07('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x2f07('0x2')]},'note':{'type':Sequelize[_0x2f07('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x2f07('0x9')]},'sipcallid':{'type':Sequelize[_0x2f07('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 1cd13aa..0c1e325 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 _0x70e0=['rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','alias','User','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','destroy','describe','uniqueid','eml-format'];(function(_0x1ffd67,_0x1c18ba){var _0xce170f=function(_0x16cdb2){while(--_0x16cdb2){_0x1ffd67['push'](_0x1ffd67['shift']());}};_0xce170f(++_0x1c18ba);}(_0x70e0,0x17b));var _0x070e=function(_0x2aa62a,_0xdcb2f3){_0x2aa62a=_0x2aa62a-0x0;var _0x103260=_0x70e0[_0x2aa62a];return _0x103260;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={},_0x26373b={},_0x5e8326={'count':0x0,'rows':[]};var _0x282344=_[_0x070e('0x29')](db[_0x070e('0x2a')]['rawAttributes'],function(_0x5c5f0d){return{'name':_0x5c5f0d[_0x070e('0x2b')],'type':_0x5c5f0d[_0x070e('0x2c')][_0x070e('0x2d')]};});_0x26373b['model']=_[_0x070e('0x29')](_0x282344,_0x070e('0x26'));_0x26373b[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x43dd96['query']);_0x26373b['filters']=_['intersection'](_0x26373b['model'],_0x26373b[_0x070e('0x2e')]);_0x1a1892['attributes']=_[_0x070e('0x30')](_0x26373b[_0x070e('0x31')],qs['fields'](_0x43dd96['query'][_0x070e('0x32')]));_0x1a1892[_0x070e('0x33')]=_0x1a1892['attributes']['length']?_0x1a1892[_0x070e('0x33')]:_0x26373b[_0x070e('0x31')];if(!_0x43dd96[_0x070e('0x2e')][_0x070e('0x34')](_0x070e('0x35'))){_0x1a1892['limit']=qs['limit'](_0x43dd96[_0x070e('0x2e')][_0x070e('0x1e')]);_0x1a1892[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x43dd96[_0x070e('0x2e')]['offset']);}_0x1a1892[_0x070e('0x36')]=qs[_0x070e('0x37')](_0x43dd96['query'][_0x070e('0x37')]);_0x1a1892[_0x070e('0x38')]=qs['filters'](_['pick'](_0x43dd96['query'],_0x26373b[_0x070e('0x39')]),_0x282344);if(_0x43dd96[_0x070e('0x2e')][_0x070e('0x3a')]){_0x1a1892[_0x070e('0x38')]=_[_0x070e('0x3b')](_0x1a1892['where'],{'$or':_[_0x070e('0x29')](_0x282344,function(_0xa1bb20){if(_0xa1bb20[_0x070e('0x2c')]!=='VIRTUAL'){var _0x268c5d={};_0x268c5d[_0xa1bb20[_0x070e('0x26')]]={'$like':'%'+_0x43dd96[_0x070e('0x2e')]['filter']+'%'};return _0x268c5d;}})});}_0x1a1892=_[_0x070e('0x3b')]({},_0x1a1892,_0x43dd96[_0x070e('0x3c')]);var _0x4800a9={'where':_0x1a1892[_0x070e('0x38')]};return db['VoiceCallReport'][_0x070e('0x1d')](_0x4800a9)[_0x070e('0x23')](function(_0x3462d3){_0x5e8326[_0x070e('0x1d')]=_0x3462d3;if(_0x43dd96[_0x070e('0x2e')]['includeAll']){_0x1a1892[_0x070e('0x3d')]=[{'attributes':['id','name','fullname',_0x070e('0x3e')],'model':db[_0x070e('0x3f')],'as':_0x070e('0x3f')}];}return db['VoiceCallReport'][_0x070e('0x40')](_0x1a1892);})[_0x070e('0x23')](function(_0x556bf3){_0x5e8326[_0x070e('0x41')]=_0x556bf3;return _0x5e8326;})['then'](respondWithFilteredResult(_0x28d7f2,_0x1a1892))[_0x070e('0x42')](handleError(_0x28d7f2,null));};exports['show']=function(_0x544b53,_0x5d77d9){var _0x3feb83={'raw':!![],'where':{'id':_0x544b53[_0x070e('0x43')]['id']}},_0x926533={};_0x926533[_0x070e('0x31')]=_[_0x070e('0x2f')](db['VoiceCallReport'][_0x070e('0x44')]);_0x926533['query']=_[_0x070e('0x2f')](_0x544b53[_0x070e('0x2e')]);_0x926533[_0x070e('0x39')]=_['intersection'](_0x926533['model'],_0x926533[_0x070e('0x2e')]);_0x3feb83['attributes']=_[_0x070e('0x30')](_0x926533[_0x070e('0x31')],qs[_0x070e('0x32')](_0x544b53['query'][_0x070e('0x32')]));_0x3feb83[_0x070e('0x33')]=_0x3feb83['attributes']['length']?_0x3feb83[_0x070e('0x33')]:_0x926533[_0x070e('0x31')];if(_0x544b53[_0x070e('0x2e')][_0x070e('0x45')]){_0x3feb83[_0x070e('0x3d')]=[{'all':!![]}];}_0x3feb83=_['merge']({},_0x3feb83,_0x544b53[_0x070e('0x3c')]);return db[_0x070e('0x2a')][_0x070e('0x46')](_0x3feb83)[_0x070e('0x23')](handleEntityNotFound(_0x5d77d9,null))[_0x070e('0x23')](respondWithResult(_0x5d77d9,null))[_0x070e('0x42')](handleError(_0x5d77d9,null));};exports[_0x070e('0x47')]=function(_0x1b5374,_0xd67987){return db[_0x070e('0x2a')][_0x070e('0x47')](_0x1b5374[_0x070e('0x48')],{})[_0x070e('0x23')](respondWithResult(_0xd67987,0xc9))[_0x070e('0x42')](handleError(_0xd67987,null));};exports[_0x070e('0x49')]=function(_0x5e051a,_0x171621){return db[_0x070e('0x2a')][_0x070e('0x46')]({'where':{'id':_0x5e051a[_0x070e('0x43')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x171621,null))[_0x070e('0x23')](removeEntity(_0x171621,null))[_0x070e('0x42')](handleError(_0x171621,null));};exports[_0x070e('0x4a')]=function(_0x1c64d2,_0x5744c5){return db[_0x070e('0x2a')]['describe']()[_0x070e('0x23')](respondWithResult(_0x5744c5,null))[_0x070e('0x42')](handleError(_0x5744c5,null));};exports['update']=function(_0x991d23,_0x130a50){if(_0x991d23[_0x070e('0x48')][_0x070e('0x4b')]){delete _0x991d23[_0x070e('0x48')][_0x070e('0x4b')];}return db[_0x070e('0x2a')]['find']({'where':{'uniqueid':_0x991d23[_0x070e('0x43')]['id'],'UserId':{'$or':[null,_0x991d23['user']['id']]}}})['then'](handleEntityNotFound(_0x130a50,null))[_0x070e('0x23')](saveUpdates(_0x991d23[_0x070e('0x48')],null))[_0x070e('0x23')](respondWithResult(_0x130a50,null))[_0x070e('0x42')](handleError(_0x130a50,null));}; \ No newline at end of file +var _0xb43b=['reject','update','destroy','sendStatus','name','status','send','index','map','VoiceCallReport','rawAttributes','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','fullname','alias','User','findAll','then','catch','show','params','find','create','body','describe','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply'];(function(_0x305d32,_0x57b171){var _0x6aaab=function(_0x568ef5){while(--_0x568ef5){_0x305d32['push'](_0x305d32['shift']());}};_0x6aaab(++_0x57b171);}(_0xb43b,0x1b2));var _0xbb43=function(_0x25a1a6,_0x171e5d){_0x25a1a6=_0x25a1a6-0x0;var _0x3dcfd2=_0xb43b[_0x25a1a6];return _0x3dcfd2;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={},_0x539730={},_0x2ad6da={'count':0x0,'rows':[]};var _0x56fe33=_[_0xbb43('0x2a')](db[_0xbb43('0x2b')][_0xbb43('0x2c')],function(_0x1880cd){return{'name':_0x1880cd['fieldName'],'type':_0x1880cd[_0xbb43('0x2d')]['key']};});_0x539730['model']=_['map'](_0x56fe33,_0xbb43('0x26'));_0x539730['query']=_[_0xbb43('0x2e')](_0x40b04b[_0xbb43('0x2f')]);_0x539730[_0xbb43('0x30')]=_['intersection'](_0x539730[_0xbb43('0x31')],_0x539730[_0xbb43('0x2f')]);_0x473828[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x539730[_0xbb43('0x31')],qs[_0xbb43('0x34')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x34')]));_0x473828['attributes']=_0x473828[_0xbb43('0x32')][_0xbb43('0x35')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x31')];if(!_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x36')](_0xbb43('0x37'))){_0x473828[_0xbb43('0x1d')]=qs[_0xbb43('0x1d')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x1d')]);_0x473828[_0xbb43('0x1c')]=qs[_0xbb43('0x1c')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x1c')]);}_0x473828[_0xbb43('0x38')]=qs['sort'](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x39')]);_0x473828['where']=qs[_0xbb43('0x30')](_[_0xbb43('0x3a')](_0x40b04b[_0xbb43('0x2f')],_0x539730['filters']),_0x56fe33);if(_0x40b04b['query']['filter']){_0x473828[_0xbb43('0x3b')]=_[_0xbb43('0x3c')](_0x473828['where'],{'$or':_['map'](_0x56fe33,function(_0x2aa381){if(_0x2aa381[_0xbb43('0x2d')]!==_0xbb43('0x3d')){var _0x37afbb={};_0x37afbb[_0x2aa381[_0xbb43('0x26')]]={'$like':'%'+_0x40b04b['query'][_0xbb43('0x3e')]+'%'};return _0x37afbb;}})});}_0x473828=_[_0xbb43('0x3c')]({},_0x473828,_0x40b04b[_0xbb43('0x3f')]);var _0x3340aa={'where':_0x473828[_0xbb43('0x3b')]};return db['VoiceCallReport'][_0xbb43('0x1b')](_0x3340aa)['then'](function(_0x1c076f){_0x2ad6da[_0xbb43('0x1b')]=_0x1c076f;if(_0x40b04b['query'][_0xbb43('0x40')]){_0x473828['include']=[{'attributes':['id',_0xbb43('0x26'),_0xbb43('0x41'),_0xbb43('0x42')],'model':db[_0xbb43('0x43')],'as':'User'}];}return db[_0xbb43('0x2b')][_0xbb43('0x44')](_0x473828);})['then'](function(_0x3443f8){_0x2ad6da['rows']=_0x3443f8;return _0x2ad6da;})[_0xbb43('0x45')](respondWithFilteredResult(_0x21d386,_0x473828))[_0xbb43('0x46')](handleError(_0x21d386,null));};exports[_0xbb43('0x47')]=function(_0x14e57e,_0x37ffb7){var _0x1e762c={'raw':!![],'where':{'id':_0x14e57e[_0xbb43('0x48')]['id']}},_0x4bf8ed={};_0x4bf8ed['model']=_[_0xbb43('0x2e')](db[_0xbb43('0x2b')][_0xbb43('0x2c')]);_0x4bf8ed[_0xbb43('0x2f')]=_['keys'](_0x14e57e[_0xbb43('0x2f')]);_0x4bf8ed[_0xbb43('0x30')]=_[_0xbb43('0x33')](_0x4bf8ed[_0xbb43('0x31')],_0x4bf8ed[_0xbb43('0x2f')]);_0x1e762c[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x4bf8ed[_0xbb43('0x31')],qs['fields'](_0x14e57e[_0xbb43('0x2f')][_0xbb43('0x34')]));_0x1e762c['attributes']=_0x1e762c[_0xbb43('0x32')]['length']?_0x1e762c['attributes']:_0x4bf8ed['model'];if(_0x14e57e['query'][_0xbb43('0x40')]){_0x1e762c['include']=[{'all':!![]}];}_0x1e762c=_[_0xbb43('0x3c')]({},_0x1e762c,_0x14e57e['options']);return db[_0xbb43('0x2b')][_0xbb43('0x49')](_0x1e762c)[_0xbb43('0x45')](handleEntityNotFound(_0x37ffb7,null))['then'](respondWithResult(_0x37ffb7,null))[_0xbb43('0x46')](handleError(_0x37ffb7,null));};exports['create']=function(_0x3edc65,_0x2518bf){return db[_0xbb43('0x2b')][_0xbb43('0x4a')](_0x3edc65[_0xbb43('0x4b')],{})[_0xbb43('0x45')](respondWithResult(_0x2518bf,0xc9))[_0xbb43('0x46')](handleError(_0x2518bf,null));};exports['destroy']=function(_0x93f6e7,_0x26ea59){return db[_0xbb43('0x2b')][_0xbb43('0x49')]({'where':{'id':_0x93f6e7['params']['id']}})[_0xbb43('0x45')](handleEntityNotFound(_0x26ea59,null))[_0xbb43('0x45')](removeEntity(_0x26ea59,null))[_0xbb43('0x46')](handleError(_0x26ea59,null));};exports[_0xbb43('0x4c')]=function(_0x4b7712,_0x3206c0){return db[_0xbb43('0x2b')][_0xbb43('0x4c')]()['then'](respondWithResult(_0x3206c0,null))[_0xbb43('0x46')](handleError(_0x3206c0,null));};exports[_0xbb43('0x23')]=function(_0x73d4ce,_0x1dc40a){if(_0x73d4ce[_0xbb43('0x4b')]['uniqueid']){delete _0x73d4ce['body'][_0xbb43('0x4d')];}return db['VoiceCallReport'][_0xbb43('0x49')]({'where':{'uniqueid':_0x73d4ce[_0xbb43('0x48')]['id'],'UserId':{'$or':[null,_0x73d4ce['user']['id']]}}})[_0xbb43('0x45')](handleEntityNotFound(_0x1dc40a,null))[_0xbb43('0x45')](saveUpdates(_0x73d4ce[_0xbb43('0x4b')],null))[_0xbb43('0x45')](respondWithResult(_0x1dc40a,null))[_0xbb43('0x46')](handleError(_0x1dc40a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index aff3832..4c70ec7 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 _0xdaf7=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','path'];(function(_0xd839e7,_0x4209e9){var _0xc3cf23=function(_0x16ace2){while(--_0x16ace2){_0xd839e7['push'](_0xd839e7['shift']());}};_0xc3cf23(++_0x4209e9);}(_0xdaf7,0x1e9));var _0x7daf=function(_0x1cd407,_0x41b2ab){_0x1cd407=_0x1cd407-0x0;var _0x301944=_0xdaf7[_0x1cd407];return _0x301944;};'use strict';var _=require(_0x7daf('0x0'));var util=require(_0x7daf('0x1'));var logger=require(_0x7daf('0x2'))(_0x7daf('0x3'));var moment=require('moment');var BPromise=require(_0x7daf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7daf('0x5'));var rimraf=require(_0x7daf('0x6'));var config=require(_0x7daf('0x7'));var attributes=require(_0x7daf('0x8'));module[_0x7daf('0x9')]=function(_0x5829d1,_0x10a702){return _0x5829d1[_0x7daf('0xa')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xef3e=['path','rimraf','exports','define','uniqueid','lodash','util','moment','bluebird','request-promise'];(function(_0xc84da7,_0x3824aa){var _0x3e5a32=function(_0x503fb8){while(--_0x503fb8){_0xc84da7['push'](_0xc84da7['shift']());}};_0x3e5a32(++_0x3824aa);}(_0xef3e,0x87));var _0xeef3=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xef3e[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0xeef3('0x0'));var util=require(_0xeef3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeef3('0x2'));var BPromise=require(_0xeef3('0x3'));var rp=require(_0xeef3('0x4'));var fs=require('fs');var path=require(_0xeef3('0x5'));var rimraf=require(_0xeef3('0x6'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0xeef3('0x7')]=function(_0x52c48a,_0xb0af8){return _0x52c48a[_0xeef3('0x8')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xeef3('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c71c074..56cb2de 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 _0xd4a5=['client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','map','model','create','CreateVoiceCallReport','body','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x937aa9,_0x47613c){var _0x53a038=function(_0x45b3e1){while(--_0x45b3e1){_0x937aa9['push'](_0x937aa9['shift']());}};_0x53a038(++_0x47613c);}(_0xd4a5,0xab));var _0x5d4a=function(_0x2299b2,_0x2d9fcf){_0x2299b2=_0x2299b2-0x0;var _0x6a31c8=_0xd4a5[_0x2299b2];return _0x6a31c8;};'use strict';var _=require(_0x5d4a('0x0'));var util=require(_0x5d4a('0x1'));var moment=require(_0x5d4a('0x2'));var BPromise=require(_0x5d4a('0x3'));var rs=require(_0x5d4a('0x4'));var fs=require('fs');var Redis=require(_0x5d4a('0x5'));var db=require(_0x5d4a('0x6'))['db'];var utils=require(_0x5d4a('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5d4a('0x8'));var client=jayson[_0x5d4a('0x9')][_0x5d4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x285c85,_0x5c8697,_0x4762cb){return new BPromise(function(_0xd575dd,_0x46b627){return client[_0x5d4a('0xb')](_0x285c85,_0x4762cb)[_0x5d4a('0xc')](function(_0x4c4434){logger[_0x5d4a('0xd')](_0x5d4a('0xe'),_0x5c8697,_0x5d4a('0xf'));logger[_0x5d4a('0x10')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x5c8697,_0x5d4a('0xf'),JSON[_0x5d4a('0x11')](_0x4c4434));if(_0x4c4434['error']){if(_0x4c4434[_0x5d4a('0x12')][_0x5d4a('0x13')]===0x1f4){logger['error'](_0x5d4a('0xe'),_0x5c8697,_0x4c4434[_0x5d4a('0x12')][_0x5d4a('0x14')]);return _0x46b627(_0x4c4434[_0x5d4a('0x12')][_0x5d4a('0x14')]);}logger[_0x5d4a('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x5c8697,_0x4c4434[_0x5d4a('0x12')][_0x5d4a('0x14')]);return _0xd575dd(_0x4c4434['error']['message']);}else{logger[_0x5d4a('0xd')](_0x5d4a('0xe'),_0x5c8697,_0x5d4a('0xf'));_0xd575dd(_0x4c4434['result'][_0x5d4a('0x14')]);}})[_0x5d4a('0x15')](function(_0x3e2e05){logger['error'](_0x5d4a('0xe'),_0x5c8697,_0x3e2e05);_0x46b627(_0x3e2e05);});});}exports[_0x5d4a('0x16')]=function(_0x47e290){var _0x4216ff=this;return new Promise(function(_0x92b447,_0x58ced8){return db[_0x5d4a('0x17')][_0x5d4a('0x18')]({'raw':_0x47e290[_0x5d4a('0x19')]?_0x47e290[_0x5d4a('0x19')][_0x5d4a('0x1a')]===undefined?!![]:![]:!![],'where':_0x47e290[_0x5d4a('0x19')]?_0x47e290['options'][_0x5d4a('0x1b')]||null:null,'attributes':_0x47e290['options']?_0x47e290[_0x5d4a('0x19')][_0x5d4a('0x1c')]||null:null,'limit':_0x47e290['options']?_0x47e290[_0x5d4a('0x19')]['limit']||null:null,'include':_0x47e290[_0x5d4a('0x19')]?_0x47e290[_0x5d4a('0x19')][_0x5d4a('0x1d')]?_[_0x5d4a('0x1e')](_0x47e290[_0x5d4a('0x19')][_0x5d4a('0x1d')],function(_0x54f0af){return{'model':db[_0x54f0af[_0x5d4a('0x1f')]],'as':_0x54f0af['as'],'attributes':_0x54f0af[_0x5d4a('0x1c')],'include':_0x54f0af[_0x5d4a('0x1d')]?_[_0x5d4a('0x1e')](_0x54f0af[_0x5d4a('0x1d')],function(_0x12ab26){return{'model':db[_0x12ab26[_0x5d4a('0x1f')]],'as':_0x12ab26['as'],'attributes':_0x12ab26[_0x5d4a('0x1c')],'include':_0x12ab26[_0x5d4a('0x1d')]?_[_0x5d4a('0x1e')](_0x12ab26[_0x5d4a('0x1d')],function(_0x3cbfca){return{'model':db[_0x3cbfca['model']],'as':_0x3cbfca['as'],'attributes':_0x3cbfca[_0x5d4a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5d4a('0xc')](function(_0x5ba2e1){logger['info'](_0x5d4a('0x16'),_0x47e290);logger[_0x5d4a('0x10')](_0x5d4a('0x16'),_0x47e290,JSON['stringify'](_0x5ba2e1));_0x92b447(_0x5ba2e1);})['catch'](function(_0x2eeec8){logger[_0x5d4a('0x12')](_0x5d4a('0x16'),_0x2eeec8['message'],_0x47e290);_0x58ced8(_0x4216ff[_0x5d4a('0x12')](0x1f4,_0x2eeec8['message']));});});};exports['CreateVoiceCallReport']=function(_0x20e307){var _0x9598a6=this;return new Promise(function(_0x14c884,_0x2e4b16){return db['VoiceCallReport'][_0x5d4a('0x20')](_0x20e307['body'],{'raw':_0x20e307[_0x5d4a('0x19')]?_0x20e307[_0x5d4a('0x19')][_0x5d4a('0x1a')]===undefined?!![]:![]:!![]})[_0x5d4a('0xc')](function(_0x118b2f){logger[_0x5d4a('0xd')](_0x5d4a('0x21'),_0x20e307);logger[_0x5d4a('0x10')](_0x5d4a('0x21'),_0x20e307,JSON[_0x5d4a('0x11')](_0x118b2f));_0x14c884(_0x118b2f);})[_0x5d4a('0x15')](function(_0x51742e){logger['error'](_0x5d4a('0x21'),_0x51742e[_0x5d4a('0x14')],_0x20e307);_0x2e4b16(_0x9598a6[_0x5d4a('0x12')](0x1f4,_0x51742e[_0x5d4a('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x3c9a9b){var _0x3fa9f8=this;return new Promise(function(_0x2debeb,_0x404585){return db[_0x5d4a('0x17')]['update'](_0x3c9a9b[_0x5d4a('0x22')],{'raw':_0x3c9a9b['options']?_0x3c9a9b['options'][_0x5d4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c9a9b[_0x5d4a('0x19')]?_0x3c9a9b[_0x5d4a('0x19')][_0x5d4a('0x1b')]||null:null,'attributes':_0x3c9a9b[_0x5d4a('0x19')]?_0x3c9a9b['options']['attributes']||null:null,'limit':_0x3c9a9b[_0x5d4a('0x19')]?_0x3c9a9b[_0x5d4a('0x19')]['limit']||null:null})[_0x5d4a('0xc')](function(_0x221141){logger[_0x5d4a('0xd')](_0x5d4a('0x23'),_0x3c9a9b);logger[_0x5d4a('0x10')]('UpdateVoiceCallReport',_0x3c9a9b,JSON[_0x5d4a('0x11')](_0x221141));_0x2debeb(_0x221141);})[_0x5d4a('0x15')](function(_0x430c69){logger[_0x5d4a('0x12')](_0x5d4a('0x23'),_0x430c69[_0x5d4a('0x14')],_0x3c9a9b);_0x404585(_0x3fa9f8[_0x5d4a('0x12')](0x1f4,_0x430c69[_0x5d4a('0x14')]));});});}; \ No newline at end of file +var _0x236c=['body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport'];(function(_0xe101be,_0x137048){var _0x245749=function(_0x55c86e){while(--_0x55c86e){_0xe101be['push'](_0xe101be['shift']());}};_0x245749(++_0x137048);}(_0x236c,0x16c));var _0xc236=function(_0x1893d6,_0x1eec2c){_0x1893d6=_0x1893d6-0x0;var _0x33b70e=_0x236c[_0x1893d6];return _0x33b70e;};'use strict';var _=require(_0xc236('0x0'));var util=require(_0xc236('0x1'));var moment=require(_0xc236('0x2'));var BPromise=require(_0xc236('0x3'));var rs=require(_0xc236('0x4'));var fs=require('fs');var Redis=require(_0xc236('0x5'));var db=require(_0xc236('0x6'))['db'];var utils=require(_0xc236('0x7'));var logger=require(_0xc236('0x8'))(_0xc236('0x9'));var config=require(_0xc236('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc236('0xb')][_0xc236('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcf8bc0,_0x2c9283,_0x12a057){return new BPromise(function(_0x482564,_0x24a658){return client[_0xc236('0xd')](_0xcf8bc0,_0x12a057)[_0xc236('0xe')](function(_0x4982f1){logger['info'](_0xc236('0xf'),_0x2c9283,_0xc236('0x10'));logger[_0xc236('0x11')](_0xc236('0x12'),_0x2c9283,_0xc236('0x10'),JSON[_0xc236('0x13')](_0x4982f1));if(_0x4982f1['error']){if(_0x4982f1[_0xc236('0x14')]['code']===0x1f4){logger[_0xc236('0x14')](_0xc236('0xf'),_0x2c9283,_0x4982f1['error'][_0xc236('0x15')]);return _0x24a658(_0x4982f1[_0xc236('0x14')]['message']);}logger[_0xc236('0x14')](_0xc236('0xf'),_0x2c9283,_0x4982f1[_0xc236('0x14')]['message']);return _0x482564(_0x4982f1[_0xc236('0x14')][_0xc236('0x15')]);}else{logger[_0xc236('0x16')](_0xc236('0xf'),_0x2c9283,_0xc236('0x10'));_0x482564(_0x4982f1[_0xc236('0x17')]['message']);}})[_0xc236('0x18')](function(_0x3b1afb){logger[_0xc236('0x14')](_0xc236('0xf'),_0x2c9283,_0x3b1afb);_0x24a658(_0x3b1afb);});});}exports['GetVoiceCallReport']=function(_0x3572c0){var _0x42f428=this;return new Promise(function(_0x46a1c3,_0x3932eb){return db[_0xc236('0x19')][_0xc236('0x1a')]({'raw':_0x3572c0[_0xc236('0x1b')]?_0x3572c0['options'][_0xc236('0x1c')]===undefined?!![]:![]:!![],'where':_0x3572c0[_0xc236('0x1b')]?_0x3572c0[_0xc236('0x1b')][_0xc236('0x1d')]||null:null,'attributes':_0x3572c0[_0xc236('0x1b')]?_0x3572c0[_0xc236('0x1b')][_0xc236('0x1e')]||null:null,'limit':_0x3572c0[_0xc236('0x1b')]?_0x3572c0['options'][_0xc236('0x1f')]||null:null,'include':_0x3572c0['options']?_0x3572c0['options'][_0xc236('0x20')]?_[_0xc236('0x21')](_0x3572c0[_0xc236('0x1b')][_0xc236('0x20')],function(_0x63bf86){return{'model':db[_0x63bf86[_0xc236('0x22')]],'as':_0x63bf86['as'],'attributes':_0x63bf86[_0xc236('0x1e')],'include':_0x63bf86[_0xc236('0x20')]?_[_0xc236('0x21')](_0x63bf86['include'],function(_0x24cb38){return{'model':db[_0x24cb38[_0xc236('0x22')]],'as':_0x24cb38['as'],'attributes':_0x24cb38[_0xc236('0x1e')],'include':_0x24cb38[_0xc236('0x20')]?_[_0xc236('0x21')](_0x24cb38[_0xc236('0x20')],function(_0x40d894){return{'model':db[_0x40d894[_0xc236('0x22')]],'as':_0x40d894['as'],'attributes':_0x40d894[_0xc236('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc236('0xe')](function(_0x4f40b5){logger['info'](_0xc236('0x23'),_0x3572c0);logger[_0xc236('0x11')](_0xc236('0x23'),_0x3572c0,JSON[_0xc236('0x13')](_0x4f40b5));_0x46a1c3(_0x4f40b5);})[_0xc236('0x18')](function(_0x2b47f4){logger['error'](_0xc236('0x23'),_0x2b47f4['message'],_0x3572c0);_0x3932eb(_0x42f428[_0xc236('0x14')](0x1f4,_0x2b47f4['message']));});});};exports['CreateVoiceCallReport']=function(_0x2c31f3){var _0x3bfd5f=this;return new Promise(function(_0x4b5e07,_0x13acfb){return db[_0xc236('0x19')]['create'](_0x2c31f3[_0xc236('0x24')],{'raw':_0x2c31f3['options']?_0x2c31f3[_0xc236('0x1b')][_0xc236('0x1c')]===undefined?!![]:![]:!![]})[_0xc236('0xe')](function(_0x11a101){logger[_0xc236('0x16')](_0xc236('0x25'),_0x2c31f3);logger[_0xc236('0x11')]('CreateVoiceCallReport',_0x2c31f3,JSON[_0xc236('0x13')](_0x11a101));_0x4b5e07(_0x11a101);})[_0xc236('0x18')](function(_0xa25d1f){logger[_0xc236('0x14')]('CreateVoiceCallReport',_0xa25d1f[_0xc236('0x15')],_0x2c31f3);_0x13acfb(_0x3bfd5f[_0xc236('0x14')](0x1f4,_0xa25d1f[_0xc236('0x15')]));});});};exports[_0xc236('0x26')]=function(_0x4b75bd){var _0x290da9=this;return new Promise(function(_0xf0358c,_0x50c3fb){return db[_0xc236('0x19')][_0xc236('0x27')](_0x4b75bd[_0xc236('0x24')],{'raw':_0x4b75bd['options']?_0x4b75bd['options'][_0xc236('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b75bd[_0xc236('0x1b')]?_0x4b75bd['options'][_0xc236('0x1d')]||null:null,'attributes':_0x4b75bd['options']?_0x4b75bd['options'][_0xc236('0x1e')]||null:null,'limit':_0x4b75bd['options']?_0x4b75bd[_0xc236('0x1b')][_0xc236('0x1f')]||null:null})['then'](function(_0x3bf2e3){logger['info'](_0xc236('0x26'),_0x4b75bd);logger['debug'](_0xc236('0x26'),_0x4b75bd,JSON['stringify'](_0x3bf2e3));_0xf0358c(_0x3bf2e3);})['catch'](function(_0x417662){logger[_0xc236('0x14')](_0xc236('0x26'),_0x417662[_0xc236('0x15')],_0x4b75bd);_0x50c3fb(_0x290da9[_0xc236('0x14')](0x1f4,_0x417662['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index e50e201..bf7ca85 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 _0x457b=['Router','../../components/interaction/service','isAuthenticated','index','get','/:id','post','create','delete','exports','multer','util','path'];(function(_0x5ebc09,_0x26ca6e){var _0x5957a9=function(_0x55efe3){while(--_0x55efe3){_0x5ebc09['push'](_0x5ebc09['shift']());}};_0x5957a9(++_0x26ca6e);}(_0x457b,0x142));var _0xb457=function(_0x38b0a1,_0x29da11){_0x38b0a1=_0x38b0a1-0x0;var _0x27d217=_0x457b[_0x38b0a1];return _0x27d217;};'use strict';var multer=require(_0xb457('0x0'));var util=require(_0xb457('0x1'));var path=require(_0xb457('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb457('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb457('0x4'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0xb457('0x5')](),controller[_0xb457('0x6')]);router[_0xb457('0x7')](_0xb457('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xb457('0x9')]('/',auth['isAuthenticated'](),controller[_0xb457('0xa')]);router['put'](_0xb457('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xb457('0xb')](_0xb457('0x8'),auth[_0xb457('0x5')](),controller['destroy']);module[_0xb457('0xc')]=router; \ No newline at end of file +var _0x4b0a=['/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x4b0a,0xad));var _0xa4b0=function(_0x3d361e,_0x522650){_0x3d361e=_0x3d361e-0x0;var _0x547c79=_0x4b0a[_0x3d361e];return _0x547c79;};'use strict';var multer=require('multer');var util=require(_0xa4b0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa4b0('0x1'));var router=express[_0xa4b0('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa4b0('0x3'));var interaction=require(_0xa4b0('0x4'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0xa4b0('0x5')]('/',auth['isAuthenticated'](),controller[_0xa4b0('0x6')]);router[_0xa4b0('0x5')](_0xa4b0('0x7'),auth[_0xa4b0('0x8')](),controller[_0xa4b0('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa4b0('0xa')](_0xa4b0('0x7'),auth[_0xa4b0('0x8')](),controller[_0xa4b0('0xb')]);router[_0xa4b0('0xc')](_0xa4b0('0x7'),auth[_0xa4b0('0x8')](),controller[_0xa4b0('0xd')]);module[_0xa4b0('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index ff78cbd..d910b74 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 _0x5ffb=['exports','STRING','setDataValue','options','getDataValue','BOOLEAN'];(function(_0xe35583,_0x22715c){var _0x51fb67=function(_0x2e4dbe){while(--_0x2e4dbe){_0xe35583['push'](_0xe35583['shift']());}};_0x51fb67(++_0x22715c);}(_0x5ffb,0x14a));var _0xb5ff=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5ffb[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0xb5ff('0x0')]={'name':{'type':Sequelize[_0xb5ff('0x1')]},'prefix':{'type':Sequelize[_0xb5ff('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x4534b5){this[_0xb5ff('0x2')](_0xb5ff('0x3'),_0x4534b5?_0x4534b5['join'](''):[]);},'get':function(){return this[_0xb5ff('0x4')](_0xb5ff('0x3'))?this[_0xb5ff('0x4')](_0xb5ff('0x3'))['split'](''):[];}},'auth':{'type':Sequelize[_0xb5ff('0x5')],'defaultValue':![]},'password':{'type':Sequelize[_0xb5ff('0x1')]},'record':{'type':Sequelize[_0xb5ff('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb5ff('0x1')]}}; \ No newline at end of file +var _0x850c=['STRING','name','options','join','BOOLEAN','sequelize','exports'];(function(_0x5d0218,_0x51ccc6){var _0x5a1644=function(_0x4bb38e){while(--_0x4bb38e){_0x5d0218['push'](_0x5d0218['shift']());}};_0x5a1644(++_0x51ccc6);}(_0x850c,0xfa));var _0xc850=function(_0x1b398b,_0x59dc61){_0x1b398b=_0x1b398b-0x0;var _0x30b89b=_0x850c[_0x1b398b];return _0x30b89b;};'use strict';var Sequelize=require(_0xc850('0x0'));module[_0xc850('0x1')]={'name':{'type':Sequelize[_0xc850('0x2')]},'prefix':{'type':Sequelize[_0xc850('0x2')],'unique':_0xc850('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xc850('0x2')],'set':function(_0x2f4f94){this['setDataValue'](_0xc850('0x4'),_0x2f4f94?_0x2f4f94[_0xc850('0x5')](''):[]);},'get':function(){return this['getDataValue']('options')?this['getDataValue']('options')['split'](''):[];}},'auth':{'type':Sequelize[_0xc850('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xc850('0x2')]},'record':{'type':Sequelize[_0xc850('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc850('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 44a078b..54d0e26 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 _0xee9e=['filters','pick','type','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','where'];(function(_0x4a405d,_0xd4e4c1){var _0x2fcb1f=function(_0x3d4dbd){while(--_0x3d4dbd){_0x4a405d['push'](_0x4a405d['shift']());}};_0x2fcb1f(++_0xd4e4c1);}(_0xee9e,0x1b0));var _0xeee9=function(_0x499938,_0x3556d8){_0x499938=_0x499938-0x0;var _0x38206d=_0xee9e[_0x499938];return _0x38206d;};'use strict';var emlformat=require(_0xeee9('0x0'));var rimraf=require(_0xeee9('0x1'));var zipdir=require(_0xeee9('0x2'));var jsonpatch=require(_0xeee9('0x3'));var rp=require(_0xeee9('0x4'));var moment=require(_0xeee9('0x5'));var BPromise=require(_0xeee9('0x6'));var Mustache=require(_0xeee9('0x7'));var util=require(_0xeee9('0x8'));var path=require(_0xeee9('0x9'));var sox=require('sox');var csv=require(_0xeee9('0xa'));var ejs=require(_0xeee9('0xb'));var fs=require('fs');var fs_extra=require(_0xeee9('0xc'));var _=require(_0xeee9('0xd'));var squel=require(_0xeee9('0xe'));var crypto=require('crypto');var jsforce=require(_0xeee9('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeee9('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeee9('0x11'));var qs=require(_0xeee9('0x12'));var as=require(_0xeee9('0x13'));var hardwareService=require(_0xeee9('0x14'));var logger=require('../../config/logger')(_0xeee9('0x15'));var utils=require(_0xeee9('0x16'));var config=require(_0xeee9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xeee9('0x18'))['db'];function respondWithStatusCode(_0x3e9bf3,_0x4e34ca){_0x4e34ca=_0x4e34ca||0xcc;return function(_0x10cd9c){if(_0x10cd9c){return _0x3e9bf3[_0xeee9('0x19')](_0x4e34ca);}return _0x3e9bf3[_0xeee9('0x1a')](_0x4e34ca)[_0xeee9('0x1b')]();};}function respondWithResult(_0x408ede,_0x6dfd18){_0x6dfd18=_0x6dfd18||0xc8;return function(_0x573b47){if(_0x573b47){return _0x408ede[_0xeee9('0x1a')](_0x6dfd18)['json'](_0x573b47);}};}function respondWithFilteredResult(_0x56e808,_0x1afa13){return function(_0x2fc3c5){if(_0x2fc3c5){var _0x98d583=typeof _0x1afa13[_0xeee9('0x1c')]===_0xeee9('0x1d')&&typeof _0x1afa13['limit']===_0xeee9('0x1d');var _0x37bc14=_0x2fc3c5[_0xeee9('0x1e')];var _0xa2d4cc=_0x98d583?0x0:_0x1afa13[_0xeee9('0x1c')];var _0xea2011=_0x98d583?_0x2fc3c5[_0xeee9('0x1e')]:_0x1afa13[_0xeee9('0x1c')]+_0x1afa13[_0xeee9('0x1f')];var _0x244b5c;if(_0xea2011>=_0x37bc14){_0xea2011=_0x37bc14;_0x244b5c=0xc8;}else{_0x244b5c=0xce;}_0x56e808['status'](_0x244b5c);return _0x56e808[_0xeee9('0x20')](_0xeee9('0x21'),_0xa2d4cc+'-'+_0xea2011+'/'+_0x37bc14)['json'](_0x2fc3c5);}return null;};}function patchUpdates(_0x4ad80e){return function(_0x260dc9){try{jsonpatch[_0xeee9('0x22')](_0x260dc9,_0x4ad80e,!![]);}catch(_0x421892){return BPromise['reject'](_0x421892);}return _0x260dc9[_0xeee9('0x23')]();};}function saveUpdates(_0x2b0a8c,_0x17d8e1){return function(_0x2f49c6){if(_0x2f49c6){return _0x2f49c6['update'](_0x2b0a8c)['then'](function(_0x2e2239){return _0x2e2239;});}return null;};}function removeEntity(_0x24403d,_0x45a692){return function(_0x5f5594){if(_0x5f5594){return _0x5f5594[_0xeee9('0x24')]()[_0xeee9('0x25')](function(){var _0x181d27=_0x5f5594[_0xeee9('0x26')]({'plain':!![]});var _0x964fd2=_0xeee9('0x27');return db[_0xeee9('0x28')][_0xeee9('0x24')]({'where':{'type':_0x964fd2,'resourceId':_0x181d27['id']}})[_0xeee9('0x25')](function(){return _0x5f5594;});})[_0xeee9('0x25')](function(){_0x24403d[_0xeee9('0x1a')](0xcc)[_0xeee9('0x1b')]();});}};}function handleEntityNotFound(_0x3dfdeb,_0x508127){return function(_0x4412aa){if(!_0x4412aa){_0x3dfdeb[_0xeee9('0x19')](0x194);}return _0x4412aa;};}function handleError(_0x3da3be,_0x2073de){_0x2073de=_0x2073de||0x1f4;return function(_0xc243b4){logger[_0xeee9('0x29')](_0xc243b4[_0xeee9('0x2a')]);if(_0xc243b4[_0xeee9('0x2b')]){delete _0xc243b4[_0xeee9('0x2b')];}_0x3da3be[_0xeee9('0x1a')](_0x2073de)[_0xeee9('0x2c')](_0xc243b4);};}exports[_0xeee9('0x2d')]=function(_0x30a3a8,_0xb78837){var _0x1bba0c={},_0x4a26b1={},_0x148b0d={'count':0x0,'rows':[]};var _0x3fe21c=_[_0xeee9('0x2e')](db[_0xeee9('0x2f')][_0xeee9('0x30')],function(_0x2aa085){return{'name':_0x2aa085['fieldName'],'type':_0x2aa085['type'][_0xeee9('0x31')]};});_0x4a26b1['model']=_[_0xeee9('0x2e')](_0x3fe21c,_0xeee9('0x2b'));_0x4a26b1[_0xeee9('0x32')]=_[_0xeee9('0x33')](_0x30a3a8[_0xeee9('0x32')]);_0x4a26b1['filters']=_[_0xeee9('0x34')](_0x4a26b1[_0xeee9('0x35')],_0x4a26b1[_0xeee9('0x32')]);_0x1bba0c[_0xeee9('0x36')]=_[_0xeee9('0x34')](_0x4a26b1[_0xeee9('0x35')],qs[_0xeee9('0x37')](_0x30a3a8[_0xeee9('0x32')][_0xeee9('0x37')]));_0x1bba0c[_0xeee9('0x36')]=_0x1bba0c[_0xeee9('0x36')][_0xeee9('0x38')]?_0x1bba0c[_0xeee9('0x36')]:_0x4a26b1[_0xeee9('0x35')];if(!_0x30a3a8[_0xeee9('0x32')][_0xeee9('0x39')]('nolimit')){_0x1bba0c[_0xeee9('0x1f')]=qs[_0xeee9('0x1f')](_0x30a3a8[_0xeee9('0x32')][_0xeee9('0x1f')]);_0x1bba0c[_0xeee9('0x1c')]=qs[_0xeee9('0x1c')](_0x30a3a8[_0xeee9('0x32')][_0xeee9('0x1c')]);}_0x1bba0c[_0xeee9('0x3a')]=qs['sort'](_0x30a3a8[_0xeee9('0x32')]['sort']);_0x1bba0c[_0xeee9('0x3b')]=qs[_0xeee9('0x3c')](_[_0xeee9('0x3d')](_0x30a3a8[_0xeee9('0x32')],_0x4a26b1[_0xeee9('0x3c')]),_0x3fe21c);if(_0x30a3a8[_0xeee9('0x32')]['filter']){_0x1bba0c[_0xeee9('0x3b')]=_['merge'](_0x1bba0c[_0xeee9('0x3b')],{'$or':_[_0xeee9('0x2e')](_0x3fe21c,function(_0x4d4bc6){if(_0x4d4bc6[_0xeee9('0x3e')]!=='VIRTUAL'){var _0xdc7106={};_0xdc7106[_0x4d4bc6[_0xeee9('0x2b')]]={'$like':'%'+_0x30a3a8[_0xeee9('0x32')]['filter']+'%'};return _0xdc7106;}})});}_0x1bba0c=_[_0xeee9('0x3f')]({},_0x1bba0c,_0x30a3a8[_0xeee9('0x40')]);var _0xa55024={'where':_0x1bba0c[_0xeee9('0x3b')]};return db[_0xeee9('0x2f')]['count'](_0xa55024)[_0xeee9('0x25')](function(_0x58fc41){_0x148b0d[_0xeee9('0x1e')]=_0x58fc41;if(_0x30a3a8[_0xeee9('0x32')][_0xeee9('0x41')]){_0x1bba0c[_0xeee9('0x42')]=[{'all':!![]}];}return db[_0xeee9('0x2f')][_0xeee9('0x43')](_0x1bba0c);})['then'](function(_0x1dc122){_0x148b0d[_0xeee9('0x44')]=_0x1dc122;return _0x148b0d;})['then'](respondWithFilteredResult(_0xb78837,_0x1bba0c))[_0xeee9('0x45')](handleError(_0xb78837,null));};exports[_0xeee9('0x46')]=function(_0x2c3a59,_0x579cd5){var _0x276b24={'raw':![],'where':{'id':_0x2c3a59[_0xeee9('0x47')]['id']}},_0x3f2c80={};_0x3f2c80['model']=_[_0xeee9('0x33')](db[_0xeee9('0x2f')][_0xeee9('0x30')]);_0x3f2c80[_0xeee9('0x32')]=_[_0xeee9('0x33')](_0x2c3a59[_0xeee9('0x32')]);_0x3f2c80[_0xeee9('0x3c')]=_[_0xeee9('0x34')](_0x3f2c80['model'],_0x3f2c80[_0xeee9('0x32')]);_0x276b24[_0xeee9('0x36')]=_[_0xeee9('0x34')](_0x3f2c80[_0xeee9('0x35')],qs['fields'](_0x2c3a59[_0xeee9('0x32')]['fields']));_0x276b24['attributes']=_0x276b24['attributes'][_0xeee9('0x38')]?_0x276b24[_0xeee9('0x36')]:_0x3f2c80[_0xeee9('0x35')];if(_0x2c3a59[_0xeee9('0x32')][_0xeee9('0x41')]){_0x276b24[_0xeee9('0x42')]=[{'all':!![]}];}_0x276b24=_[_0xeee9('0x3f')]({},_0x276b24,_0x2c3a59[_0xeee9('0x40')]);return db['VoiceChanSpy'][_0xeee9('0x48')](_0x276b24)[_0xeee9('0x25')](handleEntityNotFound(_0x579cd5,null))[_0xeee9('0x25')](respondWithResult(_0x579cd5,null))[_0xeee9('0x45')](handleError(_0x579cd5,null));};exports['create']=function(_0xccc16e,_0x361111){return db['VoiceChanSpy'][_0xeee9('0x49')](_0xccc16e['body'],{})[_0xeee9('0x25')](function(_0x90f1b0){var _0x35495e=_0xccc16e[_0xeee9('0x4a')]['get']({'plain':!![]});if(!_0x35495e)throw new Error(_0xeee9('0x4b'));if(_0x35495e[_0xeee9('0x4c')]===_0xeee9('0x4a')){var _0x5c930d=_0x90f1b0[_0xeee9('0x26')]({'plain':!![]});var _0xbed4a0=_0xeee9('0x27');return db[_0xeee9('0x4d')][_0xeee9('0x48')]({'where':{'name':_0xbed4a0,'userProfileId':_0x35495e[_0xeee9('0x4e')]},'raw':!![]})['then'](function(_0x5521cb){if(_0x5521cb&&_0x5521cb[_0xeee9('0x4f')]===0x0){return db[_0xeee9('0x28')][_0xeee9('0x49')]({'name':_0x5c930d[_0xeee9('0x2b')],'resourceId':_0x5c930d['id'],'type':_0x5521cb[_0xeee9('0x2b')],'sectionId':_0x5521cb['id']},{})['then'](function(){return _0x90f1b0;});}else{return _0x90f1b0;}})[_0xeee9('0x45')](function(_0x576c05){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x576c05);throw _0x576c05;});}return _0x90f1b0;})[_0xeee9('0x25')](respondWithResult(_0x361111,0xc9))['catch'](handleError(_0x361111,null));};exports[_0xeee9('0x50')]=function(_0x320f09,_0x570aad){if(_0x320f09[_0xeee9('0x51')]['id']){delete _0x320f09[_0xeee9('0x51')]['id'];}return db[_0xeee9('0x2f')]['find']({'where':{'id':_0x320f09['params']['id']}})[_0xeee9('0x25')](handleEntityNotFound(_0x570aad,null))[_0xeee9('0x25')](saveUpdates(_0x320f09['body'],null))['then'](respondWithResult(_0x570aad,null))[_0xeee9('0x45')](handleError(_0x570aad,null));};exports[_0xeee9('0x24')]=function(_0x270cbb,_0x52f1b8){return db['VoiceChanSpy'][_0xeee9('0x48')]({'where':{'id':_0x270cbb[_0xeee9('0x47')]['id']}})[_0xeee9('0x25')](handleEntityNotFound(_0x52f1b8,null))['then'](removeEntity(_0x52f1b8,null))['catch'](handleError(_0x52f1b8,null));}; \ No newline at end of file +var _0xe328=['set','json','apply','reject','update','then','destroy','get','end','error','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','include','VoiceChanSpy','findAll','rows','catch','params','rawAttributes','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count'];(function(_0x53b522,_0x20751e){var _0x548d58=function(_0x18c16b){while(--_0x18c16b){_0x53b522['push'](_0x53b522['shift']());}};_0x548d58(++_0x20751e);}(_0xe328,0x1e2));var _0x8e32=function(_0x2082d5,_0x58cff9){_0x2082d5=_0x2082d5-0x0;var _0x5953c3=_0xe328[_0x2082d5];return _0x5953c3;};'use strict';var emlformat=require(_0x8e32('0x0'));var rimraf=require(_0x8e32('0x1'));var zipdir=require(_0x8e32('0x2'));var jsonpatch=require(_0x8e32('0x3'));var rp=require(_0x8e32('0x4'));var moment=require('moment');var BPromise=require(_0x8e32('0x5'));var Mustache=require(_0x8e32('0x6'));var util=require(_0x8e32('0x7'));var path=require(_0x8e32('0x8'));var sox=require(_0x8e32('0x9'));var csv=require('to-csv');var ejs=require(_0x8e32('0xa'));var fs=require('fs');var fs_extra=require(_0x8e32('0xb'));var _=require(_0x8e32('0xc'));var squel=require(_0x8e32('0xd'));var crypto=require(_0x8e32('0xe'));var jsforce=require(_0x8e32('0xf'));var deskjs=require(_0x8e32('0x10'));var toCsv=require(_0x8e32('0x11'));var querystring=require(_0x8e32('0x12'));var Papa=require(_0x8e32('0x13'));var Redis=require(_0x8e32('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x8e32('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e32('0x16'))(_0x8e32('0x17'));var utils=require(_0x8e32('0x18'));var config=require(_0x8e32('0x19'));var licenseUtil=require(_0x8e32('0x1a'));var db=require(_0x8e32('0x1b'))['db'];function respondWithStatusCode(_0x2f41bd,_0xd614a9){_0xd614a9=_0xd614a9||0xcc;return function(_0x535afc){if(_0x535afc){return _0x2f41bd[_0x8e32('0x1c')](_0xd614a9);}return _0x2f41bd['status'](_0xd614a9)['end']();};}function respondWithResult(_0x579996,_0x396c22){_0x396c22=_0x396c22||0xc8;return function(_0x8c372b){if(_0x8c372b){return _0x579996[_0x8e32('0x1d')](_0x396c22)['json'](_0x8c372b);}};}function respondWithFilteredResult(_0x522fef,_0xc00644){return function(_0x3b9c29){if(_0x3b9c29){var _0x50626a=typeof _0xc00644[_0x8e32('0x1e')]==='undefined'&&typeof _0xc00644[_0x8e32('0x1f')]===_0x8e32('0x20');var _0x4d9a57=_0x3b9c29[_0x8e32('0x21')];var _0x4128eb=_0x50626a?0x0:_0xc00644[_0x8e32('0x1e')];var _0x40a2db=_0x50626a?_0x3b9c29['count']:_0xc00644[_0x8e32('0x1e')]+_0xc00644[_0x8e32('0x1f')];var _0x1df3db;if(_0x40a2db>=_0x4d9a57){_0x40a2db=_0x4d9a57;_0x1df3db=0xc8;}else{_0x1df3db=0xce;}_0x522fef[_0x8e32('0x1d')](_0x1df3db);return _0x522fef[_0x8e32('0x22')]('Content-Range',_0x4128eb+'-'+_0x40a2db+'/'+_0x4d9a57)[_0x8e32('0x23')](_0x3b9c29);}return null;};}function patchUpdates(_0x4c7e86){return function(_0x1e7768){try{jsonpatch[_0x8e32('0x24')](_0x1e7768,_0x4c7e86,!![]);}catch(_0x1897cd){return BPromise[_0x8e32('0x25')](_0x1897cd);}return _0x1e7768['save']();};}function saveUpdates(_0x5d6189,_0x3ad794){return function(_0x1df699){if(_0x1df699){return _0x1df699[_0x8e32('0x26')](_0x5d6189)[_0x8e32('0x27')](function(_0x45c964){return _0x45c964;});}return null;};}function removeEntity(_0x2cacd2,_0x222d1a){return function(_0x591f80){if(_0x591f80){return _0x591f80[_0x8e32('0x28')]()[_0x8e32('0x27')](function(){var _0x3b8e61=_0x591f80[_0x8e32('0x29')]({'plain':!![]});var _0x4c049a='ChanSpies';return db['UserProfileResource'][_0x8e32('0x28')]({'where':{'type':_0x4c049a,'resourceId':_0x3b8e61['id']}})[_0x8e32('0x27')](function(){return _0x591f80;});})[_0x8e32('0x27')](function(){_0x2cacd2['status'](0xcc)[_0x8e32('0x2a')]();});}};}function handleEntityNotFound(_0x28a798,_0x247ebd){return function(_0x24930d){if(!_0x24930d){_0x28a798[_0x8e32('0x1c')](0x194);}return _0x24930d;};}function handleError(_0xa67016,_0x34c8a1){_0x34c8a1=_0x34c8a1||0x1f4;return function(_0xc79122){logger[_0x8e32('0x2b')](_0xc79122['stack']);if(_0xc79122[_0x8e32('0x2c')]){delete _0xc79122[_0x8e32('0x2c')];}_0xa67016[_0x8e32('0x1d')](_0x34c8a1)[_0x8e32('0x2d')](_0xc79122);};}exports[_0x8e32('0x2e')]=function(_0x155acf,_0x9dedbd){var _0x25bfbb={},_0x54241d={},_0x410b40={'count':0x0,'rows':[]};var _0xd38f73=_[_0x8e32('0x2f')](db['VoiceChanSpy']['rawAttributes'],function(_0x483115){return{'name':_0x483115[_0x8e32('0x30')],'type':_0x483115['type'][_0x8e32('0x31')]};});_0x54241d[_0x8e32('0x32')]=_['map'](_0xd38f73,_0x8e32('0x2c'));_0x54241d[_0x8e32('0x33')]=_[_0x8e32('0x34')](_0x155acf[_0x8e32('0x33')]);_0x54241d[_0x8e32('0x35')]=_[_0x8e32('0x36')](_0x54241d[_0x8e32('0x32')],_0x54241d[_0x8e32('0x33')]);_0x25bfbb['attributes']=_['intersection'](_0x54241d[_0x8e32('0x32')],qs[_0x8e32('0x37')](_0x155acf[_0x8e32('0x33')][_0x8e32('0x37')]));_0x25bfbb[_0x8e32('0x38')]=_0x25bfbb[_0x8e32('0x38')]['length']?_0x25bfbb[_0x8e32('0x38')]:_0x54241d[_0x8e32('0x32')];if(!_0x155acf[_0x8e32('0x33')]['hasOwnProperty'](_0x8e32('0x39'))){_0x25bfbb[_0x8e32('0x1f')]=qs[_0x8e32('0x1f')](_0x155acf['query'][_0x8e32('0x1f')]);_0x25bfbb[_0x8e32('0x1e')]=qs['offset'](_0x155acf['query']['offset']);}_0x25bfbb[_0x8e32('0x3a')]=qs[_0x8e32('0x3b')](_0x155acf[_0x8e32('0x33')][_0x8e32('0x3b')]);_0x25bfbb['where']=qs[_0x8e32('0x35')](_[_0x8e32('0x3c')](_0x155acf[_0x8e32('0x33')],_0x54241d[_0x8e32('0x35')]),_0xd38f73);if(_0x155acf['query'][_0x8e32('0x3d')]){_0x25bfbb[_0x8e32('0x3e')]=_['merge'](_0x25bfbb[_0x8e32('0x3e')],{'$or':_['map'](_0xd38f73,function(_0x3823a6){if(_0x3823a6[_0x8e32('0x3f')]!==_0x8e32('0x40')){var _0x1606a2={};_0x1606a2[_0x3823a6['name']]={'$like':'%'+_0x155acf[_0x8e32('0x33')][_0x8e32('0x3d')]+'%'};return _0x1606a2;}})});}_0x25bfbb=_[_0x8e32('0x41')]({},_0x25bfbb,_0x155acf[_0x8e32('0x42')]);var _0x31e861={'where':_0x25bfbb['where']};return db['VoiceChanSpy'][_0x8e32('0x21')](_0x31e861)['then'](function(_0x4c79e1){_0x410b40['count']=_0x4c79e1;if(_0x155acf[_0x8e32('0x33')]['includeAll']){_0x25bfbb[_0x8e32('0x43')]=[{'all':!![]}];}return db[_0x8e32('0x44')][_0x8e32('0x45')](_0x25bfbb);})[_0x8e32('0x27')](function(_0x528b3d){_0x410b40[_0x8e32('0x46')]=_0x528b3d;return _0x410b40;})[_0x8e32('0x27')](respondWithFilteredResult(_0x9dedbd,_0x25bfbb))[_0x8e32('0x47')](handleError(_0x9dedbd,null));};exports['show']=function(_0x122ea6,_0xe4067b){var _0x1afabc={'raw':![],'where':{'id':_0x122ea6[_0x8e32('0x48')]['id']}},_0x48def8={};_0x48def8[_0x8e32('0x32')]=_['keys'](db['VoiceChanSpy'][_0x8e32('0x49')]);_0x48def8[_0x8e32('0x33')]=_[_0x8e32('0x34')](_0x122ea6[_0x8e32('0x33')]);_0x48def8[_0x8e32('0x35')]=_[_0x8e32('0x36')](_0x48def8[_0x8e32('0x32')],_0x48def8[_0x8e32('0x33')]);_0x1afabc[_0x8e32('0x38')]=_[_0x8e32('0x36')](_0x48def8['model'],qs[_0x8e32('0x37')](_0x122ea6[_0x8e32('0x33')][_0x8e32('0x37')]));_0x1afabc[_0x8e32('0x38')]=_0x1afabc[_0x8e32('0x38')][_0x8e32('0x4a')]?_0x1afabc[_0x8e32('0x38')]:_0x48def8[_0x8e32('0x32')];if(_0x122ea6[_0x8e32('0x33')][_0x8e32('0x4b')]){_0x1afabc[_0x8e32('0x43')]=[{'all':!![]}];}_0x1afabc=_['merge']({},_0x1afabc,_0x122ea6['options']);return db['VoiceChanSpy'][_0x8e32('0x4c')](_0x1afabc)[_0x8e32('0x27')](handleEntityNotFound(_0xe4067b,null))[_0x8e32('0x27')](respondWithResult(_0xe4067b,null))[_0x8e32('0x47')](handleError(_0xe4067b,null));};exports[_0x8e32('0x4d')]=function(_0x50530c,_0x27d928){return db[_0x8e32('0x44')][_0x8e32('0x4d')](_0x50530c[_0x8e32('0x4e')],{})[_0x8e32('0x27')](function(_0x42762d){var _0x344133=_0x50530c['user'][_0x8e32('0x29')]({'plain':!![]});if(!_0x344133)throw new Error(_0x8e32('0x4f'));if(_0x344133[_0x8e32('0x50')]===_0x8e32('0x51')){var _0x2a526b=_0x42762d[_0x8e32('0x29')]({'plain':!![]});var _0x145800=_0x8e32('0x52');return db[_0x8e32('0x53')][_0x8e32('0x4c')]({'where':{'name':_0x145800,'userProfileId':_0x344133[_0x8e32('0x54')]},'raw':!![]})['then'](function(_0x1ed01a){if(_0x1ed01a&&_0x1ed01a[_0x8e32('0x55')]===0x0){return db['UserProfileResource'][_0x8e32('0x4d')]({'name':_0x2a526b[_0x8e32('0x2c')],'resourceId':_0x2a526b['id'],'type':_0x1ed01a['name'],'sectionId':_0x1ed01a['id']},{})[_0x8e32('0x27')](function(){return _0x42762d;});}else{return _0x42762d;}})[_0x8e32('0x47')](function(_0xdfb2d){logger[_0x8e32('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdfb2d);throw _0xdfb2d;});}return _0x42762d;})['then'](respondWithResult(_0x27d928,0xc9))[_0x8e32('0x47')](handleError(_0x27d928,null));};exports['update']=function(_0x143b0d,_0x3054ba){if(_0x143b0d[_0x8e32('0x4e')]['id']){delete _0x143b0d[_0x8e32('0x4e')]['id'];}return db['VoiceChanSpy'][_0x8e32('0x4c')]({'where':{'id':_0x143b0d[_0x8e32('0x48')]['id']}})['then'](handleEntityNotFound(_0x3054ba,null))['then'](saveUpdates(_0x143b0d[_0x8e32('0x4e')],null))[_0x8e32('0x27')](respondWithResult(_0x3054ba,null))[_0x8e32('0x47')](handleError(_0x3054ba,null));};exports[_0x8e32('0x28')]=function(_0x823840,_0x443ef7){return db[_0x8e32('0x44')][_0x8e32('0x4c')]({'where':{'id':_0x823840[_0x8e32('0x48')]['id']}})[_0x8e32('0x27')](handleEntityNotFound(_0x443ef7,null))['then'](removeEntity(_0x443ef7,null))[_0x8e32('0x47')](handleError(_0x443ef7,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 91c6f25..38ba1a0 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 _0x7aad=['concat','internal','User','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','push','Set','chanspy','record','merge','MixMonitor','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length'];(function(_0x42ccc9,_0x3fd7b8){var _0x240b0b=function(_0x5505b3){while(--_0x5505b3){_0x42ccc9['push'](_0x42ccc9['shift']());}};_0x240b0b(++_0x3fd7b8);}(_0x7aad,0x160));var _0xd7aa=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x7aad[_0x481bf7];return _0x461787;};'use strict';var _=require(_0xd7aa('0x0'));var util=require('util');var BPromise=require(_0xd7aa('0x1'));var attributes=require(_0xd7aa('0x2'));var getUserApplications=function(_0x51b405,_0x3dad0e,_0x300a7d){var _0x3c8c9f=0x1;var _0x4cac90=[];var _0x543110={'context':_0x3dad0e[_0xd7aa('0x3')]||_0xd7aa('0x4'),'exten':util[_0xd7aa('0x5')](_0xd7aa('0x6'),_0x51b405['prefix'],_0x300a7d),'type':'system','isApp':![],'ChanSpyId':_0x51b405['id'],'UserId':_0x3dad0e['id']};_0x4cac90[_0xd7aa('0x7')](_['merge']({'app':_0xd7aa('0x8'),'appdata':util[_0xd7aa('0x5')]('CDR(type)=%s',_0xd7aa('0x9')),'priority':_0x3c8c9f++},_0x543110));if(_0x51b405[_0xd7aa('0xa')]){_0x4cac90[_0xd7aa('0x7')](_[_0xd7aa('0xb')]({'app':_0xd7aa('0xc'),'appdata':util[_0xd7aa('0x5')]('${UNIQUEID}.%s,a',_0x51b405['recordingFormat']),'priority':_0x3c8c9f++},_0x543110));}if(_0x51b405[_0xd7aa('0xd')]){_0x4cac90[_0xd7aa('0x7')](_[_0xd7aa('0xb')]({'app':_0xd7aa('0xe'),'appdata':_0x51b405['password'],'priority':_0x3c8c9f++},_0x543110));}_0x4cac90[_0xd7aa('0x7')](_[_0xd7aa('0xb')]({'app':_0xd7aa('0xf'),'appdata':util[_0xd7aa('0x5')](_0xd7aa('0x10'),_0x3dad0e[_0xd7aa('0x11')],_0x51b405['options']?_0x51b405[_0xd7aa('0x12')][_0xd7aa('0x13')](''):''),'priority':_0x3c8c9f++},_0x543110));if(_0x51b405[_0xd7aa('0xa')]){_0x4cac90[_0xd7aa('0x7')](_['merge']({'app':_0xd7aa('0x14'),'priority':_0x3c8c9f++},_0x543110));}return _0x4cac90;};var getChanSpyApplications=function(_0x12685c,_0x246aad){var _0x1f01a8=[];for(var _0x3b23b7=0x0,_0x2bad5b=0x1;_0x3b23b7<_0x246aad[_0xd7aa('0x15')];_0x3b23b7++,_0x2bad5b=0x1){_0x1f01a8=_0x1f01a8[_0xd7aa('0x16')](getUserApplications(_0x12685c,_0x246aad[_0x3b23b7],_0x246aad[_0x3b23b7][_0xd7aa('0x17')]));if(_0x246aad[_0x3b23b7][_0xd7aa('0x17')]!=_0x246aad[_0x3b23b7][_0xd7aa('0x11')]){_0x1f01a8=_0x1f01a8['concat'](getUserApplications(_0x12685c,_0x246aad[_0x3b23b7],_0x246aad[_0x3b23b7][_0xd7aa('0x11')]));}}return _0x1f01a8;};var getChanSpyPromise=function(_0x6a3dec,_0x1f2bf7){return new BPromise(function(_0x308fc4,_0x235cde){return _0x6a3dec[_0xd7aa('0x18')]['findAll']({'attributes':['id','name',_0xd7aa('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xd7aa('0x19')](function(_0x43328b){if(_0x43328b){return _0x308fc4(getChanSpyApplications(_0x1f2bf7,_0x43328b));}return _0x308fc4([]);})[_0xd7aa('0x1a')](function(_0x2616e4){_0x235cde(_0x2616e4);});});};module[_0xd7aa('0x1b')]=function(_0x3043f7,_0x500127){var _0x13a13c=_0x3043f7[_0xd7aa('0x1c')];return _0x3043f7[_0xd7aa('0x1d')](_0xd7aa('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x25f575,_0x11d594,_0x350fa6){return getChanSpyPromise(_0x13a13c,_0x25f575)[_0xd7aa('0x19')](function(_0x20ee4a){if(_0x20ee4a&&_0x20ee4a[_0xd7aa('0x15')]){return _0x13a13c[_0xd7aa('0x1f')][_0xd7aa('0x20')](_0x20ee4a);}})[_0xd7aa('0x19')](function(){_0x350fa6();})[_0xd7aa('0x1a')](function(_0x52cfb7){_0x350fa6(_0x52cfb7);});},'afterUpdate':function(_0x5cb673,_0x18e05c,_0x384fca){return _0x13a13c[_0xd7aa('0x1f')]['destroy']({'where':{'ChanSpyId':_0x5cb673['id']}})[_0xd7aa('0x19')](function(){return getChanSpyPromise(_0x13a13c,_0x5cb673);})[_0xd7aa('0x19')](function(_0x21ff0f){if(_0x21ff0f&&_0x21ff0f[_0xd7aa('0x15')]){return _0x13a13c[_0xd7aa('0x1f')][_0xd7aa('0x20')](_0x21ff0f);}})[_0xd7aa('0x19')](function(){_0x384fca();})[_0xd7aa('0x1a')](function(_0x273da7){_0x384fca(_0x273da7);});},'afterDestroy':function(_0x129977,_0x38b9dc,_0x129a8d){return _0x13a13c[_0xd7aa('0x1f')][_0xd7aa('0x21')]({'where':{'ChanSpyId':_0x129977['id']}})[_0xd7aa('0x19')](function(){_0x129a8d();})[_0xd7aa('0x1a')](function(_0x3a4840){_0x129a8d(_0x3a4840);});}}});}; \ No newline at end of file +var _0x2f38=['options','join','StopMixMonitor','internal','concat','User','agent','then','catch','exports','models','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','util','./voiceChanSpy.attributes','context','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','name'];(function(_0x2889b9,_0x4a84a9){var _0x2e5b24=function(_0x5b0948){while(--_0x5b0948){_0x2889b9['push'](_0x2889b9['shift']());}};_0x2e5b24(++_0x4a84a9);}(_0x2f38,0x1a7));var _0x82f3=function(_0xf051f5,_0xf10aa8){_0xf051f5=_0xf051f5-0x0;var _0x4f1f25=_0x2f38[_0xf051f5];return _0x4f1f25;};'use strict';var _=require('lodash');var util=require(_0x82f3('0x0'));var BPromise=require('bluebird');var attributes=require(_0x82f3('0x1'));var getUserApplications=function(_0x5d800f,_0x656185,_0x68d97e){var _0xf09db1=0x1;var _0x466e73=[];var _0x4c5ab1={'context':_0x656185[_0x82f3('0x2')]||'from-sip','exten':util['format'](_0x82f3('0x3'),_0x5d800f[_0x82f3('0x4')],_0x68d97e),'type':_0x82f3('0x5'),'isApp':![],'ChanSpyId':_0x5d800f['id'],'UserId':_0x656185['id']};_0x466e73[_0x82f3('0x6')](_[_0x82f3('0x7')]({'app':_0x82f3('0x8'),'appdata':util[_0x82f3('0x9')](_0x82f3('0xa'),_0x82f3('0xb')),'priority':_0xf09db1++},_0x4c5ab1));if(_0x5d800f[_0x82f3('0xc')]){_0x466e73[_0x82f3('0x6')](_[_0x82f3('0x7')]({'app':_0x82f3('0xd'),'appdata':util['format'](_0x82f3('0xe'),_0x5d800f[_0x82f3('0xf')]),'priority':_0xf09db1++},_0x4c5ab1));}if(_0x5d800f[_0x82f3('0x10')]){_0x466e73[_0x82f3('0x6')](_[_0x82f3('0x7')]({'app':_0x82f3('0x11'),'appdata':_0x5d800f[_0x82f3('0x12')],'priority':_0xf09db1++},_0x4c5ab1));}_0x466e73['push'](_['merge']({'app':_0x82f3('0x13'),'appdata':util[_0x82f3('0x9')]('SIP/%s,%s',_0x656185[_0x82f3('0x14')],_0x5d800f[_0x82f3('0x15')]?_0x5d800f[_0x82f3('0x15')][_0x82f3('0x16')](''):''),'priority':_0xf09db1++},_0x4c5ab1));if(_0x5d800f[_0x82f3('0xc')]){_0x466e73[_0x82f3('0x6')](_['merge']({'app':_0x82f3('0x17'),'priority':_0xf09db1++},_0x4c5ab1));}return _0x466e73;};var getChanSpyApplications=function(_0x2cafd6,_0x1b3b55){var _0x3a43ee=[];for(var _0x4d1a2d=0x0,_0x11bf83=0x1;_0x4d1a2d<_0x1b3b55['length'];_0x4d1a2d++,_0x11bf83=0x1){_0x3a43ee=_0x3a43ee['concat'](getUserApplications(_0x2cafd6,_0x1b3b55[_0x4d1a2d],_0x1b3b55[_0x4d1a2d][_0x82f3('0x18')]));if(_0x1b3b55[_0x4d1a2d][_0x82f3('0x18')]!=_0x1b3b55[_0x4d1a2d][_0x82f3('0x14')]){_0x3a43ee=_0x3a43ee[_0x82f3('0x19')](getUserApplications(_0x2cafd6,_0x1b3b55[_0x4d1a2d],_0x1b3b55[_0x4d1a2d][_0x82f3('0x14')]));}}return _0x3a43ee;};var getChanSpyPromise=function(_0x2c0388,_0x571804){return new BPromise(function(_0x5e0eb7,_0x36666d){return _0x2c0388[_0x82f3('0x1a')]['findAll']({'attributes':['id','name',_0x82f3('0x18')],'where':{'role':_0x82f3('0x1b'),'chanspy':!![]},'raw':!![]})[_0x82f3('0x1c')](function(_0x1c7069){if(_0x1c7069){return _0x5e0eb7(getChanSpyApplications(_0x571804,_0x1c7069));}return _0x5e0eb7([]);})[_0x82f3('0x1d')](function(_0x115b92){_0x36666d(_0x115b92);});});};module[_0x82f3('0x1e')]=function(_0x11d076,_0x507ad9){var _0x2a9a5f=_0x11d076[_0x82f3('0x1f')];return _0x11d076['define']('VoiceChanSpy',attributes,{'tableName':_0x82f3('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a3982,_0x144c24,_0x42344c){return getChanSpyPromise(_0x2a9a5f,_0x5a3982)[_0x82f3('0x1c')](function(_0x4d861b){if(_0x4d861b&&_0x4d861b[_0x82f3('0x21')]){return _0x2a9a5f[_0x82f3('0x22')][_0x82f3('0x23')](_0x4d861b);}})[_0x82f3('0x1c')](function(){_0x42344c();})[_0x82f3('0x1d')](function(_0x48b7d3){_0x42344c(_0x48b7d3);});},'afterUpdate':function(_0x405f1c,_0x3c8980,_0xd09d09){return _0x2a9a5f['VoiceExtension'][_0x82f3('0x24')]({'where':{'ChanSpyId':_0x405f1c['id']}})[_0x82f3('0x1c')](function(){return getChanSpyPromise(_0x2a9a5f,_0x405f1c);})[_0x82f3('0x1c')](function(_0x2352ab){if(_0x2352ab&&_0x2352ab[_0x82f3('0x21')]){return _0x2a9a5f[_0x82f3('0x22')][_0x82f3('0x23')](_0x2352ab);}})[_0x82f3('0x1c')](function(){_0xd09d09();})[_0x82f3('0x1d')](function(_0x3bdc31){_0xd09d09(_0x3bdc31);});},'afterDestroy':function(_0x3da974,_0x365630,_0x20442f){return _0x2a9a5f[_0x82f3('0x22')][_0x82f3('0x24')]({'where':{'ChanSpyId':_0x3da974['id']}})[_0x82f3('0x1c')](function(){_0x20442f();})[_0x82f3('0x1d')](function(_0x2d2ae3){_0x20442f(_0x2d2ae3);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b8b84b9..5d135af 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 _0xae4e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment'];(function(_0x1d4a48,_0x1b289c){var _0x100d67=function(_0x7ba067){while(--_0x7ba067){_0x1d4a48['push'](_0x1d4a48['shift']());}};_0x100d67(++_0x1b289c);}(_0xae4e,0x1b6));var _0xeae4=function(_0x10c8f0,_0xce9f83){_0x10c8f0=_0x10c8f0-0x0;var _0x5e933a=_0xae4e[_0x10c8f0];return _0x5e933a;};'use strict';var _=require(_0xeae4('0x0'));var util=require('util');var moment=require(_0xeae4('0x1'));var BPromise=require('bluebird');var rs=require(_0xeae4('0x2'));var fs=require('fs');var Redis=require(_0xeae4('0x3'));var db=require(_0xeae4('0x4'))['db'];var utils=require(_0xeae4('0x5'));var logger=require(_0xeae4('0x6'))(_0xeae4('0x7'));var config=require(_0xeae4('0x8'));var jayson=require(_0xeae4('0x9'));var client=jayson[_0xeae4('0xa')][_0xeae4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x371a3c,_0x4b248f,_0x3f8a63){return new BPromise(function(_0x274cdd,_0x5b3804){return client[_0xeae4('0xc')](_0x371a3c,_0x3f8a63)['then'](function(_0x4ff382){logger[_0xeae4('0xd')](_0xeae4('0xe'),_0x4b248f,_0xeae4('0xf'));logger[_0xeae4('0x10')](_0xeae4('0x11'),_0x4b248f,_0xeae4('0xf'),JSON['stringify'](_0x4ff382));if(_0x4ff382[_0xeae4('0x12')]){if(_0x4ff382[_0xeae4('0x12')]['code']===0x1f4){logger['error'](_0xeae4('0xe'),_0x4b248f,_0x4ff382[_0xeae4('0x12')][_0xeae4('0x13')]);return _0x5b3804(_0x4ff382[_0xeae4('0x12')][_0xeae4('0x13')]);}logger[_0xeae4('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x4b248f,_0x4ff382[_0xeae4('0x12')]['message']);return _0x274cdd(_0x4ff382[_0xeae4('0x12')]['message']);}else{logger[_0xeae4('0xd')](_0xeae4('0xe'),_0x4b248f,'request\x20sent');_0x274cdd(_0x4ff382[_0xeae4('0x14')][_0xeae4('0x13')]);}})[_0xeae4('0x15')](function(_0x56700a){logger[_0xeae4('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x4b248f,_0x56700a);_0x5b3804(_0x56700a);});});} \ No newline at end of file +var _0xf6e2=['info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','VoiceChanSpy,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6e2,0x106));var _0x2f6e=function(_0xd6a479,_0x1817cc){_0xd6a479=_0xd6a479-0x0;var _0x2a86d9=_0xf6e2[_0xd6a479];return _0x2a86d9;};'use strict';var _=require(_0x2f6e('0x0'));var util=require(_0x2f6e('0x1'));var moment=require('moment');var BPromise=require(_0x2f6e('0x2'));var rs=require(_0x2f6e('0x3'));var fs=require('fs');var Redis=require(_0x2f6e('0x4'));var db=require(_0x2f6e('0x5'))['db'];var utils=require(_0x2f6e('0x6'));var logger=require(_0x2f6e('0x7'))(_0x2f6e('0x8'));var config=require(_0x2f6e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2f6e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e1439,_0x50acf1,_0x1c867f){return new BPromise(function(_0x50abcb,_0x5c19e3){return client['request'](_0x2e1439,_0x1c867f)['then'](function(_0x42d7a9){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x50acf1,_0x2f6e('0xb'));logger[_0x2f6e('0xc')](_0x2f6e('0xd'),_0x50acf1,'request\x20sent',JSON['stringify'](_0x42d7a9));if(_0x42d7a9[_0x2f6e('0xe')]){if(_0x42d7a9[_0x2f6e('0xe')][_0x2f6e('0xf')]===0x1f4){logger[_0x2f6e('0xe')](_0x2f6e('0x10'),_0x50acf1,_0x42d7a9[_0x2f6e('0xe')][_0x2f6e('0x11')]);return _0x5c19e3(_0x42d7a9['error'][_0x2f6e('0x11')]);}logger[_0x2f6e('0xe')](_0x2f6e('0x10'),_0x50acf1,_0x42d7a9[_0x2f6e('0xe')][_0x2f6e('0x11')]);return _0x50abcb(_0x42d7a9[_0x2f6e('0xe')][_0x2f6e('0x11')]);}else{logger[_0x2f6e('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x50acf1,_0x2f6e('0xb'));_0x50abcb(_0x42d7a9['result'][_0x2f6e('0x11')]);}})[_0x2f6e('0x13')](function(_0x3b74ce){logger['error'](_0x2f6e('0x10'),_0x50acf1,_0x3b74ce);_0x5c19e3(_0x3b74ce);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 0f45020..c5ad7ca 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 _0x7a2c=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','put','/:id','delete','destroy'];(function(_0x4d025f,_0xbc069d){var _0x52f15c=function(_0x45227f){while(--_0x45227f){_0x4d025f['push'](_0x4d025f['shift']());}};_0x52f15c(++_0xbc069d);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x5b46a2,_0x5964bb){_0x5b46a2=_0x5b46a2-0x0;var _0x4d69d4=_0x7a2c[_0x5b46a2];return _0x4d69d4;};'use strict';var multer=require(_0xc7a2('0x0'));var util=require('util');var path=require(_0xc7a2('0x1'));var timeout=require(_0xc7a2('0x2'));var express=require(_0xc7a2('0x3'));var router=express[_0xc7a2('0x4')]();var fs_extra=require(_0xc7a2('0x5'));var auth=require(_0xc7a2('0x6'));var interaction=require(_0xc7a2('0x7'));var config=require(_0xc7a2('0x8'));var controller=require('./voiceContext.controller');router[_0xc7a2('0x9')]('/',auth[_0xc7a2('0xa')](),controller['index']);router['get']('/:id',auth[_0xc7a2('0xa')](),controller[_0xc7a2('0xb')]);router[_0xc7a2('0xc')]('/',auth[_0xc7a2('0xa')](),controller['create']);router[_0xc7a2('0xd')](_0xc7a2('0xe'),auth[_0xc7a2('0xa')](),controller['update']);router[_0xc7a2('0xf')]('/:id',auth[_0xc7a2('0xa')](),controller[_0xc7a2('0x10')]);module[_0xc7a2('0x11')]=router; \ No newline at end of file +var _0x68fc=['delete','destroy','exports','multer','util','path','Router','../../components/auth/service','./voiceContext.controller','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x68fc,0xa5));var _0xc68f=function(_0x23e9f8,_0x347bc1){_0x23e9f8=_0x23e9f8-0x0;var _0x33b12b=_0x68fc[_0x23e9f8];return _0x33b12b;};'use strict';var multer=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var path=require(_0xc68f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc68f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc68f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc68f('0x5'));router[_0xc68f('0x6')]('/',auth[_0xc68f('0x7')](),controller[_0xc68f('0x8')]);router['get']('/:id',auth[_0xc68f('0x7')](),controller[_0xc68f('0x9')]);router[_0xc68f('0xa')]('/',auth[_0xc68f('0x7')](),controller[_0xc68f('0xb')]);router[_0xc68f('0xc')](_0xc68f('0xd'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xe')]);router[_0xc68f('0xf')]('/:id',auth[_0xc68f('0x7')](),controller[_0xc68f('0x10')]);module[_0xc68f('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 7f20529..2fab68b 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 _0x3e74=['name','sequelize','STRING'];(function(_0x18fd5e,_0x27c890){var _0x5021d4=function(_0x525288){while(--_0x525288){_0x18fd5e['push'](_0x18fd5e['shift']());}};_0x5021d4(++_0x27c890);}(_0x3e74,0x175));var _0x43e7=function(_0xae8d20,_0x4f822d){_0xae8d20=_0xae8d20-0x0;var _0x5be68a=_0x3e74[_0xae8d20];return _0x5be68a;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x288536,_0x369b51){var _0x525e94=function(_0x2fe9db){while(--_0x2fe9db){_0x288536['push'](_0x288536['shift']());}};_0x525e94(++_0x369b51);}(_0x3e74,0x175));var _0x43e7=function(_0x2379af,_0x1a5e34){_0x2379af=_0x2379af-0x0;var _0x5e191b=_0x3e74[_0x2379af];return _0x5e191b;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'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 281260b..3058a0d 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 _0xe14b=['json','undefined','count','offset','Content-Range','apply','reject','save','update','then','get','destroy','sendStatus','name','send','VoiceContext','rawAttributes','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','show','params','find','create','body','findAll','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','render','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end'];(function(_0x5170e0,_0x1856da){var _0xc35c46=function(_0x4befef){while(--_0x4befef){_0x5170e0['push'](_0x5170e0['shift']());}};_0xc35c46(++_0x1856da);}(_0xe14b,0x17c));var _0xbe14=function(_0xfdfb23,_0x4ac186){_0xfdfb23=_0xfdfb23-0x0;var _0x2c35f8=_0xe14b[_0xfdfb23];return _0x2c35f8;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require(_0xbe14('0x2'));var jsonpatch=require(_0xbe14('0x3'));var rp=require(_0xbe14('0x4'));var moment=require(_0xbe14('0x5'));var BPromise=require(_0xbe14('0x6'));var Mustache=require(_0xbe14('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbe14('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe14('0x9'));var _=require(_0xbe14('0xa'));var squel=require(_0xbe14('0xb'));var crypto=require(_0xbe14('0xc'));var jsforce=require(_0xbe14('0xd'));var deskjs=require(_0xbe14('0xe'));var toCsv=require(_0xbe14('0x8'));var querystring=require(_0xbe14('0xf'));var Papa=require(_0xbe14('0x10'));var Redis=require(_0xbe14('0x11'));var authService=require(_0xbe14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbe14('0x13'));var hardwareService=require(_0xbe14('0x14'));var logger=require(_0xbe14('0x15'))(_0xbe14('0x16'));var utils=require(_0xbe14('0x17'));var config=require(_0xbe14('0x18'));var licenseUtil=require(_0xbe14('0x19'));var db=require(_0xbe14('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xbe14('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xaa6373,_0x5e4948,_0x4cb0e9,_0x1aca4d){return new BPromise(function(_0x3f20d8,_0x145215){var _0x11b92c=_0x1aca4d||client;return _0x11b92c[_0xbe14('0x1c')](_0xaa6373,_0x4cb0e9)['then'](function(_0x2d364f){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x5e4948,_0xbe14('0x1f'));logger[_0xbe14('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5e4948,_0xbe14('0x1f'),JSON[_0xbe14('0x21')](_0x2d364f));if(_0x2d364f['error']){if(_0x2d364f[_0xbe14('0x22')][_0xbe14('0x23')]===0x1f4){logger['error'](_0xbe14('0x1e'),_0x5e4948,_0x2d364f[_0xbe14('0x22')][_0xbe14('0x24')]);return _0x145215(_0x2d364f[_0xbe14('0x22')][_0xbe14('0x24')]);}logger[_0xbe14('0x22')](_0xbe14('0x1e'),_0x5e4948,_0x2d364f[_0xbe14('0x22')][_0xbe14('0x24')]);return _0x3f20d8(_0x2d364f['error']['message']);}else{logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x5e4948,_0xbe14('0x1f'));_0x3f20d8(_0x2d364f['result'][_0xbe14('0x24')]);}})[_0xbe14('0x25')](function(_0x4fedbf){logger[_0xbe14('0x22')](_0xbe14('0x1e'),_0x5e4948,_0x4fedbf);_0x145215(_0x4fedbf);});});}function respondWithStatusCode(_0x2483af,_0x3c79b6){_0x3c79b6=_0x3c79b6||0xcc;return function(_0x1e3828){if(_0x1e3828){return _0x2483af['sendStatus'](_0x3c79b6);}return _0x2483af[_0xbe14('0x26')](_0x3c79b6)[_0xbe14('0x27')]();};}function respondWithResult(_0x2b19ae,_0x4427fb){_0x4427fb=_0x4427fb||0xc8;return function(_0x423d0f){if(_0x423d0f){return _0x2b19ae[_0xbe14('0x26')](_0x4427fb)[_0xbe14('0x28')](_0x423d0f);}};}function respondWithFilteredResult(_0x2bbf7a,_0x1df1bb){return function(_0x41169e){if(_0x41169e){var _0x354334=typeof _0x1df1bb['offset']===_0xbe14('0x29')&&typeof _0x1df1bb['limit']===_0xbe14('0x29');var _0x7164c5=_0x41169e[_0xbe14('0x2a')];var _0x5b95a1=_0x354334?0x0:_0x1df1bb[_0xbe14('0x2b')];var _0x3688fe=_0x354334?_0x41169e[_0xbe14('0x2a')]:_0x1df1bb[_0xbe14('0x2b')]+_0x1df1bb['limit'];var _0x1a5044;if(_0x3688fe>=_0x7164c5){_0x3688fe=_0x7164c5;_0x1a5044=0xc8;}else{_0x1a5044=0xce;}_0x2bbf7a['status'](_0x1a5044);return _0x2bbf7a['set'](_0xbe14('0x2c'),_0x5b95a1+'-'+_0x3688fe+'/'+_0x7164c5)[_0xbe14('0x28')](_0x41169e);}return null;};}function patchUpdates(_0x1fd25){return function(_0x321784){try{jsonpatch[_0xbe14('0x2d')](_0x321784,_0x1fd25,!![]);}catch(_0x1294a9){return BPromise[_0xbe14('0x2e')](_0x1294a9);}return _0x321784[_0xbe14('0x2f')]();};}function saveUpdates(_0x538dbd,_0x3bd766){return function(_0x5bb1ff){if(_0x5bb1ff){return _0x5bb1ff[_0xbe14('0x30')](_0x538dbd)[_0xbe14('0x31')](function(_0x2c639f){return _0x2c639f;});}return null;};}function removeEntity(_0x377c09,_0x220cf5){return function(_0x25522b){if(_0x25522b){return _0x25522b['destroy']()[_0xbe14('0x31')](function(){var _0x1d31ec=_0x25522b[_0xbe14('0x32')]({'plain':!![]});var _0x1bb8a7='Contexts';return db['UserProfileResource'][_0xbe14('0x33')]({'where':{'type':_0x1bb8a7,'resourceId':_0x1d31ec['id']}})[_0xbe14('0x31')](function(){return _0x25522b;});})['then'](function(){_0x377c09['status'](0xcc)[_0xbe14('0x27')]();});}};}function handleEntityNotFound(_0x3bcd15,_0xbf77cd){return function(_0x528959){if(!_0x528959){_0x3bcd15[_0xbe14('0x34')](0x194);}return _0x528959;};}function handleError(_0x20e569,_0x245e56){_0x245e56=_0x245e56||0x1f4;return function(_0x632136){logger[_0xbe14('0x22')](_0x632136['stack']);if(_0x632136[_0xbe14('0x35')]){delete _0x632136[_0xbe14('0x35')];}_0x20e569[_0xbe14('0x26')](_0x245e56)[_0xbe14('0x36')](_0x632136);};}exports['index']=function(_0x461a17,_0x3aad18){var _0x2cdaf8={},_0xc0843a={},_0x4da11b={'count':0x0,'rows':[]};var _0x58b8c9=_['map'](db[_0xbe14('0x37')][_0xbe14('0x38')],function(_0x1be87e){return{'name':_0x1be87e['fieldName'],'type':_0x1be87e['type'][_0xbe14('0x39')]};});_0xc0843a[_0xbe14('0x3a')]=_[_0xbe14('0x3b')](_0x58b8c9,_0xbe14('0x35'));_0xc0843a[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x461a17[_0xbe14('0x3c')]);_0xc0843a['filters']=_[_0xbe14('0x3e')](_0xc0843a[_0xbe14('0x3a')],_0xc0843a['query']);_0x2cdaf8['attributes']=_[_0xbe14('0x3e')](_0xc0843a[_0xbe14('0x3a')],qs[_0xbe14('0x3f')](_0x461a17[_0xbe14('0x3c')][_0xbe14('0x3f')]));_0x2cdaf8['attributes']=_0x2cdaf8[_0xbe14('0x40')][_0xbe14('0x41')]?_0x2cdaf8['attributes']:_0xc0843a[_0xbe14('0x3a')];if(!_0x461a17[_0xbe14('0x3c')][_0xbe14('0x42')](_0xbe14('0x43'))){_0x2cdaf8[_0xbe14('0x44')]=qs[_0xbe14('0x44')](_0x461a17[_0xbe14('0x3c')][_0xbe14('0x44')]);_0x2cdaf8[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x461a17[_0xbe14('0x3c')][_0xbe14('0x2b')]);}_0x2cdaf8[_0xbe14('0x45')]=qs['sort'](_0x461a17[_0xbe14('0x3c')][_0xbe14('0x46')]);_0x2cdaf8[_0xbe14('0x47')]=qs[_0xbe14('0x48')](_[_0xbe14('0x49')](_0x461a17['query'],_0xc0843a['filters']),_0x58b8c9);if(_0x461a17['query'][_0xbe14('0x4a')]){_0x2cdaf8[_0xbe14('0x47')]=_['merge'](_0x2cdaf8[_0xbe14('0x47')],{'$or':_[_0xbe14('0x3b')](_0x58b8c9,function(_0x7385e){if(_0x7385e[_0xbe14('0x4b')]!==_0xbe14('0x4c')){var _0x57c626={};_0x57c626[_0x7385e[_0xbe14('0x35')]]={'$like':'%'+_0x461a17[_0xbe14('0x3c')]['filter']+'%'};return _0x57c626;}})});}_0x2cdaf8=_[_0xbe14('0x4d')]({},_0x2cdaf8,_0x461a17[_0xbe14('0x4e')]);var _0x464d1a={'where':_0x2cdaf8[_0xbe14('0x47')]};return db['VoiceContext'][_0xbe14('0x2a')](_0x464d1a)[_0xbe14('0x31')](function(_0x5e50fa){_0x4da11b[_0xbe14('0x2a')]=_0x5e50fa;if(_0x461a17[_0xbe14('0x3c')][_0xbe14('0x4f')]){_0x2cdaf8[_0xbe14('0x50')]=[{'all':!![]}];}return db[_0xbe14('0x37')]['findAll'](_0x2cdaf8);})['then'](function(_0x1d4106){_0x4da11b['rows']=_0x1d4106;return _0x4da11b;})[_0xbe14('0x31')](respondWithFilteredResult(_0x3aad18,_0x2cdaf8))[_0xbe14('0x25')](handleError(_0x3aad18,null));};exports[_0xbe14('0x51')]=function(_0x5db116,_0x385d25){var _0x13e07f={'raw':![],'where':{'id':_0x5db116[_0xbe14('0x52')]['id']}},_0x1321e3={};_0x1321e3[_0xbe14('0x3a')]=_[_0xbe14('0x3d')](db[_0xbe14('0x37')][_0xbe14('0x38')]);_0x1321e3[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x5db116['query']);_0x1321e3['filters']=_[_0xbe14('0x3e')](_0x1321e3['model'],_0x1321e3[_0xbe14('0x3c')]);_0x13e07f[_0xbe14('0x40')]=_[_0xbe14('0x3e')](_0x1321e3['model'],qs[_0xbe14('0x3f')](_0x5db116[_0xbe14('0x3c')]['fields']));_0x13e07f['attributes']=_0x13e07f[_0xbe14('0x40')][_0xbe14('0x41')]?_0x13e07f['attributes']:_0x1321e3[_0xbe14('0x3a')];if(_0x5db116[_0xbe14('0x3c')][_0xbe14('0x4f')]){_0x13e07f[_0xbe14('0x50')]=[{'all':!![]}];}_0x13e07f=_[_0xbe14('0x4d')]({},_0x13e07f,_0x5db116[_0xbe14('0x4e')]);return db[_0xbe14('0x37')][_0xbe14('0x53')](_0x13e07f)[_0xbe14('0x31')](handleEntityNotFound(_0x385d25,null))['then'](respondWithResult(_0x385d25,null))[_0xbe14('0x25')](handleError(_0x385d25,null));};exports['create']=function(_0x4be170,_0x4fc9e9,_0x1077ff){var _0x5c4ba8;return db['VoiceContext'][_0xbe14('0x54')](_0x4be170[_0xbe14('0x55')],{'raw':!![]})['then'](function(_0x548408){_0x5c4ba8=_0x548408;return db[_0xbe14('0x37')][_0xbe14('0x56')]({'raw':!![]});})[_0xbe14('0x31')](function(_0x4cf696){var _0x2741aa=fs['readFileSync'](path[_0xbe14('0x57')](config[_0xbe14('0x58')],_0xbe14('0x59')),_0xbe14('0x5a'));var _0x124483=ejs['render'](_0x2741aa,{'contexts':_0x4cf696||[]});fs[_0xbe14('0x5b')](_0xbe14('0x5c'),_0x124483);})[_0xbe14('0x31')](function(){return respondWithRpcPromise(_0xbe14('0x5d'),'create',{'module':_0xbe14('0x5e')});})['then'](function(){var _0x498148=_0x4be170[_0xbe14('0x5f')]['get']({'plain':!![]});if(!_0x498148)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x498148[_0xbe14('0x60')]===_0xbe14('0x5f')){var _0x3cfa31=_0x5c4ba8[_0xbe14('0x32')]({'plain':!![]});return db[_0xbe14('0x61')][_0xbe14('0x53')]({'where':{'name':_0xbe14('0x62'),'userProfileId':_0x498148[_0xbe14('0x63')]},'raw':!![]})['then'](function(_0x4290f5){if(_0x4290f5&&_0x4290f5[_0xbe14('0x64')]===0x0){return db[_0xbe14('0x65')]['create']({'name':_0x3cfa31[_0xbe14('0x35')],'resourceId':_0x3cfa31['id'],'type':_0x4290f5[_0xbe14('0x35')],'sectionId':_0x4290f5['id']},{})[_0xbe14('0x31')](function(){return _0x5c4ba8;});}else{return _0x5c4ba8;}})['catch'](function(_0x2ebafc){logger['error'](_0xbe14('0x66'),_0x2ebafc);throw _0x2ebafc;});}return _0x5c4ba8;})[_0xbe14('0x31')](respondWithResult(_0x4fc9e9,0xc9))[_0xbe14('0x25')](handleError(_0x4fc9e9,null));};exports['update']=function(_0x491b07,_0x118e8c,_0x502a86){var _0x3fedf9;return db[_0xbe14('0x37')][_0xbe14('0x53')]({'where':{'id':_0x491b07[_0xbe14('0x52')]['id']}})[_0xbe14('0x31')](handleEntityNotFound(_0x118e8c,null))['then'](saveUpdates(_0x491b07[_0xbe14('0x55')],null))[_0xbe14('0x31')](function(_0x17784a){if(_0x17784a){_0x3fedf9=_0x17784a;return db[_0xbe14('0x37')][_0xbe14('0x56')]({'raw':!![]});}})[_0xbe14('0x31')](function(_0x4ed027){var _0x2250bb=fs[_0xbe14('0x67')](path[_0xbe14('0x57')](config[_0xbe14('0x58')],_0xbe14('0x59')),_0xbe14('0x5a'));var _0x4ec51e=ejs[_0xbe14('0x68')](_0x2250bb,{'contexts':_0x4ed027||[]});fs['writeFileSync'](_0xbe14('0x5c'),_0x4ec51e);})['then'](function(){return respondWithRpcPromise(_0xbe14('0x5d'),_0xbe14('0x30'),{'module':_0xbe14('0x5e')});})[_0xbe14('0x31')](function(){return _0x3fedf9;})[_0xbe14('0x31')](respondWithResult(_0x118e8c,null))[_0xbe14('0x25')](handleError(_0x118e8c,null));};exports['destroy']=function(_0x2735a0,_0x29891c,_0x4cb0be){var _0x2399dc;return db[_0xbe14('0x37')][_0xbe14('0x53')]({'where':{'id':_0x2735a0['params']['id']}})[_0xbe14('0x31')](handleEntityNotFound(_0x29891c,null))[_0xbe14('0x31')](removeEntity(_0x29891c,null))['then'](function(){return db[_0xbe14('0x37')]['findAll']({'raw':!![]});})[_0xbe14('0x31')](function(_0x478c8e){var _0x26f1c7=fs[_0xbe14('0x67')](path[_0xbe14('0x57')](config['root'],_0xbe14('0x59')),'utf8');var _0x2b601e=ejs['render'](_0x26f1c7,{'contexts':_0x478c8e});fs['writeFileSync'](_0xbe14('0x5c'),_0x2b601e);return respondWithRpcPromise(_0xbe14('0x5d'),_0xbe14('0x33'),{'module':_0xbe14('0x5e')});})[_0xbe14('0x25')](handleError(_0x29891c,null));}; \ No newline at end of file +var _0xfb41=['nolimit','order','sort','filter','merge','where','options','findAll','rows','catch','show','params','intersection','includeAll','include','find','create','body','readFileSync','root','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','join','server/files/templates/context.ejs','utf8','writeFileSync','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','json','undefined','count','offset','limit','status','set','apply','save','then','destroy','get','Contexts','UserProfileResource','stack','name','index','map','VoiceContext','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty'];(function(_0x2ceadd,_0x563d9b){var _0x1114d5=function(_0x2c56f5){while(--_0x2c56f5){_0x2ceadd['push'](_0x2ceadd['shift']());}};_0x1114d5(++_0x563d9b);}(_0xfb41,0xea));var _0x1fb4=function(_0x10c778,_0x58ef9e){_0x10c778=_0x10c778-0x0;var _0x4e9fb2=_0xfb41[_0x10c778];return _0x4e9fb2;};'use strict';var emlformat=require(_0x1fb4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fb4('0x1'));var jsonpatch=require(_0x1fb4('0x2'));var rp=require(_0x1fb4('0x3'));var moment=require('moment');var BPromise=require(_0x1fb4('0x4'));var Mustache=require(_0x1fb4('0x5'));var util=require(_0x1fb4('0x6'));var path=require(_0x1fb4('0x7'));var sox=require('sox');var csv=require(_0x1fb4('0x8'));var ejs=require(_0x1fb4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1fb4('0xa'));var squel=require(_0x1fb4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1fb4('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1fb4('0xd'));var Redis=require(_0x1fb4('0xe'));var authService=require(_0x1fb4('0xf'));var qs=require(_0x1fb4('0x10'));var as=require(_0x1fb4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1fb4('0x12'));var utils=require(_0x1fb4('0x13'));var config=require(_0x1fb4('0x14'));var licenseUtil=require(_0x1fb4('0x15'));var db=require(_0x1fb4('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1fb4('0x17')][_0x1fb4('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x25c861,_0x182125,_0x509261,_0x50f9ed){return new BPromise(function(_0x498fce,_0x2916c5){var _0x5bbc24=_0x50f9ed||client;return _0x5bbc24['request'](_0x25c861,_0x509261)['then'](function(_0x370374){logger[_0x1fb4('0x19')](_0x1fb4('0x1a'),_0x182125,_0x1fb4('0x1b'));logger[_0x1fb4('0x1c')](_0x1fb4('0x1d'),_0x182125,_0x1fb4('0x1b'),JSON[_0x1fb4('0x1e')](_0x370374));if(_0x370374[_0x1fb4('0x1f')]){if(_0x370374['error'][_0x1fb4('0x20')]===0x1f4){logger['error'](_0x1fb4('0x1a'),_0x182125,_0x370374[_0x1fb4('0x1f')][_0x1fb4('0x21')]);return _0x2916c5(_0x370374[_0x1fb4('0x1f')]['message']);}logger[_0x1fb4('0x1f')](_0x1fb4('0x1a'),_0x182125,_0x370374['error'][_0x1fb4('0x21')]);return _0x498fce(_0x370374[_0x1fb4('0x1f')]['message']);}else{logger['info'](_0x1fb4('0x1a'),_0x182125,_0x1fb4('0x1b'));_0x498fce(_0x370374[_0x1fb4('0x22')][_0x1fb4('0x21')]);}})['catch'](function(_0x2fb430){logger[_0x1fb4('0x1f')](_0x1fb4('0x1a'),_0x182125,_0x2fb430);_0x2916c5(_0x2fb430);});});}function respondWithStatusCode(_0x5a5d86,_0x59152c){_0x59152c=_0x59152c||0xcc;return function(_0x103ed2){if(_0x103ed2){return _0x5a5d86[_0x1fb4('0x23')](_0x59152c);}return _0x5a5d86['status'](_0x59152c)[_0x1fb4('0x24')]();};}function respondWithResult(_0x2c75e2,_0x30f940){_0x30f940=_0x30f940||0xc8;return function(_0x5e574f){if(_0x5e574f){return _0x2c75e2['status'](_0x30f940)[_0x1fb4('0x25')](_0x5e574f);}};}function respondWithFilteredResult(_0x539f4b,_0x3ede9f){return function(_0x407aa3){if(_0x407aa3){var _0x17e193=typeof _0x3ede9f['offset']===_0x1fb4('0x26')&&typeof _0x3ede9f['limit']===_0x1fb4('0x26');var _0x4d4d69=_0x407aa3[_0x1fb4('0x27')];var _0x5286ef=_0x17e193?0x0:_0x3ede9f[_0x1fb4('0x28')];var _0x1e52ce=_0x17e193?_0x407aa3[_0x1fb4('0x27')]:_0x3ede9f[_0x1fb4('0x28')]+_0x3ede9f[_0x1fb4('0x29')];var _0x5043d1;if(_0x1e52ce>=_0x4d4d69){_0x1e52ce=_0x4d4d69;_0x5043d1=0xc8;}else{_0x5043d1=0xce;}_0x539f4b[_0x1fb4('0x2a')](_0x5043d1);return _0x539f4b[_0x1fb4('0x2b')]('Content-Range',_0x5286ef+'-'+_0x1e52ce+'/'+_0x4d4d69)[_0x1fb4('0x25')](_0x407aa3);}return null;};}function patchUpdates(_0x1ce15a){return function(_0x3daa9d){try{jsonpatch[_0x1fb4('0x2c')](_0x3daa9d,_0x1ce15a,!![]);}catch(_0x4c4a02){return BPromise['reject'](_0x4c4a02);}return _0x3daa9d[_0x1fb4('0x2d')]();};}function saveUpdates(_0x39780e,_0x1a7ffc){return function(_0x99205a){if(_0x99205a){return _0x99205a['update'](_0x39780e)[_0x1fb4('0x2e')](function(_0x1429c9){return _0x1429c9;});}return null;};}function removeEntity(_0x720c19,_0x4118c1){return function(_0x297b47){if(_0x297b47){return _0x297b47[_0x1fb4('0x2f')]()[_0x1fb4('0x2e')](function(){var _0x4047a3=_0x297b47[_0x1fb4('0x30')]({'plain':!![]});var _0x1923b=_0x1fb4('0x31');return db[_0x1fb4('0x32')][_0x1fb4('0x2f')]({'where':{'type':_0x1923b,'resourceId':_0x4047a3['id']}})[_0x1fb4('0x2e')](function(){return _0x297b47;});})[_0x1fb4('0x2e')](function(){_0x720c19['status'](0xcc)[_0x1fb4('0x24')]();});}};}function handleEntityNotFound(_0x3eb7b0,_0x3093f6){return function(_0x1316e3){if(!_0x1316e3){_0x3eb7b0[_0x1fb4('0x23')](0x194);}return _0x1316e3;};}function handleError(_0x5480d6,_0x1c60a4){_0x1c60a4=_0x1c60a4||0x1f4;return function(_0x454c3f){logger[_0x1fb4('0x1f')](_0x454c3f[_0x1fb4('0x33')]);if(_0x454c3f[_0x1fb4('0x34')]){delete _0x454c3f[_0x1fb4('0x34')];}_0x5480d6[_0x1fb4('0x2a')](_0x1c60a4)['send'](_0x454c3f);};}exports[_0x1fb4('0x35')]=function(_0xe6a018,_0x5b86ec){var _0x496b8b={},_0x14f853={},_0x157dce={'count':0x0,'rows':[]};var _0x5646d9=_[_0x1fb4('0x36')](db[_0x1fb4('0x37')]['rawAttributes'],function(_0x588312){return{'name':_0x588312['fieldName'],'type':_0x588312[_0x1fb4('0x38')][_0x1fb4('0x39')]};});_0x14f853['model']=_[_0x1fb4('0x36')](_0x5646d9,_0x1fb4('0x34'));_0x14f853[_0x1fb4('0x3a')]=_[_0x1fb4('0x3b')](_0xe6a018[_0x1fb4('0x3a')]);_0x14f853[_0x1fb4('0x3c')]=_['intersection'](_0x14f853[_0x1fb4('0x3d')],_0x14f853['query']);_0x496b8b[_0x1fb4('0x3e')]=_['intersection'](_0x14f853[_0x1fb4('0x3d')],qs[_0x1fb4('0x3f')](_0xe6a018[_0x1fb4('0x3a')][_0x1fb4('0x3f')]));_0x496b8b[_0x1fb4('0x3e')]=_0x496b8b[_0x1fb4('0x3e')][_0x1fb4('0x40')]?_0x496b8b[_0x1fb4('0x3e')]:_0x14f853['model'];if(!_0xe6a018['query'][_0x1fb4('0x41')](_0x1fb4('0x42'))){_0x496b8b[_0x1fb4('0x29')]=qs['limit'](_0xe6a018[_0x1fb4('0x3a')][_0x1fb4('0x29')]);_0x496b8b[_0x1fb4('0x28')]=qs[_0x1fb4('0x28')](_0xe6a018['query'][_0x1fb4('0x28')]);}_0x496b8b[_0x1fb4('0x43')]=qs[_0x1fb4('0x44')](_0xe6a018[_0x1fb4('0x3a')]['sort']);_0x496b8b['where']=qs[_0x1fb4('0x3c')](_['pick'](_0xe6a018[_0x1fb4('0x3a')],_0x14f853[_0x1fb4('0x3c')]),_0x5646d9);if(_0xe6a018['query'][_0x1fb4('0x45')]){_0x496b8b['where']=_[_0x1fb4('0x46')](_0x496b8b[_0x1fb4('0x47')],{'$or':_['map'](_0x5646d9,function(_0x42f193){if(_0x42f193[_0x1fb4('0x38')]!=='VIRTUAL'){var _0x24251f={};_0x24251f[_0x42f193[_0x1fb4('0x34')]]={'$like':'%'+_0xe6a018[_0x1fb4('0x3a')][_0x1fb4('0x45')]+'%'};return _0x24251f;}})});}_0x496b8b=_[_0x1fb4('0x46')]({},_0x496b8b,_0xe6a018[_0x1fb4('0x48')]);var _0x53bdce={'where':_0x496b8b['where']};return db[_0x1fb4('0x37')][_0x1fb4('0x27')](_0x53bdce)['then'](function(_0x43911c){_0x157dce['count']=_0x43911c;if(_0xe6a018[_0x1fb4('0x3a')]['includeAll']){_0x496b8b['include']=[{'all':!![]}];}return db[_0x1fb4('0x37')][_0x1fb4('0x49')](_0x496b8b);})[_0x1fb4('0x2e')](function(_0x332066){_0x157dce[_0x1fb4('0x4a')]=_0x332066;return _0x157dce;})[_0x1fb4('0x2e')](respondWithFilteredResult(_0x5b86ec,_0x496b8b))[_0x1fb4('0x4b')](handleError(_0x5b86ec,null));};exports[_0x1fb4('0x4c')]=function(_0x47eb48,_0x3019f0){var _0x590231={'raw':![],'where':{'id':_0x47eb48[_0x1fb4('0x4d')]['id']}},_0x2c9afe={};_0x2c9afe[_0x1fb4('0x3d')]=_['keys'](db[_0x1fb4('0x37')]['rawAttributes']);_0x2c9afe['query']=_[_0x1fb4('0x3b')](_0x47eb48[_0x1fb4('0x3a')]);_0x2c9afe[_0x1fb4('0x3c')]=_[_0x1fb4('0x4e')](_0x2c9afe[_0x1fb4('0x3d')],_0x2c9afe[_0x1fb4('0x3a')]);_0x590231['attributes']=_[_0x1fb4('0x4e')](_0x2c9afe[_0x1fb4('0x3d')],qs[_0x1fb4('0x3f')](_0x47eb48['query'][_0x1fb4('0x3f')]));_0x590231[_0x1fb4('0x3e')]=_0x590231[_0x1fb4('0x3e')][_0x1fb4('0x40')]?_0x590231['attributes']:_0x2c9afe[_0x1fb4('0x3d')];if(_0x47eb48[_0x1fb4('0x3a')][_0x1fb4('0x4f')]){_0x590231[_0x1fb4('0x50')]=[{'all':!![]}];}_0x590231=_[_0x1fb4('0x46')]({},_0x590231,_0x47eb48['options']);return db[_0x1fb4('0x37')][_0x1fb4('0x51')](_0x590231)[_0x1fb4('0x2e')](handleEntityNotFound(_0x3019f0,null))[_0x1fb4('0x2e')](respondWithResult(_0x3019f0,null))[_0x1fb4('0x4b')](handleError(_0x3019f0,null));};exports[_0x1fb4('0x52')]=function(_0x31cdac,_0x26b8b8,_0x4e4c82){var _0x4b87d5;return db[_0x1fb4('0x37')][_0x1fb4('0x52')](_0x31cdac[_0x1fb4('0x53')],{'raw':!![]})[_0x1fb4('0x2e')](function(_0x539060){_0x4b87d5=_0x539060;return db[_0x1fb4('0x37')]['findAll']({'raw':!![]});})[_0x1fb4('0x2e')](function(_0x5d5143){var _0x3892b1=fs[_0x1fb4('0x54')](path['join'](config[_0x1fb4('0x55')],'server/files/templates/context.ejs'),'utf8');var _0x489332=ejs[_0x1fb4('0x56')](_0x3892b1,{'contexts':_0x5d5143||[]});fs['writeFileSync'](_0x1fb4('0x57'),_0x489332);})[_0x1fb4('0x2e')](function(){return respondWithRpcPromise(_0x1fb4('0x58'),_0x1fb4('0x52'),{'module':_0x1fb4('0x59')});})['then'](function(){var _0x3f4f11=_0x31cdac['user'][_0x1fb4('0x30')]({'plain':!![]});if(!_0x3f4f11)throw new Error(_0x1fb4('0x5a'));if(_0x3f4f11[_0x1fb4('0x5b')]==='user'){var _0x522e8f=_0x4b87d5['get']({'plain':!![]});return db[_0x1fb4('0x5c')][_0x1fb4('0x51')]({'where':{'name':_0x1fb4('0x31'),'userProfileId':_0x3f4f11[_0x1fb4('0x5d')]},'raw':!![]})[_0x1fb4('0x2e')](function(_0x4eceb3){if(_0x4eceb3&&_0x4eceb3[_0x1fb4('0x5e')]===0x0){return db[_0x1fb4('0x32')]['create']({'name':_0x522e8f['name'],'resourceId':_0x522e8f['id'],'type':_0x4eceb3[_0x1fb4('0x34')],'sectionId':_0x4eceb3['id']},{})[_0x1fb4('0x2e')](function(){return _0x4b87d5;});}else{return _0x4b87d5;}})[_0x1fb4('0x4b')](function(_0x44f29a){logger[_0x1fb4('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44f29a);throw _0x44f29a;});}return _0x4b87d5;})['then'](respondWithResult(_0x26b8b8,0xc9))[_0x1fb4('0x4b')](handleError(_0x26b8b8,null));};exports['update']=function(_0x244eb8,_0x337660,_0x103769){var _0x5547d7;return db[_0x1fb4('0x37')][_0x1fb4('0x51')]({'where':{'id':_0x244eb8['params']['id']}})['then'](handleEntityNotFound(_0x337660,null))[_0x1fb4('0x2e')](saveUpdates(_0x244eb8[_0x1fb4('0x53')],null))[_0x1fb4('0x2e')](function(_0x536486){if(_0x536486){_0x5547d7=_0x536486;return db[_0x1fb4('0x37')][_0x1fb4('0x49')]({'raw':!![]});}})[_0x1fb4('0x2e')](function(_0x2cb0cf){var _0x3d7683=fs[_0x1fb4('0x54')](path[_0x1fb4('0x5f')](config[_0x1fb4('0x55')],_0x1fb4('0x60')),_0x1fb4('0x61'));var _0x5b2715=ejs[_0x1fb4('0x56')](_0x3d7683,{'contexts':_0x2cb0cf||[]});fs[_0x1fb4('0x62')](_0x1fb4('0x57'),_0x5b2715);})[_0x1fb4('0x2e')](function(){return respondWithRpcPromise(_0x1fb4('0x58'),_0x1fb4('0x63'),{'module':_0x1fb4('0x59')});})['then'](function(){return _0x5547d7;})['then'](respondWithResult(_0x337660,null))[_0x1fb4('0x4b')](handleError(_0x337660,null));};exports[_0x1fb4('0x2f')]=function(_0x5cd1ca,_0x6eb78f,_0x40e932){var _0x9f309b;return db[_0x1fb4('0x37')]['find']({'where':{'id':_0x5cd1ca[_0x1fb4('0x4d')]['id']}})[_0x1fb4('0x2e')](handleEntityNotFound(_0x6eb78f,null))[_0x1fb4('0x2e')](removeEntity(_0x6eb78f,null))[_0x1fb4('0x2e')](function(){return db[_0x1fb4('0x37')][_0x1fb4('0x49')]({'raw':!![]});})[_0x1fb4('0x2e')](function(_0x24c5b8){var _0x104233=fs[_0x1fb4('0x54')](path[_0x1fb4('0x5f')](config['root'],'server/files/templates/context.ejs'),_0x1fb4('0x61'));var _0x5ec864=ejs['render'](_0x104233,{'contexts':_0x24c5b8});fs[_0x1fb4('0x62')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5ec864);return respondWithRpcPromise(_0x1fb4('0x58'),_0x1fb4('0x2f'),{'module':_0x1fb4('0x59')});})[_0x1fb4('0x4b')](handleError(_0x6eb78f,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 55c9678..a29e298 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 _0x183c=['voice_contexts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceContext'];(function(_0x521de1,_0x23e812){var _0x49f370=function(_0x183d4e){while(--_0x183d4e){_0x521de1['push'](_0x521de1['shift']());}};_0x49f370(++_0x23e812);}(_0x183c,0xe5));var _0xc183=function(_0x28ef4b,_0x3c5fce){_0x28ef4b=_0x28ef4b-0x0;var _0x1bdcda=_0x183c[_0x28ef4b];return _0x1bdcda;};'use strict';var _=require(_0xc183('0x0'));var util=require(_0xc183('0x1'));var logger=require('../../config/logger')(_0xc183('0x2'));var moment=require(_0xc183('0x3'));var BPromise=require(_0xc183('0x4'));var rp=require(_0xc183('0x5'));var fs=require('fs');var path=require(_0xc183('0x6'));var rimraf=require(_0xc183('0x7'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0xc183('0x8')]=function(_0x15672c,_0x47a4e4){return _0x15672c[_0xc183('0x9')](_0xc183('0xa'),attributes,{'tableName':_0xc183('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5be=['VoiceContext','voice_contexts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0xf5be,0x1ba));var _0xef5b=function(_0x24a41d,_0x2715e6){_0x24a41d=_0x24a41d-0x0;var _0x3eeca8=_0xf5be[_0x24a41d];return _0x3eeca8;};'use strict';var _=require(_0xef5b('0x0'));var util=require(_0xef5b('0x1'));var logger=require('../../config/logger')(_0xef5b('0x2'));var moment=require(_0xef5b('0x3'));var BPromise=require(_0xef5b('0x4'));var rp=require(_0xef5b('0x5'));var fs=require('fs');var path=require(_0xef5b('0x6'));var rimraf=require(_0xef5b('0x7'));var config=require(_0xef5b('0x8'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x26c1c5,_0x42ab8e){return _0x26c1c5['define'](_0xef5b('0x9'),attributes,{'tableName':_0xef5b('0xa'),'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 48da668..f92107d 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 _0x10a5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0x10a5,0x163));var _0x510a=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x10a5[_0x2a0350];return _0x425220;};'use strict';var _=require(_0x510a('0x0'));var util=require(_0x510a('0x1'));var moment=require(_0x510a('0x2'));var BPromise=require(_0x510a('0x3'));var rs=require(_0x510a('0x4'));var fs=require('fs');var Redis=require(_0x510a('0x5'));var db=require(_0x510a('0x6'))['db'];var utils=require(_0x510a('0x7'));var logger=require(_0x510a('0x8'))(_0x510a('0x9'));var config=require(_0x510a('0xa'));var jayson=require(_0x510a('0xb'));var client=jayson[_0x510a('0xc')][_0x510a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4bdf71,_0x5a9ffa,_0x1484a1){return new BPromise(function(_0x1639dc,_0x149a3d){return client[_0x510a('0xe')](_0x4bdf71,_0x1484a1)[_0x510a('0xf')](function(_0x4737d0){logger[_0x510a('0x10')](_0x510a('0x11'),_0x5a9ffa,_0x510a('0x12'));logger['debug'](_0x510a('0x13'),_0x5a9ffa,_0x510a('0x12'),JSON['stringify'](_0x4737d0));if(_0x4737d0[_0x510a('0x14')]){if(_0x4737d0[_0x510a('0x14')][_0x510a('0x15')]===0x1f4){logger[_0x510a('0x14')](_0x510a('0x11'),_0x5a9ffa,_0x4737d0[_0x510a('0x14')][_0x510a('0x16')]);return _0x149a3d(_0x4737d0[_0x510a('0x14')]['message']);}logger[_0x510a('0x14')](_0x510a('0x11'),_0x5a9ffa,_0x4737d0['error']['message']);return _0x1639dc(_0x4737d0['error'][_0x510a('0x16')]);}else{logger[_0x510a('0x10')](_0x510a('0x11'),_0x5a9ffa,_0x510a('0x12'));_0x1639dc(_0x4737d0[_0x510a('0x17')][_0x510a('0x16')]);}})['catch'](function(_0x19f5c4){logger[_0x510a('0x14')]('VoiceContext,\x20%s,\x20%s',_0x5a9ffa,_0x19f5c4);_0x149a3d(_0x19f5c4);});});} \ No newline at end of file +var _0x9803=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','catch','lodash'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x9803,0x113));var _0x3980=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9803[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x3980('0x0'));var util=require(_0x3980('0x1'));var moment=require(_0x3980('0x2'));var BPromise=require(_0x3980('0x3'));var rs=require(_0x3980('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3980('0x5'))['db'];var utils=require(_0x3980('0x6'));var logger=require(_0x3980('0x7'))(_0x3980('0x8'));var config=require(_0x3980('0x9'));var jayson=require(_0x3980('0xa'));var client=jayson['client'][_0x3980('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf59bce,_0x6818f3,_0x1138e7){return new BPromise(function(_0x1f2a6c,_0x3110f5){return client[_0x3980('0xc')](_0xf59bce,_0x1138e7)['then'](function(_0x51631a){logger['info']('VoiceContext,\x20%s,\x20%s',_0x6818f3,'request\x20sent');logger[_0x3980('0xd')](_0x3980('0xe'),_0x6818f3,_0x3980('0xf'),JSON[_0x3980('0x10')](_0x51631a));if(_0x51631a[_0x3980('0x11')]){if(_0x51631a[_0x3980('0x11')][_0x3980('0x12')]===0x1f4){logger['error'](_0x3980('0x13'),_0x6818f3,_0x51631a['error']['message']);return _0x3110f5(_0x51631a[_0x3980('0x11')]['message']);}logger[_0x3980('0x11')](_0x3980('0x13'),_0x6818f3,_0x51631a['error'][_0x3980('0x14')]);return _0x1f2a6c(_0x51631a[_0x3980('0x11')][_0x3980('0x14')]);}else{logger[_0x3980('0x15')](_0x3980('0x13'),_0x6818f3,'request\x20sent');_0x1f2a6c(_0x51631a['result'][_0x3980('0x14')]);}})[_0x3980('0x16')](function(_0x5687a1){logger['error'](_0x3980('0x13'),_0x6818f3,_0x5687a1);_0x3110f5(_0x5687a1);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index bf47d0b..27f6b43 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 _0x4fdb=['describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','/describe'];(function(_0x31282b,_0xa476db){var _0x19c632=function(_0x207214){while(--_0x207214){_0x31282b['push'](_0x31282b['shift']());}};_0x19c632(++_0xa476db);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x7c6c6b,_0x4767b7){_0x7c6c6b=_0x7c6c6b-0x0;var _0x23ef61=_0x4fdb[_0x7c6c6b];return _0x23ef61;};'use strict';var multer=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var path=require(_0xb4fd('0x2'));var timeout=require(_0xb4fd('0x3'));var express=require(_0xb4fd('0x4'));var router=express[_0xb4fd('0x5')]();var fs_extra=require(_0xb4fd('0x6'));var auth=require(_0xb4fd('0x7'));var interaction=require(_0xb4fd('0x8'));var config=require('../../config/environment');var controller=require(_0xb4fd('0x9'));router['get']('/',auth[_0xb4fd('0xa')](),controller['index']);router['get'](_0xb4fd('0xb'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0xc')]);router['get']('/:id',auth[_0xb4fd('0xa')](),controller[_0xb4fd('0xd')]);router[_0xb4fd('0xe')]('/',auth['isAuthenticated'](),controller[_0xb4fd('0xf')]);router[_0xb4fd('0x10')](_0xb4fd('0x11'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x12')]);router['delete'](_0xb4fd('0x11'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x13')]);module[_0xb4fd('0x14')]=router; \ No newline at end of file +var _0x00bb=['express','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x223766,_0x2c3def){var _0x2bb0e2=function(_0x295c68){while(--_0x295c68){_0x223766['push'](_0x223766['shift']());}};_0x2bb0e2(++_0x2c3def);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x00bb[_0x1e7b16];return _0x37fadc;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var fs_extra=require(_0xb00b('0x4'));var auth=require(_0xb00b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb00b('0x6'));var controller=require(_0xb00b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb00b('0x8')](_0xb00b('0x9'),auth[_0xb00b('0xa')](),controller[_0xb00b('0xb')]);router[_0xb00b('0x8')](_0xb00b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb00b('0xd')]('/',auth[_0xb00b('0xa')](),controller[_0xb00b('0xe')]);router[_0xb00b('0xf')](_0xb00b('0xc'),auth['isAuthenticated'](),controller[_0xb00b('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb00b('0x11')]);module[_0xb00b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index c93a7c8..62c5d95 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 _0x6e01=['DATE','exports','STRING','INTEGER'];(function(_0x3c1852,_0x1b59d1){var _0x4a1af0=function(_0x57325f){while(--_0x57325f){_0x3c1852['push'](_0x3c1852['shift']());}};_0x4a1af0(++_0x1b59d1);}(_0x6e01,0x111));var _0x16e0=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x6e01[_0x54b062];return _0x255e41;};'use strict';var Sequelize=require('sequelize');module[_0x16e0('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x16e0('0x1')]},'channelstate':{'type':Sequelize[_0x16e0('0x2')]},'channelstatedesc':{'type':Sequelize[_0x16e0('0x1')]},'calleridnum':{'type':Sequelize[_0x16e0('0x1')]},'calleridname':{'type':Sequelize[_0x16e0('0x1')]},'connectedlinenum':{'type':Sequelize[_0x16e0('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x16e0('0x1')]},'accountcode':{'type':Sequelize[_0x16e0('0x1')]},'context':{'type':Sequelize[_0x16e0('0x1')]},'exten':{'type':Sequelize[_0x16e0('0x1')]},'priority':{'type':Sequelize[_0x16e0('0x2')]},'uniqueid':{'type':Sequelize[_0x16e0('0x1')]},'linkedid':{'type':Sequelize[_0x16e0('0x1')]},'destchannel':{'type':Sequelize[_0x16e0('0x1')]},'destchannelstate':{'type':Sequelize[_0x16e0('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x16e0('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x16e0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x16e0('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x16e0('0x1')]},'destaccountcode':{'type':Sequelize[_0x16e0('0x1')]},'destcontext':{'type':Sequelize[_0x16e0('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x16e0('0x2')]},'destuniqueid':{'type':Sequelize[_0x16e0('0x1')]},'destlinkedid':{'type':Sequelize[_0x16e0('0x1')]},'dialstring':{'type':Sequelize[_0x16e0('0x1')]},'dialstatus':{'type':Sequelize[_0x16e0('0x1')]},'starttime':{'type':Sequelize[_0x16e0('0x3')]},'answertime':{'type':Sequelize[_0x16e0('0x3')]},'endtime':{'type':Sequelize[_0x16e0('0x3')]},'lastevent':{'type':Sequelize[_0x16e0('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x16e0('0x2')]},'duration':{'type':Sequelize[_0x16e0('0x2')]},'holdtime':{'type':Sequelize[_0x16e0('0x2')]},'billableseconds':{'type':Sequelize[_0x16e0('0x2')]}}; \ No newline at end of file +var _0x88cf=['INTEGER','DATE','sequelize','STRING'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x88cf,0x76));var _0xf88c=function(_0xd0a9b8,_0x463ed7){_0xd0a9b8=_0xd0a9b8-0x0;var _0x1db5a5=_0x88cf[_0xd0a9b8];return _0x1db5a5;};'use strict';var Sequelize=require(_0xf88c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xf88c('0x1')]},'channel':{'type':Sequelize[_0xf88c('0x1')]},'channelstate':{'type':Sequelize[_0xf88c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf88c('0x1')]},'calleridname':{'type':Sequelize[_0xf88c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xf88c('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf88c('0x1')]},'accountcode':{'type':Sequelize[_0xf88c('0x1')]},'context':{'type':Sequelize[_0xf88c('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf88c('0x2')]},'uniqueid':{'type':Sequelize[_0xf88c('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf88c('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf88c('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf88c('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xf88c('0x1')]},'destaccountcode':{'type':Sequelize[_0xf88c('0x1')]},'destcontext':{'type':Sequelize[_0xf88c('0x1')]},'destexten':{'type':Sequelize[_0xf88c('0x1')]},'destpriority':{'type':Sequelize[_0xf88c('0x2')]},'destuniqueid':{'type':Sequelize[_0xf88c('0x1')]},'destlinkedid':{'type':Sequelize[_0xf88c('0x1')]},'dialstring':{'type':Sequelize[_0xf88c('0x1')]},'dialstatus':{'type':Sequelize[_0xf88c('0x1')]},'starttime':{'type':Sequelize[_0xf88c('0x3')]},'answertime':{'type':Sequelize[_0xf88c('0x3')]},'endtime':{'type':Sequelize[_0xf88c('0x3')]},'lastevent':{'type':Sequelize[_0xf88c('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xf88c('0x2')]},'duration':{'type':Sequelize[_0xf88c('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'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 88cb0be..5fd9f50 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 _0x922d=['options','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','name','VoiceDialReport','catch','show','params','includeAll'];(function(_0x4df04b,_0x52b8cb){var _0x5ce10e=function(_0x1dd148){while(--_0x1dd148){_0x4df04b['push'](_0x4df04b['shift']());}};_0x5ce10e(++_0x52b8cb);}(_0x922d,0x9c));var _0xd922=function(_0x4134d6,_0x12a9cf){_0x4134d6=_0x4134d6-0x0;var _0x81e604=_0x922d[_0x4134d6];return _0x81e604;};'use strict';var emlformat=require(_0xd922('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd922('0x1'));var rp=require(_0xd922('0x2'));var moment=require(_0xd922('0x3'));var BPromise=require(_0xd922('0x4'));var Mustache=require(_0xd922('0x5'));var util=require(_0xd922('0x6'));var path=require(_0xd922('0x7'));var sox=require(_0xd922('0x8'));var csv=require(_0xd922('0x9'));var ejs=require(_0xd922('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd922('0xb'));var squel=require(_0xd922('0xc'));var crypto=require(_0xd922('0xd'));var jsforce=require(_0xd922('0xe'));var deskjs=require(_0xd922('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd922('0x10'));var Papa=require('papaparse');var Redis=require(_0xd922('0x11'));var authService=require(_0xd922('0x12'));var qs=require(_0xd922('0x13'));var as=require(_0xd922('0x14'));var hardwareService=require(_0xd922('0x15'));var logger=require(_0xd922('0x16'))(_0xd922('0x17'));var utils=require('../../config/utils');var config=require(_0xd922('0x18'));var licenseUtil=require(_0xd922('0x19'));var db=require(_0xd922('0x1a'))['db'];function respondWithStatusCode(_0x6a3389,_0x26233a){_0x26233a=_0x26233a||0xcc;return function(_0x52a38c){if(_0x52a38c){return _0x6a3389[_0xd922('0x1b')](_0x26233a);}return _0x6a3389[_0xd922('0x1c')](_0x26233a)[_0xd922('0x1d')]();};}function respondWithResult(_0x55b383,_0x5f0a30){_0x5f0a30=_0x5f0a30||0xc8;return function(_0xd0ec3c){if(_0xd0ec3c){return _0x55b383[_0xd922('0x1c')](_0x5f0a30)[_0xd922('0x1e')](_0xd0ec3c);}};}function respondWithFilteredResult(_0x4ad025,_0x11c51d){return function(_0x15b396){if(_0x15b396){var _0x3ce3c8=typeof _0x11c51d[_0xd922('0x1f')]===_0xd922('0x20')&&typeof _0x11c51d['limit']===_0xd922('0x20');var _0x335c3a=_0x15b396[_0xd922('0x21')];var _0x20d83f=_0x3ce3c8?0x0:_0x11c51d[_0xd922('0x1f')];var _0xffbea8=_0x3ce3c8?_0x15b396[_0xd922('0x21')]:_0x11c51d['offset']+_0x11c51d[_0xd922('0x22')];var _0x52589f;if(_0xffbea8>=_0x335c3a){_0xffbea8=_0x335c3a;_0x52589f=0xc8;}else{_0x52589f=0xce;}_0x4ad025[_0xd922('0x1c')](_0x52589f);return _0x4ad025['set']('Content-Range',_0x20d83f+'-'+_0xffbea8+'/'+_0x335c3a)[_0xd922('0x1e')](_0x15b396);}return null;};}function patchUpdates(_0x6903db){return function(_0x59c099){try{jsonpatch[_0xd922('0x23')](_0x59c099,_0x6903db,!![]);}catch(_0x448e56){return BPromise[_0xd922('0x24')](_0x448e56);}return _0x59c099[_0xd922('0x25')]();};}function saveUpdates(_0x4f54b6,_0x5e6291){return function(_0x3c7008){if(_0x3c7008){return _0x3c7008[_0xd922('0x26')](_0x4f54b6)[_0xd922('0x27')](function(_0x4276ef){return _0x4276ef;});}return null;};}function removeEntity(_0x1bb49b,_0x37fda6){return function(_0xc8df41){if(_0xc8df41){return _0xc8df41['destroy']()['then'](function(){_0x1bb49b[_0xd922('0x1c')](0xcc)[_0xd922('0x1d')]();});}};}function handleEntityNotFound(_0x4d8d2c,_0x57893f){return function(_0x128edb){if(!_0x128edb){_0x4d8d2c[_0xd922('0x1b')](0x194);}return _0x128edb;};}function handleError(_0x4c33ef,_0x4d8dc9){_0x4d8dc9=_0x4d8dc9||0x1f4;return function(_0x4f3648){logger['error'](_0x4f3648['stack']);if(_0x4f3648['name']){delete _0x4f3648['name'];}_0x4c33ef[_0xd922('0x1c')](_0x4d8dc9)[_0xd922('0x28')](_0x4f3648);};}exports[_0xd922('0x29')]=function(_0x227859,_0x1cf6fd){var _0x2d5354={},_0x3a928e={},_0x43811a={'count':0x0,'rows':[]};var _0x4c2ca1=_['map'](db['VoiceDialReport'][_0xd922('0x2a')],function(_0x5df6c3){return{'name':_0x5df6c3[_0xd922('0x2b')],'type':_0x5df6c3[_0xd922('0x2c')][_0xd922('0x2d')]};});_0x3a928e[_0xd922('0x2e')]=_[_0xd922('0x2f')](_0x4c2ca1,'name');_0x3a928e[_0xd922('0x30')]=_[_0xd922('0x31')](_0x227859[_0xd922('0x30')]);_0x3a928e[_0xd922('0x32')]=_[_0xd922('0x33')](_0x3a928e[_0xd922('0x2e')],_0x3a928e[_0xd922('0x30')]);_0x2d5354[_0xd922('0x34')]=_[_0xd922('0x33')](_0x3a928e[_0xd922('0x2e')],qs[_0xd922('0x35')](_0x227859[_0xd922('0x30')]['fields']));_0x2d5354[_0xd922('0x34')]=_0x2d5354[_0xd922('0x34')][_0xd922('0x36')]?_0x2d5354[_0xd922('0x34')]:_0x3a928e['model'];if(!_0x227859[_0xd922('0x30')][_0xd922('0x37')](_0xd922('0x38'))){_0x2d5354[_0xd922('0x22')]=qs[_0xd922('0x22')](_0x227859[_0xd922('0x30')][_0xd922('0x22')]);_0x2d5354[_0xd922('0x1f')]=qs[_0xd922('0x1f')](_0x227859[_0xd922('0x30')]['offset']);}_0x2d5354[_0xd922('0x39')]=qs[_0xd922('0x3a')](_0x227859[_0xd922('0x30')][_0xd922('0x3a')]);_0x2d5354[_0xd922('0x3b')]=qs[_0xd922('0x32')](_[_0xd922('0x3c')](_0x227859[_0xd922('0x30')],_0x3a928e['filters']),_0x4c2ca1);if(_0x227859[_0xd922('0x30')]['filter']){_0x2d5354[_0xd922('0x3b')]=_[_0xd922('0x3d')](_0x2d5354[_0xd922('0x3b')],{'$or':_[_0xd922('0x2f')](_0x4c2ca1,function(_0x3dd98c){if(_0x3dd98c[_0xd922('0x2c')]!==_0xd922('0x3e')){var _0xb0eac5={};_0xb0eac5[_0x3dd98c[_0xd922('0x3f')]]={'$like':'%'+_0x227859[_0xd922('0x30')]['filter']+'%'};return _0xb0eac5;}})});}_0x2d5354=_['merge']({},_0x2d5354,_0x227859['options']);var _0x178cfd={'where':_0x2d5354[_0xd922('0x3b')]};return db[_0xd922('0x40')]['count'](_0x178cfd)[_0xd922('0x27')](function(_0x18dba2){_0x43811a[_0xd922('0x21')]=_0x18dba2;if(_0x227859[_0xd922('0x30')]['includeAll']){_0x2d5354['include']=[{'all':!![]}];}return db[_0xd922('0x40')]['findAll'](_0x2d5354);})['then'](function(_0x5a928a){_0x43811a['rows']=_0x5a928a;return _0x43811a;})[_0xd922('0x27')](respondWithFilteredResult(_0x1cf6fd,_0x2d5354))[_0xd922('0x41')](handleError(_0x1cf6fd,null));};exports[_0xd922('0x42')]=function(_0x36b13a,_0x189706){var _0x1e642a={'raw':!![],'where':{'id':_0x36b13a[_0xd922('0x43')]['id']}},_0x23856e={};_0x23856e['model']=_['keys'](db[_0xd922('0x40')][_0xd922('0x2a')]);_0x23856e['query']=_['keys'](_0x36b13a[_0xd922('0x30')]);_0x23856e[_0xd922('0x32')]=_[_0xd922('0x33')](_0x23856e[_0xd922('0x2e')],_0x23856e[_0xd922('0x30')]);_0x1e642a[_0xd922('0x34')]=_[_0xd922('0x33')](_0x23856e['model'],qs[_0xd922('0x35')](_0x36b13a['query'][_0xd922('0x35')]));_0x1e642a['attributes']=_0x1e642a['attributes'][_0xd922('0x36')]?_0x1e642a['attributes']:_0x23856e['model'];if(_0x36b13a[_0xd922('0x30')][_0xd922('0x44')]){_0x1e642a['include']=[{'all':!![]}];}_0x1e642a=_[_0xd922('0x3d')]({},_0x1e642a,_0x36b13a[_0xd922('0x45')]);return db['VoiceDialReport'][_0xd922('0x46')](_0x1e642a)['then'](handleEntityNotFound(_0x189706,null))[_0xd922('0x27')](respondWithResult(_0x189706,null))[_0xd922('0x41')](handleError(_0x189706,null));};exports['create']=function(_0x4c1846,_0x462ee0){return db['VoiceDialReport'][_0xd922('0x47')](_0x4c1846[_0xd922('0x48')],{})[_0xd922('0x27')](respondWithResult(_0x462ee0,0xc9))[_0xd922('0x41')](handleError(_0x462ee0,null));};exports[_0xd922('0x26')]=function(_0x51b1b3,_0x25928e){if(_0x51b1b3[_0xd922('0x48')]['id']){delete _0x51b1b3[_0xd922('0x48')]['id'];}return db[_0xd922('0x40')]['find']({'where':{'id':_0x51b1b3['params']['id']}})[_0xd922('0x27')](handleEntityNotFound(_0x25928e,null))['then'](saveUpdates(_0x51b1b3[_0xd922('0x48')],null))['then'](respondWithResult(_0x25928e,null))[_0xd922('0x41')](handleError(_0x25928e,null));};exports[_0xd922('0x49')]=function(_0x233a2b,_0x313dbe){return db[_0xd922('0x40')][_0xd922('0x46')]({'where':{'id':_0x233a2b[_0xd922('0x43')]['id']}})[_0xd922('0x27')](handleEntityNotFound(_0x313dbe,null))['then'](removeEntity(_0x313dbe,null))[_0xd922('0x41')](handleError(_0x313dbe,null));};exports['describe']=function(_0x4cec11,_0x3966d7){return db['VoiceDialReport'][_0xd922('0x4a')]()[_0xd922('0x27')](respondWithResult(_0x3966d7,null))[_0xd922('0x41')](handleError(_0x3966d7,null));}; \ No newline at end of file +var _0x0cf0=['to-csv','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','VoiceDialReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','params','rawAttributes','includeAll','include','options','find','create','body','describe','eml-format','zip-dir','moment','path','sox'];(function(_0x245eff,_0xf4e451){var _0x4a0611=function(_0x1083a9){while(--_0x1083a9){_0x245eff['push'](_0x245eff['shift']());}};_0x4a0611(++_0xf4e451);}(_0x0cf0,0x1e5));var _0x00cf=function(_0x5242b3,_0x362d7c){_0x5242b3=_0x5242b3-0x0;var _0x22a265=_0x0cf0[_0x5242b3];return _0x22a265;};'use strict';var emlformat=require(_0x00cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x00cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x00cf('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x00cf('0x3'));var sox=require(_0x00cf('0x4'));var csv=require(_0x00cf('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x00cf('0x6'));var crypto=require('crypto');var jsforce=require(_0x00cf('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x00cf('0x5'));var querystring=require(_0x00cf('0x8'));var Papa=require(_0x00cf('0x9'));var Redis=require(_0x00cf('0xa'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00cf('0xb'));var logger=require('../../config/logger')(_0x00cf('0xc'));var utils=require(_0x00cf('0xd'));var config=require(_0x00cf('0xe'));var licenseUtil=require(_0x00cf('0xf'));var db=require(_0x00cf('0x10'))['db'];function respondWithStatusCode(_0xeeabec,_0x1abeb1){_0x1abeb1=_0x1abeb1||0xcc;return function(_0x5e56b2){if(_0x5e56b2){return _0xeeabec[_0x00cf('0x11')](_0x1abeb1);}return _0xeeabec[_0x00cf('0x12')](_0x1abeb1)[_0x00cf('0x13')]();};}function respondWithResult(_0x3b9d82,_0x3c5598){_0x3c5598=_0x3c5598||0xc8;return function(_0x173a6b){if(_0x173a6b){return _0x3b9d82[_0x00cf('0x12')](_0x3c5598)[_0x00cf('0x14')](_0x173a6b);}};}function respondWithFilteredResult(_0x24596e,_0x17e811){return function(_0x3f6cef){if(_0x3f6cef){var _0x446344=typeof _0x17e811[_0x00cf('0x15')]===_0x00cf('0x16')&&typeof _0x17e811[_0x00cf('0x17')]==='undefined';var _0x582a89=_0x3f6cef[_0x00cf('0x18')];var _0x2bb776=_0x446344?0x0:_0x17e811['offset'];var _0x3b2637=_0x446344?_0x3f6cef[_0x00cf('0x18')]:_0x17e811[_0x00cf('0x15')]+_0x17e811['limit'];var _0x650d09;if(_0x3b2637>=_0x582a89){_0x3b2637=_0x582a89;_0x650d09=0xc8;}else{_0x650d09=0xce;}_0x24596e[_0x00cf('0x12')](_0x650d09);return _0x24596e[_0x00cf('0x19')](_0x00cf('0x1a'),_0x2bb776+'-'+_0x3b2637+'/'+_0x582a89)[_0x00cf('0x14')](_0x3f6cef);}return null;};}function patchUpdates(_0x577f74){return function(_0x3aa00a){try{jsonpatch[_0x00cf('0x1b')](_0x3aa00a,_0x577f74,!![]);}catch(_0x4beedc){return BPromise[_0x00cf('0x1c')](_0x4beedc);}return _0x3aa00a[_0x00cf('0x1d')]();};}function saveUpdates(_0x31ff01,_0x3eb4e8){return function(_0x4f2ee2){if(_0x4f2ee2){return _0x4f2ee2[_0x00cf('0x1e')](_0x31ff01)[_0x00cf('0x1f')](function(_0x11b9c1){return _0x11b9c1;});}return null;};}function removeEntity(_0x5b4353,_0x25e5c1){return function(_0x1370df){if(_0x1370df){return _0x1370df[_0x00cf('0x20')]()[_0x00cf('0x1f')](function(){_0x5b4353['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33f857,_0x43828f){return function(_0x8a4818){if(!_0x8a4818){_0x33f857[_0x00cf('0x11')](0x194);}return _0x8a4818;};}function handleError(_0x453195,_0x2e8238){_0x2e8238=_0x2e8238||0x1f4;return function(_0x13ad5e){logger[_0x00cf('0x21')](_0x13ad5e['stack']);if(_0x13ad5e[_0x00cf('0x22')]){delete _0x13ad5e[_0x00cf('0x22')];}_0x453195['status'](_0x2e8238)['send'](_0x13ad5e);};}exports[_0x00cf('0x23')]=function(_0x349dd7,_0x5ad906){var _0xed436b={},_0x3a8e14={},_0x447a6b={'count':0x0,'rows':[]};var _0x25390d=_[_0x00cf('0x24')](db[_0x00cf('0x25')]['rawAttributes'],function(_0x5a1e97){return{'name':_0x5a1e97[_0x00cf('0x26')],'type':_0x5a1e97[_0x00cf('0x27')][_0x00cf('0x28')]};});_0x3a8e14[_0x00cf('0x29')]=_[_0x00cf('0x24')](_0x25390d,_0x00cf('0x22'));_0x3a8e14[_0x00cf('0x2a')]=_[_0x00cf('0x2b')](_0x349dd7[_0x00cf('0x2a')]);_0x3a8e14[_0x00cf('0x2c')]=_['intersection'](_0x3a8e14[_0x00cf('0x29')],_0x3a8e14[_0x00cf('0x2a')]);_0xed436b[_0x00cf('0x2d')]=_[_0x00cf('0x2e')](_0x3a8e14[_0x00cf('0x29')],qs[_0x00cf('0x2f')](_0x349dd7[_0x00cf('0x2a')][_0x00cf('0x2f')]));_0xed436b[_0x00cf('0x2d')]=_0xed436b[_0x00cf('0x2d')][_0x00cf('0x30')]?_0xed436b[_0x00cf('0x2d')]:_0x3a8e14[_0x00cf('0x29')];if(!_0x349dd7[_0x00cf('0x2a')][_0x00cf('0x31')](_0x00cf('0x32'))){_0xed436b[_0x00cf('0x17')]=qs[_0x00cf('0x17')](_0x349dd7['query'][_0x00cf('0x17')]);_0xed436b['offset']=qs['offset'](_0x349dd7['query'][_0x00cf('0x15')]);}_0xed436b[_0x00cf('0x33')]=qs[_0x00cf('0x34')](_0x349dd7[_0x00cf('0x2a')][_0x00cf('0x34')]);_0xed436b[_0x00cf('0x35')]=qs[_0x00cf('0x2c')](_[_0x00cf('0x36')](_0x349dd7[_0x00cf('0x2a')],_0x3a8e14[_0x00cf('0x2c')]),_0x25390d);if(_0x349dd7['query'][_0x00cf('0x37')]){_0xed436b[_0x00cf('0x35')]=_[_0x00cf('0x38')](_0xed436b[_0x00cf('0x35')],{'$or':_[_0x00cf('0x24')](_0x25390d,function(_0x2411c7){if(_0x2411c7[_0x00cf('0x27')]!==_0x00cf('0x39')){var _0x3a3db5={};_0x3a3db5[_0x2411c7[_0x00cf('0x22')]]={'$like':'%'+_0x349dd7['query'][_0x00cf('0x37')]+'%'};return _0x3a3db5;}})});}_0xed436b=_['merge']({},_0xed436b,_0x349dd7['options']);var _0x3ee55a={'where':_0xed436b[_0x00cf('0x35')]};return db[_0x00cf('0x25')]['count'](_0x3ee55a)[_0x00cf('0x1f')](function(_0x392b6f){_0x447a6b[_0x00cf('0x18')]=_0x392b6f;if(_0x349dd7[_0x00cf('0x2a')]['includeAll']){_0xed436b['include']=[{'all':!![]}];}return db[_0x00cf('0x25')][_0x00cf('0x3a')](_0xed436b);})[_0x00cf('0x1f')](function(_0x98e6d2){_0x447a6b[_0x00cf('0x3b')]=_0x98e6d2;return _0x447a6b;})[_0x00cf('0x1f')](respondWithFilteredResult(_0x5ad906,_0xed436b))[_0x00cf('0x3c')](handleError(_0x5ad906,null));};exports['show']=function(_0x2781cd,_0x5226c7){var _0x5aceed={'raw':!![],'where':{'id':_0x2781cd[_0x00cf('0x3d')]['id']}},_0x5c868e={};_0x5c868e[_0x00cf('0x29')]=_[_0x00cf('0x2b')](db[_0x00cf('0x25')][_0x00cf('0x3e')]);_0x5c868e[_0x00cf('0x2a')]=_[_0x00cf('0x2b')](_0x2781cd['query']);_0x5c868e[_0x00cf('0x2c')]=_['intersection'](_0x5c868e[_0x00cf('0x29')],_0x5c868e[_0x00cf('0x2a')]);_0x5aceed[_0x00cf('0x2d')]=_[_0x00cf('0x2e')](_0x5c868e[_0x00cf('0x29')],qs[_0x00cf('0x2f')](_0x2781cd[_0x00cf('0x2a')][_0x00cf('0x2f')]));_0x5aceed[_0x00cf('0x2d')]=_0x5aceed[_0x00cf('0x2d')][_0x00cf('0x30')]?_0x5aceed['attributes']:_0x5c868e[_0x00cf('0x29')];if(_0x2781cd[_0x00cf('0x2a')][_0x00cf('0x3f')]){_0x5aceed[_0x00cf('0x40')]=[{'all':!![]}];}_0x5aceed=_['merge']({},_0x5aceed,_0x2781cd[_0x00cf('0x41')]);return db[_0x00cf('0x25')][_0x00cf('0x42')](_0x5aceed)[_0x00cf('0x1f')](handleEntityNotFound(_0x5226c7,null))[_0x00cf('0x1f')](respondWithResult(_0x5226c7,null))[_0x00cf('0x3c')](handleError(_0x5226c7,null));};exports[_0x00cf('0x43')]=function(_0x55f4f0,_0x4f365d){return db[_0x00cf('0x25')][_0x00cf('0x43')](_0x55f4f0[_0x00cf('0x44')],{})[_0x00cf('0x1f')](respondWithResult(_0x4f365d,0xc9))[_0x00cf('0x3c')](handleError(_0x4f365d,null));};exports[_0x00cf('0x1e')]=function(_0x4332e3,_0x367b5a){if(_0x4332e3[_0x00cf('0x44')]['id']){delete _0x4332e3['body']['id'];}return db[_0x00cf('0x25')][_0x00cf('0x42')]({'where':{'id':_0x4332e3[_0x00cf('0x3d')]['id']}})[_0x00cf('0x1f')](handleEntityNotFound(_0x367b5a,null))[_0x00cf('0x1f')](saveUpdates(_0x4332e3[_0x00cf('0x44')],null))[_0x00cf('0x1f')](respondWithResult(_0x367b5a,null))['catch'](handleError(_0x367b5a,null));};exports['destroy']=function(_0x594add,_0x185ece){return db[_0x00cf('0x25')]['find']({'where':{'id':_0x594add[_0x00cf('0x3d')]['id']}})[_0x00cf('0x1f')](handleEntityNotFound(_0x185ece,null))[_0x00cf('0x1f')](removeEntity(_0x185ece,null))[_0x00cf('0x3c')](handleError(_0x185ece,null));};exports[_0x00cf('0x45')]=function(_0x21a0c3,_0x2f5dc0){return db[_0x00cf('0x25')][_0x00cf('0x45')]()['then'](respondWithResult(_0x2f5dc0,null))[_0x00cf('0x3c')](handleError(_0x2f5dc0,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index fde5c2c..4dffd9c 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 _0x4038=['../../config/environment','./voiceDialReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x4ffd9c,_0x55827e){var _0x4ccb28=function(_0x24760a){while(--_0x24760a){_0x4ffd9c['push'](_0x4ffd9c['shift']());}};_0x4ccb28(++_0x55827e);}(_0x4038,0x95));var _0x8403=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x4038[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x8403('0x0'));var util=require(_0x8403('0x1'));var logger=require(_0x8403('0x2'))(_0x8403('0x3'));var moment=require(_0x8403('0x4'));var BPromise=require(_0x8403('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8403('0x6'));var config=require(_0x8403('0x7'));var attributes=require(_0x8403('0x8'));module[_0x8403('0x9')]=function(_0x3c6905,_0x20a005){return _0x3c6905[_0x8403('0xa')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x8403('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x85ee=['util','api','moment','path','exports','define','VoiceDialReport','report_dial','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x85ee,0xe0));var _0xe85e=function(_0x8b3eae,_0x2fb0b2){_0x8b3eae=_0x8b3eae-0x0;var _0x55a650=_0x85ee[_0x8b3eae];return _0x55a650;};'use strict';var _=require(_0xe85e('0x0'));var util=require(_0xe85e('0x1'));var logger=require('../../config/logger')(_0xe85e('0x2'));var moment=require(_0xe85e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe85e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0xe85e('0x5')]=function(_0x8a066,_0x1c315c){return _0x8a066[_0xe85e('0x6')](_0xe85e('0x7'),attributes,{'tableName':_0xe85e('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 44dbd24..8ff3e33 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 _0x8408=['options','raw','catch','UpdateVoiceDialReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateVoiceDialReport','VoiceDialReport','body'];(function(_0x4be04a,_0x3bf896){var _0xd03915=function(_0x4b23ca){while(--_0x4b23ca){_0x4be04a['push'](_0x4be04a['shift']());}};_0xd03915(++_0x3bf896);}(_0x8408,0x194));var _0x8840=function(_0x14db12,_0x440b12){_0x14db12=_0x14db12-0x0;var _0x3fc276=_0x8408[_0x14db12];return _0x3fc276;};'use strict';var _=require('lodash');var util=require(_0x8840('0x0'));var moment=require(_0x8840('0x1'));var BPromise=require(_0x8840('0x2'));var rs=require(_0x8840('0x3'));var fs=require('fs');var Redis=require(_0x8840('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8840('0x5'));var logger=require(_0x8840('0x6'))(_0x8840('0x7'));var config=require(_0x8840('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8840('0x9')][_0x8840('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24cb14,_0x29c589,_0x426a17){return new BPromise(function(_0x43b107,_0x1fee12){return client[_0x8840('0xb')](_0x24cb14,_0x426a17)[_0x8840('0xc')](function(_0x1e02a0){logger[_0x8840('0xd')](_0x8840('0xe'),_0x29c589,'request\x20sent');logger[_0x8840('0xf')](_0x8840('0x10'),_0x29c589,_0x8840('0x11'),JSON[_0x8840('0x12')](_0x1e02a0));if(_0x1e02a0[_0x8840('0x13')]){if(_0x1e02a0['error']['code']===0x1f4){logger[_0x8840('0x13')](_0x8840('0xe'),_0x29c589,_0x1e02a0[_0x8840('0x13')][_0x8840('0x14')]);return _0x1fee12(_0x1e02a0['error'][_0x8840('0x14')]);}logger['error'](_0x8840('0xe'),_0x29c589,_0x1e02a0['error'][_0x8840('0x14')]);return _0x43b107(_0x1e02a0[_0x8840('0x13')][_0x8840('0x14')]);}else{logger[_0x8840('0xd')](_0x8840('0xe'),_0x29c589,_0x8840('0x11'));_0x43b107(_0x1e02a0[_0x8840('0x15')][_0x8840('0x14')]);}})['catch'](function(_0x41a43f){logger[_0x8840('0x13')](_0x8840('0xe'),_0x29c589,_0x41a43f);_0x1fee12(_0x41a43f);});});}exports[_0x8840('0x16')]=function(_0x2e0bbf){var _0x3ac73a=this;return new Promise(function(_0x3397ff,_0x9fdb77){return db[_0x8840('0x17')]['create'](_0x2e0bbf[_0x8840('0x18')],{'raw':_0x2e0bbf[_0x8840('0x19')]?_0x2e0bbf[_0x8840('0x19')][_0x8840('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x273a06){logger[_0x8840('0xd')]('CreateVoiceDialReport',_0x2e0bbf);logger['debug']('CreateVoiceDialReport',_0x2e0bbf,JSON[_0x8840('0x12')](_0x273a06));_0x3397ff(_0x273a06);})[_0x8840('0x1b')](function(_0x2abfd4){logger['error'](_0x8840('0x16'),_0x2abfd4[_0x8840('0x14')],_0x2e0bbf);_0x9fdb77(_0x3ac73a[_0x8840('0x13')](0x1f4,_0x2abfd4['message']));});});};exports[_0x8840('0x1c')]=function(_0x2bf0a7){var _0x31cec3=this;return new Promise(function(_0x4fb823,_0x33b25b){return db[_0x8840('0x17')][_0x8840('0x1d')](_0x2bf0a7[_0x8840('0x18')],{'raw':_0x2bf0a7[_0x8840('0x19')]?_0x2bf0a7[_0x8840('0x19')][_0x8840('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bf0a7[_0x8840('0x19')]?_0x2bf0a7[_0x8840('0x19')][_0x8840('0x1e')]||null:null,'attributes':_0x2bf0a7[_0x8840('0x19')]?_0x2bf0a7[_0x8840('0x19')][_0x8840('0x1f')]||null:null,'limit':_0x2bf0a7[_0x8840('0x19')]?_0x2bf0a7['options'][_0x8840('0x20')]||null:null})[_0x8840('0xc')](function(_0x31b9d3){logger[_0x8840('0xd')](_0x8840('0x1c'),_0x2bf0a7);logger[_0x8840('0xf')](_0x8840('0x1c'),_0x2bf0a7,JSON[_0x8840('0x12')](_0x31b9d3));_0x4fb823(_0x31b9d3);})[_0x8840('0x1b')](function(_0x2f9433){logger[_0x8840('0x13')](_0x8840('0x1c'),_0x2f9433[_0x8840('0x14')],_0x2bf0a7);_0x33b25b(_0x31cec3[_0x8840('0x13')](0x1f4,_0x2f9433[_0x8840('0x14')]));});});}; \ No newline at end of file +var _0x16b3=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','create','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport','update','where','attributes','lodash'];(function(_0xc6a9f9,_0x186ca5){var _0x10664d=function(_0x4456bb){while(--_0x4456bb){_0xc6a9f9['push'](_0xc6a9f9['shift']());}};_0x10664d(++_0x186ca5);}(_0x16b3,0xff));var _0x316b=function(_0x59bfa0,_0x1d5df7){_0x59bfa0=_0x59bfa0-0x0;var _0x1a43b8=_0x16b3[_0x59bfa0];return _0x1a43b8;};'use strict';var _=require(_0x316b('0x0'));var util=require(_0x316b('0x1'));var moment=require('moment');var BPromise=require(_0x316b('0x2'));var rs=require(_0x316b('0x3'));var fs=require('fs');var Redis=require(_0x316b('0x4'));var db=require(_0x316b('0x5'))['db'];var utils=require(_0x316b('0x6'));var logger=require(_0x316b('0x7'))(_0x316b('0x8'));var config=require('../../config/environment');var jayson=require(_0x316b('0x9'));var client=jayson[_0x316b('0xa')][_0x316b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5756fd,_0x27fb55,_0x14506e){return new BPromise(function(_0x487de9,_0x1373e3){return client[_0x316b('0xc')](_0x5756fd,_0x14506e)[_0x316b('0xd')](function(_0x1d41c9){logger[_0x316b('0xe')](_0x316b('0xf'),_0x27fb55,_0x316b('0x10'));logger[_0x316b('0x11')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x27fb55,_0x316b('0x10'),JSON[_0x316b('0x12')](_0x1d41c9));if(_0x1d41c9[_0x316b('0x13')]){if(_0x1d41c9['error']['code']===0x1f4){logger[_0x316b('0x13')](_0x316b('0xf'),_0x27fb55,_0x1d41c9['error'][_0x316b('0x14')]);return _0x1373e3(_0x1d41c9[_0x316b('0x13')][_0x316b('0x14')]);}logger['error'](_0x316b('0xf'),_0x27fb55,_0x1d41c9[_0x316b('0x13')][_0x316b('0x14')]);return _0x487de9(_0x1d41c9[_0x316b('0x13')]['message']);}else{logger[_0x316b('0xe')](_0x316b('0xf'),_0x27fb55,_0x316b('0x10'));_0x487de9(_0x1d41c9['result'][_0x316b('0x14')]);}})[_0x316b('0x15')](function(_0x522a1e){logger[_0x316b('0x13')](_0x316b('0xf'),_0x27fb55,_0x522a1e);_0x1373e3(_0x522a1e);});});}exports['CreateVoiceDialReport']=function(_0x27462d){var _0x25f1f2=this;return new Promise(function(_0x450c81,_0x2869db){return db['VoiceDialReport'][_0x316b('0x16')](_0x27462d[_0x316b('0x17')],{'raw':_0x27462d['options']?_0x27462d[_0x316b('0x18')][_0x316b('0x19')]===undefined?!![]:![]:!![]})[_0x316b('0xd')](function(_0x1608db){logger[_0x316b('0xe')](_0x316b('0x1a'),_0x27462d);logger[_0x316b('0x11')](_0x316b('0x1a'),_0x27462d,JSON[_0x316b('0x12')](_0x1608db));_0x450c81(_0x1608db);})[_0x316b('0x15')](function(_0x1caf7a){logger[_0x316b('0x13')](_0x316b('0x1a'),_0x1caf7a[_0x316b('0x14')],_0x27462d);_0x2869db(_0x25f1f2['error'](0x1f4,_0x1caf7a[_0x316b('0x14')]));});});};exports[_0x316b('0x1b')]=function(_0x53926c){var _0x2d0684=this;return new Promise(function(_0x5dca48,_0x335582){return db[_0x316b('0x1c')][_0x316b('0x1d')](_0x53926c[_0x316b('0x17')],{'raw':_0x53926c[_0x316b('0x18')]?_0x53926c[_0x316b('0x18')][_0x316b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53926c[_0x316b('0x18')]?_0x53926c[_0x316b('0x18')][_0x316b('0x1e')]||null:null,'attributes':_0x53926c[_0x316b('0x18')]?_0x53926c[_0x316b('0x18')][_0x316b('0x1f')]||null:null,'limit':_0x53926c[_0x316b('0x18')]?_0x53926c[_0x316b('0x18')]['limit']||null:null})[_0x316b('0xd')](function(_0x11d982){logger['info'](_0x316b('0x1b'),_0x53926c);logger[_0x316b('0x11')](_0x316b('0x1b'),_0x53926c,JSON[_0x316b('0x12')](_0x11d982));_0x5dca48(_0x11d982);})[_0x316b('0x15')](function(_0x28fc36){logger[_0x316b('0x13')]('UpdateVoiceDialReport',_0x28fc36[_0x316b('0x14')],_0x53926c);_0x335582(_0x2d0684[_0x316b('0x13')](0x1f4,_0x28fc36['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index c474d9e..40a95a1 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 _0xc695=['update','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','create','/:id/applications','addApplications','put'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc695,0x114));var _0x5c69=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0xc695[_0x540133];return _0x26b6e9;};'use strict';var multer=require('multer');var util=require(_0x5c69('0x0'));var path=require(_0x5c69('0x1'));var timeout=require(_0x5c69('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5c69('0x3'));var auth=require(_0x5c69('0x4'));var interaction=require(_0x5c69('0x5'));var config=require(_0x5c69('0x6'));var controller=require(_0x5c69('0x7'));router[_0x5c69('0x8')]('/',auth['isAuthenticated'](),controller[_0x5c69('0x9')]);router[_0x5c69('0x8')](_0x5c69('0xa'),auth[_0x5c69('0xb')](),controller[_0x5c69('0xc')]);router[_0x5c69('0xd')]('/',auth[_0x5c69('0xb')](),controller[_0x5c69('0xe')]);router['post'](_0x5c69('0xf'),auth[_0x5c69('0xb')](),controller[_0x5c69('0x10')]);router[_0x5c69('0x11')](_0x5c69('0xa'),auth[_0x5c69('0xb')](),controller[_0x5c69('0x12')]);router['delete'](_0x5c69('0xa'),auth['isAuthenticated'](),controller[_0x5c69('0x13')]);module[_0x5c69('0x14')]=router; \ No newline at end of file +var _0x44e8=['put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','addApplications'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x44e8,0xe7));var _0x844e=function(_0x18a53d,_0x26550a){_0x18a53d=_0x18a53d-0x0;var _0x22d0b7=_0x44e8[_0x18a53d];return _0x22d0b7;};'use strict';var multer=require('multer');var util=require(_0x844e('0x0'));var path=require(_0x844e('0x1'));var timeout=require(_0x844e('0x2'));var express=require(_0x844e('0x3'));var router=express[_0x844e('0x4')]();var fs_extra=require(_0x844e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x844e('0x6'));var config=require('../../config/environment');var controller=require(_0x844e('0x7'));router[_0x844e('0x8')]('/',auth[_0x844e('0x9')](),controller[_0x844e('0xa')]);router[_0x844e('0x8')](_0x844e('0xb'),auth['isAuthenticated'](),controller[_0x844e('0xc')]);router[_0x844e('0xd')]('/',auth[_0x844e('0x9')](),controller[_0x844e('0xe')]);router['post']('/:id/applications',auth[_0x844e('0x9')](),controller[_0x844e('0xf')]);router[_0x844e('0x10')](_0x844e('0xb'),auth[_0x844e('0x9')](),controller['update']);router[_0x844e('0x11')](_0x844e('0xb'),auth[_0x844e('0x9')](),controller['destroy']);module[_0x844e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 7d2207d..0d9c532 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 _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x1bd9bc,_0x59b9d7){var _0x56cd90=function(_0x5f2f2d){while(--_0x5f2f2d){_0x1bd9bc['push'](_0x1bd9bc['shift']());}};_0x56cd90(++_0x59b9d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x46df26,_0x589a4){var _0x583d52=function(_0x37a0e4){while(--_0x37a0e4){_0x46df26['push'](_0x46df26['shift']());}};_0x583d52(++_0x589a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index f59a3e9..9188e87 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 _0x3618=['filter','map','includes','type','value','UserProfileResource','error','stack','name','status','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','rows','show','find','catch','create','body','startsWith','exten','user','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','context','description','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0x3618,0x10d));var _0x8361=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x3618[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0x8361('0x0'));var rimraf=require(_0x8361('0x1'));var zipdir=require(_0x8361('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8361('0x3'));var moment=require(_0x8361('0x4'));var BPromise=require(_0x8361('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8361('0x6'));var sox=require(_0x8361('0x7'));var csv=require(_0x8361('0x8'));var ejs=require(_0x8361('0x9'));var fs=require('fs');var fs_extra=require(_0x8361('0xa'));var _=require('lodash');var squel=require(_0x8361('0xb'));var crypto=require('crypto');var jsforce=require(_0x8361('0xc'));var deskjs=require(_0x8361('0xd'));var toCsv=require(_0x8361('0x8'));var querystring=require('querystring');var Papa=require(_0x8361('0xe'));var Redis=require(_0x8361('0xf'));var authService=require(_0x8361('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8361('0x11'));var hardwareService=require(_0x8361('0x12'));var logger=require(_0x8361('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8361('0x14'));var licenseUtil=require(_0x8361('0x15'));var db=require('../../mysqldb')['db'];config[_0x8361('0x16')]=_[_0x8361('0x17')](config[_0x8361('0x16')],{'host':_0x8361('0x18'),'port':0x18eb});var socket=require(_0x8361('0x19'))(new Redis(config['redis']));require(_0x8361('0x1a'))['register'](socket);function respondWithStatusCode(_0xe587b2,_0x577ab3){_0x577ab3=_0x577ab3||0xcc;return function(_0x2411cd){if(_0x2411cd){return _0xe587b2[_0x8361('0x1b')](_0x577ab3);}return _0xe587b2['status'](_0x577ab3)[_0x8361('0x1c')]();};}function respondWithResult(_0x4b988b,_0x346274){_0x346274=_0x346274||0xc8;return function(_0x3d40c7){if(_0x3d40c7){return _0x4b988b['status'](_0x346274)['json'](_0x3d40c7);}};}function respondWithFilteredResult(_0x1adfda,_0x4bdfc6){return function(_0x411d68){if(_0x411d68){var _0x19150d=typeof _0x4bdfc6[_0x8361('0x1d')]==='undefined'&&typeof _0x4bdfc6['limit']===_0x8361('0x1e');var _0x5c36e2=_0x411d68[_0x8361('0x1f')];var _0x13cda7=_0x19150d?0x0:_0x4bdfc6[_0x8361('0x1d')];var _0x5d25cf=_0x19150d?_0x411d68[_0x8361('0x1f')]:_0x4bdfc6[_0x8361('0x1d')]+_0x4bdfc6[_0x8361('0x20')];var _0x23bfb6;if(_0x5d25cf>=_0x5c36e2){_0x5d25cf=_0x5c36e2;_0x23bfb6=0xc8;}else{_0x23bfb6=0xce;}_0x1adfda['status'](_0x23bfb6);return _0x1adfda[_0x8361('0x21')](_0x8361('0x22'),_0x13cda7+'-'+_0x5d25cf+'/'+_0x5c36e2)[_0x8361('0x23')](_0x411d68);}return null;};}function patchUpdates(_0x1914cf){return function(_0x539606){try{jsonpatch[_0x8361('0x24')](_0x539606,_0x1914cf,!![]);}catch(_0x4103e3){return BPromise[_0x8361('0x25')](_0x4103e3);}return _0x539606[_0x8361('0x26')]();};}function saveUpdates(_0x5c73d1,_0x34a471){return function(_0xe55394){if(_0xe55394){return _0xe55394['update'](_0x5c73d1)[_0x8361('0x27')](function(_0x2470d8){return _0x2470d8;});}return null;};}function removeEntity(_0x5396dd,_0x5eadcd){return function(_0x18e3f8){if(_0x18e3f8){return _0x18e3f8[_0x8361('0x28')]()['then'](function(){var _0x2515db=_0x18e3f8[_0x8361('0x29')]({'plain':!![]});var _0x5282c0=[{'name':_0x8361('0x2a'),'value':_0x8361('0x2b'),'ignore':![]},{'name':_0x8361('0x2c'),'value':_0x8361('0x2d'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x57f451=_(_0x5282c0)[_0x8361('0x2e')]('ignore')[_0x8361('0x2f')]('value')['value']();if(_[_0x8361('0x30')](_0x57f451,_0x2515db[_0x8361('0x31')])){return;}var _0x334a2a=_['find'](_0x5282c0,[_0x8361('0x32'),_0x2515db[_0x8361('0x31')]])['name'];return db[_0x8361('0x33')]['destroy']({'where':{'type':_0x334a2a,'resourceId':_0x2515db['id']}})[_0x8361('0x27')](function(){return _0x18e3f8;});})[_0x8361('0x27')](function(){_0x5396dd['status'](0xcc)[_0x8361('0x1c')]();});}};}function handleEntityNotFound(_0x436881,_0x32886a){return function(_0x242a53){if(!_0x242a53){_0x436881[_0x8361('0x1b')](0x194);}return _0x242a53;};}function handleError(_0x182070,_0x2586d0){_0x2586d0=_0x2586d0||0x1f4;return function(_0x3410ca){logger[_0x8361('0x34')](_0x3410ca[_0x8361('0x35')]);if(_0x3410ca[_0x8361('0x36')]){delete _0x3410ca[_0x8361('0x36')];}_0x182070[_0x8361('0x37')](_0x2586d0)['send'](_0x3410ca);};}exports['index']=function(_0x52aef1,_0x113342){var _0x3c8978={},_0x27f9b2={},_0x2dd565={'count':0x0,'rows':[]};var _0x40c2d3=_[_0x8361('0x2f')](db[_0x8361('0x38')][_0x8361('0x39')],function(_0x44d37b){return{'name':_0x44d37b[_0x8361('0x3a')],'type':_0x44d37b[_0x8361('0x31')][_0x8361('0x3b')]};});_0x27f9b2[_0x8361('0x3c')]=_[_0x8361('0x2f')](_0x40c2d3,_0x8361('0x36'));_0x27f9b2[_0x8361('0x3d')]=_[_0x8361('0x3e')](_0x52aef1[_0x8361('0x3d')]);_0x27f9b2[_0x8361('0x3f')]=_[_0x8361('0x40')](_0x27f9b2[_0x8361('0x3c')],_0x27f9b2[_0x8361('0x3d')]);_0x3c8978[_0x8361('0x41')]=_[_0x8361('0x40')](_0x27f9b2[_0x8361('0x3c')],qs[_0x8361('0x42')](_0x52aef1[_0x8361('0x3d')][_0x8361('0x42')]));_0x3c8978['attributes']=_0x3c8978[_0x8361('0x41')][_0x8361('0x43')]?_0x3c8978[_0x8361('0x41')]:_0x27f9b2[_0x8361('0x3c')];if(!_0x52aef1[_0x8361('0x3d')][_0x8361('0x44')](_0x8361('0x45'))){_0x3c8978[_0x8361('0x20')]=qs[_0x8361('0x20')](_0x52aef1[_0x8361('0x3d')][_0x8361('0x20')]);_0x3c8978[_0x8361('0x1d')]=qs[_0x8361('0x1d')](_0x52aef1[_0x8361('0x3d')][_0x8361('0x1d')]);}_0x3c8978[_0x8361('0x46')]=qs[_0x8361('0x47')](_0x52aef1[_0x8361('0x3d')]['sort']);_0x3c8978[_0x8361('0x48')]=qs[_0x8361('0x3f')](_[_0x8361('0x49')](_0x52aef1[_0x8361('0x3d')],_0x27f9b2[_0x8361('0x3f')]),_0x40c2d3);if(_0x52aef1[_0x8361('0x3d')]['filter']){_0x3c8978[_0x8361('0x48')]=_[_0x8361('0x4a')](_0x3c8978[_0x8361('0x48')],{'$or':_[_0x8361('0x2f')](_0x40c2d3,function(_0x515a64){if(_0x515a64[_0x8361('0x31')]!=='VIRTUAL'){var _0x52ca4a={};_0x52ca4a[_0x515a64[_0x8361('0x36')]]={'$like':'%'+_0x52aef1[_0x8361('0x3d')]['filter']+'%'};return _0x52ca4a;}})});}_0x3c8978=_[_0x8361('0x4a')]({},_0x3c8978,_0x52aef1[_0x8361('0x4b')]);var _0x2577d8={'where':_0x3c8978[_0x8361('0x48')]};return db['VoiceExtension'][_0x8361('0x1f')](_0x2577d8)[_0x8361('0x27')](function(_0x543592){_0x2dd565['count']=_0x543592;if(_0x52aef1['query'][_0x8361('0x4c')]){_0x3c8978[_0x8361('0x4d')]=[{'all':!![]}];}return db[_0x8361('0x38')]['findAll'](_0x3c8978);})[_0x8361('0x27')](function(_0x4f16f8){_0x2dd565[_0x8361('0x4e')]=_0x4f16f8;return _0x2dd565;})['then'](respondWithFilteredResult(_0x113342,_0x3c8978))['catch'](handleError(_0x113342,null));};exports[_0x8361('0x4f')]=function(_0x162882,_0x393fe3){var _0x530a49={'raw':![],'where':{'id':_0x162882['params']['id']}},_0x199cfb={};_0x199cfb[_0x8361('0x3c')]=_[_0x8361('0x3e')](db[_0x8361('0x38')][_0x8361('0x39')]);_0x199cfb[_0x8361('0x3d')]=_['keys'](_0x162882[_0x8361('0x3d')]);_0x199cfb['filters']=_[_0x8361('0x40')](_0x199cfb[_0x8361('0x3c')],_0x199cfb[_0x8361('0x3d')]);_0x530a49[_0x8361('0x41')]=_['intersection'](_0x199cfb['model'],qs['fields'](_0x162882[_0x8361('0x3d')][_0x8361('0x42')]));_0x530a49[_0x8361('0x41')]=_0x530a49[_0x8361('0x41')][_0x8361('0x43')]?_0x530a49[_0x8361('0x41')]:_0x199cfb[_0x8361('0x3c')];if(_0x162882[_0x8361('0x3d')][_0x8361('0x4c')]){_0x530a49['include']=[{'all':!![]}];}_0x530a49=_[_0x8361('0x4a')]({},_0x530a49,_0x162882[_0x8361('0x4b')]);return db[_0x8361('0x38')][_0x8361('0x50')](_0x530a49)[_0x8361('0x27')](handleEntityNotFound(_0x393fe3,null))['then'](respondWithResult(_0x393fe3,null))[_0x8361('0x51')](handleError(_0x393fe3,null));};exports[_0x8361('0x28')]=function(_0xd6aae5,_0x5886ee){return db[_0x8361('0x38')][_0x8361('0x50')]({'where':{'id':_0xd6aae5['params']['id']}})[_0x8361('0x27')](handleEntityNotFound(_0x5886ee,null))[_0x8361('0x27')](removeEntity(_0x5886ee,null))[_0x8361('0x51')](handleError(_0x5886ee,null));};exports[_0x8361('0x52')]=function(_0x238da5,_0x1522ec){if(_0x238da5[_0x8361('0x53')]['type']==='outbound'&&!_[_0x8361('0x54')](_0x238da5[_0x8361('0x53')][_0x8361('0x55')],'_')){_0x238da5[_0x8361('0x53')][_0x8361('0x55')]='_'['concat'](_0x238da5['body'][_0x8361('0x55')]);}return db[_0x8361('0x38')][_0x8361('0x52')](_0x238da5[_0x8361('0x53')],{'raw':![]})[_0x8361('0x27')](function(_0x59a2db){var _0x5076e7=_0x238da5['user'][_0x8361('0x29')]({'plain':!![]});if(!_0x5076e7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5076e7['role']===_0x8361('0x56')){var _0x33cfe6=_0x59a2db['get']({'plain':!![]});var _0x83a7bb=[{'name':_0x8361('0x2a'),'value':_0x8361('0x2b')},{'name':_0x8361('0x2c'),'value':'outbound'},{'name':_0x8361('0x57'),'value':'internal'}];var _0x3d9bec=_[_0x8361('0x50')](_0x83a7bb,[_0x8361('0x32'),_0x33cfe6[_0x8361('0x31')]])[_0x8361('0x36')];return db[_0x8361('0x58')]['find']({'where':{'name':_0x3d9bec,'userProfileId':_0x5076e7[_0x8361('0x59')]},'raw':!![]})[_0x8361('0x27')](function(_0x4ecc24){if(_0x4ecc24&&_0x4ecc24[_0x8361('0x5a')]===0x0){return db['UserProfileResource'][_0x8361('0x52')]({'name':_0x33cfe6['name'],'resourceId':_0x33cfe6['id'],'type':_0x4ecc24[_0x8361('0x36')],'sectionId':_0x4ecc24['id']},{})['then'](function(){return _0x59a2db;});}else{return _0x59a2db;}})[_0x8361('0x51')](function(_0xb3e5be){logger[_0x8361('0x34')](_0x8361('0x5b'),_0xb3e5be);throw _0xb3e5be;});}return _0x59a2db;})[_0x8361('0x27')](respondWithResult(_0x1522ec,0xc9))['catch'](handleError(_0x1522ec,null));};exports[_0x8361('0x5c')]=function(_0x3316f6,_0x410294){if(_0x3316f6['body']['id']){delete _0x3316f6[_0x8361('0x53')]['id'];}return db[_0x8361('0x38')][_0x8361('0x50')]({'where':{'id':_0x3316f6[_0x8361('0x5d')]['id']}})[_0x8361('0x27')](handleEntityNotFound(_0x410294,null))[_0x8361('0x27')](function(_0x33dfc6){if(_0x33dfc6){return db[_0x8361('0x38')][_0x8361('0x5c')](_['pick'](_0x3316f6[_0x8361('0x53')],[_0x8361('0x55'),_0x8361('0x5e'),_0x8361('0x5f'),'recordingFormat',_0x8361('0x60'),_0x8361('0x61')]),{'where':{'context':_0x33dfc6[_0x8361('0x5e')],'exten':_0x33dfc6[_0x8361('0x55')]},'individualHooks':!![]})['then'](function(_0xd0b06a){return _0xd0b06a;});}return null;})['then'](respondWithStatusCode(_0x410294,null))[_0x8361('0x51')](handleError(_0x410294,null));};exports[_0x8361('0x62')]=function(_0x55a9da,_0x49d6b9,_0x6f3c16){return db[_0x8361('0x38')][_0x8361('0x63')]({'where':{'id':_0x55a9da['params']['id']}})[_0x8361('0x27')](handleEntityNotFound(_0x49d6b9,null))[_0x8361('0x27')](function(_0xb91056){if(_0xb91056){return db[_0x8361('0x64')]['transaction'](function(_0x525226){return db['VoiceExtension'][_0x8361('0x28')]({'where':{'VoiceExtensionId':_0x55a9da['params']['id']},'transaction':_0x525226})[_0x8361('0x27')](function(_0x13a90c){var _0x557ad7=_[_0x8361('0x2f')](_0x55a9da[_0x8361('0x53')],function(_0x19e976){_0x19e976[_0x8361('0x65')]=_0x55a9da[_0x8361('0x5d')]['id'];return _0x19e976;});return db[_0x8361('0x38')][_0x8361('0x66')](_0x557ad7,{'transaction':_0x525226});});})[_0x8361('0x27')](function(){return db['VoiceExtension'][_0x8361('0x67')]({'where':{'isApp':!![],'VoiceExtensionId':_0x55a9da[_0x8361('0x5d')]['id']},'order':_0x8361('0x68')});});}})[_0x8361('0x27')](respondWithResult(_0x49d6b9,null))['catch'](handleError(_0x49d6b9,null));}; \ No newline at end of file +var _0x6d5e=['fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','count','includeAll','include','findAll','rows','catch','params','find','destroy','create','startsWith','exten','body','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','internal','UserProfileSection','autoAssociation','pick','description','cutdigits','mandatoryDisposition','context','addApplications','findOne','sequelize','transaction','VoiceExtensionId','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','undefined','offset','limit','set','Content-Range','reject','save','update','then','get','inbound','outbound','InternalRoutes','ignore','map','value','includes','type','name','UserProfileResource','error','stack','index','VoiceExtension','rawAttributes'];(function(_0xdff99f,_0x11811c){var _0x5bf22a=function(_0x451847){while(--_0x451847){_0xdff99f['push'](_0xdff99f['shift']());}};_0x5bf22a(++_0x11811c);}(_0x6d5e,0x103));var _0xe6d5=function(_0x456372,_0x42f6fb){_0x456372=_0x456372-0x0;var _0x537c34=_0x6d5e[_0x456372];return _0x537c34;};'use strict';var emlformat=require(_0xe6d5('0x0'));var rimraf=require(_0xe6d5('0x1'));var zipdir=require(_0xe6d5('0x2'));var jsonpatch=require(_0xe6d5('0x3'));var rp=require('request-promise');var moment=require(_0xe6d5('0x4'));var BPromise=require(_0xe6d5('0x5'));var Mustache=require(_0xe6d5('0x6'));var util=require(_0xe6d5('0x7'));var path=require(_0xe6d5('0x8'));var sox=require(_0xe6d5('0x9'));var csv=require(_0xe6d5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe6d5('0xb'));var _=require('lodash');var squel=require(_0xe6d5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe6d5('0xd'));var Papa=require(_0xe6d5('0xe'));var Redis=require(_0xe6d5('0xf'));var authService=require(_0xe6d5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe6d5('0x11'));var hardwareService=require(_0xe6d5('0x12'));var logger=require(_0xe6d5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xe6d5('0x14'));var licenseUtil=require(_0xe6d5('0x15'));var db=require(_0xe6d5('0x16'))['db'];config[_0xe6d5('0x17')]=_[_0xe6d5('0x18')](config[_0xe6d5('0x17')],{'host':_0xe6d5('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6d5('0x17')]));require(_0xe6d5('0x1a'))[_0xe6d5('0x1b')](socket);function respondWithStatusCode(_0x32dbdb,_0x88b75e){_0x88b75e=_0x88b75e||0xcc;return function(_0x42f2ba){if(_0x42f2ba){return _0x32dbdb[_0xe6d5('0x1c')](_0x88b75e);}return _0x32dbdb[_0xe6d5('0x1d')](_0x88b75e)[_0xe6d5('0x1e')]();};}function respondWithResult(_0x49adf8,_0x2a8aa7){_0x2a8aa7=_0x2a8aa7||0xc8;return function(_0x2adb34){if(_0x2adb34){return _0x49adf8[_0xe6d5('0x1d')](_0x2a8aa7)['json'](_0x2adb34);}};}function respondWithFilteredResult(_0x3847d1,_0xf0a8bf){return function(_0x5f5d7a){if(_0x5f5d7a){var _0x1f4ce6=typeof _0xf0a8bf['offset']===_0xe6d5('0x1f')&&typeof _0xf0a8bf['limit']==='undefined';var _0x3d9ccb=_0x5f5d7a['count'];var _0x35c3ee=_0x1f4ce6?0x0:_0xf0a8bf[_0xe6d5('0x20')];var _0x1b06e0=_0x1f4ce6?_0x5f5d7a['count']:_0xf0a8bf['offset']+_0xf0a8bf[_0xe6d5('0x21')];var _0x1c458a;if(_0x1b06e0>=_0x3d9ccb){_0x1b06e0=_0x3d9ccb;_0x1c458a=0xc8;}else{_0x1c458a=0xce;}_0x3847d1[_0xe6d5('0x1d')](_0x1c458a);return _0x3847d1[_0xe6d5('0x22')](_0xe6d5('0x23'),_0x35c3ee+'-'+_0x1b06e0+'/'+_0x3d9ccb)['json'](_0x5f5d7a);}return null;};}function patchUpdates(_0x19e2b4){return function(_0xeac707){try{jsonpatch['apply'](_0xeac707,_0x19e2b4,!![]);}catch(_0x344ed5){return BPromise[_0xe6d5('0x24')](_0x344ed5);}return _0xeac707[_0xe6d5('0x25')]();};}function saveUpdates(_0x49bd97,_0x1fdacf){return function(_0xb5d87d){if(_0xb5d87d){return _0xb5d87d[_0xe6d5('0x26')](_0x49bd97)[_0xe6d5('0x27')](function(_0x1be7b0){return _0x1be7b0;});}return null;};}function removeEntity(_0x26a768,_0x1e6a36){return function(_0x7f7bcd){if(_0x7f7bcd){return _0x7f7bcd['destroy']()[_0xe6d5('0x27')](function(){var _0x210b00=_0x7f7bcd[_0xe6d5('0x28')]({'plain':!![]});var _0x2e4bde=[{'name':'InboundRoutes','value':_0xe6d5('0x29'),'ignore':![]},{'name':'OutboundRoutes','value':_0xe6d5('0x2a'),'ignore':![]},{'name':_0xe6d5('0x2b'),'value':'internal','ignore':![]}];var _0x2bab45=_(_0x2e4bde)['filter'](_0xe6d5('0x2c'))[_0xe6d5('0x2d')](_0xe6d5('0x2e'))[_0xe6d5('0x2e')]();if(_[_0xe6d5('0x2f')](_0x2bab45,_0x210b00[_0xe6d5('0x30')])){return;}var _0x1b5d3f=_['find'](_0x2e4bde,[_0xe6d5('0x2e'),_0x210b00[_0xe6d5('0x30')]])[_0xe6d5('0x31')];return db[_0xe6d5('0x32')]['destroy']({'where':{'type':_0x1b5d3f,'resourceId':_0x210b00['id']}})[_0xe6d5('0x27')](function(){return _0x7f7bcd;});})[_0xe6d5('0x27')](function(){_0x26a768['status'](0xcc)[_0xe6d5('0x1e')]();});}};}function handleEntityNotFound(_0x594a25,_0x1fe99a){return function(_0x513cbd){if(!_0x513cbd){_0x594a25[_0xe6d5('0x1c')](0x194);}return _0x513cbd;};}function handleError(_0x5354b0,_0x12f3b0){_0x12f3b0=_0x12f3b0||0x1f4;return function(_0x2dc20a){logger[_0xe6d5('0x33')](_0x2dc20a[_0xe6d5('0x34')]);if(_0x2dc20a['name']){delete _0x2dc20a[_0xe6d5('0x31')];}_0x5354b0[_0xe6d5('0x1d')](_0x12f3b0)['send'](_0x2dc20a);};}exports[_0xe6d5('0x35')]=function(_0x38c757,_0x5cf193){var _0x2663ab={},_0x28466a={},_0x5de1ae={'count':0x0,'rows':[]};var _0x5a919=_[_0xe6d5('0x2d')](db[_0xe6d5('0x36')][_0xe6d5('0x37')],function(_0x28cedb){return{'name':_0x28cedb[_0xe6d5('0x38')],'type':_0x28cedb[_0xe6d5('0x30')][_0xe6d5('0x39')]};});_0x28466a['model']=_['map'](_0x5a919,_0xe6d5('0x31'));_0x28466a[_0xe6d5('0x3a')]=_[_0xe6d5('0x3b')](_0x38c757[_0xe6d5('0x3a')]);_0x28466a[_0xe6d5('0x3c')]=_[_0xe6d5('0x3d')](_0x28466a[_0xe6d5('0x3e')],_0x28466a[_0xe6d5('0x3a')]);_0x2663ab[_0xe6d5('0x3f')]=_[_0xe6d5('0x3d')](_0x28466a[_0xe6d5('0x3e')],qs[_0xe6d5('0x40')](_0x38c757[_0xe6d5('0x3a')][_0xe6d5('0x40')]));_0x2663ab[_0xe6d5('0x3f')]=_0x2663ab[_0xe6d5('0x3f')][_0xe6d5('0x41')]?_0x2663ab[_0xe6d5('0x3f')]:_0x28466a[_0xe6d5('0x3e')];if(!_0x38c757[_0xe6d5('0x3a')][_0xe6d5('0x42')](_0xe6d5('0x43'))){_0x2663ab[_0xe6d5('0x21')]=qs[_0xe6d5('0x21')](_0x38c757[_0xe6d5('0x3a')]['limit']);_0x2663ab[_0xe6d5('0x20')]=qs[_0xe6d5('0x20')](_0x38c757[_0xe6d5('0x3a')][_0xe6d5('0x20')]);}_0x2663ab[_0xe6d5('0x44')]=qs[_0xe6d5('0x45')](_0x38c757[_0xe6d5('0x3a')][_0xe6d5('0x45')]);_0x2663ab[_0xe6d5('0x46')]=qs[_0xe6d5('0x3c')](_['pick'](_0x38c757['query'],_0x28466a[_0xe6d5('0x3c')]),_0x5a919);if(_0x38c757['query']['filter']){_0x2663ab[_0xe6d5('0x46')]=_[_0xe6d5('0x47')](_0x2663ab[_0xe6d5('0x46')],{'$or':_[_0xe6d5('0x2d')](_0x5a919,function(_0x353323){if(_0x353323[_0xe6d5('0x30')]!=='VIRTUAL'){var _0x6e19d6={};_0x6e19d6[_0x353323['name']]={'$like':'%'+_0x38c757[_0xe6d5('0x3a')][_0xe6d5('0x48')]+'%'};return _0x6e19d6;}})});}_0x2663ab=_['merge']({},_0x2663ab,_0x38c757[_0xe6d5('0x49')]);var _0x47b934={'where':_0x2663ab['where']};return db[_0xe6d5('0x36')]['count'](_0x47b934)[_0xe6d5('0x27')](function(_0x375487){_0x5de1ae[_0xe6d5('0x4a')]=_0x375487;if(_0x38c757['query'][_0xe6d5('0x4b')]){_0x2663ab[_0xe6d5('0x4c')]=[{'all':!![]}];}return db[_0xe6d5('0x36')][_0xe6d5('0x4d')](_0x2663ab);})[_0xe6d5('0x27')](function(_0x5be411){_0x5de1ae[_0xe6d5('0x4e')]=_0x5be411;return _0x5de1ae;})[_0xe6d5('0x27')](respondWithFilteredResult(_0x5cf193,_0x2663ab))[_0xe6d5('0x4f')](handleError(_0x5cf193,null));};exports['show']=function(_0x7ff72e,_0xc696ca){var _0x544e87={'raw':![],'where':{'id':_0x7ff72e[_0xe6d5('0x50')]['id']}},_0x3a3ccd={};_0x3a3ccd[_0xe6d5('0x3e')]=_[_0xe6d5('0x3b')](db['VoiceExtension']['rawAttributes']);_0x3a3ccd['query']=_[_0xe6d5('0x3b')](_0x7ff72e[_0xe6d5('0x3a')]);_0x3a3ccd[_0xe6d5('0x3c')]=_[_0xe6d5('0x3d')](_0x3a3ccd[_0xe6d5('0x3e')],_0x3a3ccd['query']);_0x544e87[_0xe6d5('0x3f')]=_[_0xe6d5('0x3d')](_0x3a3ccd[_0xe6d5('0x3e')],qs['fields'](_0x7ff72e[_0xe6d5('0x3a')][_0xe6d5('0x40')]));_0x544e87[_0xe6d5('0x3f')]=_0x544e87[_0xe6d5('0x3f')][_0xe6d5('0x41')]?_0x544e87['attributes']:_0x3a3ccd[_0xe6d5('0x3e')];if(_0x7ff72e[_0xe6d5('0x3a')]['includeAll']){_0x544e87[_0xe6d5('0x4c')]=[{'all':!![]}];}_0x544e87=_[_0xe6d5('0x47')]({},_0x544e87,_0x7ff72e[_0xe6d5('0x49')]);return db[_0xe6d5('0x36')][_0xe6d5('0x51')](_0x544e87)[_0xe6d5('0x27')](handleEntityNotFound(_0xc696ca,null))[_0xe6d5('0x27')](respondWithResult(_0xc696ca,null))['catch'](handleError(_0xc696ca,null));};exports[_0xe6d5('0x52')]=function(_0x566502,_0x347fb6){return db[_0xe6d5('0x36')]['find']({'where':{'id':_0x566502[_0xe6d5('0x50')]['id']}})['then'](handleEntityNotFound(_0x347fb6,null))[_0xe6d5('0x27')](removeEntity(_0x347fb6,null))[_0xe6d5('0x4f')](handleError(_0x347fb6,null));};exports[_0xe6d5('0x53')]=function(_0x53b3b3,_0x2d5c22){if(_0x53b3b3['body'][_0xe6d5('0x30')]===_0xe6d5('0x2a')&&!_[_0xe6d5('0x54')](_0x53b3b3['body'][_0xe6d5('0x55')],'_')){_0x53b3b3[_0xe6d5('0x56')][_0xe6d5('0x55')]='_'[_0xe6d5('0x57')](_0x53b3b3[_0xe6d5('0x56')][_0xe6d5('0x55')]);}return db[_0xe6d5('0x36')][_0xe6d5('0x53')](_0x53b3b3[_0xe6d5('0x56')],{'raw':![]})['then'](function(_0x3cc28f){var _0x4f3347=_0x53b3b3[_0xe6d5('0x58')][_0xe6d5('0x28')]({'plain':!![]});if(!_0x4f3347)throw new Error(_0xe6d5('0x59'));if(_0x4f3347['role']===_0xe6d5('0x58')){var _0x59fcbc=_0x3cc28f[_0xe6d5('0x28')]({'plain':!![]});var _0x39dd3f=[{'name':_0xe6d5('0x5a'),'value':'inbound'},{'name':'OutboundRoutes','value':_0xe6d5('0x2a')},{'name':_0xe6d5('0x2b'),'value':_0xe6d5('0x5b')}];var _0x177c30=_[_0xe6d5('0x51')](_0x39dd3f,[_0xe6d5('0x2e'),_0x59fcbc[_0xe6d5('0x30')]])['name'];return db[_0xe6d5('0x5c')]['find']({'where':{'name':_0x177c30,'userProfileId':_0x4f3347['userProfileId']},'raw':!![]})['then'](function(_0x4f9e28){if(_0x4f9e28&&_0x4f9e28[_0xe6d5('0x5d')]===0x0){return db[_0xe6d5('0x32')]['create']({'name':_0x59fcbc[_0xe6d5('0x31')],'resourceId':_0x59fcbc['id'],'type':_0x4f9e28[_0xe6d5('0x31')],'sectionId':_0x4f9e28['id']},{})[_0xe6d5('0x27')](function(){return _0x3cc28f;});}else{return _0x3cc28f;}})['catch'](function(_0x74e59d){logger[_0xe6d5('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x74e59d);throw _0x74e59d;});}return _0x3cc28f;})[_0xe6d5('0x27')](respondWithResult(_0x2d5c22,0xc9))[_0xe6d5('0x4f')](handleError(_0x2d5c22,null));};exports[_0xe6d5('0x26')]=function(_0x4f8231,_0x3cfd58){if(_0x4f8231['body']['id']){delete _0x4f8231[_0xe6d5('0x56')]['id'];}return db[_0xe6d5('0x36')][_0xe6d5('0x51')]({'where':{'id':_0x4f8231[_0xe6d5('0x50')]['id']}})[_0xe6d5('0x27')](handleEntityNotFound(_0x3cfd58,null))[_0xe6d5('0x27')](function(_0x2ba4a3){if(_0x2ba4a3){return db[_0xe6d5('0x36')][_0xe6d5('0x26')](_[_0xe6d5('0x5e')](_0x4f8231[_0xe6d5('0x56')],[_0xe6d5('0x55'),'context',_0xe6d5('0x5f'),'recordingFormat',_0xe6d5('0x60'),_0xe6d5('0x61')]),{'where':{'context':_0x2ba4a3[_0xe6d5('0x62')],'exten':_0x2ba4a3['exten']},'individualHooks':!![]})['then'](function(_0x499a2e){return _0x499a2e;});}return null;})['then'](respondWithStatusCode(_0x3cfd58,null))['catch'](handleError(_0x3cfd58,null));};exports[_0xe6d5('0x63')]=function(_0x3be5eb,_0x183ad4,_0x1adfe1){return db[_0xe6d5('0x36')][_0xe6d5('0x64')]({'where':{'id':_0x3be5eb[_0xe6d5('0x50')]['id']}})[_0xe6d5('0x27')](handleEntityNotFound(_0x183ad4,null))['then'](function(_0x21378b){if(_0x21378b){return db[_0xe6d5('0x65')][_0xe6d5('0x66')](function(_0xd9c361){return db['VoiceExtension'][_0xe6d5('0x52')]({'where':{'VoiceExtensionId':_0x3be5eb['params']['id']},'transaction':_0xd9c361})[_0xe6d5('0x27')](function(_0x2cd56c){var _0x5834af=_[_0xe6d5('0x2d')](_0x3be5eb['body'],function(_0x2ec566){_0x2ec566[_0xe6d5('0x67')]=_0x3be5eb[_0xe6d5('0x50')]['id'];return _0x2ec566;});return db[_0xe6d5('0x36')]['bulkCreate'](_0x5834af,{'transaction':_0xd9c361});});})[_0xe6d5('0x27')](function(){return db[_0xe6d5('0x36')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x3be5eb[_0xe6d5('0x50')]['id']},'order':_0xe6d5('0x68')});});}})[_0xe6d5('0x27')](respondWithResult(_0x183ad4,null))[_0xe6d5('0x4f')](handleError(_0x183ad4,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index c1501b1..2a0252a 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 _0x136a=['exports','events','VoiceExtension','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0xeb0630,_0x22a776){var _0x2fda39=function(_0x4589d6){while(--_0x4589d6){_0xeb0630['push'](_0xeb0630['shift']());}};_0x2fda39(++_0x22a776);}(_0x136a,0x196));var _0xa136=function(_0x4b4914,_0x14dd73){_0x4b4914=_0x4b4914-0x0;var _0x46b2c1=_0x136a[_0x4b4914];return _0x46b2c1;};'use strict';var EventEmitter=require(_0xa136('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xa136('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa136('0x2')](0x0);var events={'afterCreate':_0xa136('0x3'),'afterUpdate':'update','afterDestroy':_0xa136('0x4')};function emitEvent(_0x10b93f){return function(_0x335d34,_0x418de6,_0x502c98){VoiceExtensionEvents[_0xa136('0x5')](_0x10b93f+':'+_0x335d34['id'],_0x335d34);VoiceExtensionEvents['emit'](_0x10b93f,_0x335d34);_0x502c98(null);};}for(var e in events){if(events[_0xa136('0x6')](e)){var event=events[e];VoiceExtension[_0xa136('0x7')](e,emitEvent(event));}}module[_0xa136('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x0519=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x184e69,_0x39af04){var _0x57d8ad=function(_0x153dd9){while(--_0x153dd9){_0x184e69['push'](_0x184e69['shift']());}};_0x57d8ad(++_0x39af04);}(_0x0519,0x16c));var _0x9051=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x0519[_0x609988];return _0x159984;};'use strict';var EventEmitter=require(_0x9051('0x0'));var VoiceExtension=require(_0x9051('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9051('0x2'),'afterUpdate':_0x9051('0x3'),'afterDestroy':_0x9051('0x4')};function emitEvent(_0x1429db){return function(_0x293648,_0x4c3641,_0x374005){VoiceExtensionEvents['emit'](_0x1429db+':'+_0x293648['id'],_0x293648);VoiceExtensionEvents[_0x9051('0x5')](_0x1429db,_0x293648);_0x374005(null);};}for(var e in events){if(events[_0x9051('0x6')](e)){var event=events[e];VoiceExtension[_0x9051('0x7')](e,emitEvent(event));}}module[_0x9051('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 ac75d1f..af7cfde 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 _0xc092=['exports','define','VoiceExtension','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x233dc1,_0x1dd97b){var _0x3ef666=function(_0x11988b){while(--_0x11988b){_0x233dc1['push'](_0x233dc1['shift']());}};_0x3ef666(++_0x1dd97b);}(_0xc092,0x92));var _0x2c09=function(_0x4660b2,_0x4045ee){_0x4660b2=_0x4660b2-0x0;var _0x5a33a4=_0xc092[_0x4660b2];return _0x5a33a4;};'use strict';var _=require('lodash');var util=require(_0x2c09('0x0'));var logger=require(_0x2c09('0x1'))('api');var moment=require(_0x2c09('0x2'));var BPromise=require(_0x2c09('0x3'));var rp=require(_0x2c09('0x4'));var fs=require('fs');var path=require(_0x2c09('0x5'));var rimraf=require(_0x2c09('0x6'));var config=require(_0x2c09('0x7'));var attributes=require('./voiceExtension.attributes');module[_0x2c09('0x8')]=function(_0x3f4016,_0x3df37d){return _0x3f4016[_0x2c09('0x9')](_0x2c09('0xa'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0461=['bluebird','request-promise','path','rimraf','./voiceExtension.attributes','define','voice_extensions','lodash','util','../../config/logger','moment'];(function(_0x3b3d88,_0x2c90de){var _0x32d5d7=function(_0x53d5ca){while(--_0x53d5ca){_0x3b3d88['push'](_0x3b3d88['shift']());}};_0x32d5d7(++_0x2c90de);}(_0x0461,0x151));var _0x1046=function(_0x3d19bf,_0x4767b5){_0x3d19bf=_0x3d19bf-0x0;var _0x3776de=_0x0461[_0x3d19bf];return _0x3776de;};'use strict';var _=require(_0x1046('0x0'));var util=require(_0x1046('0x1'));var logger=require(_0x1046('0x2'))('api');var moment=require(_0x1046('0x3'));var BPromise=require(_0x1046('0x4'));var rp=require(_0x1046('0x5'));var fs=require('fs');var path=require(_0x1046('0x6'));var rimraf=require(_0x1046('0x7'));var config=require('../../config/environment');var attributes=require(_0x1046('0x8'));module['exports']=function(_0x34242f,_0x51b8a3){return _0x34242f[_0x1046('0x9')]('VoiceExtension',attributes,{'tableName':_0x1046('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index abab08a..d76390c 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 _0x439e=['limit','include','map','model','GetVoiceExtension','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VoiceExtension','options','raw','where','attributes'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x439e,0xa2));var _0xe439=function(_0xdd079,_0x3ee867){_0xdd079=_0xdd079-0x0;var _0x5022ec=_0x439e[_0xdd079];return _0x5022ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe439('0x0'));var BPromise=require(_0xe439('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe439('0x2'));var db=require(_0xe439('0x3'))['db'];var utils=require(_0xe439('0x4'));var logger=require(_0xe439('0x5'))(_0xe439('0x6'));var config=require(_0xe439('0x7'));var jayson=require(_0xe439('0x8'));var client=jayson[_0xe439('0x9')][_0xe439('0xa')]({'port':0x232a});config['redis']=_[_0xe439('0xb')](config[_0xe439('0xc')],{'host':_0xe439('0xd'),'port':0x18eb});var socket=require(_0xe439('0xe'))(new Redis(config['redis']));require(_0xe439('0xf'))[_0xe439('0x10')](socket);function respondWithRpcPromise(_0x1dde19,_0x576d91,_0x5074e1){return new BPromise(function(_0x4edcaa,_0x16a95){return client[_0xe439('0x11')](_0x1dde19,_0x5074e1)[_0xe439('0x12')](function(_0x1a689f){logger[_0xe439('0x13')](_0xe439('0x14'),_0x576d91,_0xe439('0x15'));logger[_0xe439('0x16')](_0xe439('0x17'),_0x576d91,_0xe439('0x15'),JSON[_0xe439('0x18')](_0x1a689f));if(_0x1a689f[_0xe439('0x19')]){if(_0x1a689f[_0xe439('0x19')]['code']===0x1f4){logger[_0xe439('0x19')](_0xe439('0x14'),_0x576d91,_0x1a689f[_0xe439('0x19')][_0xe439('0x1a')]);return _0x16a95(_0x1a689f[_0xe439('0x19')][_0xe439('0x1a')]);}logger['error'](_0xe439('0x14'),_0x576d91,_0x1a689f['error']['message']);return _0x4edcaa(_0x1a689f[_0xe439('0x19')]['message']);}else{logger[_0xe439('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x576d91,'request\x20sent');_0x4edcaa(_0x1a689f[_0xe439('0x1b')][_0xe439('0x1a')]);}})['catch'](function(_0x12a0b0){logger[_0xe439('0x19')](_0xe439('0x14'),_0x576d91,_0x12a0b0);_0x16a95(_0x12a0b0);});});}exports['GetVoiceExtension']=function(_0x89cc8a){var _0x11201f=this;return new Promise(function(_0x4a7bb3,_0x2488ca){return db[_0xe439('0x1c')]['findAll']({'raw':_0x89cc8a[_0xe439('0x1d')]?_0x89cc8a['options'][_0xe439('0x1e')]===undefined?!![]:![]:!![],'where':_0x89cc8a[_0xe439('0x1d')]?_0x89cc8a[_0xe439('0x1d')][_0xe439('0x1f')]||null:null,'attributes':_0x89cc8a[_0xe439('0x1d')]?_0x89cc8a[_0xe439('0x1d')][_0xe439('0x20')]||null:null,'limit':_0x89cc8a[_0xe439('0x1d')]?_0x89cc8a[_0xe439('0x1d')][_0xe439('0x21')]||null:null,'include':_0x89cc8a['options']?_0x89cc8a[_0xe439('0x1d')][_0xe439('0x22')]?_[_0xe439('0x23')](_0x89cc8a['options'][_0xe439('0x22')],function(_0x20fda6){return{'model':db[_0x20fda6[_0xe439('0x24')]],'as':_0x20fda6['as'],'attributes':_0x20fda6[_0xe439('0x20')],'include':_0x20fda6[_0xe439('0x22')]?_[_0xe439('0x23')](_0x20fda6['include'],function(_0x48c4ab){return{'model':db[_0x48c4ab[_0xe439('0x24')]],'as':_0x48c4ab['as'],'attributes':_0x48c4ab[_0xe439('0x20')],'include':_0x48c4ab[_0xe439('0x22')]?_[_0xe439('0x23')](_0x48c4ab[_0xe439('0x22')],function(_0x1d193d){return{'model':db[_0x1d193d[_0xe439('0x24')]],'as':_0x1d193d['as'],'attributes':_0x1d193d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x52baf7){logger[_0xe439('0x13')](_0xe439('0x25'),_0x89cc8a);logger[_0xe439('0x16')](_0xe439('0x25'),_0x89cc8a,JSON[_0xe439('0x18')](_0x52baf7));_0x4a7bb3(_0x52baf7);})[_0xe439('0x26')](function(_0xe5fd7a){logger[_0xe439('0x19')](_0xe439('0x25'),_0xe5fd7a['message'],_0x89cc8a);_0x2488ca(_0x11201f['error'](0x1f4,_0xe5fd7a[_0xe439('0x1a')]));});});}; \ No newline at end of file +var _0x3411=['ioredis','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceExtension','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','util','bluebird','randomstring'];(function(_0x5a19fc,_0x58f9f4){var _0x34b413=function(_0x344feb){while(--_0x344feb){_0x5a19fc['push'](_0x5a19fc['shift']());}};_0x34b413(++_0x58f9f4);}(_0x3411,0x1a1));var _0x1341=function(_0x4131e2,_0x13313a){_0x4131e2=_0x4131e2-0x0;var _0x2bb5fb=_0x3411[_0x4131e2];return _0x2bb5fb;};'use strict';var _=require('lodash');var util=require(_0x1341('0x0'));var moment=require('moment');var BPromise=require(_0x1341('0x1'));var rs=require(_0x1341('0x2'));var fs=require('fs');var Redis=require(_0x1341('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1341('0x4'))(_0x1341('0x5'));var config=require(_0x1341('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1341('0x7')]['http']({'port':0x232a});config['redis']=_[_0x1341('0x8')](config[_0x1341('0x9')],{'host':_0x1341('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1341('0x9')]));require('./voiceExtension.socket')[_0x1341('0xb')](socket);function respondWithRpcPromise(_0x11ed03,_0x484917,_0x1b8195){return new BPromise(function(_0x130d95,_0x54a587){return client[_0x1341('0xc')](_0x11ed03,_0x1b8195)[_0x1341('0xd')](function(_0x565415){logger['info'](_0x1341('0xe'),_0x484917,_0x1341('0xf'));logger[_0x1341('0x10')](_0x1341('0x11'),_0x484917,_0x1341('0xf'),JSON[_0x1341('0x12')](_0x565415));if(_0x565415['error']){if(_0x565415[_0x1341('0x13')][_0x1341('0x14')]===0x1f4){logger[_0x1341('0x13')](_0x1341('0xe'),_0x484917,_0x565415['error']['message']);return _0x54a587(_0x565415[_0x1341('0x13')][_0x1341('0x15')]);}logger[_0x1341('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x484917,_0x565415['error'][_0x1341('0x15')]);return _0x130d95(_0x565415['error'][_0x1341('0x15')]);}else{logger[_0x1341('0x16')](_0x1341('0xe'),_0x484917,_0x1341('0xf'));_0x130d95(_0x565415[_0x1341('0x17')][_0x1341('0x15')]);}})[_0x1341('0x18')](function(_0x383576){logger[_0x1341('0x13')](_0x1341('0xe'),_0x484917,_0x383576);_0x54a587(_0x383576);});});}exports['GetVoiceExtension']=function(_0x421932){var _0x2842f6=this;return new Promise(function(_0x287e16,_0x103070){return db[_0x1341('0x19')]['findAll']({'raw':_0x421932['options']?_0x421932[_0x1341('0x1a')][_0x1341('0x1b')]===undefined?!![]:![]:!![],'where':_0x421932['options']?_0x421932['options'][_0x1341('0x1c')]||null:null,'attributes':_0x421932[_0x1341('0x1a')]?_0x421932['options'][_0x1341('0x1d')]||null:null,'limit':_0x421932[_0x1341('0x1a')]?_0x421932[_0x1341('0x1a')][_0x1341('0x1e')]||null:null,'include':_0x421932[_0x1341('0x1a')]?_0x421932[_0x1341('0x1a')][_0x1341('0x1f')]?_[_0x1341('0x20')](_0x421932[_0x1341('0x1a')][_0x1341('0x1f')],function(_0x10453f){return{'model':db[_0x10453f[_0x1341('0x21')]],'as':_0x10453f['as'],'attributes':_0x10453f[_0x1341('0x1d')],'include':_0x10453f[_0x1341('0x1f')]?_[_0x1341('0x20')](_0x10453f[_0x1341('0x1f')],function(_0xb5baec){return{'model':db[_0xb5baec[_0x1341('0x21')]],'as':_0xb5baec['as'],'attributes':_0xb5baec[_0x1341('0x1d')],'include':_0xb5baec['include']?_[_0x1341('0x20')](_0xb5baec[_0x1341('0x1f')],function(_0x443485){return{'model':db[_0x443485[_0x1341('0x21')]],'as':_0x443485['as'],'attributes':_0x443485[_0x1341('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1341('0xd')](function(_0x5ee2e1){logger[_0x1341('0x16')](_0x1341('0x22'),_0x421932);logger['debug'](_0x1341('0x22'),_0x421932,JSON['stringify'](_0x5ee2e1));_0x287e16(_0x5ee2e1);})[_0x1341('0x18')](function(_0x4eb688){logger[_0x1341('0x13')](_0x1341('0x22'),_0x4eb688[_0x1341('0x15')],_0x421932);_0x103070(_0x2842f6[_0x1341('0x13')](0x1f4,_0x4eb688['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a167dd1..d63af51 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 _0x55b0=['save','remove','update','emit','voiceExtension:','./voiceExtension.events'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0x55b0,0x95));var _0x055b=function(_0x4f4eaf,_0x1c05cc){_0x4f4eaf=_0x4f4eaf-0x0;var _0x24565d=_0x55b0[_0x4f4eaf];return _0x24565d;};'use strict';var VoiceExtensionEvents=require(_0x055b('0x0'));var events=[_0x055b('0x1'),_0x055b('0x2'),_0x055b('0x3')];function createListener(_0x420395,_0x2400a8){return function(_0x2f5a0d){_0x2400a8[_0x055b('0x4')](_0x420395,_0x2f5a0d);};}function removeListener(_0x1204b6,_0x224c94){return function(){VoiceExtensionEvents['removeListener'](_0x1204b6,_0x224c94);};}exports['register']=function(_0x14f575){for(var _0x584657=0x0,_0xc52518=events['length'];_0x584657<_0xc52518;_0x584657++){var _0x3ba1b4=events[_0x584657];var _0xcc697=createListener(_0x055b('0x5')+_0x3ba1b4,_0x14f575);VoiceExtensionEvents['on'](_0x3ba1b4,_0xcc697);}}; \ No newline at end of file +var _0xe029=['removeListener','register','voiceExtension:','./voiceExtension.events','save','emit'];(function(_0x5c3223,_0x34e68f){var _0x2427a6=function(_0x921a86){while(--_0x921a86){_0x5c3223['push'](_0x5c3223['shift']());}};_0x2427a6(++_0x34e68f);}(_0xe029,0x99));var _0x9e02=function(_0x7e95c9,_0xe40903){_0x7e95c9=_0x7e95c9-0x0;var _0x55f967=_0xe029[_0x7e95c9];return _0x55f967;};'use strict';var VoiceExtensionEvents=require(_0x9e02('0x0'));var events=[_0x9e02('0x1'),'remove','update'];function createListener(_0x3aedab,_0x4940a9){return function(_0x176475){_0x4940a9[_0x9e02('0x2')](_0x3aedab,_0x176475);};}function removeListener(_0x5f0108,_0x39eacd){return function(){VoiceExtensionEvents[_0x9e02('0x3')](_0x5f0108,_0x39eacd);};}exports[_0x9e02('0x4')]=function(_0x2acbdc){for(var _0x20d8d3=0x0,_0x3cf87f=events['length'];_0x20d8d3<_0x3cf87f;_0x20d8d3++){var _0xb763ed=events[_0x20d8d3];var _0x52845c=createListener(_0x9e02('0x5')+_0xb763ed,_0x2acbdc);VoiceExtensionEvents['on'](_0xb763ed,_0x52845c);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index b2a24c8..f4b627e 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 _0xd64b=['../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','/:id/messages','post','create','update','delete','exports','multer','path','express','Router','fs-extra'];(function(_0x4fcec7,_0x56be81){var _0x929e19=function(_0x40d9f4){while(--_0x40d9f4){_0x4fcec7['push'](_0x4fcec7['shift']());}};_0x929e19(++_0x56be81);}(_0xd64b,0xc1));var _0xbd64=function(_0x2dd628,_0x3c22e4){_0x2dd628=_0x2dd628-0x0;var _0x2e138c=_0xd64b[_0x2dd628];return _0x2e138c;};'use strict';var multer=require(_0xbd64('0x0'));var util=require('util');var path=require(_0xbd64('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd64('0x2'));var router=express[_0xbd64('0x3')]();var fs_extra=require(_0xbd64('0x4'));var auth=require(_0xbd64('0x5'));var interaction=require(_0xbd64('0x6'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbd64('0x7')]);router[_0xbd64('0x8')](_0xbd64('0x9'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xb')]);router[_0xbd64('0x8')](_0xbd64('0xc'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbd64('0xd')]('/',auth[_0xbd64('0xa')](),controller[_0xbd64('0xe')]);router['put'](_0xbd64('0x9'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xf')]);router[_0xbd64('0x10')]('/:id',auth[_0xbd64('0xa')](),controller['destroy']);module[_0xbd64('0x11')]=router; \ No newline at end of file +var _0x1152=['isAuthenticated','/:id/messages','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0x1152,0x182));var _0x2115=function(_0x5cf93c,_0x2b5075){_0x5cf93c=_0x5cf93c-0x0;var _0x56aa24=_0x1152[_0x5cf93c];return _0x56aa24;};'use strict';var multer=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var path=require(_0x2115('0x2'));var timeout=require(_0x2115('0x3'));var express=require(_0x2115('0x4'));var router=express[_0x2115('0x5')]();var fs_extra=require(_0x2115('0x6'));var auth=require(_0x2115('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2115('0x8'));var controller=require('./voiceMail.controller');router[_0x2115('0x9')]('/',auth[_0x2115('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2115('0x9')](_0x2115('0xb'),auth[_0x2115('0xa')](),controller['getMessages']);router[_0x2115('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2115('0xd')](_0x2115('0xe'),auth[_0x2115('0xa')](),controller['update']);router[_0x2115('0xf')]('/:id',auth[_0x2115('0xa')](),controller[_0x2115('0x10')]);module[_0x2115('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 66a4c77..9d4af76 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 _0x36ee=['trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','mailbox','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x431d4e,_0x402f81){var _0x2abe2c=function(_0x40e9c3){while(--_0x40e9c3){_0x431d4e['push'](_0x431d4e['shift']());}};_0x2abe2c(++_0x402f81);}(_0x36ee,0xe8));var _0xe36e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x36ee[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0xe36e('0x0')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xe36e('0x1'),'unique':_0xe36e('0x2')},'mailbox':{'type':Sequelize[_0xe36e('0x0')],'defaultValue':'','allowNull':![],'unique':_0xe36e('0x2')},'password':{'type':Sequelize[_0xe36e('0x0')]},'fullname':{'type':Sequelize[_0xe36e('0x0')]},'email':{'type':Sequelize[_0xe36e('0x0')],'validate':{'isEmail':!![]},'set':function(_0x3f29e1){this[_0xe36e('0x3')](_0xe36e('0x4'),typeof _0x3f29e1===_0xe36e('0x5')&&_0x3f29e1[_0xe36e('0x6')]()?_0x3f29e1['trim']():null);}},'pager':{'type':Sequelize[_0xe36e('0x0')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xe36e('0x7')},'attach':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xe36e('0x8')]('yes','no'),'defaultValue':_0xe36e('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xe36e('0x0')]},'callback':{'type':Sequelize[_0xe36e('0x0')]},'review':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xe36e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xe36e('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xe36e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xe36e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xe36e('0x9'),'no'),'defaultValue':_0xe36e('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':_0xe36e('0x9'),'allowNull':![]},'stamp':{'type':_0xe36e('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xe36e('0x0')]},'maxsecs':{'type':Sequelize[_0xe36e('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xe36e('0xd')],'get':function(){return this['getDataValue'](_0xe36e('0xe'))+_0xe36e('0xf')+this['getDataValue'](_0xe36e('0x10'));}}}; \ No newline at end of file +var _0xd8b0=['trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','contest_mailbox','STRING','setDataValue','email','string'];(function(_0x3b45e4,_0x329893){var _0x502b9d=function(_0x3c8d99){while(--_0x3c8d99){_0x3b45e4['push'](_0x3b45e4['shift']());}};_0x502b9d(++_0x329893);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':_0x0d8b('0x2')},'mailbox':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':'','allowNull':![],'unique':_0x0d8b('0x2')},'password':{'type':Sequelize[_0x0d8b('0x3')]},'fullname':{'type':Sequelize[_0x0d8b('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x5e15e6){this[_0x0d8b('0x4')](_0x0d8b('0x5'),typeof _0x5e15e6===_0x0d8b('0x6')&&_0x5e15e6['trim']()?_0x5e15e6[_0x0d8b('0x7')]():null);}},'pager':{'type':Sequelize[_0x0d8b('0x3')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0x8')},'attach':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':_0x0d8b('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':_0x0d8b('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0d8b('0x3')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x0d8b('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0d8b('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':_0x0d8b('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0d8b('0x9')](_0x0d8b('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x0d8b('0xc')},'emailsubject':{'type':Sequelize[_0x0d8b('0x3')]},'emailbody':{'type':Sequelize[_0x0d8b('0x3')]},'maxsecs':{'type':Sequelize[_0x0d8b('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0d8b('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0d8b('0xe')],'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x10'))+'\x20-\x20'+this[_0x0d8b('0xf')](_0x0d8b('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 9db0ec0..1a2f556 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 _0x1e4c=['order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','update','getMessages','VoiceMailMessage','hasOwnProperty','options','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','count','limit','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','end','error','name','send','index','map','VoiceMail','type','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit'];(function(_0x523bd2,_0x4c3ecc){var _0x4a1012=function(_0x353d0b){while(--_0x353d0b){_0x523bd2['push'](_0x523bd2['shift']());}};_0x4a1012(++_0x4c3ecc);}(_0x1e4c,0x1b6));var _0xc1e4=function(_0x317f6b,_0x47c05b){_0x317f6b=_0x317f6b-0x0;var _0x5092e7=_0x1e4c[_0x317f6b];return _0x5092e7;};'use strict';var emlformat=require(_0xc1e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1e4('0x1'));var jsonpatch=require(_0xc1e4('0x2'));var rp=require(_0xc1e4('0x3'));var moment=require('moment');var BPromise=require(_0xc1e4('0x4'));var Mustache=require(_0xc1e4('0x5'));var util=require(_0xc1e4('0x6'));var path=require(_0xc1e4('0x7'));var sox=require(_0xc1e4('0x8'));var csv=require(_0xc1e4('0x9'));var ejs=require(_0xc1e4('0xa'));var fs=require('fs');var fs_extra=require(_0xc1e4('0xb'));var _=require(_0xc1e4('0xc'));var squel=require(_0xc1e4('0xd'));var crypto=require(_0xc1e4('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc1e4('0x9'));var querystring=require(_0xc1e4('0xf'));var Papa=require(_0xc1e4('0x10'));var Redis=require(_0xc1e4('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1e4('0x12'));var logger=require(_0xc1e4('0x13'))('api');var utils=require(_0xc1e4('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc1e4('0x15'))['db'];function respondWithStatusCode(_0x329662,_0x3a8d65){_0x3a8d65=_0x3a8d65||0xcc;return function(_0x5c190b){if(_0x5c190b){return _0x329662[_0xc1e4('0x16')](_0x3a8d65);}return _0x329662['status'](_0x3a8d65)['end']();};}function respondWithResult(_0x4c8d16,_0x42ebe8){_0x42ebe8=_0x42ebe8||0xc8;return function(_0x4b9a6b){if(_0x4b9a6b){return _0x4c8d16[_0xc1e4('0x17')](_0x42ebe8)['json'](_0x4b9a6b);}};}function respondWithFilteredResult(_0x392c8b,_0x34f598){return function(_0x5e77d5){if(_0x5e77d5){var _0x5b2af6=typeof _0x34f598[_0xc1e4('0x18')]===_0xc1e4('0x19')&&typeof _0x34f598['limit']===_0xc1e4('0x19');var _0x5106e2=_0x5e77d5[_0xc1e4('0x1a')];var _0x5b5361=_0x5b2af6?0x0:_0x34f598[_0xc1e4('0x18')];var _0x27c8b1=_0x5b2af6?_0x5e77d5[_0xc1e4('0x1a')]:_0x34f598['offset']+_0x34f598[_0xc1e4('0x1b')];var _0x6a6b81;if(_0x27c8b1>=_0x5106e2){_0x27c8b1=_0x5106e2;_0x6a6b81=0xc8;}else{_0x6a6b81=0xce;}_0x392c8b['status'](_0x6a6b81);return _0x392c8b['set']('Content-Range',_0x5b5361+'-'+_0x27c8b1+'/'+_0x5106e2)['json'](_0x5e77d5);}return null;};}function patchUpdates(_0x5c03bd){return function(_0x15fca5){try{jsonpatch[_0xc1e4('0x1c')](_0x15fca5,_0x5c03bd,!![]);}catch(_0x255da0){return BPromise[_0xc1e4('0x1d')](_0x255da0);}return _0x15fca5[_0xc1e4('0x1e')]();};}function saveUpdates(_0x3d4a85,_0x2ef408){return function(_0x18fbec){if(_0x18fbec){return _0x18fbec['update'](_0x3d4a85)[_0xc1e4('0x1f')](function(_0x3ec82f){return _0x3ec82f;});}return null;};}function removeEntity(_0x124cb8,_0x4e5673){return function(_0x578779){if(_0x578779){return _0x578779[_0xc1e4('0x20')]()[_0xc1e4('0x1f')](function(){var _0x992368=_0x578779[_0xc1e4('0x21')]({'plain':!![]});var _0x101272=_0xc1e4('0x22');return db[_0xc1e4('0x23')][_0xc1e4('0x20')]({'where':{'type':_0x101272,'resourceId':_0x992368['id']}})[_0xc1e4('0x1f')](function(){return _0x578779;});})[_0xc1e4('0x1f')](function(){_0x124cb8[_0xc1e4('0x17')](0xcc)[_0xc1e4('0x24')]();});}};}function handleEntityNotFound(_0x367a94,_0x4a2262){return function(_0x41f945){if(!_0x41f945){_0x367a94[_0xc1e4('0x16')](0x194);}return _0x41f945;};}function handleError(_0x5984f3,_0x16fc8a){_0x16fc8a=_0x16fc8a||0x1f4;return function(_0x49bb06){logger[_0xc1e4('0x25')](_0x49bb06['stack']);if(_0x49bb06[_0xc1e4('0x26')]){delete _0x49bb06[_0xc1e4('0x26')];}_0x5984f3[_0xc1e4('0x17')](_0x16fc8a)[_0xc1e4('0x27')](_0x49bb06);};}exports[_0xc1e4('0x28')]=function(_0x1183c4,_0x5c8225){var _0x455165={},_0x3238c7={},_0x750a83={'count':0x0,'rows':[]};var _0x5bf2e0=_[_0xc1e4('0x29')](db[_0xc1e4('0x2a')]['rawAttributes'],function(_0x1cb588){return{'name':_0x1cb588['fieldName'],'type':_0x1cb588[_0xc1e4('0x2b')][_0xc1e4('0x2c')]};});_0x3238c7[_0xc1e4('0x2d')]=_[_0xc1e4('0x29')](_0x5bf2e0,'name');_0x3238c7[_0xc1e4('0x2e')]=_[_0xc1e4('0x2f')](_0x1183c4[_0xc1e4('0x2e')]);_0x3238c7[_0xc1e4('0x30')]=_['intersection'](_0x3238c7[_0xc1e4('0x2d')],_0x3238c7[_0xc1e4('0x2e')]);_0x455165['attributes']=_[_0xc1e4('0x31')](_0x3238c7[_0xc1e4('0x2d')],qs[_0xc1e4('0x32')](_0x1183c4[_0xc1e4('0x2e')]['fields']));_0x455165['attributes']=_0x455165['attributes'][_0xc1e4('0x33')]?_0x455165[_0xc1e4('0x34')]:_0x3238c7[_0xc1e4('0x2d')];if(!_0x1183c4[_0xc1e4('0x2e')]['hasOwnProperty'](_0xc1e4('0x35'))){_0x455165[_0xc1e4('0x1b')]=qs['limit'](_0x1183c4['query'][_0xc1e4('0x1b')]);_0x455165[_0xc1e4('0x18')]=qs[_0xc1e4('0x18')](_0x1183c4[_0xc1e4('0x2e')][_0xc1e4('0x18')]);}_0x455165[_0xc1e4('0x36')]=qs['sort'](_0x1183c4[_0xc1e4('0x2e')][_0xc1e4('0x37')]);_0x455165[_0xc1e4('0x38')]=qs[_0xc1e4('0x30')](_[_0xc1e4('0x39')](_0x1183c4['query'],_0x3238c7[_0xc1e4('0x30')]),_0x5bf2e0);if(_0x1183c4[_0xc1e4('0x2e')][_0xc1e4('0x3a')]){_0x455165[_0xc1e4('0x38')]=_['merge'](_0x455165[_0xc1e4('0x38')],{'$or':_['map'](_0x5bf2e0,function(_0x7df984){if(_0x7df984['type']!==_0xc1e4('0x3b')){var _0x12dc9b={};_0x12dc9b[_0x7df984['name']]={'$like':'%'+_0x1183c4[_0xc1e4('0x2e')][_0xc1e4('0x3a')]+'%'};return _0x12dc9b;}})});}_0x455165=_['merge']({},_0x455165,_0x1183c4['options']);var _0x2c2a6d={'where':_0x455165['where']};return db[_0xc1e4('0x2a')][_0xc1e4('0x1a')](_0x2c2a6d)[_0xc1e4('0x1f')](function(_0x499c78){_0x750a83[_0xc1e4('0x1a')]=_0x499c78;if(_0x1183c4[_0xc1e4('0x2e')][_0xc1e4('0x3c')]){_0x455165[_0xc1e4('0x3d')]=[{'all':!![]}];}return db[_0xc1e4('0x2a')][_0xc1e4('0x3e')](_0x455165);})[_0xc1e4('0x1f')](function(_0x153dd5){_0x750a83[_0xc1e4('0x3f')]=_0x153dd5;return _0x750a83;})[_0xc1e4('0x1f')](respondWithFilteredResult(_0x5c8225,_0x455165))[_0xc1e4('0x40')](handleError(_0x5c8225,null));};exports[_0xc1e4('0x41')]=function(_0x4bbca9,_0x47d4eb){var _0xb25ac6={'raw':!![],'where':{'id':_0x4bbca9[_0xc1e4('0x42')]['id']}},_0x20784c={};_0x20784c[_0xc1e4('0x2d')]=_['keys'](db['VoiceMail'][_0xc1e4('0x43')]);_0x20784c[_0xc1e4('0x2e')]=_['keys'](_0x4bbca9[_0xc1e4('0x2e')]);_0x20784c[_0xc1e4('0x30')]=_[_0xc1e4('0x31')](_0x20784c[_0xc1e4('0x2d')],_0x20784c['query']);_0xb25ac6[_0xc1e4('0x34')]=_[_0xc1e4('0x31')](_0x20784c[_0xc1e4('0x2d')],qs[_0xc1e4('0x32')](_0x4bbca9['query'][_0xc1e4('0x32')]));_0xb25ac6[_0xc1e4('0x34')]=_0xb25ac6[_0xc1e4('0x34')]['length']?_0xb25ac6['attributes']:_0x20784c[_0xc1e4('0x2d')];if(_0x4bbca9[_0xc1e4('0x2e')][_0xc1e4('0x3c')]){_0xb25ac6[_0xc1e4('0x3d')]=[{'all':!![]}];}_0xb25ac6=_[_0xc1e4('0x44')]({},_0xb25ac6,_0x4bbca9['options']);return db[_0xc1e4('0x2a')][_0xc1e4('0x45')](_0xb25ac6)['then'](handleEntityNotFound(_0x47d4eb,null))[_0xc1e4('0x1f')](respondWithResult(_0x47d4eb,null))[_0xc1e4('0x40')](handleError(_0x47d4eb,null));};exports['create']=function(_0x4416d8,_0x3a1c43){return db[_0xc1e4('0x2a')][_0xc1e4('0x46')](_0x4416d8[_0xc1e4('0x47')],{})[_0xc1e4('0x1f')](function(_0x291baa){var _0x7bf093=_0x4416d8[_0xc1e4('0x48')][_0xc1e4('0x21')]({'plain':!![]});if(!_0x7bf093)throw new Error(_0xc1e4('0x49'));if(_0x7bf093[_0xc1e4('0x4a')]==='user'){var _0xa3877a=_0x291baa[_0xc1e4('0x21')]({'plain':!![]});var _0x4df733=_0xc1e4('0x22');return db['UserProfileSection'][_0xc1e4('0x45')]({'where':{'name':_0x4df733,'userProfileId':_0x7bf093['userProfileId']},'raw':!![]})[_0xc1e4('0x1f')](function(_0x3c68c8){if(_0x3c68c8&&_0x3c68c8[_0xc1e4('0x4b')]===0x0){return db[_0xc1e4('0x23')]['create']({'name':_0xa3877a[_0xc1e4('0x26')],'resourceId':_0xa3877a['id'],'type':_0x3c68c8[_0xc1e4('0x26')],'sectionId':_0x3c68c8['id']},{})[_0xc1e4('0x1f')](function(){return _0x291baa;});}else{return _0x291baa;}})[_0xc1e4('0x40')](function(_0x161e1a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x161e1a);throw _0x161e1a;});}return _0x291baa;})[_0xc1e4('0x1f')](respondWithResult(_0x3a1c43,0xc9))[_0xc1e4('0x40')](handleError(_0x3a1c43,null));};exports[_0xc1e4('0x4c')]=function(_0x2bae19,_0x4f1968){if(_0x2bae19[_0xc1e4('0x47')]['id']){delete _0x2bae19[_0xc1e4('0x47')]['id'];}return db[_0xc1e4('0x2a')][_0xc1e4('0x45')]({'where':{'id':_0x2bae19['params']['id']}})[_0xc1e4('0x1f')](handleEntityNotFound(_0x4f1968,null))['then'](saveUpdates(_0x2bae19[_0xc1e4('0x47')],null))[_0xc1e4('0x1f')](respondWithResult(_0x4f1968,null))[_0xc1e4('0x40')](handleError(_0x4f1968,null));};exports['destroy']=function(_0x4502ab,_0x228311){return db[_0xc1e4('0x2a')][_0xc1e4('0x45')]({'where':{'id':_0x4502ab[_0xc1e4('0x42')]['id']}})[_0xc1e4('0x1f')](handleEntityNotFound(_0x228311,null))['then'](removeEntity(_0x228311,null))[_0xc1e4('0x40')](handleError(_0x228311,null));};exports[_0xc1e4('0x4d')]=function(_0x3729e0,_0x2ed1e,_0x1eabb4){return db[_0xc1e4('0x2a')]['findOne']({'where':{'id':_0x3729e0[_0xc1e4('0x42')]['id']}})[_0xc1e4('0x1f')](handleEntityNotFound(_0x2ed1e,null))[_0xc1e4('0x1f')](function(_0xcbd313){var _0x3d9dc0;var _0x905e6={},_0x3b4e02={};_0x3b4e02['model']=_[_0xc1e4('0x2f')](db[_0xc1e4('0x4e')][_0xc1e4('0x43')]);_0x3b4e02[_0xc1e4('0x2e')]=_['keys'](_0x3729e0['query']);_0x3b4e02[_0xc1e4('0x30')]=_[_0xc1e4('0x31')](_0x3b4e02[_0xc1e4('0x2d')],_0x3b4e02[_0xc1e4('0x2e')]);_0x905e6[_0xc1e4('0x34')]=_[_0xc1e4('0x31')](_0x3b4e02[_0xc1e4('0x2d')],qs[_0xc1e4('0x32')](_0x3729e0[_0xc1e4('0x2e')][_0xc1e4('0x32')]));_0x905e6[_0xc1e4('0x34')]=_0x905e6[_0xc1e4('0x34')]['length']?_0x905e6['attributes']:_0x3b4e02[_0xc1e4('0x2d')];if(!_0x3729e0[_0xc1e4('0x2e')][_0xc1e4('0x4f')](_0xc1e4('0x35'))){_0x905e6[_0xc1e4('0x1b')]=qs[_0xc1e4('0x1b')](_0x3729e0[_0xc1e4('0x2e')][_0xc1e4('0x1b')]);_0x905e6[_0xc1e4('0x18')]=qs[_0xc1e4('0x18')](_0x3729e0[_0xc1e4('0x2e')][_0xc1e4('0x18')]);}_0x905e6[_0xc1e4('0x36')]=qs['sort'](_0x3729e0['query'][_0xc1e4('0x37')]);_0x905e6[_0xc1e4('0x38')]=qs[_0xc1e4('0x30')](_[_0xc1e4('0x39')](_0x3729e0['query'],_0x3b4e02['filters']));if(_0x3729e0[_0xc1e4('0x2e')][_0xc1e4('0x3a')]){_0x905e6['where']=_['merge'](_0x905e6[_0xc1e4('0x38')],{'$or':_['map'](_0x905e6[_0xc1e4('0x34')],function(_0x5caded){var _0x2be20d={};_0x2be20d[_0x5caded]={'$like':'%'+_0x3729e0[_0xc1e4('0x2e')]['filter']+'%'};return _0x2be20d;})});}_0x905e6[_0xc1e4('0x38')]=_[_0xc1e4('0x44')](_0x905e6[_0xc1e4('0x38')],{'mailboxuser':_0xcbd313['mailbox']});_0x905e6=_[_0xc1e4('0x44')]({},_0x905e6,_0x3729e0[_0xc1e4('0x50')]);return db[_0xc1e4('0x4e')][_0xc1e4('0x51')](_0x905e6)[_0xc1e4('0x1f')](respondWithFilteredResult(_0x2ed1e,_0x905e6));})['catch'](handleError(_0x2ed1e,null));}; \ No newline at end of file +var _0xbebc=['catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','autoAssociation'];(function(_0x1ad342,_0x3257f8){var _0x2b4eb9=function(_0x3248e2){while(--_0x3248e2){_0x1ad342['push'](_0x1ad342['shift']());}};_0x2b4eb9(++_0x3257f8);}(_0xbebc,0x118));var _0xcbeb=function(_0x194086,_0x5493b7){_0x194086=_0x194086-0x0;var _0x5b3932=_0xbebc[_0x194086];return _0x5b3932;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcbeb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcbeb('0x1'));var moment=require(_0xcbeb('0x2'));var BPromise=require(_0xcbeb('0x3'));var Mustache=require('mustache');var util=require(_0xcbeb('0x4'));var path=require(_0xcbeb('0x5'));var sox=require(_0xcbeb('0x6'));var csv=require(_0xcbeb('0x7'));var ejs=require(_0xcbeb('0x8'));var fs=require('fs');var fs_extra=require(_0xcbeb('0x9'));var _=require('lodash');var squel=require(_0xcbeb('0xa'));var crypto=require(_0xcbeb('0xb'));var jsforce=require(_0xcbeb('0xc'));var deskjs=require(_0xcbeb('0xd'));var toCsv=require(_0xcbeb('0x7'));var querystring=require(_0xcbeb('0xe'));var Papa=require(_0xcbeb('0xf'));var Redis=require(_0xcbeb('0x10'));var authService=require(_0xcbeb('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcbeb('0x12'));var logger=require(_0xcbeb('0x13'))(_0xcbeb('0x14'));var utils=require(_0xcbeb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xcbeb('0x16'));var db=require(_0xcbeb('0x17'))['db'];function respondWithStatusCode(_0x1f81c9,_0x47dde1){_0x47dde1=_0x47dde1||0xcc;return function(_0xee5e00){if(_0xee5e00){return _0x1f81c9[_0xcbeb('0x18')](_0x47dde1);}return _0x1f81c9[_0xcbeb('0x19')](_0x47dde1)[_0xcbeb('0x1a')]();};}function respondWithResult(_0x36e67f,_0x3c3b4d){_0x3c3b4d=_0x3c3b4d||0xc8;return function(_0x4965af){if(_0x4965af){return _0x36e67f[_0xcbeb('0x19')](_0x3c3b4d)['json'](_0x4965af);}};}function respondWithFilteredResult(_0x4ffd5,_0x4a6c35){return function(_0x1d17cc){if(_0x1d17cc){var _0x28f988=typeof _0x4a6c35[_0xcbeb('0x1b')]===_0xcbeb('0x1c')&&typeof _0x4a6c35[_0xcbeb('0x1d')]===_0xcbeb('0x1c');var _0x183c7b=_0x1d17cc['count'];var _0x4c2138=_0x28f988?0x0:_0x4a6c35[_0xcbeb('0x1b')];var _0x335582=_0x28f988?_0x1d17cc[_0xcbeb('0x1e')]:_0x4a6c35['offset']+_0x4a6c35[_0xcbeb('0x1d')];var _0xdf25ab;if(_0x335582>=_0x183c7b){_0x335582=_0x183c7b;_0xdf25ab=0xc8;}else{_0xdf25ab=0xce;}_0x4ffd5[_0xcbeb('0x19')](_0xdf25ab);return _0x4ffd5[_0xcbeb('0x1f')](_0xcbeb('0x20'),_0x4c2138+'-'+_0x335582+'/'+_0x183c7b)[_0xcbeb('0x21')](_0x1d17cc);}return null;};}function patchUpdates(_0x577612){return function(_0x206122){try{jsonpatch[_0xcbeb('0x22')](_0x206122,_0x577612,!![]);}catch(_0x167096){return BPromise['reject'](_0x167096);}return _0x206122[_0xcbeb('0x23')]();};}function saveUpdates(_0x8f72e8,_0x2289fe){return function(_0x2471a8){if(_0x2471a8){return _0x2471a8[_0xcbeb('0x24')](_0x8f72e8)[_0xcbeb('0x25')](function(_0x5174a4){return _0x5174a4;});}return null;};}function removeEntity(_0x1fc58c,_0xf66c3d){return function(_0x4878bf){if(_0x4878bf){return _0x4878bf[_0xcbeb('0x26')]()['then'](function(){var _0x282dd9=_0x4878bf[_0xcbeb('0x27')]({'plain':!![]});var _0x1eefd5=_0xcbeb('0x28');return db[_0xcbeb('0x29')][_0xcbeb('0x26')]({'where':{'type':_0x1eefd5,'resourceId':_0x282dd9['id']}})[_0xcbeb('0x25')](function(){return _0x4878bf;});})[_0xcbeb('0x25')](function(){_0x1fc58c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x314d6c,_0x4301bf){return function(_0x10b761){if(!_0x10b761){_0x314d6c[_0xcbeb('0x18')](0x194);}return _0x10b761;};}function handleError(_0x612dee,_0x4cc06b){_0x4cc06b=_0x4cc06b||0x1f4;return function(_0x56a69e){logger[_0xcbeb('0x2a')](_0x56a69e[_0xcbeb('0x2b')]);if(_0x56a69e[_0xcbeb('0x2c')]){delete _0x56a69e[_0xcbeb('0x2c')];}_0x612dee[_0xcbeb('0x19')](_0x4cc06b)[_0xcbeb('0x2d')](_0x56a69e);};}exports[_0xcbeb('0x2e')]=function(_0x1ec6bd,_0x3474f1){var _0x1eb904={},_0x31d8f0={},_0x54fe6c={'count':0x0,'rows':[]};var _0x40ad31=_[_0xcbeb('0x2f')](db[_0xcbeb('0x30')]['rawAttributes'],function(_0x350553){return{'name':_0x350553[_0xcbeb('0x31')],'type':_0x350553[_0xcbeb('0x32')][_0xcbeb('0x33')]};});_0x31d8f0[_0xcbeb('0x34')]=_[_0xcbeb('0x2f')](_0x40ad31,'name');_0x31d8f0[_0xcbeb('0x35')]=_[_0xcbeb('0x36')](_0x1ec6bd[_0xcbeb('0x35')]);_0x31d8f0[_0xcbeb('0x37')]=_[_0xcbeb('0x38')](_0x31d8f0[_0xcbeb('0x34')],_0x31d8f0[_0xcbeb('0x35')]);_0x1eb904[_0xcbeb('0x39')]=_[_0xcbeb('0x38')](_0x31d8f0[_0xcbeb('0x34')],qs[_0xcbeb('0x3a')](_0x1ec6bd[_0xcbeb('0x35')][_0xcbeb('0x3a')]));_0x1eb904[_0xcbeb('0x39')]=_0x1eb904[_0xcbeb('0x39')][_0xcbeb('0x3b')]?_0x1eb904[_0xcbeb('0x39')]:_0x31d8f0[_0xcbeb('0x34')];if(!_0x1ec6bd[_0xcbeb('0x35')][_0xcbeb('0x3c')](_0xcbeb('0x3d'))){_0x1eb904['limit']=qs[_0xcbeb('0x1d')](_0x1ec6bd[_0xcbeb('0x35')][_0xcbeb('0x1d')]);_0x1eb904['offset']=qs[_0xcbeb('0x1b')](_0x1ec6bd[_0xcbeb('0x35')][_0xcbeb('0x1b')]);}_0x1eb904[_0xcbeb('0x3e')]=qs[_0xcbeb('0x3f')](_0x1ec6bd['query']['sort']);_0x1eb904['where']=qs[_0xcbeb('0x37')](_[_0xcbeb('0x40')](_0x1ec6bd[_0xcbeb('0x35')],_0x31d8f0['filters']),_0x40ad31);if(_0x1ec6bd['query'][_0xcbeb('0x41')]){_0x1eb904[_0xcbeb('0x42')]=_['merge'](_0x1eb904[_0xcbeb('0x42')],{'$or':_[_0xcbeb('0x2f')](_0x40ad31,function(_0x2d8636){if(_0x2d8636[_0xcbeb('0x32')]!==_0xcbeb('0x43')){var _0x5cdd6d={};_0x5cdd6d[_0x2d8636[_0xcbeb('0x2c')]]={'$like':'%'+_0x1ec6bd[_0xcbeb('0x35')][_0xcbeb('0x41')]+'%'};return _0x5cdd6d;}})});}_0x1eb904=_[_0xcbeb('0x44')]({},_0x1eb904,_0x1ec6bd[_0xcbeb('0x45')]);var _0x1faae8={'where':_0x1eb904['where']};return db[_0xcbeb('0x30')][_0xcbeb('0x1e')](_0x1faae8)[_0xcbeb('0x25')](function(_0x3ebaf8){_0x54fe6c[_0xcbeb('0x1e')]=_0x3ebaf8;if(_0x1ec6bd[_0xcbeb('0x35')][_0xcbeb('0x46')]){_0x1eb904[_0xcbeb('0x47')]=[{'all':!![]}];}return db[_0xcbeb('0x30')][_0xcbeb('0x48')](_0x1eb904);})[_0xcbeb('0x25')](function(_0x1b5b66){_0x54fe6c[_0xcbeb('0x49')]=_0x1b5b66;return _0x54fe6c;})['then'](respondWithFilteredResult(_0x3474f1,_0x1eb904))['catch'](handleError(_0x3474f1,null));};exports[_0xcbeb('0x4a')]=function(_0xf7f9e6,_0x4b76bf){var _0x44392f={'raw':!![],'where':{'id':_0xf7f9e6[_0xcbeb('0x4b')]['id']}},_0x36280f={};_0x36280f[_0xcbeb('0x34')]=_['keys'](db[_0xcbeb('0x30')][_0xcbeb('0x4c')]);_0x36280f[_0xcbeb('0x35')]=_['keys'](_0xf7f9e6['query']);_0x36280f['filters']=_[_0xcbeb('0x38')](_0x36280f[_0xcbeb('0x34')],_0x36280f[_0xcbeb('0x35')]);_0x44392f[_0xcbeb('0x39')]=_[_0xcbeb('0x38')](_0x36280f[_0xcbeb('0x34')],qs['fields'](_0xf7f9e6[_0xcbeb('0x35')][_0xcbeb('0x3a')]));_0x44392f[_0xcbeb('0x39')]=_0x44392f[_0xcbeb('0x39')][_0xcbeb('0x3b')]?_0x44392f['attributes']:_0x36280f[_0xcbeb('0x34')];if(_0xf7f9e6['query'][_0xcbeb('0x46')]){_0x44392f[_0xcbeb('0x47')]=[{'all':!![]}];}_0x44392f=_[_0xcbeb('0x44')]({},_0x44392f,_0xf7f9e6[_0xcbeb('0x45')]);return db[_0xcbeb('0x30')][_0xcbeb('0x4d')](_0x44392f)[_0xcbeb('0x25')](handleEntityNotFound(_0x4b76bf,null))[_0xcbeb('0x25')](respondWithResult(_0x4b76bf,null))['catch'](handleError(_0x4b76bf,null));};exports['create']=function(_0x30a54b,_0x4f630a){return db[_0xcbeb('0x30')][_0xcbeb('0x4e')](_0x30a54b[_0xcbeb('0x4f')],{})[_0xcbeb('0x25')](function(_0x5bcd){var _0x23c2c1=_0x30a54b[_0xcbeb('0x50')][_0xcbeb('0x27')]({'plain':!![]});if(!_0x23c2c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23c2c1[_0xcbeb('0x51')]==='user'){var _0x5dfa2d=_0x5bcd[_0xcbeb('0x27')]({'plain':!![]});var _0x5cf659=_0xcbeb('0x28');return db[_0xcbeb('0x52')][_0xcbeb('0x4d')]({'where':{'name':_0x5cf659,'userProfileId':_0x23c2c1['userProfileId']},'raw':!![]})['then'](function(_0x36f6c6){if(_0x36f6c6&&_0x36f6c6[_0xcbeb('0x53')]===0x0){return db[_0xcbeb('0x29')][_0xcbeb('0x4e')]({'name':_0x5dfa2d[_0xcbeb('0x2c')],'resourceId':_0x5dfa2d['id'],'type':_0x36f6c6[_0xcbeb('0x2c')],'sectionId':_0x36f6c6['id']},{})[_0xcbeb('0x25')](function(){return _0x5bcd;});}else{return _0x5bcd;}})[_0xcbeb('0x54')](function(_0x554462){logger[_0xcbeb('0x2a')](_0xcbeb('0x55'),_0x554462);throw _0x554462;});}return _0x5bcd;})[_0xcbeb('0x25')](respondWithResult(_0x4f630a,0xc9))[_0xcbeb('0x54')](handleError(_0x4f630a,null));};exports[_0xcbeb('0x24')]=function(_0x10e01a,_0x39d5d0){if(_0x10e01a[_0xcbeb('0x4f')]['id']){delete _0x10e01a[_0xcbeb('0x4f')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x10e01a[_0xcbeb('0x4b')]['id']}})[_0xcbeb('0x25')](handleEntityNotFound(_0x39d5d0,null))[_0xcbeb('0x25')](saveUpdates(_0x10e01a['body'],null))[_0xcbeb('0x25')](respondWithResult(_0x39d5d0,null))[_0xcbeb('0x54')](handleError(_0x39d5d0,null));};exports[_0xcbeb('0x26')]=function(_0x76ecdb,_0x147bbf){return db['VoiceMail']['find']({'where':{'id':_0x76ecdb[_0xcbeb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x147bbf,null))[_0xcbeb('0x25')](removeEntity(_0x147bbf,null))[_0xcbeb('0x54')](handleError(_0x147bbf,null));};exports[_0xcbeb('0x56')]=function(_0x471a79,_0x183e3a,_0x4d17d0){return db[_0xcbeb('0x30')][_0xcbeb('0x57')]({'where':{'id':_0x471a79['params']['id']}})[_0xcbeb('0x25')](handleEntityNotFound(_0x183e3a,null))[_0xcbeb('0x25')](function(_0x2ecb2e){var _0x5cce03;var _0x18fae6={},_0x3ea21e={};_0x3ea21e[_0xcbeb('0x34')]=_[_0xcbeb('0x36')](db[_0xcbeb('0x58')][_0xcbeb('0x4c')]);_0x3ea21e[_0xcbeb('0x35')]=_[_0xcbeb('0x36')](_0x471a79['query']);_0x3ea21e[_0xcbeb('0x37')]=_[_0xcbeb('0x38')](_0x3ea21e[_0xcbeb('0x34')],_0x3ea21e[_0xcbeb('0x35')]);_0x18fae6[_0xcbeb('0x39')]=_['intersection'](_0x3ea21e[_0xcbeb('0x34')],qs[_0xcbeb('0x3a')](_0x471a79[_0xcbeb('0x35')]['fields']));_0x18fae6['attributes']=_0x18fae6[_0xcbeb('0x39')][_0xcbeb('0x3b')]?_0x18fae6[_0xcbeb('0x39')]:_0x3ea21e[_0xcbeb('0x34')];if(!_0x471a79['query'][_0xcbeb('0x3c')](_0xcbeb('0x3d'))){_0x18fae6['limit']=qs[_0xcbeb('0x1d')](_0x471a79[_0xcbeb('0x35')]['limit']);_0x18fae6[_0xcbeb('0x1b')]=qs['offset'](_0x471a79[_0xcbeb('0x35')][_0xcbeb('0x1b')]);}_0x18fae6[_0xcbeb('0x3e')]=qs[_0xcbeb('0x3f')](_0x471a79[_0xcbeb('0x35')]['sort']);_0x18fae6[_0xcbeb('0x42')]=qs['filters'](_[_0xcbeb('0x40')](_0x471a79[_0xcbeb('0x35')],_0x3ea21e['filters']));if(_0x471a79['query']['filter']){_0x18fae6['where']=_['merge'](_0x18fae6['where'],{'$or':_[_0xcbeb('0x2f')](_0x18fae6['attributes'],function(_0x25d67f){var _0x1feb46={};_0x1feb46[_0x25d67f]={'$like':'%'+_0x471a79['query']['filter']+'%'};return _0x1feb46;})});}_0x18fae6[_0xcbeb('0x42')]=_[_0xcbeb('0x44')](_0x18fae6[_0xcbeb('0x42')],{'mailboxuser':_0x2ecb2e[_0xcbeb('0x59')]});_0x18fae6=_[_0xcbeb('0x44')]({},_0x18fae6,_0x471a79[_0xcbeb('0x45')]);return db[_0xcbeb('0x58')][_0xcbeb('0x5a')](_0x18fae6)[_0xcbeb('0x25')](respondWithFilteredResult(_0x183e3a,_0x18fae6));})['catch'](handleError(_0x183e3a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 742c54c..ca6d39c 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 _0x3719=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','lodash','../../config/logger','api'];(function(_0x3974a3,_0x34fb1c){var _0x5858fc=function(_0x72d0b1){while(--_0x72d0b1){_0x3974a3['push'](_0x3974a3['shift']());}};_0x5858fc(++_0x34fb1c);}(_0x3719,0x123));var _0x9371=function(_0x21b4f9,_0x139386){_0x21b4f9=_0x21b4f9-0x0;var _0x55e2d0=_0x3719[_0x21b4f9];return _0x55e2d0;};'use strict';var _=require(_0x9371('0x0'));var util=require('util');var logger=require(_0x9371('0x1'))(_0x9371('0x2'));var moment=require(_0x9371('0x3'));var BPromise=require(_0x9371('0x4'));var rp=require(_0x9371('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9371('0x6'));var config=require(_0x9371('0x7'));var attributes=require(_0x9371('0x8'));module[_0x9371('0x9')]=function(_0x375c18,_0x432014){return _0x375c18[_0x9371('0xa')](_0x9371('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x9371('0xc'),'fields':[_0x9371('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xef30=['request-promise','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','api','moment','bluebird'];(function(_0x3c8067,_0xb40335){var _0x1b0350=function(_0x40163a){while(--_0x40163a){_0x3c8067['push'](_0x3c8067['shift']());}};_0x1b0350(++_0xb40335);}(_0xef30,0x133));var _0x0ef3=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xef30[_0x1c510a];return _0x23cedd;};'use strict';var _=require(_0x0ef3('0x0'));var util=require(_0x0ef3('0x1'));var logger=require('../../config/logger')(_0x0ef3('0x2'));var moment=require(_0x0ef3('0x3'));var BPromise=require(_0x0ef3('0x4'));var rp=require(_0x0ef3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ef3('0x6'));module['exports']=function(_0x4adeb3,_0x4b4795){return _0x4adeb3[_0x0ef3('0x7')](_0x0ef3('0x8'),attributes,{'tableName':_0x0ef3('0x9'),'paranoid':![],'indexes':[{'name':_0x0ef3('0xa'),'fields':[_0x0ef3('0xb'),_0x0ef3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 2292e2a..fbbcd0f 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 _0x2947=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring'];(function(_0x580464,_0x58d37b){var _0x478d78=function(_0x566d0a){while(--_0x566d0a){_0x580464['push'](_0x580464['shift']());}};_0x478d78(++_0x58d37b);}(_0x2947,0x1db));var _0x7294=function(_0x5edc29,_0x71248){_0x5edc29=_0x5edc29-0x0;var _0x595b92=_0x2947[_0x5edc29];return _0x595b92;};'use strict';var _=require(_0x7294('0x0'));var util=require(_0x7294('0x1'));var moment=require(_0x7294('0x2'));var BPromise=require(_0x7294('0x3'));var rs=require(_0x7294('0x4'));var fs=require('fs');var Redis=require(_0x7294('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7294('0x6'))(_0x7294('0x7'));var config=require(_0x7294('0x8'));var jayson=require(_0x7294('0x9'));var client=jayson[_0x7294('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b2f95,_0x126dbb,_0x1f99a9){return new BPromise(function(_0x3c33db,_0x346637){return client[_0x7294('0xb')](_0x5b2f95,_0x1f99a9)[_0x7294('0xc')](function(_0x2a0a58){logger[_0x7294('0xd')](_0x7294('0xe'),_0x126dbb,'request\x20sent');logger['debug'](_0x7294('0xf'),_0x126dbb,'request\x20sent',JSON[_0x7294('0x10')](_0x2a0a58));if(_0x2a0a58[_0x7294('0x11')]){if(_0x2a0a58[_0x7294('0x11')][_0x7294('0x12')]===0x1f4){logger[_0x7294('0x11')]('VoiceMail,\x20%s,\x20%s',_0x126dbb,_0x2a0a58['error']['message']);return _0x346637(_0x2a0a58[_0x7294('0x11')][_0x7294('0x13')]);}logger[_0x7294('0x11')](_0x7294('0xe'),_0x126dbb,_0x2a0a58['error'][_0x7294('0x13')]);return _0x3c33db(_0x2a0a58['error'][_0x7294('0x13')]);}else{logger[_0x7294('0xd')](_0x7294('0xe'),_0x126dbb,'request\x20sent');_0x3c33db(_0x2a0a58['result'][_0x7294('0x13')]);}})['catch'](function(_0x6f9120){logger[_0x7294('0x11')](_0x7294('0xe'),_0x126dbb,_0x6f9120);_0x346637(_0x6f9120);});});} \ No newline at end of file +var _0xa469=['../../config/utils','../../config/logger','rpc','jayson/promise','client','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x18af0e,_0x2ddd94){var _0x4dfd06=function(_0x4e6bcf){while(--_0x4e6bcf){_0x18af0e['push'](_0x18af0e['shift']());}};_0x4dfd06(++_0x2ddd94);}(_0xa469,0x19c));var _0x9a46=function(_0x34057f,_0x3a683f){_0x34057f=_0x34057f-0x0;var _0x3ea6b0=_0xa469[_0x34057f];return _0x3ea6b0;};'use strict';var _=require(_0x9a46('0x0'));var util=require(_0x9a46('0x1'));var moment=require('moment');var BPromise=require(_0x9a46('0x2'));var rs=require(_0x9a46('0x3'));var fs=require('fs');var Redis=require(_0x9a46('0x4'));var db=require(_0x9a46('0x5'))['db'];var utils=require(_0x9a46('0x6'));var logger=require(_0x9a46('0x7'))(_0x9a46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9a46('0x9'));var client=jayson[_0x9a46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe96c22,_0x906d29,_0x2aad0e){return new BPromise(function(_0x5817c4,_0x2a888d){return client['request'](_0xe96c22,_0x2aad0e)['then'](function(_0x2329f9){logger[_0x9a46('0xb')](_0x9a46('0xc'),_0x906d29,_0x9a46('0xd'));logger[_0x9a46('0xe')](_0x9a46('0xf'),_0x906d29,_0x9a46('0xd'),JSON[_0x9a46('0x10')](_0x2329f9));if(_0x2329f9[_0x9a46('0x11')]){if(_0x2329f9['error'][_0x9a46('0x12')]===0x1f4){logger[_0x9a46('0x11')](_0x9a46('0xc'),_0x906d29,_0x2329f9[_0x9a46('0x11')]['message']);return _0x2a888d(_0x2329f9[_0x9a46('0x11')]['message']);}logger[_0x9a46('0x11')]('VoiceMail,\x20%s,\x20%s',_0x906d29,_0x2329f9[_0x9a46('0x11')]['message']);return _0x5817c4(_0x2329f9['error']['message']);}else{logger[_0x9a46('0xb')](_0x9a46('0xc'),_0x906d29,_0x9a46('0xd'));_0x5817c4(_0x2329f9[_0x9a46('0x13')][_0x9a46('0x14')]);}})[_0x9a46('0x15')](function(_0x32b088){logger['error'](_0x9a46('0xc'),_0x906d29,_0x32b088);_0x2a888d(_0x32b088);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 30058c4..78a9d8a 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 _0x4777=['Router','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x318522,_0x5dd509){var _0x523fa1=function(_0x2aa389){while(--_0x2aa389){_0x318522['push'](_0x318522['shift']());}};_0x523fa1(++_0x5dd509);}(_0x4777,0xcd));var _0x7477=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x4777[_0x4d07cc];return _0x42de3b;};'use strict';var multer=require(_0x7477('0x0'));var util=require(_0x7477('0x1'));var path=require(_0x7477('0x2'));var timeout=require(_0x7477('0x3'));var express=require('express');var router=express[_0x7477('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7477('0x5'));var config=require('../../config/environment');var controller=require(_0x7477('0x6'));router[_0x7477('0x7')]('/',auth[_0x7477('0x8')](),controller['index']);router[_0x7477('0x7')](_0x7477('0x9'),auth['isAuthenticated'](),controller[_0x7477('0xa')]);router[_0x7477('0x7')](_0x7477('0xb'),auth['isAuthenticated'](),controller[_0x7477('0xc')]);router[_0x7477('0xd')]('/',auth['isAuthenticated'](),controller[_0x7477('0xe')]);router[_0x7477('0xf')](_0x7477('0x9'),auth[_0x7477('0x8')](),controller[_0x7477('0x10')]);router['delete'](_0x7477('0x9'),auth[_0x7477('0x8')](),controller[_0x7477('0x11')]);module[_0x7477('0x12')]=router; \ No newline at end of file +var _0x2abe=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x319b1c,_0x5889a2){var _0x2c6bfe=function(_0x3d72f0){while(--_0x3d72f0){_0x319b1c['push'](_0x319b1c['shift']());}};_0x2c6bfe(++_0x5889a2);}(_0x2abe,0x131));var _0xe2ab=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x2abe[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require(_0xe2ab('0x0'));var path=require(_0xe2ab('0x1'));var timeout=require(_0xe2ab('0x2'));var express=require(_0xe2ab('0x3'));var router=express[_0xe2ab('0x4')]();var fs_extra=require(_0xe2ab('0x5'));var auth=require(_0xe2ab('0x6'));var interaction=require(_0xe2ab('0x7'));var config=require('../../config/environment');var controller=require(_0xe2ab('0x8'));router[_0xe2ab('0x9')]('/',auth[_0xe2ab('0xa')](),controller[_0xe2ab('0xb')]);router[_0xe2ab('0x9')](_0xe2ab('0xc'),auth[_0xe2ab('0xa')](),controller[_0xe2ab('0xd')]);router['get'](_0xe2ab('0xe'),auth['isAuthenticated'](),controller[_0xe2ab('0xf')]);router[_0xe2ab('0x10')]('/',auth[_0xe2ab('0xa')](),controller[_0xe2ab('0x11')]);router['put'](_0xe2ab('0xc'),auth[_0xe2ab('0xa')](),controller[_0xe2ab('0x12')]);router[_0xe2ab('0x13')](_0xe2ab('0xc'),auth['isAuthenticated'](),controller[_0xe2ab('0x14')]);module[_0xe2ab('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index a61751f..5b03cc0 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 _0xc543=['BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x273b36,_0x18be49){var _0x374f7c=function(_0x2fb75e){while(--_0x2fb75e){_0x273b36['push'](_0x273b36['shift']());}};_0x374f7c(++_0x18be49);}(_0xc543,0x9f));var _0x3c54=function(_0x83bf,_0x4b3273){_0x83bf=_0x83bf-0x0;var _0x14a6d3=_0xc543[_0x83bf];return _0x14a6d3;};'use strict';var Sequelize=require(_0x3c54('0x0'));module[_0x3c54('0x1')]={'name':{'type':Sequelize[_0x3c54('0x2')],'get':function(_0x2577c7){return this[_0x3c54('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x3c54('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x3c54('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x3c54('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x3c54('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x3c54('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x3c54('0x6')](_0x3c54('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x3c54('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x3c54('0x5')],'defaultValue':''},'stamp':{'type':_0x3c54('0x8'),'defaultValue':Sequelize[_0x3c54('0x9')](_0x3c54('0xa'))}}; \ No newline at end of file +var _0x40b1=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x340d08,_0x4f7d3c){var _0x53d8d9=function(_0x2f36dd){while(--_0x2f36dd){_0x340d08['push'](_0x340d08['shift']());}};_0x53d8d9(++_0x4f7d3c);}(_0x40b1,0x110));var _0x140b=function(_0x21aedc,_0x22dc2c){_0x21aedc=_0x21aedc-0x0;var _0x2f0625=_0x40b1[_0x21aedc];return _0x2f0625;};'use strict';var Sequelize=require('sequelize');module[_0x140b('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5a91d3){return this[_0x140b('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x140b('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x140b('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x140b('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x140b('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x140b('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x140b('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x140b('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x140b('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x140b('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x140b('0x4')](_0x140b('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x140b('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x140b('0x3')],'defaultValue':''},'stamp':{'type':_0x140b('0x6'),'defaultValue':Sequelize[_0x140b('0x7')](_0x140b('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 4cd707c..25a0387 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 _0x0bf9=['path','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','create','body','download','find','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22','set','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0x0bf9,0x9d));var _0x90bf=function(_0x37828c,_0x251b28){_0x37828c=_0x37828c-0x0;var _0x56d30c=_0x0bf9[_0x37828c];return _0x56d30c;};'use strict';var emlformat=require(_0x90bf('0x0'));var rimraf=require(_0x90bf('0x1'));var zipdir=require(_0x90bf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90bf('0x3'));var moment=require(_0x90bf('0x4'));var BPromise=require(_0x90bf('0x5'));var Mustache=require('mustache');var util=require(_0x90bf('0x6'));var path=require(_0x90bf('0x7'));var sox=require('sox');var csv=require(_0x90bf('0x8'));var ejs=require(_0x90bf('0x9'));var fs=require('fs');var fs_extra=require(_0x90bf('0xa'));var _=require('lodash');var squel=require(_0x90bf('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x90bf('0xc'));var Papa=require(_0x90bf('0xd'));var Redis=require(_0x90bf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x90bf('0xf'));var as=require(_0x90bf('0x10'));var hardwareService=require(_0x90bf('0x11'));var logger=require(_0x90bf('0x12'))(_0x90bf('0x13'));var utils=require(_0x90bf('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90bf('0x15'));var db=require(_0x90bf('0x16'))['db'];function respondWithStatusCode(_0xae0aa0,_0x1be4b2){_0x1be4b2=_0x1be4b2||0xcc;return function(_0x2c532e){if(_0x2c532e){return _0xae0aa0[_0x90bf('0x17')](_0x1be4b2);}return _0xae0aa0[_0x90bf('0x18')](_0x1be4b2)[_0x90bf('0x19')]();};}function respondWithResult(_0x478f85,_0x4e6d41){_0x4e6d41=_0x4e6d41||0xc8;return function(_0x5dbe23){if(_0x5dbe23){return _0x478f85[_0x90bf('0x18')](_0x4e6d41)['json'](_0x5dbe23);}};}function respondWithFilteredResult(_0x2e8a00,_0x180e63){return function(_0x3df539){if(_0x3df539){var _0x21ae50=typeof _0x180e63[_0x90bf('0x1a')]===_0x90bf('0x1b')&&typeof _0x180e63[_0x90bf('0x1c')]==='undefined';var _0x193544=_0x3df539['count'];var _0x26864d=_0x21ae50?0x0:_0x180e63[_0x90bf('0x1a')];var _0x2101da=_0x21ae50?_0x3df539[_0x90bf('0x1d')]:_0x180e63[_0x90bf('0x1a')]+_0x180e63[_0x90bf('0x1c')];var _0x4105d4;if(_0x2101da>=_0x193544){_0x2101da=_0x193544;_0x4105d4=0xc8;}else{_0x4105d4=0xce;}_0x2e8a00[_0x90bf('0x18')](_0x4105d4);return _0x2e8a00['set']('Content-Range',_0x26864d+'-'+_0x2101da+'/'+_0x193544)['json'](_0x3df539);}return null;};}function patchUpdates(_0x2ed079){return function(_0x47bc6c){try{jsonpatch[_0x90bf('0x1e')](_0x47bc6c,_0x2ed079,!![]);}catch(_0x332bdd){return BPromise[_0x90bf('0x1f')](_0x332bdd);}return _0x47bc6c['save']();};}function saveUpdates(_0x251da3,_0x3c16e1){return function(_0x57647e){if(_0x57647e){return _0x57647e[_0x90bf('0x20')](_0x251da3)[_0x90bf('0x21')](function(_0x1b21ba){return _0x1b21ba;});}return null;};}function removeEntity(_0x37d260,_0x3ceb32){return function(_0x373f5b){if(_0x373f5b){return _0x373f5b[_0x90bf('0x22')]()[_0x90bf('0x21')](function(){_0x37d260[_0x90bf('0x18')](0xcc)[_0x90bf('0x19')]();});}};}function handleEntityNotFound(_0x2c95e3,_0x5912a2){return function(_0x461423){if(!_0x461423){_0x2c95e3[_0x90bf('0x17')](0x194);}return _0x461423;};}function handleError(_0x46c5a2,_0x3d897a){_0x3d897a=_0x3d897a||0x1f4;return function(_0x1a322a){logger[_0x90bf('0x23')](_0x1a322a[_0x90bf('0x24')]);if(_0x1a322a[_0x90bf('0x25')]){delete _0x1a322a[_0x90bf('0x25')];}_0x46c5a2[_0x90bf('0x18')](_0x3d897a)[_0x90bf('0x26')](_0x1a322a);};}exports[_0x90bf('0x27')]=function(_0x28cfa4,_0x1640e1){var _0x4a58b2={},_0x3b1ae5={},_0x3d95d1={'count':0x0,'rows':[]};var _0x859acf=_[_0x90bf('0x28')](db[_0x90bf('0x29')][_0x90bf('0x2a')],function(_0x4d3580){return{'name':_0x4d3580[_0x90bf('0x2b')],'type':_0x4d3580[_0x90bf('0x2c')]['key']};});_0x3b1ae5[_0x90bf('0x2d')]=_[_0x90bf('0x2e')](_[_0x90bf('0x28')](_0x859acf,_0x90bf('0x25')),[_0x90bf('0x25')]);_0x3b1ae5[_0x90bf('0x2f')]=_[_0x90bf('0x30')](_0x28cfa4[_0x90bf('0x2f')]);_0x3b1ae5['filters']=_[_0x90bf('0x31')](_0x3b1ae5['model'],_0x3b1ae5[_0x90bf('0x2f')]);_0x4a58b2['attributes']=_['intersection'](_0x3b1ae5['model'],qs['fields'](_0x28cfa4[_0x90bf('0x2f')][_0x90bf('0x32')]));_0x4a58b2['attributes']=_0x4a58b2[_0x90bf('0x33')][_0x90bf('0x34')]?_0x4a58b2['attributes']:_0x3b1ae5['model'];if(!_0x28cfa4[_0x90bf('0x2f')][_0x90bf('0x35')](_0x90bf('0x36'))){_0x4a58b2['limit']=qs[_0x90bf('0x1c')](_0x28cfa4['query']['limit']);_0x4a58b2['offset']=qs[_0x90bf('0x1a')](_0x28cfa4['query'][_0x90bf('0x1a')]);}_0x4a58b2[_0x90bf('0x37')]=qs[_0x90bf('0x38')](_0x28cfa4[_0x90bf('0x2f')][_0x90bf('0x38')]);_0x4a58b2[_0x90bf('0x39')]=qs[_0x90bf('0x3a')](_[_0x90bf('0x3b')](_0x28cfa4[_0x90bf('0x2f')],_0x3b1ae5[_0x90bf('0x3a')]),_0x859acf);if(_0x28cfa4[_0x90bf('0x2f')][_0x90bf('0x3c')]){_0x4a58b2[_0x90bf('0x39')]=_[_0x90bf('0x3d')](_0x4a58b2[_0x90bf('0x39')],{'$or':_[_0x90bf('0x28')](_0x859acf,function(_0x21e054){if(_0x21e054[_0x90bf('0x2c')]!==_0x90bf('0x3e')){var _0x3137dc={};_0x3137dc[_0x21e054[_0x90bf('0x25')]]={'$like':'%'+_0x28cfa4['query']['filter']+'%'};return _0x3137dc;}})});}_0x4a58b2=_['merge']({},_0x4a58b2,_0x28cfa4[_0x90bf('0x3f')]);var _0x577acb={'where':_0x4a58b2[_0x90bf('0x39')]};return db['VoiceMailMessage']['count'](_0x577acb)[_0x90bf('0x21')](function(_0x1cdc5a){_0x3d95d1[_0x90bf('0x1d')]=_0x1cdc5a;if(_0x28cfa4['query'][_0x90bf('0x40')]){_0x4a58b2[_0x90bf('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x90bf('0x42')](_0x4a58b2);})[_0x90bf('0x21')](function(_0x92c4c9){_0x3d95d1[_0x90bf('0x43')]=_0x92c4c9;return _0x3d95d1;})[_0x90bf('0x21')](respondWithFilteredResult(_0x1640e1,_0x4a58b2))['catch'](handleError(_0x1640e1,null));};exports['show']=function(_0x1678b4,_0xa1f875){var _0x2b45b2={'raw':!![],'where':{'id':_0x1678b4[_0x90bf('0x44')]['id']}},_0x48b3a7={};_0x48b3a7[_0x90bf('0x2d')]=_[_0x90bf('0x30')](db['VoiceMailMessage'][_0x90bf('0x2a')]);_0x48b3a7[_0x90bf('0x2f')]=_['keys'](_0x1678b4['query']);_0x48b3a7['filters']=_[_0x90bf('0x31')](_0x48b3a7[_0x90bf('0x2d')],_0x48b3a7[_0x90bf('0x2f')]);_0x2b45b2[_0x90bf('0x33')]=_[_0x90bf('0x31')](_0x48b3a7[_0x90bf('0x2d')],qs[_0x90bf('0x32')](_0x1678b4[_0x90bf('0x2f')]['fields']));_0x2b45b2[_0x90bf('0x33')]=_0x2b45b2[_0x90bf('0x33')][_0x90bf('0x34')]?_0x2b45b2[_0x90bf('0x33')]:_0x48b3a7[_0x90bf('0x2d')];if(_0x1678b4[_0x90bf('0x2f')]['includeAll']){_0x2b45b2[_0x90bf('0x41')]=[{'all':!![]}];}_0x2b45b2=_[_0x90bf('0x3d')]({},_0x2b45b2,_0x1678b4[_0x90bf('0x3f')]);return db[_0x90bf('0x29')]['find'](_0x2b45b2)[_0x90bf('0x21')](handleEntityNotFound(_0xa1f875,null))[_0x90bf('0x21')](respondWithResult(_0xa1f875,null))[_0x90bf('0x45')](handleError(_0xa1f875,null));};exports[_0x90bf('0x46')]=function(_0x59b373,_0x2f8013){return db[_0x90bf('0x29')]['create'](_0x59b373['body'],{})['then'](respondWithResult(_0x2f8013,0xc9))[_0x90bf('0x45')](handleError(_0x2f8013,null));};exports[_0x90bf('0x20')]=function(_0x19d2a8,_0x2568b9){if(_0x19d2a8['body']['id']){delete _0x19d2a8[_0x90bf('0x47')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x19d2a8[_0x90bf('0x44')]['id']}})[_0x90bf('0x21')](handleEntityNotFound(_0x2568b9,null))[_0x90bf('0x21')](saveUpdates(_0x19d2a8['body'],null))[_0x90bf('0x21')](respondWithResult(_0x2568b9,null))[_0x90bf('0x45')](handleError(_0x2568b9,null));};exports[_0x90bf('0x22')]=function(_0x1e7fd9,_0x23242d){return db[_0x90bf('0x29')]['find']({'where':{'id':_0x1e7fd9[_0x90bf('0x44')]['id']}})[_0x90bf('0x21')](handleEntityNotFound(_0x23242d,null))[_0x90bf('0x21')](removeEntity(_0x23242d,null))[_0x90bf('0x45')](handleError(_0x23242d,null));};exports[_0x90bf('0x48')]=function(_0x90dd1c,_0x505dec,_0x13c6c0){return db[_0x90bf('0x29')][_0x90bf('0x49')]({'where':{'id':_0x90dd1c[_0x90bf('0x44')]['id']},'attributes':['id',_0x90bf('0x4a'),_0x90bf('0x4b')]})[_0x90bf('0x21')](handleEntityNotFound(_0x505dec,null))[_0x90bf('0x21')](function(_0x3771d0){if(_0x3771d0){if(!_0x3771d0['recording']){throw new db['Sequelize'][(_0x90bf('0x4c'))](_0x90bf('0x4d'));}var _0x19babe={'Content-Type':'audio/wav','Content-Disposition':_0x90bf('0x4e')};if(_0x3771d0[_0x90bf('0x4b')]){_0x19babe[_0x90bf('0x4f')]='attachment;\x20filename=\x22'+_0x3771d0[_0x90bf('0x4b')]+_0x90bf('0x50');}_0x505dec[_0x90bf('0x51')](_0x19babe);return _0x505dec[_0x90bf('0x26')](new Buffer(_0x3771d0[_0x90bf('0x4a')]));}})[_0x90bf('0x45')](handleError(_0x505dec,null));}; \ No newline at end of file +var _0x6737=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','download','find','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x13eb6b,_0x3eacc6){var _0x317d16=function(_0x144b1b){while(--_0x144b1b){_0x13eb6b['push'](_0x13eb6b['shift']());}};_0x317d16(++_0x3eacc6);}(_0x6737,0x9c));var _0x7673=function(_0x525094,_0x4342df){_0x525094=_0x525094-0x0;var _0x4a2051=_0x6737[_0x525094];return _0x4a2051;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7673('0x0'));var zipdir=require(_0x7673('0x1'));var jsonpatch=require(_0x7673('0x2'));var rp=require(_0x7673('0x3'));var moment=require(_0x7673('0x4'));var BPromise=require(_0x7673('0x5'));var Mustache=require(_0x7673('0x6'));var util=require('util');var path=require(_0x7673('0x7'));var sox=require('sox');var csv=require(_0x7673('0x8'));var ejs=require(_0x7673('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7673('0xa'));var jsforce=require(_0x7673('0xb'));var deskjs=require(_0x7673('0xc'));var toCsv=require(_0x7673('0x8'));var querystring=require(_0x7673('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7673('0xe'));var qs=require(_0x7673('0xf'));var as=require(_0x7673('0x10'));var hardwareService=require(_0x7673('0x11'));var logger=require(_0x7673('0x12'))(_0x7673('0x13'));var utils=require('../../config/utils');var config=require(_0x7673('0x14'));var licenseUtil=require(_0x7673('0x15'));var db=require(_0x7673('0x16'))['db'];function respondWithStatusCode(_0x42e827,_0xe535f1){_0xe535f1=_0xe535f1||0xcc;return function(_0x53f484){if(_0x53f484){return _0x42e827[_0x7673('0x17')](_0xe535f1);}return _0x42e827[_0x7673('0x18')](_0xe535f1)[_0x7673('0x19')]();};}function respondWithResult(_0x57ddb8,_0x3a1825){_0x3a1825=_0x3a1825||0xc8;return function(_0x28bae6){if(_0x28bae6){return _0x57ddb8[_0x7673('0x18')](_0x3a1825)['json'](_0x28bae6);}};}function respondWithFilteredResult(_0x5d9bdc,_0x328760){return function(_0x373d9f){if(_0x373d9f){var _0x21d9c2=typeof _0x328760[_0x7673('0x1a')]===_0x7673('0x1b')&&typeof _0x328760['limit']===_0x7673('0x1b');var _0x57de08=_0x373d9f[_0x7673('0x1c')];var _0x4512dd=_0x21d9c2?0x0:_0x328760['offset'];var _0x58fc1e=_0x21d9c2?_0x373d9f[_0x7673('0x1c')]:_0x328760[_0x7673('0x1a')]+_0x328760[_0x7673('0x1d')];var _0x228cf9;if(_0x58fc1e>=_0x57de08){_0x58fc1e=_0x57de08;_0x228cf9=0xc8;}else{_0x228cf9=0xce;}_0x5d9bdc[_0x7673('0x18')](_0x228cf9);return _0x5d9bdc[_0x7673('0x1e')](_0x7673('0x1f'),_0x4512dd+'-'+_0x58fc1e+'/'+_0x57de08)[_0x7673('0x20')](_0x373d9f);}return null;};}function patchUpdates(_0x20f55b){return function(_0x58af23){try{jsonpatch['apply'](_0x58af23,_0x20f55b,!![]);}catch(_0x4294dd){return BPromise[_0x7673('0x21')](_0x4294dd);}return _0x58af23[_0x7673('0x22')]();};}function saveUpdates(_0x4077e9,_0x1b172a){return function(_0x353941){if(_0x353941){return _0x353941[_0x7673('0x23')](_0x4077e9)[_0x7673('0x24')](function(_0x2cee84){return _0x2cee84;});}return null;};}function removeEntity(_0x592c9d,_0x49c1a4){return function(_0x344199){if(_0x344199){return _0x344199[_0x7673('0x25')]()[_0x7673('0x24')](function(){_0x592c9d[_0x7673('0x18')](0xcc)[_0x7673('0x19')]();});}};}function handleEntityNotFound(_0x4c39fd,_0x2d9682){return function(_0x41c47c){if(!_0x41c47c){_0x4c39fd['sendStatus'](0x194);}return _0x41c47c;};}function handleError(_0x17517f,_0x1da637){_0x1da637=_0x1da637||0x1f4;return function(_0x3a49c1){logger[_0x7673('0x26')](_0x3a49c1[_0x7673('0x27')]);if(_0x3a49c1[_0x7673('0x28')]){delete _0x3a49c1[_0x7673('0x28')];}_0x17517f[_0x7673('0x18')](_0x1da637)['send'](_0x3a49c1);};}exports['index']=function(_0x1beddc,_0x24d7e5){var _0x23433b={},_0x19bfa0={},_0x121dd1={'count':0x0,'rows':[]};var _0x59b3d2=_[_0x7673('0x29')](db[_0x7673('0x2a')][_0x7673('0x2b')],function(_0x1e7ea9){return{'name':_0x1e7ea9['fieldName'],'type':_0x1e7ea9[_0x7673('0x2c')][_0x7673('0x2d')]};});_0x19bfa0[_0x7673('0x2e')]=_[_0x7673('0x2f')](_[_0x7673('0x29')](_0x59b3d2,_0x7673('0x28')),[_0x7673('0x28')]);_0x19bfa0['query']=_[_0x7673('0x30')](_0x1beddc[_0x7673('0x31')]);_0x19bfa0['filters']=_['intersection'](_0x19bfa0[_0x7673('0x2e')],_0x19bfa0[_0x7673('0x31')]);_0x23433b[_0x7673('0x32')]=_[_0x7673('0x33')](_0x19bfa0[_0x7673('0x2e')],qs[_0x7673('0x34')](_0x1beddc['query'][_0x7673('0x34')]));_0x23433b[_0x7673('0x32')]=_0x23433b[_0x7673('0x32')][_0x7673('0x35')]?_0x23433b[_0x7673('0x32')]:_0x19bfa0[_0x7673('0x2e')];if(!_0x1beddc[_0x7673('0x31')][_0x7673('0x36')](_0x7673('0x37'))){_0x23433b['limit']=qs['limit'](_0x1beddc[_0x7673('0x31')][_0x7673('0x1d')]);_0x23433b[_0x7673('0x1a')]=qs[_0x7673('0x1a')](_0x1beddc[_0x7673('0x31')][_0x7673('0x1a')]);}_0x23433b[_0x7673('0x38')]=qs['sort'](_0x1beddc[_0x7673('0x31')][_0x7673('0x39')]);_0x23433b[_0x7673('0x3a')]=qs[_0x7673('0x3b')](_['pick'](_0x1beddc[_0x7673('0x31')],_0x19bfa0['filters']),_0x59b3d2);if(_0x1beddc[_0x7673('0x31')][_0x7673('0x3c')]){_0x23433b[_0x7673('0x3a')]=_[_0x7673('0x3d')](_0x23433b[_0x7673('0x3a')],{'$or':_[_0x7673('0x29')](_0x59b3d2,function(_0x2f93f6){if(_0x2f93f6[_0x7673('0x2c')]!==_0x7673('0x3e')){var _0x29d4e2={};_0x29d4e2[_0x2f93f6[_0x7673('0x28')]]={'$like':'%'+_0x1beddc[_0x7673('0x31')][_0x7673('0x3c')]+'%'};return _0x29d4e2;}})});}_0x23433b=_[_0x7673('0x3d')]({},_0x23433b,_0x1beddc[_0x7673('0x3f')]);var _0x515ac2={'where':_0x23433b[_0x7673('0x3a')]};return db['VoiceMailMessage'][_0x7673('0x1c')](_0x515ac2)[_0x7673('0x24')](function(_0x54d112){_0x121dd1['count']=_0x54d112;if(_0x1beddc[_0x7673('0x31')][_0x7673('0x40')]){_0x23433b[_0x7673('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x7673('0x42')](_0x23433b);})[_0x7673('0x24')](function(_0x3f2d97){_0x121dd1[_0x7673('0x43')]=_0x3f2d97;return _0x121dd1;})[_0x7673('0x24')](respondWithFilteredResult(_0x24d7e5,_0x23433b))[_0x7673('0x44')](handleError(_0x24d7e5,null));};exports[_0x7673('0x45')]=function(_0x1ce104,_0x4a6d65){var _0x9e401e={'raw':!![],'where':{'id':_0x1ce104[_0x7673('0x46')]['id']}},_0x29a633={};_0x29a633[_0x7673('0x2e')]=_[_0x7673('0x30')](db[_0x7673('0x2a')][_0x7673('0x2b')]);_0x29a633['query']=_[_0x7673('0x30')](_0x1ce104[_0x7673('0x31')]);_0x29a633['filters']=_[_0x7673('0x33')](_0x29a633[_0x7673('0x2e')],_0x29a633[_0x7673('0x31')]);_0x9e401e[_0x7673('0x32')]=_['intersection'](_0x29a633[_0x7673('0x2e')],qs[_0x7673('0x34')](_0x1ce104[_0x7673('0x31')][_0x7673('0x34')]));_0x9e401e[_0x7673('0x32')]=_0x9e401e[_0x7673('0x32')][_0x7673('0x35')]?_0x9e401e['attributes']:_0x29a633[_0x7673('0x2e')];if(_0x1ce104['query'][_0x7673('0x40')]){_0x9e401e['include']=[{'all':!![]}];}_0x9e401e=_[_0x7673('0x3d')]({},_0x9e401e,_0x1ce104[_0x7673('0x3f')]);return db[_0x7673('0x2a')]['find'](_0x9e401e)[_0x7673('0x24')](handleEntityNotFound(_0x4a6d65,null))[_0x7673('0x24')](respondWithResult(_0x4a6d65,null))[_0x7673('0x44')](handleError(_0x4a6d65,null));};exports[_0x7673('0x47')]=function(_0x4daaf5,_0x3cb01f){return db[_0x7673('0x2a')][_0x7673('0x47')](_0x4daaf5[_0x7673('0x48')],{})[_0x7673('0x24')](respondWithResult(_0x3cb01f,0xc9))[_0x7673('0x44')](handleError(_0x3cb01f,null));};exports[_0x7673('0x23')]=function(_0x609b2b,_0x2c7b83){if(_0x609b2b[_0x7673('0x48')]['id']){delete _0x609b2b[_0x7673('0x48')]['id'];}return db[_0x7673('0x2a')]['find']({'where':{'id':_0x609b2b[_0x7673('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c7b83,null))[_0x7673('0x24')](saveUpdates(_0x609b2b['body'],null))[_0x7673('0x24')](respondWithResult(_0x2c7b83,null))[_0x7673('0x44')](handleError(_0x2c7b83,null));};exports[_0x7673('0x25')]=function(_0xdc60db,_0x1a37dc){return db[_0x7673('0x2a')]['find']({'where':{'id':_0xdc60db[_0x7673('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a37dc,null))['then'](removeEntity(_0x1a37dc,null))[_0x7673('0x44')](handleError(_0x1a37dc,null));};exports[_0x7673('0x49')]=function(_0x33dba7,_0x238449,_0x3d67d3){return db[_0x7673('0x2a')][_0x7673('0x4a')]({'where':{'id':_0x33dba7[_0x7673('0x46')]['id']},'attributes':['id',_0x7673('0x4b'),_0x7673('0x4c')]})[_0x7673('0x24')](handleEntityNotFound(_0x238449,null))[_0x7673('0x24')](function(_0x19a2d0){if(_0x19a2d0){if(!_0x19a2d0[_0x7673('0x4b')]){throw new db[(_0x7673('0x4d'))][(_0x7673('0x4e'))](_0x7673('0x4f'));}var _0x43f547={'Content-Type':_0x7673('0x50'),'Content-Disposition':_0x7673('0x51')};if(_0x19a2d0[_0x7673('0x4c')]){_0x43f547[_0x7673('0x52')]=_0x7673('0x53')+_0x19a2d0['msg_id']+_0x7673('0x54');}_0x238449[_0x7673('0x1e')](_0x43f547);return _0x238449[_0x7673('0x55')](new Buffer(_0x19a2d0[_0x7673('0x4b')]));}})['catch'](handleError(_0x238449,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 28e4a01..ea0199b 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 _0xcf90=['dir','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./voiceMailMessage.attributes','exports','define','VoiceMailMessage'];(function(_0x31cb75,_0x33b36a){var _0x26a411=function(_0x2bb716){while(--_0x2bb716){_0x31cb75['push'](_0x31cb75['shift']());}};_0x26a411(++_0x33b36a);}(_0xcf90,0x121));var _0x0cf9=function(_0x2ee2c0,_0x27a502){_0x2ee2c0=_0x2ee2c0-0x0;var _0x347164=_0xcf90[_0x2ee2c0];return _0x347164;};'use strict';var _=require(_0x0cf9('0x0'));var util=require(_0x0cf9('0x1'));var logger=require(_0x0cf9('0x2'))('api');var moment=require(_0x0cf9('0x3'));var BPromise=require(_0x0cf9('0x4'));var rp=require(_0x0cf9('0x5'));var fs=require('fs');var path=require(_0x0cf9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0cf9('0x7'));module[_0x0cf9('0x8')]=function(_0x1ad3c8,_0x33f09d){return _0x1ad3c8[_0x0cf9('0x9')](_0x0cf9('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x0cf9('0xb'),'fields':[_0x0cf9('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf6c1=['define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x521e8d,_0x23a290){var _0x518bbd=function(_0x4241eb){while(--_0x4241eb){_0x521e8d['push'](_0x521e8d['shift']());}};_0x518bbd(++_0x23a290);}(_0xf6c1,0x154));var _0x1f6c=function(_0x4214fb,_0x31a0e4){_0x4214fb=_0x4214fb-0x0;var _0x51840e=_0xf6c1[_0x4214fb];return _0x51840e;};'use strict';var _=require(_0x1f6c('0x0'));var util=require(_0x1f6c('0x1'));var logger=require(_0x1f6c('0x2'))('api');var moment=require(_0x1f6c('0x3'));var BPromise=require(_0x1f6c('0x4'));var rp=require(_0x1f6c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f6c('0x6'));var config=require(_0x1f6c('0x7'));var attributes=require(_0x1f6c('0x8'));module[_0x1f6c('0x9')]=function(_0x5c9380,_0x2a9cf5){return _0x5c9380[_0x1f6c('0xa')](_0x1f6c('0xb'),attributes,{'tableName':_0x1f6c('0xc'),'paranoid':![],'indexes':[{'name':_0x1f6c('0xd'),'fields':[_0x1f6c('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 42d5629..a0deb1c 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 _0x7a54=['info','VoiceMailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x1a2f2c,_0x4ccce8){_0x1a2f2c=_0x1a2f2c-0x0;var _0xc11784=_0x7a54[_0x1a2f2c];return _0xc11784;};'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')]('VoiceMailMessage,\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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x1b4943,_0x48bd8d){var _0x1e91f0=function(_0x1799f2){while(--_0x1799f2){_0x1b4943['push'](_0x1b4943['shift']());}};_0x1e91f0(++_0x48bd8d);}(_0x14a0,0x8e));var _0x014a=function(_0x21783,_0x36e23a){_0x21783=_0x21783-0x0;var _0x5becfa=_0x14a0[_0x21783];return _0x5becfa;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index a10515f..3a11b98 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 _0x8772=['../../config/environment','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','post','create','addSound','destroy','delete','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1c2903,_0x22ffa1){var _0x3054b1=function(_0x240f1c){while(--_0x240f1c){_0x1c2903['push'](_0x1c2903['shift']());}};_0x3054b1(++_0x22ffa1);}(_0x8772,0xeb));var _0x2877=function(_0x3450d6,_0x2cb5b8){_0x3450d6=_0x3450d6-0x0;var _0x596bdd=_0x8772[_0x3450d6];return _0x596bdd;};'use strict';var multer=require('multer');var util=require(_0x2877('0x0'));var path=require(_0x2877('0x1'));var timeout=require(_0x2877('0x2'));var express=require(_0x2877('0x3'));var router=express[_0x2877('0x4')]();var fs_extra=require(_0x2877('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2877('0x6'));var config=require(_0x2877('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0x2877('0x8')]('/',auth[_0x2877('0x9')](),controller[_0x2877('0xa')]);router[_0x2877('0x8')](_0x2877('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2877('0x8')](_0x2877('0xc'),auth[_0x2877('0x9')](),controller[_0x2877('0xd')]);router[_0x2877('0xe')]('/',auth[_0x2877('0x9')](),controller[_0x2877('0xf')]);router[_0x2877('0xe')](_0x2877('0xc'),auth[_0x2877('0x9')](),controller[_0x2877('0x10')]);router['put'](_0x2877('0xb'),auth[_0x2877('0x9')](),controller['update']);router['delete']('/:id',auth[_0x2877('0x9')](),controller[_0x2877('0x11')]);router[_0x2877('0x12')](_0x2877('0x13'),auth[_0x2877('0x9')](),controller[_0x2877('0x14')]);module[_0x2877('0x15')]=router; \ No newline at end of file +var _0x6427=['getSounds','post','create','addSound','put','/:id','delete','destroy','/:id/sounds/:id2','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','index','get','isAuthenticated','show','/:id/sounds'];(function(_0x2bf14b,_0x409fc8){var _0x32f2d4=function(_0x1f5602){while(--_0x1f5602){_0x2bf14b['push'](_0x2bf14b['shift']());}};_0x32f2d4(++_0x409fc8);}(_0x6427,0x6a));var _0x7642=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x6427[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0x7642('0x0'));var util=require(_0x7642('0x1'));var path=require(_0x7642('0x2'));var timeout=require('connect-timeout');var express=require(_0x7642('0x3'));var router=express['Router']();var fs_extra=require(_0x7642('0x4'));var auth=require(_0x7642('0x5'));var interaction=require(_0x7642('0x6'));var config=require(_0x7642('0x7'));var controller=require(_0x7642('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7642('0x9')]);router[_0x7642('0xa')]('/:id',auth[_0x7642('0xb')](),controller[_0x7642('0xc')]);router[_0x7642('0xa')](_0x7642('0xd'),auth[_0x7642('0xb')](),controller[_0x7642('0xe')]);router[_0x7642('0xf')]('/',auth[_0x7642('0xb')](),controller[_0x7642('0x10')]);router[_0x7642('0xf')]('/:id/sounds',auth[_0x7642('0xb')](),controller[_0x7642('0x11')]);router[_0x7642('0x12')](_0x7642('0x13'),auth[_0x7642('0xb')](),controller['update']);router[_0x7642('0x14')]('/:id',auth[_0x7642('0xb')](),controller[_0x7642('0x15')]);router['delete'](_0x7642('0x16'),auth[_0x7642('0xb')](),controller['removeSound']);module[_0x7642('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index caa19ac..e8d2de3 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 _0xb04e=['mp3','files','STRING','alpha','BOOLEAN','sequelize','exports','ENUM','custom','mp3nb','quietmp3nb','quietmp3'];(function(_0x45ee27,_0x43549e){var _0x36e328=function(_0x3574cf){while(--_0x3574cf){_0x45ee27['push'](_0x45ee27['shift']());}};_0x36e328(++_0x43549e);}(_0xb04e,0x179));var _0xeb04=function(_0x582b0f,_0x35a9de){_0x582b0f=_0x582b0f-0x0;var _0x4658f0=_0xb04e[_0x582b0f];return _0x4658f0;};'use strict';var Sequelize=require(_0xeb04('0x0'));module[_0xeb04('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xeb04('0x2')](_0xeb04('0x3'),'files',_0xeb04('0x4'),_0xeb04('0x5'),_0xeb04('0x6'),_0xeb04('0x7')),'allowNull':!![],'defaultValue':_0xeb04('0x8')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xeb04('0x9')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xeb04('0xa')},'format':{'type':Sequelize[_0xeb04('0x9')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xeb04('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xca44=['quietmp3nb','mp3','alpha','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb'];(function(_0x56ffae,_0x16ac0f){var _0x532acd=function(_0x3b913e){while(--_0x3b913e){_0x56ffae['push'](_0x56ffae['shift']());}};_0x532acd(++_0x16ac0f);}(_0xca44,0x184));var _0x4ca4=function(_0x3a3d8b,_0x530ce2){_0x3a3d8b=_0x3a3d8b-0x0;var _0x58180b=_0xca44[_0x3a3d8b];return _0x58180b;};'use strict';var Sequelize=require(_0x4ca4('0x0'));module[_0x4ca4('0x1')]={'name':{'type':Sequelize[_0x4ca4('0x2')],'allowNull':![],'unique':_0x4ca4('0x3')},'mode':{'type':Sequelize[_0x4ca4('0x4')](_0x4ca4('0x5'),_0x4ca4('0x6'),_0x4ca4('0x7'),_0x4ca4('0x8'),'quietmp3',_0x4ca4('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x4ca4('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x4ca4('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x4ca4('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x4ca4('0x2')],'allowNull':!![],'defaultValue':_0x4ca4('0xa')},'format':{'type':Sequelize[_0x4ca4('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 692a86d..32e0e23 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 _0x2ab2=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','findOne','id2','message','getSounds','nolimit','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','get','MusicOnHolds','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','intersection','find','body','params','sequelize','transaction','mode','directory','join','root','server/files/moh','create','files','0777'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x2ab2,0xfa));var _0x22ab=function(_0x3a4571,_0x3a7ffd){_0x3a4571=_0x3a4571-0x0;var _0x393350=_0x2ab2[_0x3a4571];return _0x393350;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x22ab('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x22ab('0x1'));var BPromise=require(_0x22ab('0x2'));var Mustache=require(_0x22ab('0x3'));var util=require(_0x22ab('0x4'));var path=require('path');var sox=require(_0x22ab('0x5'));var csv=require(_0x22ab('0x6'));var ejs=require(_0x22ab('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x22ab('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x22ab('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x22ab('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x22ab('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x22ab('0xb'));var as=require(_0x22ab('0xc'));var hardwareService=require(_0x22ab('0xd'));var logger=require('../../config/logger')(_0x22ab('0xe'));var utils=require(_0x22ab('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x22ab('0x10'))['db'];function respondWithStatusCode(_0x32f4e2,_0x4d7636){_0x4d7636=_0x4d7636||0xcc;return function(_0x1b948e){if(_0x1b948e){return _0x32f4e2[_0x22ab('0x11')](_0x4d7636);}return _0x32f4e2[_0x22ab('0x12')](_0x4d7636)[_0x22ab('0x13')]();};}function respondWithResult(_0x5515d5,_0x5636c7){_0x5636c7=_0x5636c7||0xc8;return function(_0x52e20d){if(_0x52e20d){return _0x5515d5['status'](_0x5636c7)['json'](_0x52e20d);}};}function respondWithFilteredResult(_0x421c5f,_0x473207){return function(_0x2ca97b){if(_0x2ca97b){var _0x2c581a=typeof _0x473207[_0x22ab('0x14')]===_0x22ab('0x15')&&typeof _0x473207['limit']==='undefined';var _0x46ae68=_0x2ca97b[_0x22ab('0x16')];var _0xd60ce6=_0x2c581a?0x0:_0x473207[_0x22ab('0x14')];var _0x394c2b=_0x2c581a?_0x2ca97b['count']:_0x473207[_0x22ab('0x14')]+_0x473207[_0x22ab('0x17')];var _0x1d7770;if(_0x394c2b>=_0x46ae68){_0x394c2b=_0x46ae68;_0x1d7770=0xc8;}else{_0x1d7770=0xce;}_0x421c5f[_0x22ab('0x12')](_0x1d7770);return _0x421c5f[_0x22ab('0x18')](_0x22ab('0x19'),_0xd60ce6+'-'+_0x394c2b+'/'+_0x46ae68)[_0x22ab('0x1a')](_0x2ca97b);}return null;};}function patchUpdates(_0x2cbd45){return function(_0x250dd1){try{jsonpatch[_0x22ab('0x1b')](_0x250dd1,_0x2cbd45,!![]);}catch(_0x29a443){return BPromise[_0x22ab('0x1c')](_0x29a443);}return _0x250dd1[_0x22ab('0x1d')]();};}function saveUpdates(_0x35bae7,_0x40b21e){return function(_0x407d22){if(_0x407d22){return _0x407d22[_0x22ab('0x1e')](_0x35bae7)['then'](function(_0x94e2e7){return _0x94e2e7;});}return null;};}function removeEntity(_0x5177a4,_0x1e4176){return function(_0x37fb17){if(_0x37fb17){return _0x37fb17[_0x22ab('0x1f')]()[_0x22ab('0x20')](function(){var _0x3965e9=_0x37fb17[_0x22ab('0x21')]({'plain':!![]});var _0x43acc6=_0x22ab('0x22');return db['UserProfileResource'][_0x22ab('0x1f')]({'where':{'type':_0x43acc6,'resourceId':_0x3965e9['id']}})['then'](function(){return _0x37fb17;});})['then'](function(){_0x5177a4[_0x22ab('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x516ac4,_0x278b9d){return function(_0x2dbd49){if(!_0x2dbd49){_0x516ac4['sendStatus'](0x194);}return _0x2dbd49;};}function handleError(_0x209fa8,_0x1c7200){_0x1c7200=_0x1c7200||0x1f4;return function(_0x3d533d){logger[_0x22ab('0x23')](_0x3d533d[_0x22ab('0x24')]);if(_0x3d533d[_0x22ab('0x25')]){delete _0x3d533d[_0x22ab('0x25')];}_0x209fa8[_0x22ab('0x12')](_0x1c7200)[_0x22ab('0x26')](_0x3d533d);};}exports[_0x22ab('0x27')]=function(_0x2f1aaf,_0x5d2890){var _0x4e6b4e={},_0x18fbf1={},_0x224ff7={'count':0x0,'rows':[]};var _0x249991=_[_0x22ab('0x28')](db[_0x22ab('0x29')][_0x22ab('0x2a')],function(_0x405f2b){return{'name':_0x405f2b[_0x22ab('0x2b')],'type':_0x405f2b[_0x22ab('0x2c')][_0x22ab('0x2d')]};});_0x18fbf1['model']=_[_0x22ab('0x28')](_0x249991,_0x22ab('0x25'));_0x18fbf1[_0x22ab('0x2e')]=_['keys'](_0x2f1aaf['query']);_0x18fbf1[_0x22ab('0x2f')]=_['intersection'](_0x18fbf1[_0x22ab('0x30')],_0x18fbf1[_0x22ab('0x2e')]);_0x4e6b4e['attributes']=_['intersection'](_0x18fbf1[_0x22ab('0x30')],qs[_0x22ab('0x31')](_0x2f1aaf[_0x22ab('0x2e')][_0x22ab('0x31')]));_0x4e6b4e[_0x22ab('0x32')]=_0x4e6b4e[_0x22ab('0x32')][_0x22ab('0x33')]?_0x4e6b4e[_0x22ab('0x32')]:_0x18fbf1['model'];if(!_0x2f1aaf[_0x22ab('0x2e')][_0x22ab('0x34')]('nolimit')){_0x4e6b4e[_0x22ab('0x17')]=qs['limit'](_0x2f1aaf[_0x22ab('0x2e')][_0x22ab('0x17')]);_0x4e6b4e[_0x22ab('0x14')]=qs[_0x22ab('0x14')](_0x2f1aaf[_0x22ab('0x2e')][_0x22ab('0x14')]);}_0x4e6b4e[_0x22ab('0x35')]=qs['sort'](_0x2f1aaf[_0x22ab('0x2e')][_0x22ab('0x36')]);delete _0x2f1aaf[_0x22ab('0x2e')][_0x22ab('0x36')];_0x4e6b4e[_0x22ab('0x37')]=qs[_0x22ab('0x2f')](_['pick'](_0x2f1aaf[_0x22ab('0x2e')],_0x18fbf1[_0x22ab('0x2f')]),_0x249991);if(_0x2f1aaf[_0x22ab('0x2e')][_0x22ab('0x38')]){_0x4e6b4e['where']=_[_0x22ab('0x39')](_0x4e6b4e[_0x22ab('0x37')],{'$or':_['map'](_0x249991,function(_0x119899){if(_0x119899[_0x22ab('0x2c')]!==_0x22ab('0x3a')){var _0x5c765a={};_0x5c765a[_0x119899[_0x22ab('0x25')]]={'$like':'%'+_0x2f1aaf[_0x22ab('0x2e')][_0x22ab('0x38')]+'%'};return _0x5c765a;}})});}_0x4e6b4e=_[_0x22ab('0x39')]({},_0x4e6b4e,_0x2f1aaf[_0x22ab('0x3b')]);var _0x1c366f={'where':_0x4e6b4e['where']};return db['VoiceMusicOnHold'][_0x22ab('0x16')](_0x1c366f)['then'](function(_0x174f3e){_0x224ff7['count']=_0x174f3e;if(_0x2f1aaf[_0x22ab('0x2e')][_0x22ab('0x3c')]){_0x4e6b4e[_0x22ab('0x3d')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x4e6b4e);})[_0x22ab('0x20')](function(_0x1a155a){_0x224ff7[_0x22ab('0x3e')]=_0x1a155a;return _0x224ff7;})[_0x22ab('0x20')](respondWithFilteredResult(_0x5d2890,_0x4e6b4e))[_0x22ab('0x3f')](handleError(_0x5d2890,null));};exports[_0x22ab('0x40')]=function(_0x472a45,_0x1f2fd6){var _0x470216={'raw':![],'where':{'id':_0x472a45['params']['id']}},_0x560be8={};_0x560be8['model']=_[_0x22ab('0x41')](db['VoiceMusicOnHold'][_0x22ab('0x2a')]);_0x560be8[_0x22ab('0x2e')]=_[_0x22ab('0x41')](_0x472a45[_0x22ab('0x2e')]);_0x560be8['filters']=_[_0x22ab('0x42')](_0x560be8['model'],_0x560be8['query']);_0x470216[_0x22ab('0x32')]=_[_0x22ab('0x42')](_0x560be8[_0x22ab('0x30')],qs[_0x22ab('0x31')](_0x472a45[_0x22ab('0x2e')][_0x22ab('0x31')]));_0x470216[_0x22ab('0x32')]=_0x470216['attributes']['length']?_0x470216[_0x22ab('0x32')]:_0x560be8[_0x22ab('0x30')];if(_0x472a45[_0x22ab('0x2e')]['includeAll']){_0x470216['include']=[{'all':!![]}];}_0x470216=_[_0x22ab('0x39')]({},_0x470216,_0x472a45[_0x22ab('0x3b')]);return db[_0x22ab('0x29')][_0x22ab('0x43')](_0x470216)['then'](handleEntityNotFound(_0x1f2fd6,null))[_0x22ab('0x20')](respondWithResult(_0x1f2fd6,null))[_0x22ab('0x3f')](handleError(_0x1f2fd6,null));};exports[_0x22ab('0x1e')]=function(_0x1f6701,_0x5d9d02){if(_0x1f6701[_0x22ab('0x44')]['id']){delete _0x1f6701[_0x22ab('0x44')]['id'];}return db[_0x22ab('0x29')][_0x22ab('0x43')]({'where':{'id':_0x1f6701[_0x22ab('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d9d02,null))[_0x22ab('0x20')](saveUpdates(_0x1f6701[_0x22ab('0x44')],null))['then'](respondWithResult(_0x5d9d02,null))[_0x22ab('0x3f')](handleError(_0x5d9d02,null));};exports['create']=function(_0x20a64c,_0x4bafcd,_0x29dc3a){return db[_0x22ab('0x46')][_0x22ab('0x47')](function(_0x1b8e29){if(_0x20a64c[_0x22ab('0x44')][_0x22ab('0x48')]==='files'){_0x20a64c[_0x22ab('0x44')][_0x22ab('0x49')]=path[_0x22ab('0x4a')](config[_0x22ab('0x4b')],_0x22ab('0x4c'),_0x20a64c[_0x22ab('0x44')]['name']);}return db['VoiceMusicOnHold'][_0x22ab('0x4d')](_0x20a64c[_0x22ab('0x44')],{'transaction':_0x1b8e29})['then'](function(_0x2dee30){if(_0x20a64c[_0x22ab('0x44')][_0x22ab('0x48')]===_0x22ab('0x4e')){fs['mkdirSync'](_0x2dee30[_0x22ab('0x49')],parseInt(_0x22ab('0x4f'),0x8));}var _0x697a0c=_0x20a64c[_0x22ab('0x50')][_0x22ab('0x21')]({'plain':!![]});if(!_0x697a0c)throw new Error(_0x22ab('0x51'));if(_0x697a0c[_0x22ab('0x52')]===_0x22ab('0x50')){var _0x509505=_0x2dee30['get']({'plain':!![]});return db[_0x22ab('0x53')][_0x22ab('0x43')]({'where':{'name':_0x22ab('0x22'),'userProfileId':_0x697a0c[_0x22ab('0x54')]},'raw':!![]})[_0x22ab('0x20')](function(_0x530a1b){if(_0x530a1b&&_0x530a1b[_0x22ab('0x55')]===0x0){return db[_0x22ab('0x56')]['create']({'name':_0x509505['name'],'resourceId':_0x509505['id'],'type':_0x530a1b[_0x22ab('0x25')],'sectionId':_0x530a1b['id']},{})[_0x22ab('0x20')](function(){return _0x2dee30;});}else{return _0x2dee30;}})[_0x22ab('0x3f')](function(_0x4934ed){logger['error'](_0x22ab('0x57'),_0x4934ed);});}return _0x2dee30;});})[_0x22ab('0x20')](respondWithResult(_0x4bafcd,0xc9))[_0x22ab('0x3f')](handleError(_0x4bafcd,null));};exports['destroy']=function(_0x12fe89,_0x57908f,_0x4d4cae){var _0x205734;return db['VoiceMusicOnHold'][_0x22ab('0x43')]({'where':{'id':_0x12fe89[_0x22ab('0x45')]['id']}})[_0x22ab('0x20')](function(_0x344aa1){if(_0x344aa1){return db[_0x22ab('0x46')][_0x22ab('0x47')](function(_0x1c053e){return _0x344aa1[_0x22ab('0x1f')]({'transaction':_0x1c053e,'raw':!![]})[_0x22ab('0x20')](function(_0x2f3ec1){if(_0x2f3ec1[_0x22ab('0x49')]){fs[_0x22ab('0x58')](_0x2f3ec1[_0x22ab('0x49')])[_0x22ab('0x59')](function(_0x492339){fs[_0x22ab('0x5a')](path['join'](_0x2f3ec1['directory'],_0x492339));});fs['rmdirSync'](_0x2f3ec1[_0x22ab('0x49')]);}return _0x2f3ec1;});})[_0x22ab('0x3f')](function(_0x22b19f){throw new db[(_0x22ab('0x5b'))][(_0x22ab('0x5c'))](_0x22b19f['message']);});}})[_0x22ab('0x20')](handleEntityNotFound(_0x57908f,null))['then'](removeEntity(_0x57908f,null))[_0x22ab('0x3f')](handleError(_0x57908f,null));};exports[_0x22ab('0x5d')]=function(_0x43ce71,_0x453224,_0x14b85a){return db[_0x22ab('0x46')]['transaction'](function(_0x223ca5){var _0x2ddecf;return db['VoiceMusicOnHold'][_0x22ab('0x43')]({'where':{'id':_0x43ce71['params']['id']}})[_0x22ab('0x20')](function(_0x3ea09f){if(_0x3ea09f){_0x2ddecf=_0x3ea09f;return _0x3ea09f['addSound'](_0x43ce71[_0x22ab('0x44')]['id'],{'transaction':_0x223ca5});}})[_0x22ab('0x20')](function(_0x542cba){if(_0x542cba){return db[_0x22ab('0x5e')]['findOne']({'where':{'id':_0x43ce71[_0x22ab('0x44')]['id']},'attributes':['id',_0x22ab('0x25'),_0x22ab('0x5f'),_0x22ab('0x60'),_0x22ab('0x61')],'raw':!![]});}})['then'](function(_0x30a747){if(_0x30a747){var _0x1d3826=path['join'](config[_0x22ab('0x4b')],_0x22ab('0x62'),util[_0x22ab('0x63')](_0x22ab('0x64'),path[_0x22ab('0x65')](_0x30a747[_0x22ab('0x5f')],path[_0x22ab('0x66')](_0x30a747[_0x22ab('0x5f')])),_0x30a747['converted_format']));var _0x2eaa4c=path[_0x22ab('0x4a')](config['root'],_0x22ab('0x4c'),_0x2ddecf[_0x22ab('0x25')],util['format']('%s.%s',_0x30a747[_0x22ab('0x25')],_0x30a747[_0x22ab('0x60')]));fs[_0x22ab('0x67')](_0x1d3826,_0x2eaa4c);return _0x30a747;}})[_0x22ab('0x3f')](function(_0x397f86){throw new db[(_0x22ab('0x5b'))]['ValidationError'](_0x397f86['message']);});})['then'](handleEntityNotFound(_0x453224,null))[_0x22ab('0x20')](respondWithResult(_0x453224,0xc9))['catch'](handleError(_0x453224,null));};exports[_0x22ab('0x68')]=function(_0xac832c,_0x157023,_0x28e64b){return db['sequelize']['transaction'](function(_0x46a7ce){var _0x16ca30;return db[_0x22ab('0x29')][_0x22ab('0x69')]({'where':{'id':_0xac832c['params']['id']}})[_0x22ab('0x20')](handleEntityNotFound(_0x157023,null))[_0x22ab('0x20')](function(_0x25b760){if(_0x25b760){_0x16ca30=_0x25b760;return _0x25b760[_0x22ab('0x68')](_0xac832c[_0x22ab('0x45')][_0x22ab('0x6a')]);}})['then'](function(_0x269e56){if(_0x269e56){return db['Sound'][_0x22ab('0x69')]({'where':{'id':_0xac832c[_0x22ab('0x45')][_0x22ab('0x6a')]},'attributes':['id',_0x22ab('0x25'),_0x22ab('0x5f'),_0x22ab('0x60'),_0x22ab('0x61')],'raw':!![]});}})[_0x22ab('0x20')](function(_0x2b6c9d){if(_0x2b6c9d){fs['unlinkSync'](path[_0x22ab('0x4a')](_0x16ca30[_0x22ab('0x49')],util[_0x22ab('0x63')](_0x22ab('0x64'),_0x2b6c9d[_0x22ab('0x25')],_0x2b6c9d[_0x22ab('0x60')])));return _0x2b6c9d;}})['catch'](function(_0x231767){throw new db[(_0x22ab('0x5b'))][(_0x22ab('0x5c'))](_0x231767[_0x22ab('0x6b')]);});})['then'](handleEntityNotFound(_0x157023,null))[_0x22ab('0x20')](respondWithStatusCode(_0x157023,0xcc))[_0x22ab('0x3f')](handleError(_0x157023,null));};exports[_0x22ab('0x6c')]=function(_0x351579,_0x564328,_0x145e89){var _0x490971={};var _0x1eb76a={};var _0x8dfed6;var _0x314c0e;return db[_0x22ab('0x29')][_0x22ab('0x69')]({'where':{'id':_0x351579[_0x22ab('0x45')]['id']}})[_0x22ab('0x20')](handleEntityNotFound(_0x564328,null))[_0x22ab('0x20')](function(_0x374220){if(_0x374220){_0x8dfed6=_0x374220;_0x1eb76a[_0x22ab('0x30')]=_[_0x22ab('0x41')](db[_0x22ab('0x5e')][_0x22ab('0x2a')]);_0x1eb76a[_0x22ab('0x2e')]=_[_0x22ab('0x41')](_0x351579[_0x22ab('0x2e')]);_0x1eb76a['filters']=_[_0x22ab('0x42')](_0x1eb76a[_0x22ab('0x30')],_0x1eb76a[_0x22ab('0x2e')]);_0x490971[_0x22ab('0x32')]=_[_0x22ab('0x42')](_0x1eb76a[_0x22ab('0x30')],qs['fields'](_0x351579[_0x22ab('0x2e')][_0x22ab('0x31')]));_0x490971[_0x22ab('0x32')]=_0x490971[_0x22ab('0x32')][_0x22ab('0x33')]?_0x490971[_0x22ab('0x32')]:_0x1eb76a[_0x22ab('0x30')];_0x490971[_0x22ab('0x35')]=qs['sort'](_0x351579[_0x22ab('0x2e')][_0x22ab('0x36')]);_0x490971['where']=qs[_0x22ab('0x2f')](_['pick'](_0x351579[_0x22ab('0x2e')],_0x1eb76a[_0x22ab('0x2f')]));if(_0x351579[_0x22ab('0x2e')][_0x22ab('0x38')]){_0x490971['where']=_['merge'](_0x490971['where'],{'$or':_[_0x22ab('0x28')](_0x490971[_0x22ab('0x32')],function(_0x469da4){var _0x551dc4={};_0x551dc4[_0x469da4]={'$like':'%'+_0x351579[_0x22ab('0x2e')][_0x22ab('0x38')]+'%'};return _0x551dc4;})});}_0x490971=_['merge']({},_0x490971,_0x351579[_0x22ab('0x3b')]);return _0x8dfed6[_0x22ab('0x6c')](_0x490971);}})[_0x22ab('0x20')](function(_0xc5d770){if(_0xc5d770){_0x314c0e=_0xc5d770[_0x22ab('0x33')];if(!_0x351579[_0x22ab('0x2e')][_0x22ab('0x34')](_0x22ab('0x6d'))){_0x490971[_0x22ab('0x17')]=qs['limit'](_0x351579[_0x22ab('0x2e')][_0x22ab('0x17')]);_0x490971[_0x22ab('0x14')]=qs[_0x22ab('0x14')](_0x351579[_0x22ab('0x2e')][_0x22ab('0x14')]);}return _0x8dfed6[_0x22ab('0x6c')](_0x490971);}})[_0x22ab('0x20')](function(_0x32b007){if(_0x32b007){return _0x32b007?{'count':_0x314c0e,'rows':_0x32b007}:null;}})['then'](respondWithResult(_0x564328,null))['catch'](handleError(_0x564328,null));}; \ No newline at end of file +var _0x6b7c=['findAll','catch','params','length','find','update','body','transaction','mode','directory','join','root','create','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','forEach','unlinkSync','rmdirSync','ValidationError','addSound','Sound','findOne','converted_format','createdAt','format','basename','save_name','server/files/moh','%s.%s','symlinkSync','message','removeSound','id2','Sequelize','getSounds','pick','options','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','get','MusicOnHolds','UserProfileResource','then','error','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include'];(function(_0x2c9d95,_0xcc4c3){var _0x1b9a2e=function(_0x53290f){while(--_0x53290f){_0x2c9d95['push'](_0x2c9d95['shift']());}};_0x1b9a2e(++_0xcc4c3);}(_0x6b7c,0x98));var _0xc6b7=function(_0x1301aa,_0x4da5c4){_0x1301aa=_0x1301aa-0x0;var _0x5146a1=_0x6b7c[_0x1301aa];return _0x5146a1;};'use strict';var emlformat=require(_0xc6b7('0x0'));var rimraf=require(_0xc6b7('0x1'));var zipdir=require(_0xc6b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc6b7('0x3'));var moment=require(_0xc6b7('0x4'));var BPromise=require(_0xc6b7('0x5'));var Mustache=require(_0xc6b7('0x6'));var util=require(_0xc6b7('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc6b7('0x8'));var ejs=require(_0xc6b7('0x9'));var fs=require('fs');var fs_extra=require(_0xc6b7('0xa'));var _=require(_0xc6b7('0xb'));var squel=require(_0xc6b7('0xc'));var crypto=require(_0xc6b7('0xd'));var jsforce=require(_0xc6b7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc6b7('0x8'));var querystring=require(_0xc6b7('0xf'));var Papa=require(_0xc6b7('0x10'));var Redis=require(_0xc6b7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc6b7('0x12'));var as=require(_0xc6b7('0x13'));var hardwareService=require(_0xc6b7('0x14'));var logger=require(_0xc6b7('0x15'))(_0xc6b7('0x16'));var utils=require(_0xc6b7('0x17'));var config=require(_0xc6b7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6b7('0x19'))['db'];function respondWithStatusCode(_0x47f3e0,_0x89e3e){_0x89e3e=_0x89e3e||0xcc;return function(_0x1e9a4c){if(_0x1e9a4c){return _0x47f3e0[_0xc6b7('0x1a')](_0x89e3e);}return _0x47f3e0[_0xc6b7('0x1b')](_0x89e3e)[_0xc6b7('0x1c')]();};}function respondWithResult(_0x4086e9,_0x130169){_0x130169=_0x130169||0xc8;return function(_0x32a970){if(_0x32a970){return _0x4086e9['status'](_0x130169)[_0xc6b7('0x1d')](_0x32a970);}};}function respondWithFilteredResult(_0x4feac8,_0x4d84d7){return function(_0x288e87){if(_0x288e87){var _0x1e2909=typeof _0x4d84d7[_0xc6b7('0x1e')]===_0xc6b7('0x1f')&&typeof _0x4d84d7[_0xc6b7('0x20')]===_0xc6b7('0x1f');var _0x3731e5=_0x288e87[_0xc6b7('0x21')];var _0x31fa45=_0x1e2909?0x0:_0x4d84d7[_0xc6b7('0x1e')];var _0x3d577c=_0x1e2909?_0x288e87[_0xc6b7('0x21')]:_0x4d84d7['offset']+_0x4d84d7[_0xc6b7('0x20')];var _0x545f31;if(_0x3d577c>=_0x3731e5){_0x3d577c=_0x3731e5;_0x545f31=0xc8;}else{_0x545f31=0xce;}_0x4feac8['status'](_0x545f31);return _0x4feac8[_0xc6b7('0x22')]('Content-Range',_0x31fa45+'-'+_0x3d577c+'/'+_0x3731e5)[_0xc6b7('0x1d')](_0x288e87);}return null;};}function patchUpdates(_0xc2b4e4){return function(_0x2535c1){try{jsonpatch[_0xc6b7('0x23')](_0x2535c1,_0xc2b4e4,!![]);}catch(_0x57d788){return BPromise[_0xc6b7('0x24')](_0x57d788);}return _0x2535c1[_0xc6b7('0x25')]();};}function saveUpdates(_0x370fa7,_0x4ddbb3){return function(_0x4d19f3){if(_0x4d19f3){return _0x4d19f3['update'](_0x370fa7)['then'](function(_0x2de63c){return _0x2de63c;});}return null;};}function removeEntity(_0x21f57f,_0x5a3ba0){return function(_0xb6d20f){if(_0xb6d20f){return _0xb6d20f[_0xc6b7('0x26')]()['then'](function(){var _0x445aa7=_0xb6d20f[_0xc6b7('0x27')]({'plain':!![]});var _0x57fc8a=_0xc6b7('0x28');return db[_0xc6b7('0x29')]['destroy']({'where':{'type':_0x57fc8a,'resourceId':_0x445aa7['id']}})[_0xc6b7('0x2a')](function(){return _0xb6d20f;});})[_0xc6b7('0x2a')](function(){_0x21f57f['status'](0xcc)[_0xc6b7('0x1c')]();});}};}function handleEntityNotFound(_0x2ac331,_0x13f33c){return function(_0x3f4bc3){if(!_0x3f4bc3){_0x2ac331[_0xc6b7('0x1a')](0x194);}return _0x3f4bc3;};}function handleError(_0x5a2d4e,_0x4d49bc){_0x4d49bc=_0x4d49bc||0x1f4;return function(_0x967604){logger[_0xc6b7('0x2b')](_0x967604['stack']);if(_0x967604[_0xc6b7('0x2c')]){delete _0x967604['name'];}_0x5a2d4e[_0xc6b7('0x1b')](_0x4d49bc)[_0xc6b7('0x2d')](_0x967604);};}exports['index']=function(_0xac2c39,_0xdf6029){var _0x565afa={},_0x223d2e={},_0x570c78={'count':0x0,'rows':[]};var _0x447ce6=_[_0xc6b7('0x2e')](db[_0xc6b7('0x2f')][_0xc6b7('0x30')],function(_0x2ec672){return{'name':_0x2ec672[_0xc6b7('0x31')],'type':_0x2ec672[_0xc6b7('0x32')][_0xc6b7('0x33')]};});_0x223d2e['model']=_['map'](_0x447ce6,_0xc6b7('0x2c'));_0x223d2e['query']=_[_0xc6b7('0x34')](_0xac2c39[_0xc6b7('0x35')]);_0x223d2e['filters']=_[_0xc6b7('0x36')](_0x223d2e[_0xc6b7('0x37')],_0x223d2e[_0xc6b7('0x35')]);_0x565afa[_0xc6b7('0x38')]=_['intersection'](_0x223d2e['model'],qs['fields'](_0xac2c39[_0xc6b7('0x35')][_0xc6b7('0x39')]));_0x565afa[_0xc6b7('0x38')]=_0x565afa[_0xc6b7('0x38')]['length']?_0x565afa[_0xc6b7('0x38')]:_0x223d2e[_0xc6b7('0x37')];if(!_0xac2c39['query'][_0xc6b7('0x3a')](_0xc6b7('0x3b'))){_0x565afa['limit']=qs[_0xc6b7('0x20')](_0xac2c39[_0xc6b7('0x35')][_0xc6b7('0x20')]);_0x565afa[_0xc6b7('0x1e')]=qs[_0xc6b7('0x1e')](_0xac2c39[_0xc6b7('0x35')][_0xc6b7('0x1e')]);}_0x565afa[_0xc6b7('0x3c')]=qs[_0xc6b7('0x3d')](_0xac2c39[_0xc6b7('0x35')][_0xc6b7('0x3d')]);delete _0xac2c39[_0xc6b7('0x35')][_0xc6b7('0x3d')];_0x565afa[_0xc6b7('0x3e')]=qs['filters'](_['pick'](_0xac2c39['query'],_0x223d2e[_0xc6b7('0x3f')]),_0x447ce6);if(_0xac2c39['query'][_0xc6b7('0x40')]){_0x565afa[_0xc6b7('0x3e')]=_['merge'](_0x565afa[_0xc6b7('0x3e')],{'$or':_[_0xc6b7('0x2e')](_0x447ce6,function(_0x1e6894){if(_0x1e6894['type']!=='VIRTUAL'){var _0x14ad33={};_0x14ad33[_0x1e6894['name']]={'$like':'%'+_0xac2c39['query'][_0xc6b7('0x40')]+'%'};return _0x14ad33;}})});}_0x565afa=_[_0xc6b7('0x41')]({},_0x565afa,_0xac2c39['options']);var _0xa342c0={'where':_0x565afa[_0xc6b7('0x3e')]};return db['VoiceMusicOnHold'][_0xc6b7('0x21')](_0xa342c0)[_0xc6b7('0x2a')](function(_0x257f9e){_0x570c78[_0xc6b7('0x21')]=_0x257f9e;if(_0xac2c39['query'][_0xc6b7('0x42')]){_0x565afa[_0xc6b7('0x43')]=[{'all':!![]}];}return db[_0xc6b7('0x2f')][_0xc6b7('0x44')](_0x565afa);})[_0xc6b7('0x2a')](function(_0x1ad047){_0x570c78['rows']=_0x1ad047;return _0x570c78;})['then'](respondWithFilteredResult(_0xdf6029,_0x565afa))[_0xc6b7('0x45')](handleError(_0xdf6029,null));};exports['show']=function(_0x3b01a1,_0x2afb31){var _0x56e23b={'raw':![],'where':{'id':_0x3b01a1[_0xc6b7('0x46')]['id']}},_0x55012f={};_0x55012f[_0xc6b7('0x37')]=_[_0xc6b7('0x34')](db['VoiceMusicOnHold']['rawAttributes']);_0x55012f['query']=_[_0xc6b7('0x34')](_0x3b01a1[_0xc6b7('0x35')]);_0x55012f[_0xc6b7('0x3f')]=_[_0xc6b7('0x36')](_0x55012f[_0xc6b7('0x37')],_0x55012f[_0xc6b7('0x35')]);_0x56e23b[_0xc6b7('0x38')]=_[_0xc6b7('0x36')](_0x55012f[_0xc6b7('0x37')],qs[_0xc6b7('0x39')](_0x3b01a1[_0xc6b7('0x35')][_0xc6b7('0x39')]));_0x56e23b[_0xc6b7('0x38')]=_0x56e23b[_0xc6b7('0x38')][_0xc6b7('0x47')]?_0x56e23b[_0xc6b7('0x38')]:_0x55012f[_0xc6b7('0x37')];if(_0x3b01a1[_0xc6b7('0x35')][_0xc6b7('0x42')]){_0x56e23b['include']=[{'all':!![]}];}_0x56e23b=_[_0xc6b7('0x41')]({},_0x56e23b,_0x3b01a1['options']);return db['VoiceMusicOnHold'][_0xc6b7('0x48')](_0x56e23b)[_0xc6b7('0x2a')](handleEntityNotFound(_0x2afb31,null))['then'](respondWithResult(_0x2afb31,null))[_0xc6b7('0x45')](handleError(_0x2afb31,null));};exports[_0xc6b7('0x49')]=function(_0x3873e4,_0x122000){if(_0x3873e4[_0xc6b7('0x4a')]['id']){delete _0x3873e4[_0xc6b7('0x4a')]['id'];}return db[_0xc6b7('0x2f')]['find']({'where':{'id':_0x3873e4[_0xc6b7('0x46')]['id']}})['then'](handleEntityNotFound(_0x122000,null))[_0xc6b7('0x2a')](saveUpdates(_0x3873e4[_0xc6b7('0x4a')],null))[_0xc6b7('0x2a')](respondWithResult(_0x122000,null))[_0xc6b7('0x45')](handleError(_0x122000,null));};exports['create']=function(_0x441420,_0x1bc6d4,_0x39b86b){return db['sequelize'][_0xc6b7('0x4b')](function(_0x25fed4){if(_0x441420[_0xc6b7('0x4a')][_0xc6b7('0x4c')]==='files'){_0x441420[_0xc6b7('0x4a')][_0xc6b7('0x4d')]=path[_0xc6b7('0x4e')](config[_0xc6b7('0x4f')],'server/files/moh',_0x441420['body']['name']);}return db[_0xc6b7('0x2f')][_0xc6b7('0x50')](_0x441420[_0xc6b7('0x4a')],{'transaction':_0x25fed4})[_0xc6b7('0x2a')](function(_0x5783c3){if(_0x441420['body'][_0xc6b7('0x4c')]==='files'){fs['mkdirSync'](_0x5783c3['directory'],parseInt(_0xc6b7('0x51'),0x8));}var _0x2b850b=_0x441420[_0xc6b7('0x52')][_0xc6b7('0x27')]({'plain':!![]});if(!_0x2b850b)throw new Error(_0xc6b7('0x53'));if(_0x2b850b['role']==='user'){var _0x23aef1=_0x5783c3['get']({'plain':!![]});return db[_0xc6b7('0x54')]['find']({'where':{'name':_0xc6b7('0x28'),'userProfileId':_0x2b850b[_0xc6b7('0x55')]},'raw':!![]})[_0xc6b7('0x2a')](function(_0x2ecbf7){if(_0x2ecbf7&&_0x2ecbf7['autoAssociation']===0x0){return db[_0xc6b7('0x29')][_0xc6b7('0x50')]({'name':_0x23aef1[_0xc6b7('0x2c')],'resourceId':_0x23aef1['id'],'type':_0x2ecbf7[_0xc6b7('0x2c')],'sectionId':_0x2ecbf7['id']},{})[_0xc6b7('0x2a')](function(){return _0x5783c3;});}else{return _0x5783c3;}})[_0xc6b7('0x45')](function(_0x318ef1){logger['error'](_0xc6b7('0x56'),_0x318ef1);});}return _0x5783c3;});})['then'](respondWithResult(_0x1bc6d4,0xc9))[_0xc6b7('0x45')](handleError(_0x1bc6d4,null));};exports['destroy']=function(_0xb83821,_0x1e57c6,_0x4bb87b){var _0x1539c0;return db[_0xc6b7('0x2f')]['find']({'where':{'id':_0xb83821[_0xc6b7('0x46')]['id']}})[_0xc6b7('0x2a')](function(_0x46ad67){if(_0x46ad67){return db[_0xc6b7('0x57')][_0xc6b7('0x4b')](function(_0x1cd422){return _0x46ad67[_0xc6b7('0x26')]({'transaction':_0x1cd422,'raw':!![]})[_0xc6b7('0x2a')](function(_0x4d5a7a){if(_0x4d5a7a[_0xc6b7('0x4d')]){fs['readdirSync'](_0x4d5a7a[_0xc6b7('0x4d')])[_0xc6b7('0x58')](function(_0x25656d){fs[_0xc6b7('0x59')](path['join'](_0x4d5a7a[_0xc6b7('0x4d')],_0x25656d));});fs[_0xc6b7('0x5a')](_0x4d5a7a[_0xc6b7('0x4d')]);}return _0x4d5a7a;});})['catch'](function(_0x1422e5){throw new db['Sequelize'][(_0xc6b7('0x5b'))](_0x1422e5['message']);});}})[_0xc6b7('0x2a')](handleEntityNotFound(_0x1e57c6,null))['then'](removeEntity(_0x1e57c6,null))[_0xc6b7('0x45')](handleError(_0x1e57c6,null));};exports['addSound']=function(_0xa952ed,_0x2a5ba6,_0x376e7b){return db['sequelize'][_0xc6b7('0x4b')](function(_0x1da30c){var _0x8bd3c4;return db[_0xc6b7('0x2f')]['find']({'where':{'id':_0xa952ed['params']['id']}})[_0xc6b7('0x2a')](function(_0x58af72){if(_0x58af72){_0x8bd3c4=_0x58af72;return _0x58af72[_0xc6b7('0x5c')](_0xa952ed['body']['id'],{'transaction':_0x1da30c});}})[_0xc6b7('0x2a')](function(_0x32ff7e){if(_0x32ff7e){return db[_0xc6b7('0x5d')][_0xc6b7('0x5e')]({'where':{'id':_0xa952ed[_0xc6b7('0x4a')]['id']},'attributes':['id','name','save_name',_0xc6b7('0x5f'),_0xc6b7('0x60')],'raw':!![]});}})[_0xc6b7('0x2a')](function(_0x5834a8){if(_0x5834a8){var _0x14bc7e=path['join'](config['root'],'server/files/sounds/converted',util[_0xc6b7('0x61')]('%s.%s',path[_0xc6b7('0x62')](_0x5834a8[_0xc6b7('0x63')],path['extname'](_0x5834a8[_0xc6b7('0x63')])),_0x5834a8['converted_format']));var _0x317feb=path[_0xc6b7('0x4e')](config['root'],_0xc6b7('0x64'),_0x8bd3c4[_0xc6b7('0x2c')],util['format'](_0xc6b7('0x65'),_0x5834a8[_0xc6b7('0x2c')],_0x5834a8[_0xc6b7('0x5f')]));fs[_0xc6b7('0x66')](_0x14bc7e,_0x317feb);return _0x5834a8;}})[_0xc6b7('0x45')](function(_0x133c03){throw new db['Sequelize'][(_0xc6b7('0x5b'))](_0x133c03[_0xc6b7('0x67')]);});})[_0xc6b7('0x2a')](handleEntityNotFound(_0x2a5ba6,null))['then'](respondWithResult(_0x2a5ba6,0xc9))[_0xc6b7('0x45')](handleError(_0x2a5ba6,null));};exports[_0xc6b7('0x68')]=function(_0x1887b2,_0x444cb9,_0x310467){return db[_0xc6b7('0x57')][_0xc6b7('0x4b')](function(_0xc6003d){var _0x5c8c41;return db[_0xc6b7('0x2f')][_0xc6b7('0x5e')]({'where':{'id':_0x1887b2[_0xc6b7('0x46')]['id']}})['then'](handleEntityNotFound(_0x444cb9,null))['then'](function(_0x5e61b8){if(_0x5e61b8){_0x5c8c41=_0x5e61b8;return _0x5e61b8[_0xc6b7('0x68')](_0x1887b2[_0xc6b7('0x46')][_0xc6b7('0x69')]);}})[_0xc6b7('0x2a')](function(_0x14a72d){if(_0x14a72d){return db[_0xc6b7('0x5d')]['findOne']({'where':{'id':_0x1887b2[_0xc6b7('0x46')]['id2']},'attributes':['id',_0xc6b7('0x2c'),'save_name',_0xc6b7('0x5f'),_0xc6b7('0x60')],'raw':!![]});}})[_0xc6b7('0x2a')](function(_0x1ee72c){if(_0x1ee72c){fs[_0xc6b7('0x59')](path['join'](_0x5c8c41[_0xc6b7('0x4d')],util[_0xc6b7('0x61')]('%s.%s',_0x1ee72c[_0xc6b7('0x2c')],_0x1ee72c['converted_format'])));return _0x1ee72c;}})[_0xc6b7('0x45')](function(_0x4f0ffe){throw new db[(_0xc6b7('0x6a'))][(_0xc6b7('0x5b'))](_0x4f0ffe[_0xc6b7('0x67')]);});})['then'](handleEntityNotFound(_0x444cb9,null))['then'](respondWithStatusCode(_0x444cb9,0xcc))['catch'](handleError(_0x444cb9,null));};exports[_0xc6b7('0x6b')]=function(_0x3c3077,_0x322487,_0x3bd6b6){var _0x36452a={};var _0x37d262={};var _0x40ef0b;var _0x30fade;return db[_0xc6b7('0x2f')]['findOne']({'where':{'id':_0x3c3077[_0xc6b7('0x46')]['id']}})[_0xc6b7('0x2a')](handleEntityNotFound(_0x322487,null))[_0xc6b7('0x2a')](function(_0x461f59){if(_0x461f59){_0x40ef0b=_0x461f59;_0x37d262['model']=_[_0xc6b7('0x34')](db['Sound']['rawAttributes']);_0x37d262['query']=_[_0xc6b7('0x34')](_0x3c3077[_0xc6b7('0x35')]);_0x37d262[_0xc6b7('0x3f')]=_[_0xc6b7('0x36')](_0x37d262[_0xc6b7('0x37')],_0x37d262[_0xc6b7('0x35')]);_0x36452a[_0xc6b7('0x38')]=_[_0xc6b7('0x36')](_0x37d262['model'],qs[_0xc6b7('0x39')](_0x3c3077[_0xc6b7('0x35')][_0xc6b7('0x39')]));_0x36452a[_0xc6b7('0x38')]=_0x36452a['attributes']['length']?_0x36452a[_0xc6b7('0x38')]:_0x37d262[_0xc6b7('0x37')];_0x36452a[_0xc6b7('0x3c')]=qs[_0xc6b7('0x3d')](_0x3c3077[_0xc6b7('0x35')][_0xc6b7('0x3d')]);_0x36452a[_0xc6b7('0x3e')]=qs[_0xc6b7('0x3f')](_[_0xc6b7('0x6c')](_0x3c3077[_0xc6b7('0x35')],_0x37d262['filters']));if(_0x3c3077[_0xc6b7('0x35')]['filter']){_0x36452a[_0xc6b7('0x3e')]=_[_0xc6b7('0x41')](_0x36452a[_0xc6b7('0x3e')],{'$or':_['map'](_0x36452a[_0xc6b7('0x38')],function(_0xc16338){var _0x11e0b6={};_0x11e0b6[_0xc16338]={'$like':'%'+_0x3c3077['query'][_0xc6b7('0x40')]+'%'};return _0x11e0b6;})});}_0x36452a=_['merge']({},_0x36452a,_0x3c3077[_0xc6b7('0x6d')]);return _0x40ef0b['getSounds'](_0x36452a);}})['then'](function(_0x36c811){if(_0x36c811){_0x30fade=_0x36c811['length'];if(!_0x3c3077['query'][_0xc6b7('0x3a')](_0xc6b7('0x3b'))){_0x36452a[_0xc6b7('0x20')]=qs[_0xc6b7('0x20')](_0x3c3077[_0xc6b7('0x35')][_0xc6b7('0x20')]);_0x36452a[_0xc6b7('0x1e')]=qs['offset'](_0x3c3077['query'][_0xc6b7('0x1e')]);}return _0x40ef0b['getSounds'](_0x36452a);}})[_0xc6b7('0x2a')](function(_0x130f63){if(_0x130f63){return _0x130f63?{'count':_0x30fade,'rows':_0x130f63}:null;}})[_0xc6b7('0x2a')](respondWithResult(_0x322487,null))[_0xc6b7('0x45')](handleError(_0x322487,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index d9c8e03..c13aa49 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 _0x77fb=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3634d8,_0xbfa70b){var _0x2c1369=function(_0x27b79a){while(--_0x27b79a){_0x3634d8['push'](_0x3634d8['shift']());}};_0x2c1369(++_0xbfa70b);}(_0x77fb,0x93));var _0xb77f=function(_0x502da7,_0x42bcc2){_0x502da7=_0x502da7-0x0;var _0x246e4b=_0x77fb[_0x502da7];return _0x246e4b;};'use strict';var _=require(_0xb77f('0x0'));var util=require(_0xb77f('0x1'));var logger=require('../../config/logger')(_0xb77f('0x2'));var moment=require(_0xb77f('0x3'));var BPromise=require(_0xb77f('0x4'));var rp=require(_0xb77f('0x5'));var fs=require('fs');var path=require(_0xb77f('0x6'));var rimraf=require('rimraf');var config=require(_0xb77f('0x7'));var attributes=require(_0xb77f('0x8'));module[_0xb77f('0x9')]=function(_0x471ba9,_0xbff581){return _0x471ba9[_0xb77f('0xa')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81ba=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x1e70e4,_0xc44ad8){var _0x118f81=function(_0x336a0d){while(--_0x336a0d){_0x1e70e4['push'](_0x1e70e4['shift']());}};_0x118f81(++_0xc44ad8);}(_0x81ba,0xad));var _0xa81b=function(_0x5cc9d3,_0x563405){_0x5cc9d3=_0x5cc9d3-0x0;var _0x49194e=_0x81ba[_0x5cc9d3];return _0x49194e;};'use strict';var _=require(_0xa81b('0x0'));var util=require(_0xa81b('0x1'));var logger=require(_0xa81b('0x2'))('api');var moment=require(_0xa81b('0x3'));var BPromise=require(_0xa81b('0x4'));var rp=require(_0xa81b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa81b('0x6'));var config=require('../../config/environment');var attributes=require(_0xa81b('0x7'));module[_0xa81b('0x8')]=function(_0x2ce893,_0x40f2d4){return _0x2ce893[_0xa81b('0x9')](_0xa81b('0xa'),attributes,{'tableName':_0xa81b('0xb'),'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 04b8bde..8d62d1c 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 _0x17c2=['../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x484e3d,_0x542772){var _0xd40672=function(_0xb49799){while(--_0xb49799){_0x484e3d['push'](_0x484e3d['shift']());}};_0xd40672(++_0x542772);}(_0x17c2,0x12b));var _0x217c=function(_0x1f47b2,_0x32ea9c){_0x1f47b2=_0x1f47b2-0x0;var _0xf37729=_0x17c2[_0x1f47b2];return _0xf37729;};'use strict';var _=require('lodash');var util=require(_0x217c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x217c('0x1'));var fs=require('fs');var Redis=require(_0x217c('0x2'));var db=require(_0x217c('0x3'))['db'];var utils=require(_0x217c('0x4'));var logger=require(_0x217c('0x5'))('rpc');var config=require(_0x217c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x217c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde7f3d,_0x4f7dd8,_0x11324e){return new BPromise(function(_0x597ccd,_0x36fda9){return client[_0x217c('0x8')](_0xde7f3d,_0x11324e)[_0x217c('0x9')](function(_0x578f65){logger[_0x217c('0xa')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4f7dd8,_0x217c('0xb'));logger[_0x217c('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x4f7dd8,_0x217c('0xb'),JSON[_0x217c('0xd')](_0x578f65));if(_0x578f65[_0x217c('0xe')]){if(_0x578f65['error']['code']===0x1f4){logger[_0x217c('0xe')](_0x217c('0xf'),_0x4f7dd8,_0x578f65[_0x217c('0xe')]['message']);return _0x36fda9(_0x578f65[_0x217c('0xe')][_0x217c('0x10')]);}logger[_0x217c('0xe')](_0x217c('0xf'),_0x4f7dd8,_0x578f65['error']['message']);return _0x597ccd(_0x578f65[_0x217c('0xe')][_0x217c('0x10')]);}else{logger['info'](_0x217c('0xf'),_0x4f7dd8,'request\x20sent');_0x597ccd(_0x578f65[_0x217c('0x11')][_0x217c('0x10')]);}})[_0x217c('0x12')](function(_0x3c6360){logger[_0x217c('0xe')](_0x217c('0xf'),_0x4f7dd8,_0x3c6360);_0x36fda9(_0x3c6360);});});} \ No newline at end of file +var _0x64f7=['message','result','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x49e584,_0x2886f8){var _0x58b1be=function(_0x40397c){while(--_0x40397c){_0x49e584['push'](_0x49e584['shift']());}};_0x58b1be(++_0x2886f8);}(_0x64f7,0x145));var _0x764f=function(_0x350791,_0x5f3ea7){_0x350791=_0x350791-0x0;var _0x18adee=_0x64f7[_0x350791];return _0x18adee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x764f('0x0'));var BPromise=require('bluebird');var rs=require(_0x764f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x764f('0x2'))['db'];var utils=require(_0x764f('0x3'));var logger=require(_0x764f('0x4'))(_0x764f('0x5'));var config=require(_0x764f('0x6'));var jayson=require(_0x764f('0x7'));var client=jayson['client'][_0x764f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1cf5fc,_0x311f8d,_0x3021a5){return new BPromise(function(_0x48936d,_0x462c83){return client[_0x764f('0x9')](_0x1cf5fc,_0x3021a5)['then'](function(_0x499d75){logger[_0x764f('0xa')](_0x764f('0xb'),_0x311f8d,_0x764f('0xc'));logger[_0x764f('0xd')](_0x764f('0xe'),_0x311f8d,_0x764f('0xc'),JSON[_0x764f('0xf')](_0x499d75));if(_0x499d75[_0x764f('0x10')]){if(_0x499d75['error']['code']===0x1f4){logger['error'](_0x764f('0xb'),_0x311f8d,_0x499d75[_0x764f('0x10')]['message']);return _0x462c83(_0x499d75[_0x764f('0x10')]['message']);}logger['error'](_0x764f('0xb'),_0x311f8d,_0x499d75['error'][_0x764f('0x11')]);return _0x48936d(_0x499d75[_0x764f('0x10')][_0x764f('0x11')]);}else{logger[_0x764f('0xa')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x311f8d,_0x764f('0xc'));_0x48936d(_0x499d75[_0x764f('0x12')][_0x764f('0x11')]);}})['catch'](function(_0x1ceb19){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x311f8d,_0x1ceb19);_0x462c83(_0x1ceb19);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index cea6bdd..a8e6636 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 _0x7a54=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','isAuthenticated','/:id/users','getAgents','create','post','addAgents','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x184759,_0x1cc38a){var _0xf26d5f=function(_0x1010c8){while(--_0x1010c8){_0x184759['push'](_0x184759['shift']());}};_0xf26d5f(++_0x1cc38a);}(_0x7a54,0x106));var _0x47a5=function(_0x45acf7,_0x3750bf){_0x45acf7=_0x45acf7-0x0;var _0x56c223=_0x7a54[_0x45acf7];return _0x56c223;};'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['post']('/',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0x13'),auth['isAuthenticated'](),controller[_0x47a5('0x14')]);router[_0x47a5('0x15')](_0x47a5('0x13'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x16')]);router[_0x47a5('0x15')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeAgents']);module[_0x47a5('0x17')]=router; \ No newline at end of file +var _0xb091=['put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','describe','/:id','show','/:id/users','getAgents','post','create','addAgents'];(function(_0x1c167f,_0x20858a){var _0x58e94a=function(_0x45f84e){while(--_0x45f84e){_0x1c167f['push'](_0x1c167f['shift']());}};_0x58e94a(++_0x20858a);}(_0xb091,0x16e));var _0x1b09=function(_0x10c559,_0x46e36e){_0x10c559=_0x10c559-0x0;var _0x48ee4c=_0xb091[_0x10c559];return _0x48ee4c;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/describe',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0x9')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0x9')](_0x1b09('0xd'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xe')]);router[_0x1b09('0xf')]('/',auth['isAuthenticated'](),controller[_0x1b09('0x10')]);router[_0x1b09('0xf')]('/:id/users',auth['isAuthenticated'](),controller[_0x1b09('0x11')]);router[_0x1b09('0x12')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0x13')]);router[_0x1b09('0x14')](_0x1b09('0xb'),auth['isAuthenticated'](),controller[_0x1b09('0x15')]);router['delete'](_0x1b09('0xd'),auth[_0x1b09('0x7')](),controller[_0x1b09('0x16')]);module[_0x1b09('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 37cbf80..10bb56c 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 _0x11ec=['sequelize','exports','STRING','VIRTUAL','system-','getDataValue','INTEGER'];(function(_0x365cf4,_0x54cd92){var _0x4f5059=function(_0x45fb87){while(--_0x45fb87){_0x365cf4['push'](_0x365cf4['shift']());}};_0x4f5059(++_0x54cd92);}(_0x11ec,0x126));var _0xc11e=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x11ec[_0x155c64];return _0x1f154a;};'use strict';var Sequelize=require(_0xc11e('0x0'));module[_0xc11e('0x1')]={'name':{'type':Sequelize[_0xc11e('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xc11e('0x3')],'get':function(_0x2a2d60){return _0xc11e('0x4')+this[_0xc11e('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0xc11e('0x2')]},'callerIdAll':{'type':Sequelize[_0xc11e('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xc11e('0x6')]}}; \ No newline at end of file +var _0x0f79=['STRING','name','VIRTUAL','getDataValue','INTEGER','exports'];(function(_0x3f4c47,_0x502304){var _0x40cce5=function(_0x16c9fd){while(--_0x16c9fd){_0x3f4c47['push'](_0x3f4c47['shift']());}};_0x40cce5(++_0x502304);}(_0x0f79,0xd1));var _0x90f7=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x0f79[_0x19dd7a];return _0x3feb6a;};'use strict';var Sequelize=require('sequelize');module[_0x90f7('0x0')]={'name':{'type':Sequelize[_0x90f7('0x1')],'allowNull':![],'unique':_0x90f7('0x2')},'prefix':{'type':Sequelize[_0x90f7('0x3')],'get':function(_0x1ca3c2){return'system-'+this[_0x90f7('0x4')](_0x90f7('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x90f7('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x90f7('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 7c3afc8..0d69882 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 _0xe45a=['count','offset','set','Content-Range','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','describe','create','transaction','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','Set','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','body','system-','sequelize','findById','addAgents','ids','omit','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','nolimit','fast-json-patch','request-promise','path','sox','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','limit','undefined'];(function(_0x19098f,_0x544dc5){var _0x951d0d=function(_0x408b53){while(--_0x408b53){_0x19098f['push'](_0x19098f['shift']());}};_0x951d0d(++_0x544dc5);}(_0xe45a,0x1d1));var _0xae45=function(_0x13acb5,_0xde43e0){_0x13acb5=_0x13acb5-0x0;var _0x1f6cab=_0xe45a[_0x13acb5];return _0x1f6cab;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xae45('0x0'));var rp=require(_0xae45('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xae45('0x2'));var sox=require(_0xae45('0x3'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae45('0x4'));var squel=require(_0xae45('0x5'));var crypto=require('crypto');var jsforce=require(_0xae45('0x6'));var deskjs=require(_0xae45('0x7'));var toCsv=require('to-csv');var querystring=require(_0xae45('0x8'));var Papa=require(_0xae45('0x9'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xae45('0xa'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae45('0xb'));var logger=require(_0xae45('0xc'))(_0xae45('0xd'));var utils=require('../../config/utils');var config=require(_0xae45('0xe'));var licenseUtil=require(_0xae45('0xf'));var db=require('../../mysqldb')['db'];config[_0xae45('0x10')]=_[_0xae45('0x11')](config['redis'],{'host':_0xae45('0x12'),'port':0x18eb});var socket=require(_0xae45('0x13'))(new Redis(config[_0xae45('0x10')]));require(_0xae45('0x14'))[_0xae45('0x15')](socket);function respondWithStatusCode(_0x3509d2,_0x25ab52){_0x25ab52=_0x25ab52||0xcc;return function(_0x43afc4){if(_0x43afc4){return _0x3509d2['sendStatus'](_0x25ab52);}return _0x3509d2[_0xae45('0x16')](_0x25ab52)[_0xae45('0x17')]();};}function respondWithResult(_0x4f529d,_0x16b67a){_0x16b67a=_0x16b67a||0xc8;return function(_0x123102){if(_0x123102){return _0x4f529d[_0xae45('0x16')](_0x16b67a)[_0xae45('0x18')](_0x123102);}};}function respondWithFilteredResult(_0x94ee31,_0x4609a0){return function(_0x3ac755){if(_0x3ac755){var _0x1327e6=typeof _0x4609a0['offset']==='undefined'&&typeof _0x4609a0[_0xae45('0x19')]===_0xae45('0x1a');var _0x19b504=_0x3ac755[_0xae45('0x1b')];var _0x514346=_0x1327e6?0x0:_0x4609a0[_0xae45('0x1c')];var _0x486095=_0x1327e6?_0x3ac755[_0xae45('0x1b')]:_0x4609a0[_0xae45('0x1c')]+_0x4609a0[_0xae45('0x19')];var _0x4d1170;if(_0x486095>=_0x19b504){_0x486095=_0x19b504;_0x4d1170=0xc8;}else{_0x4d1170=0xce;}_0x94ee31[_0xae45('0x16')](_0x4d1170);return _0x94ee31[_0xae45('0x1d')](_0xae45('0x1e'),_0x514346+'-'+_0x486095+'/'+_0x19b504)[_0xae45('0x18')](_0x3ac755);}return null;};}function patchUpdates(_0x1445e7){return function(_0x9a68f7){try{jsonpatch['apply'](_0x9a68f7,_0x1445e7,!![]);}catch(_0x297336){return BPromise[_0xae45('0x1f')](_0x297336);}return _0x9a68f7[_0xae45('0x20')]();};}function saveUpdates(_0x31a1d8,_0x3f7c2f){return function(_0x4dd152){if(_0x4dd152){return _0x4dd152[_0xae45('0x21')](_0x31a1d8)[_0xae45('0x22')](function(_0x157202){return _0x157202;});}return null;};}function removeEntity(_0x34f8cb,_0x6c110f){return function(_0x2e1435){if(_0x2e1435){return _0x2e1435['destroy']()[_0xae45('0x22')](function(){var _0x17fcc3=_0x2e1435[_0xae45('0x23')]({'plain':!![]});var _0x2171a1=_0xae45('0x24');return db[_0xae45('0x25')][_0xae45('0x26')]({'where':{'type':_0x2171a1,'resourceId':_0x17fcc3['id']}})[_0xae45('0x22')](function(){return _0x2e1435;});})[_0xae45('0x22')](function(){_0x34f8cb['status'](0xcc)[_0xae45('0x17')]();});}};}function handleEntityNotFound(_0x311224,_0x100966){return function(_0x3e0e4d){if(!_0x3e0e4d){_0x311224[_0xae45('0x27')](0x194);}return _0x3e0e4d;};}function handleError(_0xf96b76,_0x7dd283){_0x7dd283=_0x7dd283||0x1f4;return function(_0x1353aa){logger[_0xae45('0x28')](_0x1353aa[_0xae45('0x29')]);if(_0x1353aa[_0xae45('0x2a')]){delete _0x1353aa[_0xae45('0x2a')];}_0xf96b76[_0xae45('0x16')](_0x7dd283)[_0xae45('0x2b')](_0x1353aa);};}exports[_0xae45('0x2c')]=function(_0x5dc24f,_0x1e9498){var _0x4b4e62={},_0x629557={},_0x2080f5={'count':0x0,'rows':[]};var _0x3665f4=_[_0xae45('0x2d')](db[_0xae45('0x2e')]['rawAttributes'],function(_0x41ae5c){return{'name':_0x41ae5c[_0xae45('0x2f')],'type':_0x41ae5c[_0xae45('0x30')][_0xae45('0x31')]};});_0x629557[_0xae45('0x32')]=_[_0xae45('0x2d')](_0x3665f4,_0xae45('0x2a'));_0x629557[_0xae45('0x33')]=_[_0xae45('0x34')](_0x5dc24f['query']);_0x629557[_0xae45('0x35')]=_[_0xae45('0x36')](_0x629557[_0xae45('0x32')],_0x629557[_0xae45('0x33')]);_0x4b4e62[_0xae45('0x37')]=_['intersection'](_0x629557['model'],qs[_0xae45('0x38')](_0x5dc24f['query']['fields']));_0x4b4e62[_0xae45('0x37')]=_0x4b4e62[_0xae45('0x37')][_0xae45('0x39')]?_0x4b4e62[_0xae45('0x37')]:_0x629557[_0xae45('0x32')];if(!_0x5dc24f[_0xae45('0x33')]['hasOwnProperty']('nolimit')){_0x4b4e62[_0xae45('0x19')]=qs[_0xae45('0x19')](_0x5dc24f[_0xae45('0x33')][_0xae45('0x19')]);_0x4b4e62[_0xae45('0x1c')]=qs[_0xae45('0x1c')](_0x5dc24f['query'][_0xae45('0x1c')]);}_0x4b4e62[_0xae45('0x3a')]=qs[_0xae45('0x3b')](_0x5dc24f[_0xae45('0x33')][_0xae45('0x3b')]);_0x4b4e62[_0xae45('0x3c')]=qs[_0xae45('0x35')](_[_0xae45('0x3d')](_0x5dc24f[_0xae45('0x33')],_0x629557[_0xae45('0x35')]),_0x3665f4);if(_0x5dc24f[_0xae45('0x33')][_0xae45('0x3e')]){_0x4b4e62['where']=_['merge'](_0x4b4e62[_0xae45('0x3c')],{'$or':_[_0xae45('0x2d')](_0x3665f4,function(_0x2f91ff){if(_0x2f91ff[_0xae45('0x30')]!==_0xae45('0x3f')){var _0x25b653={};_0x25b653[_0x2f91ff['name']]={'$like':'%'+_0x5dc24f[_0xae45('0x33')][_0xae45('0x3e')]+'%'};return _0x25b653;}})});}_0x4b4e62=_[_0xae45('0x40')]({},_0x4b4e62,_0x5dc24f[_0xae45('0x41')]);var _0x11ce19={'where':_0x4b4e62['where']};return db[_0xae45('0x2e')][_0xae45('0x1b')](_0x11ce19)[_0xae45('0x22')](function(_0x33993f){_0x2080f5['count']=_0x33993f;if(_0x5dc24f[_0xae45('0x33')][_0xae45('0x42')]){_0x4b4e62[_0xae45('0x43')]=[{'all':!![]}];}return db['VoicePrefix'][_0xae45('0x44')](_0x4b4e62);})[_0xae45('0x22')](function(_0x3948bb){_0x2080f5[_0xae45('0x45')]=_0x3948bb;return _0x2080f5;})[_0xae45('0x22')](respondWithFilteredResult(_0x1e9498,_0x4b4e62))[_0xae45('0x46')](handleError(_0x1e9498,null));};exports[_0xae45('0x47')]=function(_0x3dd6b0,_0x11762a){var _0x51ba04={'raw':![],'where':{'id':_0x3dd6b0[_0xae45('0x48')]['id']}},_0x1f5aef={};_0x1f5aef[_0xae45('0x32')]=_[_0xae45('0x34')](db[_0xae45('0x2e')][_0xae45('0x49')]);_0x1f5aef['query']=_[_0xae45('0x34')](_0x3dd6b0[_0xae45('0x33')]);_0x1f5aef[_0xae45('0x35')]=_[_0xae45('0x36')](_0x1f5aef[_0xae45('0x32')],_0x1f5aef['query']);_0x51ba04[_0xae45('0x37')]=_[_0xae45('0x36')](_0x1f5aef[_0xae45('0x32')],qs['fields'](_0x3dd6b0[_0xae45('0x33')][_0xae45('0x38')]));_0x51ba04[_0xae45('0x37')]=_0x51ba04[_0xae45('0x37')][_0xae45('0x39')]?_0x51ba04['attributes']:_0x1f5aef[_0xae45('0x32')];if(_0x3dd6b0['query'][_0xae45('0x42')]){_0x51ba04['include']=[{'all':!![]}];}_0x51ba04=_['merge']({},_0x51ba04,_0x3dd6b0[_0xae45('0x41')]);return db[_0xae45('0x2e')][_0xae45('0x4a')](_0x51ba04)[_0xae45('0x22')](handleEntityNotFound(_0x11762a,null))[_0xae45('0x22')](respondWithResult(_0x11762a,null))['catch'](handleError(_0x11762a,null));};exports[_0xae45('0x26')]=function(_0x3e89a7,_0x110dd7){return db[_0xae45('0x2e')]['find']({'where':{'id':_0x3e89a7[_0xae45('0x48')]['id']}})[_0xae45('0x22')](handleEntityNotFound(_0x110dd7,null))[_0xae45('0x22')](removeEntity(_0x110dd7,null))[_0xae45('0x46')](handleError(_0x110dd7,null));};exports['describe']=function(_0x50a6d7,_0x24191f){return db['VoicePrefix'][_0xae45('0x4b')]()[_0xae45('0x22')](respondWithResult(_0x24191f,null))[_0xae45('0x46')](handleError(_0x24191f,null));};exports[_0xae45('0x4c')]=function(_0x2ee4e1,_0x273df9){var _0x4db3df;return db['sequelize'][_0xae45('0x4d')](function(_0x7c394f){return db['VoicePrefix'][_0xae45('0x4c')](_0x2ee4e1['body'],{'transaction':_0x7c394f})[_0xae45('0x22')](function(_0x3a6b37){_0x4db3df=_0x3a6b37['get']({'plain':!![]});return db[_0xae45('0x4e')][_0xae45('0x4a')]({'where':{'id':_0x4db3df[_0xae45('0x4f')]},'raw':!![]})[_0xae45('0x22')](function(_0x6c02a1){return createVoicePrefixExtensions(_0x4db3df,_0x6c02a1,_0x7c394f);});});})[_0xae45('0x22')](function(){var _0x5af93a=_0x2ee4e1[_0xae45('0x50')][_0xae45('0x23')]({'plain':!![]});if(!_0x5af93a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5af93a[_0xae45('0x51')]===_0xae45('0x50')){var _0x2a738d=_0x4db3df;return db[_0xae45('0x52')][_0xae45('0x4a')]({'where':{'name':_0xae45('0x24'),'userProfileId':_0x5af93a[_0xae45('0x53')]},'raw':!![]})['then'](function(_0x2c553a){if(_0x2c553a&&_0x2c553a['autoAssociation']===0x0){return db[_0xae45('0x25')][_0xae45('0x4c')]({'name':_0x2a738d['name'],'resourceId':_0x2a738d['id'],'type':_0x2c553a[_0xae45('0x2a')],'sectionId':_0x2c553a['id']},{})[_0xae45('0x22')](function(){return _0x4db3df;});}else{return _0x4db3df;}})[_0xae45('0x46')](function(_0xb9560d){logger[_0xae45('0x28')](_0xae45('0x54'),_0xb9560d);throw _0xb9560d;});}return _0x4db3df;})[_0xae45('0x22')](respondWithResult(_0x273df9,null))[_0xae45('0x46')](handleError(_0x273df9,null));};function Extension(_0x309aaa,_0x31d228,_0x41f43a,_0x2259f1){this[_0xae45('0x55')]=_0xae45('0x56');this[_0xae45('0x57')]=_0x309aaa;this[_0xae45('0x58')]=_0x41f43a;this['type']=_0xae45('0x59');this[_0xae45('0x5a')]=_0xae45('0x5b');this[_0xae45('0x5c')]=_0x31d228;this['appdata']=_0x2259f1;}function createVoicePrefixExtensions(_0x494b29,_0x4e798b,_0x42b248){return new BPromise(function(_0x576a68,_0x480aeb){var _0x25420f=new Extension(formatPrefixName(_0x494b29['prefix']),0x1,_0xae45('0x5d'),_0xae45('0x5e'));_0x25420f[_0xae45('0x5f')]=_0x494b29['id'];return db[_0xae45('0x4e')][_0xae45('0x4c')](_0x25420f,{'transaction':_0x42b248})[_0xae45('0x22')](function(_0x12a466){var _0x451c4a=_0x12a466[_0xae45('0x23')]({'plain':!![]});var _0x2b1df6=_[_0xae45('0x2d')](addVoicePrefixExtensions(_0x494b29,_0x4e798b),function(_0x4c2524){_0x4c2524[_0xae45('0x4f')]=_0x451c4a['id'];_0x4c2524[_0xae45('0x5f')]=_0x494b29['id'];return _0x4c2524;});return db['VoiceExtension'][_0xae45('0x60')](_0x2b1df6,{'transaction':_0x42b248})[_0xae45('0x22')](function(_0x2f5d40){if(!_0x2f5d40){return _0x480aeb(_0xae45('0x61'));}else{return _0x576a68(_0x2f5d40);}})['catch'](function(_0x26f661){return _0x480aeb(_0x26f661);});});;});};function addVoicePrefixExtensions(_0x5cc770,_0x4860fe){var _0x3d65b4=[];var _0x1e98ae=formatPrefixName(_0x5cc770[_0xae45('0x62')]);_0x3d65b4['push'](new Extension(_0x1e98ae,0x2,_0xae45('0x63'),'CDR(prefix)='+_0x5cc770[_0xae45('0x2a')]));if(_0x5cc770[_0xae45('0x64')]){_0x3d65b4[_0xae45('0x65')](new Extension(_0x1e98ae,0x3,_0xae45('0x63'),_0xae45('0x66')+_0x5cc770[_0xae45('0x64')]));}else{_0x3d65b4[_0xae45('0x65')](new Extension(_0x1e98ae,0x3,_0xae45('0x5d'),_0xae45('0x67')));}_0x3d65b4[_0xae45('0x65')](new Extension(_0x1e98ae,0x4,_0xae45('0x68'),_0x4860fe[_0xae45('0x55')]+','+'${EXTEN:'+(0x8+_0x5cc770[_0xae45('0x2a')][_0xae45('0x39')])+'}'+','+0x1));return _0x3d65b4;}function formatPrefixName(_0xdb499d){var _0x30729e='_';for(var _0x2699f4=0x0;_0x2699f4<_0xdb499d['length'];_0x2699f4++){if(_0xdb499d[_0xae45('0x69')](_0x2699f4)=='-'){_0x30729e+=_0xdb499d[_0xae45('0x69')](_0x2699f4);}else{_0x30729e+='['+_0xdb499d[_0xae45('0x69')](_0x2699f4)+']';}}_0x30729e+='.';return _0x30729e;}exports[_0xae45('0x21')]=function(_0x2a5ba0,_0x49c1e1,_0x3d7191){var _0x3cea9b=_0x2a5ba0[_0xae45('0x6a')];_0x3cea9b[_0xae45('0x62')]=_0xae45('0x6b')+_0x3cea9b[_0xae45('0x2a')]+'-';return db[_0xae45('0x6c')]['transaction'](function(_0x14112b){return db[_0xae45('0x2e')][_0xae45('0x21')](_0x3cea9b,{'where':{'id':_0x3cea9b['id']},'transaction':_0x14112b})[_0xae45('0x22')](function(){return db[_0xae45('0x4e')][_0xae45('0x26')]({'where':{'VoicePrefixId':_0x3cea9b['id']},'transaction':_0x14112b})['then'](function(){return db[_0xae45('0x4e')][_0xae45('0x4a')]({'where':{'id':_0x3cea9b[_0xae45('0x4f')]},'raw':!![]})[_0xae45('0x22')](function(_0x175af5){return createVoicePrefixExtensions(_0x3cea9b,_0x175af5,_0x14112b);});});});})[_0xae45('0x22')](function(){return db[_0xae45('0x2e')][_0xae45('0x6d')](_0x3cea9b['id']);})[_0xae45('0x22')](respondWithResult(_0x49c1e1,null))[_0xae45('0x46')](handleError(_0x49c1e1,null));};exports[_0xae45('0x6e')]=function(_0x304231,_0x1711dc,_0x5591cb){return db[_0xae45('0x2e')][_0xae45('0x4a')]({'where':{'id':_0x304231['params']['id']}})[_0xae45('0x22')](handleEntityNotFound(_0x1711dc,null))[_0xae45('0x22')](function(_0xf3bfe9){if(_0xf3bfe9){return _0xf3bfe9[_0xae45('0x6e')](_0x304231[_0xae45('0x6a')][_0xae45('0x6f')],_[_0xae45('0x70')](_0x304231[_0xae45('0x6a')],[_0xae45('0x6f'),'id'])||{})['spread'](function(_0xb023f2){for(var _0x79e6e=0x0;_0x79e6e<_0x304231[_0xae45('0x6a')][_0xae45('0x6f')][_0xae45('0x39')];_0x79e6e+=0x1){socket['emit'](_0xae45('0x71'),{'UserId':_0x304231[_0xae45('0x6a')][_0xae45('0x6f')][_0x79e6e],'VoicePrefixId':_0x304231['params']['id']});}return _0xb023f2;});}})[_0xae45('0x22')](respondWithResult(_0x1711dc,null))[_0xae45('0x46')](handleError(_0x1711dc,null));};exports[_0xae45('0x72')]=function(_0x49b9ee,_0x5f4b54,_0x2aa77f){return db[_0xae45('0x2e')]['find']({'where':{'id':_0x49b9ee[_0xae45('0x48')]['id']}})[_0xae45('0x22')](handleEntityNotFound(_0x5f4b54,null))[_0xae45('0x22')](function(_0x3a9f0f){if(_0x3a9f0f){return _0x3a9f0f[_0xae45('0x72')](_0x49b9ee[_0xae45('0x33')][_0xae45('0x6f')])[_0xae45('0x22')](function(){if(_[_0xae45('0x73')](_0x49b9ee[_0xae45('0x33')][_0xae45('0x6f')])){for(var _0xc6e446=0x0;_0xc6e446<_0x49b9ee[_0xae45('0x33')]['ids'][_0xae45('0x39')];_0xc6e446+=0x1){socket[_0xae45('0x74')]('userVoicePrefix:remove',{'UserId':Number(_0x49b9ee[_0xae45('0x33')][_0xae45('0x6f')][_0xc6e446]),'VoicePrefixId':Number(_0x49b9ee['params']['id'])});}}else{socket[_0xae45('0x74')](_0xae45('0x75'),{'UserId':Number(_0x49b9ee['query'][_0xae45('0x6f')]),'VoicePrefixId':Number(_0x49b9ee[_0xae45('0x48')]['id'])});}});}})[_0xae45('0x22')](respondWithStatusCode(_0x5f4b54,null))[_0xae45('0x46')](handleError(_0x5f4b54,null));};exports[_0xae45('0x76')]=function(_0x3893b1,_0x37d141,_0x5b6a34){var _0x383a43={};var _0x41a5aa={};var _0x9b4478;var _0x39f3e7;return db[_0xae45('0x2e')][_0xae45('0x77')]({'where':{'id':_0x3893b1['params']['id']}})[_0xae45('0x22')](handleEntityNotFound(_0x37d141,null))['then'](function(_0xe5f018){if(_0xe5f018){_0x9b4478=_0xe5f018;_0x41a5aa[_0xae45('0x32')]=_[_0xae45('0x34')](db[_0xae45('0x78')][_0xae45('0x49')]);_0x41a5aa['query']=_[_0xae45('0x34')](_0x3893b1[_0xae45('0x33')]);_0x41a5aa[_0xae45('0x35')]=_[_0xae45('0x36')](_0x41a5aa['model'],_0x41a5aa['query']);_0x383a43[_0xae45('0x37')]=_[_0xae45('0x36')](_0x41a5aa[_0xae45('0x32')],qs[_0xae45('0x38')](_0x3893b1[_0xae45('0x33')]['fields']));_0x383a43[_0xae45('0x37')]=_0x383a43[_0xae45('0x37')]['length']?_0x383a43['attributes']:_0x41a5aa[_0xae45('0x32')];_0x383a43[_0xae45('0x3a')]=qs[_0xae45('0x3b')](_0x3893b1[_0xae45('0x33')][_0xae45('0x3b')]);_0x383a43[_0xae45('0x3c')]=qs[_0xae45('0x35')](_[_0xae45('0x3d')](_0x3893b1[_0xae45('0x33')],_0x41a5aa['filters']));if(_0x3893b1[_0xae45('0x33')]['filter']){_0x383a43['where']=_[_0xae45('0x40')](_0x383a43[_0xae45('0x3c')],{'$or':_[_0xae45('0x2d')](_0x383a43[_0xae45('0x37')],function(_0x327ea0){var _0x44865e={};_0x44865e[_0x327ea0]={'$like':'%'+_0x3893b1[_0xae45('0x33')][_0xae45('0x3e')]+'%'};return _0x44865e;})});}_0x383a43=_['merge']({},_0x383a43,_0x3893b1[_0xae45('0x41')]);return _0x9b4478[_0xae45('0x76')](_0x383a43);}})[_0xae45('0x22')](function(_0x573739){if(_0x573739){_0x39f3e7=_0x573739[_0xae45('0x39')];if(!_0x3893b1[_0xae45('0x33')][_0xae45('0x79')](_0xae45('0x7a'))){_0x383a43[_0xae45('0x19')]=qs['limit'](_0x3893b1[_0xae45('0x33')]['limit']);_0x383a43[_0xae45('0x1c')]=qs[_0xae45('0x1c')](_0x3893b1[_0xae45('0x33')]['offset']);}return _0x9b4478['getAgents'](_0x383a43);}})['then'](function(_0x2a9542){if(_0x2a9542){return _0x2a9542?{'count':_0x39f3e7,'rows':_0x2a9542}:null;}})[_0xae45('0x22')](respondWithResult(_0x37d141,null))[_0xae45('0x46')](handleError(_0x37d141,null));}; \ No newline at end of file +var _0x9430=['crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./voicePrefix.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','VoicePrefix','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','params','rawAttributes','length','find','describe','sequelize','transaction','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel'];(function(_0x22b003,_0x3d35c0){var _0x2bd09f=function(_0x5cdbee){while(--_0x5cdbee){_0x22b003['push'](_0x22b003['shift']());}};_0x2bd09f(++_0x3d35c0);}(_0x9430,0xe7));var _0x0943=function(_0x3ca582,_0x12383f){_0x3ca582=_0x3ca582-0x0;var _0x21b86d=_0x9430[_0x3ca582];return _0x21b86d;};'use strict';var emlformat=require(_0x0943('0x0'));var rimraf=require(_0x0943('0x1'));var zipdir=require(_0x0943('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0943('0x3'));var moment=require(_0x0943('0x4'));var BPromise=require(_0x0943('0x5'));var Mustache=require(_0x0943('0x6'));var util=require('util');var path=require(_0x0943('0x7'));var sox=require(_0x0943('0x8'));var csv=require(_0x0943('0x9'));var ejs=require(_0x0943('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0943('0xb'));var squel=require(_0x0943('0xc'));var crypto=require(_0x0943('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0943('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0943('0xf'));var Papa=require('papaparse');var Redis=require(_0x0943('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0943('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0943('0x12'));var utils=require(_0x0943('0x13'));var config=require(_0x0943('0x14'));var licenseUtil=require(_0x0943('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0943('0x16')],{'host':_0x0943('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0943('0x16')]));require(_0x0943('0x18'))[_0x0943('0x19')](socket);function respondWithStatusCode(_0x3654c9,_0x4b5e89){_0x4b5e89=_0x4b5e89||0xcc;return function(_0x3df49b){if(_0x3df49b){return _0x3654c9[_0x0943('0x1a')](_0x4b5e89);}return _0x3654c9['status'](_0x4b5e89)[_0x0943('0x1b')]();};}function respondWithResult(_0x3c9580,_0x4b82cf){_0x4b82cf=_0x4b82cf||0xc8;return function(_0x154ddc){if(_0x154ddc){return _0x3c9580[_0x0943('0x1c')](_0x4b82cf)[_0x0943('0x1d')](_0x154ddc);}};}function respondWithFilteredResult(_0x2e30bc,_0xc0012c){return function(_0x23407d){if(_0x23407d){var _0x189c4a=typeof _0xc0012c['offset']===_0x0943('0x1e')&&typeof _0xc0012c[_0x0943('0x1f')]===_0x0943('0x1e');var _0x3e8479=_0x23407d[_0x0943('0x20')];var _0x14d554=_0x189c4a?0x0:_0xc0012c[_0x0943('0x21')];var _0x118ce1=_0x189c4a?_0x23407d[_0x0943('0x20')]:_0xc0012c['offset']+_0xc0012c[_0x0943('0x1f')];var _0x20d32f;if(_0x118ce1>=_0x3e8479){_0x118ce1=_0x3e8479;_0x20d32f=0xc8;}else{_0x20d32f=0xce;}_0x2e30bc[_0x0943('0x1c')](_0x20d32f);return _0x2e30bc[_0x0943('0x22')]('Content-Range',_0x14d554+'-'+_0x118ce1+'/'+_0x3e8479)[_0x0943('0x1d')](_0x23407d);}return null;};}function patchUpdates(_0x5a9bde){return function(_0x2da5d8){try{jsonpatch[_0x0943('0x23')](_0x2da5d8,_0x5a9bde,!![]);}catch(_0x50e93e){return BPromise[_0x0943('0x24')](_0x50e93e);}return _0x2da5d8[_0x0943('0x25')]();};}function saveUpdates(_0x15ad72,_0x5d982c){return function(_0xe72e73){if(_0xe72e73){return _0xe72e73[_0x0943('0x26')](_0x15ad72)[_0x0943('0x27')](function(_0x4d633b){return _0x4d633b;});}return null;};}function removeEntity(_0x353410,_0x4b84f5){return function(_0x13ac07){if(_0x13ac07){return _0x13ac07[_0x0943('0x28')]()['then'](function(){var _0x2471bb=_0x13ac07[_0x0943('0x29')]({'plain':!![]});var _0x51931a='VoicePrefixes';return db['UserProfileResource']['destroy']({'where':{'type':_0x51931a,'resourceId':_0x2471bb['id']}})[_0x0943('0x27')](function(){return _0x13ac07;});})['then'](function(){_0x353410[_0x0943('0x1c')](0xcc)[_0x0943('0x1b')]();});}};}function handleEntityNotFound(_0x558f24,_0x40f5ea){return function(_0x5aa31b){if(!_0x5aa31b){_0x558f24[_0x0943('0x1a')](0x194);}return _0x5aa31b;};}function handleError(_0x18717b,_0x5cdbbb){_0x5cdbbb=_0x5cdbbb||0x1f4;return function(_0x1b1f55){logger[_0x0943('0x2a')](_0x1b1f55[_0x0943('0x2b')]);if(_0x1b1f55[_0x0943('0x2c')]){delete _0x1b1f55[_0x0943('0x2c')];}_0x18717b[_0x0943('0x1c')](_0x5cdbbb)[_0x0943('0x2d')](_0x1b1f55);};}exports[_0x0943('0x2e')]=function(_0x22ee78,_0x7fb0ba){var _0xa1889d={},_0x48f2cd={},_0x2006f8={'count':0x0,'rows':[]};var _0x8b75f=_[_0x0943('0x2f')](db[_0x0943('0x30')]['rawAttributes'],function(_0x1cd56a){return{'name':_0x1cd56a['fieldName'],'type':_0x1cd56a['type']['key']};});_0x48f2cd[_0x0943('0x31')]=_[_0x0943('0x2f')](_0x8b75f,_0x0943('0x2c'));_0x48f2cd[_0x0943('0x32')]=_[_0x0943('0x33')](_0x22ee78[_0x0943('0x32')]);_0x48f2cd[_0x0943('0x34')]=_[_0x0943('0x35')](_0x48f2cd[_0x0943('0x31')],_0x48f2cd[_0x0943('0x32')]);_0xa1889d[_0x0943('0x36')]=_[_0x0943('0x35')](_0x48f2cd[_0x0943('0x31')],qs[_0x0943('0x37')](_0x22ee78[_0x0943('0x32')][_0x0943('0x37')]));_0xa1889d[_0x0943('0x36')]=_0xa1889d[_0x0943('0x36')]['length']?_0xa1889d[_0x0943('0x36')]:_0x48f2cd['model'];if(!_0x22ee78[_0x0943('0x32')][_0x0943('0x38')](_0x0943('0x39'))){_0xa1889d[_0x0943('0x1f')]=qs['limit'](_0x22ee78['query'][_0x0943('0x1f')]);_0xa1889d['offset']=qs['offset'](_0x22ee78[_0x0943('0x32')][_0x0943('0x21')]);}_0xa1889d[_0x0943('0x3a')]=qs[_0x0943('0x3b')](_0x22ee78[_0x0943('0x32')][_0x0943('0x3b')]);_0xa1889d[_0x0943('0x3c')]=qs[_0x0943('0x34')](_[_0x0943('0x3d')](_0x22ee78[_0x0943('0x32')],_0x48f2cd[_0x0943('0x34')]),_0x8b75f);if(_0x22ee78[_0x0943('0x32')][_0x0943('0x3e')]){_0xa1889d[_0x0943('0x3c')]=_['merge'](_0xa1889d[_0x0943('0x3c')],{'$or':_[_0x0943('0x2f')](_0x8b75f,function(_0x4b1aed){if(_0x4b1aed[_0x0943('0x3f')]!==_0x0943('0x40')){var _0x5a0478={};_0x5a0478[_0x4b1aed[_0x0943('0x2c')]]={'$like':'%'+_0x22ee78['query'][_0x0943('0x3e')]+'%'};return _0x5a0478;}})});}_0xa1889d=_[_0x0943('0x41')]({},_0xa1889d,_0x22ee78[_0x0943('0x42')]);var _0x38b62f={'where':_0xa1889d['where']};return db[_0x0943('0x30')][_0x0943('0x20')](_0x38b62f)[_0x0943('0x27')](function(_0xd10771){_0x2006f8[_0x0943('0x20')]=_0xd10771;if(_0x22ee78[_0x0943('0x32')][_0x0943('0x43')]){_0xa1889d[_0x0943('0x44')]=[{'all':!![]}];}return db[_0x0943('0x30')]['findAll'](_0xa1889d);})[_0x0943('0x27')](function(_0x1b8152){_0x2006f8[_0x0943('0x45')]=_0x1b8152;return _0x2006f8;})[_0x0943('0x27')](respondWithFilteredResult(_0x7fb0ba,_0xa1889d))[_0x0943('0x46')](handleError(_0x7fb0ba,null));};exports['show']=function(_0xfd7b39,_0x14b997){var _0x44792a={'raw':![],'where':{'id':_0xfd7b39[_0x0943('0x47')]['id']}},_0x112e01={};_0x112e01[_0x0943('0x31')]=_[_0x0943('0x33')](db['VoicePrefix'][_0x0943('0x48')]);_0x112e01[_0x0943('0x32')]=_[_0x0943('0x33')](_0xfd7b39[_0x0943('0x32')]);_0x112e01[_0x0943('0x34')]=_[_0x0943('0x35')](_0x112e01[_0x0943('0x31')],_0x112e01[_0x0943('0x32')]);_0x44792a['attributes']=_[_0x0943('0x35')](_0x112e01[_0x0943('0x31')],qs[_0x0943('0x37')](_0xfd7b39[_0x0943('0x32')][_0x0943('0x37')]));_0x44792a[_0x0943('0x36')]=_0x44792a['attributes'][_0x0943('0x49')]?_0x44792a['attributes']:_0x112e01[_0x0943('0x31')];if(_0xfd7b39[_0x0943('0x32')][_0x0943('0x43')]){_0x44792a[_0x0943('0x44')]=[{'all':!![]}];}_0x44792a=_[_0x0943('0x41')]({},_0x44792a,_0xfd7b39['options']);return db[_0x0943('0x30')][_0x0943('0x4a')](_0x44792a)[_0x0943('0x27')](handleEntityNotFound(_0x14b997,null))[_0x0943('0x27')](respondWithResult(_0x14b997,null))[_0x0943('0x46')](handleError(_0x14b997,null));};exports['destroy']=function(_0x39890f,_0x34cd53){return db[_0x0943('0x30')]['find']({'where':{'id':_0x39890f['params']['id']}})[_0x0943('0x27')](handleEntityNotFound(_0x34cd53,null))[_0x0943('0x27')](removeEntity(_0x34cd53,null))[_0x0943('0x46')](handleError(_0x34cd53,null));};exports[_0x0943('0x4b')]=function(_0x20f546,_0x268da4){return db['VoicePrefix'][_0x0943('0x4b')]()[_0x0943('0x27')](respondWithResult(_0x268da4,null))['catch'](handleError(_0x268da4,null));};exports['create']=function(_0x520504,_0x792014){var _0x338c04;return db[_0x0943('0x4c')][_0x0943('0x4d')](function(_0x4acc52){return db[_0x0943('0x30')][_0x0943('0x4e')](_0x520504[_0x0943('0x4f')],{'transaction':_0x4acc52})[_0x0943('0x27')](function(_0x49f39e){_0x338c04=_0x49f39e[_0x0943('0x29')]({'plain':!![]});return db[_0x0943('0x50')][_0x0943('0x4a')]({'where':{'id':_0x338c04[_0x0943('0x51')]},'raw':!![]})[_0x0943('0x27')](function(_0xf98340){return createVoicePrefixExtensions(_0x338c04,_0xf98340,_0x4acc52);});});})['then'](function(){var _0x337a71=_0x520504[_0x0943('0x52')]['get']({'plain':!![]});if(!_0x337a71)throw new Error(_0x0943('0x53'));if(_0x337a71[_0x0943('0x54')]===_0x0943('0x52')){var _0x5e568d=_0x338c04;return db['UserProfileSection'][_0x0943('0x4a')]({'where':{'name':'VoicePrefixes','userProfileId':_0x337a71[_0x0943('0x55')]},'raw':!![]})[_0x0943('0x27')](function(_0x1af585){if(_0x1af585&&_0x1af585[_0x0943('0x56')]===0x0){return db[_0x0943('0x57')][_0x0943('0x4e')]({'name':_0x5e568d['name'],'resourceId':_0x5e568d['id'],'type':_0x1af585['name'],'sectionId':_0x1af585['id']},{})['then'](function(){return _0x338c04;});}else{return _0x338c04;}})[_0x0943('0x46')](function(_0x3a4a85){logger['error'](_0x0943('0x58'),_0x3a4a85);throw _0x3a4a85;});}return _0x338c04;})[_0x0943('0x27')](respondWithResult(_0x792014,null))[_0x0943('0x46')](handleError(_0x792014,null));};function Extension(_0x669cab,_0x1dd04e,_0x33ed94,_0x3b87d5){this[_0x0943('0x59')]='from-sip';this[_0x0943('0x5a')]=_0x669cab;this[_0x0943('0x5b')]=_0x33ed94;this[_0x0943('0x3f')]='system';this[_0x0943('0x5c')]=_0x0943('0x5d');this[_0x0943('0x5e')]=_0x1dd04e;this['appdata']=_0x3b87d5;}function createVoicePrefixExtensions(_0x34b06e,_0x21b5be,_0x1a19c2){return new BPromise(function(_0xb0113a,_0x485c1){var _0x114046=new Extension(formatPrefixName(_0x34b06e[_0x0943('0x5f')]),0x1,_0x0943('0x60'),_0x0943('0x61'));_0x114046[_0x0943('0x62')]=_0x34b06e['id'];return db['VoiceExtension'][_0x0943('0x4e')](_0x114046,{'transaction':_0x1a19c2})['then'](function(_0x3b8c96){var _0x4fd1e5=_0x3b8c96[_0x0943('0x29')]({'plain':!![]});var _0x18d469=_[_0x0943('0x2f')](addVoicePrefixExtensions(_0x34b06e,_0x21b5be),function(_0x26014d){_0x26014d[_0x0943('0x51')]=_0x4fd1e5['id'];_0x26014d[_0x0943('0x62')]=_0x34b06e['id'];return _0x26014d;});return db[_0x0943('0x50')][_0x0943('0x63')](_0x18d469,{'transaction':_0x1a19c2})[_0x0943('0x27')](function(_0x3dcc39){if(!_0x3dcc39){return _0x485c1(_0x0943('0x64'));}else{return _0xb0113a(_0x3dcc39);}})[_0x0943('0x46')](function(_0x9969b9){return _0x485c1(_0x9969b9);});});;});};function addVoicePrefixExtensions(_0x2115a7,_0x31cc5e){var _0x40a658=[];var _0x57625b=formatPrefixName(_0x2115a7[_0x0943('0x5f')]);_0x40a658[_0x0943('0x65')](new Extension(_0x57625b,0x2,_0x0943('0x66'),_0x0943('0x67')+_0x2115a7['name']));if(_0x2115a7[_0x0943('0x68')]){_0x40a658[_0x0943('0x65')](new Extension(_0x57625b,0x3,'Set','PREFIX-CALLERIDALL='+_0x2115a7[_0x0943('0x68')]));}else{_0x40a658[_0x0943('0x65')](new Extension(_0x57625b,0x3,_0x0943('0x60'),_0x0943('0x69')));}_0x40a658[_0x0943('0x65')](new Extension(_0x57625b,0x4,_0x0943('0x6a'),_0x31cc5e[_0x0943('0x59')]+','+_0x0943('0x6b')+(0x8+_0x2115a7[_0x0943('0x2c')][_0x0943('0x49')])+'}'+','+0x1));return _0x40a658;}function formatPrefixName(_0x472020){var _0x48897b='_';for(var _0x4619f3=0x0;_0x4619f3<_0x472020[_0x0943('0x49')];_0x4619f3++){if(_0x472020['charAt'](_0x4619f3)=='-'){_0x48897b+=_0x472020[_0x0943('0x6c')](_0x4619f3);}else{_0x48897b+='['+_0x472020[_0x0943('0x6c')](_0x4619f3)+']';}}_0x48897b+='.';return _0x48897b;}exports[_0x0943('0x26')]=function(_0x34f496,_0x390c1d,_0x56adcf){var _0x25d2ed=_0x34f496[_0x0943('0x4f')];_0x25d2ed[_0x0943('0x5f')]=_0x0943('0x6d')+_0x25d2ed[_0x0943('0x2c')]+'-';return db['sequelize'][_0x0943('0x4d')](function(_0x9c1032){return db[_0x0943('0x30')][_0x0943('0x26')](_0x25d2ed,{'where':{'id':_0x25d2ed['id']},'transaction':_0x9c1032})['then'](function(){return db[_0x0943('0x50')][_0x0943('0x28')]({'where':{'VoicePrefixId':_0x25d2ed['id']},'transaction':_0x9c1032})['then'](function(){return db['VoiceExtension'][_0x0943('0x4a')]({'where':{'id':_0x25d2ed['VoiceExtensionId']},'raw':!![]})['then'](function(_0x4a957e){return createVoicePrefixExtensions(_0x25d2ed,_0x4a957e,_0x9c1032);});});});})['then'](function(){return db['VoicePrefix'][_0x0943('0x6e')](_0x25d2ed['id']);})[_0x0943('0x27')](respondWithResult(_0x390c1d,null))[_0x0943('0x46')](handleError(_0x390c1d,null));};exports[_0x0943('0x6f')]=function(_0x187eb2,_0x5b13e7,_0x520edd){return db[_0x0943('0x30')]['find']({'where':{'id':_0x187eb2[_0x0943('0x47')]['id']}})[_0x0943('0x27')](handleEntityNotFound(_0x5b13e7,null))[_0x0943('0x27')](function(_0x4396a7){if(_0x4396a7){return _0x4396a7[_0x0943('0x6f')](_0x187eb2[_0x0943('0x4f')][_0x0943('0x70')],_[_0x0943('0x71')](_0x187eb2[_0x0943('0x4f')],['ids','id'])||{})[_0x0943('0x72')](function(_0x1aae55){for(var _0x377640=0x0;_0x377640<_0x187eb2['body'][_0x0943('0x70')][_0x0943('0x49')];_0x377640+=0x1){socket[_0x0943('0x73')]('userVoicePrefix:save',{'UserId':_0x187eb2[_0x0943('0x4f')][_0x0943('0x70')][_0x377640],'VoicePrefixId':_0x187eb2['params']['id']});}return _0x1aae55;});}})[_0x0943('0x27')](respondWithResult(_0x5b13e7,null))[_0x0943('0x46')](handleError(_0x5b13e7,null));};exports[_0x0943('0x74')]=function(_0x5cd989,_0x4b6144,_0x48298d){return db[_0x0943('0x30')][_0x0943('0x4a')]({'where':{'id':_0x5cd989[_0x0943('0x47')]['id']}})[_0x0943('0x27')](handleEntityNotFound(_0x4b6144,null))[_0x0943('0x27')](function(_0x526a5d){if(_0x526a5d){return _0x526a5d[_0x0943('0x74')](_0x5cd989[_0x0943('0x32')][_0x0943('0x70')])[_0x0943('0x27')](function(){if(_[_0x0943('0x75')](_0x5cd989[_0x0943('0x32')]['ids'])){for(var _0x29ac4b=0x0;_0x29ac4b<_0x5cd989['query'][_0x0943('0x70')]['length'];_0x29ac4b+=0x1){socket[_0x0943('0x73')](_0x0943('0x76'),{'UserId':Number(_0x5cd989['query'][_0x0943('0x70')][_0x29ac4b]),'VoicePrefixId':Number(_0x5cd989[_0x0943('0x47')]['id'])});}}else{socket[_0x0943('0x73')](_0x0943('0x76'),{'UserId':Number(_0x5cd989[_0x0943('0x32')]['ids']),'VoicePrefixId':Number(_0x5cd989[_0x0943('0x47')]['id'])});}});}})[_0x0943('0x27')](respondWithStatusCode(_0x4b6144,null))[_0x0943('0x46')](handleError(_0x4b6144,null));};exports[_0x0943('0x77')]=function(_0x492ff8,_0x78e458,_0x469838){var _0x4a5634={};var _0x53261a={};var _0x59802d;var _0x329d25;return db[_0x0943('0x30')][_0x0943('0x78')]({'where':{'id':_0x492ff8[_0x0943('0x47')]['id']}})[_0x0943('0x27')](handleEntityNotFound(_0x78e458,null))[_0x0943('0x27')](function(_0x511d1b){if(_0x511d1b){_0x59802d=_0x511d1b;_0x53261a['model']=_[_0x0943('0x33')](db[_0x0943('0x79')][_0x0943('0x48')]);_0x53261a['query']=_[_0x0943('0x33')](_0x492ff8[_0x0943('0x32')]);_0x53261a['filters']=_['intersection'](_0x53261a['model'],_0x53261a[_0x0943('0x32')]);_0x4a5634[_0x0943('0x36')]=_['intersection'](_0x53261a[_0x0943('0x31')],qs[_0x0943('0x37')](_0x492ff8[_0x0943('0x32')][_0x0943('0x37')]));_0x4a5634[_0x0943('0x36')]=_0x4a5634['attributes'][_0x0943('0x49')]?_0x4a5634[_0x0943('0x36')]:_0x53261a['model'];_0x4a5634[_0x0943('0x3a')]=qs[_0x0943('0x3b')](_0x492ff8['query'][_0x0943('0x3b')]);_0x4a5634['where']=qs[_0x0943('0x34')](_[_0x0943('0x3d')](_0x492ff8[_0x0943('0x32')],_0x53261a[_0x0943('0x34')]));if(_0x492ff8['query'][_0x0943('0x3e')]){_0x4a5634[_0x0943('0x3c')]=_[_0x0943('0x41')](_0x4a5634[_0x0943('0x3c')],{'$or':_['map'](_0x4a5634[_0x0943('0x36')],function(_0x3865dc){var _0x2bc46f={};_0x2bc46f[_0x3865dc]={'$like':'%'+_0x492ff8['query'][_0x0943('0x3e')]+'%'};return _0x2bc46f;})});}_0x4a5634=_[_0x0943('0x41')]({},_0x4a5634,_0x492ff8[_0x0943('0x42')]);return _0x59802d[_0x0943('0x77')](_0x4a5634);}})['then'](function(_0x41cc29){if(_0x41cc29){_0x329d25=_0x41cc29['length'];if(!_0x492ff8[_0x0943('0x32')][_0x0943('0x38')]('nolimit')){_0x4a5634[_0x0943('0x1f')]=qs[_0x0943('0x1f')](_0x492ff8[_0x0943('0x32')][_0x0943('0x1f')]);_0x4a5634[_0x0943('0x21')]=qs[_0x0943('0x21')](_0x492ff8[_0x0943('0x32')]['offset']);}return _0x59802d[_0x0943('0x77')](_0x4a5634);}})[_0x0943('0x27')](function(_0xee8ba8){if(_0xee8ba8){return _0xee8ba8?{'count':_0x329d25,'rows':_0xee8ba8}:null;}})[_0x0943('0x27')](respondWithResult(_0x78e458,null))[_0x0943('0x46')](handleError(_0x78e458,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 3c75f23..b30f004 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 _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x511c19,_0x101729){var _0x9bb7d8=function(_0xd499d4){while(--_0xd499d4){_0x511c19['push'](_0x511c19['shift']());}};_0x9bb7d8(++_0x101729);}(_0x70e0,0x17b));var _0x070e=function(_0x44e319,_0x4db888){_0x44e319=_0x44e319-0x0;var _0x46a8ca=_0x70e0[_0x44e319];return _0x46a8ca;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x14bd0,_0x8b5d91){var _0x500e90=function(_0x5dad24){while(--_0x5dad24){_0x14bd0['push'](_0x14bd0['shift']());}};_0x500e90(++_0x8b5d91);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('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 31b5784..125e6b0 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 _0x8f7a=['../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x2f6b4e,_0x5b0b2a){var _0x1b7c2b=function(_0x11f9a1){while(--_0x11f9a1){_0x2f6b4e['push'](_0x2f6b4e['shift']());}};_0x1b7c2b(++_0x5b0b2a);}(_0x8f7a,0x165));var _0xa8f7=function(_0x245dd2,_0x37a45d){_0x245dd2=_0x245dd2-0x0;var _0x5d2f32=_0x8f7a[_0x245dd2];return _0x5d2f32;};'use strict';var _=require(_0xa8f7('0x0'));var util=require(_0xa8f7('0x1'));var logger=require(_0xa8f7('0x2'))('api');var moment=require(_0xa8f7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8f7('0x4'));var rimraf=require(_0xa8f7('0x5'));var config=require(_0xa8f7('0x6'));var attributes=require(_0xa8f7('0x7'));module[_0xa8f7('0x8')]=function(_0x15af41,_0xed5edd){return _0x15af41[_0xa8f7('0x9')](_0xa8f7('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4527=['./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x201dc0,_0x361d4f){var _0x58c9af=function(_0x1e3a00){while(--_0x1e3a00){_0x201dc0['push'](_0x201dc0['shift']());}};_0x58c9af(++_0x361d4f);}(_0x4527,0x65));var _0x7452=function(_0x47d0c0,_0x22270b){_0x47d0c0=_0x47d0c0-0x0;var _0x2f4a7d=_0x4527[_0x47d0c0];return _0x2f4a7d;};'use strict';var _=require(_0x7452('0x0'));var util=require('util');var logger=require(_0x7452('0x1'))(_0x7452('0x2'));var moment=require('moment');var BPromise=require(_0x7452('0x3'));var rp=require(_0x7452('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7452('0x5'));var config=require(_0x7452('0x6'));var attributes=require(_0x7452('0x7'));module[_0x7452('0x8')]=function(_0x58f1c9,_0x299adc){return _0x58f1c9[_0x7452('0x9')](_0x7452('0xa'),attributes,{'tableName':_0x7452('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 65b4848..9a74b42 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 _0x0007=['client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x0007,0x1ee));var _0x7000=function(_0x24e19c,_0x1eec14){_0x24e19c=_0x24e19c-0x0;var _0x188fac=_0x0007[_0x24e19c];return _0x188fac;};'use strict';var _=require(_0x7000('0x0'));var util=require(_0x7000('0x1'));var moment=require(_0x7000('0x2'));var BPromise=require('bluebird');var rs=require(_0x7000('0x3'));var fs=require('fs');var Redis=require(_0x7000('0x4'));var db=require(_0x7000('0x5'))['db'];var utils=require(_0x7000('0x6'));var logger=require('../../config/logger')(_0x7000('0x7'));var config=require(_0x7000('0x8'));var jayson=require(_0x7000('0x9'));var client=jayson[_0x7000('0xa')][_0x7000('0xb')]({'port':0x232a});config[_0x7000('0xc')]=_[_0x7000('0xd')](config['redis'],{'host':_0x7000('0xe'),'port':0x18eb});var socket=require(_0x7000('0xf'))(new Redis(config[_0x7000('0xc')]));require(_0x7000('0x10'))[_0x7000('0x11')](socket);function respondWithRpcPromise(_0x42833f,_0x5a45d4,_0x3c82fb){return new BPromise(function(_0x7c030,_0x1aee6a){return client[_0x7000('0x12')](_0x42833f,_0x3c82fb)[_0x7000('0x13')](function(_0x347e20){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x5a45d4,_0x7000('0x14'));logger[_0x7000('0x15')](_0x7000('0x16'),_0x5a45d4,'request\x20sent',JSON[_0x7000('0x17')](_0x347e20));if(_0x347e20[_0x7000('0x18')]){if(_0x347e20['error'][_0x7000('0x19')]===0x1f4){logger[_0x7000('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x5a45d4,_0x347e20[_0x7000('0x18')][_0x7000('0x1a')]);return _0x1aee6a(_0x347e20[_0x7000('0x18')][_0x7000('0x1a')]);}logger['error'](_0x7000('0x1b'),_0x5a45d4,_0x347e20['error']['message']);return _0x7c030(_0x347e20[_0x7000('0x18')][_0x7000('0x1a')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x5a45d4,_0x7000('0x14'));_0x7c030(_0x347e20['result'][_0x7000('0x1a')]);}})['catch'](function(_0x249542){logger[_0x7000('0x18')](_0x7000('0x1b'),_0x5a45d4,_0x249542);_0x1aee6a(_0x249542);});});} \ No newline at end of file +var _0xf4de=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5463b0,_0x260640){var _0x1e225a=function(_0xbec196){while(--_0xbec196){_0x5463b0['push'](_0x5463b0['shift']());}};_0x1e225a(++_0x260640);}(_0xf4de,0xdf));var _0xef4d=function(_0x37d90a,_0x3ef4b3){_0x37d90a=_0x37d90a-0x0;var _0x5e49ee=_0xf4de[_0x37d90a];return _0x5e49ee;};'use strict';var _=require(_0xef4d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xef4d('0x1'));var rs=require(_0xef4d('0x2'));var fs=require('fs');var Redis=require(_0xef4d('0x3'));var db=require(_0xef4d('0x4'))['db'];var utils=require(_0xef4d('0x5'));var logger=require(_0xef4d('0x6'))(_0xef4d('0x7'));var config=require(_0xef4d('0x8'));var jayson=require(_0xef4d('0x9'));var client=jayson[_0xef4d('0xa')][_0xef4d('0xb')]({'port':0x232a});config['redis']=_[_0xef4d('0xc')](config[_0xef4d('0xd')],{'host':_0xef4d('0xe'),'port':0x18eb});var socket=require(_0xef4d('0xf'))(new Redis(config[_0xef4d('0xd')]));require(_0xef4d('0x10'))[_0xef4d('0x11')](socket);function respondWithRpcPromise(_0x26b3b8,_0x1ecd77,_0x8dc7fc){return new BPromise(function(_0x2ca003,_0x31f547){return client[_0xef4d('0x12')](_0x26b3b8,_0x8dc7fc)[_0xef4d('0x13')](function(_0x5b7431){logger[_0xef4d('0x14')](_0xef4d('0x15'),_0x1ecd77,_0xef4d('0x16'));logger['debug'](_0xef4d('0x17'),_0x1ecd77,_0xef4d('0x16'),JSON[_0xef4d('0x18')](_0x5b7431));if(_0x5b7431[_0xef4d('0x19')]){if(_0x5b7431['error'][_0xef4d('0x1a')]===0x1f4){logger[_0xef4d('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x1ecd77,_0x5b7431[_0xef4d('0x19')]['message']);return _0x31f547(_0x5b7431['error'][_0xef4d('0x1b')]);}logger[_0xef4d('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x1ecd77,_0x5b7431['error']['message']);return _0x2ca003(_0x5b7431['error'][_0xef4d('0x1b')]);}else{logger[_0xef4d('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x1ecd77,_0xef4d('0x16'));_0x2ca003(_0x5b7431[_0xef4d('0x1c')][_0xef4d('0x1b')]);}})['catch'](function(_0x4451b6){logger[_0xef4d('0x19')](_0xef4d('0x15'),_0x1ecd77,_0x4451b6);_0x31f547(_0x4451b6);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 6059d27..6923277 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 _0x2ed2=['removeListener','register','length','voicePrefix:','save','update','emit'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x2ed2,0xe4));var _0x22ed=function(_0x23c1c5,_0x1c9c85){_0x23c1c5=_0x23c1c5-0x0;var _0x38fb89=_0x2ed2[_0x23c1c5];return _0x38fb89;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x22ed('0x0'),'remove',_0x22ed('0x1')];function createListener(_0x22ff28,_0x2ddb10){return function(_0xc659d8){_0x2ddb10[_0x22ed('0x2')](_0x22ff28,_0xc659d8);};}function removeListener(_0x1bd2e1,_0x189138){return function(){VoicePrefixEvents[_0x22ed('0x3')](_0x1bd2e1,_0x189138);};}exports[_0x22ed('0x4')]=function(_0x1d57c0){for(var _0x29da01=0x0,_0x2c4b7e=events[_0x22ed('0x5')];_0x29da01<_0x2c4b7e;_0x29da01++){var _0x158c27=events[_0x29da01];var _0x14cee5=createListener(_0x22ed('0x6')+_0x158c27,_0x1d57c0);VoicePrefixEvents['on'](_0x158c27,_0x14cee5);}}; \ No newline at end of file +var _0x8cd6=['removeListener','register','length','voicePrefix:','save','remove','update','emit'];(function(_0x188741,_0x243906){var _0x5e9290=function(_0x90f20a){while(--_0x90f20a){_0x188741['push'](_0x188741['shift']());}};_0x5e9290(++_0x243906);}(_0x8cd6,0x134));var _0x68cd=function(_0x2185f1,_0x540ad2){_0x2185f1=_0x2185f1-0x0;var _0xf85844=_0x8cd6[_0x2185f1];return _0xf85844;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x68cd('0x0'),_0x68cd('0x1'),_0x68cd('0x2')];function createListener(_0x322e89,_0x3d429a){return function(_0x5d6bd7){_0x3d429a[_0x68cd('0x3')](_0x322e89,_0x5d6bd7);};}function removeListener(_0xc874,_0x5b117c){return function(){VoicePrefixEvents[_0x68cd('0x4')](_0xc874,_0x5b117c);};}exports[_0x68cd('0x5')]=function(_0x20ee7c){for(var _0x1e9457=0x0,_0x4d7919=events[_0x68cd('0x6')];_0x1e9457<_0x4d7919;_0x1e9457++){var _0x472e99=events[_0x1e9457];var _0x3b5cb4=createListener(_0x68cd('0x7')+_0x472e99,_0x20ee7c);VoicePrefixEvents['on'](_0x472e99,_0x3b5cb4);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 4ea3dec..e5e1d52 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 _0x7708=['/:id/hopper_black','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getBlackLists','post','/:id/clone','clone','addTeams','/:id/lists','addLists','/:id/blacklists','put','update','destroy','delete','removeTeams','removeAgents','removeLists','removeBlackLists','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0x3c5493,_0x38b32e){var _0x57b82e=function(_0x24de6f){while(--_0x24de6f){_0x3c5493['push'](_0x3c5493['shift']());}};_0x57b82e(++_0x38b32e);}(_0x7708,0x188));var _0x8770=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0x7708[_0x12ddb2];return _0x10b6dd;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./voiceQueue.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['getHopperFinals']);router[_0x8770('0x5')](_0x8770('0xf'),auth[_0x8770('0x8')](),controller['getHopperBlacks']);router[_0x8770('0x5')](_0x8770('0x10'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0x5')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x13')]);router['get'](_0x8770('0x14'),auth[_0x8770('0x8')](),controller['getMembers']);router[_0x8770('0x5')]('/:id/lists',auth[_0x8770('0x8')](),controller['getLists']);router['get']('/:id/blacklists',auth[_0x8770('0x8')](),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/',auth[_0x8770('0x8')](),controller['create']);router['post'](_0x8770('0x17'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);router[_0x8770('0x16')](_0x8770('0x10'),auth['isAuthenticated'](),controller[_0x8770('0x19')]);router[_0x8770('0x16')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller['addAgents']);router['post'](_0x8770('0x1a'),auth[_0x8770('0x8')](),controller[_0x8770('0x1b')]);router[_0x8770('0x16')](_0x8770('0x1c'),auth[_0x8770('0x8')](),controller['addBlackLists']);router[_0x8770('0x1d')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x1e')]);router['delete'](_0x8770('0x7'),auth['isAuthenticated'](),controller[_0x8770('0x1f')]);router[_0x8770('0x20')](_0x8770('0x10'),auth[_0x8770('0x8')](),controller[_0x8770('0x21')]);router[_0x8770('0x20')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x22')]);router[_0x8770('0x20')]('/:id/lists',auth[_0x8770('0x8')](),controller[_0x8770('0x23')]);router[_0x8770('0x20')](_0x8770('0x1c'),auth[_0x8770('0x8')](),controller[_0x8770('0x24')]);module['exports']=router; \ No newline at end of file +var _0x896e=['update','delete','removeAgents','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','getMembers','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addTeams','/:id/lists','addLists','put'];(function(_0x5a6de2,_0x5c8b10){var _0x2c0525=function(_0x59d072){while(--_0x59d072){_0x5a6de2['push'](_0x5a6de2['shift']());}};_0x2c0525(++_0x5c8b10);}(_0x896e,0x1e9));var _0xe896=function(_0x1b1bdb,_0x4f460b){_0x1b1bdb=_0x1b1bdb-0x0;var _0x255769=_0x896e[_0x1b1bdb];return _0x255769;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['get'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x11')]);router['get'](_0xe896('0x12'),auth['isAuthenticated'](),controller[_0xe896('0x13')]);router['get'](_0xe896('0x14'),auth[_0xe896('0xe')](),controller[_0xe896('0x15')]);router['get'](_0xe896('0x16'),auth[_0xe896('0xe')](),controller[_0xe896('0x17')]);router['get'](_0xe896('0x18'),auth[_0xe896('0xe')](),controller[_0xe896('0x19')]);router['get'](_0xe896('0x1a'),auth[_0xe896('0xe')](),controller[_0xe896('0x1b')]);router['get']('/:id/members',auth[_0xe896('0xe')](),controller[_0xe896('0x1c')]);router['get']('/:id/lists',auth[_0xe896('0xe')](),controller[_0xe896('0x1d')]);router['get'](_0xe896('0x1e'),auth['isAuthenticated'](),controller[_0xe896('0x1f')]);router[_0xe896('0x20')]('/',auth[_0xe896('0xe')](),controller['create']);router[_0xe896('0x20')](_0xe896('0x21'),auth[_0xe896('0xe')](),controller[_0xe896('0x22')]);router[_0xe896('0x20')](_0xe896('0x18'),auth[_0xe896('0xe')](),controller[_0xe896('0x23')]);router['post'](_0xe896('0x1a'),auth['isAuthenticated'](),controller['addAgents']);router[_0xe896('0x20')](_0xe896('0x24'),auth[_0xe896('0xe')](),controller[_0xe896('0x25')]);router['post'](_0xe896('0x1e'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0xe896('0x26')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0x27')]);router[_0xe896('0x28')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller['destroy']);router[_0xe896('0x28')](_0xe896('0x18'),auth[_0xe896('0xe')](),controller['removeTeams']);router[_0xe896('0x28')](_0xe896('0x1a'),auth[_0xe896('0xe')](),controller[_0xe896('0x29')]);router[_0xe896('0x28')](_0xe896('0x24'),auth['isAuthenticated'](),controller[_0xe896('0x2a')]);router[_0xe896('0x28')](_0xe896('0x1e'),auth[_0xe896('0xe')](),controller[_0xe896('0x2b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 2834648..44ab4fc 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 _0x9536=['BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Minutes\x20to\x20wait\x20to\x20call\x20next\x20additional\x20phone\x20number\x20','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','outbound','STRING','default','leastrecent','rrmemory','linear','wrandom','ringall','setDataValue','strategy','getDataValue','type','inbound','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','leavewhenempty','acw','wrapuptime'];(function(_0x2e4b17,_0x7749e2){var _0x46ff7b=function(_0x5d57f3){while(--_0x5d57f3){_0x2e4b17['push'](_0x2e4b17['shift']());}};_0x46ff7b(++_0x7749e2);}(_0x9536,0x188));var _0x6953=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x9536[_0x43d16c];return _0x208cce;};'use strict';var Sequelize=require(_0x6953('0x0'));module[_0x6953('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6953('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6953('0x3')]('inbound',_0x6953('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x6953('0x5')],'defaultValue':_0x6953('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x6953('0x7'),'fewestcalls','random',_0x6953('0x8'),_0x6953('0x9'),_0x6953('0xa'),'rrordered'),'allowNull':![],'defaultValue':_0x6953('0xb'),'set':function(_0x22fd75){this[_0x6953('0xc')](_0x6953('0xd'),_0x22fd75?_0x22fd75:_0x6953('0x8'));},'get':function(){var _0x4c6a03=this[_0x6953('0xe')](_0x6953('0xf'));var _0x577063=this['getDataValue']('dialMethod');var _0x513606=this[_0x6953('0xe')]('strategy');if(_0x4c6a03===_0x6953('0x10')){return _0x513606;}if(_0x577063===_0x6953('0x11')&&_0x513606===_0x6953('0x8')||_0x577063===_0x6953('0x11')&&_0x513606===_0x6953('0x12')){return _0x513606;}if(_0x577063===_0x6953('0x13')||_0x577063===_0x6953('0x14')||_0x577063===_0x6953('0x15')){return _0x513606;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x6953('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x6953('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x6953('0x5')]},'weight':{'type':Sequelize[_0x6953('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x6953('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x6953('0x17')},'autopause':{'type':Sequelize[_0x6953('0x3')](_0x6953('0x17'),'no',_0x6953('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x6953('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x6953('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x6953('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x6953('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x6953('0x3')](_0x6953('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x6953('0x3')](_0x6953('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x6953('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x6953('0x3')](_0x6953('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x6953('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x6953('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x6953('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x6953('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x6953('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x6953('0x3')](_0x6953('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x6953('0x3')](_0x6953('0x17'),'no'),'defaultValue':_0x6953('0x17')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x6953('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x6953('0x3')](_0x6953('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x6953('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x6953('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x6953('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x6953('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x6953('0x5')]},'queue_quantity1':{'type':Sequelize[_0x6953('0x5')]},'queue_quantity2':{'type':Sequelize[_0x6953('0x5')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x6953('0x5')]},'periodic_announce':{'type':Sequelize[_0x6953('0x1a')],'set':function(_0x1ad4a5){this[_0x6953('0xc')](_0x6953('0x1b'),_0x1ad4a5?_0x1ad4a5[_0x6953('0x1c')](','):[]);},'get':function(){return this[_0x6953('0xe')](_0x6953('0x1b'))?this['getDataValue'](_0x6953('0x1b'))[_0x6953('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x6953('0x5')],'defaultValue':'yes','set':function(_0xe2812a){this[_0x6953('0xc')]('joinempty',_0xe2812a?_0xe2812a[_0x6953('0x1c')](','):undefined);},'get':function(){return this[_0x6953('0xe')]('joinempty')?this['getDataValue']('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0xf5560c){this['setDataValue'](_0x6953('0x1e'),_0xf5560c?_0xf5560c[_0x6953('0x1c')](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this['getDataValue'](_0x6953('0x1e'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x6953('0x3')](_0x6953('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x6953('0x3')](_0x6953('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x6953('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x6953('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x6953('0x5')]},'description':{'type':Sequelize[_0x6953('0x5')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x1a0e0f){this[_0x6953('0xc')](_0x6953('0x1f'),_0x1a0e0f);if(_0x1a0e0f){if(this[_0x6953('0xe')](_0x6953('0x20'))<0x2){this['setDataValue'](_0x6953('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x6953('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x6953('0x21')],'defaultValue':0x0,'comment':_0x6953('0x22')},'dialMethod':{'type':Sequelize[_0x6953('0x3')](_0x6953('0x23'),'progressive','power',_0x6953('0x14'),_0x6953('0x11')),'defaultValue':'progressive','comment':_0x6953('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6953('0x25')},'dialLimitQueue':{'type':Sequelize[_0x6953('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6953('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x6953('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x6953('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x6953('0x3')](_0x6953('0x29'),_0x6953('0x2a')),'defaultValue':_0x6953('0x2a'),'comment':_0x6953('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x6953('0x2c')](0x2)[_0x6953('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x6953('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x6953('0x16')](0x3)[_0x6953('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x6953('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6953('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x6953('0x16')](0x3)[_0x6953('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6953('0x2f')},'dialQueueOptions':{'type':Sequelize[_0x6953('0x5')],'defaultValue':_0x6953('0x30'),'comment':_0x6953('0x31')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x6953('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x6953('0x5')],'comment':_0x6953('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6953('0x16')](0x3)[_0x6953('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6953('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6953('0x16')](0x5)[_0x6953('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6953('0x34')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6953('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x6953('0x16')](0x5)[_0x6953('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6953('0x16')](0x3)[_0x6953('0x27')],'defaultValue':0x3,'comment':_0x6953('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6953('0x16')](0x5)[_0x6953('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6953('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6953('0x16')](0x3)[_0x6953('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6953('0x5')],'defaultValue':_0x6953('0x37')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x6953('0x38'),_0x6953('0x39'),_0x6953('0x3a')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x6953('0x3b')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6953('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x6953('0x16')](0x9)[_0x6953('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6953('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6953('0x16')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6953('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6953('0x16')](0x9)[_0x6953('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6953('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0x6953('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6953('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6953('0x16')](0x9)[_0x6953('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6953('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6953('0x16')](0x9)[_0x6953('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6953('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6953('0x16')](0x5)[_0x6953('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6953('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6953('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0x6953('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x6953('0x44')},'dialRecallInQueue':{'type':Sequelize[_0x6953('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x6953('0x45')),'defaultValue':_0x6953('0x46')},'dialQueueProject2':{'type':Sequelize[_0x6953('0x5')],'comment':_0x6953('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x6953('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6953('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6953('0x47')},'dialCutDigit':{'type':Sequelize[_0x6953('0x16')](0x3)[_0x6953('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6953('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6953('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6953('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6953('0x16')](0x5)[_0x6953('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6953('0x4a')},'dialDropMaxRetry':{'type':Sequelize[_0x6953('0x16')](0x3)[_0x6953('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6953('0x4b')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6953('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6953('0x16')](0x3)[_0x6953('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6953('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x6953('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6953('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6953('0x16')](0x5)[_0x6953('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6953('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6953('0x16')](0x3)[_0x6953('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6953('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6953('0x16')](0x5)[_0x6953('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x6953('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x3,'comment':_0x6953('0x50')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6953('0x16')],'allowNull':!![],'comment':_0x6953('0x51')},'mandatoryDisposition':{'type':Sequelize[_0x6953('0x21')],'defaultValue':![],'comment':_0x6953('0x52'),'set':function(_0x35b132){if(!_0x35b132)this[_0x6953('0xc')](_0x6953('0x53'),null);this[_0x6953('0xc')](_0x6953('0x54'),_0x35b132);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x6953('0x16')](0x3)[_0x6953('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x6953('0x16')](0x3)[_0x6953('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xb88c=['tTxX','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Minutes\x20to\x20wait\x20to\x20call\x20next\x20additional\x20phone\x20number\x20','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','STRING','name','ENUM','inbound','leastrecent','random','rrmemory','linear','wrandom','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','INTEGER','yes','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x248682,_0x5af82e){var _0x51acb8=function(_0x139c2f){while(--_0x139c2f){_0x248682['push'](_0x248682['shift']());}};_0x51acb8(++_0x5af82e);}(_0xb88c,0x147));var _0xcb88=function(_0x2a3306,_0x27fd5b){_0x2a3306=_0x2a3306-0x0;var _0x3c3859=_0xb88c[_0x2a3306];return _0x3c3859;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcb88('0x0')],'allowNull':![],'unique':_0xcb88('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xcb88('0x2')]('inbound','outbound'),'allowNull':![],'defaultValue':_0xcb88('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0xcb88('0x0')],'defaultValue':''},'strategy':{'type':Sequelize[_0xcb88('0x2')]('rr','ringall',_0xcb88('0x4'),'fewestcalls',_0xcb88('0x5'),_0xcb88('0x6'),_0xcb88('0x7'),_0xcb88('0x8'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x28029d){this[_0xcb88('0x9')](_0xcb88('0xa'),_0x28029d?_0x28029d:_0xcb88('0x6'));},'get':function(){var _0x2bc1d0=this[_0xcb88('0xb')](_0xcb88('0xc'));var _0x1306e8=this[_0xcb88('0xb')](_0xcb88('0xd'));var _0x5be4bb=this['getDataValue']('strategy');if(_0x2bc1d0===_0xcb88('0x3')){return _0x5be4bb;}if(_0x1306e8==='booked'&&_0x5be4bb===_0xcb88('0x6')||_0x1306e8===_0xcb88('0xe')&&_0x5be4bb===_0xcb88('0xf')){return _0x5be4bb;}if(_0x1306e8===_0xcb88('0x10')||_0x1306e8===_0xcb88('0x11')||_0x1306e8==='power'){return _0x5be4bb;}return null;}},'servicelevel':{'type':Sequelize[_0xcb88('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xcb88('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xcb88('0x2')](_0xcb88('0x13'),'no'),'defaultValue':_0xcb88('0x13')},'autopause':{'type':Sequelize[_0xcb88('0x2')]('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xcb88('0x12')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xcb88('0x2')](_0xcb88('0x13'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xcb88('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xcb88('0x2')](_0xcb88('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xcb88('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xcb88('0x2')](_0xcb88('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xcb88('0x2')](_0xcb88('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xcb88('0x0')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xcb88('0x0')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xcb88('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xcb88('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xcb88('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xcb88('0x2')](_0xcb88('0x13'),'no'),'defaultValue':_0xcb88('0x13')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xcb88('0x13'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xcb88('0x0')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xcb88('0x2')](_0xcb88('0x13'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xcb88('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xcb88('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xcb88('0x0')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xcb88('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xcb88('0x0')]},'queue_quantity1':{'type':Sequelize[_0xcb88('0x0')]},'queue_quantity2':{'type':Sequelize[_0xcb88('0x0')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xcb88('0x0')]},'periodic_announce':{'type':Sequelize[_0xcb88('0x14')],'set':function(_0x1537fb){this[_0xcb88('0x9')](_0xcb88('0x15'),_0x1537fb?_0x1537fb[_0xcb88('0x16')](','):[]);},'get':function(){return this[_0xcb88('0xb')](_0xcb88('0x15'))?this[_0xcb88('0xb')]('periodic_announce')[_0xcb88('0x17')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xcb88('0x13'),'set':function(_0x1f5866){this[_0xcb88('0x9')]('joinempty',_0x1f5866?_0x1f5866[_0xcb88('0x16')](','):undefined);},'get':function(){return this[_0xcb88('0xb')](_0xcb88('0x18'))?this['getDataValue']('joinempty')[_0xcb88('0x17')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xcb88('0x0')],'defaultValue':'no','set':function(_0x477c76){this['setDataValue']('leavewhenempty',_0x477c76?_0x477c76[_0xcb88('0x16')](','):undefined);},'get':function(){return this[_0xcb88('0xb')]('leavewhenempty')?this[_0xcb88('0xb')](_0xcb88('0x19'))[_0xcb88('0x17')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xcb88('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xcb88('0x2')](_0xcb88('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xcb88('0x2')](_0xcb88('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xcb88('0x0')]},'description':{'type':Sequelize[_0xcb88('0x0')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x2f50e7){this['setDataValue'](_0xcb88('0x1a'),_0x2f50e7);if(_0x2f50e7){if(this[_0xcb88('0xb')](_0xcb88('0x1b'))<0x2){this[_0xcb88('0x9')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xcb88('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xcb88('0x1c')],'defaultValue':0x0,'comment':_0xcb88('0x1d')},'dialMethod':{'type':Sequelize[_0xcb88('0x2')](_0xcb88('0x1e'),_0xcb88('0x10'),_0xcb88('0x1f'),_0xcb88('0x11'),'booked'),'defaultValue':_0xcb88('0x10'),'comment':_0xcb88('0x20')},'dialLimitChannel':{'type':Sequelize[_0xcb88('0x12')](0x4)[_0xcb88('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xcb88('0x22')},'dialLimitQueue':{'type':Sequelize[_0xcb88('0x12')](0x4)[_0xcb88('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xcb88('0x23')},'dialPowerLevel':{'type':Sequelize[_0xcb88('0x24')](0x2)[_0xcb88('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xcb88('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0xcb88('0x2')](_0xcb88('0x26'),_0xcb88('0x27')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xcb88('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0xcb88('0x12')](0x3)[_0xcb88('0x21')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xcb88('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0xcb88('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcb88('0x2a')},'dialQueueOptions':{'type':Sequelize[_0xcb88('0x0')],'defaultValue':_0xcb88('0x2b'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xcb88('0x12')](0x3)[_0xcb88('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xcb88('0x0')],'comment':_0xcb88('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcb88('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xcb88('0x12')](0x5)[_0xcb88('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcb88('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcb88('0x2d')},'dialBusyRetryFrequency':{'type':Sequelize[_0xcb88('0x12')](0x5)[_0xcb88('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcb88('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xcb88('0x12')](0x3)[_0xcb88('0x21')],'defaultValue':0x3,'comment':_0xcb88('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xcb88('0x12')](0x5)[_0xcb88('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcb88('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0xcb88('0x12')](0x3)[_0xcb88('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xcb88('0x31')},'dialTimezone':{'type':Sequelize[_0xcb88('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xcb88('0x0')],'defaultValue':_0xcb88('0x32')},'dialPrefix':{'type':Sequelize[_0xcb88('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xcb88('0x2')](_0xcb88('0x33'),_0xcb88('0x34'),_0xcb88('0x35')),'defaultValue':_0xcb88('0x33')},'dialAMDActive':{'type':Sequelize[_0xcb88('0x1c')],'defaultValue':0x0,'comment':_0xcb88('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0xcb88('0x12')](0x9)[_0xcb88('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xcb88('0x37')},'dialAMDGreeting':{'type':Sequelize[_0xcb88('0x12')](0x9)[_0xcb88('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xcb88('0x12')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xcb88('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xcb88('0x12')](0x9)[_0xcb88('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xcb88('0x12')](0x9)[_0xcb88('0x21')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xcb88('0x39')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xcb88('0x12')](0x9)[_0xcb88('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xcb88('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xcb88('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xcb88('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xcb88('0x12')](0x9)[_0xcb88('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xcb88('0x12')](0x5)[_0xcb88('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xcb88('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0xcb88('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xcb88('0x3d'),_0xcb88('0x3e')),'defaultValue':_0xcb88('0x3d')},'dialQueueProject2':{'type':Sequelize[_0xcb88('0x0')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xcb88('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xcb88('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xcb88('0x12')](0x3)[_0xcb88('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xcb88('0x3f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcb88('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcb88('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xcb88('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcb88('0x41')},'dialDropMaxRetry':{'type':Sequelize[_0xcb88('0x12')](0x3)[_0xcb88('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcb88('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0xcb88('0x12')](0x5)[_0xcb88('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xcb88('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcb88('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xcb88('0x12')](0x5)[_0xcb88('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcb88('0x44')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcb88('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xcb88('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcb88('0x45')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xcb88('0x12')](0x3)[_0xcb88('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xcb88('0x12')](0x5)[_0xcb88('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcb88('0x46')},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x5)[_0xcb88('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x3,'comment':_0xcb88('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xcb88('0x48')},'mandatoryDisposition':{'type':Sequelize[_0xcb88('0x1c')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1a28b9){if(!_0x1a28b9)this[_0xcb88('0x9')]('mandatoryDispositionPauseId',null);this[_0xcb88('0x9')](_0xcb88('0x49'),_0x1a28b9);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xcb88('0x12')](0x3)[_0xcb88('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xcb88('0x12')](0x3)[_0xcb88('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 384efd3..cdf69f7 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 _0xf011=['path','sox','fs-extra','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','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','find','name','end','error','stack','send','index','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','VoiceQueue','count','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','get','role','VoiceQueues','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','flatMap','Agents','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','interface','emit','userVoiceQueue:save','tq.TeamId','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','compact','removeTeams','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','SIP/%s','isArray','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','phone','CmListId','ListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','NOW()','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.ContactId\x20=\x20ci.CmContactId','h.VoiceQueueId=?','h.createdAt\x20=\x20?','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x1972ee,_0x4709d6){var _0x56117f=function(_0x390da7){while(--_0x390da7){_0x1972ee['push'](_0x1972ee['shift']());}};_0x56117f(++_0x4709d6);}(_0xf011,0x181));var _0x1f01=function(_0x59cd4a,_0x5ede29){_0x59cd4a=_0x59cd4a-0x0;var _0x4489a6=_0xf011[_0x59cd4a];return _0x4489a6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1f01('0x0'));var rp=require('request-promise');var moment=require(_0x1f01('0x1'));var BPromise=require(_0x1f01('0x2'));var Mustache=require(_0x1f01('0x3'));var util=require(_0x1f01('0x4'));var path=require(_0x1f01('0x5'));var sox=require(_0x1f01('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f01('0x7'));var _=require(_0x1f01('0x8'));var squel=require(_0x1f01('0x9'));var crypto=require('crypto');var jsforce=require(_0x1f01('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1f01('0xb'));var querystring=require(_0x1f01('0xc'));var Papa=require('papaparse');var Redis=require(_0x1f01('0xd'));var authService=require(_0x1f01('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1f01('0xf'));var hardwareService=require(_0x1f01('0x10'));var logger=require(_0x1f01('0x11'))('api');var utils=require(_0x1f01('0x12'));var config=require(_0x1f01('0x13'));var licenseUtil=require(_0x1f01('0x14'));var db=require(_0x1f01('0x15'))['db'];config['redis']=_['defaults'](config[_0x1f01('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f01('0x17'))(new Redis(config[_0x1f01('0x16')]));require(_0x1f01('0x18'))['register'](socket);function respondWithStatusCode(_0x540967,_0x2a3ecd){_0x2a3ecd=_0x2a3ecd||0xcc;return function(_0x26efdc){if(_0x26efdc){return _0x540967[_0x1f01('0x19')](_0x2a3ecd);}return _0x540967[_0x1f01('0x1a')](_0x2a3ecd)['end']();};}function respondWithResult(_0x3396f7,_0x52e82){_0x52e82=_0x52e82||0xc8;return function(_0x432609){if(_0x432609){return _0x3396f7['status'](_0x52e82)[_0x1f01('0x1b')](_0x432609);}};}function respondWithFilteredResult(_0x2d8e85,_0x14e6ed){return function(_0x4face6){if(_0x4face6){var _0x3a38b7=typeof _0x14e6ed[_0x1f01('0x1c')]===_0x1f01('0x1d')&&typeof _0x14e6ed[_0x1f01('0x1e')]==='undefined';var _0x50be06=_0x4face6['count'];var _0x5b7ff9=_0x3a38b7?0x0:_0x14e6ed[_0x1f01('0x1c')];var _0x244c7e=_0x3a38b7?_0x4face6['count']:_0x14e6ed[_0x1f01('0x1c')]+_0x14e6ed[_0x1f01('0x1e')];var _0x133567;if(_0x244c7e>=_0x50be06){_0x244c7e=_0x50be06;_0x133567=0xc8;}else{_0x133567=0xce;}_0x2d8e85[_0x1f01('0x1a')](_0x133567);return _0x2d8e85[_0x1f01('0x1f')](_0x1f01('0x20'),_0x5b7ff9+'-'+_0x244c7e+'/'+_0x50be06)[_0x1f01('0x1b')](_0x4face6);}return null;};}function patchUpdates(_0x43d187){return function(_0x445776){try{jsonpatch[_0x1f01('0x21')](_0x445776,_0x43d187,!![]);}catch(_0x1b8ae8){return BPromise[_0x1f01('0x22')](_0x1b8ae8);}return _0x445776[_0x1f01('0x23')]();};}function saveUpdates(_0x158af6,_0x396277){return function(_0x5bf046){if(_0x5bf046){return _0x5bf046[_0x1f01('0x24')](_0x158af6)[_0x1f01('0x25')](function(_0x1c204e){return _0x1c204e;});}return null;};}function removeEntity(_0xb4557f,_0x35465a){return function(_0x10c741){if(_0x10c741){return _0x10c741[_0x1f01('0x26')]()[_0x1f01('0x25')](function(){var _0x554d7b=_0x10c741['get']({'plain':!![]});var _0x48f464=[{'name':'VoiceQueues','value':_0x1f01('0x27'),'ignore':![]},{'name':_0x1f01('0x28'),'value':_0x1f01('0x29'),'ignore':![]}];var _0x556cfb=_(_0x48f464)[_0x1f01('0x2a')](_0x1f01('0x2b'))['map'](_0x1f01('0x2c'))[_0x1f01('0x2c')]();if(_[_0x1f01('0x2d')](_0x556cfb,_0x554d7b[_0x1f01('0x2e')])){return;}var _0x2df090=_[_0x1f01('0x2f')](_0x48f464,[_0x1f01('0x2c'),_0x554d7b[_0x1f01('0x2e')]])[_0x1f01('0x30')];return db['UserProfileResource'][_0x1f01('0x26')]({'where':{'type':_0x2df090,'resourceId':_0x554d7b['id']}})['then'](function(){return _0x10c741;});})[_0x1f01('0x25')](function(){_0xb4557f[_0x1f01('0x1a')](0xcc)[_0x1f01('0x31')]();});}};}function handleEntityNotFound(_0x18b9de,_0x26ddc2){return function(_0x6d8b20){if(!_0x6d8b20){_0x18b9de['sendStatus'](0x194);}return _0x6d8b20;};}function handleError(_0x5b951b,_0x175a53){_0x175a53=_0x175a53||0x1f4;return function(_0x4bc289){logger[_0x1f01('0x32')](_0x4bc289[_0x1f01('0x33')]);if(_0x4bc289[_0x1f01('0x30')]){delete _0x4bc289[_0x1f01('0x30')];}_0x5b951b['status'](_0x175a53)[_0x1f01('0x34')](_0x4bc289);};}exports[_0x1f01('0x35')]=function(_0x209c96,_0x2a088c){var _0x54e8fa={},_0x41f5b8={},_0x18766b={'count':0x0,'rows':[]};var _0x247f04=_['map'](db['VoiceQueue'][_0x1f01('0x36')],function(_0x4cde20){return{'name':_0x4cde20[_0x1f01('0x37')],'type':_0x4cde20[_0x1f01('0x2e')][_0x1f01('0x38')]};});_0x41f5b8[_0x1f01('0x39')]=_[_0x1f01('0x3a')](_0x247f04,_0x1f01('0x30'));_0x41f5b8[_0x1f01('0x3b')]=_[_0x1f01('0x3c')](_0x209c96[_0x1f01('0x3b')]);_0x41f5b8['filters']=_[_0x1f01('0x3d')](_0x41f5b8['model'],_0x41f5b8[_0x1f01('0x3b')]);_0x54e8fa[_0x1f01('0x3e')]=_[_0x1f01('0x3d')](_0x41f5b8['model'],qs[_0x1f01('0x3f')](_0x209c96['query']['fields']));_0x54e8fa[_0x1f01('0x3e')]=_0x54e8fa[_0x1f01('0x3e')]['length']?_0x54e8fa[_0x1f01('0x3e')]:_0x41f5b8[_0x1f01('0x39')];if(!_0x209c96[_0x1f01('0x3b')][_0x1f01('0x40')](_0x1f01('0x41'))){_0x54e8fa[_0x1f01('0x1e')]=qs['limit'](_0x209c96[_0x1f01('0x3b')][_0x1f01('0x1e')]);_0x54e8fa[_0x1f01('0x1c')]=qs[_0x1f01('0x1c')](_0x209c96[_0x1f01('0x3b')][_0x1f01('0x1c')]);}_0x54e8fa[_0x1f01('0x42')]=qs[_0x1f01('0x43')](_0x209c96[_0x1f01('0x3b')][_0x1f01('0x43')]);_0x54e8fa[_0x1f01('0x44')]=qs['filters'](_[_0x1f01('0x45')](_0x209c96[_0x1f01('0x3b')],_0x41f5b8[_0x1f01('0x46')]),_0x247f04);if(_0x209c96['query'][_0x1f01('0x2a')]){_0x54e8fa['where']=_[_0x1f01('0x47')](_0x54e8fa['where'],{'$or':_[_0x1f01('0x3a')](_0x247f04,function(_0x491dbf){if(_0x491dbf[_0x1f01('0x2e')]!==_0x1f01('0x48')){var _0x510bc3={};_0x510bc3[_0x491dbf['name']]={'$like':'%'+_0x209c96[_0x1f01('0x3b')][_0x1f01('0x2a')]+'%'};return _0x510bc3;}})});}_0x54e8fa=_[_0x1f01('0x47')]({},_0x54e8fa,_0x209c96[_0x1f01('0x49')]);var _0x1f3762={'where':_0x54e8fa[_0x1f01('0x44')]};return db[_0x1f01('0x4a')][_0x1f01('0x4b')](_0x1f3762)[_0x1f01('0x25')](function(_0x219e07){_0x18766b[_0x1f01('0x4b')]=_0x219e07;if(_0x209c96['query'][_0x1f01('0x4c')]){_0x54e8fa[_0x1f01('0x4d')]=[{'all':!![]}];}return db[_0x1f01('0x4a')][_0x1f01('0x4e')](_0x54e8fa);})[_0x1f01('0x25')](function(_0x5e5a30){_0x18766b[_0x1f01('0x4f')]=_0x5e5a30;return _0x18766b;})[_0x1f01('0x25')](respondWithFilteredResult(_0x2a088c,_0x54e8fa))[_0x1f01('0x50')](handleError(_0x2a088c,null));};exports[_0x1f01('0x51')]=function(_0x5950d6,_0x2a25d4){var _0x45c770={'raw':![],'where':{'id':_0x5950d6[_0x1f01('0x52')]['id']}},_0x55abf8={};_0x55abf8[_0x1f01('0x39')]=_['keys'](db[_0x1f01('0x4a')]['rawAttributes']);_0x55abf8['query']=_[_0x1f01('0x3c')](_0x5950d6[_0x1f01('0x3b')]);_0x55abf8['filters']=_[_0x1f01('0x3d')](_0x55abf8[_0x1f01('0x39')],_0x55abf8[_0x1f01('0x3b')]);_0x45c770[_0x1f01('0x3e')]=_[_0x1f01('0x3d')](_0x55abf8['model'],qs[_0x1f01('0x3f')](_0x5950d6[_0x1f01('0x3b')][_0x1f01('0x3f')]));_0x45c770[_0x1f01('0x3e')]=_0x45c770['attributes'][_0x1f01('0x53')]?_0x45c770[_0x1f01('0x3e')]:_0x55abf8['model'];if(_0x5950d6[_0x1f01('0x3b')][_0x1f01('0x4c')]){_0x45c770[_0x1f01('0x4d')]=[{'all':!![]}];}_0x45c770=_[_0x1f01('0x47')]({},_0x45c770,_0x5950d6['options']);return db[_0x1f01('0x4a')][_0x1f01('0x2f')](_0x45c770)[_0x1f01('0x25')](handleEntityNotFound(_0x2a25d4,null))['then'](respondWithResult(_0x2a25d4,null))[_0x1f01('0x50')](handleError(_0x2a25d4,null));};exports['create']=function(_0x32b3a0,_0x23232c){return db[_0x1f01('0x4a')][_0x1f01('0x54')](_0x32b3a0[_0x1f01('0x55')],{})[_0x1f01('0x25')](function(_0x8bcede){var _0x46dafb=_0x32b3a0[_0x1f01('0x56')][_0x1f01('0x57')]({'plain':!![]});if(!_0x46dafb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46dafb[_0x1f01('0x58')]===_0x1f01('0x56')){var _0x48eeb8=_0x8bcede[_0x1f01('0x57')]({'plain':!![]});var _0x128fd9=[{'name':_0x1f01('0x59'),'value':'inbound'},{'name':_0x1f01('0x28'),'value':_0x1f01('0x29')}];var _0x5267cf=_['find'](_0x128fd9,[_0x1f01('0x2c'),_0x48eeb8[_0x1f01('0x2e')]])[_0x1f01('0x30')];return db[_0x1f01('0x5a')][_0x1f01('0x2f')]({'where':{'name':_0x5267cf,'userProfileId':_0x46dafb[_0x1f01('0x5b')]},'raw':!![]})[_0x1f01('0x25')](function(_0x5c753d){if(_0x5c753d&&_0x5c753d['autoAssociation']===0x0){return db[_0x1f01('0x5c')]['create']({'name':_0x48eeb8['name'],'resourceId':_0x48eeb8['id'],'type':_0x5c753d[_0x1f01('0x30')],'sectionId':_0x5c753d['id']},{})[_0x1f01('0x25')](function(){return _0x8bcede;});}else{return _0x8bcede;}})[_0x1f01('0x50')](function(_0x12eb71){logger[_0x1f01('0x32')](_0x1f01('0x5d'),_0x12eb71);throw _0x12eb71;});}return _0x8bcede;})[_0x1f01('0x25')](respondWithResult(_0x23232c,0xc9))[_0x1f01('0x50')](handleError(_0x23232c,null));};exports[_0x1f01('0x5e')]=function(_0x32cdb7,_0x2fda0c){var _0x1b3280={'where':{'id':_0x32cdb7[_0x1f01('0x52')]['id']}},_0x4c76a4={};_0x4c76a4[_0x1f01('0x39')]=_[_0x1f01('0x3c')](db[_0x1f01('0x4a')]['rawAttributes']);_0x1b3280['attributes']=_[_0x1f01('0x3d')](_0x4c76a4[_0x1f01('0x39')],qs[_0x1f01('0x3f')](_0x32cdb7[_0x1f01('0x3b')][_0x1f01('0x3f')]));_0x1b3280[_0x1f01('0x3e')]=_0x1b3280[_0x1f01('0x3e')][_0x1f01('0x53')]?_0x1b3280[_0x1f01('0x3e')]:_0x4c76a4['model'];if(_0x32cdb7[_0x1f01('0x3b')][_0x1f01('0x4c')]){_0x1b3280[_0x1f01('0x4d')]=[{'all':!![]}];}_0x1b3280=_[_0x1f01('0x47')]({},_0x1b3280,_0x32cdb7[_0x1f01('0x49')]);return db[_0x1f01('0x4a')]['find'](_0x1b3280)[_0x1f01('0x25')](handleEntityNotFound(_0x2fda0c,null))[_0x1f01('0x25')](function(_0x17545b){if(_0x17545b){var _0x213a27=_0x17545b[_0x1f01('0x57')]({'plain':!![]});_0x213a27=qs[_0x1f01('0x5f')](_0x213a27,['id',_0x1f01('0x60'),'updatedAt']);_0x32cdb7['body']=_[_0x1f01('0x5f')](_0x32cdb7[_0x1f01('0x55')],['id',_0x1f01('0x60'),_0x1f01('0x61')]);return db[_0x1f01('0x4a')][_0x1f01('0x54')](_[_0x1f01('0x47')](_0x213a27,_0x32cdb7[_0x1f01('0x55')]),{'include':_0x32cdb7[_0x1f01('0x3b')][_0x1f01('0x4c')]?[{'all':!![]}]:undefined})[_0x1f01('0x25')](function(_0x4b1950){var _0x31ca20=_0x32cdb7[_0x1f01('0x56')][_0x1f01('0x57')]({'plain':!![]});if(!_0x31ca20)throw new Error(_0x1f01('0x62'));if(_0x31ca20[_0x1f01('0x58')]==='user'){var _0x152dac=_0x4b1950[_0x1f01('0x57')]({'plain':!![]});var _0x4aae6f=[{'name':_0x1f01('0x59'),'value':_0x1f01('0x27')},{'name':_0x1f01('0x28'),'value':_0x1f01('0x29')}];var _0x5ca138=_['find'](_0x4aae6f,['value',_0x152dac['type']])[_0x1f01('0x30')];return db['UserProfileSection'][_0x1f01('0x2f')]({'where':{'name':_0x5ca138,'userProfileId':_0x31ca20['userProfileId']},'raw':!![]})[_0x1f01('0x25')](function(_0x1ecef2){if(_0x1ecef2&&_0x1ecef2[_0x1f01('0x63')]===0x0){return db[_0x1f01('0x5c')][_0x1f01('0x54')]({'name':_0x152dac['name'],'resourceId':_0x152dac['id'],'type':_0x1ecef2['name'],'sectionId':_0x1ecef2['id']},{})[_0x1f01('0x25')](function(){return _0x4b1950;});}else{return _0x4b1950;}})['catch'](function(_0x37fd03){logger[_0x1f01('0x32')](_0x1f01('0x5d'),_0x37fd03);throw _0x37fd03;});}return _0x4b1950;});}})[_0x1f01('0x25')](respondWithResult(_0x2fda0c,0xc9))['catch'](handleError(_0x2fda0c,null));};exports['update']=function(_0x556bf0,_0x2fef2f){if(_0x556bf0['body']['id']){delete _0x556bf0[_0x1f01('0x55')]['id'];}return db[_0x1f01('0x4a')]['find']({'where':{'id':_0x556bf0[_0x1f01('0x52')]['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x2fef2f,null))[_0x1f01('0x25')](saveUpdates(_0x556bf0[_0x1f01('0x55')],null))['then'](respondWithResult(_0x2fef2f,null))[_0x1f01('0x50')](handleError(_0x2fef2f,null));};exports[_0x1f01('0x26')]=function(_0x3f6748,_0x39ccc0){return db[_0x1f01('0x4a')][_0x1f01('0x2f')]({'where':{'id':_0x3f6748[_0x1f01('0x52')]['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x39ccc0,null))['then'](removeEntity(_0x39ccc0,null))['catch'](handleError(_0x39ccc0,null));};exports['getHoppers']=function(_0x47b4fe,_0x126eb2,_0x162c51){var _0x42a53b={'raw':![],'where':{}};var _0x308cdd={};var _0x4a3b90={'count':0x0,'rows':[]};return db[_0x1f01('0x4a')][_0x1f01('0x64')]({'where':{'id':_0x47b4fe['params']['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x126eb2,null))[_0x1f01('0x25')](function(_0x1d41c9){if(_0x1d41c9){_0x308cdd[_0x1f01('0x39')]=_['keys'](db[_0x1f01('0x65')]['rawAttributes']);_0x308cdd[_0x1f01('0x3b')]=_['keys'](_0x47b4fe[_0x1f01('0x3b')]);_0x308cdd['filters']=_[_0x1f01('0x3d')](_0x308cdd[_0x1f01('0x39')],_0x308cdd[_0x1f01('0x3b')]);_0x42a53b['attributes']=_[_0x1f01('0x3d')](_0x308cdd['model'],qs[_0x1f01('0x3f')](_0x47b4fe['query'][_0x1f01('0x3f')]));_0x42a53b['attributes']=_0x42a53b[_0x1f01('0x3e')][_0x1f01('0x53')]?_0x42a53b[_0x1f01('0x3e')]:_0x308cdd[_0x1f01('0x39')];if(!_0x47b4fe[_0x1f01('0x3b')][_0x1f01('0x40')](_0x1f01('0x41'))){_0x42a53b[_0x1f01('0x1e')]=qs[_0x1f01('0x1e')](_0x47b4fe['query'][_0x1f01('0x1e')]);_0x42a53b[_0x1f01('0x1c')]=qs[_0x1f01('0x1c')](_0x47b4fe['query'][_0x1f01('0x1c')]);}_0x42a53b[_0x1f01('0x42')]=qs[_0x1f01('0x43')](_0x47b4fe['query']['sort']);_0x42a53b[_0x1f01('0x44')]=qs[_0x1f01('0x46')](_[_0x1f01('0x45')](_0x47b4fe[_0x1f01('0x3b')],_0x308cdd['filters']));_0x42a53b[_0x1f01('0x44')][_0x1f01('0x66')]=_0x1d41c9['id'];if(_0x47b4fe['query'][_0x1f01('0x2a')]){_0x42a53b['where']=_[_0x1f01('0x47')](_0x42a53b[_0x1f01('0x44')],{'$or':_[_0x1f01('0x3a')](_0x42a53b[_0x1f01('0x3e')],function(_0x2687a7){var _0x4dde41={};_0x4dde41[_0x2687a7]={'$like':'%'+_0x47b4fe[_0x1f01('0x3b')][_0x1f01('0x2a')]+'%'};return _0x4dde41;})});}_0x42a53b=_[_0x1f01('0x47')]({},_0x42a53b,_0x47b4fe[_0x1f01('0x49')]);return db[_0x1f01('0x65')][_0x1f01('0x4b')]({'where':_0x42a53b[_0x1f01('0x44')]})[_0x1f01('0x25')](function(_0x45860b){_0x4a3b90[_0x1f01('0x4b')]=_0x45860b;if(_0x47b4fe[_0x1f01('0x3b')]['includeAll']){_0x42a53b[_0x1f01('0x4d')]=[{'all':!![]}];}return db[_0x1f01('0x65')]['findAll'](_0x42a53b);})[_0x1f01('0x25')](function(_0x5b95a5){_0x4a3b90[_0x1f01('0x4f')]=_0x5b95a5;return _0x4a3b90;});}})[_0x1f01('0x25')](respondWithFilteredResult(_0x126eb2,_0x42a53b))[_0x1f01('0x50')](handleError(_0x126eb2,null));};exports[_0x1f01('0x67')]=function(_0x329164,_0x3fe9f1,_0x902086){var _0x20eb6e={'raw':!![],'where':{}};var _0x5c8c08={};var _0x3d224c={'count':0x0,'rows':[]};return db[_0x1f01('0x4a')][_0x1f01('0x64')]({'where':{'id':_0x329164[_0x1f01('0x52')]['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x3fe9f1,null))[_0x1f01('0x25')](function(_0xd524b6){if(_0xd524b6){_0x5c8c08[_0x1f01('0x39')]=_['keys'](db[_0x1f01('0x68')][_0x1f01('0x36')]);_0x5c8c08[_0x1f01('0x3b')]=_[_0x1f01('0x3c')](_0x329164[_0x1f01('0x3b')]);_0x5c8c08[_0x1f01('0x46')]=_[_0x1f01('0x3d')](_0x5c8c08[_0x1f01('0x39')],_0x5c8c08[_0x1f01('0x3b')]);_0x20eb6e[_0x1f01('0x3e')]=_['intersection'](_0x5c8c08[_0x1f01('0x39')],qs['fields'](_0x329164[_0x1f01('0x3b')]['fields']));_0x20eb6e[_0x1f01('0x3e')]=_0x20eb6e[_0x1f01('0x3e')][_0x1f01('0x53')]?_0x20eb6e['attributes']:_0x5c8c08[_0x1f01('0x39')];if(!_0x329164['query'][_0x1f01('0x40')]('nolimit')){_0x20eb6e[_0x1f01('0x1e')]=qs[_0x1f01('0x1e')](_0x329164[_0x1f01('0x3b')][_0x1f01('0x1e')]);_0x20eb6e[_0x1f01('0x1c')]=qs['offset'](_0x329164[_0x1f01('0x3b')]['offset']);}_0x20eb6e[_0x1f01('0x42')]=qs['sort'](_0x329164[_0x1f01('0x3b')][_0x1f01('0x43')]);_0x20eb6e[_0x1f01('0x44')]=qs[_0x1f01('0x46')](_[_0x1f01('0x45')](_0x329164[_0x1f01('0x3b')],_0x5c8c08[_0x1f01('0x46')]));_0x20eb6e['where'][_0x1f01('0x66')]=_0xd524b6['id'];if(_0x329164[_0x1f01('0x3b')][_0x1f01('0x2a')]){_0x20eb6e['where']=_[_0x1f01('0x47')](_0x20eb6e[_0x1f01('0x44')],{'$or':_['map'](_0x20eb6e['attributes'],function(_0x2e3024){var _0x54b891={};_0x54b891[_0x2e3024]={'$like':'%'+_0x329164['query']['filter']+'%'};return _0x54b891;})});}_0x20eb6e=_[_0x1f01('0x47')]({},_0x20eb6e,_0x329164[_0x1f01('0x49')]);return db['CmHopperHistory']['count']({'where':_0x20eb6e['where']})['then'](function(_0x27c0ea){_0x3d224c[_0x1f01('0x4b')]=_0x27c0ea;if(_0x329164[_0x1f01('0x3b')]['includeAll']){_0x20eb6e[_0x1f01('0x4d')]=[{'all':!![]}];}return db[_0x1f01('0x68')][_0x1f01('0x4e')](_0x20eb6e);})[_0x1f01('0x25')](function(_0x31c4e2){_0x3d224c[_0x1f01('0x4f')]=_0x31c4e2;return _0x3d224c;});}})[_0x1f01('0x25')](respondWithFilteredResult(_0x3fe9f1,_0x20eb6e))[_0x1f01('0x50')](handleError(_0x3fe9f1,null));};exports[_0x1f01('0x69')]=function(_0x3dd9e3,_0x4f686e,_0x1ccece){var _0x36a2fd={'raw':!![],'where':{}};var _0x3385b3={};var _0x51c8a9={'count':0x0,'rows':[]};return db[_0x1f01('0x4a')][_0x1f01('0x64')]({'where':{'id':_0x3dd9e3[_0x1f01('0x52')]['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x4f686e,null))[_0x1f01('0x25')](function(_0x3196f1){if(_0x3196f1){_0x3385b3[_0x1f01('0x39')]=_[_0x1f01('0x3c')](db[_0x1f01('0x6a')][_0x1f01('0x36')]);_0x3385b3[_0x1f01('0x3b')]=_[_0x1f01('0x3c')](_0x3dd9e3[_0x1f01('0x3b')]);_0x3385b3[_0x1f01('0x46')]=_[_0x1f01('0x3d')](_0x3385b3['model'],_0x3385b3['query']);_0x36a2fd[_0x1f01('0x3e')]=_['intersection'](_0x3385b3['model'],qs[_0x1f01('0x3f')](_0x3dd9e3[_0x1f01('0x3b')][_0x1f01('0x3f')]));_0x36a2fd['attributes']=_0x36a2fd[_0x1f01('0x3e')][_0x1f01('0x53')]?_0x36a2fd[_0x1f01('0x3e')]:_0x3385b3['model'];if(!_0x3dd9e3[_0x1f01('0x3b')][_0x1f01('0x40')]('nolimit')){_0x36a2fd[_0x1f01('0x1e')]=qs['limit'](_0x3dd9e3[_0x1f01('0x3b')][_0x1f01('0x1e')]);_0x36a2fd['offset']=qs[_0x1f01('0x1c')](_0x3dd9e3[_0x1f01('0x3b')][_0x1f01('0x1c')]);}_0x36a2fd[_0x1f01('0x42')]=qs[_0x1f01('0x43')](_0x3dd9e3[_0x1f01('0x3b')][_0x1f01('0x43')]);_0x36a2fd[_0x1f01('0x44')]=qs[_0x1f01('0x46')](_[_0x1f01('0x45')](_0x3dd9e3[_0x1f01('0x3b')],_0x3385b3[_0x1f01('0x46')]));_0x36a2fd[_0x1f01('0x44')][_0x1f01('0x66')]=_0x3196f1['id'];if(_0x3dd9e3[_0x1f01('0x3b')][_0x1f01('0x2a')]){_0x36a2fd[_0x1f01('0x44')]=_['merge'](_0x36a2fd['where'],{'$or':_['map'](_0x36a2fd[_0x1f01('0x3e')],function(_0x170c82){var _0x5a2087={};_0x5a2087[_0x170c82]={'$like':'%'+_0x3dd9e3[_0x1f01('0x3b')]['filter']+'%'};return _0x5a2087;})});}_0x36a2fd=_[_0x1f01('0x47')]({},_0x36a2fd,_0x3dd9e3[_0x1f01('0x49')]);return db[_0x1f01('0x6a')]['count']({'where':_0x36a2fd[_0x1f01('0x44')]})[_0x1f01('0x25')](function(_0x540d39){_0x51c8a9[_0x1f01('0x4b')]=_0x540d39;if(_0x3dd9e3['query'][_0x1f01('0x4c')]){_0x36a2fd[_0x1f01('0x4d')]=[{'all':!![]}];}return db[_0x1f01('0x6a')][_0x1f01('0x4e')](_0x36a2fd);})[_0x1f01('0x25')](function(_0xa4ffb){_0x51c8a9[_0x1f01('0x4f')]=_0xa4ffb;return _0x51c8a9;});}})[_0x1f01('0x25')](respondWithFilteredResult(_0x4f686e,_0x36a2fd))[_0x1f01('0x50')](handleError(_0x4f686e,null));};exports[_0x1f01('0x6b')]=function(_0x2ee5e1,_0x53352c,_0x7b8402){var _0x8e575f={'raw':!![],'where':{}};var _0x3b0c9a={};var _0x1e7ed7={'count':0x0,'rows':[]};return db[_0x1f01('0x4a')]['findOne']({'where':{'id':_0x2ee5e1[_0x1f01('0x52')]['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x53352c,null))[_0x1f01('0x25')](function(_0xc1249b){if(_0xc1249b){_0x3b0c9a[_0x1f01('0x39')]=_[_0x1f01('0x3c')](db['CmHopperBlack'][_0x1f01('0x36')]);_0x3b0c9a[_0x1f01('0x3b')]=_[_0x1f01('0x3c')](_0x2ee5e1[_0x1f01('0x3b')]);_0x3b0c9a[_0x1f01('0x46')]=_[_0x1f01('0x3d')](_0x3b0c9a[_0x1f01('0x39')],_0x3b0c9a['query']);_0x8e575f[_0x1f01('0x3e')]=_[_0x1f01('0x3d')](_0x3b0c9a[_0x1f01('0x39')],qs['fields'](_0x2ee5e1[_0x1f01('0x3b')][_0x1f01('0x3f')]));_0x8e575f['attributes']=_0x8e575f[_0x1f01('0x3e')]['length']?_0x8e575f['attributes']:_0x3b0c9a[_0x1f01('0x39')];if(!_0x2ee5e1[_0x1f01('0x3b')][_0x1f01('0x40')]('nolimit')){_0x8e575f[_0x1f01('0x1e')]=qs[_0x1f01('0x1e')](_0x2ee5e1[_0x1f01('0x3b')][_0x1f01('0x1e')]);_0x8e575f[_0x1f01('0x1c')]=qs['offset'](_0x2ee5e1[_0x1f01('0x3b')][_0x1f01('0x1c')]);}_0x8e575f[_0x1f01('0x42')]=qs[_0x1f01('0x43')](_0x2ee5e1[_0x1f01('0x3b')][_0x1f01('0x43')]);_0x8e575f[_0x1f01('0x44')]=qs['filters'](_[_0x1f01('0x45')](_0x2ee5e1[_0x1f01('0x3b')],_0x3b0c9a['filters']));_0x8e575f[_0x1f01('0x44')][_0x1f01('0x66')]=_0xc1249b['id'];if(_0x2ee5e1[_0x1f01('0x3b')]['filter']){_0x8e575f[_0x1f01('0x44')]=_[_0x1f01('0x47')](_0x8e575f['where'],{'$or':_[_0x1f01('0x3a')](_0x8e575f['attributes'],function(_0x12723e){var _0x2fc30e={};_0x2fc30e[_0x12723e]={'$like':'%'+_0x2ee5e1[_0x1f01('0x3b')][_0x1f01('0x2a')]+'%'};return _0x2fc30e;})});}_0x8e575f=_[_0x1f01('0x47')]({},_0x8e575f,_0x2ee5e1[_0x1f01('0x49')]);return db[_0x1f01('0x6c')][_0x1f01('0x4b')]({'where':_0x8e575f[_0x1f01('0x44')]})[_0x1f01('0x25')](function(_0x2053b8){_0x1e7ed7[_0x1f01('0x4b')]=_0x2053b8;if(_0x2ee5e1[_0x1f01('0x3b')]['includeAll']){_0x8e575f[_0x1f01('0x4d')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x1f01('0x4e')](_0x8e575f);})['then'](function(_0x3a4818){_0x1e7ed7[_0x1f01('0x4f')]=_0x3a4818;return _0x1e7ed7;});}})['then'](respondWithFilteredResult(_0x53352c,_0x8e575f))['catch'](handleError(_0x53352c,null));};exports[_0x1f01('0x6d')]=function(_0x5ee1fa,_0x47bc4,_0x5dc468){var _0x558291={};var _0xa52247={};var _0x221ece;var _0x4bd56c;return db[_0x1f01('0x4a')][_0x1f01('0x64')]({'where':{'id':_0x5ee1fa['params']['id']}})['then'](handleEntityNotFound(_0x47bc4,null))[_0x1f01('0x25')](function(_0x4f68c3){if(_0x4f68c3){_0x221ece=_0x4f68c3;_0xa52247[_0x1f01('0x39')]=_[_0x1f01('0x3c')](db[_0x1f01('0x6e')]['rawAttributes']);_0xa52247[_0x1f01('0x3b')]=_[_0x1f01('0x3c')](_0x5ee1fa[_0x1f01('0x3b')]);_0xa52247['filters']=_[_0x1f01('0x3d')](_0xa52247['model'],_0xa52247[_0x1f01('0x3b')]);_0x558291[_0x1f01('0x3e')]=_[_0x1f01('0x3d')](_0xa52247['model'],qs['fields'](_0x5ee1fa['query'][_0x1f01('0x3f')]));_0x558291[_0x1f01('0x3e')]=_0x558291[_0x1f01('0x3e')][_0x1f01('0x53')]?_0x558291[_0x1f01('0x3e')]:_0xa52247[_0x1f01('0x39')];_0x558291['order']=qs[_0x1f01('0x43')](_0x5ee1fa[_0x1f01('0x3b')][_0x1f01('0x43')]);_0x558291[_0x1f01('0x44')]=qs[_0x1f01('0x46')](_[_0x1f01('0x45')](_0x5ee1fa[_0x1f01('0x3b')],_0xa52247[_0x1f01('0x46')]));if(_0x5ee1fa[_0x1f01('0x3b')][_0x1f01('0x2a')]){_0x558291[_0x1f01('0x44')]=_['merge'](_0x558291[_0x1f01('0x44')],{'$or':_[_0x1f01('0x3a')](_0x558291[_0x1f01('0x3e')],function(_0x336cb6){var _0x2c0b2e={};_0x2c0b2e[_0x336cb6]={'$like':'%'+_0x5ee1fa[_0x1f01('0x3b')]['filter']+'%'};return _0x2c0b2e;})});}_0x558291=_['merge']({},_0x558291,_0x5ee1fa[_0x1f01('0x49')]);return _0x221ece[_0x1f01('0x6d')](_0x558291);}})['then'](function(_0x511734){if(_0x511734){_0x4bd56c=_0x511734[_0x1f01('0x53')];if(!_0x5ee1fa[_0x1f01('0x3b')][_0x1f01('0x40')](_0x1f01('0x41'))){_0x558291[_0x1f01('0x1e')]=qs['limit'](_0x5ee1fa['query']['limit']);_0x558291[_0x1f01('0x1c')]=qs[_0x1f01('0x1c')](_0x5ee1fa[_0x1f01('0x3b')][_0x1f01('0x1c')]);}return _0x221ece[_0x1f01('0x6d')](_0x558291);}})[_0x1f01('0x25')](function(_0x24e277){if(_0x24e277){return _0x24e277?{'count':_0x4bd56c,'rows':_0x24e277}:null;}})['then'](respondWithResult(_0x47bc4,null))[_0x1f01('0x50')](handleError(_0x47bc4,null));};exports[_0x1f01('0x6f')]=function(_0x2faa24,_0x16b88a,_0xd6515d){var _0xe19218=_0x2faa24[_0x1f01('0x55')][_0x1f01('0x70')];var _0x201291=_[_0x1f01('0x3a')](_0xe19218,'id');return db[_0x1f01('0x6e')][_0x1f01('0x4e')]({'where':{'id':_0x201291},'attributes':['id'],'include':[{'model':db[_0x1f01('0x71')],'as':'Agents','attributes':['id',_0x1f01('0x30'),_0x1f01('0x72'),_0x1f01('0x73'),'interface'],'raw':!![]}]})['then'](function(_0x29e6db){if(_0x29e6db){var _0x47b869=_[_0x1f01('0x74')](_0x29e6db,function(_0xf3bd14){var _0x445847=_0xf3bd14[_0x1f01('0x57')]({'plain':!![]});_0x445847[_0x1f01('0x75')][_0x1f01('0x76')](function(_0x1ac06c){_0x1ac06c[_0x1f01('0x77')]=_[_0x1f01('0x2f')](_0xe19218,{'id':_0x445847['id']})[_0x1f01('0x77')];});return _0x445847[_0x1f01('0x75')];});return db[_0x1f01('0x4a')]['find']({'where':{'id':_0x2faa24['params']['id']}})[_0x1f01('0x25')](function(_0x2869d8){return db[_0x1f01('0x78')][_0x1f01('0x79')](function(_0x53d5cf){return _0x2869d8['addTeams'](_0x201291,{'transaction':_0x53d5cf})[_0x1f01('0x25')](function(){return BPromise[_0x1f01('0x7a')](_0xe19218,function(_0x5789b6){return db[_0x1f01('0x7b')][_0x1f01('0x7c')]({'TeamId':_0x5789b6['id'],'VoiceQueueId':_0x2faa24[_0x1f01('0x52')]['id'],'penalty':_0x5789b6[_0x1f01('0x77')]},{'transaction':_0x53d5cf});});})[_0x1f01('0x25')](function(){return BPromise[_0x1f01('0x7a')](_0x47b869,function(_0x43cff1){return db['UserVoiceQueue'][_0x1f01('0x7d')]({'where':{'UserId':_0x43cff1['id'],'VoiceQueueId':_0x2faa24[_0x1f01('0x52')]['id']},'defaults':{'penalty':_0x43cff1['penalty']},'transaction':_0x53d5cf});});})[_0x1f01('0x25')](function(){return BPromise['each'](_[_0x1f01('0x2a')](_0x47b869,{'online':!![]}),function(_0x12f24f){return db[_0x1f01('0x7e')][_0x1f01('0x7c')]({'membername':_0x12f24f['name'],'UserId':_0x12f24f['id'],'queue_name':_0x2869d8[_0x1f01('0x30')],'VoiceQueueId':_0x2869d8['id'],'interface':_[_0x1f01('0x7f')](_0x12f24f['interface'])?util[_0x1f01('0x80')]('SIP/%s',_0x12f24f[_0x1f01('0x30')]):_0x12f24f[_0x1f01('0x81')],'paused':_0x12f24f[_0x1f01('0x73')]||![],'penalty':_0x12f24f['penalty']},{'transaction':_0x53d5cf});});})['then'](function(){_0x47b869[_0x1f01('0x76')](function(_0x1cdd0f){socket[_0x1f01('0x82')](_0x1f01('0x83'),{'UserId':_0x1cdd0f['id'],'VoiceQueueId':_0x2869d8['id']});});});});});}})[_0x1f01('0x25')](respondWithStatusCode(_0x16b88a,null))[_0x1f01('0x50')](handleError(_0x16b88a,null));};exports['removeTeams']=function(_0x33b2b3,_0x72baec,_0x2b670b){return db[_0x1f01('0x6e')]['findAll']({'where':{'id':_0x33b2b3['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x1f01('0x71')],'as':_0x1f01('0x75'),'attributes':['id'],'raw':!![]}]})[_0x1f01('0x25')](handleEntityNotFound(_0x72baec,null))[_0x1f01('0x25')](function(_0x742f00){var _0x4dd41f=_[_0x1f01('0x3a')](_0x742f00,'id');var _0x96ae94=[];var _0x1a2015=[];var _0x4d3ed8=squel['select']();_0x4d3ed8['field'](_0x1f01('0x84'))[_0x1f01('0x85')](_0x1f01('0x86'),'tq')[_0x1f01('0x87')]('user_has_teams','ut',_0x1f01('0x88'))[_0x1f01('0x44')](_0x1f01('0x89'),_0x33b2b3[_0x1f01('0x52')]['id']);for(var _0x36609f=0x0;_0x36609f<_0x742f00[_0x1f01('0x53')];_0x36609f+=0x1){let _0x2f8816=_0x742f00[_0x36609f];for(var _0x269b2e=0x0;_0x269b2e<_0x2f8816[_0x1f01('0x75')][_0x1f01('0x53')];_0x269b2e+=0x1){let _0x27ea8b=_0x2f8816[_0x1f01('0x75')][_0x269b2e];var _0x5d04a6=_0x4d3ed8['clone']();_0x5d04a6[_0x1f01('0x44')](_0x1f01('0x8a'),_0x27ea8b['id']);_0x1a2015[_0x1f01('0x8b')](db[_0x1f01('0x78')][_0x1f01('0x3b')](_0x5d04a6[_0x1f01('0x8c')](),{'type':db[_0x1f01('0x78')]['QueryTypes'][_0x1f01('0x8d')]})['then'](function(_0x4a2b26){if(_0x4a2b26[_0x1f01('0x53')]===0x1){return _0x27ea8b['id'];}else{var _0x5ea338=_[_0x1f01('0x8e')](_[_0x1f01('0x3a')](_0x4a2b26,_0x1f01('0x8f')),function(_0xc9157b){return _[_0x1f01('0x2d')](_0x4dd41f,_0xc9157b);});if(_0x5ea338){return _0x27ea8b['id'];}}}));}}return BPromise[_0x1f01('0x90')](_0x1a2015)['then'](function(_0x40e070){_0x96ae94=_(_0x96ae94)['union'](_0x40e070)[_0x1f01('0x91')]()[_0x1f01('0x2c')]();return db['VoiceQueue']['find']({'where':{'id':_0x33b2b3[_0x1f01('0x52')]['id']}})['then'](function(_0x450f7f){return db['sequelize'][_0x1f01('0x79')](function(_0x176c50){return _0x450f7f[_0x1f01('0x92')](_0x33b2b3[_0x1f01('0x3b')][_0x1f01('0x93')],{'transaction':_0x176c50})['then'](function(){if(!_[_0x1f01('0x94')](_0x96ae94)){return _0x450f7f[_0x1f01('0x95')](_0x96ae94,{'transaction':_0x176c50})['then'](function(){return db[_0x1f01('0x7e')]['destroy']({'where':{'VoiceQueueId':_0x33b2b3['params']['id'],'UserId':_0x96ae94},'transaction':_0x176c50});});}})[_0x1f01('0x25')](function(){_0x96ae94[_0x1f01('0x76')](function(_0xf37d87){socket['emit'](_0x1f01('0x96'),{'UserId':_0xf37d87,'VoiceQueueId':_0x450f7f['id']});});});});});});})['then'](respondWithStatusCode(_0x72baec,null))[_0x1f01('0x50')](handleError(_0x72baec,null));};exports[_0x1f01('0x97')]=function(_0x878e19,_0x1ba12b,_0x5c785d){var _0x207e48,_0x346dfa;return db['VoiceQueue'][_0x1f01('0x2f')]({'where':{'id':_0x878e19[_0x1f01('0x52')]['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x1ba12b,null))[_0x1f01('0x25')](function(_0xebb306){if(_0xebb306){_0x346dfa=_0xebb306;return _0xebb306[_0x1f01('0x97')](_0x878e19[_0x1f01('0x55')]['ids'],_[_0x1f01('0x5f')](_0x878e19['body'],[_0x1f01('0x93'),'id'])||{})['spread'](function(_0x2f9558){for(var _0x551a78=0x0;_0x551a78<_0x878e19['body']['ids'][_0x1f01('0x53')];_0x551a78+=0x1){socket[_0x1f01('0x82')](_0x1f01('0x83'),{'UserId':_0x878e19[_0x1f01('0x55')][_0x1f01('0x93')][_0x551a78],'VoiceQueueId':_0x878e19[_0x1f01('0x52')]['id']});}return _0x2f9558;});}})[_0x1f01('0x25')](function(_0x3270ce){_0x207e48=_0x3270ce||[];if(_0x346dfa){return db[_0x1f01('0x71')][_0x1f01('0x4e')]({'where':{'id':_0x878e19[_0x1f01('0x55')][_0x1f01('0x93')]},'attributes':['id',_0x1f01('0x30'),'online',_0x1f01('0x73'),_0x1f01('0x81')],'raw':!![]});}})['then'](function(_0x46c499){if(!_[_0x1f01('0x94')](_0x46c499)){var _0x4353d3=[];for(var _0x3f5200=0x0;_0x3f5200<_0x46c499['length'];_0x3f5200++){if(_0x46c499[_0x3f5200][_0x1f01('0x72')]){_0x4353d3[_0x1f01('0x8b')](db[_0x1f01('0x7e')][_0x1f01('0x7c')]({'membername':_0x46c499[_0x3f5200][_0x1f01('0x30')],'UserId':_0x46c499[_0x3f5200]['id'],'queue_name':_0x346dfa[_0x1f01('0x30')],'VoiceQueueId':_0x346dfa['id'],'interface':_[_0x1f01('0x7f')](_0x46c499[_0x3f5200][_0x1f01('0x81')])?util['format'](_0x1f01('0x98'),_0x46c499[_0x3f5200]['name']):_0x46c499[_0x3f5200][_0x1f01('0x81')],'paused':_0x46c499[_0x3f5200][_0x1f01('0x73')]||![],'penalty':_0x878e19[_0x1f01('0x55')][_0x1f01('0x77')]||0x0}));}}return BPromise[_0x1f01('0x90')](_0x4353d3);}})[_0x1f01('0x25')](function(){return _0x207e48;})['then'](respondWithResult(_0x1ba12b,null))['catch'](handleError(_0x1ba12b,null));};exports[_0x1f01('0x95')]=function(_0xe432d4,_0x2fc395,_0x556df5){return db[_0x1f01('0x4a')][_0x1f01('0x2f')]({'where':{'id':_0xe432d4[_0x1f01('0x52')]['id']}})['then'](handleEntityNotFound(_0x2fc395,null))[_0x1f01('0x25')](function(_0x45132e){if(_0x45132e){return _0x45132e[_0x1f01('0x95')](_0xe432d4[_0x1f01('0x3b')]['ids'])[_0x1f01('0x25')](function(){if(_[_0x1f01('0x99')](_0xe432d4[_0x1f01('0x3b')][_0x1f01('0x93')])){for(var _0x58793a=0x0;_0x58793a<_0xe432d4[_0x1f01('0x3b')][_0x1f01('0x93')][_0x1f01('0x53')];_0x58793a+=0x1){socket[_0x1f01('0x82')](_0x1f01('0x96'),{'UserId':Number(_0xe432d4[_0x1f01('0x3b')][_0x1f01('0x93')][_0x58793a]),'VoiceQueueId':Number(_0xe432d4['params']['id'])});}}else{socket[_0x1f01('0x82')]('userVoiceQueue:remove',{'UserId':Number(_0xe432d4['query'][_0x1f01('0x93')]),'VoiceQueueId':Number(_0xe432d4[_0x1f01('0x52')]['id'])});}});}})['then'](function(_0x26256b){return db[_0x1f01('0x7e')][_0x1f01('0x26')]({'where':{'VoiceQueueId':_0xe432d4[_0x1f01('0x52')]['id'],'UserId':_0xe432d4[_0x1f01('0x3b')][_0x1f01('0x93')]}})[_0x1f01('0x25')](function(){return _0x26256b;});})['then'](respondWithStatusCode(_0x2fc395,null))[_0x1f01('0x50')](handleError(_0x2fc395,null));};exports[_0x1f01('0x9a')]=function(_0x2fce49,_0x24c449,_0x10850e){var _0x511420={};var _0x1f8e51={};var _0x3a828a;var _0x3fccc2;return db[_0x1f01('0x4a')][_0x1f01('0x64')]({'where':{'id':_0x2fce49['params']['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x24c449,null))[_0x1f01('0x25')](function(_0x154191){if(_0x154191){_0x3a828a=_0x154191;_0x1f8e51['model']=_[_0x1f01('0x3c')](db[_0x1f01('0x71')][_0x1f01('0x36')]);_0x1f8e51[_0x1f01('0x3b')]=_[_0x1f01('0x3c')](_0x2fce49['query']);_0x1f8e51['filters']=_[_0x1f01('0x3d')](_0x1f8e51[_0x1f01('0x39')],_0x1f8e51['query']);_0x511420[_0x1f01('0x3e')]=_['intersection'](_0x1f8e51[_0x1f01('0x39')],qs[_0x1f01('0x3f')](_0x2fce49[_0x1f01('0x3b')][_0x1f01('0x3f')]));_0x511420[_0x1f01('0x3e')]=_0x511420[_0x1f01('0x3e')][_0x1f01('0x53')]?_0x511420['attributes']:_0x1f8e51[_0x1f01('0x39')];_0x511420['order']=qs['sort'](_0x2fce49['query'][_0x1f01('0x43')]);_0x511420[_0x1f01('0x44')]=qs[_0x1f01('0x46')](_['pick'](_0x2fce49[_0x1f01('0x3b')],_0x1f8e51[_0x1f01('0x46')]));if(_0x2fce49[_0x1f01('0x3b')][_0x1f01('0x2a')]){_0x511420[_0x1f01('0x44')]=_[_0x1f01('0x47')](_0x511420[_0x1f01('0x44')],{'$or':_['map'](_0x511420['attributes'],function(_0x5ac68b){var _0x46ff2={};_0x46ff2[_0x5ac68b]={'$like':'%'+_0x2fce49[_0x1f01('0x3b')][_0x1f01('0x2a')]+'%'};return _0x46ff2;})});}_0x511420=_[_0x1f01('0x47')]({},_0x511420,_0x2fce49['options']);return _0x3a828a[_0x1f01('0x9a')](_0x511420);}})[_0x1f01('0x25')](function(_0x3e290f){if(_0x3e290f){_0x3fccc2=_0x3e290f[_0x1f01('0x53')];if(!_0x2fce49[_0x1f01('0x3b')]['hasOwnProperty'](_0x1f01('0x41'))){_0x511420[_0x1f01('0x1e')]=qs['limit'](_0x2fce49[_0x1f01('0x3b')][_0x1f01('0x1e')]);_0x511420[_0x1f01('0x1c')]=qs[_0x1f01('0x1c')](_0x2fce49[_0x1f01('0x3b')][_0x1f01('0x1c')]);}return _0x3a828a['getAgents'](_0x511420);}})['then'](function(_0x470ab3){if(_0x470ab3){return _0x470ab3?{'count':_0x3fccc2,'rows':_0x470ab3}:null;}})[_0x1f01('0x25')](respondWithResult(_0x24c449,null))['catch'](handleError(_0x24c449,null));};exports[_0x1f01('0x9b')]=function(_0x44fea0,_0x46bc45,_0x42e425){var _0x452740={};var _0x54d43c={};var _0x2df36c;var _0x43174b;return db[_0x1f01('0x4a')]['findOne']({'where':{'id':_0x44fea0[_0x1f01('0x52')]['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x46bc45,null))['then'](function(_0x218342){if(_0x218342){_0x2df36c=_0x218342;_0x54d43c['model']=_[_0x1f01('0x3c')](db[_0x1f01('0x7e')][_0x1f01('0x36')]);_0x54d43c[_0x1f01('0x3b')]=_[_0x1f01('0x3c')](_0x44fea0['query']);_0x54d43c[_0x1f01('0x46')]=_['intersection'](_0x54d43c[_0x1f01('0x39')],_0x54d43c['query']);_0x452740['attributes']=_[_0x1f01('0x3d')](_0x54d43c[_0x1f01('0x39')],qs[_0x1f01('0x3f')](_0x44fea0[_0x1f01('0x3b')][_0x1f01('0x3f')]));_0x452740['attributes']=_0x452740[_0x1f01('0x3e')]['length']?_0x452740[_0x1f01('0x3e')]:_0x54d43c[_0x1f01('0x39')];_0x452740[_0x1f01('0x42')]=qs[_0x1f01('0x43')](_0x44fea0[_0x1f01('0x3b')][_0x1f01('0x43')]);_0x452740[_0x1f01('0x44')]=qs[_0x1f01('0x46')](_[_0x1f01('0x45')](_0x44fea0['query'],_0x54d43c[_0x1f01('0x46')]));if(_0x44fea0['query'][_0x1f01('0x2a')]){_0x452740[_0x1f01('0x44')]=_[_0x1f01('0x47')](_0x452740['where'],{'$or':_[_0x1f01('0x3a')](_0x452740[_0x1f01('0x3e')],function(_0x5ac069){var _0x187523={};_0x187523[_0x5ac069]={'$like':'%'+_0x44fea0[_0x1f01('0x3b')][_0x1f01('0x2a')]+'%'};return _0x187523;})});}_0x452740=_[_0x1f01('0x47')]({},_0x452740,_0x44fea0[_0x1f01('0x49')]);return _0x2df36c[_0x1f01('0x9b')](_0x452740);}})[_0x1f01('0x25')](function(_0x477a1a){if(_0x477a1a){_0x43174b=_0x477a1a['length'];if(!_0x44fea0[_0x1f01('0x3b')]['hasOwnProperty'](_0x1f01('0x41'))){_0x452740[_0x1f01('0x1e')]=qs['limit'](_0x44fea0[_0x1f01('0x3b')][_0x1f01('0x1e')]);_0x452740[_0x1f01('0x1c')]=qs['offset'](_0x44fea0['query']['offset']);}return _0x2df36c[_0x1f01('0x9b')](_0x452740);}})[_0x1f01('0x25')](function(_0x2455d7){return _0x2455d7?{'count':_0x43174b,'rows':_0x2455d7}:null;})[_0x1f01('0x25')](respondWithResult(_0x46bc45,null))[_0x1f01('0x50')](handleError(_0x46bc45,null));};exports[_0x1f01('0x9c')]=function(_0x14e41a,_0x4a9447,_0xb93201){var _0x323386={};var _0x471bf7={};var _0x59c82b;var _0x3089ef;return db[_0x1f01('0x4a')][_0x1f01('0x64')]({'where':{'id':_0x14e41a['params']['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x4a9447,null))['then'](function(_0x1363c1){if(_0x1363c1){_0x59c82b=_0x1363c1;_0x471bf7[_0x1f01('0x39')]=_[_0x1f01('0x3c')](db[_0x1f01('0x9d')]['rawAttributes']);_0x471bf7['query']=_[_0x1f01('0x3c')](_0x14e41a[_0x1f01('0x3b')]);_0x471bf7['filters']=_['intersection'](_0x471bf7[_0x1f01('0x39')],_0x471bf7['query']);_0x323386[_0x1f01('0x3e')]=_['intersection'](_0x471bf7[_0x1f01('0x39')],qs[_0x1f01('0x3f')](_0x14e41a['query'][_0x1f01('0x3f')]));_0x323386[_0x1f01('0x3e')]=_0x323386['attributes'][_0x1f01('0x53')]?_0x323386['attributes']:_0x471bf7['model'];_0x323386[_0x1f01('0x42')]=qs[_0x1f01('0x43')](_0x14e41a[_0x1f01('0x3b')]['sort']);_0x323386[_0x1f01('0x44')]=qs[_0x1f01('0x46')](_[_0x1f01('0x45')](_0x14e41a[_0x1f01('0x3b')],_0x471bf7[_0x1f01('0x46')]));if(_0x14e41a[_0x1f01('0x3b')][_0x1f01('0x2a')]){_0x323386[_0x1f01('0x44')]=_['merge'](_0x323386['where'],{'$or':_[_0x1f01('0x3a')](_0x323386['attributes'],function(_0x2a6e87){var _0x5bf8b6={};_0x5bf8b6[_0x2a6e87]={'$like':'%'+_0x14e41a[_0x1f01('0x3b')][_0x1f01('0x2a')]+'%'};return _0x5bf8b6;})});}_0x323386=_[_0x1f01('0x47')]({},_0x323386,_0x14e41a[_0x1f01('0x49')]);return _0x59c82b['getLists'](_0x323386);}})[_0x1f01('0x25')](function(_0x26fba8){if(_0x26fba8){_0x3089ef=_0x26fba8[_0x1f01('0x53')];if(!_0x14e41a['query']['hasOwnProperty'](_0x1f01('0x41'))){_0x323386[_0x1f01('0x1e')]=qs[_0x1f01('0x1e')](_0x14e41a[_0x1f01('0x3b')][_0x1f01('0x1e')]);_0x323386['offset']=qs[_0x1f01('0x1c')](_0x14e41a['query'][_0x1f01('0x1c')]);}return _0x59c82b[_0x1f01('0x9c')](_0x323386);}})['then'](function(_0x58defd){if(_0x58defd){return _0x58defd?{'count':_0x3089ef,'rows':_0x58defd}:null;}})[_0x1f01('0x25')](respondWithResult(_0x4a9447,null))[_0x1f01('0x50')](handleError(_0x4a9447,null));};exports['addLists']=function(_0x447d09,_0x4ec470,_0x98f2ec){var _0x20fd27,_0x49f322;var _0x4c453c=[];var _0x2c6285=moment()[_0x1f01('0x80')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x1f01('0x4a')][_0x1f01('0x2f')]({'where':{'id':_0x447d09[_0x1f01('0x52')]['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x4ec470,null))['then'](function(_0x253802){if(_0x253802){_0x49f322=_0x253802;return _0x253802[_0x1f01('0x9e')](_0x447d09[_0x1f01('0x55')][_0x1f01('0x93')],_[_0x1f01('0x5f')](_0x447d09[_0x1f01('0x55')],[_0x1f01('0x93'),'id'])||{});}return null;})[_0x1f01('0x9f')](function(_0x17db07){var _0x535034;var _0x3ccfe6;_0x20fd27=_0x17db07||[];var _0x5cfc51=[];if(_0x17db07){for(var _0xa11d49=0x0;_0xa11d49<_0x17db07[_0x1f01('0x53')];_0xa11d49+=0x1){var _0x133849=_0x17db07[_0xa11d49]['get']({'plain':!![]});_0x49f322[_0x1f01('0xa0')]=_0x447d09[_0x1f01('0x55')]['dialCheckDuplicateType']?_0x447d09[_0x1f01('0x55')][_0x1f01('0xa0')]:_0x49f322[_0x1f01('0xa0')];switch(_0x49f322[_0x1f01('0xa0')]){case _0x1f01('0xa1'):_0x535034=squel['insert']()[_0x1f01('0xa2')](_0x1f01('0xa3'))[_0x1f01('0xa4')](['phone',_0x1f01('0xa5'),_0x1f01('0xa6'),'ListId','VoiceQueueId',_0x1f01('0x60'),_0x1f01('0x61')],squel[_0x1f01('0xa7')]()[_0x1f01('0xa8')](_0x1f01('0xa9'),'phone')[_0x1f01('0xa8')]('NOW()',_0x1f01('0xa5'))[_0x1f01('0xa8')]('id','ContactId')['field'](_0x133849[_0x1f01('0xaa')][_0x1f01('0x8c')](),_0x1f01('0xab'))[_0x1f01('0xa8')](_0x447d09[_0x1f01('0x52')]['id'][_0x1f01('0x8c')](),_0x1f01('0x66'))[_0x1f01('0xa8')]('\x27'+_0x2c6285+'\x27',_0x1f01('0x60'))[_0x1f01('0xa8')]('\x27'+_0x2c6285+'\x27',_0x1f01('0x61'))['from'](_0x1f01('0xac'))['where']('deletedAt\x20IS\x20NULL')[_0x1f01('0x44')](_0x1f01('0xad'),_0x133849['CmListId'][_0x1f01('0x8c')]())['where'](_0x1f01('0xae'))[_0x1f01('0x44')](_0x1f01('0xaf'),squel[_0x1f01('0xa7')]()['field'](_0x1f01('0xb0'))[_0x1f01('0x85')](_0x1f01('0xb1'))['where'](_0x1f01('0x89'),_0x447d09[_0x1f01('0x52')]['id'][_0x1f01('0x8c')]()))[_0x1f01('0x44')](_0x1f01('0xaf'),squel['select']()[_0x1f01('0xa8')](_0x1f01('0xb2'))[_0x1f01('0x85')](_0x1f01('0xa3'))[_0x1f01('0x44')](_0x1f01('0x89'),_0x447d09[_0x1f01('0x52')]['id'][_0x1f01('0x8c')]())))[_0x1f01('0x8c')]();break;case _0x1f01('0xb3'):_0x535034=squel[_0x1f01('0xb4')]()[_0x1f01('0xa2')](_0x1f01('0xa3'))[_0x1f01('0xa4')]([_0x1f01('0xa9'),'scheduledAt',_0x1f01('0xa6'),_0x1f01('0xab'),'VoiceQueueId',_0x1f01('0x60'),_0x1f01('0x61')],squel[_0x1f01('0xa7')]()[_0x1f01('0xa8')]('phone',_0x1f01('0xa9'))[_0x1f01('0xa8')](_0x1f01('0xb5'),_0x1f01('0xa5'))['field']('id','ContactId')['field'](_0x133849['CmListId'][_0x1f01('0x8c')](),'ListId')[_0x1f01('0xa8')](_0x447d09[_0x1f01('0x52')]['id'][_0x1f01('0x8c')](),'VoiceQueueId')[_0x1f01('0xa8')]('\x27'+_0x2c6285+'\x27','createdAt')[_0x1f01('0xa8')]('\x27'+_0x2c6285+'\x27','updatedAt')['from']('cm_contacts')[_0x1f01('0x44')](_0x1f01('0xb6'))[_0x1f01('0x44')](_0x1f01('0xad'),_0x133849[_0x1f01('0xaa')][_0x1f01('0x8c')]())[_0x1f01('0x44')](_0x1f01('0xae'))[_0x1f01('0x44')](_0x1f01('0xaf'),squel[_0x1f01('0xa7')]()[_0x1f01('0xa8')](_0x1f01('0xb2'))[_0x1f01('0x85')](_0x1f01('0xa3'))[_0x1f01('0x44')](_0x1f01('0x89'),_0x447d09[_0x1f01('0x52')]['id'][_0x1f01('0x8c')]())))[_0x1f01('0x8c')]();break;default:_0x535034=squel[_0x1f01('0xb4')]()[_0x1f01('0xa2')](_0x1f01('0xa3'))[_0x1f01('0xa4')]([_0x1f01('0xa9'),_0x1f01('0xa5'),_0x1f01('0xa6'),'ListId',_0x1f01('0x66'),'createdAt',_0x1f01('0x61')],squel[_0x1f01('0xa7')]()[_0x1f01('0xa8')]('phone','phone')[_0x1f01('0xa8')](_0x1f01('0xb5'),_0x1f01('0xa5'))[_0x1f01('0xa8')]('id','ContactId')[_0x1f01('0xa8')](_0x133849[_0x1f01('0xaa')][_0x1f01('0x8c')](),'ListId')[_0x1f01('0xa8')](_0x447d09[_0x1f01('0x52')]['id']['toString'](),_0x1f01('0x66'))[_0x1f01('0xa8')]('\x27'+_0x2c6285+'\x27','createdAt')[_0x1f01('0xa8')]('\x27'+_0x2c6285+'\x27',_0x1f01('0x61'))['from']('cm_contacts')[_0x1f01('0x44')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x133849[_0x1f01('0xaa')]['toString']())[_0x1f01('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0x1f01('0x8c')]();}_0x3ccfe6=squel['insert']()[_0x1f01('0xa2')](_0x1f01('0xb7'))[_0x1f01('0xa4')]([_0x1f01('0xb8'),'scheduledAt',_0x1f01('0xa9'),_0x1f01('0xb9'),_0x1f01('0x60'),_0x1f01('0x61')],squel['select']()[_0x1f01('0xa8')]('h.id','id')['field']('NOW()','scheduledAt')[_0x1f01('0xa8')]('ci.item',_0x1f01('0xa9'))[_0x1f01('0xa8')]('ci.OrderBY',_0x1f01('0xb9'))[_0x1f01('0xa8')]('\x27'+_0x2c6285+'\x27','createdAt')[_0x1f01('0xa8')]('\x27'+_0x2c6285+'\x27',_0x1f01('0x61'))[_0x1f01('0x85')]('cm_contact_has_items','ci')['join']('cm_hopper','h',_0x1f01('0xba'))[_0x1f01('0x44')]('h.ListId\x20=\x20?',_0x133849['CmListId'][_0x1f01('0x8c')]())['where'](_0x1f01('0xbb'),_0x447d09['params']['id'][_0x1f01('0x8c')]())['where'](_0x1f01('0xbc'),_0x2c6285))[_0x1f01('0x8c')]();_0x5cfc51[_0x1f01('0x8b')](db[_0x1f01('0x78')]['query'](_0x535034));_0x4c453c['push'](db['sequelize'][_0x1f01('0x3b')](_0x3ccfe6));}return BPromise[_0x1f01('0x90')](_0x5cfc51);}})['then'](function(){return BPromise['all'](_0x4c453c);})[_0x1f01('0x25')](function(){return _0x20fd27;})[_0x1f01('0x25')](respondWithResult(_0x4ec470,null))[_0x1f01('0x50')](handleError(_0x4ec470,null));};exports[_0x1f01('0xbd')]=function(_0x2882f0,_0x495751,_0x22bbff){return db[_0x1f01('0x4a')][_0x1f01('0x2f')]({'where':{'id':_0x2882f0[_0x1f01('0x52')]['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x495751,null))[_0x1f01('0x25')](function(_0x2db85a){if(_0x2db85a){return _0x2db85a[_0x1f01('0xbd')](_0x2882f0['query'][_0x1f01('0x93')]);}})[_0x1f01('0x25')](function(_0x57d07a){if(_0x57d07a){return db[_0x1f01('0x65')]['destroy']({'where':{'ListId':_0x2882f0[_0x1f01('0x3b')]['ids'],'VoiceQueueId':_0x2882f0[_0x1f01('0x52')]['id']}})[_0x1f01('0x25')](function(){return _0x57d07a;});}})['then'](respondWithStatusCode(_0x495751,null))[_0x1f01('0x50')](handleError(_0x495751,null));};exports[_0x1f01('0xbe')]=function(_0x28bfe5,_0x189068,_0x1747d1){var _0x496893={};var _0x23dc81={};var _0x104d9c;var _0xec61ae;return db[_0x1f01('0x4a')][_0x1f01('0x64')]({'where':{'id':_0x28bfe5[_0x1f01('0x52')]['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x189068,null))['then'](function(_0x52905c){if(_0x52905c){_0x104d9c=_0x52905c;_0x23dc81[_0x1f01('0x39')]=_[_0x1f01('0x3c')](db[_0x1f01('0x9d')][_0x1f01('0x36')]);_0x23dc81[_0x1f01('0x3b')]=_[_0x1f01('0x3c')](_0x28bfe5[_0x1f01('0x3b')]);_0x23dc81[_0x1f01('0x46')]=_[_0x1f01('0x3d')](_0x23dc81['model'],_0x23dc81[_0x1f01('0x3b')]);_0x496893[_0x1f01('0x3e')]=_['intersection'](_0x23dc81[_0x1f01('0x39')],qs[_0x1f01('0x3f')](_0x28bfe5[_0x1f01('0x3b')][_0x1f01('0x3f')]));_0x496893[_0x1f01('0x3e')]=_0x496893['attributes'][_0x1f01('0x53')]?_0x496893[_0x1f01('0x3e')]:_0x23dc81['model'];_0x496893[_0x1f01('0x42')]=qs[_0x1f01('0x43')](_0x28bfe5[_0x1f01('0x3b')][_0x1f01('0x43')]);_0x496893['where']=qs[_0x1f01('0x46')](_['pick'](_0x28bfe5[_0x1f01('0x3b')],_0x23dc81[_0x1f01('0x46')]));if(_0x28bfe5[_0x1f01('0x3b')]['filter']){_0x496893[_0x1f01('0x44')]=_[_0x1f01('0x47')](_0x496893[_0x1f01('0x44')],{'$or':_[_0x1f01('0x3a')](_0x496893[_0x1f01('0x3e')],function(_0xa8255){var _0x29ee2f={};_0x29ee2f[_0xa8255]={'$like':'%'+_0x28bfe5['query'][_0x1f01('0x2a')]+'%'};return _0x29ee2f;})});}_0x496893=_[_0x1f01('0x47')]({},_0x496893,_0x28bfe5[_0x1f01('0x49')]);return _0x104d9c[_0x1f01('0xbe')](_0x496893);}})['then'](function(_0x991eb){if(_0x991eb){_0xec61ae=_0x991eb[_0x1f01('0x53')];if(!_0x28bfe5['query'][_0x1f01('0x40')](_0x1f01('0x41'))){_0x496893['limit']=qs[_0x1f01('0x1e')](_0x28bfe5['query']['limit']);_0x496893[_0x1f01('0x1c')]=qs[_0x1f01('0x1c')](_0x28bfe5[_0x1f01('0x3b')]['offset']);}return _0x104d9c[_0x1f01('0xbe')](_0x496893);}})[_0x1f01('0x25')](function(_0x40229d){if(_0x40229d){return _0x40229d?{'count':_0xec61ae,'rows':_0x40229d}:null;}})[_0x1f01('0x25')](respondWithResult(_0x189068,null))[_0x1f01('0x50')](handleError(_0x189068,null));};exports[_0x1f01('0xbf')]=function(_0x4a7a67,_0x46daa8,_0x25ca6b){var _0x359a11,_0x950a1d;var _0x4da78c=[];var _0x3a3344=moment()[_0x1f01('0x80')](_0x1f01('0xc0'));return db[_0x1f01('0x4a')][_0x1f01('0x2f')]({'where':{'id':_0x4a7a67[_0x1f01('0x52')]['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x46daa8,null))[_0x1f01('0x25')](function(_0x473c5c){if(_0x473c5c){_0x950a1d=_0x473c5c;return _0x473c5c['addBlackLists'](_0x4a7a67[_0x1f01('0x55')][_0x1f01('0x93')],_[_0x1f01('0x5f')](_0x4a7a67[_0x1f01('0x55')],[_0x1f01('0x93'),'id'])||{});}return null;})[_0x1f01('0x9f')](function(_0x1d4908){var _0x48563d;var _0x492f99;_0x359a11=_0x1d4908||[];var _0x35046d=[];if(_0x1d4908){for(var _0x1f126d=0x0;_0x1f126d<_0x1d4908[_0x1f01('0x53')];_0x1f126d+=0x1){var _0x14ed92=_0x1d4908[_0x1f126d]['get']({'plain':!![]});_0x48563d=squel['insert']()[_0x1f01('0xa2')](_0x1f01('0xc1'))[_0x1f01('0xa4')]([_0x1f01('0xa9'),'ContactId',_0x1f01('0xab'),_0x1f01('0x66'),_0x1f01('0x60'),_0x1f01('0x61')],squel[_0x1f01('0xa7')]()['field'](_0x1f01('0xa9'),_0x1f01('0xa9'))[_0x1f01('0xa8')]('id','ContactId')[_0x1f01('0xa8')](_0x14ed92[_0x1f01('0xaa')][_0x1f01('0x8c')](),_0x1f01('0xab'))['field'](_0x4a7a67[_0x1f01('0x52')]['id'][_0x1f01('0x8c')](),_0x1f01('0x66'))[_0x1f01('0xa8')](_0x1f01('0xb5'),_0x1f01('0x60'))[_0x1f01('0xa8')](_0x1f01('0xb5'),'updatedAt')[_0x1f01('0x85')](_0x1f01('0xac'))[_0x1f01('0x44')](_0x1f01('0xb6'))[_0x1f01('0x44')](_0x1f01('0xad'),_0x14ed92['CmListId'][_0x1f01('0x8c')]())[_0x1f01('0x44')](_0x1f01('0xae')))[_0x1f01('0x8c')]();_0x35046d[_0x1f01('0x8b')](db[_0x1f01('0x78')][_0x1f01('0x3b')](_0x48563d));}return BPromise[_0x1f01('0x90')](_0x35046d);}})[_0x1f01('0x25')](function(){return _0x359a11;})['then'](respondWithResult(_0x46daa8,null))[_0x1f01('0x50')](handleError(_0x46daa8,null));};exports[_0x1f01('0xc2')]=function(_0x512a14,_0x194cd9,_0x4ebb27){return db[_0x1f01('0x4a')][_0x1f01('0x2f')]({'where':{'id':_0x512a14[_0x1f01('0x52')]['id']}})[_0x1f01('0x25')](handleEntityNotFound(_0x194cd9,null))[_0x1f01('0x25')](function(_0x2c9a0f){if(_0x2c9a0f){return _0x2c9a0f['removeBlackLists'](_0x512a14['query']['ids']);}})[_0x1f01('0x25')](function(_0x25bf7b){if(_0x25bf7b){return db['CmHopperBlack'][_0x1f01('0x26')]({'where':{'ListId':_0x512a14[_0x1f01('0x3b')][_0x1f01('0x93')],'VoiceQueueId':_0x512a14['params']['id']}})['then'](function(){return _0x25bf7b;});}})[_0x1f01('0x25')](respondWithStatusCode(_0x194cd9,null))[_0x1f01('0x50')](handleError(_0x194cd9,null));}; \ No newline at end of file +var _0x1ea6=['intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','options','VoiceQueue','includeAll','findAll','rows','show','params','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','QueueCampaigns','outbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','role','VoiceQueues','getHoppers','findOne','order','pick','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','online','voicePause','interface','Agents','forEach','penalty','transaction','addTeams','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','TeamId','includes','all','union','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','CmListId','into','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ListId\x20=\x20?','h.VoiceQueueId=?','h.createdAt\x20=\x20?','removeLists','CmHopper','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','apply','save','update','then','get','inbound','ignore','map','value','find','type','name','UserProfileResource','destroy','error','stack','send','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x74895e,_0x298c35){var _0x40bc2a=function(_0x558c6d){while(--_0x558c6d){_0x74895e['push'](_0x74895e['shift']());}};_0x40bc2a(++_0x298c35);}(_0x1ea6,0x87));var _0x61ea=function(_0x3cf3ee,_0x3cbabc){_0x3cf3ee=_0x3cf3ee-0x0;var _0x4de09c=_0x1ea6[_0x3cf3ee];return _0x4de09c;};'use strict';var emlformat=require(_0x61ea('0x0'));var rimraf=require(_0x61ea('0x1'));var zipdir=require(_0x61ea('0x2'));var jsonpatch=require(_0x61ea('0x3'));var rp=require(_0x61ea('0x4'));var moment=require(_0x61ea('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x61ea('0x6'));var path=require(_0x61ea('0x7'));var sox=require('sox');var csv=require(_0x61ea('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61ea('0x9'));var _=require('lodash');var squel=require(_0x61ea('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x61ea('0x8'));var querystring=require(_0x61ea('0xb'));var Papa=require(_0x61ea('0xc'));var Redis=require(_0x61ea('0xd'));var authService=require(_0x61ea('0xe'));var qs=require(_0x61ea('0xf'));var as=require(_0x61ea('0x10'));var hardwareService=require(_0x61ea('0x11'));var logger=require(_0x61ea('0x12'))(_0x61ea('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x61ea('0x14'));var db=require('../../mysqldb')['db'];config[_0x61ea('0x15')]=_['defaults'](config[_0x61ea('0x15')],{'host':_0x61ea('0x16'),'port':0x18eb});var socket=require(_0x61ea('0x17'))(new Redis(config[_0x61ea('0x15')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x46c0cd,_0x5953cf){_0x5953cf=_0x5953cf||0xcc;return function(_0x5ebc66){if(_0x5ebc66){return _0x46c0cd[_0x61ea('0x18')](_0x5953cf);}return _0x46c0cd['status'](_0x5953cf)[_0x61ea('0x19')]();};}function respondWithResult(_0x46d9a3,_0x41f126){_0x41f126=_0x41f126||0xc8;return function(_0x37f541){if(_0x37f541){return _0x46d9a3[_0x61ea('0x1a')](_0x41f126)[_0x61ea('0x1b')](_0x37f541);}};}function respondWithFilteredResult(_0x2164b3,_0x16a714){return function(_0x2cd5d9){if(_0x2cd5d9){var _0x71ad20=typeof _0x16a714[_0x61ea('0x1c')]===_0x61ea('0x1d')&&typeof _0x16a714[_0x61ea('0x1e')]===_0x61ea('0x1d');var _0x431d01=_0x2cd5d9[_0x61ea('0x1f')];var _0x38f385=_0x71ad20?0x0:_0x16a714[_0x61ea('0x1c')];var _0x3f003a=_0x71ad20?_0x2cd5d9[_0x61ea('0x1f')]:_0x16a714[_0x61ea('0x1c')]+_0x16a714['limit'];var _0x4c0080;if(_0x3f003a>=_0x431d01){_0x3f003a=_0x431d01;_0x4c0080=0xc8;}else{_0x4c0080=0xce;}_0x2164b3[_0x61ea('0x1a')](_0x4c0080);return _0x2164b3['set']('Content-Range',_0x38f385+'-'+_0x3f003a+'/'+_0x431d01)['json'](_0x2cd5d9);}return null;};}function patchUpdates(_0x2c64ab){return function(_0x52286b){try{jsonpatch[_0x61ea('0x20')](_0x52286b,_0x2c64ab,!![]);}catch(_0x59aa79){return BPromise['reject'](_0x59aa79);}return _0x52286b[_0x61ea('0x21')]();};}function saveUpdates(_0x2907cb,_0x55de25){return function(_0x943a13){if(_0x943a13){return _0x943a13[_0x61ea('0x22')](_0x2907cb)[_0x61ea('0x23')](function(_0x201c3c){return _0x201c3c;});}return null;};}function removeEntity(_0x550615,_0x460c8e){return function(_0x181be0){if(_0x181be0){return _0x181be0['destroy']()[_0x61ea('0x23')](function(){var _0x3da309=_0x181be0[_0x61ea('0x24')]({'plain':!![]});var _0x279fd6=[{'name':'VoiceQueues','value':_0x61ea('0x25'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x59db93=_(_0x279fd6)['filter'](_0x61ea('0x26'))[_0x61ea('0x27')](_0x61ea('0x28'))[_0x61ea('0x28')]();if(_['includes'](_0x59db93,_0x3da309['type'])){return;}var _0x37f073=_[_0x61ea('0x29')](_0x279fd6,[_0x61ea('0x28'),_0x3da309[_0x61ea('0x2a')]])[_0x61ea('0x2b')];return db[_0x61ea('0x2c')][_0x61ea('0x2d')]({'where':{'type':_0x37f073,'resourceId':_0x3da309['id']}})['then'](function(){return _0x181be0;});})[_0x61ea('0x23')](function(){_0x550615[_0x61ea('0x1a')](0xcc)[_0x61ea('0x19')]();});}};}function handleEntityNotFound(_0x2e125e,_0x429cb9){return function(_0x1e43de){if(!_0x1e43de){_0x2e125e[_0x61ea('0x18')](0x194);}return _0x1e43de;};}function handleError(_0x5c6a64,_0x22530c){_0x22530c=_0x22530c||0x1f4;return function(_0x4d5b9d){logger[_0x61ea('0x2e')](_0x4d5b9d[_0x61ea('0x2f')]);if(_0x4d5b9d['name']){delete _0x4d5b9d[_0x61ea('0x2b')];}_0x5c6a64[_0x61ea('0x1a')](_0x22530c)[_0x61ea('0x30')](_0x4d5b9d);};}exports['index']=function(_0x26cd84,_0xab3084){var _0x246670={},_0xb5bc92={},_0x4cff72={'count':0x0,'rows':[]};var _0x132ee0=_[_0x61ea('0x27')](db['VoiceQueue'][_0x61ea('0x31')],function(_0x295b02){return{'name':_0x295b02[_0x61ea('0x32')],'type':_0x295b02[_0x61ea('0x2a')][_0x61ea('0x33')]};});_0xb5bc92[_0x61ea('0x34')]=_[_0x61ea('0x27')](_0x132ee0,_0x61ea('0x2b'));_0xb5bc92[_0x61ea('0x35')]=_[_0x61ea('0x36')](_0x26cd84[_0x61ea('0x35')]);_0xb5bc92[_0x61ea('0x37')]=_[_0x61ea('0x38')](_0xb5bc92[_0x61ea('0x34')],_0xb5bc92['query']);_0x246670['attributes']=_[_0x61ea('0x38')](_0xb5bc92[_0x61ea('0x34')],qs[_0x61ea('0x39')](_0x26cd84[_0x61ea('0x35')][_0x61ea('0x39')]));_0x246670[_0x61ea('0x3a')]=_0x246670[_0x61ea('0x3a')]['length']?_0x246670[_0x61ea('0x3a')]:_0xb5bc92['model'];if(!_0x26cd84[_0x61ea('0x35')][_0x61ea('0x3b')](_0x61ea('0x3c'))){_0x246670[_0x61ea('0x1e')]=qs[_0x61ea('0x1e')](_0x26cd84[_0x61ea('0x35')][_0x61ea('0x1e')]);_0x246670[_0x61ea('0x1c')]=qs[_0x61ea('0x1c')](_0x26cd84[_0x61ea('0x35')]['offset']);}_0x246670['order']=qs['sort'](_0x26cd84[_0x61ea('0x35')][_0x61ea('0x3d')]);_0x246670[_0x61ea('0x3e')]=qs[_0x61ea('0x37')](_['pick'](_0x26cd84[_0x61ea('0x35')],_0xb5bc92['filters']),_0x132ee0);if(_0x26cd84[_0x61ea('0x35')][_0x61ea('0x3f')]){_0x246670[_0x61ea('0x3e')]=_[_0x61ea('0x40')](_0x246670['where'],{'$or':_[_0x61ea('0x27')](_0x132ee0,function(_0x65e3fd){if(_0x65e3fd[_0x61ea('0x2a')]!=='VIRTUAL'){var _0x5c2f25={};_0x5c2f25[_0x65e3fd[_0x61ea('0x2b')]]={'$like':'%'+_0x26cd84[_0x61ea('0x35')][_0x61ea('0x3f')]+'%'};return _0x5c2f25;}})});}_0x246670=_[_0x61ea('0x40')]({},_0x246670,_0x26cd84[_0x61ea('0x41')]);var _0x526a44={'where':_0x246670['where']};return db[_0x61ea('0x42')]['count'](_0x526a44)[_0x61ea('0x23')](function(_0x5200e5){_0x4cff72[_0x61ea('0x1f')]=_0x5200e5;if(_0x26cd84[_0x61ea('0x35')][_0x61ea('0x43')]){_0x246670['include']=[{'all':!![]}];}return db['VoiceQueue'][_0x61ea('0x44')](_0x246670);})[_0x61ea('0x23')](function(_0x2c215e){_0x4cff72[_0x61ea('0x45')]=_0x2c215e;return _0x4cff72;})[_0x61ea('0x23')](respondWithFilteredResult(_0xab3084,_0x246670))['catch'](handleError(_0xab3084,null));};exports[_0x61ea('0x46')]=function(_0x3acad4,_0x305729){var _0x457bdd={'raw':![],'where':{'id':_0x3acad4[_0x61ea('0x47')]['id']}},_0x6c2842={};_0x6c2842[_0x61ea('0x34')]=_['keys'](db[_0x61ea('0x42')][_0x61ea('0x31')]);_0x6c2842[_0x61ea('0x35')]=_[_0x61ea('0x36')](_0x3acad4['query']);_0x6c2842['filters']=_[_0x61ea('0x38')](_0x6c2842[_0x61ea('0x34')],_0x6c2842[_0x61ea('0x35')]);_0x457bdd['attributes']=_['intersection'](_0x6c2842['model'],qs['fields'](_0x3acad4[_0x61ea('0x35')][_0x61ea('0x39')]));_0x457bdd[_0x61ea('0x3a')]=_0x457bdd['attributes']['length']?_0x457bdd[_0x61ea('0x3a')]:_0x6c2842['model'];if(_0x3acad4[_0x61ea('0x35')][_0x61ea('0x43')]){_0x457bdd[_0x61ea('0x48')]=[{'all':!![]}];}_0x457bdd=_[_0x61ea('0x40')]({},_0x457bdd,_0x3acad4[_0x61ea('0x41')]);return db[_0x61ea('0x42')][_0x61ea('0x29')](_0x457bdd)[_0x61ea('0x23')](handleEntityNotFound(_0x305729,null))['then'](respondWithResult(_0x305729,null))[_0x61ea('0x49')](handleError(_0x305729,null));};exports[_0x61ea('0x4a')]=function(_0x50b955,_0x415e78){return db['VoiceQueue'][_0x61ea('0x4a')](_0x50b955[_0x61ea('0x4b')],{})[_0x61ea('0x23')](function(_0x1061d0){var _0x506eb4=_0x50b955[_0x61ea('0x4c')][_0x61ea('0x24')]({'plain':!![]});if(!_0x506eb4)throw new Error(_0x61ea('0x4d'));if(_0x506eb4['role']===_0x61ea('0x4c')){var _0x386db2=_0x1061d0[_0x61ea('0x24')]({'plain':!![]});var _0x5a116e=[{'name':'VoiceQueues','value':_0x61ea('0x25')},{'name':_0x61ea('0x4e'),'value':_0x61ea('0x4f')}];var _0x506c57=_['find'](_0x5a116e,[_0x61ea('0x28'),_0x386db2[_0x61ea('0x2a')]])[_0x61ea('0x2b')];return db[_0x61ea('0x50')][_0x61ea('0x29')]({'where':{'name':_0x506c57,'userProfileId':_0x506eb4[_0x61ea('0x51')]},'raw':!![]})[_0x61ea('0x23')](function(_0xe5dd0e){if(_0xe5dd0e&&_0xe5dd0e[_0x61ea('0x52')]===0x0){return db[_0x61ea('0x2c')][_0x61ea('0x4a')]({'name':_0x386db2[_0x61ea('0x2b')],'resourceId':_0x386db2['id'],'type':_0xe5dd0e[_0x61ea('0x2b')],'sectionId':_0xe5dd0e['id']},{})[_0x61ea('0x23')](function(){return _0x1061d0;});}else{return _0x1061d0;}})[_0x61ea('0x49')](function(_0x11513a){logger[_0x61ea('0x2e')](_0x61ea('0x53'),_0x11513a);throw _0x11513a;});}return _0x1061d0;})[_0x61ea('0x23')](respondWithResult(_0x415e78,0xc9))[_0x61ea('0x49')](handleError(_0x415e78,null));};exports[_0x61ea('0x54')]=function(_0x211367,_0x27d0f7){var _0x1cd861={'where':{'id':_0x211367['params']['id']}},_0x435d6d={};_0x435d6d['model']=_[_0x61ea('0x36')](db[_0x61ea('0x42')][_0x61ea('0x31')]);_0x1cd861[_0x61ea('0x3a')]=_[_0x61ea('0x38')](_0x435d6d[_0x61ea('0x34')],qs[_0x61ea('0x39')](_0x211367[_0x61ea('0x35')][_0x61ea('0x39')]));_0x1cd861[_0x61ea('0x3a')]=_0x1cd861['attributes'][_0x61ea('0x55')]?_0x1cd861['attributes']:_0x435d6d[_0x61ea('0x34')];if(_0x211367[_0x61ea('0x35')]['includeAll']){_0x1cd861[_0x61ea('0x48')]=[{'all':!![]}];}_0x1cd861=_[_0x61ea('0x40')]({},_0x1cd861,_0x211367[_0x61ea('0x41')]);return db[_0x61ea('0x42')][_0x61ea('0x29')](_0x1cd861)[_0x61ea('0x23')](handleEntityNotFound(_0x27d0f7,null))[_0x61ea('0x23')](function(_0x20c002){if(_0x20c002){var _0x8f7fae=_0x20c002[_0x61ea('0x24')]({'plain':!![]});_0x8f7fae=qs[_0x61ea('0x56')](_0x8f7fae,['id',_0x61ea('0x57'),_0x61ea('0x58')]);_0x211367[_0x61ea('0x4b')]=_[_0x61ea('0x56')](_0x211367[_0x61ea('0x4b')],['id',_0x61ea('0x57'),'updatedAt']);return db[_0x61ea('0x42')]['create'](_[_0x61ea('0x40')](_0x8f7fae,_0x211367[_0x61ea('0x4b')]),{'include':_0x211367[_0x61ea('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0x61ea('0x23')](function(_0x34570d){var _0x1bd540=_0x211367[_0x61ea('0x4c')]['get']({'plain':!![]});if(!_0x1bd540)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bd540[_0x61ea('0x59')]===_0x61ea('0x4c')){var _0x241ca4=_0x34570d[_0x61ea('0x24')]({'plain':!![]});var _0x27bf36=[{'name':_0x61ea('0x5a'),'value':_0x61ea('0x25')},{'name':_0x61ea('0x4e'),'value':'outbound'}];var _0x365bd0=_['find'](_0x27bf36,[_0x61ea('0x28'),_0x241ca4[_0x61ea('0x2a')]])[_0x61ea('0x2b')];return db[_0x61ea('0x50')]['find']({'where':{'name':_0x365bd0,'userProfileId':_0x1bd540['userProfileId']},'raw':!![]})[_0x61ea('0x23')](function(_0x5d4819){if(_0x5d4819&&_0x5d4819[_0x61ea('0x52')]===0x0){return db['UserProfileResource'][_0x61ea('0x4a')]({'name':_0x241ca4['name'],'resourceId':_0x241ca4['id'],'type':_0x5d4819[_0x61ea('0x2b')],'sectionId':_0x5d4819['id']},{})[_0x61ea('0x23')](function(){return _0x34570d;});}else{return _0x34570d;}})[_0x61ea('0x49')](function(_0x206f66){logger[_0x61ea('0x2e')](_0x61ea('0x53'),_0x206f66);throw _0x206f66;});}return _0x34570d;});}})['then'](respondWithResult(_0x27d0f7,0xc9))[_0x61ea('0x49')](handleError(_0x27d0f7,null));};exports['update']=function(_0x4e3854,_0x173749){if(_0x4e3854['body']['id']){delete _0x4e3854['body']['id'];}return db[_0x61ea('0x42')][_0x61ea('0x29')]({'where':{'id':_0x4e3854[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0x173749,null))[_0x61ea('0x23')](saveUpdates(_0x4e3854['body'],null))[_0x61ea('0x23')](respondWithResult(_0x173749,null))[_0x61ea('0x49')](handleError(_0x173749,null));};exports['destroy']=function(_0x404644,_0x38c423){return db['VoiceQueue']['find']({'where':{'id':_0x404644[_0x61ea('0x47')]['id']}})['then'](handleEntityNotFound(_0x38c423,null))['then'](removeEntity(_0x38c423,null))[_0x61ea('0x49')](handleError(_0x38c423,null));};exports[_0x61ea('0x5b')]=function(_0x156595,_0x1006f4,_0x32280e){var _0x14b5ef={'raw':![],'where':{}};var _0x4e7845={};var _0x1233a6={'count':0x0,'rows':[]};return db[_0x61ea('0x42')][_0x61ea('0x5c')]({'where':{'id':_0x156595[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0x1006f4,null))[_0x61ea('0x23')](function(_0x2cc651){if(_0x2cc651){_0x4e7845['model']=_[_0x61ea('0x36')](db['CmHopper'][_0x61ea('0x31')]);_0x4e7845[_0x61ea('0x35')]=_['keys'](_0x156595[_0x61ea('0x35')]);_0x4e7845[_0x61ea('0x37')]=_[_0x61ea('0x38')](_0x4e7845['model'],_0x4e7845['query']);_0x14b5ef[_0x61ea('0x3a')]=_[_0x61ea('0x38')](_0x4e7845['model'],qs[_0x61ea('0x39')](_0x156595[_0x61ea('0x35')]['fields']));_0x14b5ef[_0x61ea('0x3a')]=_0x14b5ef[_0x61ea('0x3a')][_0x61ea('0x55')]?_0x14b5ef[_0x61ea('0x3a')]:_0x4e7845['model'];if(!_0x156595[_0x61ea('0x35')]['hasOwnProperty'](_0x61ea('0x3c'))){_0x14b5ef[_0x61ea('0x1e')]=qs[_0x61ea('0x1e')](_0x156595['query'][_0x61ea('0x1e')]);_0x14b5ef['offset']=qs[_0x61ea('0x1c')](_0x156595['query'][_0x61ea('0x1c')]);}_0x14b5ef[_0x61ea('0x5d')]=qs[_0x61ea('0x3d')](_0x156595['query']['sort']);_0x14b5ef[_0x61ea('0x3e')]=qs['filters'](_[_0x61ea('0x5e')](_0x156595[_0x61ea('0x35')],_0x4e7845[_0x61ea('0x37')]));_0x14b5ef[_0x61ea('0x3e')]['VoiceQueueId']=_0x2cc651['id'];if(_0x156595['query'][_0x61ea('0x3f')]){_0x14b5ef[_0x61ea('0x3e')]=_[_0x61ea('0x40')](_0x14b5ef['where'],{'$or':_[_0x61ea('0x27')](_0x14b5ef['attributes'],function(_0x40e452){var _0x3ea712={};_0x3ea712[_0x40e452]={'$like':'%'+_0x156595['query'][_0x61ea('0x3f')]+'%'};return _0x3ea712;})});}_0x14b5ef=_['merge']({},_0x14b5ef,_0x156595[_0x61ea('0x41')]);return db['CmHopper'][_0x61ea('0x1f')]({'where':_0x14b5ef['where']})['then'](function(_0x12846a){_0x1233a6['count']=_0x12846a;if(_0x156595[_0x61ea('0x35')][_0x61ea('0x43')]){_0x14b5ef[_0x61ea('0x48')]=[{'all':!![]}];}return db['CmHopper'][_0x61ea('0x44')](_0x14b5ef);})['then'](function(_0x475ec4){_0x1233a6[_0x61ea('0x45')]=_0x475ec4;return _0x1233a6;});}})[_0x61ea('0x23')](respondWithFilteredResult(_0x1006f4,_0x14b5ef))[_0x61ea('0x49')](handleError(_0x1006f4,null));};exports[_0x61ea('0x5f')]=function(_0x440b8c,_0x2622c6,_0x551e86){var _0x304ab0={'raw':!![],'where':{}};var _0x4974fd={};var _0x2cff15={'count':0x0,'rows':[]};return db[_0x61ea('0x42')]['findOne']({'where':{'id':_0x440b8c[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0x2622c6,null))[_0x61ea('0x23')](function(_0x47df85){if(_0x47df85){_0x4974fd['model']=_['keys'](db[_0x61ea('0x60')][_0x61ea('0x31')]);_0x4974fd[_0x61ea('0x35')]=_[_0x61ea('0x36')](_0x440b8c[_0x61ea('0x35')]);_0x4974fd['filters']=_[_0x61ea('0x38')](_0x4974fd[_0x61ea('0x34')],_0x4974fd['query']);_0x304ab0[_0x61ea('0x3a')]=_['intersection'](_0x4974fd[_0x61ea('0x34')],qs['fields'](_0x440b8c[_0x61ea('0x35')][_0x61ea('0x39')]));_0x304ab0['attributes']=_0x304ab0[_0x61ea('0x3a')]['length']?_0x304ab0['attributes']:_0x4974fd[_0x61ea('0x34')];if(!_0x440b8c[_0x61ea('0x35')][_0x61ea('0x3b')](_0x61ea('0x3c'))){_0x304ab0['limit']=qs[_0x61ea('0x1e')](_0x440b8c[_0x61ea('0x35')][_0x61ea('0x1e')]);_0x304ab0[_0x61ea('0x1c')]=qs[_0x61ea('0x1c')](_0x440b8c[_0x61ea('0x35')]['offset']);}_0x304ab0[_0x61ea('0x5d')]=qs[_0x61ea('0x3d')](_0x440b8c[_0x61ea('0x35')][_0x61ea('0x3d')]);_0x304ab0[_0x61ea('0x3e')]=qs[_0x61ea('0x37')](_['pick'](_0x440b8c[_0x61ea('0x35')],_0x4974fd[_0x61ea('0x37')]));_0x304ab0[_0x61ea('0x3e')][_0x61ea('0x61')]=_0x47df85['id'];if(_0x440b8c['query']['filter']){_0x304ab0[_0x61ea('0x3e')]=_[_0x61ea('0x40')](_0x304ab0['where'],{'$or':_[_0x61ea('0x27')](_0x304ab0[_0x61ea('0x3a')],function(_0x2ebb74){var _0x2660b6={};_0x2660b6[_0x2ebb74]={'$like':'%'+_0x440b8c[_0x61ea('0x35')][_0x61ea('0x3f')]+'%'};return _0x2660b6;})});}_0x304ab0=_[_0x61ea('0x40')]({},_0x304ab0,_0x440b8c['options']);return db['CmHopperHistory'][_0x61ea('0x1f')]({'where':_0x304ab0[_0x61ea('0x3e')]})['then'](function(_0x54dcd3){_0x2cff15[_0x61ea('0x1f')]=_0x54dcd3;if(_0x440b8c[_0x61ea('0x35')][_0x61ea('0x43')]){_0x304ab0[_0x61ea('0x48')]=[{'all':!![]}];}return db[_0x61ea('0x60')][_0x61ea('0x44')](_0x304ab0);})[_0x61ea('0x23')](function(_0x4996be){_0x2cff15[_0x61ea('0x45')]=_0x4996be;return _0x2cff15;});}})[_0x61ea('0x23')](respondWithFilteredResult(_0x2622c6,_0x304ab0))[_0x61ea('0x49')](handleError(_0x2622c6,null));};exports[_0x61ea('0x62')]=function(_0x4d00a4,_0x3cd581,_0x115cda){var _0x3857d2={'raw':!![],'where':{}};var _0x276ff1={};var _0x2f0159={'count':0x0,'rows':[]};return db[_0x61ea('0x42')][_0x61ea('0x5c')]({'where':{'id':_0x4d00a4['params']['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0x3cd581,null))[_0x61ea('0x23')](function(_0x27ad14){if(_0x27ad14){_0x276ff1[_0x61ea('0x34')]=_[_0x61ea('0x36')](db[_0x61ea('0x63')]['rawAttributes']);_0x276ff1[_0x61ea('0x35')]=_[_0x61ea('0x36')](_0x4d00a4[_0x61ea('0x35')]);_0x276ff1[_0x61ea('0x37')]=_[_0x61ea('0x38')](_0x276ff1[_0x61ea('0x34')],_0x276ff1[_0x61ea('0x35')]);_0x3857d2['attributes']=_[_0x61ea('0x38')](_0x276ff1[_0x61ea('0x34')],qs[_0x61ea('0x39')](_0x4d00a4['query'][_0x61ea('0x39')]));_0x3857d2[_0x61ea('0x3a')]=_0x3857d2[_0x61ea('0x3a')][_0x61ea('0x55')]?_0x3857d2[_0x61ea('0x3a')]:_0x276ff1[_0x61ea('0x34')];if(!_0x4d00a4[_0x61ea('0x35')][_0x61ea('0x3b')](_0x61ea('0x3c'))){_0x3857d2[_0x61ea('0x1e')]=qs['limit'](_0x4d00a4[_0x61ea('0x35')][_0x61ea('0x1e')]);_0x3857d2['offset']=qs['offset'](_0x4d00a4[_0x61ea('0x35')][_0x61ea('0x1c')]);}_0x3857d2[_0x61ea('0x5d')]=qs[_0x61ea('0x3d')](_0x4d00a4[_0x61ea('0x35')][_0x61ea('0x3d')]);_0x3857d2[_0x61ea('0x3e')]=qs[_0x61ea('0x37')](_[_0x61ea('0x5e')](_0x4d00a4[_0x61ea('0x35')],_0x276ff1[_0x61ea('0x37')]));_0x3857d2['where'][_0x61ea('0x61')]=_0x27ad14['id'];if(_0x4d00a4[_0x61ea('0x35')]['filter']){_0x3857d2[_0x61ea('0x3e')]=_['merge'](_0x3857d2[_0x61ea('0x3e')],{'$or':_[_0x61ea('0x27')](_0x3857d2[_0x61ea('0x3a')],function(_0x3d162b){var _0x99190a={};_0x99190a[_0x3d162b]={'$like':'%'+_0x4d00a4[_0x61ea('0x35')][_0x61ea('0x3f')]+'%'};return _0x99190a;})});}_0x3857d2=_['merge']({},_0x3857d2,_0x4d00a4['options']);return db['CmHopperFinal']['count']({'where':_0x3857d2[_0x61ea('0x3e')]})['then'](function(_0x4c283b){_0x2f0159[_0x61ea('0x1f')]=_0x4c283b;if(_0x4d00a4['query'][_0x61ea('0x43')]){_0x3857d2[_0x61ea('0x48')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3857d2);})['then'](function(_0x148867){_0x2f0159['rows']=_0x148867;return _0x2f0159;});}})['then'](respondWithFilteredResult(_0x3cd581,_0x3857d2))[_0x61ea('0x49')](handleError(_0x3cd581,null));};exports[_0x61ea('0x64')]=function(_0x174f0a,_0xe74059,_0x35835a){var _0x5abe72={'raw':!![],'where':{}};var _0x225ea4={};var _0x56b704={'count':0x0,'rows':[]};return db[_0x61ea('0x42')][_0x61ea('0x5c')]({'where':{'id':_0x174f0a[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0xe74059,null))[_0x61ea('0x23')](function(_0x1424ad){if(_0x1424ad){_0x225ea4[_0x61ea('0x34')]=_[_0x61ea('0x36')](db['CmHopperBlack'][_0x61ea('0x31')]);_0x225ea4[_0x61ea('0x35')]=_[_0x61ea('0x36')](_0x174f0a['query']);_0x225ea4[_0x61ea('0x37')]=_['intersection'](_0x225ea4[_0x61ea('0x34')],_0x225ea4[_0x61ea('0x35')]);_0x5abe72['attributes']=_[_0x61ea('0x38')](_0x225ea4['model'],qs['fields'](_0x174f0a[_0x61ea('0x35')][_0x61ea('0x39')]));_0x5abe72['attributes']=_0x5abe72[_0x61ea('0x3a')][_0x61ea('0x55')]?_0x5abe72[_0x61ea('0x3a')]:_0x225ea4[_0x61ea('0x34')];if(!_0x174f0a[_0x61ea('0x35')][_0x61ea('0x3b')]('nolimit')){_0x5abe72[_0x61ea('0x1e')]=qs[_0x61ea('0x1e')](_0x174f0a[_0x61ea('0x35')]['limit']);_0x5abe72[_0x61ea('0x1c')]=qs[_0x61ea('0x1c')](_0x174f0a[_0x61ea('0x35')][_0x61ea('0x1c')]);}_0x5abe72[_0x61ea('0x5d')]=qs['sort'](_0x174f0a[_0x61ea('0x35')][_0x61ea('0x3d')]);_0x5abe72['where']=qs[_0x61ea('0x37')](_[_0x61ea('0x5e')](_0x174f0a['query'],_0x225ea4[_0x61ea('0x37')]));_0x5abe72[_0x61ea('0x3e')][_0x61ea('0x61')]=_0x1424ad['id'];if(_0x174f0a[_0x61ea('0x35')]['filter']){_0x5abe72[_0x61ea('0x3e')]=_[_0x61ea('0x40')](_0x5abe72[_0x61ea('0x3e')],{'$or':_[_0x61ea('0x27')](_0x5abe72['attributes'],function(_0x595733){var _0x5c8bd1={};_0x5c8bd1[_0x595733]={'$like':'%'+_0x174f0a['query'][_0x61ea('0x3f')]+'%'};return _0x5c8bd1;})});}_0x5abe72=_[_0x61ea('0x40')]({},_0x5abe72,_0x174f0a[_0x61ea('0x41')]);return db[_0x61ea('0x65')][_0x61ea('0x1f')]({'where':_0x5abe72[_0x61ea('0x3e')]})[_0x61ea('0x23')](function(_0x3b3ccf){_0x56b704['count']=_0x3b3ccf;if(_0x174f0a[_0x61ea('0x35')][_0x61ea('0x43')]){_0x5abe72['include']=[{'all':!![]}];}return db[_0x61ea('0x65')][_0x61ea('0x44')](_0x5abe72);})[_0x61ea('0x23')](function(_0x1048af){_0x56b704[_0x61ea('0x45')]=_0x1048af;return _0x56b704;});}})['then'](respondWithFilteredResult(_0xe74059,_0x5abe72))[_0x61ea('0x49')](handleError(_0xe74059,null));};exports[_0x61ea('0x66')]=function(_0x42402d,_0x3372a5,_0x571f72){var _0x4906ea={};var _0x8545a0={};var _0x59d714;var _0x528b40;return db[_0x61ea('0x42')]['findOne']({'where':{'id':_0x42402d[_0x61ea('0x47')]['id']}})['then'](handleEntityNotFound(_0x3372a5,null))[_0x61ea('0x23')](function(_0x53126b){if(_0x53126b){_0x59d714=_0x53126b;_0x8545a0['model']=_[_0x61ea('0x36')](db[_0x61ea('0x67')]['rawAttributes']);_0x8545a0['query']=_[_0x61ea('0x36')](_0x42402d[_0x61ea('0x35')]);_0x8545a0[_0x61ea('0x37')]=_[_0x61ea('0x38')](_0x8545a0[_0x61ea('0x34')],_0x8545a0[_0x61ea('0x35')]);_0x4906ea[_0x61ea('0x3a')]=_[_0x61ea('0x38')](_0x8545a0[_0x61ea('0x34')],qs[_0x61ea('0x39')](_0x42402d[_0x61ea('0x35')][_0x61ea('0x39')]));_0x4906ea[_0x61ea('0x3a')]=_0x4906ea[_0x61ea('0x3a')][_0x61ea('0x55')]?_0x4906ea[_0x61ea('0x3a')]:_0x8545a0[_0x61ea('0x34')];_0x4906ea[_0x61ea('0x5d')]=qs[_0x61ea('0x3d')](_0x42402d[_0x61ea('0x35')][_0x61ea('0x3d')]);_0x4906ea[_0x61ea('0x3e')]=qs[_0x61ea('0x37')](_['pick'](_0x42402d[_0x61ea('0x35')],_0x8545a0['filters']));if(_0x42402d['query'][_0x61ea('0x3f')]){_0x4906ea[_0x61ea('0x3e')]=_[_0x61ea('0x40')](_0x4906ea[_0x61ea('0x3e')],{'$or':_[_0x61ea('0x27')](_0x4906ea['attributes'],function(_0x3bbc88){var _0x300441={};_0x300441[_0x3bbc88]={'$like':'%'+_0x42402d[_0x61ea('0x35')][_0x61ea('0x3f')]+'%'};return _0x300441;})});}_0x4906ea=_['merge']({},_0x4906ea,_0x42402d[_0x61ea('0x41')]);return _0x59d714['getTeams'](_0x4906ea);}})[_0x61ea('0x23')](function(_0x3bc3d6){if(_0x3bc3d6){_0x528b40=_0x3bc3d6[_0x61ea('0x55')];if(!_0x42402d[_0x61ea('0x35')][_0x61ea('0x3b')](_0x61ea('0x3c'))){_0x4906ea[_0x61ea('0x1e')]=qs['limit'](_0x42402d['query'][_0x61ea('0x1e')]);_0x4906ea[_0x61ea('0x1c')]=qs[_0x61ea('0x1c')](_0x42402d[_0x61ea('0x35')]['offset']);}return _0x59d714[_0x61ea('0x66')](_0x4906ea);}})[_0x61ea('0x23')](function(_0x57a92c){if(_0x57a92c){return _0x57a92c?{'count':_0x528b40,'rows':_0x57a92c}:null;}})[_0x61ea('0x23')](respondWithResult(_0x3372a5,null))[_0x61ea('0x49')](handleError(_0x3372a5,null));};exports['addTeams']=function(_0x534d29,_0x5f530c,_0x197652){var _0x294ea8=_0x534d29[_0x61ea('0x4b')][_0x61ea('0x68')];var _0x5edab3=_[_0x61ea('0x27')](_0x294ea8,'id');return db[_0x61ea('0x67')][_0x61ea('0x44')]({'where':{'id':_0x5edab3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x61ea('0x2b'),_0x61ea('0x69'),_0x61ea('0x6a'),_0x61ea('0x6b')],'raw':!![]}]})[_0x61ea('0x23')](function(_0x138b74){if(_0x138b74){var _0x40b72d=_['flatMap'](_0x138b74,function(_0x1950af){var _0x27bdbd=_0x1950af[_0x61ea('0x24')]({'plain':!![]});_0x27bdbd[_0x61ea('0x6c')][_0x61ea('0x6d')](function(_0x13eb6){_0x13eb6['penalty']=_[_0x61ea('0x29')](_0x294ea8,{'id':_0x27bdbd['id']})[_0x61ea('0x6e')];});return _0x27bdbd[_0x61ea('0x6c')];});return db['VoiceQueue'][_0x61ea('0x29')]({'where':{'id':_0x534d29[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](function(_0x425528){return db['sequelize'][_0x61ea('0x6f')](function(_0x925dfe){return _0x425528[_0x61ea('0x70')](_0x5edab3,{'transaction':_0x925dfe})[_0x61ea('0x23')](function(){return BPromise[_0x61ea('0x71')](_0x294ea8,function(_0x397e8f){return db[_0x61ea('0x72')]['upsert']({'TeamId':_0x397e8f['id'],'VoiceQueueId':_0x534d29['params']['id'],'penalty':_0x397e8f[_0x61ea('0x6e')]},{'transaction':_0x925dfe});});})[_0x61ea('0x23')](function(){return BPromise[_0x61ea('0x71')](_0x40b72d,function(_0x4c4f89){return db[_0x61ea('0x73')][_0x61ea('0x74')]({'where':{'UserId':_0x4c4f89['id'],'VoiceQueueId':_0x534d29[_0x61ea('0x47')]['id']},'defaults':{'penalty':_0x4c4f89[_0x61ea('0x6e')]},'transaction':_0x925dfe});});})['then'](function(){return BPromise[_0x61ea('0x71')](_[_0x61ea('0x3f')](_0x40b72d,{'online':!![]}),function(_0x1e0954){return db[_0x61ea('0x75')][_0x61ea('0x76')]({'membername':_0x1e0954[_0x61ea('0x2b')],'UserId':_0x1e0954['id'],'queue_name':_0x425528[_0x61ea('0x2b')],'VoiceQueueId':_0x425528['id'],'interface':_['isNil'](_0x1e0954[_0x61ea('0x6b')])?util[_0x61ea('0x77')](_0x61ea('0x78'),_0x1e0954[_0x61ea('0x2b')]):_0x1e0954[_0x61ea('0x6b')],'paused':_0x1e0954[_0x61ea('0x6a')]||![],'penalty':_0x1e0954[_0x61ea('0x6e')]},{'transaction':_0x925dfe});});})[_0x61ea('0x23')](function(){_0x40b72d[_0x61ea('0x6d')](function(_0x2550ea){socket[_0x61ea('0x79')](_0x61ea('0x7a'),{'UserId':_0x2550ea['id'],'VoiceQueueId':_0x425528['id']});});});});});}})[_0x61ea('0x23')](respondWithStatusCode(_0x5f530c,null))[_0x61ea('0x49')](handleError(_0x5f530c,null));};exports[_0x61ea('0x7b')]=function(_0x5bad2a,_0x21c71d,_0x1d3fd9){return db[_0x61ea('0x67')][_0x61ea('0x44')]({'where':{'id':_0x5bad2a[_0x61ea('0x35')][_0x61ea('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x61ea('0x7d')],'as':_0x61ea('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x61ea('0x23')](handleEntityNotFound(_0x21c71d,null))[_0x61ea('0x23')](function(_0x2be850){var _0x2c12d5=_[_0x61ea('0x27')](_0x2be850,'id');var _0x24e415=[];var _0x4df29e=[];var _0x167e55=squel[_0x61ea('0x7e')]();_0x167e55[_0x61ea('0x7f')](_0x61ea('0x80'))['from'](_0x61ea('0x81'),'tq')[_0x61ea('0x82')](_0x61ea('0x83'),'ut',_0x61ea('0x84'))[_0x61ea('0x3e')](_0x61ea('0x85'),_0x5bad2a[_0x61ea('0x47')]['id']);for(var _0x149612=0x0;_0x149612<_0x2be850[_0x61ea('0x55')];_0x149612+=0x1){let _0x344afa=_0x2be850[_0x149612];for(var _0x3c78f4=0x0;_0x3c78f4<_0x344afa['Agents']['length'];_0x3c78f4+=0x1){let _0x33449d=_0x344afa[_0x61ea('0x6c')][_0x3c78f4];var _0x5b6b09=_0x167e55[_0x61ea('0x54')]();_0x5b6b09[_0x61ea('0x3e')](_0x61ea('0x86'),_0x33449d['id']);_0x4df29e[_0x61ea('0x87')](db[_0x61ea('0x88')]['query'](_0x5b6b09['toString'](),{'type':db[_0x61ea('0x88')][_0x61ea('0x89')]['SELECT']})['then'](function(_0x13c471){if(_0x13c471[_0x61ea('0x55')]===0x1){return _0x33449d['id'];}else{var _0x19ec38=_[_0x61ea('0x8a')](_[_0x61ea('0x27')](_0x13c471,_0x61ea('0x8b')),function(_0x1900cc){return _[_0x61ea('0x8c')](_0x2c12d5,_0x1900cc);});if(_0x19ec38){return _0x33449d['id'];}}}));}}return BPromise[_0x61ea('0x8d')](_0x4df29e)['then'](function(_0x2e751a){_0x24e415=_(_0x24e415)[_0x61ea('0x8e')](_0x2e751a)['compact']()[_0x61ea('0x28')]();return db[_0x61ea('0x42')][_0x61ea('0x29')]({'where':{'id':_0x5bad2a[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](function(_0x1949dc){return db[_0x61ea('0x88')][_0x61ea('0x6f')](function(_0x3fa7c3){return _0x1949dc[_0x61ea('0x7b')](_0x5bad2a[_0x61ea('0x35')][_0x61ea('0x7c')],{'transaction':_0x3fa7c3})[_0x61ea('0x23')](function(){if(!_[_0x61ea('0x8f')](_0x24e415)){return _0x1949dc[_0x61ea('0x90')](_0x24e415,{'transaction':_0x3fa7c3})[_0x61ea('0x23')](function(){return db[_0x61ea('0x75')][_0x61ea('0x2d')]({'where':{'VoiceQueueId':_0x5bad2a[_0x61ea('0x47')]['id'],'UserId':_0x24e415},'transaction':_0x3fa7c3});});}})[_0x61ea('0x23')](function(){_0x24e415[_0x61ea('0x6d')](function(_0x2f0d3c){socket[_0x61ea('0x79')]('userVoiceQueue:remove',{'UserId':_0x2f0d3c,'VoiceQueueId':_0x1949dc['id']});});});});});});})[_0x61ea('0x23')](respondWithStatusCode(_0x21c71d,null))[_0x61ea('0x49')](handleError(_0x21c71d,null));};exports[_0x61ea('0x91')]=function(_0x3a5a39,_0x16a64e,_0x3b5d0d){var _0x2bc35b,_0x1be583;return db[_0x61ea('0x42')][_0x61ea('0x29')]({'where':{'id':_0x3a5a39[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0x16a64e,null))[_0x61ea('0x23')](function(_0x464e24){if(_0x464e24){_0x1be583=_0x464e24;return _0x464e24[_0x61ea('0x91')](_0x3a5a39['body']['ids'],_[_0x61ea('0x56')](_0x3a5a39[_0x61ea('0x4b')],[_0x61ea('0x7c'),'id'])||{})[_0x61ea('0x92')](function(_0x270c33){for(var _0x2a7362=0x0;_0x2a7362<_0x3a5a39['body'][_0x61ea('0x7c')][_0x61ea('0x55')];_0x2a7362+=0x1){socket[_0x61ea('0x79')](_0x61ea('0x7a'),{'UserId':_0x3a5a39[_0x61ea('0x4b')]['ids'][_0x2a7362],'VoiceQueueId':_0x3a5a39['params']['id']});}return _0x270c33;});}})[_0x61ea('0x23')](function(_0x515f86){_0x2bc35b=_0x515f86||[];if(_0x1be583){return db[_0x61ea('0x7d')][_0x61ea('0x44')]({'where':{'id':_0x3a5a39[_0x61ea('0x4b')][_0x61ea('0x7c')]},'attributes':['id',_0x61ea('0x2b'),'online','voicePause','interface'],'raw':!![]});}})['then'](function(_0x249229){if(!_[_0x61ea('0x8f')](_0x249229)){var _0x46559c=[];for(var _0x2b1616=0x0;_0x2b1616<_0x249229[_0x61ea('0x55')];_0x2b1616++){if(_0x249229[_0x2b1616][_0x61ea('0x69')]){_0x46559c[_0x61ea('0x87')](db[_0x61ea('0x75')][_0x61ea('0x76')]({'membername':_0x249229[_0x2b1616][_0x61ea('0x2b')],'UserId':_0x249229[_0x2b1616]['id'],'queue_name':_0x1be583[_0x61ea('0x2b')],'VoiceQueueId':_0x1be583['id'],'interface':_['isNil'](_0x249229[_0x2b1616]['interface'])?util[_0x61ea('0x77')](_0x61ea('0x78'),_0x249229[_0x2b1616][_0x61ea('0x2b')]):_0x249229[_0x2b1616][_0x61ea('0x6b')],'paused':_0x249229[_0x2b1616][_0x61ea('0x6a')]||![],'penalty':_0x3a5a39['body']['penalty']||0x0}));}}return BPromise['all'](_0x46559c);}})[_0x61ea('0x23')](function(){return _0x2bc35b;})[_0x61ea('0x23')](respondWithResult(_0x16a64e,null))[_0x61ea('0x49')](handleError(_0x16a64e,null));};exports['removeAgents']=function(_0x3a6aa4,_0x5609d6,_0x1b5ec8){return db['VoiceQueue'][_0x61ea('0x29')]({'where':{'id':_0x3a6aa4[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0x5609d6,null))[_0x61ea('0x23')](function(_0x47b2d5){if(_0x47b2d5){return _0x47b2d5[_0x61ea('0x90')](_0x3a6aa4[_0x61ea('0x35')][_0x61ea('0x7c')])[_0x61ea('0x23')](function(){if(_['isArray'](_0x3a6aa4[_0x61ea('0x35')]['ids'])){for(var _0x49790b=0x0;_0x49790b<_0x3a6aa4[_0x61ea('0x35')][_0x61ea('0x7c')][_0x61ea('0x55')];_0x49790b+=0x1){socket['emit'](_0x61ea('0x93'),{'UserId':Number(_0x3a6aa4[_0x61ea('0x35')][_0x61ea('0x7c')][_0x49790b]),'VoiceQueueId':Number(_0x3a6aa4[_0x61ea('0x47')]['id'])});}}else{socket[_0x61ea('0x79')](_0x61ea('0x93'),{'UserId':Number(_0x3a6aa4[_0x61ea('0x35')]['ids']),'VoiceQueueId':Number(_0x3a6aa4['params']['id'])});}});}})['then'](function(_0x269fc1){return db['UserVoiceQueueRt'][_0x61ea('0x2d')]({'where':{'VoiceQueueId':_0x3a6aa4['params']['id'],'UserId':_0x3a6aa4[_0x61ea('0x35')][_0x61ea('0x7c')]}})[_0x61ea('0x23')](function(){return _0x269fc1;});})[_0x61ea('0x23')](respondWithStatusCode(_0x5609d6,null))[_0x61ea('0x49')](handleError(_0x5609d6,null));};exports[_0x61ea('0x94')]=function(_0x2b5953,_0x3ef44f,_0x268f53){var _0x576a3e={};var _0x7e73c3={};var _0x1471a6;var _0x1e0301;return db[_0x61ea('0x42')][_0x61ea('0x5c')]({'where':{'id':_0x2b5953[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0x3ef44f,null))['then'](function(_0x32b492){if(_0x32b492){_0x1471a6=_0x32b492;_0x7e73c3['model']=_[_0x61ea('0x36')](db[_0x61ea('0x7d')][_0x61ea('0x31')]);_0x7e73c3['query']=_[_0x61ea('0x36')](_0x2b5953[_0x61ea('0x35')]);_0x7e73c3[_0x61ea('0x37')]=_[_0x61ea('0x38')](_0x7e73c3[_0x61ea('0x34')],_0x7e73c3[_0x61ea('0x35')]);_0x576a3e[_0x61ea('0x3a')]=_['intersection'](_0x7e73c3['model'],qs[_0x61ea('0x39')](_0x2b5953[_0x61ea('0x35')]['fields']));_0x576a3e[_0x61ea('0x3a')]=_0x576a3e['attributes'][_0x61ea('0x55')]?_0x576a3e[_0x61ea('0x3a')]:_0x7e73c3[_0x61ea('0x34')];_0x576a3e[_0x61ea('0x5d')]=qs[_0x61ea('0x3d')](_0x2b5953[_0x61ea('0x35')]['sort']);_0x576a3e[_0x61ea('0x3e')]=qs[_0x61ea('0x37')](_[_0x61ea('0x5e')](_0x2b5953[_0x61ea('0x35')],_0x7e73c3['filters']));if(_0x2b5953[_0x61ea('0x35')][_0x61ea('0x3f')]){_0x576a3e[_0x61ea('0x3e')]=_['merge'](_0x576a3e[_0x61ea('0x3e')],{'$or':_[_0x61ea('0x27')](_0x576a3e['attributes'],function(_0x2a1c18){var _0x18028f={};_0x18028f[_0x2a1c18]={'$like':'%'+_0x2b5953[_0x61ea('0x35')][_0x61ea('0x3f')]+'%'};return _0x18028f;})});}_0x576a3e=_['merge']({},_0x576a3e,_0x2b5953[_0x61ea('0x41')]);return _0x1471a6[_0x61ea('0x94')](_0x576a3e);}})[_0x61ea('0x23')](function(_0x33c687){if(_0x33c687){_0x1e0301=_0x33c687[_0x61ea('0x55')];if(!_0x2b5953[_0x61ea('0x35')]['hasOwnProperty'](_0x61ea('0x3c'))){_0x576a3e[_0x61ea('0x1e')]=qs[_0x61ea('0x1e')](_0x2b5953[_0x61ea('0x35')]['limit']);_0x576a3e['offset']=qs[_0x61ea('0x1c')](_0x2b5953[_0x61ea('0x35')][_0x61ea('0x1c')]);}return _0x1471a6['getAgents'](_0x576a3e);}})[_0x61ea('0x23')](function(_0x2cb790){if(_0x2cb790){return _0x2cb790?{'count':_0x1e0301,'rows':_0x2cb790}:null;}})[_0x61ea('0x23')](respondWithResult(_0x3ef44f,null))['catch'](handleError(_0x3ef44f,null));};exports[_0x61ea('0x95')]=function(_0x38919e,_0x37b0c2,_0x2e02a){var _0x369cf5={};var _0x3e3cbb={};var _0x39b87d;var _0x4e9d95;return db['VoiceQueue'][_0x61ea('0x5c')]({'where':{'id':_0x38919e['params']['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0x37b0c2,null))[_0x61ea('0x23')](function(_0x32e6ce){if(_0x32e6ce){_0x39b87d=_0x32e6ce;_0x3e3cbb[_0x61ea('0x34')]=_[_0x61ea('0x36')](db[_0x61ea('0x75')][_0x61ea('0x31')]);_0x3e3cbb[_0x61ea('0x35')]=_[_0x61ea('0x36')](_0x38919e[_0x61ea('0x35')]);_0x3e3cbb[_0x61ea('0x37')]=_[_0x61ea('0x38')](_0x3e3cbb[_0x61ea('0x34')],_0x3e3cbb[_0x61ea('0x35')]);_0x369cf5['attributes']=_[_0x61ea('0x38')](_0x3e3cbb[_0x61ea('0x34')],qs[_0x61ea('0x39')](_0x38919e[_0x61ea('0x35')][_0x61ea('0x39')]));_0x369cf5[_0x61ea('0x3a')]=_0x369cf5[_0x61ea('0x3a')][_0x61ea('0x55')]?_0x369cf5[_0x61ea('0x3a')]:_0x3e3cbb['model'];_0x369cf5[_0x61ea('0x5d')]=qs[_0x61ea('0x3d')](_0x38919e[_0x61ea('0x35')][_0x61ea('0x3d')]);_0x369cf5['where']=qs['filters'](_[_0x61ea('0x5e')](_0x38919e[_0x61ea('0x35')],_0x3e3cbb[_0x61ea('0x37')]));if(_0x38919e['query'][_0x61ea('0x3f')]){_0x369cf5['where']=_[_0x61ea('0x40')](_0x369cf5[_0x61ea('0x3e')],{'$or':_['map'](_0x369cf5[_0x61ea('0x3a')],function(_0x53fb5b){var _0x410be2={};_0x410be2[_0x53fb5b]={'$like':'%'+_0x38919e[_0x61ea('0x35')][_0x61ea('0x3f')]+'%'};return _0x410be2;})});}_0x369cf5=_[_0x61ea('0x40')]({},_0x369cf5,_0x38919e[_0x61ea('0x41')]);return _0x39b87d[_0x61ea('0x95')](_0x369cf5);}})[_0x61ea('0x23')](function(_0x35a0f4){if(_0x35a0f4){_0x4e9d95=_0x35a0f4[_0x61ea('0x55')];if(!_0x38919e['query'][_0x61ea('0x3b')](_0x61ea('0x3c'))){_0x369cf5[_0x61ea('0x1e')]=qs[_0x61ea('0x1e')](_0x38919e[_0x61ea('0x35')][_0x61ea('0x1e')]);_0x369cf5[_0x61ea('0x1c')]=qs[_0x61ea('0x1c')](_0x38919e[_0x61ea('0x35')][_0x61ea('0x1c')]);}return _0x39b87d['getMembers'](_0x369cf5);}})[_0x61ea('0x23')](function(_0x30fe9f){return _0x30fe9f?{'count':_0x4e9d95,'rows':_0x30fe9f}:null;})[_0x61ea('0x23')](respondWithResult(_0x37b0c2,null))[_0x61ea('0x49')](handleError(_0x37b0c2,null));};exports[_0x61ea('0x96')]=function(_0x913b5e,_0x155240,_0xe32ea5){var _0x52d9d6={};var _0xa5e00={};var _0x58178b;var _0x1a2e62;return db[_0x61ea('0x42')][_0x61ea('0x5c')]({'where':{'id':_0x913b5e['params']['id']}})['then'](handleEntityNotFound(_0x155240,null))[_0x61ea('0x23')](function(_0x4ac095){if(_0x4ac095){_0x58178b=_0x4ac095;_0xa5e00[_0x61ea('0x34')]=_[_0x61ea('0x36')](db['CmList']['rawAttributes']);_0xa5e00[_0x61ea('0x35')]=_[_0x61ea('0x36')](_0x913b5e['query']);_0xa5e00[_0x61ea('0x37')]=_[_0x61ea('0x38')](_0xa5e00[_0x61ea('0x34')],_0xa5e00[_0x61ea('0x35')]);_0x52d9d6[_0x61ea('0x3a')]=_['intersection'](_0xa5e00['model'],qs[_0x61ea('0x39')](_0x913b5e[_0x61ea('0x35')][_0x61ea('0x39')]));_0x52d9d6['attributes']=_0x52d9d6['attributes'][_0x61ea('0x55')]?_0x52d9d6[_0x61ea('0x3a')]:_0xa5e00[_0x61ea('0x34')];_0x52d9d6[_0x61ea('0x5d')]=qs['sort'](_0x913b5e['query'][_0x61ea('0x3d')]);_0x52d9d6['where']=qs['filters'](_['pick'](_0x913b5e[_0x61ea('0x35')],_0xa5e00['filters']));if(_0x913b5e[_0x61ea('0x35')][_0x61ea('0x3f')]){_0x52d9d6[_0x61ea('0x3e')]=_[_0x61ea('0x40')](_0x52d9d6[_0x61ea('0x3e')],{'$or':_[_0x61ea('0x27')](_0x52d9d6['attributes'],function(_0x3835ad){var _0x20a2dd={};_0x20a2dd[_0x3835ad]={'$like':'%'+_0x913b5e['query']['filter']+'%'};return _0x20a2dd;})});}_0x52d9d6=_['merge']({},_0x52d9d6,_0x913b5e[_0x61ea('0x41')]);return _0x58178b[_0x61ea('0x96')](_0x52d9d6);}})[_0x61ea('0x23')](function(_0x474136){if(_0x474136){_0x1a2e62=_0x474136[_0x61ea('0x55')];if(!_0x913b5e['query'][_0x61ea('0x3b')]('nolimit')){_0x52d9d6['limit']=qs[_0x61ea('0x1e')](_0x913b5e['query'][_0x61ea('0x1e')]);_0x52d9d6[_0x61ea('0x1c')]=qs['offset'](_0x913b5e[_0x61ea('0x35')][_0x61ea('0x1c')]);}return _0x58178b[_0x61ea('0x96')](_0x52d9d6);}})[_0x61ea('0x23')](function(_0x27f99a){if(_0x27f99a){return _0x27f99a?{'count':_0x1a2e62,'rows':_0x27f99a}:null;}})[_0x61ea('0x23')](respondWithResult(_0x155240,null))[_0x61ea('0x49')](handleError(_0x155240,null));};exports[_0x61ea('0x97')]=function(_0x3b3cf4,_0x29dab0,_0x274282){var _0x3906c2,_0x3d3cf0;var _0x41b087=[];var _0x143cff=moment()[_0x61ea('0x77')]('YYYY-MM-DD\x20HH:mm:ss');return db['VoiceQueue']['find']({'where':{'id':_0x3b3cf4[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0x29dab0,null))[_0x61ea('0x23')](function(_0x39ef78){if(_0x39ef78){_0x3d3cf0=_0x39ef78;return _0x39ef78[_0x61ea('0x97')](_0x3b3cf4[_0x61ea('0x4b')]['ids'],_[_0x61ea('0x56')](_0x3b3cf4[_0x61ea('0x4b')],['ids','id'])||{});}return null;})[_0x61ea('0x92')](function(_0x354e3e){var _0x2c7504;var _0x285904;_0x3906c2=_0x354e3e||[];var _0x38c6cc=[];if(_0x354e3e){for(var _0x3bd055=0x0;_0x3bd055<_0x354e3e[_0x61ea('0x55')];_0x3bd055+=0x1){var _0x5d2e07=_0x354e3e[_0x3bd055][_0x61ea('0x24')]({'plain':!![]});_0x3d3cf0[_0x61ea('0x98')]=_0x3b3cf4[_0x61ea('0x4b')][_0x61ea('0x98')]?_0x3b3cf4[_0x61ea('0x4b')][_0x61ea('0x98')]:_0x3d3cf0[_0x61ea('0x98')];switch(_0x3d3cf0['dialCheckDuplicateType']){case _0x61ea('0x99'):_0x2c7504=squel[_0x61ea('0x9a')]()['into'](_0x61ea('0x9b'))[_0x61ea('0x9c')]([_0x61ea('0x9d'),_0x61ea('0x9e'),_0x61ea('0x9f'),_0x61ea('0xa0'),_0x61ea('0x61'),_0x61ea('0x57'),_0x61ea('0x58')],squel[_0x61ea('0x7e')]()['field']('phone',_0x61ea('0x9d'))[_0x61ea('0x7f')](_0x61ea('0xa1'),'scheduledAt')['field']('id','ContactId')['field'](_0x5d2e07['CmListId'][_0x61ea('0xa2')](),_0x61ea('0xa0'))['field'](_0x3b3cf4[_0x61ea('0x47')]['id'][_0x61ea('0xa2')](),_0x61ea('0x61'))[_0x61ea('0x7f')]('\x27'+_0x143cff+'\x27',_0x61ea('0x57'))[_0x61ea('0x7f')]('\x27'+_0x143cff+'\x27',_0x61ea('0x58'))[_0x61ea('0xa3')](_0x61ea('0xa4'))[_0x61ea('0x3e')](_0x61ea('0xa5'))[_0x61ea('0x3e')](_0x61ea('0xa6'),_0x5d2e07['CmListId'][_0x61ea('0xa2')]())[_0x61ea('0x3e')](_0x61ea('0xa7'))[_0x61ea('0x3e')](_0x61ea('0xa8'),squel['select']()['field'](_0x61ea('0xa9'))[_0x61ea('0xa3')]('cm_hopper_final')[_0x61ea('0x3e')](_0x61ea('0x85'),_0x3b3cf4[_0x61ea('0x47')]['id'][_0x61ea('0xa2')]()))[_0x61ea('0x3e')](_0x61ea('0xa8'),squel['select']()[_0x61ea('0x7f')](_0x61ea('0xaa'))['from']('cm_hopper')[_0x61ea('0x3e')](_0x61ea('0x85'),_0x3b3cf4[_0x61ea('0x47')]['id']['toString']())))[_0x61ea('0xa2')]();break;case _0x61ea('0xab'):_0x2c7504=squel['insert']()['into'](_0x61ea('0x9b'))[_0x61ea('0x9c')]([_0x61ea('0x9d'),'scheduledAt',_0x61ea('0x9f'),_0x61ea('0xa0'),_0x61ea('0x61'),_0x61ea('0x57'),_0x61ea('0x58')],squel[_0x61ea('0x7e')]()[_0x61ea('0x7f')](_0x61ea('0x9d'),_0x61ea('0x9d'))[_0x61ea('0x7f')](_0x61ea('0xa1'),_0x61ea('0x9e'))['field']('id',_0x61ea('0x9f'))[_0x61ea('0x7f')](_0x5d2e07[_0x61ea('0xac')]['toString'](),'ListId')[_0x61ea('0x7f')](_0x3b3cf4[_0x61ea('0x47')]['id'][_0x61ea('0xa2')](),'VoiceQueueId')['field']('\x27'+_0x143cff+'\x27',_0x61ea('0x57'))['field']('\x27'+_0x143cff+'\x27',_0x61ea('0x58'))[_0x61ea('0xa3')](_0x61ea('0xa4'))[_0x61ea('0x3e')](_0x61ea('0xa5'))[_0x61ea('0x3e')](_0x61ea('0xa6'),_0x5d2e07[_0x61ea('0xac')][_0x61ea('0xa2')]())[_0x61ea('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x61ea('0x3e')](_0x61ea('0xa8'),squel['select']()['field'](_0x61ea('0xaa'))[_0x61ea('0xa3')]('cm_hopper')[_0x61ea('0x3e')](_0x61ea('0x85'),_0x3b3cf4[_0x61ea('0x47')]['id'][_0x61ea('0xa2')]())))[_0x61ea('0xa2')]();break;default:_0x2c7504=squel[_0x61ea('0x9a')]()[_0x61ea('0xad')](_0x61ea('0x9b'))[_0x61ea('0x9c')]([_0x61ea('0x9d'),_0x61ea('0x9e'),_0x61ea('0x9f'),_0x61ea('0xa0'),_0x61ea('0x61'),_0x61ea('0x57'),_0x61ea('0x58')],squel[_0x61ea('0x7e')]()['field']('phone',_0x61ea('0x9d'))[_0x61ea('0x7f')]('NOW()',_0x61ea('0x9e'))[_0x61ea('0x7f')]('id',_0x61ea('0x9f'))['field'](_0x5d2e07[_0x61ea('0xac')][_0x61ea('0xa2')](),_0x61ea('0xa0'))[_0x61ea('0x7f')](_0x3b3cf4[_0x61ea('0x47')]['id'][_0x61ea('0xa2')](),_0x61ea('0x61'))[_0x61ea('0x7f')]('\x27'+_0x143cff+'\x27',_0x61ea('0x57'))[_0x61ea('0x7f')]('\x27'+_0x143cff+'\x27',_0x61ea('0x58'))[_0x61ea('0xa3')](_0x61ea('0xa4'))[_0x61ea('0x3e')]('deletedAt\x20IS\x20NULL')[_0x61ea('0x3e')](_0x61ea('0xa6'),_0x5d2e07['CmListId'][_0x61ea('0xa2')]())[_0x61ea('0x3e')](_0x61ea('0xa7')))[_0x61ea('0xa2')]();}_0x285904=squel['insert']()[_0x61ea('0xad')](_0x61ea('0xae'))[_0x61ea('0x9c')]([_0x61ea('0xaf'),_0x61ea('0x9e'),'phone',_0x61ea('0xb0'),_0x61ea('0x57'),_0x61ea('0x58')],squel[_0x61ea('0x7e')]()[_0x61ea('0x7f')](_0x61ea('0xb1'),'id')[_0x61ea('0x7f')](_0x61ea('0xa1'),'scheduledAt')[_0x61ea('0x7f')](_0x61ea('0xb2'),'phone')['field'](_0x61ea('0xb3'),_0x61ea('0xb0'))[_0x61ea('0x7f')]('\x27'+_0x143cff+'\x27',_0x61ea('0x57'))[_0x61ea('0x7f')]('\x27'+_0x143cff+'\x27',_0x61ea('0x58'))[_0x61ea('0xa3')](_0x61ea('0xb4'),'ci')[_0x61ea('0x82')](_0x61ea('0x9b'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x61ea('0x3e')](_0x61ea('0xb5'),_0x5d2e07[_0x61ea('0xac')][_0x61ea('0xa2')]())['where'](_0x61ea('0xb6'),_0x3b3cf4[_0x61ea('0x47')]['id'][_0x61ea('0xa2')]())['where'](_0x61ea('0xb7'),_0x143cff))[_0x61ea('0xa2')]();_0x38c6cc['push'](db[_0x61ea('0x88')][_0x61ea('0x35')](_0x2c7504));_0x41b087[_0x61ea('0x87')](db['sequelize']['query'](_0x285904));}return BPromise[_0x61ea('0x8d')](_0x38c6cc);}})[_0x61ea('0x23')](function(){return BPromise['all'](_0x41b087);})[_0x61ea('0x23')](function(){return _0x3906c2;})[_0x61ea('0x23')](respondWithResult(_0x29dab0,null))[_0x61ea('0x49')](handleError(_0x29dab0,null));};exports[_0x61ea('0xb8')]=function(_0x105344,_0x4fd26e,_0x205302){return db['VoiceQueue']['find']({'where':{'id':_0x105344[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0x4fd26e,null))[_0x61ea('0x23')](function(_0x33dfab){if(_0x33dfab){return _0x33dfab[_0x61ea('0xb8')](_0x105344[_0x61ea('0x35')][_0x61ea('0x7c')]);}})[_0x61ea('0x23')](function(_0x34c6da){if(_0x34c6da){return db[_0x61ea('0xb9')]['destroy']({'where':{'ListId':_0x105344[_0x61ea('0x35')][_0x61ea('0x7c')],'VoiceQueueId':_0x105344[_0x61ea('0x47')]['id']}})['then'](function(){return _0x34c6da;});}})[_0x61ea('0x23')](respondWithStatusCode(_0x4fd26e,null))[_0x61ea('0x49')](handleError(_0x4fd26e,null));};exports[_0x61ea('0xba')]=function(_0x57bf9c,_0x289b17,_0x23b24){var _0x18ad5a={};var _0x4c533b={};var _0x10f8ff;var _0x1d591e;return db['VoiceQueue']['findOne']({'where':{'id':_0x57bf9c[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0x289b17,null))[_0x61ea('0x23')](function(_0x341c99){if(_0x341c99){_0x10f8ff=_0x341c99;_0x4c533b[_0x61ea('0x34')]=_['keys'](db['CmList'][_0x61ea('0x31')]);_0x4c533b[_0x61ea('0x35')]=_[_0x61ea('0x36')](_0x57bf9c[_0x61ea('0x35')]);_0x4c533b[_0x61ea('0x37')]=_[_0x61ea('0x38')](_0x4c533b['model'],_0x4c533b['query']);_0x18ad5a[_0x61ea('0x3a')]=_['intersection'](_0x4c533b['model'],qs['fields'](_0x57bf9c[_0x61ea('0x35')][_0x61ea('0x39')]));_0x18ad5a[_0x61ea('0x3a')]=_0x18ad5a[_0x61ea('0x3a')][_0x61ea('0x55')]?_0x18ad5a[_0x61ea('0x3a')]:_0x4c533b[_0x61ea('0x34')];_0x18ad5a[_0x61ea('0x5d')]=qs[_0x61ea('0x3d')](_0x57bf9c[_0x61ea('0x35')][_0x61ea('0x3d')]);_0x18ad5a[_0x61ea('0x3e')]=qs['filters'](_[_0x61ea('0x5e')](_0x57bf9c[_0x61ea('0x35')],_0x4c533b[_0x61ea('0x37')]));if(_0x57bf9c[_0x61ea('0x35')][_0x61ea('0x3f')]){_0x18ad5a['where']=_[_0x61ea('0x40')](_0x18ad5a[_0x61ea('0x3e')],{'$or':_['map'](_0x18ad5a[_0x61ea('0x3a')],function(_0x1e7168){var _0x548103={};_0x548103[_0x1e7168]={'$like':'%'+_0x57bf9c[_0x61ea('0x35')][_0x61ea('0x3f')]+'%'};return _0x548103;})});}_0x18ad5a=_[_0x61ea('0x40')]({},_0x18ad5a,_0x57bf9c[_0x61ea('0x41')]);return _0x10f8ff['getBlackLists'](_0x18ad5a);}})[_0x61ea('0x23')](function(_0x4f4b0e){if(_0x4f4b0e){_0x1d591e=_0x4f4b0e[_0x61ea('0x55')];if(!_0x57bf9c[_0x61ea('0x35')][_0x61ea('0x3b')]('nolimit')){_0x18ad5a['limit']=qs[_0x61ea('0x1e')](_0x57bf9c[_0x61ea('0x35')][_0x61ea('0x1e')]);_0x18ad5a[_0x61ea('0x1c')]=qs['offset'](_0x57bf9c[_0x61ea('0x35')][_0x61ea('0x1c')]);}return _0x10f8ff[_0x61ea('0xba')](_0x18ad5a);}})[_0x61ea('0x23')](function(_0x5a7839){if(_0x5a7839){return _0x5a7839?{'count':_0x1d591e,'rows':_0x5a7839}:null;}})[_0x61ea('0x23')](respondWithResult(_0x289b17,null))[_0x61ea('0x49')](handleError(_0x289b17,null));};exports[_0x61ea('0xbb')]=function(_0x5b3142,_0x527ecc,_0x2e71d3){var _0x1a9619,_0x40df81;var _0x3079ac=[];var _0x7ea27c=moment()[_0x61ea('0x77')](_0x61ea('0xbc'));return db[_0x61ea('0x42')][_0x61ea('0x29')]({'where':{'id':_0x5b3142[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0x527ecc,null))[_0x61ea('0x23')](function(_0x18116f){if(_0x18116f){_0x40df81=_0x18116f;return _0x18116f[_0x61ea('0xbb')](_0x5b3142[_0x61ea('0x4b')][_0x61ea('0x7c')],_['omit'](_0x5b3142['body'],[_0x61ea('0x7c'),'id'])||{});}return null;})['spread'](function(_0x197b60){var _0x1f8453;var _0x46de49;_0x1a9619=_0x197b60||[];var _0x4706d5=[];if(_0x197b60){for(var _0x4d64ba=0x0;_0x4d64ba<_0x197b60[_0x61ea('0x55')];_0x4d64ba+=0x1){var _0x41ed87=_0x197b60[_0x4d64ba]['get']({'plain':!![]});_0x1f8453=squel[_0x61ea('0x9a')]()[_0x61ea('0xad')](_0x61ea('0xbd'))['fromQuery']([_0x61ea('0x9d'),'ContactId','ListId',_0x61ea('0x61'),'createdAt','updatedAt'],squel[_0x61ea('0x7e')]()[_0x61ea('0x7f')]('phone',_0x61ea('0x9d'))['field']('id',_0x61ea('0x9f'))[_0x61ea('0x7f')](_0x41ed87[_0x61ea('0xac')][_0x61ea('0xa2')](),_0x61ea('0xa0'))[_0x61ea('0x7f')](_0x5b3142[_0x61ea('0x47')]['id'][_0x61ea('0xa2')](),'VoiceQueueId')[_0x61ea('0x7f')](_0x61ea('0xa1'),_0x61ea('0x57'))[_0x61ea('0x7f')](_0x61ea('0xa1'),_0x61ea('0x58'))[_0x61ea('0xa3')](_0x61ea('0xa4'))[_0x61ea('0x3e')]('deletedAt\x20IS\x20NULL')['where'](_0x61ea('0xa6'),_0x41ed87['CmListId'][_0x61ea('0xa2')]())[_0x61ea('0x3e')](_0x61ea('0xa7')))[_0x61ea('0xa2')]();_0x4706d5[_0x61ea('0x87')](db[_0x61ea('0x88')][_0x61ea('0x35')](_0x1f8453));}return BPromise[_0x61ea('0x8d')](_0x4706d5);}})['then'](function(){return _0x1a9619;})[_0x61ea('0x23')](respondWithResult(_0x527ecc,null))[_0x61ea('0x49')](handleError(_0x527ecc,null));};exports[_0x61ea('0xbe')]=function(_0x57ea9f,_0x371b79,_0x3a1e07){return db[_0x61ea('0x42')][_0x61ea('0x29')]({'where':{'id':_0x57ea9f[_0x61ea('0x47')]['id']}})[_0x61ea('0x23')](handleEntityNotFound(_0x371b79,null))['then'](function(_0x2a11a0){if(_0x2a11a0){return _0x2a11a0['removeBlackLists'](_0x57ea9f['query']['ids']);}})['then'](function(_0x5efb4d){if(_0x5efb4d){return db[_0x61ea('0x65')][_0x61ea('0x2d')]({'where':{'ListId':_0x57ea9f[_0x61ea('0x35')][_0x61ea('0x7c')],'VoiceQueueId':_0x57ea9f[_0x61ea('0x47')]['id']}})['then'](function(){return _0x5efb4d;});}})[_0x61ea('0x23')](respondWithStatusCode(_0x371b79,null))[_0x61ea('0x49')](handleError(_0x371b79,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 0761779..c0f2852 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 _0xb514=['setMaxListeners','emit','hook','events','../../mysqldb','VoiceQueue'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xb514,0x1b9));var _0x4b51=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0xb514[_0x2a55f8];return _0x245efd;};'use strict';var EventEmitter=require(_0x4b51('0x0'));var VoiceQueue=require(_0x4b51('0x1'))['db'][_0x4b51('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4b51('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e0179){return function(_0x409d0b,_0x519ef0,_0x49be04){VoiceQueueEvents['emit'](_0x2e0179+':'+_0x409d0b['id'],_0x409d0b);VoiceQueueEvents[_0x4b51('0x4')](_0x2e0179,_0x409d0b);_0x49be04(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x4b51('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x89f6=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x6fb7c2,_0x27d02a){var _0x506651=function(_0x2d719a){while(--_0x2d719a){_0x6fb7c2['push'](_0x6fb7c2['shift']());}};_0x506651(++_0x27d02a);}(_0x89f6,0xe3));var _0x689f=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x89f6[_0x4ae625];return _0x31accf;};'use strict';var EventEmitter=require(_0x689f('0x0'));var VoiceQueue=require(_0x689f('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x689f('0x2')](0x0);var events={'afterCreate':_0x689f('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x59fd94){return function(_0x5b7451,_0x25c57c,_0x442dce){VoiceQueueEvents[_0x689f('0x4')](_0x59fd94+':'+_0x5b7451['id'],_0x5b7451);VoiceQueueEvents['emit'](_0x59fd94,_0x5b7451);_0x442dce(null);};}for(var e in events){if(events[_0x689f('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x689f('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 5ccfe89..9e0b1e8 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 _0xb6de=['define','VoiceQueue','voice_queues','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x2b1864,_0x38097d){var _0x4a6811=function(_0x838350){while(--_0x838350){_0x2b1864['push'](_0x2b1864['shift']());}};_0x4a6811(++_0x38097d);}(_0xb6de,0x9f));var _0xeb6d=function(_0x34b73c,_0xda7e1e){_0x34b73c=_0x34b73c-0x0;var _0x28068a=_0xb6de[_0x34b73c];return _0x28068a;};'use strict';var _=require(_0xeb6d('0x0'));var util=require(_0xeb6d('0x1'));var logger=require('../../config/logger')(_0xeb6d('0x2'));var moment=require(_0xeb6d('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb6d('0x4'));var fs=require('fs');var path=require(_0xeb6d('0x5'));var rimraf=require(_0xeb6d('0x6'));var config=require(_0xeb6d('0x7'));var attributes=require(_0xeb6d('0x8'));module[_0xeb6d('0x9')]=function(_0xe4cf1,_0x169be1){return _0xe4cf1[_0xeb6d('0xa')](_0xeb6d('0xb'),attributes,{'tableName':_0xeb6d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39bc=['lodash','util','api','moment','bluebird','path','../../config/environment','./voiceQueue.attributes','define','voice_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39bc,0xdc));var _0xc39b=function(_0x28b447,_0x2a929d){_0x28b447=_0x28b447-0x0;var _0x82feff=_0x39bc[_0x28b447];return _0x82feff;};'use strict';var _=require(_0xc39b('0x0'));var util=require(_0xc39b('0x1'));var logger=require('../../config/logger')(_0xc39b('0x2'));var moment=require(_0xc39b('0x3'));var BPromise=require(_0xc39b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc39b('0x5'));var rimraf=require('rimraf');var config=require(_0xc39b('0x6'));var attributes=require(_0xc39b('0x7'));module['exports']=function(_0x23f32b,_0xd06b52){return _0x23f32b[_0xc39b('0x8')]('VoiceQueue',attributes,{'tableName':_0xc39b('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 960d902..dbdf5f2 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 _0x2484=['VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceQueue','findAll','options','raw','where','attributes','include','model','map','GetVoiceQueue','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info'];(function(_0x2240d8,_0x413b9f){var _0x12509f=function(_0x42dc08){while(--_0x42dc08){_0x2240d8['push'](_0x2240d8['shift']());}};_0x12509f(++_0x413b9f);}(_0x2484,0x1b9));var _0x4248=function(_0x4a5516,_0x4cf973){_0x4a5516=_0x4a5516-0x0;var _0x161148=_0x2484[_0x4a5516];return _0x161148;};'use strict';var _=require(_0x4248('0x0'));var util=require(_0x4248('0x1'));var moment=require(_0x4248('0x2'));var BPromise=require(_0x4248('0x3'));var rs=require(_0x4248('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4248('0x5'))['db'];var utils=require(_0x4248('0x6'));var logger=require(_0x4248('0x7'))(_0x4248('0x8'));var config=require(_0x4248('0x9'));var jayson=require(_0x4248('0xa'));var client=jayson['client'][_0x4248('0xb')]({'port':0x232a});config[_0x4248('0xc')]=_[_0x4248('0xd')](config[_0x4248('0xc')],{'host':_0x4248('0xe'),'port':0x18eb});var socket=require(_0x4248('0xf'))(new Redis(config[_0x4248('0xc')]));require(_0x4248('0x10'))[_0x4248('0x11')](socket);function respondWithRpcPromise(_0x917eb8,_0x269620,_0x293526){return new BPromise(function(_0x3b6e30,_0x2fef7b){return client[_0x4248('0x12')](_0x917eb8,_0x293526)[_0x4248('0x13')](function(_0x4c626f){logger[_0x4248('0x14')](_0x4248('0x15'),_0x269620,_0x4248('0x16'));logger[_0x4248('0x17')](_0x4248('0x18'),_0x269620,'request\x20sent',JSON[_0x4248('0x19')](_0x4c626f));if(_0x4c626f[_0x4248('0x1a')]){if(_0x4c626f[_0x4248('0x1a')][_0x4248('0x1b')]===0x1f4){logger[_0x4248('0x1a')]('VoiceQueue,\x20%s,\x20%s',_0x269620,_0x4c626f[_0x4248('0x1a')][_0x4248('0x1c')]);return _0x2fef7b(_0x4c626f[_0x4248('0x1a')]['message']);}logger[_0x4248('0x1a')](_0x4248('0x15'),_0x269620,_0x4c626f[_0x4248('0x1a')][_0x4248('0x1c')]);return _0x3b6e30(_0x4c626f[_0x4248('0x1a')][_0x4248('0x1c')]);}else{logger[_0x4248('0x14')](_0x4248('0x15'),_0x269620,_0x4248('0x16'));_0x3b6e30(_0x4c626f['result'][_0x4248('0x1c')]);}})[_0x4248('0x1d')](function(_0x193c96){logger[_0x4248('0x1a')](_0x4248('0x15'),_0x269620,_0x193c96);_0x2fef7b(_0x193c96);});});}exports['GetVoiceQueue']=function(_0x1ba0e2){var _0x19ae7d=this;return new Promise(function(_0x210b50,_0xebd418){return db[_0x4248('0x1e')][_0x4248('0x1f')]({'raw':_0x1ba0e2['options']?_0x1ba0e2[_0x4248('0x20')][_0x4248('0x21')]===undefined?!![]:![]:!![],'where':_0x1ba0e2[_0x4248('0x20')]?_0x1ba0e2['options'][_0x4248('0x22')]||null:null,'attributes':_0x1ba0e2[_0x4248('0x20')]?_0x1ba0e2['options'][_0x4248('0x23')]||null:null,'limit':_0x1ba0e2[_0x4248('0x20')]?_0x1ba0e2[_0x4248('0x20')]['limit']||null:null,'include':_0x1ba0e2[_0x4248('0x20')]?_0x1ba0e2[_0x4248('0x20')][_0x4248('0x24')]?_['map'](_0x1ba0e2[_0x4248('0x20')][_0x4248('0x24')],function(_0x16abfa){return{'model':db[_0x16abfa[_0x4248('0x25')]],'as':_0x16abfa['as'],'attributes':_0x16abfa[_0x4248('0x23')],'include':_0x16abfa['include']?_['map'](_0x16abfa[_0x4248('0x24')],function(_0x116668){return{'model':db[_0x116668[_0x4248('0x25')]],'as':_0x116668['as'],'attributes':_0x116668[_0x4248('0x23')],'include':_0x116668['include']?_[_0x4248('0x26')](_0x116668['include'],function(_0x1274c9){return{'model':db[_0x1274c9[_0x4248('0x25')]],'as':_0x1274c9['as'],'attributes':_0x1274c9[_0x4248('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4248('0x13')](function(_0xc335bf){logger[_0x4248('0x14')](_0x4248('0x27'),_0x1ba0e2);logger['debug'](_0x4248('0x27'),_0x1ba0e2,JSON[_0x4248('0x19')](_0xc335bf));_0x210b50(_0xc335bf);})[_0x4248('0x1d')](function(_0x52dc49){logger[_0x4248('0x1a')](_0x4248('0x27'),_0x52dc49['message'],_0x1ba0e2);_0xebd418(_0x19ae7d[_0x4248('0x1a')](0x1f4,_0x52dc49[_0x4248('0x1c')]));});});};exports[_0x4248('0x28')]=function(_0x11ec6b){var _0x318b66=this;return new Promise(function(_0x26a126,_0x169690){return db['VoiceQueue'][_0x4248('0x29')]({'raw':_0x11ec6b[_0x4248('0x20')]?_0x11ec6b[_0x4248('0x20')][_0x4248('0x21')]===undefined?!![]:![]:!![],'where':_0x11ec6b['options']?_0x11ec6b[_0x4248('0x20')][_0x4248('0x22')]||null:null,'attributes':_0x11ec6b[_0x4248('0x20')]?_0x11ec6b[_0x4248('0x20')][_0x4248('0x23')]||null:null,'include':_0x11ec6b[_0x4248('0x20')]?_0x11ec6b['options'][_0x4248('0x24')]?_[_0x4248('0x26')](_0x11ec6b['options']['include'],function(_0x7ec326){return{'model':db[_0x7ec326[_0x4248('0x25')]],'as':_0x7ec326['as'],'attributes':_0x7ec326[_0x4248('0x23')],'include':_0x7ec326[_0x4248('0x24')]?_['map'](_0x7ec326[_0x4248('0x24')],function(_0x16b4a2){return{'model':db[_0x16b4a2[_0x4248('0x25')]],'as':_0x16b4a2['as'],'attributes':_0x16b4a2['attributes'],'include':_0x16b4a2[_0x4248('0x24')]?_[_0x4248('0x26')](_0x16b4a2[_0x4248('0x24')],function(_0x52f573){return{'model':db[_0x52f573[_0x4248('0x25')]],'as':_0x52f573['as'],'attributes':_0x52f573[_0x4248('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4248('0x13')](function(_0x1d13b1){logger[_0x4248('0x14')](_0x4248('0x28'),_0x11ec6b);logger['debug'](_0x4248('0x28'),_0x11ec6b,JSON['stringify'](_0x1d13b1));_0x26a126(_0x1d13b1);})['catch'](function(_0x5d9ed3){logger[_0x4248('0x1a')](_0x4248('0x28'),_0x5d9ed3[_0x4248('0x1c')],_0x11ec6b);_0x169690(_0x318b66[_0x4248('0x1a')](0x1f4,_0x5d9ed3[_0x4248('0x1c')]));});});}; \ No newline at end of file +var _0x5a86=['find','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceQueue,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueue','findAll','options','raw','where','include','map','model','attributes','ShowVoiceQueue','VoiceQueue'];(function(_0x2ab2f2,_0x40c32a){var _0x521541=function(_0xe0fcd0){while(--_0xe0fcd0){_0x2ab2f2['push'](_0x2ab2f2['shift']());}};_0x521541(++_0x40c32a);}(_0x5a86,0x1c5));var _0x65a8=function(_0x2caa1a,_0x4017b4){_0x2caa1a=_0x2caa1a-0x0;var _0x2b5f1f=_0x5a86[_0x2caa1a];return _0x2b5f1f;};'use strict';var _=require(_0x65a8('0x0'));var util=require(_0x65a8('0x1'));var moment=require(_0x65a8('0x2'));var BPromise=require(_0x65a8('0x3'));var rs=require(_0x65a8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65a8('0x5'))['db'];var utils=require(_0x65a8('0x6'));var logger=require('../../config/logger')(_0x65a8('0x7'));var config=require(_0x65a8('0x8'));var jayson=require(_0x65a8('0x9'));var client=jayson[_0x65a8('0xa')][_0x65a8('0xb')]({'port':0x232a});config[_0x65a8('0xc')]=_[_0x65a8('0xd')](config[_0x65a8('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x65a8('0xe'))(new Redis(config[_0x65a8('0xc')]));require('./voiceQueue.socket')[_0x65a8('0xf')](socket);function respondWithRpcPromise(_0x1a0adf,_0x8e05d0,_0x4aa4ed){return new BPromise(function(_0x2beccf,_0x1b9b81){return client[_0x65a8('0x10')](_0x1a0adf,_0x4aa4ed)[_0x65a8('0x11')](function(_0x43fb9a){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x8e05d0,'request\x20sent');logger[_0x65a8('0x12')](_0x65a8('0x13'),_0x8e05d0,_0x65a8('0x14'),JSON['stringify'](_0x43fb9a));if(_0x43fb9a[_0x65a8('0x15')]){if(_0x43fb9a[_0x65a8('0x15')][_0x65a8('0x16')]===0x1f4){logger[_0x65a8('0x15')](_0x65a8('0x17'),_0x8e05d0,_0x43fb9a[_0x65a8('0x15')][_0x65a8('0x18')]);return _0x1b9b81(_0x43fb9a['error'][_0x65a8('0x18')]);}logger[_0x65a8('0x15')](_0x65a8('0x17'),_0x8e05d0,_0x43fb9a[_0x65a8('0x15')][_0x65a8('0x18')]);return _0x2beccf(_0x43fb9a[_0x65a8('0x15')][_0x65a8('0x18')]);}else{logger[_0x65a8('0x19')](_0x65a8('0x17'),_0x8e05d0,_0x65a8('0x14'));_0x2beccf(_0x43fb9a[_0x65a8('0x1a')][_0x65a8('0x18')]);}})[_0x65a8('0x1b')](function(_0x5bcab6){logger[_0x65a8('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x8e05d0,_0x5bcab6);_0x1b9b81(_0x5bcab6);});});}exports[_0x65a8('0x1c')]=function(_0x475757){var _0x349558=this;return new Promise(function(_0x74e079,_0x135c73){return db['VoiceQueue'][_0x65a8('0x1d')]({'raw':_0x475757['options']?_0x475757[_0x65a8('0x1e')][_0x65a8('0x1f')]===undefined?!![]:![]:!![],'where':_0x475757['options']?_0x475757['options'][_0x65a8('0x20')]||null:null,'attributes':_0x475757['options']?_0x475757[_0x65a8('0x1e')]['attributes']||null:null,'limit':_0x475757[_0x65a8('0x1e')]?_0x475757[_0x65a8('0x1e')]['limit']||null:null,'include':_0x475757[_0x65a8('0x1e')]?_0x475757['options'][_0x65a8('0x21')]?_[_0x65a8('0x22')](_0x475757[_0x65a8('0x1e')][_0x65a8('0x21')],function(_0x100928){return{'model':db[_0x100928[_0x65a8('0x23')]],'as':_0x100928['as'],'attributes':_0x100928['attributes'],'include':_0x100928[_0x65a8('0x21')]?_[_0x65a8('0x22')](_0x100928[_0x65a8('0x21')],function(_0x571198){return{'model':db[_0x571198[_0x65a8('0x23')]],'as':_0x571198['as'],'attributes':_0x571198[_0x65a8('0x24')],'include':_0x571198[_0x65a8('0x21')]?_['map'](_0x571198['include'],function(_0x454325){return{'model':db[_0x454325[_0x65a8('0x23')]],'as':_0x454325['as'],'attributes':_0x454325[_0x65a8('0x24')]};}):[]};}):[]};}):[]:[]})[_0x65a8('0x11')](function(_0x52978f){logger['info'](_0x65a8('0x1c'),_0x475757);logger[_0x65a8('0x12')](_0x65a8('0x1c'),_0x475757,JSON['stringify'](_0x52978f));_0x74e079(_0x52978f);})[_0x65a8('0x1b')](function(_0x100da4){logger[_0x65a8('0x15')](_0x65a8('0x1c'),_0x100da4['message'],_0x475757);_0x135c73(_0x349558['error'](0x1f4,_0x100da4[_0x65a8('0x18')]));});});};exports[_0x65a8('0x25')]=function(_0x3e8dd5){var _0xba0327=this;return new Promise(function(_0x10b6e0,_0x246c37){return db[_0x65a8('0x26')][_0x65a8('0x27')]({'raw':_0x3e8dd5[_0x65a8('0x1e')]?_0x3e8dd5['options']['raw']===undefined?!![]:![]:!![],'where':_0x3e8dd5['options']?_0x3e8dd5[_0x65a8('0x1e')][_0x65a8('0x20')]||null:null,'attributes':_0x3e8dd5[_0x65a8('0x1e')]?_0x3e8dd5[_0x65a8('0x1e')][_0x65a8('0x24')]||null:null,'include':_0x3e8dd5[_0x65a8('0x1e')]?_0x3e8dd5[_0x65a8('0x1e')][_0x65a8('0x21')]?_['map'](_0x3e8dd5['options']['include'],function(_0x59fe70){return{'model':db[_0x59fe70[_0x65a8('0x23')]],'as':_0x59fe70['as'],'attributes':_0x59fe70['attributes'],'include':_0x59fe70[_0x65a8('0x21')]?_[_0x65a8('0x22')](_0x59fe70[_0x65a8('0x21')],function(_0x195fe7){return{'model':db[_0x195fe7[_0x65a8('0x23')]],'as':_0x195fe7['as'],'attributes':_0x195fe7[_0x65a8('0x24')],'include':_0x195fe7[_0x65a8('0x21')]?_[_0x65a8('0x22')](_0x195fe7['include'],function(_0x50a97e){return{'model':db[_0x50a97e[_0x65a8('0x23')]],'as':_0x50a97e['as'],'attributes':_0x50a97e['attributes']};}):[]};}):[]};}):[]:[]})[_0x65a8('0x11')](function(_0x53d685){logger[_0x65a8('0x19')](_0x65a8('0x25'),_0x3e8dd5);logger['debug'](_0x65a8('0x25'),_0x3e8dd5,JSON[_0x65a8('0x28')](_0x53d685));_0x10b6e0(_0x53d685);})[_0x65a8('0x1b')](function(_0x537077){logger['error']('ShowVoiceQueue',_0x537077[_0x65a8('0x18')],_0x3e8dd5);_0x246c37(_0xba0327[_0x65a8('0x15')](0x1f4,_0x537077[_0x65a8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index d9f15d0..2e1b7ab 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 _0xc4e9=['./voiceQueue.events','save','update','emit','register','length'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xc4e9,0x144));var _0x9c4e=function(_0x54fe1c,_0x5d208c){_0x54fe1c=_0x54fe1c-0x0;var _0x460aaa=_0xc4e9[_0x54fe1c];return _0x460aaa;};'use strict';var VoiceQueueEvents=require(_0x9c4e('0x0'));var events=[_0x9c4e('0x1'),'remove',_0x9c4e('0x2')];function createListener(_0x6967f0,_0x3c3268){return function(_0x2b1381){_0x3c3268[_0x9c4e('0x3')](_0x6967f0,_0x2b1381);};}function removeListener(_0x198d91,_0x5b27e7){return function(){VoiceQueueEvents['removeListener'](_0x198d91,_0x5b27e7);};}exports[_0x9c4e('0x4')]=function(_0x433019){for(var _0x110437=0x0,_0x4afb4b=events[_0x9c4e('0x5')];_0x110437<_0x4afb4b;_0x110437++){var _0x334c64=events[_0x110437];var _0x15b0de=createListener('voiceQueue:'+_0x334c64,_0x433019);VoiceQueueEvents['on'](_0x334c64,_0x15b0de);}}; \ No newline at end of file +var _0xf989=['emit','removeListener','register','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x1accb5,_0x36dc61){var _0x3f6291=function(_0x416289){while(--_0x416289){_0x1accb5['push'](_0x1accb5['shift']());}};_0x3f6291(++_0x36dc61);}(_0xf989,0x164));var _0x9f98=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0xf989[_0x30033a];return _0x5e3518;};'use strict';var VoiceQueueEvents=require(_0x9f98('0x0'));var events=[_0x9f98('0x1'),_0x9f98('0x2'),_0x9f98('0x3')];function createListener(_0x815f48,_0x2de5d1){return function(_0xb7fb57){_0x2de5d1[_0x9f98('0x4')](_0x815f48,_0xb7fb57);};}function removeListener(_0x254548,_0x101fb4){return function(){VoiceQueueEvents[_0x9f98('0x5')](_0x254548,_0x101fb4);};}exports[_0x9f98('0x6')]=function(_0x280ac2){for(var _0x1c63c1=0x0,_0x31d816=events['length'];_0x1c63c1<_0x31d816;_0x1c63c1++){var _0x18e88a=events[_0x1c63c1];var _0x5f1016=createListener(_0x9f98('0x7')+_0x18e88a,_0x280ac2);VoiceQueueEvents['on'](_0x18e88a,_0x5f1016);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 9aca98b..a6bd3b6 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 _0x2879=['/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','/describe','isAuthenticated','describe','/index'];(function(_0x324645,_0xdc9c60){var _0x518909=function(_0x48a9f9){while(--_0x48a9f9){_0x324645['push'](_0x324645['shift']());}};_0x518909(++_0xdc9c60);}(_0x2879,0x1d6));var _0x9287=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x2879[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x9287('0x0'));var util=require('util');var path=require(_0x9287('0x1'));var timeout=require(_0x9287('0x2'));var express=require(_0x9287('0x3'));var router=express['Router']();var fs_extra=require(_0x9287('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9287('0x5'));var config=require(_0x9287('0x6'));var controller=require(_0x9287('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9287('0x8')]);router[_0x9287('0x9')](_0x9287('0xa'),auth[_0x9287('0xb')](),controller[_0x9287('0xc')]);router[_0x9287('0x9')](_0x9287('0xd'),auth[_0x9287('0xb')](),controller['getVoiceQueuesReport']);router[_0x9287('0x9')](_0x9287('0xe'),auth[_0x9287('0xb')](),controller[_0x9287('0xf')]);router[_0x9287('0x10')]('/',auth[_0x9287('0xb')](),controller[_0x9287('0x11')]);router[_0x9287('0x12')](_0x9287('0xe'),auth[_0x9287('0xb')](),controller['update']);router[_0x9287('0x13')]('/:id',auth[_0x9287('0xb')](),controller[_0x9287('0x14')]);module[_0x9287('0x15')]=router; \ No newline at end of file +var _0x0150=['fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','Router'];(function(_0x1e040e,_0x48c4c4){var _0x43ab59=function(_0x2fa4f1){while(--_0x2fa4f1){_0x1e040e['push'](_0x1e040e['shift']());}};_0x43ab59(++_0x48c4c4);}(_0x0150,0x10f));var _0x0015=function(_0x3e549c,_0x5de883){_0x3e549c=_0x3e549c-0x0;var _0x84ca64=_0x0150[_0x3e549c];return _0x84ca64;};'use strict';var multer=require(_0x0015('0x0'));var util=require(_0x0015('0x1'));var path=require(_0x0015('0x2'));var timeout=require('connect-timeout');var express=require(_0x0015('0x3'));var router=express[_0x0015('0x4')]();var fs_extra=require(_0x0015('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0015('0x6'));var config=require(_0x0015('0x7'));var controller=require(_0x0015('0x8'));router[_0x0015('0x9')]('/',auth[_0x0015('0xa')](),controller['index']);router[_0x0015('0x9')](_0x0015('0xb'),auth[_0x0015('0xa')](),controller[_0x0015('0xc')]);router['get'](_0x0015('0xd'),auth['isAuthenticated'](),controller[_0x0015('0xe')]);router[_0x0015('0x9')](_0x0015('0xf'),auth[_0x0015('0xa')](),controller[_0x0015('0x10')]);router[_0x0015('0x11')]('/',auth['isAuthenticated'](),controller[_0x0015('0x12')]);router[_0x0015('0x13')](_0x0015('0xf'),auth[_0x0015('0xa')](),controller[_0x0015('0x14')]);router['delete'](_0x0015('0xf'),auth[_0x0015('0xa')](),controller[_0x0015('0x15')]);module[_0x0015('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index fd19ee1..2aafdec 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 _0xd8b0=['seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0d8b('0x2')]},'calleridname':{'type':Sequelize[_0x0d8b('0x2')]},'queue':{'type':Sequelize[_0x0d8b('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x0d8b('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x0d8b('0x3')],'set':function(_0x577834){var _0x5e15e6=moment(_0x577834);var _0x3f8b6f=moment(this[_0x0d8b('0x4')](_0x0d8b('0x5')))['format'](_0x0d8b('0x6'));var _0x284169=_0x5e15e6['diff'](_0x3f8b6f,_0x0d8b('0x7'));this[_0x0d8b('0x8')](_0x0d8b('0x9'),_0x577834);this[_0x0d8b('0x8')](_0x0d8b('0xa'),_0x284169||null);}},'position':{'type':Sequelize[_0x0d8b('0xb')]},'count':{'type':Sequelize[_0x0d8b('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0d8b('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x0d8b('0x2')],'comment':_0x0d8b('0xd')},'originalposition':{'type':Sequelize[_0x0d8b('0xb')]},'channel':{'type':Sequelize[_0x0d8b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0d8b('0x2')]},'connectedlinename':{'type':Sequelize[_0x0d8b('0x2')]},'accountcode':{'type':Sequelize[_0x0d8b('0x2')]},'context':{'type':Sequelize[_0x0d8b('0x2')]},'exten':{'type':Sequelize[_0x0d8b('0x2')]},'priority':{'type':Sequelize[_0x0d8b('0x2')]},'holdtime':{'type':Sequelize[_0x0d8b('0xb')]},'mohtime':{'type':Sequelize[_0x0d8b('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0d8b('0x2')]},'transfer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0d8b('0x2')],'comment':_0x0d8b('0xe')},'transferexten':{'type':Sequelize[_0x0d8b('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'secondDisposition':{'type':Sequelize[_0x0d8b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0d8b('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x0d8b('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb7e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x3fadd4,_0x3553ef){var _0x4a7a8c=function(_0x37ca8b){while(--_0x37ca8b){_0x3fadd4['push'](_0x3fadd4['shift']());}};_0x4a7a8c(++_0x3553ef);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b7e('0x3')],'set':function(_0x1d9384){var _0x52047f=moment(_0x1d9384);var _0x53ed64=moment(this[_0x7b7e('0x4')](_0x7b7e('0x5')))[_0x7b7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x42b871=_0x52047f[_0x7b7e('0x7')](_0x53ed64,_0x7b7e('0x8'));this[_0x7b7e('0x9')](_0x7b7e('0xa'),_0x1d9384);this[_0x7b7e('0x9')](_0x7b7e('0xb'),_0x42b871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7b7e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7e('0x2')],'comment':_0x7b7e('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b7e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7b7e('0x2')]},'holdtime':{'type':Sequelize[_0x7b7e('0xc')]},'mohtime':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7e('0xf')},'transferexten':{'type':Sequelize[_0x7b7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize[_0x7b7e('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 2e84ab6..e6f0cb3 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 _0x4961=['length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','describe','rawAttributes','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','update','then','name','index','map','VoiceQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0x4961,0x164));var _0x1496=function(_0x7cdaf4,_0x3071b2){_0x7cdaf4=_0x7cdaf4-0x0;var _0x38f3cb=_0x4961[_0x7cdaf4];return _0x38f3cb;};'use strict';var emlformat=require(_0x1496('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1496('0x1'));var jsonpatch=require(_0x1496('0x2'));var rp=require(_0x1496('0x3'));var moment=require(_0x1496('0x4'));var BPromise=require(_0x1496('0x5'));var Mustache=require('mustache');var util=require(_0x1496('0x6'));var path=require(_0x1496('0x7'));var sox=require(_0x1496('0x8'));var csv=require(_0x1496('0x9'));var ejs=require(_0x1496('0xa'));var fs=require('fs');var fs_extra=require(_0x1496('0xb'));var _=require(_0x1496('0xc'));var squel=require(_0x1496('0xd'));var crypto=require('crypto');var jsforce=require(_0x1496('0xe'));var deskjs=require(_0x1496('0xf'));var toCsv=require(_0x1496('0x9'));var querystring=require(_0x1496('0x10'));var Papa=require(_0x1496('0x11'));var Redis=require(_0x1496('0x12'));var authService=require(_0x1496('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1496('0x14'));var hardwareService=require(_0x1496('0x15'));var logger=require(_0x1496('0x16'))(_0x1496('0x17'));var utils=require(_0x1496('0x18'));var config=require(_0x1496('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1496('0x1a'))['db'];config[_0x1496('0x1b')]=_[_0x1496('0x1c')](config['redis'],{'host':_0x1496('0x1d'),'port':0x18eb});var socket=require(_0x1496('0x1e'))(new Redis(config[_0x1496('0x1b')]));require(_0x1496('0x1f'))[_0x1496('0x20')](socket);function respondWithStatusCode(_0x1e46a6,_0x3ea556){_0x3ea556=_0x3ea556||0xcc;return function(_0x6121e9){if(_0x6121e9){return _0x1e46a6[_0x1496('0x21')](_0x3ea556);}return _0x1e46a6[_0x1496('0x22')](_0x3ea556)[_0x1496('0x23')]();};}function respondWithResult(_0x1332a6,_0xd34b46){_0xd34b46=_0xd34b46||0xc8;return function(_0x1f4ea6){if(_0x1f4ea6){return _0x1332a6[_0x1496('0x22')](_0xd34b46)[_0x1496('0x24')](_0x1f4ea6);}};}function respondWithFilteredResult(_0x40efb1,_0x3dc5de){return function(_0x1abd51){if(_0x1abd51){var _0x5a7a1c=typeof _0x3dc5de[_0x1496('0x25')]==='undefined'&&typeof _0x3dc5de['limit']===_0x1496('0x26');var _0x12b502=_0x1abd51[_0x1496('0x27')];var _0x1c9152=_0x5a7a1c?0x0:_0x3dc5de[_0x1496('0x25')];var _0x2ac89b=_0x5a7a1c?_0x1abd51[_0x1496('0x27')]:_0x3dc5de[_0x1496('0x25')]+_0x3dc5de['limit'];var _0x37c7ae;if(_0x2ac89b>=_0x12b502){_0x2ac89b=_0x12b502;_0x37c7ae=0xc8;}else{_0x37c7ae=0xce;}_0x40efb1[_0x1496('0x22')](_0x37c7ae);return _0x40efb1[_0x1496('0x28')](_0x1496('0x29'),_0x1c9152+'-'+_0x2ac89b+'/'+_0x12b502)['json'](_0x1abd51);}return null;};}function patchUpdates(_0x1ad063){return function(_0x311a8d){try{jsonpatch['apply'](_0x311a8d,_0x1ad063,!![]);}catch(_0x2f17cb){return BPromise[_0x1496('0x2a')](_0x2f17cb);}return _0x311a8d['save']();};}function saveUpdates(_0x12cfe6,_0x175fe2){return function(_0x44de5){if(_0x44de5){return _0x44de5[_0x1496('0x2b')](_0x12cfe6)[_0x1496('0x2c')](function(_0x58bec6){return _0x58bec6;});}return null;};}function removeEntity(_0x3cef33,_0x5e3eb3){return function(_0x3d79b7){if(_0x3d79b7){return _0x3d79b7['destroy']()['then'](function(){_0x3cef33[_0x1496('0x22')](0xcc)[_0x1496('0x23')]();});}};}function handleEntityNotFound(_0x368665,_0x4205b4){return function(_0x2eabb7){if(!_0x2eabb7){_0x368665[_0x1496('0x21')](0x194);}return _0x2eabb7;};}function handleError(_0x453f4a,_0x17ca6d){_0x17ca6d=_0x17ca6d||0x1f4;return function(_0x15aa96){logger['error'](_0x15aa96['stack']);if(_0x15aa96['name']){delete _0x15aa96[_0x1496('0x2d')];}_0x453f4a['status'](_0x17ca6d)['send'](_0x15aa96);};}exports[_0x1496('0x2e')]=function(_0x2c1987,_0x5d4ed5){var _0x3a0e28={},_0x3eac09={},_0x5d5f1a={'count':0x0,'rows':[]};var _0x564953=_[_0x1496('0x2f')](db[_0x1496('0x30')]['rawAttributes'],function(_0x57469f){return{'name':_0x57469f[_0x1496('0x31')],'type':_0x57469f[_0x1496('0x32')][_0x1496('0x33')]};});_0x3eac09[_0x1496('0x34')]=_[_0x1496('0x2f')](_0x564953,_0x1496('0x2d'));_0x3eac09[_0x1496('0x35')]=_[_0x1496('0x36')](_0x2c1987['query']);_0x3eac09[_0x1496('0x37')]=_[_0x1496('0x38')](_0x3eac09[_0x1496('0x34')],_0x3eac09[_0x1496('0x35')]);_0x3a0e28[_0x1496('0x39')]=_[_0x1496('0x38')](_0x3eac09[_0x1496('0x34')],qs['fields'](_0x2c1987[_0x1496('0x35')][_0x1496('0x3a')]));_0x3a0e28[_0x1496('0x39')]=_0x3a0e28[_0x1496('0x39')][_0x1496('0x3b')]?_0x3a0e28[_0x1496('0x39')]:_0x3eac09['model'];if(!_0x2c1987[_0x1496('0x35')][_0x1496('0x3c')](_0x1496('0x3d'))){_0x3a0e28['limit']=qs[_0x1496('0x3e')](_0x2c1987[_0x1496('0x35')][_0x1496('0x3e')]);_0x3a0e28[_0x1496('0x25')]=qs[_0x1496('0x25')](_0x2c1987[_0x1496('0x35')]['offset']);}_0x3a0e28[_0x1496('0x3f')]=qs[_0x1496('0x40')](_0x2c1987[_0x1496('0x35')][_0x1496('0x40')]);_0x3a0e28['where']=qs[_0x1496('0x37')](_[_0x1496('0x41')](_0x2c1987['query'],_0x3eac09['filters']),_0x564953);if(_0x2c1987[_0x1496('0x35')][_0x1496('0x42')]){_0x3a0e28[_0x1496('0x43')]=_[_0x1496('0x44')](_0x3a0e28[_0x1496('0x43')],{'$or':_[_0x1496('0x2f')](_0x564953,function(_0x5bd893){if(_0x5bd893[_0x1496('0x32')]!=='VIRTUAL'){var _0x298ed4={};_0x298ed4[_0x5bd893['name']]={'$like':'%'+_0x2c1987[_0x1496('0x35')]['filter']+'%'};return _0x298ed4;}})});}_0x3a0e28=_[_0x1496('0x44')]({},_0x3a0e28,_0x2c1987[_0x1496('0x45')]);var _0x16ebfb={'where':_0x3a0e28[_0x1496('0x43')]};return db[_0x1496('0x30')][_0x1496('0x27')](_0x16ebfb)['then'](function(_0x424550){_0x5d5f1a[_0x1496('0x27')]=_0x424550;if(_0x2c1987[_0x1496('0x35')][_0x1496('0x46')]){_0x3a0e28[_0x1496('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x1496('0x48')](_0x3a0e28);})[_0x1496('0x2c')](function(_0x9c3f79){_0x5d5f1a[_0x1496('0x49')]=_0x9c3f79;return _0x5d5f1a;})[_0x1496('0x2c')](respondWithFilteredResult(_0x5d4ed5,_0x3a0e28))[_0x1496('0x4a')](handleError(_0x5d4ed5,null));};exports[_0x1496('0x4b')]=function(_0x3d456f,_0x40add8){var _0x436f67={'raw':![],'where':{'id':_0x3d456f[_0x1496('0x4c')]['id']}},_0x3bfc8d={};_0x3bfc8d[_0x1496('0x34')]=_[_0x1496('0x36')](db[_0x1496('0x30')]['rawAttributes']);_0x3bfc8d[_0x1496('0x35')]=_[_0x1496('0x36')](_0x3d456f['query']);_0x3bfc8d[_0x1496('0x37')]=_['intersection'](_0x3bfc8d[_0x1496('0x34')],_0x3bfc8d['query']);_0x436f67[_0x1496('0x39')]=_['intersection'](_0x3bfc8d[_0x1496('0x34')],qs['fields'](_0x3d456f['query']['fields']));_0x436f67[_0x1496('0x39')]=_0x436f67[_0x1496('0x39')]['length']?_0x436f67[_0x1496('0x39')]:_0x3bfc8d[_0x1496('0x34')];if(_0x3d456f[_0x1496('0x35')][_0x1496('0x46')]){_0x436f67[_0x1496('0x47')]=[{'all':!![]}];}_0x436f67=_[_0x1496('0x44')]({},_0x436f67,_0x3d456f[_0x1496('0x45')]);return db[_0x1496('0x30')][_0x1496('0x4d')](_0x436f67)[_0x1496('0x2c')](handleEntityNotFound(_0x40add8,null))[_0x1496('0x2c')](respondWithResult(_0x40add8,null))[_0x1496('0x4a')](handleError(_0x40add8,null));};exports['create']=function(_0x4644c5,_0x406c6f){return db[_0x1496('0x30')]['create'](_0x4644c5[_0x1496('0x4e')],{})[_0x1496('0x2c')](respondWithResult(_0x406c6f,0xc9))[_0x1496('0x4a')](handleError(_0x406c6f,null));};exports['update']=function(_0x106a63,_0x23b287){if(_0x106a63[_0x1496('0x4e')]['id']){delete _0x106a63[_0x1496('0x4e')]['id'];}return db[_0x1496('0x30')][_0x1496('0x4d')]({'where':{'id':_0x106a63['params']['id']}})[_0x1496('0x2c')](handleEntityNotFound(_0x23b287,null))['then'](saveUpdates(_0x106a63[_0x1496('0x4e')],null))[_0x1496('0x2c')](respondWithResult(_0x23b287,null))['catch'](handleError(_0x23b287,null));};exports[_0x1496('0x4f')]=function(_0x434423,_0xdfcb0c){return db[_0x1496('0x30')][_0x1496('0x4d')]({'where':{'id':_0x434423['params']['id']}})['then'](handleEntityNotFound(_0xdfcb0c,null))[_0x1496('0x2c')](removeEntity(_0xdfcb0c,null))[_0x1496('0x4a')](handleError(_0xdfcb0c,null));};exports[_0x1496('0x50')]=function(_0x4e2df7,_0x330c9c){return db['VoiceQueueReport'][_0x1496('0x50')]()[_0x1496('0x2c')](respondWithResult(_0x330c9c,null))[_0x1496('0x4a')](handleError(_0x330c9c,null));};exports['getVoiceQueuesReport']=function(_0x2b5a54,_0x315bf9){var _0x235321={},_0xccb6c1={},_0x52d010={'count':0x0,'rows':[]};_0xccb6c1[_0x1496('0x34')]=_[_0x1496('0x36')](db[_0x1496('0x30')][_0x1496('0x51')]);_0xccb6c1['query']=_['keys'](_0x2b5a54[_0x1496('0x35')]);_0xccb6c1['filters']=_[_0x1496('0x38')](_0xccb6c1[_0x1496('0x34')],_0xccb6c1['query']);_0x235321['attributes']=_[_0x1496('0x38')](_0xccb6c1[_0x1496('0x34')],qs[_0x1496('0x3a')](_0x2b5a54[_0x1496('0x35')][_0x1496('0x3a')]));_0x235321[_0x1496('0x39')]=_0x235321[_0x1496('0x39')][_0x1496('0x3b')]?_0x235321[_0x1496('0x39')]:_0xccb6c1[_0x1496('0x34')];if(!_0x2b5a54[_0x1496('0x35')][_0x1496('0x3c')](_0x1496('0x3d'))){_0x235321[_0x1496('0x3e')]=qs[_0x1496('0x3e')](_0x2b5a54[_0x1496('0x35')]['limit']);_0x235321[_0x1496('0x25')]=qs[_0x1496('0x25')](_0x2b5a54[_0x1496('0x35')][_0x1496('0x25')]);}_0x235321[_0x1496('0x3f')]=qs['sort'](_0x2b5a54[_0x1496('0x35')][_0x1496('0x40')]);_0x235321[_0x1496('0x43')]=qs[_0x1496('0x37')](_[_0x1496('0x41')](_0x2b5a54[_0x1496('0x35')],_0xccb6c1[_0x1496('0x37')]));if(_0x2b5a54[_0x1496('0x35')][_0x1496('0x42')]){_0x235321[_0x1496('0x43')]=_['merge'](_0x235321['where'],{'$or':_[_0x1496('0x2f')](_0x235321[_0x1496('0x39')],function(_0x29e209){var _0x3820f9={};_0x3820f9[_0x29e209]={'$like':'%'+_0x2b5a54[_0x1496('0x35')][_0x1496('0x42')]+'%'};return _0x3820f9;})});}_0x235321=_[_0x1496('0x44')]({},_0x235321,_0x2b5a54[_0x1496('0x45')]);var _0x1f4408={'where':_0x235321[_0x1496('0x43')]};return db[_0x1496('0x30')][_0x1496('0x27')](_0x1f4408)[_0x1496('0x2c')](function(_0x12d06b){_0x52d010['count']=_0x12d06b;if(_0x2b5a54[_0x1496('0x35')][_0x1496('0x46')]){_0x235321['include']=[{'all':!![]}];}return db[_0x1496('0x30')][_0x1496('0x48')](_0x235321);})[_0x1496('0x2c')](function(_0x71c5f4){_0x52d010[_0x1496('0x49')]=_0x71c5f4;return _0x52d010;})['then'](respondWithFilteredResult(_0x315bf9,_0x235321,_0x1496('0x52')))['catch'](handleError(_0x315bf9,null,_0x1496('0x52')));}; \ No newline at end of file +var _0x524b=['../../config/license/util','../../mysqldb','defaults','localhost','redis','./voiceQueueReport.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','create','body','find','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1c4dc7,_0x8dad54){var _0x40743b=function(_0x556b90){while(--_0x556b90){_0x1c4dc7['push'](_0x1c4dc7['shift']());}};_0x40743b(++_0x8dad54);}(_0x524b,0xe9));var _0xb524=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x524b[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0xb524('0x0'));var rimraf=require(_0xb524('0x1'));var zipdir=require(_0xb524('0x2'));var jsonpatch=require(_0xb524('0x3'));var rp=require(_0xb524('0x4'));var moment=require(_0xb524('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb524('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb524('0x7'));var csv=require(_0xb524('0x8'));var ejs=require(_0xb524('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb524('0xa'));var squel=require(_0xb524('0xb'));var crypto=require(_0xb524('0xc'));var jsforce=require(_0xb524('0xd'));var deskjs=require(_0xb524('0xe'));var toCsv=require(_0xb524('0x8'));var querystring=require(_0xb524('0xf'));var Papa=require(_0xb524('0x10'));var Redis=require(_0xb524('0x11'));var authService=require(_0xb524('0x12'));var qs=require(_0xb524('0x13'));var as=require(_0xb524('0x14'));var hardwareService=require(_0xb524('0x15'));var logger=require(_0xb524('0x16'))(_0xb524('0x17'));var utils=require(_0xb524('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb524('0x19'));var db=require(_0xb524('0x1a'))['db'];config['redis']=_[_0xb524('0x1b')](config['redis'],{'host':_0xb524('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb524('0x1d')]));require(_0xb524('0x1e'))[_0xb524('0x1f')](socket);function respondWithStatusCode(_0x63f1f0,_0x1f0aa9){_0x1f0aa9=_0x1f0aa9||0xcc;return function(_0x1b4c2f){if(_0x1b4c2f){return _0x63f1f0[_0xb524('0x20')](_0x1f0aa9);}return _0x63f1f0[_0xb524('0x21')](_0x1f0aa9)['end']();};}function respondWithResult(_0x5d54c5,_0x4a0abe){_0x4a0abe=_0x4a0abe||0xc8;return function(_0x242879){if(_0x242879){return _0x5d54c5[_0xb524('0x21')](_0x4a0abe)[_0xb524('0x22')](_0x242879);}};}function respondWithFilteredResult(_0x1638ea,_0x13504f){return function(_0x129adb){if(_0x129adb){var _0x4d4582=typeof _0x13504f[_0xb524('0x23')]==='undefined'&&typeof _0x13504f[_0xb524('0x24')]===_0xb524('0x25');var _0x49971f=_0x129adb[_0xb524('0x26')];var _0x23987a=_0x4d4582?0x0:_0x13504f[_0xb524('0x23')];var _0x431fad=_0x4d4582?_0x129adb[_0xb524('0x26')]:_0x13504f['offset']+_0x13504f[_0xb524('0x24')];var _0x85999d;if(_0x431fad>=_0x49971f){_0x431fad=_0x49971f;_0x85999d=0xc8;}else{_0x85999d=0xce;}_0x1638ea[_0xb524('0x21')](_0x85999d);return _0x1638ea[_0xb524('0x27')](_0xb524('0x28'),_0x23987a+'-'+_0x431fad+'/'+_0x49971f)['json'](_0x129adb);}return null;};}function patchUpdates(_0x1ec913){return function(_0x4f0831){try{jsonpatch[_0xb524('0x29')](_0x4f0831,_0x1ec913,!![]);}catch(_0xee4bc6){return BPromise[_0xb524('0x2a')](_0xee4bc6);}return _0x4f0831[_0xb524('0x2b')]();};}function saveUpdates(_0x16ca31,_0x3b0ec0){return function(_0x44933d){if(_0x44933d){return _0x44933d[_0xb524('0x2c')](_0x16ca31)[_0xb524('0x2d')](function(_0x4f8508){return _0x4f8508;});}return null;};}function removeEntity(_0x56671c,_0x23e62e){return function(_0x84b022){if(_0x84b022){return _0x84b022[_0xb524('0x2e')]()[_0xb524('0x2d')](function(){_0x56671c[_0xb524('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cf1bc,_0x4bf55a){return function(_0x3bf4e5){if(!_0x3bf4e5){_0x3cf1bc[_0xb524('0x20')](0x194);}return _0x3bf4e5;};}function handleError(_0x49f11e,_0x2cdb1c){_0x2cdb1c=_0x2cdb1c||0x1f4;return function(_0x49c87e){logger[_0xb524('0x2f')](_0x49c87e[_0xb524('0x30')]);if(_0x49c87e[_0xb524('0x31')]){delete _0x49c87e['name'];}_0x49f11e['status'](_0x2cdb1c)[_0xb524('0x32')](_0x49c87e);};}exports[_0xb524('0x33')]=function(_0x35ce5e,_0x39a43a){var _0x303ff6={},_0x5f0fdd={},_0x5b11af={'count':0x0,'rows':[]};var _0x5f2ab4=_[_0xb524('0x34')](db[_0xb524('0x35')][_0xb524('0x36')],function(_0x4986f9){return{'name':_0x4986f9[_0xb524('0x37')],'type':_0x4986f9[_0xb524('0x38')]['key']};});_0x5f0fdd[_0xb524('0x39')]=_['map'](_0x5f2ab4,_0xb524('0x31'));_0x5f0fdd[_0xb524('0x3a')]=_[_0xb524('0x3b')](_0x35ce5e[_0xb524('0x3a')]);_0x5f0fdd[_0xb524('0x3c')]=_['intersection'](_0x5f0fdd[_0xb524('0x39')],_0x5f0fdd[_0xb524('0x3a')]);_0x303ff6[_0xb524('0x3d')]=_[_0xb524('0x3e')](_0x5f0fdd[_0xb524('0x39')],qs[_0xb524('0x3f')](_0x35ce5e[_0xb524('0x3a')][_0xb524('0x3f')]));_0x303ff6[_0xb524('0x3d')]=_0x303ff6[_0xb524('0x3d')]['length']?_0x303ff6['attributes']:_0x5f0fdd['model'];if(!_0x35ce5e[_0xb524('0x3a')][_0xb524('0x40')](_0xb524('0x41'))){_0x303ff6[_0xb524('0x24')]=qs[_0xb524('0x24')](_0x35ce5e['query']['limit']);_0x303ff6['offset']=qs[_0xb524('0x23')](_0x35ce5e[_0xb524('0x3a')][_0xb524('0x23')]);}_0x303ff6[_0xb524('0x42')]=qs[_0xb524('0x43')](_0x35ce5e[_0xb524('0x3a')][_0xb524('0x43')]);_0x303ff6[_0xb524('0x44')]=qs[_0xb524('0x3c')](_[_0xb524('0x45')](_0x35ce5e[_0xb524('0x3a')],_0x5f0fdd['filters']),_0x5f2ab4);if(_0x35ce5e[_0xb524('0x3a')][_0xb524('0x46')]){_0x303ff6[_0xb524('0x44')]=_[_0xb524('0x47')](_0x303ff6['where'],{'$or':_[_0xb524('0x34')](_0x5f2ab4,function(_0x24f42e){if(_0x24f42e[_0xb524('0x38')]!==_0xb524('0x48')){var _0x1542f2={};_0x1542f2[_0x24f42e['name']]={'$like':'%'+_0x35ce5e[_0xb524('0x3a')][_0xb524('0x46')]+'%'};return _0x1542f2;}})});}_0x303ff6=_[_0xb524('0x47')]({},_0x303ff6,_0x35ce5e[_0xb524('0x49')]);var _0x1d3627={'where':_0x303ff6[_0xb524('0x44')]};return db['VoiceQueueReport'][_0xb524('0x26')](_0x1d3627)[_0xb524('0x2d')](function(_0x51040e){_0x5b11af['count']=_0x51040e;if(_0x35ce5e[_0xb524('0x3a')][_0xb524('0x4a')]){_0x303ff6[_0xb524('0x4b')]=[{'all':!![]}];}return db[_0xb524('0x35')]['findAll'](_0x303ff6);})['then'](function(_0x4b4036){_0x5b11af[_0xb524('0x4c')]=_0x4b4036;return _0x5b11af;})['then'](respondWithFilteredResult(_0x39a43a,_0x303ff6))[_0xb524('0x4d')](handleError(_0x39a43a,null));};exports[_0xb524('0x4e')]=function(_0x382b30,_0x61650c){var _0x3ed724={'raw':![],'where':{'id':_0x382b30[_0xb524('0x4f')]['id']}},_0x47fb3c={};_0x47fb3c[_0xb524('0x39')]=_['keys'](db[_0xb524('0x35')][_0xb524('0x36')]);_0x47fb3c[_0xb524('0x3a')]=_[_0xb524('0x3b')](_0x382b30[_0xb524('0x3a')]);_0x47fb3c['filters']=_[_0xb524('0x3e')](_0x47fb3c[_0xb524('0x39')],_0x47fb3c[_0xb524('0x3a')]);_0x3ed724['attributes']=_['intersection'](_0x47fb3c[_0xb524('0x39')],qs[_0xb524('0x3f')](_0x382b30[_0xb524('0x3a')]['fields']));_0x3ed724[_0xb524('0x3d')]=_0x3ed724[_0xb524('0x3d')][_0xb524('0x50')]?_0x3ed724[_0xb524('0x3d')]:_0x47fb3c[_0xb524('0x39')];if(_0x382b30['query'][_0xb524('0x4a')]){_0x3ed724[_0xb524('0x4b')]=[{'all':!![]}];}_0x3ed724=_['merge']({},_0x3ed724,_0x382b30[_0xb524('0x49')]);return db[_0xb524('0x35')]['find'](_0x3ed724)[_0xb524('0x2d')](handleEntityNotFound(_0x61650c,null))[_0xb524('0x2d')](respondWithResult(_0x61650c,null))['catch'](handleError(_0x61650c,null));};exports['create']=function(_0x148d0e,_0x590433){return db[_0xb524('0x35')][_0xb524('0x51')](_0x148d0e['body'],{})[_0xb524('0x2d')](respondWithResult(_0x590433,0xc9))[_0xb524('0x4d')](handleError(_0x590433,null));};exports[_0xb524('0x2c')]=function(_0x4f5fbd,_0x330df8){if(_0x4f5fbd['body']['id']){delete _0x4f5fbd[_0xb524('0x52')]['id'];}return db[_0xb524('0x35')]['find']({'where':{'id':_0x4f5fbd[_0xb524('0x4f')]['id']}})[_0xb524('0x2d')](handleEntityNotFound(_0x330df8,null))[_0xb524('0x2d')](saveUpdates(_0x4f5fbd[_0xb524('0x52')],null))[_0xb524('0x2d')](respondWithResult(_0x330df8,null))[_0xb524('0x4d')](handleError(_0x330df8,null));};exports['destroy']=function(_0x5bc865,_0x48d0d8){return db[_0xb524('0x35')][_0xb524('0x53')]({'where':{'id':_0x5bc865[_0xb524('0x4f')]['id']}})[_0xb524('0x2d')](handleEntityNotFound(_0x48d0d8,null))[_0xb524('0x2d')](removeEntity(_0x48d0d8,null))[_0xb524('0x4d')](handleError(_0x48d0d8,null));};exports[_0xb524('0x54')]=function(_0x5ce0f1,_0x3e0dfd){return db[_0xb524('0x35')][_0xb524('0x54')]()[_0xb524('0x2d')](respondWithResult(_0x3e0dfd,null))[_0xb524('0x4d')](handleError(_0x3e0dfd,null));};exports['getVoiceQueuesReport']=function(_0x1b949c,_0x1d0b00){var _0x4a4388={},_0x4afbaa={},_0x4ab631={'count':0x0,'rows':[]};_0x4afbaa[_0xb524('0x39')]=_['keys'](db['VoiceQueueReport']['rawAttributes']);_0x4afbaa[_0xb524('0x3a')]=_[_0xb524('0x3b')](_0x1b949c['query']);_0x4afbaa[_0xb524('0x3c')]=_[_0xb524('0x3e')](_0x4afbaa[_0xb524('0x39')],_0x4afbaa['query']);_0x4a4388[_0xb524('0x3d')]=_[_0xb524('0x3e')](_0x4afbaa['model'],qs[_0xb524('0x3f')](_0x1b949c[_0xb524('0x3a')][_0xb524('0x3f')]));_0x4a4388[_0xb524('0x3d')]=_0x4a4388[_0xb524('0x3d')]['length']?_0x4a4388[_0xb524('0x3d')]:_0x4afbaa[_0xb524('0x39')];if(!_0x1b949c[_0xb524('0x3a')][_0xb524('0x40')](_0xb524('0x41'))){_0x4a4388[_0xb524('0x24')]=qs[_0xb524('0x24')](_0x1b949c[_0xb524('0x3a')][_0xb524('0x24')]);_0x4a4388[_0xb524('0x23')]=qs['offset'](_0x1b949c['query'][_0xb524('0x23')]);}_0x4a4388[_0xb524('0x42')]=qs[_0xb524('0x43')](_0x1b949c['query']['sort']);_0x4a4388[_0xb524('0x44')]=qs['filters'](_['pick'](_0x1b949c[_0xb524('0x3a')],_0x4afbaa[_0xb524('0x3c')]));if(_0x1b949c[_0xb524('0x3a')]['filter']){_0x4a4388[_0xb524('0x44')]=_[_0xb524('0x47')](_0x4a4388[_0xb524('0x44')],{'$or':_[_0xb524('0x34')](_0x4a4388[_0xb524('0x3d')],function(_0x4a00d6){var _0x352d74={};_0x352d74[_0x4a00d6]={'$like':'%'+_0x1b949c[_0xb524('0x3a')][_0xb524('0x46')]+'%'};return _0x352d74;})});}_0x4a4388=_['merge']({},_0x4a4388,_0x1b949c[_0xb524('0x49')]);var _0x10d889={'where':_0x4a4388['where']};return db[_0xb524('0x35')][_0xb524('0x26')](_0x10d889)['then'](function(_0xcbe495){_0x4ab631[_0xb524('0x26')]=_0xcbe495;if(_0x1b949c[_0xb524('0x3a')][_0xb524('0x4a')]){_0x4a4388[_0xb524('0x4b')]=[{'all':!![]}];}return db[_0xb524('0x35')]['findAll'](_0x4a4388);})['then'](function(_0x40c4ac){_0x4ab631[_0xb524('0x4c')]=_0x40c4ac;return _0x4ab631;})[_0xb524('0x2d')](respondWithFilteredResult(_0x1d0b00,_0x4a4388,'getVoiceQueuesReport'))[_0xb524('0x4d')](handleError(_0x1d0b00,null,_0xb524('0x55')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index fef74eb..d2536fa 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 _0xc04a=['setMaxListeners','save','remove','emit','hook','exports','events','VoiceQueueReport'];(function(_0x3e2180,_0x4c72fe){var _0x7381f4=function(_0x5f3aa4){while(--_0x5f3aa4){_0x3e2180['push'](_0x3e2180['shift']());}};_0x7381f4(++_0x4c72fe);}(_0xc04a,0x16e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xac04('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xac04('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xac04('0x2')](0x0);var events={'afterCreate':_0xac04('0x3'),'afterUpdate':'update','afterDestroy':_0xac04('0x4')};function emitEvent(_0x3d0709){return function(_0x53fc98,_0x3533d9,_0xb3c813){VoiceQueueReportEvents[_0xac04('0x5')](_0x3d0709+':'+_0x53fc98['id'],_0x53fc98);VoiceQueueReportEvents[_0xac04('0x5')](_0x3d0709,_0x53fc98);_0xb3c813(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xac04('0x6')](e,emitEvent(event));}}module[_0xac04('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x5340=['exports','events','../../mysqldb','VoiceQueueReport','save','update','emit','hasOwnProperty','hook'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x5340,0x1cc));var _0x0534=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5340[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x0534('0x0'));var VoiceQueueReport=require(_0x0534('0x1'))['db'][_0x0534('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0534('0x3'),'afterUpdate':_0x0534('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2bc671){return function(_0x250cb0,_0x11d529,_0x5ce651){VoiceQueueReportEvents[_0x0534('0x5')](_0x2bc671+':'+_0x250cb0['id'],_0x250cb0);VoiceQueueReportEvents[_0x0534('0x5')](_0x2bc671,_0x250cb0);_0x5ce651(null);};}for(var e in events){if(events[_0x0534('0x6')](e)){var event=events[e];VoiceQueueReport[_0x0534('0x7')](e,emitEvent(event));}}module[_0x0534('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 1ee3897..7991f0b 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 _0xbaf0=['define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x1c2f33,_0xb3bef1){var _0x49beb3=function(_0x162c82){while(--_0x162c82){_0x1c2f33['push'](_0x1c2f33['shift']());}};_0x49beb3(++_0xb3bef1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x41b4df,_0x15b067){var _0x55d4dc=function(_0x43e391){while(--_0x43e391){_0x41b4df['push'](_0x41b4df['shift']());}};_0x55d4dc(++_0x15b067);}(_0xb10b,0x12a));var _0xbb10=function(_0x55336a,_0x240d59){_0x55336a=_0x55336a-0x0;var _0x28ceb3=_0xb10b[_0x55336a];return _0x28ceb3;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('VoiceQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbb10('0xc')]},{'fields':[_0xbb10('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 5646bde..a013f11 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 _0x4baa=['request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','limit','include','model','attributes','map','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','where','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','redis','defaults','localhost','./voiceQueueReport.socket','register','then','VoiceQueueReport,\x20%s,\x20%s'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x4baa,0x12a));var _0xa4ba=function(_0x1f3cf1,_0x528a06){_0x1f3cf1=_0x1f3cf1-0x0;var _0x3820da=_0x4baa[_0x1f3cf1];return _0x3820da;};'use strict';var _=require('lodash');var util=require(_0xa4ba('0x0'));var moment=require('moment');var BPromise=require(_0xa4ba('0x1'));var rs=require(_0xa4ba('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4ba('0x3'))['db'];var utils=require(_0xa4ba('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa4ba('0x5'));var client=jayson[_0xa4ba('0x6')]['http']({'port':0x232a});config[_0xa4ba('0x7')]=_[_0xa4ba('0x8')](config[_0xa4ba('0x7')],{'host':_0xa4ba('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa4ba('0xa'))[_0xa4ba('0xb')](socket);function respondWithRpcPromise(_0x1d93c1,_0x416069,_0x4e3264){return new BPromise(function(_0x2cff65,_0x31a6e0){return client['request'](_0x1d93c1,_0x4e3264)[_0xa4ba('0xc')](function(_0x5f1c36){logger['info'](_0xa4ba('0xd'),_0x416069,_0xa4ba('0xe'));logger[_0xa4ba('0xf')](_0xa4ba('0x10'),_0x416069,_0xa4ba('0xe'),JSON[_0xa4ba('0x11')](_0x5f1c36));if(_0x5f1c36[_0xa4ba('0x12')]){if(_0x5f1c36[_0xa4ba('0x12')][_0xa4ba('0x13')]===0x1f4){logger[_0xa4ba('0x12')](_0xa4ba('0xd'),_0x416069,_0x5f1c36[_0xa4ba('0x12')][_0xa4ba('0x14')]);return _0x31a6e0(_0x5f1c36[_0xa4ba('0x12')][_0xa4ba('0x14')]);}logger[_0xa4ba('0x12')](_0xa4ba('0xd'),_0x416069,_0x5f1c36[_0xa4ba('0x12')][_0xa4ba('0x14')]);return _0x2cff65(_0x5f1c36['error'][_0xa4ba('0x14')]);}else{logger[_0xa4ba('0x15')](_0xa4ba('0xd'),_0x416069,_0xa4ba('0xe'));_0x2cff65(_0x5f1c36[_0xa4ba('0x16')][_0xa4ba('0x14')]);}})[_0xa4ba('0x17')](function(_0x445a2f){logger[_0xa4ba('0x12')](_0xa4ba('0xd'),_0x416069,_0x445a2f);_0x31a6e0(_0x445a2f);});});}exports[_0xa4ba('0x18')]=function(_0x17c507){var _0xffff38=this;return new Promise(function(_0x2b2478,_0x24686e){return db[_0xa4ba('0x19')]['findAll']({'raw':_0x17c507['options']?_0x17c507[_0xa4ba('0x1a')][_0xa4ba('0x1b')]===undefined?!![]:![]:!![],'where':_0x17c507['options']?_0x17c507[_0xa4ba('0x1a')]['where']||null:null,'attributes':_0x17c507[_0xa4ba('0x1a')]?_0x17c507['options']['attributes']||null:null,'limit':_0x17c507[_0xa4ba('0x1a')]?_0x17c507[_0xa4ba('0x1a')][_0xa4ba('0x1c')]||null:null,'include':_0x17c507[_0xa4ba('0x1a')]?_0x17c507[_0xa4ba('0x1a')][_0xa4ba('0x1d')]?_['map'](_0x17c507['options'][_0xa4ba('0x1d')],function(_0x332e52){return{'model':db[_0x332e52[_0xa4ba('0x1e')]],'as':_0x332e52['as'],'attributes':_0x332e52[_0xa4ba('0x1f')],'include':_0x332e52[_0xa4ba('0x1d')]?_[_0xa4ba('0x20')](_0x332e52[_0xa4ba('0x1d')],function(_0x10538d){return{'model':db[_0x10538d[_0xa4ba('0x1e')]],'as':_0x10538d['as'],'attributes':_0x10538d[_0xa4ba('0x1f')],'include':_0x10538d['include']?_[_0xa4ba('0x20')](_0x10538d[_0xa4ba('0x1d')],function(_0x55aa7b){return{'model':db[_0x55aa7b['model']],'as':_0x55aa7b['as'],'attributes':_0x55aa7b[_0xa4ba('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa4ba('0xc')](function(_0xe68b0){logger[_0xa4ba('0x15')](_0xa4ba('0x18'),_0x17c507);logger['debug'](_0xa4ba('0x18'),_0x17c507,JSON[_0xa4ba('0x11')](_0xe68b0));_0x2b2478(_0xe68b0);})[_0xa4ba('0x17')](function(_0x316676){logger['error'](_0xa4ba('0x18'),_0x316676[_0xa4ba('0x14')],_0x17c507);_0x24686e(_0xffff38['error'](0x1f4,_0x316676['message']));});});};exports[_0xa4ba('0x21')]=function(_0x4c97ba){var _0x4e0df7=this;return new Promise(function(_0x4ea826,_0x17a261){return db[_0xa4ba('0x19')][_0xa4ba('0x22')](_0x4c97ba['body'],{'raw':_0x4c97ba[_0xa4ba('0x1a')]?_0x4c97ba['options'][_0xa4ba('0x1b')]===undefined?!![]:![]:!![]})[_0xa4ba('0xc')](function(_0x372fdd){logger['info'](_0xa4ba('0x21'),_0x4c97ba);logger[_0xa4ba('0xf')](_0xa4ba('0x21'),_0x4c97ba,JSON['stringify'](_0x372fdd));_0x4ea826(_0x372fdd);})[_0xa4ba('0x17')](function(_0xc4b3c5){logger[_0xa4ba('0x12')](_0xa4ba('0x21'),_0xc4b3c5[_0xa4ba('0x14')],_0x4c97ba);_0x17a261(_0x4e0df7['error'](0x1f4,_0xc4b3c5[_0xa4ba('0x14')]));});});};exports[_0xa4ba('0x23')]=function(_0x2c85e7){var _0x4297af=this;return new Promise(function(_0x182aaf,_0x12ac74){return db[_0xa4ba('0x19')][_0xa4ba('0x24')](_0x2c85e7[_0xa4ba('0x25')],{'raw':_0x2c85e7['options']?_0x2c85e7[_0xa4ba('0x1a')][_0xa4ba('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c85e7[_0xa4ba('0x1a')]?_0x2c85e7['options'][_0xa4ba('0x26')]||null:null,'attributes':_0x2c85e7[_0xa4ba('0x1a')]?_0x2c85e7[_0xa4ba('0x1a')][_0xa4ba('0x1f')]||null:null,'limit':_0x2c85e7['options']?_0x2c85e7['options'][_0xa4ba('0x1c')]||null:null})[_0xa4ba('0xc')](function(_0x457f3c){logger[_0xa4ba('0x15')](_0xa4ba('0x23'),_0x2c85e7);logger['debug'](_0xa4ba('0x23'),_0x2c85e7,JSON[_0xa4ba('0x11')](_0x457f3c));_0x182aaf(_0x457f3c);})['catch'](function(_0x4b5d2e){logger[_0xa4ba('0x12')](_0xa4ba('0x23'),_0x4b5d2e[_0xa4ba('0x14')],_0x2c85e7);_0x12ac74(_0x4297af[_0xa4ba('0x12')](0x1f4,_0x4b5d2e[_0xa4ba('0x14')]));});});}; \ No newline at end of file +var _0x962a=['request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','localhost','register','request','then','info'];(function(_0x548523,_0x4d67c1){var _0x5e4088=function(_0xbd19ec){while(--_0xbd19ec){_0x548523['push'](_0x548523['shift']());}};_0x5e4088(++_0x4d67c1);}(_0x962a,0x14f));var _0xa962=function(_0x739d82,_0x2158d5){_0x739d82=_0x739d82-0x0;var _0x2acffe=_0x962a[_0x739d82];return _0x2acffe;};'use strict';var _=require(_0xa962('0x0'));var util=require(_0xa962('0x1'));var moment=require(_0xa962('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa962('0x3'));var db=require(_0xa962('0x4'))['db'];var utils=require(_0xa962('0x5'));var logger=require('../../config/logger')(_0xa962('0x6'));var config=require(_0xa962('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa962('0x8')][_0xa962('0x9')]({'port':0x232a});config['redis']=_[_0xa962('0xa')](config['redis'],{'host':_0xa962('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xa962('0xc')](socket);function respondWithRpcPromise(_0x73f2e0,_0x4d16e7,_0x29a4dc){return new BPromise(function(_0x533354,_0xcf5cdf){return client[_0xa962('0xd')](_0x73f2e0,_0x29a4dc)[_0xa962('0xe')](function(_0x29d026){logger[_0xa962('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x4d16e7,_0xa962('0x10'));logger[_0xa962('0x11')](_0xa962('0x12'),_0x4d16e7,_0xa962('0x10'),JSON[_0xa962('0x13')](_0x29d026));if(_0x29d026[_0xa962('0x14')]){if(_0x29d026['error']['code']===0x1f4){logger['error'](_0xa962('0x15'),_0x4d16e7,_0x29d026[_0xa962('0x14')][_0xa962('0x16')]);return _0xcf5cdf(_0x29d026[_0xa962('0x14')][_0xa962('0x16')]);}logger['error'](_0xa962('0x15'),_0x4d16e7,_0x29d026[_0xa962('0x14')][_0xa962('0x16')]);return _0x533354(_0x29d026[_0xa962('0x14')][_0xa962('0x16')]);}else{logger[_0xa962('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x4d16e7,_0xa962('0x10'));_0x533354(_0x29d026['result'][_0xa962('0x16')]);}})[_0xa962('0x17')](function(_0x210bb0){logger[_0xa962('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x4d16e7,_0x210bb0);_0xcf5cdf(_0x210bb0);});});}exports[_0xa962('0x18')]=function(_0x24e9cb){var _0x1b8152=this;return new Promise(function(_0x2bc1c8,_0x56beee){return db[_0xa962('0x19')][_0xa962('0x1a')]({'raw':_0x24e9cb['options']?_0x24e9cb[_0xa962('0x1b')][_0xa962('0x1c')]===undefined?!![]:![]:!![],'where':_0x24e9cb[_0xa962('0x1b')]?_0x24e9cb['options'][_0xa962('0x1d')]||null:null,'attributes':_0x24e9cb[_0xa962('0x1b')]?_0x24e9cb[_0xa962('0x1b')][_0xa962('0x1e')]||null:null,'limit':_0x24e9cb[_0xa962('0x1b')]?_0x24e9cb[_0xa962('0x1b')][_0xa962('0x1f')]||null:null,'include':_0x24e9cb[_0xa962('0x1b')]?_0x24e9cb[_0xa962('0x1b')][_0xa962('0x20')]?_[_0xa962('0x21')](_0x24e9cb[_0xa962('0x1b')][_0xa962('0x20')],function(_0x1b3c1c){return{'model':db[_0x1b3c1c[_0xa962('0x22')]],'as':_0x1b3c1c['as'],'attributes':_0x1b3c1c['attributes'],'include':_0x1b3c1c['include']?_[_0xa962('0x21')](_0x1b3c1c[_0xa962('0x20')],function(_0x57143c){return{'model':db[_0x57143c[_0xa962('0x22')]],'as':_0x57143c['as'],'attributes':_0x57143c['attributes'],'include':_0x57143c[_0xa962('0x20')]?_['map'](_0x57143c['include'],function(_0x6b4b65){return{'model':db[_0x6b4b65['model']],'as':_0x6b4b65['as'],'attributes':_0x6b4b65[_0xa962('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14774f){logger[_0xa962('0xf')](_0xa962('0x18'),_0x24e9cb);logger['debug'](_0xa962('0x18'),_0x24e9cb,JSON[_0xa962('0x13')](_0x14774f));_0x2bc1c8(_0x14774f);})[_0xa962('0x17')](function(_0x31bc05){logger[_0xa962('0x14')](_0xa962('0x18'),_0x31bc05[_0xa962('0x16')],_0x24e9cb);_0x56beee(_0x1b8152[_0xa962('0x14')](0x1f4,_0x31bc05[_0xa962('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x308710){var _0x5fc277=this;return new Promise(function(_0x5a1282,_0xc119c0){return db[_0xa962('0x19')][_0xa962('0x23')](_0x308710[_0xa962('0x24')],{'raw':_0x308710[_0xa962('0x1b')]?_0x308710['options'][_0xa962('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0xdc1043){logger['info'](_0xa962('0x25'),_0x308710);logger['debug'](_0xa962('0x25'),_0x308710,JSON[_0xa962('0x13')](_0xdc1043));_0x5a1282(_0xdc1043);})[_0xa962('0x17')](function(_0x2d892c){logger[_0xa962('0x14')](_0xa962('0x25'),_0x2d892c['message'],_0x308710);_0xc119c0(_0x5fc277['error'](0x1f4,_0x2d892c[_0xa962('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x1e7831){var _0x19a62e=this;return new Promise(function(_0x4c45a7,_0x169a6a){return db[_0xa962('0x19')]['update'](_0x1e7831['body'],{'raw':_0x1e7831['options']?_0x1e7831[_0xa962('0x1b')][_0xa962('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e7831[_0xa962('0x1b')]?_0x1e7831[_0xa962('0x1b')][_0xa962('0x1d')]||null:null,'attributes':_0x1e7831[_0xa962('0x1b')]?_0x1e7831[_0xa962('0x1b')][_0xa962('0x1e')]||null:null,'limit':_0x1e7831['options']?_0x1e7831[_0xa962('0x1b')][_0xa962('0x1f')]||null:null})[_0xa962('0xe')](function(_0x36e0b0){logger['info'](_0xa962('0x26'),_0x1e7831);logger[_0xa962('0x11')](_0xa962('0x26'),_0x1e7831,JSON['stringify'](_0x36e0b0));_0x4c45a7(_0x36e0b0);})[_0xa962('0x17')](function(_0x464d1e){logger[_0xa962('0x14')](_0xa962('0x26'),_0x464d1e[_0xa962('0x16')],_0x1e7831);_0x169a6a(_0x19a62e['error'](0x1f4,_0x464d1e[_0xa962('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 0a3efd2..9ccd160 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 _0x2444=['length','voiceQueueReport:','save','remove','update','emit','removeListener','register'];(function(_0x51819a,_0x873bbf){var _0x1d2a9e=function(_0x1a323e){while(--_0x1a323e){_0x51819a['push'](_0x51819a['shift']());}};_0x1d2a9e(++_0x873bbf);}(_0x2444,0x1c2));var _0x4244=function(_0x1ec40b,_0x956ae1){_0x1ec40b=_0x1ec40b-0x0;var _0xd1e8fc=_0x2444[_0x1ec40b];return _0xd1e8fc;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x4244('0x0'),_0x4244('0x1'),_0x4244('0x2')];function createListener(_0x5f5087,_0x1f423d){return function(_0x17e8f5){_0x1f423d[_0x4244('0x3')](_0x5f5087,_0x17e8f5);};}function removeListener(_0xfb1d84,_0x1e941d){return function(){VoiceQueueReportEvents[_0x4244('0x4')](_0xfb1d84,_0x1e941d);};}exports[_0x4244('0x5')]=function(_0x31692f){for(var _0x4eebd1=0x0,_0x4fc9cf=events[_0x4244('0x6')];_0x4eebd1<_0x4fc9cf;_0x4eebd1++){var _0x2df6c0=events[_0x4eebd1];var _0x3c57f8=createListener(_0x4244('0x7')+_0x2df6c0,_0x31692f);VoiceQueueReportEvents['on'](_0x2df6c0,_0x3c57f8);}}; \ No newline at end of file +var _0x5894=['update','emit','removeListener','register','length','voiceQueueReport:','remove'];(function(_0x34b56f,_0x285a97){var _0x4aae9c=function(_0x216fc3){while(--_0x216fc3){_0x34b56f['push'](_0x34b56f['shift']());}};_0x4aae9c(++_0x285a97);}(_0x5894,0xca));var _0x4589=function(_0x222080,_0x3d567c){_0x222080=_0x222080-0x0;var _0xd82141=_0x5894[_0x222080];return _0xd82141;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0x4589('0x0'),_0x4589('0x1')];function createListener(_0x45aef9,_0x255094){return function(_0x2ebab3){_0x255094[_0x4589('0x2')](_0x45aef9,_0x2ebab3);};}function removeListener(_0x3f490e,_0x561211){return function(){VoiceQueueReportEvents[_0x4589('0x3')](_0x3f490e,_0x561211);};}exports[_0x4589('0x4')]=function(_0x52d505){for(var _0x4db9d8=0x0,_0x522a6a=events[_0x4589('0x5')];_0x4db9d8<_0x522a6a;_0x4db9d8++){var _0x58ecaa=events[_0x4db9d8];var _0x8e60a6=createListener(_0x4589('0x6')+_0x58ecaa,_0x52d505);VoiceQueueReportEvents['on'](_0x58ecaa,_0x8e60a6);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 266862c..721e6b6 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 _0xed20=['isAuthenticated','/:id','show','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3bf388,_0x54aae5){var _0x42a6ad=function(_0xfa0ab3){while(--_0xfa0ab3){_0x3bf388['push'](_0x3bf388['shift']());}};_0x42a6ad(++_0x54aae5);}(_0xed20,0xce));var _0x0ed2=function(_0x242919,_0x220d3e){_0x242919=_0x242919-0x0;var _0x1ff206=_0xed20[_0x242919];return _0x1ff206;};'use strict';var multer=require(_0x0ed2('0x0'));var util=require(_0x0ed2('0x1'));var path=require(_0x0ed2('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ed2('0x3'));var router=express[_0x0ed2('0x4')]();var fs_extra=require(_0x0ed2('0x5'));var auth=require(_0x0ed2('0x6'));var interaction=require(_0x0ed2('0x7'));var config=require(_0x0ed2('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0x0ed2('0x9')]('/',auth[_0x0ed2('0xa')](),controller['index']);router[_0x0ed2('0x9')](_0x0ed2('0xb'),auth[_0x0ed2('0xa')](),controller[_0x0ed2('0xc')]);router['post']('/',auth[_0x0ed2('0xa')](),controller[_0x0ed2('0xd')]);router[_0x0ed2('0xe')](_0x0ed2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0ed2('0xf')](_0x0ed2('0xb'),auth[_0x0ed2('0xa')](),controller[_0x0ed2('0x10')]);module[_0x0ed2('0x11')]=router; \ No newline at end of file +var _0xb1aa=['put','/:id','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create'];(function(_0x49bcea,_0x425015){var _0x3dd54e=function(_0x411afe){while(--_0x411afe){_0x49bcea['push'](_0x49bcea['shift']());}};_0x3dd54e(++_0x425015);}(_0xb1aa,0x159));var _0xab1a=function(_0x432f9f,_0x4c52fb){_0x432f9f=_0x432f9f-0x0;var _0xd6bd91=_0xb1aa[_0x432f9f];return _0xd6bd91;};'use strict';var multer=require(_0xab1a('0x0'));var util=require(_0xab1a('0x1'));var path=require('path');var timeout=require(_0xab1a('0x2'));var express=require('express');var router=express[_0xab1a('0x3')]();var fs_extra=require(_0xab1a('0x4'));var auth=require(_0xab1a('0x5'));var interaction=require(_0xab1a('0x6'));var config=require(_0xab1a('0x7'));var controller=require(_0xab1a('0x8'));router[_0xab1a('0x9')]('/',auth[_0xab1a('0xa')](),controller[_0xab1a('0xb')]);router[_0xab1a('0x9')]('/:id',auth[_0xab1a('0xa')](),controller[_0xab1a('0xc')]);router[_0xab1a('0xd')]('/',auth[_0xab1a('0xa')](),controller[_0xab1a('0xe')]);router[_0xab1a('0xf')](_0xab1a('0x10'),auth[_0xab1a('0xa')](),controller['update']);router[_0xab1a('0x11')](_0xab1a('0x10'),auth[_0xab1a('0xa')](),controller[_0xab1a('0x12')]);module[_0xab1a('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index f1cdef5..e735487 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 _0xe78d=['moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x494a42,_0x1f2103){var _0x254792=function(_0x5f1c1d){while(--_0x5f1c1d){_0x494a42['push'](_0x494a42['shift']());}};_0x254792(++_0x1f2103);}(_0xe78d,0x109));var _0xde78=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0xe78d[_0x5eb22e];return _0x27fed5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xde78('0x0'));module['exports']={'time':{'type':Sequelize[_0xde78('0x1')]},'callid':{'type':Sequelize[_0xde78('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xde78('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xde78('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xde78('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xde78('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xde78('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xde78('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xde78('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xde78('0x2')],'allowNull':![],'defaultValue':moment()[_0xde78('0x3')](_0xde78('0x4'))}}; \ No newline at end of file +var _0x0ce2=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING','DATE'];(function(_0x3db7ac,_0x4b9b9c){var _0x390337=function(_0x1df948){while(--_0x1df948){_0x3db7ac['push'](_0x3db7ac['shift']());}};_0x390337(++_0x4b9b9c);}(_0x0ce2,0x1ac));var _0x20ce=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0ce2[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x20ce('0x0'));var moment=require('moment');module[_0x20ce('0x1')]={'time':{'type':Sequelize[_0x20ce('0x2')]},'callid':{'type':Sequelize[_0x20ce('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x20ce('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x20ce('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x20ce('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x20ce('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x20ce('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x20ce('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x20ce('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x20ce('0x3')],'allowNull':![],'defaultValue':moment()[_0x20ce('0x4')](_0x20ce('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index dcb6a34..baac133 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 _0x1c9a=['create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','find'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1c9a,0x98));var _0xa1c9=function(_0x461647,_0x5b4e49){_0x461647=_0x461647-0x0;var _0x15d6ba=_0x1c9a[_0x461647];return _0x15d6ba;};'use strict';var emlformat=require(_0xa1c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var Mustache=require('mustache');var util=require(_0xa1c9('0x5'));var path=require(_0xa1c9('0x6'));var sox=require(_0xa1c9('0x7'));var csv=require(_0xa1c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1c9('0x9'));var _=require('lodash');var squel=require(_0xa1c9('0xa'));var crypto=require(_0xa1c9('0xb'));var jsforce=require(_0xa1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1c9('0x8'));var querystring=require(_0xa1c9('0xd'));var Papa=require(_0xa1c9('0xe'));var Redis=require(_0xa1c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1c9('0x10'));var as=require(_0xa1c9('0x11'));var hardwareService=require(_0xa1c9('0x12'));var logger=require(_0xa1c9('0x13'))(_0xa1c9('0x14'));var utils=require(_0xa1c9('0x15'));var config=require(_0xa1c9('0x16'));var licenseUtil=require(_0xa1c9('0x17'));var db=require(_0xa1c9('0x18'))['db'];function respondWithStatusCode(_0x17ee28,_0x57e2a8){_0x57e2a8=_0x57e2a8||0xcc;return function(_0x341233){if(_0x341233){return _0x17ee28[_0xa1c9('0x19')](_0x57e2a8);}return _0x17ee28[_0xa1c9('0x1a')](_0x57e2a8)[_0xa1c9('0x1b')]();};}function respondWithResult(_0x13f4e9,_0x4c70dd){_0x4c70dd=_0x4c70dd||0xc8;return function(_0x335dda){if(_0x335dda){return _0x13f4e9[_0xa1c9('0x1a')](_0x4c70dd)[_0xa1c9('0x1c')](_0x335dda);}};}function respondWithFilteredResult(_0xd9bca1,_0x2d825c){return function(_0x1bbc94){if(_0x1bbc94){var _0x44ab5b=typeof _0x2d825c[_0xa1c9('0x1d')]===_0xa1c9('0x1e')&&typeof _0x2d825c[_0xa1c9('0x1f')]==='undefined';var _0x11ca10=_0x1bbc94[_0xa1c9('0x20')];var _0x224ae4=_0x44ab5b?0x0:_0x2d825c['offset'];var _0x2fb81e=_0x44ab5b?_0x1bbc94['count']:_0x2d825c[_0xa1c9('0x1d')]+_0x2d825c[_0xa1c9('0x1f')];var _0x204d54;if(_0x2fb81e>=_0x11ca10){_0x2fb81e=_0x11ca10;_0x204d54=0xc8;}else{_0x204d54=0xce;}_0xd9bca1['status'](_0x204d54);return _0xd9bca1[_0xa1c9('0x21')](_0xa1c9('0x22'),_0x224ae4+'-'+_0x2fb81e+'/'+_0x11ca10)[_0xa1c9('0x1c')](_0x1bbc94);}return null;};}function patchUpdates(_0x4edf37){return function(_0x41e6d2){try{jsonpatch[_0xa1c9('0x23')](_0x41e6d2,_0x4edf37,!![]);}catch(_0x4c6dbb){return BPromise[_0xa1c9('0x24')](_0x4c6dbb);}return _0x41e6d2[_0xa1c9('0x25')]();};}function saveUpdates(_0x9f201f,_0x4d05d0){return function(_0x29f1b1){if(_0x29f1b1){return _0x29f1b1[_0xa1c9('0x26')](_0x9f201f)[_0xa1c9('0x27')](function(_0x23a461){return _0x23a461;});}return null;};}function removeEntity(_0x24a5da,_0x4a0a0c){return function(_0x50b16b){if(_0x50b16b){return _0x50b16b[_0xa1c9('0x28')]()['then'](function(){_0x24a5da[_0xa1c9('0x1a')](0xcc)[_0xa1c9('0x1b')]();});}};}function handleEntityNotFound(_0x1c6f37,_0x3059eb){return function(_0x339ed1){if(!_0x339ed1){_0x1c6f37['sendStatus'](0x194);}return _0x339ed1;};}function handleError(_0x1925e7,_0x3ca2a8){_0x3ca2a8=_0x3ca2a8||0x1f4;return function(_0x20cbe1){logger['error'](_0x20cbe1[_0xa1c9('0x29')]);if(_0x20cbe1[_0xa1c9('0x2a')]){delete _0x20cbe1[_0xa1c9('0x2a')];}_0x1925e7['status'](_0x3ca2a8)[_0xa1c9('0x2b')](_0x20cbe1);};}exports[_0xa1c9('0x2c')]=function(_0x594137,_0x38936f){var _0x48ce34={},_0xdf6d0c={},_0x2404c3={'count':0x0,'rows':[]};var _0x88ba11=_[_0xa1c9('0x2d')](db[_0xa1c9('0x2e')][_0xa1c9('0x2f')],function(_0x42fcb2){return{'name':_0x42fcb2[_0xa1c9('0x30')],'type':_0x42fcb2['type']['key']};});_0xdf6d0c[_0xa1c9('0x31')]=_[_0xa1c9('0x2d')](_0x88ba11,_0xa1c9('0x2a'));_0xdf6d0c[_0xa1c9('0x32')]=_[_0xa1c9('0x33')](_0x594137['query']);_0xdf6d0c['filters']=_['intersection'](_0xdf6d0c[_0xa1c9('0x31')],_0xdf6d0c[_0xa1c9('0x32')]);_0x48ce34[_0xa1c9('0x34')]=_[_0xa1c9('0x35')](_0xdf6d0c[_0xa1c9('0x31')],qs[_0xa1c9('0x36')](_0x594137[_0xa1c9('0x32')]['fields']));_0x48ce34[_0xa1c9('0x34')]=_0x48ce34['attributes'][_0xa1c9('0x37')]?_0x48ce34['attributes']:_0xdf6d0c[_0xa1c9('0x31')];if(!_0x594137[_0xa1c9('0x32')][_0xa1c9('0x38')]('nolimit')){_0x48ce34[_0xa1c9('0x1f')]=qs[_0xa1c9('0x1f')](_0x594137[_0xa1c9('0x32')][_0xa1c9('0x1f')]);_0x48ce34['offset']=qs['offset'](_0x594137[_0xa1c9('0x32')][_0xa1c9('0x1d')]);}_0x48ce34[_0xa1c9('0x39')]=qs[_0xa1c9('0x3a')](_0x594137[_0xa1c9('0x32')][_0xa1c9('0x3a')]);_0x48ce34[_0xa1c9('0x3b')]=qs[_0xa1c9('0x3c')](_[_0xa1c9('0x3d')](_0x594137[_0xa1c9('0x32')],_0xdf6d0c['filters']),_0x88ba11);if(_0x594137[_0xa1c9('0x32')][_0xa1c9('0x3e')]){_0x48ce34[_0xa1c9('0x3b')]=_[_0xa1c9('0x3f')](_0x48ce34[_0xa1c9('0x3b')],{'$or':_[_0xa1c9('0x2d')](_0x88ba11,function(_0x5011a3){if(_0x5011a3[_0xa1c9('0x40')]!==_0xa1c9('0x41')){var _0x29d871={};_0x29d871[_0x5011a3['name']]={'$like':'%'+_0x594137[_0xa1c9('0x32')][_0xa1c9('0x3e')]+'%'};return _0x29d871;}})});}_0x48ce34=_['merge']({},_0x48ce34,_0x594137[_0xa1c9('0x42')]);var _0x25502f={'where':_0x48ce34['where']};return db['VoiceQueuesLog'][_0xa1c9('0x20')](_0x25502f)[_0xa1c9('0x27')](function(_0x34a6b8){_0x2404c3[_0xa1c9('0x20')]=_0x34a6b8;if(_0x594137[_0xa1c9('0x32')][_0xa1c9('0x43')]){_0x48ce34[_0xa1c9('0x44')]=[{'all':!![]}];}return db[_0xa1c9('0x2e')][_0xa1c9('0x45')](_0x48ce34);})[_0xa1c9('0x27')](function(_0x5ac71f){_0x2404c3['rows']=_0x5ac71f;return _0x2404c3;})[_0xa1c9('0x27')](respondWithFilteredResult(_0x38936f,_0x48ce34))[_0xa1c9('0x46')](handleError(_0x38936f,null));};exports['show']=function(_0x30ce3b,_0x102a33){var _0x43de42={'raw':!![],'where':{'id':_0x30ce3b[_0xa1c9('0x47')]['id']}},_0x36c846={};_0x36c846[_0xa1c9('0x31')]=_[_0xa1c9('0x33')](db[_0xa1c9('0x2e')][_0xa1c9('0x2f')]);_0x36c846[_0xa1c9('0x32')]=_[_0xa1c9('0x33')](_0x30ce3b['query']);_0x36c846[_0xa1c9('0x3c')]=_['intersection'](_0x36c846[_0xa1c9('0x31')],_0x36c846['query']);_0x43de42[_0xa1c9('0x34')]=_['intersection'](_0x36c846[_0xa1c9('0x31')],qs[_0xa1c9('0x36')](_0x30ce3b['query'][_0xa1c9('0x36')]));_0x43de42[_0xa1c9('0x34')]=_0x43de42['attributes'][_0xa1c9('0x37')]?_0x43de42[_0xa1c9('0x34')]:_0x36c846[_0xa1c9('0x31')];if(_0x30ce3b[_0xa1c9('0x32')][_0xa1c9('0x43')]){_0x43de42[_0xa1c9('0x44')]=[{'all':!![]}];}_0x43de42=_['merge']({},_0x43de42,_0x30ce3b[_0xa1c9('0x42')]);return db[_0xa1c9('0x2e')][_0xa1c9('0x48')](_0x43de42)[_0xa1c9('0x27')](handleEntityNotFound(_0x102a33,null))[_0xa1c9('0x27')](respondWithResult(_0x102a33,null))['catch'](handleError(_0x102a33,null));};exports['create']=function(_0x4cf00a,_0x15329c){return db[_0xa1c9('0x2e')][_0xa1c9('0x49')](_0x4cf00a['body'],{})[_0xa1c9('0x27')](respondWithResult(_0x15329c,0xc9))[_0xa1c9('0x46')](handleError(_0x15329c,null));};exports['update']=function(_0x43ee79,_0x4bdf5d){if(_0x43ee79['body']['id']){delete _0x43ee79[_0xa1c9('0x4a')]['id'];}return db[_0xa1c9('0x2e')][_0xa1c9('0x48')]({'where':{'id':_0x43ee79[_0xa1c9('0x47')]['id']}})[_0xa1c9('0x27')](handleEntityNotFound(_0x4bdf5d,null))[_0xa1c9('0x27')](saveUpdates(_0x43ee79[_0xa1c9('0x4a')],null))[_0xa1c9('0x27')](respondWithResult(_0x4bdf5d,null))[_0xa1c9('0x46')](handleError(_0x4bdf5d,null));};exports[_0xa1c9('0x28')]=function(_0x2b2065,_0x1bed85){return db[_0xa1c9('0x2e')][_0xa1c9('0x48')]({'where':{'id':_0x2b2065[_0xa1c9('0x47')]['id']}})[_0xa1c9('0x27')](handleEntityNotFound(_0x1bed85,null))[_0xa1c9('0x27')](removeEntity(_0x1bed85,null))[_0xa1c9('0x46')](handleError(_0x1bed85,null));}; \ No newline at end of file +var _0x29a6=['moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','zip-dir'];(function(_0xb4d51f,_0x28f1b8){var _0x35f34d=function(_0x5d1aee){while(--_0x5d1aee){_0xb4d51f['push'](_0xb4d51f['shift']());}};_0x35f34d(++_0x28f1b8);}(_0x29a6,0xd9));var _0x629a=function(_0x34e845,_0x3ad519){_0x34e845=_0x34e845-0x0;var _0x29d464=_0x29a6[_0x34e845];return _0x29d464;};'use strict';var emlformat=require(_0x629a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x629a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x629a('0x2'));var BPromise=require(_0x629a('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x629a('0x4'));var csv=require(_0x629a('0x5'));var ejs=require(_0x629a('0x6'));var fs=require('fs');var fs_extra=require(_0x629a('0x7'));var _=require(_0x629a('0x8'));var squel=require('squel');var crypto=require(_0x629a('0x9'));var jsforce=require(_0x629a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x629a('0x5'));var querystring=require(_0x629a('0xb'));var Papa=require(_0x629a('0xc'));var Redis=require(_0x629a('0xd'));var authService=require(_0x629a('0xe'));var qs=require(_0x629a('0xf'));var as=require(_0x629a('0x10'));var hardwareService=require(_0x629a('0x11'));var logger=require(_0x629a('0x12'))(_0x629a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x629a('0x14'));var db=require(_0x629a('0x15'))['db'];function respondWithStatusCode(_0x1549bd,_0x2165dd){_0x2165dd=_0x2165dd||0xcc;return function(_0x58333a){if(_0x58333a){return _0x1549bd[_0x629a('0x16')](_0x2165dd);}return _0x1549bd[_0x629a('0x17')](_0x2165dd)[_0x629a('0x18')]();};}function respondWithResult(_0x33b855,_0x8c1580){_0x8c1580=_0x8c1580||0xc8;return function(_0x8592a5){if(_0x8592a5){return _0x33b855[_0x629a('0x17')](_0x8c1580)[_0x629a('0x19')](_0x8592a5);}};}function respondWithFilteredResult(_0x562cb2,_0x3fb078){return function(_0x28b283){if(_0x28b283){var _0x3ff573=typeof _0x3fb078[_0x629a('0x1a')]===_0x629a('0x1b')&&typeof _0x3fb078[_0x629a('0x1c')]===_0x629a('0x1b');var _0x5db3ed=_0x28b283[_0x629a('0x1d')];var _0x1501ad=_0x3ff573?0x0:_0x3fb078['offset'];var _0x175b69=_0x3ff573?_0x28b283[_0x629a('0x1d')]:_0x3fb078['offset']+_0x3fb078['limit'];var _0x44742f;if(_0x175b69>=_0x5db3ed){_0x175b69=_0x5db3ed;_0x44742f=0xc8;}else{_0x44742f=0xce;}_0x562cb2[_0x629a('0x17')](_0x44742f);return _0x562cb2[_0x629a('0x1e')]('Content-Range',_0x1501ad+'-'+_0x175b69+'/'+_0x5db3ed)[_0x629a('0x19')](_0x28b283);}return null;};}function patchUpdates(_0x2e3cee){return function(_0x400ab0){try{jsonpatch[_0x629a('0x1f')](_0x400ab0,_0x2e3cee,!![]);}catch(_0x1e9da0){return BPromise[_0x629a('0x20')](_0x1e9da0);}return _0x400ab0['save']();};}function saveUpdates(_0x1554c3,_0x3fea0b){return function(_0x395305){if(_0x395305){return _0x395305['update'](_0x1554c3)[_0x629a('0x21')](function(_0x35b73e){return _0x35b73e;});}return null;};}function removeEntity(_0x178df9,_0x12a42f){return function(_0x104e30){if(_0x104e30){return _0x104e30[_0x629a('0x22')]()[_0x629a('0x21')](function(){_0x178df9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d89c,_0x345c72){return function(_0x2383b8){if(!_0x2383b8){_0x51d89c['sendStatus'](0x194);}return _0x2383b8;};}function handleError(_0x5edc23,_0x5c7e5d){_0x5c7e5d=_0x5c7e5d||0x1f4;return function(_0x254296){logger[_0x629a('0x23')](_0x254296[_0x629a('0x24')]);if(_0x254296['name']){delete _0x254296[_0x629a('0x25')];}_0x5edc23[_0x629a('0x17')](_0x5c7e5d)[_0x629a('0x26')](_0x254296);};}exports[_0x629a('0x27')]=function(_0x16a501,_0xae5a91){var _0x1cb663={},_0xe596ad={},_0x57a326={'count':0x0,'rows':[]};var _0x26194b=_[_0x629a('0x28')](db[_0x629a('0x29')][_0x629a('0x2a')],function(_0x513f6e){return{'name':_0x513f6e[_0x629a('0x2b')],'type':_0x513f6e[_0x629a('0x2c')][_0x629a('0x2d')]};});_0xe596ad[_0x629a('0x2e')]=_[_0x629a('0x28')](_0x26194b,'name');_0xe596ad[_0x629a('0x2f')]=_[_0x629a('0x30')](_0x16a501['query']);_0xe596ad[_0x629a('0x31')]=_[_0x629a('0x32')](_0xe596ad[_0x629a('0x2e')],_0xe596ad[_0x629a('0x2f')]);_0x1cb663[_0x629a('0x33')]=_['intersection'](_0xe596ad[_0x629a('0x2e')],qs[_0x629a('0x34')](_0x16a501[_0x629a('0x2f')][_0x629a('0x34')]));_0x1cb663['attributes']=_0x1cb663[_0x629a('0x33')][_0x629a('0x35')]?_0x1cb663[_0x629a('0x33')]:_0xe596ad['model'];if(!_0x16a501[_0x629a('0x2f')][_0x629a('0x36')]('nolimit')){_0x1cb663[_0x629a('0x1c')]=qs['limit'](_0x16a501[_0x629a('0x2f')][_0x629a('0x1c')]);_0x1cb663[_0x629a('0x1a')]=qs[_0x629a('0x1a')](_0x16a501['query'][_0x629a('0x1a')]);}_0x1cb663[_0x629a('0x37')]=qs[_0x629a('0x38')](_0x16a501[_0x629a('0x2f')][_0x629a('0x38')]);_0x1cb663[_0x629a('0x39')]=qs[_0x629a('0x31')](_[_0x629a('0x3a')](_0x16a501[_0x629a('0x2f')],_0xe596ad[_0x629a('0x31')]),_0x26194b);if(_0x16a501[_0x629a('0x2f')][_0x629a('0x3b')]){_0x1cb663[_0x629a('0x39')]=_[_0x629a('0x3c')](_0x1cb663[_0x629a('0x39')],{'$or':_[_0x629a('0x28')](_0x26194b,function(_0x406ae3){if(_0x406ae3[_0x629a('0x2c')]!==_0x629a('0x3d')){var _0x650c99={};_0x650c99[_0x406ae3['name']]={'$like':'%'+_0x16a501[_0x629a('0x2f')][_0x629a('0x3b')]+'%'};return _0x650c99;}})});}_0x1cb663=_[_0x629a('0x3c')]({},_0x1cb663,_0x16a501[_0x629a('0x3e')]);var _0x24e743={'where':_0x1cb663[_0x629a('0x39')]};return db[_0x629a('0x29')][_0x629a('0x1d')](_0x24e743)[_0x629a('0x21')](function(_0x1d66de){_0x57a326['count']=_0x1d66de;if(_0x16a501[_0x629a('0x2f')][_0x629a('0x3f')]){_0x1cb663[_0x629a('0x40')]=[{'all':!![]}];}return db[_0x629a('0x29')][_0x629a('0x41')](_0x1cb663);})[_0x629a('0x21')](function(_0x33d1db){_0x57a326[_0x629a('0x42')]=_0x33d1db;return _0x57a326;})[_0x629a('0x21')](respondWithFilteredResult(_0xae5a91,_0x1cb663))['catch'](handleError(_0xae5a91,null));};exports[_0x629a('0x43')]=function(_0x2fb894,_0x5cc44d){var _0x5da874={'raw':!![],'where':{'id':_0x2fb894[_0x629a('0x44')]['id']}},_0x168fc2={};_0x168fc2['model']=_[_0x629a('0x30')](db['VoiceQueuesLog'][_0x629a('0x2a')]);_0x168fc2[_0x629a('0x2f')]=_['keys'](_0x2fb894['query']);_0x168fc2[_0x629a('0x31')]=_['intersection'](_0x168fc2[_0x629a('0x2e')],_0x168fc2['query']);_0x5da874[_0x629a('0x33')]=_[_0x629a('0x32')](_0x168fc2[_0x629a('0x2e')],qs[_0x629a('0x34')](_0x2fb894[_0x629a('0x2f')]['fields']));_0x5da874[_0x629a('0x33')]=_0x5da874['attributes'][_0x629a('0x35')]?_0x5da874[_0x629a('0x33')]:_0x168fc2[_0x629a('0x2e')];if(_0x2fb894[_0x629a('0x2f')][_0x629a('0x3f')]){_0x5da874[_0x629a('0x40')]=[{'all':!![]}];}_0x5da874=_[_0x629a('0x3c')]({},_0x5da874,_0x2fb894[_0x629a('0x3e')]);return db[_0x629a('0x29')][_0x629a('0x45')](_0x5da874)[_0x629a('0x21')](handleEntityNotFound(_0x5cc44d,null))[_0x629a('0x21')](respondWithResult(_0x5cc44d,null))[_0x629a('0x46')](handleError(_0x5cc44d,null));};exports['create']=function(_0x16eb17,_0x4365f1){return db['VoiceQueuesLog'][_0x629a('0x47')](_0x16eb17[_0x629a('0x48')],{})['then'](respondWithResult(_0x4365f1,0xc9))['catch'](handleError(_0x4365f1,null));};exports['update']=function(_0x3e7f31,_0x497ace){if(_0x3e7f31['body']['id']){delete _0x3e7f31[_0x629a('0x48')]['id'];}return db['VoiceQueuesLog'][_0x629a('0x45')]({'where':{'id':_0x3e7f31[_0x629a('0x44')]['id']}})[_0x629a('0x21')](handleEntityNotFound(_0x497ace,null))['then'](saveUpdates(_0x3e7f31[_0x629a('0x48')],null))[_0x629a('0x21')](respondWithResult(_0x497ace,null))['catch'](handleError(_0x497ace,null));};exports[_0x629a('0x22')]=function(_0x1cf0b0,_0x5bdbaa){return db['VoiceQueuesLog'][_0x629a('0x45')]({'where':{'id':_0x1cf0b0[_0x629a('0x44')]['id']}})['then'](handleEntityNotFound(_0x5bdbaa,null))[_0x629a('0x21')](removeEntity(_0x5bdbaa,null))[_0x629a('0x46')](handleError(_0x5bdbaa,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 9ec5c5c..654151e 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 _0xe3d4=['VoiceQueuesLog','voice_queues_log','event_dtm','event','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define'];(function(_0x3d8c50,_0x4bb14c){var _0x2725db=function(_0x56671d){while(--_0x56671d){_0x3d8c50['push'](_0x3d8c50['shift']());}};_0x2725db(++_0x4bb14c);}(_0xe3d4,0x79));var _0x4e3d=function(_0x571dbc,_0x400df9){_0x571dbc=_0x571dbc-0x0;var _0x55043c=_0xe3d4[_0x571dbc];return _0x55043c;};'use strict';var _=require('lodash');var util=require(_0x4e3d('0x0'));var logger=require(_0x4e3d('0x1'))(_0x4e3d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e3d('0x3'));var fs=require('fs');var path=require(_0x4e3d('0x4'));var rimraf=require(_0x4e3d('0x5'));var config=require(_0x4e3d('0x6'));var attributes=require(_0x4e3d('0x7'));module['exports']=function(_0x51da02,_0x247e83){return _0x51da02[_0x4e3d('0x8')](_0x4e3d('0x9'),attributes,{'tableName':_0x4e3d('0xa'),'paranoid':![],'indexes':[{'name':_0x4e3d('0xb'),'fields':[_0x4e3d('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xd2db=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xd2db,0x10d));var _0xbd2d=function(_0x3cfba1,_0x3decb7){_0x3cfba1=_0x3cfba1-0x0;var _0x8ffb22=_0xd2db[_0x3cfba1];return _0x8ffb22;};'use strict';var _=require(_0xbd2d('0x0'));var util=require('util');var logger=require(_0xbd2d('0x1'))(_0xbd2d('0x2'));var moment=require('moment');var BPromise=require(_0xbd2d('0x3'));var rp=require(_0xbd2d('0x4'));var fs=require('fs');var path=require(_0xbd2d('0x5'));var rimraf=require('rimraf');var config=require(_0xbd2d('0x6'));var attributes=require(_0xbd2d('0x7'));module[_0xbd2d('0x8')]=function(_0x5421ae,_0x1bb873){return _0x5421ae[_0xbd2d('0x9')](_0xbd2d('0xa'),attributes,{'tableName':_0xbd2d('0xb'),'paranoid':![],'indexes':[{'name':_0xbd2d('0xc'),'fields':[_0xbd2d('0xd'),_0xbd2d('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 a9d439d..85d2ed1 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 _0x06ef=['then','info','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceQueuesLog,\x20%s,\x20%s','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x20efe6,_0x2d6285){var _0x2680c2=function(_0x1c969b){while(--_0x1c969b){_0x20efe6['push'](_0x20efe6['shift']());}};_0x2680c2(++_0x2d6285);}(_0x06ef,0x185));var _0xf06e=function(_0x4894aa,_0x19f667){_0x4894aa=_0x4894aa-0x0;var _0x15de3c=_0x06ef[_0x4894aa];return _0x15de3c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf06e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf06e('0x1'));var logger=require(_0xf06e('0x2'))(_0xf06e('0x3'));var config=require('../../config/environment');var jayson=require(_0xf06e('0x4'));var client=jayson[_0xf06e('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b74b,_0x4e05dc,_0x5cddf1){return new BPromise(function(_0x4ccbee,_0x25b56e){return client[_0xf06e('0x6')](_0x59b74b,_0x5cddf1)[_0xf06e('0x7')](function(_0x2bb08c){logger[_0xf06e('0x8')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'));logger[_0xf06e('0xa')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'),JSON[_0xf06e('0xb')](_0x2bb08c));if(_0x2bb08c[_0xf06e('0xc')]){if(_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xd')]===0x1f4){logger[_0xf06e('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4e05dc,_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xe')]);return _0x25b56e(_0x2bb08c['error'][_0xf06e('0xe')]);}logger[_0xf06e('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4e05dc,_0x2bb08c['error']['message']);return _0x4ccbee(_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xe')]);}else{logger[_0xf06e('0x8')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'));_0x4ccbee(_0x2bb08c[_0xf06e('0xf')][_0xf06e('0xe')]);}})[_0xf06e('0x10')](function(_0x44157a){logger[_0xf06e('0xc')](_0xf06e('0x11'),_0x4e05dc,_0x44157a);_0x25b56e(_0x44157a);});});} \ No newline at end of file +var _0x263f=['client','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0x263f,0x182));var _0xf263=function(_0x1bc1b0,_0x25fb56){_0x1bc1b0=_0x1bc1b0-0x0;var _0x37cd22=_0x263f[_0x1bc1b0];return _0x37cd22;};'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});function respondWithRpcPromise(_0x4fded6,_0xa2b1b0,_0x9644ab){return new BPromise(function(_0xa2e77e,_0x16ff53){return client['request'](_0x4fded6,_0x9644ab)[_0xf263('0xb')](function(_0x26504c){logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));logger[_0xf263('0xf')](_0xf263('0x10'),_0xa2b1b0,'request\x20sent',JSON[_0xf263('0x11')](_0x26504c));if(_0x26504c['error']){if(_0x26504c[_0xf263('0x12')]['code']===0x1f4){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);return _0x16ff53(_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);}logger[_0xf263('0x12')](_0xf263('0xd'),_0xa2b1b0,_0x26504c['error'][_0xf263('0x13')]);return _0xa2e77e(_0x26504c['error'][_0xf263('0x13')]);}else{logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));_0xa2e77e(_0x26504c[_0xf263('0x14')][_0xf263('0x13')]);}})[_0xf263('0x15')](function(_0x57c655){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x57c655);_0x16ff53(_0x57c655);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 52e3403..87e6d6c 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 _0x4389=['downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','index','get','isAuthenticated','describe','/:id','show','/:id/download','download'];(function(_0x473049,_0x3c006e){var _0x188568=function(_0xc8a16c){while(--_0xc8a16c){_0x473049['push'](_0x473049['shift']());}};_0x188568(++_0x3c006e);}(_0x4389,0x79));var _0x9438=function(_0x55c4e8,_0x29a596){_0x55c4e8=_0x55c4e8-0x0;var _0x49070c=_0x4389[_0x55c4e8];return _0x49070c;};'use strict';var multer=require(_0x9438('0x0'));var util=require(_0x9438('0x1'));var path=require(_0x9438('0x2'));var timeout=require(_0x9438('0x3'));var express=require(_0x9438('0x4'));var router=express[_0x9438('0x5')]();var fs_extra=require(_0x9438('0x6'));var auth=require(_0x9438('0x7'));var interaction=require(_0x9438('0x8'));var config=require(_0x9438('0x9'));var controller=require(_0x9438('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x9438('0xb')]);router[_0x9438('0xc')]('/describe',auth[_0x9438('0xd')](),controller[_0x9438('0xe')]);router['get'](_0x9438('0xf'),auth['isAuthenticated'](),controller[_0x9438('0x10')]);router[_0x9438('0xc')](_0x9438('0x11'),auth['isAuthenticated'](),controller[_0x9438('0x12')]);router[_0x9438('0xc')]('/:id/downloads',controller[_0x9438('0x13')]);router[_0x9438('0xc')](_0x9438('0x14'),auth[_0x9438('0xd')](),controller[_0x9438('0x15')]);router[_0x9438('0x16')]('/',auth['isAuthenticated'](),controller[_0x9438('0x17')]);router[_0x9438('0x16')](_0x9438('0x14'),auth['isAuthenticated'](),controller[_0x9438('0x18')]);router['put'](_0x9438('0xf'),auth[_0x9438('0xd')](),controller[_0x9438('0x19')]);router['delete'](_0x9438('0xf'),auth[_0x9438('0xd')](),controller[_0x9438('0x1a')]);module[_0x9438('0x1b')]=router; \ No newline at end of file +var _0xcc52=['show','/:id/download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0xcc52,0x78));var _0x2cc5=function(_0x2417a9,_0x4c7c50){_0x2417a9=_0x2417a9-0x0;var _0x479e77=_0xcc52[_0x2417a9];return _0x479e77;};'use strict';var multer=require(_0x2cc5('0x0'));var util=require(_0x2cc5('0x1'));var path=require('path');var timeout=require(_0x2cc5('0x2'));var express=require(_0x2cc5('0x3'));var router=express['Router']();var fs_extra=require(_0x2cc5('0x4'));var auth=require(_0x2cc5('0x5'));var interaction=require(_0x2cc5('0x6'));var config=require(_0x2cc5('0x7'));var controller=require(_0x2cc5('0x8'));router[_0x2cc5('0x9')]('/',auth[_0x2cc5('0xa')](),controller[_0x2cc5('0xb')]);router['get'](_0x2cc5('0xc'),auth[_0x2cc5('0xa')](),controller[_0x2cc5('0xd')]);router[_0x2cc5('0x9')](_0x2cc5('0xe'),auth[_0x2cc5('0xa')](),controller[_0x2cc5('0xf')]);router[_0x2cc5('0x9')](_0x2cc5('0x10'),auth[_0x2cc5('0xa')](),controller['download']);router[_0x2cc5('0x9')](_0x2cc5('0x11'),controller['downloads']);router[_0x2cc5('0x9')](_0x2cc5('0x12'),auth['isAuthenticated'](),controller[_0x2cc5('0x13')]);router[_0x2cc5('0x14')]('/',auth['isAuthenticated'](),controller[_0x2cc5('0x15')]);router[_0x2cc5('0x14')](_0x2cc5('0x12'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0x2cc5('0x16')]('/:id',auth[_0x2cc5('0xa')](),controller[_0x2cc5('0x17')]);router[_0x2cc5('0x18')]('/:id',auth[_0x2cc5('0xa')](),controller[_0x2cc5('0x19')]);module[_0x2cc5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a41845a..f585308 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 _0x9915=['toString','path','VIRTUAL','getDataValue','extname','STRING','channel','setDataValue','membername','split','INTEGER','TEXT','NEW','FLOAT','createdAt','DATE','updatedAt','MM-DD-YYYY\x20HH:mm'];(function(_0x277c93,_0x33a8bb){var _0x1bc988=function(_0x4c1ffb){while(--_0x4c1ffb){_0x277c93['push'](_0x277c93['shift']());}};_0x1bc988(++_0x33a8bb);}(_0x9915,0x1b1));var _0x5991=function(_0x41eba9,_0x53a26a){_0x41eba9=_0x41eba9-0x0;var _0x5ac9ba=_0x9915[_0x41eba9];return _0x5ac9ba;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x5991('0x0'));module['exports']={'format':{'type':Sequelize[_0x5991('0x1')],'get':function(){return this[_0x5991('0x2')]('value')?path[_0x5991('0x3')](this[_0x5991('0x2')]('value')):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5991('0x4')],'set':function(_0x252097){if(_0x252097){this['setDataValue'](_0x5991('0x5'),_0x252097);this[_0x5991('0x6')](_0x5991('0x7'),_0x252097[_0x5991('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x5991('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5991('0x4')]},'context':{'type':Sequelize[_0x5991('0x4')]},'exten':{'type':Sequelize[_0x5991('0x4')]},'value':{'type':Sequelize[_0x5991('0x4')]},'type':{'type':Sequelize[_0x5991('0x4')]},'rating':{'type':Sequelize[_0x5991('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x5991('0x4')]},'userDisposition':{'type':Sequelize[_0x5991('0x4')]},'userSecondDisposition':{'type':Sequelize[_0x5991('0x4')]},'userThirdDisposition':{'type':Sequelize[_0x5991('0x4')]},'location':{'type':Sequelize[_0x5991('0xa')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x5991('0x4')],'defaultValue':_0x5991('0xb')},'fileUri':{'type':Sequelize[_0x5991('0xa')]},'fileText':{'type':Sequelize[_0x5991('0xa')]},'failureReason':{'type':Sequelize[_0x5991('0xa')]},'sentiment':{'type':Sequelize[_0x5991('0x4')]},'sPositive':{'type':Sequelize[_0x5991('0xc')]},'sNegative':{'type':Sequelize[_0x5991('0xc')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x5991('0x2')](_0x5991('0xd')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x5991('0xe')],'get':function(){return moment(this[_0x5991('0x2')](_0x5991('0xf')))['format'](_0x5991('0x10'))[_0x5991('0x11')]();}}}; \ No newline at end of file +var _0x3e59=['BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','exports','VIRTUAL','getDataValue','extname','STRING','channel','setDataValue','membername','split','INTEGER','NEW','TEXT','FLOAT'];(function(_0x32c8c2,_0x5e0ab0){var _0x16ed42=function(_0x4646b0){while(--_0x4646b0){_0x32c8c2['push'](_0x32c8c2['shift']());}};_0x16ed42(++_0x5e0ab0);}(_0x3e59,0x151));var _0x93e5=function(_0x6c59fc,_0x5fe88d){_0x6c59fc=_0x6c59fc-0x0;var _0x17c96f=_0x3e59[_0x6c59fc];return _0x17c96f;};'use strict';var Sequelize=require(_0x93e5('0x0'));var moment=require(_0x93e5('0x1'));var path=require('path');module[_0x93e5('0x2')]={'format':{'type':Sequelize[_0x93e5('0x3')],'get':function(){return this[_0x93e5('0x4')]('value')?path[_0x93e5('0x5')](this['getDataValue']('value')):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x93e5('0x6')],'set':function(_0x53ac83){if(_0x53ac83){this['setDataValue'](_0x93e5('0x7'),_0x53ac83);this[_0x93e5('0x8')](_0x93e5('0x9'),_0x53ac83[_0x93e5('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x93e5('0x6')]},'calleridnum':{'type':Sequelize[_0x93e5('0x6')]},'calleridname':{'type':Sequelize[_0x93e5('0x6')]},'connectedlinenum':{'type':Sequelize[_0x93e5('0x6')]},'connectedlinename':{'type':Sequelize[_0x93e5('0x6')]},'accountcode':{'type':Sequelize[_0x93e5('0x6')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x93e5('0x6')]},'type':{'type':Sequelize[_0x93e5('0x6')]},'rating':{'type':Sequelize[_0x93e5('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x93e5('0x6')]},'userDisposition':{'type':Sequelize[_0x93e5('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x93e5('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x93e5('0x6')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0x93e5('0x6')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0x93e5('0xc')},'fileUri':{'type':Sequelize[_0x93e5('0xd')]},'fileText':{'type':Sequelize[_0x93e5('0xd')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x93e5('0x6')]},'sPositive':{'type':Sequelize[_0x93e5('0xe')]},'sNegative':{'type':Sequelize[_0x93e5('0xe')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x93e5('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x93e5('0x10')],'get':function(){return moment(this['getDataValue'](_0x93e5('0x11')))[_0x93e5('0x12')](_0x93e5('0x13'))[_0x93e5('0x14')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x93e5('0x4')](_0x93e5('0x15')))['format']('MM-DD-YYYY\x20HH:mm')[_0x93e5('0x14')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index d0a2d17..67d83e7 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 _0x96dc=['json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','rawAttributes','length','create','body','find','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','../../components/encryptor','sequelize','MD5','push','recording','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x103133,_0x26be21){var _0x4672f7=function(_0x2d296a){while(--_0x2d296a){_0x103133['push'](_0x103133['shift']());}};_0x4672f7(++_0x26be21);}(_0x96dc,0x10f));var _0xc96d=function(_0x2d92e3,_0x46bd1a){_0x2d92e3=_0x2d92e3-0x0;var _0x263936=_0x96dc[_0x2d92e3];return _0x263936;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc96d('0x0'));var jsonpatch=require(_0xc96d('0x1'));var rp=require('request-promise');var moment=require(_0xc96d('0x2'));var BPromise=require(_0xc96d('0x3'));var Mustache=require(_0xc96d('0x4'));var util=require('util');var path=require(_0xc96d('0x5'));var sox=require(_0xc96d('0x6'));var csv=require(_0xc96d('0x7'));var ejs=require(_0xc96d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc96d('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc96d('0x7'));var querystring=require(_0xc96d('0xa'));var Papa=require(_0xc96d('0xb'));var AWS=require(_0xc96d('0xc'));var uuidv4=require(_0xc96d('0xd'));var Redis=require(_0xc96d('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc96d('0xf'));var logger=require(_0xc96d('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xc96d('0x11'));var licenseUtil=require(_0xc96d('0x12'));var db=require(_0xc96d('0x13'))['db'];function respondWithStatusCode(_0x3c25dd,_0x5ef678){_0x5ef678=_0x5ef678||0xcc;return function(_0x451bd3){if(_0x451bd3){return _0x3c25dd[_0xc96d('0x14')](_0x5ef678);}return _0x3c25dd[_0xc96d('0x15')](_0x5ef678)[_0xc96d('0x16')]();};}function respondWithResult(_0x3e0e18,_0x47e398){_0x47e398=_0x47e398||0xc8;return function(_0x285133){if(_0x285133){return _0x3e0e18[_0xc96d('0x15')](_0x47e398)[_0xc96d('0x17')](_0x285133);}};}function respondWithFilteredResult(_0x23175c,_0x2c2bdd){return function(_0x57e351){if(_0x57e351){var _0x113689=typeof _0x2c2bdd[_0xc96d('0x18')]==='undefined'&&typeof _0x2c2bdd[_0xc96d('0x19')]==='undefined';var _0x1052c2=_0x57e351[_0xc96d('0x1a')];var _0x49d9ea=_0x113689?0x0:_0x2c2bdd[_0xc96d('0x18')];var _0x160fe7=_0x113689?_0x57e351[_0xc96d('0x1a')]:_0x2c2bdd[_0xc96d('0x18')]+_0x2c2bdd[_0xc96d('0x19')];var _0x40f488;if(_0x160fe7>=_0x1052c2){_0x160fe7=_0x1052c2;_0x40f488=0xc8;}else{_0x40f488=0xce;}_0x23175c[_0xc96d('0x15')](_0x40f488);return _0x23175c[_0xc96d('0x1b')](_0xc96d('0x1c'),_0x49d9ea+'-'+_0x160fe7+'/'+_0x1052c2)[_0xc96d('0x17')](_0x57e351);}return null;};}function patchUpdates(_0x57f0f9){return function(_0x567642){try{jsonpatch[_0xc96d('0x1d')](_0x567642,_0x57f0f9,!![]);}catch(_0x2ed9ac){return BPromise[_0xc96d('0x1e')](_0x2ed9ac);}return _0x567642[_0xc96d('0x1f')]();};}function saveUpdates(_0x36571e,_0x5284c2){return function(_0x125f48){if(_0x125f48){return _0x125f48[_0xc96d('0x20')](_0x36571e)[_0xc96d('0x21')](function(_0x44ef0a){return _0x44ef0a;});}return null;};}function removeEntity(_0x3b72c1,_0x3b4c08){return function(_0x5e89a2){if(_0x5e89a2){return _0x5e89a2[_0xc96d('0x22')]()[_0xc96d('0x21')](function(){_0x3b72c1[_0xc96d('0x15')](0xcc)[_0xc96d('0x16')]();});}};}function handleEntityNotFound(_0x44b172,_0x167a57){return function(_0x12f687){if(!_0x12f687){_0x44b172[_0xc96d('0x14')](0x194);}return _0x12f687;};}function handleError(_0x3f2f19,_0x20c06b){_0x20c06b=_0x20c06b||0x1f4;return function(_0x4a9f84){logger[_0xc96d('0x23')](_0x4a9f84['stack']);if(_0x4a9f84[_0xc96d('0x24')]){delete _0x4a9f84['name'];}_0x3f2f19[_0xc96d('0x15')](_0x20c06b)[_0xc96d('0x25')](_0x4a9f84);};}exports[_0xc96d('0x26')]=function(_0x5d0bb3,_0x24b3dc){var _0x6b529={},_0x5ad705={},_0x41e649={'count':0x0,'rows':[]};var _0x172f60=_[_0xc96d('0x27')](db[_0xc96d('0x28')]['rawAttributes'],function(_0x16090d){return{'name':_0x16090d[_0xc96d('0x29')],'type':_0x16090d[_0xc96d('0x2a')][_0xc96d('0x2b')]};});_0x5ad705[_0xc96d('0x2c')]=_[_0xc96d('0x2d')](_[_0xc96d('0x27')](_0x172f60,_0xc96d('0x24')),[_0xc96d('0x2e')]);_0x5ad705[_0xc96d('0x2f')]=_[_0xc96d('0x30')](_0x5d0bb3['query']);_0x5ad705[_0xc96d('0x31')]=_['intersection'](_0x5ad705[_0xc96d('0x2c')],_0x5ad705[_0xc96d('0x2f')]);_0x6b529[_0xc96d('0x32')]=_[_0xc96d('0x33')](_0x5ad705[_0xc96d('0x2c')],qs[_0xc96d('0x34')](_0x5d0bb3[_0xc96d('0x2f')]['fields']));_0x6b529['attributes']=_0x6b529['attributes']['length']?_0x6b529['attributes']:_0x5ad705[_0xc96d('0x2c')];if(!_0x5d0bb3[_0xc96d('0x2f')]['hasOwnProperty'](_0xc96d('0x35'))){_0x6b529[_0xc96d('0x19')]=qs[_0xc96d('0x19')](_0x5d0bb3[_0xc96d('0x2f')][_0xc96d('0x19')]);_0x6b529[_0xc96d('0x18')]=qs[_0xc96d('0x18')](_0x5d0bb3[_0xc96d('0x2f')][_0xc96d('0x18')]);}_0x6b529[_0xc96d('0x36')]=qs['sort'](_0x5d0bb3[_0xc96d('0x2f')][_0xc96d('0x37')]);_0x6b529[_0xc96d('0x38')]=qs[_0xc96d('0x31')](_[_0xc96d('0x39')](_0x5d0bb3[_0xc96d('0x2f')],_0x5ad705['filters']),_0x172f60);if(_0x5d0bb3[_0xc96d('0x2f')]['filter']){_0x6b529[_0xc96d('0x38')]=_[_0xc96d('0x3a')](_0x6b529[_0xc96d('0x38')],{'$or':_['map'](_0x172f60,function(_0x212371){if(_0x212371[_0xc96d('0x2a')]!==_0xc96d('0x3b')){var _0x57d059={};_0x57d059[_0x212371[_0xc96d('0x24')]]={'$like':'%'+_0x5d0bb3['query'][_0xc96d('0x3c')]+'%'};return _0x57d059;}})});}_0x6b529=_[_0xc96d('0x3a')]({},_0x6b529,_0x5d0bb3[_0xc96d('0x3d')]);var _0x379ed4={'where':_0x6b529['where']};return db[_0xc96d('0x28')][_0xc96d('0x1a')](_0x379ed4)['then'](function(_0xc670c){_0x41e649[_0xc96d('0x1a')]=_0xc670c;if(_0x5d0bb3[_0xc96d('0x2f')][_0xc96d('0x3e')]){_0x6b529[_0xc96d('0x3f')]=[{'all':!![]}];}return db[_0xc96d('0x28')][_0xc96d('0x40')](_0x6b529);})['then'](function(_0x10869b){_0x41e649['rows']=_0x10869b;return _0x41e649;})[_0xc96d('0x21')](respondWithFilteredResult(_0x24b3dc,_0x6b529))[_0xc96d('0x41')](handleError(_0x24b3dc,null));};exports['show']=function(_0x51304a,_0x3f704f){var _0x24fdc9={'raw':![],'where':{'id':_0x51304a[_0xc96d('0x42')]['id']}},_0x49f8f1={};_0x49f8f1['model']=_[_0xc96d('0x30')](db[_0xc96d('0x28')][_0xc96d('0x43')]);_0x49f8f1[_0xc96d('0x2f')]=_[_0xc96d('0x30')](_0x51304a[_0xc96d('0x2f')]);_0x49f8f1[_0xc96d('0x31')]=_['intersection'](_0x49f8f1[_0xc96d('0x2c')],_0x49f8f1[_0xc96d('0x2f')]);_0x24fdc9['attributes']=_['intersection'](_0x49f8f1[_0xc96d('0x2c')],qs[_0xc96d('0x34')](_0x51304a[_0xc96d('0x2f')][_0xc96d('0x34')]));_0x24fdc9['attributes']=_0x24fdc9[_0xc96d('0x32')][_0xc96d('0x44')]?_0x24fdc9[_0xc96d('0x32')]:_0x49f8f1[_0xc96d('0x2c')];if(_0x51304a[_0xc96d('0x2f')]['includeAll']){_0x24fdc9[_0xc96d('0x3f')]=[{'all':!![]}];}_0x24fdc9=_['merge']({},_0x24fdc9,_0x51304a[_0xc96d('0x3d')]);return db['VoiceRecording']['find'](_0x24fdc9)[_0xc96d('0x21')](handleEntityNotFound(_0x3f704f,null))[_0xc96d('0x21')](respondWithResult(_0x3f704f,null))[_0xc96d('0x41')](handleError(_0x3f704f,null));};exports[_0xc96d('0x45')]=function(_0x3fb8b8,_0x2dea75){return db['VoiceRecording'][_0xc96d('0x45')](_0x3fb8b8['body'],{})[_0xc96d('0x21')](respondWithResult(_0x2dea75,0xc9))[_0xc96d('0x41')](handleError(_0x2dea75,null));};exports[_0xc96d('0x20')]=function(_0x426d4a,_0x1cd665){if(_0x426d4a[_0xc96d('0x46')]['id']){delete _0x426d4a[_0xc96d('0x46')]['id'];}return db[_0xc96d('0x28')][_0xc96d('0x47')]({'where':{'id':_0x426d4a['params']['id']}})['then'](handleEntityNotFound(_0x1cd665,null))[_0xc96d('0x21')](saveUpdates(_0x426d4a['body'],null))['then'](respondWithResult(_0x1cd665,null))[_0xc96d('0x41')](handleError(_0x1cd665,null));};exports[_0xc96d('0x48')]=function(_0x433427,_0x1ada26){return db[_0xc96d('0x28')][_0xc96d('0x48')]()[_0xc96d('0x21')](respondWithResult(_0x1ada26,null))[_0xc96d('0x41')](handleError(_0x1ada26,null));};exports[_0xc96d('0x49')]=function(_0x3cc7f6,_0x2cba3e,_0x2121c9){var _0x52658e=require('../../components/encryptor');var _0x2a95dd=![];var _0x3d5ac8={};if(_0x3cc7f6[_0xc96d('0x2f')][_0xc96d('0x2a')]&&_0x3cc7f6[_0xc96d('0x2f')]['type']==='uniqueid'){_0x3d5ac8[_0xc96d('0x4a')]=_0x3cc7f6[_0xc96d('0x42')]['id'];}else{_0x3d5ac8['id']=_0x3cc7f6['params']['id'];}return db[_0xc96d('0x28')][_0xc96d('0x47')]({'where':_0x3d5ac8,'attributes':['id','value'],'raw':!![]})[_0xc96d('0x21')](handleEntityNotFound(_0x2cba3e,null))['then'](function(_0x5ea7d7){if(_0x5ea7d7){var _0x8c56a0=_0x5ea7d7[_0xc96d('0x4b')];var _0x3184b5=util['format'](_0xc96d('0x4c'),_0x8c56a0);if(fs[_0xc96d('0x4d')](_0x3184b5)){_0x2a95dd=!![];return _0x52658e[_0xc96d('0x4e')](_0x3184b5,_0x8c56a0,config[_0xc96d('0x4f')]['recording'])[_0xc96d('0x21')](function(){return _0x5ea7d7;});}return _0x5ea7d7;}})[_0xc96d('0x21')](function(_0xf3645d){if(_0xf3645d){var _0x312ea8=_0xf3645d[_0xc96d('0x4b')];if(!fs[_0xc96d('0x4d')](_0x312ea8)){throw new db[(_0xc96d('0x50'))][(_0xc96d('0x51'))](_0xc96d('0x52'));}if(_0xf3645d[_0xc96d('0x53')]){return _0x2cba3e['download'](_0x312ea8,_0xf3645d[_0xc96d('0x53')]+path[_0xc96d('0x54')](_0x312ea8),function(){if(_0x2a95dd){fs[_0xc96d('0x55')](_0x312ea8);}});}else{return _0x2cba3e[_0xc96d('0x49')](_0x312ea8,function(_0x14d10b){if(_0x2a95dd){fs[_0xc96d('0x55')](_0x312ea8);}});}}})[_0xc96d('0x41')](function(_0x470391){if(_0x470391[_0xc96d('0x56')]==='VoiceRecording\x20not\x20found'){_0x2cba3e['status'](0x194)[_0xc96d('0x25')]('Not\x20found');}else{return handleError(_0x2cba3e,null);}});};exports[_0xc96d('0x57')]=function(_0x39c363,_0x53bd87,_0x209cca){var _0x54e415=require(_0xc96d('0x58'));var _0x106900=![];var _0x2b493e={'$and':[db['sequelize'][_0xc96d('0x38')](db[_0xc96d('0x59')]['fn'](_0xc96d('0x5a'),db['sequelize']['col'](_0xc96d('0x4a'))),_0x39c363['query']['token'])]};if(_0x39c363['query'][_0xc96d('0x2a')]&&_0x39c363[_0xc96d('0x2f')][_0xc96d('0x2a')]===_0xc96d('0x4a')){_0x2b493e['$and'][_0xc96d('0x5b')]({'uniqueid':_0x39c363[_0xc96d('0x42')]['id']});}else{_0x2b493e['$and'][_0xc96d('0x5b')]({'id':_0x39c363[_0xc96d('0x42')]['id']});}return db['VoiceRecording'][_0xc96d('0x47')]({'where':_0x2b493e,'attributes':['id',_0xc96d('0x4b')],'raw':!![]})[_0xc96d('0x21')](handleEntityNotFound(_0x53bd87,null))['then'](function(_0x4a23dc){if(_0x4a23dc){var _0x4dfad0=util[_0xc96d('0x2e')](_0xc96d('0x4c'),_0x4a23dc['value']);if(fs[_0xc96d('0x4d')](_0x4dfad0)){_0x106900=!![];return _0x54e415[_0xc96d('0x4e')](_0x4dfad0,_0x4a23dc['value'],config[_0xc96d('0x4f')][_0xc96d('0x5c')])[_0xc96d('0x21')](function(){return _0x4a23dc;});}return _0x4a23dc;}})['then'](function(_0x26878){if(_0x26878){if(!fs[_0xc96d('0x4d')](_0x26878[_0xc96d('0x4b')])){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x26878[_0xc96d('0x53')]){return _0x53bd87[_0xc96d('0x49')](_0x26878['value'],_0x26878[_0xc96d('0x53')]+path[_0xc96d('0x54')](_0x26878[_0xc96d('0x4b')]),function(){if(_0x106900){fs[_0xc96d('0x55')](_0x26878[_0xc96d('0x4b')]);}});}else{return _0x53bd87[_0xc96d('0x49')](_0x26878[_0xc96d('0x4b')],function(_0x5cba90){if(_0x106900){fs[_0xc96d('0x55')](_0x26878[_0xc96d('0x4b')]);}});}}})[_0xc96d('0x41')](handleError(_0x53bd87,null));};exports[_0xc96d('0x22')]=function(_0x6457a6,_0x5222a7){return db['VoiceRecording']['find']({'where':{'id':_0x6457a6[_0xc96d('0x42')]['id']}})['then'](function(_0x1f922b){if(_[_0xc96d('0x5d')](_0x1f922b)){throw new ReferenceError(_0xc96d('0x5e'));}return _0x1f922b;})[_0xc96d('0x21')](function(_0x3dbe7a){var _0x18c074=_0x3dbe7a['value'];logger[_0xc96d('0x5f')](_0xc96d('0x60'),_0x18c074);if(!_[_0xc96d('0x5d')](_0x3dbe7a[_0xc96d('0x4b')])&&fs[_0xc96d('0x4d')](_0x18c074)){logger[_0xc96d('0x5f')](_0xc96d('0x61')+_0x18c074+_0xc96d('0x62'));fs[_0xc96d('0x63')](_0x18c074);}_0x18c074=_0x18c074+_0xc96d('0x64');if(!_[_0xc96d('0x5d')](_0x3dbe7a[_0xc96d('0x4b')])&&fs[_0xc96d('0x4d')](_0x18c074)){logger['info'](_0xc96d('0x61')+_0x18c074+_0xc96d('0x62'));fs[_0xc96d('0x63')](_0x18c074);}return _0x3dbe7a;})['then'](function(_0x3a8518){if(!_0x3a8518)throw new InternalError();return _0x3a8518['destroy']();})[_0xc96d('0x21')](function(){_0x5222a7[_0xc96d('0x15')](0xcc)[_0xc96d('0x16')]();})[_0xc96d('0x41')](handleError(_0x5222a7,null));};function getBucketslist(_0x31e208,_0x4993bf,_0x12faa7){return new Promise(function(_0x2eb564,_0x366712){var _0x32976a=new AWS['S3']({'accessKeyId':_0x4993bf,'secretAccessKey':_0x31e208,'region':_0x12faa7});_0x32976a[_0xc96d('0x65')]({},function(_0x5a0ee9,_0x5d42af){if(_0x5a0ee9){return _0x366712(_0x5a0ee9);}else{return _0x2eb564(_0x5d42af);}});});}function createBucket(_0x5c7b3a,_0x2508ef,_0x1d9493,_0xff50bd){return new Promise(function(_0x5ee15e,_0x5da784){var _0x1e360a=new AWS['S3']({'accessKeyId':_0x2508ef,'secretAccessKey':_0x5c7b3a,'region':_0x1d9493});_0x1e360a[_0xc96d('0x66')]({'Bucket':_0xff50bd},function(_0x2bde7d,_0x557bb3){if(_0x2bde7d){return _0x5da784(_0x2bde7d);}else{return _0x5ee15e(_0x557bb3);}});});}function uploadFile(_0x3e4eee,_0x471ab1,_0x4d95e8,_0x36b455,_0x363a7e,_0x3da3f0){return new Promise(function(_0x3c34ed,_0xac0220){var _0x2b8bb5=new AWS['S3']({'accessKeyId':_0x471ab1,'secretAccessKey':_0x3e4eee,'region':_0x4d95e8});_0x2b8bb5[_0xc96d('0x67')]({'Bucket':_0x36b455,'Key':_0x363a7e,'Body':_0x3da3f0},function(_0x33c052,_0x556d64){if(_0x33c052){return _0xac0220(_0x33c052);}else{return _0x3c34ed(_0x556d64);}});});}function startTranscribe(_0x51d901,_0x303273,_0x437046,_0x5ce4a9,_0x31dfab,_0x565b58){return new Promise(function(_0x32d317,_0x334df2){var _0x519266=new AWS['TranscribeService']({'accessKeyId':_0x303273,'secretAccessKey':_0x51d901,'region':_0x437046});_0x519266[_0xc96d('0x68')]({'TranscriptionJobName':_0x5ce4a9,'LanguageCode':_0x31dfab,'Media':{'MediaFileUri':_0x565b58}},function(_0x3c8764,_0x34d6be){if(_0x3c8764){return _0x334df2(_0x3c8764);}else{return _0x32d317(_0x34d6be);}});});}function transcribe(_0x544ece,_0x479c96,_0x28b831,_0x57e6b6,_0xe1a9d8,_0x1521bb,_0x508c9f){return new Promise(function(_0x4e5ca3,_0x42da40){var _0xb67374={};logger[_0xc96d('0x5f')](util[_0xc96d('0x2e')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x544ece,_0xe1a9d8));return uploadFile(_0x479c96,_0x28b831,_0x57e6b6,_0xe1a9d8,path[_0xc96d('0x69')](_0x1521bb),fs['readFileSync'](_0x1521bb))[_0xc96d('0x21')](function(_0x98137b){logger['info'](util[_0xc96d('0x2e')](_0xc96d('0x6a'),_0x544ece,_0xe1a9d8,_0x98137b[_0xc96d('0x6b')]));_0xb67374[_0xc96d('0x6c')]=_0x98137b[_0xc96d('0x6d')];_0xb67374['location']=_0x98137b[_0xc96d('0x6b')];logger[_0xc96d('0x5f')](util[_0xc96d('0x2e')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x544ece));return startTranscribe(_0x479c96,_0x28b831,_0x57e6b6,uuidv4(),_0x508c9f,_0x98137b[_0xc96d('0x6b')]);})[_0xc96d('0x21')](function(_0x4ef4dd){logger['info'](util['format'](_0xc96d('0x6e'),_0x544ece,_0x4ef4dd[_0xc96d('0x6f')][_0xc96d('0x70')]));_0xb67374[_0xc96d('0x71')]=_0x4ef4dd[_0xc96d('0x6f')][_0xc96d('0x70')];_0xb67374['transcribeStatus']=_0x4ef4dd[_0xc96d('0x6f')][_0xc96d('0x72')];return _0x4e5ca3(_0xb67374);})[_0xc96d('0x41')](function(_0x56f9cc){return _0x42da40(_0x56f9cc);});});}exports[_0xc96d('0x73')]=function(_0x3cad0b,_0x11cbaf,_0x378b8c){var _0x5d2cac;var _0x1b434d;var _0x2027c6;var _0xad0c79=require(_0xc96d('0x58'));return db[_0xc96d('0x28')][_0xc96d('0x74')]({'where':{'id':_0x3cad0b['params']['id']}})['then'](function(_0x31ee8c){if(_0x31ee8c){var _0x199977=util['format'](_0xc96d('0x4c'),_0x31ee8c[_0xc96d('0x4b')]);if(fs[_0xc96d('0x4d')](_0x199977)){cypher=!![];return _0xad0c79[_0xc96d('0x4e')](_0x199977,_0x31ee8c[_0xc96d('0x4b')],config['secrets'][_0xc96d('0x5c')])['then'](function(){return _0x31ee8c;});}return _0x31ee8c;}})[_0xc96d('0x21')](function(_0x1c3a21){if(!_0x1c3a21){throw new db['Sequelize']['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x1b434d=_0x1c3a21;return db[_0xc96d('0x75')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x11cbaf,null))[_0xc96d('0x21')](function(_0x334a63){if(_0x334a63){_0x5d2cac=_0x334a63;if(!_0x5d2cac[_0xc96d('0x76')]||!_0x5d2cac[_0xc96d('0x77')]||!_0x5d2cac[_0xc96d('0x78')]||!_0x5d2cac[_0xc96d('0x79')]||!_0x5d2cac[_0xc96d('0x6c')]){throw new db[(_0xc96d('0x50'))][(_0xc96d('0x51'))](_0xc96d('0x7a'));}if(_0x3cad0b[_0xc96d('0x46')][_0xc96d('0x7b')]&&(!_0x5d2cac[_0xc96d('0x7c')]||!_0x5d2cac['sentimentAccountId']||!_0x5d2cac[_0xc96d('0x7d')]||!_0x5d2cac['language']||!_0x5d2cac['bucket'])){throw new db[(_0xc96d('0x50'))]['ValidationError'](_0xc96d('0x7e'));}return db[_0xc96d('0x7f')]['findOne']({'where':{'id':_0x5d2cac['transcribeAccountId']}});}})[_0xc96d('0x21')](function(_0x133d0e){if(!_0x133d0e){throw new db[(_0xc96d('0x50'))][(_0xc96d('0x51'))](_0xc96d('0x80'));}if(!_0x133d0e['data1']||!_0x133d0e[_0xc96d('0x81')]){throw new db[(_0xc96d('0x50'))][(_0xc96d('0x51'))](_0xc96d('0x82'));}_0x2027c6=_0x133d0e;return getBucketslist(_0x2027c6[_0xc96d('0x83')],_0x2027c6[_0xc96d('0x81')],_0x5d2cac['transcribeRegion']);})[_0xc96d('0x21')](function(_0x3ab857){if(_0x3ab857&&_0x3ab857['Buckets']){var _0x3f6155=_['find'](_0x3ab857[_0xc96d('0x84')],function(_0x18cfbf){return _0x18cfbf[_0xc96d('0x85')]===_0x5d2cac['bucket'];});if(!_0x3f6155){logger[_0xc96d('0x5f')](util['format'](_0xc96d('0x86'),_0x3cad0b['params']['id'],_0x5d2cac['bucket']));return createBucket(_0x2027c6['data1'],_0x2027c6[_0xc96d('0x81')],_0x5d2cac[_0xc96d('0x78')],_0x5d2cac['bucket']);}logger['info'](util['format'](_0xc96d('0x87'),_0x3cad0b[_0xc96d('0x42')]['id'],_0x5d2cac[_0xc96d('0x6c')]));return;}})[_0xc96d('0x21')](function(_0x5541f8){if(_0x1b434d[_0xc96d('0x88')]===_0xc96d('0x89')){return transcribe(_0x3cad0b[_0xc96d('0x42')]['id'],_0x2027c6[_0xc96d('0x83')],_0x2027c6[_0xc96d('0x81')],_0x5d2cac[_0xc96d('0x78')],_0x5d2cac[_0xc96d('0x6c')],_0x1b434d[_0xc96d('0x4b')],_0x5d2cac[_0xc96d('0x79')]);}else{logger['info'](util[_0xc96d('0x2e')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3cad0b['params']['id']));return{'transcribeStatus':_0xc96d('0x8a')};}})[_0xc96d('0x21')](function(_0x22d84e){if(_0x22d84e){_0x22d84e[_0xc96d('0x8b')]=_0x3cad0b['body'][_0xc96d('0x7b')];return _0x1b434d[_0xc96d('0x8c')](_0x22d84e);}})[_0xc96d('0x21')](respondWithResult(_0x11cbaf,null))[_0xc96d('0x41')](handleError(_0x11cbaf,null));};function writeFile(_0x337198,_0x424247){return new Promise(function(_0x445380,_0x4fd650){fs[_0xc96d('0x8d')](_0x424247,_0x337198,function(_0xe2e22d,_0x59ddab){if(_0xe2e22d){return _0x4fd650(_0xe2e22d);}else{return _0x445380(_0x59ddab);}});});}exports[_0xc96d('0x8e')]=function(_0x554456,_0x5e1ec5,_0x20992e){return db[_0xc96d('0x28')][_0xc96d('0x74')]({'where':{'id':_0x554456['params']['id']}})[_0xc96d('0x21')](handleEntityNotFound(_0x5e1ec5))[_0xc96d('0x21')](function(_0xea74f5){if(_0xea74f5&&_0xea74f5[_0xc96d('0x8f')]){var _0x2ce489=_0xea74f5[_0xc96d('0x8f')];var _0x312851=config['root']+_0xc96d('0x90')+_0xea74f5['id']+_0xc96d('0x91');if(fs[_0xc96d('0x4d')](_0x312851)){return _0x312851;}return writeFile(_0x2ce489,_0x312851)[_0xc96d('0x21')](function(){return _0x312851;});}else{throw new db[(_0xc96d('0x50'))][(_0xc96d('0x51'))](_0xc96d('0x92'));}})[_0xc96d('0x21')](function(_0x4dd23d){return _0x5e1ec5['download'](_0x4dd23d);})[_0xc96d('0x41')](handleError(_0x5e1ec5));}; \ No newline at end of file +var _0xa152=['CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','writeFile','downloadTranscribe','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','uuid/v4','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','sendStatus','error','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','rows','catch','show','params','include','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','sequelize','MD5','col','$and','push','recording','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','end','listBuckets','createBucket','startTranscriptionJob','format','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xa152,0x136));var _0x2a15=function(_0x10f860,_0x2c1d40){_0x10f860=_0x10f860-0x0;var _0x530205=_0xa152[_0x10f860];return _0x530205;};'use strict';var emlformat=require(_0x2a15('0x0'));var rimraf=require(_0x2a15('0x1'));var zipdir=require(_0x2a15('0x2'));var jsonpatch=require(_0x2a15('0x3'));var rp=require(_0x2a15('0x4'));var moment=require(_0x2a15('0x5'));var BPromise=require(_0x2a15('0x6'));var Mustache=require(_0x2a15('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2a15('0x8'));var csv=require('to-csv');var ejs=require(_0x2a15('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a15('0xa'));var crypto=require(_0x2a15('0xb'));var jsforce=require(_0x2a15('0xc'));var deskjs=require(_0x2a15('0xd'));var toCsv=require(_0x2a15('0xe'));var querystring=require(_0x2a15('0xf'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x2a15('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2a15('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a15('0x12'));var logger=require(_0x2a15('0x13'))(_0x2a15('0x14'));var utils=require(_0x2a15('0x15'));var config=require(_0x2a15('0x16'));var licenseUtil=require(_0x2a15('0x17'));var db=require(_0x2a15('0x18'))['db'];function respondWithStatusCode(_0x48a668,_0xe6f38c){_0xe6f38c=_0xe6f38c||0xcc;return function(_0x39f790){if(_0x39f790){return _0x48a668['sendStatus'](_0xe6f38c);}return _0x48a668[_0x2a15('0x19')](_0xe6f38c)['end']();};}function respondWithResult(_0x3d4829,_0x219ce8){_0x219ce8=_0x219ce8||0xc8;return function(_0x2014ee){if(_0x2014ee){return _0x3d4829['status'](_0x219ce8)[_0x2a15('0x1a')](_0x2014ee);}};}function respondWithFilteredResult(_0x27e115,_0x80ce47){return function(_0x45c61b){if(_0x45c61b){var _0x33864d=typeof _0x80ce47[_0x2a15('0x1b')]===_0x2a15('0x1c')&&typeof _0x80ce47[_0x2a15('0x1d')]===_0x2a15('0x1c');var _0xe02bc5=_0x45c61b[_0x2a15('0x1e')];var _0x1db566=_0x33864d?0x0:_0x80ce47['offset'];var _0x46361b=_0x33864d?_0x45c61b['count']:_0x80ce47[_0x2a15('0x1b')]+_0x80ce47['limit'];var _0x273dda;if(_0x46361b>=_0xe02bc5){_0x46361b=_0xe02bc5;_0x273dda=0xc8;}else{_0x273dda=0xce;}_0x27e115[_0x2a15('0x19')](_0x273dda);return _0x27e115[_0x2a15('0x1f')]('Content-Range',_0x1db566+'-'+_0x46361b+'/'+_0xe02bc5)[_0x2a15('0x1a')](_0x45c61b);}return null;};}function patchUpdates(_0xde32cd){return function(_0xb0a7){try{jsonpatch[_0x2a15('0x20')](_0xb0a7,_0xde32cd,!![]);}catch(_0x57f729){return BPromise[_0x2a15('0x21')](_0x57f729);}return _0xb0a7['save']();};}function saveUpdates(_0x5561e2,_0x51384d){return function(_0x5066c1){if(_0x5066c1){return _0x5066c1[_0x2a15('0x22')](_0x5561e2)[_0x2a15('0x23')](function(_0x3bc5b6){return _0x3bc5b6;});}return null;};}function removeEntity(_0x41f983,_0x2552e1){return function(_0x2e7636){if(_0x2e7636){return _0x2e7636[_0x2a15('0x24')]()[_0x2a15('0x23')](function(){_0x41f983[_0x2a15('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50b36d,_0x3e47a0){return function(_0xd176ac){if(!_0xd176ac){_0x50b36d[_0x2a15('0x25')](0x194);}return _0xd176ac;};}function handleError(_0x24c02a,_0x5ab7f3){_0x5ab7f3=_0x5ab7f3||0x1f4;return function(_0x4911b1){logger[_0x2a15('0x26')](_0x4911b1['stack']);if(_0x4911b1[_0x2a15('0x27')]){delete _0x4911b1['name'];}_0x24c02a[_0x2a15('0x19')](_0x5ab7f3)['send'](_0x4911b1);};}exports[_0x2a15('0x28')]=function(_0x503835,_0x452f7b){var _0x3691c2={},_0x3a8260={},_0x4e6182={'count':0x0,'rows':[]};var _0x5935db=_[_0x2a15('0x29')](db[_0x2a15('0x2a')][_0x2a15('0x2b')],function(_0x18b02d){return{'name':_0x18b02d[_0x2a15('0x2c')],'type':_0x18b02d[_0x2a15('0x2d')][_0x2a15('0x2e')]};});_0x3a8260[_0x2a15('0x2f')]=_['differenceBy'](_[_0x2a15('0x29')](_0x5935db,_0x2a15('0x27')),['format']);_0x3a8260[_0x2a15('0x30')]=_[_0x2a15('0x31')](_0x503835[_0x2a15('0x30')]);_0x3a8260['filters']=_['intersection'](_0x3a8260[_0x2a15('0x2f')],_0x3a8260['query']);_0x3691c2[_0x2a15('0x32')]=_[_0x2a15('0x33')](_0x3a8260[_0x2a15('0x2f')],qs['fields'](_0x503835['query'][_0x2a15('0x34')]));_0x3691c2[_0x2a15('0x32')]=_0x3691c2[_0x2a15('0x32')][_0x2a15('0x35')]?_0x3691c2[_0x2a15('0x32')]:_0x3a8260[_0x2a15('0x2f')];if(!_0x503835[_0x2a15('0x30')][_0x2a15('0x36')](_0x2a15('0x37'))){_0x3691c2[_0x2a15('0x1d')]=qs['limit'](_0x503835[_0x2a15('0x30')][_0x2a15('0x1d')]);_0x3691c2[_0x2a15('0x1b')]=qs[_0x2a15('0x1b')](_0x503835[_0x2a15('0x30')][_0x2a15('0x1b')]);}_0x3691c2[_0x2a15('0x38')]=qs[_0x2a15('0x39')](_0x503835['query']['sort']);_0x3691c2[_0x2a15('0x3a')]=qs[_0x2a15('0x3b')](_[_0x2a15('0x3c')](_0x503835[_0x2a15('0x30')],_0x3a8260[_0x2a15('0x3b')]),_0x5935db);if(_0x503835[_0x2a15('0x30')][_0x2a15('0x3d')]){_0x3691c2[_0x2a15('0x3a')]=_['merge'](_0x3691c2[_0x2a15('0x3a')],{'$or':_[_0x2a15('0x29')](_0x5935db,function(_0x4e0a6b){if(_0x4e0a6b[_0x2a15('0x2d')]!=='VIRTUAL'){var _0x2f8e3e={};_0x2f8e3e[_0x4e0a6b[_0x2a15('0x27')]]={'$like':'%'+_0x503835['query'][_0x2a15('0x3d')]+'%'};return _0x2f8e3e;}})});}_0x3691c2=_[_0x2a15('0x3e')]({},_0x3691c2,_0x503835[_0x2a15('0x3f')]);var _0x42c78b={'where':_0x3691c2[_0x2a15('0x3a')]};return db[_0x2a15('0x2a')][_0x2a15('0x1e')](_0x42c78b)[_0x2a15('0x23')](function(_0x4881b2){_0x4e6182[_0x2a15('0x1e')]=_0x4881b2;if(_0x503835[_0x2a15('0x30')][_0x2a15('0x40')]){_0x3691c2['include']=[{'all':!![]}];}return db[_0x2a15('0x2a')]['findAll'](_0x3691c2);})[_0x2a15('0x23')](function(_0x262316){_0x4e6182[_0x2a15('0x41')]=_0x262316;return _0x4e6182;})['then'](respondWithFilteredResult(_0x452f7b,_0x3691c2))[_0x2a15('0x42')](handleError(_0x452f7b,null));};exports[_0x2a15('0x43')]=function(_0x26833b,_0x2b9bce){var _0x388a02={'raw':![],'where':{'id':_0x26833b[_0x2a15('0x44')]['id']}},_0x29e56a={};_0x29e56a[_0x2a15('0x2f')]=_[_0x2a15('0x31')](db[_0x2a15('0x2a')][_0x2a15('0x2b')]);_0x29e56a[_0x2a15('0x30')]=_[_0x2a15('0x31')](_0x26833b[_0x2a15('0x30')]);_0x29e56a[_0x2a15('0x3b')]=_[_0x2a15('0x33')](_0x29e56a['model'],_0x29e56a[_0x2a15('0x30')]);_0x388a02['attributes']=_[_0x2a15('0x33')](_0x29e56a[_0x2a15('0x2f')],qs[_0x2a15('0x34')](_0x26833b[_0x2a15('0x30')][_0x2a15('0x34')]));_0x388a02[_0x2a15('0x32')]=_0x388a02[_0x2a15('0x32')]['length']?_0x388a02[_0x2a15('0x32')]:_0x29e56a[_0x2a15('0x2f')];if(_0x26833b[_0x2a15('0x30')][_0x2a15('0x40')]){_0x388a02[_0x2a15('0x45')]=[{'all':!![]}];}_0x388a02=_[_0x2a15('0x3e')]({},_0x388a02,_0x26833b['options']);return db[_0x2a15('0x2a')][_0x2a15('0x46')](_0x388a02)['then'](handleEntityNotFound(_0x2b9bce,null))[_0x2a15('0x23')](respondWithResult(_0x2b9bce,null))[_0x2a15('0x42')](handleError(_0x2b9bce,null));};exports[_0x2a15('0x47')]=function(_0x192820,_0x5b896f){return db[_0x2a15('0x2a')][_0x2a15('0x47')](_0x192820['body'],{})[_0x2a15('0x23')](respondWithResult(_0x5b896f,0xc9))[_0x2a15('0x42')](handleError(_0x5b896f,null));};exports[_0x2a15('0x22')]=function(_0x17ff4b,_0x94d8a9){if(_0x17ff4b[_0x2a15('0x48')]['id']){delete _0x17ff4b[_0x2a15('0x48')]['id'];}return db[_0x2a15('0x2a')]['find']({'where':{'id':_0x17ff4b[_0x2a15('0x44')]['id']}})[_0x2a15('0x23')](handleEntityNotFound(_0x94d8a9,null))[_0x2a15('0x23')](saveUpdates(_0x17ff4b[_0x2a15('0x48')],null))[_0x2a15('0x23')](respondWithResult(_0x94d8a9,null))[_0x2a15('0x42')](handleError(_0x94d8a9,null));};exports[_0x2a15('0x49')]=function(_0x91e698,_0x373be8){return db[_0x2a15('0x2a')]['describe']()['then'](respondWithResult(_0x373be8,null))[_0x2a15('0x42')](handleError(_0x373be8,null));};exports[_0x2a15('0x4a')]=function(_0x2e070e,_0x53a258,_0x58e489){var _0x229050=require(_0x2a15('0x4b'));var _0x4fd615=![];var _0x386f7c={};if(_0x2e070e[_0x2a15('0x30')][_0x2a15('0x2d')]&&_0x2e070e[_0x2a15('0x30')][_0x2a15('0x2d')]==='uniqueid'){_0x386f7c[_0x2a15('0x4c')]=_0x2e070e[_0x2a15('0x44')]['id'];}else{_0x386f7c['id']=_0x2e070e[_0x2a15('0x44')]['id'];}return db[_0x2a15('0x2a')][_0x2a15('0x46')]({'where':_0x386f7c,'attributes':['id',_0x2a15('0x4d')],'raw':!![]})[_0x2a15('0x23')](handleEntityNotFound(_0x53a258,null))[_0x2a15('0x23')](function(_0x4c42da){if(_0x4c42da){var _0x82e5a1=_0x4c42da[_0x2a15('0x4d')];var _0x40c48e=util['format'](_0x2a15('0x4e'),_0x82e5a1);if(fs[_0x2a15('0x4f')](_0x40c48e)){_0x4fd615=!![];return _0x229050[_0x2a15('0x50')](_0x40c48e,_0x82e5a1,config[_0x2a15('0x51')]['recording'])['then'](function(){return _0x4c42da;});}return _0x4c42da;}})['then'](function(_0x531c30){if(_0x531c30){var _0x184bd0=_0x531c30[_0x2a15('0x4d')];if(!fs[_0x2a15('0x4f')](_0x184bd0)){throw new db[(_0x2a15('0x52'))]['ValidationError'](_0x2a15('0x53'));}if(_0x531c30[_0x2a15('0x54')]){return _0x53a258['download'](_0x184bd0,_0x531c30[_0x2a15('0x54')]+path[_0x2a15('0x55')](_0x184bd0),function(){if(_0x4fd615){fs[_0x2a15('0x56')](_0x184bd0);}});}else{return _0x53a258[_0x2a15('0x4a')](_0x184bd0,function(_0x5a3ad8){if(_0x4fd615){fs[_0x2a15('0x56')](_0x184bd0);}});}}})[_0x2a15('0x42')](function(_0x4479e0){if(_0x4479e0[_0x2a15('0x57')]===_0x2a15('0x53')){_0x53a258['status'](0x194)[_0x2a15('0x58')](_0x2a15('0x59'));}else{return handleError(_0x53a258,null);}});};exports['downloads']=function(_0x23d0ee,_0x11c070,_0xe5e448){var _0x308486=require(_0x2a15('0x4b'));var _0x1051a7=![];var _0x5a02e6={'$and':[db['sequelize']['where'](db[_0x2a15('0x5a')]['fn'](_0x2a15('0x5b'),db[_0x2a15('0x5a')][_0x2a15('0x5c')](_0x2a15('0x4c'))),_0x23d0ee['query']['token'])]};if(_0x23d0ee[_0x2a15('0x30')][_0x2a15('0x2d')]&&_0x23d0ee['query'][_0x2a15('0x2d')]==='uniqueid'){_0x5a02e6[_0x2a15('0x5d')][_0x2a15('0x5e')]({'uniqueid':_0x23d0ee['params']['id']});}else{_0x5a02e6[_0x2a15('0x5d')][_0x2a15('0x5e')]({'id':_0x23d0ee['params']['id']});}return db[_0x2a15('0x2a')][_0x2a15('0x46')]({'where':_0x5a02e6,'attributes':['id',_0x2a15('0x4d')],'raw':!![]})[_0x2a15('0x23')](handleEntityNotFound(_0x11c070,null))['then'](function(_0x3c01d7){if(_0x3c01d7){var _0x3b5ef7=util['format'](_0x2a15('0x4e'),_0x3c01d7[_0x2a15('0x4d')]);if(fs[_0x2a15('0x4f')](_0x3b5ef7)){_0x1051a7=!![];return _0x308486[_0x2a15('0x50')](_0x3b5ef7,_0x3c01d7[_0x2a15('0x4d')],config[_0x2a15('0x51')][_0x2a15('0x5f')])['then'](function(){return _0x3c01d7;});}return _0x3c01d7;}})['then'](function(_0x3124f8){if(_0x3124f8){if(!fs[_0x2a15('0x4f')](_0x3124f8[_0x2a15('0x4d')])){throw new db[(_0x2a15('0x52'))][(_0x2a15('0x60'))](_0x2a15('0x53'));}if(_0x3124f8[_0x2a15('0x54')]){return _0x11c070['download'](_0x3124f8[_0x2a15('0x4d')],_0x3124f8['filename']+path[_0x2a15('0x55')](_0x3124f8['value']),function(){if(_0x1051a7){fs[_0x2a15('0x56')](_0x3124f8['value']);}});}else{return _0x11c070[_0x2a15('0x4a')](_0x3124f8[_0x2a15('0x4d')],function(_0x861498){if(_0x1051a7){fs[_0x2a15('0x56')](_0x3124f8[_0x2a15('0x4d')]);}});}}})[_0x2a15('0x42')](handleError(_0x11c070,null));};exports[_0x2a15('0x24')]=function(_0x450684,_0x1e45b3){return db[_0x2a15('0x2a')][_0x2a15('0x46')]({'where':{'id':_0x450684['params']['id']}})['then'](function(_0xbccd96){if(_[_0x2a15('0x61')](_0xbccd96)){throw new ReferenceError(_0x2a15('0x62'));}return _0xbccd96;})[_0x2a15('0x23')](function(_0x173973){var _0xd9dce5=_0x173973[_0x2a15('0x4d')];logger[_0x2a15('0x63')](_0x2a15('0x64'),_0xd9dce5);if(!_['isNil'](_0x173973[_0x2a15('0x4d')])&&fs['existsSync'](_0xd9dce5)){logger[_0x2a15('0x63')](_0x2a15('0x65')+_0xd9dce5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2a15('0x66')](_0xd9dce5);}_0xd9dce5=_0xd9dce5+_0x2a15('0x67');if(!_[_0x2a15('0x61')](_0x173973['value'])&&fs[_0x2a15('0x4f')](_0xd9dce5)){logger[_0x2a15('0x63')](_0x2a15('0x65')+_0xd9dce5+_0x2a15('0x68'));fs[_0x2a15('0x66')](_0xd9dce5);}return _0x173973;})['then'](function(_0x237828){if(!_0x237828)throw new InternalError();return _0x237828['destroy']();})['then'](function(){_0x1e45b3['status'](0xcc)[_0x2a15('0x69')]();})[_0x2a15('0x42')](handleError(_0x1e45b3,null));};function getBucketslist(_0x152890,_0x54657b,_0x446cca){return new Promise(function(_0x2eadf8,_0x117c9c){var _0x2a63ae=new AWS['S3']({'accessKeyId':_0x54657b,'secretAccessKey':_0x152890,'region':_0x446cca});_0x2a63ae[_0x2a15('0x6a')]({},function(_0x1e9804,_0x8cb178){if(_0x1e9804){return _0x117c9c(_0x1e9804);}else{return _0x2eadf8(_0x8cb178);}});});}function createBucket(_0x27afdc,_0x6b698,_0x57876f,_0xab9226){return new Promise(function(_0x36e47d,_0x5cb0e5){var _0x19fe49=new AWS['S3']({'accessKeyId':_0x6b698,'secretAccessKey':_0x27afdc,'region':_0x57876f});_0x19fe49[_0x2a15('0x6b')]({'Bucket':_0xab9226},function(_0x2f2215,_0x6e5e8){if(_0x2f2215){return _0x5cb0e5(_0x2f2215);}else{return _0x36e47d(_0x6e5e8);}});});}function uploadFile(_0x30a760,_0x538a76,_0x3c8b08,_0x24f8af,_0x54cb97,_0x4bf979){return new Promise(function(_0xe1e1e1,_0xec51d6){var _0x4a1c5b=new AWS['S3']({'accessKeyId':_0x538a76,'secretAccessKey':_0x30a760,'region':_0x3c8b08});_0x4a1c5b['upload']({'Bucket':_0x24f8af,'Key':_0x54cb97,'Body':_0x4bf979},function(_0x216a75,_0x10ceea){if(_0x216a75){return _0xec51d6(_0x216a75);}else{return _0xe1e1e1(_0x10ceea);}});});}function startTranscribe(_0x329173,_0x4c7352,_0x530a65,_0x34911a,_0xdd8b91,_0xf6d210){return new Promise(function(_0xe2a089,_0x3a4d65){var _0x2b01fa=new AWS['TranscribeService']({'accessKeyId':_0x4c7352,'secretAccessKey':_0x329173,'region':_0x530a65});_0x2b01fa[_0x2a15('0x6c')]({'TranscriptionJobName':_0x34911a,'LanguageCode':_0xdd8b91,'Media':{'MediaFileUri':_0xf6d210}},function(_0x211c58,_0x34c394){if(_0x211c58){return _0x3a4d65(_0x211c58);}else{return _0xe2a089(_0x34c394);}});});}function transcribe(_0x525037,_0x26c57d,_0x3c5c5d,_0x4d08e2,_0x170cec,_0x3c379d,_0xd56eb5){return new Promise(function(_0x1a8185,_0x1a4311){var _0x474799={};logger[_0x2a15('0x63')](util[_0x2a15('0x6d')](_0x2a15('0x6e'),_0x525037,_0x170cec));return uploadFile(_0x26c57d,_0x3c5c5d,_0x4d08e2,_0x170cec,path[_0x2a15('0x6f')](_0x3c379d),fs[_0x2a15('0x70')](_0x3c379d))[_0x2a15('0x23')](function(_0x4f7c2e){logger[_0x2a15('0x63')](util[_0x2a15('0x6d')](_0x2a15('0x71'),_0x525037,_0x170cec,_0x4f7c2e[_0x2a15('0x72')]));_0x474799[_0x2a15('0x73')]=_0x4f7c2e[_0x2a15('0x74')];_0x474799[_0x2a15('0x75')]=_0x4f7c2e['Location'];logger[_0x2a15('0x63')](util[_0x2a15('0x6d')](_0x2a15('0x76'),_0x525037));return startTranscribe(_0x26c57d,_0x3c5c5d,_0x4d08e2,uuidv4(),_0xd56eb5,_0x4f7c2e[_0x2a15('0x72')]);})[_0x2a15('0x23')](function(_0x205cb9){logger[_0x2a15('0x63')](util[_0x2a15('0x6d')](_0x2a15('0x77'),_0x525037,_0x205cb9['TranscriptionJob']['TranscriptionJobName']));_0x474799['transcribeName']=_0x205cb9[_0x2a15('0x78')][_0x2a15('0x79')];_0x474799['transcribeStatus']=_0x205cb9[_0x2a15('0x78')]['TranscriptionJobStatus'];return _0x1a8185(_0x474799);})[_0x2a15('0x42')](function(_0x116bf3){return _0x1a4311(_0x116bf3);});});}exports[_0x2a15('0x7a')]=function(_0x23d083,_0x2085cb,_0x48b024){var _0x4bd2ab;var _0x483bea;var _0x56f853;var _0x2fe089=require(_0x2a15('0x4b'));return db[_0x2a15('0x2a')]['findOne']({'where':{'id':_0x23d083['params']['id']}})[_0x2a15('0x23')](function(_0x592dde){if(_0x592dde){var _0x506749=util['format'](_0x2a15('0x4e'),_0x592dde[_0x2a15('0x4d')]);if(fs[_0x2a15('0x4f')](_0x506749)){cypher=!![];return _0x2fe089[_0x2a15('0x50')](_0x506749,_0x592dde[_0x2a15('0x4d')],config[_0x2a15('0x51')]['recording'])['then'](function(){return _0x592dde;});}return _0x592dde;}})[_0x2a15('0x23')](function(_0x25aa2f){if(!_0x25aa2f){throw new db[(_0x2a15('0x52'))]['ValidationError'](_0x2a15('0x7b'));}_0x483bea=_0x25aa2f;return db[_0x2a15('0x7c')][_0x2a15('0x7d')]({'where':{'id':0x1}});})[_0x2a15('0x23')](handleEntityNotFound(_0x2085cb,null))[_0x2a15('0x23')](function(_0x1df87f){if(_0x1df87f){_0x4bd2ab=_0x1df87f;if(!_0x4bd2ab[_0x2a15('0x7e')]||!_0x4bd2ab[_0x2a15('0x7f')]||!_0x4bd2ab[_0x2a15('0x80')]||!_0x4bd2ab[_0x2a15('0x81')]||!_0x4bd2ab[_0x2a15('0x73')]){throw new db[(_0x2a15('0x52'))][(_0x2a15('0x60'))](_0x2a15('0x82'));}if(_0x23d083[_0x2a15('0x48')]['runSentiment']&&(!_0x4bd2ab['sentiment']||!_0x4bd2ab[_0x2a15('0x83')]||!_0x4bd2ab[_0x2a15('0x84')]||!_0x4bd2ab[_0x2a15('0x81')]||!_0x4bd2ab[_0x2a15('0x73')])){throw new db['Sequelize']['ValidationError'](_0x2a15('0x85'));}return db[_0x2a15('0x86')]['findOne']({'where':{'id':_0x4bd2ab[_0x2a15('0x7f')]}});}})[_0x2a15('0x23')](function(_0x4c9a77){if(!_0x4c9a77){throw new db[(_0x2a15('0x52'))]['ValidationError'](_0x2a15('0x87'));}if(!_0x4c9a77[_0x2a15('0x88')]||!_0x4c9a77[_0x2a15('0x89')]){throw new db['Sequelize'][(_0x2a15('0x60'))](_0x2a15('0x8a'));}_0x56f853=_0x4c9a77;return getBucketslist(_0x56f853[_0x2a15('0x88')],_0x56f853['data2'],_0x4bd2ab[_0x2a15('0x80')]);})[_0x2a15('0x23')](function(_0x26e527){if(_0x26e527&&_0x26e527[_0x2a15('0x8b')]){var _0x644204=_['find'](_0x26e527[_0x2a15('0x8b')],function(_0x21aaf9){return _0x21aaf9[_0x2a15('0x8c')]===_0x4bd2ab[_0x2a15('0x73')];});if(!_0x644204){logger['info'](util[_0x2a15('0x6d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x23d083[_0x2a15('0x44')]['id'],_0x4bd2ab[_0x2a15('0x73')]));return createBucket(_0x56f853[_0x2a15('0x88')],_0x56f853[_0x2a15('0x89')],_0x4bd2ab[_0x2a15('0x80')],_0x4bd2ab[_0x2a15('0x73')]);}logger[_0x2a15('0x63')](util[_0x2a15('0x6d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x23d083[_0x2a15('0x44')]['id'],_0x4bd2ab[_0x2a15('0x73')]));return;}})['then'](function(_0x49e3a5){if(_0x483bea['transcribeStatus']===_0x2a15('0x8d')){return transcribe(_0x23d083[_0x2a15('0x44')]['id'],_0x56f853[_0x2a15('0x88')],_0x56f853[_0x2a15('0x89')],_0x4bd2ab[_0x2a15('0x80')],_0x4bd2ab[_0x2a15('0x73')],_0x483bea['value'],_0x4bd2ab[_0x2a15('0x81')]);}else{logger[_0x2a15('0x63')](util[_0x2a15('0x6d')](_0x2a15('0x8e'),_0x23d083['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x2a15('0x23')](function(_0x5ba011){if(_0x5ba011){_0x5ba011[_0x2a15('0x8f')]=_0x23d083[_0x2a15('0x48')]['runSentiment'];return _0x483bea['updateAttributes'](_0x5ba011);}})[_0x2a15('0x23')](respondWithResult(_0x2085cb,null))[_0x2a15('0x42')](handleError(_0x2085cb,null));};function writeFile(_0x250432,_0x2bda4a){return new Promise(function(_0x3080cc,_0x5f1fbc){fs[_0x2a15('0x90')](_0x2bda4a,_0x250432,function(_0x47e40e,_0x4f8c7c){if(_0x47e40e){return _0x5f1fbc(_0x47e40e);}else{return _0x3080cc(_0x4f8c7c);}});});}exports[_0x2a15('0x91')]=function(_0x1484bf,_0xe296f0,_0x24a7d9){return db['VoiceRecording'][_0x2a15('0x7d')]({'where':{'id':_0x1484bf['params']['id']}})[_0x2a15('0x23')](handleEntityNotFound(_0xe296f0))[_0x2a15('0x23')](function(_0x3d6f56){if(_0x3d6f56&&_0x3d6f56['fileText']){var _0x1f0c66=_0x3d6f56['fileText'];var _0x18145a=config['root']+_0x2a15('0x92')+_0x3d6f56['id']+'.txt';if(fs['existsSync'](_0x18145a)){return _0x18145a;}return writeFile(_0x1f0c66,_0x18145a)[_0x2a15('0x23')](function(){return _0x18145a;});}else{throw new db[(_0x2a15('0x52'))][(_0x2a15('0x60'))](_0x2a15('0x93'));}})[_0x2a15('0x23')](function(_0x54bc31){return _0xe296f0[_0x2a15('0x4a')](_0x54bc31);})[_0x2a15('0x42')](handleError(_0xe296f0));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 3d3cc8f..c24f289 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 _0x6ccf=['../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x6ccf,0xba));var _0xf6cc=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x6ccf[_0x1daaa9];return _0x1dd221;};'use strict';var _=require(_0xf6cc('0x0'));var util=require(_0xf6cc('0x1'));var logger=require(_0xf6cc('0x2'))(_0xf6cc('0x3'));var moment=require(_0xf6cc('0x4'));var BPromise=require(_0xf6cc('0x5'));var rp=require(_0xf6cc('0x6'));var fs=require('fs');var path=require(_0xf6cc('0x7'));var rimraf=require(_0xf6cc('0x8'));var config=require(_0xf6cc('0x9'));var attributes=require(_0xf6cc('0xa'));module['exports']=function(_0x1adcab,_0x360254){return _0x1adcab[_0xf6cc('0xb')](_0xf6cc('0xc'),attributes,{'tableName':_0xf6cc('0xd'),'paranoid':![],'indexes':[{'name':_0xf6cc('0xe'),'fields':[_0xf6cc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a8f=['exports','define','voice_recordings','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0x6a8f,0x197));var _0xf6a8=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0x6a8f[_0x26b5ff];return _0x58603e;};'use strict';var _=require(_0xf6a8('0x0'));var util=require(_0xf6a8('0x1'));var logger=require(_0xf6a8('0x2'))('api');var moment=require(_0xf6a8('0x3'));var BPromise=require(_0xf6a8('0x4'));var rp=require(_0xf6a8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6a8('0x6'));var config=require(_0xf6a8('0x7'));var attributes=require(_0xf6a8('0x8'));module[_0xf6a8('0x9')]=function(_0x143bb2,_0x143974){return _0x143bb2[_0xf6a8('0xa')]('VoiceRecording',attributes,{'tableName':_0xf6a8('0xb'),'paranoid':![],'indexes':[{'name':_0xf6a8('0xc'),'fields':[_0xf6a8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 95c84e6..52f5b22 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 _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x2cce72,_0x432665){var _0xe78e46=function(_0x5d2992){while(--_0x5d2992){_0x2cce72['push'](_0x2cce72['shift']());}};_0xe78e46(++_0x432665);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x551aef,_0x3a75be){var _0x4b5526=function(_0x486c73){while(--_0x486c73){_0x551aef['push'](_0x551aef['shift']());}};_0x4b5526(++_0x3a75be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 1213060..9c65781 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 _0x9689=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x1ee48a,_0x6560b1){var _0x395a45=function(_0x4c694b){while(--_0x4c694b){_0x1ee48a['push'](_0x1ee48a['shift']());}};_0x395a45(++_0x6560b1);}(_0x9689,0x156));var _0x9968=function(_0x5354b6,_0x5181b9){_0x5354b6=_0x5354b6-0x0;var _0x33128f=_0x9689[_0x5354b6];return _0x33128f;};'use strict';var multer=require(_0x9968('0x0'));var util=require(_0x9968('0x1'));var path=require(_0x9968('0x2'));var timeout=require(_0x9968('0x3'));var express=require(_0x9968('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9968('0x5'));var interaction=require(_0x9968('0x6'));var config=require('../../config/environment');var controller=require(_0x9968('0x7'));router[_0x9968('0x8')]('/',auth[_0x9968('0x9')](),controller[_0x9968('0xa')]);router['get'](_0x9968('0xb'),auth[_0x9968('0x9')](),controller[_0x9968('0xc')]);router['get'](_0x9968('0xd'),auth[_0x9968('0x9')](),controller[_0x9968('0xe')]);router[_0x9968('0xf')]('/',auth[_0x9968('0x9')](),controller[_0x9968('0x10')]);router[_0x9968('0x11')]('/:id',auth[_0x9968('0x9')](),controller[_0x9968('0x12')]);router[_0x9968('0x13')](_0x9968('0xd'),auth[_0x9968('0x9')](),controller[_0x9968('0x14')]);module[_0x9968('0x15')]=router; \ No newline at end of file +var _0x84c7=['express','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','index','/describe','describe','/:id','post','isAuthenticated','create','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x1d03dc,_0x353c52){var _0x2d84ac=function(_0x49ecdc){while(--_0x49ecdc){_0x1d03dc['push'](_0x1d03dc['shift']());}};_0x2d84ac(++_0x353c52);}(_0x84c7,0xe1));var _0x784c=function(_0x3239ed,_0x2f2d3d){_0x3239ed=_0x3239ed-0x0;var _0x3ba613=_0x84c7[_0x3239ed];return _0x3ba613;};'use strict';var multer=require(_0x784c('0x0'));var util=require('util');var path=require(_0x784c('0x1'));var timeout=require(_0x784c('0x2'));var express=require(_0x784c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x784c('0x4'));var interaction=require(_0x784c('0x5'));var config=require('../../config/environment');var controller=require(_0x784c('0x6'));router[_0x784c('0x7')]('/',auth['isAuthenticated'](),controller[_0x784c('0x8')]);router[_0x784c('0x7')](_0x784c('0x9'),auth['isAuthenticated'](),controller[_0x784c('0xa')]);router[_0x784c('0x7')](_0x784c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x784c('0xc')]('/',auth[_0x784c('0xd')](),controller[_0x784c('0xe')]);router[_0x784c('0xf')](_0x784c('0xb'),auth[_0x784c('0xd')](),controller[_0x784c('0x10')]);router[_0x784c('0x11')](_0x784c('0xb'),auth[_0x784c('0xd')](),controller['destroy']);module[_0x784c('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 557053c..f101bd9 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 _0x5b35=['attended','STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x469020,_0x3ad9c7){var _0x34d9b6=function(_0x14ad49){while(--_0x14ad49){_0x469020['push'](_0x469020['shift']());}};_0x34d9b6(++_0x3ad9c7);}(_0x5b35,0x11b));var _0x55b3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5b35[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x55b3('0x0'));var moment=require(_0x55b3('0x1'));module[_0x55b3('0x2')]={'type':{'type':Sequelize[_0x55b3('0x3')](_0x55b3('0x4'),_0x55b3('0x5'))},'result':{'type':Sequelize[_0x55b3('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x55b3('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x55b3('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x55b3('0x6')]},'transferercontext':{'type':Sequelize[_0x55b3('0x6')]},'transfererexten':{'type':Sequelize[_0x55b3('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x55b3('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x55b3('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x55b3('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x55b3('0x6')]},'transfereeexten':{'type':Sequelize[_0x55b3('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x55b3('0x6')]},'isexternal':{'type':Sequelize[_0x55b3('0x3')](_0x55b3('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x55b3('0x6')]}}; \ No newline at end of file +var _0xeaff=['STRING','moment','exports','ENUM'];(function(_0x218dd8,_0x46df98){var _0x3de3f2=function(_0xeb2f61){while(--_0xeb2f61){_0x218dd8['push'](_0x218dd8['shift']());}};_0x3de3f2(++_0x46df98);}(_0xeaff,0x131));var _0xfeaf=function(_0x1251f1,_0x2edc4a){_0x1251f1=_0x1251f1-0x0;var _0x514d6c=_0xeaff[_0x1251f1];return _0x514d6c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfeaf('0x0'));module[_0xfeaf('0x1')]={'type':{'type':Sequelize[_0xfeaf('0x2')]('blind','attended')},'result':{'type':Sequelize[_0xfeaf('0x3')]},'transfererchannel':{'type':Sequelize[_0xfeaf('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xfeaf('0x3')]},'transferercalleridname':{'type':Sequelize[_0xfeaf('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xfeaf('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xfeaf('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xfeaf('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xfeaf('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xfeaf('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xfeaf('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xfeaf('0x3')]},'transfereecontext':{'type':Sequelize[_0xfeaf('0x3')]},'transfereeexten':{'type':Sequelize[_0xfeaf('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xfeaf('0x3')]},'isexternal':{'type':Sequelize[_0xfeaf('0x2')]('Yes','No')},'context':{'type':Sequelize[_0xfeaf('0x3')]},'extension':{'type':Sequelize[_0xfeaf('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index d2108dd..c202488 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 _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','VoiceTransferReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','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'];(function(_0x276c70,_0x593869){var _0x1a20c4=function(_0x9b5c3){while(--_0x9b5c3){_0x276c70['push'](_0x276c70['shift']());}};_0x1a20c4(++_0x593869);}(_0x7a54,0x106));var _0x47a5=function(_0x14e56a,_0x2fb198){_0x14e56a=_0x14e56a-0x0;var _0x1a94e8=_0x7a54[_0x14e56a];return _0x1a94e8;};'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['VoiceTransferReport'][_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['VoiceTransferReport']['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['VoiceTransferReport']['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('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['VoiceTransferReport'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file +var _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','VoiceTransferReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','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'];(function(_0x23fcec,_0x48ec4c){var _0x447567=function(_0x4781bb){while(--_0x4781bb){_0x23fcec['push'](_0x23fcec['shift']());}};_0x447567(++_0x48ec4c);}(_0x7a54,0x106));var _0x47a5=function(_0x57a2fd,_0x8c5080){_0x57a2fd=_0x57a2fd-0x0;var _0x3e48b8=_0x7a54[_0x57a2fd];return _0x3e48b8;};'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['VoiceTransferReport'][_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['VoiceTransferReport']['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['VoiceTransferReport']['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('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['VoiceTransferReport'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d566170..6e963c0 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 _0x9d1d=['lodash','api','path','rimraf','./voiceTransferReport.attributes','VoiceTransferReport','report_call_transfer'];(function(_0x563bdf,_0x1f9718){var _0x7b58e6=function(_0x63192c){while(--_0x63192c){_0x563bdf['push'](_0x563bdf['shift']());}};_0x7b58e6(++_0x1f9718);}(_0x9d1d,0x118));var _0xd9d1=function(_0x3bafe6,_0x3432b7){_0x3bafe6=_0x3bafe6-0x0;var _0x30bc43=_0x9d1d[_0x3bafe6];return _0x30bc43;};'use strict';var _=require(_0xd9d1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd9d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9d1('0x2'));var rimraf=require(_0xd9d1('0x3'));var config=require('../../config/environment');var attributes=require(_0xd9d1('0x4'));module['exports']=function(_0x2450de,_0x1ddd64){return _0x2450de['define'](_0xd9d1('0x5'),attributes,{'tableName':_0xd9d1('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd987=['report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define'];(function(_0x598275,_0x3fed64){var _0x5979be=function(_0xd6ce55){while(--_0xd6ce55){_0x598275['push'](_0x598275['shift']());}};_0x5979be(++_0x3fed64);}(_0xd987,0x15d));var _0x7d98=function(_0x3c9d05,_0xe34f93){_0x3c9d05=_0x3c9d05-0x0;var _0x110261=_0xd987[_0x3c9d05];return _0x110261;};'use strict';var _=require(_0x7d98('0x0'));var util=require(_0x7d98('0x1'));var logger=require(_0x7d98('0x2'))(_0x7d98('0x3'));var moment=require(_0x7d98('0x4'));var BPromise=require(_0x7d98('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d98('0x6'));var rimraf=require(_0x7d98('0x7'));var config=require(_0x7d98('0x8'));var attributes=require(_0x7d98('0x9'));module['exports']=function(_0x1319d9,_0x41c8f9){return _0x1319d9[_0x7d98('0xa')]('VoiceTransferReport',attributes,{'tableName':_0x7d98('0xb'),'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 2ecc44f..6adc2b3 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 _0xf874=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','moment','bluebird','randomstring'];(function(_0x54b749,_0x45913f){var _0x5a1b77=function(_0x462b04){while(--_0x462b04){_0x54b749['push'](_0x54b749['shift']());}};_0x5a1b77(++_0x45913f);}(_0xf874,0xed));var _0x4f87=function(_0x415828,_0x210738){_0x415828=_0x415828-0x0;var _0x27681a=_0xf874[_0x415828];return _0x27681a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f87('0x0'));var BPromise=require(_0x4f87('0x1'));var rs=require(_0x4f87('0x2'));var fs=require('fs');var Redis=require(_0x4f87('0x3'));var db=require(_0x4f87('0x4'))['db'];var utils=require(_0x4f87('0x5'));var logger=require('../../config/logger')(_0x4f87('0x6'));var config=require(_0x4f87('0x7'));var jayson=require(_0x4f87('0x8'));var client=jayson[_0x4f87('0x9')][_0x4f87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44fea6,_0x4a0662,_0x3a89e3){return new BPromise(function(_0x194853,_0x592008){return client[_0x4f87('0xb')](_0x44fea6,_0x3a89e3)[_0x4f87('0xc')](function(_0x4d8354){logger[_0x4f87('0xd')](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));logger[_0x4f87('0x10')](_0x4f87('0x11'),_0x4a0662,_0x4f87('0xf'),JSON[_0x4f87('0x12')](_0x4d8354));if(_0x4d8354['error']){if(_0x4d8354['error'][_0x4f87('0x13')]===0x1f4){logger[_0x4f87('0x14')](_0x4f87('0xe'),_0x4a0662,_0x4d8354['error']['message']);return _0x592008(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}logger[_0x4f87('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x4a0662,_0x4d8354[_0x4f87('0x14')]['message']);return _0x194853(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}else{logger['info'](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));_0x194853(_0x4d8354[_0x4f87('0x16')][_0x4f87('0x15')]);}})[_0x4f87('0x17')](function(_0x3bd90f){logger['error'](_0x4f87('0xe'),_0x4a0662,_0x3bd90f);_0x592008(_0x3bd90f);});});}exports['CreateVoiceTransferReport']=function(_0x10551e){var _0x6a3017=this;return new Promise(function(_0x46492d,_0x42c399){return db[_0x4f87('0x18')][_0x4f87('0x19')](_0x10551e[_0x4f87('0x1a')],{'raw':_0x10551e[_0x4f87('0x1b')]?_0x10551e[_0x4f87('0x1b')][_0x4f87('0x1c')]===undefined?!![]:![]:!![]})[_0x4f87('0xc')](function(_0x2c13a0){logger[_0x4f87('0xd')]('CreateVoiceTransferReport',_0x10551e);logger['debug'](_0x4f87('0x1d'),_0x10551e,JSON[_0x4f87('0x12')](_0x2c13a0));_0x46492d(_0x2c13a0);})['catch'](function(_0x592edd){logger[_0x4f87('0x14')]('CreateVoiceTransferReport',_0x592edd['message'],_0x10551e);_0x42c399(_0x6a3017[_0x4f87('0x14')](0x1f4,_0x592edd[_0x4f87('0x15')]));});});}; \ No newline at end of file +var _0x182b=['VoiceTransferReport','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport'];(function(_0x57f2a3,_0x165575){var _0x54601f=function(_0x3b6fe0){while(--_0x3b6fe0){_0x57f2a3['push'](_0x57f2a3['shift']());}};_0x54601f(++_0x165575);}(_0x182b,0xf5));var _0xb182=function(_0x3a66a5,_0x4abf25){_0x3a66a5=_0x3a66a5-0x0;var _0x5931f1=_0x182b[_0x3a66a5];return _0x5931f1;};'use strict';var _=require(_0xb182('0x0'));var util=require(_0xb182('0x1'));var moment=require(_0xb182('0x2'));var BPromise=require(_0xb182('0x3'));var rs=require(_0xb182('0x4'));var fs=require('fs');var Redis=require(_0xb182('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb182('0x6'));var logger=require(_0xb182('0x7'))('rpc');var config=require(_0xb182('0x8'));var jayson=require(_0xb182('0x9'));var client=jayson[_0xb182('0xa')][_0xb182('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x442d3a,_0x4e416f,_0x4ae32e){return new BPromise(function(_0x3bec85,_0x3ed3c5){return client[_0xb182('0xc')](_0x442d3a,_0x4ae32e)['then'](function(_0x4afa82){logger[_0xb182('0xd')](_0xb182('0xe'),_0x4e416f,_0xb182('0xf'));logger[_0xb182('0x10')](_0xb182('0x11'),_0x4e416f,_0xb182('0xf'),JSON[_0xb182('0x12')](_0x4afa82));if(_0x4afa82[_0xb182('0x13')]){if(_0x4afa82['error'][_0xb182('0x14')]===0x1f4){logger['error'](_0xb182('0xe'),_0x4e416f,_0x4afa82[_0xb182('0x13')]['message']);return _0x3ed3c5(_0x4afa82[_0xb182('0x13')]['message']);}logger[_0xb182('0x13')](_0xb182('0xe'),_0x4e416f,_0x4afa82[_0xb182('0x13')][_0xb182('0x15')]);return _0x3bec85(_0x4afa82[_0xb182('0x13')][_0xb182('0x15')]);}else{logger[_0xb182('0xd')](_0xb182('0xe'),_0x4e416f,'request\x20sent');_0x3bec85(_0x4afa82[_0xb182('0x16')]['message']);}})[_0xb182('0x17')](function(_0x18cfdd){logger[_0xb182('0x13')](_0xb182('0xe'),_0x4e416f,_0x18cfdd);_0x3ed3c5(_0x18cfdd);});});}exports[_0xb182('0x18')]=function(_0x2f45a7){var _0x4e44ae=this;return new Promise(function(_0x1d3be9,_0x4fbbe7){return db[_0xb182('0x19')]['create'](_0x2f45a7[_0xb182('0x1a')],{'raw':_0x2f45a7[_0xb182('0x1b')]?_0x2f45a7['options'][_0xb182('0x1c')]===undefined?!![]:![]:!![]})[_0xb182('0x1d')](function(_0x132140){logger[_0xb182('0xd')](_0xb182('0x18'),_0x2f45a7);logger['debug'](_0xb182('0x18'),_0x2f45a7,JSON[_0xb182('0x12')](_0x132140));_0x1d3be9(_0x132140);})[_0xb182('0x17')](function(_0x1a412c){logger[_0xb182('0x13')](_0xb182('0x18'),_0x1a412c[_0xb182('0x15')],_0x2f45a7);_0x4fbbe7(_0x4e44ae[_0xb182('0x13')](0x1f4,_0x1a412c['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 3a2eb35..09d8353 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 _0x8d53=['hangup','answer','/hold','hold','/unhold','unhold','transfer','exports','express','Router','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hangup'];(function(_0x352217,_0x5481d7){var _0x107d4b=function(_0x6d068d){while(--_0x6d068d){_0x352217['push'](_0x352217['shift']());}};_0x107d4b(++_0x5481d7);}(_0x8d53,0x1c2));var _0x38d5=function(_0x3faf65,_0x70b5c3){_0x3faf65=_0x3faf65-0x0;var _0x5d66f3=_0x8d53[_0x3faf65];return _0x5d66f3;};'use strict';var express=require(_0x38d5('0x0'));var router=express[_0x38d5('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x38d5('0x2'));router[_0x38d5('0x3')](_0x38d5('0x4'),auth[_0x38d5('0x5')](),auth[_0x38d5('0x6')](),controller[_0x38d5('0x7')]);router[_0x38d5('0x3')](_0x38d5('0x8'),auth['isAuthenticated'](),auth[_0x38d5('0x6')](),controller[_0x38d5('0x9')]);router[_0x38d5('0x3')]('/answer',auth[_0x38d5('0x5')](),auth[_0x38d5('0x6')](),controller[_0x38d5('0xa')]);router[_0x38d5('0x3')](_0x38d5('0xb'),auth['isAuthenticated'](),auth[_0x38d5('0x6')](),controller[_0x38d5('0xc')]);router['post'](_0x38d5('0xd'),auth[_0x38d5('0x5')](),auth[_0x38d5('0x6')](),controller[_0x38d5('0xe')]);router['post']('/calls',auth[_0x38d5('0x5')](),auth[_0x38d5('0x6')](),controller['calls']);router[_0x38d5('0x3')]('/transfer',auth[_0x38d5('0x5')](),auth[_0x38d5('0x6')](),controller[_0x38d5('0xf')]);module[_0x38d5('0x10')]=router; \ No newline at end of file +var _0xb4e6=['unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hangup','/hold','hold','/unhold'];(function(_0x572bf8,_0x23d0d9){var _0xa1944a=function(_0x4d3c45){while(--_0x4d3c45){_0x572bf8['push'](_0x572bf8['shift']());}};_0xa1944a(++_0x23d0d9);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0xb4e6[_0x255ac0];return _0x437bf1;};'use strict';var express=require(_0x6b4e('0x0'));var router=express['Router']();var auth=require(_0x6b4e('0x1'));var controller=require(_0x6b4e('0x2'));router[_0x6b4e('0x3')](_0x6b4e('0x4'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0x7')]);router['post'](_0x6b4e('0x8'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['hangup']);router[_0x6b4e('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6b4e('0x6')](),controller['answer']);router['post'](_0x6b4e('0x9'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xa')]);router[_0x6b4e('0x3')](_0x6b4e('0xb'),auth[_0x6b4e('0x5')](),auth['canUpdate'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x3')]('/calls',auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xd')]);router[_0x6b4e('0x3')](_0x6b4e('0xe'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['transfer']);module[_0x6b4e('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 9d3794c..9db9385 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 _0x8f7d=['entityFound:','webbar:hangup','hangup\x20executed!','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../config/environment','jayson/promise','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','error','stack','name','status','send','then','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId\x20','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','hangup','hangup\x20fired:','length','sessionId'];(function(_0x1af046,_0x218baa){var _0x479abf=function(_0x250048){while(--_0x250048){_0x1af046['push'](_0x1af046['shift']());}};_0x479abf(++_0x218baa);}(_0x8f7d,0xf5));var _0xd8f7=function(_0x395cdc,_0x1bd668){_0x395cdc=_0x395cdc-0x0;var _0x19b4b6=_0x8f7d[_0x395cdc];return _0x19b4b6;};'use strict';var path=require(_0xd8f7('0x0'));var fs=require('fs');var _=require(_0xd8f7('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xd8f7('0x2'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xd8f7('0x3'));var amiClient=jayson['client'][_0xd8f7('0x4')]({'port':0x232a});var logger=require(_0xd8f7('0x5'))(_0xd8f7('0x6'));var Redis=require(_0xd8f7('0x7'));config['redis']=_[_0xd8f7('0x8')](config[_0xd8f7('0x9')],{'host':_0xd8f7('0xa'),'port':0x18eb});var io=require(_0xd8f7('0xb'))(new Redis(config[_0xd8f7('0x9')]));var Schema=require(_0xd8f7('0xc'));var originateValidation=new Schema({'userId':{'type':_0xd8f7('0xd'),'required':[!![],_0xd8f7('0xe')]},'callNumber':{'type':'string','required':[!![],_0xd8f7('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xd8f7('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0xd8f7('0xd'),'required':[!![],_0xd8f7('0xe')]},'sessionId':{'type':_0xd8f7('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xd8f7('0xd'),'required':[!![],_0xd8f7('0xe')]},'sessionId':{'type':_0xd8f7('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xd8f7('0xd'),'required':[!![],_0xd8f7('0xe')]},'sessionId':{'type':_0xd8f7('0x10'),'required':[!![],_0xd8f7('0x11')]},'transferNumber':{'type':_0xd8f7('0x10'),'required':[!![],_0xd8f7('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xd8f7('0xd'),'required':[!![],_0xd8f7('0xe')]},'sessionId':{'type':_0xd8f7('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xd8f7('0xd'),'required':[!![],_0xd8f7('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xd8f7('0xd'),'required':[!![],_0xd8f7('0xe')]}});function emit(_0x299208,_0x2b4a80,_0x1417b8){logger[_0xd8f7('0x13')](_0x299208,_0x2b4a80,JSON['stringify'](_0x1417b8));io['to'](_0x299208)[_0xd8f7('0x14')](_0x2b4a80,_0x1417b8);}function handleError(_0x47c992){return function(_0x202298){console[_0xd8f7('0x15')]('handleError:',_0x202298,_0x202298 instanceof RangeError);logger[_0xd8f7('0x16')](_0x202298[_0xd8f7('0x17')]);if(_0x202298 instanceof RangeError){if(_0x202298[_0xd8f7('0x18')]){delete _0x202298['name'];}_0x47c992[_0xd8f7('0x19')](0x194)['send'](_0x202298);}else{if(_0x202298[_0xd8f7('0x18')]){delete _0x202298[_0xd8f7('0x18')];}_0x47c992['status'](0x1f4)[_0xd8f7('0x1a')](_0x202298);}};}function checkError(){return function(_0x2fd930){if(!_0x2fd930){throw new RangeError('NotFound');}return _0x2fd930;};}function respondWithRpcPromise(_0x2b6ee2,_0x50d93f){return new BPromise(function(_0x54bc78,_0x2fc6cb){var _0x58469a=amiClient;return _0x58469a['request'](_0x2b6ee2,_0x50d93f)[_0xd8f7('0x1b')](function(_0x4e1e10){if(_0x4e1e10[_0xd8f7('0x16')]){if(_0x4e1e10[_0xd8f7('0x16')]['code']===0x1f4){return _0x2fc6cb(_0x4e1e10[_0xd8f7('0x16')][_0xd8f7('0x1c')]);}return _0x54bc78(_0x4e1e10[_0xd8f7('0x16')][_0xd8f7('0x1c')]);}else{_0x54bc78(_0x4e1e10[_0xd8f7('0x1d')]);}})[_0xd8f7('0x1e')](function(_0x3ca18a){_0x2fc6cb(_0x3ca18a);});});}function getAgent(_0x29ae5e){return db[_0xd8f7('0x1f')][_0xd8f7('0x20')]({'where':{'id':_0x29ae5e,'role':_0xd8f7('0x21')}})[_0xd8f7('0x1b')](checkError());}function getAgentCheckSession(_0x309d4a,_0x54d242){return new BPromise(function(_0x535f78,_0x1a9752){var _0x3dadbb=respondWithRpcPromise(_0xd8f7('0x22'));var _0x20ef3a=getAgent(_0x309d4a);Promise[_0xd8f7('0x23')]([_0x3dadbb,_0x20ef3a])[_0xd8f7('0x1b')](function(_0x5d54b9){var _0x480635=_0x5d54b9[0x0];var _0x12bf13=_0x5d54b9[0x1];var _0x148491=_[_0xd8f7('0x24')](_0x480635[_0xd8f7('0x25')],function(_0x3e2f76){return _0x3e2f76[_0xd8f7('0x26')]==_0x12bf13['id']&&_0x3e2f76['sessionId']==_0x54d242;});if(_0x148491['length']==0x1){_0x535f78(_0x12bf13);}else{_0x1a9752(new RangeError(_0xd8f7('0x27')+_0x54d242+'\x20not\x20found!'));}});});}exports[_0xd8f7('0x28')]=function(_0x4962f9,_0x1b2008){logger[_0xd8f7('0x13')](_0xd8f7('0x29'),_0x4962f9[_0xd8f7('0x2a')]);var _0x1ba0a8=originateValidation[_0xd8f7('0xc')](_0x4962f9['body']);if(_0x1ba0a8['length']>0x0){return _0x1b2008[_0xd8f7('0x19')](0x190)[_0xd8f7('0x2b')](_0x1ba0a8);}var _0x4c3481=_0x4962f9[_0xd8f7('0x2a')][_0xd8f7('0x2c')];var _0xcc2d5b=_0x4962f9[_0xd8f7('0x2a')][_0xd8f7('0x2d')];var _0x1da889=_0x4962f9[_0xd8f7('0x2a')][_0xd8f7('0x2e')];var _0xbbdfdb=_0x4962f9[_0xd8f7('0x2a')][_0xd8f7('0x2f')];return getAgent(_0x4c3481)['then'](function(_0x4e89d5){logger[_0xd8f7('0x13')]('entityFound:',_0x4e89d5['name']);emit(util[_0xd8f7('0x30')](_0xd8f7('0x31'),_0x4e89d5[_0xd8f7('0x18')]),_0xd8f7('0x32'),{'callNumber':_0xcc2d5b,'callerId':_0x1da889,'callbackUrl':_0xbbdfdb});return _0x1b2008[_0xd8f7('0x19')](0xc8)[_0xd8f7('0x2b')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x1b2008));};exports[_0xd8f7('0x33')]=function(_0x516b4b,_0x2f52d7){logger[_0xd8f7('0x13')](_0xd8f7('0x34'),_0x516b4b[_0xd8f7('0x2a')]);var _0x41cb12=hangupValidation[_0xd8f7('0xc')](_0x516b4b[_0xd8f7('0x2a')]);if(_0x41cb12[_0xd8f7('0x35')]>0x0){return _0x2f52d7[_0xd8f7('0x19')](0x190)[_0xd8f7('0x2b')](_0x41cb12);}var _0x186d35=_0x516b4b[_0xd8f7('0x2a')][_0xd8f7('0x2c')];var _0x4f8c02=_0x516b4b[_0xd8f7('0x2a')][_0xd8f7('0x36')];return getAgent(_0x186d35)[_0xd8f7('0x1b')](function(_0x120a65){logger[_0xd8f7('0x13')](_0xd8f7('0x37'),_0x120a65[_0xd8f7('0x18')]);emit(util[_0xd8f7('0x30')]('user:%s',_0x120a65[_0xd8f7('0x18')]),_0xd8f7('0x38'),{'sessionId':_0x4f8c02});return _0x2f52d7[_0xd8f7('0x19')](0xc8)[_0xd8f7('0x2b')]({'error':![],'message':_0xd8f7('0x39')});})[_0xd8f7('0x1e')](handleError(_0x2f52d7));};exports['answer']=function(_0x22456b,_0x113b3d){logger[_0xd8f7('0x13')]('answer\x20fired:',_0x22456b[_0xd8f7('0x2a')]);var _0x244d12=answerValidation['validate'](_0x22456b[_0xd8f7('0x2a')]);if(_0x244d12[_0xd8f7('0x35')]>0x0){return _0x113b3d['status'](0x190)['json'](_0x244d12);}var _0x54c353=_0x22456b[_0xd8f7('0x2a')][_0xd8f7('0x2c')];var _0x3149b3=_0x22456b[_0xd8f7('0x2a')]['sessionId'];return getAgent(_0x54c353)[_0xd8f7('0x1b')](function(_0x3a3e38){logger[_0xd8f7('0x13')](_0xd8f7('0x37'),_0x3a3e38[_0xd8f7('0x18')]);emit(util[_0xd8f7('0x30')](_0xd8f7('0x31'),_0x3a3e38[_0xd8f7('0x18')]),_0xd8f7('0x3a'),{'sessionId':_0x3149b3});return _0x113b3d[_0xd8f7('0x19')](0xc8)[_0xd8f7('0x2b')]({'error':![],'message':_0xd8f7('0x3b')});})[_0xd8f7('0x1e')](handleError(_0x113b3d));};exports[_0xd8f7('0x3c')]=function(_0x914ded,_0x2f7b99){logger['info']('hold\x20fired:',_0x914ded[_0xd8f7('0x2a')]);var _0x33fc11=holdValidation[_0xd8f7('0xc')](_0x914ded['body']);if(_0x33fc11[_0xd8f7('0x35')]>0x0){return _0x2f7b99[_0xd8f7('0x19')](0x190)[_0xd8f7('0x2b')](_0x33fc11);}var _0x1e8343=_0x914ded['body'][_0xd8f7('0x2c')];var _0x2871ec=_0x914ded[_0xd8f7('0x2a')][_0xd8f7('0x36')];return getAgent(_0x1e8343)[_0xd8f7('0x1b')](function(_0x3a317c){logger[_0xd8f7('0x13')](_0xd8f7('0x37'),_0x3a317c[_0xd8f7('0x18')]);emit(util[_0xd8f7('0x30')](_0xd8f7('0x31'),_0x3a317c[_0xd8f7('0x18')]),_0xd8f7('0x3d'),{'sessionId':_0x2871ec});return _0x2f7b99[_0xd8f7('0x19')](0xc8)['json']({'error':![],'message':_0xd8f7('0x3e')});})['catch'](handleError(_0x2f7b99));};exports[_0xd8f7('0x3f')]=function(_0x2a797d,_0x19ccef){logger['info']('unhold\x20fired:',_0x2a797d['body']);var _0x514d95=unholdValidation['validate'](_0x2a797d['body']);if(_0x514d95[_0xd8f7('0x35')]>0x0){return _0x19ccef[_0xd8f7('0x19')](0x190)[_0xd8f7('0x2b')](_0x514d95);}var _0x13ba06=_0x2a797d[_0xd8f7('0x2a')][_0xd8f7('0x2c')];var _0x129577=_0x2a797d[_0xd8f7('0x2a')][_0xd8f7('0x36')];return getAgent(_0x13ba06)[_0xd8f7('0x1b')](function(_0x40f8e0){logger[_0xd8f7('0x13')](_0xd8f7('0x37'),_0x40f8e0[_0xd8f7('0x18')]);emit(util['format'](_0xd8f7('0x31'),_0x40f8e0[_0xd8f7('0x18')]),_0xd8f7('0x40'),{'sessionId':_0x129577});return _0x19ccef[_0xd8f7('0x19')](0xc8)[_0xd8f7('0x2b')]({'error':![],'message':_0xd8f7('0x41')});})[_0xd8f7('0x1e')](handleError(_0x19ccef));};exports[_0xd8f7('0x42')]=function(_0x5430cb,_0x4aa156){logger[_0xd8f7('0x13')](_0xd8f7('0x43'),_0x4aa156[_0xd8f7('0x2a')]);var _0x493413=callsValidation['validate'](_0x5430cb[_0xd8f7('0x2a')]);if(_0x493413[_0xd8f7('0x35')]>0x0){return _0x4aa156[_0xd8f7('0x19')](0x190)[_0xd8f7('0x2b')](_0x493413);}var _0x2f8ee5=_0x5430cb[_0xd8f7('0x2a')][_0xd8f7('0x2c')];var _0x512314=respondWithRpcPromise(_0xd8f7('0x22'));var _0x4bb0e4=getAgent(_0x2f8ee5);return Promise['all']([_0x512314,_0x4bb0e4])['then'](function(_0x1e2025){var _0xa1d8d=_0x1e2025[0x0];var _0x4f3664=_0x1e2025[0x1];var _0x5fba31=_['filter'](_0xa1d8d[_0xd8f7('0x25')],function(_0x234339){return _0x234339[_0xd8f7('0x26')]==_0x4f3664['id'];});return _0x4aa156[_0xd8f7('0x19')](0xc8)[_0xd8f7('0x2b')]({'count':_0x5fba31[_0xd8f7('0x35')],'rows':_0x5fba31});})[_0xd8f7('0x1e')](handleError(_0x4aa156));};exports[_0xd8f7('0x44')]=function(_0x57e610,_0x4e64b6){logger[_0xd8f7('0x13')](_0xd8f7('0x45'),_0x57e610[_0xd8f7('0x2a')]);var _0x20e328=conferenceValidation[_0xd8f7('0xc')](_0x57e610[_0xd8f7('0x2a')]);if(_0x20e328[_0xd8f7('0x35')]>0x0){return _0x4e64b6[_0xd8f7('0x19')](0x190)[_0xd8f7('0x2b')](_0x20e328);}var _0x5c98d0=_0x57e610[_0xd8f7('0x2a')][_0xd8f7('0x2c')];return getAgent(_0x5c98d0)[_0xd8f7('0x1b')](function(_0x1a839e){logger['info'](_0xd8f7('0x37'),_0x1a839e[_0xd8f7('0x18')]);emit(util['format'](_0xd8f7('0x31'),_0x1a839e[_0xd8f7('0x18')]),_0xd8f7('0x46'));return _0x4e64b6[_0xd8f7('0x19')](0xc8)[_0xd8f7('0x2b')]({'error':![],'message':'conference\x20executed!'});})[_0xd8f7('0x1e')](handleError(_0x4e64b6));};exports[_0xd8f7('0x47')]=function(_0x5922e9,_0x465be1){logger[_0xd8f7('0x13')](_0xd8f7('0x48'),_0x5922e9['body']);var _0x165972=transferValidation[_0xd8f7('0xc')](_0x5922e9['body']);if(_0x165972[_0xd8f7('0x35')]>0x0){return _0x465be1[_0xd8f7('0x19')](0x190)[_0xd8f7('0x2b')](_0x165972);}var _0x2a5fe9=_0x5922e9[_0xd8f7('0x2a')]['userId'];var _0x52eefe=_0x5922e9['body'][_0xd8f7('0x36')];var _0x102185=_0x5922e9[_0xd8f7('0x2a')][_0xd8f7('0x49')];return getAgent(_0x2a5fe9)[_0xd8f7('0x1b')](function(_0x2f53ad){logger[_0xd8f7('0x13')](_0xd8f7('0x37'),_0x2f53ad['name']);emit(util[_0xd8f7('0x30')]('user:%s',_0x2f53ad['name']),_0xd8f7('0x4a'),{'sessionId':_0x52eefe,'transferNumber':_0x102185});return _0x465be1['status'](0xc8)[_0xd8f7('0x2b')]({'error':![],'message':'transfer\x20executed!'});})[_0xd8f7('0x1e')](handleError(_0x465be1));}; \ No newline at end of file +var _0xe893=['UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','user:%s','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','transfer\x20executed!','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','localhost','socket.io-emitter','number','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','stack','name','status','send','NotFound','then','error','message','result','catch','User','findOne','agent','VoiceChannels','filter','rows'];(function(_0x296d24,_0x14d755){var _0x1cc450=function(_0x185ae4){while(--_0x185ae4){_0x296d24['push'](_0x296d24['shift']());}};_0x1cc450(++_0x14d755);}(_0xe893,0xbe));var _0x3e89=function(_0x445a7d,_0x2feb68){_0x445a7d=_0x445a7d-0x0;var _0x5808f0=_0xe893[_0x445a7d];return _0x5808f0;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x3e89('0x0'));var db=require(_0x3e89('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x3e89('0x2'));var BPromise=require(_0x3e89('0x3'));var jayson=require(_0x3e89('0x4'));var amiClient=jayson[_0x3e89('0x5')][_0x3e89('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x3e89('0x7'));var Redis=require(_0x3e89('0x8'));config[_0x3e89('0x9')]=_['defaults'](config[_0x3e89('0x9')],{'host':_0x3e89('0xa'),'port':0x18eb});var io=require(_0x3e89('0xb'))(new Redis(config[_0x3e89('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x3e89('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x3e89('0xd')},'callbackUrl':{'type':_0x3e89('0xd')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3e89('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e89('0xe')]},'sessionId':{'type':_0x3e89('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e89('0xe')]},'sessionId':{'type':_0x3e89('0xd'),'required':[!![],_0x3e89('0xf')]},'transferNumber':{'type':'string','required':[!![],_0x3e89('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x3e89('0xc'),'required':[!![],_0x3e89('0xe')]},'sessionId':{'type':_0x3e89('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3e89('0xc'),'required':[!![],_0x3e89('0xe')]},'sessionId':{'type':_0x3e89('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e89('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x3e89('0xc'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x345d7b,_0x30f891,_0x206ee2){logger[_0x3e89('0x11')](_0x345d7b,_0x30f891,JSON[_0x3e89('0x12')](_0x206ee2));io['to'](_0x345d7b)[_0x3e89('0x13')](_0x30f891,_0x206ee2);}function handleError(_0x2f2787){return function(_0x447caa){console[_0x3e89('0x14')](_0x3e89('0x15'),_0x447caa,_0x447caa instanceof RangeError);logger['error'](_0x447caa[_0x3e89('0x16')]);if(_0x447caa instanceof RangeError){if(_0x447caa['name']){delete _0x447caa[_0x3e89('0x17')];}_0x2f2787[_0x3e89('0x18')](0x194)[_0x3e89('0x19')](_0x447caa);}else{if(_0x447caa[_0x3e89('0x17')]){delete _0x447caa[_0x3e89('0x17')];}_0x2f2787[_0x3e89('0x18')](0x1f4)[_0x3e89('0x19')](_0x447caa);}};}function checkError(){return function(_0x45e64c){if(!_0x45e64c){throw new RangeError(_0x3e89('0x1a'));}return _0x45e64c;};}function respondWithRpcPromise(_0x14e11a,_0x12f2b8){return new BPromise(function(_0x2008b0,_0x2255a7){var _0x269edc=amiClient;return _0x269edc['request'](_0x14e11a,_0x12f2b8)[_0x3e89('0x1b')](function(_0x811201){if(_0x811201[_0x3e89('0x1c')]){if(_0x811201[_0x3e89('0x1c')]['code']===0x1f4){return _0x2255a7(_0x811201[_0x3e89('0x1c')][_0x3e89('0x1d')]);}return _0x2008b0(_0x811201[_0x3e89('0x1c')][_0x3e89('0x1d')]);}else{_0x2008b0(_0x811201[_0x3e89('0x1e')]);}})[_0x3e89('0x1f')](function(_0x4d9cf0){_0x2255a7(_0x4d9cf0);});});}function getAgent(_0x332ebb){return db[_0x3e89('0x20')][_0x3e89('0x21')]({'where':{'id':_0x332ebb,'role':_0x3e89('0x22')}})[_0x3e89('0x1b')](checkError());}function getAgentCheckSession(_0x116434,_0x40a20f){return new BPromise(function(_0x41b41c,_0x9d923f){var _0x2c5ee4=respondWithRpcPromise(_0x3e89('0x23'));var _0xf68c8=getAgent(_0x116434);Promise['all']([_0x2c5ee4,_0xf68c8])[_0x3e89('0x1b')](function(_0x396c46){var _0x3887cc=_0x396c46[0x0];var _0x345f28=_0x396c46[0x1];var _0x26ccb8=_[_0x3e89('0x24')](_0x3887cc[_0x3e89('0x25')],function(_0x243ad5){return _0x243ad5[_0x3e89('0x26')]==_0x345f28['id']&&_0x243ad5[_0x3e89('0x27')]==_0x40a20f;});if(_0x26ccb8[_0x3e89('0x28')]==0x1){_0x41b41c(_0x345f28);}else{_0x9d923f(new RangeError(_0x3e89('0x29')+_0x40a20f+_0x3e89('0x2a')));}});});}exports[_0x3e89('0x2b')]=function(_0x48ec2c,_0x59af9c){logger[_0x3e89('0x11')](_0x3e89('0x2c'),_0x48ec2c[_0x3e89('0x2d')]);var _0x593658=originateValidation[_0x3e89('0x2e')](_0x48ec2c[_0x3e89('0x2d')]);if(_0x593658[_0x3e89('0x28')]>0x0){return _0x59af9c['status'](0x190)[_0x3e89('0x2f')](_0x593658);}var _0x43044d=_0x48ec2c['body'][_0x3e89('0x30')];var _0x274313=_0x48ec2c['body'][_0x3e89('0x31')];var _0x743d87=_0x48ec2c[_0x3e89('0x2d')][_0x3e89('0x32')];var _0x3ba10b=_0x48ec2c[_0x3e89('0x2d')][_0x3e89('0x33')];return getAgent(_0x43044d)[_0x3e89('0x1b')](function(_0x2d424a){logger[_0x3e89('0x11')](_0x3e89('0x34'),_0x2d424a[_0x3e89('0x17')]);emit(util[_0x3e89('0x35')]('user:%s',_0x2d424a[_0x3e89('0x17')]),_0x3e89('0x36'),{'callNumber':_0x274313,'callerId':_0x743d87,'callbackUrl':_0x3ba10b});return _0x59af9c[_0x3e89('0x18')](0xc8)[_0x3e89('0x2f')]({'error':![],'message':_0x3e89('0x37')});})[_0x3e89('0x1f')](handleError(_0x59af9c));};exports['hangup']=function(_0xdf18fc,_0x4c5968){logger[_0x3e89('0x11')]('hangup\x20fired:',_0xdf18fc['body']);var _0x5b16c8=hangupValidation['validate'](_0xdf18fc[_0x3e89('0x2d')]);if(_0x5b16c8[_0x3e89('0x28')]>0x0){return _0x4c5968['status'](0x190)[_0x3e89('0x2f')](_0x5b16c8);}var _0x13228b=_0xdf18fc['body']['userId'];var _0x22c954=_0xdf18fc[_0x3e89('0x2d')]['sessionId'];return getAgent(_0x13228b)[_0x3e89('0x1b')](function(_0x2910f6){logger[_0x3e89('0x11')](_0x3e89('0x34'),_0x2910f6[_0x3e89('0x17')]);emit(util['format'](_0x3e89('0x38'),_0x2910f6[_0x3e89('0x17')]),'webbar:hangup',{'sessionId':_0x22c954});return _0x4c5968['status'](0xc8)[_0x3e89('0x2f')]({'error':![],'message':_0x3e89('0x39')});})[_0x3e89('0x1f')](handleError(_0x4c5968));};exports[_0x3e89('0x3a')]=function(_0x244728,_0xc697d9){logger[_0x3e89('0x11')]('answer\x20fired:',_0x244728[_0x3e89('0x2d')]);var _0x28c23e=answerValidation[_0x3e89('0x2e')](_0x244728[_0x3e89('0x2d')]);if(_0x28c23e[_0x3e89('0x28')]>0x0){return _0xc697d9['status'](0x190)[_0x3e89('0x2f')](_0x28c23e);}var _0x48a706=_0x244728['body'][_0x3e89('0x30')];var _0x71bb1c=_0x244728[_0x3e89('0x2d')]['sessionId'];return getAgent(_0x48a706)['then'](function(_0xdf3fb2){logger[_0x3e89('0x11')](_0x3e89('0x34'),_0xdf3fb2[_0x3e89('0x17')]);emit(util[_0x3e89('0x35')](_0x3e89('0x38'),_0xdf3fb2[_0x3e89('0x17')]),_0x3e89('0x3b'),{'sessionId':_0x71bb1c});return _0xc697d9[_0x3e89('0x18')](0xc8)['json']({'error':![],'message':_0x3e89('0x3c')});})['catch'](handleError(_0xc697d9));};exports['hold']=function(_0x82a44e,_0x59309d){logger[_0x3e89('0x11')](_0x3e89('0x3d'),_0x82a44e[_0x3e89('0x2d')]);var _0x3231dd=holdValidation[_0x3e89('0x2e')](_0x82a44e['body']);if(_0x3231dd[_0x3e89('0x28')]>0x0){return _0x59309d['status'](0x190)[_0x3e89('0x2f')](_0x3231dd);}var _0x488954=_0x82a44e[_0x3e89('0x2d')]['userId'];var _0x52928f=_0x82a44e[_0x3e89('0x2d')][_0x3e89('0x27')];return getAgent(_0x488954)[_0x3e89('0x1b')](function(_0x5ee561){logger[_0x3e89('0x11')](_0x3e89('0x34'),_0x5ee561[_0x3e89('0x17')]);emit(util[_0x3e89('0x35')](_0x3e89('0x38'),_0x5ee561[_0x3e89('0x17')]),'webbar:hold',{'sessionId':_0x52928f});return _0x59309d[_0x3e89('0x18')](0xc8)[_0x3e89('0x2f')]({'error':![],'message':_0x3e89('0x3e')});})[_0x3e89('0x1f')](handleError(_0x59309d));};exports[_0x3e89('0x3f')]=function(_0x525172,_0x3232ed){logger[_0x3e89('0x11')](_0x3e89('0x40'),_0x525172[_0x3e89('0x2d')]);var _0x2be1d7=unholdValidation[_0x3e89('0x2e')](_0x525172['body']);if(_0x2be1d7['length']>0x0){return _0x3232ed[_0x3e89('0x18')](0x190)[_0x3e89('0x2f')](_0x2be1d7);}var _0x36bd56=_0x525172[_0x3e89('0x2d')]['userId'];var _0x28eff4=_0x525172[_0x3e89('0x2d')][_0x3e89('0x27')];return getAgent(_0x36bd56)[_0x3e89('0x1b')](function(_0x581d57){logger['info'](_0x3e89('0x34'),_0x581d57[_0x3e89('0x17')]);emit(util['format'](_0x3e89('0x38'),_0x581d57[_0x3e89('0x17')]),_0x3e89('0x41'),{'sessionId':_0x28eff4});return _0x3232ed['status'](0xc8)[_0x3e89('0x2f')]({'error':![],'message':_0x3e89('0x42')});})['catch'](handleError(_0x3232ed));};exports[_0x3e89('0x43')]=function(_0x19bd19,_0x25e98){logger['info'](_0x3e89('0x44'),_0x25e98['body']);var _0x3b1d02=callsValidation[_0x3e89('0x2e')](_0x19bd19['body']);if(_0x3b1d02[_0x3e89('0x28')]>0x0){return _0x25e98['status'](0x190)[_0x3e89('0x2f')](_0x3b1d02);}var _0x49f030=_0x19bd19[_0x3e89('0x2d')]['userId'];var _0xa1e394=respondWithRpcPromise('VoiceChannels');var _0x15596e=getAgent(_0x49f030);return Promise[_0x3e89('0x45')]([_0xa1e394,_0x15596e])['then'](function(_0x6b49e5){var _0x1a72d7=_0x6b49e5[0x0];var _0x3fa341=_0x6b49e5[0x1];var _0x35f29b=_[_0x3e89('0x24')](_0x1a72d7[_0x3e89('0x25')],function(_0x2edb25){return _0x2edb25['UserId']==_0x3fa341['id'];});return _0x25e98[_0x3e89('0x18')](0xc8)[_0x3e89('0x2f')]({'count':_0x35f29b[_0x3e89('0x28')],'rows':_0x35f29b});})[_0x3e89('0x1f')](handleError(_0x25e98));};exports['conference']=function(_0x29bceb,_0x4247a8){logger[_0x3e89('0x11')](_0x3e89('0x46'),_0x29bceb[_0x3e89('0x2d')]);var _0x314e52=conferenceValidation[_0x3e89('0x2e')](_0x29bceb['body']);if(_0x314e52[_0x3e89('0x28')]>0x0){return _0x4247a8['status'](0x190)[_0x3e89('0x2f')](_0x314e52);}var _0x2e18be=_0x29bceb['body'][_0x3e89('0x30')];return getAgent(_0x2e18be)[_0x3e89('0x1b')](function(_0x441942){logger['info']('entityFound:',_0x441942['name']);emit(util[_0x3e89('0x35')](_0x3e89('0x38'),_0x441942['name']),_0x3e89('0x47'));return _0x4247a8[_0x3e89('0x18')](0xc8)[_0x3e89('0x2f')]({'error':![],'message':_0x3e89('0x48')});})['catch'](handleError(_0x4247a8));};exports['transfer']=function(_0x49602b,_0x58f6f0){logger[_0x3e89('0x11')](_0x3e89('0x49'),_0x49602b[_0x3e89('0x2d')]);var _0x487704=transferValidation[_0x3e89('0x2e')](_0x49602b[_0x3e89('0x2d')]);if(_0x487704[_0x3e89('0x28')]>0x0){return _0x58f6f0[_0x3e89('0x18')](0x190)[_0x3e89('0x2f')](_0x487704);}var _0x1d86b0=_0x49602b[_0x3e89('0x2d')][_0x3e89('0x30')];var _0x263c87=_0x49602b['body']['sessionId'];var _0x13e4a8=_0x49602b[_0x3e89('0x2d')][_0x3e89('0x4a')];return getAgent(_0x1d86b0)[_0x3e89('0x1b')](function(_0x4d53fb){logger[_0x3e89('0x11')]('entityFound:',_0x4d53fb['name']);emit(util[_0x3e89('0x35')](_0x3e89('0x38'),_0x4d53fb[_0x3e89('0x17')]),'webbar:transfer',{'sessionId':_0x263c87,'transferNumber':_0x13e4a8});return _0x58f6f0['status'](0xc8)[_0x3e89('0x2f')]({'error':![],'message':_0x3e89('0x4b')});})['catch'](handleError(_0x58f6f0));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index c0f0799..433d6ec 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 _0xa5ca=['../../config/environment','./whatsappAccount.controller','get','index','describe','/:id','isAuthenticated','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x417504,_0x3cb623){var _0x1fe475=function(_0x86ae6c){while(--_0x86ae6c){_0x417504['push'](_0x417504['shift']());}};_0x1fe475(++_0x3cb623);}(_0xa5ca,0xd2));var _0xaa5c=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xa5ca[_0x476bf4];return _0x788ffe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaa5c('0x0'));var timeout=require(_0xaa5c('0x1'));var express=require('express');var router=express[_0xaa5c('0x2')]();var fs_extra=require(_0xaa5c('0x3'));var auth=require(_0xaa5c('0x4'));var interaction=require(_0xaa5c('0x5'));var config=require(_0xaa5c('0x6'));var controller=require(_0xaa5c('0x7'));router[_0xaa5c('0x8')]('/',auth['isAuthenticated'](),controller[_0xaa5c('0x9')]);router[_0xaa5c('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xaa5c('0xa')]);router['get'](_0xaa5c('0xb'),auth[_0xaa5c('0xc')](),controller['show']);router['get']('/:id/dispositions',auth[_0xaa5c('0xc')](),controller[_0xaa5c('0xd')]);router['get'](_0xaa5c('0xe'),auth['isAuthenticated'](),controller[_0xaa5c('0xf')]);router[_0xaa5c('0x8')](_0xaa5c('0x10'),auth[_0xaa5c('0xc')](),controller[_0xaa5c('0x11')]);router[_0xaa5c('0x8')](_0xaa5c('0x12'),auth[_0xaa5c('0xc')](),controller[_0xaa5c('0x13')]);router[_0xaa5c('0x14')]('/',auth[_0xaa5c('0xc')](),controller[_0xaa5c('0x15')]);router['post']('/:id/dispositions',auth[_0xaa5c('0xc')](),controller[_0xaa5c('0x16')]);router[_0xaa5c('0x14')](_0xaa5c('0xe'),auth[_0xaa5c('0xc')](),controller[_0xaa5c('0x17')]);router[_0xaa5c('0x14')](_0xaa5c('0x10'),auth[_0xaa5c('0xc')](),controller['addAgents']);router[_0xaa5c('0x14')](_0xaa5c('0x12'),auth[_0xaa5c('0xc')](),controller[_0xaa5c('0x18')]);router[_0xaa5c('0x14')]('/:id/notify',controller[_0xaa5c('0x19')]);router[_0xaa5c('0x14')](_0xaa5c('0x1a'),auth[_0xaa5c('0xc')](),controller[_0xaa5c('0x1b')]);router[_0xaa5c('0x1c')](_0xaa5c('0xb'),auth[_0xaa5c('0xc')](),controller[_0xaa5c('0x1d')]);router[_0xaa5c('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0xaa5c('0x1f')]);router[_0xaa5c('0x1e')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xaa5c('0x20')]);router['delete'](_0xaa5c('0xe'),auth['isAuthenticated'](),controller[_0xaa5c('0x21')]);router[_0xaa5c('0x1e')](_0xaa5c('0x10'),auth['isAuthenticated'](),controller[_0xaa5c('0x22')]);module[_0xaa5c('0x23')]=router; \ No newline at end of file +var _0x6e91=['/:id/canned_answers','getApplications','post','/:id/dispositions','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','/:id','getDispositions'];(function(_0x41f88e,_0x44406f){var _0x290e81=function(_0x5b3abc){while(--_0x5b3abc){_0x41f88e['push'](_0x41f88e['shift']());}};_0x290e81(++_0x44406f);}(_0x6e91,0x7d));var _0x16e9=function(_0x12267d,_0x4b279e){_0x12267d=_0x12267d-0x0;var _0x2d4a64=_0x6e91[_0x12267d];return _0x2d4a64;};'use strict';var multer=require(_0x16e9('0x0'));var util=require(_0x16e9('0x1'));var path=require(_0x16e9('0x2'));var timeout=require(_0x16e9('0x3'));var express=require(_0x16e9('0x4'));var router=express[_0x16e9('0x5')]();var fs_extra=require(_0x16e9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x16e9('0x7'));var config=require('../../config/environment');var controller=require(_0x16e9('0x8'));router[_0x16e9('0x9')]('/',auth['isAuthenticated'](),controller[_0x16e9('0xa')]);router[_0x16e9('0x9')](_0x16e9('0xb'),auth[_0x16e9('0xc')](),controller['describe']);router[_0x16e9('0x9')](_0x16e9('0xd'),auth[_0x16e9('0xc')](),controller['show']);router[_0x16e9('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x16e9('0xe')]);router[_0x16e9('0x9')](_0x16e9('0xf'),auth[_0x16e9('0xc')](),controller['getAnswers']);router[_0x16e9('0x9')]('/:id/users',auth[_0x16e9('0xc')](),controller['getAgents']);router[_0x16e9('0x9')]('/:id/applications',auth[_0x16e9('0xc')](),controller[_0x16e9('0x10')]);router[_0x16e9('0x11')]('/',auth[_0x16e9('0xc')](),controller['create']);router[_0x16e9('0x11')](_0x16e9('0x12'),auth[_0x16e9('0xc')](),controller[_0x16e9('0x13')]);router[_0x16e9('0x11')](_0x16e9('0xf'),auth['isAuthenticated'](),controller[_0x16e9('0x14')]);router[_0x16e9('0x11')](_0x16e9('0x15'),auth[_0x16e9('0xc')](),controller[_0x16e9('0x16')]);router[_0x16e9('0x11')]('/:id/applications',auth[_0x16e9('0xc')](),controller[_0x16e9('0x17')]);router[_0x16e9('0x11')](_0x16e9('0x18'),controller[_0x16e9('0x19')]);router[_0x16e9('0x11')](_0x16e9('0x1a'),auth['isAuthenticated'](),controller[_0x16e9('0x1b')]);router[_0x16e9('0x1c')](_0x16e9('0xd'),auth['isAuthenticated'](),controller[_0x16e9('0x1d')]);router[_0x16e9('0x1e')](_0x16e9('0xd'),auth[_0x16e9('0xc')](),controller[_0x16e9('0x1f')]);router[_0x16e9('0x1e')](_0x16e9('0x12'),auth[_0x16e9('0xc')](),controller[_0x16e9('0x20')]);router[_0x16e9('0x1e')](_0x16e9('0xf'),auth[_0x16e9('0xc')](),controller['removeAnswers']);router[_0x16e9('0x1e')](_0x16e9('0x15'),auth[_0x16e9('0xc')](),controller[_0x16e9('0x21')]);module[_0x16e9('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 7618f85..2a53cd6 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 _0x81b9=['mandatoryDisposition','sequelize','exports','STRING','name','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x2b2a71,_0x50c50c){var _0x496434=function(_0x165029){while(--_0x165029){_0x2b2a71['push'](_0x2b2a71['shift']());}};_0x496434(++_0x50c50c);}(_0x81b9,0x11e));var _0x981b=function(_0x106308,_0x30322a){_0x106308=_0x106308-0x0;var _0x3586a9=_0x81b9[_0x106308];return _0x3586a9;};'use strict';var Sequelize=require(_0x981b('0x0'));var rs=require('randomstring');module[_0x981b('0x1')]={'name':{'type':Sequelize[_0x981b('0x2')],'unique':_0x981b('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x981b('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x981b('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x981b('0x2')]},'type':{'type':Sequelize[_0x981b('0x4')](_0x981b('0x5'))},'accountSid':{'type':Sequelize[_0x981b('0x2')]},'authToken':{'type':Sequelize[_0x981b('0x2')]},'notificationTemplate':{'type':Sequelize[_0x981b('0x6')],'defaultValue':function(){return _0x981b('0x7');}},'notificationSound':{'type':Sequelize[_0x981b('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x981b('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x981b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x981b('0x9')],'comment':_0x981b('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x981b('0xb'),'set':function(_0x17b45d){if(!_0x17b45d){this['setDataValue'](_0x981b('0xc'),null);}this[_0x981b('0xd')](_0x981b('0xe'),_0x17b45d);}},'description':{'type':Sequelize[_0x981b('0x2')]}}; \ No newline at end of file +var _0x1b6c=['setDataValue','mandatoryDisposition','name','STRING','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1b6c,0x116));var _0xc1b6=function(_0x35a779,_0x27f8fb){_0x35a779=_0x35a779-0x0;var _0xca723b=_0x1b6c[_0x35a779];return _0xca723b;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc1b6('0x0'),'allowNull':![]},'key':{'type':Sequelize[_0xc1b6('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xc1b6('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xc1b6('0x1')],'defaultValue':function(){return rs[_0xc1b6('0x2')]();}},'phone':{'type':Sequelize[_0xc1b6('0x1')]},'type':{'type':Sequelize[_0xc1b6('0x3')](_0xc1b6('0x4'))},'accountSid':{'type':Sequelize[_0xc1b6('0x1')]},'authToken':{'type':Sequelize[_0xc1b6('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc1b6('0x5');}},'notificationSound':{'type':Sequelize[_0xc1b6('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xc1b6('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc1b6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc1b6('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc1b6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc1b6('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc1b6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc1b6('0x7')],'comment':_0xc1b6('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xc1b6('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x846e82){if(!_0x846e82){this['setDataValue'](_0xc1b6('0x9'),null);}this[_0xc1b6('0xa')](_0xc1b6('0xb'),_0x846e82);}},'description':{'type':Sequelize[_0xc1b6('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 7bfaf52..f475ff6 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 _0xaf2a=['catch','params','keys','filters','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','WhatsappAccountId','Disposition','getDispositions','removeDispositions','CannedAnswer','getAnswers','findOne','nolimit','rows','removeAnswers','ids','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','CmContact','describe','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','WhatsappInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','User','UserId','agent','startRouting','Start','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll'];(function(_0x2e1909,_0x5b79e){var _0xd3a4ae=function(_0x3dfb09){while(--_0x3dfb09){_0x2e1909['push'](_0x2e1909['shift']());}};_0xd3a4ae(++_0x5b79e);}(_0xaf2a,0x1dc));var _0xaaf2=function(_0x4a1c68,_0x712102){_0x4a1c68=_0x4a1c68-0x0;var _0x25bcf5=_0xaf2a[_0x4a1c68];return _0x25bcf5;};'use strict';var emlformat=require(_0xaaf2('0x0'));var rimraf=require(_0xaaf2('0x1'));var zipdir=require(_0xaaf2('0x2'));var jsonpatch=require(_0xaaf2('0x3'));var rp=require(_0xaaf2('0x4'));var moment=require(_0xaaf2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaaf2('0x6'));var util=require(_0xaaf2('0x7'));var path=require('path');var sox=require(_0xaaf2('0x8'));var csv=require(_0xaaf2('0x9'));var ejs=require(_0xaaf2('0xa'));var fs=require('fs');var fs_extra=require(_0xaaf2('0xb'));var _=require('lodash');var squel=require(_0xaaf2('0xc'));var crypto=require(_0xaaf2('0xd'));var jsforce=require(_0xaaf2('0xe'));var deskjs=require(_0xaaf2('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaaf2('0x10'));var Papa=require(_0xaaf2('0x11'));var Redis=require(_0xaaf2('0x12'));var authService=require(_0xaaf2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaaf2('0x14'));var hardwareService=require(_0xaaf2('0x15'));var logger=require(_0xaaf2('0x16'))('api');var utils=require(_0xaaf2('0x17'));var config=require(_0xaaf2('0x18'));var licenseUtil=require(_0xaaf2('0x19'));var db=require(_0xaaf2('0x1a'))['db'];config[_0xaaf2('0x1b')]=_[_0xaaf2('0x1c')](config[_0xaaf2('0x1b')],{'host':_0xaaf2('0x1d'),'port':0x18eb});var socket=require(_0xaaf2('0x1e'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xaaf2('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xaaf2('0x20')][_0xaaf2('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x34a0ba,_0x48d458,_0x2db323,_0x42bddf){return new BPromise(function(_0x542a85,_0x1bfa2c){var _0x3aed0c=_0x42bddf||client;return _0x3aed0c[_0xaaf2('0x22')](_0x34a0ba,_0x2db323)['then'](function(_0x4f0b6a){logger[_0xaaf2('0x23')](_0xaaf2('0x24'),_0x48d458,_0xaaf2('0x25'));logger[_0xaaf2('0x26')](_0xaaf2('0x27'),_0x48d458,_0xaaf2('0x25'),JSON['stringify'](_0x4f0b6a));if(_0x4f0b6a[_0xaaf2('0x28')]){if(_0x4f0b6a[_0xaaf2('0x28')][_0xaaf2('0x29')]===0x1f4){logger[_0xaaf2('0x28')](_0xaaf2('0x24'),_0x48d458,_0x4f0b6a[_0xaaf2('0x28')][_0xaaf2('0x2a')]);return _0x1bfa2c(_0x4f0b6a[_0xaaf2('0x28')][_0xaaf2('0x2a')]);}logger[_0xaaf2('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x48d458,_0x4f0b6a[_0xaaf2('0x28')][_0xaaf2('0x2a')]);return _0x542a85(_0x4f0b6a['error'][_0xaaf2('0x2a')]);}else{logger[_0xaaf2('0x23')](_0xaaf2('0x24'),_0x48d458,_0xaaf2('0x25'));_0x542a85(_0x4f0b6a[_0xaaf2('0x2b')]['message']);}})['catch'](function(_0x459179){logger[_0xaaf2('0x28')](_0xaaf2('0x24'),_0x48d458,_0x459179);_0x1bfa2c(_0x459179);});});}function respondWithStatusCode(_0x394f19,_0x5f2827){_0x5f2827=_0x5f2827||0xcc;return function(_0x373404){if(_0x373404){return _0x394f19[_0xaaf2('0x2c')](_0x5f2827);}return _0x394f19['status'](_0x5f2827)[_0xaaf2('0x2d')]();};}function respondWithResult(_0x452422,_0x1c33e1){_0x1c33e1=_0x1c33e1||0xc8;return function(_0x222245){if(_0x222245){return _0x452422[_0xaaf2('0x2e')](_0x1c33e1)[_0xaaf2('0x2f')](_0x222245);}};}function respondWithFilteredResult(_0x486987,_0x5124e3){return function(_0x1ebe9a){if(_0x1ebe9a){var _0x544e5d=typeof _0x5124e3[_0xaaf2('0x30')]===_0xaaf2('0x31')&&typeof _0x5124e3[_0xaaf2('0x32')]===_0xaaf2('0x31');var _0x4ad7de=_0x1ebe9a[_0xaaf2('0x33')];var _0x279341=_0x544e5d?0x0:_0x5124e3[_0xaaf2('0x30')];var _0xa03a67=_0x544e5d?_0x1ebe9a[_0xaaf2('0x33')]:_0x5124e3[_0xaaf2('0x30')]+_0x5124e3[_0xaaf2('0x32')];var _0x26e9c0;if(_0xa03a67>=_0x4ad7de){_0xa03a67=_0x4ad7de;_0x26e9c0=0xc8;}else{_0x26e9c0=0xce;}_0x486987['status'](_0x26e9c0);return _0x486987[_0xaaf2('0x34')](_0xaaf2('0x35'),_0x279341+'-'+_0xa03a67+'/'+_0x4ad7de)[_0xaaf2('0x2f')](_0x1ebe9a);}return null;};}function patchUpdates(_0x45ea91){return function(_0x51965c){try{jsonpatch[_0xaaf2('0x36')](_0x51965c,_0x45ea91,!![]);}catch(_0x3a4ee2){return BPromise['reject'](_0x3a4ee2);}return _0x51965c['save']();};}function saveUpdates(_0x62b3ac,_0x366f0c){return function(_0x583c25){if(_0x583c25){return _0x583c25[_0xaaf2('0x37')](_0x62b3ac)[_0xaaf2('0x38')](function(_0x69ed3e){return _0x69ed3e;});}return null;};}function removeEntity(_0x16207d,_0x5c69f8){return function(_0x51e59a){if(_0x51e59a){return _0x51e59a[_0xaaf2('0x39')]()[_0xaaf2('0x38')](function(){var _0x45013b=_0x51e59a[_0xaaf2('0x3a')]({'plain':!![]});var _0x4ead19=_0xaaf2('0x3b');return db[_0xaaf2('0x3c')]['destroy']({'where':{'type':_0x4ead19,'resourceId':_0x45013b['id']}})[_0xaaf2('0x38')](function(){return _0x51e59a;});})[_0xaaf2('0x38')](function(){_0x16207d['status'](0xcc)[_0xaaf2('0x2d')]();});}};}function handleEntityNotFound(_0x52cfa5,_0x33805c){return function(_0x337657){if(!_0x337657){_0x52cfa5['sendStatus'](0x194);}return _0x337657;};}function handleError(_0x44dba3,_0x3105a7){_0x3105a7=_0x3105a7||0x1f4;return function(_0x20fe5b){logger['error'](_0x20fe5b[_0xaaf2('0x3d')]);if(_0x20fe5b[_0xaaf2('0x3e')]){delete _0x20fe5b[_0xaaf2('0x3e')];}_0x44dba3['status'](_0x3105a7)[_0xaaf2('0x3f')](_0x20fe5b);};}exports[_0xaaf2('0x40')]=function(_0x7f1bd8,_0xfd55ac){var _0x2e098a={'include':[{'model':db[_0xaaf2('0x41')],'as':_0xaaf2('0x42')}]},_0x3b16fe={},_0x2277df={'count':0x0,'rows':[]};var _0x345634=_[_0xaaf2('0x43')](db[_0xaaf2('0x44')][_0xaaf2('0x45')],function(_0x1bf6a7){return{'name':_0x1bf6a7[_0xaaf2('0x46')],'type':_0x1bf6a7[_0xaaf2('0x47')][_0xaaf2('0x48')]};});_0x3b16fe[_0xaaf2('0x49')]=_['map'](_0x345634,_0xaaf2('0x3e'));_0x3b16fe[_0xaaf2('0x4a')]=_['keys'](_0x7f1bd8[_0xaaf2('0x4a')]);_0x3b16fe['filters']=_[_0xaaf2('0x4b')](_0x3b16fe[_0xaaf2('0x49')],_0x3b16fe[_0xaaf2('0x4a')]);_0x2e098a[_0xaaf2('0x4c')]=_[_0xaaf2('0x4b')](_0x3b16fe[_0xaaf2('0x49')],qs['fields'](_0x7f1bd8[_0xaaf2('0x4a')][_0xaaf2('0x4d')]));_0x2e098a[_0xaaf2('0x4c')]=_0x2e098a[_0xaaf2('0x4c')][_0xaaf2('0x4e')]?_0x2e098a['attributes']:_0x3b16fe['model'];if(!_0x7f1bd8[_0xaaf2('0x4a')][_0xaaf2('0x4f')]('nolimit')){_0x2e098a[_0xaaf2('0x32')]=qs[_0xaaf2('0x32')](_0x7f1bd8[_0xaaf2('0x4a')][_0xaaf2('0x32')]);_0x2e098a[_0xaaf2('0x30')]=qs[_0xaaf2('0x30')](_0x7f1bd8['query']['offset']);}_0x2e098a[_0xaaf2('0x50')]=qs[_0xaaf2('0x51')](_0x7f1bd8[_0xaaf2('0x4a')]['sort']);_0x2e098a[_0xaaf2('0x52')]=qs['filters'](_[_0xaaf2('0x53')](_0x7f1bd8[_0xaaf2('0x4a')],_0x3b16fe['filters']),_0x345634);if(_0x7f1bd8[_0xaaf2('0x4a')]['filter']){_0x2e098a[_0xaaf2('0x52')]=_[_0xaaf2('0x54')](_0x2e098a[_0xaaf2('0x52')],{'$or':_['map'](_0x345634,function(_0x37de4e){if(_0x37de4e[_0xaaf2('0x47')]!==_0xaaf2('0x55')){var _0x14cf80={};_0x14cf80[_0x37de4e[_0xaaf2('0x3e')]]={'$like':'%'+_0x7f1bd8[_0xaaf2('0x4a')][_0xaaf2('0x56')]+'%'};return _0x14cf80;}})});}_0x2e098a=_[_0xaaf2('0x54')]({},_0x2e098a,_0x7f1bd8[_0xaaf2('0x57')]);var _0x3954f7={'where':_0x2e098a[_0xaaf2('0x52')]};return db[_0xaaf2('0x44')]['count'](_0x3954f7)[_0xaaf2('0x38')](function(_0x106912){_0x2277df[_0xaaf2('0x33')]=_0x106912;if(_0x7f1bd8['query'][_0xaaf2('0x58')]){_0x2e098a[_0xaaf2('0x59')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xaaf2('0x5a')](_0x2e098a);})[_0xaaf2('0x38')](function(_0x522fd7){_0x2277df['rows']=_0x522fd7;return _0x2277df;})[_0xaaf2('0x38')](respondWithFilteredResult(_0xfd55ac,_0x2e098a))[_0xaaf2('0x5b')](handleError(_0xfd55ac,null));};exports['show']=function(_0x38f2cf,_0x500bee){var _0x4402b6={'raw':![],'where':{'id':_0x38f2cf[_0xaaf2('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0xaaf2('0x42')}]},_0x4a0367={};_0x4a0367['model']=_[_0xaaf2('0x5d')](db[_0xaaf2('0x44')][_0xaaf2('0x45')]);_0x4a0367[_0xaaf2('0x4a')]=_[_0xaaf2('0x5d')](_0x38f2cf[_0xaaf2('0x4a')]);_0x4a0367[_0xaaf2('0x5e')]=_['intersection'](_0x4a0367[_0xaaf2('0x49')],_0x4a0367[_0xaaf2('0x4a')]);_0x4402b6[_0xaaf2('0x4c')]=_[_0xaaf2('0x4b')](_0x4a0367[_0xaaf2('0x49')],qs[_0xaaf2('0x4d')](_0x38f2cf['query'][_0xaaf2('0x4d')]));_0x4402b6['attributes']=_0x4402b6[_0xaaf2('0x4c')][_0xaaf2('0x4e')]?_0x4402b6[_0xaaf2('0x4c')]:_0x4a0367[_0xaaf2('0x49')];if(_0x38f2cf[_0xaaf2('0x4a')][_0xaaf2('0x58')]){_0x4402b6[_0xaaf2('0x59')]=[{'all':!![]}];}_0x4402b6=_[_0xaaf2('0x54')]({},_0x4402b6,_0x38f2cf[_0xaaf2('0x57')]);return db['WhatsappAccount']['find'](_0x4402b6)[_0xaaf2('0x38')](handleEntityNotFound(_0x500bee,null))[_0xaaf2('0x38')](respondWithResult(_0x500bee,null))[_0xaaf2('0x5b')](handleError(_0x500bee,null));};exports[_0xaaf2('0x5f')]=function(_0x3788f6,_0x5c9a24){return db[_0xaaf2('0x44')]['create'](_0x3788f6[_0xaaf2('0x60')],{})[_0xaaf2('0x38')](function(_0x46f884){var _0x1ce9dc=_0x3788f6[_0xaaf2('0x61')]['get']({'plain':!![]});if(!_0x1ce9dc)throw new Error(_0xaaf2('0x62'));if(_0x1ce9dc[_0xaaf2('0x63')]===_0xaaf2('0x61')){var _0x504093=_0x46f884[_0xaaf2('0x3a')]({'plain':!![]});var _0x441de7=_0xaaf2('0x3b');return db[_0xaaf2('0x64')][_0xaaf2('0x65')]({'where':{'name':_0x441de7,'userProfileId':_0x1ce9dc[_0xaaf2('0x66')]},'raw':!![]})[_0xaaf2('0x38')](function(_0x676e47){if(_0x676e47&&_0x676e47[_0xaaf2('0x67')]===0x0){return db[_0xaaf2('0x3c')]['create']({'name':_0x504093[_0xaaf2('0x3e')],'resourceId':_0x504093['id'],'type':_0x676e47[_0xaaf2('0x3e')],'sectionId':_0x676e47['id']},{})[_0xaaf2('0x38')](function(){return _0x46f884;});}else{return _0x46f884;}})['catch'](function(_0x8481a7){logger[_0xaaf2('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8481a7);throw _0x8481a7;});}return _0x46f884;})['then'](respondWithResult(_0x5c9a24,0xc9))[_0xaaf2('0x5b')](handleError(_0x5c9a24,null));};exports[_0xaaf2('0x37')]=function(_0x245980,_0x19a237){if(_0x245980['body']['id']){delete _0x245980[_0xaaf2('0x60')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x245980[_0xaaf2('0x5c')]['id']},'include':[{'model':db[_0xaaf2('0x41')],'as':_0xaaf2('0x42')}]})[_0xaaf2('0x38')](handleEntityNotFound(_0x19a237,null))[_0xaaf2('0x38')](saveUpdates(_0x245980[_0xaaf2('0x60')],null))[_0xaaf2('0x38')](respondWithResult(_0x19a237,null))[_0xaaf2('0x5b')](handleError(_0x19a237,null));};exports[_0xaaf2('0x39')]=function(_0x186225,_0x4feb06){return db[_0xaaf2('0x44')][_0xaaf2('0x65')]({'where':{'id':_0x186225['params']['id']}})['then'](handleEntityNotFound(_0x4feb06,null))['then'](removeEntity(_0x4feb06,null))[_0xaaf2('0x5b')](handleError(_0x4feb06,null));};exports['describe']=function(_0x2931ac,_0x5711f6){return db[_0xaaf2('0x44')]['describe']()[_0xaaf2('0x38')](respondWithResult(_0x5711f6,null))[_0xaaf2('0x5b')](handleError(_0x5711f6,null));};exports['addDisposition']=function(_0x167398,_0x5a63c5,_0x9210e7){if(_0x167398[_0xaaf2('0x60')]['id']){delete _0x167398[_0xaaf2('0x60')]['id'];}return db['WhatsappAccount'][_0xaaf2('0x65')]({'where':{'id':_0x167398[_0xaaf2('0x5c')]['id']}})[_0xaaf2('0x38')](handleEntityNotFound(_0x5a63c5,null))['then'](function(_0x427a6d){if(_0x427a6d){_0x167398[_0xaaf2('0x60')][_0xaaf2('0x68')]=_0x427a6d['id'];return db[_0xaaf2('0x69')][_0xaaf2('0x5f')](_0x167398['body']);}})[_0xaaf2('0x38')](respondWithResult(_0x5a63c5,null))[_0xaaf2('0x5b')](handleError(_0x5a63c5,null));};exports[_0xaaf2('0x6a')]=function(_0xee216e,_0x422d8,_0x2a24a1){var _0x21923e={'raw':![],'where':{}};var _0x2b366c={};var _0x4c8117={'count':0x0,'rows':[]};return db[_0xaaf2('0x44')]['findOne']({'where':{'id':_0xee216e['params']['id']}})[_0xaaf2('0x38')](handleEntityNotFound(_0x422d8,null))['then'](function(_0x477bc7){if(_0x477bc7){_0x2b366c[_0xaaf2('0x49')]=_['keys'](db[_0xaaf2('0x69')]['rawAttributes']);_0x2b366c[_0xaaf2('0x4a')]=_['keys'](_0xee216e[_0xaaf2('0x4a')]);_0x2b366c[_0xaaf2('0x5e')]=_['intersection'](_0x2b366c['model'],_0x2b366c[_0xaaf2('0x4a')]);_0x21923e[_0xaaf2('0x4c')]=_[_0xaaf2('0x4b')](_0x2b366c[_0xaaf2('0x49')],qs[_0xaaf2('0x4d')](_0xee216e[_0xaaf2('0x4a')]['fields']));_0x21923e[_0xaaf2('0x4c')]=_0x21923e['attributes'][_0xaaf2('0x4e')]?_0x21923e[_0xaaf2('0x4c')]:_0x2b366c['model'];if(!_0xee216e[_0xaaf2('0x4a')][_0xaaf2('0x4f')]('nolimit')){_0x21923e[_0xaaf2('0x32')]=qs[_0xaaf2('0x32')](_0xee216e[_0xaaf2('0x4a')][_0xaaf2('0x32')]);_0x21923e['offset']=qs['offset'](_0xee216e[_0xaaf2('0x4a')][_0xaaf2('0x30')]);}_0x21923e[_0xaaf2('0x50')]=qs[_0xaaf2('0x51')](_0xee216e[_0xaaf2('0x4a')]['sort']);_0x21923e[_0xaaf2('0x52')]=qs['filters'](_[_0xaaf2('0x53')](_0xee216e[_0xaaf2('0x4a')],_0x2b366c[_0xaaf2('0x5e')]));_0x21923e['where'][_0xaaf2('0x68')]=_0x477bc7['id'];if(_0xee216e['query']['filter']){_0x21923e[_0xaaf2('0x52')]=_['merge'](_0x21923e[_0xaaf2('0x52')],{'$or':_[_0xaaf2('0x43')](_0x21923e[_0xaaf2('0x4c')],function(_0x56ed13){var _0x165216={};_0x165216[_0x56ed13]={'$like':'%'+_0xee216e[_0xaaf2('0x4a')]['filter']+'%'};return _0x165216;})});}_0x21923e=_[_0xaaf2('0x54')]({},_0x21923e,_0xee216e[_0xaaf2('0x57')]);return db['Disposition'][_0xaaf2('0x33')]({'where':_0x21923e[_0xaaf2('0x52')]})[_0xaaf2('0x38')](function(_0x285f61){_0x4c8117[_0xaaf2('0x33')]=_0x285f61;if(_0xee216e[_0xaaf2('0x4a')][_0xaaf2('0x58')]){_0x21923e[_0xaaf2('0x59')]=[{'all':!![]}];}return db[_0xaaf2('0x69')][_0xaaf2('0x5a')](_0x21923e);})[_0xaaf2('0x38')](function(_0x3b4e50){_0x4c8117['rows']=_0x3b4e50;return _0x4c8117;});}})[_0xaaf2('0x38')](respondWithFilteredResult(_0x422d8,_0x21923e))['catch'](handleError(_0x422d8,null));};exports[_0xaaf2('0x6b')]=function(_0x4f3d68,_0x510a4c,_0x1584b8){return db[_0xaaf2('0x44')][_0xaaf2('0x65')]({'where':{'id':_0x4f3d68[_0xaaf2('0x5c')]['id']}})[_0xaaf2('0x38')](handleEntityNotFound(_0x510a4c,null))['then'](function(_0x162a16){if(_0x162a16){return _0x162a16[_0xaaf2('0x6b')](_0x4f3d68[_0xaaf2('0x4a')]['ids']);}})[_0xaaf2('0x38')](respondWithStatusCode(_0x510a4c,null))[_0xaaf2('0x5b')](handleError(_0x510a4c,null));};exports['addAnswer']=function(_0x44dcc3,_0x320311,_0x47ddb6){if(_0x44dcc3[_0xaaf2('0x60')]['id']){delete _0x44dcc3[_0xaaf2('0x60')]['id'];}return db[_0xaaf2('0x44')][_0xaaf2('0x65')]({'where':{'id':_0x44dcc3[_0xaaf2('0x5c')]['id']}})[_0xaaf2('0x38')](handleEntityNotFound(_0x320311,null))[_0xaaf2('0x38')](function(_0x384011){if(_0x384011){_0x44dcc3[_0xaaf2('0x60')][_0xaaf2('0x68')]=_0x384011['id'];return db[_0xaaf2('0x6c')][_0xaaf2('0x5f')](_0x44dcc3[_0xaaf2('0x60')]);}})[_0xaaf2('0x38')](respondWithResult(_0x320311,null))[_0xaaf2('0x5b')](handleError(_0x320311,null));};exports[_0xaaf2('0x6d')]=function(_0x5856fd,_0x82f2c6,_0x32cab6){var _0x5df143={'raw':![],'where':{}};var _0x5cb9af={};var _0x53dc99={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xaaf2('0x6e')]({'where':{'id':_0x5856fd[_0xaaf2('0x5c')]['id']}})[_0xaaf2('0x38')](handleEntityNotFound(_0x82f2c6,null))[_0xaaf2('0x38')](function(_0x25827c){if(_0x25827c){_0x5cb9af['model']=_[_0xaaf2('0x5d')](db['CannedAnswer'][_0xaaf2('0x45')]);_0x5cb9af[_0xaaf2('0x4a')]=_[_0xaaf2('0x5d')](_0x5856fd[_0xaaf2('0x4a')]);_0x5cb9af[_0xaaf2('0x5e')]=_[_0xaaf2('0x4b')](_0x5cb9af[_0xaaf2('0x49')],_0x5cb9af['query']);_0x5df143[_0xaaf2('0x4c')]=_[_0xaaf2('0x4b')](_0x5cb9af[_0xaaf2('0x49')],qs[_0xaaf2('0x4d')](_0x5856fd[_0xaaf2('0x4a')][_0xaaf2('0x4d')]));_0x5df143[_0xaaf2('0x4c')]=_0x5df143[_0xaaf2('0x4c')][_0xaaf2('0x4e')]?_0x5df143[_0xaaf2('0x4c')]:_0x5cb9af[_0xaaf2('0x49')];if(!_0x5856fd[_0xaaf2('0x4a')][_0xaaf2('0x4f')](_0xaaf2('0x6f'))){_0x5df143[_0xaaf2('0x32')]=qs[_0xaaf2('0x32')](_0x5856fd[_0xaaf2('0x4a')][_0xaaf2('0x32')]);_0x5df143[_0xaaf2('0x30')]=qs[_0xaaf2('0x30')](_0x5856fd['query'][_0xaaf2('0x30')]);}_0x5df143[_0xaaf2('0x50')]=qs[_0xaaf2('0x51')](_0x5856fd[_0xaaf2('0x4a')]['sort']);_0x5df143[_0xaaf2('0x52')]=qs['filters'](_['pick'](_0x5856fd[_0xaaf2('0x4a')],_0x5cb9af[_0xaaf2('0x5e')]));_0x5df143[_0xaaf2('0x52')][_0xaaf2('0x68')]=_0x25827c['id'];if(_0x5856fd[_0xaaf2('0x4a')][_0xaaf2('0x56')]){_0x5df143[_0xaaf2('0x52')]=_[_0xaaf2('0x54')](_0x5df143[_0xaaf2('0x52')],{'$or':_[_0xaaf2('0x43')](_0x5df143['attributes'],function(_0x105108){var _0x2be64e={};_0x2be64e[_0x105108]={'$like':'%'+_0x5856fd[_0xaaf2('0x4a')][_0xaaf2('0x56')]+'%'};return _0x2be64e;})});}_0x5df143=_[_0xaaf2('0x54')]({},_0x5df143,_0x5856fd[_0xaaf2('0x57')]);return db[_0xaaf2('0x6c')][_0xaaf2('0x33')]({'where':_0x5df143[_0xaaf2('0x52')]})[_0xaaf2('0x38')](function(_0x522fed){_0x53dc99['count']=_0x522fed;if(_0x5856fd[_0xaaf2('0x4a')][_0xaaf2('0x58')]){_0x5df143[_0xaaf2('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0xaaf2('0x5a')](_0x5df143);})[_0xaaf2('0x38')](function(_0xf62a11){_0x53dc99[_0xaaf2('0x70')]=_0xf62a11;return _0x53dc99;});}})['then'](respondWithFilteredResult(_0x82f2c6,_0x5df143))[_0xaaf2('0x5b')](handleError(_0x82f2c6,null));};exports[_0xaaf2('0x71')]=function(_0x5c4106,_0x403729,_0x32da3e){return db['WhatsappAccount'][_0xaaf2('0x65')]({'where':{'id':_0x5c4106[_0xaaf2('0x5c')]['id']}})[_0xaaf2('0x38')](handleEntityNotFound(_0x403729,null))[_0xaaf2('0x38')](function(_0x7f2472){if(_0x7f2472){return _0x7f2472[_0xaaf2('0x71')](_0x5c4106[_0xaaf2('0x4a')][_0xaaf2('0x72')]);}})[_0xaaf2('0x38')](respondWithStatusCode(_0x403729,null))[_0xaaf2('0x5b')](handleError(_0x403729,null));};exports[_0xaaf2('0x73')]=function(_0x433364,_0x46752c,_0x38d288){return db[_0xaaf2('0x44')][_0xaaf2('0x65')]({'where':{'id':_0x433364[_0xaaf2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x46752c,null))[_0xaaf2('0x38')](function(_0x4104da){if(_0x4104da){return _0x4104da['addAgents'](_0x433364['body'][_0xaaf2('0x72')],_[_0xaaf2('0x74')](_0x433364['body'],['ids','id'])||{})['spread'](function(_0x213c15){for(var _0x583dc9=0x0;_0x583dc9<_0x433364[_0xaaf2('0x60')][_0xaaf2('0x72')][_0xaaf2('0x4e')];_0x583dc9+=0x1){socket[_0xaaf2('0x75')](_0xaaf2('0x76'),{'UserId':_0x433364[_0xaaf2('0x60')][_0xaaf2('0x72')][_0x583dc9],'WhatsappAccountId':_0x433364[_0xaaf2('0x5c')]['id']});}return _0x213c15;});}})[_0xaaf2('0x38')](respondWithResult(_0x46752c,null))[_0xaaf2('0x5b')](handleError(_0x46752c,null));};exports[_0xaaf2('0x77')]=function(_0x579580,_0x5bc70c,_0x3ce577){return db[_0xaaf2('0x44')][_0xaaf2('0x65')]({'where':{'id':_0x579580[_0xaaf2('0x5c')]['id']}})[_0xaaf2('0x38')](handleEntityNotFound(_0x5bc70c,null))[_0xaaf2('0x38')](function(_0x3aa308){if(_0x3aa308){return _0x3aa308[_0xaaf2('0x77')](_0x579580['query'][_0xaaf2('0x72')])[_0xaaf2('0x38')](function(){if(_['isArray'](_0x579580[_0xaaf2('0x4a')][_0xaaf2('0x72')])){for(var _0x29d42b=0x0;_0x29d42b<_0x579580[_0xaaf2('0x4a')][_0xaaf2('0x72')][_0xaaf2('0x4e')];_0x29d42b+=0x1){socket[_0xaaf2('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x579580[_0xaaf2('0x4a')]['ids'][_0x29d42b]),'WhatsappAccountId':Number(_0x579580['params']['id'])});}}else{socket['emit'](_0xaaf2('0x78'),{'UserId':Number(_0x579580[_0xaaf2('0x4a')][_0xaaf2('0x72')]),'WhatsappAccountId':Number(_0x579580['params']['id'])});}});}})[_0xaaf2('0x38')](respondWithStatusCode(_0x5bc70c,null))[_0xaaf2('0x5b')](handleError(_0x5bc70c,null));};exports[_0xaaf2('0x79')]=function(_0x45c854,_0x2deff7,_0x5f180b){var _0x1207c8={};var _0x112301={};var _0x1a806c;var _0x3a01d1;return db[_0xaaf2('0x44')][_0xaaf2('0x6e')]({'where':{'id':_0x45c854['params']['id']}})[_0xaaf2('0x38')](handleEntityNotFound(_0x2deff7,null))[_0xaaf2('0x38')](function(_0x31c723){if(_0x31c723){_0x1a806c=_0x31c723;_0x112301[_0xaaf2('0x49')]=_[_0xaaf2('0x5d')](db['User'][_0xaaf2('0x45')]);_0x112301[_0xaaf2('0x4a')]=_[_0xaaf2('0x5d')](_0x45c854[_0xaaf2('0x4a')]);_0x112301[_0xaaf2('0x5e')]=_['intersection'](_0x112301[_0xaaf2('0x49')],_0x112301[_0xaaf2('0x4a')]);_0x1207c8[_0xaaf2('0x4c')]=_[_0xaaf2('0x4b')](_0x112301[_0xaaf2('0x49')],qs['fields'](_0x45c854[_0xaaf2('0x4a')]['fields']));_0x1207c8[_0xaaf2('0x4c')]=_0x1207c8[_0xaaf2('0x4c')][_0xaaf2('0x4e')]?_0x1207c8[_0xaaf2('0x4c')]:_0x112301[_0xaaf2('0x49')];_0x1207c8[_0xaaf2('0x50')]=qs['sort'](_0x45c854[_0xaaf2('0x4a')][_0xaaf2('0x51')]);_0x1207c8['where']=qs[_0xaaf2('0x5e')](_['pick'](_0x45c854['query'],_0x112301[_0xaaf2('0x5e')]));if(_0x45c854['query']['filter']){_0x1207c8[_0xaaf2('0x52')]=_[_0xaaf2('0x54')](_0x1207c8[_0xaaf2('0x52')],{'$or':_[_0xaaf2('0x43')](_0x1207c8[_0xaaf2('0x4c')],function(_0x3a175c){var _0x4e9d9e={};_0x4e9d9e[_0x3a175c]={'$like':'%'+_0x45c854['query'][_0xaaf2('0x56')]+'%'};return _0x4e9d9e;})});}_0x1207c8=_[_0xaaf2('0x54')]({},_0x1207c8,_0x45c854[_0xaaf2('0x57')]);return _0x1a806c['getAgents'](_0x1207c8);}})[_0xaaf2('0x38')](function(_0xa69b52){if(_0xa69b52){_0x3a01d1=_0xa69b52[_0xaaf2('0x4e')];if(!_0x45c854['query'][_0xaaf2('0x4f')](_0xaaf2('0x6f'))){_0x1207c8['limit']=qs[_0xaaf2('0x32')](_0x45c854[_0xaaf2('0x4a')]['limit']);_0x1207c8['offset']=qs[_0xaaf2('0x30')](_0x45c854['query'][_0xaaf2('0x30')]);}return _0x1a806c[_0xaaf2('0x79')](_0x1207c8);}})[_0xaaf2('0x38')](function(_0x299388){if(_0x299388){return _0x299388?{'count':_0x3a01d1,'rows':_0x299388}:null;}})[_0xaaf2('0x38')](respondWithResult(_0x2deff7,null))[_0xaaf2('0x5b')](handleError(_0x2deff7,null));};exports[_0xaaf2('0x7a')]=function(_0x1dafd1,_0x16898a,_0x2f569c){return db['WhatsappAccount'][_0xaaf2('0x6e')]({'where':{'id':_0x1dafd1[_0xaaf2('0x5c')]['id']}})[_0xaaf2('0x38')](handleEntityNotFound(_0x16898a,null))[_0xaaf2('0x38')](function(_0x4a5d64){if(_0x4a5d64){return db[_0xaaf2('0x7b')][_0xaaf2('0x7c')](function(_0x5b9c98){return db[_0xaaf2('0x7d')][_0xaaf2('0x39')]({'where':{'WhatsappAccountId':_0x1dafd1[_0xaaf2('0x5c')]['id']},'transaction':_0x5b9c98})[_0xaaf2('0x38')](function(_0x264231){var _0x16c705=_[_0xaaf2('0x43')](_0x1dafd1['body'],function(_0x36c8ec){_0x36c8ec['WhatsappAccountId']=_0x1dafd1[_0xaaf2('0x5c')]['id'];return _0x36c8ec;});return db[_0xaaf2('0x7d')][_0xaaf2('0x7e')](_0x16c705,{'transaction':_0x5b9c98});});})[_0xaaf2('0x38')](function(){return db['WhatsappApplication'][_0xaaf2('0x7f')]({'where':{'WhatsappAccountId':_0x1dafd1[_0xaaf2('0x5c')]['id']},'order':_0xaaf2('0x80')});});}})[_0xaaf2('0x38')](respondWithResult(_0x16898a,null))[_0xaaf2('0x5b')](handleError(_0x16898a,null));};exports['getApplications']=function(_0x255192,_0x48ba39,_0x433aa3){var _0x396e7b={};var _0x36b9a2={};var _0x248fe7;var _0x131b1a;return db[_0xaaf2('0x44')][_0xaaf2('0x6e')]({'where':{'id':_0x255192[_0xaaf2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x48ba39,null))[_0xaaf2('0x38')](function(_0x4320ae){if(_0x4320ae){_0x248fe7=_0x4320ae;_0x36b9a2[_0xaaf2('0x49')]=_[_0xaaf2('0x5d')](db['WhatsappApplication']['rawAttributes']);_0x36b9a2['query']=_['keys'](_0x255192[_0xaaf2('0x4a')]);_0x36b9a2['filters']=_[_0xaaf2('0x4b')](_0x36b9a2[_0xaaf2('0x49')],_0x36b9a2[_0xaaf2('0x4a')]);_0x396e7b[_0xaaf2('0x4c')]=_['intersection'](_0x36b9a2[_0xaaf2('0x49')],qs['fields'](_0x255192['query']['fields']));_0x396e7b[_0xaaf2('0x4c')]=_0x396e7b['attributes'][_0xaaf2('0x4e')]?_0x396e7b[_0xaaf2('0x4c')]:_0x36b9a2[_0xaaf2('0x49')];_0x396e7b['order']=qs['sort'](_0x255192[_0xaaf2('0x4a')][_0xaaf2('0x51')]);_0x396e7b[_0xaaf2('0x52')]=qs[_0xaaf2('0x5e')](_[_0xaaf2('0x53')](_0x255192[_0xaaf2('0x4a')],_0x36b9a2['filters']));if(_0x255192[_0xaaf2('0x4a')]['filter']){_0x396e7b[_0xaaf2('0x52')]=_[_0xaaf2('0x54')](_0x396e7b[_0xaaf2('0x52')],{'$or':_['map'](_0x396e7b[_0xaaf2('0x4c')],function(_0x5169e9){var _0x4dd321={};_0x4dd321[_0x5169e9]={'$like':'%'+_0x255192['query'][_0xaaf2('0x56')]+'%'};return _0x4dd321;})});}_0x396e7b=_[_0xaaf2('0x54')]({},_0x396e7b,_0x255192[_0xaaf2('0x57')]);return _0x248fe7[_0xaaf2('0x81')](_0x396e7b);}})[_0xaaf2('0x38')](function(_0x486e8b){if(_0x486e8b){_0x131b1a=_0x486e8b[_0xaaf2('0x4e')];if(!_0x255192[_0xaaf2('0x4a')][_0xaaf2('0x4f')](_0xaaf2('0x6f'))){_0x396e7b[_0xaaf2('0x32')]=qs[_0xaaf2('0x32')](_0x255192[_0xaaf2('0x4a')][_0xaaf2('0x32')]);_0x396e7b[_0xaaf2('0x30')]=qs['offset'](_0x255192[_0xaaf2('0x4a')][_0xaaf2('0x30')]);}return _0x248fe7['getApplications'](_0x396e7b);}})[_0xaaf2('0x38')](function(_0x2f5b5b){if(_0x2f5b5b){return _0x2f5b5b?{'count':_0x131b1a,'rows':_0x2f5b5b}:null;}})[_0xaaf2('0x38')](respondWithResult(_0x48ba39,null))['catch'](handleError(_0x48ba39,null));};exports[_0xaaf2('0x82')]=function(_0x3bcfb4,_0x51bb2b,_0x1322cd){var _0x3800e0={'channel':_0xaaf2('0x83')};var _0xc2f6e8=[];var _0xeb054d=[];var _0x117df2={};return db['WhatsappAccount'][_0xaaf2('0x65')]({'where':{'id':_0x3bcfb4[_0xaaf2('0x5c')]['id']},'include':[{'model':db[_0xaaf2('0x7d')],'as':_0xaaf2('0x84')}]})[_0xaaf2('0x38')](handleEntityNotFound(_0x51bb2b,null))['then'](function(_0x3e041e){_0x3800e0[_0xaaf2('0x85')]=_0x3e041e;_0x3800e0[_0xaaf2('0x86')]=_[_0xaaf2('0x87')](_0x3e041e[_0xaaf2('0x84')],[_0xaaf2('0x80')],[_0xaaf2('0x88')]);if(_0x3800e0[_0xaaf2('0x85')][_0xaaf2('0x84')]){delete _0x3800e0['account'][_0xaaf2('0x84')];}return db[_0xaaf2('0x89')][_0xaaf2('0x8a')]();})[_0xaaf2('0x38')](function(_0x3200bf){if(!_0x3200bf){throw new db[(_0xaaf2('0x8b'))][(_0xaaf2('0x8c'))]('no\x20available\x20attributes');}_0xc2f6e8=_['difference'](_[_0xaaf2('0x5d')](_0x3200bf),[_0xaaf2('0x8d'),_0xaaf2('0x8e')]);_0xeb054d=_[_0xaaf2('0x8f')](_['keys'](_0x3200bf),[_0xaaf2('0x8d'),_0xaaf2('0x8e'),_0xaaf2('0x90'),_0xaaf2('0x91')]);_0x3800e0['body']={'mapKey':_0xaaf2('0x92')};if(_0x3800e0[_0xaaf2('0x85')][_0xaaf2('0x47')]&&_0x3800e0[_0xaaf2('0x85')][_0xaaf2('0x47')]===_0xaaf2('0x93')){_0x3800e0[_0xaaf2('0x60')][_0xaaf2('0x94')]=_0x3bcfb4[_0xaaf2('0x60')][_0xaaf2('0x95')][_0xaaf2('0x96')](_0xaaf2('0x97'),'');_0x3800e0['body'][_0xaaf2('0x60')]=_0x3bcfb4[_0xaaf2('0x60')][_0xaaf2('0x98')];_0x3800e0[_0xaaf2('0x60')][_0xaaf2('0x99')]=_0x3bcfb4['body'][_0xaaf2('0x9a')];}if(_0x3800e0[_0xaaf2('0x60')]['id']){delete _0x3800e0[_0xaaf2('0x60')]['id'];}if(_[_0xaaf2('0x9b')](_0x3800e0[_0xaaf2('0x60')][_0xaaf2('0x94')])){throw new db[(_0xaaf2('0x8b'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x3800e0[_0xaaf2('0x60')]['body'])||_0x3800e0[_0xaaf2('0x60')][_0xaaf2('0x60')]===''){throw new db[(_0xaaf2('0x8b'))][(_0xaaf2('0x8c'))](_0xaaf2('0x9c'));}if(_[_0xaaf2('0x9b')](_0x3800e0['body'][_0xaaf2('0x9d')])){throw new db['Sequelize'][(_0xaaf2('0x8c'))](_0xaaf2('0x9e')+_0xeb054d);}if(!_[_0xaaf2('0x9f')](_0xeb054d,_0x3800e0[_0xaaf2('0x60')]['mapKey'])){throw new db['Sequelize'][(_0xaaf2('0x8c'))](_0xaaf2('0xa0')+_0xeb054d);}_0x117df2[_0x3800e0[_0xaaf2('0x60')]['mapKey']]=_0x3800e0['body'][_0xaaf2('0x94')];return db[_0xaaf2('0xa1')][_0xaaf2('0x65')]({'where':{'id':_0x3800e0[_0xaaf2('0x85')][_0xaaf2('0x91')]},'include':[{'model':db['CmContact'],'as':_0xaaf2('0xa2'),'where':_0x117df2,'limit':0x1,'order':[['updatedAt',_0xaaf2('0xa3')]]}]});})[_0xaaf2('0x38')](handleEntityNotFound(_0x51bb2b,null))[_0xaaf2('0x38')](function(_0x1f52d5){if(_0x1f52d5){_0x3800e0[_0xaaf2('0xa4')]=_['omit'](_0x1f52d5,[_0xaaf2('0xa2')]);if(_0x1f52d5[_0xaaf2('0xa2')][_0xaaf2('0x4e')]){return _0x1f52d5[_0xaaf2('0xa2')][0x0];}var _0x55c728=_[_0xaaf2('0x1c')](_0x3800e0[_0xaaf2('0x60')],{'firstName':_0x3800e0[_0xaaf2('0x60')][_0xaaf2('0x94')],'ListId':_0x1f52d5['id']});_0x55c728[_0x3800e0[_0xaaf2('0x60')][_0xaaf2('0x9d')]]=_0x3800e0[_0xaaf2('0x60')]['from'];return db[_0xaaf2('0x89')]['create'](_0x55c728,{'fields':_0xc2f6e8,'raw':!![]});}})[_0xaaf2('0x38')](handleEntityNotFound(_0x51bb2b,null))[_0xaaf2('0x38')](function(_0x1ef57f){if(_0x1ef57f){_0x3800e0['contact']=_0x1ef57f;var _0x4ef02c={'ContactId':_0x1ef57f['id'],'phone':_0x3800e0[_0xaaf2('0x60')][_0xaaf2('0x94')],'WhatsappAccountId':_0x3bcfb4[_0xaaf2('0x5c')]['id']};var _0x8596c6={'ContactId':_0x1ef57f['id'],'WhatsappAccountId':_0x3bcfb4[_0xaaf2('0x5c')]['id'],'closed':![]};return db[_0xaaf2('0xa5')]['find']({'where':_0x8596c6})['then'](function(_0x132275){if(_0x132275){return[_0x132275,![]];}return db['WhatsappInteraction'][_0xaaf2('0x5f')](_0x4ef02c)[_0xaaf2('0x38')](function(_0x4ac6bd){return[_0x4ac6bd,!![]];});});}})[_0xaaf2('0xa6')](function(_0x1e1bf9,_0x5d5b7f){_0x3800e0[_0xaaf2('0xa7')]=_0x1e1bf9[_0xaaf2('0x3a')]({'plain':!![]});_0x3800e0[_0xaaf2('0xa7')][_0xaaf2('0xa8')]=![];if(_0x5d5b7f){if(_0x3800e0[_0xaaf2('0x85')][_0xaaf2('0xa9')]){_0x3800e0[_0xaaf2('0x86')][_0xaaf2('0xaa')]({'id':0x0,'priority':_0x3800e0[_0xaaf2('0x86')][_0xaaf2('0x4e')]+0x1,'app':'close','appdata':_0xaaf2('0xab'),'interval':_0xaaf2('0xac')});}_0x3800e0['interaction'][_0xaaf2('0xa8')]=!![];}return db[_0xaaf2('0xad')][_0xaaf2('0x5f')]({'phone':_0x3800e0[_0xaaf2('0x60')]['from'],'messageId':_0x3800e0['body'][_0xaaf2('0x99')],'body':_0x3800e0[_0xaaf2('0x60')]['body'],'WhatsappAccountId':_0x3bcfb4[_0xaaf2('0x5c')]['id'],'WhatsappInteractionId':_0x1e1bf9['id'],'direction':'in','ContactId':_0x1e1bf9[_0xaaf2('0xae')],'AttachmentId':_0x3800e0[_0xaaf2('0x60')][_0xaaf2('0xaf')]});})[_0xaaf2('0x38')](function(_0x12de35){_0x3800e0[_0xaaf2('0x2a')]=_0x12de35;if(_0x3800e0[_0xaaf2('0xa7')]['UserId']){return db[_0xaaf2('0xb0')]['find']({'attributes':['id',_0xaaf2('0x3e')],'where':{'id':_0x3800e0[_0xaaf2('0xa7')][_0xaaf2('0xb1')]}})[_0xaaf2('0x38')](function(_0x481137){if(_0x481137){_0x3800e0['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xaaf2('0xb2'),'appdata':_0x481137[_0xaaf2('0x3e')]+','+(_0x3800e0[_0xaaf2('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0xaaf2('0xac')});}return respondWithRpcPromise('Start',_0xaaf2('0xb3'),_0x3800e0);});}return respondWithRpcPromise(_0xaaf2('0xb4'),_0xaaf2('0xb3'),_0x3800e0);})['then'](function(_0x16f66e){if(_0x16f66e){var _0x363492=0xc8;var _0x4843fa='receiveMessage';logger[_0xaaf2('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4843fa,_0x363492,_0xaaf2('0xb5'));logger[_0xaaf2('0x26')](_0xaaf2('0xb6'),_0x4843fa,_0x363492,_0xaaf2('0xb5'),JSON['stringify'](_0x16f66e));if(_0x3800e0[_0xaaf2('0x85')][_0xaaf2('0x47')]===_0xaaf2('0x93')){return _0x51bb2b[_0xaaf2('0x2e')](_0x363492)[_0xaaf2('0x34')](_0xaaf2('0xb7'),_0xaaf2('0xb8'))['send']('\x0a');}else{return _0x51bb2b[_0xaaf2('0x2e')](_0x363492)[_0xaaf2('0x2f')](_0x16f66e);}}})[_0xaaf2('0x5b')](handleError(_0x51bb2b,null));};exports[_0xaaf2('0x3f')]=function(_0x2f81bc,_0x189d25,_0x4bcc80){var _0x2947cf,_0x3530b8,_0x4e0820;if(_[_0xaaf2('0x9b')](_0x2f81bc[_0xaaf2('0x60')][_0xaaf2('0x60')])||_0x2f81bc[_0xaaf2('0x60')][_0xaaf2('0x60')]===''){throw new db[(_0xaaf2('0x8b'))]['ValidationError'](_0xaaf2('0x9c'));}if(_[_0xaaf2('0x9b')](_0x2f81bc[_0xaaf2('0x60')]['to'])){throw new db[(_0xaaf2('0x8b'))]['ValidationError'](_0xaaf2('0xb9'));}_0x2947cf=_0x2f81bc['body']['to'];return db[_0xaaf2('0x44')][_0xaaf2('0x65')]({'where':{'id':_0x2f81bc['params']['id']},'include':[{'model':db[_0xaaf2('0xa1')],'as':_0xaaf2('0xba'),'include':[{'model':db[_0xaaf2('0x89')],'as':_0xaaf2('0xa2'),'where':{'mobile':_0x2947cf},'limit':0x1,'order':[['updatedAt',_0xaaf2('0xa3')]]}]}]})[_0xaaf2('0x38')](handleEntityNotFound(_0x189d25,null))[_0xaaf2('0x38')](function(_0x5e2cfb){if(_0x5e2cfb&&_0x5e2cfb[_0xaaf2('0xba')]){_0x3530b8=_0x5e2cfb[_0xaaf2('0x3a')]({'plain':!![]});if(_0x3530b8[_0xaaf2('0xba')]&&_0x3530b8['List'][_0xaaf2('0xa2')][_0xaaf2('0x4e')]){return _0x3530b8[_0xaaf2('0xba')][_0xaaf2('0xa2')][0x0];}return db[_0xaaf2('0x89')][_0xaaf2('0x5f')](_[_0xaaf2('0x1c')](_0x2f81bc[_0xaaf2('0x60')],{'firstName':_0x2947cf,'mobile':_0x2947cf,'phone':_0x2947cf,'ListId':_0x3530b8['ListId']}));}})['then'](handleEntityNotFound(_0x189d25,null))[_0xaaf2('0x38')](function(_0x24d7b5){if(_0x24d7b5){_0x4e0820=_0x24d7b5;return db[_0xaaf2('0xa5')][_0xaaf2('0x65')]({'where':{'ContactId':_0x4e0820['id'],'closed':![],'WhatsappAccountId':_0x3530b8['id']}})[_0xaaf2('0x38')](function(_0x2fb2f8){if(_0x2fb2f8){return[_0x2fb2f8,![]];}return db[_0xaaf2('0xa5')][_0xaaf2('0x5f')]({'UserId':_0x2f81bc['user']['id'],'ContactId':_0x4e0820['id'],'WhatsappAccountId':_0x3530b8['id'],'phone':_0x2947cf,'firstMsgDirection':'out','Messages':[_[_0xaaf2('0x54')](_0x2f81bc['body'],{'read':![],'body':_0x2f81bc[_0xaaf2('0x60')][_0xaaf2('0x60')],'phone':_0x2947cf,'WhatsappAccountId':_0x3530b8['id'],'UserId':_0x2f81bc[_0xaaf2('0x61')]['id'],'ContactId':_0x4e0820['id']})]},{'include':[{'model':db[_0xaaf2('0xad')],'as':_0xaaf2('0xbb')}]})[_0xaaf2('0x38')](function(_0x4b83e5){return[_0x4b83e5,!![]];});});}})[_0xaaf2('0xa6')](function(_0x40b89f,_0x52de8b){if(_0x52de8b){return _0x40b89f;}return db[_0xaaf2('0xad')][_0xaaf2('0x5f')](_[_0xaaf2('0x54')](_0x2f81bc[_0xaaf2('0x60')],{'read':![],'body':_0x2f81bc[_0xaaf2('0x60')][_0xaaf2('0x60')],'phone':_0x2947cf,'WhatsappAccountId':_0x3530b8['id'],'WhatsappInteractionId':_0x40b89f['id'],'UserId':_0x2f81bc['user']['id'],'ContactId':_0x4e0820['id']}))[_0xaaf2('0x38')](function(_0x3bb81e){_0x40b89f['dataValues'][_0xaaf2('0xbb')]=[];_0x40b89f[_0xaaf2('0xbc')]['Messages'][_0xaaf2('0xaa')](_0x3bb81e[_0xaaf2('0xbc')]);return _0x40b89f;});})[_0xaaf2('0x38')](respondWithResult(_0x189d25,null))[_0xaaf2('0x5b')](handleError(_0x189d25,null));}; \ No newline at end of file +var _0x8b56=['debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','get','WhatsappAccounts','UserProfileResource','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','key','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','Pause','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','findOne','User','addApplications','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','Applications','account','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','to\x20is\x20mandatory','CmList','List','out','WhatsappMessage','Messages','dataValues','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4dd433,_0x46db36){var _0x1dbf43=function(_0x160be0){while(--_0x160be0){_0x4dd433['push'](_0x4dd433['shift']());}};_0x1dbf43(++_0x46db36);}(_0x8b56,0x99));var _0x68b5=function(_0x1af750,_0x4c74ae){_0x1af750=_0x1af750-0x0;var _0x4e8c9d=_0x8b56[_0x1af750];return _0x4e8c9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x68b5('0x0'));var zipdir=require(_0x68b5('0x1'));var jsonpatch=require(_0x68b5('0x2'));var rp=require('request-promise');var moment=require(_0x68b5('0x3'));var BPromise=require(_0x68b5('0x4'));var Mustache=require(_0x68b5('0x5'));var util=require(_0x68b5('0x6'));var path=require(_0x68b5('0x7'));var sox=require(_0x68b5('0x8'));var csv=require('to-csv');var ejs=require(_0x68b5('0x9'));var fs=require('fs');var fs_extra=require(_0x68b5('0xa'));var _=require(_0x68b5('0xb'));var squel=require(_0x68b5('0xc'));var crypto=require(_0x68b5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68b5('0xe'));var toCsv=require(_0x68b5('0xf'));var querystring=require(_0x68b5('0x10'));var Papa=require(_0x68b5('0x11'));var Redis=require('ioredis');var authService=require(_0x68b5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x68b5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x68b5('0x14'));var utils=require(_0x68b5('0x15'));var config=require(_0x68b5('0x16'));var licenseUtil=require(_0x68b5('0x17'));var db=require(_0x68b5('0x18'))['db'];config[_0x68b5('0x19')]=_[_0x68b5('0x1a')](config[_0x68b5('0x19')],{'host':_0x68b5('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x68b5('0x19')]));require(_0x68b5('0x1c'))[_0x68b5('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x68b5('0x1e')][_0x68b5('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x3e9f67,_0x4c0ede,_0x4ad726,_0x3015bc){return new BPromise(function(_0x3681ca,_0x26c969){var _0x268717=_0x3015bc||client;return _0x268717[_0x68b5('0x20')](_0x3e9f67,_0x4ad726)[_0x68b5('0x21')](function(_0x246b24){logger[_0x68b5('0x22')](_0x68b5('0x23'),_0x4c0ede,_0x68b5('0x24'));logger[_0x68b5('0x25')](_0x68b5('0x26'),_0x4c0ede,_0x68b5('0x24'),JSON[_0x68b5('0x27')](_0x246b24));if(_0x246b24['error']){if(_0x246b24[_0x68b5('0x28')]['code']===0x1f4){logger[_0x68b5('0x28')](_0x68b5('0x23'),_0x4c0ede,_0x246b24[_0x68b5('0x28')][_0x68b5('0x29')]);return _0x26c969(_0x246b24[_0x68b5('0x28')][_0x68b5('0x29')]);}logger[_0x68b5('0x28')](_0x68b5('0x23'),_0x4c0ede,_0x246b24[_0x68b5('0x28')][_0x68b5('0x29')]);return _0x3681ca(_0x246b24[_0x68b5('0x28')][_0x68b5('0x29')]);}else{logger[_0x68b5('0x22')](_0x68b5('0x23'),_0x4c0ede,_0x68b5('0x24'));_0x3681ca(_0x246b24['result']['message']);}})[_0x68b5('0x2a')](function(_0x2d1088){logger[_0x68b5('0x28')](_0x68b5('0x23'),_0x4c0ede,_0x2d1088);_0x26c969(_0x2d1088);});});}function respondWithStatusCode(_0x51539a,_0x17c32b){_0x17c32b=_0x17c32b||0xcc;return function(_0x1f253b){if(_0x1f253b){return _0x51539a[_0x68b5('0x2b')](_0x17c32b);}return _0x51539a[_0x68b5('0x2c')](_0x17c32b)[_0x68b5('0x2d')]();};}function respondWithResult(_0x5c53ed,_0x2e25d7){_0x2e25d7=_0x2e25d7||0xc8;return function(_0x2cc512){if(_0x2cc512){return _0x5c53ed[_0x68b5('0x2c')](_0x2e25d7)[_0x68b5('0x2e')](_0x2cc512);}};}function respondWithFilteredResult(_0x1aa7fa,_0x80986e){return function(_0x194100){if(_0x194100){var _0x2688ac=typeof _0x80986e[_0x68b5('0x2f')]===_0x68b5('0x30')&&typeof _0x80986e[_0x68b5('0x31')]===_0x68b5('0x30');var _0x3975f9=_0x194100[_0x68b5('0x32')];var _0x554640=_0x2688ac?0x0:_0x80986e[_0x68b5('0x2f')];var _0x1d6881=_0x2688ac?_0x194100[_0x68b5('0x32')]:_0x80986e[_0x68b5('0x2f')]+_0x80986e[_0x68b5('0x31')];var _0x1fea94;if(_0x1d6881>=_0x3975f9){_0x1d6881=_0x3975f9;_0x1fea94=0xc8;}else{_0x1fea94=0xce;}_0x1aa7fa[_0x68b5('0x2c')](_0x1fea94);return _0x1aa7fa[_0x68b5('0x33')](_0x68b5('0x34'),_0x554640+'-'+_0x1d6881+'/'+_0x3975f9)[_0x68b5('0x2e')](_0x194100);}return null;};}function patchUpdates(_0x1021ea){return function(_0x426495){try{jsonpatch[_0x68b5('0x35')](_0x426495,_0x1021ea,!![]);}catch(_0x5dde9d){return BPromise[_0x68b5('0x36')](_0x5dde9d);}return _0x426495['save']();};}function saveUpdates(_0x13e6eb,_0x1bb289){return function(_0x535f85){if(_0x535f85){return _0x535f85['update'](_0x13e6eb)[_0x68b5('0x21')](function(_0x20e85b){return _0x20e85b;});}return null;};}function removeEntity(_0x33490d,_0xef3c45){return function(_0x360fb6){if(_0x360fb6){return _0x360fb6[_0x68b5('0x37')]()[_0x68b5('0x21')](function(){var _0x3d08e0=_0x360fb6[_0x68b5('0x38')]({'plain':!![]});var _0x2790f8=_0x68b5('0x39');return db[_0x68b5('0x3a')][_0x68b5('0x37')]({'where':{'type':_0x2790f8,'resourceId':_0x3d08e0['id']}})[_0x68b5('0x21')](function(){return _0x360fb6;});})[_0x68b5('0x21')](function(){_0x33490d[_0x68b5('0x2c')](0xcc)[_0x68b5('0x2d')]();});}};}function handleEntityNotFound(_0x72515,_0xdb7bf0){return function(_0x3462fd){if(!_0x3462fd){_0x72515[_0x68b5('0x2b')](0x194);}return _0x3462fd;};}function handleError(_0x30ced5,_0x2a091b){_0x2a091b=_0x2a091b||0x1f4;return function(_0x51b565){logger[_0x68b5('0x28')](_0x51b565['stack']);if(_0x51b565[_0x68b5('0x3b')]){delete _0x51b565[_0x68b5('0x3b')];}_0x30ced5[_0x68b5('0x2c')](_0x2a091b)['send'](_0x51b565);};}exports[_0x68b5('0x3c')]=function(_0x2df60b,_0x59d315){var _0x91bc62={'include':[{'model':db['Pause'],'as':_0x68b5('0x3d')}]},_0x713d0a={},_0x5c69ee={'count':0x0,'rows':[]};var _0x2799f5=_[_0x68b5('0x3e')](db[_0x68b5('0x3f')][_0x68b5('0x40')],function(_0x134b9c){return{'name':_0x134b9c['fieldName'],'type':_0x134b9c['type'][_0x68b5('0x41')]};});_0x713d0a[_0x68b5('0x42')]=_[_0x68b5('0x3e')](_0x2799f5,_0x68b5('0x3b'));_0x713d0a['query']=_[_0x68b5('0x43')](_0x2df60b[_0x68b5('0x44')]);_0x713d0a['filters']=_['intersection'](_0x713d0a[_0x68b5('0x42')],_0x713d0a[_0x68b5('0x44')]);_0x91bc62[_0x68b5('0x45')]=_[_0x68b5('0x46')](_0x713d0a[_0x68b5('0x42')],qs[_0x68b5('0x47')](_0x2df60b[_0x68b5('0x44')]['fields']));_0x91bc62[_0x68b5('0x45')]=_0x91bc62[_0x68b5('0x45')][_0x68b5('0x48')]?_0x91bc62[_0x68b5('0x45')]:_0x713d0a[_0x68b5('0x42')];if(!_0x2df60b[_0x68b5('0x44')]['hasOwnProperty'](_0x68b5('0x49'))){_0x91bc62[_0x68b5('0x31')]=qs[_0x68b5('0x31')](_0x2df60b[_0x68b5('0x44')][_0x68b5('0x31')]);_0x91bc62[_0x68b5('0x2f')]=qs[_0x68b5('0x2f')](_0x2df60b[_0x68b5('0x44')]['offset']);}_0x91bc62[_0x68b5('0x4a')]=qs['sort'](_0x2df60b[_0x68b5('0x44')][_0x68b5('0x4b')]);_0x91bc62[_0x68b5('0x4c')]=qs[_0x68b5('0x4d')](_[_0x68b5('0x4e')](_0x2df60b[_0x68b5('0x44')],_0x713d0a['filters']),_0x2799f5);if(_0x2df60b[_0x68b5('0x44')][_0x68b5('0x4f')]){_0x91bc62[_0x68b5('0x4c')]=_['merge'](_0x91bc62[_0x68b5('0x4c')],{'$or':_[_0x68b5('0x3e')](_0x2799f5,function(_0x3495c0){if(_0x3495c0[_0x68b5('0x50')]!==_0x68b5('0x51')){var _0x4a45d9={};_0x4a45d9[_0x3495c0[_0x68b5('0x3b')]]={'$like':'%'+_0x2df60b['query'][_0x68b5('0x4f')]+'%'};return _0x4a45d9;}})});}_0x91bc62=_[_0x68b5('0x52')]({},_0x91bc62,_0x2df60b['options']);var _0xa730ad={'where':_0x91bc62[_0x68b5('0x4c')]};return db['WhatsappAccount'][_0x68b5('0x32')](_0xa730ad)[_0x68b5('0x21')](function(_0x4a81d3){_0x5c69ee[_0x68b5('0x32')]=_0x4a81d3;if(_0x2df60b['query'][_0x68b5('0x53')]){_0x91bc62[_0x68b5('0x54')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x68b5('0x55')](_0x91bc62);})['then'](function(_0x10363d){_0x5c69ee[_0x68b5('0x56')]=_0x10363d;return _0x5c69ee;})[_0x68b5('0x21')](respondWithFilteredResult(_0x59d315,_0x91bc62))[_0x68b5('0x2a')](handleError(_0x59d315,null));};exports[_0x68b5('0x57')]=function(_0x4c50b3,_0xedb677){var _0x1ff286={'raw':![],'where':{'id':_0x4c50b3[_0x68b5('0x58')]['id']},'include':[{'model':db[_0x68b5('0x59')],'as':'mandatoryDispositionPause'}]},_0x131248={};_0x131248[_0x68b5('0x42')]=_['keys'](db[_0x68b5('0x3f')]['rawAttributes']);_0x131248['query']=_[_0x68b5('0x43')](_0x4c50b3[_0x68b5('0x44')]);_0x131248['filters']=_[_0x68b5('0x46')](_0x131248[_0x68b5('0x42')],_0x131248[_0x68b5('0x44')]);_0x1ff286['attributes']=_[_0x68b5('0x46')](_0x131248['model'],qs[_0x68b5('0x47')](_0x4c50b3[_0x68b5('0x44')][_0x68b5('0x47')]));_0x1ff286[_0x68b5('0x45')]=_0x1ff286['attributes'][_0x68b5('0x48')]?_0x1ff286[_0x68b5('0x45')]:_0x131248[_0x68b5('0x42')];if(_0x4c50b3[_0x68b5('0x44')]['includeAll']){_0x1ff286[_0x68b5('0x54')]=[{'all':!![]}];}_0x1ff286=_[_0x68b5('0x52')]({},_0x1ff286,_0x4c50b3[_0x68b5('0x5a')]);return db['WhatsappAccount']['find'](_0x1ff286)[_0x68b5('0x21')](handleEntityNotFound(_0xedb677,null))['then'](respondWithResult(_0xedb677,null))[_0x68b5('0x2a')](handleError(_0xedb677,null));};exports[_0x68b5('0x5b')]=function(_0x5ba22b,_0x51e1e9){return db[_0x68b5('0x3f')]['create'](_0x5ba22b[_0x68b5('0x5c')],{})[_0x68b5('0x21')](function(_0x246523){var _0x326b49=_0x5ba22b[_0x68b5('0x5d')][_0x68b5('0x38')]({'plain':!![]});if(!_0x326b49)throw new Error(_0x68b5('0x5e'));if(_0x326b49[_0x68b5('0x5f')]===_0x68b5('0x5d')){var _0xf8f1c4=_0x246523[_0x68b5('0x38')]({'plain':!![]});var _0x5c35e3='WhatsappAccounts';return db[_0x68b5('0x60')][_0x68b5('0x61')]({'where':{'name':_0x5c35e3,'userProfileId':_0x326b49[_0x68b5('0x62')]},'raw':!![]})[_0x68b5('0x21')](function(_0x80d138){if(_0x80d138&&_0x80d138[_0x68b5('0x63')]===0x0){return db[_0x68b5('0x3a')][_0x68b5('0x5b')]({'name':_0xf8f1c4['name'],'resourceId':_0xf8f1c4['id'],'type':_0x80d138[_0x68b5('0x3b')],'sectionId':_0x80d138['id']},{})[_0x68b5('0x21')](function(){return _0x246523;});}else{return _0x246523;}})[_0x68b5('0x2a')](function(_0x27cf7d){logger['error'](_0x68b5('0x64'),_0x27cf7d);throw _0x27cf7d;});}return _0x246523;})[_0x68b5('0x21')](respondWithResult(_0x51e1e9,0xc9))[_0x68b5('0x2a')](handleError(_0x51e1e9,null));};exports[_0x68b5('0x65')]=function(_0x8af500,_0x1b32e6){if(_0x8af500[_0x68b5('0x5c')]['id']){delete _0x8af500[_0x68b5('0x5c')]['id'];}return db[_0x68b5('0x3f')][_0x68b5('0x61')]({'where':{'id':_0x8af500[_0x68b5('0x58')]['id']},'include':[{'model':db[_0x68b5('0x59')],'as':_0x68b5('0x3d')}]})[_0x68b5('0x21')](handleEntityNotFound(_0x1b32e6,null))[_0x68b5('0x21')](saveUpdates(_0x8af500['body'],null))[_0x68b5('0x21')](respondWithResult(_0x1b32e6,null))[_0x68b5('0x2a')](handleError(_0x1b32e6,null));};exports[_0x68b5('0x37')]=function(_0x12751c,_0x4ba1cf){return db['WhatsappAccount'][_0x68b5('0x61')]({'where':{'id':_0x12751c[_0x68b5('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ba1cf,null))[_0x68b5('0x21')](removeEntity(_0x4ba1cf,null))['catch'](handleError(_0x4ba1cf,null));};exports[_0x68b5('0x66')]=function(_0x1be9ba,_0x478fc7){return db[_0x68b5('0x3f')][_0x68b5('0x66')]()[_0x68b5('0x21')](respondWithResult(_0x478fc7,null))[_0x68b5('0x2a')](handleError(_0x478fc7,null));};exports[_0x68b5('0x67')]=function(_0x2c150a,_0x425683,_0x3255a7){if(_0x2c150a['body']['id']){delete _0x2c150a[_0x68b5('0x5c')]['id'];}return db[_0x68b5('0x3f')][_0x68b5('0x61')]({'where':{'id':_0x2c150a[_0x68b5('0x58')]['id']}})['then'](handleEntityNotFound(_0x425683,null))[_0x68b5('0x21')](function(_0x37b899){if(_0x37b899){_0x2c150a['body'][_0x68b5('0x68')]=_0x37b899['id'];return db[_0x68b5('0x69')][_0x68b5('0x5b')](_0x2c150a[_0x68b5('0x5c')]);}})['then'](respondWithResult(_0x425683,null))['catch'](handleError(_0x425683,null));};exports[_0x68b5('0x6a')]=function(_0x5160e6,_0x5f5ae2,_0x4cee4b){var _0x141527={'raw':![],'where':{}};var _0x3891e2={};var _0x186420={'count':0x0,'rows':[]};return db[_0x68b5('0x3f')]['findOne']({'where':{'id':_0x5160e6['params']['id']}})['then'](handleEntityNotFound(_0x5f5ae2,null))['then'](function(_0x2c5d26){if(_0x2c5d26){_0x3891e2['model']=_[_0x68b5('0x43')](db[_0x68b5('0x69')][_0x68b5('0x40')]);_0x3891e2[_0x68b5('0x44')]=_['keys'](_0x5160e6[_0x68b5('0x44')]);_0x3891e2[_0x68b5('0x4d')]=_[_0x68b5('0x46')](_0x3891e2[_0x68b5('0x42')],_0x3891e2[_0x68b5('0x44')]);_0x141527[_0x68b5('0x45')]=_[_0x68b5('0x46')](_0x3891e2[_0x68b5('0x42')],qs[_0x68b5('0x47')](_0x5160e6['query'][_0x68b5('0x47')]));_0x141527['attributes']=_0x141527[_0x68b5('0x45')][_0x68b5('0x48')]?_0x141527[_0x68b5('0x45')]:_0x3891e2[_0x68b5('0x42')];if(!_0x5160e6[_0x68b5('0x44')][_0x68b5('0x6b')](_0x68b5('0x49'))){_0x141527['limit']=qs[_0x68b5('0x31')](_0x5160e6[_0x68b5('0x44')][_0x68b5('0x31')]);_0x141527[_0x68b5('0x2f')]=qs['offset'](_0x5160e6[_0x68b5('0x44')][_0x68b5('0x2f')]);}_0x141527[_0x68b5('0x4a')]=qs[_0x68b5('0x4b')](_0x5160e6[_0x68b5('0x44')]['sort']);_0x141527[_0x68b5('0x4c')]=qs[_0x68b5('0x4d')](_[_0x68b5('0x4e')](_0x5160e6[_0x68b5('0x44')],_0x3891e2[_0x68b5('0x4d')]));_0x141527[_0x68b5('0x4c')][_0x68b5('0x68')]=_0x2c5d26['id'];if(_0x5160e6[_0x68b5('0x44')]['filter']){_0x141527['where']=_[_0x68b5('0x52')](_0x141527[_0x68b5('0x4c')],{'$or':_[_0x68b5('0x3e')](_0x141527[_0x68b5('0x45')],function(_0xc242c8){var _0x3e0c91={};_0x3e0c91[_0xc242c8]={'$like':'%'+_0x5160e6['query']['filter']+'%'};return _0x3e0c91;})});}_0x141527=_[_0x68b5('0x52')]({},_0x141527,_0x5160e6[_0x68b5('0x5a')]);return db[_0x68b5('0x69')][_0x68b5('0x32')]({'where':_0x141527['where']})[_0x68b5('0x21')](function(_0x3d16ce){_0x186420[_0x68b5('0x32')]=_0x3d16ce;if(_0x5160e6[_0x68b5('0x44')][_0x68b5('0x53')]){_0x141527['include']=[{'all':!![]}];}return db['Disposition'][_0x68b5('0x55')](_0x141527);})['then'](function(_0x308003){_0x186420['rows']=_0x308003;return _0x186420;});}})[_0x68b5('0x21')](respondWithFilteredResult(_0x5f5ae2,_0x141527))[_0x68b5('0x2a')](handleError(_0x5f5ae2,null));};exports[_0x68b5('0x6c')]=function(_0x3f54b3,_0x3a3b5c,_0x17b786){return db['WhatsappAccount'][_0x68b5('0x61')]({'where':{'id':_0x3f54b3[_0x68b5('0x58')]['id']}})[_0x68b5('0x21')](handleEntityNotFound(_0x3a3b5c,null))[_0x68b5('0x21')](function(_0x3a0f3e){if(_0x3a0f3e){return _0x3a0f3e[_0x68b5('0x6c')](_0x3f54b3[_0x68b5('0x44')][_0x68b5('0x6d')]);}})[_0x68b5('0x21')](respondWithStatusCode(_0x3a3b5c,null))[_0x68b5('0x2a')](handleError(_0x3a3b5c,null));};exports[_0x68b5('0x6e')]=function(_0x532928,_0xba39a2,_0x5b09b8){if(_0x532928[_0x68b5('0x5c')]['id']){delete _0x532928[_0x68b5('0x5c')]['id'];}return db[_0x68b5('0x3f')]['find']({'where':{'id':_0x532928[_0x68b5('0x58')]['id']}})['then'](handleEntityNotFound(_0xba39a2,null))[_0x68b5('0x21')](function(_0x33c62e){if(_0x33c62e){_0x532928[_0x68b5('0x5c')]['WhatsappAccountId']=_0x33c62e['id'];return db[_0x68b5('0x6f')][_0x68b5('0x5b')](_0x532928[_0x68b5('0x5c')]);}})[_0x68b5('0x21')](respondWithResult(_0xba39a2,null))[_0x68b5('0x2a')](handleError(_0xba39a2,null));};exports[_0x68b5('0x70')]=function(_0x566ed4,_0x2a3d17,_0x1668a0){var _0x194561={'raw':![],'where':{}};var _0x32272b={};var _0x2bc2df={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x566ed4['params']['id']}})['then'](handleEntityNotFound(_0x2a3d17,null))['then'](function(_0x5602f4){if(_0x5602f4){_0x32272b[_0x68b5('0x42')]=_[_0x68b5('0x43')](db[_0x68b5('0x6f')]['rawAttributes']);_0x32272b['query']=_[_0x68b5('0x43')](_0x566ed4[_0x68b5('0x44')]);_0x32272b['filters']=_[_0x68b5('0x46')](_0x32272b[_0x68b5('0x42')],_0x32272b[_0x68b5('0x44')]);_0x194561[_0x68b5('0x45')]=_['intersection'](_0x32272b['model'],qs[_0x68b5('0x47')](_0x566ed4[_0x68b5('0x44')][_0x68b5('0x47')]));_0x194561[_0x68b5('0x45')]=_0x194561[_0x68b5('0x45')]['length']?_0x194561['attributes']:_0x32272b[_0x68b5('0x42')];if(!_0x566ed4['query']['hasOwnProperty'](_0x68b5('0x49'))){_0x194561[_0x68b5('0x31')]=qs['limit'](_0x566ed4[_0x68b5('0x44')][_0x68b5('0x31')]);_0x194561['offset']=qs['offset'](_0x566ed4[_0x68b5('0x44')]['offset']);}_0x194561[_0x68b5('0x4a')]=qs[_0x68b5('0x4b')](_0x566ed4[_0x68b5('0x44')][_0x68b5('0x4b')]);_0x194561[_0x68b5('0x4c')]=qs['filters'](_[_0x68b5('0x4e')](_0x566ed4[_0x68b5('0x44')],_0x32272b[_0x68b5('0x4d')]));_0x194561[_0x68b5('0x4c')]['WhatsappAccountId']=_0x5602f4['id'];if(_0x566ed4[_0x68b5('0x44')][_0x68b5('0x4f')]){_0x194561[_0x68b5('0x4c')]=_[_0x68b5('0x52')](_0x194561[_0x68b5('0x4c')],{'$or':_[_0x68b5('0x3e')](_0x194561[_0x68b5('0x45')],function(_0x189b8d){var _0xc92961={};_0xc92961[_0x189b8d]={'$like':'%'+_0x566ed4[_0x68b5('0x44')][_0x68b5('0x4f')]+'%'};return _0xc92961;})});}_0x194561=_[_0x68b5('0x52')]({},_0x194561,_0x566ed4[_0x68b5('0x5a')]);return db[_0x68b5('0x6f')][_0x68b5('0x32')]({'where':_0x194561['where']})[_0x68b5('0x21')](function(_0x5c93a8){_0x2bc2df[_0x68b5('0x32')]=_0x5c93a8;if(_0x566ed4['query'][_0x68b5('0x53')]){_0x194561[_0x68b5('0x54')]=[{'all':!![]}];}return db[_0x68b5('0x6f')][_0x68b5('0x55')](_0x194561);})[_0x68b5('0x21')](function(_0x493a8c){_0x2bc2df[_0x68b5('0x56')]=_0x493a8c;return _0x2bc2df;});}})[_0x68b5('0x21')](respondWithFilteredResult(_0x2a3d17,_0x194561))[_0x68b5('0x2a')](handleError(_0x2a3d17,null));};exports[_0x68b5('0x71')]=function(_0x50d9c1,_0x592155,_0x47f5be){return db[_0x68b5('0x3f')]['find']({'where':{'id':_0x50d9c1['params']['id']}})[_0x68b5('0x21')](handleEntityNotFound(_0x592155,null))[_0x68b5('0x21')](function(_0x3b7369){if(_0x3b7369){return _0x3b7369[_0x68b5('0x71')](_0x50d9c1[_0x68b5('0x44')][_0x68b5('0x6d')]);}})[_0x68b5('0x21')](respondWithStatusCode(_0x592155,null))['catch'](handleError(_0x592155,null));};exports[_0x68b5('0x72')]=function(_0x526afe,_0x4d4677,_0x382b34){return db[_0x68b5('0x3f')][_0x68b5('0x61')]({'where':{'id':_0x526afe[_0x68b5('0x58')]['id']}})[_0x68b5('0x21')](handleEntityNotFound(_0x4d4677,null))[_0x68b5('0x21')](function(_0x4b2e61){if(_0x4b2e61){return _0x4b2e61['addAgents'](_0x526afe[_0x68b5('0x5c')]['ids'],_[_0x68b5('0x73')](_0x526afe['body'],[_0x68b5('0x6d'),'id'])||{})[_0x68b5('0x74')](function(_0x431976){for(var _0x1f6166=0x0;_0x1f6166<_0x526afe['body'][_0x68b5('0x6d')][_0x68b5('0x48')];_0x1f6166+=0x1){socket[_0x68b5('0x75')](_0x68b5('0x76'),{'UserId':_0x526afe[_0x68b5('0x5c')]['ids'][_0x1f6166],'WhatsappAccountId':_0x526afe[_0x68b5('0x58')]['id']});}return _0x431976;});}})[_0x68b5('0x21')](respondWithResult(_0x4d4677,null))[_0x68b5('0x2a')](handleError(_0x4d4677,null));};exports[_0x68b5('0x77')]=function(_0x56bab4,_0x48afcd,_0x5495d9){return db[_0x68b5('0x3f')][_0x68b5('0x61')]({'where':{'id':_0x56bab4[_0x68b5('0x58')]['id']}})[_0x68b5('0x21')](handleEntityNotFound(_0x48afcd,null))[_0x68b5('0x21')](function(_0x3ddfee){if(_0x3ddfee){return _0x3ddfee[_0x68b5('0x77')](_0x56bab4[_0x68b5('0x44')][_0x68b5('0x6d')])['then'](function(){if(_[_0x68b5('0x78')](_0x56bab4['query']['ids'])){for(var _0x40a510=0x0;_0x40a510<_0x56bab4[_0x68b5('0x44')][_0x68b5('0x6d')][_0x68b5('0x48')];_0x40a510+=0x1){socket[_0x68b5('0x75')](_0x68b5('0x79'),{'UserId':Number(_0x56bab4[_0x68b5('0x44')][_0x68b5('0x6d')][_0x40a510]),'WhatsappAccountId':Number(_0x56bab4[_0x68b5('0x58')]['id'])});}}else{socket['emit'](_0x68b5('0x79'),{'UserId':Number(_0x56bab4[_0x68b5('0x44')][_0x68b5('0x6d')]),'WhatsappAccountId':Number(_0x56bab4['params']['id'])});}});}})[_0x68b5('0x21')](respondWithStatusCode(_0x48afcd,null))['catch'](handleError(_0x48afcd,null));};exports[_0x68b5('0x7a')]=function(_0x182594,_0xcf7e1,_0xca7f9e){var _0x53b4de={};var _0x26429b={};var _0x148f53;var _0xea5907;return db[_0x68b5('0x3f')][_0x68b5('0x7b')]({'where':{'id':_0x182594['params']['id']}})[_0x68b5('0x21')](handleEntityNotFound(_0xcf7e1,null))[_0x68b5('0x21')](function(_0x5c951e){if(_0x5c951e){_0x148f53=_0x5c951e;_0x26429b[_0x68b5('0x42')]=_['keys'](db[_0x68b5('0x7c')][_0x68b5('0x40')]);_0x26429b[_0x68b5('0x44')]=_['keys'](_0x182594[_0x68b5('0x44')]);_0x26429b[_0x68b5('0x4d')]=_[_0x68b5('0x46')](_0x26429b[_0x68b5('0x42')],_0x26429b[_0x68b5('0x44')]);_0x53b4de[_0x68b5('0x45')]=_[_0x68b5('0x46')](_0x26429b[_0x68b5('0x42')],qs['fields'](_0x182594[_0x68b5('0x44')][_0x68b5('0x47')]));_0x53b4de['attributes']=_0x53b4de[_0x68b5('0x45')]['length']?_0x53b4de[_0x68b5('0x45')]:_0x26429b[_0x68b5('0x42')];_0x53b4de[_0x68b5('0x4a')]=qs[_0x68b5('0x4b')](_0x182594['query'][_0x68b5('0x4b')]);_0x53b4de[_0x68b5('0x4c')]=qs[_0x68b5('0x4d')](_[_0x68b5('0x4e')](_0x182594[_0x68b5('0x44')],_0x26429b['filters']));if(_0x182594[_0x68b5('0x44')][_0x68b5('0x4f')]){_0x53b4de[_0x68b5('0x4c')]=_['merge'](_0x53b4de[_0x68b5('0x4c')],{'$or':_[_0x68b5('0x3e')](_0x53b4de[_0x68b5('0x45')],function(_0x3ede6f){var _0x118268={};_0x118268[_0x3ede6f]={'$like':'%'+_0x182594[_0x68b5('0x44')]['filter']+'%'};return _0x118268;})});}_0x53b4de=_['merge']({},_0x53b4de,_0x182594[_0x68b5('0x5a')]);return _0x148f53[_0x68b5('0x7a')](_0x53b4de);}})[_0x68b5('0x21')](function(_0x28a487){if(_0x28a487){_0xea5907=_0x28a487[_0x68b5('0x48')];if(!_0x182594[_0x68b5('0x44')][_0x68b5('0x6b')](_0x68b5('0x49'))){_0x53b4de[_0x68b5('0x31')]=qs[_0x68b5('0x31')](_0x182594[_0x68b5('0x44')][_0x68b5('0x31')]);_0x53b4de[_0x68b5('0x2f')]=qs[_0x68b5('0x2f')](_0x182594[_0x68b5('0x44')][_0x68b5('0x2f')]);}return _0x148f53[_0x68b5('0x7a')](_0x53b4de);}})[_0x68b5('0x21')](function(_0x11d3a4){if(_0x11d3a4){return _0x11d3a4?{'count':_0xea5907,'rows':_0x11d3a4}:null;}})[_0x68b5('0x21')](respondWithResult(_0xcf7e1,null))[_0x68b5('0x2a')](handleError(_0xcf7e1,null));};exports[_0x68b5('0x7d')]=function(_0x492baa,_0x238fb4,_0x2af736){return db[_0x68b5('0x3f')][_0x68b5('0x7b')]({'where':{'id':_0x492baa['params']['id']}})['then'](handleEntityNotFound(_0x238fb4,null))[_0x68b5('0x21')](function(_0x3b0571){if(_0x3b0571){return db['sequelize'][_0x68b5('0x7e')](function(_0x464268){return db[_0x68b5('0x7f')][_0x68b5('0x37')]({'where':{'WhatsappAccountId':_0x492baa[_0x68b5('0x58')]['id']},'transaction':_0x464268})['then'](function(_0x1bbe74){var _0x3d0a71=_[_0x68b5('0x3e')](_0x492baa[_0x68b5('0x5c')],function(_0x53afcd){_0x53afcd[_0x68b5('0x68')]=_0x492baa[_0x68b5('0x58')]['id'];return _0x53afcd;});return db[_0x68b5('0x7f')]['bulkCreate'](_0x3d0a71,{'transaction':_0x464268});});})[_0x68b5('0x21')](function(){return db[_0x68b5('0x7f')][_0x68b5('0x80')]({'where':{'WhatsappAccountId':_0x492baa['params']['id']},'order':_0x68b5('0x81')});});}})['then'](respondWithResult(_0x238fb4,null))[_0x68b5('0x2a')](handleError(_0x238fb4,null));};exports[_0x68b5('0x82')]=function(_0x3e46f4,_0x17c597,_0x17649a){var _0x53c846={};var _0x166ae5={};var _0x375753;var _0x58ea6b;return db[_0x68b5('0x3f')][_0x68b5('0x7b')]({'where':{'id':_0x3e46f4[_0x68b5('0x58')]['id']}})[_0x68b5('0x21')](handleEntityNotFound(_0x17c597,null))[_0x68b5('0x21')](function(_0x471b06){if(_0x471b06){_0x375753=_0x471b06;_0x166ae5[_0x68b5('0x42')]=_[_0x68b5('0x43')](db[_0x68b5('0x7f')][_0x68b5('0x40')]);_0x166ae5[_0x68b5('0x44')]=_[_0x68b5('0x43')](_0x3e46f4[_0x68b5('0x44')]);_0x166ae5['filters']=_[_0x68b5('0x46')](_0x166ae5[_0x68b5('0x42')],_0x166ae5[_0x68b5('0x44')]);_0x53c846[_0x68b5('0x45')]=_['intersection'](_0x166ae5[_0x68b5('0x42')],qs[_0x68b5('0x47')](_0x3e46f4[_0x68b5('0x44')]['fields']));_0x53c846[_0x68b5('0x45')]=_0x53c846['attributes'][_0x68b5('0x48')]?_0x53c846['attributes']:_0x166ae5['model'];_0x53c846['order']=qs[_0x68b5('0x4b')](_0x3e46f4[_0x68b5('0x44')][_0x68b5('0x4b')]);_0x53c846[_0x68b5('0x4c')]=qs['filters'](_[_0x68b5('0x4e')](_0x3e46f4[_0x68b5('0x44')],_0x166ae5[_0x68b5('0x4d')]));if(_0x3e46f4['query']['filter']){_0x53c846[_0x68b5('0x4c')]=_['merge'](_0x53c846[_0x68b5('0x4c')],{'$or':_[_0x68b5('0x3e')](_0x53c846[_0x68b5('0x45')],function(_0x5c25f6){var _0x59351a={};_0x59351a[_0x5c25f6]={'$like':'%'+_0x3e46f4['query']['filter']+'%'};return _0x59351a;})});}_0x53c846=_[_0x68b5('0x52')]({},_0x53c846,_0x3e46f4['options']);return _0x375753[_0x68b5('0x82')](_0x53c846);}})[_0x68b5('0x21')](function(_0x3d973a){if(_0x3d973a){_0x58ea6b=_0x3d973a[_0x68b5('0x48')];if(!_0x3e46f4[_0x68b5('0x44')][_0x68b5('0x6b')](_0x68b5('0x49'))){_0x53c846[_0x68b5('0x31')]=qs[_0x68b5('0x31')](_0x3e46f4[_0x68b5('0x44')][_0x68b5('0x31')]);_0x53c846[_0x68b5('0x2f')]=qs[_0x68b5('0x2f')](_0x3e46f4[_0x68b5('0x44')]['offset']);}return _0x375753[_0x68b5('0x82')](_0x53c846);}})[_0x68b5('0x21')](function(_0x3471de){if(_0x3471de){return _0x3471de?{'count':_0x58ea6b,'rows':_0x3471de}:null;}})[_0x68b5('0x21')](respondWithResult(_0x17c597,null))['catch'](handleError(_0x17c597,null));};exports[_0x68b5('0x83')]=function(_0x2d3d65,_0x3bba88,_0x528be9){var _0x15df6a={'channel':'whatsapp'};var _0x9bf17c=[];var _0x394d75=[];var _0x2184ef={};return db[_0x68b5('0x3f')][_0x68b5('0x61')]({'where':{'id':_0x2d3d65[_0x68b5('0x58')]['id']},'include':[{'model':db[_0x68b5('0x7f')],'as':_0x68b5('0x84')}]})[_0x68b5('0x21')](handleEntityNotFound(_0x3bba88,null))[_0x68b5('0x21')](function(_0x1cba8e){_0x15df6a[_0x68b5('0x85')]=_0x1cba8e;_0x15df6a[_0x68b5('0x86')]=_[_0x68b5('0x87')](_0x1cba8e[_0x68b5('0x84')],['priority'],[_0x68b5('0x88')]);if(_0x15df6a[_0x68b5('0x85')][_0x68b5('0x84')]){delete _0x15df6a['account']['Applications'];}return db[_0x68b5('0x89')]['describe']();})['then'](function(_0x23567a){if(!_0x23567a){throw new db[(_0x68b5('0x8a'))][(_0x68b5('0x8b'))](_0x68b5('0x8c'));}_0x9bf17c=_['difference'](_['keys'](_0x23567a),[_0x68b5('0x8d'),_0x68b5('0x8e')]);_0x394d75=_[_0x68b5('0x8f')](_[_0x68b5('0x43')](_0x23567a),['createdAt','updatedAt',_0x68b5('0x90'),_0x68b5('0x91')]);_0x15df6a[_0x68b5('0x5c')]={'mapKey':_0x68b5('0x92')};if(_0x15df6a[_0x68b5('0x85')]['type']&&_0x15df6a[_0x68b5('0x85')][_0x68b5('0x50')]===_0x68b5('0x93')){_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x94')]=_0x2d3d65[_0x68b5('0x5c')][_0x68b5('0x95')][_0x68b5('0x96')](_0x68b5('0x97'),'');_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x5c')]=_0x2d3d65[_0x68b5('0x5c')][_0x68b5('0x98')];_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x99')]=_0x2d3d65[_0x68b5('0x5c')][_0x68b5('0x9a')];}if(_0x15df6a[_0x68b5('0x5c')]['id']){delete _0x15df6a[_0x68b5('0x5c')]['id'];}if(_[_0x68b5('0x9b')](_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x94')])){throw new db['Sequelize'][(_0x68b5('0x8b'))](_0x68b5('0x9c'));}if(_['isNil'](_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x5c')])||_0x15df6a[_0x68b5('0x5c')]['body']===''){throw new db[(_0x68b5('0x8a'))]['ValidationError'](_0x68b5('0x9d'));}if(_['isNil'](_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x9e')])){throw new db[(_0x68b5('0x8a'))][(_0x68b5('0x8b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x394d75);}if(!_[_0x68b5('0x9f')](_0x394d75,_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x9e')])){throw new db[(_0x68b5('0x8a'))][(_0x68b5('0x8b'))](_0x68b5('0xa0')+_0x394d75);}_0x2184ef[_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x9e')]]=_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x94')];return db['CmList'][_0x68b5('0x61')]({'where':{'id':_0x15df6a[_0x68b5('0x85')][_0x68b5('0x91')]},'include':[{'model':db['CmContact'],'as':_0x68b5('0xa1'),'where':_0x2184ef,'limit':0x1,'order':[['updatedAt',_0x68b5('0xa2')]]}]});})[_0x68b5('0x21')](handleEntityNotFound(_0x3bba88,null))['then'](function(_0x1c140e){if(_0x1c140e){_0x15df6a[_0x68b5('0xa3')]=_['omit'](_0x1c140e,[_0x68b5('0xa1')]);if(_0x1c140e[_0x68b5('0xa1')][_0x68b5('0x48')]){return _0x1c140e[_0x68b5('0xa1')][0x0];}var _0x55ee28=_[_0x68b5('0x1a')](_0x15df6a[_0x68b5('0x5c')],{'firstName':_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x94')],'ListId':_0x1c140e['id']});_0x55ee28[_0x15df6a[_0x68b5('0x5c')]['mapKey']]=_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x94')];return db[_0x68b5('0x89')][_0x68b5('0x5b')](_0x55ee28,{'fields':_0x9bf17c,'raw':!![]});}})['then'](handleEntityNotFound(_0x3bba88,null))[_0x68b5('0x21')](function(_0x5e16d9){if(_0x5e16d9){_0x15df6a['contact']=_0x5e16d9;var _0x1fb8c0={'ContactId':_0x5e16d9['id'],'phone':_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x94')],'WhatsappAccountId':_0x2d3d65[_0x68b5('0x58')]['id']};var _0x26764e={'ContactId':_0x5e16d9['id'],'WhatsappAccountId':_0x2d3d65[_0x68b5('0x58')]['id'],'closed':![]};return db[_0x68b5('0xa4')][_0x68b5('0x61')]({'where':_0x26764e})[_0x68b5('0x21')](function(_0x5dbf95){if(_0x5dbf95){return[_0x5dbf95,![]];}return db[_0x68b5('0xa4')][_0x68b5('0x5b')](_0x1fb8c0)[_0x68b5('0x21')](function(_0x311c6f){return[_0x311c6f,!![]];});});}})[_0x68b5('0x74')](function(_0x21ab2a,_0x4fa4d1){_0x15df6a[_0x68b5('0xa5')]=_0x21ab2a[_0x68b5('0x38')]({'plain':!![]});_0x15df6a[_0x68b5('0xa5')][_0x68b5('0xa6')]=![];if(_0x4fa4d1){if(_0x15df6a['account'][_0x68b5('0xa7')]){_0x15df6a['applications'][_0x68b5('0xa8')]({'id':0x0,'priority':_0x15df6a[_0x68b5('0x86')][_0x68b5('0x48')]+0x1,'app':'close','appdata':_0x68b5('0xa9'),'interval':_0x68b5('0xaa')});}_0x15df6a[_0x68b5('0xa5')][_0x68b5('0xa6')]=!![];}return db['WhatsappMessage'][_0x68b5('0x5b')]({'phone':_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x94')],'messageId':_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x99')],'body':_0x15df6a[_0x68b5('0x5c')][_0x68b5('0x5c')],'WhatsappAccountId':_0x2d3d65['params']['id'],'WhatsappInteractionId':_0x21ab2a['id'],'direction':'in','ContactId':_0x21ab2a['ContactId'],'AttachmentId':_0x15df6a[_0x68b5('0x5c')]['AttachmentId']});})[_0x68b5('0x21')](function(_0x237262){_0x15df6a[_0x68b5('0x29')]=_0x237262;if(_0x15df6a[_0x68b5('0xa5')][_0x68b5('0xab')]){return db[_0x68b5('0x7c')][_0x68b5('0x61')]({'attributes':['id','name'],'where':{'id':_0x15df6a['interaction'][_0x68b5('0xab')]}})[_0x68b5('0x21')](function(_0x51647a){if(_0x51647a){_0x15df6a[_0x68b5('0x86')][_0x68b5('0xac')]({'id':0x0,'priority':0x0,'app':_0x68b5('0xad'),'appdata':_0x51647a[_0x68b5('0x3b')]+','+(_0x15df6a[_0x68b5('0x85')][_0x68b5('0xae')]||0xa),'interval':_0x68b5('0xaa')});}return respondWithRpcPromise('Start',_0x68b5('0xaf'),_0x15df6a);});}return respondWithRpcPromise('Start','startRouting',_0x15df6a);})['then'](function(_0x230970){if(_0x230970){var _0x583fec=0xc8;var _0x198ec3=_0x68b5('0xb0');logger['info'](_0x68b5('0x26'),_0x198ec3,_0x583fec,_0x68b5('0xb1'));logger[_0x68b5('0x25')](_0x68b5('0xb2'),_0x198ec3,_0x583fec,'entity\x20found',JSON[_0x68b5('0x27')](_0x230970));if(_0x15df6a[_0x68b5('0x85')][_0x68b5('0x50')]===_0x68b5('0x93')){return _0x3bba88[_0x68b5('0x2c')](_0x583fec)['set'](_0x68b5('0xb3'),_0x68b5('0xb4'))[_0x68b5('0xb5')](_0x68b5('0xb6'));}else{return _0x3bba88['status'](_0x583fec)[_0x68b5('0x2e')](_0x230970);}}})[_0x68b5('0x2a')](handleError(_0x3bba88,null));};exports[_0x68b5('0xb5')]=function(_0x38c954,_0x406ab5,_0x2aba07){var _0x2b0dfc,_0x451854,_0x382414;if(_[_0x68b5('0x9b')](_0x38c954['body']['body'])||_0x38c954['body']['body']===''){throw new db[(_0x68b5('0x8a'))][(_0x68b5('0x8b'))](_0x68b5('0x9d'));}if(_[_0x68b5('0x9b')](_0x38c954['body']['to'])){throw new db[(_0x68b5('0x8a'))][(_0x68b5('0x8b'))](_0x68b5('0xb7'));}_0x2b0dfc=_0x38c954['body']['to'];return db[_0x68b5('0x3f')][_0x68b5('0x61')]({'where':{'id':_0x38c954[_0x68b5('0x58')]['id']},'include':[{'model':db[_0x68b5('0xb8')],'as':_0x68b5('0xb9'),'include':[{'model':db[_0x68b5('0x89')],'as':'Contacts','where':{'mobile':_0x2b0dfc},'limit':0x1,'order':[['updatedAt',_0x68b5('0xa2')]]}]}]})[_0x68b5('0x21')](handleEntityNotFound(_0x406ab5,null))[_0x68b5('0x21')](function(_0x35f931){if(_0x35f931&&_0x35f931[_0x68b5('0xb9')]){_0x451854=_0x35f931['get']({'plain':!![]});if(_0x451854[_0x68b5('0xb9')]&&_0x451854['List'][_0x68b5('0xa1')][_0x68b5('0x48')]){return _0x451854[_0x68b5('0xb9')][_0x68b5('0xa1')][0x0];}return db[_0x68b5('0x89')][_0x68b5('0x5b')](_[_0x68b5('0x1a')](_0x38c954['body'],{'firstName':_0x2b0dfc,'mobile':_0x2b0dfc,'phone':_0x2b0dfc,'ListId':_0x451854[_0x68b5('0x91')]}));}})[_0x68b5('0x21')](handleEntityNotFound(_0x406ab5,null))['then'](function(_0x497d3d){if(_0x497d3d){_0x382414=_0x497d3d;return db['WhatsappInteraction'][_0x68b5('0x61')]({'where':{'ContactId':_0x382414['id'],'closed':![],'WhatsappAccountId':_0x451854['id']}})[_0x68b5('0x21')](function(_0x5a60f4){if(_0x5a60f4){return[_0x5a60f4,![]];}return db[_0x68b5('0xa4')][_0x68b5('0x5b')]({'UserId':_0x38c954[_0x68b5('0x5d')]['id'],'ContactId':_0x382414['id'],'WhatsappAccountId':_0x451854['id'],'phone':_0x2b0dfc,'firstMsgDirection':_0x68b5('0xba'),'Messages':[_[_0x68b5('0x52')](_0x38c954[_0x68b5('0x5c')],{'read':![],'body':_0x38c954[_0x68b5('0x5c')]['body'],'phone':_0x2b0dfc,'WhatsappAccountId':_0x451854['id'],'UserId':_0x38c954[_0x68b5('0x5d')]['id'],'ContactId':_0x382414['id']})]},{'include':[{'model':db[_0x68b5('0xbb')],'as':_0x68b5('0xbc')}]})[_0x68b5('0x21')](function(_0x16e370){return[_0x16e370,!![]];});});}})[_0x68b5('0x74')](function(_0x580c92,_0x3bab38){if(_0x3bab38){return _0x580c92;}return db[_0x68b5('0xbb')][_0x68b5('0x5b')](_[_0x68b5('0x52')](_0x38c954[_0x68b5('0x5c')],{'read':![],'body':_0x38c954[_0x68b5('0x5c')][_0x68b5('0x5c')],'phone':_0x2b0dfc,'WhatsappAccountId':_0x451854['id'],'WhatsappInteractionId':_0x580c92['id'],'UserId':_0x38c954['user']['id'],'ContactId':_0x382414['id']}))[_0x68b5('0x21')](function(_0x2755c7){_0x580c92[_0x68b5('0xbd')][_0x68b5('0xbc')]=[];_0x580c92[_0x68b5('0xbd')][_0x68b5('0xbc')][_0x68b5('0xa8')](_0x2755c7[_0x68b5('0xbd')]);return _0x580c92;});})[_0x68b5('0x21')](respondWithResult(_0x406ab5,null))['catch'](handleError(_0x406ab5,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index e268d3c..5c18918 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 _0xa498=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa498,0x1d6));var _0x8a49=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xa498[_0x43f881];return _0x365c14;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x8a49('0x0'))['db'][_0x8a49('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8a49('0x2'),'afterDestroy':_0x8a49('0x3')};function emitEvent(_0x1d4dd2){return function(_0x65eb15,_0x2f362e,_0x5aaf52){WhatsappAccountEvents[_0x8a49('0x4')](_0x1d4dd2+':'+_0x65eb15['id'],_0x65eb15);WhatsappAccountEvents['emit'](_0x1d4dd2,_0x65eb15);_0x5aaf52(null);};}for(var e in events){if(events[_0x8a49('0x5')](e)){var event=events[e];WhatsappAccount[_0x8a49('0x6')](e,emitEvent(event));}}module[_0x8a49('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xaf1b=['hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit'];(function(_0x2e4977,_0x214199){var _0x301ce2=function(_0x5c761d){while(--_0x5c761d){_0x2e4977['push'](_0x2e4977['shift']());}};_0x301ce2(++_0x214199);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x3837dc,_0x192393){_0x3837dc=_0x3837dc-0x0;var _0x285111=_0xaf1b[_0x3837dc];return _0x285111;};'use strict';var EventEmitter=require(_0xbaf1('0x0'));var WhatsappAccount=require(_0xbaf1('0x1'))['db'][_0xbaf1('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xbaf1('0x3')](0x0);var events={'afterCreate':_0xbaf1('0x4'),'afterUpdate':_0xbaf1('0x5'),'afterDestroy':_0xbaf1('0x6')};function emitEvent(_0xdf4a1b){return function(_0x461ffb,_0x3fe8f0,_0x156a67){WhatsappAccountEvents[_0xbaf1('0x7')](_0xdf4a1b+':'+_0x461ffb['id'],_0x461ffb);WhatsappAccountEvents[_0xbaf1('0x7')](_0xdf4a1b,_0x461ffb);_0x156a67(null);};}for(var e in events){if(events[_0xbaf1('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xbaf1('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a0330ca..7bb492d 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 _0x5dbc=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','../../config/logger','api'];(function(_0x589a3d,_0x96da1a){var _0x148699=function(_0x5e239c){while(--_0x5e239c){_0x589a3d['push'](_0x589a3d['shift']());}};_0x148699(++_0x96da1a);}(_0x5dbc,0x1a0));var _0xc5db=function(_0xc1bb96,_0x4917ac){_0xc1bb96=_0xc1bb96-0x0;var _0x56a8ba=_0x5dbc[_0xc1bb96];return _0x56a8ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc5db('0x0'))(_0xc5db('0x1'));var moment=require('moment');var BPromise=require(_0xc5db('0x2'));var rp=require(_0xc5db('0x3'));var fs=require('fs');var path=require(_0xc5db('0x4'));var rimraf=require(_0xc5db('0x5'));var config=require(_0xc5db('0x6'));var attributes=require(_0xc5db('0x7'));module['exports']=function(_0x19af5d,_0x1cc885){return _0x19af5d[_0xc5db('0x8')](_0xc5db('0x9'),attributes,{'tableName':_0xc5db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1b2=['path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','bluebird','request-promise'];(function(_0x459c2b,_0x44b2d9){var _0x26bc62=function(_0xf8c480){while(--_0xf8c480){_0x459c2b['push'](_0x459c2b['shift']());}};_0x26bc62(++_0x44b2d9);}(_0xb1b2,0x1f3));var _0x2b1b=function(_0x1eba8d,_0x5d4160){_0x1eba8d=_0x1eba8d-0x0;var _0x5dfc75=_0xb1b2[_0x1eba8d];return _0x5dfc75;};'use strict';var _=require('lodash');var util=require(_0x2b1b('0x0'));var logger=require(_0x2b1b('0x1'))(_0x2b1b('0x2'));var moment=require('moment');var BPromise=require(_0x2b1b('0x3'));var rp=require(_0x2b1b('0x4'));var fs=require('fs');var path=require(_0x2b1b('0x5'));var rimraf=require(_0x2b1b('0x6'));var config=require('../../config/environment');var attributes=require(_0x2b1b('0x7'));module[_0x2b1b('0x8')]=function(_0x324cb6,_0x55c10a){return _0x324cb6[_0x2b1b('0x9')](_0x2b1b('0xa'),attributes,{'tableName':_0x2b1b('0xb'),'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 8934287..0fbb224 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 _0x3e57=['WhatsappAccount','find','options','raw','where','attributes','include','map','model','debug','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','WhatsappAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','ShowWhatsappAccount'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x3e57,0x1d1));var _0x73e5=function(_0x2a6d45,_0x3c9321){_0x2a6d45=_0x2a6d45-0x0;var _0x295253=_0x3e57[_0x2a6d45];return _0x295253;};'use strict';var _=require(_0x73e5('0x0'));var util=require(_0x73e5('0x1'));var moment=require('moment');var BPromise=require(_0x73e5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73e5('0x3'))['db'];var utils=require(_0x73e5('0x4'));var logger=require(_0x73e5('0x5'))('rpc');var config=require(_0x73e5('0x6'));var jayson=require(_0x73e5('0x7'));var client=jayson[_0x73e5('0x8')][_0x73e5('0x9')]({'port':0x232a});config[_0x73e5('0xa')]=_[_0x73e5('0xb')](config[_0x73e5('0xa')],{'host':_0x73e5('0xc'),'port':0x18eb});var socket=require(_0x73e5('0xd'))(new Redis(config[_0x73e5('0xa')]));require('./whatsappAccount.socket')[_0x73e5('0xe')](socket);function respondWithRpcPromise(_0x48c07b,_0x38e8bc,_0x57d926){return new BPromise(function(_0x40a69d,_0x58389a){return client[_0x73e5('0xf')](_0x48c07b,_0x57d926)['then'](function(_0x55686a){logger['info'](_0x73e5('0x10'),_0x38e8bc,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x38e8bc,'request\x20sent',JSON[_0x73e5('0x11')](_0x55686a));if(_0x55686a[_0x73e5('0x12')]){if(_0x55686a[_0x73e5('0x12')][_0x73e5('0x13')]===0x1f4){logger['error'](_0x73e5('0x10'),_0x38e8bc,_0x55686a[_0x73e5('0x12')]['message']);return _0x58389a(_0x55686a[_0x73e5('0x12')]['message']);}logger[_0x73e5('0x12')](_0x73e5('0x10'),_0x38e8bc,_0x55686a[_0x73e5('0x12')][_0x73e5('0x14')]);return _0x40a69d(_0x55686a[_0x73e5('0x12')]['message']);}else{logger['info'](_0x73e5('0x10'),_0x38e8bc,_0x73e5('0x15'));_0x40a69d(_0x55686a[_0x73e5('0x16')][_0x73e5('0x14')]);}})[_0x73e5('0x17')](function(_0x476b79){logger[_0x73e5('0x12')](_0x73e5('0x10'),_0x38e8bc,_0x476b79);_0x58389a(_0x476b79);});});}exports[_0x73e5('0x18')]=function(_0xc98317){var _0x4db8e3=this;return new Promise(function(_0x44b2ba,_0x26ee4e){return db[_0x73e5('0x19')][_0x73e5('0x1a')]({'raw':_0xc98317[_0x73e5('0x1b')]?_0xc98317[_0x73e5('0x1b')][_0x73e5('0x1c')]===undefined?!![]:![]:!![],'where':_0xc98317[_0x73e5('0x1b')]?_0xc98317[_0x73e5('0x1b')][_0x73e5('0x1d')]||null:null,'attributes':_0xc98317[_0x73e5('0x1b')]?_0xc98317[_0x73e5('0x1b')][_0x73e5('0x1e')]||null:null,'include':_0xc98317[_0x73e5('0x1b')]?_0xc98317[_0x73e5('0x1b')][_0x73e5('0x1f')]?_[_0x73e5('0x20')](_0xc98317[_0x73e5('0x1b')][_0x73e5('0x1f')],function(_0x98ff45){return{'model':db[_0x98ff45['model']],'as':_0x98ff45['as'],'attributes':_0x98ff45['attributes'],'include':_0x98ff45[_0x73e5('0x1f')]?_['map'](_0x98ff45[_0x73e5('0x1f')],function(_0x43b502){return{'model':db[_0x43b502[_0x73e5('0x21')]],'as':_0x43b502['as'],'attributes':_0x43b502['attributes'],'include':_0x43b502['include']?_['map'](_0x43b502['include'],function(_0x2be8e8){return{'model':db[_0x2be8e8[_0x73e5('0x21')]],'as':_0x2be8e8['as'],'attributes':_0x2be8e8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x311eca){logger['info'](_0x73e5('0x18'),_0xc98317);logger[_0x73e5('0x22')]('ShowWhatsappAccount',_0xc98317,JSON[_0x73e5('0x11')](_0x311eca));_0x44b2ba(_0x311eca);})[_0x73e5('0x17')](function(_0x1e081d){logger[_0x73e5('0x12')](_0x73e5('0x18'),_0x1e081d['message'],_0xc98317);_0x26ee4e(_0x4db8e3[_0x73e5('0x12')](0x1f4,_0x1e081d[_0x73e5('0x14')]));});});}; \ No newline at end of file +var _0xd679=['stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','raw','options','attributes','include','model','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x278d3b,_0x1f29a9){var _0x465d08=function(_0x1fb678){while(--_0x1fb678){_0x278d3b['push'](_0x278d3b['shift']());}};_0x465d08(++_0x1f29a9);}(_0xd679,0xcc));var _0x9d67=function(_0x1b57b2,_0x4dffaf){_0x1b57b2=_0x1b57b2-0x0;var _0x27b62f=_0xd679[_0x1b57b2];return _0x27b62f;};'use strict';var _=require('lodash');var util=require(_0x9d67('0x0'));var moment=require(_0x9d67('0x1'));var BPromise=require(_0x9d67('0x2'));var rs=require(_0x9d67('0x3'));var fs=require('fs');var Redis=require(_0x9d67('0x4'));var db=require(_0x9d67('0x5'))['db'];var utils=require(_0x9d67('0x6'));var logger=require(_0x9d67('0x7'))(_0x9d67('0x8'));var config=require(_0x9d67('0x9'));var jayson=require(_0x9d67('0xa'));var client=jayson['client'][_0x9d67('0xb')]({'port':0x232a});config['redis']=_[_0x9d67('0xc')](config[_0x9d67('0xd')],{'host':_0x9d67('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d67('0xd')]));require(_0x9d67('0xf'))[_0x9d67('0x10')](socket);function respondWithRpcPromise(_0x25609f,_0x4d79f8,_0x516dbe){return new BPromise(function(_0x5dfd3b,_0x2b4b2b){return client[_0x9d67('0x11')](_0x25609f,_0x516dbe)[_0x9d67('0x12')](function(_0x336e50){logger[_0x9d67('0x13')](_0x9d67('0x14'),_0x4d79f8,_0x9d67('0x15'));logger[_0x9d67('0x16')](_0x9d67('0x17'),_0x4d79f8,_0x9d67('0x15'),JSON[_0x9d67('0x18')](_0x336e50));if(_0x336e50[_0x9d67('0x19')]){if(_0x336e50['error'][_0x9d67('0x1a')]===0x1f4){logger[_0x9d67('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x4d79f8,_0x336e50[_0x9d67('0x19')][_0x9d67('0x1b')]);return _0x2b4b2b(_0x336e50[_0x9d67('0x19')][_0x9d67('0x1b')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4d79f8,_0x336e50[_0x9d67('0x19')]['message']);return _0x5dfd3b(_0x336e50['error'][_0x9d67('0x1b')]);}else{logger[_0x9d67('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x4d79f8,'request\x20sent');_0x5dfd3b(_0x336e50[_0x9d67('0x1c')][_0x9d67('0x1b')]);}})[_0x9d67('0x1d')](function(_0x5d6102){logger['error'](_0x9d67('0x14'),_0x4d79f8,_0x5d6102);_0x2b4b2b(_0x5d6102);});});}exports[_0x9d67('0x1e')]=function(_0x253be5){var _0x139a05=this;return new Promise(function(_0x3614de,_0x4f469f){return db[_0x9d67('0x1f')]['find']({'raw':_0x253be5['options']?_0x253be5['options'][_0x9d67('0x20')]===undefined?!![]:![]:!![],'where':_0x253be5[_0x9d67('0x21')]?_0x253be5[_0x9d67('0x21')]['where']||null:null,'attributes':_0x253be5[_0x9d67('0x21')]?_0x253be5[_0x9d67('0x21')][_0x9d67('0x22')]||null:null,'include':_0x253be5[_0x9d67('0x21')]?_0x253be5[_0x9d67('0x21')][_0x9d67('0x23')]?_['map'](_0x253be5[_0x9d67('0x21')]['include'],function(_0x2e0921){return{'model':db[_0x2e0921[_0x9d67('0x24')]],'as':_0x2e0921['as'],'attributes':_0x2e0921[_0x9d67('0x22')],'include':_0x2e0921['include']?_[_0x9d67('0x25')](_0x2e0921[_0x9d67('0x23')],function(_0x610dcc){return{'model':db[_0x610dcc[_0x9d67('0x24')]],'as':_0x610dcc['as'],'attributes':_0x610dcc[_0x9d67('0x22')],'include':_0x610dcc['include']?_[_0x9d67('0x25')](_0x610dcc[_0x9d67('0x23')],function(_0x149327){return{'model':db[_0x149327['model']],'as':_0x149327['as'],'attributes':_0x149327[_0x9d67('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9dd29e){logger['info'](_0x9d67('0x1e'),_0x253be5);logger[_0x9d67('0x16')](_0x9d67('0x1e'),_0x253be5,JSON[_0x9d67('0x18')](_0x9dd29e));_0x3614de(_0x9dd29e);})['catch'](function(_0x4824f9){logger[_0x9d67('0x19')](_0x9d67('0x1e'),_0x4824f9[_0x9d67('0x1b')],_0x253be5);_0x4f469f(_0x139a05[_0x9d67('0x19')](0x1f4,_0x4824f9[_0x9d67('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 4049a9d..5ce0122 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 _0x4827=['register','length','whatsappAccount:','./whatsappAccount.events','remove','update','emit'];(function(_0x5d6707,_0xbadf9f){var _0x2cf48a=function(_0x528dfd){while(--_0x528dfd){_0x5d6707['push'](_0x5d6707['shift']());}};_0x2cf48a(++_0xbadf9f);}(_0x4827,0x14c));var _0x7482=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4827[_0x3b380d];return _0x54502b;};'use strict';var WhatsappAccountEvents=require(_0x7482('0x0'));var events=['save',_0x7482('0x1'),_0x7482('0x2')];function createListener(_0xb092eb,_0x3b5cb4){return function(_0x4eb2fb){_0x3b5cb4[_0x7482('0x3')](_0xb092eb,_0x4eb2fb);};}function removeListener(_0x48c8b5,_0xaa72e4){return function(){WhatsappAccountEvents['removeListener'](_0x48c8b5,_0xaa72e4);};}exports[_0x7482('0x4')]=function(_0x45b5d2){for(var _0x5abfd3=0x0,_0x5cb625=events[_0x7482('0x5')];_0x5abfd3<_0x5cb625;_0x5abfd3++){var _0x5ed83b=events[_0x5abfd3];var _0x5a3f6b=createListener(_0x7482('0x6')+_0x5ed83b,_0x45b5d2);WhatsappAccountEvents['on'](_0x5ed83b,_0x5a3f6b);}}; \ No newline at end of file +var _0xa45f=['emit','register','length','whatsappAccount:','./whatsappAccount.events','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa45f,0x90));var _0xfa45=function(_0x4cc7e9,_0x182640){_0x4cc7e9=_0x4cc7e9-0x0;var _0x2fcc18=_0xa45f[_0x4cc7e9];return _0x2fcc18;};'use strict';var WhatsappAccountEvents=require(_0xfa45('0x0'));var events=[_0xfa45('0x1'),'remove',_0xfa45('0x2')];function createListener(_0x2f8f76,_0xd688e9){return function(_0x1a8624){_0xd688e9[_0xfa45('0x3')](_0x2f8f76,_0x1a8624);};}function removeListener(_0x112528,_0x7ccc25){return function(){WhatsappAccountEvents['removeListener'](_0x112528,_0x7ccc25);};}exports[_0xfa45('0x4')]=function(_0x20a8fb){for(var _0x461d4d=0x0,_0x1fcfcf=events[_0xfa45('0x5')];_0x461d4d<_0x1fcfcf;_0x461d4d++){var _0x24bb65=events[_0x461d4d];var _0x4686be=createListener(_0xfa45('0x6')+_0x24bb65,_0x20a8fb);WhatsappAccountEvents['on'](_0x24bb65,_0x4686be);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 73cda89..ee57080 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 _0x500c=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x500c,0x17a));var _0xc500=function(_0x30eee9,_0x156e55){_0x30eee9=_0x30eee9-0x0;var _0x18c1b0=_0x500c[_0x30eee9];return _0x18c1b0;};'use strict';var multer=require(_0xc500('0x0'));var util=require(_0xc500('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc500('0x2'));var router=express[_0xc500('0x3')]();var fs_extra=require(_0xc500('0x4'));var auth=require(_0xc500('0x5'));var interaction=require(_0xc500('0x6'));var config=require(_0xc500('0x7'));var controller=require(_0xc500('0x8'));router[_0xc500('0x9')]('/',auth[_0xc500('0xa')](),controller[_0xc500('0xb')]);router['get'](_0xc500('0xc'),auth[_0xc500('0xa')](),controller[_0xc500('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc500('0xe')](_0xc500('0xc'),auth[_0xc500('0xa')](),controller['update']);router[_0xc500('0xf')](_0xc500('0xc'),auth[_0xc500('0xa')](),controller[_0xc500('0x10')]);module[_0xc500('0x11')]=router; \ No newline at end of file +var _0xc7a5=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x3b1e7f,_0x512ca3){var _0x3c362b=function(_0x6c0286){while(--_0x6c0286){_0x3b1e7f['push'](_0x3b1e7f['shift']());}};_0x3c362b(++_0x512ca3);}(_0xc7a5,0x143));var _0x5c7a=function(_0x312b03,_0x10f392){_0x312b03=_0x312b03-0x0;var _0x58dd5f=_0xc7a5[_0x312b03];return _0x58dd5f;};'use strict';var multer=require('multer');var util=require(_0x5c7a('0x0'));var path=require(_0x5c7a('0x1'));var timeout=require(_0x5c7a('0x2'));var express=require(_0x5c7a('0x3'));var router=express[_0x5c7a('0x4')]();var fs_extra=require(_0x5c7a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5c7a('0x6'));var config=require(_0x5c7a('0x7'));var controller=require(_0x5c7a('0x8'));router[_0x5c7a('0x9')]('/',auth[_0x5c7a('0xa')](),controller['index']);router['get'](_0x5c7a('0xb'),auth[_0x5c7a('0xa')](),controller[_0x5c7a('0xc')]);router['post']('/',auth[_0x5c7a('0xa')](),controller[_0x5c7a('0xd')]);router[_0x5c7a('0xe')](_0x5c7a('0xb'),auth[_0x5c7a('0xa')](),controller[_0x5c7a('0xf')]);router[_0x5c7a('0x10')](_0x5c7a('0xb'),auth[_0x5c7a('0xa')](),controller[_0x5c7a('0x11')]);module[_0x5c7a('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index ddb0c6c..1b8eca1 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 _0x6403=['TEXT','exports','INTEGER','STRING'];(function(_0x9d2b29,_0x3bb0b6){var _0x23625b=function(_0x30fe9e){while(--_0x30fe9e){_0x9d2b29['push'](_0x9d2b29['shift']());}};_0x23625b(++_0x3bb0b6);}(_0x6403,0x71));var _0x3640=function(_0x1720a8,_0x2ffba6){_0x1720a8=_0x1720a8-0x0;var _0x326099=_0x6403[_0x1720a8];return _0x326099;};'use strict';var Sequelize=require('sequelize');module[_0x3640('0x0')]={'priority':{'type':Sequelize[_0x3640('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3640('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3640('0x3')]()},'description':{'type':Sequelize[_0x3640('0x2')]},'interval':{'type':Sequelize[_0x3640('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6b69=['noop','TEXT','*,*,*,*','sequelize','STRING'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0x6b69,0x139));var _0x96b6=function(_0x4e9e24,_0x100582){_0x4e9e24=_0x4e9e24-0x0;var _0x3cb51b=_0x6b69[_0x4e9e24];return _0x3cb51b;};'use strict';var Sequelize=require(_0x96b6('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x96b6('0x1')],'allowNull':![],'defaultValue':_0x96b6('0x2')},'appdata':{'type':Sequelize[_0x96b6('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x96b6('0x1')],'defaultValue':_0x96b6('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 7a17089..7c3e4e7 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 _0x8e90=['bluebird','util','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','fast-json-patch','moment'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0x8e90,0x8e));var _0x08e9=function(_0x59ad93,_0x5ae764){_0x59ad93=_0x59ad93-0x0;var _0x5614bc=_0x8e90[_0x59ad93];return _0x5614bc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x08e9('0x0'));var rp=require('request-promise');var moment=require(_0x08e9('0x1'));var BPromise=require(_0x08e9('0x2'));var Mustache=require('mustache');var util=require(_0x08e9('0x3'));var path=require('path');var sox=require(_0x08e9('0x4'));var csv=require(_0x08e9('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x08e9('0x6'));var _=require(_0x08e9('0x7'));var squel=require(_0x08e9('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x08e9('0x9'));var toCsv=require(_0x08e9('0x5'));var querystring=require('querystring');var Papa=require(_0x08e9('0xa'));var Redis=require(_0x08e9('0xb'));var authService=require(_0x08e9('0xc'));var qs=require(_0x08e9('0xd'));var as=require(_0x08e9('0xe'));var hardwareService=require(_0x08e9('0xf'));var logger=require('../../config/logger')(_0x08e9('0x10'));var utils=require(_0x08e9('0x11'));var config=require(_0x08e9('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x08e9('0x13'))['db'];function respondWithStatusCode(_0x469258,_0x174d7f){_0x174d7f=_0x174d7f||0xcc;return function(_0x33f041){if(_0x33f041){return _0x469258[_0x08e9('0x14')](_0x174d7f);}return _0x469258[_0x08e9('0x15')](_0x174d7f)['end']();};}function respondWithResult(_0x6deae,_0x5ce0cf){_0x5ce0cf=_0x5ce0cf||0xc8;return function(_0x5bbece){if(_0x5bbece){return _0x6deae['status'](_0x5ce0cf)[_0x08e9('0x16')](_0x5bbece);}};}function respondWithFilteredResult(_0x20a5f9,_0x5a0536){return function(_0x12b32b){if(_0x12b32b){var _0x3e9f83=typeof _0x5a0536['offset']===_0x08e9('0x17')&&typeof _0x5a0536[_0x08e9('0x18')]===_0x08e9('0x17');var _0xa3bdc4=_0x12b32b[_0x08e9('0x19')];var _0x4b2a61=_0x3e9f83?0x0:_0x5a0536[_0x08e9('0x1a')];var _0x1b902e=_0x3e9f83?_0x12b32b[_0x08e9('0x19')]:_0x5a0536['offset']+_0x5a0536[_0x08e9('0x18')];var _0x1621bc;if(_0x1b902e>=_0xa3bdc4){_0x1b902e=_0xa3bdc4;_0x1621bc=0xc8;}else{_0x1621bc=0xce;}_0x20a5f9[_0x08e9('0x15')](_0x1621bc);return _0x20a5f9[_0x08e9('0x1b')](_0x08e9('0x1c'),_0x4b2a61+'-'+_0x1b902e+'/'+_0xa3bdc4)[_0x08e9('0x16')](_0x12b32b);}return null;};}function patchUpdates(_0x48d37c){return function(_0x1efd36){try{jsonpatch[_0x08e9('0x1d')](_0x1efd36,_0x48d37c,!![]);}catch(_0x50e3aa){return BPromise[_0x08e9('0x1e')](_0x50e3aa);}return _0x1efd36[_0x08e9('0x1f')]();};}function saveUpdates(_0x1ba232,_0x2f4bef){return function(_0x1efd4c){if(_0x1efd4c){return _0x1efd4c['update'](_0x1ba232)[_0x08e9('0x20')](function(_0x4dfc2d){return _0x4dfc2d;});}return null;};}function removeEntity(_0x1586bb,_0x93ebfa){return function(_0x29b049){if(_0x29b049){return _0x29b049[_0x08e9('0x21')]()['then'](function(){_0x1586bb[_0x08e9('0x15')](0xcc)[_0x08e9('0x22')]();});}};}function handleEntityNotFound(_0x54a29c,_0x57f4dc){return function(_0x3f771c){if(!_0x3f771c){_0x54a29c[_0x08e9('0x14')](0x194);}return _0x3f771c;};}function handleError(_0x35fba6,_0x3f4b7b){_0x3f4b7b=_0x3f4b7b||0x1f4;return function(_0x4a99ec){logger['error'](_0x4a99ec[_0x08e9('0x23')]);if(_0x4a99ec[_0x08e9('0x24')]){delete _0x4a99ec[_0x08e9('0x24')];}_0x35fba6[_0x08e9('0x15')](_0x3f4b7b)[_0x08e9('0x25')](_0x4a99ec);};}exports[_0x08e9('0x26')]=function(_0x5bfe63,_0x2f34f9){var _0x50df98={},_0x1cb1fc={},_0x51a82c={'count':0x0,'rows':[]};var _0x552d26=_[_0x08e9('0x27')](db[_0x08e9('0x28')][_0x08e9('0x29')],function(_0x3932d3){return{'name':_0x3932d3[_0x08e9('0x2a')],'type':_0x3932d3[_0x08e9('0x2b')][_0x08e9('0x2c')]};});_0x1cb1fc[_0x08e9('0x2d')]=_[_0x08e9('0x27')](_0x552d26,_0x08e9('0x24'));_0x1cb1fc[_0x08e9('0x2e')]=_[_0x08e9('0x2f')](_0x5bfe63['query']);_0x1cb1fc[_0x08e9('0x30')]=_[_0x08e9('0x31')](_0x1cb1fc[_0x08e9('0x2d')],_0x1cb1fc[_0x08e9('0x2e')]);_0x50df98[_0x08e9('0x32')]=_[_0x08e9('0x31')](_0x1cb1fc['model'],qs['fields'](_0x5bfe63[_0x08e9('0x2e')][_0x08e9('0x33')]));_0x50df98[_0x08e9('0x32')]=_0x50df98[_0x08e9('0x32')]['length']?_0x50df98[_0x08e9('0x32')]:_0x1cb1fc[_0x08e9('0x2d')];if(!_0x5bfe63[_0x08e9('0x2e')]['hasOwnProperty']('nolimit')){_0x50df98[_0x08e9('0x18')]=qs[_0x08e9('0x18')](_0x5bfe63[_0x08e9('0x2e')]['limit']);_0x50df98[_0x08e9('0x1a')]=qs[_0x08e9('0x1a')](_0x5bfe63['query'][_0x08e9('0x1a')]);}_0x50df98[_0x08e9('0x34')]=qs[_0x08e9('0x35')](_0x5bfe63[_0x08e9('0x2e')][_0x08e9('0x35')]);_0x50df98[_0x08e9('0x36')]=qs[_0x08e9('0x30')](_[_0x08e9('0x37')](_0x5bfe63[_0x08e9('0x2e')],_0x1cb1fc[_0x08e9('0x30')]),_0x552d26);if(_0x5bfe63['query'][_0x08e9('0x38')]){_0x50df98['where']=_['merge'](_0x50df98[_0x08e9('0x36')],{'$or':_[_0x08e9('0x27')](_0x552d26,function(_0x346bdd){if(_0x346bdd[_0x08e9('0x2b')]!==_0x08e9('0x39')){var _0x114602={};_0x114602[_0x346bdd['name']]={'$like':'%'+_0x5bfe63[_0x08e9('0x2e')]['filter']+'%'};return _0x114602;}})});}_0x50df98=_[_0x08e9('0x3a')]({},_0x50df98,_0x5bfe63[_0x08e9('0x3b')]);var _0x239ae9={'where':_0x50df98[_0x08e9('0x36')]};return db['WhatsappApplication']['count'](_0x239ae9)[_0x08e9('0x20')](function(_0x197630){_0x51a82c[_0x08e9('0x19')]=_0x197630;if(_0x5bfe63[_0x08e9('0x2e')][_0x08e9('0x3c')]){_0x50df98[_0x08e9('0x3d')]=[{'all':!![]}];}return db[_0x08e9('0x28')][_0x08e9('0x3e')](_0x50df98);})[_0x08e9('0x20')](function(_0x46474b){_0x51a82c[_0x08e9('0x3f')]=_0x46474b;return _0x51a82c;})[_0x08e9('0x20')](respondWithFilteredResult(_0x2f34f9,_0x50df98))[_0x08e9('0x40')](handleError(_0x2f34f9,null));};exports[_0x08e9('0x41')]=function(_0x10a037,_0x51d92f){var _0x4b6870={'raw':!![],'where':{'id':_0x10a037[_0x08e9('0x42')]['id']}},_0x5587fd={};_0x5587fd[_0x08e9('0x2d')]=_[_0x08e9('0x2f')](db[_0x08e9('0x28')][_0x08e9('0x29')]);_0x5587fd[_0x08e9('0x2e')]=_['keys'](_0x10a037['query']);_0x5587fd['filters']=_[_0x08e9('0x31')](_0x5587fd[_0x08e9('0x2d')],_0x5587fd[_0x08e9('0x2e')]);_0x4b6870[_0x08e9('0x32')]=_[_0x08e9('0x31')](_0x5587fd['model'],qs[_0x08e9('0x33')](_0x10a037['query'][_0x08e9('0x33')]));_0x4b6870[_0x08e9('0x32')]=_0x4b6870['attributes'][_0x08e9('0x43')]?_0x4b6870['attributes']:_0x5587fd['model'];if(_0x10a037[_0x08e9('0x2e')][_0x08e9('0x3c')]){_0x4b6870[_0x08e9('0x3d')]=[{'all':!![]}];}_0x4b6870=_[_0x08e9('0x3a')]({},_0x4b6870,_0x10a037['options']);return db[_0x08e9('0x28')][_0x08e9('0x44')](_0x4b6870)['then'](handleEntityNotFound(_0x51d92f,null))[_0x08e9('0x20')](respondWithResult(_0x51d92f,null))[_0x08e9('0x40')](handleError(_0x51d92f,null));};exports[_0x08e9('0x45')]=function(_0x461b47,_0x329f61){return db[_0x08e9('0x28')][_0x08e9('0x45')](_0x461b47[_0x08e9('0x46')],{})[_0x08e9('0x20')](respondWithResult(_0x329f61,0xc9))[_0x08e9('0x40')](handleError(_0x329f61,null));};exports[_0x08e9('0x47')]=function(_0x444293,_0x4b2838){if(_0x444293['body']['id']){delete _0x444293['body']['id'];}return db[_0x08e9('0x28')][_0x08e9('0x44')]({'where':{'id':_0x444293[_0x08e9('0x42')]['id']}})[_0x08e9('0x20')](handleEntityNotFound(_0x4b2838,null))[_0x08e9('0x20')](saveUpdates(_0x444293[_0x08e9('0x46')],null))[_0x08e9('0x20')](respondWithResult(_0x4b2838,null))[_0x08e9('0x40')](handleError(_0x4b2838,null));};exports[_0x08e9('0x21')]=function(_0xf5b581,_0x4d454a){return db[_0x08e9('0x28')][_0x08e9('0x44')]({'where':{'id':_0xf5b581['params']['id']}})[_0x08e9('0x20')](handleEntityNotFound(_0x4d454a,null))[_0x08e9('0x20')](removeEntity(_0x4d454a,null))[_0x08e9('0x40')](handleError(_0x4d454a,null));}; \ No newline at end of file +var _0x2234=['filter','VIRTUAL','merge','options','WhatsappApplication','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','where','pick'];(function(_0xd2c06c,_0x5d6e23){var _0x1bd1cf=function(_0x48e483){while(--_0x48e483){_0xd2c06c['push'](_0xd2c06c['shift']());}};_0x1bd1cf(++_0x5d6e23);}(_0x2234,0x18c));var _0x4223=function(_0x124fbe,_0x5a9dfe){_0x124fbe=_0x124fbe-0x0;var _0x4700d5=_0x2234[_0x124fbe];return _0x4700d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4223('0x0'));var zipdir=require(_0x4223('0x1'));var jsonpatch=require(_0x4223('0x2'));var rp=require('request-promise');var moment=require(_0x4223('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4223('0x4'));var util=require(_0x4223('0x5'));var path=require(_0x4223('0x6'));var sox=require(_0x4223('0x7'));var csv=require(_0x4223('0x8'));var ejs=require(_0x4223('0x9'));var fs=require('fs');var fs_extra=require(_0x4223('0xa'));var _=require(_0x4223('0xb'));var squel=require(_0x4223('0xc'));var crypto=require(_0x4223('0xd'));var jsforce=require(_0x4223('0xe'));var deskjs=require(_0x4223('0xf'));var toCsv=require(_0x4223('0x8'));var querystring=require(_0x4223('0x10'));var Papa=require(_0x4223('0x11'));var Redis=require(_0x4223('0x12'));var authService=require(_0x4223('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4223('0x14'));var hardwareService=require(_0x4223('0x15'));var logger=require(_0x4223('0x16'))('api');var utils=require(_0x4223('0x17'));var config=require(_0x4223('0x18'));var licenseUtil=require(_0x4223('0x19'));var db=require(_0x4223('0x1a'))['db'];function respondWithStatusCode(_0x1dfea3,_0x573db0){_0x573db0=_0x573db0||0xcc;return function(_0x3337d6){if(_0x3337d6){return _0x1dfea3['sendStatus'](_0x573db0);}return _0x1dfea3[_0x4223('0x1b')](_0x573db0)[_0x4223('0x1c')]();};}function respondWithResult(_0x34e9d7,_0x1383b0){_0x1383b0=_0x1383b0||0xc8;return function(_0x346df0){if(_0x346df0){return _0x34e9d7[_0x4223('0x1b')](_0x1383b0)[_0x4223('0x1d')](_0x346df0);}};}function respondWithFilteredResult(_0x2c6b53,_0x22955d){return function(_0x3c601e){if(_0x3c601e){var _0x1c8405=typeof _0x22955d[_0x4223('0x1e')]===_0x4223('0x1f')&&typeof _0x22955d[_0x4223('0x20')]===_0x4223('0x1f');var _0x269b3a=_0x3c601e[_0x4223('0x21')];var _0x43dda4=_0x1c8405?0x0:_0x22955d['offset'];var _0x1dcfa1=_0x1c8405?_0x3c601e[_0x4223('0x21')]:_0x22955d[_0x4223('0x1e')]+_0x22955d[_0x4223('0x20')];var _0x10898d;if(_0x1dcfa1>=_0x269b3a){_0x1dcfa1=_0x269b3a;_0x10898d=0xc8;}else{_0x10898d=0xce;}_0x2c6b53[_0x4223('0x1b')](_0x10898d);return _0x2c6b53[_0x4223('0x22')]('Content-Range',_0x43dda4+'-'+_0x1dcfa1+'/'+_0x269b3a)[_0x4223('0x1d')](_0x3c601e);}return null;};}function patchUpdates(_0x4d5705){return function(_0x330d2a){try{jsonpatch[_0x4223('0x23')](_0x330d2a,_0x4d5705,!![]);}catch(_0x3ada09){return BPromise[_0x4223('0x24')](_0x3ada09);}return _0x330d2a['save']();};}function saveUpdates(_0x7ffce0,_0x98b9cf){return function(_0x39b04c){if(_0x39b04c){return _0x39b04c[_0x4223('0x25')](_0x7ffce0)[_0x4223('0x26')](function(_0x1da3b7){return _0x1da3b7;});}return null;};}function removeEntity(_0x3b7962,_0x3a794f){return function(_0xafdc2d){if(_0xafdc2d){return _0xafdc2d[_0x4223('0x27')]()[_0x4223('0x26')](function(){_0x3b7962[_0x4223('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x573dd5,_0x1ff4c3){return function(_0x5f0c85){if(!_0x5f0c85){_0x573dd5[_0x4223('0x28')](0x194);}return _0x5f0c85;};}function handleError(_0x597036,_0x5822af){_0x5822af=_0x5822af||0x1f4;return function(_0x5b430f){logger[_0x4223('0x29')](_0x5b430f[_0x4223('0x2a')]);if(_0x5b430f[_0x4223('0x2b')]){delete _0x5b430f['name'];}_0x597036[_0x4223('0x1b')](_0x5822af)[_0x4223('0x2c')](_0x5b430f);};}exports[_0x4223('0x2d')]=function(_0xfbfcf8,_0x3282ff){var _0x359c58={},_0x2b6f73={},_0x24ddba={'count':0x0,'rows':[]};var _0x12b0a1=_[_0x4223('0x2e')](db['WhatsappApplication']['rawAttributes'],function(_0x23478e){return{'name':_0x23478e[_0x4223('0x2f')],'type':_0x23478e[_0x4223('0x30')][_0x4223('0x31')]};});_0x2b6f73[_0x4223('0x32')]=_[_0x4223('0x2e')](_0x12b0a1,_0x4223('0x2b'));_0x2b6f73[_0x4223('0x33')]=_[_0x4223('0x34')](_0xfbfcf8[_0x4223('0x33')]);_0x2b6f73[_0x4223('0x35')]=_[_0x4223('0x36')](_0x2b6f73[_0x4223('0x32')],_0x2b6f73[_0x4223('0x33')]);_0x359c58['attributes']=_[_0x4223('0x36')](_0x2b6f73[_0x4223('0x32')],qs[_0x4223('0x37')](_0xfbfcf8['query'][_0x4223('0x37')]));_0x359c58[_0x4223('0x38')]=_0x359c58[_0x4223('0x38')]['length']?_0x359c58[_0x4223('0x38')]:_0x2b6f73[_0x4223('0x32')];if(!_0xfbfcf8[_0x4223('0x33')]['hasOwnProperty']('nolimit')){_0x359c58[_0x4223('0x20')]=qs['limit'](_0xfbfcf8['query'][_0x4223('0x20')]);_0x359c58[_0x4223('0x1e')]=qs[_0x4223('0x1e')](_0xfbfcf8['query']['offset']);}_0x359c58[_0x4223('0x39')]=qs['sort'](_0xfbfcf8['query']['sort']);_0x359c58[_0x4223('0x3a')]=qs[_0x4223('0x35')](_[_0x4223('0x3b')](_0xfbfcf8['query'],_0x2b6f73[_0x4223('0x35')]),_0x12b0a1);if(_0xfbfcf8[_0x4223('0x33')][_0x4223('0x3c')]){_0x359c58[_0x4223('0x3a')]=_['merge'](_0x359c58[_0x4223('0x3a')],{'$or':_['map'](_0x12b0a1,function(_0xddae94){if(_0xddae94[_0x4223('0x30')]!==_0x4223('0x3d')){var _0x176d31={};_0x176d31[_0xddae94[_0x4223('0x2b')]]={'$like':'%'+_0xfbfcf8[_0x4223('0x33')][_0x4223('0x3c')]+'%'};return _0x176d31;}})});}_0x359c58=_[_0x4223('0x3e')]({},_0x359c58,_0xfbfcf8[_0x4223('0x3f')]);var _0x29e0ca={'where':_0x359c58[_0x4223('0x3a')]};return db[_0x4223('0x40')][_0x4223('0x21')](_0x29e0ca)[_0x4223('0x26')](function(_0x43f792){_0x24ddba[_0x4223('0x21')]=_0x43f792;if(_0xfbfcf8[_0x4223('0x33')][_0x4223('0x41')]){_0x359c58[_0x4223('0x42')]=[{'all':!![]}];}return db[_0x4223('0x40')][_0x4223('0x43')](_0x359c58);})[_0x4223('0x26')](function(_0x2ef828){_0x24ddba['rows']=_0x2ef828;return _0x24ddba;})['then'](respondWithFilteredResult(_0x3282ff,_0x359c58))[_0x4223('0x44')](handleError(_0x3282ff,null));};exports[_0x4223('0x45')]=function(_0x113404,_0x411f6e){var _0x1a6bfc={'raw':!![],'where':{'id':_0x113404[_0x4223('0x46')]['id']}},_0x342c36={};_0x342c36[_0x4223('0x32')]=_[_0x4223('0x34')](db['WhatsappApplication'][_0x4223('0x47')]);_0x342c36[_0x4223('0x33')]=_[_0x4223('0x34')](_0x113404[_0x4223('0x33')]);_0x342c36[_0x4223('0x35')]=_[_0x4223('0x36')](_0x342c36[_0x4223('0x32')],_0x342c36[_0x4223('0x33')]);_0x1a6bfc[_0x4223('0x38')]=_[_0x4223('0x36')](_0x342c36['model'],qs[_0x4223('0x37')](_0x113404[_0x4223('0x33')][_0x4223('0x37')]));_0x1a6bfc[_0x4223('0x38')]=_0x1a6bfc['attributes'][_0x4223('0x48')]?_0x1a6bfc['attributes']:_0x342c36['model'];if(_0x113404[_0x4223('0x33')][_0x4223('0x41')]){_0x1a6bfc[_0x4223('0x42')]=[{'all':!![]}];}_0x1a6bfc=_[_0x4223('0x3e')]({},_0x1a6bfc,_0x113404[_0x4223('0x3f')]);return db[_0x4223('0x40')][_0x4223('0x49')](_0x1a6bfc)[_0x4223('0x26')](handleEntityNotFound(_0x411f6e,null))[_0x4223('0x26')](respondWithResult(_0x411f6e,null))[_0x4223('0x44')](handleError(_0x411f6e,null));};exports[_0x4223('0x4a')]=function(_0x302f94,_0x1dc6f4){return db[_0x4223('0x40')][_0x4223('0x4a')](_0x302f94[_0x4223('0x4b')],{})['then'](respondWithResult(_0x1dc6f4,0xc9))[_0x4223('0x44')](handleError(_0x1dc6f4,null));};exports[_0x4223('0x25')]=function(_0x365f4b,_0x23e8b0){if(_0x365f4b[_0x4223('0x4b')]['id']){delete _0x365f4b['body']['id'];}return db[_0x4223('0x40')][_0x4223('0x49')]({'where':{'id':_0x365f4b['params']['id']}})[_0x4223('0x26')](handleEntityNotFound(_0x23e8b0,null))[_0x4223('0x26')](saveUpdates(_0x365f4b[_0x4223('0x4b')],null))[_0x4223('0x26')](respondWithResult(_0x23e8b0,null))[_0x4223('0x44')](handleError(_0x23e8b0,null));};exports[_0x4223('0x27')]=function(_0x17863d,_0x1b4df7){return db['WhatsappApplication'][_0x4223('0x49')]({'where':{'id':_0x17863d[_0x4223('0x46')]['id']}})[_0x4223('0x26')](handleEntityNotFound(_0x1b4df7,null))[_0x4223('0x26')](removeEntity(_0x1b4df7,null))[_0x4223('0x44')](handleError(_0x1b4df7,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 5dedb15..00c3961 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 _0xd65d=['request-promise','path','rimraf','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd65d,0x175));var _0xdd65=function(_0x149f69,_0x2ca0be){_0x149f69=_0x149f69-0x0;var _0x413aaa=_0xd65d[_0x149f69];return _0x413aaa;};'use strict';var _=require(_0xdd65('0x0'));var util=require(_0xdd65('0x1'));var logger=require('../../config/logger')(_0xdd65('0x2'));var moment=require(_0xdd65('0x3'));var BPromise=require(_0xdd65('0x4'));var rp=require(_0xdd65('0x5'));var fs=require('fs');var path=require(_0xdd65('0x6'));var rimraf=require(_0xdd65('0x7'));var config=require('../../config/environment');var attributes=require(_0xdd65('0x8'));module[_0xdd65('0x9')]=function(_0x388877,_0x20cf34){return _0x388877['define'](_0xdd65('0xa'),attributes,{'tableName':_0xdd65('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd65('0xc'),'collate':_0xdd65('0xd')});}; \ No newline at end of file +var _0x221f=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappApplication','utf8mb4_unicode_ci'];(function(_0x22929d,_0x50ee37){var _0x1f63d0=function(_0x561d1f){while(--_0x561d1f){_0x22929d['push'](_0x22929d['shift']());}};_0x1f63d0(++_0x50ee37);}(_0x221f,0x19a));var _0xf221=function(_0x502e15,_0x49ff8f){_0x502e15=_0x502e15-0x0;var _0xadd0c4=_0x221f[_0x502e15];return _0xadd0c4;};'use strict';var _=require('lodash');var util=require(_0xf221('0x0'));var logger=require(_0xf221('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf221('0x2'));var rp=require(_0xf221('0x3'));var fs=require('fs');var path=require(_0xf221('0x4'));var rimraf=require(_0xf221('0x5'));var config=require(_0xf221('0x6'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x1987fd,_0x4ef221){return _0x1987fd[_0xf221('0x7')](_0xf221('0x8'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf221('0x9')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index aabce68..42af217 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 _0x8c8b=['info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x328099,_0x2bb1e0){var _0x5266d0=function(_0x5e7d6f){while(--_0x5e7d6f){_0x328099['push'](_0x328099['shift']());}};_0x5266d0(++_0x2bb1e0);}(_0x8c8b,0x106));var _0xb8c8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8c8b[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xb8c8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb8c8('0x1'));var rs=require(_0xb8c8('0x2'));var fs=require('fs');var Redis=require(_0xb8c8('0x3'));var db=require(_0xb8c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8c8('0x5'));var config=require(_0xb8c8('0x6'));var jayson=require(_0xb8c8('0x7'));var client=jayson[_0xb8c8('0x8')][_0xb8c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c33cf,_0x1fa488,_0x36d081){return new BPromise(function(_0x1d9bd8,_0x2badd9){return client[_0xb8c8('0xa')](_0x3c33cf,_0x36d081)['then'](function(_0xfa7361){logger[_0xb8c8('0xb')](_0xb8c8('0xc'),_0x1fa488,_0xb8c8('0xd'));logger[_0xb8c8('0xe')](_0xb8c8('0xf'),_0x1fa488,_0xb8c8('0xd'),JSON[_0xb8c8('0x10')](_0xfa7361));if(_0xfa7361[_0xb8c8('0x11')]){if(_0xfa7361[_0xb8c8('0x11')][_0xb8c8('0x12')]===0x1f4){logger[_0xb8c8('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x1fa488,_0xfa7361[_0xb8c8('0x11')]['message']);return _0x2badd9(_0xfa7361[_0xb8c8('0x11')][_0xb8c8('0x13')]);}logger['error'](_0xb8c8('0xc'),_0x1fa488,_0xfa7361[_0xb8c8('0x11')][_0xb8c8('0x13')]);return _0x1d9bd8(_0xfa7361['error'][_0xb8c8('0x13')]);}else{logger[_0xb8c8('0xb')](_0xb8c8('0xc'),_0x1fa488,_0xb8c8('0xd'));_0x1d9bd8(_0xfa7361['result'][_0xb8c8('0x13')]);}})[_0xb8c8('0x14')](function(_0x190365){logger[_0xb8c8('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x1fa488,_0x190365);_0x2badd9(_0x190365);});});} \ No newline at end of file +var _0x6132=['../../config/environment','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xf062c,_0x1578b5){var _0x4d0a05=function(_0x491175){while(--_0x491175){_0xf062c['push'](_0xf062c['shift']());}};_0x4d0a05(++_0x1578b5);}(_0x6132,0x13a));var _0x2613=function(_0x516f94,_0x32f8d8){_0x516f94=_0x516f94-0x0;var _0x3f2bb7=_0x6132[_0x516f94];return _0x3f2bb7;};'use strict';var _=require(_0x2613('0x0'));var util=require(_0x2613('0x1'));var moment=require(_0x2613('0x2'));var BPromise=require(_0x2613('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2613('0x4'));var db=require(_0x2613('0x5'))['db'];var utils=require(_0x2613('0x6'));var logger=require(_0x2613('0x7'))('rpc');var config=require(_0x2613('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2613('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x309663,_0x369931,_0x465a32){return new BPromise(function(_0xe295ea,_0x4b6a40){return client[_0x2613('0xa')](_0x309663,_0x465a32)[_0x2613('0xb')](function(_0x196831){logger['info'](_0x2613('0xc'),_0x369931,_0x2613('0xd'));logger[_0x2613('0xe')](_0x2613('0xf'),_0x369931,_0x2613('0xd'),JSON[_0x2613('0x10')](_0x196831));if(_0x196831[_0x2613('0x11')]){if(_0x196831[_0x2613('0x11')][_0x2613('0x12')]===0x1f4){logger[_0x2613('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x369931,_0x196831[_0x2613('0x11')][_0x2613('0x13')]);return _0x4b6a40(_0x196831[_0x2613('0x11')][_0x2613('0x13')]);}logger['error'](_0x2613('0xc'),_0x369931,_0x196831[_0x2613('0x11')][_0x2613('0x13')]);return _0xe295ea(_0x196831[_0x2613('0x11')]['message']);}else{logger[_0x2613('0x14')](_0x2613('0xc'),_0x369931,_0x2613('0xd'));_0xe295ea(_0x196831[_0x2613('0x15')]['message']);}})[_0x2613('0x16')](function(_0x13cdee){logger['error'](_0x2613('0xc'),_0x369931,_0x13cdee);_0x4b6a40(_0x13cdee);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 6ac52dc..e8f9eea 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 _0x7295=['/describe','isAuthenticated','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get'];(function(_0x106441,_0x10c155){var _0x3a3404=function(_0x10d4c0){while(--_0x10d4c0){_0x106441['push'](_0x106441['shift']());}};_0x3a3404(++_0x10c155);}(_0x7295,0x1d6));var _0x5729=function(_0x23b1d5,_0x3043fa){_0x23b1d5=_0x23b1d5-0x0;var _0x3f5702=_0x7295[_0x23b1d5];return _0x3f5702;};'use strict';var multer=require(_0x5729('0x0'));var util=require(_0x5729('0x1'));var path=require(_0x5729('0x2'));var timeout=require('connect-timeout');var express=require(_0x5729('0x3'));var router=express[_0x5729('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5729('0x5'));var interaction=require(_0x5729('0x6'));var config=require(_0x5729('0x7'));var controller=require(_0x5729('0x8'));router[_0x5729('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5729('0x9')](_0x5729('0xa'),auth[_0x5729('0xb')](),controller['describe']);router['get'](_0x5729('0xc'),auth[_0x5729('0xb')](),controller['show']);router['get'](_0x5729('0xd'),auth[_0x5729('0xb')](),controller[_0x5729('0xe')]);router[_0x5729('0x9')](_0x5729('0xf'),auth[_0x5729('0xb')](),controller[_0x5729('0x10')]);router['post']('/',auth[_0x5729('0xb')](),controller[_0x5729('0x11')]);router[_0x5729('0x12')](_0x5729('0xd'),auth[_0x5729('0xb')](),controller[_0x5729('0x13')]);router[_0x5729('0x12')]('/:id/tags',auth[_0x5729('0xb')](),interaction[_0x5729('0x14')]('whatsapp',_0x5729('0x15')),controller[_0x5729('0x16')]);router[_0x5729('0x17')]('/:id',auth[_0x5729('0xb')](),interaction[_0x5729('0x14')](_0x5729('0x18'),'whatsappinteraction:update'),controller[_0x5729('0x19')]);router['delete'](_0x5729('0xc'),auth[_0x5729('0xb')](),interaction[_0x5729('0x14')](_0x5729('0x18'),_0x5729('0x1a')),controller[_0x5729('0x1b')]);router[_0x5729('0x1c')](_0x5729('0x1d'),auth['isAuthenticated'](),controller[_0x5729('0x1e')]);module[_0x5729('0x1f')]=router; \ No newline at end of file +var _0x4da6=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','whatsappinteraction:addtags','addTags','whatsapp','delete','removeTags','exports','multer'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4da6,0xe7));var _0x64da=function(_0x1a71c9,_0x48ed5b){_0x1a71c9=_0x1a71c9-0x0;var _0x59367e=_0x4da6[_0x1a71c9];return _0x59367e;};'use strict';var multer=require(_0x64da('0x0'));var util=require(_0x64da('0x1'));var path=require('path');var timeout=require(_0x64da('0x2'));var express=require('express');var router=express[_0x64da('0x3')]();var fs_extra=require(_0x64da('0x4'));var auth=require(_0x64da('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x64da('0x6'));var controller=require(_0x64da('0x7'));router[_0x64da('0x8')]('/',auth[_0x64da('0x9')](),controller[_0x64da('0xa')]);router[_0x64da('0x8')](_0x64da('0xb'),auth[_0x64da('0x9')](),controller[_0x64da('0xc')]);router['get'](_0x64da('0xd'),auth[_0x64da('0x9')](),controller[_0x64da('0xe')]);router[_0x64da('0x8')](_0x64da('0xf'),auth[_0x64da('0x9')](),controller[_0x64da('0x10')]);router['get'](_0x64da('0x11'),auth['isAuthenticated'](),controller[_0x64da('0x12')]);router['post']('/',auth[_0x64da('0x9')](),controller[_0x64da('0x13')]);router[_0x64da('0x14')]('/:id/messages',auth[_0x64da('0x9')](),controller['addMessage']);router['post'](_0x64da('0x15'),auth[_0x64da('0x9')](),interaction[_0x64da('0x16')]('whatsapp',_0x64da('0x17')),controller[_0x64da('0x18')]);router['put'](_0x64da('0xd'),auth[_0x64da('0x9')](),interaction[_0x64da('0x16')](_0x64da('0x19'),'whatsappinteraction:update'),controller['update']);router[_0x64da('0x1a')]('/:id',auth[_0x64da('0x9')](),interaction[_0x64da('0x16')](_0x64da('0x19'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x64da('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0x64da('0x1b')]);module[_0x64da('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index bd7368d..1ed0c08 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 _0xbb35=['BOOLEAN','DATE','STRING','ENUM','out','moment','exports'];(function(_0xd62d2a,_0x27ca09){var _0x591018=function(_0x4bf81c){while(--_0x4bf81c){_0xd62d2a['push'](_0xd62d2a['shift']());}};_0x591018(++_0x27ca09);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x57c794,_0x43e2f0){_0x57c794=_0x57c794-0x0;var _0x44cd23=_0xbb35[_0x57c794];return _0x44cd23;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5bb3('0x0'));module[_0x5bb3('0x1')]={'closed':{'type':Sequelize[_0x5bb3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5bb3('0x3')]},'disposition':{'type':Sequelize[_0x5bb3('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5bb3('0x4')]},'note':{'type':Sequelize[_0x5bb3('0x4')]},'phone':{'type':Sequelize[_0x5bb3('0x4')]},'read1stAt':{'type':Sequelize[_0x5bb3('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x5bb3('0x5')]('in',_0x5bb3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5bb3('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5bb3('0x5')]('in',_0x5bb3('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x43ea=['ENUM','out','sequelize','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x43ea,0x142));var _0xa43e=function(_0x1b9695,_0x495c34){_0x1b9695=_0x1b9695-0x0;var _0x400eba=_0x43ea[_0x1b9695];return _0x400eba;};'use strict';var Sequelize=require(_0xa43e('0x0'));var moment=require(_0xa43e('0x1'));module[_0xa43e('0x2')]={'closed':{'type':Sequelize[_0xa43e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa43e('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa43e('0x4')]},'note':{'type':Sequelize[_0xa43e('0x4')]},'phone':{'type':Sequelize[_0xa43e('0x4')]},'read1stAt':{'type':Sequelize[_0xa43e('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xa43e('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa43e('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa43e('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index aab53da..56b3948 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 _0x299e=['parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','merge','unreadMessages','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','catch','show','params','includeAll','include','options','create','describe','addMessage','WhatsappMessage','ids','omit','findOne','hasOwnProperty','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','format','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','secret','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','closed','closedAt','basename','pipe','createWriteStream','direction','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','index','WhatsappInteraction','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','sort','where','pick','field','color','tools_tags','u.id','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','value','having','`\x20=\x200','`\x20>\x200','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','compact','isEmpty','concat','createdAt'];(function(_0x47b03c,_0x2b8a51){var _0x2a3db5=function(_0x39cabe){while(--_0x39cabe){_0x47b03c['push'](_0x47b03c['shift']());}};_0x2a3db5(++_0x2b8a51);}(_0x299e,0x169));var _0xe299=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x299e[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xe299('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe299('0x1'));var jsonpatch=require(_0xe299('0x2'));var rp=require(_0xe299('0x3'));var moment=require('moment');var BPromise=require(_0xe299('0x4'));var Mustache=require('mustache');var util=require(_0xe299('0x5'));var path=require(_0xe299('0x6'));var sox=require(_0xe299('0x7'));var csv=require(_0xe299('0x8'));var ejs=require(_0xe299('0x9'));var fs=require('fs');var fs_extra=require(_0xe299('0xa'));var _=require(_0xe299('0xb'));var squel=require('squel');var crypto=require(_0xe299('0xc'));var jsforce=require(_0xe299('0xd'));var deskjs=require(_0xe299('0xe'));var toCsv=require(_0xe299('0x8'));var querystring=require(_0xe299('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe299('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe299('0x11'));var pdf=require(_0xe299('0x12'));var hardwareService=require(_0xe299('0x13'));var logger=require(_0xe299('0x14'))(_0xe299('0x15'));var utils=require(_0xe299('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe299('0x17'));var db=require(_0xe299('0x18'))['db'];config[_0xe299('0x19')]=_[_0xe299('0x1a')](config[_0xe299('0x19')],{'host':_0xe299('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe299('0x19')]));require(_0xe299('0x1c'))['register'](socket);function respondWithStatusCode(_0x30f5c9,_0x1d2444){_0x1d2444=_0x1d2444||0xcc;return function(_0x84faf7){if(_0x84faf7){return _0x30f5c9[_0xe299('0x1d')](_0x1d2444);}return _0x30f5c9['status'](_0x1d2444)[_0xe299('0x1e')]();};}function respondWithResult(_0x4e0eac,_0x46ce25){_0x46ce25=_0x46ce25||0xc8;return function(_0x440171){if(_0x440171){return _0x4e0eac['status'](_0x46ce25)[_0xe299('0x1f')](_0x440171);}};}function respondWithFilteredResult(_0x234f16,_0x5b4903){return function(_0x14cf02){if(_0x14cf02){var _0x8e6cc6=typeof _0x5b4903[_0xe299('0x20')]==='undefined'&&typeof _0x5b4903[_0xe299('0x21')]===_0xe299('0x22');var _0x53260f=_0x14cf02[_0xe299('0x23')];var _0x5ea617=_0x8e6cc6?0x0:_0x5b4903['offset'];var _0x5ada0d=_0x8e6cc6?_0x14cf02[_0xe299('0x23')]:_0x5b4903['offset']+_0x5b4903[_0xe299('0x21')];var _0x5abddb;if(_0x5ada0d>=_0x53260f){_0x5ada0d=_0x53260f;_0x5abddb=0xc8;}else{_0x5abddb=0xce;}_0x234f16[_0xe299('0x24')](_0x5abddb);return _0x234f16[_0xe299('0x25')](_0xe299('0x26'),_0x5ea617+'-'+_0x5ada0d+'/'+_0x53260f)[_0xe299('0x1f')](_0x14cf02);}return null;};}function patchUpdates(_0x47124f){return function(_0x2269ad){try{jsonpatch[_0xe299('0x27')](_0x2269ad,_0x47124f,!![]);}catch(_0x254849){return BPromise[_0xe299('0x28')](_0x254849);}return _0x2269ad[_0xe299('0x29')]();};}function saveUpdates(_0x2d9158,_0x315557){return function(_0x404ea6){if(_0x404ea6){return _0x404ea6[_0xe299('0x2a')](_0x2d9158)['then'](function(_0x177690){return _0x177690;});}return null;};}function removeEntity(_0x4e2d86,_0x30f707){return function(_0x2b7160){if(_0x2b7160){return _0x2b7160[_0xe299('0x2b')]()[_0xe299('0x2c')](function(){_0x4e2d86['status'](0xcc)[_0xe299('0x1e')]();});}};}function handleEntityNotFound(_0x581258,_0x1f42b8){return function(_0x5c7168){if(!_0x5c7168){_0x581258[_0xe299('0x1d')](0x194);}return _0x5c7168;};}function handleError(_0x122711,_0x351bec){_0x351bec=_0x351bec||0x1f4;return function(_0x2d2b79){logger[_0xe299('0x2d')](_0x2d2b79[_0xe299('0x2e')]);if(_0x2d2b79[_0xe299('0x2f')]){delete _0x2d2b79[_0xe299('0x2f')];}_0x122711[_0xe299('0x24')](_0x351bec)[_0xe299('0x30')](_0x2d2b79);};}function getInteractionUsers(_0x5a14af,_0x15fec1){return new BPromise(function(_0x2d698d,_0x162619){try{if(_0x15fec1[_0x5a14af['id']]){_0x5a14af[_0xe299('0x31')]=_[_0xe299('0x32')](_0x15fec1[_0x5a14af['id']],function(_0x42f953){return{'id':_0x42f953['id'],'fullname':_0x42f953[_0xe299('0x33')]};});}}catch(_0x4904e1){_0x162619(_0x4904e1);}_0x2d698d(_0x5a14af);});}function getInteractionTags(_0x278365,_0x57d5b7){return new BPromise(function(_0x24d427,_0x5a4bd0){try{if(_0x278365[_0xe299('0x34')]){_0x278365[_0xe299('0x35')]=[];_0x278365['TagIds']['split'](',')[_0xe299('0x36')](function(_0x2ca352){_0x278365[_0xe299('0x35')][_0xe299('0x37')](_0x57d5b7[_0x2ca352]);});}delete _0x278365[_0xe299('0x34')];}catch(_0x38a905){_0x5a4bd0(_0x38a905);}_0x24d427(_0x278365);});}function updateWhatsappInteraction(_0x1ccf91,_0x29bd6b,_0x1bc7a1){return new BPromise(function(_0x4e7bde,_0x29f6fa){return getInteractionUsers(_0x1ccf91,_0x1bc7a1)[_0xe299('0x2c')](function(_0x529677){return getInteractionTags(_0x529677,_0x29bd6b);})[_0xe299('0x2c')](function(_0x5e2f97){_0x4e7bde(_0x5e2f97);})['catch'](function(_0x15b730){_0x29f6fa(_0x15b730);});});}exports[_0xe299('0x38')]=function(_0x55308a,_0xa90784){var _0x32baa8={},_0x1b362f={},_0x49736b={'count':0x0,'rows':[]};var _0x596a5c=_[_0xe299('0x32')](db[_0xe299('0x39')][_0xe299('0x3a')],function(_0x41ced9){return{'name':_0x41ced9['fieldName'],'type':_0x41ced9[_0xe299('0x3b')][_0xe299('0x3c')]};});_0x1b362f[_0xe299('0x3d')]=_[_0xe299('0x32')](_0x596a5c,_0xe299('0x2f'));_0x1b362f['query']=_[_0xe299('0x3e')](_0x55308a[_0xe299('0x3f')]);_0x1b362f[_0xe299('0x40')]=_[_0xe299('0x41')](_0x1b362f['model'],_0x1b362f['query']);_0x32baa8[_0xe299('0x42')]=_['intersection'](_0x1b362f['model'],qs[_0xe299('0x43')](_0x55308a[_0xe299('0x3f')][_0xe299('0x43')]));_0x32baa8[_0xe299('0x42')]=_0x32baa8[_0xe299('0x42')]['length']?_0x32baa8[_0xe299('0x42')]:_0x1b362f['model'];if(!_0x55308a[_0xe299('0x3f')]['hasOwnProperty']('nolimit')){_0x32baa8[_0xe299('0x21')]=qs[_0xe299('0x21')](_0x55308a[_0xe299('0x3f')]['limit']);_0x32baa8[_0xe299('0x20')]=qs['offset'](_0x55308a[_0xe299('0x3f')][_0xe299('0x20')]);}_0x32baa8['order']=qs[_0xe299('0x44')](_0x55308a[_0xe299('0x3f')][_0xe299('0x44')]);_0x32baa8[_0xe299('0x45')]=qs[_0xe299('0x40')](_[_0xe299('0x46')](_0x55308a[_0xe299('0x3f')],_0x1b362f['filters']),_0x596a5c);var _0x1bb9be=[];var _0x3cb1c1=squel['select']()['field']('id')[_0xe299('0x47')](_0xe299('0x2f'))[_0xe299('0x47')](_0xe299('0x48'))['from'](_0xe299('0x49'));var _0x157e06=squel['select']()[_0xe299('0x47')](_0xe299('0x4a'))[_0xe299('0x47')]('u.fullname')[_0xe299('0x47')](_0xe299('0x4b'))[_0xe299('0x4c')](_0xe299('0x4d'),'ui')['left_join']('users','u',_0xe299('0x4e'));var _0x505a00=squel['select']()[_0xe299('0x4c')](_0xe299('0x4f'),'i')[_0xe299('0x50')](_0xe299('0x51'),'c',_0xe299('0x52'))[_0xe299('0x50')](_0xe299('0x53'),'o',_0xe299('0x54'))[_0xe299('0x50')](_0xe299('0x55'),'a',_0xe299('0x56'))[_0xe299('0x50')](_0xe299('0x57'),'me',_0xe299('0x58'))[_0xe299('0x50')](_0xe299('0x59'),'it','it.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0xe299('0x49'),'t',_0xe299('0x5a'));var _0x4c7093=squel[_0xe299('0x5b')]();var _0x1d83aa=[];var _0x218638=squel['expr']();var _0x584db0;if(_0x55308a[_0xe299('0x3f')][_0xe299('0x5c')]){_0x584db0=as[_0xe299('0x5d')](_0x55308a['query'][_0xe299('0x5c')]);var _0x1c31e3=_0x584db0[_0xe299('0x5e')];for(var _0x37b953=0x0;_0x37b953<_0x584db0[_0xe299('0x5f')][_0xe299('0x60')];_0x37b953++){var _0x420426=_0x584db0[_0xe299('0x5f')][_0x37b953];var _0x381bdb='i';var _0x1ad9bc=_[_0xe299('0x61')](_0x596a5c,[_0xe299('0x2f'),_0x420426[_0xe299('0x47')]]);if(!_0x1ad9bc){switch(_0x420426['field']){case'unreadMessages':if(_0x420426[_0xe299('0x62')]==0x1){_0x505a00[_0xe299('0x63')]('`'+_0x420426[_0xe299('0x47')]+_0xe299('0x64'));}else{_0x505a00[_0xe299('0x63')]('`'+_0x420426[_0xe299('0x47')]+_0xe299('0x65'));}break;case'Contact':if(_0x420426['operator']==='$substring'){if(_0x420426[_0xe299('0x62')][_0xe299('0x66')]('\x20')['length']>0x1){_0x4c7093[_0x1c31e3](_0xe299('0x67'),qs[_0xe299('0x68')](_0x420426[_0xe299('0x62')]),null);}else{var _0xe385cd='%'+_0x420426[_0xe299('0x62')]+'%';_0x4c7093[_0x1c31e3](_0xe299('0x69'),_0xe385cd,_0xe385cd,_0xe385cd);}}else{_0x1ad9bc=_['find'](_0x596a5c,['name',_0xe299('0x6a')]);_0x420426[_0xe299('0x47')]=_0xe299('0x6a');_0x48a403=as[_0xe299('0x6b')](_0x381bdb,_0x1ad9bc['type'],_0x420426);_0x4c7093[_0x1c31e3](_0x48a403[_0xe299('0x6c')],_0x48a403['value']['start'],_0x48a403[_0xe299('0x62')][_0xe299('0x1e')]);}break;case _0xe299('0x6d'):var _0x20244f=_0x420426[_0xe299('0x62')][_0xe299('0x66')](',')[_0xe299('0x32')](function(_0x3fc65b){return Number(_0x3fc65b);});_0x20244f[_0xe299('0x36')](function(_0x4103b6){_0x218638['or'](_0xe299('0x6e'),'%,'+_0x4103b6+',%');});_0x1d83aa=_['union'](_0x1d83aa,_0x20244f);break;case _0xe299('0x6f'):if(_0x420426[_0xe299('0x70')]===_0xe299('0x71')){_0x4c7093[_0x1c31e3](_0xe299('0x72'),'%'+_0x420426['value']+'%',null);}else{_0x1ad9bc=_[_0xe299('0x61')](_0x596a5c,[_0xe299('0x2f'),_0xe299('0x73')]);_0x420426[_0xe299('0x47')]='UserId';_0x48a403=as[_0xe299('0x6b')](_0x381bdb,_0x1ad9bc[_0xe299('0x3b')],_0x420426);_0x4c7093[_0x1c31e3](_0x48a403['text'],_0x48a403[_0xe299('0x62')][_0xe299('0x74')],_0x48a403[_0xe299('0x62')][_0xe299('0x1e')]);}break;case _0xe299('0x75'):_0x48a403=as[_0xe299('0x6b')]('me',null,_0x420426);_0x4c7093[_0x1c31e3](_0x48a403[_0xe299('0x6c')],_0x48a403[_0xe299('0x62')][_0xe299('0x74')],_0x48a403[_0xe299('0x62')][_0xe299('0x1e')]);break;}}else{var _0x48a403=as['buildExpression'](_0x381bdb,_0x1ad9bc['type'],_0x420426);_0x4c7093[_0x1c31e3](_0x48a403[_0xe299('0x6c')],_0x48a403[_0xe299('0x62')][_0xe299('0x74')],_0x48a403[_0xe299('0x62')][_0xe299('0x1e')]);}}}else{var _0x595bd4=_(_0x55308a['query'])[_0xe299('0x3e')]()[_0xe299('0x32')](function(_0x4cbce6){return _[_0xe299('0x76')](_0x596a5c,[_0xe299('0x2f'),_0x4cbce6])?_0x4cbce6:undefined;})[_0xe299('0x77')]()[_0xe299('0x62')]();if(!_[_0xe299('0x78')](_0x595bd4)){_0x595bd4[_0xe299('0x36')](function(_0x4f676e){if(_0x4f676e==='WhatsappAccountId'){_0x505a00['where']('i.WhatsappAccountId\x20IN\x20?',[][_0xe299('0x79')](_0x55308a[_0xe299('0x3f')][_0x4f676e]));}else if(_0x4f676e===_0xe299('0x7a')){var _0x1effe6=JSON['parse'](_0x55308a[_0xe299('0x3f')][_0x4f676e])['$gte'];var _0x429351=JSON[_0xe299('0x7b')](_0x55308a[_0xe299('0x3f')][_0x4f676e])[_0xe299('0x7c')];_0x505a00[_0xe299('0x45')](_0xe299('0x7d'),_0x1effe6,_0x429351);}else{if(_0x55308a[_0xe299('0x3f')][_0x4f676e]==='null'){_0x505a00['where']('i.'+_0x4f676e+_0xe299('0x7e'));}else{_0x505a00[_0xe299('0x45')]('i.'+_0x4f676e+_0xe299('0x7f'),_0x55308a[_0xe299('0x3f')][_0x4f676e]);}}});}if(_0x55308a[_0xe299('0x3f')][_0xe299('0x80')]){if(_0x55308a[_0xe299('0x3f')]['read']==0x1){_0x505a00[_0xe299('0x63')](_0xe299('0x81'));}else{_0x505a00['having'](_0xe299('0x82'));}}if(_0x55308a[_0xe299('0x3f')]['tag']){_0x1d83aa=_[_0xe299('0x83')](_0x55308a['query']['tag'])?_0x55308a[_0xe299('0x3f')][_0xe299('0x84')]:new Array(_0x55308a[_0xe299('0x3f')][_0xe299('0x84')]);_0x1d83aa[_0xe299('0x36')](function(_0x2ac1c9){_0x218638['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2ac1c9+',%');});}if(_0x55308a['query'][_0xe299('0x85')]){var _0x4fa702=_0x55308a[_0xe299('0x3f')][_0xe299('0x85')][_0xe299('0x86')]('\x5c','\x5c\x5c')[_0xe299('0x86')](/'/g,'\x27\x27');if(qs[_0xe299('0x87')](_0x4fa702)){_0x4c7093['or']('i.id\x20LIKE\x20?',_0x4fa702+'%')['or']('i.phone\x20LIKE\x20?',_0x4fa702+'%');}else{_0x4c7093['or'](_0xe299('0x88'),qs[_0xe299('0x68')](_0x4fa702))['or'](_0xe299('0x89'),_0x4fa702+'%');}}}_0x505a00['where'](_0x4c7093);_0x505a00[_0xe299('0x8a')](_0xe299('0x8b'));var _0x139c9c={'type':db[_0xe299('0x8c')][_0xe299('0x8d')][_0xe299('0x8e')],'raw':!![]};var _0x3ca862=_0x505a00[_0xe299('0x8f')]();_0x3ca862[_0xe299('0x47')](_0xe299('0x8b'));_0x3ca862[_0xe299('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x32baa8[_0xe299('0x90')]){_0x32baa8[_0xe299('0x90')]['forEach'](function(_0x1ec6ea){var _0x23336a=_0x1ec6ea[0x0]===_0xe299('0x91')?_0x1ec6ea[0x0]:'i.'+_0x1ec6ea[0x0];_0x505a00[_0xe299('0x90')](_0x23336a,_0x1ec6ea[0x1]===_0xe299('0x92')?![]:!![]);});}if(!_[_0xe299('0x78')](_0x1d83aa)){_0x505a00[_0xe299('0x63')](_0x218638);_0x3ca862['where'](_0xe299('0x93'),_0x1d83aa);}BPromise[_0xe299('0x94')]()[_0xe299('0x2c')](function(){if(!_0x584db0){if(_0x55308a[_0xe299('0x3f')][_0xe299('0x95')])return;_0x3ca862[_0xe299('0x45')](_0xe299('0x96'));_0x505a00[_0xe299('0x45')](_0xe299('0x96'));return;}if(_0x55308a[_0xe299('0x97')][_0xe299('0x98')]!==_0xe299('0x99'))return;return _0x55308a[_0xe299('0x97')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0xe299('0x2c')](function(_0x4ddc2c){if(_[_0xe299('0x78')](_0x4ddc2c)){_0x3ca862[_0xe299('0x45')](_0xe299('0x9a'));_0x505a00[_0xe299('0x45')](_0xe299('0x9a'));}else{_0x3ca862['where'](_0xe299('0x9b'),_['map'](_0x4ddc2c,'id'));_0x505a00[_0xe299('0x45')](_0xe299('0x9b'),_[_0xe299('0x32')](_0x4ddc2c,'id'));}});})[_0xe299('0x2c')](function(){if(_0x55308a[_0xe299('0x97')][_0xe299('0x98')]==='agent'&&!_0x584db0&&!_0x55308a[_0xe299('0x3f')][_0xe299('0x95')])return[];return db[_0xe299('0x9c')][_0xe299('0x3f')](_0x3ca862[_0xe299('0x9d')](),_0x139c9c);})[_0xe299('0x2c')](function(_0x51ea85){_0x49736b[_0xe299('0x23')]=_0x51ea85[_0xe299('0x60')];if(_0x49736b[_0xe299('0x23')]===0x0)return[];return db[_0xe299('0x9c')][_0xe299('0x3f')](_0x3cb1c1[_0xe299('0x9d')](),_0x139c9c)[_0xe299('0x2c')](function(_0x445995){_0x1bb9be=_['keyBy'](_0x445995,'id');_0x139c9c=_[_0xe299('0x9e')](_0x139c9c,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x55308a[_0xe299('0x3f')]['fields']){_0x32baa8[_0xe299('0x42')][_0xe299('0x36')](function(_0x35012a){_0x505a00['field']('i.'+_0x35012a);});}else{_0x505a00[_0xe299('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe299('0x9f'));_0x505a00[_0xe299('0x47')]('a.key','Account.key');_0x505a00[_0xe299('0x47')](_0xe299('0xa0'),_0xe299('0xa1'));_0x505a00[_0xe299('0x47')](_0xe299('0xa2'),'contactName');_0x505a00[_0xe299('0x47')](_0xe299('0xa3'));_0x505a00[_0xe299('0x47')](_0xe299('0xa4'),_0xe299('0xa5'));_0x505a00[_0xe299('0x47')](_0xe299('0xa6'),_0xe299('0xa7'));_0x505a00[_0xe299('0x47')](_0xe299('0xa8'),_0xe299('0xa9'));_0x505a00['field'](_0xe299('0xaa'),_0xe299('0xab'));_0x505a00[_0xe299('0x47')](_0xe299('0xac'),'Contact.mobile');_0x505a00[_0xe299('0x47')](_0xe299('0xad'),'Contact.fax');_0x505a00[_0xe299('0x47')]('o.fullname','Owner.fullname');_0x505a00[_0xe299('0x47')](_0xe299('0xae'),_0xe299('0xaf'));_0x505a00[_0xe299('0x47')](_0xe299('0xb0'),_0xe299('0x34'));}if(_0x32baa8['limit'])_0x505a00['limit'](_0x32baa8[_0xe299('0x21')]);if(_0x32baa8[_0xe299('0x20')])_0x505a00[_0xe299('0x20')](_0x32baa8[_0xe299('0x20')]);return db[_0xe299('0x9c')][_0xe299('0x3f')](_0x505a00[_0xe299('0x9d')](),_0x139c9c);})[_0xe299('0x2c')](function(_0x46d9bd){if(_0x46d9bd[_0xe299('0x60')]>0x0)_0x157e06[_0xe299('0x45')](_0xe299('0xb1'),_[_0xe299('0x32')](_0x46d9bd,'id'));return db[_0xe299('0x9c')][_0xe299('0x3f')](_0x157e06[_0xe299('0x9d')](),_0x139c9c)[_0xe299('0x2c')](function(_0x2bac0d){var _0x4727c9=_[_0xe299('0xb2')](_0x2bac0d,_0xe299('0xb3'));var _0x3dedd4=[];_0x46d9bd[_0xe299('0x36')](function(_0xce9723){_0x3dedd4[_0xe299('0x37')](updateWhatsappInteraction(_0xce9723,_0x1bb9be,_0x4727c9));});return BPromise[_0xe299('0xb4')](_0x3dedd4);});});})['then'](function(_0x7c8823){_0x49736b[_0xe299('0xb5')]=_0x7c8823;return _0x49736b;})[_0xe299('0x2c')](respondWithFilteredResult(_0xa90784,_0x32baa8))[_0xe299('0xb6')](handleError(_0xa90784,null));};exports[_0xe299('0xb7')]=function(_0x4d3df6,_0x658a5d){var _0x351af8={'raw':![],'where':{'id':_0x4d3df6[_0xe299('0xb8')]['id']}},_0x30acad={};_0x30acad[_0xe299('0x3d')]=_[_0xe299('0x3e')](db[_0xe299('0x39')]['rawAttributes']);_0x30acad['query']=_[_0xe299('0x3e')](_0x4d3df6[_0xe299('0x3f')]);_0x30acad[_0xe299('0x40')]=_[_0xe299('0x41')](_0x30acad[_0xe299('0x3d')],_0x30acad[_0xe299('0x3f')]);_0x351af8[_0xe299('0x42')]=_[_0xe299('0x41')](_0x30acad[_0xe299('0x3d')],qs[_0xe299('0x43')](_0x4d3df6['query'][_0xe299('0x43')]));_0x351af8[_0xe299('0x42')]=_0x351af8['attributes'][_0xe299('0x60')]?_0x351af8['attributes']:_0x30acad['model'];if(_0x4d3df6['query'][_0xe299('0xb9')]){_0x351af8[_0xe299('0xba')]=[{'all':!![]}];}_0x351af8=_['merge']({},_0x351af8,_0x4d3df6[_0xe299('0xbb')]);return db[_0xe299('0x39')][_0xe299('0x61')](_0x351af8)['then'](handleEntityNotFound(_0x658a5d,null))['then'](respondWithResult(_0x658a5d,null))[_0xe299('0xb6')](handleError(_0x658a5d,null));};exports[_0xe299('0xbc')]=function(_0x466fea,_0x2e3a90){return db[_0xe299('0x39')]['create'](_0x466fea[_0xe299('0x75')],{})[_0xe299('0x2c')](respondWithResult(_0x2e3a90,0xc9))['catch'](handleError(_0x2e3a90,null));};exports[_0xe299('0x2a')]=function(_0x46dabb,_0x58416e){if(_0x46dabb[_0xe299('0x75')]['id']){delete _0x46dabb['body']['id'];}return db[_0xe299('0x39')][_0xe299('0x61')]({'where':{'id':_0x46dabb[_0xe299('0xb8')]['id']}})['then'](handleEntityNotFound(_0x58416e,null))[_0xe299('0x2c')](saveUpdates(_0x46dabb[_0xe299('0x75')],null))['then'](respondWithResult(_0x58416e,null))[_0xe299('0xb6')](handleError(_0x58416e,null));};exports[_0xe299('0x2b')]=function(_0x355f7c,_0x34bec2){return db[_0xe299('0x39')]['find']({'where':{'id':_0x355f7c['params']['id']}})[_0xe299('0x2c')](handleEntityNotFound(_0x34bec2,null))[_0xe299('0x2c')](removeEntity(_0x34bec2,null))[_0xe299('0xb6')](handleError(_0x34bec2,null));};exports['describe']=function(_0x3fc8c0,_0x254d87){return db[_0xe299('0x39')][_0xe299('0xbd')]()[_0xe299('0x2c')](respondWithResult(_0x254d87,null))[_0xe299('0xb6')](handleError(_0x254d87,null));};exports[_0xe299('0xbe')]=function(_0x1d674d,_0x4d2ab5,_0x5c5c55){return db[_0xe299('0xbf')][_0xe299('0x61')]({'where':{'id':_0x1d674d[_0xe299('0xb8')]['id']}})[_0xe299('0x2c')](handleEntityNotFound(_0x4d2ab5,null))['then'](function(_0x451355){if(_0x451355){return _0x451355[_0xe299('0xbe')](_0x1d674d[_0xe299('0x75')][_0xe299('0xc0')],_[_0xe299('0xc1')](_0x1d674d[_0xe299('0x75')],[_0xe299('0xc0'),'id'])||{});}})[_0xe299('0x2c')](respondWithResult(_0x4d2ab5,null))[_0xe299('0xb6')](handleError(_0x4d2ab5,null));};exports['getMessages']=function(_0x402b41,_0x4ea33f,_0x15d2bb){var _0x11f6af={'raw':![],'where':{}};var _0x3bc97d={};var _0x5c17c7={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xe299('0xc2')]({'where':{'id':_0x402b41['params']['id']}})[_0xe299('0x2c')](handleEntityNotFound(_0x4ea33f,null))[_0xe299('0x2c')](function(_0x2bcea2){if(_0x2bcea2){_0x3bc97d[_0xe299('0x3d')]=_[_0xe299('0x3e')](db[_0xe299('0xbf')]['rawAttributes']);_0x3bc97d[_0xe299('0x3f')]=_['keys'](_0x402b41[_0xe299('0x3f')]);_0x3bc97d[_0xe299('0x40')]=_[_0xe299('0x41')](_0x3bc97d[_0xe299('0x3d')],_0x3bc97d['query']);_0x11f6af[_0xe299('0x42')]=_[_0xe299('0x41')](_0x3bc97d[_0xe299('0x3d')],qs[_0xe299('0x43')](_0x402b41[_0xe299('0x3f')][_0xe299('0x43')]));_0x11f6af[_0xe299('0x42')]=_0x11f6af['attributes'][_0xe299('0x60')]?_0x11f6af[_0xe299('0x42')]:_0x3bc97d[_0xe299('0x3d')];if(!_0x402b41[_0xe299('0x3f')][_0xe299('0xc3')](_0xe299('0xc4'))){_0x11f6af[_0xe299('0x21')]=qs['limit'](_0x402b41['query'][_0xe299('0x21')]);_0x11f6af[_0xe299('0x20')]=qs[_0xe299('0x20')](_0x402b41[_0xe299('0x3f')][_0xe299('0x20')]);}_0x11f6af[_0xe299('0x90')]=qs['sort'](_0x402b41[_0xe299('0x3f')][_0xe299('0x44')]);_0x11f6af[_0xe299('0x45')]=qs[_0xe299('0x40')](_[_0xe299('0x46')](_0x402b41[_0xe299('0x3f')],_0x3bc97d[_0xe299('0x40')]));_0x11f6af[_0xe299('0x45')][_0xe299('0xb3')]=_0x2bcea2['id'];if(_0x402b41[_0xe299('0x3f')][_0xe299('0x85')]){_0x11f6af[_0xe299('0x45')]=_['merge'](_0x11f6af['where'],{'$or':_[_0xe299('0x32')](_0x11f6af[_0xe299('0x42')],function(_0x4da39e){var _0x30885c={};_0x30885c[_0x4da39e]={'$like':'%'+_0x402b41[_0xe299('0x3f')][_0xe299('0x85')]+'%'};return _0x30885c;})});}if(_0x402b41['query'][_0xe299('0xc5')]){var _0x26840a=_0x402b41[_0xe299('0x3f')][_0xe299('0xc5')][_0xe299('0x66')](',');var _0x416d95={};_0x416d95[_0x26840a[0x0]]={'$gte':moment(_0x26840a[0x1])['format'](_0xe299('0xc6'))};_0x11f6af['where']=_[_0xe299('0x9e')](_0x11f6af['where'],_0x416d95);}_0x11f6af=_['merge']({},_0x11f6af,_0x402b41[_0xe299('0xbb')]);return db[_0xe299('0xbf')]['count']({'where':_0x11f6af['where']})['then'](function(_0x15420b){_0x5c17c7[_0xe299('0x23')]=_0x15420b;if(_0x402b41['query']['includeAll']){_0x11f6af[_0xe299('0xba')]=[{'all':!![]}];}return db[_0xe299('0xbf')][_0xe299('0xc7')](_0x11f6af);})['then'](function(_0x16c032){_0x5c17c7[_0xe299('0xb5')]=_0x16c032;return _0x5c17c7;});}})[_0xe299('0x2c')](respondWithFilteredResult(_0x4ea33f,_0x11f6af))[_0xe299('0xb6')](handleError(_0x4ea33f,null));};exports[_0xe299('0xc8')]=function(_0x237c0d,_0x28d867,_0x28ceb7){return db[_0xe299('0x39')][_0xe299('0x61')]({'where':{'id':_0x237c0d[_0xe299('0xb8')]['id']}})[_0xe299('0x2c')](handleEntityNotFound(_0x28d867,null))[_0xe299('0x2c')](function(_0x21c4ea){if(_0x21c4ea){return _0x21c4ea['setTags'](_0x237c0d[_0xe299('0x75')]['ids'],_[_0xe299('0xc1')](_0x237c0d[_0xe299('0x75')],[_0xe299('0xc0'),'id'])||{})[_0xe299('0xc9')](function(){return db[_0xe299('0x6d')][_0xe299('0xc7')]({'attributes':['id',_0xe299('0x2f'),'color'],'where':{'id':_0x237c0d[_0xe299('0x75')][_0xe299('0xc0')]}});})[_0xe299('0x2c')](function(_0x58f756){socket[_0xe299('0xca')](_0xe299('0xcb'),{'id':Number(_0x237c0d[_0xe299('0xb8')]['id']),'tags':_0x58f756||[]});return{'id':Number(_0x237c0d['params']['id']),'tags':_0x58f756||[]};});}})[_0xe299('0x2c')](respondWithResult(_0x28d867,null))['catch'](handleError(_0x28d867,null));};exports['removeTags']=function(_0x5ab1e8,_0x3b9f28,_0x31c11f){return db['WhatsappInteraction'][_0xe299('0x61')]({'where':{'id':_0x5ab1e8[_0xe299('0xb8')]['id']}})[_0xe299('0x2c')](handleEntityNotFound(_0x3b9f28,null))[_0xe299('0x2c')](function(_0x360c43){if(_0x360c43){return _0x360c43[_0xe299('0xcc')](_0x5ab1e8[_0xe299('0x3f')][_0xe299('0xc0')]);}})[_0xe299('0x2c')](respondWithStatusCode(_0x3b9f28,null))['catch'](handleError(_0x3b9f28,null));};exports[_0xe299('0xcd')]=function(_0xa97664,_0xc6c19c){var _0x4934cc=moment()[_0xe299('0xce')]()['toString']();var _0x597a14=path[_0xe299('0xcf')](config[_0xe299('0xd0')],_0xe299('0xd1'),_0xe299('0xd2'),_0xe299('0xd3'));var _0x1b2d5b=path[_0xe299('0xcf')](config[_0xe299('0xd0')],_0xe299('0xd1'),'files','attachments');var _0x26731c=path[_0xe299('0xcf')](_0x597a14,_0x4934cc);var _0x310e54=util[_0xe299('0xd4')]('transcript-%d-%s.zip',_0xa97664['params']['id'],_0x4934cc);var _0x35fd78=path[_0xe299('0xcf')](_0x597a14,_0x310e54);var _0x33b4a0=[];_0x33b4a0[_0xe299('0x37')]({'model':db[_0xe299('0x6f')],'as':_0xe299('0x6f'),'attributes':['id',_0xe299('0x33')],'raw':!![]});_0x33b4a0['push']({'model':db[_0xe299('0xd5')],'as':_0xe299('0xd6'),'attributes':['id',_0xe299('0xd7'),_0xe299('0xd8')],'raw':!![]});if(_0xa97664['query'][_0xe299('0xd9')]){_0x33b4a0[_0xe299('0x37')]({'model':db[_0xe299('0xda')],'as':_0xe299('0xda'),'raw':!![]});}var _0xc653bf=[{'model':db['WhatsappMessage'],'as':_0xe299('0xdb'),'attributes':['id','body',_0xe299('0x7a'),'direction',_0xe299('0xdc'),_0xe299('0x80')],'include':_0x33b4a0}];_0xc653bf['push']({'model':db[_0xe299('0xdd')],'as':_0xe299('0xde'),'attributes':['id','name']});_0xc653bf['push']({'model':db[_0xe299('0x6f')],'as':_0xe299('0xdf'),'attributes':['id',_0xe299('0x33')]});return db[_0xe299('0x39')]['find']({'where':{'id':_0xa97664[_0xe299('0xb8')]['id']},'include':_0xc653bf})[_0xe299('0x2c')](handleEntityNotFound(_0xc6c19c,null))[_0xe299('0x2c')](function(_0x2fb67c){if(_0x2fb67c){var _0x3e4895=_0x2fb67c['get']({'plain':!![]});fs[_0xe299('0xe0')](_0x26731c);var _0x39de63={'channel':_0xe299('0xe1'),'account':_0x3e4895[_0xe299('0xde')][_0xe299('0x2f')],'agent':_0x3e4895[_0xe299('0xdf')]?_0x3e4895[_0xe299('0xdf')][_0xe299('0x33')]:'N.A.','createdAt':moment(_0x3e4895['createdAt'])[_0xe299('0xd4')](_0xe299('0xc6'))[_0xe299('0x9d')](),'closedAt':_0x3e4895[_0xe299('0xe2')]?moment(_0x3e4895[_0xe299('0xe3')])[_0xe299('0xd4')](_0xe299('0xc6'))[_0xe299('0x9d')]():'','disposition':_0x3e4895['disposition'],'messages':_(_0x3e4895[_0xe299('0xdb')])[_0xe299('0x85')]({'secret':![]})['map'](function(_0x203fd0){if(_0x203fd0[_0xe299('0xda')]){var _0xbf563a=path[_0xe299('0xcf')](_0x1b2d5b,_0x203fd0[_0xe299('0xda')][_0xe299('0xe4')]);if(fs['existsSync'](_0xbf563a)){fs['createReadStream'](_0xbf563a)[_0xe299('0xe5')](fs[_0xe299('0xe6')](path['join'](_0x26731c,_0x203fd0['Attachment'][_0xe299('0xe4')])));}}return{'date':moment(_0x203fd0[_0xe299('0x7a')])[_0xe299('0xd4')](_0xe299('0xc6'))[_0xe299('0x9d')](),'sender':_0x203fd0[_0xe299('0xe7')]===_0xe299('0xe8')?_0x203fd0[_0xe299('0x6f')]?_0x203fd0[_0xe299('0x6f')][_0xe299('0x33')]:'System':_0x203fd0[_0xe299('0xd6')][_0xe299('0xd7')]+(_0x203fd0['Contact'][_0xe299('0xd8')]?'\x20'+_0x203fd0[_0xe299('0xd6')]['lastName']:''),'body':_0x203fd0['Attachment']?_0x203fd0[_0xe299('0xda')][_0xe299('0xe4')]:_0x203fd0[_0xe299('0x75')],'direction':_0x203fd0[_0xe299('0xe7')]===_0xe299('0xe8')?'A':'C','secret':_0x203fd0[_0xe299('0xdc')],'read':_0x203fd0[_0xe299('0x80')],'attachment':_0x203fd0[_0xe299('0xda')]};})[_0xe299('0x62')]()};return ejs[_0xe299('0xe9')](path[_0xe299('0xcf')](config[_0xe299('0xd0')],'server',_0xe299('0xea'),_0xe299('0xeb')),{'interaction':_0x39de63})[_0xe299('0x2c')](function(_0x35b8e1){var _0x1e40e3=path['join'](_0x26731c,_0xe299('0xec')+_0x3e4895['id']+'-'+_0x4934cc+_0xe299('0xed'));var _0x119a2f={'path':_0x1e40e3,'channel':_0xe299('0xe1'),'interactionId':_0x3e4895['id']};return pdf[_0xe299('0xee')](_0x35b8e1,_0x119a2f);})[_0xe299('0x2c')](function(){return new BPromise(function(_0xcffcd6,_0x1578be){zipdir(_0x26731c,{'saveTo':_0x35fd78},function(_0x1da1bb,_0x26ca0c){if(_0x1da1bb)return _0x1578be(_0x1da1bb);return _0xcffcd6(_0x26ca0c);});})[_0xe299('0x2c')](function(){return new BPromise(function(_0x57899c,_0x25d43d){rimraf(_0x26731c,function(_0x4d7f3c){if(_0x4d7f3c)_0x25d43d(_0x4d7f3c);return _0x57899c();});});})[_0xe299('0x2c')](function(){return _0xc6c19c[_0xe299('0xcd')](_0x35fd78,_0x310e54,function(_0x40e167){if(_0x40e167){console[_0xe299('0xef')](_0xe299('0xf0'),_0x40e167);}else{fs[_0xe299('0xf1')](_0x35fd78);}});});});}else{return _0xc6c19c[_0xe299('0x1d')](0xc8);}})[_0xe299('0xb6')](handleError(_0xc6c19c,null));}; \ No newline at end of file +var _0x7898=['CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','WhatsappAccountId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','params','includeAll','options','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','rawAttributes','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','setTags','spread','color','emit','whatsappInteractionTags:save','removeTags','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Attachment','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','log','err','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','name','Users','map','fullname','TagIds','Tags','push','catch','WhatsappInteraction','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','select','field','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x7898,0x7e));var _0x8789=function(_0xf7224d,_0x2b8c21){_0xf7224d=_0xf7224d-0x0;var _0x525740=_0x7898[_0xf7224d];return _0x525740;};'use strict';var emlformat=require(_0x8789('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8789('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8789('0x2'));var moment=require(_0x8789('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8789('0x4'));var util=require('util');var path=require(_0x8789('0x5'));var sox=require(_0x8789('0x6'));var csv=require(_0x8789('0x7'));var ejs=require(_0x8789('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8789('0x9'));var squel=require(_0x8789('0xa'));var crypto=require(_0x8789('0xb'));var jsforce=require(_0x8789('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8789('0x7'));var querystring=require('querystring');var Papa=require(_0x8789('0xd'));var Redis=require(_0x8789('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8789('0xf'));var pdf=require(_0x8789('0x10'));var hardwareService=require(_0x8789('0x11'));var logger=require('../../config/logger')(_0x8789('0x12'));var utils=require(_0x8789('0x13'));var config=require(_0x8789('0x14'));var licenseUtil=require(_0x8789('0x15'));var db=require(_0x8789('0x16'))['db'];config[_0x8789('0x17')]=_[_0x8789('0x18')](config[_0x8789('0x17')],{'host':_0x8789('0x19'),'port':0x18eb});var socket=require(_0x8789('0x1a'))(new Redis(config[_0x8789('0x17')]));require(_0x8789('0x1b'))[_0x8789('0x1c')](socket);function respondWithStatusCode(_0x22d632,_0x1359cd){_0x1359cd=_0x1359cd||0xcc;return function(_0x1b2006){if(_0x1b2006){return _0x22d632['sendStatus'](_0x1359cd);}return _0x22d632[_0x8789('0x1d')](_0x1359cd)[_0x8789('0x1e')]();};}function respondWithResult(_0x2fbf2c,_0x403735){_0x403735=_0x403735||0xc8;return function(_0xc5d101){if(_0xc5d101){return _0x2fbf2c[_0x8789('0x1d')](_0x403735)[_0x8789('0x1f')](_0xc5d101);}};}function respondWithFilteredResult(_0x579ed2,_0x15d861){return function(_0x5ed807){if(_0x5ed807){var _0x1bf483=typeof _0x15d861[_0x8789('0x20')]==='undefined'&&typeof _0x15d861[_0x8789('0x21')]===_0x8789('0x22');var _0x49521b=_0x5ed807[_0x8789('0x23')];var _0x413495=_0x1bf483?0x0:_0x15d861[_0x8789('0x20')];var _0x1499d9=_0x1bf483?_0x5ed807['count']:_0x15d861[_0x8789('0x20')]+_0x15d861['limit'];var _0x55912b;if(_0x1499d9>=_0x49521b){_0x1499d9=_0x49521b;_0x55912b=0xc8;}else{_0x55912b=0xce;}_0x579ed2[_0x8789('0x1d')](_0x55912b);return _0x579ed2[_0x8789('0x24')](_0x8789('0x25'),_0x413495+'-'+_0x1499d9+'/'+_0x49521b)[_0x8789('0x1f')](_0x5ed807);}return null;};}function patchUpdates(_0x2214ce){return function(_0x3a17b8){try{jsonpatch[_0x8789('0x26')](_0x3a17b8,_0x2214ce,!![]);}catch(_0x5ecc8d){return BPromise['reject'](_0x5ecc8d);}return _0x3a17b8[_0x8789('0x27')]();};}function saveUpdates(_0x3c3400,_0x3eadb4){return function(_0xce504){if(_0xce504){return _0xce504[_0x8789('0x28')](_0x3c3400)[_0x8789('0x29')](function(_0x1c2ad4){return _0x1c2ad4;});}return null;};}function removeEntity(_0x44c6d5,_0xa448db){return function(_0x417cc1){if(_0x417cc1){return _0x417cc1[_0x8789('0x2a')]()[_0x8789('0x29')](function(){_0x44c6d5[_0x8789('0x1d')](0xcc)[_0x8789('0x1e')]();});}};}function handleEntityNotFound(_0x3450e8,_0x3d2f98){return function(_0x42f0a8){if(!_0x42f0a8){_0x3450e8['sendStatus'](0x194);}return _0x42f0a8;};}function handleError(_0x4cb5f4,_0x506308){_0x506308=_0x506308||0x1f4;return function(_0x5199c3){logger['error'](_0x5199c3[_0x8789('0x2b')]);if(_0x5199c3[_0x8789('0x2c')]){delete _0x5199c3[_0x8789('0x2c')];}_0x4cb5f4[_0x8789('0x1d')](_0x506308)['send'](_0x5199c3);};}function getInteractionUsers(_0x160f98,_0x2a7b7a){return new BPromise(function(_0x5152c7,_0x2269cb){try{if(_0x2a7b7a[_0x160f98['id']]){_0x160f98[_0x8789('0x2d')]=_[_0x8789('0x2e')](_0x2a7b7a[_0x160f98['id']],function(_0x421e49){return{'id':_0x421e49['id'],'fullname':_0x421e49[_0x8789('0x2f')]};});}}catch(_0x4d26ec){_0x2269cb(_0x4d26ec);}_0x5152c7(_0x160f98);});}function getInteractionTags(_0xa639aa,_0x278415){return new BPromise(function(_0x3f59de,_0x4fbc2a){try{if(_0xa639aa[_0x8789('0x30')]){_0xa639aa[_0x8789('0x31')]=[];_0xa639aa[_0x8789('0x30')]['split'](',')['forEach'](function(_0x29c8c8){_0xa639aa[_0x8789('0x31')][_0x8789('0x32')](_0x278415[_0x29c8c8]);});}delete _0xa639aa[_0x8789('0x30')];}catch(_0x3a0884){_0x4fbc2a(_0x3a0884);}_0x3f59de(_0xa639aa);});}function updateWhatsappInteraction(_0x2252bd,_0x8b9046,_0x52c5bd){return new BPromise(function(_0x40f314,_0x5a551f){return getInteractionUsers(_0x2252bd,_0x52c5bd)['then'](function(_0x45f68f){return getInteractionTags(_0x45f68f,_0x8b9046);})[_0x8789('0x29')](function(_0x3f2e65){_0x40f314(_0x3f2e65);})[_0x8789('0x33')](function(_0x34546c){_0x5a551f(_0x34546c);});});}exports['index']=function(_0x10e2b1,_0x2febf1){var _0xea6ba4={},_0x313311={},_0x2069cc={'count':0x0,'rows':[]};var _0x1678df=_[_0x8789('0x2e')](db[_0x8789('0x34')]['rawAttributes'],function(_0x2e2ce2){return{'name':_0x2e2ce2['fieldName'],'type':_0x2e2ce2[_0x8789('0x35')][_0x8789('0x36')]};});_0x313311['model']=_[_0x8789('0x2e')](_0x1678df,_0x8789('0x2c'));_0x313311[_0x8789('0x37')]=_[_0x8789('0x38')](_0x10e2b1[_0x8789('0x37')]);_0x313311[_0x8789('0x39')]=_[_0x8789('0x3a')](_0x313311['model'],_0x313311[_0x8789('0x37')]);_0xea6ba4[_0x8789('0x3b')]=_[_0x8789('0x3a')](_0x313311[_0x8789('0x3c')],qs[_0x8789('0x3d')](_0x10e2b1[_0x8789('0x37')][_0x8789('0x3d')]));_0xea6ba4['attributes']=_0xea6ba4[_0x8789('0x3b')][_0x8789('0x3e')]?_0xea6ba4[_0x8789('0x3b')]:_0x313311[_0x8789('0x3c')];if(!_0x10e2b1[_0x8789('0x37')]['hasOwnProperty'](_0x8789('0x3f'))){_0xea6ba4[_0x8789('0x21')]=qs['limit'](_0x10e2b1[_0x8789('0x37')][_0x8789('0x21')]);_0xea6ba4['offset']=qs[_0x8789('0x20')](_0x10e2b1['query'][_0x8789('0x20')]);}_0xea6ba4[_0x8789('0x40')]=qs[_0x8789('0x41')](_0x10e2b1[_0x8789('0x37')][_0x8789('0x41')]);_0xea6ba4[_0x8789('0x42')]=qs[_0x8789('0x39')](_[_0x8789('0x43')](_0x10e2b1[_0x8789('0x37')],_0x313311['filters']),_0x1678df);var _0x332a89=[];var _0x230f9d=squel[_0x8789('0x44')]()[_0x8789('0x45')]('id')[_0x8789('0x45')](_0x8789('0x2c'))[_0x8789('0x45')]('color')['from'](_0x8789('0x46'));var _0x11b8ff=squel[_0x8789('0x44')]()[_0x8789('0x45')](_0x8789('0x47'))['field'](_0x8789('0x48'))[_0x8789('0x45')](_0x8789('0x49'))[_0x8789('0x4a')](_0x8789('0x4b'),'ui')['left_join'](_0x8789('0x4c'),'u',_0x8789('0x4d'));var _0x130e62=squel[_0x8789('0x44')]()[_0x8789('0x4a')](_0x8789('0x4e'),'i')[_0x8789('0x4f')](_0x8789('0x50'),'c',_0x8789('0x51'))[_0x8789('0x4f')](_0x8789('0x4c'),'o','o.id\x20=\x20i.UserId')[_0x8789('0x4f')]('whatsapp_accounts','a',_0x8789('0x52'))[_0x8789('0x4f')]('whatsapp_messages','me',_0x8789('0x53'))[_0x8789('0x4f')](_0x8789('0x54'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x8789('0x4f')]('tools_tags','t',_0x8789('0x55'));var _0x3681eb=squel[_0x8789('0x56')]();var _0x2b18d4=[];var _0x2ea92d=squel['expr']();var _0x44e915;if(_0x10e2b1[_0x8789('0x37')]['search']){_0x44e915=as[_0x8789('0x57')](_0x10e2b1['query'][_0x8789('0x58')]);var _0x4feb57=_0x44e915[_0x8789('0x59')];for(var _0x371e40=0x0;_0x371e40<_0x44e915['conditions'][_0x8789('0x3e')];_0x371e40++){var _0x15a98b=_0x44e915[_0x8789('0x5a')][_0x371e40];var _0x31b60d='i';var _0x4b6cb5=_[_0x8789('0x5b')](_0x1678df,[_0x8789('0x2c'),_0x15a98b[_0x8789('0x45')]]);if(!_0x4b6cb5){switch(_0x15a98b[_0x8789('0x45')]){case _0x8789('0x5c'):if(_0x15a98b[_0x8789('0x5d')]==0x1){_0x130e62['having']('`'+_0x15a98b[_0x8789('0x45')]+_0x8789('0x5e'));}else{_0x130e62['having']('`'+_0x15a98b[_0x8789('0x45')]+_0x8789('0x5f'));}break;case'Contact':if(_0x15a98b[_0x8789('0x60')]===_0x8789('0x61')){if(_0x15a98b[_0x8789('0x5d')][_0x8789('0x62')]('\x20')['length']>0x1){_0x3681eb[_0x4feb57](_0x8789('0x63'),qs[_0x8789('0x64')](_0x15a98b[_0x8789('0x5d')]),null);}else{var _0x5efccb='%'+_0x15a98b[_0x8789('0x5d')]+'%';_0x3681eb[_0x4feb57](_0x8789('0x65'),_0x5efccb,_0x5efccb,_0x5efccb);}}else{_0x4b6cb5=_[_0x8789('0x5b')](_0x1678df,['name',_0x8789('0x66')]);_0x15a98b[_0x8789('0x45')]=_0x8789('0x66');_0x46052c=as[_0x8789('0x67')](_0x31b60d,_0x4b6cb5[_0x8789('0x35')],_0x15a98b);_0x3681eb[_0x4feb57](_0x46052c[_0x8789('0x68')],_0x46052c[_0x8789('0x5d')][_0x8789('0x69')],_0x46052c[_0x8789('0x5d')][_0x8789('0x1e')]);}break;case _0x8789('0x6a'):var _0x61bb0=_0x15a98b[_0x8789('0x5d')][_0x8789('0x62')](',')[_0x8789('0x2e')](function(_0x1af69d){return Number(_0x1af69d);});_0x61bb0[_0x8789('0x6b')](function(_0x1fa178){_0x2ea92d['or'](_0x8789('0x6c'),'%,'+_0x1fa178+',%');});_0x2b18d4=_[_0x8789('0x6d')](_0x2b18d4,_0x61bb0);break;case _0x8789('0x6e'):if(_0x15a98b[_0x8789('0x60')]===_0x8789('0x61')){_0x3681eb[_0x4feb57](_0x8789('0x6f'),'%'+_0x15a98b['value']+'%',null);}else{_0x4b6cb5=_[_0x8789('0x5b')](_0x1678df,['name',_0x8789('0x70')]);_0x15a98b[_0x8789('0x45')]=_0x8789('0x70');_0x46052c=as[_0x8789('0x67')](_0x31b60d,_0x4b6cb5[_0x8789('0x35')],_0x15a98b);_0x3681eb[_0x4feb57](_0x46052c[_0x8789('0x68')],_0x46052c[_0x8789('0x5d')][_0x8789('0x69')],_0x46052c[_0x8789('0x5d')][_0x8789('0x1e')]);}break;case _0x8789('0x71'):_0x46052c=as['buildExpression']('me',null,_0x15a98b);_0x3681eb[_0x4feb57](_0x46052c[_0x8789('0x68')],_0x46052c[_0x8789('0x5d')][_0x8789('0x69')],_0x46052c['value'][_0x8789('0x1e')]);break;}}else{var _0x46052c=as[_0x8789('0x67')](_0x31b60d,_0x4b6cb5[_0x8789('0x35')],_0x15a98b);_0x3681eb[_0x4feb57](_0x46052c['text'],_0x46052c[_0x8789('0x5d')]['start'],_0x46052c[_0x8789('0x5d')]['end']);}}}else{var _0x85a4cb=_(_0x10e2b1[_0x8789('0x37')])['keys']()[_0x8789('0x2e')](function(_0xda98d6){return _['some'](_0x1678df,[_0x8789('0x2c'),_0xda98d6])?_0xda98d6:undefined;})[_0x8789('0x72')]()[_0x8789('0x5d')]();if(!_[_0x8789('0x73')](_0x85a4cb)){_0x85a4cb[_0x8789('0x6b')](function(_0x20b0f1){if(_0x20b0f1===_0x8789('0x74')){_0x130e62['where']('i.WhatsappAccountId\x20IN\x20?',[][_0x8789('0x75')](_0x10e2b1[_0x8789('0x37')][_0x20b0f1]));}else if(_0x20b0f1===_0x8789('0x76')){var _0x288fc7=JSON['parse'](_0x10e2b1['query'][_0x20b0f1])[_0x8789('0x77')];var _0x892d92=JSON[_0x8789('0x78')](_0x10e2b1[_0x8789('0x37')][_0x20b0f1])[_0x8789('0x79')];_0x130e62[_0x8789('0x42')](_0x8789('0x7a'),_0x288fc7,_0x892d92);}else{if(_0x10e2b1['query'][_0x20b0f1]===_0x8789('0x7b')){_0x130e62['where']('i.'+_0x20b0f1+_0x8789('0x7c'));}else{_0x130e62['where']('i.'+_0x20b0f1+_0x8789('0x7d'),_0x10e2b1[_0x8789('0x37')][_0x20b0f1]);}}});}if(_0x10e2b1[_0x8789('0x37')]['read']){if(_0x10e2b1[_0x8789('0x37')][_0x8789('0x7e')]==0x1){_0x130e62[_0x8789('0x7f')](_0x8789('0x80'));}else{_0x130e62[_0x8789('0x7f')](_0x8789('0x81'));}}if(_0x10e2b1[_0x8789('0x37')][_0x8789('0x82')]){_0x2b18d4=_['isArray'](_0x10e2b1[_0x8789('0x37')][_0x8789('0x82')])?_0x10e2b1[_0x8789('0x37')][_0x8789('0x82')]:new Array(_0x10e2b1[_0x8789('0x37')][_0x8789('0x82')]);_0x2b18d4[_0x8789('0x6b')](function(_0x347953){_0x2ea92d['or'](_0x8789('0x6c'),'%,'+_0x347953+',%');});}if(_0x10e2b1['query'][_0x8789('0x83')]){var _0x2c4f0e=_0x10e2b1[_0x8789('0x37')][_0x8789('0x83')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2c4f0e)){_0x3681eb['or'](_0x8789('0x84'),_0x2c4f0e+'%')['or'](_0x8789('0x85'),_0x2c4f0e+'%');}else{_0x3681eb['or'](_0x8789('0x86'),qs[_0x8789('0x64')](_0x2c4f0e))['or'](_0x8789('0x87'),_0x2c4f0e+'%');}}}_0x130e62['where'](_0x3681eb);_0x130e62[_0x8789('0x88')](_0x8789('0x89'));var _0x38797c={'type':db[_0x8789('0x8a')]['QueryTypes'][_0x8789('0x8b')],'raw':!![]};var _0x28a0ab=_0x130e62[_0x8789('0x8c')]();_0x28a0ab[_0x8789('0x45')](_0x8789('0x89'));_0x28a0ab[_0x8789('0x45')](_0x8789('0x8d'),_0x8789('0x5c'));if(_0xea6ba4[_0x8789('0x40')]){_0xea6ba4['order'][_0x8789('0x6b')](function(_0x314bc9){var _0x21e2f5=_0x314bc9[0x0]===_0x8789('0x8e')?_0x314bc9[0x0]:'i.'+_0x314bc9[0x0];_0x130e62['order'](_0x21e2f5,_0x314bc9[0x1]===_0x8789('0x8f')?![]:!![]);});}if(!_[_0x8789('0x73')](_0x2b18d4)){_0x130e62['having'](_0x2ea92d);_0x28a0ab[_0x8789('0x42')](_0x8789('0x90'),_0x2b18d4);}BPromise[_0x8789('0x91')]()['then'](function(){if(!_0x44e915){if(_0x10e2b1[_0x8789('0x37')][_0x8789('0x74')])return;_0x28a0ab['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x130e62[_0x8789('0x42')](_0x8789('0x92'));return;}if(_0x10e2b1[_0x8789('0x93')][_0x8789('0x94')]!=='agent')return;return _0x10e2b1[_0x8789('0x93')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x8789('0x29')](function(_0x1a3f66){if(_[_0x8789('0x73')](_0x1a3f66)){_0x28a0ab['where'](_0x8789('0x95'));_0x130e62[_0x8789('0x42')](_0x8789('0x95'));}else{_0x28a0ab['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x8789('0x2e')](_0x1a3f66,'id'));_0x130e62[_0x8789('0x42')](_0x8789('0x96'),_[_0x8789('0x2e')](_0x1a3f66,'id'));}});})['then'](function(){if(_0x10e2b1[_0x8789('0x93')][_0x8789('0x94')]===_0x8789('0x97')&&!_0x44e915&&!_0x10e2b1[_0x8789('0x37')][_0x8789('0x74')])return[];return db[_0x8789('0x98')][_0x8789('0x37')](_0x28a0ab['toString'](),_0x38797c);})[_0x8789('0x29')](function(_0x379e90){_0x2069cc[_0x8789('0x23')]=_0x379e90[_0x8789('0x3e')];if(_0x2069cc[_0x8789('0x23')]===0x0)return[];return db[_0x8789('0x98')][_0x8789('0x37')](_0x230f9d[_0x8789('0x99')](),_0x38797c)['then'](function(_0x4736c1){_0x332a89=_[_0x8789('0x9a')](_0x4736c1,'id');_0x38797c=_[_0x8789('0x9b')](_0x38797c,{'model':db[_0x8789('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10e2b1[_0x8789('0x37')][_0x8789('0x3d')]){_0xea6ba4['attributes'][_0x8789('0x6b')](function(_0x1f9948){_0x130e62[_0x8789('0x45')]('i.'+_0x1f9948);});}else{_0x130e62[_0x8789('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8789('0x5c'));_0x130e62[_0x8789('0x45')]('a.key',_0x8789('0x9c'));_0x130e62[_0x8789('0x45')]('a.mandatoryDisposition',_0x8789('0x9d'));_0x130e62[_0x8789('0x45')](_0x8789('0x9e'),_0x8789('0x8e'));_0x130e62[_0x8789('0x45')]('i.*');_0x130e62[_0x8789('0x45')]('c.firstName',_0x8789('0x9f'));_0x130e62[_0x8789('0x45')](_0x8789('0xa0'),_0x8789('0xa1'));_0x130e62[_0x8789('0x45')](_0x8789('0xa2'),_0x8789('0xa3'));_0x130e62[_0x8789('0x45')](_0x8789('0xa4'),'Contact.phone');_0x130e62[_0x8789('0x45')](_0x8789('0xa5'),_0x8789('0xa6'));_0x130e62[_0x8789('0x45')](_0x8789('0xa7'),'Contact.fax');_0x130e62['field'](_0x8789('0xa8'),_0x8789('0xa9'));_0x130e62[_0x8789('0x45')](_0x8789('0xaa'),_0x8789('0xab'));_0x130e62[_0x8789('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8789('0x30'));}if(_0xea6ba4['limit'])_0x130e62[_0x8789('0x21')](_0xea6ba4[_0x8789('0x21')]);if(_0xea6ba4[_0x8789('0x20')])_0x130e62[_0x8789('0x20')](_0xea6ba4['offset']);return db[_0x8789('0x98')][_0x8789('0x37')](_0x130e62[_0x8789('0x99')](),_0x38797c);})['then'](function(_0x5d602c){if(_0x5d602c[_0x8789('0x3e')]>0x0)_0x11b8ff[_0x8789('0x42')](_0x8789('0xac'),_['map'](_0x5d602c,'id'));return db[_0x8789('0x98')][_0x8789('0x37')](_0x11b8ff['toString'](),_0x38797c)[_0x8789('0x29')](function(_0x1c1c3e){var _0x2f2dbe=_[_0x8789('0xad')](_0x1c1c3e,_0x8789('0xae'));var _0x5e10e4=[];_0x5d602c[_0x8789('0x6b')](function(_0x8b9a77){_0x5e10e4[_0x8789('0x32')](updateWhatsappInteraction(_0x8b9a77,_0x332a89,_0x2f2dbe));});return BPromise[_0x8789('0xaf')](_0x5e10e4);});});})[_0x8789('0x29')](function(_0x5352b2){_0x2069cc[_0x8789('0xb0')]=_0x5352b2;return _0x2069cc;})[_0x8789('0x29')](respondWithFilteredResult(_0x2febf1,_0xea6ba4))['catch'](handleError(_0x2febf1,null));};exports['show']=function(_0x57492b,_0x38e7e6){var _0x3a1454={'raw':![],'where':{'id':_0x57492b[_0x8789('0xb1')]['id']}},_0x28d6b4={};_0x28d6b4['model']=_[_0x8789('0x38')](db[_0x8789('0x34')]['rawAttributes']);_0x28d6b4[_0x8789('0x37')]=_[_0x8789('0x38')](_0x57492b['query']);_0x28d6b4[_0x8789('0x39')]=_[_0x8789('0x3a')](_0x28d6b4['model'],_0x28d6b4[_0x8789('0x37')]);_0x3a1454[_0x8789('0x3b')]=_['intersection'](_0x28d6b4[_0x8789('0x3c')],qs['fields'](_0x57492b[_0x8789('0x37')][_0x8789('0x3d')]));_0x3a1454[_0x8789('0x3b')]=_0x3a1454['attributes'][_0x8789('0x3e')]?_0x3a1454['attributes']:_0x28d6b4[_0x8789('0x3c')];if(_0x57492b['query'][_0x8789('0xb2')]){_0x3a1454['include']=[{'all':!![]}];}_0x3a1454=_[_0x8789('0x9b')]({},_0x3a1454,_0x57492b[_0x8789('0xb3')]);return db['WhatsappInteraction'][_0x8789('0x5b')](_0x3a1454)[_0x8789('0x29')](handleEntityNotFound(_0x38e7e6,null))['then'](respondWithResult(_0x38e7e6,null))['catch'](handleError(_0x38e7e6,null));};exports['create']=function(_0x184e9d,_0x152c67){return db['WhatsappInteraction']['create'](_0x184e9d['body'],{})[_0x8789('0x29')](respondWithResult(_0x152c67,0xc9))[_0x8789('0x33')](handleError(_0x152c67,null));};exports[_0x8789('0x28')]=function(_0xacbecf,_0x5c1cbb){if(_0xacbecf[_0x8789('0x71')]['id']){delete _0xacbecf[_0x8789('0x71')]['id'];}return db[_0x8789('0x34')][_0x8789('0x5b')]({'where':{'id':_0xacbecf[_0x8789('0xb1')]['id']}})['then'](handleEntityNotFound(_0x5c1cbb,null))[_0x8789('0x29')](saveUpdates(_0xacbecf[_0x8789('0x71')],null))['then'](respondWithResult(_0x5c1cbb,null))['catch'](handleError(_0x5c1cbb,null));};exports['destroy']=function(_0x1f7995,_0xa1497a){return db[_0x8789('0x34')][_0x8789('0x5b')]({'where':{'id':_0x1f7995[_0x8789('0xb1')]['id']}})['then'](handleEntityNotFound(_0xa1497a,null))['then'](removeEntity(_0xa1497a,null))[_0x8789('0x33')](handleError(_0xa1497a,null));};exports[_0x8789('0xb4')]=function(_0xf714ad,_0x18a1c7){return db['WhatsappInteraction'][_0x8789('0xb4')]()[_0x8789('0x29')](respondWithResult(_0x18a1c7,null))[_0x8789('0x33')](handleError(_0x18a1c7,null));};exports[_0x8789('0xb5')]=function(_0x3e07f6,_0x3931e7,_0x22ff41){return db['WhatsappMessage']['find']({'where':{'id':_0x3e07f6[_0x8789('0xb1')]['id']}})[_0x8789('0x29')](handleEntityNotFound(_0x3931e7,null))[_0x8789('0x29')](function(_0x4b725f){if(_0x4b725f){return _0x4b725f['addMessage'](_0x3e07f6['body'][_0x8789('0xb6')],_[_0x8789('0xb7')](_0x3e07f6[_0x8789('0x71')],[_0x8789('0xb6'),'id'])||{});}})[_0x8789('0x29')](respondWithResult(_0x3931e7,null))[_0x8789('0x33')](handleError(_0x3931e7,null));};exports[_0x8789('0xb8')]=function(_0x693aa1,_0x52832f,_0x5d9f9a){var _0x19ea28={'raw':![],'where':{}};var _0x26ad94={};var _0x354e98={'count':0x0,'rows':[]};return db[_0x8789('0x34')][_0x8789('0xb9')]({'where':{'id':_0x693aa1[_0x8789('0xb1')]['id']}})[_0x8789('0x29')](handleEntityNotFound(_0x52832f,null))[_0x8789('0x29')](function(_0x29f8bd){if(_0x29f8bd){_0x26ad94[_0x8789('0x3c')]=_[_0x8789('0x38')](db[_0x8789('0xba')][_0x8789('0xbb')]);_0x26ad94[_0x8789('0x37')]=_[_0x8789('0x38')](_0x693aa1['query']);_0x26ad94['filters']=_[_0x8789('0x3a')](_0x26ad94[_0x8789('0x3c')],_0x26ad94[_0x8789('0x37')]);_0x19ea28['attributes']=_['intersection'](_0x26ad94[_0x8789('0x3c')],qs[_0x8789('0x3d')](_0x693aa1[_0x8789('0x37')][_0x8789('0x3d')]));_0x19ea28[_0x8789('0x3b')]=_0x19ea28['attributes'][_0x8789('0x3e')]?_0x19ea28[_0x8789('0x3b')]:_0x26ad94[_0x8789('0x3c')];if(!_0x693aa1[_0x8789('0x37')][_0x8789('0xbc')]('nolimit')){_0x19ea28['limit']=qs[_0x8789('0x21')](_0x693aa1[_0x8789('0x37')][_0x8789('0x21')]);_0x19ea28[_0x8789('0x20')]=qs['offset'](_0x693aa1[_0x8789('0x37')][_0x8789('0x20')]);}_0x19ea28['order']=qs[_0x8789('0x41')](_0x693aa1['query']['sort']);_0x19ea28['where']=qs[_0x8789('0x39')](_[_0x8789('0x43')](_0x693aa1[_0x8789('0x37')],_0x26ad94['filters']));_0x19ea28['where'][_0x8789('0xae')]=_0x29f8bd['id'];if(_0x693aa1[_0x8789('0x37')][_0x8789('0x83')]){_0x19ea28[_0x8789('0x42')]=_[_0x8789('0x9b')](_0x19ea28[_0x8789('0x42')],{'$or':_[_0x8789('0x2e')](_0x19ea28[_0x8789('0x3b')],function(_0x32fb2b){var _0x18e878={};_0x18e878[_0x32fb2b]={'$like':'%'+_0x693aa1['query'][_0x8789('0x83')]+'%'};return _0x18e878;})});}if(_0x693aa1[_0x8789('0x37')][_0x8789('0x77')]){var _0x1acc1c=_0x693aa1[_0x8789('0x37')]['$gte'][_0x8789('0x62')](',');var _0x55c150={};_0x55c150[_0x1acc1c[0x0]]={'$gte':moment(_0x1acc1c[0x1])[_0x8789('0xbd')](_0x8789('0xbe'))};_0x19ea28[_0x8789('0x42')]=_[_0x8789('0x9b')](_0x19ea28[_0x8789('0x42')],_0x55c150);}_0x19ea28=_[_0x8789('0x9b')]({},_0x19ea28,_0x693aa1['options']);return db[_0x8789('0xba')][_0x8789('0x23')]({'where':_0x19ea28[_0x8789('0x42')]})[_0x8789('0x29')](function(_0x47d76f){_0x354e98[_0x8789('0x23')]=_0x47d76f;if(_0x693aa1[_0x8789('0x37')][_0x8789('0xb2')]){_0x19ea28[_0x8789('0xbf')]=[{'all':!![]}];}return db[_0x8789('0xba')][_0x8789('0xc0')](_0x19ea28);})['then'](function(_0x168136){_0x354e98['rows']=_0x168136;return _0x354e98;});}})[_0x8789('0x29')](respondWithFilteredResult(_0x52832f,_0x19ea28))[_0x8789('0x33')](handleError(_0x52832f,null));};exports['addTags']=function(_0x1a23dc,_0x1985a1,_0x253a48){return db['WhatsappInteraction'][_0x8789('0x5b')]({'where':{'id':_0x1a23dc[_0x8789('0xb1')]['id']}})['then'](handleEntityNotFound(_0x1985a1,null))[_0x8789('0x29')](function(_0x4cd533){if(_0x4cd533){return _0x4cd533[_0x8789('0xc1')](_0x1a23dc['body']['ids'],_[_0x8789('0xb7')](_0x1a23dc[_0x8789('0x71')],[_0x8789('0xb6'),'id'])||{})[_0x8789('0xc2')](function(){return db[_0x8789('0x6a')][_0x8789('0xc0')]({'attributes':['id',_0x8789('0x2c'),_0x8789('0xc3')],'where':{'id':_0x1a23dc[_0x8789('0x71')][_0x8789('0xb6')]}});})['then'](function(_0x151f33){socket[_0x8789('0xc4')](_0x8789('0xc5'),{'id':Number(_0x1a23dc[_0x8789('0xb1')]['id']),'tags':_0x151f33||[]});return{'id':Number(_0x1a23dc[_0x8789('0xb1')]['id']),'tags':_0x151f33||[]};});}})[_0x8789('0x29')](respondWithResult(_0x1985a1,null))['catch'](handleError(_0x1985a1,null));};exports[_0x8789('0xc6')]=function(_0x2c7c5b,_0x23d912,_0x49a111){return db['WhatsappInteraction']['find']({'where':{'id':_0x2c7c5b['params']['id']}})[_0x8789('0x29')](handleEntityNotFound(_0x23d912,null))[_0x8789('0x29')](function(_0x293601){if(_0x293601){return _0x293601['removeTags'](_0x2c7c5b[_0x8789('0x37')][_0x8789('0xb6')]);}})[_0x8789('0x29')](respondWithStatusCode(_0x23d912,null))['catch'](handleError(_0x23d912,null));};exports['download']=function(_0x216e1,_0x4ff16c){var _0x26781c=moment()[_0x8789('0xc7')]()[_0x8789('0x99')]();var _0x5dc1d4=path[_0x8789('0xc8')](config[_0x8789('0xc9')],'server',_0x8789('0xca'),_0x8789('0xcb'));var _0x4fc24a=path[_0x8789('0xc8')](config['root'],_0x8789('0xcc'),_0x8789('0xca'),_0x8789('0xcd'));var _0x9db8a5=path[_0x8789('0xc8')](_0x5dc1d4,_0x26781c);var _0x4175c2=util[_0x8789('0xbd')](_0x8789('0xce'),_0x216e1[_0x8789('0xb1')]['id'],_0x26781c);var _0x1a1c33=path[_0x8789('0xc8')](_0x5dc1d4,_0x4175c2);var _0xd6b668=[];_0xd6b668['push']({'model':db[_0x8789('0x6e')],'as':'User','attributes':['id',_0x8789('0x2f')],'raw':!![]});_0xd6b668[_0x8789('0x32')]({'model':db['CmContact'],'as':_0x8789('0xcf'),'attributes':['id',_0x8789('0xd0'),_0x8789('0xd1')],'raw':!![]});if(_0x216e1['query'][_0x8789('0xcd')]){_0xd6b668[_0x8789('0x32')]({'model':db[_0x8789('0xd2')],'as':_0x8789('0xd2'),'raw':!![]});}var _0x512c4e=[{'model':db[_0x8789('0xba')],'as':'Messages','attributes':['id','body',_0x8789('0x76'),_0x8789('0xd3'),_0x8789('0xd4'),_0x8789('0x7e')],'include':_0xd6b668}];_0x512c4e['push']({'model':db[_0x8789('0xd5')],'as':_0x8789('0xd6'),'attributes':['id',_0x8789('0x2c')]});_0x512c4e['push']({'model':db[_0x8789('0x6e')],'as':_0x8789('0xd7'),'attributes':['id',_0x8789('0x2f')]});return db[_0x8789('0x34')][_0x8789('0x5b')]({'where':{'id':_0x216e1[_0x8789('0xb1')]['id']},'include':_0x512c4e})[_0x8789('0x29')](handleEntityNotFound(_0x4ff16c,null))[_0x8789('0x29')](function(_0x1f9b6c){if(_0x1f9b6c){var _0x2f1279=_0x1f9b6c[_0x8789('0xd8')]({'plain':!![]});fs[_0x8789('0xd9')](_0x9db8a5);var _0x4a4a4b={'channel':_0x8789('0xda'),'account':_0x2f1279['Account']['name'],'agent':_0x2f1279[_0x8789('0xd7')]?_0x2f1279[_0x8789('0xd7')][_0x8789('0x2f')]:_0x8789('0xdb'),'createdAt':moment(_0x2f1279[_0x8789('0x76')])[_0x8789('0xbd')](_0x8789('0xbe'))[_0x8789('0x99')](),'closedAt':_0x2f1279[_0x8789('0xdc')]?moment(_0x2f1279[_0x8789('0xdd')])[_0x8789('0xbd')](_0x8789('0xbe'))[_0x8789('0x99')]():'','disposition':_0x2f1279['disposition'],'messages':_(_0x2f1279[_0x8789('0xde')])[_0x8789('0x83')]({'secret':![]})['map'](function(_0xb194bf){if(_0xb194bf[_0x8789('0xd2')]){var _0x528cf7=path[_0x8789('0xc8')](_0x4fc24a,_0xb194bf[_0x8789('0xd2')][_0x8789('0xdf')]);if(fs[_0x8789('0xe0')](_0x528cf7)){fs[_0x8789('0xe1')](_0x528cf7)[_0x8789('0xe2')](fs[_0x8789('0xe3')](path[_0x8789('0xc8')](_0x9db8a5,_0xb194bf['Attachment'][_0x8789('0xdf')])));}}return{'date':moment(_0xb194bf[_0x8789('0x76')])['format'](_0x8789('0xbe'))[_0x8789('0x99')](),'sender':_0xb194bf['direction']===_0x8789('0xe4')?_0xb194bf['User']?_0xb194bf[_0x8789('0x6e')]['fullname']:_0x8789('0xe5'):_0xb194bf['Contact'][_0x8789('0xd0')]+(_0xb194bf['Contact']['lastName']?'\x20'+_0xb194bf[_0x8789('0xcf')]['lastName']:''),'body':_0xb194bf['Attachment']?_0xb194bf[_0x8789('0xd2')][_0x8789('0xdf')]:_0xb194bf[_0x8789('0x71')],'direction':_0xb194bf[_0x8789('0xd3')]==='out'?'A':'C','secret':_0xb194bf[_0x8789('0xd4')],'read':_0xb194bf[_0x8789('0x7e')],'attachment':_0xb194bf[_0x8789('0xd2')]};})[_0x8789('0x5d')]()};return ejs['renderFile'](path['join'](config[_0x8789('0xc9')],_0x8789('0xcc'),_0x8789('0xe6'),_0x8789('0xe7')),{'interaction':_0x4a4a4b})[_0x8789('0x29')](function(_0x13ed48){var _0x10f8c2=path[_0x8789('0xc8')](_0x9db8a5,_0x8789('0xe8')+_0x2f1279['id']+'-'+_0x26781c+'.pdf');var _0x3d76f8={'path':_0x10f8c2,'channel':_0x8789('0xda'),'interactionId':_0x2f1279['id']};return pdf[_0x8789('0xe9')](_0x13ed48,_0x3d76f8);})['then'](function(){return new BPromise(function(_0x3e2f94,_0x1d31d3){zipdir(_0x9db8a5,{'saveTo':_0x1a1c33},function(_0x211d94,_0x55674e){if(_0x211d94)return _0x1d31d3(_0x211d94);return _0x3e2f94(_0x55674e);});})[_0x8789('0x29')](function(){return new BPromise(function(_0x5a7d3c,_0x3828e4){rimraf(_0x9db8a5,function(_0x224e61){if(_0x224e61)_0x3828e4(_0x224e61);return _0x5a7d3c();});});})['then'](function(){return _0x4ff16c[_0x8789('0xea')](_0x1a1c33,_0x4175c2,function(_0x292198){if(_0x292198){console[_0x8789('0xeb')](_0x8789('0xec'),_0x292198);}else{fs['unlinkSync'](_0x1a1c33);}});});});}else{return _0x4ff16c['sendStatus'](0xc8);}})[_0x8789('0x33')](handleError(_0x4ff16c,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d0511f4..2bbece4 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 _0x9319=['WhatsappInteraction','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0x9319,0x87));var _0x9931=function(_0x17761b,_0x504ade){_0x17761b=_0x17761b-0x0;var _0x13a51a=_0x9319[_0x17761b];return _0x13a51a;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x9931('0x0'))['db'][_0x9931('0x1')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9931('0x2')](0x0);var events={'afterCreate':_0x9931('0x3'),'afterUpdate':_0x9931('0x4'),'afterDestroy':'remove'};function emitEvent(_0xd88ef9){return function(_0x5abc84,_0x526c63,_0x209905){_0x5abc84[_0x9931('0x5')]({'attributes':['id'],'raw':!![]})[_0x9931('0x6')](function(_0x3a2881){_0x5abc84[_0x9931('0x7')](_0x9931('0x8'),_0x3a2881[_0x9931('0x9')](function(_0x2e70ef){return{'id':_0x2e70ef['id']};}));return WhatsappMessage[_0x9931('0xa')]({'where':{'WhatsappInteractionId':_0x5abc84['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9931('0x6')](function(_0xa1bbf7){_0x5abc84[_0x9931('0x7')](_0x9931('0xb'),_0xa1bbf7[_0x9931('0xc')]);WhatsappInteractionEvents[_0x9931('0xd')](_0xd88ef9+':'+_0x5abc84['id'],_0x5abc84);WhatsappInteractionEvents[_0x9931('0xd')](_0xd88ef9,_0x5abc84);_0x209905(null);})['catch'](_0x209905(null));};}for(var e in events){if(events[_0x9931('0xe')](e)){var event=events[e];WhatsappInteraction[_0x9931('0xf')](e,emitEvent(event));}}module[_0x9931('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xdfff=['events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','exports'];(function(_0x4ec13d,_0x358a8f){var _0x3c3fa7=function(_0x2615f6){while(--_0x2615f6){_0x4ec13d['push'](_0x4ec13d['shift']());}};_0x3c3fa7(++_0x358a8f);}(_0xdfff,0x110));var _0xfdff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdfff[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xfdff('0x0'));var WhatsappInteraction=require(_0xfdff('0x1'))['db'][_0xfdff('0x2')];var WhatsappMessage=require(_0xfdff('0x1'))['db'][_0xfdff('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfdff('0x4'),'afterUpdate':'update','afterDestroy':_0xfdff('0x5')};function emitEvent(_0xfa4504){return function(_0x33202c,_0x3b2346,_0x30d77d){_0x33202c[_0xfdff('0x6')]({'attributes':['id'],'raw':!![]})[_0xfdff('0x7')](function(_0x37480){_0x33202c[_0xfdff('0x8')](_0xfdff('0x9'),_0x37480[_0xfdff('0xa')](function(_0x45c451){return{'id':_0x45c451['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x33202c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4fd397){_0x33202c[_0xfdff('0x8')](_0xfdff('0xb'),_0x4fd397[_0xfdff('0xc')]);WhatsappInteractionEvents[_0xfdff('0xd')](_0xfa4504+':'+_0x33202c['id'],_0x33202c);WhatsappInteractionEvents[_0xfdff('0xd')](_0xfa4504,_0x33202c);_0x30d77d(null);})[_0xfdff('0xe')](_0x30d77d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xfdff('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 68e0610..a6bbcf6 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 _0xdf3d=['closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed'];(function(_0x3275cf,_0x3f56b2){var _0x3015b6=function(_0x4ac0cd){while(--_0x4ac0cd){_0x3275cf['push'](_0x3275cf['shift']());}};_0x3015b6(++_0x3f56b2);}(_0xdf3d,0x79));var _0xddf3=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xdf3d[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0xddf3('0x0'));var util=require(_0xddf3('0x1'));var logger=require(_0xddf3('0x2'))(_0xddf3('0x3'));var moment=require(_0xddf3('0x4'));var BPromise=require(_0xddf3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xddf3('0x6'));var config=require(_0xddf3('0x7'));var attributes=require(_0xddf3('0x8'));module[_0xddf3('0x9')]=function(_0x33fed4,_0x192f45){return _0x33fed4[_0xddf3('0xa')](_0xddf3('0xb'),attributes,{'tableName':_0xddf3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1996c8,_0x3ffebd,_0x12ced5){if(_0x1996c8[_0xddf3('0xd')](_0xddf3('0xe'))){_0x1996c8[_0xddf3('0xf')]=moment()[_0xddf3('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x12ced5(null,_0x1996c8);}}});}; \ No newline at end of file +var _0x3bd5=['./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','format','lodash','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x1c30bf,_0x247c31){var _0x255b5e=function(_0x70c22b){while(--_0x70c22b){_0x1c30bf['push'](_0x1c30bf['shift']());}};_0x255b5e(++_0x247c31);}(_0x3bd5,0x6e));var _0x53bd=function(_0xc26e8c,_0x41f753){_0xc26e8c=_0xc26e8c-0x0;var _0x2d6ece=_0x3bd5[_0xc26e8c];return _0x2d6ece;};'use strict';var _=require(_0x53bd('0x0'));var util=require(_0x53bd('0x1'));var logger=require(_0x53bd('0x2'))(_0x53bd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x53bd('0x4'));var rimraf=require(_0x53bd('0x5'));var config=require(_0x53bd('0x6'));var attributes=require(_0x53bd('0x7'));module[_0x53bd('0x8')]=function(_0x4d4fde,_0x4d50d6){return _0x4d4fde[_0x53bd('0x9')](_0x53bd('0xa'),attributes,{'tableName':_0x53bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32c121,_0x573082,_0x2c6c0d){if(_0x32c121['changed']('closed')){_0x32c121['closedAt']=moment()[_0x53bd('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2c6c0d(null,_0x32c121);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 4c4ac62..8e39f67 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 _0xa8d9=['jayson/promise','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappInteraction','update','body','options','where','attributes','limit','UpdateWhatsappInteraction','catch','find','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x10ed52,_0x4dcad2){var _0x2f4623=function(_0x4fc455){while(--_0x4fc455){_0x10ed52['push'](_0x10ed52['shift']());}};_0x2f4623(++_0x4dcad2);}(_0xa8d9,0x9e));var _0x9a8d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa8d9[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9a8d('0x0'));var util=require(_0x9a8d('0x1'));var moment=require(_0x9a8d('0x2'));var BPromise=require(_0x9a8d('0x3'));var rs=require(_0x9a8d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a8d('0x5'))['db'];var utils=require(_0x9a8d('0x6'));var logger=require(_0x9a8d('0x7'))(_0x9a8d('0x8'));var config=require(_0x9a8d('0x9'));var jayson=require(_0x9a8d('0xa'));var client=jayson[_0x9a8d('0xb')][_0x9a8d('0xc')]({'port':0x232a});config[_0x9a8d('0xd')]=_['defaults'](config[_0x9a8d('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x9a8d('0xe'))(new Redis(config[_0x9a8d('0xd')]));require(_0x9a8d('0xf'))[_0x9a8d('0x10')](socket);function respondWithRpcPromise(_0x20ee36,_0x33901f,_0x57b17c){return new BPromise(function(_0x184af4,_0x27e72e){return client[_0x9a8d('0x11')](_0x20ee36,_0x57b17c)[_0x9a8d('0x12')](function(_0x46ea35){logger[_0x9a8d('0x13')](_0x9a8d('0x14'),_0x33901f,_0x9a8d('0x15'));logger[_0x9a8d('0x16')](_0x9a8d('0x17'),_0x33901f,'request\x20sent',JSON[_0x9a8d('0x18')](_0x46ea35));if(_0x46ea35[_0x9a8d('0x19')]){if(_0x46ea35['error'][_0x9a8d('0x1a')]===0x1f4){logger['error'](_0x9a8d('0x14'),_0x33901f,_0x46ea35[_0x9a8d('0x19')][_0x9a8d('0x1b')]);return _0x27e72e(_0x46ea35[_0x9a8d('0x19')][_0x9a8d('0x1b')]);}logger['error'](_0x9a8d('0x14'),_0x33901f,_0x46ea35[_0x9a8d('0x19')][_0x9a8d('0x1b')]);return _0x184af4(_0x46ea35[_0x9a8d('0x19')][_0x9a8d('0x1b')]);}else{logger[_0x9a8d('0x13')](_0x9a8d('0x14'),_0x33901f,_0x9a8d('0x15'));_0x184af4(_0x46ea35[_0x9a8d('0x1c')]['message']);}})['catch'](function(_0x16c4e7){logger['error'](_0x9a8d('0x14'),_0x33901f,_0x16c4e7);_0x27e72e(_0x16c4e7);});});}exports['UpdateWhatsappInteraction']=function(_0xb72d58){var _0x34d191=this;return new Promise(function(_0x334c77,_0x5e3cdb){return db[_0x9a8d('0x1d')][_0x9a8d('0x1e')](_0xb72d58[_0x9a8d('0x1f')],{'raw':_0xb72d58[_0x9a8d('0x20')]?_0xb72d58[_0x9a8d('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb72d58[_0x9a8d('0x20')]?_0xb72d58[_0x9a8d('0x20')][_0x9a8d('0x21')]||null:null,'attributes':_0xb72d58[_0x9a8d('0x20')]?_0xb72d58[_0x9a8d('0x20')][_0x9a8d('0x22')]||null:null,'limit':_0xb72d58[_0x9a8d('0x20')]?_0xb72d58[_0x9a8d('0x20')][_0x9a8d('0x23')]||null:null})[_0x9a8d('0x12')](function(_0x518908){logger['info'](_0x9a8d('0x24'),_0xb72d58);logger[_0x9a8d('0x16')](_0x9a8d('0x24'),_0xb72d58,JSON[_0x9a8d('0x18')](_0x518908));_0x334c77(_0x518908);})[_0x9a8d('0x25')](function(_0x858b8c){logger[_0x9a8d('0x19')](_0x9a8d('0x24'),_0x858b8c['message'],_0xb72d58);_0x5e3cdb(_0x34d191[_0x9a8d('0x19')](0x1f4,_0x858b8c[_0x9a8d('0x1b')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x5e67c6){return new Promise(function(_0x5e698a,_0x3f2b31){return db[_0x9a8d('0x1d')][_0x9a8d('0x26')]({'where':_0x5e67c6[_0x9a8d('0x20')]?_0x5e67c6['options'][_0x9a8d('0x21')]||null:null})[_0x9a8d('0x12')](function(_0x41afd3){if(_0x41afd3){return _0x41afd3['addTags'](_0x5e67c6[_0x9a8d('0x1f')]['ids'],_[_0x9a8d('0x27')](_0x5e67c6[_0x9a8d('0x1f')],['ids','id'])||{});}})[_0x9a8d('0x28')](function(_0x569e67){logger[_0x9a8d('0x13')](_0x9a8d('0x29'),_0x5e67c6);logger[_0x9a8d('0x16')]('AddTags',_0x5e67c6,JSON['stringify'](_0x569e67));_0x5e698a(_0x569e67);})[_0x9a8d('0x25')](function(_0x28f4f5){logger['error'](_0x9a8d('0x29'),_0x28f4f5[_0x9a8d('0x1b')],_0x5e67c6);_0x3f2b31(_this[_0x9a8d('0x19')](0x1f4,_0x28f4f5[_0x9a8d('0x1b')]));});});}; \ No newline at end of file +var _0x0139=['code','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4a2164,_0x3c6203){var _0x41e116=function(_0x3fd2e7){while(--_0x3fd2e7){_0x4a2164['push'](_0x4a2164['shift']());}};_0x41e116(++_0x3c6203);}(_0x0139,0x117));var _0x9013=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0139[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9013('0x0'));var util=require(_0x9013('0x1'));var moment=require(_0x9013('0x2'));var BPromise=require('bluebird');var rs=require(_0x9013('0x3'));var fs=require('fs');var Redis=require(_0x9013('0x4'));var db=require(_0x9013('0x5'))['db'];var utils=require(_0x9013('0x6'));var logger=require(_0x9013('0x7'))(_0x9013('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9013('0x9')][_0x9013('0xa')]({'port':0x232a});config[_0x9013('0xb')]=_['defaults'](config[_0x9013('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9013('0xc'))(new Redis(config[_0x9013('0xb')]));require(_0x9013('0xd'))[_0x9013('0xe')](socket);function respondWithRpcPromise(_0x1ccb85,_0x567b11,_0x24bb65){return new BPromise(function(_0x519a8e,_0x2d9527){return client['request'](_0x1ccb85,_0x24bb65)[_0x9013('0xf')](function(_0x45fd44){logger[_0x9013('0x10')](_0x9013('0x11'),_0x567b11,_0x9013('0x12'));logger['debug'](_0x9013('0x13'),_0x567b11,_0x9013('0x12'),JSON[_0x9013('0x14')](_0x45fd44));if(_0x45fd44[_0x9013('0x15')]){if(_0x45fd44['error'][_0x9013('0x16')]===0x1f4){logger['error'](_0x9013('0x11'),_0x567b11,_0x45fd44[_0x9013('0x15')][_0x9013('0x17')]);return _0x2d9527(_0x45fd44[_0x9013('0x15')]['message']);}logger[_0x9013('0x15')](_0x9013('0x11'),_0x567b11,_0x45fd44[_0x9013('0x15')][_0x9013('0x17')]);return _0x519a8e(_0x45fd44[_0x9013('0x15')][_0x9013('0x17')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x567b11,_0x9013('0x12'));_0x519a8e(_0x45fd44[_0x9013('0x18')][_0x9013('0x17')]);}})[_0x9013('0x19')](function(_0x1cd8fd){logger[_0x9013('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x567b11,_0x1cd8fd);_0x2d9527(_0x1cd8fd);});});}exports[_0x9013('0x1a')]=function(_0x15e8c5){var _0x1dd2c4=this;return new Promise(function(_0xcada7f,_0x455281){return db['WhatsappInteraction'][_0x9013('0x1b')](_0x15e8c5[_0x9013('0x1c')],{'raw':_0x15e8c5[_0x9013('0x1d')]?_0x15e8c5[_0x9013('0x1d')][_0x9013('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15e8c5['options']?_0x15e8c5[_0x9013('0x1d')][_0x9013('0x1f')]||null:null,'attributes':_0x15e8c5['options']?_0x15e8c5['options'][_0x9013('0x20')]||null:null,'limit':_0x15e8c5['options']?_0x15e8c5[_0x9013('0x1d')][_0x9013('0x21')]||null:null})[_0x9013('0xf')](function(_0x5a7d97){logger[_0x9013('0x10')](_0x9013('0x1a'),_0x15e8c5);logger[_0x9013('0x22')](_0x9013('0x1a'),_0x15e8c5,JSON[_0x9013('0x14')](_0x5a7d97));_0xcada7f(_0x5a7d97);})[_0x9013('0x19')](function(_0x2a389c){logger['error'](_0x9013('0x1a'),_0x2a389c[_0x9013('0x17')],_0x15e8c5);_0x455281(_0x1dd2c4[_0x9013('0x15')](0x1f4,_0x2a389c[_0x9013('0x17')]));});});};exports[_0x9013('0x23')]=function(_0x41611d){return new Promise(function(_0x1adee1,_0x386d3e){return db[_0x9013('0x24')][_0x9013('0x25')]({'where':_0x41611d[_0x9013('0x1d')]?_0x41611d[_0x9013('0x1d')]['where']||null:null})['then'](function(_0x1f1707){if(_0x1f1707){return _0x1f1707[_0x9013('0x26')](_0x41611d['body'][_0x9013('0x27')],_[_0x9013('0x28')](_0x41611d[_0x9013('0x1c')],['ids','id'])||{});}})[_0x9013('0x29')](function(_0x1f68d9){logger[_0x9013('0x10')](_0x9013('0x2a'),_0x41611d);logger['debug'](_0x9013('0x2a'),_0x41611d,JSON[_0x9013('0x14')](_0x1f68d9));_0x1adee1(_0x1f68d9);})['catch'](function(_0x4bfc6f){logger[_0x9013('0x15')](_0x9013('0x2a'),_0x4bfc6f['message'],_0x41611d);_0x386d3e(_this['error'](0x1f4,_0x4bfc6f['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 25676c4..5718875 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 _0x49f2=['emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x49f2,0x18c));var _0x249f=function(_0x495645,_0x275141){_0x495645=_0x495645-0x0;var _0x545dee=_0x49f2[_0x495645];return _0x545dee;};'use strict';var WhatsappInteractionEvents=require(_0x249f('0x0'));var events=[_0x249f('0x1'),_0x249f('0x2'),_0x249f('0x3')];function createListener(_0x3606ac,_0x5086c3){return function(_0x1a6f52){_0x5086c3[_0x249f('0x4')](_0x3606ac,_0x1a6f52);};}function removeListener(_0x256a9c,_0x329ae7){return function(){WhatsappInteractionEvents[_0x249f('0x5')](_0x256a9c,_0x329ae7);};}exports['register']=function(_0xe56be8){for(var _0x11439a=0x0,_0x32b447=events[_0x249f('0x6')];_0x11439a<_0x32b447;_0x11439a++){var _0x32be28=events[_0x11439a];var _0x5dfab8=createListener(_0x249f('0x7')+_0x32be28,_0xe56be8);WhatsappInteractionEvents['on'](_0x32be28,_0x5dfab8);}}; \ No newline at end of file +var _0x7ca0=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','length'];(function(_0x19ed43,_0x1b738d){var _0x3ee071=function(_0x1d643e){while(--_0x1d643e){_0x19ed43['push'](_0x19ed43['shift']());}};_0x3ee071(++_0x1b738d);}(_0x7ca0,0x1ac));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require(_0x07ca('0x0'));var events=[_0x07ca('0x1'),_0x07ca('0x2'),_0x07ca('0x3')];function createListener(_0x41c9db,_0x911c67){return function(_0x4967d2){_0x911c67[_0x07ca('0x4')](_0x41c9db,_0x4967d2);};}function removeListener(_0x3f010e,_0xb8380a){return function(){WhatsappInteractionEvents['removeListener'](_0x3f010e,_0xb8380a);};}exports['register']=function(_0x12b3ba){for(var _0x28b1f0=0x0,_0x55a844=events[_0x07ca('0x5')];_0x28b1f0<_0x55a844;_0x28b1f0++){var _0x2e25a5=events[_0x28b1f0];var _0x2325e7=createListener(_0x07ca('0x6')+_0x2e25a5,_0x12b3ba);WhatsappInteractionEvents['on'](_0x2e25a5,_0x2325e7);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 7f15a29..00facb2 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 _0x7bae=['index','/describe','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','update','put','/:id/accept','accept','reject','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x2a4ebe,_0x1280ad){var _0x4601ec=function(_0x59824c){while(--_0x59824c){_0x2a4ebe['push'](_0x2a4ebe['shift']());}};_0x4601ec(++_0x1280ad);}(_0x7bae,0x13b));var _0xe7ba=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x7bae[_0x32d457];return _0x338386;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['show']);router[_0xe7ba('0xd')]('/',auth[_0xe7ba('0x8')](),interaction[_0xe7ba('0xe')](_0xe7ba('0xf'),_0xe7ba('0x10')),controller[_0xe7ba('0x11')]);router[_0xe7ba('0xd')](_0xe7ba('0x12'),controller[_0xe7ba('0x13')]);router['put'](_0xe7ba('0xc'),auth['isAuthenticated'](),controller[_0xe7ba('0x14')]);router[_0xe7ba('0x15')](_0xe7ba('0x16'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x17')]);router[_0xe7ba('0x15')]('/:id/reject',auth['isAuthenticated'](),controller[_0xe7ba('0x18')]);router[_0xe7ba('0x19')](_0xe7ba('0xc'),auth['isAuthenticated'](),controller[_0xe7ba('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x17ba=['/:id','show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17ba,0xab));var _0xa17b=function(_0x5dfeb2,_0x205762){_0x5dfeb2=_0x5dfeb2-0x0;var _0x4b9abc=_0x17ba[_0x5dfeb2];return _0x4b9abc;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),interaction[_0xa17b('0x11')](_0xa17b('0x12'),_0xa17b('0x13')),controller[_0xa17b('0x14')]);router[_0xa17b('0x15')](_0xa17b('0x16'),controller['status']);router[_0xa17b('0x17')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller['update']);router[_0xa17b('0x17')](_0xa17b('0x18'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x19')]);router['put'](_0xa17b('0x1a'),auth['isAuthenticated'](),controller[_0xa17b('0x1b')]);router[_0xa17b('0x1c')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x1d')]);module[_0xa17b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index d3d53ee..de9f858 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 _0xfd7b=['medium','ENUM','out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xfd7b,0x180));var _0xbfd7=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0xfd7b[_0x5c2a2b];return _0x19921f;};'use strict';var Sequelize=require(_0xbfd7('0x0'));module[_0xbfd7('0x1')]={'body':{'type':Sequelize[_0xbfd7('0x2')](_0xbfd7('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfd7('0x4')]('in',_0xbfd7('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xbfd7('0x6')](0xbe)},'phone':{'type':Sequelize[_0xbfd7('0x6')]},'readAt':{'type':Sequelize[_0xbfd7('0x7')]},'secret':{'type':Sequelize[_0xbfd7('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbfd7('0x6')]},'providerResponse':{'type':Sequelize[_0xbfd7('0x2')]}}; \ No newline at end of file +var _0x4009=['out','STRING','TEXT','sequelize','exports','BOOLEAN'];(function(_0x497d8c,_0x2904c9){var _0xeafed7=function(_0x3b51e8){while(--_0x3b51e8){_0x497d8c['push'](_0x497d8c['shift']());}};_0xeafed7(++_0x2904c9);}(_0x4009,0x8d));var _0x9400=function(_0x1b607e,_0x5cfe86){_0x1b607e=_0x1b607e-0x0;var _0x1c7b8e=_0x4009[_0x1b607e];return _0x1c7b8e;};'use strict';var Sequelize=require(_0x9400('0x0'));module[_0x9400('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9400('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9400('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x9400('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x9400('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9400('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 44f9ea5..6a26bf7 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 _0x3e74=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./whatsappMessage.socket','register','http','client','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','stack','name','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','where','pick','merge','VIRTUAL','filter','include','findAll','show','params','includeAll','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','length','startsWith','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','manual','SIP/%s','channel','event','EventManager','RejectMessage','rejectMessage','Sequelize','QueryTypes','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5ea7a8,_0x257068){var _0x1b2e3a=function(_0x5d3cfa){while(--_0x5d3cfa){_0x5ea7a8['push'](_0x5ea7a8['shift']());}};_0x1b2e3a(++_0x257068);}(_0x3e74,0x175));var _0x43e7=function(_0x46960d,_0x31be9f){_0x46960d=_0x46960d-0x0;var _0x3ecf46=_0x3e74[_0x46960d];return _0x3ecf46;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];config[_0x43e7('0x15')]=_[_0x43e7('0x16')](config[_0x43e7('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43e7('0x15')]));require(_0x43e7('0x17'))[_0x43e7('0x18')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x43e7('0x19')]({'port':0x232c});var client9002=jayson[_0x43e7('0x1a')][_0x43e7('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x328445,_0x4de324,_0x5c4eaa,_0xdf16c){return new BPromise(function(_0x264575,_0x273a32){var _0x5d346f=_0xdf16c||client;return _0x5d346f['request'](_0x328445,_0x5c4eaa)[_0x43e7('0x1b')](function(_0x1ca758){logger[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x4de324,_0x43e7('0x1e'));logger[_0x43e7('0x1f')](_0x43e7('0x20'),_0x4de324,_0x43e7('0x1e'),JSON[_0x43e7('0x21')](_0x1ca758));if(_0x1ca758[_0x43e7('0x22')]){if(_0x1ca758[_0x43e7('0x22')][_0x43e7('0x23')]===0x1f4){logger['error'](_0x43e7('0x1d'),_0x4de324,_0x1ca758[_0x43e7('0x22')]['message']);return _0x273a32(_0x1ca758[_0x43e7('0x22')][_0x43e7('0x24')]);}logger[_0x43e7('0x22')](_0x43e7('0x1d'),_0x4de324,_0x1ca758[_0x43e7('0x22')][_0x43e7('0x24')]);return _0x264575(_0x1ca758['error'][_0x43e7('0x24')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4de324,_0x43e7('0x1e'));_0x264575(_0x1ca758[_0x43e7('0x25')]['message']);}})[_0x43e7('0x26')](function(_0x4ca5cf){logger[_0x43e7('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x4de324,_0x4ca5cf);_0x273a32(_0x4ca5cf);});});}function respondWithStatusCode(_0x1af208,_0x1b5f50){_0x1b5f50=_0x1b5f50||0xcc;return function(_0x20888b){if(_0x20888b){return _0x1af208[_0x43e7('0x27')](_0x1b5f50);}return _0x1af208['status'](_0x1b5f50)['end']();};}function respondWithResult(_0x805b54,_0x501551){_0x501551=_0x501551||0xc8;return function(_0x2dd5f){if(_0x2dd5f){return _0x805b54[_0x43e7('0x28')](_0x501551)[_0x43e7('0x29')](_0x2dd5f);}};}function respondWithFilteredResult(_0xb1fc63,_0x5087d7){return function(_0x33a1a5){if(_0x33a1a5){var _0x4690a6=typeof _0x5087d7[_0x43e7('0x2a')]===_0x43e7('0x2b')&&typeof _0x5087d7[_0x43e7('0x2c')]===_0x43e7('0x2b');var _0x2b85a5=_0x33a1a5[_0x43e7('0x2d')];var _0x3bf475=_0x4690a6?0x0:_0x5087d7[_0x43e7('0x2a')];var _0x17df44=_0x4690a6?_0x33a1a5[_0x43e7('0x2d')]:_0x5087d7[_0x43e7('0x2a')]+_0x5087d7[_0x43e7('0x2c')];var _0x4bdb17;if(_0x17df44>=_0x2b85a5){_0x17df44=_0x2b85a5;_0x4bdb17=0xc8;}else{_0x4bdb17=0xce;}_0xb1fc63[_0x43e7('0x28')](_0x4bdb17);return _0xb1fc63[_0x43e7('0x2e')](_0x43e7('0x2f'),_0x3bf475+'-'+_0x17df44+'/'+_0x2b85a5)[_0x43e7('0x29')](_0x33a1a5);}return null;};}function patchUpdates(_0x4251c8){return function(_0x4c8650){try{jsonpatch[_0x43e7('0x30')](_0x4c8650,_0x4251c8,!![]);}catch(_0x49b83d){return BPromise[_0x43e7('0x31')](_0x49b83d);}return _0x4c8650[_0x43e7('0x32')]();};}function saveUpdates(_0x4c61b9,_0x5a7342){return function(_0x5e203f){if(_0x5e203f){return _0x5e203f[_0x43e7('0x33')](_0x4c61b9)[_0x43e7('0x1b')](function(_0x117c07){return _0x117c07;});}return null;};}function removeEntity(_0x234fe6,_0x108313){return function(_0xde7ed){if(_0xde7ed){return _0xde7ed['destroy']()['then'](function(){_0x234fe6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8e86,_0x564f0e){return function(_0x5cb753){if(!_0x5cb753){_0x4e8e86[_0x43e7('0x27')](0x194);}return _0x5cb753;};}function handleError(_0x49cda6,_0x2b4bfd){_0x2b4bfd=_0x2b4bfd||0x1f4;return function(_0x8e9f40){logger[_0x43e7('0x22')](_0x8e9f40[_0x43e7('0x34')]);if(_0x8e9f40[_0x43e7('0x35')]){delete _0x8e9f40[_0x43e7('0x35')];}_0x49cda6[_0x43e7('0x28')](_0x2b4bfd)['send'](_0x8e9f40);};}exports['index']=function(_0x5d84f4,_0xfa0474){var _0xfe70e9={},_0x199ff6={},_0x16cdba={'count':0x0,'rows':[]};var _0x1b1440=_[_0x43e7('0x36')](db[_0x43e7('0x37')][_0x43e7('0x38')],function(_0x55c798){return{'name':_0x55c798[_0x43e7('0x39')],'type':_0x55c798[_0x43e7('0x3a')]['key']};});_0x199ff6[_0x43e7('0x3b')]=_['map'](_0x1b1440,_0x43e7('0x35'));_0x199ff6[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](_0x5d84f4[_0x43e7('0x3c')]);_0x199ff6[_0x43e7('0x3e')]=_[_0x43e7('0x3f')](_0x199ff6['model'],_0x199ff6['query']);_0xfe70e9[_0x43e7('0x40')]=_[_0x43e7('0x3f')](_0x199ff6[_0x43e7('0x3b')],qs[_0x43e7('0x41')](_0x5d84f4[_0x43e7('0x3c')]['fields']));_0xfe70e9[_0x43e7('0x40')]=_0xfe70e9[_0x43e7('0x40')]['length']?_0xfe70e9[_0x43e7('0x40')]:_0x199ff6['model'];if(!_0x5d84f4[_0x43e7('0x3c')]['hasOwnProperty'](_0x43e7('0x42'))){_0xfe70e9[_0x43e7('0x2c')]=qs[_0x43e7('0x2c')](_0x5d84f4[_0x43e7('0x3c')]['limit']);_0xfe70e9['offset']=qs[_0x43e7('0x2a')](_0x5d84f4[_0x43e7('0x3c')][_0x43e7('0x2a')]);}_0xfe70e9[_0x43e7('0x43')]=qs['sort'](_0x5d84f4['query']['sort']);_0xfe70e9[_0x43e7('0x44')]=qs['filters'](_[_0x43e7('0x45')](_0x5d84f4['query'],_0x199ff6['filters']),_0x1b1440);if(_0x5d84f4[_0x43e7('0x3c')]['filter']){_0xfe70e9[_0x43e7('0x44')]=_[_0x43e7('0x46')](_0xfe70e9[_0x43e7('0x44')],{'$or':_[_0x43e7('0x36')](_0x1b1440,function(_0x4fc5e8){if(_0x4fc5e8[_0x43e7('0x3a')]!==_0x43e7('0x47')){var _0x23a611={};_0x23a611[_0x4fc5e8[_0x43e7('0x35')]]={'$like':'%'+_0x5d84f4[_0x43e7('0x3c')][_0x43e7('0x48')]+'%'};return _0x23a611;}})});}_0xfe70e9=_['merge']({},_0xfe70e9,_0x5d84f4['options']);var _0x3bc9de={'where':_0xfe70e9[_0x43e7('0x44')]};return db[_0x43e7('0x37')]['count'](_0x3bc9de)['then'](function(_0x56489b){_0x16cdba[_0x43e7('0x2d')]=_0x56489b;if(_0x5d84f4[_0x43e7('0x3c')]['includeAll']){_0xfe70e9[_0x43e7('0x49')]=[{'all':!![]}];}return db[_0x43e7('0x37')][_0x43e7('0x4a')](_0xfe70e9);})['then'](function(_0x593155){_0x16cdba['rows']=_0x593155;return _0x16cdba;})['then'](respondWithFilteredResult(_0xfa0474,_0xfe70e9))[_0x43e7('0x26')](handleError(_0xfa0474,null));};exports[_0x43e7('0x4b')]=function(_0x52fea5,_0x23e7cb){var _0x82d32f={'raw':!![],'where':{'id':_0x52fea5[_0x43e7('0x4c')]['id']}},_0x426bcb={};_0x426bcb['model']=_[_0x43e7('0x3d')](db['WhatsappMessage']['rawAttributes']);_0x426bcb[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](_0x52fea5[_0x43e7('0x3c')]);_0x426bcb[_0x43e7('0x3e')]=_[_0x43e7('0x3f')](_0x426bcb[_0x43e7('0x3b')],_0x426bcb[_0x43e7('0x3c')]);_0x82d32f[_0x43e7('0x40')]=_[_0x43e7('0x3f')](_0x426bcb[_0x43e7('0x3b')],qs['fields'](_0x52fea5[_0x43e7('0x3c')][_0x43e7('0x41')]));_0x82d32f['attributes']=_0x82d32f[_0x43e7('0x40')]['length']?_0x82d32f[_0x43e7('0x40')]:_0x426bcb[_0x43e7('0x3b')];if(_0x52fea5[_0x43e7('0x3c')][_0x43e7('0x4d')]){_0x82d32f[_0x43e7('0x49')]=[{'all':!![]}];}_0x82d32f=_['merge']({},_0x82d32f,_0x52fea5['options']);return db[_0x43e7('0x37')][_0x43e7('0x4e')](_0x82d32f)[_0x43e7('0x1b')](handleEntityNotFound(_0x23e7cb,null))[_0x43e7('0x1b')](respondWithResult(_0x23e7cb,null))[_0x43e7('0x26')](handleError(_0x23e7cb,null));};exports[_0x43e7('0x4f')]=function(_0xa47464,_0x44f8a0){return db[_0x43e7('0x37')][_0x43e7('0x4f')](_0xa47464[_0x43e7('0x50')],{})['then'](respondWithResult(_0x44f8a0,0xc9))[_0x43e7('0x26')](handleError(_0x44f8a0,null));};exports[_0x43e7('0x33')]=function(_0x50a3fa,_0x4314d8){if(_0x50a3fa[_0x43e7('0x50')]['id']){delete _0x50a3fa[_0x43e7('0x50')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x50a3fa[_0x43e7('0x4c')]['id']}})[_0x43e7('0x1b')](handleEntityNotFound(_0x4314d8,null))['then'](saveUpdates(_0x50a3fa[_0x43e7('0x50')],null))['then'](respondWithResult(_0x4314d8,null))['catch'](handleError(_0x4314d8,null));};exports[_0x43e7('0x51')]=function(_0x4b6b7f,_0x1f7c02){return db[_0x43e7('0x37')][_0x43e7('0x4e')]({'where':{'id':_0x4b6b7f['params']['id']}})[_0x43e7('0x1b')](handleEntityNotFound(_0x1f7c02,null))[_0x43e7('0x1b')](removeEntity(_0x1f7c02,null))['catch'](handleError(_0x1f7c02,null));};exports[_0x43e7('0x52')]=function(_0x1267c5,_0x296a0d){return db['WhatsappMessage']['describe']()['then'](respondWithResult(_0x296a0d,null))[_0x43e7('0x26')](handleError(_0x296a0d,null));};var interaction_log=require(_0x43e7('0x11'))(_0x43e7('0x53'));exports[_0x43e7('0x54')]=function(_0x52ea9c,_0x5a50fc,_0x1b27da){var _0x8b50bb={'agent':{},'channel':_0x43e7('0x55')};if(_0x52ea9c[_0x43e7('0x50')]['id']){delete _0x52ea9c['body']['id'];}_0x52ea9c[_0x43e7('0x50')][_0x43e7('0x56')]=!![];_0x52ea9c[_0x43e7('0x50')][_0x43e7('0x57')]=moment()[_0x43e7('0x58')](_0x43e7('0x59'));_0x52ea9c[_0x43e7('0x50')][_0x43e7('0x5a')]=_0x52ea9c[_0x43e7('0x50')][_0x43e7('0x5a')]||_0x52ea9c[_0x43e7('0x5b')]['id'];_0x8b50bb['agent']['id']=_0x52ea9c['body'][_0x43e7('0x5a')];return db['WhatsappMessage']['find']({'where':{'id':_0x52ea9c['params']['id'],'UserId':null},'include':[{'model':db[_0x43e7('0x5c')],'as':_0x43e7('0x5d')}]})['then'](handleEntityNotFound(_0x5a50fc,null))[_0x43e7('0x1b')](saveUpdates(_0x52ea9c[_0x43e7('0x50')],null))[_0x43e7('0x1b')](function(_0x537a53){if(_0x537a53){_0x8b50bb[_0x43e7('0x24')]=_0x537a53[_0x43e7('0x5e')]({'plain':!![]});return db[_0x43e7('0x5f')][_0x43e7('0x4e')]({'where':{'id':_0x537a53[_0x43e7('0x60')]}});}return null;})[_0x43e7('0x1b')](handleEntityNotFound(_0x5a50fc,null))[_0x43e7('0x1b')](function(_0x515f01){if(_0x515f01){return _0x515f01[_0x43e7('0x33')]({'UserId':_0x52ea9c[_0x43e7('0x50')][_0x43e7('0x5a')],'read1stAt':_['isNil'](_0x515f01['read1stAt'])?moment()[_0x43e7('0x58')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1b793d){if(_0x1b793d){_0x8b50bb[_0x43e7('0x61')]=_0x1b793d['get']({'plain':!![]});interaction_log[_0x43e7('0x1c')](_0x43e7('0x62'),_0x52ea9c[_0x43e7('0x5b')]['id'],_0x52ea9c[_0x43e7('0x5b')][_0x43e7('0x35')],_0x52ea9c[_0x43e7('0x5b')][_0x43e7('0x63')],_0x8b50bb['interaction']['id'],_0x52ea9c[_0x43e7('0x50')]?JSON[_0x43e7('0x21')](_0x52ea9c['body']):_0x43e7('0x64'));return respondWithRpcPromise('AcceptMessage',_0x43e7('0x65'),_0x8b50bb);}return null;})[_0x43e7('0x1b')](function(_0x37301b){return db[_0x43e7('0x5c')]['describe']()[_0x43e7('0x1b')](function(_0x2646c2){var _0xf929a5=[];for(var _0x556001=0x0;_0x556001=_0xbe87e1){_0x209aba=_0xbe87e1;_0x4fd03f=0xc8;}else{_0x4fd03f=0xce;}_0x52746a[_0x9edd('0x2d')](_0x4fd03f);return _0x52746a[_0x9edd('0x34')](_0x9edd('0x35'),_0xbbf08f+'-'+_0x209aba+'/'+_0xbe87e1)[_0x9edd('0x2f')](_0x28cfae);}return null;};}function patchUpdates(_0x5af178){return function(_0x1453d2){try{jsonpatch[_0x9edd('0x36')](_0x1453d2,_0x5af178,!![]);}catch(_0x267c74){return BPromise['reject'](_0x267c74);}return _0x1453d2[_0x9edd('0x37')]();};}function saveUpdates(_0x3990fb,_0xde9b13){return function(_0x38a7be){if(_0x38a7be){return _0x38a7be[_0x9edd('0x38')](_0x3990fb)[_0x9edd('0x22')](function(_0x473068){return _0x473068;});}return null;};}function removeEntity(_0x438a5d,_0xd0fd74){return function(_0x2539c6){if(_0x2539c6){return _0x2539c6[_0x9edd('0x39')]()[_0x9edd('0x22')](function(){_0x438a5d[_0x9edd('0x2d')](0xcc)[_0x9edd('0x2e')]();});}};}function handleEntityNotFound(_0x5757fc,_0x37fcb2){return function(_0x5ed62d){if(!_0x5ed62d){_0x5757fc[_0x9edd('0x2c')](0x194);}return _0x5ed62d;};}function handleError(_0x148630,_0x10d6fd){_0x10d6fd=_0x10d6fd||0x1f4;return function(_0x434d26){logger[_0x9edd('0x27')](_0x434d26['stack']);if(_0x434d26[_0x9edd('0x3a')]){delete _0x434d26[_0x9edd('0x3a')];}_0x148630[_0x9edd('0x2d')](_0x10d6fd)[_0x9edd('0x3b')](_0x434d26);};}exports[_0x9edd('0x3c')]=function(_0x337e6c,_0x5c0627){var _0x1cbbac={},_0x1ccee8={},_0x35c16f={'count':0x0,'rows':[]};var _0x51a54a=_[_0x9edd('0x3d')](db['WhatsappMessage'][_0x9edd('0x3e')],function(_0x5658d6){return{'name':_0x5658d6[_0x9edd('0x3f')],'type':_0x5658d6[_0x9edd('0x40')][_0x9edd('0x41')]};});_0x1ccee8['model']=_[_0x9edd('0x3d')](_0x51a54a,_0x9edd('0x3a'));_0x1ccee8[_0x9edd('0x42')]=_['keys'](_0x337e6c[_0x9edd('0x42')]);_0x1ccee8['filters']=_[_0x9edd('0x43')](_0x1ccee8[_0x9edd('0x44')],_0x1ccee8['query']);_0x1cbbac[_0x9edd('0x45')]=_[_0x9edd('0x43')](_0x1ccee8[_0x9edd('0x44')],qs[_0x9edd('0x46')](_0x337e6c['query'][_0x9edd('0x46')]));_0x1cbbac['attributes']=_0x1cbbac[_0x9edd('0x45')][_0x9edd('0x47')]?_0x1cbbac['attributes']:_0x1ccee8[_0x9edd('0x44')];if(!_0x337e6c['query']['hasOwnProperty'](_0x9edd('0x48'))){_0x1cbbac[_0x9edd('0x31')]=qs[_0x9edd('0x31')](_0x337e6c[_0x9edd('0x42')][_0x9edd('0x31')]);_0x1cbbac[_0x9edd('0x30')]=qs[_0x9edd('0x30')](_0x337e6c[_0x9edd('0x42')][_0x9edd('0x30')]);}_0x1cbbac[_0x9edd('0x49')]=qs[_0x9edd('0x4a')](_0x337e6c[_0x9edd('0x42')][_0x9edd('0x4a')]);_0x1cbbac[_0x9edd('0x4b')]=qs[_0x9edd('0x4c')](_['pick'](_0x337e6c[_0x9edd('0x42')],_0x1ccee8[_0x9edd('0x4c')]),_0x51a54a);if(_0x337e6c[_0x9edd('0x42')][_0x9edd('0x4d')]){_0x1cbbac[_0x9edd('0x4b')]=_[_0x9edd('0x4e')](_0x1cbbac[_0x9edd('0x4b')],{'$or':_['map'](_0x51a54a,function(_0x4a4656){if(_0x4a4656['type']!==_0x9edd('0x4f')){var _0x58a1dd={};_0x58a1dd[_0x4a4656[_0x9edd('0x3a')]]={'$like':'%'+_0x337e6c[_0x9edd('0x42')][_0x9edd('0x4d')]+'%'};return _0x58a1dd;}})});}_0x1cbbac=_[_0x9edd('0x4e')]({},_0x1cbbac,_0x337e6c[_0x9edd('0x50')]);var _0x53005b={'where':_0x1cbbac[_0x9edd('0x4b')]};return db[_0x9edd('0x51')][_0x9edd('0x33')](_0x53005b)['then'](function(_0x3626bc){_0x35c16f[_0x9edd('0x33')]=_0x3626bc;if(_0x337e6c[_0x9edd('0x42')][_0x9edd('0x52')]){_0x1cbbac[_0x9edd('0x53')]=[{'all':!![]}];}return db[_0x9edd('0x51')]['findAll'](_0x1cbbac);})[_0x9edd('0x22')](function(_0x237e91){_0x35c16f['rows']=_0x237e91;return _0x35c16f;})[_0x9edd('0x22')](respondWithFilteredResult(_0x5c0627,_0x1cbbac))[_0x9edd('0x2b')](handleError(_0x5c0627,null));};exports['show']=function(_0x2bd089,_0x8134cd){var _0x468239={'raw':!![],'where':{'id':_0x2bd089[_0x9edd('0x54')]['id']}},_0x5215b0={};_0x5215b0[_0x9edd('0x44')]=_[_0x9edd('0x55')](db[_0x9edd('0x51')]['rawAttributes']);_0x5215b0[_0x9edd('0x42')]=_[_0x9edd('0x55')](_0x2bd089[_0x9edd('0x42')]);_0x5215b0['filters']=_[_0x9edd('0x43')](_0x5215b0[_0x9edd('0x44')],_0x5215b0['query']);_0x468239[_0x9edd('0x45')]=_['intersection'](_0x5215b0[_0x9edd('0x44')],qs[_0x9edd('0x46')](_0x2bd089[_0x9edd('0x42')][_0x9edd('0x46')]));_0x468239[_0x9edd('0x45')]=_0x468239[_0x9edd('0x45')][_0x9edd('0x47')]?_0x468239[_0x9edd('0x45')]:_0x5215b0[_0x9edd('0x44')];if(_0x2bd089[_0x9edd('0x42')][_0x9edd('0x52')]){_0x468239['include']=[{'all':!![]}];}_0x468239=_[_0x9edd('0x4e')]({},_0x468239,_0x2bd089[_0x9edd('0x50')]);return db[_0x9edd('0x51')]['find'](_0x468239)[_0x9edd('0x22')](handleEntityNotFound(_0x8134cd,null))['then'](respondWithResult(_0x8134cd,null))['catch'](handleError(_0x8134cd,null));};exports['create']=function(_0x1348a7,_0x45f47c){return db[_0x9edd('0x51')][_0x9edd('0x56')](_0x1348a7['body'],{})['then'](respondWithResult(_0x45f47c,0xc9))['catch'](handleError(_0x45f47c,null));};exports[_0x9edd('0x38')]=function(_0x5f666b,_0xd5090a){if(_0x5f666b[_0x9edd('0x57')]['id']){delete _0x5f666b[_0x9edd('0x57')]['id'];}return db[_0x9edd('0x51')][_0x9edd('0x58')]({'where':{'id':_0x5f666b[_0x9edd('0x54')]['id']}})['then'](handleEntityNotFound(_0xd5090a,null))[_0x9edd('0x22')](saveUpdates(_0x5f666b['body'],null))[_0x9edd('0x22')](respondWithResult(_0xd5090a,null))[_0x9edd('0x2b')](handleError(_0xd5090a,null));};exports['destroy']=function(_0x22b91a,_0x322359){return db[_0x9edd('0x51')]['find']({'where':{'id':_0x22b91a[_0x9edd('0x54')]['id']}})[_0x9edd('0x22')](handleEntityNotFound(_0x322359,null))[_0x9edd('0x22')](removeEntity(_0x322359,null))[_0x9edd('0x2b')](handleError(_0x322359,null));};exports[_0x9edd('0x59')]=function(_0x2c3173,_0x53f55b){return db['WhatsappMessage'][_0x9edd('0x59')]()['then'](respondWithResult(_0x53f55b,null))[_0x9edd('0x2b')](handleError(_0x53f55b,null));};var interaction_log=require(_0x9edd('0x13'))(_0x9edd('0x5a'));exports[_0x9edd('0x5b')]=function(_0x5df1d7,_0x21ead2,_0x507cce){var _0x3e5dca={'agent':{},'channel':_0x9edd('0x5c')};if(_0x5df1d7[_0x9edd('0x57')]['id']){delete _0x5df1d7['body']['id'];}_0x5df1d7[_0x9edd('0x57')]['read']=!![];_0x5df1d7[_0x9edd('0x57')][_0x9edd('0x5d')]=moment()['format'](_0x9edd('0x5e'));_0x5df1d7['body'][_0x9edd('0x5f')]=_0x5df1d7[_0x9edd('0x57')][_0x9edd('0x5f')]||_0x5df1d7['user']['id'];_0x3e5dca[_0x9edd('0x60')]['id']=_0x5df1d7[_0x9edd('0x57')][_0x9edd('0x5f')];return db[_0x9edd('0x51')][_0x9edd('0x58')]({'where':{'id':_0x5df1d7['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x9edd('0x61')}]})[_0x9edd('0x22')](handleEntityNotFound(_0x21ead2,null))['then'](saveUpdates(_0x5df1d7['body'],null))['then'](function(_0x1bc89b){if(_0x1bc89b){_0x3e5dca['message']=_0x1bc89b['get']({'plain':!![]});return db[_0x9edd('0x62')][_0x9edd('0x58')]({'where':{'id':_0x1bc89b['WhatsappInteractionId']}});}return null;})[_0x9edd('0x22')](handleEntityNotFound(_0x21ead2,null))[_0x9edd('0x22')](function(_0x34dff5){if(_0x34dff5){return _0x34dff5['update']({'UserId':_0x5df1d7[_0x9edd('0x57')]['UserId'],'read1stAt':_[_0x9edd('0x63')](_0x34dff5[_0x9edd('0x64')])?moment()['format'](_0x9edd('0x5e')):undefined});}return null;})[_0x9edd('0x22')](function(_0x5c1746){if(_0x5c1746){_0x3e5dca[_0x9edd('0x65')]=_0x5c1746[_0x9edd('0x66')]({'plain':!![]});interaction_log[_0x9edd('0x23')](_0x9edd('0x67'),_0x5df1d7['user']['id'],_0x5df1d7[_0x9edd('0x68')]['name'],_0x5df1d7[_0x9edd('0x68')][_0x9edd('0x69')],_0x3e5dca[_0x9edd('0x65')]['id'],_0x5df1d7['body']?JSON[_0x9edd('0x26')](_0x5df1d7[_0x9edd('0x57')]):_0x9edd('0x6a'));return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x6c'),_0x3e5dca);}return null;})[_0x9edd('0x22')](function(_0x3fa4a9){return db['CmContact']['describe']()[_0x9edd('0x22')](function(_0x3c7874){var _0x13254e=[];for(var _0x171403=0x0;_0x171403=_0x271eef){_0x1feb6f=_0x271eef;_0x473406=0xc8;}else{_0x473406=0xce;}_0x47147a[_0x2e15('0x20')](_0x473406);return _0x47147a['set'](_0x2e15('0x27'),_0x3aa923+'-'+_0x1feb6f+'/'+_0x271eef)[_0x2e15('0x22')](_0x39e114);}return null;};}function patchUpdates(_0x35477d){return function(_0x41e5a1){try{jsonpatch[_0x2e15('0x28')](_0x41e5a1,_0x35477d,!![]);}catch(_0x27a2c4){return BPromise[_0x2e15('0x29')](_0x27a2c4);}return _0x41e5a1['save']();};}function saveUpdates(_0x50b673,_0x52757f){return function(_0x10bf45){if(_0x10bf45){return _0x10bf45[_0x2e15('0x2a')](_0x50b673)[_0x2e15('0x2b')](function(_0xd5b05c){return _0xd5b05c;});}return null;};}function removeEntity(_0x1e760d,_0x225ab9){return function(_0x5bb555){if(_0x5bb555){return _0x5bb555[_0x2e15('0x2c')]()['then'](function(){var _0x2aa1b1=_0x5bb555['get']({'plain':!![]});var _0x430f49='WhatsappQueues';return db['UserProfileResource'][_0x2e15('0x2c')]({'where':{'type':_0x430f49,'resourceId':_0x2aa1b1['id']}})[_0x2e15('0x2b')](function(){return _0x5bb555;});})[_0x2e15('0x2b')](function(){_0x1e760d[_0x2e15('0x20')](0xcc)[_0x2e15('0x21')]();});}};}function handleEntityNotFound(_0x99d88d,_0x5ddef3){return function(_0x2ef843){if(!_0x2ef843){_0x99d88d['sendStatus'](0x194);}return _0x2ef843;};}function handleError(_0x2a238b,_0x46d16d){_0x46d16d=_0x46d16d||0x1f4;return function(_0x22052e){logger['error'](_0x22052e['stack']);if(_0x22052e['name']){delete _0x22052e[_0x2e15('0x2d')];}_0x2a238b[_0x2e15('0x20')](_0x46d16d)[_0x2e15('0x2e')](_0x22052e);};}exports[_0x2e15('0x2f')]=function(_0x516408,_0x5a927b){var _0x554935={},_0x404f79={},_0x54957={'count':0x0,'rows':[]};var _0x20fca8=_['map'](db[_0x2e15('0x30')][_0x2e15('0x31')],function(_0x3d64cc){return{'name':_0x3d64cc[_0x2e15('0x32')],'type':_0x3d64cc['type']['key']};});_0x404f79['model']=_[_0x2e15('0x33')](_0x20fca8,_0x2e15('0x2d'));_0x404f79[_0x2e15('0x34')]=_['keys'](_0x516408['query']);_0x404f79[_0x2e15('0x35')]=_[_0x2e15('0x36')](_0x404f79[_0x2e15('0x37')],_0x404f79[_0x2e15('0x34')]);_0x554935[_0x2e15('0x38')]=_[_0x2e15('0x36')](_0x404f79[_0x2e15('0x37')],qs['fields'](_0x516408['query']['fields']));_0x554935[_0x2e15('0x38')]=_0x554935[_0x2e15('0x38')][_0x2e15('0x39')]?_0x554935[_0x2e15('0x38')]:_0x404f79[_0x2e15('0x37')];if(!_0x516408[_0x2e15('0x34')][_0x2e15('0x3a')](_0x2e15('0x3b'))){_0x554935['limit']=qs[_0x2e15('0x25')](_0x516408[_0x2e15('0x34')]['limit']);_0x554935['offset']=qs[_0x2e15('0x23')](_0x516408[_0x2e15('0x34')]['offset']);}_0x554935[_0x2e15('0x3c')]=qs[_0x2e15('0x3d')](_0x516408[_0x2e15('0x34')][_0x2e15('0x3d')]);_0x554935[_0x2e15('0x3e')]=qs[_0x2e15('0x35')](_[_0x2e15('0x3f')](_0x516408[_0x2e15('0x34')],_0x404f79[_0x2e15('0x35')]),_0x20fca8);if(_0x516408[_0x2e15('0x34')][_0x2e15('0x40')]){_0x554935['where']=_[_0x2e15('0x41')](_0x554935[_0x2e15('0x3e')],{'$or':_[_0x2e15('0x33')](_0x20fca8,function(_0x5a6a3a){if(_0x5a6a3a['type']!==_0x2e15('0x42')){var _0x639959={};_0x639959[_0x5a6a3a[_0x2e15('0x2d')]]={'$like':'%'+_0x516408[_0x2e15('0x34')]['filter']+'%'};return _0x639959;}})});}_0x554935=_['merge']({},_0x554935,_0x516408[_0x2e15('0x43')]);var _0x256e33={'where':_0x554935[_0x2e15('0x3e')]};return db[_0x2e15('0x30')][_0x2e15('0x26')](_0x256e33)[_0x2e15('0x2b')](function(_0x51de32){_0x54957[_0x2e15('0x26')]=_0x51de32;if(_0x516408[_0x2e15('0x34')][_0x2e15('0x44')]){_0x554935[_0x2e15('0x45')]=[{'all':!![]}];}return db[_0x2e15('0x30')][_0x2e15('0x46')](_0x554935);})['then'](function(_0x35442f){_0x54957[_0x2e15('0x47')]=_0x35442f;return _0x54957;})['then'](respondWithFilteredResult(_0x5a927b,_0x554935))[_0x2e15('0x48')](handleError(_0x5a927b,null));};exports['show']=function(_0x3d02b5,_0xcff9be){var _0x3e4517={'raw':!![],'where':{'id':_0x3d02b5['params']['id']}},_0x364bf4={};_0x364bf4[_0x2e15('0x37')]=_[_0x2e15('0x49')](db[_0x2e15('0x30')][_0x2e15('0x31')]);_0x364bf4[_0x2e15('0x34')]=_[_0x2e15('0x49')](_0x3d02b5['query']);_0x364bf4[_0x2e15('0x35')]=_['intersection'](_0x364bf4[_0x2e15('0x37')],_0x364bf4[_0x2e15('0x34')]);_0x3e4517[_0x2e15('0x38')]=_[_0x2e15('0x36')](_0x364bf4[_0x2e15('0x37')],qs[_0x2e15('0x4a')](_0x3d02b5[_0x2e15('0x34')][_0x2e15('0x4a')]));_0x3e4517[_0x2e15('0x38')]=_0x3e4517[_0x2e15('0x38')][_0x2e15('0x39')]?_0x3e4517[_0x2e15('0x38')]:_0x364bf4[_0x2e15('0x37')];if(_0x3d02b5[_0x2e15('0x34')][_0x2e15('0x44')]){_0x3e4517['include']=[{'all':!![]}];}_0x3e4517=_[_0x2e15('0x41')]({},_0x3e4517,_0x3d02b5[_0x2e15('0x43')]);return db[_0x2e15('0x30')][_0x2e15('0x4b')](_0x3e4517)[_0x2e15('0x2b')](handleEntityNotFound(_0xcff9be,null))[_0x2e15('0x2b')](respondWithResult(_0xcff9be,null))['catch'](handleError(_0xcff9be,null));};exports[_0x2e15('0x4c')]=function(_0x47aee7,_0x472312){return db[_0x2e15('0x30')]['create'](_0x47aee7[_0x2e15('0x4d')],{})[_0x2e15('0x2b')](function(_0xf1e799){var _0xd742e5=_0x47aee7['user'][_0x2e15('0x4e')]({'plain':!![]});if(!_0xd742e5)throw new Error(_0x2e15('0x4f'));if(_0xd742e5[_0x2e15('0x50')]==='user'){var _0x36a21c=_0xf1e799[_0x2e15('0x4e')]({'plain':!![]});var _0x22b7f4='WhatsappQueues';return db[_0x2e15('0x51')]['find']({'where':{'name':_0x22b7f4,'userProfileId':_0xd742e5[_0x2e15('0x52')]},'raw':!![]})[_0x2e15('0x2b')](function(_0x232319){if(_0x232319&&_0x232319[_0x2e15('0x53')]===0x0){return db[_0x2e15('0x54')][_0x2e15('0x4c')]({'name':_0x36a21c[_0x2e15('0x2d')],'resourceId':_0x36a21c['id'],'type':_0x232319[_0x2e15('0x2d')],'sectionId':_0x232319['id']},{})['then'](function(){return _0xf1e799;});}else{return _0xf1e799;}})[_0x2e15('0x48')](function(_0xd47b05){logger[_0x2e15('0x55')](_0x2e15('0x56'),_0xd47b05);throw _0xd47b05;});}return _0xf1e799;})[_0x2e15('0x2b')](respondWithResult(_0x472312,0xc9))[_0x2e15('0x48')](handleError(_0x472312,null));};exports[_0x2e15('0x2a')]=function(_0x557f91,_0x9bb0c5){if(_0x557f91[_0x2e15('0x4d')]['id']){delete _0x557f91[_0x2e15('0x4d')]['id'];}return db['WhatsappQueue'][_0x2e15('0x4b')]({'where':{'id':_0x557f91['params']['id']}})[_0x2e15('0x2b')](handleEntityNotFound(_0x9bb0c5,null))[_0x2e15('0x2b')](saveUpdates(_0x557f91[_0x2e15('0x4d')],null))['then'](respondWithResult(_0x9bb0c5,null))[_0x2e15('0x48')](handleError(_0x9bb0c5,null));};exports[_0x2e15('0x2c')]=function(_0x6237b2,_0x47bb6d){return db['WhatsappQueue'][_0x2e15('0x4b')]({'where':{'id':_0x6237b2[_0x2e15('0x57')]['id']}})[_0x2e15('0x2b')](handleEntityNotFound(_0x47bb6d,null))['then'](removeEntity(_0x47bb6d,null))[_0x2e15('0x48')](handleError(_0x47bb6d,null));};exports['describe']=function(_0x5d005a,_0x4bd6d7){return db[_0x2e15('0x30')][_0x2e15('0x58')]()[_0x2e15('0x2b')](respondWithResult(_0x4bd6d7,null))['catch'](handleError(_0x4bd6d7,null));};exports[_0x2e15('0x59')]=function(_0xacafe7,_0x48ce71,_0x3f2426){var _0xb64512={'raw':!![],'where':{}},_0x2675ed={},_0x102600;return db[_0x2e15('0x30')][_0x2e15('0x5a')]({'where':{'id':_0xacafe7[_0x2e15('0x57')]['id']}})['then'](handleEntityNotFound(_0x48ce71,null))[_0x2e15('0x2b')](function(_0x4b38a1){if(_0x4b38a1){_0x102600=_0x4b38a1[_0x2e15('0x4e')]({'plain':!![]});_0x2675ed['model']=_[_0x2e15('0x49')](db[_0x2e15('0x5b')][_0x2e15('0x31')]);_0x2675ed[_0x2e15('0x34')]=_[_0x2e15('0x49')](_0xacafe7[_0x2e15('0x34')]);_0x2675ed[_0x2e15('0x35')]=_[_0x2e15('0x36')](_0x2675ed[_0x2e15('0x37')],_0x2675ed[_0x2e15('0x34')]);_0xb64512[_0x2e15('0x38')]=_[_0x2e15('0x36')](_0x2675ed[_0x2e15('0x37')],qs[_0x2e15('0x4a')](_0xacafe7['query']['fields']));_0xb64512[_0x2e15('0x38')]=_0xb64512[_0x2e15('0x38')][_0x2e15('0x39')]?_0xb64512['attributes']:_0x2675ed['model'];if(!_0xacafe7[_0x2e15('0x34')][_0x2e15('0x3a')](_0x2e15('0x3b'))){_0xb64512['limit']=qs[_0x2e15('0x25')](_0xacafe7['query'][_0x2e15('0x25')]);_0xb64512[_0x2e15('0x23')]=qs[_0x2e15('0x23')](_0xacafe7[_0x2e15('0x34')][_0x2e15('0x23')]);}_0xb64512[_0x2e15('0x3c')]=qs[_0x2e15('0x3d')](_0xacafe7[_0x2e15('0x34')]['sort']);_0xb64512[_0x2e15('0x3e')]=qs['filters'](_[_0x2e15('0x3f')](_0xacafe7[_0x2e15('0x34')],_0x2675ed[_0x2e15('0x35')]));_0xb64512['where'][_0x2e15('0x5c')]=_0x4b38a1['id'];if(_0xacafe7['query'][_0x2e15('0x40')]){_0xb64512[_0x2e15('0x3e')]=_['merge'](_0xb64512[_0x2e15('0x3e')],{'$or':_['map'](_0xb64512[_0x2e15('0x38')],function(_0x501537){var _0xe404ba={};_0xe404ba[_0x501537]={'$like':'%'+_0xacafe7[_0x2e15('0x34')][_0x2e15('0x40')]+'%'};return _0xe404ba;})});}_0xb64512=_[_0x2e15('0x41')]({},_0xb64512,_0xacafe7[_0x2e15('0x43')]);return db[_0x2e15('0x5b')][_0x2e15('0x46')](_0xb64512);}})[_0x2e15('0x2b')](function(_0x3b56ca){if(_0x3b56ca){return db[_0x2e15('0x5d')]['findAndCountAll']({'where':{'id':_[_0x2e15('0x33')](_0x3b56ca,'UserId'),'role':_0x2e15('0x5e')},'attributes':['id','name',_0x2e15('0x5f'),_0x2e15('0x60'),'createdAt']});}})[_0x2e15('0x2b')](function(_0x51d6f7){if(_0x51d6f7){return{'count':_0x51d6f7['count'],'rows':_[_0x2e15('0x33')](_0x51d6f7[_0x2e15('0x47')],function(_0x1eafe9){return{'membername':_0x1eafe9['name'],'UserId':_0x1eafe9['id'],'queue_name':_0x102600[_0x2e15('0x2d')],'WhatsappQueueId':_0x102600['id'],'interface':util[_0x2e15('0x61')]('%s/%s',_0x2e15('0x62'),_0x1eafe9[_0x2e15('0x2d')]),'penalty':0x0,'paused':_0x1eafe9['whatsappPause'],'createdAt':_0x1eafe9[_0x2e15('0x63')],'updatedAt':_0x1eafe9[_0x2e15('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x48ce71,_0xb64512))[_0x2e15('0x48')](handleError(_0x48ce71,null));};exports[_0x2e15('0x64')]=function(_0x4ff758,_0x298362,_0x400f83){var _0x11354d={};var _0x65fd66={};var _0x3e5c8f;var _0x10eb1;return db[_0x2e15('0x30')]['findOne']({'where':{'id':_0x4ff758[_0x2e15('0x57')]['id']}})['then'](handleEntityNotFound(_0x298362,null))[_0x2e15('0x2b')](function(_0x30aab8){if(_0x30aab8){_0x3e5c8f=_0x30aab8;_0x65fd66[_0x2e15('0x37')]=_[_0x2e15('0x49')](db[_0x2e15('0x65')][_0x2e15('0x31')]);_0x65fd66[_0x2e15('0x34')]=_['keys'](_0x4ff758[_0x2e15('0x34')]);_0x65fd66[_0x2e15('0x35')]=_[_0x2e15('0x36')](_0x65fd66[_0x2e15('0x37')],_0x65fd66[_0x2e15('0x34')]);_0x11354d[_0x2e15('0x38')]=_[_0x2e15('0x36')](_0x65fd66[_0x2e15('0x37')],qs[_0x2e15('0x4a')](_0x4ff758[_0x2e15('0x34')][_0x2e15('0x4a')]));_0x11354d[_0x2e15('0x38')]=_0x11354d['attributes'][_0x2e15('0x39')]?_0x11354d[_0x2e15('0x38')]:_0x65fd66[_0x2e15('0x37')];_0x11354d['order']=qs[_0x2e15('0x3d')](_0x4ff758[_0x2e15('0x34')][_0x2e15('0x3d')]);_0x11354d[_0x2e15('0x3e')]=qs['filters'](_['pick'](_0x4ff758[_0x2e15('0x34')],_0x65fd66[_0x2e15('0x35')]));if(_0x4ff758[_0x2e15('0x34')][_0x2e15('0x40')]){_0x11354d[_0x2e15('0x3e')]=_['merge'](_0x11354d['where'],{'$or':_[_0x2e15('0x33')](_0x11354d[_0x2e15('0x38')],function(_0x83cb48){var _0x58c573={};_0x58c573[_0x83cb48]={'$like':'%'+_0x4ff758[_0x2e15('0x34')][_0x2e15('0x40')]+'%'};return _0x58c573;})});}_0x11354d=_[_0x2e15('0x41')]({},_0x11354d,_0x4ff758[_0x2e15('0x43')]);return _0x3e5c8f[_0x2e15('0x64')](_0x11354d);}})[_0x2e15('0x2b')](function(_0x54275d){if(_0x54275d){_0x10eb1=_0x54275d[_0x2e15('0x39')];if(!_0x4ff758[_0x2e15('0x34')]['hasOwnProperty']('nolimit')){_0x11354d[_0x2e15('0x25')]=qs[_0x2e15('0x25')](_0x4ff758[_0x2e15('0x34')]['limit']);_0x11354d[_0x2e15('0x23')]=qs[_0x2e15('0x23')](_0x4ff758['query']['offset']);}return _0x3e5c8f[_0x2e15('0x64')](_0x11354d);}})[_0x2e15('0x2b')](function(_0x3efee5){if(_0x3efee5){return _0x3efee5?{'count':_0x10eb1,'rows':_0x3efee5}:null;}})[_0x2e15('0x2b')](respondWithResult(_0x298362,null))[_0x2e15('0x48')](handleError(_0x298362,null));};exports[_0x2e15('0x66')]=function(_0x5387ac,_0x4f77c0,_0x2bf36b){var _0x3c0f70=_0x5387ac[_0x2e15('0x4d')]['ids'];return db['Team'][_0x2e15('0x46')]({'where':{'id':_0x3c0f70},'attributes':['id'],'include':[{'model':db[_0x2e15('0x5d')],'as':'Agents','attributes':['id',_0x2e15('0x2d'),_0x2e15('0x67'),_0x2e15('0x68'),_0x2e15('0x69')],'raw':!![]}]})['then'](function(_0x534cb0){if(_0x534cb0){var _0x35776c=_[_0x2e15('0x6a')](_0x534cb0,function(_0x244028){var _0x21df0c=_0x244028[_0x2e15('0x4e')]({'plain':!![]});return _0x21df0c[_0x2e15('0x6b')];});return db[_0x2e15('0x30')][_0x2e15('0x4b')]({'where':{'id':_0x5387ac[_0x2e15('0x57')]['id']}})[_0x2e15('0x2b')](function(_0x4ec0ce){return db[_0x2e15('0x6c')][_0x2e15('0x6d')](function(_0x1e7337){return _0x4ec0ce[_0x2e15('0x66')](_0x3c0f70,{'transaction':_0x1e7337})[_0x2e15('0x2b')](function(){return BPromise[_0x2e15('0x6e')](_0x35776c,function(_0x54d9b2){return db['UserWhatsappQueue'][_0x2e15('0x6f')]({'where':{'UserId':_0x54d9b2['id'],'WhatsappQueueId':_0x5387ac[_0x2e15('0x57')]['id']},'transaction':_0x1e7337});});})[_0x2e15('0x2b')](function(){_0x35776c[_0x2e15('0x70')](function(_0x397e2f){socket[_0x2e15('0x71')](_0x2e15('0x72'),{'UserId':_0x397e2f['id'],'WhatsappQueueId':_0x4ec0ce['id']});});});});});}})['then'](respondWithStatusCode(_0x4f77c0,null))[_0x2e15('0x48')](handleError(_0x4f77c0,null));};exports['removeTeams']=function(_0x1ceb0a,_0x65090a,_0x13602c){return db[_0x2e15('0x65')]['findAll']({'where':{'id':_0x1ceb0a[_0x2e15('0x34')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2e15('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x65090a,null))['then'](function(_0x2a0ffa){var _0x1bbec0=_[_0x2e15('0x33')](_0x2a0ffa,'id');var _0x19b37c=[];var _0x244d9d=[];var _0x1e2d91=squel['select']();_0x1e2d91[_0x2e15('0x73')]('tq.TeamId')[_0x2e15('0x74')](_0x2e15('0x75'),'tq')[_0x2e15('0x76')]('user_has_teams','ut',_0x2e15('0x77'))[_0x2e15('0x3e')](_0x2e15('0x78'),_0x1ceb0a[_0x2e15('0x57')]['id']);for(var _0x463234=0x0;_0x463234<_0x2a0ffa[_0x2e15('0x39')];_0x463234+=0x1){let _0x53bec9=_0x2a0ffa[_0x463234];for(var _0x275821=0x0;_0x275821<_0x53bec9[_0x2e15('0x6b')][_0x2e15('0x39')];_0x275821+=0x1){let _0x2fd64e=_0x53bec9[_0x2e15('0x6b')][_0x275821];var _0x155d0e=_0x1e2d91[_0x2e15('0x79')]();_0x155d0e['where'](_0x2e15('0x7a'),_0x2fd64e['id']);_0x244d9d[_0x2e15('0x7b')](db[_0x2e15('0x6c')][_0x2e15('0x34')](_0x155d0e[_0x2e15('0x7c')](),{'type':db[_0x2e15('0x6c')][_0x2e15('0x7d')]['SELECT']})['then'](function(_0x3410e1){if(_0x3410e1[_0x2e15('0x39')]===0x1){return _0x2fd64e['id'];}else{var _0x124e7a=_[_0x2e15('0x7e')](_[_0x2e15('0x33')](_0x3410e1,'TeamId'),function(_0x1ba806){return _[_0x2e15('0x7f')](_0x1bbec0,_0x1ba806);});if(_0x124e7a){return _0x2fd64e['id'];}}}));}}return BPromise[_0x2e15('0x80')](_0x244d9d)[_0x2e15('0x2b')](function(_0xfceba4){_0x19b37c=_(_0x19b37c)[_0x2e15('0x81')](_0xfceba4)[_0x2e15('0x82')]()[_0x2e15('0x83')]();return db['WhatsappQueue'][_0x2e15('0x4b')]({'where':{'id':_0x1ceb0a['params']['id']}})[_0x2e15('0x2b')](function(_0x483167){return db[_0x2e15('0x6c')][_0x2e15('0x6d')](function(_0x5e691b){return _0x483167[_0x2e15('0x84')](_0x1ceb0a[_0x2e15('0x34')]['ids'],{'transaction':_0x5e691b})[_0x2e15('0x2b')](function(){if(!_[_0x2e15('0x85')](_0x19b37c)){return _0x483167['removeAgents'](_0x19b37c,{'transaction':_0x5e691b});}})[_0x2e15('0x2b')](function(){_0x19b37c['forEach'](function(_0x2063e0){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x2063e0,'WhatsappQueueId':_0x483167['id']});});});});});});})[_0x2e15('0x2b')](respondWithStatusCode(_0x65090a,null))[_0x2e15('0x48')](handleError(_0x65090a,null));};exports[_0x2e15('0x86')]=function(_0x5bcc47,_0x2d6431,_0x2b78b6){return db['WhatsappQueue']['find']({'where':{'id':_0x5bcc47[_0x2e15('0x57')]['id']}})[_0x2e15('0x2b')](handleEntityNotFound(_0x2d6431,null))[_0x2e15('0x2b')](function(_0x1fd4a1){if(_0x1fd4a1){return _0x1fd4a1[_0x2e15('0x86')](_0x5bcc47['body'][_0x2e15('0x87')],_['omit'](_0x5bcc47[_0x2e15('0x4d')],[_0x2e15('0x87'),'id'])||{})[_0x2e15('0x88')](function(_0x26b185){for(var _0x41bd01=0x0;_0x41bd01<_0x5bcc47['body'][_0x2e15('0x87')]['length'];_0x41bd01+=0x1){socket[_0x2e15('0x71')]('userWhatsappQueue:save',{'UserId':_0x5bcc47[_0x2e15('0x4d')][_0x2e15('0x87')][_0x41bd01],'WhatsappQueueId':_0x5bcc47[_0x2e15('0x57')]['id']});}return _0x26b185;});}})['then'](respondWithResult(_0x2d6431,null))['catch'](handleError(_0x2d6431,null));};exports['removeAgents']=function(_0x19f59,_0x32a950,_0x25faba){return db[_0x2e15('0x30')][_0x2e15('0x4b')]({'where':{'id':_0x19f59['params']['id']}})['then'](handleEntityNotFound(_0x32a950,null))['then'](function(_0x1034c4){if(_0x1034c4){return _0x1034c4[_0x2e15('0x89')](_0x19f59[_0x2e15('0x34')][_0x2e15('0x87')])['then'](function(){if(_[_0x2e15('0x8a')](_0x19f59[_0x2e15('0x34')][_0x2e15('0x87')])){for(var _0x538e20=0x0;_0x538e20<_0x19f59[_0x2e15('0x34')][_0x2e15('0x87')][_0x2e15('0x39')];_0x538e20+=0x1){socket[_0x2e15('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x19f59[_0x2e15('0x34')][_0x2e15('0x87')][_0x538e20]),'WhatsappQueueId':Number(_0x19f59['params']['id'])});}}else{socket[_0x2e15('0x71')](_0x2e15('0x8b'),{'UserId':Number(_0x19f59[_0x2e15('0x34')]['ids']),'WhatsappQueueId':Number(_0x19f59[_0x2e15('0x57')]['id'])});}});}})[_0x2e15('0x2b')](respondWithStatusCode(_0x32a950,null))[_0x2e15('0x48')](handleError(_0x32a950,null));};exports[_0x2e15('0x8c')]=function(_0x2fc43d,_0x57a2bf,_0x559aa6){var _0x196d9c={};var _0xeb336d={};var _0x487495;var _0x3bf29a;return db['WhatsappQueue'][_0x2e15('0x5a')]({'where':{'id':_0x2fc43d[_0x2e15('0x57')]['id']}})[_0x2e15('0x2b')](handleEntityNotFound(_0x57a2bf,null))[_0x2e15('0x2b')](function(_0xe9d95d){if(_0xe9d95d){_0x487495=_0xe9d95d;_0xeb336d[_0x2e15('0x37')]=_[_0x2e15('0x49')](db['User'][_0x2e15('0x31')]);_0xeb336d[_0x2e15('0x34')]=_[_0x2e15('0x49')](_0x2fc43d[_0x2e15('0x34')]);_0xeb336d[_0x2e15('0x35')]=_['intersection'](_0xeb336d['model'],_0xeb336d[_0x2e15('0x34')]);_0x196d9c[_0x2e15('0x38')]=_[_0x2e15('0x36')](_0xeb336d[_0x2e15('0x37')],qs[_0x2e15('0x4a')](_0x2fc43d['query'][_0x2e15('0x4a')]));_0x196d9c[_0x2e15('0x38')]=_0x196d9c[_0x2e15('0x38')][_0x2e15('0x39')]?_0x196d9c[_0x2e15('0x38')]:_0xeb336d[_0x2e15('0x37')];_0x196d9c['order']=qs[_0x2e15('0x3d')](_0x2fc43d[_0x2e15('0x34')][_0x2e15('0x3d')]);_0x196d9c[_0x2e15('0x3e')]=qs[_0x2e15('0x35')](_[_0x2e15('0x3f')](_0x2fc43d['query'],_0xeb336d[_0x2e15('0x35')]));if(_0x2fc43d[_0x2e15('0x34')][_0x2e15('0x40')]){_0x196d9c['where']=_[_0x2e15('0x41')](_0x196d9c[_0x2e15('0x3e')],{'$or':_[_0x2e15('0x33')](_0x196d9c[_0x2e15('0x38')],function(_0x208e81){var _0x4d5087={};_0x4d5087[_0x208e81]={'$like':'%'+_0x2fc43d[_0x2e15('0x34')][_0x2e15('0x40')]+'%'};return _0x4d5087;})});}_0x196d9c=_['merge']({},_0x196d9c,_0x2fc43d[_0x2e15('0x43')]);return _0x487495[_0x2e15('0x8c')](_0x196d9c);}})[_0x2e15('0x2b')](function(_0x116e1d){if(_0x116e1d){_0x3bf29a=_0x116e1d['length'];if(!_0x2fc43d[_0x2e15('0x34')][_0x2e15('0x3a')](_0x2e15('0x3b'))){_0x196d9c[_0x2e15('0x25')]=qs['limit'](_0x2fc43d[_0x2e15('0x34')][_0x2e15('0x25')]);_0x196d9c[_0x2e15('0x23')]=qs[_0x2e15('0x23')](_0x2fc43d['query'][_0x2e15('0x23')]);}return _0x487495['getAgents'](_0x196d9c);}})['then'](function(_0x41e9cf){if(_0x41e9cf){return _0x41e9cf?{'count':_0x3bf29a,'rows':_0x41e9cf}:null;}})[_0x2e15('0x2b')](respondWithResult(_0x57a2bf,null))[_0x2e15('0x48')](handleError(_0x57a2bf,null));}; \ No newline at end of file +var _0x8cd6=['createdAt','getTeams','findOne','Team','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','compact','value','isEmpty','userWhatsappQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','fieldName','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','then','rows','catch','show','params','rawAttributes','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserWhatsappQueue','findAll','User','UserId','agent','whatsappPause','updatedAt','format','%s/%s','SIP'];(function(_0x52f21f,_0x1d07eb){var _0x1ece33=function(_0x4e700f){while(--_0x4e700f){_0x52f21f['push'](_0x52f21f['shift']());}};_0x1ece33(++_0x1d07eb);}(_0x8cd6,0xbd));var _0x68cd=function(_0x348eef,_0x1ab2c4){_0x348eef=_0x348eef-0x0;var _0x20ad48=_0x8cd6[_0x348eef];return _0x20ad48;};'use strict';var emlformat=require(_0x68cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x68cd('0x1'));var jsonpatch=require(_0x68cd('0x2'));var rp=require(_0x68cd('0x3'));var moment=require(_0x68cd('0x4'));var BPromise=require(_0x68cd('0x5'));var Mustache=require(_0x68cd('0x6'));var util=require(_0x68cd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x68cd('0x8'));var ejs=require(_0x68cd('0x9'));var fs=require('fs');var fs_extra=require(_0x68cd('0xa'));var _=require(_0x68cd('0xb'));var squel=require(_0x68cd('0xc'));var crypto=require('crypto');var jsforce=require(_0x68cd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x68cd('0x8'));var querystring=require(_0x68cd('0xe'));var Papa=require(_0x68cd('0xf'));var Redis=require('ioredis');var authService=require(_0x68cd('0x10'));var qs=require(_0x68cd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68cd('0x12'));var logger=require(_0x68cd('0x13'))(_0x68cd('0x14'));var utils=require(_0x68cd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x68cd('0x16'));var db=require('../../mysqldb')['db'];config[_0x68cd('0x17')]=_[_0x68cd('0x18')](config[_0x68cd('0x17')],{'host':_0x68cd('0x19'),'port':0x18eb});var socket=require(_0x68cd('0x1a'))(new Redis(config[_0x68cd('0x17')]));require(_0x68cd('0x1b'))[_0x68cd('0x1c')](socket);function respondWithStatusCode(_0x268ace,_0x554476){_0x554476=_0x554476||0xcc;return function(_0x4d05f9){if(_0x4d05f9){return _0x268ace['sendStatus'](_0x554476);}return _0x268ace[_0x68cd('0x1d')](_0x554476)[_0x68cd('0x1e')]();};}function respondWithResult(_0x262709,_0x2d0b0e){_0x2d0b0e=_0x2d0b0e||0xc8;return function(_0x6a0e70){if(_0x6a0e70){return _0x262709['status'](_0x2d0b0e)[_0x68cd('0x1f')](_0x6a0e70);}};}function respondWithFilteredResult(_0x340c7f,_0x2a0d2d){return function(_0x3b0307){if(_0x3b0307){var _0x4a9f3a=typeof _0x2a0d2d[_0x68cd('0x20')]==='undefined'&&typeof _0x2a0d2d[_0x68cd('0x21')]===_0x68cd('0x22');var _0x46078a=_0x3b0307[_0x68cd('0x23')];var _0x4cc4e6=_0x4a9f3a?0x0:_0x2a0d2d[_0x68cd('0x20')];var _0x1842e3=_0x4a9f3a?_0x3b0307[_0x68cd('0x23')]:_0x2a0d2d[_0x68cd('0x20')]+_0x2a0d2d[_0x68cd('0x21')];var _0x8971d5;if(_0x1842e3>=_0x46078a){_0x1842e3=_0x46078a;_0x8971d5=0xc8;}else{_0x8971d5=0xce;}_0x340c7f['status'](_0x8971d5);return _0x340c7f[_0x68cd('0x24')](_0x68cd('0x25'),_0x4cc4e6+'-'+_0x1842e3+'/'+_0x46078a)[_0x68cd('0x1f')](_0x3b0307);}return null;};}function patchUpdates(_0x26c1ce){return function(_0x2ce348){try{jsonpatch[_0x68cd('0x26')](_0x2ce348,_0x26c1ce,!![]);}catch(_0x5007f8){return BPromise[_0x68cd('0x27')](_0x5007f8);}return _0x2ce348[_0x68cd('0x28')]();};}function saveUpdates(_0x4fa252,_0x12977b){return function(_0x1220d8){if(_0x1220d8){return _0x1220d8[_0x68cd('0x29')](_0x4fa252)['then'](function(_0x4f7b4e){return _0x4f7b4e;});}return null;};}function removeEntity(_0x1bc543,_0x54dae1){return function(_0x6dcc02){if(_0x6dcc02){return _0x6dcc02[_0x68cd('0x2a')]()['then'](function(){var _0x45525a=_0x6dcc02[_0x68cd('0x2b')]({'plain':!![]});var _0x2623b7=_0x68cd('0x2c');return db[_0x68cd('0x2d')]['destroy']({'where':{'type':_0x2623b7,'resourceId':_0x45525a['id']}})['then'](function(){return _0x6dcc02;});})['then'](function(){_0x1bc543[_0x68cd('0x1d')](0xcc)[_0x68cd('0x1e')]();});}};}function handleEntityNotFound(_0x12dccb,_0x1cba37){return function(_0x505024){if(!_0x505024){_0x12dccb['sendStatus'](0x194);}return _0x505024;};}function handleError(_0x301aa4,_0x5c927d){_0x5c927d=_0x5c927d||0x1f4;return function(_0x3a4006){logger[_0x68cd('0x2e')](_0x3a4006[_0x68cd('0x2f')]);if(_0x3a4006[_0x68cd('0x30')]){delete _0x3a4006['name'];}_0x301aa4[_0x68cd('0x1d')](_0x5c927d)[_0x68cd('0x31')](_0x3a4006);};}exports[_0x68cd('0x32')]=function(_0x4582d0,_0x2a6c86){var _0x440bcd={},_0x263b79={},_0xa3923a={'count':0x0,'rows':[]};var _0x2c8626=_[_0x68cd('0x33')](db[_0x68cd('0x34')]['rawAttributes'],function(_0x26bceb){return{'name':_0x26bceb[_0x68cd('0x35')],'type':_0x26bceb['type'][_0x68cd('0x36')]};});_0x263b79['model']=_[_0x68cd('0x33')](_0x2c8626,_0x68cd('0x30'));_0x263b79['query']=_[_0x68cd('0x37')](_0x4582d0[_0x68cd('0x38')]);_0x263b79[_0x68cd('0x39')]=_[_0x68cd('0x3a')](_0x263b79['model'],_0x263b79[_0x68cd('0x38')]);_0x440bcd[_0x68cd('0x3b')]=_[_0x68cd('0x3a')](_0x263b79['model'],qs[_0x68cd('0x3c')](_0x4582d0[_0x68cd('0x38')][_0x68cd('0x3c')]));_0x440bcd['attributes']=_0x440bcd[_0x68cd('0x3b')][_0x68cd('0x3d')]?_0x440bcd[_0x68cd('0x3b')]:_0x263b79[_0x68cd('0x3e')];if(!_0x4582d0[_0x68cd('0x38')][_0x68cd('0x3f')](_0x68cd('0x40'))){_0x440bcd[_0x68cd('0x21')]=qs[_0x68cd('0x21')](_0x4582d0['query'][_0x68cd('0x21')]);_0x440bcd[_0x68cd('0x20')]=qs[_0x68cd('0x20')](_0x4582d0[_0x68cd('0x38')][_0x68cd('0x20')]);}_0x440bcd[_0x68cd('0x41')]=qs[_0x68cd('0x42')](_0x4582d0[_0x68cd('0x38')][_0x68cd('0x42')]);_0x440bcd[_0x68cd('0x43')]=qs[_0x68cd('0x39')](_[_0x68cd('0x44')](_0x4582d0['query'],_0x263b79[_0x68cd('0x39')]),_0x2c8626);if(_0x4582d0['query'][_0x68cd('0x45')]){_0x440bcd['where']=_[_0x68cd('0x46')](_0x440bcd[_0x68cd('0x43')],{'$or':_[_0x68cd('0x33')](_0x2c8626,function(_0x42cc1d){if(_0x42cc1d[_0x68cd('0x47')]!==_0x68cd('0x48')){var _0x3be959={};_0x3be959[_0x42cc1d[_0x68cd('0x30')]]={'$like':'%'+_0x4582d0[_0x68cd('0x38')][_0x68cd('0x45')]+'%'};return _0x3be959;}})});}_0x440bcd=_[_0x68cd('0x46')]({},_0x440bcd,_0x4582d0['options']);var _0xc00162={'where':_0x440bcd['where']};return db['WhatsappQueue'][_0x68cd('0x23')](_0xc00162)['then'](function(_0x44d9ea){_0xa3923a[_0x68cd('0x23')]=_0x44d9ea;if(_0x4582d0[_0x68cd('0x38')][_0x68cd('0x49')]){_0x440bcd[_0x68cd('0x4a')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x440bcd);})[_0x68cd('0x4b')](function(_0x4712b6){_0xa3923a[_0x68cd('0x4c')]=_0x4712b6;return _0xa3923a;})[_0x68cd('0x4b')](respondWithFilteredResult(_0x2a6c86,_0x440bcd))[_0x68cd('0x4d')](handleError(_0x2a6c86,null));};exports[_0x68cd('0x4e')]=function(_0x2d5d89,_0x104b27){var _0x38014f={'raw':!![],'where':{'id':_0x2d5d89[_0x68cd('0x4f')]['id']}},_0x2bd0ae={};_0x2bd0ae[_0x68cd('0x3e')]=_[_0x68cd('0x37')](db[_0x68cd('0x34')][_0x68cd('0x50')]);_0x2bd0ae[_0x68cd('0x38')]=_[_0x68cd('0x37')](_0x2d5d89[_0x68cd('0x38')]);_0x2bd0ae[_0x68cd('0x39')]=_[_0x68cd('0x3a')](_0x2bd0ae[_0x68cd('0x3e')],_0x2bd0ae['query']);_0x38014f[_0x68cd('0x3b')]=_[_0x68cd('0x3a')](_0x2bd0ae['model'],qs[_0x68cd('0x3c')](_0x2d5d89[_0x68cd('0x38')][_0x68cd('0x3c')]));_0x38014f['attributes']=_0x38014f[_0x68cd('0x3b')][_0x68cd('0x3d')]?_0x38014f['attributes']:_0x2bd0ae[_0x68cd('0x3e')];if(_0x2d5d89[_0x68cd('0x38')]['includeAll']){_0x38014f[_0x68cd('0x4a')]=[{'all':!![]}];}_0x38014f=_[_0x68cd('0x46')]({},_0x38014f,_0x2d5d89[_0x68cd('0x51')]);return db[_0x68cd('0x34')][_0x68cd('0x52')](_0x38014f)[_0x68cd('0x4b')](handleEntityNotFound(_0x104b27,null))[_0x68cd('0x4b')](respondWithResult(_0x104b27,null))[_0x68cd('0x4d')](handleError(_0x104b27,null));};exports['create']=function(_0x4846b6,_0xc54fe1){return db['WhatsappQueue'][_0x68cd('0x53')](_0x4846b6['body'],{})[_0x68cd('0x4b')](function(_0x27d3df){var _0xe5e856=_0x4846b6[_0x68cd('0x54')]['get']({'plain':!![]});if(!_0xe5e856)throw new Error(_0x68cd('0x55'));if(_0xe5e856['role']===_0x68cd('0x54')){var _0x9eb62=_0x27d3df['get']({'plain':!![]});var _0x35d8e1=_0x68cd('0x2c');return db[_0x68cd('0x56')]['find']({'where':{'name':_0x35d8e1,'userProfileId':_0xe5e856[_0x68cd('0x57')]},'raw':!![]})['then'](function(_0x1070fc){if(_0x1070fc&&_0x1070fc[_0x68cd('0x58')]===0x0){return db[_0x68cd('0x2d')][_0x68cd('0x53')]({'name':_0x9eb62[_0x68cd('0x30')],'resourceId':_0x9eb62['id'],'type':_0x1070fc[_0x68cd('0x30')],'sectionId':_0x1070fc['id']},{})['then'](function(){return _0x27d3df;});}else{return _0x27d3df;}})['catch'](function(_0x1528d2){logger['error'](_0x68cd('0x59'),_0x1528d2);throw _0x1528d2;});}return _0x27d3df;})['then'](respondWithResult(_0xc54fe1,0xc9))[_0x68cd('0x4d')](handleError(_0xc54fe1,null));};exports[_0x68cd('0x29')]=function(_0x5ace1b,_0x52de58){if(_0x5ace1b[_0x68cd('0x5a')]['id']){delete _0x5ace1b[_0x68cd('0x5a')]['id'];}return db[_0x68cd('0x34')][_0x68cd('0x52')]({'where':{'id':_0x5ace1b[_0x68cd('0x4f')]['id']}})[_0x68cd('0x4b')](handleEntityNotFound(_0x52de58,null))[_0x68cd('0x4b')](saveUpdates(_0x5ace1b[_0x68cd('0x5a')],null))[_0x68cd('0x4b')](respondWithResult(_0x52de58,null))[_0x68cd('0x4d')](handleError(_0x52de58,null));};exports[_0x68cd('0x2a')]=function(_0x36a937,_0x4f20c5){return db[_0x68cd('0x34')][_0x68cd('0x52')]({'where':{'id':_0x36a937['params']['id']}})[_0x68cd('0x4b')](handleEntityNotFound(_0x4f20c5,null))[_0x68cd('0x4b')](removeEntity(_0x4f20c5,null))['catch'](handleError(_0x4f20c5,null));};exports['describe']=function(_0x1548ba,_0x346f74){return db[_0x68cd('0x34')][_0x68cd('0x5b')]()[_0x68cd('0x4b')](respondWithResult(_0x346f74,null))['catch'](handleError(_0x346f74,null));};exports[_0x68cd('0x5c')]=function(_0x17957e,_0x5454b7,_0x4080b9){var _0x4f796d={'raw':!![],'where':{}},_0x56f981={},_0x2dfc11;return db[_0x68cd('0x34')]['findOne']({'where':{'id':_0x17957e['params']['id']}})[_0x68cd('0x4b')](handleEntityNotFound(_0x5454b7,null))[_0x68cd('0x4b')](function(_0xd7c967){if(_0xd7c967){_0x2dfc11=_0xd7c967['get']({'plain':!![]});_0x56f981[_0x68cd('0x3e')]=_['keys'](db[_0x68cd('0x5d')][_0x68cd('0x50')]);_0x56f981[_0x68cd('0x38')]=_['keys'](_0x17957e[_0x68cd('0x38')]);_0x56f981[_0x68cd('0x39')]=_['intersection'](_0x56f981[_0x68cd('0x3e')],_0x56f981[_0x68cd('0x38')]);_0x4f796d['attributes']=_[_0x68cd('0x3a')](_0x56f981['model'],qs[_0x68cd('0x3c')](_0x17957e[_0x68cd('0x38')][_0x68cd('0x3c')]));_0x4f796d['attributes']=_0x4f796d[_0x68cd('0x3b')][_0x68cd('0x3d')]?_0x4f796d[_0x68cd('0x3b')]:_0x56f981[_0x68cd('0x3e')];if(!_0x17957e['query']['hasOwnProperty'](_0x68cd('0x40'))){_0x4f796d['limit']=qs[_0x68cd('0x21')](_0x17957e[_0x68cd('0x38')][_0x68cd('0x21')]);_0x4f796d[_0x68cd('0x20')]=qs['offset'](_0x17957e['query'][_0x68cd('0x20')]);}_0x4f796d['order']=qs['sort'](_0x17957e['query'][_0x68cd('0x42')]);_0x4f796d[_0x68cd('0x43')]=qs[_0x68cd('0x39')](_['pick'](_0x17957e[_0x68cd('0x38')],_0x56f981[_0x68cd('0x39')]));_0x4f796d['where']['WhatsappQueueId']=_0xd7c967['id'];if(_0x17957e[_0x68cd('0x38')][_0x68cd('0x45')]){_0x4f796d[_0x68cd('0x43')]=_[_0x68cd('0x46')](_0x4f796d[_0x68cd('0x43')],{'$or':_[_0x68cd('0x33')](_0x4f796d[_0x68cd('0x3b')],function(_0xb0b1bf){var _0x23f79f={};_0x23f79f[_0xb0b1bf]={'$like':'%'+_0x17957e[_0x68cd('0x38')][_0x68cd('0x45')]+'%'};return _0x23f79f;})});}_0x4f796d=_[_0x68cd('0x46')]({},_0x4f796d,_0x17957e[_0x68cd('0x51')]);return db[_0x68cd('0x5d')][_0x68cd('0x5e')](_0x4f796d);}})[_0x68cd('0x4b')](function(_0x44099c){if(_0x44099c){return db[_0x68cd('0x5f')]['findAndCountAll']({'where':{'id':_['map'](_0x44099c,_0x68cd('0x60')),'role':_0x68cd('0x61')},'attributes':['id',_0x68cd('0x30'),_0x68cd('0x62'),_0x68cd('0x63'),'createdAt']});}})[_0x68cd('0x4b')](function(_0x541e2d){if(_0x541e2d){return{'count':_0x541e2d[_0x68cd('0x23')],'rows':_[_0x68cd('0x33')](_0x541e2d[_0x68cd('0x4c')],function(_0x21ea95){return{'membername':_0x21ea95[_0x68cd('0x30')],'UserId':_0x21ea95['id'],'queue_name':_0x2dfc11[_0x68cd('0x30')],'WhatsappQueueId':_0x2dfc11['id'],'interface':util[_0x68cd('0x64')](_0x68cd('0x65'),_0x68cd('0x66'),_0x21ea95['name']),'penalty':0x0,'paused':_0x21ea95[_0x68cd('0x62')],'createdAt':_0x21ea95[_0x68cd('0x67')],'updatedAt':_0x21ea95[_0x68cd('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x68cd('0x4b')](respondWithFilteredResult(_0x5454b7,_0x4f796d))[_0x68cd('0x4d')](handleError(_0x5454b7,null));};exports[_0x68cd('0x68')]=function(_0x416568,_0x574c6f,_0x6afbee){var _0x92acb5={};var _0x53ae6f={};var _0x2337d7;var _0x458a49;return db[_0x68cd('0x34')][_0x68cd('0x69')]({'where':{'id':_0x416568[_0x68cd('0x4f')]['id']}})[_0x68cd('0x4b')](handleEntityNotFound(_0x574c6f,null))['then'](function(_0x3b3584){if(_0x3b3584){_0x2337d7=_0x3b3584;_0x53ae6f[_0x68cd('0x3e')]=_['keys'](db[_0x68cd('0x6a')][_0x68cd('0x50')]);_0x53ae6f['query']=_[_0x68cd('0x37')](_0x416568['query']);_0x53ae6f[_0x68cd('0x39')]=_[_0x68cd('0x3a')](_0x53ae6f[_0x68cd('0x3e')],_0x53ae6f[_0x68cd('0x38')]);_0x92acb5[_0x68cd('0x3b')]=_[_0x68cd('0x3a')](_0x53ae6f[_0x68cd('0x3e')],qs[_0x68cd('0x3c')](_0x416568[_0x68cd('0x38')][_0x68cd('0x3c')]));_0x92acb5['attributes']=_0x92acb5['attributes'][_0x68cd('0x3d')]?_0x92acb5[_0x68cd('0x3b')]:_0x53ae6f[_0x68cd('0x3e')];_0x92acb5[_0x68cd('0x41')]=qs[_0x68cd('0x42')](_0x416568[_0x68cd('0x38')]['sort']);_0x92acb5['where']=qs[_0x68cd('0x39')](_[_0x68cd('0x44')](_0x416568[_0x68cd('0x38')],_0x53ae6f['filters']));if(_0x416568['query']['filter']){_0x92acb5[_0x68cd('0x43')]=_[_0x68cd('0x46')](_0x92acb5[_0x68cd('0x43')],{'$or':_[_0x68cd('0x33')](_0x92acb5[_0x68cd('0x3b')],function(_0xb27d48){var _0xc71250={};_0xc71250[_0xb27d48]={'$like':'%'+_0x416568[_0x68cd('0x38')][_0x68cd('0x45')]+'%'};return _0xc71250;})});}_0x92acb5=_['merge']({},_0x92acb5,_0x416568[_0x68cd('0x51')]);return _0x2337d7['getTeams'](_0x92acb5);}})[_0x68cd('0x4b')](function(_0x41f012){if(_0x41f012){_0x458a49=_0x41f012['length'];if(!_0x416568[_0x68cd('0x38')][_0x68cd('0x3f')]('nolimit')){_0x92acb5[_0x68cd('0x21')]=qs['limit'](_0x416568[_0x68cd('0x38')][_0x68cd('0x21')]);_0x92acb5[_0x68cd('0x20')]=qs[_0x68cd('0x20')](_0x416568[_0x68cd('0x38')]['offset']);}return _0x2337d7[_0x68cd('0x68')](_0x92acb5);}})[_0x68cd('0x4b')](function(_0x334bdd){if(_0x334bdd){return _0x334bdd?{'count':_0x458a49,'rows':_0x334bdd}:null;}})[_0x68cd('0x4b')](respondWithResult(_0x574c6f,null))['catch'](handleError(_0x574c6f,null));};exports['addTeams']=function(_0x425093,_0x20f34d,_0x152360){var _0x1e19fc=_0x425093[_0x68cd('0x5a')][_0x68cd('0x6b')];return db[_0x68cd('0x6a')][_0x68cd('0x5e')]({'where':{'id':_0x1e19fc},'attributes':['id'],'include':[{'model':db[_0x68cd('0x5f')],'as':_0x68cd('0x6c'),'attributes':['id','name',_0x68cd('0x6d'),_0x68cd('0x6e'),_0x68cd('0x6f')],'raw':!![]}]})['then'](function(_0x4bf39d){if(_0x4bf39d){var _0x54b181=_['flatMap'](_0x4bf39d,function(_0x2e38bd){var _0x1fcc45=_0x2e38bd[_0x68cd('0x2b')]({'plain':!![]});return _0x1fcc45[_0x68cd('0x6c')];});return db[_0x68cd('0x34')][_0x68cd('0x52')]({'where':{'id':_0x425093['params']['id']}})['then'](function(_0x4f838e){return db[_0x68cd('0x70')][_0x68cd('0x71')](function(_0x1c698a){return _0x4f838e[_0x68cd('0x72')](_0x1e19fc,{'transaction':_0x1c698a})[_0x68cd('0x4b')](function(){return BPromise[_0x68cd('0x73')](_0x54b181,function(_0x497bc5){return db[_0x68cd('0x5d')][_0x68cd('0x74')]({'where':{'UserId':_0x497bc5['id'],'WhatsappQueueId':_0x425093['params']['id']},'transaction':_0x1c698a});});})[_0x68cd('0x4b')](function(){_0x54b181[_0x68cd('0x75')](function(_0x4765db){socket[_0x68cd('0x76')](_0x68cd('0x77'),{'UserId':_0x4765db['id'],'WhatsappQueueId':_0x4f838e['id']});});});});});}})[_0x68cd('0x4b')](respondWithStatusCode(_0x20f34d,null))['catch'](handleError(_0x20f34d,null));};exports[_0x68cd('0x78')]=function(_0x1fe1eb,_0x55d53c,_0x664823){return db[_0x68cd('0x6a')][_0x68cd('0x5e')]({'where':{'id':_0x1fe1eb[_0x68cd('0x38')][_0x68cd('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68cd('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x68cd('0x4b')](handleEntityNotFound(_0x55d53c,null))['then'](function(_0x385543){var _0x5184cd=_[_0x68cd('0x33')](_0x385543,'id');var _0x13a8d8=[];var _0x414721=[];var _0x391e5c=squel[_0x68cd('0x79')]();_0x391e5c[_0x68cd('0x7a')](_0x68cd('0x7b'))[_0x68cd('0x7c')](_0x68cd('0x7d'),'tq')['join'](_0x68cd('0x7e'),'ut',_0x68cd('0x7f'))[_0x68cd('0x43')](_0x68cd('0x80'),_0x1fe1eb[_0x68cd('0x4f')]['id']);for(var _0x4f3ad6=0x0;_0x4f3ad6<_0x385543[_0x68cd('0x3d')];_0x4f3ad6+=0x1){let _0x5f20b5=_0x385543[_0x4f3ad6];for(var _0xe68d0e=0x0;_0xe68d0e<_0x5f20b5[_0x68cd('0x6c')][_0x68cd('0x3d')];_0xe68d0e+=0x1){let _0xdefb6a=_0x5f20b5[_0x68cd('0x6c')][_0xe68d0e];var _0x54dce3=_0x391e5c[_0x68cd('0x81')]();_0x54dce3['where'](_0x68cd('0x82'),_0xdefb6a['id']);_0x414721['push'](db[_0x68cd('0x70')][_0x68cd('0x38')](_0x54dce3[_0x68cd('0x83')](),{'type':db['sequelize']['QueryTypes'][_0x68cd('0x84')]})[_0x68cd('0x4b')](function(_0x1ce21d){if(_0x1ce21d[_0x68cd('0x3d')]===0x1){return _0xdefb6a['id'];}else{var _0x37d3d6=_[_0x68cd('0x85')](_[_0x68cd('0x33')](_0x1ce21d,_0x68cd('0x86')),function(_0x3efecd){return _[_0x68cd('0x87')](_0x5184cd,_0x3efecd);});if(_0x37d3d6){return _0xdefb6a['id'];}}}));}}return BPromise[_0x68cd('0x88')](_0x414721)[_0x68cd('0x4b')](function(_0x4636a0){_0x13a8d8=_(_0x13a8d8)['union'](_0x4636a0)[_0x68cd('0x89')]()[_0x68cd('0x8a')]();return db[_0x68cd('0x34')][_0x68cd('0x52')]({'where':{'id':_0x1fe1eb['params']['id']}})['then'](function(_0x15ca3e){return db[_0x68cd('0x70')][_0x68cd('0x71')](function(_0x3daf2c){return _0x15ca3e[_0x68cd('0x78')](_0x1fe1eb[_0x68cd('0x38')]['ids'],{'transaction':_0x3daf2c})[_0x68cd('0x4b')](function(){if(!_[_0x68cd('0x8b')](_0x13a8d8)){return _0x15ca3e['removeAgents'](_0x13a8d8,{'transaction':_0x3daf2c});}})[_0x68cd('0x4b')](function(){_0x13a8d8[_0x68cd('0x75')](function(_0x56570a){socket['emit'](_0x68cd('0x8c'),{'UserId':_0x56570a,'WhatsappQueueId':_0x15ca3e['id']});});});});});});})[_0x68cd('0x4b')](respondWithStatusCode(_0x55d53c,null))[_0x68cd('0x4d')](handleError(_0x55d53c,null));};exports[_0x68cd('0x8d')]=function(_0x54de17,_0x23f6bb,_0xce7fe1){return db[_0x68cd('0x34')]['find']({'where':{'id':_0x54de17[_0x68cd('0x4f')]['id']}})[_0x68cd('0x4b')](handleEntityNotFound(_0x23f6bb,null))[_0x68cd('0x4b')](function(_0x239a9c){if(_0x239a9c){return _0x239a9c[_0x68cd('0x8d')](_0x54de17[_0x68cd('0x5a')][_0x68cd('0x6b')],_['omit'](_0x54de17['body'],[_0x68cd('0x6b'),'id'])||{})[_0x68cd('0x8e')](function(_0x4fd4eb){for(var _0x18bffa=0x0;_0x18bffa<_0x54de17['body'][_0x68cd('0x6b')][_0x68cd('0x3d')];_0x18bffa+=0x1){socket[_0x68cd('0x76')]('userWhatsappQueue:save',{'UserId':_0x54de17[_0x68cd('0x5a')]['ids'][_0x18bffa],'WhatsappQueueId':_0x54de17[_0x68cd('0x4f')]['id']});}return _0x4fd4eb;});}})[_0x68cd('0x4b')](respondWithResult(_0x23f6bb,null))[_0x68cd('0x4d')](handleError(_0x23f6bb,null));};exports[_0x68cd('0x8f')]=function(_0xdc2d4e,_0x288e90,_0x2d5ea1){return db[_0x68cd('0x34')][_0x68cd('0x52')]({'where':{'id':_0xdc2d4e[_0x68cd('0x4f')]['id']}})['then'](handleEntityNotFound(_0x288e90,null))[_0x68cd('0x4b')](function(_0x1a3f9e){if(_0x1a3f9e){return _0x1a3f9e[_0x68cd('0x8f')](_0xdc2d4e[_0x68cd('0x38')][_0x68cd('0x6b')])[_0x68cd('0x4b')](function(){if(_[_0x68cd('0x90')](_0xdc2d4e['query'][_0x68cd('0x6b')])){for(var _0x157b71=0x0;_0x157b71<_0xdc2d4e[_0x68cd('0x38')]['ids'][_0x68cd('0x3d')];_0x157b71+=0x1){socket['emit'](_0x68cd('0x8c'),{'UserId':Number(_0xdc2d4e[_0x68cd('0x38')][_0x68cd('0x6b')][_0x157b71]),'WhatsappQueueId':Number(_0xdc2d4e[_0x68cd('0x4f')]['id'])});}}else{socket[_0x68cd('0x76')](_0x68cd('0x8c'),{'UserId':Number(_0xdc2d4e[_0x68cd('0x38')]['ids']),'WhatsappQueueId':Number(_0xdc2d4e[_0x68cd('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x288e90,null))[_0x68cd('0x4d')](handleError(_0x288e90,null));};exports[_0x68cd('0x91')]=function(_0x52e094,_0x44f355,_0x2ea1f3){var _0x1a2cd9={};var _0x1d9db9={};var _0x17efb1;var _0x48f92e;return db[_0x68cd('0x34')][_0x68cd('0x69')]({'where':{'id':_0x52e094[_0x68cd('0x4f')]['id']}})[_0x68cd('0x4b')](handleEntityNotFound(_0x44f355,null))[_0x68cd('0x4b')](function(_0x5bcf17){if(_0x5bcf17){_0x17efb1=_0x5bcf17;_0x1d9db9[_0x68cd('0x3e')]=_['keys'](db[_0x68cd('0x5f')]['rawAttributes']);_0x1d9db9[_0x68cd('0x38')]=_[_0x68cd('0x37')](_0x52e094[_0x68cd('0x38')]);_0x1d9db9[_0x68cd('0x39')]=_[_0x68cd('0x3a')](_0x1d9db9[_0x68cd('0x3e')],_0x1d9db9[_0x68cd('0x38')]);_0x1a2cd9['attributes']=_[_0x68cd('0x3a')](_0x1d9db9[_0x68cd('0x3e')],qs['fields'](_0x52e094['query'][_0x68cd('0x3c')]));_0x1a2cd9['attributes']=_0x1a2cd9[_0x68cd('0x3b')][_0x68cd('0x3d')]?_0x1a2cd9[_0x68cd('0x3b')]:_0x1d9db9['model'];_0x1a2cd9['order']=qs[_0x68cd('0x42')](_0x52e094['query'][_0x68cd('0x42')]);_0x1a2cd9[_0x68cd('0x43')]=qs[_0x68cd('0x39')](_['pick'](_0x52e094[_0x68cd('0x38')],_0x1d9db9[_0x68cd('0x39')]));if(_0x52e094[_0x68cd('0x38')][_0x68cd('0x45')]){_0x1a2cd9[_0x68cd('0x43')]=_[_0x68cd('0x46')](_0x1a2cd9[_0x68cd('0x43')],{'$or':_[_0x68cd('0x33')](_0x1a2cd9[_0x68cd('0x3b')],function(_0x47cdcc){var _0x47a4b1={};_0x47a4b1[_0x47cdcc]={'$like':'%'+_0x52e094['query'][_0x68cd('0x45')]+'%'};return _0x47a4b1;})});}_0x1a2cd9=_[_0x68cd('0x46')]({},_0x1a2cd9,_0x52e094[_0x68cd('0x51')]);return _0x17efb1[_0x68cd('0x91')](_0x1a2cd9);}})['then'](function(_0x3bcb0d){if(_0x3bcb0d){_0x48f92e=_0x3bcb0d[_0x68cd('0x3d')];if(!_0x52e094['query'][_0x68cd('0x3f')](_0x68cd('0x40'))){_0x1a2cd9[_0x68cd('0x21')]=qs['limit'](_0x52e094[_0x68cd('0x38')][_0x68cd('0x21')]);_0x1a2cd9[_0x68cd('0x20')]=qs[_0x68cd('0x20')](_0x52e094['query']['offset']);}return _0x17efb1[_0x68cd('0x91')](_0x1a2cd9);}})[_0x68cd('0x4b')](function(_0x390dcf){if(_0x390dcf){return _0x390dcf?{'count':_0x48f92e,'rows':_0x390dcf}:null;}})[_0x68cd('0x4b')](respondWithResult(_0x44f355,null))[_0x68cd('0x4d')](handleError(_0x44f355,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6891fb5..21ebc9f 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 _0xdb45=['../../mysqldb','WhatsappQueue','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x14e2e7,_0x214bc3){var _0x411776=function(_0x1773bc){while(--_0x1773bc){_0x14e2e7['push'](_0x14e2e7['shift']());}};_0x411776(++_0x214bc3);}(_0xdb45,0x16f));var _0x5db4=function(_0x3cad98,_0x3a6539){_0x3cad98=_0x3cad98-0x0;var _0x53f43c=_0xdb45[_0x3cad98];return _0x53f43c;};'use strict';var EventEmitter=require(_0x5db4('0x0'));var WhatsappQueue=require(_0x5db4('0x1'))['db'][_0x5db4('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5db4('0x3'),'afterDestroy':_0x5db4('0x4')};function emitEvent(_0x15cd2b){return function(_0x5713c0,_0x5b99e5,_0x3d6f11){WhatsappQueueEvents[_0x5db4('0x5')](_0x15cd2b+':'+_0x5713c0['id'],_0x5713c0);WhatsappQueueEvents[_0x5db4('0x5')](_0x15cd2b,_0x5713c0);_0x3d6f11(null);};}for(var e in events){if(events[_0x5db4('0x6')](e)){var event=events[e];WhatsappQueue[_0x5db4('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xdab5=['exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hook'];(function(_0x328405,_0xc0699e){var _0x1c563b=function(_0x140ae2){while(--_0x140ae2){_0x328405['push'](_0x328405['shift']());}};_0x1c563b(++_0xc0699e);}(_0xdab5,0xd3));var _0x5dab=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xdab5[_0x3511d3];return _0x5d6321;};'use strict';var EventEmitter=require(_0x5dab('0x0'));var WhatsappQueue=require(_0x5dab('0x1'))['db'][_0x5dab('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5dab('0x3')](0x0);var events={'afterCreate':_0x5dab('0x4'),'afterUpdate':_0x5dab('0x5'),'afterDestroy':_0x5dab('0x6')};function emitEvent(_0x3832bc){return function(_0x426de4,_0x33d22e,_0x1a249a){WhatsappQueueEvents[_0x5dab('0x7')](_0x3832bc+':'+_0x426de4['id'],_0x426de4);WhatsappQueueEvents[_0x5dab('0x7')](_0x3832bc,_0x426de4);_0x1a249a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x5dab('0x8')](e,emitEvent(event));}}module[_0x5dab('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index a874561..cf80477 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 _0x273e=['define','WhatsappQueue','whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x273e,0x162));var _0xe273=function(_0x7c2847,_0x6b9d38){_0x7c2847=_0x7c2847-0x0;var _0x21243e=_0x273e[_0x7c2847];return _0x21243e;};'use strict';var _=require(_0xe273('0x0'));var util=require(_0xe273('0x1'));var logger=require('../../config/logger')(_0xe273('0x2'));var moment=require(_0xe273('0x3'));var BPromise=require(_0xe273('0x4'));var rp=require(_0xe273('0x5'));var fs=require('fs');var path=require(_0xe273('0x6'));var rimraf=require('rimraf');var config=require(_0xe273('0x7'));var attributes=require(_0xe273('0x8'));module[_0xe273('0x9')]=function(_0x481489,_0x3a2c65){return _0x481489[_0xe273('0xa')](_0xe273('0xb'),attributes,{'tableName':_0xe273('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63ce=['define','whatsapp_queues','util','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x63ce,0xda));var _0xe63c=function(_0x2a390b,_0xf49f9b){_0x2a390b=_0x2a390b-0x0;var _0x5df10a=_0x63ce[_0x2a390b];return _0x5df10a;};'use strict';var _=require('lodash');var util=require(_0xe63c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe63c('0x1'));var BPromise=require(_0xe63c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe63c('0x3'));var rimraf=require(_0xe63c('0x4'));var config=require(_0xe63c('0x5'));var attributes=require(_0xe63c('0x6'));module['exports']=function(_0x2e3598,_0x40ff2e){return _0x2e3598[_0xe63c('0x7')]('WhatsappQueue',attributes,{'tableName':_0xe63c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index dfdf676..51fb2dd 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 _0x7fd4=['find','where','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','then','info','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','WhatsappQueue','options','raw','attributes','limit','map','include','model','GetWhatsappQueue','ShowWhatsappQueue'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7fd4,0xf9));var _0x47fd=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0x7fd4[_0x441563];return _0x2369ec;};'use strict';var _=require(_0x47fd('0x0'));var util=require('util');var moment=require(_0x47fd('0x1'));var BPromise=require(_0x47fd('0x2'));var rs=require(_0x47fd('0x3'));var fs=require('fs');var Redis=require(_0x47fd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47fd('0x5'));var logger=require(_0x47fd('0x6'))(_0x47fd('0x7'));var config=require(_0x47fd('0x8'));var jayson=require(_0x47fd('0x9'));var client=jayson[_0x47fd('0xa')][_0x47fd('0xb')]({'port':0x232a});config[_0x47fd('0xc')]=_[_0x47fd('0xd')](config[_0x47fd('0xc')],{'host':_0x47fd('0xe'),'port':0x18eb});var socket=require(_0x47fd('0xf'))(new Redis(config['redis']));require(_0x47fd('0x10'))['register'](socket);function respondWithRpcPromise(_0x209740,_0x210908,_0x48ec32){return new BPromise(function(_0x472176,_0x827471){return client['request'](_0x209740,_0x48ec32)[_0x47fd('0x11')](function(_0x1d7767){logger[_0x47fd('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x210908,'request\x20sent');logger['debug'](_0x47fd('0x13'),_0x210908,_0x47fd('0x14'),JSON[_0x47fd('0x15')](_0x1d7767));if(_0x1d7767[_0x47fd('0x16')]){if(_0x1d7767[_0x47fd('0x16')][_0x47fd('0x17')]===0x1f4){logger[_0x47fd('0x16')](_0x47fd('0x18'),_0x210908,_0x1d7767['error']['message']);return _0x827471(_0x1d7767[_0x47fd('0x16')]['message']);}logger[_0x47fd('0x16')](_0x47fd('0x18'),_0x210908,_0x1d7767[_0x47fd('0x16')][_0x47fd('0x19')]);return _0x472176(_0x1d7767[_0x47fd('0x16')]['message']);}else{logger[_0x47fd('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x210908,'request\x20sent');_0x472176(_0x1d7767[_0x47fd('0x1a')][_0x47fd('0x19')]);}})[_0x47fd('0x1b')](function(_0x218473){logger[_0x47fd('0x16')](_0x47fd('0x18'),_0x210908,_0x218473);_0x827471(_0x218473);});});}exports['GetWhatsappQueue']=function(_0x470e24){var _0x3bc771=this;return new Promise(function(_0x2f4c12,_0x106067){return db[_0x47fd('0x1c')]['findAll']({'raw':_0x470e24[_0x47fd('0x1d')]?_0x470e24[_0x47fd('0x1d')][_0x47fd('0x1e')]===undefined?!![]:![]:!![],'where':_0x470e24[_0x47fd('0x1d')]?_0x470e24[_0x47fd('0x1d')]['where']||null:null,'attributes':_0x470e24[_0x47fd('0x1d')]?_0x470e24[_0x47fd('0x1d')][_0x47fd('0x1f')]||null:null,'limit':_0x470e24['options']?_0x470e24[_0x47fd('0x1d')][_0x47fd('0x20')]||null:null,'include':_0x470e24[_0x47fd('0x1d')]?_0x470e24[_0x47fd('0x1d')]['include']?_[_0x47fd('0x21')](_0x470e24['options'][_0x47fd('0x22')],function(_0xf0f191){return{'model':db[_0xf0f191['model']],'as':_0xf0f191['as'],'attributes':_0xf0f191[_0x47fd('0x1f')],'include':_0xf0f191[_0x47fd('0x22')]?_[_0x47fd('0x21')](_0xf0f191['include'],function(_0x36cf81){return{'model':db[_0x36cf81['model']],'as':_0x36cf81['as'],'attributes':_0x36cf81[_0x47fd('0x1f')],'include':_0x36cf81[_0x47fd('0x22')]?_[_0x47fd('0x21')](_0x36cf81[_0x47fd('0x22')],function(_0x38b4e9){return{'model':db[_0x38b4e9[_0x47fd('0x23')]],'as':_0x38b4e9['as'],'attributes':_0x38b4e9[_0x47fd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x47fd('0x11')](function(_0x10dcf3){logger['info'](_0x47fd('0x24'),_0x470e24);logger['debug'](_0x47fd('0x24'),_0x470e24,JSON['stringify'](_0x10dcf3));_0x2f4c12(_0x10dcf3);})[_0x47fd('0x1b')](function(_0x195058){logger[_0x47fd('0x16')]('GetWhatsappQueue',_0x195058[_0x47fd('0x19')],_0x470e24);_0x106067(_0x3bc771['error'](0x1f4,_0x195058['message']));});});};exports[_0x47fd('0x25')]=function(_0xaa530d){var _0x5aec70=this;return new Promise(function(_0x2849f7,_0x38b214){return db[_0x47fd('0x1c')][_0x47fd('0x26')]({'raw':_0xaa530d['options']?_0xaa530d[_0x47fd('0x1d')][_0x47fd('0x1e')]===undefined?!![]:![]:!![],'where':_0xaa530d[_0x47fd('0x1d')]?_0xaa530d[_0x47fd('0x1d')][_0x47fd('0x27')]||null:null,'attributes':_0xaa530d[_0x47fd('0x1d')]?_0xaa530d['options'][_0x47fd('0x1f')]||null:null,'include':_0xaa530d[_0x47fd('0x1d')]?_0xaa530d[_0x47fd('0x1d')][_0x47fd('0x22')]?_[_0x47fd('0x21')](_0xaa530d['options'][_0x47fd('0x22')],function(_0x5af7d6){return{'model':db[_0x5af7d6[_0x47fd('0x23')]],'as':_0x5af7d6['as'],'attributes':_0x5af7d6['attributes'],'include':_0x5af7d6['include']?_[_0x47fd('0x21')](_0x5af7d6[_0x47fd('0x22')],function(_0x312521){return{'model':db[_0x312521[_0x47fd('0x23')]],'as':_0x312521['as'],'attributes':_0x312521[_0x47fd('0x1f')],'include':_0x312521[_0x47fd('0x22')]?_[_0x47fd('0x21')](_0x312521[_0x47fd('0x22')],function(_0x2837aa){return{'model':db[_0x2837aa[_0x47fd('0x23')]],'as':_0x2837aa['as'],'attributes':_0x2837aa[_0x47fd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x47fd('0x11')](function(_0x2e8de6){logger[_0x47fd('0x12')](_0x47fd('0x25'),_0xaa530d);logger[_0x47fd('0x28')](_0x47fd('0x25'),_0xaa530d,JSON['stringify'](_0x2e8de6));_0x2849f7(_0x2e8de6);})[_0x47fd('0x1b')](function(_0x1496dd){logger[_0x47fd('0x16')](_0x47fd('0x25'),_0x1496dd[_0x47fd('0x19')],_0xaa530d);_0x38b214(_0x5aec70[_0x47fd('0x16')](0x1f4,_0x1496dd['message']));});});}; \ No newline at end of file +var _0x87c6=['map','model','then','ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','info','debug','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x43011f,_0x265e5e){var _0x3f962b=function(_0x461706){while(--_0x461706){_0x43011f['push'](_0x43011f['shift']());}};_0x3f962b(++_0x265e5e);}(_0x87c6,0x12c));var _0x687c=function(_0x15fb4e,_0x2e45e1){_0x15fb4e=_0x15fb4e-0x0;var _0x5b5351=_0x87c6[_0x15fb4e];return _0x5b5351;};'use strict';var _=require(_0x687c('0x0'));var util=require(_0x687c('0x1'));var moment=require(_0x687c('0x2'));var BPromise=require('bluebird');var rs=require(_0x687c('0x3'));var fs=require('fs');var Redis=require(_0x687c('0x4'));var db=require(_0x687c('0x5'))['db'];var utils=require(_0x687c('0x6'));var logger=require(_0x687c('0x7'))(_0x687c('0x8'));var config=require(_0x687c('0x9'));var jayson=require(_0x687c('0xa'));var client=jayson[_0x687c('0xb')][_0x687c('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x687c('0xd')],{'host':_0x687c('0xe'),'port':0x18eb});var socket=require(_0x687c('0xf'))(new Redis(config[_0x687c('0xd')]));require(_0x687c('0x10'))['register'](socket);function respondWithRpcPromise(_0x4b893b,_0x2cad01,_0x145abe){return new BPromise(function(_0x20052f,_0x3c2b5f){return client[_0x687c('0x11')](_0x4b893b,_0x145abe)['then'](function(_0x4d4fad){logger[_0x687c('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x2cad01,'request\x20sent');logger[_0x687c('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2cad01,_0x687c('0x14'),JSON[_0x687c('0x15')](_0x4d4fad));if(_0x4d4fad[_0x687c('0x16')]){if(_0x4d4fad[_0x687c('0x16')][_0x687c('0x17')]===0x1f4){logger['error'](_0x687c('0x18'),_0x2cad01,_0x4d4fad[_0x687c('0x16')]['message']);return _0x3c2b5f(_0x4d4fad[_0x687c('0x16')][_0x687c('0x19')]);}logger[_0x687c('0x16')](_0x687c('0x18'),_0x2cad01,_0x4d4fad[_0x687c('0x16')][_0x687c('0x19')]);return _0x20052f(_0x4d4fad['error'][_0x687c('0x19')]);}else{logger[_0x687c('0x12')](_0x687c('0x18'),_0x2cad01,_0x687c('0x14'));_0x20052f(_0x4d4fad[_0x687c('0x1a')]['message']);}})[_0x687c('0x1b')](function(_0x5ba865){logger[_0x687c('0x16')](_0x687c('0x18'),_0x2cad01,_0x5ba865);_0x3c2b5f(_0x5ba865);});});}exports[_0x687c('0x1c')]=function(_0x9a4430){var _0x2a1947=this;return new Promise(function(_0x51e1bd,_0x2d92f4){return db['WhatsappQueue'][_0x687c('0x1d')]({'raw':_0x9a4430[_0x687c('0x1e')]?_0x9a4430[_0x687c('0x1e')][_0x687c('0x1f')]===undefined?!![]:![]:!![],'where':_0x9a4430[_0x687c('0x1e')]?_0x9a4430[_0x687c('0x1e')][_0x687c('0x20')]||null:null,'attributes':_0x9a4430[_0x687c('0x1e')]?_0x9a4430['options'][_0x687c('0x21')]||null:null,'limit':_0x9a4430[_0x687c('0x1e')]?_0x9a4430[_0x687c('0x1e')][_0x687c('0x22')]||null:null,'include':_0x9a4430[_0x687c('0x1e')]?_0x9a4430[_0x687c('0x1e')][_0x687c('0x23')]?_[_0x687c('0x24')](_0x9a4430[_0x687c('0x1e')][_0x687c('0x23')],function(_0x23210f){return{'model':db[_0x23210f[_0x687c('0x25')]],'as':_0x23210f['as'],'attributes':_0x23210f[_0x687c('0x21')],'include':_0x23210f[_0x687c('0x23')]?_[_0x687c('0x24')](_0x23210f[_0x687c('0x23')],function(_0x1dc3b7){return{'model':db[_0x1dc3b7[_0x687c('0x25')]],'as':_0x1dc3b7['as'],'attributes':_0x1dc3b7[_0x687c('0x21')],'include':_0x1dc3b7[_0x687c('0x23')]?_[_0x687c('0x24')](_0x1dc3b7[_0x687c('0x23')],function(_0x2df7d5){return{'model':db[_0x2df7d5[_0x687c('0x25')]],'as':_0x2df7d5['as'],'attributes':_0x2df7d5[_0x687c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x687c('0x26')](function(_0x25223d){logger[_0x687c('0x12')](_0x687c('0x1c'),_0x9a4430);logger[_0x687c('0x13')]('GetWhatsappQueue',_0x9a4430,JSON[_0x687c('0x15')](_0x25223d));_0x51e1bd(_0x25223d);})[_0x687c('0x1b')](function(_0x41caf5){logger[_0x687c('0x16')](_0x687c('0x1c'),_0x41caf5[_0x687c('0x19')],_0x9a4430);_0x2d92f4(_0x2a1947[_0x687c('0x16')](0x1f4,_0x41caf5[_0x687c('0x19')]));});});};exports[_0x687c('0x27')]=function(_0x192c30){var _0x58d496=this;return new Promise(function(_0x2e3dbe,_0x55c016){return db[_0x687c('0x28')][_0x687c('0x29')]({'raw':_0x192c30['options']?_0x192c30[_0x687c('0x1e')][_0x687c('0x1f')]===undefined?!![]:![]:!![],'where':_0x192c30[_0x687c('0x1e')]?_0x192c30[_0x687c('0x1e')][_0x687c('0x20')]||null:null,'attributes':_0x192c30[_0x687c('0x1e')]?_0x192c30['options'][_0x687c('0x21')]||null:null,'include':_0x192c30[_0x687c('0x1e')]?_0x192c30[_0x687c('0x1e')]['include']?_[_0x687c('0x24')](_0x192c30[_0x687c('0x1e')][_0x687c('0x23')],function(_0x2bd8fb){return{'model':db[_0x2bd8fb[_0x687c('0x25')]],'as':_0x2bd8fb['as'],'attributes':_0x2bd8fb['attributes'],'include':_0x2bd8fb[_0x687c('0x23')]?_[_0x687c('0x24')](_0x2bd8fb['include'],function(_0x1ef285){return{'model':db[_0x1ef285[_0x687c('0x25')]],'as':_0x1ef285['as'],'attributes':_0x1ef285[_0x687c('0x21')],'include':_0x1ef285[_0x687c('0x23')]?_[_0x687c('0x24')](_0x1ef285[_0x687c('0x23')],function(_0x2442ee){return{'model':db[_0x2442ee[_0x687c('0x25')]],'as':_0x2442ee['as'],'attributes':_0x2442ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x687c('0x26')](function(_0x2d31cc){logger[_0x687c('0x12')](_0x687c('0x27'),_0x192c30);logger[_0x687c('0x13')](_0x687c('0x27'),_0x192c30,JSON[_0x687c('0x15')](_0x2d31cc));_0x2e3dbe(_0x2d31cc);})['catch'](function(_0x369526){logger[_0x687c('0x16')](_0x687c('0x27'),_0x369526[_0x687c('0x19')],_0x192c30);_0x55c016(_0x58d496[_0x687c('0x16')](0x1f4,_0x369526[_0x687c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 6de665f..2f549ec 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 _0x39e0=['remove','update','emit','length','./whatsappQueue.events','save'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x39e0,0x190));var _0x039e=function(_0x2110e5,_0x1e899a){_0x2110e5=_0x2110e5-0x0;var _0x2b47a1=_0x39e0[_0x2110e5];return _0x2b47a1;};'use strict';var WhatsappQueueEvents=require(_0x039e('0x0'));var events=[_0x039e('0x1'),_0x039e('0x2'),_0x039e('0x3')];function createListener(_0x59ff1d,_0x5f3fea){return function(_0x299c41){_0x5f3fea[_0x039e('0x4')](_0x59ff1d,_0x299c41);};}function removeListener(_0xb5fa4d,_0x319e1e){return function(){WhatsappQueueEvents['removeListener'](_0xb5fa4d,_0x319e1e);};}exports['register']=function(_0x25c3e2){for(var _0x40872a=0x0,_0x5f4be6=events[_0x039e('0x5')];_0x40872a<_0x5f4be6;_0x40872a++){var _0x34e2cf=events[_0x40872a];var _0x488a43=createListener('whatsappQueue:'+_0x34e2cf,_0x25c3e2);WhatsappQueueEvents['on'](_0x34e2cf,_0x488a43);}}; \ No newline at end of file +var _0x7735=['whatsappQueue:','save','update','emit','removeListener','register'];(function(_0x501ba2,_0x2d9480){var _0x2ad211=function(_0x22a3a6){while(--_0x22a3a6){_0x501ba2['push'](_0x501ba2['shift']());}};_0x2ad211(++_0x2d9480);}(_0x7735,0x1b1));var _0x5773=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7735[_0x2be8c2];return _0x97f531;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x5773('0x0'),'remove',_0x5773('0x1')];function createListener(_0x2f4372,_0x50ff2b){return function(_0x3d09cf){_0x50ff2b[_0x5773('0x2')](_0x2f4372,_0x3d09cf);};}function removeListener(_0x18541,_0x4f3efe){return function(){WhatsappQueueEvents[_0x5773('0x3')](_0x18541,_0x4f3efe);};}exports[_0x5773('0x4')]=function(_0x5a41b8){for(var _0x1a7d44=0x0,_0xf7640f=events['length'];_0x1a7d44<_0xf7640f;_0x1a7d44++){var _0x3b532b=events[_0x1a7d44];var _0x1e9d17=createListener(_0x5773('0x5')+_0x3b532b,_0x5a41b8);WhatsappQueueEvents['on'](_0x3b532b,_0x1e9d17);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 2afb9ef..125d501 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 _0x823c=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','update','delete','destroy','exports'];(function(_0x49b845,_0x2c2580){var _0x346715=function(_0x5dfe97){while(--_0x5dfe97){_0x49b845['push'](_0x49b845['shift']());}};_0x346715(++_0x2c2580);}(_0x823c,0x143));var _0xc823=function(_0x346c9d,_0xa0e6b4){_0x346c9d=_0x346c9d-0x0;var _0x3d74d1=_0x823c[_0x346c9d];return _0x3d74d1;};'use strict';var multer=require(_0xc823('0x0'));var util=require('util');var path=require(_0xc823('0x1'));var timeout=require(_0xc823('0x2'));var express=require(_0xc823('0x3'));var router=express[_0xc823('0x4')]();var fs_extra=require(_0xc823('0x5'));var auth=require(_0xc823('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc823('0x7'));var controller=require(_0xc823('0x8'));router[_0xc823('0x9')]('/',auth[_0xc823('0xa')](),controller[_0xc823('0xb')]);router['get'](_0xc823('0xc'),auth[_0xc823('0xa')](),controller['describe']);router['get'](_0xc823('0xd'),auth[_0xc823('0xa')](),controller['show']);router[_0xc823('0xe')]('/',auth[_0xc823('0xa')](),controller['create']);router['put'](_0xc823('0xd'),auth[_0xc823('0xa')](),controller[_0xc823('0xf')]);router[_0xc823('0x10')](_0xc823('0xd'),auth['isAuthenticated'](),controller[_0xc823('0x11')]);module[_0xc823('0x12')]=router; \ No newline at end of file +var _0x082b=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x2190d6,_0xebab6d){var _0x312c91=function(_0xf8b80c){while(--_0xf8b80c){_0x2190d6['push'](_0x2190d6['shift']());}};_0x312c91(++_0xebab6d);}(_0x082b,0x1ec));var _0xb082=function(_0x14dcc5,_0x163ab7){_0x14dcc5=_0x14dcc5-0x0;var _0x35d6cc=_0x082b[_0x14dcc5];return _0x35d6cc;};'use strict';var multer=require(_0xb082('0x0'));var util=require(_0xb082('0x1'));var path=require(_0xb082('0x2'));var timeout=require(_0xb082('0x3'));var express=require('express');var router=express[_0xb082('0x4')]();var fs_extra=require(_0xb082('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb082('0x6'));var config=require(_0xb082('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0xb082('0x8')]('/',auth[_0xb082('0x9')](),controller[_0xb082('0xa')]);router[_0xb082('0x8')]('/describe',auth[_0xb082('0x9')](),controller[_0xb082('0xb')]);router[_0xb082('0x8')]('/:id',auth[_0xb082('0x9')](),controller[_0xb082('0xc')]);router[_0xb082('0xd')]('/',auth[_0xb082('0x9')](),controller['create']);router[_0xb082('0xe')]('/:id',auth[_0xb082('0x9')](),controller[_0xb082('0xf')]);router[_0xb082('0x10')]('/:id',auth[_0xb082('0x9')](),controller[_0xb082('0x11')]);module[_0xb082('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 27861e3..281f62e 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(_0x54b700,_0x4eeb3d){var _0x813d2=function(_0x23b980){while(--_0x23b980){_0x54b700['push'](_0x54b700['shift']());}};_0x813d2(++_0x4eeb3d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 _0x008c=['sequelize','exports','STRING','DATE'];(function(_0x2e5f6d,_0x14f116){var _0x566c53=function(_0xe7bde4){while(--_0xe7bde4){_0x2e5f6d['push'](_0x2e5f6d['shift']());}};_0x566c53(++_0x14f116);}(_0x008c,0x188));var _0xc008=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x008c[_0x2468b5];return _0x1056e4;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'uniqueid':{'type':Sequelize[_0xc008('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc008('0x2')]},'joinAt':{'type':Sequelize[_0xc008('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc008('0x3')]},'exitAt':{'type':Sequelize[_0xc008('0x3')]},'reason':{'type':Sequelize[_0xc008('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index afcd23f..058a2f7 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 _0xc029=['include','findAll','rows','catch','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','name','index','map','WhatsappQueueReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll'];(function(_0x43bf97,_0x2965b5){var _0x8c03b2=function(_0x15808b){while(--_0x15808b){_0x43bf97['push'](_0x43bf97['shift']());}};_0x8c03b2(++_0x2965b5);}(_0xc029,0x18a));var _0x9c02=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0xc029[_0x2cde0a];return _0x260610;};'use strict';var emlformat=require(_0x9c02('0x0'));var rimraf=require(_0x9c02('0x1'));var zipdir=require(_0x9c02('0x2'));var jsonpatch=require(_0x9c02('0x3'));var rp=require(_0x9c02('0x4'));var moment=require(_0x9c02('0x5'));var BPromise=require(_0x9c02('0x6'));var Mustache=require(_0x9c02('0x7'));var util=require(_0x9c02('0x8'));var path=require(_0x9c02('0x9'));var sox=require('sox');var csv=require(_0x9c02('0xa'));var ejs=require(_0x9c02('0xb'));var fs=require('fs');var fs_extra=require(_0x9c02('0xc'));var _=require(_0x9c02('0xd'));var squel=require(_0x9c02('0xe'));var crypto=require(_0x9c02('0xf'));var jsforce=require(_0x9c02('0x10'));var deskjs=require(_0x9c02('0x11'));var toCsv=require(_0x9c02('0xa'));var querystring=require('querystring');var Papa=require(_0x9c02('0x12'));var Redis=require(_0x9c02('0x13'));var authService=require(_0x9c02('0x14'));var qs=require(_0x9c02('0x15'));var as=require(_0x9c02('0x16'));var hardwareService=require(_0x9c02('0x17'));var logger=require(_0x9c02('0x18'))(_0x9c02('0x19'));var utils=require(_0x9c02('0x1a'));var config=require(_0x9c02('0x1b'));var licenseUtil=require(_0x9c02('0x1c'));var db=require(_0x9c02('0x1d'))['db'];function respondWithStatusCode(_0x1a7bee,_0x339094){_0x339094=_0x339094||0xcc;return function(_0x377df7){if(_0x377df7){return _0x1a7bee[_0x9c02('0x1e')](_0x339094);}return _0x1a7bee[_0x9c02('0x1f')](_0x339094)['end']();};}function respondWithResult(_0x15b5f8,_0xf26ea9){_0xf26ea9=_0xf26ea9||0xc8;return function(_0x4e3cda){if(_0x4e3cda){return _0x15b5f8[_0x9c02('0x1f')](_0xf26ea9)[_0x9c02('0x20')](_0x4e3cda);}};}function respondWithFilteredResult(_0x523a98,_0x46a016){return function(_0x569e7d){if(_0x569e7d){var _0x4cb435=typeof _0x46a016[_0x9c02('0x21')]==='undefined'&&typeof _0x46a016[_0x9c02('0x22')]==='undefined';var _0x3fae43=_0x569e7d[_0x9c02('0x23')];var _0x2db57e=_0x4cb435?0x0:_0x46a016[_0x9c02('0x21')];var _0x22ea5d=_0x4cb435?_0x569e7d['count']:_0x46a016[_0x9c02('0x21')]+_0x46a016[_0x9c02('0x22')];var _0x18cd19;if(_0x22ea5d>=_0x3fae43){_0x22ea5d=_0x3fae43;_0x18cd19=0xc8;}else{_0x18cd19=0xce;}_0x523a98['status'](_0x18cd19);return _0x523a98[_0x9c02('0x24')](_0x9c02('0x25'),_0x2db57e+'-'+_0x22ea5d+'/'+_0x3fae43)[_0x9c02('0x20')](_0x569e7d);}return null;};}function patchUpdates(_0x240e2f){return function(_0x517b76){try{jsonpatch[_0x9c02('0x26')](_0x517b76,_0x240e2f,!![]);}catch(_0x344baf){return BPromise[_0x9c02('0x27')](_0x344baf);}return _0x517b76['save']();};}function saveUpdates(_0x175b3e,_0x438995){return function(_0xcac5ef){if(_0xcac5ef){return _0xcac5ef[_0x9c02('0x28')](_0x175b3e)[_0x9c02('0x29')](function(_0x4a6d0a){return _0x4a6d0a;});}return null;};}function removeEntity(_0x39bb3b,_0x24f3ab){return function(_0x3f1b8d){if(_0x3f1b8d){return _0x3f1b8d[_0x9c02('0x2a')]()[_0x9c02('0x29')](function(){_0x39bb3b[_0x9c02('0x1f')](0xcc)[_0x9c02('0x2b')]();});}};}function handleEntityNotFound(_0x4d1985,_0x373041){return function(_0x4fcd2a){if(!_0x4fcd2a){_0x4d1985[_0x9c02('0x1e')](0x194);}return _0x4fcd2a;};}function handleError(_0x297be,_0x1213cc){_0x1213cc=_0x1213cc||0x1f4;return function(_0x30c7e5){logger['error'](_0x30c7e5['stack']);if(_0x30c7e5['name']){delete _0x30c7e5[_0x9c02('0x2c')];}_0x297be['status'](_0x1213cc)['send'](_0x30c7e5);};}exports[_0x9c02('0x2d')]=function(_0x266f5e,_0x5b0f){var _0x393ff2={},_0x257e53={},_0x3e8996={'count':0x0,'rows':[]};var _0x2504ec=_[_0x9c02('0x2e')](db[_0x9c02('0x2f')][_0x9c02('0x30')],function(_0x5047f3){return{'name':_0x5047f3['fieldName'],'type':_0x5047f3[_0x9c02('0x31')]['key']};});_0x257e53[_0x9c02('0x32')]=_[_0x9c02('0x2e')](_0x2504ec,_0x9c02('0x2c'));_0x257e53[_0x9c02('0x33')]=_[_0x9c02('0x34')](_0x266f5e['query']);_0x257e53[_0x9c02('0x35')]=_[_0x9c02('0x36')](_0x257e53[_0x9c02('0x32')],_0x257e53[_0x9c02('0x33')]);_0x393ff2[_0x9c02('0x37')]=_[_0x9c02('0x36')](_0x257e53[_0x9c02('0x32')],qs[_0x9c02('0x38')](_0x266f5e[_0x9c02('0x33')][_0x9c02('0x38')]));_0x393ff2['attributes']=_0x393ff2[_0x9c02('0x37')][_0x9c02('0x39')]?_0x393ff2[_0x9c02('0x37')]:_0x257e53[_0x9c02('0x32')];if(!_0x266f5e[_0x9c02('0x33')]['hasOwnProperty'](_0x9c02('0x3a'))){_0x393ff2['limit']=qs[_0x9c02('0x22')](_0x266f5e[_0x9c02('0x33')][_0x9c02('0x22')]);_0x393ff2[_0x9c02('0x21')]=qs[_0x9c02('0x21')](_0x266f5e['query']['offset']);}_0x393ff2[_0x9c02('0x3b')]=qs[_0x9c02('0x3c')](_0x266f5e[_0x9c02('0x33')][_0x9c02('0x3c')]);_0x393ff2['where']=qs[_0x9c02('0x35')](_[_0x9c02('0x3d')](_0x266f5e[_0x9c02('0x33')],_0x257e53[_0x9c02('0x35')]),_0x2504ec);if(_0x266f5e[_0x9c02('0x33')][_0x9c02('0x3e')]){_0x393ff2['where']=_[_0x9c02('0x3f')](_0x393ff2[_0x9c02('0x40')],{'$or':_[_0x9c02('0x2e')](_0x2504ec,function(_0x492c82){if(_0x492c82['type']!==_0x9c02('0x41')){var _0x1e0349={};_0x1e0349[_0x492c82[_0x9c02('0x2c')]]={'$like':'%'+_0x266f5e[_0x9c02('0x33')][_0x9c02('0x3e')]+'%'};return _0x1e0349;}})});}_0x393ff2=_[_0x9c02('0x3f')]({},_0x393ff2,_0x266f5e[_0x9c02('0x42')]);var _0x138dc8={'where':_0x393ff2['where']};return db[_0x9c02('0x2f')]['count'](_0x138dc8)['then'](function(_0x32ec91){_0x3e8996[_0x9c02('0x23')]=_0x32ec91;if(_0x266f5e[_0x9c02('0x33')][_0x9c02('0x43')]){_0x393ff2[_0x9c02('0x44')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x9c02('0x45')](_0x393ff2);})[_0x9c02('0x29')](function(_0x138719){_0x3e8996[_0x9c02('0x46')]=_0x138719;return _0x3e8996;})[_0x9c02('0x29')](respondWithFilteredResult(_0x5b0f,_0x393ff2))[_0x9c02('0x47')](handleError(_0x5b0f,null));};exports['show']=function(_0x83f3f5,_0x54948f){var _0x3efa8c={'raw':!![],'where':{'id':_0x83f3f5[_0x9c02('0x48')]['id']}},_0x47ca6c={};_0x47ca6c[_0x9c02('0x32')]=_[_0x9c02('0x34')](db[_0x9c02('0x2f')][_0x9c02('0x30')]);_0x47ca6c[_0x9c02('0x33')]=_[_0x9c02('0x34')](_0x83f3f5[_0x9c02('0x33')]);_0x47ca6c[_0x9c02('0x35')]=_[_0x9c02('0x36')](_0x47ca6c[_0x9c02('0x32')],_0x47ca6c[_0x9c02('0x33')]);_0x3efa8c[_0x9c02('0x37')]=_['intersection'](_0x47ca6c[_0x9c02('0x32')],qs[_0x9c02('0x38')](_0x83f3f5[_0x9c02('0x33')][_0x9c02('0x38')]));_0x3efa8c['attributes']=_0x3efa8c[_0x9c02('0x37')]['length']?_0x3efa8c['attributes']:_0x47ca6c[_0x9c02('0x32')];if(_0x83f3f5['query']['includeAll']){_0x3efa8c['include']=[{'all':!![]}];}_0x3efa8c=_[_0x9c02('0x3f')]({},_0x3efa8c,_0x83f3f5[_0x9c02('0x42')]);return db['WhatsappQueueReport']['find'](_0x3efa8c)['then'](handleEntityNotFound(_0x54948f,null))[_0x9c02('0x29')](respondWithResult(_0x54948f,null))[_0x9c02('0x47')](handleError(_0x54948f,null));};exports['create']=function(_0x4d522c,_0x7d8ce){return db['WhatsappQueueReport'][_0x9c02('0x49')](_0x4d522c['body'],{})['then'](respondWithResult(_0x7d8ce,0xc9))[_0x9c02('0x47')](handleError(_0x7d8ce,null));};exports[_0x9c02('0x28')]=function(_0x36dc36,_0xd210ff){if(_0x36dc36[_0x9c02('0x4a')]['id']){delete _0x36dc36[_0x9c02('0x4a')]['id'];}return db[_0x9c02('0x2f')][_0x9c02('0x4b')]({'where':{'id':_0x36dc36[_0x9c02('0x48')]['id']}})['then'](handleEntityNotFound(_0xd210ff,null))['then'](saveUpdates(_0x36dc36[_0x9c02('0x4a')],null))[_0x9c02('0x29')](respondWithResult(_0xd210ff,null))[_0x9c02('0x47')](handleError(_0xd210ff,null));};exports[_0x9c02('0x2a')]=function(_0x58a3aa,_0x1f817a){return db[_0x9c02('0x2f')][_0x9c02('0x4b')]({'where':{'id':_0x58a3aa[_0x9c02('0x48')]['id']}})[_0x9c02('0x29')](handleEntityNotFound(_0x1f817a,null))[_0x9c02('0x29')](removeEntity(_0x1f817a,null))[_0x9c02('0x47')](handleError(_0x1f817a,null));};exports[_0x9c02('0x4c')]=function(_0x33bcba,_0x510d8f){return db[_0x9c02('0x2f')]['describe']()[_0x9c02('0x29')](respondWithResult(_0x510d8f,null))[_0x9c02('0x47')](handleError(_0x510d8f,null));}; \ No newline at end of file +var _0xaef1=['error','stack','name','send','rawAttributes','type','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','WhatsappQueueReport','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then'];(function(_0x1602af,_0x540e07){var _0x3c088e=function(_0x1be346){while(--_0x1be346){_0x1602af['push'](_0x1602af['shift']());}};_0x3c088e(++_0x540e07);}(_0xaef1,0xb1));var _0x1aef=function(_0x235323,_0x106590){_0x235323=_0x235323-0x0;var _0x152ded=_0xaef1[_0x235323];return _0x152ded;};'use strict';var emlformat=require(_0x1aef('0x0'));var rimraf=require(_0x1aef('0x1'));var zipdir=require(_0x1aef('0x2'));var jsonpatch=require(_0x1aef('0x3'));var rp=require(_0x1aef('0x4'));var moment=require('moment');var BPromise=require(_0x1aef('0x5'));var Mustache=require(_0x1aef('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1aef('0x7'));var csv=require(_0x1aef('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1aef('0x9'));var squel=require('squel');var crypto=require(_0x1aef('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1aef('0xb'));var toCsv=require(_0x1aef('0x8'));var querystring=require(_0x1aef('0xc'));var Papa=require(_0x1aef('0xd'));var Redis=require('ioredis');var authService=require(_0x1aef('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1aef('0xf'));var logger=require(_0x1aef('0x10'))('api');var utils=require(_0x1aef('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x1aef('0x12'));var db=require(_0x1aef('0x13'))['db'];function respondWithStatusCode(_0x1d63c2,_0x26e9d4){_0x26e9d4=_0x26e9d4||0xcc;return function(_0x413dce){if(_0x413dce){return _0x1d63c2[_0x1aef('0x14')](_0x26e9d4);}return _0x1d63c2[_0x1aef('0x15')](_0x26e9d4)[_0x1aef('0x16')]();};}function respondWithResult(_0x34af6f,_0x35ed8a){_0x35ed8a=_0x35ed8a||0xc8;return function(_0x14862f){if(_0x14862f){return _0x34af6f['status'](_0x35ed8a)[_0x1aef('0x17')](_0x14862f);}};}function respondWithFilteredResult(_0x1020cf,_0x188d16){return function(_0x349523){if(_0x349523){var _0x5ccbd8=typeof _0x188d16[_0x1aef('0x18')]===_0x1aef('0x19')&&typeof _0x188d16[_0x1aef('0x1a')]===_0x1aef('0x19');var _0x4082ef=_0x349523[_0x1aef('0x1b')];var _0x235468=_0x5ccbd8?0x0:_0x188d16[_0x1aef('0x18')];var _0x1bc613=_0x5ccbd8?_0x349523[_0x1aef('0x1b')]:_0x188d16['offset']+_0x188d16[_0x1aef('0x1a')];var _0x50bac4;if(_0x1bc613>=_0x4082ef){_0x1bc613=_0x4082ef;_0x50bac4=0xc8;}else{_0x50bac4=0xce;}_0x1020cf['status'](_0x50bac4);return _0x1020cf['set'](_0x1aef('0x1c'),_0x235468+'-'+_0x1bc613+'/'+_0x4082ef)[_0x1aef('0x17')](_0x349523);}return null;};}function patchUpdates(_0x1caadd){return function(_0x582eb6){try{jsonpatch['apply'](_0x582eb6,_0x1caadd,!![]);}catch(_0x537e36){return BPromise[_0x1aef('0x1d')](_0x537e36);}return _0x582eb6[_0x1aef('0x1e')]();};}function saveUpdates(_0x2f0578,_0x3dc87c){return function(_0x58f9ce){if(_0x58f9ce){return _0x58f9ce[_0x1aef('0x1f')](_0x2f0578)[_0x1aef('0x20')](function(_0x2d3961){return _0x2d3961;});}return null;};}function removeEntity(_0x4ddce4,_0x2b0d5b){return function(_0x1f6c12){if(_0x1f6c12){return _0x1f6c12['destroy']()[_0x1aef('0x20')](function(){_0x4ddce4['status'](0xcc)[_0x1aef('0x16')]();});}};}function handleEntityNotFound(_0x40e433,_0x276fab){return function(_0x4c4ab8){if(!_0x4c4ab8){_0x40e433[_0x1aef('0x14')](0x194);}return _0x4c4ab8;};}function handleError(_0x172f49,_0x393a20){_0x393a20=_0x393a20||0x1f4;return function(_0x57896f){logger[_0x1aef('0x21')](_0x57896f[_0x1aef('0x22')]);if(_0x57896f[_0x1aef('0x23')]){delete _0x57896f[_0x1aef('0x23')];}_0x172f49[_0x1aef('0x15')](_0x393a20)[_0x1aef('0x24')](_0x57896f);};}exports['index']=function(_0x530329,_0x5967b9){var _0x171bc8={},_0x45c213={},_0x349508={'count':0x0,'rows':[]};var _0x5a2495=_['map'](db['WhatsappQueueReport'][_0x1aef('0x25')],function(_0x3d31fb){return{'name':_0x3d31fb['fieldName'],'type':_0x3d31fb[_0x1aef('0x26')][_0x1aef('0x27')]};});_0x45c213[_0x1aef('0x28')]=_[_0x1aef('0x29')](_0x5a2495,_0x1aef('0x23'));_0x45c213['query']=_['keys'](_0x530329['query']);_0x45c213[_0x1aef('0x2a')]=_[_0x1aef('0x2b')](_0x45c213[_0x1aef('0x28')],_0x45c213[_0x1aef('0x2c')]);_0x171bc8[_0x1aef('0x2d')]=_[_0x1aef('0x2b')](_0x45c213['model'],qs[_0x1aef('0x2e')](_0x530329[_0x1aef('0x2c')]['fields']));_0x171bc8[_0x1aef('0x2d')]=_0x171bc8[_0x1aef('0x2d')][_0x1aef('0x2f')]?_0x171bc8[_0x1aef('0x2d')]:_0x45c213[_0x1aef('0x28')];if(!_0x530329['query'][_0x1aef('0x30')]('nolimit')){_0x171bc8[_0x1aef('0x1a')]=qs[_0x1aef('0x1a')](_0x530329[_0x1aef('0x2c')][_0x1aef('0x1a')]);_0x171bc8['offset']=qs[_0x1aef('0x18')](_0x530329[_0x1aef('0x2c')]['offset']);}_0x171bc8[_0x1aef('0x31')]=qs['sort'](_0x530329['query'][_0x1aef('0x32')]);_0x171bc8['where']=qs[_0x1aef('0x2a')](_['pick'](_0x530329['query'],_0x45c213[_0x1aef('0x2a')]),_0x5a2495);if(_0x530329[_0x1aef('0x2c')][_0x1aef('0x33')]){_0x171bc8[_0x1aef('0x34')]=_[_0x1aef('0x35')](_0x171bc8[_0x1aef('0x34')],{'$or':_[_0x1aef('0x29')](_0x5a2495,function(_0x11941d){if(_0x11941d[_0x1aef('0x26')]!==_0x1aef('0x36')){var _0x1db7c8={};_0x1db7c8[_0x11941d[_0x1aef('0x23')]]={'$like':'%'+_0x530329[_0x1aef('0x2c')][_0x1aef('0x33')]+'%'};return _0x1db7c8;}})});}_0x171bc8=_[_0x1aef('0x35')]({},_0x171bc8,_0x530329[_0x1aef('0x37')]);var _0xf5d226={'where':_0x171bc8[_0x1aef('0x34')]};return db['WhatsappQueueReport'][_0x1aef('0x1b')](_0xf5d226)[_0x1aef('0x20')](function(_0x2b93f3){_0x349508[_0x1aef('0x1b')]=_0x2b93f3;if(_0x530329[_0x1aef('0x2c')][_0x1aef('0x38')]){_0x171bc8[_0x1aef('0x39')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x1aef('0x3a')](_0x171bc8);})[_0x1aef('0x20')](function(_0x17a72d){_0x349508[_0x1aef('0x3b')]=_0x17a72d;return _0x349508;})[_0x1aef('0x20')](respondWithFilteredResult(_0x5967b9,_0x171bc8))[_0x1aef('0x3c')](handleError(_0x5967b9,null));};exports[_0x1aef('0x3d')]=function(_0x6425e2,_0x4b59a1){var _0x11053c={'raw':!![],'where':{'id':_0x6425e2[_0x1aef('0x3e')]['id']}},_0x1245a7={};_0x1245a7[_0x1aef('0x28')]=_[_0x1aef('0x3f')](db[_0x1aef('0x40')]['rawAttributes']);_0x1245a7[_0x1aef('0x2c')]=_[_0x1aef('0x3f')](_0x6425e2[_0x1aef('0x2c')]);_0x1245a7[_0x1aef('0x2a')]=_[_0x1aef('0x2b')](_0x1245a7['model'],_0x1245a7['query']);_0x11053c[_0x1aef('0x2d')]=_[_0x1aef('0x2b')](_0x1245a7[_0x1aef('0x28')],qs[_0x1aef('0x2e')](_0x6425e2[_0x1aef('0x2c')]['fields']));_0x11053c[_0x1aef('0x2d')]=_0x11053c[_0x1aef('0x2d')][_0x1aef('0x2f')]?_0x11053c[_0x1aef('0x2d')]:_0x1245a7['model'];if(_0x6425e2[_0x1aef('0x2c')][_0x1aef('0x38')]){_0x11053c[_0x1aef('0x39')]=[{'all':!![]}];}_0x11053c=_[_0x1aef('0x35')]({},_0x11053c,_0x6425e2[_0x1aef('0x37')]);return db['WhatsappQueueReport'][_0x1aef('0x41')](_0x11053c)['then'](handleEntityNotFound(_0x4b59a1,null))['then'](respondWithResult(_0x4b59a1,null))['catch'](handleError(_0x4b59a1,null));};exports[_0x1aef('0x42')]=function(_0xe3c097,_0x14c4c2){return db[_0x1aef('0x40')]['create'](_0xe3c097[_0x1aef('0x43')],{})[_0x1aef('0x20')](respondWithResult(_0x14c4c2,0xc9))[_0x1aef('0x3c')](handleError(_0x14c4c2,null));};exports['update']=function(_0x42bafb,_0x4104b5){if(_0x42bafb['body']['id']){delete _0x42bafb['body']['id'];}return db[_0x1aef('0x40')]['find']({'where':{'id':_0x42bafb[_0x1aef('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4104b5,null))[_0x1aef('0x20')](saveUpdates(_0x42bafb[_0x1aef('0x43')],null))[_0x1aef('0x20')](respondWithResult(_0x4104b5,null))['catch'](handleError(_0x4104b5,null));};exports[_0x1aef('0x44')]=function(_0x25fdd9,_0x576f37){return db[_0x1aef('0x40')][_0x1aef('0x41')]({'where':{'id':_0x25fdd9['params']['id']}})[_0x1aef('0x20')](handleEntityNotFound(_0x576f37,null))[_0x1aef('0x20')](removeEntity(_0x576f37,null))['catch'](handleError(_0x576f37,null));};exports[_0x1aef('0x45')]=function(_0xaba0fe,_0xd840dc){return db['WhatsappQueueReport'][_0x1aef('0x45')]()[_0x1aef('0x20')](respondWithResult(_0xd840dc,null))[_0x1aef('0x3c')](handleError(_0xd840dc,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 82a78f7..fbf05b5 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 _0x8a08=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x8a08,0xb5));var _0x88a0=function(_0x5b575e,_0x295783){_0x5b575e=_0x5b575e-0x0;var _0x162ec8=_0x8a08[_0x5b575e];return _0x162ec8;};'use strict';var _=require(_0x88a0('0x0'));var util=require('util');var logger=require(_0x88a0('0x1'))('api');var moment=require(_0x88a0('0x2'));var BPromise=require(_0x88a0('0x3'));var rp=require(_0x88a0('0x4'));var fs=require('fs');var path=require(_0x88a0('0x5'));var rimraf=require(_0x88a0('0x6'));var config=require(_0x88a0('0x7'));var attributes=require(_0x88a0('0x8'));module[_0x88a0('0x9')]=function(_0x41868d,_0x239f11){return _0x41868d[_0x88a0('0xa')](_0x88a0('0xb'),attributes,{'tableName':_0x88a0('0xc'),'paranoid':![],'indexes':[{'name':_0x88a0('0xd'),'fields':[_0x88a0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6e07=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x4a1835,_0xe4a237){var _0x203f1b=function(_0x52886e){while(--_0x52886e){_0x4a1835['push'](_0x4a1835['shift']());}};_0x203f1b(++_0xe4a237);}(_0x6e07,0x1d2));var _0x76e0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6e07[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x76e0('0x0'));var util=require('util');var logger=require(_0x76e0('0x1'))(_0x76e0('0x2'));var moment=require(_0x76e0('0x3'));var BPromise=require(_0x76e0('0x4'));var rp=require(_0x76e0('0x5'));var fs=require('fs');var path=require(_0x76e0('0x6'));var rimraf=require(_0x76e0('0x7'));var config=require(_0x76e0('0x8'));var attributes=require(_0x76e0('0x9'));module[_0x76e0('0xa')]=function(_0xd82236,_0x42d402){return _0xd82236['define'](_0x76e0('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x76e0('0xc'),'fields':[_0x76e0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 4591571..5e77316 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 _0x1263=['WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateWhatsappQueueReport','create','options','raw','debug','stringify','UpdateWhatsappQueueReport','WhatsappQueueReport','update','body','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0xbb9cb0,_0x4c1858){var _0x5cfd58=function(_0x28b75c){while(--_0x28b75c){_0xbb9cb0['push'](_0xbb9cb0['shift']());}};_0x5cfd58(++_0x4c1858);}(_0x1263,0x171));var _0x3126=function(_0x25a144,_0x251d80){_0x25a144=_0x25a144-0x0;var _0x40ebe2=_0x1263[_0x25a144];return _0x40ebe2;};'use strict';var _=require(_0x3126('0x0'));var util=require(_0x3126('0x1'));var moment=require(_0x3126('0x2'));var BPromise=require(_0x3126('0x3'));var rs=require(_0x3126('0x4'));var fs=require('fs');var Redis=require(_0x3126('0x5'));var db=require(_0x3126('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3126('0x7'))(_0x3126('0x8'));var config=require(_0x3126('0x9'));var jayson=require(_0x3126('0xa'));var client=jayson[_0x3126('0xb')][_0x3126('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5193ef,_0x45d243,_0x216c49){return new BPromise(function(_0x3eab20,_0x5eb9ab){return client['request'](_0x5193ef,_0x216c49)[_0x3126('0xd')](function(_0x6f14c6){logger[_0x3126('0xe')](_0x3126('0xf'),_0x45d243,'request\x20sent');logger['debug'](_0x3126('0x10'),_0x45d243,'request\x20sent',JSON['stringify'](_0x6f14c6));if(_0x6f14c6[_0x3126('0x11')]){if(_0x6f14c6['error'][_0x3126('0x12')]===0x1f4){logger[_0x3126('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x45d243,_0x6f14c6[_0x3126('0x11')][_0x3126('0x13')]);return _0x5eb9ab(_0x6f14c6[_0x3126('0x11')]['message']);}logger['error'](_0x3126('0xf'),_0x45d243,_0x6f14c6[_0x3126('0x11')]['message']);return _0x3eab20(_0x6f14c6[_0x3126('0x11')][_0x3126('0x13')]);}else{logger[_0x3126('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x45d243,_0x3126('0x14'));_0x3eab20(_0x6f14c6[_0x3126('0x15')]['message']);}})[_0x3126('0x16')](function(_0x587acb){logger[_0x3126('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x45d243,_0x587acb);_0x5eb9ab(_0x587acb);});});}exports[_0x3126('0x17')]=function(_0x4ab51b){var _0x29bd9c=this;return new Promise(function(_0x5cefd6,_0x59158b){return db['WhatsappQueueReport'][_0x3126('0x18')](_0x4ab51b['body'],{'raw':_0x4ab51b['options']?_0x4ab51b[_0x3126('0x19')][_0x3126('0x1a')]===undefined?!![]:![]:!![]})[_0x3126('0xd')](function(_0x1c9e83){logger[_0x3126('0xe')]('CreateWhatsappQueueReport',_0x4ab51b);logger[_0x3126('0x1b')](_0x3126('0x17'),_0x4ab51b,JSON[_0x3126('0x1c')](_0x1c9e83));_0x5cefd6(_0x1c9e83);})['catch'](function(_0x1ce0fe){logger['error'](_0x3126('0x17'),_0x1ce0fe['message'],_0x4ab51b);_0x59158b(_0x29bd9c[_0x3126('0x11')](0x1f4,_0x1ce0fe[_0x3126('0x13')]));});});};exports[_0x3126('0x1d')]=function(_0x393023){var _0x18ffba=this;return new Promise(function(_0x2f76fc,_0x15806a){return db[_0x3126('0x1e')][_0x3126('0x1f')](_0x393023[_0x3126('0x20')],{'raw':_0x393023[_0x3126('0x19')]?_0x393023[_0x3126('0x19')][_0x3126('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x393023[_0x3126('0x19')]?_0x393023[_0x3126('0x19')][_0x3126('0x21')]||null:null,'attributes':_0x393023[_0x3126('0x19')]?_0x393023['options']['attributes']||null:null,'limit':_0x393023['options']?_0x393023[_0x3126('0x19')][_0x3126('0x22')]||null:null})[_0x3126('0xd')](function(_0x49cbaf){logger[_0x3126('0xe')](_0x3126('0x1d'),_0x393023);logger[_0x3126('0x1b')](_0x3126('0x1d'),_0x393023,JSON[_0x3126('0x1c')](_0x49cbaf));_0x2f76fc(_0x49cbaf);})[_0x3126('0x16')](function(_0xbc7f0f){logger[_0x3126('0x11')](_0x3126('0x1d'),_0xbc7f0f[_0x3126('0x13')],_0x393023);_0x15806a(_0x18ffba[_0x3126('0x11')](0x1f4,_0xbc7f0f[_0x3126('0x13')]));});});}; \ No newline at end of file +var _0x9ec6=['attributes','limit','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','info','result','WhatsappQueueReport','create','body','raw','CreateWhatsappQueueReport','stringify','UpdateWhatsappQueueReport','update','options'];(function(_0x6be757,_0x24affc){var _0x9b95aa=function(_0x5d00bf){while(--_0x5d00bf){_0x6be757['push'](_0x6be757['shift']());}};_0x9b95aa(++_0x24affc);}(_0x9ec6,0xd5));var _0x69ec=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0x9ec6[_0x25b4a4];return _0x707267;};'use strict';var _=require(_0x69ec('0x0'));var util=require(_0x69ec('0x1'));var moment=require(_0x69ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x69ec('0x3'));var fs=require('fs');var Redis=require(_0x69ec('0x4'));var db=require(_0x69ec('0x5'))['db'];var utils=require(_0x69ec('0x6'));var logger=require(_0x69ec('0x7'))(_0x69ec('0x8'));var config=require(_0x69ec('0x9'));var jayson=require(_0x69ec('0xa'));var client=jayson[_0x69ec('0xb')][_0x69ec('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13c680,_0x20ddb7,_0x97aa64){return new BPromise(function(_0xca503,_0x33c8fb){return client['request'](_0x13c680,_0x97aa64)[_0x69ec('0xd')](function(_0x473f60){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x20ddb7,_0x69ec('0xe'));logger[_0x69ec('0xf')](_0x69ec('0x10'),_0x20ddb7,'request\x20sent',JSON['stringify'](_0x473f60));if(_0x473f60[_0x69ec('0x11')]){if(_0x473f60['error'][_0x69ec('0x12')]===0x1f4){logger[_0x69ec('0x11')](_0x69ec('0x13'),_0x20ddb7,_0x473f60['error']['message']);return _0x33c8fb(_0x473f60[_0x69ec('0x11')][_0x69ec('0x14')]);}logger[_0x69ec('0x11')](_0x69ec('0x13'),_0x20ddb7,_0x473f60[_0x69ec('0x11')][_0x69ec('0x14')]);return _0xca503(_0x473f60['error']['message']);}else{logger[_0x69ec('0x15')](_0x69ec('0x13'),_0x20ddb7,_0x69ec('0xe'));_0xca503(_0x473f60[_0x69ec('0x16')][_0x69ec('0x14')]);}})['catch'](function(_0x12f798){logger[_0x69ec('0x11')](_0x69ec('0x13'),_0x20ddb7,_0x12f798);_0x33c8fb(_0x12f798);});});}exports['CreateWhatsappQueueReport']=function(_0x43ade1){var _0x433d84=this;return new Promise(function(_0x2d7ed8,_0x255972){return db[_0x69ec('0x17')][_0x69ec('0x18')](_0x43ade1[_0x69ec('0x19')],{'raw':_0x43ade1['options']?_0x43ade1['options'][_0x69ec('0x1a')]===undefined?!![]:![]:!![]})[_0x69ec('0xd')](function(_0x198e13){logger['info'](_0x69ec('0x1b'),_0x43ade1);logger[_0x69ec('0xf')](_0x69ec('0x1b'),_0x43ade1,JSON[_0x69ec('0x1c')](_0x198e13));_0x2d7ed8(_0x198e13);})['catch'](function(_0x453803){logger[_0x69ec('0x11')]('CreateWhatsappQueueReport',_0x453803[_0x69ec('0x14')],_0x43ade1);_0x255972(_0x433d84['error'](0x1f4,_0x453803[_0x69ec('0x14')]));});});};exports[_0x69ec('0x1d')]=function(_0x14e3b5){var _0x493d36=this;return new Promise(function(_0x420ac0,_0x4ba09c){return db[_0x69ec('0x17')][_0x69ec('0x1e')](_0x14e3b5[_0x69ec('0x19')],{'raw':_0x14e3b5[_0x69ec('0x1f')]?_0x14e3b5[_0x69ec('0x1f')][_0x69ec('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14e3b5[_0x69ec('0x1f')]?_0x14e3b5[_0x69ec('0x1f')]['where']||null:null,'attributes':_0x14e3b5['options']?_0x14e3b5[_0x69ec('0x1f')][_0x69ec('0x20')]||null:null,'limit':_0x14e3b5[_0x69ec('0x1f')]?_0x14e3b5[_0x69ec('0x1f')][_0x69ec('0x21')]||null:null})['then'](function(_0x5458d4){logger[_0x69ec('0x15')](_0x69ec('0x1d'),_0x14e3b5);logger[_0x69ec('0xf')](_0x69ec('0x1d'),_0x14e3b5,JSON[_0x69ec('0x1c')](_0x5458d4));_0x420ac0(_0x5458d4);})[_0x69ec('0x22')](function(_0x5872bb){logger['error']('UpdateWhatsappQueueReport',_0x5872bb[_0x69ec('0x14')],_0x14e3b5);_0x4ba09c(_0x493d36[_0x69ec('0x11')](0x1f4,_0x5872bb['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 6eed140..53dd49a 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 _0x29bf=['multer','util','path','express','fs-extra','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x2ac267,_0x489e64){var _0x5badd5=function(_0x3e072){while(--_0x3e072){_0x2ac267['push'](_0x2ac267['shift']());}};_0x5badd5(++_0x489e64);}(_0x29bf,0xa0));var _0xf29b=function(_0x3be15f,_0x13de89){_0x3be15f=_0x3be15f-0x0;var _0x4eb3c1=_0x29bf[_0x3be15f];return _0x4eb3c1;};'use strict';var multer=require(_0xf29b('0x0'));var util=require(_0xf29b('0x1'));var path=require(_0xf29b('0x2'));var timeout=require('connect-timeout');var express=require(_0xf29b('0x3'));var router=express['Router']();var fs_extra=require(_0xf29b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf29b('0x5'));var config=require('../../config/environment');var controller=require(_0xf29b('0x6'));router[_0xf29b('0x7')]('/',auth[_0xf29b('0x8')](),controller[_0xf29b('0x9')]);router[_0xf29b('0x7')](_0xf29b('0xa'),auth[_0xf29b('0x8')](),controller[_0xf29b('0xb')]);router[_0xf29b('0x7')](_0xf29b('0xc'),auth['isAuthenticated'](),controller[_0xf29b('0xd')]);router[_0xf29b('0xe')]('/',auth[_0xf29b('0x8')](),controller[_0xf29b('0xf')]);router[_0xf29b('0x10')](_0xf29b('0xc'),auth[_0xf29b('0x8')](),controller[_0xf29b('0x11')]);router[_0xf29b('0x12')](_0xf29b('0xc'),auth[_0xf29b('0x8')](),controller[_0xf29b('0x13')]);module['exports']=router; \ No newline at end of file +var _0xacbd=['/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x41d3ce,_0x231b8c){var _0x5848b9=function(_0x32081e){while(--_0x32081e){_0x41d3ce['push'](_0x41d3ce['shift']());}};_0x5848b9(++_0x231b8c);}(_0xacbd,0x147));var _0xdacb=function(_0x2218ff,_0xe1d291){_0x2218ff=_0x2218ff-0x0;var _0x374996=_0xacbd[_0x2218ff];return _0x374996;};'use strict';var multer=require(_0xdacb('0x0'));var util=require(_0xdacb('0x1'));var path=require(_0xdacb('0x2'));var timeout=require(_0xdacb('0x3'));var express=require(_0xdacb('0x4'));var router=express[_0xdacb('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdacb('0x6'));var config=require(_0xdacb('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xdacb('0x8')]('/',auth[_0xdacb('0x9')](),controller[_0xdacb('0xa')]);router[_0xdacb('0x8')](_0xdacb('0xb'),auth[_0xdacb('0x9')](),controller[_0xdacb('0xc')]);router[_0xdacb('0x8')](_0xdacb('0xd'),auth[_0xdacb('0x9')](),controller[_0xdacb('0xe')]);router[_0xdacb('0xf')]('/',auth[_0xdacb('0x9')](),controller[_0xdacb('0x10')]);router['put']('/:id',auth[_0xdacb('0x9')](),controller[_0xdacb('0x11')]);router[_0xdacb('0x12')]('/:id',auth[_0xdacb('0x9')](),controller[_0xdacb('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 27e6a16..b1cc16e 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 _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0x2cc53a,_0xc11bc6){var _0x43c65e=function(_0x48b5e9){while(--_0x48b5e9){_0x2cc53a['push'](_0x2cc53a['shift']());}};_0x43c65e(++_0xc11bc6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'uniqueid':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0baf('0x2')](_0x0baf('0x3'),_0x0baf('0x4'),_0x0baf('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb7e7=['queue','sequelize','STRING','account'];(function(_0x285326,_0x536bc9){var _0x18e5db=function(_0xe1a131){while(--_0xe1a131){_0x285326['push'](_0x285326['shift']());}};_0x18e5db(++_0x536bc9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xb7e7[_0x2f1762];return _0x8ab21;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x2'),'agent',_0x7b7e('0x3')),'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 81e0af8..5735880 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 _0xf05d=['destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','WhatsappTransferReport','findAll','rows','show','create','body','catch','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x1f336d,_0x5d0bee){var _0x49199d=function(_0x3ea45c){while(--_0x3ea45c){_0x1f336d['push'](_0x1f336d['shift']());}};_0x49199d(++_0x5d0bee);}(_0xf05d,0x1b2));var _0xdf05=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf05d[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xdf05('0x0'));var rimraf=require(_0xdf05('0x1'));var zipdir=require(_0xdf05('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf05('0x3'));var moment=require(_0xdf05('0x4'));var BPromise=require(_0xdf05('0x5'));var Mustache=require(_0xdf05('0x6'));var util=require('util');var path=require(_0xdf05('0x7'));var sox=require(_0xdf05('0x8'));var csv=require(_0xdf05('0x9'));var ejs=require(_0xdf05('0xa'));var fs=require('fs');var fs_extra=require(_0xdf05('0xb'));var _=require(_0xdf05('0xc'));var squel=require(_0xdf05('0xd'));var crypto=require(_0xdf05('0xe'));var jsforce=require(_0xdf05('0xf'));var deskjs=require(_0xdf05('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdf05('0x11'));var Papa=require(_0xdf05('0x12'));var Redis=require(_0xdf05('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xdf05('0x14'));var as=require(_0xdf05('0x15'));var hardwareService=require(_0xdf05('0x16'));var logger=require(_0xdf05('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdf05('0x18'));var db=require(_0xdf05('0x19'))['db'];function respondWithStatusCode(_0x405df9,_0x21604a){_0x21604a=_0x21604a||0xcc;return function(_0x12c58e){if(_0x12c58e){return _0x405df9['sendStatus'](_0x21604a);}return _0x405df9[_0xdf05('0x1a')](_0x21604a)[_0xdf05('0x1b')]();};}function respondWithResult(_0x58ecc0,_0x137e01){_0x137e01=_0x137e01||0xc8;return function(_0x5ab9d2){if(_0x5ab9d2){return _0x58ecc0['status'](_0x137e01)[_0xdf05('0x1c')](_0x5ab9d2);}};}function respondWithFilteredResult(_0x1dd8e3,_0x4296d8){return function(_0x248860){if(_0x248860){var _0x4a0bc0=typeof _0x4296d8[_0xdf05('0x1d')]===_0xdf05('0x1e')&&typeof _0x4296d8[_0xdf05('0x1f')]===_0xdf05('0x1e');var _0x16505a=_0x248860[_0xdf05('0x20')];var _0x4422bc=_0x4a0bc0?0x0:_0x4296d8[_0xdf05('0x1d')];var _0x8b58b3=_0x4a0bc0?_0x248860[_0xdf05('0x20')]:_0x4296d8['offset']+_0x4296d8['limit'];var _0x449cf5;if(_0x8b58b3>=_0x16505a){_0x8b58b3=_0x16505a;_0x449cf5=0xc8;}else{_0x449cf5=0xce;}_0x1dd8e3[_0xdf05('0x1a')](_0x449cf5);return _0x1dd8e3[_0xdf05('0x21')](_0xdf05('0x22'),_0x4422bc+'-'+_0x8b58b3+'/'+_0x16505a)[_0xdf05('0x1c')](_0x248860);}return null;};}function patchUpdates(_0x1c1e52){return function(_0x956d71){try{jsonpatch[_0xdf05('0x23')](_0x956d71,_0x1c1e52,!![]);}catch(_0x32743f){return BPromise[_0xdf05('0x24')](_0x32743f);}return _0x956d71[_0xdf05('0x25')]();};}function saveUpdates(_0x41397c,_0x544730){return function(_0x438d9e){if(_0x438d9e){return _0x438d9e[_0xdf05('0x26')](_0x41397c)[_0xdf05('0x27')](function(_0x3930e5){return _0x3930e5;});}return null;};}function removeEntity(_0xa3e5e2,_0x51b6af){return function(_0xac9b9e){if(_0xac9b9e){return _0xac9b9e[_0xdf05('0x28')]()[_0xdf05('0x27')](function(){_0xa3e5e2[_0xdf05('0x1a')](0xcc)[_0xdf05('0x1b')]();});}};}function handleEntityNotFound(_0x4b633e,_0x4572fb){return function(_0x50ecd4){if(!_0x50ecd4){_0x4b633e[_0xdf05('0x29')](0x194);}return _0x50ecd4;};}function handleError(_0x3167ec,_0x2f58d9){_0x2f58d9=_0x2f58d9||0x1f4;return function(_0x3841e8){logger[_0xdf05('0x2a')](_0x3841e8[_0xdf05('0x2b')]);if(_0x3841e8[_0xdf05('0x2c')]){delete _0x3841e8[_0xdf05('0x2c')];}_0x3167ec['status'](_0x2f58d9)[_0xdf05('0x2d')](_0x3841e8);};}exports[_0xdf05('0x2e')]=function(_0x499ead,_0x3220d9){var _0x4c282a={},_0x132fb6={},_0x216c85={'count':0x0,'rows':[]};var _0x13d584=_[_0xdf05('0x2f')](db['WhatsappTransferReport'][_0xdf05('0x30')],function(_0x16dcd5){return{'name':_0x16dcd5['fieldName'],'type':_0x16dcd5[_0xdf05('0x31')][_0xdf05('0x32')]};});_0x132fb6[_0xdf05('0x33')]=_[_0xdf05('0x2f')](_0x13d584,_0xdf05('0x2c'));_0x132fb6[_0xdf05('0x34')]=_[_0xdf05('0x35')](_0x499ead[_0xdf05('0x34')]);_0x132fb6[_0xdf05('0x36')]=_[_0xdf05('0x37')](_0x132fb6['model'],_0x132fb6['query']);_0x4c282a[_0xdf05('0x38')]=_[_0xdf05('0x37')](_0x132fb6['model'],qs['fields'](_0x499ead['query'][_0xdf05('0x39')]));_0x4c282a[_0xdf05('0x38')]=_0x4c282a['attributes'][_0xdf05('0x3a')]?_0x4c282a[_0xdf05('0x38')]:_0x132fb6[_0xdf05('0x33')];if(!_0x499ead[_0xdf05('0x34')][_0xdf05('0x3b')]('nolimit')){_0x4c282a[_0xdf05('0x1f')]=qs[_0xdf05('0x1f')](_0x499ead[_0xdf05('0x34')][_0xdf05('0x1f')]);_0x4c282a[_0xdf05('0x1d')]=qs[_0xdf05('0x1d')](_0x499ead['query'][_0xdf05('0x1d')]);}_0x4c282a[_0xdf05('0x3c')]=qs[_0xdf05('0x3d')](_0x499ead[_0xdf05('0x34')][_0xdf05('0x3d')]);_0x4c282a[_0xdf05('0x3e')]=qs[_0xdf05('0x36')](_[_0xdf05('0x3f')](_0x499ead[_0xdf05('0x34')],_0x132fb6[_0xdf05('0x36')]),_0x13d584);if(_0x499ead[_0xdf05('0x34')][_0xdf05('0x40')]){_0x4c282a['where']=_[_0xdf05('0x41')](_0x4c282a[_0xdf05('0x3e')],{'$or':_[_0xdf05('0x2f')](_0x13d584,function(_0x21cb77){if(_0x21cb77[_0xdf05('0x31')]!=='VIRTUAL'){var _0x34bbe2={};_0x34bbe2[_0x21cb77[_0xdf05('0x2c')]]={'$like':'%'+_0x499ead[_0xdf05('0x34')][_0xdf05('0x40')]+'%'};return _0x34bbe2;}})});}_0x4c282a=_['merge']({},_0x4c282a,_0x499ead[_0xdf05('0x42')]);var _0x5dc4a3={'where':_0x4c282a[_0xdf05('0x3e')]};return db['WhatsappTransferReport'][_0xdf05('0x20')](_0x5dc4a3)['then'](function(_0x893eaa){_0x216c85['count']=_0x893eaa;if(_0x499ead[_0xdf05('0x34')][_0xdf05('0x43')]){_0x4c282a[_0xdf05('0x44')]=[{'all':!![]}];}return db[_0xdf05('0x45')][_0xdf05('0x46')](_0x4c282a);})['then'](function(_0x27d265){_0x216c85[_0xdf05('0x47')]=_0x27d265;return _0x216c85;})[_0xdf05('0x27')](respondWithFilteredResult(_0x3220d9,_0x4c282a))['catch'](handleError(_0x3220d9,null));};exports[_0xdf05('0x48')]=function(_0x3ad350,_0x3c695e){var _0x46fd69={'raw':!![],'where':{'id':_0x3ad350['params']['id']}},_0x5ad20c={};_0x5ad20c[_0xdf05('0x33')]=_[_0xdf05('0x35')](db[_0xdf05('0x45')]['rawAttributes']);_0x5ad20c[_0xdf05('0x34')]=_[_0xdf05('0x35')](_0x3ad350[_0xdf05('0x34')]);_0x5ad20c['filters']=_[_0xdf05('0x37')](_0x5ad20c[_0xdf05('0x33')],_0x5ad20c[_0xdf05('0x34')]);_0x46fd69[_0xdf05('0x38')]=_[_0xdf05('0x37')](_0x5ad20c[_0xdf05('0x33')],qs[_0xdf05('0x39')](_0x3ad350[_0xdf05('0x34')][_0xdf05('0x39')]));_0x46fd69[_0xdf05('0x38')]=_0x46fd69['attributes'][_0xdf05('0x3a')]?_0x46fd69[_0xdf05('0x38')]:_0x5ad20c[_0xdf05('0x33')];if(_0x3ad350[_0xdf05('0x34')][_0xdf05('0x43')]){_0x46fd69[_0xdf05('0x44')]=[{'all':!![]}];}_0x46fd69=_[_0xdf05('0x41')]({},_0x46fd69,_0x3ad350[_0xdf05('0x42')]);return db['WhatsappTransferReport']['find'](_0x46fd69)['then'](handleEntityNotFound(_0x3c695e,null))[_0xdf05('0x27')](respondWithResult(_0x3c695e,null))['catch'](handleError(_0x3c695e,null));};exports[_0xdf05('0x49')]=function(_0x2bd08f,_0x3d3535){return db[_0xdf05('0x45')][_0xdf05('0x49')](_0x2bd08f[_0xdf05('0x4a')],{})[_0xdf05('0x27')](respondWithResult(_0x3d3535,0xc9))[_0xdf05('0x4b')](handleError(_0x3d3535,null));};exports[_0xdf05('0x26')]=function(_0x348292,_0x25d71b){if(_0x348292['body']['id']){delete _0x348292[_0xdf05('0x4a')]['id'];}return db[_0xdf05('0x45')][_0xdf05('0x4c')]({'where':{'id':_0x348292[_0xdf05('0x4d')]['id']}})[_0xdf05('0x27')](handleEntityNotFound(_0x25d71b,null))[_0xdf05('0x27')](saveUpdates(_0x348292[_0xdf05('0x4a')],null))[_0xdf05('0x27')](respondWithResult(_0x25d71b,null))[_0xdf05('0x4b')](handleError(_0x25d71b,null));};exports[_0xdf05('0x28')]=function(_0x50635a,_0x58b99b){return db[_0xdf05('0x45')][_0xdf05('0x4c')]({'where':{'id':_0x50635a['params']['id']}})[_0xdf05('0x27')](handleEntityNotFound(_0x58b99b,null))['then'](removeEntity(_0x58b99b,null))[_0xdf05('0x4b')](handleError(_0x58b99b,null));};exports['describe']=function(_0x219c97,_0x30e082){return db[_0xdf05('0x45')][_0xdf05('0x4e')]()[_0xdf05('0x27')](respondWithResult(_0x30e082,null))[_0xdf05('0x4b')](handleError(_0x30e082,null));}; \ No newline at end of file +var _0x7f7f=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','nolimit','sort','where','filter','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set'];(function(_0x29a03e,_0x425a5b){var _0x1aad26=function(_0x44bc18){while(--_0x44bc18){_0x29a03e['push'](_0x29a03e['shift']());}};_0x1aad26(++_0x425a5b);}(_0x7f7f,0x1dc));var _0xf7f7=function(_0x82a28a,_0x434dc5){_0x82a28a=_0x82a28a-0x0;var _0x4cc2bd=_0x7f7f[_0x82a28a];return _0x4cc2bd;};'use strict';var emlformat=require(_0xf7f7('0x0'));var rimraf=require(_0xf7f7('0x1'));var zipdir=require(_0xf7f7('0x2'));var jsonpatch=require(_0xf7f7('0x3'));var rp=require(_0xf7f7('0x4'));var moment=require(_0xf7f7('0x5'));var BPromise=require(_0xf7f7('0x6'));var Mustache=require(_0xf7f7('0x7'));var util=require(_0xf7f7('0x8'));var path=require(_0xf7f7('0x9'));var sox=require('sox');var csv=require(_0xf7f7('0xa'));var ejs=require(_0xf7f7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7f7('0xc'));var squel=require(_0xf7f7('0xd'));var crypto=require(_0xf7f7('0xe'));var jsforce=require(_0xf7f7('0xf'));var deskjs=require(_0xf7f7('0x10'));var toCsv=require(_0xf7f7('0xa'));var querystring=require(_0xf7f7('0x11'));var Papa=require(_0xf7f7('0x12'));var Redis=require('ioredis');var authService=require(_0xf7f7('0x13'));var qs=require(_0xf7f7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7f7('0x15'));var logger=require(_0xf7f7('0x16'))(_0xf7f7('0x17'));var utils=require(_0xf7f7('0x18'));var config=require(_0xf7f7('0x19'));var licenseUtil=require(_0xf7f7('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41618f,_0x35e30b){_0x35e30b=_0x35e30b||0xcc;return function(_0x2e592a){if(_0x2e592a){return _0x41618f[_0xf7f7('0x1b')](_0x35e30b);}return _0x41618f[_0xf7f7('0x1c')](_0x35e30b)[_0xf7f7('0x1d')]();};}function respondWithResult(_0x3ddd6c,_0x4db38d){_0x4db38d=_0x4db38d||0xc8;return function(_0x18dfd0){if(_0x18dfd0){return _0x3ddd6c['status'](_0x4db38d)[_0xf7f7('0x1e')](_0x18dfd0);}};}function respondWithFilteredResult(_0x54fb1e,_0x1dec15){return function(_0x4e00e6){if(_0x4e00e6){var _0x31e6aa=typeof _0x1dec15[_0xf7f7('0x1f')]==='undefined'&&typeof _0x1dec15['limit']==='undefined';var _0x31f89e=_0x4e00e6[_0xf7f7('0x20')];var _0xaee1ba=_0x31e6aa?0x0:_0x1dec15[_0xf7f7('0x1f')];var _0x59319d=_0x31e6aa?_0x4e00e6['count']:_0x1dec15[_0xf7f7('0x1f')]+_0x1dec15[_0xf7f7('0x21')];var _0x282d5b;if(_0x59319d>=_0x31f89e){_0x59319d=_0x31f89e;_0x282d5b=0xc8;}else{_0x282d5b=0xce;}_0x54fb1e[_0xf7f7('0x1c')](_0x282d5b);return _0x54fb1e[_0xf7f7('0x22')](_0xf7f7('0x23'),_0xaee1ba+'-'+_0x59319d+'/'+_0x31f89e)[_0xf7f7('0x1e')](_0x4e00e6);}return null;};}function patchUpdates(_0x190054){return function(_0x24ede7){try{jsonpatch[_0xf7f7('0x24')](_0x24ede7,_0x190054,!![]);}catch(_0x321667){return BPromise[_0xf7f7('0x25')](_0x321667);}return _0x24ede7[_0xf7f7('0x26')]();};}function saveUpdates(_0x48d544,_0x3dc0d2){return function(_0x2df583){if(_0x2df583){return _0x2df583[_0xf7f7('0x27')](_0x48d544)[_0xf7f7('0x28')](function(_0x32ae59){return _0x32ae59;});}return null;};}function removeEntity(_0x166caf,_0xc380a){return function(_0x466eed){if(_0x466eed){return _0x466eed[_0xf7f7('0x29')]()[_0xf7f7('0x28')](function(){_0x166caf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x452abf,_0x2c6ece){return function(_0x313c71){if(!_0x313c71){_0x452abf['sendStatus'](0x194);}return _0x313c71;};}function handleError(_0x2dfb4b,_0x5171fd){_0x5171fd=_0x5171fd||0x1f4;return function(_0x32fb45){logger[_0xf7f7('0x2a')](_0x32fb45[_0xf7f7('0x2b')]);if(_0x32fb45[_0xf7f7('0x2c')]){delete _0x32fb45[_0xf7f7('0x2c')];}_0x2dfb4b['status'](_0x5171fd)['send'](_0x32fb45);};}exports[_0xf7f7('0x2d')]=function(_0x467b18,_0x351173){var _0x526568={},_0x1b1c5f={},_0x473fc9={'count':0x0,'rows':[]};var _0x3b93f9=_[_0xf7f7('0x2e')](db[_0xf7f7('0x2f')][_0xf7f7('0x30')],function(_0x1263d5){return{'name':_0x1263d5[_0xf7f7('0x31')],'type':_0x1263d5['type']['key']};});_0x1b1c5f['model']=_[_0xf7f7('0x2e')](_0x3b93f9,_0xf7f7('0x2c'));_0x1b1c5f[_0xf7f7('0x32')]=_[_0xf7f7('0x33')](_0x467b18[_0xf7f7('0x32')]);_0x1b1c5f[_0xf7f7('0x34')]=_[_0xf7f7('0x35')](_0x1b1c5f[_0xf7f7('0x36')],_0x1b1c5f['query']);_0x526568['attributes']=_[_0xf7f7('0x35')](_0x1b1c5f[_0xf7f7('0x36')],qs[_0xf7f7('0x37')](_0x467b18[_0xf7f7('0x32')][_0xf7f7('0x37')]));_0x526568['attributes']=_0x526568[_0xf7f7('0x38')]['length']?_0x526568[_0xf7f7('0x38')]:_0x1b1c5f[_0xf7f7('0x36')];if(!_0x467b18[_0xf7f7('0x32')]['hasOwnProperty'](_0xf7f7('0x39'))){_0x526568[_0xf7f7('0x21')]=qs['limit'](_0x467b18[_0xf7f7('0x32')][_0xf7f7('0x21')]);_0x526568[_0xf7f7('0x1f')]=qs[_0xf7f7('0x1f')](_0x467b18[_0xf7f7('0x32')][_0xf7f7('0x1f')]);}_0x526568['order']=qs[_0xf7f7('0x3a')](_0x467b18[_0xf7f7('0x32')][_0xf7f7('0x3a')]);_0x526568[_0xf7f7('0x3b')]=qs[_0xf7f7('0x34')](_['pick'](_0x467b18['query'],_0x1b1c5f[_0xf7f7('0x34')]),_0x3b93f9);if(_0x467b18[_0xf7f7('0x32')][_0xf7f7('0x3c')]){_0x526568['where']=_['merge'](_0x526568[_0xf7f7('0x3b')],{'$or':_[_0xf7f7('0x2e')](_0x3b93f9,function(_0x4aa26c){if(_0x4aa26c['type']!=='VIRTUAL'){var _0x3c7663={};_0x3c7663[_0x4aa26c[_0xf7f7('0x2c')]]={'$like':'%'+_0x467b18[_0xf7f7('0x32')][_0xf7f7('0x3c')]+'%'};return _0x3c7663;}})});}_0x526568=_['merge']({},_0x526568,_0x467b18['options']);var _0x3c9825={'where':_0x526568[_0xf7f7('0x3b')]};return db['WhatsappTransferReport']['count'](_0x3c9825)[_0xf7f7('0x28')](function(_0x493243){_0x473fc9[_0xf7f7('0x20')]=_0x493243;if(_0x467b18[_0xf7f7('0x32')][_0xf7f7('0x3d')]){_0x526568[_0xf7f7('0x3e')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xf7f7('0x3f')](_0x526568);})[_0xf7f7('0x28')](function(_0x8f8713){_0x473fc9[_0xf7f7('0x40')]=_0x8f8713;return _0x473fc9;})[_0xf7f7('0x28')](respondWithFilteredResult(_0x351173,_0x526568))[_0xf7f7('0x41')](handleError(_0x351173,null));};exports[_0xf7f7('0x42')]=function(_0x1e7d53,_0x55401d){var _0x37a49b={'raw':!![],'where':{'id':_0x1e7d53[_0xf7f7('0x43')]['id']}},_0x303cdf={};_0x303cdf[_0xf7f7('0x36')]=_[_0xf7f7('0x33')](db[_0xf7f7('0x2f')][_0xf7f7('0x30')]);_0x303cdf[_0xf7f7('0x32')]=_[_0xf7f7('0x33')](_0x1e7d53[_0xf7f7('0x32')]);_0x303cdf[_0xf7f7('0x34')]=_[_0xf7f7('0x35')](_0x303cdf[_0xf7f7('0x36')],_0x303cdf[_0xf7f7('0x32')]);_0x37a49b[_0xf7f7('0x38')]=_['intersection'](_0x303cdf['model'],qs[_0xf7f7('0x37')](_0x1e7d53[_0xf7f7('0x32')][_0xf7f7('0x37')]));_0x37a49b[_0xf7f7('0x38')]=_0x37a49b[_0xf7f7('0x38')]['length']?_0x37a49b[_0xf7f7('0x38')]:_0x303cdf[_0xf7f7('0x36')];if(_0x1e7d53['query'][_0xf7f7('0x3d')]){_0x37a49b[_0xf7f7('0x3e')]=[{'all':!![]}];}_0x37a49b=_[_0xf7f7('0x44')]({},_0x37a49b,_0x1e7d53['options']);return db[_0xf7f7('0x2f')]['find'](_0x37a49b)[_0xf7f7('0x28')](handleEntityNotFound(_0x55401d,null))[_0xf7f7('0x28')](respondWithResult(_0x55401d,null))[_0xf7f7('0x41')](handleError(_0x55401d,null));};exports['create']=function(_0x4b3d86,_0x29a3b1){return db[_0xf7f7('0x2f')][_0xf7f7('0x45')](_0x4b3d86[_0xf7f7('0x46')],{})['then'](respondWithResult(_0x29a3b1,0xc9))[_0xf7f7('0x41')](handleError(_0x29a3b1,null));};exports[_0xf7f7('0x27')]=function(_0x14c28b,_0x2838c6){if(_0x14c28b[_0xf7f7('0x46')]['id']){delete _0x14c28b[_0xf7f7('0x46')]['id'];}return db[_0xf7f7('0x2f')][_0xf7f7('0x47')]({'where':{'id':_0x14c28b['params']['id']}})['then'](handleEntityNotFound(_0x2838c6,null))['then'](saveUpdates(_0x14c28b[_0xf7f7('0x46')],null))[_0xf7f7('0x28')](respondWithResult(_0x2838c6,null))[_0xf7f7('0x41')](handleError(_0x2838c6,null));};exports[_0xf7f7('0x29')]=function(_0x676571,_0x2078b0){return db[_0xf7f7('0x2f')][_0xf7f7('0x47')]({'where':{'id':_0x676571[_0xf7f7('0x43')]['id']}})['then'](handleEntityNotFound(_0x2078b0,null))[_0xf7f7('0x28')](removeEntity(_0x2078b0,null))[_0xf7f7('0x41')](handleError(_0x2078b0,null));};exports[_0xf7f7('0x48')]=function(_0x2590ff,_0x56fa53){return db[_0xf7f7('0x2f')][_0xf7f7('0x48')]()['then'](respondWithResult(_0x56fa53,null))[_0xf7f7('0x41')](handleError(_0x56fa53,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index ae8c93b..7057616 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 _0xf09f=['../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf09f,0x1ba));var _0xff09=function(_0x17996a,_0x3f275f){_0x17996a=_0x17996a-0x0;var _0x3df313=_0xf09f[_0x17996a];return _0x3df313;};'use strict';var _=require(_0xff09('0x0'));var util=require(_0xff09('0x1'));var logger=require(_0xff09('0x2'))(_0xff09('0x3'));var moment=require(_0xff09('0x4'));var BPromise=require(_0xff09('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff09('0x6'));var rimraf=require(_0xff09('0x7'));var config=require(_0xff09('0x8'));var attributes=require(_0xff09('0x9'));module[_0xff09('0xa')]=function(_0x10828a,_0xfe231b){return _0x10828a[_0xff09('0xb')](_0xff09('0xc'),attributes,{'tableName':_0xff09('0xd'),'paranoid':![],'indexes':[{'name':_0xff09('0xe'),'fields':[_0xff09('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa938=['rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x217ab2,_0x791194){var _0x20ee58=function(_0x38e8f4){while(--_0x38e8f4){_0x217ab2['push'](_0x217ab2['shift']());}};_0x20ee58(++_0x791194);}(_0xa938,0xaf));var _0x8a93=function(_0xde6992,_0x2c5fa0){_0xde6992=_0xde6992-0x0;var _0x2b4cc2=_0xa938[_0xde6992];return _0x2b4cc2;};'use strict';var _=require(_0x8a93('0x0'));var util=require(_0x8a93('0x1'));var logger=require(_0x8a93('0x2'))(_0x8a93('0x3'));var moment=require(_0x8a93('0x4'));var BPromise=require(_0x8a93('0x5'));var rp=require(_0x8a93('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a93('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a93('0x8'));module[_0x8a93('0x9')]=function(_0x38ffa6,_0x3d1dcd){return _0x38ffa6[_0x8a93('0xa')](_0x8a93('0xb'),attributes,{'tableName':_0x8a93('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index e21f68e..263113c 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 _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x43e4c1,_0x2a068f){var _0x156295=function(_0x146e30){while(--_0x146e30){_0x43e4c1['push'](_0x43e4c1['shift']());}};_0x156295(++_0x2a068f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x4bdecf,_0x3c1acc){var _0x1740ac=function(_0x189c18){while(--_0x189c18){_0x4bdecf['push'](_0x4bdecf['shift']());}};_0x1740ac(++_0x3c1acc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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/app.js b/server/app.js index 6d6383f..2bd542a 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84c6=['join','seedDB','./config/license','default','catch','error','exit','./rpc','./config/environment','./config/logger','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','start','info','Online\x20apps:','map','filter','name','Offline\x20apps:','status','online'];(function(_0x26cddc,_0x51b2e3){var _0x591830=function(_0x332266){while(--_0x332266){_0x26cddc['push'](_0x26cddc['shift']());}};_0x591830(++_0x51b2e3);}(_0x84c6,0xe7));var _0x684c=function(_0x331872,_0x3ccaa5){_0x331872=_0x331872-0x0;var _0x396f4f=_0x84c6[_0x331872];return _0x396f4f;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0x684c('0x0'));var config=require(_0x684c('0x1'));var logger=require(_0x684c('0x2'))('app');var pm2=require(_0x684c('0x3'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x684c('0x4'));var chat=require(_0x684c('0x5'));var whatsapp=require(_0x684c('0x6'));var transcribe=require(_0x684c('0x7'));function main(){return mysqldb['db'][_0x684c('0x8')][_0x684c('0x9')]()[_0x684c('0xa')](function(){return rpc[_0x684c('0xb')]();})[_0x684c('0xa')](function(_0x2fd628){logger['info'](_0x2fd628);return chat[_0x684c('0xc')]();})[_0x684c('0xa')](function(){return whatsapp['start']();})[_0x684c('0xa')](function(){return schedule['start']();})[_0x684c('0xa')](function(){return transcribe[_0x684c('0xc')]();})[_0x684c('0xa')](function(_0x29d5a8){logger[_0x684c('0xd')](_0x29d5a8);return pm2['start'](pm2Config);})['then'](function(_0x2a38f0){logger['info'](_0x684c('0xe'),_[_0x684c('0xf')](_[_0x684c('0x10')](_0x2a38f0,{'status':'online'}),_0x684c('0x11'))['join']());logger[_0x684c('0xd')](_0x684c('0x12'),_[_0x684c('0xf')](_[_0x684c('0x10')](_0x2a38f0,function(_0x329a6d){return _0x329a6d[_0x684c('0x13')]!==_0x684c('0x14');}),_0x684c('0x11'))[_0x684c('0x15')]()||'None');config[_0x684c('0x16')]&&require('./config/seedDB')['default']();require(_0x684c('0x17'))[_0x684c('0x18')]();})[_0x684c('0x19')](function(_0x1dc55d){logger[_0x684c('0x1a')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1dc55d);process[_0x684c('0x1b')](0x1);});}main(); \ No newline at end of file +var _0x79e2=['catch','error','exit','lodash','./rpc','./config/environment','./config/logger','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','then','listen','info','start','Online\x20apps:','map','online','join','Offline\x20apps:','filter','status','name','None','seedDB','./config/seedDB','default'];(function(_0x35c945,_0x21d64f){var _0x1bea72=function(_0x43227e){while(--_0x43227e){_0x35c945['push'](_0x35c945['shift']());}};_0x1bea72(++_0x21d64f);}(_0x79e2,0x1c3));var _0x279e=function(_0x2f0dc3,_0x541e4d){_0x2f0dc3=_0x2f0dc3-0x0;var _0x15cad9=_0x79e2[_0x2f0dc3];return _0x15cad9;};'use strict';var _=require(_0x279e('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x279e('0x1'));var config=require(_0x279e('0x2'));var logger=require(_0x279e('0x3'))('app');var pm2=require(_0x279e('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x279e('0x5'));var chat=require(_0x279e('0x6'));var whatsapp=require(_0x279e('0x7'));var transcribe=require(_0x279e('0x8'));function main(){return mysqldb['db']['sequelize']['sync']()[_0x279e('0x9')](function(){return rpc[_0x279e('0xa')]();})[_0x279e('0x9')](function(_0x3d2176){logger[_0x279e('0xb')](_0x3d2176);return chat['start']();})[_0x279e('0x9')](function(){return whatsapp[_0x279e('0xc')]();})[_0x279e('0x9')](function(){return schedule['start']();})[_0x279e('0x9')](function(){return transcribe[_0x279e('0xc')]();})['then'](function(_0x238cfa){logger[_0x279e('0xb')](_0x238cfa);return pm2[_0x279e('0xc')](pm2Config);})[_0x279e('0x9')](function(_0x3aa8a7){logger[_0x279e('0xb')](_0x279e('0xd'),_[_0x279e('0xe')](_['filter'](_0x3aa8a7,{'status':_0x279e('0xf')}),'name')[_0x279e('0x10')]());logger[_0x279e('0xb')](_0x279e('0x11'),_['map'](_[_0x279e('0x12')](_0x3aa8a7,function(_0x42ad0a){return _0x42ad0a[_0x279e('0x13')]!=='online';}),_0x279e('0x14'))[_0x279e('0x10')]()||_0x279e('0x15'));config[_0x279e('0x16')]&&require(_0x279e('0x17'))[_0x279e('0x18')]();require('./config/license')[_0x279e('0x18')]();})[_0x279e('0x19')](function(_0x1e9a48){logger[_0x279e('0x1a')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1e9a48);process[_0x279e('0x1b')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 5697c96..99587e1 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 _0x0592=['HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','session','role','fullname','name','internal','email','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','privacyEnabled','settingsEnabled','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','Forbidden.','catch','headers','authorization','startsWith','Basic','find','authenticate','status','Wrong\x20credentials.','Bearer','json','query','apikey','getUuid','User','Setting','blockDuration','isEqual','apiKeyNonce','Invalid\x20API\x20access\x20key','blocked','add','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','sign','secret','payload','options','secrets','randomBytes','hex','floor','now','toString'];(function(_0x3fa36d,_0x17ec13){var _0x45c7cc=function(_0x27fdce){while(--_0x27fdce){_0x3fa36d['push'](_0x3fa36d['shift']());}};_0x45c7cc(++_0x17ec13);}(_0x0592,0xf3));var _0x2059=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0592[_0x57b54c];return _0x59cc19;};'use strict';var db=require(_0x2059('0x0'))['db'];var config=require(_0x2059('0x1'));var hardwareConf=require(_0x2059('0x2'));var licenseUtil=require(_0x2059('0x3'));var encryptor=require(_0x2059('0x4'));var _=require(_0x2059('0x5'));var jwt=require(_0x2059('0x6'));var expressJwt=require('express-jwt');var compose=require(_0x2059('0x7'));var basicAuth=require(_0x2059('0x8'));var crypto=require(_0x2059('0x9'));var BPromise=require(_0x2059('0xa'));var util=require(_0x2059('0xb'));var moment=require(_0x2059('0xc'));var validateJwt=expressJwt({'secret':config['secrets'][_0x2059('0xd')]});var userAttributes=['id',_0x2059('0xe'),_0x2059('0xf'),_0x2059('0x10'),_0x2059('0x11'),_0x2059('0x12'),'userpic','permissions',_0x2059('0x13'),_0x2059('0x14'),_0x2059('0x15'),_0x2059('0x16'),'faxPause',_0x2059('0x17'),_0x2059('0x18'),_0x2059('0x19'),'showWebBar',_0x2059('0x1a'),_0x2059('0x1b'),_0x2059('0x1c'),_0x2059('0x1d'),_0x2059('0x1e'),_0x2059('0x1f'),_0x2059('0x20'),_0x2059('0x21'),_0x2059('0x22'),_0x2059('0x23'),_0x2059('0x24'),_0x2059('0x25'),_0x2059('0x26'),'phoneBarPrefixRequired',_0x2059('0x27'),_0x2059('0x28'),'hotdesk',_0x2059('0x29'),'userProfileId',_0x2059('0x2a'),_0x2059('0x2b'),'wssPort','downloadVoiceRecordings',_0x2059('0x2c'),_0x2059('0x2d')];exports[_0x2059('0x2e')]=function(){return this[_0x2059('0x2f')](!![])[_0x2059('0x30')](function(_0x4f482a,_0x1e0472,_0x7e2747){if(_0x4f482a[_0x2059('0x31')]){_0x7e2747();}else{return db[_0x2059('0x32')][_0x2059('0x33')]({'where':{'id':_0x4f482a['params']['id']},'attributes':['id',_0x2059('0x34'),_0x2059('0x35')],'raw':!![]})[_0x2059('0x36')](function(_0x17e02e){if(_0x17e02e&&_0x17e02e[_0x2059('0x34')]){return _0x1e0472['status'](_0x17e02e[_0x2059('0x35')]===_0x2059('0x37')?0x195:0x193)['json']({'message':_0x17e02e[_0x2059('0x35')]===_0x2059('0x37')?'Unmanaged.':_0x2059('0x38')});}else{_0x7e2747();}})[_0x2059('0x39')](function(_0x8b2295){_0x7e2747(_0x8b2295);});}});};exports[_0x2059('0x2f')]=function isAuthenticated(_0x165670){return compose()['use'](function(_0x4e29bd,_0x4d9c50,_0x2996d0){var _0x29650b;if(_0x4e29bd[_0x2059('0x3a')][_0x2059('0x3b')]){if(_[_0x2059('0x3c')](_0x4e29bd[_0x2059('0x3a')][_0x2059('0x3b')],_0x2059('0x3d'))){var _0x1104bd=basicAuth(_0x4e29bd);db['User'][_0x2059('0x3e')]({'where':{'name':_0x1104bd[_0x2059('0x10')]}})[_0x2059('0x36')](function(_0x2f0456){if(!_0x2f0456||!_0x2f0456[_0x2059('0x3f')](_0x1104bd['pass'])){return _0x4d9c50[_0x2059('0x40')](0x191)['json']({'message':_0x2059('0x41')});}_0x4e29bd[_0x2059('0x31')]={'id':_0x2f0456['id']};_0x2996d0();})[_0x2059('0x39')](function(_0x20a88b){_0x2996d0(_0x20a88b);});}else if(_[_0x2059('0x3c')](_0x4e29bd[_0x2059('0x3a')]['authorization'],_0x2059('0x42'))){validateJwt(_0x4e29bd,_0x4d9c50,_0x2996d0);}else{if(_0x165670){_0x2996d0();}else{return _0x4d9c50[_0x2059('0x40')](0x193)[_0x2059('0x43')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4e29bd[_0x2059('0x44')][_0x2059('0x45')]){try{var _0x310e2f={'audience':hardwareConf[_0x2059('0x46')](),'issuer':hardwareConf[_0x2059('0x46')]()};verifyJwt(_0x4e29bd['query'][_0x2059('0x45')],_0x310e2f)[_0x2059('0x36')](function(_0x58d583){return db[_0x2059('0x47')]['find']({'where':{'id':_0x58d583['sub']}})[_0x2059('0x36')](function(_0x107a0c){_0x29650b=_0x107a0c;return db[_0x2059('0x48')][_0x2059('0x33')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2059('0x49')],'raw':!![]});})['then'](function(_0x4a882){if(!_0x29650b||!_[_0x2059('0x4a')](_0x29650b[_0x2059('0x4b')],_0x58d583['nonce'])){return _0x4d9c50['status'](0x191)[_0x2059('0x43')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x29650b['disabled']){return _0x4d9c50[_0x2059('0x40')](0x191)[_0x2059('0x43')]({'message':_0x2059('0x4c')});}if(_0x29650b[_0x2059('0x4d')]){if(_0x4a882[_0x2059('0x49')]>0x0){if(moment(_0x29650b['blockedAt'])[_0x2059('0x4e')](_0x4a882[_0x2059('0x49')],'minutes')>moment()){return _0x4d9c50[_0x2059('0x40')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x4d9c50['status'](0x191)[_0x2059('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4e29bd[_0x2059('0x31')]={'id':_0x29650b['id']};_0x2996d0();});})[_0x2059('0x39')](function(){return _0x4d9c50[_0x2059('0x40')](0x191)[_0x2059('0x43')]({'message':_0x2059('0x4c')});});}catch(_0xeca024){_0x2996d0(_0xeca024);}}else if(_0x165670){_0x2996d0();}else{return _0x4d9c50[_0x2059('0x40')](0x193)[_0x2059('0x43')]({'message':_0x2059('0x4f')});}})[_0x2059('0x30')](function(_0x43c52c,_0x3768de,_0x7a51c){if(_0x43c52c[_0x2059('0x31')]){db[_0x2059('0x47')]['find']({'where':{'id':_0x43c52c[_0x2059('0x31')]['id']},'attributes':userAttributes})['then'](function(_0x2081d7){if(!_0x2081d7){return _0x3768de[_0x2059('0x40')](0x194)[_0x2059('0x43')]({'message':_0x2059('0x50')});}_0x43c52c['user']=_0x2081d7;_0x7a51c();})['catch'](function(_0x418b0f){_0x7a51c(_0x418b0f);});}else if(_0x165670){_0x7a51c();}else{return _0x3768de[_0x2059('0x40')](0x194)['json']({'message':_0x2059('0x51')});}});};exports[_0x2059('0x52')]=function canUpdate(){return compose()[_0x2059('0x30')](function(_0x1cf315,_0xae8847,_0x152bf7){return licenseUtil['getLicense']()[_0x2059('0x36')](function(_0x4487ab){if(_0x4487ab[_0x2059('0x53')]){_0x152bf7();}else{return _0xae8847[_0x2059('0x40')](0x193)[_0x2059('0x43')]({'message':'Forbidden'});}})[_0x2059('0x39')](function(_0x38e6c8){_0x152bf7(_0x38e6c8);});});};exports[_0x2059('0x54')]=function(_0x591a31,_0x1d0a1f,_0x1a29f0){_0x591a31[_0x2059('0x54')]=!![];return _0x1a29f0();};exports[_0x2059('0x55')]=function signToken(_0x337c72){return signJwt(_0x337c72);};exports[_0x2059('0x56')]=function(_0x1020b5,_0x51f88c){if(!_0x1020b5['user']){return _0x51f88c['status'](0x194)[_0x2059('0x43')]({'message':_0x2059('0x57')});}var _0x154ffa={'payload':{'id':_0x1020b5[_0x2059('0x31')]['id'],'role':_0x1020b5['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x154ffa)[_0x2059('0x36')](function(_0x27c3d3){_0x51f88c[_0x2059('0x58')](_0x2059('0x59'),_0x27c3d3);_0x51f88c['redirect'](_0x2059('0x5a'));})[_0x2059('0x39')](function(_0x3e6a56){return _0x51f88c[_0x2059('0x40')](0x1f4)['send'](_0x3e6a56);});};exports[_0x2059('0x5b')]=function(_0x61391a){if(_['isNil'](_0x61391a[_0x2059('0x4b')])||_[_0x2059('0x5c')](_0x61391a[_0x2059('0x5d')])){return null;}else{return createJwt(_0x61391a);}};exports['generateApiKey']=function(_0x69ace5){_0x69ace5[_0x2059('0x4b')]=generateNonce();_0x69ace5[_0x2059('0x5d')]=generateIssuedAt();return createJwt(_0x69ace5);};exports['regenerateApiKey']=function(_0x18f2d6,_0x4e864c){var _0x24d5d3=_0x18f2d6[_0x2059('0x44')][_0x2059('0x45')];if(_0x24d5d3){var _0x2b7595={'nonce':_0x4e864c['apiKeyNonce'],'iat':_0x4e864c[_0x2059('0x5d')],'audience':hardwareConf[_0x2059('0x46')](),'issuer':hardwareConf[_0x2059('0x46')]()};return verifyJwt(_0x24d5d3,_0x2b7595)[_0x2059('0x36')](function(){return generateApiKey(_0x4e864c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x2059('0x5e')]=function(_0x3abf9f){var _0x26fd4f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x26fd4f[_0x2059('0x5f')](_0x3abf9f))throw new db[(_0x2059('0x60'))][(_0x2059('0x61'))](_0x2059('0x62'));return;};exports[_0x2059('0x63')]=function(_0x1079cf,_0x3bcc07,_0x153099){var _0x367f20=encryptor[_0x2059('0x64')](_0x3bcc07)[_0x2059('0x65')](',');for(var _0x1e629e=0x0;_0x1e629e<_0x153099;_0x1e629e++){if(!_0x367f20[_0x1e629e])break;if(_0x1079cf['toLowerCase']()===_0x367f20[_0x1e629e][_0x2059('0x66')]()){var _0x305086=util['format'](_0x2059('0x67'),_0x153099);if(_0x153099===0x1){_0x305086=_0x2059('0x68');}throw new db[(_0x2059('0x60'))][(_0x2059('0x61'))](_0x305086);}}return;};exports[_0x2059('0x69')]=function(_0x7971bb,_0x5afb51){var _0x35aaa0=_0x5afb51?encryptor[_0x2059('0x64')](_0x5afb51)['split'](','):[];if(_0x35aaa0['length']===0x5){_0x35aaa0['splice'](-0x1,0x1);}_0x35aaa0[_0x2059('0x6a')](_0x7971bb);return encryptor[_0x2059('0x6b')](_0x35aaa0[_0x2059('0x6c')](','));};function signJwt(_0x1afff3){var _0x5558ce=BPromise[_0x2059('0x6d')](jwt[_0x2059('0x6e')],{'context':jwt});var _0x55cf64=_0x1afff3[_0x2059('0x6f')]||config['secrets'][_0x2059('0xd')];return new BPromise(function(_0x59af78,_0x59d507){_0x5558ce(_0x1afff3[_0x2059('0x70')],_0x55cf64,_0x1afff3[_0x2059('0x71')])['then'](function(_0x59d678){_0x59af78(_0x59d678);})[_0x2059('0x39')](function(_0x3994d3){_0x59d507(_0x3994d3);});});}function verifyJwt(_0x3ed0b5,_0x2b14a9,_0x3519e7){var _0x22b8e7=BPromise[_0x2059('0x6d')](jwt['verify'],{'context':jwt});var _0x4fe529=_0x3519e7||config[_0x2059('0x72')]['session'];return new BPromise(function(_0x1fc7ec,_0x13a9c9){_0x22b8e7(_0x3ed0b5,_0x4fe529,_0x2b14a9)[_0x2059('0x36')](function(_0x13f36d){_0x1fc7ec(_0x13f36d);})[_0x2059('0x39')](function(_0x473842){_0x13a9c9(_0x473842);});});}function generateNonce(){return crypto[_0x2059('0x73')](0x10)['toString'](_0x2059('0x74'));}function generateIssuedAt(){return Math[_0x2059('0x75')](Date[_0x2059('0x76')]()/0x3e8)[_0x2059('0x77')]();}function createJwt(_0xf70841){var _0x275b1f={'payload':{'iat':_0xf70841[_0x2059('0x5d')],'nonce':_0xf70841['apiKeyNonce']},'options':{'algorithm':_0x2059('0x78'),'subject':_0xf70841['id'][_0x2059('0x77')](),'issuer':hardwareConf[_0x2059('0x46')](),'audience':hardwareConf[_0x2059('0x46')]()}};return signJwt(_0x275b1f)[_0x2059('0x36')](function(_0x44b8ac){return{'iat':_0xf70841[_0x2059('0x5d')],'nonce':_0xf70841[_0x2059('0x4b')],'token':_0x44b8ac};});} \ No newline at end of file +var _0x3339=['closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','add','user','catch','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','split','toLowerCase','updatePasswordsHistory','decryptString','length','unshift','encryptString','join','promisify','sign','payload','options','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','permissions','voicePause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','userProfileId','privacyEnabled','downloadVoiceRecordings','downloadAttachments','isAuthenticated','use','ChatInteraction','findOne','params'];(function(_0x47db1f,_0x258637){var _0x2b77b0=function(_0x34c113){while(--_0x34c113){_0x47db1f['push'](_0x47db1f['shift']());}};_0x2b77b0(++_0x258637);}(_0x3339,0x1a7));var _0x9333=function(_0x37d500,_0x146c41){_0x37d500=_0x37d500-0x0;var _0x297016=_0x3339[_0x37d500];return _0x297016;};'use strict';var db=require(_0x9333('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x9333('0x1'));var licenseUtil=require(_0x9333('0x2'));var encryptor=require(_0x9333('0x3'));var _=require(_0x9333('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x9333('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0x9333('0x6'));var crypto=require(_0x9333('0x7'));var BPromise=require(_0x9333('0x8'));var util=require(_0x9333('0x9'));var moment=require(_0x9333('0xa'));var validateJwt=expressJwt({'secret':config[_0x9333('0xb')][_0x9333('0xc')]});var userAttributes=['id',_0x9333('0xd'),_0x9333('0xe'),_0x9333('0xf'),_0x9333('0x10'),_0x9333('0x11'),'userpic',_0x9333('0x12'),'md5secret',_0x9333('0x13'),'chatPause',_0x9333('0x14'),_0x9333('0x15'),_0x9333('0x16'),_0x9333('0x17'),'pauseType',_0x9333('0x18'),_0x9333('0x19'),'lastPauseAt',_0x9333('0x1a'),'allowmessenger',_0x9333('0x1b'),_0x9333('0x1c'),_0x9333('0x1d'),'phoneBarAutoAnswerDelay',_0x9333('0x1e'),_0x9333('0x1f'),_0x9333('0x20'),'phoneBarEnableSettings',_0x9333('0x21'),_0x9333('0x22'),_0x9333('0x23'),'phoneBarRemoteControlPort','hotdesk','interface',_0x9333('0x24'),_0x9333('0x25'),'settingsEnabled','wssPort',_0x9333('0x26'),'downloadOmnichannelInteractions',_0x9333('0x27')];exports['isChatInteractionAuthorized']=function(){return this[_0x9333('0x28')](!![])[_0x9333('0x29')](function(_0x309872,_0x3385e8,_0x2cc7c3){if(_0x309872['user']){_0x2cc7c3();}else{return db[_0x9333('0x2a')][_0x9333('0x2b')]({'where':{'id':_0x309872[_0x9333('0x2c')]['id']},'attributes':['id',_0x9333('0x2d'),_0x9333('0x2e')],'raw':!![]})[_0x9333('0x2f')](function(_0x1980d6){if(_0x1980d6&&_0x1980d6['closed']){return _0x3385e8[_0x9333('0x30')](_0x1980d6[_0x9333('0x2e')]===_0x9333('0x31')?0x195:0x193)[_0x9333('0x32')]({'message':_0x1980d6[_0x9333('0x2e')]===_0x9333('0x31')?_0x9333('0x33'):_0x9333('0x34')});}else{_0x2cc7c3();}})['catch'](function(_0x47b44e){_0x2cc7c3(_0x47b44e);});}});};exports[_0x9333('0x28')]=function isAuthenticated(_0x8871f4){return compose()[_0x9333('0x29')](function(_0x22e2d9,_0x4605cf,_0x4dbbec){var _0x11dddd;if(_0x22e2d9[_0x9333('0x35')][_0x9333('0x36')]){if(_[_0x9333('0x37')](_0x22e2d9[_0x9333('0x35')]['authorization'],_0x9333('0x38'))){var _0x2e7f64=basicAuth(_0x22e2d9);db[_0x9333('0x39')][_0x9333('0x3a')]({'where':{'name':_0x2e7f64['name']}})['then'](function(_0x14f4e2){if(!_0x14f4e2||!_0x14f4e2[_0x9333('0x3b')](_0x2e7f64[_0x9333('0x3c')])){return _0x4605cf[_0x9333('0x30')](0x191)['json']({'message':_0x9333('0x3d')});}_0x22e2d9['user']={'id':_0x14f4e2['id']};_0x4dbbec();})['catch'](function(_0x349f4f){_0x4dbbec(_0x349f4f);});}else if(_['startsWith'](_0x22e2d9[_0x9333('0x35')][_0x9333('0x36')],'Bearer')){validateJwt(_0x22e2d9,_0x4605cf,_0x4dbbec);}else{if(_0x8871f4){_0x4dbbec();}else{return _0x4605cf[_0x9333('0x30')](0x193)[_0x9333('0x32')]({'message':_0x9333('0x3e')});}}}else if(_0x22e2d9[_0x9333('0x3f')][_0x9333('0x40')]){try{var _0x557a69={'audience':hardwareConf[_0x9333('0x41')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x22e2d9[_0x9333('0x3f')][_0x9333('0x40')],_0x557a69)[_0x9333('0x2f')](function(_0x307642){return db[_0x9333('0x39')][_0x9333('0x3a')]({'where':{'id':_0x307642['sub']}})[_0x9333('0x2f')](function(_0x35c258){_0x11dddd=_0x35c258;return db['Setting'][_0x9333('0x2b')]({'where':{'id':0x1},'attributes':[_0x9333('0x42'),_0x9333('0x43')],'raw':!![]});})[_0x9333('0x2f')](function(_0x20f3dd){if(!_0x11dddd||!_[_0x9333('0x44')](_0x11dddd[_0x9333('0x45')],_0x307642[_0x9333('0x46')])){return _0x4605cf[_0x9333('0x30')](0x191)[_0x9333('0x32')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x11dddd[_0x9333('0x47')]){return _0x4605cf[_0x9333('0x30')](0x191)[_0x9333('0x32')]({'message':_0x9333('0x48')});}if(_0x11dddd['blocked']){if(_0x20f3dd[_0x9333('0x43')]>0x0){if(moment(_0x11dddd['blockedAt'])[_0x9333('0x49')](_0x20f3dd['blockDuration'],'minutes')>moment()){return _0x4605cf[_0x9333('0x30')](0x191)[_0x9333('0x32')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x4605cf[_0x9333('0x30')](0x191)[_0x9333('0x32')]({'message':_0x9333('0x48')});}}_0x22e2d9[_0x9333('0x4a')]={'id':_0x11dddd['id']};_0x4dbbec();});})[_0x9333('0x4b')](function(){return _0x4605cf[_0x9333('0x30')](0x191)[_0x9333('0x32')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x61e322){_0x4dbbec(_0x61e322);}}else if(_0x8871f4){_0x4dbbec();}else{return _0x4605cf[_0x9333('0x30')](0x193)[_0x9333('0x32')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x361c3c,_0xc96f6c,_0x5b3963){if(_0x361c3c[_0x9333('0x4a')]){db['User'][_0x9333('0x3a')]({'where':{'id':_0x361c3c[_0x9333('0x4a')]['id']},'attributes':userAttributes})[_0x9333('0x2f')](function(_0x39783b){if(!_0x39783b){return _0xc96f6c['status'](0x194)[_0x9333('0x32')]({'message':_0x9333('0x4c')});}_0x361c3c[_0x9333('0x4a')]=_0x39783b;_0x5b3963();})[_0x9333('0x4b')](function(_0x3ad80a){_0x5b3963(_0x3ad80a);});}else if(_0x8871f4){_0x5b3963();}else{return _0xc96f6c[_0x9333('0x30')](0x194)[_0x9333('0x32')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x9333('0x4d')]=function canUpdate(){return compose()['use'](function(_0x56d168,_0x21b212,_0x4a78f4){return licenseUtil[_0x9333('0x4e')]()[_0x9333('0x2f')](function(_0x3c7e14){if(_0x3c7e14[_0x9333('0x4f')]){_0x4a78f4();}else{return _0x21b212[_0x9333('0x30')](0x193)[_0x9333('0x32')]({'message':_0x9333('0x50')});}})['catch'](function(_0x1a3607){_0x4a78f4(_0x1a3607);});});};exports[_0x9333('0x51')]=function(_0x247e50,_0x3c8991,_0x2e64cd){_0x247e50[_0x9333('0x51')]=!![];return _0x2e64cd();};exports[_0x9333('0x52')]=function signToken(_0x5334c1){return signJwt(_0x5334c1);};exports[_0x9333('0x53')]=function(_0x22ed36,_0x2999f0){if(!_0x22ed36[_0x9333('0x4a')]){return _0x2999f0[_0x9333('0x30')](0x194)['json']({'message':_0x9333('0x54')});}var _0x599912={'payload':{'id':_0x22ed36[_0x9333('0x4a')]['id'],'role':_0x22ed36[_0x9333('0x4a')][_0x9333('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x599912)[_0x9333('0x2f')](function(_0x31b7a6){_0x2999f0[_0x9333('0x55')](_0x9333('0x56'),_0x31b7a6);_0x2999f0[_0x9333('0x57')](_0x9333('0x58'));})[_0x9333('0x4b')](function(_0x12a47d){return _0x2999f0[_0x9333('0x30')](0x1f4)['send'](_0x12a47d);});};exports[_0x9333('0x59')]=function(_0x2628c6){if(_['isNil'](_0x2628c6[_0x9333('0x45')])||_[_0x9333('0x5a')](_0x2628c6[_0x9333('0x5b')])){return null;}else{return createJwt(_0x2628c6);}};exports[_0x9333('0x5c')]=function(_0x3521d0){_0x3521d0[_0x9333('0x45')]=generateNonce();_0x3521d0['apiKeyIat']=generateIssuedAt();return createJwt(_0x3521d0);};exports[_0x9333('0x5d')]=function(_0x1c6f7f,_0x1eded3){var _0x426f4d=_0x1c6f7f[_0x9333('0x3f')][_0x9333('0x40')];if(_0x426f4d){var _0x28080c={'nonce':_0x1eded3[_0x9333('0x45')],'iat':_0x1eded3[_0x9333('0x5b')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x9333('0x41')]()};return verifyJwt(_0x426f4d,_0x28080c)['then'](function(){return generateApiKey(_0x1eded3);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x9333('0x5e')]=function(_0x4f42c2){var _0x390f71=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x390f71[_0x9333('0x5f')](_0x4f42c2))throw new db[(_0x9333('0x60'))][(_0x9333('0x61'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x9333('0x62')]=function(_0x2c0ef7,_0x23ea1d,_0x3359a){var _0x5bb921=encryptor['decryptString'](_0x23ea1d)[_0x9333('0x63')](',');for(var _0x3bdd4a=0x0;_0x3bdd4a<_0x3359a;_0x3bdd4a++){if(!_0x5bb921[_0x3bdd4a])break;if(_0x2c0ef7['toLowerCase']()===_0x5bb921[_0x3bdd4a][_0x9333('0x64')]()){var _0x4035b2=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x3359a);if(_0x3359a===0x1){_0x4035b2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x9333('0x60'))]['ValidationError'](_0x4035b2);}}return;};exports[_0x9333('0x65')]=function(_0xfc0fa9,_0x2b7de4){var _0x4963c2=_0x2b7de4?encryptor[_0x9333('0x66')](_0x2b7de4)['split'](','):[];if(_0x4963c2[_0x9333('0x67')]===0x5){_0x4963c2['splice'](-0x1,0x1);}_0x4963c2[_0x9333('0x68')](_0xfc0fa9);return encryptor[_0x9333('0x69')](_0x4963c2[_0x9333('0x6a')](','));};function signJwt(_0xee2176){var _0x9a00cf=BPromise[_0x9333('0x6b')](jwt[_0x9333('0x6c')],{'context':jwt});var _0x195176=_0xee2176['secret']||config['secrets']['session'];return new BPromise(function(_0x4e250b,_0x3cd710){_0x9a00cf(_0xee2176[_0x9333('0x6d')],_0x195176,_0xee2176[_0x9333('0x6e')])[_0x9333('0x2f')](function(_0x17c024){_0x4e250b(_0x17c024);})[_0x9333('0x4b')](function(_0x147424){_0x3cd710(_0x147424);});});}function verifyJwt(_0x4a051f,_0x377336,_0xc2eda1){var _0x7270f=BPromise[_0x9333('0x6b')](jwt[_0x9333('0x6f')],{'context':jwt});var _0x5e3370=_0xc2eda1||config[_0x9333('0xb')][_0x9333('0xc')];return new BPromise(function(_0x2f518e,_0x336cef){_0x7270f(_0x4a051f,_0x5e3370,_0x377336)['then'](function(_0xf4abf4){_0x2f518e(_0xf4abf4);})[_0x9333('0x4b')](function(_0x45f1f9){_0x336cef(_0x45f1f9);});});}function generateNonce(){return crypto[_0x9333('0x70')](0x10)[_0x9333('0x71')]('hex');}function generateIssuedAt(){return Math[_0x9333('0x72')](Date[_0x9333('0x73')]()/0x3e8)['toString']();}function createJwt(_0x1fef83){var _0x2b6182={'payload':{'iat':_0x1fef83['apiKeyIat'],'nonce':_0x1fef83[_0x9333('0x45')]},'options':{'algorithm':_0x9333('0x74'),'subject':_0x1fef83['id']['toString'](),'issuer':hardwareConf[_0x9333('0x41')](),'audience':hardwareConf[_0x9333('0x41')]()}};return signJwt(_0x2b6182)[_0x9333('0x2f')](function(_0x4deeb8){return{'iat':_0x1fef83[_0x9333('0x5b')],'nonce':_0x1fef83[_0x9333('0x45')],'token':_0x4deeb8};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index ce4a78b..f32010c 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 _0x50ff=['close','decryptFile','createReadStream','createDecipher','encryptString','secret','update','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','createWriteStream','data','binary','write','end','final'];(function(_0x10ae5a,_0x3ffe94){var _0xd78aeb=function(_0x528c8c){while(--_0x528c8c){_0x10ae5a['push'](_0x10ae5a['shift']());}};_0xd78aeb(++_0x3ffe94);}(_0x50ff,0xd6));var _0xf50f=function(_0x58943c,_0x17dea4){_0x58943c=_0x58943c-0x0;var _0x5abf69=_0x50ff[_0x58943c];return _0x5abf69;};'use strict';var crypto=require(_0xf50f('0x0'));var fs=require('fs');var BPromise=require(_0xf50f('0x1'));var _=require(_0xf50f('0x2'));var config=require('../../config/environment');var logger=require(_0xf50f('0x3'))(_0xf50f('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf50f('0x5')][_0xf50f('0x6')],'algorithm':_0xf50f('0x7')};const fileOptions={'algorithm':_0xf50f('0x8')};if(config[_0xf50f('0x9')]&&config[_0xf50f('0x9')][_0xf50f('0xa')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0xf50f('0xa')]=config['encrypt'][_0xf50f('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf50f('0xb')](',\x20');logger[_0xf50f('0xc')](config[_0xf50f('0x9')][_0xf50f('0xa')],_0xf50f('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x5af076){return AES_SUPPORTED_RX['test'](_0x5af076);}function getSupportedCiphers(){return crypto[_0xf50f('0xe')]()[_0xf50f('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x35271a){return getSupportedCiphers()[_0xf50f('0x10')](_0x35271a)>-0x1;}function combineOptions(_0xcb1471){var _0x427269={};for(var _0x579b09 in fileOptions){if(fileOptions[_0xf50f('0x11')](_0x579b09)){_0x427269[_0x579b09]=fileOptions[_0x579b09];}}if(_0xcb1471){for(var _0x55549e in _0xcb1471){if(_0xcb1471['hasOwnProperty'](_0x55549e)){_0x427269[_0x55549e]=_0xcb1471[_0x55549e];}}}return _0x427269;}exports['encryptFile']=function(_0x55fcee,_0x52306e,_0x1fe4ed,_0x34e213){return new BPromise(function(_0x23304f,_0x222323){_0x34e213=combineOptions(_0x34e213);var _0x24ba20=new Buffer(_0x1fe4ed);var _0x4b341d=fs['createReadStream'](_0x55fcee);var _0x437887=fs[_0xf50f('0x12')](_0x52306e);var _0x507099=crypto['createCipher'](_0x34e213[_0xf50f('0xa')],_0x24ba20);_0x4b341d['on'](_0xf50f('0x13'),function(_0x20c17b){var _0x5cfc9a=new Buffer(_0x507099['update'](_0x20c17b),_0xf50f('0x14'));_0x437887[_0xf50f('0x15')](_0x5cfc9a);});_0x4b341d['on'](_0xf50f('0x16'),function(){try{var _0x1e016d=new Buffer(_0x507099[_0xf50f('0x17')]('binary'),_0xf50f('0x14'));_0x437887[_0xf50f('0x15')](_0x1e016d);_0x437887[_0xf50f('0x16')]();_0x437887['on'](_0xf50f('0x18'),function(){return _0x23304f(_0x52306e);});}catch(_0x2a8fbd){fs['unlink'](_0x52306e);return _0x222323(_0x2a8fbd);}});});};exports[_0xf50f('0x19')]=function(_0x389c8d,_0x57862a,_0x23717f,_0x2f4551){return new BPromise(function(_0xafaaa9,_0x1fb074){_0x2f4551=combineOptions(_0x2f4551);var _0x174180=new Buffer(_0x23717f);var _0x305a6c=fs[_0xf50f('0x1a')](_0x389c8d);var _0x286314=fs[_0xf50f('0x12')](_0x57862a);var _0x59c3d1=crypto[_0xf50f('0x1b')](_0x2f4551['algorithm'],_0x174180);_0x305a6c['on'](_0xf50f('0x13'),function(_0x155ad5){var _0x752838=new Buffer(_0x59c3d1['update'](_0x155ad5),_0xf50f('0x14'));_0x286314[_0xf50f('0x15')](_0x752838);});_0x305a6c['on'](_0xf50f('0x16'),function(){try{var _0x34c403=new Buffer(_0x59c3d1['final'](_0xf50f('0x14')),_0xf50f('0x14'));_0x286314[_0xf50f('0x15')](_0x34c403);_0x286314['end']();_0x286314['on']('close',function(){return _0xafaaa9(_0x57862a);});}catch(_0x79efd6){fs['unlink'](_0x57862a);return _0x1fb074(_0x79efd6);}});});};exports[_0xf50f('0x1c')]=function(_0x516cde,_0x2f9332,_0x52ffa9){var _0x2a6a76=_0x52ffa9||stringOptions['algorithm'];var _0xe7fdb1=_0x2f9332||stringOptions[_0xf50f('0x1d')];var _0x512958=crypto['createCipher'](_0x2a6a76,_0xe7fdb1);var _0x35bdaa=_0x512958[_0xf50f('0x1e')](_0x516cde,_0xf50f('0x1f'),'base64');_0x35bdaa+=_0x512958[_0xf50f('0x17')](_0xf50f('0x20'));return _0x35bdaa;};exports[_0xf50f('0x21')]=function(_0x121d1f,_0x3ab2dc,_0x14fcf5){var _0x4607c9=_0x14fcf5||stringOptions[_0xf50f('0xa')];var _0x55a830=_0x3ab2dc||stringOptions[_0xf50f('0x1d')];var _0x318ab0=crypto[_0xf50f('0x1b')](_0x4607c9,_0x55a830);var _0x4df549=_0x318ab0['update'](_0x121d1f,'base64',_0xf50f('0x1f'));_0x4df549+=_0x318ab0[_0xf50f('0x17')](_0xf50f('0x1f'));return _0x4df549;}; \ No newline at end of file +var _0x7040=['write','end','final','close','unlink','decryptFile','secret','utf8','decryptString','base64','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x7040,0xaf));var _0x0704=function(_0xc817d7,_0x5d6206){_0xc817d7=_0xc817d7-0x0;var _0x25cc06=_0x7040[_0xc817d7];return _0x25cc06;};'use strict';var crypto=require(_0x0704('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x0704('0x1'));var config=require(_0x0704('0x2'));var logger=require(_0x0704('0x3'))(_0x0704('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0704('0x5')][_0x0704('0x6')],'algorithm':_0x0704('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0x0704('0x8')]&&config['encrypt'][_0x0704('0x9')]){var isSupported=isAlgorithmSupported(config[_0x0704('0x8')]['algorithm']);if(isSupported){fileOptions[_0x0704('0x9')]=config['encrypt'][_0x0704('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0704('0xa')](',\x20');logger[_0x0704('0xb')](config[_0x0704('0x8')][_0x0704('0x9')],_0x0704('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x175cb7){return AES_SUPPORTED_RX[_0x0704('0xd')](_0x175cb7);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x0704('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x33cd62){return getSupportedCiphers()[_0x0704('0xf')](_0x33cd62)>-0x1;}function combineOptions(_0x227a5a){var _0xbd3349={};for(var _0x165dae in fileOptions){if(fileOptions[_0x0704('0x10')](_0x165dae)){_0xbd3349[_0x165dae]=fileOptions[_0x165dae];}}if(_0x227a5a){for(var _0x40320b in _0x227a5a){if(_0x227a5a[_0x0704('0x10')](_0x40320b)){_0xbd3349[_0x40320b]=_0x227a5a[_0x40320b];}}}return _0xbd3349;}exports[_0x0704('0x11')]=function(_0x22bb4e,_0x41c222,_0x31b180,_0x3f8e22){return new BPromise(function(_0x47c6fc,_0x258f50){_0x3f8e22=combineOptions(_0x3f8e22);var _0x56fc9b=new Buffer(_0x31b180);var _0x4e7c5f=fs[_0x0704('0x12')](_0x22bb4e);var _0x1a0991=fs[_0x0704('0x13')](_0x41c222);var _0x394953=crypto['createCipher'](_0x3f8e22[_0x0704('0x9')],_0x56fc9b);_0x4e7c5f['on'](_0x0704('0x14'),function(_0x6955fc){var _0x5bad99=new Buffer(_0x394953[_0x0704('0x15')](_0x6955fc),_0x0704('0x16'));_0x1a0991[_0x0704('0x17')](_0x5bad99);});_0x4e7c5f['on'](_0x0704('0x18'),function(){try{var _0x318f54=new Buffer(_0x394953[_0x0704('0x19')](_0x0704('0x16')),_0x0704('0x16'));_0x1a0991[_0x0704('0x17')](_0x318f54);_0x1a0991[_0x0704('0x18')]();_0x1a0991['on'](_0x0704('0x1a'),function(){return _0x47c6fc(_0x41c222);});}catch(_0x1f94fa){fs[_0x0704('0x1b')](_0x41c222);return _0x258f50(_0x1f94fa);}});});};exports[_0x0704('0x1c')]=function(_0x3d5b1e,_0x19d19f,_0x35b6e7,_0xc245ba){return new BPromise(function(_0x54126a,_0x107bd7){_0xc245ba=combineOptions(_0xc245ba);var _0x21887d=new Buffer(_0x35b6e7);var _0x49f3eb=fs[_0x0704('0x12')](_0x3d5b1e);var _0x59ee70=fs[_0x0704('0x13')](_0x19d19f);var _0x23396d=crypto['createDecipher'](_0xc245ba[_0x0704('0x9')],_0x21887d);_0x49f3eb['on'](_0x0704('0x14'),function(_0x29dec8){var _0x113e22=new Buffer(_0x23396d[_0x0704('0x15')](_0x29dec8),_0x0704('0x16'));_0x59ee70[_0x0704('0x17')](_0x113e22);});_0x49f3eb['on'](_0x0704('0x18'),function(){try{var _0xa29efb=new Buffer(_0x23396d[_0x0704('0x19')](_0x0704('0x16')),_0x0704('0x16'));_0x59ee70[_0x0704('0x17')](_0xa29efb);_0x59ee70[_0x0704('0x18')]();_0x59ee70['on']('close',function(){return _0x54126a(_0x19d19f);});}catch(_0x8de505){fs[_0x0704('0x1b')](_0x19d19f);return _0x107bd7(_0x8de505);}});});};exports['encryptString']=function(_0xc8633,_0x4762ee,_0x4b0b8e){var _0x19d655=_0x4b0b8e||stringOptions[_0x0704('0x9')];var _0x3b3c43=_0x4762ee||stringOptions[_0x0704('0x1d')];var _0x237dd2=crypto['createCipher'](_0x19d655,_0x3b3c43);var _0x16e8a1=_0x237dd2[_0x0704('0x15')](_0xc8633,_0x0704('0x1e'),'base64');_0x16e8a1+=_0x237dd2[_0x0704('0x19')]('base64');return _0x16e8a1;};exports[_0x0704('0x1f')]=function(_0x83e70d,_0x244d15,_0x3a20d0){var _0x28a62a=_0x3a20d0||stringOptions['algorithm'];var _0x58bab9=_0x244d15||stringOptions[_0x0704('0x1d')];var _0x5b0877=crypto['createDecipher'](_0x28a62a,_0x58bab9);var _0x4e5a77=_0x5b0877[_0x0704('0x15')](_0x83e70d,_0x0704('0x20'),'utf8');_0x4e5a77+=_0x5b0877[_0x0704('0x19')]('utf8');return _0x4e5a77;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index b6b7153..1faf8bd 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 _0x48ed=['zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','each','join','%s%d.%s','%s.%s','csv','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','inspect','Failed','finally','util','path','to-csv'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x48ed,0x84));var _0xd48e=function(_0x5cdc52,_0x33ce72){_0x5cdc52=_0x5cdc52-0x0;var _0x455283=_0x48ed[_0x5cdc52];return _0x455283;};'use strict';var util=require(_0xd48e('0x0'));var path=require(_0xd48e('0x1'));var _=require('lodash');var csv=require(_0xd48e('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xd48e('0x3'));var rimraf=require(_0xd48e('0x4'));var db=require(_0xd48e('0x5'))['db'];var dbH=require(_0xd48e('0x5'))[_0xd48e('0x6')];var logger=require('../../config/logger')(_0xd48e('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xd48e('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd48e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e3772,_0x3cc146){var _0x5e8ce6={'status':_0x2e3772};var _0x4fa31c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3cc146){_0x5e8ce6[_0xd48e('0x9')]=_0x3cc146;}return db['AnalyticExtractedReport'][_0xd48e('0xa')](_0x5e8ce6,_0x4fa31c);}function main(){var _0xa52026=0x1388;var _0x5db97c;logger[_0xd48e('0xb')](util[_0xd48e('0xc')](_0xd48e('0xd'),EXTRACTED_REPORT_ID,_0xd48e('0xe')));return db['Setting'][_0xd48e('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd48e('0x10'),'splitSizeCsv']})[_0xd48e('0x11')](function(_0x210429){if(_0x210429){_0x5db97c=_0x210429;_0xa52026=_0x5db97c[_0xd48e('0x12')]||0x1388;}})[_0xd48e('0x11')](function(){return dbH[_0xd48e('0x13')][_0xd48e('0x14')](util[_0xd48e('0xc')](_0xd48e('0x15'),QUERY),{'type':dbH[_0xd48e('0x13')][_0xd48e('0x16')][_0xd48e('0x17')]});})[_0xd48e('0x11')](function(_0x4e8a67){if(!_0x4e8a67[0x0]['num']){return analyticExtractedReport(_0xd48e('0x18'));}var _0x30a2f4=[];var _0x86a9de=0x0;var _0x4d2cbc=!![];if(_0x4e8a67&&_0x4e8a67[_0xd48e('0x19')]){var _0x131f41=_0x4e8a67[0x0][_0xd48e('0x1a')]%(_0x86a9de+_0xa52026);if(_0x5db97c['split']){for(;_0x4d2cbc;_0x86a9de+=_0xa52026,_0x131f41=_0x4e8a67[0x0][_0xd48e('0x1a')]%(_0x86a9de+_0xa52026)){if(_0x131f41==0x0||_0x131f41==_0x4e8a67[0x0][_0xd48e('0x1a')]){_0x4d2cbc=![];}_0x30a2f4[_0xd48e('0x1b')](dbH[_0xd48e('0x13')][_0xd48e('0x14')](util['format'](_0xd48e('0x1c'),QUERY,_0xa52026,_0x86a9de),{'type':dbH[_0xd48e('0x13')][_0xd48e('0x16')][_0xd48e('0x17')]}));}}else{_0x30a2f4[_0xd48e('0x1b')](dbH[_0xd48e('0x13')][_0xd48e('0x14')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xd48e('0x17')]}));}}var _0x3908a3=path[_0xd48e('0x1d')](PATH);var _0x1ce624=path[_0xd48e('0x1e')](PATH,_0xd48e('0x1f'));var _0xadffd9=_0x5db97c['split']&&_0x30a2f4['length']>0x1;var _0x505691=[];if(!fs[_0xd48e('0x20')](path['join'](_0x3908a3,_0x1ce624))&&_0xadffd9){fs['mkdirSync'](path['join'](_0x3908a3,_0x1ce624));}return BPromise[_0xd48e('0x21')](_0x30a2f4,function(_0x28cf9b){_0x505691['push'](_0x28cf9b);})[_0xd48e('0x11')](function(){for(var _0x15b21a=0x0;_0x15b21a<_0x505691[_0xd48e('0x19')];_0x15b21a+=0x1){var _0x1368f1;var _0x32ea1e=_0x505691[_0x15b21a];if(_0xadffd9){_0x1368f1=path[_0xd48e('0x22')](_0x3908a3,_0x1ce624,util['format'](_0xd48e('0x23'),_0x1ce624,_0x15b21a,'csv'));}else{_0x1368f1=path[_0xd48e('0x22')](_0x3908a3,util['format'](_0xd48e('0x24'),_0x1ce624,_0xd48e('0x25')));}fs[_0xd48e('0x26')](_0x1368f1,csv(_0x32ea1e));}})[_0xd48e('0x11')](function(){if(_0xadffd9){zipdir(path[_0xd48e('0x22')](_0x3908a3,_0x1ce624),{'saveTo':path[_0xd48e('0x22')](_0x3908a3,util[_0xd48e('0xc')](_0xd48e('0x24'),_0x1ce624,_0xd48e('0x27')))},function(_0x30f389,_0x37659f){});rimraf(path[_0xd48e('0x22')](_0x3908a3,_0x1ce624),function(){});}})[_0xd48e('0x11')](function(){logger[_0xd48e('0xb')](util[_0xd48e('0xc')](_0xd48e('0x28'),EXTRACTED_REPORT_ID,_0xd48e('0xe')));return analyticExtractedReport('Completed',_0xadffd9?util[_0xd48e('0xc')]('%s.%s',_0x1ce624,_0xadffd9?'zip':'csv'):null);});})[_0xd48e('0x29')](function(_0x448a05){logger[_0xd48e('0xb')](util[_0xd48e('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd48e('0xe')),util[_0xd48e('0x2a')](_0x448a05,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd48e('0x2b'));})[_0xd48e('0x2c')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1d26=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','split','splitSizeCsv','then','sequelize','query','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.csv','existsSync','join','mkdirSync','each','push','%s%d.%s','csv','%s.%s','writeFileSync','zip','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info'];(function(_0x46e3d5,_0x5ff91d){var _0x4a1ab7=function(_0x533184){while(--_0x533184){_0x46e3d5['push'](_0x46e3d5['shift']());}};_0x4a1ab7(++_0x5ff91d);}(_0x1d26,0xa7));var _0x61d2=function(_0x308a1d,_0x3d379d){_0x308a1d=_0x308a1d-0x0;var _0x5eb875=_0x1d26[_0x308a1d];return _0x5eb875;};'use strict';var util=require(_0x61d2('0x0'));var path=require('path');var _=require(_0x61d2('0x1'));var csv=require(_0x61d2('0x2'));var fs=require('fs');var BPromise=require(_0x61d2('0x3'));var zipdir=require(_0x61d2('0x4'));var rimraf=require(_0x61d2('0x5'));var db=require(_0x61d2('0x6'))['db'];var dbH=require(_0x61d2('0x6'))['dbH'];var logger=require(_0x61d2('0x7'))(_0x61d2('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x61d2('0x9')][0x2]);var QUERY=process[_0x61d2('0x9')][0x3];var PATH=process[_0x61d2('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x521b8b,_0x160902){var _0x3d0bb8={'status':_0x521b8b};var _0x47ceca={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x160902){_0x3d0bb8[_0x61d2('0xa')]=_0x160902;}return db[_0x61d2('0xb')]['update'](_0x3d0bb8,_0x47ceca);}function main(){var _0x14d366=0x1388;var _0x5612dd;logger[_0x61d2('0xc')](util[_0x61d2('0xd')](_0x61d2('0xe'),EXTRACTED_REPORT_ID,_0x61d2('0xf')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x61d2('0x10'),_0x61d2('0x11')]})[_0x61d2('0x12')](function(_0x41f9c8){if(_0x41f9c8){_0x5612dd=_0x41f9c8;_0x14d366=_0x5612dd[_0x61d2('0x11')]||0x1388;}})[_0x61d2('0x12')](function(){return dbH[_0x61d2('0x13')][_0x61d2('0x14')](util[_0x61d2('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x61d2('0x13')]['QueryTypes']['SELECT']});})[_0x61d2('0x12')](function(_0x28c368){if(!_0x28c368[0x0][_0x61d2('0x15')]){return analyticExtractedReport(_0x61d2('0x16'));}var _0x41bec8=[];var _0x4681d2=0x0;var _0x298d16=!![];if(_0x28c368&&_0x28c368[_0x61d2('0x17')]){var _0x3df843=_0x28c368[0x0][_0x61d2('0x15')]%(_0x4681d2+_0x14d366);if(_0x5612dd['split']){for(;_0x298d16;_0x4681d2+=_0x14d366,_0x3df843=_0x28c368[0x0][_0x61d2('0x15')]%(_0x4681d2+_0x14d366)){if(_0x3df843==0x0||_0x3df843==_0x28c368[0x0][_0x61d2('0x15')]){_0x298d16=![];}_0x41bec8['push'](dbH[_0x61d2('0x13')][_0x61d2('0x14')](util[_0x61d2('0xd')](_0x61d2('0x18'),QUERY,_0x14d366,_0x4681d2),{'type':dbH['sequelize'][_0x61d2('0x19')][_0x61d2('0x1a')]}));}}else{_0x41bec8['push'](dbH[_0x61d2('0x13')][_0x61d2('0x14')](QUERY,{'type':dbH['sequelize'][_0x61d2('0x19')][_0x61d2('0x1a')]}));}}var _0x5a523f=path[_0x61d2('0x1b')](PATH);var _0x34fe0b=path[_0x61d2('0x1c')](PATH,_0x61d2('0x1d'));var _0x2a750f=_0x5612dd[_0x61d2('0x10')]&&_0x41bec8[_0x61d2('0x17')]>0x1;var _0x43fa42=[];if(!fs[_0x61d2('0x1e')](path[_0x61d2('0x1f')](_0x5a523f,_0x34fe0b))&&_0x2a750f){fs[_0x61d2('0x20')](path[_0x61d2('0x1f')](_0x5a523f,_0x34fe0b));}return BPromise[_0x61d2('0x21')](_0x41bec8,function(_0x2697e6){_0x43fa42[_0x61d2('0x22')](_0x2697e6);})[_0x61d2('0x12')](function(){for(var _0x805350=0x0;_0x805350<_0x43fa42[_0x61d2('0x17')];_0x805350+=0x1){var _0x1d57fe;var _0x434b6=_0x43fa42[_0x805350];if(_0x2a750f){_0x1d57fe=path[_0x61d2('0x1f')](_0x5a523f,_0x34fe0b,util[_0x61d2('0xd')](_0x61d2('0x23'),_0x34fe0b,_0x805350,_0x61d2('0x24')));}else{_0x1d57fe=path['join'](_0x5a523f,util['format'](_0x61d2('0x25'),_0x34fe0b,_0x61d2('0x24')));}fs[_0x61d2('0x26')](_0x1d57fe,csv(_0x434b6));}})[_0x61d2('0x12')](function(){if(_0x2a750f){zipdir(path['join'](_0x5a523f,_0x34fe0b),{'saveTo':path[_0x61d2('0x1f')](_0x5a523f,util[_0x61d2('0xd')]('%s.%s',_0x34fe0b,_0x61d2('0x27')))},function(_0x4b79fd,_0xd5528a){});rimraf(path[_0x61d2('0x1f')](_0x5a523f,_0x34fe0b),function(){});}})['then'](function(){logger['info'](util[_0x61d2('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x61d2('0x28'),_0x2a750f?util[_0x61d2('0xd')](_0x61d2('0x25'),_0x34fe0b,_0x2a750f?_0x61d2('0x27'):'csv'):null);});})['catch'](function(_0x16fc96){logger[_0x61d2('0xc')](util[_0x61d2('0xd')](_0x61d2('0x29'),EXTRACTED_REPORT_ID,_0x61d2('0xf')),util['inspect'](_0x16fc96,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x61d2('0x2a'));})[_0x61d2('0x2b')](function(){process[_0x61d2('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index d25f216..2a20861 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 _0xea8e=['path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','pageBreak','margin','\x20/\x20','black','dirname','basename','.pdf','join','%s.%s','Setting','split','splitSizePdf','then','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','Arial','center','Interaction\x20Transcript','header','footer','pipe','finish','end','createPdfFromHTML','lodash'];(function(_0x86d4ec,_0x528a1e){var _0x50ed4f=function(_0xfc5a25){while(--_0xfc5a25){_0x86d4ec['push'](_0x86d4ec['shift']());}};_0x50ed4f(++_0x528a1e);}(_0xea8e,0x15b));var _0xeea8=function(_0x5813eb,_0x157c17){_0x5813eb=_0x5813eb-0x0;var _0x314c58=_0xea8e[_0x5813eb];return _0x314c58;};'use strict';var _=require(_0xeea8('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xeea8('0x1'));var moment=require(_0xeea8('0x2'));var htmlToPdfmake=require(_0xeea8('0x3'));var PdfPrinter=require(_0xeea8('0x4'));var zipdir=require(_0xeea8('0x5'));var rimraf=require(_0xeea8('0x6'));var JSDOM=require(_0xeea8('0x7'))[_0xeea8('0x8')];var window=new JSDOM('')[_0xeea8('0x9')];var db=require(_0xeea8('0xa'))['db'];var dbH=require(_0xeea8('0xa'))['dbH'];var logger=require(_0xeea8('0xb'))(_0xeea8('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xeea8('0xd')][0x5];var FORMAT=_0xeea8('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x280832,_0x5ead52){var _0xd9bce7={'status':_0x280832};var _0x10d2a2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ead52){_0xd9bce7[_0xeea8('0xf')]=_0x5ead52;}return db['AnalyticExtractedReport'][_0xeea8('0x10')](_0xd9bce7,_0x10d2a2);}function getHeaders(_0x4b39ee){return _[_0xeea8('0x11')](_0x4b39ee,function(_0x44a700){return{'text':_0x44a700,'style':_0xeea8('0x12')};});}function getRows(_0x1c611a,_0x2b86da){return _[_0xeea8('0x11')](_0x2b86da,function(_0xe6bdec){return _(_0xe6bdec)[_0xeea8('0x13')](_0x1c611a)[_0xeea8('0x11')](function(_0x59112e){return _0x59112e?_[_0xeea8('0x14')](_0x59112e):'';})[_0xeea8('0x15')]();});}function createTable(_0x1e34e8,_0x2fa1bd){var _0x4da60e={'widths':_[_0xeea8('0x16')](Array(_0x1e34e8[_0xeea8('0x17')]),0x91),'heights':function(_0x14b6ef){return _0x14b6ef===0x0?_0xeea8('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x587d28=getHeaders(_0x1e34e8);_0x4da60e[_0xeea8('0x19')][_0xeea8('0x1a')](_0x587d28);var _0x170e64=getRows(_0x1e34e8,_0x2fa1bd);_0x4da60e[_0xeea8('0x19')]=_0x4da60e[_0xeea8('0x19')][_0xeea8('0x1b')](_0x170e64);return _0x4da60e;}function createTables(_0x181210){var _0x6b89cc=[];var _0x3bd03d=_[_0xeea8('0x1c')](Object[_0xeea8('0x1d')](_0x181210[0x0]),0x5);_0x3bd03d[_0xeea8('0x1e')](function(_0x529a2f){_0x6b89cc[_0xeea8('0x1a')](createTable(_0x529a2f,_0x181210));});return _0x6b89cc;}function getPDFDocDefinition(_0x39472c){var _0x5f70b4=util[_0xeea8('0x1f')](_0xeea8('0x20'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xeea8('0x21')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xeea8('0x22')])['format'](FORMAT));var _0x3b0fa2=[];for(var _0x4eb40a=0x0;_0x4eb40a<_0x39472c['length'];_0x4eb40a++){var _0x58773f=[];if(_0x4eb40a===0x0){_0x58773f['push']({'text':_0x5f70b4,'style':'header'});}var _0x586969={'table':_0x39472c[_0x4eb40a]};if(_0x4eb40a>0x0){_0x586969[_0xeea8('0x23')]='before';_0x586969[_0xeea8('0x24')]=[0x0,0x46,0x0,0x0];}_0x58773f['push'](_0x586969);_0x3b0fa2[_0xeea8('0x1a')](_0x58773f);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x3b0fa2,'footer':function(_0xd248ab,_0x3712d1){return{'text':_0xd248ab[_0xeea8('0x14')]()+_0xeea8('0x25')+_0x3712d1,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xeea8('0x26')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xe874ca){var _0x50fe7f=0x1388;var _0x4a3b13;if(!_0xe874ca[0x0]['num']){return analyticExtractedReport('Empty');}var _0x42117a=[];var _0x2867e8=0x0;var _0x826b5b=!![];var _0x204620=path[_0xeea8('0x27')](PATH);var _0x45562c=path[_0xeea8('0x28')](PATH,_0xeea8('0x29'));var _0x3d44c3=path[_0xeea8('0x2a')](_0x204620,util[_0xeea8('0x1f')](_0xeea8('0x2b'),_0x45562c,'pdf'));var _0x38ead8=![];return db[_0xeea8('0x2c')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xeea8('0x2d'),_0xeea8('0x2e')]})[_0xeea8('0x2f')](function(_0x32f075){if(_0x32f075){_0x4a3b13=_0x32f075;_0x50fe7f=_0x4a3b13[_0xeea8('0x2e')]||0x3e8;}})['then'](function(){if(_0xe874ca&&_0xe874ca[_0xeea8('0x17')]){var _0xf7ee5b=_0xe874ca[0x0]['num']%(_0x2867e8+_0x50fe7f);if(_0x4a3b13[_0xeea8('0x2d')]){for(;_0x826b5b;_0x2867e8+=_0x50fe7f,_0xf7ee5b=_0xe874ca[0x0][_0xeea8('0x30')]%(_0x2867e8+_0x50fe7f)){if(_0xf7ee5b==0x0||_0xf7ee5b==_0xe874ca[0x0][_0xeea8('0x30')]){_0x826b5b=![];}_0x42117a['push'](dbH[_0xeea8('0x31')][_0xeea8('0x32')](util[_0xeea8('0x1f')](_0xeea8('0x33'),QUERY,_0x50fe7f,_0x2867e8),{'type':dbH[_0xeea8('0x31')][_0xeea8('0x34')][_0xeea8('0x35')]}));}}else{_0x42117a['push'](dbH[_0xeea8('0x31')][_0xeea8('0x32')](QUERY,{'type':dbH['sequelize'][_0xeea8('0x34')]['SELECT']}));}}_0x38ead8=_0x4a3b13[_0xeea8('0x2d')]&&_0x42117a['length']>0x1;if(!fs['existsSync'](path['join'](_0x204620,_0x45562c))&&_0x38ead8){fs[_0xeea8('0x36')](path[_0xeea8('0x2a')](_0x204620,_0x45562c));}return Promise['all'](_0x42117a);})[_0xeea8('0x2f')](function(_0x116546){return createTables(_[_0xeea8('0x37')](_0x116546));})[_0xeea8('0x2f')](function(_0x5850d3){var _0xf01b40=getPDFDocDefinition(_0x5850d3);var _0x2b264f=getPDFPrinter();var _0x56c193=_0x2b264f[_0xeea8('0x38')](_0xf01b40);if(_0x38ead8)_0x3d44c3=path[_0xeea8('0x2a')](_0x204620,_0x45562c,util[_0xeea8('0x1f')](_0xeea8('0x39'),_0x45562c,index,_0xeea8('0x3a')));return writePDFDocument(_0x56c193,_0x3d44c3);})[_0xeea8('0x2f')](function(){if(!_0x38ead8)return;zipdir(path[_0xeea8('0x2a')](_0x204620,_0x45562c),{'saveTo':path[_0xeea8('0x2a')](_0x204620,util[_0xeea8('0x1f')]('%s.%s',_0x45562c,_0xeea8('0x3b')))},function(_0x5824ce){if(_0x5824ce)throw _0x5824ce;return;});})[_0xeea8('0x2f')](function(){if(!_0x38ead8)return;rimraf(path[_0xeea8('0x2a')](_0x204620,_0x45562c),function(){});})[_0xeea8('0x2f')](function(){logger[_0xeea8('0x3c')](util['format'](_0xeea8('0x3d'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x38ead8?util[_0xeea8('0x1f')](_0xeea8('0x2b'),_0x45562c,_0x38ead8?'zip':_0xeea8('0x3a')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xeea8('0x3c')](util[_0xeea8('0x1f')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xeea8('0x3e')));return db[_0xeea8('0x3f')][_0xeea8('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x51c81f){EXTRACTED_REPORT=_0x51c81f;return dbH[_0xeea8('0x31')][_0xeea8('0x32')](util[_0xeea8('0x1f')](_0xeea8('0x41'),QUERY),{'type':dbH['sequelize'][_0xeea8('0x34')][_0xeea8('0x35')]});})['then'](extractReport)[_0xeea8('0x42')](function(_0x1c5a6a){logger[_0xeea8('0x3c')](util[_0xeea8('0x1f')](_0xeea8('0x43'),EXTRACTED_REPORT_ID,'PDF'),util[_0xeea8('0x44')](_0x1c5a6a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xeea8('0x45'));})[_0xeea8('0x46')](function(){process[_0xeea8('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x13080a=new PdfPrinter({'Arial':{'normal':__dirname+_0xeea8('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xeea8('0x49'),'bolditalics':__dirname+_0xeea8('0x4a')}});return _0x13080a;}function getPDFDocDefinitionFromHTML(_0x1441e9,_0x44a8f6){var _0x4a73f6=util[_0xeea8('0x1f')](_0xeea8('0x4b'),_0x44a8f6[_0xeea8('0x4c')],_0x44a8f6[_0xeea8('0x4d')]);var _0x212c1a=moment()[_0xeea8('0x1f')]('YYYY-MM-DD')[_0xeea8('0x14')]();var _0x4c04f8=htmlToPdfmake(_0x1441e9,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4c04f8],'defaultStyle':{'font':_0xeea8('0x4e')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xeea8('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xeea8('0x50'),'style':_0xeea8('0x51')}];},'footer':function(_0x125246,_0x205b89){return[{'text':util[_0xeea8('0x1f')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x4a73f6,_0x125246,_0x205b89,_0x212c1a),'style':_0xeea8('0x52')}];}};}function writePDFDocument(_0x2e694a,_0x31cd48){return new Promise(function(_0x1bcd75,_0x16c80d){var _0x1fc62a=_0x2e694a[_0xeea8('0x53')](fs['createWriteStream'](_0x31cd48));_0x1fc62a['on'](_0xeea8('0x54'),function(){_0x1bcd75(_0xeea8('0x54'));});_0x1fc62a['on']('error',function(_0x589cff){_0x16c80d(_0x589cff);});_0x2e694a[_0xeea8('0x55')]();});}exports[_0xeea8('0x56')]=function(_0x5302fa,_0x58cdc1){var _0x5e4aae=getPDFPrinter();var _0x33ea35=getPDFDocDefinitionFromHTML(_0x5302fa,_0x58cdc1);var _0x442811=_0x5e4aae['createPdfKitDocument'](_0x33ea35);return writePDFDocument(_0x442811,_0x58cdc1[_0xeea8('0x1')])[_0xeea8('0x42')](function(_0x159572){throw _0x159572;});}; \ No newline at end of file +var _0x253a=['.pdf','join','%s.%s','pdf','Setting','split','splitSizePdf','then','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','flatten','%s%d.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','createPdfFromHTML','createPdfKitDocument','path','catch','lodash','util','moment','html-to-pdfmake','zip-dir','rimraf','JSDOM','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','name','startDate','endDate','header','before','margin','landscape','footer','Arial','right','Empty','dirname','basename'];(function(_0x5c4547,_0x54e66d){var _0x16c44f=function(_0x226eac){while(--_0x226eac){_0x5c4547['push'](_0x5c4547['shift']());}};_0x16c44f(++_0x54e66d);}(_0x253a,0x1e8));var _0xa253=function(_0x59b2cd,_0x1c1ca3){_0x59b2cd=_0x59b2cd-0x0;var _0xd0d917=_0x253a[_0x59b2cd];return _0xd0d917;};'use strict';var _=require(_0xa253('0x0'));var fs=require('fs');var util=require(_0xa253('0x1'));var path=require('path');var moment=require(_0xa253('0x2'));var htmlToPdfmake=require(_0xa253('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xa253('0x4'));var rimraf=require(_0xa253('0x5'));var JSDOM=require('jsdom')[_0xa253('0x6')];var window=new JSDOM('')['window'];var db=require(_0xa253('0x7'))['db'];var dbH=require(_0xa253('0x7'))[_0xa253('0x8')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa253('0x9')][0x2]);var QUERY=process[_0xa253('0x9')][0x3];var PATH=process[_0xa253('0x9')][0x4];var NAME=process[_0xa253('0x9')][0x5];var FORMAT=_0xa253('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x193406,_0x328b53){var _0x26612f={'status':_0x193406};var _0x2988cc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x328b53){_0x26612f['savename']=_0x328b53;}return db[_0xa253('0xb')][_0xa253('0xc')](_0x26612f,_0x2988cc);}function getHeaders(_0x19c14d){return _[_0xa253('0xd')](_0x19c14d,function(_0x435b8c){return{'text':_0x435b8c,'style':'tableHeader'};});}function getRows(_0x5d94fb,_0x553135){return _['map'](_0x553135,function(_0x2b54b8){return _(_0x2b54b8)[_0xa253('0xe')](_0x5d94fb)[_0xa253('0xd')](function(_0x2c04c6){return _0x2c04c6?_[_0xa253('0xf')](_0x2c04c6):'';})[_0xa253('0x10')]();});}function createTable(_0x25a613,_0x48b001){var _0x27538f={'widths':_[_0xa253('0x11')](Array(_0x25a613[_0xa253('0x12')]),0x91),'heights':function(_0x4b4d87){return _0x4b4d87===0x0?_0xa253('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x579185=getHeaders(_0x25a613);_0x27538f[_0xa253('0x14')][_0xa253('0x15')](_0x579185);var _0x576f96=getRows(_0x25a613,_0x48b001);_0x27538f[_0xa253('0x14')]=_0x27538f[_0xa253('0x14')][_0xa253('0x16')](_0x576f96);return _0x27538f;}function createTables(_0xa8c0b9){var _0x753d6=[];var _0x213690=_[_0xa253('0x17')](Object[_0xa253('0x18')](_0xa8c0b9[0x0]),0x5);_0x213690[_0xa253('0x19')](function(_0x221a51){_0x753d6[_0xa253('0x15')](createTable(_0x221a51,_0xa8c0b9));});return _0x753d6;}function getPDFDocDefinition(_0x43eec2){var _0x21c5fa=util[_0xa253('0x1a')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xa253('0x1b')],moment(EXTRACTED_REPORT[_0xa253('0x1c')])[_0xa253('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0xa253('0x1d')])[_0xa253('0x1a')](FORMAT));var _0x1991a8=[];for(var _0x1f59b6=0x0;_0x1f59b6<_0x43eec2['length'];_0x1f59b6++){var _0x405baf=[];if(_0x1f59b6===0x0){_0x405baf['push']({'text':_0x21c5fa,'style':_0xa253('0x1e')});}var _0x10439f={'table':_0x43eec2[_0x1f59b6]};if(_0x1f59b6>0x0){_0x10439f['pageBreak']=_0xa253('0x1f');_0x10439f[_0xa253('0x20')]=[0x0,0x46,0x0,0x0];}_0x405baf[_0xa253('0x15')](_0x10439f);_0x1991a8[_0xa253('0x15')](_0x405baf);}return{'pageSize':'A4','pageOrientation':_0xa253('0x21'),'content':_0x1991a8,'footer':function(_0x1e775c,_0x54cf55){return{'text':_0x1e775c[_0xa253('0xf')]()+'\x20/\x20'+_0x54cf55,'style':_0xa253('0x22')};},'defaultStyle':{'font':_0xa253('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xa253('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1395fe){var _0x4ab426=0x1388;var _0x18c1db;if(!_0x1395fe[0x0]['num']){return analyticExtractedReport(_0xa253('0x25'));}var _0x2de960=[];var _0x151e75=0x0;var _0x261ad9=!![];var _0x47eb89=path[_0xa253('0x26')](PATH);var _0x2e5414=path[_0xa253('0x27')](PATH,_0xa253('0x28'));var _0x1a1cc1=path[_0xa253('0x29')](_0x47eb89,util[_0xa253('0x1a')](_0xa253('0x2a'),_0x2e5414,_0xa253('0x2b')));var _0x2f5581=![];return db[_0xa253('0x2c')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa253('0x2d'),_0xa253('0x2e')]})[_0xa253('0x2f')](function(_0x5f267c){if(_0x5f267c){_0x18c1db=_0x5f267c;_0x4ab426=_0x18c1db[_0xa253('0x2e')]||0x3e8;}})[_0xa253('0x2f')](function(){if(_0x1395fe&&_0x1395fe['length']){var _0x3da15f=_0x1395fe[0x0][_0xa253('0x30')]%(_0x151e75+_0x4ab426);if(_0x18c1db['split']){for(;_0x261ad9;_0x151e75+=_0x4ab426,_0x3da15f=_0x1395fe[0x0][_0xa253('0x30')]%(_0x151e75+_0x4ab426)){if(_0x3da15f==0x0||_0x3da15f==_0x1395fe[0x0][_0xa253('0x30')]){_0x261ad9=![];}_0x2de960[_0xa253('0x15')](dbH[_0xa253('0x31')][_0xa253('0x32')](util[_0xa253('0x1a')](_0xa253('0x33'),QUERY,_0x4ab426,_0x151e75),{'type':dbH[_0xa253('0x31')][_0xa253('0x34')][_0xa253('0x35')]}));}}else{_0x2de960[_0xa253('0x15')](dbH[_0xa253('0x31')][_0xa253('0x32')](QUERY,{'type':dbH[_0xa253('0x31')][_0xa253('0x34')][_0xa253('0x35')]}));}}_0x2f5581=_0x18c1db['split']&&_0x2de960[_0xa253('0x12')]>0x1;if(!fs[_0xa253('0x36')](path[_0xa253('0x29')](_0x47eb89,_0x2e5414))&&_0x2f5581){fs['mkdirSync'](path[_0xa253('0x29')](_0x47eb89,_0x2e5414));}return Promise['all'](_0x2de960);})[_0xa253('0x2f')](function(_0x566dcb){return createTables(_[_0xa253('0x37')](_0x566dcb));})[_0xa253('0x2f')](function(_0x2dca2a){var _0x226e19=getPDFDocDefinition(_0x2dca2a);var _0x5f095b=getPDFPrinter();var _0x3d9b51=_0x5f095b['createPdfKitDocument'](_0x226e19);if(_0x2f5581)_0x1a1cc1=path[_0xa253('0x29')](_0x47eb89,_0x2e5414,util[_0xa253('0x1a')](_0xa253('0x38'),_0x2e5414,index,'pdf'));return writePDFDocument(_0x3d9b51,_0x1a1cc1);})[_0xa253('0x2f')](function(){if(!_0x2f5581)return;zipdir(path['join'](_0x47eb89,_0x2e5414),{'saveTo':path['join'](_0x47eb89,util[_0xa253('0x1a')](_0xa253('0x2a'),_0x2e5414,'zip'))},function(_0x1c0205){if(_0x1c0205)throw _0x1c0205;return;});})[_0xa253('0x2f')](function(){if(!_0x2f5581)return;rimraf(path[_0xa253('0x29')](_0x47eb89,_0x2e5414),function(){});})[_0xa253('0x2f')](function(){logger[_0xa253('0x39')](util[_0xa253('0x1a')](_0xa253('0x3a'),EXTRACTED_REPORT_ID,_0xa253('0x3b')));return analyticExtractedReport(_0xa253('0x3c'),_0x2f5581?util[_0xa253('0x1a')](_0xa253('0x2a'),_0x2e5414,_0x2f5581?_0xa253('0x3d'):_0xa253('0x2b')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xa253('0x1a')](_0xa253('0x3e'),EXTRACTED_REPORT_ID,_0xa253('0x3f')));return db[_0xa253('0xb')][_0xa253('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa253('0x2f')](function(_0x3a7e13){EXTRACTED_REPORT=_0x3a7e13;return dbH[_0xa253('0x31')][_0xa253('0x32')](util[_0xa253('0x1a')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xa253('0x31')]['QueryTypes'][_0xa253('0x35')]});})['then'](extractReport)['catch'](function(_0x484c98){logger[_0xa253('0x39')](util[_0xa253('0x1a')](_0xa253('0x41'),EXTRACTED_REPORT_ID,_0xa253('0x3f')),util[_0xa253('0x42')](_0x484c98,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa253('0x43'));})[_0xa253('0x44')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2224ec=new PdfPrinter({'Arial':{'normal':__dirname+_0xa253('0x45'),'bold':__dirname+_0xa253('0x46'),'italics':__dirname+_0xa253('0x47'),'bolditalics':__dirname+_0xa253('0x48')}});return _0x2224ec;}function getPDFDocDefinitionFromHTML(_0x38c101,_0x3f2ebb){var _0x5596a1=util[_0xa253('0x1a')](_0xa253('0x49'),_0x3f2ebb[_0xa253('0x4a')],_0x3f2ebb[_0xa253('0x4b')]);var _0x29fc4f=moment()['format'](_0xa253('0x4c'))['toString']();var _0x57a9ad=htmlToPdfmake(_0x38c101,{'window':window,'tableAutoSize':!![]});return{'content':[_0x57a9ad],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa253('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa253('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa253('0x4d')}},'header':function(){return[{'text':_0xa253('0x4e'),'style':_0xa253('0x1e')}];},'footer':function(_0x29961f,_0x2a9eab){return[{'text':util[_0xa253('0x1a')](_0xa253('0x4f'),_0x5596a1,_0x29961f,_0x2a9eab,_0x29fc4f),'style':'footer'}];}};}function writePDFDocument(_0x42b9fd,_0x4e598a){return new Promise(function(_0x54be6b,_0x54fb53){var _0x3df8ca=_0x42b9fd[_0xa253('0x50')](fs[_0xa253('0x51')](_0x4e598a));_0x3df8ca['on'](_0xa253('0x52'),function(){_0x54be6b(_0xa253('0x52'));});_0x3df8ca['on']('error',function(_0x4cc6f9){_0x54fb53(_0x4cc6f9);});_0x42b9fd[_0xa253('0x53')]();});}exports[_0xa253('0x54')]=function(_0x57787a,_0xc761a5){var _0x206376=getPDFPrinter();var _0x4caa1b=getPDFDocDefinitionFromHTML(_0x57787a,_0xc761a5);var _0x5388f9=_0x206376[_0xa253('0x55')](_0x4caa1b);return writePDFDocument(_0x5388f9,_0xc761a5[_0xa253('0x56')])[_0xa253('0x57')](function(_0x10dfa9){throw _0x10dfa9;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index e82d9bd..5277f12 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 _0xa9e0=['QueryTypes','SELECT','num','split','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','length','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x2fdee1,_0x466858){var _0x2c5533=function(_0x1f34de){while(--_0x1f34de){_0x2fdee1['push'](_0x2fdee1['shift']());}};_0x2c5533(++_0x466858);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x307b3e[_0x0a9e('0x14')]){if(_0x52a03d&&_0x52a03d['length']){var _0x225616=_0x52a03d[0x0]['num']%(_0x519dfd+_0xf81284);for(;_0x16033c;_0x519dfd+=_0xf81284,_0x225616=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x225616==0x0||_0x225616==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x14')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1c')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1d')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x1e')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,json2xls(_0x33161b),_0x0a9e('0x22'));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1b')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1b')](_0x20f109,util['format'](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x23')))},function(_0x2b1f27,_0x2ec755){});rimraf(path['join'](_0x20f109,_0x588269),function(){});}})[_0x0a9e('0xe')](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x24'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')));return analyticExtractedReport(_0x0a9e('0x26'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x23'):'xlsx'):null);});})[_0x0a9e('0x27')](function(_0x5d1e0e){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x28'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')),util[_0x0a9e('0x29')](_0x5d1e0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0a9e('0x2a')](function(){process[_0x0a9e('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa9e0=['QueryTypes','SELECT','num','split','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','length','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x386b69,_0x5d9360){var _0x476415=function(_0x49fd60){while(--_0x49fd60){_0x386b69['push'](_0x386b69['shift']());}};_0x476415(++_0x5d9360);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x307b3e[_0x0a9e('0x14')]){if(_0x52a03d&&_0x52a03d['length']){var _0x225616=_0x52a03d[0x0]['num']%(_0x519dfd+_0xf81284);for(;_0x16033c;_0x519dfd+=_0xf81284,_0x225616=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x225616==0x0||_0x225616==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x14')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1c')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1d')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x1e')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,json2xls(_0x33161b),_0x0a9e('0x22'));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1b')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1b')](_0x20f109,util['format'](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x23')))},function(_0x2b1f27,_0x2ec755){});rimraf(path['join'](_0x20f109,_0x588269),function(){});}})[_0x0a9e('0xe')](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x24'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')));return analyticExtractedReport(_0x0a9e('0x26'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x23'):'xlsx'):null);});})[_0x0a9e('0x27')](function(_0x5d1e0e){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x28'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')),util[_0x0a9e('0x29')](_0x5d1e0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0a9e('0x2a')](function(){process[_0x0a9e('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 090a3f2..438e5ec 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 _0x64c2=['appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','sortBy','catch','error','lodash','models','Interval','findAll','then','intervals','VoiceExtension','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','hasOwnProperty','find','extensions','push','type','format','CDR(type)=%s','context','priority','outbound','extension','Set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','VoiceExtensionId','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','tag','length','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','indexOf','app'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x64c2,0x178));var _0x264c=function(_0x560e06,_0x4a2ab9){_0x560e06=_0x560e06-0x0;var _0x345d9d=_0x64c2[_0x560e06];return _0x345d9d;};'use strict';var _=require(_0x264c('0x0'));var util=require('util');function rewrite(_0x1e0c74,_0x2ba24d){var _0x1194f4=this;return _0x1e0c74[_0x264c('0x1')][_0x264c('0x2')][_0x264c('0x3')]({'raw':!![]})[_0x264c('0x4')](function(_0x192d3e){_0x1194f4[_0x264c('0x5')]=_0x192d3e;return _0x1e0c74[_0x264c('0x1')][_0x264c('0x6')]['findAll']({'where':{'IntervalId':_0x2ba24d['IntervalId']},'raw':!![]});})['then'](function(_0x4518e6){return _0x1e0c74[_0x264c('0x1')][_0x264c('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x264c('0x7')](_0x4518e6,'exten'))}},'order':[{'raw':_0x264c('0x8')}],'raw':!![]});})[_0x264c('0x4')](function(_0x4e3773){var _0x4ce051=_[_0x264c('0x9')](_0x4e3773,{'priority':'1'});var _0x51d8da=_['filter'](_0x4e3773,{'isApp':0x1});var _0x4e86e0=_[_0x264c('0xa')](_0x51d8da,_0x264c('0xb'));var _0x22511d=[_0x264c('0xc'),'playback'];var _0x38a0c8=[];var _0x528dff=[];for(var _0x4f11b4 in _0x4e86e0){if(_0x4e86e0[_0x264c('0xd')](_0x4f11b4)){_0x1194f4['priority']=0x2;_0x1194f4['extensions']=[];_0x1194f4['extension']=_[_0x264c('0xe')](_0x4ce051,{'exten':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0xb')]});_0x1194f4[_0x264c('0xf')][_0x264c('0x10')]({'type':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x11')],'app':'Set','appdata':util[_0x264c('0x12')](_0x264c('0x13'),_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x11')]),'context':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x14')],'exten':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0xb')],'priority':_0x1194f4[_0x264c('0x15')]++,'VoiceExtensionId':_0x4e86e0[_0x4f11b4][0x0]['VoiceExtensionId']});if(_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x11')]===_0x264c('0x16')){if(_0x1194f4[_0x264c('0x17')]){_0x1194f4[_0x264c('0xf')]['push']({'type':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x11')],'app':_0x264c('0x18'),'appdata':_0x264c('0x19')+(_0x1194f4['extension'][_0x264c('0x1a')]?_0x264c('0x1b')+_0x1194f4[_0x264c('0x17')][_0x264c('0x1a')]+'}':_0x264c('0x1c')),'context':_0x4e86e0[_0x4f11b4][0x0]['context'],'exten':_0x4e86e0[_0x4f11b4][0x0]['exten'],'priority':_0x1194f4[_0x264c('0x15')]++,'VoiceExtensionId':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x1d')]});}_0x1194f4[_0x264c('0xf')][_0x264c('0x10')]({'type':_0x4e86e0[_0x4f11b4][0x0]['type'],'app':_0x264c('0x18'),'appdata':_0x264c('0x1e')+_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x1d')],'context':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x14')],'exten':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0xb')],'priority':_0x1194f4[_0x264c('0x15')]++,'VoiceExtensionId':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x1d')]});var _0x45b445=_0x1194f4[_0x264c('0x15')]++;_0x1194f4[_0x264c('0xf')]['push']({'type':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x11')],'app':'ExecIf','appdata':_0x264c('0x1f')+(_0x45b445+0x2)+_0x264c('0x20')+(_0x45b445+0x1)+')','context':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x14')],'exten':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0xb')],'priority':_0x45b445,'VoiceExtensionId':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x1d')]});if(_0x1194f4[_0x264c('0x17')]){_0x1194f4[_0x264c('0xf')][_0x264c('0x10')]({'type':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x11')],'app':_0x264c('0x18'),'appdata':_0x1194f4[_0x264c('0x17')]['cutdigits']?_0x264c('0x21')+_0x1194f4[_0x264c('0x17')][_0x264c('0x1a')]+'}':_0x264c('0x22'),'context':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x14')],'exten':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0xb')],'priority':_0x1194f4[_0x264c('0x15')]++,'VoiceExtensionId':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x1d')]});}_0x1194f4[_0x264c('0xf')]['push']({'type':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x11')],'app':_0x264c('0x18'),'appdata':_0x264c('0x23')+_0x4e86e0[_0x4f11b4][0x0]['VoiceExtensionId'],'context':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x14')],'exten':_0x4e86e0[_0x4f11b4][0x0]['exten'],'priority':_0x1194f4[_0x264c('0x15')]++,'VoiceExtensionId':_0x4e86e0[_0x4f11b4][0x0]['VoiceExtensionId']});if(_0x1194f4[_0x264c('0x17')]&&_0x1194f4[_0x264c('0x17')][_0x264c('0xd')](_0x264c('0x24'))&&_0x1194f4[_0x264c('0x17')]['recordingFormat']!==_0x264c('0x25')){_0x1194f4[_0x264c('0xf')]['push']({'type':_0x4e86e0[_0x4f11b4][0x0]['type'],'app':'Set','appdata':_0x264c('0x26'),'context':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x14')],'exten':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0xb')],'priority':_0x1194f4[_0x264c('0x15')]++,'VoiceExtensionId':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x1d')]});_0x1194f4['extensions'][_0x264c('0x10')]({'type':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x11')],'app':'Set','appdata':_0x264c('0x27')+_0x1194f4['extension'][_0x264c('0x24')]||'wav','context':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x14')],'exten':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0xb')],'priority':_0x1194f4['priority']++,'VoiceExtensionId':_0x4e86e0[_0x4f11b4][0x0]['VoiceExtensionId']});}}_0x1194f4['extensions'][_0x264c('0x10')]({'type':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x11')],'app':_0x264c('0x18'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4e86e0[_0x4f11b4][0x0]['context'],'exten':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0xb')],'priority':_0x1194f4[_0x264c('0x15')]++,'VoiceExtensionId':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x1d')]});_0x1194f4[_0x264c('0xf')][_0x264c('0x10')]({'type':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x11')],'app':'Set','appdata':_0x264c('0x28'),'context':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x14')],'exten':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0xb')],'priority':_0x1194f4[_0x264c('0x15')]++,'VoiceExtensionId':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x1d')]});_0x1194f4[_0x264c('0xf')][_0x264c('0x10')]({'type':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x11')],'app':_0x264c('0x18'),'appdata':_0x264c('0x29'),'context':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x14')],'exten':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0xb')],'priority':_0x1194f4['priority']++,'VoiceExtensionId':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x1d')]});for(var _0x5a6141=0x0,_0x45d858=0x0;_0x5a6141<_0x4e86e0[_0x4f11b4]['length'];_0x5a6141+=0x1,_0x45d858=0x0){var _0xca7282=_0x4e86e0[_0x4f11b4][_0x5a6141];if(_0xca7282['type']){_0xca7282[_0x264c('0x11')]=_0xca7282[_0x264c('0x11')][_0x264c('0x2a')]();}var _0x172aa9=[];var _0x580721=[];delete _0xca7282['id'];delete _0xca7282[_0x264c('0x2b')];delete _0xca7282['updatedAt'];var _0x4f4ec7=_0xca7282[_0x264c('0x2c')]!==_0x264c('0x2d')?[_0xca7282[_0x264c('0x2c')]]:_0xca7282[_0x264c('0x2e')]?_[_0x264c('0x7')](_[_0x264c('0x9')](_0x1194f4[_0x264c('0x5')],{'IntervalId':_0xca7282['IntervalId']}),_0x264c('0x2c')):[];if(_0xca7282[_0x264c('0xd')](_0x264c('0x2f'))){if(_0xca7282[_0x264c('0x2f')]&&_0xca7282['tag']!=='--'){_0x172aa9[_0x264c('0x10')]({'type':_0xca7282[_0x264c('0x11')],'app':_0x264c('0x18'),'appdata':'CDR(tag)='+_0xca7282['tag'],'context':_0xca7282[_0x264c('0x14')],'exten':_0xca7282[_0x264c('0xb')],'priority':_0x4f4ec7[_0x264c('0x30')]+_0x1194f4[_0x264c('0x15')]+_0x45d858++,'VoiceExtensionId':_0xca7282[_0x264c('0x1d')]});}}if(_0xca7282[_0x264c('0x11')]===_0x264c('0x16')&&_0xca7282[_0x264c('0xd')](_0x264c('0x31'))){if(_0xca7282[_0x264c('0x31')]){_0x172aa9['push']({'type':_0xca7282[_0x264c('0x11')],'app':_0x264c('0x32'),'appdata':_0x264c('0x33')+_0xca7282[_0x264c('0x31')]+')','context':_0xca7282[_0x264c('0x14')],'exten':_0xca7282['exten'],'priority':_0x4f4ec7['length']+_0x1194f4['priority']+_0x45d858++,'VoiceExtensionId':_0xca7282['VoiceExtensionId']});}else{_0x172aa9['push']({'type':_0xca7282[_0x264c('0x11')],'app':_0x264c('0x32'),'appdata':_0x264c('0x34'),'context':_0xca7282[_0x264c('0x14')],'exten':_0xca7282[_0x264c('0xb')],'priority':_0x4f4ec7['length']+_0x1194f4[_0x264c('0x15')]+_0x45d858++,'VoiceExtensionId':_0xca7282[_0x264c('0x1d')]});}}if(_0xca7282[_0x264c('0xd')](_0x264c('0x35'))){if(_0x22511d[_0x264c('0x36')](_0xca7282[_0x264c('0x37')][_0x264c('0x2a')]())>=0x0&&_0xca7282[_0x264c('0x38')]!==_0x264c('0x39')){if(_0xca7282['answer']){_0x172aa9['push']({'type':_0xca7282['type'],'app':_0x264c('0x32'),'appdata':_0x264c('0x3a'),'context':_0xca7282[_0x264c('0x14')],'exten':_0xca7282['exten'],'priority':_0x4f4ec7['length']+_0x1194f4['priority']+_0x45d858++,'VoiceExtensionId':_0xca7282['VoiceExtensionId']});_0x172aa9[_0x264c('0x10')]({'type':_0xca7282[_0x264c('0x11')],'app':'Set','appdata':_0x264c('0x3b'),'context':_0xca7282[_0x264c('0x14')],'exten':_0xca7282[_0x264c('0xb')],'priority':_0x4f4ec7[_0x264c('0x30')]+_0x1194f4[_0x264c('0x15')]+_0x45d858++,'VoiceExtensionId':_0xca7282[_0x264c('0x1d')]});}else{_0x172aa9['push']({'type':_0xca7282['type'],'app':_0x264c('0x32'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xca7282[_0x264c('0x14')],'exten':_0xca7282[_0x264c('0xb')],'priority':_0x4f4ec7[_0x264c('0x30')]+_0x1194f4[_0x264c('0x15')]+_0x45d858++,'VoiceExtensionId':_0xca7282[_0x264c('0x1d')]});_0x172aa9[_0x264c('0x10')]({'type':_0xca7282['type'],'app':_0x264c('0x18'),'appdata':_0x264c('0x3c'),'context':_0xca7282[_0x264c('0x14')],'exten':_0xca7282[_0x264c('0xb')],'priority':_0x4f4ec7['length']+_0x1194f4[_0x264c('0x15')]+_0x45d858++,'VoiceExtensionId':_0xca7282[_0x264c('0x1d')]});}}}for(var _0xecaee9=0x0;_0xecaee9<_0x4f4ec7[_0x264c('0x30')];_0xecaee9+=0x1){var _0x5db66c=_0x1194f4[_0x264c('0x15')]+_0x4f4ec7['length'];var _0x157036=_0xecaee9===_0x4f4ec7[_0x264c('0x30')]-0x1?_0x1194f4[_0x264c('0x15')]+_0x172aa9['length']+_0x580721[_0x264c('0x30')]+0x2:_0x1194f4['priority']+_0xecaee9+0x1;_0x172aa9[_0x264c('0x3d')](_0xecaee9,0x0,{'type':_0xca7282[_0x264c('0x11')],'app':_0x264c('0x3e'),'appdata':_0x4f4ec7[_0xecaee9]+'?'+_0xca7282[_0x264c('0x14')]+_0x264c('0x3f')+_0x5db66c+':'+_0xca7282[_0x264c('0x14')]+_0x264c('0x3f')+_0x157036,'exten':_0xca7282['exten'],'context':_0xca7282[_0x264c('0x14')],'priority':_0x1194f4[_0x264c('0x15')]+_0xecaee9,'VoiceExtensionId':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x1d')]});}_0xca7282['priority']=_0x172aa9[_0x264c('0x30')]?_['last'](_0x172aa9)[_0x264c('0x15')]+0x1:_0x1194f4[_0x264c('0x15')];_0x1194f4['priority']=(_0x580721[_0x264c('0x30')]?_[_0x264c('0x40')](_0x580721)[_0x264c('0x15')]:_0xca7282[_0x264c('0x15')])+0x1;_0x1194f4['extensions']=_['concat'](_0x1194f4[_0x264c('0xf')],_0x172aa9,[_0xca7282],_0x580721);}_0x1194f4['extensions']['push']({'type':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x11')],'app':_0x264c('0x41'),'exten':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0xb')],'context':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x14')],'priority':_0x1194f4[_0x264c('0x15')],'VoiceExtensionId':_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x1d')]});_0x38a0c8[_0x264c('0x10')](_0x4e86e0[_0x4f11b4][0x0][_0x264c('0x1d')]);_0x528dff=_[_0x264c('0x42')](_0x528dff,_0x1194f4[_0x264c('0xf')]);}}return _0x1e0c74['transaction'](function(_0x3184b4){return _0x1e0c74[_0x264c('0x1')][_0x264c('0x6')][_0x264c('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x38a0c8}},'transaction':_0x3184b4})[_0x264c('0x4')](function(_0x108897){return _0x1e0c74['models']['VoiceExtension'][_0x264c('0x44')](_[_0x264c('0x45')](_0x528dff,_0x264c('0x15')),{'transaction':_0x3184b4});});});})[_0x264c('0x46')](function(_0x96fda){console[_0x264c('0x47')](_0x96fda);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xa1f1=['exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','outbound','CDR(destination)=','cutdigits','${EXTEN:','context','VoiceExtensionId','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','error','rewrite','util','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','map'];(function(_0x1434d1,_0x3ff205){var _0x51d5b9=function(_0x395d2c){while(--_0x395d2c){_0x1434d1['push'](_0x1434d1['shift']());}};_0x51d5b9(++_0x3ff205);}(_0xa1f1,0x7b));var _0x1a1f=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0xa1f1[_0x256e32];return _0x464070;};'use strict';var _=require('lodash');var util=require(_0x1a1f('0x0'));function rewrite(_0x2aac67,_0x281bc2){var _0x515938=this;return _0x2aac67['models'][_0x1a1f('0x1')][_0x1a1f('0x2')]({'raw':!![]})[_0x1a1f('0x3')](function(_0x3992dd){_0x515938[_0x1a1f('0x4')]=_0x3992dd;return _0x2aac67[_0x1a1f('0x5')][_0x1a1f('0x6')][_0x1a1f('0x2')]({'where':{'IntervalId':_0x281bc2[_0x1a1f('0x7')]},'raw':!![]});})[_0x1a1f('0x3')](function(_0x536442){return _0x2aac67[_0x1a1f('0x5')][_0x1a1f('0x6')][_0x1a1f('0x2')]({'where':{'exten':{'$in':_['uniq'](_[_0x1a1f('0x8')](_0x536442,_0x1a1f('0x9')))}},'order':[{'raw':_0x1a1f('0xa')}],'raw':!![]});})[_0x1a1f('0x3')](function(_0x4bb963){var _0x1556dd=_[_0x1a1f('0xb')](_0x4bb963,{'priority':'1'});var _0x2d5985=_[_0x1a1f('0xb')](_0x4bb963,{'isApp':0x1});var _0x380c1c=_[_0x1a1f('0xc')](_0x2d5985,_0x1a1f('0x9'));var _0x51f73b=[_0x1a1f('0xd'),_0x1a1f('0xe')];var _0x1c6785=[];var _0x38fb10=[];for(var _0x20b40d in _0x380c1c){if(_0x380c1c[_0x1a1f('0xf')](_0x20b40d)){_0x515938[_0x1a1f('0x10')]=0x2;_0x515938[_0x1a1f('0x11')]=[];_0x515938[_0x1a1f('0x12')]=_[_0x1a1f('0x13')](_0x1556dd,{'exten':_0x380c1c[_0x20b40d][0x0]['exten']});_0x515938[_0x1a1f('0x11')][_0x1a1f('0x14')]({'type':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x15')],'app':_0x1a1f('0x16'),'appdata':util[_0x1a1f('0x17')](_0x1a1f('0x18'),_0x380c1c[_0x20b40d][0x0]['type']),'context':_0x380c1c[_0x20b40d][0x0]['context'],'exten':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x9')],'priority':_0x515938[_0x1a1f('0x10')]++,'VoiceExtensionId':_0x380c1c[_0x20b40d][0x0]['VoiceExtensionId']});if(_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x15')]===_0x1a1f('0x19')){if(_0x515938['extension']){_0x515938['extensions'][_0x1a1f('0x14')]({'type':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x15')],'app':_0x1a1f('0x16'),'appdata':_0x1a1f('0x1a')+(_0x515938['extension'][_0x1a1f('0x1b')]?_0x1a1f('0x1c')+_0x515938[_0x1a1f('0x12')][_0x1a1f('0x1b')]+'}':'${EXTEN}'),'context':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1d')],'exten':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x9')],'priority':_0x515938['priority']++,'VoiceExtensionId':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1e')]});}_0x515938[_0x1a1f('0x11')][_0x1a1f('0x14')]({'type':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x15')],'app':'Set','appdata':_0x1a1f('0x1f')+_0x380c1c[_0x20b40d][0x0]['VoiceExtensionId'],'context':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1d')],'exten':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x9')],'priority':_0x515938[_0x1a1f('0x10')]++,'VoiceExtensionId':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1e')]});var _0x3d0440=_0x515938[_0x1a1f('0x10')]++;_0x515938['extensions'][_0x1a1f('0x14')]({'type':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x15')],'app':_0x1a1f('0x20'),'appdata':_0x1a1f('0x21')+(_0x3d0440+0x2)+_0x1a1f('0x22')+(_0x3d0440+0x1)+')','context':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1d')],'exten':_0x380c1c[_0x20b40d][0x0]['exten'],'priority':_0x3d0440,'VoiceExtensionId':_0x380c1c[_0x20b40d][0x0]['VoiceExtensionId']});if(_0x515938[_0x1a1f('0x12')]){_0x515938[_0x1a1f('0x11')][_0x1a1f('0x14')]({'type':_0x380c1c[_0x20b40d][0x0]['type'],'app':_0x1a1f('0x16'),'appdata':_0x515938[_0x1a1f('0x12')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x515938[_0x1a1f('0x12')][_0x1a1f('0x1b')]+'}':_0x1a1f('0x23'),'context':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1d')],'exten':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x9')],'priority':_0x515938[_0x1a1f('0x10')]++,'VoiceExtensionId':_0x380c1c[_0x20b40d][0x0]['VoiceExtensionId']});}_0x515938[_0x1a1f('0x11')][_0x1a1f('0x14')]({'type':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x15')],'app':_0x1a1f('0x16'),'appdata':'outboundrouteid='+_0x380c1c[_0x20b40d][0x0]['VoiceExtensionId'],'context':_0x380c1c[_0x20b40d][0x0]['context'],'exten':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x9')],'priority':_0x515938[_0x1a1f('0x10')]++,'VoiceExtensionId':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1e')]});if(_0x515938[_0x1a1f('0x12')]&&_0x515938[_0x1a1f('0x12')][_0x1a1f('0xf')]('recordingFormat')&&_0x515938['extension'][_0x1a1f('0x24')]!==_0x1a1f('0x25')){_0x515938[_0x1a1f('0x11')]['push']({'type':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x15')],'app':_0x1a1f('0x16'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x380c1c[_0x20b40d][0x0]['context'],'exten':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x9')],'priority':_0x515938[_0x1a1f('0x10')]++,'VoiceExtensionId':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1e')]});_0x515938[_0x1a1f('0x11')][_0x1a1f('0x14')]({'type':_0x380c1c[_0x20b40d][0x0]['type'],'app':_0x1a1f('0x16'),'appdata':_0x1a1f('0x26')+_0x515938[_0x1a1f('0x12')][_0x1a1f('0x24')]||'wav','context':_0x380c1c[_0x20b40d][0x0]['context'],'exten':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x9')],'priority':_0x515938[_0x1a1f('0x10')]++,'VoiceExtensionId':_0x380c1c[_0x20b40d][0x0]['VoiceExtensionId']});}}_0x515938[_0x1a1f('0x11')]['push']({'type':_0x380c1c[_0x20b40d][0x0]['type'],'app':_0x1a1f('0x16'),'appdata':_0x1a1f('0x27'),'context':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1d')],'exten':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x9')],'priority':_0x515938[_0x1a1f('0x10')]++,'VoiceExtensionId':_0x380c1c[_0x20b40d][0x0]['VoiceExtensionId']});_0x515938[_0x1a1f('0x11')][_0x1a1f('0x14')]({'type':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x15')],'app':'Set','appdata':_0x1a1f('0x28'),'context':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1d')],'exten':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x9')],'priority':_0x515938[_0x1a1f('0x10')]++,'VoiceExtensionId':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1e')]});_0x515938[_0x1a1f('0x11')]['push']({'type':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x15')],'app':_0x1a1f('0x16'),'appdata':_0x1a1f('0x29'),'context':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1d')],'exten':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x9')],'priority':_0x515938[_0x1a1f('0x10')]++,'VoiceExtensionId':_0x380c1c[_0x20b40d][0x0]['VoiceExtensionId']});for(var _0x1cfcab=0x0,_0x16a63e=0x0;_0x1cfcab<_0x380c1c[_0x20b40d]['length'];_0x1cfcab+=0x1,_0x16a63e=0x0){var _0x4516df=_0x380c1c[_0x20b40d][_0x1cfcab];if(_0x4516df[_0x1a1f('0x15')]){_0x4516df[_0x1a1f('0x15')]=_0x4516df[_0x1a1f('0x15')][_0x1a1f('0x2a')]();}var _0x1a7f05=[];var _0x573440=[];delete _0x4516df['id'];delete _0x4516df['createdAt'];delete _0x4516df[_0x1a1f('0x2b')];var _0x4eaa29=_0x4516df['interval']!==_0x1a1f('0x2c')?[_0x4516df[_0x1a1f('0x2d')]]:_0x4516df[_0x1a1f('0x7')]?_[_0x1a1f('0x8')](_[_0x1a1f('0xb')](_0x515938[_0x1a1f('0x4')],{'IntervalId':_0x4516df['IntervalId']}),_0x1a1f('0x2d')):[];if(_0x4516df[_0x1a1f('0xf')]('tag')){if(_0x4516df['tag']&&_0x4516df[_0x1a1f('0x2e')]!=='--'){_0x1a7f05[_0x1a1f('0x14')]({'type':_0x4516df[_0x1a1f('0x15')],'app':_0x1a1f('0x16'),'appdata':_0x1a1f('0x2f')+_0x4516df[_0x1a1f('0x2e')],'context':_0x4516df[_0x1a1f('0x1d')],'exten':_0x4516df['exten'],'priority':_0x4eaa29['length']+_0x515938[_0x1a1f('0x10')]+_0x16a63e++,'VoiceExtensionId':_0x4516df['VoiceExtensionId']});}}if(_0x4516df[_0x1a1f('0x15')]===_0x1a1f('0x19')&&_0x4516df[_0x1a1f('0xf')]('callerID')){if(_0x4516df[_0x1a1f('0x30')]){_0x1a7f05[_0x1a1f('0x14')]({'type':_0x4516df[_0x1a1f('0x15')],'app':_0x1a1f('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x4516df[_0x1a1f('0x30')]+')','context':_0x4516df[_0x1a1f('0x1d')],'exten':_0x4516df[_0x1a1f('0x9')],'priority':_0x4eaa29[_0x1a1f('0x31')]+_0x515938['priority']+_0x16a63e++,'VoiceExtensionId':_0x4516df[_0x1a1f('0x1e')]});}else{_0x1a7f05['push']({'type':_0x4516df[_0x1a1f('0x15')],'app':_0x1a1f('0x20'),'appdata':_0x1a1f('0x32'),'context':_0x4516df[_0x1a1f('0x1d')],'exten':_0x4516df[_0x1a1f('0x9')],'priority':_0x4eaa29['length']+_0x515938[_0x1a1f('0x10')]+_0x16a63e++,'VoiceExtensionId':_0x4516df[_0x1a1f('0x1e')]});}}if(_0x4516df['hasOwnProperty']('answer')){if(_0x51f73b[_0x1a1f('0x33')](_0x4516df['app'][_0x1a1f('0x2a')]())>=0x0&&_0x4516df[_0x1a1f('0x34')]!=='custom'){if(_0x4516df[_0x1a1f('0x35')]){_0x1a7f05[_0x1a1f('0x14')]({'type':_0x4516df[_0x1a1f('0x15')],'app':_0x1a1f('0x20'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4516df[_0x1a1f('0x1d')],'exten':_0x4516df[_0x1a1f('0x9')],'priority':_0x4eaa29[_0x1a1f('0x31')]+_0x515938[_0x1a1f('0x10')]+_0x16a63e++,'VoiceExtensionId':_0x4516df[_0x1a1f('0x1e')]});_0x1a7f05[_0x1a1f('0x14')]({'type':_0x4516df[_0x1a1f('0x15')],'app':'Set','appdata':_0x1a1f('0x36'),'context':_0x4516df[_0x1a1f('0x1d')],'exten':_0x4516df[_0x1a1f('0x9')],'priority':_0x4eaa29[_0x1a1f('0x31')]+_0x515938[_0x1a1f('0x10')]+_0x16a63e++,'VoiceExtensionId':_0x4516df[_0x1a1f('0x1e')]});}else{_0x1a7f05[_0x1a1f('0x14')]({'type':_0x4516df[_0x1a1f('0x15')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4516df[_0x1a1f('0x1d')],'exten':_0x4516df['exten'],'priority':_0x4eaa29[_0x1a1f('0x31')]+_0x515938[_0x1a1f('0x10')]+_0x16a63e++,'VoiceExtensionId':_0x4516df[_0x1a1f('0x1e')]});_0x1a7f05['push']({'type':_0x4516df['type'],'app':_0x1a1f('0x16'),'appdata':_0x1a1f('0x37'),'context':_0x4516df[_0x1a1f('0x1d')],'exten':_0x4516df[_0x1a1f('0x9')],'priority':_0x4eaa29['length']+_0x515938[_0x1a1f('0x10')]+_0x16a63e++,'VoiceExtensionId':_0x4516df[_0x1a1f('0x1e')]});}}}for(var _0x560bb9=0x0;_0x560bb9<_0x4eaa29[_0x1a1f('0x31')];_0x560bb9+=0x1){var _0x288a1e=_0x515938[_0x1a1f('0x10')]+_0x4eaa29[_0x1a1f('0x31')];var _0x3645ff=_0x560bb9===_0x4eaa29[_0x1a1f('0x31')]-0x1?_0x515938[_0x1a1f('0x10')]+_0x1a7f05[_0x1a1f('0x31')]+_0x573440['length']+0x2:_0x515938[_0x1a1f('0x10')]+_0x560bb9+0x1;_0x1a7f05['splice'](_0x560bb9,0x0,{'type':_0x4516df[_0x1a1f('0x15')],'app':_0x1a1f('0x38'),'appdata':_0x4eaa29[_0x560bb9]+'?'+_0x4516df[_0x1a1f('0x1d')]+',${EXTEN},'+_0x288a1e+':'+_0x4516df[_0x1a1f('0x1d')]+_0x1a1f('0x39')+_0x3645ff,'exten':_0x4516df[_0x1a1f('0x9')],'context':_0x4516df[_0x1a1f('0x1d')],'priority':_0x515938['priority']+_0x560bb9,'VoiceExtensionId':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1e')]});}_0x4516df['priority']=_0x1a7f05[_0x1a1f('0x31')]?_[_0x1a1f('0x3a')](_0x1a7f05)[_0x1a1f('0x10')]+0x1:_0x515938[_0x1a1f('0x10')];_0x515938[_0x1a1f('0x10')]=(_0x573440[_0x1a1f('0x31')]?_['last'](_0x573440)['priority']:_0x4516df['priority'])+0x1;_0x515938[_0x1a1f('0x11')]=_[_0x1a1f('0x3b')](_0x515938[_0x1a1f('0x11')],_0x1a7f05,[_0x4516df],_0x573440);}_0x515938[_0x1a1f('0x11')][_0x1a1f('0x14')]({'type':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x15')],'app':_0x1a1f('0x3c'),'exten':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x9')],'context':_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1d')],'priority':_0x515938['priority'],'VoiceExtensionId':_0x380c1c[_0x20b40d][0x0]['VoiceExtensionId']});_0x1c6785[_0x1a1f('0x14')](_0x380c1c[_0x20b40d][0x0][_0x1a1f('0x1e')]);_0x38fb10=_[_0x1a1f('0x3b')](_0x38fb10,_0x515938[_0x1a1f('0x11')]);}}return _0x2aac67[_0x1a1f('0x3d')](function(_0x5e85cc){return _0x2aac67['models'][_0x1a1f('0x6')][_0x1a1f('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x1c6785}},'transaction':_0x5e85cc})[_0x1a1f('0x3')](function(_0xdc6a51){return _0x2aac67[_0x1a1f('0x5')][_0x1a1f('0x6')]['bulkCreate'](_[_0x1a1f('0x3f')](_0x38fb10,'priority'),{'transaction':_0x5e85cc});});});})['catch'](function(_0x3aa117){console[_0x1a1f('0x40')](_0x3aa117);});}exports[_0x1a1f('0x41')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 574eaac..0bd3ae0 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 _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x2a9351,_0x5c404){var _0x684ab6=function(_0x36e52a){while(--_0x36e52a){_0x2a9351['push'](_0x2a9351['shift']());}};_0x684ab6(++_0x5c404);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xcb91[_0x15c421];return _0x5e5ed5;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);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(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){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))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['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(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file +var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x1fdae8,_0xe5676){var _0x55e590=function(_0x1f7f53){while(--_0x1f7f53){_0x1fdae8['push'](_0x1fdae8['shift']());}};_0x55e590(++_0xe5676);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);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(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){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))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 52a0327..905bfd4 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 _0x2d17=['start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','ContactItemType','name','writeFileSync','parse','createReadStream','data','rows','find','_description','isNil','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','hasOwnProperty','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactTypeId','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','unlink','exit','complete','argv','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','bluebird','squel','ioredis','../../../config/environment','import','defaults','redis','socket.io-emitter','format','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','CmContactHasItem','findOne','update','updated','create','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','cm_contacts.createdAt\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.createdAt','cm_hopper_additional_phones','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','errors','code','query','spread','catch','main','stringify','send'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0x2d17,0x17e));var _0x72d1=function(_0x505eea,_0x39b482){_0x505eea=_0x505eea-0x0;var _0x5adb10=_0x2d17[_0x505eea];return _0x5adb10;};'use strict';var fs=require('fs');var path=require(_0x72d1('0x0'));var _=require(_0x72d1('0x1'));var Papa=require('papaparse');var util=require(_0x72d1('0x2'));var BPromise=require(_0x72d1('0x3'));var moment=require('moment');var squel=require(_0x72d1('0x4'));var Redis=require(_0x72d1('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x72d1('0x6'));var logger=require('../../../config/logger')(_0x72d1('0x7'));config['redis']=_[_0x72d1('0x8')](config[_0x72d1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x72d1('0xa'))(new Redis(config[_0x72d1('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x72d1('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x215536){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))*$/[_0x72d1('0xc')](_0x215536);}function selectNotIn(_0x283775,_0x593c91,_0x1d7520,_0x3a35c6,_0x45eb4a){return squel[_0x72d1('0xd')]()[_0x72d1('0xe')](_0x72d1('0xf'))[_0x72d1('0x10')](_0x3a35c6)[_0x72d1('0x11')](_0x593c91,null,_0x593c91+_0x72d1('0x12')+_0x3a35c6+'.'+_0x1d7520)[_0x72d1('0x13')](_0x3a35c6+'.'+_0x1d7520+'\x20=\x20'+_0x283775+'.'+_0x1d7520)[_0x72d1('0x13')](_0x593c91+_0x72d1('0x14')+_0x45eb4a[_0x72d1('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x115cd7,_0x22ac6f){promisesAdditionalPhones=[];return db[_0x72d1('0x15')][_0x72d1('0x16')]({'raw':!![],'attributes':['id',_0x72d1('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x72d1('0x18')](function(_0x3f190f){if(_0x3f190f!==null){var _0x21c85e=[];for(var _0x23a238=0x0;_0x23a238<_0x3f190f[_0x72d1('0x19')];_0x23a238++){var _0x491af4=_0x3f190f[_0x23a238];_0x21c85e[_0x72d1('0x1a')](insertAdditionalPhones(_0x491af4));}}Promise['all'](_0x21c85e)[_0x72d1('0x18')](function(){_0x115cd7({'val':0x1});});});});}function insertAdditionalPhones(_0x2c9851){return new Promise(function(_0x59d7b5,_0x1061b7){var _0x1cbb45=_0x2c9851[_0x72d1('0x17')];var _0x49caf4=_0x1cbb45['split'](';');var _0x313d7b=[];orderBy=0x0;for(var _0x10d464=0x0;_0x10d464<_0x49caf4[_0x72d1('0x19')];_0x10d464++){_0x313d7b[_0x72d1('0x1a')](splitAdditionalPhone(_0x2c9851['id'],_0x49caf4[_0x10d464]));}Promise[_0x72d1('0x1b')](_0x313d7b)[_0x72d1('0x18')](function(){_0x59d7b5({'val':_0x49caf4[_0x72d1('0x19')]});});});}function splitAdditionalPhone(_0x5c7982,_0x1c695c){return new Promise(function(_0x56e8d3,_0x506062){var _0x5b85cc=_0x1c695c['split'](':');var _0x445985=_0x5b85cc[0x0];var _0x374602=_0x5b85cc[0x1];if(_0x374602!==''){var _0x573c98=_0x374602[_0x72d1('0x1c')]('|');var _0x256dc1=[];for(var _0x492086=0x0;_0x492086<_0x573c98[_0x72d1('0x19')];_0x492086++){if(_0x573c98[_0x492086]!==''){var _0x26fa35=_['filter'](promisesAdditionalPhones,{'contactId':_0x5c7982,'phone':_0x573c98[_0x492086]});if(_0x26fa35['length']==0x0){orderBy++;promisesAdditionalPhones[_0x72d1('0x1a')]({'contactId':_0x5c7982,'contactTypeId':_0x445985,'phone':_0x573c98[_0x492086],'orderBy':orderBy});}}}_0x56e8d3({'ok':0x1});}else _0x56e8d3({'res':0x0});});}function createAdditionalPhone(_0x36bc65,_0x2f661,_0x2f879f,_0xdf6a69){var _0x33d530='';var _0x163bec='';var _0x589f7c=_0x2f879f['split']('§');_0x33d530=_0x589f7c[0x0];if(_0x589f7c[_0x72d1('0x19')]==0x2)_0x163bec=_0x589f7c[0x1];return new Promise(function(_0x482cb8,_0x18ca85){return db[_0x72d1('0x1d')][_0x72d1('0x1e')]({'where':{'CmContactId':_0x36bc65,'item':_0x33d530}})['then'](function(_0x1c4b21){if(_0x1c4b21){return db['CmContactHasItem'][_0x72d1('0x1f')]({'ItemTypeId':_0x2f661,'description':_0x163bec,'OrderBy':_0xdf6a69},{'where':{'CmContactId':_0x36bc65,'item':_0x33d530}})[_0x72d1('0x18')](function(_0x32588f){_0x482cb8({'res':_0x72d1('0x20')});});}else{return db['CmContactHasItem'][_0x72d1('0x21')]({'CmContactId':_0x36bc65,'item':_0x33d530,'description':_0x163bec,'ItemTypeId':_0x2f661,'OrderBy':_0xdf6a69,'ItemClass':'PHONE'})[_0x72d1('0x18')](function(_0x32dc5e){_0x482cb8({'res':'inserted'});});}});});}function insertCmHopper(_0x14d653,_0x358b0c,_0xf9f890,_0x11ea2f,_0x379c00){var _0x52511f=[_0x72d1('0x22'),_0x72d1('0x23'),_0x72d1('0x24'),'cm_contacts.ListId',_0x358b0c+'.'+_0x11ea2f,_0x72d1('0x25'),_0x72d1('0x26'),'cm_contacts.priority',_0x72d1('0x27'),'\x22'+_0x379c00+'\x22'];return squel[_0x72d1('0x28')]()[_0x72d1('0x29')]('cm_hopper')[_0x72d1('0x2a')](['phone',_0x72d1('0x2b'),_0x72d1('0x2c'),_0x72d1('0x2d'),_0x11ea2f,_0x72d1('0x2e'),_0x72d1('0x2f'),_0x72d1('0x30'),_0x72d1('0x31'),_0x72d1('0x32')],squel[_0x72d1('0xd')]()[_0x72d1('0x33')](_0x52511f)[_0x72d1('0x10')](_0x358b0c)['join'](_0x72d1('0x34'),null,_0x72d1('0x35')+_0x358b0c+_0x72d1('0x36'))[_0x72d1('0x11')](_0xf9f890,null,_0xf9f890+'.id\x20=\x20'+_0x358b0c+'.'+_0x11ea2f)[_0x72d1('0x13')](_0x358b0c+_0x72d1('0x37'),_0x14d653)[_0x72d1('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x72d1('0x13')](_0x72d1('0x38'),selectNotIn(_0x358b0c,_0xf9f890,_0x11ea2f,_0x72d1('0x39'),['\x22always\x22',_0x72d1('0x3a')]))[_0x72d1('0x13')](_0x72d1('0x38'),selectNotIn(_0x358b0c,_0xf9f890,_0x11ea2f,'cm_hopper',[_0x72d1('0x3b')])))[_0x72d1('0x3c')]();}function insertCmHopperBlack(_0x1e083e,_0x14cb3d,_0x44c4f5,_0x785820){var _0xd7ec0f=['cm_contacts.phone',_0x72d1('0x24'),_0x72d1('0x3d'),_0x14cb3d+'.'+_0x785820,_0x72d1('0x25'),_0x72d1('0x26')];return squel[_0x72d1('0x28')]()[_0x72d1('0x29')](_0x72d1('0x3e'))[_0x72d1('0x2a')](['phone',_0x72d1('0x2c'),_0x72d1('0x2d'),_0x785820,_0x72d1('0x2e'),_0x72d1('0x2f')],squel[_0x72d1('0xd')]()[_0x72d1('0x33')](_0xd7ec0f)[_0x72d1('0x10')](_0x14cb3d)[_0x72d1('0x11')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x14cb3d+_0x72d1('0x36'))[_0x72d1('0x11')](_0x44c4f5,null,_0x44c4f5+_0x72d1('0x12')+_0x14cb3d+'.'+_0x785820)[_0x72d1('0x13')](_0x14cb3d+'.CmListId\x20=\x20?',_0x1e083e)[_0x72d1('0x13')](_0x72d1('0x3f'),NOW)['where'](_0x72d1('0x38'),squel['select']()[_0x72d1('0xe')](_0x72d1('0xf'))['from'](_0x72d1('0x3e'))['where']('ListId\x20=\x20?',_0x1e083e)['where'](_0x785820+_0x72d1('0x40'),_0x14cb3d+'.'+_0x785820)))['toString']();}function insertCmHopperAdditionalPhones(_0x42ac27){var _0x1ece64=[_0x72d1('0x41'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0x72d1('0x42'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0x72d1('0x29')](_0x72d1('0x43'))[_0x72d1('0x2a')](['CmHopperId','phone','OrderBy','createdAt',_0x72d1('0x2f')],squel[_0x72d1('0xd')]()[_0x72d1('0x33')](_0x1ece64)[_0x72d1('0x10')](_0x72d1('0x39'))[_0x72d1('0x11')](_0x72d1('0x34'),null,_0x72d1('0x44'))[_0x72d1('0x11')]('cm_contact_has_items',null,_0x72d1('0x45'))[_0x72d1('0x13')](_0x72d1('0x46'),_0x42ac27)['where'](_0x72d1('0x3f'),NOW))[_0x72d1('0x3c')]();}function insertCmContact(_0x12ad75,_0x5d413a,_0x11291a,_0x2b60f0){var _0x343da3=_[_0x72d1('0x47')](_['keys'](_0x2b60f0),['ListId',_0x72d1('0x48'),_0x72d1('0x2e'),_0x72d1('0x2f')]);return squel['insert']()[_0x72d1('0x29')](_0x72d1('0x34'))[_0x72d1('0x2a')](_0x343da3,squel[_0x72d1('0xd')]()[_0x72d1('0x33')](_0x343da3)[_0x72d1('0x10')](_0x5d413a)[_0x72d1('0x13')]('('+_0x11291a[_0x72d1('0x11')](',')+_0x72d1('0x49'),squel[_0x72d1('0xd')]()[_0x72d1('0x33')](_0x11291a)['from'](_0x72d1('0x34'))['where']('ListId\x20=\x20?',_0x12ad75)[_0x72d1('0x13')]('deletedAt\x20IS\x20NULL'))[_0x72d1('0x13')](_0x72d1('0x4a'),squel[_0x72d1('0xd')]()[_0x72d1('0xe')](_0x72d1('0x4b'),_0x72d1('0x4c'))[_0x72d1('0x10')](_0x5d413a)[_0x72d1('0x4d')](_0x11291a[_0x72d1('0x11')](','))))[_0x72d1('0x3c')]();}function handleStop(){logger[_0x72d1('0x4e')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x413bf8){logger[_0x72d1('0x4f')](_0x413bf8[_0x72d1('0x50')]);process['exit'](0x1);}function handleError(_0x53bd97,_0x32f1ea){stats[_0x72d1('0x51')][_0x72d1('0x1a')]({'name':_0x32f1ea[_0x72d1('0x52')],'message':_0x32f1ea[_0x72d1('0x50')],'row':_0x53bd97});}function handleQuery(_0x480b5d){logger[_0x72d1('0x4e')](_0x480b5d);return db['sequelize'][_0x72d1('0x53')](_0x480b5d)[_0x72d1('0x54')](function(_0x20daf0){results[_0x72d1('0x1a')](_0x20daf0);})[_0x72d1('0x55')](function(_0x223321){logger[_0x72d1('0x4f')](_0x223321[_0x72d1('0x50')]);});}function main(_0x384f0a,_0x3a2dfe,_0xc3a6b9,_0x13056c){logger[_0x72d1('0x4e')](_0x72d1('0x56'),_0x384f0a,JSON[_0x72d1('0x57')](_0x3a2dfe));process[_0x72d1('0x58')](_0x72d1('0x59'));var _0x5e63cc=_0x3a2dfe[_0x72d1('0x5a')];var _0x3dceb7=_[_0x72d1('0x5b')](_0x5e63cc);var _0x277b06=_0x3a2dfe[_0x72d1('0x5c')];var _0x3f3718=path['join'](config[_0x72d1('0x5d')],_0x72d1('0x5e'),_0x277b06+_0x72d1('0x5f'));logger['info']('body',_0x3a2dfe);db[_0x72d1('0x60')]['findAll']({'raw':!![],'attributes':['id',_0x72d1('0x61')]})[_0x72d1('0x18')](function(_0x201810){for(var _0x41525c=0x0;_0x41525c<_0x201810[_0x72d1('0x19')];_0x41525c++){if(_0x201810[_0x41525c][_0x72d1('0x61')]in _0x5e63cc){contactItemTypes[_0x72d1('0x1a')](_0x201810[_0x41525c]);delete _0x3dceb7[_0x201810[_0x41525c][_0x72d1('0x61')]];hasAdditionalPhones=!![];}for(var _0x28e42b in _0x5e63cc){if(_0x201810[_0x41525c]['name']+'_description'===_0x28e42b){phoneDescriptions[_0x72d1('0x1a')]({'itemTypeId':_0x201810[_0x41525c]['id'],'description':_0x28e42b});delete _0x3dceb7[_0x28e42b];}}}if(hasAdditionalPhones)_0x3dceb7[_0x72d1('0x17')]='';var _0x1bd80b=_['keys'](_0x3dceb7)[_0x72d1('0x11')]();logger[_0x72d1('0x4e')]('header',_0x1bd80b);fs[_0x72d1('0x62')](_0x3f3718,_0x1bd80b+'\x0a');Papa[_0x72d1('0x63')](fs[_0x72d1('0x64')](_0x384f0a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x46e570,_0x17ac0e){try{for(var _0x34fe3b=0x0,_0x102574=[];_0x34fe3b<_0x46e570[_0x72d1('0x65')][_0x72d1('0x19')];_0x34fe3b++){stats[_0x72d1('0x66')]+=0x1;if(_0x46e570[_0x72d1('0x51')][_0x34fe3b]){handleError(_0x46e570[_0x72d1('0x65')][_0x34fe3b],_0x46e570['errors'][_0x34fe3b]);}else{var _0x55f49f=[];var _0x15e0e0=[];var _0x277d4b={};for(var _0x268194 in _0x5e63cc){let _0x162e33=contactItemTypes[_0x72d1('0x67')](_0x5c5866=>_0x5c5866[_0x72d1('0x61')]===_0x268194);let _0xd69e12=contactItemTypes['find'](_0x837b6b=>_0x837b6b['name']+_0x72d1('0x68')===_0x268194);if(_[_0x72d1('0x69')](_0x162e33)&&_['isNil'](_0xd69e12)){if(_0x5e63cc['hasOwnProperty'](_0x268194)){if(_0x46e570[_0x72d1('0x65')][_0x34fe3b][_0x5e63cc[_0x268194]]){var _0x53e57b=_[_0x72d1('0x6a')](_0x46e570[_0x72d1('0x65')][_0x34fe3b][_0x5e63cc[_0x268194]][_0x72d1('0x6b')](/"/g,'\x27'));switch(_0x268194){case _0x72d1('0x2b'):var _0x27d3be=moment(_0x53e57b,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x27d3be[_0x72d1('0x6c')]()){_0x102574[_0x72d1('0x1a')]('\x22'+_0x53e57b+'\x22');}else{_0x55f49f[_0x72d1('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x72d1('0x30'):var _0x4970ac=parseInt(_0x53e57b);_0x53e57b=_[_0x72d1('0x6d')](_0x4970ac)||_0x4970ac<0x0||_0x4970ac>0x4?_0x13056c?0x3:0x2:_0x4970ac;_0x102574[_0x72d1('0x1a')]('\x22'+_0x53e57b+'\x22');break;case'UserId':var _0x3c0a7e=parseInt(_0x53e57b);if(_[_0x72d1('0x6e')](_0x3c0a7e)&&_['includes'](_0xc3a6b9,_0x3c0a7e)){_0x102574[_0x72d1('0x1a')]('\x22'+_0x3c0a7e+'\x22');}else{_0x55f49f[_0x72d1('0x1a')](_0x72d1('0x6f'));}break;case _0x72d1('0x70'):if(isEmail(_0x53e57b)){_0x102574['push']('\x22'+_0x53e57b+'\x22');}else{_0x55f49f['push']('email\x20wrong\x20format');}break;case _0x72d1('0x71'):var _0x1753e7=moment(_0x53e57b,_0x72d1('0x72'),!![]);if(_0x1753e7[_0x72d1('0x6c')]()){_0x102574[_0x72d1('0x1a')]('\x22'+_0x53e57b+'\x22');}else{_0x55f49f[_0x72d1('0x1a')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x102574['push']('\x22'+_0x53e57b+'\x22');}}else{switch(_0x268194){case _0x72d1('0x73'):case _0x72d1('0xf'):_0x55f49f[_0x72d1('0x1a')](_0x268194+_0x72d1('0x74'));break;default:_0x102574[_0x72d1('0x1a')]('\x22\x22');}}}}else{var _0x422391='';if(!_['isNil'](_0x162e33)){if(!_0x277d4b[_0x72d1('0x75')](_0x162e33['id'])){for(var _0x4511a4=0x0;_0x4511a4<_0x5e63cc[_0x268194][_0x72d1('0x19')];_0x4511a4++){var _0x53e57b=_[_0x72d1('0x6a')](_0x46e570[_0x72d1('0x65')][_0x34fe3b][_0x5e63cc[_0x268194][_0x4511a4]][_0x72d1('0x6b')](/"/g,'\x27'));var _0x3dd2c1=phoneDescriptions[_0x72d1('0x67')](_0x2c68c1=>_0x2c68c1[_0x72d1('0x76')]===_0x162e33['id']);if(!_[_0x72d1('0x69')](_0x3dd2c1)){var _0x4f6135=_[_0x72d1('0x6a')](_0x46e570[_0x72d1('0x65')][_0x34fe3b][_0x5e63cc[_0x3dd2c1[_0x72d1('0x77')]][0x0]][_0x72d1('0x6b')](/"/g,'\x27'));if(!_['isNil'](_0x4f6135))_0x53e57b=_0x53e57b+'§'+_0x4f6135;}if(_0x422391=='')_0x422391=_0x53e57b;else _0x422391+='|'+_0x53e57b;}_0x15e0e0['push'](_0x162e33['id']+':'+_0x422391);_0x277d4b[_0x162e33['id']]=0x1;}}}}if(hasAdditionalPhones){_0x102574[_0x72d1('0x1a')]('\x22'+_0x15e0e0[_0x72d1('0x11')](';')+'\x22');}if(_0x55f49f['length']){handleError(_0x46e570[_0x72d1('0x65')][_0x34fe3b],{'code':_0x72d1('0x78'),'message':_0x55f49f[_0x72d1('0x11')]()});}else{fs[_0x72d1('0x79')](_0x3f3718,_0x102574[_0x72d1('0x11')]()+'\x0a');}_0x102574=[];}if(!(stats[_0x72d1('0x66')]%0xc8)){socket[_0x72d1('0x7a')](_0x72d1('0x7b')+_0x277b06,stats);stats['errors']=[];}}if(stopped){logger[_0x72d1('0x4e')](_0x72d1('0x7c'));_0x17ac0e[_0x72d1('0x7d')]();}}catch(_0x3cbe00){handleError(_0x46e570[_0x72d1('0x65')][_0x34fe3b],{'code':_0x72d1('0x7e'),'message':_0x3cbe00[_0x72d1('0x50')]});logger[_0x72d1('0x4f')]('step',_0x3cbe00[_0x72d1('0x50')]);}},'complete':function(){try{var _0x466634=[];var _0x2b7f20=_0x72d1('0x34');if(_0x3a2dfe[_0x72d1('0x7f')]&&_0x3a2dfe[_0x72d1('0x7f')]['length']){_0x2b7f20=_0x72d1('0x80')+_0x277b06;_0x466634[_0x72d1('0x1a')]('CREATE\x20TABLE\x20'+_0x2b7f20+_0x72d1('0x81'));}logger[_0x72d1('0x4e')](_0x72d1('0x82'),contactItemTypes[_0x72d1('0x19')]);var _0x27c651=util[_0x72d1('0xb')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x3f3718,_0x2b7f20,_0x1bd80b,_0x3a2dfe[_0x72d1('0x2d')],_0x3a2dfe[_0x72d1('0x48')]||null,NOW,NOW);if(_['isNil'](_0x5e63cc['scheduledat'])){_0x27c651+=_0x72d1('0x83');}_0x466634[_0x72d1('0x1a')](_0x27c651);if(_0x3a2dfe[_0x72d1('0x7f')]&&_0x3a2dfe[_0x72d1('0x7f')]['length']){_0x466634[_0x72d1('0x1a')](insertCmContact(_0x3a2dfe[_0x72d1('0x2d')],_0x2b7f20,_0x3a2dfe[_0x72d1('0x7f')],_0x5e63cc));_0x466634[_0x72d1('0x1a')](_0x72d1('0x84')+_0x2b7f20+';');}BPromise[_0x72d1('0x85')](_0x466634,handleQuery)[_0x72d1('0x18')](function(_0x14a215){BPromise['all']([handleAdditionalPhones()])[_0x72d1('0x18')](function(){_0x466634=[];for(var _0x41ee45=0x0;_0x41ee45\x20\x20');}var _0x145230=path['join'](config['root'],'server/files/tmp',process[_0x72d1('0x93')][0x2]);if(!fs[_0x72d1('0x94')](_0x145230)){throw new Error(_0x72d1('0x95'));}var _0x14d48b={};try{_0x14d48b=JSON[_0x72d1('0x63')](process[_0x72d1('0x93')][0x3]);if(!_0x14d48b[_0x72d1('0x5a')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x14d48b['binding'][_0x72d1('0xf')]){throw new Error(_0x72d1('0x96'));}if(!_0x14d48b['binding'][_0x72d1('0x73')]){throw new Error('firstName\x20is\x20mandatory');}var _0x49eebc=0x0;if(_0x14d48b[_0x72d1('0x5a')][_0x72d1('0x31')]){_0x49eebc=0x1;}if(!_0x14d48b[_0x72d1('0x2d')]){throw new Error(_0x72d1('0x97'));}}catch(_0x3ff6bb){throw new Error(_0x72d1('0x98'));}var _0x5071a0=[];try{_0x5071a0=_[_0x72d1('0x99')](JSON[_0x72d1('0x63')](process['argv'][0x4]),'id');}catch(_0x3e1ae0){logger['info'](_0x72d1('0x9a'));}main(_0x145230,_0x14d48b,_0x5071a0,_0x49eebc);}validate();process['on'](_0x72d1('0x9b'),handleStop);process['on'](_0x72d1('0x9c'),handleUncaughtException); \ No newline at end of file +var _0x029b=['cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','fromQuery','ContactId','createdAt','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','errors','code','sequelize','catch','stringify','send','start','binding','clone','server/files/tmp','.csv','body','ContactItemType','name','_description','parse','createReadStream','data','rows','find','isNil','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','priority','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','Abort\x20parser','abort','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','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()','each','contactId','contactTypeId','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','affectedRows','contact:import:','unlink','exit','argv','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','util','bluebird','squel','ioredis','../../../config/logger','import','redis','defaults','socket.io-emitter','format','select','field','phone','from','join','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','length','push','all','then','split','filter','findOne','CmContactHasItem','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','scheduledat','ListId','updatedAt','UserId','recallme','fields'];(function(_0x257a28,_0x2cd00d){var _0x13bccc=function(_0x32c46f){while(--_0x32c46f){_0x257a28['push'](_0x257a28['shift']());}};_0x13bccc(++_0x2cd00d);}(_0x029b,0x66));var _0xb029=function(_0x1a9fbc,_0x5829a8){_0x1a9fbc=_0x1a9fbc-0x0;var _0xf727d9=_0x029b[_0x1a9fbc];return _0xf727d9;};'use strict';var fs=require('fs');var path=require(_0xb029('0x0'));var _=require(_0xb029('0x1'));var Papa=require('papaparse');var util=require(_0xb029('0x2'));var BPromise=require(_0xb029('0x3'));var moment=require('moment');var squel=require(_0xb029('0x4'));var Redis=require(_0xb029('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xb029('0x6'))(_0xb029('0x7'));config[_0xb029('0x8')]=_[_0xb029('0x9')](config[_0xb029('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb029('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()[_0xb029('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2c3772){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'](_0x2c3772);}function selectNotIn(_0x23fee0,_0x4b3036,_0x2696e3,_0x1fcf6e,_0x5a2625){return squel[_0xb029('0xc')]()[_0xb029('0xd')](_0xb029('0xe'))[_0xb029('0xf')](_0x1fcf6e)[_0xb029('0x10')](_0x4b3036,null,_0x4b3036+'.id\x20=\x20'+_0x1fcf6e+'.'+_0x2696e3)[_0xb029('0x11')](_0x1fcf6e+'.'+_0x2696e3+'\x20=\x20'+_0x23fee0+'.'+_0x2696e3)[_0xb029('0x11')](_0x4b3036+_0xb029('0x12')+_0x5a2625[_0xb029('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x8dfbf1,_0x5ce391){promisesAdditionalPhones=[];return db[_0xb029('0x13')][_0xb029('0x14')]({'raw':!![],'attributes':['id',_0xb029('0x15')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x5617c){if(_0x5617c!==null){var _0x3afa2b=[];for(var _0x379fdb=0x0;_0x379fdb<_0x5617c[_0xb029('0x16')];_0x379fdb++){var _0x138573=_0x5617c[_0x379fdb];_0x3afa2b[_0xb029('0x17')](insertAdditionalPhones(_0x138573));}}Promise[_0xb029('0x18')](_0x3afa2b)[_0xb029('0x19')](function(){_0x8dfbf1({'val':0x1});});});});}function insertAdditionalPhones(_0x3f91cb){return new Promise(function(_0x4b205e,_0x58fbe7){var _0xa79ca=_0x3f91cb['AdditionalPhones'];var _0xe41f46=_0xa79ca[_0xb029('0x1a')](';');var _0x230fe6=[];orderBy=0x0;for(var _0x497ca0=0x0;_0x497ca0<_0xe41f46['length'];_0x497ca0++){_0x230fe6[_0xb029('0x17')](splitAdditionalPhone(_0x3f91cb['id'],_0xe41f46[_0x497ca0]));}Promise[_0xb029('0x18')](_0x230fe6)[_0xb029('0x19')](function(){_0x4b205e({'val':_0xe41f46[_0xb029('0x16')]});});});}function splitAdditionalPhone(_0x3c4396,_0xad23b2){return new Promise(function(_0x530486,_0x5c7db9){var _0x4c8cae=_0xad23b2['split'](':');var _0x3e1dc4=_0x4c8cae[0x0];var _0x1e16a3=_0x4c8cae[0x1];if(_0x1e16a3!==''){var _0x41e0c0=_0x1e16a3[_0xb029('0x1a')]('|');var _0x500bb6=[];for(var _0x3642b5=0x0;_0x3642b5<_0x41e0c0[_0xb029('0x16')];_0x3642b5++){if(_0x41e0c0[_0x3642b5]!==''){var _0x42b91e=_[_0xb029('0x1b')](promisesAdditionalPhones,{'contactId':_0x3c4396,'phone':_0x41e0c0[_0x3642b5]});if(_0x42b91e[_0xb029('0x16')]==0x0){orderBy++;promisesAdditionalPhones[_0xb029('0x17')]({'contactId':_0x3c4396,'contactTypeId':_0x3e1dc4,'phone':_0x41e0c0[_0x3642b5],'orderBy':orderBy});}}}_0x530486({'ok':0x1});}else _0x530486({'res':0x0});});}function createAdditionalPhone(_0x405ec6,_0x3eb5ac,_0x147ad0,_0x3671e6){var _0xd9206b='';var _0x22dccd='';var _0x279e4a=_0x147ad0['split']('§');_0xd9206b=_0x279e4a[0x0];if(_0x279e4a[_0xb029('0x16')]==0x2)_0x22dccd=_0x279e4a[0x1];return new Promise(function(_0x2eb298,_0x47f874){return db['CmContactHasItem'][_0xb029('0x1c')]({'where':{'CmContactId':_0x405ec6,'item':_0xd9206b}})[_0xb029('0x19')](function(_0x334ce6){if(_0x334ce6){return db[_0xb029('0x1d')][_0xb029('0x1e')]({'ItemTypeId':_0x3eb5ac,'description':_0x22dccd,'OrderBy':_0x3671e6},{'where':{'CmContactId':_0x405ec6,'item':_0xd9206b}})['then'](function(_0x605a61){_0x2eb298({'res':'updated'});});}else{return db[_0xb029('0x1d')][_0xb029('0x1f')]({'CmContactId':_0x405ec6,'item':_0xd9206b,'description':_0x22dccd,'ItemTypeId':_0x3eb5ac,'OrderBy':_0x3671e6,'ItemClass':_0xb029('0x20')})['then'](function(_0x1aa94b){_0x2eb298({'res':_0xb029('0x21')});});}});});}function insertCmHopper(_0x59bf9d,_0x236217,_0x4d9e7e,_0x1ee866,_0x5be69c){var _0x88a69b=[_0xb029('0x22'),_0xb029('0x23'),_0xb029('0x24'),_0xb029('0x25'),_0x236217+'.'+_0x1ee866,_0xb029('0x26'),_0xb029('0x27'),_0xb029('0x28'),'cm_contacts.UserId','\x22'+_0x5be69c+'\x22'];return squel[_0xb029('0x29')]()[_0xb029('0x2a')](_0xb029('0x2b'))['fromQuery']([_0xb029('0xe'),_0xb029('0x2c'),'ContactId',_0xb029('0x2d'),_0x1ee866,'createdAt',_0xb029('0x2e'),'priority',_0xb029('0x2f'),_0xb029('0x30')],squel[_0xb029('0xc')]()[_0xb029('0x31')](_0x88a69b)[_0xb029('0xf')](_0x236217)[_0xb029('0x10')](_0xb029('0x32'),null,'cm_contacts.ListId\x20=\x20'+_0x236217+_0xb029('0x33'))[_0xb029('0x10')](_0x4d9e7e,null,_0x4d9e7e+'.id\x20=\x20'+_0x236217+'.'+_0x1ee866)[_0xb029('0x11')](_0x236217+_0xb029('0x34'),_0x59bf9d)[_0xb029('0x11')](_0xb029('0x35'),NOW)['where'](_0xb029('0x36'),selectNotIn(_0x236217,_0x4d9e7e,_0x1ee866,_0xb029('0x2b'),[_0xb029('0x37'),'\x22onlyIfOpen\x22']))[_0xb029('0x11')](_0xb029('0x36'),selectNotIn(_0x236217,_0x4d9e7e,_0x1ee866,_0xb029('0x2b'),[_0xb029('0x37')])))[_0xb029('0x38')]();}function insertCmHopperBlack(_0x3be751,_0x2328b0,_0x30cb15,_0x3f42ef){var _0x1392af=['cm_contacts.phone',_0xb029('0x24'),_0xb029('0x25'),_0x2328b0+'.'+_0x3f42ef,_0xb029('0x26'),'cm_contacts.updatedAt'];return squel['insert']()['into'](_0xb029('0x39'))[_0xb029('0x3a')](['phone',_0xb029('0x3b'),_0xb029('0x2d'),_0x3f42ef,_0xb029('0x3c'),_0xb029('0x2e')],squel[_0xb029('0xc')]()['fields'](_0x1392af)[_0xb029('0xf')](_0x2328b0)[_0xb029('0x10')]('cm_contacts',null,_0xb029('0x3d')+_0x2328b0+_0xb029('0x33'))[_0xb029('0x10')](_0x30cb15,null,_0x30cb15+'.id\x20=\x20'+_0x2328b0+'.'+_0x3f42ef)[_0xb029('0x11')](_0x2328b0+_0xb029('0x34'),_0x3be751)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb029('0x11')](_0xb029('0x36'),squel[_0xb029('0xc')]()[_0xb029('0xd')]('phone')['from'](_0xb029('0x39'))['where'](_0xb029('0x3e'),_0x3be751)['where'](_0x3f42ef+_0xb029('0x3f'),_0x2328b0+'.'+_0x3f42ef)))[_0xb029('0x38')]();}function insertCmHopperAdditionalPhones(_0x9f770a){var _0x1ee0d0=[_0xb029('0x40'),_0xb029('0x41'),'cm_contact_has_items.OrderBy',_0xb029('0x42'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0xb029('0x2a')]('cm_hopper_additional_phones')[_0xb029('0x3a')](['CmHopperId',_0xb029('0xe'),_0xb029('0x43'),_0xb029('0x3c'),_0xb029('0x2e')],squel['select']()[_0xb029('0x31')](_0x1ee0d0)[_0xb029('0xf')](_0xb029('0x2b'))[_0xb029('0x10')](_0xb029('0x32'),null,_0xb029('0x44'))[_0xb029('0x10')](_0xb029('0x45'),null,_0xb029('0x46'))[_0xb029('0x11')]('cm_hopper.ListId\x20=\x20?',_0x9f770a)[_0xb029('0x11')](_0xb029('0x35'),NOW))[_0xb029('0x38')]();}function insertCmContact(_0x3172a2,_0x4845ab,_0x30800e,_0x59acea){var _0x5f6e93=_[_0xb029('0x47')](_[_0xb029('0x48')](_0x59acea),[_0xb029('0x2d'),_0xb029('0x49'),'createdAt','updatedAt']);return squel[_0xb029('0x29')]()[_0xb029('0x2a')](_0xb029('0x32'))[_0xb029('0x3a')](_0x5f6e93,squel[_0xb029('0xc')]()[_0xb029('0x31')](_0x5f6e93)['from'](_0x4845ab)[_0xb029('0x11')]('('+_0x30800e[_0xb029('0x10')](',')+_0xb029('0x4a'),squel['select']()['fields'](_0x30800e)[_0xb029('0xf')]('cm_contacts')[_0xb029('0x11')](_0xb029('0x3e'),_0x3172a2)[_0xb029('0x11')]('deletedAt\x20IS\x20NULL'))[_0xb029('0x11')](_0xb029('0x4b'),squel['select']()[_0xb029('0xd')](_0xb029('0x4c'),_0xb029('0x4d'))['from'](_0x4845ab)[_0xb029('0x4e')](_0x30800e[_0xb029('0x10')](','))))[_0xb029('0x38')]();}function handleStop(){logger[_0xb029('0x4f')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3cbbfe){logger[_0xb029('0x50')](_0x3cbbfe[_0xb029('0x51')]);process['exit'](0x1);}function handleError(_0x1b7502,_0x49a768){stats[_0xb029('0x52')][_0xb029('0x17')]({'name':_0x49a768[_0xb029('0x53')],'message':_0x49a768[_0xb029('0x51')],'row':_0x1b7502});}function handleQuery(_0x34ccda){logger[_0xb029('0x4f')](_0x34ccda);return db[_0xb029('0x54')]['query'](_0x34ccda)['spread'](function(_0x59ef04){results[_0xb029('0x17')](_0x59ef04);})[_0xb029('0x55')](function(_0x4140fd){logger[_0xb029('0x50')](_0x4140fd[_0xb029('0x51')]);});}function main(_0x48e07b,_0x208878,_0x894515,_0x10b3c6){logger[_0xb029('0x4f')]('main',_0x48e07b,JSON[_0xb029('0x56')](_0x208878));process[_0xb029('0x57')](_0xb029('0x58'));var _0x44f34c=_0x208878[_0xb029('0x59')];var _0xa6836e=_[_0xb029('0x5a')](_0x44f34c);var _0x2e6191=_0x208878['socket_timestamp'];var _0x2e7122=path[_0xb029('0x10')](config['root'],_0xb029('0x5b'),_0x2e6191+_0xb029('0x5c'));logger[_0xb029('0x4f')](_0xb029('0x5d'),_0x208878);db[_0xb029('0x5e')][_0xb029('0x14')]({'raw':!![],'attributes':['id',_0xb029('0x5f')]})[_0xb029('0x19')](function(_0x5b9c07){for(var _0x2a0c04=0x0;_0x2a0c04<_0x5b9c07['length'];_0x2a0c04++){if(_0x5b9c07[_0x2a0c04][_0xb029('0x5f')]in _0x44f34c){contactItemTypes[_0xb029('0x17')](_0x5b9c07[_0x2a0c04]);delete _0xa6836e[_0x5b9c07[_0x2a0c04][_0xb029('0x5f')]];hasAdditionalPhones=!![];}for(var _0x495ab7 in _0x44f34c){if(_0x5b9c07[_0x2a0c04][_0xb029('0x5f')]+_0xb029('0x60')===_0x495ab7){phoneDescriptions['push']({'itemTypeId':_0x5b9c07[_0x2a0c04]['id'],'description':_0x495ab7});delete _0xa6836e[_0x495ab7];}}}if(hasAdditionalPhones)_0xa6836e['AdditionalPhones']='';var _0x5792a1=_[_0xb029('0x48')](_0xa6836e)['join']();logger[_0xb029('0x4f')]('header',_0x5792a1);fs['writeFileSync'](_0x2e7122,_0x5792a1+'\x0a');Papa[_0xb029('0x61')](fs[_0xb029('0x62')](_0x48e07b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x24769e,_0x28ee6a){try{for(var _0x8b3c36=0x0,_0x3b8bcb=[];_0x8b3c36<_0x24769e[_0xb029('0x63')]['length'];_0x8b3c36++){stats[_0xb029('0x64')]+=0x1;if(_0x24769e[_0xb029('0x52')][_0x8b3c36]){handleError(_0x24769e['data'][_0x8b3c36],_0x24769e[_0xb029('0x52')][_0x8b3c36]);}else{var _0x46dfda=[];var _0x214715=[];var _0x4c53f9={};for(var _0x365831 in _0x44f34c){let _0x24f413=contactItemTypes['find'](_0x769d8=>_0x769d8[_0xb029('0x5f')]===_0x365831);let _0x4da56f=contactItemTypes[_0xb029('0x65')](_0x16f093=>_0x16f093[_0xb029('0x5f')]+_0xb029('0x60')===_0x365831);if(_[_0xb029('0x66')](_0x24f413)&&_['isNil'](_0x4da56f)){if(_0x44f34c[_0xb029('0x67')](_0x365831)){if(_0x24769e['data'][_0x8b3c36][_0x44f34c[_0x365831]]){var _0x133e8c=_[_0xb029('0x68')](_0x24769e[_0xb029('0x63')][_0x8b3c36][_0x44f34c[_0x365831]][_0xb029('0x69')](/"/g,'\x27'));switch(_0x365831){case'scheduledat':var _0x44c05f=moment(_0x133e8c,_0xb029('0x6a'),!![]);if(_0x44c05f['isValid']()){_0x3b8bcb['push']('\x22'+_0x133e8c+'\x22');}else{_0x46dfda[_0xb029('0x17')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb029('0x6b'):var _0x4bf4a4=parseInt(_0x133e8c);_0x133e8c=_['isNaN'](_0x4bf4a4)||_0x4bf4a4<0x0||_0x4bf4a4>0x4?_0x10b3c6?0x3:0x2:_0x4bf4a4;_0x3b8bcb[_0xb029('0x17')]('\x22'+_0x133e8c+'\x22');break;case'UserId':var _0x28389a=parseInt(_0x133e8c);if(_[_0xb029('0x6c')](_0x28389a)&&_[_0xb029('0x6d')](_0x894515,_0x28389a)){_0x3b8bcb[_0xb029('0x17')]('\x22'+_0x28389a+'\x22');}else{_0x46dfda[_0xb029('0x17')](_0xb029('0x6e'));}break;case _0xb029('0x6f'):if(isEmail(_0x133e8c)){_0x3b8bcb[_0xb029('0x17')]('\x22'+_0x133e8c+'\x22');}else{_0x46dfda[_0xb029('0x17')]('email\x20wrong\x20format');}break;case _0xb029('0x70'):var _0x39fc55=moment(_0x133e8c,_0xb029('0x71'),!![]);if(_0x39fc55[_0xb029('0x72')]()){_0x3b8bcb[_0xb029('0x17')]('\x22'+_0x133e8c+'\x22');}else{_0x46dfda[_0xb029('0x17')](_0xb029('0x73'));}break;default:_0x3b8bcb[_0xb029('0x17')]('\x22'+_0x133e8c+'\x22');}}else{switch(_0x365831){case _0xb029('0x74'):case'phone':_0x46dfda[_0xb029('0x17')](_0x365831+_0xb029('0x75'));break;default:_0x3b8bcb[_0xb029('0x17')]('\x22\x22');}}}}else{var _0x58e738='';if(!_[_0xb029('0x66')](_0x24f413)){if(!_0x4c53f9[_0xb029('0x67')](_0x24f413['id'])){for(var _0x14a0f3=0x0;_0x14a0f3<_0x44f34c[_0x365831][_0xb029('0x16')];_0x14a0f3++){var _0x133e8c=_[_0xb029('0x68')](_0x24769e[_0xb029('0x63')][_0x8b3c36][_0x44f34c[_0x365831][_0x14a0f3]]['replace'](/"/g,'\x27'));var _0x600a05=phoneDescriptions['find'](_0x2dc610=>_0x2dc610[_0xb029('0x76')]===_0x24f413['id']);if(!_['isNil'](_0x600a05)){var _0x212262=_['trim'](_0x24769e['data'][_0x8b3c36][_0x44f34c[_0x600a05[_0xb029('0x77')]][0x0]][_0xb029('0x69')](/"/g,'\x27'));if(!_[_0xb029('0x66')](_0x212262))_0x133e8c=_0x133e8c+'§'+_0x212262;}if(_0x58e738=='')_0x58e738=_0x133e8c;else _0x58e738+='|'+_0x133e8c;}_0x214715[_0xb029('0x17')](_0x24f413['id']+':'+_0x58e738);_0x4c53f9[_0x24f413['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3b8bcb['push']('\x22'+_0x214715['join'](';')+'\x22');}if(_0x46dfda[_0xb029('0x16')]){handleError(_0x24769e['data'][_0x8b3c36],{'code':_0xb029('0x78'),'message':_0x46dfda[_0xb029('0x10')]()});}else{fs[_0xb029('0x79')](_0x2e7122,_0x3b8bcb[_0xb029('0x10')]()+'\x0a');}_0x3b8bcb=[];}if(!(stats['rows']%0xc8)){socket[_0xb029('0x7a')]('contact:import:'+_0x2e6191,stats);stats['errors']=[];}}if(stopped){logger[_0xb029('0x4f')](_0xb029('0x7b'));_0x28ee6a[_0xb029('0x7c')]();}}catch(_0x197e3a){handleError(_0x24769e['data'][_0x8b3c36],{'code':'SystemError','message':_0x197e3a[_0xb029('0x51')]});logger[_0xb029('0x50')](_0xb029('0x7d'),_0x197e3a[_0xb029('0x51')]);}},'complete':function(){try{var _0x3d9ed2=[];var _0x4969af=_0xb029('0x32');if(_0x208878[_0xb029('0x7e')]&&_0x208878['duplicates'][_0xb029('0x16')]){_0x4969af=_0xb029('0x7f')+_0x2e6191;_0x3d9ed2[_0xb029('0x17')]('CREATE\x20TABLE\x20'+_0x4969af+_0xb029('0x80'));}logger[_0xb029('0x4f')]('CIS\x20len',contactItemTypes[_0xb029('0x16')]);var _0x27f030=util[_0xb029('0xb')](_0xb029('0x81'),_0x2e7122,_0x4969af,_0x5792a1,_0x208878[_0xb029('0x2d')],_0x208878[_0xb029('0x49')]||null,NOW,NOW);if(_['isNil'](_0x44f34c['scheduledat'])){_0x27f030+=_0xb029('0x82');}_0x3d9ed2[_0xb029('0x17')](_0x27f030);if(_0x208878[_0xb029('0x7e')]&&_0x208878[_0xb029('0x7e')]['length']){_0x3d9ed2[_0xb029('0x17')](insertCmContact(_0x208878[_0xb029('0x2d')],_0x4969af,_0x208878[_0xb029('0x7e')],_0x44f34c));_0x3d9ed2[_0xb029('0x17')]('DROP\x20TABLE\x20'+_0x4969af+';');}BPromise[_0xb029('0x83')](_0x3d9ed2,handleQuery)[_0xb029('0x19')](function(_0xa17af9){BPromise['all']([handleAdditionalPhones()])[_0xb029('0x19')](function(){_0x3d9ed2=[];for(var _0x3d1ea5=0x0;_0x3d1ea5\x20\x20');}var _0x5c426d=path[_0xb029('0x10')](config['root'],_0xb029('0x5b'),process[_0xb029('0x8f')][0x2]);if(!fs[_0xb029('0x90')](_0x5c426d)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x204ad3={};try{_0x204ad3=JSON[_0xb029('0x61')](process['argv'][0x3]);if(!_0x204ad3[_0xb029('0x59')]){throw new Error(_0xb029('0x91'));}if(!_0x204ad3[_0xb029('0x59')][_0xb029('0xe')]){throw new Error(_0xb029('0x92'));}if(!_0x204ad3['binding'][_0xb029('0x74')]){throw new Error(_0xb029('0x93'));}var _0x27f2a1=0x0;if(_0x204ad3[_0xb029('0x59')][_0xb029('0x2f')]){_0x27f2a1=0x1;}if(!_0x204ad3[_0xb029('0x2d')]){throw new Error(_0xb029('0x94'));}}catch(_0x4b9c0a){throw new Error(_0xb029('0x95'));}var _0x1809be=[];try{_0x1809be=_['map'](JSON[_0xb029('0x61')](process[_0xb029('0x8f')][0x4]),'id');}catch(_0x25238e){logger[_0xb029('0x4f')](_0xb029('0x96'));}main(_0x5c426d,_0x204ad3,_0x1809be,_0x27f2a1);}validate();process['on'](_0xb029('0x97'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index da60c86..1483c50 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','query','select\x20*\x20from\x20','length','AdditionalPhones','push','then','catch','error','message','split','all','filter','CmContactHasItem','findOne','update','updated','PHONE','inserted','CmContact','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','insert','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','into','fromQuery','.CmListId','cm_hopper_black','\x20=\x20?','toString','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','exit','errors','info','spread','main','start','clone','socket_timestamp','root','server/files/tmp','.csv','body','findAll','name','header','parse','createReadStream','rows','data','find','_description','isNil','hasOwnProperty','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','\x20not\x20specified','trim','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','\x20LIKE\x20cm_contacts;','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','each','contactId','orderBy','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available'];(function(_0xd8bf45,_0x54fb05){var _0x36eba1=function(_0x1745da){while(--_0x1745da){_0xd8bf45['push'](_0xd8bf45['shift']());}};_0x36eba1(++_0x54fb05);}(_0xe706,0xa3));var _0x6e70=function(_0x3e4d9a,_0x449a9f){_0x3e4d9a=_0x3e4d9a-0x0;var _0x4124d3=_0xe706[_0x3e4d9a];return _0x4124d3;};'use strict';var fs=require('fs');var path=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var Papa=require(_0x6e70('0x2'));var util=require('util');var BPromise=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var squel=require(_0x6e70('0x5'));var Redis=require(_0x6e70('0x6'));var db=require(_0x6e70('0x7'))['db'];var config=require(_0x6e70('0x8'));var logger=require(_0x6e70('0x9'))(_0x6e70('0xa'));config[_0x6e70('0xb')]=_[_0x6e70('0xc')](config[_0x6e70('0xb')],{'host':_0x6e70('0xd'),'port':0x18eb});var socket=require(_0x6e70('0xe'))(new Redis(config[_0x6e70('0xb')]));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()[_0x6e70('0xf')](_0x6e70('0x10'));var tempTableName=_0x6e70('0x11')+moment()[_0x6e70('0xf')](_0x6e70('0x12'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x463853){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))*$/[_0x6e70('0x13')](_0x463853);}function selectNotIn(_0x3f474a,_0x37b3e0,_0x4600f9,_0x5b3d07,_0x47f6b2){return squel[_0x6e70('0x14')]()[_0x6e70('0x15')](_0x6e70('0x16'))[_0x6e70('0x17')](_0x5b3d07)[_0x6e70('0x18')](_0x37b3e0,null,_0x37b3e0+_0x6e70('0x19')+_0x5b3d07+'.'+_0x4600f9)[_0x6e70('0x1a')](_0x5b3d07+'.'+_0x4600f9+_0x6e70('0x1b')+_0x3f474a+'.'+_0x4600f9)['where'](_0x37b3e0+'.dialCheckDuplicateType\x20IN\x20('+_0x47f6b2['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x257e81,_0x5a37a6){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x6e70('0x1c')](_0x6e70('0x1d')+tempTableName)['spread'](function(_0x24f3ac){if(_0x24f3ac!==null){var _0x5c3fe7=[];for(var _0x2efc0f=0x0;_0x2efc0f<_0x24f3ac[_0x6e70('0x1e')];_0x2efc0f++){var _0x4ca554=_0x24f3ac[_0x2efc0f];if(!_['isNil'](_0x4ca554[_0x6e70('0x16')])){if(!_['isNil'](_0x4ca554[_0x6e70('0x1f')]))_0x5c3fe7[_0x6e70('0x20')](insertAdditionalPhones(_0x4ca554));promisesContact['push']({'contact':_0x4ca554});}}}Promise['all'](_0x5c3fe7)[_0x6e70('0x21')](function(){_0x257e81({'val':0x1});});})[_0x6e70('0x22')](function(_0x2368eb){logger[_0x6e70('0x23')](_0x2368eb[_0x6e70('0x24')]);});});}function insertAdditionalPhones(_0xcdf9f2){return new Promise(function(_0x1b2453,_0x44a49f){var _0x29326f=_0xcdf9f2[_0x6e70('0x1f')];if(_['isNil'](_0x29326f))_0x44a49f({'val':0x0});else{var _0x228350=_0x29326f[_0x6e70('0x25')](';');var _0x27b294=[];orderBy=0x0;for(var _0x502b2d=0x0;_0x502b2d<_0x228350[_0x6e70('0x1e')];_0x502b2d++){_0x27b294[_0x6e70('0x20')](splitAdditionalPhone(_0xcdf9f2['id'],_0x228350[_0x502b2d]));}Promise[_0x6e70('0x26')](_0x27b294)['then'](function(){_0x1b2453({'val':_0x228350[_0x6e70('0x1e')]});});}});}function splitAdditionalPhone(_0x538b9c,_0x50aec2){return new Promise(function(_0x4e97c7,_0x41e352){var _0x19c5ae=_0x50aec2['split'](':');var _0x3ecdf1=_0x19c5ae[0x0];var _0x1196ed=_0x19c5ae[0x1];if(_0x1196ed!==''){var _0x5f268f=_0x1196ed[_0x6e70('0x25')]('|');var _0x67fb43=[];for(var _0x2bb231=0x0;_0x2bb231<_0x5f268f['length'];_0x2bb231++){if(_0x5f268f[_0x2bb231]!==''){var _0x54a5fe=_[_0x6e70('0x27')](promisesAdditionalPhones,{'contactId':_0x538b9c,'phone':_0x5f268f[_0x2bb231]});if(_0x54a5fe[_0x6e70('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x6e70('0x20')]({'contactId':_0x538b9c,'contactTypeId':_0x3ecdf1,'phone':_0x5f268f[_0x2bb231],'orderBy':orderBy});}}}_0x4e97c7({'ok':0x1});}else _0x4e97c7({'res':0x0});});}function createAdditionalPhone(_0x114344,_0x43fee0,_0x5d772a,_0x1952ea){var _0x406f29='';var _0xecf336='';var _0x2864a0=_0x5d772a[_0x6e70('0x25')]('§');_0x406f29=_0x2864a0[0x0];if(_0x2864a0[_0x6e70('0x1e')]==0x2)_0xecf336=_0x2864a0[0x1];return new Promise(function(_0x3f78d2,_0x24114a){return db[_0x6e70('0x28')][_0x6e70('0x29')]({'where':{'CmContactId':_0x114344,'item':_0x406f29}})['then'](function(_0x1b27d8){if(_0x1b27d8){return db['CmContactHasItem'][_0x6e70('0x2a')]({'ItemTypeId':_0x43fee0,'description':_0xecf336,'OrderBy':_0x1952ea},{'where':{'CmContactId':_0x114344,'item':_0x406f29}})['then'](function(_0xdd7cc1){_0x3f78d2({'res':_0x6e70('0x2b')});});}else{return db[_0x6e70('0x28')]['create']({'CmContactId':_0x114344,'item':_0x406f29,'ItemTypeId':_0x43fee0,'description':_0xecf336,'OrderBy':_0x1952ea,'ItemClass':_0x6e70('0x2c')})[_0x6e70('0x21')](function(_0x5780a1){_0x3f78d2({'res':_0x6e70('0x2d')});});}});});}function updateContact(_0x154925){return new Promise(function(_0x52b457,_0x10d8f6){var _0x3665a1=_0x154925['id'];delete _0x154925['id'];return db[_0x6e70('0x2e')][_0x6e70('0x2a')](_0x154925,{'where':{'id':_0x3665a1}})[_0x6e70('0x21')](function(_0x1e3e76){updatedRows+=0x1;return db[_0x6e70('0x2f')][_0x6e70('0x2a')]({'phone':_0x154925[_0x6e70('0x16')]},{'where':{'ContactId':_0x3665a1}})[_0x6e70('0x21')](function(_0x4d32d8){_0x52b457({'ret':'OK'});});});});}function insertCmHopper(_0x3b9c06,_0x4795a0,_0x23cd1a,_0x3222a2,_0x98c683){var _0x32d12d=[_0x6e70('0x30'),_0x6e70('0x31'),_0x6e70('0x32'),_0x6e70('0x33'),_0x4795a0+'.'+_0x3222a2,_0x6e70('0x34'),_0x6e70('0x35'),_0x6e70('0x36'),_0x6e70('0x37'),'\x22'+_0x98c683+'\x22'];return squel[_0x6e70('0x38')]()['into']('cm_hopper')['fromQuery']([_0x6e70('0x16'),_0x6e70('0x39'),_0x6e70('0x3a'),_0x6e70('0x3b'),_0x3222a2,_0x6e70('0x3c'),_0x6e70('0x3d'),'priority',_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x14')]()[_0x6e70('0x40')](_0x32d12d)[_0x6e70('0x17')](_0x4795a0)[_0x6e70('0x18')](_0x6e70('0x41'),null,_0x6e70('0x42')+_0x4795a0+'.CmListId')[_0x6e70('0x18')](_0x23cd1a,null,_0x23cd1a+_0x6e70('0x19')+_0x4795a0+'.'+_0x3222a2)[_0x6e70('0x1a')](_0x4795a0+_0x6e70('0x43'),_0x3b9c06)[_0x6e70('0x1a')](_0x6e70('0x44'),NOW)[_0x6e70('0x1a')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4795a0,_0x23cd1a,_0x3222a2,'cm_hopper',['\x22always\x22',_0x6e70('0x45')]))[_0x6e70('0x1a')](_0x6e70('0x46'),selectNotIn(_0x4795a0,_0x23cd1a,_0x3222a2,_0x6e70('0x47'),[_0x6e70('0x48')])))['toString']();}function insertCmHopperBlack(_0x225d44,_0x2a58d7,_0x2a2aca,_0x52b197){var _0x544ad0=['cm_contacts.phone',_0x6e70('0x32'),'cm_contacts.ListId',_0x2a58d7+'.'+_0x52b197,_0x6e70('0x34'),_0x6e70('0x35')];return squel[_0x6e70('0x38')]()[_0x6e70('0x49')]('cm_hopper_black')[_0x6e70('0x4a')](['phone',_0x6e70('0x3a'),_0x6e70('0x3b'),_0x52b197,_0x6e70('0x3c'),_0x6e70('0x3d')],squel['select']()[_0x6e70('0x40')](_0x544ad0)[_0x6e70('0x17')](_0x2a58d7)[_0x6e70('0x18')](_0x6e70('0x41'),null,_0x6e70('0x42')+_0x2a58d7+_0x6e70('0x4b'))[_0x6e70('0x18')](_0x2a2aca,null,_0x2a2aca+'.id\x20=\x20'+_0x2a58d7+'.'+_0x52b197)[_0x6e70('0x1a')](_0x2a58d7+_0x6e70('0x43'),_0x225d44)[_0x6e70('0x1a')](_0x6e70('0x44'),NOW)[_0x6e70('0x1a')](_0x6e70('0x46'),squel[_0x6e70('0x14')]()['field'](_0x6e70('0x16'))['from'](_0x6e70('0x4c'))[_0x6e70('0x1a')]('ListId\x20=\x20?',_0x225d44)['where'](_0x52b197+_0x6e70('0x4d'),_0x2a58d7+'.'+_0x52b197)))[_0x6e70('0x4e')]();}function insertCmHopperAdditionalPhones(_0x18fa40){var _0x587f04=['cm_hopper.id',_0x6e70('0x4f'),_0x6e70('0x50'),_0x6e70('0x51'),_0x6e70('0x52')];return squel[_0x6e70('0x38')]()[_0x6e70('0x49')]('cm_hopper_additional_phones')[_0x6e70('0x4a')]([_0x6e70('0x53'),_0x6e70('0x16'),_0x6e70('0x54'),_0x6e70('0x3c'),'updatedAt'],squel['select']()[_0x6e70('0x40')](_0x587f04)[_0x6e70('0x17')](_0x6e70('0x47'))[_0x6e70('0x18')](_0x6e70('0x41'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x6e70('0x18')](_0x6e70('0x55'),null,_0x6e70('0x56'))[_0x6e70('0x1a')](_0x6e70('0x57'),_0x18fa40)['where'](_0x6e70('0x44'),NOW))[_0x6e70('0x4e')]();}function insertCmContact(_0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d){var _0x5d2e29=_[_0x6e70('0x58')](_[_0x6e70('0x59')](_0x3fd03d),['ListId',_0x6e70('0x5a'),_0x6e70('0x3c'),'updatedAt']);return squel[_0x6e70('0x38')]()[_0x6e70('0x49')](_0x6e70('0x41'))[_0x6e70('0x4a')](_0x5d2e29,squel[_0x6e70('0x14')]()['fields'](_0x5d2e29)[_0x6e70('0x17')](_0x3fb0d3)[_0x6e70('0x1a')]('('+_0x8ef4f7[_0x6e70('0x18')](',')+_0x6e70('0x5b'),squel[_0x6e70('0x14')]()[_0x6e70('0x40')](_0x8ef4f7)[_0x6e70('0x17')](_0x6e70('0x41'))[_0x6e70('0x1a')](_0x6e70('0x5c'),_0x2c20d3))[_0x6e70('0x1a')](_0x6e70('0x5d'),squel[_0x6e70('0x14')]()[_0x6e70('0x15')](_0x6e70('0x5e'),_0x6e70('0x5f'))[_0x6e70('0x17')](_0x3fb0d3)[_0x6e70('0x60')](_0x8ef4f7[_0x6e70('0x18')](','))))[_0x6e70('0x4e')]();}function handleStop(){logger['info'](_0x6e70('0x61'));stopped=!![];}function handleUncaughtException(_0x4434dd){logger[_0x6e70('0x23')](_0x4434dd[_0x6e70('0x24')]);process[_0x6e70('0x62')](0x1);}function handleError(_0x3880dd,_0x5b4d5d){stats[_0x6e70('0x63')][_0x6e70('0x20')]({'name':_0x5b4d5d['code'],'message':_0x5b4d5d[_0x6e70('0x24')],'row':_0x3880dd});}function handleQuery(_0x692205){logger[_0x6e70('0x64')](_0x692205);return db['sequelize']['query'](_0x692205)[_0x6e70('0x65')](function(_0xd6bccd){results[_0x6e70('0x20')](_0xd6bccd);})[_0x6e70('0x22')](function(_0x10d299){logger[_0x6e70('0x23')](_0x10d299[_0x6e70('0x24')]);});}function main(_0x57bfe5,_0x4d47e1,_0x2c8dc6,_0x1e23c5){logger[_0x6e70('0x64')](_0x6e70('0x66'),_0x57bfe5,JSON['stringify'](_0x4d47e1));process['send'](_0x6e70('0x67'));var _0x4e5545=_0x4d47e1['binding'];var _0x57eaa1=_[_0x6e70('0x68')](_0x4e5545);var _0x47fbed=_0x4d47e1[_0x6e70('0x69')];var _0x23900b=path[_0x6e70('0x18')](config[_0x6e70('0x6a')],_0x6e70('0x6b'),_0x47fbed+_0x6e70('0x6c'));logger[_0x6e70('0x64')](_0x6e70('0x6d'),_0x4d47e1);db['ContactItemType'][_0x6e70('0x6e')]({'raw':!![],'attributes':['id',_0x6e70('0x6f')]})[_0x6e70('0x21')](function(_0x346c79){for(var _0x7aa313=0x0;_0x7aa313<_0x346c79['length'];_0x7aa313++){if(_0x346c79[_0x7aa313]['name']in _0x4e5545){contactItemTypes['push'](_0x346c79[_0x7aa313]);delete _0x57eaa1[_0x346c79[_0x7aa313][_0x6e70('0x6f')]];hasAdditionalPhones=!![];}for(var _0xd91b9 in _0x4e5545){if(_0x346c79[_0x7aa313][_0x6e70('0x6f')]+'_description'===_0xd91b9){phoneDescriptions['push']({'itemTypeId':_0x346c79[_0x7aa313]['id'],'description':_0xd91b9});delete _0x57eaa1[_0xd91b9];}}}if(hasAdditionalPhones)_0x57eaa1[_0x6e70('0x1f')]='';var _0x3dae08=_[_0x6e70('0x59')](_0x57eaa1)[_0x6e70('0x18')]();logger[_0x6e70('0x64')](_0x6e70('0x70'),_0x3dae08);fs['writeFileSync'](_0x23900b,_0x3dae08+'\x0a');Papa[_0x6e70('0x71')](fs[_0x6e70('0x72')](_0x57bfe5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x30d11b,_0x82a9a){try{for(var _0x515c0c=0x0,_0xce964b=[];_0x515c0c<_0x30d11b['data']['length'];_0x515c0c++){stats[_0x6e70('0x73')]+=0x1;if(_0x30d11b[_0x6e70('0x63')][_0x515c0c]){handleError(_0x30d11b[_0x6e70('0x74')][_0x515c0c],_0x30d11b[_0x6e70('0x63')][_0x515c0c]);}else{var _0x326584=[];var _0x2be0fc=[];var _0x4b5b19={};for(var _0x370eeb in _0x4e5545){let _0x152003=contactItemTypes[_0x6e70('0x75')](_0x18e64c=>_0x18e64c[_0x6e70('0x6f')]===_0x370eeb);let _0x13c092=contactItemTypes[_0x6e70('0x75')](_0xd9b4a9=>_0xd9b4a9[_0x6e70('0x6f')]+_0x6e70('0x76')===_0x370eeb);if(_['isNil'](_0x152003)&&_[_0x6e70('0x77')](_0x13c092)){if(_0x4e5545[_0x6e70('0x78')](_0x370eeb)){if(_0x30d11b[_0x6e70('0x74')][_0x515c0c][_0x4e5545[_0x370eeb]]){var _0x2e8ed3=_['trim'](_0x30d11b[_0x6e70('0x74')][_0x515c0c][_0x4e5545[_0x370eeb]][_0x6e70('0x79')](/"/g,'\x27'));switch(_0x370eeb){case _0x6e70('0x39'):var _0x14bb74=moment(_0x2e8ed3,_0x6e70('0x10'),!![]);if(_0x14bb74['isValid']()){_0xce964b['push']('\x22'+_0x2e8ed3+'\x22');}else{_0x326584[_0x6e70('0x20')](_0x6e70('0x7a'));}break;case'priority':var _0x58666a=parseInt(_0x2e8ed3);_0x2e8ed3=_[_0x6e70('0x7b')](_0x58666a)||_0x58666a<0x0||_0x58666a>0x4?_0x1e23c5?0x3:0x2:_0x58666a;_0xce964b[_0x6e70('0x20')]('\x22'+_0x2e8ed3+'\x22');break;case _0x6e70('0x3e'):var _0x3b01c9=parseInt(_0x2e8ed3);if(_[_0x6e70('0x7c')](_0x3b01c9)&&_[_0x6e70('0x7d')](_0x2c8dc6,_0x3b01c9)){_0xce964b[_0x6e70('0x20')]('\x22'+_0x3b01c9+'\x22');}else{_0x326584[_0x6e70('0x20')](_0x6e70('0x7e'));}break;case _0x6e70('0x7f'):if(isEmail(_0x2e8ed3)){_0xce964b[_0x6e70('0x20')]('\x22'+_0x2e8ed3+'\x22');}else{_0x326584[_0x6e70('0x20')](_0x6e70('0x80'));}break;case'dateOfBirth':var _0x5b3cb0=moment(_0x2e8ed3,_0x6e70('0x81'),!![]);if(_0x5b3cb0['isValid']()){_0xce964b[_0x6e70('0x20')]('\x22'+_0x2e8ed3+'\x22');}else{_0x326584['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0xce964b[_0x6e70('0x20')]('\x22'+_0x2e8ed3+'\x22');}}else{switch(_0x370eeb){case'firstName':case'phone':_0x326584[_0x6e70('0x20')](_0x370eeb+_0x6e70('0x82'));break;default:_0xce964b[_0x6e70('0x20')]('\x22\x22');}}}}else{var _0x4e9fda='';if(!_['isNil'](_0x152003)){if(!_0x4b5b19['hasOwnProperty'](_0x152003['id'])){for(var _0x3e7be7=0x0;_0x3e7be7<_0x4e5545[_0x370eeb]['length'];_0x3e7be7++){var _0x2e8ed3=_[_0x6e70('0x83')](_0x30d11b[_0x6e70('0x74')][_0x515c0c][_0x4e5545[_0x370eeb][_0x3e7be7]][_0x6e70('0x79')](/"/g,'\x27'));var _0x329068=phoneDescriptions[_0x6e70('0x75')](_0x214a8f=>_0x214a8f['itemTypeId']===_0x152003['id']);if(!_[_0x6e70('0x77')](_0x329068)){var _0x2493b0=_[_0x6e70('0x83')](_0x30d11b['data'][_0x515c0c][_0x4e5545[_0x329068[_0x6e70('0x84')]][0x0]][_0x6e70('0x79')](/"/g,'\x27'));if(!_[_0x6e70('0x77')](_0x2493b0))_0x2e8ed3=_0x2e8ed3+'§'+_0x2493b0;}if(_0x4e9fda=='')_0x4e9fda=_0x2e8ed3;else _0x4e9fda+='|'+_0x2e8ed3;}_0x2be0fc[_0x6e70('0x20')](_0x152003['id']+':'+_0x4e9fda);_0x4b5b19[_0x152003['id']]=0x1;}}}}if(hasAdditionalPhones){_0xce964b[_0x6e70('0x20')]('\x22'+_0x2be0fc[_0x6e70('0x18')](';')+'\x22');}if(_0x326584[_0x6e70('0x1e')]){handleError(_0x30d11b[_0x6e70('0x74')][_0x515c0c],{'code':_0x6e70('0x85'),'message':_0x326584['join']()});}else{fs[_0x6e70('0x86')](_0x23900b,_0xce964b[_0x6e70('0x18')]()+'\x0a');}_0xce964b=[];}if(!(stats['rows']%0xc8)){socket[_0x6e70('0x87')](_0x6e70('0x88')+_0x47fbed,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x6e70('0x89'));_0x82a9a['abort']();}}catch(_0x154c8a){handleError(_0x30d11b['data'][_0x515c0c],{'code':_0x6e70('0x8a'),'message':_0x154c8a[_0x6e70('0x24')]});logger[_0x6e70('0x23')](_0x6e70('0x8b'),_0x154c8a[_0x6e70('0x24')]);}},'complete':function(){try{var _0x3d44fd=[];var _0x3f985f=tempTableName;_0x3d44fd['push']('CREATE\x20TABLE\x20'+_0x3f985f+_0x6e70('0x8c'));logger['info'](_0x6e70('0x8d'),contactItemTypes[_0x6e70('0x1e')]);var _0x28e5b1=util[_0x6e70('0xf')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x23900b,_0x3f985f,_0x3dae08,_0x4d47e1[_0x6e70('0x3b')],_0x4d47e1['CompanyId']||null,NOW,NOW);if(_[_0x6e70('0x77')](_0x4e5545[_0x6e70('0x39')])){_0x28e5b1+=_0x6e70('0x8e');}_0x3d44fd[_0x6e70('0x20')](_0x28e5b1);BPromise[_0x6e70('0x8f')](_0x3d44fd,handleQuery)[_0x6e70('0x21')](function(_0x2c3bf6){BPromise['all']([handleAdditionalPhones()])[_0x6e70('0x21')](function(){_0x3d44fd=[];for(var _0x5b9a97=0x0;_0x5b9a97\x20\x20','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','SIGINT','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','.id\x20=\x20','\x20=\x20','where','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','filter','CmContactHasItem','findOne','update','create','inserted','CmContact','CmHopper'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x3071('0x0'));var util=require(_0x3071('0x1'));var BPromise=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var squel=require(_0x3071('0x4'));var Redis=require('ioredis');var db=require(_0x3071('0x5'))['db'];var config=require(_0x3071('0x6'));var logger=require(_0x3071('0x7'))(_0x3071('0x8'));config[_0x3071('0x9')]=_[_0x3071('0xa')](config[_0x3071('0x9')],{'host':_0x3071('0xb'),'port':0x18eb});var socket=require(_0x3071('0xc'))(new Redis(config[_0x3071('0x9')]));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()[_0x3071('0xd')](_0x3071('0xe'));var tempTableName=_0x3071('0xf')+moment()['format'](_0x3071('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2610b4){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))*$/[_0x3071('0x11')](_0x2610b4);}function selectNotIn(_0xff9a29,_0x1ce844,_0x4a470a,_0x2ace21,_0x11a7ee){return squel[_0x3071('0x12')]()[_0x3071('0x13')](_0x3071('0x14'))['from'](_0x2ace21)['join'](_0x1ce844,null,_0x1ce844+_0x3071('0x15')+_0x2ace21+'.'+_0x4a470a)['where'](_0x2ace21+'.'+_0x4a470a+_0x3071('0x16')+_0xff9a29+'.'+_0x4a470a)[_0x3071('0x17')](_0x1ce844+'.dialCheckDuplicateType\x20IN\x20('+_0x11a7ee[_0x3071('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4e1219,_0x2fc15d){promisesAdditionalPhones=[];promisesContact=[];return db[_0x3071('0x19')][_0x3071('0x1a')](_0x3071('0x1b')+tempTableName)[_0x3071('0x1c')](function(_0x2a6a4b){if(_0x2a6a4b!==null){var _0x157a47=[];for(var _0x11bdc9=0x0;_0x11bdc9<_0x2a6a4b[_0x3071('0x1d')];_0x11bdc9++){var _0x344ea6=_0x2a6a4b[_0x11bdc9];if(!_['isNil'](_0x344ea6[_0x3071('0x14')])){if(!_[_0x3071('0x1e')](_0x344ea6[_0x3071('0x1f')]))_0x157a47[_0x3071('0x20')](insertAdditionalPhones(_0x344ea6));promisesContact[_0x3071('0x20')]({'contact':_0x344ea6});}}}Promise[_0x3071('0x21')](_0x157a47)[_0x3071('0x22')](function(){_0x4e1219({'val':0x1});});})[_0x3071('0x23')](function(_0x502a16){logger[_0x3071('0x24')](_0x502a16[_0x3071('0x25')]);});});}function insertAdditionalPhones(_0xd3e23d){return new Promise(function(_0x56c267,_0xb8f4e3){var _0x5cd80d=_0xd3e23d[_0x3071('0x1f')];if(_[_0x3071('0x1e')](_0x5cd80d))_0xb8f4e3({'val':0x0});else{var _0x3762d8=_0x5cd80d[_0x3071('0x26')](';');var _0x33090c=[];orderBy=0x0;for(var _0x34c50e=0x0;_0x34c50e<_0x3762d8[_0x3071('0x1d')];_0x34c50e++){_0x33090c[_0x3071('0x20')](splitAdditionalPhone(_0xd3e23d['id'],_0x3762d8[_0x34c50e]));}Promise['all'](_0x33090c)['then'](function(){_0x56c267({'val':_0x3762d8[_0x3071('0x1d')]});});}});}function splitAdditionalPhone(_0xb05b1d,_0x412652){return new Promise(function(_0x13df9f,_0x2793ef){var _0x44b45f=_0x412652[_0x3071('0x26')](':');var _0x1fe727=_0x44b45f[0x0];var _0x1de5fb=_0x44b45f[0x1];if(_0x1de5fb!==''){var _0x4c7130=_0x1de5fb[_0x3071('0x26')]('|');var _0x3f1e6e=[];for(var _0x177138=0x0;_0x177138<_0x4c7130['length'];_0x177138++){if(_0x4c7130[_0x177138]!==''){var _0x4fb1ca=_[_0x3071('0x27')](promisesAdditionalPhones,{'contactId':_0xb05b1d,'phone':_0x4c7130[_0x177138]});if(_0x4fb1ca[_0x3071('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x3071('0x20')]({'contactId':_0xb05b1d,'contactTypeId':_0x1fe727,'phone':_0x4c7130[_0x177138],'orderBy':orderBy});}}}_0x13df9f({'ok':0x1});}else _0x13df9f({'res':0x0});});}function createAdditionalPhone(_0x3fa3b8,_0x25b96b,_0x177b5f,_0x3921a1){var _0x32f1b4='';var _0x292205='';var _0x254fc8=_0x177b5f['split']('§');_0x32f1b4=_0x254fc8[0x0];if(_0x254fc8['length']==0x2)_0x292205=_0x254fc8[0x1];return new Promise(function(_0x9e26d1,_0x149e0d){return db[_0x3071('0x28')][_0x3071('0x29')]({'where':{'CmContactId':_0x3fa3b8,'item':_0x32f1b4}})[_0x3071('0x22')](function(_0x29538c){if(_0x29538c){return db[_0x3071('0x28')][_0x3071('0x2a')]({'ItemTypeId':_0x25b96b,'description':_0x292205,'OrderBy':_0x3921a1},{'where':{'CmContactId':_0x3fa3b8,'item':_0x32f1b4}})['then'](function(_0x55d230){_0x9e26d1({'res':'updated'});});}else{return db[_0x3071('0x28')][_0x3071('0x2b')]({'CmContactId':_0x3fa3b8,'item':_0x32f1b4,'ItemTypeId':_0x25b96b,'description':_0x292205,'OrderBy':_0x3921a1,'ItemClass':'PHONE'})[_0x3071('0x22')](function(_0x28747d){_0x9e26d1({'res':_0x3071('0x2c')});});}});});}function updateContact(_0x13ae2c){return new Promise(function(_0x5e1d2b,_0x218a82){var _0x1525df=_0x13ae2c['id'];delete _0x13ae2c['id'];return db[_0x3071('0x2d')][_0x3071('0x2a')](_0x13ae2c,{'where':{'id':_0x1525df}})[_0x3071('0x22')](function(_0x2068ce){updatedRows+=0x1;return db[_0x3071('0x2e')][_0x3071('0x2a')]({'phone':_0x13ae2c['phone']},{'where':{'ContactId':_0x1525df}})[_0x3071('0x22')](function(_0x54e52f){_0x5e1d2b({'ret':'OK'});});});});}function insertCmHopper(_0x4fb1ec,_0x1a1a64,_0xa3a7ae,_0x54d9c3,_0x2e85c8){var _0x46e94e=[_0x3071('0x2f'),_0x3071('0x30'),_0x3071('0x31'),_0x3071('0x32'),_0x1a1a64+'.'+_0x54d9c3,'cm_contacts.createdAt',_0x3071('0x33'),_0x3071('0x34'),'cm_contacts.UserId','\x22'+_0x2e85c8+'\x22'];return squel[_0x3071('0x35')]()['into'](_0x3071('0x36'))[_0x3071('0x37')](['phone','scheduledat',_0x3071('0x38'),_0x3071('0x39'),_0x54d9c3,_0x3071('0x3a'),'updatedAt',_0x3071('0x3b'),'UserId',_0x3071('0x3c')],squel['select']()[_0x3071('0x3d')](_0x46e94e)[_0x3071('0x3e')](_0x1a1a64)[_0x3071('0x18')](_0x3071('0x3f'),null,_0x3071('0x40')+_0x1a1a64+'.CmListId')['join'](_0xa3a7ae,null,_0xa3a7ae+_0x3071('0x15')+_0x1a1a64+'.'+_0x54d9c3)[_0x3071('0x17')](_0x1a1a64+_0x3071('0x41'),_0x4fb1ec)[_0x3071('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x3071('0x17')](_0x3071('0x42'),selectNotIn(_0x1a1a64,_0xa3a7ae,_0x54d9c3,_0x3071('0x36'),[_0x3071('0x43'),_0x3071('0x44')]))[_0x3071('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1a1a64,_0xa3a7ae,_0x54d9c3,_0x3071('0x36'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x4dc9d1,_0x47ceaf,_0x2992e6,_0x1be8b6){var _0x67b2fb=[_0x3071('0x2f'),_0x3071('0x31'),_0x3071('0x32'),_0x47ceaf+'.'+_0x1be8b6,_0x3071('0x45'),_0x3071('0x33')];return squel['insert']()[_0x3071('0x46')](_0x3071('0x47'))[_0x3071('0x37')]([_0x3071('0x14'),_0x3071('0x38'),'ListId',_0x1be8b6,'createdAt',_0x3071('0x48')],squel[_0x3071('0x12')]()[_0x3071('0x3d')](_0x67b2fb)[_0x3071('0x3e')](_0x47ceaf)[_0x3071('0x18')]('cm_contacts',null,_0x3071('0x40')+_0x47ceaf+'.CmListId')[_0x3071('0x18')](_0x2992e6,null,_0x2992e6+'.id\x20=\x20'+_0x47ceaf+'.'+_0x1be8b6)['where'](_0x47ceaf+_0x3071('0x41'),_0x4dc9d1)['where'](_0x3071('0x49'),NOW)['where'](_0x3071('0x42'),squel[_0x3071('0x12')]()[_0x3071('0x13')](_0x3071('0x14'))['from'](_0x3071('0x47'))['where'](_0x3071('0x4a'),_0x4dc9d1)['where'](_0x1be8b6+_0x3071('0x4b'),_0x47ceaf+'.'+_0x1be8b6)))[_0x3071('0x4c')]();}function insertCmHopperAdditionalPhones(_0x4d395a){var _0x131ae6=[_0x3071('0x4d'),_0x3071('0x4e'),_0x3071('0x4f'),_0x3071('0x50'),_0x3071('0x51')];return squel[_0x3071('0x35')]()['into'](_0x3071('0x52'))[_0x3071('0x37')]([_0x3071('0x53'),_0x3071('0x14'),'OrderBy',_0x3071('0x3a'),_0x3071('0x48')],squel[_0x3071('0x12')]()[_0x3071('0x3d')](_0x131ae6)[_0x3071('0x3e')](_0x3071('0x36'))[_0x3071('0x18')](_0x3071('0x3f'),null,_0x3071('0x54'))[_0x3071('0x18')](_0x3071('0x55'),null,_0x3071('0x56'))[_0x3071('0x17')](_0x3071('0x57'),_0x4d395a)[_0x3071('0x17')](_0x3071('0x49'),NOW))['toString']();}function insertCmContact(_0x47a438,_0x12536d,_0x580c04,_0x403761){var _0x198168=_[_0x3071('0x58')](_['keys'](_0x403761),[_0x3071('0x39'),_0x3071('0x59'),'createdAt','updatedAt']);return squel[_0x3071('0x35')]()[_0x3071('0x46')](_0x3071('0x3f'))[_0x3071('0x37')](_0x198168,squel['select']()[_0x3071('0x3d')](_0x198168)[_0x3071('0x3e')](_0x12536d)[_0x3071('0x17')]('('+_0x580c04[_0x3071('0x18')](',')+_0x3071('0x5a'),squel['select']()[_0x3071('0x3d')](_0x580c04)[_0x3071('0x3e')](_0x3071('0x3f'))[_0x3071('0x17')](_0x3071('0x4a'),_0x47a438))[_0x3071('0x17')](_0x3071('0x5b'),squel['select']()['field'](_0x3071('0x5c'),'min_id')[_0x3071('0x3e')](_0x12536d)[_0x3071('0x5d')](_0x580c04['join'](','))))[_0x3071('0x4c')]();}function handleStop(){logger[_0x3071('0x5e')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x108b14){logger[_0x3071('0x24')](_0x108b14[_0x3071('0x25')]);process[_0x3071('0x5f')](0x1);}function handleError(_0x2aaccb,_0x53a399){stats[_0x3071('0x60')][_0x3071('0x20')]({'name':_0x53a399[_0x3071('0x61')],'message':_0x53a399['message'],'row':_0x2aaccb});}function handleQuery(_0x1b0f81){logger[_0x3071('0x5e')](_0x1b0f81);return db[_0x3071('0x19')][_0x3071('0x1a')](_0x1b0f81)[_0x3071('0x1c')](function(_0x210123){results[_0x3071('0x20')](_0x210123);})[_0x3071('0x23')](function(_0x3b47e8){logger['error'](_0x3b47e8[_0x3071('0x25')]);});}function main(_0x29a58e,_0x3bcf28,_0x26ecb2,_0x466835){logger[_0x3071('0x5e')](_0x3071('0x62'),_0x29a58e,JSON[_0x3071('0x63')](_0x3bcf28));process[_0x3071('0x64')](_0x3071('0x65'));var _0x195d03=_0x3bcf28['binding'];var _0x320fe6=_[_0x3071('0x66')](_0x195d03);var _0x279594=_0x3bcf28[_0x3071('0x67')];var _0x429a03=path[_0x3071('0x18')](config[_0x3071('0x68')],_0x3071('0x69'),_0x279594+'.csv');logger[_0x3071('0x5e')](_0x3071('0x6a'),_0x3bcf28);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x3071('0x6b')]})[_0x3071('0x22')](function(_0x3469c1){for(var _0x38bc1f=0x0;_0x38bc1f<_0x3469c1['length'];_0x38bc1f++){if(_0x3469c1[_0x38bc1f]['name']in _0x195d03){contactItemTypes[_0x3071('0x20')](_0x3469c1[_0x38bc1f]);delete _0x320fe6[_0x3469c1[_0x38bc1f]['name']];hasAdditionalPhones=!![];}for(var _0x518bb5 in _0x195d03){if(_0x3469c1[_0x38bc1f]['name']+'_description'===_0x518bb5){phoneDescriptions[_0x3071('0x20')]({'itemTypeId':_0x3469c1[_0x38bc1f]['id'],'description':_0x518bb5});delete _0x320fe6[_0x518bb5];}}}if(hasAdditionalPhones)_0x320fe6[_0x3071('0x1f')]='';var _0xd928e8=_['keys'](_0x320fe6)[_0x3071('0x18')]();logger[_0x3071('0x5e')](_0x3071('0x6c'),_0xd928e8);fs[_0x3071('0x6d')](_0x429a03,_0xd928e8+'\x0a');Papa['parse'](fs[_0x3071('0x6e')](_0x29a58e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x29841a,_0x588406){try{for(var _0x1b35d3=0x0,_0x29ee70=[];_0x1b35d3<_0x29841a[_0x3071('0x6f')][_0x3071('0x1d')];_0x1b35d3++){stats[_0x3071('0x70')]+=0x1;if(_0x29841a[_0x3071('0x60')][_0x1b35d3]){handleError(_0x29841a[_0x3071('0x6f')][_0x1b35d3],_0x29841a['errors'][_0x1b35d3]);}else{var _0x5dde93=[];var _0x21c1e3=[];var _0x168025={};for(var _0x1456ce in _0x195d03){let _0x4bf839=contactItemTypes['find'](_0x9f49f0=>_0x9f49f0[_0x3071('0x6b')]===_0x1456ce);let _0x3bad84=contactItemTypes[_0x3071('0x71')](_0x2f1935=>_0x2f1935[_0x3071('0x6b')]+_0x3071('0x72')===_0x1456ce);if(_[_0x3071('0x1e')](_0x4bf839)&&_['isNil'](_0x3bad84)){if(_0x195d03[_0x3071('0x73')](_0x1456ce)){if(_0x29841a['data'][_0x1b35d3][_0x195d03[_0x1456ce]]){var _0xa8e233=_[_0x3071('0x74')](_0x29841a[_0x3071('0x6f')][_0x1b35d3][_0x195d03[_0x1456ce]][_0x3071('0x75')](/"/g,'\x27'));switch(_0x1456ce){case _0x3071('0x76'):var _0x44b5dc=moment(_0xa8e233,_0x3071('0xe'),!![]);if(_0x44b5dc[_0x3071('0x77')]()){_0x29ee70['push']('\x22'+_0xa8e233+'\x22');}else{_0x5dde93[_0x3071('0x20')](_0x3071('0x78'));}break;case _0x3071('0x3b'):var _0x4f06c0=parseInt(_0xa8e233);_0xa8e233=_[_0x3071('0x79')](_0x4f06c0)||_0x4f06c0<0x0||_0x4f06c0>0x4?_0x466835?0x3:0x2:_0x4f06c0;_0x29ee70[_0x3071('0x20')]('\x22'+_0xa8e233+'\x22');break;case _0x3071('0x7a'):var _0x567e33=parseInt(_0xa8e233);if(_['isNumber'](_0x567e33)&&_[_0x3071('0x7b')](_0x26ecb2,_0x567e33)){_0x29ee70['push']('\x22'+_0x567e33+'\x22');}else{_0x5dde93[_0x3071('0x20')](_0x3071('0x7c'));}break;case _0x3071('0x7d'):if(isEmail(_0xa8e233)){_0x29ee70[_0x3071('0x20')]('\x22'+_0xa8e233+'\x22');}else{_0x5dde93[_0x3071('0x20')](_0x3071('0x7e'));}break;case _0x3071('0x7f'):var _0x4c67ec=moment(_0xa8e233,_0x3071('0x80'),!![]);if(_0x4c67ec[_0x3071('0x77')]()){_0x29ee70[_0x3071('0x20')]('\x22'+_0xa8e233+'\x22');}else{_0x5dde93[_0x3071('0x20')](_0x3071('0x81'));}break;default:_0x29ee70[_0x3071('0x20')]('\x22'+_0xa8e233+'\x22');}}else{switch(_0x1456ce){case _0x3071('0x82'):case _0x3071('0x14'):_0x5dde93['push'](_0x1456ce+_0x3071('0x83'));break;default:_0x29ee70['push']('\x22\x22');}}}}else{var _0x2aef6e='';if(!_[_0x3071('0x1e')](_0x4bf839)){if(!_0x168025[_0x3071('0x73')](_0x4bf839['id'])){for(var _0x45879b=0x0;_0x45879b<_0x195d03[_0x1456ce][_0x3071('0x1d')];_0x45879b++){var _0xa8e233=_[_0x3071('0x74')](_0x29841a[_0x3071('0x6f')][_0x1b35d3][_0x195d03[_0x1456ce][_0x45879b]][_0x3071('0x75')](/"/g,'\x27'));var _0x3a3cf3=phoneDescriptions['find'](_0x456921=>_0x456921[_0x3071('0x84')]===_0x4bf839['id']);if(!_['isNil'](_0x3a3cf3)){var _0x156826=_[_0x3071('0x74')](_0x29841a[_0x3071('0x6f')][_0x1b35d3][_0x195d03[_0x3a3cf3[_0x3071('0x85')]][0x0]][_0x3071('0x75')](/"/g,'\x27'));if(!_['isNil'](_0x156826))_0xa8e233=_0xa8e233+'§'+_0x156826;}if(_0x2aef6e=='')_0x2aef6e=_0xa8e233;else _0x2aef6e+='|'+_0xa8e233;}_0x21c1e3['push'](_0x4bf839['id']+':'+_0x2aef6e);_0x168025[_0x4bf839['id']]=0x1;}}}}if(hasAdditionalPhones){_0x29ee70[_0x3071('0x20')]('\x22'+_0x21c1e3['join'](';')+'\x22');}if(_0x5dde93[_0x3071('0x1d')]){handleError(_0x29841a[_0x3071('0x6f')][_0x1b35d3],{'code':_0x3071('0x86'),'message':_0x5dde93[_0x3071('0x18')]()});}else{fs[_0x3071('0x87')](_0x429a03,_0x29ee70[_0x3071('0x18')]()+'\x0a');}_0x29ee70=[];}if(!(stats['rows']%0xc8)){socket[_0x3071('0x88')](_0x3071('0x89')+_0x279594,stats);stats[_0x3071('0x60')]=[];}}if(stopped){logger[_0x3071('0x5e')]('Abort\x20parser');_0x588406[_0x3071('0x8a')]();}}catch(_0x446546){handleError(_0x29841a['data'][_0x1b35d3],{'code':_0x3071('0x8b'),'message':_0x446546[_0x3071('0x25')]});logger[_0x3071('0x24')](_0x3071('0x8c'),_0x446546[_0x3071('0x25')]);}},'complete':function(){try{var _0x547ba8=[];var _0x44cecd=tempTableName;_0x547ba8['push'](_0x3071('0x8d')+_0x44cecd+_0x3071('0x8e'));logger[_0x3071('0x5e')](_0x3071('0x8f'),contactItemTypes[_0x3071('0x1d')]);var _0x247cda=util[_0x3071('0xd')](_0x3071('0x90'),_0x429a03,_0x44cecd,_0xd928e8,_0x3bcf28['ListId'],_0x3bcf28[_0x3071('0x59')]||null,NOW,NOW);if(_[_0x3071('0x1e')](_0x195d03[_0x3071('0x76')])){_0x247cda+=',\x20scheduledAt\x20=\x20NOW()';}_0x547ba8[_0x3071('0x20')](_0x247cda);BPromise['each'](_0x547ba8,handleQuery)[_0x3071('0x22')](function(_0x5a5861){BPromise[_0x3071('0x21')]([handleAdditionalPhones()])['then'](function(){_0x547ba8=[];for(var _0x163b29=0x0;_0x163b29=_0x21e4b1){return _0x32eee6[_0x8d43('0x13')](0x193)[_0x8d43('0x14')]({'message':util[_0x8d43('0x15')](_0x8d43('0x16'),_0x2c19b4)});}_0x35569e();})['catch'](function(_0x15c4bd){_0x35569e(_0x15c4bd);});});}function isUserLimit(){return isLimit(_0x8d43('0x17'),0x1,db[_0x8d43('0x18')],{'where':{'$or':[{'role':_0x8d43('0x19')},{'role':_0x8d43('0x1a')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xa6c4=['../../config/environment','data1','license','split','aes-256-ctr','%s:%s:%s','update','utf8','use','License','then','status','json','format','catch','users','User','admin','user','crypto','util','composable-middleware','../../mysqldb'];(function(_0x30aa79,_0x361fb1){var _0x297a74=function(_0x310c35){while(--_0x310c35){_0x30aa79['push'](_0x30aa79['shift']());}};_0x297a74(++_0x361fb1);}(_0xa6c4,0x6f));var _0x4a6c=function(_0x53b133,_0x176261){_0x53b133=_0x53b133-0x0;var _0x5647e0=_0xa6c4[_0x53b133];return _0x5647e0;};'use strict';var crypto=require(_0x4a6c('0x0'));var util=require(_0x4a6c('0x1'));var compose=require(_0x4a6c('0x2'));var db=require(_0x4a6c('0x3'))['db'];var config=require(_0x4a6c('0x4'));function getValueFromLicense(_0xb2fc1e,_0x4271ee){if(_0xb2fc1e&&_0x4271ee){if(_0x4271ee[_0x4a6c('0x5')]&&_0x4271ee[_0x4a6c('0x6')]){var _0x3fe037=_0x4271ee['data1'];var _0x4f364e=_0x4271ee['license'];var _0x9fb497=_0x3fe037['split']('-')[0x4];var _0x6d995c=_0x3fe037[_0x4a6c('0x7')]('-')[0x0];var _0x129081=crypto['createDecipher'](_0x4a6c('0x8'),util['format'](_0x4a6c('0x9'),_0x9fb497,_0x3fe037,_0x6d995c));var _0x194060=_0x129081[_0x4a6c('0xa')](_0x4f364e,'base64',_0x4a6c('0xb'));_0x194060+=_0x129081['final'](_0x4a6c('0xb'));var _0x52fcfa=JSON['parse'](_0x194060);return _0x52fcfa['hasOwnProperty'](_0xb2fc1e)?_0x52fcfa[_0xb2fc1e]:null;}}return null;}function isLimit(_0x414b2e,_0x5aa216,_0x45e928,_0x2d69a3){var _0x5bcdfe=_0x5aa216;return compose()[_0x4a6c('0xc')](function(_0x1f08fe,_0x2a2712,_0x17c34b){return db[_0x4a6c('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x4a6c('0xe')](function(_0x54a2b2){var _0x4658ba=getValueFromLicense(_0x414b2e,_0x54a2b2);return _0x4658ba?_0x4658ba:_0x5bcdfe;})['then'](function(_0x139b17){_0x5bcdfe=_0x139b17;return _0x45e928['count'](_0x2d69a3);})[_0x4a6c('0xe')](function(_0x49e642){if(_0x49e642>=_0x5bcdfe){return _0x2a2712[_0x4a6c('0xf')](0x193)[_0x4a6c('0x10')]({'message':util[_0x4a6c('0x11')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x414b2e)});}_0x17c34b();})[_0x4a6c('0x12')](function(_0xf5af2e){_0x17c34b(_0xf5af2e);});});}function isUserLimit(){return isLimit(_0x4a6c('0x13'),0x1,db[_0x4a6c('0x14')],{'where':{'$or':[{'role':_0x4a6c('0x15')},{'role':_0x4a6c('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index a5df2ff..d1a7f99 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 _0x3315=['$eq','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','$between','pop','utcOffset','hours','minutes','seconds','lodash','parseSearch','and','replace','[$or]','split','slice','shift','match','forEach','filter','map','DATE','operator'];(function(_0x28c7a7,_0x55a356){var _0x50610f=function(_0x3a4038){while(--_0x3a4038){_0x28c7a7['push'](_0x28c7a7['shift']());}};_0x50610f(++_0x55a356);}(_0x3315,0x1cf));var _0x5331=function(_0x4c060a,_0x264726){_0x4c060a=_0x4c060a-0x0;var _0x488d93=_0x3315[_0x4c060a];return _0x488d93;};'use strict';var _=require(_0x5331('0x0'));var moment=require('moment');exports[_0x5331('0x1')]=function(_0x588add){var _0x400b1c={'conditions':[]};_0x400b1c['sqlOperator']=_['startsWith'](_0x588add,'[$or]')?'or':_0x5331('0x2');var _0x132104=_0x588add['replace']('[$and]','')[_0x5331('0x3')](_0x5331('0x4'),'')[_0x5331('0x5')]('||');for(var _0x55370d=0x0;_0x55370d<_0x132104['length'];_0x55370d++){var _0x5423b4=_0x132104[_0x55370d][_0x5331('0x5')](':=');var _0x17f474=_0x5423b4[0x0];var _0x127aa4=_0x5423b4[_0x5331('0x6')](0x1);_0x127aa4['forEach'](function(_0x262955){var _0x2da04a=_0x262955[_0x5331('0x5')]('[')[_0x5331('0x7')]();var _0x50c497=_0x262955[_0x5331('0x8')](/\[(.*?)\]/g);_0x50c497[_0x5331('0x9')](function(_0x40a9ee){var _0x58da62=_0x40a9ee[_0x5331('0x5')]('[')[_0x5331('0xa')](function(_0x46a51e){return _0x46a51e['indexOf'](']')>-0x1;})[_0x5331('0xb')](function(_0x2336ea){return _0x2336ea[_0x5331('0x5')](']')[0x0];})[0x0];_0x400b1c['conditions']['push']({'field':_0x17f474,'operator':_0x2da04a,'value':_0x58da62});});});}return _0x400b1c;};exports['buildExpression']=function(_0x2f515c,_0x13cc13,_0x1358ca){var _0x12770a={};if(_0x13cc13===_0x5331('0xc')){if(_0x1358ca[_0x5331('0xd')]===_0x5331('0xe')){_0x1358ca['operator']='$between';_0x1358ca['value']+=','+_0x1358ca[_0x5331('0xf')];}else if(_[_0x5331('0x10')]([_0x5331('0x11'),_0x5331('0x12')],_0x1358ca[_0x5331('0xd')])){_0x1358ca[_0x5331('0xf')]=moment(_0x1358ca[_0x5331('0xf')])[_0x5331('0x13')](0x1,_0x5331('0x14'))[_0x5331('0x15')](_0x5331('0x16'));}}if(_0x1358ca[_0x5331('0x17')]){_0x13cc13=_0x1358ca[_0x5331('0x17')];_0x12770a[_0x5331('0x18')]=_0x5331('0x19')+_0x2f515c+'.'+_0x1358ca[_0x5331('0x1a')]+_0x5331('0x1b')+_0x1358ca[_0x5331('0x17')]+')\x20'+parseOperator(_0x1358ca[_0x5331('0xd')]);}else{_0x12770a[_0x5331('0x18')]=_0x2f515c+'.'+_0x1358ca[_0x5331('0x1a')]+'\x20'+parseOperator(_0x1358ca[_0x5331('0xd')]);}if(_[_0x5331('0x10')]([_0x5331('0x1c'),_0x5331('0x1d')],_0x1358ca['operator']))_0x12770a[_0x5331('0x18')]='('+_0x12770a[_0x5331('0x18')]+_0x5331('0x1e')+_0x2f515c+'.'+_0x1358ca['field']+_0x5331('0x1f');_0x12770a[_0x5331('0xf')]=parseValue(_0x13cc13,_0x1358ca['operator'],_0x1358ca[_0x5331('0xf')]);return _0x12770a;};function parseOperator(_0x31ffae){var _0x5afd7a;switch(_0x31ffae){case _0x5331('0x20'):_0x5afd7a=_0x5331('0x21');break;case _0x5331('0x1d'):_0x5afd7a=_0x5331('0x22');break;case _0x5331('0xe'):_0x5afd7a=_0x5331('0x23');break;case _0x5331('0x1c'):_0x5afd7a=_0x5331('0x24');break;case _0x5331('0x25'):case _0x5331('0x26'):case _0x5331('0x27'):_0x5afd7a=_0x5331('0x28');break;case _0x5331('0x29'):_0x5afd7a=_0x5331('0x2a');break;case _0x5331('0x11'):_0x5afd7a=_0x5331('0x2b');break;case _0x5331('0x12'):_0x5afd7a='<=\x20?';break;case _0x5331('0x2c'):_0x5afd7a='>=\x20?';break;case'$between':_0x5afd7a=_0x5331('0x2d');break;}return _0x5afd7a;}function parseValue(_0x2ab01c,_0x43a32b,_0x3379a9){var _0x3bcc55={'start':undefined,'end':undefined};switch(_0x43a32b){case'$in':case _0x5331('0x1d'):_0x3bcc55[_0x5331('0x2e')]=_0x3379a9[_0x5331('0x5')](',');break;case _0x5331('0x25'):_0x3bcc55[_0x5331('0x2e')]='%'+_0x3379a9+'%';break;case _0x5331('0x26'):_0x3bcc55['start']=_0x3379a9+'%';break;case _0x5331('0x27'):_0x3bcc55['start']='%'+_0x3379a9;break;case _0x5331('0x2f'):var _0x3e13da=_0x3379a9[_0x5331('0x5')](',');var _0x3379a9=_0x3e13da[_0x5331('0x7')]();var _0x4c7012=_0x3e13da[_0x5331('0x30')]();if(_0x2ab01c===_0x5331('0xc')){_0x3379a9=moment(_0x3379a9)[_0x5331('0x31')](0x0,!![])[_0x5331('0x15')]();_0x4c7012=moment(_0x4c7012)[_0x5331('0x31')](0x0,!![])[_0x5331('0x13')](0x17,_0x5331('0x32'))['add'](0x3b,_0x5331('0x33'))['add'](0x3b,_0x5331('0x34'))[_0x5331('0x15')]();}_0x3bcc55={'start':_0x3379a9,'end':_0x4c7012};break;default:_0x3bcc55[_0x5331('0x2e')]=_0x3379a9;break;}return _0x3bcc55;} \ No newline at end of file +var _0xb6ad=['field','includes','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','$ne','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','replace','split','slice','forEach','shift','filter','indexOf','map','operator','$eq','$between','value','$lte','add','days','format','YYYY-MM-DD','castTo','text'];(function(_0x58cbde,_0x4b0f62){var _0x5799f3=function(_0x326eca){while(--_0x326eca){_0x58cbde['push'](_0x58cbde['shift']());}};_0x5799f3(++_0x4b0f62);}(_0xb6ad,0xac));var _0xdb6a=function(_0x267f20,_0x1f4eb6){_0x267f20=_0x267f20-0x0;var _0xbe3f66=_0xb6ad[_0x267f20];return _0xbe3f66;};'use strict';var _=require(_0xdb6a('0x0'));var moment=require(_0xdb6a('0x1'));exports[_0xdb6a('0x2')]=function(_0x4b3ad4){var _0x42586c={'conditions':[]};_0x42586c[_0xdb6a('0x3')]=_[_0xdb6a('0x4')](_0x4b3ad4,'[$or]')?'or':'and';var _0x253a4f=_0x4b3ad4[_0xdb6a('0x5')]('[$and]','')[_0xdb6a('0x5')]('[$or]','')[_0xdb6a('0x6')]('||');for(var _0x2cf1c9=0x0;_0x2cf1c9<_0x253a4f['length'];_0x2cf1c9++){var _0x138363=_0x253a4f[_0x2cf1c9][_0xdb6a('0x6')](':=');var _0x346f85=_0x138363[0x0];var _0x16cc4e=_0x138363[_0xdb6a('0x7')](0x1);_0x16cc4e[_0xdb6a('0x8')](function(_0x517baa){var _0x328e81=_0x517baa[_0xdb6a('0x6')]('[')[_0xdb6a('0x9')]();var _0x1ffcb1=_0x517baa['match'](/\[(.*?)\]/g);_0x1ffcb1[_0xdb6a('0x8')](function(_0x5019f1){var _0x4d4c48=_0x5019f1[_0xdb6a('0x6')]('[')[_0xdb6a('0xa')](function(_0x1c40f9){return _0x1c40f9[_0xdb6a('0xb')](']')>-0x1;})[_0xdb6a('0xc')](function(_0x6dd702){return _0x6dd702[_0xdb6a('0x6')](']')[0x0];})[0x0];_0x42586c['conditions']['push']({'field':_0x346f85,'operator':_0x328e81,'value':_0x4d4c48});});});}return _0x42586c;};exports['buildExpression']=function(_0x31d0c8,_0x2a6567,_0x17d629){var _0x21e56a={};if(_0x2a6567==='DATE'){if(_0x17d629[_0xdb6a('0xd')]===_0xdb6a('0xe')){_0x17d629[_0xdb6a('0xd')]=_0xdb6a('0xf');_0x17d629[_0xdb6a('0x10')]+=','+_0x17d629[_0xdb6a('0x10')];}else if(_['includes'](['$gt',_0xdb6a('0x11')],_0x17d629[_0xdb6a('0xd')])){_0x17d629[_0xdb6a('0x10')]=moment(_0x17d629[_0xdb6a('0x10')])[_0xdb6a('0x12')](0x1,_0xdb6a('0x13'))[_0xdb6a('0x14')](_0xdb6a('0x15'));}}if(_0x17d629[_0xdb6a('0x16')]){_0x2a6567=_0x17d629[_0xdb6a('0x16')];_0x21e56a[_0xdb6a('0x17')]='CAST('+_0x31d0c8+'.'+_0x17d629[_0xdb6a('0x18')]+'\x20AS\x20'+_0x17d629[_0xdb6a('0x16')]+')\x20'+parseOperator(_0x17d629[_0xdb6a('0xd')]);}else{_0x21e56a[_0xdb6a('0x17')]=_0x31d0c8+'.'+_0x17d629[_0xdb6a('0x18')]+'\x20'+parseOperator(_0x17d629[_0xdb6a('0xd')]);}if(_[_0xdb6a('0x19')](['$ne',_0xdb6a('0x1a')],_0x17d629['operator']))_0x21e56a[_0xdb6a('0x17')]='('+_0x21e56a[_0xdb6a('0x17')]+_0xdb6a('0x1b')+_0x31d0c8+'.'+_0x17d629[_0xdb6a('0x18')]+_0xdb6a('0x1c');_0x21e56a[_0xdb6a('0x10')]=parseValue(_0x2a6567,_0x17d629[_0xdb6a('0xd')],_0x17d629['value']);return _0x21e56a;};function parseOperator(_0x5c0c70){var _0x2630a2;switch(_0x5c0c70){case'$in':_0x2630a2=_0xdb6a('0x1d');break;case _0xdb6a('0x1a'):_0x2630a2=_0xdb6a('0x1e');break;case _0xdb6a('0xe'):_0x2630a2='=\x20?';break;case _0xdb6a('0x1f'):_0x2630a2=_0xdb6a('0x20');break;case _0xdb6a('0x21'):case _0xdb6a('0x22'):case'$endsWith':_0x2630a2=_0xdb6a('0x23');break;case _0xdb6a('0x24'):_0x2630a2=_0xdb6a('0x25');break;case'$gt':_0x2630a2=_0xdb6a('0x26');break;case'$lte':_0x2630a2=_0xdb6a('0x27');break;case _0xdb6a('0x28'):_0x2630a2=_0xdb6a('0x29');break;case'$between':_0x2630a2=_0xdb6a('0x2a');break;}return _0x2630a2;}function parseValue(_0xe9a5d4,_0x5842ac,_0x41e52e){var _0x35e0e8={'start':undefined,'end':undefined};switch(_0x5842ac){case'$in':case _0xdb6a('0x1a'):_0x35e0e8[_0xdb6a('0x2b')]=_0x41e52e[_0xdb6a('0x6')](',');break;case _0xdb6a('0x21'):_0x35e0e8[_0xdb6a('0x2b')]='%'+_0x41e52e+'%';break;case _0xdb6a('0x22'):_0x35e0e8['start']=_0x41e52e+'%';break;case _0xdb6a('0x2c'):_0x35e0e8[_0xdb6a('0x2b')]='%'+_0x41e52e;break;case _0xdb6a('0xf'):var _0x180741=_0x41e52e[_0xdb6a('0x6')](',');var _0x41e52e=_0x180741[_0xdb6a('0x9')]();var _0x4763c1=_0x180741[_0xdb6a('0x2d')]();if(_0xe9a5d4==='DATE'){_0x41e52e=moment(_0x41e52e)[_0xdb6a('0x2e')](0x0,!![])[_0xdb6a('0x14')]();_0x4763c1=moment(_0x4763c1)[_0xdb6a('0x2e')](0x0,!![])[_0xdb6a('0x12')](0x17,_0xdb6a('0x2f'))[_0xdb6a('0x12')](0x3b,_0xdb6a('0x30'))['add'](0x3b,'seconds')[_0xdb6a('0x14')]();}_0x35e0e8={'start':_0x41e52e,'end':_0x4763c1};break;default:_0x35e0e8[_0xdb6a('0x2b')]=_0x41e52e;break;}return _0x35e0e8;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 3d6c93d..c78ae2d 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 _0x5997=['ASC','length','omit','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','includes','join','lodash','moment','fields','split','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','isArray','parse','indexOf','cast','col','priority','substr','DESC','unsigned'];(function(_0x22dfd6,_0x3baf7b){var _0x21cab2=function(_0x5c00a8){while(--_0x5c00a8){_0x22dfd6['push'](_0x22dfd6['shift']());}};_0x21cab2(++_0x3baf7b);}(_0x5997,0x13f));var _0x7599=function(_0x2c8360,_0x1852e7){_0x2c8360=_0x2c8360-0x0;var _0xce8c45=_0x5997[_0x2c8360];return _0xce8c45;};'use strict';var _=require(_0x7599('0x0'));var sequelize=require('sequelize');var moment=require(_0x7599('0x1'));var LIMIT_VALUE=0xfa;exports[_0x7599('0x2')]=function(_0x37cd78){var _0x4cf4e1=null;if(_0x37cd78){_0x4cf4e1=_0x37cd78[_0x7599('0x3')](',');}return _0x4cf4e1;};exports['filters']=function(_0x476a08,_0x16a4f4){var _0x480b08={};if(!_['isEmpty'](_0x476a08)){_[_0x7599('0x4')](_0x476a08,function(_0x4bab33,_0x562116){try{if(_0x16a4f4){var _0x2ee7e9=_[_0x7599('0x5')](_0x16a4f4,{'name':_0x562116})||{};if(_0x2ee7e9[_0x7599('0x6')]===_0x7599('0x7')&&_[_0x7599('0x8')](_0x4bab33)){var _0x353a57=JSON['parse'](_0x4bab33);var _0x8cb536={'$gte':moment(moment(_0x353a57[_0x7599('0x9')])[_0x7599('0xa')](_0x7599('0xb')))[_0x7599('0xc')]()['format'](),'$lte':moment(moment(_0x353a57['$lte'])['format']('YYYY-MM-DD'))['utc']()[_0x7599('0xd')](0x1,'s')['format']()};_0x480b08[_0x562116]=_0x8cb536;}else if(_0x2ee7e9['name']==='uniqueid'){_0x480b08[_0x562116]=_0x4bab33;}else{_0x480b08[_0x562116]=_[_0x7599('0xe')](_0x4bab33)?_0x4bab33:JSON[_0x7599('0xf')](_0x4bab33);}}else{_0x480b08[_0x562116]=_[_0x7599('0xe')](_0x4bab33)?_0x4bab33:JSON[_0x7599('0xf')](_0x4bab33);}}catch(_0x4f0613){_0x480b08[_0x562116]=_0x4bab33[_0x7599('0x3')](',');}});}return _0x480b08;};exports['limit']=function(_0x11c857){_0x11c857=parseInt(_0x11c857,0xa);if(!_0x11c857||_0x11c857<0x0){_0x11c857=LIMIT_VALUE;}return _0x11c857;};exports['offset']=function(_0x590e9c){_0x590e9c=parseInt(_0x590e9c,0xa);if(!_0x590e9c||_0x590e9c<0x0){_0x590e9c=0x0;}return _0x590e9c;};exports['sort']=function(_0x18e5a0){var _0x7dd186,_0x3aa7b9=null;if(_0x18e5a0){_0x7dd186=_0x18e5a0[_0x7599('0x3')](',');_0x3aa7b9=_['map'](_0x7dd186,function(_0x4950f2){if(_0x4950f2[_0x7599('0x10')]('-')===0x0){return[_0x4950f2==='priority'?sequelize[_0x7599('0x11')](sequelize[_0x7599('0x12')](_0x7599('0x13')),'unsigned'):_0x4950f2[_0x7599('0x14')](0x1),_0x7599('0x15')];}else{return[_0x4950f2===_0x7599('0x13')?sequelize[_0x7599('0x11')](sequelize['col']('priority'),_0x7599('0x16')):_0x4950f2,_0x7599('0x17')];}});}return _0x3aa7b9;};exports['omit']=function(_0x5c156e,_0x361ae0){if(_['isEmpty'](_0x5c156e)){return _0x5c156e;}if(_[_0x7599('0xe')](_0x5c156e)){for(var _0x30d07a=0x0;_0x30d07a<_0x5c156e[_0x7599('0x18')];_0x30d07a+=0x1){_0x5c156e[_0x30d07a]=this[_0x7599('0x19')](_0x5c156e[_0x30d07a],_0x361ae0);}return _0x5c156e;}if(!_['isObject'](_0x5c156e)){return _0x5c156e;}if(_[_0x7599('0x1a')](_0x361ae0)){_0x361ae0=[_0x361ae0];}if(!_[_0x7599('0xe')](_0x361ae0)){return _0x5c156e;}for(var _0x1904d4=0x0;_0x1904d4<_0x361ae0[_0x7599('0x18')];_0x1904d4+=0x1){_[_0x7599('0x1b')](_0x5c156e,_0x361ae0[_0x1904d4]);}for(var _0x3796c4 in _0x5c156e){if(_0x5c156e[_0x7599('0x1c')](_0x3796c4)){_0x5c156e[_0x3796c4]=this[_0x7599('0x19')](_0x5c156e[_0x3796c4],_0x361ae0);}}return _0x5c156e;};exports[_0x7599('0x1d')]=function(_0x5d06b9){return _0x5d06b9[_0x7599('0x1e')](RegExp(_0x7599('0x1f')))?!![]:![];};exports[_0x7599('0x20')]=function(_0x40d2af){return _0x40d2af[_0x7599('0x1e')](/^\S+@\S+$/)?!![]:![];};exports[_0x7599('0x21')]=function(_0x5aabce){var _0x19492b=[];_0x5aabce[_0x7599('0x3')](/[ ,]+/)[_0x7599('0x22')](function(_0x263382){_0x263382=_0x263382[_0x7599('0x23')](/([^:]")"+/g,'$1');_0x263382='+'+_0x263382+'*';if(_0x263382[_0x7599('0x24')]('@'))_0x263382='\x22'+_0x263382+'\x22';_0x19492b['push'](_0x263382);});return _0x19492b[_0x7599('0x25')]('\x20');}; \ No newline at end of file +var _0xaf37=['match','^[+]?[0-9]*$','getFullTextValue','replace','includes','push','join','lodash','moment','split','filters','isEmpty','forOwn','find','type','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','offset','sort','map','indexOf','priority','cast','col','unsigned','DESC','omit','isArray','isObject','isString','unset','isNumeric'];(function(_0x3b247d,_0xbe4218){var _0x131bcf=function(_0x4882f4){while(--_0x4882f4){_0x3b247d['push'](_0x3b247d['shift']());}};_0x131bcf(++_0xbe4218);}(_0xaf37,0xa7));var _0x7af3=function(_0x1443eb,_0x203408){_0x1443eb=_0x1443eb-0x0;var _0x2b8810=_0xaf37[_0x1443eb];return _0x2b8810;};'use strict';var _=require(_0x7af3('0x0'));var sequelize=require('sequelize');var moment=require(_0x7af3('0x1'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x424e0c){var _0x3ee2c3=null;if(_0x424e0c){_0x3ee2c3=_0x424e0c[_0x7af3('0x2')](',');}return _0x3ee2c3;};exports[_0x7af3('0x3')]=function(_0xd0ac14,_0x5929c5){var _0x15d2ca={};if(!_[_0x7af3('0x4')](_0xd0ac14)){_[_0x7af3('0x5')](_0xd0ac14,function(_0x4e5ecc,_0x220dfb){try{if(_0x5929c5){var _0x323955=_[_0x7af3('0x6')](_0x5929c5,{'name':_0x220dfb})||{};if(_0x323955[_0x7af3('0x7')]==='DATE'&&_[_0x7af3('0x8')](_0x4e5ecc)){var _0x322526=JSON[_0x7af3('0x9')](_0x4e5ecc);var _0x19d0fd={'$gte':moment(moment(_0x322526[_0x7af3('0xa')])[_0x7af3('0xb')](_0x7af3('0xc')))[_0x7af3('0xd')]()['format'](),'$lte':moment(moment(_0x322526[_0x7af3('0xe')])['format'](_0x7af3('0xc')))[_0x7af3('0xd')]()[_0x7af3('0xf')](0x1,'s')[_0x7af3('0xb')]()};_0x15d2ca[_0x220dfb]=_0x19d0fd;}else if(_0x323955[_0x7af3('0x10')]===_0x7af3('0x11')){_0x15d2ca[_0x220dfb]=_0x4e5ecc;}else{_0x15d2ca[_0x220dfb]=_['isArray'](_0x4e5ecc)?_0x4e5ecc:JSON[_0x7af3('0x9')](_0x4e5ecc);}}else{_0x15d2ca[_0x220dfb]=_['isArray'](_0x4e5ecc)?_0x4e5ecc:JSON[_0x7af3('0x9')](_0x4e5ecc);}}catch(_0x571984){_0x15d2ca[_0x220dfb]=_0x4e5ecc[_0x7af3('0x2')](',');}});}return _0x15d2ca;};exports['limit']=function(_0x4f7443){_0x4f7443=parseInt(_0x4f7443,0xa);if(!_0x4f7443||_0x4f7443<0x0){_0x4f7443=LIMIT_VALUE;}return _0x4f7443;};exports[_0x7af3('0x12')]=function(_0x3f48e8){_0x3f48e8=parseInt(_0x3f48e8,0xa);if(!_0x3f48e8||_0x3f48e8<0x0){_0x3f48e8=0x0;}return _0x3f48e8;};exports[_0x7af3('0x13')]=function(_0x1732d8){var _0x5adef4,_0xed4a46=null;if(_0x1732d8){_0x5adef4=_0x1732d8[_0x7af3('0x2')](',');_0xed4a46=_[_0x7af3('0x14')](_0x5adef4,function(_0x5e8b87){if(_0x5e8b87[_0x7af3('0x15')]('-')===0x0){return[_0x5e8b87===_0x7af3('0x16')?sequelize[_0x7af3('0x17')](sequelize[_0x7af3('0x18')]('priority'),_0x7af3('0x19')):_0x5e8b87['substr'](0x1),_0x7af3('0x1a')];}else{return[_0x5e8b87===_0x7af3('0x16')?sequelize[_0x7af3('0x17')](sequelize[_0x7af3('0x18')](_0x7af3('0x16')),_0x7af3('0x19')):_0x5e8b87,'ASC'];}});}return _0xed4a46;};exports[_0x7af3('0x1b')]=function(_0x4db9cb,_0x38fb21){if(_[_0x7af3('0x4')](_0x4db9cb)){return _0x4db9cb;}if(_[_0x7af3('0x1c')](_0x4db9cb)){for(var _0xe30f15=0x0;_0xe30f15<_0x4db9cb['length'];_0xe30f15+=0x1){_0x4db9cb[_0xe30f15]=this['omit'](_0x4db9cb[_0xe30f15],_0x38fb21);}return _0x4db9cb;}if(!_[_0x7af3('0x1d')](_0x4db9cb)){return _0x4db9cb;}if(_[_0x7af3('0x1e')](_0x38fb21)){_0x38fb21=[_0x38fb21];}if(!_[_0x7af3('0x1c')](_0x38fb21)){return _0x4db9cb;}for(var _0x5ccc9b=0x0;_0x5ccc9b<_0x38fb21['length'];_0x5ccc9b+=0x1){_[_0x7af3('0x1f')](_0x4db9cb,_0x38fb21[_0x5ccc9b]);}for(var _0x3fb530 in _0x4db9cb){if(_0x4db9cb['hasOwnProperty'](_0x3fb530)){_0x4db9cb[_0x3fb530]=this[_0x7af3('0x1b')](_0x4db9cb[_0x3fb530],_0x38fb21);}}return _0x4db9cb;};exports[_0x7af3('0x20')]=function(_0x215362){return _0x215362[_0x7af3('0x21')](RegExp(_0x7af3('0x22')))?!![]:![];};exports['isEmail']=function(_0x2dda11){return _0x2dda11[_0x7af3('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0x7af3('0x23')]=function(_0x2cb6d0){var _0x30c656=[];_0x2cb6d0[_0x7af3('0x2')](/[ ,]+/)['forEach'](function(_0x8bb4a6){_0x8bb4a6=_0x8bb4a6[_0x7af3('0x24')](/([^:]")"+/g,'$1');_0x8bb4a6='+'+_0x8bb4a6+'*';if(_0x8bb4a6[_0x7af3('0x25')]('@'))_0x8bb4a6='\x22'+_0x8bb4a6+'\x22';_0x30c656[_0x7af3('0x26')](_0x8bb4a6);});return _0x30c656[_0x7af3('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 32c6169..a556c7c 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e5e=['express','serve-favicon','body-parser','path','passport','cors','moment','./environment','../mysqldb','default','env','production','set','join','public','client','use','json\x20replacer','toISOString','split','static','get','appPath','/server/views','engine','ejs','renderFile','view\x20engine','html','urlencoded','json','50mb','initialize'];(function(_0x305d72,_0x48253a){var _0x34a65e=function(_0x52f925){while(--_0x52f925){_0x305d72['push'](_0x305d72['shift']());}};_0x34a65e(++_0x48253a);}(_0x8e5e,0x1ef));var _0xe8e5=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0x8e5e[_0x2077c2];return _0x312f9f;};'use strict';var express=require(_0xe8e5('0x0'));var favicon=require(_0xe8e5('0x1'));var bodyParser=require(_0xe8e5('0x2'));var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0xe8e5('0x3'));var passport=require(_0xe8e5('0x4'));var cors=require(_0xe8e5('0x5'));var moment=require(_0xe8e5('0x6'));var config=require(_0xe8e5('0x7'));var db=require(_0xe8e5('0x8'))['db'];exports[_0xe8e5('0x9')]=function(_0x5c051e){var _0x5bf361=_0x5c051e['get'](_0xe8e5('0xa'));if(_0x5bf361===_0xe8e5('0xb')){_0x5c051e[_0xe8e5('0xc')]('appPath',path[_0xe8e5('0xd')](config['root'],_0xe8e5('0xe')));}if(_0x5bf361==='development'||_0x5bf361==='test'){_0x5c051e[_0xe8e5('0xc')]('appPath',path[_0xe8e5('0xd')](config['root'],_0xe8e5('0xf')));_0x5c051e[_0xe8e5('0x10')](errorHandler());}_0x5c051e['set'](_0xe8e5('0x11'),function(_0x23dce7,_0x178b10){if(this[_0x23dce7]instanceof Date){_0x178b10=this[_0x23dce7][_0xe8e5('0x12')]()[_0xe8e5('0x13')]('.')[0x0]+'Z';}return _0x178b10;});_0x5c051e[_0xe8e5('0x10')](express[_0xe8e5('0x14')](_0x5c051e[_0xe8e5('0x15')](_0xe8e5('0x16'))));_0x5c051e[_0xe8e5('0xc')]('views',config['root']+_0xe8e5('0x17'));_0x5c051e[_0xe8e5('0x18')]('html',require(_0xe8e5('0x19'))[_0xe8e5('0x1a')]);_0x5c051e['set'](_0xe8e5('0x1b'),_0xe8e5('0x1c'));_0x5c051e[_0xe8e5('0x10')](bodyParser[_0xe8e5('0x1d')]({'limit':'50mb','extended':!![]}));_0x5c051e[_0xe8e5('0x10')](bodyParser[_0xe8e5('0x1e')]({'limit':_0xe8e5('0x1f')}));_0x5c051e[_0xe8e5('0x10')](cors());_0x5c051e[_0xe8e5('0x10')](methodOverride());_0x5c051e[_0xe8e5('0x10')](cookieParser());_0x5c051e[_0xe8e5('0x10')](passport[_0xe8e5('0x20')]());}; \ No newline at end of file +var _0xd171=['env','set','appPath','root','public','development','test','join','client','use','json\x20replacer','split','static','views','html','ejs','renderFile','urlencoded','50mb','json','express','serve-favicon','method-override','cookie-parser','errorhandler','cors','moment','./environment','../mysqldb','default','get'];(function(_0x39a06f,_0x21827e){var _0xdf3fbb=function(_0x47fe16){while(--_0x47fe16){_0x39a06f['push'](_0x39a06f['shift']());}};_0xdf3fbb(++_0x21827e);}(_0xd171,0x12b));var _0x1d17=function(_0x133078,_0x337ba5){_0x133078=_0x133078-0x0;var _0x3aafd1=_0xd171[_0x133078];return _0x3aafd1;};'use strict';var express=require(_0x1d17('0x0'));var favicon=require(_0x1d17('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x1d17('0x2'));var cookieParser=require(_0x1d17('0x3'));var errorHandler=require(_0x1d17('0x4'));var path=require('path');var passport=require('passport');var cors=require(_0x1d17('0x5'));var moment=require(_0x1d17('0x6'));var config=require(_0x1d17('0x7'));var db=require(_0x1d17('0x8'))['db'];exports[_0x1d17('0x9')]=function(_0x5117d1){var _0x1955c0=_0x5117d1[_0x1d17('0xa')](_0x1d17('0xb'));if(_0x1955c0==='production'){_0x5117d1[_0x1d17('0xc')](_0x1d17('0xd'),path['join'](config[_0x1d17('0xe')],_0x1d17('0xf')));}if(_0x1955c0===_0x1d17('0x10')||_0x1955c0===_0x1d17('0x11')){_0x5117d1[_0x1d17('0xc')]('appPath',path[_0x1d17('0x12')](config['root'],_0x1d17('0x13')));_0x5117d1[_0x1d17('0x14')](errorHandler());}_0x5117d1[_0x1d17('0xc')](_0x1d17('0x15'),function(_0x1e7f11,_0x4c3c1d){if(this[_0x1e7f11]instanceof Date){_0x4c3c1d=this[_0x1e7f11]['toISOString']()[_0x1d17('0x16')]('.')[0x0]+'Z';}return _0x4c3c1d;});_0x5117d1[_0x1d17('0x14')](express[_0x1d17('0x17')](_0x5117d1[_0x1d17('0xa')](_0x1d17('0xd'))));_0x5117d1[_0x1d17('0xc')](_0x1d17('0x18'),config[_0x1d17('0xe')]+'/server/views');_0x5117d1['engine'](_0x1d17('0x19'),require(_0x1d17('0x1a'))[_0x1d17('0x1b')]);_0x5117d1[_0x1d17('0xc')]('view\x20engine','html');_0x5117d1['use'](bodyParser[_0x1d17('0x1c')]({'limit':_0x1d17('0x1d'),'extended':!![]}));_0x5117d1['use'](bodyParser[_0x1d17('0x1e')]({'limit':_0x1d17('0x1d')}));_0x5117d1[_0x1d17('0x14')](cors());_0x5117d1['use'](methodOverride());_0x5117d1['use'](cookieParser());_0x5117d1[_0x1d17('0x14')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index b503c26..15c728c 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 _0x331e=['head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','join','md5','update','hex','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','ipAddress','createHash','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat'];(function(_0x58af53,_0x124150){var _0x106629=function(_0x11ba2e){while(--_0x11ba2e){_0x58af53['push'](_0x58af53['shift']());}};_0x106629(++_0x124150);}(_0x331e,0x193));var _0xe331=function(_0x59d692,_0x637365){_0x59d692=_0x59d692-0x0;var _0x13316a=_0x331e[_0x59d692];return _0x13316a;};'use strict';var _=require(_0xe331('0x0'));var os=require('os');var crypto=require(_0xe331('0x1'));var machine=require(_0xe331('0x2'));var exec=require(_0xe331('0x3'))[_0xe331('0x4')];var config=require(_0xe331('0x5'));function getInterfaces(){var _0x4ce742=[];var _0x3f94e0=os[_0xe331('0x6')]();var _0x581e45=_[_0xe331('0x7')](_[_0xe331('0x8')](_0x3f94e0));for(var _0x598cbb=0x0;_0x598cbb<_0x581e45[_0xe331('0x9')];_0x598cbb++){var _0x5989ae=_0x3f94e0[_0x581e45[_0x598cbb]][_0xe331('0xa')](function(_0x3e0e67){return _0x3e0e67[_0xe331('0xb')]===_0xe331('0xc')&&_0x3e0e67[_0xe331('0xd')]===![];});_0x4ce742=_0x4ce742[_0xe331('0xe')](_0x5989ae);}return _0x4ce742;}function getFirstInterface(){var _0x3e9fbc=_[_0xe331('0xf')](getInterfaces());return{'macAddress':_0x3e9fbc&&_0x3e9fbc[_0xe331('0x10')]?_0x3e9fbc[_0xe331('0x10')]:_0xe331('0x11'),'ipAddress':_0x3e9fbc&&_0x3e9fbc[_0xe331('0x12')]?_0x3e9fbc['address']:_0xe331('0x13')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x50f95e=_[_0xe331('0x7')](os[_0xe331('0x14')]()[_0xe331('0x15')](function(_0x2e4e50){return _0x2e4e50['model'];}))[_0xe331('0x16')](':');return crypto['createHash'](_0xe331('0x17'))[_0xe331('0x18')](_0x50f95e)['digest'](_0xe331('0x19'));}exports['getUuid']=function(){var _0x4d238f=os[_0xe331('0x1a')]();var _0x580ebe=/[0-9a-f-]{36}/;if(config[_0xe331('0x1b')]&&_0x580ebe[_0xe331('0x1c')](config[_0xe331('0x1b')])){return config[_0xe331('0x1b')];}else if(_0x4d238f===_0xe331('0x1d')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xe331('0x1e')})[_0xe331('0x1f')]('\x0d\x0a','');}else{var _0xbde197=getFirstInterface();var _0x3299f7=getCPUhash();var _0x1be922=_0x3299f7+'|'+os[_0xe331('0x20')]()+'|'+_0xbde197[_0xe331('0x21')]+'|'+_0xbde197[_0xe331('0x22')];var _0x5d8269=crypto[_0xe331('0x23')](_0xe331('0x17'))[_0xe331('0x18')](_0x1be922)[_0xe331('0x24')](_0xe331('0x19'));return _0x5d8269[_0xe331('0x25')](0x0,0x8)+'-'+_0x5d8269[_0xe331('0x25')](0x8,0xc)+'-'+_0x5d8269[_0xe331('0x25')](0xc,0x10)+'-'+_0x5d8269['substring'](0x10,0x14)+'-'+_0x5d8269[_0xe331('0x25')](0x14);}}; \ No newline at end of file +var _0xf199=['getFirstInterface','cpus','map','join','createHash','md5','update','digest','hex','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','IPv4','concat','head','mac','00:00:00:00:00:00','address'];(function(_0x5d0bf6,_0xbc0514){var _0x39a1a1=function(_0xd637a4){while(--_0xd637a4){_0x5d0bf6['push'](_0x5d0bf6['shift']());}};_0x39a1a1(++_0xbc0514);}(_0xf199,0x1cd));var _0x9f19=function(_0x1badb1,_0x375ec6){_0x1badb1=_0x1badb1-0x0;var _0x260dae=_0xf199[_0x1badb1];return _0x260dae;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x9f19('0x0'));var exec=require(_0x9f19('0x1'))[_0x9f19('0x2')];var config=require(_0x9f19('0x3'));function getInterfaces(){var _0x54ebb0=[];var _0x1a3d6e=os[_0x9f19('0x4')]();var _0x17078f=_[_0x9f19('0x5')](_[_0x9f19('0x6')](_0x1a3d6e));for(var _0x2e0316=0x0;_0x2e0316<_0x17078f[_0x9f19('0x7')];_0x2e0316++){var _0x41b478=_0x1a3d6e[_0x17078f[_0x2e0316]][_0x9f19('0x8')](function(_0x401489){return _0x401489['family']===_0x9f19('0x9')&&_0x401489['internal']===![];});_0x54ebb0=_0x54ebb0[_0x9f19('0xa')](_0x41b478);}return _0x54ebb0;}function getFirstInterface(){var _0x4babf0=_[_0x9f19('0xb')](getInterfaces());return{'macAddress':_0x4babf0&&_0x4babf0['mac']?_0x4babf0[_0x9f19('0xc')]:_0x9f19('0xd'),'ipAddress':_0x4babf0&&_0x4babf0['address']?_0x4babf0[_0x9f19('0xe')]:'127.0.0.1'};}exports[_0x9f19('0xf')]=getFirstInterface;function getCPUhash(){var _0x12155b=_['orderBy'](os[_0x9f19('0x10')]()[_0x9f19('0x11')](function(_0x52340a){return _0x52340a['model'];}))[_0x9f19('0x12')](':');return crypto[_0x9f19('0x13')](_0x9f19('0x14'))[_0x9f19('0x15')](_0x12155b)[_0x9f19('0x16')](_0x9f19('0x17'));}exports['getUuid']=function(){var _0x481b77=os[_0x9f19('0x18')]();var _0x4e6144=/[0-9a-f-]{36}/;if(config[_0x9f19('0x19')]&&_0x4e6144['test'](config[_0x9f19('0x19')])){return config['licenseToken'];}else if(_0x481b77===_0x9f19('0x1a')){return exec(_0x9f19('0x1b'),{'encoding':_0x9f19('0x1c')})[_0x9f19('0x1d')]('\x0d\x0a','');}else{var _0x2b1ad6=getFirstInterface();var _0x5765f3=getCPUhash();var _0x1aeaa8=_0x5765f3+'|'+os[_0x9f19('0x1e')]()+'|'+_0x2b1ad6[_0x9f19('0x1f')]+'|'+_0x2b1ad6[_0x9f19('0x20')];var _0x19edae=crypto[_0x9f19('0x13')]('md5')[_0x9f19('0x15')](_0x1aeaa8)[_0x9f19('0x16')]('hex');return _0x19edae[_0x9f19('0x21')](0x0,0x8)+'-'+_0x19edae[_0x9f19('0x21')](0x8,0xc)+'-'+_0x19edae['substring'](0xc,0x10)+'-'+_0x19edae[_0x9f19('0x21')](0x10,0x14)+'-'+_0x19edae[_0x9f19('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 3e39647..e27f7b6 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 _0xf1e4=['DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','pkginfo','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm','update','decryptString','days'];(function(_0xe11966,_0x455d9d){var _0x2fa7e1=function(_0x5194b8){while(--_0x5194b8){_0xe11966['push'](_0xe11966['shift']());}};_0x2fa7e1(++_0x455d9d);}(_0xf1e4,0x77));var _0x4f1e=function(_0x2c5f65,_0xbde740){_0x2c5f65=_0x2c5f65-0x0;var _0x22f16e=_0xf1e4[_0x2c5f65];return _0x22f16e;};'use strict';var util=require('util');var moment=require(_0x4f1e('0x0'));var rp=require(_0x4f1e('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x4f1e('0x2'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0x4f1e('0x3'));var hardware=require(_0x4f1e('0x4'));var logger=require(_0x4f1e('0x5'))('license');var HOST=_0x4f1e('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4e0849){return new BPromise(function(_0x4cd0c5,_0x5a9176){var _0x19b3aa=util[_0x4f1e('0x7')](_0x4f1e('0x8'),HOST,_0x4e0849,module[_0x4f1e('0x9')][_0x4f1e('0xa')]);if(oldToken){_0x19b3aa=util['format'](_0x4f1e('0xb'),HOST,_0x4e0849,module[_0x4f1e('0x9')]['version'],oldToken);}var _0x1a081d={'uri':_0x19b3aa,'method':_0x4f1e('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x1a081d)['then'](function(_0x5d975d){_0x4cd0c5(_0x5d975d);})[_0x4f1e('0xd')](function(_0x3a0ba){_0x5a9176(_0x3a0ba);});});}function manageLicense(_0x2d3b7e,_0x2ed390){var _0x434dbd=_0x2ed390[_0x4f1e('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x434dbd[_0x4f1e('0xf')]!==_0x2d3b7e&&!_0x434dbd[_0x4f1e('0x10')]){oldToken=_0x434dbd['data1'];}httpRequest(_0x2d3b7e)[_0x4f1e('0x11')](function(_0x2f8402){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2f8402['active']){isOldTokenSent=![];if(!_0x434dbd['license']&&_0x434dbd[_0x4f1e('0x12')]!=_0x2f8402['license']||_0x434dbd[_0x4f1e('0x12')]&&_0x434dbd['data2']){logger[_0x4f1e('0x13')](_0x4f1e('0x14'));}if(_0x434dbd['license']&&!_0x434dbd[_0x4f1e('0x10')]&&_0x434dbd[_0x4f1e('0x12')]!=_0x2f8402[_0x4f1e('0x12')]){logger[_0x4f1e('0x13')](_0x4f1e('0x15'));}if(_0x434dbd['license']&&!_0x434dbd[_0x4f1e('0x10')]&&_0x434dbd[_0x4f1e('0x12')]==_0x2f8402['license']){return _0x2ed390;}return _0x2ed390['update']({'data1':_0x2d3b7e,'data2':null,'license':_0x2f8402[_0x4f1e('0x12')]});}else{if(_0x2f8402[_0x4f1e('0x12')]||_0x434dbd['license']){if(!_0x434dbd[_0x4f1e('0x10')]){if(_0x434dbd[_0x4f1e('0xf')]==_0x2d3b7e){GRAY_PERIOD_REASON=_0x4f1e('0x16');logger[_0x4f1e('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x4f1e('0x17');logger['info'](_0x4f1e('0x18'),_0x434dbd['data1'],_0x2d3b7e);}logger[_0x4f1e('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x4f1e('0x7')](_0x4f1e('0x19')));return _0x2ed390[_0x4f1e('0x1a')]({'data2':encryptor['encryptString'](moment()[_0x4f1e('0x7')](_0x4f1e('0x19')))});}else{if(moment()['diff'](encryptor[_0x4f1e('0x1b')](_0x434dbd[_0x4f1e('0x10')]),_0x4f1e('0x1c'))>DAYS){logger[_0x4f1e('0x13')](_0x4f1e('0x1d'),moment()['format'](_0x4f1e('0x19')));isOldTokenSent=![];return _0x2ed390[_0x4f1e('0x1a')]({'data1':_0x2d3b7e,'data2':null,'license':null});}}}else{if(_0x434dbd[_0x4f1e('0xf')]!=_0x2d3b7e){logger[_0x4f1e('0x13')](_0x4f1e('0x18'),_0x434dbd[_0x4f1e('0xf')],_0x2d3b7e);return _0x2ed390[_0x4f1e('0x1a')]({'data1':_0x2d3b7e,'data2':null,'license':null});}}}return _0x2ed390;})['then'](function(_0x1a3958){_0x2ed390=_0x1a3958;})[_0x4f1e('0xd')](function(_0x3f1acb){logger[_0x4f1e('0x1e')](_0x3f1acb[_0x4f1e('0x1f')]);})[_0x4f1e('0x20')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2ed390);},TIME);});}function defaultLicense(){var _0x4d5b7d=hardware[_0x4f1e('0x21')]();if(_0x4d5b7d){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x4d5b7d}})[_0x4f1e('0x22')](function(_0x184032,_0x34fd41){logger[_0x4f1e('0x13')](_0x4f1e('0x23'),_0x4d5b7d);manageLicense(_0x4d5b7d,_0x184032);})[_0x4f1e('0xd')](function(_0xcb39c5){logger['error'](_0xcb39c5['message']);});}}exports[_0x4f1e('0x24')]=defaultLicense; \ No newline at end of file +var _0x094a=['Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','message','finally','getUuid','error','default','moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','GET','then','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x2bc0cb,_0x544a0){var _0x4739c0=function(_0x168f58){while(--_0x168f58){_0x2bc0cb['push'](_0x2bc0cb['shift']());}};_0x4739c0(++_0x544a0);}(_0x094a,0xc5));var _0xa094=function(_0x59434c,_0x18f9c5){_0x59434c=_0x59434c-0x0;var _0x22c479=_0x094a[_0x59434c];return _0x22c479;};'use strict';var util=require('util');var moment=require(_0xa094('0x0'));var rp=require(_0xa094('0x1'));var BPromise=require(_0xa094('0x2'));var pkginfo=require(_0xa094('0x3'))(module,'version');var db=require(_0xa094('0x4'))['db'];var encryptor=require(_0xa094('0x5'));var hardware=require(_0xa094('0x6'));var logger=require(_0xa094('0x7'))(_0xa094('0x8'));var HOST=_0xa094('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x252b60){return new BPromise(function(_0xaf77a0,_0xdbd82){var _0x11f321=util[_0xa094('0xa')](_0xa094('0xb'),HOST,_0x252b60,module[_0xa094('0xc')][_0xa094('0xd')]);if(oldToken){_0x11f321=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x252b60,module[_0xa094('0xc')][_0xa094('0xd')],oldToken);}var _0x275aa8={'uri':_0x11f321,'method':_0xa094('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x275aa8)[_0xa094('0xf')](function(_0x36d277){_0xaf77a0(_0x36d277);})[_0xa094('0x10')](function(_0x1a781e){_0xdbd82(_0x1a781e);});});}function manageLicense(_0x1a1373,_0x3ad483){var _0x29956b=_0x3ad483['get']({'plain':!![]});if(!isOldTokenSent&&_0x29956b[_0xa094('0x11')]!==_0x1a1373&&!_0x29956b[_0xa094('0x12')]){oldToken=_0x29956b[_0xa094('0x11')];}httpRequest(_0x1a1373)[_0xa094('0xf')](function(_0x26bfe1){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x26bfe1[_0xa094('0x13')]){isOldTokenSent=![];if(!_0x29956b['license']&&_0x29956b['license']!=_0x26bfe1[_0xa094('0x8')]||_0x29956b[_0xa094('0x8')]&&_0x29956b['data2']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x29956b['license']&&!_0x29956b['data2']&&_0x29956b[_0xa094('0x8')]!=_0x26bfe1[_0xa094('0x8')]){logger[_0xa094('0x14')](_0xa094('0x15'));}if(_0x29956b[_0xa094('0x8')]&&!_0x29956b[_0xa094('0x12')]&&_0x29956b[_0xa094('0x8')]==_0x26bfe1[_0xa094('0x8')]){return _0x3ad483;}return _0x3ad483[_0xa094('0x16')]({'data1':_0x1a1373,'data2':null,'license':_0x26bfe1[_0xa094('0x8')]});}else{if(_0x26bfe1[_0xa094('0x8')]||_0x29956b['license']){if(!_0x29956b[_0xa094('0x12')]){if(_0x29956b[_0xa094('0x11')]==_0x1a1373){GRAY_PERIOD_REASON=_0xa094('0x17');logger[_0xa094('0x14')](_0xa094('0x18'));}else{GRAY_PERIOD_REASON=_0xa094('0x19');logger[_0xa094('0x14')](_0xa094('0x1a'),_0x29956b[_0xa094('0x11')],_0x1a1373);}logger[_0xa094('0x14')](_0xa094('0x1b'),GRAY_PERIOD_REASON[_0xa094('0x1c')](),moment()['format'](_0xa094('0x1d')));return _0x3ad483[_0xa094('0x16')]({'data2':encryptor[_0xa094('0x1e')](moment()['format'](_0xa094('0x1d')))});}else{if(moment()['diff'](encryptor[_0xa094('0x1f')](_0x29956b[_0xa094('0x12')]),'days')>DAYS){logger[_0xa094('0x14')]('DEMO\x20START\x20AT\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x3ad483[_0xa094('0x16')]({'data1':_0x1a1373,'data2':null,'license':null});}}}else{if(_0x29956b[_0xa094('0x11')]!=_0x1a1373){logger[_0xa094('0x14')](_0xa094('0x1a'),_0x29956b['data1'],_0x1a1373);return _0x3ad483[_0xa094('0x16')]({'data1':_0x1a1373,'data2':null,'license':null});}}}return _0x3ad483;})[_0xa094('0xf')](function(_0x1f56e8){_0x3ad483=_0x1f56e8;})[_0xa094('0x10')](function(_0x357354){logger['error'](_0x357354[_0xa094('0x20')]);})[_0xa094('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xa094('0x22')](),_0x3ad483);},TIME);});}function defaultLicense(){var _0xb9d786=hardware[_0xa094('0x22')]();if(_0xb9d786){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0xb9d786}})['spread'](function(_0x4278af,_0x1aef75){logger[_0xa094('0x14')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0xb9d786);manageLicense(_0xb9d786,_0x4278af);})[_0xa094('0x10')](function(_0x4b4f21){logger[_0xa094('0x23')](_0x4b4f21[_0xa094('0x20')]);});}}exports[_0xa094('0x24')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 60ddaae..486d447 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 _0x3880=['deadline','add','days','grayReason','disabled','message','User','role','sequelize','COUNT','col','count','admin','user','users','forEach','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','defaults','then','catch','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x3880,0xa9));var _0x0388=function(_0x46c537,_0x59c781){_0x46c537=_0x46c537-0x0;var _0xc6e5a4=_0x3880[_0x46c537];return _0xc6e5a4;};'use strict';var util=require(_0x0388('0x0'));var _=require(_0x0388('0x1'));var moment=require(_0x0388('0x2'));var BPromise=require(_0x0388('0x3'));var hardware=require(_0x0388('0x4'));var encryptor=require(_0x0388('0x5'));var db=require(_0x0388('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0388('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x0388('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0388('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0388('0x9'),'machineUuid':hardware[_0x0388('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5d6884){return new BPromise(function(_0x12d707,_0x32dcf2){return db[_0x0388('0xa')]['find'](_[_0x0388('0xb')](_0x5d6884,{'raw':!![],'where':{'id':0x1}}))[_0x0388('0xc')](function(_0x3fc3f9){return checkLicense(_0x3fc3f9,null);})[_0x0388('0xc')](function(_0x235fe2){_0x12d707(_0x235fe2);return;})[_0x0388('0xd')](function(_0x8d4e2c){_0x32dcf2(_0x8d4e2c);});});}function checkLicense(_0x572726,_0x5dd276){if(!_0x572726){demoLicense['uuid']=_0x572726[_0x0388('0xe')];return demoLicense;}try{var _0x233ab9=_0x5dd276||_0x572726[_0x0388('0xf')];if(_['isEmpty'](_0x233ab9)){throw new Error(_0x0388('0x10'));}var _0x1b02dc=_0x572726[_0x0388('0xe')];var _0x5b420c=_0x572726[_0x0388('0x11')];var _0x5e24c0=_0x1b02dc[_0x0388('0x12')]('-')[0x4];var _0x402003=_0x1b02dc['split']('-')[0x0];var _0x29ce33=encryptor[_0x0388('0x13')](_0x233ab9,util[_0x0388('0x14')](_0x0388('0x15'),_0x5e24c0,_0x1b02dc,_0x402003));var _0x4201bb=JSON[_0x0388('0x16')](_0x29ce33);_0x4201bb[_0x0388('0x17')]=![];_0x4201bb[_0x0388('0x18')]=_0x1b02dc;_0x4201bb[_0x0388('0x19')]=hardware[_0x0388('0x8')]();if(_0x5b420c){var _0x44744d=encryptor[_0x0388('0x13')](_0x5b420c);_0x4201bb[_0x0388('0x1a')]=_0x44744d;_0x4201bb[_0x0388('0x1b')]=moment(_0x44744d)[_0x0388('0x1c')](0x7,_0x0388('0x1d'))[_0x0388('0x14')]();_0x4201bb[_0x0388('0x1e')]=_0x4201bb['uuid']!=_0x4201bb[_0x0388('0x19')]?'changed':_0x0388('0x1f');}return _0x4201bb;}catch(_0x4d9d8f){breakingLicense['uuid']=_0x572726[_0x0388('0xe')];breakingLicense['message']=_0x4d9d8f[_0x0388('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x49dfa2,_0xfbb7af){getLicense()[_0x0388('0xc')](function(_0x59f205){return db[_0x0388('0x21')]['findAll']({'attributes':[_0x0388('0x22'),[db[_0x0388('0x23')]['fn'](_0x0388('0x24'),db[_0x0388('0x23')][_0x0388('0x25')](_0x0388('0x22'))),_0x0388('0x26')]],'group':_0x0388('0x22'),'where':{'role':{'$or':[_0x0388('0x27'),_0x0388('0x28'),'telephone']}},'raw':!![]})[_0x0388('0xc')](function(_0x1e8c96){var _0x2ca990={'user':_0x59f205[_0x0388('0x29')]||0x0,'telephone':_0x59f205['telephones']||0x0};_0x1e8c96[_0x0388('0x2a')](function(_0x17e2a5){var _0x4989ff=_0x17e2a5[_0x0388('0x22')]==='admin'?_0x0388('0x28'):_0x17e2a5[_0x0388('0x22')];_0x2ca990[_0x4989ff]-=_0x17e2a5[_0x0388('0x26')];if(_0x2ca990[_0x4989ff]<0x0)_0x2ca990[_0x4989ff]=0x0;});_0x49dfa2(_0x2ca990);return;});})[_0x0388('0xd')](function(_0x4056e6){_0xfbb7af(_0x4056e6);});});}function checkUserLimits(_0x3582ac){return new BPromise(function(_0xdf11aa,_0x54fde4){getLimits()[_0x0388('0xc')](function(_0x43820f){var _0x5e0f2d=_[_0x0388('0x2b')](_[_0x0388('0x2c')](_0x3582ac,_0x0388('0x22')),[_0x0388('0x27'),_0x0388('0x28'),_0x0388('0x2d')]);var _0x303f40=(_0x5e0f2d[_0x0388('0x27')]||0x0)+(_0x5e0f2d['user']||0x0);var _0x1a648e=_0x5e0f2d[_0x0388('0x2d')]||0x0;if(_0x303f40>_0x43820f[_0x0388('0x28')])return _0x54fde4(_0x0388('0x2e'));if(_0x1a648e>_0x43820f[_0x0388('0x2d')])return _0x54fde4(_0x0388('0x2f'));return _0xdf11aa();})[_0x0388('0xd')](function(_0x398292){_0x54fde4(_0x398292);});});}module[_0x0388('0x30')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xcaee=['isEmpty','data1','decryptString','parse','machineUuid','gray','deadline','add','days','format','grayReason','changed','disabled','message','role','sequelize','COUNT','col','count','admin','telephones','forEach','user','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','license'];(function(_0x2a1dd1,_0x3794df){var _0x132c45=function(_0x42b666){while(--_0x42b666){_0x2a1dd1['push'](_0x2a1dd1['shift']());}};_0x132c45(++_0x3794df);}(_0xcaee,0x1aa));var _0xecae=function(_0x563e2d,_0x552fb9){_0x563e2d=_0x563e2d-0x0;var _0x4fd627=_0xcaee[_0x563e2d];return _0x4fd627;};'use strict';var util=require(_0xecae('0x0'));var _=require(_0xecae('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0xecae('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0xecae('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xecae('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xecae('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xecae('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xecae('0x6'),'machineUuid':hardware[_0xecae('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x697c1f){return new BPromise(function(_0x56afc5,_0x186608){return db[_0xecae('0x7')][_0xecae('0x8')](_[_0xecae('0x9')](_0x697c1f,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x422b9a){return checkLicense(_0x422b9a,null);})[_0xecae('0xa')](function(_0x4748b8){_0x56afc5(_0x4748b8);return;})[_0xecae('0xb')](function(_0x535db8){_0x186608(_0x535db8);});});}function checkLicense(_0x1fca4d,_0x5ba465){if(!_0x1fca4d){demoLicense[_0xecae('0xc')]=_0x1fca4d['data1'];return demoLicense;}try{var _0x2dbd54=_0x5ba465||_0x1fca4d[_0xecae('0xd')];if(_[_0xecae('0xe')](_0x2dbd54)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x3f83d1=_0x1fca4d[_0xecae('0xf')];var _0x240bed=_0x1fca4d['data2'];var _0x3f9677=_0x3f83d1['split']('-')[0x4];var _0x3434c9=_0x3f83d1['split']('-')[0x0];var _0x5527c5=encryptor[_0xecae('0x10')](_0x2dbd54,util['format']('%s:%s:%s',_0x3f9677,_0x3f83d1,_0x3434c9));var _0x37f63a=JSON[_0xecae('0x11')](_0x5527c5);_0x37f63a['demo']=![];_0x37f63a[_0xecae('0xc')]=_0x3f83d1;_0x37f63a[_0xecae('0x12')]=hardware[_0xecae('0x5')]();if(_0x240bed){var _0x1caa57=encryptor[_0xecae('0x10')](_0x240bed);_0x37f63a[_0xecae('0x13')]=_0x1caa57;_0x37f63a[_0xecae('0x14')]=moment(_0x1caa57)[_0xecae('0x15')](0x7,_0xecae('0x16'))[_0xecae('0x17')]();_0x37f63a[_0xecae('0x18')]=_0x37f63a['uuid']!=_0x37f63a['machineUuid']?_0xecae('0x19'):_0xecae('0x1a');}return _0x37f63a;}catch(_0x5b1926){breakingLicense['uuid']=_0x1fca4d['data1'];breakingLicense['message']=_0x5b1926[_0xecae('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x793ed1,_0x4b4a48){getLicense()[_0xecae('0xa')](function(_0x177645){return db['User']['findAll']({'attributes':[_0xecae('0x1c'),[db[_0xecae('0x1d')]['fn'](_0xecae('0x1e'),db[_0xecae('0x1d')][_0xecae('0x1f')]('role')),_0xecae('0x20')]],'group':_0xecae('0x1c'),'where':{'role':{'$or':[_0xecae('0x21'),'user','telephone']}},'raw':!![]})[_0xecae('0xa')](function(_0x555040){var _0x29eadf={'user':_0x177645['users']||0x0,'telephone':_0x177645[_0xecae('0x22')]||0x0};_0x555040[_0xecae('0x23')](function(_0x2fab39){var _0x43d764=_0x2fab39['role']===_0xecae('0x21')?_0xecae('0x24'):_0x2fab39[_0xecae('0x1c')];_0x29eadf[_0x43d764]-=_0x2fab39['count'];if(_0x29eadf[_0x43d764]<0x0)_0x29eadf[_0x43d764]=0x0;});_0x793ed1(_0x29eadf);return;});})[_0xecae('0xb')](function(_0x24ad83){_0x4b4a48(_0x24ad83);});});}function checkUserLimits(_0x38f808){return new BPromise(function(_0x25911d,_0x2e5f4){getLimits()['then'](function(_0x469fd9){var _0x3f900d=_['pick'](_['countBy'](_0x38f808,_0xecae('0x1c')),['admin','user','telephone']);var _0x2b12d6=(_0x3f900d[_0xecae('0x21')]||0x0)+(_0x3f900d[_0xecae('0x24')]||0x0);var _0x34ba80=_0x3f900d[_0xecae('0x25')]||0x0;if(_0x2b12d6>_0x469fd9[_0xecae('0x24')])return _0x2e5f4(_0xecae('0x26'));if(_0x34ba80>_0x469fd9[_0xecae('0x25')])return _0x2e5f4(_0xecae('0x27'));return _0x25911d();})[_0xecae('0xb')](function(_0x176b02){_0x2e5f4(_0x176b02);});});}module['exports']={'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 cc7d404..a7d5791 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 _0xbfd5=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xbfd5,0x1dc));var _0x5bfd=function(_0x4661cd,_0x5b219c){_0x4661cd=_0x4661cd-0x0;var _0x309ec7=_0xbfd5[_0x4661cd];return _0x309ec7;};'use strict';module[_0x5bfd('0x0')]={'DOMAIN':_0x5bfd('0x1'),'SESSION_SECRET':_0x5bfd('0x2'),'GOOGLE_ID':_0x5bfd('0x3'),'GOOGLE_SECRET':_0x5bfd('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xc69d=['http://localhost:9000','myappanuglar-secret','exports'];(function(_0xe1a08e,_0x5605f5){var _0x512e17=function(_0x163f51){while(--_0x163f51){_0xe1a08e['push'](_0xe1a08e['shift']());}};_0x512e17(++_0x5605f5);}(_0xc69d,0x10a));var _0xdc69=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xc69d[_0x173d7e];return _0x2220d6;};'use strict';module[_0xdc69('0x0')]={'DOMAIN':_0xdc69('0x1'),'SESSION_SECRET':_0xdc69('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 1437abb..0ed124b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2990=['Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','util','path','INFO','/var','log','format','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x2990,0x1a9));var _0x0299=function(_0x190bb7,_0xb14d44){_0x190bb7=_0x190bb7-0x0;var _0x447f1a=_0x2990[_0x190bb7];return _0x447f1a;};'use strict';var moment=require(_0x0299('0x0'));var winston=require(_0x0299('0x1'));var util=require(_0x0299('0x2'));var path=require(_0x0299('0x3'));var debugLevel=_0x0299('0x4');function filename(_0x67e8c2,_0x2721a3){return path['join'](_0x0299('0x5'),_0x0299('0x6'),'xcally',util[_0x0299('0x7')](_0x0299('0x8'),_0x67e8c2,_0x2721a3));}function formatter(_0x3b7f8f,_0xd5805e){_0xd5805e[_0x0299('0x9')]=_0xd5805e['message'][_0x0299('0xa')](/@@{/g,_0x0299('0xb'))[_0x0299('0xa')](/}@@/g,'}}}')[_0x0299('0xa')](/@{/g,'{{')[_0x0299('0xa')](/}@/g,'}}');return util['format'](_0x0299('0xc'),moment()[_0x0299('0x7')](_0x0299('0xd')),_0xd5805e[_0x0299('0xe')][_0x0299('0xf')](),_0x3b7f8f,_0xd5805e[_0x0299('0x9')]);}module[_0x0299('0x10')]=function(_0x5296a3){return new winston[(_0x0299('0x11'))]({'transports':[new winston[(_0x0299('0x12'))][(_0x0299('0x13'))]({'name':util['format'](_0x0299('0x14'),_0x5296a3,_0x0299('0x15')),'filename':filename(_0x5296a3,_0x0299('0x15')),'level':_0x0299('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x38b5ca){return formatter(_0x5296a3,_0x38b5ca);}}),new winston[(_0x0299('0x12'))][(_0x0299('0x13'))]({'name':util[_0x0299('0x7')]('%s-%s',_0x5296a3,'info'),'filename':filename(_0x5296a3,_0x0299('0x16')),'level':_0x0299('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x517fac){return formatter(_0x5296a3,_0x517fac);}}),new winston[(_0x0299('0x12'))][(_0x0299('0x17'))]({'level':process[_0x0299('0x18')][_0x0299('0x19')]||debugLevel,'json':![],'formatter':function(_0x27b087){return formatter(_0x5296a3,_0x27b087);}})]});}; \ No newline at end of file +var _0x6fac=['[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','Logger','transports','File','%s-%s','error','info','env','debugLevel','moment','util','path','INFO','join','/var','log','format','%s-%s.log','message','replace','}}}'];(function(_0x1a8b58,_0x2c6665){var _0x3fa938=function(_0xc93616){while(--_0xc93616){_0x1a8b58['push'](_0x1a8b58['shift']());}};_0x3fa938(++_0x2c6665);}(_0x6fac,0x1c2));var _0xc6fa=function(_0xe4058e,_0x41b9af){_0xe4058e=_0xe4058e-0x0;var _0x521f42=_0x6fac[_0xe4058e];return _0x521f42;};'use strict';var moment=require(_0xc6fa('0x0'));var winston=require('winston');var util=require(_0xc6fa('0x1'));var path=require(_0xc6fa('0x2'));var debugLevel=_0xc6fa('0x3');function filename(_0x11ac39,_0x2ee901){return path[_0xc6fa('0x4')](_0xc6fa('0x5'),_0xc6fa('0x6'),'xcally',util[_0xc6fa('0x7')](_0xc6fa('0x8'),_0x11ac39,_0x2ee901));}function formatter(_0x227ecb,_0x5a0529){_0x5a0529[_0xc6fa('0x9')]=_0x5a0529[_0xc6fa('0x9')][_0xc6fa('0xa')](/@@{/g,'{{{')['replace'](/}@@/g,_0xc6fa('0xb'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xc6fa('0x7')](_0xc6fa('0xc'),moment()[_0xc6fa('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0x5a0529['level'][_0xc6fa('0xd')](),_0x227ecb,_0x5a0529['message']);}module['exports']=function(_0x204ba1){return new winston[(_0xc6fa('0xe'))]({'transports':[new winston[(_0xc6fa('0xf'))][(_0xc6fa('0x10'))]({'name':util[_0xc6fa('0x7')](_0xc6fa('0x11'),_0x204ba1,_0xc6fa('0x12')),'filename':filename(_0x204ba1,_0xc6fa('0x12')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x522f67){return formatter(_0x204ba1,_0x522f67);}}),new winston[(_0xc6fa('0xf'))][(_0xc6fa('0x10'))]({'name':util[_0xc6fa('0x7')]('%s-%s',_0x204ba1,'info'),'filename':filename(_0x204ba1,_0xc6fa('0x13')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x207aaf){return formatter(_0x204ba1,_0x207aaf);}}),new winston[(_0xc6fa('0xf'))]['Console']({'level':process[_0xc6fa('0x14')][_0xc6fa('0x15')]||debugLevel,'json':![],'formatter':function(_0xe8a8c9){return formatter(_0x204ba1,_0xe8a8c9);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index a019898..09ace33 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 _0xfc9c=['../../services/email/index.js','routing','xdr','../../services/xdr/index.js','path','express','../../services/express/index.js','join','../../services/ami/index.js','agi','email'];(function(_0x4e1263,_0x663193){var _0xc97604=function(_0x28dab5){while(--_0x28dab5){_0x4e1263['push'](_0x4e1263['shift']());}};_0xc97604(++_0x663193);}(_0xfc9c,0xb4));var _0xcfc9=function(_0x43ebe6,_0x4d6a5){_0x43ebe6=_0x43ebe6-0x0;var _0x5be9de=_0xfc9c[_0x43ebe6];return _0x5be9de;};'use strict';var path=require(_0xcfc9('0x0'));var os=require('os');var config={'apps':[{'name':_0xcfc9('0x1'),'script':path['join'](__dirname,_0xcfc9('0x2'))},{'name':'ami','script':path[_0xcfc9('0x3')](__dirname,_0xcfc9('0x4'))},{'name':_0xcfc9('0x5'),'script':path[_0xcfc9('0x3')](__dirname,'../../services/agi/index.js')},{'name':_0xcfc9('0x6'),'script':path[_0xcfc9('0x3')](__dirname,_0xcfc9('0x7'))},{'name':_0xcfc9('0x8'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':_0xcfc9('0x9'),'script':path[_0xcfc9('0x3')](__dirname,_0xcfc9('0xa'))}]};module['exports']=config; \ No newline at end of file +var _0x7b78=['../../services/email/index.js','routing','xdr','../../services/xdr/index.js','path','express','join','ami','../../services/ami/index.js','../../services/agi/index.js','email'];(function(_0x4d507f,_0x2298e0){var _0x4ccc37=function(_0x1a5d37){while(--_0x1a5d37){_0x4d507f['push'](_0x4d507f['shift']());}};_0x4ccc37(++_0x2298e0);}(_0x7b78,0x185));var _0x87b7=function(_0x49d6af,_0x494092){_0x49d6af=_0x49d6af-0x0;var _0x3d223a=_0x7b78[_0x49d6af];return _0x3d223a;};'use strict';var path=require(_0x87b7('0x0'));var os=require('os');var config={'apps':[{'name':_0x87b7('0x1'),'script':path[_0x87b7('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x87b7('0x3'),'script':path['join'](__dirname,_0x87b7('0x4'))},{'name':'agi','script':path[_0x87b7('0x2')](__dirname,_0x87b7('0x5'))},{'name':_0x87b7('0x6'),'script':path[_0x87b7('0x2')](__dirname,_0x87b7('0x7'))},{'name':_0x87b7('0x8'),'script':path[_0x87b7('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x87b7('0x9'),'script':path['join'](__dirname,_0x87b7('0xa'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index d6d840a..71f10e3 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 _0x3a16=['stop','restart','list','describe','delete','dump','pm2','connect','connected','start','then','disconnect'];(function(_0x2b411b,_0x3d8a1e){var _0x49961e=function(_0x10cf45){while(--_0x10cf45){_0x2b411b['push'](_0x2b411b['shift']());}};_0x49961e(++_0x3d8a1e);}(_0x3a16,0x192));var _0x63a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a16[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0x63a1('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0xb8c70c,_0x12e735){return pm2[_0x63a1('0x1')](function(_0x57f561){if(_0x57f561){return _0x12e735(_0x57f561);}return _0xb8c70c(_0x63a1('0x2'));});});};exports[_0x63a1('0x3')]=function(_0x397176){return connect()[_0x63a1('0x4')](function(){return new BPromise(function(_0x108979,_0x392dce){return pm2[_0x63a1('0x3')](_0x397176,function(_0x567f5c,_0x5a4e22){if(_0x567f5c){return _0x392dce(_0x567f5c);}pm2[_0x63a1('0x5')]();return _0x108979(_0x5a4e22);});});});};exports[_0x63a1('0x6')]=function(_0x18472d){return connect()['then'](function(){return new BPromise(function(_0x46ed77,_0x307bed){return pm2[_0x63a1('0x6')](_0x18472d,function(_0x43725c,_0x5c5232){if(_0x43725c){return _0x307bed(_0x43725c);}pm2['disconnect']();return _0x46ed77(_0x5c5232);});});});};exports[_0x63a1('0x7')]=function(_0x33b74a){return connect()[_0x63a1('0x4')](function(){return new BPromise(function(_0x1aac4f,_0x4f9746){return pm2['restart'](_0x33b74a,function(_0x1433b4,_0x2f7073){if(_0x1433b4){return _0x4f9746(_0x1433b4);}pm2[_0x63a1('0x5')]();return _0x1aac4f(_0x2f7073);});});});};exports['list']=function(){return connect()[_0x63a1('0x4')](function(){return new BPromise(function(_0x54d69c,_0x1ac6d9){return pm2[_0x63a1('0x8')](function(_0x54ac77,_0x2afe60){if(_0x54ac77){return _0x1ac6d9(_0x54ac77);}pm2[_0x63a1('0x5')]();return _0x54d69c(_0x2afe60);});});});};exports[_0x63a1('0x9')]=function(_0x321df5){return connect()[_0x63a1('0x4')](function(){return new BPromise(function(_0x65884e,_0x29b393){return pm2['describe'](_0x321df5,function(_0x522dfa,_0x9c2f87){if(_0x522dfa){return _0x29b393(_0x522dfa);}pm2[_0x63a1('0x5')]();return _0x65884e(_0x9c2f87);});});});};exports[_0x63a1('0xa')]=function(_0x4b9c58){return connect()['then'](function(){return new BPromise(function(_0x513352,_0x421fd0){return pm2['delete'](_0x4b9c58,function(_0xc7b8cd,_0x432aeb){if(_0xc7b8cd){return _0x421fd0(_0xc7b8cd);}pm2[_0x63a1('0x5')]();return _0x513352(_0x432aeb);});});});};exports[_0x63a1('0xb')]=function(){return connect()[_0x63a1('0x4')](function(){return new BPromise(function(_0x1679b4,_0x4e2610){return pm2[_0x63a1('0xb')](function(_0x9b47e2){if(_0x9b47e2){return _0x4e2610(_0x9b47e2);}return _0x1679b4('saved');});});});}; \ No newline at end of file +var _0x1c3d=['restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connected','start','then','disconnect','stop'];(function(_0x14377b,_0x49b341){var _0x1830ca=function(_0x2da2ee){while(--_0x2da2ee){_0x14377b['push'](_0x14377b['shift']());}};_0x1830ca(++_0x49b341);}(_0x1c3d,0x68));var _0xd1c3=function(_0x12dab4,_0x546844){_0x12dab4=_0x12dab4-0x0;var _0x1a90a7=_0x1c3d[_0x12dab4];return _0x1a90a7;};'use strict';var pm2=require(_0xd1c3('0x0'));var BPromise=require(_0xd1c3('0x1'));var config=require(_0xd1c3('0x2'));function connect(){return new BPromise(function(_0x14d253,_0x2c7ce0){return pm2['connect'](function(_0xead51e){if(_0xead51e){return _0x2c7ce0(_0xead51e);}return _0x14d253(_0xd1c3('0x3'));});});};exports[_0xd1c3('0x4')]=function(_0x2919df){return connect()[_0xd1c3('0x5')](function(){return new BPromise(function(_0x206ce5,_0xa5b3ec){return pm2[_0xd1c3('0x4')](_0x2919df,function(_0x2721cf,_0x443ebd){if(_0x2721cf){return _0xa5b3ec(_0x2721cf);}pm2[_0xd1c3('0x6')]();return _0x206ce5(_0x443ebd);});});});};exports[_0xd1c3('0x7')]=function(_0x82eab8){return connect()['then'](function(){return new BPromise(function(_0x2fa81e,_0x20d86c){return pm2[_0xd1c3('0x7')](_0x82eab8,function(_0x24e858,_0xffed77){if(_0x24e858){return _0x20d86c(_0x24e858);}pm2[_0xd1c3('0x6')]();return _0x2fa81e(_0xffed77);});});});};exports[_0xd1c3('0x8')]=function(_0x12ba06){return connect()[_0xd1c3('0x5')](function(){return new BPromise(function(_0x52d31e,_0x58391d){return pm2['restart'](_0x12ba06,function(_0x5a6ae2,_0x3889f4){if(_0x5a6ae2){return _0x58391d(_0x5a6ae2);}pm2[_0xd1c3('0x6')]();return _0x52d31e(_0x3889f4);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x537eae,_0x2bf361){return pm2[_0xd1c3('0x9')](function(_0x47cf3d,_0x413257){if(_0x47cf3d){return _0x2bf361(_0x47cf3d);}pm2[_0xd1c3('0x6')]();return _0x537eae(_0x413257);});});});};exports[_0xd1c3('0xa')]=function(_0x1716f7){return connect()['then'](function(){return new BPromise(function(_0x51ab1a,_0xd839c3){return pm2[_0xd1c3('0xa')](_0x1716f7,function(_0x5df0d4,_0x5ae3b1){if(_0x5df0d4){return _0xd839c3(_0x5df0d4);}pm2[_0xd1c3('0x6')]();return _0x51ab1a(_0x5ae3b1);});});});};exports[_0xd1c3('0xb')]=function(_0x1b8333){return connect()['then'](function(){return new BPromise(function(_0x5c6382,_0x474791){return pm2[_0xd1c3('0xb')](_0x1b8333,function(_0x798c0f,_0x466850){if(_0x798c0f){return _0x474791(_0x798c0f);}pm2[_0xd1c3('0x6')]();return _0x5c6382(_0x466850);});});});};exports[_0xd1c3('0xc')]=function(){return connect()[_0xd1c3('0x5')](function(){return new BPromise(function(_0x1af960,_0x14a126){return pm2[_0xd1c3('0xc')](function(_0x42a12e){if(_0x42a12e){return _0x14a126(_0x42a12e);}return _0x1af960(_0xd1c3('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index ff580bc..280a609 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 _0x39f0=['find','chatTimeout','ChatInteraction','lastMsgAt','minutes','then','length','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','chatInteraction:update','catch','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','redis','defaults','localhost','socket.io-emitter','Setting'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x39f0,0x10c));var _0x039f=function(_0x49dee5,_0x42bba6){_0x49dee5=_0x49dee5-0x0;var _0x55ca60=_0x39f0[_0x49dee5];return _0x55ca60;};'use strict';var _=require(_0x039f('0x0'));var moment=require(_0x039f('0x1'));var Redis=require(_0x039f('0x2'));var util=require(_0x039f('0x3'));var config=require(_0x039f('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x039f('0x5'))('schedule');config[_0x039f('0x6')]=_[_0x039f('0x7')](config['redis'],{'host':_0x039f('0x8'),'port':0x18eb});var io=require(_0x039f('0x9'))(new Redis(config[_0x039f('0x6')]));function closeInteractions(){var _0x117f9a=0x0;var _0x49a103=[];return db[_0x039f('0xa')][_0x039f('0xb')]({'raw':!![],'attributes':['id',_0x039f('0xc')],'where':{'id':0x1}})['then'](function(_0x41feb2){_0x117f9a=_0x41feb2['chatTimeout'];if(_0x117f9a){return db[_0x039f('0xd')]['findAll']({'raw':!![],'attributes':['id',_0x039f('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x41feb2[_0x039f('0xc')],_0x039f('0xf'))}}});}else{return[];}})[_0x039f('0x10')](function(_0x3e16a0){if(_0x3e16a0&&_0x3e16a0[_0x039f('0x11')]){_0x49a103=_['map'](_0x3e16a0||[],'id');logger[_0x039f('0x12')](_0x039f('0x13'),_0x49a103['join']());return db['ChatInteraction'][_0x039f('0x14')]({'closeReason':_0x039f('0x15'),'disposition':_0x039f('0x16'),'closed':!![],'closedAt':moment()[_0x039f('0x17')](_0x039f('0x18'))},{'where':{'id':_0x49a103}});}})['then'](function(){if(_0x49a103&&_0x49a103[_0x039f('0x11')]){logger[_0x039f('0x12')](_0x039f('0x19'),_0x49a103[_0x039f('0x1a')]());for(var _0x201b5e=0x0;_0x201b5e<_0x49a103[_0x039f('0x11')];_0x201b5e++){io['emit'](_0x039f('0x1b'),{'id':_0x49a103[_0x201b5e],'closed':!![]});}}})[_0x039f('0x1c')](function(_0x150eae){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x150eae?util[_0x039f('0x1d')](_0x150eae,{'showHidden':![],'depth':null}):'');});}exports[_0x039f('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x25a6=['Setting','chatTimeout','findAll','lastMsgAt','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter'];(function(_0x25f271,_0x4e67ed){var _0x104ab9=function(_0x3bf4f5){while(--_0x3bf4f5){_0x25f271['push'](_0x25f271['shift']());}};_0x104ab9(++_0x4e67ed);}(_0x25a6,0x7d));var _0x625a=function(_0x1344fb,_0x2ba081){_0x1344fb=_0x1344fb-0x0;var _0x19408b=_0x25a6[_0x1344fb];return _0x19408b;};'use strict';var _=require(_0x625a('0x0'));var moment=require(_0x625a('0x1'));var Redis=require(_0x625a('0x2'));var util=require('util');var config=require(_0x625a('0x3'));var db=require(_0x625a('0x4'))['db'];var logger=require(_0x625a('0x5'))(_0x625a('0x6'));config[_0x625a('0x7')]=_[_0x625a('0x8')](config[_0x625a('0x7')],{'host':_0x625a('0x9'),'port':0x18eb});var io=require(_0x625a('0xa'))(new Redis(config[_0x625a('0x7')]));function closeInteractions(){var _0x5f1009=0x0;var _0x1f374a=[];return db[_0x625a('0xb')]['find']({'raw':!![],'attributes':['id',_0x625a('0xc')],'where':{'id':0x1}})['then'](function(_0x10af84){_0x5f1009=_0x10af84[_0x625a('0xc')];if(_0x5f1009){return db['ChatInteraction'][_0x625a('0xd')]({'raw':!![],'attributes':['id',_0x625a('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x10af84['chatTimeout'],_0x625a('0xf'))}}});}else{return[];}})['then'](function(_0x4930f8){if(_0x4930f8&&_0x4930f8['length']){_0x1f374a=_[_0x625a('0x10')](_0x4930f8||[],'id');logger[_0x625a('0x11')](_0x625a('0x12'),_0x1f374a['join']());return db[_0x625a('0x13')][_0x625a('0x14')]({'closeReason':_0x625a('0x15'),'disposition':_0x625a('0x16'),'closed':!![],'closedAt':moment()[_0x625a('0x17')](_0x625a('0x18'))},{'where':{'id':_0x1f374a}});}})['then'](function(){if(_0x1f374a&&_0x1f374a[_0x625a('0x19')]){logger['info'](_0x625a('0x1a'),_0x1f374a[_0x625a('0x1b')]());for(var _0x2761d1=0x0;_0x2761d1<_0x1f374a[_0x625a('0x19')];_0x2761d1++){io[_0x625a('0x1c')](_0x625a('0x1d'),{'id':_0x1f374a[_0x2761d1],'closed':!![]});}}})['catch'](function(_0xe786f5){logger[_0x625a('0x1e')](_0x625a('0x1f'),_0xe786f5?util[_0x625a('0x20')](_0xe786f5,{'showHidden':![],'depth':null}):'');});}exports[_0x625a('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index fcc579b..08db27c 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 _0x6af2=['user','Report\x20%s\x20last\x20%s\x20%s','join','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','text','format','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','difference','length','exists','deleteJob','delete\x20cron','toRun','index','run\x20job','cron','active','isBetween','add\x20cron','stop\x20cron','startAt','update','update\x20cron','stop','start','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','\x22%s\x22\x20<%s>','name','email'];(function(_0xd9caad,_0x5856b7){var _0x3127e6=function(_0x15aacc){while(--_0x15aacc){_0xd9caad['push'](_0xd9caad['shift']());}};_0x3127e6(++_0x5856b7);}(_0x6af2,0x1aa));var _0x26af=function(_0x513d5f,_0x193c3d){_0x513d5f=_0x513d5f-0x0;var _0x4d69ed=_0x6af2[_0x513d5f];return _0x4d69ed;};'use strict';var fs=require('fs');var util=require(_0x26af('0x0'));var path=require(_0x26af('0x1'));var _=require(_0x26af('0x2'));var moment=require('moment');var CronJobManager=require(_0x26af('0x3'));var jayson=require(_0x26af('0x4'));var BPromise=require(_0x26af('0x5'));var logger=require(_0x26af('0x6'))('schedule');var db=require(_0x26af('0x7'))['db'];var analyticCustomReportController=require(_0x26af('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x26af('0x9')][_0x26af('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x354448,_0x377821){return function(){logger[_0x26af('0xb')](_0x26af('0xc'),_0x354448['email']);var _0x299c4c=!![];var _0x52d82c={'tls':{'rejectUnauthorized':![]}};if(_0x354448[_0x26af('0xd')][_0x26af('0xe')][_0x26af('0xf')]){_0x52d82c[_0x26af('0xf')]=_0x354448[_0x26af('0xd')][_0x26af('0xe')][_0x26af('0xf')];}else{_0x52d82c[_0x26af('0x10')]=_0x354448[_0x26af('0xd')]['Smtp'][_0x26af('0x10')];_0x52d82c['port']=_0x354448[_0x26af('0xd')][_0x26af('0xe')][_0x26af('0x11')];_0x52d82c[_0x26af('0x12')]=_0x354448[_0x26af('0xd')][_0x26af('0xe')][_0x26af('0x12')];}if(_0x354448[_0x26af('0xd')][_0x26af('0xe')][_0x26af('0x13')]){_0x52d82c[_0x26af('0x14')]={'user':_0x354448[_0x26af('0xd')]['Smtp']['user'],'pass':_0x354448[_0x26af('0xd')][_0x26af('0xe')]['pass']};}var _0x16d1e8={'account':_0x52d82c,'message':{'from':util['format'](_0x26af('0x15'),_0x354448[_0x26af('0xd')][_0x26af('0x16')],_0x354448[_0x26af('0xd')][_0x26af('0x17')]||_0x354448['MailAccount']['Smtp'][_0x26af('0x18')]),'to':_0x354448['email'],'cc':_0x354448['cc'],'bcc':_0x354448['bcc'],'subject':util['format'](_0x26af('0x19'),_0x377821[_0x26af('0x16')],_0x354448['subtractNumber'],_0x354448['subtractUnit'])}};var _0x6d46f2=path[_0x26af('0x1a')](__dirname,'../../files/reports');var _0x20a31b=_0x377821[_0x26af('0x1b')];var _0x5f218b=util['format'](_0x26af('0x1c'),path[_0x26af('0x1d')](_0x377821[_0x26af('0x1b')],path[_0x26af('0x1e')](_0x377821['savename'])),_0x26af('0x1f'));var _0x960f82=path[_0x26af('0x1a')](_0x6d46f2,_0x20a31b);var _0x3e09cf=path[_0x26af('0x1a')](_0x6d46f2,_0x5f218b);if(fs[_0x26af('0x20')](_0x960f82)){_0x377821[_0x26af('0x21')]=_0x26af('0x22');_0x16d1e8['message']['attachments']=[{'filename':_0x20a31b,'path':_0x960f82}];_0x16d1e8[_0x26af('0x23')][_0x26af('0x24')]=util[_0x26af('0x25')](_0x26af('0x26'),JSON[_0x26af('0x27')](_0x377821,null,0x2));}else if(fs[_0x26af('0x20')](_0x3e09cf)){_0x377821[_0x26af('0x21')]=_0x26af('0x22');_0x16d1e8[_0x26af('0x23')][_0x26af('0x28')]=[{'filename':_0x5f218b,'path':_0x3e09cf}];}else{_0x16d1e8[_0x26af('0x23')]['text']=_0x26af('0x29');if(!_0x354448[_0x26af('0x2a')]){_0x299c4c=![];logger[_0x26af('0xb')](_0x26af('0x2b'));}}if(_0x299c4c){return client[_0x26af('0x2c')](_0x26af('0x2d'),_0x16d1e8)[_0x26af('0x2e')](function(_0xe99618){if(_0xe99618[_0x26af('0x2f')]){return logger[_0x26af('0x2f')](_0x26af('0x30'),JSON['stringify'](_0xe99618));}return logger[_0x26af('0xb')](_0x26af('0x31'));})[_0x26af('0x32')](function(_0x10de1c){return logger[_0x26af('0x2f')]('error\x20mail',JSON[_0x26af('0x27')](_0x10de1c));});}};}function handleError(){return function(_0x118d51){return logger[_0x26af('0x2f')](JSON['stringify'](_0x118d51));};}function handleResult(_0x4adf02){return function(_0x57d253){logger[_0x26af('0xb')](_0x26af('0x33'),JSON['stringify'](_0x57d253));if(_0x4adf02[_0x26af('0xd')]&&_0x4adf02[_0x26af('0xd')]['Smtp']&&!_[_0x26af('0x34')](_0x4adf02[_0x26af('0x17')])){setTimeout(handleSendEmail(_0x4adf02,_0x57d253),0x3c*0x3e8);}};}function handleJob(_0xfadfe7){return function(){try{if(_['isNil'](_0xfadfe7[_0x26af('0x35')])){return logger['info'](_0x26af('0x36'));}if(_[_0x26af('0x34')](_0xfadfe7[_0x26af('0x37')])){return logger[_0x26af('0xb')](_0x26af('0x38'));}var _0x1ebe85={'startDate':moment()[_0x26af('0x39')](_0xfadfe7[_0x26af('0x35')],_0xfadfe7[_0x26af('0x37')])['format'](_0x26af('0x3a')),'endDate':moment()[_0x26af('0x25')](_0x26af('0x3a')),'type':_0x26af('0x3b'),'output':_0xfadfe7[_0x26af('0x3c')],'name':_0xfadfe7[_0x26af('0x16')]};if(!_[_0x26af('0x34')](_0xfadfe7[_0x26af('0x3d')])){logger[_0x26af('0xb')]('exec\x20defaul\x20report\x20id:%s',_0xfadfe7[_0x26af('0x3d')]);return analyticDefaultReportController['runReport']({'id':_0xfadfe7[_0x26af('0x3d')]},_0x1ebe85)[_0x26af('0x2e')](handleResult(_0xfadfe7))[_0x26af('0x32')](handleError());}if(!_['isNil'](_0xfadfe7[_0x26af('0x3e')])){logger[_0x26af('0xb')]('exec\x20custom\x20report\x20id:%s',_0xfadfe7['CustomReportId']);return analyticCustomReportController[_0x26af('0x3f')]({'id':_0xfadfe7[_0x26af('0x3e')]},_0x1ebe85)[_0x26af('0x2e')](handleResult(_0xfadfe7))[_0x26af('0x32')](handleError());}}catch(_0x35ddcd){logger['error'](JSON[_0x26af('0x27')](_0x35ddcd));}return logger['info'](_0x26af('0x40'));};}function getJobs(_0x374522){var _0x39cddf={};if(_0x374522){_0x39cddf['id']=_0x374522;}return db[_0x26af('0x41')][_0x26af('0x42')]({'where':_0x39cddf,'include':[{'model':db[_0x26af('0xd')],'attributes':['id',_0x26af('0x16'),'email'],'include':[{'model':db[_0x26af('0x43')],'as':_0x26af('0xe')}]}]})['then'](function(_0x5eb2fe){var _0xc1e4=_[_0x26af('0x44')](manager[_0x26af('0x45')]);var _0x2f35c9=_[_0x26af('0x46')](_0x5eb2fe,function(_0x5e68e7){return _0x5e68e7['id'][_0x26af('0x47')]();});var _0xdc96fe=_['keyBy'](_0x5eb2fe,function(_0x2f51f3){return _0x2f51f3['id'][_0x26af('0x47')]();});var _0x3498ec=_0x374522?_0x2f35c9:_[_0x26af('0x48')](_0x2f35c9,_0xc1e4);var _0x5b021b=_['intersection'](_0x2f35c9,_0xc1e4);var _0x44c5c0=_[_0x26af('0x48')](_0xc1e4,_0x2f35c9);var _0x3a194e;var _0x292083;for(_0x3a194e=0x0;_0x3a194e<_0x44c5c0[_0x26af('0x49')]&&!_0x374522;_0x3a194e+=0x1){_0x292083=_0x44c5c0[_0x3a194e][_0x26af('0x47')]();if(manager[_0x26af('0x4a')](_0x292083)){manager['stop'](_0x292083);manager[_0x26af('0x4b')](_0x292083);logger['info'](_0x26af('0x4c'),_0x292083);}}logger[_0x26af('0xb')](_0x26af('0x4d'),JSON['stringify'](_0x3498ec));for(_0x3a194e=0x0;_0x3a194e<_0x3498ec[_0x26af('0x49')];_0x3a194e+=0x1){_0x292083=_0x3498ec[_0x3a194e][_0x26af('0x47')]();logger[_0x26af('0xb')](_0x26af('0x4e'),_0x292083);if(_0x374522){logger[_0x26af('0xb')]('my\x20id',_0x374522);logger[_0x26af('0xb')](JSON['stringify'](_0xdc96fe[_0x292083]));BPromise['resolve']()['then'](handleJob(_0xdc96fe[_0x292083]));logger[_0x26af('0xb')](_0x26af('0x4f'),_0xdc96fe[_0x292083][_0x26af('0x16')],_0xdc96fe[_0x292083][_0x26af('0x50')]);}else if(_0xdc96fe[_0x292083][_0x26af('0x50')]&&_0xdc96fe[_0x292083][_0x26af('0x51')]&&moment()[_0x26af('0x52')](_0xdc96fe[_0x292083]['startAt'],_0xdc96fe[_0x292083]['endAt'])){manager['add'](_0x292083,_0xdc96fe[_0x292083][_0x26af('0x50')],handleJob(_0xdc96fe[_0x292083]));manager['start'](_0x292083);logger[_0x26af('0xb')](_0x26af('0x53'),_0xdc96fe[_0x292083][_0x26af('0x16')],_0xdc96fe[_0x292083][_0x26af('0x50')]);}else if(manager[_0x26af('0x4a')](_0x292083)){manager['stop'](_0x292083);manager[_0x26af('0x4b')](_0x292083);logger[_0x26af('0xb')](_0x26af('0x54'),_0xdc96fe[_0x292083][_0x26af('0x16')],_0xdc96fe[_0x292083][_0x26af('0x50')]);}}for(_0x3a194e=0x0,_0x292083;_0x3a194e<_0x5b021b[_0x26af('0x49')]&&!_0x374522;_0x3a194e+=0x1){_0x292083=_0x5b021b[_0x3a194e]['toString']();if(manager[_0x26af('0x4a')](_0x292083)){if(_0xdc96fe[_0x292083][_0x26af('0x50')]&&_0xdc96fe[_0x292083][_0x26af('0x51')]&&moment()[_0x26af('0x52')](_0xdc96fe[_0x292083][_0x26af('0x55')],_0xdc96fe[_0x292083]['endAt'])){manager[_0x26af('0x56')](_0x292083,_0xdc96fe[_0x292083]['cron'],handleJob(_0xdc96fe[_0x292083]));logger['info'](_0x26af('0x57'),_0xdc96fe[_0x292083][_0x26af('0x16')],_0xdc96fe[_0x292083][_0x26af('0x50')]);}else{manager[_0x26af('0x58')](_0x292083);manager[_0x26af('0x4b')](_0x292083);logger['info'](_0x26af('0x54'),_0xdc96fe[_0x292083][_0x26af('0x16')],_0xdc96fe[_0x292083][_0x26af('0x50')]);}}}})['catch'](function(_0x3dfa37){logger['error'](JSON[_0x26af('0x27')](_0x3dfa37));});}exports['run']=function(_0x2d8d76){return getJobs(_0x2d8d76);};exports[_0x26af('0x59')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x9118=['email','MailAccount','service','Smtp','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','bcc','name','subtractNumber','join','savename','%s.%s','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','data','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','run\x20job','cron','isBetween','endAt','add','start','add\x20cron','exists','stop\x20cron','active','update','run','util','path','cron-job-manager','jayson/promise','bluebird','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to'];(function(_0x3d8101,_0x28bf01){var _0x4ebfd8=function(_0x3a883e){while(--_0x3a883e){_0x3d8101['push'](_0x3d8101['shift']());}};_0x4ebfd8(++_0x28bf01);}(_0x9118,0xa2));var _0x8911=function(_0x3c0224,_0x549906){_0x3c0224=_0x3c0224-0x0;var _0x3c3585=_0x9118[_0x3c0224];return _0x3c3585;};'use strict';var fs=require('fs');var util=require(_0x8911('0x0'));var path=require(_0x8911('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x8911('0x2'));var jayson=require(_0x8911('0x3'));var BPromise=require(_0x8911('0x4'));var logger=require('../logger')('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x8911('0x5'));var analyticDefaultReportController=require(_0x8911('0x6'));var client=jayson['client'][_0x8911('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x478891,_0x5ae4e4){return function(){logger[_0x8911('0x8')](_0x8911('0x9'),_0x478891[_0x8911('0xa')]);var _0x10e68d=!![];var _0x63613={'tls':{'rejectUnauthorized':![]}};if(_0x478891[_0x8911('0xb')]['Smtp'][_0x8911('0xc')]){_0x63613[_0x8911('0xc')]=_0x478891['MailAccount'][_0x8911('0xd')][_0x8911('0xc')];}else{_0x63613['host']=_0x478891['MailAccount']['Smtp'][_0x8911('0xe')];_0x63613['port']=_0x478891[_0x8911('0xb')]['Smtp'][_0x8911('0xf')];_0x63613[_0x8911('0x10')]=_0x478891[_0x8911('0xb')][_0x8911('0xd')][_0x8911('0x10')];}if(_0x478891[_0x8911('0xb')][_0x8911('0xd')][_0x8911('0x11')]){_0x63613[_0x8911('0x12')]={'user':_0x478891[_0x8911('0xb')][_0x8911('0xd')]['user'],'pass':_0x478891[_0x8911('0xb')][_0x8911('0xd')][_0x8911('0x13')]};}var _0x194912={'account':_0x63613,'message':{'from':util[_0x8911('0x14')](_0x8911('0x15'),_0x478891['MailAccount']['name'],_0x478891[_0x8911('0xb')][_0x8911('0xa')]||_0x478891['MailAccount'][_0x8911('0xd')]['user']),'to':_0x478891[_0x8911('0xa')],'cc':_0x478891['cc'],'bcc':_0x478891[_0x8911('0x16')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x5ae4e4[_0x8911('0x17')],_0x478891[_0x8911('0x18')],_0x478891['subtractUnit'])}};var _0x59d692=path[_0x8911('0x19')](__dirname,'../../files/reports');var _0x28dc56=_0x5ae4e4[_0x8911('0x1a')];var _0x181bbb=util[_0x8911('0x14')](_0x8911('0x1b'),path['basename'](_0x5ae4e4[_0x8911('0x1a')],path['extname'](_0x5ae4e4['savename'])),'zip');var _0x3474d1=path[_0x8911('0x19')](_0x59d692,_0x28dc56);var _0x276ba5=path[_0x8911('0x19')](_0x59d692,_0x181bbb);if(fs[_0x8911('0x1c')](_0x3474d1)){_0x5ae4e4[_0x8911('0x1d')]=_0x8911('0x1e');_0x194912['message'][_0x8911('0x1f')]=[{'filename':_0x28dc56,'path':_0x3474d1}];_0x194912[_0x8911('0x20')][_0x8911('0x21')]=util[_0x8911('0x14')](_0x8911('0x22'),JSON[_0x8911('0x23')](_0x5ae4e4,null,0x2));}else if(fs[_0x8911('0x1c')](_0x276ba5)){_0x5ae4e4[_0x8911('0x1d')]=_0x8911('0x1e');_0x194912['message']['attachments']=[{'filename':_0x181bbb,'path':_0x276ba5}];}else{_0x194912[_0x8911('0x20')][_0x8911('0x21')]=_0x8911('0x24');if(!_0x478891['sendIfEmpty']){_0x10e68d=![];logger[_0x8911('0x8')](_0x8911('0x25'));}}if(_0x10e68d){return client[_0x8911('0x26')](_0x8911('0x27'),_0x194912)[_0x8911('0x28')](function(_0x171143){if(_0x171143[_0x8911('0x29')]){return logger[_0x8911('0x29')](_0x8911('0x2a'),JSON[_0x8911('0x23')](_0x171143));}return logger['info'](_0x8911('0x2b'));})['catch'](function(_0x1ae446){return logger[_0x8911('0x29')]('error\x20mail',JSON[_0x8911('0x23')](_0x1ae446));});}};}function handleError(){return function(_0x2b921d){return logger[_0x8911('0x29')](JSON[_0x8911('0x23')](_0x2b921d));};}function handleResult(_0x18a11c){return function(_0x4f5128){logger[_0x8911('0x8')](_0x8911('0x2c'),JSON[_0x8911('0x23')](_0x4f5128));if(_0x18a11c[_0x8911('0xb')]&&_0x18a11c[_0x8911('0xb')]['Smtp']&&!_['isNil'](_0x18a11c[_0x8911('0xa')])){setTimeout(handleSendEmail(_0x18a11c,_0x4f5128),0x3c*0x3e8);}};}function handleJob(_0x2ea70e){return function(){try{if(_['isNil'](_0x2ea70e[_0x8911('0x18')])){return logger['info'](_0x8911('0x2d'));}if(_[_0x8911('0x2e')](_0x2ea70e[_0x8911('0x2f')])){return logger[_0x8911('0x8')](_0x8911('0x30'));}var _0xfdb853={'startDate':moment()[_0x8911('0x31')](_0x2ea70e[_0x8911('0x18')],_0x2ea70e[_0x8911('0x2f')])[_0x8911('0x14')](_0x8911('0x32')),'endDate':moment()[_0x8911('0x14')](_0x8911('0x32')),'type':_0x8911('0x33'),'output':_0x2ea70e[_0x8911('0x34')],'name':_0x2ea70e[_0x8911('0x17')]};if(!_['isNil'](_0x2ea70e[_0x8911('0x35')])){logger[_0x8911('0x8')](_0x8911('0x36'),_0x2ea70e[_0x8911('0x35')]);return analyticDefaultReportController[_0x8911('0x37')]({'id':_0x2ea70e[_0x8911('0x35')]},_0xfdb853)[_0x8911('0x28')](handleResult(_0x2ea70e))[_0x8911('0x38')](handleError());}if(!_[_0x8911('0x2e')](_0x2ea70e[_0x8911('0x39')])){logger[_0x8911('0x8')]('exec\x20custom\x20report\x20id:%s',_0x2ea70e[_0x8911('0x39')]);return analyticCustomReportController[_0x8911('0x37')]({'id':_0x2ea70e['CustomReportId']},_0xfdb853)['then'](handleResult(_0x2ea70e))[_0x8911('0x38')](handleError());}}catch(_0x1fdbf8){logger[_0x8911('0x29')](JSON[_0x8911('0x23')](_0x1fdbf8));}return logger[_0x8911('0x8')](_0x8911('0x3a'));};}function getJobs(_0x1d3e8e){var _0xe53720={};if(_0x1d3e8e){_0xe53720['id']=_0x1d3e8e;}return db[_0x8911('0x3b')][_0x8911('0x3c')]({'where':_0xe53720,'include':[{'model':db[_0x8911('0xb')],'attributes':['id',_0x8911('0x17'),_0x8911('0xa')],'include':[{'model':db[_0x8911('0x3d')],'as':_0x8911('0xd')}]}]})['then'](function(_0x737a3f){var _0x48b22b=_[_0x8911('0x3e')](manager[_0x8911('0x3f')]);var _0x4aa7e1=_[_0x8911('0x40')](_0x737a3f,function(_0x4979b8){return _0x4979b8['id']['toString']();});var _0x545335=_['keyBy'](_0x737a3f,function(_0x598d19){return _0x598d19['id'][_0x8911('0x41')]();});var _0x3d29dc=_0x1d3e8e?_0x4aa7e1:_[_0x8911('0x42')](_0x4aa7e1,_0x48b22b);var _0x40e9ab=_[_0x8911('0x43')](_0x4aa7e1,_0x48b22b);var _0xc1f27f=_[_0x8911('0x42')](_0x48b22b,_0x4aa7e1);var _0x47e50d;var _0x1c4bfd;for(_0x47e50d=0x0;_0x47e50d<_0xc1f27f[_0x8911('0x44')]&&!_0x1d3e8e;_0x47e50d+=0x1){_0x1c4bfd=_0xc1f27f[_0x47e50d][_0x8911('0x41')]();if(manager['exists'](_0x1c4bfd)){manager[_0x8911('0x45')](_0x1c4bfd);manager[_0x8911('0x46')](_0x1c4bfd);logger[_0x8911('0x8')](_0x8911('0x47'),_0x1c4bfd);}}logger['info'](_0x8911('0x48'),JSON['stringify'](_0x3d29dc));for(_0x47e50d=0x0;_0x47e50d<_0x3d29dc[_0x8911('0x44')];_0x47e50d+=0x1){_0x1c4bfd=_0x3d29dc[_0x47e50d][_0x8911('0x41')]();logger['info'](_0x8911('0x49'),_0x1c4bfd);if(_0x1d3e8e){logger[_0x8911('0x8')]('my\x20id',_0x1d3e8e);logger[_0x8911('0x8')](JSON[_0x8911('0x23')](_0x545335[_0x1c4bfd]));BPromise['resolve']()['then'](handleJob(_0x545335[_0x1c4bfd]));logger[_0x8911('0x8')](_0x8911('0x4a'),_0x545335[_0x1c4bfd][_0x8911('0x17')],_0x545335[_0x1c4bfd]['cron']);}else if(_0x545335[_0x1c4bfd][_0x8911('0x4b')]&&_0x545335[_0x1c4bfd]['active']&&moment()[_0x8911('0x4c')](_0x545335[_0x1c4bfd]['startAt'],_0x545335[_0x1c4bfd][_0x8911('0x4d')])){manager[_0x8911('0x4e')](_0x1c4bfd,_0x545335[_0x1c4bfd][_0x8911('0x4b')],handleJob(_0x545335[_0x1c4bfd]));manager[_0x8911('0x4f')](_0x1c4bfd);logger[_0x8911('0x8')](_0x8911('0x50'),_0x545335[_0x1c4bfd][_0x8911('0x17')],_0x545335[_0x1c4bfd][_0x8911('0x4b')]);}else if(manager[_0x8911('0x51')](_0x1c4bfd)){manager[_0x8911('0x45')](_0x1c4bfd);manager[_0x8911('0x46')](_0x1c4bfd);logger[_0x8911('0x8')](_0x8911('0x52'),_0x545335[_0x1c4bfd][_0x8911('0x17')],_0x545335[_0x1c4bfd][_0x8911('0x4b')]);}}for(_0x47e50d=0x0,_0x1c4bfd;_0x47e50d<_0x40e9ab[_0x8911('0x44')]&&!_0x1d3e8e;_0x47e50d+=0x1){_0x1c4bfd=_0x40e9ab[_0x47e50d][_0x8911('0x41')]();if(manager['exists'](_0x1c4bfd)){if(_0x545335[_0x1c4bfd]['cron']&&_0x545335[_0x1c4bfd][_0x8911('0x53')]&&moment()[_0x8911('0x4c')](_0x545335[_0x1c4bfd]['startAt'],_0x545335[_0x1c4bfd][_0x8911('0x4d')])){manager[_0x8911('0x54')](_0x1c4bfd,_0x545335[_0x1c4bfd]['cron'],handleJob(_0x545335[_0x1c4bfd]));logger[_0x8911('0x8')]('update\x20cron',_0x545335[_0x1c4bfd][_0x8911('0x17')],_0x545335[_0x1c4bfd][_0x8911('0x4b')]);}else{manager['stop'](_0x1c4bfd);manager['deleteJob'](_0x1c4bfd);logger[_0x8911('0x8')](_0x8911('0x52'),_0x545335[_0x1c4bfd][_0x8911('0x17')],_0x545335[_0x1c4bfd]['cron']);}}}})[_0x8911('0x38')](function(_0x876f80){logger['error'](JSON[_0x8911('0x23')](_0x876f80));});}exports[_0x8911('0x55')]=function(_0x22ffdb){return getJobs(_0x22ffdb);};exports[_0x8911('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 10a036b..c8aa1f2 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 _0xc950=['Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','SentimentScore','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentimentRegion','Cloud\x20Provider\x20not\x20configured','Sentiment','Negative','Neutral','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','transcribeRegion','forEach','all','error','start','lodash','request-promise','util','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','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','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','fileText','transcripts','length','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xc950,0xf6));var _0x0c95=function(_0x21134e,_0x166425){_0x21134e=_0x21134e-0x0;var _0x578c4a=_0xc950[_0x21134e];return _0x578c4a;};var _=require(_0x0c95('0x0'));var AWS=require('aws-sdk');var rp=require(_0x0c95('0x1'));var util=require(_0x0c95('0x2'));var BPromise=require('bluebird');var db=require(_0x0c95('0x3'))['db'];var logger=require(_0x0c95('0x4'))('transcribe');function getTranscriptionJob(_0x2bbf64,_0x3e3462,_0x5bfef1,_0x4bcc8e){return new Promise(function(_0xc9623e,_0x4d4b03){var _0x271b3e=new AWS[(_0x0c95('0x5'))]({'accessKeyId':_0x3e3462,'secretAccessKey':_0x2bbf64,'region':_0x5bfef1});_0x271b3e[_0x0c95('0x6')]({'TranscriptionJobName':_0x4bcc8e},function(_0x1e4bc8,_0x37d3d0){if(_0x1e4bc8){return _0x4d4b03(_0x1e4bc8);}else{return _0xc9623e(_0x37d3d0);}});});}function sentiment(_0x1e84d9,_0x37fef6,_0xd3f25c,_0x22cd1b,_0x45469d){return new Promise(function(_0x375070,_0x44b7e5){var _0x12137f=new AWS[(_0x0c95('0x7'))]({'accessKeyId':_0x37fef6,'secretAccessKey':_0x1e84d9,'region':_0xd3f25c});_0x12137f[_0x0c95('0x8')]({'Text':_0x22cd1b,'LanguageCode':_0x45469d[_0x0c95('0x9')](0x0,0x2)},function(_0x1a6aa6,_0x307ae7){if(_0x1a6aa6){return _0x44b7e5(_0x1a6aa6);}else{return _0x375070(_0x307ae7);}});});}function checkTranscribeJob(_0x1948c3,_0x19385a,_0x2c41f5){var _0x3da16d;return new BPromise(function(_0x1a56aa,_0x178071){logger[_0x0c95('0xa')](util[_0x0c95('0xb')](_0x0c95('0xc'),_0x1948c3['id'],_0x1948c3[_0x0c95('0xd')]));return getTranscriptionJob(_0x2c41f5[_0x0c95('0xe')],_0x2c41f5['data2'],_0x19385a['transcribeRegion'],_0x1948c3['transcribeName'])[_0x0c95('0xf')](function(_0x5cf634){logger[_0x0c95('0xa')](util[_0x0c95('0xb')](_0x0c95('0x10'),_0x1948c3['id'],_0x1948c3[_0x0c95('0xd')],_0x5cf634[_0x0c95('0x11')][_0x0c95('0x12')]));if(!_0x1948c3['fileText']){switch(_0x5cf634[_0x0c95('0x11')][_0x0c95('0x12')]){case _0x0c95('0x13'):var _0x2556b0={'transcribeStatus':_0x5cf634['TranscriptionJob'][_0x0c95('0x12')],'fileUri':_0x5cf634[_0x0c95('0x11')][_0x0c95('0x14')][_0x0c95('0x15')]};logger[_0x0c95('0xa')](util['format'](_0x0c95('0x16'),_0x1948c3['id']));return rp({'uri':_0x5cf634[_0x0c95('0x11')][_0x0c95('0x14')]['TranscriptFileUri'],'json':!![]})[_0x0c95('0xf')](function(_0x4a527b){logger[_0x0c95('0xa')](util['format'](_0x0c95('0x17'),_0x1948c3['id']));if(_0x4a527b&&_0x4a527b[_0x0c95('0x18')]&&_0x4a527b['results']['transcripts']&&_0x4a527b[_0x0c95('0x18')]['transcripts']['length']){_0x2556b0[_0x0c95('0x19')]='';for(var _0x3cdfca=0x0;_0x3cdfca<_0x4a527b['results'][_0x0c95('0x1a')][_0x0c95('0x1b')];_0x3cdfca++){_0x2556b0['fileText']+=_0x4a527b[_0x0c95('0x18')][_0x0c95('0x1a')][_0x3cdfca]['transcript']+'';}}return _0x1948c3[_0x0c95('0x1c')](_0x2556b0);})[_0x0c95('0xf')](function(){logger[_0x0c95('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1948c3['id']));if(!_0x1948c3[_0x0c95('0x1d')]){throw new db[(_0x0c95('0x1e'))][(_0x0c95('0x1f'))](_0x0c95('0x20'));}if(!_0x19385a[_0x0c95('0x21')]||!_0x19385a[_0x0c95('0x22')]||!_0x19385a['sentimentRegion']||!_0x19385a[_0x0c95('0x23')]||!_0x19385a[_0x0c95('0x24')]){throw new db[(_0x0c95('0x1e'))]['ValidationError'](_0x0c95('0x25'));}if(!_0x2556b0[_0x0c95('0x19')]){throw new Error(_0x0c95('0x26'));}if(_0x19385a[_0x0c95('0x22')]===_0x2c41f5['id']){return _0x2c41f5;}else{return db[_0x0c95('0x27')][_0x0c95('0x28')]({'where':{'id':_settings[_0x0c95('0x22')]}});}})[_0x0c95('0xf')](function(_0x593daf){if(!_0x593daf){throw new db[(_0x0c95('0x1e'))]['ValidationError'](_0x0c95('0x29'));}if(!_0x593daf[_0x0c95('0xe')]||!_0x593daf[_0x0c95('0x2a')]){throw new db['Sequelize'][(_0x0c95('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x3da16d=_0x593daf;logger['info'](util[_0x0c95('0xb')](_0x0c95('0x2b'),_0x1948c3['id']));return sentiment(_0x3da16d[_0x0c95('0xe')],_0x3da16d[_0x0c95('0x2a')],_0x19385a['sentimentRegion'],_0x2556b0[_0x0c95('0x19')],_0x19385a[_0x0c95('0x23')]);})[_0x0c95('0xf')](function(_0x117b36){logger['info'](util[_0x0c95('0xb')](_0x0c95('0x2c'),_0x1948c3['id']));return _0x1948c3[_0x0c95('0x1c')]({'sentiment':_0x117b36['Sentiment'],'sPositive':_0x117b36['SentimentScore'][_0x0c95('0x2d')],'sNegative':_0x117b36[_0x0c95('0x2e')]['Negative'],'sMixed':_0x117b36['SentimentScore'][_0x0c95('0x2f')],'sNeutral':_0x117b36[_0x0c95('0x2e')]['Neutral']});})[_0x0c95('0xf')](function(){logger[_0x0c95('0xa')](util[_0x0c95('0xb')](_0x0c95('0x30'),_0x1948c3['id']));_0x1a56aa();});case'FAILED':return _0x1948c3[_0x0c95('0x1c')]({'transcribeStatus':_0x0c95('0x31'),'failureReason':_0x5cf634['TranscriptionJob'][_0x0c95('0x32')]})[_0x0c95('0xf')](function(){logger[_0x0c95('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1948c3['id']));_0x1a56aa();});default:logger['info'](util[_0x0c95('0xb')](_0x0c95('0x33'),_0x1948c3['id']));break;}}else{return BPromise[_0x0c95('0x34')]()[_0x0c95('0xf')](function(){if(!_0x1948c3[_0x0c95('0x1d')]){throw new db[(_0x0c95('0x1e'))]['ValidationError'](_0x0c95('0x20'));}if(!_0x19385a['sentiment']||!_0x19385a[_0x0c95('0x22')]||!_0x19385a[_0x0c95('0x35')]||!_0x19385a[_0x0c95('0x23')]||!_0x19385a[_0x0c95('0x24')]){throw new db[(_0x0c95('0x1e'))][(_0x0c95('0x1f'))](_0x0c95('0x25'));}if(!_0x1948c3[_0x0c95('0x19')]){throw new Error('Transcript\x20not\x20available');}if(_0x19385a[_0x0c95('0x22')]===_0x2c41f5['id']){return _0x2c41f5;}else{return db[_0x0c95('0x27')][_0x0c95('0x28')]({'where':{'id':_settings[_0x0c95('0x22')]}});}})[_0x0c95('0xf')](function(_0x2c28c5){if(!_0x2c28c5){throw new db[(_0x0c95('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2c28c5[_0x0c95('0xe')]||!_0x2c28c5[_0x0c95('0x2a')]){throw new db[(_0x0c95('0x1e'))][(_0x0c95('0x1f'))](_0x0c95('0x36'));}_0x3da16d=_0x2c28c5;logger[_0x0c95('0xa')](util[_0x0c95('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1948c3['id']));return sentiment(_0x3da16d[_0x0c95('0xe')],_0x3da16d[_0x0c95('0x2a')],_0x19385a[_0x0c95('0x35')],_0x1948c3['fileText'],_0x19385a[_0x0c95('0x23')]);})[_0x0c95('0xf')](function(_0x15ecfa){logger[_0x0c95('0xa')](util[_0x0c95('0xb')](_0x0c95('0x2c'),_0x1948c3['id']));return _0x1948c3['update']({'sentiment':_0x15ecfa[_0x0c95('0x37')],'sPositive':_0x15ecfa['SentimentScore']['Positive'],'sNegative':_0x15ecfa[_0x0c95('0x2e')][_0x0c95('0x38')],'sMixed':_0x15ecfa['SentimentScore'][_0x0c95('0x2f')],'sNeutral':_0x15ecfa[_0x0c95('0x2e')][_0x0c95('0x39')],'transcribeStatus':_0x0c95('0x13')});})['then'](function(){logger['info'](util[_0x0c95('0xb')](_0x0c95('0x30'),_0x1948c3['id']));_0x1a56aa();});}})[_0x0c95('0x3a')](function(_0x26385f){if(_0x26385f){if(!_0x26385f[_0x0c95('0x3b')]||_0x26385f[_0x0c95('0x3b')]!==_0x0c95('0x3c')){logger['error'](util[_0x0c95('0xb')](_0x0c95('0x3d'),_0x1948c3['id']),util[_0x0c95('0x3e')](_0x26385f,{'showHidden':![],'depth':null}));}}_0x1a56aa();});});}function checkTranscribe(){var _0x47f5b0;var _0xc4d136;var _0x1c8f30;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x0c95('0xf')](function(_0x233063){if(!_0x233063||!_0x233063['length']){throw new db[(_0x0c95('0x1e'))][(_0x0c95('0x1f'))](_0x0c95('0x3f'));}_0x47f5b0=_0x233063;return db[_0x0c95('0x40')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x584ed9){if(!_0x584ed9){throw new db[(_0x0c95('0x1e'))]['ValidationError']('Settings\x20not\x20available');}_0xc4d136=_0x584ed9;if(!_0xc4d136['transcribe']||!_0xc4d136[_0x0c95('0x41')]||!_0xc4d136[_0x0c95('0x42')]||!_0xc4d136[_0x0c95('0x23')]||!_0xc4d136[_0x0c95('0x24')]){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x0c95('0x27')][_0x0c95('0x28')]({'where':{'id':_0xc4d136[_0x0c95('0x41')]}});})['then'](function(_0xb02669){if(!_0xb02669){throw new db['Sequelize'][(_0x0c95('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xb02669[_0x0c95('0xe')]||!_0xb02669[_0x0c95('0x2a')]){throw new db[(_0x0c95('0x1e'))][(_0x0c95('0x1f'))](_0x0c95('0x36'));}_0x1c8f30=_0xb02669;var _0x18e5cd=[];_0x47f5b0[_0x0c95('0x43')](function(_0x57c006){_0x18e5cd['push'](checkTranscribeJob(_0x57c006,_0xc4d136,_0x1c8f30));});return BPromise[_0x0c95('0x44')](_0x18e5cd);})['catch'](function(_0x2c3874){if(_0x2c3874){if(!_0x2c3874[_0x0c95('0x3b')]||_0x2c3874[_0x0c95('0x3b')]!=='SequelizeValidationError'){logger[_0x0c95('0x45')](util[_0x0c95('0x3e')](_0x2c3874,{'showHidden':![],'depth':null}));}}});}exports[_0x0c95('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x3bd4=['format','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Transcript\x20not\x20available','Positive','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','CloudProvider','push','all','catch','error','lodash','aws-sdk','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','transcribeName','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri'];(function(_0x1ae17a,_0x20b4d5){var _0xbddffa=function(_0x35dc33){while(--_0x35dc33){_0x1ae17a['push'](_0x1ae17a['shift']());}};_0xbddffa(++_0x20b4d5);}(_0x3bd4,0x1d6));var _0x43bd=function(_0x3c49b2,_0x285e48){_0x3c49b2=_0x3c49b2-0x0;var _0x2d9203=_0x3bd4[_0x3c49b2];return _0x2d9203;};var _=require(_0x43bd('0x0'));var AWS=require(_0x43bd('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0x43bd('0x2'));var db=require(_0x43bd('0x3'))['db'];var logger=require(_0x43bd('0x4'))(_0x43bd('0x5'));function getTranscriptionJob(_0x499396,_0x5d4b8f,_0x3757c6,_0x26ec91){return new Promise(function(_0x4d55dd,_0x58a242){var _0x124408=new AWS[(_0x43bd('0x6'))]({'accessKeyId':_0x5d4b8f,'secretAccessKey':_0x499396,'region':_0x3757c6});_0x124408[_0x43bd('0x7')]({'TranscriptionJobName':_0x26ec91},function(_0x5c0ee9,_0x3d16fe){if(_0x5c0ee9){return _0x58a242(_0x5c0ee9);}else{return _0x4d55dd(_0x3d16fe);}});});}function sentiment(_0x2d4c74,_0x41ba97,_0x39ef2c,_0x1936d8,_0x4d00a6){return new Promise(function(_0x10d0c4,_0x38db7f){var _0x2be672=new AWS[(_0x43bd('0x8'))]({'accessKeyId':_0x41ba97,'secretAccessKey':_0x2d4c74,'region':_0x39ef2c});_0x2be672[_0x43bd('0x9')]({'Text':_0x1936d8,'LanguageCode':_0x4d00a6['substring'](0x0,0x2)},function(_0xf1af55,_0x3acd9f){if(_0xf1af55){return _0x38db7f(_0xf1af55);}else{return _0x10d0c4(_0x3acd9f);}});});}function checkTranscribeJob(_0x344497,_0x30f323,_0x2300ff){var _0x104947;return new BPromise(function(_0x3e9875,_0x2ef133){logger[_0x43bd('0xa')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x344497['id'],_0x344497[_0x43bd('0xb')]));return getTranscriptionJob(_0x2300ff['data1'],_0x2300ff['data2'],_0x30f323[_0x43bd('0xc')],_0x344497[_0x43bd('0xb')])['then'](function(_0x4cec7b){logger[_0x43bd('0xa')](util['format'](_0x43bd('0xd'),_0x344497['id'],_0x344497[_0x43bd('0xb')],_0x4cec7b[_0x43bd('0xe')]['TranscriptionJobStatus']));if(!_0x344497[_0x43bd('0xf')]){switch(_0x4cec7b['TranscriptionJob'][_0x43bd('0x10')]){case _0x43bd('0x11'):var _0x43f411={'transcribeStatus':_0x4cec7b[_0x43bd('0xe')][_0x43bd('0x10')],'fileUri':_0x4cec7b['TranscriptionJob'][_0x43bd('0x12')][_0x43bd('0x13')]};logger[_0x43bd('0xa')](util[_0x43bd('0x14')](_0x43bd('0x15'),_0x344497['id']));return rp({'uri':_0x4cec7b['TranscriptionJob']['Transcript'][_0x43bd('0x13')],'json':!![]})[_0x43bd('0x16')](function(_0x35a11c){logger[_0x43bd('0xa')](util[_0x43bd('0x14')](_0x43bd('0x17'),_0x344497['id']));if(_0x35a11c&&_0x35a11c[_0x43bd('0x18')]&&_0x35a11c[_0x43bd('0x18')][_0x43bd('0x19')]&&_0x35a11c['results'][_0x43bd('0x19')]['length']){_0x43f411['fileText']='';for(var _0x5c1ca1=0x0;_0x5c1ca1<_0x35a11c[_0x43bd('0x18')][_0x43bd('0x19')][_0x43bd('0x1a')];_0x5c1ca1++){_0x43f411['fileText']+=_0x35a11c[_0x43bd('0x18')][_0x43bd('0x19')][_0x5c1ca1]['transcript']+'';}}return _0x344497[_0x43bd('0x1b')](_0x43f411);})['then'](function(){logger['info'](util[_0x43bd('0x14')](_0x43bd('0x1c'),_0x344497['id']));if(!_0x344497[_0x43bd('0x1d')]){throw new db[(_0x43bd('0x1e'))][(_0x43bd('0x1f'))](_0x43bd('0x20'));}if(!_0x30f323[_0x43bd('0x21')]||!_0x30f323[_0x43bd('0x22')]||!_0x30f323[_0x43bd('0x23')]||!_0x30f323[_0x43bd('0x24')]||!_0x30f323[_0x43bd('0x25')]){throw new db[(_0x43bd('0x1e'))][(_0x43bd('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x43f411[_0x43bd('0xf')]){throw new Error('Transcript\x20not\x20available');}if(_0x30f323[_0x43bd('0x22')]===_0x2300ff['id']){return _0x2300ff;}else{return db['CloudProvider'][_0x43bd('0x26')]({'where':{'id':_settings[_0x43bd('0x22')]}});}})[_0x43bd('0x16')](function(_0x41efdf){if(!_0x41efdf){throw new db['Sequelize'][(_0x43bd('0x1f'))](_0x43bd('0x27'));}if(!_0x41efdf[_0x43bd('0x28')]||!_0x41efdf[_0x43bd('0x29')]){throw new db['Sequelize'][(_0x43bd('0x1f'))](_0x43bd('0x2a'));}_0x104947=_0x41efdf;logger['info'](util[_0x43bd('0x14')](_0x43bd('0x2b'),_0x344497['id']));return sentiment(_0x104947[_0x43bd('0x28')],_0x104947[_0x43bd('0x29')],_0x30f323[_0x43bd('0x23')],_0x43f411['fileText'],_0x30f323[_0x43bd('0x24')]);})['then'](function(_0x42b5d0){logger[_0x43bd('0xa')](util[_0x43bd('0x14')](_0x43bd('0x2c'),_0x344497['id']));return _0x344497['update']({'sentiment':_0x42b5d0[_0x43bd('0x2d')],'sPositive':_0x42b5d0[_0x43bd('0x2e')]['Positive'],'sNegative':_0x42b5d0[_0x43bd('0x2e')][_0x43bd('0x2f')],'sMixed':_0x42b5d0[_0x43bd('0x2e')][_0x43bd('0x30')],'sNeutral':_0x42b5d0[_0x43bd('0x2e')][_0x43bd('0x31')]});})['then'](function(){logger[_0x43bd('0xa')](util['format'](_0x43bd('0x1c'),_0x344497['id']));_0x3e9875();});case _0x43bd('0x32'):return _0x344497['update']({'transcribeStatus':_0x43bd('0x32'),'failureReason':_0x4cec7b['TranscriptionJob'][_0x43bd('0x33')]})[_0x43bd('0x16')](function(){logger[_0x43bd('0xa')](util[_0x43bd('0x14')](_0x43bd('0x1c'),_0x344497['id']));_0x3e9875();});default:logger[_0x43bd('0xa')](util[_0x43bd('0x14')](_0x43bd('0x34'),_0x344497['id']));break;}}else{return BPromise['resolve']()[_0x43bd('0x16')](function(){if(!_0x344497['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0x43bd('0x20'));}if(!_0x30f323[_0x43bd('0x21')]||!_0x30f323[_0x43bd('0x22')]||!_0x30f323[_0x43bd('0x23')]||!_0x30f323[_0x43bd('0x24')]||!_0x30f323[_0x43bd('0x25')]){throw new db[(_0x43bd('0x1e'))][(_0x43bd('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x344497[_0x43bd('0xf')]){throw new Error(_0x43bd('0x35'));}if(_0x30f323[_0x43bd('0x22')]===_0x2300ff['id']){return _0x2300ff;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x43bd('0x16')](function(_0x411528){if(!_0x411528){throw new db[(_0x43bd('0x1e'))][(_0x43bd('0x1f'))](_0x43bd('0x27'));}if(!_0x411528[_0x43bd('0x28')]||!_0x411528[_0x43bd('0x29')]){throw new db[(_0x43bd('0x1e'))][(_0x43bd('0x1f'))](_0x43bd('0x2a'));}_0x104947=_0x411528;logger[_0x43bd('0xa')](util[_0x43bd('0x14')](_0x43bd('0x2b'),_0x344497['id']));return sentiment(_0x104947[_0x43bd('0x28')],_0x104947[_0x43bd('0x29')],_0x30f323['sentimentRegion'],_0x344497[_0x43bd('0xf')],_0x30f323[_0x43bd('0x24')]);})[_0x43bd('0x16')](function(_0x463fa5){logger['info'](util[_0x43bd('0x14')](_0x43bd('0x2c'),_0x344497['id']));return _0x344497[_0x43bd('0x1b')]({'sentiment':_0x463fa5[_0x43bd('0x2d')],'sPositive':_0x463fa5[_0x43bd('0x2e')][_0x43bd('0x36')],'sNegative':_0x463fa5[_0x43bd('0x2e')][_0x43bd('0x2f')],'sMixed':_0x463fa5['SentimentScore'][_0x43bd('0x30')],'sNeutral':_0x463fa5['SentimentScore'][_0x43bd('0x31')],'transcribeStatus':'COMPLETED'});})[_0x43bd('0x16')](function(){logger[_0x43bd('0xa')](util[_0x43bd('0x14')](_0x43bd('0x1c'),_0x344497['id']));_0x3e9875();});}})['catch'](function(_0x4efb0f){if(_0x4efb0f){if(!_0x4efb0f[_0x43bd('0x37')]||_0x4efb0f[_0x43bd('0x37')]!==_0x43bd('0x38')){logger['error'](util[_0x43bd('0x14')](_0x43bd('0x39'),_0x344497['id']),util[_0x43bd('0x3a')](_0x4efb0f,{'showHidden':![],'depth':null}));}}_0x3e9875();});});}function checkTranscribe(){var _0x37e4a5;var _0x429589;var _0x4c93f5;return db[_0x43bd('0x3b')]['findAll']({'where':{'transcribeStatus':_0x43bd('0x3c')}})[_0x43bd('0x16')](function(_0x51727b){if(!_0x51727b||!_0x51727b[_0x43bd('0x1a')]){throw new db[(_0x43bd('0x1e'))][(_0x43bd('0x1f'))](_0x43bd('0x3d'));}_0x37e4a5=_0x51727b;return db[_0x43bd('0x3e')][_0x43bd('0x26')]({'where':{'id':0x1}});})[_0x43bd('0x16')](function(_0x3b2a51){if(!_0x3b2a51){throw new db['Sequelize'][(_0x43bd('0x1f'))]('Settings\x20not\x20available');}_0x429589=_0x3b2a51;if(!_0x429589['transcribe']||!_0x429589[_0x43bd('0x3f')]||!_0x429589['transcribeRegion']||!_0x429589[_0x43bd('0x24')]||!_0x429589[_0x43bd('0x25')]){throw new db['Sequelize'][(_0x43bd('0x1f'))](_0x43bd('0x40'));}return db[_0x43bd('0x41')][_0x43bd('0x26')]({'where':{'id':_0x429589[_0x43bd('0x3f')]}});})['then'](function(_0x235e9a){if(!_0x235e9a){throw new db[(_0x43bd('0x1e'))]['ValidationError'](_0x43bd('0x27'));}if(!_0x235e9a[_0x43bd('0x28')]||!_0x235e9a['data2']){throw new db[(_0x43bd('0x1e'))][(_0x43bd('0x1f'))](_0x43bd('0x2a'));}_0x4c93f5=_0x235e9a;var _0x14cbfb=[];_0x37e4a5['forEach'](function(_0x149325){_0x14cbfb[_0x43bd('0x42')](checkTranscribeJob(_0x149325,_0x429589,_0x4c93f5));});return BPromise[_0x43bd('0x43')](_0x14cbfb);})[_0x43bd('0x44')](function(_0x2b1187){if(_0x2b1187){if(!_0x2b1187['name']||_0x2b1187['name']!==_0x43bd('0x38')){logger[_0x43bd('0x45')](util['inspect'](_0x2b1187,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 878f850..540a3ca 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 _0x48ee=['hours','then','map','info','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract'];(function(_0x4b8156,_0x437af2){var _0x4a819c=function(_0xe21347){while(--_0xe21347){_0x4b8156['push'](_0x4b8156['shift']());}};_0x4a819c(++_0x437af2);}(_0x48ee,0xeb));var _0xe48e=function(_0x4a173c,_0x243613){_0x4a173c=_0x4a173c-0x0;var _0x5501ab=_0x48ee[_0x4a173c];return _0x5501ab;};'use strict';var _=require(_0xe48e('0x0'));var moment=require(_0xe48e('0x1'));var Redis=require('ioredis');var util=require(_0xe48e('0x2'));var config=require(_0xe48e('0x3'));var db=require(_0xe48e('0x4'))['db'];var logger=require(_0xe48e('0x5'))(_0xe48e('0x6'));config['redis']=_['defaults'](config[_0xe48e('0x7')],{'host':_0xe48e('0x8'),'port':0x18eb});var io=require(_0xe48e('0x9'))(new Redis(config[_0xe48e('0x7')]));function closeInteractions(){var _0x2348e9=[];return db[_0xe48e('0xa')]['findAll']({'raw':!![],'attributes':['id',_0xe48e('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe48e('0xc')](0x18,_0xe48e('0xd'))}}})[_0xe48e('0xe')](function(_0x598414){if(_0x598414&&_0x598414['length']){_0x2348e9=_[_0xe48e('0xf')](_0x598414||[],'id');logger[_0xe48e('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2348e9['join']());return db[_0xe48e('0xa')][_0xe48e('0x11')]({'closeReason':_0xe48e('0x12'),'disposition':_0xe48e('0x13'),'closed':!![],'closedAt':moment()[_0xe48e('0x14')](_0xe48e('0x15'))},{'where':{'id':_0x2348e9}});}})[_0xe48e('0xe')](function(){if(_0x2348e9&&_0x2348e9[_0xe48e('0x16')]){logger['info'](_0xe48e('0x17'),_0x2348e9[_0xe48e('0x18')]());for(var _0x1ac511=0x0;_0x1ac511<_0x2348e9[_0xe48e('0x16')];_0x1ac511++){io[_0xe48e('0x19')](_0xe48e('0x1a'),{'id':_0x2348e9[_0x1ac511],'closed':!![]});}}})[_0xe48e('0x1b')](function(_0x28655d){logger['error'](_0xe48e('0x1c'),_0x28655d?util[_0xe48e('0x1d')](_0x28655d,{'showHidden':![],'depth':null}):'');});}exports[_0xe48e('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xeb2b=['[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../../config/environment','../../mysqldb','schedule','redis','defaults','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch','error'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xeb2b,0xb0));var _0xbeb2=function(_0x11f5e9,_0x37d49a){_0x11f5e9=_0x11f5e9-0x0;var _0xe06296=_0xeb2b[_0x11f5e9];return _0xe06296;};'use strict';var _=require(_0xbeb2('0x0'));var moment=require(_0xbeb2('0x1'));var Redis=require('ioredis');var util=require(_0xbeb2('0x2'));var config=require(_0xbeb2('0x3'));var db=require(_0xbeb2('0x4'))['db'];var logger=require('../logger')(_0xbeb2('0x5'));config[_0xbeb2('0x6')]=_[_0xbeb2('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0xdc56f=[];return db['WhatsappInteraction'][_0xbeb2('0x8')]({'raw':!![],'attributes':['id',_0xbeb2('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xbeb2('0xa')](0x18,_0xbeb2('0xb'))}}})[_0xbeb2('0xc')](function(_0x3e8295){if(_0x3e8295&&_0x3e8295[_0xbeb2('0xd')]){_0xdc56f=_[_0xbeb2('0xe')](_0x3e8295||[],'id');logger[_0xbeb2('0xf')](_0xbeb2('0x10'),_0xdc56f[_0xbeb2('0x11')]());return db[_0xbeb2('0x12')][_0xbeb2('0x13')]({'closeReason':_0xbeb2('0x14'),'disposition':_0xbeb2('0x15'),'closed':!![],'closedAt':moment()['format'](_0xbeb2('0x16'))},{'where':{'id':_0xdc56f}});}})[_0xbeb2('0xc')](function(){if(_0xdc56f&&_0xdc56f[_0xbeb2('0xd')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0xdc56f['join']());for(var _0x4ed1d7=0x0;_0x4ed1d7<_0xdc56f[_0xbeb2('0xd')];_0x4ed1d7++){io[_0xbeb2('0x17')](_0xbeb2('0x18'),{'id':_0xdc56f[_0x4ed1d7],'closed':!![]});}}})[_0xbeb2('0x19')](function(_0x1a7a54){logger[_0xbeb2('0x1a')](_0xbeb2('0x1b'),_0x1a7a54?util[_0xbeb2('0x1c')](_0x1a7a54,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index d68b042..801e9a6 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x169f=['hopper2','catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2'];(function(_0x480b30,_0x47c427){var _0x234122=function(_0x4521e0){while(--_0x4521e0){_0x480b30['push'](_0x480b30['shift']());}};_0x234122(++_0x47c427);}(_0x169f,0x156));var _0xf169=function(_0x2ceb1c,_0x2048a8){_0x2ceb1c=_0x2ceb1c-0x0;var _0x24b732=_0x169f[_0x2ceb1c];return _0x24b732;};'use strict';var util=require(_0xf169('0x0'));var db=require(_0xf169('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf169('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xf169('0x3')+i,'phone':0xf879fb460+i,'email':_0xf169('0x4')+i+_0xf169('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xf169('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf169('0x6')](),'updatedAt':Date[_0xf169('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xf169('0x2')]({'id':i,'firstName':_0xf169('0x7')+i,'lastName':_0xf169('0x3')+i,'phone':0xf879fb460+i,'email':_0xf169('0x4')+i+_0xf169('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf169('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xf169('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf169('0x6')](),'updatedAt':Date[_0xf169('0x6')]()});}db[_0xf169('0x8')][_0xf169('0x9')]({'where':{}})[_0xf169('0xa')](function(){return db['CmContact'][_0xf169('0xb')](contacts);})[_0xf169('0xa')](function(){console[_0xf169('0xc')](_0xf169('0xd'),_0xf169('0xe'));return db[_0xf169('0xf')][_0xf169('0x9')]({'where':{}});})[_0xf169('0xa')](function(){return db[_0xf169('0xf')]['bulkCreate'](hopper);})['then'](function(){console['log'](_0xf169('0xd'),_0xf169('0x10'));return db[_0xf169('0x8')]['bulkCreate'](contacts2);})['then'](function(){console[_0xf169('0xc')](_0xf169('0xd'),_0xf169('0x11'));return db['CmHopper']['bulkCreate'](hopper2);})[_0xf169('0xa')](function(){console[_0xf169('0xc')](_0xf169('0xd'),_0xf169('0x12'));})[_0xf169('0x13')](function(_0x4481d8){console[_0xf169('0xc')](_0x4481d8);}); \ No newline at end of file +var _0xc672=['log','hopper1','bulkCreate','hopper2','util','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','then','finished\x20populating','contacts1','CmHopper'];(function(_0x3c4e4c,_0x36ff70){var _0x144a87=function(_0x5efb4b){while(--_0x5efb4b){_0x3c4e4c['push'](_0x3c4e4c['shift']());}};_0x144a87(++_0x36ff70);}(_0xc672,0x19c));var _0x2c67=function(_0x500d45,_0x1c5839){_0x500d45=_0x500d45-0x0;var _0x509a51=_0xc672[_0x500d45];return _0x509a51;};'use strict';var util=require(_0x2c67('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x2c67('0x1')+i,'lastName':_0x2c67('0x2')+i,'phone':0xf879fb460+i,'email':_0x2c67('0x3')+i+_0x2c67('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2c67('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2c67('0x6')](),'updatedAt':Date[_0x2c67('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2c67('0x5')]({'id':i,'firstName':_0x2c67('0x1')+i,'lastName':_0x2c67('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x2c67('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2c67('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2c67('0x6')](),'updatedAt':Date[_0x2c67('0x6')]()});}db[_0x2c67('0x7')][_0x2c67('0x8')]({'where':{}})['then'](function(){return db[_0x2c67('0x7')]['bulkCreate'](contacts);})[_0x2c67('0x9')](function(){console['log'](_0x2c67('0xa'),_0x2c67('0xb'));return db[_0x2c67('0xc')]['destroy']({'where':{}});})[_0x2c67('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0x2c67('0x9')](function(){console[_0x2c67('0xd')](_0x2c67('0xa'),_0x2c67('0xe'));return db[_0x2c67('0x7')][_0x2c67('0xf')](contacts2);})[_0x2c67('0x9')](function(){console[_0x2c67('0xd')](_0x2c67('0xa'),'contacts2');return db['CmHopper'][_0x2c67('0xf')](hopper2);})[_0x2c67('0x9')](function(){console[_0x2c67('0xd')](_0x2c67('0xa'),_0x2c67('0x10'));})['catch'](function(_0x3b621f){console['log'](_0x3b621f);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 9dda018..9323077 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33f0=['all','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','agent','%s%s','%s%s@xcally.com','password','friend','wss'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x33f0,0x186));var _0x033f=function(_0x5903e8,_0x260592){_0x5903e8=_0x5903e8-0x0;var _0x2f3d12=_0x33f0[_0x5903e8];return _0x2f3d12;};'use strict';var util=require(_0x033f('0x0'));var db=require(_0x033f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x033f('0x2')]('%s%s',_0x033f('0x3'),i),'fullname':util[_0x033f('0x2')](_0x033f('0x4'),_0x033f('0x3'),i),'email':util['format'](_0x033f('0x5'),_0x033f('0x3'),i),'role':_0x033f('0x3'),'password':_0x033f('0x6'),'internal':0xfa0+i,'type':_0x033f('0x7'),'transport':['udp','ws',_0x033f('0x8')],'disallow':[_0x033f('0x9')],'allow':['ulaw'],'defaultuser':util[_0x033f('0x2')](_0x033f('0x4'),_0x033f('0x3'),i),'encryption':_0x033f('0xa'),'avpf':'yes','force_avp':_0x033f('0xa'),'icesupport':_0x033f('0xa'),'dtlsenable':_0x033f('0xa'),'dtlsverify':'no','dtlscertfile':_0x033f('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x033f('0x2')](_0x033f('0xc'),util['format'](_0x033f('0x4'),_0x033f('0x3'),i),0xfa0+i)});}db[_0x033f('0xd')][_0x033f('0xe')](users)[_0x033f('0xf')](function(){console[_0x033f('0x10')](_0x033f('0x11'));})[_0x033f('0x12')](function(_0x47e985){console[_0x033f('0x10')](_0x47e985);}); \ No newline at end of file +var _0x138f=['bulkCreate','then','catch','util','../mysqldb','push','format','agent','%s%s','password','friend','udp','wss','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User'];(function(_0x2cac42,_0x362036){var _0xe14c06=function(_0x170030){while(--_0x170030){_0x2cac42['push'](_0x2cac42['shift']());}};_0xe14c06(++_0x362036);}(_0x138f,0x147));var _0xf138=function(_0x18baf4,_0x33086b){_0x18baf4=_0x18baf4-0x0;var _0x278ed1=_0x138f[_0x18baf4];return _0x278ed1;};'use strict';var util=require(_0xf138('0x0'));var db=require(_0xf138('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf138('0x2')]({'name':util[_0xf138('0x3')]('%s%s',_0xf138('0x4'),i),'fullname':util['format'](_0xf138('0x5'),'agent',i),'email':util[_0xf138('0x3')]('%s%s@xcally.com','agent',i),'role':'agent','password':_0xf138('0x6'),'internal':0xfa0+i,'type':_0xf138('0x7'),'transport':[_0xf138('0x8'),'ws',_0xf138('0x9')],'disallow':['all'],'allow':[_0xf138('0xa')],'defaultuser':util[_0xf138('0x3')]('%s%s',_0xf138('0x4'),i),'encryption':_0xf138('0xb'),'avpf':'yes','force_avp':_0xf138('0xb'),'icesupport':'yes','dtlsenable':_0xf138('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xf138('0xc'),'callerid':util[_0xf138('0x3')](_0xf138('0xd'),util['format'](_0xf138('0x5'),'agent',i),0xfa0+i)});}db[_0xf138('0xe')][_0xf138('0xf')](users)[_0xf138('0x10')](function(){console['log']('add\x20user');})[_0xf138('0x11')](function(_0x2b94b1){console['log'](_0x2b94b1);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 8f260ee..a9bd93f 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b26=['ChatQueues','FaxQueues','OpenchannelQueue','Campaign','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','join','default','connection','setMaxListeners','remoteAddress','log','SocketIO\x20','nsp','CONNECTED','lodash','util','bluebird','./environment','name','Agents','User','role','agent','telephone','type','ivr','findOne','then','VoiceQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','where','format','%s:queue:%s','length','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteractions','user:%s','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','voice:outbound'];(function(_0x274314,_0xc51544){var _0x5f472d=function(_0x6dfcd){while(--_0x6dfcd){_0x274314['push'](_0x274314['shift']());}};_0x5f472d(++_0xc51544);}(_0x8b26,0x1f3));var _0x68b2=function(_0x4f357d,_0x3dae2d){_0x4f357d=_0x4f357d-0x0;var _0x21af41=_0x8b26[_0x4f357d];return _0x21af41;};'use strict';var _=require(_0x68b2('0x0'));var util=require(_0x68b2('0x1'));var BPromise=require(_0x68b2('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x68b2('0x3'));var queryQueues={'attributes':['id',_0x68b2('0x4')],'include':[{'as':_0x68b2('0x5'),'model':db[_0x68b2('0x6')],'attributes':['id',_0x68b2('0x4'),_0x68b2('0x7')],'raw':!![],'where':{'role':_0x68b2('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x68b2('0x4')],'where':{'role':_0x68b2('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x68b2('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x68b2('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x68b2('0x4'),_0x68b2('0xa')],'where':{'type':_0x68b2('0xb')}};function getAssociatedResources(_0x5c3531,_0x1d2daf,_0x4e0d4e){return db['UserProfileSection'][_0x68b2('0xc')]({'where':{'name':_0x5c3531,'userProfileId':_0x1d2daf},'raw':!![]})[_0x68b2('0xd')](function(_0x179350){if(_0x179350){if(_0x179350['autoAssociation']){switch(_0x5c3531){case _0x68b2('0xe'):case'ChatQueues':case'FaxQueues':case _0x68b2('0xf'):case _0x68b2('0x10'):case _0x68b2('0x11'):case _0x68b2('0x12'):return db[_0x4e0d4e][_0x68b2('0x13')](queryQueues);case _0x68b2('0x14'):return db[_0x4e0d4e][_0x68b2('0x13')](queryTelephones);case _0x68b2('0x15'):return db[_0x4e0d4e][_0x68b2('0x13')](queryTrunks);case _0x68b2('0x16'):return db[_0x4e0d4e][_0x68b2('0x13')](queryCampaigns);}}else{return db['UserProfileResource'][_0x68b2('0x13')]({'attributes':[_0x68b2('0x17')],'where':{'sectionId':_0x179350['id']},'raw':!![]})[_0x68b2('0xd')](function(_0x1f1e43){if(_0x1f1e43){var _0xffd6d0={'where':{'id':_['map'](_0x1f1e43,_0x68b2('0x17'))},'raw':!![]};switch(_0x4e0d4e){case'User':_0xffd6d0[_0x68b2('0x18')][_0x68b2('0x7')]=_0x68b2('0x9');break;case'Campaign':_0xffd6d0['where'][_0x68b2('0xa')]=_0x68b2('0xb');break;}return db[_0x4e0d4e][_0x68b2('0x13')](_0xffd6d0);}else{return[];}});}}else{return[];}})['then'](function(_0x24b21f){return _0x24b21f;});}function joinOrLeaveQueues(_0x3b8a4a,_0x3a969f,_0x28af4d,_0x313704){_0x3b8a4a[_0x3a969f](util[_0x68b2('0x19')](_0x68b2('0x1a'),_0x28af4d,_0x313704['name']));if(_0x313704[_0x68b2('0x5')]){for(var _0x128c6b=0x0;_0x128c6b<_0x313704[_0x68b2('0x5')][_0x68b2('0x1b')];_0x128c6b+=0x1){_0x3b8a4a[_0x3a969f](util[_0x68b2('0x19')]('user:%s',_0x313704[_0x68b2('0x5')][_0x128c6b][_0x68b2('0x4')]));}}}function joinOrLeave(_0x2cd713,_0x3be271,_0x5bda53){var _0xb835ba;if(_0x2cd713['handshake'][_0x68b2('0x1c')]['id']){db[_0x68b2('0x6')][_0x68b2('0x1d')]({'attributes':['id','name','role',_0x68b2('0x1e')],'where':{'id':_0x2cd713['handshake'][_0x68b2('0x1c')]['id']},'include':[{'model':db[_0x68b2('0x1f')],'as':_0x68b2('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x68b2('0x21')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x68b2('0x22')],'as':_0x68b2('0x23'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x68b2('0x24'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x68b2('0x25'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x68b2('0x26'),'attributes':['id'],'raw':!![]}]})[_0x68b2('0xd')](function(_0x4248f8){if(_0x4248f8){_0xb835ba=_0x4248f8;_0x2cd713[_0x3be271](util[_0x68b2('0x19')](_0x68b2('0x27'),_0x4248f8['name']));var _0x4538e6=[];switch(_0x4248f8[_0x68b2('0x7')]){case'admin':_0x2cd713[_0x3be271](_0x68b2('0x28'));_0x2cd713[_0x3be271]('voice:outbound');if(queryQueues[_0x68b2('0x29')](_0x68b2('0x2a'))){delete queryQueues[_0x68b2('0x2a')];}_0x4538e6[_0x68b2('0x2b')](db[_0x68b2('0x2c')]['findAll'](queryQueues));_0x4538e6['push'](db[_0x68b2('0x2d')][_0x68b2('0x13')](queryQueues));_0x4538e6[_0x68b2('0x2b')](db[_0x68b2('0x2e')][_0x68b2('0x13')](queryQueues));_0x4538e6['push'](db[_0x68b2('0x2f')][_0x68b2('0x13')](queryQueues));_0x4538e6[_0x68b2('0x2b')](db[_0x68b2('0x30')][_0x68b2('0x13')](queryQueues));_0x4538e6[_0x68b2('0x2b')](db['OpenchannelQueue'][_0x68b2('0x13')](queryQueues));_0x4538e6['push'](db[_0x68b2('0x31')][_0x68b2('0x13')](queryQueues));_0x4538e6[_0x68b2('0x2b')](db[_0x68b2('0x6')]['findAll'](queryTelephones));_0x4538e6['push'](db[_0x68b2('0x32')][_0x68b2('0x13')](queryTrunks));_0x4538e6[_0x68b2('0x2b')](db['Campaign'][_0x68b2('0x13')](queryCampaigns));_0x4538e6['push'](db[_0x68b2('0x6')][_0x68b2('0x13')](queryAgents));break;case _0x68b2('0x33'):_0x2cd713[_0x3be271](_0x68b2('0x28'));_0x2cd713[_0x3be271](_0x68b2('0x34'));_0x4538e6[_0x68b2('0x2b')](getAssociatedResources(_0x68b2('0xe'),_0x4248f8[_0x68b2('0x1e')],_0x68b2('0x2c')));_0x4538e6['push'](getAssociatedResources(_0x68b2('0x35'),_0x4248f8[_0x68b2('0x1e')],_0x68b2('0x2d')));_0x4538e6[_0x68b2('0x2b')](getAssociatedResources(_0x68b2('0x36'),_0x4248f8[_0x68b2('0x1e')],_0x68b2('0x2e')));_0x4538e6[_0x68b2('0x2b')](getAssociatedResources(_0x68b2('0xf'),_0x4248f8[_0x68b2('0x1e')],_0x68b2('0x2f')));_0x4538e6[_0x68b2('0x2b')](getAssociatedResources(_0x68b2('0x10'),_0x4248f8[_0x68b2('0x1e')],_0x68b2('0x30')));_0x4538e6['push'](getAssociatedResources('OpenchannelQueues',_0x4248f8[_0x68b2('0x1e')],_0x68b2('0x37')));_0x4538e6[_0x68b2('0x2b')](getAssociatedResources('WhatsappQueues',_0x4248f8[_0x68b2('0x1e')],_0x68b2('0x31')));_0x4538e6[_0x68b2('0x2b')](getAssociatedResources('Telephones',_0x4248f8['userProfileId'],_0x68b2('0x6')));_0x4538e6[_0x68b2('0x2b')](getAssociatedResources('Trunks',_0x4248f8[_0x68b2('0x1e')],'Trunk'));_0x4538e6[_0x68b2('0x2b')](getAssociatedResources(_0x68b2('0x16'),_0x4248f8['userProfileId'],_0x68b2('0x38')));_0x4538e6[_0x68b2('0x2b')](db[_0x68b2('0x6')][_0x68b2('0x13')](queryAgents));break;case _0x68b2('0x8'):_0x2cd713[_0x3be271]('voice:inbound');_0x2cd713[_0x3be271]('voice:outbound');_0x4538e6[_0x68b2('0x2b')](_0x4248f8['getVoiceQueues']({'attributes':['id',_0x68b2('0x4')]}));_0x4538e6['push'](_0x4248f8[_0x68b2('0x39')]({'attributes':['id','name']}));_0x4538e6[_0x68b2('0x2b')](_0x4248f8[_0x68b2('0x3a')]({'attributes':['id',_0x68b2('0x4')]}));_0x4538e6['push'](_0x4248f8[_0x68b2('0x3b')]({'attributes':['id',_0x68b2('0x4')]}));_0x4538e6[_0x68b2('0x2b')](_0x4248f8['getMailQueues']({'attributes':['id',_0x68b2('0x4')]}));_0x4538e6[_0x68b2('0x2b')](_0x4248f8[_0x68b2('0x3c')]({'attributes':['id','name']}));_0x4538e6[_0x68b2('0x2b')](_0x4248f8[_0x68b2('0x3d')]({'attributes':['id',_0x68b2('0x4')]}));break;}return BPromise['all'](_0x4538e6);}})['then'](function(_0x434cfa){if(_0x434cfa&&_0x434cfa[_0x68b2('0x1b')]){for(var _0xd9afb4=0x0;_0xd9afb4<_0x434cfa[_0x68b2('0x1b')];_0xd9afb4+=0x1){for(var _0x4680bc=0x0;_0x4680bc<_0x434cfa[_0xd9afb4][_0x68b2('0x1b')];_0x4680bc+=0x1){switch(_0xd9afb4){case 0x0:joinOrLeaveQueues(_0x2cd713,_0x3be271,_0x68b2('0x3e'),_0x434cfa[_0xd9afb4][_0x4680bc]);break;case 0x1:joinOrLeaveQueues(_0x2cd713,_0x3be271,_0x68b2('0x3f'),_0x434cfa[_0xd9afb4][_0x4680bc]);break;case 0x2:joinOrLeaveQueues(_0x2cd713,_0x3be271,'fax',_0x434cfa[_0xd9afb4][_0x4680bc]);break;case 0x3:joinOrLeaveQueues(_0x2cd713,_0x3be271,'sms',_0x434cfa[_0xd9afb4][_0x4680bc]);break;case 0x4:joinOrLeaveQueues(_0x2cd713,_0x3be271,_0x68b2('0x40'),_0x434cfa[_0xd9afb4][_0x4680bc]);break;case 0x5:joinOrLeaveQueues(_0x2cd713,_0x3be271,_0x68b2('0x41'),_0x434cfa[_0xd9afb4][_0x4680bc]);break;case 0x6:joinOrLeaveQueues(_0x2cd713,_0x3be271,_0x68b2('0x42'),_0x434cfa[_0xd9afb4][_0x4680bc]);break;case 0x7:if(_0xb835ba[_0x68b2('0x7')]!==_0x68b2('0x8'))_0x2cd713[_0x3be271](util[_0x68b2('0x19')](_0x68b2('0x43'),_0x434cfa[_0xd9afb4][_0x4680bc][_0x68b2('0x4')]));break;case 0x8:if(_0xb835ba[_0x68b2('0x7')]!=='agent')_0x2cd713[_0x3be271](util[_0x68b2('0x19')]('trunk:%s',_0x434cfa[_0xd9afb4][_0x4680bc][_0x68b2('0x4')]));break;case 0x9:if(_0xb835ba['role']!=='agent')_0x2cd713[_0x3be271](util[_0x68b2('0x19')](_0x68b2('0x44'),_0x434cfa[_0xd9afb4][_0x4680bc][_0x68b2('0xa')],_0x434cfa[_0xd9afb4][_0x4680bc][_0x68b2('0x4')]));break;case 0xa:_0x2cd713[_0x3be271](util[_0x68b2('0x19')]('user:%s',_0x434cfa[_0xd9afb4][_0x4680bc][_0x68b2('0x4')]));break;}}}}})[_0x68b2('0xd')](function(){if(_0x3be271===_0x68b2('0x45')){var _0x4368b6=_[_0x68b2('0x46')](_0xb835ba['ChatInteractions'],'id');return _0xb835ba[_0x68b2('0x47')](_0x4368b6)[_0x68b2('0xd')](function(){for(var _0x5b6e65=0x0;_0x5b6e65<_0x4368b6['length'];_0x5b6e65+=0x1){_0x5bda53[_0x68b2('0x48')](_0x68b2('0x49'),{'ChatInteractionId':Number(_0x4368b6[_0x5b6e65]),'UserId':Number(_0xb835ba['id'])});}});}})['then'](function(){if(_0x3be271===_0x68b2('0x45')){var _0x3a2205=_['map'](_0xb835ba[_0x68b2('0x4a')],'id');return _0xb835ba['removeMailInteractions'](_0x3a2205)[_0x68b2('0xd')](function(){for(var _0x35cfa0=0x0;_0x35cfa0<_0x3a2205['length'];_0x35cfa0+=0x1){_0x5bda53[_0x68b2('0x48')](_0x68b2('0x4b'),{'MailInteractionId':Number(_0x3a2205[_0x35cfa0]),'UserId':Number(_0xb835ba['id'])});}});}})['then'](function(){if(_0x3be271===_0x68b2('0x45')){var _0x57fb9a=_[_0x68b2('0x46')](_0xb835ba[_0x68b2('0x23')],'id');return _0xb835ba['removeFaxInteractions'](_0x57fb9a)['then'](function(){for(var _0x22853e=0x0;_0x22853e<_0x57fb9a[_0x68b2('0x1b')];_0x22853e+=0x1){_0x5bda53[_0x68b2('0x48')](_0x68b2('0x4c'),{'FaxInteractionId':Number(_0x57fb9a[_0x22853e]),'UserId':Number(_0xb835ba['id'])});}});}})[_0x68b2('0xd')](function(){if(_0x3be271===_0x68b2('0x45')){var _0x456859=_['map'](_0xb835ba['SmsInteractions'],'id');return _0xb835ba[_0x68b2('0x4d')](_0x456859)[_0x68b2('0xd')](function(){for(var _0x2cba35=0x0;_0x2cba35<_0x456859[_0x68b2('0x1b')];_0x2cba35+=0x1){_0x5bda53['emit'](_0x68b2('0x4e'),{'SmsInteractionId':Number(_0x456859[_0x2cba35]),'UserId':Number(_0xb835ba['id'])});}});}})['then'](function(){if(_0x3be271===_0x68b2('0x45')){var _0x3f23d0=_[_0x68b2('0x46')](_0xb835ba[_0x68b2('0x25')],'id');return _0xb835ba[_0x68b2('0x4f')](_0x3f23d0)[_0x68b2('0xd')](function(){for(var _0x21465f=0x0;_0x21465f<_0x3f23d0['length'];_0x21465f+=0x1){_0x5bda53['emit'](_0x68b2('0x50'),{'OpenchannelInteractionId':Number(_0x3f23d0[_0x21465f]),'UserId':Number(_0xb835ba['id'])});}});}})['then'](function(){if(_0x3be271===_0x68b2('0x45')){var _0x5928cc=_[_0x68b2('0x46')](_0xb835ba[_0x68b2('0x26')],'id');return _0xb835ba[_0x68b2('0x51')](_0x5928cc)[_0x68b2('0xd')](function(){for(var _0x192920=0x0;_0x192920<_0x5928cc[_0x68b2('0x1b')];_0x192920+=0x1){_0x5bda53[_0x68b2('0x48')](_0x68b2('0x52'),{'WhatsappInteractionId':Number(_0x5928cc[_0x192920]),'UserId':Number(_0xb835ba['id'])});}});}})['catch'](function(_0x685971){_0x2cd713['log'](_0x685971);});}}function onDisconnect(_0x55268c,_0x869506){joinOrLeave(_0x55268c,_0x68b2('0x45'),_0x869506);}function onConnect(_0x17c765){joinOrLeave(_0x17c765,_0x68b2('0x53'));}exports[_0x68b2('0x54')]=function(_0x1cdee1){_0x1cdee1['on'](_0x68b2('0x55'),function(_0x577cd3){_0x577cd3[_0x68b2('0x56')](0x0);_0x577cd3['address']=_0x577cd3['request'][_0x68b2('0x55')][_0x68b2('0x57')]+':'+_0x577cd3['request'][_0x68b2('0x55')]['remotePort'];_0x577cd3['connectedAt']=new Date();_0x577cd3[_0x68b2('0x58')]=function(_0x5f2ca8){console[_0x68b2('0x58')](_0x68b2('0x59')+_0x577cd3[_0x68b2('0x5a')][_0x68b2('0x4')]+'['+_0x577cd3['address']+']',_0x5f2ca8);};_0x577cd3['on']('disconnect',function(){onDisconnect(_0x577cd3,_0x1cdee1);_0x577cd3['log']('DISCONNECTED');});onConnect(_0x577cd3);_0x577cd3[_0x68b2('0x58')](_0x68b2('0x5b'));});}; \ No newline at end of file +var _0xb49b=['leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','log','join','connection','setMaxListeners','address','request','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','util','../mysqldb','./environment','Agents','User','role','agent','name','telephone','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','type','ivr','format','length','handshake','query','userProfileId','ChatInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','include','push','VoiceQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','FaxQueues','SmsQueue','voice:outbound','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','map','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove'];(function(_0x568c82,_0x51653b){var _0x6b8145=function(_0x532165){while(--_0x532165){_0x568c82['push'](_0x568c82['shift']());}};_0x6b8145(++_0x51653b);}(_0xb49b,0x194));var _0xbb49=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb49b[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xbb49('0x0'));var BPromise=require('bluebird');var db=require(_0xbb49('0x1'))['db'];var config=require(_0xbb49('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xbb49('0x3'),'model':db[_0xbb49('0x4')],'attributes':['id','name',_0xbb49('0x5')],'raw':!![],'where':{'role':_0xbb49('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xbb49('0x7')],'where':{'role':_0xbb49('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xbb49('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0xbb49('0x7')],'where':{'role':_0xbb49('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xbb49('0x7'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x51b1c5,_0x34ec80,_0x3a21ae){return db[_0xbb49('0x9')]['findOne']({'where':{'name':_0x51b1c5,'userProfileId':_0x34ec80},'raw':!![]})[_0xbb49('0xa')](function(_0xf4c138){if(_0xf4c138){if(_0xf4c138[_0xbb49('0xb')]){switch(_0x51b1c5){case _0xbb49('0xc'):case _0xbb49('0xd'):case'FaxQueues':case _0xbb49('0xe'):case _0xbb49('0xf'):case _0xbb49('0x10'):case _0xbb49('0x11'):return db[_0x3a21ae][_0xbb49('0x12')](queryQueues);case _0xbb49('0x13'):return db[_0x3a21ae][_0xbb49('0x12')](queryTelephones);case _0xbb49('0x14'):return db[_0x3a21ae][_0xbb49('0x12')](queryTrunks);case _0xbb49('0x15'):return db[_0x3a21ae][_0xbb49('0x12')](queryCampaigns);}}else{return db[_0xbb49('0x16')][_0xbb49('0x12')]({'attributes':[_0xbb49('0x17')],'where':{'sectionId':_0xf4c138['id']},'raw':!![]})[_0xbb49('0xa')](function(_0x311cb9){if(_0x311cb9){var _0x226e53={'where':{'id':_['map'](_0x311cb9,_0xbb49('0x17'))},'raw':!![]};switch(_0x3a21ae){case _0xbb49('0x4'):_0x226e53[_0xbb49('0x18')][_0xbb49('0x5')]=_0xbb49('0x8');break;case _0xbb49('0x19'):_0x226e53[_0xbb49('0x18')][_0xbb49('0x1a')]=_0xbb49('0x1b');break;}return db[_0x3a21ae][_0xbb49('0x12')](_0x226e53);}else{return[];}});}}else{return[];}})[_0xbb49('0xa')](function(_0xc93091){return _0xc93091;});}function joinOrLeaveQueues(_0x586110,_0x377439,_0x133a28,_0x3eced9){_0x586110[_0x377439](util[_0xbb49('0x1c')]('%s:queue:%s',_0x133a28,_0x3eced9[_0xbb49('0x7')]));if(_0x3eced9[_0xbb49('0x3')]){for(var _0x28fb4e=0x0;_0x28fb4e<_0x3eced9[_0xbb49('0x3')][_0xbb49('0x1d')];_0x28fb4e+=0x1){_0x586110[_0x377439](util[_0xbb49('0x1c')]('user:%s',_0x3eced9[_0xbb49('0x3')][_0x28fb4e][_0xbb49('0x7')]));}}}function joinOrLeave(_0x4f551f,_0x7a53a2,_0x4c60f1){var _0x4958c3;if(_0x4f551f[_0xbb49('0x1e')][_0xbb49('0x1f')]['id']){db[_0xbb49('0x4')]['find']({'attributes':['id','name',_0xbb49('0x5'),_0xbb49('0x20')],'where':{'id':_0x4f551f[_0xbb49('0x1e')][_0xbb49('0x1f')]['id']},'include':[{'model':db[_0xbb49('0x21')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xbb49('0x22'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xbb49('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xbb49('0x24')],'as':_0xbb49('0x25'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xbb49('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xbb49('0x27')],'as':_0xbb49('0x28'),'attributes':['id'],'raw':!![]}]})[_0xbb49('0xa')](function(_0x497ba3){if(_0x497ba3){_0x4958c3=_0x497ba3;_0x4f551f[_0x7a53a2](util['format'](_0xbb49('0x29'),_0x497ba3[_0xbb49('0x7')]));var _0x8fac77=[];switch(_0x497ba3[_0xbb49('0x5')]){case _0xbb49('0x2a'):_0x4f551f[_0x7a53a2](_0xbb49('0x2b'));_0x4f551f[_0x7a53a2]('voice:outbound');if(queryQueues['hasOwnProperty'](_0xbb49('0x2c'))){delete queryQueues[_0xbb49('0x2c')];}_0x8fac77[_0xbb49('0x2d')](db[_0xbb49('0x2e')][_0xbb49('0x12')](queryQueues));_0x8fac77[_0xbb49('0x2d')](db['ChatQueue'][_0xbb49('0x12')](queryQueues));_0x8fac77[_0xbb49('0x2d')](db[_0xbb49('0x2f')][_0xbb49('0x12')](queryQueues));_0x8fac77[_0xbb49('0x2d')](db['SmsQueue'][_0xbb49('0x12')](queryQueues));_0x8fac77[_0xbb49('0x2d')](db[_0xbb49('0x30')][_0xbb49('0x12')](queryQueues));_0x8fac77[_0xbb49('0x2d')](db[_0xbb49('0x31')][_0xbb49('0x12')](queryQueues));_0x8fac77[_0xbb49('0x2d')](db[_0xbb49('0x32')][_0xbb49('0x12')](queryQueues));_0x8fac77['push'](db[_0xbb49('0x4')][_0xbb49('0x12')](queryTelephones));_0x8fac77['push'](db[_0xbb49('0x33')]['findAll'](queryTrunks));_0x8fac77[_0xbb49('0x2d')](db[_0xbb49('0x19')][_0xbb49('0x12')](queryCampaigns));_0x8fac77['push'](db[_0xbb49('0x4')][_0xbb49('0x12')](queryAgents));break;case _0xbb49('0x34'):_0x4f551f[_0x7a53a2](_0xbb49('0x2b'));_0x4f551f[_0x7a53a2]('voice:outbound');_0x8fac77[_0xbb49('0x2d')](getAssociatedResources(_0xbb49('0xc'),_0x497ba3['userProfileId'],_0xbb49('0x2e')));_0x8fac77[_0xbb49('0x2d')](getAssociatedResources(_0xbb49('0xd'),_0x497ba3[_0xbb49('0x20')],'ChatQueue'));_0x8fac77[_0xbb49('0x2d')](getAssociatedResources(_0xbb49('0x35'),_0x497ba3[_0xbb49('0x20')],_0xbb49('0x2f')));_0x8fac77[_0xbb49('0x2d')](getAssociatedResources(_0xbb49('0xe'),_0x497ba3[_0xbb49('0x20')],_0xbb49('0x36')));_0x8fac77[_0xbb49('0x2d')](getAssociatedResources('MailQueues',_0x497ba3[_0xbb49('0x20')],_0xbb49('0x30')));_0x8fac77['push'](getAssociatedResources(_0xbb49('0x10'),_0x497ba3['userProfileId'],_0xbb49('0x31')));_0x8fac77[_0xbb49('0x2d')](getAssociatedResources('WhatsappQueues',_0x497ba3[_0xbb49('0x20')],'WhatsappQueue'));_0x8fac77[_0xbb49('0x2d')](getAssociatedResources(_0xbb49('0x13'),_0x497ba3[_0xbb49('0x20')],_0xbb49('0x4')));_0x8fac77[_0xbb49('0x2d')](getAssociatedResources(_0xbb49('0x14'),_0x497ba3['userProfileId'],'Trunk'));_0x8fac77[_0xbb49('0x2d')](getAssociatedResources(_0xbb49('0x15'),_0x497ba3[_0xbb49('0x20')],'Campaign'));_0x8fac77[_0xbb49('0x2d')](db[_0xbb49('0x4')][_0xbb49('0x12')](queryAgents));break;case'agent':_0x4f551f[_0x7a53a2](_0xbb49('0x2b'));_0x4f551f[_0x7a53a2](_0xbb49('0x37'));_0x8fac77[_0xbb49('0x2d')](_0x497ba3[_0xbb49('0x38')]({'attributes':['id',_0xbb49('0x7')]}));_0x8fac77[_0xbb49('0x2d')](_0x497ba3['getChatQueues']({'attributes':['id',_0xbb49('0x7')]}));_0x8fac77[_0xbb49('0x2d')](_0x497ba3[_0xbb49('0x39')]({'attributes':['id',_0xbb49('0x7')]}));_0x8fac77[_0xbb49('0x2d')](_0x497ba3[_0xbb49('0x3a')]({'attributes':['id',_0xbb49('0x7')]}));_0x8fac77[_0xbb49('0x2d')](_0x497ba3[_0xbb49('0x3b')]({'attributes':['id',_0xbb49('0x7')]}));_0x8fac77[_0xbb49('0x2d')](_0x497ba3[_0xbb49('0x3c')]({'attributes':['id','name']}));_0x8fac77['push'](_0x497ba3['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0xbb49('0x3d')](_0x8fac77);}})[_0xbb49('0xa')](function(_0xce014){if(_0xce014&&_0xce014[_0xbb49('0x1d')]){for(var _0x275c0d=0x0;_0x275c0d<_0xce014['length'];_0x275c0d+=0x1){for(var _0x2e31a4=0x0;_0x2e31a4<_0xce014[_0x275c0d][_0xbb49('0x1d')];_0x2e31a4+=0x1){switch(_0x275c0d){case 0x0:joinOrLeaveQueues(_0x4f551f,_0x7a53a2,_0xbb49('0x3e'),_0xce014[_0x275c0d][_0x2e31a4]);break;case 0x1:joinOrLeaveQueues(_0x4f551f,_0x7a53a2,_0xbb49('0x3f'),_0xce014[_0x275c0d][_0x2e31a4]);break;case 0x2:joinOrLeaveQueues(_0x4f551f,_0x7a53a2,_0xbb49('0x40'),_0xce014[_0x275c0d][_0x2e31a4]);break;case 0x3:joinOrLeaveQueues(_0x4f551f,_0x7a53a2,_0xbb49('0x41'),_0xce014[_0x275c0d][_0x2e31a4]);break;case 0x4:joinOrLeaveQueues(_0x4f551f,_0x7a53a2,_0xbb49('0x42'),_0xce014[_0x275c0d][_0x2e31a4]);break;case 0x5:joinOrLeaveQueues(_0x4f551f,_0x7a53a2,_0xbb49('0x43'),_0xce014[_0x275c0d][_0x2e31a4]);break;case 0x6:joinOrLeaveQueues(_0x4f551f,_0x7a53a2,_0xbb49('0x44'),_0xce014[_0x275c0d][_0x2e31a4]);break;case 0x7:if(_0x4958c3[_0xbb49('0x5')]!==_0xbb49('0x6'))_0x4f551f[_0x7a53a2](util[_0xbb49('0x1c')]('telephone:%s',_0xce014[_0x275c0d][_0x2e31a4][_0xbb49('0x7')]));break;case 0x8:if(_0x4958c3['role']!==_0xbb49('0x6'))_0x4f551f[_0x7a53a2](util['format'](_0xbb49('0x45'),_0xce014[_0x275c0d][_0x2e31a4][_0xbb49('0x7')]));break;case 0x9:if(_0x4958c3['role']!=='agent')_0x4f551f[_0x7a53a2](util[_0xbb49('0x1c')](_0xbb49('0x46'),_0xce014[_0x275c0d][_0x2e31a4][_0xbb49('0x1a')],_0xce014[_0x275c0d][_0x2e31a4]['name']));break;case 0xa:_0x4f551f[_0x7a53a2](util['format']('user:%s',_0xce014[_0x275c0d][_0x2e31a4]['name']));break;}}}}})['then'](function(){if(_0x7a53a2==='leave'){var _0x47b0cc=_[_0xbb49('0x47')](_0x4958c3[_0xbb49('0x48')],'id');return _0x4958c3[_0xbb49('0x49')](_0x47b0cc)[_0xbb49('0xa')](function(){for(var _0x3549ae=0x0;_0x3549ae<_0x47b0cc[_0xbb49('0x1d')];_0x3549ae+=0x1){_0x4c60f1[_0xbb49('0x4a')](_0xbb49('0x4b'),{'ChatInteractionId':Number(_0x47b0cc[_0x3549ae]),'UserId':Number(_0x4958c3['id'])});}});}})[_0xbb49('0xa')](function(){if(_0x7a53a2===_0xbb49('0x4c')){var _0x411e6a=_[_0xbb49('0x47')](_0x4958c3[_0xbb49('0x22')],'id');return _0x4958c3[_0xbb49('0x4d')](_0x411e6a)[_0xbb49('0xa')](function(){for(var _0x3db708=0x0;_0x3db708<_0x411e6a[_0xbb49('0x1d')];_0x3db708+=0x1){_0x4c60f1[_0xbb49('0x4a')](_0xbb49('0x4e'),{'MailInteractionId':Number(_0x411e6a[_0x3db708]),'UserId':Number(_0x4958c3['id'])});}});}})['then'](function(){if(_0x7a53a2===_0xbb49('0x4c')){var _0x104994=_['map'](_0x4958c3[_0xbb49('0x23')],'id');return _0x4958c3[_0xbb49('0x4f')](_0x104994)[_0xbb49('0xa')](function(){for(var _0x149d97=0x0;_0x149d97<_0x104994[_0xbb49('0x1d')];_0x149d97+=0x1){_0x4c60f1[_0xbb49('0x4a')](_0xbb49('0x50'),{'FaxInteractionId':Number(_0x104994[_0x149d97]),'UserId':Number(_0x4958c3['id'])});}});}})[_0xbb49('0xa')](function(){if(_0x7a53a2===_0xbb49('0x4c')){var _0x5350a6=_['map'](_0x4958c3[_0xbb49('0x25')],'id');return _0x4958c3[_0xbb49('0x51')](_0x5350a6)[_0xbb49('0xa')](function(){for(var _0x4e51f0=0x0;_0x4e51f0<_0x5350a6[_0xbb49('0x1d')];_0x4e51f0+=0x1){_0x4c60f1[_0xbb49('0x4a')](_0xbb49('0x52'),{'SmsInteractionId':Number(_0x5350a6[_0x4e51f0]),'UserId':Number(_0x4958c3['id'])});}});}})['then'](function(){if(_0x7a53a2===_0xbb49('0x4c')){var _0x557b73=_['map'](_0x4958c3[_0xbb49('0x26')],'id');return _0x4958c3['removeOpenchannelInteractions'](_0x557b73)[_0xbb49('0xa')](function(){for(var _0x2e6e0c=0x0;_0x2e6e0c<_0x557b73[_0xbb49('0x1d')];_0x2e6e0c+=0x1){_0x4c60f1['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x557b73[_0x2e6e0c]),'UserId':Number(_0x4958c3['id'])});}});}})[_0xbb49('0xa')](function(){if(_0x7a53a2==='leave'){var _0x431083=_[_0xbb49('0x47')](_0x4958c3['WhatsappInteractions'],'id');return _0x4958c3[_0xbb49('0x53')](_0x431083)['then'](function(){for(var _0x14738d=0x0;_0x14738d<_0x431083[_0xbb49('0x1d')];_0x14738d+=0x1){_0x4c60f1[_0xbb49('0x4a')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x431083[_0x14738d]),'UserId':Number(_0x4958c3['id'])});}});}})['catch'](function(_0x4affec){_0x4f551f[_0xbb49('0x54')](_0x4affec);});}}function onDisconnect(_0x16d24e,_0x25bfe4){joinOrLeave(_0x16d24e,_0xbb49('0x4c'),_0x25bfe4);}function onConnect(_0x25f850){joinOrLeave(_0x25f850,_0xbb49('0x55'));}exports['default']=function(_0x477997){_0x477997['on'](_0xbb49('0x56'),function(_0x36a8c1){_0x36a8c1[_0xbb49('0x57')](0x0);_0x36a8c1[_0xbb49('0x58')]=_0x36a8c1[_0xbb49('0x59')][_0xbb49('0x56')]['remoteAddress']+':'+_0x36a8c1[_0xbb49('0x59')][_0xbb49('0x56')][_0xbb49('0x5a')];_0x36a8c1[_0xbb49('0x5b')]=new Date();_0x36a8c1['log']=function(_0x449d8e){console['log']('SocketIO\x20'+_0x36a8c1[_0xbb49('0x5c')][_0xbb49('0x7')]+'['+_0x36a8c1[_0xbb49('0x58')]+']',_0x449d8e);};_0x36a8c1['on'](_0xbb49('0x5d'),function(){onDisconnect(_0x36a8c1,_0x477997);_0x36a8c1[_0xbb49('0x54')](_0xbb49('0x5e'));});onConnect(_0x36a8c1);_0x36a8c1[_0xbb49('0x54')](_0xbb49('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index ca7599b..2ba5c8b 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 _0x0431=['SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','then','info','EventManager','error','code','Trigger,\x20%s','catch','get','channel','CmContact','describe','length','cf_','sequelize','query','Sequelize','contact','UserId','find','format','name','incomingmessage','outgoingmessage','event','opened','keys','startsWith','push','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','changed','closed','QueryTypes','User','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','lodash','client','http','ChatInteraction','afterUpdate','closedinteraction','Chat','afterCreate','newmessage','Sms','SmsInteraction','newinteraction'];(function(_0x3d42ff,_0x1c03b7){var _0x284ce1=function(_0x1ed9cf){while(--_0x1ed9cf){_0x3d42ff['push'](_0x3d42ff['shift']());}};_0x284ce1(++_0x1c03b7);}(_0x0431,0x1da));var _0x1043=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x0431[_0x1d9aa0];return _0x226868;};'use strict';var util=require(_0x1043('0x0'));var db=require(_0x1043('0x1'))['db'];var jayson=require(_0x1043('0x2'));var logger=require(_0x1043('0x3'))('triggers');var _=require(_0x1043('0x4'));var client=jayson[_0x1043('0x5')][_0x1043('0x6')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x1043('0x7'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':_0x1043('0x7'),'event':_0x1043('0x8'),'condition':_0x1043('0x9'),'callback':afterUpdate},{'channel':_0x1043('0xa'),'model':'ChatMessage','event':_0x1043('0xb'),'condition':_0x1043('0xc'),'callback':afterCreateMessage},{'channel':_0x1043('0xd'),'model':_0x1043('0xe'),'event':_0x1043('0xb'),'condition':_0x1043('0xf'),'callback':afterCreate},{'channel':_0x1043('0xd'),'model':_0x1043('0xe'),'event':'afterUpdate','condition':_0x1043('0x9'),'callback':afterUpdate},{'channel':_0x1043('0xd'),'model':_0x1043('0x10'),'event':_0x1043('0xb'),'condition':_0x1043('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x1043('0xb'),'condition':_0x1043('0xf'),'callback':afterCreate},{'channel':_0x1043('0x11'),'model':_0x1043('0x12'),'event':_0x1043('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1043('0x11'),'model':_0x1043('0x13'),'event':'afterCreate','condition':_0x1043('0xc'),'callback':afterCreateMessage},{'channel':_0x1043('0x14'),'model':_0x1043('0x15'),'event':_0x1043('0xb'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x1043('0x14'),'model':'FaxInteraction','event':_0x1043('0x8'),'condition':_0x1043('0x9'),'callback':afterUpdate},{'channel':_0x1043('0x14'),'model':_0x1043('0x16'),'event':_0x1043('0xb'),'condition':_0x1043('0xc'),'callback':afterCreateMessage},{'channel':_0x1043('0x17'),'model':_0x1043('0x18'),'event':_0x1043('0xb'),'condition':_0x1043('0xf'),'callback':afterCreate},{'channel':_0x1043('0x17'),'model':'MailInteraction','event':_0x1043('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1043('0x17'),'model':_0x1043('0x19'),'event':_0x1043('0xb'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1043('0x1a'),'model':_0x1043('0x1b'),'event':_0x1043('0xb'),'condition':_0x1043('0xf'),'callback':afterCreate},{'channel':_0x1043('0x1a'),'model':_0x1043('0x1b'),'event':_0x1043('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1043('0x1a'),'model':'OpenchannelMessage','event':_0x1043('0xb'),'condition':_0x1043('0xc'),'callback':afterCreateMessage}];function request(_0x281aa3){return client[_0x1043('0x1c')]('EventManager',_0x281aa3)[_0x1043('0x1d')](function(_0x5eeff9){logger[_0x1043('0x1e')]('Trigger,\x20%s',_0x1043('0x1f'),_0x5eeff9);if(_0x5eeff9[_0x1043('0x20')]){if(_0x5eeff9[_0x1043('0x20')][_0x1043('0x21')]===0x1f4){logger[_0x1043('0x20')](_0x1043('0x22'),_0x1043('0x1f'),_0x5eeff9['error']);}}})[_0x1043('0x23')](function(_0x4237d0){logger[_0x1043('0x20')](_0x1043('0x22'),'EventManager',_0x4237d0);});}function afterCreateMessage(_0x5be0c0,_0x31d624){return function(_0x1fd152,_0x5a23ec){_0x1fd152=_0x1fd152[_0x1043('0x24')]({'plain':!![]});_0x1fd152[_0x1043('0x25')]=_0x5be0c0;_0x1fd152['event']=_0x1fd152['direction'];return db[_0x1043('0x26')][_0x1043('0x27')]()[_0x1043('0x1d')](function(_0x382b1a){var _0x2970df=[];for(var _0x23c17f=0x0;_0x23c17f=_0x2f70a2['agents']){throw Error(_0xeee3('0x16'));}_0x1662da(_0x55093f);})[_0xeee3('0x17')](function(_0x5667f1){_0xc2eeca(_0x5667f1);});});}; \ No newline at end of file +var _0xdf1e=['count','then','agents','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User'];(function(_0x426c11,_0xb9c844){var _0x2aa258=function(_0x42fa91){while(--_0x42fa91){_0x426c11['push'](_0x426c11['shift']());}};_0x2aa258(++_0xb9c844);}(_0xdf1e,0xb3));var _0xedf1=function(_0x8025e8,_0x3641b9){_0x8025e8=_0x8025e8-0x0;var _0x27b01e=_0xdf1e[_0x8025e8];return _0x27b01e;};'use strict';var _=require(_0xedf1('0x0'));var BPromise=require(_0xedf1('0x1'));var db=require(_0xedf1('0x2'))['db'];var util=require(_0xedf1('0x3'));var channels=[_0xedf1('0x4'),_0xedf1('0x5'),'chat','fax',_0xedf1('0x6'),_0xedf1('0x7'),_0xedf1('0x8')];exports[_0xedf1('0x9')]=function(){return channels;};exports[_0xedf1('0xa')]=function(_0xc8777){_0xc8777=_0xc8777[_0xedf1('0xb')]();return _[_0xedf1('0xc')](channels,_0xc8777);};exports[_0xedf1('0xd')]=function(_0x499b32,_0x119d2e,_0xd3d95a,_0x317d2b){var _0xe7a6cc={'loginAttempts':_0x119d2e,'blocked':_0xd3d95a};if(!_[_0xedf1('0xe')](_0x317d2b)){_0xe7a6cc[_0xedf1('0xf')]=_0x317d2b;}return _0x499b32[_0xedf1('0x10')](_0xe7a6cc);};exports[_0xedf1('0x11')]=function(_0x92976d){return new BPromise(function(_0x1fcdee,_0x32fb4d){var _0xd5c237=0x0;if(_0x92976d[_0xedf1('0x12')]!==_0xedf1('0x13')){_0x1fcdee(_0x92976d);}db[_0xedf1('0x14')][_0xedf1('0x15')]({'where':{'role':_0xedf1('0x13'),'online':!![],'id':{'$ne':_0x92976d['id']}}})[_0xedf1('0x16')](function(_0x3c420a){_0xd5c237=_0x3c420a;return util[_0xedf1('0x11')]();})[_0xedf1('0x16')](function(_0x226394){if(_0x226394&&_0x226394['agents']&&_0xd5c237>=_0x226394[_0xedf1('0x17')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1fcdee(_0x92976d);})[_0xedf1('0x18')](function(_0x54c637){_0x32fb4d(_0x54c637);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index bab690d..2f39465 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7602=['json','send','exports','404','status','render'];(function(_0x4af376,_0x22c5c0){var _0x17f4c6=function(_0xa3de50){while(--_0xa3de50){_0x4af376['push'](_0x4af376['shift']());}};_0x17f4c6(++_0x22c5c0);}(_0x7602,0x1a6));var _0x2760=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x7602[_0x42bdad];return _0x122626;};'use strict';module[_0x2760('0x0')][0x194]=function pageNotFound(_0x52dcc8,_0x26c86d){var _0xdff6a3=_0x2760('0x1');var _0x4d73f4=0x194;var _0x36b776={'status':_0x4d73f4};_0x26c86d[_0x2760('0x2')](_0x36b776['status']);_0x26c86d[_0x2760('0x3')](_0xdff6a3,{},function(_0x204af6,_0x197079){if(_0x204af6){return _0x26c86d[_0x2760('0x2')](_0x36b776[_0x2760('0x2')])[_0x2760('0x4')](_0x36b776);}_0x26c86d[_0x2760('0x5')](_0x197079);});}; \ No newline at end of file +var _0x4ee4=['status','render','json'];(function(_0x27bb5b,_0xc7c676){var _0xef8210=function(_0x43867f){while(--_0x43867f){_0x27bb5b['push'](_0x27bb5b['shift']());}};_0xef8210(++_0xc7c676);}(_0x4ee4,0x1c8));var _0x44ee=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x4ee4[_0x236d24];return _0x1574cf;};'use strict';module['exports'][0x194]=function pageNotFound(_0x205175,_0x39a94a){var _0x55dd26='404';var _0x1e067a=0x194;var _0x21a47c={'status':_0x1e067a};_0x39a94a[_0x44ee('0x0')](_0x21a47c[_0x44ee('0x0')]);_0x39a94a[_0x44ee('0x1')](_0x55dd26,{},function(_0x863814,_0x1d24e2){if(_0x863814){return _0x39a94a[_0x44ee('0x0')](_0x21a47c['status'])[_0x44ee('0x2')](_0x21a47c);}_0x39a94a['send'](_0x1d24e2);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 2598225..ad57ae4 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57e1=['ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','Plugin','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','cascade','HopperFinals','HopperHistory','OpenchannelInteraction','ChatInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','VoiceChanSpy','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','VoiceQueue','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','Messages','mailboxuser','QueueCalls','uniqueid','AgentReports','CmContact','Contact','ContactId','MailAccountId','hasOne','Imap','Smtp','Answers','List','ListId','TemplateId','Agents','team_has_mail_queues','MailMessage','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','Items','Disposition','Dispositions','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Users','SmsAccountId','SmsMessage','Interactions','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','chat_group_has_users','Website','CmCompany','CompanyId','Phones','CmContactId','JscriptySessionReport','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','OneAll','Any','OneAny','AutomationAnyId','Action','AutomationId','ParentId','MailApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','CustomReportId','VoiceMusicOnHold','Mohs','whatsapp_interaction_has_tags','CmContactHasItem','ContactItemType','ItemType','AllConditions','AllCondition','TriggerAllId','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','DefaultReportId','AnalyticMetric','MetricId','SalesforceConfiguration','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Field','FieldId','VariableId','SugarcrmConfiguration','Description','int_desk_configuration_has_tags','ZohoAccount','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','ServicenowConfiguration','ServicenowAccount','FromId','SessionId','ProjectId','team_has_chat_queues','team_has_fax_queues','team_has_whatsapp_queues','TrunkBackup','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','FromChatWebsiteId','ToAgent','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','FromAccount','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToSmsQueueId','ToSmsAccountId','CmCustomField','Queues','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xcall','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','mysql','database','username','options','password','User','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model'];(function(_0x177e0e,_0x3c86a8){var _0x6b2089=function(_0x5e361b){while(--_0x5e361b){_0x177e0e['push'](_0x177e0e['shift']());}};_0x6b2089(++_0x3c86a8);}(_0x57e1,0x182));var _0x157e=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0x57e1[_0x400322];return _0xfdd597;};'use strict';var path=require(_0x157e('0x0'));var config=require(_0x157e('0x1'));var Sequelize=require('sequelize');var _=require(_0x157e('0x2'));var jstz=require(_0x157e('0x3'));var timezone=jstz[_0x157e('0x4')]();config[_0x157e('0x5')]=_[_0x157e('0x6')](config['sequelize'],{'database':_0x157e('0x7'),'username':_0x157e('0x8'),'password':'xC@LL1234','options':{'host':_0x157e('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x157e('0xa')},'logging':![],'timezone':timezone[_0x157e('0xb')](),'define':{'charset':_0x157e('0xc'),'collate':_0x157e('0xd')}}});config[_0x157e('0xe')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':'motion2','username':'xcall','password':_0x157e('0xf'),'options':{'host':_0x157e('0x9'),'port':0xcea,'dialect':_0x157e('0x10'),'dialectOptions':{'charset':_0x157e('0xa')},'logging':![],'timezone':timezone[_0x157e('0xb')](),'define':{'charset':'utf8','collate':_0x157e('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x157e('0x5')][_0x157e('0x11')],config[_0x157e('0x5')][_0x157e('0x12')],config['sequelize']['password'],config['sequelize'][_0x157e('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x157e('0xe')][_0x157e('0x11')],config['sequelizeHistory'][_0x157e('0x12')],config[_0x157e('0xe')][_0x157e('0x14')],config[_0x157e('0xe')]['options'])};db[_0x157e('0x15')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/user/user.model');db['VoiceChanSpy']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x17'));db[_0x157e('0x18')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x19'));db[_0x157e('0x1a')]=db['sequelize'][_0x157e('0x16')](_0x157e('0x1b'));db['VoiceMusicOnHold']=db[_0x157e('0x5')][_0x157e('0x16')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x157e('0x5')][_0x157e('0x16')]('../api/voiceQueue/voiceQueue.model');db[_0x157e('0x1c')]=db['sequelize'][_0x157e('0x16')](_0x157e('0x1d'));db[_0x157e('0x1e')]=db['sequelize'][_0x157e('0x16')](_0x157e('0x1f'));db[_0x157e('0x20')]=db[_0x157e('0x5')]['import'](_0x157e('0x21'));db[_0x157e('0x22')]=db['sequelize'][_0x157e('0x16')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x157e('0x23')]=db['sequelize'][_0x157e('0x16')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x24'));db[_0x157e('0x25')]=db['sequelize'][_0x157e('0x16')](_0x157e('0x26'));db['VoiceQueueReport']=db[_0x157e('0x5')][_0x157e('0x16')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x27'));db[_0x157e('0x28')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x29'));db[_0x157e('0x2a')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x2b'));db[_0x157e('0x2c')]=db['sequelize'][_0x157e('0x16')](_0x157e('0x2d'));db[_0x157e('0x2e')]=db['sequelize'][_0x157e('0x16')](_0x157e('0x2f'));db[_0x157e('0x30')]=db['sequelize']['import'](_0x157e('0x31'));db[_0x157e('0x32')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x33'));db[_0x157e('0x34')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x35'));db[_0x157e('0x36')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x37'));db[_0x157e('0x38')]=db['sequelize'][_0x157e('0x16')](_0x157e('0x39'));db[_0x157e('0x3a')]=db['sequelize'][_0x157e('0x16')]('../api/mailServerIn/mailServerIn.model');db[_0x157e('0x3b')]=db[_0x157e('0x5')]['import']('../api/mailServerOut/mailServerOut.model');db[_0x157e('0x3c')]=db['sequelize']['import']('../api/mailAccount/mailAccount.model');db[_0x157e('0x3d')]=db[_0x157e('0x5')]['import'](_0x157e('0x3e'));db[_0x157e('0x3f')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x40'));db[_0x157e('0x41')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x42'));db['MailMessage']=db['sequelize'][_0x157e('0x16')](_0x157e('0x43'));db[_0x157e('0x44')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x45'));db[_0x157e('0x46')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x47'));db[_0x157e('0x48')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x49'));db[_0x157e('0x4a')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x4b'));db[_0x157e('0x4c')]=db[_0x157e('0x5')]['import'](_0x157e('0x4d'));db[_0x157e('0x4e')]=db[_0x157e('0x5')]['import']('../api/faxApplication/faxApplication.model');db[_0x157e('0x4f')]=db['sequelize']['import'](_0x157e('0x50'));db[_0x157e('0x51')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x52'));db[_0x157e('0x53')]=db[_0x157e('0x5')]['import'](_0x157e('0x54'));db[_0x157e('0x55')]=db['sequelize'][_0x157e('0x16')]('../api/faxQueueReport/faxQueueReport.model');db[_0x157e('0x56')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x57'));db[_0x157e('0x58')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x59'));db[_0x157e('0x5a')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x5b'));db['SmsMessage']=db[_0x157e('0x5')][_0x157e('0x16')]('../api/smsMessage/smsMessage.model');db[_0x157e('0x5c')]=db[_0x157e('0x5')]['import']('../api/smsQueue/smsQueue.model');db[_0x157e('0x5d')]=db[_0x157e('0x5')]['import'](_0x157e('0x5e'));db['OpenchannelApplication']=db[_0x157e('0x5')]['import'](_0x157e('0x5f'));db['OpenchannelInteraction']=db['sequelize']['import'](_0x157e('0x60'));db['OpenchannelMessage']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x61'));db[_0x157e('0x62')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x63'));db[_0x157e('0x64')]=db['sequelize'][_0x157e('0x16')](_0x157e('0x65'));db[_0x157e('0x66')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x67'));db['ChatApplication']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x68'));db[_0x157e('0x69')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/chatInteraction/chatInteraction.model');db[_0x157e('0x6a')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x6b'));db[_0x157e('0x6c')]=db['sequelize'][_0x157e('0x16')](_0x157e('0x6d'));db[_0x157e('0x6e')]=db[_0x157e('0x5')]['import'](_0x157e('0x6f'));db[_0x157e('0x70')]=db['sequelize'][_0x157e('0x16')](_0x157e('0x71'));db[_0x157e('0x72')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x73'));db['CmCompany']=db['sequelize']['import']('../api/cmCompany/cmCompany.model');db['CmContact']=db['sequelize'][_0x157e('0x16')](_0x157e('0x74'));db[_0x157e('0x75')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x76'));db['CmHopperBlack']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x77'));db[_0x157e('0x78')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x79'));db[_0x157e('0x7a')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x7b'));db[_0x157e('0x7c')]=db[_0x157e('0x5')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x7d'));db['Action']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x7e'));db[_0x157e('0x7f')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x80'));db[_0x157e('0x81')]=db['sequelize'][_0x157e('0x16')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0x157e('0x5')][_0x157e('0x16')]('../api/disposition/disposition.model');db[_0x157e('0x82')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x83'));db[_0x157e('0x84')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x85'));db[_0x157e('0x86')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/pause/pause.model');db['Cdr']=db['sequelize'][_0x157e('0x16')](_0x157e('0x87'));db[_0x157e('0x88')]=db[_0x157e('0x5')]['import'](_0x157e('0x89'));db[_0x157e('0x8a')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x8b'));db['Sound']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x8c'));db[_0x157e('0x8d')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x8e'));db['ContactItemType']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x8f'));db['CmContactHasItem']=db[_0x157e('0x5')]['import']('../api/cmContactHasItem/cmContactHasItem.model');db[_0x157e('0x90')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x157e('0x91')]=db['sequelize'][_0x157e('0x16')](_0x157e('0x92'));db[_0x157e('0x93')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x94'));db[_0x157e('0x95')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/variable/variable.model');db[_0x157e('0x96')]=db['sequelize'][_0x157e('0x16')]('../api/integration/integration.model');db[_0x157e('0x97')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x98'));db[_0x157e('0x99')]=db['sequelize'][_0x157e('0x16')](_0x157e('0x9a'));db['AnalyticDefaultReport']=db[_0x157e('0x5')][_0x157e('0x16')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x9b'));db['AnalyticMetric']=db['sequelize'][_0x157e('0x16')](_0x157e('0x9c'));db['AnalyticFieldReport']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x9d'));db['AnalyticTreeReport']=db['sequelize']['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x157e('0x9e')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x9f'));db['SalesforceConfiguration']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xa0'));db['SalesforceField']=db[_0x157e('0x5')]['import']('../api/intSalesforceField/intSalesforceField.model');db[_0x157e('0xa1')]=db[_0x157e('0x5')]['import'](_0x157e('0xa2'));db['SugarcrmConfiguration']=db[_0x157e('0x5')][_0x157e('0x16')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x157e('0xa3')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xa4'));db[_0x157e('0xa5')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xa6'));db[_0x157e('0xa7')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xa8'));db[_0x157e('0xa9')]=db['sequelize'][_0x157e('0x16')](_0x157e('0xaa'));db['ZohoAccount']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xab'));db[_0x157e('0xac')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xad'));db[_0x157e('0xae')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xaf'));db['ZendeskAccount']=db['sequelize'][_0x157e('0x16')](_0x157e('0xb0'));db[_0x157e('0xb1')]=db['sequelize']['import'](_0x157e('0xb2'));db[_0x157e('0xb3')]=db['sequelize'][_0x157e('0x16')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xb4'));db[_0x157e('0xb5')]=db['sequelize'][_0x157e('0x16')](_0x157e('0xb6'));db[_0x157e('0xb7')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xb8'));db[_0x157e('0xb9')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xba'));db[_0x157e('0xbb')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xbc'));db[_0x157e('0xbd')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xbe'));db['ServicenowAccount']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xbf'));db['ServicenowConfiguration']=db['sequelize'][_0x157e('0x16')](_0x157e('0xc0'));db[_0x157e('0xc1')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/intServicenowField/intServicenowField.model');db[_0x157e('0xc2')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x157e('0xc3')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xc4'));db[_0x157e('0xc5')]=db[_0x157e('0x5')]['import'](_0x157e('0xc6'));db[_0x157e('0xc7')]=db[_0x157e('0x5')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x157e('0xc8')]=db['sequelize'][_0x157e('0x16')](_0x157e('0xc9'));db[_0x157e('0xca')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x157e('0x96')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xcb'));db[_0x157e('0xcc')]=db[_0x157e('0x5')]['import'](_0x157e('0xcd'));db[_0x157e('0xce')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xcf'));db[_0x157e('0xd0')]=db[_0x157e('0x5')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0x157e('0xd1')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xd2'));db[_0x157e('0xd3')]=db['sequelize'][_0x157e('0x16')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xd4'));db[_0x157e('0xd5')]=db['sequelize']['import'](_0x157e('0xd6'));db['SquareReport']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xd7'));db['SquareDetailsReport']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xd8'));db[_0x157e('0xd9')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xda'));db['Setting']=db['sequelize'][_0x157e('0x16')](_0x157e('0xdb'));db[_0x157e('0xdc')]=db[_0x157e('0x5')]['import'](_0x157e('0xdd'));db[_0x157e('0xde')]=db[_0x157e('0x5')]['import']('../api/squareProject/squareProject.model');db[_0x157e('0xdf')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xe0'));db[_0x157e('0xe1')]=db[_0x157e('0x5')]['import'](_0x157e('0xe2'));db[_0x157e('0xe3')]=db[_0x157e('0x5')]['import']('../api/team/team.model');db[_0x157e('0xe4')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xe5'));db[_0x157e('0xe6')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xe7'));db['Migration']=db[_0x157e('0x5')]['import']('../api/migration/migration.model');db[_0x157e('0xe8')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/attachment/attachment.model');db[_0x157e('0xe9')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/plugin/plugin.model');db['MailTransferReport']=db['sequelize'][_0x157e('0x16')](_0x157e('0xea'));db[_0x157e('0xeb')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xec'));db['FaxTransferReport']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xed'));db['OpenchannelTransferReport']=db['sequelize'][_0x157e('0x16')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x157e('0xee')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xef'));db[_0x157e('0xf0')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xf1'));db[_0x157e('0xf2')]=db['sequelize'][_0x157e('0x16')](_0x157e('0xf3'));db[_0x157e('0xf4')]=db[_0x157e('0x5')]['import'](_0x157e('0xf5'));db[_0x157e('0xf6')]=db['sequelize'][_0x157e('0x16')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x157e('0x5')][_0x157e('0x16')]('../api/userProfileResource/userProfileResource.model');db[_0x157e('0xf7')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/userNotification/userNotification.model');db[_0x157e('0xf8')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xf9'));db[_0x157e('0xfa')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xfb'));db['WhatsappInteraction']=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0xfc'));db[_0x157e('0xfd')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/whatsappMessage/whatsappMessage.model');db[_0x157e('0xfe')]=db['sequelize'][_0x157e('0x16')](_0x157e('0xff'));db['WhatsappTransferReport']=db['sequelize']['import'](_0x157e('0x100'));db[_0x157e('0x101')]=db[_0x157e('0x5')][_0x157e('0x16')]('../api/whatsappQueue/whatsappQueue.model');db[_0x157e('0x102')]=db[_0x157e('0x5')]['import']('../api/cloudProvider/cloudProvider.model');db[_0x157e('0x103')]=db[_0x157e('0x5')][_0x157e('0x16')](_0x157e('0x104'));db[_0x157e('0x15')]['hasOne'](db[_0x157e('0x20')],{'as':_0x157e('0x20'),'onDelete':'cascade','foreignKey':_0x157e('0x105')});db['User'][_0x157e('0x106')](db[_0x157e('0x1c')],{'as':_0x157e('0x107'),'foreignKey':'UserId'});db[_0x157e('0x15')][_0x157e('0x106')](db['UserVoiceQueueRt'],{'as':_0x157e('0x108'),'foreignKey':_0x157e('0x105')});db[_0x157e('0x15')][_0x157e('0x106')](db[_0x157e('0x1a')],{'as':_0x157e('0x109'),'onDelete':_0x157e('0x10a'),'hooks':!![]});db[_0x157e('0x15')][_0x157e('0x106')](db['CmHopperFinal'],{'as':_0x157e('0x10b'),'foreignKey':'UserId'});db[_0x157e('0x15')][_0x157e('0x106')](db['CmHopperHistory'],{'as':_0x157e('0x10c'),'foreignKey':_0x157e('0x105')});db['User']['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0x157e('0x15')]['hasMany'](db[_0x157e('0x10d')],{'as':'OpenchannelInteractions','foreignKey':_0x157e('0x105')});db[_0x157e('0x15')][_0x157e('0x106')](db[_0x157e('0x69')],{'as':_0x157e('0x10e'),'foreignKey':_0x157e('0x105')});db[_0x157e('0x15')][_0x157e('0x106')](db[_0x157e('0x5a')],{'as':'SmsInteractions','foreignKey':_0x157e('0x105')});db[_0x157e('0x15')][_0x157e('0x106')](db['FaxInteraction'],{'as':_0x157e('0x10f'),'foreignKey':_0x157e('0x105')});db['User']['hasMany'](db[_0x157e('0x41')],{'as':_0x157e('0x110'),'foreignKey':'UserId'});db[_0x157e('0x15')][_0x157e('0x106')](db[_0x157e('0x111')],{'as':'WhatsappInteractions','foreignKey':_0x157e('0x105')});db['User']['hasMany'](db[_0x157e('0xf7')],{'as':_0x157e('0x112'),'foreignKey':_0x157e('0x113')});db[_0x157e('0x15')][_0x157e('0x114')](db[_0x157e('0xf4')],{'as':_0x157e('0xf4'),'foreignKey':_0x157e('0x115')});db[_0x157e('0x15')]['belongsToMany'](db[_0x157e('0x70')],{'as':'Groups','through':'chat_group_has_users'});db[_0x157e('0x15')][_0x157e('0x116')](db['CmContact'],{'as':_0x157e('0x117'),'through':_0x157e('0x118')});db[_0x157e('0x15')]['belongsToMany'](db[_0x157e('0xf0')],{'as':_0x157e('0x119'),'through':_0x157e('0x11a')});db[_0x157e('0x15')][_0x157e('0x116')](db[_0x157e('0xe3')],{'through':_0x157e('0x11b')});db[_0x157e('0x15')][_0x157e('0x116')](db['MailInteraction'],{'as':_0x157e('0x110'),'through':_0x157e('0x11c')});db[_0x157e('0x15')][_0x157e('0x116')](db[_0x157e('0x69')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x157e('0x4f')],{'as':_0x157e('0x10f'),'through':_0x157e('0x11d')});db[_0x157e('0x15')][_0x157e('0x116')](db[_0x157e('0x5a')],{'as':_0x157e('0x11e'),'through':_0x157e('0x11f')});db[_0x157e('0x15')][_0x157e('0x116')](db['OpenchannelInteraction'],{'as':_0x157e('0x120'),'through':_0x157e('0x121')});db[_0x157e('0x15')][_0x157e('0x116')](db[_0x157e('0x111')],{'as':'WhatsappInteractions','through':_0x157e('0x122')});db['User']['belongsToMany'](db['VoiceQueue'],{'as':_0x157e('0x123'),'through':_0x157e('0x2c'),'required':![]});db['User'][_0x157e('0x116')](db[_0x157e('0x3d')],{'as':_0x157e('0x124'),'through':_0x157e('0x30'),'required':![]});db['User'][_0x157e('0x116')](db[_0x157e('0x6e')],{'as':_0x157e('0x125'),'through':_0x157e('0x2e'),'required':![],'hooks':!![]});db['User'][_0x157e('0x116')](db[_0x157e('0x53')],{'as':_0x157e('0x126'),'through':_0x157e('0x32'),'required':![]});db[_0x157e('0x15')][_0x157e('0x116')](db[_0x157e('0x5c')],{'as':_0x157e('0x127'),'through':_0x157e('0x34'),'required':![]});db[_0x157e('0x15')]['belongsToMany'](db[_0x157e('0x62')],{'as':_0x157e('0x128'),'through':_0x157e('0x36'),'required':![]});db[_0x157e('0x15')][_0x157e('0x116')](db['WhatsappQueue'],{'as':_0x157e('0x129'),'through':'UserWhatsappQueue','required':![]});db[_0x157e('0x15')][_0x157e('0x116')](db[_0x157e('0xf0')],{'through':_0x157e('0x11a')});db[_0x157e('0x15')][_0x157e('0x116')](db[_0x157e('0xf2')],{'as':'VoicePrefixes','through':_0x157e('0x12a'),'required':![]});db[_0x157e('0x15')][_0x157e('0x116')](db[_0x157e('0x64')],{'as':_0x157e('0x12b'),'through':_0x157e('0x12c')});db[_0x157e('0x15')][_0x157e('0x116')](db['FaxAccount'],{'as':_0x157e('0x12d'),'through':_0x157e('0x12e')});db[_0x157e('0x15')][_0x157e('0x116')](db['MailAccount'],{'as':_0x157e('0x12f'),'through':_0x157e('0x130')});db[_0x157e('0x15')]['belongsToMany'](db[_0x157e('0x5d')],{'as':_0x157e('0x131'),'through':_0x157e('0x132')});db[_0x157e('0x15')]['belongsToMany'](db[_0x157e('0x56')],{'as':_0x157e('0x133'),'through':_0x157e('0x134')});db['User'][_0x157e('0x116')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x157e('0x135')});db[_0x157e('0x15')][_0x157e('0x116')](db[_0x157e('0xde')],{'as':_0x157e('0x136'),'through':'user_has_square_projects'});db[_0x157e('0x137')][_0x157e('0x106')](db[_0x157e('0x1a')],{'as':'SpiedAgents','onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x138')});db[_0x157e('0x18')][_0x157e('0x106')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0x157e('0x1a')][_0x157e('0x106')](db[_0x157e('0x1a')],{'as':_0x157e('0x139'),'onDelete':_0x157e('0x10a')});db['VoiceMusicOnHold']['belongsToMany'](db[_0x157e('0x13a')],{'as':_0x157e('0x13b'),'through':_0x157e('0x13c')});db['VoiceQueue'][_0x157e('0x106')](db['UserVoiceQueueRt'],{'as':_0x157e('0x13d'),'foreignKey':_0x157e('0x13e')});db[_0x157e('0x13f')]['hasMany'](db[_0x157e('0x75')],{'as':_0x157e('0x140'),'foreignKey':_0x157e('0x13e')});db[_0x157e('0x13f')]['hasMany'](db[_0x157e('0x78')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x157e('0x106')](db[_0x157e('0x7a')],{'as':_0x157e('0x141'),'foreignKey':_0x157e('0x13e')});db[_0x157e('0x13f')][_0x157e('0x106')](db[_0x157e('0x7c')],{'as':_0x157e('0x7c'),'foreignKey':_0x157e('0x13e')});db['VoiceQueue']['hasMany'](db[_0x157e('0x142')],{'as':_0x157e('0x143'),'foreignKey':_0x157e('0x13e')});db['VoiceQueue']['hasMany'](db['JscriptySessionReport'],{'as':_0x157e('0x144'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x157e('0x114')](db[_0x157e('0x28')],{'as':'Trunk','foreignKey':_0x157e('0x145')});db[_0x157e('0x13f')][_0x157e('0x114')](db[_0x157e('0x28')],{'as':'TrunkBackup','foreignKey':_0x157e('0x146')});db['VoiceQueue'][_0x157e('0x114')](db[_0x157e('0x84')],{'as':_0x157e('0x84'),'foreignKey':_0x157e('0x147')});db[_0x157e('0x13f')][_0x157e('0x114')](db[_0x157e('0x86')],{'as':_0x157e('0x148'),'foreignKey':_0x157e('0x149')});db[_0x157e('0x13f')][_0x157e('0x116')](db[_0x157e('0xf0')],{'as':_0x157e('0x119'),'through':_0x157e('0x14a')});db['VoiceQueue'][_0x157e('0x116')](db[_0x157e('0x15')],{'as':'Agents','through':_0x157e('0x2c')});db['VoiceQueue'][_0x157e('0x116')](db[_0x157e('0xe3')],{'as':_0x157e('0x14b'),'through':_0x157e('0x103')});db[_0x157e('0x13f')][_0x157e('0x116')](db[_0x157e('0xf0')],{'as':_0x157e('0x14c'),'through':'voice_queues_has_cm_blacklists'});db[_0x157e('0x1c')][_0x157e('0x114')](db[_0x157e('0x15')],{'as':'User','foreignKey':'UserId'});db[_0x157e('0x1e')]['belongsTo'](db[_0x157e('0x15')],{'as':'User','foreignKey':_0x157e('0x105')});db['VoiceMail']['hasMany'](db['VoiceMailMessage'],{'as':_0x157e('0x14d'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x14e'),'sourceKey':'mailbox'});db[_0x157e('0x22')][_0x157e('0x114')](db['VoiceMail'],{'foreignKey':_0x157e('0x14e'),'targetKey':'mailbox'});db[_0x157e('0x23')][_0x157e('0x106')](db['VoiceQueueReport'],{'as':_0x157e('0x14f'),'foreignKey':_0x157e('0x150'),'constraints':![]});db[_0x157e('0x23')][_0x157e('0x106')](db[_0x157e('0x25')],{'as':_0x157e('0x151'),'foreignKey':'uniqueid','constraints':![]});db[_0x157e('0x23')][_0x157e('0x114')](db[_0x157e('0x15')],{'as':'User','foreignKey':'UserId'});db[_0x157e('0x23')][_0x157e('0x114')](db[_0x157e('0x152')],{'as':_0x157e('0x153'),'foreignKey':_0x157e('0x154')});db[_0x157e('0x3a')][_0x157e('0x114')](db[_0x157e('0x3c')],{'as':_0x157e('0x3c'),'foreignKey':_0x157e('0x155')});db['MailServerOut']['belongsTo'](db[_0x157e('0x3c')],{'as':_0x157e('0x3c'),'foreignKey':_0x157e('0x155')});db[_0x157e('0x3c')][_0x157e('0x156')](db[_0x157e('0x3a')],{'as':_0x157e('0x157'),'onDelete':'cascade'});db[_0x157e('0x3c')][_0x157e('0x156')](db['MailServerOut'],{'as':_0x157e('0x158'),'onDelete':_0x157e('0x10a')});db['MailAccount'][_0x157e('0x106')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x157e('0x155')});db[_0x157e('0x3c')]['hasMany'](db[_0x157e('0x81')],{'as':_0x157e('0x159'),'foreignKey':'MailAccountId'});db[_0x157e('0x3c')][_0x157e('0x106')](db['MailMessage'],{'as':_0x157e('0x14d'),'foreignKey':_0x157e('0x155')});db[_0x157e('0x3c')][_0x157e('0x106')](db[_0x157e('0x41')],{'as':'Interactions'});db[_0x157e('0x3c')][_0x157e('0x106')](db[_0x157e('0x44')],{'as':_0x157e('0x139')});db[_0x157e('0x3c')][_0x157e('0x114')](db['CmList'],{'as':_0x157e('0x15a'),'foreignKey':_0x157e('0x15b')});db[_0x157e('0x3c')]['belongsTo'](db[_0x157e('0x91')],{'as':_0x157e('0x91'),'foreignKey':_0x157e('0x15c')});db['MailAccount'][_0x157e('0x114')](db['Pause'],{'as':_0x157e('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x157e('0x3c')][_0x157e('0x116')](db['User'],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x157e('0x3d')][_0x157e('0x116')](db[_0x157e('0x15')],{'as':_0x157e('0x15d'),'through':_0x157e('0x30')});db['MailQueue'][_0x157e('0x116')](db['Team'],{'through':_0x157e('0x15e'),'as':_0x157e('0x14b')});db[_0x157e('0x41')][_0x157e('0x106')](db[_0x157e('0x15f')],{'as':'Messages','onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x160')});db[_0x157e('0x41')][_0x157e('0x114')](db[_0x157e('0x3c')],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x155')});db['MailInteraction'][_0x157e('0x114')](db[_0x157e('0x152')],{'as':_0x157e('0x153'),'foreignKey':'ContactId'});db[_0x157e('0x41')]['belongsTo'](db[_0x157e('0x15')],{'as':_0x157e('0x162'),'foreignKey':_0x157e('0x105')});db['MailInteraction'][_0x157e('0x116')](db['Tag'],{'through':_0x157e('0x163'),'as':_0x157e('0x164')});db[_0x157e('0x41')][_0x157e('0x116')](db['Tag'],{'through':_0x157e('0x163'),'as':_0x157e('0x165')});db[_0x157e('0x41')][_0x157e('0x116')](db[_0x157e('0x15')],{'as':'Users','through':_0x157e('0x11c'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x157e('0x106')](db[_0x157e('0xe8')],{'as':_0x157e('0x166'),'onDelete':'cascade'});db[_0x157e('0x15f')][_0x157e('0x114')](db[_0x157e('0x15')],{'as':_0x157e('0x15')});db[_0x157e('0x15f')]['belongsTo'](db[_0x157e('0x152')],{'onDelete':_0x157e('0x10a'),'as':_0x157e('0x153')});db['MailMessage'][_0x157e('0x114')](db[_0x157e('0x41')],{'as':_0x157e('0x167'),'foreignKey':_0x157e('0x160')});db[_0x157e('0x15f')]['belongsTo'](db[_0x157e('0x3c')],{'as':'Account','foreignKey':'MailAccountId'});db['MailMessage'][_0x157e('0x114')](db[_0x157e('0x64')],{'as':_0x157e('0x64'),'foreignKey':_0x157e('0x168')});db[_0x157e('0x15f')][_0x157e('0x114')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x157e('0x169')});db[_0x157e('0x44')][_0x157e('0x114')](db[_0x157e('0x15')],{'onDelete':_0x157e('0x16a')});db[_0x157e('0x44')][_0x157e('0x114')](db[_0x157e('0x3d')],{'onDelete':_0x157e('0x16a')});db[_0x157e('0x44')][_0x157e('0x114')](db[_0x157e('0x3c')],{'onDelete':_0x157e('0x16a')});db[_0x157e('0x44')][_0x157e('0x114')](db[_0x157e('0x84')],{'onDelete':_0x157e('0x16a'),'foreignKey':_0x157e('0x147')});db[_0x157e('0x44')][_0x157e('0x114')](db[_0x157e('0x8d')],{'onDelete':'restrict','foreignKey':_0x157e('0x16b')});db[_0x157e('0x46')][_0x157e('0x114')](db[_0x157e('0x3c')],{});db[_0x157e('0x46')][_0x157e('0x114')](db[_0x157e('0xf0')],{'as':'List','foreignKey':_0x157e('0x15b')});db[_0x157e('0x46')][_0x157e('0x114')](db['CmContact'],{'as':_0x157e('0x153'),'foreignKey':_0x157e('0x154')});db[_0x157e('0x46')][_0x157e('0x114')](db['MailInteraction'],{});db[_0x157e('0x46')][_0x157e('0x114')](db[_0x157e('0x15f')],{});db[_0x157e('0x46')][_0x157e('0x114')](db[_0x157e('0x15')],{});db[_0x157e('0x46')][_0x157e('0x114')](db['MailQueue'],{});db[_0x157e('0x48')]['hasMany'](db[_0x157e('0x4a')],{'as':_0x157e('0x16c'),'onDelete':_0x157e('0x10a')});db[_0x157e('0x4c')][_0x157e('0x106')](db[_0x157e('0x16d')],{'as':_0x157e('0x16e'),'foreignKey':_0x157e('0x16f')});db['FaxAccount'][_0x157e('0x106')](db[_0x157e('0x81')],{'as':_0x157e('0x159'),'foreignKey':'FaxAccountId'});db[_0x157e('0x4c')]['hasMany'](db['FaxInteraction'],{'as':'Interactions'});db[_0x157e('0x4c')][_0x157e('0x106')](db[_0x157e('0x4e')],{'as':_0x157e('0x139')});db[_0x157e('0x4c')][_0x157e('0x106')](db[_0x157e('0x1a')],{'as':_0x157e('0x170'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0x157e('0x51')],{'as':_0x157e('0x14d')});db['FaxAccount']['belongsTo'](db['Trunk'],{'as':_0x157e('0x28')});db[_0x157e('0x4c')][_0x157e('0x114')](db['CmList'],{'as':_0x157e('0x15a'),'foreignKey':'ListId'});db['FaxAccount'][_0x157e('0x114')](db['Pause'],{'as':_0x157e('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x157e('0x4c')][_0x157e('0x116')](db[_0x157e('0x15')],{'as':_0x157e('0x15d'),'through':_0x157e('0x12e')});db[_0x157e('0x4e')][_0x157e('0x114')](db[_0x157e('0x15')],{'onDelete':_0x157e('0x16a')});db[_0x157e('0x4e')]['belongsTo'](db[_0x157e('0x53')],{'onDelete':_0x157e('0x16a')});db[_0x157e('0x4e')][_0x157e('0x114')](db[_0x157e('0x4c')],{'onDelete':'restrict'});db['FaxApplication'][_0x157e('0x114')](db['Tag'],{'onDelete':_0x157e('0x16a'),'foreignKey':_0x157e('0x16b')});db['FaxInteraction'][_0x157e('0x106')](db[_0x157e('0x51')],{'as':_0x157e('0x14d'),'onDelete':'cascade','foreignKey':_0x157e('0x171')});db[_0x157e('0x4f')][_0x157e('0x114')](db[_0x157e('0x4c')],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x16f')});db[_0x157e('0x4f')]['belongsTo'](db[_0x157e('0x152')],{'as':_0x157e('0x153'),'foreignKey':_0x157e('0x154')});db[_0x157e('0x4f')][_0x157e('0x114')](db[_0x157e('0x15')],{'as':'Owner','foreignKey':'UserId'});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':_0x157e('0x172'),'as':_0x157e('0x164')});db[_0x157e('0x4f')][_0x157e('0x116')](db[_0x157e('0x8d')],{'through':_0x157e('0x172'),'as':_0x157e('0x165')});db[_0x157e('0x4f')]['belongsToMany'](db[_0x157e('0x15')],{'as':_0x157e('0x173'),'through':_0x157e('0x11d'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x157e('0x114')](db[_0x157e('0x15')],{'onDelete':'cascade','as':_0x157e('0x15')});db[_0x157e('0x51')][_0x157e('0x114')](db[_0x157e('0x4f')],{'as':_0x157e('0x167'),'foreignKey':_0x157e('0x171')});db[_0x157e('0x51')][_0x157e('0x114')](db[_0x157e('0x152')],{'onDelete':_0x157e('0x10a'),'as':_0x157e('0x153')});db[_0x157e('0x51')][_0x157e('0x114')](db[_0x157e('0xe8')],{'as':_0x157e('0xe8'),'foreignKey':'AttachmentId'});db[_0x157e('0x51')][_0x157e('0x114')](db['FaxAccount'],{'as':_0x157e('0x161'),'foreignKey':'FaxAccountId'});db['FaxQueue']['belongsToMany'](db[_0x157e('0x15')],{'as':_0x157e('0x15d'),'through':_0x157e('0x32')});db[_0x157e('0x53')]['belongsToMany'](db[_0x157e('0xe3')],{'through':'team_has_fax_queues','as':_0x157e('0x14b')});db[_0x157e('0x55')][_0x157e('0x114')](db[_0x157e('0x4c')],{});db[_0x157e('0x55')][_0x157e('0x114')](db[_0x157e('0xf0')],{'as':_0x157e('0x15a'),'foreignKey':'ListId'});db[_0x157e('0x55')][_0x157e('0x114')](db[_0x157e('0x152')],{'as':'Contact','foreignKey':'ContactId'});db[_0x157e('0x55')]['belongsTo'](db[_0x157e('0x4f')],{});db[_0x157e('0x55')]['belongsTo'](db[_0x157e('0x51')],{});db['FaxQueueReport']['belongsTo'](db[_0x157e('0x15')],{});db[_0x157e('0x55')][_0x157e('0x114')](db[_0x157e('0x53')],{});db[_0x157e('0x56')][_0x157e('0x106')](db['Disposition'],{'as':_0x157e('0x16e'),'foreignKey':_0x157e('0x174')});db['SmsAccount'][_0x157e('0x106')](db['CannedAnswer'],{'as':_0x157e('0x159'),'foreignKey':_0x157e('0x174')});db[_0x157e('0x56')][_0x157e('0x106')](db[_0x157e('0x175')],{'as':_0x157e('0x14d'),'foreignKey':_0x157e('0x174')});db['SmsAccount'][_0x157e('0x106')](db['SmsInteraction'],{'as':_0x157e('0x176')});db[_0x157e('0x56')]['hasMany'](db['SmsApplication'],{'as':_0x157e('0x139')});db[_0x157e('0x56')][_0x157e('0x114')](db[_0x157e('0xf0')],{'as':_0x157e('0x15a'),'foreignKey':_0x157e('0x15b')});db[_0x157e('0x56')][_0x157e('0x114')](db[_0x157e('0x86')],{'as':_0x157e('0x148'),'foreignKey':_0x157e('0x149')});db[_0x157e('0x56')][_0x157e('0x116')](db[_0x157e('0x15')],{'as':_0x157e('0x15d'),'through':_0x157e('0x134')});db[_0x157e('0x58')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x157e('0x58')]['belongsTo'](db['SmsQueue'],{'onDelete':_0x157e('0x16a')});db['SmsApplication'][_0x157e('0x114')](db[_0x157e('0x56')],{'onDelete':_0x157e('0x16a')});db[_0x157e('0x58')]['belongsTo'](db[_0x157e('0x84')],{'onDelete':_0x157e('0x16a'),'foreignKey':_0x157e('0x147')});db[_0x157e('0x58')]['belongsTo'](db[_0x157e('0x8d')],{'onDelete':_0x157e('0x16a'),'foreignKey':'TagId'});db[_0x157e('0x5a')][_0x157e('0x106')](db[_0x157e('0x175')],{'as':_0x157e('0x14d'),'onDelete':'cascade','foreignKey':_0x157e('0x177')});db[_0x157e('0x5a')][_0x157e('0x114')](db['SmsAccount'],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x174')});db['SmsInteraction'][_0x157e('0x114')](db[_0x157e('0x152')],{'as':_0x157e('0x153'),'foreignKey':_0x157e('0x154')});db['SmsInteraction'][_0x157e('0x114')](db[_0x157e('0x15')],{'as':_0x157e('0x162'),'foreignKey':_0x157e('0x105')});db['SmsInteraction'][_0x157e('0x116')](db[_0x157e('0x8d')],{'through':_0x157e('0x178'),'as':_0x157e('0x164')});db[_0x157e('0x5a')]['belongsToMany'](db['Tag'],{'through':_0x157e('0x178'),'as':_0x157e('0x165')});db[_0x157e('0x5a')]['belongsToMany'](db[_0x157e('0x15')],{'as':_0x157e('0x173'),'through':_0x157e('0x11f'),'foreignKey':_0x157e('0x177')});db['SmsMessage'][_0x157e('0x114')](db[_0x157e('0x15')],{'as':_0x157e('0x15')});db['SmsMessage'][_0x157e('0x114')](db[_0x157e('0x152')],{'onDelete':_0x157e('0x10a'),'as':_0x157e('0x153')});db[_0x157e('0x175')]['belongsTo'](db[_0x157e('0x5a')],{'onDelete':_0x157e('0x10a'),'as':_0x157e('0x167'),'foreignKey':_0x157e('0x177')});db[_0x157e('0x175')][_0x157e('0x114')](db[_0x157e('0x56')],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x174')});db[_0x157e('0x5c')][_0x157e('0x116')](db[_0x157e('0x15')],{'as':_0x157e('0x15d'),'through':'UserSmsQueue','foreignKey':_0x157e('0x179')});db[_0x157e('0x5c')][_0x157e('0x116')](db[_0x157e('0xe3')],{'through':_0x157e('0x17a'),'as':_0x157e('0x14b')});db[_0x157e('0x5d')][_0x157e('0x106')](db[_0x157e('0x16d')],{'as':_0x157e('0x16e'),'foreignKey':_0x157e('0x17b')});db[_0x157e('0x5d')][_0x157e('0x106')](db[_0x157e('0x81')],{'as':_0x157e('0x159'),'foreignKey':_0x157e('0x17b')});db[_0x157e('0x5d')][_0x157e('0x106')](db[_0x157e('0x10d')],{'as':_0x157e('0x176'),'foreignKey':_0x157e('0x17b')});db[_0x157e('0x5d')][_0x157e('0x106')](db[_0x157e('0x17c')],{'as':_0x157e('0x14d'),'foreignKey':'OpenchannelAccountId'});db[_0x157e('0x5d')]['hasMany'](db[_0x157e('0x17d')],{'as':_0x157e('0x139'),'foreignKey':'OpenchannelAccountId'});db[_0x157e('0x5d')][_0x157e('0x114')](db['CmList'],{'as':_0x157e('0x15a'),'foreignKey':_0x157e('0x15b')});db['OpenchannelAccount'][_0x157e('0x114')](db[_0x157e('0x86')],{'as':_0x157e('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x157e('0x5d')]['belongsToMany'](db[_0x157e('0x15')],{'as':_0x157e('0x15d'),'through':'user_has_openchannel_accounts'});db[_0x157e('0x17d')][_0x157e('0x114')](db[_0x157e('0x15')],{'onDelete':_0x157e('0x16a')});db[_0x157e('0x17d')][_0x157e('0x114')](db[_0x157e('0x62')],{'onDelete':'restrict','foreignKey':_0x157e('0x17e')});db[_0x157e('0x17d')][_0x157e('0x114')](db[_0x157e('0x5d')],{'onDelete':_0x157e('0x16a'),'foreignKey':_0x157e('0x17b')});db[_0x157e('0x17d')]['belongsTo'](db[_0x157e('0x84')],{'onDelete':_0x157e('0x16a'),'foreignKey':_0x157e('0x147')});db['OpenchannelApplication'][_0x157e('0x114')](db[_0x157e('0x8d')],{'onDelete':_0x157e('0x16a'),'foreignKey':_0x157e('0x16b')});db['OpenchannelInteraction'][_0x157e('0x106')](db[_0x157e('0x17c')],{'as':_0x157e('0x14d'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x17f')});db[_0x157e('0x10d')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x17b')});db['OpenchannelInteraction']['belongsTo'](db[_0x157e('0x152')],{'as':_0x157e('0x153'),'foreignKey':_0x157e('0x154')});db[_0x157e('0x10d')][_0x157e('0x114')](db[_0x157e('0x15')],{'as':'Owner','foreignKey':_0x157e('0x105')});db[_0x157e('0x10d')][_0x157e('0x116')](db[_0x157e('0x8d')],{'through':_0x157e('0x180'),'as':_0x157e('0x164')});db[_0x157e('0x10d')][_0x157e('0x116')](db[_0x157e('0x8d')],{'through':'openchannel_interaction_has_tags','as':_0x157e('0x165')});db[_0x157e('0x10d')][_0x157e('0x116')](db[_0x157e('0x15')],{'as':_0x157e('0x173'),'through':_0x157e('0x121'),'foreignKey':'OpenchannelInteractionId'});db[_0x157e('0x17c')]['belongsTo'](db['User'],{'onDelete':'cascade','as':_0x157e('0x15')});db[_0x157e('0x17c')][_0x157e('0x114')](db['CmContact'],{'onDelete':_0x157e('0x10a'),'as':'Contact'});db[_0x157e('0x17c')][_0x157e('0x114')](db['OpenchannelInteraction'],{'onDelete':_0x157e('0x10a'),'as':_0x157e('0x167'),'foreignKey':'OpenchannelInteractionId'});db[_0x157e('0x17c')]['belongsTo'](db[_0x157e('0xe8')],{'as':_0x157e('0xe8'),'foreignKey':_0x157e('0x181')});db[_0x157e('0x17c')][_0x157e('0x114')](db['OpenchannelAccount'],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x17b')});db[_0x157e('0x62')][_0x157e('0x116')](db['User'],{'as':_0x157e('0x15d'),'through':'UserOpenchannelQueue','foreignKey':_0x157e('0x17e')});db[_0x157e('0x62')]['belongsToMany'](db['Team'],{'through':_0x157e('0x182'),'as':'Teams'});db[_0x157e('0x64')][_0x157e('0x106')](db['Disposition'],{'as':_0x157e('0x16e'),'foreignKey':'ChatWebsiteId'});db[_0x157e('0x64')]['hasMany'](db[_0x157e('0x81')],{'as':'Answers','foreignKey':_0x157e('0x168')});db[_0x157e('0x64')][_0x157e('0x106')](db[_0x157e('0x72')],{'as':_0x157e('0x183')});db[_0x157e('0x64')][_0x157e('0x106')](db['ChatInteraction'],{'as':'Interactions'});db[_0x157e('0x64')][_0x157e('0x106')](db[_0x157e('0x184')],{'as':_0x157e('0x139')});db[_0x157e('0x64')]['hasMany'](db[_0x157e('0x6a')],{'as':_0x157e('0x14d')});db['ChatWebsite']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x157e('0x15b')});db[_0x157e('0x64')][_0x157e('0x114')](db[_0x157e('0x84')],{'as':'Interval','foreignKey':_0x157e('0x147')});db[_0x157e('0x64')][_0x157e('0x114')](db[_0x157e('0x3c')],{'as':_0x157e('0x3c'),'foreignKey':_0x157e('0x155')});db['ChatWebsite'][_0x157e('0x114')](db[_0x157e('0x86')],{'as':_0x157e('0x148'),'foreignKey':_0x157e('0x149')});db[_0x157e('0x64')][_0x157e('0x116')](db[_0x157e('0x15')],{'as':_0x157e('0x15d'),'through':_0x157e('0x12c')});db[_0x157e('0x66')]['belongsTo'](db[_0x157e('0x5d')],{});db['OpenchannelQueueReport'][_0x157e('0x114')](db[_0x157e('0xf0')],{'as':_0x157e('0x15a'),'foreignKey':_0x157e('0x15b')});db[_0x157e('0x66')][_0x157e('0x114')](db[_0x157e('0x152')],{'as':_0x157e('0x153'),'foreignKey':_0x157e('0x154')});db[_0x157e('0x66')]['belongsTo'](db[_0x157e('0x10d')],{});db[_0x157e('0x66')][_0x157e('0x114')](db['OpenchannelMessage'],{});db[_0x157e('0x66')]['belongsTo'](db[_0x157e('0x15')],{});db[_0x157e('0x66')][_0x157e('0x114')](db[_0x157e('0x62')],{});db['ChatApplication'][_0x157e('0x114')](db[_0x157e('0x15')],{'as':_0x157e('0x185'),'foreignKey':_0x157e('0x105'),'onDelete':_0x157e('0x16a')});db[_0x157e('0x184')][_0x157e('0x114')](db['ChatQueue'],{'as':_0x157e('0x186'),'foreignKey':_0x157e('0x187'),'onDelete':_0x157e('0x16a')});db[_0x157e('0x184')][_0x157e('0x114')](db[_0x157e('0x64')],{'as':'Website','foreignKey':_0x157e('0x168'),'onDelete':_0x157e('0x16a')});db[_0x157e('0x184')][_0x157e('0x114')](db['Tag'],{'onDelete':_0x157e('0x16a'),'foreignKey':_0x157e('0x16b')});db[_0x157e('0x69')][_0x157e('0x106')](db[_0x157e('0x6a')],{'as':_0x157e('0x14d'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x188')});db[_0x157e('0x69')][_0x157e('0x114')](db[_0x157e('0x64')],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x168')});db[_0x157e('0x69')][_0x157e('0x114')](db[_0x157e('0x152')],{'as':'Contact','foreignKey':'ContactId'});db[_0x157e('0x69')]['belongsTo'](db[_0x157e('0x15')],{'as':_0x157e('0x162'),'foreignKey':_0x157e('0x105')});db['ChatInteraction']['belongsToMany'](db[_0x157e('0x8d')],{'through':_0x157e('0x189'),'as':_0x157e('0x164')});db[_0x157e('0x69')][_0x157e('0x116')](db[_0x157e('0x8d')],{'through':_0x157e('0x189'),'as':_0x157e('0x165')});db[_0x157e('0x69')][_0x157e('0x116')](db[_0x157e('0x15')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0x157e('0x188')});db[_0x157e('0x6a')][_0x157e('0x114')](db['User'],{'onDelete':_0x157e('0x10a'),'as':'User'});db[_0x157e('0x6a')][_0x157e('0x114')](db[_0x157e('0x152')],{'onDelete':_0x157e('0x10a'),'as':_0x157e('0x153'),'foreignKey':'ContactId'});db[_0x157e('0x6a')][_0x157e('0x114')](db[_0x157e('0x69')],{'onDelete':_0x157e('0x10a'),'as':_0x157e('0x167'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x157e('0x114')](db[_0x157e('0xe8')],{'as':_0x157e('0xe8'),'foreignKey':_0x157e('0x181')});db[_0x157e('0x6a')][_0x157e('0x114')](db['ChatWebsite'],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x168')});db['ChatOfflineMessage'][_0x157e('0x106')](db[_0x157e('0xe8')],{'as':_0x157e('0x166'),'foreignKey':_0x157e('0x169'),'onDelete':_0x157e('0x10a'),'hooks':!![]});db[_0x157e('0x6c')][_0x157e('0x114')](db[_0x157e('0x152')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x157e('0x154')});db[_0x157e('0x6c')]['belongsTo'](db['ChatWebsite'],{'as':_0x157e('0x161'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0x157e('0x116')](db[_0x157e('0x15')],{'as':_0x157e('0x15d'),'through':_0x157e('0x2e'),'hooks':!![]});db[_0x157e('0x6e')][_0x157e('0x116')](db[_0x157e('0xe3')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x157e('0x70')][_0x157e('0x106')](db[_0x157e('0xd0')],{'as':_0x157e('0x14d'),'foreignKey':_0x157e('0x18a'),'onDelete':_0x157e('0x10a')});db[_0x157e('0x70')][_0x157e('0x116')](db[_0x157e('0x15')],{'as':_0x157e('0x13d'),'through':_0x157e('0x18b')});db[_0x157e('0x72')][_0x157e('0x114')](db['ChatWebsite'],{'as':_0x157e('0x18c'),'foreignKey':_0x157e('0x168')});db[_0x157e('0x18d')]['hasMany'](db[_0x157e('0x152')],{'as':_0x157e('0x117'),'foreignKey':_0x157e('0x18e')});db[_0x157e('0x152')][_0x157e('0x106')](db['CmContactHasItem'],{'as':_0x157e('0x18f'),'foreignKey':_0x157e('0x190')});db[_0x157e('0x152')][_0x157e('0x106')](db['CmHopper'],{'as':_0x157e('0x140'),'foreignKey':_0x157e('0x154')});db[_0x157e('0x152')][_0x157e('0x106')](db[_0x157e('0x78')],{'as':_0x157e('0x10b'),'foreignKey':'ContactId'});db[_0x157e('0x152')]['hasMany'](db['CmHopperHistory'],{'as':_0x157e('0x141'),'foreignKey':'ContactId'});db[_0x157e('0x152')]['hasMany'](db[_0x157e('0x7c')],{'as':_0x157e('0x7c'),'foreignKey':_0x157e('0x154')});db[_0x157e('0x152')][_0x157e('0x106')](db[_0x157e('0x191')],{'as':_0x157e('0x144'),'foreignKey':'ContactId'});db[_0x157e('0x152')][_0x157e('0x106')](db[_0x157e('0x10d')],{'as':'OpenchannelInteractions','foreignKey':_0x157e('0x154'),'onDelete':_0x157e('0x16a')});db[_0x157e('0x152')][_0x157e('0x106')](db[_0x157e('0x69')],{'as':_0x157e('0x10e'),'foreignKey':_0x157e('0x154'),'onDelete':_0x157e('0x16a')});db['CmContact']['hasMany'](db[_0x157e('0x5a')],{'as':'SmsInteractions','foreignKey':_0x157e('0x154'),'onDelete':_0x157e('0x16a')});db['CmContact'][_0x157e('0x106')](db[_0x157e('0x4f')],{'as':_0x157e('0x10f'),'foreignKey':_0x157e('0x154'),'onDelete':_0x157e('0x16a')});db[_0x157e('0x152')][_0x157e('0x106')](db[_0x157e('0x41')],{'as':_0x157e('0x110'),'foreignKey':_0x157e('0x154'),'onDelete':'restrict'});db[_0x157e('0x152')][_0x157e('0x114')](db[_0x157e('0x18d')],{'as':'Company','foreignKey':_0x157e('0x18e')});db[_0x157e('0x152')][_0x157e('0x114')](db['CmList'],{'as':_0x157e('0x15a'),'foreignKey':_0x157e('0x15b'),'onDelete':_0x157e('0x10a')});db['CmContact'][_0x157e('0x116')](db[_0x157e('0x15')],{'as':'Users','through':_0x157e('0x118')});db[_0x157e('0x152')][_0x157e('0x116')](db[_0x157e('0x8d')],{'as':_0x157e('0x164'),'through':_0x157e('0x192')});db[_0x157e('0x152')][_0x157e('0x116')](db[_0x157e('0x8d')],{'through':_0x157e('0x192'),'as':'ThroughTags'});db[_0x157e('0x75')][_0x157e('0x106')](db[_0x157e('0x90')],{'as':_0x157e('0x193'),'foreignKey':_0x157e('0x194')});db[_0x157e('0x75')][_0x157e('0x114')](db[_0x157e('0x152')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x157e('0x10a')});db[_0x157e('0x75')]['belongsTo'](db[_0x157e('0xf0')],{'as':'List','foreignKey':_0x157e('0x15b'),'onDelete':_0x157e('0x10a')});db[_0x157e('0x75')][_0x157e('0x114')](db[_0x157e('0x15')],{'as':_0x157e('0x185'),'foreignKey':'UserId'});db[_0x157e('0x75')][_0x157e('0x114')](db[_0x157e('0x13f')],{'as':_0x157e('0x186'),'foreignKey':_0x157e('0x13e'),'onDelete':_0x157e('0x10a')});db[_0x157e('0x75')][_0x157e('0x114')](db[_0x157e('0xe6')],{'as':_0x157e('0xe6'),'foreignKey':_0x157e('0x195'),'onDelete':_0x157e('0x10a')});db[_0x157e('0x75')]['belongsTo'](db[_0x157e('0x15')],{'as':_0x157e('0x162'),'foreignKey':_0x157e('0x196')});db['CmHopperBlack'][_0x157e('0x114')](db[_0x157e('0x152')],{'as':_0x157e('0x153'),'foreignKey':'ContactId','onDelete':_0x157e('0x10a')});db[_0x157e('0x142')][_0x157e('0x114')](db['CmList'],{'as':'List','foreignKey':_0x157e('0x15b'),'onDelete':_0x157e('0x10a')});db['CmHopperBlack'][_0x157e('0x114')](db[_0x157e('0x13f')],{'as':_0x157e('0x186'),'foreignKey':_0x157e('0x13e'),'onDelete':_0x157e('0x10a')});db[_0x157e('0x142')][_0x157e('0x114')](db[_0x157e('0xe6')],{'as':_0x157e('0xe6'),'foreignKey':_0x157e('0x195'),'onDelete':'cascade'});db['Automation'][_0x157e('0x106')](db[_0x157e('0x82')],{'as':{'plural':'All','singular':_0x157e('0x197')},'foreignKey':'AutomationAllId','onDelete':_0x157e('0x10a'),'hooks':!![]});db['Automation'][_0x157e('0x106')](db[_0x157e('0x82')],{'as':{'plural':_0x157e('0x198'),'singular':_0x157e('0x199')},'foreignKey':_0x157e('0x19a'),'onDelete':_0x157e('0x10a'),'hooks':!![]});db['Automation'][_0x157e('0x106')](db[_0x157e('0x19b')],{'as':'Actions','foreignKey':_0x157e('0x19c'),'onDelete':'cascade','hooks':!![]});db['Disposition']['hasMany'](db[_0x157e('0x16d')],{'as':'Dispositions','foreignKey':_0x157e('0x19d'),'onDelete':_0x157e('0x10a')});db[_0x157e('0x84')]['hasMany'](db[_0x157e('0x84')],{'as':'Intervals','foreignKey':_0x157e('0x147'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0x157e('0x106')](db[_0x157e('0x1a')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x157e('0x16a')});db['Interval'][_0x157e('0x106')](db['MailApplication'],{'as':_0x157e('0x19e'),'foreignKey':_0x157e('0x147')});db['Interval'][_0x157e('0x106')](db[_0x157e('0x184')],{'as':'ChatApplications','foreignKey':_0x157e('0x147')});db[_0x157e('0x84')][_0x157e('0x106')](db[_0x157e('0x4e')],{'as':_0x157e('0x19f'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0x157e('0x58')],{'as':_0x157e('0x1a0'),'foreignKey':_0x157e('0x147')});db[_0x157e('0x8a')]['belongsTo'](db['MailAccount'],{});db[_0x157e('0x8a')]['belongsTo'](db[_0x157e('0x1a1')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0x157e('0x114')](db['AnalyticCustomReport'],{'foreignKey':_0x157e('0x1a2')});db[_0x157e('0x13a')][_0x157e('0x116')](db[_0x157e('0x1a3')],{'as':_0x157e('0x1a4'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0x157e('0x8d')]['belongsToMany'](db[_0x157e('0x152')],{'through':_0x157e('0x192')});db['Tag'][_0x157e('0x116')](db[_0x157e('0x69')],{'through':_0x157e('0x189')});db[_0x157e('0x8d')][_0x157e('0x116')](db[_0x157e('0x41')],{'through':_0x157e('0x163')});db[_0x157e('0x8d')][_0x157e('0x116')](db[_0x157e('0x5a')],{'through':_0x157e('0x178')});db[_0x157e('0x8d')][_0x157e('0x116')](db[_0x157e('0x4f')],{'through':'fax_interaction_has_tags'});db[_0x157e('0x8d')][_0x157e('0x116')](db[_0x157e('0x10d')],{'through':_0x157e('0x180')});db[_0x157e('0x8d')][_0x157e('0x116')](db['WhatsappInteraction'],{'through':_0x157e('0x1a5')});db[_0x157e('0x1a6')][_0x157e('0x114')](db[_0x157e('0x1a7')],{'as':_0x157e('0x1a8'),'foreignKey':'ItemTypeId'});db['CmHopperAdditionalPhone'][_0x157e('0x114')](db[_0x157e('0x75')],{'as':'Hopper','foreignKey':_0x157e('0x194')});db[_0x157e('0x93')][_0x157e('0x106')](db[_0x157e('0x82')],{'as':{'plural':_0x157e('0x1a9'),'singular':_0x157e('0x1aa')},'foreignKey':_0x157e('0x1ab'),'onDelete':_0x157e('0x10a'),'hooks':!![]});db[_0x157e('0x93')][_0x157e('0x106')](db[_0x157e('0x82')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0x157e('0x1ac'),'onDelete':_0x157e('0x10a'),'hooks':!![]});db['Trigger'][_0x157e('0x106')](db[_0x157e('0x19b')],{'as':'Actions','foreignKey':_0x157e('0x1ad'),'onDelete':_0x157e('0x10a'),'hooks':!![]});db['AnalyticCustomReport'][_0x157e('0x106')](db[_0x157e('0x1ae')],{'as':_0x157e('0x1af'),'onDelete':_0x157e('0x10a'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x157e('0x1a1')][_0x157e('0x106')](db[_0x157e('0x1ae')],{'as':_0x157e('0x1af'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1b0')});db[_0x157e('0x1b1')][_0x157e('0x106')](db['AnalyticFieldReport'],{'as':_0x157e('0x1af'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1b2')});db[_0x157e('0x1ae')][_0x157e('0x114')](db[_0x157e('0x1b1')],{'foreignKey':_0x157e('0x1b2')});db[_0x157e('0x9e')][_0x157e('0x106')](db[_0x157e('0x1b3')],{'as':_0x157e('0x1b4'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1b5')});db[_0x157e('0x1b3')][_0x157e('0x106')](db[_0x157e('0x1b6')],{'as':_0x157e('0x1b7'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1b8')});db[_0x157e('0x1b3')][_0x157e('0x106')](db[_0x157e('0x1b6')],{'as':_0x157e('0x1b9'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1ba')});db[_0x157e('0x1b3')][_0x157e('0x106')](db['SalesforceField'],{'as':_0x157e('0x1af'),'onDelete':_0x157e('0x10a'),'foreignKey':'FieldId'});db['SalesforceConfiguration'][_0x157e('0x114')](db['SalesforceAccount'],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x1b5')});db[_0x157e('0x1b6')][_0x157e('0x106')](db['SalesforceField'],{'as':_0x157e('0x1bb'),'foreignKey':_0x157e('0x1b8')});db[_0x157e('0x1b6')][_0x157e('0x106')](db[_0x157e('0x1b6')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x157e('0x1b6')][_0x157e('0x106')](db[_0x157e('0x1b6')],{'as':_0x157e('0x1bc'),'foreignKey':_0x157e('0x1bd')});db[_0x157e('0x1b6')][_0x157e('0x114')](db[_0x157e('0x95')],{'as':_0x157e('0x95'),'foreignKey':_0x157e('0x1be')});db['SugarcrmAccount']['hasMany'](db[_0x157e('0x1bf')],{'as':_0x157e('0x1b4'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1b5')});db[_0x157e('0x1bf')][_0x157e('0x106')](db[_0x157e('0xa3')],{'as':_0x157e('0x1b7'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1b8')});db[_0x157e('0x1bf')]['hasMany'](db[_0x157e('0xa3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x157e('0x1ba')});db['SugarcrmConfiguration'][_0x157e('0x106')](db[_0x157e('0xa3')],{'as':_0x157e('0x1af'),'onDelete':_0x157e('0x10a'),'foreignKey':'FieldId'});db[_0x157e('0x1bf')][_0x157e('0x114')](db[_0x157e('0xa1')],{'as':'Account','foreignKey':_0x157e('0x1b5')});db[_0x157e('0xa3')][_0x157e('0x106')](db[_0x157e('0xa3')],{'as':_0x157e('0x1bb'),'foreignKey':_0x157e('0x1b8')});db[_0x157e('0xa3')][_0x157e('0x106')](db['SugarcrmField'],{'as':_0x157e('0x1c0'),'foreignKey':'DescriptionId'});db[_0x157e('0xa3')][_0x157e('0x106')](db[_0x157e('0xa3')],{'as':'Field','foreignKey':_0x157e('0x1bd')});db[_0x157e('0xa3')][_0x157e('0x114')](db[_0x157e('0x95')],{'as':_0x157e('0x95'),'foreignKey':_0x157e('0x1be')});db['DeskAccount'][_0x157e('0x106')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x157e('0x10a'),'foreignKey':'AccountId'});db[_0x157e('0xa7')]['hasMany'](db['DeskField'],{'as':_0x157e('0x1b7'),'onDelete':_0x157e('0x10a'),'foreignKey':'SubjectId'});db[_0x157e('0xa7')]['hasMany'](db[_0x157e('0xa9')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x157e('0x106')](db[_0x157e('0xa9')],{'as':_0x157e('0x1af'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1bd')});db['DeskConfiguration'][_0x157e('0x114')](db[_0x157e('0xa5')],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x1b5')});db[_0x157e('0xa7')]['belongsToMany'](db[_0x157e('0x8d')],{'through':_0x157e('0x1c1')});db['DeskField'][_0x157e('0x106')](db[_0x157e('0xa9')],{'as':_0x157e('0x1bb'),'foreignKey':_0x157e('0x1b8')});db[_0x157e('0xa9')][_0x157e('0x106')](db['DeskField'],{'as':'Description','foreignKey':_0x157e('0x1ba')});db['DeskField'][_0x157e('0x106')](db['DeskField'],{'as':'Field','foreignKey':_0x157e('0x1bd')});db[_0x157e('0xa9')][_0x157e('0x114')](db[_0x157e('0x95')],{'as':_0x157e('0x95'),'foreignKey':'VariableId'});db['ZohoAccount'][_0x157e('0x106')](db[_0x157e('0xac')],{'as':_0x157e('0x1b4'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1b5')});db[_0x157e('0xac')]['hasMany'](db[_0x157e('0xae')],{'as':_0x157e('0x1b7'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1b8')});db[_0x157e('0xac')][_0x157e('0x106')](db[_0x157e('0xae')],{'as':_0x157e('0x1b9'),'onDelete':_0x157e('0x10a'),'foreignKey':'DescriptionId'});db[_0x157e('0xac')][_0x157e('0x106')](db[_0x157e('0xae')],{'as':_0x157e('0x1af'),'onDelete':'cascade','foreignKey':_0x157e('0x1bd')});db[_0x157e('0xac')][_0x157e('0x114')](db[_0x157e('0x1c2')],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x1b5')});db['ZohoField']['hasMany'](db[_0x157e('0xae')],{'as':_0x157e('0x1bb'),'foreignKey':_0x157e('0x1b8')});db['ZohoField'][_0x157e('0x106')](db[_0x157e('0xae')],{'as':'Description','foreignKey':_0x157e('0x1ba')});db[_0x157e('0xae')][_0x157e('0x106')](db[_0x157e('0xae')],{'as':'Field','foreignKey':_0x157e('0x1bd')});db['ZohoField'][_0x157e('0x114')](db[_0x157e('0x95')],{'as':'Variable','foreignKey':_0x157e('0x1be')});db[_0x157e('0x1c3')][_0x157e('0x106')](db['ZendeskConfiguration'],{'as':_0x157e('0x1b4'),'onDelete':'cascade','foreignKey':_0x157e('0x1b5')});db[_0x157e('0xb1')][_0x157e('0x106')](db[_0x157e('0xb3')],{'as':'Subjects','foreignKey':_0x157e('0x1b8')});db[_0x157e('0xb1')]['hasMany'](db[_0x157e('0xb3')],{'as':_0x157e('0x1b9'),'foreignKey':_0x157e('0x1ba')});db[_0x157e('0xb1')][_0x157e('0x106')](db['ZendeskField'],{'as':_0x157e('0x1af'),'foreignKey':_0x157e('0x1bd')});db[_0x157e('0xb1')][_0x157e('0x114')](db['ZendeskAccount'],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x1b5')});db['ZendeskConfiguration'][_0x157e('0x116')](db['Tag'],{'through':_0x157e('0x1c4')});db['ZendeskField'][_0x157e('0x106')](db[_0x157e('0xb3')],{'as':_0x157e('0x1bb'),'foreignKey':_0x157e('0x1b8')});db['ZendeskField'][_0x157e('0x106')](db[_0x157e('0xb3')],{'as':'Description','foreignKey':_0x157e('0x1ba')});db['ZendeskField']['hasMany'](db[_0x157e('0xb3')],{'as':_0x157e('0x1bc'),'foreignKey':_0x157e('0x1bd')});db[_0x157e('0xb3')][_0x157e('0x114')](db[_0x157e('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0x157e('0x1c5')][_0x157e('0x106')](db[_0x157e('0xb5')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x157e('0x1b5')});db[_0x157e('0xb5')][_0x157e('0x106')](db[_0x157e('0xb7')],{'as':_0x157e('0x1b7'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1b8')});db[_0x157e('0xb5')][_0x157e('0x106')](db[_0x157e('0xb7')],{'as':'Descriptions','onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1ba')});db[_0x157e('0xb5')][_0x157e('0x106')](db['FreshdeskField'],{'as':_0x157e('0x1af'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1bd')});db['FreshdeskConfiguration']['belongsTo'](db[_0x157e('0x1c5')],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x1b5')});db[_0x157e('0xb5')]['belongsToMany'](db[_0x157e('0x8d')],{'through':_0x157e('0x1c6')});db[_0x157e('0xb7')][_0x157e('0x106')](db[_0x157e('0xb7')],{'as':_0x157e('0x1bb'),'foreignKey':_0x157e('0x1b8')});db[_0x157e('0xb7')]['hasMany'](db[_0x157e('0xb7')],{'as':_0x157e('0x1c0'),'foreignKey':_0x157e('0x1ba')});db['FreshdeskField'][_0x157e('0x106')](db[_0x157e('0xb7')],{'as':'Field','foreignKey':_0x157e('0x1bd')});db[_0x157e('0xb7')][_0x157e('0x114')](db[_0x157e('0x95')],{'as':_0x157e('0x95'),'foreignKey':_0x157e('0x1be')});db['VtigerAccount'][_0x157e('0x106')](db[_0x157e('0xbb')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x157e('0x1b5')});db[_0x157e('0xbb')][_0x157e('0x106')](db[_0x157e('0xbd')],{'as':'Subjects','foreignKey':_0x157e('0x1b8')});db[_0x157e('0xbb')]['hasMany'](db[_0x157e('0xbd')],{'as':_0x157e('0x1b9'),'foreignKey':_0x157e('0x1ba')});db[_0x157e('0xbb')]['hasMany'](db[_0x157e('0xbd')],{'as':_0x157e('0x1af'),'foreignKey':'FieldId'});db[_0x157e('0xbb')][_0x157e('0x114')](db[_0x157e('0xb9')],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x1b5')});db['VtigerField'][_0x157e('0x106')](db[_0x157e('0xbd')],{'as':'Subject','foreignKey':_0x157e('0x1b8')});db[_0x157e('0xbd')][_0x157e('0x106')](db[_0x157e('0xbd')],{'as':_0x157e('0x1c0'),'foreignKey':_0x157e('0x1ba')});db[_0x157e('0xbd')][_0x157e('0x106')](db[_0x157e('0xbd')],{'as':'Field','foreignKey':'FieldId'});db[_0x157e('0xbd')]['belongsTo'](db[_0x157e('0x95')],{'as':_0x157e('0x95'),'foreignKey':_0x157e('0x1be')});db['ServicenowAccount']['hasMany'](db[_0x157e('0x1c7')],{'as':'Configurations','onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1b5')});db[_0x157e('0x1c7')][_0x157e('0x106')](db[_0x157e('0xc1')],{'as':_0x157e('0x1b7'),'foreignKey':'SubjectId'});db[_0x157e('0x1c7')]['hasMany'](db[_0x157e('0xc1')],{'as':_0x157e('0x1b9'),'foreignKey':_0x157e('0x1ba')});db[_0x157e('0x1c7')]['hasMany'](db['ServicenowField'],{'as':_0x157e('0x1af'),'foreignKey':'FieldId'});db[_0x157e('0x1c7')]['belongsTo'](db[_0x157e('0x1c8')],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0x157e('0x106')](db['ServicenowField'],{'as':_0x157e('0x1bb'),'foreignKey':'SubjectId'});db[_0x157e('0xc1')]['hasMany'](db[_0x157e('0xc1')],{'as':_0x157e('0x1c0'),'foreignKey':_0x157e('0x1ba')});db[_0x157e('0xc1')][_0x157e('0x106')](db[_0x157e('0xc1')],{'as':_0x157e('0x1bc'),'foreignKey':'FieldId'});db['ServicenowField'][_0x157e('0x114')](db['Variable'],{'as':_0x157e('0x95'),'foreignKey':_0x157e('0x1be')});db[_0x157e('0xc2')]['hasMany'](db[_0x157e('0xc3')],{'as':_0x157e('0x1b4'),'onDelete':_0x157e('0x10a'),'foreignKey':'AccountId'});db['Dynamics365Configuration']['hasMany'](db[_0x157e('0xc5')],{'as':'Subjects','onDelete':_0x157e('0x10a'),'foreignKey':'SubjectId'});db[_0x157e('0xc3')][_0x157e('0x106')](db['Dynamics365Field'],{'as':_0x157e('0x1b9'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1ba')});db['Dynamics365Configuration'][_0x157e('0x106')](db[_0x157e('0xc5')],{'as':_0x157e('0x1af'),'onDelete':'cascade','foreignKey':_0x157e('0x1bd')});db[_0x157e('0xc3')][_0x157e('0x114')](db[_0x157e('0xc2')],{'as':'Account','foreignKey':_0x157e('0x1b5')});db[_0x157e('0xc5')][_0x157e('0x106')](db[_0x157e('0xc5')],{'as':_0x157e('0x1bb'),'foreignKey':_0x157e('0x1b8')});db['Dynamics365Field'][_0x157e('0x106')](db[_0x157e('0xc5')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x157e('0xc5')][_0x157e('0x106')](db[_0x157e('0xc5')],{'as':_0x157e('0x1bc'),'foreignKey':_0x157e('0x1bd')});db[_0x157e('0xc5')][_0x157e('0x114')](db[_0x157e('0x95')],{'as':_0x157e('0x95'),'foreignKey':_0x157e('0x1be')});db['FreshsalesAccount'][_0x157e('0x106')](db[_0x157e('0xc8')],{'as':_0x157e('0x1b4'),'onDelete':'cascade','foreignKey':_0x157e('0x1b5')});db[_0x157e('0xc8')]['hasMany'](db[_0x157e('0xca')],{'as':_0x157e('0x1b7'),'foreignKey':_0x157e('0x1b8')});db[_0x157e('0xc8')][_0x157e('0x106')](db['FreshsalesField'],{'as':_0x157e('0x1b9'),'foreignKey':_0x157e('0x1ba')});db[_0x157e('0xc8')]['hasMany'](db[_0x157e('0xca')],{'as':_0x157e('0x1af'),'foreignKey':_0x157e('0x1bd')});db['FreshsalesConfiguration'][_0x157e('0x114')](db['FreshsalesAccount'],{'as':_0x157e('0x161'),'foreignKey':_0x157e('0x1b5')});db['FreshsalesField'][_0x157e('0x106')](db[_0x157e('0xca')],{'as':_0x157e('0x1bb'),'foreignKey':'SubjectId'});db[_0x157e('0xca')][_0x157e('0x106')](db[_0x157e('0xca')],{'as':'Description','foreignKey':_0x157e('0x1ba')});db[_0x157e('0xca')]['hasMany'](db['FreshsalesField'],{'as':_0x157e('0x1bc'),'foreignKey':_0x157e('0x1bd')});db[_0x157e('0xca')][_0x157e('0x114')](db['Variable'],{'as':_0x157e('0x95'),'foreignKey':_0x157e('0x1be')});db[_0x157e('0xce')][_0x157e('0x114')](db[_0x157e('0x64')],{});db[_0x157e('0xce')]['belongsTo'](db[_0x157e('0xf0')],{'as':_0x157e('0x15a'),'foreignKey':_0x157e('0x15b')});db[_0x157e('0xce')][_0x157e('0x114')](db[_0x157e('0x152')],{'as':_0x157e('0x153'),'foreignKey':'ContactId'});db[_0x157e('0xce')]['belongsTo'](db['ChatInteraction'],{});db[_0x157e('0xce')][_0x157e('0x114')](db[_0x157e('0x6a')],{});db['ChatQueueReport'][_0x157e('0x114')](db[_0x157e('0x15')],{});db['ChatQueueReport']['belongsTo'](db[_0x157e('0x6e')],{});db[_0x157e('0xd0')]['belongsTo'](db['User'],{'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1c9')});db['ChatInternalMessage'][_0x157e('0x114')](db[_0x157e('0x15')],{'onDelete':_0x157e('0x10a'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0x157e('0x106')](db[_0x157e('0xd3')],{'foreignKey':'SessionId','onDelete':_0x157e('0x10a')});db[_0x157e('0x191')][_0x157e('0x106')](db['JscriptyAnswerReport'],{'foreignKey':_0x157e('0x1ca'),'onDelete':_0x157e('0x10a')});db[_0x157e('0xd5')][_0x157e('0x114')](db[_0x157e('0x56')],{});db[_0x157e('0xd5')][_0x157e('0x114')](db[_0x157e('0xf0')],{'as':'List','foreignKey':_0x157e('0x15b')});db['SmsQueueReport'][_0x157e('0x114')](db[_0x157e('0x152')],{'as':_0x157e('0x153'),'foreignKey':_0x157e('0x154')});db['SmsQueueReport'][_0x157e('0x114')](db[_0x157e('0x5a')],{});db[_0x157e('0xd5')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x157e('0x114')](db[_0x157e('0x15')],{});db[_0x157e('0xd5')]['belongsTo'](db[_0x157e('0x5c')],{});db[_0x157e('0xd9')][_0x157e('0x106')](db[_0x157e('0x191')],{'foreignKey':_0x157e('0x1cb')});db['JscriptyProject'][_0x157e('0x106')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x157e('0xd9')][_0x157e('0x106')](db[_0x157e('0xd1')],{'foreignKey':_0x157e('0x1cb')});db[_0x157e('0xde')][_0x157e('0x116')](db['User'],{'as':_0x157e('0x173'),'through':'user_has_square_projects'});db[_0x157e('0xe3')][_0x157e('0x116')](db['User'],{'as':_0x157e('0x15d'),'through':_0x157e('0x11b')});db[_0x157e('0xe3')][_0x157e('0x116')](db[_0x157e('0x13f')],{'through':'TeamVoiceQueue','as':_0x157e('0x123')});db['Team'][_0x157e('0x116')](db['MailQueue'],{'through':_0x157e('0x15e'),'as':_0x157e('0x124')});db[_0x157e('0xe3')][_0x157e('0x116')](db[_0x157e('0x6e')],{'through':_0x157e('0x1cc'),'as':_0x157e('0x125')});db[_0x157e('0xe3')][_0x157e('0x116')](db[_0x157e('0x53')],{'through':_0x157e('0x1cd'),'as':_0x157e('0x126')});db[_0x157e('0xe3')]['belongsToMany'](db[_0x157e('0x5c')],{'through':_0x157e('0x17a'),'as':_0x157e('0x127')});db['Team'][_0x157e('0x116')](db['OpenchannelQueue'],{'through':_0x157e('0x182'),'as':'OpenchannelQueues'});db[_0x157e('0xe3')]['belongsToMany'](db['WhatsappQueue'],{'through':_0x157e('0x1ce'),'as':_0x157e('0x129')});db['Campaign'][_0x157e('0x106')](db[_0x157e('0x75')],{'as':_0x157e('0x140'),'foreignKey':'CampaignId'});db[_0x157e('0xe6')][_0x157e('0x106')](db[_0x157e('0x78')],{'as':_0x157e('0x10b'),'foreignKey':'CampaignId'});db[_0x157e('0xe6')][_0x157e('0x106')](db[_0x157e('0x7a')],{'as':'HopperHistories','foreignKey':'CampaignId'});db['Campaign'][_0x157e('0x106')](db[_0x157e('0x142')],{'as':_0x157e('0x143'),'foreignKey':_0x157e('0x195')});db['Campaign']['belongsTo'](db[_0x157e('0x28')],{'as':_0x157e('0x28'),'foreignKey':_0x157e('0x145')});db[_0x157e('0xe6')][_0x157e('0x114')](db[_0x157e('0x28')],{'as':_0x157e('0x1cf'),'foreignKey':_0x157e('0x146')});db[_0x157e('0xe6')]['belongsTo'](db['Interval'],{'as':_0x157e('0x84'),'foreignKey':_0x157e('0x147')});db['Campaign'][_0x157e('0x114')](db[_0x157e('0xde')],{'as':_0x157e('0xde'),'foreignKey':_0x157e('0x1d0')});db['Campaign']['belongsToMany'](db[_0x157e('0xf0')],{'as':_0x157e('0x119'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0x157e('0x116')](db[_0x157e('0xf0')],{'as':_0x157e('0x14c'),'through':_0x157e('0x1d1')});db[_0x157e('0xe8')][_0x157e('0x114')](db[_0x157e('0x6c')],{'as':_0x157e('0x6c'),'foreignKey':_0x157e('0x169')});db['MailTransferReport'][_0x157e('0x114')](db[_0x157e('0x15f')],{});db[_0x157e('0x1d2')][_0x157e('0x114')](db[_0x157e('0x41')],{});db[_0x157e('0x1d2')][_0x157e('0x114')](db[_0x157e('0x3c')],{'foreignKey':_0x157e('0x1d3'),'as':'FromAccount'});db[_0x157e('0x1d2')]['belongsTo'](db[_0x157e('0x15')],{'foreignKey':_0x157e('0x1d4'),'as':_0x157e('0x1d5')});db[_0x157e('0x1d2')]['belongsTo'](db[_0x157e('0x15')],{'foreignKey':_0x157e('0x1d6'),'as':'ToAgent'});db[_0x157e('0x1d2')][_0x157e('0x114')](db[_0x157e('0x3d')],{'foreignKey':_0x157e('0x1d7'),'as':_0x157e('0x1d8')});db[_0x157e('0x1d2')][_0x157e('0x114')](db[_0x157e('0x3c')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x157e('0xeb')][_0x157e('0x114')](db[_0x157e('0x6a')],{});db[_0x157e('0xeb')]['belongsTo'](db[_0x157e('0x69')],{});db['ChatTransferReport'][_0x157e('0x114')](db[_0x157e('0x64')],{'foreignKey':_0x157e('0x1d9'),'as':'FromAccount'});db[_0x157e('0xeb')][_0x157e('0x114')](db[_0x157e('0x15')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x157e('0xeb')][_0x157e('0x114')](db['User'],{'foreignKey':_0x157e('0x1d6'),'as':_0x157e('0x1da')});db[_0x157e('0xeb')][_0x157e('0x114')](db[_0x157e('0x6e')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0x157e('0xeb')]['belongsTo'](db[_0x157e('0x64')],{'foreignKey':_0x157e('0x1db'),'as':_0x157e('0x1dc')});db[_0x157e('0x1dd')]['belongsTo'](db[_0x157e('0x51')],{});db[_0x157e('0x1dd')]['belongsTo'](db['FaxInteraction'],{});db[_0x157e('0x1dd')][_0x157e('0x114')](db['FaxAccount'],{'foreignKey':_0x157e('0x1de'),'as':_0x157e('0x1df')});db[_0x157e('0x1dd')][_0x157e('0x114')](db[_0x157e('0x15')],{'foreignKey':_0x157e('0x1d4'),'as':_0x157e('0x1d5')});db[_0x157e('0x1dd')][_0x157e('0x114')](db[_0x157e('0x15')],{'foreignKey':_0x157e('0x1d6'),'as':_0x157e('0x1da')});db['FaxTransferReport'][_0x157e('0x114')](db[_0x157e('0x53')],{'foreignKey':'ToFaxQueueId','as':_0x157e('0x1d8')});db[_0x157e('0x1dd')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x157e('0x1e0'),'as':_0x157e('0x1dc')});db[_0x157e('0x1e1')][_0x157e('0x114')](db[_0x157e('0x17c')],{});db['OpenchannelTransferReport'][_0x157e('0x114')](db[_0x157e('0x10d')],{});db['OpenchannelTransferReport'][_0x157e('0x114')](db[_0x157e('0x5d')],{'foreignKey':_0x157e('0x1e2'),'as':'FromAccount'});db[_0x157e('0x1e1')][_0x157e('0x114')](db['User'],{'foreignKey':_0x157e('0x1d4'),'as':_0x157e('0x1d5')});db[_0x157e('0x1e1')][_0x157e('0x114')](db[_0x157e('0x15')],{'foreignKey':_0x157e('0x1d6'),'as':_0x157e('0x1da')});db['OpenchannelTransferReport'][_0x157e('0x114')](db[_0x157e('0x62')],{'foreignKey':_0x157e('0x1e3'),'as':_0x157e('0x1d8')});db[_0x157e('0x1e1')][_0x157e('0x114')](db[_0x157e('0x5d')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0x157e('0xee')]['belongsTo'](db[_0x157e('0x175')],{});db[_0x157e('0xee')][_0x157e('0x114')](db['SmsInteraction'],{});db['SmsTransferReport'][_0x157e('0x114')](db[_0x157e('0x56')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db[_0x157e('0xee')][_0x157e('0x114')](db[_0x157e('0x15')],{'foreignKey':_0x157e('0x1d4'),'as':_0x157e('0x1d5')});db[_0x157e('0xee')][_0x157e('0x114')](db[_0x157e('0x15')],{'foreignKey':_0x157e('0x1d6'),'as':_0x157e('0x1da')});db[_0x157e('0xee')][_0x157e('0x114')](db[_0x157e('0x5c')],{'foreignKey':_0x157e('0x1e4'),'as':_0x157e('0x1d8')});db[_0x157e('0xee')][_0x157e('0x114')](db['SmsAccount'],{'foreignKey':_0x157e('0x1e5'),'as':'ToAccount'});db[_0x157e('0xf0')][_0x157e('0x106')](db['Disposition'],{'as':_0x157e('0x16e'),'foreignKey':_0x157e('0x15b')});db[_0x157e('0xf0')][_0x157e('0x106')](db[_0x157e('0x1e6')],{'as':'CustomFields','foreignKey':_0x157e('0x15b')});db[_0x157e('0xf0')]['hasMany'](db[_0x157e('0x152')],{'as':_0x157e('0x117'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x15b')});db[_0x157e('0xf0')][_0x157e('0x106')](db['CmHopperFinal'],{'as':_0x157e('0x10b'),'foreignKey':_0x157e('0x15b')});db['CmList']['hasMany'](db[_0x157e('0x7a')],{'as':'HopperHistory','foreignKey':_0x157e('0x15b')});db[_0x157e('0xf0')]['hasMany'](db[_0x157e('0x7c')],{'as':_0x157e('0x7c'),'foreignKey':_0x157e('0x15b')});db[_0x157e('0xf0')]['belongsToMany'](db['VoiceQueue'],{'as':_0x157e('0x1e7'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0x157e('0x116')](db[_0x157e('0x15')],{'as':'Agents','through':'cm_user_has_lists'});db[_0x157e('0xf2')][_0x157e('0x106')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x157e('0x10a')});db[_0x157e('0xf2')][_0x157e('0x116')](db[_0x157e('0x15')],{'as':_0x157e('0x15d'),'through':_0x157e('0x12a')});db[_0x157e('0xf4')]['hasMany'](db[_0x157e('0x15')],{'as':_0x157e('0x173'),'foreignKey':'userProfileId'});db[_0x157e('0xf4')][_0x157e('0x106')](db[_0x157e('0xf6')],{'as':_0x157e('0x1e8'),'foreignKey':_0x157e('0x115'),'onDelete':_0x157e('0x10a')});db['UserProfileSection'][_0x157e('0x106')](db[_0x157e('0x1e9')],{'as':_0x157e('0x1ea'),'foreignKey':_0x157e('0x1eb'),'onDelete':_0x157e('0x10a')});db[_0x157e('0xf8')][_0x157e('0x106')](db['Disposition'],{'as':_0x157e('0x16e'),'foreignKey':_0x157e('0x1ec')});db['WhatsappAccount'][_0x157e('0x106')](db[_0x157e('0x81')],{'as':_0x157e('0x159'),'foreignKey':_0x157e('0x1ec')});db[_0x157e('0xf8')]['hasMany'](db[_0x157e('0xfd')],{'as':_0x157e('0x14d'),'foreignKey':'WhatsappAccountId'});db[_0x157e('0xf8')][_0x157e('0x106')](db['WhatsappInteraction'],{'as':_0x157e('0x176')});db[_0x157e('0xf8')][_0x157e('0x106')](db[_0x157e('0xfa')],{'as':_0x157e('0x139')});db['WhatsappAccount'][_0x157e('0x114')](db['CmList'],{'as':_0x157e('0x15a'),'foreignKey':_0x157e('0x15b')});db[_0x157e('0xf8')]['belongsTo'](db[_0x157e('0x86')],{'as':_0x157e('0x148'),'foreignKey':_0x157e('0x149')});db['WhatsappAccount'][_0x157e('0x116')](db['User'],{'as':'Agents','through':_0x157e('0x135')});db[_0x157e('0xfa')][_0x157e('0x114')](db['User'],{'onDelete':_0x157e('0x16a')});db[_0x157e('0xfa')][_0x157e('0x114')](db[_0x157e('0x101')],{'onDelete':'restrict'});db[_0x157e('0xfa')]['belongsTo'](db[_0x157e('0xf8')],{'onDelete':_0x157e('0x16a')});db[_0x157e('0xfa')][_0x157e('0x114')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x157e('0x147')});db[_0x157e('0xfa')][_0x157e('0x114')](db[_0x157e('0x8d')],{'onDelete':_0x157e('0x16a'),'foreignKey':_0x157e('0x16b')});db[_0x157e('0x111')][_0x157e('0x106')](db[_0x157e('0xfd')],{'as':_0x157e('0x14d'),'onDelete':_0x157e('0x10a'),'foreignKey':_0x157e('0x1ed')});db['WhatsappInteraction'][_0x157e('0x114')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x157e('0x1ec')});db[_0x157e('0x111')]['belongsTo'](db[_0x157e('0x152')],{'as':_0x157e('0x153'),'foreignKey':_0x157e('0x154')});db[_0x157e('0x111')][_0x157e('0x114')](db['User'],{'as':_0x157e('0x162'),'foreignKey':_0x157e('0x105')});db[_0x157e('0x111')][_0x157e('0x116')](db[_0x157e('0x8d')],{'through':'whatsapp_interaction_has_tags','as':_0x157e('0x164')});db[_0x157e('0x111')][_0x157e('0x116')](db[_0x157e('0x8d')],{'through':'whatsapp_interaction_has_tags','as':_0x157e('0x165')});db[_0x157e('0x111')][_0x157e('0x116')](db[_0x157e('0x15')],{'as':_0x157e('0x173'),'through':'user_has_whatsapp_interactions','foreignKey':_0x157e('0x1ed')});db[_0x157e('0xfd')]['belongsTo'](db['User'],{'as':_0x157e('0x15')});db['WhatsappMessage'][_0x157e('0x114')](db[_0x157e('0x152')],{'onDelete':'cascade','as':_0x157e('0x153')});db['WhatsappMessage'][_0x157e('0x114')](db[_0x157e('0x111')],{'onDelete':_0x157e('0x10a'),'as':'Interaction','foreignKey':_0x157e('0x1ed')});db[_0x157e('0xfd')][_0x157e('0x114')](db[_0x157e('0xf8')],{'as':'Account','foreignKey':_0x157e('0x1ec')});db[_0x157e('0xfe')][_0x157e('0x114')](db[_0x157e('0xf8')],{});db[_0x157e('0xfe')][_0x157e('0x114')](db[_0x157e('0xf0')],{'as':'List','foreignKey':'ListId'});db[_0x157e('0xfe')][_0x157e('0x114')](db[_0x157e('0x152')],{'as':_0x157e('0x153'),'foreignKey':_0x157e('0x154')});db[_0x157e('0xfe')][_0x157e('0x114')](db[_0x157e('0x111')],{});db[_0x157e('0xfe')][_0x157e('0x114')](db[_0x157e('0x101')],{});db[_0x157e('0xfe')][_0x157e('0x114')](db[_0x157e('0xfd')],{});db['WhatsappQueueReport'][_0x157e('0x114')](db['User'],{});db[_0x157e('0x1ee')][_0x157e('0x114')](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0x157e('0x114')](db[_0x157e('0x111')],{});db['WhatsappTransferReport'][_0x157e('0x114')](db[_0x157e('0xf8')],{'foreignKey':_0x157e('0x1ef'),'as':_0x157e('0x1df')});db[_0x157e('0x1ee')][_0x157e('0x114')](db[_0x157e('0xf8')],{'foreignKey':_0x157e('0x1f0'),'as':'ToAccount'});db[_0x157e('0x1ee')][_0x157e('0x114')](db[_0x157e('0x101')],{'foreignKey':_0x157e('0x1f1'),'as':'ToQueue'});db[_0x157e('0x1ee')]['belongsTo'](db[_0x157e('0x15')],{'foreignKey':_0x157e('0x1d4'),'as':_0x157e('0x1d5')});db[_0x157e('0x1ee')][_0x157e('0x114')](db['User'],{'foreignKey':_0x157e('0x1d6'),'as':_0x157e('0x1da')});db['WhatsappQueue'][_0x157e('0x116')](db['User'],{'as':_0x157e('0x15d'),'through':_0x157e('0x38'),'foreignKey':_0x157e('0x1f2')});db[_0x157e('0x101')][_0x157e('0x116')](db['Team'],{'through':_0x157e('0x1ce'),'as':'Teams'});module[_0x157e('0x1f3')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x2b16=['UserVoiceQueue','Teams','BlackLists','mailbox','mailboxuser','QueueCalls','uniqueid','Contact','ContactId','MailServerIn','MailAccountId','MailMessage','Messages','Applications','List','ListId','TemplateId','Pause','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','Attachment','Interaction','ChatWebsiteId','restrict','TagId','Items','Disposition','Dispositions','FaxAccountId','Answers','Interactions','Exntensions','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsAccountId','SmsMessage','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','openchannel_interaction_has_tags','ThroughTags','OpenchannelInteractionId','OpenchannelQueueId','ProactiveActions','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','Phones','CmContactId','JscriptySessions','Company','cm_contact_has_tags','CmHopperId','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','AnalyticCustomReport','CustomReportId','Sound','Mohs','whatsapp_interaction_has_tags','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','DefaultReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','Variable','VariableId','SugarcrmConfiguration','int_desk_configuration_has_tags','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','VtigerAccount','ServicenowConfiguration','ToId','SessionId','ProjectId','FaxQueues','team_has_openchannel_queues','TrunkId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','path','../config/environment','sequelize','lodash','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','mysql','database','options','username','password','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','CmCompany','CmContact','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','Recordings','hasMany','UserVoiceQueueRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','MailQueue','MailQueues','ChatQueues','UserChatQueue','SmsQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','VoiceMusicOnHold','moh_has_sounds','VoiceQueue','Hoppers','VoiceQueueId','HopperHistories','CmHopperBlack','HopperBlacks','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents'];(function(_0x11df62,_0x523276){var _0x3f65d9=function(_0x46f361){while(--_0x46f361){_0x11df62['push'](_0x11df62['shift']());}};_0x3f65d9(++_0x523276);}(_0x2b16,0xa3));var _0x62b1=function(_0x3b71cb,_0x131679){_0x3b71cb=_0x3b71cb-0x0;var _0x1a0f5d=_0x2b16[_0x3b71cb];return _0x1a0f5d;};'use strict';var path=require(_0x62b1('0x0'));var config=require(_0x62b1('0x1'));var Sequelize=require(_0x62b1('0x2'));var _=require(_0x62b1('0x3'));var jstz=require('jstz');var timezone=jstz[_0x62b1('0x4')]();config[_0x62b1('0x2')]=_[_0x62b1('0x5')](config['sequelize'],{'database':_0x62b1('0x6'),'username':_0x62b1('0x7'),'password':_0x62b1('0x8'),'options':{'host':_0x62b1('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x62b1('0xa')},'logging':![],'timezone':timezone[_0x62b1('0xb')](),'define':{'charset':_0x62b1('0xc'),'collate':_0x62b1('0xd')}}});config[_0x62b1('0xe')]=_[_0x62b1('0x5')](config[_0x62b1('0xe')],{'database':_0x62b1('0x6'),'username':_0x62b1('0x7'),'password':_0x62b1('0x8'),'options':{'host':_0x62b1('0x9'),'port':0xcea,'dialect':_0x62b1('0xf'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x62b1('0xb')](),'define':{'charset':_0x62b1('0xc'),'collate':_0x62b1('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x62b1('0x2')][_0x62b1('0x10')],config[_0x62b1('0x2')]['username'],config[_0x62b1('0x2')]['password'],config[_0x62b1('0x2')][_0x62b1('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x62b1('0xe')]['database'],config[_0x62b1('0xe')][_0x62b1('0x12')],config[_0x62b1('0xe')][_0x62b1('0x13')],config[_0x62b1('0xe')][_0x62b1('0x11')])};db[_0x62b1('0x14')]=db[_0x62b1('0x2')]['import'](_0x62b1('0x15'));db[_0x62b1('0x16')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x18'));db[_0x62b1('0x19')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x1a'));db[_0x62b1('0x1b')]=db[_0x62b1('0x2')]['import'](_0x62b1('0x1c'));db['VoiceMusicOnHold']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x1d'));db['VoiceQueue']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x1e'));db[_0x62b1('0x1f')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x20'));db['ScreenRecording']=db['sequelize'][_0x62b1('0x17')]('../api/screenRecording/screenRecording.model');db[_0x62b1('0x21')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/voiceMail/voiceMail.model');db[_0x62b1('0x22')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0x23'));db[_0x62b1('0x24')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0x25'));db[_0x62b1('0x26')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x27'));db[_0x62b1('0x28')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x29'));db[_0x62b1('0x2a')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x2b'));db[_0x62b1('0x2c')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x2d'));db[_0x62b1('0x2e')]=db[_0x62b1('0x2')]['import'](_0x62b1('0x2f'));db[_0x62b1('0x30')]=db['sequelize'][_0x62b1('0x17')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x31'));db['UserVoiceQueue']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x32'));db['UserChatQueue']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x33'));db[_0x62b1('0x34')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x35'));db[_0x62b1('0x36')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0x37'));db[_0x62b1('0x38')]=db['sequelize']['import'](_0x62b1('0x39'));db[_0x62b1('0x3a')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x3b'));db[_0x62b1('0x3c')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x3d'));db['MailServerIn']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x3e'));db[_0x62b1('0x3f')]=db[_0x62b1('0x2')]['import'](_0x62b1('0x40'));db[_0x62b1('0x41')]=db['sequelize']['import'](_0x62b1('0x42'));db['MailQueue']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x43'));db['MailSubstatus']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x44'));db[_0x62b1('0x45')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x46'));db['MailMessage']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x47'));db[_0x62b1('0x48')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/mailApplication/mailApplication.model');db[_0x62b1('0x49')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x4a'));db[_0x62b1('0x4b')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/dashboard/dashboard.model');db[_0x62b1('0x4c')]=db['sequelize']['import'](_0x62b1('0x4d'));db[_0x62b1('0x4e')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/faxAccount/faxAccount.model');db[_0x62b1('0x4f')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x50'));db[_0x62b1('0x51')]=db['sequelize'][_0x62b1('0x17')]('../api/faxInteraction/faxInteraction.model');db[_0x62b1('0x52')]=db[_0x62b1('0x2')]['import'](_0x62b1('0x53'));db[_0x62b1('0x54')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/faxQueue/faxQueue.model');db[_0x62b1('0x55')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/faxQueueReport/faxQueueReport.model');db[_0x62b1('0x56')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x57'));db[_0x62b1('0x58')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x59'));db[_0x62b1('0x5a')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0x5b'));db['SmsMessage']=db[_0x62b1('0x2')]['import'](_0x62b1('0x5c'));db['SmsQueue']=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/smsQueue/smsQueue.model');db[_0x62b1('0x5d')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0x5e'));db[_0x62b1('0x5f')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0x60'));db['OpenchannelInteraction']=db[_0x62b1('0x2')]['import'](_0x62b1('0x61'));db[_0x62b1('0x62')]=db['sequelize'][_0x62b1('0x17')]('../api/openchannelMessage/openchannelMessage.model');db[_0x62b1('0x63')]=db[_0x62b1('0x2')]['import'](_0x62b1('0x64'));db['ChatWebsite']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x65'));db[_0x62b1('0x66')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x67'));db[_0x62b1('0x68')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0x69'));db['ChatInteraction']=db[_0x62b1('0x2')]['import'](_0x62b1('0x6a'));db[_0x62b1('0x6b')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x6c'));db[_0x62b1('0x6d')]=db[_0x62b1('0x2')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x62b1('0x6e')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0x6f'));db[_0x62b1('0x70')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/chatGroup/chatGroup.model');db[_0x62b1('0x71')]=db['sequelize'][_0x62b1('0x17')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x62b1('0x72')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/cmCompany/cmCompany.model');db[_0x62b1('0x73')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/cmContact/cmContact.model');db[_0x62b1('0x74')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x75'));db['CmHopperBlack']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x76'));db[_0x62b1('0x77')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x78'));db[_0x62b1('0x79')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x7a'));db[_0x62b1('0x7b')]=db['sequelize'][_0x62b1('0x17')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x7c'));db[_0x62b1('0x7d')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x7e'));db[_0x62b1('0x7f')]=db['sequelize']['import'](_0x62b1('0x80'));db[_0x62b1('0x81')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x82'));db['Disposition']=db['sequelize'][_0x62b1('0x17')](_0x62b1('0x83'));db[_0x62b1('0x84')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x85'));db[_0x62b1('0x86')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x87'));db['Pause']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x88'));db[_0x62b1('0x89')]=db[_0x62b1('0x2')]['import']('../api/cdr/cdr.model');db[_0x62b1('0x8a')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x8b'));db[_0x62b1('0x8c')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x8d'));db['Sound']=db[_0x62b1('0x2')]['import'](_0x62b1('0x8e'));db[_0x62b1('0x8f')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x90'));db[_0x62b1('0x91')]=db['sequelize']['import'](_0x62b1('0x92'));db[_0x62b1('0x93')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x94'));db[_0x62b1('0x95')]=db[_0x62b1('0x2')]['import'](_0x62b1('0x96'));db[_0x62b1('0x97')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x98'));db[_0x62b1('0x99')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x9a'));db['Variable']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x9b'));db[_0x62b1('0x9c')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x9d'));db[_0x62b1('0x9e')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x9f'));db['AnalyticDefaultReport']=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x62b1('0xa0')]=db[_0x62b1('0x2')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x62b1('0xa1')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/analyticMetric/analyticMetric.model');db[_0x62b1('0xa2')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0xa3'));db[_0x62b1('0xa4')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xa5'));db[_0x62b1('0xa6')]=db['sequelize'][_0x62b1('0x17')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x62b1('0xa7')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0xa8'));db[_0x62b1('0xa9')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xaa'));db[_0x62b1('0xab')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xac'));db[_0x62b1('0xad')]=db[_0x62b1('0x2')]['import'](_0x62b1('0xae'));db[_0x62b1('0xaf')]=db['sequelize']['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x62b1('0xb0')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xb1'));db[_0x62b1('0xb2')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xb3'));db[_0x62b1('0xb4')]=db[_0x62b1('0x2')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0x62b1('0xb5')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xb6'));db[_0x62b1('0xb7')]=db[_0x62b1('0x2')]['import'](_0x62b1('0xb8'));db['ZendeskAccount']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xb9'));db[_0x62b1('0xba')]=db['sequelize'][_0x62b1('0x17')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x62b1('0xbb')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xbc'));db[_0x62b1('0xbd')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0xbe'));db[_0x62b1('0xbf')]=db[_0x62b1('0x2')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xc0'));db['VtigerConfiguration']=db['sequelize'][_0x62b1('0x17')](_0x62b1('0xc1'));db['VtigerField']=db['sequelize'][_0x62b1('0x17')](_0x62b1('0xc2'));db[_0x62b1('0xc3')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xc4'));db['ServicenowConfiguration']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xc5'));db[_0x62b1('0xc6')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xc7'));db[_0x62b1('0xc8')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xc9'));db[_0x62b1('0xca')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xcb'));db[_0x62b1('0xcc')]=db[_0x62b1('0x2')]['import'](_0x62b1('0xcd'));db[_0x62b1('0xce')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0xcf'));db[_0x62b1('0xd0')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x62b1('0xd1')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xd2'));db[_0x62b1('0x9c')]=db[_0x62b1('0x2')]['import'](_0x62b1('0x9d'));db['Network']=db[_0x62b1('0x2')]['import'](_0x62b1('0xd3'));db[_0x62b1('0xd4')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xd5'));db[_0x62b1('0xd6')]=db[_0x62b1('0x2')]['import'](_0x62b1('0xd7'));db[_0x62b1('0xd8')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x62b1('0xd9')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0xda'));db[_0x62b1('0xdb')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xdc'));db[_0x62b1('0xdd')]=db[_0x62b1('0x2')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x62b1('0xde')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xdf'));db[_0x62b1('0xe0')]=db[_0x62b1('0x2')]['import'](_0x62b1('0xe1'));db[_0x62b1('0xe2')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/jscriptyProject/jscriptyProject.model');db[_0x62b1('0xe3')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xe4'));db[_0x62b1('0xe5')]=db[_0x62b1('0x2')][_0x62b1('0x17')]('../api/squareOdbc/squareOdbc.model');db[_0x62b1('0xe6')]=db['sequelize'][_0x62b1('0x17')]('../api/squareProject/squareProject.model');db[_0x62b1('0xe7')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0xe8'));db[_0x62b1('0xe9')]=db[_0x62b1('0x2')]['import'](_0x62b1('0xea'));db[_0x62b1('0xeb')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xec'));db[_0x62b1('0xed')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xee'));db[_0x62b1('0xef')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xf0'));db[_0x62b1('0xf1')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xf2'));db['Attachment']=db['sequelize'][_0x62b1('0x17')](_0x62b1('0xf3'));db[_0x62b1('0xf4')]=db[_0x62b1('0x2')]['import'](_0x62b1('0xf5'));db[_0x62b1('0xf6')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xf7'));db[_0x62b1('0xf8')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xf9'));db[_0x62b1('0xfa')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xfb'));db['OpenchannelTransferReport']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xfc'));db['SmsTransferReport']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0xfd'));db[_0x62b1('0xfe')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0xff'));db[_0x62b1('0x100')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x101'));db[_0x62b1('0x102')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x103'));db[_0x62b1('0x104')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0x105'));db[_0x62b1('0x106')]=db[_0x62b1('0x2')]['import']('../api/userProfileResource/userProfileResource.model');db[_0x62b1('0x107')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x108'));db[_0x62b1('0x109')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x10a'));db[_0x62b1('0x10b')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0x10c'));db[_0x62b1('0x10d')]=db[_0x62b1('0x2')]['import'](_0x62b1('0x10e'));db['WhatsappMessage']=db['sequelize'][_0x62b1('0x17')](_0x62b1('0x10f'));db[_0x62b1('0x110')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x111'));db[_0x62b1('0x112')]=db['sequelize']['import'](_0x62b1('0x113'));db[_0x62b1('0x114')]=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x115'));db['CloudProvider']=db[_0x62b1('0x2')][_0x62b1('0x17')](_0x62b1('0x116'));db[_0x62b1('0x117')]=db['sequelize'][_0x62b1('0x17')](_0x62b1('0x118'));db['User'][_0x62b1('0x119')](db['VoiceMail'],{'as':_0x62b1('0x21'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x14')]['hasMany'](db[_0x62b1('0x1f')],{'as':_0x62b1('0x11c'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x14')][_0x62b1('0x11d')](db[_0x62b1('0x11e')],{'as':'VoiceQueuesRt','foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x14')][_0x62b1('0x11d')](db[_0x62b1('0x1b')],{'as':_0x62b1('0x11f'),'onDelete':'cascade','hooks':!![]});db[_0x62b1('0x14')][_0x62b1('0x11d')](db['CmHopperFinal'],{'as':_0x62b1('0x120'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x14')][_0x62b1('0x11d')](db[_0x62b1('0x79')],{'as':_0x62b1('0x121'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x14')]['hasMany'](db['ReportAgentPreview'],{'as':_0x62b1('0x7b'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x14')]['hasMany'](db[_0x62b1('0x122')],{'as':_0x62b1('0x123'),'foreignKey':_0x62b1('0x11b')});db['User'][_0x62b1('0x11d')](db[_0x62b1('0x124')],{'as':_0x62b1('0x125'),'foreignKey':'UserId'});db['User'][_0x62b1('0x11d')](db['SmsInteraction'],{'as':_0x62b1('0x126'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x14')][_0x62b1('0x11d')](db[_0x62b1('0x51')],{'as':_0x62b1('0x127'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x14')][_0x62b1('0x11d')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x14')]['hasMany'](db[_0x62b1('0x10d')],{'as':_0x62b1('0x128'),'foreignKey':_0x62b1('0x11b')});db['User'][_0x62b1('0x11d')](db[_0x62b1('0x107')],{'as':_0x62b1('0x129'),'foreignKey':_0x62b1('0x12a')});db[_0x62b1('0x14')][_0x62b1('0x12b')](db[_0x62b1('0x102')],{'as':_0x62b1('0x102'),'foreignKey':_0x62b1('0x12c')});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x70')],{'as':_0x62b1('0x12e'),'through':_0x62b1('0x12f')});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x73')],{'as':_0x62b1('0x130'),'through':_0x62b1('0x131')});db[_0x62b1('0x14')]['belongsToMany'](db['CmList'],{'as':_0x62b1('0x132'),'through':'cm_user_has_lists'});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0xeb')],{'through':'user_has_teams'});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x45')],{'as':_0x62b1('0x133'),'through':_0x62b1('0x134')});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x124')],{'as':_0x62b1('0x125'),'through':_0x62b1('0x135')});db['User']['belongsToMany'](db['FaxInteraction'],{'as':_0x62b1('0x127'),'through':_0x62b1('0x136')});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x5a')],{'as':_0x62b1('0x126'),'through':_0x62b1('0x137')});db['User'][_0x62b1('0x12d')](db[_0x62b1('0x122')],{'as':'OpenchannelInteractions','through':_0x62b1('0x138')});db['User'][_0x62b1('0x12d')](db['WhatsappInteraction'],{'as':_0x62b1('0x128'),'through':'user_has_whatsapp_interactions'});db[_0x62b1('0x14')][_0x62b1('0x12d')](db['VoiceQueue'],{'as':_0x62b1('0x139'),'through':'UserVoiceQueue','required':![]});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x13a')],{'as':_0x62b1('0x13b'),'through':_0x62b1('0x34'),'required':![]});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x6e')],{'as':_0x62b1('0x13c'),'through':_0x62b1('0x13d'),'required':![],'hooks':!![]});db[_0x62b1('0x14')][_0x62b1('0x12d')](db['FaxQueue'],{'as':'FaxQueues','through':_0x62b1('0x36'),'required':![]});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x13e')],{'as':_0x62b1('0x13f'),'through':_0x62b1('0x38'),'required':![]});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x63')],{'as':_0x62b1('0x140'),'through':_0x62b1('0x3a'),'required':![]});db['User'][_0x62b1('0x12d')](db[_0x62b1('0x114')],{'as':_0x62b1('0x141'),'through':_0x62b1('0x3c'),'required':![]});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0xfe')],{'through':_0x62b1('0x142')});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x100')],{'as':_0x62b1('0x143'),'through':_0x62b1('0x144'),'required':![]});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x145')],{'as':_0x62b1('0x146'),'through':_0x62b1('0x147')});db[_0x62b1('0x14')]['belongsToMany'](db[_0x62b1('0x4e')],{'as':_0x62b1('0x148'),'through':_0x62b1('0x149')});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x41')],{'as':_0x62b1('0x14a'),'through':_0x62b1('0x14b')});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x5d')],{'as':_0x62b1('0x14c'),'through':_0x62b1('0x14d')});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0x56')],{'as':_0x62b1('0x14e'),'through':'user_has_sms_accounts'});db['User'][_0x62b1('0x12d')](db[_0x62b1('0x109')],{'as':_0x62b1('0x14f'),'through':_0x62b1('0x150')});db[_0x62b1('0x14')][_0x62b1('0x12d')](db[_0x62b1('0xe6')],{'as':_0x62b1('0x151'),'through':_0x62b1('0x152')});db[_0x62b1('0x16')]['hasMany'](db[_0x62b1('0x1b')],{'as':_0x62b1('0x153'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db['VoiceContext'][_0x62b1('0x11d')](db[_0x62b1('0x1b')],{'onDelete':_0x62b1('0x11a')});db[_0x62b1('0x1b')][_0x62b1('0x11d')](db[_0x62b1('0x1b')],{'as':'Applications','onDelete':_0x62b1('0x11a')});db[_0x62b1('0x154')][_0x62b1('0x12d')](db['Sound'],{'as':'Sounds','through':_0x62b1('0x155')});db[_0x62b1('0x156')][_0x62b1('0x11d')](db[_0x62b1('0x11e')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x62b1('0x156')][_0x62b1('0x11d')](db[_0x62b1('0x74')],{'as':_0x62b1('0x157'),'foreignKey':'VoiceQueueId'});db[_0x62b1('0x156')]['hasMany'](db['CmHopperFinal'],{'as':_0x62b1('0x120'),'foreignKey':_0x62b1('0x158')});db[_0x62b1('0x156')]['hasMany'](db[_0x62b1('0x79')],{'as':_0x62b1('0x159'),'foreignKey':_0x62b1('0x158')});db[_0x62b1('0x156')][_0x62b1('0x11d')](db[_0x62b1('0x7b')],{'as':_0x62b1('0x7b'),'foreignKey':'VoiceQueueId'});db[_0x62b1('0x156')][_0x62b1('0x11d')](db[_0x62b1('0x15a')],{'as':_0x62b1('0x15b'),'foreignKey':'VoiceQueueId'});db[_0x62b1('0x156')]['hasMany'](db[_0x62b1('0xdb')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0x62b1('0x156')]['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x62b1('0x156')][_0x62b1('0x12b')](db[_0x62b1('0x2e')],{'as':_0x62b1('0x15c'),'foreignKey':_0x62b1('0x15d')});db[_0x62b1('0x156')][_0x62b1('0x12b')](db['Interval'],{'as':_0x62b1('0x86'),'foreignKey':_0x62b1('0x15e')});db['VoiceQueue'][_0x62b1('0x12b')](db['Pause'],{'as':_0x62b1('0x15f'),'foreignKey':_0x62b1('0x160')});db[_0x62b1('0x156')][_0x62b1('0x12d')](db['CmList'],{'as':_0x62b1('0x132'),'through':_0x62b1('0x161')});db['VoiceQueue'][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':_0x62b1('0x162'),'through':_0x62b1('0x163')});db['VoiceQueue'][_0x62b1('0x12d')](db['Team'],{'as':_0x62b1('0x164'),'through':_0x62b1('0x117')});db[_0x62b1('0x156')]['belongsToMany'](db[_0x62b1('0xfe')],{'as':_0x62b1('0x165'),'through':'voice_queues_has_cm_blacklists'});db[_0x62b1('0x1f')][_0x62b1('0x12b')](db['User'],{'as':_0x62b1('0x14'),'foreignKey':_0x62b1('0x11b')});db['ScreenRecording'][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'as':_0x62b1('0x14'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x21')][_0x62b1('0x11d')](db[_0x62b1('0x22')],{'as':'Messages','onDelete':_0x62b1('0x11a'),'foreignKey':'mailboxuser','sourceKey':_0x62b1('0x166')});db[_0x62b1('0x22')][_0x62b1('0x12b')](db['VoiceMail'],{'foreignKey':_0x62b1('0x167'),'targetKey':_0x62b1('0x166')});db[_0x62b1('0x24')][_0x62b1('0x11d')](db['VoiceQueueReport'],{'as':_0x62b1('0x168'),'foreignKey':_0x62b1('0x169'),'constraints':![]});db['VoiceCallReport'][_0x62b1('0x11d')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0x62b1('0x169'),'constraints':![]});db[_0x62b1('0x24')]['belongsTo'](db['User'],{'as':_0x62b1('0x14'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x24')]['belongsTo'](db[_0x62b1('0x73')],{'as':_0x62b1('0x16a'),'foreignKey':_0x62b1('0x16b')});db[_0x62b1('0x16c')][_0x62b1('0x12b')](db[_0x62b1('0x41')],{'as':_0x62b1('0x41'),'foreignKey':_0x62b1('0x16d')});db[_0x62b1('0x3f')][_0x62b1('0x12b')](db[_0x62b1('0x41')],{'as':_0x62b1('0x41'),'foreignKey':'MailAccountId'});db[_0x62b1('0x41')][_0x62b1('0x119')](db[_0x62b1('0x16c')],{'as':'Imap','onDelete':'cascade'});db[_0x62b1('0x41')][_0x62b1('0x119')](db[_0x62b1('0x3f')],{'as':'Smtp','onDelete':_0x62b1('0x11a')});db['MailAccount'][_0x62b1('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x62b1('0x16d')});db[_0x62b1('0x41')]['hasMany'](db[_0x62b1('0x81')],{'as':'Answers','foreignKey':_0x62b1('0x16d')});db[_0x62b1('0x41')][_0x62b1('0x11d')](db[_0x62b1('0x16e')],{'as':_0x62b1('0x16f'),'foreignKey':_0x62b1('0x16d')});db[_0x62b1('0x41')][_0x62b1('0x11d')](db[_0x62b1('0x45')],{'as':'Interactions'});db[_0x62b1('0x41')]['hasMany'](db[_0x62b1('0x48')],{'as':_0x62b1('0x170')});db[_0x62b1('0x41')][_0x62b1('0x12b')](db['CmList'],{'as':_0x62b1('0x171'),'foreignKey':_0x62b1('0x172')});db['MailAccount'][_0x62b1('0x12b')](db[_0x62b1('0x97')],{'as':_0x62b1('0x97'),'foreignKey':_0x62b1('0x173')});db[_0x62b1('0x41')]['belongsTo'](db[_0x62b1('0x174')],{'as':_0x62b1('0x15f'),'foreignKey':_0x62b1('0x160')});db['MailAccount'][_0x62b1('0x12d')](db['User'],{'as':_0x62b1('0x162'),'through':_0x62b1('0x14b')});db[_0x62b1('0x13a')]['belongsToMany'](db[_0x62b1('0x14')],{'as':_0x62b1('0x162'),'through':'UserMailQueue'});db['MailQueue'][_0x62b1('0x12d')](db[_0x62b1('0xeb')],{'through':_0x62b1('0x175'),'as':_0x62b1('0x164')});db[_0x62b1('0x45')][_0x62b1('0x11d')](db['MailMessage'],{'as':'Messages','onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x176')});db[_0x62b1('0x45')][_0x62b1('0x12b')](db[_0x62b1('0x41')],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x16d')});db['MailInteraction'][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'as':_0x62b1('0x16a'),'foreignKey':_0x62b1('0x16b')});db[_0x62b1('0x45')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'as':_0x62b1('0x178'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x45')][_0x62b1('0x12d')](db[_0x62b1('0x8f')],{'through':_0x62b1('0x179'),'as':_0x62b1('0x17a')});db[_0x62b1('0x45')][_0x62b1('0x12d')](db[_0x62b1('0x8f')],{'through':_0x62b1('0x179'),'as':'ThroughTags'});db[_0x62b1('0x45')]['belongsToMany'](db[_0x62b1('0x14')],{'as':_0x62b1('0x17b'),'through':_0x62b1('0x134'),'foreignKey':_0x62b1('0x176')});db[_0x62b1('0x16e')][_0x62b1('0x11d')](db[_0x62b1('0x17c')],{'as':'Attachments','onDelete':_0x62b1('0x11a')});db[_0x62b1('0x16e')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'as':_0x62b1('0x14')});db['MailMessage'][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'onDelete':_0x62b1('0x11a'),'as':_0x62b1('0x16a')});db[_0x62b1('0x16e')][_0x62b1('0x12b')](db[_0x62b1('0x45')],{'as':_0x62b1('0x17d'),'foreignKey':_0x62b1('0x176')});db[_0x62b1('0x16e')][_0x62b1('0x12b')](db['MailAccount'],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x16d')});db[_0x62b1('0x16e')][_0x62b1('0x12b')](db[_0x62b1('0x145')],{'as':_0x62b1('0x145'),'foreignKey':_0x62b1('0x17e')});db[_0x62b1('0x16e')][_0x62b1('0x12b')](db['ChatOfflineMessage'],{'as':_0x62b1('0x6d'),'foreignKey':'ChatOfflineMessageId'});db[_0x62b1('0x48')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'onDelete':_0x62b1('0x17f')});db['MailApplication'][_0x62b1('0x12b')](db[_0x62b1('0x13a')],{'onDelete':_0x62b1('0x17f')});db['MailApplication'][_0x62b1('0x12b')](db[_0x62b1('0x41')],{'onDelete':_0x62b1('0x17f')});db['MailApplication']['belongsTo'](db[_0x62b1('0x86')],{'onDelete':_0x62b1('0x17f'),'foreignKey':_0x62b1('0x15e')});db[_0x62b1('0x48')][_0x62b1('0x12b')](db['Tag'],{'onDelete':_0x62b1('0x17f'),'foreignKey':_0x62b1('0x180')});db['MailQueueReport'][_0x62b1('0x12b')](db['MailAccount'],{});db[_0x62b1('0x49')][_0x62b1('0x12b')](db['CmList'],{'as':'List','foreignKey':_0x62b1('0x172')});db['MailQueueReport'][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'as':_0x62b1('0x16a'),'foreignKey':_0x62b1('0x16b')});db[_0x62b1('0x49')][_0x62b1('0x12b')](db[_0x62b1('0x45')],{});db['MailQueueReport'][_0x62b1('0x12b')](db[_0x62b1('0x16e')],{});db[_0x62b1('0x49')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{});db[_0x62b1('0x49')][_0x62b1('0x12b')](db[_0x62b1('0x13a')],{});db[_0x62b1('0x4b')][_0x62b1('0x11d')](db[_0x62b1('0x4c')],{'as':_0x62b1('0x181'),'onDelete':_0x62b1('0x11a')});db[_0x62b1('0x4e')][_0x62b1('0x11d')](db[_0x62b1('0x182')],{'as':_0x62b1('0x183'),'foreignKey':_0x62b1('0x184')});db[_0x62b1('0x4e')][_0x62b1('0x11d')](db[_0x62b1('0x81')],{'as':_0x62b1('0x185'),'foreignKey':_0x62b1('0x184')});db['FaxAccount']['hasMany'](db[_0x62b1('0x51')],{'as':_0x62b1('0x186')});db[_0x62b1('0x4e')][_0x62b1('0x11d')](db[_0x62b1('0x4f')],{'as':_0x62b1('0x170')});db[_0x62b1('0x4e')][_0x62b1('0x11d')](db[_0x62b1('0x1b')],{'as':_0x62b1('0x187'),'onDelete':_0x62b1('0x11a')});db['FaxAccount']['hasMany'](db[_0x62b1('0x52')],{'as':_0x62b1('0x16f')});db[_0x62b1('0x4e')][_0x62b1('0x12b')](db[_0x62b1('0x2e')],{'as':_0x62b1('0x2e')});db[_0x62b1('0x4e')][_0x62b1('0x12b')](db[_0x62b1('0xfe')],{'as':_0x62b1('0x171'),'foreignKey':_0x62b1('0x172')});db[_0x62b1('0x4e')][_0x62b1('0x12b')](db[_0x62b1('0x174')],{'as':_0x62b1('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x62b1('0x4e')][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':_0x62b1('0x162'),'through':_0x62b1('0x149')});db[_0x62b1('0x4f')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'onDelete':_0x62b1('0x17f')});db[_0x62b1('0x4f')][_0x62b1('0x12b')](db['FaxQueue'],{'onDelete':_0x62b1('0x17f')});db[_0x62b1('0x4f')][_0x62b1('0x12b')](db[_0x62b1('0x4e')],{'onDelete':_0x62b1('0x17f')});db['FaxApplication']['belongsTo'](db[_0x62b1('0x8f')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x62b1('0x51')][_0x62b1('0x11d')](db['FaxMessage'],{'as':_0x62b1('0x16f'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x188')});db[_0x62b1('0x51')][_0x62b1('0x12b')](db[_0x62b1('0x4e')],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x184')});db[_0x62b1('0x51')][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'as':_0x62b1('0x16a'),'foreignKey':_0x62b1('0x16b')});db[_0x62b1('0x51')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'as':_0x62b1('0x178'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x51')][_0x62b1('0x12d')](db[_0x62b1('0x8f')],{'through':_0x62b1('0x189'),'as':_0x62b1('0x17a')});db[_0x62b1('0x51')][_0x62b1('0x12d')](db[_0x62b1('0x8f')],{'through':_0x62b1('0x189'),'as':'ThroughTags'});db[_0x62b1('0x51')][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0x62b1('0x188')});db[_0x62b1('0x52')][_0x62b1('0x12b')](db['User'],{'onDelete':'cascade','as':_0x62b1('0x14')});db[_0x62b1('0x52')][_0x62b1('0x12b')](db[_0x62b1('0x51')],{'as':_0x62b1('0x17d'),'foreignKey':_0x62b1('0x188')});db[_0x62b1('0x52')][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'onDelete':'cascade','as':_0x62b1('0x16a')});db[_0x62b1('0x52')][_0x62b1('0x12b')](db[_0x62b1('0x17c')],{'as':_0x62b1('0x17c'),'foreignKey':_0x62b1('0x18a')});db[_0x62b1('0x52')][_0x62b1('0x12b')](db[_0x62b1('0x4e')],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x184')});db['FaxQueue'][_0x62b1('0x12d')](db['User'],{'as':_0x62b1('0x162'),'through':'UserFaxQueue'});db['FaxQueue'][_0x62b1('0x12d')](db['Team'],{'through':'team_has_fax_queues','as':_0x62b1('0x164')});db['FaxQueueReport'][_0x62b1('0x12b')](db[_0x62b1('0x4e')],{});db[_0x62b1('0x55')][_0x62b1('0x12b')](db[_0x62b1('0xfe')],{'as':_0x62b1('0x171'),'foreignKey':_0x62b1('0x172')});db[_0x62b1('0x55')][_0x62b1('0x12b')](db['CmContact'],{'as':_0x62b1('0x16a'),'foreignKey':_0x62b1('0x16b')});db[_0x62b1('0x55')][_0x62b1('0x12b')](db[_0x62b1('0x51')],{});db[_0x62b1('0x55')][_0x62b1('0x12b')](db[_0x62b1('0x52')],{});db[_0x62b1('0x55')]['belongsTo'](db[_0x62b1('0x14')],{});db[_0x62b1('0x55')][_0x62b1('0x12b')](db[_0x62b1('0x54')],{});db[_0x62b1('0x56')][_0x62b1('0x11d')](db[_0x62b1('0x182')],{'as':_0x62b1('0x183'),'foreignKey':_0x62b1('0x18b')});db['SmsAccount'][_0x62b1('0x11d')](db[_0x62b1('0x81')],{'as':_0x62b1('0x185'),'foreignKey':_0x62b1('0x18b')});db['SmsAccount'][_0x62b1('0x11d')](db[_0x62b1('0x18c')],{'as':_0x62b1('0x16f'),'foreignKey':'SmsAccountId'});db[_0x62b1('0x56')][_0x62b1('0x11d')](db[_0x62b1('0x5a')],{'as':_0x62b1('0x186')});db[_0x62b1('0x56')][_0x62b1('0x11d')](db[_0x62b1('0x58')],{'as':_0x62b1('0x170')});db[_0x62b1('0x56')][_0x62b1('0x12b')](db[_0x62b1('0xfe')],{'as':_0x62b1('0x171'),'foreignKey':_0x62b1('0x172')});db['SmsAccount'][_0x62b1('0x12b')](db[_0x62b1('0x174')],{'as':'mandatoryDispositionPause','foreignKey':_0x62b1('0x160')});db['SmsAccount'][_0x62b1('0x12d')](db['User'],{'as':_0x62b1('0x162'),'through':_0x62b1('0x18d')});db[_0x62b1('0x58')]['belongsTo'](db[_0x62b1('0x14')],{'onDelete':'restrict'});db[_0x62b1('0x58')][_0x62b1('0x12b')](db['SmsQueue'],{'onDelete':_0x62b1('0x17f')});db[_0x62b1('0x58')][_0x62b1('0x12b')](db[_0x62b1('0x56')],{'onDelete':_0x62b1('0x17f')});db[_0x62b1('0x58')][_0x62b1('0x12b')](db[_0x62b1('0x86')],{'onDelete':_0x62b1('0x17f'),'foreignKey':'IntervalId'});db[_0x62b1('0x58')]['belongsTo'](db[_0x62b1('0x8f')],{'onDelete':_0x62b1('0x17f'),'foreignKey':_0x62b1('0x180')});db[_0x62b1('0x5a')][_0x62b1('0x11d')](db[_0x62b1('0x18c')],{'as':_0x62b1('0x16f'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x18e')});db[_0x62b1('0x5a')][_0x62b1('0x12b')](db[_0x62b1('0x56')],{'as':'Account','foreignKey':_0x62b1('0x18b')});db[_0x62b1('0x5a')][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'as':_0x62b1('0x16a'),'foreignKey':_0x62b1('0x16b')});db['SmsInteraction'][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'as':_0x62b1('0x178'),'foreignKey':_0x62b1('0x11b')});db['SmsInteraction'][_0x62b1('0x12d')](db[_0x62b1('0x8f')],{'through':'sms_interaction_has_tags','as':_0x62b1('0x17a')});db[_0x62b1('0x5a')][_0x62b1('0x12d')](db[_0x62b1('0x8f')],{'through':_0x62b1('0x18f'),'as':'ThroughTags'});db[_0x62b1('0x5a')][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':_0x62b1('0x17b'),'through':_0x62b1('0x137'),'foreignKey':'SmsInteractionId'});db[_0x62b1('0x18c')][_0x62b1('0x12b')](db['User'],{'as':'User'});db[_0x62b1('0x18c')][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'onDelete':_0x62b1('0x11a'),'as':_0x62b1('0x16a')});db['SmsMessage']['belongsTo'](db[_0x62b1('0x5a')],{'onDelete':'cascade','as':_0x62b1('0x17d'),'foreignKey':_0x62b1('0x18e')});db[_0x62b1('0x18c')][_0x62b1('0x12b')](db[_0x62b1('0x56')],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x18b')});db[_0x62b1('0x13e')][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':_0x62b1('0x162'),'through':_0x62b1('0x38'),'foreignKey':_0x62b1('0x190')});db[_0x62b1('0x13e')][_0x62b1('0x12d')](db[_0x62b1('0xeb')],{'through':_0x62b1('0x191'),'as':_0x62b1('0x164')});db[_0x62b1('0x5d')][_0x62b1('0x11d')](db['Disposition'],{'as':_0x62b1('0x183'),'foreignKey':_0x62b1('0x192')});db[_0x62b1('0x5d')][_0x62b1('0x11d')](db[_0x62b1('0x81')],{'as':_0x62b1('0x185'),'foreignKey':_0x62b1('0x192')});db[_0x62b1('0x5d')]['hasMany'](db[_0x62b1('0x122')],{'as':_0x62b1('0x186'),'foreignKey':'OpenchannelAccountId'});db[_0x62b1('0x5d')][_0x62b1('0x11d')](db[_0x62b1('0x62')],{'as':_0x62b1('0x16f'),'foreignKey':_0x62b1('0x192')});db[_0x62b1('0x5d')][_0x62b1('0x11d')](db[_0x62b1('0x5f')],{'as':_0x62b1('0x170'),'foreignKey':_0x62b1('0x192')});db[_0x62b1('0x5d')][_0x62b1('0x12b')](db['CmList'],{'as':_0x62b1('0x171'),'foreignKey':'ListId'});db['OpenchannelAccount']['belongsTo'](db[_0x62b1('0x174')],{'as':_0x62b1('0x15f'),'foreignKey':_0x62b1('0x160')});db['OpenchannelAccount'][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':_0x62b1('0x162'),'through':_0x62b1('0x14d')});db[_0x62b1('0x5f')]['belongsTo'](db[_0x62b1('0x14')],{'onDelete':_0x62b1('0x17f')});db[_0x62b1('0x5f')]['belongsTo'](db[_0x62b1('0x63')],{'onDelete':_0x62b1('0x17f'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0x62b1('0x12b')](db['OpenchannelAccount'],{'onDelete':_0x62b1('0x17f'),'foreignKey':_0x62b1('0x192')});db[_0x62b1('0x5f')][_0x62b1('0x12b')](db[_0x62b1('0x86')],{'onDelete':_0x62b1('0x17f'),'foreignKey':_0x62b1('0x15e')});db[_0x62b1('0x5f')][_0x62b1('0x12b')](db[_0x62b1('0x8f')],{'onDelete':'restrict','foreignKey':_0x62b1('0x180')});db[_0x62b1('0x122')][_0x62b1('0x11d')](db[_0x62b1('0x62')],{'as':_0x62b1('0x16f'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x62b1('0x122')][_0x62b1('0x12b')](db[_0x62b1('0x5d')],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x192')});db[_0x62b1('0x122')][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'as':_0x62b1('0x16a'),'foreignKey':_0x62b1('0x16b')});db['OpenchannelInteraction'][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'as':'Owner','foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x122')][_0x62b1('0x12d')](db[_0x62b1('0x8f')],{'through':_0x62b1('0x193'),'as':'Tags'});db[_0x62b1('0x122')]['belongsToMany'](db[_0x62b1('0x8f')],{'through':_0x62b1('0x193'),'as':_0x62b1('0x194')});db[_0x62b1('0x122')][_0x62b1('0x12d')](db['User'],{'as':_0x62b1('0x17b'),'through':_0x62b1('0x138'),'foreignKey':_0x62b1('0x195')});db[_0x62b1('0x62')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'onDelete':_0x62b1('0x11a'),'as':_0x62b1('0x14')});db[_0x62b1('0x62')][_0x62b1('0x12b')](db['CmContact'],{'onDelete':'cascade','as':_0x62b1('0x16a')});db['OpenchannelMessage'][_0x62b1('0x12b')](db['OpenchannelInteraction'],{'onDelete':_0x62b1('0x11a'),'as':_0x62b1('0x17d'),'foreignKey':_0x62b1('0x195')});db[_0x62b1('0x62')][_0x62b1('0x12b')](db[_0x62b1('0x17c')],{'as':'Attachment','foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x62b1('0x12b')](db[_0x62b1('0x5d')],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x192')});db[_0x62b1('0x63')][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':_0x62b1('0x162'),'through':_0x62b1('0x3a'),'foreignKey':_0x62b1('0x196')});db[_0x62b1('0x63')]['belongsToMany'](db[_0x62b1('0xeb')],{'through':'team_has_openchannel_queues','as':_0x62b1('0x164')});db['ChatWebsite'][_0x62b1('0x11d')](db['Disposition'],{'as':_0x62b1('0x183'),'foreignKey':'ChatWebsiteId'});db[_0x62b1('0x145')][_0x62b1('0x11d')](db[_0x62b1('0x81')],{'as':_0x62b1('0x185'),'foreignKey':_0x62b1('0x17e')});db[_0x62b1('0x145')]['hasMany'](db[_0x62b1('0x71')],{'as':_0x62b1('0x197')});db[_0x62b1('0x145')][_0x62b1('0x11d')](db['ChatInteraction'],{'as':_0x62b1('0x186')});db[_0x62b1('0x145')]['hasMany'](db[_0x62b1('0x68')],{'as':'Applications'});db['ChatWebsite'][_0x62b1('0x11d')](db[_0x62b1('0x6b')],{'as':_0x62b1('0x16f')});db[_0x62b1('0x145')][_0x62b1('0x12b')](db[_0x62b1('0xfe')],{'as':_0x62b1('0x171'),'foreignKey':_0x62b1('0x172')});db[_0x62b1('0x145')][_0x62b1('0x12b')](db[_0x62b1('0x86')],{'as':_0x62b1('0x86'),'foreignKey':_0x62b1('0x15e')});db['ChatWebsite']['belongsTo'](db['MailAccount'],{'as':_0x62b1('0x41'),'foreignKey':'MailAccountId'});db['ChatWebsite']['belongsTo'](db[_0x62b1('0x174')],{'as':_0x62b1('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x62b1('0x145')][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':_0x62b1('0x162'),'through':_0x62b1('0x147')});db[_0x62b1('0x66')][_0x62b1('0x12b')](db[_0x62b1('0x5d')],{});db[_0x62b1('0x66')][_0x62b1('0x12b')](db['CmList'],{'as':_0x62b1('0x171'),'foreignKey':_0x62b1('0x172')});db['OpenchannelQueueReport'][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'as':_0x62b1('0x16a'),'foreignKey':_0x62b1('0x16b')});db['OpenchannelQueueReport'][_0x62b1('0x12b')](db[_0x62b1('0x122')],{});db[_0x62b1('0x66')]['belongsTo'](db[_0x62b1('0x62')],{});db[_0x62b1('0x66')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{});db[_0x62b1('0x66')][_0x62b1('0x12b')](db['OpenchannelQueue'],{});db[_0x62b1('0x68')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'as':'Agent','foreignKey':_0x62b1('0x11b'),'onDelete':_0x62b1('0x17f')});db[_0x62b1('0x68')][_0x62b1('0x12b')](db[_0x62b1('0x6e')],{'as':_0x62b1('0x198'),'foreignKey':_0x62b1('0x199'),'onDelete':_0x62b1('0x17f')});db[_0x62b1('0x68')][_0x62b1('0x12b')](db[_0x62b1('0x145')],{'as':_0x62b1('0x19a'),'foreignKey':_0x62b1('0x17e'),'onDelete':_0x62b1('0x17f')});db['ChatApplication']['belongsTo'](db[_0x62b1('0x8f')],{'onDelete':_0x62b1('0x17f'),'foreignKey':_0x62b1('0x180')});db[_0x62b1('0x124')][_0x62b1('0x11d')](db['ChatMessage'],{'as':_0x62b1('0x16f'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x19b')});db[_0x62b1('0x124')][_0x62b1('0x12b')](db[_0x62b1('0x145')],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x17e')});db[_0x62b1('0x124')][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'as':'Contact','foreignKey':'ContactId'});db[_0x62b1('0x124')]['belongsTo'](db[_0x62b1('0x14')],{'as':_0x62b1('0x178'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x124')]['belongsToMany'](db[_0x62b1('0x8f')],{'through':_0x62b1('0x19c'),'as':'Tags'});db[_0x62b1('0x124')]['belongsToMany'](db[_0x62b1('0x8f')],{'through':'chat_interaction_has_tags','as':_0x62b1('0x194')});db[_0x62b1('0x124')][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':_0x62b1('0x17b'),'through':'user_has_chat_interactions','foreignKey':_0x62b1('0x19b')});db['ChatMessage'][_0x62b1('0x12b')](db['User'],{'onDelete':'cascade','as':_0x62b1('0x14')});db[_0x62b1('0x6b')]['belongsTo'](db['CmContact'],{'onDelete':_0x62b1('0x11a'),'as':_0x62b1('0x16a'),'foreignKey':_0x62b1('0x16b')});db[_0x62b1('0x6b')][_0x62b1('0x12b')](db[_0x62b1('0x124')],{'onDelete':_0x62b1('0x11a'),'as':_0x62b1('0x17d'),'foreignKey':_0x62b1('0x19b')});db['ChatMessage'][_0x62b1('0x12b')](db[_0x62b1('0x17c')],{'as':_0x62b1('0x17c'),'foreignKey':_0x62b1('0x18a')});db['ChatMessage']['belongsTo'](db[_0x62b1('0x145')],{'as':_0x62b1('0x177'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x62b1('0x11d')](db[_0x62b1('0x17c')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x62b1('0x11a'),'hooks':!![]});db['ChatOfflineMessage'][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'onDelete':_0x62b1('0x11a'),'as':'Contact','foreignKey':'ContactId'});db[_0x62b1('0x6d')]['belongsTo'](db[_0x62b1('0x145')],{'as':'Account','foreignKey':_0x62b1('0x17e')});db[_0x62b1('0x6e')][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':'Agents','through':_0x62b1('0x13d'),'hooks':!![]});db[_0x62b1('0x6e')][_0x62b1('0x12d')](db['Team'],{'through':_0x62b1('0x19d'),'as':_0x62b1('0x164')});db[_0x62b1('0x70')]['hasMany'](db[_0x62b1('0xd6')],{'as':_0x62b1('0x16f'),'foreignKey':_0x62b1('0x19e'),'onDelete':_0x62b1('0x11a')});db[_0x62b1('0x70')]['belongsToMany'](db[_0x62b1('0x14')],{'as':_0x62b1('0x19f'),'through':_0x62b1('0x12f')});db[_0x62b1('0x71')][_0x62b1('0x12b')](db[_0x62b1('0x145')],{'as':_0x62b1('0x19a'),'foreignKey':_0x62b1('0x17e')});db[_0x62b1('0x72')][_0x62b1('0x11d')](db[_0x62b1('0x73')],{'as':_0x62b1('0x130'),'foreignKey':'CompanyId'});db['CmContact'][_0x62b1('0x11d')](db[_0x62b1('0x93')],{'as':_0x62b1('0x1a0'),'foreignKey':_0x62b1('0x1a1')});db[_0x62b1('0x73')][_0x62b1('0x11d')](db['CmHopper'],{'as':_0x62b1('0x157'),'foreignKey':_0x62b1('0x16b')});db[_0x62b1('0x73')][_0x62b1('0x11d')](db[_0x62b1('0x77')],{'as':_0x62b1('0x120'),'foreignKey':_0x62b1('0x16b')});db[_0x62b1('0x73')][_0x62b1('0x11d')](db[_0x62b1('0x79')],{'as':_0x62b1('0x159'),'foreignKey':_0x62b1('0x16b')});db[_0x62b1('0x73')][_0x62b1('0x11d')](db[_0x62b1('0x7b')],{'as':_0x62b1('0x7b'),'foreignKey':'ContactId'});db[_0x62b1('0x73')][_0x62b1('0x11d')](db[_0x62b1('0xdb')],{'as':_0x62b1('0x1a2'),'foreignKey':_0x62b1('0x16b')});db['CmContact'][_0x62b1('0x11d')](db[_0x62b1('0x122')],{'as':_0x62b1('0x123'),'foreignKey':_0x62b1('0x16b'),'onDelete':_0x62b1('0x17f')});db[_0x62b1('0x73')][_0x62b1('0x11d')](db['ChatInteraction'],{'as':_0x62b1('0x125'),'foreignKey':_0x62b1('0x16b'),'onDelete':_0x62b1('0x17f')});db[_0x62b1('0x73')][_0x62b1('0x11d')](db[_0x62b1('0x5a')],{'as':_0x62b1('0x126'),'foreignKey':_0x62b1('0x16b'),'onDelete':_0x62b1('0x17f')});db['CmContact']['hasMany'](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x62b1('0x16b'),'onDelete':_0x62b1('0x17f')});db['CmContact'][_0x62b1('0x11d')](db[_0x62b1('0x45')],{'as':_0x62b1('0x133'),'foreignKey':_0x62b1('0x16b'),'onDelete':_0x62b1('0x17f')});db[_0x62b1('0x73')][_0x62b1('0x12b')](db[_0x62b1('0x72')],{'as':_0x62b1('0x1a3'),'foreignKey':'CompanyId'});db[_0x62b1('0x73')][_0x62b1('0x12b')](db['CmList'],{'as':_0x62b1('0x171'),'foreignKey':'ListId','onDelete':_0x62b1('0x11a')});db['CmContact'][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':_0x62b1('0x17b'),'through':_0x62b1('0x131')});db[_0x62b1('0x73')]['belongsToMany'](db[_0x62b1('0x8f')],{'as':_0x62b1('0x17a'),'through':_0x62b1('0x1a4')});db[_0x62b1('0x73')][_0x62b1('0x12d')](db[_0x62b1('0x8f')],{'through':_0x62b1('0x1a4'),'as':'ThroughTags'});db[_0x62b1('0x74')][_0x62b1('0x11d')](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0x62b1('0x1a5')});db[_0x62b1('0x74')][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'as':'Contact','foreignKey':_0x62b1('0x16b'),'onDelete':_0x62b1('0x11a')});db[_0x62b1('0x74')][_0x62b1('0x12b')](db[_0x62b1('0xfe')],{'as':'List','foreignKey':'ListId','onDelete':_0x62b1('0x11a')});db['CmHopper'][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'as':_0x62b1('0x1a6'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x74')][_0x62b1('0x12b')](db[_0x62b1('0x156')],{'as':_0x62b1('0x198'),'foreignKey':_0x62b1('0x158'),'onDelete':_0x62b1('0x11a')});db[_0x62b1('0x74')][_0x62b1('0x12b')](db['Campaign'],{'as':_0x62b1('0xef'),'foreignKey':_0x62b1('0x1a7'),'onDelete':_0x62b1('0x11a')});db[_0x62b1('0x74')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'as':'Owner','foreignKey':_0x62b1('0x1a8')});db[_0x62b1('0x15a')]['belongsTo'](db[_0x62b1('0x73')],{'as':_0x62b1('0x16a'),'foreignKey':_0x62b1('0x16b'),'onDelete':_0x62b1('0x11a')});db[_0x62b1('0x15a')][_0x62b1('0x12b')](db[_0x62b1('0xfe')],{'as':_0x62b1('0x171'),'foreignKey':'ListId','onDelete':_0x62b1('0x11a')});db[_0x62b1('0x15a')][_0x62b1('0x12b')](db[_0x62b1('0x156')],{'as':_0x62b1('0x198'),'foreignKey':_0x62b1('0x158'),'onDelete':_0x62b1('0x11a')});db[_0x62b1('0x15a')]['belongsTo'](db[_0x62b1('0xef')],{'as':_0x62b1('0xef'),'foreignKey':_0x62b1('0x1a7'),'onDelete':_0x62b1('0x11a')});db[_0x62b1('0x7f')][_0x62b1('0x11d')](db[_0x62b1('0x84')],{'as':{'plural':_0x62b1('0x1a9'),'singular':_0x62b1('0x1aa')},'foreignKey':_0x62b1('0x1ab'),'onDelete':_0x62b1('0x11a'),'hooks':!![]});db[_0x62b1('0x7f')][_0x62b1('0x11d')](db[_0x62b1('0x84')],{'as':{'plural':_0x62b1('0x1ac'),'singular':_0x62b1('0x1ad')},'foreignKey':_0x62b1('0x1ae'),'onDelete':_0x62b1('0x11a'),'hooks':!![]});db['Automation'][_0x62b1('0x11d')](db[_0x62b1('0x7d')],{'as':'Actions','foreignKey':_0x62b1('0x1af'),'onDelete':_0x62b1('0x11a'),'hooks':!![]});db[_0x62b1('0x182')][_0x62b1('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x62b1('0x1b0'),'onDelete':_0x62b1('0x11a')});db['Interval'][_0x62b1('0x11d')](db[_0x62b1('0x86')],{'as':'Intervals','foreignKey':_0x62b1('0x15e'),'onDelete':_0x62b1('0x11a'),'hooks':!![],'required':![]});db[_0x62b1('0x86')]['hasMany'](db['VoiceExtension'],{'as':_0x62b1('0x11f'),'foreignKey':_0x62b1('0x15e'),'onDelete':_0x62b1('0x17f')});db['Interval'][_0x62b1('0x11d')](db[_0x62b1('0x48')],{'as':_0x62b1('0x1b1'),'foreignKey':_0x62b1('0x15e')});db[_0x62b1('0x86')][_0x62b1('0x11d')](db[_0x62b1('0x68')],{'as':_0x62b1('0x1b2'),'foreignKey':_0x62b1('0x15e')});db[_0x62b1('0x86')][_0x62b1('0x11d')](db[_0x62b1('0x4f')],{'as':_0x62b1('0x1b3'),'foreignKey':_0x62b1('0x15e')});db[_0x62b1('0x86')]['hasMany'](db[_0x62b1('0x58')],{'as':_0x62b1('0x1b4'),'foreignKey':_0x62b1('0x15e')});db[_0x62b1('0x8c')][_0x62b1('0x12b')](db[_0x62b1('0x41')],{});db[_0x62b1('0x8c')][_0x62b1('0x12b')](db[_0x62b1('0x1b5')],{'foreignKey':'DefaultReportId'});db[_0x62b1('0x8c')]['belongsTo'](db[_0x62b1('0x1b6')],{'foreignKey':_0x62b1('0x1b7')});db[_0x62b1('0x1b8')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0x62b1('0x1b9'),'through':_0x62b1('0x155'),'onDelete':'restrict'});db[_0x62b1('0x8f')][_0x62b1('0x12d')](db[_0x62b1('0x73')],{'through':_0x62b1('0x1a4')});db[_0x62b1('0x8f')][_0x62b1('0x12d')](db[_0x62b1('0x124')],{'through':'chat_interaction_has_tags'});db[_0x62b1('0x8f')]['belongsToMany'](db[_0x62b1('0x45')],{'through':_0x62b1('0x179')});db[_0x62b1('0x8f')]['belongsToMany'](db[_0x62b1('0x5a')],{'through':'sms_interaction_has_tags'});db[_0x62b1('0x8f')]['belongsToMany'](db[_0x62b1('0x51')],{'through':_0x62b1('0x189')});db[_0x62b1('0x8f')]['belongsToMany'](db[_0x62b1('0x122')],{'through':_0x62b1('0x193')});db[_0x62b1('0x8f')]['belongsToMany'](db[_0x62b1('0x10d')],{'through':_0x62b1('0x1ba')});db['CmContactHasItem']['belongsTo'](db[_0x62b1('0x91')],{'as':'ItemType','foreignKey':'ItemTypeId'});db['CmHopperAdditionalPhone']['belongsTo'](db[_0x62b1('0x74')],{'as':_0x62b1('0x1bb'),'foreignKey':_0x62b1('0x1a5')});db[_0x62b1('0x99')][_0x62b1('0x11d')](db[_0x62b1('0x84')],{'as':{'plural':_0x62b1('0x1bc'),'singular':_0x62b1('0x1bd')},'foreignKey':_0x62b1('0x1be'),'onDelete':'cascade','hooks':!![]});db[_0x62b1('0x99')][_0x62b1('0x11d')](db[_0x62b1('0x84')],{'as':{'plural':_0x62b1('0x1bf'),'singular':'AnyCondition'},'foreignKey':_0x62b1('0x1c0'),'onDelete':'cascade','hooks':!![]});db[_0x62b1('0x99')][_0x62b1('0x11d')](db[_0x62b1('0x7d')],{'as':'Actions','foreignKey':_0x62b1('0x1c1'),'onDelete':_0x62b1('0x11a'),'hooks':!![]});db[_0x62b1('0x1b6')][_0x62b1('0x11d')](db[_0x62b1('0xa2')],{'as':_0x62b1('0x1c2'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x62b1('0x1b5')][_0x62b1('0x11d')](db[_0x62b1('0xa2')],{'as':_0x62b1('0x1c2'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x1c3')});db[_0x62b1('0xa1')][_0x62b1('0x11d')](db[_0x62b1('0xa2')],{'as':_0x62b1('0x1c2'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x1c4')});db['AnalyticFieldReport']['belongsTo'](db[_0x62b1('0xa1')],{'foreignKey':_0x62b1('0x1c4')});db[_0x62b1('0xa6')][_0x62b1('0x11d')](db[_0x62b1('0xa7')],{'as':_0x62b1('0x1c5'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x1c6')});db[_0x62b1('0xa7')][_0x62b1('0x11d')](db[_0x62b1('0xa9')],{'as':_0x62b1('0x1c7'),'onDelete':'cascade','foreignKey':_0x62b1('0x1c8')});db['SalesforceConfiguration'][_0x62b1('0x11d')](db[_0x62b1('0xa9')],{'as':_0x62b1('0x1c9'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x1ca')});db[_0x62b1('0xa7')]['hasMany'](db[_0x62b1('0xa9')],{'as':_0x62b1('0x1c2'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x1cb')});db[_0x62b1('0xa7')][_0x62b1('0x12b')](db[_0x62b1('0xa6')],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x1c6')});db['SalesforceField'][_0x62b1('0x11d')](db[_0x62b1('0xa9')],{'as':_0x62b1('0x1cc'),'foreignKey':_0x62b1('0x1c8')});db[_0x62b1('0xa9')][_0x62b1('0x11d')](db[_0x62b1('0xa9')],{'as':_0x62b1('0x1cd'),'foreignKey':'DescriptionId'});db[_0x62b1('0xa9')][_0x62b1('0x11d')](db['SalesforceField'],{'as':_0x62b1('0x1ce'),'foreignKey':_0x62b1('0x1cb')});db[_0x62b1('0xa9')][_0x62b1('0x12b')](db[_0x62b1('0x1cf')],{'as':_0x62b1('0x1cf'),'foreignKey':_0x62b1('0x1d0')});db['SugarcrmAccount'][_0x62b1('0x11d')](db['SugarcrmConfiguration'],{'as':_0x62b1('0x1c5'),'onDelete':_0x62b1('0x11a'),'foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0x62b1('0x11d')](db[_0x62b1('0xad')],{'as':'Subjects','onDelete':_0x62b1('0x11a'),'foreignKey':'SubjectId'});db[_0x62b1('0x1d1')][_0x62b1('0x11d')](db[_0x62b1('0xad')],{'as':_0x62b1('0x1c9'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x1ca')});db['SugarcrmConfiguration'][_0x62b1('0x11d')](db[_0x62b1('0xad')],{'as':'Fields','onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x1cb')});db[_0x62b1('0x1d1')]['belongsTo'](db[_0x62b1('0xab')],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x1c6')});db[_0x62b1('0xad')]['hasMany'](db[_0x62b1('0xad')],{'as':_0x62b1('0x1cc'),'foreignKey':_0x62b1('0x1c8')});db[_0x62b1('0xad')][_0x62b1('0x11d')](db[_0x62b1('0xad')],{'as':_0x62b1('0x1cd'),'foreignKey':_0x62b1('0x1ca')});db['SugarcrmField'][_0x62b1('0x11d')](db[_0x62b1('0xad')],{'as':_0x62b1('0x1ce'),'foreignKey':_0x62b1('0x1cb')});db['SugarcrmField'][_0x62b1('0x12b')](db[_0x62b1('0x1cf')],{'as':_0x62b1('0x1cf'),'foreignKey':_0x62b1('0x1d0')});db[_0x62b1('0xaf')][_0x62b1('0x11d')](db[_0x62b1('0xb0')],{'as':_0x62b1('0x1c5'),'onDelete':_0x62b1('0x11a'),'foreignKey':'AccountId'});db[_0x62b1('0xb0')][_0x62b1('0x11d')](db['DeskField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x62b1('0x1c8')});db[_0x62b1('0xb0')][_0x62b1('0x11d')](db[_0x62b1('0xb2')],{'as':_0x62b1('0x1c9'),'onDelete':_0x62b1('0x11a'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x62b1('0x11d')](db[_0x62b1('0xb2')],{'as':'Fields','onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x1cb')});db[_0x62b1('0xb0')][_0x62b1('0x12b')](db[_0x62b1('0xaf')],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x1c6')});db[_0x62b1('0xb0')]['belongsToMany'](db[_0x62b1('0x8f')],{'through':_0x62b1('0x1d2')});db[_0x62b1('0xb2')]['hasMany'](db[_0x62b1('0xb2')],{'as':_0x62b1('0x1cc'),'foreignKey':_0x62b1('0x1c8')});db[_0x62b1('0xb2')][_0x62b1('0x11d')](db[_0x62b1('0xb2')],{'as':_0x62b1('0x1cd'),'foreignKey':_0x62b1('0x1ca')});db[_0x62b1('0xb2')][_0x62b1('0x11d')](db[_0x62b1('0xb2')],{'as':_0x62b1('0x1ce'),'foreignKey':_0x62b1('0x1cb')});db['DeskField'][_0x62b1('0x12b')](db['Variable'],{'as':_0x62b1('0x1cf'),'foreignKey':_0x62b1('0x1d0')});db['ZohoAccount'][_0x62b1('0x11d')](db[_0x62b1('0xb5')],{'as':_0x62b1('0x1c5'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x1c6')});db['ZohoConfiguration'][_0x62b1('0x11d')](db[_0x62b1('0xb7')],{'as':_0x62b1('0x1c7'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x62b1('0xb5')][_0x62b1('0x11d')](db[_0x62b1('0xb7')],{'as':_0x62b1('0x1c9'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x1ca')});db[_0x62b1('0xb5')]['hasMany'](db[_0x62b1('0xb7')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x62b1('0xb5')][_0x62b1('0x12b')](db['ZohoAccount'],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x1c6')});db[_0x62b1('0xb7')][_0x62b1('0x11d')](db[_0x62b1('0xb7')],{'as':'Subject','foreignKey':'SubjectId'});db['ZohoField'][_0x62b1('0x11d')](db['ZohoField'],{'as':_0x62b1('0x1cd'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x62b1('0x11d')](db[_0x62b1('0xb7')],{'as':_0x62b1('0x1ce'),'foreignKey':_0x62b1('0x1cb')});db[_0x62b1('0xb7')]['belongsTo'](db[_0x62b1('0x1cf')],{'as':_0x62b1('0x1cf'),'foreignKey':_0x62b1('0x1d0')});db['ZendeskAccount'][_0x62b1('0x11d')](db[_0x62b1('0xba')],{'as':'Configurations','onDelete':_0x62b1('0x11a'),'foreignKey':'AccountId'});db[_0x62b1('0xba')][_0x62b1('0x11d')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x62b1('0x1c8')});db[_0x62b1('0xba')][_0x62b1('0x11d')](db['ZendeskField'],{'as':_0x62b1('0x1c9'),'foreignKey':_0x62b1('0x1ca')});db[_0x62b1('0xba')]['hasMany'](db[_0x62b1('0xbb')],{'as':'Fields','foreignKey':'FieldId'});db[_0x62b1('0xba')][_0x62b1('0x12b')](db[_0x62b1('0x1d3')],{'as':_0x62b1('0x177'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x62b1('0x12d')](db[_0x62b1('0x8f')],{'through':_0x62b1('0x1d4')});db['ZendeskField'][_0x62b1('0x11d')](db[_0x62b1('0xbb')],{'as':_0x62b1('0x1cc'),'foreignKey':_0x62b1('0x1c8')});db[_0x62b1('0xbb')][_0x62b1('0x11d')](db['ZendeskField'],{'as':_0x62b1('0x1cd'),'foreignKey':_0x62b1('0x1ca')});db[_0x62b1('0xbb')]['hasMany'](db[_0x62b1('0xbb')],{'as':'Field','foreignKey':_0x62b1('0x1cb')});db[_0x62b1('0xbb')][_0x62b1('0x12b')](db['Variable'],{'as':_0x62b1('0x1cf'),'foreignKey':_0x62b1('0x1d0')});db[_0x62b1('0xbd')]['hasMany'](db[_0x62b1('0xbf')],{'as':_0x62b1('0x1c5'),'onDelete':'cascade','foreignKey':_0x62b1('0x1c6')});db['FreshdeskConfiguration'][_0x62b1('0x11d')](db[_0x62b1('0x1d5')],{'as':_0x62b1('0x1c7'),'onDelete':'cascade','foreignKey':_0x62b1('0x1c8')});db[_0x62b1('0xbf')][_0x62b1('0x11d')](db['FreshdeskField'],{'as':_0x62b1('0x1c9'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x1ca')});db[_0x62b1('0xbf')][_0x62b1('0x11d')](db['FreshdeskField'],{'as':_0x62b1('0x1c2'),'onDelete':'cascade','foreignKey':_0x62b1('0x1cb')});db[_0x62b1('0xbf')][_0x62b1('0x12b')](db[_0x62b1('0xbd')],{'as':_0x62b1('0x177'),'foreignKey':'AccountId'});db[_0x62b1('0xbf')][_0x62b1('0x12d')](db[_0x62b1('0x8f')],{'through':_0x62b1('0x1d6')});db[_0x62b1('0x1d5')][_0x62b1('0x11d')](db[_0x62b1('0x1d5')],{'as':_0x62b1('0x1cc'),'foreignKey':_0x62b1('0x1c8')});db[_0x62b1('0x1d5')][_0x62b1('0x11d')](db['FreshdeskField'],{'as':_0x62b1('0x1cd'),'foreignKey':_0x62b1('0x1ca')});db[_0x62b1('0x1d5')][_0x62b1('0x11d')](db['FreshdeskField'],{'as':_0x62b1('0x1ce'),'foreignKey':_0x62b1('0x1cb')});db[_0x62b1('0x1d5')]['belongsTo'](db['Variable'],{'as':_0x62b1('0x1cf'),'foreignKey':_0x62b1('0x1d0')});db['VtigerAccount'][_0x62b1('0x11d')](db[_0x62b1('0x1d7')],{'as':'Configurations','onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x1c6')});db[_0x62b1('0x1d7')]['hasMany'](db[_0x62b1('0x1d8')],{'as':_0x62b1('0x1c7'),'foreignKey':_0x62b1('0x1c8')});db['VtigerConfiguration'][_0x62b1('0x11d')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x62b1('0x1ca')});db['VtigerConfiguration'][_0x62b1('0x11d')](db['VtigerField'],{'as':_0x62b1('0x1c2'),'foreignKey':_0x62b1('0x1cb')});db['VtigerConfiguration']['belongsTo'](db[_0x62b1('0x1d9')],{'as':'Account','foreignKey':_0x62b1('0x1c6')});db[_0x62b1('0x1d8')][_0x62b1('0x11d')](db[_0x62b1('0x1d8')],{'as':_0x62b1('0x1cc'),'foreignKey':_0x62b1('0x1c8')});db['VtigerField']['hasMany'](db[_0x62b1('0x1d8')],{'as':'Description','foreignKey':_0x62b1('0x1ca')});db[_0x62b1('0x1d8')][_0x62b1('0x11d')](db[_0x62b1('0x1d8')],{'as':'Field','foreignKey':'FieldId'});db[_0x62b1('0x1d8')][_0x62b1('0x12b')](db[_0x62b1('0x1cf')],{'as':_0x62b1('0x1cf'),'foreignKey':_0x62b1('0x1d0')});db[_0x62b1('0xc3')][_0x62b1('0x11d')](db['ServicenowConfiguration'],{'as':_0x62b1('0x1c5'),'onDelete':_0x62b1('0x11a'),'foreignKey':'AccountId'});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x62b1('0x1c7'),'foreignKey':_0x62b1('0x1c8')});db[_0x62b1('0x1da')][_0x62b1('0x11d')](db[_0x62b1('0xc6')],{'as':_0x62b1('0x1c9'),'foreignKey':_0x62b1('0x1ca')});db[_0x62b1('0x1da')][_0x62b1('0x11d')](db[_0x62b1('0xc6')],{'as':_0x62b1('0x1c2'),'foreignKey':'FieldId'});db[_0x62b1('0x1da')][_0x62b1('0x12b')](db['ServicenowAccount'],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x1c6')});db[_0x62b1('0xc6')][_0x62b1('0x11d')](db['ServicenowField'],{'as':_0x62b1('0x1cc'),'foreignKey':_0x62b1('0x1c8')});db[_0x62b1('0xc6')][_0x62b1('0x11d')](db[_0x62b1('0xc6')],{'as':_0x62b1('0x1cd'),'foreignKey':_0x62b1('0x1ca')});db['ServicenowField'][_0x62b1('0x11d')](db[_0x62b1('0xc6')],{'as':_0x62b1('0x1ce'),'foreignKey':_0x62b1('0x1cb')});db['ServicenowField'][_0x62b1('0x12b')](db[_0x62b1('0x1cf')],{'as':_0x62b1('0x1cf'),'foreignKey':_0x62b1('0x1d0')});db[_0x62b1('0xc8')][_0x62b1('0x11d')](db[_0x62b1('0xca')],{'as':_0x62b1('0x1c5'),'onDelete':'cascade','foreignKey':_0x62b1('0x1c6')});db['Dynamics365Configuration'][_0x62b1('0x11d')](db[_0x62b1('0xcc')],{'as':_0x62b1('0x1c7'),'onDelete':'cascade','foreignKey':_0x62b1('0x1c8')});db['Dynamics365Configuration'][_0x62b1('0x11d')](db[_0x62b1('0xcc')],{'as':_0x62b1('0x1c9'),'onDelete':_0x62b1('0x11a'),'foreignKey':'DescriptionId'});db[_0x62b1('0xca')][_0x62b1('0x11d')](db[_0x62b1('0xcc')],{'as':_0x62b1('0x1c2'),'onDelete':_0x62b1('0x11a'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x62b1('0x12b')](db[_0x62b1('0xc8')],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x1c6')});db[_0x62b1('0xcc')]['hasMany'](db['Dynamics365Field'],{'as':_0x62b1('0x1cc'),'foreignKey':_0x62b1('0x1c8')});db[_0x62b1('0xcc')]['hasMany'](db[_0x62b1('0xcc')],{'as':'Description','foreignKey':_0x62b1('0x1ca')});db[_0x62b1('0xcc')][_0x62b1('0x11d')](db[_0x62b1('0xcc')],{'as':_0x62b1('0x1ce'),'foreignKey':_0x62b1('0x1cb')});db[_0x62b1('0xcc')]['belongsTo'](db[_0x62b1('0x1cf')],{'as':_0x62b1('0x1cf'),'foreignKey':_0x62b1('0x1d0')});db[_0x62b1('0xce')]['hasMany'](db[_0x62b1('0xd0')],{'as':_0x62b1('0x1c5'),'onDelete':_0x62b1('0x11a'),'foreignKey':'AccountId'});db[_0x62b1('0xd0')]['hasMany'](db[_0x62b1('0xd1')],{'as':_0x62b1('0x1c7'),'foreignKey':_0x62b1('0x1c8')});db[_0x62b1('0xd0')]['hasMany'](db[_0x62b1('0xd1')],{'as':_0x62b1('0x1c9'),'foreignKey':_0x62b1('0x1ca')});db[_0x62b1('0xd0')][_0x62b1('0x11d')](db[_0x62b1('0xd1')],{'as':'Fields','foreignKey':_0x62b1('0x1cb')});db[_0x62b1('0xd0')][_0x62b1('0x12b')](db[_0x62b1('0xce')],{'as':'Account','foreignKey':_0x62b1('0x1c6')});db[_0x62b1('0xd1')][_0x62b1('0x11d')](db[_0x62b1('0xd1')],{'as':_0x62b1('0x1cc'),'foreignKey':_0x62b1('0x1c8')});db[_0x62b1('0xd1')][_0x62b1('0x11d')](db[_0x62b1('0xd1')],{'as':_0x62b1('0x1cd'),'foreignKey':_0x62b1('0x1ca')});db['FreshsalesField'][_0x62b1('0x11d')](db[_0x62b1('0xd1')],{'as':_0x62b1('0x1ce'),'foreignKey':_0x62b1('0x1cb')});db[_0x62b1('0xd1')]['belongsTo'](db[_0x62b1('0x1cf')],{'as':_0x62b1('0x1cf'),'foreignKey':_0x62b1('0x1d0')});db['ChatQueueReport'][_0x62b1('0x12b')](db[_0x62b1('0x145')],{});db[_0x62b1('0xd4')][_0x62b1('0x12b')](db['CmList'],{'as':_0x62b1('0x171'),'foreignKey':_0x62b1('0x172')});db[_0x62b1('0xd4')][_0x62b1('0x12b')](db['CmContact'],{'as':_0x62b1('0x16a'),'foreignKey':_0x62b1('0x16b')});db[_0x62b1('0xd4')]['belongsTo'](db[_0x62b1('0x124')],{});db[_0x62b1('0xd4')]['belongsTo'](db[_0x62b1('0x6b')],{});db[_0x62b1('0xd4')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{});db['ChatQueueReport'][_0x62b1('0x12b')](db[_0x62b1('0x6e')],{});db[_0x62b1('0xd6')]['belongsTo'](db[_0x62b1('0x14')],{'onDelete':_0x62b1('0x11a'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x1db')});db[_0x62b1('0xdb')][_0x62b1('0x11d')](db[_0x62b1('0xd9')],{'foreignKey':_0x62b1('0x1dc'),'onDelete':_0x62b1('0x11a')});db[_0x62b1('0xdb')]['hasMany'](db[_0x62b1('0xd8')],{'foreignKey':_0x62b1('0x1dc'),'onDelete':_0x62b1('0x11a')});db[_0x62b1('0xdd')][_0x62b1('0x12b')](db[_0x62b1('0x56')],{});db[_0x62b1('0xdd')]['belongsTo'](db[_0x62b1('0xfe')],{'as':'List','foreignKey':_0x62b1('0x172')});db['SmsQueueReport'][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'as':'Contact','foreignKey':'ContactId'});db[_0x62b1('0xdd')][_0x62b1('0x12b')](db['SmsInteraction'],{});db[_0x62b1('0xdd')][_0x62b1('0x12b')](db['SmsMessage'],{});db[_0x62b1('0xdd')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{});db['SmsQueueReport'][_0x62b1('0x12b')](db['SmsQueue'],{});db['JscriptyProject'][_0x62b1('0x11d')](db['JscriptySessionReport'],{'foreignKey':_0x62b1('0x1dd')});db[_0x62b1('0xe2')]['hasMany'](db[_0x62b1('0xd9')],{'foreignKey':_0x62b1('0x1dd')});db[_0x62b1('0xe2')][_0x62b1('0x11d')](db[_0x62b1('0xd8')],{'foreignKey':_0x62b1('0x1dd')});db[_0x62b1('0xe6')][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':'Users','through':_0x62b1('0x152')});db[_0x62b1('0xeb')][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':_0x62b1('0x162'),'through':'user_has_teams'});db[_0x62b1('0xeb')][_0x62b1('0x12d')](db[_0x62b1('0x156')],{'through':'TeamVoiceQueue','as':_0x62b1('0x139')});db['Team']['belongsToMany'](db[_0x62b1('0x13a')],{'through':_0x62b1('0x175'),'as':_0x62b1('0x13b')});db[_0x62b1('0xeb')][_0x62b1('0x12d')](db[_0x62b1('0x6e')],{'through':_0x62b1('0x19d'),'as':_0x62b1('0x13c')});db['Team'][_0x62b1('0x12d')](db[_0x62b1('0x54')],{'through':'team_has_fax_queues','as':_0x62b1('0x1de')});db['Team']['belongsToMany'](db[_0x62b1('0x13e')],{'through':_0x62b1('0x191'),'as':'SmsQueues'});db[_0x62b1('0xeb')]['belongsToMany'](db[_0x62b1('0x63')],{'through':_0x62b1('0x1df'),'as':'OpenchannelQueues'});db[_0x62b1('0xeb')][_0x62b1('0x12d')](db[_0x62b1('0x114')],{'through':'team_has_whatsapp_queues','as':_0x62b1('0x141')});db[_0x62b1('0xef')][_0x62b1('0x11d')](db['CmHopper'],{'as':_0x62b1('0x157'),'foreignKey':_0x62b1('0x1a7')});db['Campaign'][_0x62b1('0x11d')](db[_0x62b1('0x77')],{'as':_0x62b1('0x120'),'foreignKey':_0x62b1('0x1a7')});db[_0x62b1('0xef')][_0x62b1('0x11d')](db['CmHopperHistory'],{'as':_0x62b1('0x159'),'foreignKey':_0x62b1('0x1a7')});db[_0x62b1('0xef')][_0x62b1('0x11d')](db[_0x62b1('0x15a')],{'as':_0x62b1('0x15b'),'foreignKey':_0x62b1('0x1a7')});db['Campaign'][_0x62b1('0x12b')](db[_0x62b1('0x2e')],{'as':'Trunk','foreignKey':_0x62b1('0x1e0')});db['Campaign'][_0x62b1('0x12b')](db[_0x62b1('0x2e')],{'as':_0x62b1('0x15c'),'foreignKey':_0x62b1('0x15d')});db[_0x62b1('0xef')][_0x62b1('0x12b')](db[_0x62b1('0x86')],{'as':_0x62b1('0x86'),'foreignKey':_0x62b1('0x15e')});db[_0x62b1('0xef')][_0x62b1('0x12b')](db[_0x62b1('0xe6')],{'as':_0x62b1('0xe6'),'foreignKey':'SquareProjectId'});db['Campaign'][_0x62b1('0x12d')](db[_0x62b1('0xfe')],{'as':_0x62b1('0x132'),'through':_0x62b1('0x1e1')});db[_0x62b1('0xef')][_0x62b1('0x12d')](db[_0x62b1('0xfe')],{'as':_0x62b1('0x165'),'through':_0x62b1('0x1e2')});db[_0x62b1('0x17c')][_0x62b1('0x12b')](db[_0x62b1('0x6d')],{'as':_0x62b1('0x6d'),'foreignKey':'ChatOfflineMessageId'});db[_0x62b1('0xf6')][_0x62b1('0x12b')](db[_0x62b1('0x16e')],{});db[_0x62b1('0xf6')][_0x62b1('0x12b')](db[_0x62b1('0x45')],{});db[_0x62b1('0xf6')][_0x62b1('0x12b')](db[_0x62b1('0x41')],{'foreignKey':_0x62b1('0x1e3'),'as':_0x62b1('0x1e4')});db['MailTransferReport']['belongsTo'](db[_0x62b1('0x14')],{'foreignKey':_0x62b1('0x1e5'),'as':'FromAgent'});db[_0x62b1('0xf6')]['belongsTo'](db[_0x62b1('0x14')],{'foreignKey':_0x62b1('0x1e6'),'as':'ToAgent'});db['MailTransferReport'][_0x62b1('0x12b')](db[_0x62b1('0x13a')],{'foreignKey':'ToMailQueueId','as':_0x62b1('0x1e7')});db['MailTransferReport'][_0x62b1('0x12b')](db['MailAccount'],{'foreignKey':_0x62b1('0x1e8'),'as':_0x62b1('0x1e9')});db[_0x62b1('0xf8')][_0x62b1('0x12b')](db[_0x62b1('0x6b')],{});db['ChatTransferReport'][_0x62b1('0x12b')](db[_0x62b1('0x124')],{});db['ChatTransferReport'][_0x62b1('0x12b')](db['ChatWebsite'],{'foreignKey':_0x62b1('0x1ea'),'as':_0x62b1('0x1e4')});db['ChatTransferReport']['belongsTo'](db[_0x62b1('0x14')],{'foreignKey':_0x62b1('0x1e5'),'as':_0x62b1('0x1eb')});db[_0x62b1('0xf8')]['belongsTo'](db[_0x62b1('0x14')],{'foreignKey':'ToUserId','as':_0x62b1('0x1ec')});db['ChatTransferReport'][_0x62b1('0x12b')](db[_0x62b1('0x6e')],{'foreignKey':_0x62b1('0x1ed'),'as':_0x62b1('0x1e7')});db[_0x62b1('0xf8')][_0x62b1('0x12b')](db[_0x62b1('0x145')],{'foreignKey':_0x62b1('0x1ee'),'as':'ToAccount'});db[_0x62b1('0xfa')][_0x62b1('0x12b')](db['FaxMessage'],{});db['FaxTransferReport'][_0x62b1('0x12b')](db['FaxInteraction'],{});db[_0x62b1('0xfa')][_0x62b1('0x12b')](db[_0x62b1('0x4e')],{'foreignKey':_0x62b1('0x1ef'),'as':'FromAccount'});db['FaxTransferReport'][_0x62b1('0x12b')](db['User'],{'foreignKey':_0x62b1('0x1e5'),'as':_0x62b1('0x1eb')});db[_0x62b1('0xfa')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'foreignKey':_0x62b1('0x1e6'),'as':_0x62b1('0x1ec')});db[_0x62b1('0xfa')]['belongsTo'](db[_0x62b1('0x54')],{'foreignKey':_0x62b1('0x1f0'),'as':_0x62b1('0x1e7')});db[_0x62b1('0xfa')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x62b1('0x1f1'),'as':_0x62b1('0x1e9')});db[_0x62b1('0x1f2')][_0x62b1('0x12b')](db[_0x62b1('0x62')],{});db[_0x62b1('0x1f2')][_0x62b1('0x12b')](db[_0x62b1('0x122')],{});db[_0x62b1('0x1f2')]['belongsTo'](db[_0x62b1('0x5d')],{'foreignKey':_0x62b1('0x1f3'),'as':'FromAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x62b1('0x14')],{'foreignKey':_0x62b1('0x1e5'),'as':_0x62b1('0x1eb')});db[_0x62b1('0x1f2')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'foreignKey':_0x62b1('0x1e6'),'as':'ToAgent'});db[_0x62b1('0x1f2')][_0x62b1('0x12b')](db[_0x62b1('0x63')],{'foreignKey':_0x62b1('0x1f4'),'as':_0x62b1('0x1e7')});db[_0x62b1('0x1f2')][_0x62b1('0x12b')](db[_0x62b1('0x5d')],{'foreignKey':'ToOpenchannelAccountId','as':_0x62b1('0x1e9')});db['SmsTransferReport'][_0x62b1('0x12b')](db[_0x62b1('0x18c')],{});db[_0x62b1('0x1f5')][_0x62b1('0x12b')](db['SmsInteraction'],{});db['SmsTransferReport']['belongsTo'](db['SmsAccount'],{'foreignKey':_0x62b1('0x1f6'),'as':_0x62b1('0x1e4')});db[_0x62b1('0x1f5')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'foreignKey':_0x62b1('0x1e5'),'as':_0x62b1('0x1eb')});db[_0x62b1('0x1f5')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'foreignKey':_0x62b1('0x1e6'),'as':_0x62b1('0x1ec')});db[_0x62b1('0x1f5')][_0x62b1('0x12b')](db['SmsQueue'],{'foreignKey':_0x62b1('0x1f7'),'as':_0x62b1('0x1e7')});db[_0x62b1('0x1f5')][_0x62b1('0x12b')](db[_0x62b1('0x56')],{'foreignKey':_0x62b1('0x1f8'),'as':_0x62b1('0x1e9')});db[_0x62b1('0xfe')][_0x62b1('0x11d')](db[_0x62b1('0x182')],{'as':'Dispositions','foreignKey':_0x62b1('0x172')});db[_0x62b1('0xfe')][_0x62b1('0x11d')](db[_0x62b1('0x1f9')],{'as':'CustomFields','foreignKey':_0x62b1('0x172')});db[_0x62b1('0xfe')][_0x62b1('0x11d')](db[_0x62b1('0x73')],{'as':_0x62b1('0x130'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x172')});db[_0x62b1('0xfe')][_0x62b1('0x11d')](db[_0x62b1('0x77')],{'as':_0x62b1('0x120'),'foreignKey':_0x62b1('0x172')});db[_0x62b1('0xfe')][_0x62b1('0x11d')](db[_0x62b1('0x79')],{'as':'HopperHistory','foreignKey':_0x62b1('0x172')});db['CmList'][_0x62b1('0x11d')](db[_0x62b1('0x7b')],{'as':_0x62b1('0x7b'),'foreignKey':_0x62b1('0x172')});db[_0x62b1('0xfe')][_0x62b1('0x12d')](db[_0x62b1('0x156')],{'as':_0x62b1('0x1fa'),'through':_0x62b1('0x161')});db[_0x62b1('0xfe')][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':_0x62b1('0x162'),'through':_0x62b1('0x142')});db['VoicePrefix']['hasMany'](db[_0x62b1('0x1b')],{'as':_0x62b1('0x11f'),'onDelete':_0x62b1('0x11a')});db[_0x62b1('0x100')][_0x62b1('0x12d')](db['User'],{'as':_0x62b1('0x162'),'through':_0x62b1('0x144')});db[_0x62b1('0x102')][_0x62b1('0x11d')](db[_0x62b1('0x14')],{'as':_0x62b1('0x17b'),'foreignKey':'userProfileId'});db['UserProfile'][_0x62b1('0x11d')](db[_0x62b1('0x104')],{'as':_0x62b1('0x1fb'),'foreignKey':_0x62b1('0x12c'),'onDelete':'cascade'});db[_0x62b1('0x104')][_0x62b1('0x11d')](db[_0x62b1('0x106')],{'as':_0x62b1('0x1fc'),'foreignKey':_0x62b1('0x1fd'),'onDelete':_0x62b1('0x11a')});db['WhatsappAccount'][_0x62b1('0x11d')](db[_0x62b1('0x182')],{'as':_0x62b1('0x183'),'foreignKey':_0x62b1('0x1fe')});db[_0x62b1('0x109')][_0x62b1('0x11d')](db[_0x62b1('0x81')],{'as':_0x62b1('0x185'),'foreignKey':_0x62b1('0x1fe')});db[_0x62b1('0x109')][_0x62b1('0x11d')](db['WhatsappMessage'],{'as':_0x62b1('0x16f'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x62b1('0x11d')](db[_0x62b1('0x10d')],{'as':_0x62b1('0x186')});db['WhatsappAccount'][_0x62b1('0x11d')](db[_0x62b1('0x10b')],{'as':_0x62b1('0x170')});db[_0x62b1('0x109')][_0x62b1('0x12b')](db[_0x62b1('0xfe')],{'as':'List','foreignKey':'ListId'});db[_0x62b1('0x109')][_0x62b1('0x12b')](db[_0x62b1('0x174')],{'as':_0x62b1('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x62b1('0x109')][_0x62b1('0x12d')](db['User'],{'as':'Agents','through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0x62b1('0x12b')](db['User'],{'onDelete':'restrict'});db[_0x62b1('0x10b')]['belongsTo'](db[_0x62b1('0x114')],{'onDelete':_0x62b1('0x17f')});db[_0x62b1('0x10b')][_0x62b1('0x12b')](db[_0x62b1('0x109')],{'onDelete':_0x62b1('0x17f')});db[_0x62b1('0x10b')][_0x62b1('0x12b')](db[_0x62b1('0x86')],{'onDelete':'restrict','foreignKey':_0x62b1('0x15e')});db[_0x62b1('0x10b')][_0x62b1('0x12b')](db[_0x62b1('0x8f')],{'onDelete':'restrict','foreignKey':_0x62b1('0x180')});db[_0x62b1('0x10d')][_0x62b1('0x11d')](db[_0x62b1('0x1ff')],{'as':_0x62b1('0x16f'),'onDelete':_0x62b1('0x11a'),'foreignKey':_0x62b1('0x200')});db[_0x62b1('0x10d')]['belongsTo'](db[_0x62b1('0x109')],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x1fe')});db[_0x62b1('0x10d')][_0x62b1('0x12b')](db[_0x62b1('0x73')],{'as':_0x62b1('0x16a'),'foreignKey':_0x62b1('0x16b')});db['WhatsappInteraction'][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'as':_0x62b1('0x178'),'foreignKey':_0x62b1('0x11b')});db[_0x62b1('0x10d')][_0x62b1('0x12d')](db[_0x62b1('0x8f')],{'through':'whatsapp_interaction_has_tags','as':_0x62b1('0x17a')});db[_0x62b1('0x10d')][_0x62b1('0x12d')](db[_0x62b1('0x8f')],{'through':'whatsapp_interaction_has_tags','as':_0x62b1('0x194')});db['WhatsappInteraction'][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':_0x62b1('0x17b'),'through':_0x62b1('0x201'),'foreignKey':'WhatsappInteractionId'});db[_0x62b1('0x1ff')][_0x62b1('0x12b')](db[_0x62b1('0x14')],{'as':_0x62b1('0x14')});db[_0x62b1('0x1ff')][_0x62b1('0x12b')](db['CmContact'],{'onDelete':'cascade','as':_0x62b1('0x16a')});db[_0x62b1('0x1ff')][_0x62b1('0x12b')](db[_0x62b1('0x10d')],{'onDelete':_0x62b1('0x11a'),'as':_0x62b1('0x17d'),'foreignKey':_0x62b1('0x200')});db[_0x62b1('0x1ff')][_0x62b1('0x12b')](db['WhatsappAccount'],{'as':_0x62b1('0x177'),'foreignKey':_0x62b1('0x1fe')});db['WhatsappQueueReport'][_0x62b1('0x12b')](db[_0x62b1('0x109')],{});db[_0x62b1('0x110')][_0x62b1('0x12b')](db['CmList'],{'as':_0x62b1('0x171'),'foreignKey':_0x62b1('0x172')});db[_0x62b1('0x110')][_0x62b1('0x12b')](db['CmContact'],{'as':_0x62b1('0x16a'),'foreignKey':'ContactId'});db[_0x62b1('0x110')][_0x62b1('0x12b')](db[_0x62b1('0x10d')],{});db[_0x62b1('0x110')]['belongsTo'](db['WhatsappQueue'],{});db[_0x62b1('0x110')][_0x62b1('0x12b')](db[_0x62b1('0x1ff')],{});db[_0x62b1('0x110')]['belongsTo'](db[_0x62b1('0x14')],{});db[_0x62b1('0x112')][_0x62b1('0x12b')](db['WhatsappMessage'],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0x62b1('0x112')][_0x62b1('0x12b')](db[_0x62b1('0x109')],{'foreignKey':_0x62b1('0x202'),'as':'FromAccount'});db[_0x62b1('0x112')][_0x62b1('0x12b')](db['WhatsappAccount'],{'foreignKey':_0x62b1('0x203'),'as':_0x62b1('0x1e9')});db[_0x62b1('0x112')][_0x62b1('0x12b')](db[_0x62b1('0x114')],{'foreignKey':_0x62b1('0x204'),'as':_0x62b1('0x1e7')});db[_0x62b1('0x112')]['belongsTo'](db[_0x62b1('0x14')],{'foreignKey':_0x62b1('0x1e5'),'as':'FromAgent'});db[_0x62b1('0x112')][_0x62b1('0x12b')](db['User'],{'foreignKey':_0x62b1('0x1e6'),'as':_0x62b1('0x1ec')});db[_0x62b1('0x114')][_0x62b1('0x12d')](db[_0x62b1('0x14')],{'as':'Agents','through':_0x62b1('0x3c'),'foreignKey':_0x62b1('0x205')});db[_0x62b1('0x114')]['belongsToMany'](db[_0x62b1('0xeb')],{'through':'team_has_whatsapp_queues','as':_0x62b1('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b3634f2..7b8441c 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb846=['body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','name','role','inspect','%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)','url','other','agent_name','test','/api/users','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/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/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/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/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','root','/apidoc','/www','static','/demo','join','/snippet','snippet','3.0.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','password','newPassword','apiKey','lastName','street','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','vidaooApiKey','clientEmail','privateKey','accesskeyid','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','length','replace','}@@','includes','lodash','path','express','express-winston','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty'];(function(_0x5a91a5,_0x1eb099){var _0x8f99de=function(_0x579b28){while(--_0x579b28){_0x5a91a5['push'](_0x5a91a5['shift']());}};_0x8f99de(++_0x1eb099);}(_0xb846,0x145));var _0x6b84=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb846[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x6b84('0x0'));var path=require(_0x6b84('0x1'));var express=require(_0x6b84('0x2'));var ewinston=require(_0x6b84('0x3'));var util=require('util');var errors=require('./errors');var config=require('./config/environment');var logger=require(_0x6b84('0x4'))(_0x6b84('0x5'));var authLogger=require(_0x6b84('0x4'))(_0x6b84('0x6'));exports[_0x6b84('0x7')]=function(_0x5ef7c1){_0x5ef7c1[_0x6b84('0x8')](ewinston[_0x6b84('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xc50187,_0x4d158f){var _0x1a488a=_0x6b84('0xa');if(!_[_0x6b84('0xb')](_0xc50187[_0x6b84('0xc')])){_0x1a488a+=_0x6b84('0xd');var _0x113b8d=_0xc50187[_0x6b84('0xc')];maskSensitiveData(_0x113b8d);}return util[_0x6b84('0xe')](_0x1a488a,_0xc50187[_0x6b84('0xf')],_0xc50187[_0x6b84('0x10')][_0x6b84('0x11')]?_0xc50187['headers'][_0x6b84('0x11')]:_0xc50187[_0x6b84('0x12')][_0x6b84('0x13')]||_0xc50187['ip'],_0xc50187['url'],_0x4d158f[_0x6b84('0x14')],_0x4d158f[_0x6b84('0x15')],_0xc50187[_0x6b84('0x16')]?_0xc50187[_0x6b84('0x16')]['id']:null,_0xc50187[_0x6b84('0x16')]?_0xc50187[_0x6b84('0x16')][_0x6b84('0x17')]:null,_0xc50187[_0x6b84('0x16')]?_0xc50187['user'][_0x6b84('0x18')]:null,_0x113b8d?util[_0x6b84('0x19')](_0x113b8d,![],null):'');}}));_0x5ef7c1[_0x6b84('0x8')](ewinston[_0x6b84('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4b73db,_0x5ca670){var _0x10fec1=_0x6b84('0x1a');if(_0x4b73db[_0x6b84('0xc')]&&_0x4b73db[_0x6b84('0xc')][_0x6b84('0x1b')]&&_0x4b73db[_0x6b84('0xc')][_0x6b84('0x1c')]){_0x10fec1=_0x6b84('0x1d');}return util[_0x6b84('0xe')](_0x10fec1,_0x4b73db[_0x6b84('0xf')],_0x4b73db['headers'][_0x6b84('0x11')]?_0x4b73db[_0x6b84('0x10')][_0x6b84('0x11')]:_0x4b73db[_0x6b84('0x12')][_0x6b84('0x13')]||_0x4b73db['ip'],_0x4b73db[_0x6b84('0x1e')],_0x5ca670['statusCode'],_0x5ca670[_0x6b84('0x15')],_0x4b73db[_0x6b84('0x16')]?_0x4b73db[_0x6b84('0x16')]['id']:null,_0x4b73db[_0x6b84('0x16')]?_0x4b73db['user'][_0x6b84('0x17')]:null,_0x4b73db['user']?_0x4b73db[_0x6b84('0x16')][_0x6b84('0x18')]:null,_0x4b73db[_0x6b84('0xc')]&&_0x4b73db[_0x6b84('0xc')][_0x6b84('0x1b')]?_0x4b73db[_0x6b84('0xc')][_0x6b84('0x1b')]:_0x6b84('0x1f'),_0x4b73db[_0x6b84('0xc')]&&_0x4b73db[_0x6b84('0xc')][_0x6b84('0x1c')]?_0x4b73db[_0x6b84('0xc')][_0x6b84('0x1c')]:'',_0x4b73db['body']&&_0x4b73db['body'][_0x6b84('0x20')]?_0x4b73db[_0x6b84('0xc')]['agent_name']:'');},'ignoreRoute':function(_0x2a3506){var _0x5487ee=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5487ee[_0x6b84('0x21')](_0x2a3506[_0x6b84('0x1e')]);}}));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x22'),require('./api/user'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x23'),require(_0x6b84('0x24')));_0x5ef7c1[_0x6b84('0x8')]('/api/voice/contexts',require(_0x6b84('0x25')));_0x5ef7c1[_0x6b84('0x8')]('/api/voice/extensions',require(_0x6b84('0x26')));_0x5ef7c1[_0x6b84('0x8')]('/api/voice/mohs',require(_0x6b84('0x27')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x28'),require('./api/voiceQueue'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x29'),require('./api/voiceRecording'));_0x5ef7c1[_0x6b84('0x8')]('/api/screen/recordings',require(_0x6b84('0x2a')));_0x5ef7c1[_0x6b84('0x8')]('/api/voice/mails',require(_0x6b84('0x2b')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x2c'),require(_0x6b84('0x2d')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x2e'),require('./api/voiceCallReport'));_0x5ef7c1['use']('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x2f'),require(_0x6b84('0x30')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x31'),require(_0x6b84('0x32')));_0x5ef7c1['use'](_0x6b84('0x33'),require(_0x6b84('0x34')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x35'),require(_0x6b84('0x36')));_0x5ef7c1['use'](_0x6b84('0x37'),require('./api/voiceTransferReport'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x38'),require('./api/mailServerOut'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x39'),require(_0x6b84('0x3a')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x3b'),require(_0x6b84('0x3c')));_0x5ef7c1[_0x6b84('0x8')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x3d'),require(_0x6b84('0x3e')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x3f'),require(_0x6b84('0x40')));_0x5ef7c1['use'](_0x6b84('0x41'),require(_0x6b84('0x42')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x43'),require(_0x6b84('0x44')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x45'),require('./api/dashboard'));_0x5ef7c1['use'](_0x6b84('0x46'),require(_0x6b84('0x47')));_0x5ef7c1['use'](_0x6b84('0x48'),require('./api/faxAccount'));_0x5ef7c1['use'](_0x6b84('0x49'),require('./api/faxApplication'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x4a'),require(_0x6b84('0x4b')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x4c'),require('./api/faxMessage'));_0x5ef7c1['use'](_0x6b84('0x4d'),require(_0x6b84('0x4e')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x4f'),require(_0x6b84('0x50')));_0x5ef7c1['use']('/api/sms/accounts',require(_0x6b84('0x51')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x52'),require(_0x6b84('0x53')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x54'),require(_0x6b84('0x55')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x56'),require(_0x6b84('0x57')));_0x5ef7c1[_0x6b84('0x8')]('/api/sms/queues',require(_0x6b84('0x58')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x59'),require(_0x6b84('0x5a')));_0x5ef7c1[_0x6b84('0x8')]('/api/openchannel/applications',require(_0x6b84('0x5b')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x5c'),require('./api/openchannelInteraction'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x5d'),require('./api/openchannelMessage'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x5e'),require(_0x6b84('0x5f')));_0x5ef7c1['use'](_0x6b84('0x60'),require('./api/chatWebsite'));_0x5ef7c1[_0x6b84('0x8')]('/api/openchannel/reports/queue',require(_0x6b84('0x61')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x62'),require(_0x6b84('0x63')));_0x5ef7c1[_0x6b84('0x8')]('/api/chat/interactions',require(_0x6b84('0x64')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x65'),require(_0x6b84('0x66')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x67'),require(_0x6b84('0x68')));_0x5ef7c1['use'](_0x6b84('0x69'),require(_0x6b84('0x6a')));_0x5ef7c1[_0x6b84('0x8')]('/api/chat/groups',require('./api/chatGroup'));_0x5ef7c1[_0x6b84('0x8')]('/api/chat/proactive_actions',require(_0x6b84('0x6b')));_0x5ef7c1['use'](_0x6b84('0x6c'),require(_0x6b84('0x6d')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x6e'),require(_0x6b84('0x6f')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x70'),require(_0x6b84('0x71')));_0x5ef7c1['use'](_0x6b84('0x72'),require(_0x6b84('0x73')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x74'),require('./api/cmHopperFinal'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x75'),require(_0x6b84('0x76')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x77'),require(_0x6b84('0x78')));_0x5ef7c1['use'](_0x6b84('0x79'),require(_0x6b84('0x7a')));_0x5ef7c1[_0x6b84('0x8')]('/api/automations',require(_0x6b84('0x7b')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x7c'),require(_0x6b84('0x7d')));_0x5ef7c1['use']('/api/dispositions',require(_0x6b84('0x7e')));_0x5ef7c1['use'](_0x6b84('0x7f'),require(_0x6b84('0x80')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x81'),require(_0x6b84('0x82')));_0x5ef7c1['use'](_0x6b84('0x83'),require(_0x6b84('0x84')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x85'),require(_0x6b84('0x86')));_0x5ef7c1['use'](_0x6b84('0x87'),require(_0x6b84('0x88')));_0x5ef7c1[_0x6b84('0x8')]('/api/schedules',require(_0x6b84('0x89')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x8a'),require('./api/sound'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x8b'),require(_0x6b84('0x8c')));_0x5ef7c1['use'](_0x6b84('0x8d'),require('./api/contactItemType'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x8e'),require(_0x6b84('0x8f')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x90'),require('./api/cmHopperAdditionalPhone'));_0x5ef7c1['use'](_0x6b84('0x91'),require(_0x6b84('0x92')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x93'),require(_0x6b84('0x94')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x95'),require(_0x6b84('0x96')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x97'),require(_0x6b84('0x98')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x99'),require(_0x6b84('0x9a')));_0x5ef7c1['use'](_0x6b84('0x9b'),require(_0x6b84('0x9c')));_0x5ef7c1['use'](_0x6b84('0x9d'),require(_0x6b84('0x9e')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x9f'),require(_0x6b84('0xa0')));_0x5ef7c1['use'](_0x6b84('0xa1'),require(_0x6b84('0xa2')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xa3'),require('./api/analyticFieldReport'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xa4'),require(_0x6b84('0xa5')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xa6'),require(_0x6b84('0xa7')));_0x5ef7c1[_0x6b84('0x8')]('/api/integrations/salesforce/configurations',require(_0x6b84('0xa8')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xa9'),require(_0x6b84('0xaa')));_0x5ef7c1['use'](_0x6b84('0xab'),require('./api/intSugarcrmAccount'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xac'),require(_0x6b84('0xad')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xae'),require(_0x6b84('0xaf')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xb0'),require(_0x6b84('0xb1')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xb2'),require(_0x6b84('0xb3')));_0x5ef7c1['use']('/api/integrations/desk/fields',require('./api/intDeskField'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xb4'),require(_0x6b84('0xb5')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xb6'),require(_0x6b84('0xb7')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xb8'),require('./api/intZohoField'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xb9'),require(_0x6b84('0xba')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xbb'),require(_0x6b84('0xbc')));_0x5ef7c1[_0x6b84('0x8')]('/api/integrations/zendesk/fields',require(_0x6b84('0xbd')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xbe'),require(_0x6b84('0xbf')));_0x5ef7c1['use'](_0x6b84('0xc0'),require('./api/intFreshdeskConfiguration'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xc1'),require(_0x6b84('0xc2')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xc3'),require(_0x6b84('0xc4')));_0x5ef7c1['use']('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x5ef7c1[_0x6b84('0x8')]('/api/integrations/vtiger/fields',require(_0x6b84('0xc5')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xc6'),require('./api/intServicenowAccount'));_0x5ef7c1[_0x6b84('0x8')]('/api/integrations/servicenow/configurations',require(_0x6b84('0xc7')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xc8'),require(_0x6b84('0xc9')));_0x5ef7c1['use'](_0x6b84('0xca'),require(_0x6b84('0xcb')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xcc'),require(_0x6b84('0xcd')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xce'),require('./api/intDynamics365Field'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xcf'),require(_0x6b84('0xd0')));_0x5ef7c1[_0x6b84('0x8')]('/api/integrations/freshsales/configurations',require(_0x6b84('0xd1')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xd2'),require(_0x6b84('0xd3')));_0x5ef7c1[_0x6b84('0x8')]('/api/networks',require('./api/network'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xd4'),require(_0x6b84('0xd5')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xd6'),require(_0x6b84('0xd7')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xd8'),require(_0x6b84('0xd9')));_0x5ef7c1['use']('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x5ef7c1['use']('/api/jscripty/sessions/reports',require(_0x6b84('0xda')));_0x5ef7c1[_0x6b84('0x8')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xdb'),require(_0x6b84('0xdc')));_0x5ef7c1['use'](_0x6b84('0xdd'),require(_0x6b84('0xde')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xdf'),require(_0x6b84('0xe0')));_0x5ef7c1[_0x6b84('0x8')]('/api/settings',require('./api/setting'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xe1'),require(_0x6b84('0xe2')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xe3'),require(_0x6b84('0xe4')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xe5'),require(_0x6b84('0xe6')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xe7'),require(_0x6b84('0xe8')));_0x5ef7c1['use'](_0x6b84('0xe9'),require(_0x6b84('0xea')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xeb'),require(_0x6b84('0xec')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xed'),require(_0x6b84('0xee')));_0x5ef7c1['use']('/api/migrations',require(_0x6b84('0xef')));_0x5ef7c1[_0x6b84('0x8')]('/api/attachments',require('./api/attachment'));_0x5ef7c1['use'](_0x6b84('0xf0'),require('./api/plugin'));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xf1'),require(_0x6b84('0xf2')));_0x5ef7c1['use'](_0x6b84('0xf3'),require(_0x6b84('0xf4')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xf5'),require('./api/faxTransferReport'));_0x5ef7c1['use'](_0x6b84('0xf6'),require(_0x6b84('0xf7')));_0x5ef7c1['use'](_0x6b84('0xf8'),require('./api/smsTransferReport'));_0x5ef7c1['use'](_0x6b84('0xf9'),require(_0x6b84('0xfa')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xfb'),require('./api/voicePrefix'));_0x5ef7c1[_0x6b84('0x8')]('/api/userProfiles',require(_0x6b84('0xfc')));_0x5ef7c1['use'](_0x6b84('0xfd'),require(_0x6b84('0xfe')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0xff'),require(_0x6b84('0x100')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x101'),require(_0x6b84('0x102')));_0x5ef7c1['use'](_0x6b84('0x103'),require(_0x6b84('0x104')));_0x5ef7c1['use']('/api/whatsapp/applications',require(_0x6b84('0x105')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x106'),require(_0x6b84('0x107')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x108'),require(_0x6b84('0x109')));_0x5ef7c1[_0x6b84('0x8')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x5ef7c1['use']('/api/whatsapp/reports/transfer',require(_0x6b84('0x10a')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x10b'),require('./api/whatsappQueue'));_0x5ef7c1['use'](_0x6b84('0x10c'),require(_0x6b84('0x10d')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x10e'),require('./api/authLocal'));_0x5ef7c1[_0x6b84('0x8')]('/api/auth/google',require(_0x6b84('0x10f')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x110'),require(_0x6b84('0x111')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x112'),require(_0x6b84('0x113')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x114'),require(_0x6b84('0x115')));_0x5ef7c1[_0x6b84('0x8')]('/api/system',require(_0x6b84('0x116')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x117'),require(_0x6b84('0x118')));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x119'),require(_0x6b84('0x11a')));_0x5ef7c1[_0x6b84('0x8')]('/apidoc',express['static'](path['join'](config[_0x6b84('0x11b')],_0x6b84('0x11c'))));_0x5ef7c1[_0x6b84('0x8')](_0x6b84('0x11d'),express[_0x6b84('0x11e')](path['join'](config[_0x6b84('0x11b')],_0x6b84('0x11d'))));_0x5ef7c1['use'](_0x6b84('0x11f'),express[_0x6b84('0x11e')](path[_0x6b84('0x120')](config[_0x6b84('0x11b')],_0x6b84('0x11f'))));_0x5ef7c1['use'](_0x6b84('0x121'),express[_0x6b84('0x11e')](path[_0x6b84('0x120')](config['root'],_0x6b84('0x122'),_0x6b84('0x123'))));_0x5ef7c1['use']('/plugins',express['static'](path[_0x6b84('0x120')](config[_0x6b84('0x11b')],_0x6b84('0x124'))));_0x5ef7c1['route'](_0x6b84('0x125'))[_0x6b84('0x126')](errors[0x194]);_0x5ef7c1[_0x6b84('0x127')]('/*')['get'](function(_0x2aa7b2,_0x25d380){_0x25d380[_0x6b84('0x128')](path[_0x6b84('0x129')](_0x5ef7c1[_0x6b84('0x126')](_0x6b84('0x12a'))+_0x6b84('0x12b')));});};var sensitiveFields=['username',_0x6b84('0x12c'),_0x6b84('0x12d'),_0x6b84('0x12e'),'firstName',_0x6b84('0x12f'),_0x6b84('0x130'),'phone',_0x6b84('0x131'),_0x6b84('0x132'),_0x6b84('0x133'),_0x6b84('0x134'),_0x6b84('0x135'),_0x6b84('0x136'),_0x6b84('0x137'),_0x6b84('0x138'),'tenantId',_0x6b84('0x139'),'channelSecret','accessToken',_0x6b84('0x13a'),_0x6b84('0x13b'),_0x6b84('0x13c'),_0x6b84('0x13d'),_0x6b84('0x13e'),_0x6b84('0x13f'),'calleridnum','exten',_0x6b84('0x140'),_0x6b84('0x141'),_0x6b84('0x142'),_0x6b84('0x143'),'secretaccesskey',_0x6b84('0x144'),_0x6b84('0x16'),_0x6b84('0x145'),_0x6b84('0x146'),_0x6b84('0x147'),_0x6b84('0x148'),_0x6b84('0x149'),_0x6b84('0x14a'),_0x6b84('0x14b')];function maskSensitiveData(_0x1873f8){var _0x1d2c42=/(?!^)[\s\S](?!$)/g;if(!_[_0x6b84('0x14c')](_0x1873f8))return;for(var _0x5d1d1b in _0x1873f8){if(_['isArray'](_0x1873f8[_0x5d1d1b])){for(var _0x507cdb=0x0;_0x507cdb<_0x1873f8[_0x5d1d1b][_0x6b84('0x14d')];_0x507cdb++){maskSensitiveData(_0x1873f8[_0x5d1d1b][_0x507cdb]);}}else if(_[_0x6b84('0x14c')](_0x1873f8[_0x5d1d1b])){maskSensitiveData(_0x1873f8[_0x5d1d1b]);}else if(_['isString'](_0x1873f8[_0x5d1d1b])){_0x1873f8[_0x5d1d1b]=_0x1873f8[_0x5d1d1b][_0x6b84('0x14e')](/{{{/g,'@@{')['replace'](/}}}/g,_0x6b84('0x14f'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x6b84('0x150')](sensitiveFields,_0x5d1d1b)){_0x1873f8[_0x5d1d1b]=_0x1873f8[_0x5d1d1b]['replace'](_0x1d2c42,'*');}}}} \ No newline at end of file +var _0xcad1=['./api/pm2','/apidoc','static','join','root','/demo','/snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','password','newPassword','apiKey','firstName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','tenantId','channelSecret','authToken','consumerSecret','calleridnum','vidaooApiKey','privateKey','accesskeyid','key','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','path','express','./errors','./config/environment','./config/logger','api','auth','default','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','user','name','role','inspect','use','logger','%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)','statusCode','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmCustomField','./api/action','/api/automations','./api/automation','/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/tag','/api/contact_item_types','./api/cmContactHasItem','/api/templates','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/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/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/team','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/mailTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/api/pm2'];(function(_0x147ad3,_0xade099){var _0x42a7ac=function(_0x16b005){while(--_0x16b005){_0x147ad3['push'](_0x147ad3['shift']());}};_0x42a7ac(++_0xade099);}(_0xcad1,0x16c));var _0x1cad=function(_0x5555eb,_0x7217b5){_0x5555eb=_0x5555eb-0x0;var _0x4e4a36=_0xcad1[_0x5555eb];return _0x4e4a36;};'use strict';var _=require('lodash');var path=require(_0x1cad('0x0'));var express=require(_0x1cad('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require(_0x1cad('0x2'));var config=require(_0x1cad('0x3'));var logger=require(_0x1cad('0x4'))(_0x1cad('0x5'));var authLogger=require('./config/logger')(_0x1cad('0x6'));exports[_0x1cad('0x7')]=function(_0x1358e0){_0x1358e0['use'](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4d99fd,_0x27fec9){var _0x5a79f7=_0x1cad('0x8');if(!_[_0x1cad('0x9')](_0x4d99fd[_0x1cad('0xa')])){_0x5a79f7+=_0x1cad('0xb');var _0x165eba=_0x4d99fd[_0x1cad('0xa')];maskSensitiveData(_0x165eba);}return util[_0x1cad('0xc')](_0x5a79f7,_0x4d99fd[_0x1cad('0xd')],_0x4d99fd[_0x1cad('0xe')]['x-forwarded-for']?_0x4d99fd[_0x1cad('0xe')][_0x1cad('0xf')]:_0x4d99fd[_0x1cad('0x10')][_0x1cad('0x11')]||_0x4d99fd['ip'],_0x4d99fd[_0x1cad('0x12')],_0x27fec9['statusCode'],_0x27fec9[_0x1cad('0x13')],_0x4d99fd[_0x1cad('0x14')]?_0x4d99fd[_0x1cad('0x14')]['id']:null,_0x4d99fd['user']?_0x4d99fd[_0x1cad('0x14')][_0x1cad('0x15')]:null,_0x4d99fd['user']?_0x4d99fd[_0x1cad('0x14')][_0x1cad('0x16')]:null,_0x165eba?util[_0x1cad('0x17')](_0x165eba,![],null):'');}}));_0x1358e0[_0x1cad('0x18')](ewinston[_0x1cad('0x19')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1f27a8,_0x758708){var _0x2e9456=_0x1cad('0x1a');if(_0x1f27a8[_0x1cad('0xa')]&&_0x1f27a8[_0x1cad('0xa')]['device']&&_0x1f27a8[_0x1cad('0xa')][_0x1cad('0x1b')]){_0x2e9456=_0x1cad('0x1c');}return util[_0x1cad('0xc')](_0x2e9456,_0x1f27a8[_0x1cad('0xd')],_0x1f27a8[_0x1cad('0xe')][_0x1cad('0xf')]?_0x1f27a8[_0x1cad('0xe')][_0x1cad('0xf')]:_0x1f27a8[_0x1cad('0x10')][_0x1cad('0x11')]||_0x1f27a8['ip'],_0x1f27a8[_0x1cad('0x12')],_0x758708[_0x1cad('0x1d')],_0x758708['responseTime'],_0x1f27a8[_0x1cad('0x14')]?_0x1f27a8[_0x1cad('0x14')]['id']:null,_0x1f27a8[_0x1cad('0x14')]?_0x1f27a8[_0x1cad('0x14')][_0x1cad('0x15')]:null,_0x1f27a8['user']?_0x1f27a8[_0x1cad('0x14')][_0x1cad('0x16')]:null,_0x1f27a8[_0x1cad('0xa')]&&_0x1f27a8[_0x1cad('0xa')]['device']?_0x1f27a8[_0x1cad('0xa')][_0x1cad('0x1e')]:_0x1cad('0x1f'),_0x1f27a8[_0x1cad('0xa')]&&_0x1f27a8[_0x1cad('0xa')][_0x1cad('0x1b')]?_0x1f27a8['body']['agent_id']:'',_0x1f27a8[_0x1cad('0xa')]&&_0x1f27a8[_0x1cad('0xa')][_0x1cad('0x20')]?_0x1f27a8[_0x1cad('0xa')]['agent_name']:'');},'ignoreRoute':function(_0x599e55){var _0x4ccc89=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4ccc89[_0x1cad('0x21')](_0x599e55[_0x1cad('0x12')]);}}));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x22'),require(_0x1cad('0x23')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x24'),require('./api/voiceChanSpy'));_0x1358e0[_0x1cad('0x18')]('/api/voice/contexts',require('./api/voiceContext'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x25'),require(_0x1cad('0x26')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x27'),require(_0x1cad('0x28')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x29'),require('./api/voiceQueue'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x2a'),require(_0x1cad('0x2b')));_0x1358e0['use']('/api/screen/recordings',require(_0x1cad('0x2c')));_0x1358e0['use'](_0x1cad('0x2d'),require(_0x1cad('0x2e')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x2f'),require(_0x1cad('0x30')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x31'),require(_0x1cad('0x32')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x33'),require('./api/voiceDialReport'));_0x1358e0[_0x1cad('0x18')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x1358e0[_0x1cad('0x18')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x34'),require(_0x1cad('0x35')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x36'),require(_0x1cad('0x37')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x38'),require(_0x1cad('0x39')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x3a'),require(_0x1cad('0x3b')));_0x1358e0[_0x1cad('0x18')]('/api/mail/accounts',require('./api/mailAccount'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x3c'),require(_0x1cad('0x3d')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x3e'),require(_0x1cad('0x3f')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x40'),require(_0x1cad('0x41')));_0x1358e0['use'](_0x1cad('0x42'),require(_0x1cad('0x43')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x44'),require('./api/mailApplication'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x45'),require('./api/mailQueueReport'));_0x1358e0['use'](_0x1cad('0x46'),require('./api/dashboard'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x47'),require(_0x1cad('0x48')));_0x1358e0[_0x1cad('0x18')]('/api/fax/accounts',require(_0x1cad('0x49')));_0x1358e0[_0x1cad('0x18')]('/api/fax/applications',require(_0x1cad('0x4a')));_0x1358e0['use'](_0x1cad('0x4b'),require(_0x1cad('0x4c')));_0x1358e0['use'](_0x1cad('0x4d'),require(_0x1cad('0x4e')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x4f'),require(_0x1cad('0x50')));_0x1358e0['use'](_0x1cad('0x51'),require('./api/faxQueueReport'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x52'),require(_0x1cad('0x53')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x54'),require(_0x1cad('0x55')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x56'),require(_0x1cad('0x57')));_0x1358e0['use']('/api/sms/messages',require(_0x1cad('0x58')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x59'),require(_0x1cad('0x5a')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x5b'),require(_0x1cad('0x5c')));_0x1358e0[_0x1cad('0x18')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x5d'),require(_0x1cad('0x5e')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x5f'),require(_0x1cad('0x60')));_0x1358e0[_0x1cad('0x18')]('/api/openchannel/queues',require(_0x1cad('0x61')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x62'),require(_0x1cad('0x63')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x64'),require(_0x1cad('0x65')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x66'),require(_0x1cad('0x67')));_0x1358e0['use']('/api/chat/interactions',require(_0x1cad('0x68')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x69'),require(_0x1cad('0x6a')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x6b'),require('./api/chatOfflineMessage'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x6c'),require(_0x1cad('0x6d')));_0x1358e0['use'](_0x1cad('0x6e'),require(_0x1cad('0x6f')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x70'),require(_0x1cad('0x71')));_0x1358e0[_0x1cad('0x18')]('/api/cm/companies',require(_0x1cad('0x72')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x73'),require(_0x1cad('0x74')));_0x1358e0[_0x1cad('0x18')]('/api/cm/hopper',require(_0x1cad('0x75')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x76'),require(_0x1cad('0x77')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x78'),require('./api/cmHopperFinal'));_0x1358e0[_0x1cad('0x18')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x1358e0[_0x1cad('0x18')]('/api/cm/custom_fields',require(_0x1cad('0x79')));_0x1358e0[_0x1cad('0x18')]('/api/actions',require(_0x1cad('0x7a')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x7b'),require(_0x1cad('0x7c')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x7d'),require(_0x1cad('0x7e')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x7f'),require(_0x1cad('0x80')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x81'),require(_0x1cad('0x82')));_0x1358e0['use'](_0x1cad('0x83'),require(_0x1cad('0x84')));_0x1358e0[_0x1cad('0x18')]('/api/pauses',require(_0x1cad('0x85')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x86'),require(_0x1cad('0x87')));_0x1358e0['use'](_0x1cad('0x88'),require(_0x1cad('0x89')));_0x1358e0[_0x1cad('0x18')]('/api/schedules',require('./api/schedule'));_0x1358e0[_0x1cad('0x18')]('/api/sounds',require('./api/sound'));_0x1358e0[_0x1cad('0x18')]('/api/tags',require(_0x1cad('0x8a')));_0x1358e0['use'](_0x1cad('0x8b'),require('./api/contactItemType'));_0x1358e0[_0x1cad('0x18')]('/api/cm_contact_has_items',require(_0x1cad('0x8c')));_0x1358e0[_0x1cad('0x18')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x8d'),require('./api/template'));_0x1358e0[_0x1cad('0x18')]('/api/triggers',require(_0x1cad('0x8e')));_0x1358e0[_0x1cad('0x18')]('/api/variables',require(_0x1cad('0x8f')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x90'),require(_0x1cad('0x91')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x92'),require(_0x1cad('0x93')));_0x1358e0[_0x1cad('0x18')]('/api/analytics/custom_reports',require(_0x1cad('0x94')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x95'),require(_0x1cad('0x96')));_0x1358e0[_0x1cad('0x18')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x97'),require(_0x1cad('0x98')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x99'),require('./api/analyticFieldReport'));_0x1358e0['use'](_0x1cad('0x9a'),require(_0x1cad('0x9b')));_0x1358e0['use'](_0x1cad('0x9c'),require(_0x1cad('0x9d')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x9e'),require('./api/intSalesforceConfiguration'));_0x1358e0[_0x1cad('0x18')]('/api/integrations/salesforce/fields',require(_0x1cad('0x9f')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xa0'),require(_0x1cad('0xa1')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xa2'),require('./api/intSugarcrmConfiguration'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xa3'),require(_0x1cad('0xa4')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xa5'),require('./api/intDeskAccount'));_0x1358e0['use'](_0x1cad('0xa6'),require(_0x1cad('0xa7')));_0x1358e0[_0x1cad('0x18')]('/api/integrations/desk/fields',require(_0x1cad('0xa8')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xa9'),require(_0x1cad('0xaa')));_0x1358e0['use']('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xab'),require(_0x1cad('0xac')));_0x1358e0['use'](_0x1cad('0xad'),require('./api/intZendeskAccount'));_0x1358e0[_0x1cad('0x18')]('/api/integrations/zendesk/configurations',require(_0x1cad('0xae')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xaf'),require('./api/intZendeskField'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xb0'),require(_0x1cad('0xb1')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xb2'),require('./api/intFreshdeskConfiguration'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xb3'),require(_0x1cad('0xb4')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xb5'),require(_0x1cad('0xb6')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xb7'),require(_0x1cad('0xb8')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xb9'),require(_0x1cad('0xba')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xbb'),require(_0x1cad('0xbc')));_0x1358e0[_0x1cad('0x18')]('/api/integrations/servicenow/configurations',require(_0x1cad('0xbd')));_0x1358e0['use'](_0x1cad('0xbe'),require(_0x1cad('0xbf')));_0x1358e0[_0x1cad('0x18')]('/api/integrations/dynamics365/accounts',require(_0x1cad('0xc0')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xc1'),require(_0x1cad('0xc2')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xc3'),require('./api/intDynamics365Field'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xc4'),require(_0x1cad('0xc5')));_0x1358e0[_0x1cad('0x18')]('/api/integrations/freshsales/configurations',require(_0x1cad('0xc6')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xc7'),require(_0x1cad('0xc8')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xc9'),require(_0x1cad('0xca')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xcb'),require(_0x1cad('0xcc')));_0x1358e0['use']('/api/chat/internal/messages',require(_0x1cad('0xcd')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xce'),require(_0x1cad('0xcf')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xd0'),require('./api/jscriptyQuestionReport'));_0x1358e0[_0x1cad('0x18')]('/api/jscripty/sessions/reports',require(_0x1cad('0xd1')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xd2'),require(_0x1cad('0xd3')));_0x1358e0['use']('/api/square/reports',require(_0x1cad('0xd4')));_0x1358e0['use'](_0x1cad('0xd5'),require(_0x1cad('0xd6')));_0x1358e0[_0x1cad('0x18')]('/api/jscripty/projects',require(_0x1cad('0xd7')));_0x1358e0['use'](_0x1cad('0xd8'),require(_0x1cad('0xd9')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xda'),require(_0x1cad('0xdb')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xdc'),require(_0x1cad('0xdd')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xde'),require('./api/squareRecording'));_0x1358e0[_0x1cad('0x18')]('/api/square/messages',require('./api/squareMessage'));_0x1358e0[_0x1cad('0x18')]('/api/teams',require(_0x1cad('0xdf')));_0x1358e0[_0x1cad('0x18')]('/api/license',require(_0x1cad('0xe0')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xe1'),require('./api/campaign'));_0x1358e0[_0x1cad('0x18')]('/api/migrations',require(_0x1cad('0xe2')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xe3'),require(_0x1cad('0xe4')));_0x1358e0['use'](_0x1cad('0xe5'),require('./api/plugin'));_0x1358e0['use']('/api/mail/reports/transfer',require(_0x1cad('0xe6')));_0x1358e0[_0x1cad('0x18')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x1358e0['use'](_0x1cad('0xe7'),require('./api/faxTransferReport'));_0x1358e0[_0x1cad('0x18')]('/api/openchannel/reports/transfer',require(_0x1cad('0xe8')));_0x1358e0['use'](_0x1cad('0xe9'),require(_0x1cad('0xea')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xeb'),require(_0x1cad('0xec')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xed'),require('./api/voicePrefix'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xee'),require(_0x1cad('0xef')));_0x1358e0[_0x1cad('0x18')]('/api/userProfile/sections',require(_0x1cad('0xf0')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xf1'),require(_0x1cad('0xf2')));_0x1358e0['use'](_0x1cad('0xf3'),require('./api/userNotification'));_0x1358e0[_0x1cad('0x18')]('/api/whatsapp/accounts',require(_0x1cad('0xf4')));_0x1358e0['use'](_0x1cad('0xf5'),require('./api/whatsappApplication'));_0x1358e0[_0x1cad('0x18')]('/api/whatsapp/interactions',require(_0x1cad('0xf6')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xf7'),require(_0x1cad('0xf8')));_0x1358e0['use']('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xf9'),require('./api/whatsappTransferReport'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xfa'),require('./api/whatsappQueue'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xfb'),require(_0x1cad('0xfc')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xfd'),require(_0x1cad('0xfe')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0xff'),require(_0x1cad('0x100')));_0x1358e0['use'](_0x1cad('0x101'),require(_0x1cad('0x102')));_0x1358e0['use'](_0x1cad('0x103'),require(_0x1cad('0x104')));_0x1358e0[_0x1cad('0x18')]('/api/version',require(_0x1cad('0x105')));_0x1358e0[_0x1cad('0x18')]('/api/system',require(_0x1cad('0x106')));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x107'),require(_0x1cad('0x108')));_0x1358e0[_0x1cad('0x18')]('/api/webbar',require('./api/webbar'));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x109'),express[_0x1cad('0x10a')](path[_0x1cad('0x10b')](config['root'],_0x1cad('0x109'))));_0x1358e0[_0x1cad('0x18')]('/www',express[_0x1cad('0x10a')](path['join'](config[_0x1cad('0x10c')],'/www')));_0x1358e0['use']('/demo',express[_0x1cad('0x10a')](path[_0x1cad('0x10b')](config[_0x1cad('0x10c')],_0x1cad('0x10d'))));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x10e'),express[_0x1cad('0x10a')](path['join'](config[_0x1cad('0x10c')],'snippet',_0x1cad('0x10f'))));_0x1358e0[_0x1cad('0x18')](_0x1cad('0x110'),express[_0x1cad('0x10a')](path['join'](config[_0x1cad('0x10c')],_0x1cad('0x111'))));_0x1358e0[_0x1cad('0x112')](_0x1cad('0x113'))[_0x1cad('0x114')](errors[0x194]);_0x1358e0['route']('/*')[_0x1cad('0x114')](function(_0x5bf492,_0x12cc04){_0x12cc04[_0x1cad('0x115')](path['resolve'](_0x1358e0[_0x1cad('0x114')](_0x1cad('0x116'))+_0x1cad('0x117')));});};var sensitiveFields=['username',_0x1cad('0x118'),_0x1cad('0x119'),_0x1cad('0x11a'),_0x1cad('0x11b'),'lastName',_0x1cad('0x11c'),_0x1cad('0x11d'),_0x1cad('0x11e'),_0x1cad('0x11f'),_0x1cad('0x120'),_0x1cad('0x121'),_0x1cad('0x122'),_0x1cad('0x123'),_0x1cad('0x124'),'accessKey',_0x1cad('0x125'),'token',_0x1cad('0x126'),'accessToken','accessTokenSecret',_0x1cad('0x127'),'consumerKey',_0x1cad('0x128'),'membername','calleridname',_0x1cad('0x129'),'exten',_0x1cad('0x12a'),'clientEmail',_0x1cad('0x12b'),_0x1cad('0x12c'),'secretaccesskey',_0x1cad('0x12d'),_0x1cad('0x14'),'pass',_0x1cad('0x12e'),_0x1cad('0x12f'),_0x1cad('0x130'),_0x1cad('0x131'),'registry',_0x1cad('0x132')];function maskSensitiveData(_0x5e1eb0){var _0x5c88a7=/(?!^)[\s\S](?!$)/g;if(!_[_0x1cad('0x133')](_0x5e1eb0))return;for(var _0x1aa66d in _0x5e1eb0){if(_[_0x1cad('0x134')](_0x5e1eb0[_0x1aa66d])){for(var _0x333381=0x0;_0x333381<_0x5e1eb0[_0x1aa66d][_0x1cad('0x135')];_0x333381++){maskSensitiveData(_0x5e1eb0[_0x1aa66d][_0x333381]);}}else if(_[_0x1cad('0x133')](_0x5e1eb0[_0x1aa66d])){maskSensitiveData(_0x5e1eb0[_0x1aa66d]);}else if(_[_0x1cad('0x136')](_0x5e1eb0[_0x1aa66d])){_0x5e1eb0[_0x1aa66d]=_0x5e1eb0[_0x1aa66d][_0x1cad('0x137')](/{{{/g,_0x1cad('0x138'))[_0x1cad('0x137')](/}}}/g,_0x1cad('0x139'))[_0x1cad('0x137')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x1aa66d)){_0x5e1eb0[_0x1aa66d]=_0x5e1eb0[_0x1aa66d][_0x1cad('0x137')](_0x5c88a7,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 29d8dbb..55370e8 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f9a=['../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'];(function(_0x1d30a3,_0x5f428c){var _0x32bba1=function(_0x5a60cc){while(--_0x5a60cc){_0x1d30a3['push'](_0x1d30a3['shift']());}};_0x32bba1(++_0x5f428c);}(_0x0f9a,0x17b));var _0xa0f9=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x0f9a[_0x618414];return _0x21c19a;};'use strict';var jayson=require(_0xa0f9('0x0'));var BPromise=require(_0xa0f9('0x1'));var _=require(_0xa0f9('0x2'));var config=require(_0xa0f9('0x3'));exports[_0xa0f9('0x4')]=function(){return new BPromise(function(_0x2d6de9,_0x55ce1f){var _0x3790a1={};_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x6')));_0x3790a1=_['merge'](_0x3790a1,require('../api/voiceExtension/voiceExtension.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x7')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x8')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x9')));_0x3790a1=_['merge'](_0x3790a1,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0xa')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0xb')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0xc')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require('../api/trunk/trunk.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0xd')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0xe')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0xf')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x10')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require('../api/mailInteraction/mailInteraction.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require('../api/mailMessage/mailMessage.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x11')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x12')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x13')));_0x3790a1=_['merge'](_0x3790a1,require(_0xa0f9('0x14')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x15')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x16')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x17')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x18')));_0x3790a1=_['merge'](_0x3790a1,require(_0xa0f9('0x19')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require('../api/smsInteraction/smsInteraction.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x1a')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x1b')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x1c')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x1d')));_0x3790a1=_['merge'](_0x3790a1,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x3790a1=_['merge'](_0x3790a1,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x1e')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x1f')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require('../api/chatMessage/chatMessage.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x20')));_0x3790a1=_['merge'](_0x3790a1,require('../api/cmContact/cmContact.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x21')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x22')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x23')));_0x3790a1=_['merge'](_0x3790a1,require(_0xa0f9('0x24')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x25')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x26')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require('../api/pause/pause.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x27')));_0x3790a1=_['merge'](_0x3790a1,require(_0xa0f9('0x28')));_0x3790a1=_['merge'](_0x3790a1,require('../api/template/template.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x29')));_0x3790a1=_['merge'](_0x3790a1,require(_0xa0f9('0x2a')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x2b')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x2c')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x2d')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x2e')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x2f')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x30')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x31')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x32')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x33')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x34')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x35')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x36')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x37')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x38')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x39')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x3a')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x3b')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require('../api/campaign/campaign.rpc'));_0x3790a1=_['merge'](_0x3790a1,require('../api/attachment/attachment.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require('../api/plugin/plugin.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x3c')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require(_0xa0f9('0x3d')));_0x3790a1=_[_0xa0f9('0x5')](_0x3790a1,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3790a1=_['merge'](_0x3790a1,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x4f8d9e=jayson[_0xa0f9('0x3e')](_0x3790a1)[_0xa0f9('0x3f')]();var _0x1b661d=config[_0xa0f9('0x40')]['port']||config[_0xa0f9('0x41')]+0x1;var _0x25b790=config[_0xa0f9('0x40')]['ip']||_0xa0f9('0x42');_0x4f8d9e['on'](_0xa0f9('0x43'),function(_0x3aed98){return _0x55ce1f(_0x3aed98);});_0x4f8d9e[_0xa0f9('0x4')](_0x1b661d,_0x25b790,function(){console['log'](_0xa0f9('0x44'),_0x25b790,_0x1b661d);require(_0xa0f9('0x45'))['default']();return _0x2d6de9('RPC\x20listening\x20on\x20'+_0x25b790+':'+_0x1b661d);});});}; \ No newline at end of file +var _0x7ae7=['../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/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/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x7ae7,0xd9));var _0x77ae=function(_0x42c7e7,_0x357294){_0x42c7e7=_0x42c7e7-0x0;var _0x4f17aa=_0x7ae7[_0x42c7e7];return _0x4f17aa;};'use strict';var jayson=require(_0x77ae('0x0'));var BPromise=require(_0x77ae('0x1'));var _=require('lodash');var config=require(_0x77ae('0x2'));exports[_0x77ae('0x3')]=function(){return new BPromise(function(_0x176048,_0xf7c23c){var _0xa7b0de={};_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x5')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x6')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x7')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x8')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x9')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0xa')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0xb')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/memberReport/memberReport.rpc'));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0xc')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0xd')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0xe')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/mailServerIn/mailServerIn.rpc'));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0xf')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/mailQueue/mailQueue.rpc'));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x10')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x11')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x12')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/mailQueueReport/mailQueueReport.rpc'));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x13')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x14')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x15')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x16')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x17')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x18')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x19')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x1a')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x1b')));_0xa7b0de=_['merge'](_0xa7b0de,require('../api/smsQueue/smsQueue.rpc'));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/openchannelApplication/openchannelApplication.rpc'));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x1c')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x1d')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x1e')));_0xa7b0de=_['merge'](_0xa7b0de,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x1f')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/chatMessage/chatMessage.rpc'));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x20')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x21')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x22')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x23')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x24')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x25')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x26')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x27')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x28')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x29')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x2a')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x2b')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x2c')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x2d')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x2e')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/intZohoAccount/intZohoAccount.rpc'));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x2f')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x30')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x31')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x32')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x33')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/chatQueueReport/chatQueueReport.rpc'));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x34')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x35')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x36')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x37')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/squareOdbc/squareOdbc.rpc'));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x38')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x39')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x3a')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x3b')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/attachment/attachment.rpc'));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x3c')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x3d')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x3e')));_0xa7b0de=_['merge'](_0xa7b0de,require(_0x77ae('0x3f')));_0xa7b0de=_[_0x77ae('0x4')](_0xa7b0de,require(_0x77ae('0x40')));var _0x2aedee=jayson[_0x77ae('0x41')](_0xa7b0de)['http']();var _0x18a150=config['rpc'][_0x77ae('0x42')]||config['port']+0x1;var _0xf8834b=config['rpc']['ip']||_0x77ae('0x43');_0x2aedee['on'](_0x77ae('0x44'),function(_0x3d5e39){return _0xf7c23c(_0x3d5e39);});_0x2aedee[_0x77ae('0x3')](_0x18a150,_0xf8834b,function(){console['log'](_0x77ae('0x45'),_0xf8834b,_0x18a150);require(_0x77ae('0x46'))[_0x77ae('0x47')]();return _0x176048(_0x77ae('0x48')+_0xf8834b+':'+_0x18a150);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 6f8ffd1..242a81e 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 _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','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','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file +var _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x4bb52e,_0x2390d2){var _0x378759=function(_0xf59564){while(--_0xf59564){_0x4bb52e['push'](_0x4bb52e['shift']());}};_0x378759(++_0x2390d2);}(_0x70e0,0x17b));var _0x070e=function(_0x205d73,_0x1052ce){_0x205d73=_0x205d73-0x0;var _0x10dbc7=_0x70e0[_0x205d73];return _0x10dbc7;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 023b759..518de25 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 _0x6611=['format','apply','message','name','exports','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.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push'];(function(_0x69893c,_0x53a17b){var _0x492e50=function(_0x1ff777){while(--_0x1ff777){_0x69893c['push'](_0x69893c['shift']());}};_0x492e50(++_0x53a17b);}(_0x6611,0xdd));var _0x1661=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6611[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x1661('0x0'),'E_AGI_ARGUMENT_PORT':_0x1661('0x1'),'E_AGI_SERVER_ERROR':_0x1661('0x2'),'E_AGI_SERVER_CLOSE':_0x1661('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x1661('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x1661('0x5'),'E_AGI_SOCKET_ERROR':_0x1661('0x6'),'E_AGI_SOCKET_CLOSE':_0x1661('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x1661('0x8'),'E_AGI_COMMAND_EMPTY':_0x1661('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1661('0xa'),'E_AGI_IVR_ENTRY':_0x1661('0xb')};function AGIError(_0x58781d){var _0x58781d=_0x58781d||null,_0x3f32f3=_0x3f32f3||[],_0x3be60f=0x1,_0x57e4b8='';if(!error[_0x58781d]){_0x58781d='E_AGI_UNDEFINED';}_0x3f32f3[_0x1661('0xc')](error[_0x58781d]);while(arguments[_0x3be60f]){_0x3f32f3[_0x1661('0xc')](arguments[_0x3be60f]);_0x3be60f++;}_0x57e4b8=util[_0x1661('0xd')][_0x1661('0xe')](util,_0x3f32f3);this[_0x1661('0xf')]=_0x57e4b8;this[_0x1661('0x10')]=_0x58781d;}module[_0x1661('0x11')]=AGIError; \ No newline at end of file +var _0x3a16=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','util','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3a16,0x192));var _0x63a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a16[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x63a1('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x63a1('0x1'),'E_AGI_SERVER_CLOSE':_0x63a1('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x63a1('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x63a1('0x4'),'E_AGI_SOCKET_CLOSE':_0x63a1('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x63a1('0x6'),'E_AGI_COMMAND_EMPTY':_0x63a1('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x63a1('0x8'),'E_AGI_IVR_ENTRY':_0x63a1('0x9')};function AGIError(_0x14a8eb){var _0x14a8eb=_0x14a8eb||null,_0x5a4e22=_0x5a4e22||[],_0x12df39=0x1,_0x253e62='';if(!error[_0x14a8eb]){_0x14a8eb=_0x63a1('0xa');}_0x5a4e22['push'](error[_0x14a8eb]);while(arguments[_0x12df39]){_0x5a4e22[_0x63a1('0xb')](arguments[_0x12df39]);_0x12df39++;}_0x253e62=util[_0x63a1('0xc')][_0x63a1('0xd')](util,_0x5a4e22);this[_0x63a1('0xe')]=_0x253e62;this['name']=_0x14a8eb;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 4c53553..d12a9af 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 _0xaa5e=['getdigits','getsecretdigits','vertices','edges','prototype','addVertex','addEdge','numberOfEdges','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','condition','split','agicommand','vswitch','default','target','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','exports','lodash','../../../config/logger','menu'];(function(_0x15e49b,_0x44cdd5){var _0x55e549=function(_0xe2f55c){while(--_0xe2f55c){_0x15e49b['push'](_0x15e49b['shift']());}};_0x55e549(++_0x44cdd5);}(_0xaa5e,0xa5));var _0xeaa5=function(_0xc0fe3f,_0x3476db){_0xc0fe3f=_0xc0fe3f-0x0;var _0x11aa02=_0xaa5e[_0xc0fe3f];return _0x11aa02;};'use strict';var _=require(_0xeaa5('0x0'));var logger=require(_0xeaa5('0x1'))('agi');var verticesWithRetry=[_0xeaa5('0x2'),_0xeaa5('0x3'),_0xeaa5('0x4')];var Graph=function(){this[_0xeaa5('0x5')]={};this[_0xeaa5('0x6')]={};this['numberOfEdges']=0x0;};Graph[_0xeaa5('0x7')][_0xeaa5('0x8')]=function(_0x33d376){this[_0xeaa5('0x5')][_0x33d376['id']]=_0x33d376;this['edges'][_0x33d376['id']]=[];};Graph['prototype'][_0xeaa5('0x9')]=function(_0x2c9696,_0x50cb62,_0x2e35c3){this[_0xeaa5('0x6')][_0x2c9696]['push']({'target':_0x50cb62,'condition':_0x2e35c3});this[_0xeaa5('0xa')]+=0x1;};Graph['prototype'][_0xeaa5('0xb')]=function(){return _[_0xeaa5('0xb')](this['vertices']);};Graph[_0xeaa5('0x7')][_0xeaa5('0xc')]=function(){return this[_0xeaa5('0xa')];};Graph[_0xeaa5('0x7')][_0xeaa5('0xd')]=function(_0x6f18de){return this[_0xeaa5('0x5')][_0x6f18de];};Graph[_0xeaa5('0x7')][_0xeaa5('0xe')]=function(_0x47a779,_0x3ae823){if(!this[_0xeaa5('0x5')][_0x47a779]){return logger[_0xeaa5('0xf')](_0xeaa5('0x10'));}var _0x18ca75=_0x3ae823(this['vertices'][_0x47a779]);if(!_0x18ca75){return logger[_0xeaa5('0xf')]('stop\x20traverse');}if(this[_0xeaa5('0x6')][_0x47a779][_0xeaa5('0x11')]===0x0){return logger[_0xeaa5('0xf')]('no\x20edge/s\x20available');}for(var _0x1cc157=0x0,_0x5a0fed=[],_0x44e4b4=![];_0x1cc157\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','addVertex','mxCell','isArray','source','target','addEdge','value','then','catch','createSquareReport','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','hangup','production','start','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc','context','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','[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','Project\x20%s\x20not\x20found','getLicense'];(function(_0x1f9337,_0x4c616c){var _0x481eeb=function(_0x474fd8){while(--_0x474fd8){_0x1f9337['push'](_0x1f9337['shift']());}};_0x481eeb(++_0x4c616c);}(_0x5178,0x171));var _0x8517=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5178[_0x2d7f0e];return _0x110b07;};'use strict';var parser=require('xml2json');var _=require(_0x8517('0x0'));var syncho=require(_0x8517('0x1'));var util=require(_0x8517('0x2'));var moment=require(_0x8517('0x3'));var config=require(_0x8517('0x4'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x8517('0x5'));var rpc=require(_0x8517('0x6'));var mailRpc=require('./mailRpc');var Graph=require(_0x8517('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x8517('0x8')]=_[_0x8517('0x9')](config[_0x8517('0x8')],{'ip':_0x8517('0xa'),'port':0x11dd});function connectionHandler(_0x25146d){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x25146d);agiHandler(_0x25146d);}catch(_0x46f6aa){logger['error'](_0x46f6aa['stack']);}});});}function listeningHandler(){console[_0x8517('0xb')](_0x8517('0xc'),config['agi'][_0x8517('0xd')]);logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x10'),config[_0x8517('0x8')]['ip'],config[_0x8517('0x8')][_0x8517('0xd')]));}function errorHandler(_0x12388f){if(_0x12388f&&_0x12388f['name']&&_0x12388f[_0x8517('0x11')]){logger[_0x8517('0x12')](util[_0x8517('0xf')](_0x8517('0x13'),_0x12388f[_0x8517('0x14')],_0x12388f['message']));}else{logger[_0x8517('0x12')](util[_0x8517('0xf')](_0x8517('0x15'),_0x12388f[_0x8517('0x16')]));}}function closeHandler(){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x17'),this[_0x8517('0x18')],this[_0x8517('0x19')],this[_0x8517('0x1a')],this[_0x8517('0x1b')],this[_0x8517('0x1c')]));try{createSquareReport(this);}catch(_0x50e2de){logger[_0x8517('0x12')](_0x50e2de[_0x8517('0x16')]);}}function timeoutHandler(){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x1d'),this[_0x8517('0x18')],this[_0x8517('0x19')],this['callerid'],this[_0x8517('0x1b')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x8517('0xf')](_0x8517('0x1e'),this[_0x8517('0x18')],this[_0x8517('0x19')],this[_0x8517('0x1a')],this[_0x8517('0x1b')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x2dd1df){return parser[_0x8517('0x1f')](_0x2dd1df,{'object':!![]})[_0x8517('0x20')][_0x8517('0x21')];}function addVertex(_0x3a5f0b,_0x2e6e47,_0x5f02ee){_0x2e6e47[_0x8517('0x22')]=_0x5f02ee;if(_0x2e6e47[_0x8517('0x23')]('retry')){_0x2e6e47[_0x8517('0x24')]=parseInt(_0x2e6e47[_0x8517('0x25')],0xa);}_0x3a5f0b[_0x8517('0x26')](_['omit'](_0x2e6e47,_0x8517('0x27')));}function initGraph(_0x572ce4,_0x2880b6){var _0x2a2b7e=new Graph();for(var _0x448211 in _0x572ce4){if(_0x572ce4[_0x8517('0x23')](_0x448211)){if(_[_0x8517('0x28')](_0x572ce4[_0x448211])){for(var _0x300e3f=0x0;_0x300e3f<_0x572ce4[_0x448211]['length'];_0x300e3f+=0x1){addVertex(_0x2a2b7e,_0x572ce4[_0x448211][_0x300e3f],_0x448211);}}else{addVertex(_0x2a2b7e,_0x572ce4[_0x448211],_0x448211);}}}for(var _0x39764e=0x0;_0x39764e<_0x2880b6['length'];_0x39764e+=0x1){if(_0x2880b6[_0x39764e][_0x8517('0x29')]&&_0x2880b6[_0x39764e][_0x8517('0x2a')]){_0x2a2b7e[_0x8517('0x2b')](_0x2880b6[_0x39764e][_0x8517('0x29')],_0x2880b6[_0x39764e][_0x8517('0x2a')],_0x2880b6[_0x39764e][_0x8517('0x2c')]);}}return _0x2a2b7e;}function getSquareProject(_0x4c691f,_0x20ec0a){rpc['getSquareProject'](_0x4c691f)[_0x8517('0x2d')](function(_0x4b9983){_0x20ec0a(null,_0x4b9983);})[_0x8517('0x2e')](function(_0x2d360c){_0x20ec0a(null,_0x2d360c);});}function createSquareReport(_0x3cf945,_0x14eb04){rpc[_0x8517('0x2f')](_0x3cf945)[_0x8517('0x2d')](function(_0x647d81){if(_0x14eb04){_0x14eb04(null,_0x647d81);}})['catch'](function(_0x3e8f81){if(_0x14eb04){_0x14eb04(null,_0x3e8f81);}});}function setChannelVariables(_0x1031b3){for(var _0x773e3c in _0x1031b3){if(_0x1031b3['hasOwnProperty'](_0x773e3c)){if(_0x773e3c['indexOf']('agi_')===0x0){_0x1031b3[_0x773e3c[_0x8517('0x30')](0x4)]=_0x1031b3[_0x773e3c];delete _0x1031b3[_0x773e3c];}}}}function getLogFromObject(_0x4102b4){return util[_0x8517('0x31')](_0x4102b4,{'showHidden':![],'depth':null});}function agiHandler(_0x2abad4){var _0x5ed2a9,_0x254566,_0x5d9d04,_0x19dd26,_0x234da4;logger[_0x8517('0x32')]('variables',JSON[_0x8517('0x33')](_0x2abad4,null,0x2));logger['info'](util[_0x8517('0xf')](_0x8517('0x34'),_0x2abad4['arg_1'],_0x2abad4['calleridname'],_0x2abad4[_0x8517('0x1a')],_0x2abad4[_0x8517('0x1b')],_0x2abad4[_0x8517('0x1c')]));_0x2abad4['on'](_0x8517('0x12'),errorHandler);_0x2abad4['on']('close',closeHandler);_0x2abad4['on']('timeout',timeoutHandler);_0x2abad4[_0x8517('0x35')]=![];_0x2abad4['on'](_0x8517('0x36'),hangupHandler);var _0x1835ac=getSquareProject['sync'](null,_0x2abad4[_0x8517('0x18')]);if(_0x1835ac){if(_0x1835ac[_0x8517('0x37')]){_0x5ed2a9=getRoot(_0x1835ac['production']);if(_0x5ed2a9&&_0x5ed2a9[_0x8517('0x38')]){logger[_0x8517('0x32')](_0x8517('0x21'),JSON[_0x8517('0x33')](_0x5ed2a9,null,0x2));_0x2abad4['joinAt']=moment()[_0x8517('0xf')](_0x8517('0x39'));_0x254566=initGraph(_[_0x8517('0x3a')](_0x5ed2a9,_0x8517('0x27')),_0x5ed2a9[_0x8517('0x27')]);_0x5d9d04=new Vertices(_0x2abad4,rpc,mailRpc);logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x3b'),_0x2abad4[_0x8517('0x18')],_0x2abad4[_0x8517('0x19')],_0x2abad4[_0x8517('0x1a')],_0x2abad4[_0x8517('0x1b')],_0x2abad4[_0x8517('0x1c')]));_0x254566['traverseBFS'](_0x5ed2a9['start']['id'],function(_0x3f1219){try{_0x3f1219=_0x5d9d04[_0x8517('0x3c')](_0x3f1219);logger[_0x8517('0x32')](_0x8517('0x3d'),JSON[_0x8517('0x33')](_0x3f1219,null,0x2));if(_0x3f1219['agicommand']===_0x8517('0x3e')){logger[_0x8517('0xe')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x2abad4[_0x8517('0x3f')]=_0x3f1219[_0x8517('0x3f')]||_0x2abad4[_0x8517('0x3f')];_0x2abad4[_0x8517('0x40')]=_0x3f1219['extension'];_0x2abad4[_0x8517('0x41')]=_0x3f1219[_0x8517('0x41')]?_0x3f1219['priority']-0x1:0x1;return null;}else if(_0x3f1219&&_0x5d9d04[_0x3f1219[_0x8517('0x22')]]){_0x234da4=_0x5d9d04[_0x3f1219[_0x8517('0x22')]](_0x3f1219);logger[_0x8517('0xe')]('response',JSON[_0x8517('0x33')](_0x234da4,null,0x2));if(_0x234da4&&_0x234da4[_0x8517('0x42')]===AGI_CODE_SUCCESS&&_0x234da4[_0x8517('0x43')]!==AGI_RESULT_ERROR&&!_0x2abad4[_0x8517('0x35')]){logger[_0x8517('0x32')](_0x8517('0x44'),getLogFromObject(_0x234da4));return _[_0x8517('0x45')](_0x234da4['result'])?null:_0x234da4[_0x8517('0x43')][_0x8517('0x46')]();}else{logger['error'](_0x8517('0x44'),getLogFromObject(_0x234da4));return null;}}else{logger[_0x8517('0x12')](_0x8517('0x47'));return null;}}catch(_0x333553){logger[_0x8517('0x12')](_0x333553[_0x8517('0x16')]);return null;}});if(_0x5ed2a9['finally']){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x48'),_0x2abad4['arg_1'],_0x2abad4[_0x8517('0x19')],_0x2abad4[_0x8517('0x1a')],_0x2abad4['dnid'],_0x2abad4[_0x8517('0x1c')]));_0x254566[_0x8517('0x49')](_0x5ed2a9['finally']['id'],function(_0x54b346){try{_0x54b346=_0x5d9d04['clear'](_0x54b346);logger[_0x8517('0x32')](_0x8517('0x3d'),JSON['stringify'](_0x54b346,null,0x2));if(_0x54b346&&_0x5d9d04[_0x54b346[_0x8517('0x22')]]){_0x234da4=_0x5d9d04[_0x54b346['agicommand']](_0x54b346);if(_0x234da4){logger['debug'](_0x8517('0x44'),getLogFromObject(_0x234da4));return _[_0x8517('0x45')](_0x234da4[_0x8517('0x43')])?null:_0x234da4[_0x8517('0x43')]['toString']();}else{logger[_0x8517('0x12')](_0x8517('0x44'),getLogFromObject(_0x234da4));return null;}}else{logger[_0x8517('0x12')]('agicommand\x20not\x20found');return null;}}catch(_0x15102f){logger[_0x8517('0x12')](_0x15102f[_0x8517('0x16')]);return null;}});}logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x4a'),_0x2abad4[_0x8517('0x18')],_0x2abad4['calleridname'],_0x2abad4[_0x8517('0x1a')],_0x2abad4['dnid'],_0x2abad4['uniqueid']));logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x4b'),_0x2abad4[_0x8517('0x3f')],_0x2abad4['extension'],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1));_0x2abad4[_0x8517('0x4c')](_0x2abad4['context'],_0x2abad4['extension'],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1);_0x2abad4[_0x8517('0x4d')]();}}else{logger[_0x8517('0x12')](util['format'](_0x8517('0x4e'),_0x2abad4['arg_1']));_0x2abad4[_0x8517('0x4c')](_0x2abad4[_0x8517('0x3f')],_0x2abad4[_0x8517('0x40')],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1);_0x2abad4[_0x8517('0x4d')]();}}else{logger[_0x8517('0x12')](util[_0x8517('0xf')](_0x8517('0x4f'),_0x2abad4[_0x8517('0x18')]));_0x2abad4['continueAt'](_0x2abad4['context'],_0x2abad4[_0x8517('0x40')],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1);_0x2abad4[_0x8517('0x4d')]();}}function main(){var _0x5e82ab;return utilLicense[_0x8517('0x50')]()[_0x8517('0x2d')](function(_0x445f9b){if(_0x445f9b){if(_0x445f9b['voice']){if(_0x445f9b['callysquare']&&_0x445f9b[_0x8517('0x51')]>0x0){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x52'),_0x445f9b[_0x8517('0x51')]));_0x5e82ab=_0x445f9b[_0x8517('0x51')];}else{logger[_0x8517('0xe')](_0x8517('0x53'));}}else{logger[_0x8517('0xe')](_0x8517('0x54'));_0x5e82ab=-0x1;}}})[_0x8517('0x2e')](function(_0x3c5462){logger[_0x8517('0x12')](_0x8517('0x55'),_0x3c5462[_0x8517('0x16')]);})[_0x8517('0x56')](function(){var _0x5c3932=require(_0x8517('0x57'))(config[_0x8517('0x8')][_0x8517('0xd')],config[_0x8517('0x8')]['ip'],_0x5e82ab);_0x5c3932['on'](_0x8517('0x12'),errorHandler);_0x5c3932['on'](_0x8517('0x58'),listeningHandler);_0x5c3932['on'](_0x8517('0x59'),connectionHandler);_0x5c3932['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x8958=['[%s]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','root','retry','maxRetry','addVertex','mxCell','hasOwnProperty','length','source','target','value','catch','then','indexOf','agi_','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','priority','response','code','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','agicommand','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','context','extension','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','connection','lodash','../../config/logger','../../config/license/util','./rpc','./mailRpc','./vertices','agi','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message'];(function(_0x124b15,_0x4b257){var _0x147a0e=function(_0x302ca0){while(--_0x302ca0){_0x124b15['push'](_0x124b15['shift']());}};_0x147a0e(++_0x4b257);}(_0x8958,0x93));var _0x8895=function(_0x1c7c34,_0x3ef891){_0x1c7c34=_0x1c7c34-0x0;var _0x1c4cd1=_0x8958[_0x1c7c34];return _0x1c4cd1;};'use strict';var parser=require('xml2json');var _=require(_0x8895('0x0'));var syncho=require('syncho');var util=require('util');var moment=require('moment');var config=require('../../config/environment');var logger=require(_0x8895('0x1'))('agi');var utilLicense=require(_0x8895('0x2'));var rpc=require(_0x8895('0x3'));var mailRpc=require(_0x8895('0x4'));var Graph=require('./graph');var Vertices=require(_0x8895('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x8895('0x6')]=_[_0x8895('0x7')](config[_0x8895('0x6')],{'ip':_0x8895('0x8'),'port':0x11dd});function connectionHandler(_0x51376b){process[_0x8895('0x9')](function(){syncho(function(){try{setChannelVariables(_0x51376b);agiHandler(_0x51376b);}catch(_0xc2be9f){logger[_0x8895('0xa')](_0xc2be9f[_0x8895('0xb')]);}});});}function listeningHandler(){console[_0x8895('0xc')](_0x8895('0xd'),config[_0x8895('0x6')][_0x8895('0xe')]);logger[_0x8895('0xf')](util[_0x8895('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x8895('0x6')]['ip'],config[_0x8895('0x6')][_0x8895('0xe')]));}function errorHandler(_0x301bec){if(_0x301bec&&_0x301bec[_0x8895('0x11')]&&_0x301bec[_0x8895('0x12')]){logger['error'](util[_0x8895('0x10')](_0x8895('0x13'),_0x301bec[_0x8895('0x11')],_0x301bec['message']));}else{logger['error'](util[_0x8895('0x10')]('[ERROR]\x20%s',_0x301bec[_0x8895('0xb')]));}}function closeHandler(){logger[_0x8895('0xf')](util[_0x8895('0x10')](_0x8895('0x14'),this[_0x8895('0x15')],this['calleridname'],this[_0x8895('0x16')],this[_0x8895('0x17')],this[_0x8895('0x18')]));try{createSquareReport(this);}catch(_0xcdd661){logger[_0x8895('0xa')](_0xcdd661[_0x8895('0xb')]);}}function timeoutHandler(){logger[_0x8895('0xf')](util[_0x8895('0x10')](_0x8895('0x19'),this[_0x8895('0x15')],this[_0x8895('0x1a')],this[_0x8895('0x16')],this[_0x8895('0x17')],this['uniqueid']));}function hangupHandler(){logger['info'](util['format'](_0x8895('0x1b'),this[_0x8895('0x15')],this[_0x8895('0x1a')],this[_0x8895('0x16')],this[_0x8895('0x17')],this[_0x8895('0x18')]));this[_0x8895('0x1c')]=!![];}function getRoot(_0xc1ce17){return parser['toJson'](_0xc1ce17,{'object':!![]})[_0x8895('0x1d')][_0x8895('0x1e')];}function addVertex(_0x2a403,_0x1f71f3,_0x29223d){_0x1f71f3['agicommand']=_0x29223d;if(_0x1f71f3['hasOwnProperty'](_0x8895('0x1f'))){_0x1f71f3[_0x8895('0x20')]=parseInt(_0x1f71f3[_0x8895('0x1f')],0xa);}_0x2a403[_0x8895('0x21')](_['omit'](_0x1f71f3,_0x8895('0x22')));}function initGraph(_0x1e8ac9,_0x187a15){var _0x5486a6=new Graph();for(var _0x4aee03 in _0x1e8ac9){if(_0x1e8ac9[_0x8895('0x23')](_0x4aee03)){if(_['isArray'](_0x1e8ac9[_0x4aee03])){for(var _0x3d51b0=0x0;_0x3d51b0<_0x1e8ac9[_0x4aee03][_0x8895('0x24')];_0x3d51b0+=0x1){addVertex(_0x5486a6,_0x1e8ac9[_0x4aee03][_0x3d51b0],_0x4aee03);}}else{addVertex(_0x5486a6,_0x1e8ac9[_0x4aee03],_0x4aee03);}}}for(var _0x10b48f=0x0;_0x10b48f<_0x187a15[_0x8895('0x24')];_0x10b48f+=0x1){if(_0x187a15[_0x10b48f][_0x8895('0x25')]&&_0x187a15[_0x10b48f]['target']){_0x5486a6['addEdge'](_0x187a15[_0x10b48f][_0x8895('0x25')],_0x187a15[_0x10b48f][_0x8895('0x26')],_0x187a15[_0x10b48f][_0x8895('0x27')]);}}return _0x5486a6;}function getSquareProject(_0x16b65b,_0x19b6dd){rpc['getSquareProject'](_0x16b65b)['then'](function(_0x46ae32){_0x19b6dd(null,_0x46ae32);})[_0x8895('0x28')](function(_0x1c16f6){_0x19b6dd(null,_0x1c16f6);});}function createSquareReport(_0x29f565,_0x1eabb6){rpc['createSquareReport'](_0x29f565)[_0x8895('0x29')](function(_0x5d2f33){if(_0x1eabb6){_0x1eabb6(null,_0x5d2f33);}})[_0x8895('0x28')](function(_0x5b2b19){if(_0x1eabb6){_0x1eabb6(null,_0x5b2b19);}});}function setChannelVariables(_0x40ba14){for(var _0x1a3fe5 in _0x40ba14){if(_0x40ba14[_0x8895('0x23')](_0x1a3fe5)){if(_0x1a3fe5[_0x8895('0x2a')](_0x8895('0x2b'))===0x0){_0x40ba14[_0x1a3fe5['substring'](0x4)]=_0x40ba14[_0x1a3fe5];delete _0x40ba14[_0x1a3fe5];}}}}function getLogFromObject(_0x2c54a0){return util[_0x8895('0x2c')](_0x2c54a0,{'showHidden':![],'depth':null});}function agiHandler(_0x1b5359){var _0x34cb11,_0x330692,_0x574f0e,_0x2880a6,_0x5f0a79;logger[_0x8895('0x2d')]('variables',JSON[_0x8895('0x2e')](_0x1b5359,null,0x2));logger[_0x8895('0xf')](util[_0x8895('0x10')](_0x8895('0x2f'),_0x1b5359[_0x8895('0x15')],_0x1b5359['calleridname'],_0x1b5359[_0x8895('0x16')],_0x1b5359['dnid'],_0x1b5359[_0x8895('0x18')]));_0x1b5359['on'](_0x8895('0xa'),errorHandler);_0x1b5359['on'](_0x8895('0x30'),closeHandler);_0x1b5359['on'](_0x8895('0x31'),timeoutHandler);_0x1b5359[_0x8895('0x1c')]=![];_0x1b5359['on'](_0x8895('0x32'),hangupHandler);var _0x4b7fe0=getSquareProject[_0x8895('0x33')](null,_0x1b5359[_0x8895('0x15')]);if(_0x4b7fe0){if(_0x4b7fe0['production']){_0x34cb11=getRoot(_0x4b7fe0[_0x8895('0x34')]);if(_0x34cb11&&_0x34cb11['start']){logger[_0x8895('0x2d')](_0x8895('0x1e'),JSON['stringify'](_0x34cb11,null,0x2));_0x1b5359[_0x8895('0x35')]=moment()[_0x8895('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x330692=initGraph(_['omit'](_0x34cb11,_0x8895('0x22')),_0x34cb11[_0x8895('0x22')]);_0x574f0e=new Vertices(_0x1b5359,rpc,mailRpc);logger[_0x8895('0xf')](util[_0x8895('0x10')](_0x8895('0x36'),_0x1b5359['arg_1'],_0x1b5359[_0x8895('0x1a')],_0x1b5359[_0x8895('0x16')],_0x1b5359[_0x8895('0x17')],_0x1b5359[_0x8895('0x18')]));_0x330692[_0x8895('0x37')](_0x34cb11[_0x8895('0x38')]['id'],function(_0x4a7e22){try{_0x4a7e22=_0x574f0e[_0x8895('0x39')](_0x4a7e22);logger['debug'](_0x8895('0x3a'),JSON[_0x8895('0x2e')](_0x4a7e22,null,0x2));if(_0x4a7e22['agicommand']===_0x8895('0x3b')){logger['info'](_0x8895('0x3c'));_0x1b5359['context']=_0x4a7e22['context']||_0x1b5359['context'];_0x1b5359['extension']=_0x4a7e22['extension'];_0x1b5359['priority']=_0x4a7e22[_0x8895('0x3d')]?_0x4a7e22[_0x8895('0x3d')]-0x1:0x1;return null;}else if(_0x4a7e22&&_0x574f0e[_0x4a7e22['agicommand']]){_0x5f0a79=_0x574f0e[_0x4a7e22['agicommand']](_0x4a7e22);logger[_0x8895('0xf')](_0x8895('0x3e'),JSON['stringify'](_0x5f0a79,null,0x2));if(_0x5f0a79&&_0x5f0a79[_0x8895('0x3f')]===AGI_CODE_SUCCESS&&_0x5f0a79[_0x8895('0x40')]!==AGI_RESULT_ERROR&&!_0x1b5359[_0x8895('0x1c')]){logger[_0x8895('0x2d')](_0x8895('0x3e'),getLogFromObject(_0x5f0a79));return _['isUndefined'](_0x5f0a79['result'])?null:_0x5f0a79['result'][_0x8895('0x41')]();}else{logger['error'](_0x8895('0x3e'),getLogFromObject(_0x5f0a79));return null;}}else{logger[_0x8895('0xa')](_0x8895('0x42'));return null;}}catch(_0x28aaa9){logger['error'](_0x28aaa9[_0x8895('0xb')]);return null;}});if(_0x34cb11[_0x8895('0x43')]){logger[_0x8895('0xf')](util[_0x8895('0x10')](_0x8895('0x44'),_0x1b5359[_0x8895('0x15')],_0x1b5359[_0x8895('0x1a')],_0x1b5359[_0x8895('0x16')],_0x1b5359['dnid'],_0x1b5359[_0x8895('0x18')]));_0x330692[_0x8895('0x37')](_0x34cb11['finally']['id'],function(_0x35db2d){try{_0x35db2d=_0x574f0e['clear'](_0x35db2d);logger['debug'](_0x8895('0x3a'),JSON[_0x8895('0x2e')](_0x35db2d,null,0x2));if(_0x35db2d&&_0x574f0e[_0x35db2d[_0x8895('0x45')]]){_0x5f0a79=_0x574f0e[_0x35db2d['agicommand']](_0x35db2d);if(_0x5f0a79){logger[_0x8895('0x2d')]('response',getLogFromObject(_0x5f0a79));return _[_0x8895('0x46')](_0x5f0a79[_0x8895('0x40')])?null:_0x5f0a79[_0x8895('0x40')][_0x8895('0x41')]();}else{logger[_0x8895('0xa')](_0x8895('0x3e'),getLogFromObject(_0x5f0a79));return null;}}else{logger[_0x8895('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x47c4b9){logger[_0x8895('0xa')](_0x47c4b9[_0x8895('0xb')]);return null;}});}logger['info'](util[_0x8895('0x10')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1b5359['arg_1'],_0x1b5359[_0x8895('0x1a')],_0x1b5359['callerid'],_0x1b5359[_0x8895('0x17')],_0x1b5359[_0x8895('0x18')]));logger[_0x8895('0xf')](util[_0x8895('0x10')](_0x8895('0x47'),_0x1b5359[_0x8895('0x48')],_0x1b5359[_0x8895('0x49')],parseInt(_0x1b5359[_0x8895('0x3d')],0xa)+0x1));_0x1b5359['continueAt'](_0x1b5359[_0x8895('0x48')],_0x1b5359[_0x8895('0x49')],parseInt(_0x1b5359[_0x8895('0x3d')],0xa)+0x1);_0x1b5359['close']();}}else{logger[_0x8895('0xa')](util[_0x8895('0x10')](_0x8895('0x4a'),_0x1b5359[_0x8895('0x15')]));_0x1b5359[_0x8895('0x4b')](_0x1b5359[_0x8895('0x48')],_0x1b5359[_0x8895('0x49')],parseInt(_0x1b5359[_0x8895('0x3d')],0xa)+0x1);_0x1b5359[_0x8895('0x30')]();}}else{logger[_0x8895('0xa')](util['format'](_0x8895('0x4c'),_0x1b5359[_0x8895('0x15')]));_0x1b5359[_0x8895('0x4b')](_0x1b5359[_0x8895('0x48')],_0x1b5359[_0x8895('0x49')],parseInt(_0x1b5359['priority'],0xa)+0x1);_0x1b5359[_0x8895('0x30')]();}}function main(){var _0x38c88f;return utilLicense[_0x8895('0x4d')]()[_0x8895('0x29')](function(_0x37a7b4){if(_0x37a7b4){if(_0x37a7b4['voice']){if(_0x37a7b4[_0x8895('0x4e')]&&_0x37a7b4[_0x8895('0x4e')]>0x0){logger[_0x8895('0xf')](util['format'](_0x8895('0x4f'),_0x37a7b4[_0x8895('0x4e')]));_0x38c88f=_0x37a7b4[_0x8895('0x4e')];}else{logger['info'](_0x8895('0x50'));}}else{logger[_0x8895('0xf')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x38c88f=-0x1;}}})[_0x8895('0x28')](function(_0x26f68c){logger['error'](_0x8895('0x51'),_0x26f68c[_0x8895('0xb')]);})[_0x8895('0x43')](function(){var _0x3caa6c=require('./server')(config['agi'][_0x8895('0xe')],config[_0x8895('0x6')]['ip'],_0x38c88f);_0x3caa6c['on'](_0x8895('0xa'),errorHandler);_0x3caa6c['on']('listening',listeningHandler);_0x3caa6c['on'](_0x8895('0x52'),connectionHandler);_0x3caa6c['on'](_0x8895('0x30'),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 ceb8bff..ee84bc2 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 _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0xd9e7d2,_0x1c0c86){var _0x1e86ee=function(_0x1f5709){while(--_0x1f5709){_0xd9e7d2['push'](_0xd9e7d2['shift']());}};_0x1e86ee(++_0x1c0c86);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x24c729,_0x1f85d4){var _0x1812ae=function(_0x49c8fa){while(--_0x49c8fa){_0x24c729['push'](_0x24c729['shift']());}};_0x1812ae(++_0x1f85d4);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 9c25d60..ed80126 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 _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x28cef5,_0x5ed280){var _0x5b4cf3=function(_0x5530bb){while(--_0x5530bb){_0x28cef5['push'](_0x28cef5['shift']());}};_0x5b4cf3(++_0x5ed280);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1fbb39,_0x3d1b4f){_0x1fbb39=_0x1fbb39-0x0;var _0x52f309=_0x5f2f[_0x1fbb39];return _0x52f309;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x275e44,_0x12af3a){var _0x44dfd3=function(_0x30c942){while(--_0x30c942){_0x275e44['push'](_0x275e44['shift']());}};_0x44dfd3(++_0x12af3a);}(_0x7a54,0x106));var _0x47a5=function(_0x142228,_0x250241){_0x142228=_0x142228-0x0;var _0x295fa1=_0x7a54[_0x142228];return _0x295fa1;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index ec8f826..511f7cf 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 _0xe265=['ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','client','http','then','error','message','result','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','getIntervalById','ShowInterval','Interval','getSmsAccountById','CreateSmsMessage','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','phone','getPauseById'];(function(_0x813d0a,_0x4fd3d7){var _0x241352=function(_0x3ca375){while(--_0x3ca375){_0x813d0a['push'](_0x813d0a['shift']());}};_0x241352(++_0x4fd3d7);}(_0xe265,0x111));var _0x5e26=function(_0xacc1e4,_0x1e1120){_0xacc1e4=_0xacc1e4-0x0;var _0x2a7731=_0xe265[_0xacc1e4];return _0x2a7731;};'use strict';var BPromise=require(_0x5e26('0x0'));var moment=require(_0x5e26('0x1'));var _=require('lodash');var util=require(_0x5e26('0x2'));var jayson=require(_0x5e26('0x3'));var client=jayson[_0x5e26('0x4')][_0x5e26('0x5')]({'port':0x2329});function request(_0x32ef80,_0x59e306){return new BPromise(function(_0x244ea1,_0x3496e7){return client['request'](_0x32ef80,_0x59e306)[_0x5e26('0x6')](function(_0x4999f4){if(_0x4999f4[_0x5e26('0x7')]){return _0x3496e7(_0x4999f4['error'][_0x5e26('0x8')]);}else{return _0x244ea1(_0x4999f4[_0x5e26('0x9')]);}})[_0x5e26('0xa')](function(_0x5d5419){return _0x3496e7(_0x5d5419);});});}exports['getSquareProject']=function(_0x166885){return request(_0x5e26('0xb'),{'options':{'raw':![],'where':{'name':_0x166885},'attributes':[_0x5e26('0xc')]}});};exports[_0x5e26('0xd')]=function(_0x34af5d){return request(_0x5e26('0xe'),{'options':{'raw':![],'where':{'id':_0x34af5d},'include':[{'model':_0x5e26('0xf'),'as':'Smtp'}],'attributes':['id',_0x5e26('0x10'),_0x5e26('0x11')]}});};exports['getSquareProjectById']=function(_0x155333){return request(_0x5e26('0xb'),{'options':{'where':{'id':_0x155333},'attributes':[_0x5e26('0x10')]}});};exports[_0x5e26('0x12')]=function(_0x2454c1){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x2454c1},'attributes':[_0x5e26('0x10')]}});};exports[_0x5e26('0x13')]=function(_0x25ca2e){return request(_0x5e26('0x14'),{'options':{'where':{'id':_0x25ca2e},'attributes':['name']}});};exports[_0x5e26('0x15')]=function(_0x553f71){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x553f71},'attributes':[_0x5e26('0x16')]}});};exports[_0x5e26('0x17')]=function(_0x496573){return request(_0x5e26('0x18'),{'options':{'where':{'id':_0x496573},'attributes':[_0x5e26('0x10')]}});};exports[_0x5e26('0x19')]=function(_0x404335){return request(_0x5e26('0x1a'),{'options':{'where':{'id':_0x404335},'attributes':[_0x5e26('0x10')]}});};exports[_0x5e26('0x1b')]=function(_0x3f694e){return request('ShowSound',{'options':{'where':{'id':_0x3f694e},'attributes':['save_name']}});};exports[_0x5e26('0x1c')]=function(_0x5ce0d0){return request(_0x5e26('0x1d'),{'options':{'raw':![],'where':{'id':_0x5ce0d0},'include':[{'model':_0x5e26('0x1e'),'as':'Intervals'}]}});};exports[_0x5e26('0x1f')]=function(_0x1cc0e1){return request('ShowSmsAccount',{'options':{'where':{'id':_0x1cc0e1},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x35c820){return request(_0x5e26('0x20'),{'body':_0x35c820});};exports['createSquareDetailsReport']=function(_0x52eedd){return request(_0x5e26('0x21'),{'body':_0x52eedd});};exports['createSquareReport']=function(_0x100a55){return request(_0x5e26('0x22'),{'body':_[_0x5e26('0x23')](_0x100a55,{'project_name':_0x100a55[_0x5e26('0x24')],'prev_project_name':_0x100a55[_0x5e26('0x25')]||'','is_subproject':_0x100a55[_0x5e26('0x25')]?!![]:![],'leaveAt':moment()[_0x5e26('0x26')](_0x5e26('0x27'))})});};exports[_0x5e26('0x28')]=function(_0x4bd54e){return request(_0x5e26('0x29'),{'body':_0x4bd54e});};exports[_0x5e26('0x2a')]=function(_0x5e3f6b){return request('CreateSquareMessage',{'body':_0x5e3f6b});};exports['createCmContact']=function(_0x1c504c){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x1c504c[_0x5e26('0x2b')],'ListId':_0x1c504c['ListId']}}})[_0x5e26('0x6')](function(_0x29a737){if(_0x29a737){return _0x29a737;}return request('CreateCmContact',{'body':_0x1c504c});});};exports[_0x5e26('0x2c')]=function(_0x4f97c5){return request(_0x5e26('0x2d'),{'options':{'where':{'id':_0x4f97c5},'attributes':[_0x5e26('0x10')]}});};exports['agentLogin']=function(_0x2c1d65,_0x36b92f){return request(_0x5e26('0x2e'),{'body':{'interface':_0x36b92f},'options':{'where':_0x2c1d65}});};exports[_0x5e26('0x2f')]=function(_0x326920,_0x51e3d6,_0x3b4ef8){return request(_0x5e26('0x30'),{'body':{'type':_0x51e3d6,'uniqueid':_0x3b4ef8},'options':{'where':_0x326920}});};exports[_0x5e26('0x31')]=function(_0xe8afb){return request(_0x5e26('0x32'),{'body':{},'options':{'where':_0xe8afb}});};exports[_0x5e26('0x33')]=function(_0x3d3a73){return request(_0x5e26('0x34'),{'body':{},'options':{'where':_0x3d3a73}});}; \ No newline at end of file +var _0x5c66=['getPauseById','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','name','email','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createCmContact','ShowCmHopper','phone','ListId'];(function(_0x5d3d74,_0x14d562){var _0x49e664=function(_0x5cdd47){while(--_0x5cdd47){_0x5d3d74['push'](_0x5d3d74['shift']());}};_0x49e664(++_0x14d562);}(_0x5c66,0x76));var _0x65c6=function(_0xd335d2,_0x1d0768){_0xd335d2=_0xd335d2-0x0;var _0x112b5d=_0x5c66[_0xd335d2];return _0x112b5d;};'use strict';var BPromise=require(_0x65c6('0x0'));var moment=require(_0x65c6('0x1'));var _=require(_0x65c6('0x2'));var util=require(_0x65c6('0x3'));var jayson=require(_0x65c6('0x4'));var client=jayson[_0x65c6('0x5')][_0x65c6('0x6')]({'port':0x2329});function request(_0x3fabe3,_0x1cf275){return new BPromise(function(_0x3ab01d,_0x184c0e){return client[_0x65c6('0x7')](_0x3fabe3,_0x1cf275)[_0x65c6('0x8')](function(_0x5e39cc){if(_0x5e39cc['error']){return _0x184c0e(_0x5e39cc[_0x65c6('0x9')]['message']);}else{return _0x3ab01d(_0x5e39cc[_0x65c6('0xa')]);}})[_0x65c6('0xb')](function(_0x4daa60){return _0x184c0e(_0x4daa60);});});}exports[_0x65c6('0xc')]=function(_0x20bed3){return request(_0x65c6('0xd'),{'options':{'raw':![],'where':{'name':_0x20bed3},'attributes':[_0x65c6('0xe')]}});};exports[_0x65c6('0xf')]=function(_0x2f8462){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x2f8462},'include':[{'model':_0x65c6('0x10'),'as':'Smtp'}],'attributes':['id',_0x65c6('0x11'),_0x65c6('0x12')]}});};exports['getSquareProjectById']=function(_0x5b5d22){return request(_0x65c6('0xd'),{'options':{'where':{'id':_0x5b5d22},'attributes':[_0x65c6('0x11')]}});};exports[_0x65c6('0x13')]=function(_0x4e1166){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4e1166},'attributes':[_0x65c6('0x11')]}});};exports[_0x65c6('0x14')]=function(_0x127e47){return request(_0x65c6('0x15'),{'options':{'where':{'id':_0x127e47},'attributes':['name']}});};exports[_0x65c6('0x16')]=function(_0x541f93){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x541f93},'attributes':['dsn']}});};exports[_0x65c6('0x17')]=function(_0x2187a5){return request('ShowUser',{'options':{'where':{'id':_0x2187a5},'attributes':[_0x65c6('0x11')]}});};exports[_0x65c6('0x18')]=function(_0x141db2){return request(_0x65c6('0x19'),{'options':{'where':{'id':_0x141db2},'attributes':[_0x65c6('0x11')]}});};exports[_0x65c6('0x1a')]=function(_0x4a04f4){return request(_0x65c6('0x1b'),{'options':{'where':{'id':_0x4a04f4},'attributes':[_0x65c6('0x1c')]}});};exports[_0x65c6('0x1d')]=function(_0x5a3356){return request(_0x65c6('0x1e'),{'options':{'raw':![],'where':{'id':_0x5a3356},'include':[{'model':_0x65c6('0x1f'),'as':_0x65c6('0x20')}]}});};exports[_0x65c6('0x21')]=function(_0x4e7dd3){return request(_0x65c6('0x22'),{'options':{'where':{'id':_0x4e7dd3},'attributes':['id',_0x65c6('0x11')]}});};exports['createSmsMessage']=function(_0x34fb86){return request(_0x65c6('0x23'),{'body':_0x34fb86});};exports[_0x65c6('0x24')]=function(_0xfa7594){return request(_0x65c6('0x25'),{'body':_0xfa7594});};exports[_0x65c6('0x26')]=function(_0x15d6fb){return request(_0x65c6('0x27'),{'body':_[_0x65c6('0x28')](_0x15d6fb,{'project_name':_0x15d6fb[_0x65c6('0x29')],'prev_project_name':_0x15d6fb[_0x65c6('0x2a')]||'','is_subproject':_0x15d6fb[_0x65c6('0x2a')]?!![]:![],'leaveAt':moment()[_0x65c6('0x2b')](_0x65c6('0x2c'))})});};exports[_0x65c6('0x2d')]=function(_0x25235c){return request('CreateSquareRecording',{'body':_0x25235c});};exports['createSquareMessage']=function(_0x58adb7){return request('CreateSquareMessage',{'body':_0x58adb7});};exports[_0x65c6('0x2e')]=function(_0x1092c1){return request(_0x65c6('0x2f'),{'options':{'raw':![],'where':{'phone':_0x1092c1[_0x65c6('0x30')],'ListId':_0x1092c1[_0x65c6('0x31')]}}})[_0x65c6('0x8')](function(_0x591439){if(_0x591439){return _0x591439;}return request('CreateCmContact',{'body':_0x1092c1});});};exports[_0x65c6('0x32')]=function(_0x4d60f2){return request('ShowPause',{'options':{'where':{'id':_0x4d60f2},'attributes':[_0x65c6('0x11')]}});};exports[_0x65c6('0x33')]=function(_0x60a174,_0x1e3eb7){return request('LoginUser',{'body':{'interface':_0x1e3eb7},'options':{'where':_0x60a174}});};exports[_0x65c6('0x34')]=function(_0x49b52f,_0x3212d5,_0x3ea381){return request(_0x65c6('0x35'),{'body':{'type':_0x3212d5,'uniqueid':_0x3ea381},'options':{'where':_0x49b52f}});};exports['agentUnpause']=function(_0x4c3518){return request(_0x65c6('0x36'),{'body':{},'options':{'where':_0x4c3518}});};exports[_0x65c6('0x37')]=function(_0x48c5ea){return request('LogoutUser',{'body':{},'options':{'where':_0x48c5ea}});}; \ 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 024a870..04493ba 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 _0x2123=['exports','./polly','./lex'];(function(_0x57171b,_0xfe67c6){var _0x33a2c8=function(_0x31e60d){while(--_0x31e60d){_0x57171b['push'](_0x57171b['shift']());}};_0x33a2c8(++_0xfe67c6);}(_0x2123,0x190));var _0x3212=function(_0x1266bc,_0xc6ae74){_0x1266bc=_0x1266bc-0x0;var _0x524d54=_0x2123[_0x1266bc];return _0x524d54;};var polly=require(_0x3212('0x0'));var lex=require(_0x3212('0x1'));module[_0x3212('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x579c=['./lex','exports','./polly'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x579c,0xda));var _0xc579=function(_0x56b305,_0x5aa452){_0x56b305=_0x56b305-0x0;var _0x1f0239=_0x579c[_0x56b305];return _0x1f0239;};var polly=require(_0xc579('0x0'));var lex=require(_0xc579('0x1'));module[_0xc579('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 0d0795c..7551a63 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 _0xbec5=['exports','./lib/api'];(function(_0x1bf225,_0x341acb){var _0x47e7fb=function(_0x5cbe87){while(--_0x5cbe87){_0x1bf225['push'](_0x1bf225['shift']());}};_0x47e7fb(++_0x341acb);}(_0xbec5,0xe5));var _0x5bec=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0xbec5[_0x47e93d];return _0xe86c46;};'use strict';var lex=require(_0x5bec('0x0'));module[_0x5bec('0x1')]=function(_0x4cfc3b,_0x1d4842,_0x38c81a,_0x276b9e,_0x3859a1,_0x244027){return lex(_0x4cfc3b,_0x1d4842,_0x38c81a,_0x276b9e,_0x3859a1,_0x244027);}; \ No newline at end of file +var _0x6f7f=['exports'];(function(_0x257178,_0x3a1ce4){var _0x5a92b0=function(_0x45ee92){while(--_0x45ee92){_0x257178['push'](_0x257178['shift']());}};_0x5a92b0(++_0x3a1ce4);}(_0x6f7f,0x177));var _0xf6f7=function(_0x33ef96,_0x205dc5){_0x33ef96=_0x33ef96-0x0;var _0x55ee42=_0x6f7f[_0x33ef96];return _0x55ee42;};'use strict';var lex=require('./lib/api');module[_0xf6f7('0x0')]=function(_0x2d025d,_0x2b4ee7,_0x2e063e,_0x13f2d2,_0x4d1344,_0x1933e9){return lex(_0x2d025d,_0x2b4ee7,_0x2e063e,_0x13f2d2,_0x4d1344,_0x1933e9);}; \ 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 f2deb8f..69144c5 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 _0x532c=['slot_','exports','LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots','hasOwnProperty'];(function(_0x38da42,_0x443a7d){var _0x4412ea=function(_0x248bd1){while(--_0x248bd1){_0x38da42['push'](_0x38da42['shift']());}};_0x4412ea(++_0x443a7d);}(_0x532c,0x124));var _0xc532=function(_0x5b0fd6,_0x51a24c){_0x5b0fd6=_0x5b0fd6-0x0;var _0x2f6b80=_0x532c[_0x5b0fd6];return _0x2f6b80;};'use strict';var BPromise=require(_0xc532('0x0'));var AWS=require(_0xc532('0x1'));function lexResult(_0x39e2d2,_0x471f1f){return new BPromise(function(_0x4a9d9a,_0x4aee3a){_0x39e2d2[_0xc532('0x2')](_0x471f1f,function(_0x3b087c,_0x44c62c){if(_0x3b087c){_0x4aee3a(_0x3b087c);}if(_0x44c62c[_0xc532('0x3')]){for(const _0x157ba8 in _0x44c62c[_0xc532('0x3')]){if(_0x44c62c[_0xc532('0x3')][_0xc532('0x4')](_0x157ba8)){var _0x5c0629=_0x44c62c[_0xc532('0x3')][_0x157ba8];_0x44c62c[_0xc532('0x5')+_0x157ba8]=_0x5c0629;}}}_0x4a9d9a(_0x44c62c);});});}module[_0xc532('0x6')]=function(_0x374d54,_0x274e48,_0x3a935d,_0x3add3a,_0x437ef8,_0x148c8f){var _0x1411a0=new AWS[(_0xc532('0x7'))]({'accessKeyId':_0x274e48,'secretAccessKey':_0x3a935d,'region':_0x3add3a});var _0x3590a8={'botAlias':_0xc532('0x8'),'botName':_0x148c8f,'inputText':_0x437ef8,'userId':_0x374d54};return lexResult(_0x1411a0,_0x3590a8);}; \ No newline at end of file +var _0x717d=['slot_','exports','LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots'];(function(_0x1dfe96,_0xacd7bf){var _0x23bb8a=function(_0x2f9f1a){while(--_0x2f9f1a){_0x1dfe96['push'](_0x1dfe96['shift']());}};_0x23bb8a(++_0xacd7bf);}(_0x717d,0xc4));var _0xd717=function(_0x5cbd7b,_0x207439){_0x5cbd7b=_0x5cbd7b-0x0;var _0x3fdfb8=_0x717d[_0x5cbd7b];return _0x3fdfb8;};'use strict';var BPromise=require(_0xd717('0x0'));var AWS=require(_0xd717('0x1'));function lexResult(_0x210a00,_0x364956){return new BPromise(function(_0x3cf9e0,_0x369c8c){_0x210a00[_0xd717('0x2')](_0x364956,function(_0x25cac7,_0x5183b7){if(_0x25cac7){_0x369c8c(_0x25cac7);}if(_0x5183b7[_0xd717('0x3')]){for(const _0x2926ed in _0x5183b7['slots']){if(_0x5183b7[_0xd717('0x3')]['hasOwnProperty'](_0x2926ed)){var _0x535a0c=_0x5183b7['slots'][_0x2926ed];_0x5183b7[_0xd717('0x4')+_0x2926ed]=_0x535a0c;}}}_0x3cf9e0(_0x5183b7);});});}module[_0xd717('0x5')]=function(_0x2dd2c2,_0xe22240,_0x326d60,_0x4aaa91,_0x2dc4a2,_0x29ede8){var _0x413041=new AWS[(_0xd717('0x6'))]({'accessKeyId':_0xe22240,'secretAccessKey':_0x326d60,'region':_0x4aaa91});var _0x4cce8d={'botAlias':_0xd717('0x7'),'botName':_0x29ede8,'inputText':_0x2dc4a2,'userId':_0x2dd2c2};return lexResult(_0x413041,_0x4cce8d);}; \ 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 d385e19..dbd04be 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 _0xaa7b=['exports'];(function(_0x3ecb53,_0x168712){var _0x417da9=function(_0x17c24f){while(--_0x17c24f){_0x3ecb53['push'](_0x3ecb53['shift']());}};_0x417da9(++_0x168712);}(_0xaa7b,0x199));var _0xbaa7=function(_0x5dea6a,_0x192e18){_0x5dea6a=_0x5dea6a-0x0;var _0x4d5435=_0xaa7b[_0x5dea6a];return _0x4d5435;};'use strict';var polly=require('./lib/api');module[_0xbaa7('0x0')]=function(_0x58b1f8,_0x18a92b,_0x3ca268,_0x457f02,_0x58ac9e,_0x4aad4a,_0x2e6175){return polly(_0x58b1f8,_0x18a92b,_0x3ca268,_0x457f02,_0x58ac9e,_0x4aad4a,_0x2e6175);}; \ No newline at end of file +var _0xdd59=['exports'];(function(_0x160a7b,_0x1b5588){var _0x159636=function(_0x2a065f){while(--_0x2a065f){_0x160a7b['push'](_0x160a7b['shift']());}};_0x159636(++_0x1b5588);}(_0xdd59,0x155));var _0x9dd5=function(_0x16370b,_0x4fe34d){_0x16370b=_0x16370b-0x0;var _0x41bbe2=_0xdd59[_0x16370b];return _0x41bbe2;};'use strict';var polly=require('./lib/api');module[_0x9dd5('0x0')]=function(_0x349c23,_0x21d1cf,_0x2f459d,_0xca92ce,_0x5de280,_0x4098d8,_0x5f04ea){return polly(_0x349c23,_0x21d1cf,_0x2f459d,_0xca92ce,_0x5de280,_0x4098d8,_0x5f04ea);}; \ 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 20b2814..400c7c5 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 _0xdd89=['exports','text','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x415a87,_0x44a3eb){var _0x39e818=function(_0x45bc12){while(--_0x45bc12){_0x415a87['push'](_0x415a87['shift']());}};_0x39e818(++_0x44a3eb);}(_0xdd89,0x1e3));var _0x9dd8=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0xdd89[_0x3df871];return _0x570f7b;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x9dd8('0x0'));var rs=require(_0x9dd8('0x1'));var AWS=require(_0x9dd8('0x2'));function pollyResult(_0x1a7e97,_0x5734ac,_0x28b307){return new BPromise(function(_0x1157c3,_0x4208cc){_0x1a7e97[_0x9dd8('0x3')](_0x5734ac,function(_0x4328ed,_0x14292b){if(_0x4328ed){_0x4208cc(_0x4328ed);}else if(_0x14292b){if(_0x14292b[_0x9dd8('0x4')]instanceof Buffer){fs[_0x9dd8('0x5')](_0x28b307,_0x14292b[_0x9dd8('0x4')],function(_0x4b5416){if(_0x4b5416){_0x4208cc(_0x4b5416);}else{_0x1157c3();}});}else{_0x4208cc(new Error(_0x9dd8('0x6')));}}else{_0x4208cc(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x9dd8('0x7')]=function(_0x983c9c,_0x4f4bda,_0x4504e6,_0x45406e,_0x11a03c,_0x7b12bb,_0xa00224){var _0x2f8a88=new AWS['Polly']({'accessKeyId':_0x983c9c,'secretAccessKey':_0x4f4bda,'region':_0x4504e6});var _0x48a70f={'Text':_0x11a03c,'TextType':_0x7b12bb||_0x9dd8('0x8'),'OutputFormat':_0x9dd8('0x9'),'VoiceId':_0x45406e};return pollyResult(_0x2f8a88,_0x48a70f,_0xa00224);}; \ No newline at end of file +var _0x6e7c=['Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x9fa97a,_0x50640c){var _0x5657fa=function(_0x1b70c2){while(--_0x1b70c2){_0x9fa97a['push'](_0x9fa97a['shift']());}};_0x5657fa(++_0x50640c);}(_0x6e7c,0x1e7));var _0xc6e7=function(_0x1a8b81,_0x19279a){_0x1a8b81=_0x1a8b81-0x0;var _0x416bf0=_0x6e7c[_0x1a8b81];return _0x416bf0;};'use strict';var fs=require('fs');var path=require(_0xc6e7('0x0'));var BPromise=require(_0xc6e7('0x1'));var rs=require(_0xc6e7('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x3ab03b,_0x3da6cd,_0x35ce37){return new BPromise(function(_0x3ea893,_0x47570b){_0x3ab03b[_0xc6e7('0x3')](_0x3da6cd,function(_0x2e8dae,_0x549bac){if(_0x2e8dae){_0x47570b(_0x2e8dae);}else if(_0x549bac){if(_0x549bac['AudioStream']instanceof Buffer){fs[_0xc6e7('0x4')](_0x35ce37,_0x549bac[_0xc6e7('0x5')],function(_0x5621bb){if(_0x5621bb){_0x47570b(_0x5621bb);}else{_0x3ea893();}});}else{_0x47570b(new Error(_0xc6e7('0x6')));}}else{_0x47570b(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xc6e7('0x7')]=function(_0x558a61,_0x14bd69,_0x3d90e7,_0x4aebbf,_0x123de4,_0x3ef4b7,_0x54db4e){var _0x495673=new AWS[(_0xc6e7('0x8'))]({'accessKeyId':_0x558a61,'secretAccessKey':_0x14bd69,'region':_0x3d90e7});var _0x596af8={'Text':_0x123de4,'TextType':_0x3ef4b7||_0xc6e7('0x9'),'OutputFormat':_0xc6e7('0xa'),'VoiceId':_0x4aebbf};return pollyResult(_0x495673,_0x596af8,_0x54db4e);}; \ 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 968e970..4f1915b 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 _0xea20=['exports'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0xea20,0x1ba));var _0x0ea2=function(_0x3a18d3,_0x2f820f){_0x3a18d3=_0x3a18d3-0x0;var _0x190f40=_0xea20[_0x3a18d3];return _0x190f40;};'use strict';var asr=require('./lib/api');module[_0x0ea2('0x0')]=function(_0x1043ef,_0x9b2420,_0x3aae86,_0x3a1f41){return asr(_0x1043ef,_0x9b2420,_0x3aae86);}; \ No newline at end of file +var _0xde5b=['./lib/api','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xde5b,0x15c));var _0xbde5=function(_0x4e5a78,_0x3ad099){_0x4e5a78=_0x4e5a78-0x0;var _0x5d0fb3=_0xde5b[_0x4e5a78];return _0x5d0fb3;};'use strict';var asr=require(_0xbde5('0x0'));module[_0xbde5('0x1')]=function(_0x533028,_0x5a93c7,_0x49d443,_0x3aafe3){return asr(_0x533028,_0x5a93c7,_0x49d443);}; \ 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 cbe2229..9a6af39 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 _0x1de7=['string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string'];(function(_0xa260b0,_0x469b0f){var _0x3469d7=function(_0x4c056a){while(--_0x4c056a){_0xa260b0['push'](_0xa260b0['shift']());}};_0x3469d7(++_0x469b0f);}(_0x1de7,0xcc));var _0x71de=function(_0x52746e,_0x442edd){_0x52746e=_0x52746e-0x0;var _0x5b8e92=_0x1de7[_0x52746e];return _0x5b8e92;};'use strict';var url=require(_0x71de('0x0'));var BPromise=require(_0x71de('0x1'));var fs=require('fs');var host=_0x71de('0x2');module['exports']=function(_0x171d0d,_0x5ca61a,_0x7b2d9c){return new BPromise(function(_0x2af591,_0x2ed8f6){var _0x9dae33;if(typeof _0x171d0d!=='string'||_0x171d0d[_0x71de('0x3')]===0x0){return _0x2ed8f6(_0x71de('0x4'));}if(typeof _0x5ca61a!=='string'||_0x5ca61a[_0x71de('0x3')]===0x0){return _0x2ed8f6(_0x71de('0x5'));}if(typeof _0x7b2d9c!=='undefined'&&(typeof _0x7b2d9c!==_0x71de('0x6')||_0x7b2d9c[_0x71de('0x3')]===0x0)){return _0x2ed8f6(_0x71de('0x7'));}try{_0x9dae33=fs[_0x71de('0x8')](_0x171d0d)[_0x71de('0x9')](_0x71de('0xa'));}catch(_0x2bfeef){return _0x2ed8f6(_0x2bfeef);}return _0x2af591({'method':_0x71de('0xb'),'uri':host+_0x71de('0xc')+_0x5ca61a,'body':{'config':{'encoding':_0x71de('0xd'),'sampleRateHertz':_0x71de('0xe'),'languageCode':_0x7b2d9c},'audio':{'content':_0x9dae33}},'json':!![]});});}; \ No newline at end of file +var _0x2e58=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','LINEAR16','8000','url','https://speech.googleapis.com','exports','string','length'];(function(_0x4c3f39,_0x394c52){var _0x46672e=function(_0x1fabd9){while(--_0x1fabd9){_0x4c3f39['push'](_0x4c3f39['shift']());}};_0x46672e(++_0x394c52);}(_0x2e58,0x10c));var _0x82e5=function(_0x4efa28,_0x4e1805){_0x4efa28=_0x4efa28-0x0;var _0x599196=_0x2e58[_0x4efa28];return _0x599196;};'use strict';var url=require(_0x82e5('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x82e5('0x1');module[_0x82e5('0x2')]=function(_0x35473b,_0x52ef71,_0x264562){return new BPromise(function(_0x367fdb,_0x116986){var _0x5e1210;if(typeof _0x35473b!==_0x82e5('0x3')||_0x35473b[_0x82e5('0x4')]===0x0){return _0x116986(_0x82e5('0x5'));}if(typeof _0x52ef71!==_0x82e5('0x3')||_0x52ef71[_0x82e5('0x4')]===0x0){return _0x116986(_0x82e5('0x6'));}if(typeof _0x264562!=='undefined'&&(typeof _0x264562!==_0x82e5('0x3')||_0x264562[_0x82e5('0x4')]===0x0)){return _0x116986(_0x82e5('0x7'));}try{_0x5e1210=fs[_0x82e5('0x8')](_0x35473b)[_0x82e5('0x9')]('base64');}catch(_0x904af0){return _0x116986(_0x904af0);}return _0x367fdb({'method':_0x82e5('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x52ef71,'body':{'config':{'encoding':_0x82e5('0xb'),'sampleRateHertz':_0x82e5('0xc'),'languageCode':_0x264562},'audio':{'content':_0x5e1210}},'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 97baf51..b9a9f05 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 _0x5b1a=['exports','./asr'];(function(_0x4dca75,_0x5a631a){var _0x35701f=function(_0x4c8573){while(--_0x4c8573){_0x4dca75['push'](_0x4dca75['shift']());}};_0x35701f(++_0x5a631a);}(_0x5b1a,0x8d));var _0xa5b1=function(_0x3ffb3d,_0x46c256){_0x3ffb3d=_0x3ffb3d-0x0;var _0xecf03e=_0x5b1a[_0x3ffb3d];return _0xecf03e;};var asr=require(_0xa5b1('0x0'));module[_0xa5b1('0x1')]={'asr':asr}; \ No newline at end of file +var _0xf640=['./asr','exports'];(function(_0x212a17,_0x1749f6){var _0x578aa4=function(_0x2fbded){while(--_0x2fbded){_0x212a17['push'](_0x212a17['shift']());}};_0x578aa4(++_0x1749f6);}(_0xf640,0x16e));var _0x0f64=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf640[_0x321bb2];return _0x9c12ed;};var asr=require(_0x0f64('0x0'));module[_0x0f64('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 23f6fa2..41debad 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 _0xda41=['https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','MP3','text:synthesize','tmp','generate','.mp3','from','audioContent','777','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','fields','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','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','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','dirName','apiai-promise','bluebird','http','querystring','randomstring','url','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','.wav','writeFileSync','base64','then','chmodSync','split','toString','googleCloudTTS'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xda41,0xe1));var _0x1da4=function(_0x143079,_0x1d1fd0){_0x143079=_0x143079-0x0;var _0x517679=_0xda41[_0x143079];return _0x517679;};'use strict';var apiai=require(_0x1da4('0x0'));var BPromise=require(_0x1da4('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x1da4('0x2'));var https=require('https');var md5=require('md5');var path=require('path');var querystring=require(_0x1da4('0x3'));var rp=require('request-promise');var rs=require(_0x1da4('0x4'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0x1da4('0x5'))[_0x1da4('0x6')];var util=require(_0x1da4('0x7'));var aws=require(_0x1da4('0x8'));var google=require(_0x1da4('0x9'));var sestek=require(_0x1da4('0xa'));var tilde=require('./tilde');var logger=require(_0x1da4('0xb'))(_0x1da4('0xc'));var ISPEECH_API=_0x1da4('0xd');function downloadFile(_0x3ac5b7,_0x88ecd7){return new BPromise(function(_0x2572a5,_0x2df8b1){var _0x240a35=urlParse(_0x3ac5b7);var _0x56295a=_0x240a35[_0x1da4('0xe')]===_0x1da4('0xf')?https:http;var _0x411749={'host':_0x240a35[_0x1da4('0x10')],'path':_0x240a35[_0x1da4('0x11')],'headers':{'user-agent':_0x1da4('0x12')}};_0x56295a[_0x1da4('0x13')](_0x411749,function(_0x60a637){if(_0x60a637[_0x1da4('0x14')]!==0xc8){logger[_0x1da4('0x15')](_0x1da4('0x16')+_0x3ac5b7+_0x1da4('0x17')+_0x60a637['statusCode']+'\x20('+_0x60a637['statusMessage']+')');_0x2df8b1(new Error(_0x1da4('0x16')+_0x3ac5b7+_0x1da4('0x17')+_0x60a637['statusCode']+'\x20('+_0x60a637[_0x1da4('0x18')]+')'));return;}var _0xca84c4=fs[_0x1da4('0x19')](_0x88ecd7);_0xca84c4['on'](_0x1da4('0x1a'),function(){logger[_0x1da4('0x1b')](_0x1da4('0x1c'));_0xca84c4[_0x1da4('0x1d')](_0x2572a5);});_0xca84c4['on'](_0x1da4('0x15'),function(_0x5b4876){fs[_0x1da4('0x1e')](_0x88ecd7);logger['error'](_0x1da4('0x1f'),_0x5b4876);_0x2df8b1(_0x5b4876);});_0x60a637[_0x1da4('0x20')](_0xca84c4);})['on']('error',function(_0x5e2682){logger['error'](_0x5e2682);_0x2df8b1(_0x5e2682);})['end']();});}function uploadFile(_0x5268c7){return new BPromise(function(_0x470f41,_0x1474e8){var _0x4ef6c8=urlParse(_0x5268c7);var _0x497e9b=_0x4ef6c8[_0x1da4('0xe')]===_0x1da4('0xf')?https:http;var _0x255d4d={'host':_0x4ef6c8[_0x1da4('0x10')],'path':_0x4ef6c8[_0x1da4('0x11')],'headers':{'user-agent':_0x1da4('0x12')}};_0x497e9b['get'](_0x255d4d,function(_0x626ad1){if(_0x626ad1['statusCode']!==0xc8){_0x1474e8(new Error(_0x1da4('0x16')+_0x5268c7+_0x1da4('0x17')+_0x626ad1[_0x1da4('0x14')]+'\x20('+_0x626ad1[_0x1da4('0x18')]+')'));return;}var _0x554e29='';_0x626ad1['on']('data',function(_0x34ba1c){_0x554e29+=_0x34ba1c;});_0x626ad1['on'](_0x1da4('0x21'),function(){_0x470f41(_0x554e29);});})['on']('error',function(_0x312a79){_0x1474e8(_0x312a79);})['end']();});}function convertFile(_0x9dcf0b,_0x5365f8){return new BPromise(function(_0xaa1b8f,_0x4672cc){var _0x51fa5d=sox[_0x1da4('0x22')](_0x9dcf0b,_0x5365f8,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x51fa5d['on']('error',function(_0x63779f){logger['error'](_0x1da4('0x23'),_0x63779f);_0x4672cc(_0x63779f);});_0x51fa5d['on'](_0x1da4('0x21'),function(){logger[_0x1da4('0x1b')](_0x1da4('0x24'));_0xaa1b8f();});_0x51fa5d[_0x1da4('0x25')]();});}function base64Decode(_0x27e1f6,_0x1d4b20){var _0x1e86a8=path[_0x1da4('0x26')](__dirname,'tmp',rs['generate'](0x4)+_0x1da4('0x27'));fs[_0x1da4('0x28')](_0x1e86a8,_0x27e1f6,_0x1da4('0x29'));return convertFile(_0x1e86a8,_0x1d4b20)[_0x1da4('0x2a')](function(){try{fs['unlink'](_0x1e86a8);fs[_0x1da4('0x2b')](_0x1d4b20,'777');}catch(_0x203395){logger[_0x1da4('0x15')](_0x203395);}return _0x1d4b20[_0x1da4('0x2c')]('.')[0x0];});}function base64Encode(_0x55f975){var _0x4b5147=fs['readFileSync'](_0x55f975);return new Buffer(_0x4b5147)[_0x1da4('0x2d')](_0x1da4('0x29'));}exports[_0x1da4('0x2e')]=function(_0x299aca,_0x5e5151,_0x55ce46,_0x597dd4,_0x2d0e74,_0xe434e4){var _0x5180df,_0x1a061a;var _0x3beeb2=_0x1da4('0x2f');var _0x24b2e3='?key='+_0x299aca;var _0x42c5f4={};if(_0x5e5151===_0x1da4('0x30')){_0x42c5f4[_0x1da4('0x31')]={'ssml':_0x55ce46};}else{_0x42c5f4[_0x1da4('0x31')]={'text':_0x55ce46};};_0x42c5f4['voice']={'languageCode':_0x597dd4,'ssmlGender':_0x2d0e74};_0x42c5f4[_0x1da4('0x32')]={'audioEncoding':_0x1da4('0x33'),'sampleRateHertz':0x1f40};var _0x29c27b={'url':_0x3beeb2+_0x1da4('0x34')+_0x24b2e3,'method':'POST','json':!![],'body':_0x42c5f4};return rp(_0x29c27b)[_0x1da4('0x2a')](function(_0x17e491){return new BPromise(function(_0x35f0ad,_0x250657){_0x5180df=path[_0x1da4('0x26')](__dirname,_0x1da4('0x35'),rs[_0x1da4('0x36')](0x4)+_0x1da4('0x37'));var _0x5174d2=Buffer[_0x1da4('0x38')](_0x17e491[_0x1da4('0x39')],'base64');return fs['writeFile'](_0x5180df,_0x5174d2,function(_0x3d8f9f){_0x250657(_0x3d8f9f);},function(_0x318232){fs[_0x1da4('0x2b')](_0x5180df,'777');_0x35f0ad(_0x318232);});});})[_0x1da4('0x2a')](function(_0x4bfc1c){_0x1a061a=path[_0x1da4('0x26')](__dirname,_0x1da4('0x35'),rs[_0x1da4('0x36')](0x4)+_0x1da4('0x27'));return convertFile(_0x5180df,_0x1a061a);})[_0x1da4('0x2a')](function(){try{fs[_0x1da4('0x1e')](_0x5180df);fs[_0x1da4('0x2b')](_0x1a061a,_0x1da4('0x3a'));}catch(_0xf9601b){logger[_0x1da4('0x15')](_0xf9601b);}logger['info']('googleCloudTTS\x20path',_0x1a061a['split']('.')[0x0]);return _0x1a061a['split']('.')[0x0];});};exports[_0x1da4('0x3b')]=function(_0x3cc88f,_0x54fc52){var _0x20a526=_0x1da4('0x3c');var _0x52dad1,_0x55c425;var _0x27e532;var _0x4eccf5={'encoding':_0x1da4('0x3d'),'method':_0x1da4('0x3e'),'timeout':0x2710,'url':_0x20a526,'headers':{'Content-Type':_0x1da4('0x3f')},'body':_0x1da4('0x40')+encodeURIComponent(JSON[_0x1da4('0x41')]([[[_0x1da4('0x42'),JSON[_0x1da4('0x41')]([_0x3cc88f,_0x54fc52||'en',![],'null']),null,_0x1da4('0x43')]]]))};return rp(_0x4eccf5)[_0x1da4('0x2a')](function(_0x139681){try{_0x27e532=eval(_0x139681[_0x1da4('0x44')](0x5))[0x0][0x2];}catch(_0x1d2bfa){throw new Error('parse\x20response\x20failed:\x0a'+_0x139681[_0x1da4('0x45')]);}if(!_0x27e532){if(_0x3cc88f[_0x1da4('0x46')]>0xc8){throw new Error(_0x1da4('0x47'));}else{throw new Error(_0x1da4('0x48')+_0x54fc52+'\x22\x20might\x20not\x20exist');}}try{_0x27e532=eval(_0x27e532)[0x0];}catch(_0x31e105){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x1da4('0x45')]);}const _0x3ac35f=_0x27e532;_0x52dad1=path[_0x1da4('0x26')](__dirname,_0x1da4('0x35'),rs['generate'](0x4)+_0x1da4('0x37'));fs['writeFileSync'](_0x52dad1,_0x27e532,{'encoding':_0x1da4('0x29')});_0x55c425=path['resolve'](__dirname,_0x1da4('0x35'),rs[_0x1da4('0x36')](0x4)+'.wav');return convertFile(_0x52dad1,_0x55c425);})[_0x1da4('0x2a')](function(){try{fs['unlink'](_0x52dad1);fs[_0x1da4('0x2b')](_0x55c425,'777');}catch(_0x180d9b){logger[_0x1da4('0x15')](_0x180d9b);}logger[_0x1da4('0x1b')](_0x1da4('0x49'),_0x55c425[_0x1da4('0x2c')]('.')[0x0]);return _0x55c425[_0x1da4('0x2c')]('.')[0x0];});};exports[_0x1da4('0x4a')]=function(_0x49242e,_0x3abb82,_0x409c6d){return google['asr'](_0x49242e,_0x3abb82,_0x409c6d)[_0x1da4('0x2a')](function(_0x308ceb){logger[_0x1da4('0x1b')](_0x308ceb[_0x1da4('0x4b')]);return rp(_0x308ceb);})[_0x1da4('0x2a')](function(_0x8e18ee){var _0x326ddd='';var _0x30aeff=0x0;try{fs[_0x1da4('0x1e')](_0x49242e);}catch(_0x484693){logger[_0x1da4('0x15')](_0x484693);}if(_0x8e18ee&&_0x8e18ee[_0x1da4('0x4c')]){_0x326ddd=_0x8e18ee['results']['map'](function(_0x516614){return _0x516614&&_0x516614[_0x1da4('0x4d')][0x0]&&_0x516614[_0x1da4('0x4d')][0x0]['transcript']?_0x516614[_0x1da4('0x4d')][0x0][_0x1da4('0x4e')]:'';})[_0x1da4('0x4f')]('\x0a');_0x30aeff=_0x8e18ee[_0x1da4('0x4c')][_0x1da4('0x50')](function(_0x549a7a){return _0x549a7a&&_0x549a7a['alternatives'][0x0]&&_0x549a7a[_0x1da4('0x4d')][0x0][_0x1da4('0x51')]?_0x549a7a[_0x1da4('0x4d')][0x0][_0x1da4('0x51')]:0x0;})[_0x1da4('0x4f')]('\x0a');}logger[_0x1da4('0x1b')](_0x1da4('0x52'),_0x326ddd);logger[_0x1da4('0x1b')](_0x1da4('0x53'),_0x30aeff);return{'transcript':_0x326ddd,'confidence':_0x30aeff};})['catch'](function(_0x5ee0d7){logger['error'](_0x1da4('0x54'),_0x5ee0d7[_0x1da4('0x14')],_0x5ee0d7[_0x1da4('0x55')],_0x5ee0d7[_0x1da4('0x56')]);});};exports[_0x1da4('0x57')]=function(_0x2453fd,_0x3c80c8,_0x36046b,_0x5e1fc7){var _0x441ef0=apiai(_0x3c80c8,{'language':_0x5e1fc7||'en'});return _0x441ef0[_0x1da4('0x58')](_0x36046b,{'sessionId':md5(_0x2453fd)})[_0x1da4('0x2a')](function(_0x367ffe){logger[_0x1da4('0x1b')](JSON['stringify'](_0x367ffe));return{'source':_0x367ffe[_0x1da4('0x59')][_0x1da4('0x5a')],'resolvedQuery':_0x367ffe[_0x1da4('0x59')][_0x1da4('0x5b')],'action':_0x367ffe['result']['action'],'actionIncomplete':_0x367ffe[_0x1da4('0x59')][_0x1da4('0x5c')],'speech':_0x367ffe['result'][_0x1da4('0x5d')][_0x1da4('0x5e')],'score':_0x367ffe[_0x1da4('0x59')][_0x1da4('0x5f')],'statusCode':_0x367ffe[_0x1da4('0x60')][_0x1da4('0x61')],'endConversation':_0x367ffe['result'][_0x1da4('0x62')][_0x1da4('0x63')]||![],'isFallbackIntent':_0x367ffe[_0x1da4('0x59')][_0x1da4('0x62')]['isFallbackIntent']};});};exports[_0x1da4('0x64')]=function(_0x539bd8,_0x57a698,_0x54ae8f,_0x5a1dfc,_0x51507f,_0xf5e5e0){var _0x408bcd=_0x5a1dfc[_0x1da4('0x65')](/\\n/g,'\x0a');var _0x15f2b0={'credentials':{'private_key':_0x408bcd,'client_email':_0x54ae8f}};var _0x427098=new dialogflow[(_0x1da4('0x66'))](_0x15f2b0);var _0x14ba98=_0x427098[_0x1da4('0x67')](_0x57a698,md5(_0x539bd8));var _0x59f8dc={'session':_0x14ba98,'queryInput':{'text':{'text':_0x51507f,'languageCode':_0xf5e5e0}}};return _0x427098[_0x1da4('0x68')](_0x59f8dc)['then'](function(_0x5e7576){if(_0x5e7576&&_0x5e7576['length']){logger[_0x1da4('0x1b')](_0x1da4('0x69'),JSON['stringify'](_0x5e7576));var _0x1d2c00=_0x5e7576[0x0];if(_0x1d2c00){var _0x271cb4={'action':_0x1d2c00[_0x1da4('0x6a')][_0x1da4('0x6b')],'allRequiredParamsPresent':_0x1d2c00['queryResult']['allRequiredParamsPresent'],'endConversation':_0x1d2c00[_0x1da4('0x6a')]['diagnosticInfo']&&_0x1d2c00['queryResult']['diagnosticInfo'][_0x1da4('0x6c')]?_0x1d2c00['queryResult'][_0x1da4('0x6d')][_0x1da4('0x6c')][_0x1da4('0x6e')][_0x1da4('0x6f')]:![],'fulfillmentText':_0x1d2c00[_0x1da4('0x6a')][_0x1da4('0x70')],'intentName':_0x1d2c00[_0x1da4('0x6a')]['intent'][_0x1da4('0x55')],'intentDisplayName':_0x1d2c00[_0x1da4('0x6a')][_0x1da4('0x71')][_0x1da4('0x72')],'isFallbackIntent':_0x1d2c00[_0x1da4('0x6a')][_0x1da4('0x71')][_0x1da4('0x73')],'languageCode':_0x1d2c00[_0x1da4('0x6a')]['languageCode'],'queryText':_0x1d2c00[_0x1da4('0x6a')][_0x1da4('0x74')],'responseId':_0x1d2c00['responseId'],'score':_0x1d2c00[_0x1da4('0x6a')]['intentDetectionConfidence'],'speech':_0x1d2c00['queryResult'][_0x1da4('0x70')],'providerResponse':JSON[_0x1da4('0x41')](_0x5e7576)};return _0x271cb4;}}});};exports[_0x1da4('0x75')]=function(_0x6f9f37,_0x2d4cd0,_0x4443ae,_0x3152c3){return tilde[_0x1da4('0x76')](_0x6f9f37,_0x2d4cd0,_0x4443ae,_0x3152c3)[_0x1da4('0x2a')](function(_0x56dd42){try{fs[_0x1da4('0x1e')](_0x6f9f37);}catch(_0x4dc8e8){logger[_0x1da4('0x15')](_0x4dc8e8);}logger[_0x1da4('0x1b')](_0x1da4('0x77'),_0x56dd42[_0x1da4('0x4e')]);logger[_0x1da4('0x1b')](_0x1da4('0x78'),_0x56dd42['confidence']);return _0x56dd42;});};exports[_0x1da4('0x79')]=function(_0x301221,_0x801853,_0x30c274,_0xcc583a,_0x1d793b,_0x25a302){var _0xecc5d3=path[_0x1da4('0x26')](__dirname,_0x1da4('0x35'),rs[_0x1da4('0x36')](0x4)+'.mp3');var _0x34783d;return aws['polly'](_0x301221,_0x801853,_0x30c274,_0xcc583a,_0x1d793b,_0x25a302,_0xecc5d3)[_0x1da4('0x2a')](function(){_0x34783d=path['resolve'](__dirname,'tmp',rs[_0x1da4('0x36')](0x4)+_0x1da4('0x27'));return convertFile(_0xecc5d3,_0x34783d);})[_0x1da4('0x2a')](function(){try{fs[_0x1da4('0x1e')](_0xecc5d3);fs[_0x1da4('0x2b')](_0x34783d,'777');}catch(_0x283497){logger['error'](_0x283497);}return _0x34783d[_0x1da4('0x2c')]('.')[0x0];});};exports[_0x1da4('0x7a')]=function(_0x5c5c19,_0xeb4134,_0x22ff49,_0x271e54,_0xf12232,_0x51d6b1){return aws[_0x1da4('0x7b')](_0x5c5c19,_0xeb4134,_0x22ff49,_0x271e54,_0xf12232,_0x51d6b1)[_0x1da4('0x2a')](function(_0x1367ff){logger[_0x1da4('0x1b')](JSON[_0x1da4('0x41')](_0x1367ff));return _0x1367ff;});};exports[_0x1da4('0x7c')]=function(_0xb04648,_0x108714,_0x1d6a69,_0x53930d){var _0x31dfe0=util[_0x1da4('0x7d')](_0x1da4('0x7e'),ISPEECH_API,_0xb04648,encodeURIComponent(_0x108714),_0x1d6a69,_0x53930d);var _0xe73897=path['resolve'](__dirname,'tmp',rs[_0x1da4('0x36')](0x4)+_0x1da4('0x37'));var _0x18a775;return downloadFile(_0x31dfe0,_0xe73897)[_0x1da4('0x2a')](function(){_0x18a775=path['resolve'](__dirname,_0x1da4('0x35'),rs['generate'](0x4)+_0x1da4('0x27'));return convertFile(_0xe73897,_0x18a775);})['then'](function(){try{fs[_0x1da4('0x1e')](_0xe73897);fs[_0x1da4('0x2b')](_0x18a775,'777');}catch(_0x4001e8){logger[_0x1da4('0x15')](_0x4001e8);}return _0x18a775[_0x1da4('0x2c')]('.')[0x0];});};exports[_0x1da4('0x7f')]=function(_0x177a45,_0x4b0bc7,_0x462fa0,_0x5742bf){var _0x214ad2=util[_0x1da4('0x7d')](_0x1da4('0x80'),ISPEECH_API,_0x4b0bc7,_0x462fa0,base64Encode(_0x177a45),_0x5742bf?util[_0x1da4('0x7d')]('model=%s',encodeURIComponent(_0x5742bf)):'freeform=3');return uploadFile(_0x214ad2)[_0x1da4('0x2a')](function(_0x1afc7e){return querystring[_0x1da4('0x6')](_0x1afc7e);});};exports['sestekNDA']=function(_0x338dec,_0x226ac5){return sestek[_0x1da4('0x81')](_0x338dec,_0x226ac5)[_0x1da4('0x2a')](function(_0x500c7b){logger['info'](JSON[_0x1da4('0x41')](_0x500c7b));var _0x4b9aa0={'speech':_0x500c7b[_0x1da4('0x82')],'action':_0x500c7b[_0x1da4('0x83')]?_0x500c7b['channelData'][_0x1da4('0x84')]:undefined,'actiondata':_0x500c7b['channelData']?_0x500c7b[_0x1da4('0x83')][_0x1da4('0x85')]:undefined};if(_0x500c7b[_0x1da4('0x83')]&&_0x500c7b[_0x1da4('0x83')][_0x1da4('0x86')]){return base64Decode(_0x500c7b[_0x1da4('0x83')][_0x1da4('0x86')]['Data'],path[_0x1da4('0x26')](__dirname,_0x1da4('0x35'),rs[_0x1da4('0x36')](0x4)+_0x1da4('0x27')))[_0x1da4('0x2a')](function(_0x3ea482){_0x4b9aa0['audiofile']=_0x3ea482;return _0x4b9aa0;});}return _0x4b9aa0;});};exports[_0x1da4('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0xf0cc=['fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','info','finish\x20download\x20file','unlink','download\x20error','pipe','protocol','WHAT_EVER','data','end','wav','error\x20convert','start','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','googleCloudTTS','ssml','input','voice','audioConfig','MP3','text:synthesize','tmp','.mp3','from','audioContent','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','f.req=','stringify','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','resolve','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','action','queryResult','allRequiredParamsPresent','diagnosticInfo'];(function(_0x4e7c15,_0x3921cc){var _0x11409d=function(_0x106a08){while(--_0x106a08){_0x4e7c15['push'](_0x4e7c15['shift']());}};_0x11409d(++_0x3921cc);}(_0xf0cc,0x1d7));var _0xcf0c=function(_0x321732,_0x5f33f6){_0x321732=_0x321732-0x0;var _0x1b483a=_0xf0cc[_0x321732];return _0x1b483a;};'use strict';var apiai=require(_0xcf0c('0x0'));var BPromise=require(_0xcf0c('0x1'));var dialogflow=require(_0xcf0c('0x2'));var fs=require('fs');var http=require(_0xcf0c('0x3'));var https=require(_0xcf0c('0x4'));var md5=require('md5');var path=require(_0xcf0c('0x5'));var querystring=require(_0xcf0c('0x6'));var rp=require(_0xcf0c('0x7'));var rs=require(_0xcf0c('0x8'));var sox=require(_0xcf0c('0x9'));var tts=require(_0xcf0c('0xa'));var urlParse=require(_0xcf0c('0xb'))['parse'];var util=require(_0xcf0c('0xc'));var aws=require(_0xcf0c('0xd'));var google=require(_0xcf0c('0xe'));var sestek=require(_0xcf0c('0xf'));var tilde=require(_0xcf0c('0x10'));var logger=require(_0xcf0c('0x11'))(_0xcf0c('0x12'));var ISPEECH_API=_0xcf0c('0x13');function downloadFile(_0x1d20b4,_0x244e2e){return new BPromise(function(_0x521d41,_0x544d83){var _0x8e4e9f=urlParse(_0x1d20b4);var _0x3710bb=_0x8e4e9f['protocol']===_0xcf0c('0x14')?https:http;var _0x54715b={'host':_0x8e4e9f[_0xcf0c('0x15')],'path':_0x8e4e9f[_0xcf0c('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x3710bb[_0xcf0c('0x16')](_0x54715b,function(_0x29efdf){if(_0x29efdf[_0xcf0c('0x17')]!==0xc8){logger[_0xcf0c('0x18')]('request\x20to\x20'+_0x1d20b4+_0xcf0c('0x19')+_0x29efdf['statusCode']+'\x20('+_0x29efdf[_0xcf0c('0x1a')]+')');_0x544d83(new Error(_0xcf0c('0x1b')+_0x1d20b4+_0xcf0c('0x19')+_0x29efdf[_0xcf0c('0x17')]+'\x20('+_0x29efdf[_0xcf0c('0x1a')]+')'));return;}var _0x5f2a98=fs[_0xcf0c('0x1c')](_0x244e2e);_0x5f2a98['on']('finish',function(){logger[_0xcf0c('0x1d')](_0xcf0c('0x1e'));_0x5f2a98['close'](_0x521d41);});_0x5f2a98['on']('error',function(_0x3bab32){fs[_0xcf0c('0x1f')](_0x244e2e);logger[_0xcf0c('0x18')](_0xcf0c('0x20'),_0x3bab32);_0x544d83(_0x3bab32);});_0x29efdf[_0xcf0c('0x21')](_0x5f2a98);})['on'](_0xcf0c('0x18'),function(_0x188bb0){logger['error'](_0x188bb0);_0x544d83(_0x188bb0);})['end']();});}function uploadFile(_0x2b266d){return new BPromise(function(_0x533034,_0x41f4c7){var _0x442444=urlParse(_0x2b266d);var _0xa80f21=_0x442444[_0xcf0c('0x22')]===_0xcf0c('0x14')?https:http;var _0x14237b={'host':_0x442444['host'],'path':_0x442444[_0xcf0c('0x5')],'headers':{'user-agent':_0xcf0c('0x23')}};_0xa80f21[_0xcf0c('0x16')](_0x14237b,function(_0x309373){if(_0x309373[_0xcf0c('0x17')]!==0xc8){_0x41f4c7(new Error('request\x20to\x20'+_0x2b266d+_0xcf0c('0x19')+_0x309373[_0xcf0c('0x17')]+'\x20('+_0x309373[_0xcf0c('0x1a')]+')'));return;}var _0x52d207='';_0x309373['on'](_0xcf0c('0x24'),function(_0x16375a){_0x52d207+=_0x16375a;});_0x309373['on'](_0xcf0c('0x25'),function(){_0x533034(_0x52d207);});})['on'](_0xcf0c('0x18'),function(_0x365d53){_0x41f4c7(_0x365d53);})[_0xcf0c('0x25')]();});}function convertFile(_0x2d8b35,_0x4db0aa){return new BPromise(function(_0x122d03,_0x193529){var _0x12c902=sox['transcode'](_0x2d8b35,_0x4db0aa,{'sampleRate':0x1f40,'format':_0xcf0c('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x12c902['on']('error',function(_0x47d419){logger[_0xcf0c('0x18')](_0xcf0c('0x27'),_0x47d419);_0x193529(_0x47d419);});_0x12c902['on']('end',function(){logger[_0xcf0c('0x1d')]('finish\x20to\x20convert');_0x122d03();});_0x12c902[_0xcf0c('0x28')]();});}function base64Decode(_0x10e124,_0x2a54b1){var _0x99a12a=path['resolve'](__dirname,'tmp',rs[_0xcf0c('0x29')](0x4)+_0xcf0c('0x2a'));fs[_0xcf0c('0x2b')](_0x99a12a,_0x10e124,_0xcf0c('0x2c'));return convertFile(_0x99a12a,_0x2a54b1)[_0xcf0c('0x2d')](function(){try{fs[_0xcf0c('0x1f')](_0x99a12a);fs[_0xcf0c('0x2e')](_0x2a54b1,_0xcf0c('0x2f'));}catch(_0x3ccc06){logger['error'](_0x3ccc06);}return _0x2a54b1[_0xcf0c('0x30')]('.')[0x0];});}function base64Encode(_0x15fe6d){var _0x562d59=fs['readFileSync'](_0x15fe6d);return new Buffer(_0x562d59)[_0xcf0c('0x31')](_0xcf0c('0x2c'));}exports[_0xcf0c('0x32')]=function(_0xe6f4a8,_0x1d8593,_0x134484,_0x40a428,_0x2949e4,_0x32f140){var _0x3ea6f3,_0xde89db;var _0x551618='https://texttospeech.googleapis.com/v1/';var _0x3dbd12='?key='+_0xe6f4a8;var _0x3e7cfe={};if(_0x1d8593===_0xcf0c('0x33')){_0x3e7cfe[_0xcf0c('0x34')]={'ssml':_0x134484};}else{_0x3e7cfe['input']={'text':_0x134484};};_0x3e7cfe[_0xcf0c('0x35')]={'languageCode':_0x40a428,'ssmlGender':_0x2949e4};_0x3e7cfe[_0xcf0c('0x36')]={'audioEncoding':_0xcf0c('0x37'),'sampleRateHertz':0x1f40};var _0x35591c={'url':_0x551618+_0xcf0c('0x38')+_0x3dbd12,'method':'POST','json':!![],'body':_0x3e7cfe};return rp(_0x35591c)['then'](function(_0x36e3ad){return new BPromise(function(_0x456b97,_0x58e1ed){_0x3ea6f3=path['resolve'](__dirname,_0xcf0c('0x39'),rs['generate'](0x4)+_0xcf0c('0x3a'));var _0x26b274=Buffer[_0xcf0c('0x3b')](_0x36e3ad[_0xcf0c('0x3c')],'base64');return fs['writeFile'](_0x3ea6f3,_0x26b274,function(_0x383015){_0x58e1ed(_0x383015);},function(_0x3d850a){fs[_0xcf0c('0x2e')](_0x3ea6f3,'777');_0x456b97(_0x3d850a);});});})[_0xcf0c('0x2d')](function(_0x10f7a7){_0xde89db=path['resolve'](__dirname,_0xcf0c('0x39'),rs[_0xcf0c('0x29')](0x4)+_0xcf0c('0x2a'));return convertFile(_0x3ea6f3,_0xde89db);})[_0xcf0c('0x2d')](function(){try{fs[_0xcf0c('0x1f')](_0x3ea6f3);fs[_0xcf0c('0x2e')](_0xde89db,_0xcf0c('0x2f'));}catch(_0x564551){logger[_0xcf0c('0x18')](_0x564551);}logger['info'](_0xcf0c('0x3d'),_0xde89db['split']('.')[0x0]);return _0xde89db[_0xcf0c('0x30')]('.')[0x0];});};exports[_0xcf0c('0x3e')]=function(_0x217a16,_0x1cb75b){var _0x2df364=_0xcf0c('0x3f');var _0x16e031,_0x73dc1c;var _0x36a0fa;var _0xb38b87={'encoding':_0xcf0c('0x40'),'method':_0xcf0c('0x41'),'timeout':0x2710,'url':_0x2df364,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xcf0c('0x42')+encodeURIComponent(JSON[_0xcf0c('0x43')]([[[_0xcf0c('0x44'),JSON['stringify']([_0x217a16,_0x1cb75b||'en',![],_0xcf0c('0x45')]),null,_0xcf0c('0x46')]]]))};return rp(_0xb38b87)['then'](function(_0x2c33b7){try{_0x36a0fa=eval(_0x2c33b7[_0xcf0c('0x47')](0x5))[0x0][0x2];}catch(_0x2f7a93){throw new Error('parse\x20response\x20failed:\x0a'+_0x2c33b7['data']);}if(!_0x36a0fa){if(_0x217a16[_0xcf0c('0x48')]>0xc8){throw new Error(_0xcf0c('0x49'));}else{throw new Error(_0xcf0c('0x4a')+_0x1cb75b+_0xcf0c('0x4b'));}}try{_0x36a0fa=eval(_0x36a0fa)[0x0];}catch(_0x54a36f){throw new Error(_0xcf0c('0x4c')+res[_0xcf0c('0x24')]);}const _0x4378d8=_0x36a0fa;_0x16e031=path[_0xcf0c('0x4d')](__dirname,_0xcf0c('0x39'),rs['generate'](0x4)+_0xcf0c('0x3a'));fs[_0xcf0c('0x2b')](_0x16e031,_0x36a0fa,{'encoding':_0xcf0c('0x2c')});_0x73dc1c=path[_0xcf0c('0x4d')](__dirname,'tmp',rs['generate'](0x4)+_0xcf0c('0x2a'));return convertFile(_0x16e031,_0x73dc1c);})[_0xcf0c('0x2d')](function(){try{fs[_0xcf0c('0x1f')](_0x16e031);fs[_0xcf0c('0x2e')](_0x73dc1c,_0xcf0c('0x2f'));}catch(_0x41d6ca){logger['error'](_0x41d6ca);}logger[_0xcf0c('0x1d')]('goggleTTS\x20path',_0x73dc1c[_0xcf0c('0x30')]('.')[0x0]);return _0x73dc1c[_0xcf0c('0x30')]('.')[0x0];});};exports['googleASR']=function(_0x27109e,_0x166059,_0x563a65){return google[_0xcf0c('0x4e')](_0x27109e,_0x166059,_0x563a65)['then'](function(_0x4aa341){logger[_0xcf0c('0x1d')](_0x4aa341[_0xcf0c('0x4f')]);return rp(_0x4aa341);})['then'](function(_0x424ec7){var _0x13e8bf='';var _0x301461=0x0;try{fs[_0xcf0c('0x1f')](_0x27109e);}catch(_0x4cb70b){logger[_0xcf0c('0x18')](_0x4cb70b);}if(_0x424ec7&&_0x424ec7[_0xcf0c('0x50')]){_0x13e8bf=_0x424ec7[_0xcf0c('0x50')]['map'](function(_0x1f7eba){return _0x1f7eba&&_0x1f7eba[_0xcf0c('0x51')][0x0]&&_0x1f7eba[_0xcf0c('0x51')][0x0]['transcript']?_0x1f7eba[_0xcf0c('0x51')][0x0][_0xcf0c('0x52')]:'';})[_0xcf0c('0x53')]('\x0a');_0x301461=_0x424ec7[_0xcf0c('0x50')][_0xcf0c('0x54')](function(_0x42248d){return _0x42248d&&_0x42248d[_0xcf0c('0x51')][0x0]&&_0x42248d['alternatives'][0x0][_0xcf0c('0x55')]?_0x42248d[_0xcf0c('0x51')][0x0][_0xcf0c('0x55')]:0x0;})['join']('\x0a');}logger[_0xcf0c('0x1d')](_0xcf0c('0x56'),_0x13e8bf);logger[_0xcf0c('0x1d')]('googleASR\x20confidence',_0x301461);return{'transcript':_0x13e8bf,'confidence':_0x301461};})[_0xcf0c('0x57')](function(_0x429c44){logger['error'](_0xcf0c('0x58'),_0x429c44[_0xcf0c('0x17')],_0x429c44[_0xcf0c('0x59')],_0x429c44['message']);});};exports[_0xcf0c('0x5a')]=function(_0x1d7d31,_0x25fb69,_0xe19776,_0x5f0149){var _0x2a9077=apiai(_0x25fb69,{'language':_0x5f0149||'en'});return _0x2a9077[_0xcf0c('0x5b')](_0xe19776,{'sessionId':md5(_0x1d7d31)})[_0xcf0c('0x2d')](function(_0x28254c){logger[_0xcf0c('0x1d')](JSON[_0xcf0c('0x43')](_0x28254c));return{'source':_0x28254c[_0xcf0c('0x5c')][_0xcf0c('0x5d')],'resolvedQuery':_0x28254c['result'][_0xcf0c('0x5e')],'action':_0x28254c['result']['action'],'actionIncomplete':_0x28254c[_0xcf0c('0x5c')][_0xcf0c('0x5f')],'speech':_0x28254c['result'][_0xcf0c('0x60')][_0xcf0c('0x61')],'score':_0x28254c[_0xcf0c('0x5c')][_0xcf0c('0x62')],'statusCode':_0x28254c[_0xcf0c('0x63')]['code'],'endConversation':_0x28254c['result']['metadata'][_0xcf0c('0x64')]||![],'isFallbackIntent':_0x28254c[_0xcf0c('0x5c')][_0xcf0c('0x65')][_0xcf0c('0x66')]};});};exports[_0xcf0c('0x67')]=function(_0x3b3cb9,_0x5c1b2c,_0x19ce00,_0x20e606,_0x5e70d3,_0x13f3c8){var _0x8e7379=_0x20e606[_0xcf0c('0x68')](/\\n/g,'\x0a');var _0x87544={'credentials':{'private_key':_0x8e7379,'client_email':_0x19ce00}};var _0x4fba51=new dialogflow[(_0xcf0c('0x69'))](_0x87544);var _0x5c1453=_0x4fba51[_0xcf0c('0x6a')](_0x5c1b2c,md5(_0x3b3cb9));var _0x5eea90={'session':_0x5c1453,'queryInput':{'text':{'text':_0x5e70d3,'languageCode':_0x13f3c8}}};return _0x4fba51[_0xcf0c('0x6b')](_0x5eea90)[_0xcf0c('0x2d')](function(_0x5a928e){if(_0x5a928e&&_0x5a928e[_0xcf0c('0x48')]){logger['info'](_0xcf0c('0x6c'),JSON[_0xcf0c('0x43')](_0x5a928e));var _0x1b7549=_0x5a928e[0x0];if(_0x1b7549){var _0x1abda7={'action':_0x1b7549['queryResult'][_0xcf0c('0x6d')],'allRequiredParamsPresent':_0x1b7549[_0xcf0c('0x6e')][_0xcf0c('0x6f')],'endConversation':_0x1b7549[_0xcf0c('0x6e')][_0xcf0c('0x70')]&&_0x1b7549[_0xcf0c('0x6e')][_0xcf0c('0x70')][_0xcf0c('0x71')]?_0x1b7549[_0xcf0c('0x6e')][_0xcf0c('0x70')][_0xcf0c('0x71')][_0xcf0c('0x72')]['boolValue']:![],'fulfillmentText':_0x1b7549[_0xcf0c('0x6e')][_0xcf0c('0x73')],'intentName':_0x1b7549[_0xcf0c('0x6e')][_0xcf0c('0x74')][_0xcf0c('0x59')],'intentDisplayName':_0x1b7549['queryResult']['intent'][_0xcf0c('0x75')],'isFallbackIntent':_0x1b7549[_0xcf0c('0x6e')][_0xcf0c('0x74')][_0xcf0c('0x76')],'languageCode':_0x1b7549[_0xcf0c('0x6e')][_0xcf0c('0x77')],'queryText':_0x1b7549[_0xcf0c('0x6e')][_0xcf0c('0x78')],'responseId':_0x1b7549[_0xcf0c('0x79')],'score':_0x1b7549[_0xcf0c('0x6e')]['intentDetectionConfidence'],'speech':_0x1b7549[_0xcf0c('0x6e')]['fulfillmentText'],'providerResponse':JSON[_0xcf0c('0x43')](_0x5a928e)};return _0x1abda7;}}});};exports[_0xcf0c('0x7a')]=function(_0x115da7,_0x255d08,_0x59fd44,_0x2edbd1){return tilde[_0xcf0c('0x4e')](_0x115da7,_0x255d08,_0x59fd44,_0x2edbd1)[_0xcf0c('0x2d')](function(_0x5d9aea){try{fs[_0xcf0c('0x1f')](_0x115da7);}catch(_0x4ba292){logger[_0xcf0c('0x18')](_0x4ba292);}logger['info']('Tilde\x20ASR\x20transcription',_0x5d9aea[_0xcf0c('0x52')]);logger[_0xcf0c('0x1d')](_0xcf0c('0x7b'),_0x5d9aea[_0xcf0c('0x55')]);return _0x5d9aea;});};exports[_0xcf0c('0x7c')]=function(_0x1b1cd0,_0x32a0e1,_0x3e6ad0,_0x1c8d87,_0x2ae8d2,_0x2e36f2){var _0x12c618=path[_0xcf0c('0x4d')](__dirname,_0xcf0c('0x39'),rs['generate'](0x4)+_0xcf0c('0x3a'));var _0x47f026;return aws[_0xcf0c('0x7d')](_0x1b1cd0,_0x32a0e1,_0x3e6ad0,_0x1c8d87,_0x2ae8d2,_0x2e36f2,_0x12c618)[_0xcf0c('0x2d')](function(){_0x47f026=path[_0xcf0c('0x4d')](__dirname,_0xcf0c('0x39'),rs[_0xcf0c('0x29')](0x4)+'.wav');return convertFile(_0x12c618,_0x47f026);})[_0xcf0c('0x2d')](function(){try{fs[_0xcf0c('0x1f')](_0x12c618);fs[_0xcf0c('0x2e')](_0x47f026,'777');}catch(_0xa8e2d4){logger[_0xcf0c('0x18')](_0xa8e2d4);}return _0x47f026[_0xcf0c('0x30')]('.')[0x0];});};exports[_0xcf0c('0x7e')]=function(_0x60d86f,_0x3ccf1a,_0x413cb6,_0x380d78,_0x17d803,_0x31272f){return aws[_0xcf0c('0x7f')](_0x60d86f,_0x3ccf1a,_0x413cb6,_0x380d78,_0x17d803,_0x31272f)[_0xcf0c('0x2d')](function(_0x4f8a20){logger[_0xcf0c('0x1d')](JSON[_0xcf0c('0x43')](_0x4f8a20));return _0x4f8a20;});};exports[_0xcf0c('0x80')]=function(_0x37a53f,_0x357116,_0x1f1c55,_0x28a1f9){var _0x1f01f5=util['format'](_0xcf0c('0x81'),ISPEECH_API,_0x37a53f,encodeURIComponent(_0x357116),_0x1f1c55,_0x28a1f9);var _0x3ce4c8=path[_0xcf0c('0x4d')](__dirname,_0xcf0c('0x39'),rs['generate'](0x4)+_0xcf0c('0x3a'));var _0x46cfc4;return downloadFile(_0x1f01f5,_0x3ce4c8)['then'](function(){_0x46cfc4=path[_0xcf0c('0x4d')](__dirname,'tmp',rs['generate'](0x4)+_0xcf0c('0x2a'));return convertFile(_0x3ce4c8,_0x46cfc4);})[_0xcf0c('0x2d')](function(){try{fs[_0xcf0c('0x1f')](_0x3ce4c8);fs[_0xcf0c('0x2e')](_0x46cfc4,_0xcf0c('0x2f'));}catch(_0x2437c0){logger[_0xcf0c('0x18')](_0x2437c0);}return _0x46cfc4[_0xcf0c('0x30')]('.')[0x0];});};exports[_0xcf0c('0x82')]=function(_0x412f11,_0x2b62f7,_0x482857,_0x52550c){var _0x44b76f=util[_0xcf0c('0x83')](_0xcf0c('0x84'),ISPEECH_API,_0x2b62f7,_0x482857,base64Encode(_0x412f11),_0x52550c?util[_0xcf0c('0x83')](_0xcf0c('0x85'),encodeURIComponent(_0x52550c)):_0xcf0c('0x86'));return uploadFile(_0x44b76f)[_0xcf0c('0x2d')](function(_0x3319c8){return querystring[_0xcf0c('0x87')](_0x3319c8);});};exports[_0xcf0c('0x88')]=function(_0x4f6374,_0x1df6af){return sestek[_0xcf0c('0x89')](_0x4f6374,_0x1df6af)[_0xcf0c('0x2d')](function(_0x2c09ee){logger[_0xcf0c('0x1d')](JSON[_0xcf0c('0x43')](_0x2c09ee));var _0x1f9c68={'speech':_0x2c09ee[_0xcf0c('0x8a')],'action':_0x2c09ee[_0xcf0c('0x8b')]?_0x2c09ee[_0xcf0c('0x8b')][_0xcf0c('0x8c')]:undefined,'actiondata':_0x2c09ee[_0xcf0c('0x8b')]?_0x2c09ee[_0xcf0c('0x8b')][_0xcf0c('0x8d')]:undefined};if(_0x2c09ee['channelData']&&_0x2c09ee[_0xcf0c('0x8b')][_0xcf0c('0x8e')]){return base64Decode(_0x2c09ee[_0xcf0c('0x8b')][_0xcf0c('0x8e')][_0xcf0c('0x8f')],path[_0xcf0c('0x4d')](__dirname,_0xcf0c('0x39'),rs['generate'](0x4)+_0xcf0c('0x2a')))[_0xcf0c('0x2d')](function(_0x4795ae){_0x1f9c68[_0xcf0c('0x90')]=_0x4795ae;return _0x1f9c68;});}return _0x1f9c68;});};exports[_0xcf0c('0x91')]=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 88f851d..1ef009a 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 _0xdd87=['./nda','exports'];(function(_0x1c081d,_0x10b432){var _0x2deb0e=function(_0x43fcbd){while(--_0x43fcbd){_0x1c081d['push'](_0x1c081d['shift']());}};_0x2deb0e(++_0x10b432);}(_0xdd87,0x184));var _0x7dd8=function(_0x2f350c,_0xcc73a4){_0x2f350c=_0x2f350c-0x0;var _0xf7ed44=_0xdd87[_0x2f350c];return _0xf7ed44;};var nda=require(_0x7dd8('0x0'));module[_0x7dd8('0x1')]={'nda':nda}; \ No newline at end of file +var _0x95f9=['exports'];(function(_0x4e0863,_0x1ec822){var _0x3133d7=function(_0x3fca7d){while(--_0x3fca7d){_0x4e0863['push'](_0x4e0863['shift']());}};_0x3133d7(++_0x1ec822);}(_0x95f9,0x129));var _0x995f=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x95f9[_0x53cf8e];return _0x459197;};var nda=require('./nda');module[_0x995f('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index e0d99c1..a34a884 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 _0xeec2=['password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','calleridname','dnid','extension','Bearer\x20','access_token','project','body','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','exports','POST','resolve','/token','username'];(function(_0x32a228,_0x5a4381){var _0x50af2e=function(_0x113dcd){while(--_0x113dcd){_0x32a228['push'](_0x32a228['shift']());}};_0x50af2e(++_0x5a4381);}(_0xeec2,0x1c9));var _0x2eec=function(_0x396251,_0x43b92f){_0x396251=_0x396251-0x0;var _0x3add35=_0xeec2[_0x396251];return _0x3add35;};'use strict';var rp=require(_0x2eec('0x0'));var url=require(_0x2eec('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0x2eec('0x2')]=function(_0x2cfac8,_0x66222f){var _0x458223={'method':_0x2eec('0x3'),'uri':url[_0x2eec('0x4')](_0x66222f['ndauth_url'],_0x2eec('0x5')),'form':{'grant_type':'password','username':_0x66222f[_0x2eec('0x6')],'password':_0x66222f[_0x2eec('0x7')]},'json':!![]};return rp(_0x458223)[_0x2eec('0x8')](function(_0x2fde6c){var _0x5d2163={'method':_0x2eec('0x3'),'uri':url[_0x2eec('0x4')](_0x66222f[_0x2eec('0x9')],_0x2eec('0xa')),'body':{'type':_0x66222f[_0x2eec('0xb')]||_0x2eec('0xc'),'channelId':'Nda','conversation':{'id':_0x2cfac8['uniqueid']},'from':{'id':_0x2cfac8['callerid'],'name':_0x2cfac8[_0x2eec('0xd')]},'recipient':{'id':_0x2cfac8[_0x2eec('0xe')],'name':_0x2cfac8[_0x2eec('0xf')]},'text':_0x66222f['text'],'channelData':{}},'headers':{'Authorization':_0x2eec('0x10')+_0x2fde6c[_0x2eec('0x11')]},'json':!![]};if(_0x66222f[_0x2eec('0x12')]){_0x5d2163[_0x2eec('0x13')][_0x2eec('0x14')]['ProjectName']=_0x66222f[_0x2eec('0x12')];}if(_0x66222f['ndagenerate_audio']=='1'){_0x5d2163[_0x2eec('0x13')][_0x2eec('0x14')][_0x2eec('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2eec('0x16')};}if(_0x66222f[_0x2eec('0x17')]){_0x5d2163['body']['channelData'][_0x2eec('0x18')]=_0x66222f['custom_action'];if(_0x66222f[_0x2eec('0x19')]){_0x5d2163['body']['channelData'][_0x2eec('0x1a')]=_0x66222f['custom_action_data'];}}logger[_0x2eec('0x1b')](JSON[_0x2eec('0x1c')](_0x5d2163));return rp(_0x5d2163);});}; \ No newline at end of file +var _0xbbd5=['Nda','uniqueid','callerid','dnid','extension','text','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x3c8d4f,_0x1e41dc){var _0x24226e=function(_0x381810){while(--_0x381810){_0x3c8d4f['push'](_0x3c8d4f['shift']());}};_0x24226e(++_0x1e41dc);}(_0xbbd5,0x1e3));var _0x5bbd=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbbd5[_0x57b54c];return _0x59cc19;};'use strict';var rp=require(_0x5bbd('0x0'));var url=require(_0x5bbd('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0x5bbd('0x2')]=function(_0xf5bfd7,_0x190915){var _0x3a30b3={'method':_0x5bbd('0x3'),'uri':url[_0x5bbd('0x4')](_0x190915[_0x5bbd('0x5')],_0x5bbd('0x6')),'form':{'grant_type':_0x5bbd('0x7'),'username':_0x190915['username'],'password':_0x190915[_0x5bbd('0x7')]},'json':!![]};return rp(_0x3a30b3)[_0x5bbd('0x8')](function(_0x4db948){var _0x388f7b={'method':_0x5bbd('0x3'),'uri':url[_0x5bbd('0x4')](_0x190915[_0x5bbd('0x9')],_0x5bbd('0xa')),'body':{'type':_0x190915[_0x5bbd('0xb')]||_0x5bbd('0xc'),'channelId':_0x5bbd('0xd'),'conversation':{'id':_0xf5bfd7[_0x5bbd('0xe')]},'from':{'id':_0xf5bfd7[_0x5bbd('0xf')],'name':_0xf5bfd7['calleridname']},'recipient':{'id':_0xf5bfd7[_0x5bbd('0x10')],'name':_0xf5bfd7[_0x5bbd('0x11')]},'text':_0x190915[_0x5bbd('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x4db948['access_token']},'json':!![]};if(_0x190915['project']){_0x388f7b[_0x5bbd('0x13')][_0x5bbd('0x14')][_0x5bbd('0x15')]=_0x190915[_0x5bbd('0x16')];}if(_0x190915[_0x5bbd('0x17')]=='1'){_0x388f7b[_0x5bbd('0x13')][_0x5bbd('0x14')][_0x5bbd('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5bbd('0x19')};}if(_0x190915[_0x5bbd('0x1a')]){_0x388f7b[_0x5bbd('0x13')][_0x5bbd('0x14')][_0x5bbd('0x1b')]=_0x190915[_0x5bbd('0x1a')];if(_0x190915[_0x5bbd('0x1c')]){_0x388f7b[_0x5bbd('0x13')][_0x5bbd('0x14')][_0x5bbd('0x1d')]=_0x190915[_0x5bbd('0x1c')];}}logger['info'](JSON[_0x5bbd('0x1e')](_0x388f7b));return rp(_0x388f7b);});}; \ 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 3076884..963353f 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 _0xe061=['exports','./lib/api'];(function(_0x2a18b7,_0x5041c8){var _0x45e74e=function(_0x1d32d6){while(--_0x1d32d6){_0x2a18b7['push'](_0x2a18b7['shift']());}};_0x45e74e(++_0x5041c8);}(_0xe061,0x1b3));var _0x1e06=function(_0x14869a,_0x22918e){_0x14869a=_0x14869a-0x0;var _0x4ba1fc=_0xe061[_0x14869a];return _0x4ba1fc;};'use strict';var asr=require(_0x1e06('0x0'));module[_0x1e06('0x1')]=function(_0x3d8cbd,_0x15e730,_0xfe38ed,_0x2ebff5){return asr(_0x3d8cbd,_0x15e730,_0xfe38ed,_0x2ebff5);}; \ No newline at end of file +var _0xfb0a=['./lib/api','exports'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xfb0a,0xba));var _0xafb0=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xfb0a[_0x2064e5];return _0x21a233;};'use strict';var asr=require(_0xafb0('0x0'));module[_0xafb0('0x1')]=function(_0x75beae,_0x314ae3,_0x42ecd2,_0x43abc5){return asr(_0x75beae,_0x314ae3,_0x42ecd2,_0x43abc5);}; \ 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 4883ebd..650f153 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 _0x1201=['open','message','bluebird','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','Tilde\x20ASR\x20send\x20error','parse','status','result','final','info','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket'];(function(_0x18307e,_0x1898e8){var _0x24186b=function(_0x5ee12b){while(--_0x5ee12b){_0x18307e['push'](_0x18307e['shift']());}};_0x24186b(++_0x1898e8);}(_0x1201,0x188));var _0x1120=function(_0x305bbf,_0x5647b3){_0x305bbf=_0x305bbf-0x0;var _0x4ed772=_0x1201[_0x305bbf];return _0x4ed772;};'use strict';var BPromise=require(_0x1120('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x1120('0x1'));var logger=require(_0x1120('0x2'))(_0x1120('0x3'));module[_0x1120('0x4')]=function(_0x72be,_0x3c997e,_0x5b0f18,_0xe7d0f6){return new BPromise(function(_0x52f988,_0x546e88){logger['info'](_0x1120('0x5'),_0xe7d0f6||_0x1120('0x6'));var _0x2633b3=new WebSocket(_0xe7d0f6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x2cf97c='';var _0x450991='0';var _0x49033f='1';var _0x4d6fdb='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x19164c(_0x1b2b2f){var _0x5aff6c=crypto[_0x1120('0x7')](_0x1120('0x8'));_0x5aff6c['update'](_0x1b2b2f);return _0x5aff6c[_0x1120('0x9')]('hex');}function _0x1ddc62(){try{logger['info'](_0x1120('0xa'));var _0x215511=moment()[_0x1120('0xb')]();var _0x5692f9=_0x19164c(_0x215511+_0x3c997e+_0x5b0f18);_0x2633b3[_0x1120('0xc')](JSON[_0x1120('0xd')]({'appID':_0x3c997e,'timestamp':_0x215511,'appKey':_0x5692f9}));var _0x493f30=fs['createReadStream'](_0x72be);_0x493f30['on'](_0x1120('0xe'),function(_0x3dada5){_0x2633b3[_0x1120('0xc')](_0x3dada5);});_0x493f30['on'](_0x1120('0xf'),function(){_0x2633b3['send'](_0x1120('0x10'));});}catch(_0x517ea2){logger['error'](_0x1120('0x11'),JSON[_0x1120('0xd')](_0x517ea2));_0x2633b3['terminate']();}}function _0x498a31(_0x549b15){try{if(_0x549b15){var _0x79d062=JSON[_0x1120('0x12')](_0x549b15);switch(_0x79d062[_0x1120('0x13')]){case 0x0:if(_0x79d062[_0x1120('0x14')]){if(_0x79d062[_0x1120('0x14')][_0x1120('0x15')]){logger[_0x1120('0x16')](_0x1120('0x17'),JSON[_0x1120('0xd')](_0x79d062[_0x1120('0x14')][_0x1120('0x18')]));_0x2cf97c=_0x79d062[_0x1120('0x14')][_0x1120('0x18')][0x0][_0x1120('0x19')];_0x450991=_0x79d062[_0x1120('0x14')]['hypotheses'][0x0][_0x1120('0x1a')];_0x49033f='0';_0x4d6fdb=_0x1120('0x1b');_0x2633b3[_0x1120('0x1c')]();}}break;case 0x1:logger[_0x1120('0x16')](_0x1120('0x1d'));_0x49033f='1';_0x4d6fdb=_0x1120('0x1d');break;case 0x2:logger[_0x1120('0x16')](_0x1120('0x1e'));_0x49033f='2';_0x4d6fdb='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x1120('0x16')](_0x1120('0x1f'));_0x49033f='9';_0x4d6fdb=_0x1120('0x1f');break;case 0xa:logger[_0x1120('0x16')](_0x1120('0x20'));_0x49033f='10';_0x4d6fdb=_0x1120('0x20');break;case 0xb:logger[_0x1120('0x16')](_0x1120('0x21'));_0x49033f='11';_0x4d6fdb=_0x1120('0x21');}}}catch(_0x5d598b){logger[_0x1120('0x22')](_0x1120('0x23'),JSON['stringify'](_0x5d598b));_0x2633b3[_0x1120('0x1c')]();}}function _0x286102(){logger[_0x1120('0x16')](_0x1120('0x24'));_0x52f988({'transcript':_0x2cf97c,'confidence':_0x450991,'status':_0x49033f,'status_message':_0x4d6fdb});}function _0x584dc9(_0x282bca){logger[_0x1120('0x22')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x282bca)){logger[_0x1120('0x22')](_['isObject'](_0x282bca)?JSON['stringify'](_0x282bca):_0x282bca);}}_0x2633b3['on'](_0x1120('0x25'),_0x1ddc62);_0x2633b3['on'](_0x1120('0x26'),_0x498a31);_0x2633b3['on']('close',_0x286102);_0x2633b3['on'](_0x1120('0x22'),_0x584dc9);});}; \ No newline at end of file +var _0x386b=['parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isNil','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error'];(function(_0x17bca3,_0x2f4804){var _0x4df8a0=function(_0x43599a){while(--_0x43599a){_0x17bca3['push'](_0x17bca3['shift']());}};_0x4df8a0(++_0x2f4804);}(_0x386b,0xcb));var _0xb386=function(_0x4771de,_0x2326dd){_0x4771de=_0x4771de-0x0;var _0x97ea15=_0x386b[_0x4771de];return _0x97ea15;};'use strict';var BPromise=require('bluebird');var _=require(_0xb386('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb386('0x1'));var crypto=require(_0xb386('0x2'));var logger=require(_0xb386('0x3'))(_0xb386('0x4'));module[_0xb386('0x5')]=function(_0x1b623e,_0x2df56a,_0xe5e3ed,_0x3f58cd){return new BPromise(function(_0x4c649c,_0xc72f25){logger[_0xb386('0x6')](_0xb386('0x7'),_0x3f58cd||_0xb386('0x8'));var _0x49fdb2=new WebSocket(_0x3f58cd||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1c73c8='';var _0x198853='0';var _0x3776e9='1';var _0x393d44=_0xb386('0x9');function _0x2bb87f(_0x5a8ea6){var _0x5ee7c0=crypto[_0xb386('0xa')](_0xb386('0xb'));_0x5ee7c0[_0xb386('0xc')](_0x5a8ea6);return _0x5ee7c0[_0xb386('0xd')](_0xb386('0xe'));}function _0x52ea0d(){try{logger[_0xb386('0x6')](_0xb386('0xf'));var _0x24f520=moment()[_0xb386('0x10')]();var _0x478b76=_0x2bb87f(_0x24f520+_0x2df56a+_0xe5e3ed);_0x49fdb2[_0xb386('0x11')](JSON[_0xb386('0x12')]({'appID':_0x2df56a,'timestamp':_0x24f520,'appKey':_0x478b76}));var _0x25b6a0=fs[_0xb386('0x13')](_0x1b623e);_0x25b6a0['on'](_0xb386('0x14'),function(_0x255247){_0x49fdb2[_0xb386('0x11')](_0x255247);});_0x25b6a0['on'](_0xb386('0x15'),function(){_0x49fdb2['send'](_0xb386('0x16'));});}catch(_0x18b626){logger[_0xb386('0x17')](_0xb386('0x18'),JSON['stringify'](_0x18b626));_0x49fdb2['terminate']();}}function _0x55dcbf(_0x23167e){try{if(_0x23167e){var _0x529e04=JSON[_0xb386('0x19')](_0x23167e);switch(_0x529e04[_0xb386('0x1a')]){case 0x0:if(_0x529e04['result']){if(_0x529e04[_0xb386('0x1b')]['final']){logger[_0xb386('0x6')](_0xb386('0x1c'),JSON[_0xb386('0x12')](_0x529e04[_0xb386('0x1b')][_0xb386('0x1d')]));_0x1c73c8=_0x529e04[_0xb386('0x1b')][_0xb386('0x1d')][0x0][_0xb386('0x1e')];_0x198853=_0x529e04[_0xb386('0x1b')][_0xb386('0x1d')][0x0][_0xb386('0x1f')];_0x3776e9='0';_0x393d44='Success.';_0x49fdb2['terminate']();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x3776e9='1';_0x393d44=_0xb386('0x9');break;case 0x2:logger[_0xb386('0x6')](_0xb386('0x20'));_0x3776e9='2';_0x393d44=_0xb386('0x20');break;case 0x9:logger[_0xb386('0x6')](_0xb386('0x21'));_0x3776e9='9';_0x393d44='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xb386('0x6')](_0xb386('0x22'));_0x3776e9='10';_0x393d44='Authentication\x20failed.';break;case 0xb:logger[_0xb386('0x6')](_0xb386('0x23'));_0x3776e9='11';_0x393d44=_0xb386('0x23');}}}catch(_0x11046a){logger[_0xb386('0x17')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xb386('0x12')](_0x11046a));_0x49fdb2['terminate']();}}function _0x1c8b93(){logger[_0xb386('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x4c649c({'transcript':_0x1c73c8,'confidence':_0x198853,'status':_0x3776e9,'status_message':_0x393d44});}function _0x5e646d(_0x504d90){logger['error'](_0xb386('0x24'));if(!_[_0xb386('0x25')](_0x504d90)){logger[_0xb386('0x17')](_['isObject'](_0x504d90)?JSON[_0xb386('0x12')](_0x504d90):_0x504d90);}}_0x49fdb2['on']('open',_0x52ea0d);_0x49fdb2['on']('message',_0x55dcbf);_0x49fdb2['on'](_0xb386('0x15'),_0x1c8b93);_0x49fdb2['on'](_0xb386('0x17'),_0x5e646d);});}; \ 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 1b5364c..10cb4be 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 _0xa5d9=['./asr','exports'];(function(_0x328528,_0x108503){var _0x30603c=function(_0x13fcf9){while(--_0x13fcf9){_0x328528['push'](_0x328528['shift']());}};_0x30603c(++_0x108503);}(_0xa5d9,0xb8));var _0x9a5d=function(_0x1167e4,_0x3364e1){_0x1167e4=_0x1167e4-0x0;var _0x16463b=_0xa5d9[_0x1167e4];return _0x16463b;};var asr=require(_0x9a5d('0x0'));module[_0x9a5d('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 6368e02..f32b2d8 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 _0xc73e=['emit','E_AGI_SERVER_ERROR','destroy','ready','code','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','EventEmitter','./error','127.0.0.1','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection'];(function(_0x246346,_0x335ee5){var _0x5e0957=function(_0x310f9b){while(--_0x310f9b){_0x246346['push'](_0x246346['shift']());}};_0x5e0957(++_0x335ee5);}(_0xc73e,0x1e9));var _0xec73=function(_0x18b148,_0x48cdb6){_0x18b148=_0x18b148-0x0;var _0x4e3ab1=_0xc73e[_0x18b148];return _0x4e3ab1;};'use strict';var util=require(_0xec73('0x0'));var net=require(_0xec73('0x1'));var EventEmitter=require('events')[_0xec73('0x2')];var AGIError=require(_0xec73('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x5e5526,_0x494c49,_0x36ed48){var _0x3b35a2=this,_0x5e5526=_0x5e5526||0x11dd,_0x494c49=_0x494c49||_0xec73('0x4'),_0x26598a=null,_0x3bd154=0x0;EventEmitter['call'](_0x3b35a2);function _0x278b3b(){if(!_0x5e5526){_0x3b35a2['emit'](_0xec73('0x5'),new AGIError(_0xec73('0x6')));return![];}_0x26598a=net[_0xec73('0x7')]();_0x26598a[_0xec73('0x8')](_0x5e5526,_0x494c49);_0x26598a['on']('listening',function(){_0x3b35a2['emit'](_0xec73('0x9'));});_0x26598a['on'](_0xec73('0xa'),function(_0x5c2321){_0x26598a['getConnections'](function(_0x152195,_0x2ae06c){if(_0x152195){_0x3b35a2[_0xec73('0xb')](_0xec73('0x5'),new AGIError(_0xec73('0xc'),_0x152195));}else if(_0x36ed48&&_0x36ed48<0x0){_0x3b35a2[_0xec73('0xb')](_0xec73('0x5'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x5c2321[_0xec73('0xd')]();}else if(_0x36ed48&&_0x36ed48>0x0&&_0x36ed48<_0x2ae06c){_0x3bd154+=0x1;_0x3b35a2['emit'](_0xec73('0x5'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x3bd154));_0x5c2321[_0xec73('0xd')]();}else{var _0x1e4869=new AGIChannel(_0x5c2321);_0x1e4869['on'](_0xec73('0xe'),function(){_0x3b35a2[_0xec73('0xb')](_0xec73('0xa'),_0x1e4869);});}});});_0x26598a['on'](_0xec73('0x5'),function(_0x35be28){_0x3b35a2[_0xec73('0xb')]('error',new AGIError(_0xec73('0xc'),_0x35be28[_0xec73('0xf')]));});_0x26598a['on'](_0xec73('0x10'),function(){_0x3b35a2[_0xec73('0xb')](_0xec73('0x10'),new AGIError(_0xec73('0x11')));});}process['nextTick'](function(){_0x278b3b();});};util[_0xec73('0x12')](AGIServer,EventEmitter);module[_0xec73('0x13')]=function(_0x255d53,_0x506772,_0x57ac66){return new AGIServer(_0x255d53,_0x506772,_0x57ac66);}; \ No newline at end of file +var _0x9aea=['listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','code','close','nextTick','util','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer'];(function(_0x30c4fd,_0x551b8d){var _0x1aa9fa=function(_0x5f41fe){while(--_0x5f41fe){_0x30c4fd['push'](_0x30c4fd['shift']());}};_0x1aa9fa(++_0x551b8d);}(_0x9aea,0xdd));var _0xa9ae=function(_0x25696a,_0x307985){_0x25696a=_0x25696a-0x0;var _0x521589=_0x9aea[_0x25696a];return _0x521589;};'use strict';var util=require(_0xa9ae('0x0'));var net=require('net');var EventEmitter=require(_0xa9ae('0x1'))['EventEmitter'];var AGIError=require(_0xa9ae('0x2'));var AGIChannel=require(_0xa9ae('0x3'));var AGIServer=function(_0x563a24,_0x414638,_0x115593){var _0x41fb71=this,_0x563a24=_0x563a24||0x11dd,_0x414638=_0x414638||_0xa9ae('0x4'),_0x56f942=null,_0x1aa3b9=0x0;EventEmitter[_0xa9ae('0x5')](_0x41fb71);function _0x53e52c(){if(!_0x563a24){_0x41fb71[_0xa9ae('0x6')](_0xa9ae('0x7'),new AGIError(_0xa9ae('0x8')));return![];}_0x56f942=net[_0xa9ae('0x9')]();_0x56f942[_0xa9ae('0xa')](_0x563a24,_0x414638);_0x56f942['on'](_0xa9ae('0xb'),function(){_0x41fb71[_0xa9ae('0x6')](_0xa9ae('0xb'));});_0x56f942['on'](_0xa9ae('0xc'),function(_0x5a8178){_0x56f942[_0xa9ae('0xd')](function(_0x4fbf0e,_0x2addd2){if(_0x4fbf0e){_0x41fb71[_0xa9ae('0x6')](_0xa9ae('0x7'),new AGIError(_0xa9ae('0xe'),_0x4fbf0e));}else if(_0x115593&&_0x115593<0x0){_0x41fb71[_0xa9ae('0x6')](_0xa9ae('0x7'),new AGIError(_0xa9ae('0xf')));_0x5a8178[_0xa9ae('0x10')]();}else if(_0x115593&&_0x115593>0x0&&_0x115593<_0x2addd2){_0x1aa3b9+=0x1;_0x41fb71['emit'](_0xa9ae('0x7'),new AGIError(_0xa9ae('0x11'),_0x1aa3b9));_0x5a8178[_0xa9ae('0x10')]();}else{var _0x3f7f61=new AGIChannel(_0x5a8178);_0x3f7f61['on']('ready',function(){_0x41fb71[_0xa9ae('0x6')](_0xa9ae('0xc'),_0x3f7f61);});}});});_0x56f942['on'](_0xa9ae('0x7'),function(_0x40b756){_0x41fb71[_0xa9ae('0x6')](_0xa9ae('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x40b756[_0xa9ae('0x12')]));});_0x56f942['on'](_0xa9ae('0x13'),function(){_0x41fb71[_0xa9ae('0x6')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xa9ae('0x14')](function(){_0x53e52c();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x18911b,_0x3b8245,_0xbfd2ff){return new AGIServer(_0x18911b,_0x3b8245,_0xbfd2ff);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 60e0832..e54ed3a 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 _0x9fe7=['Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','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\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','join','path','util','shelljs','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','mailRpc','getVariable','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','callback_','random','isEmpty','lastName','isNil','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','method','timeout','number','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','url','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','replaceAllVariables','saveRestApiResult','%s.%s','length','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','providerResponse','toUpperCase','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','sestekNDA','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','isString','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appid\x20configured','wav','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','menu','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','PLAYBACK','Executed\x20command\x20%s\x20%s','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','replace','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','user','subject','Smtp','service','port','secure','authentication','auth','sendMail\x20message','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','debug','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','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'];(function(_0x1e61cd,_0x234800){var _0x11ab62=function(_0x309ada){while(--_0x309ada){_0x1e61cd['push'](_0x1e61cd['shift']());}};_0x11ab62(++_0x234800);}(_0x9fe7,0x1df));var _0x79fe=function(_0x3fcf38,_0x521826){_0x3fcf38=_0x3fcf38-0x0;var _0xd7594=_0x9fe7[_0x3fcf38];return _0xd7594;};'use strict';var fs=require('fs');var path=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var _=require('lodash');var sh=require(_0x79fe('0x2'));var odbc=require('odbc')();var rs=require(_0x79fe('0x3'));var moment=require(_0x79fe('0x4'));var Mustache=require(_0x79fe('0x5'));var rp=require('request-promise');var logger=require(_0x79fe('0x6'))(_0x79fe('0x7'));var config=require(_0x79fe('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x79fe('0x9');var recursiveMapAttributes=[_0x79fe('0xa'),_0x79fe('0xb')];var verticesWithRetry=['menu',_0x79fe('0xc'),_0x79fe('0xd')];var AGIVertices=function(_0x29b317,_0x26d723,_0xafc7cd){this['channel']=_0x29b317;this[_0x79fe('0xe')]=_0x26d723;this[_0x79fe('0xf')]=_0xafc7cd;};AGIVertices['prototype'][_0x79fe('0x10')]=function(_0x3c79f8,_0x33351e){this[_0x79fe('0xe')]['getVariableById'](_0x3c79f8)[_0x79fe('0x11')](function(_0x30c992){_0x33351e(null,_0x30c992?_0x30c992[_0x79fe('0x12')]:![]);})[_0x79fe('0x13')](function(_0x1a83f2){_0x33351e(_0x1a83f2);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x15')]=function(_0x1abd7f,_0x4be1c4){this[_0x79fe('0xe')][_0x79fe('0x16')](_0x1abd7f)[_0x79fe('0x11')](function(_0x536944){_0x4be1c4(null,_0x536944?_0x536944[_0x79fe('0x12')]:![]);})[_0x79fe('0x13')](function(_0x58124b){_0x4be1c4(_0x58124b);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x17')]=function(_0xcae4ff,_0x5f0af3){this['rpc'][_0x79fe('0x18')](_0xcae4ff)[_0x79fe('0x11')](function(_0x39be95){_0x5f0af3(null,_0x39be95?_0x39be95[_0x79fe('0x12')]:![]);})['catch'](function(_0x5e2f0b){_0x5f0af3(_0x5e2f0b);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x19')]=function(_0x25e51f,_0x4bca4d){this[_0x79fe('0xe')][_0x79fe('0x1a')](_0x25e51f)[_0x79fe('0x11')](function(_0x4c7062){_0x4bca4d(null,_0x4c7062?_0x4c7062[_0x79fe('0x1b')]:![]);})['catch'](function(_0x15f019){_0x4bca4d(_0x15f019);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x1c')]=function(_0x191bd8,_0x1ac8d7){this[_0x79fe('0xe')]['getUserById'](_0x191bd8)['then'](function(_0x107641){_0x1ac8d7(null,_0x107641?_0x107641['name']:![]);})[_0x79fe('0x13')](function(_0x3721bc){_0x1ac8d7(_0x3721bc);});};AGIVertices['prototype']['getTrunk']=function(_0x454e93,_0x321778){this['rpc'][_0x79fe('0x1d')](_0x454e93)[_0x79fe('0x11')](function(_0x5c84e0){_0x321778(null,_0x5c84e0?_0x5c84e0['name']:![]);})['catch'](function(_0x3720fa){_0x321778(_0x3720fa);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x1e')]=function(_0x4ac913,_0x47786f){var _0x43782e=this;this[_0x79fe('0xe')]['getSoundById'](_0x4ac913)['then'](function(_0x14e055){_0x47786f(null,_0x14e055?_0x43782e['getSoundPath'](_0x14e055[_0x79fe('0x1f')]):![]);})['catch'](function(_0x4d1a9a){_0x47786f(_0x4d1a9a);});};AGIVertices['prototype']['getMailAccount']=function(_0x13f8da,_0xd2ec88){this['rpc'][_0x79fe('0x20')](_0x13f8da)['then'](function(_0x42558d){_0xd2ec88(null,_0x42558d?_0x42558d:![]);})[_0x79fe('0x13')](function(_0xd01981){_0xd2ec88(_0xd01981);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x21')]=function(_0x5ac1c4,_0x436279,_0x2dbf62){this[_0x79fe('0xf')][_0x79fe('0x21')](_0x5ac1c4,_0x436279)[_0x79fe('0x11')](function(){_0x2dbf62(null);})[_0x79fe('0x13')](function(_0x57ab6b){_0x2dbf62(_0x57ab6b);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x22')]=function(_0x8ddef3,_0x9d93c1){this[_0x79fe('0xe')][_0x79fe('0x23')](_0x8ddef3)['then'](function(_0x2d4705){if(_0x2d4705){if(_0x2d4705['IntervalId']){_0x9d93c1(null,[_0x2d4705[_0x79fe('0x24')]]);}else{_0x9d93c1(null,_['map'](_0x2d4705[_0x79fe('0x25')],'interval'));}}else{_0x9d93c1(null,![]);}})[_0x79fe('0x13')](function(_0x16c7b8){_0x9d93c1(_0x16c7b8);});};AGIVertices[_0x79fe('0x14')]['getSoundPath']=function(_0x174423){return util[_0x79fe('0x26')](_0x79fe('0x27'),FILES_PATH,_0x174423);};AGIVertices[_0x79fe('0x14')][_0x79fe('0x28')]=function(_0x5b15bb,_0x53957b,_0x28439a){odbc['open'](_0x5b15bb,function(_0x27de50){if(_0x27de50){logger[_0x79fe('0x29')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x27de50);_0x28439a(_0x27de50);}else{logger[_0x79fe('0x2a')](_0x79fe('0x2b'));odbc[_0x79fe('0x2c')](_0x53957b,function(_0xc3f7ac,_0x43d8b6){if(_0xc3f7ac){logger[_0x79fe('0x2a')]('Error\x20executing\x20query\x20%s',_0x53957b);_0x28439a(_0xc3f7ac);}else{logger[_0x79fe('0x2a')](_0x79fe('0x2d'),_0x53957b);odbc[_0x79fe('0x2e')](function(_0x2d2908){if(_0x2d2908){logger['error'](_0x79fe('0x2f'),_0x2d2908);}_0x28439a(null,_0x43d8b6);});}});}});};AGIVertices['prototype'][_0x79fe('0x30')]=function(_0x5e29b5,_0x400a36){this['rpc'][_0x79fe('0x31')](_0x5e29b5)[_0x79fe('0x11')](function(_0x577341){_0x400a36(null,_0x577341?_0x577341:![]);})['catch'](function(_0x4137a3){_0x400a36(_0x4137a3);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x32')]=function(_0xeb03e4,_0x522241){this['rpc'][_0x79fe('0x32')](_0xeb03e4)[_0x79fe('0x11')](function(_0x440ff1){_0x522241(null,_0x440ff1);})[_0x79fe('0x13')](function(_0x2e0a27){_0x522241(_0x2e0a27);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x33')]=function(_0x43c316,_0x48b1ac,_0x2d13fb){this[_0x79fe('0xe')][_0x79fe('0x33')]({'uniqueid':this[_0x79fe('0x34')][_0x79fe('0x35')],'node':_0x43c316[_0x79fe('0x36')],'application':_0x43c316['agicommand'],'data':_0x48b1ac||null,'project_name':this[_0x79fe('0x34')][_0x79fe('0x37')],'callerid':this[_0x79fe('0x34')][_0x79fe('0x38')]})[_0x79fe('0x11')](function(_0x802410){if(_0x2d13fb){_0x2d13fb(null,_0x802410);}})['catch'](function(_0x4497c4){if(_0x2d13fb){_0x2d13fb(_0x4497c4);}});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x39')]=function(_0x5a5d83,_0x14e9e0,_0x563b71,_0x569c78){this[_0x79fe('0xe')][_0x79fe('0x39')]({'uniqueid':this[_0x79fe('0x34')]['uniqueid'],'callerid':this[_0x79fe('0x34')][_0x79fe('0x38')],'calleridname':this[_0x79fe('0x34')]['calleridname'],'context':this['channel'][_0x79fe('0x3a')],'extension':this[_0x79fe('0x34')][_0x79fe('0x3b')],'priority':this[_0x79fe('0x34')][_0x79fe('0x3c')],'accountcode':this[_0x79fe('0x34')][_0x79fe('0x3d')],'dnid':this[_0x79fe('0x34')][_0x79fe('0x3e')],'projectName':this['channel'][_0x79fe('0x37')],'saveName':_0x14e9e0,'filename':_0x5a5d83[_0x79fe('0x3f')]||_0x14e9e0,'savePath':_0x563b71})['then'](function(_0x22ab55){_0x569c78(null,_0x22ab55);})['catch'](function(_0x2909d0){_0x569c78(_0x2909d0);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x40')]=function(_0x1761d7,_0x4b82eb,_0x2c7dd8,_0x23faee,_0x35870d){this['rpc']['createSquareMessage']({'uniqueid':this[_0x79fe('0x34')][_0x79fe('0x35')],'body':_0x1761d7,'direction':_0x4b82eb,'providerName':_0x2c7dd8,'providerResponse':_0x23faee})['then'](function(_0x1ae54f){if(_0x35870d){_0x35870d(null,_0x1ae54f);}})[_0x79fe('0x13')](function(_0x1985d1){if(_0x35870d){_0x35870d(_0x1985d1);}});};AGIVertices[_0x79fe('0x14')]['createCmContact']=function(_0x47520b,_0x328b62){this[_0x79fe('0xe')]['createCmContact']({'firstName':_['isEmpty'](_0x47520b['name'])||_['isNil'](_0x47520b['name'])?_0x79fe('0x41')+Math[_0x79fe('0x42')]():_0x47520b['name'],'lastName':_[_0x79fe('0x43')](_0x47520b[_0x79fe('0x44')])||_[_0x79fe('0x45')](_0x47520b['lastName'])?null:_0x47520b['lastName'],'phone':_0x47520b['phone'],'ListId':_0x47520b[_0x79fe('0x46')],'scheduledat':_0x47520b['scheduledAt'],'callbackUniqueid':this[_0x79fe('0x34')][_0x79fe('0x35')],'tags':_0x79fe('0x47'),'description':_0x79fe('0x48')+_0x47520b[_0x79fe('0x49')][_0x79fe('0x4a')](),'priority':_0x47520b[_0x79fe('0x4b')]})[_0x79fe('0x11')](function(_0x230ed9){_0x328b62(null,_0x230ed9);})[_0x79fe('0x13')](function(_0x20ff3a){_0x328b62(_0x20ff3a);});};AGIVertices['prototype'][_0x79fe('0x4c')]=function(_0x397e40,_0x4a5468){this[_0x79fe('0xe')]['getPauseById'](_0x397e40)[_0x79fe('0x11')](function(_0x1fff51){_0x4a5468(null,_0x1fff51?_0x1fff51['name']:![]);})[_0x79fe('0x13')](function(_0x5d60d3){_0x4a5468(_0x5d60d3);});};AGIVertices[_0x79fe('0x14')]['agentPause']=function(_0x5ef724,_0x492ac1,_0x9728b9){var _0x272272={'role':_0x79fe('0x4d')};_0x272272[_0x5ef724]=this[_0x79fe('0x34')][_0x79fe('0x38')];this[_0x79fe('0xe')][_0x79fe('0x4e')](_0x272272,_0x492ac1,this[_0x79fe('0x34')][_0x79fe('0x35')])['then'](function(_0xc7f9e){_0x9728b9(null,_[_0x79fe('0x45')](_0xc7f9e)?![]:!![]);})[_0x79fe('0x13')](function(_0x39beab){logger['error'](_0x39beab);_0x9728b9(null,![]);});};AGIVertices[_0x79fe('0x14')]['agentUnpause']=function(_0x24da87,_0x52d583){var _0x136b97={'role':_0x79fe('0x4d')};_0x136b97[_0x24da87]=this[_0x79fe('0x34')][_0x79fe('0x38')];this['rpc'][_0x79fe('0x4f')](_0x136b97)[_0x79fe('0x11')](function(_0x25eb0d){_0x52d583(null,_[_0x79fe('0x45')](_0x25eb0d)?![]:!![]);})['catch'](function(_0x9e880c){logger[_0x79fe('0x29')](_0x9e880c);_0x52d583(null,![]);});};AGIVertices['prototype'][_0x79fe('0x50')]=function(_0x52bdfe,_0x4ed2b8){var _0x37ccea={'role':_0x79fe('0x4d')};_0x37ccea[_0x52bdfe]=this[_0x79fe('0x34')]['callerid'];this['rpc'][_0x79fe('0x50')](_0x37ccea)['then'](function(_0x49bfc9){_0x4ed2b8(null,_[_0x79fe('0x45')](_0x49bfc9)?![]:!![]);})[_0x79fe('0x13')](function(_0x45a70f){logger[_0x79fe('0x29')](_0x45a70f);_0x4ed2b8(null,![]);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x51')]=function(_0x45d90d,_0xc91129){var _0x3c0326={'role':'agent'};_0x3c0326[_0x45d90d]=this[_0x79fe('0x34')][_0x79fe('0x38')];var _0x546a47=_0x45d90d!=_0x79fe('0x52')?util[_0x79fe('0x26')](_0x79fe('0x53'),_0x79fe('0x54'),this[_0x79fe('0x34')][_0x79fe('0x38')]):undefined;this[_0x79fe('0xe')][_0x79fe('0x51')](_0x3c0326,_0x546a47)[_0x79fe('0x11')](function(_0x2ab682){_0xc91129(null,_[_0x79fe('0x45')](_0x2ab682)?![]:!![]);})['catch'](function(_0x4d5458){logger[_0x79fe('0x29')](_0x4d5458);_0xc91129(null,![]);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x55')]=function(_0xbb92d5,_0x1b0be4){sh[_0x79fe('0x56')](_['trim'](_0xbb92d5),function(_0xdf3368,_0x238d57){var _0xbf0700=_0x238d57['replace'](/(\r\n|\n|\r)/gm,'');_0x1b0be4(null,_0xbf0700);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x4cec0c,_0x16525f){scripts['googleCloudTTS'](_0x4cec0c[_0x79fe('0x57')],_0x4cec0c[_0x79fe('0x58')]||_0x79fe('0x59'),_0x4cec0c[_0x79fe('0x59')],_0x4cec0c[_0x79fe('0x5a')]||'en-US',_0x4cec0c[_0x79fe('0x5b')]||'MALE',_0x4cec0c[_0x79fe('0x5c')]||_0x79fe('0x5d'))[_0x79fe('0x11')](function(_0x134584){_0x16525f(null,_0x134584);})[_0x79fe('0x13')](function(_0xa0b17f){_0x16525f(_0xa0b17f);});};AGIVertices[_0x79fe('0x14')]['googleTTS']=function(_0x24d539,_0x50c361){scripts[_0x79fe('0x5e')](_0x24d539[_0x79fe('0x59')],_0x24d539[_0x79fe('0x5f')]||'en',0x1)['then'](function(_0x29d7ba){_0x50c361(null,_0x29d7ba);})[_0x79fe('0x13')](function(_0x1f38d3){_0x50c361(_0x1f38d3);});};AGIVertices[_0x79fe('0x14')]['restAPI']=function(_0x30d99b,_0x27dbe9){var _0x2d4bfa={'uri':_0x30d99b['url'],'method':_0x30d99b[_0x79fe('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x30d99b[_0x79fe('0x61')])===_0x79fe('0x62')&&parseInt(_0x30d99b[_0x79fe('0x61')])>=0x1?parseInt(_0x30d99b[_0x79fe('0x61')])*0x3e8:0x5*0x3e8};if(_[_0x79fe('0x63')]([_0x79fe('0x64'),_0x79fe('0x65')],_0x2d4bfa[_0x79fe('0x60')]['toUpperCase']())){try{_0x2d4bfa[_0x79fe('0x66')]=_0x30d99b['rawBody']?JSON[_0x79fe('0x67')](_0x30d99b[_0x79fe('0xb')]):{};}catch(_0x2b8f99){logger[_0x79fe('0x29')](_0x79fe('0x68'),_0x2b8f99);}}try{_0x2d4bfa['headers']=_0x30d99b[_0x79fe('0xa')]?JSON['parse'](_0x30d99b[_0x79fe('0xa')]):{};}catch(_0x136706){logger['error'](_0x79fe('0x69'),_0x136706);}if(_0x30d99b[_0x79fe('0x6a')]){try{var _0x18262c=require(_0x30d99b[_0x79fe('0x6a')])[_0x79fe('0x6b')](this,_0x2d4bfa);_0x2d4bfa['uri']=Mustache[_0x79fe('0x6c')](_0x30d99b[_0x79fe('0x6d')],_0x18262c,{},['$$','$$']);if(_0x2d4bfa[_0x79fe('0x6e')]){_0x2d4bfa[_0x79fe('0x6e')]=JSON[_0x79fe('0x67')](Mustache[_0x79fe('0x6c')](JSON[_0x79fe('0x6f')](_0x2d4bfa[_0x79fe('0x6e')]),_0x18262c,{},['$$','$$']));}if(_0x2d4bfa[_0x79fe('0x66')]){_0x2d4bfa[_0x79fe('0x66')]=JSON['parse'](Mustache[_0x79fe('0x6c')](JSON['stringify'](_0x2d4bfa[_0x79fe('0x66')]),_0x18262c,{},['$$','$$']));}}catch(_0x5ce49d){logger[_0x79fe('0x29')](_0x79fe('0x70'),_0x5ce49d);}}rp(_0x2d4bfa)[_0x79fe('0x11')](function(_0x50fa09){var _0x34a296={'statusCode':_0x50fa09['statusCode']||0xc8,'statusMessage':_0x50fa09[_0x79fe('0x71')]||'OK','headers':_0x50fa09[_0x79fe('0x6e')]||{},'body':_0x50fa09[_0x79fe('0x66')]||{}};_0x27dbe9(null,_0x34a296);})[_0x79fe('0x13')](function(_0x557cfd){var _0x2de2d5={'statusCode':_0x557cfd['statusCode']||0x1f4,'statusMessage':_0x557cfd[_0x79fe('0x72')]||_0x79fe('0x73'),'headers':_0x557cfd[_0x79fe('0x74')][_0x79fe('0x6e')]||{},'body':_0x557cfd[_0x79fe('0x74')]['body']||{}};_0x27dbe9(null,_0x2de2d5);});};AGIVertices[_0x79fe('0x14')]['googleDialogflow']=function(_0x165680,_0x14d622){scripts['googleDialogflow'](this[_0x79fe('0x34')][_0x79fe('0x35')],_0x165680[_0x79fe('0x75')],_0x165680[_0x79fe('0x59')],_0x165680[_0x79fe('0x76')]||'en')[_0x79fe('0x11')](function(_0x4d92af){_0x14d622(null,_0x4d92af);})['catch'](function(_0x139478){_0x14d622(_0x139478);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x77')]=function(_0x550501,_0xfde41e){scripts[_0x79fe('0x77')](this[_0x79fe('0x34')][_0x79fe('0x35')],_0x550501[_0x79fe('0x78')],_0x550501['client_email'],_0x550501[_0x79fe('0x79')],_0x550501[_0x79fe('0x59')],_0x550501[_0x79fe('0x7a')]||'en')['then'](function(_0x3e3b72){_0xfde41e(null,_0x3e3b72);})[_0x79fe('0x13')](function(_0x3362a6){_0xfde41e(_0x3362a6);});};AGIVertices[_0x79fe('0x14')]['sestekNDA']=function(_0x11ed56,_0x190aa4){scripts['sestekNDA'](this[_0x79fe('0x34')],_0x11ed56)[_0x79fe('0x11')](function(_0x227a97){_0x190aa4(null,_0x227a97);})[_0x79fe('0x13')](function(_0x4887c4){_0x190aa4(_0x4887c4);});};AGIVertices['prototype'][_0x79fe('0x7b')]=function(_0x3ad4b7,_0x517612){scripts['ispeechTTS'](_0x3ad4b7['key'],_0x3ad4b7[_0x79fe('0x59')],_0x3ad4b7[_0x79fe('0x7c')]||_0x79fe('0x7d'),_0x3ad4b7[_0x79fe('0x7e')])[_0x79fe('0x11')](function(_0x5d2971){_0x517612(null,_0x5d2971);})[_0x79fe('0x13')](function(_0x389e32){_0x517612(_0x389e32);});};AGIVertices['prototype'][_0x79fe('0x7f')]=function(_0x4afd6b,_0x56abb2,_0x4662f8){scripts[_0x79fe('0x7f')](_0x56abb2,_0x4afd6b[_0x79fe('0x75')],_0x4afd6b[_0x79fe('0x80')]||_0x79fe('0x7d'),this[_0x79fe('0x81')](_0x4afd6b[_0x79fe('0x82')])?_0x4afd6b[_0x79fe('0x82')]:undefined)[_0x79fe('0x11')](function(_0x3eeb90){_0x4662f8(null,_0x3eeb90);})[_0x79fe('0x13')](function(_0x57a104){_0x4662f8(_0x57a104);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x83')]=function(_0x1562da,_0x1114ce){scripts[_0x79fe('0x83')](_0x1562da[_0x79fe('0x84')],_0x1562da[_0x79fe('0x85')],_0x1562da[_0x79fe('0x86')],_0x1562da[_0x79fe('0x87')]||'Amy',_0x1562da[_0x79fe('0x59')],_0x1562da[_0x79fe('0x88')]||_0x79fe('0x59'))[_0x79fe('0x11')](function(_0x4d0417){_0x1114ce(null,_0x4d0417);})[_0x79fe('0x13')](function(_0x47eaa3){_0x1114ce(_0x47eaa3);});};AGIVertices[_0x79fe('0x14')]['awsLex']=function(_0x46151b,_0x44b212){scripts[_0x79fe('0x89')](this[_0x79fe('0x34')][_0x79fe('0x35')],_0x46151b[_0x79fe('0x84')],_0x46151b['aws_secret_access_key'],_0x46151b['aws_lex_region'],_0x46151b[_0x79fe('0x59')],_0x46151b[_0x79fe('0x8a')])[_0x79fe('0x11')](function(_0x182e01){_0x44b212(null,_0x182e01);})[_0x79fe('0x13')](function(_0x5eca8c){_0x44b212(_0x5eca8c);});};AGIVertices[_0x79fe('0x14')]['googleASR']=function(_0x487856,_0x28685f,_0x517c85){scripts[_0x79fe('0x8b')](_0x28685f,_0x487856[_0x79fe('0x75')],_0x487856[_0x79fe('0x8c')]||_0x79fe('0x7d'))[_0x79fe('0x11')](function(_0x454eb0){_0x517c85(null,_0x454eb0);})[_0x79fe('0x13')](function(_0x32b296){_0x517c85(_0x32b296);});};AGIVertices['prototype'][_0x79fe('0x8d')]=function(_0x220224,_0x5b5d4e,_0x42066b){scripts[_0x79fe('0x8d')](_0x5b5d4e,_0x220224[_0x79fe('0x8e')],_0x220224[_0x79fe('0x8f')],_0x220224['uri'])['then'](function(_0x67f6ce){_0x42066b(null,_0x67f6ce);})['catch'](function(_0x6865fa){_0x42066b(_0x6865fa);});};AGIVertices[_0x79fe('0x14')][_0x79fe('0x90')]=function(_0x5f04da){var _0x12f704=_[_0x79fe('0x63')](verticesWithRetry,_0x5f04da[_0x79fe('0x91')])?_0x5f04da:_[_0x79fe('0x92')](_0x5f04da);for(var _0x208301 in _0x12f704){if(_0x12f704[_0x79fe('0x93')](_0x208301)){if(_0x12f704[_0x208301]&&_['isString'](_0x12f704[_0x208301])){if(_['includes'](recursiveMapAttributes,_0x208301)){_0x12f704[_0x208301]=this[_0x79fe('0x94')](_0x12f704[_0x208301]);}else{_0x12f704[_0x208301]=this['replaceAllVariables'](_0x12f704[_0x208301]);}}}}return _0x12f704;};AGIVertices[_0x79fe('0x14')][_0x79fe('0x95')]=function(_0x431d9c){for(var _0x1e3f89 in _0x431d9c){if(_0x431d9c['hasOwnProperty'](_0x1e3f89)){if(_[_0x79fe('0x96')](_0x431d9c[_0x1e3f89])){this[_0x79fe('0x95')](_0x431d9c[_0x1e3f89]);}else if(_[_0x79fe('0x97')](_0x431d9c[_0x1e3f89])){for(var _0x3f541f=0x0;_0x3f541f<_0x431d9c[_0x1e3f89]['length'];_0x3f541f++){this[_0x79fe('0x95')](_0x431d9c[_0x1e3f89][_0x3f541f]);}}else if(_['isString'](_0x431d9c[_0x1e3f89])){_0x431d9c[_0x1e3f89]=this[_0x79fe('0x98')](_0x431d9c[_0x1e3f89]);}}}};AGIVertices['prototype'][_0x79fe('0x99')]=function(_0x2905a3,_0x391b14){for(var _0x1c61c3 in _0x2905a3){if(_0x2905a3[_0x79fe('0x93')](_0x1c61c3)){if(_[_0x79fe('0x96')](_0x2905a3[_0x1c61c3])){if(!_['isEmpty'](_0x2905a3[_0x1c61c3])){this[_0x79fe('0x99')](_0x2905a3[_0x1c61c3],util['format'](_0x79fe('0x9a'),_0x391b14,_0x1c61c3));}}else if(_[_0x79fe('0x97')](_0x2905a3[_0x1c61c3])){for(var _0x15c17b=0x0;_0x15c17b<_0x2905a3[_0x1c61c3][_0x79fe('0x9b')];_0x15c17b++){this[_0x79fe('0x99')](_0x2905a3[_0x1c61c3][_0x15c17b],util[_0x79fe('0x26')](_0x79fe('0x9a'),_0x391b14,_0x1c61c3+'['+_0x15c17b+']'));}}else{if(!_[_0x79fe('0x45')](_0x2905a3[_0x1c61c3])){this[_0x79fe('0x34')][_0x79fe('0x9c')](util[_0x79fe('0x26')](_0x79fe('0x9a'),_0x391b14,_0x1c61c3),_0x2905a3[_0x1c61c3]);}}}}};AGIVertices[_0x79fe('0x14')][_0x79fe('0x94')]=function(_0x58ddb7){try{var _0x5ec99e=JSON[_0x79fe('0x67')](_0x58ddb7);this[_0x79fe('0x95')](_0x5ec99e);return JSON[_0x79fe('0x6f')](_0x5ec99e);}catch(_0x3d8cdb){return this[_0x79fe('0x98')](_0x58ddb7);}};AGIVertices[_0x79fe('0x14')][_0x79fe('0x98')]=function(_0x323837){var _0x5643a0=_0x323837[_0x79fe('0x9d')]('{');for(var _0x241b06=0x1;_0x241b06<_0x5643a0[_0x79fe('0x9b')];_0x241b06+=0x1){var _0x5ad6ae=_0x5643a0[_0x241b06][_0x79fe('0x9d')]('}');if(_0x5ad6ae[_0x79fe('0x9b')]>0x1){_0x323837=_0x323837[_0x79fe('0x9e')]('{'+_0x5ad6ae[0x0]+'}',this[_0x79fe('0x34')][_0x79fe('0x10')](_0x5ad6ae[0x0])[_0x79fe('0x9f')]||_0x5ad6ae[0x0]);}}if(_0x5643a0[_0x79fe('0x9b')]===0x1){return _0x323837[_0x79fe('0x4a')]();}return this[_0x79fe('0x98')](_0x323837);};AGIVertices['prototype'][_0x79fe('0xa0')]=function(_0x5e40a2,_0x589923){var _0x585aa9=this['channel'][_0x79fe('0x10')](_0x5e40a2);if(_0x585aa9[_0x79fe('0xa1')]===-0x1){return _0x585aa9;}logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0xa2'),_0x589923,_0x585aa9[_0x79fe('0x9f')]));return this['channel']['setVariable'](_0x589923,_0x585aa9[_0x79fe('0x9f')]);};AGIVertices[_0x79fe('0x14')][_0x79fe('0x81')]=function(_0x2122d7){return _0x2122d7&&_0x2122d7!=='0'&&_0x2122d7!=='-1'&&_0x2122d7!=='';};AGIVertices['prototype'][_0x79fe('0xa3')]=function(_0x5d29ec){this[_0x79fe('0x33')][_0x79fe('0x6b')](this,_0x5d29ec,'-');_0x5d29ec[_0x79fe('0xa4')]=_0x5d29ec[_0x79fe('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x79fe('0xa5')]=function(_0x41ce74){logger['info'](util[_0x79fe('0x26')](_0x79fe('0xa6'),_0x41ce74['label']));if(!this[_0x79fe('0x81')](_0x41ce74[_0x79fe('0x59')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0xa8'));}var _0x536a5a='\x22'+_0x41ce74[_0x79fe('0x59')]+'\x22';if(this[_0x79fe('0x81')](_0x41ce74[_0x79fe('0x74')])){_0x536a5a+=','+_0x41ce74[_0x79fe('0x74')];}var _0x5417d2=this[_0x79fe('0x34')][_0x79fe('0x56')](_0x79fe('0xa9'),_0x536a5a);if(_0x5417d2[_0x79fe('0xa1')]===-0x1){return _0x5417d2;}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0xaa'),_0x536a5a));};AGIVertices['prototype'][_0x79fe('0xab')]=function(_0x578b8e){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0xac'),_0x578b8e[_0x79fe('0x36')]));if(!this['isConfigured'](_0x578b8e[_0x79fe('0xad')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0xae'));}var _0xa2b309=_0x578b8e[_0x79fe('0xad')];if(this[_0x79fe('0x81')](_0x578b8e[_0x79fe('0x74')])){_0xa2b309+=','+_0x578b8e[_0x79fe('0x74')];}var _0xafaa47=this['channel'][_0x79fe('0x56')](_0x79fe('0xaf'),_0xa2b309);if(_0xafaa47[_0x79fe('0xa1')]===-0x1){return _0xafaa47;}var _0x47b5bd=this[_0x79fe('0xa0')](_0x79fe('0xb0'),_0x79fe('0xb1'));if(_0x47b5bd[_0x79fe('0xa1')]===-0x1){return _0x47b5bd;}var _0x400e20=this[_0x79fe('0xa0')](_0x79fe('0xb2'),_0x79fe('0xb3'));if(_0x400e20[_0x79fe('0xa1')]===-0x1){return _0x400e20;}var _0x6aadaf=this[_0x79fe('0xa0')](_0x79fe('0xb4'),_0x79fe('0xb5'));if(_0x6aadaf['result']===-0x1){return _0x6aadaf;}return this['channel'][_0x79fe('0xa7')](util[_0x79fe('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0xa2b309));};AGIVertices[_0x79fe('0x14')][_0x79fe('0x7')]=function(_0x5cfbdb){logger[_0x79fe('0x2a')](util['format'](_0x79fe('0xb6'),_0x5cfbdb[_0x79fe('0x36')]));return this[_0x79fe('0x34')][_0x79fe('0x7')]([_0x5cfbdb[_0x79fe('0xb7')],_0x5cfbdb[_0x79fe('0xb8')]]);};AGIVertices['prototype']['answer']=function(_0x550525){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0xb9'),_0x550525[_0x79fe('0x36')]));if(this[_0x79fe('0x81')](_0x550525['timeout'])){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x550525[_0x79fe('0x61')]));var _0x2669a2=this['channel'][_0x79fe('0xba')](_0x550525['timeout']);if(_0x2669a2[_0x79fe('0xa1')]===-0x1){return _0x2669a2;}}return this[_0x79fe('0x34')][_0x79fe('0xbb')]();};AGIVertices[_0x79fe('0x14')]['callback']=function(_0x15976c){logger['info'](util[_0x79fe('0x26')](_0x79fe('0xbc'),_0x15976c['label']));if(!this[_0x79fe('0x81')](_0x15976c[_0x79fe('0x46')])){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x15976c,_0x79fe('0xbd'));}_0x15976c['scheduledAt']=moment();if(this['isConfigured'](_0x15976c[_0x79fe('0xbe')])){_0x15976c[_0x79fe('0x49')]=moment()[_0x79fe('0xbf')](_0x15976c[_0x79fe('0xbe')],_0x79fe('0xc0'));}if(!this[_0x79fe('0x81')](_0x15976c['callback_priority'])){_0x15976c[_0x79fe('0x4b')]=0x2;}this['createCmContact'][_0x79fe('0x6b')](this,_0x15976c);return this['channel']['noop'](util[_0x79fe('0x26')](_0x79fe('0xc1'),_0x15976c[_0x79fe('0xc2')],_0x15976c[_0x79fe('0x46')],_0x15976c[_0x79fe('0x49')]));};AGIVertices[_0x79fe('0x14')][_0x79fe('0xc3')]=function(_0x26cbf0){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0xc4'),_0x26cbf0[_0x79fe('0x36')]));var _0x35902c=this['channel'][_0x79fe('0x56')](_0x26cbf0[_0x79fe('0xc5')],_0x26cbf0['options']);if(_0x35902c[_0x79fe('0xa1')]===-0x1){return _0x35902c;}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')]('Executed\x20command\x20%s\x20%s',_0x26cbf0[_0x79fe('0xc5')],_0x26cbf0[_0x79fe('0x74')]));};AGIVertices[_0x79fe('0x14')][_0x79fe('0xc6')]=function(_0x15d0b7){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x15d0b7[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x15d0b7[_0x79fe('0x59')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0xa8'));}var _0x3a4be4='\x22'+_0x15d0b7[_0x79fe('0x59')]+'\x22';if(this[_0x79fe('0x81')](_0x15d0b7[_0x79fe('0x74')])){_0x3a4be4+=','+_0x15d0b7[_0x79fe('0x74')];}var _0x140e73=this[_0x79fe('0x34')][_0x79fe('0x56')](_0x79fe('0xa9'),_0x3a4be4);if(_0x140e73[_0x79fe('0xa1')]===-0x1){return _0x140e73;}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0xaa'),_0x3a4be4));};AGIVertices[_0x79fe('0x14')][_0x79fe('0xc7')]=function(_0x35c940){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0xc8'),_0x35c940['label']));if(!this['isConfigured'](_0x35c940[_0x79fe('0x59')])){return this[_0x79fe('0x34')]['noop'](_0x79fe('0xa8'));}var _0x14b9db='\x22'+_0x35c940[_0x79fe('0x59')]+'\x22';if(this[_0x79fe('0x81')](_0x35c940[_0x79fe('0x74')])){_0x14b9db+=','+_0x35c940[_0x79fe('0x74')];}var _0x523e76=this[_0x79fe('0x34')][_0x79fe('0x56')](_0x79fe('0xa9'),_0x14b9db);if(_0x523e76[_0x79fe('0xa1')]===-0x1){return _0x523e76;}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0xaa'),_0x14b9db));};AGIVertices[_0x79fe('0x14')][_0x79fe('0xc9')]=function(_0x47f8b6){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0xca'),_0x47f8b6[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x47f8b6['grammar'])){return this[_0x79fe('0x34')]['noop'](_0x79fe('0xae'));}var _0x4ff314=_0x47f8b6[_0x79fe('0xad')];if(this['isConfigured'](_0x47f8b6[_0x79fe('0x74')])){_0x4ff314+=','+_0x47f8b6['options'];}var _0x72f9c=this[_0x79fe('0x34')]['exec'](_0x79fe('0xaf'),_0x4ff314);if(_0x72f9c['result']===-0x1){return _0x72f9c;}var _0x521a58=this[_0x79fe('0xa0')](_0x79fe('0xb0'),_0x79fe('0xcb'));if(_0x521a58[_0x79fe('0xa1')]===-0x1){return _0x521a58;}var _0x181e39=this[_0x79fe('0xa0')]('RECOG_INPUT()',_0x79fe('0xcc'));if(_0x181e39[_0x79fe('0xa1')]===-0x1){return _0x181e39;}var _0x490275=this['getAndSetVariable']('RECOG_INSTANCE()',_0x79fe('0xcd'));if(_0x490275[_0x79fe('0xa1')]===-0x1){return _0x490275;}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4ff314));};AGIVertices[_0x79fe('0x14')][_0x79fe('0xce')]=function(_0x11a511){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0xcf'),_0x11a511['label']));if(!this[_0x79fe('0x81')](_0x11a511[_0x79fe('0xad')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x1aa2ee=_0x11a511[_0x79fe('0xad')];if(this['isConfigured'](_0x11a511[_0x79fe('0x74')])){_0x1aa2ee+=','+_0x11a511['options'];}var _0x476b0b=this[_0x79fe('0x34')][_0x79fe('0x56')](_0x79fe('0xaf'),_0x1aa2ee);if(_0x476b0b[_0x79fe('0xa1')]===-0x1){return _0x476b0b;}var _0xeffd2d=this['getAndSetVariable'](_0x79fe('0xb0'),_0x79fe('0xd0'));if(_0xeffd2d[_0x79fe('0xa1')]===-0x1){return _0xeffd2d;}var _0xce1c53=this['getAndSetVariable'](_0x79fe('0xb2'),_0x79fe('0xd1'));if(_0xce1c53[_0x79fe('0xa1')]===-0x1){return _0xce1c53;}var _0x4b03d1=this[_0x79fe('0xa0')](_0x79fe('0xb4'),_0x79fe('0xd2'));if(_0x4b03d1[_0x79fe('0xa1')]===-0x1){return _0x4b03d1;}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0xd3'),_0x1aa2ee));};AGIVertices[_0x79fe('0x14')][_0x79fe('0xd4')]=function(_0x33c6ce){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x33c6ce[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x33c6ce[_0x79fe('0xd5')])){return this['channel']['error'](_0x33c6ce,_0x79fe('0xd6'));}var _0x983ff7=this[_0x79fe('0x19')][_0x79fe('0x6b')](this,_0x33c6ce['odbc_id']);if(!_0x983ff7){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x33c6ce,_0x79fe('0xd7'));}if(!this[_0x79fe('0x81')](_0x33c6ce[_0x79fe('0x2c')])){return this['channel'][_0x79fe('0x29')](_0x33c6ce,_0x79fe('0xd8'));}var _0x5183a1=_0x33c6ce[_0x79fe('0x2c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x79fe('0x34')]['noop'](util[_0x79fe('0x26')]('query:\x20%s',_0x5183a1));var _0x2171a8=this[_0x79fe('0x28')][_0x79fe('0x6b')](this,_0x983ff7,_0x5183a1);this[_0x79fe('0x33')]['sync'](this,_0x33c6ce,_0x5183a1);if(!this[_0x79fe('0x81')](_0x33c6ce['variable_id'])){return this['channel'][_0x79fe('0xa7')](_0x79fe('0xd9'));}var _0x217b84=this[_0x79fe('0x10')][_0x79fe('0x6b')](this,_0x33c6ce[_0x79fe('0xda')]);if(!_0x217b84){return this[_0x79fe('0x34')]['error'](_0x33c6ce,_0x79fe('0xdb'));}var _0x2a4ce4=this;_0x2171a8[_0x79fe('0xdc')](function(_0x3cbf69,_0x9adf44){Object['keys'](_0x3cbf69)[_0x79fe('0xdc')](function(_0x252410){_0x2a4ce4[_0x79fe('0x34')][_0x79fe('0x9c')](util[_0x79fe('0x26')](_0x79fe('0xdd'),_0x217b84,_0x9adf44,_0x252410),_0x3cbf69[_0x252410]);});});this['channel'][_0x79fe('0x9c')](util[_0x79fe('0x26')](_0x79fe('0xde'),_0x217b84),_0x2171a8[_0x79fe('0x9b')]);return this['channel']['noop'](util[_0x79fe('0x26')](_0x79fe('0xdf'),_0x217b84));};AGIVertices[_0x79fe('0x14')][_0x79fe('0xe0')]=function(_0x33f15c){logger['debug'](util[_0x79fe('0x26')](_0x79fe('0xe1'),_0x33f15c[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x33f15c[_0x79fe('0xe2')])){return this['channel']['error'](_0x33f15c,_0x79fe('0xe3'));}var _0x56b9b8=this[_0x79fe('0x1c')][_0x79fe('0x6b')](this,_0x33f15c[_0x79fe('0xe2')]);if(!_0x56b9b8){return this['channel'][_0x79fe('0x29')](_0x33f15c,_0x79fe('0xe4'));}var _0x8fe0da=this[_0x79fe('0x34')]['exec'](_0x79fe('0xe5'),[util[_0x79fe('0x26')](_0x79fe('0xe6'),_0x56b9b8),_0x33f15c[_0x79fe('0x61')],_0x33f15c[_0x79fe('0xe7')],_0x33f15c[_0x79fe('0x6d')]]);if(_0x8fe0da[_0x79fe('0xa1')]===-0x1){return _0x8fe0da;}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')]('Executed\x20command\x20%s',_0x79fe('0xe5')));};AGIVertices[_0x79fe('0x14')][_0x79fe('0xe8')]=function(_0x9dcedb){logger['info'](util[_0x79fe('0x26')](_0x79fe('0xe9'),_0x9dcedb[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x9dcedb['key'])){return this['channel'][_0x79fe('0xa7')](_0x79fe('0xea'));}if(!this[_0x79fe('0x81')](_0x9dcedb[_0x79fe('0x59')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0xa8'));}this['channel']['bot']=!![];this[_0x79fe('0x33')](_0x9dcedb);this[_0x79fe('0x40')](_0x9dcedb[_0x79fe('0x59')],'in','','');this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0xeb'),_0x9dcedb[_0x79fe('0x59')]));var _0x14b4b5=this[_0x79fe('0xec')][_0x79fe('0x6b')](this,_0x9dcedb);if(_0x14b4b5){for(var _0x2e59dc in _0x14b4b5){if(_0x14b4b5['hasOwnProperty'](_0x2e59dc)){this[_0x79fe('0x34')][_0x79fe('0x9c')](util[_0x79fe('0x26')](_0x79fe('0xed'),_0x2e59dc['toUpperCase']()),_0x14b4b5[_0x2e59dc]);}}this[_0x79fe('0x40')](_0x14b4b5['speech'],_0x79fe('0xee'),_0x79fe('0xe8'),'');return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0xef'),_0x14b4b5[_0x79fe('0xf0')]));}return this['channel']['error'](_0x9dcedb,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype']['dialogflowV2']=function(_0x9059a4){logger['info'](util[_0x79fe('0x26')](_0x79fe('0xf1'),_0x9059a4[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x9059a4[_0x79fe('0x78')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0xf2'));}if(!this[_0x79fe('0x81')](_0x9059a4[_0x79fe('0xf3')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0xf4'));}if(!this['isConfigured'](_0x9059a4['private_key'])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0xf5'));}if(!this[_0x79fe('0x81')](_0x9059a4[_0x79fe('0x7a')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0xf6'));}if(!this[_0x79fe('0x81')](_0x9059a4['text'])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0xa8'));}this[_0x79fe('0x34')][_0x79fe('0xf7')]=!![];this['createSquareDetailsReport'](_0x9059a4);this[_0x79fe('0x40')](_0x9059a4[_0x79fe('0x59')],'in','','');this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')]('Trying\x20DialogflowV2:\x20%s',_0x9059a4[_0x79fe('0x59')]));var _0x41e916=this[_0x79fe('0x77')]['sync'](this,_0x9059a4);if(_0x41e916){for(var _0x30a2e1 in _0x41e916){if(_0x41e916[_0x79fe('0x93')](_0x30a2e1)){if(_0x30a2e1!==_0x79fe('0xf8')){this[_0x79fe('0x34')][_0x79fe('0x9c')](util[_0x79fe('0x26')](_0x79fe('0xed'),_0x30a2e1[_0x79fe('0xf9')]()),_0x41e916[_0x30a2e1]);}}}this['createSquareMessage'](_0x41e916[_0x79fe('0xf0')],'out',_0x79fe('0xfa'),_0x41e916[_0x79fe('0xf8')]);return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0xfb'),_0x41e916[_0x79fe('0xf0')]));}return this['channel'][_0x79fe('0x29')](_0x9059a4,_0x79fe('0xfc'));};AGIVertices[_0x79fe('0x14')][_0x79fe('0xfd')]=function(_0xee9abb){logger['info'](util[_0x79fe('0x26')](_0x79fe('0xfe'),_0xee9abb[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0xee9abb['ndauth_url'])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0xff'));}if(!this[_0x79fe('0x81')](_0xee9abb[_0x79fe('0x100')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0x101'));}if(!this['isConfigured'](_0xee9abb[_0x79fe('0x102')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0x103'));}if(!this[_0x79fe('0x81')](_0xee9abb[_0x79fe('0x104')])){return this[_0x79fe('0x34')]['noop'](_0x79fe('0xa8'));}this['channel'][_0x79fe('0xf7')]=!![];this['createSquareDetailsReport'](_0xee9abb);this[_0x79fe('0x40')](_0xee9abb[_0x79fe('0x59')],'in','','');this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')]('Trying\x20SestekNDA:\x20%s',_0xee9abb[_0x79fe('0x59')]));var _0x29ed8e=this[_0x79fe('0x105')]['sync'](this,_0xee9abb);if(_0x29ed8e){for(var _0x40ba60 in _0x29ed8e){if(_0x29ed8e[_0x79fe('0x93')](_0x40ba60)){this['channel'][_0x79fe('0x9c')](util[_0x79fe('0x26')](_0x79fe('0x106'),_0x40ba60[_0x79fe('0xf9')]()),_0x29ed8e[_0x40ba60]);}}this[_0x79fe('0x40')](_0x29ed8e[_0x79fe('0xf0')],_0x79fe('0xee'),_0x79fe('0xfd'),'');if(_0x29ed8e[_0x79fe('0x107')]){this['channel'][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x108'),_0x29ed8e['audiofile']));var _0x5f284f=this[_0x79fe('0x34')][_0x79fe('0x109')](_0x29ed8e['audiofile']);try{fs[_0x79fe('0x10a')](_0x29ed8e[_0x79fe('0x107')]+_0x79fe('0x10b'));}catch(_0x48a206){logger['error'](_0x48a206);}return _0x5f284f;}else{return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x10c'),_0x29ed8e['speech']));}}return this[_0x79fe('0x34')][_0x79fe('0x29')](_0xee9abb,_0x79fe('0x10d'));};AGIVertices[_0x79fe('0x14')][_0x79fe('0x10e')]=function(_0x1f602b){logger['info'](util[_0x79fe('0x26')]('Enter\x20in\x20END\x20(%s)\x20block',_0x1f602b[_0x79fe('0x36')]));return this['channel'][_0x79fe('0xa7')](_0x79fe('0x10e'));};AGIVertices[_0x79fe('0x14')][_0x79fe('0x10f')]=function(_0xd2cb12){logger['info'](util[_0x79fe('0x26')](_0x79fe('0x110'),_0xd2cb12['label']));var _0xbde545='';if(_0xd2cb12['trunk_id']){if(!this[_0x79fe('0x81')](_0xd2cb12[_0x79fe('0x111')])){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0xd2cb12,'no\x20trunk\x20selected');}else{var _0x2dfc37=parseInt(_0xd2cb12['trunk_id'],0xa);if(isNaN(_0x2dfc37)){_0xbde545=_0xd2cb12[_0x79fe('0x111')];}else{_0xbde545=this[_0x79fe('0x112')]['sync'](this,_0xd2cb12[_0x79fe('0x111')]);if(!_0xbde545){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0xd2cb12,_0x79fe('0x113'));}}}}else if(_0xd2cb12['trunk_name']){_0xbde545=_0xd2cb12[_0x79fe('0x114')];}else{return this['channel']['error'](_0xd2cb12,'no\x20trunk\x20selected');}var _0x2a59f0=this[_0x79fe('0x34')][_0x79fe('0x56')](_0x79fe('0xe5'),[util['format']('SIP/%s/%s',_0xbde545,_0xd2cb12[_0x79fe('0xc2')]),_0xd2cb12[_0x79fe('0x61')],_0xd2cb12['opts'],_0xd2cb12['url']]);if(_0x2a59f0['result']===-0x1){return _0x2a59f0;}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x115'),_0x79fe('0xe5')));};AGIVertices[_0x79fe('0x14')][_0x79fe('0x116')]=function(_0x3e38be){logger['info'](util[_0x79fe('0x26')](_0x79fe('0x117'),_0x3e38be[_0x79fe('0x36')]));return this[_0x79fe('0x34')][_0x79fe('0xa7')]('finally');};AGIVertices[_0x79fe('0x14')][_0x79fe('0xc')]=function(_0x9195d4){logger['info'](util[_0x79fe('0x26')](_0x79fe('0x118'),_0x9195d4[_0x79fe('0x36')]));if(_0x9195d4['retry']===0x0){return this[_0x79fe('0xa3')](_0x9195d4);}_0x9195d4[_0x79fe('0xa4')]-=0x1;if(!this[_0x79fe('0x81')](_0x9195d4[_0x79fe('0x119')])){return this[_0x79fe('0x34')]['error'](_0x9195d4,'no\x20file\x20audio\x20selected');}var _0x4d4f5a=this[_0x79fe('0x1e')][_0x79fe('0x6b')](this,_0x9195d4['file_id']);if(!_0x4d4f5a){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x9195d4,'no\x20file\x20audio\x20found');}if(!this[_0x79fe('0x81')](_0x9195d4[_0x79fe('0xda')])){return this[_0x79fe('0x34')]['error'](_0x79fe('0xd9'));}var _0x539504=this[_0x79fe('0x34')][_0x79fe('0x11a')](_0x4d4f5a,_0x9195d4[_0x79fe('0x11b')],_0x9195d4[_0x79fe('0x11c')]);var _0x2f8e81=_0x539504[_0x79fe('0xa1')]?_0x539504['result']['toString']():'';logger[_0x79fe('0x2a')](_0x79fe('0x11d'),JSON['stringify'](_0x539504));if(_0x539504[_0x79fe('0xa1')]===-0x1){this[_0x79fe('0x33')][_0x79fe('0x6b')](this,_0x9195d4,_0x2f8e81);return _0x539504;}else if(_0x539504[_0x79fe('0x9f')]===_0x79fe('0x61')){_0x539504[_0x79fe('0xa1')]=_0x2f8e81[_0x79fe('0x9b')]>=parseInt(_0x9195d4[_0x79fe('0x11e')])?'x':'i';}else{_0x539504[_0x79fe('0xa1')]=_0x2f8e81[_0x79fe('0x9b')]>=parseInt(_0x9195d4[_0x79fe('0x11e')])&&_0x2f8e81['length']<=parseInt(_0x9195d4[_0x79fe('0x11c')])?'x':'i';}var _0x418a57=this[_0x79fe('0x10')][_0x79fe('0x6b')](this,_0x9195d4[_0x79fe('0xda')]);if(!_0x418a57){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x9195d4,'no\x20variable\x20found');}this[_0x79fe('0x34')][_0x79fe('0x9c')](_0x418a57,_0x2f8e81);if(this[_0x79fe('0x81')](_0x9195d4[_0x79fe('0x11f')])){var _0x4079f6=parseInt(_0x9195d4[_0x79fe('0x11f')],0xa);var _0x39c49d=rs[_0x79fe('0x120')]({'charset':'*','length':_0x4079f6});var _0x438174=_0x2f8e81[_0x79fe('0x9b')];if(_0x438174>0x0){if(_0x438174>_0x4079f6){this['createSquareDetailsReport']['sync'](this,_0x9195d4,_0x9195d4['hiddendigitspos']==='first'?_0x39c49d+_0x2f8e81[_0x79fe('0x121')](_0x4079f6):_0x2f8e81['substr'](0x0,_0x438174-_0x4079f6)+_0x39c49d);}else{this[_0x79fe('0x33')][_0x79fe('0x6b')](this,_0x9195d4,rs['generate']({'charset':'*','length':_0x438174}));}}else{this[_0x79fe('0x33')][_0x79fe('0x6b')](this,_0x9195d4,'');}}else{this[_0x79fe('0x33')][_0x79fe('0x6b')](this,_0x9195d4,_0x2f8e81);}return _0x539504;};AGIVertices[_0x79fe('0x14')][_0x79fe('0xd')]=function(_0x168496){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x122'),_0x168496[_0x79fe('0x36')]));return this[_0x79fe('0xc')](_0x168496);};AGIVertices[_0x79fe('0x14')][_0x79fe('0x123')]=function(_0x47848f){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x124'),_0x47848f['label']));this[_0x79fe('0x33')]['sync'](this,_0x47848f,_0x47848f['goalname']);return this[_0x79fe('0x34')]['noop'](util[_0x79fe('0x26')]('GOAL\x20%s',_0x47848f[_0x79fe('0x125')]));};AGIVertices['prototype'][_0x79fe('0x126')]=function(_0x32cded){logger['info'](util[_0x79fe('0x26')](_0x79fe('0x127'),_0x32cded[_0x79fe('0x36')]));if(!this['isConfigured'](_0x32cded[_0x79fe('0x84')])||!this['isConfigured'](_0x32cded[_0x79fe('0x85')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0x128'));}if(!this[_0x79fe('0x81')](_0x32cded[_0x79fe('0x59')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')]('no\x20text\x20configured');}this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x129'),_0x32cded[_0x79fe('0x59')]));var _0xffac5e=this[_0x79fe('0x83')][_0x79fe('0x6b')](this,_0x32cded);if(_0xffac5e){this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x12a'),_0xffac5e));var _0x494065=this[_0x79fe('0x34')][_0x79fe('0x109')](_0xffac5e);try{fs['unlink'](_0xffac5e+_0x79fe('0x10b'));}catch(_0x191aad){logger['error'](_0x191aad);}return _0x494065;}return this[_0x79fe('0x34')]['error'](_0x32cded,_0x79fe('0x12b'));};AGIVertices[_0x79fe('0x14')][_0x79fe('0x12c')]=function(_0xe7d0b7){logger['info'](util[_0x79fe('0x26')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0xe7d0b7[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0xe7d0b7[_0x79fe('0x84')])||!this[_0x79fe('0x81')](_0xe7d0b7['aws_secret_access_key'])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0x128'));}if(!this[_0x79fe('0x81')](_0xe7d0b7[_0x79fe('0x8a')])){return this[_0x79fe('0x34')]['noop'](_0x79fe('0x12d'));}if(!this[_0x79fe('0x81')](_0xe7d0b7[_0x79fe('0x59')])){return this['channel'][_0x79fe('0xa7')](_0x79fe('0xa8'));}this[_0x79fe('0x34')][_0x79fe('0xf7')]=!![];this['createSquareDetailsReport'](_0xe7d0b7);this[_0x79fe('0x40')](_0xe7d0b7[_0x79fe('0x59')],'in','','');this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x12e'),_0xe7d0b7[_0x79fe('0x59')]));var _0x4485a6=this[_0x79fe('0x89')][_0x79fe('0x6b')](this,_0xe7d0b7);if(_0x4485a6){for(var _0x3c7ad6 in _0x4485a6){if(_0x4485a6[_0x79fe('0x93')](_0x3c7ad6)&&_[_0x79fe('0x12f')](_0x4485a6[_0x3c7ad6])){this[_0x79fe('0x34')][_0x79fe('0x9c')](util[_0x79fe('0x26')]('AWS_LEX_%s',_0x3c7ad6[_0x79fe('0xf9')]()),_0x4485a6[_0x3c7ad6]);}}if(_[_0x79fe('0x45')](_0x4485a6[_0x79fe('0x72')])){return this[_0x79fe('0x34')]['noop'](_0x79fe('0x130'));}else{this[_0x79fe('0x40')](_0x4485a6[_0x79fe('0x72')],_0x79fe('0xee'),'amazonlex','');return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x131'),_0x4485a6['message']));}}return this[_0x79fe('0x34')][_0x79fe('0x29')](_0xe7d0b7,_0x79fe('0x132'));};AGIVertices[_0x79fe('0x14')]['googleasr']=function(_0x2226e8){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x133'),_0x2226e8[_0x79fe('0x36')],_0x2226e8[_0x79fe('0x61')]));if(!this['isConfigured'](_0x2226e8[_0x79fe('0x75')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0xea'));}var _0x693160='wav';var _0x452fe6=util[_0x79fe('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0x79fe('0x120')](0x4));var _0x1c4f67=util[_0x79fe('0x26')](_0x79fe('0x9a'),_0x452fe6,_0x693160);var _0x58e94f=!![];if(_0x2226e8[_0x79fe('0x134')]===_0x79fe('0x135')){_0x58e94f=![];}var _0x219ad0=this[_0x79fe('0x34')][_0x79fe('0x136')](_0x452fe6,_0x693160,_0x2226e8[_0x79fe('0x137')],_0x2226e8[_0x79fe('0x61')],undefined,_0x58e94f);if(_0x219ad0[_0x79fe('0xa1')]!==-0x1){this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x138'),_0x1c4f67));var _0x7a0e7a=this[_0x79fe('0x8b')][_0x79fe('0x6b')](this,_0x2226e8,_0x1c4f67);if(_0x7a0e7a){for(var _0x2cd8e6 in _0x7a0e7a){if(_0x7a0e7a['hasOwnProperty'](_0x2cd8e6)){this[_0x79fe('0x34')][_0x79fe('0x9c')](util['format'](_0x79fe('0x139'),_0x2cd8e6['toUpperCase']()),_0x7a0e7a[_0x2cd8e6]);}}return this['channel'][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x13a'),JSON[_0x79fe('0x6f')](_0x7a0e7a)));}}return _0x219ad0;};AGIVertices['prototype']['tildeasr']=function(_0x11d472){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x11d472[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x11d472[_0x79fe('0x8e')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0x13b'));}if(!this[_0x79fe('0x81')](_0x11d472[_0x79fe('0x8f')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')]('no\x20appsecret\x20configured');}var _0x208f9a=_0x79fe('0x13c');var _0x32181e=util[_0x79fe('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0x79fe('0x120')](0x4));var _0x4a07aa=util['format'](_0x79fe('0x9a'),_0x32181e,_0x208f9a);var _0xbe8468=!![];if(_0x11d472[_0x79fe('0x134')]===_0x79fe('0x135')){_0xbe8468=![];}var _0x56ac=this[_0x79fe('0x34')][_0x79fe('0x136')](_0x32181e,_0x208f9a,_0x11d472[_0x79fe('0x137')],_0x11d472['timeout'],undefined,_0xbe8468);if(_0x56ac['result']!==-0x1){this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')]('tilde\x20%s\x20file\x20created',_0x4a07aa));var _0x32a017=this[_0x79fe('0x8d')][_0x79fe('0x6b')](this,_0x11d472,_0x4a07aa);if(_0x32a017){for(var _0x3bb924 in _0x32a017){if(_0x32a017['hasOwnProperty'](_0x3bb924)){this[_0x79fe('0x34')]['setVariable'](util[_0x79fe('0x26')](_0x79fe('0x13d'),_0x3bb924['toUpperCase']()),_0x32a017[_0x3bb924]);}}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x13e'),JSON[_0x79fe('0x6f')](_0x32a017)));}}return _0x56ac;};AGIVertices[_0x79fe('0x14')][_0x79fe('0x13f')]=function(_0x58be25){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x140'),_0x58be25[_0x79fe('0x36')]));return this['channel'][_0x79fe('0x141')](_0x58be25[_0x79fe('0x3a')],_0x58be25[_0x79fe('0x3b')],_0x58be25[_0x79fe('0x3c')]);};AGIVertices[_0x79fe('0x14')][_0x79fe('0x142')]=function(_0x5c5095){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x143'),_0x5c5095[_0x79fe('0x36')]));if(!this['isConfigured'](_0x5c5095[_0x79fe('0x144')])){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x5c5095,_0x79fe('0x145'));}try{var _0x1f6b3c=eval(_0x5c5095[_0x79fe('0x144')])?_0x79fe('0x146'):'false';this[_0x79fe('0x34')][_0x79fe('0xa7')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x5c5095['condition'],_0x1f6b3c));return{'code':0xc8,'result':_0x1f6b3c};}catch(_0x53a784){return{'code':0xc8,'result':_0x79fe('0x147')};}};AGIVertices[_0x79fe('0x14')][_0x79fe('0x148')]=function(_0x4070f5){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x149'),_0x4070f5[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x4070f5['interval_id'])){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x4070f5,_0x79fe('0x14a'));}var _0x16c0b0=this['getIntervals'][_0x79fe('0x6b')](this,_0x4070f5[_0x79fe('0x14b')]);if(!_0x16c0b0){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x4070f5,_0x79fe('0x14c'));}for(var _0x370bad=0x0;_0x370bad<_0x16c0b0[_0x79fe('0x9b')];_0x370bad+=0x1){var _0x2112de=this['channel'][_0x79fe('0x10')](util['format'](_0x79fe('0x14d'),_0x16c0b0[_0x370bad]));if(_0x2112de[_0x79fe('0xa1')]===-0x1){return _0x2112de;}logger['info'](util[_0x79fe('0x26')](_0x79fe('0x14e'),_0x16c0b0[_0x370bad],_0x2112de[_0x79fe('0x9f')]));if(_0x2112de[_0x79fe('0x9f')]===_0x79fe('0x146')){logger['info'](util[_0x79fe('0x26')](_0x79fe('0x14e'),_0x16c0b0[_0x370bad],_0x79fe('0x146')));this['channel'][_0x79fe('0xa7')](util['format'](_0x79fe('0x14e'),_0x16c0b0[_0x370bad],_0x79fe('0x146')));return{'code':0xc8,'result':_0x79fe('0x146')};}else{logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x14e'),_0x16c0b0[_0x370bad],_0x79fe('0x147')));this[_0x79fe('0x34')]['noop'](util[_0x79fe('0x26')]('IFTIME\x20%s\x20%s',_0x16c0b0[_0x370bad],_0x79fe('0x147')));}}return{'code':0xc8,'result':_0x79fe('0x147')};};AGIVertices[_0x79fe('0x14')]['hangup']=function(_0x3f8a6f){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x14f'),_0x3f8a6f[_0x79fe('0x36')]));return this[_0x79fe('0x34')][_0x79fe('0x150')]();};AGIVertices['prototype'][_0x79fe('0x151')]=function(_0x7c79a4){logger['info'](util[_0x79fe('0x26')](_0x79fe('0x152'),_0x7c79a4[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x7c79a4[_0x79fe('0x75')])){return this[_0x79fe('0x34')]['noop']('no\x20key\x20configured');}var _0x47e08e=_0x79fe('0x13c');var _0x425931=util[_0x79fe('0x26')](_0x79fe('0x153'),FILES_PATH,rs[_0x79fe('0x120')](0x4));var _0x4a3e40=util[_0x79fe('0x26')]('%s.%s',_0x425931,_0x47e08e);var _0x1724f4=!![];if(_0x7c79a4[_0x79fe('0x134')]===_0x79fe('0x135')){_0x1724f4=![];}var _0x5c78d1=this[_0x79fe('0x34')][_0x79fe('0x136')](_0x425931,_0x47e08e,_0x7c79a4[_0x79fe('0x137')],_0x7c79a4[_0x79fe('0x61')],undefined,_0x1724f4);if(_0x5c78d1[_0x79fe('0xa1')]!==-0x1){this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x154'),_0x4a3e40));var _0x351407=this[_0x79fe('0x7f')][_0x79fe('0x6b')](this,_0x7c79a4,_0x4a3e40);if(_0x351407){for(var _0x15adea in _0x351407){if(_0x351407[_0x79fe('0x93')](_0x15adea)){this['channel'][_0x79fe('0x9c')](util[_0x79fe('0x26')](_0x79fe('0x155'),_0x15adea[_0x79fe('0xf9')]()),_0x351407[_0x15adea]);}}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')]('IspeechASR\x20Result\x20%s',JSON[_0x79fe('0x6f')](_0x351407)));}}return _0x5c78d1;};AGIVertices[_0x79fe('0x14')][_0x79fe('0x156')]=function(_0x1e0f27){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x157'),_0x1e0f27[_0x79fe('0x36')]));if(!this['isConfigured'](_0x1e0f27['key'])){return this[_0x79fe('0x34')][_0x79fe('0xa7')]('no\x20key\x20configured');}if(!this[_0x79fe('0x81')](_0x1e0f27['text'])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0xa8'));}this['channel']['noop'](util[_0x79fe('0x26')](_0x79fe('0x158'),_0x1e0f27['text']));var _0x164742=this[_0x79fe('0x7b')][_0x79fe('0x6b')](this,_0x1e0f27);if(_0x164742){this['channel'][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x154'),_0x164742));var _0x541787=this['channel'][_0x79fe('0x109')](_0x164742,_0x1e0f27[_0x79fe('0x137')]);try{fs[_0x79fe('0x10a')](_0x164742+'.wav');}catch(_0x505420){logger[_0x79fe('0x29')](_0x505420);}return _0x541787;}return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x1e0f27,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['login']=function(_0x36b4f9){logger[_0x79fe('0x2a')](util['format'](_0x79fe('0x159'),_0x36b4f9['label']));if(!this['isConfigured'](_0x36b4f9[_0x79fe('0x15a')])){return this['channel'][_0x79fe('0x29')](_0x36b4f9,_0x79fe('0x15b'));}logger['info'](util[_0x79fe('0x26')](_0x79fe('0x15c'),this[_0x79fe('0x34')][_0x79fe('0x38')],_0x36b4f9[_0x79fe('0x15a')]));var _0xfcfde0=this['agentLogin'][_0x79fe('0x6b')](this,_0x36b4f9[_0x79fe('0x15a')]);if(_0xfcfde0){logger[_0x79fe('0x2a')](util['format'](_0x79fe('0x15d'),this[_0x79fe('0x34')]['callerid'],_0x36b4f9[_0x79fe('0x15a')]));this['channel'][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x15d'),this[_0x79fe('0x34')][_0x79fe('0x38')],_0x36b4f9[_0x79fe('0x15a')]));return{'code':0xc8,'result':_0x79fe('0x15e')};}else{logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x15f'),this[_0x79fe('0x34')]['callerid'],_0x36b4f9[_0x79fe('0x15a')]));this[_0x79fe('0x34')][_0x79fe('0xa7')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x79fe('0x34')]['callerid'],_0x36b4f9[_0x79fe('0x15a')]));return{'code':0xc8,'result':_0x79fe('0x160')};}};AGIVertices['prototype'][_0x79fe('0x161')]=function(_0x4253c4){logger['info'](util[_0x79fe('0x26')](_0x79fe('0x162'),_0x4253c4[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x4253c4[_0x79fe('0x15a')])){return this[_0x79fe('0x34')]['error'](_0x4253c4,_0x79fe('0x15b'));}logger[_0x79fe('0x2a')](util['format'](_0x79fe('0x15c'),this[_0x79fe('0x34')][_0x79fe('0x38')],_0x4253c4[_0x79fe('0x15a')]));var _0x20371f=this['agentLogout'][_0x79fe('0x6b')](this,_0x4253c4[_0x79fe('0x15a')]);if(_0x20371f){logger[_0x79fe('0x2a')](util['format'](_0x79fe('0x15d'),this[_0x79fe('0x34')][_0x79fe('0x38')],_0x4253c4[_0x79fe('0x15a')]));this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x15d'),this[_0x79fe('0x34')]['callerid'],_0x4253c4[_0x79fe('0x15a')]));return{'code':0xc8,'result':_0x79fe('0x15e')};}else{logger[_0x79fe('0x2a')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x79fe('0x38')],_0x4253c4['findBy']));this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x15f'),this[_0x79fe('0x34')][_0x79fe('0x38')],_0x4253c4[_0x79fe('0x15a')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x79fe('0x163')]=function(_0x5b5958){logger['info'](util[_0x79fe('0x26')](_0x79fe('0x164'),_0x5b5958[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x5b5958[_0x79fe('0x165')])){return this[_0x79fe('0x34')]['error'](_0x5b5958,_0x79fe('0x166'));}this['channel']['noop'](util[_0x79fe('0x26')]('math\x20%s',_0x5b5958['operation']));var _0xab0629=eval(_0x5b5958[_0x79fe('0x165')]);if(!this[_0x79fe('0x81')](_0x5b5958['variable_id'])){return this['channel'][_0x79fe('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x33ab12=this[_0x79fe('0x10')][_0x79fe('0x6b')](this,_0x5b5958[_0x79fe('0xda')]);if(!_0x33ab12){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x5b5958,'no\x20variable\x20found');}if(_[_0x79fe('0x97')](_0xab0629)){var _0xa2df5c=this;_0xab0629[_0x79fe('0xdc')](function(_0x22de8e,_0x550ca3){_0xa2df5c[_0x79fe('0x34')]['setVariable'](util[_0x79fe('0x26')](_0x79fe('0x167'),_0x33ab12,_0x550ca3),_0x22de8e);});return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x168'),_0x33ab12));}else{return this[_0x79fe('0x34')][_0x79fe('0x9c')](_0x33ab12,_0xab0629);}};AGIVertices[_0x79fe('0x14')][_0x79fe('0x169')]=function(_0x205431){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x205431[_0x79fe('0x36')]));if(_0x205431[_0x79fe('0xa4')]===0x0){return this[_0x79fe('0xa3')](_0x205431);}_0x205431[_0x79fe('0xa4')]-=0x1;if(!this[_0x79fe('0x81')](_0x205431['file_id'])){return this['channel'][_0x79fe('0x29')](_0x205431,'no\x20file\x20audio\x20selected');}var _0x26319a=this[_0x79fe('0x1e')]['sync'](this,_0x205431[_0x79fe('0x119')]);if(!_0x26319a){return this['channel']['error'](_0x205431,'no\x20file\x20audio\x20found');}var _0x10fba2=this[_0x79fe('0x34')][_0x79fe('0x11a')](_0x26319a,_0x205431[_0x79fe('0x11b')],_0x205431[_0x79fe('0x16a')]);var _0x16484f=_0x10fba2[_0x79fe('0xa1')];if(_0x10fba2[_0x79fe('0xa1')]===-0x1){this[_0x79fe('0x33')][_0x79fe('0x6b')](this,_0x205431,'-1');return _0x10fba2;}else if(_0x10fba2[_0x79fe('0x9f')]==='timeout'){_0x10fba2[_0x79fe('0xa1')]=_0x10fba2['result'][_0x79fe('0x9b')]>0x0?_0x10fba2['result']:'t';}else if(_['isEmpty'](_0x10fba2['result'])){_0x10fba2[_0x79fe('0xa1')]='#';_0x16484f='#';}if(!this['isConfigured'](_0x205431[_0x79fe('0xda')])){this[_0x79fe('0x34')][_0x79fe('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x38cc42=this[_0x79fe('0x10')][_0x79fe('0x6b')](this,_0x205431[_0x79fe('0xda')]);if(!_0x38cc42){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x205431,_0x79fe('0xdb'));}this[_0x79fe('0x34')]['setVariable'](_0x38cc42,_0x16484f);}this[_0x79fe('0x33')][_0x79fe('0x6b')](this,_0x205431,_0x16484f);return _0x10fba2;};AGIVertices[_0x79fe('0x14')][_0x79fe('0xa7')]=function(_0x243863){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x16b'),_0x243863['label']));return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x243863[_0x79fe('0x16c')]||_0x243863[_0x79fe('0x36')]);};AGIVertices[_0x79fe('0x14')][_0x79fe('0x16d')]=function(_0x89930e){logger[_0x79fe('0x2a')](util['format'](_0x79fe('0x16e'),_0x89930e[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x89930e[_0x79fe('0x15a')])){return this['channel']['error'](_0x89930e,'no\x20find\x20by\x20configured');}logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x15c'),this[_0x79fe('0x34')][_0x79fe('0x38')],_0x89930e[_0x79fe('0x15a')]));var _0xc0905c=this[_0x79fe('0x4c')][_0x79fe('0x6b')](this,_0x89930e[_0x79fe('0x16f')]);var _0x330c70=this[_0x79fe('0x4e')][_0x79fe('0x6b')](this,_0x89930e['findBy'],_0xc0905c);if(_0x330c70){logger['info'](util[_0x79fe('0x26')](_0x79fe('0x15d'),this[_0x79fe('0x34')][_0x79fe('0x38')],_0x89930e[_0x79fe('0x15a')]));this[_0x79fe('0x34')][_0x79fe('0xa7')](util['format'](_0x79fe('0x15d'),this[_0x79fe('0x34')][_0x79fe('0x38')],_0x89930e[_0x79fe('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger[_0x79fe('0x2a')](util[_0x79fe('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x79fe('0x34')]['callerid'],_0x89930e[_0x79fe('0x15a')]));this['channel'][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x15d'),this[_0x79fe('0x34')][_0x79fe('0x38')],_0x89930e[_0x79fe('0x15a')]));return{'code':0xc8,'result':_0x79fe('0x160')};}};AGIVertices[_0x79fe('0x14')][_0x79fe('0x170')]=function(_0x181e15){logger['info'](util['format'](_0x79fe('0x171'),_0x181e15['label']));if(!this[_0x79fe('0x81')](_0x181e15[_0x79fe('0x119')])){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x181e15,_0x79fe('0x172'));}var _0x10c4b2=this[_0x79fe('0x1e')]['sync'](this,_0x181e15[_0x79fe('0x119')]);if(!_0x10c4b2){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x181e15,_0x79fe('0x173'));}var _0x9730d4=this[_0x79fe('0x34')][_0x79fe('0x56')](_0x79fe('0x174'),[_0x10c4b2,_0x181e15[_0x79fe('0xe7')]]);if(_0x9730d4['result']===-0x1){return _0x9730d4;}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x175'),_0x79fe('0x174'),_0x10c4b2));};AGIVertices[_0x79fe('0x14')]['queue']=function(_0x5843ec){logger[_0x79fe('0x2a')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x5843ec[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x5843ec[_0x79fe('0x176')])){return this[_0x79fe('0x34')]['error'](_0x5843ec,_0x79fe('0x177'));}var _0x189b8d='';var _0x211be5=parseInt(_0x5843ec['queue_id'],0xa);if(isNaN(_0x211be5)){_0x189b8d=_0x5843ec[_0x79fe('0x176')];}else{_0x189b8d=this[_0x79fe('0x15')][_0x79fe('0x6b')](this,_0x5843ec['queue_id']);if(!_0x189b8d){return this['channel'][_0x79fe('0x29')](_0x5843ec,'no\x20queue\x20found');}}var _0x35211b='';if(this[_0x79fe('0x81')](_0x5843ec[_0x79fe('0x119')])){var _0x225c01=this[_0x79fe('0x1e')][_0x79fe('0x6b')](this,_0x5843ec[_0x79fe('0x119')]);if(_0x225c01){_0x35211b=_0x225c01;}}this[_0x79fe('0x33')][_0x79fe('0x6b')](this,_0x5843ec,_0x189b8d);if(_0x5843ec[_0x79fe('0xe7')]['indexOf']('x')<0x0){_0x5843ec[_0x79fe('0xe7')]+='x';}if(_0x5843ec[_0x79fe('0xe7')][_0x79fe('0x178')]('X')<0x0){_0x5843ec['opts']+='X';}this[_0x79fe('0x34')][_0x79fe('0x9c')](_0x79fe('0x179'),_0x189b8d?_0x189b8d[_0x79fe('0x17a')]():'');var _0x2b3632=this[_0x79fe('0x34')][_0x79fe('0x56')](_0x79fe('0x17b'),[_0x189b8d,_0x5843ec[_0x79fe('0xe7')],_0x5843ec[_0x79fe('0x6d')],_0x35211b,_0x5843ec[_0x79fe('0x61')],_0x5843ec[_0x79fe('0x7')],_0x5843ec[_0x79fe('0x17c')],_0x5843ec[_0x79fe('0x17d')],'',_0x5843ec[_0x79fe('0x17e')]]);if(_0x2b3632[_0x79fe('0xa1')]===-0x1){return _0x2b3632;}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util['format'](_0x79fe('0x175'),_0x79fe('0x17b'),_0x189b8d));};AGIVertices['prototype'][_0x79fe('0x17f')]=function(_0x39334c){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x180'),_0x39334c[_0x79fe('0x36')]));var _0x12be06=_0x39334c[_0x79fe('0x181')]||_0x79fe('0x13c');var _0x42eac8=util[_0x79fe('0x26')](_0x79fe('0x182'),this[_0x79fe('0x34')][_0x79fe('0x35')],rs['generate'](0x5));var _0x279e68=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x42eac8,_0x12be06);var _0x346c47=util[_0x79fe('0x26')](_0x79fe('0x153'),FILES_PATH,_0x42eac8);this[_0x79fe('0x39')]['sync'](this,_0x39334c,_0x42eac8,_0x279e68);this['channel'][_0x79fe('0x9c')](_0x79fe('0x183'),_0x42eac8);logger[_0x79fe('0x2a')](_0x79fe('0x184'),_0x346c47,_0x12be06,_0x39334c[_0x79fe('0x185')],_0x39334c['timeout']);return this[_0x79fe('0x34')][_0x79fe('0x136')](_0x346c47,_0x12be06,_0x39334c[_0x79fe('0x185')],_0x39334c[_0x79fe('0x61')],undefined,!![]);};AGIVertices[_0x79fe('0x14')][_0x79fe('0x186')]=function(_0x427aa1){logger[_0x79fe('0x2a')](util['format'](_0x79fe('0x187'),_0x427aa1[_0x79fe('0x36')]));if(!this['isConfigured'](_0x427aa1[_0x79fe('0x6d')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0x188'));}var _0x4f9b3d=this[_0x79fe('0x189')][_0x79fe('0x6b')](this,_0x427aa1);logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x18a'),util['inspect'](_0x4f9b3d,{'showHidden':![],'depth':null})));if(!this[_0x79fe('0x81')](_0x427aa1['variable_id'])){return this[_0x79fe('0x34')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x3933d9=this[_0x79fe('0x10')][_0x79fe('0x6b')](this,_0x427aa1[_0x79fe('0xda')]);if(!_0x3933d9){return this['channel'][_0x79fe('0x29')](_0x427aa1,_0x79fe('0xdb'));}this['channel']['setVariable'](util[_0x79fe('0x26')](_0x79fe('0x18b'),_0x3933d9),_0x4f9b3d['statusCode']?_0x4f9b3d['statusCode']:_0x79fe('0x18c'));this[_0x79fe('0x34')][_0x79fe('0x9c')](util[_0x79fe('0x26')](_0x79fe('0x18d'),_0x3933d9),_0x4f9b3d[_0x79fe('0x71')]?_0x4f9b3d[_0x79fe('0x71')]:'OK');if(_0x4f9b3d[_0x79fe('0x66')]){try{this[_0x79fe('0x99')](_0x4f9b3d['body'],_0x3933d9);}catch(_0x30fdd5){logger[_0x79fe('0x29')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x3933d9));}}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0xdf'),_0x3933d9));};AGIVertices['prototype'][_0x79fe('0x18e')]=function(_0x263149){logger['info'](util[_0x79fe('0x26')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x263149['label']));return this['channel'][_0x79fe('0x18f')](_0x263149[_0x79fe('0x190')]['replace'](/\s+/g,''),_0x263149['escape_digits']);};AGIVertices[_0x79fe('0x14')][_0x79fe('0x191')]=function(_0x531c78){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x192'),_0x531c78[_0x79fe('0x36')]));return this[_0x79fe('0x34')]['sayNumber'](_0x531c78[_0x79fe('0x62')][_0x79fe('0x193')](/\s+/g,''),_0x531c78[_0x79fe('0x185')]);};AGIVertices[_0x79fe('0x14')]['sayphonetic']=function(_0x118349){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x194'),_0x118349[_0x79fe('0x36')]));return this['channel'][_0x79fe('0x195')](_0x118349[_0x79fe('0x59')],_0x118349[_0x79fe('0x185')]);};AGIVertices[_0x79fe('0x14')]['sendMail']=function(_0x18fc9a){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x196'),_0x18fc9a[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x18fc9a['account_id'])){return this[_0x79fe('0x34')]['noop'](_0x79fe('0x197'));}var _0x5986=this['getMailAccount'][_0x79fe('0x6b')](this,_0x18fc9a[_0x79fe('0x198')]);if(!_0x5986||!_0x5986['Smtp']){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x18fc9a,_0x79fe('0x199'));}var _0x4dc67f={'from':util['format']('\x22%s\x22\x20<%s>',_0x5986[_0x79fe('0x12')],_0x5986['email']||_0x5986['Smtp'][_0x79fe('0x19a')]),'to':_0x18fc9a['to']||'','cc':_0x18fc9a['cc']||'','bcc':_0x18fc9a['bcc']||'','subject':_0x18fc9a[_0x79fe('0x19b')],'html':_0x18fc9a[_0x79fe('0x59')],'text':_0x18fc9a[_0x79fe('0x59')]};var _0x5dd8a8={'tls':{'rejectUnauthorized':![]}};if(_0x5986[_0x79fe('0x19c')]['service']){_0x5dd8a8[_0x79fe('0x19d')]=_0x5986[_0x79fe('0x19c')][_0x79fe('0x19d')];}else{_0x5dd8a8['host']=_0x5986['Smtp']['host'];_0x5dd8a8[_0x79fe('0x19e')]=_0x5986[_0x79fe('0x19c')]['port'];_0x5dd8a8['secure']=_0x5986[_0x79fe('0x19c')][_0x79fe('0x19f')];}if(_0x5986['Smtp'][_0x79fe('0x1a0')]){_0x5dd8a8[_0x79fe('0x1a1')]={'user':_0x5986['Smtp']['user'],'pass':_0x5986[_0x79fe('0x19c')]['pass']};}if(this[_0x79fe('0x81')](_0x18fc9a['template_id'])){}logger['debug'](_0x79fe('0x1a2'),JSON['stringify'](_0x4dc67f));this[_0x79fe('0x33')][_0x79fe('0x6b')](this,_0x18fc9a,_0x18fc9a[_0x79fe('0x198')]);this[_0x79fe('0x34')]['noop'](util[_0x79fe('0x26')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x5986[_0x79fe('0x12')]));this[_0x79fe('0x21')]['sync'](this,_0x5dd8a8,_0x4dc67f);return this[_0x79fe('0x34')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x79fe('0x14')][_0x79fe('0x1a3')]=function(_0x4082e0){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x4082e0[_0x79fe('0x36')]));return this[_0x79fe('0x34')]['noop'](_0x79fe('0x1a4'));};AGIVertices['prototype'][_0x79fe('0x1a5')]=function(_0x4637d4){logger['info'](util[_0x79fe('0x26')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4637d4[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x4637d4[_0x79fe('0x1a6')])){return this['channel']['noop'](_0x79fe('0x1a7'));}var _0x3309eb=this['getSmsAccount'][_0x79fe('0x6b')](this,_0x4637d4['sms_account_id']);if(!_0x3309eb){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x4637d4,_0x79fe('0x1a8'));}var _0xe8be32={'body':_0x4637d4[_0x79fe('0x1a9')],'phone':_0x4637d4['to']||'','SmsAccountId':_0x3309eb['id']};logger[_0x79fe('0x1aa')](_0x79fe('0x1ab'),JSON[_0x79fe('0x6f')](_0xe8be32));this[_0x79fe('0x33')][_0x79fe('0x6b')](this,_0x4637d4,_0x4637d4[_0x79fe('0x1a6')]);this['channel'][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x1ac'),_0x3309eb[_0x79fe('0x12')]));this['createSmsMessage'][_0x79fe('0x6b')](this,_0xe8be32);return this[_0x79fe('0x34')]['noop'](_0x79fe('0x1ad'));};AGIVertices['prototype'][_0x79fe('0x1ae')]=function(_0x22507c){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x22507c[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x22507c[_0x79fe('0xda')])){return this[_0x79fe('0x34')]['error'](_0x22507c,_0x79fe('0x1af'));}var _0x3a60ac=this[_0x79fe('0x10')][_0x79fe('0x6b')](this,_0x22507c['variable_id']);if(!_0x3a60ac){return this['channel'][_0x79fe('0x29')](_0x22507c,_0x79fe('0xdb'));}return this['channel']['setVariable'](_0x3a60ac,_0x22507c[_0x79fe('0x1b0')]);};AGIVertices[_0x79fe('0x14')][_0x79fe('0x1b1')]=function(_0xcba30a){logger['info'](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0xcba30a[_0x79fe('0x36')]));this[_0x79fe('0x34')]['noop'](_0x79fe('0x1b2'));if(_0xcba30a[_0x79fe('0xbb')]===_0x79fe('0x1b3')){this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0x1b4'));return this['channel'][_0x79fe('0xbb')]();}return this[_0x79fe('0x34')]['noop']('Skipped\x20Answer');};AGIVertices[_0x79fe('0x14')][_0x79fe('0x1b5')]=function(_0x22702e){logger[_0x79fe('0x2a')](util['format'](_0x79fe('0x1b6'),_0x22702e[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x22702e[_0x79fe('0x1b7')])){return this[_0x79fe('0x34')]['error'](_0x22702e,_0x79fe('0x1b8'));}var _0x6db6be=this['getSquareProject']['sync'](this,_0x22702e['project_id']);if(!this[_0x79fe('0x81')](_0x6db6be)){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x22702e,util[_0x79fe('0x26')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x22702e[_0x79fe('0x1b7')]));}if(_0x6db6be===this['channel'][_0x79fe('0x37')]){return this[_0x79fe('0x34')]['error'](_0x22702e,_0x79fe('0x1b9'));}this[_0x79fe('0x33')][_0x79fe('0x6b')](this,_0x22702e,_0x6db6be);var _0x528af3=this[_0x79fe('0x34')][_0x79fe('0x56')](_0x79fe('0x1ba'),util[_0x79fe('0x26')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x79fe('0x1bb')]||'127.0.0.1',_0x6db6be,this[_0x79fe('0x34')]['arg_1']));if(_0x528af3[_0x79fe('0xa1')]===-0x1){return _0x528af3;}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x175'),_0x79fe('0x1ba'),_0x6db6be));};AGIVertices[_0x79fe('0x14')][_0x79fe('0x1bc')]=function(_0x5456d1){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x1bd'),_0x5456d1[_0x79fe('0x36')]));var _0x3eeeba=this['shellCommand'][_0x79fe('0x6b')](this,_0x5456d1[_0x79fe('0xb7')]);this[_0x79fe('0x33')][_0x79fe('0x6b')](this,_0x5456d1,_0x5456d1[_0x79fe('0xb7')]);if(this['isConfigured'](_0x5456d1[_0x79fe('0xda')])){var _0x44ddb2=this[_0x79fe('0x10')][_0x79fe('0x6b')](this,_0x5456d1['variable_id']);if(_0x44ddb2){this[_0x79fe('0x34')]['setVariable'](_0x44ddb2,_0x3eeeba);return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x1be'),_0x5456d1['command'],_0x44ddb2));}}return this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x1bf'),_0x5456d1[_0x79fe('0xb7')]));};AGIVertices[_0x79fe('0x14')][_0x79fe('0x1c0')]=function(_0x4f5dde){logger['info'](util[_0x79fe('0x26')](_0x79fe('0x1c1'),_0x4f5dde[_0x79fe('0x36')]));_0x4f5dde['text']=_0x4f5dde[_0x79fe('0x59')][_0x79fe('0x193')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x79fe('0x81')](_0x4f5dde[_0x79fe('0x57')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0x1c2'));}if(!this[_0x79fe('0x81')](_0x4f5dde[_0x79fe('0x59')])){return this[_0x79fe('0x34')][_0x79fe('0xa7')](_0x79fe('0xa8'));}this[_0x79fe('0x34')][_0x79fe('0xa7')](util['format'](_0x79fe('0x1c3'),_0x4f5dde[_0x79fe('0x59')]));var _0xab858f=this[_0x79fe('0x1c4')][_0x79fe('0x6b')](this,_0x4f5dde);if(_0xab858f){this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x1c5'),_0xab858f));var _0x5b69c9=this[_0x79fe('0x34')][_0x79fe('0x109')](_0xab858f);try{fs['unlink'](_0xab858f+_0x79fe('0x10b'));}catch(_0x58d955){logger[_0x79fe('0x29')](_0x58d955);}return _0x5b69c9;}return this[_0x79fe('0x34')]['error'](_0x4f5dde,_0x79fe('0x1c6'));};AGIVertices[_0x79fe('0x14')][_0x79fe('0x1c7')]=function(_0x33cb24){logger[_0x79fe('0x2a')](util['format'](_0x79fe('0x1c8'),_0x33cb24[_0x79fe('0x36')]));_0x33cb24[_0x79fe('0x59')]=_0x33cb24['text'][_0x79fe('0x193')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x33cb24[_0x79fe('0x59')])){return this['channel'][_0x79fe('0xa7')](_0x79fe('0xa8'));}this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')](_0x79fe('0x1c9'),_0x33cb24['text']));var _0x115b89=this['googleTTS'][_0x79fe('0x6b')](this,_0x33cb24);if(_0x115b89){this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')]('Google\x20TTS\x20%s\x20file\x20created',_0x115b89));var _0x3bdcd3=this[_0x79fe('0x34')]['streamFile'](_0x115b89);try{fs[_0x79fe('0x10a')](_0x115b89+_0x79fe('0x10b'));}catch(_0x2c0cd4){logger[_0x79fe('0x29')](_0x2c0cd4);}return _0x3bdcd3;}return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x33cb24,_0x79fe('0x1ca'));};AGIVertices[_0x79fe('0x14')]['unpause']=function(_0x206e53){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x1cb'),_0x206e53[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x206e53[_0x79fe('0x15a')])){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x206e53,_0x79fe('0x15b'));}logger['info'](util[_0x79fe('0x26')](_0x79fe('0x15c'),this[_0x79fe('0x34')][_0x79fe('0x38')],_0x206e53[_0x79fe('0x15a')]));var _0xe43705=this['agentUnpause'][_0x79fe('0x6b')](this,_0x206e53[_0x79fe('0x15a')]);if(_0xe43705){logger['info'](util[_0x79fe('0x26')](_0x79fe('0x15d'),this['channel'][_0x79fe('0x38')],_0x206e53['findBy']));this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x206e53['findBy']));return{'code':0xc8,'result':_0x79fe('0x15e')};}else{logger[_0x79fe('0x2a')](util[_0x79fe('0x26')](_0x79fe('0x15f'),this[_0x79fe('0x34')][_0x79fe('0x38')],_0x206e53['findBy']));this[_0x79fe('0x34')][_0x79fe('0xa7')](util[_0x79fe('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x79fe('0x34')][_0x79fe('0x38')],_0x206e53[_0x79fe('0x15a')]));return{'code':0xc8,'result':_0x79fe('0x160')};}};AGIVertices['prototype'][_0x79fe('0x1cc')]=function(_0x2e3857){logger[_0x79fe('0x2a')](util[_0x79fe('0x26')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x2e3857[_0x79fe('0x36')]));var _0x3d7d4a=this[_0x79fe('0x34')]['exec'](_0x79fe('0x1cd'),[_0x2e3857['mailbox'],_0x2e3857['options']]);if(_0x3d7d4a[_0x79fe('0xa1')]===-0x1){return _0x3d7d4a;}return this['channel']['noop'](util[_0x79fe('0x26')](_0x79fe('0x175'),_0x79fe('0x1cd'),_0x2e3857[_0x79fe('0x1ce')]));};AGIVertices[_0x79fe('0x14')]['vswitch']=function(_0x86dadd){logger[_0x79fe('0x2a')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x86dadd[_0x79fe('0x36')]));if(!this[_0x79fe('0x81')](_0x86dadd[_0x79fe('0xda')])){return this[_0x79fe('0x34')]['error'](_0x86dadd,_0x79fe('0x1af'));}var _0x3114a5=this[_0x79fe('0x10')][_0x79fe('0x6b')](this,_0x86dadd[_0x79fe('0xda')]);if(!_0x3114a5){return this[_0x79fe('0x34')][_0x79fe('0x29')](_0x86dadd,'no\x20variable\x20found');}var _0x31d634=this['channel'][_0x79fe('0x10')](_0x3114a5);return{'code':0xc8,'result':_0x31d634[_0x79fe('0x9f')]?_0x31d634['extra']:'-'};};String[_0x79fe('0x14')][_0x79fe('0x9e')]=function(_0xd64fa3,_0x2d061f){return this['split'](_0xd64fa3)[_0x79fe('0x1cf')](_0x2d061f);};module['exports']=AGIVertices; \ No newline at end of file +var _0xd819=['toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','trim','googleCloudTTS','apiKey','text','languageCode','en-US','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','PUT','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','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','googleASR','google_asr_language','tildeASR','appsecret','clear','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','options','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','scheduledAt','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','getSquareOdbc','odbc_id','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','speech','out','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','toUpperCase','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','maxdigit','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ISPEECH_ASR_%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','failure','playback','PLAYBACK','Executed\x20command\x20%s\x20%s','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','email','user','bcc','subject','service','host','port','secure','authentication','auth','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','join','exports','util','lodash','shelljs','odbc','moment','request-promise','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20'];(function(_0x19f8ee,_0x3e08c2){var _0x3b68f2=function(_0x1f0f13){while(--_0x1f0f13){_0x19f8ee['push'](_0x19f8ee['shift']());}};_0x3b68f2(++_0x3e08c2);}(_0xd819,0x181));var _0x9d81=function(_0x519380,_0x7f196){_0x519380=_0x519380-0x0;var _0x60ba2c=_0xd819[_0x519380];return _0x60ba2c;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x9d81('0x0'));var _=require(_0x9d81('0x1'));var sh=require(_0x9d81('0x2'));var odbc=require(_0x9d81('0x3'))();var rs=require('randomstring');var moment=require(_0x9d81('0x4'));var Mustache=require('mustache');var rp=require(_0x9d81('0x5'));var logger=require('../../config/logger')(_0x9d81('0x6'));var config=require(_0x9d81('0x7'));var scripts=require(_0x9d81('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x9d81('0x9'),_0x9d81('0xa')];var verticesWithRetry=[_0x9d81('0xb'),_0x9d81('0xc'),_0x9d81('0xd')];var AGIVertices=function(_0x43244d,_0x28d055,_0x21e4f7){this[_0x9d81('0xe')]=_0x43244d;this[_0x9d81('0xf')]=_0x28d055;this[_0x9d81('0x10')]=_0x21e4f7;};AGIVertices[_0x9d81('0x11')][_0x9d81('0x12')]=function(_0x32ff90,_0x53951a){this[_0x9d81('0xf')][_0x9d81('0x13')](_0x32ff90)['then'](function(_0x2113a5){_0x53951a(null,_0x2113a5?_0x2113a5[_0x9d81('0x14')]:![]);})[_0x9d81('0x15')](function(_0x25b9e8){_0x53951a(_0x25b9e8);});};AGIVertices['prototype'][_0x9d81('0x16')]=function(_0x4be590,_0x228553){this['rpc'][_0x9d81('0x17')](_0x4be590)[_0x9d81('0x18')](function(_0x5d0f0f){_0x228553(null,_0x5d0f0f?_0x5d0f0f[_0x9d81('0x14')]:![]);})[_0x9d81('0x15')](function(_0x2ba83e){_0x228553(_0x2ba83e);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x19')]=function(_0x43452e,_0x446994){this[_0x9d81('0xf')]['getSquareProjectById'](_0x43452e)[_0x9d81('0x18')](function(_0x1bb0d7){_0x446994(null,_0x1bb0d7?_0x1bb0d7[_0x9d81('0x14')]:![]);})[_0x9d81('0x15')](function(_0x3fd093){_0x446994(_0x3fd093);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x2879ad,_0x3844c8){this[_0x9d81('0xf')][_0x9d81('0x1a')](_0x2879ad)[_0x9d81('0x18')](function(_0x175d4f){_0x3844c8(null,_0x175d4f?_0x175d4f[_0x9d81('0x1b')]:![]);})[_0x9d81('0x15')](function(_0x291249){_0x3844c8(_0x291249);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x1c')]=function(_0xd7d5cf,_0x7c5c52){this['rpc'][_0x9d81('0x1d')](_0xd7d5cf)[_0x9d81('0x18')](function(_0x2ebd66){_0x7c5c52(null,_0x2ebd66?_0x2ebd66[_0x9d81('0x14')]:![]);})[_0x9d81('0x15')](function(_0x12a1e4){_0x7c5c52(_0x12a1e4);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x1e')]=function(_0x56fcd7,_0x25bbd4){this[_0x9d81('0xf')][_0x9d81('0x1f')](_0x56fcd7)[_0x9d81('0x18')](function(_0x49730b){_0x25bbd4(null,_0x49730b?_0x49730b[_0x9d81('0x14')]:![]);})['catch'](function(_0x213a73){_0x25bbd4(_0x213a73);});};AGIVertices['prototype'][_0x9d81('0x20')]=function(_0x5cba30,_0x3f44c0){var _0x2d8da6=this;this[_0x9d81('0xf')][_0x9d81('0x21')](_0x5cba30)[_0x9d81('0x18')](function(_0x16a188){_0x3f44c0(null,_0x16a188?_0x2d8da6[_0x9d81('0x22')](_0x16a188[_0x9d81('0x23')]):![]);})[_0x9d81('0x15')](function(_0xa9e62c){_0x3f44c0(_0xa9e62c);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x24')]=function(_0x397957,_0x28a5bf){this[_0x9d81('0xf')][_0x9d81('0x25')](_0x397957)['then'](function(_0x593041){_0x28a5bf(null,_0x593041?_0x593041:![]);})[_0x9d81('0x15')](function(_0xffc939){_0x28a5bf(_0xffc939);});};AGIVertices[_0x9d81('0x11')]['sendMailMessage']=function(_0xb9c18b,_0x6905c0,_0x4aa29d){this['mailRpc'][_0x9d81('0x26')](_0xb9c18b,_0x6905c0)[_0x9d81('0x18')](function(){_0x4aa29d(null);})[_0x9d81('0x15')](function(_0x20e581){_0x4aa29d(_0x20e581);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x27')]=function(_0x1bfb8b,_0x3234b4){this[_0x9d81('0xf')][_0x9d81('0x28')](_0x1bfb8b)[_0x9d81('0x18')](function(_0x204082){if(_0x204082){if(_0x204082[_0x9d81('0x29')]){_0x3234b4(null,[_0x204082['interval']]);}else{_0x3234b4(null,_[_0x9d81('0x2a')](_0x204082[_0x9d81('0x2b')],_0x9d81('0x2c')));}}else{_0x3234b4(null,![]);}})[_0x9d81('0x15')](function(_0x173ef1){_0x3234b4(_0x173ef1);});};AGIVertices['prototype'][_0x9d81('0x22')]=function(_0x36bed2){return util[_0x9d81('0x2d')](_0x9d81('0x2e'),FILES_PATH,_0x36bed2);};AGIVertices[_0x9d81('0x11')][_0x9d81('0x2f')]=function(_0x136205,_0x3abde3,_0x5e8f70){odbc[_0x9d81('0x30')](_0x136205,function(_0x25e0c0){if(_0x25e0c0){logger[_0x9d81('0x31')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x25e0c0);_0x5e8f70(_0x25e0c0);}else{logger[_0x9d81('0x32')]('ODBC\x20connection\x20successfully');odbc[_0x9d81('0x33')](_0x3abde3,function(_0x4ed2aa,_0x1a4b89){if(_0x4ed2aa){logger[_0x9d81('0x32')](_0x9d81('0x34'),_0x3abde3);_0x5e8f70(_0x4ed2aa);}else{logger['info'](_0x9d81('0x35'),_0x3abde3);odbc[_0x9d81('0x36')](function(_0x155e5f){if(_0x155e5f){logger[_0x9d81('0x31')](_0x9d81('0x37'),_0x155e5f);}_0x5e8f70(null,_0x1a4b89);});}});}});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x38')]=function(_0x2cd156,_0x4dca21){this['rpc']['getSmsAccountById'](_0x2cd156)[_0x9d81('0x18')](function(_0xa9cff1){_0x4dca21(null,_0xa9cff1?_0xa9cff1:![]);})['catch'](function(_0x323956){_0x4dca21(_0x323956);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x39')]=function(_0x597ecb,_0x3dd82f){this[_0x9d81('0xf')][_0x9d81('0x39')](_0x597ecb)[_0x9d81('0x18')](function(_0xd9c31b){_0x3dd82f(null,_0xd9c31b);})[_0x9d81('0x15')](function(_0x3a1684){_0x3dd82f(_0x3a1684);});};AGIVertices[_0x9d81('0x11')]['createSquareDetailsReport']=function(_0xd37559,_0x5101d7,_0x27b3b9){this[_0x9d81('0xf')][_0x9d81('0x3a')]({'uniqueid':this['channel']['uniqueid'],'node':_0xd37559[_0x9d81('0x3b')],'application':_0xd37559[_0x9d81('0x3c')],'data':_0x5101d7||null,'project_name':this['channel'][_0x9d81('0x3d')],'callerid':this[_0x9d81('0xe')][_0x9d81('0x3e')]})[_0x9d81('0x18')](function(_0x1ef0fa){if(_0x27b3b9){_0x27b3b9(null,_0x1ef0fa);}})[_0x9d81('0x15')](function(_0x28a5c3){if(_0x27b3b9){_0x27b3b9(_0x28a5c3);}});};AGIVertices['prototype'][_0x9d81('0x3f')]=function(_0x41b111,_0x169770,_0x190a2f,_0x4be63c){this[_0x9d81('0xf')]['createSquareRecording']({'uniqueid':this[_0x9d81('0xe')][_0x9d81('0x40')],'callerid':this[_0x9d81('0xe')][_0x9d81('0x3e')],'calleridname':this[_0x9d81('0xe')][_0x9d81('0x41')],'context':this[_0x9d81('0xe')]['context'],'extension':this['channel'][_0x9d81('0x42')],'priority':this['channel'][_0x9d81('0x43')],'accountcode':this[_0x9d81('0xe')][_0x9d81('0x44')],'dnid':this[_0x9d81('0xe')][_0x9d81('0x45')],'projectName':this[_0x9d81('0xe')][_0x9d81('0x3d')],'saveName':_0x169770,'filename':_0x41b111['file']||_0x169770,'savePath':_0x190a2f})[_0x9d81('0x18')](function(_0x15ed68){_0x4be63c(null,_0x15ed68);})['catch'](function(_0x2caef6){_0x4be63c(_0x2caef6);});};AGIVertices['prototype']['createSquareMessage']=function(_0x3848ea,_0x28ce32,_0x220490,_0x4e0f4c,_0x22e721){this['rpc'][_0x9d81('0x46')]({'uniqueid':this[_0x9d81('0xe')][_0x9d81('0x40')],'body':_0x3848ea,'direction':_0x28ce32,'providerName':_0x220490,'providerResponse':_0x4e0f4c})[_0x9d81('0x18')](function(_0x58abdb){if(_0x22e721){_0x22e721(null,_0x58abdb);}})['catch'](function(_0x54ea74){if(_0x22e721){_0x22e721(_0x54ea74);}});};AGIVertices[_0x9d81('0x11')]['createCmContact']=function(_0x42db05,_0x5a8eba){this[_0x9d81('0xf')][_0x9d81('0x47')]({'firstName':_[_0x9d81('0x48')](_0x42db05[_0x9d81('0x14')])||_[_0x9d81('0x49')](_0x42db05['name'])?'callback_'+Math[_0x9d81('0x4a')]():_0x42db05['name'],'lastName':_['isEmpty'](_0x42db05['lastName'])||_['isNil'](_0x42db05[_0x9d81('0x4b')])?null:_0x42db05[_0x9d81('0x4b')],'phone':_0x42db05[_0x9d81('0x4c')],'ListId':_0x42db05[_0x9d81('0x4d')],'scheduledat':_0x42db05['scheduledAt'],'callbackUniqueid':this[_0x9d81('0xe')][_0x9d81('0x40')],'tags':_0x9d81('0x4e'),'description':_0x9d81('0x4f')+_0x42db05['scheduledAt'][_0x9d81('0x50')](),'priority':_0x42db05[_0x9d81('0x51')]})[_0x9d81('0x18')](function(_0x459c8d){_0x5a8eba(null,_0x459c8d);})['catch'](function(_0x33f8f7){_0x5a8eba(_0x33f8f7);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x52')]=function(_0x2ec26a,_0x201de8){this[_0x9d81('0xf')][_0x9d81('0x53')](_0x2ec26a)['then'](function(_0x4f3cd1){_0x201de8(null,_0x4f3cd1?_0x4f3cd1['name']:![]);})[_0x9d81('0x15')](function(_0x49a286){_0x201de8(_0x49a286);});};AGIVertices['prototype']['agentPause']=function(_0x252c2,_0x544248,_0x4aecb4){var _0x193197={'role':_0x9d81('0x54')};_0x193197[_0x252c2]=this[_0x9d81('0xe')][_0x9d81('0x3e')];this[_0x9d81('0xf')][_0x9d81('0x55')](_0x193197,_0x544248,this['channel'][_0x9d81('0x40')])[_0x9d81('0x18')](function(_0x4492e4){_0x4aecb4(null,_[_0x9d81('0x49')](_0x4492e4)?![]:!![]);})[_0x9d81('0x15')](function(_0x4b4263){logger[_0x9d81('0x31')](_0x4b4263);_0x4aecb4(null,![]);});};AGIVertices['prototype'][_0x9d81('0x56')]=function(_0x545f68,_0x5d3b8d){var _0x21112c={'role':_0x9d81('0x54')};_0x21112c[_0x545f68]=this[_0x9d81('0xe')]['callerid'];this['rpc'][_0x9d81('0x56')](_0x21112c)[_0x9d81('0x18')](function(_0x25114b){_0x5d3b8d(null,_[_0x9d81('0x49')](_0x25114b)?![]:!![]);})['catch'](function(_0x12ab8f){logger[_0x9d81('0x31')](_0x12ab8f);_0x5d3b8d(null,![]);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x57')]=function(_0x351025,_0xdd609d){var _0x342525={'role':_0x9d81('0x54')};_0x342525[_0x351025]=this[_0x9d81('0xe')][_0x9d81('0x3e')];this['rpc'][_0x9d81('0x57')](_0x342525)[_0x9d81('0x18')](function(_0x1037e9){_0xdd609d(null,_[_0x9d81('0x49')](_0x1037e9)?![]:!![]);})[_0x9d81('0x15')](function(_0x4eedb9){logger[_0x9d81('0x31')](_0x4eedb9);_0xdd609d(null,![]);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x58')]=function(_0x365b29,_0x268b8b){var _0x3be75b={'role':'agent'};_0x3be75b[_0x365b29]=this['channel'][_0x9d81('0x3e')];var _0x57711f=_0x365b29!=_0x9d81('0x59')?util['format'](_0x9d81('0x5a'),'LOCAL',this[_0x9d81('0xe')]['callerid']):undefined;this['rpc'][_0x9d81('0x58')](_0x3be75b,_0x57711f)[_0x9d81('0x18')](function(_0x52e3ae){_0x268b8b(null,_['isNil'](_0x52e3ae)?![]:!![]);})['catch'](function(_0x4196ed){logger['error'](_0x4196ed);_0x268b8b(null,![]);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x5b')]=function(_0x4d3fdc,_0xdc640b){sh['exec'](_[_0x9d81('0x5c')](_0x4d3fdc),function(_0xa7dbc,_0x221311){var _0x42f6fd=_0x221311['replace'](/(\r\n|\n|\r)/gm,'');_0xdc640b(null,_0x42f6fd);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x5d')]=function(_0xf3e341,_0x442c7d){scripts[_0x9d81('0x5d')](_0xf3e341[_0x9d81('0x5e')],_0xf3e341['google_cloud_tts_text_type']||_0x9d81('0x5f'),_0xf3e341[_0x9d81('0x5f')],_0xf3e341[_0x9d81('0x60')]||_0x9d81('0x61'),_0xf3e341['ssmlGender']||'MALE',_0xf3e341['audioEncoding']||_0x9d81('0x62'))[_0x9d81('0x18')](function(_0x453134){_0x442c7d(null,_0x453134);})[_0x9d81('0x15')](function(_0x255d30){_0x442c7d(_0x255d30);});};AGIVertices['prototype'][_0x9d81('0x63')]=function(_0x439292,_0x5410d7){scripts[_0x9d81('0x63')](_0x439292[_0x9d81('0x5f')],_0x439292[_0x9d81('0x64')]||'en',0x1)['then'](function(_0x24b7a6){_0x5410d7(null,_0x24b7a6);})[_0x9d81('0x15')](function(_0xa65d3e){_0x5410d7(_0xa65d3e);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x65')]=function(_0x258b59,_0x439e24){var _0x414456={'uri':_0x258b59[_0x9d81('0x66')],'method':_0x258b59[_0x9d81('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x258b59['timeout'])===_0x9d81('0x68')&&parseInt(_0x258b59['timeout'])>=0x1?parseInt(_0x258b59[_0x9d81('0x69')])*0x3e8:0x5*0x3e8};if(_[_0x9d81('0x6a')](['POST',_0x9d81('0x6b')],_0x414456[_0x9d81('0x67')]['toUpperCase']())){try{_0x414456[_0x9d81('0x6c')]=_0x258b59[_0x9d81('0xa')]?JSON[_0x9d81('0x6d')](_0x258b59[_0x9d81('0xa')]):{};}catch(_0x37b9d7){logger[_0x9d81('0x31')](_0x9d81('0x6e'),_0x37b9d7);}}try{_0x414456[_0x9d81('0x6f')]=_0x258b59['rawHeaders']?JSON[_0x9d81('0x6d')](_0x258b59[_0x9d81('0x9')]):{};}catch(_0x22ab57){logger[_0x9d81('0x31')](_0x9d81('0x70'),_0x22ab57);}if(_0x258b59['computedVariables']){try{var _0x4c0835=require(_0x258b59['computedVariables'])[_0x9d81('0x71')](this,_0x414456);_0x414456[_0x9d81('0x72')]=Mustache[_0x9d81('0x73')](_0x258b59[_0x9d81('0x66')],_0x4c0835,{},['$$','$$']);if(_0x414456[_0x9d81('0x6f')]){_0x414456['headers']=JSON[_0x9d81('0x6d')](Mustache[_0x9d81('0x73')](JSON[_0x9d81('0x74')](_0x414456[_0x9d81('0x6f')]),_0x4c0835,{},['$$','$$']));}if(_0x414456[_0x9d81('0x6c')]){_0x414456[_0x9d81('0x6c')]=JSON[_0x9d81('0x6d')](Mustache[_0x9d81('0x73')](JSON[_0x9d81('0x74')](_0x414456[_0x9d81('0x6c')]),_0x4c0835,{},['$$','$$']));}}catch(_0x776a27){logger[_0x9d81('0x31')](_0x9d81('0x75'),_0x776a27);}}rp(_0x414456)[_0x9d81('0x18')](function(_0x157c9a){var _0x28a978={'statusCode':_0x157c9a[_0x9d81('0x76')]||0xc8,'statusMessage':_0x157c9a[_0x9d81('0x77')]||'OK','headers':_0x157c9a[_0x9d81('0x6f')]||{},'body':_0x157c9a[_0x9d81('0x6c')]||{}};_0x439e24(null,_0x28a978);})['catch'](function(_0x5a7739){var _0x1bdc26={'statusCode':_0x5a7739[_0x9d81('0x76')]||0x1f4,'statusMessage':_0x5a7739[_0x9d81('0x78')]||_0x9d81('0x79'),'headers':_0x5a7739['options'][_0x9d81('0x6f')]||{},'body':_0x5a7739['options']['body']||{}};_0x439e24(null,_0x1bdc26);});};AGIVertices['prototype'][_0x9d81('0x7a')]=function(_0x13abd7,_0x3c04b7){scripts[_0x9d81('0x7a')](this['channel'][_0x9d81('0x40')],_0x13abd7[_0x9d81('0x7b')],_0x13abd7[_0x9d81('0x5f')],_0x13abd7[_0x9d81('0x7c')]||'en')[_0x9d81('0x18')](function(_0x470b0a){_0x3c04b7(null,_0x470b0a);})[_0x9d81('0x15')](function(_0x2b34f5){_0x3c04b7(_0x2b34f5);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x7d')]=function(_0x155e1f,_0x58a5ec){scripts[_0x9d81('0x7d')](this[_0x9d81('0xe')][_0x9d81('0x40')],_0x155e1f[_0x9d81('0x7e')],_0x155e1f[_0x9d81('0x7f')],_0x155e1f[_0x9d81('0x80')],_0x155e1f[_0x9d81('0x5f')],_0x155e1f['dialogflowV2_language']||'en')[_0x9d81('0x18')](function(_0x47a179){_0x58a5ec(null,_0x47a179);})['catch'](function(_0x13993e){_0x58a5ec(_0x13993e);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x81')]=function(_0x29882e,_0x511695){scripts[_0x9d81('0x81')](this[_0x9d81('0xe')],_0x29882e)['then'](function(_0x1c7284){_0x511695(null,_0x1c7284);})[_0x9d81('0x15')](function(_0x39918b){_0x511695(_0x39918b);});};AGIVertices['prototype']['ispeechTTS']=function(_0xc59084,_0x2a0ece){scripts[_0x9d81('0x82')](_0xc59084[_0x9d81('0x7b')],_0xc59084[_0x9d81('0x5f')],_0xc59084['ispeech_tts_language']||_0x9d81('0x61'),_0xc59084['speed'])[_0x9d81('0x18')](function(_0x1a1ffa){_0x2a0ece(null,_0x1a1ffa);})[_0x9d81('0x15')](function(_0x538e0b){_0x2a0ece(_0x538e0b);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x83')]=function(_0x4e8e8a,_0x160ab6,_0x42e326){scripts[_0x9d81('0x83')](_0x160ab6,_0x4e8e8a[_0x9d81('0x7b')],_0x4e8e8a[_0x9d81('0x84')]||_0x9d81('0x61'),this[_0x9d81('0x85')](_0x4e8e8a['model'])?_0x4e8e8a[_0x9d81('0x86')]:undefined)['then'](function(_0x14dcaa){_0x42e326(null,_0x14dcaa);})[_0x9d81('0x15')](function(_0x1053b3){_0x42e326(_0x1053b3);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x87')]=function(_0x4ff317,_0x5d8635){scripts[_0x9d81('0x87')](_0x4ff317['aws_access_key_id'],_0x4ff317[_0x9d81('0x88')],_0x4ff317[_0x9d81('0x89')],_0x4ff317[_0x9d81('0x8a')]||_0x9d81('0x8b'),_0x4ff317['text'],_0x4ff317[_0x9d81('0x8c')]||'text')[_0x9d81('0x18')](function(_0x52c1e8){_0x5d8635(null,_0x52c1e8);})[_0x9d81('0x15')](function(_0x5042d7){_0x5d8635(_0x5042d7);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x8d')]=function(_0x249a93,_0x330759){scripts[_0x9d81('0x8d')](this[_0x9d81('0xe')][_0x9d81('0x40')],_0x249a93['aws_access_key_id'],_0x249a93[_0x9d81('0x88')],_0x249a93['aws_lex_region'],_0x249a93[_0x9d81('0x5f')],_0x249a93['aws_bot_name'])[_0x9d81('0x18')](function(_0x441810){_0x330759(null,_0x441810);})[_0x9d81('0x15')](function(_0xfff183){_0x330759(_0xfff183);});};AGIVertices[_0x9d81('0x11')][_0x9d81('0x8e')]=function(_0x2a0ef5,_0x43c96a,_0x376675){scripts[_0x9d81('0x8e')](_0x43c96a,_0x2a0ef5[_0x9d81('0x7b')],_0x2a0ef5[_0x9d81('0x8f')]||_0x9d81('0x61'))[_0x9d81('0x18')](function(_0x5596da){_0x376675(null,_0x5596da);})['catch'](function(_0x29340f){_0x376675(_0x29340f);});};AGIVertices[_0x9d81('0x11')]['tildeASR']=function(_0x25ddd3,_0xd6c322,_0x44a694){scripts[_0x9d81('0x90')](_0xd6c322,_0x25ddd3['appid'],_0x25ddd3[_0x9d81('0x91')],_0x25ddd3[_0x9d81('0x72')])[_0x9d81('0x18')](function(_0x2ad5da){_0x44a694(null,_0x2ad5da);})[_0x9d81('0x15')](function(_0x5e7384){_0x44a694(_0x5e7384);});};AGIVertices['prototype'][_0x9d81('0x92')]=function(_0x56c2b6){var _0xe5cd1b=_[_0x9d81('0x6a')](verticesWithRetry,_0x56c2b6[_0x9d81('0x3c')])?_0x56c2b6:_['clone'](_0x56c2b6);for(var _0x44ba30 in _0xe5cd1b){if(_0xe5cd1b[_0x9d81('0x93')](_0x44ba30)){if(_0xe5cd1b[_0x44ba30]&&_['isString'](_0xe5cd1b[_0x44ba30])){if(_['includes'](recursiveMapAttributes,_0x44ba30)){_0xe5cd1b[_0x44ba30]=this[_0x9d81('0x94')](_0xe5cd1b[_0x44ba30]);}else{_0xe5cd1b[_0x44ba30]=this[_0x9d81('0x95')](_0xe5cd1b[_0x44ba30]);}}}}return _0xe5cd1b;};AGIVertices[_0x9d81('0x11')][_0x9d81('0x96')]=function(_0x5772c5){for(var _0x240b99 in _0x5772c5){if(_0x5772c5[_0x9d81('0x93')](_0x240b99)){if(_['isPlainObject'](_0x5772c5[_0x240b99])){this['recursiveNodeIndex'](_0x5772c5[_0x240b99]);}else if(_[_0x9d81('0x97')](_0x5772c5[_0x240b99])){for(var _0x240361=0x0;_0x240361<_0x5772c5[_0x240b99][_0x9d81('0x98')];_0x240361++){this[_0x9d81('0x96')](_0x5772c5[_0x240b99][_0x240361]);}}else if(_[_0x9d81('0x99')](_0x5772c5[_0x240b99])){_0x5772c5[_0x240b99]=this[_0x9d81('0x95')](_0x5772c5[_0x240b99]);}}}};AGIVertices['prototype'][_0x9d81('0x9a')]=function(_0x5f57c4,_0x5288a2){for(var _0x2b836c in _0x5f57c4){if(_0x5f57c4[_0x9d81('0x93')](_0x2b836c)){if(_['isPlainObject'](_0x5f57c4[_0x2b836c])){if(!_[_0x9d81('0x48')](_0x5f57c4[_0x2b836c])){this['saveRestApiResult'](_0x5f57c4[_0x2b836c],util[_0x9d81('0x2d')]('%s.%s',_0x5288a2,_0x2b836c));}}else if(_['isArray'](_0x5f57c4[_0x2b836c])){for(var _0x4c7479=0x0;_0x4c7479<_0x5f57c4[_0x2b836c]['length'];_0x4c7479++){this[_0x9d81('0x9a')](_0x5f57c4[_0x2b836c][_0x4c7479],util[_0x9d81('0x2d')](_0x9d81('0x9b'),_0x5288a2,_0x2b836c+'['+_0x4c7479+']'));}}else{if(!_['isNil'](_0x5f57c4[_0x2b836c])){this[_0x9d81('0xe')][_0x9d81('0x9c')](util[_0x9d81('0x2d')](_0x9d81('0x9b'),_0x5288a2,_0x2b836c),_0x5f57c4[_0x2b836c]);}}}}};AGIVertices[_0x9d81('0x11')][_0x9d81('0x94')]=function(_0x575b30){try{var _0x589927=JSON[_0x9d81('0x6d')](_0x575b30);this[_0x9d81('0x96')](_0x589927);return JSON[_0x9d81('0x74')](_0x589927);}catch(_0x395301){return this[_0x9d81('0x95')](_0x575b30);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x2587f4){var _0x26ad6a=_0x2587f4['split']('{');for(var _0x58e843=0x1;_0x58e843<_0x26ad6a['length'];_0x58e843+=0x1){var _0x21e1a3=_0x26ad6a[_0x58e843]['split']('}');if(_0x21e1a3['length']>0x1){_0x2587f4=_0x2587f4[_0x9d81('0x9d')]('{'+_0x21e1a3[0x0]+'}',this['channel']['getVariable'](_0x21e1a3[0x0])[_0x9d81('0x9e')]||_0x21e1a3[0x0]);}}if(_0x26ad6a[_0x9d81('0x98')]===0x1){return _0x2587f4['toString']();}return this[_0x9d81('0x95')](_0x2587f4);};AGIVertices['prototype']['getAndSetVariable']=function(_0x22497d,_0x55c04d){var _0x287bfa=this['channel']['getVariable'](_0x22497d);if(_0x287bfa[_0x9d81('0x9f')]===-0x1){return _0x287bfa;}logger['info'](util[_0x9d81('0x2d')](_0x9d81('0xa0'),_0x55c04d,_0x287bfa[_0x9d81('0x9e')]));return this['channel']['setVariable'](_0x55c04d,_0x287bfa['extra']);};AGIVertices[_0x9d81('0x11')]['isConfigured']=function(_0x34dd67){return _0x34dd67&&_0x34dd67!=='0'&&_0x34dd67!=='-1'&&_0x34dd67!=='';};AGIVertices[_0x9d81('0x11')][_0x9d81('0xa1')]=function(_0x52bcaf){this[_0x9d81('0x3a')]['sync'](this,_0x52bcaf,'-');_0x52bcaf[_0x9d81('0xa2')]=_0x52bcaf[_0x9d81('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x9d81('0xa3')]=function(_0x101af1){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0xa4'),_0x101af1[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x101af1[_0x9d81('0x5f')])){return this['channel'][_0x9d81('0xa5')]('no\x20text\x20configured');}var _0xc72c09='\x22'+_0x101af1[_0x9d81('0x5f')]+'\x22';if(this[_0x9d81('0x85')](_0x101af1[_0x9d81('0xa6')])){_0xc72c09+=','+_0x101af1[_0x9d81('0xa6')];}var _0x22d9f9=this[_0x9d81('0xe')][_0x9d81('0xa7')](_0x9d81('0xa8'),_0xc72c09);if(_0x22d9f9[_0x9d81('0x9f')]===-0x1){return _0x22d9f9;}return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0xa9'),_0xc72c09));};AGIVertices[_0x9d81('0x11')][_0x9d81('0xaa')]=function(_0x654b82){logger[_0x9d81('0x32')](util['format'](_0x9d81('0xab'),_0x654b82[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x654b82[_0x9d81('0xac')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')]('no\x20grammar\x20configured');}var _0x3c4a77=_0x654b82[_0x9d81('0xac')];if(this[_0x9d81('0x85')](_0x654b82['options'])){_0x3c4a77+=','+_0x654b82[_0x9d81('0xa6')];}var _0x21d8b6=this['channel'][_0x9d81('0xa7')](_0x9d81('0xad'),_0x3c4a77);if(_0x21d8b6[_0x9d81('0x9f')]===-0x1){return _0x21d8b6;}var _0x3a2bd3=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x9d81('0xae'));if(_0x3a2bd3[_0x9d81('0x9f')]===-0x1){return _0x3a2bd3;}var _0x1dc582=this[_0x9d81('0xaf')](_0x9d81('0xb0'),'MRCP_RECOG_TRANSCRIPT');if(_0x1dc582[_0x9d81('0x9f')]===-0x1){return _0x1dc582;}var _0x489857=this[_0x9d81('0xaf')](_0x9d81('0xb1'),_0x9d81('0xb2'));if(_0x489857[_0x9d81('0x9f')]===-0x1){return _0x489857;}return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0xb3'),_0x3c4a77));};AGIVertices['prototype'][_0x9d81('0x6')]=function(_0x16b380){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x16b380[_0x9d81('0x3b')]));return this['channel'][_0x9d81('0x6')]([_0x16b380[_0x9d81('0xb4')],_0x16b380[_0x9d81('0xb5')]]);};AGIVertices[_0x9d81('0x11')][_0x9d81('0xb6')]=function(_0x4d7812){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0xb7'),_0x4d7812[_0x9d81('0x3b')]));if(this[_0x9d81('0x85')](_0x4d7812[_0x9d81('0x69')])){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x4d7812['timeout']));var _0x170ba3=this[_0x9d81('0xe')][_0x9d81('0xb8')](_0x4d7812[_0x9d81('0x69')]);if(_0x170ba3[_0x9d81('0x9f')]===-0x1){return _0x170ba3;}}return this[_0x9d81('0xe')][_0x9d81('0xb6')]();};AGIVertices['prototype'][_0x9d81('0x4e')]=function(_0x4d0419){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0xb9'),_0x4d0419['label']));if(!this['isConfigured'](_0x4d0419['list_id'])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x4d0419,_0x9d81('0xba'));}_0x4d0419[_0x9d81('0xbb')]=moment();if(this[_0x9d81('0x85')](_0x4d0419['delay'])){_0x4d0419[_0x9d81('0xbb')]=moment()[_0x9d81('0xbc')](_0x4d0419[_0x9d81('0xbd')],_0x9d81('0xbe'));}if(!this['isConfigured'](_0x4d0419[_0x9d81('0x51')])){_0x4d0419[_0x9d81('0x51')]=0x2;}this[_0x9d81('0x47')][_0x9d81('0x71')](this,_0x4d0419);return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0xbf'),_0x4d0419[_0x9d81('0x4c')],_0x4d0419[_0x9d81('0x4d')],_0x4d0419[_0x9d81('0xbb')]));};AGIVertices[_0x9d81('0x11')][_0x9d81('0xc0')]=function(_0xc0e8da){logger[_0x9d81('0x32')](util['format'](_0x9d81('0xc1'),_0xc0e8da[_0x9d81('0x3b')]));var _0x526cee=this['channel']['exec'](_0xc0e8da[_0x9d81('0xc2')],_0xc0e8da[_0x9d81('0xa6')]);if(_0x526cee[_0x9d81('0x9f')]===-0x1){return _0x526cee;}return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')]('Executed\x20command\x20%s\x20%s',_0xc0e8da[_0x9d81('0xc2')],_0xc0e8da[_0x9d81('0xa6')]));};AGIVertices[_0x9d81('0x11')][_0x9d81('0xc3')]=function(_0x1c8947){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0xc4'),_0x1c8947[_0x9d81('0x3b')]));if(!this['isConfigured'](_0x1c8947[_0x9d81('0x5f')])){return this['channel'][_0x9d81('0xa5')](_0x9d81('0xc5'));}var _0xd29cd6='\x22'+_0x1c8947[_0x9d81('0x5f')]+'\x22';if(this[_0x9d81('0x85')](_0x1c8947[_0x9d81('0xa6')])){_0xd29cd6+=','+_0x1c8947['options'];}var _0x243ed2=this['channel'][_0x9d81('0xa7')]('MRCPSynth',_0xd29cd6);if(_0x243ed2[_0x9d81('0x9f')]===-0x1){return _0x243ed2;}return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0xa9'),_0xd29cd6));};AGIVertices[_0x9d81('0x11')][_0x9d81('0xc6')]=function(_0x4a3e77){logger[_0x9d81('0x32')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x4a3e77[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x4a3e77[_0x9d81('0x5f')])){return this[_0x9d81('0xe')]['noop'](_0x9d81('0xc5'));}var _0x50235a='\x22'+_0x4a3e77[_0x9d81('0x5f')]+'\x22';if(this['isConfigured'](_0x4a3e77[_0x9d81('0xa6')])){_0x50235a+=','+_0x4a3e77[_0x9d81('0xa6')];}var _0xd268bc=this[_0x9d81('0xe')][_0x9d81('0xa7')](_0x9d81('0xa8'),_0x50235a);if(_0xd268bc['result']===-0x1){return _0xd268bc;}return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0xa9'),_0x50235a));};AGIVertices[_0x9d81('0x11')]['lumenvoxasr']=function(_0x5adbe7){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0xc7'),_0x5adbe7['label']));if(!this[_0x9d81('0x85')](_0x5adbe7[_0x9d81('0xac')])){return this[_0x9d81('0xe')]['noop']('no\x20grammar\x20configured');}var _0x505702=_0x5adbe7['grammar'];if(this[_0x9d81('0x85')](_0x5adbe7[_0x9d81('0xa6')])){_0x505702+=','+_0x5adbe7['options'];}var _0x5c14bf=this[_0x9d81('0xe')]['exec'](_0x9d81('0xad'),_0x505702);if(_0x5c14bf[_0x9d81('0x9f')]===-0x1){return _0x5c14bf;}var _0x490ed7=this[_0x9d81('0xaf')](_0x9d81('0xc8'),_0x9d81('0xc9'));if(_0x490ed7[_0x9d81('0x9f')]===-0x1){return _0x490ed7;}var _0x3688da=this[_0x9d81('0xaf')](_0x9d81('0xb0'),_0x9d81('0xca'));if(_0x3688da[_0x9d81('0x9f')]===-0x1){return _0x3688da;}var _0x4aa516=this[_0x9d81('0xaf')](_0x9d81('0xb1'),_0x9d81('0xcb'));if(_0x4aa516[_0x9d81('0x9f')]===-0x1){return _0x4aa516;}return this[_0x9d81('0xe')]['noop'](util[_0x9d81('0x2d')](_0x9d81('0xb3'),_0x505702));};AGIVertices[_0x9d81('0x11')][_0x9d81('0xcc')]=function(_0x409bdb){logger['info'](util[_0x9d81('0x2d')](_0x9d81('0xcd'),_0x409bdb[_0x9d81('0x3b')]));if(!this['isConfigured'](_0x409bdb[_0x9d81('0xac')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0xce'));}var _0x2155d1=_0x409bdb['grammar'];if(this['isConfigured'](_0x409bdb[_0x9d81('0xa6')])){_0x2155d1+=','+_0x409bdb[_0x9d81('0xa6')];}var _0x1dc4a1=this[_0x9d81('0xe')][_0x9d81('0xa7')]('MRCPRecog',_0x2155d1);if(_0x1dc4a1[_0x9d81('0x9f')]===-0x1){return _0x1dc4a1;}var _0x19e401=this[_0x9d81('0xaf')](_0x9d81('0xc8'),_0x9d81('0xcf'));if(_0x19e401[_0x9d81('0x9f')]===-0x1){return _0x19e401;}var _0x5eff40=this['getAndSetVariable'](_0x9d81('0xb0'),_0x9d81('0xd0'));if(_0x5eff40['result']===-0x1){return _0x5eff40;}var _0x4f5919=this[_0x9d81('0xaf')](_0x9d81('0xb1'),_0x9d81('0xd1'));if(_0x4f5919[_0x9d81('0x9f')]===-0x1){return _0x4f5919;}return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0xb3'),_0x2155d1));};AGIVertices[_0x9d81('0x11')][_0x9d81('0xd2')]=function(_0x779f0f){logger['info'](util['format'](_0x9d81('0xd3'),_0x779f0f['label']));if(!this[_0x9d81('0x85')](_0x779f0f['odbc_id'])){return this['channel']['error'](_0x779f0f,'no\x20database\x20selected');}var _0x4c5cef=this[_0x9d81('0xd4')]['sync'](this,_0x779f0f[_0x9d81('0xd5')]);if(!_0x4c5cef){return this[_0x9d81('0xe')]['error'](_0x779f0f,'no\x20odbc\x20database\x20found');}if(!this[_0x9d81('0x85')](_0x779f0f[_0x9d81('0x33')])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x779f0f,_0x9d81('0xd6'));}var _0x420c5c=_0x779f0f['query'][_0x9d81('0xd7')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0xd8'),_0x420c5c));var _0x5bc07a=this['getQueryOdbc'][_0x9d81('0x71')](this,_0x4c5cef,_0x420c5c);this['createSquareDetailsReport'][_0x9d81('0x71')](this,_0x779f0f,_0x420c5c);if(!this[_0x9d81('0x85')](_0x779f0f[_0x9d81('0xd9')])){return this[_0x9d81('0xe')]['noop'](_0x9d81('0xda'));}var _0x954d57=this[_0x9d81('0x12')][_0x9d81('0x71')](this,_0x779f0f['variable_id']);if(!_0x954d57){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x779f0f,_0x9d81('0xdb'));}var _0x26b4d0=this;_0x5bc07a[_0x9d81('0xdc')](function(_0x5bb184,_0x4d86ae){Object[_0x9d81('0xdd')](_0x5bb184)['forEach'](function(_0x5b9991){_0x26b4d0[_0x9d81('0xe')][_0x9d81('0x9c')](util[_0x9d81('0x2d')](_0x9d81('0xde'),_0x954d57,_0x4d86ae,_0x5b9991),_0x5bb184[_0x5b9991]);});});this[_0x9d81('0xe')][_0x9d81('0x9c')](util[_0x9d81('0x2d')]('%s_ROWS_COUNT',_0x954d57),_0x5bc07a[_0x9d81('0x98')]);return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')]('variable\x20%s\x20set',_0x954d57));};AGIVertices[_0x9d81('0x11')]['dial']=function(_0x233727){logger[_0x9d81('0xdf')](util['format'](_0x9d81('0xe0'),_0x233727[_0x9d81('0x3b')]));if(!this['isConfigured'](_0x233727[_0x9d81('0xe1')])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x233727,_0x9d81('0xe2'));}var _0x505bea=this[_0x9d81('0x1c')][_0x9d81('0x71')](this,_0x233727['sip_id']);if(!_0x505bea){return this['channel'][_0x9d81('0x31')](_0x233727,'no\x20user\x20found');}var _0x51eb82=this['channel'][_0x9d81('0xa7')](_0x9d81('0xe3'),[util[_0x9d81('0x2d')](_0x9d81('0xe4'),_0x505bea),_0x233727[_0x9d81('0x69')],_0x233727[_0x9d81('0xe5')],_0x233727[_0x9d81('0x66')]]);if(_0x51eb82[_0x9d81('0x9f')]===-0x1){return _0x51eb82;}return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')]('Executed\x20command\x20%s',_0x9d81('0xe3')));};AGIVertices[_0x9d81('0x11')][_0x9d81('0xe6')]=function(_0x36d8e6){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0xe7'),_0x36d8e6[_0x9d81('0x3b')]));if(!this['isConfigured'](_0x36d8e6[_0x9d81('0x7b')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0xe8'));}if(!this[_0x9d81('0x85')](_0x36d8e6['text'])){return this['channel']['noop'](_0x9d81('0xc5'));}this[_0x9d81('0xe')][_0x9d81('0xe9')]=!![];this[_0x9d81('0x3a')](_0x36d8e6);this[_0x9d81('0x46')](_0x36d8e6[_0x9d81('0x5f')],'in','','');this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')]('Trying\x20Dialogflow:\x20%s',_0x36d8e6[_0x9d81('0x5f')]));var _0x3a599f=this['googleDialogflow'][_0x9d81('0x71')](this,_0x36d8e6);if(_0x3a599f){for(var _0x30f9da in _0x3a599f){if(_0x3a599f[_0x9d81('0x93')](_0x30f9da)){this[_0x9d81('0xe')][_0x9d81('0x9c')](util[_0x9d81('0x2d')]('DIALOGFLOW_%s',_0x30f9da['toUpperCase']()),_0x3a599f[_0x30f9da]);}}this[_0x9d81('0x46')](_0x3a599f[_0x9d81('0xea')],_0x9d81('0xeb'),'dialogflow','');return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')]('Dialogflow\x20Result\x20%s',_0x3a599f[_0x9d81('0xea')]));}return this['channel'][_0x9d81('0x31')](_0x36d8e6,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x9d81('0x11')][_0x9d81('0xec')]=function(_0xe1c7af){logger['info'](util[_0x9d81('0x2d')](_0x9d81('0xed'),_0xe1c7af[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0xe1c7af[_0x9d81('0x7e')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0xee'));}if(!this[_0x9d81('0x85')](_0xe1c7af[_0x9d81('0x7f')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0xef'));}if(!this['isConfigured'](_0xe1c7af[_0x9d81('0x80')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0xf0'));}if(!this['isConfigured'](_0xe1c7af[_0x9d81('0xf1')])){return this['channel']['noop'](_0x9d81('0xf2'));}if(!this['isConfigured'](_0xe1c7af[_0x9d81('0x5f')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0xc5'));}this[_0x9d81('0xe')][_0x9d81('0xe9')]=!![];this[_0x9d81('0x3a')](_0xe1c7af);this['createSquareMessage'](_0xe1c7af[_0x9d81('0x5f')],'in','','');this['channel'][_0x9d81('0xa5')](util['format'](_0x9d81('0xf3'),_0xe1c7af[_0x9d81('0x5f')]));var _0x378d13=this['googleDialogflowV2'][_0x9d81('0x71')](this,_0xe1c7af);if(_0x378d13){for(var _0x85d5be in _0x378d13){if(_0x378d13[_0x9d81('0x93')](_0x85d5be)){if(_0x85d5be!==_0x9d81('0xf4')){this[_0x9d81('0xe')]['setVariable'](util['format']('DIALOGFLOW_%s',_0x85d5be[_0x9d81('0xf5')]()),_0x378d13[_0x85d5be]);}}}this[_0x9d81('0x46')](_0x378d13['speech'],'out','dialogflowV2',_0x378d13[_0x9d81('0xf4')]);return this[_0x9d81('0xe')]['noop'](util['format']('DialogflowV2\x20Result\x20%s',_0x378d13[_0x9d81('0xea')]));}return this['channel']['error'](_0xe1c7af,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0x9d81('0xf6')]=function(_0x1399a4){logger[_0x9d81('0x32')](util['format'](_0x9d81('0xf7'),_0x1399a4['label']));if(!this[_0x9d81('0x85')](_0x1399a4[_0x9d81('0xf8')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0xf9'));}if(!this[_0x9d81('0x85')](_0x1399a4[_0x9d81('0xfa')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0xfb'));}if(!this[_0x9d81('0x85')](_0x1399a4[_0x9d81('0xfc')])){return this['channel'][_0x9d81('0xa5')]('no\x20password\x20configured');}if(!this[_0x9d81('0x85')](_0x1399a4[_0x9d81('0xfd')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0xc5'));}this[_0x9d81('0xe')][_0x9d81('0xe9')]=!![];this[_0x9d81('0x3a')](_0x1399a4);this[_0x9d81('0x46')](_0x1399a4[_0x9d81('0x5f')],'in','','');this['channel'][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0xfe'),_0x1399a4[_0x9d81('0x5f')]));var _0x3855db=this['sestekNDA']['sync'](this,_0x1399a4);if(_0x3855db){for(var _0x3ebae3 in _0x3855db){if(_0x3855db[_0x9d81('0x93')](_0x3ebae3)){this[_0x9d81('0xe')][_0x9d81('0x9c')](util[_0x9d81('0x2d')](_0x9d81('0xff'),_0x3ebae3[_0x9d81('0xf5')]()),_0x3855db[_0x3ebae3]);}}this[_0x9d81('0x46')](_0x3855db[_0x9d81('0xea')],'out','sesteknda','');if(_0x3855db[_0x9d81('0x100')]){this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x3855db['audiofile']));var _0x4f27ed=this[_0x9d81('0xe')][_0x9d81('0x101')](_0x3855db[_0x9d81('0x100')]);try{fs['unlink'](_0x3855db[_0x9d81('0x100')]+_0x9d81('0x102'));}catch(_0x18b91b){logger[_0x9d81('0x31')](_0x18b91b);}return _0x4f27ed;}else{return this[_0x9d81('0xe')]['noop'](util[_0x9d81('0x2d')]('SestekNDA\x20Result\x20%s',_0x3855db[_0x9d81('0xea')]));}}return this['channel']['error'](_0x1399a4,_0x9d81('0x103'));};AGIVertices[_0x9d81('0x11')]['end']=function(_0x103933){logger[_0x9d81('0x32')](util['format'](_0x9d81('0x104'),_0x103933[_0x9d81('0x3b')]));return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0x105'));};AGIVertices[_0x9d81('0x11')]['ext_dial']=function(_0x5883a1){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x106'),_0x5883a1[_0x9d81('0x3b')]));var _0x483e7b='';if(_0x5883a1[_0x9d81('0x107')]){if(!this[_0x9d81('0x85')](_0x5883a1[_0x9d81('0x107')])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x5883a1,'no\x20trunk\x20selected');}else{var _0x4f484f=parseInt(_0x5883a1[_0x9d81('0x107')],0xa);if(isNaN(_0x4f484f)){_0x483e7b=_0x5883a1['trunk_id'];}else{_0x483e7b=this['getTrunk'][_0x9d81('0x71')](this,_0x5883a1['trunk_id']);if(!_0x483e7b){return this['channel']['error'](_0x5883a1,_0x9d81('0x108'));}}}}else if(_0x5883a1[_0x9d81('0x109')]){_0x483e7b=_0x5883a1[_0x9d81('0x109')];}else{return this['channel'][_0x9d81('0x31')](_0x5883a1,_0x9d81('0x10a'));}var _0x35427f=this['channel'][_0x9d81('0xa7')](_0x9d81('0xe3'),[util[_0x9d81('0x2d')](_0x9d81('0x10b'),_0x483e7b,_0x5883a1['phone']),_0x5883a1[_0x9d81('0x69')],_0x5883a1[_0x9d81('0xe5')],_0x5883a1[_0x9d81('0x66')]]);if(_0x35427f[_0x9d81('0x9f')]===-0x1){return _0x35427f;}return this[_0x9d81('0xe')]['noop'](util[_0x9d81('0x2d')](_0x9d81('0x10c'),_0x9d81('0xe3')));};AGIVertices[_0x9d81('0x11')]['finally']=function(_0x2cb393){logger[_0x9d81('0x32')](util['format'](_0x9d81('0x10d'),_0x2cb393[_0x9d81('0x3b')]));return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0x10e'));};AGIVertices[_0x9d81('0x11')][_0x9d81('0xc')]=function(_0x37d6f8){logger['info'](util[_0x9d81('0x2d')](_0x9d81('0x10f'),_0x37d6f8['label']));if(_0x37d6f8['retry']===0x0){return this[_0x9d81('0xa1')](_0x37d6f8);}_0x37d6f8[_0x9d81('0xa2')]-=0x1;if(!this[_0x9d81('0x85')](_0x37d6f8['file_id'])){return this['channel'][_0x9d81('0x31')](_0x37d6f8,_0x9d81('0x110'));}var _0x5b2daa=this[_0x9d81('0x20')][_0x9d81('0x71')](this,_0x37d6f8[_0x9d81('0x111')]);if(!_0x5b2daa){return this[_0x9d81('0xe')]['error'](_0x37d6f8,_0x9d81('0x112'));}if(!this[_0x9d81('0x85')](_0x37d6f8[_0x9d81('0xd9')])){return this['channel'][_0x9d81('0x31')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xea14b2=this[_0x9d81('0xe')][_0x9d81('0x113')](_0x5b2daa,_0x37d6f8['response'],_0x37d6f8[_0x9d81('0x114')]);var _0x2811ff=_0xea14b2[_0x9d81('0x9f')]?_0xea14b2[_0x9d81('0x9f')][_0x9d81('0x50')]():'';logger['info']('test',JSON[_0x9d81('0x74')](_0xea14b2));if(_0xea14b2[_0x9d81('0x9f')]===-0x1){this[_0x9d81('0x3a')]['sync'](this,_0x37d6f8,_0x2811ff);return _0xea14b2;}else if(_0xea14b2[_0x9d81('0x9e')]===_0x9d81('0x69')){_0xea14b2['result']=_0x2811ff[_0x9d81('0x98')]>=parseInt(_0x37d6f8[_0x9d81('0x115')])?'x':'i';}else{_0xea14b2[_0x9d81('0x9f')]=_0x2811ff[_0x9d81('0x98')]>=parseInt(_0x37d6f8['mindigit'])&&_0x2811ff[_0x9d81('0x98')]<=parseInt(_0x37d6f8[_0x9d81('0x114')])?'x':'i';}var _0x176dbc=this['getVariable'][_0x9d81('0x71')](this,_0x37d6f8[_0x9d81('0xd9')]);if(!_0x176dbc){return this[_0x9d81('0xe')]['error'](_0x37d6f8,_0x9d81('0xdb'));}this[_0x9d81('0xe')][_0x9d81('0x9c')](_0x176dbc,_0x2811ff);if(this['isConfigured'](_0x37d6f8[_0x9d81('0x116')])){var _0x5dd750=parseInt(_0x37d6f8[_0x9d81('0x116')],0xa);var _0x1b7b37=rs['generate']({'charset':'*','length':_0x5dd750});var _0x298999=_0x2811ff['length'];if(_0x298999>0x0){if(_0x298999>_0x5dd750){this['createSquareDetailsReport'][_0x9d81('0x71')](this,_0x37d6f8,_0x37d6f8[_0x9d81('0x117')]===_0x9d81('0x118')?_0x1b7b37+_0x2811ff[_0x9d81('0x119')](_0x5dd750):_0x2811ff['substr'](0x0,_0x298999-_0x5dd750)+_0x1b7b37);}else{this[_0x9d81('0x3a')][_0x9d81('0x71')](this,_0x37d6f8,rs[_0x9d81('0x11a')]({'charset':'*','length':_0x298999}));}}else{this[_0x9d81('0x3a')][_0x9d81('0x71')](this,_0x37d6f8,'');}}else{this[_0x9d81('0x3a')]['sync'](this,_0x37d6f8,_0x2811ff);}return _0xea14b2;};AGIVertices[_0x9d81('0x11')][_0x9d81('0xd')]=function(_0x2a8d76){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x11b'),_0x2a8d76[_0x9d81('0x3b')]));return this[_0x9d81('0xc')](_0x2a8d76);};AGIVertices['prototype']['goal']=function(_0x398c7f){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x11c'),_0x398c7f[_0x9d81('0x3b')]));this[_0x9d81('0x3a')][_0x9d81('0x71')](this,_0x398c7f,_0x398c7f[_0x9d81('0x11d')]);return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x11e'),_0x398c7f['goalname']));};AGIVertices[_0x9d81('0x11')][_0x9d81('0x11f')]=function(_0x11069e){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x120'),_0x11069e[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x11069e[_0x9d81('0x121')])||!this[_0x9d81('0x85')](_0x11069e[_0x9d81('0x88')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0x122'));}if(!this[_0x9d81('0x85')](_0x11069e[_0x9d81('0x5f')])){return this[_0x9d81('0xe')]['noop'](_0x9d81('0xc5'));}this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x123'),_0x11069e[_0x9d81('0x5f')]));var _0x3b7b1d=this[_0x9d81('0x87')]['sync'](this,_0x11069e);if(_0x3b7b1d){this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x124'),_0x3b7b1d));var _0x36e57e=this['channel'][_0x9d81('0x101')](_0x3b7b1d);try{fs[_0x9d81('0x125')](_0x3b7b1d+_0x9d81('0x102'));}catch(_0x2fa566){logger['error'](_0x2fa566);}return _0x36e57e;}return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x11069e,_0x9d81('0x126'));};AGIVertices[_0x9d81('0x11')][_0x9d81('0x127')]=function(_0x39a9ac){logger['info'](util[_0x9d81('0x2d')](_0x9d81('0x128'),_0x39a9ac['label']));if(!this['isConfigured'](_0x39a9ac[_0x9d81('0x121')])||!this[_0x9d81('0x85')](_0x39a9ac[_0x9d81('0x88')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x9d81('0x85')](_0x39a9ac[_0x9d81('0x129')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0x12a'));}if(!this[_0x9d81('0x85')](_0x39a9ac[_0x9d81('0x5f')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0xc5'));}this[_0x9d81('0xe')][_0x9d81('0xe9')]=!![];this['createSquareDetailsReport'](_0x39a9ac);this[_0x9d81('0x46')](_0x39a9ac[_0x9d81('0x5f')],'in','','');this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x12b'),_0x39a9ac[_0x9d81('0x5f')]));var _0x40ba36=this['awsLex']['sync'](this,_0x39a9ac);if(_0x40ba36){for(var _0xab3d0e in _0x40ba36){if(_0x40ba36[_0x9d81('0x93')](_0xab3d0e)&&_[_0x9d81('0x99')](_0x40ba36[_0xab3d0e])){this[_0x9d81('0xe')][_0x9d81('0x9c')](util[_0x9d81('0x2d')](_0x9d81('0x12c'),_0xab3d0e['toUpperCase']()),_0x40ba36[_0xab3d0e]);}}if(_[_0x9d81('0x49')](_0x40ba36[_0x9d81('0x78')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0x12d'));}else{this['createSquareMessage'](_0x40ba36['message'],'out',_0x9d81('0x12e'),'');return this['channel'][_0x9d81('0xa5')](util[_0x9d81('0x2d')]('Amazon\x20Lex\x20Result\x20%s',_0x40ba36['message']));}}return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x39a9ac,_0x9d81('0x12f'));};AGIVertices[_0x9d81('0x11')][_0x9d81('0x130')]=function(_0x55fa8f){logger['info'](util[_0x9d81('0x2d')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x55fa8f['label'],_0x55fa8f['timeout']));if(!this[_0x9d81('0x85')](_0x55fa8f[_0x9d81('0x7b')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0xe8'));}var _0x1207a3=_0x9d81('0x131');var _0x2d1efd=util[_0x9d81('0x2d')](_0x9d81('0x132'),FILES_PATH,rs[_0x9d81('0x11a')](0x4));var _0x10cbe1=util[_0x9d81('0x2d')](_0x9d81('0x9b'),_0x2d1efd,_0x1207a3);var _0x2436bb=!![];if(_0x55fa8f[_0x9d81('0x133')]==='NOBEEP'){_0x2436bb=![];}var _0x1be03a=this[_0x9d81('0xe')][_0x9d81('0x134')](_0x2d1efd,_0x1207a3,_0x55fa8f[_0x9d81('0x135')],_0x55fa8f[_0x9d81('0x69')],undefined,_0x2436bb);if(_0x1be03a[_0x9d81('0x9f')]!==-0x1){this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x136'),_0x10cbe1));var _0x3bd3eb=this[_0x9d81('0x8e')][_0x9d81('0x71')](this,_0x55fa8f,_0x10cbe1);if(_0x3bd3eb){for(var _0x501d65 in _0x3bd3eb){if(_0x3bd3eb[_0x9d81('0x93')](_0x501d65)){this[_0x9d81('0xe')][_0x9d81('0x9c')](util[_0x9d81('0x2d')](_0x9d81('0x137'),_0x501d65[_0x9d81('0xf5')]()),_0x3bd3eb[_0x501d65]);}}return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x138'),JSON['stringify'](_0x3bd3eb)));}}return _0x1be03a;};AGIVertices[_0x9d81('0x11')][_0x9d81('0x139')]=function(_0x4c8f1e){logger['info'](util[_0x9d81('0x2d')](_0x9d81('0x13a'),_0x4c8f1e['label']));if(!this['isConfigured'](_0x4c8f1e[_0x9d81('0x13b')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0x13c'));}if(!this['isConfigured'](_0x4c8f1e[_0x9d81('0x91')])){return this['channel']['noop']('no\x20appsecret\x20configured');}var _0x568106=_0x9d81('0x131');var _0x211223=util[_0x9d81('0x2d')]('%s/recordings/%s',FILES_PATH,rs[_0x9d81('0x11a')](0x4));var _0x4dbbc5=util[_0x9d81('0x2d')](_0x9d81('0x9b'),_0x211223,_0x568106);var _0x1e5f53=!![];if(_0x4c8f1e[_0x9d81('0x133')]===_0x9d81('0x13d')){_0x1e5f53=![];}var _0x4c13f5=this[_0x9d81('0xe')][_0x9d81('0x134')](_0x211223,_0x568106,_0x4c8f1e['intKey'],_0x4c8f1e[_0x9d81('0x69')],undefined,_0x1e5f53);if(_0x4c13f5[_0x9d81('0x9f')]!==-0x1){this['channel']['noop'](util['format'](_0x9d81('0x13e'),_0x4dbbc5));var _0x4aec31=this[_0x9d81('0x90')]['sync'](this,_0x4c8f1e,_0x4dbbc5);if(_0x4aec31){for(var _0x3e60d7 in _0x4aec31){if(_0x4aec31[_0x9d81('0x93')](_0x3e60d7)){this[_0x9d81('0xe')]['setVariable'](util[_0x9d81('0x2d')](_0x9d81('0x13f'),_0x3e60d7[_0x9d81('0xf5')]()),_0x4aec31[_0x3e60d7]);}}return this[_0x9d81('0xe')]['noop'](util[_0x9d81('0x2d')]('TildeASR\x20Result\x20%s',JSON[_0x9d81('0x74')](_0x4aec31)));}}return _0x4c13f5;};AGIVertices[_0x9d81('0x11')][_0x9d81('0x140')]=function(_0x35072f){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x35072f[_0x9d81('0x3b')]));return this['channel']['continueAt'](_0x35072f[_0x9d81('0x141')],_0x35072f[_0x9d81('0x42')],_0x35072f[_0x9d81('0x43')]);};AGIVertices[_0x9d81('0x11')][_0x9d81('0x142')]=function(_0x41f581){logger[_0x9d81('0x32')](util['format'](_0x9d81('0x143'),_0x41f581['label']));if(!this[_0x9d81('0x85')](_0x41f581[_0x9d81('0x144')])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x41f581,_0x9d81('0x145'));}try{var _0x34de17=eval(_0x41f581[_0x9d81('0x144')])?'true':_0x9d81('0x146');this['channel'][_0x9d81('0xa5')](util[_0x9d81('0x2d')]('EVAL\x20CONDITION\x20%s\x20%s',_0x41f581['condition'],_0x34de17));return{'code':0xc8,'result':_0x34de17};}catch(_0x1b2e26){return{'code':0xc8,'result':_0x9d81('0x146')};}};AGIVertices[_0x9d81('0x11')]['gotoiftime']=function(_0x415512){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x415512['label']));if(!this[_0x9d81('0x85')](_0x415512[_0x9d81('0x147')])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x415512,_0x9d81('0x148'));}var _0x115515=this[_0x9d81('0x27')]['sync'](this,_0x415512['interval_id']);if(!_0x115515){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x415512,_0x9d81('0x149'));}for(var _0x1da88a=0x0;_0x1da88a<_0x115515['length'];_0x1da88a+=0x1){var _0x463ee9=this[_0x9d81('0xe')][_0x9d81('0x12')](util[_0x9d81('0x2d')](_0x9d81('0x14a'),_0x115515[_0x1da88a]));if(_0x463ee9[_0x9d81('0x9f')]===-0x1){return _0x463ee9;}logger['info'](util[_0x9d81('0x2d')]('IFTIME\x20%s\x20%s',_0x115515[_0x1da88a],_0x463ee9['extra']));if(_0x463ee9[_0x9d81('0x9e')]===_0x9d81('0x14b')){logger[_0x9d81('0x32')](util['format'](_0x9d81('0x14c'),_0x115515[_0x1da88a],_0x9d81('0x14b')));this[_0x9d81('0xe')][_0x9d81('0xa5')](util['format'](_0x9d81('0x14c'),_0x115515[_0x1da88a],'true'));return{'code':0xc8,'result':_0x9d81('0x14b')};}else{logger['info'](util[_0x9d81('0x2d')]('IFTIME\x20%s\x20%s',_0x115515[_0x1da88a],'false'));this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')]('IFTIME\x20%s\x20%s',_0x115515[_0x1da88a],'false'));}}return{'code':0xc8,'result':_0x9d81('0x146')};};AGIVertices[_0x9d81('0x11')][_0x9d81('0x14d')]=function(_0x2d56c3){logger[_0x9d81('0x32')](util['format'](_0x9d81('0x14e'),_0x2d56c3['label']));return this[_0x9d81('0xe')][_0x9d81('0x14d')]();};AGIVertices[_0x9d81('0x11')]['ispeechasr']=function(_0x4fa2c5){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x4fa2c5[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x4fa2c5[_0x9d81('0x7b')])){return this[_0x9d81('0xe')]['noop']('no\x20key\x20configured');}var _0x224d5e=_0x9d81('0x131');var _0x58b425=util[_0x9d81('0x2d')](_0x9d81('0x132'),FILES_PATH,rs[_0x9d81('0x11a')](0x4));var _0x154a45=util[_0x9d81('0x2d')](_0x9d81('0x9b'),_0x58b425,_0x224d5e);var _0x39ba7=!![];if(_0x4fa2c5[_0x9d81('0x133')]==='NOBEEP'){_0x39ba7=![];}var _0x2984ae=this[_0x9d81('0xe')][_0x9d81('0x134')](_0x58b425,_0x224d5e,_0x4fa2c5[_0x9d81('0x135')],_0x4fa2c5[_0x9d81('0x69')],undefined,_0x39ba7);if(_0x2984ae[_0x9d81('0x9f')]!==-0x1){this[_0x9d81('0xe')][_0x9d81('0xa5')](util['format']('ispeech\x20%s\x20file\x20created',_0x154a45));var _0x31f254=this[_0x9d81('0x83')][_0x9d81('0x71')](this,_0x4fa2c5,_0x154a45);if(_0x31f254){for(var _0xcd95ca in _0x31f254){if(_0x31f254[_0x9d81('0x93')](_0xcd95ca)){this[_0x9d81('0xe')][_0x9d81('0x9c')](util[_0x9d81('0x2d')](_0x9d81('0x14f'),_0xcd95ca[_0x9d81('0xf5')]()),_0x31f254[_0xcd95ca]);}}return this[_0x9d81('0xe')]['noop'](util[_0x9d81('0x2d')]('IspeechASR\x20Result\x20%s',JSON[_0x9d81('0x74')](_0x31f254)));}}return _0x2984ae;};AGIVertices['prototype'][_0x9d81('0x150')]=function(_0x4a4405){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x4a4405[_0x9d81('0x3b')]));if(!this['isConfigured'](_0x4a4405['key'])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0xe8'));}if(!this[_0x9d81('0x85')](_0x4a4405['text'])){return this['channel'][_0x9d81('0xa5')](_0x9d81('0xc5'));}this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x151'),_0x4a4405[_0x9d81('0x5f')]));var _0x3c053d=this[_0x9d81('0x82')][_0x9d81('0x71')](this,_0x4a4405);if(_0x3c053d){this[_0x9d81('0xe')]['noop'](util[_0x9d81('0x2d')]('ispeech\x20%s\x20file\x20created',_0x3c053d));var _0x224090=this['channel'][_0x9d81('0x101')](_0x3c053d,_0x4a4405[_0x9d81('0x135')]);try{fs['unlink'](_0x3c053d+'.wav');}catch(_0xb02732){logger[_0x9d81('0x31')](_0xb02732);}return _0x224090;}return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x4a4405,_0x9d81('0x152'));};AGIVertices[_0x9d81('0x11')][_0x9d81('0x153')]=function(_0x9e6cbe){logger['info'](util[_0x9d81('0x2d')](_0x9d81('0x154'),_0x9e6cbe[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x9e6cbe[_0x9d81('0x155')])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x9e6cbe,_0x9d81('0x156'));}logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x157'),this['channel'][_0x9d81('0x3e')],_0x9e6cbe[_0x9d81('0x155')]));var _0x8a0633=this[_0x9d81('0x58')]['sync'](this,_0x9e6cbe['findBy']);if(_0x8a0633){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9d81('0xe')][_0x9d81('0x3e')],_0x9e6cbe[_0x9d81('0x155')]));this[_0x9d81('0xe')]['noop'](util[_0x9d81('0x2d')](_0x9d81('0x158'),this['channel']['callerid'],_0x9e6cbe[_0x9d81('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x159'),this[_0x9d81('0xe')][_0x9d81('0x3e')],_0x9e6cbe[_0x9d81('0x155')]));this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x159'),this[_0x9d81('0xe')][_0x9d81('0x3e')],_0x9e6cbe[_0x9d81('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9d81('0x11')][_0x9d81('0x15a')]=function(_0x25be97){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x25be97[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x25be97[_0x9d81('0x155')])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x25be97,_0x9d81('0x156'));}logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x157'),this[_0x9d81('0xe')][_0x9d81('0x3e')],_0x25be97[_0x9d81('0x155')]));var _0x30b817=this[_0x9d81('0x57')]['sync'](this,_0x25be97[_0x9d81('0x155')]);if(_0x30b817){logger['info'](util[_0x9d81('0x2d')](_0x9d81('0x158'),this[_0x9d81('0xe')]['callerid'],_0x25be97[_0x9d81('0x155')]));this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x158'),this[_0x9d81('0xe')][_0x9d81('0x3e')],_0x25be97[_0x9d81('0x155')]));return{'code':0xc8,'result':_0x9d81('0x15b')};}else{logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x159'),this['channel'][_0x9d81('0x3e')],_0x25be97[_0x9d81('0x155')]));this['channel'][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x159'),this[_0x9d81('0xe')][_0x9d81('0x3e')],_0x25be97[_0x9d81('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9d81('0x11')][_0x9d81('0x15c')]=function(_0x25f5be){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x15d'),_0x25f5be[_0x9d81('0x3b')]));if(!this['isConfigured'](_0x25f5be['operation'])){return this['channel'][_0x9d81('0x31')](_0x25f5be,_0x9d81('0x15e'));}this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x15f'),_0x25f5be[_0x9d81('0x160')]));var _0x4a99d9=eval(_0x25f5be['operation']);if(!this['isConfigured'](_0x25f5be[_0x9d81('0xd9')])){return this['channel'][_0x9d81('0xa5')](_0x9d81('0xda'));}var _0x3190a7=this[_0x9d81('0x12')][_0x9d81('0x71')](this,_0x25f5be[_0x9d81('0xd9')]);if(!_0x3190a7){return this['channel'][_0x9d81('0x31')](_0x25f5be,'no\x20variable\x20found');}if(_[_0x9d81('0x97')](_0x4a99d9)){var _0x4007b7=this;_0x4a99d9[_0x9d81('0xdc')](function(_0x4aa3e9,_0x456f88){_0x4007b7[_0x9d81('0xe')]['setVariable'](util[_0x9d81('0x2d')](_0x9d81('0x161'),_0x3190a7,_0x456f88),_0x4aa3e9);});return this['channel'][_0x9d81('0xa5')](util['format'](_0x9d81('0x162'),_0x3190a7));}else{return this[_0x9d81('0xe')][_0x9d81('0x9c')](_0x3190a7,_0x4a99d9);}};AGIVertices['prototype']['menu']=function(_0x18a6a1){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x163'),_0x18a6a1['label']));if(_0x18a6a1[_0x9d81('0xa2')]===0x0){return this['maxRetry'](_0x18a6a1);}_0x18a6a1[_0x9d81('0xa2')]-=0x1;if(!this[_0x9d81('0x85')](_0x18a6a1[_0x9d81('0x111')])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x18a6a1,_0x9d81('0x110'));}var _0x3220e2=this['getSound'][_0x9d81('0x71')](this,_0x18a6a1[_0x9d81('0x111')]);if(!_0x3220e2){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x18a6a1,_0x9d81('0x112'));}var _0x31bc9b=this['channel'][_0x9d81('0x113')](_0x3220e2,_0x18a6a1[_0x9d81('0x164')],_0x18a6a1[_0x9d81('0x165')]);var _0x5b18a0=_0x31bc9b['result'];if(_0x31bc9b[_0x9d81('0x9f')]===-0x1){this[_0x9d81('0x3a')][_0x9d81('0x71')](this,_0x18a6a1,'-1');return _0x31bc9b;}else if(_0x31bc9b[_0x9d81('0x9e')]===_0x9d81('0x69')){_0x31bc9b[_0x9d81('0x9f')]=_0x31bc9b[_0x9d81('0x9f')]['length']>0x0?_0x31bc9b[_0x9d81('0x9f')]:'t';}else if(_[_0x9d81('0x48')](_0x31bc9b[_0x9d81('0x9f')])){_0x31bc9b[_0x9d81('0x9f')]='#';_0x5b18a0='#';}if(!this[_0x9d81('0x85')](_0x18a6a1['variable_id'])){this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0xda'));}else{var _0x2f79d7=this[_0x9d81('0x12')][_0x9d81('0x71')](this,_0x18a6a1['variable_id']);if(!_0x2f79d7){return this[_0x9d81('0xe')]['error'](_0x18a6a1,_0x9d81('0xdb'));}this[_0x9d81('0xe')][_0x9d81('0x9c')](_0x2f79d7,_0x5b18a0);}this[_0x9d81('0x3a')][_0x9d81('0x71')](this,_0x18a6a1,_0x5b18a0);return _0x31bc9b;};AGIVertices['prototype']['noop']=function(_0x44a420){logger[_0x9d81('0x32')](util['format'](_0x9d81('0x166'),_0x44a420[_0x9d81('0x3b')]));return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x44a420[_0x9d81('0x167')]||_0x44a420[_0x9d81('0x3b')]);};AGIVertices[_0x9d81('0x11')][_0x9d81('0x168')]=function(_0x3b529c){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x169'),_0x3b529c[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x3b529c[_0x9d81('0x155')])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x3b529c,_0x9d81('0x156'));}logger[_0x9d81('0x32')](util['format'](_0x9d81('0x157'),this[_0x9d81('0xe')]['callerid'],_0x3b529c[_0x9d81('0x155')]));var _0x2db006=this[_0x9d81('0x52')][_0x9d81('0x71')](this,_0x3b529c[_0x9d81('0x16a')]);var _0xc837e7=this[_0x9d81('0x55')][_0x9d81('0x71')](this,_0x3b529c['findBy'],_0x2db006);if(_0xc837e7){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x158'),this[_0x9d81('0xe')]['callerid'],_0x3b529c[_0x9d81('0x155')]));this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x158'),this['channel']['callerid'],_0x3b529c['findBy']));return{'code':0xc8,'result':_0x9d81('0x15b')};}else{logger['info'](util['format'](_0x9d81('0x159'),this['channel']['callerid'],_0x3b529c[_0x9d81('0x155')]));this['channel'][_0x9d81('0xa5')](util[_0x9d81('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9d81('0xe')]['callerid'],_0x3b529c[_0x9d81('0x155')]));return{'code':0xc8,'result':_0x9d81('0x16b')};}};AGIVertices[_0x9d81('0x11')][_0x9d81('0x16c')]=function(_0x541fe7){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x541fe7[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x541fe7[_0x9d81('0x111')])){return this['channel'][_0x9d81('0x31')](_0x541fe7,'no\x20file\x20audio\x20selected');}var _0x3ccf6d=this[_0x9d81('0x20')][_0x9d81('0x71')](this,_0x541fe7[_0x9d81('0x111')]);if(!_0x3ccf6d){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x541fe7,_0x9d81('0x112'));}var _0x3e6ab3=this[_0x9d81('0xe')][_0x9d81('0xa7')](_0x9d81('0x16d'),[_0x3ccf6d,_0x541fe7['opts']]);if(_0x3e6ab3[_0x9d81('0x9f')]===-0x1){return _0x3e6ab3;}return this['channel'][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x16e'),_0x9d81('0x16d'),_0x3ccf6d));};AGIVertices['prototype']['queue']=function(_0x5c4b24){logger['info'](util[_0x9d81('0x2d')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x5c4b24[_0x9d81('0x3b')]));if(!this['isConfigured'](_0x5c4b24[_0x9d81('0x16f')])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x5c4b24,_0x9d81('0x170'));}var _0x33523b='';var _0x4be9e2=parseInt(_0x5c4b24[_0x9d81('0x16f')],0xa);if(isNaN(_0x4be9e2)){_0x33523b=_0x5c4b24[_0x9d81('0x16f')];}else{_0x33523b=this[_0x9d81('0x16')][_0x9d81('0x71')](this,_0x5c4b24[_0x9d81('0x16f')]);if(!_0x33523b){return this['channel'][_0x9d81('0x31')](_0x5c4b24,'no\x20queue\x20found');}}var _0x3ae4b9='';if(this['isConfigured'](_0x5c4b24[_0x9d81('0x111')])){var _0x5427a7=this[_0x9d81('0x20')][_0x9d81('0x71')](this,_0x5c4b24[_0x9d81('0x111')]);if(_0x5427a7){_0x3ae4b9=_0x5427a7;}}this[_0x9d81('0x3a')][_0x9d81('0x71')](this,_0x5c4b24,_0x33523b);if(_0x5c4b24[_0x9d81('0xe5')][_0x9d81('0x171')]('x')<0x0){_0x5c4b24['opts']+='x';}if(_0x5c4b24['opts'][_0x9d81('0x171')]('X')<0x0){_0x5c4b24['opts']+='X';}this['channel'][_0x9d81('0x9c')](_0x9d81('0x172'),_0x33523b?_0x33523b['toLowerCase']():'');var _0x387563=this[_0x9d81('0xe')]['exec'](_0x9d81('0x173'),[_0x33523b,_0x5c4b24[_0x9d81('0xe5')],_0x5c4b24[_0x9d81('0x66')],_0x3ae4b9,_0x5c4b24[_0x9d81('0x69')],_0x5c4b24[_0x9d81('0x6')],_0x5c4b24[_0x9d81('0x174')],_0x5c4b24[_0x9d81('0x175')],'',_0x5c4b24[_0x9d81('0x176')]]);if(_0x387563['result']===-0x1){return _0x387563;}return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x16e'),_0x9d81('0x173'),_0x33523b));};AGIVertices[_0x9d81('0x11')][_0x9d81('0x177')]=function(_0x46b92d){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x178'),_0x46b92d[_0x9d81('0x3b')]));var _0x30ca0b=_0x46b92d[_0x9d81('0x179')]||_0x9d81('0x131');var _0x1ac294=util[_0x9d81('0x2d')](_0x9d81('0x17a'),this[_0x9d81('0xe')]['uniqueid'],rs[_0x9d81('0x11a')](0x5));var _0x271311=util[_0x9d81('0x2d')](_0x9d81('0x17b'),FILES_PATH,_0x1ac294,_0x30ca0b);var _0x2780b1=util[_0x9d81('0x2d')](_0x9d81('0x132'),FILES_PATH,_0x1ac294);this[_0x9d81('0x3f')][_0x9d81('0x71')](this,_0x46b92d,_0x1ac294,_0x271311);this[_0x9d81('0xe')][_0x9d81('0x9c')](_0x9d81('0x17c'),_0x1ac294);logger['info'](_0x9d81('0x17d'),_0x2780b1,_0x30ca0b,_0x46b92d[_0x9d81('0x17e')],_0x46b92d[_0x9d81('0x69')]);return this[_0x9d81('0xe')][_0x9d81('0x134')](_0x2780b1,_0x30ca0b,_0x46b92d[_0x9d81('0x17e')],_0x46b92d[_0x9d81('0x69')],undefined,!![]);};AGIVertices['prototype'][_0x9d81('0x17f')]=function(_0x315bc2){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x180'),_0x315bc2[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x315bc2[_0x9d81('0x66')])){return this['channel'][_0x9d81('0xa5')](_0x9d81('0x181'));}var _0x1d5e49=this[_0x9d81('0x65')][_0x9d81('0x71')](this,_0x315bc2);logger['info'](util['format'](_0x9d81('0x182'),util[_0x9d81('0x183')](_0x1d5e49,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x315bc2[_0x9d81('0xd9')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0x184'));}var _0xa69a45=this[_0x9d81('0x12')][_0x9d81('0x71')](this,_0x315bc2[_0x9d81('0xd9')]);if(!_0xa69a45){return this['channel'][_0x9d81('0x31')](_0x315bc2,_0x9d81('0xdb'));}this[_0x9d81('0xe')][_0x9d81('0x9c')](util['format'](_0x9d81('0x185'),_0xa69a45),_0x1d5e49[_0x9d81('0x76')]?_0x1d5e49[_0x9d81('0x76')]:_0x9d81('0x186'));this[_0x9d81('0xe')]['setVariable'](util['format'](_0x9d81('0x187'),_0xa69a45),_0x1d5e49['statusMessage']?_0x1d5e49[_0x9d81('0x77')]:'OK');if(_0x1d5e49['body']){try{this[_0x9d81('0x9a')](_0x1d5e49[_0x9d81('0x6c')],_0xa69a45);}catch(_0x1c0276){logger['error'](util[_0x9d81('0x2d')](_0x9d81('0x188'),_0xa69a45));}}return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x189'),_0xa69a45));};AGIVertices[_0x9d81('0x11')]['saydigits']=function(_0xd003c3){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x18a'),_0xd003c3[_0x9d81('0x3b')]));return this[_0x9d81('0xe')][_0x9d81('0x18b')](_0xd003c3[_0x9d81('0x18c')][_0x9d81('0xd7')](/\s+/g,''),_0xd003c3[_0x9d81('0x17e')]);};AGIVertices[_0x9d81('0x11')][_0x9d81('0x18d')]=function(_0x571266){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x18e'),_0x571266[_0x9d81('0x3b')]));return this[_0x9d81('0xe')][_0x9d81('0x18f')](_0x571266['number']['replace'](/\s+/g,''),_0x571266[_0x9d81('0x17e')]);};AGIVertices[_0x9d81('0x11')]['sayphonetic']=function(_0x53e3c8){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x53e3c8[_0x9d81('0x3b')]));return this['channel'][_0x9d81('0x190')](_0x53e3c8[_0x9d81('0x5f')],_0x53e3c8[_0x9d81('0x17e')]);};AGIVertices['prototype'][_0x9d81('0x191')]=function(_0x5a4cc2){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x192'),_0x5a4cc2[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x5a4cc2['account_id'])){return this[_0x9d81('0xe')]['noop'](_0x9d81('0x193'));}var _0x5eb10a=this[_0x9d81('0x24')][_0x9d81('0x71')](this,_0x5a4cc2[_0x9d81('0x194')]);if(!_0x5eb10a||!_0x5eb10a[_0x9d81('0x195')]){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x5a4cc2,'no\x20mail\x20account\x20found');}var _0x56dac1={'from':util[_0x9d81('0x2d')]('\x22%s\x22\x20<%s>',_0x5eb10a[_0x9d81('0x14')],_0x5eb10a[_0x9d81('0x196')]||_0x5eb10a[_0x9d81('0x195')][_0x9d81('0x197')]),'to':_0x5a4cc2['to']||'','cc':_0x5a4cc2['cc']||'','bcc':_0x5a4cc2[_0x9d81('0x198')]||'','subject':_0x5a4cc2[_0x9d81('0x199')],'html':_0x5a4cc2['text'],'text':_0x5a4cc2[_0x9d81('0x5f')]};var _0x2f6fea={'tls':{'rejectUnauthorized':![]}};if(_0x5eb10a[_0x9d81('0x195')][_0x9d81('0x19a')]){_0x2f6fea['service']=_0x5eb10a[_0x9d81('0x195')][_0x9d81('0x19a')];}else{_0x2f6fea['host']=_0x5eb10a[_0x9d81('0x195')][_0x9d81('0x19b')];_0x2f6fea[_0x9d81('0x19c')]=_0x5eb10a[_0x9d81('0x195')][_0x9d81('0x19c')];_0x2f6fea[_0x9d81('0x19d')]=_0x5eb10a[_0x9d81('0x195')]['secure'];}if(_0x5eb10a[_0x9d81('0x195')][_0x9d81('0x19e')]){_0x2f6fea[_0x9d81('0x19f')]={'user':_0x5eb10a[_0x9d81('0x195')][_0x9d81('0x197')],'pass':_0x5eb10a[_0x9d81('0x195')]['pass']};}if(this['isConfigured'](_0x5a4cc2[_0x9d81('0x1a0')])){}logger[_0x9d81('0xdf')](_0x9d81('0x1a1'),JSON[_0x9d81('0x74')](_0x56dac1));this[_0x9d81('0x3a')][_0x9d81('0x71')](this,_0x5a4cc2,_0x5a4cc2['account_id']);this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x1a2'),_0x5eb10a[_0x9d81('0x14')]));this['sendMailMessage'][_0x9d81('0x71')](this,_0x2f6fea,_0x56dac1);return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0x1a3'));};AGIVertices[_0x9d81('0x11')][_0x9d81('0x1a4')]=function(_0xdc11a1){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x1a5'),_0xdc11a1['label']));return this['channel'][_0x9d81('0xa5')](_0x9d81('0x1a6'));};AGIVertices[_0x9d81('0x11')][_0x9d81('0x1a7')]=function(_0x43d547){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x1a8'),_0x43d547[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x43d547[_0x9d81('0x1a9')])){return this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0x1aa'));}var _0x34aadb=this[_0x9d81('0x38')][_0x9d81('0x71')](this,_0x43d547[_0x9d81('0x1a9')]);if(!_0x34aadb){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x43d547,_0x9d81('0x1ab'));}var _0xa891e0={'body':_0x43d547[_0x9d81('0x1ac')],'phone':_0x43d547['to']||'','SmsAccountId':_0x34aadb['id']};logger[_0x9d81('0xdf')](_0x9d81('0x1ad'),JSON[_0x9d81('0x74')](_0xa891e0));this[_0x9d81('0x3a')][_0x9d81('0x71')](this,_0x43d547,_0x43d547[_0x9d81('0x1a9')]);this['channel']['noop'](util[_0x9d81('0x2d')](_0x9d81('0x1ae'),_0x34aadb[_0x9d81('0x14')]));this[_0x9d81('0x39')][_0x9d81('0x71')](this,_0xa891e0);return this[_0x9d81('0xe')][_0x9d81('0xa5')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x9d81('0x11')]['set']=function(_0x5a418f){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x5a418f[_0x9d81('0x3b')]));if(!this['isConfigured'](_0x5a418f['variable_id'])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x5a418f,_0x9d81('0x1af'));}var _0x1901cd=this['getVariable'][_0x9d81('0x71')](this,_0x5a418f[_0x9d81('0xd9')]);if(!_0x1901cd){return this['channel'][_0x9d81('0x31')](_0x5a418f,'no\x20variable\x20found');}return this['channel'][_0x9d81('0x9c')](_0x1901cd,_0x5a418f[_0x9d81('0x1b0')]);};AGIVertices[_0x9d81('0x11')][_0x9d81('0x1b1')]=function(_0x4aa48a){logger[_0x9d81('0x32')](util['format'](_0x9d81('0x1b2'),_0x4aa48a['label']));this[_0x9d81('0xe')]['noop'](_0x9d81('0x1b3'));if(_0x4aa48a[_0x9d81('0xb6')]===_0x9d81('0x1b4')){this[_0x9d81('0xe')][_0x9d81('0xa5')](_0x9d81('0x1b5'));return this[_0x9d81('0xe')]['answer']();}return this[_0x9d81('0xe')][_0x9d81('0xa5')]('Skipped\x20Answer');};AGIVertices[_0x9d81('0x11')][_0x9d81('0x1b6')]=function(_0x1bd5b9){logger['info'](util[_0x9d81('0x2d')](_0x9d81('0x1b7'),_0x1bd5b9[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x1bd5b9[_0x9d81('0x1b8')])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x1bd5b9,_0x9d81('0x1b9'));}var _0x26894f=this[_0x9d81('0x19')][_0x9d81('0x71')](this,_0x1bd5b9[_0x9d81('0x1b8')]);if(!this[_0x9d81('0x85')](_0x26894f)){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x1bd5b9,util[_0x9d81('0x2d')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x1bd5b9[_0x9d81('0x1b8')]));}if(_0x26894f===this[_0x9d81('0xe')][_0x9d81('0x3d')]){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x1bd5b9,_0x9d81('0x1ba'));}this[_0x9d81('0x3a')][_0x9d81('0x71')](this,_0x1bd5b9,_0x26894f);var _0x1a451f=this[_0x9d81('0xe')][_0x9d81('0xa7')](_0x9d81('0x1bb'),util[_0x9d81('0x2d')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x9d81('0x6')][_0x9d81('0x19b')]||_0x9d81('0x1bc'),_0x26894f,this['channel'][_0x9d81('0x3d')]));if(_0x1a451f[_0x9d81('0x9f')]===-0x1){return _0x1a451f;}return this[_0x9d81('0xe')]['noop'](util['format'](_0x9d81('0x16e'),'AGI',_0x26894f));};AGIVertices[_0x9d81('0x11')]['system']=function(_0x564a10){logger['info'](util[_0x9d81('0x2d')](_0x9d81('0x1bd'),_0x564a10['label']));var _0x3d70b2=this[_0x9d81('0x5b')]['sync'](this,_0x564a10[_0x9d81('0xb4')]);this[_0x9d81('0x3a')][_0x9d81('0x71')](this,_0x564a10,_0x564a10[_0x9d81('0xb4')]);if(this['isConfigured'](_0x564a10[_0x9d81('0xd9')])){var _0x3347f4=this[_0x9d81('0x12')][_0x9d81('0x71')](this,_0x564a10[_0x9d81('0xd9')]);if(_0x3347f4){this[_0x9d81('0xe')][_0x9d81('0x9c')](_0x3347f4,_0x3d70b2);return this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x1be'),_0x564a10[_0x9d81('0xb4')],_0x3347f4));}}return this[_0x9d81('0xe')][_0x9d81('0xa5')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x564a10['command']));};AGIVertices[_0x9d81('0x11')][_0x9d81('0x1bf')]=function(_0xae3219){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0xae3219[_0x9d81('0x3b')]));_0xae3219[_0x9d81('0x5f')]=_0xae3219[_0x9d81('0x5f')][_0x9d81('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xae3219[_0x9d81('0x5e')])){return this['channel']['noop'](_0x9d81('0x1c0'));}if(!this['isConfigured'](_0xae3219[_0x9d81('0x5f')])){return this['channel'][_0x9d81('0xa5')](_0x9d81('0xc5'));}this[_0x9d81('0xe')][_0x9d81('0xa5')](util['format'](_0x9d81('0x1c1'),_0xae3219[_0x9d81('0x5f')]));var _0xcda2b7=this['googleCloudTTS'][_0x9d81('0x71')](this,_0xae3219);if(_0xcda2b7){this['channel'][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x1c2'),_0xcda2b7));var _0x7a0a81=this[_0x9d81('0xe')][_0x9d81('0x101')](_0xcda2b7);try{fs['unlink'](_0xcda2b7+_0x9d81('0x102'));}catch(_0xaea3f){logger[_0x9d81('0x31')](_0xaea3f);}return _0x7a0a81;}return this[_0x9d81('0xe')][_0x9d81('0x31')](_0xae3219,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x9d81('0x1c3')]=function(_0x8a1897){logger['info'](util[_0x9d81('0x2d')](_0x9d81('0x1c4'),_0x8a1897[_0x9d81('0x3b')]));_0x8a1897[_0x9d81('0x5f')]=_0x8a1897['text'][_0x9d81('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9d81('0x85')](_0x8a1897[_0x9d81('0x5f')])){return this['channel'][_0x9d81('0xa5')]('no\x20text\x20configured');}this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x1c5'),_0x8a1897[_0x9d81('0x5f')]));var _0x38e956=this[_0x9d81('0x63')][_0x9d81('0x71')](this,_0x8a1897);if(_0x38e956){this['channel'][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x1c6'),_0x38e956));var _0x4e49ea=this[_0x9d81('0xe')]['streamFile'](_0x38e956);try{fs[_0x9d81('0x125')](_0x38e956+_0x9d81('0x102'));}catch(_0xc7cae3){logger[_0x9d81('0x31')](_0xc7cae3);}return _0x4e49ea;}return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x8a1897,_0x9d81('0x1c7'));};AGIVertices[_0x9d81('0x11')][_0x9d81('0x1c8')]=function(_0x169e8f){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x169e8f[_0x9d81('0x3b')]));if(!this['isConfigured'](_0x169e8f[_0x9d81('0x155')])){return this['channel'][_0x9d81('0x31')](_0x169e8f,_0x9d81('0x156'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9d81('0xe')][_0x9d81('0x3e')],_0x169e8f['findBy']));var _0x42c9ff=this[_0x9d81('0x56')][_0x9d81('0x71')](this,_0x169e8f['findBy']);if(_0x42c9ff){logger[_0x9d81('0x32')](util['format'](_0x9d81('0x158'),this[_0x9d81('0xe')]['callerid'],_0x169e8f[_0x9d81('0x155')]));this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9d81('0xe')][_0x9d81('0x3e')],_0x169e8f['findBy']));return{'code':0xc8,'result':_0x9d81('0x15b')};}else{logger[_0x9d81('0x32')](util[_0x9d81('0x2d')](_0x9d81('0x159'),this[_0x9d81('0xe')][_0x9d81('0x3e')],_0x169e8f[_0x9d81('0x155')]));this[_0x9d81('0xe')][_0x9d81('0xa5')](util[_0x9d81('0x2d')](_0x9d81('0x159'),this[_0x9d81('0xe')]['callerid'],_0x169e8f[_0x9d81('0x155')]));return{'code':0xc8,'result':_0x9d81('0x16b')};}};AGIVertices[_0x9d81('0x11')][_0x9d81('0x1c9')]=function(_0x54656b){logger[_0x9d81('0x32')](util[_0x9d81('0x2d')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x54656b[_0x9d81('0x3b')]));var _0xeb6391=this[_0x9d81('0xe')][_0x9d81('0xa7')](_0x9d81('0x1ca'),[_0x54656b[_0x9d81('0x1cb')],_0x54656b['options']]);if(_0xeb6391[_0x9d81('0x9f')]===-0x1){return _0xeb6391;}return this['channel'][_0x9d81('0xa5')](util[_0x9d81('0x2d')]('Executed\x20command\x20%s\x20%s',_0x9d81('0x1ca'),_0x54656b['mailbox']));};AGIVertices['prototype'][_0x9d81('0x1cc')]=function(_0x20f083){logger[_0x9d81('0x32')](util['format'](_0x9d81('0x1cd'),_0x20f083[_0x9d81('0x3b')]));if(!this[_0x9d81('0x85')](_0x20f083[_0x9d81('0xd9')])){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x20f083,'no\x20variable\x20selected');}var _0x5ae90e=this[_0x9d81('0x12')][_0x9d81('0x71')](this,_0x20f083['variable_id']);if(!_0x5ae90e){return this[_0x9d81('0xe')][_0x9d81('0x31')](_0x20f083,'no\x20variable\x20found');}var _0x529a34=this[_0x9d81('0xe')][_0x9d81('0x12')](_0x5ae90e);return{'code':0xc8,'result':_0x529a34[_0x9d81('0x9e')]?_0x529a34[_0x9d81('0x9e')]:'-'};};String[_0x9d81('0x11')]['replaceAll']=function(_0x42b431,_0x4fbeec){return this[_0x9d81('0x1ce')](_0x42b431)[_0x9d81('0x1cf')](_0x4fbeec);};module[_0x9d81('0x1d0')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index a82fb18..d95e960 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 _0x9957=['then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent'];(function(_0x33adc1,_0x1e7990){var _0x385eb6=function(_0x19b64a){while(--_0x19b64a){_0x33adc1['push'](_0x33adc1['shift']());}};_0x385eb6(++_0x1e7990);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var ami=require(_0x7995('0x3'));var logger=require('../../../config/logger')(_0x7995('0x4'));var RpcUser=require(_0x7995('0x5'));var RpcVoiceAgentReport=require(_0x7995('0x6'));function Acw(_0x462a03){this['voiceQueues']=_0x462a03[_0x7995('0x7')];this[_0x7995('0x8')]=_0x462a03[_0x7995('0x8')];this[_0x7995('0x9')]=_0x462a03[_0x7995('0x9')];this[_0x7995('0xa')]={};ami['on']('agentconnect',this[_0x7995('0xb')][_0x7995('0xc')](this));ami['on']('hanguprequest',this[_0x7995('0xd')][_0x7995('0xc')](this));ami['on'](_0x7995('0xe'),this[_0x7995('0xf')][_0x7995('0xc')](this));ami['on'](_0x7995('0x10'),this[_0x7995('0x11')]['bind'](this));ami['on'](_0x7995('0x12'),this[_0x7995('0x13')]['bind'](this));ami['on'](_0x7995('0x14'),this[_0x7995('0x15')][_0x7995('0xc')](this));ami['on'](_0x7995('0x16'),this[_0x7995('0x17')][_0x7995('0xc')](this));}function getDiff(_0x2bbe7a){var _0x4cc004=moment()['milliseconds'](0x0);var _0x2b4e94=moment(_0x2bbe7a)[_0x7995('0x18')](0x0);return _0x4cc004[_0x7995('0x19')](_0x2b4e94,_0x7995('0x1a'));}Acw[_0x7995('0x1b')][_0x7995('0x1c')]=function(_0x2202ce){try{var _0x41cbf0=this;var _0x5377e5=this[_0x7995('0xa')][_0x2202ce]['interface'];var _0x2f832e=this[_0x7995('0xa')][_0x2202ce][_0x7995('0x1d')];var _0x291317=this[_0x7995('0x7')][_0x2f832e];var _0x37a7d4=![];var _0x4faa60='ACW';if(_0x291317[_0x7995('0x1e')]){if(_0x291317['mandatoryDispositionPause']['name']){_0x37a7d4=!![];_0x4faa60=_0x291317[_0x7995('0x1f')][_0x7995('0x20')];}}ami['Action']({'action':_0x7995('0x21'),'interface':_0x5377e5,'paused':!![],'reason':_0x4faa60})['then'](function(_0x4b1a8e){if(_0x41cbf0[_0x7995('0x8')][_0x5377e5]){return RpcUser[_0x7995('0x22')](_0x41cbf0[_0x7995('0x8')][_0x5377e5]['id'])[_0x7995('0x23')](function(_0x460924){if(_0x460924&&!_0x460924[_0x7995('0x24')]){logger['info'](_0x7995('0x25'),_0x2202ce,_0x5377e5,_0x2f832e);var _0x46ee4b=_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x26')]&&_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]?_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]:_0x2202ce;return RpcUser['savePause'](_0x41cbf0[_0x7995('0x8')][_0x5377e5],_0x4faa60,_0x46ee4b)[_0x7995('0x23')](function(_0x401dc3){if(!_0x37a7d4){_0x41cbf0[_0x7995('0x9')][_0x5377e5]={};logger[_0x7995('0x28')](_0x7995('0x29'),_0x2202ce,_0x41cbf0['voiceQueues'][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2b')]=setTimeout(_0x41cbf0[_0x7995('0x2c')][_0x7995('0xc')](_0x41cbf0,_0x5377e5),_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')]*0x3e8);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2d')]=moment()['format'](_0x7995('0x2e'));_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2f')]=_0x2202ce;_0x41cbf0['timers'][_0x5377e5]['queue']=_0x2f832e;_0x41cbf0['timers'][_0x5377e5][_0x7995('0x30')]=function(){var _0xe6b0b3=getDiff(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2d')]);clearTimeout(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2b')]);_0x41cbf0['timers'][_0x5377e5]['timer']=![];RpcVoiceAgentReport[_0x7995('0x31')]({'acwtime':_0xe6b0b3},_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2f')],_0x5377e5)[_0x7995('0x23')](function(_0x29fac5){logger[_0x7995('0x28')](_0x7995('0x32'),_0x2202ce,_0xe6b0b3,_0x29fac5);})['catch'](function(_0x44309d){logger[_0x7995('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x2202ce,_0x44309d);});delete _0x41cbf0['timers'][_0x5377e5];};}});}else{logger['info'](_0x7995('0x34'),_0x2202ce,_0x5377e5,_0x2f832e);}});}})[_0x7995('0x35')](function(_0x4a176f){logger[_0x7995('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2202ce,_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);})[_0x7995('0x36')](function(){delete _0x41cbf0['channels'][_0x2202ce];});}catch(_0x52d76d){logger[_0x7995('0x33')]('[ACW][START]\x20%s',_0x52d76d['message']);}};Acw[_0x7995('0x1b')][_0x7995('0x2c')]=function(_0x5212ff){try{var _0x1baa15=this;if(_0x1baa15[_0x7995('0x9')][_0x5212ff]){_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x2b')]=![];var _0x1e3dbf=_0x1baa15['timers'][_0x5212ff][_0x7995('0x2f')];var _0x242713=_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x1d')];var _0x4b1541=_0x1baa15[_0x7995('0x7')][_0x242713][_0x7995('0x2a')];logger[_0x7995('0x28')](_0x7995('0x37'),_0x1e3dbf,_0x5212ff);RpcUser[_0x7995('0x38')](this[_0x7995('0x8')][_0x5212ff]);RpcVoiceAgentReport['update']({'acwtime':_0x4b1541,'agentacw':!![]},_0x1e3dbf,_0x5212ff)[_0x7995('0x23')](function(_0x3be298){logger[_0x7995('0x28')](_0x7995('0x32'),_0x1e3dbf,_0x4b1541,_0x3be298);})[_0x7995('0x35')](function(_0x298fc2){logger[_0x7995('0x33')](_0x7995('0x39'),_0x1e3dbf,_0x298fc2);});}else{logger[_0x7995('0x33')](_0x7995('0x3a'),_0x5212ff);if(_0x1baa15[_0x7995('0x9')]){logger[_0x7995('0x28')](_0x7995('0x3b'),JSON['stringify'](_0x1baa15['timers']));}}}catch(_0x334dff){logger[_0x7995('0x33')]('[ACW][STOP]\x20%s',_0x334dff['message']);}};Acw[_0x7995('0x1b')]['syncAgentConnect']=function(_0x504a33){try{if(this[_0x7995('0x7')][_0x504a33[_0x7995('0x1d')]]&&(this[_0x7995('0x7')][_0x504a33['queue']][_0x7995('0x4')]||this['voiceQueues'][_0x504a33[_0x7995('0x1d')]]['mandatoryDisposition'])){if(this['agents'][_0x504a33[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x504a33[_0x7995('0x2f')]]={'queue':_0x504a33[_0x7995('0x1d')],'interface':_0x504a33['interface'],'destlinkedid':_0x504a33[_0x7995('0x27')]};}}}catch(_0x40fc68){logger[_0x7995('0x33')](_0x7995('0x3d'),_0x40fc68['message']);}};Acw['prototype'][_0x7995('0x17')]=function(_0x55791b){try{if(this[_0x7995('0x7')][_0x55791b['queue']]&&(this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x4')]||this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x1e')])){if(this[_0x7995('0x8')][_0x55791b[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x55791b['uniqueid']]={'queue':_0x55791b[_0x7995('0x1d')],'interface':_0x55791b[_0x7995('0x3c')]};}}}catch(_0x237270){logger['error'](_0x7995('0x3e'),_0x237270[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0xd')]=function(_0x255313){try{if(this['channels'][_0x255313[_0x7995('0x2f')]]&&_[_0x7995('0x40')](this['channels'][_0x255313[_0x7995('0x2f')]]['attended'])){logger[_0x7995('0x28')](_0x7995('0x41'),_0x255313[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x255313[_0x7995('0x2f')]);}else if(this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]]&&_['isUndefined'](this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]][_0x7995('0x26')])){logger['info'](_0x7995('0x43'),_0x255313[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x255313['linkedid']);}}catch(_0x4ec548){logger['error'](_0x7995('0x44'),_0x4ec548[_0x7995('0x3f')]);}};Acw['prototype'][_0x7995('0xf')]=function(_0x29f300){try{if(this[_0x7995('0xa')][_0x29f300[_0x7995('0x2f')]]&&this[_0x7995('0xa')][_0x29f300['uniqueid']][_0x7995('0x26')]){logger['info'](_0x7995('0x45'),_0x29f300[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x29f300['uniqueid']);}else if(this['channels'][_0x29f300['linkedid']]&&this['channels'][_0x29f300[_0x7995('0x42')]][_0x7995('0x26')]){logger[_0x7995('0x28')](_0x7995('0x46'),_0x29f300[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x29f300[_0x7995('0x42')]);}}catch(_0xda6ce8){logger[_0x7995('0x33')](_0x7995('0x47'),_0xda6ce8[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x13')]=function(_0x35bea3){try{if(!_[_0x7995('0x48')](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x49')]);if(this['channels'][_0x35bea3[_0x7995('0x4a')]]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]][_0x7995('0x26')]=!![];this['channels'][_0x35bea3['transfertargetuniqueid']]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];}}else if(!_['isNil'](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4b')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x4b')]);if(this['channels'][_0x35bea3['origtransfereruniqueid']]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]][_0x7995('0x26')]=!![];this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];}}}catch(_0x50caf5){logger[_0x7995('0x33')](_0x7995('0x4d'),_0x50caf5[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')]['syncBlindTransfer']=function(_0x51bf6a){try{if(this[_0x7995('0xa')][_0x51bf6a[_0x7995('0x4e')]]){logger['info'](_0x7995('0x4f'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x4e')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x4e')]);}else if(this['channels'][_0x51bf6a[_0x7995('0x51')]]){logger['info'](_0x7995('0x52'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x51')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x51')]);}}catch(_0xeb8920){logger[_0x7995('0x33')](_0x7995('0x53'),_0xeb8920[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x11')]=function(_0x234d8d){try{if(this['voiceQueues'][_0x234d8d[_0x7995('0x1d')]]&&this[_0x7995('0x7')][_0x234d8d[_0x7995('0x1d')]][_0x7995('0x54')]===_0x7995('0x55')){if(this['agents'][_0x234d8d['interface']]){logger[_0x7995('0x28')](_0x7995('0x56'),_0x234d8d[_0x7995('0x2f')],_0x234d8d[_0x7995('0x3c')],_0x234d8d['queue']);return RpcUser[_0x7995('0x57')](this['agents'][_0x234d8d['interface']],_0x7995('0x58'),_0x234d8d[_0x7995('0x2f')]);}}}catch(_0x3f0a71){logger[_0x7995('0x33')](_0x7995('0x59'),_0x3f0a71[_0x7995('0x3f')]);}};module[_0x7995('0x5a')]=Acw; \ No newline at end of file +var _0x9957=['then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent'];(function(_0x11080c,_0x583902){var _0x4005ae=function(_0x25481e){while(--_0x25481e){_0x11080c['push'](_0x11080c['shift']());}};_0x4005ae(++_0x583902);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var ami=require(_0x7995('0x3'));var logger=require('../../../config/logger')(_0x7995('0x4'));var RpcUser=require(_0x7995('0x5'));var RpcVoiceAgentReport=require(_0x7995('0x6'));function Acw(_0x462a03){this['voiceQueues']=_0x462a03[_0x7995('0x7')];this[_0x7995('0x8')]=_0x462a03[_0x7995('0x8')];this[_0x7995('0x9')]=_0x462a03[_0x7995('0x9')];this[_0x7995('0xa')]={};ami['on']('agentconnect',this[_0x7995('0xb')][_0x7995('0xc')](this));ami['on']('hanguprequest',this[_0x7995('0xd')][_0x7995('0xc')](this));ami['on'](_0x7995('0xe'),this[_0x7995('0xf')][_0x7995('0xc')](this));ami['on'](_0x7995('0x10'),this[_0x7995('0x11')]['bind'](this));ami['on'](_0x7995('0x12'),this[_0x7995('0x13')]['bind'](this));ami['on'](_0x7995('0x14'),this[_0x7995('0x15')][_0x7995('0xc')](this));ami['on'](_0x7995('0x16'),this[_0x7995('0x17')][_0x7995('0xc')](this));}function getDiff(_0x2bbe7a){var _0x4cc004=moment()['milliseconds'](0x0);var _0x2b4e94=moment(_0x2bbe7a)[_0x7995('0x18')](0x0);return _0x4cc004[_0x7995('0x19')](_0x2b4e94,_0x7995('0x1a'));}Acw[_0x7995('0x1b')][_0x7995('0x1c')]=function(_0x2202ce){try{var _0x41cbf0=this;var _0x5377e5=this[_0x7995('0xa')][_0x2202ce]['interface'];var _0x2f832e=this[_0x7995('0xa')][_0x2202ce][_0x7995('0x1d')];var _0x291317=this[_0x7995('0x7')][_0x2f832e];var _0x37a7d4=![];var _0x4faa60='ACW';if(_0x291317[_0x7995('0x1e')]){if(_0x291317['mandatoryDispositionPause']['name']){_0x37a7d4=!![];_0x4faa60=_0x291317[_0x7995('0x1f')][_0x7995('0x20')];}}ami['Action']({'action':_0x7995('0x21'),'interface':_0x5377e5,'paused':!![],'reason':_0x4faa60})['then'](function(_0x4b1a8e){if(_0x41cbf0[_0x7995('0x8')][_0x5377e5]){return RpcUser[_0x7995('0x22')](_0x41cbf0[_0x7995('0x8')][_0x5377e5]['id'])[_0x7995('0x23')](function(_0x460924){if(_0x460924&&!_0x460924[_0x7995('0x24')]){logger['info'](_0x7995('0x25'),_0x2202ce,_0x5377e5,_0x2f832e);var _0x46ee4b=_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x26')]&&_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]?_0x41cbf0[_0x7995('0xa')][_0x2202ce][_0x7995('0x27')]:_0x2202ce;return RpcUser['savePause'](_0x41cbf0[_0x7995('0x8')][_0x5377e5],_0x4faa60,_0x46ee4b)[_0x7995('0x23')](function(_0x401dc3){if(!_0x37a7d4){_0x41cbf0[_0x7995('0x9')][_0x5377e5]={};logger[_0x7995('0x28')](_0x7995('0x29'),_0x2202ce,_0x41cbf0['voiceQueues'][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2b')]=setTimeout(_0x41cbf0[_0x7995('0x2c')][_0x7995('0xc')](_0x41cbf0,_0x5377e5),_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')]*0x3e8);_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2d')]=moment()['format'](_0x7995('0x2e'));_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2f')]=_0x2202ce;_0x41cbf0['timers'][_0x5377e5]['queue']=_0x2f832e;_0x41cbf0['timers'][_0x5377e5][_0x7995('0x30')]=function(){var _0xe6b0b3=getDiff(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2d')]);clearTimeout(_0x41cbf0[_0x7995('0x9')][_0x5377e5][_0x7995('0x2b')]);_0x41cbf0['timers'][_0x5377e5]['timer']=![];RpcVoiceAgentReport[_0x7995('0x31')]({'acwtime':_0xe6b0b3},_0x41cbf0['timers'][_0x5377e5][_0x7995('0x2f')],_0x5377e5)[_0x7995('0x23')](function(_0x29fac5){logger[_0x7995('0x28')](_0x7995('0x32'),_0x2202ce,_0xe6b0b3,_0x29fac5);})['catch'](function(_0x44309d){logger[_0x7995('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x2202ce,_0x44309d);});delete _0x41cbf0['timers'][_0x5377e5];};}});}else{logger['info'](_0x7995('0x34'),_0x2202ce,_0x5377e5,_0x2f832e);}});}})[_0x7995('0x35')](function(_0x4a176f){logger[_0x7995('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2202ce,_0x41cbf0[_0x7995('0x7')][_0x2f832e][_0x7995('0x2a')],_0x5377e5,_0x2f832e);})[_0x7995('0x36')](function(){delete _0x41cbf0['channels'][_0x2202ce];});}catch(_0x52d76d){logger[_0x7995('0x33')]('[ACW][START]\x20%s',_0x52d76d['message']);}};Acw[_0x7995('0x1b')][_0x7995('0x2c')]=function(_0x5212ff){try{var _0x1baa15=this;if(_0x1baa15[_0x7995('0x9')][_0x5212ff]){_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x2b')]=![];var _0x1e3dbf=_0x1baa15['timers'][_0x5212ff][_0x7995('0x2f')];var _0x242713=_0x1baa15[_0x7995('0x9')][_0x5212ff][_0x7995('0x1d')];var _0x4b1541=_0x1baa15[_0x7995('0x7')][_0x242713][_0x7995('0x2a')];logger[_0x7995('0x28')](_0x7995('0x37'),_0x1e3dbf,_0x5212ff);RpcUser[_0x7995('0x38')](this[_0x7995('0x8')][_0x5212ff]);RpcVoiceAgentReport['update']({'acwtime':_0x4b1541,'agentacw':!![]},_0x1e3dbf,_0x5212ff)[_0x7995('0x23')](function(_0x3be298){logger[_0x7995('0x28')](_0x7995('0x32'),_0x1e3dbf,_0x4b1541,_0x3be298);})[_0x7995('0x35')](function(_0x298fc2){logger[_0x7995('0x33')](_0x7995('0x39'),_0x1e3dbf,_0x298fc2);});}else{logger[_0x7995('0x33')](_0x7995('0x3a'),_0x5212ff);if(_0x1baa15[_0x7995('0x9')]){logger[_0x7995('0x28')](_0x7995('0x3b'),JSON['stringify'](_0x1baa15['timers']));}}}catch(_0x334dff){logger[_0x7995('0x33')]('[ACW][STOP]\x20%s',_0x334dff['message']);}};Acw[_0x7995('0x1b')]['syncAgentConnect']=function(_0x504a33){try{if(this[_0x7995('0x7')][_0x504a33[_0x7995('0x1d')]]&&(this[_0x7995('0x7')][_0x504a33['queue']][_0x7995('0x4')]||this['voiceQueues'][_0x504a33[_0x7995('0x1d')]]['mandatoryDisposition'])){if(this['agents'][_0x504a33[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x504a33[_0x7995('0x2f')]]={'queue':_0x504a33[_0x7995('0x1d')],'interface':_0x504a33['interface'],'destlinkedid':_0x504a33[_0x7995('0x27')]};}}}catch(_0x40fc68){logger[_0x7995('0x33')](_0x7995('0x3d'),_0x40fc68['message']);}};Acw['prototype'][_0x7995('0x17')]=function(_0x55791b){try{if(this[_0x7995('0x7')][_0x55791b['queue']]&&(this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x4')]||this[_0x7995('0x7')][_0x55791b['queue']][_0x7995('0x1e')])){if(this[_0x7995('0x8')][_0x55791b[_0x7995('0x3c')]]){this[_0x7995('0xa')][_0x55791b['uniqueid']]={'queue':_0x55791b[_0x7995('0x1d')],'interface':_0x55791b[_0x7995('0x3c')]};}}}catch(_0x237270){logger['error'](_0x7995('0x3e'),_0x237270[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0xd')]=function(_0x255313){try{if(this['channels'][_0x255313[_0x7995('0x2f')]]&&_[_0x7995('0x40')](this['channels'][_0x255313[_0x7995('0x2f')]]['attended'])){logger[_0x7995('0x28')](_0x7995('0x41'),_0x255313[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x255313[_0x7995('0x2f')]);}else if(this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]]&&_['isUndefined'](this[_0x7995('0xa')][_0x255313[_0x7995('0x42')]][_0x7995('0x26')])){logger['info'](_0x7995('0x43'),_0x255313[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x255313['linkedid']);}}catch(_0x4ec548){logger['error'](_0x7995('0x44'),_0x4ec548[_0x7995('0x3f')]);}};Acw['prototype'][_0x7995('0xf')]=function(_0x29f300){try{if(this[_0x7995('0xa')][_0x29f300[_0x7995('0x2f')]]&&this[_0x7995('0xa')][_0x29f300['uniqueid']][_0x7995('0x26')]){logger['info'](_0x7995('0x45'),_0x29f300[_0x7995('0x2f')]);this[_0x7995('0x1c')](_0x29f300['uniqueid']);}else if(this['channels'][_0x29f300['linkedid']]&&this['channels'][_0x29f300[_0x7995('0x42')]][_0x7995('0x26')]){logger[_0x7995('0x28')](_0x7995('0x46'),_0x29f300[_0x7995('0x42')]);this[_0x7995('0x1c')](_0x29f300[_0x7995('0x42')]);}}catch(_0xda6ce8){logger[_0x7995('0x33')](_0x7995('0x47'),_0xda6ce8[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x13')]=function(_0x35bea3){try{if(!_[_0x7995('0x48')](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x49')]);if(this['channels'][_0x35bea3[_0x7995('0x4a')]]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]][_0x7995('0x26')]=!![];this['channels'][_0x35bea3['transfertargetuniqueid']]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4a')]];}}else if(!_['isNil'](this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4b')]])){this[_0x7995('0x1c')](_0x35bea3[_0x7995('0x4b')]);if(this['channels'][_0x35bea3['origtransfereruniqueid']]){this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]][_0x7995('0x26')]=!![];this[_0x7995('0xa')][_0x35bea3[_0x7995('0x49')]]=this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];delete this[_0x7995('0xa')][_0x35bea3[_0x7995('0x4c')]];}}}catch(_0x50caf5){logger[_0x7995('0x33')](_0x7995('0x4d'),_0x50caf5[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')]['syncBlindTransfer']=function(_0x51bf6a){try{if(this[_0x7995('0xa')][_0x51bf6a[_0x7995('0x4e')]]){logger['info'](_0x7995('0x4f'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x4e')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x4e')]);}else if(this['channels'][_0x51bf6a[_0x7995('0x51')]]){logger['info'](_0x7995('0x52'),JSON[_0x7995('0x50')](_0x51bf6a[_0x7995('0x51')]));this[_0x7995('0x1c')](_0x51bf6a[_0x7995('0x51')]);}}catch(_0xeb8920){logger[_0x7995('0x33')](_0x7995('0x53'),_0xeb8920[_0x7995('0x3f')]);}};Acw[_0x7995('0x1b')][_0x7995('0x11')]=function(_0x234d8d){try{if(this['voiceQueues'][_0x234d8d[_0x7995('0x1d')]]&&this[_0x7995('0x7')][_0x234d8d[_0x7995('0x1d')]][_0x7995('0x54')]===_0x7995('0x55')){if(this['agents'][_0x234d8d['interface']]){logger[_0x7995('0x28')](_0x7995('0x56'),_0x234d8d[_0x7995('0x2f')],_0x234d8d[_0x7995('0x3c')],_0x234d8d['queue']);return RpcUser[_0x7995('0x57')](this['agents'][_0x234d8d['interface']],_0x7995('0x58'),_0x234d8d[_0x7995('0x2f')]);}}}catch(_0x3f0a71){logger[_0x7995('0x33')](_0x7995('0x59'),_0x3f0a71[_0x7995('0x3f')]);}};module[_0x7995('0x5a')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 53b2a9a..239dc61 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 _0x9d77=['bluebird','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','username','password','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','port','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','Action','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','info','resolve','then','catch','exports'];(function(_0x5c422a,_0x2376e5){var _0x6c5b33=function(_0x3138c0){while(--_0x3138c0){_0x5c422a['push'](_0x5c422a['shift']());}};_0x6c5b33(++_0x2376e5);}(_0x9d77,0xea));var _0x79d7=function(_0x35e35c,_0x236278){_0x35e35c=_0x35e35c-0x0;var _0x25ac09=_0x9d77[_0x35e35c];return _0x25ac09;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x79d7('0x0'));var moment=require(_0x79d7('0x1'));var util=require(_0x79d7('0x2'));var _=require(_0x79d7('0x3'));var logger=require(_0x79d7('0x4'))(_0x79d7('0x5'));var config=require(_0x79d7('0x6'));var ami=new Manager(config[_0x79d7('0x7')]['port'],config[_0x79d7('0x7')]['ip'],config[_0x79d7('0x7')][_0x79d7('0x8')],config['asterisk'][_0x79d7('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0x79d7('0xa')](ami[_0x79d7('0xb')]);function error(_0x1239bb){logger[_0x79d7('0xc')](util[_0x79d7('0xd')](_0x79d7('0xe'),config[_0x79d7('0x7')]['username'],config[_0x79d7('0x7')]['ip'],config[_0x79d7('0x7')]['port'],util[_0x79d7('0xf')](_0x1239bb,![],null)));}function close(){logger[_0x79d7('0xc')](util[_0x79d7('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x79d7('0x7')][_0x79d7('0x8')],config[_0x79d7('0x7')]['ip'],config[_0x79d7('0x7')][_0x79d7('0x10')]));}ami[_0x79d7('0x11')]=function(){return function(){return ami['Action']({'action':_0x79d7('0x12')});};};ami[_0x79d7('0x13')]=function(){return function(){return ami['Action']({'action':_0x79d7('0x14')});};};ami[_0x79d7('0x15')]=function(){return function(){return ami[_0x79d7('0x16')]({'action':_0x79d7('0x17')});};};ami[_0x79d7('0x18')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x79d7('0x19')]=function(){return function(){return ami[_0x79d7('0x16')]({'action':_0x79d7('0x1a')});};};function connect(_0x351d37){logger['info'](util[_0x79d7('0xd')](_0x79d7('0x1b'),config[_0x79d7('0x7')][_0x79d7('0x8')],config[_0x79d7('0x7')]['ip'],config[_0x79d7('0x7')][_0x79d7('0x10')]));ami[_0x79d7('0x1c')](_0x79d7('0xc'),error);ami[_0x79d7('0x1c')](_0x79d7('0x1d'),close);}ami['on'](_0x79d7('0x1e'),connect);ami['on'](_0x79d7('0x1f'),function(_0x9503b2){logger['info'](util[_0x79d7('0xd')](_0x79d7('0x20'),config[_0x79d7('0x7')][_0x79d7('0x8')],config[_0x79d7('0x7')]['ip'],config[_0x79d7('0x7')]['port'],util[_0x79d7('0xf')](_0x9503b2,![],null)));});ami['on'](_0x79d7('0x21'),function(_0x53ea5a){logger[_0x79d7('0x22')](util[_0x79d7('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x79d7('0x7')][_0x79d7('0x8')],config['asterisk']['ip'],config[_0x79d7('0x7')]['port']));return BPromise[_0x79d7('0x23')]()['then'](ami[_0x79d7('0x11')]())['then'](ami['actionDeviceStateList']())[_0x79d7('0x24')](ami[_0x79d7('0x15')]())[_0x79d7('0x24')](ami[_0x79d7('0x18')]())[_0x79d7('0x24')](ami[_0x79d7('0x19')]())[_0x79d7('0x25')](function(_0x2cdc26){console['log'](_0x2cdc26);});});ami[_0x79d7('0x1c')](_0x79d7('0xc'),error);ami[_0x79d7('0x1c')](_0x79d7('0x1d'),close);module[_0x79d7('0x26')]=ami; \ No newline at end of file +var _0xb38b=['then','log','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb38b,0x135));var _0xbb38=function(_0xe4de9,_0x4c6f61){_0xe4de9=_0xe4de9-0x0;var _0x3d9fe7=_0xb38b[_0xe4de9];return _0x3d9fe7;};'use strict';var Manager=require(_0xbb38('0x0'));var BPromise=require(_0xbb38('0x1'));var moment=require(_0xbb38('0x2'));var util=require('util');var _=require(_0xbb38('0x3'));var logger=require(_0xbb38('0x4'))('ami');var config=require(_0xbb38('0x5'));var ami=new Manager(config[_0xbb38('0x6')][_0xbb38('0x7')],config[_0xbb38('0x6')]['ip'],config['asterisk'][_0xbb38('0x8')],config[_0xbb38('0x6')][_0xbb38('0x9')],!![]);ami[_0xbb38('0xa')]();ami[_0xbb38('0xb')]=BPromise[_0xbb38('0xc')](ami[_0xbb38('0xd')]);function error(_0xfbf14f){logger['error'](util[_0xbb38('0xe')](_0xbb38('0xf'),config['asterisk'][_0xbb38('0x8')],config['asterisk']['ip'],config['asterisk'][_0xbb38('0x7')],util[_0xbb38('0x10')](_0xfbf14f,![],null)));}function close(){logger[_0xbb38('0x11')](util[_0xbb38('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0xbb38('0x8')],config[_0xbb38('0x6')]['ip'],config[_0xbb38('0x6')]['port']));}ami[_0xbb38('0x12')]=function(){return function(){return ami[_0xbb38('0xb')]({'action':'sipshowregistry'});};};ami[_0xbb38('0x13')]=function(){return function(){return ami[_0xbb38('0xb')]({'action':_0xbb38('0x14')});};};ami[_0xbb38('0x15')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xbb38('0x16')]=function(){return function(){return ami[_0xbb38('0xb')]({'action':_0xbb38('0x17')});};};ami[_0xbb38('0x18')]=function(){return function(){return ami[_0xbb38('0xb')]({'action':_0xbb38('0x19')});};};function connect(_0xbcfd1e){logger[_0xbb38('0x1a')](util[_0xbb38('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xbb38('0x6')][_0xbb38('0x8')],config['asterisk']['ip'],config['asterisk'][_0xbb38('0x7')]));ami['once'](_0xbb38('0x11'),error);ami[_0xbb38('0x1b')]('close',close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x3d65a7){logger[_0xbb38('0x1a')](util[_0xbb38('0xe')](_0xbb38('0x1c'),config[_0xbb38('0x6')][_0xbb38('0x8')],config['asterisk']['ip'],config[_0xbb38('0x6')]['port'],util[_0xbb38('0x10')](_0x3d65a7,![],null)));});ami['on']('fullybooted',function(_0x226f5b){logger[_0xbb38('0x1a')](util[_0xbb38('0xe')](_0xbb38('0x1d'),config['asterisk']['username'],config[_0xbb38('0x6')]['ip'],config[_0xbb38('0x6')][_0xbb38('0x7')]));return BPromise[_0xbb38('0x1e')]()[_0xbb38('0x1f')](ami['actionSipShowRegistry']())[_0xbb38('0x1f')](ami[_0xbb38('0x13')]())[_0xbb38('0x1f')](ami[_0xbb38('0x15')]())[_0xbb38('0x1f')](ami[_0xbb38('0x16')]())[_0xbb38('0x1f')](ami[_0xbb38('0x18')]())['catch'](function(_0x167a80){console[_0xbb38('0x20')](_0x167a80);});});ami[_0xbb38('0x1b')]('error',error);ami[_0xbb38('0x1b')]('close',close);module[_0xbb38('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index f670e2b..be5cb30 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 _0x001d=['../../config/logger','ami','client','Request','request','then','rpc','memberReport','error','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x001d,0xdf));var _0xd001=function(_0x4f91f5,_0x4b0282){_0x4f91f5=_0x4f91f5-0x0;var _0x3cee50=_0x001d[_0x4f91f5];return _0x3cee50;};'use strict';var jayson=require(_0xd001('0x0'));var BPromise=require(_0xd001('0x1'));var logger=require(_0xd001('0x2'))(_0xd001('0x3'));var client=jayson[_0xd001('0x4')]['http']({'port':0x2329});client[_0xd001('0x5')]=function(_0x248464,_0x3210ac){return new BPromise(function(_0x549cf9,_0x24a99e){return client[_0xd001('0x6')](_0x248464,_0x3210ac)[_0xd001('0x7')](function(_0x2ee9b0){logger['debug'](_0xd001('0x8'),_0xd001('0x9'),_0x248464,_0x3210ac,_0x2ee9b0);if(_0x2ee9b0['error']){logger['error'](_0xd001('0x8'),_0xd001('0x9'),_0x248464,_0x2ee9b0[_0xd001('0xa')][_0xd001('0xb')],_0x3210ac);return _0x24a99e(_0x2ee9b0[_0xd001('0xa')][_0xd001('0xb')]);}else{return _0x549cf9(_0x2ee9b0[_0xd001('0xc')]);}})[_0xd001('0xd')](function(_0x469c18){logger['error']('rpc',_0xd001('0x9'),_0x248464,_0x469c18,_0x3210ac);return _0x24a99e(_0x469c18);});});};module[_0xd001('0xe')]=client; \ No newline at end of file +var _0xb202=['jayson/promise','ami','client','Request','request','then','rpc','memberReport','error','message','catch','exports'];(function(_0x3b9995,_0x471ac2){var _0x4795f0=function(_0x1f6ac2){while(--_0x1f6ac2){_0x3b9995['push'](_0x3b9995['shift']());}};_0x4795f0(++_0x471ac2);}(_0xb202,0x84));var _0x2b20=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xb202[_0x4cf98e];return _0x1623ac;};'use strict';var jayson=require(_0x2b20('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x2b20('0x1'));var client=jayson[_0x2b20('0x2')]['http']({'port':0x2329});client[_0x2b20('0x3')]=function(_0x4fada8,_0x26b29c){return new BPromise(function(_0x4f6f47,_0x847360){return client[_0x2b20('0x4')](_0x4fada8,_0x26b29c)[_0x2b20('0x5')](function(_0x45f02e){logger['debug'](_0x2b20('0x6'),_0x2b20('0x7'),_0x4fada8,_0x26b29c,_0x45f02e);if(_0x45f02e['error']){logger['error'](_0x2b20('0x6'),_0x2b20('0x7'),_0x4fada8,_0x45f02e[_0x2b20('0x8')][_0x2b20('0x9')],_0x26b29c);return _0x847360(_0x45f02e[_0x2b20('0x8')][_0x2b20('0x9')]);}else{return _0x4f6f47(_0x45f02e['result']);}})[_0x2b20('0xa')](function(_0x25526e){logger[_0x2b20('0x8')](_0x2b20('0x6'),_0x2b20('0x7'),_0x4fada8,_0x25526e,_0x26b29c);return _0x847360(_0x25526e);});});};module[_0x2b20('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 73b9e5a..a27b882 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x552d=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','moment','isNil','voiceQueue','uniqueid','name','phone','firstName','Contact','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry'];(function(_0x3f9399,_0x3caf17){var _0x11c085=function(_0x598ac2){while(--_0x598ac2){_0x3f9399['push'](_0x3f9399['shift']());}};_0x11c085(++_0x3caf17);}(_0x552d,0x14f));var _0xd552=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x552d[_0x8c43de];return _0xa6591b;};'use strict';var util=require(_0xd552('0x0'));var _=require('lodash');var moment=require(_0xd552('0x1'));function checkNameSurname(_0x529f12,_0x1b4d56,_0x361f27){var _0x5a2509='';if(!_[_0xd552('0x2')](_0x1b4d56)&&'string'===typeof _0x1b4d56){_0x5a2509+=_0x1b4d56;}if(!_['isNil'](_0x361f27)&&'string'===typeof _0x361f27){_0x5a2509+='\x20'+_0x361f27;}if(_0x5a2509!==''){return _0x5a2509;}return _0x529f12;}function Action(_0x2c1dfb,_0x214649,_0x5dfc33){this[_0xd552('0x3')]=_0x2c1dfb;this[_0xd552('0x4')]=_0x5dfc33||undefined;this[_0xd552('0x5')]=checkNameSurname(_0x214649['Contact'][_0xd552('0x6')],_0x214649['Contact'][_0xd552('0x7')],_0x214649[_0xd552('0x8')][_0xd552('0x9')]);this[_0xd552('0xa')]=_0x214649[_0xd552('0x6')];this[_0xd552('0xb')]=_0x2c1dfb['name'];this[_0xd552('0xc')]=_0x214649[_0xd552('0xc')]||![];this['type']=_0x2c1dfb[_0xd552('0xd')];this[_0xd552('0xe')]=_0x2c1dfb['dialQueueTimeout']||0x3;this[_0xd552('0xf')]=_0x214649[_0xd552('0xf')];this[_0xd552('0x10')]=_0x214649[_0xd552('0x10')];this[_0xd552('0x11')]=_0x214649[_0xd552('0x11')];this[_0xd552('0x12')]=_0x214649[_0xd552('0x12')];this[_0xd552('0x13')]=_0x214649['countnosuchnumberretry'];this[_0xd552('0x14')]=_0x214649[_0xd552('0x14')];this[_0xd552('0x15')]=_0x214649[_0xd552('0x15')];this['countmachineretry']=_0x214649['countmachineretry'];this[_0xd552('0x16')]=_0x214649['countagentrejectretry'];this[_0xd552('0x17')]=_0x214649[_0xd552('0x17')];this[_0xd552('0x18')]=_0x214649[_0xd552('0x18')];this['UserId']=_0x214649['UserId'];this[_0xd552('0x19')]=_0x214649['VoiceQueueId'];this['CampaignId']=_0x214649[_0xd552('0x1a')];this[_0xd552('0x1b')]=_0x214649['id'];this[_0xd552('0x1c')]=_0x214649[_0xd552('0x8')]['firstName']||'';this[_0xd552('0x1d')]=moment()[_0xd552('0x1e')](_0xd552('0x1f'));this[_0xd552('0x20')]=_0x214649['callback'];this['callbackuniqueid']=_0x214649[_0xd552('0x21')];this['callbackat']=_0x214649['callbackat'];this['recallme']=_0x214649[_0xd552('0x22')];this[_0xd552('0x23')]='';this[_0xd552('0x24')]='';}Action[_0xd552('0x25')][_0xd552('0x26')]=function(){return util[_0xd552('0x1e')](_0xd552('0x27'),this[_0xd552('0x5')],this[_0xd552('0x3')][_0xd552('0x28')]>0x0?this[_0xd552('0xa')][_0xd552('0x29')](this[_0xd552('0x3')][_0xd552('0x28')]):this[_0xd552('0xa')]);};Action[_0xd552('0x25')][_0xd552('0x2a')]=function(){return this[_0xd552('0xb')];};module[_0xd552('0x2b')]=Action; \ No newline at end of file +var _0xa7b1=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','name','dialCutDigit','substring','exports','util','lodash','isNil','string','voiceQueue','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x243f33,_0x1eb592){var _0x39da33=function(_0x501128){while(--_0x501128){_0x243f33['push'](_0x243f33['shift']());}};_0x39da33(++_0x1eb592);}(_0xa7b1,0x166));var _0x1a7b=function(_0x10ab98,_0x1fb446){_0x10ab98=_0x10ab98-0x0;var _0x4a24f4=_0xa7b1[_0x10ab98];return _0x4a24f4;};'use strict';var util=require(_0x1a7b('0x0'));var _=require(_0x1a7b('0x1'));var moment=require('moment');function checkNameSurname(_0x119e9d,_0x342029,_0x50971d){var _0x27df3f='';if(!_[_0x1a7b('0x2')](_0x342029)&&_0x1a7b('0x3')===typeof _0x342029){_0x27df3f+=_0x342029;}if(!_[_0x1a7b('0x2')](_0x50971d)&&_0x1a7b('0x3')===typeof _0x50971d){_0x27df3f+='\x20'+_0x50971d;}if(_0x27df3f!==''){return _0x27df3f;}return _0x119e9d;}function Action(_0x40c708,_0x1b75f2,_0x3b25c9){this[_0x1a7b('0x4')]=_0x40c708;this['uniqueid']=_0x3b25c9||undefined;this['name']=checkNameSurname(_0x1b75f2[_0x1a7b('0x5')][_0x1a7b('0x6')],_0x1b75f2[_0x1a7b('0x5')][_0x1a7b('0x7')],_0x1b75f2[_0x1a7b('0x5')]['lastName']);this[_0x1a7b('0x8')]=_0x1b75f2[_0x1a7b('0x6')];this[_0x1a7b('0x9')]=_0x40c708['name'];this[_0x1a7b('0xa')]=_0x1b75f2['active']||![];this[_0x1a7b('0xb')]=_0x40c708[_0x1a7b('0xb')];this[_0x1a7b('0xc')]=_0x40c708['dialQueueTimeout']||0x3;this['scheduledat']=_0x1b75f2['scheduledat'];this[_0x1a7b('0xd')]=_0x1b75f2[_0x1a7b('0xd')];this['countcongestionretry']=_0x1b75f2[_0x1a7b('0xe')];this[_0x1a7b('0xf')]=_0x1b75f2['countnoanswerretry'];this[_0x1a7b('0x10')]=_0x1b75f2[_0x1a7b('0x10')];this['countdropretry']=_0x1b75f2[_0x1a7b('0x11')];this[_0x1a7b('0x12')]=_0x1b75f2[_0x1a7b('0x12')];this['countmachineretry']=_0x1b75f2[_0x1a7b('0x13')];this[_0x1a7b('0x14')]=_0x1b75f2['countagentrejectretry'];this[_0x1a7b('0x15')]=_0x1b75f2['ContactId'];this[_0x1a7b('0x16')]=_0x1b75f2[_0x1a7b('0x16')];this[_0x1a7b('0x17')]=_0x1b75f2[_0x1a7b('0x17')];this['VoiceQueueId']=_0x1b75f2[_0x1a7b('0x18')];this[_0x1a7b('0x19')]=_0x1b75f2[_0x1a7b('0x19')];this['idHopper']=_0x1b75f2['id'];this['ContactFirstName']=_0x1b75f2[_0x1a7b('0x5')][_0x1a7b('0x7')]||'';this[_0x1a7b('0x1a')]=moment()[_0x1a7b('0x1b')](_0x1a7b('0x1c'));this[_0x1a7b('0x1d')]=_0x1b75f2[_0x1a7b('0x1d')];this[_0x1a7b('0x1e')]=_0x1b75f2['callbackuniqueid'];this[_0x1a7b('0x1f')]=_0x1b75f2[_0x1a7b('0x1f')];this['recallme']=_0x1b75f2[_0x1a7b('0x20')];this[_0x1a7b('0x21')]='';this[_0x1a7b('0x22')]='';}Action[_0x1a7b('0x23')][_0x1a7b('0x24')]=function(){return util[_0x1a7b('0x1b')](_0x1a7b('0x25'),this[_0x1a7b('0x26')],this['voiceQueue'][_0x1a7b('0x27')]>0x0?this['number'][_0x1a7b('0x28')](this[_0x1a7b('0x4')][_0x1a7b('0x27')]):this[_0x1a7b('0x8')]);};Action['prototype']['getQueue']=function(){return this[_0x1a7b('0x9')];};module[_0x1a7b('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 462852e..7a55dae 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa18b=['originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x41c690,_0x3a5dbb){var _0x1006e4=function(_0x13f18d){while(--_0x13f18d){_0x41c690['push'](_0x41c690['shift']());}};_0x1006e4(++_0x3a5dbb);}(_0xa18b,0x173));var _0xba18=function(_0x4eb7e6,_0x451464){_0x4eb7e6=_0x4eb7e6-0x0;var _0x3cf508=_0xa18b[_0x4eb7e6];return _0x3cf508;};'use strict';var util=require(_0xba18('0x0'));var _=require(_0xba18('0x1'));var moment=require(_0xba18('0x2'));function getSeconds(_0x4ea250,_0x2a282a){var _0xbad845=moment(_0x4ea250)['milliseconds'](0x0);var _0x256e32=moment(_0x2a282a)[_0xba18('0x3')](0x0);return _0xbad845[_0xba18('0x4')](_0x256e32,_0xba18('0x5'));}function AdditionalPhone(_0xf98b4b){this[_0xba18('0x6')]=_0xf98b4b[_0xba18('0x6')];this[_0xba18('0x7')]=_0xf98b4b[_0xba18('0x7')]||undefined;this[_0xba18('0x8')]=_0xf98b4b[_0xba18('0x8')];this[_0xba18('0x9')]=_0xf98b4b['type']===_0xba18('0xa')?_0xba18('0xb'):_0xf98b4b[_0xba18('0x8')];this[_0xba18('0xc')]=_0xf98b4b['countbusyretry'];this[_0xba18('0xd')]=_0xf98b4b['countcongestionretry'];this[_0xba18('0xe')]=_0xf98b4b['countnoanswerretry'];this[_0xba18('0xf')]=_0xf98b4b['countbusyretry']+_0xf98b4b[_0xba18('0xd')]+_0xf98b4b['countnoanswerretry']+_0xf98b4b[_0xba18('0x10')]+_0xf98b4b['countdropretry']+_0xf98b4b['countabandonedretry']+_0xf98b4b[_0xba18('0x11')]+_0xf98b4b[_0xba18('0x12')];this[_0xba18('0x10')]=_0xf98b4b[_0xba18('0x10')];this['countdropretry']=_0xf98b4b[_0xba18('0x13')];this['countabandonedretry']=_0xf98b4b[_0xba18('0x14')];this[_0xba18('0x11')]=_0xf98b4b['countmachineretry'];this[_0xba18('0x12')]=_0xf98b4b[_0xba18('0x12')];this[_0xba18('0xb')]=_0xf98b4b[_0xba18('0xb')];this[_0xba18('0x15')]=_0xf98b4b[_0xba18('0x16')];this[_0xba18('0x17')]=_0xf98b4b['number'];this[_0xba18('0x18')]=_0xf98b4b['starttime'];this['responsetime']=_0xf98b4b[_0xba18('0x19')];this[_0xba18('0x1a')]=_0xf98b4b[_0xba18('0x19')];this[_0xba18('0x1b')]=getSeconds(_0xf98b4b['responsetime'],_0xf98b4b['starttime']);this[_0xba18('0x1c')]=0x0;this['talktime']=0x0;this[_0xba18('0x1d')]=_0xf98b4b['callback'];this['callbackuniqueid']=_0xf98b4b[_0xba18('0x1e')];this[_0xba18('0x1f')]=_0xf98b4b['callbackat'];this[_0xba18('0x20')]=_0xf98b4b[_0xba18('0x20')];this[_0xba18('0x21')]=_0xf98b4b['ContactId'];this[_0xba18('0x22')]=_0xf98b4b[_0xba18('0x22')];this['UserId']=_0xf98b4b[_0xba18('0x23')];this[_0xba18('0x24')]=_0xf98b4b[_0xba18('0x24')];this[_0xba18('0x25')]=_0xf98b4b[_0xba18('0x25')];this['originatecalleridnum']=_0xf98b4b[_0xba18('0x26')]||'';this[_0xba18('0x27')]=_0xf98b4b[_0xba18('0x27')]||'';}module[_0xba18('0x28')]=History; \ No newline at end of file +var _0x3912=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3912,0xb5));var _0x2391=function(_0x34e2e5,_0x355fff){_0x34e2e5=_0x34e2e5-0x0;var _0xf364da=_0x3912[_0x34e2e5];return _0xf364da;};'use strict';var util=require(_0x2391('0x0'));var _=require(_0x2391('0x1'));var moment=require(_0x2391('0x2'));function getSeconds(_0xe0aacf,_0x18bf56){var _0x75aca3=moment(_0xe0aacf)[_0x2391('0x3')](0x0);var _0x3331b3=moment(_0x18bf56)['milliseconds'](0x0);return _0x75aca3['diff'](_0x3331b3,'seconds');}function AdditionalPhone(_0x3588c4){this[_0x2391('0x4')]=_0x3588c4['uniqueid'];this[_0x2391('0x5')]=_0x3588c4[_0x2391('0x5')]||undefined;this[_0x2391('0x6')]=_0x3588c4['type'];this[_0x2391('0x7')]=_0x3588c4[_0x2391('0x6')]===_0x2391('0x8')?_0x2391('0x9'):_0x3588c4['type'];this['countbusyretry']=_0x3588c4[_0x2391('0xa')];this[_0x2391('0xb')]=_0x3588c4['countcongestionretry'];this[_0x2391('0xc')]=_0x3588c4[_0x2391('0xc')];this[_0x2391('0xd')]=_0x3588c4[_0x2391('0xa')]+_0x3588c4[_0x2391('0xb')]+_0x3588c4[_0x2391('0xc')]+_0x3588c4[_0x2391('0xe')]+_0x3588c4[_0x2391('0xf')]+_0x3588c4[_0x2391('0x10')]+_0x3588c4['countmachineretry']+_0x3588c4[_0x2391('0x11')];this[_0x2391('0xe')]=_0x3588c4[_0x2391('0xe')];this[_0x2391('0xf')]=_0x3588c4[_0x2391('0xf')];this[_0x2391('0x10')]=_0x3588c4['countabandonedretry'];this['countmachineretry']=_0x3588c4['countmachineretry'];this[_0x2391('0x11')]=_0x3588c4['countagentrejectretry'];this[_0x2391('0x9')]=_0x3588c4[_0x2391('0x9')];this[_0x2391('0x12')]=_0x3588c4[_0x2391('0x13')];this[_0x2391('0x14')]=_0x3588c4[_0x2391('0x15')];this[_0x2391('0x16')]=_0x3588c4['starttime'];this[_0x2391('0x17')]=_0x3588c4[_0x2391('0x17')];this[_0x2391('0x18')]=_0x3588c4[_0x2391('0x17')];this[_0x2391('0x19')]=getSeconds(_0x3588c4[_0x2391('0x17')],_0x3588c4[_0x2391('0x16')]);this[_0x2391('0x1a')]=0x0;this[_0x2391('0x1b')]=0x0;this['callback']=_0x3588c4[_0x2391('0x1c')];this[_0x2391('0x1d')]=_0x3588c4[_0x2391('0x1d')];this['callbackat']=_0x3588c4[_0x2391('0x1e')];this['recallme']=_0x3588c4[_0x2391('0x1f')];this['ContactId']=_0x3588c4[_0x2391('0x20')];this['ListId']=_0x3588c4['ListId'];this[_0x2391('0x21')]=_0x3588c4[_0x2391('0x21')];this[_0x2391('0x22')]=_0x3588c4['VoiceQueueId'];this[_0x2391('0x23')]=_0x3588c4[_0x2391('0x23')];this[_0x2391('0x24')]=_0x3588c4['originatecalleridnum']||'';this[_0x2391('0x25')]=_0x3588c4[_0x2391('0x25')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index d89c859..6a404fb 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bb8=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9bb8,0x13a));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x89bb('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x5ca03c,_0xba89f9){var _0x522792=moment(_0x5ca03c)[_0x89bb('0x1')](0x0);var _0x42e76c=moment(_0xba89f9)[_0x89bb('0x1')](0x0);return _0x522792[_0x89bb('0x2')](_0x42e76c,'seconds');}function AgentComplete(_0x366bd2,_0x433d05){this['state']=0x4;this[_0x89bb('0x3')]=_0x89bb('0x4');this[_0x89bb('0x5')]=_0x366bd2[_0x89bb('0x5')];this[_0x89bb('0x6')]=_0x366bd2['type'];this[_0x89bb('0x7')]=_0x366bd2[_0x89bb('0x6')]===_0x89bb('0x8')?_0x89bb('0x9'):_0x366bd2[_0x89bb('0x6')];this['countbusyretry']=_0x366bd2['countbusyretry'];this[_0x89bb('0xa')]=_0x366bd2['countcongestionretry'];this[_0x89bb('0xb')]=_0x366bd2['countnoanswerretry'];this[_0x89bb('0xc')]=_0x366bd2[_0x89bb('0xd')]+_0x366bd2[_0x89bb('0xa')]+_0x366bd2['countnoanswerretry']+_0x366bd2[_0x89bb('0xe')]+_0x366bd2[_0x89bb('0xf')]+_0x366bd2[_0x89bb('0x10')]+_0x366bd2[_0x89bb('0x11')]+_0x366bd2['countagentrejectretry'];this['countnosuchnumberretry']=_0x366bd2['countnosuchnumberretry'];this[_0x89bb('0xf')]=_0x366bd2[_0x89bb('0xf')];this['countabandonedretry']=_0x366bd2[_0x89bb('0x10')];this[_0x89bb('0x11')]=_0x366bd2[_0x89bb('0x11')];this[_0x89bb('0x12')]=_0x366bd2[_0x89bb('0x12')];this['uniqueid']=_0x433d05['uniqueid'];this['calleridname']=_0x366bd2['name'];this[_0x89bb('0x13')]=_0x366bd2['number'];this[_0x89bb('0x14')]=_0x366bd2[_0x89bb('0x14')];this[_0x89bb('0x15')]=_0x366bd2[_0x89bb('0x15')];this[_0x89bb('0x16')]=_0x366bd2[_0x89bb('0x16')];this[_0x89bb('0x17')]=moment()[_0x89bb('0x18')](_0x89bb('0x19'));this[_0x89bb('0x1a')]=getSeconds(_0x366bd2[_0x89bb('0x15')],_0x366bd2[_0x89bb('0x14')]);this[_0x89bb('0x1b')]=getSeconds(_0x366bd2[_0x89bb('0x16')],_0x366bd2[_0x89bb('0x15')]);this[_0x89bb('0x1c')]=getSeconds(this[_0x89bb('0x17')],_0x366bd2['answertime']);this['queue']=_0x433d05[_0x89bb('0x9')];this[_0x89bb('0x1d')]=_0x433d05[_0x89bb('0x1d')];this[_0x89bb('0x1e')]=_0x433d05[_0x89bb('0x1e')];this[_0x89bb('0x1f')]=_0x366bd2[_0x89bb('0x1f')];this[_0x89bb('0x20')]=_0x366bd2[_0x89bb('0x20')];this[_0x89bb('0x21')]=_0x366bd2[_0x89bb('0x21')];this[_0x89bb('0x22')]=_0x366bd2[_0x89bb('0x22')];this[_0x89bb('0x23')]=_0x366bd2[_0x89bb('0x23')];this[_0x89bb('0x24')]=_0x366bd2[_0x89bb('0x24')];this[_0x89bb('0x25')]=_0x366bd2['UserId'];this[_0x89bb('0x26')]=_0x366bd2['VoiceQueueId'];this[_0x89bb('0x27')]=_0x366bd2[_0x89bb('0x27')];this[_0x89bb('0x28')]=_0x366bd2['originatecalleridnum']||'';this[_0x89bb('0x29')]=_0x366bd2['originatecalleridname']||'';}module[_0x89bb('0x2a')]=AgentComplete; \ No newline at end of file +var _0x8eb8=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','answertime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x1dbc72,_0x2471ce){var _0x45d204=function(_0x50658f){while(--_0x50658f){_0x1dbc72['push'](_0x1dbc72['shift']());}};_0x45d204(++_0x2471ce);}(_0x8eb8,0x1ad));var _0x88eb=function(_0x767f15,_0x30408f){_0x767f15=_0x767f15-0x0;var _0x232f49=_0x8eb8[_0x767f15];return _0x232f49;};'use strict';var util=require(_0x88eb('0x0'));var _=require(_0x88eb('0x1'));var moment=require(_0x88eb('0x2'));function getSeconds(_0x923771,_0x1eff82){var _0x560b45=moment(_0x923771)[_0x88eb('0x3')](0x0);var _0x2992d3=moment(_0x1eff82)['milliseconds'](0x0);return _0x560b45[_0x88eb('0x4')](_0x2992d3,_0x88eb('0x5'));}function AgentComplete(_0x5508c1,_0x5ebf8b){this[_0x88eb('0x6')]=0x4;this['statedesc']=_0x88eb('0x7');this[_0x88eb('0x8')]=_0x5508c1[_0x88eb('0x8')];this[_0x88eb('0x9')]=_0x5508c1[_0x88eb('0x9')];this[_0x88eb('0xa')]=_0x5508c1[_0x88eb('0x9')]===_0x88eb('0xb')?_0x88eb('0xc'):_0x5508c1[_0x88eb('0x9')];this['countbusyretry']=_0x5508c1[_0x88eb('0xd')];this[_0x88eb('0xe')]=_0x5508c1[_0x88eb('0xe')];this['countnoanswerretry']=_0x5508c1[_0x88eb('0xf')];this[_0x88eb('0x10')]=_0x5508c1[_0x88eb('0xd')]+_0x5508c1[_0x88eb('0xe')]+_0x5508c1[_0x88eb('0xf')]+_0x5508c1[_0x88eb('0x11')]+_0x5508c1[_0x88eb('0x12')]+_0x5508c1[_0x88eb('0x13')]+_0x5508c1[_0x88eb('0x14')]+_0x5508c1[_0x88eb('0x15')];this['countnosuchnumberretry']=_0x5508c1['countnosuchnumberretry'];this[_0x88eb('0x12')]=_0x5508c1[_0x88eb('0x12')];this[_0x88eb('0x13')]=_0x5508c1['countabandonedretry'];this[_0x88eb('0x14')]=_0x5508c1[_0x88eb('0x14')];this[_0x88eb('0x15')]=_0x5508c1['countagentrejectretry'];this[_0x88eb('0x16')]=_0x5ebf8b[_0x88eb('0x16')];this['calleridname']=_0x5508c1[_0x88eb('0x17')];this[_0x88eb('0x18')]=_0x5508c1[_0x88eb('0x19')];this[_0x88eb('0x1a')]=_0x5508c1[_0x88eb('0x1a')];this[_0x88eb('0x1b')]=_0x5508c1[_0x88eb('0x1b')];this['answertime']=_0x5508c1['answertime'];this[_0x88eb('0x1c')]=moment()[_0x88eb('0x1d')](_0x88eb('0x1e'));this[_0x88eb('0x1f')]=getSeconds(_0x5508c1[_0x88eb('0x1b')],_0x5508c1['starttime']);this[_0x88eb('0x20')]=getSeconds(_0x5508c1[_0x88eb('0x21')],_0x5508c1[_0x88eb('0x1b')]);this['talktime']=getSeconds(this[_0x88eb('0x1c')],_0x5508c1['answertime']);this[_0x88eb('0xc')]=_0x5ebf8b['queue'];this[_0x88eb('0x22')]=_0x5ebf8b[_0x88eb('0x22')];this[_0x88eb('0x23')]=_0x5ebf8b[_0x88eb('0x23')];this[_0x88eb('0x24')]=_0x5508c1['callback'];this[_0x88eb('0x25')]=_0x5508c1['callbackuniqueid'];this[_0x88eb('0x26')]=_0x5508c1[_0x88eb('0x26')];this[_0x88eb('0x27')]=_0x5508c1[_0x88eb('0x27')];this[_0x88eb('0x28')]=_0x5508c1['ContactId'];this['ListId']=_0x5508c1['ListId'];this['UserId']=_0x5508c1[_0x88eb('0x29')];this[_0x88eb('0x2a')]=_0x5508c1[_0x88eb('0x2a')];this[_0x88eb('0x2b')]=_0x5508c1['CampaignId'];this['originatecalleridnum']=_0x5508c1[_0x88eb('0x2c')]||'';this['originatecalleridname']=_0x5508c1[_0x88eb('0x2d')]||'';}module[_0x88eb('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 1ff7e1f..89b3634 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b9a=['type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x8b9a,0x94));var _0xa8b9=function(_0x3adc73,_0x2f442a){_0x3adc73=_0x3adc73-0x0;var _0x1c1001=_0x8b9a[_0x3adc73];return _0x1c1001;};'use strict';var util=require(_0xa8b9('0x0'));var _=require(_0xa8b9('0x1'));var moment=require(_0xa8b9('0x2'));function getSeconds(_0x3d4e69,_0x3e4793){var _0x202ec7=moment(_0x3d4e69)[_0xa8b9('0x3')](0x0);var _0x38d3c0=moment(_0x3e4793)[_0xa8b9('0x3')](0x0);return _0x202ec7[_0xa8b9('0x4')](_0x38d3c0,_0xa8b9('0x5'));}function Final(_0x477efc){this[_0xa8b9('0x6')]=_0x477efc[_0xa8b9('0x6')];this[_0xa8b9('0x7')]=_0x477efc[_0xa8b9('0x7')];this[_0xa8b9('0x8')]=_0x477efc[_0xa8b9('0x8')];this[_0xa8b9('0x9')]=_0x477efc['type']===_0xa8b9('0xa')?'queue':_0x477efc[_0xa8b9('0x8')];this[_0xa8b9('0xb')]=_0x477efc[_0xa8b9('0xb')];this[_0xa8b9('0xc')]=_0x477efc[_0xa8b9('0xc')];this['countnoanswerretry']=_0x477efc['countnoanswerretry'];this[_0xa8b9('0xd')]=_0x477efc['countbusyretry']+_0x477efc[_0xa8b9('0xc')]+_0x477efc['countnoanswerretry']+_0x477efc[_0xa8b9('0xe')]+_0x477efc[_0xa8b9('0xf')]+_0x477efc[_0xa8b9('0x10')]+_0x477efc['countmachineretry']+_0x477efc[_0xa8b9('0x11')];this['countnosuchnumberretry']=_0x477efc[_0xa8b9('0xe')];this[_0xa8b9('0xf')]=_0x477efc[_0xa8b9('0xf')];this[_0xa8b9('0x10')]=_0x477efc[_0xa8b9('0x10')];this[_0xa8b9('0x12')]=_0x477efc['countmachineretry'];this[_0xa8b9('0x11')]=_0x477efc['countagentrejectretry'];this['queue']=_0x477efc['queue'];this[_0xa8b9('0x13')]=_0x477efc['calleridname'];this[_0xa8b9('0x14')]=_0x477efc['calleridnum'];this['starttime']=_0x477efc[_0xa8b9('0x15')];this['responsetime']=_0x477efc[_0xa8b9('0x16')];this[_0xa8b9('0x17')]=_0x477efc['responsetime'];this[_0xa8b9('0x18')]=_0x477efc[_0xa8b9('0x18')]||0x0;this[_0xa8b9('0x19')]=_0x477efc[_0xa8b9('0x19')]||0x0;this[_0xa8b9('0x1a')]=_0x477efc['talktime']||0x0;this['callback']=_0x477efc[_0xa8b9('0x1b')];this[_0xa8b9('0x1c')]=_0x477efc[_0xa8b9('0x1c')];this['callbackat']=_0x477efc[_0xa8b9('0x1d')];this[_0xa8b9('0x1e')]=_0x477efc['recallme'];this[_0xa8b9('0x1f')]=_0x477efc[_0xa8b9('0x1f')];this[_0xa8b9('0x20')]=_0x477efc['ListId'];this['UserId']=_0x477efc[_0xa8b9('0x21')];this[_0xa8b9('0x22')]=_0x477efc[_0xa8b9('0x22')];this['CampaignId']=_0x477efc[_0xa8b9('0x23')];this[_0xa8b9('0x24')]=_0x477efc[_0xa8b9('0x24')]||'';this[_0xa8b9('0x25')]=_0x477efc[_0xa8b9('0x25')]||'';}module[_0xa8b9('0x26')]=Final; \ No newline at end of file +var _0xa9ce=['diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds'];(function(_0x552663,_0x558a13){var _0x5541e8=function(_0x2afc24){while(--_0x2afc24){_0x552663['push'](_0x552663['shift']());}};_0x5541e8(++_0x558a13);}(_0xa9ce,0xf9));var _0xea9c=function(_0x38f956,_0x29894b){_0x38f956=_0x38f956-0x0;var _0x529b59=_0xa9ce[_0x38f956];return _0x529b59;};'use strict';var util=require(_0xea9c('0x0'));var _=require('lodash');var moment=require(_0xea9c('0x1'));function getSeconds(_0x35a59b,_0x5a673e){var _0x35dae2=moment(_0x35a59b)[_0xea9c('0x2')](0x0);var _0x4b0d29=moment(_0x5a673e)[_0xea9c('0x2')](0x0);return _0x35dae2[_0xea9c('0x3')](_0x4b0d29,_0xea9c('0x4'));}function Final(_0x1af984){this[_0xea9c('0x5')]=_0x1af984[_0xea9c('0x5')];this[_0xea9c('0x6')]=_0x1af984[_0xea9c('0x6')];this[_0xea9c('0x7')]=_0x1af984[_0xea9c('0x7')];this['campaigntype']=_0x1af984[_0xea9c('0x7')]===_0xea9c('0x8')?'queue':_0x1af984[_0xea9c('0x7')];this['countbusyretry']=_0x1af984[_0xea9c('0x9')];this[_0xea9c('0xa')]=_0x1af984[_0xea9c('0xa')];this[_0xea9c('0xb')]=_0x1af984['countnoanswerretry'];this[_0xea9c('0xc')]=_0x1af984[_0xea9c('0x9')]+_0x1af984[_0xea9c('0xa')]+_0x1af984[_0xea9c('0xb')]+_0x1af984[_0xea9c('0xd')]+_0x1af984['countdropretry']+_0x1af984[_0xea9c('0xe')]+_0x1af984[_0xea9c('0xf')]+_0x1af984[_0xea9c('0x10')];this[_0xea9c('0xd')]=_0x1af984[_0xea9c('0xd')];this[_0xea9c('0x11')]=_0x1af984['countdropretry'];this[_0xea9c('0xe')]=_0x1af984[_0xea9c('0xe')];this['countmachineretry']=_0x1af984[_0xea9c('0xf')];this['countagentrejectretry']=_0x1af984[_0xea9c('0x10')];this['queue']=_0x1af984['queue'];this[_0xea9c('0x12')]=_0x1af984['calleridname'];this['calleridnum']=_0x1af984['calleridnum'];this['starttime']=_0x1af984['starttime'];this[_0xea9c('0x13')]=_0x1af984[_0xea9c('0x13')];this[_0xea9c('0x14')]=_0x1af984[_0xea9c('0x13')];this[_0xea9c('0x15')]=_0x1af984['ringtime']||0x0;this[_0xea9c('0x16')]=_0x1af984[_0xea9c('0x16')]||0x0;this[_0xea9c('0x17')]=_0x1af984[_0xea9c('0x17')]||0x0;this[_0xea9c('0x18')]=_0x1af984[_0xea9c('0x18')];this[_0xea9c('0x19')]=_0x1af984[_0xea9c('0x19')];this[_0xea9c('0x1a')]=_0x1af984[_0xea9c('0x1a')];this['recallme']=_0x1af984[_0xea9c('0x1b')];this[_0xea9c('0x1c')]=_0x1af984[_0xea9c('0x1c')];this['ListId']=_0x1af984[_0xea9c('0x1d')];this[_0xea9c('0x1e')]=_0x1af984[_0xea9c('0x1e')];this[_0xea9c('0x1f')]=_0x1af984[_0xea9c('0x1f')];this[_0xea9c('0x20')]=_0x1af984['CampaignId'];this[_0xea9c('0x21')]=_0x1af984[_0xea9c('0x21')]||'';this[_0xea9c('0x22')]=_0x1af984[_0xea9c('0x22')]||'';}module[_0xea9c('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 78ec149..d358ef1 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacd2=['calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname'];(function(_0x4a848a,_0x2e09e1){var _0x396f47=function(_0x51bd0a){while(--_0x51bd0a){_0x4a848a['push'](_0x4a848a['shift']());}};_0x396f47(++_0x2e09e1);}(_0xacd2,0x1ef));var _0x2acd=function(_0x4da63e,_0x2543f8){_0x4da63e=_0x4da63e-0x0;var _0x52d104=_0xacd2[_0x4da63e];return _0x52d104;};'use strict';var util=require(_0x2acd('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x5506c8,_0x2f3109){var _0x34aebc=moment(_0x5506c8)[_0x2acd('0x1')](0x0);var _0xe949f8=moment(_0x2f3109)[_0x2acd('0x1')](0x0);return _0x34aebc[_0x2acd('0x2')](_0xe949f8,_0x2acd('0x3'));}function Hangup(_0x34eeb7,_0x3aebfe){this[_0x2acd('0x4')]=0x4;this[_0x2acd('0x5')]=_0x2acd('0x6');this[_0x2acd('0x7')]=_0x34eeb7[_0x2acd('0x7')];this[_0x2acd('0x8')]=_0x34eeb7[_0x2acd('0x8')];this[_0x2acd('0x9')]=_0x34eeb7['type']===_0x2acd('0xa')?'queue':_0x34eeb7[_0x2acd('0x8')];this[_0x2acd('0xb')]=_0x34eeb7['countbusyretry'];this[_0x2acd('0xc')]=_0x34eeb7[_0x2acd('0xc')];this['countnoanswerretry']=_0x34eeb7[_0x2acd('0xd')];this['countglobal']=_0x34eeb7['countbusyretry']+_0x34eeb7[_0x2acd('0xc')]+_0x34eeb7[_0x2acd('0xd')]+_0x34eeb7[_0x2acd('0xe')]+_0x34eeb7[_0x2acd('0xf')]+_0x34eeb7[_0x2acd('0x10')]+_0x34eeb7[_0x2acd('0x11')]+_0x34eeb7['countagentrejectretry'];this['countnosuchnumberretry']=_0x34eeb7[_0x2acd('0xe')];this[_0x2acd('0xf')]=_0x34eeb7['countdropretry'];this['countabandonedretry']=_0x34eeb7[_0x2acd('0x10')];this[_0x2acd('0x11')]=_0x34eeb7[_0x2acd('0x11')];this[_0x2acd('0x12')]=_0x34eeb7[_0x2acd('0x12')];this[_0x2acd('0x13')]=_0x3aebfe[_0x2acd('0x13')];this[_0x2acd('0x14')]=_0x34eeb7['name'];this[_0x2acd('0x15')]=_0x34eeb7[_0x2acd('0x16')];this[_0x2acd('0x17')]=_0x34eeb7['starttime'];this[_0x2acd('0x18')]=_0x34eeb7['responsetime'];this['endtime']=moment()[_0x2acd('0x19')](_0x2acd('0x1a'));this[_0x2acd('0x1b')]=getSeconds(_0x34eeb7[_0x2acd('0x18')],_0x34eeb7[_0x2acd('0x17')]);this[_0x2acd('0x1c')]=0x0;this[_0x2acd('0x1d')]=getSeconds(this[_0x2acd('0x1e')],_0x34eeb7[_0x2acd('0x18')]);this['queue']=_0x34eeb7['queue'];this[_0x2acd('0x1f')]='IVR';this[_0x2acd('0x20')]=_0x3aebfe['cause-txt'];this[_0x2acd('0x21')]=_0x34eeb7['callback'];this[_0x2acd('0x22')]=_0x34eeb7[_0x2acd('0x22')];this[_0x2acd('0x23')]=_0x34eeb7['callbackat'];this[_0x2acd('0x24')]=_0x34eeb7[_0x2acd('0x24')];this[_0x2acd('0x25')]=_0x34eeb7[_0x2acd('0x25')];this[_0x2acd('0x26')]=_0x34eeb7[_0x2acd('0x26')];this[_0x2acd('0x27')]=_0x34eeb7['UserId'];this[_0x2acd('0x28')]=_0x34eeb7[_0x2acd('0x28')];this[_0x2acd('0x29')]=_0x34eeb7[_0x2acd('0x29')];}module[_0x2acd('0x2a')]=Hangup; \ No newline at end of file +var _0x7f2b=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','type','campaigntype','outbound','countbusyretry'];(function(_0x493050,_0x49ead2){var _0x1a555b=function(_0x4d7f16){while(--_0x4d7f16){_0x493050['push'](_0x493050['shift']());}};_0x1a555b(++_0x49ead2);}(_0x7f2b,0xcb));var _0xb7f2=function(_0x3b4f6b,_0x40904f){_0x3b4f6b=_0x3b4f6b-0x0;var _0x3448b8=_0x7f2b[_0x3b4f6b];return _0x3448b8;};'use strict';var util=require(_0xb7f2('0x0'));var _=require(_0xb7f2('0x1'));var moment=require('moment');function getSeconds(_0x4f1afe,_0x2817c6){var _0x566738=moment(_0x4f1afe)[_0xb7f2('0x2')](0x0);var _0x7c623d=moment(_0x2817c6)['milliseconds'](0x0);return _0x566738[_0xb7f2('0x3')](_0x7c623d,_0xb7f2('0x4'));}function Hangup(_0x31230f,_0x35e02c){this[_0xb7f2('0x5')]=0x4;this[_0xb7f2('0x6')]=_0xb7f2('0x7');this['scheduledat']=_0x31230f['scheduledat'];this[_0xb7f2('0x8')]=_0x31230f[_0xb7f2('0x8')];this[_0xb7f2('0x9')]=_0x31230f[_0xb7f2('0x8')]===_0xb7f2('0xa')?'queue':_0x31230f[_0xb7f2('0x8')];this[_0xb7f2('0xb')]=_0x31230f[_0xb7f2('0xb')];this[_0xb7f2('0xc')]=_0x31230f['countcongestionretry'];this['countnoanswerretry']=_0x31230f[_0xb7f2('0xd')];this[_0xb7f2('0xe')]=_0x31230f[_0xb7f2('0xb')]+_0x31230f[_0xb7f2('0xc')]+_0x31230f[_0xb7f2('0xd')]+_0x31230f['countnosuchnumberretry']+_0x31230f[_0xb7f2('0xf')]+_0x31230f[_0xb7f2('0x10')]+_0x31230f[_0xb7f2('0x11')]+_0x31230f[_0xb7f2('0x12')];this['countnosuchnumberretry']=_0x31230f[_0xb7f2('0x13')];this['countdropretry']=_0x31230f[_0xb7f2('0xf')];this[_0xb7f2('0x10')]=_0x31230f[_0xb7f2('0x10')];this[_0xb7f2('0x11')]=_0x31230f[_0xb7f2('0x11')];this[_0xb7f2('0x12')]=_0x31230f[_0xb7f2('0x12')];this[_0xb7f2('0x14')]=_0x35e02c[_0xb7f2('0x14')];this['calleridname']=_0x31230f[_0xb7f2('0x15')];this[_0xb7f2('0x16')]=_0x31230f[_0xb7f2('0x17')];this[_0xb7f2('0x18')]=_0x31230f['starttime'];this[_0xb7f2('0x19')]=_0x31230f[_0xb7f2('0x19')];this[_0xb7f2('0x1a')]=moment()[_0xb7f2('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb7f2('0x1c')]=getSeconds(_0x31230f[_0xb7f2('0x19')],_0x31230f[_0xb7f2('0x18')]);this[_0xb7f2('0x1d')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x31230f[_0xb7f2('0x19')]);this[_0xb7f2('0x1e')]=_0x31230f[_0xb7f2('0x1e')];this[_0xb7f2('0x1f')]=_0xb7f2('0x20');this[_0xb7f2('0x21')]=_0x35e02c[_0xb7f2('0x22')];this[_0xb7f2('0x23')]=_0x31230f[_0xb7f2('0x23')];this['callbackuniqueid']=_0x31230f[_0xb7f2('0x24')];this[_0xb7f2('0x25')]=_0x31230f[_0xb7f2('0x25')];this['recallme']=_0x31230f[_0xb7f2('0x26')];this[_0xb7f2('0x27')]=_0x31230f[_0xb7f2('0x27')];this['ListId']=_0x31230f['ListId'];this[_0xb7f2('0x28')]=_0x31230f[_0xb7f2('0x28')];this[_0xb7f2('0x29')]=_0x31230f['VoiceQueueId'];this[_0xb7f2('0x2a')]=_0x31230f[_0xb7f2('0x2a')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 1d69aa8..77c46ac 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa2ae=['type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0xa2ae,0x95));var _0xea2a=function(_0x98459f,_0x4dfb55){_0x98459f=_0x98459f-0x0;var _0x128f94=_0xa2ae[_0x98459f];return _0x128f94;};'use strict';var util=require(_0xea2a('0x0'));var _=require(_0xea2a('0x1'));var moment=require('moment');function getSeconds(_0x8db3d7,_0x3f62e2){var _0x408dfb=moment(_0x8db3d7)[_0xea2a('0x2')](0x0);var _0x568b94=moment(_0x3f62e2)[_0xea2a('0x2')](0x0);return _0x408dfb[_0xea2a('0x3')](_0x568b94,_0xea2a('0x4'));}function History(_0x435f1d){this[_0xea2a('0x5')]=_0x435f1d[_0xea2a('0x5')];this[_0xea2a('0x6')]=_0x435f1d[_0xea2a('0x6')]||undefined;this[_0xea2a('0x7')]=_0x435f1d[_0xea2a('0x7')];this[_0xea2a('0x8')]=_0x435f1d[_0xea2a('0x7')]==='outbound'?_0xea2a('0x9'):_0x435f1d[_0xea2a('0x7')];this[_0xea2a('0xa')]=_0x435f1d[_0xea2a('0xa')];this[_0xea2a('0xb')]=_0x435f1d[_0xea2a('0xb')];this[_0xea2a('0xc')]=_0x435f1d[_0xea2a('0xc')];this[_0xea2a('0xd')]=_0x435f1d[_0xea2a('0xa')]+_0x435f1d['countcongestionretry']+_0x435f1d[_0xea2a('0xc')]+_0x435f1d[_0xea2a('0xe')]+_0x435f1d[_0xea2a('0xf')]+_0x435f1d[_0xea2a('0x10')]+_0x435f1d[_0xea2a('0x11')]+_0x435f1d[_0xea2a('0x12')];this[_0xea2a('0xe')]=_0x435f1d['countnosuchnumberretry'];this[_0xea2a('0xf')]=_0x435f1d['countdropretry'];this[_0xea2a('0x10')]=_0x435f1d['countabandonedretry'];this[_0xea2a('0x11')]=_0x435f1d[_0xea2a('0x11')];this['countagentrejectretry']=_0x435f1d[_0xea2a('0x12')];this[_0xea2a('0x9')]=_0x435f1d[_0xea2a('0x9')];this[_0xea2a('0x13')]=_0x435f1d[_0xea2a('0x14')];this['calleridnum']=_0x435f1d[_0xea2a('0x15')];this[_0xea2a('0x16')]=_0x435f1d[_0xea2a('0x16')];this[_0xea2a('0x17')]=_0x435f1d[_0xea2a('0x17')];this[_0xea2a('0x18')]=_0x435f1d[_0xea2a('0x17')];this[_0xea2a('0x19')]=getSeconds(_0x435f1d[_0xea2a('0x17')],_0x435f1d[_0xea2a('0x16')]);this[_0xea2a('0x1a')]=0x0;this[_0xea2a('0x1b')]=0x0;this[_0xea2a('0x1c')]=_0x435f1d[_0xea2a('0x1c')];this[_0xea2a('0x1d')]=_0x435f1d[_0xea2a('0x1d')];this[_0xea2a('0x1e')]=_0x435f1d[_0xea2a('0x1e')];this['recallme']=_0x435f1d[_0xea2a('0x1f')];this[_0xea2a('0x20')]=_0x435f1d['ContactId'];this['ListId']=_0x435f1d[_0xea2a('0x21')];this[_0xea2a('0x22')]=_0x435f1d[_0xea2a('0x22')];this[_0xea2a('0x23')]=_0x435f1d[_0xea2a('0x23')];this[_0xea2a('0x24')]=_0x435f1d[_0xea2a('0x24')];this['originatecalleridnum']=_0x435f1d['originatecalleridnum']||'';this[_0xea2a('0x25')]=_0x435f1d['originatecalleridname']||'';}module[_0xea2a('0x26')]=History; \ No newline at end of file +var _0x7bbd=['countmachineretry','queue','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry'];(function(_0x596119,_0x2599a7){var _0xaaff6f=function(_0x1accb1){while(--_0x1accb1){_0x596119['push'](_0x596119['shift']());}};_0xaaff6f(++_0x2599a7);}(_0x7bbd,0x11f));var _0xd7bb=function(_0x1ff2c8,_0x481178){_0x1ff2c8=_0x1ff2c8-0x0;var _0x55817a=_0x7bbd[_0x1ff2c8];return _0x55817a;};'use strict';var util=require(_0xd7bb('0x0'));var _=require(_0xd7bb('0x1'));var moment=require(_0xd7bb('0x2'));function getSeconds(_0xdbd23a,_0x4d6483){var _0x525a91=moment(_0xdbd23a)['milliseconds'](0x0);var _0x4b7949=moment(_0x4d6483)[_0xd7bb('0x3')](0x0);return _0x525a91[_0xd7bb('0x4')](_0x4b7949,'seconds');}function History(_0x26925e){this[_0xd7bb('0x5')]=_0x26925e[_0xd7bb('0x5')];this[_0xd7bb('0x6')]=_0x26925e[_0xd7bb('0x6')]||undefined;this[_0xd7bb('0x7')]=_0x26925e[_0xd7bb('0x7')];this[_0xd7bb('0x8')]=_0x26925e[_0xd7bb('0x7')]===_0xd7bb('0x9')?'queue':_0x26925e[_0xd7bb('0x7')];this[_0xd7bb('0xa')]=_0x26925e[_0xd7bb('0xa')];this[_0xd7bb('0xb')]=_0x26925e['countcongestionretry'];this[_0xd7bb('0xc')]=_0x26925e[_0xd7bb('0xc')];this['countglobal']=_0x26925e['countbusyretry']+_0x26925e[_0xd7bb('0xb')]+_0x26925e['countnoanswerretry']+_0x26925e[_0xd7bb('0xd')]+_0x26925e['countdropretry']+_0x26925e[_0xd7bb('0xe')]+_0x26925e['countmachineretry']+_0x26925e[_0xd7bb('0xf')];this[_0xd7bb('0xd')]=_0x26925e[_0xd7bb('0xd')];this['countdropretry']=_0x26925e[_0xd7bb('0x10')];this['countabandonedretry']=_0x26925e[_0xd7bb('0xe')];this[_0xd7bb('0x11')]=_0x26925e['countmachineretry'];this[_0xd7bb('0xf')]=_0x26925e[_0xd7bb('0xf')];this[_0xd7bb('0x12')]=_0x26925e[_0xd7bb('0x12')];this[_0xd7bb('0x13')]=_0x26925e['name'];this[_0xd7bb('0x14')]=_0x26925e[_0xd7bb('0x15')];this[_0xd7bb('0x16')]=_0x26925e[_0xd7bb('0x16')];this[_0xd7bb('0x17')]=_0x26925e[_0xd7bb('0x17')];this[_0xd7bb('0x18')]=_0x26925e[_0xd7bb('0x17')];this[_0xd7bb('0x19')]=getSeconds(_0x26925e[_0xd7bb('0x17')],_0x26925e[_0xd7bb('0x16')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0xd7bb('0x1a')]=_0x26925e[_0xd7bb('0x1a')];this['callbackuniqueid']=_0x26925e[_0xd7bb('0x1b')];this[_0xd7bb('0x1c')]=_0x26925e[_0xd7bb('0x1c')];this[_0xd7bb('0x1d')]=_0x26925e[_0xd7bb('0x1d')];this[_0xd7bb('0x1e')]=_0x26925e['ContactId'];this[_0xd7bb('0x1f')]=_0x26925e[_0xd7bb('0x1f')];this['UserId']=_0x26925e[_0xd7bb('0x20')];this[_0xd7bb('0x21')]=_0x26925e[_0xd7bb('0x21')];this[_0xd7bb('0x22')]=_0x26925e[_0xd7bb('0x22')];this[_0xd7bb('0x23')]=_0x26925e[_0xd7bb('0x23')]||'';this[_0xd7bb('0x24')]=_0x26925e['originatecalleridname']||'';}module[_0xd7bb('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 3afd93c..1c3247a 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 _0x8a3d=['\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','getQueue','callProgressDetecting','[callProgressDetecting]\x20','countcongestionretry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','dialNoAnswerRetryFrequency','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperBlack','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','optionPredictive','startPredictive','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','hangup','syncHangup','newexten','syncVarSet','queuemember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','message','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','undefined','sequence','isNil','Action','channel','No\x20such\x20channel','queue','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','catch','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','status','reachable','unmonitored','uniqueId','variable','exten','dialAMDActive','value','HANGUP','uniqueid','state','statedesc','HangupInAMD','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnoanswerretry','dialMachineMaxRetry','reason\x2019\x20machine....','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AGI','[syncHangupIvr]','cause-txt','membername','Unknow','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','dropreason','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','syncNewExten','syncQueueMember','actionid','strategy','locked','paused','stateinterface','push','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','content','indexOf','true','command','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE'];(function(_0x5a4d67,_0x1196aa){var _0x4d1777=function(_0x362b43){while(--_0x362b43){_0x5a4d67['push'](_0x5a4d67['shift']());}};_0x4d1777(++_0x1196aa);}(_0x8a3d,0xa7));var _0xd8a3=function(_0x260819,_0x2636a4){_0x260819=_0x260819-0x0;var _0x28cbd4=_0x8a3d[_0x260819];return _0x28cbd4;};'use strict';var util=require(_0xd8a3('0x0'));var _=require(_0xd8a3('0x1'));var BPromise=require(_0xd8a3('0x2'));var uuid=require(_0xd8a3('0x3'));var moment=require(_0xd8a3('0x4'));var rr=require('rr');var md5=require(_0xd8a3('0x5'));var Redis=require(_0xd8a3('0x6'));var ut=require('../preview/util/util');var config=require(_0xd8a3('0x7'));var logger=require(_0xd8a3('0x8'))(_0xd8a3('0x9'));var loggerBooked=require(_0xd8a3('0x8'))(_0xd8a3('0xa'));var loggerPredictive=require(_0xd8a3('0x8'))(_0xd8a3('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0xd8a3('0xc'));var loggerSyncQueueSummary=require(_0xd8a3('0x8'))(_0xd8a3('0xd'));var ami=require(_0xd8a3('0xe'));config['redis']=_['defaults'](config[_0xd8a3('0xf')],{'host':_0xd8a3('0x10'),'port':0x18eb});var io=require(_0xd8a3('0x11'))(new Redis(config[_0xd8a3('0xf')]));var cmHopper=require(_0xd8a3('0x12'));var cmHopperHistory=require(_0xd8a3('0x13'));var cmHopperFinal=require(_0xd8a3('0x14'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0xd8a3('0x15'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require('./history');var Final=require(_0xd8a3('0x16'));var AgentComplete=require(_0xd8a3('0x17'));var QueueCallerAbandon=require(_0xd8a3('0x18'));var Hangup=require(_0xd8a3('0x19'));var ipAgi=process[_0xd8a3('0x1a')][_0xd8a3('0x1b')]||'127.0.0.1';var strategy={'rrmemory':_0xd8a3('0x1c'),'roundrobin':_0xd8a3('0x1d')};var Sequence=function(){};Sequence[_0xd8a3('0x1e')][_0xd8a3('0x1f')]=function(_0x344802){this['tail']=this[_0xd8a3('0x20')]?this[_0xd8a3('0x20')][_0xd8a3('0x21')](_0x344802):_0x344802();};function Dialer(_0x39ccdc,_0x13494d){this['sequence']=new Sequence();this[_0xd8a3('0x22')]=_0x13494d;this[_0xd8a3('0x23')]=_0x39ccdc['voiceQueues'];this[_0xd8a3('0x24')]=_0x39ccdc['campaigns'];this['agents']=_0x39ccdc[_0xd8a3('0x25')];this[_0xd8a3('0x26')]=_0x39ccdc[_0xd8a3('0x26')];this[_0xd8a3('0x27')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0xd8a3('0x28')]={};this['contactsId']={};this['uniqueId']={};this[_0xd8a3('0x29')]={};this[_0xd8a3('0x2a')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0xd8a3('0x2b')]={};this['queueBookedRR']={};ami['on'](_0xd8a3('0x2c'),this[_0xd8a3('0x2d')][_0xd8a3('0x2e')](this));ami['on'](_0xd8a3('0x2f'),this[_0xd8a3('0x30')][_0xd8a3('0x2e')](this));ami['on'](_0xd8a3('0x31'),this[_0xd8a3('0x32')][_0xd8a3('0x2e')](this));ami['on']('agentcomplete',this[_0xd8a3('0x33')]['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary']['bind'](this));ami['on'](_0xd8a3('0x34'),this[_0xd8a3('0x35')]['bind'](this));ami['on'](_0xd8a3('0x36'),this['syncNewExten'][_0xd8a3('0x2e')](this));ami['on']('varset',this[_0xd8a3('0x37')][_0xd8a3('0x2e')](this));ami['on'](_0xd8a3('0x38'),this['syncQueueMember'][_0xd8a3('0x2e')](this));ami['on']('queuestatuscomplete',this[_0xd8a3('0x39')][_0xd8a3('0x2e')](this));this[_0xd8a3('0x3a')]();this[_0xd8a3('0x3b')]();}function isNotNull(_0x44d33e){return _0x44d33e!==null&&!_['isUndefined'](_0x44d33e);}function checkIsLoggedIn(_0x17e5fe,_0x1e3da2){return function(){if(_0x1e3da2<=0x0){_0x17e5fe['message']=_0xd8a3('0x3c');throw _0x17e5fe[_0xd8a3('0x3d')]+_0xd8a3('0x3e');}};}function isActive(_0x1577f8){return _0x1577f8;}function checkIsActive(_0x3b42fc,_0x13f519){return function(){if(!isActive(_0x13f519)){_0x3b42fc['message']='NOT_ACTIVE';throw _0x3b42fc[_0xd8a3('0x3d')]+_0xd8a3('0x3f');}};}function checkInterval(_0x5bc597){return function(){if(!isNotNull(_0x5bc597[_0xd8a3('0x40')])){_0x5bc597[_0xd8a3('0x41')]=_0xd8a3('0x42');throw _0x5bc597[_0xd8a3('0x3d')]+_0xd8a3('0x43');}if(!isNotNull(_0x5bc597[_0xd8a3('0x40')][_0xd8a3('0x44')])){_0x5bc597[_0xd8a3('0x41')]=_0xd8a3('0x42');throw _0x5bc597[_0xd8a3('0x3d')]+_0xd8a3('0x43');}if(!isNotNull(_['isEmpty'](_0x5bc597[_0xd8a3('0x40')]['Intervals']))){_0x5bc597['message']=_0xd8a3('0x42');throw _0x5bc597[_0xd8a3('0x3d')]+_0xd8a3('0x43');}};}function msgResponse(_0x338a55,_0x5adc38,_0x5a0c14){return{'action':_0x338a55,'response':_0x5adc38,'message':_0x5a0c14,'stack':_0x5a0c14};}function myreject(_0x1bf8e6){return function(_0x4aa329){return _0x1bf8e6(msgResponse(_0xd8a3('0x45'),_0xd8a3('0x46'),JSON[_0xd8a3('0x47')](_0x4aa329)));};}function getSeconds(_0x590d22,_0x78d155){var _0x58b87c=moment(_0x590d22)[_0xd8a3('0x48')](0x0);var _0x16e48c=moment(_0x78d155)[_0xd8a3('0x48')](0x0);return _0x58b87c[_0xd8a3('0x49')](_0x16e48c,_0xd8a3('0x4a'));}function emit(_0x3e4420,_0x2f7a72,_0x5a93e4){io['to'](_0x3e4420)[_0xd8a3('0x4b')](_0x2f7a72,_0x5a93e4);}function emitVoiceQueueSummary(_0x372ac3){if(_0x372ac3[_0xd8a3('0x4c')]===_0xd8a3('0x4d')){var _0xa04597={'id':_0x372ac3['id'],'name':_0x372ac3[_0xd8a3('0x3d')],'strategy':_0x372ac3['strategy'],'answered':_0x372ac3[_0xd8a3('0x4e')],'available':_0x372ac3[_0xd8a3('0x4f')],'loggedIn':_0x372ac3[_0xd8a3('0x50')],'pTalking':_0x372ac3[_0xd8a3('0x51')],'sumBillable':_0x372ac3['sumBillable'],'sumDuration':_0x372ac3[_0xd8a3('0x52')],'sumHoldTime':_0x372ac3[_0xd8a3('0x53')]||0x0,'talking':_0x372ac3[_0xd8a3('0x54')],'total':_0x372ac3[_0xd8a3('0x55')],'type':_0x372ac3['type'],'unmanaged':_0x372ac3[_0xd8a3('0x56')],'abandoned':_0x372ac3[_0xd8a3('0x57')],'waiting':_0x372ac3[_0xd8a3('0x58')],'loggedInDb':_0x372ac3['loggedInDb'],'dialActive':_0x372ac3['dialActive'],'dialMethod':_0x372ac3[_0xd8a3('0x59')],'dialOriginateCallerIdName':_0x372ac3['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x372ac3[_0xd8a3('0x5a')],'dialOriginateTimeout':_0x372ac3[_0xd8a3('0x5b')],'dialPrefix':_0x372ac3[_0xd8a3('0x5c')],'outboundAnswerAgiCallsDay':_0x372ac3[_0xd8a3('0x5d')],'outboundAnswerCallsDay':_0x372ac3[_0xd8a3('0x5e')],'outboundBlacklistCallsDay':_0x372ac3[_0xd8a3('0x5f')],'outboundBusyCallsDay':_0x372ac3[_0xd8a3('0x60')],'outboundCongestionCallsDay':_0x372ac3[_0xd8a3('0x61')],'outboundDropCallsDayACS':_0x372ac3[_0xd8a3('0x62')],'outboundDropCallsDayCallersExit':_0x372ac3[_0xd8a3('0x63')],'outboundDropCallsDayTimeout':_0x372ac3[_0xd8a3('0x64')],'outboundNoAnswerCallsDay':_0x372ac3[_0xd8a3('0x65')],'outboundNoSuchCallsDay':_0x372ac3[_0xd8a3('0x66')],'outboundOriginateFailureCallsDay':_0x372ac3['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x372ac3['outboundReCallsDay'],'outboundRejectCallsDay':_0x372ac3['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x372ac3[_0xd8a3('0x67')],'predictiveIntervalAnsweredCalls':_0x372ac3[_0xd8a3('0x68')],'predictiveIntervalAvgHoldtime':_0x372ac3[_0xd8a3('0x69')],'predictiveIntervalAvgTalktime':_0x372ac3[_0xd8a3('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x372ac3[_0xd8a3('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x372ac3[_0xd8a3('0x6c')],'predictiveIntervalErlangCalls':_0x372ac3[_0xd8a3('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x372ac3[_0xd8a3('0x6e')],'predictiveIntervalHitRate':_0x372ac3[_0xd8a3('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x372ac3['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x372ac3[_0xd8a3('0x70')],'predictiveIntervalAvailable':_0x372ac3[_0xd8a3('0x71')],'predictiveIntervalTotalCalls':_0x372ac3[_0xd8a3('0x72')],'message':_0x372ac3['message'],'originated':_0x372ac3[_0xd8a3('0x73')],'erlangCalls':_0x372ac3['erlangCalls'],'erlangCallToSecond':_0x372ac3[_0xd8a3('0x74')],'erlangAbandonmentRate':_0x372ac3[_0xd8a3('0x75')],'erlangBusyFactor':_0x372ac3[_0xd8a3('0x76')],'startPredictive':_0x372ac3['startPredictive'],'startProgressive':_0x372ac3[_0xd8a3('0x77')]};if(_0x372ac3[_0xd8a3('0x78')]){_0xa04597[_0xd8a3('0x78')]={'id':_0x372ac3[_0xd8a3('0x78')]['id'],'name':_0x372ac3[_0xd8a3('0x78')]['name'],'active':_0x372ac3[_0xd8a3('0x78')][_0xd8a3('0x79')],'callerid':_0x372ac3['Trunk'][_0xd8a3('0x7a')]};}if(_0x372ac3['Interval']){_0xa04597[_0xd8a3('0x40')]={'id':_0x372ac3[_0xd8a3('0x40')]['id'],'name':_0x372ac3['Interval'][_0xd8a3('0x3d')]};}var _0x1b8e8a=md5(JSON[_0xd8a3('0x47')](_0xa04597));if(_0x372ac3['md5']!==_0x1b8e8a){_0x372ac3['md5']=_0x1b8e8a;emit(util[_0xd8a3('0x7b')](_0xd8a3('0x7c'),_0xa04597['name']),_0xd8a3('0x7d'),_0xa04597);}}}function emitCampaignSummary(_0x464002){if(_0x464002[_0xd8a3('0x4c')]==='ivr'){emit(util[_0xd8a3('0x7b')](_0xd8a3('0x7e'),_0x464002['name']),'campaign:save',_0x464002);}}function checkGetDataPredictive(_0x5bdb3c){if(isNotNull(_0x5bdb3c)&&!_[_0xd8a3('0x7f')](_0x5bdb3c)){loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x81'));loggerPredictive[_0xd8a3('0x80')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5bdb3c[_0xd8a3('0x72')]);loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x82'),_0x5bdb3c[_0xd8a3('0x68')]);loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x83'),_0x5bdb3c[_0xd8a3('0x6c')]);loggerPredictive['info'](_0xd8a3('0x84'),_0x5bdb3c[_0xd8a3('0x6b')]);loggerPredictive[_0xd8a3('0x80')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5bdb3c[_0xd8a3('0x69')]);loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x85'),_0x5bdb3c[_0xd8a3('0x6a')]);loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x86'));if(_0x5bdb3c[_0xd8a3('0x72')]>0x0){if(!_[_0xd8a3('0x87')](_0x5bdb3c['predictiveIntervalAvgTalktime'])&&_0x5bdb3c[_0xd8a3('0x6a')]>0x0){return!![];}loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x88'));if(!_[_0xd8a3('0x87')](_0x5bdb3c['predictiveIntervalAvgHoldtime'])&&_0x5bdb3c[_0xd8a3('0x69')]>0x0){return!![];}loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x89'));}else{loggerPredictive['info'](_0xd8a3('0x8a'));}}else{loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x8b'));}return![];}function mergeDataErlangB(_0x2f9b45){return function(_0x2ee450){loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x8c'));loggerPredictive['info'](_0xd8a3('0x8d'),_0x2ee450[_0xd8a3('0x8e')]);loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x8f'),_0x2ee450[_0xd8a3('0x74')]);loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x90'),_0x2ee450[_0xd8a3('0x75')]);loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x91'),_0x2ee450[_0xd8a3('0x76')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ee450[_0xd8a3('0x75')]);loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x86'));_[_0xd8a3('0x92')](_0x2f9b45,_0x2ee450);};}function getDiff(_0x17ab0c){var _0x49347a=moment()['milliseconds'](0x0);var _0x2e5022=moment(_0x17ab0c)[_0xd8a3('0x48')](0x0);return _0x49347a[_0xd8a3('0x49')](_0x2e5022,_0xd8a3('0x4a'));}function ifInterval(_0x2c9ecd,_0x47805a){if(_['isUndefined'](_0x47805a)){return![];}return getDiff(_0x47805a)<_0x2c9ecd*0x3c;}function freeVariablesPredictive(_0x4a1b80){if(isNotNull(_0x4a1b80)){if(!_['isUndefined'](_0x4a1b80[_0xd8a3('0x77')])){_0x4a1b80['startProgressive']=undefined;loggerPredictive['info'](_0x4a1b80[_0xd8a3('0x3d')],_0xd8a3('0x93'));}if(!_[_0xd8a3('0x87')](_0x4a1b80[_0xd8a3('0x2a')])){_0x4a1b80[_0xd8a3('0x2a')]=undefined;loggerPredictive['info'](_0x4a1b80[_0xd8a3('0x3d')],_0xd8a3('0x94'));}if(!_['isUndefined'](_0x4a1b80['handlePredictive'])){clearInterval(_0x4a1b80[_0xd8a3('0x95')]);_0x4a1b80[_0xd8a3('0x95')]=undefined;loggerPredictive[_0xd8a3('0x80')](_0x4a1b80['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x371512,_0x3ea53f){if(_0x3ea53f===0x0){return 0x0;}var _0x16c9e8=0x1;for(var _0x48b67a=0x1;_0x48b67a<=_0x3ea53f;_0x48b67a+=0x1){_0x16c9e8=0x1+_0x16c9e8*_0x48b67a/_0x371512;}return 0x1/_0x16c9e8;}function isVoiceQueueOutbound(_0x37c7cb){return _0x37c7cb==='outbound';}function isNotPreview(_0x3b8087){return _0x3b8087!==_0xd8a3('0x22');}function isCampaignIvr(_0x2877aa){return _0x2877aa===_0xd8a3('0x96');}function getCallerId(_0x26efe5,_0x2cd849,_0x549f12){if(!_[_0xd8a3('0x87')](_0x549f12)&&typeof _0x549f12===_0xd8a3('0x97')&&!_[_0xd8a3('0x7f')](_0x549f12)){if(!_[_0xd8a3('0x87')](_0x2cd849)&&typeof _0x2cd849==='string'&&!_['isEmpty'](_0x2cd849)){return util[_0xd8a3('0x7b')](_0xd8a3('0x98'),_0x2cd849,_0x549f12);}return util['format']('\x22%s\x22\x20<%s>',_0x549f12,_0x549f12);}if(!_[_0xd8a3('0x87')](_0x26efe5)&&typeof _0x26efe5==='string'&&!_[_0xd8a3('0x7f')](_0x26efe5)){return _0x26efe5;}return _0xd8a3('0x99');}function loggerCatchQueueSummary(_0x3989c5,_0x3db3f){return function(_0x18dece){freeVariablesPredictive(_0x3db3f);emitVoiceQueueSummary(_0x3db3f);emitCampaignSummary(_0x3db3f);loggerSyncQueueSummary[_0xd8a3('0x9a')](_0x3989c5,util[_0xd8a3('0x9b')](_0x18dece,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3f1729,_0x5b389f){return function(_0x52cd37){loggerPredictive[_0xd8a3('0x9a')](_0x5b389f['name'],_0x3f1729);loggerPredictive[_0xd8a3('0x9a')](_0x52cd37[_0xd8a3('0x9c')]);freeVariablesPredictive(_0x5b389f);};}function loggerCatch(_0x56340f){return function(_0x2597ac){logger['error'](_0x56340f,util['inspect'](_0x2597ac,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xea5e07){return _0xea5e07&&!_[_0xd8a3('0x87')](_0xea5e07)&&_0xea5e07[_0xd8a3('0x9d')]>0x0;}function decremetOriginate(_0x543f44){if(!_['isUndefined'](_0x543f44)&&_0x543f44!==null){if(typeof _0x543f44[_0xd8a3('0x73')]!=='undefined'){if(_0x543f44[_0xd8a3('0x73')]>0x0){_0x543f44[_0xd8a3('0x73')]-=0x1;}else{logger[_0xd8a3('0x9a')](_0xd8a3('0x9e'));}}}else{logger[_0xd8a3('0x9a')](_0xd8a3('0x9f'));}}function checkContactLowerLimitOriginate(_0x5b0612,_0x577141,_0x41739a){if(_0x577141>_0x41739a){for(var _0x54289a=0x0;_0x54289a<_0x577141-_0x41739a;_0x54289a+=0x1){decremetOriginate(_0x5b0612);}}}function loggerGetContactDialer(_0x5a36b2,_0x28a61b,_0x379f1b){return function(_0x4856d3){checkContactLowerLimitOriginate(_0x28a61b,_0x379f1b,0x0);logger[_0xd8a3('0x9a')](_0x5a36b2,util['inspect'](_0x4856d3,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5854a2){return function(_0x38039b){if(isNotNull(_0x38039b)&&isNotNull(_0x38039b[0x0])){if(_0x38039b[0x0][_0xd8a3('0xa0')]>0x0){_0x5854a2[_0xd8a3('0x41')]='RESCHEDULED_CONTACTS';logger[_0xd8a3('0x80')](_0xd8a3('0xa1')+_0x5854a2[_0xd8a3('0x3d')],_0x38039b[0x0][_0xd8a3('0xa0')],_0xd8a3('0xa2'));}else{_0x5854a2[_0xd8a3('0x41')]=_0xd8a3('0xa3');logger[_0xd8a3('0x80')](_0xd8a3('0xa4')+_0x5854a2[_0xd8a3('0x3d')]);}}};}function notSendMessagesQueue(_0x10d5ba){if(_0x10d5ba[_0xd8a3('0xa5')]){freeVariablesPredictive(_0x10d5ba);if(_0x10d5ba[_0xd8a3('0x73')]===0x0&&_0x10d5ba[_0xd8a3('0x54')]===0x0&&_0x10d5ba[_0xd8a3('0x58')]===0x0&&(_0x10d5ba[_0xd8a3('0x51')]||0x0)===0x0){_0x10d5ba[_0xd8a3('0xa5')]=![];_0x10d5ba[_0xd8a3('0x4f')]=0x0;_0x10d5ba[_0xd8a3('0x41')]=_0xd8a3('0xa6');loggerSyncQueueSummary[_0xd8a3('0x9a')](_0xd8a3('0xa7'),_0x10d5ba[_0xd8a3('0x3d')],_0xd8a3('0xa8'));}else{_0x10d5ba['message']=_0xd8a3('0xa9');loggerSyncQueueSummary[_0xd8a3('0x9a')](_0xd8a3('0xa7'),_0x10d5ba[_0xd8a3('0x3d')],'is\x20disactive');}emitVoiceQueueSummary(_0x10d5ba);}}function notSendMessagesCampaign(_0x5e6b8b){if(_0x5e6b8b['sendMessageOneNotActive']){if(_0x5e6b8b[_0xd8a3('0x73')]===0x0){_0x5e6b8b[_0xd8a3('0xa5')]=![];_0x5e6b8b[_0xd8a3('0x41')]=_0xd8a3('0xa6');loggerSyncQueueSummary[_0xd8a3('0x9a')](_0xd8a3('0xaa'),_0x5e6b8b[_0xd8a3('0x3d')],_0xd8a3('0xa8'));}else{_0x5e6b8b[_0xd8a3('0x41')]='IS_DISACTIVED';loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5e6b8b[_0xd8a3('0x3d')],_0xd8a3('0xab'));}emitCampaignSummary(_0x5e6b8b);}}function createObjHistory(_0x2b1333,_0xb15f90,_0x39d40e,_0x456743,_0x2266f5){_0x2b1333[_0xd8a3('0x41')]=_0x39d40e;var _0x108a18=new Action(_0x2b1333,_0xb15f90);var _0x2599c5=new History(_0x108a18);_0x2599c5['state']=_0x456743;_0x2599c5['statedesc']=_0x2266f5;_0x2599c5[_0xd8a3('0xac')]=_0x108a18[_0xd8a3('0xad')];return _0x2599c5;}Dialer[_0xd8a3('0x1e')][_0xd8a3('0x3b')]=function(){var _0x292ead=this;setInterval(function(){_0x292ead[_0xd8a3('0xae')](_0x292ead['uniqueId'],_0xd8a3('0xaf'));_0x292ead[_0xd8a3('0xae')](_0x292ead[_0xd8a3('0x28')],_0xd8a3('0xb0'));},0x32c8);};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xae')]=function(_0x333eaa,_0x435705){var _0xbed040=this;for(var _0x3e9d8f in _0x333eaa){if(typeof _0x333eaa[_0x3e9d8f]!==_0xd8a3('0xb1')){this[_0xd8a3('0xb2')][_0xd8a3('0x1f')](function(){if(!_[_0xd8a3('0xb3')](_0x333eaa[_0x3e9d8f])){return ami[_0xd8a3('0xb4')]({'action':'status','channel':_0x333eaa[_0x3e9d8f][_0xd8a3('0xb5')]})['catch'](function(_0x1df39a){if(_0x1df39a[_0xd8a3('0x41')]===_0xd8a3('0xb6')){setTimeout(function(){if(_0x333eaa[_0x3e9d8f]&&_0x333eaa[_0x3e9d8f]['type']!==_0xd8a3('0x96')){_0xbed040['updateOriginated'](_0xbed040['voiceQueues'][_0x333eaa[_0x3e9d8f][_0xd8a3('0xb7')]]);logger[_0xd8a3('0x9a')]('[Dialer][checkChannel]',_0x435705,_0x3e9d8f,_0x333eaa[_0x3e9d8f][_0xd8a3('0xb7')]);delete _0x333eaa[_0x3e9d8f];}if(_0x333eaa[_0x3e9d8f]&&_0x333eaa[_0x3e9d8f]['type']===_0xd8a3('0x96')){_0xbed040[_0xd8a3('0xb8')](_0xbed040[_0xd8a3('0x24')][_0x333eaa[_0x3e9d8f][_0xd8a3('0xb7')]]);logger[_0xd8a3('0x9a')](_0xd8a3('0xb9'),_0x435705,_0x3e9d8f,_0x333eaa[_0x3e9d8f][_0xd8a3('0xb7')]);delete _0x333eaa[_0x3e9d8f];}},0x2328);}});}});}}};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xba')]=function(_0x1cc76d){return BPromise[_0xd8a3('0xbb')]()[_0xd8a3('0xbc')](cmHopper[_0xd8a3('0xba')](_0x1cc76d))['catch'](loggerCatch(_0xd8a3('0xbd')));};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xbe')]=function(_0x5e5f5f){return BPromise[_0xd8a3('0xbb')]()[_0xd8a3('0xbc')](cmHopperBlack[_0xd8a3('0xbe')](_0x5e5f5f))[_0xd8a3('0xbf')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype']['verifyAdditionalPhones']=function(_0x4c60f7,_0xab1d38,_0x441a60){return BPromise[_0xd8a3('0xbb')]()['then'](cmHopperAdditionalPhone[_0xd8a3('0xc0')](_0x4c60f7,_0xab1d38,_0x441a60))['catch'](loggerCatch(_0xd8a3('0xc1')));};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xc2')]=function(_0x52047b,_0x113b53,_0x57d105){return BPromise[_0xd8a3('0xbb')]()[_0xd8a3('0xbc')](cmHopperAdditionalPhone[_0xd8a3('0xc2')](_0x52047b,_0x113b53,_0x57d105))[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0xc3')));};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xc4')]=function(_0xc67ce6){return BPromise[_0xd8a3('0xbb')]()[_0xd8a3('0xbc')](cmHopperBlack[_0xd8a3('0xc4')](_0xc67ce6))[_0xd8a3('0xbf')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xc5')]=function(_0x1485e0){return BPromise[_0xd8a3('0xbb')]()[_0xd8a3('0xbc')](cmHopperHistory[_0xd8a3('0xc6')](_0x1485e0))[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0xc7')));};Dialer[_0xd8a3('0x1e')]['rescheduleContact']=function(_0x1c9b78){return BPromise[_0xd8a3('0xbb')]()[_0xd8a3('0xbc')](cmHopper[_0xd8a3('0xc8')](_0x1c9b78))[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0xc9')));};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xca')]=function(_0x13d514,_0x56aca9,_0x110e9b){return BPromise['resolve']()[_0xd8a3('0xbc')](cmHopper[_0xd8a3('0xca')](_0x13d514,_0x56aca9,_0x110e9b))[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0xcb')));};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xcc')]=function(_0x5146d2,_0x2ec337,_0x530064,_0x59c0a9,_0x26151f){return BPromise['resolve']()[_0xd8a3('0xbc')](cmHopper[_0xd8a3('0xcc')](_0x5146d2,_0x2ec337,_0x530064,_0x59c0a9))[_0xd8a3('0xbf')](function(_0x5a4f77){_0x26151f[_0xd8a3('0xcd')]-=_0x530064;_0x26151f[_0xd8a3('0xcd')]=_0x26151f[_0xd8a3('0xcd')]>0x0?_0x26151f[_0xd8a3('0xcd')]:0x0;loggerCatch(_0xd8a3('0xce'))(_0x5a4f77);});};Dialer[_0xd8a3('0x1e')]['getContactDialerIvr']=function(_0x5434d7,_0xa57949,_0x551021,_0x3851cc){return BPromise[_0xd8a3('0xbb')]()[_0xd8a3('0xbc')](cmHopper[_0xd8a3('0xcf')](_0x5434d7,_0xa57949,_0x551021))[_0xd8a3('0xbf')](function(_0x66af2){_0x3851cc[_0xd8a3('0xcd')]-=_0xa57949;_0x3851cc[_0xd8a3('0xcd')]=_0x3851cc[_0xd8a3('0xcd')]>0x0?_0x3851cc[_0xd8a3('0xcd')]:0x0;loggerCatch(_0xd8a3('0xd0'))(_0x66af2);});};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xd1')]=function(_0x485810){return BPromise['resolve']()[_0xd8a3('0xbc')](voiceQueueRt[_0xd8a3('0xd1')](_0x485810))[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0xd2')));};Dialer[_0xd8a3('0x1e')]['moveContactManagedDialer']=function(_0xc77a16){return BPromise[_0xd8a3('0xbb')]()['then'](cmHopper[_0xd8a3('0xd3')](_0xc77a16))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xd4')]=function(_0x57b821){return BPromise['resolve']()[_0xd8a3('0xbc')](cmHopperHistory[_0xd8a3('0xd4')](_0x57b821))[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0xd5')));};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xb8')]=function(_0x3defa8){if(!_['isUndefined'](_0x3defa8)&&_0x3defa8!==null){if(typeof _0x3defa8[_0xd8a3('0x73')]!==_0xd8a3('0xb1')){if(_0x3defa8['originated']>0x0){_0x3defa8['originated']-=0x1;}else{logger[_0xd8a3('0x9a')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0xd8a3('0xd6'));}};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xd7')]=function(_0x2ecb25,_0x54a3ea){var _0x42f681=this;return function(_0x57655d){_0x42f681[_0xd8a3('0xb8')](_0x54a3ea);logger[_0xd8a3('0x9a')](_0x2ecb25,util[_0xd8a3('0x9b')](_0x57655d,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xd8a3('0xd8')]=function(_0x125c99,_0x27aa84,_0x3a9b69){var _0x1734b9={'state':0x19,'statedesc':_0xd8a3('0xd9')};this[_0xd8a3('0xb8')](_0x27aa84);this['saveInDb'](_[_0xd8a3('0x92')](_0x1734b9,_['pick'](_0x3a9b69,[_0xd8a3('0xda'),_0xd8a3('0xdb'),_0xd8a3('0xdc'),_0xd8a3('0xdd'),_0xd8a3('0xde')])),_0xd8a3('0xdf'),_0xd8a3('0xe0'));logger['error'](_0x125c99);};Dialer['prototype'][_0xd8a3('0xe1')]=function(_0x34579a){return _0x34579a===_0xd8a3('0xe2');};Dialer['prototype'][_0xd8a3('0xe3')]=function(_0x27718f){return!_[_0xd8a3('0x87')](_0x27718f)&&_0x27718f&&!_[_0xd8a3('0x87')](_0x27718f[_0xd8a3('0x3d')])&&!_[_0xd8a3('0x87')](_0x27718f[_0xd8a3('0x79')])&&_0x27718f['active']&&(this[_0xd8a3('0x26')][util[_0xd8a3('0x7b')](_0xd8a3('0xe4'),_0x27718f['name'])][_0xd8a3('0xe5')]===_0xd8a3('0xe6')||this['trunks'][util[_0xd8a3('0x7b')](_0xd8a3('0xe4'),_0x27718f[_0xd8a3('0x3d')])]['status']===_0xd8a3('0xe7'));};Dialer[_0xd8a3('0x1e')]['saveInDb']=function(_0x2f0512,_0x574708,_0x20e30f){this[_0xd8a3('0xd4')](_0x2f0512)['catch'](loggerCatch(_0x574708));this[_0xd8a3('0xd3')](_0x2f0512)['catch'](loggerCatch(_0x20e30f));};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x37')]=function(_0x4dc8e5){var _0x2d7e0f=this[_0xd8a3('0xe8')][_0x4dc8e5['uniqueid']];var _0x2cb28c;if(!_[_0xd8a3('0xb3')](_0x4dc8e5)&&!_['isNil'](_0x4dc8e5[_0xd8a3('0xe9')])&&!_[_0xd8a3('0xb3')](_0x4dc8e5[_0xd8a3('0xe9')]['amdstatus'])&&_0x4dc8e5[_0xd8a3('0xea')]==='xcally-motion-dialer'&&_0x2d7e0f){if(_0x2d7e0f['type']!==_0xd8a3('0x96')&&this[_0xd8a3('0x23')][_0x2d7e0f[_0xd8a3('0xb7')]][_0xd8a3('0xeb')]&&_0x4dc8e5[_0xd8a3('0xec')]===_0xd8a3('0xed')){delete this[_0xd8a3('0xe8')][_0x4dc8e5[_0xd8a3('0xee')]];this[_0xd8a3('0xb8')](this['voiceQueues'][_0x2d7e0f[_0xd8a3('0xb7')]]);this['voiceQueues'][_0x2d7e0f[_0xd8a3('0xb7')]]['outboundAnswerCallsDay']+=0x1;this[_0xd8a3('0x23')][_0x2d7e0f[_0xd8a3('0xb7')]][_0xd8a3('0x5d')]+=0x1;_0x2cb28c=new Hangup(_0x2d7e0f,_0x4dc8e5);_0x2cb28c[_0xd8a3('0xef')]=0x12;_0x2cb28c[_0xd8a3('0xf0')]=_0xd8a3('0xf1');_0x2cb28c['membername']=_0xd8a3('0xf2');ami[_0xd8a3('0x4b')](_0xd8a3('0xf3'),ut[_0xd8a3('0xf4')](_0x2cb28c,_0xd8a3('0xf5')));this['saveInDb'](_0x2cb28c,_0xd8a3('0xf6'),'[syncHangupInAMD]');}if(_0x2d7e0f[_0xd8a3('0x4c')]!==_0xd8a3('0x96')&&this[_0xd8a3('0x23')][_0x2d7e0f['queue']][_0xd8a3('0xeb')]&&_0x4dc8e5[_0xd8a3('0xec')]===_0xd8a3('0xf7')){var _0x80fe2=this;return new BPromise(function(_0x8cb0a0,_0x5331d7){delete _0x80fe2[_0xd8a3('0xe8')][_0x4dc8e5[_0xd8a3('0xee')]];_0x80fe2['updateOriginated'](_0x80fe2['voiceQueues'][_0x2d7e0f['queue']]);_0x80fe2[_0xd8a3('0x23')][_0x2d7e0f['queue']][_0xd8a3('0x5e')]+=0x1;_0x80fe2['voiceQueues'][_0x2d7e0f[_0xd8a3('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x654a74=_0x80fe2['voiceQueues'][_0x2d7e0f[_0xd8a3('0xb7')]];var _0x304bb7=new Hangup(_0x2d7e0f,_0x4dc8e5);_0x304bb7[_0xd8a3('0xef')]=0x13;_0x304bb7[_0xd8a3('0xf0')]=_0xd8a3('0xf8');_0x304bb7['membername']=_0xd8a3('0xf2');_0x304bb7[_0xd8a3('0xf9')]+=0x1;_0x304bb7[_0xd8a3('0xfa')]+=0x1;_0x304bb7[_0xd8a3('0xf5')]=!![];ami[_0xd8a3('0x4b')](_0xd8a3('0xf3'),ut[_0xd8a3('0xf4')](_0x304bb7,_0xd8a3('0xf5')));_0x80fe2['createHistory'](_0x304bb7)['catch'](loggerCatch(_0xd8a3('0xfb')));if(_0x304bb7[_0xd8a3('0xfc')]+_0x304bb7['countcongestionretry']+_0x304bb7['countnoanswerretry']+_0x304bb7[_0xd8a3('0xfd')]+_0x304bb7[_0xd8a3('0xfe')]+_0x304bb7[_0xd8a3('0xff')]+_0x304bb7['countmachineretry']+_0x304bb7[_0xd8a3('0x100')]>=_0x654a74[_0xd8a3('0x101')]){_0x80fe2[_0xd8a3('0x102')](_0x304bb7,_0x8cb0a0,_0x5331d7,_0xd8a3('0x103'));}else{if(_0x304bb7[_0xd8a3('0xf9')]>=_0x654a74['dialMachineMaxRetry']){_0x80fe2['createStateFinal'](_0x304bb7,_0x8cb0a0,_0x5331d7,'reason\x2019\x20machine....');}else{_0x80fe2[_0xd8a3('0xc8')]({'active':![],'countmachineretry':_0x304bb7[_0xd8a3('0xf9')],'scheduledat':moment()[_0xd8a3('0x104')](_0x654a74[_0xd8a3('0x105')],'minutes')['format'](_0xd8a3('0x106')),'ContactId':_0x304bb7[_0xd8a3('0xda')],'ListId':_0x304bb7[_0xd8a3('0xdb')],'VoiceQueueId':_0x304bb7[_0xd8a3('0xdd')]||undefined,'CampaignId':_0x304bb7[_0xd8a3('0xde')]||undefined})[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x107')));_0x8cb0a0({'reschedule':0x1});}}});}if(_0x2d7e0f[_0xd8a3('0x4c')]==='ivr'&&this[_0xd8a3('0x24')][_0x2d7e0f[_0xd8a3('0xb7')]][_0xd8a3('0xeb')]&&_0x4dc8e5[_0xd8a3('0xec')]===_0xd8a3('0xed')){delete this['uniqueId'][_0x4dc8e5[_0xd8a3('0xee')]];this[_0xd8a3('0xb8')](this[_0xd8a3('0x24')][_0x2d7e0f[_0xd8a3('0xb7')]]);_0x2cb28c=new Hangup(_0x2d7e0f,_0x4dc8e5);_0x2cb28c[_0xd8a3('0xef')]=0x12;_0x2cb28c[_0xd8a3('0xf0')]=_0xd8a3('0xf1');_0x2cb28c['membername']=_0xd8a3('0xf2');ami['emit'](_0xd8a3('0xf3'),ut[_0xd8a3('0xf4')](_0x2cb28c,_0xd8a3('0xf5')));this[_0xd8a3('0x108')](_0x2cb28c,_0xd8a3('0x109'),_0xd8a3('0x10a'));}if(_0x2d7e0f[_0xd8a3('0x4c')]===_0xd8a3('0x96')&&this[_0xd8a3('0x24')][_0x2d7e0f['queue']][_0xd8a3('0xeb')]&&_0x4dc8e5[_0xd8a3('0xec')]===_0xd8a3('0xf7')){var _0x80fe2=this;return new BPromise(function(_0x1fb382,_0x515929){delete _0x80fe2['uniqueId'][_0x4dc8e5[_0xd8a3('0xee')]];_0x80fe2[_0xd8a3('0xb8')](_0x80fe2[_0xd8a3('0x24')][_0x2d7e0f['queue']]);_0x80fe2[_0xd8a3('0x24')][_0x2d7e0f[_0xd8a3('0xb7')]][_0xd8a3('0x5e')]+=0x1;_0x80fe2[_0xd8a3('0x24')][_0x2d7e0f[_0xd8a3('0xb7')]][_0xd8a3('0x5d')]+=0x1;var _0xe3f1db=_0x80fe2[_0xd8a3('0x24')][_0x2d7e0f[_0xd8a3('0xb7')]];var _0x61f2da=new Hangup(_0x2d7e0f,_0x4dc8e5);_0x61f2da[_0xd8a3('0xef')]=0x13;_0x61f2da[_0xd8a3('0xf0')]='Machine';_0x61f2da['membername']=_0xd8a3('0xf2');_0x61f2da['countmachineretry']+=0x1;_0x61f2da[_0xd8a3('0xfa')]+=0x1;_0x61f2da['amd']=!![];ami['emit']('custom:amd',ut[_0xd8a3('0xf4')](_0x61f2da,'amd'));_0x80fe2[_0xd8a3('0xd4')](_0x61f2da)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0xfb')));if(_0x61f2da['countbusyretry']+_0x61f2da['countcongestionretry']+_0x61f2da[_0xd8a3('0x10b')]+_0x61f2da['countnosuchnumberretry']+_0x61f2da[_0xd8a3('0xfe')]+_0x61f2da['countabandonedretry']+_0x61f2da[_0xd8a3('0xf9')]+_0x61f2da[_0xd8a3('0x100')]>=_0xe3f1db[_0xd8a3('0x101')]){_0x80fe2[_0xd8a3('0x102')](_0x61f2da,_0x1fb382,_0x515929,_0xd8a3('0x103'));}else{if(_0x61f2da[_0xd8a3('0xf9')]>=_0xe3f1db[_0xd8a3('0x10c')]){_0x80fe2['createStateFinal'](_0x61f2da,_0x1fb382,_0x515929,_0xd8a3('0x10d'));}else{_0x80fe2['rescheduleContact']({'active':![],'countmachineretry':_0x61f2da[_0xd8a3('0xf9')],'scheduledat':moment()[_0xd8a3('0x104')](_0xe3f1db[_0xd8a3('0x105')],_0xd8a3('0x10e'))[_0xd8a3('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x61f2da[_0xd8a3('0xda')],'ListId':_0x61f2da[_0xd8a3('0xdb')],'VoiceQueueId':_0x61f2da[_0xd8a3('0xdd')]||undefined,'CampaignId':_0x61f2da['CampaignId']||undefined})[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x107')));_0x1fb382({'reschedule':0x1});}}});}}};Dialer[_0xd8a3('0x1e')]['syncHangup']=function(_0x9464a4){var _0xc1bc9d=this[_0xd8a3('0xe8')][_0x9464a4['uniqueid']];var _0x37ee3c=this;var _0x38f5c0;if(_0xc1bc9d&&_0xc1bc9d[_0xd8a3('0x4c')]===_0xd8a3('0x96')){delete this[_0xd8a3('0xe8')][_0x9464a4['uniqueid']];this[_0xd8a3('0xb8')](this['campaigns'][_0xc1bc9d[_0xd8a3('0xb7')]]);this[_0xd8a3('0x24')][_0xc1bc9d[_0xd8a3('0xb7')]][_0xd8a3('0x10f')]+=0x1;_0x38f5c0=new Hangup(_0xc1bc9d,_0x9464a4);this['createHistory'](_0x38f5c0)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x110')));this[_0xd8a3('0xd3')](_0x38f5c0)[_0xd8a3('0xbf')](loggerCatch('[syncHangupIvr]'));}if(_0xc1bc9d&&_0xc1bc9d[_0xd8a3('0x4c')]!==_0xd8a3('0x96')&&isNotNull(this[_0xd8a3('0x23')][_0xc1bc9d['queue']][_0xd8a3('0x111')])){delete this[_0xd8a3('0xe8')][_0x9464a4[_0xd8a3('0xee')]];this[_0xd8a3('0xb8')](this[_0xd8a3('0x23')][_0xc1bc9d[_0xd8a3('0xb7')]]);this[_0xd8a3('0x23')][_0xc1bc9d[_0xd8a3('0xb7')]][_0xd8a3('0x5e')]+=0x1;this[_0xd8a3('0x23')][_0xc1bc9d[_0xd8a3('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;_0x38f5c0=new Hangup(_0xc1bc9d,_0x9464a4);_0x38f5c0[_0xd8a3('0xef')]=0x10;_0x38f5c0[_0xd8a3('0xf0')]='AnswerAGI';_0x38f5c0['membername']=_0xd8a3('0x112');this[_0xd8a3('0xd4')](_0x38f5c0)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x110')));this[_0xd8a3('0xd3')](_0x38f5c0)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x113')));}if(_0xc1bc9d&&_0xc1bc9d[_0xd8a3('0x4c')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0xc1bc9d[_0xd8a3('0xb7')]][_0xd8a3('0x111')])){delete this[_0xd8a3('0xe8')][_0x9464a4['uniqueid']];this['updateOriginated'](this[_0xd8a3('0x23')][_0xc1bc9d[_0xd8a3('0xb7')]]);this['voiceQueues'][_0xc1bc9d[_0xd8a3('0xb7')]][_0xd8a3('0x67')]+=0x1;_0x38f5c0=new Hangup(_0xc1bc9d,_0x9464a4);_0x38f5c0[_0xd8a3('0xef')]=0xc;_0x38f5c0[_0xd8a3('0xf0')]=_0x9464a4[_0xd8a3('0x114')];_0x38f5c0[_0xd8a3('0x115')]=_0xd8a3('0x116');this[_0xd8a3('0xd4')](_0x38f5c0)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x110')));this[_0xd8a3('0xd3')](_0x38f5c0)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x113')));}};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x33')]=function(_0x8b8eec){var _0x5377d3=this[_0xd8a3('0xe8')][_0x8b8eec[_0xd8a3('0xee')]];var _0x1740ef=this;if(this[_0xd8a3('0x23')][_0x8b8eec[_0xd8a3('0xb7')]]){if(_0x5377d3&&_0x5377d3[_0xd8a3('0x4c')]!=='ivr'){delete this[_0xd8a3('0xe8')][_0x8b8eec['uniqueid']];this[_0xd8a3('0x23')][_0x8b8eec[_0xd8a3('0xb7')]][_0xd8a3('0x5e')]+=0x1;var _0x259994=new AgentComplete(_0x5377d3,_0x8b8eec);if(_0x8b8eec[_0xd8a3('0x117')]===_0xd8a3('0x118')){_0x259994['agiafterat']=this[_0xd8a3('0x23')][_0x8b8eec[_0xd8a3('0xb7')]][_0xd8a3('0x119')]&&this[_0xd8a3('0x23')][_0x8b8eec[_0xd8a3('0xb7')]][_0xd8a3('0x11a')]?moment()[_0xd8a3('0x7b')](_0xd8a3('0x106')):undefined;}this[_0xd8a3('0xd4')](_0x259994)[_0xd8a3('0xbf')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xd8a3('0xd3')](_0x259994)[_0xd8a3('0xbf')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xd8a3('0x1e')]['syncAgentConnect']=function(_0x5acecc){if(this['voiceQueues'][_0x5acecc['queue']]){if(this[_0xd8a3('0xe8')][_0x5acecc[_0xd8a3('0xee')]]&&this[_0xd8a3('0xe8')][_0x5acecc['uniqueid']][_0xd8a3('0x4c')]!==_0xd8a3('0x96')){this[_0xd8a3('0xb8')](this[_0xd8a3('0x23')][_0x5acecc[_0xd8a3('0xb7')]]);this[_0xd8a3('0xe8')][_0x5acecc[_0xd8a3('0xee')]]['answertime']=moment()[_0xd8a3('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x11b')]=function(_0xdaa6f5,_0x75d32f){this[_0xd8a3('0xd4')](_0xdaa6f5)[_0xd8a3('0xbf')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x75d32f==0x0){this[_0xd8a3('0xd3')](_0xdaa6f5)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x11c')));}};Dialer['prototype'][_0xd8a3('0x30')]=function(_0x1c5a01){var _0x278082=this['uniqueId'][_0x1c5a01[_0xd8a3('0xee')]];var _0x3d1fd0=this;var _0x3e143c=![];var _0x81b744;var _0x4cc2d1;if(this[_0xd8a3('0x23')][_0x1c5a01['queue']]){if(_0x278082&&_0x278082[_0xd8a3('0x4c')]!=='ivr'){delete this[_0xd8a3('0xe8')][_0x1c5a01[_0xd8a3('0xee')]];this['updateOriginated'](this[_0xd8a3('0x23')][_0x1c5a01['queue']]);_0x278082[_0xd8a3('0x11d')]=moment()[_0xd8a3('0x7b')](_0xd8a3('0x106'));var _0x85f834=new QueueCallerAbandon(_0x278082,_0x1c5a01);if(getSeconds(_0x278082[_0xd8a3('0x11d')],_0x278082[_0xd8a3('0x11e')])>=_0x278082[_0xd8a3('0x11f')]){this[_0xd8a3('0x23')][_0x1c5a01['queue']][_0xd8a3('0x6c')]+=0x1;this['voiceQueues'][_0x1c5a01[_0xd8a3('0xb7')]][_0xd8a3('0x64')]+=0x1;this[_0xd8a3('0x23')][_0x1c5a01[_0xd8a3('0xb7')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x85f834['state']=0xa;_0x85f834[_0xd8a3('0xf0')]='Drop';_0x85f834[_0xd8a3('0x120')]='TIMEOUT';_0x85f834['agiafterat']=this['voiceQueues'][_0x1c5a01[_0xd8a3('0xb7')]][_0xd8a3('0x119')]?moment()[_0xd8a3('0x7b')](_0xd8a3('0x106')):undefined;_0x85f834['countdropretry']+=0x1;_0x85f834['countglobal']+=0x1;_0x81b744=this[_0xd8a3('0x23')][_0x1c5a01[_0xd8a3('0xb7')]][_0xd8a3('0x121')];_0x4cc2d1=this[_0xd8a3('0x23')][_0x1c5a01[_0xd8a3('0xb7')]][_0xd8a3('0x122')];_0x3d1fd0[_0xd8a3('0xc0')](_0x85f834,_0x85f834['state'],_0x278082[_0xd8a3('0x123')])[_0xd8a3('0xbc')](function(_0x252e8d){_0x3e143c=_0x252e8d[_0xd8a3('0x124')]==0x1;if(_0x85f834[_0xd8a3('0xfe')]>=_0x3d1fd0['voiceQueues'][_0x1c5a01[_0xd8a3('0xb7')]][_0xd8a3('0x125')]){_0x3d1fd0[_0xd8a3('0x11b')](_0x85f834,_0x252e8d[_0xd8a3('0x124')]);}else{_0x3d1fd0['rescheduleContact']({'active':![],'countdropretry':_0x85f834[_0xd8a3('0xfe')],'scheduledat':moment()[_0xd8a3('0x104')](_0x3d1fd0['voiceQueues'][_0x1c5a01[_0xd8a3('0xb7')]]['dialDropRetryFrequency'],_0xd8a3('0x10e'))[_0xd8a3('0x7b')](_0xd8a3('0x106')),'ContactId':_0x278082[_0xd8a3('0xda')],'ListId':_0x278082[_0xd8a3('0xdb')],'VoiceQueueId':_0x278082[_0xd8a3('0xdd')]||undefined,'CampaignId':_0x278082[_0xd8a3('0xde')]||undefined})[_0xd8a3('0xbf')](loggerCatch('[rescheduleContact][Drop]'));var _0x411008=new History(_0x85f834);_0x411008['state']=0xa;_0x411008[_0xd8a3('0xf0')]='Drop';_0x411008['starttime']=moment()[_0xd8a3('0x7b')](_0xd8a3('0x106'));_0x411008[_0xd8a3('0xac')]=_0x411008[_0xd8a3('0xad')];_0x411008['calleridname']=_0x85f834[_0xd8a3('0x126')];_0x411008[_0xd8a3('0x127')]=_0x85f834['calleridnum'];_0x3d1fd0['createHistory'](_0x411008)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x128')));}})[_0xd8a3('0xbc')](function(_0x95d438){if(_0x3e143c)_0x3d1fd0[_0xd8a3('0xc2')](_0x85f834,_0x81b744,_0x4cc2d1)['then'](function(_0x2d0d34){return 0x1;});});}else{this[_0xd8a3('0x23')][_0x1c5a01['queue']][_0xd8a3('0x6b')]+=0x1;this[_0xd8a3('0x23')][_0x1c5a01[_0xd8a3('0xb7')]][_0xd8a3('0x63')]+=0x1;_0x85f834[_0xd8a3('0xef')]=0xb;_0x85f834[_0xd8a3('0xf0')]=_0xd8a3('0x129');_0x85f834[_0xd8a3('0x120')]=_0xd8a3('0x12a');_0x85f834['countabandonedretry']+=0x1;_0x85f834[_0xd8a3('0xfa')]+=0x1;_0x81b744=this[_0xd8a3('0x23')][_0x1c5a01[_0xd8a3('0xb7')]][_0xd8a3('0x12b')];_0x4cc2d1=this[_0xd8a3('0x23')][_0x1c5a01[_0xd8a3('0xb7')]][_0xd8a3('0x122')];_0x3d1fd0[_0xd8a3('0xc0')](_0x85f834,_0x85f834['state'],_0x278082[_0xd8a3('0x123')])[_0xd8a3('0xbc')](function(_0x3e56ff){if(_0x85f834[_0xd8a3('0xff')]>=_0x3d1fd0[_0xd8a3('0x23')][_0x1c5a01[_0xd8a3('0xb7')]][_0xd8a3('0x12c')]){_0x3d1fd0[_0xd8a3('0x11b')](_0x85f834,_0x3e56ff[_0xd8a3('0x124')]);}else{_0x3d1fd0[_0xd8a3('0xc8')]({'active':![],'countabandonedretry':_0x85f834[_0xd8a3('0xff')],'scheduledat':moment()[_0xd8a3('0x104')](_0x3d1fd0[_0xd8a3('0x23')][_0x1c5a01[_0xd8a3('0xb7')]][_0xd8a3('0x12b')],_0xd8a3('0x10e'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x278082[_0xd8a3('0xda')],'ListId':_0x278082['ListId'],'VoiceQueueId':_0x278082['VoiceQueueId']||undefined,'CampaignId':_0x278082['CampaignId']||undefined})[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x12d')));var _0xcc992d=new History(_0x85f834);_0xcc992d[_0xd8a3('0xef')]=0xb;_0xcc992d['statedesc']='Abandoned';_0xcc992d[_0xd8a3('0xad')]=moment()[_0xd8a3('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');_0xcc992d[_0xd8a3('0xac')]=_0xcc992d[_0xd8a3('0xad')];_0xcc992d[_0xd8a3('0x126')]=_0x85f834[_0xd8a3('0x126')];_0xcc992d[_0xd8a3('0x127')]=_0x85f834[_0xd8a3('0x127')];_0x3d1fd0[_0xd8a3('0xd4')](_0xcc992d)[_0xd8a3('0xbf')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})['then'](function(_0x40be48){if(_0x3e143c)_0x3d1fd0[_0xd8a3('0xc2')](_0x85f834,_0x81b744,_0x4cc2d1)['then'](function(_0x492b55){return 0x1;});});}}}};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x12e')]=function(_0x3db691){if(this[_0xd8a3('0x28')][_0x3db691[_0xd8a3('0xee')]]){this[_0xd8a3('0x28')][_0x3db691[_0xd8a3('0xee')]][_0xd8a3('0xb5')]=_0x3db691[_0xd8a3('0xb5')];}if(this[_0xd8a3('0xe8')][_0x3db691['uniqueid']]){this[_0xd8a3('0xe8')][_0x3db691[_0xd8a3('0xee')]][_0xd8a3('0xb5')]=_0x3db691[_0xd8a3('0xb5')];}};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x12f')]=function(_0x532d94){if(strategy[this[_0xd8a3('0x23')][this[_0xd8a3('0x28')][_0x532d94[_0xd8a3('0x130')]][_0xd8a3('0xb7')]][_0xd8a3('0x131')]]==='roundrobin'){if(this[_0xd8a3('0x28')][_0x532d94[_0xd8a3('0x130')]]&&_[_0xd8a3('0xb3')](this['actions'][_0x532d94[_0xd8a3('0x130')]][_0xd8a3('0x132')])&&_0x532d94[_0xd8a3('0xe5')]==='1'&&_0x532d94[_0xd8a3('0x133')]==='0'){if(this[_0xd8a3('0x25')][_0x532d94[_0xd8a3('0x134')]]){if(!this['agents'][_0x532d94['stateinterface']]['locked']){this[_0xd8a3('0x25')][_0x532d94[_0xd8a3('0x134')]][_0xd8a3('0x132')]=!![];this[_0xd8a3('0x28')][_0x532d94[_0xd8a3('0x130')]][_0xd8a3('0x132')]=!![];this[_0xd8a3('0x28')][_0x532d94[_0xd8a3('0x130')]][_0xd8a3('0x134')]=_0x532d94[_0xd8a3('0x134')];}}}}else if((strategy[this[_0xd8a3('0x23')][this[_0xd8a3('0x28')][_0x532d94[_0xd8a3('0x130')]][_0xd8a3('0xb7')]]['strategy']]||_0xd8a3('0x1c'))===_0xd8a3('0x1c')){if(this['actions'][_0x532d94[_0xd8a3('0x130')]]){if(this[_0xd8a3('0x25')][_0x532d94['stateinterface']]){this['actions'][_0x532d94[_0xd8a3('0x130')]][_0xd8a3('0x134')]=_0x532d94[_0xd8a3('0x134')];if(_[_0xd8a3('0xb3')](this['queueBooked'][this[_0xd8a3('0x28')][_0x532d94[_0xd8a3('0x130')]][_0xd8a3('0xb7')]])){this['queueBooked'][this['actions'][_0x532d94[_0xd8a3('0x130')]][_0xd8a3('0xb7')]]=[];}this['queueBooked'][this[_0xd8a3('0x28')][_0x532d94[_0xd8a3('0x130')]][_0xd8a3('0xb7')]][_0xd8a3('0x135')](_[_0xd8a3('0x92')](_[_0xd8a3('0x136')](this['actions'][_0x532d94[_0xd8a3('0x130')]],[_0xd8a3('0x137'),_0xd8a3('0x134')]),{'status':_0x532d94[_0xd8a3('0xe5')],'paused':_0x532d94['paused']}));}}}};function unlockQueueStatus(_0xd13bb1,_0x13d8df){setTimeout(function(){if(_[_0xd8a3('0x87')](_0xd13bb1[_0xd8a3('0x138')])){loggerBooked[_0xd8a3('0x9a')](_0xd8a3('0x139'),_0x13d8df);}_0xd13bb1[_0xd8a3('0x138')]=!![];loggerBooked['info'](_0xd8a3('0x13a'),_0x13d8df,JSON[_0xd8a3('0x47')](_['pick'](_0xd13bb1,[_0xd8a3('0x3d'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xd8a3('0x1e')][_0xd8a3('0x39')]=function(_0x271d19){var _0x21efe7=this;var _0xcf16ec=_0x21efe7[_0xd8a3('0x23')][_0x21efe7[_0xd8a3('0x28')][_0x271d19['actionid']][_0xd8a3('0xb7')]];if(strategy[this[_0xd8a3('0x23')][this[_0xd8a3('0x28')][_0x271d19[_0xd8a3('0x130')]][_0xd8a3('0xb7')]]['strategy']]==='roundrobin'){if(this['actions'][_0x271d19['actionid']]&&this[_0xd8a3('0x28')][_0x271d19['actionid']][_0xd8a3('0x134')]){this[_0xd8a3('0x22')][_0xd8a3('0x13b')](this[_0xd8a3('0x28')][_0x271d19['actionid']]['idHopper'],this[_0xd8a3('0x28')][_0x271d19[_0xd8a3('0x130')]][_0xd8a3('0x134')])[_0xd8a3('0xbf')](function(_0x2d2b09){logger[_0xd8a3('0x9a')](_0xd8a3('0x13c'),util[_0xd8a3('0x9b')](_0x2d2b09,{'showHidden':![],'depth':null}));})['finally'](function(){_0x21efe7[_0xd8a3('0xb8')](_0x21efe7['voiceQueues'][_0x21efe7[_0xd8a3('0x28')][_0x271d19['actionid']][_0xd8a3('0xb7')]]);_0x21efe7[_0xd8a3('0x25')][_0x21efe7[_0xd8a3('0x28')][_0x271d19[_0xd8a3('0x130')]][_0xd8a3('0x134')]][_0xd8a3('0x132')]=![];delete _0x21efe7[_0xd8a3('0x28')][_0x271d19['actionid']];unlockQueueStatus(_0xcf16ec);});}else{this[_0xd8a3('0xb8')](this['voiceQueues'][this[_0xd8a3('0x28')][_0x271d19[_0xd8a3('0x130')]]['queue']]);this[_0xd8a3('0xc8')]({'active':![],'ContactId':this[_0xd8a3('0x28')][_0x271d19['actionid']]['ContactId'],'ListId':this[_0xd8a3('0x28')][_0x271d19[_0xd8a3('0x130')]][_0xd8a3('0xdb')],'VoiceQueueId':this[_0xd8a3('0x28')][_0x271d19['actionid']][_0xd8a3('0xdd')]||undefined,'CampaignId':this[_0xd8a3('0x28')][_0x271d19['actionid']]['CampaignId']||undefined})[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x13d')));delete this[_0xd8a3('0x28')][_0x271d19[_0xd8a3('0x130')]];unlockQueueStatus(_0xcf16ec);}}else if((strategy[this[_0xd8a3('0x23')][this[_0xd8a3('0x28')][_0x271d19[_0xd8a3('0x130')]][_0xd8a3('0xb7')]]['strategy']]||_0xd8a3('0x1c'))===_0xd8a3('0x1c')){var _0x45f409;if(this[_0xd8a3('0x28')][_0x271d19[_0xd8a3('0x130')]]&&!_[_0xd8a3('0x7f')](this[_0xd8a3('0x2b')][this[_0xd8a3('0x28')][_0x271d19[_0xd8a3('0x130')]][_0xd8a3('0xb7')]])){if(this[_0xd8a3('0x13e')][_0x21efe7[_0xd8a3('0x28')][_0x271d19[_0xd8a3('0x130')]]['queue']]){this[_0xd8a3('0x13e')][_0x21efe7[_0xd8a3('0x28')][_0x271d19[_0xd8a3('0x130')]][_0xd8a3('0xb7')]]=this[_0xd8a3('0x13e')][this[_0xd8a3('0x28')][_0x271d19['actionid']][_0xd8a3('0xb7')]]?this[_0xd8a3('0x13e')][this[_0xd8a3('0x28')][_0x271d19[_0xd8a3('0x130')]][_0xd8a3('0xb7')]]:this[_0xd8a3('0x2b')][this['actions'][_0x271d19['actionid']][_0xd8a3('0xb7')]]?this[_0xd8a3('0x2b')][this[_0xd8a3('0x28')][_0x271d19['actionid']][_0xd8a3('0xb7')]][_0xd8a3('0x13f')]||0x0:0x0;}this[_0xd8a3('0x2b')][this[_0xd8a3('0x28')][_0x271d19[_0xd8a3('0x130')]][_0xd8a3('0xb7')]][_0xd8a3('0x13f')]=this['queueBookedRR'][this['actions'][_0x271d19['actionid']][_0xd8a3('0xb7')]];for(var _0x4e5c4c=0x0;_0x4e5c4c=0x0;})[_0xd8a3('0xbf')](myreject(_0x4dbe67)));}}else{_0x15e384[_0xd8a3('0x135')](ami[_0xd8a3('0xb4')]({'action':_0xd8a3('0x158'),'command':util[_0xd8a3('0x7b')](_0xd8a3('0x153'),_0x533860,!_[_0xd8a3('0x87')](config[_0xd8a3('0x150')][_0x5cf77a])?_0x5cf77a:'')})[_0xd8a3('0xbc')](function(_0x4325a4){return _0x4325a4[_0xd8a3('0x155')][_0xd8a3('0x156')](_0xd8a3('0x157'))>=0x0;})[_0xd8a3('0xbf')](myreject(_0x4dbe67)));}BPromise['all'](_0x15e384)['then'](function(_0xda53fe){var _0x4265ce=_['some'](_0xda53fe);if(_0x4265ce){return _0x4b07d8(_0x4265ce);}else{_0x492fd2[_0xd8a3('0x41')]=_0x417d10?_0xd8a3('0x159'):_0xd8a3('0x15a');return _0x4dbe67(msgResponse(_0xd8a3('0x15b'),_0xd8a3('0x14d'),'Global:\x20'+_0x417d10+'\x20'+_0x2a94a3+_0xd8a3('0x15c')+util[_0xd8a3('0x9b')](_0x533860,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x5cf77a));}})[_0xd8a3('0xbf')](function(_0xafe0c7){return _0x4dbe67(msgResponse(_0xd8a3('0x14c'),'Failure',JSON[_0xd8a3('0x47')](_0xafe0c7)));});});};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x15d')]=function(_0x2a8a1f){var _0x4064ba=this;return function(){switch(_0x2a8a1f['dialMethod']){case _0xd8a3('0x15e'):freeVariablesPredictive(_0x2a8a1f);_0x4064ba[_0xd8a3('0x15f')](_0x2a8a1f,0x1);break;case'power':freeVariablesPredictive(_0x2a8a1f);_0x4064ba[_0xd8a3('0x15f')](_0x2a8a1f,_0x2a8a1f[_0xd8a3('0x160')]);break;case _0xd8a3('0xb'):_0x4064ba[_0xd8a3('0xb')](_0x2a8a1f);break;case'booked':freeVariablesPredictive(_0x2a8a1f);_0x4064ba[_0xd8a3('0x15f')](_0x2a8a1f,0x1);break;default:freeVariablesPredictive(_0x2a8a1f);logger[_0xd8a3('0x9a')](_0xd8a3('0x161'),_0x2a8a1f['name'],_0xd8a3('0x162'));}};};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x163')]=function(_0x2cf3cc){var _0x1ec842=this;return function(){_0x1ec842[_0xd8a3('0x164')](_0x2cf3cc);};};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xd')]=function(_0x962457){var _0x2fc707=this;if(isNotPreview(_0x962457['dialMethod'])){if(isVoiceQueueOutbound(_0x962457[_0xd8a3('0x4c')])&&isActive(_0x962457['dialActive'])){_0x962457['sendMessageOneNotActive']=!![];BPromise[_0xd8a3('0xbb')]()['then'](checkIsLoggedIn(_0x962457,_0x962457[_0xd8a3('0x50')]))[_0xd8a3('0xbc')](checkIsActive(_0x962457,_0x962457['dialActive']))[_0xd8a3('0xbc')](checkInterval(_0x962457))[_0xd8a3('0xbc')](_0x2fc707[_0xd8a3('0x147')](_0x962457))[_0xd8a3('0xbc')](_0x2fc707[_0xd8a3('0x14b')](_0x962457[_0xd8a3('0x165')],_0x962457[_0xd8a3('0x166')],_0x962457[_0xd8a3('0x3d')],_0x962457))[_0xd8a3('0xbc')](_0x2fc707[_0xd8a3('0x167')](_0x962457[_0xd8a3('0x40')],_0x962457[_0xd8a3('0x166')],_0x962457[_0xd8a3('0x3d')],_0x962457))['then'](_0x2fc707[_0xd8a3('0x15d')](_0x962457))['catch'](loggerCatchQueueSummary(_0xd8a3('0x168'),_0x962457));}else{notSendMessagesQueue(_0x962457);}}else{freeVariablesPredictive(_0x962457);}};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x146')]=function(){var _0x4ea74b=this;var _0x5ad488;for(var _0x24469f in this[_0xd8a3('0x24')]){if(typeof this[_0xd8a3('0x24')][_0x24469f]!==_0xd8a3('0xb1')){_0x5ad488=this['campaigns'][_0x24469f];if(isCampaignIvr(_0x5ad488[_0xd8a3('0x4c')])&&isActive(_0x5ad488[_0xd8a3('0x79')])){_0x5ad488['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0xd8a3('0xbc')](checkIsActive(_0x5ad488,_0x5ad488[_0xd8a3('0x79')]))['then'](checkInterval(_0x5ad488))[_0xd8a3('0xbc')](_0x4ea74b[_0xd8a3('0x147')](_0x5ad488))['then'](_0x4ea74b[_0xd8a3('0x14b')](_0x5ad488[_0xd8a3('0x165')],_0x5ad488[_0xd8a3('0x166')],_0x5ad488[_0xd8a3('0x3d')],_0x5ad488))[_0xd8a3('0xbc')](_0x4ea74b['checkIfTimeIntervals'](_0x5ad488[_0xd8a3('0x40')],_0x5ad488[_0xd8a3('0x166')],_0x5ad488['name'],_0x5ad488))[_0xd8a3('0xbc')](_0x4ea74b[_0xd8a3('0x163')](_0x5ad488))['catch'](loggerCatchQueueSummary(_0xd8a3('0x169'),_0x5ad488));}else{notSendMessagesCampaign(_0x5ad488);}}}};function getCallerIdRandom(_0x3de034,_0x2fa5e3){var _0xe43e20;var _0x27e40e;var _0xbeb83f;if(_0x2fa5e3<=0x0){_0x2fa5e3=0x1;}_0xe43e20=new RegExp(_0xd8a3('0x16a')+_0x2fa5e3+'}$');_0x27e40e=Math['pow'](0xa,_0x2fa5e3-0x1);_0xbeb83f=Math[_0xd8a3('0x16b')](0xa,_0x2fa5e3)-0x1;return util['format']('%s',_[_0xd8a3('0x16c')](_0x3de034,_0xe43e20,_[_0xd8a3('0x16d')](_0x27e40e,_0xbeb83f)));}function extractCalleridName(_0x306f8a){var _0x2fdc39=_0x306f8a[_0xd8a3('0x16e')](/"(.*?)"/);return _0x2fdc39?_0x2fdc39[0x1]:_0x306f8a;}function extractCalleridNumber(_0x2e0887){var _0x47e403=_0x2e0887['match'](/<(.*?)>/);return _0x47e403?_0x47e403[0x1]:_0x2e0887;}Dialer[_0xd8a3('0x1e')][_0xd8a3('0x16f')]=function(_0x50a1e4,_0x395829){var _0x557d31=this;var _0x5505b1=uuid['v4']();this[_0xd8a3('0x28')][_0x5505b1]=new Action(_0x50a1e4,_0x395829,_0x5505b1);return new BPromise(function(_0x92897e,_0x527135){if(_[_0xd8a3('0x87')](_0x50a1e4)&&typeof _0x50a1e4!==_0xd8a3('0x170')){return _0x527135(msgResponse(_0xd8a3('0x171'),_0xd8a3('0x14d'),_0xd8a3('0x172')));}if(_[_0xd8a3('0x87')](_0x395829[_0xd8a3('0x173')])||_0x395829[_0xd8a3('0x173')]===null){return _0x527135(msgResponse('originate',_0xd8a3('0x14d'),'contact\x20is\x20undefine'));}var _0x4deb1f={'XMD-CALLERID':_0x557d31[_0xd8a3('0x28')][_0x5505b1][_0xd8a3('0x174')](),'XMD-AGI':_0x50a1e4[_0xd8a3('0x111')]?util[_0xd8a3('0x7b')](_0xd8a3('0x175'),ipAgi,_0x50a1e4[_0xd8a3('0x111')]):'NONE','XMD-AGIAFTER':_0x50a1e4[_0xd8a3('0x119')]?util[_0xd8a3('0x7b')](_0xd8a3('0x175'),ipAgi,_0x50a1e4['dialQueueProject2']):_0xd8a3('0x176'),'XMD-QUEUE':_0x50a1e4['type']===_0xd8a3('0x4d')?util[_0xd8a3('0x7b')](_0xd8a3('0x177'),_0x50a1e4[_0xd8a3('0x3d')],_0x50a1e4[_0xd8a3('0x178')]||'',_0x50a1e4[_0xd8a3('0x11a')]?'c':'',_0x50a1e4['dialQueueTimeout']||0x3):_0xd8a3('0x176'),'XMD-CONTACTID':_0x395829[_0xd8a3('0xda')],'XMD-CDRTYPE':_0xd8a3('0x9'),'CALLERID(all)':_0x557d31[_0xd8a3('0x28')][_0x5505b1]['getCaller'](),'XMD-AMD':_0x50a1e4[_0xd8a3('0xeb')]?_0xd8a3('0x179'):_0xd8a3('0x176'),'XMD-DESTINATION':_0xd8a3('0x17a')};if(_0x50a1e4[_0xd8a3('0xeb')]){_0x4deb1f[_0xd8a3('0x17b')]=_0x50a1e4[_0xd8a3('0x17c')]||0x9c4;_0x4deb1f[_0xd8a3('0x17d')]=_0x50a1e4['dialAMDGreeting']||0x5dc;_0x4deb1f[_0xd8a3('0x17e')]=_0x50a1e4['dialAMDAfterGreetingSilence']||0x320;_0x4deb1f[_0xd8a3('0x17f')]=_0x50a1e4['dialAMDTotalAnalysisTime']||0x1388;_0x4deb1f[_0xd8a3('0x180')]=_0x50a1e4[_0xd8a3('0x181')]||0x64;_0x4deb1f[_0xd8a3('0x182')]=_0x50a1e4[_0xd8a3('0x183')]||0x32;_0x4deb1f['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x50a1e4[_0xd8a3('0x184')]||0x3;_0x4deb1f['XMD-AMDSILENCETHRESHOLD']=_0x50a1e4[_0xd8a3('0x185')]||0x100;_0x4deb1f[_0xd8a3('0x186')]=_0x50a1e4['dialAMDMaximumWordLength']||0x1388;}if(_0x50a1e4[_0xd8a3('0x4c')]===_0xd8a3('0x4d')){_0x4deb1f['XMD-VOICEQUEUEID']=_0x395829['VoiceQueueId'];}else{_0x4deb1f[_0xd8a3('0x187')]=_0x395829[_0xd8a3('0xde')];}for(var _0x45a6fb in _0x395829['Contact']){if(typeof _0x395829[_0xd8a3('0x188')][_0x45a6fb]!==_0xd8a3('0xb1')){if(isNotNull(_0x395829['Contact'][_0x45a6fb])&&_0x45a6fb!=='id'&&_0x45a6fb!==_0xd8a3('0x189')&&_0x45a6fb!==_0xd8a3('0x18a')&&_0x45a6fb!==_0xd8a3('0x18b')){_0x4deb1f[util[_0xd8a3('0x7b')](_0xd8a3('0x18c'),_0xd8a3('0x18d'),_[_0xd8a3('0x18e')](_0x45a6fb))]=_0x395829['Contact'][_0x45a6fb];}}}var _0x248928=_0x557d31[_0xd8a3('0xe3')](_0x50a1e4[_0xd8a3('0x78')])?getCallerId(_0x50a1e4[_0xd8a3('0x78')][_0xd8a3('0x7a')],_0x50a1e4['dialOriginateCallerIdName'],_0x50a1e4['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x50a1e4[_0xd8a3('0x5a')],_0x50a1e4['dialRandomLastDigitCallerIdNumber']):_0x50a1e4[_0xd8a3('0x5a')]):getCallerId(_[_0xd8a3('0xb3')](_0x50a1e4[_0xd8a3('0x148')])?_0x50a1e4[_0xd8a3('0x78')][_0xd8a3('0x7a')]:_0x50a1e4['TrunkBackup'][_0xd8a3('0x7a')],_0x50a1e4['dialOriginateCallerIdName'],_0x50a1e4[_0xd8a3('0x18f')]>0x0?getCallerIdRandom(_0x50a1e4[_0xd8a3('0x5a')],_0x50a1e4[_0xd8a3('0x18f')]):_0x50a1e4[_0xd8a3('0x5a')]);if(_0x248928){_0x4deb1f[_0xd8a3('0x190')]=_0x557d31['actions'][_0x5505b1][_0xd8a3('0x191')]=extractCalleridName(_0x248928);_0x4deb1f[_0xd8a3('0x192')]=_0x395829[_0xd8a3('0x173')];}return ami[_0xd8a3('0xb4')]({'actionid':_0x5505b1,'action':'originate','channel':_0x557d31[_0xd8a3('0xe3')](_0x50a1e4[_0xd8a3('0x78')])?util[_0xd8a3('0x7b')](_0xd8a3('0x193'),_0x50a1e4[_0xd8a3('0x78')][_0xd8a3('0x3d')],isNotNull(_0x50a1e4[_0xd8a3('0x5c')])?_0x50a1e4[_0xd8a3('0x5c')][_0xd8a3('0x194')]()||'':'',_0x50a1e4['dialCutDigit']>0x0?_0x395829[_0xd8a3('0x173')][_0xd8a3('0x195')](_0x50a1e4[_0xd8a3('0x196')]):_0x395829[_0xd8a3('0x173')]):util[_0xd8a3('0x7b')](_0xd8a3('0x193'),_['isNil'](_0x50a1e4[_0xd8a3('0x148')])?_0x50a1e4[_0xd8a3('0x78')][_0xd8a3('0x3d')]:_0x50a1e4[_0xd8a3('0x148')]['name'],isNotNull(_0x50a1e4[_0xd8a3('0x5c')])?_0x50a1e4[_0xd8a3('0x5c')][_0xd8a3('0x194')]()||'':'',_0x50a1e4[_0xd8a3('0x196')]>0x0?_0x395829['phone'][_0xd8a3('0x195')](_0x50a1e4[_0xd8a3('0x196')]):_0x395829['phone']),'callerid':_0x248928,'Exten':_0xd8a3('0x17a'),'Context':_0xd8a3('0x197'),'Priority':'1','variable':_0x4deb1f,'timeout':(_0x50a1e4[_0xd8a3('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5505b1})[_0xd8a3('0xbc')](function(_0x3365ef){return _0x92897e(_0x3365ef);})[_0xd8a3('0xbf')](function(_0x376cf7){_0x50a1e4[_0xd8a3('0x198')]+=0x1;var _0x10944c=new History(_0x557d31[_0xd8a3('0x28')][_0x5505b1]);logger['error'](util[_0xd8a3('0x7b')](_0xd8a3('0x199'),JSON['stringify'](_0x376cf7)));_0x10944c[_0xd8a3('0xef')]=0xe;_0x10944c[_0xd8a3('0xf0')]='OriginateError';_0x10944c[_0xd8a3('0xad')]=moment()[_0xd8a3('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');_0x10944c[_0xd8a3('0xac')]=_0x10944c['starttime'];_0x557d31[_0xd8a3('0xd4')](_0x10944c)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x19a')));_0x557d31[_0xd8a3('0xd3')](_0x10944c)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x19a')))['finally'](function(){delete _0x557d31['actions'][_0x5505b1];return _0x527135(msgResponse(_0xd8a3('0x171'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x32')]=function(_0x2d48dc){var _0x409d3c=this[_0xd8a3('0x28')][_0x2d48dc['actionid']];if(_0x409d3c){delete this['actions'][_0x2d48dc[_0xd8a3('0x130')]];_0x409d3c[_0xd8a3('0x11e')]=moment()['format'](_0xd8a3('0x106'));var _0xe015b7=_0x409d3c[_0xd8a3('0x4c')]===_0xd8a3('0x96')?this['campaigns'][_0x409d3c[_0xd8a3('0xb7')]]:this[_0xd8a3('0x23')][_0x409d3c[_0xd8a3('0x19b')]()];if(!this[_0xd8a3('0xe1')](_0x2d48dc['response'])){this[_0xd8a3('0xb8')](_0xe015b7);return this[_0xd8a3('0x19c')](_0x409d3c,_0xe015b7,_0x2d48dc)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x19d')));}this[_0xd8a3('0xe8')][_0x2d48dc[_0xd8a3('0xee')]]=_0x409d3c;}};Dialer[_0xd8a3('0x1e')]['checkRetriveMax']=function(_0xfe2f79,_0x52fb45,_0x539b0f){var _0x136e51=new History(_0x52fb45);if(_0x136e51[_0xd8a3('0xfc')]+_0x136e51[_0xd8a3('0x19e')]+_0x136e51['countnoanswerretry']+_0x136e51[_0xd8a3('0xfd')]+_0x136e51[_0xd8a3('0xfe')]+_0x136e51['countabandonedretry']+_0x136e51[_0xd8a3('0xf9')]+_0x136e51[_0xd8a3('0x100')]>=_0x539b0f[_0xd8a3('0x101')]-0x1){return!![];}switch(_0xfe2f79){case 0x3:if(_0x136e51['countnoanswerretry']>=_0x539b0f[_0xd8a3('0x19f')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x136e51[_0xd8a3('0x10b')]+=0x1,'scheduledat':moment()['add'](_0x539b0f['dialNoAnswerRetryFrequency'],'minutes')['format'](_0xd8a3('0x106')),'ContactId':_0x136e51['ContactId'],'ListId':_0x136e51['ListId'],'VoiceQueueId':_0x136e51['VoiceQueueId']||undefined,'CampaignId':_0x136e51[_0xd8a3('0xde')]||undefined})['catch'](loggerCatch(_0xd8a3('0x1a0')));break;case 0x5:if(_0x136e51[_0xd8a3('0xfc')]>=_0x539b0f[_0xd8a3('0x1a1')]-0x1){return!![];}this[_0xd8a3('0xc8')]({'active':![],'countbusyretry':_0x136e51[_0xd8a3('0xfc')]+=0x1,'scheduledat':moment()['add'](_0x539b0f[_0xd8a3('0x1a2')],'minutes')['format'](_0xd8a3('0x106')),'ContactId':_0x136e51[_0xd8a3('0xda')],'ListId':_0x136e51[_0xd8a3('0xdb')],'VoiceQueueId':_0x136e51['VoiceQueueId']||undefined,'CampaignId':_0x136e51[_0xd8a3('0xde')]||undefined})[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x1a3')));break;case 0x8:if(_0x136e51['countcongestionretry']>=_0x539b0f[_0xd8a3('0x1a4')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x136e51[_0xd8a3('0x19e')]+=0x1,'scheduledat':moment()[_0xd8a3('0x104')](_0x539b0f[_0xd8a3('0x1a5')],_0xd8a3('0x10e'))[_0xd8a3('0x7b')](_0xd8a3('0x106')),'ContactId':_0x136e51[_0xd8a3('0xda')],'ListId':_0x136e51['ListId'],'VoiceQueueId':_0x136e51['VoiceQueueId']||undefined,'CampaignId':_0x136e51['CampaignId']||undefined})[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x1a6')));break;case 0x0:if(_0x136e51[_0xd8a3('0xfd')]>=_0x539b0f[_0xd8a3('0x1a7')]-0x1){return!![];}else{this[_0xd8a3('0xc8')]({'active':![],'countnosuchnumberretry':_0x136e51[_0xd8a3('0xfd')]+=0x1,'scheduledat':moment()[_0xd8a3('0x104')](_0x539b0f[_0xd8a3('0x1a8')],_0xd8a3('0x10e'))[_0xd8a3('0x7b')](_0xd8a3('0x106')),'ContactId':_0x136e51[_0xd8a3('0xda')],'ListId':_0x136e51[_0xd8a3('0xdb')],'VoiceQueueId':_0x136e51[_0xd8a3('0xdd')]||undefined,'CampaignId':_0x136e51['CampaignId']||undefined})[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x1a9')));}break;case 0xa:if(_0x136e51[_0xd8a3('0xfe')]>=_0x539b0f[_0xd8a3('0x125')]-0x1){return!![];}this[_0xd8a3('0xc8')]({'active':![],'countdropretry':_0x136e51[_0xd8a3('0xfe')]+=0x1,'scheduledat':moment()['add'](_0x539b0f[_0xd8a3('0x121')],'minutes')[_0xd8a3('0x7b')](_0xd8a3('0x106')),'ContactId':_0x136e51[_0xd8a3('0xda')],'ListId':_0x136e51[_0xd8a3('0xdb')],'VoiceQueueId':_0x136e51[_0xd8a3('0xdd')]||undefined,'CampaignId':_0x136e51[_0xd8a3('0xde')]||undefined})[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x1aa')));break;case 0xb:if(_0x136e51[_0xd8a3('0xff')]>=_0x539b0f[_0xd8a3('0x12c')]-0x1){return!![];}this[_0xd8a3('0xc8')]({'active':![],'countabandonedretry':_0x136e51[_0xd8a3('0xff')]+=0x1,'scheduledat':moment()[_0xd8a3('0x104')](_0x539b0f[_0xd8a3('0x12b')],_0xd8a3('0x10e'))['format'](_0xd8a3('0x106')),'ContactId':_0x136e51[_0xd8a3('0xda')],'ListId':_0x136e51[_0xd8a3('0xdb')],'VoiceQueueId':_0x136e51[_0xd8a3('0xdd')]||undefined,'CampaignId':_0x136e51['CampaignId']||undefined})['catch'](loggerCatch(_0xd8a3('0x12d')));break;case 0x13:if(_0x136e51[_0xd8a3('0xf9')]>=_0x539b0f[_0xd8a3('0x10c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x136e51['countmachineretry']+=0x1,'scheduledat':moment()[_0xd8a3('0x104')](_0x539b0f[_0xd8a3('0x105')],'minutes')[_0xd8a3('0x7b')](_0xd8a3('0x106')),'ContactId':_0x136e51[_0xd8a3('0xda')],'ListId':_0x136e51[_0xd8a3('0xdb')],'VoiceQueueId':_0x136e51['VoiceQueueId']||undefined,'CampaignId':_0x136e51['CampaignId']||undefined})[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x107')));break;case 0x14:if(_0x136e51['countagentrejectretry']>=_0x539b0f[_0xd8a3('0x1ab')]-0x1){return!![];}this[_0xd8a3('0xc8')]({'active':![],'countagentrejectretry':_0x136e51['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xd8a3('0x104')](_0x539b0f[_0xd8a3('0x1ac')],_0xd8a3('0x10e'))['format'](_0xd8a3('0x106')),'ContactId':_0x136e51[_0xd8a3('0xda')],'ListId':_0x136e51[_0xd8a3('0xdb')],'VoiceQueueId':_0x136e51['VoiceQueueId']||undefined,'CampaignId':_0x136e51['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xd8a3('0x1e')]['callProgressDetecting']=function(_0xfbee57,_0x2a2f21,_0x5c1b87){var _0xc0aa3f=this;var _0x129def=new History(_0xfbee57);var _0x5ae922=![];var _0x10922c;var _0x2d99d6;return new BPromise(function(_0x434e6d,_0x1223b9){if(_[_0xd8a3('0x87')](_0x2a2f21)&&typeof _0x2a2f21!==_0xd8a3('0x170')){return _0x1223b9(msgResponse(_0xd8a3('0x1ad'),'Failure',_0xd8a3('0x1ae')));}if(_[_0xd8a3('0x87')](_0x5c1b87)&&typeof _0x5c1b87!==_0xd8a3('0x170')){return _0x1223b9(msgResponse(_0xd8a3('0x1ad'),_0xd8a3('0x14d'),'evt\x20is\x20undefine'));}_0xc0aa3f['verifyAdditionalPhones'](_0x129def,_0x5c1b87[_0xd8a3('0x117')],_0x2a2f21)[_0xd8a3('0xbc')](function(_0x5f51d9){if(_0x5f51d9[_0xd8a3('0x124')]==0x1)_0x5ae922=!![];switch(_0x5c1b87[_0xd8a3('0x117')]){case'0':_0x2a2f21['outboundNoSuchCallsDay']+=0x1;_0x129def['state']=0x0;_0x129def[_0xd8a3('0xf0')]=_0xd8a3('0x1af');_0x129def[_0xd8a3('0xfd')]+=0x1;_0x129def['countglobal']+=0x1;ami[_0xd8a3('0x4b')](_0xd8a3('0x1b0'),ut[_0xd8a3('0xf4')](_0xfbee57,_0xd8a3('0x1b1')));_0x10922c=_0x2a2f21[_0xd8a3('0x1a8')];_0x2d99d6=_0x2a2f21[_0xd8a3('0x122')];_0xc0aa3f[_0xd8a3('0xd4')](_0x129def)['catch'](loggerCatch(_0xd8a3('0xfb')));if(_0xc0aa3f[_0xd8a3('0x1b2')](0x0,_0xfbee57,_0x2a2f21)&&!_0x5ae922){if(_0x129def['countnosuchnumberretry']>=_0x2a2f21[_0xd8a3('0x1a7')]){_0xc0aa3f[_0xd8a3('0x1b3')](_0x129def,_0x434e6d,_0x1223b9,_0xd8a3('0x1b4'));}else{_0xc0aa3f[_0xd8a3('0x102')](_0x129def,_0x434e6d,_0x1223b9,_0xd8a3('0x1b4'));}}break;case'3':_0x2a2f21[_0xd8a3('0x65')]+=0x1;_0x129def[_0xd8a3('0xef')]=0x3;_0x129def['statedesc']=_0xd8a3('0x1b5');_0x129def['countnoanswerretry']+=0x1;_0x129def[_0xd8a3('0xfa')]+=0x1;ami[_0xd8a3('0x4b')](_0xd8a3('0x1b6'),ut[_0xd8a3('0xf4')](_0xfbee57,'noanswer'));_0x10922c=_0x2a2f21[_0xd8a3('0x1b7')];_0x2d99d6=_0x2a2f21[_0xd8a3('0x122')];_0xc0aa3f[_0xd8a3('0xd4')](_0x129def)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0xc0aa3f[_0xd8a3('0x1b2')](0x3,_0xfbee57,_0x2a2f21)&&!_0x5ae922){if(_0x129def[_0xd8a3('0x10b')]>=_0x2a2f21['dialNoAnswerMaxRetry']){_0xc0aa3f[_0xd8a3('0x1b3')](_0x129def,_0x434e6d,_0x1223b9,_0xd8a3('0x1b8'));}else{_0xc0aa3f['stateGlobal'](_0x129def,_0x434e6d,_0x1223b9,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x2a2f21['outboundBusyCallsDay']+=0x1;_0x129def[_0xd8a3('0xef')]=0x5;_0x129def['statedesc']=_0xd8a3('0x1b9');_0x129def[_0xd8a3('0xfc')]+=0x1;_0x129def['countglobal']+=0x1;ami[_0xd8a3('0x4b')](_0xd8a3('0x1ba'),ut['buildObj'](_0xfbee57,'busy'));_0x10922c=_0x2a2f21[_0xd8a3('0x1a2')];_0x2d99d6=_0x2a2f21[_0xd8a3('0x122')];_0xc0aa3f[_0xd8a3('0xd4')](_0x129def)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x1bb')));if(_0xc0aa3f['checkRetriveMax'](0x5,_0xfbee57,_0x2a2f21)&&!_0x5ae922){if(_0x129def['countbusyretry']>=_0x2a2f21[_0xd8a3('0x1a1')]){_0xc0aa3f[_0xd8a3('0x1b3')](_0x129def,_0x434e6d,_0x1223b9,_0xd8a3('0x1bc'));}else{_0xc0aa3f[_0xd8a3('0x102')](_0x129def,_0x434e6d,_0x1223b9,_0xd8a3('0x1bc'));}}break;case'8':_0x2a2f21[_0xd8a3('0x61')]+=0x1;_0x129def[_0xd8a3('0xef')]=0x8;_0x129def[_0xd8a3('0xf0')]=_0xd8a3('0x1bd');_0x129def[_0xd8a3('0x19e')]+=0x1;_0x129def[_0xd8a3('0xfa')]+=0x1;_0x10922c=_0x2a2f21[_0xd8a3('0x1a5')];_0x2d99d6=_0x2a2f21[_0xd8a3('0x122')];ami[_0xd8a3('0x4b')](_0xd8a3('0x1be'),ut[_0xd8a3('0xf4')](_0xfbee57,_0xd8a3('0x1bf')));_0xc0aa3f['createHistory'](_0x129def)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x1c0')));if(_0xc0aa3f['checkRetriveMax'](0x8,_0xfbee57,_0x2a2f21)&&!_0x5ae922){if(_0x129def['countcongestionretry']>=_0x2a2f21['dialCongestionMaxRetry']){_0xc0aa3f[_0xd8a3('0x1b3')](_0x129def,_0x434e6d,_0x1223b9,'reason\x208\x20congestion');}else{_0xc0aa3f[_0xd8a3('0x102')](_0x129def,_0x434e6d,_0x1223b9,_0xd8a3('0x1c1'));}}break;case'11':_0x2a2f21[_0xd8a3('0x1c2')]+=0x1;_0x129def[_0xd8a3('0xef')]=0xb;_0x129def[_0xd8a3('0xf0')]=_0xd8a3('0x129');_0x129def[_0xd8a3('0xff')]+=0x1;_0x129def['countglobal']+=0x1;_0x10922c=_0x2a2f21[_0xd8a3('0x12b')];_0x2d99d6=_0x2a2f21[_0xd8a3('0x122')];_0xc0aa3f['createHistory'](_0x129def)['catch'](loggerCatch(_0xd8a3('0x1c3')));if(_0xc0aa3f[_0xd8a3('0x1b2')](0xb,_0xfbee57,_0x2a2f21)&&!_0x5ae922){if(_0x129def[_0xd8a3('0xff')]>=_0x2a2f21[_0xd8a3('0x12c')]){_0xc0aa3f['createStateFinal'](_0x129def,_0x434e6d,_0x1223b9,_0xd8a3('0x1c4'));}else{_0xc0aa3f[_0xd8a3('0x102')](_0x129def,_0x434e6d,_0x1223b9,_0xd8a3('0x1c4'));}}break;case'20':_0x2a2f21['outboundRejectCallsDay']+=0x1;_0x129def[_0xd8a3('0xef')]=0x14;_0x129def[_0xd8a3('0xf0')]=_0xd8a3('0x1c5');_0x129def['countagentrejectretry']+=0x1;_0x129def[_0xd8a3('0xfa')]+=0x1;_0x10922c=_0x2a2f21['dialAgentRejectRetryFrequency'];_0x2d99d6=_0x2a2f21[_0xd8a3('0x122')];ami[_0xd8a3('0x4b')](_0xd8a3('0x1c6'),ut['buildObj'](_0xfbee57,_0xd8a3('0x1c7')));_0xc0aa3f[_0xd8a3('0xd4')](_0x129def)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x1c8')));if(_0xc0aa3f[_0xd8a3('0x1b2')](0x14,_0xfbee57,_0x2a2f21)&&!_0x5ae922){if(_0x129def[_0xd8a3('0x100')]>=_0x2a2f21[_0xd8a3('0x1ab')]){_0xc0aa3f['createStateFinal'](_0x129def,_0x434e6d,_0x1223b9,_0xd8a3('0x1c9'));}else{_0xc0aa3f[_0xd8a3('0x102')](_0x129def,_0x434e6d,_0x1223b9,_0xd8a3('0x1c9'));}}break;default:_0x2a2f21[_0xd8a3('0x67')]+=0x1;_0x129def[_0xd8a3('0xef')]=0xc;_0x129def['statedesc']=_0x5c1b87[_0xd8a3('0x117')];_0x10922c=_0x2a2f21[_0xd8a3('0x1ac')];_0x2d99d6=_0x2a2f21[_0xd8a3('0x122')];_0xc0aa3f[_0xd8a3('0xd4')](_0x129def)[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x1ca')));if(_0xc0aa3f[_0xd8a3('0x1b2')](_0x5c1b87[_0xd8a3('0x117')],_0xfbee57,_0x2a2f21)&&!_0x5ae922){if(_0x129def['countbusyretry']+_0x129def[_0xd8a3('0x19e')]+_0x129def[_0xd8a3('0x10b')]+_0x129def[_0xd8a3('0xfd')]+_0x129def['countdropretry']+_0x129def[_0xd8a3('0xff')]+_0x129def[_0xd8a3('0xf9')]+_0x129def[_0xd8a3('0x100')]>=_0x2a2f21[_0xd8a3('0x101')]){_0xc0aa3f['stateGlobal'](_0x129def,_0x434e6d,_0x1223b9,_0x5c1b87[_0xd8a3('0x117')]);}else{_0xc0aa3f[_0xd8a3('0x1b3')](_0x129def,_0x434e6d,_0x1223b9,_0x5c1b87[_0xd8a3('0x117')]);}}}})['then'](function(_0x5b0751){if(_0x5ae922){_0xc0aa3f[_0xd8a3('0xc2')](_0x129def,_0x10922c,_0x2d99d6)[_0xd8a3('0xbc')](function(_0x4f0376){return _0x434e6d(0x1);});}});});};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x102')]=function(_0x51c49b,_0x570680,_0x15d7fe,_0x534817){var _0x477cc9=new Final(_0x51c49b);_0x477cc9['state']=0xf;_0x477cc9[_0xd8a3('0xf0')]=_0xd8a3('0x1cb');this[_0xd8a3('0x1b3')](_0x477cc9,_0x570680,_0x15d7fe,_0x534817);};Dialer['prototype'][_0xd8a3('0x1b3')]=function(_0x6f132b,_0x4e0360,_0x191cbb,_0x3903bb){this['moveContactManagedDialer'](_0x6f132b)['then'](function(){return _0x4e0360(msgResponse(_0xd8a3('0x1ad'),_0xd8a3('0xe2'),_0x3903bb));})[_0xd8a3('0xbf')](function(){return _0x191cbb(msgResponse('[moveContactManagedDialer][0]',_0xd8a3('0x14d'),_0xd8a3('0x1cc')));});};Dialer[_0xd8a3('0x1e')][_0xd8a3('0xb')]=function(_0x20383f){var _0x33e6d5=_0x20383f[_0xd8a3('0x1cd')]/0x64;var _0x355261=_0x20383f[_0xd8a3('0x64')]/(_0x20383f[_0xd8a3('0x64')]+_0x20383f[_0xd8a3('0x5e')]);var _0x3dbba9=Math[_0xd8a3('0x1ce')](_0x20383f['predictiveIntervalAvailable']*(_0x20383f['predictiveIntervalMaxThreshold']/0x64));var _0x84b58c=Math[_0xd8a3('0x1ce')](_0x20383f[_0xd8a3('0x71')]*(_0x20383f['predictiveIntervalMinThreshold']/0x64));var _0x4fd4eb=_0x20383f[_0xd8a3('0x4f')]+_0x20383f[_0xd8a3('0x54')];var _0x587599=Math[_0xd8a3('0x1cf')](_0x20383f[_0xd8a3('0x8e')]*_0x20383f[_0xd8a3('0x75')]*_0x20383f[_0xd8a3('0x6f')]*_0x20383f[_0xd8a3('0x1d0')]);if(_[_0xd8a3('0x87')](_0x20383f[_0xd8a3('0x77')])){if(!_[_0xd8a3('0x87')](_0x20383f['startPredictive'])){_0x20383f[_0xd8a3('0x2a')]=undefined;loggerPredictive['error'](_0xd8a3('0x1d1'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xd8a3('0x87')](_0x20383f[_0xd8a3('0x95')])){loggerPredictive[_0xd8a3('0x9a')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x20383f[_0xd8a3('0x95')]);_0x20383f['handlePredictive']=undefined;}_0x20383f['startProgressive']=moment()[_0xd8a3('0x7b')](_0xd8a3('0x106'));loggerPredictive[_0xd8a3('0x80')](_0x20383f[_0xd8a3('0x3d')],_0xd8a3('0x1d2'),_0x20383f[_0xd8a3('0x77')]);this[_0xd8a3('0x15f')](_0x20383f,0x1);}else if(ifInterval(_0x20383f[_0xd8a3('0x1d3')],_0x20383f[_0xd8a3('0x77')])){this['handlePower'](_0x20383f,0x1);loggerPredictiveCalls['info'](_0xd8a3('0x1d4'),_0x20383f[_0xd8a3('0x77')],_0x20383f[_0xd8a3('0x3d')]);_0x20383f['erlangCalls']=0x0;_0x20383f[_0xd8a3('0x6e')]=0x0;}else if(_0x33e6d5<_0x355261&&_0x20383f[_0xd8a3('0x1d5')]===_0xd8a3('0x1d6')){freeVariablesPredictive(_0x20383f);loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x1d7'),_0xd8a3('0x1d8'),_0x355261,_0xd8a3('0x77'),_0x20383f['name']);}else if(_0x587599<_0x20383f[_0xd8a3('0x6e')]&&_0x20383f[_0xd8a3('0x1d5')]==='dropRate'){freeVariablesPredictive(_0x20383f);loggerPredictive[_0xd8a3('0x80')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x587599,'Drop\x20in\x20this\x20interval',_0x20383f[_0xd8a3('0x6e')],_0xd8a3('0x77'),_0x20383f[_0xd8a3('0x3d')]);}else if(!ifInterval(_0x20383f['dialPredictiveInterval'],_0x20383f['startProgressive'])&&_[_0xd8a3('0x87')](_0x20383f[_0xd8a3('0x2a')])&&!_['isUndefined'](_0x20383f[_0xd8a3('0x77')])){_0x20383f['startPredictive']=moment()[_0xd8a3('0x7b')](_0xd8a3('0x106'));loggerPredictive[_0xd8a3('0x80')](_0x20383f['name'],_0xd8a3('0x1d9'),_0x20383f[_0xd8a3('0x2a')]);this[_0xd8a3('0xc5')](_0x20383f[_0xd8a3('0x1d3')])[_0xd8a3('0xbc')](this[_0xd8a3('0x1da')](_0x20383f))[_0xd8a3('0xbc')](mergeDataErlangB(_0x20383f))[_0xd8a3('0xbc')](this[_0xd8a3('0x1db')](_0x20383f))[_0xd8a3('0xbf')](loggerCatchPredictive(_0xd8a3('0x1dc'),_0x20383f));}else if(!ifInterval(_0x20383f[_0xd8a3('0x1d3')],_0x20383f[_0xd8a3('0x2a')])){_0x20383f[_0xd8a3('0x6e')]=0x0;_0x20383f['startPredictive']=moment()['format'](_0xd8a3('0x106'));loggerPredictive[_0xd8a3('0x80')](_0x20383f[_0xd8a3('0x3d')],_0xd8a3('0x1dd'),_0x20383f[_0xd8a3('0x2a')]);clearInterval(_0x20383f[_0xd8a3('0x95')]);_0x20383f[_0xd8a3('0x95')]=undefined;this['averageHandleTime'](_0x20383f['dialPredictiveInterval'])[_0xd8a3('0xbc')](this[_0xd8a3('0x1da')](_0x20383f))[_0xd8a3('0xbc')](mergeDataErlangB(_0x20383f))[_0xd8a3('0xbc')](this[_0xd8a3('0x1db')](_0x20383f))['catch'](loggerCatchPredictive(_0xd8a3('0x1de'),_0x20383f));}else if(_0x20383f[_0xd8a3('0x71')]&&_0x4fd4eb<_0x20383f[_0xd8a3('0x71')]-_0x84b58c){freeVariablesPredictive(_0x20383f);loggerPredictive['info'](_0x20383f[_0xd8a3('0x3d')],_0xd8a3('0x1df'),_0x4fd4eb,_0xd8a3('0x1e0'),_0x20383f[_0xd8a3('0x71')],'-',_0x84b58c,'=',_0x20383f[_0xd8a3('0x71')]-_0x84b58c,')');}else if(_0x20383f[_0xd8a3('0x71')]&&_0x4fd4eb>_0x20383f[_0xd8a3('0x71')]+_0x3dbba9){freeVariablesPredictive(_0x20383f);loggerPredictive[_0xd8a3('0x80')](_0x20383f[_0xd8a3('0x3d')],_0xd8a3('0x1df'),_0x4fd4eb,_0xd8a3('0x1e1'),_0x20383f[_0xd8a3('0x71')],'+',_0x3dbba9,'=',_0x20383f[_0xd8a3('0x71')]+_0x3dbba9,')');}};Dialer['prototype'][_0xd8a3('0x1da')]=function(_0x22d09b){var _0x2cb4ae=this;return function(_0xc13787){return new BPromise(function(_0xf1ea4f,_0x29cfbe){_[_0xd8a3('0x92')](_0x22d09b,_0xc13787[0x0]);if(checkGetDataPredictive(_0xc13787[0x0])){var _0x3d7868=_0x22d09b[_0xd8a3('0x71')]=_0x22d09b['talking']+_0x22d09b[_0xd8a3('0x4f')];var _0x28d8c5=_0x22d09b['dialPredictiveInterval']*0x3c;var _0x555767=_0xc13787[0x0][_0xd8a3('0x6a')]+_0xc13787[0x0][_0xd8a3('0x69')];var _0x49c561=(_0xc13787[0x0][_0xd8a3('0x68')]+_0xc13787[0x0][_0xd8a3('0x6c')]+_0xc13787[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xc13787[0x0]['predictiveIntervalTotalCalls'];_0x22d09b[_0xd8a3('0x6f')]=_0x49c561>0x0?_0x49c561:0x1;switch(_0x22d09b[_0xd8a3('0x1d5')]){case'dropRate':var _0x334501=_0x22d09b[_0xd8a3('0x1cd')]/0x64;return _0x2cb4ae['abandonmentRate'](_0x3d7868,_0x28d8c5,_0x555767,_0x49c561,_0x334501)['then'](function(_0x34d5cd){return _0xf1ea4f(_0x34d5cd);});case _0xd8a3('0x1e2'):var _0x40d7db=_0x22d09b[_0xd8a3('0x1cd')]/0x64;return _0x2cb4ae['busyFactor'](_0x3d7868,_0x28d8c5,_0x555767,_0x49c561,_0x40d7db)[_0xd8a3('0xbc')](function(_0x5efd46){return _0xf1ea4f(_0x5efd46);});default:return _0x29cfbe(msgResponse('[getDataPredictive]','Failure','Unknown\x20Predictive'));}}else{return _0x29cfbe(msgResponse('[getDataPredictive]',_0xd8a3('0x14d'),_0xd8a3('0x1e3')));}});};};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x1e4')]=function(_0x3bb4c6){var _0x11d61d=this;return function(_0x19a6d8){return new BPromise(function(_0x2c37cb,_0x39a636){_[_0xd8a3('0x92')](_0x3bb4c6,_0x19a6d8[0x0]);if(checkGetDataPredictive(_0x19a6d8[0x0])){loggerPredictive[_0xd8a3('0x80')](JSON[_0xd8a3('0x47')](_0x19a6d8[0x0]));if(_0x3bb4c6['dialPredictiveOptimization']===_0xd8a3('0x1d6')){return _0x11d61d['getVoiceQueueRtPauses'](_0x3bb4c6['id'])[_0xd8a3('0xbc')](function(_0x3df2d7){var _0x1290b0=_0x3bb4c6[_0xd8a3('0x50')]-_0x3df2d7[0x0][_0xd8a3('0x1e5')];var _0x15b864=_0x3bb4c6[_0xd8a3('0x1d3')]*0x3c;var _0x579856=_0x19a6d8[0x0][_0xd8a3('0x6a')]+_0x19a6d8[0x0][_0xd8a3('0x69')];var _0x31150f=(_0x19a6d8[0x0][_0xd8a3('0x68')]+_0x19a6d8[0x0][_0xd8a3('0x6c')]+_0x19a6d8[0x0][_0xd8a3('0x6b')])/_0x19a6d8[0x0][_0xd8a3('0x72')];var _0x4c4347=_0x3bb4c6[_0xd8a3('0x1cd')]/0x64;_0x3bb4c6['predictiveIntervalPauses']=_0x3df2d7[0x0][_0xd8a3('0x1e5')]||0x0;_0x3bb4c6[_0xd8a3('0x6f')]=_0x31150f>0x0?_0x31150f:0x1;return _0x11d61d['abandonmentRate'](_0x1290b0,_0x15b864,_0x579856,_0x31150f,_0x4c4347);})[_0xd8a3('0xbc')](function(_0x5c6feb){return _0x2c37cb(_0x5c6feb);})['catch'](function(_0x3c5ef5){return _0x39a636(msgResponse(_0xd8a3('0x1e6'),_0xd8a3('0x14d'),JSON['stringify'](_0x3c5ef5)));});}if(_0x3bb4c6[_0xd8a3('0x1d5')]===_0xd8a3('0x1e2')){return _0x11d61d[_0xd8a3('0xd1')](_0x3bb4c6['id'])[_0xd8a3('0xbc')](function(_0x343546){var _0x4c6506=_0x3bb4c6[_0xd8a3('0x50')]-_0x343546[0x0][_0xd8a3('0x1e5')];var _0x1cd98c=_0x3bb4c6['dialPredictiveInterval']*0x3c;var _0xe25e6f=_0x19a6d8[0x0][_0xd8a3('0x6a')]+_0x19a6d8[0x0]['predictiveIntervalAvgHoldtime'];var _0x26a0d1=(_0x19a6d8[0x0][_0xd8a3('0x68')]+_0x19a6d8[0x0][_0xd8a3('0x6c')]+_0x19a6d8[0x0][_0xd8a3('0x6b')])/_0x19a6d8[0x0][_0xd8a3('0x72')];var _0x595981=_0x3bb4c6['dialPredictiveOptimizationPercentage']/0x64;_0x3bb4c6[_0xd8a3('0x70')]=_0x343546[0x0][_0xd8a3('0x1e5')]||0x0;_0x3bb4c6[_0xd8a3('0x6f')]=_0x26a0d1>0x0?_0x26a0d1:0x1;return _0x11d61d['busyFactor'](_0x4c6506,_0x1cd98c,_0xe25e6f,_0x26a0d1,_0x595981);})['then'](function(_0x506c1f){return _0x2c37cb(_0x506c1f);})[_0xd8a3('0xbf')](function(_0x115959){return _0x39a636(msgResponse(_0xd8a3('0x1e6'),_0xd8a3('0x14d'),JSON[_0xd8a3('0x47')](_0x115959)));});}}else{return _0x39a636(msgResponse('[getDataPredictive]',_0xd8a3('0x14d'),_0xd8a3('0x1e3')));}});};};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x1db')]=function(_0x22525e){var _0x2cbad0=this;return function(){var _0x5b8b93=0x0;var _0x1c315c=Math[_0xd8a3('0x1cf')](_0x22525e[_0xd8a3('0x74')]*0x3e8);if(_0x1c315c>0x0){_0x1c315c=_0x1c315c<0x64?0x64:_0x1c315c;loggerPredictive[_0xd8a3('0x80')](_0x22525e[_0xd8a3('0x3d')],_0xd8a3('0x1e7'),_0x1c315c,_0xd8a3('0x48'));_0x22525e['handlePredictive']=setInterval(function(){_0x2cbad0[_0xd8a3('0x95')](_0x22525e);loggerPredictiveCalls['info'](_0xd8a3('0x1e8'),_0x5b8b93+=0x1);},_0x1c315c);}else{loggerPredictive[_0xd8a3('0x80')](_0x22525e[_0xd8a3('0x3d')],_0xd8a3('0x1e9'));}};};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x1ea')]=function(_0x1ef7f4,_0x4dd0ff){var _0x3330a1=this;return function(_0x5dce00){if(_[_0xd8a3('0x7f')](_0x5dce00)){if(_[_0xd8a3('0xb3')](_0x4dd0ff['UserId'])||!_0x4dd0ff[_0xd8a3('0x1eb')]){if(_0x1ef7f4[_0xd8a3('0x59')]===_0xd8a3('0xa')){_0x1ef7f4[_0xd8a3('0x138')]=_['isUndefined'](_0x1ef7f4[_0xd8a3('0x138')])?!![]:_0x1ef7f4[_0xd8a3('0x138')];var _0x1eba93=uuid['v4']();_0x3330a1[_0xd8a3('0x28')][_0x1eba93]=new Action(_0x1ef7f4,_0x4dd0ff,_0x1eba93);loggerBooked[_0xd8a3('0x80')](_0xd8a3('0x1ec'),_0x1eba93,_0xd8a3('0x1ed'),JSON[_0xd8a3('0x47')](_0x1ef7f4[_0xd8a3('0x138')]),_0xd8a3('0x1ee'),_0x1ef7f4[_0xd8a3('0x3d')]);if(_0x1ef7f4[_0xd8a3('0x138')]){_0x1ef7f4[_0xd8a3('0x138')]=![];_0x3330a1[_0xd8a3('0x2b')][_0x3330a1[_0xd8a3('0x28')][_0x1eba93][_0xd8a3('0xb7')]]=[];ami[_0xd8a3('0xb4')]({'actionid':_0x1eba93,'action':'queuestatus','queue':_0x1ef7f4[_0xd8a3('0x3d')]})['catch'](function(){_0x3330a1[_0xd8a3('0xb8')](_0x1ef7f4);_0x3330a1[_0xd8a3('0xc8')]({'active':![],'ContactId':_0x3330a1[_0xd8a3('0x28')][_0x1eba93]['ContactId'],'ListId':_0x3330a1[_0xd8a3('0x28')][_0x1eba93][_0xd8a3('0xdb')],'VoiceQueueId':_0x3330a1[_0xd8a3('0x28')][_0x1eba93]['VoiceQueueId']||undefined,'CampaignId':_0x3330a1['actions'][_0x1eba93]['CampaignId']||undefined})[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x1ef')));delete _0x3330a1[_0xd8a3('0x28')][_0x1eba93];});}else{loggerBooked[_0xd8a3('0x80')](_0xd8a3('0x1f0'),JSON['stringify'](_0x1ef7f4[_0xd8a3('0x138')]),_0xd8a3('0x1ee'),_0x1ef7f4[_0xd8a3('0x3d')]);_0x3330a1[_0xd8a3('0xb8')](_0x1ef7f4);_0x3330a1[_0xd8a3('0xc8')]({'active':![],'ContactId':_0x3330a1['actions'][_0x1eba93][_0xd8a3('0xda')],'ListId':_0x3330a1[_0xd8a3('0x28')][_0x1eba93][_0xd8a3('0xdb')],'VoiceQueueId':_0x3330a1['actions'][_0x1eba93]['VoiceQueueId']||undefined,'CampaignId':_0x3330a1['actions'][_0x1eba93][_0xd8a3('0xde')]||undefined})[_0xd8a3('0xbf')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3330a1['actions'][_0x1eba93];}}else{return _0x3330a1[_0xd8a3('0x16f')](_0x1ef7f4,_0x4dd0ff);}}else{if(getDiff(_0x4dd0ff[_0xd8a3('0x1f1')])<_0x1ef7f4[_0xd8a3('0x1f2')]*0x3c){if(_0x4dd0ff[_0xd8a3('0x1f3')]&&!_0x4dd0ff[_0xd8a3('0x1f3')][_0xd8a3('0x1f4')]){_0x3330a1[_0xd8a3('0x22')][_0xd8a3('0x13b')](_0x4dd0ff['id'])[_0xd8a3('0x21')](function(){_0x3330a1[_0xd8a3('0xb8')](_0x1ef7f4);});}else{_0x3330a1[_0xd8a3('0xca')]({'active':![]},_0x4dd0ff['id'],0x1)[_0xd8a3('0x21')](function(){_0x3330a1[_0xd8a3('0xb8')](_0x1ef7f4);});}}else{_0x1ef7f4[_0xd8a3('0x1f5')]+=0x1;_0x3330a1[_0xd8a3('0xb8')](_0x1ef7f4);if(_0x1ef7f4['dialRecallInQueue']){_0x3330a1[_0xd8a3('0xc8')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4dd0ff[_0xd8a3('0xda')],'ListId':_0x4dd0ff[_0xd8a3('0xdb')],'VoiceQueueId':_0x4dd0ff[_0xd8a3('0xdd')]||undefined,'CampaignId':_0x4dd0ff[_0xd8a3('0xde')]||undefined})[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x1f6')));_0x3330a1[_0xd8a3('0xd4')](createObjHistory(_0x1ef7f4,_0x4dd0ff,'RECALLINQUEUE',0x17,_0xd8a3('0x1f7')))[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0x1f8')));}else{_0x3330a1[_0xd8a3('0x108')](createObjHistory(_0x1ef7f4,_0x4dd0ff,_0xd8a3('0x1f9'),0x16,_0xd8a3('0x1fa')),_0xd8a3('0x1fb'),_0xd8a3('0x1fc'));}}}}else{_0x1ef7f4['outboundBlacklistCallsDay']+=0x1;_0x3330a1[_0xd8a3('0x108')](createObjHistory(_0x1ef7f4,_0x4dd0ff,_0xd8a3('0x1fd'),0xd,_0xd8a3('0x1fe')),_0xd8a3('0x1ff'),_0xd8a3('0x200'));throw _0xd8a3('0x201');}};};Dialer['prototype']['handleIvr']=function(_0x41c5ba){var _0x28d140=this;var _0x1c7a53=_0x41c5ba['limitCalls']-_0x41c5ba[_0xd8a3('0x73')]-_0x41c5ba[_0xd8a3('0xcd')];emitCampaignSummary(_0x41c5ba);if(_0x1c7a53>0x0){if(_0x1c7a53>this['maxNumberOriginate']){_0x1c7a53=this[_0xd8a3('0x27')];}_0x41c5ba[_0xd8a3('0xcd')]+=_0x1c7a53;this[_0xd8a3('0xcf')](_0x41c5ba['id'],_0x1c7a53,_0x41c5ba[_0xd8a3('0x202')],_0x41c5ba)[_0xd8a3('0xbc')](function(_0x46d98d){_0x41c5ba[_0xd8a3('0xcd')]-=_0x1c7a53;_0x41c5ba[_0xd8a3('0xcd')]=_0x41c5ba[_0xd8a3('0xcd')]>0x0?_0x41c5ba[_0xd8a3('0xcd')]:0x0;if(!checkContactEmpty(_0x46d98d)){_0x41c5ba['message']=_0xd8a3('0xa3');logger['info'](_0xd8a3('0x203')+_0x41c5ba[_0xd8a3('0x3d')]);}else{_0x41c5ba['originated']+=_0x46d98d[_0xd8a3('0x9d')];_0x41c5ba[_0xd8a3('0x41')]='RUNNING';for(var _0x29eb05=0x0;_0x29eb05<_0x46d98d['length'];_0x29eb05+=0x1){_0x41c5ba[_0xd8a3('0x204')]+=0x1;if(_[_0xd8a3('0xb3')](_0x46d98d[_0x29eb05])||_['isNil'](_0x46d98d[_0x29eb05][_0xd8a3('0x188')])||_[_0xd8a3('0xb3')](_0x46d98d[_0x29eb05][_0xd8a3('0x173')])){_0x28d140['emptyContact'](_0xd8a3('0x205'),_0x41c5ba,_0x46d98d[_0x29eb05]);}else{_0x28d140['checkIsBlackListIvr'](_[_0xd8a3('0x136')](_0x46d98d[_0x29eb05],[_0xd8a3('0xde'),_0xd8a3('0x206')]))[_0xd8a3('0xbc')](_0x28d140[_0xd8a3('0x1ea')](_0x41c5ba,_0x46d98d[_0x29eb05]))[_0xd8a3('0xbf')](_0x28d140[_0xd8a3('0xd7')]('[actionOriginateIvr]\x20',_0x41c5ba));}}}})[_0xd8a3('0xbf')](loggerGetContactDialer(_0xd8a3('0x207'),_0x41c5ba,_0x1c7a53));}};Dialer[_0xd8a3('0x1e')]['handlePower']=function(_0x3ecd9d,_0xbd46f3){var _0x21aca9=this;var _0x51d149=[];var _0x3dd976=_0xbd46f3>=0x1?_0xbd46f3:0x1;if(_0x3ecd9d[_0xd8a3('0x59')]===_0xd8a3('0xa')){_0x3dd976=0x1;}var _0x3aa7b2=Math[_0xd8a3('0x1cf')](_0x3ecd9d[_0xd8a3('0x4f')]*_0x3dd976)-_0x3ecd9d[_0xd8a3('0x73')]-_0x3ecd9d[_0xd8a3('0xcd')];emitVoiceQueueSummary(_0x3ecd9d);if(_0x3ecd9d[_0xd8a3('0x208')]>0x0){var _0x4ba086=_0x3ecd9d[_0xd8a3('0x208')]-_0x3ecd9d['originated']-_0x3ecd9d['talking']-_0x3ecd9d['temp']-_0x3ecd9d[_0xd8a3('0x51')];if(_0x3aa7b2>_0x4ba086){_0x3aa7b2=_0x4ba086;}}if(_0x3aa7b2>0x0){if(_0x3ecd9d[_0xd8a3('0x59')]===_0xd8a3('0xa')){_0x3aa7b2=0x1;}if(_0x3aa7b2>this[_0xd8a3('0x27')]){_0x3aa7b2=this[_0xd8a3('0x27')];}_0x3ecd9d[_0xd8a3('0xcd')]+=_0x3aa7b2;for(var _0x3f9e72 in this['agents']){if(typeof this['agents'][_0x3f9e72]!==_0xd8a3('0xb1')){if(this[_0xd8a3('0x25')][_0x3f9e72][_0xd8a3('0xef')]===_0xd8a3('0x209')&&this[_0xd8a3('0x25')][_0x3f9e72][_0xd8a3('0xe5')]===_0xd8a3('0xe6')){_0x51d149[_0xd8a3('0x135')](this['agents'][_0x3f9e72]['id']);}}}this[_0xd8a3('0xcc')](_0x3ecd9d['id'],_0x51d149,_0x3aa7b2,_0x3ecd9d[_0xd8a3('0x202')],_0x3ecd9d)[_0xd8a3('0xbc')](function(_0x198149){_0x3ecd9d['temp']-=_0x3aa7b2;_0x3ecd9d[_0xd8a3('0xcd')]=_0x3ecd9d[_0xd8a3('0xcd')]>0x0?_0x3ecd9d[_0xd8a3('0xcd')]:0x0;if(!checkContactEmpty(_0x198149)){_0x21aca9['countReScheduled'](_0x3ecd9d)[_0xd8a3('0xbc')](sendMessageReschedule(_0x3ecd9d))['catch'](loggerCatch(_0xd8a3('0xbd')));}else{_0x3ecd9d[_0xd8a3('0x73')]+=_0x198149[_0xd8a3('0x9d')];_0x3ecd9d[_0xd8a3('0x41')]=_0x3ecd9d[_0xd8a3('0x59')]===_0xd8a3('0xa')?_0xd8a3('0x179'):'RUNNING';for(var _0x4e172d=0x0;_0x4e172d<_0x198149[_0xd8a3('0x9d')];_0x4e172d+=0x1){if(_[_0xd8a3('0xb3')](_0x198149[_0x4e172d])||_[_0xd8a3('0xb3')](_0x198149[_0x4e172d][_0xd8a3('0x188')])||_[_0xd8a3('0xb3')](_0x198149[_0x4e172d]['phone'])){_0x21aca9[_0xd8a3('0xd8')](_0xd8a3('0x205'),_0x3ecd9d,_0x198149[_0x4e172d]);}else{_0x21aca9[_0xd8a3('0xbe')](_['pick'](_0x198149[_0x4e172d],[_0xd8a3('0xdd'),_0xd8a3('0x206')]))[_0xd8a3('0xbc')](_0x21aca9[_0xd8a3('0x1ea')](_0x3ecd9d,_0x198149[_0x4e172d]))['catch'](_0x21aca9[_0xd8a3('0xd7')]('[actionOriginate]\x20',_0x3ecd9d));}}}})[_0xd8a3('0xbf')](loggerGetContactDialer(_0xd8a3('0x20a'),_0x3ecd9d,_0x3aa7b2));}};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x95')]=function(_0x4b7c27){if(_0x4b7c27[_0xd8a3('0x208')]>0x0){var _0x28b0a2=_0x4b7c27[_0xd8a3('0x208')]-_0x4b7c27[_0xd8a3('0x73')]-_0x4b7c27[_0xd8a3('0x54')];if(_0x28b0a2>0x0){this[_0xd8a3('0x20b')](_0x4b7c27);}else{loggerPredictiveCalls[_0xd8a3('0x80')](_0xd8a3('0x20c'));}}else{this[_0xd8a3('0x20b')](_0x4b7c27);}};Dialer[_0xd8a3('0x1e')][_0xd8a3('0x20b')]=function(_0x3c7d8f){var _0x5cad5c=this;var _0x4d6f32=[];_0x3c7d8f[_0xd8a3('0x73')]+=0x1;for(var _0x46629a in this[_0xd8a3('0x25')]){if(typeof this[_0xd8a3('0x25')][_0x46629a]!==_0xd8a3('0xb1')){if(this[_0xd8a3('0x25')][_0x46629a][_0xd8a3('0xef')]===_0xd8a3('0x209')&&this[_0xd8a3('0x25')][_0x46629a][_0xd8a3('0xe5')]===_0xd8a3('0xe6')){_0x4d6f32[_0xd8a3('0x135')](this['agents'][_0x46629a]['id']);}}}this[_0xd8a3('0xcc')](_0x3c7d8f['id'],_0x4d6f32,0x1,_0x3c7d8f[_0xd8a3('0x202')],_0x3c7d8f)['then'](function(_0x5e5c48){if(!checkContactEmpty(_0x5e5c48)){checkContactLowerLimitOriginate(_0x3c7d8f,0x1,0x0);_0x5cad5c['countReScheduled'](_0x3c7d8f)[_0xd8a3('0xbc')](sendMessageReschedule(_0x3c7d8f))[_0xd8a3('0xbf')](loggerCatch(_0xd8a3('0xbd')));}else{_0x3c7d8f[_0xd8a3('0x41')]='RUNNING';if(_[_0xd8a3('0xb3')](_0x5e5c48[0x0])||_['isNil'](_0x5e5c48[0x0][_0xd8a3('0x188')])||_[_0xd8a3('0xb3')](_0x5e5c48[0x0]['phone'])){_0x5cad5c['emptyContact']('[actionOriginate]\x20',_0x3c7d8f,_0x5e5c48[0x0]);}else{_0x5cad5c['checkIsBlackList'](_['pick'](_0x5e5c48[0x0],['VoiceQueueId',_0xd8a3('0x206')]))[_0xd8a3('0xbc')](_0x5cad5c[_0xd8a3('0x1ea')](_0x3c7d8f,_0x5e5c48[0x0]))[_0xd8a3('0xbf')](_0x5cad5c['loggerHandler'](_0xd8a3('0x20d'),_0x3c7d8f));}}})[_0xd8a3('0xbf')](loggerGetContactDialer('[getContactDialerPredictive]',_0x3c7d8f,0x1));emitVoiceQueueSummary(_0x3c7d8f);};Dialer['prototype'][_0xd8a3('0x20e')]=function(_0x5adf17,_0x5b4ac4,_0xf20b0e,_0x499658,_0xeb6b7f,_0x3cc428){loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x20f'));loggerPredictive['info'](_0xd8a3('0x210'),_0x5adf17);loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x211'),_0x5b4ac4);loggerPredictive['info'](_0xd8a3('0x212'),_0xf20b0e);loggerPredictive['info'](_0xd8a3('0x213'),_0x499658);loggerPredictive[_0xd8a3('0x80')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xeb6b7f);loggerPredictive[_0xd8a3('0x80')]('---------------------------');return new BPromise(function(_0x5b2eaa,_0x66f67d){if(_0x5adf17<=0x0||isNaN(_0x5adf17)){return _0x66f67d(msgResponse('[abandonmentRate]','Error',_0xd8a3('0x214')+_0x5adf17));}if(_0xf20b0e<=0x0||isNaN(_0xf20b0e)){return _0x66f67d(msgResponse(_0xd8a3('0x215'),'Error',_0xd8a3('0x216')+_0xf20b0e));}if(_0x499658<=0x0||isNaN(_0x499658)){return _0x66f67d(msgResponse(_0xd8a3('0x215'),_0xd8a3('0x46'),_0xd8a3('0x217')+_0x499658));}if(_0x5b4ac4<=0x0||isNaN(_0x5b4ac4)){return _0x66f67d(msgResponse('[abandonmentRate]',_0xd8a3('0x46'),_0xd8a3('0x218')+_0x5b4ac4));}if(_0xeb6b7f<=0x0||isNaN(_0xeb6b7f)){return _0x66f67d(msgResponse(_0xd8a3('0x215'),_0xd8a3('0x46'),_0xd8a3('0x219')+_0xeb6b7f));}_0x3cc428=_0x3cc428||0x0;var _0x3c6452=0x1/_0xf20b0e;var _0x3ead11=0x0;var _0x209b58=0x0;var _0x40fd41=0x0;var _0x463a78=0x0;for(var _0x242ba9=0x0;_0x40fd41<_0xeb6b7f;_0x242ba9+=0x1){_0x209b58=_0x242ba9/_0x5b4ac4;_0x3ead11=(_0x499658*_0x209b58+_0x3cc428)/_0x3c6452;_0x40fd41=erlangb(_0x3ead11,_0x5adf17);_0x463a78=_0x3ead11/_0x5adf17*(0x1-erlangb(_0x3ead11,_0x5adf17));}return _0x5b2eaa({'erlangCalls':_0x242ba9,'erlangCallToSecond':_0x5b4ac4/_0x242ba9,'erlangAbandonmentRate':_0x40fd41,'erlangBusyFactor':_0x463a78});});};Dialer['prototype']['busyFactor']=function(_0x30448b,_0x98c48c,_0x792f7,_0x4fd42b,_0x326c5d,_0x3018d9){loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x21a'));loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x210'),_0x30448b);loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x211'),_0x98c48c);loggerPredictive['info']('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',_0x792f7);loggerPredictive[_0xd8a3('0x80')](_0xd8a3('0x213'),_0x4fd42b);loggerPredictive[_0xd8a3('0x80')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x326c5d);loggerPredictive['info'](_0xd8a3('0x86'));return new BPromise(function(_0x5068fe,_0x2e9c84){if(_0x30448b<=0x0||isNaN(_0x30448b)){return _0x2e9c84(msgResponse(_0xd8a3('0x21b'),_0xd8a3('0x46'),'m\x20=\x20'+_0x30448b));}if(_0x792f7<=0x0||isNaN(_0x792f7)){return _0x2e9c84(msgResponse(_0xd8a3('0x21b'),_0xd8a3('0x46'),_0xd8a3('0x216')+_0x792f7));}if(_0x4fd42b<=0x0||isNaN(_0x4fd42b)){return _0x2e9c84(msgResponse('[busyFactor]','Error','p\x20=\x20'+_0x4fd42b));}if(_0x98c48c<=0x0||isNaN(_0x98c48c)){return _0x2e9c84(msgResponse(_0xd8a3('0x21b'),_0xd8a3('0x46'),_0xd8a3('0x218')+_0x98c48c));}if(_0x326c5d<=0x0||isNaN(_0x326c5d)){return _0x2e9c84(msgResponse(_0xd8a3('0x21b'),_0xd8a3('0x46'),_0xd8a3('0x21c')+_0x326c5d));}_0x3018d9=_0x3018d9||0x0;var _0x24aecb=0x1/_0x792f7;var _0x5c701f=0x0;var _0x417a58=0x0;var _0x493d3e=0x0;var _0xf725c6=0x0;for(var _0x3bb504=0x0;_0xf725c6<_0x326c5d;_0x3bb504+=0x1){_0x417a58=_0x3bb504/_0x98c48c;_0x5c701f=(_0x4fd42b*_0x417a58+_0x3018d9)/_0x24aecb;_0x493d3e=erlangb(_0x5c701f,_0x30448b);_0xf725c6=_0x5c701f/_0x30448b*(0x1-erlangb(_0x5c701f,_0x30448b));}return _0x5068fe({'erlangCalls':_0x3bb504,'erlangCallToSecond':_0x98c48c/_0x3bb504,'erlangAbandonmentRate':_0x493d3e,'erlangBusyFactor':_0xf725c6});});};module[_0xd8a3('0x21d')]=Dialer; \ No newline at end of file +var _0xde30=['value','HANGUP','HangupInAMD','membername','amd','[syncHangupInAMD]','dialAMDActive','uniqueid','Machine','AMD','countmachineretry','countglobal','custom:amd','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','rescheduleContact','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','MACHINE','dialMachineMaxRetry','add','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','[syncHangupIvr]','Unknow','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','Drop','dropreason','TIMEOUT','dialQueueProject2','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actions','roundrobin','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','preview','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','contactAgent-idHopper:\x20','run','finally','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','Action','iftime\x20%s,%s','interval','indexOf','command','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','responsetime','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','object','[callProgressDetecting]','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','outboundDropCallsDayTimeout','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','predictiveIntervalPauses','[CatchErlangB]','outboundQueuePauses','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','limitCalls','RUNNING','ivrTotalCallsDays','Contact.phone','loggerHandler','[getContactCampaign2]','dialLimitQueue','dialOrderByScheduledAt','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','ioredis','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','./action','./agentComplete','./queueCallerAbandon','127.0.0.1','prototype','tail','sequence','voiceQueues','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','originateresponse','syncAgentComplete','custom:queuesummary','syncHangup','newexten','varset','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','message','name','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','strategy','available','pTalking','sumDuration','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','md5','voice_queue:save','ivr','format','campaign:save','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','Answered\x20Calls:\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','---------------------------','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','\x22%s\x22\x20<%s>','error','inspect','stack','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','talking','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','status','channel','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','campaigns','queue','[Dialer][checkChannel][ivr]','then','countReScheduled','checkIsBlackList','resolve','verifyAdditionalPhones','catch','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','undefined','emptyContact','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','unmonitored','saveInDb','syncVarSet','variable','amdstatus','xcally-motion-dialer'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xde30,0x13e));var _0x0de3=function(_0x2511e4,_0x208769){_0x2511e4=_0x2511e4-0x0;var _0x4d054d=_0xde30[_0x2511e4];return _0x4d054d;};'use strict';var util=require(_0x0de3('0x0'));var _=require(_0x0de3('0x1'));var BPromise=require(_0x0de3('0x2'));var uuid=require(_0x0de3('0x3'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0x0de3('0x4'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x0de3('0x5'))(_0x0de3('0x6'));var loggerBooked=require(_0x0de3('0x5'))(_0x0de3('0x7'));var loggerPredictive=require('../../../config/logger')(_0x0de3('0x8'));var loggerPredictiveCalls=require(_0x0de3('0x5'))(_0x0de3('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x0de3('0xa'));var ami=require(_0x0de3('0xb'));config[_0x0de3('0xc')]=_[_0x0de3('0xd')](config[_0x0de3('0xc')],{'host':_0x0de3('0xe'),'port':0x18eb});var io=require(_0x0de3('0xf'))(new Redis(config['redis']));var cmHopper=require(_0x0de3('0x10'));var cmHopperHistory=require(_0x0de3('0x11'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperAdditionalPhone=require(_0x0de3('0x12'));var cmHopperBlack=require(_0x0de3('0x13'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x0de3('0x14'));var History=require('./history');var Final=require('./final');var AgentComplete=require(_0x0de3('0x15'));var QueueCallerAbandon=require(_0x0de3('0x16'));var Hangup=require('./hangup');var ipAgi=process['env']['XCALLY_IP_AGI']||_0x0de3('0x17');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x0de3('0x18')]['enqueue']=function(_0x25ae86){this[_0x0de3('0x19')]=this[_0x0de3('0x19')]?this[_0x0de3('0x19')]['finally'](_0x25ae86):_0x25ae86();};function Dialer(_0x3e24dd,_0x264f39){this[_0x0de3('0x1a')]=new Sequence();this['preview']=_0x264f39;this[_0x0de3('0x1b')]=_0x3e24dd[_0x0de3('0x1b')];this['campaigns']=_0x3e24dd['campaigns'];this[_0x0de3('0x1c')]=_0x3e24dd[_0x0de3('0x1c')];this[_0x0de3('0x1d')]=_0x3e24dd['trunks'];this[_0x0de3('0x1e')]=config['maxNumberOriginate']||0x2;this[_0x0de3('0x1f')]={};this['actions']={};this[_0x0de3('0x20')]={};this[_0x0de3('0x21')]={};this[_0x0de3('0x22')]={};this[_0x0de3('0x23')]={};this[_0x0de3('0x24')]={};this[_0x0de3('0x25')]={};this[_0x0de3('0x26')]={};this[_0x0de3('0x27')]={};ami['on'](_0x0de3('0x28'),this[_0x0de3('0x29')][_0x0de3('0x2a')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x0de3('0x2a')](this));ami['on'](_0x0de3('0x2b'),this['syncOriginateResponse'][_0x0de3('0x2a')](this));ami['on']('agentcomplete',this[_0x0de3('0x2c')][_0x0de3('0x2a')](this));ami['on'](_0x0de3('0x2d'),this[_0x0de3('0xa')][_0x0de3('0x2a')](this));ami['on']('hangup',this[_0x0de3('0x2e')][_0x0de3('0x2a')](this));ami['on'](_0x0de3('0x2f'),this['syncNewExten']['bind'](this));ami['on'](_0x0de3('0x30'),this['syncVarSet'][_0x0de3('0x2a')](this));ami['on']('queuemember',this[_0x0de3('0x31')][_0x0de3('0x2a')](this));ami['on']('queuestatuscomplete',this[_0x0de3('0x32')][_0x0de3('0x2a')](this));this[_0x0de3('0x33')]();this[_0x0de3('0x34')]();}function isNotNull(_0x303fb0){return _0x303fb0!==null&&!_[_0x0de3('0x35')](_0x303fb0);}function checkIsLoggedIn(_0x2f2a15,_0x25db11){return function(){if(_0x25db11<=0x0){_0x2f2a15['message']=_0x0de3('0x36');throw _0x2f2a15['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x1bc6d7){return _0x1bc6d7;}function checkIsActive(_0x394c3c,_0x9f99fc){return function(){if(!isActive(_0x9f99fc)){_0x394c3c[_0x0de3('0x37')]='NOT_ACTIVE';throw _0x394c3c[_0x0de3('0x38')]+'\x20NOT\x20Active';}};}function checkInterval(_0x4b8474){return function(){if(!isNotNull(_0x4b8474['Interval'])){_0x4b8474[_0x0de3('0x37')]='INTERVAL_IS_NULL';throw _0x4b8474[_0x0de3('0x38')]+_0x0de3('0x39');}if(!isNotNull(_0x4b8474[_0x0de3('0x3a')][_0x0de3('0x3b')])){_0x4b8474[_0x0de3('0x37')]='INTERVAL_IS_NULL';throw _0x4b8474[_0x0de3('0x38')]+_0x0de3('0x39');}if(!isNotNull(_[_0x0de3('0x3c')](_0x4b8474['Interval'][_0x0de3('0x3b')]))){_0x4b8474[_0x0de3('0x37')]=_0x0de3('0x3d');throw _0x4b8474[_0x0de3('0x38')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x14b57c,_0x290633,_0x3d0677){return{'action':_0x14b57c,'response':_0x290633,'message':_0x3d0677,'stack':_0x3d0677};}function myreject(_0x112292){return function(_0x37ed83){return _0x112292(msgResponse(_0x0de3('0x3e'),_0x0de3('0x3f'),JSON[_0x0de3('0x40')](_0x37ed83)));};}function getSeconds(_0x6782c4,_0x3165e0){var _0x509666=moment(_0x6782c4)[_0x0de3('0x41')](0x0);var _0x3aab87=moment(_0x3165e0)[_0x0de3('0x41')](0x0);return _0x509666[_0x0de3('0x42')](_0x3aab87,_0x0de3('0x43'));}function emit(_0x58ae7c,_0xebedd3,_0x2702bf){io['to'](_0x58ae7c)[_0x0de3('0x44')](_0xebedd3,_0x2702bf);}function emitVoiceQueueSummary(_0x31454e){if(_0x31454e[_0x0de3('0x45')]==='outbound'){var _0x3f6875={'id':_0x31454e['id'],'name':_0x31454e[_0x0de3('0x38')],'strategy':_0x31454e[_0x0de3('0x46')],'answered':_0x31454e['answered'],'available':_0x31454e[_0x0de3('0x47')],'loggedIn':_0x31454e['loggedIn'],'pTalking':_0x31454e[_0x0de3('0x48')],'sumBillable':_0x31454e['sumBillable'],'sumDuration':_0x31454e[_0x0de3('0x49')],'sumHoldTime':_0x31454e[_0x0de3('0x4a')]||0x0,'talking':_0x31454e['talking'],'total':_0x31454e[_0x0de3('0x4b')],'type':_0x31454e[_0x0de3('0x45')],'unmanaged':_0x31454e[_0x0de3('0x4c')],'abandoned':_0x31454e['abandoned'],'waiting':_0x31454e[_0x0de3('0x4d')],'loggedInDb':_0x31454e[_0x0de3('0x4e')],'dialActive':_0x31454e[_0x0de3('0x4f')],'dialMethod':_0x31454e[_0x0de3('0x50')],'dialOriginateCallerIdName':_0x31454e[_0x0de3('0x51')],'dialOriginateCallerIdNumber':_0x31454e[_0x0de3('0x52')],'dialOriginateTimeout':_0x31454e['dialOriginateTimeout'],'dialPrefix':_0x31454e[_0x0de3('0x53')],'outboundAnswerAgiCallsDay':_0x31454e[_0x0de3('0x54')],'outboundAnswerCallsDay':_0x31454e[_0x0de3('0x55')],'outboundBlacklistCallsDay':_0x31454e[_0x0de3('0x56')],'outboundBusyCallsDay':_0x31454e[_0x0de3('0x57')],'outboundCongestionCallsDay':_0x31454e[_0x0de3('0x58')],'outboundDropCallsDayACS':_0x31454e[_0x0de3('0x59')],'outboundDropCallsDayCallersExit':_0x31454e[_0x0de3('0x5a')],'outboundDropCallsDayTimeout':_0x31454e['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x31454e['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x31454e[_0x0de3('0x5b')],'outboundOriginateFailureCallsDay':_0x31454e[_0x0de3('0x5c')],'outboundReCallsDay':_0x31454e[_0x0de3('0x5d')],'outboundRejectCallsDay':_0x31454e[_0x0de3('0x5e')],'outboundUnknownCallsDay':_0x31454e[_0x0de3('0x5f')],'predictiveIntervalAnsweredCalls':_0x31454e[_0x0de3('0x60')],'predictiveIntervalAvgHoldtime':_0x31454e['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x31454e[_0x0de3('0x61')],'predictiveIntervalDroppedCallsCallersExit':_0x31454e[_0x0de3('0x62')],'predictiveIntervalDroppedCallsTimeout':_0x31454e[_0x0de3('0x63')],'predictiveIntervalErlangCalls':_0x31454e[_0x0de3('0x64')],'predictiveIntervalErlangCallsDroppedCalls':_0x31454e[_0x0de3('0x65')],'predictiveIntervalHitRate':_0x31454e[_0x0de3('0x66')],'predictiveIntervalMultiplicativeFactor':_0x31454e['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x31454e['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x31454e[_0x0de3('0x67')],'predictiveIntervalTotalCalls':_0x31454e[_0x0de3('0x68')],'message':_0x31454e[_0x0de3('0x37')],'originated':_0x31454e[_0x0de3('0x69')],'erlangCalls':_0x31454e[_0x0de3('0x6a')],'erlangCallToSecond':_0x31454e[_0x0de3('0x6b')],'erlangAbandonmentRate':_0x31454e[_0x0de3('0x6c')],'erlangBusyFactor':_0x31454e[_0x0de3('0x6d')],'startPredictive':_0x31454e[_0x0de3('0x23')],'startProgressive':_0x31454e[_0x0de3('0x24')]};if(_0x31454e['Trunk']){_0x3f6875[_0x0de3('0x6e')]={'id':_0x31454e[_0x0de3('0x6e')]['id'],'name':_0x31454e[_0x0de3('0x6e')]['name'],'active':_0x31454e[_0x0de3('0x6e')][_0x0de3('0x6f')],'callerid':_0x31454e[_0x0de3('0x6e')][_0x0de3('0x70')]};}if(_0x31454e[_0x0de3('0x3a')]){_0x3f6875['Interval']={'id':_0x31454e[_0x0de3('0x3a')]['id'],'name':_0x31454e[_0x0de3('0x3a')][_0x0de3('0x38')]};}var _0x433000=md5(JSON['stringify'](_0x3f6875));if(_0x31454e['md5']!==_0x433000){_0x31454e[_0x0de3('0x71')]=_0x433000;emit(util['format']('voice:queue:%s',_0x3f6875['name']),_0x0de3('0x72'),_0x3f6875);}}}function emitCampaignSummary(_0x558153){if(_0x558153[_0x0de3('0x45')]===_0x0de3('0x73')){emit(util[_0x0de3('0x74')]('campaign:ivr:%s',_0x558153[_0x0de3('0x38')]),_0x0de3('0x75'),_0x558153);}}function checkGetDataPredictive(_0x115564){if(isNotNull(_0x115564)&&!_['isEmpty'](_0x115564)){loggerPredictive['info'](_0x0de3('0x76'));loggerPredictive['info'](_0x0de3('0x77'),_0x115564[_0x0de3('0x68')]);loggerPredictive[_0x0de3('0x78')](_0x0de3('0x79'),_0x115564[_0x0de3('0x60')]);loggerPredictive[_0x0de3('0x78')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x115564[_0x0de3('0x63')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x115564[_0x0de3('0x62')]);loggerPredictive[_0x0de3('0x78')](_0x0de3('0x7a'),_0x115564['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x0de3('0x78')](_0x0de3('0x7b'),_0x115564[_0x0de3('0x61')]);loggerPredictive['info'](_0x0de3('0x7c'));if(_0x115564[_0x0de3('0x68')]>0x0){if(!_[_0x0de3('0x35')](_0x115564[_0x0de3('0x61')])&&_0x115564[_0x0de3('0x61')]>0x0){return!![];}loggerPredictive[_0x0de3('0x78')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x0de3('0x35')](_0x115564[_0x0de3('0x7d')])&&_0x115564['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0x0de3('0x7e'));}else{loggerPredictive[_0x0de3('0x78')](_0x0de3('0x7f'));}}else{loggerPredictive[_0x0de3('0x78')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2b49ed){return function(_0x42c03e){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x0de3('0x78')](_0x0de3('0x80'),_0x42c03e[_0x0de3('0x6a')]);loggerPredictive[_0x0de3('0x78')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42c03e[_0x0de3('0x6b')]);loggerPredictive[_0x0de3('0x78')](_0x0de3('0x81'),_0x42c03e[_0x0de3('0x6c')]);loggerPredictive[_0x0de3('0x78')](_0x0de3('0x82'),_0x42c03e[_0x0de3('0x6d')]);loggerPredictive[_0x0de3('0x78')](_0x0de3('0x81'),_0x42c03e[_0x0de3('0x6c')]);loggerPredictive[_0x0de3('0x78')](_0x0de3('0x7c'));_[_0x0de3('0x83')](_0x2b49ed,_0x42c03e);};}function getDiff(_0x3d5c79){var _0x5d4f0d=moment()[_0x0de3('0x41')](0x0);var _0x4f48b6=moment(_0x3d5c79)['milliseconds'](0x0);return _0x5d4f0d[_0x0de3('0x42')](_0x4f48b6,_0x0de3('0x43'));}function ifInterval(_0x473ec7,_0x20780d){if(_[_0x0de3('0x35')](_0x20780d)){return![];}return getDiff(_0x20780d)<_0x473ec7*0x3c;}function freeVariablesPredictive(_0x2fd079){if(isNotNull(_0x2fd079)){if(!_[_0x0de3('0x35')](_0x2fd079[_0x0de3('0x24')])){_0x2fd079[_0x0de3('0x24')]=undefined;loggerPredictive[_0x0de3('0x78')](_0x2fd079[_0x0de3('0x38')],_0x0de3('0x84'));}if(!_[_0x0de3('0x35')](_0x2fd079['startPredictive'])){_0x2fd079[_0x0de3('0x23')]=undefined;loggerPredictive['info'](_0x2fd079['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x0de3('0x35')](_0x2fd079[_0x0de3('0x85')])){clearInterval(_0x2fd079['handlePredictive']);_0x2fd079['handlePredictive']=undefined;loggerPredictive[_0x0de3('0x78')](_0x2fd079['name'],_0x0de3('0x86'));}}}function erlangb(_0x535ed2,_0x54d44a){if(_0x54d44a===0x0){return 0x0;}var _0x45534b=0x1;for(var _0x8eec5a=0x1;_0x8eec5a<=_0x54d44a;_0x8eec5a+=0x1){_0x45534b=0x1+_0x45534b*_0x8eec5a/_0x535ed2;}return 0x1/_0x45534b;}function isVoiceQueueOutbound(_0x4cc92a){return _0x4cc92a===_0x0de3('0x87');}function isNotPreview(_0x39e396){return _0x39e396!=='preview';}function isCampaignIvr(_0x5b4b56){return _0x5b4b56===_0x0de3('0x73');}function getCallerId(_0x4bd404,_0x39ac44,_0x33b0be){if(!_[_0x0de3('0x35')](_0x33b0be)&&typeof _0x33b0be==='string'&&!_['isEmpty'](_0x33b0be)){if(!_[_0x0de3('0x35')](_0x39ac44)&&typeof _0x39ac44==='string'&&!_['isEmpty'](_0x39ac44)){return util[_0x0de3('0x74')](_0x0de3('0x88'),_0x39ac44,_0x33b0be);}return util[_0x0de3('0x74')](_0x0de3('0x88'),_0x33b0be,_0x33b0be);}if(!_[_0x0de3('0x35')](_0x4bd404)&&typeof _0x4bd404==='string'&&!_[_0x0de3('0x3c')](_0x4bd404)){return _0x4bd404;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4d921c,_0x44e85f){return function(_0x2447e5){freeVariablesPredictive(_0x44e85f);emitVoiceQueueSummary(_0x44e85f);emitCampaignSummary(_0x44e85f);loggerSyncQueueSummary[_0x0de3('0x89')](_0x4d921c,util[_0x0de3('0x8a')](_0x2447e5,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x14016b,_0x56e071){return function(_0x20a5fc){loggerPredictive[_0x0de3('0x89')](_0x56e071[_0x0de3('0x38')],_0x14016b);loggerPredictive[_0x0de3('0x89')](_0x20a5fc[_0x0de3('0x8b')]);freeVariablesPredictive(_0x56e071);};}function loggerCatch(_0x1d11ff){return function(_0x2d4a76){logger[_0x0de3('0x89')](_0x1d11ff,util['inspect'](_0x2d4a76,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x586754){return _0x586754&&!_[_0x0de3('0x35')](_0x586754)&&_0x586754['length']>0x0;}function decremetOriginate(_0xb95353){if(!_['isUndefined'](_0xb95353)&&_0xb95353!==null){if(typeof _0xb95353[_0x0de3('0x69')]!=='undefined'){if(_0xb95353['originated']>0x0){_0xb95353[_0x0de3('0x69')]-=0x1;}else{logger['error'](_0x0de3('0x8c'));}}}else{logger[_0x0de3('0x89')](_0x0de3('0x8d'));}}function checkContactLowerLimitOriginate(_0x3877f9,_0x231ee7,_0x3f64fa){if(_0x231ee7>_0x3f64fa){for(var _0x46b864=0x0;_0x46b864<_0x231ee7-_0x3f64fa;_0x46b864+=0x1){decremetOriginate(_0x3877f9);}}}function loggerGetContactDialer(_0xabb7ec,_0x2975cb,_0x2cca30){return function(_0x515681){checkContactLowerLimitOriginate(_0x2975cb,_0x2cca30,0x0);logger[_0x0de3('0x89')](_0xabb7ec,util['inspect'](_0x515681,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x7dde38){return function(_0x21733e){if(isNotNull(_0x21733e)&&isNotNull(_0x21733e[0x0])){if(_0x21733e[0x0][_0x0de3('0x8e')]>0x0){_0x7dde38['message']='RESCHEDULED_CONTACTS';logger[_0x0de3('0x78')](_0x0de3('0x8f')+_0x7dde38[_0x0de3('0x38')],_0x21733e[0x0][_0x0de3('0x8e')],'contacts');}else{_0x7dde38[_0x0de3('0x37')]=_0x0de3('0x90');logger[_0x0de3('0x78')]('[getContactDialer2][Empty]'+_0x7dde38[_0x0de3('0x38')]);}}};}function notSendMessagesQueue(_0x2c200a){if(_0x2c200a['sendMessageOneNotActive']){freeVariablesPredictive(_0x2c200a);if(_0x2c200a[_0x0de3('0x69')]===0x0&&_0x2c200a[_0x0de3('0x91')]===0x0&&_0x2c200a[_0x0de3('0x4d')]===0x0&&(_0x2c200a[_0x0de3('0x48')]||0x0)===0x0){_0x2c200a['sendMessageOneNotActive']=![];_0x2c200a[_0x0de3('0x47')]=0x0;_0x2c200a[_0x0de3('0x37')]=_0x0de3('0x92');loggerSyncQueueSummary['error'](_0x0de3('0x93'),_0x2c200a[_0x0de3('0x38')],_0x0de3('0x94'));}else{_0x2c200a['message']=_0x0de3('0x95');loggerSyncQueueSummary[_0x0de3('0x89')](_0x0de3('0x93'),_0x2c200a[_0x0de3('0x38')],_0x0de3('0x96'));}emitVoiceQueueSummary(_0x2c200a);}}function notSendMessagesCampaign(_0x22f1b4){if(_0x22f1b4['sendMessageOneNotActive']){if(_0x22f1b4[_0x0de3('0x69')]===0x0){_0x22f1b4[_0x0de3('0x97')]=![];_0x22f1b4[_0x0de3('0x37')]=_0x0de3('0x92');loggerSyncQueueSummary[_0x0de3('0x89')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x22f1b4[_0x0de3('0x38')],_0x0de3('0x94'));}else{_0x22f1b4[_0x0de3('0x37')]=_0x0de3('0x95');loggerSyncQueueSummary[_0x0de3('0x89')](_0x0de3('0x98'),_0x22f1b4['name'],_0x0de3('0x96'));}emitCampaignSummary(_0x22f1b4);}}function createObjHistory(_0x4a9879,_0x277ab3,_0x366ec0,_0xb28a4c,_0x68f553){_0x4a9879[_0x0de3('0x37')]=_0x366ec0;var _0x25e2b8=new Action(_0x4a9879,_0x277ab3);var _0x15ead5=new History(_0x25e2b8);_0x15ead5[_0x0de3('0x99')]=_0xb28a4c;_0x15ead5[_0x0de3('0x9a')]=_0x68f553;_0x15ead5['endtime']=_0x25e2b8[_0x0de3('0x9b')];return _0x15ead5;}Dialer[_0x0de3('0x18')]['loopClearZombieChannels']=function(){var _0x2d8d5a=this;setInterval(function(){_0x2d8d5a[_0x0de3('0x9c')](_0x2d8d5a[_0x0de3('0x21')],_0x0de3('0x9d'));_0x2d8d5a[_0x0de3('0x9c')](_0x2d8d5a['actions'],_0x0de3('0x9e'));},0x32c8);};Dialer['prototype'][_0x0de3('0x9c')]=function(_0x407dc1,_0xd72955){var _0x5a12cc=this;for(var _0x5403fc in _0x407dc1){if(typeof _0x407dc1[_0x5403fc]!=='undefined'){this[_0x0de3('0x1a')]['enqueue'](function(){if(!_[_0x0de3('0x9f')](_0x407dc1[_0x5403fc])){return ami['Action']({'action':_0x0de3('0xa0'),'channel':_0x407dc1[_0x5403fc][_0x0de3('0xa1')]})['catch'](function(_0x3af4fe){if(_0x3af4fe[_0x0de3('0x37')]===_0x0de3('0xa2')){setTimeout(function(){if(_0x407dc1[_0x5403fc]&&_0x407dc1[_0x5403fc]['type']!=='ivr'){_0x5a12cc[_0x0de3('0xa3')](_0x5a12cc[_0x0de3('0x1b')][_0x407dc1[_0x5403fc]['queue']]);logger['error'](_0x0de3('0xa4'),_0xd72955,_0x5403fc,_0x407dc1[_0x5403fc]['queue']);delete _0x407dc1[_0x5403fc];}if(_0x407dc1[_0x5403fc]&&_0x407dc1[_0x5403fc][_0x0de3('0x45')]===_0x0de3('0x73')){_0x5a12cc['updateOriginated'](_0x5a12cc[_0x0de3('0xa5')][_0x407dc1[_0x5403fc][_0x0de3('0xa6')]]);logger[_0x0de3('0x89')](_0x0de3('0xa7'),_0xd72955,_0x5403fc,_0x407dc1[_0x5403fc][_0x0de3('0xa6')]);delete _0x407dc1[_0x5403fc];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x1f26cf){return BPromise['resolve']()[_0x0de3('0xa8')](cmHopper[_0x0de3('0xa9')](_0x1f26cf))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x0de3('0xaa')]=function(_0x421331){return BPromise[_0x0de3('0xab')]()[_0x0de3('0xa8')](cmHopperBlack[_0x0de3('0xaa')](_0x421331))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x0de3('0x18')][_0x0de3('0xac')]=function(_0x32d1e0,_0x52eb11,_0x1d5838){return BPromise[_0x0de3('0xab')]()[_0x0de3('0xa8')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x32d1e0,_0x52eb11,_0x1d5838))[_0x0de3('0xad')](loggerCatch(_0x0de3('0xae')));};Dialer['prototype'][_0x0de3('0xaf')]=function(_0x1d7fcc,_0xedb8b2,_0x43e7b2){return BPromise['resolve']()['then'](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1d7fcc,_0xedb8b2,_0x43e7b2))[_0x0de3('0xad')](loggerCatch(_0x0de3('0xb0')));};Dialer[_0x0de3('0x18')][_0x0de3('0xb1')]=function(_0x71f5af){return BPromise[_0x0de3('0xab')]()[_0x0de3('0xa8')](cmHopperBlack[_0x0de3('0xb1')](_0x71f5af))[_0x0de3('0xad')](loggerCatch(_0x0de3('0xb2')));};Dialer[_0x0de3('0x18')][_0x0de3('0xb3')]=function(_0x47e3cb){return BPromise[_0x0de3('0xab')]()[_0x0de3('0xa8')](cmHopperHistory[_0x0de3('0xb4')](_0x47e3cb))['catch'](loggerCatch(_0x0de3('0xb5')));};Dialer[_0x0de3('0x18')]['rescheduleContact']=function(_0x60fbaa){return BPromise[_0x0de3('0xab')]()['then'](cmHopper['rescheduleContact'](_0x60fbaa))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x0de3('0x18')][_0x0de3('0xb6')]=function(_0x4d49c3,_0x40265b,_0x5d9877){return BPromise[_0x0de3('0xab')]()[_0x0de3('0xa8')](cmHopper['unlockContact'](_0x4d49c3,_0x40265b,_0x5d9877))[_0x0de3('0xad')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x0de3('0x18')][_0x0de3('0xb7')]=function(_0x5c7b97,_0x469285,_0x54ca3d,_0x1e6ffd,_0x8ff037){return BPromise[_0x0de3('0xab')]()['then'](cmHopper[_0x0de3('0xb7')](_0x5c7b97,_0x469285,_0x54ca3d,_0x1e6ffd))[_0x0de3('0xad')](function(_0x109e61){_0x8ff037[_0x0de3('0xb8')]-=_0x54ca3d;_0x8ff037[_0x0de3('0xb8')]=_0x8ff037[_0x0de3('0xb8')]>0x0?_0x8ff037[_0x0de3('0xb8')]:0x0;loggerCatch(_0x0de3('0xb9'))(_0x109e61);});};Dialer[_0x0de3('0x18')][_0x0de3('0xba')]=function(_0x58386d,_0x4f8a71,_0xb1d489,_0x10fca2){return BPromise['resolve']()['then'](cmHopper[_0x0de3('0xba')](_0x58386d,_0x4f8a71,_0xb1d489))[_0x0de3('0xad')](function(_0x5c780e){_0x10fca2['temp']-=_0x4f8a71;_0x10fca2[_0x0de3('0xb8')]=_0x10fca2[_0x0de3('0xb8')]>0x0?_0x10fca2['temp']:0x0;loggerCatch(_0x0de3('0xbb'))(_0x5c780e);});};Dialer['prototype'][_0x0de3('0xbc')]=function(_0x5e3094){return BPromise[_0x0de3('0xab')]()[_0x0de3('0xa8')](voiceQueueRt[_0x0de3('0xbc')](_0x5e3094))[_0x0de3('0xad')](loggerCatch(_0x0de3('0xbd')));};Dialer[_0x0de3('0x18')][_0x0de3('0xbe')]=function(_0x2d1316){return BPromise['resolve']()['then'](cmHopper[_0x0de3('0xbe')](_0x2d1316))['catch'](loggerCatch(_0x0de3('0xbf')));};Dialer[_0x0de3('0x18')][_0x0de3('0xc0')]=function(_0x3fd2cd){return BPromise['resolve']()[_0x0de3('0xa8')](cmHopperHistory[_0x0de3('0xc0')](_0x3fd2cd))[_0x0de3('0xad')](loggerCatch('[createHistory]\x20'));};Dialer[_0x0de3('0x18')][_0x0de3('0xa3')]=function(_0x4a96e2){if(!_['isUndefined'](_0x4a96e2)&&_0x4a96e2!==null){if(typeof _0x4a96e2[_0x0de3('0x69')]!==_0x0de3('0xc1')){if(_0x4a96e2[_0x0de3('0x69')]>0x0){_0x4a96e2[_0x0de3('0x69')]-=0x1;}else{logger[_0x0de3('0x89')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x0de3('0x89')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x0de3('0x18')]['loggerHandler']=function(_0x296d32,_0x48f2b2){var _0x2da02f=this;return function(_0x17b0c5){_0x2da02f[_0x0de3('0xa3')](_0x48f2b2);logger[_0x0de3('0x89')](_0x296d32,util[_0x0de3('0x8a')](_0x17b0c5,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x0de3('0xc2')]=function(_0x249e7b,_0x37c7bd,_0x337d24){var _0x469fcc={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x37c7bd);this['saveInDb'](_[_0x0de3('0x83')](_0x469fcc,_[_0x0de3('0xc3')](_0x337d24,[_0x0de3('0xc4'),_0x0de3('0xc5'),_0x0de3('0xc6'),_0x0de3('0xc7'),_0x0de3('0xc8')])),_0x0de3('0xc9'),_0x0de3('0xca'));logger[_0x0de3('0x89')](_0x249e7b);};Dialer[_0x0de3('0x18')][_0x0de3('0xcb')]=function(_0x22dff6){return _0x22dff6===_0x0de3('0xcc');};Dialer[_0x0de3('0x18')][_0x0de3('0xcd')]=function(_0x1aa857){return!_['isUndefined'](_0x1aa857)&&_0x1aa857&&!_[_0x0de3('0x35')](_0x1aa857[_0x0de3('0x38')])&&!_[_0x0de3('0x35')](_0x1aa857[_0x0de3('0x6f')])&&_0x1aa857[_0x0de3('0x6f')]&&(this[_0x0de3('0x1d')][util[_0x0de3('0x74')]('SIP/%s',_0x1aa857[_0x0de3('0x38')])][_0x0de3('0xa0')]===_0x0de3('0xce')||this[_0x0de3('0x1d')][util[_0x0de3('0x74')](_0x0de3('0xcf'),_0x1aa857[_0x0de3('0x38')])][_0x0de3('0xa0')]===_0x0de3('0xd0'));};Dialer['prototype'][_0x0de3('0xd1')]=function(_0x7a168c,_0x197915,_0x18b894){this[_0x0de3('0xc0')](_0x7a168c)[_0x0de3('0xad')](loggerCatch(_0x197915));this[_0x0de3('0xbe')](_0x7a168c)['catch'](loggerCatch(_0x18b894));};Dialer['prototype'][_0x0de3('0xd2')]=function(_0x15fbad){var _0x2cce9a=this[_0x0de3('0x21')][_0x15fbad['uniqueid']];var _0x34ddde;if(!_[_0x0de3('0x9f')](_0x15fbad)&&!_[_0x0de3('0x9f')](_0x15fbad[_0x0de3('0xd3')])&&!_[_0x0de3('0x9f')](_0x15fbad['variable'][_0x0de3('0xd4')])&&_0x15fbad['exten']===_0x0de3('0xd5')&&_0x2cce9a){if(_0x2cce9a[_0x0de3('0x45')]!==_0x0de3('0x73')&&this[_0x0de3('0x1b')][_0x2cce9a[_0x0de3('0xa6')]]['dialAMDActive']&&_0x15fbad[_0x0de3('0xd6')]===_0x0de3('0xd7')){delete this['uniqueId'][_0x15fbad['uniqueid']];this[_0x0de3('0xa3')](this[_0x0de3('0x1b')][_0x2cce9a[_0x0de3('0xa6')]]);this[_0x0de3('0x1b')][_0x2cce9a[_0x0de3('0xa6')]][_0x0de3('0x55')]+=0x1;this[_0x0de3('0x1b')][_0x2cce9a['queue']][_0x0de3('0x54')]+=0x1;_0x34ddde=new Hangup(_0x2cce9a,_0x15fbad);_0x34ddde[_0x0de3('0x99')]=0x12;_0x34ddde[_0x0de3('0x9a')]=_0x0de3('0xd8');_0x34ddde[_0x0de3('0xd9')]='AMD';ami[_0x0de3('0x44')]('custom:amd',ut['buildObj'](_0x34ddde,_0x0de3('0xda')));this[_0x0de3('0xd1')](_0x34ddde,'[syncHangupInAMD][createHistory]',_0x0de3('0xdb'));}if(_0x2cce9a[_0x0de3('0x45')]!=='ivr'&&this[_0x0de3('0x1b')][_0x2cce9a[_0x0de3('0xa6')]][_0x0de3('0xdc')]&&_0x15fbad['value']==='MACHINE'){var _0x4924c4=this;return new BPromise(function(_0x2aa30a,_0xe13842){delete _0x4924c4[_0x0de3('0x21')][_0x15fbad[_0x0de3('0xdd')]];_0x4924c4[_0x0de3('0xa3')](_0x4924c4[_0x0de3('0x1b')][_0x2cce9a[_0x0de3('0xa6')]]);_0x4924c4[_0x0de3('0x1b')][_0x2cce9a[_0x0de3('0xa6')]]['outboundAnswerCallsDay']+=0x1;_0x4924c4[_0x0de3('0x1b')][_0x2cce9a['queue']][_0x0de3('0x54')]+=0x1;var _0x2c9d0c=_0x4924c4['voiceQueues'][_0x2cce9a[_0x0de3('0xa6')]];var _0x40e6c3=new Hangup(_0x2cce9a,_0x15fbad);_0x40e6c3[_0x0de3('0x99')]=0x13;_0x40e6c3[_0x0de3('0x9a')]=_0x0de3('0xde');_0x40e6c3[_0x0de3('0xd9')]=_0x0de3('0xdf');_0x40e6c3[_0x0de3('0xe0')]+=0x1;_0x40e6c3[_0x0de3('0xe1')]+=0x1;_0x40e6c3[_0x0de3('0xda')]=!![];ami[_0x0de3('0x44')](_0x0de3('0xe2'),ut[_0x0de3('0xe3')](_0x40e6c3,_0x0de3('0xda')));_0x4924c4[_0x0de3('0xc0')](_0x40e6c3)['catch'](loggerCatch(_0x0de3('0xe4')));if(_0x40e6c3[_0x0de3('0xe5')]+_0x40e6c3[_0x0de3('0xe6')]+_0x40e6c3['countnoanswerretry']+_0x40e6c3[_0x0de3('0xe7')]+_0x40e6c3[_0x0de3('0xe8')]+_0x40e6c3[_0x0de3('0xe9')]+_0x40e6c3['countmachineretry']+_0x40e6c3[_0x0de3('0xea')]>=_0x2c9d0c[_0x0de3('0xeb')]){_0x4924c4[_0x0de3('0xec')](_0x40e6c3,_0x2aa30a,_0xe13842,_0x0de3('0xed'));}else{if(_0x40e6c3[_0x0de3('0xe0')]>=_0x2c9d0c['dialMachineMaxRetry']){_0x4924c4[_0x0de3('0xee')](_0x40e6c3,_0x2aa30a,_0xe13842,_0x0de3('0xef'));}else{_0x4924c4[_0x0de3('0xf0')]({'active':![],'countmachineretry':_0x40e6c3[_0x0de3('0xe0')],'scheduledat':moment()['add'](_0x2c9d0c[_0x0de3('0xf1')],'minutes')[_0x0de3('0x74')](_0x0de3('0xf2')),'ContactId':_0x40e6c3[_0x0de3('0xc4')],'ListId':_0x40e6c3[_0x0de3('0xc5')],'VoiceQueueId':_0x40e6c3[_0x0de3('0xc7')]||undefined,'CampaignId':_0x40e6c3[_0x0de3('0xc8')]||undefined})[_0x0de3('0xad')](loggerCatch(_0x0de3('0xf3')));_0x2aa30a({'reschedule':0x1});}}});}if(_0x2cce9a[_0x0de3('0x45')]==='ivr'&&this[_0x0de3('0xa5')][_0x2cce9a[_0x0de3('0xa6')]][_0x0de3('0xdc')]&&_0x15fbad[_0x0de3('0xd6')]===_0x0de3('0xd7')){delete this[_0x0de3('0x21')][_0x15fbad[_0x0de3('0xdd')]];this[_0x0de3('0xa3')](this[_0x0de3('0xa5')][_0x2cce9a['queue']]);_0x34ddde=new Hangup(_0x2cce9a,_0x15fbad);_0x34ddde[_0x0de3('0x99')]=0x12;_0x34ddde[_0x0de3('0x9a')]=_0x0de3('0xd8');_0x34ddde[_0x0de3('0xd9')]=_0x0de3('0xdf');ami['emit'](_0x0de3('0xe2'),ut[_0x0de3('0xe3')](_0x34ddde,_0x0de3('0xda')));this[_0x0de3('0xd1')](_0x34ddde,_0x0de3('0xf4'),'[syncHangupInAMDIvr]');}if(_0x2cce9a[_0x0de3('0x45')]===_0x0de3('0x73')&&this[_0x0de3('0xa5')][_0x2cce9a[_0x0de3('0xa6')]][_0x0de3('0xdc')]&&_0x15fbad['value']===_0x0de3('0xf5')){var _0x4924c4=this;return new BPromise(function(_0x30d5c7,_0x2d164f){delete _0x4924c4['uniqueId'][_0x15fbad[_0x0de3('0xdd')]];_0x4924c4['updateOriginated'](_0x4924c4[_0x0de3('0xa5')][_0x2cce9a['queue']]);_0x4924c4[_0x0de3('0xa5')][_0x2cce9a[_0x0de3('0xa6')]]['outboundAnswerCallsDay']+=0x1;_0x4924c4['campaigns'][_0x2cce9a[_0x0de3('0xa6')]][_0x0de3('0x54')]+=0x1;var _0x2485d8=_0x4924c4[_0x0de3('0xa5')][_0x2cce9a['queue']];var _0x56281d=new Hangup(_0x2cce9a,_0x15fbad);_0x56281d[_0x0de3('0x99')]=0x13;_0x56281d[_0x0de3('0x9a')]='Machine';_0x56281d[_0x0de3('0xd9')]=_0x0de3('0xdf');_0x56281d['countmachineretry']+=0x1;_0x56281d[_0x0de3('0xe1')]+=0x1;_0x56281d['amd']=!![];ami['emit'](_0x0de3('0xe2'),ut[_0x0de3('0xe3')](_0x56281d,'amd'));_0x4924c4[_0x0de3('0xc0')](_0x56281d)[_0x0de3('0xad')](loggerCatch(_0x0de3('0xe4')));if(_0x56281d[_0x0de3('0xe5')]+_0x56281d[_0x0de3('0xe6')]+_0x56281d['countnoanswerretry']+_0x56281d[_0x0de3('0xe7')]+_0x56281d[_0x0de3('0xe8')]+_0x56281d[_0x0de3('0xe9')]+_0x56281d[_0x0de3('0xe0')]+_0x56281d[_0x0de3('0xea')]>=_0x2485d8[_0x0de3('0xeb')]){_0x4924c4[_0x0de3('0xec')](_0x56281d,_0x30d5c7,_0x2d164f,_0x0de3('0xed'));}else{if(_0x56281d[_0x0de3('0xe0')]>=_0x2485d8[_0x0de3('0xf6')]){_0x4924c4[_0x0de3('0xee')](_0x56281d,_0x30d5c7,_0x2d164f,_0x0de3('0xef'));}else{_0x4924c4[_0x0de3('0xf0')]({'active':![],'countmachineretry':_0x56281d[_0x0de3('0xe0')],'scheduledat':moment()[_0x0de3('0xf7')](_0x2485d8[_0x0de3('0xf1')],_0x0de3('0xf8'))[_0x0de3('0x74')](_0x0de3('0xf2')),'ContactId':_0x56281d[_0x0de3('0xc4')],'ListId':_0x56281d[_0x0de3('0xc5')],'VoiceQueueId':_0x56281d[_0x0de3('0xc7')]||undefined,'CampaignId':_0x56281d['CampaignId']||undefined})[_0x0de3('0xad')](loggerCatch(_0x0de3('0xf3')));_0x30d5c7({'reschedule':0x1});}}});}}};Dialer[_0x0de3('0x18')][_0x0de3('0x2e')]=function(_0x5b4d8a){var _0x374a3d=this[_0x0de3('0x21')][_0x5b4d8a[_0x0de3('0xdd')]];var _0x53f9a0=this;var _0x4b51f6;if(_0x374a3d&&_0x374a3d[_0x0de3('0x45')]===_0x0de3('0x73')){delete this[_0x0de3('0x21')][_0x5b4d8a['uniqueid']];this[_0x0de3('0xa3')](this['campaigns'][_0x374a3d[_0x0de3('0xa6')]]);this[_0x0de3('0xa5')][_0x374a3d[_0x0de3('0xa6')]][_0x0de3('0xf9')]+=0x1;_0x4b51f6=new Hangup(_0x374a3d,_0x5b4d8a);this['createHistory'](_0x4b51f6)['catch'](loggerCatch(_0x0de3('0xfa')));this['moveContactManagedDialer'](_0x4b51f6)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x374a3d&&_0x374a3d[_0x0de3('0x45')]!==_0x0de3('0x73')&&isNotNull(this['voiceQueues'][_0x374a3d[_0x0de3('0xa6')]][_0x0de3('0xfb')])){delete this[_0x0de3('0x21')][_0x5b4d8a[_0x0de3('0xdd')]];this[_0x0de3('0xa3')](this[_0x0de3('0x1b')][_0x374a3d['queue']]);this[_0x0de3('0x1b')][_0x374a3d['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x0de3('0x1b')][_0x374a3d[_0x0de3('0xa6')]][_0x0de3('0x54')]+=0x1;_0x4b51f6=new Hangup(_0x374a3d,_0x5b4d8a);_0x4b51f6['state']=0x10;_0x4b51f6[_0x0de3('0x9a')]=_0x0de3('0xfc');_0x4b51f6['membername']='AGI';this[_0x0de3('0xc0')](_0x4b51f6)['catch'](loggerCatch(_0x0de3('0xfa')));this['moveContactManagedDialer'](_0x4b51f6)[_0x0de3('0xad')](loggerCatch(_0x0de3('0xfd')));}if(_0x374a3d&&_0x374a3d[_0x0de3('0x45')]!==_0x0de3('0x73')&&!isNotNull(this['voiceQueues'][_0x374a3d[_0x0de3('0xa6')]][_0x0de3('0xfb')])){delete this['uniqueId'][_0x5b4d8a[_0x0de3('0xdd')]];this[_0x0de3('0xa3')](this[_0x0de3('0x1b')][_0x374a3d['queue']]);this['voiceQueues'][_0x374a3d[_0x0de3('0xa6')]][_0x0de3('0x5f')]+=0x1;_0x4b51f6=new Hangup(_0x374a3d,_0x5b4d8a);_0x4b51f6[_0x0de3('0x99')]=0xc;_0x4b51f6[_0x0de3('0x9a')]=_0x5b4d8a['cause-txt'];_0x4b51f6[_0x0de3('0xd9')]=_0x0de3('0xfe');this['createHistory'](_0x4b51f6)[_0x0de3('0xad')](loggerCatch(_0x0de3('0xfa')));this['moveContactManagedDialer'](_0x4b51f6)['catch'](loggerCatch(_0x0de3('0xfd')));}};Dialer[_0x0de3('0x18')][_0x0de3('0x2c')]=function(_0x587646){var _0x3ee068=this[_0x0de3('0x21')][_0x587646[_0x0de3('0xdd')]];var _0x492174=this;if(this['voiceQueues'][_0x587646[_0x0de3('0xa6')]]){if(_0x3ee068&&_0x3ee068[_0x0de3('0x45')]!=='ivr'){delete this[_0x0de3('0x21')][_0x587646[_0x0de3('0xdd')]];this['voiceQueues'][_0x587646[_0x0de3('0xa6')]][_0x0de3('0x55')]+=0x1;var _0x5f0630=new AgentComplete(_0x3ee068,_0x587646);if(_0x587646[_0x0de3('0xff')]===_0x0de3('0x100')){_0x5f0630[_0x0de3('0x101')]=this[_0x0de3('0x1b')][_0x587646['queue']]['dialQueueProject2']&&this[_0x0de3('0x1b')][_0x587646[_0x0de3('0xa6')]][_0x0de3('0x102')]?moment()[_0x0de3('0x74')](_0x0de3('0xf2')):undefined;}this[_0x0de3('0xc0')](_0x5f0630)['catch'](loggerCatch(_0x0de3('0x103')));this[_0x0de3('0xbe')](_0x5f0630)[_0x0de3('0xad')](loggerCatch(_0x0de3('0x104')));}}};Dialer['prototype'][_0x0de3('0x29')]=function(_0x4a6a70){if(this[_0x0de3('0x1b')][_0x4a6a70[_0x0de3('0xa6')]]){if(this['uniqueId'][_0x4a6a70[_0x0de3('0xdd')]]&&this[_0x0de3('0x21')][_0x4a6a70[_0x0de3('0xdd')]][_0x0de3('0x45')]!==_0x0de3('0x73')){this[_0x0de3('0xa3')](this[_0x0de3('0x1b')][_0x4a6a70[_0x0de3('0xa6')]]);this[_0x0de3('0x21')][_0x4a6a70[_0x0de3('0xdd')]]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0x0de3('0x105')]=function(_0x2989f6,_0x10633f){this[_0x0de3('0xc0')](_0x2989f6)[_0x0de3('0xad')](loggerCatch(_0x0de3('0x103')));if(_0x10633f==0x0){this[_0x0de3('0xbe')](_0x2989f6)['catch'](loggerCatch(_0x0de3('0x106')));}};Dialer[_0x0de3('0x18')][_0x0de3('0x107')]=function(_0x182431){var _0x150093=this[_0x0de3('0x21')][_0x182431[_0x0de3('0xdd')]];var _0x2485c6=this;var _0x2b45ab=![];var _0x53ee42;var _0x50905c;if(this[_0x0de3('0x1b')][_0x182431['queue']]){if(_0x150093&&_0x150093[_0x0de3('0x45')]!==_0x0de3('0x73')){delete this['uniqueId'][_0x182431[_0x0de3('0xdd')]];this[_0x0de3('0xa3')](this[_0x0de3('0x1b')][_0x182431[_0x0de3('0xa6')]]);_0x150093[_0x0de3('0x108')]=moment()[_0x0de3('0x74')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5e41ce=new QueueCallerAbandon(_0x150093,_0x182431);if(getSeconds(_0x150093[_0x0de3('0x108')],_0x150093['responsetime'])>=_0x150093['dialQueueTimeout']){this['voiceQueues'][_0x182431['queue']][_0x0de3('0x63')]+=0x1;this['voiceQueues'][_0x182431[_0x0de3('0xa6')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x182431[_0x0de3('0xa6')]][_0x0de3('0x65')]+=0x1;_0x5e41ce['state']=0xa;_0x5e41ce[_0x0de3('0x9a')]=_0x0de3('0x109');_0x5e41ce[_0x0de3('0x10a')]=_0x0de3('0x10b');_0x5e41ce[_0x0de3('0x101')]=this['voiceQueues'][_0x182431[_0x0de3('0xa6')]][_0x0de3('0x10c')]?moment()['format'](_0x0de3('0xf2')):undefined;_0x5e41ce['countdropretry']+=0x1;_0x5e41ce['countglobal']+=0x1;_0x53ee42=this[_0x0de3('0x1b')][_0x182431['queue']]['dialDropRetryFrequency'];_0x50905c=this['voiceQueues'][_0x182431['queue']][_0x0de3('0x10d')];_0x2485c6[_0x0de3('0xac')](_0x5e41ce,_0x5e41ce[_0x0de3('0x99')],_0x150093[_0x0de3('0x10e')])[_0x0de3('0xa8')](function(_0x4b465e){_0x2b45ab=_0x4b465e[_0x0de3('0x10f')]==0x1;if(_0x5e41ce[_0x0de3('0xe8')]>=_0x2485c6[_0x0de3('0x1b')][_0x182431['queue']][_0x0de3('0x110')]){_0x2485c6[_0x0de3('0x105')](_0x5e41ce,_0x4b465e[_0x0de3('0x10f')]);}else{_0x2485c6[_0x0de3('0xf0')]({'active':![],'countdropretry':_0x5e41ce['countdropretry'],'scheduledat':moment()[_0x0de3('0xf7')](_0x2485c6[_0x0de3('0x1b')][_0x182431['queue']][_0x0de3('0x111')],_0x0de3('0xf8'))[_0x0de3('0x74')](_0x0de3('0xf2')),'ContactId':_0x150093['ContactId'],'ListId':_0x150093[_0x0de3('0xc5')],'VoiceQueueId':_0x150093[_0x0de3('0xc7')]||undefined,'CampaignId':_0x150093[_0x0de3('0xc8')]||undefined})[_0x0de3('0xad')](loggerCatch(_0x0de3('0x112')));var _0x4e0851=new History(_0x5e41ce);_0x4e0851[_0x0de3('0x99')]=0xa;_0x4e0851[_0x0de3('0x9a')]='Drop';_0x4e0851['starttime']=moment()[_0x0de3('0x74')](_0x0de3('0xf2'));_0x4e0851[_0x0de3('0x113')]=_0x4e0851[_0x0de3('0x9b')];_0x4e0851[_0x0de3('0x114')]=_0x5e41ce[_0x0de3('0x114')];_0x4e0851['calleridnum']=_0x5e41ce[_0x0de3('0x115')];_0x2485c6[_0x0de3('0xc0')](_0x4e0851)[_0x0de3('0xad')](loggerCatch(_0x0de3('0x116')));}})[_0x0de3('0xa8')](function(_0x14c7f0){if(_0x2b45ab)_0x2485c6[_0x0de3('0xaf')](_0x5e41ce,_0x53ee42,_0x50905c)['then'](function(_0x3e5a6){return 0x1;});});}else{this[_0x0de3('0x1b')][_0x182431['queue']][_0x0de3('0x62')]+=0x1;this['voiceQueues'][_0x182431['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x5e41ce[_0x0de3('0x99')]=0xb;_0x5e41ce[_0x0de3('0x9a')]=_0x0de3('0x117');_0x5e41ce['dropreason']=_0x0de3('0x118');_0x5e41ce[_0x0de3('0xe9')]+=0x1;_0x5e41ce['countglobal']+=0x1;_0x53ee42=this[_0x0de3('0x1b')][_0x182431['queue']][_0x0de3('0x119')];_0x50905c=this[_0x0de3('0x1b')][_0x182431[_0x0de3('0xa6')]]['callAdditionalPhoneAfterMin'];_0x2485c6[_0x0de3('0xac')](_0x5e41ce,_0x5e41ce['state'],_0x150093[_0x0de3('0x10e')])[_0x0de3('0xa8')](function(_0x5bf87b){if(_0x5e41ce[_0x0de3('0xe9')]>=_0x2485c6[_0x0de3('0x1b')][_0x182431['queue']][_0x0de3('0x11a')]){_0x2485c6[_0x0de3('0x105')](_0x5e41ce,_0x5bf87b[_0x0de3('0x10f')]);}else{_0x2485c6[_0x0de3('0xf0')]({'active':![],'countabandonedretry':_0x5e41ce[_0x0de3('0xe9')],'scheduledat':moment()[_0x0de3('0xf7')](_0x2485c6[_0x0de3('0x1b')][_0x182431['queue']][_0x0de3('0x119')],_0x0de3('0xf8'))[_0x0de3('0x74')](_0x0de3('0xf2')),'ContactId':_0x150093['ContactId'],'ListId':_0x150093['ListId'],'VoiceQueueId':_0x150093[_0x0de3('0xc7')]||undefined,'CampaignId':_0x150093[_0x0de3('0xc8')]||undefined})[_0x0de3('0xad')](loggerCatch(_0x0de3('0x11b')));var _0x27b9d5=new History(_0x5e41ce);_0x27b9d5[_0x0de3('0x99')]=0xb;_0x27b9d5[_0x0de3('0x9a')]=_0x0de3('0x117');_0x27b9d5[_0x0de3('0x9b')]=moment()[_0x0de3('0x74')](_0x0de3('0xf2'));_0x27b9d5[_0x0de3('0x113')]=_0x27b9d5[_0x0de3('0x9b')];_0x27b9d5['calleridname']=_0x5e41ce[_0x0de3('0x114')];_0x27b9d5[_0x0de3('0x115')]=_0x5e41ce[_0x0de3('0x115')];_0x2485c6['createHistory'](_0x27b9d5)[_0x0de3('0xad')](loggerCatch(_0x0de3('0x11c')));}})[_0x0de3('0xa8')](function(_0x219165){if(_0x2b45ab)_0x2485c6['swapAdditionalPhones'](_0x5e41ce,_0x53ee42,_0x50905c)[_0x0de3('0xa8')](function(_0xba8efe){return 0x1;});});}}}};Dialer[_0x0de3('0x18')][_0x0de3('0x11d')]=function(_0x50e5e5){if(this[_0x0de3('0x11e')][_0x50e5e5[_0x0de3('0xdd')]]){this[_0x0de3('0x11e')][_0x50e5e5[_0x0de3('0xdd')]]['channel']=_0x50e5e5[_0x0de3('0xa1')];}if(this['uniqueId'][_0x50e5e5[_0x0de3('0xdd')]]){this[_0x0de3('0x21')][_0x50e5e5['uniqueid']][_0x0de3('0xa1')]=_0x50e5e5[_0x0de3('0xa1')];}};Dialer[_0x0de3('0x18')][_0x0de3('0x31')]=function(_0x42c23a){if(strategy[this[_0x0de3('0x1b')][this[_0x0de3('0x11e')][_0x42c23a['actionid']][_0x0de3('0xa6')]][_0x0de3('0x46')]]===_0x0de3('0x11f')){if(this['actions'][_0x42c23a[_0x0de3('0x120')]]&&_[_0x0de3('0x9f')](this[_0x0de3('0x11e')][_0x42c23a[_0x0de3('0x120')]][_0x0de3('0x121')])&&_0x42c23a['status']==='1'&&_0x42c23a[_0x0de3('0x122')]==='0'){if(this[_0x0de3('0x1c')][_0x42c23a[_0x0de3('0x123')]]){if(!this['agents'][_0x42c23a[_0x0de3('0x123')]]['locked']){this[_0x0de3('0x1c')][_0x42c23a[_0x0de3('0x123')]]['locked']=!![];this[_0x0de3('0x11e')][_0x42c23a[_0x0de3('0x120')]][_0x0de3('0x121')]=!![];this[_0x0de3('0x11e')][_0x42c23a[_0x0de3('0x120')]][_0x0de3('0x123')]=_0x42c23a[_0x0de3('0x123')];}}}}else if((strategy[this[_0x0de3('0x1b')][this[_0x0de3('0x11e')][_0x42c23a[_0x0de3('0x120')]][_0x0de3('0xa6')]]['strategy']]||'rrmemory')===_0x0de3('0x124')){if(this[_0x0de3('0x11e')][_0x42c23a[_0x0de3('0x120')]]){if(this[_0x0de3('0x1c')][_0x42c23a[_0x0de3('0x123')]]){this[_0x0de3('0x11e')][_0x42c23a['actionid']][_0x0de3('0x123')]=_0x42c23a['stateinterface'];if(_[_0x0de3('0x9f')](this['queueBooked'][this[_0x0de3('0x11e')][_0x42c23a['actionid']][_0x0de3('0xa6')]])){this[_0x0de3('0x26')][this[_0x0de3('0x11e')][_0x42c23a[_0x0de3('0x120')]]['queue']]=[];}this[_0x0de3('0x26')][this['actions'][_0x42c23a[_0x0de3('0x120')]]['queue']][_0x0de3('0x125')](_[_0x0de3('0x83')](_[_0x0de3('0xc3')](this[_0x0de3('0x11e')][_0x42c23a[_0x0de3('0x120')]],[_0x0de3('0x126'),_0x0de3('0x123')]),{'status':_0x42c23a[_0x0de3('0xa0')],'paused':_0x42c23a[_0x0de3('0x122')]}));}}}};function unlockQueueStatus(_0x4b0769,_0x3b7bc8){setTimeout(function(){if(_['isUndefined'](_0x4b0769['queueStatusComplete'])){loggerBooked[_0x0de3('0x89')](_0x0de3('0x127'),_0x3b7bc8);}_0x4b0769[_0x0de3('0x128')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x3b7bc8,JSON[_0x0de3('0x40')](_[_0x0de3('0xc3')](_0x4b0769,[_0x0de3('0x38'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x0de3('0x18')]['syncQueueStatusComplete']=function(_0x4ffafd){var _0x55830b=this;var _0x1bec00=_0x55830b[_0x0de3('0x1b')][_0x55830b[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]][_0x0de3('0xa6')]];if(strategy[this[_0x0de3('0x1b')][this[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]]['queue']][_0x0de3('0x46')]]===_0x0de3('0x11f')){if(this[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]]&&this['actions'][_0x4ffafd[_0x0de3('0x120')]][_0x0de3('0x123')]){this[_0x0de3('0x129')]['run'](this[_0x0de3('0x11e')][_0x4ffafd['actionid']][_0x0de3('0x126')],this['actions'][_0x4ffafd[_0x0de3('0x120')]][_0x0de3('0x123')])[_0x0de3('0xad')](function(_0xfce0ac){logger[_0x0de3('0x89')](_0x0de3('0x12a'),util[_0x0de3('0x8a')](_0xfce0ac,{'showHidden':![],'depth':null}));})['finally'](function(){_0x55830b[_0x0de3('0xa3')](_0x55830b['voiceQueues'][_0x55830b[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]][_0x0de3('0xa6')]]);_0x55830b[_0x0de3('0x1c')][_0x55830b[_0x0de3('0x11e')][_0x4ffafd['actionid']][_0x0de3('0x123')]][_0x0de3('0x121')]=![];delete _0x55830b[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]];unlockQueueStatus(_0x1bec00);});}else{this['updateOriginated'](this[_0x0de3('0x1b')][this[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]]['queue']]);this[_0x0de3('0xf0')]({'active':![],'ContactId':this['actions'][_0x4ffafd[_0x0de3('0x120')]][_0x0de3('0xc4')],'ListId':this[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]][_0x0de3('0xc5')],'VoiceQueueId':this['actions'][_0x4ffafd[_0x0de3('0x120')]][_0x0de3('0xc7')]||undefined,'CampaignId':this[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]][_0x0de3('0xc8')]||undefined})['catch'](loggerCatch(_0x0de3('0x12b')));delete this[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]];unlockQueueStatus(_0x1bec00);}}else if((strategy[this[_0x0de3('0x1b')][this[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]][_0x0de3('0xa6')]][_0x0de3('0x46')]]||_0x0de3('0x124'))==='rrmemory'){var _0x1c435a;if(this[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]]&&!_[_0x0de3('0x3c')](this[_0x0de3('0x26')][this[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]]['queue']])){if(this['queueBookedRR'][_0x55830b[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]][_0x0de3('0xa6')]]){this[_0x0de3('0x27')][_0x55830b[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]][_0x0de3('0xa6')]]=this['queueBookedRR'][this[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]][_0x0de3('0xa6')]]?this[_0x0de3('0x27')][this[_0x0de3('0x11e')][_0x4ffafd[_0x0de3('0x120')]]['queue']]:this[_0x0de3('0x26')][this[_0x0de3('0x11e')][_0x4ffafd['actionid']][_0x0de3('0xa6')]]?this['queueBooked'][this['actions'][_0x4ffafd[_0x0de3('0x120')]][_0x0de3('0xa6')]][_0x0de3('0x12c')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x4ffafd['actionid']][_0x0de3('0xa6')]][_0x0de3('0x12c')]=this[_0x0de3('0x27')][this[_0x0de3('0x11e')][_0x4ffafd['actionid']][_0x0de3('0xa6')]];for(var _0x2ed3c3=0x0;_0x2ed3c3=0x0;})[_0x0de3('0xad')](myreject(_0xbfbf7d)));}}else{_0x4ccea1['push'](ami['Action']({'action':_0x0de3('0x149'),'command':util[_0x0de3('0x74')](_0x0de3('0x146'),_0x4af1b1,!_[_0x0de3('0x35')](config[_0x0de3('0x142')][_0x5ce2ce])?_0x5ce2ce:'')})[_0x0de3('0xa8')](function(_0x317c54){return _0x317c54[_0x0de3('0x14a')][_0x0de3('0x148')]('true')>=0x0;})[_0x0de3('0xad')](myreject(_0xbfbf7d)));}BPromise[_0x0de3('0x14b')](_0x4ccea1)[_0x0de3('0xa8')](function(_0x405424){var _0x357a60=_[_0x0de3('0x14c')](_0x405424);if(_0x357a60){return _0x3d765a(_0x357a60);}else{_0x4e569b[_0x0de3('0x37')]=_0x21cab9?_0x0de3('0x14d'):_0x0de3('0x14e');return _0xbfbf7d(msgResponse('[ifTime][promiseAll]',_0x0de3('0x140'),_0x0de3('0x14f')+_0x21cab9+'\x20'+_0x10a616+_0x0de3('0x150')+util[_0x0de3('0x8a')](_0x4af1b1,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x5ce2ce));}})['catch'](function(_0x43ebfa){return _0xbfbf7d(msgResponse(_0x0de3('0x13c'),_0x0de3('0x140'),JSON['stringify'](_0x43ebfa)));});});};Dialer[_0x0de3('0x18')][_0x0de3('0x151')]=function(_0x286c3f){var _0x4fcd81=this;return function(){switch(_0x286c3f[_0x0de3('0x50')]){case _0x0de3('0x152'):freeVariablesPredictive(_0x286c3f);_0x4fcd81['handlePower'](_0x286c3f,0x1);break;case'power':freeVariablesPredictive(_0x286c3f);_0x4fcd81[_0x0de3('0x153')](_0x286c3f,_0x286c3f['dialPowerLevel']);break;case _0x0de3('0x8'):_0x4fcd81['predictive'](_0x286c3f);break;case'booked':freeVariablesPredictive(_0x286c3f);_0x4fcd81[_0x0de3('0x153')](_0x286c3f,0x1);break;default:freeVariablesPredictive(_0x286c3f);logger[_0x0de3('0x89')](_0x0de3('0x154'),_0x286c3f[_0x0de3('0x38')],_0x0de3('0x155'));}};};Dialer[_0x0de3('0x18')][_0x0de3('0x156')]=function(_0x34aaa6){var _0x31123f=this;return function(){_0x31123f[_0x0de3('0x157')](_0x34aaa6);};};Dialer[_0x0de3('0x18')][_0x0de3('0xa')]=function(_0x2f0e14){var _0x295ad4=this;if(isNotPreview(_0x2f0e14[_0x0de3('0x50')])){if(isVoiceQueueOutbound(_0x2f0e14['type'])&&isActive(_0x2f0e14[_0x0de3('0x4f')])){_0x2f0e14[_0x0de3('0x97')]=!![];BPromise[_0x0de3('0xab')]()[_0x0de3('0xa8')](checkIsLoggedIn(_0x2f0e14,_0x2f0e14[_0x0de3('0x158')]))['then'](checkIsActive(_0x2f0e14,_0x2f0e14[_0x0de3('0x4f')]))[_0x0de3('0xa8')](checkInterval(_0x2f0e14))[_0x0de3('0xa8')](_0x295ad4[_0x0de3('0x159')](_0x2f0e14))[_0x0de3('0xa8')](_0x295ad4['checkIfTime'](_0x2f0e14[_0x0de3('0x15a')],_0x2f0e14['dialTimezone'],_0x2f0e14[_0x0de3('0x38')],_0x2f0e14))[_0x0de3('0xa8')](_0x295ad4[_0x0de3('0x13d')](_0x2f0e14[_0x0de3('0x3a')],_0x2f0e14[_0x0de3('0x15b')],_0x2f0e14[_0x0de3('0x38')],_0x2f0e14))[_0x0de3('0xa8')](_0x295ad4[_0x0de3('0x151')](_0x2f0e14))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x2f0e14));}else{notSendMessagesQueue(_0x2f0e14);}}else{freeVariablesPredictive(_0x2f0e14);}};Dialer[_0x0de3('0x18')]['syncCampaigns']=function(){var _0x564820=this;var _0x59e76e;for(var _0xc4d7fb in this[_0x0de3('0xa5')]){if(typeof this[_0x0de3('0xa5')][_0xc4d7fb]!=='undefined'){_0x59e76e=this[_0x0de3('0xa5')][_0xc4d7fb];if(isCampaignIvr(_0x59e76e[_0x0de3('0x45')])&&isActive(_0x59e76e[_0x0de3('0x6f')])){_0x59e76e[_0x0de3('0x97')]=!![];BPromise[_0x0de3('0xab')]()[_0x0de3('0xa8')](checkIsActive(_0x59e76e,_0x59e76e['active']))[_0x0de3('0xa8')](checkInterval(_0x59e76e))[_0x0de3('0xa8')](_0x564820[_0x0de3('0x159')](_0x59e76e))['then'](_0x564820[_0x0de3('0x13b')](_0x59e76e[_0x0de3('0x15a')],_0x59e76e[_0x0de3('0x15b')],_0x59e76e[_0x0de3('0x38')],_0x59e76e))[_0x0de3('0xa8')](_0x564820[_0x0de3('0x13d')](_0x59e76e['Interval'],_0x59e76e[_0x0de3('0x15b')],_0x59e76e[_0x0de3('0x38')],_0x59e76e))[_0x0de3('0xa8')](_0x564820[_0x0de3('0x156')](_0x59e76e))[_0x0de3('0xad')](loggerCatchQueueSummary('[syncCampaigns]',_0x59e76e));}else{notSendMessagesCampaign(_0x59e76e);}}}};function getCallerIdRandom(_0x27fdcd,_0x166b9e){var _0x461687;var _0x41ac9b;var _0x14cb28;if(_0x166b9e<=0x0){_0x166b9e=0x1;}_0x461687=new RegExp(_0x0de3('0x15c')+_0x166b9e+'}$');_0x41ac9b=Math[_0x0de3('0x15d')](0xa,_0x166b9e-0x1);_0x14cb28=Math[_0x0de3('0x15d')](0xa,_0x166b9e)-0x1;return util[_0x0de3('0x74')]('%s',_[_0x0de3('0x15e')](_0x27fdcd,_0x461687,_[_0x0de3('0x15f')](_0x41ac9b,_0x14cb28)));}function extractCalleridName(_0x2e61df){var _0x569490=_0x2e61df[_0x0de3('0x160')](/"(.*?)"/);return _0x569490?_0x569490[0x1]:_0x2e61df;}function extractCalleridNumber(_0x3e167){var _0x3c5564=_0x3e167[_0x0de3('0x160')](/<(.*?)>/);return _0x3c5564?_0x3c5564[0x1]:_0x3e167;}Dialer['prototype'][_0x0de3('0x161')]=function(_0x50d221,_0x2bdcc0){var _0x1b97b8=this;var _0x901d1a=uuid['v4']();this[_0x0de3('0x11e')][_0x901d1a]=new Action(_0x50d221,_0x2bdcc0,_0x901d1a);return new BPromise(function(_0x1ef2ec,_0x5b4c68){if(_[_0x0de3('0x35')](_0x50d221)&&typeof _0x50d221!=='object'){return _0x5b4c68(msgResponse(_0x0de3('0x162'),_0x0de3('0x140'),_0x0de3('0x163')));}if(_[_0x0de3('0x35')](_0x2bdcc0[_0x0de3('0x164')])||_0x2bdcc0['phone']===null){return _0x5b4c68(msgResponse(_0x0de3('0x162'),_0x0de3('0x140'),_0x0de3('0x165')));}var _0x551621={'XMD-CALLERID':_0x1b97b8[_0x0de3('0x11e')][_0x901d1a][_0x0de3('0x166')](),'XMD-AGI':_0x50d221[_0x0de3('0xfb')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x50d221['dialQueueProject']):_0x0de3('0x167'),'XMD-AGIAFTER':_0x50d221['dialQueueProject2']?util[_0x0de3('0x74')](_0x0de3('0x168'),ipAgi,_0x50d221[_0x0de3('0x10c')]):_0x0de3('0x167'),'XMD-QUEUE':_0x50d221[_0x0de3('0x45')]===_0x0de3('0x87')?util['format'](_0x0de3('0x169'),_0x50d221[_0x0de3('0x38')],_0x50d221[_0x0de3('0x16a')]||'',_0x50d221[_0x0de3('0x102')]?'c':'',_0x50d221[_0x0de3('0x16b')]||0x3):_0x0de3('0x167'),'XMD-CONTACTID':_0x2bdcc0['ContactId'],'XMD-CDRTYPE':_0x0de3('0x6'),'CALLERID(all)':_0x1b97b8['actions'][_0x901d1a][_0x0de3('0x166')](),'XMD-AMD':_0x50d221[_0x0de3('0xdc')]?_0x0de3('0x16c'):'NONE','XMD-DESTINATION':_0x0de3('0xd5')};if(_0x50d221[_0x0de3('0xdc')]){_0x551621[_0x0de3('0x16d')]=_0x50d221[_0x0de3('0x16e')]||0x9c4;_0x551621[_0x0de3('0x16f')]=_0x50d221[_0x0de3('0x170')]||0x5dc;_0x551621['XMD-AMDAFTERGREETINGSILENCE']=_0x50d221[_0x0de3('0x171')]||0x320;_0x551621[_0x0de3('0x172')]=_0x50d221[_0x0de3('0x173')]||0x1388;_0x551621[_0x0de3('0x174')]=_0x50d221[_0x0de3('0x175')]||0x64;_0x551621[_0x0de3('0x176')]=_0x50d221[_0x0de3('0x177')]||0x32;_0x551621['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x50d221[_0x0de3('0x178')]||0x3;_0x551621[_0x0de3('0x179')]=_0x50d221[_0x0de3('0x17a')]||0x100;_0x551621['XMD-AMDMAXIMUMWORDLENGTH']=_0x50d221[_0x0de3('0x17b')]||0x1388;}if(_0x50d221[_0x0de3('0x45')]===_0x0de3('0x87')){_0x551621[_0x0de3('0x17c')]=_0x2bdcc0[_0x0de3('0xc7')];}else{_0x551621['XMD-CAMPAIGNID']=_0x2bdcc0['CampaignId'];}for(var _0x236589 in _0x2bdcc0[_0x0de3('0x17d')]){if(typeof _0x2bdcc0['Contact'][_0x236589]!==_0x0de3('0xc1')){if(isNotNull(_0x2bdcc0[_0x0de3('0x17d')][_0x236589])&&_0x236589!=='id'&&_0x236589!==_0x0de3('0x17e')&&_0x236589!==_0x0de3('0x17f')&&_0x236589!==_0x0de3('0x180')){_0x551621[util[_0x0de3('0x74')](_0x0de3('0x181'),_0x0de3('0x182'),_[_0x0de3('0x183')](_0x236589))]=_0x2bdcc0[_0x0de3('0x17d')][_0x236589];}}}var _0x3c4d5c=_0x1b97b8['isTrunkReachable'](_0x50d221[_0x0de3('0x6e')])?getCallerId(_0x50d221['Trunk'][_0x0de3('0x70')],_0x50d221[_0x0de3('0x51')],_0x50d221['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x50d221[_0x0de3('0x52')],_0x50d221['dialRandomLastDigitCallerIdNumber']):_0x50d221[_0x0de3('0x52')]):getCallerId(_[_0x0de3('0x9f')](_0x50d221['TrunkBackup'])?_0x50d221[_0x0de3('0x6e')][_0x0de3('0x70')]:_0x50d221['TrunkBackup'][_0x0de3('0x70')],_0x50d221[_0x0de3('0x51')],_0x50d221[_0x0de3('0x184')]>0x0?getCallerIdRandom(_0x50d221[_0x0de3('0x52')],_0x50d221[_0x0de3('0x184')]):_0x50d221[_0x0de3('0x52')]);if(_0x3c4d5c){_0x551621[_0x0de3('0x185')]=_0x1b97b8[_0x0de3('0x11e')][_0x901d1a]['originatecalleridname']=extractCalleridName(_0x3c4d5c);_0x551621[_0x0de3('0x186')]=_0x2bdcc0[_0x0de3('0x164')];}return ami[_0x0de3('0x145')]({'actionid':_0x901d1a,'action':_0x0de3('0x162'),'channel':_0x1b97b8[_0x0de3('0xcd')](_0x50d221[_0x0de3('0x6e')])?util[_0x0de3('0x74')](_0x0de3('0x187'),_0x50d221['Trunk'][_0x0de3('0x38')],isNotNull(_0x50d221['dialPrefix'])?_0x50d221[_0x0de3('0x53')][_0x0de3('0x188')]()||'':'',_0x50d221[_0x0de3('0x189')]>0x0?_0x2bdcc0[_0x0de3('0x164')]['substring'](_0x50d221['dialCutDigit']):_0x2bdcc0['phone']):util[_0x0de3('0x74')](_0x0de3('0x187'),_[_0x0de3('0x9f')](_0x50d221['TrunkBackup'])?_0x50d221[_0x0de3('0x6e')][_0x0de3('0x38')]:_0x50d221['TrunkBackup'][_0x0de3('0x38')],isNotNull(_0x50d221[_0x0de3('0x53')])?_0x50d221[_0x0de3('0x53')]['trim']()||'':'',_0x50d221[_0x0de3('0x189')]>0x0?_0x2bdcc0[_0x0de3('0x164')]['substring'](_0x50d221[_0x0de3('0x189')]):_0x2bdcc0['phone']),'callerid':_0x3c4d5c,'Exten':_0x0de3('0xd5'),'Context':'from-sip','Priority':'1','variable':_0x551621,'timeout':(_0x50d221[_0x0de3('0x18a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x901d1a})[_0x0de3('0xa8')](function(_0x17fd53){return _0x1ef2ec(_0x17fd53);})[_0x0de3('0xad')](function(_0x498f61){_0x50d221['outboundOriginateFailureCallsDay']+=0x1;var _0x1e8274=new History(_0x1b97b8[_0x0de3('0x11e')][_0x901d1a]);logger['error'](util[_0x0de3('0x74')](_0x0de3('0x18b'),JSON[_0x0de3('0x40')](_0x498f61)));_0x1e8274[_0x0de3('0x99')]=0xe;_0x1e8274['statedesc']=_0x0de3('0x18c');_0x1e8274[_0x0de3('0x9b')]=moment()[_0x0de3('0x74')](_0x0de3('0xf2'));_0x1e8274[_0x0de3('0x113')]=_0x1e8274[_0x0de3('0x9b')];_0x1b97b8[_0x0de3('0xc0')](_0x1e8274)[_0x0de3('0xad')](loggerCatch(_0x0de3('0x18d')));_0x1b97b8[_0x0de3('0xbe')](_0x1e8274)['catch'](loggerCatch(_0x0de3('0x18d')))[_0x0de3('0x131')](function(){delete _0x1b97b8[_0x0de3('0x11e')][_0x901d1a];return _0x5b4c68(msgResponse('originate','Error',_0x0de3('0x18e')));});});});};Dialer[_0x0de3('0x18')][_0x0de3('0x18f')]=function(_0x31c2f3){var _0x4381e7=this[_0x0de3('0x11e')][_0x31c2f3[_0x0de3('0x120')]];if(_0x4381e7){delete this[_0x0de3('0x11e')][_0x31c2f3['actionid']];_0x4381e7[_0x0de3('0x190')]=moment()[_0x0de3('0x74')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2c7d18=_0x4381e7[_0x0de3('0x45')]===_0x0de3('0x73')?this['campaigns'][_0x4381e7[_0x0de3('0xa6')]]:this[_0x0de3('0x1b')][_0x4381e7[_0x0de3('0x191')]()];if(!this[_0x0de3('0xcb')](_0x31c2f3['response'])){this[_0x0de3('0xa3')](_0x2c7d18);return this[_0x0de3('0x192')](_0x4381e7,_0x2c7d18,_0x31c2f3)[_0x0de3('0xad')](loggerCatch(_0x0de3('0x193')));}this[_0x0de3('0x21')][_0x31c2f3[_0x0de3('0xdd')]]=_0x4381e7;}};Dialer[_0x0de3('0x18')][_0x0de3('0x194')]=function(_0x316a2d,_0x15a631,_0x356355){var _0x4dbfcb=new History(_0x15a631);if(_0x4dbfcb[_0x0de3('0xe5')]+_0x4dbfcb['countcongestionretry']+_0x4dbfcb[_0x0de3('0x195')]+_0x4dbfcb[_0x0de3('0xe7')]+_0x4dbfcb['countdropretry']+_0x4dbfcb[_0x0de3('0xe9')]+_0x4dbfcb[_0x0de3('0xe0')]+_0x4dbfcb[_0x0de3('0xea')]>=_0x356355[_0x0de3('0xeb')]-0x1){return!![];}switch(_0x316a2d){case 0x3:if(_0x4dbfcb[_0x0de3('0x195')]>=_0x356355[_0x0de3('0x196')]-0x1){return!![];}this[_0x0de3('0xf0')]({'active':![],'countnoanswerretry':_0x4dbfcb[_0x0de3('0x195')]+=0x1,'scheduledat':moment()[_0x0de3('0xf7')](_0x356355[_0x0de3('0x197')],_0x0de3('0xf8'))[_0x0de3('0x74')](_0x0de3('0xf2')),'ContactId':_0x4dbfcb[_0x0de3('0xc4')],'ListId':_0x4dbfcb[_0x0de3('0xc5')],'VoiceQueueId':_0x4dbfcb[_0x0de3('0xc7')]||undefined,'CampaignId':_0x4dbfcb[_0x0de3('0xc8')]||undefined})[_0x0de3('0xad')](loggerCatch(_0x0de3('0x198')));break;case 0x5:if(_0x4dbfcb[_0x0de3('0xe5')]>=_0x356355[_0x0de3('0x199')]-0x1){return!![];}this[_0x0de3('0xf0')]({'active':![],'countbusyretry':_0x4dbfcb[_0x0de3('0xe5')]+=0x1,'scheduledat':moment()[_0x0de3('0xf7')](_0x356355[_0x0de3('0x19a')],_0x0de3('0xf8'))[_0x0de3('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4dbfcb['ContactId'],'ListId':_0x4dbfcb[_0x0de3('0xc5')],'VoiceQueueId':_0x4dbfcb[_0x0de3('0xc7')]||undefined,'CampaignId':_0x4dbfcb[_0x0de3('0xc8')]||undefined})[_0x0de3('0xad')](loggerCatch(_0x0de3('0x19b')));break;case 0x8:if(_0x4dbfcb[_0x0de3('0xe6')]>=_0x356355[_0x0de3('0x19c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x4dbfcb[_0x0de3('0xe6')]+=0x1,'scheduledat':moment()[_0x0de3('0xf7')](_0x356355[_0x0de3('0x19d')],'minutes')[_0x0de3('0x74')](_0x0de3('0xf2')),'ContactId':_0x4dbfcb[_0x0de3('0xc4')],'ListId':_0x4dbfcb['ListId'],'VoiceQueueId':_0x4dbfcb['VoiceQueueId']||undefined,'CampaignId':_0x4dbfcb['CampaignId']||undefined})[_0x0de3('0xad')](loggerCatch(_0x0de3('0x19e')));break;case 0x0:if(_0x4dbfcb[_0x0de3('0xe7')]>=_0x356355[_0x0de3('0x19f')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x4dbfcb[_0x0de3('0xe7')]+=0x1,'scheduledat':moment()[_0x0de3('0xf7')](_0x356355[_0x0de3('0x1a0')],_0x0de3('0xf8'))[_0x0de3('0x74')](_0x0de3('0xf2')),'ContactId':_0x4dbfcb['ContactId'],'ListId':_0x4dbfcb['ListId'],'VoiceQueueId':_0x4dbfcb['VoiceQueueId']||undefined,'CampaignId':_0x4dbfcb[_0x0de3('0xc8')]||undefined})[_0x0de3('0xad')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x4dbfcb[_0x0de3('0xe8')]>=_0x356355[_0x0de3('0x110')]-0x1){return!![];}this[_0x0de3('0xf0')]({'active':![],'countdropretry':_0x4dbfcb[_0x0de3('0xe8')]+=0x1,'scheduledat':moment()[_0x0de3('0xf7')](_0x356355[_0x0de3('0x111')],_0x0de3('0xf8'))['format'](_0x0de3('0xf2')),'ContactId':_0x4dbfcb[_0x0de3('0xc4')],'ListId':_0x4dbfcb[_0x0de3('0xc5')],'VoiceQueueId':_0x4dbfcb[_0x0de3('0xc7')]||undefined,'CampaignId':_0x4dbfcb['CampaignId']||undefined})[_0x0de3('0xad')](loggerCatch(_0x0de3('0x112')));break;case 0xb:if(_0x4dbfcb[_0x0de3('0xe9')]>=_0x356355[_0x0de3('0x11a')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x4dbfcb[_0x0de3('0xe9')]+=0x1,'scheduledat':moment()[_0x0de3('0xf7')](_0x356355['dialAbandonedRetryFrequency'],_0x0de3('0xf8'))[_0x0de3('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4dbfcb[_0x0de3('0xc4')],'ListId':_0x4dbfcb[_0x0de3('0xc5')],'VoiceQueueId':_0x4dbfcb[_0x0de3('0xc7')]||undefined,'CampaignId':_0x4dbfcb[_0x0de3('0xc8')]||undefined})['catch'](loggerCatch(_0x0de3('0x11b')));break;case 0x13:if(_0x4dbfcb['countmachineretry']>=_0x356355['dialMachineMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x4dbfcb[_0x0de3('0xe0')]+=0x1,'scheduledat':moment()[_0x0de3('0xf7')](_0x356355['dialMachineRetryFrequency'],_0x0de3('0xf8'))[_0x0de3('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4dbfcb[_0x0de3('0xc4')],'ListId':_0x4dbfcb[_0x0de3('0xc5')],'VoiceQueueId':_0x4dbfcb['VoiceQueueId']||undefined,'CampaignId':_0x4dbfcb[_0x0de3('0xc8')]||undefined})[_0x0de3('0xad')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x4dbfcb[_0x0de3('0xea')]>=_0x356355[_0x0de3('0x1a1')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x4dbfcb[_0x0de3('0xea')]+=0x1,'scheduledat':moment()[_0x0de3('0xf7')](_0x356355['dialAgentRejectRetryFrequency'],_0x0de3('0xf8'))[_0x0de3('0x74')](_0x0de3('0xf2')),'ContactId':_0x4dbfcb[_0x0de3('0xc4')],'ListId':_0x4dbfcb[_0x0de3('0xc5')],'VoiceQueueId':_0x4dbfcb[_0x0de3('0xc7')]||undefined,'CampaignId':_0x4dbfcb['CampaignId']||undefined})[_0x0de3('0xad')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0x0de3('0x192')]=function(_0x5cdbf3,_0x4cd26f,_0x3734e6){var _0x4df0d8=this;var _0x1e5977=new History(_0x5cdbf3);var _0x48d932=![];var _0x45bdca;var _0x131f43;return new BPromise(function(_0x546496,_0x373c0b){if(_[_0x0de3('0x35')](_0x4cd26f)&&typeof _0x4cd26f!==_0x0de3('0x1a2')){return _0x373c0b(msgResponse(_0x0de3('0x1a3'),'Failure','entity\x20is\x20undefine'));}if(_[_0x0de3('0x35')](_0x3734e6)&&typeof _0x3734e6!=='object'){return _0x373c0b(msgResponse(_0x0de3('0x1a3'),'Failure','evt\x20is\x20undefine'));}_0x4df0d8[_0x0de3('0xac')](_0x1e5977,_0x3734e6[_0x0de3('0xff')],_0x4cd26f)[_0x0de3('0xa8')](function(_0x279b36){if(_0x279b36[_0x0de3('0x10f')]==0x1)_0x48d932=!![];switch(_0x3734e6[_0x0de3('0xff')]){case'0':_0x4cd26f['outboundNoSuchCallsDay']+=0x1;_0x1e5977[_0x0de3('0x99')]=0x0;_0x1e5977[_0x0de3('0x9a')]='NoSuchNumber';_0x1e5977[_0x0de3('0xe7')]+=0x1;_0x1e5977[_0x0de3('0xe1')]+=0x1;ami['emit'](_0x0de3('0x1a4'),ut[_0x0de3('0xe3')](_0x5cdbf3,_0x0de3('0x1a5')));_0x45bdca=_0x4cd26f['dialNoSuchNumberRetryFrequency'];_0x131f43=_0x4cd26f['callAdditionalPhoneAfterMin'];_0x4df0d8[_0x0de3('0xc0')](_0x1e5977)['catch'](loggerCatch(_0x0de3('0xe4')));if(_0x4df0d8[_0x0de3('0x194')](0x0,_0x5cdbf3,_0x4cd26f)&&!_0x48d932){if(_0x1e5977[_0x0de3('0xe7')]>=_0x4cd26f[_0x0de3('0x19f')]){_0x4df0d8[_0x0de3('0xee')](_0x1e5977,_0x546496,_0x373c0b,'reason\x200\x20no\x20such\x20number....');}else{_0x4df0d8['stateGlobal'](_0x1e5977,_0x546496,_0x373c0b,_0x0de3('0x1a6'));}}break;case'3':_0x4cd26f[_0x0de3('0x1a7')]+=0x1;_0x1e5977[_0x0de3('0x99')]=0x3;_0x1e5977[_0x0de3('0x9a')]='NoAnswer';_0x1e5977[_0x0de3('0x195')]+=0x1;_0x1e5977['countglobal']+=0x1;ami[_0x0de3('0x44')](_0x0de3('0x1a8'),ut[_0x0de3('0xe3')](_0x5cdbf3,_0x0de3('0x1a9')));_0x45bdca=_0x4cd26f[_0x0de3('0x197')];_0x131f43=_0x4cd26f['callAdditionalPhoneAfterMin'];_0x4df0d8[_0x0de3('0xc0')](_0x1e5977)['catch'](loggerCatch(_0x0de3('0x1aa')));if(_0x4df0d8[_0x0de3('0x194')](0x3,_0x5cdbf3,_0x4cd26f)&&!_0x48d932){if(_0x1e5977['countnoanswerretry']>=_0x4cd26f[_0x0de3('0x196')]){_0x4df0d8[_0x0de3('0xee')](_0x1e5977,_0x546496,_0x373c0b,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4df0d8[_0x0de3('0xec')](_0x1e5977,_0x546496,_0x373c0b,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x4cd26f[_0x0de3('0x57')]+=0x1;_0x1e5977[_0x0de3('0x99')]=0x5;_0x1e5977[_0x0de3('0x9a')]=_0x0de3('0x1ab');_0x1e5977[_0x0de3('0xe5')]+=0x1;_0x1e5977[_0x0de3('0xe1')]+=0x1;ami[_0x0de3('0x44')](_0x0de3('0x1ac'),ut[_0x0de3('0xe3')](_0x5cdbf3,_0x0de3('0x1ad')));_0x45bdca=_0x4cd26f[_0x0de3('0x19a')];_0x131f43=_0x4cd26f[_0x0de3('0x10d')];_0x4df0d8[_0x0de3('0xc0')](_0x1e5977)[_0x0de3('0xad')](loggerCatch(_0x0de3('0x1ae')));if(_0x4df0d8[_0x0de3('0x194')](0x5,_0x5cdbf3,_0x4cd26f)&&!_0x48d932){if(_0x1e5977[_0x0de3('0xe5')]>=_0x4cd26f['dialBusyMaxRetry']){_0x4df0d8['createStateFinal'](_0x1e5977,_0x546496,_0x373c0b,_0x0de3('0x1af'));}else{_0x4df0d8[_0x0de3('0xec')](_0x1e5977,_0x546496,_0x373c0b,_0x0de3('0x1af'));}}break;case'8':_0x4cd26f['outboundCongestionCallsDay']+=0x1;_0x1e5977['state']=0x8;_0x1e5977['statedesc']=_0x0de3('0x1b0');_0x1e5977['countcongestionretry']+=0x1;_0x1e5977['countglobal']+=0x1;_0x45bdca=_0x4cd26f[_0x0de3('0x19d')];_0x131f43=_0x4cd26f[_0x0de3('0x10d')];ami[_0x0de3('0x44')](_0x0de3('0x1b1'),ut[_0x0de3('0xe3')](_0x5cdbf3,_0x0de3('0x1b2')));_0x4df0d8[_0x0de3('0xc0')](_0x1e5977)[_0x0de3('0xad')](loggerCatch(_0x0de3('0x1b3')));if(_0x4df0d8[_0x0de3('0x194')](0x8,_0x5cdbf3,_0x4cd26f)&&!_0x48d932){if(_0x1e5977[_0x0de3('0xe6')]>=_0x4cd26f[_0x0de3('0x19c')]){_0x4df0d8['createStateFinal'](_0x1e5977,_0x546496,_0x373c0b,_0x0de3('0x1b4'));}else{_0x4df0d8['stateGlobal'](_0x1e5977,_0x546496,_0x373c0b,_0x0de3('0x1b4'));}}break;case'11':_0x4cd26f[_0x0de3('0x1b5')]+=0x1;_0x1e5977['state']=0xb;_0x1e5977[_0x0de3('0x9a')]=_0x0de3('0x117');_0x1e5977[_0x0de3('0xe9')]+=0x1;_0x1e5977[_0x0de3('0xe1')]+=0x1;_0x45bdca=_0x4cd26f[_0x0de3('0x119')];_0x131f43=_0x4cd26f[_0x0de3('0x10d')];_0x4df0d8[_0x0de3('0xc0')](_0x1e5977)[_0x0de3('0xad')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x4df0d8['checkRetriveMax'](0xb,_0x5cdbf3,_0x4cd26f)&&!_0x48d932){if(_0x1e5977[_0x0de3('0xe9')]>=_0x4cd26f[_0x0de3('0x11a')]){_0x4df0d8['createStateFinal'](_0x1e5977,_0x546496,_0x373c0b,_0x0de3('0x1b6'));}else{_0x4df0d8[_0x0de3('0xec')](_0x1e5977,_0x546496,_0x373c0b,_0x0de3('0x1b6'));}}break;case'20':_0x4cd26f[_0x0de3('0x5e')]+=0x1;_0x1e5977[_0x0de3('0x99')]=0x14;_0x1e5977[_0x0de3('0x9a')]='AgentReject';_0x1e5977[_0x0de3('0xea')]+=0x1;_0x1e5977[_0x0de3('0xe1')]+=0x1;_0x45bdca=_0x4cd26f[_0x0de3('0x1b7')];_0x131f43=_0x4cd26f[_0x0de3('0x10d')];ami['emit'](_0x0de3('0x1b8'),ut[_0x0de3('0xe3')](_0x5cdbf3,_0x0de3('0x1b9')));_0x4df0d8[_0x0de3('0xc0')](_0x1e5977)[_0x0de3('0xad')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x4df0d8['checkRetriveMax'](0x14,_0x5cdbf3,_0x4cd26f)&&!_0x48d932){if(_0x1e5977[_0x0de3('0xea')]>=_0x4cd26f[_0x0de3('0x1a1')]){_0x4df0d8[_0x0de3('0xee')](_0x1e5977,_0x546496,_0x373c0b,_0x0de3('0x1ba'));}else{_0x4df0d8[_0x0de3('0xec')](_0x1e5977,_0x546496,_0x373c0b,_0x0de3('0x1ba'));}}break;default:_0x4cd26f[_0x0de3('0x5f')]+=0x1;_0x1e5977['state']=0xc;_0x1e5977[_0x0de3('0x9a')]=_0x3734e6[_0x0de3('0xff')];_0x45bdca=_0x4cd26f[_0x0de3('0x1b7')];_0x131f43=_0x4cd26f['callAdditionalPhoneAfterMin'];_0x4df0d8[_0x0de3('0xc0')](_0x1e5977)[_0x0de3('0xad')](loggerCatch(_0x0de3('0x1bb')));if(_0x4df0d8['checkRetriveMax'](_0x3734e6[_0x0de3('0xff')],_0x5cdbf3,_0x4cd26f)&&!_0x48d932){if(_0x1e5977[_0x0de3('0xe5')]+_0x1e5977[_0x0de3('0xe6')]+_0x1e5977['countnoanswerretry']+_0x1e5977['countnosuchnumberretry']+_0x1e5977['countdropretry']+_0x1e5977[_0x0de3('0xe9')]+_0x1e5977[_0x0de3('0xe0')]+_0x1e5977[_0x0de3('0xea')]>=_0x4cd26f['dialGlobalMaxRetry']){_0x4df0d8[_0x0de3('0xec')](_0x1e5977,_0x546496,_0x373c0b,_0x3734e6[_0x0de3('0xff')]);}else{_0x4df0d8[_0x0de3('0xee')](_0x1e5977,_0x546496,_0x373c0b,_0x3734e6[_0x0de3('0xff')]);}}}})['then'](function(_0x2414b2){if(_0x48d932){_0x4df0d8[_0x0de3('0xaf')](_0x1e5977,_0x45bdca,_0x131f43)[_0x0de3('0xa8')](function(_0x3018f7){return _0x546496(0x1);});}});});};Dialer[_0x0de3('0x18')][_0x0de3('0xec')]=function(_0x34cd6a,_0xdafed6,_0x20a028,_0x2ad838){var _0x3aa51c=new Final(_0x34cd6a);_0x3aa51c['state']=0xf;_0x3aa51c[_0x0de3('0x9a')]=_0x0de3('0x1bc');this[_0x0de3('0xee')](_0x3aa51c,_0xdafed6,_0x20a028,_0x2ad838);};Dialer[_0x0de3('0x18')][_0x0de3('0xee')]=function(_0xae32b6,_0x48af2d,_0x112724,_0x1e5ead){this[_0x0de3('0xbe')](_0xae32b6)[_0x0de3('0xa8')](function(){return _0x48af2d(msgResponse(_0x0de3('0x1a3'),'Success',_0x1e5ead));})['catch'](function(){return _0x112724(msgResponse(_0x0de3('0x1bd'),_0x0de3('0x140'),_0x0de3('0x1be')));});};Dialer[_0x0de3('0x18')][_0x0de3('0x8')]=function(_0x28ccb7){var _0x5fbca8=_0x28ccb7['dialPredictiveOptimizationPercentage']/0x64;var _0x4e65a9=_0x28ccb7[_0x0de3('0x1bf')]/(_0x28ccb7[_0x0de3('0x1bf')]+_0x28ccb7[_0x0de3('0x55')]);var _0x82290a=Math['round'](_0x28ccb7['predictiveIntervalAvailable']*(_0x28ccb7['predictiveIntervalMaxThreshold']/0x64));var _0x443e3e=Math[_0x0de3('0x1c0')](_0x28ccb7['predictiveIntervalAvailable']*(_0x28ccb7[_0x0de3('0x1c1')]/0x64));var _0x3de94c=_0x28ccb7['available']+_0x28ccb7[_0x0de3('0x91')];var _0x2b03dc=Math[_0x0de3('0x1c2')](_0x28ccb7[_0x0de3('0x6a')]*_0x28ccb7[_0x0de3('0x6c')]*_0x28ccb7[_0x0de3('0x66')]*_0x28ccb7['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x28ccb7['startProgressive'])){if(!_['isUndefined'](_0x28ccb7[_0x0de3('0x23')])){_0x28ccb7[_0x0de3('0x23')]=undefined;loggerPredictive[_0x0de3('0x89')](_0x0de3('0x1c3'),_0x0de3('0x1c4'));}if(!_[_0x0de3('0x35')](_0x28ccb7[_0x0de3('0x85')])){loggerPredictive['error'](_0x0de3('0x1c3'),_0x0de3('0x1c5'));clearInterval(_0x28ccb7['handlePredictive']);_0x28ccb7[_0x0de3('0x85')]=undefined;}_0x28ccb7[_0x0de3('0x24')]=moment()['format'](_0x0de3('0xf2'));loggerPredictive[_0x0de3('0x78')](_0x28ccb7[_0x0de3('0x38')],'collection\x20data\x20in\x20progressive\x20at',_0x28ccb7[_0x0de3('0x24')]);this[_0x0de3('0x153')](_0x28ccb7,0x1);}else if(ifInterval(_0x28ccb7[_0x0de3('0x1c6')],_0x28ccb7[_0x0de3('0x24')])){this[_0x0de3('0x153')](_0x28ccb7,0x1);loggerPredictiveCalls[_0x0de3('0x78')](_0x0de3('0x1c7'),_0x28ccb7[_0x0de3('0x24')],_0x28ccb7['name']);_0x28ccb7['erlangCalls']=0x0;_0x28ccb7[_0x0de3('0x65')]=0x0;}else if(_0x5fbca8<_0x4e65a9&&_0x28ccb7[_0x0de3('0x1c8')]==='dropRate'){freeVariablesPredictive(_0x28ccb7);loggerPredictive[_0x0de3('0x78')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x0de3('0x1c9'),_0x4e65a9,_0x0de3('0x24'),_0x28ccb7[_0x0de3('0x38')]);}else if(_0x2b03dc<_0x28ccb7[_0x0de3('0x65')]&&_0x28ccb7['dialPredictiveOptimization']===_0x0de3('0x1ca')){freeVariablesPredictive(_0x28ccb7);loggerPredictive[_0x0de3('0x78')](_0x0de3('0x1cb'),'Max\x20Drop\x20',_0x2b03dc,_0x0de3('0x1cc'),_0x28ccb7[_0x0de3('0x65')],_0x0de3('0x24'),_0x28ccb7[_0x0de3('0x38')]);}else if(!ifInterval(_0x28ccb7[_0x0de3('0x1c6')],_0x28ccb7[_0x0de3('0x24')])&&_[_0x0de3('0x35')](_0x28ccb7[_0x0de3('0x23')])&&!_[_0x0de3('0x35')](_0x28ccb7[_0x0de3('0x24')])){_0x28ccb7['startPredictive']=moment()[_0x0de3('0x74')](_0x0de3('0xf2'));loggerPredictive[_0x0de3('0x78')](_0x28ccb7[_0x0de3('0x38')],_0x0de3('0x1cd'),_0x28ccb7[_0x0de3('0x23')]);this[_0x0de3('0xb3')](_0x28ccb7[_0x0de3('0x1c6')])['then'](this[_0x0de3('0x1ce')](_0x28ccb7))[_0x0de3('0xa8')](mergeDataErlangB(_0x28ccb7))[_0x0de3('0xa8')](this[_0x0de3('0x1cf')](_0x28ccb7))[_0x0de3('0xad')](loggerCatchPredictive(_0x0de3('0x1d0'),_0x28ccb7));}else if(!ifInterval(_0x28ccb7['dialPredictiveInterval'],_0x28ccb7[_0x0de3('0x23')])){_0x28ccb7['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x28ccb7[_0x0de3('0x23')]=moment()[_0x0de3('0x74')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0de3('0x78')](_0x28ccb7[_0x0de3('0x38')],_0x0de3('0x1d1'),_0x28ccb7[_0x0de3('0x23')]);clearInterval(_0x28ccb7[_0x0de3('0x85')]);_0x28ccb7[_0x0de3('0x85')]=undefined;this[_0x0de3('0xb3')](_0x28ccb7[_0x0de3('0x1c6')])[_0x0de3('0xa8')](this[_0x0de3('0x1ce')](_0x28ccb7))['then'](mergeDataErlangB(_0x28ccb7))['then'](this[_0x0de3('0x1cf')](_0x28ccb7))['catch'](loggerCatchPredictive(_0x0de3('0x1d2'),_0x28ccb7));}else if(_0x28ccb7[_0x0de3('0x67')]&&_0x3de94c<_0x28ccb7[_0x0de3('0x67')]-_0x443e3e){freeVariablesPredictive(_0x28ccb7);loggerPredictive['info'](_0x28ccb7[_0x0de3('0x38')],_0x0de3('0x1d3'),_0x3de94c,_0x0de3('0x1d4'),_0x28ccb7[_0x0de3('0x67')],'-',_0x443e3e,'=',_0x28ccb7[_0x0de3('0x67')]-_0x443e3e,')');}else if(_0x28ccb7[_0x0de3('0x67')]&&_0x3de94c>_0x28ccb7[_0x0de3('0x67')]+_0x82290a){freeVariablesPredictive(_0x28ccb7);loggerPredictive['info'](_0x28ccb7['name'],_0x0de3('0x1d3'),_0x3de94c,')\x20are\x20more\x20than\x20threshold\x20(',_0x28ccb7[_0x0de3('0x67')],'+',_0x82290a,'=',_0x28ccb7['predictiveIntervalAvailable']+_0x82290a,')');}};Dialer[_0x0de3('0x18')][_0x0de3('0x1ce')]=function(_0x18608c){var _0x577855=this;return function(_0x1b19c9){return new BPromise(function(_0x4fe2ff,_0x2dad70){_[_0x0de3('0x83')](_0x18608c,_0x1b19c9[0x0]);if(checkGetDataPredictive(_0x1b19c9[0x0])){var _0x5064c5=_0x18608c[_0x0de3('0x67')]=_0x18608c[_0x0de3('0x91')]+_0x18608c[_0x0de3('0x47')];var _0x4d248e=_0x18608c[_0x0de3('0x1c6')]*0x3c;var _0x3e844=_0x1b19c9[0x0][_0x0de3('0x61')]+_0x1b19c9[0x0][_0x0de3('0x7d')];var _0x28dcf8=(_0x1b19c9[0x0][_0x0de3('0x60')]+_0x1b19c9[0x0][_0x0de3('0x63')]+_0x1b19c9[0x0][_0x0de3('0x62')])/_0x1b19c9[0x0][_0x0de3('0x68')];_0x18608c[_0x0de3('0x66')]=_0x28dcf8>0x0?_0x28dcf8:0x1;switch(_0x18608c[_0x0de3('0x1c8')]){case _0x0de3('0x1ca'):var _0x4ddd7a=_0x18608c[_0x0de3('0x1d5')]/0x64;return _0x577855[_0x0de3('0x1d6')](_0x5064c5,_0x4d248e,_0x3e844,_0x28dcf8,_0x4ddd7a)[_0x0de3('0xa8')](function(_0x250b12){return _0x4fe2ff(_0x250b12);});case _0x0de3('0x1d7'):var _0x5f1610=_0x18608c[_0x0de3('0x1d5')]/0x64;return _0x577855[_0x0de3('0x1d8')](_0x5064c5,_0x4d248e,_0x3e844,_0x28dcf8,_0x5f1610)['then'](function(_0x7a6efe){return _0x4fe2ff(_0x7a6efe);});default:return _0x2dad70(msgResponse('[getDataPredictive]',_0x0de3('0x140'),_0x0de3('0x1d9')));}}else{return _0x2dad70(msgResponse(_0x0de3('0x1da'),'Failure',_0x0de3('0x1db')));}});};};Dialer[_0x0de3('0x18')][_0x0de3('0x1dc')]=function(_0x50662c){var _0x53119b=this;return function(_0x2dcc70){return new BPromise(function(_0x4de46a,_0x111ed4){_[_0x0de3('0x83')](_0x50662c,_0x2dcc70[0x0]);if(checkGetDataPredictive(_0x2dcc70[0x0])){loggerPredictive[_0x0de3('0x78')](JSON[_0x0de3('0x40')](_0x2dcc70[0x0]));if(_0x50662c[_0x0de3('0x1c8')]===_0x0de3('0x1ca')){return _0x53119b[_0x0de3('0xbc')](_0x50662c['id'])[_0x0de3('0xa8')](function(_0xb3b954){var _0x438d8c=_0x50662c[_0x0de3('0x158')]-_0xb3b954[0x0]['outboundQueuePauses'];var _0x2da975=_0x50662c[_0x0de3('0x1c6')]*0x3c;var _0x30a50a=_0x2dcc70[0x0]['predictiveIntervalAvgTalktime']+_0x2dcc70[0x0][_0x0de3('0x7d')];var _0x561140=(_0x2dcc70[0x0][_0x0de3('0x60')]+_0x2dcc70[0x0][_0x0de3('0x63')]+_0x2dcc70[0x0][_0x0de3('0x62')])/_0x2dcc70[0x0][_0x0de3('0x68')];var _0x83b82c=_0x50662c[_0x0de3('0x1d5')]/0x64;_0x50662c[_0x0de3('0x1dd')]=_0xb3b954[0x0]['outboundQueuePauses']||0x0;_0x50662c[_0x0de3('0x66')]=_0x561140>0x0?_0x561140:0x1;return _0x53119b['abandonmentRate'](_0x438d8c,_0x2da975,_0x30a50a,_0x561140,_0x83b82c);})[_0x0de3('0xa8')](function(_0x3f4c99){return _0x4de46a(_0x3f4c99);})[_0x0de3('0xad')](function(_0x4f8769){return _0x111ed4(msgResponse(_0x0de3('0x1de'),'Failure',JSON[_0x0de3('0x40')](_0x4f8769)));});}if(_0x50662c[_0x0de3('0x1c8')]==='agentBusyFactor'){return _0x53119b['getVoiceQueueRtPauses'](_0x50662c['id'])[_0x0de3('0xa8')](function(_0x36587d){var _0x19d520=_0x50662c[_0x0de3('0x158')]-_0x36587d[0x0][_0x0de3('0x1df')];var _0x1fb22e=_0x50662c[_0x0de3('0x1c6')]*0x3c;var _0x257b10=_0x2dcc70[0x0][_0x0de3('0x61')]+_0x2dcc70[0x0]['predictiveIntervalAvgHoldtime'];var _0xd9781e=(_0x2dcc70[0x0][_0x0de3('0x60')]+_0x2dcc70[0x0][_0x0de3('0x63')]+_0x2dcc70[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2dcc70[0x0][_0x0de3('0x68')];var _0x38b273=_0x50662c[_0x0de3('0x1d5')]/0x64;_0x50662c[_0x0de3('0x1dd')]=_0x36587d[0x0][_0x0de3('0x1df')]||0x0;_0x50662c[_0x0de3('0x66')]=_0xd9781e>0x0?_0xd9781e:0x1;return _0x53119b[_0x0de3('0x1d8')](_0x19d520,_0x1fb22e,_0x257b10,_0xd9781e,_0x38b273);})[_0x0de3('0xa8')](function(_0x1db77c){return _0x4de46a(_0x1db77c);})[_0x0de3('0xad')](function(_0x433ca5){return _0x111ed4(msgResponse(_0x0de3('0x1de'),'Failure',JSON[_0x0de3('0x40')](_0x433ca5)));});}}else{return _0x111ed4(msgResponse(_0x0de3('0x1da'),'Failure',_0x0de3('0x1db')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x39c644){var _0x5213a8=this;return function(){var _0x46572d=0x0;var _0x17654f=Math[_0x0de3('0x1c2')](_0x39c644[_0x0de3('0x6b')]*0x3e8);if(_0x17654f>0x0){_0x17654f=_0x17654f<0x64?0x64:_0x17654f;loggerPredictive[_0x0de3('0x78')](_0x39c644['name'],_0x0de3('0x1e0'),_0x17654f,_0x0de3('0x41'));_0x39c644[_0x0de3('0x85')]=setInterval(function(){_0x5213a8[_0x0de3('0x85')](_0x39c644);loggerPredictiveCalls[_0x0de3('0x78')]('[handlePredictive]',_0x46572d+=0x1);},_0x17654f);}else{loggerPredictive[_0x0de3('0x78')](_0x39c644[_0x0de3('0x38')],_0x0de3('0x1e1'));}};};Dialer[_0x0de3('0x18')][_0x0de3('0x1e2')]=function(_0x1edd16,_0x1c5cdb){var _0x4c1a5a=this;return function(_0x16f0b9){if(_[_0x0de3('0x3c')](_0x16f0b9)){if(_[_0x0de3('0x9f')](_0x1c5cdb[_0x0de3('0xc6')])||!_0x1c5cdb[_0x0de3('0x1e3')]){if(_0x1edd16[_0x0de3('0x50')]===_0x0de3('0x7')){_0x1edd16[_0x0de3('0x128')]=_[_0x0de3('0x35')](_0x1edd16[_0x0de3('0x128')])?!![]:_0x1edd16[_0x0de3('0x128')];var _0x4abc05=uuid['v4']();_0x4c1a5a[_0x0de3('0x11e')][_0x4abc05]=new Action(_0x1edd16,_0x1c5cdb,_0x4abc05);loggerBooked[_0x0de3('0x78')]('[booked][checkContactBlack]',_0x4abc05,_0x0de3('0x1e4'),JSON[_0x0de3('0x40')](_0x1edd16['queueStatusComplete']),_0x0de3('0x1e5'),_0x1edd16[_0x0de3('0x38')]);if(_0x1edd16[_0x0de3('0x128')]){_0x1edd16[_0x0de3('0x128')]=![];_0x4c1a5a[_0x0de3('0x26')][_0x4c1a5a[_0x0de3('0x11e')][_0x4abc05][_0x0de3('0xa6')]]=[];ami[_0x0de3('0x145')]({'actionid':_0x4abc05,'action':_0x0de3('0x1e6'),'queue':_0x1edd16[_0x0de3('0x38')]})['catch'](function(){_0x4c1a5a['updateOriginated'](_0x1edd16);_0x4c1a5a['rescheduleContact']({'active':![],'ContactId':_0x4c1a5a[_0x0de3('0x11e')][_0x4abc05][_0x0de3('0xc4')],'ListId':_0x4c1a5a[_0x0de3('0x11e')][_0x4abc05]['ListId'],'VoiceQueueId':_0x4c1a5a['actions'][_0x4abc05]['VoiceQueueId']||undefined,'CampaignId':_0x4c1a5a[_0x0de3('0x11e')][_0x4abc05][_0x0de3('0xc8')]||undefined})['catch'](loggerCatch(_0x0de3('0x1e7')));delete _0x4c1a5a[_0x0de3('0x11e')][_0x4abc05];});}else{loggerBooked[_0x0de3('0x78')](_0x0de3('0x1e8'),JSON['stringify'](_0x1edd16[_0x0de3('0x128')]),_0x0de3('0x1e5'),_0x1edd16[_0x0de3('0x38')]);_0x4c1a5a[_0x0de3('0xa3')](_0x1edd16);_0x4c1a5a[_0x0de3('0xf0')]({'active':![],'ContactId':_0x4c1a5a[_0x0de3('0x11e')][_0x4abc05][_0x0de3('0xc4')],'ListId':_0x4c1a5a[_0x0de3('0x11e')][_0x4abc05][_0x0de3('0xc5')],'VoiceQueueId':_0x4c1a5a[_0x0de3('0x11e')][_0x4abc05][_0x0de3('0xc7')]||undefined,'CampaignId':_0x4c1a5a[_0x0de3('0x11e')][_0x4abc05][_0x0de3('0xc8')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4c1a5a[_0x0de3('0x11e')][_0x4abc05];}}else{return _0x4c1a5a['actionOriginate'](_0x1edd16,_0x1c5cdb);}}else{if(getDiff(_0x1c5cdb[_0x0de3('0x1e9')])<_0x1edd16[_0x0de3('0x1ea')]*0x3c){if(_0x1c5cdb[_0x0de3('0x1eb')]&&!_0x1c5cdb[_0x0de3('0x1eb')]['voicePause']){_0x4c1a5a[_0x0de3('0x129')][_0x0de3('0x130')](_0x1c5cdb['id'])[_0x0de3('0x131')](function(){_0x4c1a5a[_0x0de3('0xa3')](_0x1edd16);});}else{_0x4c1a5a['unlockContact']({'active':![]},_0x1c5cdb['id'],0x1)[_0x0de3('0x131')](function(){_0x4c1a5a[_0x0de3('0xa3')](_0x1edd16);});}}else{_0x1edd16[_0x0de3('0x5d')]+=0x1;_0x4c1a5a['updateOriginated'](_0x1edd16);if(_0x1edd16[_0x0de3('0x1ec')]){_0x4c1a5a[_0x0de3('0xf0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1c5cdb['ContactId'],'ListId':_0x1c5cdb['ListId'],'VoiceQueueId':_0x1c5cdb[_0x0de3('0xc7')]||undefined,'CampaignId':_0x1c5cdb[_0x0de3('0xc8')]||undefined})[_0x0de3('0xad')](loggerCatch(_0x0de3('0x1ed')));_0x4c1a5a[_0x0de3('0xc0')](createObjHistory(_0x1edd16,_0x1c5cdb,_0x0de3('0x1ee'),0x17,_0x0de3('0x1ef')))[_0x0de3('0xad')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x4c1a5a[_0x0de3('0xd1')](createObjHistory(_0x1edd16,_0x1c5cdb,_0x0de3('0x1f0'),0x16,_0x0de3('0x1f1')),_0x0de3('0x1f2'),_0x0de3('0x1f3'));}}}}else{_0x1edd16[_0x0de3('0x56')]+=0x1;_0x4c1a5a[_0x0de3('0xd1')](createObjHistory(_0x1edd16,_0x1c5cdb,_0x0de3('0x1f4'),0xd,_0x0de3('0x1f5')),_0x0de3('0x1f6'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x0de3('0x18')]['handleIvr']=function(_0x586c3e){var _0x25940e=this;var _0xb95852=_0x586c3e[_0x0de3('0x1f7')]-_0x586c3e['originated']-_0x586c3e[_0x0de3('0xb8')];emitCampaignSummary(_0x586c3e);if(_0xb95852>0x0){if(_0xb95852>this['maxNumberOriginate']){_0xb95852=this[_0x0de3('0x1e')];}_0x586c3e[_0x0de3('0xb8')]+=_0xb95852;this[_0x0de3('0xba')](_0x586c3e['id'],_0xb95852,_0x586c3e['dialOrderByScheduledAt'],_0x586c3e)[_0x0de3('0xa8')](function(_0x448d3a){_0x586c3e[_0x0de3('0xb8')]-=_0xb95852;_0x586c3e['temp']=_0x586c3e[_0x0de3('0xb8')]>0x0?_0x586c3e[_0x0de3('0xb8')]:0x0;if(!checkContactEmpty(_0x448d3a)){_0x586c3e[_0x0de3('0x37')]=_0x0de3('0x90');logger['info']('[getContactCampaign2][Empty]'+_0x586c3e[_0x0de3('0x38')]);}else{_0x586c3e[_0x0de3('0x69')]+=_0x448d3a[_0x0de3('0x12d')];_0x586c3e[_0x0de3('0x37')]=_0x0de3('0x1f8');for(var _0x1b840b=0x0;_0x1b840b<_0x448d3a[_0x0de3('0x12d')];_0x1b840b+=0x1){_0x586c3e[_0x0de3('0x1f9')]+=0x1;if(_[_0x0de3('0x9f')](_0x448d3a[_0x1b840b])||_[_0x0de3('0x9f')](_0x448d3a[_0x1b840b][_0x0de3('0x17d')])||_[_0x0de3('0x9f')](_0x448d3a[_0x1b840b][_0x0de3('0x164')])){_0x25940e['emptyContact']('[actionOriginate]\x20',_0x586c3e,_0x448d3a[_0x1b840b]);}else{_0x25940e['checkIsBlackListIvr'](_[_0x0de3('0xc3')](_0x448d3a[_0x1b840b],[_0x0de3('0xc8'),_0x0de3('0x1fa')]))[_0x0de3('0xa8')](_0x25940e[_0x0de3('0x1e2')](_0x586c3e,_0x448d3a[_0x1b840b]))[_0x0de3('0xad')](_0x25940e[_0x0de3('0x1fb')]('[actionOriginateIvr]\x20',_0x586c3e));}}}})[_0x0de3('0xad')](loggerGetContactDialer(_0x0de3('0x1fc'),_0x586c3e,_0xb95852));}};Dialer[_0x0de3('0x18')][_0x0de3('0x153')]=function(_0x39c4fe,_0x462905){var _0x6dc9e2=this;var _0x478059=[];var _0x179ba6=_0x462905>=0x1?_0x462905:0x1;if(_0x39c4fe[_0x0de3('0x50')]===_0x0de3('0x7')){_0x179ba6=0x1;}var _0x13fe26=Math['floor'](_0x39c4fe[_0x0de3('0x47')]*_0x179ba6)-_0x39c4fe[_0x0de3('0x69')]-_0x39c4fe[_0x0de3('0xb8')];emitVoiceQueueSummary(_0x39c4fe);if(_0x39c4fe[_0x0de3('0x1fd')]>0x0){var _0x1a9893=_0x39c4fe[_0x0de3('0x1fd')]-_0x39c4fe['originated']-_0x39c4fe[_0x0de3('0x91')]-_0x39c4fe[_0x0de3('0xb8')]-_0x39c4fe[_0x0de3('0x48')];if(_0x13fe26>_0x1a9893){_0x13fe26=_0x1a9893;}}if(_0x13fe26>0x0){if(_0x39c4fe[_0x0de3('0x50')]===_0x0de3('0x7')){_0x13fe26=0x1;}if(_0x13fe26>this[_0x0de3('0x1e')]){_0x13fe26=this[_0x0de3('0x1e')];}_0x39c4fe[_0x0de3('0xb8')]+=_0x13fe26;for(var _0xccc1e2 in this['agents']){if(typeof this[_0x0de3('0x1c')][_0xccc1e2]!==_0x0de3('0xc1')){if(this[_0x0de3('0x1c')][_0xccc1e2][_0x0de3('0x99')]==='not_inuse'&&this['agents'][_0xccc1e2]['status']===_0x0de3('0xce')){_0x478059[_0x0de3('0x125')](this[_0x0de3('0x1c')][_0xccc1e2]['id']);}}}this['getContactDialer'](_0x39c4fe['id'],_0x478059,_0x13fe26,_0x39c4fe[_0x0de3('0x1fe')],_0x39c4fe)['then'](function(_0xd53a7b){_0x39c4fe[_0x0de3('0xb8')]-=_0x13fe26;_0x39c4fe[_0x0de3('0xb8')]=_0x39c4fe[_0x0de3('0xb8')]>0x0?_0x39c4fe['temp']:0x0;if(!checkContactEmpty(_0xd53a7b)){_0x6dc9e2['countReScheduled'](_0x39c4fe)[_0x0de3('0xa8')](sendMessageReschedule(_0x39c4fe))[_0x0de3('0xad')](loggerCatch('[countReScheduled]\x20'));}else{_0x39c4fe[_0x0de3('0x69')]+=_0xd53a7b[_0x0de3('0x12d')];_0x39c4fe[_0x0de3('0x37')]=_0x39c4fe['dialMethod']===_0x0de3('0x7')?_0x0de3('0x16c'):_0x0de3('0x1f8');for(var _0x5dca45=0x0;_0x5dca45<_0xd53a7b[_0x0de3('0x12d')];_0x5dca45+=0x1){if(_[_0x0de3('0x9f')](_0xd53a7b[_0x5dca45])||_[_0x0de3('0x9f')](_0xd53a7b[_0x5dca45]['Contact'])||_[_0x0de3('0x9f')](_0xd53a7b[_0x5dca45][_0x0de3('0x164')])){_0x6dc9e2['emptyContact'](_0x0de3('0x1ff'),_0x39c4fe,_0xd53a7b[_0x5dca45]);}else{_0x6dc9e2['checkIsBlackList'](_[_0x0de3('0xc3')](_0xd53a7b[_0x5dca45],[_0x0de3('0xc7'),_0x0de3('0x1fa')]))[_0x0de3('0xa8')](_0x6dc9e2[_0x0de3('0x1e2')](_0x39c4fe,_0xd53a7b[_0x5dca45]))[_0x0de3('0xad')](_0x6dc9e2[_0x0de3('0x1fb')](_0x0de3('0x1ff'),_0x39c4fe));}}}})[_0x0de3('0xad')](loggerGetContactDialer(_0x0de3('0x200'),_0x39c4fe,_0x13fe26));}};Dialer[_0x0de3('0x18')][_0x0de3('0x85')]=function(_0x190506){if(_0x190506[_0x0de3('0x1fd')]>0x0){var _0x296679=_0x190506['dialLimitQueue']-_0x190506[_0x0de3('0x69')]-_0x190506['talking'];if(_0x296679>0x0){this[_0x0de3('0x201')](_0x190506);}else{loggerPredictiveCalls[_0x0de3('0x78')](_0x0de3('0x202'));}}else{this['tryOriginatePredictive'](_0x190506);}};Dialer[_0x0de3('0x18')][_0x0de3('0x201')]=function(_0x3d753d){var _0x5c5443=this;var _0x1740f9=[];_0x3d753d[_0x0de3('0x69')]+=0x1;for(var _0x51cd68 in this[_0x0de3('0x1c')]){if(typeof this[_0x0de3('0x1c')][_0x51cd68]!==_0x0de3('0xc1')){if(this[_0x0de3('0x1c')][_0x51cd68][_0x0de3('0x99')]==='not_inuse'&&this['agents'][_0x51cd68][_0x0de3('0xa0')]===_0x0de3('0xce')){_0x1740f9[_0x0de3('0x125')](this[_0x0de3('0x1c')][_0x51cd68]['id']);}}}this[_0x0de3('0xb7')](_0x3d753d['id'],_0x1740f9,0x1,_0x3d753d[_0x0de3('0x1fe')],_0x3d753d)['then'](function(_0x2f589f){if(!checkContactEmpty(_0x2f589f)){checkContactLowerLimitOriginate(_0x3d753d,0x1,0x0);_0x5c5443[_0x0de3('0xa9')](_0x3d753d)['then'](sendMessageReschedule(_0x3d753d))[_0x0de3('0xad')](loggerCatch(_0x0de3('0x203')));}else{_0x3d753d['message']=_0x0de3('0x1f8');if(_[_0x0de3('0x9f')](_0x2f589f[0x0])||_['isNil'](_0x2f589f[0x0][_0x0de3('0x17d')])||_[_0x0de3('0x9f')](_0x2f589f[0x0][_0x0de3('0x164')])){_0x5c5443[_0x0de3('0xc2')](_0x0de3('0x1ff'),_0x3d753d,_0x2f589f[0x0]);}else{_0x5c5443['checkIsBlackList'](_['pick'](_0x2f589f[0x0],[_0x0de3('0xc7'),_0x0de3('0x1fa')]))[_0x0de3('0xa8')](_0x5c5443['checkContactBlack'](_0x3d753d,_0x2f589f[0x0]))[_0x0de3('0xad')](_0x5c5443[_0x0de3('0x1fb')](_0x0de3('0x204'),_0x3d753d));}}})['catch'](loggerGetContactDialer(_0x0de3('0x205'),_0x3d753d,0x1));emitVoiceQueueSummary(_0x3d753d);};Dialer[_0x0de3('0x18')]['abandonmentRate']=function(_0x4e30c1,_0x1c3d9b,_0x4a1fdd,_0x21b877,_0xc8381a,_0x5021b3){loggerPredictive[_0x0de3('0x78')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x0de3('0x78')]('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',_0x4e30c1);loggerPredictive[_0x0de3('0x78')](_0x0de3('0x206'),_0x1c3d9b);loggerPredictive[_0x0de3('0x78')](_0x0de3('0x207'),_0x4a1fdd);loggerPredictive[_0x0de3('0x78')](_0x0de3('0x208'),_0x21b877);loggerPredictive[_0x0de3('0x78')](_0x0de3('0x209'),_0xc8381a);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x27d516,_0x15ea9c){if(_0x4e30c1<=0x0||isNaN(_0x4e30c1)){return _0x15ea9c(msgResponse(_0x0de3('0x20a'),_0x0de3('0x3f'),_0x0de3('0x20b')+_0x4e30c1));}if(_0x4a1fdd<=0x0||isNaN(_0x4a1fdd)){return _0x15ea9c(msgResponse(_0x0de3('0x20a'),_0x0de3('0x3f'),_0x0de3('0x20c')+_0x4a1fdd));}if(_0x21b877<=0x0||isNaN(_0x21b877)){return _0x15ea9c(msgResponse(_0x0de3('0x20a'),'Error',_0x0de3('0x20d')+_0x21b877));}if(_0x1c3d9b<=0x0||isNaN(_0x1c3d9b)){return _0x15ea9c(msgResponse(_0x0de3('0x20a'),_0x0de3('0x3f'),_0x0de3('0x20e')+_0x1c3d9b));}if(_0xc8381a<=0x0||isNaN(_0xc8381a)){return _0x15ea9c(msgResponse(_0x0de3('0x20a'),_0x0de3('0x3f'),'Amax\x20=\x20'+_0xc8381a));}_0x5021b3=_0x5021b3||0x0;var _0x537a33=0x1/_0x4a1fdd;var _0x566184=0x0;var _0x14c5ed=0x0;var _0x545e36=0x0;var _0x3f7eb5=0x0;for(var _0x3d31ec=0x0;_0x545e36<_0xc8381a;_0x3d31ec+=0x1){_0x14c5ed=_0x3d31ec/_0x1c3d9b;_0x566184=(_0x21b877*_0x14c5ed+_0x5021b3)/_0x537a33;_0x545e36=erlangb(_0x566184,_0x4e30c1);_0x3f7eb5=_0x566184/_0x4e30c1*(0x1-erlangb(_0x566184,_0x4e30c1));}return _0x27d516({'erlangCalls':_0x3d31ec,'erlangCallToSecond':_0x1c3d9b/_0x3d31ec,'erlangAbandonmentRate':_0x545e36,'erlangBusyFactor':_0x3f7eb5});});};Dialer[_0x0de3('0x18')][_0x0de3('0x1d8')]=function(_0x1cc6ab,_0x20459a,_0x554e7f,_0x4ae4fc,_0x12862f,_0x2f9e51){loggerPredictive[_0x0de3('0x78')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0x0de3('0x20f'),_0x1cc6ab);loggerPredictive['info'](_0x0de3('0x206'),_0x20459a);loggerPredictive[_0x0de3('0x78')]('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',_0x554e7f);loggerPredictive['info'](_0x0de3('0x208'),_0x4ae4fc);loggerPredictive[_0x0de3('0x78')](_0x0de3('0x210'),_0x12862f);loggerPredictive[_0x0de3('0x78')]('---------------------------');return new BPromise(function(_0x2d7418,_0x592858){if(_0x1cc6ab<=0x0||isNaN(_0x1cc6ab)){return _0x592858(msgResponse(_0x0de3('0x211'),_0x0de3('0x3f'),_0x0de3('0x20b')+_0x1cc6ab));}if(_0x554e7f<=0x0||isNaN(_0x554e7f)){return _0x592858(msgResponse(_0x0de3('0x211'),_0x0de3('0x3f'),_0x0de3('0x20c')+_0x554e7f));}if(_0x4ae4fc<=0x0||isNaN(_0x4ae4fc)){return _0x592858(msgResponse(_0x0de3('0x211'),_0x0de3('0x3f'),_0x0de3('0x20d')+_0x4ae4fc));}if(_0x20459a<=0x0||isNaN(_0x20459a)){return _0x592858(msgResponse('[busyFactor]',_0x0de3('0x3f'),_0x0de3('0x20e')+_0x20459a));}if(_0x12862f<=0x0||isNaN(_0x12862f)){return _0x592858(msgResponse('[busyFactor]',_0x0de3('0x3f'),_0x0de3('0x212')+_0x12862f));}_0x2f9e51=_0x2f9e51||0x0;var _0x1923c1=0x1/_0x554e7f;var _0x3ddbfa=0x0;var _0x2ac934=0x0;var _0x19841c=0x0;var _0x265379=0x0;for(var _0x57a9ad=0x0;_0x265379<_0x12862f;_0x57a9ad+=0x1){_0x2ac934=_0x57a9ad/_0x20459a;_0x3ddbfa=(_0x4ae4fc*_0x2ac934+_0x2f9e51)/_0x1923c1;_0x19841c=erlangb(_0x3ddbfa,_0x1cc6ab);_0x265379=_0x3ddbfa/_0x1cc6ab*(0x1-erlangb(_0x3ddbfa,_0x1cc6ab));}return _0x2d7418({'erlangCalls':_0x57a9ad,'erlangCallToSecond':_0x20459a/_0x57a9ad,'erlangAbandonmentRate':_0x19841c,'erlangBusyFactor':_0x265379});});};module[_0x0de3('0x213')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index acbe729..fb3827e 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb53=['type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','queue','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','scheduledat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb53,0x1db));var _0x3db5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb53[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x3db5('0x0'));function getSeconds(_0x24a973,_0x2327ec){var _0x13037b=moment(_0x24a973)[_0x3db5('0x1')](0x0);var _0x50754d=moment(_0x2327ec)['milliseconds'](0x0);return _0x13037b[_0x3db5('0x2')](_0x50754d,_0x3db5('0x3'));}function QueueCallerAbandon(_0x32be7b,_0x56ff62){this[_0x3db5('0x4')]=_0x32be7b['scheduledat'];this['type']=_0x32be7b[_0x3db5('0x5')];this[_0x3db5('0x6')]=_0x32be7b[_0x3db5('0x5')]===_0x3db5('0x7')?'queue':_0x32be7b[_0x3db5('0x5')];this[_0x3db5('0x8')]=_0x32be7b[_0x3db5('0x8')];this['countcongestionretry']=_0x32be7b['countcongestionretry'];this[_0x3db5('0x9')]=_0x32be7b[_0x3db5('0x9')];this[_0x3db5('0xa')]=_0x32be7b[_0x3db5('0x8')]+_0x32be7b['countcongestionretry']+_0x32be7b['countnoanswerretry']+_0x32be7b[_0x3db5('0xb')]+_0x32be7b[_0x3db5('0xc')]+_0x32be7b[_0x3db5('0xd')]+_0x32be7b['countmachineretry']+_0x32be7b[_0x3db5('0xe')];this[_0x3db5('0xb')]=_0x32be7b[_0x3db5('0xb')];this[_0x3db5('0xc')]=_0x32be7b[_0x3db5('0xc')];this[_0x3db5('0xd')]=_0x32be7b[_0x3db5('0xd')];this['countmachineretry']=_0x32be7b[_0x3db5('0xf')];this[_0x3db5('0xe')]=_0x32be7b[_0x3db5('0xe')];this['uniqueid']=_0x56ff62['uniqueid'];this[_0x3db5('0x10')]=_0x32be7b[_0x3db5('0x11')];this[_0x3db5('0x12')]=_0x32be7b[_0x3db5('0x13')];this[_0x3db5('0x14')]=_0x32be7b[_0x3db5('0x14')];this['responsetime']=_0x32be7b[_0x3db5('0x15')];this[_0x3db5('0x16')]=_0x32be7b[_0x3db5('0x16')];this[_0x3db5('0x17')]=this[_0x3db5('0x16')];this['ringtime']=getSeconds(_0x32be7b[_0x3db5('0x15')],_0x32be7b[_0x3db5('0x14')]);this[_0x3db5('0x18')]=getSeconds(this[_0x3db5('0x16')],_0x32be7b[_0x3db5('0x15')]);this[_0x3db5('0x19')]=0x0;this[_0x3db5('0x1a')]=_0x56ff62[_0x3db5('0x1a')];this['membername']=_0x56ff62[_0x3db5('0x1b')];this['reason']=_0x56ff62['reason'];this[_0x3db5('0x1c')]=_0x32be7b[_0x3db5('0x1c')];this[_0x3db5('0x1d')]=_0x32be7b[_0x3db5('0x1d')];this[_0x3db5('0x1e')]=_0x32be7b[_0x3db5('0x1e')];this[_0x3db5('0x1f')]=_0x32be7b['recallme'];this[_0x3db5('0x20')]=_0x32be7b['ContactId'];this[_0x3db5('0x21')]=_0x32be7b['ListId'];this['UserId']=_0x32be7b[_0x3db5('0x22')];this[_0x3db5('0x23')]=_0x32be7b[_0x3db5('0x23')];this[_0x3db5('0x24')]=_0x32be7b['CampaignId'];this[_0x3db5('0x25')]=_0x32be7b[_0x3db5('0x25')]||'';this[_0x3db5('0x26')]=_0x32be7b[_0x3db5('0x26')]||'';}module[_0x3db5('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0xf144=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','moment','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0xf144,0xbc));var _0x4f14=function(_0x296782,_0x407742){_0x296782=_0x296782-0x0;var _0x2c8173=_0xf144[_0x296782];return _0x2c8173;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x4f14('0x0'));function getSeconds(_0x3bbda2,_0x3c7921){var _0x22c4ea=moment(_0x3bbda2)[_0x4f14('0x1')](0x0);var _0x1c76b7=moment(_0x3c7921)['milliseconds'](0x0);return _0x22c4ea[_0x4f14('0x2')](_0x1c76b7,_0x4f14('0x3'));}function QueueCallerAbandon(_0x4415b9,_0x1a60da){this[_0x4f14('0x4')]=_0x4415b9[_0x4f14('0x4')];this['type']=_0x4415b9[_0x4f14('0x5')];this['campaigntype']=_0x4415b9['type']===_0x4f14('0x6')?_0x4f14('0x7'):_0x4415b9[_0x4f14('0x5')];this['countbusyretry']=_0x4415b9[_0x4f14('0x8')];this[_0x4f14('0x9')]=_0x4415b9[_0x4f14('0x9')];this[_0x4f14('0xa')]=_0x4415b9[_0x4f14('0xa')];this[_0x4f14('0xb')]=_0x4415b9['countbusyretry']+_0x4415b9['countcongestionretry']+_0x4415b9[_0x4f14('0xa')]+_0x4415b9[_0x4f14('0xc')]+_0x4415b9['countdropretry']+_0x4415b9[_0x4f14('0xd')]+_0x4415b9[_0x4f14('0xe')]+_0x4415b9[_0x4f14('0xf')];this[_0x4f14('0xc')]=_0x4415b9[_0x4f14('0xc')];this[_0x4f14('0x10')]=_0x4415b9[_0x4f14('0x10')];this[_0x4f14('0xd')]=_0x4415b9[_0x4f14('0xd')];this[_0x4f14('0xe')]=_0x4415b9[_0x4f14('0xe')];this[_0x4f14('0xf')]=_0x4415b9['countagentrejectretry'];this[_0x4f14('0x11')]=_0x1a60da[_0x4f14('0x11')];this['calleridname']=_0x4415b9[_0x4f14('0x12')];this[_0x4f14('0x13')]=_0x4415b9[_0x4f14('0x14')];this[_0x4f14('0x15')]=_0x4415b9[_0x4f14('0x15')];this[_0x4f14('0x16')]=_0x4415b9['responsetime'];this[_0x4f14('0x17')]=_0x4415b9['droptime'];this[_0x4f14('0x18')]=this['droptime'];this['ringtime']=getSeconds(_0x4415b9['responsetime'],_0x4415b9[_0x4f14('0x15')]);this[_0x4f14('0x19')]=getSeconds(this[_0x4f14('0x17')],_0x4415b9[_0x4f14('0x16')]);this[_0x4f14('0x1a')]=0x0;this[_0x4f14('0x7')]=_0x1a60da[_0x4f14('0x7')];this['membername']=_0x1a60da[_0x4f14('0x1b')];this['reason']=_0x1a60da[_0x4f14('0x1c')];this[_0x4f14('0x1d')]=_0x4415b9[_0x4f14('0x1d')];this[_0x4f14('0x1e')]=_0x4415b9[_0x4f14('0x1e')];this[_0x4f14('0x1f')]=_0x4415b9[_0x4f14('0x1f')];this[_0x4f14('0x20')]=_0x4415b9[_0x4f14('0x20')];this[_0x4f14('0x21')]=_0x4415b9['ContactId'];this[_0x4f14('0x22')]=_0x4415b9['ListId'];this['UserId']=_0x4415b9[_0x4f14('0x23')];this['VoiceQueueId']=_0x4415b9[_0x4f14('0x24')];this[_0x4f14('0x25')]=_0x4415b9[_0x4f14('0x25')];this['originatecalleridnum']=_0x4415b9['originatecalleridnum']||'';this[_0x4f14('0x26')]=_0x4415b9[_0x4f14('0x26')]||'';}module[_0x4f14('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 94d9ae7..f638d91 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 _0x6ad0=['util','moment','channel','format','%s/%s/%s','tech','Trunk','name','fax','headerinfo','path','AttachmentId','exports'];(function(_0x1fceef,_0xe84cbd){var _0x2ee365=function(_0x43b91d){while(--_0x43b91d){_0x1fceef['push'](_0x1fceef['shift']());}};_0x2ee365(++_0xe84cbd);}(_0x6ad0,0xc3));var _0x06ad=function(_0x388f93,_0x41f45e){_0x388f93=_0x388f93-0x0;var _0x5a0f12=_0x6ad0[_0x388f93];return _0x5a0f12;};'use strict';var util=require(_0x06ad('0x0'));var _=require('lodash');var moment=require(_0x06ad('0x1'));function Action(_0x249ad7,_0x544e21,_0x652aab){this['uniqueid']=_0x249ad7||undefined;this[_0x06ad('0x2')]=util[_0x06ad('0x3')](_0x06ad('0x4'),_0x544e21[_0x06ad('0x5')],_0x544e21[_0x06ad('0x6')][_0x06ad('0x7')],_0x652aab[_0x06ad('0x8')]);this['localstationid']=_0x544e21['localstationid'];this[_0x06ad('0x9')]=_0x544e21[_0x06ad('0x9')];this['path']=_0x652aab[_0x06ad('0xa')];this[_0x06ad('0xb')]=_0x652aab[_0x06ad('0xb')];}module[_0x06ad('0xc')]=Action; \ No newline at end of file +var _0xbf3b=['channel','format','%s/%s/%s','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports','lodash','uniqueid'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0xbf3b,0x66));var _0xbbf3=function(_0x531043,_0x522250){_0x531043=_0x531043-0x0;var _0x85dbc0=_0xbf3b[_0x531043];return _0x85dbc0;};'use strict';var util=require('util');var _=require(_0xbbf3('0x0'));var moment=require('moment');function Action(_0x2c0f5d,_0x15f3d7,_0x539319){this[_0xbbf3('0x1')]=_0x2c0f5d||undefined;this[_0xbbf3('0x2')]=util[_0xbbf3('0x3')](_0xbbf3('0x4'),_0x15f3d7['tech'],_0x15f3d7[_0xbbf3('0x5')][_0xbbf3('0x6')],_0x539319[_0xbbf3('0x7')]);this['localstationid']=_0x15f3d7[_0xbbf3('0x8')];this[_0xbbf3('0x9')]=_0x15f3d7[_0xbbf3('0x9')];this[_0xbbf3('0xa')]=_0x539319['path'];this[_0xbbf3('0xb')]=_0x539319[_0xbbf3('0xb')];}module[_0xbbf3('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 3e8bf23..5e517fc 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 _0xb2af=['actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newexten','syncNewExten','faxstatus','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','name','info','\x20syncNewchannel\x20','channel','variable','value','syncNewState','channelstate','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','AttachmentId','update','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','syncHangup','\x20hangup\x20sendFile\x20','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','message','Fax\x20failed','checkTrunk','Trunk','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','variablesAction','Action','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb2af,0xd2));var _0xfb2a=function(_0x1d52ff,_0x836c36){_0x1d52ff=_0x1d52ff-0x0;var _0x292cbe=_0xb2af[_0x1d52ff];return _0x292cbe;};'use strict';var util=require(_0xfb2a('0x0'));var _=require(_0xfb2a('0x1'));var BPromise=require(_0xfb2a('0x2'));var uuid=require(_0xfb2a('0x3'));var moment=require('moment');var path=require(_0xfb2a('0x4'));var tiff2pdf=require(_0xfb2a('0x5'));var gs=require(_0xfb2a('0x6'));var logger=require(_0xfb2a('0x7'))(_0xfb2a('0x8'));var ami=require('../ami');var rpcDb=require(_0xfb2a('0x9'));var Channel=require(_0xfb2a('0xa'));var ut=require(_0xfb2a('0xb'));var Action=require('./action');var faxAccount=require(_0xfb2a('0xc'));var attachment=require(_0xfb2a('0xd'));var faxMessage=require(_0xfb2a('0xe'));function Fax(_0x55bb4e){this[_0xfb2a('0xf')]={};this[_0xfb2a('0x10')]=_0x55bb4e[_0xfb2a('0x10')];this[_0xfb2a('0x11')]=_0x55bb4e[_0xfb2a('0x11')];this[_0xfb2a('0x12')]={};ami['on'](_0xfb2a('0x13'),this[_0xfb2a('0x14')][_0xfb2a('0x15')](this));ami['on'](_0xfb2a('0x16'),this[_0xfb2a('0x17')][_0xfb2a('0x15')](this));ami['on']('newstate',this['syncNewState']['bind'](this));ami['on'](_0xfb2a('0x18'),this[_0xfb2a('0x19')][_0xfb2a('0x15')](this));ami['on'](_0xfb2a('0x1a'),this['syncFaxStatus'][_0xfb2a('0x15')](this));ami['on']('receivefax',this['syncReceiveFax'][_0xfb2a('0x15')](this));ami['on']('hangup',this['syncHangup'][_0xfb2a('0x15')](this));ami['on'](_0xfb2a('0x1b'),this[_0xfb2a('0x1c')][_0xfb2a('0x15')](this));}Fax[_0xfb2a('0x1d')][_0xfb2a('0x14')]=function(_0x30c000){if(_0x30c000[_0xfb2a('0x1e')]===_0xfb2a('0x1f')){for(var _0x52743a in this[_0xfb2a('0x10')]){if(this[_0xfb2a('0x10')][_0xfb2a('0x20')](_0x52743a)){if(_0x30c000[_0xfb2a('0x21')]===this['faxAccounts'][_0x52743a][_0xfb2a('0x22')]){this['channels'][_0x30c000[_0xfb2a('0x23')]]={};this[_0xfb2a('0xf')][_0x30c000[_0xfb2a('0x23')]]['channel']=_0x30c000['channel'];this['channels'][_0x30c000['uniqueid']]['id']=this[_0xfb2a('0x10')][_0x52743a]['id'];this[_0xfb2a('0xf')][_0x30c000[_0xfb2a('0x23')]][_0xfb2a('0x24')]=this[_0xfb2a('0x10')][_0x52743a][_0xfb2a('0x24')];logger[_0xfb2a('0x25')](_0x30c000[_0xfb2a('0x23')],_0xfb2a('0x26'));}}}}if(this[_0xfb2a('0x12')][_0x30c000['uniqueid']]){this[_0xfb2a('0xf')][_0x30c000['uniqueid']]={};this[_0xfb2a('0xf')][_0x30c000[_0xfb2a('0x23')]]['channel']=_0x30c000[_0xfb2a('0x27')];logger[_0xfb2a('0x25')](_0x30c000['uniqueid'],_0xfb2a('0x26'));}};Fax[_0xfb2a('0x1d')]['syncVarSet']=function(_0x463f06){if(this[_0xfb2a('0xf')][_0x463f06[_0xfb2a('0x23')]]){for(var _0x38a7fa in _0x463f06[_0xfb2a('0x28')]){if(_0x463f06[_0xfb2a('0x28')][_0xfb2a('0x20')](_0x38a7fa)){this[_0xfb2a('0xf')][_0x463f06[_0xfb2a('0x23')]][_0x38a7fa]=_0x463f06[_0xfb2a('0x29')];}}}};Fax['prototype'][_0xfb2a('0x2a')]=function(_0x3a4861){if(this[_0xfb2a('0xf')][_0x3a4861[_0xfb2a('0x23')]]){this[_0xfb2a('0xf')][_0x3a4861[_0xfb2a('0x23')]][_0xfb2a('0x2b')]=_0x3a4861[_0xfb2a('0x2b')];this['channels'][_0x3a4861[_0xfb2a('0x23')]]['channelstatedesc']=_0x3a4861['channelstatedesc'];}};Fax[_0xfb2a('0x1d')][_0xfb2a('0x19')]=function(_0x44fa1a){if(this['channels'][_0x44fa1a[_0xfb2a('0x23')]]){for(var _0x4ee3b9 in _0x44fa1a[_0xfb2a('0x28')]){if(_0x44fa1a[_0xfb2a('0x28')][_0xfb2a('0x20')](_0x4ee3b9)){this[_0xfb2a('0xf')][_0x44fa1a[_0xfb2a('0x23')]][_0x4ee3b9]=_0x44fa1a[_0xfb2a('0x29')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x41fbac){if(this[_0xfb2a('0xf')][_0x41fbac['uniqueid']]){this['channels'][_0x41fbac[_0xfb2a('0x23')]][_0xfb2a('0x2c')]=_0x41fbac[_0xfb2a('0x2c')];this[_0xfb2a('0xf')][_0x41fbac[_0xfb2a('0x23')]][_0xfb2a('0x2d')]=_0x41fbac['status'];this[_0xfb2a('0xf')][_0x41fbac[_0xfb2a('0x23')]][_0xfb2a('0x22')]=_0x41fbac[_0xfb2a('0x22')];this[_0xfb2a('0xf')][_0x41fbac[_0xfb2a('0x23')]][_0xfb2a('0x2e')]=_0x41fbac[_0xfb2a('0x2e')];logger[_0xfb2a('0x25')](_0x41fbac[_0xfb2a('0x23')],_0xfb2a('0x2f'));}};Fax[_0xfb2a('0x1d')][_0xfb2a('0x30')]=function(_0x17bb29){var _0xee9d74=this;if(this[_0xfb2a('0xf')][_0x17bb29[_0xfb2a('0x23')]]){var _0x30fa14=this[_0xfb2a('0xf')][_0x17bb29[_0xfb2a('0x23')]]['id'];this[_0xfb2a('0xf')][_0x17bb29[_0xfb2a('0x23')]][_0xfb2a('0x31')]=_0x17bb29[_0xfb2a('0x31')];this[_0xfb2a('0xf')][_0x17bb29[_0xfb2a('0x23')]][_0xfb2a('0x32')]=_0x17bb29[_0xfb2a('0x32')];this[_0xfb2a('0xf')][_0x17bb29['uniqueid']][_0xfb2a('0x22')]=_0x17bb29[_0xfb2a('0x22')];this[_0xfb2a('0xf')][_0x17bb29[_0xfb2a('0x23')]][_0xfb2a('0x33')]=_0x17bb29[_0xfb2a('0x33')];this['channels'][_0x17bb29[_0xfb2a('0x23')]][_0xfb2a('0x34')]=_0x17bb29[_0xfb2a('0x34')];this['channels'][_0x17bb29[_0xfb2a('0x23')]][_0xfb2a('0x2e')]=_0x17bb29[_0xfb2a('0x2e')];this[_0xfb2a('0xf')][_0x17bb29['uniqueid']][_0xfb2a('0x35')]=_0x17bb29[_0xfb2a('0x35')];if(this[_0xfb2a('0xf')][_0x17bb29[_0xfb2a('0x23')]][_0xfb2a('0x32')]>0x0){tiff2pdf(_0x17bb29[_0xfb2a('0x2e')],_0xfb2a('0x36'),function(_0x3de512){logger[_0xfb2a('0x25')](_0x17bb29['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x3de512['message']);attachment[_0xfb2a('0x37')]({'name':path[_0xfb2a('0x38')](_0x17bb29['filename'])['name'],'basename':path['parse'](_0x17bb29[_0xfb2a('0x2e')])[_0xfb2a('0x24')]+_0xfb2a('0x39'),'type':_0xfb2a('0x3a')})['then'](function(_0x10b446){faxAccount[_0xfb2a('0x3b')](_0x30fa14,{'from':_0x17bb29[_0xfb2a('0x35')],'mapKey':'fax','body':path['parse'](_0x17bb29['filename'])[_0xfb2a('0x24')]+_0xfb2a('0x39'),'AttachmentId':_0x10b446['id']})[_0xfb2a('0x3c')](function(_0x451691){logger[_0xfb2a('0x3d')](_0x17bb29[_0xfb2a('0x23')],_0xfb2a('0x3e'),JSON[_0xfb2a('0x3f')](_0x451691));});})[_0xfb2a('0x3c')](function(_0x47f437){logger['error'](_0x17bb29['uniqueid'],_0xfb2a('0x40'),JSON['stringify'](_0x47f437));});});}logger[_0xfb2a('0x25')](_0x17bb29['uniqueid'],'\x20receiveFax\x20');}};Fax[_0xfb2a('0x1d')][_0xfb2a('0x1c')]=function(_0x5843f8){if(this[_0xfb2a('0x12')][_0x5843f8[_0xfb2a('0x23')]]){_[_0xfb2a('0x41')](this['channels'][_0x5843f8[_0xfb2a('0x23')]],_[_0xfb2a('0x42')](_0x5843f8,['response','reason']));}};function updateStatus(_0x1cc576){if(_0x1cc576[_0xfb2a('0x43')]){faxMessage[_0xfb2a('0x44')](_0x1cc576['AttachmentId'],{'failMessage':_0xfb2a('0x45')})[_0xfb2a('0x46')](function(_0x1f5555){ut['logger'](_0xfb2a('0x47'),_0x1f5555);})['catch'](function(_0x4c42d4){ut[_0xfb2a('0x48')](_0xfb2a('0x49'),_0x4c42d4);});}else{ut['logger'](_0xfb2a('0x4a'));}}Fax[_0xfb2a('0x1d')][_0xfb2a('0x4b')]=function(_0x2d00e5,_0x12ebd4,_0x320741){var _0x12d2d4=this;var _0x477c0c={};if(_0x12ebd4){_0x477c0c={'read':_0x12ebd4};}else{_0x477c0c={'failMessage':_0x320741};}if(this[_0xfb2a('0x12')][_0x2d00e5][_0xfb2a('0x43')]){faxMessage[_0xfb2a('0x44')](this[_0xfb2a('0x12')][_0x2d00e5][_0xfb2a('0x43')],_0x477c0c)['then'](function(_0x18ca20){ut[_0xfb2a('0x48')](_0xfb2a('0x4c'),_0x18ca20);})[_0xfb2a('0x3c')](function(_0x297ada){ut[_0xfb2a('0x48')]('[Fax][Message][NoUpdate1]',_0x297ada);})[_0xfb2a('0x4d')](function(){delete _0x12d2d4[_0xfb2a('0xf')][_0x2d00e5];delete _0x12d2d4[_0xfb2a('0x12')][_0x2d00e5];});}else{ut[_0xfb2a('0x48')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x2d00e5];delete this['actions'][_0x2d00e5];}};Fax[_0xfb2a('0x1d')][_0xfb2a('0x4e')]=function(_0x4ff545){var _0x5a44ac=this;if(this['channels'][_0x4ff545[_0xfb2a('0x23')]]){if(this[_0xfb2a('0x12')][_0x4ff545['uniqueid']]){this[_0xfb2a('0xf')][_0x4ff545[_0xfb2a('0x23')]]['id']=this[_0xfb2a('0x12')][_0x4ff545['uniqueid']]['id'];this[_0xfb2a('0xf')][_0x4ff545['uniqueid']]['name']=this['actions'][_0x4ff545[_0xfb2a('0x23')]]['name'];}logger[_0xfb2a('0x25')](_0x4ff545[_0xfb2a('0x23')],this[_0xfb2a('0x12')][_0x4ff545['uniqueid']]?_0xfb2a('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON[_0xfb2a('0x3f')](this[_0xfb2a('0xf')][_0x4ff545[_0xfb2a('0x23')]]));if(this[_0xfb2a('0x12')][_0x4ff545[_0xfb2a('0x23')]]){if(this[_0xfb2a('0xf')][_0x4ff545[_0xfb2a('0x23')]]['faxpages']>0x0&&this[_0xfb2a('0xf')][_0x4ff545[_0xfb2a('0x23')]][_0xfb2a('0x1a')]==='SUCCESS'){this['updateStatus'](_0x4ff545[_0xfb2a('0x23')],!![]);}else{this[_0xfb2a('0x4b')](_0x4ff545[_0xfb2a('0x23')],![],this['channels'][_0x4ff545[_0xfb2a('0x23')]][_0xfb2a('0x50')]?_0xfb2a('0x51')+this[_0xfb2a('0xf')][_0x4ff545[_0xfb2a('0x23')]][_0xfb2a('0x50')]:_0xfb2a('0x52'));}}}};Fax[_0xfb2a('0x1d')]['send']=function(_0x59fb07){var _0xcd7ae=this;return new BPromise(function(_0x4cfd76,_0x492db4){_0xcd7ae[_0xfb2a('0x53')](_0x59fb07,_0xcd7ae['faxAccounts'][_0x59fb07[_0xfb2a('0x54')]])[_0xfb2a('0x46')](function(_0x385024){ut[_0xfb2a('0x48')](_0xfb2a('0x55'),_0x385024);_0x4cfd76(ut['message']('Fax\x20received'));})[_0xfb2a('0x3c')](function(_0x595e72){ut[_0xfb2a('0x48')](_0xfb2a('0x56'),_0x595e72);updateStatus(_0x59fb07);_0x492db4(ut[_0xfb2a('0x57')](_0xfb2a('0x58')));});});};Fax['prototype']['checkAfterSend']=function(_0x5326ff){var _0x3ce42e=this;return new BPromise(function(_0x253f88,_0x24f10b){var _0x48ea27=_0x3ce42e[_0xfb2a('0x59')](_0x3ce42e[_0xfb2a('0x10')][_0x5326ff[_0xfb2a('0x54')]][_0xfb2a('0x5a')],_0x5326ff);if(_0x48ea27['isValid']){_0x253f88(ut[_0xfb2a('0x57')](_0xfb2a('0x5b')));}else{_0x24f10b(ut[_0xfb2a('0x57')](_0x48ea27[_0xfb2a('0x57')]));}});};function originate(_0x1c90e6,_0x46f5e1,_0x484853){return new BPromise(function(_0x1fdbdb,_0x40a2ed){if(_0x484853){var _0x3dfa18=util[_0xfb2a('0x5c')](_0xfb2a('0x5d'),path[_0xfb2a('0x38')](_0x1c90e6[_0xfb2a('0x4')])[_0xfb2a('0x24')],_0x1c90e6[_0xfb2a('0x4')]);gs[_0xfb2a('0x5e')](_0x3dfa18)[_0xfb2a('0x46')](function(){_0x1c90e6[_0xfb2a('0x4')]=util['format'](_0xfb2a('0x5f'),path[_0xfb2a('0x38')](_0x1c90e6[_0xfb2a('0x4')])[_0xfb2a('0x60')],path[_0xfb2a('0x38')](_0x1c90e6[_0xfb2a('0x4')])[_0xfb2a('0x24')]);_0x46f5e1['XMF-PATH']=_0x1c90e6[_0xfb2a('0x4')];ut[_0xfb2a('0x48')](_0xfb2a('0x61'),'');ami['Action'](ut[_0xfb2a('0x62')](_0x1c90e6,_0x46f5e1))[_0xfb2a('0x46')](function(_0xb1d9b3){_0x1fdbdb(_0xb1d9b3);})[_0xfb2a('0x3c')](function(_0x90d234){_0x40a2ed(_0x90d234);});})[_0xfb2a('0x3c')](function(_0x269928){_0x40a2ed(_0x269928);});}else{ami[_0xfb2a('0x63')](ut['variablesAction'](_0x1c90e6,_0x46f5e1))[_0xfb2a('0x46')](function(_0x3ea888){_0x1fdbdb(_0x3ea888);})['catch'](function(_0x5d384d){_0x40a2ed(_0x5d384d);});}});}Fax['prototype']['execOriginate']=function(_0x405bdf,_0x55f45f){var _0x4107c0=this;return new BPromise(function(_0x1e0b18,_0x238b05){var _0x59b2eb=uuid['v4']();var _0x41b671=ut['addVariables'](_0x405bdf,_0x55f45f);_0x4107c0[_0xfb2a('0x12')][_0x59b2eb]=new Action(_0x59b2eb,_0x55f45f,_0x405bdf);var _0x516e31=_0x4107c0['actions'][_0x59b2eb];if(path[_0xfb2a('0x38')](_0x405bdf[_0xfb2a('0x4')])[_0xfb2a('0x64')]===_0xfb2a('0x39')){originate(_0x516e31,_0x41b671,!![])[_0xfb2a('0x46')](function(_0x36a330){_0x1e0b18(_0x36a330);})[_0xfb2a('0x3c')](function(_0x1d7952){_0x238b05(_0x1d7952);});}else{originate(_0x516e31,_0x41b671,![])[_0xfb2a('0x46')](function(_0x24444b){_0x1e0b18(_0x24444b);})[_0xfb2a('0x3c')](function(_0x359630){_0x238b05(_0x359630);});}});};Fax[_0xfb2a('0x1d')]['isTrunkReachable']=function(_0x161d73){return!_[_0xfb2a('0x65')](_0x161d73)&&!_[_0xfb2a('0x65')](_0x161d73[_0xfb2a('0x24')])&&!_[_0xfb2a('0x65')](_0x161d73[_0xfb2a('0x66')])&&_0x161d73[_0xfb2a('0x66')]&&!_['isNil'](this[_0xfb2a('0x11')][util[_0xfb2a('0x5c')](_0xfb2a('0x67'),_0x161d73[_0xfb2a('0x24')])])&&!_[_0xfb2a('0x65')](this[_0xfb2a('0x11')][util[_0xfb2a('0x5c')](_0xfb2a('0x67'),_0x161d73[_0xfb2a('0x24')])][_0xfb2a('0x2d')])&&(this[_0xfb2a('0x11')][util[_0xfb2a('0x5c')](_0xfb2a('0x67'),_0x161d73['name'])][_0xfb2a('0x2d')]===_0xfb2a('0x68')||this[_0xfb2a('0x11')][util[_0xfb2a('0x5c')]('SIP/%s',_0x161d73[_0xfb2a('0x24')])][_0xfb2a('0x2d')]===_0xfb2a('0x69'));};Fax[_0xfb2a('0x1d')][_0xfb2a('0x59')]=function(_0x3b8e83,_0x2c31a8){if(!this[_0xfb2a('0x6a')](_0x3b8e83)){ut['logger'](_0xfb2a('0x6b'),_[_0xfb2a('0x65')](_0x3b8e83)?'':_0x3b8e83['name']+_0xfb2a('0x6c'));return{'isValid':![],'message':_0xfb2a('0x6d')};}if(_[_0xfb2a('0x65')](_0x2c31a8['fax'])){ut[_0xfb2a('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xfb2a('0x3f')](_0x2c31a8));return{'isValid':![],'message':_0xfb2a('0x6e')};}if(_[_0xfb2a('0x65')](_0x2c31a8['path'])){ut['logger'](_0xfb2a('0x6f'),JSON[_0xfb2a('0x3f')](_0x2c31a8));return{'isValid':![],'message':_0xfb2a('0x70')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xfb2a('0x71')]=Fax; \ No newline at end of file +var _0xa775=['SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','channels','faxAccounts','trunks','actions','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','channelstate','channelstatedesc','operation','status','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','message','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','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active'];(function(_0xdf5fd,_0xd74c34){var _0x25dc2e=function(_0x4311b6){while(--_0x4311b6){_0xdf5fd['push'](_0xdf5fd['shift']());}};_0x25dc2e(++_0xd74c34);}(_0xa775,0xf6));var _0x5a77=function(_0x73dfd9,_0x565a0f){_0x73dfd9=_0x73dfd9-0x0;var _0x55082c=_0xa775[_0x73dfd9];return _0x55082c;};'use strict';var util=require(_0x5a77('0x0'));var _=require('lodash');var BPromise=require(_0x5a77('0x1'));var uuid=require('uuid');var moment=require('moment');var path=require(_0x5a77('0x2'));var tiff2pdf=require(_0x5a77('0x3'));var gs=require(_0x5a77('0x4'));var logger=require(_0x5a77('0x5'))('fax');var ami=require(_0x5a77('0x6'));var rpcDb=require(_0x5a77('0x7'));var Channel=require(_0x5a77('0x8'));var ut=require(_0x5a77('0x9'));var Action=require(_0x5a77('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x5ab155){this[_0x5a77('0xb')]={};this[_0x5a77('0xc')]=_0x5ab155[_0x5a77('0xc')];this[_0x5a77('0xd')]=_0x5ab155[_0x5a77('0xd')];this[_0x5a77('0xe')]={};ami['on']('newchannel',this[_0x5a77('0xf')][_0x5a77('0x10')](this));ami['on']('varset',this[_0x5a77('0x11')]['bind'](this));ami['on'](_0x5a77('0x12'),this[_0x5a77('0x13')][_0x5a77('0x10')](this));ami['on'](_0x5a77('0x14'),this[_0x5a77('0x15')][_0x5a77('0x10')](this));ami['on']('faxstatus',this[_0x5a77('0x16')][_0x5a77('0x10')](this));ami['on'](_0x5a77('0x17'),this[_0x5a77('0x18')]['bind'](this));ami['on'](_0x5a77('0x19'),this[_0x5a77('0x1a')]['bind'](this));ami['on'](_0x5a77('0x1b'),this[_0x5a77('0x1c')][_0x5a77('0x10')](this));}Fax['prototype'][_0x5a77('0xf')]=function(_0x59f8d3){if(_0x59f8d3[_0x5a77('0x1d')]===_0x5a77('0x1e')){for(var _0x5628e2 in this[_0x5a77('0xc')]){if(this['faxAccounts'][_0x5a77('0x1f')](_0x5628e2)){if(_0x59f8d3[_0x5a77('0x20')]===this[_0x5a77('0xc')][_0x5628e2][_0x5a77('0x21')]){this[_0x5a77('0xb')][_0x59f8d3['uniqueid']]={};this['channels'][_0x59f8d3[_0x5a77('0x22')]][_0x5a77('0x23')]=_0x59f8d3[_0x5a77('0x23')];this['channels'][_0x59f8d3['uniqueid']]['id']=this[_0x5a77('0xc')][_0x5628e2]['id'];this[_0x5a77('0xb')][_0x59f8d3[_0x5a77('0x22')]][_0x5a77('0x24')]=this[_0x5a77('0xc')][_0x5628e2]['name'];logger[_0x5a77('0x25')](_0x59f8d3[_0x5a77('0x22')],'\x20syncNewchannel\x20');}}}}if(this[_0x5a77('0xe')][_0x59f8d3[_0x5a77('0x22')]]){this['channels'][_0x59f8d3[_0x5a77('0x22')]]={};this[_0x5a77('0xb')][_0x59f8d3[_0x5a77('0x22')]]['channel']=_0x59f8d3[_0x5a77('0x23')];logger[_0x5a77('0x25')](_0x59f8d3[_0x5a77('0x22')],_0x5a77('0x26'));}};Fax[_0x5a77('0x27')][_0x5a77('0x11')]=function(_0x1280b9){if(this[_0x5a77('0xb')][_0x1280b9[_0x5a77('0x22')]]){for(var _0x17e9c2 in _0x1280b9[_0x5a77('0x28')]){if(_0x1280b9['variable'][_0x5a77('0x1f')](_0x17e9c2)){this[_0x5a77('0xb')][_0x1280b9[_0x5a77('0x22')]][_0x17e9c2]=_0x1280b9['value'];}}}};Fax['prototype']['syncNewState']=function(_0x4cbf4e){if(this[_0x5a77('0xb')][_0x4cbf4e[_0x5a77('0x22')]]){this['channels'][_0x4cbf4e[_0x5a77('0x22')]]['channelstate']=_0x4cbf4e[_0x5a77('0x29')];this[_0x5a77('0xb')][_0x4cbf4e['uniqueid']]['channelstatedesc']=_0x4cbf4e[_0x5a77('0x2a')];}};Fax[_0x5a77('0x27')][_0x5a77('0x15')]=function(_0x3abaf5){if(this[_0x5a77('0xb')][_0x3abaf5[_0x5a77('0x22')]]){for(var _0x27c5ad in _0x3abaf5[_0x5a77('0x28')]){if(_0x3abaf5['variable'][_0x5a77('0x1f')](_0x27c5ad)){this[_0x5a77('0xb')][_0x3abaf5[_0x5a77('0x22')]][_0x27c5ad]=_0x3abaf5['value'];}}}};Fax[_0x5a77('0x27')][_0x5a77('0x16')]=function(_0x55b01f){if(this[_0x5a77('0xb')][_0x55b01f[_0x5a77('0x22')]]){this[_0x5a77('0xb')][_0x55b01f['uniqueid']][_0x5a77('0x2b')]=_0x55b01f['operation'];this[_0x5a77('0xb')][_0x55b01f['uniqueid']][_0x5a77('0x2c')]=_0x55b01f[_0x5a77('0x2c')];this[_0x5a77('0xb')][_0x55b01f[_0x5a77('0x22')]]['localstationid']=_0x55b01f[_0x5a77('0x21')];this[_0x5a77('0xb')][_0x55b01f['uniqueid']]['filename']=_0x55b01f['filename'];logger['info'](_0x55b01f[_0x5a77('0x22')],_0x5a77('0x2d'));}};Fax['prototype'][_0x5a77('0x18')]=function(_0x2dd422){var _0x3fcf2b=this;if(this[_0x5a77('0xb')][_0x2dd422[_0x5a77('0x22')]]){var _0x17c5d1=this[_0x5a77('0xb')][_0x2dd422[_0x5a77('0x22')]]['id'];this[_0x5a77('0xb')][_0x2dd422[_0x5a77('0x22')]][_0x5a77('0x2e')]=_0x2dd422[_0x5a77('0x2e')];this[_0x5a77('0xb')][_0x2dd422[_0x5a77('0x22')]][_0x5a77('0x2f')]=_0x2dd422[_0x5a77('0x2f')];this[_0x5a77('0xb')][_0x2dd422[_0x5a77('0x22')]][_0x5a77('0x21')]=_0x2dd422[_0x5a77('0x21')];this['channels'][_0x2dd422[_0x5a77('0x22')]][_0x5a77('0x30')]=_0x2dd422[_0x5a77('0x30')];this[_0x5a77('0xb')][_0x2dd422[_0x5a77('0x22')]][_0x5a77('0x31')]=_0x2dd422[_0x5a77('0x31')];this[_0x5a77('0xb')][_0x2dd422[_0x5a77('0x22')]][_0x5a77('0x32')]=_0x2dd422['filename'];this[_0x5a77('0xb')][_0x2dd422['uniqueid']][_0x5a77('0x33')]=_0x2dd422[_0x5a77('0x33')];if(this[_0x5a77('0xb')][_0x2dd422[_0x5a77('0x22')]][_0x5a77('0x2f')]>0x0){tiff2pdf(_0x2dd422[_0x5a77('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x545ee3){logger[_0x5a77('0x25')](_0x2dd422[_0x5a77('0x22')],'\x20result\x20conversion\x20file\x20',_0x545ee3['message']);attachment[_0x5a77('0x34')]({'name':path[_0x5a77('0x35')](_0x2dd422[_0x5a77('0x32')])[_0x5a77('0x24')],'basename':path[_0x5a77('0x35')](_0x2dd422['filename'])[_0x5a77('0x24')]+_0x5a77('0x36'),'type':_0x5a77('0x37')})[_0x5a77('0x38')](function(_0x5be5e6){faxAccount[_0x5a77('0x39')](_0x17c5d1,{'from':_0x2dd422[_0x5a77('0x33')],'mapKey':_0x5a77('0x3a'),'body':path['parse'](_0x2dd422['filename'])[_0x5a77('0x24')]+'.pdf','AttachmentId':_0x5be5e6['id']})[_0x5a77('0x3b')](function(_0x177ce0){logger[_0x5a77('0x3c')](_0x2dd422[_0x5a77('0x22')],_0x5a77('0x3d'),JSON[_0x5a77('0x3e')](_0x177ce0));});})[_0x5a77('0x3b')](function(_0x18157c){logger[_0x5a77('0x3c')](_0x2dd422[_0x5a77('0x22')],_0x5a77('0x3f'),JSON['stringify'](_0x18157c));});});}logger[_0x5a77('0x25')](_0x2dd422[_0x5a77('0x22')],_0x5a77('0x3f'));}};Fax['prototype'][_0x5a77('0x1c')]=function(_0x3db645){if(this[_0x5a77('0xe')][_0x3db645['uniqueid']]){_[_0x5a77('0x40')](this['channels'][_0x3db645[_0x5a77('0x22')]],_[_0x5a77('0x41')](_0x3db645,[_0x5a77('0x42'),_0x5a77('0x43')]));}};function updateStatus(_0x3d90a3){if(_0x3d90a3[_0x5a77('0x44')]){faxMessage['update'](_0x3d90a3[_0x5a77('0x44')],{'failMessage':_0x5a77('0x45')})[_0x5a77('0x38')](function(_0x22457f){ut[_0x5a77('0x46')](_0x5a77('0x47'),_0x22457f);})[_0x5a77('0x3b')](function(_0x33b9e2){ut[_0x5a77('0x46')]('[Fax][Message][Error][NoUpdate1]',_0x33b9e2);});}else{ut[_0x5a77('0x46')](_0x5a77('0x48'));}}Fax[_0x5a77('0x27')][_0x5a77('0x49')]=function(_0x49d2af,_0x33cbb7,_0x5d7a81){var _0x7c75f=this;var _0x54b54a={};if(_0x33cbb7){_0x54b54a={'read':_0x33cbb7};}else{_0x54b54a={'failMessage':_0x5d7a81};}if(this[_0x5a77('0xe')][_0x49d2af][_0x5a77('0x44')]){faxMessage[_0x5a77('0x4a')](this['actions'][_0x49d2af][_0x5a77('0x44')],_0x54b54a)['then'](function(_0x5a85f1){ut[_0x5a77('0x46')](_0x5a77('0x4b'),_0x5a85f1);})['catch'](function(_0x5f0cbc){ut[_0x5a77('0x46')]('[Fax][Message][NoUpdate1]',_0x5f0cbc);})[_0x5a77('0x4c')](function(){delete _0x7c75f['channels'][_0x49d2af];delete _0x7c75f[_0x5a77('0xe')][_0x49d2af];});}else{ut[_0x5a77('0x46')](_0x5a77('0x4d'));delete this[_0x5a77('0xb')][_0x49d2af];delete this[_0x5a77('0xe')][_0x49d2af];}};Fax[_0x5a77('0x27')][_0x5a77('0x1a')]=function(_0x3bd39e){var _0x30c80b=this;if(this['channels'][_0x3bd39e['uniqueid']]){if(this['actions'][_0x3bd39e['uniqueid']]){this[_0x5a77('0xb')][_0x3bd39e[_0x5a77('0x22')]]['id']=this['actions'][_0x3bd39e[_0x5a77('0x22')]]['id'];this[_0x5a77('0xb')][_0x3bd39e[_0x5a77('0x22')]][_0x5a77('0x24')]=this[_0x5a77('0xe')][_0x3bd39e[_0x5a77('0x22')]][_0x5a77('0x24')];}logger[_0x5a77('0x25')](_0x3bd39e[_0x5a77('0x22')],this[_0x5a77('0xe')][_0x3bd39e[_0x5a77('0x22')]]?_0x5a77('0x4e'):_0x5a77('0x4f'),JSON[_0x5a77('0x3e')](this[_0x5a77('0xb')][_0x3bd39e['uniqueid']]));if(this[_0x5a77('0xe')][_0x3bd39e[_0x5a77('0x22')]]){if(this[_0x5a77('0xb')][_0x3bd39e[_0x5a77('0x22')]]['faxpages']>0x0&&this['channels'][_0x3bd39e[_0x5a77('0x22')]][_0x5a77('0x50')]===_0x5a77('0x51')){this['updateStatus'](_0x3bd39e[_0x5a77('0x22')],!![]);}else{this['updateStatus'](_0x3bd39e[_0x5a77('0x22')],![],this[_0x5a77('0xb')][_0x3bd39e['uniqueid']][_0x5a77('0x52')]?_0x5a77('0x53')+this['channels'][_0x3bd39e[_0x5a77('0x22')]][_0x5a77('0x52')]:_0x5a77('0x54'));}}}};Fax[_0x5a77('0x27')][_0x5a77('0x55')]=function(_0x1575e1){var _0x23a738=this;return new BPromise(function(_0x27eb59,_0x15b8a7){_0x23a738[_0x5a77('0x56')](_0x1575e1,_0x23a738[_0x5a77('0xc')][_0x1575e1[_0x5a77('0x57')]])[_0x5a77('0x38')](function(_0x11844c){ut[_0x5a77('0x46')]('[Fax][execOriginate][success]',_0x11844c);_0x27eb59(ut['message']('Fax\x20received'));})[_0x5a77('0x3b')](function(_0xfeafcb){ut[_0x5a77('0x46')](_0x5a77('0x58'),_0xfeafcb);updateStatus(_0x1575e1);_0x15b8a7(ut['message'](_0x5a77('0x59')));});});};Fax[_0x5a77('0x27')][_0x5a77('0x5a')]=function(_0x1b9460){var _0x255287=this;return new BPromise(function(_0x3aa626,_0x3d21ce){var _0x4b2e7b=_0x255287[_0x5a77('0x5b')](_0x255287[_0x5a77('0xc')][_0x1b9460[_0x5a77('0x57')]][_0x5a77('0x5c')],_0x1b9460);if(_0x4b2e7b[_0x5a77('0x5d')]){_0x3aa626(ut[_0x5a77('0x5e')](_0x5a77('0x5f')));}else{_0x3d21ce(ut['message'](_0x4b2e7b[_0x5a77('0x5e')]));}});};function originate(_0x45c4e3,_0x2b0d6b,_0x567c02){return new BPromise(function(_0x1d9da4,_0x5c8462){if(_0x567c02){var _0x2f9edc=util[_0x5a77('0x60')](_0x5a77('0x61'),path['parse'](_0x45c4e3[_0x5a77('0x2')])[_0x5a77('0x24')],_0x45c4e3['path']);gs[_0x5a77('0x62')](_0x2f9edc)[_0x5a77('0x38')](function(){_0x45c4e3[_0x5a77('0x2')]=util[_0x5a77('0x60')]('%s/%s.tif',path['parse'](_0x45c4e3['path'])[_0x5a77('0x63')],path['parse'](_0x45c4e3[_0x5a77('0x2')])[_0x5a77('0x24')]);_0x2b0d6b['XMF-PATH']=_0x45c4e3[_0x5a77('0x2')];ut[_0x5a77('0x46')](_0x5a77('0x64'),'');ami[_0x5a77('0x65')](ut[_0x5a77('0x66')](_0x45c4e3,_0x2b0d6b))['then'](function(_0xaa113f){_0x1d9da4(_0xaa113f);})['catch'](function(_0xeac873){_0x5c8462(_0xeac873);});})['catch'](function(_0x1a6a72){_0x5c8462(_0x1a6a72);});}else{ami[_0x5a77('0x65')](ut[_0x5a77('0x66')](_0x45c4e3,_0x2b0d6b))[_0x5a77('0x38')](function(_0x21e1e8){_0x1d9da4(_0x21e1e8);})['catch'](function(_0x440029){_0x5c8462(_0x440029);});}});}Fax[_0x5a77('0x27')]['execOriginate']=function(_0x5ad619,_0x45ce2c){var _0x3c0414=this;return new BPromise(function(_0x5e5562,_0x5d77b2){var _0x437ff3=uuid['v4']();var _0x27d6f0=ut[_0x5a77('0x67')](_0x5ad619,_0x45ce2c);_0x3c0414[_0x5a77('0xe')][_0x437ff3]=new Action(_0x437ff3,_0x45ce2c,_0x5ad619);var _0x240c5c=_0x3c0414[_0x5a77('0xe')][_0x437ff3];if(path[_0x5a77('0x35')](_0x5ad619[_0x5a77('0x2')])[_0x5a77('0x68')]===_0x5a77('0x36')){originate(_0x240c5c,_0x27d6f0,!![])[_0x5a77('0x38')](function(_0x2624b3){_0x5e5562(_0x2624b3);})[_0x5a77('0x3b')](function(_0x1fca52){_0x5d77b2(_0x1fca52);});}else{originate(_0x240c5c,_0x27d6f0,![])[_0x5a77('0x38')](function(_0x1bb200){_0x5e5562(_0x1bb200);})[_0x5a77('0x3b')](function(_0x8d662){_0x5d77b2(_0x8d662);});}});};Fax[_0x5a77('0x27')][_0x5a77('0x69')]=function(_0x296991){return!_[_0x5a77('0x6a')](_0x296991)&&!_[_0x5a77('0x6a')](_0x296991[_0x5a77('0x24')])&&!_[_0x5a77('0x6a')](_0x296991[_0x5a77('0x6b')])&&_0x296991['active']&&!_[_0x5a77('0x6a')](this[_0x5a77('0xd')][util[_0x5a77('0x60')](_0x5a77('0x6c'),_0x296991[_0x5a77('0x24')])])&&!_[_0x5a77('0x6a')](this[_0x5a77('0xd')][util[_0x5a77('0x60')]('SIP/%s',_0x296991[_0x5a77('0x24')])][_0x5a77('0x2c')])&&(this[_0x5a77('0xd')][util[_0x5a77('0x60')]('SIP/%s',_0x296991[_0x5a77('0x24')])][_0x5a77('0x2c')]===_0x5a77('0x6d')||this[_0x5a77('0xd')][util[_0x5a77('0x60')](_0x5a77('0x6c'),_0x296991[_0x5a77('0x24')])][_0x5a77('0x2c')]===_0x5a77('0x6e'));};Fax[_0x5a77('0x27')][_0x5a77('0x5b')]=function(_0x470fd2,_0x224e76){if(!this['isTrunkReachable'](_0x470fd2)){ut[_0x5a77('0x46')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x470fd2)?'':_0x470fd2[_0x5a77('0x24')]+_0x5a77('0x6f'));return{'isValid':![],'message':_0x5a77('0x70')};}if(_[_0x5a77('0x6a')](_0x224e76[_0x5a77('0x3a')])){ut[_0x5a77('0x46')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x5a77('0x3e')](_0x224e76));return{'isValid':![],'message':_0x5a77('0x71')};}if(_['isNil'](_0x224e76[_0x5a77('0x2')])){ut[_0x5a77('0x46')](_0x5a77('0x72'),JSON[_0x5a77('0x3e')](_0x224e76));return{'isValid':![],'message':_0x5a77('0x73')};}return{'isValid':!![],'message':_0x5a77('0x74')};};module[_0x5a77('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d24df31..9625bc2 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 _0xc8ef=['notify','resolve','then','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x25b47c,_0x255f3e){var _0x471f48=function(_0x3299ad){while(--_0x3299ad){_0x25b47c['push'](_0x25b47c['shift']());}};_0x471f48(++_0x255f3e);}(_0xc8ef,0xf6));var _0xfc8e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xc8ef[_0x2b4411];return _0x8e41ef;};'use strict';var util=require(_0xfc8e('0x0'));var BPromise=require(_0xfc8e('0x1'));var logger=require(_0xfc8e('0x2'))(_0xfc8e('0x3'));var _=require(_0xfc8e('0x4'));var faxAccount=require(_0xfc8e('0x5'));function loggerCatch(_0x123f69){return function(_0x374dbb){logger[_0xfc8e('0x6')](_0x123f69,util['inspect'](_0x374dbb,{'showHidden':![],'depth':null}));};}exports[_0xfc8e('0x7')]=function(_0x193fcb,_0x45dfff){return BPromise[_0xfc8e('0x8')]()[_0xfc8e('0x9')](faxAccount[_0xfc8e('0x7')](_0x193fcb,_0x45dfff))['catch'](loggerCatch(_0xfc8e('0xa')));}; \ No newline at end of file +var _0x9a31=['preview','lodash','../rpc/faxAccount','error','inspect','notify','then','catch','util','bluebird','../../../config/logger'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x9a31,0x11b));var _0x19a3=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9a31[_0x618414];return _0x21c19a;};'use strict';var util=require(_0x19a3('0x0'));var BPromise=require(_0x19a3('0x1'));var logger=require(_0x19a3('0x2'))(_0x19a3('0x3'));var _=require(_0x19a3('0x4'));var faxAccount=require(_0x19a3('0x5'));function loggerCatch(_0x48b195){return function(_0x201b8a){logger[_0x19a3('0x6')](_0x48b195,util[_0x19a3('0x7')](_0x201b8a,{'showHidden':![],'depth':null}));};}exports[_0x19a3('0x8')]=function(_0x3755cc,_0x5ed71f){return BPromise['resolve']()[_0x19a3('0x9')](faxAccount['notify'](_0x3755cc,_0x5ed71f))[_0x19a3('0xa')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index ced2606..792daea 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 _0xd267=['Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird','child_process','execute','info'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xd267,0xe4));var _0x7d26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd267[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x7d26('0x0'));var logger=require('../../../../config/logger')(_0x7d26('0x1'));var BPromise=require(_0x7d26('0x2'));var exec=require(_0x7d26('0x3'))['exec'];exports[_0x7d26('0x4')]=function(_0x2bd9da){return new BPromise(function(_0x3064b7,_0x19b117){exec(_0x2bd9da,function(_0x16998e,_0x1c6c8d,_0x74326a){logger[_0x7d26('0x5')](_0x7d26('0x6'),_0x1c6c8d);if(_0x16998e){logger[_0x7d26('0x5')](_0x7d26('0x6'),_0x7d26('0x7'),util[_0x7d26('0x8')](_0x16998e,{'showHidden':![],'depth':null}),_0x1c6c8d,_0x74326a);_0x19b117(_0x16998e);}_0x3064b7(_0x1c6c8d);});});}; \ No newline at end of file +var _0x00a0=['util','../../../../config/logger','fax','bluebird','exec','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x00a0,0x117));var _0x000a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x00a0[_0x2be8c2];return _0x97f531;};'use strict';var util=require(_0x000a('0x0'));var logger=require(_0x000a('0x1'))(_0x000a('0x2'));var BPromise=require(_0x000a('0x3'));var exec=require('child_process')[_0x000a('0x4')];exports['execute']=function(_0x448062){return new BPromise(function(_0x52fed8,_0x3becfc){exec(_0x448062,function(_0x4ad8de,_0x4dfcb4,_0x31dce4){logger[_0x000a('0x5')](_0x000a('0x6'),_0x4dfcb4);if(_0x4ad8de){logger[_0x000a('0x5')](_0x000a('0x6'),_0x000a('0x7'),util[_0x000a('0x8')](_0x4ad8de,{'showHidden':![],'depth':null}),_0x4dfcb4,_0x31dce4);_0x3becfc(_0x4ad8de);}_0x52fed8(_0x4dfcb4);});});}; \ 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 2141db8..8aab394 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 _0x4522=['info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','faxdetect','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','localstationid','moment','../../../../config/logger','fax','logger'];(function(_0x18084b,_0x29e451){var _0x3ddd01=function(_0x522490){while(--_0x522490){_0x18084b['push'](_0x18084b['shift']());}};_0x3ddd01(++_0x29e451);}(_0x4522,0x1a0));var _0x2452=function(_0x4c4d17,_0x11d919){_0x4c4d17=_0x4c4d17-0x0;var _0x1191e8=_0x4522[_0x4c4d17];return _0x1191e8;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x2452('0x0'));var logger=require(_0x2452('0x1'))(_0x2452('0x2'));exports['message']=function(_0x229028){return{'message':_0x229028};};exports[_0x2452('0x3')]=function(_0x35e30a,_0x2f21dc){logger[_0x2452('0x4')](_0x35e30a,util[_0x2452('0x5')](_0x2f21dc,{'showHidden':![],'depth':null}));};exports[_0x2452('0x6')]=function(_0x226578,_0x2f0139){var _0x149807={'XMF-ECM':_0x2f0139[_0x2452('0x7')],'XMF-HEADERINFO':_0x2f0139[_0x2452('0x8')],'XMF-MINRATE':_0x2f0139[_0x2452('0x9')],'XMF-MAXRATE':_0x2f0139[_0x2452('0xa')],'XMF-MODEM':util[_0x2452('0xb')](_0x2452('0xc'),_0x2f0139['modem']),'XMF-GATEWAY':_0x2f0139['gateway'],'XMF-FAXDETECT':_0x2f0139[_0x2452('0xd')],'XMF-T38TIMEOUT':_0x2f0139['t38timeout'],'XMF-LOCALSTATIONID':_0x2f0139['localstationid'],'XMF-PATH':_0x226578[_0x2452('0xe')]};return _0x149807;};exports[_0x2452('0xf')]=function(_0x1086ef,_0x3ad6c9){return{'actionid':_0x1086ef[_0x2452('0x10')],'action':_0x2452('0x11'),'channel':_0x1086ef[_0x2452('0x12')],'Exten':_0x2452('0x13'),'Context':'from-sip','Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x1086ef[_0x2452('0x8')]?_0x1086ef['headerinfo']:'',_0x1086ef[_0x2452('0x14')]),'variable':_0x3ad6c9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1086ef['uniqueid']};}; \ No newline at end of file +var _0xd87e=['modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','from-sip','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','fax','message','logger','info','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22'];(function(_0x1f4fcb,_0x211d32){var _0x3c0841=function(_0x5edb17){while(--_0x5edb17){_0x1f4fcb['push'](_0x1f4fcb['shift']());}};_0x3c0841(++_0x211d32);}(_0xd87e,0x1bf));var _0xed87=function(_0x527ce8,_0x122695){_0x527ce8=_0x527ce8-0x0;var _0x2a8a56=_0xd87e[_0x527ce8];return _0x2a8a56;};'use strict';var util=require(_0xed87('0x0'));var _=require(_0xed87('0x1'));var moment=require('moment');var logger=require(_0xed87('0x2'))(_0xed87('0x3'));exports[_0xed87('0x4')]=function(_0x5901be){return{'message':_0x5901be};};exports[_0xed87('0x5')]=function(_0x5e960f,_0x11a5d9){logger[_0xed87('0x6')](_0x5e960f,util['inspect'](_0x11a5d9,{'showHidden':![],'depth':null}));};exports[_0xed87('0x7')]=function(_0x589fb9,_0x5da793){var _0xa33c67={'XMF-ECM':_0x5da793[_0xed87('0x8')],'XMF-HEADERINFO':_0x5da793[_0xed87('0x9')],'XMF-MINRATE':_0x5da793[_0xed87('0xa')],'XMF-MAXRATE':_0x5da793['maxrate'],'XMF-MODEM':util[_0xed87('0xb')](_0xed87('0xc'),_0x5da793[_0xed87('0xd')]),'XMF-GATEWAY':_0x5da793[_0xed87('0xe')],'XMF-FAXDETECT':_0x5da793[_0xed87('0xf')],'XMF-T38TIMEOUT':_0x5da793[_0xed87('0x10')],'XMF-LOCALSTATIONID':_0x5da793[_0xed87('0x11')],'XMF-PATH':_0x589fb9['path']};return _0xa33c67;};exports[_0xed87('0x12')]=function(_0xf104cb,_0x5cf4fe){return{'actionid':_0xf104cb[_0xed87('0x13')],'action':_0xed87('0x14'),'channel':_0xf104cb['channel'],'Exten':'xcally-motion-fax','Context':_0xed87('0x15'),'Priority':'1','callerid':util[_0xed87('0xb')](_0xed87('0x16'),_0xf104cb[_0xed87('0x9')]?_0xf104cb[_0xed87('0x9')]:'',_0xf104cb[_0xed87('0x11')]),'variable':_0x5cf4fe,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xf104cb['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 8707d40..4bb5919 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 _0x4024=['initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','log','listen','sync','catch','bluebird','util','./server','./realtime','./acw','./dialer','./preview','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getSalesforceAccounts'];(function(_0x18b23c,_0x403314){var _0x21ca9d=function(_0x2b2184){while(--_0x2b2184){_0x18b23c['push'](_0x18b23c['shift']());}};_0x21ca9d(++_0x403314);}(_0x4024,0x89));var _0x4402=function(_0x2b0e7e,_0x24fa9e){_0x2b0e7e=_0x2b0e7e-0x0;var _0x1af012=_0x4024[_0x2b0e7e];return _0x1af012;};'use strict';var BPromise=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var server=require(_0x4402('0x2'));var Realtime=require(_0x4402('0x3'));var Report=require('./report');var Acw=require(_0x4402('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x4402('0x5'));var Preview=require(_0x4402('0x6'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x4402('0x7'));var voiceQueueReport=require(_0x4402('0x8'));var voiceCallReport=require(_0x4402('0x9'));var trunk=require('./rpc/trunk');var trigger=require(_0x4402('0xa'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x4402('0xb'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x4402('0xc'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x4402('0xd'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x4402('0xe'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x4402('0xf'));var freshsales=require(_0x4402('0x10'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x4402('0x11'));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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4402('0x12')](_0x4402('0x13'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x4402('0x13'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x4402('0x14')]()[_0x4402('0x15')](user[_0x4402('0x16')]())[_0x4402('0x15')](realtime[_0x4402('0x17')]())[_0x4402('0x15')](user[_0x4402('0x18')]())[_0x4402('0x15')](realtime[_0x4402('0x19')]())[_0x4402('0x15')](trunk[_0x4402('0x1a')]())[_0x4402('0x15')](realtime[_0x4402('0x1b')]())[_0x4402('0x15')](voiceQueue[_0x4402('0x1c')]())[_0x4402('0x15')](realtime[_0x4402('0x1d')]())[_0x4402('0x15')](trigger[_0x4402('0x1e')]())['then'](realtime['initTriggers']())[_0x4402('0x15')](template[_0x4402('0x1f')]())['then'](realtime[_0x4402('0x20')]())[_0x4402('0x15')](zendesk['getZendeskAccounts']())[_0x4402('0x15')](realtime['initZendeskAccounts']())['then'](salesforce[_0x4402('0x21')]())[_0x4402('0x15')](realtime[_0x4402('0x22')]())['then'](sugarcrm[_0x4402('0x23')]())['then'](realtime['initSugarcrmAccounts']())[_0x4402('0x15')](freshdesk[_0x4402('0x24')]())[_0x4402('0x15')](realtime[_0x4402('0x25')]())[_0x4402('0x15')](desk[_0x4402('0x26')]())[_0x4402('0x15')](realtime[_0x4402('0x27')]())[_0x4402('0x15')](zoho['getZohoAccounts']())[_0x4402('0x15')](realtime['initZohoAccounts']())[_0x4402('0x15')](vtiger[_0x4402('0x28')]())[_0x4402('0x15')](realtime[_0x4402('0x29')]())['then'](freshsales[_0x4402('0x2a')]())['then'](realtime['initFreshsalesAccounts']())[_0x4402('0x15')](servicenow[_0x4402('0x2b')]())[_0x4402('0x15')](realtime[_0x4402('0x2c')]())[_0x4402('0x15')](dynamics365['getDynamics365Accounts']())[_0x4402('0x15')](realtime['initDynamics365Accounts']())[_0x4402('0x15')](campaign[_0x4402('0x2d')]())[_0x4402('0x15')](realtime['initCampaigns']())[_0x4402('0x15')](voiceExtension[_0x4402('0x2e')]())[_0x4402('0x15')](realtime[_0x4402('0x2f')]())[_0x4402('0x15')](faxAccount[_0x4402('0x30')]())[_0x4402('0x15')](realtime[_0x4402('0x31')]())[_0x4402('0x15')](function(){return realtime;});}function initParams(){return BPromise[_0x4402('0x14')]()[_0x4402('0x15')](voiceQueueReport['getVoiceQueueReports']())[_0x4402('0x15')](realtime['initVoiceQueueReports']())[_0x4402('0x15')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x4402('0x15')](realtime[_0x4402('0x32')]())[_0x4402('0x15')](cmHopperHistory[_0x4402('0x33')]())[_0x4402('0x15')](realtime['initCampaignHopperHistory']())[_0x4402('0x15')](voiceCallReport[_0x4402('0x34')]())[_0x4402('0x15')](realtime['initVoiceCallReports']())[_0x4402('0x15')](function(_0x3383e3){})['catch'](function(_0x2db1fe){console[_0x4402('0x35')](_0x2db1fe);});}function main(){return server[_0x4402('0x36')](realtime,preview,fax)[_0x4402('0x15')](function(_0x170058){return initRealtime();})[_0x4402('0x15')](function(){return initParams();})[_0x4402('0x15')](function(){report[_0x4402('0x37')]();setInterval(initRealtime,0x1388);})[_0x4402('0x38')](function(_0x5c819a){console[_0x4402('0x35')](_0x5c819a);});}main(); \ No newline at end of file +var _0x8603=['initDeskAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen','sync','log','util','moment','./server','./acw','./trigger','./dialer','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x8603,0x190));var _0x3860=function(_0x529f36,_0x6b4496){_0x529f36=_0x529f36-0x0;var _0x64d301=_0x8603[_0x529f36];return _0x64d301;};'use strict';var BPromise=require('bluebird');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var server=require(_0x3860('0x2'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0x3860('0x3'));var Trigger=require(_0x3860('0x4'));var Dialer=require(_0x3860('0x5'));var Preview=require('./preview');var Fax=require(_0x3860('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0x3860('0x7'));var voiceQueueReport=require(_0x3860('0x8'));var voiceCallReport=require(_0x3860('0x9'));var trunk=require(_0x3860('0xa'));var trigger=require(_0x3860('0xb'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x3860('0xc'));var faxAccount=require(_0x3860('0xd'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x3860('0xe'));var sugarcrm=require(_0x3860('0xf'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x3860('0x10'));var zoho=require(_0x3860('0x11'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x3860('0x12'));var servicenow=require(_0x3860('0x13'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x3860('0x14')](_0x3860('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x3860('0x14')](_0x3860('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x3860('0x16')]()[_0x3860('0x17')](user[_0x3860('0x18')]())[_0x3860('0x17')](realtime[_0x3860('0x19')]())[_0x3860('0x17')](user['getTelephones']())[_0x3860('0x17')](realtime[_0x3860('0x1a')]())[_0x3860('0x17')](trunk[_0x3860('0x1b')]())[_0x3860('0x17')](realtime[_0x3860('0x1c')]())[_0x3860('0x17')](voiceQueue[_0x3860('0x1d')]())[_0x3860('0x17')](realtime[_0x3860('0x1e')]())[_0x3860('0x17')](trigger[_0x3860('0x1f')]())['then'](realtime['initTriggers']())[_0x3860('0x17')](template[_0x3860('0x20')]())[_0x3860('0x17')](realtime['initTemplates']())[_0x3860('0x17')](zendesk[_0x3860('0x21')]())[_0x3860('0x17')](realtime[_0x3860('0x22')]())[_0x3860('0x17')](salesforce[_0x3860('0x23')]())[_0x3860('0x17')](realtime[_0x3860('0x24')]())[_0x3860('0x17')](sugarcrm[_0x3860('0x25')]())[_0x3860('0x17')](realtime[_0x3860('0x26')]())[_0x3860('0x17')](freshdesk[_0x3860('0x27')]())[_0x3860('0x17')](realtime['initFreshdeskAccounts']())[_0x3860('0x17')](desk[_0x3860('0x28')]())[_0x3860('0x17')](realtime[_0x3860('0x29')]())[_0x3860('0x17')](zoho['getZohoAccounts']())[_0x3860('0x17')](realtime['initZohoAccounts']())['then'](vtiger[_0x3860('0x2a')]())[_0x3860('0x17')](realtime['initVtigerAccounts']())['then'](freshsales['getFreshsalesAccounts']())[_0x3860('0x17')](realtime[_0x3860('0x2b')]())[_0x3860('0x17')](servicenow[_0x3860('0x2c')]())[_0x3860('0x17')](realtime[_0x3860('0x2d')]())['then'](dynamics365['getDynamics365Accounts']())[_0x3860('0x17')](realtime[_0x3860('0x2e')]())['then'](campaign[_0x3860('0x2f')]())[_0x3860('0x17')](realtime[_0x3860('0x30')]())[_0x3860('0x17')](voiceExtension[_0x3860('0x31')]())['then'](realtime[_0x3860('0x32')]())[_0x3860('0x17')](faxAccount[_0x3860('0x33')]())['then'](realtime[_0x3860('0x34')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x3860('0x16')]()['then'](voiceQueueReport[_0x3860('0x35')]())[_0x3860('0x17')](realtime[_0x3860('0x36')]())['then'](cmHopperHistory[_0x3860('0x37')]())[_0x3860('0x17')](realtime['initVoiceQueueHopperHistory']())[_0x3860('0x17')](cmHopperHistory['getCampaignHopperHistory']())[_0x3860('0x17')](realtime[_0x3860('0x38')]())[_0x3860('0x17')](voiceCallReport[_0x3860('0x39')]())[_0x3860('0x17')](realtime[_0x3860('0x3a')]())[_0x3860('0x17')](function(_0x4d30bc){})[_0x3860('0x3b')](function(_0x396ccf){console['log'](_0x396ccf);});}function main(){return server[_0x3860('0x3c')](realtime,preview,fax)[_0x3860('0x17')](function(_0x3a17ea){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x3860('0x3d')]();setInterval(initRealtime,0x1388);})[_0x3860('0x3b')](function(_0x3abf18){console[_0x3860('0x3e')](_0x3abf18);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 5d68888..4ba7fc0 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 _0xb353=['defaults','redis','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','not_inuse','idle','inuse','talking','statePause','toNumber','format','stringify','md5','user:%s','emit','user:save','user:presence','exports','util'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0xb353,0xc2));var _0x3b35=function(_0x226e3d,_0x58fe82){_0x226e3d=_0x226e3d-0x0;var _0xfd2156=_0xb353[_0x226e3d];return _0xfd2156;};'use strict';var _=require('lodash');var util=require(_0x3b35('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x3b35('0x1')](config[_0x3b35('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x3b35('0x3'))(new Redis(config[_0x3b35('0x2')]));function Agent(_0x459e53){this['id']=_0x459e53['id']||0x0;this[_0x3b35('0x4')]=_0x459e53[_0x3b35('0x4')]||'';this[_0x3b35('0x5')]=_0x459e53[_0x3b35('0x5')]||'';this[_0x3b35('0x6')]=_0x459e53['accountcode']||'';this['fullname']=_0x459e53[_0x3b35('0x7')]||'';this['state']=_0x3b35('0x8');this[_0x3b35('0x9')]=0x0;this[_0x3b35('0xa')]='unknown';this[_0x3b35('0xb')]='';this[_0x3b35('0xc')]='';this[_0x3b35('0xd')]='';this[_0x3b35('0xe')]='';this[_0x3b35('0xf')]=_0x459e53[_0x3b35('0xf')]||![];this[_0x3b35('0x10')]='unknown';this[_0x3b35('0x11')]=0x0;this[_0x3b35('0x12')]='';this[_0x3b35('0x13')]='';this[_0x3b35('0x14')]=![];this[_0x3b35('0x15')]=![];this['md5']='';}Agent[_0x3b35('0x16')][_0x3b35('0x17')]=function(_0x12637d){var _0x4c4029;if(_0x12637d&&_0x12637d['state']){_0x4c4029=_0x12637d[_0x3b35('0x18')]['toLowerCase']();switch(_0x4c4029){case _0x3b35('0x19'):_0x4c4029=_0x3b35('0x1a');break;case _0x3b35('0x1b'):_0x4c4029=_0x3b35('0x1c');break;}}if(_0x4c4029&&this[_0x3b35('0x10')]!==_0x4c4029||_0x12637d[_0x3b35('0x1d')]){this['voiceStatusTime']=_[_0x3b35('0x1e')](moment()[_0x3b35('0x1f')]('x'));}if(_0x4c4029){this[_0x3b35('0x10')]=_0x4c4029;}var _0x5ded7b={'id':this['id'],'name':this['name'],'email':this[_0x3b35('0x5')],'accountcode':this['accountcode'],'fullname':this[_0x3b35('0x7')],'state':this[_0x3b35('0x18')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x3b35('0xb')],'online':this[_0x3b35('0xf')],'voiceStatus':this[_0x3b35('0x10')],'voiceStatusTime':this[_0x3b35('0x11')],'voiceStatusCallerIdNumber':this[_0x3b35('0x12')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x3b35('0xe')],'onhold':this[_0x3b35('0x14')]};var _0x234d7f=md5(JSON[_0x3b35('0x20')](_0x5ded7b));if(this[_0x3b35('0x21')]!==_0x234d7f){this['md5']=_0x234d7f;io['to'](util[_0x3b35('0x1f')](_0x3b35('0x22'),_0x5ded7b[_0x3b35('0x4')]))[_0x3b35('0x23')](_0x3b35('0x24'),_0x5ded7b);io['emit'](_0x3b35('0x25'),_0x5ded7b);}};module[_0x3b35('0x26')]=Agent; \ No newline at end of file +var _0xc58f=['onhold','local','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','toNumber','format','fullname','voiceStatusTime','stringify','user:save','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','unknown','stateTime','status','address','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue'];(function(_0x114c19,_0x4d88e1){var _0x58169f=function(_0x2be8bd){while(--_0x2be8bd){_0x114c19['push'](_0x114c19['shift']());}};_0x58169f(++_0x4d88e1);}(_0xc58f,0x183));var _0xfc58=function(_0x528404,_0x27a5ba){_0x528404=_0x528404-0x0;var _0xe59e6b=_0xc58f[_0x528404];return _0xe59e6b;};'use strict';var _=require(_0xfc58('0x0'));var util=require('util');var moment=require(_0xfc58('0x1'));var md5=require(_0xfc58('0x2'));var Redis=require(_0xfc58('0x3'));var config=require(_0xfc58('0x4'));config[_0xfc58('0x5')]=_['defaults'](config[_0xfc58('0x5')],{'host':_0xfc58('0x6'),'port':0x18eb});var io=require(_0xfc58('0x7'))(new Redis(config['redis']));function Agent(_0x5612ce){this['id']=_0x5612ce['id']||0x0;this[_0xfc58('0x8')]=_0x5612ce[_0xfc58('0x8')]||'';this[_0xfc58('0x9')]=_0x5612ce[_0xfc58('0x9')]||'';this[_0xfc58('0xa')]=_0x5612ce[_0xfc58('0xa')]||'';this['fullname']=_0x5612ce['fullname']||'';this['state']=_0xfc58('0xb');this[_0xfc58('0xc')]=0x0;this[_0xfc58('0xd')]=_0xfc58('0xb');this[_0xfc58('0xe')]='';this['phone']='';this['mobile']='';this[_0xfc58('0xf')]='';this['online']=_0x5612ce[_0xfc58('0x10')]||![];this[_0xfc58('0x11')]=_0xfc58('0xb');this['voiceStatusTime']=0x0;this[_0xfc58('0x12')]='';this[_0xfc58('0x13')]='';this[_0xfc58('0x14')]=![];this[_0xfc58('0x15')]=![];this[_0xfc58('0x2')]='';}Agent[_0xfc58('0x16')][_0xfc58('0x17')]=function(_0x41d7bf){var _0x21e650;if(_0x41d7bf&&_0x41d7bf[_0xfc58('0x18')]){_0x21e650=_0x41d7bf[_0xfc58('0x18')][_0xfc58('0x19')]();switch(_0x21e650){case'not_inuse':_0x21e650=_0xfc58('0x1a');break;case _0xfc58('0x1b'):_0x21e650=_0xfc58('0x1c');break;}}if(_0x21e650&&this['voiceStatus']!==_0x21e650||_0x41d7bf['statePause']){this['voiceStatusTime']=_[_0xfc58('0x1d')](moment()[_0xfc58('0x1e')]('x'));}if(_0x21e650){this['voiceStatus']=_0x21e650;}var _0x4060c5={'id':this['id'],'name':this[_0xfc58('0x8')],'email':this['email'],'accountcode':this[_0xfc58('0xa')],'fullname':this[_0xfc58('0x1f')],'state':this[_0xfc58('0x18')],'stateTime':this[_0xfc58('0xc')],'status':this[_0xfc58('0xd')],'address':this[_0xfc58('0xe')],'online':this[_0xfc58('0x10')],'voiceStatus':this[_0xfc58('0x11')],'voiceStatusTime':this[_0xfc58('0x20')],'voiceStatusCallerIdNumber':this[_0xfc58('0x12')],'voiceStatusQueue':this[_0xfc58('0x13')],'interface':this['interface'],'onhold':this[_0xfc58('0x14')]};var _0x3865bf=md5(JSON[_0xfc58('0x21')](_0x4060c5));if(this[_0xfc58('0x2')]!==_0x3865bf){this['md5']=_0x3865bf;io['to'](util['format']('user:%s',_0x4060c5['name']))['emit'](_0xfc58('0x22'),_0x4060c5);io[_0xfc58('0x23')]('user:presence',_0x4060c5);}};module[_0xfc58('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 0c5d997..3d1d1a3 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 _0x04f2=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject'];(function(_0x1c999a,_0x4a1ebb){var _0x5e95ca=function(_0x19275f){while(--_0x19275f){_0x1c999a['push'](_0x1c999a['shift']());}};_0x5e95ca(++_0x4a1ebb);}(_0x04f2,0x108));var _0x204f=function(_0x29d03f,_0x36c073){_0x29d03f=_0x29d03f-0x0;var _0x1d3151=_0x04f2[_0x29d03f];return _0x1d3151;};'use strict';function Campaign(_0x31d015){this['id']=_0x31d015['id']||0x0;this[_0x204f('0x0')]=_0x31d015[_0x204f('0x0')]||'';this[_0x204f('0x1')]=_0x31d015[_0x204f('0x1')]||'campaign';this[_0x204f('0x2')]=0x0;this[_0x204f('0x3')]=0x0;this[_0x204f('0x4')]=0x0;this[_0x204f('0x5')]=0x0;this[_0x204f('0x6')]='';this[_0x204f('0x7')]=!![];this[_0x204f('0x8')]=_0x31d015[_0x204f('0x8')];this[_0x204f('0x9')]=_0x31d015[_0x204f('0x9')];this['dialTimezone']=_0x31d015[_0x204f('0xa')]||null;this['dialGlobalInterval']=_0x31d015['dialGlobalInterval']?_0x31d015[_0x204f('0xb')]:null;this[_0x204f('0xc')]=_0x31d015[_0x204f('0xc')];this[_0x204f('0xd')]=_0x31d015[_0x204f('0xd')];this[_0x204f('0xe')]=_0x31d015[_0x204f('0xe')]||0x1e;this[_0x204f('0xf')]=_0x31d015[_0x204f('0xf')];this[_0x204f('0x10')]=_0x31d015['dialCongestionRetryFrequency'];this[_0x204f('0x11')]=_0x31d015[_0x204f('0x11')];this[_0x204f('0x12')]=_0x31d015[_0x204f('0x12')];this[_0x204f('0x13')]=_0x31d015[_0x204f('0x13')];this['dialNoAnswerRetryFrequency']=_0x31d015[_0x204f('0x14')];this[_0x204f('0x15')]=_0x31d015[_0x204f('0x15')];this[_0x204f('0x16')]=_0x31d015[_0x204f('0x16')]||0x3;this[_0x204f('0x17')]=_0x31d015['dialNoSuchNumberRetryFrequency']||0x96;this[_0x204f('0x18')]=_0x31d015[_0x204f('0x18')]||0x3;this[_0x204f('0x19')]=_0x31d015[_0x204f('0x19')]||0x96;this[_0x204f('0x1a')]=_0x31d015[_0x204f('0x1a')]||0x3;this[_0x204f('0x1b')]=_0x31d015[_0x204f('0x1b')]||0x96;this[_0x204f('0x1c')]=_0x31d015[_0x204f('0x1c')]||0x3;this[_0x204f('0x1d')]=_0x31d015[_0x204f('0x1d')]||0x96;this['dialAgentRejectMaxRetry']=_0x31d015[_0x204f('0x1e')]||0x3;this[_0x204f('0x1f')]=_0x31d015['dialAgentRejectRetryFrequency']||0x96;this[_0x204f('0x20')]=_0x31d015[_0x204f('0x20')]||_0x204f('0x21');this[_0x204f('0x22')]=_0x31d015[_0x204f('0x22')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x31d015[_0x204f('0x23')]||undefined;this['dialCutDigit']=_0x31d015[_0x204f('0x24')]||undefined;this[_0x204f('0x25')]=_0x31d015[_0x204f('0x25')]?_0x31d015[_0x204f('0x25')]:undefined;this['Trunk']=_0x31d015[_0x204f('0x26')]?_0x31d015['Trunk']:undefined;this['Interval']=_0x31d015[_0x204f('0x27')]?_0x31d015[_0x204f('0x27')]:undefined;this['SquareProject']=_0x31d015[_0x204f('0x28')]?_0x31d015[_0x204f('0x28')]:undefined;this[_0x204f('0x29')]=_0x31d015[_0x204f('0x28')]?_0x31d015['SquareProject']['name']:undefined;this[_0x204f('0x2a')]=_0x31d015[_0x204f('0x2a')]||![];this[_0x204f('0x2b')]=_0x31d015[_0x204f('0x2b')];this[_0x204f('0x2c')]=_0x31d015[_0x204f('0x2c')];this['dialAMDAfterGreetingSilence']=_0x31d015[_0x204f('0x2d')];this[_0x204f('0x2e')]=_0x31d015[_0x204f('0x2e')];this[_0x204f('0x2f')]=_0x31d015[_0x204f('0x2f')];this['dialAMDBetweenWordsSilence']=_0x31d015['dialAMDBetweenWordsSilence'];this[_0x204f('0x30')]=_0x31d015[_0x204f('0x30')];this['dialAMDSilenceThreshold']=_0x31d015['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x31d015[_0x204f('0x31')];}module[_0x204f('0x32')]=Campaign; \ No newline at end of file +var _0xf7e7=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xf7e7,0x182));var _0x7f7e=function(_0x2dece6,_0xc2eff9){_0x2dece6=_0x2dece6-0x0;var _0x1ca416=_0xf7e7[_0x2dece6];return _0x1ca416;};'use strict';function Campaign(_0x83b997){this['id']=_0x83b997['id']||0x0;this[_0x7f7e('0x0')]=_0x83b997[_0x7f7e('0x0')]||'';this[_0x7f7e('0x1')]=_0x83b997[_0x7f7e('0x1')]||_0x7f7e('0x2');this[_0x7f7e('0x3')]=0x0;this[_0x7f7e('0x4')]=0x0;this[_0x7f7e('0x5')]=0x0;this[_0x7f7e('0x6')]=0x0;this[_0x7f7e('0x7')]='';this[_0x7f7e('0x8')]=!![];this['active']=_0x83b997[_0x7f7e('0x9')];this[_0x7f7e('0xa')]=_0x83b997['limitCalls'];this[_0x7f7e('0xb')]=_0x83b997['dialTimezone']||null;this[_0x7f7e('0xc')]=_0x83b997[_0x7f7e('0xc')]?_0x83b997[_0x7f7e('0xc')]:null;this[_0x7f7e('0xd')]=_0x83b997[_0x7f7e('0xd')];this[_0x7f7e('0xe')]=_0x83b997[_0x7f7e('0xe')];this[_0x7f7e('0xf')]=_0x83b997[_0x7f7e('0xf')]||0x1e;this[_0x7f7e('0x10')]=_0x83b997[_0x7f7e('0x10')];this[_0x7f7e('0x11')]=_0x83b997[_0x7f7e('0x11')];this[_0x7f7e('0x12')]=_0x83b997['dialBusyMaxRetry'];this[_0x7f7e('0x13')]=_0x83b997[_0x7f7e('0x13')];this[_0x7f7e('0x14')]=_0x83b997['dialNoAnswerMaxRetry'];this[_0x7f7e('0x15')]=_0x83b997[_0x7f7e('0x15')];this[_0x7f7e('0x16')]=_0x83b997['dialGlobalMaxRetry'];this[_0x7f7e('0x17')]=_0x83b997[_0x7f7e('0x17')]||0x3;this[_0x7f7e('0x18')]=_0x83b997[_0x7f7e('0x18')]||0x96;this[_0x7f7e('0x19')]=_0x83b997[_0x7f7e('0x19')]||0x3;this[_0x7f7e('0x1a')]=_0x83b997['dialDropRetryFrequency']||0x96;this[_0x7f7e('0x1b')]=_0x83b997[_0x7f7e('0x1b')]||0x3;this[_0x7f7e('0x1c')]=_0x83b997[_0x7f7e('0x1c')]||0x96;this[_0x7f7e('0x1d')]=_0x83b997['dialMachineMaxRetry']||0x3;this[_0x7f7e('0x1e')]=_0x83b997[_0x7f7e('0x1e')]||0x96;this[_0x7f7e('0x1f')]=_0x83b997[_0x7f7e('0x1f')]||0x3;this['dialAgentRejectRetryFrequency']=_0x83b997[_0x7f7e('0x20')]||0x96;this[_0x7f7e('0x21')]=_0x83b997[_0x7f7e('0x21')]||_0x7f7e('0x22');this[_0x7f7e('0x23')]=_0x83b997[_0x7f7e('0x23')]||undefined;this[_0x7f7e('0x24')]=_0x83b997['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x7f7e('0x25')]=_0x83b997[_0x7f7e('0x25')]||undefined;this[_0x7f7e('0x26')]=_0x83b997[_0x7f7e('0x26')]?_0x83b997['TrunkBackup']:undefined;this[_0x7f7e('0x27')]=_0x83b997[_0x7f7e('0x27')]?_0x83b997['Trunk']:undefined;this[_0x7f7e('0x28')]=_0x83b997[_0x7f7e('0x28')]?_0x83b997[_0x7f7e('0x28')]:undefined;this[_0x7f7e('0x29')]=_0x83b997[_0x7f7e('0x29')]?_0x83b997[_0x7f7e('0x29')]:undefined;this[_0x7f7e('0x2a')]=_0x83b997[_0x7f7e('0x29')]?_0x83b997[_0x7f7e('0x29')][_0x7f7e('0x0')]:undefined;this[_0x7f7e('0x2b')]=_0x83b997[_0x7f7e('0x2b')]||![];this['dialAMDInitialSilence']=_0x83b997[_0x7f7e('0x2c')];this[_0x7f7e('0x2d')]=_0x83b997[_0x7f7e('0x2d')];this[_0x7f7e('0x2e')]=_0x83b997[_0x7f7e('0x2e')];this[_0x7f7e('0x2f')]=_0x83b997[_0x7f7e('0x2f')];this[_0x7f7e('0x30')]=_0x83b997['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x83b997[_0x7f7e('0x31')];this['dialAMDMaximumNumberOfWords']=_0x83b997[_0x7f7e('0x32')];this[_0x7f7e('0x33')]=_0x83b997[_0x7f7e('0x33')];this[_0x7f7e('0x34')]=_0x83b997[_0x7f7e('0x34')];}module[_0x7f7e('0x35')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 57c4627..3867df6 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 _0x2a1f=['mohtime','exports','starttime','destinationchannel','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','disposition','monitor','monitorFilename','transfercalleridnum','transferconnectedlinenum'];(function(_0x4ca630,_0x5dc370){var _0x22fb5a=function(_0x475c08){while(--_0x475c08){_0x4ca630['push'](_0x4ca630['shift']());}};_0x22fb5a(++_0x5dc370);}(_0x2a1f,0x12e));var _0xf2a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a1f[_0x3dd15e];return _0x231fd0;};'use strict';function Channel(){this[_0xf2a1('0x0')]=null;this['channel']='';this[_0xf2a1('0x1')]='';this['calleridnum']=0x0;this[_0xf2a1('0x2')]='';this['connectedlinenum']=undefined;this[_0xf2a1('0x3')]=undefined;this[_0xf2a1('0x4')]=0x0;this[_0xf2a1('0x5')]='';this[_0xf2a1('0x6')]=0x0;this[_0xf2a1('0x7')]=0x0;this[_0xf2a1('0x8')]=0x0;this['answered']=![];this[_0xf2a1('0x9')]=null;this[_0xf2a1('0xa')]=null;this[_0xf2a1('0xb')]=![];this[_0xf2a1('0xc')]=![];this[_0xf2a1('0xd')]='';this[_0xf2a1('0xe')]='';this['duration']=0x0;this[_0xf2a1('0xf')]=0x0;this[_0xf2a1('0x10')]=0x0;this[_0xf2a1('0x11')]=null;this['tag']=null;this[_0xf2a1('0x12')]=null;this[_0xf2a1('0x13')]=![];this[_0xf2a1('0x14')]=null;this['queue']=null;this['monitors']=[];this[_0xf2a1('0x15')]=undefined;this[_0xf2a1('0x16')]=undefined;this['transferType']=undefined;this[_0xf2a1('0x17')]=0x0;}module[_0xf2a1('0x18')]=Channel; \ No newline at end of file +var _0x582f=['calleridname','connectedlinenum','accountcode','context','uniqueid','exten','answered','endtime','unmanaged','abandoned','lastdata','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','calleridnum'];(function(_0x282d15,_0x225a4c){var _0x53f62a=function(_0x5f2440){while(--_0x5f2440){_0x282d15['push'](_0x282d15['shift']());}};_0x53f62a(++_0x225a4c);}(_0x582f,0x7f));var _0xf582=function(_0x483102,_0x54e93d){_0x483102=_0x483102-0x0;var _0x5cc885=_0x582f[_0x483102];return _0x5cc885;};'use strict';function Channel(){this[_0xf582('0x0')]=null;this['channel']='';this[_0xf582('0x1')]='';this[_0xf582('0x2')]=0x0;this[_0xf582('0x3')]='';this[_0xf582('0x4')]=undefined;this['connectedlinename']=undefined;this[_0xf582('0x5')]=0x0;this[_0xf582('0x6')]='';this[_0xf582('0x7')]=0x0;this['linkedid']=0x0;this[_0xf582('0x8')]=0x0;this[_0xf582('0x9')]=![];this['answertime']=null;this[_0xf582('0xa')]=null;this[_0xf582('0xb')]=![];this[_0xf582('0xc')]=![];this['lastapplication']='';this[_0xf582('0xd')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0xf582('0xe')]=0x0;this[_0xf582('0xf')]=null;this[_0xf582('0x10')]=null;this[_0xf582('0x11')]=null;this[_0xf582('0x12')]=![];this[_0xf582('0x13')]=null;this[_0xf582('0x14')]=null;this[_0xf582('0x15')]=[];this[_0xf582('0x16')]=undefined;this[_0xf582('0x17')]=undefined;this['transferType']=undefined;this[_0xf582('0x18')]=0x0;}module[_0xf582('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index c94e9b6..4fceccb 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 _0x72a2=['exports','name','username','remoteUri','authType','password','consumerSecret','token','type','serverUrl','Configurations'];(function(_0x2cc238,_0x4d6b15){var _0x1ae0e7=function(_0x343db9){while(--_0x343db9){_0x2cc238['push'](_0x2cc238['shift']());}};_0x1ae0e7(++_0x4d6b15);}(_0x72a2,0x161));var _0x272a=function(_0x1a3b2a,_0x1d541c){_0x1a3b2a=_0x1a3b2a-0x0;var _0x501cc9=_0x72a2[_0x1a3b2a];return _0x501cc9;};'use strict';function DeskAccount(_0x2a03b1){this['id']=_0x2a03b1['id']||0x0;this[_0x272a('0x0')]=_0x2a03b1[_0x272a('0x0')]||'';this[_0x272a('0x1')]=_0x2a03b1[_0x272a('0x1')]||'';this[_0x272a('0x2')]=_0x2a03b1['remoteUri']||'';this[_0x272a('0x3')]=_0x2a03b1['authType']||'';this[_0x272a('0x4')]=_0x2a03b1['password']||'';this['consumerKey']=_0x2a03b1['consumerKey']||'';this[_0x272a('0x5')]=_0x2a03b1[_0x272a('0x5')]||'';this[_0x272a('0x6')]=_0x2a03b1[_0x272a('0x6')]||'';this['tokenSecret']=_0x2a03b1['tokenSecret']||'';this[_0x272a('0x7')]=_0x2a03b1['type']||'';this[_0x272a('0x8')]=_0x2a03b1['serverUrl']||'';this[_0x272a('0x9')]=_0x2a03b1[_0x272a('0x9')]||{};}module[_0x272a('0xa')]=DeskAccount; \ No newline at end of file +var _0x8784=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x5f1b57,_0x42f644){var _0x4b703d=function(_0x483802){while(--_0x483802){_0x5f1b57['push'](_0x5f1b57['shift']());}};_0x4b703d(++_0x42f644);}(_0x8784,0x172));var _0x4878=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0x8784[_0x5ce8b9];return _0xe34be0;};'use strict';function DeskAccount(_0xb0b16d){this['id']=_0xb0b16d['id']||0x0;this[_0x4878('0x0')]=_0xb0b16d['name']||'';this[_0x4878('0x1')]=_0xb0b16d[_0x4878('0x1')]||'';this[_0x4878('0x2')]=_0xb0b16d[_0x4878('0x2')]||'';this[_0x4878('0x3')]=_0xb0b16d['authType']||'';this['password']=_0xb0b16d[_0x4878('0x4')]||'';this[_0x4878('0x5')]=_0xb0b16d[_0x4878('0x5')]||'';this[_0x4878('0x6')]=_0xb0b16d[_0x4878('0x6')]||'';this[_0x4878('0x7')]=_0xb0b16d[_0x4878('0x7')]||'';this[_0x4878('0x8')]=_0xb0b16d[_0x4878('0x8')]||'';this['type']=_0xb0b16d[_0x4878('0x9')]||'';this[_0x4878('0xa')]=_0xb0b16d[_0x4878('0xa')]||'';this[_0x4878('0xb')]=_0xb0b16d[_0x4878('0xb')]||{};}module[_0x4878('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 e6c618b..08cc0ec 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 _0xe343=['clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0xe343,0x1d0));var _0x3e34=function(_0x2d2623,_0x1aaea0){_0x2d2623=_0x2d2623-0x0;var _0x28f6c1=_0xe343[_0x2d2623];return _0x28f6c1;};'use strict';function Dynamics365Account(_0x19a72a){this['id']=_0x19a72a['id']||0x0;this[_0x3e34('0x0')]=_0x19a72a[_0x3e34('0x0')]||'';this[_0x3e34('0x1')]=_0x19a72a['username']||'';this[_0x3e34('0x2')]=_0x19a72a[_0x3e34('0x2')]||'';this[_0x3e34('0x3')]=_0x19a72a['remoteUri']||'';this[_0x3e34('0x4')]=_0x19a72a[_0x3e34('0x4')]||'';this[_0x3e34('0x5')]=_0x19a72a[_0x3e34('0x5')]||'';this[_0x3e34('0x6')]=_0x19a72a[_0x3e34('0x6')]||{};this[_0x3e34('0x7')]=_0x19a72a['serverUrl']||'';this[_0x3e34('0x8')]=_0x19a72a[_0x3e34('0x8')]||{};}module[_0x3e34('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x8b52=['remoteUri','tenantId','clientId','clientSecret','Configurations','name','username','password'];(function(_0x55d9bf,_0x1130f9){var _0x474923=function(_0x5d59c0){while(--_0x5d59c0){_0x55d9bf['push'](_0x55d9bf['shift']());}};_0x474923(++_0x1130f9);}(_0x8b52,0x19d));var _0x28b5=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8b52[_0x53ccf2];return _0x5a2964;};'use strict';function Dynamics365Account(_0x20fa88){this['id']=_0x20fa88['id']||0x0;this[_0x28b5('0x0')]=_0x20fa88['name']||'';this[_0x28b5('0x1')]=_0x20fa88[_0x28b5('0x1')]||'';this['password']=_0x20fa88[_0x28b5('0x2')]||'';this[_0x28b5('0x3')]=_0x20fa88[_0x28b5('0x3')]||'';this['tenantId']=_0x20fa88[_0x28b5('0x4')]||'';this['clientId']=_0x20fa88[_0x28b5('0x5')]||'';this['clientSecret']=_0x20fa88[_0x28b5('0x6')]||{};this['serverUrl']=_0x20fa88['serverUrl']||'';this[_0x28b5('0x7')]=_0x20fa88[_0x28b5('0x7')]||{};}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 d5801f8..593b6f3 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 _0xd653=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','name','description'];(function(_0x3b1404,_0x2639be){var _0x555efd=function(_0x10a3b9){while(--_0x10a3b9){_0x3b1404['push'](_0x3b1404['shift']());}};_0x555efd(++_0x2639be);}(_0xd653,0x6e));var _0x3d65=function(_0x242db3,_0x869fe9){_0x242db3=_0x242db3-0x0;var _0x593d17=_0xd653[_0x242db3];return _0x593d17;};'use strict';function FaxAccount(_0x563228){this['id']=_0x563228['id']||0x0;this[_0x3d65('0x0')]=_0x563228['name']||'';this['description']=_0x563228[_0x3d65('0x1')];this[_0x3d65('0x2')]=_0x563228[_0x3d65('0x2')];this['headerinfo']=_0x563228[_0x3d65('0x3')];this[_0x3d65('0x4')]=_0x563228[_0x3d65('0x4')];this[_0x3d65('0x5')]=_0x563228[_0x3d65('0x5')]||0x960;this[_0x3d65('0x6')]=_0x563228['maxrate']||0x3840;this[_0x3d65('0x7')]=_0x563228[_0x3d65('0x7')]||_0x3d65('0x8');this[_0x3d65('0x9')]=_0x563228[_0x3d65('0x9')]||'no';this[_0x3d65('0xa')]=_0x563228['faxdetect']||'no';this[_0x3d65('0xb')]=_0x563228['t38timeout']||0x1388;this[_0x3d65('0xc')]=_0x563228[_0x3d65('0xc')]||_0x3d65('0xd');this['Trunk']=_0x563228[_0x3d65('0xe')]?_0x563228[_0x3d65('0xe')]:undefined;this[_0x3d65('0xf')]=_0x563228['ListId'];this['key']=_0x563228['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0xc110=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x5eb113,_0x1d38d0){var _0x5d59b7=function(_0x161125){while(--_0x161125){_0x5eb113['push'](_0x5eb113['shift']());}};_0x5d59b7(++_0x1d38d0);}(_0xc110,0x1c1));var _0x0c11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc110[_0x3dd15e];return _0x231fd0;};'use strict';function FaxAccount(_0x3860f3){this['id']=_0x3860f3['id']||0x0;this[_0x0c11('0x0')]=_0x3860f3['name']||'';this[_0x0c11('0x1')]=_0x3860f3[_0x0c11('0x1')];this[_0x0c11('0x2')]=_0x3860f3['ecm'];this[_0x0c11('0x3')]=_0x3860f3[_0x0c11('0x3')];this[_0x0c11('0x4')]=_0x3860f3['localstationid'];this[_0x0c11('0x5')]=_0x3860f3[_0x0c11('0x5')]||0x960;this[_0x0c11('0x6')]=_0x3860f3[_0x0c11('0x6')]||0x3840;this[_0x0c11('0x7')]=_0x3860f3[_0x0c11('0x7')]||_0x0c11('0x8');this['gateway']=_0x3860f3[_0x0c11('0x9')]||'no';this[_0x0c11('0xa')]=_0x3860f3[_0x0c11('0xa')]||'no';this[_0x0c11('0xb')]=_0x3860f3['t38timeout']||0x1388;this[_0x0c11('0xc')]=_0x3860f3[_0x0c11('0xc')]||_0x0c11('0xd');this[_0x0c11('0xe')]=_0x3860f3[_0x0c11('0xe')]?_0x3860f3[_0x0c11('0xe')]:undefined;this[_0x0c11('0xf')]=_0x3860f3[_0x0c11('0xf')];this[_0x0c11('0x10')]=_0x3860f3['key'];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 1f7c6da..f1f23ae 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 _0xbfc0=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x418549,_0x11b13d){var _0x288826=function(_0x3c0411){while(--_0x3c0411){_0x418549['push'](_0x418549['shift']());}};_0x288826(++_0x11b13d);}(_0xbfc0,0x7c));var _0x0bfc=function(_0x380b8f,_0x32271d){_0x380b8f=_0x380b8f-0x0;var _0x646c69=_0xbfc0[_0x380b8f];return _0x646c69;};'use strict';function FreshdeskAccount(_0x3e314e){this['id']=_0x3e314e['id']||0x0;this[_0x0bfc('0x0')]=_0x3e314e[_0x0bfc('0x0')]||'';this[_0x0bfc('0x1')]=_0x3e314e[_0x0bfc('0x1')]||'';this['apiKey']=_0x3e314e[_0x0bfc('0x2')]||'';this[_0x0bfc('0x3')]=_0x3e314e[_0x0bfc('0x3')]||'';this[_0x0bfc('0x4')]=_0x3e314e[_0x0bfc('0x4')]||'';this[_0x0bfc('0x5')]=_0x3e314e['Configurations']||{};}module[_0x0bfc('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x32b6=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2108f9,_0x5692dd){var _0x2c7e61=function(_0x5f537e){while(--_0x5f537e){_0x2108f9['push'](_0x2108f9['shift']());}};_0x2c7e61(++_0x5692dd);}(_0x32b6,0x196));var _0x632b=function(_0x164d20,_0x2eb39d){_0x164d20=_0x164d20-0x0;var _0x57f068=_0x32b6[_0x164d20];return _0x57f068;};'use strict';function FreshdeskAccount(_0x2e218c){this['id']=_0x2e218c['id']||0x0;this[_0x632b('0x0')]=_0x2e218c['name']||'';this['username']=_0x2e218c[_0x632b('0x1')]||'';this[_0x632b('0x2')]=_0x2e218c[_0x632b('0x3')]||'';this['remoteUri']=_0x2e218c[_0x632b('0x4')]||'';this['serverUrl']=_0x2e218c[_0x632b('0x5')]||'';this[_0x632b('0x6')]=_0x2e218c['Configurations']||{};}module[_0x632b('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 1dd348c..6e897c1 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 _0x7335=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x866c51,_0xcf480c){var _0x430833=function(_0x2ced6c){while(--_0x2ced6c){_0x866c51['push'](_0x866c51['shift']());}};_0x430833(++_0xcf480c);}(_0x7335,0x82));var _0x5733=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x7335[_0x4b7895];return _0x264180;};'use strict';function FreshsalesAccount(_0x57768a){this['id']=_0x57768a['id']||0x0;this[_0x5733('0x0')]=_0x57768a['name']||'';this[_0x5733('0x1')]=_0x57768a['username']||'';this[_0x5733('0x2')]=_0x57768a[_0x5733('0x3')]||'';this['remoteUri']=_0x57768a[_0x5733('0x4')]||'';this[_0x5733('0x5')]=_0x57768a[_0x5733('0x5')]||'';this[_0x5733('0x6')]=_0x57768a[_0x5733('0x6')]||{};}module[_0x5733('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xd145=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xd145,0xfe));var _0x5d14=function(_0x112ab7,_0x242908){_0x112ab7=_0x112ab7-0x0;var _0x4bc1aa=_0xd145[_0x112ab7];return _0x4bc1aa;};'use strict';function FreshsalesAccount(_0x5a9d6a){this['id']=_0x5a9d6a['id']||0x0;this[_0x5d14('0x0')]=_0x5a9d6a[_0x5d14('0x0')]||'';this[_0x5d14('0x1')]=_0x5a9d6a[_0x5d14('0x1')]||'';this[_0x5d14('0x2')]=_0x5a9d6a[_0x5d14('0x3')]||'';this[_0x5d14('0x4')]=_0x5a9d6a[_0x5d14('0x4')]||'';this['serverUrl']=_0x5a9d6a[_0x5d14('0x5')]||'';this['Configurations']=_0x5a9d6a[_0x5d14('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index a57d881..754915a 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 _0x6be9=['variables','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','exten','priority','holdtime','lastAssignedTo','mohtime'];(function(_0x2e600d,_0x125f1e){var _0x1c9a25=function(_0xd5dbde){while(--_0xd5dbde){_0x2e600d['push'](_0x2e600d['shift']());}};_0x1c9a25(++_0x125f1e);}(_0x6be9,0xec));var _0x96be=function(_0x5f2707,_0x203047){_0x5f2707=_0x5f2707-0x0;var _0x3b953c=_0x6be9[_0x5f2707];return _0x3b953c;};'use strict';function QueueReport(){this[_0x96be('0x0')]=_0x96be('0x1');this[_0x96be('0x2')]='';this[_0x96be('0x3')]='';this['calleridname']='';this[_0x96be('0x4')]='';this[_0x96be('0x5')]=null;this[_0x96be('0x6')]=null;this[_0x96be('0x7')]=0x1;this[_0x96be('0x8')]=0x1;this[_0x96be('0x9')]=![];this[_0x96be('0xa')]=null;this[_0x96be('0xb')]=![];this[_0x96be('0xc')]=null;this[_0x96be('0xd')]=![];this[_0x96be('0xe')]=null;this[_0x96be('0xf')]=0x1;this[_0x96be('0x10')]='';this['connectedlinenum']='';this[_0x96be('0x11')]='';this[_0x96be('0x12')]='';this['context']='';this[_0x96be('0x13')]='';this[_0x96be('0x14')]='';this[_0x96be('0x15')]=0x0;this['assigned']=![];this[_0x96be('0x16')]='';this[_0x96be('0x17')]=0x0;this[_0x96be('0x18')]={};}module[_0x96be('0x19')]=QueueReport; \ No newline at end of file +var _0x3f05=['queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','inbound','calleridname','queue'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x3f05,0xbd));var _0x53f0=function(_0x22d6b2,_0x3a2543){_0x22d6b2=_0x22d6b2-0x0;var _0x3c02f6=_0x3f05[_0x22d6b2];return _0x3c02f6;};'use strict';function QueueReport(){this['type']=_0x53f0('0x0');this['uniqueid']='';this['calleridnum']='';this[_0x53f0('0x1')]='';this[_0x53f0('0x2')]='';this[_0x53f0('0x3')]=null;this[_0x53f0('0x4')]=null;this[_0x53f0('0x5')]=0x1;this[_0x53f0('0x6')]=0x1;this[_0x53f0('0x7')]=![];this[_0x53f0('0x8')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x53f0('0x9')]=null;this[_0x53f0('0xa')]=0x1;this[_0x53f0('0xb')]='';this[_0x53f0('0xc')]='';this[_0x53f0('0xd')]='';this[_0x53f0('0xe')]='';this[_0x53f0('0xf')]='';this[_0x53f0('0x10')]='';this[_0x53f0('0x11')]='';this[_0x53f0('0x12')]=0x0;this[_0x53f0('0x13')]=![];this[_0x53f0('0x14')]='';this[_0x53f0('0x15')]=0x0;this[_0x53f0('0x16')]={};}module[_0x53f0('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 9476b36..e32ccf5 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 _0xd12f=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd12f,0x8b));var _0xfd12=function(_0x40f27f,_0x2e1140){_0x40f27f=_0x40f27f-0x0;var _0x3bede3=_0xd12f[_0x40f27f];return _0x3bede3;};'use strict';function SalesforceAccount(_0x331413){this['id']=_0x331413['id']||0x0;this[_0xfd12('0x0')]=_0x331413[_0xfd12('0x0')]||'';this[_0xfd12('0x1')]=_0x331413[_0xfd12('0x1')]||'';this[_0xfd12('0x2')]=_0x331413[_0xfd12('0x2')]||'';this[_0xfd12('0x3')]=_0x331413[_0xfd12('0x3')]||'';this[_0xfd12('0x4')]=_0x331413[_0xfd12('0x4')]||'';this[_0xfd12('0x5')]=_0x331413['clientSecret']||'';this[_0xfd12('0x6')]=_0x331413[_0xfd12('0x6')]||'';this['type']=_0x331413[_0xfd12('0x7')]||_0xfd12('0x8');this[_0xfd12('0x9')]=_0x331413['serverUrl']||'';this[_0xfd12('0xa')]=_0x331413[_0xfd12('0xa')]||{};}module[_0xfd12('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x7462=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x2e617d,_0x17c590){var _0x34c295=function(_0x273f83){while(--_0x273f83){_0x2e617d['push'](_0x2e617d['shift']());}};_0x34c295(++_0x17c590);}(_0x7462,0x165));var _0x2746=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0x7462[_0x17e771];return _0x1f3a6d;};'use strict';function SalesforceAccount(_0x5605cb){this['id']=_0x5605cb['id']||0x0;this[_0x2746('0x0')]=_0x5605cb['name']||'';this['username']=_0x5605cb[_0x2746('0x1')]||'';this['remoteUri']=_0x5605cb['remoteUri']||'';this[_0x2746('0x2')]=_0x5605cb[_0x2746('0x2')]||'';this['clientId']=_0x5605cb[_0x2746('0x3')]||'';this[_0x2746('0x4')]=_0x5605cb[_0x2746('0x4')]||'';this[_0x2746('0x5')]=_0x5605cb[_0x2746('0x5')]||'';this[_0x2746('0x6')]=_0x5605cb[_0x2746('0x6')]||_0x2746('0x7');this[_0x2746('0x8')]=_0x5605cb['serverUrl']||'';this[_0x2746('0x9')]=_0x5605cb[_0x2746('0x9')]||{};}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 7a01a8b..72608f6 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 _0x70d2=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x2b3432,_0x307757){var _0x538cba=function(_0x5e4622){while(--_0x5e4622){_0x2b3432['push'](_0x2b3432['shift']());}};_0x538cba(++_0x307757);}(_0x70d2,0x10d));var _0x270d=function(_0xc09ccd,_0x5617a0){_0xc09ccd=_0xc09ccd-0x0;var _0x5b9326=_0x70d2[_0xc09ccd];return _0x5b9326;};'use strict';function ServicenowAccount(_0xbb41a9){this['id']=_0xbb41a9['id']||0x0;this[_0x270d('0x0')]=_0xbb41a9['name']||'';this[_0x270d('0x1')]=_0xbb41a9[_0x270d('0x1')]||'';this[_0x270d('0x2')]=_0xbb41a9['password']||'';this[_0x270d('0x3')]=_0xbb41a9[_0x270d('0x3')]||'';this[_0x270d('0x4')]=_0xbb41a9[_0x270d('0x4')]||'';this[_0x270d('0x5')]=_0xbb41a9[_0x270d('0x5')]||{};}module[_0x270d('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x885b=['password','remoteUri','Configurations','exports','name','username'];(function(_0x424ef0,_0x2ac057){var _0x83ccf3=function(_0x19b419){while(--_0x19b419){_0x424ef0['push'](_0x424ef0['shift']());}};_0x83ccf3(++_0x2ac057);}(_0x885b,0x6a));var _0xb885=function(_0x254e93,_0x41cb2a){_0x254e93=_0x254e93-0x0;var _0x595d06=_0x885b[_0x254e93];return _0x595d06;};'use strict';function ServicenowAccount(_0x4b6f7e){this['id']=_0x4b6f7e['id']||0x0;this[_0xb885('0x0')]=_0x4b6f7e[_0xb885('0x0')]||'';this['username']=_0x4b6f7e[_0xb885('0x1')]||'';this['password']=_0x4b6f7e[_0xb885('0x2')]||'';this['remoteUri']=_0x4b6f7e[_0xb885('0x3')]||'';this['serverUrl']=_0x4b6f7e['serverUrl']||'';this['Configurations']=_0x4b6f7e[_0xb885('0x4')]||{};}module[_0xb885('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index beeb0ec..d77b779 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 _0x1f76=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x468839,_0x2e43af){var _0x349255=function(_0x55d6d9){while(--_0x55d6d9){_0x468839['push'](_0x468839['shift']());}};_0x349255(++_0x2e43af);}(_0x1f76,0x13c));var _0x61f7=function(_0x1484ea,_0x29695e){_0x1484ea=_0x1484ea-0x0;var _0x163045=_0x1f76[_0x1484ea];return _0x163045;};'use strict';function SugarcrmAccount(_0x59e474){this['id']=_0x59e474['id']||0x0;this[_0x61f7('0x0')]=_0x59e474[_0x61f7('0x0')]||'';this[_0x61f7('0x1')]=_0x59e474[_0x61f7('0x1')]||'';this[_0x61f7('0x2')]=_0x59e474[_0x61f7('0x2')]||'';this[_0x61f7('0x3')]=_0x59e474['remoteUri']||'';this[_0x61f7('0x4')]=_0x59e474[_0x61f7('0x4')]||'';this[_0x61f7('0x5')]=_0x59e474[_0x61f7('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x378b=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x190d07,_0x3c80d2){var _0x385df0=function(_0x134289){while(--_0x134289){_0x190d07['push'](_0x190d07['shift']());}};_0x385df0(++_0x3c80d2);}(_0x378b,0x185));var _0xb378=function(_0x6c7fbc,_0x32ac0){_0x6c7fbc=_0x6c7fbc-0x0;var _0x31fdd8=_0x378b[_0x6c7fbc];return _0x31fdd8;};'use strict';function SugarcrmAccount(_0x29da10){this['id']=_0x29da10['id']||0x0;this[_0xb378('0x0')]=_0x29da10[_0xb378('0x0')]||'';this[_0xb378('0x1')]=_0x29da10[_0xb378('0x1')]||'';this[_0xb378('0x2')]=_0x29da10[_0xb378('0x2')]||'';this['remoteUri']=_0x29da10[_0xb378('0x3')]||'';this[_0xb378('0x4')]=_0x29da10['serverUrl']||'';this[_0xb378('0x5')]=_0x29da10[_0xb378('0x5')]||{};}module[_0xb378('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 c75fc3f..aba1262 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 _0xe778=['exports','name','state','status'];(function(_0x2e69dc,_0x35cc1c){var _0x2f1593=function(_0x4c46b2){while(--_0x4c46b2){_0x2e69dc['push'](_0x2e69dc['shift']());}};_0x2f1593(++_0x35cc1c);}(_0xe778,0x1dd));var _0x8e77=function(_0x27ab46,_0x39b033){_0x27ab46=_0x27ab46-0x0;var _0x2d8dc5=_0xe778[_0x27ab46];return _0x2d8dc5;};'use strict';function Telephone(_0x13eceb){this['id']=_0x13eceb['id']||0x0;this['name']=_0x13eceb[_0x8e77('0x0')]||'';this['accountcode']=_0x13eceb['accountcode']||'';this[_0x8e77('0x1')]='unknown';this['stateTime']=0x0;this[_0x8e77('0x2')]='unknown';this['address']='';}module[_0x8e77('0x3')]=Telephone; \ No newline at end of file +var _0x05a4=['address','name','accountcode','state','unknown','status'];(function(_0x5bfc4f,_0x19456e){var _0xea3ab5=function(_0x2e4ef5){while(--_0x2e4ef5){_0x5bfc4f['push'](_0x5bfc4f['shift']());}};_0xea3ab5(++_0x19456e);}(_0x05a4,0xd3));var _0x405a=function(_0xb948ec,_0x3f250c){_0xb948ec=_0xb948ec-0x0;var _0x2ef55f=_0x05a4[_0xb948ec];return _0x2ef55f;};'use strict';function Telephone(_0x1b3432){this['id']=_0x1b3432['id']||0x0;this[_0x405a('0x0')]=_0x1b3432[_0x405a('0x0')]||'';this['accountcode']=_0x1b3432[_0x405a('0x1')]||'';this[_0x405a('0x2')]=_0x405a('0x3');this['stateTime']=0x0;this[_0x405a('0x4')]=_0x405a('0x3');this[_0x405a('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index f94da5e..dd96a93 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 _0x5c87=['html','name'];(function(_0x208267,_0x2455bc){var _0x1319af=function(_0x1ee1de){while(--_0x1ee1de){_0x208267['push'](_0x208267['shift']());}};_0x1319af(++_0x2455bc);}(_0x5c87,0x77));var _0x75c8=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x5c87[_0x1b349a];return _0x5d1f7c;};'use strict';function template(_0x38d3f2){this['id']=_0x38d3f2['id']||0x0;this['name']=_0x38d3f2[_0x75c8('0x0')]||'';this['html']=_0x38d3f2[_0x75c8('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xff16=['exports','name','html'];(function(_0xff1b17,_0x4d3269){var _0x38bc39=function(_0x4a4bae){while(--_0x4a4bae){_0xff1b17['push'](_0xff1b17['shift']());}};_0x38bc39(++_0x4d3269);}(_0xff16,0x7f));var _0x6ff1=function(_0x5c76de,_0xdf4ed8){_0x5c76de=_0x5c76de-0x0;var _0x1d71ba=_0xff16[_0x5c76de];return _0x1d71ba;};'use strict';function template(_0x393ef9){this['id']=_0x393ef9['id']||0x0;this[_0x6ff1('0x0')]=_0x393ef9['name']||'';this[_0x6ff1('0x1')]=_0x393ef9[_0x6ff1('0x1')]||'';}module[_0x6ff1('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index eb7aae7..984b4d1 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 _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0x333fed,_0x3d2122){var _0x12cac2=function(_0x41d9af){while(--_0x41d9af){_0x333fed['push'](_0x333fed['shift']());}};_0x12cac2(++_0x3d2122);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('0x7')]=Trigger; \ No newline at end of file +var _0x3e74=['Actions','name','channel','status','AllConditions','AnyConditions'];(function(_0x482f49,_0x3641f9){var _0x2fcc18=function(_0x243ed5){while(--_0x243ed5){_0x482f49['push'](_0x482f49['shift']());}};_0x2fcc18(++_0x3641f9);}(_0x3e74,0x175));var _0x43e7=function(_0x4d38a4,_0x35abee){_0x4d38a4=_0x4d38a4-0x0;var _0x3bc1d1=_0x3e74[_0x4d38a4];return _0x3bc1d1;};'use strict';function Trigger(_0x284ef8){this['id']=_0x284ef8['id']||0x0;this['name']=_0x284ef8[_0x43e7('0x0')]||'';this[_0x43e7('0x1')]=_0x284ef8[_0x43e7('0x1')]||'voice';this['status']=_0x284ef8[_0x43e7('0x2')]||![];this['AllConditions']=_0x284ef8[_0x43e7('0x3')]||[];this[_0x43e7('0x4')]=_0x284ef8[_0x43e7('0x4')]||[];this[_0x43e7('0x5')]=_0x284ef8[_0x43e7('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 c3037ef..6e399bf 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 _0x4328=['stateRegistry','defaultuser','exports','active','name','state','unknown','stateTime','registry','indexOf','split','host','port','domain','refresh'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4328,0x7b));var _0x8432=function(_0x51582a,_0x46def1){_0x51582a=_0x51582a-0x0;var _0x184256=_0x4328[_0x51582a];return _0x184256;};'use strict';function Trunk(_0x5b939a){this['id']=_0x5b939a['id']||0x0;this[_0x8432('0x0')]=_0x5b939a[_0x8432('0x0')]||![];this[_0x8432('0x1')]=_0x5b939a[_0x8432('0x1')]||'';this[_0x8432('0x2')]=_0x8432('0x3');this[_0x8432('0x4')]=0x0;this['status']=_0x8432('0x3');this[_0x8432('0x5')]=_0x5b939a[_0x8432('0x5')]&&_0x5b939a[_0x8432('0x5')][_0x8432('0x6')](':')?_0x5b939a[_0x8432('0x5')][_0x8432('0x7')](':')[0x0]:'';this[_0x8432('0x8')]='';this[_0x8432('0x9')]='';this[_0x8432('0xa')]='';this['domainport']='';this[_0x8432('0xb')]='';this[_0x8432('0xc')]=_0x8432('0x3');this['registrationtime']='';this['address']='';this['defaultuser']=_0x5b939a[_0x8432('0xd')]||'';}module[_0x8432('0xe')]=Trunk; \ No newline at end of file +var _0x06f7=['stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','stateTime','status','unknown','registry','indexOf','split','port','domainport','refresh'];(function(_0x4f4b55,_0x31cbd6){var _0x36fbf9=function(_0xe8e44d){while(--_0xe8e44d){_0x4f4b55['push'](_0x4f4b55['shift']());}};_0x36fbf9(++_0x31cbd6);}(_0x06f7,0x148));var _0x706f=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x06f7[_0x934425];return _0x31d596;};'use strict';function Trunk(_0x417297){this['id']=_0x417297['id']||0x0;this[_0x706f('0x0')]=_0x417297[_0x706f('0x0')]||![];this[_0x706f('0x1')]=_0x417297[_0x706f('0x1')]||'';this[_0x706f('0x2')]='unknown';this[_0x706f('0x3')]=0x0;this[_0x706f('0x4')]=_0x706f('0x5');this['registry']=_0x417297['registry']&&_0x417297[_0x706f('0x6')][_0x706f('0x7')](':')?_0x417297[_0x706f('0x6')][_0x706f('0x8')](':')[0x0]:'';this['host']='';this[_0x706f('0x9')]='';this['domain']='';this[_0x706f('0xa')]='';this[_0x706f('0xb')]='';this[_0x706f('0xc')]='unknown';this[_0x706f('0xd')]='';this[_0x706f('0xe')]='';this[_0x706f('0xf')]=_0x417297['defaultuser']||'';}module[_0x706f('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0ea5ccc..96cb78c 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 _0xfb69=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0xfb69,0x161));var _0x9fb6=function(_0x452fff,_0x571831){_0x452fff=_0x452fff-0x0;var _0x705568=_0xfb69[_0x452fff];return _0x705568;};'use strict';function voiceExtension(_0x2ea2b2){this['id']=_0x2ea2b2['id']||0x0;this[_0x9fb6('0x0')]=_0x2ea2b2['exten']||'';this[_0x9fb6('0x1')]=_0x2ea2b2['recordingFormat']||_0x9fb6('0x2');this[_0x9fb6('0x3')]=_0x2ea2b2['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xfbbd=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x1ab641,_0x312e10){var _0x1dd5f7=function(_0x4b3839){while(--_0x4b3839){_0x1ab641['push'](_0x1ab641['shift']());}};_0x1dd5f7(++_0x312e10);}(_0xfbbd,0x9e));var _0xdfbb=function(_0x4b5412,_0x4b6200){_0x4b5412=_0x4b5412-0x0;var _0x2e011b=_0xfbbd[_0x4b5412];return _0x2e011b;};'use strict';function voiceExtension(_0x12d8c3){this['id']=_0x12d8c3['id']||0x0;this[_0xdfbb('0x0')]=_0x12d8c3[_0xdfbb('0x0')]||'';this[_0xdfbb('0x1')]=_0x12d8c3[_0xdfbb('0x1')]||_0xdfbb('0x2');this['mandatoryDisposition']=_0x12d8c3[_0xdfbb('0x3')]||![];}module[_0xdfbb('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 9e92e80..dce5f2c 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 _0x7a54=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','waiting','talking','answered','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x93ce68,_0x39fb24){var _0x4c050=function(_0x4dc674){while(--_0x4dc674){_0x93ce68['push'](_0x93ce68['shift']());}};_0x4c050(++_0x39fb24);}(_0x7a54,0x106));var _0x47a5=function(_0x247239,_0x547d86){_0x247239=_0x247239-0x0;var _0x107555=_0x7a54[_0x247239];return _0x107555;};'use strict';var statusDesc=[_0x47a5('0x0'),_0x47a5('0x1'),_0x47a5('0x2'),'busy',_0x47a5('0x3'),_0x47a5('0x4'),'ringing',_0x47a5('0x5'),_0x47a5('0x6')];var monitorFormat={'wav':_0x47a5('0x7'),'wav49':_0x47a5('0x8'),'gsm':_0x47a5('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x47a5('0xa')};function VoiceQueue(_0x59199c){this['id']=_0x59199c['id']||0x0;this[_0x47a5('0xb')]=_0x59199c[_0x47a5('0xb')]||'';this['monitor_format']=_0x59199c[_0x47a5('0xc')]||'';this['type']=_0x59199c['type']||'inbound';this[_0x47a5('0xd')]=0x0;this[_0x47a5('0xe')]=0x0;this['total']=0x0;this[_0x47a5('0xf')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x47a5('0x10')]=0x0;this[_0x47a5('0x11')]=0x0;this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;this[_0x47a5('0x14')]=0x0;this[_0x47a5('0x15')]=_0x59199c[_0x47a5('0x15')]||![];this['acwTimeout']=_0x59199c[_0x47a5('0x16')]||0xa;this[_0x47a5('0x17')]=_0x59199c[_0x47a5('0x17')]||'no';this[_0x47a5('0x18')]=!![];this[_0x47a5('0x19')]='';this[_0x47a5('0x1a')]=0x0;this[_0x47a5('0x1b')]=0x0;this[_0x47a5('0x1c')]=_0x59199c['dialTimezone']||null;this[_0x47a5('0x1d')]=_0x59199c[_0x47a5('0x1d')]?_0x59199c[_0x47a5('0x1d')]:null;this[_0x47a5('0x1e')]=_0x59199c[_0x47a5('0x1e')];this['dialMethod']=_0x59199c['dialMethod']||_0x47a5('0x1f');this['dialLimitChannel']=_0x59199c['dialLimitChannel']||0x0;this[_0x47a5('0x20')]=_0x59199c[_0x47a5('0x20')]||0x0;this[_0x47a5('0x21')]=_0x59199c[_0x47a5('0x21')]||0x1;this[_0x47a5('0x22')]=_0x59199c[_0x47a5('0x22')]||_0x47a5('0x23');this[_0x47a5('0x24')]=_0x59199c[_0x47a5('0x24')]||0.03;this['dialPredictiveInterval']=_0x59199c[_0x47a5('0x25')]||0x258;this[_0x47a5('0x26')]=_0x59199c['dialOriginateCallerIdName']||_0x47a5('0x27');this[_0x47a5('0x28')]=_0x59199c[_0x47a5('0x28')]||'anonymous';this[_0x47a5('0x29')]=_0x59199c[_0x47a5('0x29')]||0x1e;this[_0x47a5('0x2a')]=_0x59199c[_0x47a5('0x2a')]||'tTxX';this[_0x47a5('0x2b')]=_0x59199c[_0x47a5('0x2b')]||0x3;this['dialQueueProject']=_0x59199c[_0x47a5('0x2c')]||undefined;this[_0x47a5('0x2d')]=_0x59199c[_0x47a5('0x2d')]||0x3;this[_0x47a5('0x2e')]=_0x59199c[_0x47a5('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x59199c['dialBusyMaxRetry']||0x3;this[_0x47a5('0x2f')]=_0x59199c['dialBusyRetryFrequency']||0x96;this[_0x47a5('0x30')]=_0x59199c['dialNoAnswerMaxRetry']||0x3;this[_0x47a5('0x31')]=_0x59199c[_0x47a5('0x31')]||0x96;this[_0x47a5('0x32')]=_0x59199c[_0x47a5('0x32')]||0x3;this[_0x47a5('0x33')]=_0x59199c[_0x47a5('0x33')]||0x96;this[_0x47a5('0x34')]=_0x59199c[_0x47a5('0x34')]||0x3;this[_0x47a5('0x35')]=_0x59199c[_0x47a5('0x35')]||0x96;this[_0x47a5('0x36')]=_0x59199c[_0x47a5('0x36')]||0x3;this[_0x47a5('0x37')]=_0x59199c['dialAbandonedRetryFrequency']||0x96;this[_0x47a5('0x38')]=_0x59199c['dialMachineMaxRetry']||0x3;this[_0x47a5('0x39')]=_0x59199c[_0x47a5('0x39')]||0x96;this[_0x47a5('0x3a')]=_0x59199c['dialAgentRejectMaxRetry']||0x3;this[_0x47a5('0x3b')]=_0x59199c[_0x47a5('0x3b')]||0x96;this[_0x47a5('0x3c')]=_0x59199c[_0x47a5('0x3c')]||0x3;this['dialGlobalMaxRetry']=_0x59199c['dialGlobalMaxRetry']||0x4;this[_0x47a5('0x3d')]=_0x59199c[_0x47a5('0x3d')]?_0x59199c['Trunk']:undefined;this['TrunkBackup']=_0x59199c[_0x47a5('0x3e')]?_0x59199c[_0x47a5('0x3e')]:undefined;this['dialPrefix']=_0x59199c[_0x47a5('0x3f')]||undefined;this['Interval']=_0x59199c[_0x47a5('0x40')]?_0x59199c[_0x47a5('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x59199c['dialOrderByScheduledAt']||_0x47a5('0x41');this['dialRandomLastDigitCallerIdNumber']=_0x59199c[_0x47a5('0x42')]||undefined;this[_0x47a5('0x43')]=_0x59199c[_0x47a5('0x43')]||undefined;this['strategy']=strategy[_0x59199c[_0x47a5('0x44')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0x47a5('0x45')]=_0x59199c['dialAMDActive']||![];this[_0x47a5('0x46')]=_0x59199c['dialAMDInitialSilence'];this[_0x47a5('0x47')]=_0x59199c[_0x47a5('0x47')];this[_0x47a5('0x48')]=_0x59199c[_0x47a5('0x48')];this[_0x47a5('0x49')]=_0x59199c[_0x47a5('0x49')];this[_0x47a5('0x4a')]=_0x59199c[_0x47a5('0x4a')];this[_0x47a5('0x4b')]=_0x59199c['dialAMDBetweenWordsSilence'];this[_0x47a5('0x4c')]=_0x59199c[_0x47a5('0x4c')];this['dialAMDSilenceThreshold']=_0x59199c[_0x47a5('0x4d')];this[_0x47a5('0x4e')]=_0x59199c[_0x47a5('0x4e')];this['outboundRejectCallsDay']=0x0;this[_0x47a5('0x4f')]=0x0;this[_0x47a5('0x50')]=_0x59199c['timeout'];this[_0x47a5('0x51')]=0x0;this[_0x47a5('0x52')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x47a5('0x53')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x47a5('0x54')]=0x0;this[_0x47a5('0x55')]=0x0;this[_0x47a5('0x56')]=0x0;this[_0x47a5('0x57')]=0x0;this[_0x47a5('0x58')]=0x0;this[_0x47a5('0x59')]=0x0;this[_0x47a5('0x5a')]=0x0;this[_0x47a5('0x5b')]=undefined;this[_0x47a5('0x5c')]=undefined;this[_0x47a5('0x5d')]=undefined;this[_0x47a5('0x5e')]=1.05;this[_0x47a5('0x5f')]=0x0;this[_0x47a5('0x60')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x47a5('0x61')]=0x0;this[_0x47a5('0x62')]=0x0;this[_0x47a5('0x63')]=0x0;this[_0x47a5('0x64')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x47a5('0x65')]=_0x59199c['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x59199c['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x47a5('0x66')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x47a5('0x67')]=0x0;this[_0x47a5('0x68')]=0x0;this[_0x47a5('0x69')]=0x0;this['erlangBusyFactor']=0x0;this[_0x47a5('0x6a')]=_0x59199c[_0x47a5('0x6a')]||0x1e;this['dialRecallInQueue']=_0x59199c['dialRecallInQueue']||![];this[_0x47a5('0x6b')]=_0x59199c['dialQueueProject2']||undefined;this[_0x47a5('0x6c')]=_0x59199c[_0x47a5('0x6c')]||![];this[_0x47a5('0x6d')]=_0x59199c[_0x47a5('0x6d')]||![];this[_0x47a5('0xc')]=monitorFormat[_0x59199c[_0x47a5('0xc')]]?monitorFormat[_0x59199c[_0x47a5('0xc')]]:undefined;this[_0x47a5('0x6e')]=_0x59199c[_0x47a5('0x6e')]||![];this[_0x47a5('0x6f')]=_0x59199c[_0x47a5('0x6f')]?_0x59199c[_0x47a5('0x6f')]:undefined;}module[_0x47a5('0x70')]=VoiceQueue; \ No newline at end of file +var _0xb10b=['Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','sumDuration','sumHoldTime','sumBillable','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix'];(function(_0x2fe689,_0x5794e5){var _0x35ea44=function(_0x51b9d6){while(--_0x51b9d6){_0x2fe689['push'](_0x2fe689['shift']());}};_0x35ea44(++_0x5794e5);}(_0xb10b,0x12a));var _0xbb10=function(_0x21d532,_0x4552a4){_0x21d532=_0x21d532-0x0;var _0x37bda1=_0xb10b[_0x21d532];return _0x37bda1;};'use strict';var statusDesc=[_0xbb10('0x0'),'not_inuse',_0xbb10('0x1'),_0xbb10('0x2'),_0xbb10('0x3'),'unavailable',_0xbb10('0x4'),_0xbb10('0x5'),_0xbb10('0x6')];var monitorFormat={'wav':_0xbb10('0x7'),'wav49':_0xbb10('0x8'),'gsm':_0xbb10('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xbb10('0xa')};function VoiceQueue(_0x3cdd53){this['id']=_0x3cdd53['id']||0x0;this['name']=_0x3cdd53[_0xbb10('0xb')]||'';this[_0xbb10('0xc')]=_0x3cdd53[_0xbb10('0xc')]||'';this[_0xbb10('0xd')]=_0x3cdd53[_0xbb10('0xd')]||_0xbb10('0xe');this[_0xbb10('0xf')]=0x0;this[_0xbb10('0x10')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0xbb10('0x11')]=0x0;this[_0xbb10('0x12')]=0x0;this[_0xbb10('0x13')]=0x0;this['unmanaged']=0x0;this[_0xbb10('0x14')]=0x0;this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;this[_0xbb10('0x16')]=_0x3cdd53[_0xbb10('0x16')]||![];this[_0xbb10('0x17')]=_0x3cdd53[_0xbb10('0x17')]||0xa;this[_0xbb10('0x18')]=_0x3cdd53['autopause']||'no';this[_0xbb10('0x19')]=!![];this[_0xbb10('0x1a')]='';this[_0xbb10('0x1b')]=0x0;this[_0xbb10('0x1c')]=0x0;this[_0xbb10('0x1d')]=_0x3cdd53[_0xbb10('0x1d')]||null;this[_0xbb10('0x1e')]=_0x3cdd53[_0xbb10('0x1e')]?_0x3cdd53[_0xbb10('0x1e')]:null;this[_0xbb10('0x1f')]=_0x3cdd53['dialActive'];this[_0xbb10('0x20')]=_0x3cdd53[_0xbb10('0x20')]||_0xbb10('0x21');this[_0xbb10('0x22')]=_0x3cdd53[_0xbb10('0x22')]||0x0;this[_0xbb10('0x23')]=_0x3cdd53[_0xbb10('0x23')]||0x0;this[_0xbb10('0x24')]=_0x3cdd53[_0xbb10('0x24')]||0x1;this[_0xbb10('0x25')]=_0x3cdd53['dialPredictiveOptimization']||_0xbb10('0x26');this[_0xbb10('0x27')]=_0x3cdd53[_0xbb10('0x27')]||0.03;this[_0xbb10('0x28')]=_0x3cdd53[_0xbb10('0x28')]||0x258;this[_0xbb10('0x29')]=_0x3cdd53['dialOriginateCallerIdName']||_0xbb10('0x2a');this[_0xbb10('0x2b')]=_0x3cdd53['dialOriginateCallerIdNumber']||'anonymous';this[_0xbb10('0x2c')]=_0x3cdd53[_0xbb10('0x2c')]||0x1e;this[_0xbb10('0x2d')]=_0x3cdd53[_0xbb10('0x2d')]||_0xbb10('0x2e');this[_0xbb10('0x2f')]=_0x3cdd53[_0xbb10('0x2f')]||0x3;this[_0xbb10('0x30')]=_0x3cdd53[_0xbb10('0x30')]||undefined;this[_0xbb10('0x31')]=_0x3cdd53[_0xbb10('0x31')]||0x3;this[_0xbb10('0x32')]=_0x3cdd53['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x3cdd53['dialBusyMaxRetry']||0x3;this[_0xbb10('0x33')]=_0x3cdd53[_0xbb10('0x33')]||0x96;this[_0xbb10('0x34')]=_0x3cdd53['dialNoAnswerMaxRetry']||0x3;this[_0xbb10('0x35')]=_0x3cdd53[_0xbb10('0x35')]||0x96;this[_0xbb10('0x36')]=_0x3cdd53[_0xbb10('0x36')]||0x3;this[_0xbb10('0x37')]=_0x3cdd53[_0xbb10('0x37')]||0x96;this[_0xbb10('0x38')]=_0x3cdd53['dialDropMaxRetry']||0x3;this[_0xbb10('0x39')]=_0x3cdd53[_0xbb10('0x39')]||0x96;this[_0xbb10('0x3a')]=_0x3cdd53[_0xbb10('0x3a')]||0x3;this[_0xbb10('0x3b')]=_0x3cdd53[_0xbb10('0x3b')]||0x96;this['dialMachineMaxRetry']=_0x3cdd53[_0xbb10('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x3cdd53[_0xbb10('0x3d')]||0x96;this['dialAgentRejectMaxRetry']=_0x3cdd53[_0xbb10('0x3e')]||0x3;this[_0xbb10('0x3f')]=_0x3cdd53[_0xbb10('0x3f')]||0x96;this['callAdditionalPhoneAfterMin']=_0x3cdd53['callAdditionalPhoneAfterMin']||0x3;this[_0xbb10('0x40')]=_0x3cdd53[_0xbb10('0x40')]||0x4;this['Trunk']=_0x3cdd53[_0xbb10('0x41')]?_0x3cdd53[_0xbb10('0x41')]:undefined;this[_0xbb10('0x42')]=_0x3cdd53[_0xbb10('0x42')]?_0x3cdd53[_0xbb10('0x42')]:undefined;this[_0xbb10('0x43')]=_0x3cdd53[_0xbb10('0x43')]||undefined;this['Interval']=_0x3cdd53[_0xbb10('0x44')]?_0x3cdd53[_0xbb10('0x44')]:undefined;this[_0xbb10('0x45')]=_0x3cdd53[_0xbb10('0x45')]||_0xbb10('0x46');this[_0xbb10('0x47')]=_0x3cdd53[_0xbb10('0x47')]||undefined;this[_0xbb10('0x48')]=_0x3cdd53[_0xbb10('0x48')]||undefined;this['strategy']=strategy[_0x3cdd53[_0xbb10('0x49')]]||_0xbb10('0x4a');this[_0xbb10('0x4b')]=!![];this[_0xbb10('0x4c')]=_0x3cdd53['dialAMDActive']||![];this[_0xbb10('0x4d')]=_0x3cdd53['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x3cdd53[_0xbb10('0x4e')];this[_0xbb10('0x4f')]=_0x3cdd53[_0xbb10('0x4f')];this[_0xbb10('0x50')]=_0x3cdd53[_0xbb10('0x50')];this[_0xbb10('0x51')]=_0x3cdd53['dialAMDMinWordLength'];this[_0xbb10('0x52')]=_0x3cdd53[_0xbb10('0x52')];this['dialAMDMaximumNumberOfWords']=_0x3cdd53['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x3cdd53[_0xbb10('0x53')];this[_0xbb10('0x54')]=_0x3cdd53[_0xbb10('0x54')];this['outboundRejectCallsDay']=0x0;this[_0xbb10('0x55')]=0x0;this[_0xbb10('0x56')]=_0x3cdd53[_0xbb10('0x56')];this['outboundAnswerCallsDay']=0x0;this[_0xbb10('0x57')]=0x0;this[_0xbb10('0x58')]=0x0;this[_0xbb10('0x59')]=0x0;this[_0xbb10('0x5a')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xbb10('0x5b')]=0x0;this[_0xbb10('0x5c')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xbb10('0x5d')]=0x0;this[_0xbb10('0x5e')]=0x0;this[_0xbb10('0x5f')]=0x0;this[_0xbb10('0x60')]=0x0;this[_0xbb10('0x61')]=0x0;this[_0xbb10('0x62')]=undefined;this['startPredictive']=undefined;this[_0xbb10('0x63')]=undefined;this[_0xbb10('0x64')]=1.05;this[_0xbb10('0x65')]=0x0;this[_0xbb10('0x66')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xbb10('0x67')]=0x0;this[_0xbb10('0x68')]=0x0;this[_0xbb10('0x69')]=0x0;this[_0xbb10('0x6a')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xbb10('0x6b')]=_0x3cdd53[_0xbb10('0x6c')]||0x14;this['predictiveIntervalMinThreshold']=_0x3cdd53['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xbb10('0x6d')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xbb10('0x6e')]=0x1;this[_0xbb10('0x6f')]=0x0;this['erlangCallToSecond']=0x0;this[_0xbb10('0x70')]=0x0;this[_0xbb10('0x71')]=0x0;this[_0xbb10('0x72')]=_0x3cdd53['dialRecallMeTimeout']||0x1e;this[_0xbb10('0x73')]=_0x3cdd53[_0xbb10('0x73')]||![];this[_0xbb10('0x74')]=_0x3cdd53[_0xbb10('0x74')]||undefined;this[_0xbb10('0x75')]=_0x3cdd53[_0xbb10('0x75')]||![];this[_0xbb10('0x76')]=_0x3cdd53[_0xbb10('0x76')]||![];this[_0xbb10('0xc')]=monitorFormat[_0x3cdd53[_0xbb10('0xc')]]?monitorFormat[_0x3cdd53[_0xbb10('0xc')]]:undefined;this[_0xbb10('0x77')]=_0x3cdd53['mandatoryDisposition']||![];this[_0xbb10('0x78')]=_0x3cdd53[_0xbb10('0x78')]?_0x3cdd53['mandatoryDispositionPause']:undefined;}module[_0xbb10('0x79')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index e9215a6..51c40d8 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 _0xde68=['name','username','accessKey','remoteUri','Configurations'];(function(_0x4dd7d4,_0x1e6fd1){var _0x2f8543=function(_0x2874d3){while(--_0x2874d3){_0x4dd7d4['push'](_0x4dd7d4['shift']());}};_0x2f8543(++_0x1e6fd1);}(_0xde68,0x1bd));var _0x8de6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde68[_0x2641f9];return _0x585741;};'use strict';function VtigerAccount(_0x315714){this['id']=_0x315714['id']||0x0;this[_0x8de6('0x0')]=_0x315714[_0x8de6('0x0')]||'';this[_0x8de6('0x1')]=_0x315714[_0x8de6('0x1')]||'';this['accessKey']=_0x315714[_0x8de6('0x2')]||'';this[_0x8de6('0x3')]=_0x315714[_0x8de6('0x3')]||'';this['serverUrl']=_0x315714['serverUrl']||'';this[_0x8de6('0x4')]=_0x315714['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x508c=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x2360a3,_0xe03318){var _0x3dbeef=function(_0x12101c){while(--_0x12101c){_0x2360a3['push'](_0x2360a3['shift']());}};_0x3dbeef(++_0xe03318);}(_0x508c,0x164));var _0xc508=function(_0x18a536,_0x2acb01){_0x18a536=_0x18a536-0x0;var _0x5bbf23=_0x508c[_0x18a536];return _0x5bbf23;};'use strict';function VtigerAccount(_0x2aff9c){this['id']=_0x2aff9c['id']||0x0;this[_0xc508('0x0')]=_0x2aff9c[_0xc508('0x0')]||'';this[_0xc508('0x1')]=_0x2aff9c[_0xc508('0x1')]||'';this['accessKey']=_0x2aff9c[_0xc508('0x2')]||'';this[_0xc508('0x3')]=_0x2aff9c['remoteUri']||'';this[_0xc508('0x4')]=_0x2aff9c['serverUrl']||'';this['Configurations']=_0x2aff9c[_0xc508('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 3686d2c..6fb78ee 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 _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x1865b8,_0x2ded7e){_0x1865b8=_0x1865b8-0x0;var _0x58c11e=_0xdb28[_0x1865b8];return _0x58c11e;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x586ea6,_0x47a10e){_0x586ea6=_0x586ea6-0x0;var _0x4ca5b1=_0xdb28[_0x586ea6];return _0x4ca5b1;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index ce573f9..d7bccd4 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 _0x5eed=['clientId','clientSecret','serverUrl','code','refreshToken','name','description','host','zone'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x5eed,0x10a));var _0xd5ee=function(_0x35d3c4,_0x12d587){_0x35d3c4=_0x35d3c4-0x0;var _0x59981d=_0x5eed[_0x35d3c4];return _0x59981d;};'use strict';function ZohoAccount(_0x5d66a1){this['id']=_0x5d66a1['id']||0x0;this[_0xd5ee('0x0')]=_0x5d66a1[_0xd5ee('0x0')]||'';this[_0xd5ee('0x1')]=_0x5d66a1[_0xd5ee('0x1')]||'';this[_0xd5ee('0x2')]=_0x5d66a1[_0xd5ee('0x2')]||'';this[_0xd5ee('0x3')]=_0x5d66a1[_0xd5ee('0x3')]||'';this[_0xd5ee('0x4')]=_0x5d66a1['clientId']||'';this[_0xd5ee('0x5')]=_0x5d66a1[_0xd5ee('0x5')]||'';this[_0xd5ee('0x6')]=_0x5d66a1[_0xd5ee('0x6')]||'';this[_0xd5ee('0x7')]=_0x5d66a1[_0xd5ee('0x7')]||'';this[_0xd5ee('0x8')]=_0x5d66a1[_0xd5ee('0x8')]||'';this['Configurations']=_0x5d66a1['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x6db4=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x5cae92,_0x1a7006){var _0x491adc=function(_0xe75535){while(--_0xe75535){_0x5cae92['push'](_0x5cae92['shift']());}};_0x491adc(++_0x1a7006);}(_0x6db4,0x111));var _0x46db=function(_0x53c215,_0x52bedd){_0x53c215=_0x53c215-0x0;var _0x3d58cf=_0x6db4[_0x53c215];return _0x3d58cf;};'use strict';function ZohoAccount(_0x4d2803){this['id']=_0x4d2803['id']||0x0;this[_0x46db('0x0')]=_0x4d2803[_0x46db('0x0')]||'';this[_0x46db('0x1')]=_0x4d2803[_0x46db('0x1')]||'';this[_0x46db('0x2')]=_0x4d2803[_0x46db('0x2')]||'';this['zone']=_0x4d2803[_0x46db('0x3')]||'';this[_0x46db('0x4')]=_0x4d2803[_0x46db('0x4')]||'';this[_0x46db('0x5')]=_0x4d2803[_0x46db('0x5')]||'';this[_0x46db('0x6')]=_0x4d2803[_0x46db('0x6')]||'';this['code']=_0x4d2803[_0x46db('0x7')]||'';this[_0x46db('0x8')]=_0x4d2803[_0x46db('0x8')]||'';this[_0x46db('0x9')]=_0x4d2803[_0x46db('0x9')]||{};}module[_0x46db('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 1399bbd..b76d064 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 _0xc8d7=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','number','exports','util','lodash','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','Agent','name','channelAgent','membername','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0x47042b,_0x33c1d7){var _0x2904f1=function(_0x4b94f5){while(--_0x4b94f5){_0x47042b['push'](_0x47042b['shift']());}};_0x2904f1(++_0x33c1d7);}(_0xc8d7,0x168));var _0x7c8d=function(_0x2c3d63,_0x333486){_0x2c3d63=_0x2c3d63-0x0;var _0x48c465=_0xc8d7[_0x2c3d63];return _0x48c465;};'use strict';var util=require(_0x7c8d('0x0'));var _=require(_0x7c8d('0x1'));var moment=require('moment');function checkNameSurname(_0x447b9b,_0x36e66e,_0x60d273){var _0x28fa71='';if(!_[_0x7c8d('0x2')](_0x36e66e)&&_0x7c8d('0x3')===typeof _0x36e66e){_0x28fa71+=_0x36e66e;}if(!_[_0x7c8d('0x2')](_0x60d273)&&_0x7c8d('0x3')===typeof _0x60d273){_0x28fa71+='\x20'+_0x60d273;}if(_0x28fa71!==''){return _0x28fa71;}return _0x447b9b;}function Action(_0x1b4c4a,_0x182003,_0x8df957,_0x3ea2e8,_0x446422){this[_0x7c8d('0x4')]=_0x8df957||undefined;this[_0x7c8d('0x5')]=_0x1b4c4a['id'];this[_0x7c8d('0x6')]=_0x182003['name'];this[_0x7c8d('0x7')]=_0x182003[_0x7c8d('0x7')];this[_0x7c8d('0x8')]=_0x7c8d('0x6');this[_0x7c8d('0x9')]=![];this['membername']=_[_0x7c8d('0x2')](_0x1b4c4a[_0x7c8d('0xa')])?undefined:_0x1b4c4a['Agent'][_0x7c8d('0xb')];this[_0x7c8d('0xc')]=this[_0x7c8d('0xd')]?util[_0x7c8d('0xe')](_0x7c8d('0xf'),this['membername']):_0x3ea2e8||undefined;this[_0x7c8d('0x10')]=checkNameSurname(_0x1b4c4a[_0x7c8d('0x11')]['phone'],_0x1b4c4a['Contact']['firstName'],_0x1b4c4a['Contact'][_0x7c8d('0x12')]);this[_0x7c8d('0x13')]=_0x1b4c4a[_0x7c8d('0x13')]||![];this[_0x7c8d('0x14')]=_0x1b4c4a['phone'];this[_0x7c8d('0x15')]=_0x1b4c4a['scheduledat'];this[_0x7c8d('0x16')]=_0x1b4c4a[_0x7c8d('0x16')]||0x0;this['countcongestionretry']=_0x1b4c4a[_0x7c8d('0x17')]||0x0;this[_0x7c8d('0x18')]=_0x1b4c4a[_0x7c8d('0x18')]||0x0;this[_0x7c8d('0x19')]=(_0x1b4c4a['countbusyretry']||0x0)+(_0x1b4c4a[_0x7c8d('0x17')]||0x0)+(_0x1b4c4a['countnoanswerretry']||0x0)+(_0x1b4c4a['countnosuchnumberretry']||0x0)+(_0x1b4c4a[_0x7c8d('0x1a')]||0x0)+(_0x1b4c4a[_0x7c8d('0x1b')]||0x0)+(_0x1b4c4a[_0x7c8d('0x1c')]||0x0)+(_0x1b4c4a[_0x7c8d('0x1d')]||0x0);this[_0x7c8d('0x1e')]=_0x1b4c4a['countnosuchnumberretry']||0x0;this[_0x7c8d('0x1a')]=_0x1b4c4a[_0x7c8d('0x1a')]||0x0;this[_0x7c8d('0x1b')]=_0x1b4c4a['countabandonedretry']||0x0;this[_0x7c8d('0x1c')]=_0x1b4c4a['countmachineretry']||0x0;this[_0x7c8d('0x1d')]=_0x1b4c4a[_0x7c8d('0x1d')]||0x0;this[_0x7c8d('0x1f')]=_0x1b4c4a['callback'];this[_0x7c8d('0x20')]=_0x1b4c4a[_0x7c8d('0x20')];this[_0x7c8d('0x21')]=_0x1b4c4a['callbackat'];this['recallme']=_0x1b4c4a[_0x7c8d('0x22')];this[_0x7c8d('0x23')]=_0x1b4c4a[_0x7c8d('0x23')];this[_0x7c8d('0x24')]=_0x1b4c4a[_0x7c8d('0x24')];this[_0x7c8d('0x25')]=_[_0x7c8d('0x2')](_0x1b4c4a[_0x7c8d('0xa')])?_0x1b4c4a[_0x7c8d('0x25')]:_0x1b4c4a[_0x7c8d('0xa')]['id'];this[_0x7c8d('0x26')]=_0x1b4c4a[_0x7c8d('0x26')];this[_0x7c8d('0x27')]='';this['originatecalleridname']='';}Action[_0x7c8d('0x28')]['getCaller']=function(){return util[_0x7c8d('0xe')]('\x22%s\x22\x20<%s>',this[_0x7c8d('0x10')],this[_0x7c8d('0x29')]);};module[_0x7c8d('0x2a')]=Action; \ No newline at end of file +var _0x91b6=['name','type','campaigntype','queue','membername','Agent','channelAgent','calleridname','Contact','firstName','lastName','active','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','number','exports','util','lodash','moment','isNil','string','idContact'];(function(_0x4f839f,_0x292796){var _0x598e94=function(_0x51ecff){while(--_0x51ecff){_0x4f839f['push'](_0x4f839f['shift']());}};_0x598e94(++_0x292796);}(_0x91b6,0xc2));var _0x691b=function(_0x49194a,_0x4ac29e){_0x49194a=_0x49194a-0x0;var _0x277427=_0x91b6[_0x49194a];return _0x277427;};'use strict';var util=require(_0x691b('0x0'));var _=require(_0x691b('0x1'));var moment=require(_0x691b('0x2'));function checkNameSurname(_0x35711c,_0x5c39f7,_0x98e796){var _0x447ce1='';if(!_[_0x691b('0x3')](_0x5c39f7)&&_0x691b('0x4')===typeof _0x5c39f7){_0x447ce1+=_0x5c39f7;}if(!_[_0x691b('0x3')](_0x98e796)&&_0x691b('0x4')===typeof _0x98e796){_0x447ce1+='\x20'+_0x98e796;}if(_0x447ce1!==''){return _0x447ce1;}return _0x35711c;}function Action(_0x42c6db,_0x56241e,_0x3c26a0,_0x4fa95b,_0x25e3d3){this['uniqueid']=_0x3c26a0||undefined;this[_0x691b('0x5')]=_0x42c6db['id'];this['queue']=_0x56241e[_0x691b('0x6')];this[_0x691b('0x7')]=_0x56241e[_0x691b('0x7')];this[_0x691b('0x8')]=_0x691b('0x9');this['dialAnswer']=![];this[_0x691b('0xa')]=_[_0x691b('0x3')](_0x42c6db[_0x691b('0xb')])?undefined:_0x42c6db[_0x691b('0xb')][_0x691b('0x6')];this[_0x691b('0xc')]=this[_0x691b('0xa')]?util['format']('SIP/%s',this[_0x691b('0xa')]):_0x4fa95b||undefined;this[_0x691b('0xd')]=checkNameSurname(_0x42c6db['Contact']['phone'],_0x42c6db[_0x691b('0xe')][_0x691b('0xf')],_0x42c6db['Contact'][_0x691b('0x10')]);this['active']=_0x42c6db[_0x691b('0x11')]||![];this['calleridnum']=_0x42c6db[_0x691b('0x12')];this[_0x691b('0x13')]=_0x42c6db[_0x691b('0x13')];this[_0x691b('0x14')]=_0x42c6db[_0x691b('0x14')]||0x0;this[_0x691b('0x15')]=_0x42c6db['countcongestionretry']||0x0;this[_0x691b('0x16')]=_0x42c6db[_0x691b('0x16')]||0x0;this[_0x691b('0x17')]=(_0x42c6db[_0x691b('0x14')]||0x0)+(_0x42c6db['countcongestionretry']||0x0)+(_0x42c6db[_0x691b('0x16')]||0x0)+(_0x42c6db[_0x691b('0x18')]||0x0)+(_0x42c6db[_0x691b('0x19')]||0x0)+(_0x42c6db['countabandonedretry']||0x0)+(_0x42c6db['countmachineretry']||0x0)+(_0x42c6db[_0x691b('0x1a')]||0x0);this[_0x691b('0x18')]=_0x42c6db[_0x691b('0x18')]||0x0;this[_0x691b('0x19')]=_0x42c6db[_0x691b('0x19')]||0x0;this[_0x691b('0x1b')]=_0x42c6db[_0x691b('0x1b')]||0x0;this[_0x691b('0x1c')]=_0x42c6db[_0x691b('0x1c')]||0x0;this['countagentrejectretry']=_0x42c6db[_0x691b('0x1a')]||0x0;this[_0x691b('0x1d')]=_0x42c6db[_0x691b('0x1d')];this['callbackuniqueid']=_0x42c6db[_0x691b('0x1e')];this[_0x691b('0x1f')]=_0x42c6db[_0x691b('0x1f')];this['recallme']=_0x42c6db['recallme'];this[_0x691b('0x20')]=_0x42c6db[_0x691b('0x20')];this[_0x691b('0x21')]=_0x42c6db[_0x691b('0x21')];this['UserId']=_[_0x691b('0x3')](_0x42c6db[_0x691b('0xb')])?_0x42c6db[_0x691b('0x22')]:_0x42c6db[_0x691b('0xb')]['id'];this[_0x691b('0x23')]=_0x42c6db[_0x691b('0x23')];this[_0x691b('0x24')]='';this['originatecalleridname']='';}Action['prototype'][_0x691b('0x25')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x691b('0xd')],this[_0x691b('0x26')]);};module[_0x691b('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 922795a..a8aa35e 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 _0xaefa=['congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer]','destlinkedid','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialCutDigit','trim','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','response','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','dialQueueProject','transfer','reason','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','localhost','socket.io-emitter','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','dialend','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','emit','outbound','name','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','stringify','md5','format','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','prototype','loopCampaigns','syncCampaigns','clockClearZombieChannels','hasOwnProperty','setMessage','recallMe','clearZombieChannel','isNil','info','Queue','originated:\x20','queue','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','Action','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','size','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','dialBusyMaxRetry','countnoanswerretry','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion'];(function(_0x3cb9f7,_0x12f280){var _0x172b2b=function(_0x277a36){while(--_0x277a36){_0x3cb9f7['push'](_0x3cb9f7['shift']());}};_0x172b2b(++_0x12f280);}(_0xaefa,0x1ce));var _0xaaef=function(_0x4e31bc,_0x5f25d1){_0x4e31bc=_0x4e31bc-0x0;var _0x2e6944=_0xaefa[_0x4e31bc];return _0x2e6944;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require('md5');var Redis=require(_0xaaef('0x0'));var config=require(_0xaaef('0x1'));var logger=require(_0xaaef('0x2'))(_0xaaef('0x3'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0xaaef('0x4'));var rpcDb=require(_0xaaef('0x5'));var cmHopperAdditionalPhone=require(_0xaaef('0x6'));var Action=require(_0xaaef('0x7'));var ut=require(_0xaaef('0x8'));config[_0xaaef('0x9')]=_['defaults'](config['redis'],{'host':_0xaaef('0xa'),'port':0x18eb});var io=require(_0xaaef('0xb'))(new Redis(config[_0xaaef('0x9')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x4e698a){this[_0xaaef('0xc')]=this['tail']?this[_0xaaef('0xc')][_0xaaef('0xd')](_0x4e698a):_0x4e698a();};function Preview(_0x40f492){this[_0xaaef('0xe')]=new Sequence();this[_0xaaef('0xf')]=_0x40f492[_0xaaef('0x10')];this[_0xaaef('0x11')]=_0x40f492[_0xaaef('0x11')];this[_0xaaef('0x12')]={};this['agents']=_0x40f492[_0xaaef('0x13')];this['clockClearZombieChannels']=0x0;ami['on'](_0xaaef('0x14'),this[_0xaaef('0x15')][_0xaaef('0x16')](this));ami['on'](_0xaaef('0x17'),this['syncHangup'][_0xaaef('0x16')](this));ami['on'](_0xaaef('0x18'),this['syncHangupRequest'][_0xaaef('0x16')](this));ami['on'](_0xaaef('0x19'),this[_0xaaef('0x1a')][_0xaaef('0x16')](this));ami['on'](_0xaaef('0x1b'),this['syncNewExten'][_0xaaef('0x16')](this));ami['on']('varset',this[_0xaaef('0x1c')][_0xaaef('0x16')](this));ami['on'](_0xaaef('0x1d'),this[_0xaaef('0x1e')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xaaef('0x16')](this));this['loopCampaigns'](this[_0xaaef('0xf')]);}function emit(_0x41c4b7,_0x3560e1,_0x3443ef){io['to'](_0x41c4b7)[_0xaaef('0x1f')](_0x3560e1,_0x3443ef);}function emitCampaignPreview(_0x28e710){if(_0x28e710['type']===_0xaaef('0x20')){var _0x3e5ef1={'id':_0x28e710['id'],'name':_0x28e710[_0xaaef('0x21')],'strategy':_0x28e710['strategy'],'answered':_0x28e710[_0xaaef('0x22')],'available':_0x28e710[_0xaaef('0x23')],'loggedIn':_0x28e710[_0xaaef('0x24')],'pTalking':_0x28e710[_0xaaef('0x25')],'sumBillable':_0x28e710[_0xaaef('0x26')],'sumDuration':_0x28e710['sumDuration'],'sumHoldTime':_0x28e710[_0xaaef('0x27')]||0x0,'talking':_0x28e710[_0xaaef('0x28')],'total':_0x28e710[_0xaaef('0x29')],'type':_0x28e710[_0xaaef('0x2a')],'unmanaged':_0x28e710[_0xaaef('0x2b')],'abandoned':_0x28e710[_0xaaef('0x2c')],'waiting':_0x28e710[_0xaaef('0x2d')],'loggedInDb':_0x28e710['loggedInDb'],'dialActive':_0x28e710[_0xaaef('0x2e')],'dialMethod':_0x28e710[_0xaaef('0x2f')],'dialOriginateCallerIdName':_0x28e710[_0xaaef('0x30')],'dialOriginateCallerIdNumber':_0x28e710[_0xaaef('0x31')],'dialOriginateTimeout':_0x28e710[_0xaaef('0x32')],'dialPrefix':_0x28e710[_0xaaef('0x33')],'outboundAnswerAgiCallsDay':_0x28e710['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x28e710[_0xaaef('0x34')],'outboundBlacklistCallsDay':_0x28e710[_0xaaef('0x35')],'outboundBusyCallsDay':_0x28e710[_0xaaef('0x36')],'outboundCongestionCallsDay':_0x28e710['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x28e710['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x28e710[_0xaaef('0x37')],'outboundDropCallsDayTimeout':_0x28e710[_0xaaef('0x38')],'outboundNoAnswerCallsDay':_0x28e710[_0xaaef('0x39')],'outboundNoSuchCallsDay':_0x28e710[_0xaaef('0x3a')],'outboundOriginateFailureCallsDay':_0x28e710[_0xaaef('0x3b')],'outboundReCallsDay':_0x28e710[_0xaaef('0x3c')],'outboundRejectCallsDay':_0x28e710[_0xaaef('0x3d')],'outboundUnknownCallsDay':_0x28e710[_0xaaef('0x3e')],'outboundAbandonedCallsDay':_0x28e710[_0xaaef('0x3f')],'predictiveIntervalAnsweredCalls':_0x28e710[_0xaaef('0x40')],'predictiveIntervalAvgHoldtime':_0x28e710['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x28e710['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x28e710['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x28e710[_0xaaef('0x41')],'predictiveIntervalErlangCalls':_0x28e710[_0xaaef('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x28e710[_0xaaef('0x43')],'predictiveIntervalHitRate':_0x28e710[_0xaaef('0x44')],'predictiveIntervalMultiplicativeFactor':_0x28e710[_0xaaef('0x45')],'predictiveIntervalPauses':_0x28e710['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x28e710[_0xaaef('0x46')],'predictiveIntervalTotalCalls':_0x28e710[_0xaaef('0x47')],'message':_0x28e710[_0xaaef('0x48')],'originated':_0x28e710[_0xaaef('0x49')],'erlangCalls':_0x28e710[_0xaaef('0x4a')],'erlangCallToSecond':_0x28e710[_0xaaef('0x4b')],'erlangAbandonmentRate':_0x28e710[_0xaaef('0x4c')],'erlangBusyFactor':_0x28e710[_0xaaef('0x4d')],'startPredictive':_0x28e710[_0xaaef('0x4e')],'startProgressive':_0x28e710[_0xaaef('0x4f')]};if(_0x28e710[_0xaaef('0x50')]){_0x3e5ef1['Trunk']={'id':_0x28e710['Trunk']['id'],'name':_0x28e710[_0xaaef('0x50')][_0xaaef('0x21')],'active':_0x28e710[_0xaaef('0x50')]['active'],'callerid':_0x28e710[_0xaaef('0x50')]['callerid']};}if(_0x28e710[_0xaaef('0x51')]){_0x3e5ef1[_0xaaef('0x51')]={'id':_0x28e710[_0xaaef('0x51')]['id'],'name':_0x28e710[_0xaaef('0x51')][_0xaaef('0x21')]};}var _0x263727=md5(JSON[_0xaaef('0x52')](_0x3e5ef1));if(_0x28e710['md5']!==_0x263727){_0x28e710[_0xaaef('0x53')]=_0x263727;emit(util[_0xaaef('0x54')]('voice:queue:%s',_0x3e5ef1[_0xaaef('0x21')]),_0xaaef('0x55'),_0x3e5ef1);}}}function emitVoiceQueueChannelRemove(_0x4deaf0){logger['info'](_0xaaef('0x56'),JSON[_0xaaef('0x52')](_0x4deaf0));emit(util[_0xaaef('0x54')]('voice:queue:%s',_0x4deaf0[_0xaaef('0x21')]),_0xaaef('0x57'),_0x4deaf0);io[_0xaaef('0x1f')](_0xaaef('0x58'),_0x4deaf0);}function notSendMessagesQueue(_0x4c7b25){if(_0x4c7b25[_0xaaef('0x59')]){if(_0x4c7b25[_0xaaef('0x49')]===0x0&&_0x4c7b25[_0xaaef('0x25')]===0x0){_0x4c7b25[_0xaaef('0x59')]=![];_0x4c7b25['available']=0x0;_0x4c7b25[_0xaaef('0x5a')]=0x0;_0x4c7b25['message']=_0xaaef('0x5b');ut[_0xaaef('0x5c')](_0xaaef('0x5d'),_0x4c7b25[_0xaaef('0x21')]+_0xaaef('0x5e'));}else{_0x4c7b25[_0xaaef('0x48')]=_0xaaef('0x5f');ut[_0xaaef('0x5c')](_0xaaef('0x5d'),_0x4c7b25[_0xaaef('0x21')]+'\x20is\x20disactive');}emitCampaignPreview(_0x4c7b25);}}Preview[_0xaaef('0x60')][_0xaaef('0x61')]=function(){var _0x434981=this;setInterval(function(){_0x434981[_0xaaef('0x62')]();},0x7cf);};Preview[_0xaaef('0x60')]['syncCampaigns']=function(){var _0x3d4aaf=this[_0xaaef('0xf')];this[_0xaaef('0x63')]+=0x1;for(var _0x57cce4 in _0x3d4aaf){if(_0x3d4aaf[_0xaaef('0x64')](_0x57cce4)&&(_0x3d4aaf[_0x57cce4][_0xaaef('0x2f')]===_0xaaef('0x3')||_0x3d4aaf[_0x57cce4]['dialMethod']==='booked')&&_0x3d4aaf[_0x57cce4]['type']===_0xaaef('0x20')){if(this[_0xaaef('0x63')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x3d4aaf[_0xaaef('0x64')](_0x57cce4)&&_0x3d4aaf[_0x57cce4][_0xaaef('0x2f')]===_0xaaef('0x3')&&_0x3d4aaf[_0x57cce4][_0xaaef('0x2a')]===_0xaaef('0x20')){if(_0x3d4aaf[_0x57cce4][_0xaaef('0x2e')]){this[_0xaaef('0x65')](_0x3d4aaf[_0x57cce4]);this[_0xaaef('0x66')](_0x3d4aaf[_0x57cce4]);}else{notSendMessagesQueue(_0x3d4aaf[_0x57cce4]);}}}};Preview[_0xaaef('0x60')][_0xaaef('0x67')]=function(_0x20a07b){var _0x101ff2=this;this[_0xaaef('0xe')]['enqueue'](function(){if(!_[_0xaaef('0x68')](_0x101ff2[_0xaaef('0x12')][_0x20a07b])){loggerAction[_0xaaef('0x69')]('[clearZombieChannels][talking]',_0x20a07b,_0xaaef('0x6a'),_0x101ff2[_0xaaef('0x12')][_0x20a07b]['queue'],_0xaaef('0x6b'),JSON[_0xaaef('0x52')](_0x101ff2['campaignsPreview'][_0x101ff2[_0xaaef('0x12')][_0x20a07b][_0xaaef('0x6c')]]['originated']),_0xaaef('0x6d'),JSON[_0xaaef('0x52')](_0x101ff2[_0xaaef('0xf')][_0x101ff2[_0xaaef('0x12')][_0x20a07b][_0xaaef('0x6c')]][_0xaaef('0x25')]),JSON[_0xaaef('0x52')](_0x101ff2[_0xaaef('0x12')][_0x20a07b]['dialAnswer']),JSON[_0xaaef('0x52')](_[_0xaaef('0x6e')](_0x101ff2[_0xaaef('0x12')][_0x20a07b],[_0xaaef('0x6f'),_0xaaef('0x70'),_0xaaef('0x71'),'ListId'])));return ami[_0xaaef('0x72')]({'action':'status','channel':_0x101ff2['actions'][_0x20a07b]['channel']})[_0xaaef('0x73')](function(_0x11c5d1){if(_0x11c5d1['message']===_0xaaef('0x74')){setTimeout(function(){if(_0x101ff2[_0xaaef('0x12')][_0x20a07b]){ut[_0xaaef('0x75')](_0x101ff2[_0xaaef('0xf')][_0x101ff2[_0xaaef('0x12')][_0x20a07b][_0xaaef('0x6c')]],_0xaaef('0x76'));if(_0x101ff2['actions'][_0x20a07b][_0xaaef('0x77')]===!![]){ut[_0xaaef('0x78')](_0x101ff2[_0xaaef('0xf')][_0x101ff2[_0xaaef('0x12')][_0x20a07b][_0xaaef('0x6c')]],_0xaaef('0x76'));ut[_0xaaef('0x79')]('[Dialer][checkChannel][pTalking][Preview]'+_0x20a07b,_0x101ff2['actions'][_0x20a07b][_0xaaef('0x6c')]);}ut[_0xaaef('0x79')]('[Dialer][checkChannel][Preview]'+_0x20a07b,_0x101ff2['actions'][_0x20a07b]['queue']);delete _0x101ff2[_0xaaef('0x12')][_0x20a07b];}},0x2328);}});}});};Preview[_0xaaef('0x60')]['clearZombieChannels']=function(){var _0x3d6203=this;loggerAction[_0xaaef('0x69')]('[action]',_[_0xaaef('0x7a')](this[_0xaaef('0x12')]));for(var _0x5bc6b7 in this[_0xaaef('0x12')]){if(_0x3d6203[_0xaaef('0x12')]['hasOwnProperty'](_0x5bc6b7)){_0x3d6203[_0xaaef('0x67')](_0x5bc6b7);}}};Preview[_0xaaef('0x60')][_0xaaef('0x66')]=function(_0x9c1211){var _0x36d389=this;rpcDb[_0xaaef('0x7b')](_0x9c1211['id'],ut['agentReadyId'](this['agents']))[_0xaaef('0x7c')](function(_0x62c6e9){if(!_[_0xaaef('0x68')](_0x62c6e9)){for(var _0x1117de=0x0;_0x1117de<_0x62c6e9[_0xaaef('0x7d')];_0x1117de+=0x1){if(ut[_0xaaef('0x7e')](_0x62c6e9[_0x1117de][_0xaaef('0x7f')])<_0x9c1211[_0xaaef('0x80')]*0x3c){if(_0x62c6e9[_0x1117de]['Agent']&&!_0x62c6e9[_0x1117de][_0xaaef('0x81')][_0xaaef('0x82')]){_0x36d389[_0xaaef('0x83')](_0x62c6e9[_0x1117de]['id'])[_0xaaef('0x7c')](ut[_0xaaef('0x84')](_0xaaef('0x85')))[_0xaaef('0x73')](ut[_0xaaef('0x84')]('[RecallMe]'));}else{rpcDb[_0xaaef('0x86')](_0x62c6e9[_0x1117de]['id']);}}else{var _0x40aa62=new Action(_0x62c6e9[_0x1117de],_0x9c1211);_0x40aa62[_0xaaef('0x87')]=moment()[_0xaaef('0x54')](_0xaaef('0x88'));_0x9c1211[_0xaaef('0x3c')]+=0x1;ut[_0xaaef('0x89')](_0x40aa62,0x17,'RecallInQueue');if(_0x9c1211[_0xaaef('0x8a')]){rpcDb[_0xaaef('0x8b')](ut['createBody'](_0x62c6e9[_0x1117de]));rpcDb[_0xaaef('0x8c')](_0x40aa62,_0xaaef('0x8d'));}else{ut[_0xaaef('0x89')](_0x40aa62,0x16,'RecallFailedTimeout');rpcDb[_0xaaef('0x8c')](_0x40aa62,'[HistoryRecallClose]');rpcDb[_0xaaef('0x8e')](_0x40aa62,_0xaaef('0x8f'));}}}}})[_0xaaef('0x73')](ut['logger2']('[getContactRecallMe]'));};Preview[_0xaaef('0x60')]['setMessage']=function(_0x2e1797){_0x2e1797[_0xaaef('0x59')]=!![];if(ut[_0xaaef('0x90')](_0x2e1797[_0xaaef('0x24')])){_0x2e1797[_0xaaef('0x48')]=_0xaaef('0x91');}else if(!ut[_0xaaef('0x92')](_0x2e1797['dialActive'])){_0x2e1797[_0xaaef('0x48')]=_0xaaef('0x5b');}else if(!this[_0xaaef('0x93')](_0x2e1797[_0xaaef('0x50')])){if(!this[_0xaaef('0x93')](_0x2e1797[_0xaaef('0x94')])){_0x2e1797[_0xaaef('0x48')]='TRUNK_IS_NOT_REACHABLE';}else{_0x2e1797[_0xaaef('0x48')]='ACTIVE';}}else{_0x2e1797['message']=_0xaaef('0x95');}emitCampaignPreview(_0x2e1797);};Preview[_0xaaef('0x60')]['callProgressDetectingCustomer']=function(_0x37a6,_0x114ba7,_0x759501){var _0x112ef4=this;var _0x465b44=this['actions'][_0x114ba7];var _0x5d3981=this['campaignsPreview'][_0x465b44['queue']];var _0x19e7f8;var _0x3ed5cc=![];var _0x2b077c=0x2;var _0x59fcc6=0x3;if(_0x5d3981){switch(_0x759501){case'1':_0x5d3981[_0xaaef('0x3a')]+=0x1;_0x465b44[_0xaaef('0x96')]+=0x1;_0x465b44[_0xaaef('0x97')]=ut[_0xaaef('0x98')](_0x465b44);ut['logCustomer'](_0x465b44,0x0,'NoSuchNumber');ami[_0xaaef('0x1f')](_0xaaef('0x99'),ut[_0xaaef('0x9a')](_0x465b44,_0xaaef('0x9b')));rpcDb[_0xaaef('0x8c')](_0x465b44,_0xaaef('0x9c'));_0x112ef4['verifyAdditionalPhones'](_0x465b44,'0',_0x5d3981)['then'](function(_0x3af8c1){_0x3ed5cc=_0x3af8c1[_0xaaef('0x9d')]==0x1;_0x2b077c=_0x5d3981[_0xaaef('0x9e')];_0x59fcc6=_0x5d3981[_0xaaef('0x9f')];if(!_0x3ed5cc){if(ut[_0xaaef('0x98')](_0x465b44)>=_0x5d3981[_0xaaef('0xa0')]){_0x19e7f8=ut[_0xaaef('0xa1')](_0x465b44,0xf,_0xaaef('0xa2'));rpcDb[_0xaaef('0x8e')](_0x19e7f8,_0xaaef('0xa3'));}else{if(_0x465b44[_0xaaef('0x96')]>=_0x5d3981[_0xaaef('0xa4')]){rpcDb[_0xaaef('0x8e')](_0x465b44,_0xaaef('0xa3'));}else{rpcDb[_0xaaef('0xa5')](ut[_0xaaef('0xa6')](_0x465b44,_0xaaef('0x96'),_0x5d3981[_0xaaef('0x9e')]),_0x465b44[_0xaaef('0xa7')],_0x465b44[_0xaaef('0xa8')]);}}delete this[_0xaaef('0x12')][_0x37a6[_0xaaef('0xa9')]];}else{_0x465b44['countnosuchnumberretry']++;logger['info'](_0xaaef('0xaa'),_0x465b44['countnosuchnumberretry']);logger[_0xaaef('0x69')]('id',_0x465b44[_0xaaef('0xab')]);_0x112ef4[_0xaaef('0xac')]({'id':_0x465b44[_0xaaef('0xab')],'field':{'countnosuchnumberretry':_0x465b44[_0xaaef('0x96')]}})[_0xaaef('0x7c')](function(){_0x112ef4[_0xaaef('0xad')](_0x465b44,_0x2b077c,_0x59fcc6)[_0xaaef('0x7c')](function(){});});}});break;case _0xaaef('0xae'):var _0x3bf58=moment()[_0xaaef('0x54')](_0xaaef('0x88'));_0x465b44[_0xaaef('0xaf')]=_0x3bf58;_0x465b44[_0xaaef('0xb0')]=_0x3bf58;_0x465b44[_0xaaef('0x77')]=!![];_0x5d3981[_0xaaef('0x25')]+=0x1;logger[_0xaaef('0x69')]('[syncHangup][talking][increment]',_0x465b44['uniqueid'],_0xaaef('0xb1'),_0x5d3981[_0xaaef('0x21')],_0xaaef('0x6d'),_0x5d3981[_0xaaef('0x25')]);ami[_0xaaef('0x1f')](_0xaaef('0xb2'),ut[_0xaaef('0x9a')](_0x465b44,_0xaaef('0xb3'),this[_0xaaef('0xf')][_0x465b44['queue']]));if(_0x5d3981['acw']){ami['emit'](_0xaaef('0xb4'),ut['buildAcw'](_0x465b44));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0xaaef('0x9a')](_0x465b44,_0xaaef('0xb5'),this[_0xaaef('0xf')][_0x465b44[_0xaaef('0x6c')]]));emitVoiceQueueChannelRemove(ut[_0xaaef('0x9a')](_0x465b44,_0xaaef('0xb5')));_0x5d3981['outboundAnswerCallsDay']+=0x1;_0x5d3981['total']+=0x1;_0x5d3981['answered']+=0x1;ut[_0xaaef('0x78')](_0x5d3981,_0xaaef('0xb6'));_0x465b44[_0xaaef('0x97')]=ut[_0xaaef('0x98')](_0x465b44);ut['logCustomer'](_0x465b44,0x4,_0xaaef('0xb7'));rpcDb[_0xaaef('0x8c')](_0x465b44,_0xaaef('0xb8'));rpcDb[_0xaaef('0x8e')](_0x465b44,_0xaaef('0xb9'));rpcDb[_0xaaef('0xba')](_0x465b44);_0x5d3981['sumDuration']+=_0x465b44['talktime'];_0x5d3981['sumBillable']+=_0x465b44[_0xaaef('0xbb')];logger[_0xaaef('0x69')](_0xaaef('0xbc'),_0x465b44[_0xaaef('0xbd')],_0xaaef('0xb1'),_0x5d3981[_0xaaef('0x21')],_0xaaef('0x6d'),_0x5d3981[_0xaaef('0x25')]);delete this[_0xaaef('0x12')][_0x37a6[_0xaaef('0xa9')]];break;case'BUSY':_0x5d3981[_0xaaef('0x36')]+=0x1;_0x465b44[_0xaaef('0xbe')]+=0x1;_0x465b44[_0xaaef('0x97')]=ut[_0xaaef('0x98')](_0x465b44);ut[_0xaaef('0x89')](_0x465b44,0x5,_0xaaef('0xbf'));_0x2b077c=_0x5d3981[_0xaaef('0xc0')];_0x59fcc6=_0x5d3981[_0xaaef('0x9f')];ami['emit'](_0xaaef('0xc1'),ut['buildObj'](_0x465b44,_0xaaef('0xc2')));rpcDb['createCustomerHistory'](_0x465b44,_0xaaef('0xc3'));_0x112ef4[_0xaaef('0xc4')](_0x465b44,'5',_0x5d3981)[_0xaaef('0x7c')](function(_0x510301){_0x3ed5cc=_0x510301['additional']==0x1;if(!_0x3ed5cc){if(ut[_0xaaef('0x98')](_0x465b44)>=_0x5d3981[_0xaaef('0xa0')]){_0x19e7f8=ut['cloneAction'](_0x465b44,0xf,'Global');rpcDb[_0xaaef('0x8e')](_0x19e7f8,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x465b44[_0xaaef('0xbe')]>=_0x5d3981[_0xaaef('0xc5')]){rpcDb[_0xaaef('0x8e')](_0x465b44,_0xaaef('0xc3'));}else{rpcDb[_0xaaef('0xa5')](ut[_0xaaef('0xa6')](_0x465b44,_0xaaef('0xbe'),_0x5d3981[_0xaaef('0xc0')]),_0x465b44[_0xaaef('0xa7')],_0x465b44[_0xaaef('0xa8')]);}}}else{_0x465b44['countbusyretry']++;_0x112ef4[_0xaaef('0xac')]({'id':_0x465b44['idContact'],'field':{'countbusyretry':_0x465b44['countbusyretry']}})[_0xaaef('0x7c')](function(){_0x112ef4[_0xaaef('0xad')](_0x465b44,_0x2b077c,_0x59fcc6)['then'](function(){});});}});break;case'NOANSWER':_0x5d3981['outboundNoAnswerCallsDay']+=0x1;_0x465b44[_0xaaef('0xc6')]+=0x1;_0x465b44[_0xaaef('0x97')]=ut[_0xaaef('0x98')](_0x465b44);ut[_0xaaef('0x89')](_0x465b44,0x3,'NoAnswer');_0x2b077c=_0x5d3981[_0xaaef('0xc7')];_0x59fcc6=_0x5d3981[_0xaaef('0x9f')];ami['emit'](_0xaaef('0xc8'),ut['buildObj'](_0x465b44,_0xaaef('0xc9')));rpcDb[_0xaaef('0x8c')](_0x465b44,_0xaaef('0xca'));_0x112ef4[_0xaaef('0xc4')](_0x465b44,'3',_0x5d3981)['then'](function(_0x50e4cb){_0x3ed5cc=_0x50e4cb[_0xaaef('0x9d')]==0x1;if(!_0x3ed5cc){if(ut[_0xaaef('0x98')](_0x465b44)>=_0x5d3981[_0xaaef('0xa0')]){_0x19e7f8=ut['cloneAction'](_0x465b44,0xf,_0xaaef('0xa2'));rpcDb['createCustomerFinal'](_0x19e7f8,_0xaaef('0xcb'));}else{if(_0x465b44[_0xaaef('0xc6')]>=_0x5d3981[_0xaaef('0xcc')]){rpcDb['createCustomerFinal'](_0x465b44,_0xaaef('0xca'));}else{rpcDb['rescheduleContact'](ut[_0xaaef('0xa6')](_0x465b44,_0xaaef('0xc6'),_0x5d3981[_0xaaef('0xc7')]),_0x465b44[_0xaaef('0xa7')],_0x465b44[_0xaaef('0xa8')]);}}}else{_0x465b44[_0xaaef('0xc6')]++;_0x112ef4['incrementPreviewCounters']({'id':_0x465b44[_0xaaef('0xab')],'field':{'countnoanswerretry':_0x465b44[_0xaaef('0xc6')]}})['then'](function(){_0x112ef4['swapAdditionalPhones'](_0x465b44,_0x2b077c,_0x59fcc6)[_0xaaef('0x7c')](function(){});});}});break;case _0xaaef('0xcd'):_0x5d3981['outboundCongestionCallsDay']+=0x1;_0x465b44[_0xaaef('0xce')]+=0x1;_0x465b44['countglobal']=ut[_0xaaef('0x98')](_0x465b44);ut[_0xaaef('0x89')](_0x465b44,0x8,_0xaaef('0xcf'));_0x2b077c=_0x5d3981[_0xaaef('0xd0')];_0x59fcc6=_0x5d3981[_0xaaef('0x9f')];ami[_0xaaef('0x1f')](_0xaaef('0xd1'),ut[_0xaaef('0x9a')](_0x465b44,_0xaaef('0xd2')));rpcDb[_0xaaef('0x8c')](_0x465b44,_0xaaef('0xd3'));_0x112ef4[_0xaaef('0xc4')](_0x465b44,'8',_0x5d3981)[_0xaaef('0x7c')](function(_0x32ca26){_0x3ed5cc=_0x32ca26['additional']==0x1;if(!_0x3ed5cc){if(ut[_0xaaef('0x98')](_0x465b44)>=_0x5d3981[_0xaaef('0xa0')]){_0x19e7f8=ut['cloneAction'](_0x465b44,0xf,_0xaaef('0xa2'));rpcDb['createCustomerFinal'](_0x19e7f8,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x465b44[_0xaaef('0xce')]>=_0x5d3981[_0xaaef('0xd4')]){rpcDb['createCustomerFinal'](_0x465b44,_0xaaef('0xd3'));}else{rpcDb[_0xaaef('0xa5')](ut[_0xaaef('0xa6')](_0x465b44,_0xaaef('0xce'),_0x5d3981[_0xaaef('0xc0')]),_0x465b44[_0xaaef('0xa7')],_0x465b44[_0xaaef('0xa8')]);}}}else{_0x465b44[_0xaaef('0xce')]++;_0x112ef4['incrementPreviewCounters']({'id':_0x465b44[_0xaaef('0xab')],'field':{'countcongestionretry':_0x465b44[_0xaaef('0xce')]}})[_0xaaef('0x7c')](function(){_0x112ef4[_0xaaef('0xad')](_0x465b44,_0x2b077c,_0x59fcc6)[_0xaaef('0x7c')](function(){});});}});break;case _0xaaef('0xd5'):_0x5d3981['outboundRejectCallsDay']+=0x1;_0x465b44[_0xaaef('0xd6')]+=0x1;_0x465b44[_0xaaef('0x97')]=ut['totalGlobal'](_0x465b44);ut[_0xaaef('0x89')](_0x465b44,0x14,_0xaaef('0xd7'));_0x2b077c=_0x5d3981[_0xaaef('0xd8')];_0x59fcc6=_0x5d3981[_0xaaef('0x9f')];ami['emit'](_0xaaef('0xd9'),ut[_0xaaef('0x9a')](_0x465b44,_0xaaef('0xda')));rpcDb[_0xaaef('0x8c')](_0x465b44,_0xaaef('0xdb'));_0x112ef4[_0xaaef('0xc4')](_0x465b44,'20',_0x5d3981)[_0xaaef('0x7c')](function(_0x134409){_0x3ed5cc=_0x134409['additional']==0x1;if(!_0x3ed5cc){if(ut[_0xaaef('0x98')](_0x465b44)>=_0x5d3981['dialGlobalMaxRetry']){_0x19e7f8=ut[_0xaaef('0xa1')](_0x465b44,0x14,_0xaaef('0xd7'));rpcDb[_0xaaef('0x8e')](_0x19e7f8,_0xaaef('0xdc'));}else{if(_0x465b44[_0xaaef('0xd6')]>=_0x5d3981['dialAgentRejectMaxRetry']){rpcDb[_0xaaef('0x8e')](_0x465b44,_0xaaef('0xdc'));}else{rpcDb[_0xaaef('0xa5')](ut[_0xaaef('0xa6')](_0x465b44,_0xaaef('0xd6'),_0x5d3981[_0xaaef('0xd8')]),_0x465b44[_0xaaef('0xa7')],_0x465b44['activeContact']);}}}else{_0x465b44[_0xaaef('0xc6')]++;_0x112ef4['incrementPreviewCounters']({'id':_0x465b44[_0xaaef('0xab')],'field':{'countnoanswerretry':_0x465b44[_0xaaef('0xc6')]}})[_0xaaef('0x7c')](function(){_0x112ef4[_0xaaef('0xad')](_0x465b44,_0x2b077c,_0x59fcc6)[_0xaaef('0x7c')](function(){});});}});break;case _0xaaef('0xdd'):_0x5d3981[_0xaaef('0x3f')]+=0x1;_0x465b44[_0xaaef('0xde')]+=0x1;_0x465b44[_0xaaef('0x97')]=ut[_0xaaef('0x98')](_0x465b44);ut[_0xaaef('0x89')](_0x465b44,0xb,_0xaaef('0xdf'));rpcDb[_0xaaef('0x8c')](_0x465b44,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x465b44)>=_0x5d3981[_0xaaef('0xa0')]){_0x19e7f8=ut[_0xaaef('0xa1')](_0x465b44,0xf,_0xaaef('0xa2'));rpcDb[_0xaaef('0x8e')](_0x19e7f8,_0xaaef('0xe0'));}else{if(_0x465b44['countabandonedetry']>=_0x5d3981[_0xaaef('0xe1')]){rpcDb[_0xaaef('0x8e')](_0x465b44,_0xaaef('0xe0'));}else{rpcDb['rescheduleContact'](ut[_0xaaef('0xa6')](_0x465b44,_0xaaef('0xde'),_0x5d3981['dialAbandonedRetryFrequency']),_0x465b44['unlockAgent'],_0x465b44['activeContact']);}}break;case'18':_0x5d3981[_0xaaef('0x3e')]+=0x1;_0x465b44[_0xaaef('0xe2')]+=0x1;_0x465b44[_0xaaef('0x97')]=ut['totalGlobal'](_0x465b44);ut[_0xaaef('0x89')](_0x465b44,0x12,_0x37a6[_0xaaef('0xe3')]||_0x37a6[_0xaaef('0xe4')]);ami[_0xaaef('0x1f')]('custom:amd',ut['buildObj'](_0x465b44,_0xaaef('0xe5')));rpcDb[_0xaaef('0x8c')](_0x465b44,_0xaaef('0xe6'));if(ut['totalGlobal'](_0x465b44)>=_0x5d3981[_0xaaef('0xa0')]){_0x19e7f8=ut['cloneAction'](_0x465b44,0xf,_0xaaef('0xa2'));rpcDb[_0xaaef('0x8e')](_0x19e7f8,_0xaaef('0xe6'));}else{rpcDb['createCustomerFinal'](_0x465b44,_0xaaef('0xe6'));}delete this[_0xaaef('0x12')][_0x37a6[_0xaaef('0xa9')]];break;case'19':_0x5d3981[_0xaaef('0x3e')]+=0x1;_0x465b44[_0xaaef('0x97')]=ut[_0xaaef('0x98')](_0x465b44);ut[_0xaaef('0x89')](_0x465b44,0x13,_0x37a6[_0xaaef('0xe3')]||_0x37a6[_0xaaef('0xe4')]);ami[_0xaaef('0x1f')](_0xaaef('0xe7'),ut[_0xaaef('0x9a')](_0x465b44,_0xaaef('0xe5')));rpcDb[_0xaaef('0x8c')](_0x465b44,_0xaaef('0xe8'));if(ut[_0xaaef('0x98')](_0x465b44)>=_0x5d3981[_0xaaef('0xa0')]){_0x19e7f8=ut[_0xaaef('0xa1')](_0x465b44,0xf,_0xaaef('0xa2'));rpcDb['createCustomerFinal'](_0x19e7f8,_0xaaef('0xe8'));}else{rpcDb[_0xaaef('0x8e')](_0x465b44,_0xaaef('0xe8'));}delete this[_0xaaef('0x12')][_0x37a6['linkedid']];break;default:if(_0x465b44[_0xaaef('0x77')]){ut[_0xaaef('0x78')](_0x5d3981,_0xaaef('0xe9'));ut[_0xaaef('0x79')](_0xaaef('0xea')+_0x5d3981[_0xaaef('0x21')],_0x37a6);}_0x5d3981['outboundUnknownCallsDay']+=0x1;_0x465b44['countglobal']=ut[_0xaaef('0x98')](_0x465b44);ut[_0xaaef('0x89')](_0x465b44,0xc,_0x37a6['cause-txt']||_0x37a6[_0xaaef('0xe4')]);_0x2b077c=_0x5d3981[_0xaaef('0xd8')];_0x59fcc6=_0x5d3981[_0xaaef('0x9f')];rpcDb['createCustomerHistory'](_0x465b44,'[callProgressDetectingCustomer][logUnknown]');_0x112ef4['verifyAdditionalPhones'](_0x465b44,'20',_0x5d3981)[_0xaaef('0x7c')](function(_0xbc16fa){_0x3ed5cc=_0xbc16fa['additional']==0x1;if(!_0x3ed5cc){if(ut['totalGlobal'](_0x465b44)>=_0x5d3981['dialGlobalMaxRetry']){_0x19e7f8=ut[_0xaaef('0xa1')](_0x465b44,0xf,_0xaaef('0xa2'));rpcDb[_0xaaef('0x8e')](_0x19e7f8,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xaaef('0x8e')](_0x465b44,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x37a6[_0xaaef('0xa9')]];}else{_0x112ef4[_0xaaef('0xad')](_0x465b44,_0x2b077c,_0x59fcc6)[_0xaaef('0x7c')](function(_0x4d4905){});}});}if(!(_0x465b44[_0xaaef('0x77')]&&_0x759501==='16')){ut[_0xaaef('0x75')](_0x5d3981,_0xaaef('0xeb'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x465b44[_0xaaef('0xbd')],_0xaaef('0xb1'),_0x5d3981[_0xaaef('0x21')],'originated:\x20',_0x5d3981[_0xaaef('0x49')]);}if(_0x759501!==_0xaaef('0xae')){delete this['actions'][_0x37a6[_0xaaef('0xa9')]];delete this['actions'][_0x37a6[_0xaaef('0xec')]];}}};Preview[_0xaaef('0x60')]['callProgressDetectingAgent']=function(_0x23d636,_0x18db6f,_0x54ae6f){if(_[_0xaaef('0xed')](_0x18db6f)&&_0xaaef('0xee')!==typeof _0x18db6f){return;}if(_[_0xaaef('0xed')](_0x54ae6f)&&_0xaaef('0xee')!==typeof _0x54ae6f){return;}switch(_0x54ae6f['reason']){case'0':ut[_0xaaef('0xef')](_0x23d636,0x0,'NoSuchNumber');rpcDb[_0xaaef('0xf0')](_0x23d636,_0xaaef('0xf1'));break;case'3':ut['logAgent'](_0x23d636,0x3,_0xaaef('0xf2'));rpcDb[_0xaaef('0xf0')](_0x23d636,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x23d636,0x5,'Busy');rpcDb['createAgentHistory'](_0x23d636,_0xaaef('0xf3'));break;case'8':ut[_0xaaef('0xef')](_0x23d636,0x8,_0xaaef('0xcf'));rpcDb['createAgentHistory'](_0x23d636,_0xaaef('0xf4'));break;case'22':ut[_0xaaef('0xef')](_0x23d636,0x16,_0xaaef('0xf5'));rpcDb['createAgentHistory'](_0x23d636,_0xaaef('0xf6'));break;default:ut['logAgent'](_0x23d636,0xc,_0x54ae6f['reason']);rpcDb[_0xaaef('0xf0')](_0x23d636,_0xaaef('0xf4'));}ut[_0xaaef('0x75')](_0x18db6f,'[callProgressDetectingAgent]');logger[_0xaaef('0x69')](_0xaaef('0xf7'),_0x23d636['uniqueid'],_0xaaef('0xb1'),_0x18db6f['name'],'originated:\x20',_0x18db6f[_0xaaef('0x49')]);delete this[_0xaaef('0x12')][_0x23d636[_0xaaef('0xbd')]];};Preview[_0xaaef('0x60')][_0xaaef('0xc4')]=function(_0x519b1e,_0x27a9b1,_0x515165){return BPromise[_0xaaef('0xf8')]()[_0xaaef('0x7c')](cmHopperAdditionalPhone[_0xaaef('0xc4')](_0x519b1e,_0x27a9b1,_0x515165))[_0xaaef('0x73')](logger[_0xaaef('0x69')](_0xaaef('0xf9')));};Preview['prototype']['swapAdditionalPhones']=function(_0xb293fc,_0x51acdd,_0x308c2b){return BPromise[_0xaaef('0xf8')]()[_0xaaef('0x7c')](cmHopperAdditionalPhone[_0xaaef('0xad')](_0xb293fc,_0x51acdd,_0x308c2b))[_0xaaef('0x73')](logger[_0xaaef('0x69')](_0xaaef('0xfa')));};Preview[_0xaaef('0x60')][_0xaaef('0xac')]=function(_0x459978){return BPromise[_0xaaef('0xf8')]()[_0xaaef('0x7c')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x459978))[_0xaaef('0x73')](logger[_0xaaef('0x69')](_0xaaef('0xfb')));};Preview['prototype'][_0xaaef('0xfc')]=function(_0x406b0f,_0x194fc9,_0x3e58fb,_0x3e58b4,_0x2e632e){var _0x679334=this;return new BPromise(function(_0x5edd09,_0x5541bc){if(_[_0xaaef('0x68')](_0x194fc9)||_[_0xaaef('0x68')](_0x194fc9[_0xaaef('0xfd')])||_[_0xaaef('0x68')](_0x194fc9[_0xaaef('0xfe')])||_[_0xaaef('0x68')](_0x194fc9[_0xaaef('0x71')])){_0x5541bc(ut[_0xaaef('0x48')](_0xaaef('0xff'),_0x3e58b4,_0x2e632e));return;}var _0x451f9e=uuid['v4']();var _0x1e0e10=_0x679334[_0xaaef('0xf')][_0x194fc9[_0xaaef('0x6a')][_0xaaef('0x21')]];var _0x10f514=_0x3e58fb?_0x679334[_0xaaef('0x13')][_0x3e58fb]['id']:undefined;_0x679334['actions'][_0x451f9e]=new Action(_0x194fc9,_0x1e0e10,_0x451f9e,_0x3e58fb,_0x10f514);var _0x48b3f1=_0x679334[_0xaaef('0x12')][_0x451f9e];_0x48b3f1[_0xaaef('0xa7')]=_0x3e58b4;_0x48b3f1[_0xaaef('0xa8')]=_0x2e632e;_0x48b3f1[_0xaaef('0x100')]=_0x3e58fb;if(_[_0xaaef('0x101')](_0x406b0f)){_0x679334[_0xaaef('0x102')](_0x48b3f1,_0x1e0e10,_0x194fc9,_0x3e58fb)[_0xaaef('0x7c')](function(_0x643066){logger[_0xaaef('0x69')](_0xaaef('0x103'),_0xaaef('0x104')+_0x48b3f1[_0xaaef('0x6c')]+_0xaaef('0x105')+_0x48b3f1[_0xaaef('0xab')],JSON[_0xaaef('0x52')](_0x643066));ami[_0xaaef('0x1f')](_0xaaef('0x106'),ut[_0xaaef('0x9a')](_0x48b3f1,_0xaaef('0x107'),_0x679334[_0xaaef('0xf')][_0x48b3f1[_0xaaef('0x6c')]]));_0x5edd09(ut[_0xaaef('0x48')]('Calling'));})[_0xaaef('0x73')](function(_0x5dbace){ut[_0xaaef('0x5c')](_0xaaef('0x108'),_0x5dbace);_0x5541bc(ut['message'](_0xaaef('0x109'),_0x3e58b4,_0x2e632e));});}else{_0x1e0e10[_0xaaef('0x35')]+=0x1;ut['logBlacklist'](_0x48b3f1);rpcDb[_0xaaef('0x10a')](_0x48b3f1,_0xaaef('0x10b'));delete _0x679334[_0xaaef('0x12')][_0x451f9e];_0x5541bc(ut[_0xaaef('0x48')](_0xaaef('0x10c'),_0x3e58b4,_0x2e632e));}});};Preview['prototype'][_0xaaef('0x93')]=function(_0x54ad32){return!_[_0xaaef('0x68')](_0x54ad32)&&!_[_0xaaef('0x68')](_0x54ad32['name'])&&!_[_0xaaef('0x68')](_0x54ad32[_0xaaef('0x10d')])&&_0x54ad32[_0xaaef('0x10d')]&&!_['isNil'](this[_0xaaef('0x11')][util[_0xaaef('0x54')]('SIP/%s',_0x54ad32[_0xaaef('0x21')])])&&!_[_0xaaef('0x68')](this[_0xaaef('0x11')][util[_0xaaef('0x54')](_0xaaef('0x10e'),_0x54ad32[_0xaaef('0x21')])][_0xaaef('0x10f')])&&(this[_0xaaef('0x11')][util['format'](_0xaaef('0x10e'),_0x54ad32[_0xaaef('0x21')])][_0xaaef('0x10f')]==='reachable'||this[_0xaaef('0x11')][util[_0xaaef('0x54')](_0xaaef('0x10e'),_0x54ad32[_0xaaef('0x21')])][_0xaaef('0x10f')]===_0xaaef('0x110'));};Preview['prototype'][_0xaaef('0x83')]=function(_0x5f5d7a,_0x360cff){var _0x5c5245=this;return new BPromise(function(_0x563540,_0x13b603){_0x5c5245[_0xaaef('0x111')](_0x5f5d7a,_0x360cff)['then'](function(_0x24ad3e){_0x563540(_[_0xaaef('0x6e')](_0x24ad3e,[_0xaaef('0x48')]));})[_0xaaef('0x73')](function(_0x226548){if(_0x226548['unlock']){rpcDb[_0xaaef('0x112')](_0x5f5d7a);}if(_0x226548[_0xaaef('0x10d')]){rpcDb[_0xaaef('0x86')](_0x5f5d7a);}_0x13b603(_[_0xaaef('0x6e')](_0x226548,['message']));});});};Preview['prototype']['execRun']=function(_0x5f58cf,_0x231c01){var _0x236f17=this;return new BPromise(function(_0x3c3730,_0x233358){var _0x40d4c4,_0x474431;rpcDb[_0xaaef('0x113')](_0x5f58cf)[_0xaaef('0x7c')](function(_0x347269){if(!_[_0xaaef('0x68')](_0x347269[0x0])){_0x474431=_0x347269[0x0][_0xaaef('0x114')]?![]:!![];_0x40d4c4=_0x347269[0x0][_0xaaef('0x114')]?!![]:![];_0x40d4c4=_0x231c01?!![]:_0x40d4c4;}var _0xa5c5a6=_0x236f17[_0xaaef('0x115')](_0x347269);if(_0xa5c5a6[_0xaaef('0x116')]){rpcDb[_0xaaef('0x117')](_[_0xaaef('0x6e')](_0x347269[0x0],[_0xaaef('0x71'),'phone']))['then'](function(_0x48f9bb){_0x236f17['checkInBlack'](_0x48f9bb,_0x347269[0x0],_0x231c01,_0x474431,_0x40d4c4)[_0xaaef('0x7c')](function(_0x6cd812){_0x3c3730(_0x6cd812);})[_0xaaef('0x73')](function(_0x2ed653){_0x233358(_0x2ed653);});})[_0xaaef('0x73')](function(_0x4ef90d){ut[_0xaaef('0x5c')](_0xaaef('0x118'),_0x4ef90d);_0x233358(ut['message'](_0xaaef('0x119'),_0x474431,_0x40d4c4));});}else{_0x233358(ut[_0xaaef('0x48')](_0xa5c5a6[_0xaaef('0x48')],_0x474431,_0x40d4c4));}})[_0xaaef('0x73')](function(_0x5a755f){ut[_0xaaef('0x5c')](_0xaaef('0x11a'),_0x5a755f);_0x233358(ut[_0xaaef('0x48')](_0xaaef('0x119'),![],!![]));});});};Preview[_0xaaef('0x60')][_0xaaef('0x115')]=function(_0x21d4ff){if(_['isNil'](_0x21d4ff)||_[_0xaaef('0x101')](_0x21d4ff)||!_[_0xaaef('0x68')](_0x21d4ff[0x0]['Agent'])&&_[_0xaaef('0x68')](_0x21d4ff[0x0][_0xaaef('0x81')][_0xaaef('0x21')])){ut[_0xaaef('0x5c')](_0xaaef('0x11b'),_0x21d4ff);return{'isValid':![],'message':_0xaaef('0x11c')};}var _0x494dd6=this[_0xaaef('0xf')][_0x21d4ff[0x0]['Queue'][_0xaaef('0x21')]];_0x494dd6[_0xaaef('0x48')]='ACTIVE';if(_['isNil'](_0x494dd6)){ut[_0xaaef('0x5c')](_0xaaef('0x11d'),_0x494dd6);return{'isValid':![],'message':_0xaaef('0x11e')};}if(!this[_0xaaef('0x93')](_0x494dd6[_0xaaef('0x50')])){ut['logger'](_0xaaef('0x11f'),_0xaaef('0x120')+_0x494dd6[_0xaaef('0x21')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xaaef('0x93')](_0x494dd6['TrunkBackup'])){ut['logger'](_0xaaef('0x11f'),_0x494dd6[_0xaaef('0x21')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x494dd6[_0xaaef('0x2e')])){ut[_0xaaef('0x5c')](_0xaaef('0x121'),_0x494dd6[_0xaaef('0x21')]+_0xaaef('0x122'));return{'isValid':![],'message':_0xaaef('0x120')+_0x494dd6['name']+_0xaaef('0x122')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xaaef('0x60')][_0xaaef('0x102')]=function(_0x575f84,_0x39fdb3,_0x494d32,_0x28afb0){var _0x385925=this;return new BPromise(function(_0x5df34c,_0x5077cd){var _0x47443c=_0x575f84[_0xaaef('0xbd')];var _0x10afed=_0x385925[_0xaaef('0x93')](_0x39fdb3[_0xaaef('0x50')])?util[_0xaaef('0x54')](_0xaaef('0x123'),_0x39fdb3[_0xaaef('0x50')][_0xaaef('0x21')],_[_0xaaef('0x68')](_0x39fdb3[_0xaaef('0x33')])?'':_0x39fdb3['dialPrefix']['trim']()||'',_0x39fdb3[_0xaaef('0x124')]>0x0?_0x494d32[_0xaaef('0xfe')]['substring'](_0x39fdb3['dialCutDigit']):_0x494d32[_0xaaef('0xfe')]):util['format']('SIP/%s/%s%s',_[_0xaaef('0x68')](_0x39fdb3[_0xaaef('0x94')])?_0x39fdb3[_0xaaef('0x50')][_0xaaef('0x21')]:_0x39fdb3[_0xaaef('0x94')]['name'],_[_0xaaef('0x68')](_0x39fdb3[_0xaaef('0x33')])?'':_0x39fdb3['dialPrefix'][_0xaaef('0x125')]()||'',_0x39fdb3['dialCutDigit']>0x0?_0x494d32[_0xaaef('0xfe')][_0xaaef('0x126')](_0x39fdb3[_0xaaef('0x124')]):_0x494d32[_0xaaef('0xfe')]);var _0x48d5e3=_0x385925[_0xaaef('0x93')](_0x39fdb3[_0xaaef('0x50')])?ut[_0xaaef('0x127')](_0x39fdb3['Trunk'][_0xaaef('0x128')],_0x39fdb3['dialOriginateCallerIdName'],_0x39fdb3[_0xaaef('0x129')]>0x0?ut[_0xaaef('0x12a')](_0x39fdb3[_0xaaef('0x31')],_0x39fdb3[_0xaaef('0x129')]):_0x39fdb3[_0xaaef('0x31')]):ut[_0xaaef('0x127')](_['isNil'](_0x39fdb3[_0xaaef('0x94')])?_0x39fdb3[_0xaaef('0x50')][_0xaaef('0x128')]:_0x39fdb3[_0xaaef('0x94')]['callerid'],_0x39fdb3[_0xaaef('0x30')],_0x39fdb3[_0xaaef('0x129')]>0x0?ut[_0xaaef('0x12a')](_0x39fdb3[_0xaaef('0x31')],_0x39fdb3[_0xaaef('0x129')]):_0x39fdb3['dialOriginateCallerIdNumber']);if(_0x48d5e3){_0x575f84[_0xaaef('0x12b')]=ut['extractCalleridName'](_0x48d5e3);_0x575f84[_0xaaef('0x12c')]=ut[_0xaaef('0x12d')](_0x48d5e3);}var _0x39dc8b=ut[_0xaaef('0x12e')](_0x39fdb3,_0x494d32,_0x10afed,_0x48d5e3,_0x47443c,_0x575f84);_[_0xaaef('0x12f')](_0x575f84,ut['toLowerVariables'](_0x39dc8b));_0x575f84[_0xaaef('0x87')]=moment()[_0xaaef('0x54')](_0xaaef('0x88'));ami[_0xaaef('0x72')](ut['variablesAction'](_0x575f84,_0x39fdb3,_0x39dc8b,_0x575f84['activeContact'],_0x28afb0))[_0xaaef('0x7c')](function(_0xfd9d0d){_0x39fdb3[_0xaaef('0x49')]+=0x1;logger[_0xaaef('0x69')](_0xaaef('0x130'),_0x47443c,_0xaaef('0xb1'),_0x39fdb3[_0xaaef('0x21')],_0xaaef('0x6b'),_0x39fdb3[_0xaaef('0x49')]);_0x5df34c(_0xfd9d0d);})[_0xaaef('0x73')](function(_0x31aec7){ut['logAgent'](_0x575f84,0xe,_0xaaef('0x131'));rpcDb[_0xaaef('0xf0')](_0x575f84,_0xaaef('0x132'));_0x5077cd(_0x31aec7);});});};Preview[_0xaaef('0x60')]['syncNewExten']=function(_0x31e4e6){if(this[_0xaaef('0x12')][_0x31e4e6[_0xaaef('0xa9')]]){this[_0xaaef('0x12')][_0x31e4e6[_0xaaef('0xa9')]]['channel']=_0x31e4e6['channel'];}};Preview['prototype'][_0xaaef('0x15')]=function(_0x20aa76){var _0x3efd01=this;var _0x48e62b=this[_0xaaef('0x12')][_0x20aa76[_0xaaef('0x133')]];if(_0x48e62b){if(_0x48e62b[_0xaaef('0x100')]&&this[_0xaaef('0x13')][_0x48e62b[_0xaaef('0x100')]]){ut[_0xaaef('0x134')](_0x48e62b,this[_0xaaef('0x13')][_0x48e62b[_0xaaef('0x100')]][_0xaaef('0x21')],this[_0xaaef('0x13')][_0x48e62b[_0xaaef('0x100')]]['id']);}var _0xcdb11b=_[_0xaaef('0x135')](_0x48e62b);_0xcdb11b[_0xaaef('0xaf')]=moment()[_0xaaef('0x54')](_0xaaef('0x88'));var _0x58018f=_0x3efd01['campaignsPreview'][_0x48e62b[_0xaaef('0x6c')]];if(ut['isFailure'](_0x20aa76[_0xaaef('0x136')])){if(_0x48e62b[_0xaaef('0xa7')]){rpcDb[_0xaaef('0x112')](_0x48e62b[_0xaaef('0xab')]);}if(_0x48e62b[_0xaaef('0xa8')]){rpcDb[_0xaaef('0x86')](_0x48e62b['idContact']);}ami['emit']('custom:agentringnoanswer',ut['buildObj'](_0x48e62b,'rejected',this['campaignsPreview'][_0x48e62b[_0xaaef('0x6c')]]));this[_0xaaef('0x137')](_0xcdb11b,_0x58018f,_0x20aa76);}else{_0x48e62b['starttime']=moment()['format'](_0xaaef('0x88'));ut['logAgent'](_0xcdb11b,0x4,_0xaaef('0xb7'));rpcDb[_0xaaef('0xf0')](_0xcdb11b,_0xaaef('0x138'));}}};Preview[_0xaaef('0x60')]['syncHangup']=function(_0x129aa1){var _0x35d2bc=this;var _0x2993c6=this[_0xaaef('0x12')][_0x129aa1['linkedid']];var _0x137d11;if(_0x2993c6){_0x137d11=this[_0xaaef('0xf')][_0x2993c6[_0xaaef('0x6c')]];logger[_0xaaef('0x69')](_0xaaef('0x139'),_0x129aa1[_0xaaef('0xa9')],_0xaaef('0xb1'),_0x137d11[_0xaaef('0x21')],_0xaaef('0x6d'),_0x137d11['pTalking']);}if(this['actions'][_0x129aa1[_0xaaef('0xa9')]]&&_0x129aa1[_0xaaef('0xa9')]!==_0x129aa1[_0xaaef('0xbd')]){if(_0x129aa1[_0xaaef('0x13a')]==='16'&&this['actions'][_0x129aa1[_0xaaef('0xa9')]][_0xaaef('0x77')]){this[_0xaaef('0x13b')](_0x129aa1,_0x129aa1[_0xaaef('0xa9')],_0x129aa1[_0xaaef('0x13a')]);}else if(this[_0xaaef('0x12')][_0x129aa1['linkedid']][_0xaaef('0x77')]){logger[_0xaaef('0x69')](_0xaaef('0x13c'),_0x129aa1[_0xaaef('0xa9')],_0x129aa1[_0xaaef('0x13a')],'\x20Queue',_0x137d11['name'],_0xaaef('0x6d'),_0x137d11[_0xaaef('0x25')]);this[_0xaaef('0x13b')](_0x129aa1,_0x129aa1[_0xaaef('0xa9')],_0x129aa1[_0xaaef('0x13a')]);}}else if(_0x2993c6&&_[_0xaaef('0x68')](_0x2993c6['statedesc'])&&_0x137d11[_0xaaef('0x13d')]&&_0x129aa1[_0xaaef('0xa9')]===_0x129aa1[_0xaaef('0xbd')]&&_[_0xaaef('0x68')](_0x129aa1['reason'])&&_0x129aa1['cause']==='16'&&_0x129aa1['channelstate']==='6'&&_['isUndefined'](_0x2993c6[_0xaaef('0x13e')])){if(_0x2993c6[_0xaaef('0xa7')]){rpcDb[_0xaaef('0x112')](_0x2993c6[_0xaaef('0xab')]);}if(_0x2993c6['activeContact']){rpcDb['disableContact'](_0x2993c6[_0xaaef('0xab')]);}_0x129aa1[_0xaaef('0x13f')]='22';this['callProgressDetectingAgent'](_0x2993c6,_0x137d11,_0x129aa1);}else if(_0x2993c6&&_0x2993c6[_0xaaef('0x13e')]){if(_0x129aa1[_0xaaef('0x13a')]==='16'&&this[_0xaaef('0x12')][_0x129aa1[_0xaaef('0xa9')]][_0xaaef('0x77')]){logger[_0xaaef('0x69')](_0xaaef('0x140'),_0x129aa1[_0xaaef('0xa9')],_0x129aa1[_0xaaef('0x13a')],'\x20Queue',_0x137d11[_0xaaef('0x21')],_0xaaef('0x6d'),_0x137d11[_0xaaef('0x25')]);this['callProgressDetectingCustomer'](_0x129aa1,_0x129aa1[_0xaaef('0xa9')],_0x129aa1['cause']);}else if(this[_0xaaef('0x12')][_0x129aa1[_0xaaef('0xa9')]][_0xaaef('0x77')]){logger['info'](_0xaaef('0x13c'),_0x129aa1['linkedid'],_0x129aa1[_0xaaef('0x13a')],_0xaaef('0xb1'),_0x137d11[_0xaaef('0x21')],_0xaaef('0x6d'),_0x137d11[_0xaaef('0x25')]);this[_0xaaef('0x13b')](_0x129aa1,_0x129aa1[_0xaaef('0xa9')],_0x129aa1[_0xaaef('0x13a')]);}}};Preview[_0xaaef('0x60')][_0xaaef('0x1a')]=function(_0x14b476){if(this[_0xaaef('0x12')][_0x14b476[_0xaaef('0xec')]]&&_0x14b476[_0xaaef('0xec')]!==_0x14b476[_0xaaef('0x141')]){this[_0xaaef('0x13b')](_0x14b476,_0x14b476[_0xaaef('0xec')],_0x14b476[_0xaaef('0xe4')]);}};Preview['prototype'][_0xaaef('0x142')]=function(_0x477689){if(this['actions'][_0x477689[_0xaaef('0xa9')]]&&_0x477689[_0xaaef('0xa9')]!==_0x477689[_0xaaef('0xbd')]&&!this[_0xaaef('0x12')][_0x477689[_0xaaef('0xa9')]][_0xaaef('0x77')]){if(_0x477689[_0xaaef('0x13a')]==='1'){this[_0xaaef('0x13b')](_0x477689,_0x477689['linkedid'],_0x477689[_0xaaef('0x13a')]);}}};Preview[_0xaaef('0x60')][_0xaaef('0x143')]=function(_0xafb401,_0x31e658,_0x87ca6b){if(this[_0xaaef('0x12')][_0xafb401]){if(_[_0xaaef('0x68')](this['actions'][_0xafb401][_0xaaef('0x144')])){this[_0xaaef('0x12')][_0xafb401][_0xaaef('0x144')]={};}this['actions'][_0xafb401]['variables'][_0x31e658]=_0x87ca6b;}};Preview[_0xaaef('0x60')][_0xaaef('0x1c')]=function(_0x12dc04){try{if(!_['isNil'](_0x12dc04)){if(ut[_0xaaef('0x145')](_[_0xaaef('0x146')](_0x12dc04[_0xaaef('0x147')])[0x0])){this[_0xaaef('0x143')](_0x12dc04['uniqueid'],_['keys'](_0x12dc04[_0xaaef('0x147')])[0x0],_0x12dc04[_0xaaef('0x148')]);}}}catch(_0x4ebfda){logger[_0xaaef('0x149')](_0xaaef('0x14a'),util[_0xaaef('0x14b')](_0x4ebfda,{'showHidden':![],'depth':null}));}};Preview[_0xaaef('0x60')][_0xaaef('0x1e')]=function(_0x54f155){if(_0x54f155){if(this[_0xaaef('0x12')][_0x54f155['transfertargetlinkedid']]){this['actions'][_0x54f155[_0xaaef('0x14c')]][_0xaaef('0x13e')]=!![];}}};Preview[_0xaaef('0x60')][_0xaaef('0x14d')]=function(_0x161155){if(_0x161155){if(this['actions'][_0x161155['transfererlinkedid']]){this['actions'][_0x161155[_0xaaef('0x14e')]]['transfer']=!![];}}};module[_0xaaef('0x14f')]=Preview; \ No newline at end of file +var _0xfca3=['voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pick','UserId','VoiceQueueId','ListId','Action','catch','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','agentReadyId','isNil','getDiff','scheduledat','Agent','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','IsNotLoggedIn','isActive','dialActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','logCustomer','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','countnosuchnumberretry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','BUSY','dialBusyRetryFrequency','custom:agentbusy','busy','countbusyretry','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','createAgentHistory','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','logger','[Preview][execCall][failure]','Call\x20failed','logBlacklist','Contact\x20in\x20black\x20List','SIP/%s','status','unmonitored','execRun','getContactPreview','recallme','validateContact','isValid','phone','[Preview][getContactPreview]','Call\x20unsuccessful','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','execCall','dialPrefix','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','dialOriginateCallerIdName','getCallerIdRandom','originatecalleridname','originatecalleridnum','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','actionid','logLookAgent','clone','custom:agentringnoanswer','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','unlockContact','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','variables','filterKey','keys','addVariable','variable','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','talking','total','unmanaged','abandoned','waiting','loggedInDb','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','format'];(function(_0x4dbc5d,_0x2d0a51){var _0x45b461=function(_0x3e73ab){while(--_0x3e73ab){_0x4dbc5d['push'](_0x4dbc5d['shift']());}};_0x45b461(++_0x2d0a51);}(_0xfca3,0xfa));var _0x3fca=function(_0x464d0a,_0x1830c1){_0x464d0a=_0x464d0a-0x0;var _0x18ed08=_0xfca3[_0x464d0a];return _0x18ed08;};'use strict';var util=require(_0x3fca('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x3fca('0x1'));var moment=require(_0x3fca('0x2'));var md5=require(_0x3fca('0x3'));var Redis=require(_0x3fca('0x4'));var config=require(_0x3fca('0x5'));var logger=require(_0x3fca('0x6'))('preview');var loggerAction=require(_0x3fca('0x6'))(_0x3fca('0x7'));var ami=require(_0x3fca('0x8'));var rpcDb=require(_0x3fca('0x9'));var cmHopperAdditionalPhone=require(_0x3fca('0xa'));var Action=require(_0x3fca('0xb'));var ut=require(_0x3fca('0xc'));config[_0x3fca('0xd')]=_['defaults'](config[_0x3fca('0xd')],{'host':_0x3fca('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3fca('0xd')]));var Sequence=function(){};Sequence[_0x3fca('0xf')][_0x3fca('0x10')]=function(_0x40871f){this['tail']=this[_0x3fca('0x11')]?this[_0x3fca('0x11')][_0x3fca('0x12')](_0x40871f):_0x40871f();};function Preview(_0x30317d){this[_0x3fca('0x13')]=new Sequence();this[_0x3fca('0x14')]=_0x30317d[_0x3fca('0x15')];this[_0x3fca('0x16')]=_0x30317d[_0x3fca('0x16')];this[_0x3fca('0x17')]={};this[_0x3fca('0x18')]=_0x30317d[_0x3fca('0x18')];this[_0x3fca('0x19')]=0x0;ami['on'](_0x3fca('0x1a'),this[_0x3fca('0x1b')][_0x3fca('0x1c')](this));ami['on']('hangup',this[_0x3fca('0x1d')][_0x3fca('0x1c')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x3fca('0x1c')](this));ami['on'](_0x3fca('0x1e'),this[_0x3fca('0x1f')]['bind'](this));ami['on'](_0x3fca('0x20'),this[_0x3fca('0x21')][_0x3fca('0x1c')](this));ami['on'](_0x3fca('0x22'),this[_0x3fca('0x23')]['bind'](this));ami['on'](_0x3fca('0x24'),this['syncAttendedTransfer'][_0x3fca('0x1c')](this));ami['on'](_0x3fca('0x25'),this[_0x3fca('0x26')]['bind'](this));this[_0x3fca('0x27')](this[_0x3fca('0x14')]);}function emit(_0x243248,_0x1d53d6,_0x3c7170){io['to'](_0x243248)['emit'](_0x1d53d6,_0x3c7170);}function emitCampaignPreview(_0x5af02a){if(_0x5af02a[_0x3fca('0x28')]===_0x3fca('0x29')){var _0x41adf2={'id':_0x5af02a['id'],'name':_0x5af02a[_0x3fca('0x2a')],'strategy':_0x5af02a[_0x3fca('0x2b')],'answered':_0x5af02a[_0x3fca('0x2c')],'available':_0x5af02a['available'],'loggedIn':_0x5af02a[_0x3fca('0x2d')],'pTalking':_0x5af02a[_0x3fca('0x2e')],'sumBillable':_0x5af02a[_0x3fca('0x2f')],'sumDuration':_0x5af02a['sumDuration'],'sumHoldTime':_0x5af02a['sumHoldTime']||0x0,'talking':_0x5af02a[_0x3fca('0x30')],'total':_0x5af02a[_0x3fca('0x31')],'type':_0x5af02a['type'],'unmanaged':_0x5af02a[_0x3fca('0x32')],'abandoned':_0x5af02a[_0x3fca('0x33')],'waiting':_0x5af02a[_0x3fca('0x34')],'loggedInDb':_0x5af02a[_0x3fca('0x35')],'dialActive':_0x5af02a['dialActive'],'dialMethod':_0x5af02a['dialMethod'],'dialOriginateCallerIdName':_0x5af02a['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5af02a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x5af02a['dialOriginateTimeout'],'dialPrefix':_0x5af02a['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5af02a[_0x3fca('0x36')],'outboundAnswerCallsDay':_0x5af02a[_0x3fca('0x37')],'outboundBlacklistCallsDay':_0x5af02a[_0x3fca('0x38')],'outboundBusyCallsDay':_0x5af02a[_0x3fca('0x39')],'outboundCongestionCallsDay':_0x5af02a[_0x3fca('0x3a')],'outboundDropCallsDayACS':_0x5af02a[_0x3fca('0x3b')],'outboundDropCallsDayCallersExit':_0x5af02a[_0x3fca('0x3c')],'outboundDropCallsDayTimeout':_0x5af02a[_0x3fca('0x3d')],'outboundNoAnswerCallsDay':_0x5af02a[_0x3fca('0x3e')],'outboundNoSuchCallsDay':_0x5af02a[_0x3fca('0x3f')],'outboundOriginateFailureCallsDay':_0x5af02a[_0x3fca('0x40')],'outboundReCallsDay':_0x5af02a[_0x3fca('0x41')],'outboundRejectCallsDay':_0x5af02a[_0x3fca('0x42')],'outboundUnknownCallsDay':_0x5af02a[_0x3fca('0x43')],'outboundAbandonedCallsDay':_0x5af02a[_0x3fca('0x44')],'predictiveIntervalAnsweredCalls':_0x5af02a['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5af02a[_0x3fca('0x45')],'predictiveIntervalAvgTalktime':_0x5af02a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5af02a[_0x3fca('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x5af02a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x5af02a[_0x3fca('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x5af02a[_0x3fca('0x48')],'predictiveIntervalHitRate':_0x5af02a[_0x3fca('0x49')],'predictiveIntervalMultiplicativeFactor':_0x5af02a[_0x3fca('0x4a')],'predictiveIntervalPauses':_0x5af02a[_0x3fca('0x4b')],'predictiveIntervalAvailable':_0x5af02a['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5af02a['predictiveIntervalTotalCalls'],'message':_0x5af02a[_0x3fca('0x4c')],'originated':_0x5af02a['originated'],'erlangCalls':_0x5af02a[_0x3fca('0x4d')],'erlangCallToSecond':_0x5af02a['erlangCallToSecond'],'erlangAbandonmentRate':_0x5af02a[_0x3fca('0x4e')],'erlangBusyFactor':_0x5af02a[_0x3fca('0x4f')],'startPredictive':_0x5af02a['startPredictive'],'startProgressive':_0x5af02a[_0x3fca('0x50')]};if(_0x5af02a[_0x3fca('0x51')]){_0x41adf2['Trunk']={'id':_0x5af02a[_0x3fca('0x51')]['id'],'name':_0x5af02a[_0x3fca('0x51')][_0x3fca('0x2a')],'active':_0x5af02a['Trunk'][_0x3fca('0x52')],'callerid':_0x5af02a[_0x3fca('0x51')][_0x3fca('0x53')]};}if(_0x5af02a[_0x3fca('0x54')]){_0x41adf2[_0x3fca('0x54')]={'id':_0x5af02a['Interval']['id'],'name':_0x5af02a['Interval'][_0x3fca('0x2a')]};}var _0x2d2ae5=md5(JSON[_0x3fca('0x55')](_0x41adf2));if(_0x5af02a['md5']!==_0x2d2ae5){_0x5af02a['md5']=_0x2d2ae5;emit(util[_0x3fca('0x56')](_0x3fca('0x57'),_0x41adf2[_0x3fca('0x2a')]),'voice_queue:save',_0x41adf2);}}}function emitVoiceQueueChannelRemove(_0x49051e){logger[_0x3fca('0x58')](_0x3fca('0x59'),JSON[_0x3fca('0x55')](_0x49051e));emit(util['format']('voice:queue:%s',_0x49051e[_0x3fca('0x2a')]),'voice_queue_channel:remove',_0x49051e);io[_0x3fca('0x5a')](_0x3fca('0x5b'),_0x49051e);}function notSendMessagesQueue(_0x3d8a80){if(_0x3d8a80[_0x3fca('0x5c')]){if(_0x3d8a80[_0x3fca('0x5d')]===0x0&&_0x3d8a80[_0x3fca('0x2e')]===0x0){_0x3d8a80[_0x3fca('0x5c')]=![];_0x3d8a80[_0x3fca('0x5e')]=0x0;_0x3d8a80[_0x3fca('0x5f')]=0x0;_0x3d8a80[_0x3fca('0x4c')]=_0x3fca('0x60');ut['logger'](_0x3fca('0x61'),_0x3d8a80[_0x3fca('0x2a')]+_0x3fca('0x62'));}else{_0x3d8a80[_0x3fca('0x4c')]=_0x3fca('0x63');ut['logger'](_0x3fca('0x61'),_0x3d8a80['name']+_0x3fca('0x64'));}emitCampaignPreview(_0x3d8a80);}}Preview[_0x3fca('0xf')][_0x3fca('0x27')]=function(){var _0x1f40d8=this;setInterval(function(){_0x1f40d8[_0x3fca('0x65')]();},0x7cf);};Preview[_0x3fca('0xf')][_0x3fca('0x65')]=function(){var _0x52ebe3=this[_0x3fca('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x2772da in _0x52ebe3){if(_0x52ebe3[_0x3fca('0x66')](_0x2772da)&&(_0x52ebe3[_0x2772da][_0x3fca('0x67')]===_0x3fca('0x68')||_0x52ebe3[_0x2772da][_0x3fca('0x67')]===_0x3fca('0x69'))&&_0x52ebe3[_0x2772da][_0x3fca('0x28')]===_0x3fca('0x29')){if(this[_0x3fca('0x19')]>0x7){this[_0x3fca('0x19')]=0x0;this[_0x3fca('0x6a')]();}}if(_0x52ebe3[_0x3fca('0x66')](_0x2772da)&&_0x52ebe3[_0x2772da][_0x3fca('0x67')]===_0x3fca('0x68')&&_0x52ebe3[_0x2772da]['type']==='outbound'){if(_0x52ebe3[_0x2772da]['dialActive']){this[_0x3fca('0x6b')](_0x52ebe3[_0x2772da]);this[_0x3fca('0x6c')](_0x52ebe3[_0x2772da]);}else{notSendMessagesQueue(_0x52ebe3[_0x2772da]);}}}};Preview[_0x3fca('0xf')][_0x3fca('0x6d')]=function(_0x287f08){var _0xef97b0=this;this['sequence'][_0x3fca('0x10')](function(){if(!_['isNil'](_0xef97b0[_0x3fca('0x17')][_0x287f08])){loggerAction[_0x3fca('0x58')](_0x3fca('0x6e'),_0x287f08,_0x3fca('0x6f'),_0xef97b0[_0x3fca('0x17')][_0x287f08][_0x3fca('0x70')],_0x3fca('0x71'),JSON[_0x3fca('0x55')](_0xef97b0[_0x3fca('0x14')][_0xef97b0[_0x3fca('0x17')][_0x287f08][_0x3fca('0x70')]][_0x3fca('0x5d')]),'pTalking:\x20',JSON['stringify'](_0xef97b0[_0x3fca('0x14')][_0xef97b0[_0x3fca('0x17')][_0x287f08]['queue']][_0x3fca('0x2e')]),JSON[_0x3fca('0x55')](_0xef97b0['actions'][_0x287f08]['dialAnswer']),JSON[_0x3fca('0x55')](_[_0x3fca('0x72')](_0xef97b0[_0x3fca('0x17')][_0x287f08],['contactId',_0x3fca('0x73'),_0x3fca('0x74'),_0x3fca('0x75')])));return ami[_0x3fca('0x76')]({'action':'status','channel':_0xef97b0['actions'][_0x287f08]['channel']})[_0x3fca('0x77')](function(_0x2f8352){if(_0x2f8352[_0x3fca('0x4c')]===_0x3fca('0x78')){setTimeout(function(){if(_0xef97b0[_0x3fca('0x17')][_0x287f08]){ut['updateOriginated'](_0xef97b0[_0x3fca('0x14')][_0xef97b0[_0x3fca('0x17')][_0x287f08][_0x3fca('0x70')]],'[clearZombieChannel]');if(_0xef97b0['actions'][_0x287f08][_0x3fca('0x79')]===!![]){ut[_0x3fca('0x7a')](_0xef97b0[_0x3fca('0x14')][_0xef97b0[_0x3fca('0x17')][_0x287f08]['queue']],_0x3fca('0x7b'));ut[_0x3fca('0x7c')](_0x3fca('0x7d')+_0x287f08,_0xef97b0[_0x3fca('0x17')][_0x287f08][_0x3fca('0x70')]);}ut[_0x3fca('0x7c')]('[Dialer][checkChannel][Preview]'+_0x287f08,_0xef97b0['actions'][_0x287f08][_0x3fca('0x70')]);delete _0xef97b0[_0x3fca('0x17')][_0x287f08];}},0x2328);}});}});};Preview['prototype'][_0x3fca('0x6a')]=function(){var _0x190156=this;loggerAction[_0x3fca('0x58')](_0x3fca('0x7e'),_[_0x3fca('0x7f')](this[_0x3fca('0x17')]));for(var _0x46397d in this['actions']){if(_0x190156[_0x3fca('0x17')][_0x3fca('0x66')](_0x46397d)){_0x190156[_0x3fca('0x6d')](_0x46397d);}}};Preview[_0x3fca('0xf')][_0x3fca('0x6c')]=function(_0x2fb588){var _0x5cdc8c=this;rpcDb['getContactRecallMe'](_0x2fb588['id'],ut[_0x3fca('0x80')](this[_0x3fca('0x18')]))['then'](function(_0x5466cf){if(!_[_0x3fca('0x81')](_0x5466cf)){for(var _0x3ccaeb=0x0;_0x3ccaeb<_0x5466cf['length'];_0x3ccaeb+=0x1){if(ut[_0x3fca('0x82')](_0x5466cf[_0x3ccaeb][_0x3fca('0x83')])<_0x2fb588['dialRecallMeTimeout']*0x3c){if(_0x5466cf[_0x3ccaeb]['Agent']&&!_0x5466cf[_0x3ccaeb][_0x3fca('0x84')]['voicePause']){_0x5cdc8c[_0x3fca('0x85')](_0x5466cf[_0x3ccaeb]['id'])[_0x3fca('0x86')](ut[_0x3fca('0x87')](_0x3fca('0x88')))[_0x3fca('0x77')](ut[_0x3fca('0x87')](_0x3fca('0x88')));}else{rpcDb[_0x3fca('0x89')](_0x5466cf[_0x3ccaeb]['id']);}}else{var _0x530e50=new Action(_0x5466cf[_0x3ccaeb],_0x2fb588);_0x530e50[_0x3fca('0x8a')]=moment()[_0x3fca('0x56')](_0x3fca('0x8b'));_0x2fb588[_0x3fca('0x41')]+=0x1;ut['logCustomer'](_0x530e50,0x17,_0x3fca('0x8c'));if(_0x2fb588[_0x3fca('0x8d')]){rpcDb[_0x3fca('0x8e')](ut[_0x3fca('0x8f')](_0x5466cf[_0x3ccaeb]));rpcDb[_0x3fca('0x90')](_0x530e50,_0x3fca('0x91'));}else{ut['logCustomer'](_0x530e50,0x16,'RecallFailedTimeout');rpcDb[_0x3fca('0x90')](_0x530e50,_0x3fca('0x92'));rpcDb['createCustomerFinal'](_0x530e50,_0x3fca('0x92'));}}}}})[_0x3fca('0x77')](ut[_0x3fca('0x87')]('[getContactRecallMe]'));};Preview[_0x3fca('0xf')]['setMessage']=function(_0x4213af){_0x4213af[_0x3fca('0x5c')]=!![];if(ut[_0x3fca('0x93')](_0x4213af[_0x3fca('0x2d')])){_0x4213af[_0x3fca('0x4c')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x3fca('0x94')](_0x4213af[_0x3fca('0x95')])){_0x4213af[_0x3fca('0x4c')]='NOT_ACTIVE';}else if(!this[_0x3fca('0x96')](_0x4213af[_0x3fca('0x51')])){if(!this[_0x3fca('0x96')](_0x4213af[_0x3fca('0x97')])){_0x4213af[_0x3fca('0x4c')]=_0x3fca('0x98');}else{_0x4213af[_0x3fca('0x4c')]=_0x3fca('0x99');}}else{_0x4213af[_0x3fca('0x4c')]=_0x3fca('0x99');}emitCampaignPreview(_0x4213af);};Preview[_0x3fca('0xf')][_0x3fca('0x9a')]=function(_0x3fd592,_0x1f4594,_0x1eb777){var _0x5dbca0=this;var _0x11681b=this[_0x3fca('0x17')][_0x1f4594];var _0x32ae9a=this['campaignsPreview'][_0x11681b[_0x3fca('0x70')]];var _0x462ad8;var _0x4f90be=![];var _0x2a0b06=0x2;var _0x2ccf49=0x3;if(_0x32ae9a){switch(_0x1eb777){case'1':_0x32ae9a['outboundNoSuchCallsDay']+=0x1;_0x11681b['countnosuchnumberretry']+=0x1;_0x11681b[_0x3fca('0x9b')]=ut[_0x3fca('0x9c')](_0x11681b);ut[_0x3fca('0x9d')](_0x11681b,0x0,_0x3fca('0x9e'));ami[_0x3fca('0x5a')](_0x3fca('0x9f'),ut[_0x3fca('0xa0')](_0x11681b,_0x3fca('0xa1')));rpcDb[_0x3fca('0x90')](_0x11681b,_0x3fca('0xa2'));_0x5dbca0[_0x3fca('0xa3')](_0x11681b,'0',_0x32ae9a)[_0x3fca('0x86')](function(_0x18f2de){_0x4f90be=_0x18f2de[_0x3fca('0xa4')]==0x1;_0x2a0b06=_0x32ae9a[_0x3fca('0xa5')];_0x2ccf49=_0x32ae9a[_0x3fca('0xa6')];if(!_0x4f90be){if(ut['totalGlobal'](_0x11681b)>=_0x32ae9a[_0x3fca('0xa7')]){_0x462ad8=ut[_0x3fca('0xa8')](_0x11681b,0xf,_0x3fca('0xa9'));rpcDb[_0x3fca('0xaa')](_0x462ad8,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x11681b[_0x3fca('0xab')]>=_0x32ae9a['dialNoSuchNumberMaxRetry']){rpcDb[_0x3fca('0xaa')](_0x11681b,_0x3fca('0xac'));}else{rpcDb['rescheduleContact'](ut[_0x3fca('0xad')](_0x11681b,_0x3fca('0xab'),_0x32ae9a['dialNoSuchNumberRetryFrequency']),_0x11681b[_0x3fca('0xae')],_0x11681b[_0x3fca('0xaf')]);}}delete this[_0x3fca('0x17')][_0x3fd592[_0x3fca('0xb0')]];}else{_0x11681b[_0x3fca('0xab')]++;logger[_0x3fca('0x58')](_0x3fca('0xb1'),_0x11681b[_0x3fca('0xab')]);logger[_0x3fca('0x58')]('id',_0x11681b[_0x3fca('0xb2')]);_0x5dbca0[_0x3fca('0xb3')]({'id':_0x11681b['idContact'],'field':{'countnosuchnumberretry':_0x11681b[_0x3fca('0xab')]}})[_0x3fca('0x86')](function(){_0x5dbca0[_0x3fca('0xb4')](_0x11681b,_0x2a0b06,_0x2ccf49)[_0x3fca('0x86')](function(){});});}});break;case _0x3fca('0xb5'):var _0x302108=moment()[_0x3fca('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x11681b[_0x3fca('0xb6')]=_0x302108;_0x11681b['answertime']=_0x302108;_0x11681b[_0x3fca('0x79')]=!![];_0x32ae9a[_0x3fca('0x2e')]+=0x1;logger[_0x3fca('0x58')](_0x3fca('0xb7'),_0x11681b[_0x3fca('0xb8')],_0x3fca('0xb9'),_0x32ae9a['name'],_0x3fca('0xba'),_0x32ae9a[_0x3fca('0x2e')]);ami[_0x3fca('0x5a')]('custom:agentconnect',ut[_0x3fca('0xa0')](_0x11681b,_0x3fca('0xbb'),this[_0x3fca('0x14')][_0x11681b[_0x3fca('0x70')]]));if(_0x32ae9a['acw']){ami[_0x3fca('0x5a')](_0x3fca('0xbc'),ut[_0x3fca('0xbd')](_0x11681b));}break;case'16':ami[_0x3fca('0x5a')](_0x3fca('0xbe'),ut[_0x3fca('0xa0')](_0x11681b,_0x3fca('0xbf'),this[_0x3fca('0x14')][_0x11681b['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x11681b,_0x3fca('0xbf')));_0x32ae9a[_0x3fca('0x37')]+=0x1;_0x32ae9a[_0x3fca('0x31')]+=0x1;_0x32ae9a[_0x3fca('0x2c')]+=0x1;ut[_0x3fca('0x7a')](_0x32ae9a,_0x3fca('0xc0'));_0x11681b[_0x3fca('0x9b')]=ut[_0x3fca('0x9c')](_0x11681b);ut[_0x3fca('0x9d')](_0x11681b,0x4,_0x3fca('0xc1'));rpcDb[_0x3fca('0x90')](_0x11681b,_0x3fca('0xc2'));rpcDb['createCustomerFinal'](_0x11681b,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x3fca('0xc3')](_0x11681b);_0x32ae9a[_0x3fca('0xc4')]+=_0x11681b['talktime'];_0x32ae9a[_0x3fca('0x2f')]+=_0x11681b[_0x3fca('0xc5')];logger['info']('[syncHangup][talking][decrement]',_0x11681b[_0x3fca('0xb8')],_0x3fca('0xb9'),_0x32ae9a[_0x3fca('0x2a')],_0x3fca('0xba'),_0x32ae9a[_0x3fca('0x2e')]);delete this[_0x3fca('0x17')][_0x3fd592['linkedid']];break;case _0x3fca('0xc6'):_0x32ae9a[_0x3fca('0x39')]+=0x1;_0x11681b['countbusyretry']+=0x1;_0x11681b[_0x3fca('0x9b')]=ut[_0x3fca('0x9c')](_0x11681b);ut[_0x3fca('0x9d')](_0x11681b,0x5,'Busy');_0x2a0b06=_0x32ae9a[_0x3fca('0xc7')];_0x2ccf49=_0x32ae9a['callAdditionalPhoneAfterMin'];ami[_0x3fca('0x5a')](_0x3fca('0xc8'),ut['buildObj'](_0x11681b,_0x3fca('0xc9')));rpcDb[_0x3fca('0x90')](_0x11681b,'[callProgressDetectingCustomer][logBusy]');_0x5dbca0[_0x3fca('0xa3')](_0x11681b,'5',_0x32ae9a)[_0x3fca('0x86')](function(_0x1cbab8){_0x4f90be=_0x1cbab8[_0x3fca('0xa4')]==0x1;if(!_0x4f90be){if(ut[_0x3fca('0x9c')](_0x11681b)>=_0x32ae9a[_0x3fca('0xa7')]){_0x462ad8=ut[_0x3fca('0xa8')](_0x11681b,0xf,_0x3fca('0xa9'));rpcDb[_0x3fca('0xaa')](_0x462ad8,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x11681b[_0x3fca('0xca')]>=_0x32ae9a[_0x3fca('0xcb')]){rpcDb[_0x3fca('0xaa')](_0x11681b,_0x3fca('0xcc'));}else{rpcDb[_0x3fca('0xcd')](ut[_0x3fca('0xad')](_0x11681b,'countbusyretry',_0x32ae9a[_0x3fca('0xc7')]),_0x11681b['unlockAgent'],_0x11681b[_0x3fca('0xaf')]);}}}else{_0x11681b['countbusyretry']++;_0x5dbca0[_0x3fca('0xb3')]({'id':_0x11681b[_0x3fca('0xb2')],'field':{'countbusyretry':_0x11681b[_0x3fca('0xca')]}})[_0x3fca('0x86')](function(){_0x5dbca0[_0x3fca('0xb4')](_0x11681b,_0x2a0b06,_0x2ccf49)[_0x3fca('0x86')](function(){});});}});break;case _0x3fca('0xce'):_0x32ae9a[_0x3fca('0x3e')]+=0x1;_0x11681b[_0x3fca('0xcf')]+=0x1;_0x11681b['countglobal']=ut[_0x3fca('0x9c')](_0x11681b);ut[_0x3fca('0x9d')](_0x11681b,0x3,'NoAnswer');_0x2a0b06=_0x32ae9a[_0x3fca('0xd0')];_0x2ccf49=_0x32ae9a[_0x3fca('0xa6')];ami['emit'](_0x3fca('0xd1'),ut[_0x3fca('0xa0')](_0x11681b,_0x3fca('0xd2')));rpcDb['createCustomerHistory'](_0x11681b,_0x3fca('0xd3'));_0x5dbca0[_0x3fca('0xa3')](_0x11681b,'3',_0x32ae9a)[_0x3fca('0x86')](function(_0x3840fe){_0x4f90be=_0x3840fe[_0x3fca('0xa4')]==0x1;if(!_0x4f90be){if(ut[_0x3fca('0x9c')](_0x11681b)>=_0x32ae9a[_0x3fca('0xa7')]){_0x462ad8=ut['cloneAction'](_0x11681b,0xf,_0x3fca('0xa9'));rpcDb[_0x3fca('0xaa')](_0x462ad8,_0x3fca('0xd4'));}else{if(_0x11681b[_0x3fca('0xcf')]>=_0x32ae9a[_0x3fca('0xd5')]){rpcDb['createCustomerFinal'](_0x11681b,_0x3fca('0xd3'));}else{rpcDb[_0x3fca('0xcd')](ut[_0x3fca('0xad')](_0x11681b,_0x3fca('0xcf'),_0x32ae9a['dialNoAnswerRetryFrequency']),_0x11681b[_0x3fca('0xae')],_0x11681b[_0x3fca('0xaf')]);}}}else{_0x11681b[_0x3fca('0xcf')]++;_0x5dbca0[_0x3fca('0xb3')]({'id':_0x11681b['idContact'],'field':{'countnoanswerretry':_0x11681b[_0x3fca('0xcf')]}})[_0x3fca('0x86')](function(){_0x5dbca0[_0x3fca('0xb4')](_0x11681b,_0x2a0b06,_0x2ccf49)[_0x3fca('0x86')](function(){});});}});break;case _0x3fca('0xd6'):_0x32ae9a[_0x3fca('0x3a')]+=0x1;_0x11681b[_0x3fca('0xd7')]+=0x1;_0x11681b[_0x3fca('0x9b')]=ut['totalGlobal'](_0x11681b);ut[_0x3fca('0x9d')](_0x11681b,0x8,_0x3fca('0xd8'));_0x2a0b06=_0x32ae9a[_0x3fca('0xd9')];_0x2ccf49=_0x32ae9a[_0x3fca('0xa6')];ami['emit'](_0x3fca('0xda'),ut[_0x3fca('0xa0')](_0x11681b,_0x3fca('0xdb')));rpcDb[_0x3fca('0x90')](_0x11681b,_0x3fca('0xdc'));_0x5dbca0[_0x3fca('0xa3')](_0x11681b,'8',_0x32ae9a)['then'](function(_0x478384){_0x4f90be=_0x478384[_0x3fca('0xa4')]==0x1;if(!_0x4f90be){if(ut[_0x3fca('0x9c')](_0x11681b)>=_0x32ae9a[_0x3fca('0xa7')]){_0x462ad8=ut[_0x3fca('0xa8')](_0x11681b,0xf,_0x3fca('0xa9'));rpcDb[_0x3fca('0xaa')](_0x462ad8,_0x3fca('0xdd'));}else{if(_0x11681b[_0x3fca('0xd7')]>=_0x32ae9a[_0x3fca('0xde')]){rpcDb['createCustomerFinal'](_0x11681b,_0x3fca('0xdc'));}else{rpcDb[_0x3fca('0xcd')](ut['scheduledAt'](_0x11681b,_0x3fca('0xd7'),_0x32ae9a[_0x3fca('0xc7')]),_0x11681b[_0x3fca('0xae')],_0x11681b[_0x3fca('0xaf')]);}}}else{_0x11681b['countcongestionretry']++;_0x5dbca0[_0x3fca('0xb3')]({'id':_0x11681b[_0x3fca('0xb2')],'field':{'countcongestionretry':_0x11681b[_0x3fca('0xd7')]}})[_0x3fca('0x86')](function(){_0x5dbca0['swapAdditionalPhones'](_0x11681b,_0x2a0b06,_0x2ccf49)[_0x3fca('0x86')](function(){});});}});break;case _0x3fca('0xdf'):_0x32ae9a['outboundRejectCallsDay']+=0x1;_0x11681b['countagentrejectretry']+=0x1;_0x11681b[_0x3fca('0x9b')]=ut[_0x3fca('0x9c')](_0x11681b);ut[_0x3fca('0x9d')](_0x11681b,0x14,_0x3fca('0xe0'));_0x2a0b06=_0x32ae9a[_0x3fca('0xe1')];_0x2ccf49=_0x32ae9a['callAdditionalPhoneAfterMin'];ami[_0x3fca('0x5a')](_0x3fca('0xe2'),ut[_0x3fca('0xa0')](_0x11681b,_0x3fca('0xe3')));rpcDb[_0x3fca('0x90')](_0x11681b,_0x3fca('0xe4'));_0x5dbca0[_0x3fca('0xa3')](_0x11681b,'20',_0x32ae9a)[_0x3fca('0x86')](function(_0x2afa54){_0x4f90be=_0x2afa54[_0x3fca('0xa4')]==0x1;if(!_0x4f90be){if(ut[_0x3fca('0x9c')](_0x11681b)>=_0x32ae9a[_0x3fca('0xa7')]){_0x462ad8=ut['cloneAction'](_0x11681b,0x14,'AgentReject');rpcDb[_0x3fca('0xaa')](_0x462ad8,_0x3fca('0xe5'));}else{if(_0x11681b[_0x3fca('0xe6')]>=_0x32ae9a['dialAgentRejectMaxRetry']){rpcDb[_0x3fca('0xaa')](_0x11681b,_0x3fca('0xe5'));}else{rpcDb[_0x3fca('0xcd')](ut['scheduledAt'](_0x11681b,'countagentrejectretry',_0x32ae9a[_0x3fca('0xe1')]),_0x11681b[_0x3fca('0xae')],_0x11681b[_0x3fca('0xaf')]);}}}else{_0x11681b['countnoanswerretry']++;_0x5dbca0[_0x3fca('0xb3')]({'id':_0x11681b[_0x3fca('0xb2')],'field':{'countnoanswerretry':_0x11681b[_0x3fca('0xcf')]}})['then'](function(){_0x5dbca0[_0x3fca('0xb4')](_0x11681b,_0x2a0b06,_0x2ccf49)[_0x3fca('0x86')](function(){});});}});break;case _0x3fca('0xe7'):_0x32ae9a[_0x3fca('0x44')]+=0x1;_0x11681b[_0x3fca('0xe8')]+=0x1;_0x11681b[_0x3fca('0x9b')]=ut[_0x3fca('0x9c')](_0x11681b);ut[_0x3fca('0x9d')](_0x11681b,0xb,'Abandoned');rpcDb[_0x3fca('0x90')](_0x11681b,_0x3fca('0xe9'));if(ut[_0x3fca('0x9c')](_0x11681b)>=_0x32ae9a[_0x3fca('0xa7')]){_0x462ad8=ut[_0x3fca('0xa8')](_0x11681b,0xf,'Global');rpcDb[_0x3fca('0xaa')](_0x462ad8,_0x3fca('0xe9'));}else{if(_0x11681b[_0x3fca('0xea')]>=_0x32ae9a[_0x3fca('0xeb')]){rpcDb[_0x3fca('0xaa')](_0x11681b,_0x3fca('0xe9'));}else{rpcDb[_0x3fca('0xcd')](ut[_0x3fca('0xad')](_0x11681b,_0x3fca('0xe8'),_0x32ae9a[_0x3fca('0xec')]),_0x11681b[_0x3fca('0xae')],_0x11681b[_0x3fca('0xaf')]);}}break;case'18':_0x32ae9a[_0x3fca('0x43')]+=0x1;_0x11681b[_0x3fca('0xed')]+=0x1;_0x11681b[_0x3fca('0x9b')]=ut[_0x3fca('0x9c')](_0x11681b);ut['logCustomer'](_0x11681b,0x12,_0x3fd592[_0x3fca('0xee')]||_0x3fd592['dialstatus']);ami[_0x3fca('0x5a')](_0x3fca('0xef'),ut[_0x3fca('0xa0')](_0x11681b,_0x3fca('0xf0')));rpcDb[_0x3fca('0x90')](_0x11681b,_0x3fca('0xf1'));if(ut[_0x3fca('0x9c')](_0x11681b)>=_0x32ae9a['dialGlobalMaxRetry']){_0x462ad8=ut[_0x3fca('0xa8')](_0x11681b,0xf,'Global');rpcDb[_0x3fca('0xaa')](_0x462ad8,_0x3fca('0xf1'));}else{rpcDb[_0x3fca('0xaa')](_0x11681b,_0x3fca('0xf1'));}delete this[_0x3fca('0x17')][_0x3fd592[_0x3fca('0xb0')]];break;case'19':_0x32ae9a[_0x3fca('0x43')]+=0x1;_0x11681b[_0x3fca('0x9b')]=ut['totalGlobal'](_0x11681b);ut[_0x3fca('0x9d')](_0x11681b,0x13,_0x3fd592[_0x3fca('0xee')]||_0x3fd592[_0x3fca('0xf2')]);ami[_0x3fca('0x5a')]('custom:amd',ut[_0x3fca('0xa0')](_0x11681b,_0x3fca('0xf0')));rpcDb['createCustomerHistory'](_0x11681b,'[callProgressDetectingCustomer][machine]');if(ut[_0x3fca('0x9c')](_0x11681b)>=_0x32ae9a[_0x3fca('0xa7')]){_0x462ad8=ut[_0x3fca('0xa8')](_0x11681b,0xf,_0x3fca('0xa9'));rpcDb[_0x3fca('0xaa')](_0x462ad8,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x3fca('0xaa')](_0x11681b,'[callProgressDetectingCustomer][machine]');}delete this[_0x3fca('0x17')][_0x3fd592[_0x3fca('0xb0')]];break;default:if(_0x11681b['dialAnswer']){ut[_0x3fca('0x7a')](_0x32ae9a,'[default]');ut[_0x3fca('0x7c')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x32ae9a[_0x3fca('0x2a')],_0x3fd592);}_0x32ae9a[_0x3fca('0x43')]+=0x1;_0x11681b[_0x3fca('0x9b')]=ut[_0x3fca('0x9c')](_0x11681b);ut[_0x3fca('0x9d')](_0x11681b,0xc,_0x3fd592['cause-txt']||_0x3fd592['dialstatus']);_0x2a0b06=_0x32ae9a[_0x3fca('0xe1')];_0x2ccf49=_0x32ae9a[_0x3fca('0xa6')];rpcDb[_0x3fca('0x90')](_0x11681b,_0x3fca('0xf3'));_0x5dbca0[_0x3fca('0xa3')](_0x11681b,'20',_0x32ae9a)[_0x3fca('0x86')](function(_0xf53e4e){_0x4f90be=_0xf53e4e['additional']==0x1;if(!_0x4f90be){if(ut['totalGlobal'](_0x11681b)>=_0x32ae9a[_0x3fca('0xa7')]){_0x462ad8=ut[_0x3fca('0xa8')](_0x11681b,0xf,_0x3fca('0xa9'));rpcDb[_0x3fca('0xaa')](_0x462ad8,_0x3fca('0xf4'));}else{rpcDb['createCustomerFinal'](_0x11681b,_0x3fca('0xf4'));}delete this[_0x3fca('0x17')][_0x3fd592['linkedid']];}else{_0x5dbca0['swapAdditionalPhones'](_0x11681b,_0x2a0b06,_0x2ccf49)['then'](function(_0x2ab496){});}});}if(!(_0x11681b['dialAnswer']&&_0x1eb777==='16')){ut[_0x3fca('0xf5')](_0x32ae9a,'[callProgressDetectingCustomer]');logger[_0x3fca('0x58')]('[originated][decrement][callProgressDetectingCustomer]',_0x11681b[_0x3fca('0xb8')],'\x20Queue',_0x32ae9a['name'],_0x3fca('0x71'),_0x32ae9a[_0x3fca('0x5d')]);}if(_0x1eb777!==_0x3fca('0xb5')){delete this[_0x3fca('0x17')][_0x3fd592[_0x3fca('0xb0')]];delete this[_0x3fca('0x17')][_0x3fd592[_0x3fca('0xf6')]];}}};Preview[_0x3fca('0xf')][_0x3fca('0xf7')]=function(_0x38d974,_0x45d6cb,_0x3c582b){if(_['isUndefined'](_0x45d6cb)&&_0x3fca('0xf8')!==typeof _0x45d6cb){return;}if(_[_0x3fca('0xf9')](_0x3c582b)&&'object'!==typeof _0x3c582b){return;}switch(_0x3c582b[_0x3fca('0xfa')]){case'0':ut['logAgent'](_0x38d974,0x0,_0x3fca('0x9e'));rpcDb[_0x3fca('0xfb')](_0x38d974,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x3fca('0xfc')](_0x38d974,0x3,_0x3fca('0xfd'));rpcDb[_0x3fca('0xfb')](_0x38d974,_0x3fca('0xfe'));break;case'5':ut[_0x3fca('0xfc')](_0x38d974,0x5,'Busy');rpcDb['createAgentHistory'](_0x38d974,_0x3fca('0xff'));break;case'8':ut[_0x3fca('0xfc')](_0x38d974,0x8,_0x3fca('0xd8'));rpcDb[_0x3fca('0xfb')](_0x38d974,_0x3fca('0x100'));break;case'22':ut['logAgent'](_0x38d974,0x16,'AnswerAGI');rpcDb[_0x3fca('0xfb')](_0x38d974,_0x3fca('0x101'));break;default:ut[_0x3fca('0xfc')](_0x38d974,0xc,_0x3c582b[_0x3fca('0xfa')]);rpcDb['createAgentHistory'](_0x38d974,_0x3fca('0x100'));}ut[_0x3fca('0xf5')](_0x45d6cb,'[callProgressDetectingAgent]');logger[_0x3fca('0x58')](_0x3fca('0x102'),_0x38d974[_0x3fca('0xb8')],_0x3fca('0xb9'),_0x45d6cb[_0x3fca('0x2a')],_0x3fca('0x71'),_0x45d6cb[_0x3fca('0x5d')]);delete this[_0x3fca('0x17')][_0x38d974[_0x3fca('0xb8')]];};Preview[_0x3fca('0xf')][_0x3fca('0xa3')]=function(_0x9c2b72,_0x25e0f0,_0x3ace32){return BPromise['resolve']()['then'](cmHopperAdditionalPhone[_0x3fca('0xa3')](_0x9c2b72,_0x25e0f0,_0x3ace32))[_0x3fca('0x77')](logger[_0x3fca('0x58')](_0x3fca('0x103')));};Preview[_0x3fca('0xf')]['swapAdditionalPhones']=function(_0x510f63,_0x18266b,_0x24b879){return BPromise[_0x3fca('0x104')]()[_0x3fca('0x86')](cmHopperAdditionalPhone[_0x3fca('0xb4')](_0x510f63,_0x18266b,_0x24b879))['catch'](logger[_0x3fca('0x58')](_0x3fca('0x105')));};Preview[_0x3fca('0xf')][_0x3fca('0xb3')]=function(_0x11b4db){return BPromise[_0x3fca('0x104')]()[_0x3fca('0x86')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x11b4db))['catch'](logger[_0x3fca('0x58')](_0x3fca('0x106')));};Preview[_0x3fca('0xf')][_0x3fca('0x107')]=function(_0x31466c,_0xefc586,_0x19fef6,_0x3f9529,_0x16a901){var _0x100a40=this;return new BPromise(function(_0x42c8bf,_0xee2e75){if(_[_0x3fca('0x81')](_0xefc586)||_[_0x3fca('0x81')](_0xefc586[_0x3fca('0x108')])||_[_0x3fca('0x81')](_0xefc586['phone'])||_[_0x3fca('0x81')](_0xefc586['VoiceQueueId'])){_0xee2e75(ut[_0x3fca('0x4c')](_0x3fca('0x109'),_0x3f9529,_0x16a901));return;}var _0x2f51ba=uuid['v4']();var _0x93f2e1=_0x100a40[_0x3fca('0x14')][_0xefc586[_0x3fca('0x6f')]['name']];var _0x548ae8=_0x19fef6?_0x100a40[_0x3fca('0x18')][_0x19fef6]['id']:undefined;_0x100a40[_0x3fca('0x17')][_0x2f51ba]=new Action(_0xefc586,_0x93f2e1,_0x2f51ba,_0x19fef6,_0x548ae8);var _0x39a881=_0x100a40[_0x3fca('0x17')][_0x2f51ba];_0x39a881[_0x3fca('0xae')]=_0x3f9529;_0x39a881[_0x3fca('0xaf')]=_0x16a901;_0x39a881[_0x3fca('0x10a')]=_0x19fef6;if(_[_0x3fca('0x10b')](_0x31466c)){_0x100a40['execCall'](_0x39a881,_0x93f2e1,_0xefc586,_0x19fef6)[_0x3fca('0x86')](function(_0x1b8ef6){logger[_0x3fca('0x58')](_0x3fca('0x10c'),_0x3fca('0x10d')+_0x39a881[_0x3fca('0x70')]+'\x20IdHopper:\x20'+_0x39a881['idContact'],JSON[_0x3fca('0x55')](_0x1b8ef6));ami[_0x3fca('0x5a')](_0x3fca('0x10e'),ut['buildObj'](_0x39a881,'called',_0x100a40['campaignsPreview'][_0x39a881['queue']]));_0x42c8bf(ut['message']('Calling'));})[_0x3fca('0x77')](function(_0x463d5b){ut[_0x3fca('0x10f')](_0x3fca('0x110'),_0x463d5b);_0xee2e75(ut[_0x3fca('0x4c')](_0x3fca('0x111'),_0x3f9529,_0x16a901));});}else{_0x93f2e1[_0x3fca('0x38')]+=0x1;ut[_0x3fca('0x112')](_0x39a881);rpcDb['createHistory'](_0x39a881,'[Blacklist][error]');delete _0x100a40['actions'][_0x2f51ba];_0xee2e75(ut[_0x3fca('0x4c')](_0x3fca('0x113'),_0x3f9529,_0x16a901));}});};Preview[_0x3fca('0xf')]['isTrunkReachable']=function(_0x3436be){return!_[_0x3fca('0x81')](_0x3436be)&&!_[_0x3fca('0x81')](_0x3436be[_0x3fca('0x2a')])&&!_[_0x3fca('0x81')](_0x3436be['active'])&&_0x3436be[_0x3fca('0x52')]&&!_[_0x3fca('0x81')](this['trunks'][util[_0x3fca('0x56')](_0x3fca('0x114'),_0x3436be['name'])])&&!_['isNil'](this['trunks'][util['format']('SIP/%s',_0x3436be['name'])][_0x3fca('0x115')])&&(this['trunks'][util[_0x3fca('0x56')](_0x3fca('0x114'),_0x3436be[_0x3fca('0x2a')])]['status']==='reachable'||this[_0x3fca('0x16')][util[_0x3fca('0x56')](_0x3fca('0x114'),_0x3436be[_0x3fca('0x2a')])][_0x3fca('0x115')]===_0x3fca('0x116'));};Preview[_0x3fca('0xf')][_0x3fca('0x85')]=function(_0x18d7e8,_0x1c571f){var _0x2a900c=this;return new BPromise(function(_0x12e347,_0x1f18fb){_0x2a900c[_0x3fca('0x117')](_0x18d7e8,_0x1c571f)[_0x3fca('0x86')](function(_0x31b742){_0x12e347(_['pick'](_0x31b742,[_0x3fca('0x4c')]));})[_0x3fca('0x77')](function(_0x229c19){if(_0x229c19['unlock']){rpcDb['unlockContact'](_0x18d7e8);}if(_0x229c19[_0x3fca('0x52')]){rpcDb[_0x3fca('0x89')](_0x18d7e8);}_0x1f18fb(_[_0x3fca('0x72')](_0x229c19,['message']));});});};Preview['prototype']['execRun']=function(_0x3896ad,_0x7a1aca){var _0x2a0e6a=this;return new BPromise(function(_0x30ec6f,_0x582634){var _0x3b83b3,_0x4e27dc;rpcDb[_0x3fca('0x118')](_0x3896ad)[_0x3fca('0x86')](function(_0x193427){if(!_[_0x3fca('0x81')](_0x193427[0x0])){_0x4e27dc=_0x193427[0x0][_0x3fca('0x119')]?![]:!![];_0x3b83b3=_0x193427[0x0][_0x3fca('0x119')]?!![]:![];_0x3b83b3=_0x7a1aca?!![]:_0x3b83b3;}var _0x42f597=_0x2a0e6a[_0x3fca('0x11a')](_0x193427);if(_0x42f597[_0x3fca('0x11b')]){rpcDb['checkIsBlackList'](_['pick'](_0x193427[0x0],[_0x3fca('0x74'),_0x3fca('0x11c')]))[_0x3fca('0x86')](function(_0x430664){_0x2a0e6a[_0x3fca('0x107')](_0x430664,_0x193427[0x0],_0x7a1aca,_0x4e27dc,_0x3b83b3)[_0x3fca('0x86')](function(_0x1354cd){_0x30ec6f(_0x1354cd);})['catch'](function(_0x4cadd8){_0x582634(_0x4cadd8);});})['catch'](function(_0x3aa724){ut[_0x3fca('0x10f')]('[Preview][checkIsBlackList]',_0x3aa724);_0x582634(ut['message']('Call\x20unsuccessful',_0x4e27dc,_0x3b83b3));});}else{_0x582634(ut['message'](_0x42f597[_0x3fca('0x4c')],_0x4e27dc,_0x3b83b3));}})[_0x3fca('0x77')](function(_0xf074aa){ut[_0x3fca('0x10f')](_0x3fca('0x11d'),_0xf074aa);_0x582634(ut[_0x3fca('0x4c')](_0x3fca('0x11e'),![],!![]));});});};Preview['prototype'][_0x3fca('0x11a')]=function(_0x5ade27){if(_[_0x3fca('0x81')](_0x5ade27)||_[_0x3fca('0x10b')](_0x5ade27)||!_[_0x3fca('0x81')](_0x5ade27[0x0]['Agent'])&&_[_0x3fca('0x81')](_0x5ade27[0x0]['Agent']['name'])){ut[_0x3fca('0x10f')]('[Preview][validateContact][Empty\x20Contact]',_0x5ade27);return{'isValid':![],'message':_0x3fca('0x11f')};}var _0x4e2096=this[_0x3fca('0x14')][_0x5ade27[0x0][_0x3fca('0x6f')]['name']];_0x4e2096[_0x3fca('0x4c')]=_0x3fca('0x99');if(_[_0x3fca('0x81')](_0x4e2096)){ut[_0x3fca('0x10f')]('[Preview][validateContact][Empty\x20Campaign]',_0x4e2096);return{'isValid':![],'message':_0x3fca('0x120')};}if(!this[_0x3fca('0x96')](_0x4e2096[_0x3fca('0x51')])){ut['logger'](_0x3fca('0x121'),'campaign\x20Name:\x20'+_0x4e2096['name']+_0x3fca('0x122'));if(!this[_0x3fca('0x96')](_0x4e2096['TrunkBackup'])){ut[_0x3fca('0x10f')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x4e2096[_0x3fca('0x2a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x3fca('0x123')};}}if(!ut[_0x3fca('0x94')](_0x4e2096['dialActive'])){ut[_0x3fca('0x10f')](_0x3fca('0x124'),_0x4e2096[_0x3fca('0x2a')]+_0x3fca('0x125'));return{'isValid':![],'message':_0x3fca('0x126')+_0x4e2096['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x3fca('0x127')};};Preview[_0x3fca('0xf')][_0x3fca('0x128')]=function(_0x261353,_0x15f59c,_0x3a0060,_0x4165e2){var _0x399cf5=this;return new BPromise(function(_0x1968ac,_0x18f57f){var _0x5bf1cd=_0x261353[_0x3fca('0xb8')];var _0x36a357=_0x399cf5[_0x3fca('0x96')](_0x15f59c[_0x3fca('0x51')])?util['format']('SIP/%s/%s%s',_0x15f59c[_0x3fca('0x51')][_0x3fca('0x2a')],_[_0x3fca('0x81')](_0x15f59c[_0x3fca('0x129')])?'':_0x15f59c['dialPrefix'][_0x3fca('0x12a')]()||'',_0x15f59c[_0x3fca('0x12b')]>0x0?_0x3a0060[_0x3fca('0x11c')]['substring'](_0x15f59c['dialCutDigit']):_0x3a0060[_0x3fca('0x11c')]):util[_0x3fca('0x56')]('SIP/%s/%s%s',_[_0x3fca('0x81')](_0x15f59c['TrunkBackup'])?_0x15f59c['Trunk'][_0x3fca('0x2a')]:_0x15f59c[_0x3fca('0x97')][_0x3fca('0x2a')],_[_0x3fca('0x81')](_0x15f59c[_0x3fca('0x129')])?'':_0x15f59c['dialPrefix'][_0x3fca('0x12a')]()||'',_0x15f59c['dialCutDigit']>0x0?_0x3a0060[_0x3fca('0x11c')][_0x3fca('0x12c')](_0x15f59c[_0x3fca('0x12b')]):_0x3a0060[_0x3fca('0x11c')]);var _0x1b2b60=_0x399cf5[_0x3fca('0x96')](_0x15f59c[_0x3fca('0x51')])?ut['getCallerId'](_0x15f59c[_0x3fca('0x51')][_0x3fca('0x53')],_0x15f59c['dialOriginateCallerIdName'],_0x15f59c[_0x3fca('0x12d')]>0x0?ut['getCallerIdRandom'](_0x15f59c[_0x3fca('0x12e')],_0x15f59c[_0x3fca('0x12d')]):_0x15f59c['dialOriginateCallerIdNumber']):ut[_0x3fca('0x12f')](_[_0x3fca('0x81')](_0x15f59c['TrunkBackup'])?_0x15f59c[_0x3fca('0x51')]['callerid']:_0x15f59c[_0x3fca('0x97')][_0x3fca('0x53')],_0x15f59c[_0x3fca('0x130')],_0x15f59c['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x3fca('0x131')](_0x15f59c[_0x3fca('0x12e')],_0x15f59c['dialRandomLastDigitCallerIdNumber']):_0x15f59c[_0x3fca('0x12e')]);if(_0x1b2b60){_0x261353[_0x3fca('0x132')]=ut['extractCalleridName'](_0x1b2b60);_0x261353[_0x3fca('0x133')]=ut['extractCalleridNumber'](_0x1b2b60);}var _0x5993ea=ut['addVariables'](_0x15f59c,_0x3a0060,_0x36a357,_0x1b2b60,_0x5bf1cd,_0x261353);_[_0x3fca('0x134')](_0x261353,ut[_0x3fca('0x135')](_0x5993ea));_0x261353[_0x3fca('0x8a')]=moment()[_0x3fca('0x56')](_0x3fca('0x8b'));ami[_0x3fca('0x76')](ut[_0x3fca('0x136')](_0x261353,_0x15f59c,_0x5993ea,_0x261353[_0x3fca('0xaf')],_0x4165e2))[_0x3fca('0x86')](function(_0x51fb7a){_0x15f59c[_0x3fca('0x5d')]+=0x1;logger[_0x3fca('0x58')](_0x3fca('0x137'),_0x5bf1cd,_0x3fca('0xb9'),_0x15f59c[_0x3fca('0x2a')],'originated:\x20',_0x15f59c[_0x3fca('0x5d')]);_0x1968ac(_0x51fb7a);})['catch'](function(_0xf82be){ut[_0x3fca('0xfc')](_0x261353,0xe,_0x3fca('0x138'));rpcDb['createAgentHistory'](_0x261353,'[originateFailure][logOriginateFailure]');_0x18f57f(_0xf82be);});});};Preview['prototype'][_0x3fca('0x21')]=function(_0x4aa707){if(this['actions'][_0x4aa707['linkedid']]){this[_0x3fca('0x17')][_0x4aa707[_0x3fca('0xb0')]]['channel']=_0x4aa707['channel'];}};Preview['prototype'][_0x3fca('0x1b')]=function(_0x429720){var _0x62cc26=this;var _0x5b9319=this[_0x3fca('0x17')][_0x429720[_0x3fca('0x139')]];if(_0x5b9319){if(_0x5b9319[_0x3fca('0x10a')]&&this[_0x3fca('0x18')][_0x5b9319[_0x3fca('0x10a')]]){ut[_0x3fca('0x13a')](_0x5b9319,this[_0x3fca('0x18')][_0x5b9319[_0x3fca('0x10a')]]['name'],this[_0x3fca('0x18')][_0x5b9319[_0x3fca('0x10a')]]['id']);}var _0xf58ee9=_[_0x3fca('0x13b')](_0x5b9319);_0xf58ee9[_0x3fca('0xb6')]=moment()[_0x3fca('0x56')](_0x3fca('0x8b'));var _0x18b0c7=_0x62cc26[_0x3fca('0x14')][_0x5b9319[_0x3fca('0x70')]];if(ut['isFailure'](_0x429720['response'])){if(_0x5b9319[_0x3fca('0xae')]){rpcDb['unlockContact'](_0x5b9319[_0x3fca('0xb2')]);}if(_0x5b9319[_0x3fca('0xaf')]){rpcDb['disableContact'](_0x5b9319[_0x3fca('0xb2')]);}ami[_0x3fca('0x5a')](_0x3fca('0x13c'),ut['buildObj'](_0x5b9319,'rejected',this['campaignsPreview'][_0x5b9319[_0x3fca('0x70')]]));this['callProgressDetectingAgent'](_0xf58ee9,_0x18b0c7,_0x429720);}else{_0x5b9319[_0x3fca('0x8a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut[_0x3fca('0xfc')](_0xf58ee9,0x4,'Answer');rpcDb[_0x3fca('0xfb')](_0xf58ee9,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x3fca('0xf')][_0x3fca('0x1d')]=function(_0x2bcbce){var _0x296da0=this;var _0x1dd08c=this[_0x3fca('0x17')][_0x2bcbce[_0x3fca('0xb0')]];var _0x46e5c8;if(_0x1dd08c){_0x46e5c8=this[_0x3fca('0x14')][_0x1dd08c['queue']];logger['info']('[syncHangup][talking]',_0x2bcbce[_0x3fca('0xb0')],_0x3fca('0xb9'),_0x46e5c8[_0x3fca('0x2a')],_0x3fca('0xba'),_0x46e5c8[_0x3fca('0x2e')]);}if(this[_0x3fca('0x17')][_0x2bcbce['linkedid']]&&_0x2bcbce[_0x3fca('0xb0')]!==_0x2bcbce['uniqueid']){if(_0x2bcbce['cause']==='16'&&this[_0x3fca('0x17')][_0x2bcbce[_0x3fca('0xb0')]][_0x3fca('0x79')]){this[_0x3fca('0x9a')](_0x2bcbce,_0x2bcbce[_0x3fca('0xb0')],_0x2bcbce[_0x3fca('0x13d')]);}else if(this[_0x3fca('0x17')][_0x2bcbce[_0x3fca('0xb0')]][_0x3fca('0x79')]){logger['info'](_0x3fca('0x13e'),_0x2bcbce[_0x3fca('0xb0')],_0x2bcbce[_0x3fca('0x13d')],_0x3fca('0xb9'),_0x46e5c8[_0x3fca('0x2a')],_0x3fca('0xba'),_0x46e5c8[_0x3fca('0x2e')]);this[_0x3fca('0x9a')](_0x2bcbce,_0x2bcbce[_0x3fca('0xb0')],_0x2bcbce[_0x3fca('0x13d')]);}}else if(_0x1dd08c&&_[_0x3fca('0x81')](_0x1dd08c[_0x3fca('0x13f')])&&_0x46e5c8[_0x3fca('0x140')]&&_0x2bcbce[_0x3fca('0xb0')]===_0x2bcbce[_0x3fca('0xb8')]&&_[_0x3fca('0x81')](_0x2bcbce['reason'])&&_0x2bcbce[_0x3fca('0x13d')]==='16'&&_0x2bcbce['channelstate']==='6'&&_[_0x3fca('0xf9')](_0x1dd08c[_0x3fca('0x141')])){if(_0x1dd08c[_0x3fca('0xae')]){rpcDb[_0x3fca('0x142')](_0x1dd08c[_0x3fca('0xb2')]);}if(_0x1dd08c[_0x3fca('0xaf')]){rpcDb[_0x3fca('0x89')](_0x1dd08c['idContact']);}_0x2bcbce[_0x3fca('0xfa')]='22';this['callProgressDetectingAgent'](_0x1dd08c,_0x46e5c8,_0x2bcbce);}else if(_0x1dd08c&&_0x1dd08c[_0x3fca('0x141')]){if(_0x2bcbce[_0x3fca('0x13d')]==='16'&&this[_0x3fca('0x17')][_0x2bcbce['linkedid']][_0x3fca('0x79')]){logger[_0x3fca('0x58')](_0x3fca('0x143'),_0x2bcbce[_0x3fca('0xb0')],_0x2bcbce[_0x3fca('0x13d')],'\x20Queue',_0x46e5c8[_0x3fca('0x2a')],'pTalking:\x20',_0x46e5c8[_0x3fca('0x2e')]);this[_0x3fca('0x9a')](_0x2bcbce,_0x2bcbce['linkedid'],_0x2bcbce['cause']);}else if(this['actions'][_0x2bcbce[_0x3fca('0xb0')]]['dialAnswer']){logger[_0x3fca('0x58')](_0x3fca('0x13e'),_0x2bcbce[_0x3fca('0xb0')],_0x2bcbce['cause'],'\x20Queue',_0x46e5c8[_0x3fca('0x2a')],_0x3fca('0xba'),_0x46e5c8[_0x3fca('0x2e')]);this['callProgressDetectingCustomer'](_0x2bcbce,_0x2bcbce['linkedid'],_0x2bcbce[_0x3fca('0x13d')]);}}};Preview['prototype']['syncDialEnd']=function(_0x1b9d51){if(this[_0x3fca('0x17')][_0x1b9d51[_0x3fca('0xf6')]]&&_0x1b9d51[_0x3fca('0xf6')]!==_0x1b9d51[_0x3fca('0x144')]){this[_0x3fca('0x9a')](_0x1b9d51,_0x1b9d51['destlinkedid'],_0x1b9d51[_0x3fca('0xf2')]);}};Preview[_0x3fca('0xf')][_0x3fca('0x145')]=function(_0x1fd612){if(this[_0x3fca('0x17')][_0x1fd612['linkedid']]&&_0x1fd612[_0x3fca('0xb0')]!==_0x1fd612[_0x3fca('0xb8')]&&!this[_0x3fca('0x17')][_0x1fd612[_0x3fca('0xb0')]][_0x3fca('0x79')]){if(_0x1fd612[_0x3fca('0x13d')]==='1'){this['callProgressDetectingCustomer'](_0x1fd612,_0x1fd612[_0x3fca('0xb0')],_0x1fd612['cause']);}}};Preview[_0x3fca('0xf')]['addVariable']=function(_0x1946c7,_0x1e0b68,_0x54aaca){if(this[_0x3fca('0x17')][_0x1946c7]){if(_[_0x3fca('0x81')](this[_0x3fca('0x17')][_0x1946c7][_0x3fca('0x146')])){this[_0x3fca('0x17')][_0x1946c7]['variables']={};}this[_0x3fca('0x17')][_0x1946c7][_0x3fca('0x146')][_0x1e0b68]=_0x54aaca;}};Preview[_0x3fca('0xf')][_0x3fca('0x23')]=function(_0x3e1d0b){try{if(!_['isNil'](_0x3e1d0b)){if(ut[_0x3fca('0x147')](_[_0x3fca('0x148')](_0x3e1d0b['variable'])[0x0])){this[_0x3fca('0x149')](_0x3e1d0b[_0x3fca('0xb8')],_[_0x3fca('0x148')](_0x3e1d0b[_0x3fca('0x14a')])[0x0],_0x3e1d0b['value']);}}}catch(_0x32d019){logger['error'](_0x3fca('0x14b'),util[_0x3fca('0x14c')](_0x32d019,{'showHidden':![],'depth':null}));}};Preview[_0x3fca('0xf')][_0x3fca('0x14d')]=function(_0x2233d5){if(_0x2233d5){if(this['actions'][_0x2233d5[_0x3fca('0x14e')]]){this['actions'][_0x2233d5[_0x3fca('0x14e')]][_0x3fca('0x141')]=!![];}}};Preview[_0x3fca('0xf')][_0x3fca('0x26')]=function(_0x193f79){if(_0x193f79){if(this[_0x3fca('0x17')][_0x193f79[_0x3fca('0x14f')]]){this['actions'][_0x193f79[_0x3fca('0x14f')]]['transfer']=!![];}}};module[_0x3fca('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index be516af..7589341 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 _0x29d4=['[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','holdtime','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact'];(function(_0x5e8a2e,_0x3deead){var _0x20a417=function(_0x146460){while(--_0x146460){_0x5e8a2e['push'](_0x5e8a2e['shift']());}};_0x20a417(++_0x3deead);}(_0x29d4,0x1a1));var _0x429d=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x29d4[_0x433a86];return _0x23000c;};'use strict';var util=require(_0x429d('0x0'));var BPromise=require('bluebird');var logger=require(_0x429d('0x1'))(_0x429d('0x2'));var _=require(_0x429d('0x3'));var cmHopper=require(_0x429d('0x4'));var cmHopperFinal=require(_0x429d('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x429d('0x6'));var voiceQueueRt=require(_0x429d('0x7'));var agentReportPreview=require(_0x429d('0x8'));var voiceQueueReport=require(_0x429d('0x9'));function loggerCatch(_0x1c55aa){return function(_0xa71445){logger[_0x429d('0xa')](_0x1c55aa,util[_0x429d('0xb')](_0xa71445,{'showHidden':![],'depth':null}));};}function create(_0x4befb9){return BPromise[_0x429d('0xc')]()['then'](cmHopperHistory[_0x429d('0xd')](_0x4befb9))[_0x429d('0xe')](loggerCatch(_0x429d('0xf')));}function createAgent(_0x5e8430){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](agentReportPreview['createHistory'](_0x5e8430))[_0x429d('0xe')](loggerCatch(_0x429d('0xf')));}function moveContact(_0x417f77){return BPromise['resolve']()[_0x429d('0x10')](cmHopper[_0x429d('0x11')](_0x417f77,!![]))[_0x429d('0xe')](loggerCatch(_0x429d('0x12')));}exports['checkIsBlackList']=function(_0x1c542c){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopperBlack['checkIsBlackList'](_0x1c542c))[_0x429d('0xe')](loggerCatch(_0x429d('0x13')));};exports['getContactPreview']=function(_0x32d6b3){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper[_0x429d('0x14')](_0x32d6b3))[_0x429d('0xe')](loggerCatch(_0x429d('0x15')));};exports['createHistory']=function(_0xbfe8a0,_0x53d19d){create(_0xbfe8a0)[_0x429d('0xe')](loggerCatch(_0x53d19d));moveContact(_0xbfe8a0)[_0x429d('0xe')](loggerCatch(_0x53d19d));};exports[_0x429d('0x16')]=function(_0x2dc57a,_0x51ef88){createAgent(_0x2dc57a)[_0x429d('0xe')](loggerCatch(_0x51ef88));};exports[_0x429d('0x17')]=function(_0x2b9e78,_0x513854){create(_0x2b9e78)[_0x429d('0xe')](loggerCatch(_0x513854));};exports[_0x429d('0x18')]=function(_0x202c4e,_0xcbf00c){moveContact(_0x202c4e)[_0x429d('0xe')](loggerCatch(_0xcbf00c));};exports[_0x429d('0x19')]=function(_0x5a4093,_0x13e309,_0x165e4d){if(_0x13e309){_0x5a4093[_0x429d('0x1a')]=null;}if(_0x165e4d){_0x5a4093['active']=![];}return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper[_0x429d('0x19')](_0x5a4093))[_0x429d('0xe')](loggerCatch(_0x429d('0x1b')));};exports[_0x429d('0x1c')]=function(_0x4c6d89){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper['countReScheduled'](_0x4c6d89))[_0x429d('0xe')](loggerCatch(_0x429d('0x1d')));};exports[_0x429d('0x1e')]=function(_0x11c423){return BPromise['resolve']()[_0x429d('0x10')](cmHopper[_0x429d('0x1e')]({'UserId':null},_0x11c423,0x1))[_0x429d('0xe')](loggerCatch(_0x429d('0x1f')));};exports[_0x429d('0x20')]=function(_0x514f1b){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper[_0x429d('0x1e')]({'active':![]},_0x514f1b,0x1))[_0x429d('0xe')](loggerCatch(_0x429d('0x21')));};exports[_0x429d('0x22')]=function(_0x2351c9){var _0xdc7bf9={};_0xdc7bf9[_0x429d('0x23')]=_0x2351c9['type'];_0xdc7bf9[_0x429d('0x24')]=_0x2351c9[_0x429d('0x24')];_0xdc7bf9['calleridnum']=_0x2351c9[_0x429d('0x25')];_0xdc7bf9[_0x429d('0x26')]=_0x2351c9[_0x429d('0x26')];_0xdc7bf9[_0x429d('0x27')]=_0x2351c9[_0x429d('0x27')];_0xdc7bf9['queuecallerjoinAt']=_0x2351c9[_0x429d('0x28')];_0xdc7bf9[_0x429d('0x29')]=_0x2351c9[_0x429d('0x28')];_0xdc7bf9[_0x429d('0x2a')]=0x1;_0xdc7bf9[_0x429d('0x2b')]=_0x2351c9[_0x429d('0x2c')];_0xdc7bf9['connectedlinename']=_0x2351c9['membername'];_0xdc7bf9[_0x429d('0x2d')]=_0x429d('0x2e');_0xdc7bf9['exten']='xcally-motion-preview';_0xdc7bf9[_0x429d('0x2f')]=0x0;_0xdc7bf9['assigned']=0x1;_0xdc7bf9[_0x429d('0x30')]=_0x2351c9[_0x429d('0x31')];_0xdc7bf9[_0x429d('0x32')]=_0x429d('0x33');return BPromise['resolve']()[_0x429d('0x10')](voiceQueueReport[_0x429d('0x34')](_0xdc7bf9))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x5698f5,_0x5bb435){return BPromise[_0x429d('0xc')]()['then'](cmHopper['getContactRecallMe'](_0x5698f5,_0x5bb435))[_0x429d('0xe')](loggerCatch(_0x429d('0x35')));};exports[_0x429d('0x36')]=function(_0x30e645){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper['rescheduleContact'](_0x30e645,!![],!![]))[_0x429d('0xe')](loggerCatch(_0x429d('0x37')));}; \ No newline at end of file +var _0xd0bb=['queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x4e37bc,_0x8174e7){_0x4e37bc=_0x4e37bc-0x0;var _0x48a8b7=_0xd0bb[_0x4e37bc];return _0x48a8b7;};'use strict';var util=require(_0xbd0b('0x0'));var BPromise=require(_0xbd0b('0x1'));var logger=require(_0xbd0b('0x2'))('preview');var _=require(_0xbd0b('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xbd0b('0x4'));var cmHopperHistory=require(_0xbd0b('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xbd0b('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xbd0b('0x7'));function loggerCatch(_0x1b2499){return function(_0x158b5c){logger[_0xbd0b('0x8')](_0x1b2499,util[_0xbd0b('0x9')](_0x158b5c,{'showHidden':![],'depth':null}));};}function create(_0x5eb975){return BPromise[_0xbd0b('0xa')]()[_0xbd0b('0xb')](cmHopperHistory[_0xbd0b('0xc')](_0x5eb975))[_0xbd0b('0xd')](loggerCatch(_0xbd0b('0xe')));}function createAgent(_0x53d5e8){return BPromise['resolve']()[_0xbd0b('0xb')](agentReportPreview[_0xbd0b('0xc')](_0x53d5e8))['catch'](loggerCatch(_0xbd0b('0xe')));}function moveContact(_0x196beb){return BPromise['resolve']()[_0xbd0b('0xb')](cmHopper[_0xbd0b('0xf')](_0x196beb,!![]))[_0xbd0b('0xd')](loggerCatch(_0xbd0b('0x10')));}exports[_0xbd0b('0x11')]=function(_0x42a96b){return BPromise[_0xbd0b('0xa')]()[_0xbd0b('0xb')](cmHopperBlack[_0xbd0b('0x11')](_0x42a96b))[_0xbd0b('0xd')](loggerCatch(_0xbd0b('0x12')));};exports['getContactPreview']=function(_0x115f2d){return BPromise['resolve']()['then'](cmHopper[_0xbd0b('0x13')](_0x115f2d))[_0xbd0b('0xd')](loggerCatch(_0xbd0b('0x14')));};exports[_0xbd0b('0xc')]=function(_0x39b0fe,_0x546db3){create(_0x39b0fe)['catch'](loggerCatch(_0x546db3));moveContact(_0x39b0fe)[_0xbd0b('0xd')](loggerCatch(_0x546db3));};exports[_0xbd0b('0x15')]=function(_0x1f2a6e,_0x2f58a3){createAgent(_0x1f2a6e)[_0xbd0b('0xd')](loggerCatch(_0x2f58a3));};exports[_0xbd0b('0x16')]=function(_0x5aeb79,_0x1d1292){create(_0x5aeb79)['catch'](loggerCatch(_0x1d1292));};exports[_0xbd0b('0x17')]=function(_0x475801,_0x2d02d0){moveContact(_0x475801)[_0xbd0b('0xd')](loggerCatch(_0x2d02d0));};exports['rescheduleContact']=function(_0x403c91,_0x38c27f,_0x40b021){if(_0x38c27f){_0x403c91['UserId']=null;}if(_0x40b021){_0x403c91[_0xbd0b('0x18')]=![];}return BPromise['resolve']()[_0xbd0b('0xb')](cmHopper[_0xbd0b('0x19')](_0x403c91))[_0xbd0b('0xd')](loggerCatch(_0xbd0b('0x1a')));};exports[_0xbd0b('0x1b')]=function(_0x539359){return BPromise[_0xbd0b('0xa')]()['then'](cmHopper[_0xbd0b('0x1b')](_0x539359))[_0xbd0b('0xd')](loggerCatch(_0xbd0b('0x1c')));};exports[_0xbd0b('0x1d')]=function(_0xfd9f82){return BPromise[_0xbd0b('0xa')]()['then'](cmHopper[_0xbd0b('0x1d')]({'UserId':null},_0xfd9f82,0x1))[_0xbd0b('0xd')](loggerCatch(_0xbd0b('0x1e')));};exports[_0xbd0b('0x1f')]=function(_0x1129ae){return BPromise[_0xbd0b('0xa')]()['then'](cmHopper[_0xbd0b('0x1d')]({'active':![]},_0x1129ae,0x1))[_0xbd0b('0xd')](loggerCatch(_0xbd0b('0x20')));};exports['crateCustomerReportQueue']=function(_0x4dfe76){var _0x2187a5={};_0x2187a5[_0xbd0b('0x21')]=_0x4dfe76[_0xbd0b('0x21')];_0x2187a5[_0xbd0b('0x22')]=_0x4dfe76[_0xbd0b('0x22')];_0x2187a5[_0xbd0b('0x23')]=_0x4dfe76[_0xbd0b('0x23')];_0x2187a5['calleridname']=_0x4dfe76[_0xbd0b('0x24')];_0x2187a5[_0xbd0b('0x25')]=_0x4dfe76['queue'];_0x2187a5['queuecallerjoinAt']=_0x4dfe76[_0xbd0b('0x26')];_0x2187a5[_0xbd0b('0x27')]=_0x4dfe76['answertime'];_0x2187a5[_0xbd0b('0x28')]=0x1;_0x2187a5[_0xbd0b('0x29')]=_0x4dfe76[_0xbd0b('0x2a')];_0x2187a5[_0xbd0b('0x2b')]=_0x4dfe76[_0xbd0b('0x2c')];_0x2187a5[_0xbd0b('0x2d')]='from-sip';_0x2187a5[_0xbd0b('0x2e')]=_0xbd0b('0x2f');_0x2187a5[_0xbd0b('0x30')]=0x0;_0x2187a5[_0xbd0b('0x31')]=0x1;_0x2187a5[_0xbd0b('0x32')]=_0x4dfe76[_0xbd0b('0x2c')];_0x2187a5[_0xbd0b('0x33')]=_0xbd0b('0x34');return BPromise[_0xbd0b('0xa')]()[_0xbd0b('0xb')](voiceQueueReport[_0xbd0b('0x35')](_0x2187a5))[_0xbd0b('0xd')](loggerCatch(_0xbd0b('0x36')));};exports[_0xbd0b('0x37')]=function(_0x48e4cb,_0x6132c8){return BPromise[_0xbd0b('0xa')]()['then'](cmHopper[_0xbd0b('0x37')](_0x48e4cb,_0x6132c8))[_0xbd0b('0xd')](loggerCatch(_0xbd0b('0x38')));};exports[_0xbd0b('0x39')]=function(_0x27ad8b){return BPromise[_0xbd0b('0xa')]()['then'](cmHopper[_0xbd0b('0x19')](_0x27ad8b,!![],!![]))[_0xbd0b('0xd')](loggerCatch(_0xbd0b('0x3a')));}; \ 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 60e778d..b034611 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 _0x84ae=['updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','responsetime','endtime','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','statedesc','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','not_inuse','status','getDiff','diff','seconds','createBody','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitter','bridgepvtcallid','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','loggerCatch','error','logger','info','inspect','loggerError','logger2','getCallerId','string','isEmpty','isUndefined','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','format','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLower'];(function(_0x4ffe19,_0x21b8b7){var _0x7f7757=function(_0x295df7){while(--_0x295df7){_0x4ffe19['push'](_0x4ffe19['shift']());}};_0x7f7757(++_0x21b8b7);}(_0x84ae,0xeb));var _0xe84a=function(_0x5a0d6a,_0x4016c5){_0x5a0d6a=_0x5a0d6a-0x0;var _0x11d115=_0x84ae[_0x5a0d6a];return _0x11d115;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')(_0xe84a('0x0'));var ipAgi=process[_0xe84a('0x1')][_0xe84a('0x2')]||_0xe84a('0x3');function getSeconds(_0x23c867,_0x2f8623){var _0x5bfbb2=moment(_0x23c867)[_0xe84a('0x4')](0x0);var _0x430992=moment(_0x2f8623)[_0xe84a('0x4')](0x0);return _0x5bfbb2['diff'](_0x430992,'seconds');}exports[_0xe84a('0x5')]=function(_0x33f851){return function(_0x20bba2){logger[_0xe84a('0x6')](_0x33f851,util['inspect'](_0x20bba2,{'showHidden':![],'depth':null}));};};exports[_0xe84a('0x7')]=function(_0x12c786,_0x505459){logger[_0xe84a('0x8')](_0x12c786,util[_0xe84a('0x9')](_0x505459,{'showHidden':![],'depth':null}));};exports[_0xe84a('0xa')]=function(_0x14d503,_0x3cb5d1){logger[_0xe84a('0x6')](_0x14d503,util[_0xe84a('0x9')](_0x3cb5d1,{'showHidden':![],'depth':null}));};exports[_0xe84a('0xb')]=function(_0x9bf10d){return function(_0x54980d){logger[_0xe84a('0x8')](_0x9bf10d,util[_0xe84a('0x9')](_0x54980d,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x487a0e,_0x3a9e5a,_0x5e0e9d){return{'message':_0x487a0e,'unlock':_0x3a9e5a,'active':_0x5e0e9d};};exports[_0xe84a('0xc')]=function(_0x1fb16b,_0xd29d40,_0x344e25){if(!_['isUndefined'](_0x344e25)&&_0xe84a('0xd')===typeof _0x344e25&&!_[_0xe84a('0xe')](_0x344e25)){if(!_[_0xe84a('0xf')](_0xd29d40)&&_0xe84a('0xd')===typeof _0xd29d40&&!_[_0xe84a('0xe')](_0xd29d40)){return util['format'](_0xe84a('0x10'),_0xd29d40,_0x344e25);}return util['format'](_0xe84a('0x10'),_0x344e25,_0x344e25);}if(!_[_0xe84a('0xf')](_0x1fb16b)&&'string'===typeof _0x1fb16b&&!_[_0xe84a('0xe')](_0x1fb16b)){return _0x1fb16b;}return _0xe84a('0x11');};exports[_0xe84a('0x12')]=function(_0x7ab19c){if(_[_0xe84a('0x13')](_0x7ab19c)){return![];}return _0x7ab19c;};exports['addVariables']=function(_0xd20560,_0xbd3436,_0x3e791,_0x33d527,_0x19352c,_0x3cb918){var _0x5092ba={'XMD-QUEUE':_0xbd3436[_0xe84a('0x14')]?_0xbd3436[_0xe84a('0x14')][_0xe84a('0x15')]:'','XMD-CALLERID':_0x33d527,'XMD-CALLERID-PREVIEW':_0x3cb918?util[_0xe84a('0x16')](_0xe84a('0x10'),_0x3cb918[_0xe84a('0x17')],_0x3cb918[_0xe84a('0x18')]):_0x33d527,'XMD-DIALID':_0x19352c,'XMD-CONTACTID':_0xbd3436[_0xe84a('0x19')],'XMD-CDRTYPE':_0xe84a('0x1a'),'CALLERID(all)':_0x33d527,'XMD-VOICEQUEUEID':_0xbd3436[_0xe84a('0x1b')],'XMD-DIALCHANNEL':_0x3e791,'XMD-DIALTIMEOUT':_0xd20560[_0xe84a('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xe84a('0x16')](_0xe84a('0x1d'),_0xd20560[_0xe84a('0x1e')]?'g':'',_[_0xe84a('0xe')](_0xd20560['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xd20560[_0xe84a('0x1f')]||'','XMD-AGI':_0xd20560[_0xe84a('0x20')]?util[_0xe84a('0x16')](_0xe84a('0x21'),ipAgi,_0xd20560[_0xe84a('0x20')]):_0xe84a('0x22'),'XMD-AGIAFTER':_0xd20560[_0xe84a('0x1e')]?util['format'](_0xe84a('0x21'),ipAgi,_0xd20560['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3cb918?_0x3cb918[_0xe84a('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x3cb918?_0x3cb918[_0xe84a('0x24')]:'','XMD-DESTINATION':_0xe84a('0x25')};if(!_[_0xe84a('0xe')](_0xd20560[_0xe84a('0x26')])){_0x5092ba[util[_0xe84a('0x16')]('%s',_0xe84a('0x27'))]=_0xd20560[_0xe84a('0x26')];_0x5092ba[util['format']('%s',_0xe84a('0x28'))]=_0x19352c;}if(_0xbd3436&&_0xbd3436['Contact']){for(var _0x35b5c2 in _0xbd3436[_0xe84a('0x29')]){if(_0xbd3436[_0xe84a('0x29')][_0xe84a('0x2a')](_0x35b5c2)){if(!_[_0xe84a('0x13')](_0xbd3436[_0xe84a('0x29')][_0x35b5c2])&&_0x35b5c2!=='id'&&_0x35b5c2!==_0xe84a('0x2b')&&_0x35b5c2!==_0xe84a('0x2c')&&_0x35b5c2!==_0xe84a('0x2d')){_0x5092ba[util[_0xe84a('0x16')]('%s%s',_0xe84a('0x2e'),_[_0xe84a('0x2f')](_0x35b5c2))]=_0xbd3436[_0xe84a('0x29')][_0x35b5c2];}}}}return _0x5092ba;};exports['toLowerVariables']=function(_0x58eb09){var _0x4f5045={};for(var _0x4bef5b in _0x58eb09){if(_0x58eb09[_0xe84a('0x2a')](_0x4bef5b)){_0x4f5045[util[_0xe84a('0x16')]('%s',_[_0xe84a('0x30')](_0x4bef5b))]=_0x58eb09[_0x4bef5b];}}return{'variables':_0x4f5045};};exports[_0xe84a('0x31')]=function(_0x1c0046,_0x1f3e5f){if(!_[_0xe84a('0x13')](_0x1c0046)){if(_0x1c0046[_0xe84a('0x2a')](_0xe84a('0x32'))){if(_0x1c0046[_0xe84a('0x32')]>0x0){_0x1c0046['originated']-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1f3e5f);}}}else{logger[_0xe84a('0x6')](_0xe84a('0x33'),_0x1f3e5f);}};exports[_0xe84a('0x34')]=function(_0x28859e){var _0x34f975=moment()[_0xe84a('0x16')](_0xe84a('0x35'));_0x28859e[_0xe84a('0x36')]=0xd;_0x28859e['statedesc']='Blacklist';_0x28859e['starttime']=_0x34f975;_0x28859e[_0xe84a('0x37')]=_0x34f975;_0x28859e[_0xe84a('0x38')]=_0x34f975;};exports['logAgent']=function(_0x45cd0b,_0x5701d8,_0x216a86){var _0x498fbf=moment()[_0xe84a('0x16')](_0xe84a('0x35'));_0x45cd0b[_0xe84a('0x36')]=_0x5701d8;_0x45cd0b['statedesc']=_0x216a86;_0x45cd0b[_0xe84a('0x37')]=_0x498fbf;_0x45cd0b[_0xe84a('0x39')]=getSeconds(_0x45cd0b[_0xe84a('0x37')],_0x45cd0b[_0xe84a('0x3a')]);};exports[_0xe84a('0x3b')]=function(_0x1ea37c,_0x519ac5,_0x4ea5e9){_0x1ea37c[_0xe84a('0x3c')]=_0x519ac5;_0x1ea37c[_0xe84a('0x3d')]=_0x4ea5e9;};exports[_0xe84a('0x3e')]=function(_0x5469ea,_0x280cc4,_0x1fe00c){var _0x23dd29=moment()[_0xe84a('0x16')](_0xe84a('0x35'));_0x5469ea['state']=_0x280cc4;_0x5469ea[_0xe84a('0x3f')]=_0x1fe00c;_0x5469ea['responsetime']=_0x5469ea[_0xe84a('0x37')]?_0x5469ea['responsetime']:_0x23dd29;_0x5469ea[_0xe84a('0x38')]=_0x5469ea['endtime']?_0x5469ea['endtime']:_0x23dd29;_0x5469ea[_0xe84a('0x39')]=getSeconds(_0x5469ea[_0xe84a('0x37')]||0x0,_0x5469ea['starttime']||0x0);_0x5469ea[_0xe84a('0x40')]=_0x5469ea[_0xe84a('0x41')]?getSeconds(_0x5469ea[_0xe84a('0x38')],_0x5469ea['answertime']):0x0;};exports[_0xe84a('0x42')]=function(_0x324ad4){return _0x324ad4===_0xe84a('0x43');};exports[_0xe84a('0x44')]=function(_0x2beb8a,_0x211246,_0x415e47,_0x3f0be0,_0x1abe4d){var _0x534c8f=_0x3f0be0?_0xe84a('0x45'):_0x2beb8a[_0xe84a('0x17')];_0x534c8f=_0x1abe4d?_0xe84a('0x46'):_0x534c8f;return{'actionid':_0x2beb8a[_0xe84a('0x47')],'action':_0xe84a('0x48'),'channel':_0x2beb8a[_0xe84a('0x49')],'callerid':util['format'](_0xe84a('0x10'),_0x534c8f,_0x2beb8a[_0xe84a('0x18')]),'Exten':_0xe84a('0x25'),'Context':_0xe84a('0x4a'),'Priority':'1','variable':_0x415e47,'timeout':(_0x211246[_0xe84a('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2beb8a[_0xe84a('0x47')]};};exports[_0xe84a('0x4c')]=function(_0x427c48){return _0x427c48[_0xe84a('0x4d')]+_0x427c48[_0xe84a('0x4e')]+_0x427c48[_0xe84a('0x4f')]+_0x427c48[_0xe84a('0x50')]+_0x427c48[_0xe84a('0x51')];};exports[_0xe84a('0x52')]=function(_0x7fe716){var _0x386613=_[_0xe84a('0x53')](_0x7fe716);_0x386613['state']=0xf;_0x386613[_0xe84a('0x3f')]=_0xe84a('0x54');return _0x386613;};exports[_0xe84a('0x55')]=function(_0x67a5fc,_0x34ca36,_0x228153){var _0x1789e4={};_0x1789e4[_0x34ca36]=_0x67a5fc[_0x34ca36];_0x1789e4[_0xe84a('0x56')]=![];_0x1789e4['scheduledat']=moment()[_0xe84a('0x57')](_0x228153,_0xe84a('0x58'))[_0xe84a('0x16')](_0xe84a('0x35'));_0x1789e4[_0xe84a('0x19')]=_0x67a5fc[_0xe84a('0x19')];_0x1789e4[_0xe84a('0x59')]=_0x67a5fc[_0xe84a('0x59')];_0x1789e4[_0xe84a('0x1b')]=_0x67a5fc['VoiceQueueId']||undefined;return _0x1789e4;};exports[_0xe84a('0x5a')]=function(_0x230926,_0x713cb7){if(!_[_0xe84a('0x13')](_0x230926)){if(_0x230926[_0xe84a('0x5b')]>0x0){_0x230926[_0xe84a('0x5b')]-=0x1;}else{logger['error'](_0x713cb7,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x713cb7,_0xe84a('0x5c'));}};exports[_0xe84a('0x5d')]=function(_0x48d465){if(_0x48d465<=0x0){return!![];}return![];};exports[_0xe84a('0x5e')]=function(_0x26acbf,_0x3d11dc,_0x2be498){_0x26acbf[_0xe84a('0x5f')]=_0x3d11dc;_0x26acbf[_0xe84a('0x15')]=_0x26acbf[_0xe84a('0x60')];_0x26acbf[_0xe84a('0x61')]=_0x26acbf[_0xe84a('0x49')];if(_0x2be498){_0x26acbf['mandatoryDisposition']=_0x2be498[_0xe84a('0x62')];}return _0x26acbf;};exports['buildAcw']=function(_0x41ad10){var _0x27b8b2={};_0x27b8b2['queue']=_0x41ad10[_0xe84a('0x60')];_0x27b8b2[_0xe84a('0x61')]=_0x41ad10[_0xe84a('0x49')];_0x27b8b2[_0xe84a('0x47')]=_0x41ad10[_0xe84a('0x47')];return _0x27b8b2;};exports['agentReadyId']=function(_0x1ae18e){var _0x4aef02=[];for(var _0x206a94 in _0x1ae18e){if(_0x1ae18e['hasOwnProperty'](_0x206a94)){if(!_[_0xe84a('0x13')](_0x1ae18e[_0x206a94])&&_0x1ae18e[_0x206a94][_0xe84a('0x36')]===_0xe84a('0x63')&&_0x1ae18e[_0x206a94][_0xe84a('0x64')]==='reachable'){_0x4aef02['push'](_0x1ae18e[_0x206a94]['id']);}}}return _0x4aef02;};exports[_0xe84a('0x65')]=function(_0x1ee84a){var _0x5d5fb9=moment()[_0xe84a('0x4')](0x0);var _0x3791b0=moment(_0x1ee84a)[_0xe84a('0x4')](0x0);return _0x5d5fb9[_0xe84a('0x66')](_0x3791b0,_0xe84a('0x67'));};exports[_0xe84a('0x68')]=function(_0x17fc89){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x17fc89[_0xe84a('0x19')],'ListId':_0x17fc89[_0xe84a('0x59')],'VoiceQueueId':_0x17fc89[_0xe84a('0x1b')]||undefined,'CampaignId':_0x17fc89['CampaignId']||undefined};};exports[_0xe84a('0x69')]=function(_0x4a07a4){if(_0x4a07a4==='uniqueid'||_0x4a07a4===_0xe84a('0x6a')||_0x4a07a4===_0xe84a('0x60')||_0x4a07a4===_0xe84a('0x6b')||_0x4a07a4===_0xe84a('0x6c')||_0x4a07a4===_0xe84a('0x6d')||_0x4a07a4===_0xe84a('0x3c')||_0x4a07a4===_0xe84a('0x49')||_0x4a07a4==='calleridname'||_0x4a07a4===_0xe84a('0x56')||_0x4a07a4===_0xe84a('0x18')||_0x4a07a4==='scheduledat'||_0x4a07a4==='countbusyretry'||_0x4a07a4===_0xe84a('0x4e')||_0x4a07a4==='countnoanswerretry'||_0x4a07a4===_0xe84a('0x6e')||_0x4a07a4==='callback'||_0x4a07a4===_0xe84a('0x6f')||_0x4a07a4===_0xe84a('0x70')||_0x4a07a4===_0xe84a('0x71')||_0x4a07a4===_0xe84a('0x19')||_0x4a07a4===_0xe84a('0x59')||_0x4a07a4===_0xe84a('0x3d')||_0x4a07a4===_0xe84a('0x1b')||_0x4a07a4===_0xe84a('0x72')||_0x4a07a4===_0xe84a('0x73')||_0x4a07a4===_0xe84a('0x74')||_0x4a07a4===_0xe84a('0x75')||_0x4a07a4===_0xe84a('0x76')||_0x4a07a4===_0xe84a('0x77')||_0x4a07a4===_0xe84a('0x78')||_0x4a07a4===_0xe84a('0x79')||_0x4a07a4==='xmd-dialid'||_0x4a07a4===_0xe84a('0x7a')||_0x4a07a4===_0xe84a('0x7b')||_0x4a07a4==='xmd-cdrtype'||_0x4a07a4===_0xe84a('0x7c')||_0x4a07a4===_0xe84a('0x7d')||_0x4a07a4===_0xe84a('0x7e')||_0x4a07a4==='rtpaudioqos'||_0x4a07a4===_0xe84a('0x7f')||_0x4a07a4==='rtpaudioqosjitter'||_0x4a07a4===_0xe84a('0x80')||_0x4a07a4===_0xe84a('0x81')||_0x4a07a4===_0xe84a('0x82')||_0x4a07a4===_0xe84a('0x83')||_0x4a07a4===_0xe84a('0x84')||_0x4a07a4===_0xe84a('0x85')||_0x4a07a4===_0xe84a('0x7f')||_0x4a07a4===_0xe84a('0x86')||_0x4a07a4===_0xe84a('0x80')||_0x4a07a4===_0xe84a('0x81')||_0x4a07a4===_0xe84a('0x82')||_0x4a07a4===_0xe84a('0x83')||_0x4a07a4===_0xe84a('0x84')||_0x4a07a4==='bridgepeer'||_0x4a07a4===_0xe84a('0x87')||_0x4a07a4===_0xe84a('0x36')||_0x4a07a4===_0xe84a('0x3f')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x26f253,_0x59aa91){var _0xd1c54e,_0x11970d,_0x3051ec;if(_0x59aa91<=0x0){_0x59aa91=0x1;}_0xd1c54e=new RegExp(_0xe84a('0x88')+_0x59aa91+'}$');_0x11970d=Math[_0xe84a('0x89')](0xa,_0x59aa91-0x1);_0x3051ec=Math[_0xe84a('0x89')](0xa,_0x59aa91)-0x1;return util[_0xe84a('0x16')]('%s',_[_0xe84a('0x8a')](_0x26f253,_0xd1c54e,_[_0xe84a('0x8b')](_0x11970d,_0x3051ec)));};exports['extractCalleridName']=function(_0x5b31f8){var _0x141d76=_0x5b31f8[_0xe84a('0x8c')](/"(.*?)"/);return _0x141d76?_0x141d76[0x1]:_0x5b31f8;};exports[_0xe84a('0x8d')]=function(_0x538d67){var _0x18c969=_0x538d67[_0xe84a('0x8c')](/<(.*?)>/);return _0x18c969?_0x18c969[0x1]:_0x538d67;}; \ No newline at end of file +var _0xef16=['\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','responsetime','logAgent','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','xcally-motion-preview','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','statedesc','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','status','reachable','getDiff','milliseconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepeer','bridgepvtcallid','pow','replace','random','extractCalleridName','match','util','lodash','moment','preview','XCALLY_IP_AGI','127.0.0.1','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','format'];(function(_0x11dde4,_0x1d4852){var _0x6eea94=function(_0x182859){while(--_0x182859){_0x11dde4['push'](_0x11dde4['shift']());}};_0x6eea94(++_0x1d4852);}(_0xef16,0x7b));var _0x6ef1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xef16[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0x6ef1('0x0'));var _=require(_0x6ef1('0x1'));var moment=require(_0x6ef1('0x2'));var logger=require('../../../../config/logger')(_0x6ef1('0x3'));var ipAgi=process['env'][_0x6ef1('0x4')]||_0x6ef1('0x5');function getSeconds(_0xafd209,_0x2d9f8e){var _0x1f2365=moment(_0xafd209)['milliseconds'](0x0);var _0x2753c4=moment(_0x2d9f8e)['milliseconds'](0x0);return _0x1f2365[_0x6ef1('0x6')](_0x2753c4,_0x6ef1('0x7'));}exports[_0x6ef1('0x8')]=function(_0xa417){return function(_0xd5f80c){logger[_0x6ef1('0x9')](_0xa417,util[_0x6ef1('0xa')](_0xd5f80c,{'showHidden':![],'depth':null}));};};exports[_0x6ef1('0xb')]=function(_0x435e87,_0x56f5fc){logger[_0x6ef1('0xc')](_0x435e87,util[_0x6ef1('0xa')](_0x56f5fc,{'showHidden':![],'depth':null}));};exports[_0x6ef1('0xd')]=function(_0x5a9351,_0x552647){logger[_0x6ef1('0x9')](_0x5a9351,util[_0x6ef1('0xa')](_0x552647,{'showHidden':![],'depth':null}));};exports[_0x6ef1('0xe')]=function(_0xdda66e){return function(_0x515125){logger['info'](_0xdda66e,util[_0x6ef1('0xa')](_0x515125,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x31fbe0,_0x595d00,_0x56ae6e){return{'message':_0x31fbe0,'unlock':_0x595d00,'active':_0x56ae6e};};exports[_0x6ef1('0xf')]=function(_0x22f895,_0xab191c,_0x6c7912){if(!_[_0x6ef1('0x10')](_0x6c7912)&&'string'===typeof _0x6c7912&&!_['isEmpty'](_0x6c7912)){if(!_[_0x6ef1('0x10')](_0xab191c)&&_0x6ef1('0x11')===typeof _0xab191c&&!_[_0x6ef1('0x12')](_0xab191c)){return util['format']('\x22%s\x22\x20<%s>',_0xab191c,_0x6c7912);}return util[_0x6ef1('0x13')](_0x6ef1('0x14'),_0x6c7912,_0x6c7912);}if(!_[_0x6ef1('0x10')](_0x22f895)&&'string'===typeof _0x22f895&&!_[_0x6ef1('0x12')](_0x22f895)){return _0x22f895;}return _0x6ef1('0x15');};exports['isActive']=function(_0x2f8d9b){if(_[_0x6ef1('0x16')](_0x2f8d9b)){return![];}return _0x2f8d9b;};exports[_0x6ef1('0x17')]=function(_0x557c2b,_0x472658,_0xc40b49,_0x175dfb,_0x4250f4,_0x2d8bea){var _0x4f80d2={'XMD-QUEUE':_0x472658[_0x6ef1('0x18')]?_0x472658[_0x6ef1('0x18')][_0x6ef1('0x19')]:'','XMD-CALLERID':_0x175dfb,'XMD-CALLERID-PREVIEW':_0x2d8bea?util[_0x6ef1('0x13')](_0x6ef1('0x14'),_0x2d8bea[_0x6ef1('0x1a')],_0x2d8bea[_0x6ef1('0x1b')]):_0x175dfb,'XMD-DIALID':_0x4250f4,'XMD-CONTACTID':_0x472658[_0x6ef1('0x1c')],'XMD-CDRTYPE':_0x6ef1('0x1d'),'CALLERID(all)':_0x175dfb,'XMD-VOICEQUEUEID':_0x472658['VoiceQueueId'],'XMD-DIALCHANNEL':_0xc40b49,'XMD-DIALTIMEOUT':_0x557c2b['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x6ef1('0x13')](_0x6ef1('0x1e'),_0x557c2b[_0x6ef1('0x1f')]?'g':'',_['isEmpty'](_0x557c2b[_0x6ef1('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x557c2b[_0x6ef1('0x21')]||'','XMD-AGI':_0x557c2b['dialQueueProject']?util[_0x6ef1('0x13')](_0x6ef1('0x22'),ipAgi,_0x557c2b['dialQueueProject']):_0x6ef1('0x23'),'XMD-AGIAFTER':_0x557c2b[_0x6ef1('0x1f')]?util[_0x6ef1('0x13')](_0x6ef1('0x22'),ipAgi,_0x557c2b['dialQueueProject2']):_0x6ef1('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x2d8bea?_0x2d8bea[_0x6ef1('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x2d8bea?_0x2d8bea[_0x6ef1('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x6ef1('0x12')](_0x557c2b[_0x6ef1('0x20')])){_0x4f80d2[util[_0x6ef1('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x557c2b[_0x6ef1('0x20')];_0x4f80d2[util[_0x6ef1('0x13')]('%s',_0x6ef1('0x26'))]=_0x4250f4;}if(_0x472658&&_0x472658[_0x6ef1('0x27')]){for(var _0x3b1f0b in _0x472658['Contact']){if(_0x472658[_0x6ef1('0x27')][_0x6ef1('0x28')](_0x3b1f0b)){if(!_[_0x6ef1('0x16')](_0x472658[_0x6ef1('0x27')][_0x3b1f0b])&&_0x3b1f0b!=='id'&&_0x3b1f0b!==_0x6ef1('0x29')&&_0x3b1f0b!==_0x6ef1('0x2a')&&_0x3b1f0b!==_0x6ef1('0x2b')){_0x4f80d2[util[_0x6ef1('0x13')]('%s%s',_0x6ef1('0x2c'),_[_0x6ef1('0x2d')](_0x3b1f0b))]=_0x472658[_0x6ef1('0x27')][_0x3b1f0b];}}}}return _0x4f80d2;};exports[_0x6ef1('0x2e')]=function(_0x136f45){var _0x3fbee2={};for(var _0x1feccf in _0x136f45){if(_0x136f45[_0x6ef1('0x28')](_0x1feccf)){_0x3fbee2[util[_0x6ef1('0x13')]('%s',_[_0x6ef1('0x2f')](_0x1feccf))]=_0x136f45[_0x1feccf];}}return{'variables':_0x3fbee2};};exports[_0x6ef1('0x30')]=function(_0x4cd928,_0x5aa342){if(!_['isNil'](_0x4cd928)){if(_0x4cd928[_0x6ef1('0x28')](_0x6ef1('0x31'))){if(_0x4cd928[_0x6ef1('0x31')]>0x0){_0x4cd928[_0x6ef1('0x31')]-=0x1;}else{logger[_0x6ef1('0x9')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5aa342);}}}else{logger[_0x6ef1('0x9')](_0x6ef1('0x32'),_0x5aa342);}};exports['logBlacklist']=function(_0x406631){var _0x350fb=moment()['format'](_0x6ef1('0x33'));_0x406631[_0x6ef1('0x34')]=0xd;_0x406631['statedesc']=_0x6ef1('0x35');_0x406631['starttime']=_0x350fb;_0x406631[_0x6ef1('0x36')]=_0x350fb;_0x406631['endtime']=_0x350fb;};exports[_0x6ef1('0x37')]=function(_0x238362,_0x4111a6,_0xb1b706){var _0x3cc19c=moment()[_0x6ef1('0x13')](_0x6ef1('0x33'));_0x238362[_0x6ef1('0x34')]=_0x4111a6;_0x238362['statedesc']=_0xb1b706;_0x238362[_0x6ef1('0x36')]=_0x3cc19c;_0x238362[_0x6ef1('0x38')]=getSeconds(_0x238362[_0x6ef1('0x36')],_0x238362[_0x6ef1('0x39')]);};exports[_0x6ef1('0x3a')]=function(_0x18ed55,_0x27f45c,_0x1cab85){_0x18ed55[_0x6ef1('0x3b')]=_0x27f45c;_0x18ed55[_0x6ef1('0x3c')]=_0x1cab85;};exports[_0x6ef1('0x3d')]=function(_0x2b99ce,_0x3aa354,_0x25b69f){var _0x217a69=moment()[_0x6ef1('0x13')](_0x6ef1('0x33'));_0x2b99ce[_0x6ef1('0x34')]=_0x3aa354;_0x2b99ce['statedesc']=_0x25b69f;_0x2b99ce[_0x6ef1('0x36')]=_0x2b99ce[_0x6ef1('0x36')]?_0x2b99ce['responsetime']:_0x217a69;_0x2b99ce[_0x6ef1('0x3e')]=_0x2b99ce[_0x6ef1('0x3e')]?_0x2b99ce[_0x6ef1('0x3e')]:_0x217a69;_0x2b99ce[_0x6ef1('0x38')]=getSeconds(_0x2b99ce[_0x6ef1('0x36')]||0x0,_0x2b99ce[_0x6ef1('0x39')]||0x0);_0x2b99ce[_0x6ef1('0x3f')]=_0x2b99ce[_0x6ef1('0x40')]?getSeconds(_0x2b99ce['endtime'],_0x2b99ce[_0x6ef1('0x40')]):0x0;};exports[_0x6ef1('0x41')]=function(_0x32a215){return _0x32a215===_0x6ef1('0x42');};exports[_0x6ef1('0x43')]=function(_0x2668b8,_0x43d94c,_0x1708d8,_0x35b3df,_0x1082fd){var _0x1392e3=_0x35b3df?_0x6ef1('0x44'):_0x2668b8[_0x6ef1('0x1a')];_0x1392e3=_0x1082fd?_0x6ef1('0x45'):_0x1392e3;return{'actionid':_0x2668b8[_0x6ef1('0x46')],'action':'originate','channel':_0x2668b8[_0x6ef1('0x47')],'callerid':util['format'](_0x6ef1('0x14'),_0x1392e3,_0x2668b8['calleridnum']),'Exten':_0x6ef1('0x48'),'Context':_0x6ef1('0x49'),'Priority':'1','variable':_0x1708d8,'timeout':(_0x43d94c['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2668b8[_0x6ef1('0x46')]};};exports[_0x6ef1('0x4a')]=function(_0x3990ed){return _0x3990ed[_0x6ef1('0x4b')]+_0x3990ed[_0x6ef1('0x4c')]+_0x3990ed[_0x6ef1('0x4d')]+_0x3990ed[_0x6ef1('0x4e')]+_0x3990ed[_0x6ef1('0x4f')];};exports[_0x6ef1('0x50')]=function(_0x101fb4){var _0xba0d6f=_[_0x6ef1('0x51')](_0x101fb4);_0xba0d6f[_0x6ef1('0x34')]=0xf;_0xba0d6f[_0x6ef1('0x52')]='Global';return _0xba0d6f;};exports[_0x6ef1('0x53')]=function(_0xfa5e9b,_0x22cb3d,_0x3a8f3a){var _0x4eed5f={};_0x4eed5f[_0x22cb3d]=_0xfa5e9b[_0x22cb3d];_0x4eed5f[_0x6ef1('0x54')]=![];_0x4eed5f[_0x6ef1('0x55')]=moment()['add'](_0x3a8f3a,_0x6ef1('0x56'))[_0x6ef1('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x4eed5f[_0x6ef1('0x1c')]=_0xfa5e9b[_0x6ef1('0x1c')];_0x4eed5f[_0x6ef1('0x57')]=_0xfa5e9b['ListId'];_0x4eed5f[_0x6ef1('0x58')]=_0xfa5e9b[_0x6ef1('0x58')]||undefined;return _0x4eed5f;};exports[_0x6ef1('0x59')]=function(_0x53e84b,_0xf12c1d){if(!_[_0x6ef1('0x16')](_0x53e84b)){if(_0x53e84b['pTalking']>0x0){_0x53e84b[_0x6ef1('0x5a')]-=0x1;}else{logger[_0x6ef1('0x9')](_0xf12c1d,_0x6ef1('0x5b'));}}else{logger['error'](_0xf12c1d,_0x6ef1('0x5c'));}};exports['IsNotLoggedIn']=function(_0x515efa){if(_0x515efa<=0x0){return!![];}return![];};exports[_0x6ef1('0x5d')]=function(_0xa24cfa,_0x30dd62,_0x9abb12){_0xa24cfa[_0x6ef1('0x5e')]=_0x30dd62;_0xa24cfa[_0x6ef1('0x19')]=_0xa24cfa[_0x6ef1('0x5f')];_0xa24cfa[_0x6ef1('0x60')]=_0xa24cfa[_0x6ef1('0x47')];if(_0x9abb12){_0xa24cfa[_0x6ef1('0x61')]=_0x9abb12[_0x6ef1('0x61')];}return _0xa24cfa;};exports[_0x6ef1('0x62')]=function(_0x10b896){var _0x2ffefc={};_0x2ffefc['queue']=_0x10b896['queue'];_0x2ffefc[_0x6ef1('0x60')]=_0x10b896[_0x6ef1('0x47')];_0x2ffefc[_0x6ef1('0x46')]=_0x10b896[_0x6ef1('0x46')];return _0x2ffefc;};exports[_0x6ef1('0x63')]=function(_0x47bad2){var _0x40efb1=[];for(var _0x4b7f03 in _0x47bad2){if(_0x47bad2['hasOwnProperty'](_0x4b7f03)){if(!_[_0x6ef1('0x16')](_0x47bad2[_0x4b7f03])&&_0x47bad2[_0x4b7f03][_0x6ef1('0x34')]==='not_inuse'&&_0x47bad2[_0x4b7f03][_0x6ef1('0x64')]===_0x6ef1('0x65')){_0x40efb1['push'](_0x47bad2[_0x4b7f03]['id']);}}}return _0x40efb1;};exports[_0x6ef1('0x66')]=function(_0x73dbe1){var _0x28a1b9=moment()[_0x6ef1('0x67')](0x0);var _0x1a6840=moment(_0x73dbe1)[_0x6ef1('0x67')](0x0);return _0x28a1b9[_0x6ef1('0x6')](_0x1a6840,_0x6ef1('0x7'));};exports[_0x6ef1('0x68')]=function(_0x3c0a64){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3c0a64[_0x6ef1('0x1c')],'ListId':_0x3c0a64[_0x6ef1('0x57')],'VoiceQueueId':_0x3c0a64['VoiceQueueId']||undefined,'CampaignId':_0x3c0a64[_0x6ef1('0x69')]||undefined};};exports[_0x6ef1('0x6a')]=function(_0x10eb07){if(_0x10eb07==='uniqueid'||_0x10eb07===_0x6ef1('0x6b')||_0x10eb07==='queue'||_0x10eb07===_0x6ef1('0x6c')||_0x10eb07===_0x6ef1('0x6d')||_0x10eb07===_0x6ef1('0x6e')||_0x10eb07===_0x6ef1('0x3b')||_0x10eb07==='channelAgent'||_0x10eb07===_0x6ef1('0x1a')||_0x10eb07===_0x6ef1('0x54')||_0x10eb07===_0x6ef1('0x1b')||_0x10eb07===_0x6ef1('0x55')||_0x10eb07===_0x6ef1('0x4b')||_0x10eb07===_0x6ef1('0x4c')||_0x10eb07===_0x6ef1('0x4d')||_0x10eb07===_0x6ef1('0x6f')||_0x10eb07===_0x6ef1('0x70')||_0x10eb07===_0x6ef1('0x71')||_0x10eb07===_0x6ef1('0x72')||_0x10eb07===_0x6ef1('0x73')||_0x10eb07===_0x6ef1('0x1c')||_0x10eb07===_0x6ef1('0x57')||_0x10eb07==='UserId'||_0x10eb07===_0x6ef1('0x58')||_0x10eb07===_0x6ef1('0x74')||_0x10eb07===_0x6ef1('0x75')||_0x10eb07===_0x6ef1('0x76')||_0x10eb07===_0x6ef1('0x77')||_0x10eb07===_0x6ef1('0x78')||_0x10eb07===_0x6ef1('0x79')||_0x10eb07===_0x6ef1('0x7a')||_0x10eb07==='xmd-dialoptions'||_0x10eb07===_0x6ef1('0x7b')||_0x10eb07===_0x6ef1('0x7c')||_0x10eb07===_0x6ef1('0x7d')||_0x10eb07===_0x6ef1('0x7e')||_0x10eb07===_0x6ef1('0x7f')||_0x10eb07==='xmd-agiafter'||_0x10eb07===_0x6ef1('0x80')||_0x10eb07===_0x6ef1('0x81')||_0x10eb07==='rtpaudioqosbridged'||_0x10eb07===_0x6ef1('0x82')||_0x10eb07===_0x6ef1('0x83')||_0x10eb07===_0x6ef1('0x84')||_0x10eb07===_0x6ef1('0x85')||_0x10eb07==='rtpaudioqosrtt'||_0x10eb07===_0x6ef1('0x86')||_0x10eb07===_0x6ef1('0x81')||_0x10eb07===_0x6ef1('0x87')||_0x10eb07==='rtpaudioqosjitter'||_0x10eb07===_0x6ef1('0x83')||_0x10eb07===_0x6ef1('0x84')||_0x10eb07===_0x6ef1('0x85')||_0x10eb07==='rtpaudioqosrtt'||_0x10eb07===_0x6ef1('0x86')||_0x10eb07===_0x6ef1('0x88')||_0x10eb07===_0x6ef1('0x89')||_0x10eb07===_0x6ef1('0x34')||_0x10eb07===_0x6ef1('0x52')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x1ca355,_0x4234cb){var _0x4f2e3c,_0x29095c,_0x29ed24;if(_0x4234cb<=0x0){_0x4234cb=0x1;}_0x4f2e3c=new RegExp('\x5cw{0,'+_0x4234cb+'}$');_0x29095c=Math['pow'](0xa,_0x4234cb-0x1);_0x29ed24=Math[_0x6ef1('0x8a')](0xa,_0x4234cb)-0x1;return util[_0x6ef1('0x13')]('%s',_[_0x6ef1('0x8b')](_0x1ca355,_0x4f2e3c,_[_0x6ef1('0x8c')](_0x29095c,_0x29ed24)));};exports[_0x6ef1('0x8d')]=function(_0x419b80){var _0x513679=_0x419b80[_0x6ef1('0x8e')](/"(.*?)"/);return _0x513679?_0x513679[0x1]:_0x419b80;};exports['extractCalleridNumber']=function(_0x1deedb){var _0x494fff=_0x1deedb[_0x6ef1('0x8e')](/<(.*?)>/);return _0x494fff?_0x494fff[0x1]:_0x1deedb;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 995ad4d..2d67467 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 _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x413d74,_0x5bab1b){var _0x177f90=function(_0x15e9de){while(--_0x15e9de){_0x413d74['push'](_0x413d74['shift']());}};_0x177f90(++_0x5bab1b);}(_0xb10b,0x12a));var _0xbb10=function(_0x49f856,_0x26dc54){_0x49f856=_0x49f856-0x0;var _0x1bacb6=_0xb10b[_0x49f856];return _0x1bacb6;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x5a2a96,_0x4014f2){var _0x264e1f=function(_0x2af760){while(--_0x2af760){_0x5a2a96['push'](_0x5a2a96['shift']());}};_0x264e1f(++_0x4014f2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3fab70,_0xb0e49b){_0x3fab70=_0x3fab70-0x0;var _0x2da866=_0x5f2f[_0x3fab70];return _0x2da866;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 3668123..c431409 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 _0x8d0e=['voiceQueues','isUndefined','initTriggers','initTemplates','initZendeskAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','duration','disposition','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','triggers','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','timers','zendeskAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','hasOwnProperty','mapKeys','interface','format','name','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','length','isNil','SIP/%s','initTelephones','initTrunks','trunks','initVoiceQueues'];(function(_0x1da706,_0x807b21){var _0x3a4484=function(_0x1b3a79){while(--_0x1b3a79){_0x1da706['push'](_0x1da706['shift']());}};_0x3a4484(++_0x807b21);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x335640,_0x3d78e4){_0x335640=_0x335640-0x0;var _0x3c4b9c=_0x8d0e[_0x335640];return _0x3c4b9c;};'use strict';var BPromise=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var _=require(_0xe8d0('0x2'));var moment=require(_0xe8d0('0x3'));var Agent=require(_0xe8d0('0x4'));var Telephone=require(_0xe8d0('0x5'));var Trunk=require(_0xe8d0('0x6'));var VoiceQueue=require(_0xe8d0('0x7'));var Trigger=require(_0xe8d0('0x8'));var Template=require('../model/template');var Campaign=require(_0xe8d0('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xe8d0('0xa'));var FreshdeskAccount=require(_0xe8d0('0xb'));var SugarcrmAccount=require(_0xe8d0('0xc'));var ZohoAccount=require(_0xe8d0('0xd'));var DeskAccount=require(_0xe8d0('0xe'));var VtigerAccount=require(_0xe8d0('0xf'));var ServicenowAccount=require(_0xe8d0('0x10'));var Dynamics365Account=require(_0xe8d0('0x11'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xe8d0('0x12'));var Realtime=function(){this[_0xe8d0('0x13')]={};this[_0xe8d0('0x14')]={};this['trunks']={};this['voiceQueues']={};this[_0xe8d0('0x15')]={};this[_0xe8d0('0x16')]={};this[_0xe8d0('0x17')]={};this[_0xe8d0('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe8d0('0x19')]={};this[_0xe8d0('0x1a')]={};this['queueChannels']={};this[_0xe8d0('0x1b')]={};this[_0xe8d0('0x1c')]={};this['settings']={};this[_0xe8d0('0x1d')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0xe8d0('0x1e')]={};this[_0xe8d0('0x1f')]={};this[_0xe8d0('0x20')]={};this[_0xe8d0('0x21')]={};this[_0xe8d0('0x22')]={};this[_0xe8d0('0x23')]={};this['freshsalesAccounts']={};this[_0xe8d0('0x24')]={};};function freeIsNotKey(_0x49554d,_0x6d932b,_0x3c526c){var _0xfe8a4=_['mapKeys'](_0x49554d,function(_0x4d0ddb,_0x47c67a){return _0x4d0ddb[_0x3c526c];});for(var _0x1bdd94 in _0x6d932b){if(_0x6d932b[_0xe8d0('0x25')](_0x1bdd94)){if(!_0xfe8a4[_0x1bdd94]){delete _0x6d932b[_0x1bdd94];}}}}function freeIsNotKeySip(_0x27b910,_0x44bbe4){var _0x83177b=_['mapKeys'](_0x27b910,function(_0x105861,_0x12ebf4){return util['format']('SIP/%s',_0x105861['name']);});for(var _0x384a60 in _0x44bbe4){if(_0x44bbe4[_0xe8d0('0x25')](_0x384a60)){if(!_0x83177b[_0x384a60]){delete _0x44bbe4[_0x384a60];}}}}function freeIsNotKeyAgent(_0x25363b,_0x1fbfe8){var _0x25f764=_[_0xe8d0('0x26')](_0x25363b,function(_0x1bd25c,_0x28a6b5){var _0x32e39a=_['isNil'](_0x1bd25c[_0xe8d0('0x27')])?util[_0xe8d0('0x28')]('SIP/%s',_0x1bd25c[_0xe8d0('0x29')]):_0x1bd25c[_0xe8d0('0x27')];return _0x32e39a;});for(var _0x274cac in _0x1fbfe8){if(_0x1fbfe8[_0xe8d0('0x25')](_0x274cac)){if(!_0x25f764[_0x274cac]){delete _0x1fbfe8[_0x274cac];}}}}function clearVoiceCallReports(_0x146783){_0x146783[_0xe8d0('0x2a')]=0x0;_0x146783[_0xe8d0('0x2b')]=0x0;_0x146783[_0xe8d0('0x2c')]=0x0;_0x146783[_0xe8d0('0x2d')]=0x0;_0x146783[_0xe8d0('0x2e')]=0x0;}function clearCampaigns(_0x264de4){if(!_['isEmpty'](_0x264de4)){for(var _0x24982c in _0x264de4){if(_0x264de4[_0xe8d0('0x25')](_0x24982c)){_0x264de4[_0x24982c][_0xe8d0('0x2f')]=0x0;_0x264de4[_0x24982c]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x10a30b){if(!_[_0xe8d0('0x30')](_0x10a30b)){for(var _0x526240 in _0x10a30b){if(_0x10a30b[_0xe8d0('0x25')](_0x526240)){_0x10a30b[_0x526240][_0xe8d0('0x2a')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x2b')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x31')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x32')]=0x0;_0x10a30b[_0x526240]['sumHoldTime']=0x0;_0x10a30b[_0x526240][_0xe8d0('0x2d')]=0x0;_0x10a30b[_0x526240]['sumBillable']=0x0;_0x10a30b[_0x526240]['outboundAnswerAgiCallsDay']=0x0;_0x10a30b[_0x526240]['outboundNoAnswerCallsDay']=0x0;_0x10a30b[_0x526240][_0xe8d0('0x33')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x34')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x35')]=0x0;_0x10a30b[_0x526240]['outboundUnknownCallsDay']=0x0;_0x10a30b[_0x526240]['outboundDropCallsDayTimeout']=0x0;_0x10a30b[_0x526240][_0xe8d0('0x36')]=0x0;_0x10a30b[_0x526240]['outboundBlacklistCallsDay']=0x0;_0x10a30b[_0x526240][_0xe8d0('0x37')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x38')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x39')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x3a')]=0x0;_0x10a30b[_0x526240][_0xe8d0('0x3b')]=0x0;_0x10a30b[_0x526240]['queueStatusComplete']=!![];}}}}Realtime[_0xe8d0('0x3c')][_0xe8d0('0x3d')]=function(_0x402e90,_0x145ddb){for(var _0x587819 in _0x145ddb){if(_0x402e90[_0xe8d0('0x25')](_0x587819)){_0x402e90[_0x587819]=_0x145ddb[_0x587819];}}};Realtime[_0xe8d0('0x3c')]['initAgents']=function(){var _0x42c31f=this;return function(_0x51be84){if(_0x51be84){freeIsNotKeyAgent(_0x51be84,_0x42c31f[_0xe8d0('0x13')]);for(var _0x5dc4ca=0x0,_0x197e01={},_0x531835={};_0x5dc4ca<_0x51be84[_0xe8d0('0x3e')];_0x5dc4ca+=0x1){_0x197e01=_0x51be84[_0x5dc4ca];var _0xb2cdbf=_[_0xe8d0('0x3f')](_0x197e01[_0xe8d0('0x27')])?util['format'](_0xe8d0('0x40'),_0x197e01[_0xe8d0('0x29')]):_0x197e01[_0xe8d0('0x27')];if(_['isUndefined'](_0x42c31f[_0xe8d0('0x13')][_0xb2cdbf])){_0x42c31f[_0xe8d0('0x13')][_0xb2cdbf]=new Agent(_0x197e01);}else{_0x42c31f[_0xe8d0('0x3d')](_0x42c31f[_0xe8d0('0x13')][_0xb2cdbf],_0x197e01);}}}return _0x42c31f[_0xe8d0('0x13')];};};Realtime['prototype'][_0xe8d0('0x41')]=function(){var _0x1828c5=this;return function(_0x10970d){if(_0x10970d){freeIsNotKeySip(_0x10970d,_0x1828c5[_0xe8d0('0x14')]);for(var _0x318106=0x0,_0x23d72e={},_0xbb9620={};_0x318106<_0x10970d[_0xe8d0('0x3e')];_0x318106+=0x1){_0x23d72e=_0x10970d[_0x318106];if(_['isUndefined'](_0x1828c5['telephones'][util[_0xe8d0('0x28')](_0xe8d0('0x40'),_0x23d72e[_0xe8d0('0x29')])])){_0x1828c5[_0xe8d0('0x14')][util[_0xe8d0('0x28')]('SIP/%s',_0x23d72e[_0xe8d0('0x29')])]=new Telephone(_0x23d72e);}else{_0x1828c5['mergeFromDatabase'](_0x1828c5[_0xe8d0('0x14')][util[_0xe8d0('0x28')](_0xe8d0('0x40'),_0x23d72e['name'])],_0x23d72e);}}}return _0x1828c5[_0xe8d0('0x14')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x42')]=function(){var _0x230a90=this;return function(_0x87ac2e){if(_0x87ac2e){freeIsNotKeySip(_0x87ac2e,_0x230a90['trunks']);for(var _0x5ca42a=0x0,_0x57de98={},_0x4cf0da={};_0x5ca42a<_0x87ac2e[_0xe8d0('0x3e')];_0x5ca42a+=0x1){_0x57de98=_0x87ac2e[_0x5ca42a];if(_['isUndefined'](_0x230a90[_0xe8d0('0x43')][util[_0xe8d0('0x28')](_0xe8d0('0x40'),_0x57de98[_0xe8d0('0x29')])])){_0x230a90[_0xe8d0('0x43')][util[_0xe8d0('0x28')](_0xe8d0('0x40'),_0x57de98[_0xe8d0('0x29')])]=new Trunk(_0x57de98);}else{_0x230a90['mergeFromDatabase'](_0x230a90[_0xe8d0('0x43')][util[_0xe8d0('0x28')]('SIP/%s',_0x57de98['name'])],_0x57de98);}}}return _0x230a90[_0xe8d0('0x43')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x44')]=function(){var _0x481e99=this;return function(_0x1eb1f1){if(_0x1eb1f1){freeIsNotKey(_0x1eb1f1,_0x481e99[_0xe8d0('0x45')],'name');for(var _0x19731d=0x0,_0x415046={},_0x5370c9={};_0x19731d<_0x1eb1f1[_0xe8d0('0x3e')];_0x19731d+=0x1){_0x415046=_0x1eb1f1[_0x19731d];if(_[_0xe8d0('0x46')](_0x481e99[_0xe8d0('0x45')][_0x415046[_0xe8d0('0x29')]])){_0x481e99[_0xe8d0('0x45')][_0x415046[_0xe8d0('0x29')]]=new VoiceQueue(_0x415046);}else{_0x481e99[_0xe8d0('0x3d')](_0x481e99[_0xe8d0('0x45')][_0x415046['name']],_0x415046);}}}return _0x481e99[_0xe8d0('0x45')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x47')]=function(){var _0x2278ef=this;return function(_0x28d38b){if(_0x28d38b){freeIsNotKey(_0x28d38b,_0x2278ef[_0xe8d0('0x15')],'id');for(var _0x1d0875=0x0,_0x41b8af={},_0x250f51={};_0x1d0875<_0x28d38b[_0xe8d0('0x3e')];_0x1d0875+=0x1){_0x41b8af=_0x28d38b[_0x1d0875];if(_[_0xe8d0('0x46')](_0x2278ef[_0xe8d0('0x15')][_0x41b8af['id']])){_0x2278ef['triggers'][_0x41b8af['id']]=new Trigger(_0x41b8af);}else{_0x2278ef[_0xe8d0('0x3d')](_0x2278ef[_0xe8d0('0x15')][_0x41b8af['id']],_0x41b8af);}}}return _0x2278ef[_0xe8d0('0x15')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x48')]=function(){var _0x2e4caf=this;return function(_0x5a0c7e){if(_0x5a0c7e){freeIsNotKey(_0x5a0c7e,_0x2e4caf['templates'],'id');for(var _0x12324a=0x0,_0x424764={},_0x151cf4={};_0x12324a<_0x5a0c7e[_0xe8d0('0x3e')];_0x12324a+=0x1){_0x424764=_0x5a0c7e[_0x12324a];if(_['isUndefined'](_0x2e4caf[_0xe8d0('0x17')][_0x424764['id']])){_0x2e4caf['templates'][_0x424764['id']]=new Template(_0x424764);}else{_0x2e4caf[_0xe8d0('0x3d')](_0x2e4caf[_0xe8d0('0x17')][_0x424764['id']],_0x424764);}}}return _0x2e4caf[_0xe8d0('0x17')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x49')]=function(){var _0x34efb0=this;return function(_0x1646fb){if(_0x1646fb){freeIsNotKey(_0x1646fb,_0x34efb0['zendeskAccounts'],'id');for(var _0x137bc3=0x0,_0x55f93d={},_0x581a34={};_0x137bc3<_0x1646fb[_0xe8d0('0x3e')];_0x137bc3+=0x1){_0x55f93d=_0x1646fb[_0x137bc3];if(_['isUndefined'](_0x34efb0[_0xe8d0('0x1d')][_0x55f93d['id']])){_0x34efb0['zendeskAccounts'][_0x55f93d['id']]=new ZendeskAccount(_0x55f93d);}else{_0x34efb0[_0xe8d0('0x3d')](_0x34efb0[_0xe8d0('0x1d')][_0x55f93d['id']],_0x55f93d);}}}return _0x34efb0[_0xe8d0('0x1d')];};};Realtime[_0xe8d0('0x3c')]['initSalesforceAccounts']=function(){var _0x3088b1=this;return function(_0xbd55db){if(_0xbd55db){freeIsNotKey(_0xbd55db,_0x3088b1[_0xe8d0('0x4a')],'id');for(var _0x2e3f1d=0x0,_0x18cc14={},_0x57b77a={};_0x2e3f1d<_0xbd55db[_0xe8d0('0x3e')];_0x2e3f1d+=0x1){_0x18cc14=_0xbd55db[_0x2e3f1d];if(_[_0xe8d0('0x46')](_0x3088b1[_0xe8d0('0x4a')][_0x18cc14['id']])){_0x3088b1['salesforceAccounts'][_0x18cc14['id']]=new SalesforceAccount(_0x18cc14);}else{_0x3088b1[_0xe8d0('0x3d')](_0x3088b1['salesforceAccounts'][_0x18cc14['id']],_0x18cc14);}}}return _0x3088b1['salesforceAccounts'];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x4b')]=function(){var _0x4e7b49=this;return function(_0xcb6ce2){if(_0xcb6ce2){freeIsNotKey(_0xcb6ce2,_0x4e7b49[_0xe8d0('0x1e')],'id');for(var _0x47893d=0x0,_0x2a54c1={},_0xe67928={};_0x47893d<_0xcb6ce2[_0xe8d0('0x3e')];_0x47893d+=0x1){_0x2a54c1=_0xcb6ce2[_0x47893d];if(_[_0xe8d0('0x46')](_0x4e7b49['freshdeskAccounts'][_0x2a54c1['id']])){_0x4e7b49[_0xe8d0('0x1e')][_0x2a54c1['id']]=new FreshdeskAccount(_0x2a54c1);}else{_0x4e7b49[_0xe8d0('0x3d')](_0x4e7b49[_0xe8d0('0x1e')][_0x2a54c1['id']],_0x2a54c1);}}}return _0x4e7b49[_0xe8d0('0x1e')];};};Realtime['prototype'][_0xe8d0('0x4c')]=function(){var _0x677679=this;return function(_0x17c044){if(_0x17c044){freeIsNotKey(_0x17c044,_0x677679[_0xe8d0('0x1f')],'id');for(var _0x1a74d0=0x0,_0x29667c={},_0x595b24={};_0x1a74d0<_0x17c044['length'];_0x1a74d0+=0x1){_0x29667c=_0x17c044[_0x1a74d0];if(_[_0xe8d0('0x46')](_0x677679['zohoAccounts'][_0x29667c['id']])){_0x677679[_0xe8d0('0x1f')][_0x29667c['id']]=new ZohoAccount(_0x29667c);}else{_0x677679[_0xe8d0('0x3d')](_0x677679['zohoAccounts'][_0x29667c['id']],_0x29667c);}}}return _0x677679['zohoAccounts'];};};Realtime[_0xe8d0('0x3c')]['initDeskAccounts']=function(){var _0x26af63=this;return function(_0x4c458a){if(_0x4c458a){freeIsNotKey(_0x4c458a,_0x26af63[_0xe8d0('0x20')],'id');for(var _0x2c765d=0x0,_0x13b9f0={},_0x4e2abc={};_0x2c765d<_0x4c458a[_0xe8d0('0x3e')];_0x2c765d+=0x1){_0x13b9f0=_0x4c458a[_0x2c765d];if(_[_0xe8d0('0x46')](_0x26af63['deskAccounts'][_0x13b9f0['id']])){_0x26af63[_0xe8d0('0x20')][_0x13b9f0['id']]=new DeskAccount(_0x13b9f0);}else{_0x26af63['mergeFromDatabase'](_0x26af63[_0xe8d0('0x20')][_0x13b9f0['id']],_0x13b9f0);}}}return _0x26af63['deskAccounts'];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x4d')]=function(){var _0x29467d=this;return function(_0x30817f){if(_0x30817f){freeIsNotKey(_0x30817f,_0x29467d[_0xe8d0('0x4e')],'id');for(var _0x4b271e=0x0,_0x4ee750={},_0xd7d433={};_0x4b271e<_0x30817f['length'];_0x4b271e+=0x1){_0x4ee750=_0x30817f[_0x4b271e];if(_[_0xe8d0('0x46')](_0x29467d[_0xe8d0('0x4e')][_0x4ee750['id']])){_0x29467d[_0xe8d0('0x4e')][_0x4ee750['id']]=new SugarcrmAccount(_0x4ee750);}else{_0x29467d[_0xe8d0('0x3d')](_0x29467d[_0xe8d0('0x4e')][_0x4ee750['id']],_0x4ee750);}}}return _0x29467d[_0xe8d0('0x4e')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x4f')]=function(){var _0x7557d9=this;return function(_0x2fc8bd){if(_0x2fc8bd){freeIsNotKey(_0x2fc8bd,_0x7557d9[_0xe8d0('0x21')],'id');for(var _0x29a7b3=0x0,_0x3258c8={},_0x1c41d8={};_0x29a7b3<_0x2fc8bd[_0xe8d0('0x3e')];_0x29a7b3+=0x1){_0x3258c8=_0x2fc8bd[_0x29a7b3];if(_['isUndefined'](_0x7557d9[_0xe8d0('0x21')][_0x3258c8['id']])){_0x7557d9[_0xe8d0('0x21')][_0x3258c8['id']]=new VtigerAccount(_0x3258c8);}else{_0x7557d9[_0xe8d0('0x3d')](_0x7557d9[_0xe8d0('0x21')][_0x3258c8['id']],_0x3258c8);}}}return _0x7557d9[_0xe8d0('0x21')];};};Realtime['prototype'][_0xe8d0('0x50')]=function(){var _0x1d30c0=this;return function(_0x45b42b){if(_0x45b42b){freeIsNotKey(_0x45b42b,_0x1d30c0[_0xe8d0('0x22')],'id');for(var _0x360633=0x0,_0xa215f={},_0x51eb0b={};_0x360633<_0x45b42b[_0xe8d0('0x3e')];_0x360633+=0x1){_0xa215f=_0x45b42b[_0x360633];if(_[_0xe8d0('0x46')](_0x1d30c0[_0xe8d0('0x22')][_0xa215f['id']])){_0x1d30c0[_0xe8d0('0x22')][_0xa215f['id']]=new ServicenowAccount(_0xa215f);}else{_0x1d30c0[_0xe8d0('0x3d')](_0x1d30c0['servicenowAccounts'][_0xa215f['id']],_0xa215f);}}}return _0x1d30c0['servicenowAccounts'];};};Realtime[_0xe8d0('0x3c')]['initDynamics365Accounts']=function(){var _0x169047=this;return function(_0x209263){if(_0x209263){freeIsNotKey(_0x209263,_0x169047['dynamics365Accounts'],'id');for(var _0x16a989=0x0,_0x1e3d33={},_0x243c09={};_0x16a989<_0x209263[_0xe8d0('0x3e')];_0x16a989+=0x1){_0x1e3d33=_0x209263[_0x16a989];if(_[_0xe8d0('0x46')](_0x169047[_0xe8d0('0x23')][_0x1e3d33['id']])){_0x169047[_0xe8d0('0x23')][_0x1e3d33['id']]=new Dynamics365Account(_0x1e3d33);}else{_0x169047[_0xe8d0('0x3d')](_0x169047[_0xe8d0('0x23')][_0x1e3d33['id']],_0x1e3d33);}}}return _0x169047[_0xe8d0('0x23')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x51')]=function(){var _0xa0c61a=this;return function(_0x2147d5){if(_0x2147d5){freeIsNotKey(_0x2147d5,_0xa0c61a[_0xe8d0('0x52')],'id');for(var _0x391510=0x0,_0xffd884={},_0x33e3ee={};_0x391510<_0x2147d5[_0xe8d0('0x3e')];_0x391510+=0x1){_0xffd884=_0x2147d5[_0x391510];if(_['isUndefined'](_0xa0c61a[_0xe8d0('0x52')][_0xffd884['id']])){_0xa0c61a[_0xe8d0('0x52')][_0xffd884['id']]=new FreshsalesAccount(_0xffd884);}else{_0xa0c61a[_0xe8d0('0x3d')](_0xa0c61a['freshsalesAccounts'][_0xffd884['id']],_0xffd884);}}}return _0xa0c61a[_0xe8d0('0x52')];};};Realtime['prototype'][_0xe8d0('0x53')]=function(){var _0x1c1794=this;return function(_0x22791b){for(var _0x561eb3=0x0;_0x561eb3<_0x22791b[_0xe8d0('0x3e')];_0x561eb3+=0x1){_[_0xe8d0('0x54')](_0x1c1794[_0xe8d0('0x45')][_0x22791b[_0x561eb3][_0xe8d0('0x29')]],_0x22791b[_0x561eb3]);}return _0x1c1794[_0xe8d0('0x45')];};};Realtime['prototype'][_0xe8d0('0x55')]=function(){var _0xbd7ee=this;return function(_0x23ba49){clearVoiceQueues(_0xbd7ee[_0xe8d0('0x45')]);if(_0x23ba49){_0x23ba49=_[_0xe8d0('0x56')](_0x23ba49,_0xe8d0('0x57'));for(var _0x16818f in _0x23ba49){if(_0x23ba49[_0xe8d0('0x25')](_0x16818f)){var _0x5334ee={};for(var _0x20a18b=0x0;_0x20a18b<_0x23ba49[_0x16818f][_0xe8d0('0x3e')];_0x20a18b+=0x1){var _0x14d722=_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x58')];if(_0xbd7ee['voiceQueues'][_0x14d722]){if(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x59')]){_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x31')]+=0x1;}if(_0x23ba49[_0x16818f][_0x20a18b]['queuecallerabandon']){_0xbd7ee[_0xe8d0('0x45')][_0x14d722]['abandoned']+=0x1;}_0xbd7ee[_0xe8d0('0x45')][_0x14d722]['sumHoldTime']+=moment(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5a')])[_0xe8d0('0x5b')](moment(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5c')]),_0xe8d0('0x5d'))||0x0;if(_0x20a18b===_0x23ba49[_0x16818f][_0xe8d0('0x3e')]-0x1){_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x2d')]+=moment(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5e')]||_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5f')]||_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x60')])[_0xe8d0('0x5b')](moment(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5c')]),'seconds')||0x0;_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x2a')]+=0x1;if(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x61')]){_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x2b')]+=0x1;_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x2e')]+=moment(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5e')])[_0xe8d0('0x5b')](moment(_0x23ba49[_0x16818f][_0x20a18b][_0xe8d0('0x5a')]),'seconds')||0x0;}}else{_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x2d')]+=_0xbd7ee[_0xe8d0('0x45')][_0x14d722][_0xe8d0('0x2c')]||0x0;}}}}}}return _0xbd7ee[_0xe8d0('0x45')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0xca752a=this;return function(_0x5c8c7d){clearVoiceCallReports(_0xca752a[_0xe8d0('0x18')]);if(_0x5c8c7d){for(var _0x16098b=0x0;_0x16098b<_0x5c8c7d[_0xe8d0('0x3e')];_0x16098b+=0x1){_0xca752a['outbound'][_0xe8d0('0x2a')]+=0x1;_0xca752a['outbound'][_0xe8d0('0x2d')]+=_0x5c8c7d[_0x16098b][_0xe8d0('0x62')];if(_0x5c8c7d[_0x16098b][_0xe8d0('0x63')]===_0xe8d0('0x64')){_0xca752a[_0xe8d0('0x18')]['answered']+=0x1;_0xca752a['outbound'][_0xe8d0('0x2c')]+=_0x5c8c7d[_0x16098b][_0xe8d0('0x62')]-_0x5c8c7d[_0x16098b][_0xe8d0('0x65')]||0x0;_0xca752a[_0xe8d0('0x18')][_0xe8d0('0x2e')]+=_0x5c8c7d[_0x16098b][_0xe8d0('0x65')];}}}return _0xca752a[_0xe8d0('0x18')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x66')]=function(){var _0x590397=this;return function(_0x35e14f){if(_0x35e14f){freeIsNotKey(_0x35e14f,_0x590397[_0xe8d0('0x16')],_0xe8d0('0x29'));for(var _0x2f199b=0x0,_0x4a568f={};_0x2f199b<_0x35e14f['length'];_0x2f199b+=0x1){_0x4a568f=_0x35e14f[_0x2f199b];if(_[_0xe8d0('0x46')](_0x590397[_0xe8d0('0x16')][_0x4a568f[_0xe8d0('0x29')]])){_0x590397[_0xe8d0('0x16')][_0x4a568f[_0xe8d0('0x29')]]=new Campaign(_0x4a568f);}else{_0x590397[_0xe8d0('0x3d')](_0x590397[_0xe8d0('0x16')][_0x4a568f[_0xe8d0('0x29')]],_0x4a568f);_0x590397[_0xe8d0('0x16')][_0x4a568f[_0xe8d0('0x29')]]['dialQueueProject']=_0x4a568f[_0xe8d0('0x67')]?_0x4a568f[_0xe8d0('0x67')][_0xe8d0('0x29')]:undefined;}}}return _0x590397[_0xe8d0('0x16')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x68')]=function(){var _0xe674e2=this;return function(_0x1b1bd3){if(_0x1b1bd3){freeIsNotKey(_0x1b1bd3,_0xe674e2[_0xe8d0('0x19')],'id');for(var _0x47bdc2=0x0,_0x52aece={};_0x47bdc2<_0x1b1bd3[_0xe8d0('0x3e')];_0x47bdc2+=0x1){_0x52aece=_0x1b1bd3[_0x47bdc2];if(_[_0xe8d0('0x46')](_0xe674e2['voiceExtensions'][_0x52aece['id']])){_0xe674e2[_0xe8d0('0x19')][_0x52aece['id']]=new VoiceExtension(_0x52aece);}else{_0xe674e2[_0xe8d0('0x3d')](_0xe674e2[_0xe8d0('0x19')][_0x52aece['id']],_0x52aece);}}}return _0xe674e2['voiceExtensions'];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x69')]=function(){var _0x233a5a=this;return function(_0x2746db){clearCampaigns(_0x233a5a['campaigns']);for(var _0x51b0b3=0x0;_0x51b0b3<_0x2746db[_0xe8d0('0x3e')];_0x51b0b3+=0x1){_[_0xe8d0('0x54')](_0x233a5a['campaigns'][_0x2746db[_0x51b0b3]['name']],_0x2746db[_0x51b0b3]);}return _0x233a5a[_0xe8d0('0x16')];};};Realtime[_0xe8d0('0x3c')][_0xe8d0('0x6a')]=function(){var _0x5eaf13=this;return function(_0x1ffd29){if(_0x1ffd29){freeIsNotKey(_0x1ffd29,_0x5eaf13['faxAccounts'],'id');for(var _0x4bd847=0x0,_0x44a4bd={},_0x3fd5d1={};_0x4bd847<_0x1ffd29[_0xe8d0('0x3e')];_0x4bd847+=0x1){_0x44a4bd=_0x1ffd29[_0x4bd847];if(_[_0xe8d0('0x46')](_0x5eaf13[_0xe8d0('0x24')][_0x44a4bd['id']])){_0x5eaf13['faxAccounts'][_0x44a4bd['id']]=new FaxAccount(_0x44a4bd);}else{_0x5eaf13[_0xe8d0('0x3d')](_0x5eaf13[_0xe8d0('0x24')][_0x44a4bd['id']],_0x44a4bd);}}}return _0x5eaf13['faxAccounts'];};};module[_0xe8d0('0x6b')]=Realtime; \ No newline at end of file +var _0x84ab=['../model/vtigerAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','prototype','mergeFromDatabase','initAgents','length','initTelephones','isUndefined','trunks','initVoiceQueues','voiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','initVoiceCallReports','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','exports','bluebird','util','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/sugarcrmAccount','../model/deskAccount'];(function(_0x29bf20,_0x4ac48b){var _0x3efd04=function(_0x1217c8){while(--_0x1217c8){_0x29bf20['push'](_0x29bf20['shift']());}};_0x3efd04(++_0x4ac48b);}(_0x84ab,0x12f));var _0xb84a=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x84ab[_0x671369];return _0x33f2b4;};'use strict';var BPromise=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var _=require(_0xb84a('0x2'));var moment=require(_0xb84a('0x3'));var Agent=require(_0xb84a('0x4'));var Telephone=require('../model/telephone');var Trunk=require(_0xb84a('0x5'));var VoiceQueue=require(_0xb84a('0x6'));var Trigger=require('../model/trigger');var Template=require(_0xb84a('0x7'));var Campaign=require(_0xb84a('0x8'));var VoiceExtension=require(_0xb84a('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xb84a('0xa'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xb84a('0xb'));var VtigerAccount=require(_0xb84a('0xc'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xb84a('0xd'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xb84a('0xe'));var Realtime=function(){this[_0xb84a('0xf')]={};this[_0xb84a('0x10')]={};this['trunks']={};this['voiceQueues']={};this['triggers']={};this[_0xb84a('0x11')]={};this[_0xb84a('0x12')]={};this[_0xb84a('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xb84a('0x14')]={};this[_0xb84a('0x15')]={};this['queueChannels']={};this[_0xb84a('0x16')]={};this[_0xb84a('0x17')]={};this[_0xb84a('0x18')]={};this[_0xb84a('0x19')]={};this[_0xb84a('0x1a')]={};this[_0xb84a('0x1b')]={};this[_0xb84a('0x1c')]={};this[_0xb84a('0x1d')]={};this[_0xb84a('0x1e')]={};this[_0xb84a('0x1f')]={};this[_0xb84a('0x20')]={};this[_0xb84a('0x21')]={};this['freshsalesAccounts']={};this[_0xb84a('0x22')]={};};function freeIsNotKey(_0x4a691d,_0xb65e5a,_0x3c0b54){var _0x1c7378=_[_0xb84a('0x23')](_0x4a691d,function(_0x3b717e,_0x34d82f){return _0x3b717e[_0x3c0b54];});for(var _0x28fe46 in _0xb65e5a){if(_0xb65e5a[_0xb84a('0x24')](_0x28fe46)){if(!_0x1c7378[_0x28fe46]){delete _0xb65e5a[_0x28fe46];}}}}function freeIsNotKeySip(_0x11d5a0,_0x2de49c){var _0x306d08=_[_0xb84a('0x23')](_0x11d5a0,function(_0x553f79,_0x1a0056){return util[_0xb84a('0x25')]('SIP/%s',_0x553f79[_0xb84a('0x26')]);});for(var _0x61ef03 in _0x2de49c){if(_0x2de49c[_0xb84a('0x24')](_0x61ef03)){if(!_0x306d08[_0x61ef03]){delete _0x2de49c[_0x61ef03];}}}}function freeIsNotKeyAgent(_0x19f637,_0x50bac5){var _0x4ac5f8=_[_0xb84a('0x23')](_0x19f637,function(_0x19097d,_0x2d70fd){var _0x259f74=_[_0xb84a('0x27')](_0x19097d[_0xb84a('0x28')])?util[_0xb84a('0x25')](_0xb84a('0x29'),_0x19097d[_0xb84a('0x26')]):_0x19097d[_0xb84a('0x28')];return _0x259f74;});for(var _0x10d860 in _0x50bac5){if(_0x50bac5[_0xb84a('0x24')](_0x10d860)){if(!_0x4ac5f8[_0x10d860]){delete _0x50bac5[_0x10d860];}}}}function clearVoiceCallReports(_0x218aef){_0x218aef[_0xb84a('0x2a')]=0x0;_0x218aef[_0xb84a('0x2b')]=0x0;_0x218aef[_0xb84a('0x2c')]=0x0;_0x218aef[_0xb84a('0x2d')]=0x0;_0x218aef[_0xb84a('0x2e')]=0x0;}function clearCampaigns(_0x3b6805){if(!_[_0xb84a('0x2f')](_0x3b6805)){for(var _0x33bf1d in _0x3b6805){if(_0x3b6805[_0xb84a('0x24')](_0x33bf1d)){_0x3b6805[_0x33bf1d][_0xb84a('0x30')]=0x0;_0x3b6805[_0x33bf1d][_0xb84a('0x31')]=0x0;}}}}function clearVoiceQueues(_0xefef48){if(!_[_0xb84a('0x2f')](_0xefef48)){for(var _0x5349ea in _0xefef48){if(_0xefef48['hasOwnProperty'](_0x5349ea)){_0xefef48[_0x5349ea][_0xb84a('0x2a')]=0x0;_0xefef48[_0x5349ea][_0xb84a('0x2b')]=0x0;_0xefef48[_0x5349ea]['unmanaged']=0x0;_0xefef48[_0x5349ea][_0xb84a('0x32')]=0x0;_0xefef48[_0x5349ea][_0xb84a('0x2c')]=0x0;_0xefef48[_0x5349ea]['sumDuration']=0x0;_0xefef48[_0x5349ea]['sumBillable']=0x0;_0xefef48[_0x5349ea][_0xb84a('0x33')]=0x0;_0xefef48[_0x5349ea][_0xb84a('0x34')]=0x0;_0xefef48[_0x5349ea]['outboundBusyCallsDay']=0x0;_0xefef48[_0x5349ea][_0xb84a('0x35')]=0x0;_0xefef48[_0x5349ea][_0xb84a('0x36')]=0x0;_0xefef48[_0x5349ea][_0xb84a('0x37')]=0x0;_0xefef48[_0x5349ea][_0xb84a('0x38')]=0x0;_0xefef48[_0x5349ea][_0xb84a('0x39')]=0x0;_0xefef48[_0x5349ea][_0xb84a('0x3a')]=0x0;_0xefef48[_0x5349ea][_0xb84a('0x3b')]=0x0;_0xefef48[_0x5349ea][_0xb84a('0x3c')]=0x0;_0xefef48[_0x5349ea]['outboundReCallsDay']=0x0;_0xefef48[_0x5349ea][_0xb84a('0x33')]=0x0;_0xefef48[_0x5349ea]['outboundAnswerCallsDay']=0x0;_0xefef48[_0x5349ea]['queueStatusComplete']=!![];}}}}Realtime[_0xb84a('0x3d')][_0xb84a('0x3e')]=function(_0x47a5b6,_0x560203){for(var _0x218481 in _0x560203){if(_0x47a5b6[_0xb84a('0x24')](_0x218481)){_0x47a5b6[_0x218481]=_0x560203[_0x218481];}}};Realtime[_0xb84a('0x3d')][_0xb84a('0x3f')]=function(){var _0x3735fb=this;return function(_0x1d7ef1){if(_0x1d7ef1){freeIsNotKeyAgent(_0x1d7ef1,_0x3735fb[_0xb84a('0xf')]);for(var _0x1023aa=0x0,_0x4b59c7={},_0x252c6b={};_0x1023aa<_0x1d7ef1[_0xb84a('0x40')];_0x1023aa+=0x1){_0x4b59c7=_0x1d7ef1[_0x1023aa];var _0x10b944=_[_0xb84a('0x27')](_0x4b59c7[_0xb84a('0x28')])?util[_0xb84a('0x25')](_0xb84a('0x29'),_0x4b59c7['name']):_0x4b59c7[_0xb84a('0x28')];if(_['isUndefined'](_0x3735fb[_0xb84a('0xf')][_0x10b944])){_0x3735fb[_0xb84a('0xf')][_0x10b944]=new Agent(_0x4b59c7);}else{_0x3735fb[_0xb84a('0x3e')](_0x3735fb['agents'][_0x10b944],_0x4b59c7);}}}return _0x3735fb['agents'];};};Realtime[_0xb84a('0x3d')][_0xb84a('0x41')]=function(){var _0x4a3737=this;return function(_0x2d3e08){if(_0x2d3e08){freeIsNotKeySip(_0x2d3e08,_0x4a3737[_0xb84a('0x10')]);for(var _0x4cb5d4=0x0,_0x19aa4c={},_0x2d7216={};_0x4cb5d4<_0x2d3e08['length'];_0x4cb5d4+=0x1){_0x19aa4c=_0x2d3e08[_0x4cb5d4];if(_[_0xb84a('0x42')](_0x4a3737[_0xb84a('0x10')][util[_0xb84a('0x25')](_0xb84a('0x29'),_0x19aa4c['name'])])){_0x4a3737['telephones'][util['format'](_0xb84a('0x29'),_0x19aa4c[_0xb84a('0x26')])]=new Telephone(_0x19aa4c);}else{_0x4a3737[_0xb84a('0x3e')](_0x4a3737[_0xb84a('0x10')][util['format'](_0xb84a('0x29'),_0x19aa4c['name'])],_0x19aa4c);}}}return _0x4a3737[_0xb84a('0x10')];};};Realtime['prototype']['initTrunks']=function(){var _0x59d7a1=this;return function(_0x3f1b28){if(_0x3f1b28){freeIsNotKeySip(_0x3f1b28,_0x59d7a1[_0xb84a('0x43')]);for(var _0xa06d2f=0x0,_0x21e1d7={},_0x5e547e={};_0xa06d2f<_0x3f1b28[_0xb84a('0x40')];_0xa06d2f+=0x1){_0x21e1d7=_0x3f1b28[_0xa06d2f];if(_[_0xb84a('0x42')](_0x59d7a1[_0xb84a('0x43')][util[_0xb84a('0x25')]('SIP/%s',_0x21e1d7['name'])])){_0x59d7a1[_0xb84a('0x43')][util[_0xb84a('0x25')]('SIP/%s',_0x21e1d7[_0xb84a('0x26')])]=new Trunk(_0x21e1d7);}else{_0x59d7a1[_0xb84a('0x3e')](_0x59d7a1[_0xb84a('0x43')][util[_0xb84a('0x25')](_0xb84a('0x29'),_0x21e1d7[_0xb84a('0x26')])],_0x21e1d7);}}}return _0x59d7a1[_0xb84a('0x43')];};};Realtime[_0xb84a('0x3d')][_0xb84a('0x44')]=function(){var _0xcd1e3b=this;return function(_0x1dae1c){if(_0x1dae1c){freeIsNotKey(_0x1dae1c,_0xcd1e3b[_0xb84a('0x45')],_0xb84a('0x26'));for(var _0x33df6a=0x0,_0x2c7f60={},_0x4ad7d0={};_0x33df6a<_0x1dae1c[_0xb84a('0x40')];_0x33df6a+=0x1){_0x2c7f60=_0x1dae1c[_0x33df6a];if(_[_0xb84a('0x42')](_0xcd1e3b[_0xb84a('0x45')][_0x2c7f60[_0xb84a('0x26')]])){_0xcd1e3b[_0xb84a('0x45')][_0x2c7f60[_0xb84a('0x26')]]=new VoiceQueue(_0x2c7f60);}else{_0xcd1e3b['mergeFromDatabase'](_0xcd1e3b[_0xb84a('0x45')][_0x2c7f60['name']],_0x2c7f60);}}}return _0xcd1e3b[_0xb84a('0x45')];};};Realtime[_0xb84a('0x3d')][_0xb84a('0x46')]=function(){var _0x4a14fb=this;return function(_0x5e7327){if(_0x5e7327){freeIsNotKey(_0x5e7327,_0x4a14fb[_0xb84a('0x47')],'id');for(var _0x1f5b38=0x0,_0x189177={},_0x5f2172={};_0x1f5b38<_0x5e7327['length'];_0x1f5b38+=0x1){_0x189177=_0x5e7327[_0x1f5b38];if(_[_0xb84a('0x42')](_0x4a14fb[_0xb84a('0x47')][_0x189177['id']])){_0x4a14fb[_0xb84a('0x47')][_0x189177['id']]=new Trigger(_0x189177);}else{_0x4a14fb['mergeFromDatabase'](_0x4a14fb['triggers'][_0x189177['id']],_0x189177);}}}return _0x4a14fb['triggers'];};};Realtime[_0xb84a('0x3d')][_0xb84a('0x48')]=function(){var _0x38f329=this;return function(_0x4476bc){if(_0x4476bc){freeIsNotKey(_0x4476bc,_0x38f329[_0xb84a('0x12')],'id');for(var _0x584591=0x0,_0x4b40fe={},_0x5b853a={};_0x584591<_0x4476bc['length'];_0x584591+=0x1){_0x4b40fe=_0x4476bc[_0x584591];if(_[_0xb84a('0x42')](_0x38f329[_0xb84a('0x12')][_0x4b40fe['id']])){_0x38f329['templates'][_0x4b40fe['id']]=new Template(_0x4b40fe);}else{_0x38f329[_0xb84a('0x3e')](_0x38f329[_0xb84a('0x12')][_0x4b40fe['id']],_0x4b40fe);}}}return _0x38f329[_0xb84a('0x12')];};};Realtime[_0xb84a('0x3d')][_0xb84a('0x49')]=function(){var _0x432287=this;return function(_0x5a07d2){if(_0x5a07d2){freeIsNotKey(_0x5a07d2,_0x432287['zendeskAccounts'],'id');for(var _0x27cbe0=0x0,_0x50172a={},_0x1e4efc={};_0x27cbe0<_0x5a07d2['length'];_0x27cbe0+=0x1){_0x50172a=_0x5a07d2[_0x27cbe0];if(_['isUndefined'](_0x432287['zendeskAccounts'][_0x50172a['id']])){_0x432287[_0xb84a('0x19')][_0x50172a['id']]=new ZendeskAccount(_0x50172a);}else{_0x432287[_0xb84a('0x3e')](_0x432287[_0xb84a('0x19')][_0x50172a['id']],_0x50172a);}}}return _0x432287[_0xb84a('0x19')];};};Realtime[_0xb84a('0x3d')][_0xb84a('0x4a')]=function(){var _0x37ca26=this;return function(_0x29ff35){if(_0x29ff35){freeIsNotKey(_0x29ff35,_0x37ca26['salesforceAccounts'],'id');for(var _0x5afdd0=0x0,_0x4c5bdf={},_0x36d79e={};_0x5afdd0<_0x29ff35[_0xb84a('0x40')];_0x5afdd0+=0x1){_0x4c5bdf=_0x29ff35[_0x5afdd0];if(_['isUndefined'](_0x37ca26[_0xb84a('0x1a')][_0x4c5bdf['id']])){_0x37ca26['salesforceAccounts'][_0x4c5bdf['id']]=new SalesforceAccount(_0x4c5bdf);}else{_0x37ca26['mergeFromDatabase'](_0x37ca26['salesforceAccounts'][_0x4c5bdf['id']],_0x4c5bdf);}}}return _0x37ca26[_0xb84a('0x1a')];};};Realtime[_0xb84a('0x3d')][_0xb84a('0x4b')]=function(){var _0x51c415=this;return function(_0x5f757e){if(_0x5f757e){freeIsNotKey(_0x5f757e,_0x51c415[_0xb84a('0x1c')],'id');for(var _0x136d61=0x0,_0x505994={},_0x1adf13={};_0x136d61<_0x5f757e['length'];_0x136d61+=0x1){_0x505994=_0x5f757e[_0x136d61];if(_['isUndefined'](_0x51c415[_0xb84a('0x1c')][_0x505994['id']])){_0x51c415['freshdeskAccounts'][_0x505994['id']]=new FreshdeskAccount(_0x505994);}else{_0x51c415[_0xb84a('0x3e')](_0x51c415['freshdeskAccounts'][_0x505994['id']],_0x505994);}}}return _0x51c415[_0xb84a('0x1c')];};};Realtime[_0xb84a('0x3d')][_0xb84a('0x4c')]=function(){var _0x2dbd8c=this;return function(_0x53db6f){if(_0x53db6f){freeIsNotKey(_0x53db6f,_0x2dbd8c['zohoAccounts'],'id');for(var _0x4fc998=0x0,_0x40b392={},_0x2bebb6={};_0x4fc998<_0x53db6f['length'];_0x4fc998+=0x1){_0x40b392=_0x53db6f[_0x4fc998];if(_['isUndefined'](_0x2dbd8c[_0xb84a('0x1d')][_0x40b392['id']])){_0x2dbd8c[_0xb84a('0x1d')][_0x40b392['id']]=new ZohoAccount(_0x40b392);}else{_0x2dbd8c[_0xb84a('0x3e')](_0x2dbd8c['zohoAccounts'][_0x40b392['id']],_0x40b392);}}}return _0x2dbd8c[_0xb84a('0x1d')];};};Realtime[_0xb84a('0x3d')]['initDeskAccounts']=function(){var _0x318b95=this;return function(_0x4188d4){if(_0x4188d4){freeIsNotKey(_0x4188d4,_0x318b95[_0xb84a('0x1e')],'id');for(var _0x39e564=0x0,_0x3bbc69={},_0x46cc6a={};_0x39e564<_0x4188d4[_0xb84a('0x40')];_0x39e564+=0x1){_0x3bbc69=_0x4188d4[_0x39e564];if(_['isUndefined'](_0x318b95[_0xb84a('0x1e')][_0x3bbc69['id']])){_0x318b95[_0xb84a('0x1e')][_0x3bbc69['id']]=new DeskAccount(_0x3bbc69);}else{_0x318b95['mergeFromDatabase'](_0x318b95[_0xb84a('0x1e')][_0x3bbc69['id']],_0x3bbc69);}}}return _0x318b95[_0xb84a('0x1e')];};};Realtime[_0xb84a('0x3d')][_0xb84a('0x4d')]=function(){var _0x347998=this;return function(_0x2cb727){if(_0x2cb727){freeIsNotKey(_0x2cb727,_0x347998[_0xb84a('0x1b')],'id');for(var _0x1b6b82=0x0,_0x842e98={},_0x5dd660={};_0x1b6b82<_0x2cb727[_0xb84a('0x40')];_0x1b6b82+=0x1){_0x842e98=_0x2cb727[_0x1b6b82];if(_['isUndefined'](_0x347998['sugarcrmAccounts'][_0x842e98['id']])){_0x347998[_0xb84a('0x1b')][_0x842e98['id']]=new SugarcrmAccount(_0x842e98);}else{_0x347998['mergeFromDatabase'](_0x347998[_0xb84a('0x1b')][_0x842e98['id']],_0x842e98);}}}return _0x347998['sugarcrmAccounts'];};};Realtime[_0xb84a('0x3d')][_0xb84a('0x4e')]=function(){var _0x4c7d56=this;return function(_0x1262e9){if(_0x1262e9){freeIsNotKey(_0x1262e9,_0x4c7d56[_0xb84a('0x1f')],'id');for(var _0x38efe3=0x0,_0x1dd409={},_0x2e39c3={};_0x38efe3<_0x1262e9[_0xb84a('0x40')];_0x38efe3+=0x1){_0x1dd409=_0x1262e9[_0x38efe3];if(_[_0xb84a('0x42')](_0x4c7d56['vtigerAccounts'][_0x1dd409['id']])){_0x4c7d56[_0xb84a('0x1f')][_0x1dd409['id']]=new VtigerAccount(_0x1dd409);}else{_0x4c7d56['mergeFromDatabase'](_0x4c7d56['vtigerAccounts'][_0x1dd409['id']],_0x1dd409);}}}return _0x4c7d56[_0xb84a('0x1f')];};};Realtime[_0xb84a('0x3d')][_0xb84a('0x4f')]=function(){var _0x32a455=this;return function(_0x5612f3){if(_0x5612f3){freeIsNotKey(_0x5612f3,_0x32a455['servicenowAccounts'],'id');for(var _0x43031f=0x0,_0x43bc39={},_0xedd11={};_0x43031f<_0x5612f3[_0xb84a('0x40')];_0x43031f+=0x1){_0x43bc39=_0x5612f3[_0x43031f];if(_['isUndefined'](_0x32a455[_0xb84a('0x20')][_0x43bc39['id']])){_0x32a455['servicenowAccounts'][_0x43bc39['id']]=new ServicenowAccount(_0x43bc39);}else{_0x32a455[_0xb84a('0x3e')](_0x32a455['servicenowAccounts'][_0x43bc39['id']],_0x43bc39);}}}return _0x32a455[_0xb84a('0x20')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x5f2667=this;return function(_0x23fd4c){if(_0x23fd4c){freeIsNotKey(_0x23fd4c,_0x5f2667[_0xb84a('0x21')],'id');for(var _0x18abb6=0x0,_0x1001f8={},_0x5a2c96={};_0x18abb6<_0x23fd4c[_0xb84a('0x40')];_0x18abb6+=0x1){_0x1001f8=_0x23fd4c[_0x18abb6];if(_[_0xb84a('0x42')](_0x5f2667[_0xb84a('0x21')][_0x1001f8['id']])){_0x5f2667[_0xb84a('0x21')][_0x1001f8['id']]=new Dynamics365Account(_0x1001f8);}else{_0x5f2667[_0xb84a('0x3e')](_0x5f2667[_0xb84a('0x21')][_0x1001f8['id']],_0x1001f8);}}}return _0x5f2667[_0xb84a('0x21')];};};Realtime['prototype'][_0xb84a('0x50')]=function(){var _0xb083ec=this;return function(_0xf01a8e){if(_0xf01a8e){freeIsNotKey(_0xf01a8e,_0xb083ec[_0xb84a('0x51')],'id');for(var _0x16e244=0x0,_0x276488={},_0x479a75={};_0x16e244<_0xf01a8e[_0xb84a('0x40')];_0x16e244+=0x1){_0x276488=_0xf01a8e[_0x16e244];if(_[_0xb84a('0x42')](_0xb083ec[_0xb84a('0x51')][_0x276488['id']])){_0xb083ec[_0xb84a('0x51')][_0x276488['id']]=new FreshsalesAccount(_0x276488);}else{_0xb083ec[_0xb84a('0x3e')](_0xb083ec['freshsalesAccounts'][_0x276488['id']],_0x276488);}}}return _0xb083ec[_0xb84a('0x51')];};};Realtime['prototype'][_0xb84a('0x52')]=function(){var _0x593c7c=this;return function(_0x381169){for(var _0x2d18cf=0x0;_0x2d18cf<_0x381169[_0xb84a('0x40')];_0x2d18cf+=0x1){_['merge'](_0x593c7c[_0xb84a('0x45')][_0x381169[_0x2d18cf][_0xb84a('0x26')]],_0x381169[_0x2d18cf]);}return _0x593c7c[_0xb84a('0x45')];};};Realtime[_0xb84a('0x3d')][_0xb84a('0x53')]=function(){var _0x486c48=this;return function(_0x37bfe4){clearVoiceQueues(_0x486c48[_0xb84a('0x45')]);if(_0x37bfe4){_0x37bfe4=_[_0xb84a('0x54')](_0x37bfe4,'uniqueid');for(var _0x2a8ccd in _0x37bfe4){if(_0x37bfe4['hasOwnProperty'](_0x2a8ccd)){var _0x494b71={};for(var _0x286793=0x0;_0x286793<_0x37bfe4[_0x2a8ccd][_0xb84a('0x40')];_0x286793+=0x1){var _0x13c7b7=_0x37bfe4[_0x2a8ccd][_0x286793][_0xb84a('0x55')];if(_0x486c48[_0xb84a('0x45')][_0x13c7b7]){if(_0x37bfe4[_0x2a8ccd][_0x286793][_0xb84a('0x56')]){_0x486c48[_0xb84a('0x45')][_0x13c7b7][_0xb84a('0x57')]+=0x1;}if(_0x37bfe4[_0x2a8ccd][_0x286793][_0xb84a('0x58')]){_0x486c48[_0xb84a('0x45')][_0x13c7b7][_0xb84a('0x32')]+=0x1;}_0x486c48[_0xb84a('0x45')][_0x13c7b7][_0xb84a('0x2c')]+=moment(_0x37bfe4[_0x2a8ccd][_0x286793][_0xb84a('0x59')])[_0xb84a('0x5a')](moment(_0x37bfe4[_0x2a8ccd][_0x286793][_0xb84a('0x5b')]),_0xb84a('0x5c'))||0x0;if(_0x286793===_0x37bfe4[_0x2a8ccd][_0xb84a('0x40')]-0x1){_0x486c48['voiceQueues'][_0x13c7b7][_0xb84a('0x2d')]+=moment(_0x37bfe4[_0x2a8ccd][_0x286793][_0xb84a('0x5d')]||_0x37bfe4[_0x2a8ccd][_0x286793]['queuecallerabandonAt']||_0x37bfe4[_0x2a8ccd][_0x286793][_0xb84a('0x5e')])['diff'](moment(_0x37bfe4[_0x2a8ccd][_0x286793][_0xb84a('0x5b')]),'seconds')||0x0;_0x486c48[_0xb84a('0x45')][_0x13c7b7]['total']+=0x1;if(_0x37bfe4[_0x2a8ccd][_0x286793]['queuecallercomplete']){_0x486c48[_0xb84a('0x45')][_0x13c7b7][_0xb84a('0x2b')]+=0x1;_0x486c48['voiceQueues'][_0x13c7b7][_0xb84a('0x2e')]+=moment(_0x37bfe4[_0x2a8ccd][_0x286793][_0xb84a('0x5d')])[_0xb84a('0x5a')](moment(_0x37bfe4[_0x2a8ccd][_0x286793][_0xb84a('0x59')]),_0xb84a('0x5c'))||0x0;}}else{_0x486c48['voiceQueues'][_0x13c7b7][_0xb84a('0x2d')]+=_0x486c48[_0xb84a('0x45')][_0x13c7b7][_0xb84a('0x2c')]||0x0;}}}}}}return _0x486c48[_0xb84a('0x45')];};};Realtime['prototype'][_0xb84a('0x5f')]=function(){var _0x55cb95=this;return function(_0x14118c){clearVoiceCallReports(_0x55cb95[_0xb84a('0x13')]);if(_0x14118c){for(var _0x54ae3e=0x0;_0x54ae3e<_0x14118c[_0xb84a('0x40')];_0x54ae3e+=0x1){_0x55cb95[_0xb84a('0x13')][_0xb84a('0x2a')]+=0x1;_0x55cb95['outbound']['sumDuration']+=_0x14118c[_0x54ae3e][_0xb84a('0x60')];if(_0x14118c[_0x54ae3e][_0xb84a('0x61')]==='ANSWERED'){_0x55cb95[_0xb84a('0x13')]['answered']+=0x1;_0x55cb95[_0xb84a('0x13')]['sumHoldTime']+=_0x14118c[_0x54ae3e]['duration']-_0x14118c[_0x54ae3e][_0xb84a('0x62')]||0x0;_0x55cb95[_0xb84a('0x13')][_0xb84a('0x2e')]+=_0x14118c[_0x54ae3e][_0xb84a('0x62')];}}}return _0x55cb95[_0xb84a('0x13')];};};Realtime['prototype']['initCampaigns']=function(){var _0x242762=this;return function(_0xfb4aab){if(_0xfb4aab){freeIsNotKey(_0xfb4aab,_0x242762['campaigns'],_0xb84a('0x26'));for(var _0x448758=0x0,_0x385a05={};_0x448758<_0xfb4aab[_0xb84a('0x40')];_0x448758+=0x1){_0x385a05=_0xfb4aab[_0x448758];if(_['isUndefined'](_0x242762[_0xb84a('0x11')][_0x385a05['name']])){_0x242762[_0xb84a('0x11')][_0x385a05[_0xb84a('0x26')]]=new Campaign(_0x385a05);}else{_0x242762[_0xb84a('0x3e')](_0x242762[_0xb84a('0x11')][_0x385a05[_0xb84a('0x26')]],_0x385a05);_0x242762[_0xb84a('0x11')][_0x385a05[_0xb84a('0x26')]][_0xb84a('0x63')]=_0x385a05[_0xb84a('0x64')]?_0x385a05[_0xb84a('0x64')][_0xb84a('0x26')]:undefined;}}}return _0x242762[_0xb84a('0x11')];};};Realtime['prototype'][_0xb84a('0x65')]=function(){var _0x19301a=this;return function(_0x15ded2){if(_0x15ded2){freeIsNotKey(_0x15ded2,_0x19301a[_0xb84a('0x14')],'id');for(var _0x2fd41c=0x0,_0x30a74b={};_0x2fd41c<_0x15ded2[_0xb84a('0x40')];_0x2fd41c+=0x1){_0x30a74b=_0x15ded2[_0x2fd41c];if(_['isUndefined'](_0x19301a[_0xb84a('0x14')][_0x30a74b['id']])){_0x19301a[_0xb84a('0x14')][_0x30a74b['id']]=new VoiceExtension(_0x30a74b);}else{_0x19301a[_0xb84a('0x3e')](_0x19301a[_0xb84a('0x14')][_0x30a74b['id']],_0x30a74b);}}}return _0x19301a[_0xb84a('0x14')];};};Realtime[_0xb84a('0x3d')][_0xb84a('0x66')]=function(){var _0x574d57=this;return function(_0x2a7440){clearCampaigns(_0x574d57[_0xb84a('0x11')]);for(var _0x188a30=0x0;_0x188a30<_0x2a7440[_0xb84a('0x40')];_0x188a30+=0x1){_[_0xb84a('0x67')](_0x574d57[_0xb84a('0x11')][_0x2a7440[_0x188a30][_0xb84a('0x26')]],_0x2a7440[_0x188a30]);}return _0x574d57[_0xb84a('0x11')];};};Realtime[_0xb84a('0x3d')]['initFaxAccounts']=function(){var _0x432a01=this;return function(_0x157d19){if(_0x157d19){freeIsNotKey(_0x157d19,_0x432a01[_0xb84a('0x22')],'id');for(var _0x260ecf=0x0,_0x59bff5={},_0x2f5c27={};_0x260ecf<_0x157d19[_0xb84a('0x40')];_0x260ecf+=0x1){_0x59bff5=_0x157d19[_0x260ecf];if(_[_0xb84a('0x42')](_0x432a01[_0xb84a('0x22')][_0x59bff5['id']])){_0x432a01['faxAccounts'][_0x59bff5['id']]=new FaxAccount(_0x59bff5);}else{_0x432a01[_0xb84a('0x3e')](_0x432a01['faxAccounts'][_0x59bff5['id']],_0x59bff5);}}}return _0x432a01['faxAccounts'];};};module[_0xb84a('0x68')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 964d35f..30e13f7 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 _0x94bf=['calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','length','monitorFilename','filename','createdAt','connectedlinename','membername','isArray','startsWith','substring','indexOf','mobile','phone','lastIndexOf','findAgent','voiceDialReport','transfererlinkedid','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','accountcode','name','find','interface','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','isNil','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>'];(function(_0x51f9dc,_0x213ba2){var _0x33d952=function(_0x42de2b){while(--_0x42de2b){_0x51f9dc['push'](_0x51f9dc['shift']());}};_0x33d952(++_0x213ba2);}(_0x94bf,0x1ca));var _0xf94b=function(_0x130729,_0x398fa3){_0x130729=_0x130729-0x0;var _0x181ec1=_0x94bf[_0x130729];return _0x181ec1;};'use strict';var _=require(_0xf94b('0x0'));var moment=require(_0xf94b('0x1'));var util=require('util');var config=require(_0xf94b('0x2'));var ami=require(_0xf94b('0x3'));var RpcVoiceAgentReport=require(_0xf94b('0x4'));var RpcVoiceCallReport=require(_0xf94b('0x5'));var RpcVoiceDialReport=require(_0xf94b('0x6'));var RpcMemberReport=require(_0xf94b('0x7'));var RpcVoiceQueueReport=require(_0xf94b('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xf94b('0x9'));var VoiceQueueReport=require(_0xf94b('0xa'));var VoiceCallReport=require(_0xf94b('0xb'));var VoiceAgentReport=require(_0xf94b('0xc'));var VoiceDialReport=require(_0xf94b('0xd'));var UserReport=require('./userReport');function Report(_0x579e23){this[_0xf94b('0xe')]=_0x579e23;this[_0xf94b('0xf')]=_0x579e23[_0xf94b('0xf')];this['telephones']=_0x579e23[_0xf94b('0x10')];}Report[_0xf94b('0x11')]['sync']=function(_0x33383f){var _0x55f9c8=new VoiceQueueReport(this['realtime']);var _0x5967c8=new VoiceAgentReport(this[_0xf94b('0xe')]);var _0x56e9bc=new VoiceDialReport(this['realtime']);var _0x2c4b9b=new VoiceCallReport(this['realtime']);var _0x3eb2bf=new UserReport(this['realtime']);if(config[_0xf94b('0x12')]&&config[_0xf94b('0x12')]['disabled']){ami['on'](_0xf94b('0x13'),this[_0xf94b('0x14')][_0xf94b('0x15')](this));ami['on'](_0xf94b('0x16'),this[_0xf94b('0x17')]['bind'](this));ami['on'](_0xf94b('0x18'),this[_0xf94b('0x19')][_0xf94b('0x15')](this));ami['on'](_0xf94b('0x1a'),this['voiceDialReport'][_0xf94b('0x15')](this));ami['on']('blindtransfer',this[_0xf94b('0x1b')]['bind'](this));ami['on'](_0xf94b('0x1c'),this[_0xf94b('0x1d')][_0xf94b('0x15')](this));}};Report[_0xf94b('0x11')]['findAgent']=function(_0x3807ac){var _0x4176e5;_0x4176e5=_['find'](this[_0xf94b('0xf')],function(_0x438b86){return _0x438b86[_0xf94b('0x1e')]==_0x3807ac||_0x438b86[_0xf94b('0x1f')]==_0x3807ac;});if(_['isNil'](_0x4176e5)){var _0x4cb003=_[_0xf94b('0x20')](this[_0xf94b('0x10')],function(_0x18aca9){return _0x18aca9[_0xf94b('0x1e')]==_0x3807ac||_0x18aca9['name']==_0x3807ac;});if(_0x4cb003){_0x4176e5=_[_0xf94b('0x20')](this['agents'],function(_0x32ff81){return _0x32ff81[_0xf94b('0x21')]==util[_0xf94b('0x22')](_0xf94b('0x23'),_0x4cb003['name']);});}}return _0x4176e5;};Report[_0xf94b('0x11')][_0xf94b('0x14')]=function(_0x50e87b){for(var _0x3aff30=0x0;_0x3aff30<_0x50e87b['length'];_0x3aff30+=0x1){var _0x44a9a7=this['findAgent'](_0x50e87b[_0x3aff30][_0xf94b('0x24')]);if(_0x44a9a7){_0x50e87b[_0x3aff30][_0xf94b('0x1e')]=_0x44a9a7[_0xf94b('0x1e')];_0x50e87b[_0x3aff30][_0xf94b('0x25')]=!![];_0x50e87b[_0x3aff30][_0xf94b('0x26')]=_0x44a9a7[_0xf94b('0x1f')];_0x50e87b[_0x3aff30][_0xf94b('0x21')]=_[_0xf94b('0x27')](_0x44a9a7['interface'])?util['format']('SIP/%s',_0x44a9a7[_0xf94b('0x1f')]):_0x44a9a7[_0xf94b('0x21')];if(_0x50e87b[_0x3aff30]['queuecallercomplete']){_0x50e87b[_0x3aff30][_0xf94b('0x28')]=moment()[_0xf94b('0x22')](_0xf94b('0x29'));}if(_0x50e87b[_0x3aff30][_0xf94b('0x2a')]){_0x50e87b[_0x3aff30][_0xf94b('0x2b')]=moment()[_0xf94b('0x22')](_0xf94b('0x29'));}RpcMemberReport[_0xf94b('0x14')](_0x50e87b[_0x3aff30]);}RpcVoiceQueueReport[_0xf94b('0x2c')](_0x50e87b[_0x3aff30]);}};function extractCalleridNumber(_0x30ae53){var _0x12ec62=_0x30ae53[_0xf94b('0x2d')](/<(.*?)>/);return _0x12ec62?_0x12ec62[0x1]:_0x30ae53;}Report[_0xf94b('0x11')][_0xf94b('0x17')]=function(_0x1fbd8e){_0x1fbd8e['destination']=_0x1fbd8e[_0xf94b('0x2e')]||_0x1fbd8e[_0xf94b('0x2f')];if(_0x1fbd8e[_0xf94b('0x30')]==_0xf94b('0x31')){_0x1fbd8e[_0xf94b('0x32')]=_0xf94b('0x33');_0x1fbd8e['lastdata']=_0x1fbd8e[_0xf94b('0x33')];if(_0x1fbd8e[_0xf94b('0x34')]==_0xf94b('0x35')){_0x1fbd8e['accountcode']='';_0x1fbd8e[_0xf94b('0x2e')]=extractCalleridNumber(_0x1fbd8e[_0xf94b('0x36')]);}else if(_0x1fbd8e['context']=='from-sip'){if(_0x1fbd8e['destination']==_0xf94b('0x37')){_0x1fbd8e['destination']=extractCalleridNumber(_0x1fbd8e[_0xf94b('0x38')]);_0x1fbd8e['calleridnum']=_0x1fbd8e[_0xf94b('0x39')];_0x1fbd8e[_0xf94b('0x3a')]=[_0x1fbd8e['channel'],_0x1fbd8e[_0xf94b('0x3b')]=_0x1fbd8e[_0xf94b('0x3a')]][0x0];_0x1fbd8e[_0xf94b('0x36')]=_0x1fbd8e[_0xf94b('0x38')];}else{_0x1fbd8e[_0xf94b('0x2e')]=_0x1fbd8e[_0xf94b('0x3c')];_0x1fbd8e[_0xf94b('0x3c')]=_0x1fbd8e['originatecalleridnum'];if(_0x1fbd8e[_0xf94b('0x3d')]==_0xf94b('0x3e')){_0x1fbd8e[_0xf94b('0x1e')]=_0x1fbd8e['connectedlinenum'];}else{_0x1fbd8e[_0xf94b('0x1e')]='';}}}}else{_0x1fbd8e[_0xf94b('0x36')]=util['format'](_0xf94b('0x3f'),_0x1fbd8e[_0xf94b('0x40')],_0x1fbd8e[_0xf94b('0x3c')]);}if(RpcVoiceTransferReport[_0xf94b('0x41')][_0x1fbd8e[_0xf94b('0x42')]]){var _0x4d05b7=RpcVoiceTransferReport[_0xf94b('0x41')][_0x1fbd8e[_0xf94b('0x42')]];_0x4d05b7[_0xf94b('0x43')]=_0x1fbd8e[_0xf94b('0x44')];RpcVoiceTransferReport[_0xf94b('0x1b')](_0x4d05b7);delete RpcVoiceTransferReport[_0xf94b('0x41')][_0x1fbd8e[_0xf94b('0x42')]];}RpcVoiceCallReport[_0xf94b('0x2c')](_0x1fbd8e);if(_0x1fbd8e[_0xf94b('0x45')]){for(var _0x3d7b97=0x0;_0x3d7b97<_0x1fbd8e[_0xf94b('0x46')][_0xf94b('0x47')];_0x3d7b97+=0x1){_0x1fbd8e[_0xf94b('0x48')]=_0x1fbd8e[_0xf94b('0x46')][_0x3d7b97][_0xf94b('0x49')];_0x1fbd8e[_0xf94b('0x4a')]=_0x1fbd8e[_0xf94b('0x46')][_0x3d7b97][_0xf94b('0x4a')];if(_0x1fbd8e[_0xf94b('0x2f')]==_0xf94b('0x37')){_0x1fbd8e[_0xf94b('0x3c')]=_0x1fbd8e['connectedlinenum'];_0x1fbd8e[_0xf94b('0x40')]=_0x1fbd8e['connectedlinename'];_0x1fbd8e['connectedlinenum']=_0x1fbd8e[_0xf94b('0x1e')];_0x1fbd8e[_0xf94b('0x4b')]=_0x1fbd8e[_0xf94b('0x4c')];_0x1fbd8e[_0xf94b('0x2f')]=_0x1fbd8e[_0xf94b('0x39')];}else if(_0x1fbd8e[_0xf94b('0x2f')]=='xcally-motion-dialer'){_0x1fbd8e[_0xf94b('0x3c')]=_0x1fbd8e[_0xf94b('0x2e')];_0x1fbd8e[_0xf94b('0x2f')]=_0x1fbd8e[_0xf94b('0x39')];}RpcVoiceRecording[_0xf94b('0x2c')](_0x1fbd8e);}}};Report['prototype'][_0xf94b('0x19')]=function(_0x37a06d){if(_[_0xf94b('0x4d')](_0x37a06d)){_0x37a06d['forEach'](function(_0x5de067){RpcVoiceAgentReport[_0xf94b('0x2c')](_0x5de067);});}else{RpcVoiceAgentReport[_0xf94b('0x2c')](_0x37a06d);}};Report[_0xf94b('0x11')]['voiceDialReport']=function(_0x37a389){RpcVoiceDialReport[_0xf94b('0x2c')](_0x37a389);var _0x225e2c;var _0x2758b4;var _0x12afb4=_0x37a389[_0xf94b('0x3b')];if(_[_0xf94b('0x4e')](_0x12afb4,'Local')){_0x2758b4=_0x12afb4[_0xf94b('0x4f')](_0x12afb4['indexOf']('/')+0x1,_0x12afb4[_0xf94b('0x50')]('@'));_0x225e2c=_[_0xf94b('0x20')](this[_0xf94b('0xf')],function(_0x536357){return _0x536357[_0xf94b('0x51')]==_0x2758b4||_0x536357[_0xf94b('0x52')]==_0x2758b4||_0x536357[_0xf94b('0x1e')]==_0x2758b4;});}else{_0x2758b4=_0x12afb4[_0xf94b('0x4f')](_0x12afb4[_0xf94b('0x50')]('/')+0x1,_0x12afb4[_0xf94b('0x53')]('-'));_0x225e2c=this[_0xf94b('0x54')](_0x2758b4);}if(_0x225e2c){_0x37a389['interface']=_[_0xf94b('0x27')](_0x225e2c['interface'])?util['format'](_0xf94b('0x23'),_0x225e2c[_0xf94b('0x1f')]):_0x225e2c['interface'];_0x37a389[_0xf94b('0x4c')]=_0x225e2c[_0xf94b('0x1f')];_0x37a389['accountcode']=_0x225e2c[_0xf94b('0x1e')];RpcMemberReport[_0xf94b('0x55')](_0x37a389);}};Report[_0xf94b('0x11')][_0xf94b('0x1b')]=function(_0xe29fcc){RpcVoiceTransferReport[_0xf94b('0x41')][_0xe29fcc[_0xf94b('0x56')]]=_0xe29fcc;};Report[_0xf94b('0x11')][_0xf94b('0x1d')]=function(_0x16ff0d){RpcVoiceTransferReport[_0xf94b('0x1d')](_0x16ff0d);};module['exports']=Report; \ No newline at end of file +var _0x00bc=['prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','name','isNil','find','accountcode','interface','format','SIP/%s','length','findAgent','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','voiceCallReport','destination','exten','type','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','membername','forEach','startsWith','Local','substring','indexOf','attendedTransfer','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones'];(function(_0x3e2720,_0xb31a07){var _0x327e52=function(_0x74f2c3){while(--_0x74f2c3){_0x3e2720['push'](_0x3e2720['shift']());}};_0x327e52(++_0xb31a07);}(_0x00bc,0x1a3));var _0xc00b=function(_0x514131,_0x3decfa){_0x514131=_0x514131-0x0;var _0x4395cc=_0x00bc[_0x514131];return _0x4395cc;};'use strict';var _=require(_0xc00b('0x0'));var moment=require('moment');var util=require(_0xc00b('0x1'));var config=require(_0xc00b('0x2'));var ami=require(_0xc00b('0x3'));var RpcVoiceAgentReport=require(_0xc00b('0x4'));var RpcVoiceCallReport=require(_0xc00b('0x5'));var RpcVoiceDialReport=require(_0xc00b('0x6'));var RpcMemberReport=require(_0xc00b('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xc00b('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xc00b('0x9'));var VoiceCallReport=require(_0xc00b('0xa'));var VoiceAgentReport=require(_0xc00b('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xc00b('0xc'));function Report(_0x537b3f){this[_0xc00b('0xd')]=_0x537b3f;this[_0xc00b('0xe')]=_0x537b3f[_0xc00b('0xe')];this[_0xc00b('0xf')]=_0x537b3f[_0xc00b('0xf')];}Report[_0xc00b('0x10')][_0xc00b('0x11')]=function(_0xe11976){var _0x57440e=new VoiceQueueReport(this['realtime']);var _0x4c8ea6=new VoiceAgentReport(this['realtime']);var _0x26dfae=new VoiceDialReport(this['realtime']);var _0x5ddbbc=new VoiceCallReport(this[_0xc00b('0xd')]);var _0x5209d9=new UserReport(this[_0xc00b('0xd')]);if(config[_0xc00b('0x12')]&&config[_0xc00b('0x12')][_0xc00b('0x13')]){ami['on'](_0xc00b('0x14'),this[_0xc00b('0x15')]['bind'](this));ami['on'](_0xc00b('0x16'),this['voiceCallReport']['bind'](this));ami['on'](_0xc00b('0x17'),this[_0xc00b('0x18')][_0xc00b('0x19')](this));ami['on'](_0xc00b('0x1a'),this[_0xc00b('0x1b')][_0xc00b('0x19')](this));ami['on'](_0xc00b('0x1c'),this[_0xc00b('0x1d')][_0xc00b('0x19')](this));ami['on'](_0xc00b('0x1e'),this['attendedTransfer'][_0xc00b('0x19')](this));}};Report[_0xc00b('0x10')]['findAgent']=function(_0x410e94){var _0xe98d9f;_0xe98d9f=_['find'](this['agents'],function(_0xd8b59){return _0xd8b59['accountcode']==_0x410e94||_0xd8b59[_0xc00b('0x1f')]==_0x410e94;});if(_[_0xc00b('0x20')](_0xe98d9f)){var _0x168b0f=_[_0xc00b('0x21')](this[_0xc00b('0xf')],function(_0x533550){return _0x533550[_0xc00b('0x22')]==_0x410e94||_0x533550[_0xc00b('0x1f')]==_0x410e94;});if(_0x168b0f){_0xe98d9f=_[_0xc00b('0x21')](this[_0xc00b('0xe')],function(_0x6c8f25){return _0x6c8f25[_0xc00b('0x23')]==util[_0xc00b('0x24')](_0xc00b('0x25'),_0x168b0f['name']);});}}return _0xe98d9f;};Report[_0xc00b('0x10')][_0xc00b('0x15')]=function(_0xb7dd8d){for(var _0x5a9308=0x0;_0x5a9308<_0xb7dd8d[_0xc00b('0x26')];_0x5a9308+=0x1){var _0xd6eadf=this[_0xc00b('0x27')](_0xb7dd8d[_0x5a9308]['connectedlinenum']);if(_0xd6eadf){_0xb7dd8d[_0x5a9308][_0xc00b('0x22')]=_0xd6eadf[_0xc00b('0x22')];_0xb7dd8d[_0x5a9308][_0xc00b('0x28')]=!![];_0xb7dd8d[_0x5a9308][_0xc00b('0x29')]=_0xd6eadf[_0xc00b('0x1f')];_0xb7dd8d[_0x5a9308][_0xc00b('0x23')]=_[_0xc00b('0x20')](_0xd6eadf[_0xc00b('0x23')])?util[_0xc00b('0x24')]('SIP/%s',_0xd6eadf[_0xc00b('0x1f')]):_0xd6eadf[_0xc00b('0x23')];if(_0xb7dd8d[_0x5a9308][_0xc00b('0x2a')]){_0xb7dd8d[_0x5a9308][_0xc00b('0x2b')]=moment()[_0xc00b('0x24')](_0xc00b('0x2c'));}if(_0xb7dd8d[_0x5a9308][_0xc00b('0x2d')]){_0xb7dd8d[_0x5a9308][_0xc00b('0x2e')]=moment()[_0xc00b('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xc00b('0x15')](_0xb7dd8d[_0x5a9308]);}RpcVoiceQueueReport[_0xc00b('0x2f')](_0xb7dd8d[_0x5a9308]);}};function extractCalleridNumber(_0x5a47c7){var _0x5b5705=_0x5a47c7['match'](/<(.*?)>/);return _0x5b5705?_0x5b5705[0x1]:_0x5a47c7;}Report[_0xc00b('0x10')][_0xc00b('0x30')]=function(_0x4892d6){_0x4892d6[_0xc00b('0x31')]=_0x4892d6['destination']||_0x4892d6[_0xc00b('0x32')];if(_0x4892d6[_0xc00b('0x33')]=='dialer'){_0x4892d6['lastapplication']=_0xc00b('0x34');_0x4892d6[_0xc00b('0x35')]=_0x4892d6['queue'];if(_0x4892d6[_0xc00b('0x36')]==_0xc00b('0x37')){_0x4892d6[_0xc00b('0x22')]='';_0x4892d6[_0xc00b('0x31')]=extractCalleridNumber(_0x4892d6['callerid']);}else if(_0x4892d6['context']==_0xc00b('0x38')){if(_0x4892d6[_0xc00b('0x31')]==_0xc00b('0x39')){_0x4892d6[_0xc00b('0x31')]=extractCalleridNumber(_0x4892d6[_0xc00b('0x3a')]);_0x4892d6[_0xc00b('0x3b')]=_0x4892d6[_0xc00b('0x3c')];_0x4892d6[_0xc00b('0x3d')]=[_0x4892d6[_0xc00b('0x3e')],_0x4892d6[_0xc00b('0x3e')]=_0x4892d6[_0xc00b('0x3d')]][0x0];_0x4892d6[_0xc00b('0x3f')]=_0x4892d6[_0xc00b('0x3a')];}else{_0x4892d6['destination']=_0x4892d6[_0xc00b('0x3b')];_0x4892d6[_0xc00b('0x3b')]=_0x4892d6['originatecalleridnum'];if(_0x4892d6[_0xc00b('0x40')]==_0xc00b('0x41')){_0x4892d6[_0xc00b('0x22')]=_0x4892d6[_0xc00b('0x42')];}else{_0x4892d6[_0xc00b('0x22')]='';}}}}else{_0x4892d6[_0xc00b('0x3f')]=util['format'](_0xc00b('0x43'),_0x4892d6[_0xc00b('0x44')],_0x4892d6[_0xc00b('0x3b')]);}if(RpcVoiceTransferReport[_0xc00b('0x45')][_0x4892d6[_0xc00b('0x46')]]){var _0x2a8c7f=RpcVoiceTransferReport['transfers'][_0x4892d6[_0xc00b('0x46')]];_0x2a8c7f[_0xc00b('0x47')]=_0x4892d6[_0xc00b('0x48')];RpcVoiceTransferReport[_0xc00b('0x1d')](_0x2a8c7f);delete RpcVoiceTransferReport[_0xc00b('0x45')][_0x4892d6[_0xc00b('0x46')]];}RpcVoiceCallReport[_0xc00b('0x2f')](_0x4892d6);if(_0x4892d6[_0xc00b('0x49')]){for(var _0x122073=0x0;_0x122073<_0x4892d6['monitors']['length'];_0x122073+=0x1){_0x4892d6[_0xc00b('0x4a')]=_0x4892d6[_0xc00b('0x4b')][_0x122073][_0xc00b('0x4c')];_0x4892d6[_0xc00b('0x4d')]=_0x4892d6[_0xc00b('0x4b')][_0x122073][_0xc00b('0x4d')];if(_0x4892d6[_0xc00b('0x32')]==_0xc00b('0x39')){_0x4892d6[_0xc00b('0x3b')]=_0x4892d6[_0xc00b('0x42')];_0x4892d6[_0xc00b('0x44')]=_0x4892d6[_0xc00b('0x4e')];_0x4892d6[_0xc00b('0x42')]=_0x4892d6['accountcode'];_0x4892d6[_0xc00b('0x4e')]=_0x4892d6[_0xc00b('0x4f')];_0x4892d6[_0xc00b('0x32')]=_0x4892d6[_0xc00b('0x3c')];}else if(_0x4892d6['exten']=='xcally-motion-dialer'){_0x4892d6[_0xc00b('0x3b')]=_0x4892d6[_0xc00b('0x31')];_0x4892d6[_0xc00b('0x32')]=_0x4892d6[_0xc00b('0x3c')];}RpcVoiceRecording[_0xc00b('0x2f')](_0x4892d6);}}};Report[_0xc00b('0x10')][_0xc00b('0x18')]=function(_0x2e47ad){if(_['isArray'](_0x2e47ad)){_0x2e47ad[_0xc00b('0x50')](function(_0x55bfca){RpcVoiceAgentReport[_0xc00b('0x2f')](_0x55bfca);});}else{RpcVoiceAgentReport[_0xc00b('0x2f')](_0x2e47ad);}};Report['prototype']['voiceDialReport']=function(_0x4bb342){RpcVoiceDialReport[_0xc00b('0x2f')](_0x4bb342);var _0x45101c;var _0xb91c39;var _0x1f753d=_0x4bb342[_0xc00b('0x3e')];if(_[_0xc00b('0x51')](_0x1f753d,_0xc00b('0x52'))){_0xb91c39=_0x1f753d[_0xc00b('0x53')](_0x1f753d[_0xc00b('0x54')]('/')+0x1,_0x1f753d[_0xc00b('0x54')]('@'));_0x45101c=_[_0xc00b('0x21')](this[_0xc00b('0xe')],function(_0x5f0c7d){return _0x5f0c7d['mobile']==_0xb91c39||_0x5f0c7d['phone']==_0xb91c39||_0x5f0c7d['accountcode']==_0xb91c39;});}else{_0xb91c39=_0x1f753d[_0xc00b('0x53')](_0x1f753d[_0xc00b('0x54')]('/')+0x1,_0x1f753d['lastIndexOf']('-'));_0x45101c=this[_0xc00b('0x27')](_0xb91c39);}if(_0x45101c){_0x4bb342[_0xc00b('0x23')]=_['isNil'](_0x45101c[_0xc00b('0x23')])?util[_0xc00b('0x24')](_0xc00b('0x25'),_0x45101c['name']):_0x45101c[_0xc00b('0x23')];_0x4bb342[_0xc00b('0x4f')]=_0x45101c[_0xc00b('0x1f')];_0x4bb342[_0xc00b('0x22')]=_0x45101c[_0xc00b('0x22')];RpcMemberReport[_0xc00b('0x1b')](_0x4bb342);}};Report['prototype'][_0xc00b('0x1d')]=function(_0x1b2191){RpcVoiceTransferReport['transfers'][_0x1b2191['transfererlinkedid']]=_0x1b2191;};Report[_0xc00b('0x10')][_0xc00b('0x55')]=function(_0x407800){RpcVoiceTransferReport[_0xc00b('0x55')](_0x407800);};module[_0xc00b('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 0cd777b..6e5cbb4 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c40=['username','state','debug','[userReport][registry]','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','syncDeviceState','[userReport][devicestatechange]','device','agents','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','startsWith','indexOf','mobile','phone','accountcode','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','telephones','registryentry','syncRegistry','bind','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','info'];(function(_0x1ca42f,_0x5d33c3){var _0x9faca1=function(_0x1ee0ac){while(--_0x1ee0ac){_0x1ca42f['push'](_0x1ca42f['shift']());}};_0x9faca1(++_0x5d33c3);}(_0x7c40,0x1ed));var _0x07c4=function(_0x98ac65,_0x138848){_0x98ac65=_0x98ac65-0x0;var _0x4c8ee0=_0x7c40[_0x98ac65];return _0x4c8ee0;};'use strict';var _=require(_0x07c4('0x0'));var moment=require(_0x07c4('0x1'));var util=require(_0x07c4('0x2'));var Redis=require(_0x07c4('0x3'));var BPromise=require('bluebird');var config=require('../../../config/environment');var logger=require(_0x07c4('0x4'))(_0x07c4('0x5'));var ami=require(_0x07c4('0x6'));config[_0x07c4('0x7')]=_[_0x07c4('0x8')](config['redis'],{'host':_0x07c4('0x9'),'port':0x18eb});var io=require(_0x07c4('0xa'))(new Redis(config[_0x07c4('0x7')]));function UserReport(_0x527e5d){this[_0x07c4('0xb')]=_0x527e5d[_0x07c4('0xb')];this['agents']=_0x527e5d['agents'];this['telephones']=_0x527e5d[_0x07c4('0xc')];ami['on'](_0x07c4('0xd'),this[_0x07c4('0xe')][_0x07c4('0xf')](this));ami['on']('registry',this[_0x07c4('0xe')][_0x07c4('0xf')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0x07c4('0xf')](this));ami['on']('peerstatus',this[_0x07c4('0x10')]['bind'](this));return this[_0x07c4('0x11')]();}function showSipRegistrations(){Promise[_0x07c4('0x12')]()[_0x07c4('0x13')](ami[_0x07c4('0x14')]())[_0x07c4('0x15')](function(_0x17b83c){logger[_0x07c4('0x16')](_0x07c4('0x17'),util[_0x07c4('0x18')](_0x17b83c,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()['then'](ami['actionDeviceStateList']())['catch'](function(_0x24c0b2){logger[_0x07c4('0x16')]('[userReport][devicestatelist]',util['inspect'](_0x24c0b2,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x07c4('0x12')]()[_0x07c4('0x13')](ami[_0x07c4('0x19')]())[_0x07c4('0x15')](function(_0x912c14){logger[_0x07c4('0x16')](_0x07c4('0x1a'),util[_0x07c4('0x18')](_0x912c14,{'showHidden':![],'depth':null}));});}UserReport[_0x07c4('0x1b')][_0x07c4('0x11')]=function(){setInterval(function(){BPromise[_0x07c4('0x12')]()[_0x07c4('0x13')](showSipRegistrations())[_0x07c4('0x13')](listDeviceStates())[_0x07c4('0x13')](showPeersStatus());},0x32c8);};UserReport[_0x07c4('0x1b')]['isNotNull']=function(_0x1546f9){return _0x1546f9!==null&&!_[_0x07c4('0x1c')](_0x1546f9);};UserReport[_0x07c4('0x1b')][_0x07c4('0x1d')]=function(_0x3296bd,_0x1b8779,_0x3eda31){io['to'](_0x3296bd)[_0x07c4('0x1d')](_0x1b8779,_0x3eda31);};UserReport[_0x07c4('0x1b')][_0x07c4('0xe')]=function(_0x5cc4da){try{if(this[_0x07c4('0x1e')](_0x5cc4da)){logger[_0x07c4('0x1f')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x5cc4da[_0x07c4('0x20')],_0x5cc4da[_0x07c4('0x21')]);logger[_0x07c4('0x22')](_0x07c4('0x23'),util[_0x07c4('0x18')](_0x5cc4da,{'showHidden':![],'depth':null}));var _0x58b78e=_['find'](this[_0x07c4('0xb')],{'defaultuser':_0x5cc4da['username']});if(_0x58b78e){_0x5cc4da[_0x07c4('0x24')]=_0x5cc4da[_0x07c4('0x21')];_[_0x07c4('0x25')](_0x58b78e,_[_0x07c4('0x26')](_0x5cc4da,[_0x07c4('0x27'),_0x07c4('0x28'),_0x07c4('0x20'),_0x07c4('0x21')]));logger[_0x07c4('0x22')](_0x07c4('0x29'),util[_0x07c4('0x18')](_0x58b78e,{'showHidden':![],'depth':null}));this[_0x07c4('0x1d')](util[_0x07c4('0x2a')]('trunk:%s',_0x58b78e[_0x07c4('0x2b')]),_0x07c4('0x2c'),_0x58b78e);}}}catch(_0x316da4){logger[_0x07c4('0x16')](_0x07c4('0x23'),util[_0x07c4('0x18')](_0x316da4,{'showHidden':![],'depth':null}));}};UserReport[_0x07c4('0x1b')][_0x07c4('0x2d')]=function(_0x35cc59){try{if(this[_0x07c4('0x1e')](_0x35cc59)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x35cc59['device'],_0x35cc59[_0x07c4('0x21')]);logger[_0x07c4('0x22')](_0x07c4('0x2e'),util[_0x07c4('0x18')](_0x35cc59,{'showHidden':![],'depth':null}));if(this['agents'][_0x35cc59[_0x07c4('0x2f')]]){if(!this[_0x07c4('0x30')][_0x35cc59[_0x07c4('0x2f')]]['local']||_0x35cc59['state'][_0x07c4('0x31')]()==_0x07c4('0x32')){this['agents'][_0x35cc59[_0x07c4('0x2f')]][_0x07c4('0x33')]=![];if(this['agents'][_0x35cc59[_0x07c4('0x2f')]][_0x07c4('0x21')]!==_0x35cc59['state'][_0x07c4('0x31')]()){this[_0x07c4('0x30')][_0x35cc59[_0x07c4('0x2f')]][_0x07c4('0x34')]=_[_0x07c4('0x35')](moment()[_0x07c4('0x2a')]('x'));}this[_0x07c4('0x30')][_0x35cc59[_0x07c4('0x2f')]][_0x07c4('0x21')]=_0x35cc59[_0x07c4('0x21')][_0x07c4('0x31')]();this[_0x07c4('0x30')][_0x35cc59['device']][_0x07c4('0x36')](_0x35cc59);}}else if(this[_0x07c4('0xc')][_0x35cc59[_0x07c4('0x2f')]]){if(this[_0x07c4('0xc')][_0x35cc59[_0x07c4('0x2f')]]['state']!==_0x35cc59[_0x07c4('0x21')][_0x07c4('0x31')]()){this[_0x07c4('0xc')][_0x35cc59[_0x07c4('0x2f')]][_0x07c4('0x34')]=_[_0x07c4('0x35')](moment()[_0x07c4('0x2a')]('x'));}this[_0x07c4('0xc')][_0x35cc59[_0x07c4('0x2f')]][_0x07c4('0x21')]=_0x35cc59[_0x07c4('0x21')][_0x07c4('0x31')]();logger[_0x07c4('0x22')](_0x07c4('0x37'),util[_0x07c4('0x18')](this[_0x07c4('0xc')][_0x35cc59[_0x07c4('0x2f')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x07c4('0x38'),this[_0x07c4('0xc')][_0x35cc59[_0x07c4('0x2f')]]['name']),'telephone:save',this['telephones'][_0x35cc59[_0x07c4('0x2f')]]);}else if(this[_0x07c4('0xb')][_0x35cc59[_0x07c4('0x2f')]]){if(this[_0x07c4('0xb')][_0x35cc59[_0x07c4('0x2f')]][_0x07c4('0x21')]!==_0x35cc59['state'][_0x07c4('0x31')]()){this['trunks'][_0x35cc59['device']][_0x07c4('0x34')]=_[_0x07c4('0x35')](moment()[_0x07c4('0x2a')]('x'));}this[_0x07c4('0xb')][_0x35cc59[_0x07c4('0x2f')]][_0x07c4('0x21')]=_0x35cc59[_0x07c4('0x21')][_0x07c4('0x31')]();logger[_0x07c4('0x22')](_0x07c4('0x39'),util['inspect'](this[_0x07c4('0xb')][_0x35cc59['device']],{'showHidden':![],'depth':null}));this[_0x07c4('0x1d')](util[_0x07c4('0x2a')](_0x07c4('0x3a'),this[_0x07c4('0xb')][_0x35cc59[_0x07c4('0x2f')]][_0x07c4('0x2b')]),_0x07c4('0x2c'),this['trunks'][_0x35cc59[_0x07c4('0x2f')]]);}else if(_[_0x07c4('0x3b')](_0x35cc59[_0x07c4('0x2f')],'Local')){var _0x156752=_0x35cc59[_0x07c4('0x2f')];var _0x599351=_0x156752['substring'](_0x156752[_0x07c4('0x3c')]('/')+0x1,_0x156752[_0x07c4('0x3c')]('@'));var _0x188043=_['find'](this[_0x07c4('0x30')],function(_0x1d9c35){return _0x1d9c35[_0x07c4('0x3d')]==_0x599351||_0x1d9c35[_0x07c4('0x3e')]==_0x599351||_0x1d9c35[_0x07c4('0x3f')]==_0x599351;});if(_0x188043){if(_0x188043['state']!==_0x35cc59[_0x07c4('0x21')][_0x07c4('0x31')]()){_0x188043[_0x07c4('0x34')]=_[_0x07c4('0x35')](moment()[_0x07c4('0x2a')]('x'));}_0x188043[_0x07c4('0x21')]=_0x35cc59[_0x07c4('0x21')][_0x07c4('0x31')]();_0x188043[_0x07c4('0x33')]=!![];_0x188043[_0x07c4('0x36')](_0x35cc59);}}}}catch(_0x59e290){logger[_0x07c4('0x16')](_0x07c4('0x2e'),util[_0x07c4('0x18')](_0x59e290,{'showHidden':![],'depth':null}));}};UserReport[_0x07c4('0x1b')][_0x07c4('0x10')]=function(_0x5a5bce){try{if(this[_0x07c4('0x1e')](_0x5a5bce)&&this[_0x07c4('0x1e')](_0x5a5bce[_0x07c4('0x40')])){logger[_0x07c4('0x1f')](_0x07c4('0x41'),_0x5a5bce['peer'],_0x5a5bce[_0x07c4('0x42')],_0x5a5bce[_0x07c4('0x40')]);logger[_0x07c4('0x22')](_0x07c4('0x43'),util[_0x07c4('0x18')](_0x5a5bce,{'showHidden':![],'depth':null}));if(this['agents'][_0x5a5bce[_0x07c4('0x44')]]){if(!this[_0x07c4('0x30')][_0x5a5bce[_0x07c4('0x44')]][_0x07c4('0x33')]||_0x5a5bce[_0x07c4('0x40')][_0x07c4('0x31')]()==_0x07c4('0x45')){this[_0x07c4('0x30')][_0x5a5bce['peer']][_0x07c4('0x33')]=![];this['agents'][_0x5a5bce[_0x07c4('0x44')]]['status']=_0x5a5bce[_0x07c4('0x40')][_0x07c4('0x31')]();this['agents'][_0x5a5bce[_0x07c4('0x44')]][_0x07c4('0x42')]=_0x5a5bce[_0x07c4('0x42')];this['agents'][_0x5a5bce[_0x07c4('0x44')]][_0x07c4('0x36')](_0x5a5bce);}}else if(this[_0x07c4('0xc')][_0x5a5bce['peer']]){this['telephones'][_0x5a5bce[_0x07c4('0x44')]][_0x07c4('0x46')]=_0x5a5bce['peerstatus'][_0x07c4('0x31')]();this['telephones'][_0x5a5bce[_0x07c4('0x44')]]['address']=_0x5a5bce['address'];logger['debug'](_0x07c4('0x47'),util[_0x07c4('0x18')](this['telephones'][_0x5a5bce['peer']],{'showHidden':![],'depth':null}));this[_0x07c4('0x1d')](util[_0x07c4('0x2a')](_0x07c4('0x38'),this[_0x07c4('0xc')][_0x5a5bce[_0x07c4('0x44')]][_0x07c4('0x2b')]),_0x07c4('0x48'),this['telephones'][_0x5a5bce[_0x07c4('0x44')]]);}else if(this[_0x07c4('0xb')][_0x5a5bce[_0x07c4('0x44')]]){this[_0x07c4('0xb')][_0x5a5bce[_0x07c4('0x44')]][_0x07c4('0x46')]=_0x5a5bce[_0x07c4('0x40')][_0x07c4('0x31')]();this[_0x07c4('0xb')][_0x5a5bce[_0x07c4('0x44')]]['address']=_0x5a5bce[_0x07c4('0x42')];logger[_0x07c4('0x22')](_0x07c4('0x49'),util['inspect'](this['trunks'][_0x5a5bce[_0x07c4('0x44')]],{'showHidden':![],'depth':null}));this[_0x07c4('0x1d')](util[_0x07c4('0x2a')](_0x07c4('0x3a'),this[_0x07c4('0xb')][_0x5a5bce[_0x07c4('0x44')]]['name']),_0x07c4('0x2c'),this['trunks'][_0x5a5bce[_0x07c4('0x44')]]);}}}catch(_0x1faf04){logger[_0x07c4('0x16')]('[userReport][peerstatus]',util['inspect'](_0x1faf04,{'showHidden':![],'depth':null}));}};module[_0x07c4('0x4a')]=UserReport; \ No newline at end of file +var _0xb526=['isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','syncDeviceState','info','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','name','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','substring','indexOf','accountcode','syncPeerStatus','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','[userReport][peerstatus]','peer','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','exports','lodash','moment','bluebird','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','registryentry','bind','registry','syncRegistry','devicestatechange','syncRealtimeShow','resolve','then','catch','error','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype'];(function(_0x2e4282,_0x35e341){var _0x2dc20d=function(_0x476304){while(--_0x476304){_0x2e4282['push'](_0x2e4282['shift']());}};_0x2dc20d(++_0x35e341);}(_0xb526,0x74));var _0x6b52=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0xb526[_0x5ebc04];return _0x17845c;};'use strict';var _=require(_0x6b52('0x0'));var moment=require(_0x6b52('0x1'));var util=require('util');var Redis=require('ioredis');var BPromise=require(_0x6b52('0x2'));var config=require('../../../config/environment');var logger=require(_0x6b52('0x3'))(_0x6b52('0x4'));var ami=require(_0x6b52('0x5'));config[_0x6b52('0x6')]=_[_0x6b52('0x7')](config[_0x6b52('0x6')],{'host':_0x6b52('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0x2a4faf){this[_0x6b52('0x9')]=_0x2a4faf[_0x6b52('0x9')];this[_0x6b52('0xa')]=_0x2a4faf[_0x6b52('0xa')];this[_0x6b52('0xb')]=_0x2a4faf[_0x6b52('0xb')];ami['on'](_0x6b52('0xc'),this['syncRegistry'][_0x6b52('0xd')](this));ami['on'](_0x6b52('0xe'),this[_0x6b52('0xf')][_0x6b52('0xd')](this));ami['on'](_0x6b52('0x10'),this['syncDeviceState'][_0x6b52('0xd')](this));ami['on']('peerstatus',this['syncPeerStatus'][_0x6b52('0xd')](this));return this[_0x6b52('0x11')]();}function showSipRegistrations(){Promise[_0x6b52('0x12')]()[_0x6b52('0x13')](ami['actionSipShowRegistry']())[_0x6b52('0x14')](function(_0x3b3fd1){logger[_0x6b52('0x15')]('[userReport][sipshowregistry]',util[_0x6b52('0x16')](_0x3b3fd1,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x6b52('0x13')](ami[_0x6b52('0x17')]())[_0x6b52('0x14')](function(_0x3dbd8c){logger[_0x6b52('0x15')](_0x6b52('0x18'),util[_0x6b52('0x16')](_0x3dbd8c,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x6b52('0x12')]()['then'](ami[_0x6b52('0x19')]())[_0x6b52('0x14')](function(_0x5b1c2a){logger[_0x6b52('0x15')](_0x6b52('0x1a'),util[_0x6b52('0x16')](_0x5b1c2a,{'showHidden':![],'depth':null}));});}UserReport[_0x6b52('0x1b')][_0x6b52('0x11')]=function(){setInterval(function(){BPromise['resolve']()[_0x6b52('0x13')](showSipRegistrations())['then'](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x6b52('0x1b')][_0x6b52('0x1c')]=function(_0x2abef9){return _0x2abef9!==null&&!_[_0x6b52('0x1d')](_0x2abef9);};UserReport[_0x6b52('0x1b')][_0x6b52('0x1e')]=function(_0x3a79e8,_0x28d891,_0x4a0fe6){io['to'](_0x3a79e8)[_0x6b52('0x1e')](_0x28d891,_0x4a0fe6);};UserReport[_0x6b52('0x1b')][_0x6b52('0xf')]=function(_0x1f6345){try{if(this[_0x6b52('0x1c')](_0x1f6345)){logger['info'](_0x6b52('0x1f'),_0x1f6345[_0x6b52('0x20')],_0x1f6345[_0x6b52('0x21')]);logger[_0x6b52('0x22')](_0x6b52('0x23'),util[_0x6b52('0x16')](_0x1f6345,{'showHidden':![],'depth':null}));var _0x3164ba=_[_0x6b52('0x24')](this[_0x6b52('0x9')],{'defaultuser':_0x1f6345[_0x6b52('0x20')]});if(_0x3164ba){_0x1f6345['stateRegistry']=_0x1f6345['state'];_[_0x6b52('0x25')](_0x3164ba,_[_0x6b52('0x26')](_0x1f6345,[_0x6b52('0x27'),'actionid',_0x6b52('0x20'),_0x6b52('0x21')]));logger[_0x6b52('0x22')](_0x6b52('0x28'),util['inspect'](_0x3164ba,{'showHidden':![],'depth':null}));this[_0x6b52('0x1e')](util[_0x6b52('0x29')](_0x6b52('0x2a'),_0x3164ba['name']),'trunk:save',_0x3164ba);}}}catch(_0x4cced5){logger[_0x6b52('0x15')](_0x6b52('0x23'),util[_0x6b52('0x16')](_0x4cced5,{'showHidden':![],'depth':null}));}};UserReport[_0x6b52('0x1b')][_0x6b52('0x2b')]=function(_0x184efd){try{if(this['isNotNull'](_0x184efd)){logger[_0x6b52('0x2c')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x184efd[_0x6b52('0x2d')],_0x184efd[_0x6b52('0x21')]);logger[_0x6b52('0x22')](_0x6b52('0x2e'),util[_0x6b52('0x16')](_0x184efd,{'showHidden':![],'depth':null}));if(this[_0x6b52('0xa')][_0x184efd['device']]){if(!this['agents'][_0x184efd['device']][_0x6b52('0x2f')]||_0x184efd[_0x6b52('0x21')][_0x6b52('0x30')]()==_0x6b52('0x31')){this[_0x6b52('0xa')][_0x184efd[_0x6b52('0x2d')]][_0x6b52('0x2f')]=![];if(this[_0x6b52('0xa')][_0x184efd['device']][_0x6b52('0x21')]!==_0x184efd[_0x6b52('0x21')][_0x6b52('0x30')]()){this[_0x6b52('0xa')][_0x184efd[_0x6b52('0x2d')]][_0x6b52('0x32')]=_[_0x6b52('0x33')](moment()[_0x6b52('0x29')]('x'));}this[_0x6b52('0xa')][_0x184efd[_0x6b52('0x2d')]][_0x6b52('0x21')]=_0x184efd[_0x6b52('0x21')][_0x6b52('0x30')]();this[_0x6b52('0xa')][_0x184efd[_0x6b52('0x2d')]][_0x6b52('0x34')](_0x184efd);}}else if(this[_0x6b52('0xb')][_0x184efd[_0x6b52('0x2d')]]){if(this[_0x6b52('0xb')][_0x184efd[_0x6b52('0x2d')]][_0x6b52('0x21')]!==_0x184efd[_0x6b52('0x21')][_0x6b52('0x30')]()){this['telephones'][_0x184efd[_0x6b52('0x2d')]][_0x6b52('0x32')]=_[_0x6b52('0x33')](moment()['format']('x'));}this['telephones'][_0x184efd['device']][_0x6b52('0x21')]=_0x184efd['state'][_0x6b52('0x30')]();logger[_0x6b52('0x22')](_0x6b52('0x35'),util[_0x6b52('0x16')](this[_0x6b52('0xb')][_0x184efd[_0x6b52('0x2d')]],{'showHidden':![],'depth':null}));this[_0x6b52('0x1e')](util['format']('telephone:%s',this['telephones'][_0x184efd[_0x6b52('0x2d')]][_0x6b52('0x36')]),_0x6b52('0x37'),this[_0x6b52('0xb')][_0x184efd[_0x6b52('0x2d')]]);}else if(this[_0x6b52('0x9')][_0x184efd['device']]){if(this['trunks'][_0x184efd[_0x6b52('0x2d')]][_0x6b52('0x21')]!==_0x184efd[_0x6b52('0x21')][_0x6b52('0x30')]()){this[_0x6b52('0x9')][_0x184efd['device']]['stateTime']=_[_0x6b52('0x33')](moment()[_0x6b52('0x29')]('x'));}this['trunks'][_0x184efd[_0x6b52('0x2d')]]['state']=_0x184efd[_0x6b52('0x21')]['toLowerCase']();logger[_0x6b52('0x22')](_0x6b52('0x38'),util[_0x6b52('0x16')](this[_0x6b52('0x9')][_0x184efd[_0x6b52('0x2d')]],{'showHidden':![],'depth':null}));this[_0x6b52('0x1e')](util[_0x6b52('0x29')](_0x6b52('0x2a'),this[_0x6b52('0x9')][_0x184efd['device']][_0x6b52('0x36')]),_0x6b52('0x39'),this[_0x6b52('0x9')][_0x184efd[_0x6b52('0x2d')]]);}else if(_[_0x6b52('0x3a')](_0x184efd[_0x6b52('0x2d')],_0x6b52('0x3b'))){var _0x2a33f2=_0x184efd['device'];var _0x5beb96=_0x2a33f2[_0x6b52('0x3c')](_0x2a33f2['indexOf']('/')+0x1,_0x2a33f2[_0x6b52('0x3d')]('@'));var _0xed3f4b=_[_0x6b52('0x24')](this['agents'],function(_0x28b035){return _0x28b035['mobile']==_0x5beb96||_0x28b035['phone']==_0x5beb96||_0x28b035[_0x6b52('0x3e')]==_0x5beb96;});if(_0xed3f4b){if(_0xed3f4b[_0x6b52('0x21')]!==_0x184efd[_0x6b52('0x21')][_0x6b52('0x30')]()){_0xed3f4b[_0x6b52('0x32')]=_[_0x6b52('0x33')](moment()[_0x6b52('0x29')]('x'));}_0xed3f4b[_0x6b52('0x21')]=_0x184efd[_0x6b52('0x21')][_0x6b52('0x30')]();_0xed3f4b[_0x6b52('0x2f')]=!![];_0xed3f4b['updateStatusRealtime'](_0x184efd);}}}}catch(_0x3e2986){logger['error'](_0x6b52('0x2e'),util[_0x6b52('0x16')](_0x3e2986,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x6b52('0x3f')]=function(_0x39debd){try{if(this['isNotNull'](_0x39debd)&&this['isNotNull'](_0x39debd[_0x6b52('0x40')])){logger[_0x6b52('0x2c')](_0x6b52('0x41'),_0x39debd['peer'],_0x39debd['address'],_0x39debd[_0x6b52('0x40')]);logger[_0x6b52('0x22')](_0x6b52('0x42'),util['inspect'](_0x39debd,{'showHidden':![],'depth':null}));if(this[_0x6b52('0xa')][_0x39debd[_0x6b52('0x43')]]){if(!this[_0x6b52('0xa')][_0x39debd['peer']][_0x6b52('0x2f')]||_0x39debd[_0x6b52('0x40')]['toLowerCase']()=='registered'){this[_0x6b52('0xa')][_0x39debd[_0x6b52('0x43')]]['local']=![];this['agents'][_0x39debd['peer']][_0x6b52('0x44')]=_0x39debd['peerstatus'][_0x6b52('0x30')]();this[_0x6b52('0xa')][_0x39debd[_0x6b52('0x43')]][_0x6b52('0x45')]=_0x39debd['address'];this[_0x6b52('0xa')][_0x39debd['peer']][_0x6b52('0x34')](_0x39debd);}}else if(this['telephones'][_0x39debd[_0x6b52('0x43')]]){this[_0x6b52('0xb')][_0x39debd[_0x6b52('0x43')]][_0x6b52('0x44')]=_0x39debd[_0x6b52('0x40')]['toLowerCase']();this[_0x6b52('0xb')][_0x39debd[_0x6b52('0x43')]][_0x6b52('0x45')]=_0x39debd[_0x6b52('0x45')];logger[_0x6b52('0x22')](_0x6b52('0x46'),util[_0x6b52('0x16')](this['telephones'][_0x39debd['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0x6b52('0x29')]('telephone:%s',this['telephones'][_0x39debd[_0x6b52('0x43')]][_0x6b52('0x36')]),'telephone:save',this[_0x6b52('0xb')][_0x39debd[_0x6b52('0x43')]]);}else if(this[_0x6b52('0x9')][_0x39debd[_0x6b52('0x43')]]){this[_0x6b52('0x9')][_0x39debd[_0x6b52('0x43')]][_0x6b52('0x44')]=_0x39debd[_0x6b52('0x40')][_0x6b52('0x30')]();this[_0x6b52('0x9')][_0x39debd[_0x6b52('0x43')]]['address']=_0x39debd['address'];logger[_0x6b52('0x22')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x6b52('0x16')](this[_0x6b52('0x9')][_0x39debd[_0x6b52('0x43')]],{'showHidden':![],'depth':null}));this[_0x6b52('0x1e')](util[_0x6b52('0x29')](_0x6b52('0x2a'),this[_0x6b52('0x9')][_0x39debd[_0x6b52('0x43')]][_0x6b52('0x36')]),_0x6b52('0x39'),this[_0x6b52('0x9')][_0x39debd[_0x6b52('0x43')]]);}}}catch(_0x3e0bea){logger[_0x6b52('0x15')](_0x6b52('0x42'),util[_0x6b52('0x16')](_0x3e0bea,{'showHidden':![],'depth':null}));}};module[_0x6b52('0x47')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 35551d7..153b08b 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8df=['variable','value','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','util','../../../config/environment','ami','../ami','defaults','redis','localhost','socket.io-emitter','voiceQueues','agents','variables','agentcalled','bind','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','agentcomplete','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','reason','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys'];(function(_0x316ad3,_0x24e897){var _0x1d81e0=function(_0x218f04){while(--_0x218f04){_0x316ad3['push'](_0x316ad3['shift']());}};_0x1d81e0(++_0x24e897);}(_0xa8df,0xc7));var _0xfa8d=function(_0x22dfcb,_0x165493){_0x22dfcb=_0x22dfcb-0x0;var _0x58b1d2=_0xa8df[_0x22dfcb];return _0x58b1d2;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xfa8d('0x0'));var Redis=require('ioredis');var config=require(_0xfa8d('0x1'));var logger=require('../../../config/logger')(_0xfa8d('0x2'));var ami=require(_0xfa8d('0x3'));config['redis']=_[_0xfa8d('0x4')](config[_0xfa8d('0x5')],{'host':_0xfa8d('0x6'),'port':0x18eb});var io=require(_0xfa8d('0x7'))(new Redis(config['redis']));function VoiceAgentReport(_0x23a2b1){this['channels']={};this[_0xfa8d('0x8')]=_0x23a2b1[_0xfa8d('0x8')];this[_0xfa8d('0x9')]=_0x23a2b1[_0xfa8d('0x9')];this[_0xfa8d('0xa')]={};ami['on'](_0xfa8d('0xb'),this['syncAgentCalled']['bind'](this));ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0xfa8d('0xc')](this));ami['on'](_0xfa8d('0xd'),this[_0xfa8d('0xe')][_0xfa8d('0xc')](this));ami['on']('agentcomplete',this[_0xfa8d('0xf')][_0xfa8d('0xc')](this));ami['on'](_0xfa8d('0x10'),this[_0xfa8d('0x11')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0xfa8d('0xc')](this));ami['on'](_0xfa8d('0x12'),this[_0xfa8d('0x13')]['bind'](this));ami['on'](_0xfa8d('0x14'),this[_0xfa8d('0x15')][_0xfa8d('0xc')](this));ami['on'](_0xfa8d('0x16'),this[_0xfa8d('0x17')]['bind'](this));ami['on']('blindtransfer',this[_0xfa8d('0x18')][_0xfa8d('0xc')](this));}VoiceAgentReport[_0xfa8d('0x19')][_0xfa8d('0x1a')]=function(_0x546d74,_0x1e3df1,_0x215c7c){io['to'](_0x546d74)[_0xfa8d('0x1a')](_0x1e3df1,_0x215c7c);};VoiceAgentReport['prototype'][_0xfa8d('0x1b')]=function(_0x142ca7){return _0x142ca7!==null&&!_[_0xfa8d('0x1c')](_0x142ca7);};VoiceAgentReport[_0xfa8d('0x19')][_0xfa8d('0x1d')]=function(_0x3854ee){try{if(this[_0xfa8d('0x1b')](_0x3854ee)){logger[_0xfa8d('0x1e')](_0xfa8d('0x1f'),_0x3854ee['uniqueid'],_0x3854ee[_0xfa8d('0x20')],_0x3854ee[_0xfa8d('0x21')]);logger[_0xfa8d('0x22')](_0xfa8d('0x23'),_0x3854ee[_0xfa8d('0x24')],util[_0xfa8d('0x25')](_0x3854ee,{'showHidden':![],'depth':null}));if(_[_0xfa8d('0x1c')](this[_0xfa8d('0x26')][_0x3854ee[_0xfa8d('0x24')]])){this['channels'][_0x3854ee[_0xfa8d('0x24')]]={};}if(_['isUndefined'](this[_0xfa8d('0x26')][_0x3854ee[_0xfa8d('0x24')]][_0x3854ee[_0xfa8d('0x21')]])){this[_0xfa8d('0x26')][_0x3854ee[_0xfa8d('0x24')]][_0x3854ee['destuniqueid']]={'agentcalledAt':moment()[_0xfa8d('0x27')](_0xfa8d('0x28')),'lastevent':_0xfa8d('0x29'),'mandatoryDisposition':this[_0xfa8d('0x8')][_0x3854ee[_0xfa8d('0x2a')]]?this[_0xfa8d('0x8')][_0x3854ee['queue']][_0xfa8d('0x2b')]||![]:![],'type':this[_0xfa8d('0x8')][_0x3854ee[_0xfa8d('0x2a')]]?this['voiceQueues'][_0x3854ee[_0xfa8d('0x2a')]][_0xfa8d('0x2c')]||'inbound':'inbound','variables':this[_0xfa8d('0xa')][_0x3854ee['uniqueid']]};}_['merge'](this[_0xfa8d('0x26')][_0x3854ee[_0xfa8d('0x24')]][_0x3854ee[_0xfa8d('0x21')]],_['omit'](_0x3854ee,['event',_0xfa8d('0x2d')]));logger[_0xfa8d('0x22')](_0xfa8d('0x2e'),_0x3854ee[_0xfa8d('0x24')],util[_0xfa8d('0x25')](this[_0xfa8d('0x26')][_0x3854ee[_0xfa8d('0x24')]][_0x3854ee['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xfa8d('0x2f'),this[_0xfa8d('0x26')][_0x3854ee[_0xfa8d('0x24')]][_0x3854ee[_0xfa8d('0x21')]]);logger['debug'](_0xfa8d('0x30'),_0x3854ee[_0xfa8d('0x24')],util[_0xfa8d('0x25')](this[_0xfa8d('0x26')][_0x3854ee[_0xfa8d('0x24')]][_0x3854ee[_0xfa8d('0x21')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xfa8d('0x27')](_0xfa8d('0x31'),_0x3854ee[_0xfa8d('0x20')]),'user:called',this['channels'][_0x3854ee[_0xfa8d('0x24')]][_0x3854ee[_0xfa8d('0x21')]]);}}catch(_0x17f539){logger['error']('[%s][voiceAgentReport][agentcalled]',_0x3854ee[_0xfa8d('0x24')],util[_0xfa8d('0x25')](_0x17f539,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfa8d('0x19')][_0xfa8d('0x32')]=function(_0x65fbe5){try{if(this[_0xfa8d('0x1b')](_0x65fbe5)){if(this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]]){logger[_0xfa8d('0x22')](_0xfa8d('0x33'),_0x65fbe5[_0xfa8d('0x24')],util[_0xfa8d('0x25')](_0x65fbe5,{'showHidden':![],'depth':null}));for(var _0x6b6232 in this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]]){if(this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0xfa8d('0x34')](_0x6b6232)){if(_0x65fbe5[_0xfa8d('0x21')]===_0x6b6232){logger[_0xfa8d('0x1e')](_0xfa8d('0x35'),_0x65fbe5[_0xfa8d('0x24')],_0x65fbe5[_0xfa8d('0x20')],_0x65fbe5[_0xfa8d('0x21')]);this['channels'][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232][_0xfa8d('0x36')]=moment()[_0xfa8d('0x27')](_0xfa8d('0x28'));this['channels'][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232][_0xfa8d('0x37')]=_0x65fbe5[_0xfa8d('0x37')];this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232]['connectedlinenum']=_0x65fbe5['connectedlinenum'];this['channels'][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232][_0xfa8d('0x38')]=_0x65fbe5[_0xfa8d('0x38')];this[_0xfa8d('0x26')][_0x65fbe5['uniqueid']][_0x6b6232][_0xfa8d('0x39')]=_0x65fbe5[_0xfa8d('0x39')];this['channels'][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232][_0xfa8d('0x3a')]=_0x65fbe5[_0xfa8d('0x3a')];this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232][_0xfa8d('0x3b')]=_0xfa8d('0x3c');_['merge'](this[_0xfa8d('0x9')][_0x65fbe5[_0xfa8d('0x3d')]],_[_0xfa8d('0x3e')](_0x65fbe5,[_0xfa8d('0x2a'),_0xfa8d('0x3f')]));logger[_0xfa8d('0x22')](_0xfa8d('0x40'),_0x65fbe5[_0xfa8d('0x24')],util[_0xfa8d('0x25')](this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0x65fbe5['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xfa8d('0x41'),this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0x65fbe5[_0xfa8d('0x21')]]);logger['debug'](_0xfa8d('0x42'),_0x65fbe5[_0xfa8d('0x24')],util[_0xfa8d('0x25')](this['channels'][_0x65fbe5[_0xfa8d('0x24')]][_0x65fbe5[_0xfa8d('0x21')]],{'showHidden':![],'depth':null}));this[_0xfa8d('0x1a')](util[_0xfa8d('0x27')](_0xfa8d('0x31'),_0x65fbe5[_0xfa8d('0x20')]),_0xfa8d('0x43'),this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0x65fbe5['destuniqueid']]);}else if(!this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232][_0xfa8d('0x44')]&&!this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232][_0xfa8d('0x45')]){logger[_0xfa8d('0x1e')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x65fbe5[_0xfa8d('0x24')],this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232][_0xfa8d('0x20')],_0x6b6232);this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232]['agentringnoanswer']=!![];this['channels'][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232][_0xfa8d('0x46')]=moment()[_0xfa8d('0x27')](_0xfa8d('0x28'));this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232][_0xfa8d('0x47')]=_0x65fbe5[_0xfa8d('0x21')];this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232]['answeredelsewheremembername']=_0x65fbe5[_0xfa8d('0x20')];this['channels'][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232][_0xfa8d('0x3b')]=_0xfa8d('0x48');this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232][_0xfa8d('0x49')]='answered_elsewhere';logger[_0xfa8d('0x22')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x65fbe5[_0xfa8d('0x24')],util[_0xfa8d('0x25')](this[_0xfa8d('0x26')][_0x65fbe5['uniqueid']][_0x6b6232],{'showHidden':![],'depth':null}));ami[_0xfa8d('0x1a')](_0xfa8d('0x4a'),this[_0xfa8d('0x26')][_0x65fbe5[_0xfa8d('0x24')]][_0x6b6232]);}}}}}}catch(_0x22e4c6){logger[_0xfa8d('0x4b')](_0xfa8d('0x4c'),_0x65fbe5[_0xfa8d('0x24')],util[_0xfa8d('0x25')](_0x22e4c6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfa8d('0x19')][_0xfa8d('0x4d')]=function(_0x45adff){try{if(this[_0xfa8d('0x1b')](_0x45adff)){logger[_0xfa8d('0x22')](_0xfa8d('0x4e'),_0x45adff['uniqueid'],util[_0xfa8d('0x25')](_0x45adff,{'showHidden':![],'depth':null}));if(this[_0xfa8d('0x26')][_0x45adff['uniqueid']]&&this[_0xfa8d('0x26')][_0x45adff[_0xfa8d('0x24')]][_0x45adff[_0xfa8d('0x21')]]){logger['info'](_0xfa8d('0x4f'),_0x45adff[_0xfa8d('0x24')],_0x45adff[_0xfa8d('0x20')],_0x45adff[_0xfa8d('0x21')]);this[_0xfa8d('0x26')][_0x45adff[_0xfa8d('0x24')]][_0x45adff[_0xfa8d('0x21')]]['agentringnoanswer']=!![];this['channels'][_0x45adff['uniqueid']][_0x45adff[_0xfa8d('0x21')]]['agentringnoanswerAt']=moment()[_0xfa8d('0x27')](_0xfa8d('0x28'));this['channels'][_0x45adff[_0xfa8d('0x24')]][_0x45adff[_0xfa8d('0x21')]][_0xfa8d('0x3b')]=_0xfa8d('0x50');this[_0xfa8d('0x26')][_0x45adff[_0xfa8d('0x24')]][_0x45adff[_0xfa8d('0x21')]]['reason']=_0xfa8d('0x50');logger['debug'](_0xfa8d('0x51'),_0x45adff['uniqueid'],util[_0xfa8d('0x25')](this['channels'][_0x45adff['uniqueid']][_0x45adff[_0xfa8d('0x21')]],{'showHidden':![],'depth':null}));ami['emit'](_0xfa8d('0x52'),this[_0xfa8d('0x26')][_0x45adff['uniqueid']][_0x45adff[_0xfa8d('0x21')]]);}}}catch(_0x331359){logger[_0xfa8d('0x4b')](_0xfa8d('0x53'),_0x45adff[_0xfa8d('0x24')],util[_0xfa8d('0x25')](_0x331359,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfa8d('0x19')][_0xfa8d('0xe')]=function(_0x359d46){try{if(this[_0xfa8d('0x1b')](_0x359d46)){logger[_0xfa8d('0x22')](_0xfa8d('0x54'),_0x359d46[_0xfa8d('0x24')],util[_0xfa8d('0x25')](_0x359d46,{'showHidden':![],'depth':null}));if(this['channels'][_0x359d46[_0xfa8d('0x24')]]){for(var _0x32b7f7 in this['channels'][_0x359d46[_0xfa8d('0x24')]]){if(this[_0xfa8d('0x26')][_0x359d46[_0xfa8d('0x24')]][_0xfa8d('0x34')](_0x32b7f7)&&!this[_0xfa8d('0x26')][_0x359d46[_0xfa8d('0x24')]][_0x32b7f7][_0xfa8d('0x44')]&&!this['channels'][_0x359d46['uniqueid']][_0x32b7f7][_0xfa8d('0x45')]){logger['info'](_0xfa8d('0x55'),_0x359d46[_0xfa8d('0x24')],this[_0xfa8d('0x26')][_0x359d46[_0xfa8d('0x24')]][_0x32b7f7][_0xfa8d('0x20')],_0x32b7f7);this[_0xfa8d('0x26')][_0x359d46[_0xfa8d('0x24')]][_0x32b7f7][_0xfa8d('0x44')]=!![];this[_0xfa8d('0x26')][_0x359d46[_0xfa8d('0x24')]][_0x32b7f7][_0xfa8d('0x46')]=moment()[_0xfa8d('0x27')](_0xfa8d('0x28'));this[_0xfa8d('0x26')][_0x359d46['uniqueid']][_0x32b7f7][_0xfa8d('0x3b')]='abandoned';this[_0xfa8d('0x26')][_0x359d46['uniqueid']][_0x32b7f7][_0xfa8d('0x49')]=_0xfa8d('0x56');logger[_0xfa8d('0x22')](_0xfa8d('0x57'),_0x359d46[_0xfa8d('0x24')],util[_0xfa8d('0x25')](this[_0xfa8d('0x26')][_0x359d46['uniqueid']][_0x32b7f7],{'showHidden':![],'depth':null}));ami[_0xfa8d('0x1a')](_0xfa8d('0x58'),this[_0xfa8d('0x26')][_0x359d46['uniqueid']][_0x32b7f7]);}}}}}catch(_0x2026b6){logger[_0xfa8d('0x4b')](_0xfa8d('0x59'),_0x359d46['uniqueid'],util[_0xfa8d('0x25')](_0x2026b6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfa8d('0x19')][_0xfa8d('0xf')]=function(_0x436ca8){try{if(this[_0xfa8d('0x1b')](_0x436ca8)){logger[_0xfa8d('0x22')](_0xfa8d('0x5a'),_0x436ca8['uniqueid'],util[_0xfa8d('0x25')](_0x436ca8,{'showHidden':![],'depth':null}));if(this[_0xfa8d('0x26')][_0x436ca8['uniqueid']]){for(var _0x1dfda2 in this[_0xfa8d('0x26')][_0x436ca8[_0xfa8d('0x24')]]){if(this[_0xfa8d('0x26')][_0x436ca8['uniqueid']][_0xfa8d('0x34')](_0x1dfda2)){if(this[_0xfa8d('0x26')][_0x436ca8[_0xfa8d('0x24')]][_0x1dfda2][_0xfa8d('0x36')]&&!this[_0xfa8d('0x26')][_0x436ca8[_0xfa8d('0x24')]][_0x1dfda2]['agentcomplete']){logger['info'](_0xfa8d('0x5b'),_0x436ca8['uniqueid'],this['channels'][_0x436ca8[_0xfa8d('0x24')]][_0x1dfda2]['membername'],_0x1dfda2);this[_0xfa8d('0x26')][_0x436ca8['uniqueid']][_0x1dfda2][_0xfa8d('0x45')]=!![];this[_0xfa8d('0x26')][_0x436ca8[_0xfa8d('0x24')]][_0x1dfda2][_0xfa8d('0x5c')]=moment()[_0xfa8d('0x27')](_0xfa8d('0x28'));this['channels'][_0x436ca8[_0xfa8d('0x24')]][_0x1dfda2][_0xfa8d('0x3b')]=_0xfa8d('0x5d');this[_0xfa8d('0x26')][_0x436ca8[_0xfa8d('0x24')]][_0x1dfda2][_0xfa8d('0x49')]=_0x436ca8['reason']==_0xfa8d('0x5e')?_0xfa8d('0x5f'):_0x436ca8[_0xfa8d('0x49')];this['channels'][_0x436ca8[_0xfa8d('0x24')]][_0x1dfda2]['talktime']=_0x436ca8[_0xfa8d('0x60')];if(this[_0xfa8d('0x8')][_0x436ca8['queue']]&&this['voiceQueues'][_0x436ca8['queue']][_0xfa8d('0x61')]){this[_0xfa8d('0x26')][_0x436ca8[_0xfa8d('0x24')]][_0x1dfda2][_0xfa8d('0x62')]=this[_0xfa8d('0x8')][_0x436ca8['queue']]['acwTimeout'];this[_0xfa8d('0x26')][_0x436ca8[_0xfa8d('0x24')]][_0x1dfda2][_0xfa8d('0x63')]=!![];}this[_0xfa8d('0x9')][_0x436ca8[_0xfa8d('0x3d')]]=_[_0xfa8d('0x64')](this[_0xfa8d('0x9')][_0x436ca8[_0xfa8d('0x3d')]],['queue',_0xfa8d('0x3f')]);logger[_0xfa8d('0x22')](_0xfa8d('0x65'),_0x436ca8[_0xfa8d('0x24')],util['inspect'](this[_0xfa8d('0x26')][_0x436ca8[_0xfa8d('0x24')]][_0x1dfda2],{'showHidden':![],'depth':null}));ami[_0xfa8d('0x1a')](_0xfa8d('0x66'),this[_0xfa8d('0x26')][_0x436ca8[_0xfa8d('0x24')]][_0x1dfda2]);logger['debug'](_0xfa8d('0x67'),_0x436ca8[_0xfa8d('0x24')],util[_0xfa8d('0x25')](this[_0xfa8d('0x26')][_0x436ca8[_0xfa8d('0x24')]][_0x1dfda2],{'showHidden':![],'depth':null}));this[_0xfa8d('0x1a')](util['format']('user:%s',_0x436ca8[_0xfa8d('0x20')]),_0xfa8d('0x68'),this['channels'][_0x436ca8['uniqueid']][_0x1dfda2]);}}}}}}catch(_0x26102e){logger[_0xfa8d('0x4b')](_0xfa8d('0x69'),_0x436ca8['uniqueid'],util[_0xfa8d('0x25')](_0x26102e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfa8d('0x11')]=function(_0x3e68aa){try{if(this[_0xfa8d('0x1b')](_0x3e68aa)){logger[_0xfa8d('0x22')](_0xfa8d('0x6a'),_0x3e68aa[_0xfa8d('0x24')],util[_0xfa8d('0x25')](_0x3e68aa,{'showHidden':![],'depth':null}));this[_0xfa8d('0x6b')](_0x3e68aa['uniqueid'],_[_0xfa8d('0x6c')](_0x3e68aa[_0xfa8d('0x6d')])[0x0],_0x3e68aa[_0xfa8d('0x6e')]);if(this[_0xfa8d('0x26')][_0x3e68aa[_0xfa8d('0x24')]]){for(var _0x55983f in this['channels'][_0x3e68aa[_0xfa8d('0x24')]]){if(this[_0xfa8d('0x26')][_0x3e68aa[_0xfa8d('0x24')]]['hasOwnProperty'](_0x55983f)){logger[_0xfa8d('0x1e')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x3e68aa[_0xfa8d('0x24')],_0x55983f,_[_0xfa8d('0x6c')](_0x3e68aa[_0xfa8d('0x6d')])[0x0],_0x3e68aa[_0xfa8d('0x6e')]);if(_['isUndefined'](this[_0xfa8d('0x26')][_0x3e68aa['uniqueid']][_0x55983f][_0xfa8d('0xa')])){this['channels'][_0x3e68aa[_0xfa8d('0x24')]][_0x55983f][_0xfa8d('0xa')]={};}this['channels'][_0x3e68aa[_0xfa8d('0x24')]][_0x55983f][_0xfa8d('0xa')]=this[_0xfa8d('0xa')][_0x3e68aa[_0xfa8d('0x24')]];}}}}}catch(_0x2df70b){logger['error'](_0xfa8d('0x6f'),_0x3e68aa['uniqueid'],util[_0xfa8d('0x25')](_0x2df70b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfa8d('0x19')][_0xfa8d('0x6b')]=function(_0x50ce5a,_0x5acec5,_0x13562a){var _0x3c6c33=['rtpaudioqos',_0xfa8d('0x70'),_0xfa8d('0x71'),_0xfa8d('0x72'),_0xfa8d('0x73'),_0xfa8d('0x74'),_0xfa8d('0x75'),_0xfa8d('0x76'),_0xfa8d('0x77'),_0xfa8d('0x78'),_0xfa8d('0x79'),'bridgepvtcallid',_0xfa8d('0x7a'),_0xfa8d('0x7b'),_0xfa8d('0x7c'),'memberlastcall',_0xfa8d('0x20'),_0xfa8d('0x7d'),_0xfa8d('0x7e')];if(!_[_0xfa8d('0x7f')](_0x5acec5)&&!_[_0xfa8d('0x80')](_0x3c6c33,_0x5acec5)){if(_['isUndefined'](this[_0xfa8d('0xa')][_0x50ce5a])){this[_0xfa8d('0xa')][_0x50ce5a]={};}this['variables'][_0x50ce5a][_0x5acec5]=_0x13562a;}};VoiceAgentReport[_0xfa8d('0x19')]['syncHangup']=function(_0x99dd2f){try{if(this[_0xfa8d('0x1b')](_0x99dd2f)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x99dd2f[_0xfa8d('0x24')],util[_0xfa8d('0x25')](_0x99dd2f,{'showHidden':![],'depth':null}));if(this['channels'][_0x99dd2f[_0xfa8d('0x24')]]){for(var _0x163460 in this['channels'][_0x99dd2f[_0xfa8d('0x24')]]){if(this[_0xfa8d('0x26')][_0x99dd2f[_0xfa8d('0x24')]][_0xfa8d('0x34')](_0x163460)){if(this[_0xfa8d('0x26')][_0x99dd2f[_0xfa8d('0x24')]][_0x163460][_0xfa8d('0x49')]=='transfer'&&this[_0xfa8d('0x26')][_0x99dd2f[_0xfa8d('0x24')]][_0x163460]['agentcomplete']){logger[_0xfa8d('0x1e')](_0xfa8d('0x81'),_0x99dd2f['uniqueid'],_0x163460);this[_0xfa8d('0x26')][_0x99dd2f[_0xfa8d('0x24')]][_0x163460][_0xfa8d('0x5c')]=moment()[_0xfa8d('0x27')](_0xfa8d('0x28'));}}}logger[_0xfa8d('0x22')](_0xfa8d('0x82'),_0x99dd2f[_0xfa8d('0x24')],util[_0xfa8d('0x25')](_[_0xfa8d('0x83')](this[_0xfa8d('0x26')][_0x99dd2f[_0xfa8d('0x24')]]),{'showHidden':![],'depth':null}));ami[_0xfa8d('0x1a')](_0xfa8d('0x84'),_[_0xfa8d('0x83')](this[_0xfa8d('0x26')][_0x99dd2f[_0xfa8d('0x24')]]));delete this[_0xfa8d('0x26')][_0x99dd2f[_0xfa8d('0x24')]];}if(this[_0xfa8d('0xa')][_0x99dd2f[_0xfa8d('0x24')]]){delete this[_0xfa8d('0xa')][_0x99dd2f['uniqueid']];}}}catch(_0x3086ca){logger[_0xfa8d('0x4b')](_0xfa8d('0x85'),_0x99dd2f['uniqueid'],util[_0xfa8d('0x25')](_0x3086ca,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfa8d('0x19')]['syncAttendedTransfer']=function(_0x5c5e6c){try{if(this['isNotNull'](_0x5c5e6c)){logger[_0xfa8d('0x22')](_0xfa8d('0x86'),_0x5c5e6c[_0xfa8d('0x24')],util[_0xfa8d('0x25')](_0x5c5e6c,{'showHidden':![],'depth':null}));if(this[_0xfa8d('0x26')][_0x5c5e6c['transfereeuniqueid']]){for(var _0x4946a0 in this[_0xfa8d('0x26')][_0x5c5e6c['transfereeuniqueid']]){if(this[_0xfa8d('0x26')][_0x5c5e6c[_0xfa8d('0x87')]][_0xfa8d('0x34')](_0x4946a0)){if(_0x5c5e6c[_0xfa8d('0x88')]===_0x4946a0){logger[_0xfa8d('0x1e')](_0xfa8d('0x89'),_0x5c5e6c['uniqueid'],this[_0xfa8d('0x26')][_0x5c5e6c[_0xfa8d('0x87')]][_0x4946a0]['membername'],_0x4946a0);var _0x28d7cb=moment();this[_0xfa8d('0x26')][_0x5c5e6c[_0xfa8d('0x87')]][_0x4946a0][_0xfa8d('0x45')]=!![];this[_0xfa8d('0x26')][_0x5c5e6c[_0xfa8d('0x87')]][_0x4946a0]['agentcompleteAt']=moment()[_0xfa8d('0x27')](_0xfa8d('0x28'));this[_0xfa8d('0x26')][_0x5c5e6c[_0xfa8d('0x87')]][_0x4946a0][_0xfa8d('0x3b')]=_0xfa8d('0x5d');this['channels'][_0x5c5e6c[_0xfa8d('0x87')]][_0x4946a0][_0xfa8d('0x49')]=_0xfa8d('0x5e');this[_0xfa8d('0x26')][_0x5c5e6c['transfereeuniqueid']][_0x4946a0][_0xfa8d('0x60')]=_0x28d7cb[_0xfa8d('0x8a')](this[_0xfa8d('0x26')][_0x5c5e6c[_0xfa8d('0x87')]][_0x4946a0][_0xfa8d('0x36')],'seconds');}}}}if(this[_0xfa8d('0x26')][_0x5c5e6c[_0xfa8d('0x8b')]]){var _0x25ed40=this[_0xfa8d('0x26')][_0x5c5e6c['secondtransfereruniqueid']];this[_0xfa8d('0x26')][_0x5c5e6c[_0xfa8d('0x8b')]]=this[_0xfa8d('0x26')][_0x5c5e6c['transfereeuniqueid']];this[_0xfa8d('0x26')][_0x5c5e6c[_0xfa8d('0x87')]]=_0x25ed40;}}}catch(_0x304355){logger[_0xfa8d('0x4b')](_0xfa8d('0x8c'),_0x5c5e6c[_0xfa8d('0x24')],util[_0xfa8d('0x25')](_0x304355,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfa8d('0x19')][_0xfa8d('0x18')]=function(_0x2cfd40){try{if(this[_0xfa8d('0x1b')](_0x2cfd40)){logger['debug'](_0xfa8d('0x8d'),_0x2cfd40[_0xfa8d('0x24')],util['inspect'](_0x2cfd40,{'showHidden':![],'depth':null}));if(this[_0xfa8d('0x26')][_0x2cfd40[_0xfa8d('0x87')]]){for(var _0x34ddc6 in this['channels'][_0x2cfd40[_0xfa8d('0x87')]]){if(this[_0xfa8d('0x26')][_0x2cfd40[_0xfa8d('0x87')]]['hasOwnProperty'](_0x34ddc6)){if(_0x2cfd40[_0xfa8d('0x8e')]===_0x34ddc6){logger[_0xfa8d('0x1e')](_0xfa8d('0x8f'),_0x2cfd40[_0xfa8d('0x24')],this[_0xfa8d('0x26')][_0x2cfd40[_0xfa8d('0x87')]][_0x34ddc6][_0xfa8d('0x20')],_0x34ddc6);var _0x35e4f4=moment();this['channels'][_0x2cfd40[_0xfa8d('0x87')]][_0x34ddc6]['agentcomplete']=!![];this[_0xfa8d('0x26')][_0x2cfd40['transfereeuniqueid']][_0x34ddc6][_0xfa8d('0x5c')]=_0x35e4f4;this['channels'][_0x2cfd40['transfereeuniqueid']][_0x34ddc6]['lastevent']=_0xfa8d('0x5d');this[_0xfa8d('0x26')][_0x2cfd40[_0xfa8d('0x87')]][_0x34ddc6][_0xfa8d('0x49')]='transfer';this[_0xfa8d('0x26')][_0x2cfd40[_0xfa8d('0x87')]][_0x34ddc6][_0xfa8d('0x60')]=_0x35e4f4[_0xfa8d('0x8a')](this[_0xfa8d('0x26')][_0x2cfd40['transfereeuniqueid']][_0x34ddc6][_0xfa8d('0x36')],_0xfa8d('0x90'));}}}}}}catch(_0x3018a1){logger[_0xfa8d('0x4b')]('[%s][voiceAgentReport][blindtransfer]',_0x2cfd40[_0xfa8d('0x24')],util[_0xfa8d('0x25')](_0x3018a1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfa8d('0x19')][_0xfa8d('0x13')]=function(_0x438426){var _0x1bac08='';try{if(this[_0xfa8d('0x1b')](_0x438426)){logger[_0xfa8d('0x22')](_0xfa8d('0x91'),_0x438426[_0xfa8d('0x24')],util['inspect'](_0x438426,{'showHidden':![],'depth':null}));if(_0x438426[_0xfa8d('0x92')]){_0x1bac08=_0x438426[_0xfa8d('0x92')][_0xfa8d('0x93')](0x0,_0x438426[_0xfa8d('0x92')][_0xfa8d('0x94')]('-'));if(this[_0xfa8d('0x9')][_0x1bac08]){logger[_0xfa8d('0x1e')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x438426['uniqueid'],_0x1bac08);this['agents'][_0x1bac08][_0xfa8d('0x95')]=!![];}}}}catch(_0xfbb89d){logger['error']('[%s][voiceAgentReport][musiconholdstart]',_0x438426[_0xfa8d('0x24')],util[_0xfa8d('0x25')](_0xfbb89d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfa8d('0x15')]=function(_0xadce7d){var _0x2ef5ed='';try{if(this[_0xfa8d('0x1b')](_0xadce7d)){logger['debug'](_0xfa8d('0x96'),_0xadce7d['uniqueid'],util[_0xfa8d('0x25')](_0xadce7d,{'showHidden':![],'depth':null}));if(_0xadce7d[_0xfa8d('0x92')]){_0x2ef5ed=_0xadce7d[_0xfa8d('0x92')][_0xfa8d('0x93')](0x0,_0xadce7d['channel'][_0xfa8d('0x94')]('-'));if(this[_0xfa8d('0x9')][_0x2ef5ed]){logger[_0xfa8d('0x1e')](_0xfa8d('0x97'),_0xadce7d['uniqueid'],_0x2ef5ed);this[_0xfa8d('0x9')][_0x2ef5ed]['onhold']=![];}}}}catch(_0x2d2397){logger[_0xfa8d('0x4b')](_0xfa8d('0x98'),_0xadce7d[_0xfa8d('0x24')],util['inspect'](_0x2d2397,{'showHidden':![],'depth':null}));}};module[_0xfa8d('0x99')]=VoiceAgentReport; \ No newline at end of file +var _0x0f22=['merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','transfer','agent','talktime','acwtime','acwTimeout','agents','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','channels','voiceQueues','variables','agentcalled','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','varset','syncVarSet','hangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','inspect','format','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0f22,0x6a));var _0x20f2=function(_0x492c3b,_0x43c734){_0x492c3b=_0x492c3b-0x0;var _0x266a76=_0x0f22[_0x492c3b];return _0x266a76;};'use strict';var _=require(_0x20f2('0x0'));var moment=require('moment');var util=require(_0x20f2('0x1'));var Redis=require(_0x20f2('0x2'));var config=require(_0x20f2('0x3'));var logger=require(_0x20f2('0x4'))(_0x20f2('0x5'));var ami=require(_0x20f2('0x6'));config[_0x20f2('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x20f2('0x8'))(new Redis(config[_0x20f2('0x7')]));function VoiceAgentReport(_0x111ff7){this[_0x20f2('0x9')]={};this[_0x20f2('0xa')]=_0x111ff7[_0x20f2('0xa')];this['agents']=_0x111ff7['agents'];this[_0x20f2('0xb')]={};ami['on'](_0x20f2('0xc'),this['syncAgentCalled']['bind'](this));ami['on']('agentconnect',this[_0x20f2('0xd')][_0x20f2('0xe')](this));ami['on'](_0x20f2('0xf'),this[_0x20f2('0x10')][_0x20f2('0xe')](this));ami['on'](_0x20f2('0x11'),this[_0x20f2('0x12')][_0x20f2('0xe')](this));ami['on'](_0x20f2('0x13'),this['syncAgentComplete']['bind'](this));ami['on'](_0x20f2('0x14'),this[_0x20f2('0x15')][_0x20f2('0xe')](this));ami['on'](_0x20f2('0x16'),this['syncHangup']['bind'](this));ami['on'](_0x20f2('0x17'),this['syncMusicOnHoldStart'][_0x20f2('0xe')](this));ami['on'](_0x20f2('0x18'),this[_0x20f2('0x19')][_0x20f2('0xe')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x20f2('0x1a'),this[_0x20f2('0x1b')][_0x20f2('0xe')](this));}VoiceAgentReport['prototype'][_0x20f2('0x1c')]=function(_0x53f519,_0x109957,_0x7e3021){io['to'](_0x53f519)[_0x20f2('0x1c')](_0x109957,_0x7e3021);};VoiceAgentReport[_0x20f2('0x1d')][_0x20f2('0x1e')]=function(_0x38a6a3){return _0x38a6a3!==null&&!_[_0x20f2('0x1f')](_0x38a6a3);};VoiceAgentReport['prototype'][_0x20f2('0x20')]=function(_0x4ba92d){try{if(this[_0x20f2('0x1e')](_0x4ba92d)){logger[_0x20f2('0x21')](_0x20f2('0x22'),_0x4ba92d[_0x20f2('0x23')],_0x4ba92d['membername'],_0x4ba92d[_0x20f2('0x24')]);logger[_0x20f2('0x25')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x4ba92d[_0x20f2('0x23')],util[_0x20f2('0x26')](_0x4ba92d,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x20f2('0x9')][_0x4ba92d[_0x20f2('0x23')]])){this[_0x20f2('0x9')][_0x4ba92d['uniqueid']]={};}if(_[_0x20f2('0x1f')](this['channels'][_0x4ba92d['uniqueid']][_0x4ba92d[_0x20f2('0x24')]])){this[_0x20f2('0x9')][_0x4ba92d[_0x20f2('0x23')]][_0x4ba92d[_0x20f2('0x24')]]={'agentcalledAt':moment()[_0x20f2('0x27')](_0x20f2('0x28')),'lastevent':'called','mandatoryDisposition':this['voiceQueues'][_0x4ba92d[_0x20f2('0x29')]]?this[_0x20f2('0xa')][_0x4ba92d[_0x20f2('0x29')]][_0x20f2('0x2a')]||![]:![],'type':this[_0x20f2('0xa')][_0x4ba92d[_0x20f2('0x29')]]?this[_0x20f2('0xa')][_0x4ba92d[_0x20f2('0x29')]][_0x20f2('0x2b')]||_0x20f2('0x2c'):'inbound','variables':this[_0x20f2('0xb')][_0x4ba92d[_0x20f2('0x23')]]};}_[_0x20f2('0x2d')](this[_0x20f2('0x9')][_0x4ba92d['uniqueid']][_0x4ba92d[_0x20f2('0x24')]],_[_0x20f2('0x2e')](_0x4ba92d,[_0x20f2('0x2f'),_0x20f2('0x30')]));logger['debug'](_0x20f2('0x31'),_0x4ba92d[_0x20f2('0x23')],util[_0x20f2('0x26')](this[_0x20f2('0x9')][_0x4ba92d[_0x20f2('0x23')]][_0x4ba92d[_0x20f2('0x24')]],{'showHidden':![],'depth':null}));ami[_0x20f2('0x1c')]('custom:agentcalled',this['channels'][_0x4ba92d[_0x20f2('0x23')]][_0x4ba92d['destuniqueid']]);logger['debug'](_0x20f2('0x32'),_0x4ba92d['uniqueid'],util[_0x20f2('0x26')](this[_0x20f2('0x9')][_0x4ba92d[_0x20f2('0x23')]][_0x4ba92d[_0x20f2('0x24')]],{'showHidden':![],'depth':null}));this[_0x20f2('0x1c')](util[_0x20f2('0x27')](_0x20f2('0x33'),_0x4ba92d[_0x20f2('0x34')]),_0x20f2('0x35'),this['channels'][_0x4ba92d[_0x20f2('0x23')]][_0x4ba92d[_0x20f2('0x24')]]);}}catch(_0x5a14e1){logger[_0x20f2('0x36')](_0x20f2('0x37'),_0x4ba92d['uniqueid'],util[_0x20f2('0x26')](_0x5a14e1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20f2('0x1d')][_0x20f2('0xd')]=function(_0x43582b){try{if(this[_0x20f2('0x1e')](_0x43582b)){if(this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]]){logger[_0x20f2('0x25')](_0x20f2('0x38'),_0x43582b[_0x20f2('0x23')],util[_0x20f2('0x26')](_0x43582b,{'showHidden':![],'depth':null}));for(var _0x226967 in this[_0x20f2('0x9')][_0x43582b['uniqueid']]){if(this['channels'][_0x43582b[_0x20f2('0x23')]][_0x20f2('0x39')](_0x226967)){if(_0x43582b['destuniqueid']===_0x226967){logger[_0x20f2('0x21')](_0x20f2('0x3a'),_0x43582b['uniqueid'],_0x43582b[_0x20f2('0x34')],_0x43582b[_0x20f2('0x24')]);this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x226967][_0x20f2('0x3b')]=moment()[_0x20f2('0x27')](_0x20f2('0x28'));this[_0x20f2('0x9')][_0x43582b['uniqueid']][_0x226967]['connectedlinename']=_0x43582b[_0x20f2('0x3c')];this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x226967][_0x20f2('0x3d')]=_0x43582b[_0x20f2('0x3d')];this['channels'][_0x43582b['uniqueid']][_0x226967][_0x20f2('0x3e')]=_0x43582b[_0x20f2('0x3e')];this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x226967][_0x20f2('0x3f')]=_0x43582b[_0x20f2('0x3f')];this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x226967][_0x20f2('0x40')]=_0x43582b[_0x20f2('0x40')];this[_0x20f2('0x9')][_0x43582b['uniqueid']][_0x226967][_0x20f2('0x41')]=_0x20f2('0x42');_[_0x20f2('0x2d')](this['agents'][_0x43582b[_0x20f2('0x43')]],_['pick'](_0x43582b,[_0x20f2('0x29'),_0x20f2('0x44')]));logger['debug'](_0x20f2('0x45'),_0x43582b[_0x20f2('0x23')],util[_0x20f2('0x26')](this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x43582b[_0x20f2('0x24')]],{'showHidden':![],'depth':null}));ami[_0x20f2('0x1c')](_0x20f2('0x46'),this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x43582b[_0x20f2('0x24')]]);logger[_0x20f2('0x25')](_0x20f2('0x47'),_0x43582b[_0x20f2('0x23')],util[_0x20f2('0x26')](this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x43582b[_0x20f2('0x24')]],{'showHidden':![],'depth':null}));this[_0x20f2('0x1c')](util[_0x20f2('0x27')](_0x20f2('0x33'),_0x43582b[_0x20f2('0x34')]),'user:agentconnect',this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x43582b['destuniqueid']]);}else if(!this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x226967][_0x20f2('0xf')]&&!this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x226967][_0x20f2('0x13')]){logger[_0x20f2('0x21')](_0x20f2('0x48'),_0x43582b[_0x20f2('0x23')],this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x226967][_0x20f2('0x34')],_0x226967);this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x226967][_0x20f2('0xf')]=!![];this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x226967][_0x20f2('0x49')]=moment()[_0x20f2('0x27')](_0x20f2('0x28'));this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x226967]['answeredelsewheredestinationuniqueid']=_0x43582b['destuniqueid'];this[_0x20f2('0x9')][_0x43582b['uniqueid']][_0x226967]['answeredelsewheremembername']=_0x43582b[_0x20f2('0x34')];this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x226967][_0x20f2('0x41')]=_0x20f2('0x4a');this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x226967][_0x20f2('0x4b')]='answered_elsewhere';logger[_0x20f2('0x25')](_0x20f2('0x4c'),_0x43582b[_0x20f2('0x23')],util[_0x20f2('0x26')](this[_0x20f2('0x9')][_0x43582b[_0x20f2('0x23')]][_0x226967],{'showHidden':![],'depth':null}));ami['emit'](_0x20f2('0x4d'),this['channels'][_0x43582b[_0x20f2('0x23')]][_0x226967]);}}}}}}catch(_0x27b8bc){logger[_0x20f2('0x36')](_0x20f2('0x4e'),_0x43582b[_0x20f2('0x23')],util[_0x20f2('0x26')](_0x27b8bc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x376cb0){try{if(this['isNotNull'](_0x376cb0)){logger[_0x20f2('0x25')](_0x20f2('0x4f'),_0x376cb0['uniqueid'],util[_0x20f2('0x26')](_0x376cb0,{'showHidden':![],'depth':null}));if(this['channels'][_0x376cb0[_0x20f2('0x23')]]&&this['channels'][_0x376cb0[_0x20f2('0x23')]][_0x376cb0['destuniqueid']]){logger[_0x20f2('0x21')](_0x20f2('0x50'),_0x376cb0[_0x20f2('0x23')],_0x376cb0[_0x20f2('0x34')],_0x376cb0[_0x20f2('0x24')]);this[_0x20f2('0x9')][_0x376cb0[_0x20f2('0x23')]][_0x376cb0[_0x20f2('0x24')]]['agentringnoanswer']=!![];this['channels'][_0x376cb0[_0x20f2('0x23')]][_0x376cb0['destuniqueid']]['agentringnoanswerAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x20f2('0x9')][_0x376cb0[_0x20f2('0x23')]][_0x376cb0[_0x20f2('0x24')]][_0x20f2('0x41')]=_0x20f2('0x51');this[_0x20f2('0x9')][_0x376cb0[_0x20f2('0x23')]][_0x376cb0[_0x20f2('0x24')]]['reason']=_0x20f2('0x51');logger[_0x20f2('0x25')](_0x20f2('0x52'),_0x376cb0[_0x20f2('0x23')],util[_0x20f2('0x26')](this[_0x20f2('0x9')][_0x376cb0[_0x20f2('0x23')]][_0x376cb0['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x20f2('0x1c')](_0x20f2('0x53'),this[_0x20f2('0x9')][_0x376cb0[_0x20f2('0x23')]][_0x376cb0[_0x20f2('0x24')]]);}}}catch(_0x146565){logger[_0x20f2('0x36')]('[%s][voiceAgentReport][agentringnoanswer]',_0x376cb0[_0x20f2('0x23')],util['inspect'](_0x146565,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x20f2('0x12')]=function(_0x226c5e){try{if(this[_0x20f2('0x1e')](_0x226c5e)){logger[_0x20f2('0x25')](_0x20f2('0x54'),_0x226c5e[_0x20f2('0x23')],util['inspect'](_0x226c5e,{'showHidden':![],'depth':null}));if(this[_0x20f2('0x9')][_0x226c5e[_0x20f2('0x23')]]){for(var _0x2d8934 in this[_0x20f2('0x9')][_0x226c5e[_0x20f2('0x23')]]){if(this['channels'][_0x226c5e[_0x20f2('0x23')]]['hasOwnProperty'](_0x2d8934)&&!this[_0x20f2('0x9')][_0x226c5e[_0x20f2('0x23')]][_0x2d8934]['agentringnoanswer']&&!this[_0x20f2('0x9')][_0x226c5e[_0x20f2('0x23')]][_0x2d8934][_0x20f2('0x13')]){logger['info']('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x226c5e[_0x20f2('0x23')],this[_0x20f2('0x9')][_0x226c5e[_0x20f2('0x23')]][_0x2d8934][_0x20f2('0x34')],_0x2d8934);this[_0x20f2('0x9')][_0x226c5e['uniqueid']][_0x2d8934][_0x20f2('0xf')]=!![];this[_0x20f2('0x9')][_0x226c5e[_0x20f2('0x23')]][_0x2d8934][_0x20f2('0x49')]=moment()[_0x20f2('0x27')](_0x20f2('0x28'));this[_0x20f2('0x9')][_0x226c5e[_0x20f2('0x23')]][_0x2d8934]['lastevent']='abandoned';this['channels'][_0x226c5e['uniqueid']][_0x2d8934][_0x20f2('0x4b')]=_0x20f2('0x55');logger[_0x20f2('0x25')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x226c5e[_0x20f2('0x23')],util['inspect'](this['channels'][_0x226c5e[_0x20f2('0x23')]][_0x2d8934],{'showHidden':![],'depth':null}));ami[_0x20f2('0x1c')](_0x20f2('0x56'),this[_0x20f2('0x9')][_0x226c5e[_0x20f2('0x23')]][_0x2d8934]);}}}}}catch(_0x359e80){logger[_0x20f2('0x36')](_0x20f2('0x57'),_0x226c5e[_0x20f2('0x23')],util[_0x20f2('0x26')](_0x359e80,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20f2('0x1d')][_0x20f2('0x58')]=function(_0x3aee02){try{if(this[_0x20f2('0x1e')](_0x3aee02)){logger[_0x20f2('0x25')](_0x20f2('0x59'),_0x3aee02[_0x20f2('0x23')],util[_0x20f2('0x26')](_0x3aee02,{'showHidden':![],'depth':null}));if(this[_0x20f2('0x9')][_0x3aee02['uniqueid']]){for(var _0x45d6d3 in this[_0x20f2('0x9')][_0x3aee02['uniqueid']]){if(this[_0x20f2('0x9')][_0x3aee02[_0x20f2('0x23')]][_0x20f2('0x39')](_0x45d6d3)){if(this[_0x20f2('0x9')][_0x3aee02['uniqueid']][_0x45d6d3][_0x20f2('0x3b')]&&!this[_0x20f2('0x9')][_0x3aee02['uniqueid']][_0x45d6d3][_0x20f2('0x13')]){logger[_0x20f2('0x21')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3aee02[_0x20f2('0x23')],this[_0x20f2('0x9')][_0x3aee02['uniqueid']][_0x45d6d3][_0x20f2('0x34')],_0x45d6d3);this[_0x20f2('0x9')][_0x3aee02[_0x20f2('0x23')]][_0x45d6d3]['agentcomplete']=!![];this[_0x20f2('0x9')][_0x3aee02['uniqueid']][_0x45d6d3][_0x20f2('0x5a')]=moment()[_0x20f2('0x27')](_0x20f2('0x28'));this[_0x20f2('0x9')][_0x3aee02[_0x20f2('0x23')]][_0x45d6d3][_0x20f2('0x41')]='complete';this[_0x20f2('0x9')][_0x3aee02[_0x20f2('0x23')]][_0x45d6d3][_0x20f2('0x4b')]=_0x3aee02['reason']==_0x20f2('0x5b')?_0x20f2('0x5c'):_0x3aee02['reason'];this[_0x20f2('0x9')][_0x3aee02[_0x20f2('0x23')]][_0x45d6d3][_0x20f2('0x5d')]=_0x3aee02[_0x20f2('0x5d')];if(this[_0x20f2('0xa')][_0x3aee02['queue']]&&this[_0x20f2('0xa')][_0x3aee02[_0x20f2('0x29')]]['acw']){this[_0x20f2('0x9')][_0x3aee02[_0x20f2('0x23')]][_0x45d6d3][_0x20f2('0x5e')]=this[_0x20f2('0xa')][_0x3aee02['queue']][_0x20f2('0x5f')];this['channels'][_0x3aee02[_0x20f2('0x23')]][_0x45d6d3]['agentacw']=!![];}this[_0x20f2('0x60')][_0x3aee02[_0x20f2('0x43')]]=_['omit'](this[_0x20f2('0x60')][_0x3aee02[_0x20f2('0x43')]],[_0x20f2('0x29'),_0x20f2('0x44')]);logger[_0x20f2('0x25')](_0x20f2('0x61'),_0x3aee02['uniqueid'],util[_0x20f2('0x26')](this[_0x20f2('0x9')][_0x3aee02[_0x20f2('0x23')]][_0x45d6d3],{'showHidden':![],'depth':null}));ami[_0x20f2('0x1c')](_0x20f2('0x62'),this['channels'][_0x3aee02['uniqueid']][_0x45d6d3]);logger[_0x20f2('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x3aee02[_0x20f2('0x23')],util[_0x20f2('0x26')](this['channels'][_0x3aee02[_0x20f2('0x23')]][_0x45d6d3],{'showHidden':![],'depth':null}));this[_0x20f2('0x1c')](util[_0x20f2('0x27')](_0x20f2('0x33'),_0x3aee02[_0x20f2('0x34')]),_0x20f2('0x63'),this[_0x20f2('0x9')][_0x3aee02[_0x20f2('0x23')]][_0x45d6d3]);}}}}}}catch(_0x59e196){logger[_0x20f2('0x36')](_0x20f2('0x64'),_0x3aee02[_0x20f2('0x23')],util[_0x20f2('0x26')](_0x59e196,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x1e7af5){try{if(this[_0x20f2('0x1e')](_0x1e7af5)){logger[_0x20f2('0x25')](_0x20f2('0x65'),_0x1e7af5[_0x20f2('0x23')],util['inspect'](_0x1e7af5,{'showHidden':![],'depth':null}));this['addVariable'](_0x1e7af5[_0x20f2('0x23')],_[_0x20f2('0x66')](_0x1e7af5[_0x20f2('0x67')])[0x0],_0x1e7af5[_0x20f2('0x68')]);if(this['channels'][_0x1e7af5[_0x20f2('0x23')]]){for(var _0x3adc56 in this['channels'][_0x1e7af5[_0x20f2('0x23')]]){if(this[_0x20f2('0x9')][_0x1e7af5['uniqueid']][_0x20f2('0x39')](_0x3adc56)){logger[_0x20f2('0x21')](_0x20f2('0x69'),_0x1e7af5['uniqueid'],_0x3adc56,_[_0x20f2('0x66')](_0x1e7af5[_0x20f2('0x67')])[0x0],_0x1e7af5[_0x20f2('0x68')]);if(_[_0x20f2('0x1f')](this['channels'][_0x1e7af5[_0x20f2('0x23')]][_0x3adc56]['variables'])){this[_0x20f2('0x9')][_0x1e7af5[_0x20f2('0x23')]][_0x3adc56][_0x20f2('0xb')]={};}this[_0x20f2('0x9')][_0x1e7af5[_0x20f2('0x23')]][_0x3adc56]['variables']=this[_0x20f2('0xb')][_0x1e7af5[_0x20f2('0x23')]];}}}}}catch(_0x4d6b91){logger[_0x20f2('0x36')](_0x20f2('0x6a'),_0x1e7af5[_0x20f2('0x23')],util['inspect'](_0x4d6b91,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20f2('0x1d')][_0x20f2('0x6b')]=function(_0x58e59a,_0x37466f,_0x34b915){var _0x5317a5=[_0x20f2('0x6c'),'rtpaudioqosbridged',_0x20f2('0x6d'),'rtpaudioqosjitterbridged',_0x20f2('0x6e'),_0x20f2('0x6f'),_0x20f2('0x70'),_0x20f2('0x71'),_0x20f2('0x72'),_0x20f2('0x73'),_0x20f2('0x74'),'bridgepvtcallid',_0x20f2('0x75'),_0x20f2('0x76'),'memberinterface',_0x20f2('0x77'),_0x20f2('0x34'),_0x20f2('0x78'),_0x20f2('0x79')];if(!_[_0x20f2('0x7a')](_0x37466f)&&!_[_0x20f2('0x7b')](_0x5317a5,_0x37466f)){if(_[_0x20f2('0x1f')](this[_0x20f2('0xb')][_0x58e59a])){this[_0x20f2('0xb')][_0x58e59a]={};}this[_0x20f2('0xb')][_0x58e59a][_0x37466f]=_0x34b915;}};VoiceAgentReport[_0x20f2('0x1d')][_0x20f2('0x7c')]=function(_0x2fb20a){try{if(this[_0x20f2('0x1e')](_0x2fb20a)){logger[_0x20f2('0x25')](_0x20f2('0x7d'),_0x2fb20a[_0x20f2('0x23')],util[_0x20f2('0x26')](_0x2fb20a,{'showHidden':![],'depth':null}));if(this[_0x20f2('0x9')][_0x2fb20a[_0x20f2('0x23')]]){for(var _0x555c75 in this[_0x20f2('0x9')][_0x2fb20a[_0x20f2('0x23')]]){if(this[_0x20f2('0x9')][_0x2fb20a[_0x20f2('0x23')]][_0x20f2('0x39')](_0x555c75)){if(this['channels'][_0x2fb20a[_0x20f2('0x23')]][_0x555c75][_0x20f2('0x4b')]=='transfer'&&this[_0x20f2('0x9')][_0x2fb20a[_0x20f2('0x23')]][_0x555c75][_0x20f2('0x13')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x2fb20a[_0x20f2('0x23')],_0x555c75);this[_0x20f2('0x9')][_0x2fb20a[_0x20f2('0x23')]][_0x555c75][_0x20f2('0x5a')]=moment()[_0x20f2('0x27')](_0x20f2('0x28'));}}}logger['debug'](_0x20f2('0x7e'),_0x2fb20a[_0x20f2('0x23')],util[_0x20f2('0x26')](_[_0x20f2('0x7f')](this['channels'][_0x2fb20a[_0x20f2('0x23')]]),{'showHidden':![],'depth':null}));ami[_0x20f2('0x1c')](_0x20f2('0x80'),_[_0x20f2('0x7f')](this[_0x20f2('0x9')][_0x2fb20a[_0x20f2('0x23')]]));delete this[_0x20f2('0x9')][_0x2fb20a[_0x20f2('0x23')]];}if(this[_0x20f2('0xb')][_0x2fb20a['uniqueid']]){delete this[_0x20f2('0xb')][_0x2fb20a[_0x20f2('0x23')]];}}}catch(_0x20da72){logger[_0x20f2('0x36')](_0x20f2('0x81'),_0x2fb20a['uniqueid'],util[_0x20f2('0x26')](_0x20da72,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20f2('0x1d')]['syncAttendedTransfer']=function(_0x46d541){try{if(this[_0x20f2('0x1e')](_0x46d541)){logger['debug'](_0x20f2('0x82'),_0x46d541[_0x20f2('0x23')],util['inspect'](_0x46d541,{'showHidden':![],'depth':null}));if(this[_0x20f2('0x9')][_0x46d541[_0x20f2('0x83')]]){for(var _0x457a3b in this[_0x20f2('0x9')][_0x46d541['transfereeuniqueid']]){if(this[_0x20f2('0x9')][_0x46d541[_0x20f2('0x83')]][_0x20f2('0x39')](_0x457a3b)){if(_0x46d541[_0x20f2('0x84')]===_0x457a3b){logger[_0x20f2('0x21')](_0x20f2('0x85'),_0x46d541[_0x20f2('0x23')],this[_0x20f2('0x9')][_0x46d541[_0x20f2('0x83')]][_0x457a3b]['membername'],_0x457a3b);var _0x54ad8f=moment();this[_0x20f2('0x9')][_0x46d541[_0x20f2('0x83')]][_0x457a3b]['agentcomplete']=!![];this[_0x20f2('0x9')][_0x46d541[_0x20f2('0x83')]][_0x457a3b][_0x20f2('0x5a')]=moment()['format'](_0x20f2('0x28'));this[_0x20f2('0x9')][_0x46d541[_0x20f2('0x83')]][_0x457a3b][_0x20f2('0x41')]='complete';this[_0x20f2('0x9')][_0x46d541[_0x20f2('0x83')]][_0x457a3b][_0x20f2('0x4b')]=_0x20f2('0x5b');this[_0x20f2('0x9')][_0x46d541[_0x20f2('0x83')]][_0x457a3b][_0x20f2('0x5d')]=_0x54ad8f['diff'](this[_0x20f2('0x9')][_0x46d541[_0x20f2('0x83')]][_0x457a3b][_0x20f2('0x3b')],_0x20f2('0x86'));}}}}if(this[_0x20f2('0x9')][_0x46d541[_0x20f2('0x87')]]){var _0x5b587e=this['channels'][_0x46d541[_0x20f2('0x87')]];this[_0x20f2('0x9')][_0x46d541[_0x20f2('0x87')]]=this[_0x20f2('0x9')][_0x46d541[_0x20f2('0x83')]];this[_0x20f2('0x9')][_0x46d541[_0x20f2('0x83')]]=_0x5b587e;}}}catch(_0x4776dc){logger[_0x20f2('0x36')]('[%s][voiceAgentReport][attendedtransfer]',_0x46d541[_0x20f2('0x23')],util['inspect'](_0x4776dc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20f2('0x1d')][_0x20f2('0x1b')]=function(_0x564495){try{if(this[_0x20f2('0x1e')](_0x564495)){logger['debug'](_0x20f2('0x88'),_0x564495[_0x20f2('0x23')],util[_0x20f2('0x26')](_0x564495,{'showHidden':![],'depth':null}));if(this[_0x20f2('0x9')][_0x564495[_0x20f2('0x83')]]){for(var _0x80c751 in this[_0x20f2('0x9')][_0x564495[_0x20f2('0x83')]]){if(this['channels'][_0x564495[_0x20f2('0x83')]][_0x20f2('0x39')](_0x80c751)){if(_0x564495['transfereruniqueid']===_0x80c751){logger[_0x20f2('0x21')](_0x20f2('0x89'),_0x564495[_0x20f2('0x23')],this[_0x20f2('0x9')][_0x564495['transfereeuniqueid']][_0x80c751]['membername'],_0x80c751);var _0x1c6c8b=moment();this[_0x20f2('0x9')][_0x564495[_0x20f2('0x83')]][_0x80c751][_0x20f2('0x13')]=!![];this['channels'][_0x564495[_0x20f2('0x83')]][_0x80c751]['agentcompleteAt']=_0x1c6c8b;this[_0x20f2('0x9')][_0x564495[_0x20f2('0x83')]][_0x80c751][_0x20f2('0x41')]='complete';this[_0x20f2('0x9')][_0x564495['transfereeuniqueid']][_0x80c751][_0x20f2('0x4b')]='transfer';this[_0x20f2('0x9')][_0x564495[_0x20f2('0x83')]][_0x80c751][_0x20f2('0x5d')]=_0x1c6c8b[_0x20f2('0x8a')](this[_0x20f2('0x9')][_0x564495['transfereeuniqueid']][_0x80c751][_0x20f2('0x3b')],'seconds');}}}}}}catch(_0x56624c){logger['error'](_0x20f2('0x8b'),_0x564495[_0x20f2('0x23')],util[_0x20f2('0x26')](_0x56624c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20f2('0x1d')][_0x20f2('0x8c')]=function(_0x78c467){var _0x395e19='';try{if(this[_0x20f2('0x1e')](_0x78c467)){logger[_0x20f2('0x25')](_0x20f2('0x8d'),_0x78c467[_0x20f2('0x23')],util[_0x20f2('0x26')](_0x78c467,{'showHidden':![],'depth':null}));if(_0x78c467[_0x20f2('0x8e')]){_0x395e19=_0x78c467[_0x20f2('0x8e')][_0x20f2('0x8f')](0x0,_0x78c467[_0x20f2('0x8e')]['lastIndexOf']('-'));if(this['agents'][_0x395e19]){logger[_0x20f2('0x21')](_0x20f2('0x90'),_0x78c467[_0x20f2('0x23')],_0x395e19);this[_0x20f2('0x60')][_0x395e19]['onhold']=!![];}}}}catch(_0x46041e){logger[_0x20f2('0x36')](_0x20f2('0x91'),_0x78c467['uniqueid'],util['inspect'](_0x46041e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x20f2('0x19')]=function(_0x2470e2){var _0x20288a='';try{if(this[_0x20f2('0x1e')](_0x2470e2)){logger[_0x20f2('0x25')](_0x20f2('0x92'),_0x2470e2['uniqueid'],util[_0x20f2('0x26')](_0x2470e2,{'showHidden':![],'depth':null}));if(_0x2470e2['channel']){_0x20288a=_0x2470e2[_0x20f2('0x8e')][_0x20f2('0x8f')](0x0,_0x2470e2[_0x20f2('0x8e')][_0x20f2('0x93')]('-'));if(this['agents'][_0x20288a]){logger[_0x20f2('0x21')](_0x20f2('0x94'),_0x2470e2['uniqueid'],_0x20288a);this[_0x20f2('0x60')][_0x20288a][_0x20f2('0x95')]=![];}}}}catch(_0x10e993){logger[_0x20f2('0x36')]('[%s][voiceAgentReport][musiconholdstop]',_0x2470e2[_0x20f2('0x23')],util[_0x20f2('0x26')](_0x10e993,{'showHidden':![],'depth':null}));}};module[_0x20f2('0x96')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 9d94aa1..b020d94 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabbe=['lastapplication','set','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','find','isNil','push','rec','syncVarSet','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','seconds','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:%s','user:agentcomplete','resolve','transferType','undefined','isEmpty','monitors','getSettings','then','stopRecordingOnTransfer','StopMixMonitor','catch','Action','finally','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','path','ioredis','../../../config/environment','../ami','../model/channel','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','newstate','varset','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','emit','prototype','syncNewCallerId','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','keys','context','from-sip','split','destconnectedlinenum','debug','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','name','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','isUndefined','duration','subtract'];(function(_0xe27e64,_0x3f8ada){var _0x173a93=function(_0x28ac2a){while(--_0x28ac2a){_0xe27e64['push'](_0xe27e64['shift']());}};_0x173a93(++_0x3f8ada);}(_0xabbe,0x70));var _0xeabb=function(_0x1b8158,_0x9af763){_0x1b8158=_0x1b8158-0x0;var _0x16f485=_0xabbe[_0x1b8158];return _0x16f485;};'use strict';var BPromise=require(_0xeabb('0x0'));var _=require('lodash');var moment=require(_0xeabb('0x1'));var util=require('util');var path=require(_0xeabb('0x2'));var Redis=require(_0xeabb('0x3'));var config=require(_0xeabb('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0xeabb('0x5'));var Channel=require(_0xeabb('0x6'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0xeabb('0x7'),_0xeabb('0x8'),'inuse',_0xeabb('0x9'),_0xeabb('0xa'),_0xeabb('0xb'),_0xeabb('0xc'),_0xeabb('0xd'),'onhold'];var applications=['set',_0xeabb('0xe'),_0xeabb('0xf'),_0xeabb('0x10'),'playback',_0xeabb('0x11')];var dispositions=[_0xeabb('0x12'),_0xeabb('0x13'),_0xeabb('0x13'),_0xeabb('0x12'),_0xeabb('0x12'),'NO\x20ANSWER',_0xeabb('0x14'),'BUSY',_0xeabb('0x13'),_0xeabb('0x13'),_0xeabb('0x13')];var actions={};config[_0xeabb('0x15')]=_[_0xeabb('0x16')](config[_0xeabb('0x15')],{'host':_0xeabb('0x17'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xeabb('0x15')]));function VoiceCallReport(_0x4b3430){this[_0xeabb('0x18')]=_0x4b3430['channels'];this[_0xeabb('0x19')]=_0x4b3430[_0xeabb('0x19')];this[_0xeabb('0x1a')]={};ami['on'](_0xeabb('0x1b'),this[_0xeabb('0x1c')]['bind'](this));ami['on']('newexten',this[_0xeabb('0x1c')][_0xeabb('0x1d')](this));ami['on'](_0xeabb('0x1e'),this[_0xeabb('0x1f')][_0xeabb('0x1d')](this));ami['on'](_0xeabb('0x20'),this['syncNewState'][_0xeabb('0x1d')](this));ami['on'](_0xeabb('0x21'),this['syncVarSet'][_0xeabb('0x1d')](this));ami['on'](_0xeabb('0x22'),this[_0xeabb('0x23')][_0xeabb('0x1d')](this));ami['on'](_0xeabb('0x24'),this['syncNewCallerId'][_0xeabb('0x1d')](this));ami['on'](_0xeabb('0x25'),this[_0xeabb('0x26')][_0xeabb('0x1d')](this));ami['on'](_0xeabb('0x27'),this[_0xeabb('0x28')][_0xeabb('0x1d')](this));ami['on'](_0xeabb('0x29'),this[_0xeabb('0x2a')]['bind'](this));ami['on']('musiconholdstop',this[_0xeabb('0x2b')][_0xeabb('0x1d')](this));try{logger[_0xeabb('0x2c')](_0xeabb('0x2d'));ami[_0xeabb('0x2e')]();}catch(_0x403b93){logger[_0xeabb('0x2f')](_0xeabb('0x30'),util[_0xeabb('0x31')](_0x403b93,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x4834c3){return _0x4834c3!==null&&!_['isUndefined'](_0x4834c3);};VoiceCallReport['prototype'][_0xeabb('0x32')]=function(_0x2148aa,_0x517385,_0x443846){io['to'](_0x2148aa)['emit'](_0x517385,_0x443846);};VoiceCallReport[_0xeabb('0x33')][_0xeabb('0x34')]=function(_0x316fbd){try{if(this[_0xeabb('0x35')](_0x316fbd)){logger[_0xeabb('0x2c')](_0xeabb('0x36'),_0x316fbd[_0xeabb('0x37')],_0x316fbd[_0xeabb('0x38')],_0x316fbd[_0xeabb('0x39')]);logger['debug'](_0xeabb('0x3a'),_0x316fbd[_0xeabb('0x37')],util[_0xeabb('0x31')](_0x316fbd,{'showHidden':![],'depth':null}));if(_0x316fbd[_0xeabb('0x37')]===_0x316fbd[_0xeabb('0x3b')]){if(!_['isUndefined'](this[_0xeabb('0x18')][_0x316fbd[_0xeabb('0x37')]])){_[_0xeabb('0x3c')](this[_0xeabb('0x18')][_0x316fbd[_0xeabb('0x37')]],_[_0xeabb('0x3d')](_0x316fbd,_['keys'](this[_0xeabb('0x18')][_0x316fbd[_0xeabb('0x37')]])));}}}}catch(_0x36cd19){logger['error'](_0xeabb('0x3e'),_0x316fbd[_0xeabb('0x37')],util[_0xeabb('0x31')](_0x36cd19,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xeabb('0x33')][_0xeabb('0x1f')]=function(_0x4013c5){try{if(this[_0xeabb('0x35')](_0x4013c5)){logger['debug'](_0xeabb('0x3f'),_0x4013c5[_0xeabb('0x37')],util['inspect'](_0x4013c5,{'showHidden':![],'depth':null}));if(_0x4013c5[_0xeabb('0x37')]===_0x4013c5[_0xeabb('0x3b')]&&_0x4013c5[_0xeabb('0x40')]!=_0xeabb('0x41')){if(_['isUndefined'](this[_0xeabb('0x18')][_0x4013c5['uniqueid']])){logger[_0xeabb('0x2c')](_0xeabb('0x42'),_0x4013c5[_0xeabb('0x37')],_0x4013c5['context'],_0x4013c5[_0xeabb('0x43')]);this[_0xeabb('0x18')][_0x4013c5['uniqueid']]=new Channel();this['channels'][_0x4013c5[_0xeabb('0x37')]][_0xeabb('0x44')]=moment()[_0xeabb('0x45')](_0xeabb('0x46'));this[_0xeabb('0x18')][_0x4013c5[_0xeabb('0x37')]][_0xeabb('0x47')]=dispositions[_[_0xeabb('0x48')](_0x4013c5[_0xeabb('0x49')])];_[_0xeabb('0x3c')](this[_0xeabb('0x18')][_0x4013c5['uniqueid']],_[_0xeabb('0x3d')](_0x4013c5,_[_0xeabb('0x4a')](this[_0xeabb('0x18')][_0x4013c5[_0xeabb('0x37')]])));if(_0x4013c5[_0xeabb('0x4b')]===_0xeabb('0x4c')){if(this['agents'][_0x4013c5[_0xeabb('0x40')][_0xeabb('0x4d')]('-')[0x0]]){this[_0xeabb('0x19')][_0x4013c5[_0xeabb('0x40')][_0xeabb('0x4d')]('-')[0x0]][_0xeabb('0x4e')]=_0x4013c5[_0xeabb('0x43')];logger[_0xeabb('0x4f')](_0xeabb('0x50'),_0x4013c5[_0xeabb('0x37')],util[_0xeabb('0x31')]({'destaccountcode':this[_0xeabb('0x19')][_0x4013c5[_0xeabb('0x40')][_0xeabb('0x4d')]('-')[0x0]][_0xeabb('0x51')],'destconnectedlinenum':_0x4013c5[_0xeabb('0x43')]},{'showHidden':![],'depth':null}));this[_0xeabb('0x32')](util['format']('user:%s',this[_0xeabb('0x19')][_0x4013c5['channel'][_0xeabb('0x4d')]('-')[0x0]][_0xeabb('0x52')]),'user:agentconnect',{'destaccountcode':this[_0xeabb('0x19')][_0x4013c5[_0xeabb('0x40')]['split']('-')[0x0]][_0xeabb('0x51')],'destconnectedlinenum':_0x4013c5[_0xeabb('0x43')]});}}}}}}catch(_0x336a6c){logger['error'](_0xeabb('0x53'),_0x4013c5[_0xeabb('0x37')],util[_0xeabb('0x31')](_0x336a6c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xeabb('0x33')]['syncNewExten']=function(_0x4b81bc){try{if(this[_0xeabb('0x35')](_0x4b81bc)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x4b81bc[_0xeabb('0x37')],util[_0xeabb('0x31')](_0x4b81bc,{'showHidden':![],'depth':null}));if(_0x4b81bc[_0xeabb('0x37')]===_0x4b81bc[_0xeabb('0x3b')]&&_0x4b81bc[_0xeabb('0x43')]!='h'&&_0x4b81bc['channel']!='OutgoingSpoolFailed'){_0x4b81bc[_0xeabb('0x54')]=_0x4b81bc[_0xeabb('0x54')][_0xeabb('0x55')]();_0x4b81bc['applicationdata']=(_0x4b81bc['appdata']||_0x4b81bc['applicationdata'])[_0xeabb('0x55')]();logger[_0xeabb('0x2c')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x4b81bc[_0xeabb('0x37')],_0x4b81bc[_0xeabb('0x54')],_0x4b81bc[_0xeabb('0x56')]);if(_[_0xeabb('0x57')](this[_0xeabb('0x18')][_0x4b81bc[_0xeabb('0x37')]])){this[_0xeabb('0x18')][_0x4b81bc[_0xeabb('0x37')]]=new Channel();this['channels'][_0x4b81bc[_0xeabb('0x37')]]['starttime']=_0x4b81bc[_0xeabb('0x58')]?moment()[_0xeabb('0x59')](moment[_0xeabb('0x58')](_0x4b81bc['duration'])['seconds'](),'seconds')[_0xeabb('0x45')](_0xeabb('0x46')):moment()[_0xeabb('0x45')](_0xeabb('0x46'));this[_0xeabb('0x18')][_0x4b81bc['uniqueid']]['disposition']=_0xeabb('0x12');}_[_0xeabb('0x3c')](this[_0xeabb('0x18')][_0x4b81bc[_0xeabb('0x37')]],_[_0xeabb('0x3d')](_0x4b81bc,_[_0xeabb('0x4a')](this[_0xeabb('0x18')][_0x4b81bc[_0xeabb('0x37')]])));if(_['includes'](applications,_0x4b81bc[_0xeabb('0x54')])){this['channels'][_0x4b81bc[_0xeabb('0x37')]][_0xeabb('0x5a')]=_0x4b81bc[_0xeabb('0x54')];this[_0xeabb('0x18')][_0x4b81bc[_0xeabb('0x37')]]['lastdata']=_0x4b81bc['applicationdata'];if(_0x4b81bc[_0xeabb('0x54')]===_0xeabb('0x5b')&&_[_0xeabb('0x5c')](_0x4b81bc[_0xeabb('0x56')],_0xeabb('0x5d'))){var _0x2937eb=_0x4b81bc[_0xeabb('0x56')][_0xeabb('0x4d')]('=');var _0x2b2e43=_0x2937eb[0x0][_0xeabb('0x5e')](/cdr\((.*)\)/);if(_0x2b2e43){this[_0xeabb('0x18')][_0x4b81bc[_0xeabb('0x37')]][_0x2b2e43[0x1]]=_0x2937eb[0x1];}}else if(_0x4b81bc['application']===_0xeabb('0xe')){this[_0xeabb('0x18')][_0x4b81bc['uniqueid']][_0xeabb('0xe')]=_0x4b81bc['applicationdata'][_0xeabb('0x4d')](',')[0x0];}}}}}catch(_0x5c50e7){logger[_0xeabb('0x2f')](_0xeabb('0x5f'),_0x4b81bc[_0xeabb('0x37')],util[_0xeabb('0x31')](_0x5c50e7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xeabb('0x33')][_0xeabb('0x60')]=function(_0x4ecce8){try{if(this[_0xeabb('0x35')](_0x4ecce8)){logger[_0xeabb('0x2c')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x4ecce8[_0xeabb('0x37')],_0x4ecce8['linkedid'],_0x4ecce8[_0xeabb('0x38')],_0x4ecce8[_0xeabb('0x39')]);logger[_0xeabb('0x4f')](_0xeabb('0x61'),_0x4ecce8[_0xeabb('0x37')],util[_0xeabb('0x31')](_0x4ecce8,{'showHidden':![],'depth':null}));if(_0x4ecce8[_0xeabb('0x37')]!==_0x4ecce8[_0xeabb('0x3b')]){if(this['channels'][_0x4ecce8[_0xeabb('0x3b')]]){if(_0x4ecce8[_0xeabb('0x49')]==='6'){if(!this[_0xeabb('0x18')][_0x4ecce8[_0xeabb('0x3b')]][_0xeabb('0x62')]){var _0x2f3709=moment();this['channels'][_0x4ecce8['linkedid']]['answered']=!![];this[_0xeabb('0x18')][_0x4ecce8['linkedid']][_0xeabb('0x63')]=_0x2f3709[_0xeabb('0x45')](_0xeabb('0x46'));if(this['channels'][_0x4ecce8[_0xeabb('0x3b')]][_0xeabb('0x44')]){this[_0xeabb('0x18')][_0x4ecce8['linkedid']][_0xeabb('0x64')]=_0x2f3709[_0xeabb('0x65')](this[_0xeabb('0x18')][_0x4ecce8[_0xeabb('0x3b')]]['starttime'],'seconds');}}this['channels'][_0x4ecce8[_0xeabb('0x3b')]][_0xeabb('0x3b')]=_0x4ecce8[_0xeabb('0x37')];if(_0x4ecce8[_0xeabb('0x39')]!==_0xeabb('0x66')){this[_0xeabb('0x18')][_0x4ecce8[_0xeabb('0x3b')]][_0xeabb('0x67')]=_0x4ecce8[_0xeabb('0x39')];}this['channels'][_0x4ecce8[_0xeabb('0x3b')]]['connectedlinename']=_0x4ecce8['calleridname'];this[_0xeabb('0x18')][_0x4ecce8['linkedid']][_0xeabb('0x68')]=_0x4ecce8['channel'];this[_0xeabb('0x18')][_0x4ecce8[_0xeabb('0x3b')]][_0xeabb('0x47')]=dispositions[_['toNumber'](_0x4ecce8['channelstate'])];if(this[_0xeabb('0x19')][_0x4ecce8[_0xeabb('0x40')][_0xeabb('0x4d')]('-')[0x0]]){this[_0xeabb('0x18')][_0x4ecce8[_0xeabb('0x3b')]][_0xeabb('0x69')]=this[_0xeabb('0x19')][_0x4ecce8[_0xeabb('0x40')][_0xeabb('0x4d')]('-')[0x0]]['id'];this[_0xeabb('0x18')][_0x4ecce8[_0xeabb('0x3b')]][_0xeabb('0x6a')]=this['agents'][_0x4ecce8[_0xeabb('0x40')][_0xeabb('0x4d')]('-')[0x0]][_0xeabb('0x52')];}}}}else{if(this[_0xeabb('0x18')][_0x4ecce8[_0xeabb('0x37')]]){if(_0x4ecce8['channelstate']==='6'){if(this['agents'][_0x4ecce8['channel'][_0xeabb('0x4d')]('-')[0x0]]){this[_0xeabb('0x18')][_0x4ecce8[_0xeabb('0x37')]]['UserId']=this[_0xeabb('0x19')][_0x4ecce8[_0xeabb('0x40')]['split']('-')[0x0]]['id'];this[_0xeabb('0x18')][_0x4ecce8['uniqueid']][_0xeabb('0x6a')]=this['agents'][_0x4ecce8['channel'][_0xeabb('0x4d')]('-')[0x0]]['name'];}}}}}}catch(_0x48df70){logger[_0xeabb('0x2f')](_0xeabb('0x6b'),_0x4ecce8[_0xeabb('0x37')],util[_0xeabb('0x31')](_0x48df70,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xeabb('0x33')][_0xeabb('0x6c')]=function(_0x2d096a,_0x2405d7){try{if(this['channels'][_0x2d096a]){logger[_0xeabb('0x2c')](_0xeabb('0x6d'),_0x2d096a,_0x2405d7);this['channels'][_0x2d096a]['monitor']=!![];if(_[_0xeabb('0x6e')](_0x2405d7,_0xeabb('0x6f'))){_0x2405d7=_0x2405d7[_0xeabb('0x70')]('.wav49',_0xeabb('0x71'));}this[_0xeabb('0x18')][_0x2d096a]['monitorFilename']=_0x2405d7;var _0x300413=_[_0xeabb('0x72')](this['channels'][_0x2d096a]['monitors'],{'filename':_0x2405d7});if(_[_0xeabb('0x73')](_0x300413)){this[_0xeabb('0x18')][_0x2d096a]['monitors'][_0xeabb('0x74')]({'filename':_0x2405d7,'createdAt':moment()['format'](_0xeabb('0x46')),'mixmonitorid':'','status':_0xeabb('0x75')});}}}catch(_0x322122){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x2d096a,util[_0xeabb('0x31')](_0x322122,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xeabb('0x76')]=function(_0x3aa87f){try{if(this[_0xeabb('0x35')](_0x3aa87f)){logger[_0xeabb('0x4f')]('[%s][voiceCallReport][varset]\x20event:',_0x3aa87f[_0xeabb('0x37')],util[_0xeabb('0x31')](_0x3aa87f,{'showHidden':![],'depth':null}));if(this['channels'][_0x3aa87f[_0xeabb('0x37')]]&&_0x3aa87f[_0xeabb('0x40')]!=_0xeabb('0x41')){if(this[_0xeabb('0x35')](_0x3aa87f[_0xeabb('0x77')])){if(this[_0xeabb('0x35')](_0x3aa87f[_0xeabb('0x77')]['mixmonitor_filename'])){logger[_0xeabb('0x2c')](_0xeabb('0x78'),_0x3aa87f[_0xeabb('0x37')],_0x3aa87f[_0xeabb('0x79')]);this['syncMixMonitorFilename'](_0x3aa87f[_0xeabb('0x37')],_0x3aa87f['value']);}else if(this[_0xeabb('0x35')](_0x3aa87f[_0xeabb('0x77')][_0xeabb('0x7a')])){logger['info'](_0xeabb('0x7b'),_0x3aa87f[_0xeabb('0x37')],_0x3aa87f[_0xeabb('0x79')]);this[_0xeabb('0x18')][_0x3aa87f[_0xeabb('0x37')]]['calleridnum']=_0x3aa87f[_0xeabb('0x79')];}else if(this[_0xeabb('0x35')](_0x3aa87f[_0xeabb('0x77')][_0xeabb('0x7c')])){logger['info'](_0xeabb('0x7d'),_0x3aa87f['uniqueid'],_0x3aa87f[_0xeabb('0x79')]);this[_0xeabb('0x18')][_0x3aa87f[_0xeabb('0x37')]][_0xeabb('0x7e')]=_0x3aa87f[_0xeabb('0x79')];}else if(this[_0xeabb('0x35')](_0x3aa87f[_0xeabb('0x77')][_0xeabb('0x7f')])){logger[_0xeabb('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3aa87f[_0xeabb('0x37')],_0x3aa87f[_0xeabb('0x79')]);this[_0xeabb('0x18')][_0x3aa87f[_0xeabb('0x37')]][_0xeabb('0x80')]=_0x3aa87f[_0xeabb('0x79')];}else if(this['isNotNull'](_0x3aa87f[_0xeabb('0x77')][_0xeabb('0x81')])){logger[_0xeabb('0x2c')](_0xeabb('0x82'),_0x3aa87f[_0xeabb('0x37')],_0x3aa87f[_0xeabb('0x79')][_0xeabb('0x4d')](',')[0x0]);this[_0xeabb('0x18')][_0x3aa87f[_0xeabb('0x37')]][_0xeabb('0xe')]=_0x3aa87f[_0xeabb('0x79')]['split'](',')[0x0];}else if(this[_0xeabb('0x35')](_0x3aa87f[_0xeabb('0x77')]['xmd-originatecalleridnum'])){logger[_0xeabb('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x3aa87f[_0xeabb('0x37')],_0x3aa87f[_0xeabb('0x79')]);this[_0xeabb('0x18')][_0x3aa87f[_0xeabb('0x37')]][_0xeabb('0x83')]=_0x3aa87f['value'];}else if(this[_0xeabb('0x35')](_0x3aa87f[_0xeabb('0x77')][_0xeabb('0x84')])){logger[_0xeabb('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x3aa87f[_0xeabb('0x37')],_0x3aa87f['value']);this[_0xeabb('0x18')][_0x3aa87f[_0xeabb('0x37')]][_0xeabb('0x85')]=_0x3aa87f['value'];}else if(this['isNotNull'](_0x3aa87f[_0xeabb('0x77')][_0xeabb('0x86')])){logger['info'](_0xeabb('0x87'),_0x3aa87f[_0xeabb('0x37')],_0x3aa87f[_0xeabb('0x79')]);this[_0xeabb('0x18')][_0x3aa87f[_0xeabb('0x37')]][_0xeabb('0x88')]=_0x3aa87f[_0xeabb('0x79')];}else if(this['isNotNull'](_0x3aa87f['variable'][_0xeabb('0x89')])){logger[_0xeabb('0x2c')](_0xeabb('0x8a'),_0x3aa87f[_0xeabb('0x37')],_0x3aa87f['value']);this[_0xeabb('0x18')][_0x3aa87f[_0xeabb('0x37')]][_0xeabb('0xe')]=_0x3aa87f[_0xeabb('0x79')];}else if(this[_0xeabb('0x35')](_0x3aa87f[_0xeabb('0x77')][_0xeabb('0x8b')])){logger['info'](_0xeabb('0x8c'),_0x3aa87f[_0xeabb('0x37')],_0x3aa87f[_0xeabb('0x79')]);this[_0xeabb('0x18')][_0x3aa87f['uniqueid']][_0xeabb('0x8d')]=_0x3aa87f['value'];}}}else if(this[_0xeabb('0x35')](_0x3aa87f[_0xeabb('0x77')][_0xeabb('0x8e')])){if(_0x3aa87f['value']){var _0x3c8180=path[_0xeabb('0x8f')](_0x3aa87f[_0xeabb('0x79')])[_0xeabb('0x52')];logger[_0xeabb('0x2c')](_0xeabb('0x78'),_0x3c8180,_0x3aa87f['value']);this[_0xeabb('0x6c')](_0x3c8180,_0x3aa87f[_0xeabb('0x79')]);}}else if(this[_0xeabb('0x18')][_0x3aa87f[_0xeabb('0x3b')]]){if(this[_0xeabb('0x35')](_0x3aa87f['variable'])){if(this[_0xeabb('0x35')](_0x3aa87f[_0xeabb('0x77')][_0xeabb('0x8b')])){logger[_0xeabb('0x2c')](_0xeabb('0x8c'),_0x3aa87f[_0xeabb('0x3b')],_0x3aa87f[_0xeabb('0x79')]);this[_0xeabb('0x18')][_0x3aa87f[_0xeabb('0x3b')]][_0xeabb('0x90')]=_0x3aa87f[_0xeabb('0x79')];}}}}}catch(_0x4c2507){logger[_0xeabb('0x2f')]('[%s][voiceCallReport][varset]',_0x3aa87f['uniqueid'],util[_0xeabb('0x31')](_0x4c2507,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xeabb('0x33')][_0xeabb('0x23')]=function(_0xb4489e){try{if(this[_0xeabb('0x35')](_0xb4489e)){logger[_0xeabb('0x4f')]('[%s][voiceCallReport][hangup]\x20event:',_0xb4489e[_0xeabb('0x37')],util[_0xeabb('0x31')](_0xb4489e,{'showHidden':![],'depth':null}));if(this['channels'][_0xb4489e[_0xeabb('0x37')]]){logger['info'](_0xeabb('0x91'),_0xb4489e[_0xeabb('0x37')],_0xb4489e[_0xeabb('0x92')]);var _0x10e042=moment();this[_0xeabb('0x18')][_0xb4489e[_0xeabb('0x37')]][_0xeabb('0x93')]=_0x10e042[_0xeabb('0x45')](_0xeabb('0x46'));this[_0xeabb('0x18')][_0xb4489e[_0xeabb('0x37')]]['duration']=_0x10e042['diff'](this[_0xeabb('0x18')][_0xb4489e[_0xeabb('0x37')]]['starttime'],_0xeabb('0x94'));if(this['channels'][_0xb4489e['uniqueid']]['answered']){this['channels'][_0xb4489e[_0xeabb('0x37')]][_0xeabb('0x95')]=_0x10e042['diff'](this[_0xeabb('0x18')][_0xb4489e[_0xeabb('0x37')]]['answertime'],_0xeabb('0x94'));this['channels'][_0xb4489e[_0xeabb('0x37')]]['holdtime']=this['channels'][_0xb4489e[_0xeabb('0x37')]][_0xeabb('0x58')]-this['channels'][_0xb4489e['uniqueid']][_0xeabb('0x95')];}if(_0xb4489e['context']==='from-sip'){if(this[_0xeabb('0x19')][_0xb4489e[_0xeabb('0x40')][_0xeabb('0x4d')]('-')[0x0]]){this[_0xeabb('0x19')][_0xb4489e[_0xeabb('0x40')][_0xeabb('0x4d')]('-')[0x0]]=_[_0xeabb('0x96')](this['agents'][_0xb4489e[_0xeabb('0x40')][_0xeabb('0x4d')]('-')[0x0]],[_0xeabb('0x4e')]);logger[_0xeabb('0x4f')](_0xeabb('0x97'),_0xb4489e['uniqueid'],util['inspect']({'destaccountcode':this['agents'][_0xb4489e[_0xeabb('0x40')][_0xeabb('0x4d')]('-')[0x0]][_0xeabb('0x51')]},{'showHidden':![],'depth':null}));this[_0xeabb('0x32')](util[_0xeabb('0x45')](_0xeabb('0x98'),this[_0xeabb('0x19')][_0xb4489e[_0xeabb('0x40')][_0xeabb('0x4d')]('-')[0x0]][_0xeabb('0x52')]),_0xeabb('0x99'),{'destaccountcode':this[_0xeabb('0x19')][_0xb4489e[_0xeabb('0x40')][_0xeabb('0x4d')]('-')[0x0]][_0xeabb('0x51')]});}}var _0x1fd81b=this;Promise[_0xeabb('0x9a')]()['then'](function(){var _0xe4b0f5=_0x1fd81b[_0xeabb('0x18')][_0xb4489e[_0xeabb('0x37')]];if(typeof _0xe4b0f5[_0xeabb('0x9b')]===_0xeabb('0x9c'))return;if(_[_0xeabb('0x9d')](_0xe4b0f5[_0xeabb('0x9e')]))return;return RpcSetting[_0xeabb('0x9f')]()[_0xeabb('0xa0')](function(_0x4d6bd7){if(!_0x4d6bd7[_0xeabb('0xa1')])return;return Promise['resolve']()[_0xeabb('0xa0')](function(){return ami['Action']({'action':_0xeabb('0xa2'),'channel':_0xe4b0f5[_0xeabb('0x40')]})[_0xeabb('0xa3')](function(){});})[_0xeabb('0xa0')](function(){return ami[_0xeabb('0xa4')]({'action':'StopMixMonitor','channel':_0xe4b0f5[_0xeabb('0x68')]})[_0xeabb('0xa3')](function(){})[_0xeabb('0xa5')](function(){var _0x3e148f=_0x1fd81b[_0xeabb('0x19')][_0xe4b0f5[_0xeabb('0x68')][_0xeabb('0x4d')]('-')[0x0]];if(!_0x3e148f)return;io[_0xeabb('0x32')]('webbar:stopmonitors',{'agentId':_0x3e148f['id'],'uniqueid':_0xe4b0f5[_0xeabb('0x37')]});});});});})['then'](function(){if(_0xb4489e[_0xeabb('0xa6')]===_0xeabb('0xa7')){_0x1fd81b[_0xeabb('0x1a')][_0xb4489e[_0xeabb('0x37')]]=_0x1fd81b['channels'][_0xb4489e[_0xeabb('0x37')]];}else{if(_0x1fd81b[_0xeabb('0x18')][_0xb4489e[_0xeabb('0x37')]][_0xeabb('0x80')]===_0xeabb('0xa8')&&_0x1fd81b[_0xeabb('0x1a')][_0xb4489e[_0xeabb('0x37')]]){_0x1fd81b[_0xeabb('0x18')][_0xb4489e[_0xeabb('0x37')]]['uniqueid']=[_0x1fd81b[_0xeabb('0x18')][_0xb4489e[_0xeabb('0x37')]][_0xeabb('0x3b')],_0x1fd81b[_0xeabb('0x18')][_0xb4489e[_0xeabb('0x37')]][_0xeabb('0x3b')]=_0x1fd81b[_0xeabb('0x18')][_0xb4489e[_0xeabb('0x37')]][_0xeabb('0x37')]][0x0];delete _0x1fd81b[_0xeabb('0x1a')][_0xb4489e[_0xeabb('0x37')]];}}logger[_0xeabb('0x4f')](_0xeabb('0xa9'),_0xb4489e['uniqueid'],util['inspect'](_0x1fd81b[_0xeabb('0x18')][_0xb4489e[_0xeabb('0x37')]],{'showHidden':![],'depth':null}));ami[_0xeabb('0x32')](_0xeabb('0xaa'),_0x1fd81b['channels'][_0xb4489e['uniqueid']]);delete _0x1fd81b[_0xeabb('0x18')][_0xb4489e['uniqueid']];});}}}catch(_0x74e914){logger[_0xeabb('0x2f')]('[%s][voiceCallReport][hangup]',_0xb4489e[_0xeabb('0x37')],util[_0xeabb('0x31')](_0x74e914,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xeabb('0x33')][_0xeabb('0x26')]=function(_0x4aa39f){try{if(this[_0xeabb('0x35')](_0x4aa39f)){logger[_0xeabb('0x2c')](_0xeabb('0xab'),_0x4aa39f[_0xeabb('0x37')],_0x4aa39f[_0xeabb('0xac')],_0x4aa39f['transfertargetcalleridnum']);logger['debug'](_0xeabb('0xad'),_0x4aa39f[_0xeabb('0x37')],util[_0xeabb('0x31')](_0x4aa39f,{'showHidden':![],'depth':null}));if(this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xae')]]){this['channels'][_0x4aa39f[_0xeabb('0xae')]][_0xeabb('0xaf')]=_0x4aa39f[_0xeabb('0xac')];this[_0xeabb('0x18')][_0x4aa39f['transfereeuniqueid']][_0xeabb('0xb0')]=_0x4aa39f[_0xeabb('0xb1')];if(this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb2')]]){var _0x13c56f=this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb2')]];this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb2')]]=this['channels'][_0x4aa39f['transfereeuniqueid']];this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xae')]]=_0x13c56f;}}else if(this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb3')]]){this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb3')]][_0xeabb('0xaf')]=_0x4aa39f['origtransferercalleridnum'];this[_0xeabb('0x18')][_0x4aa39f['transfertargetuniqueid']][_0xeabb('0xb0')]=_0x4aa39f[_0xeabb('0xb1')];if(this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb4')]]){var _0x13c56f=this['channels'][_0x4aa39f[_0xeabb('0xb4')]];this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb4')]]=this[_0xeabb('0x18')][_0x4aa39f['transfertargetuniqueid']];this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb3')]]=_0x13c56f;}}if((this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb4')]]||this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb5')]])&&this['channels'][_0x4aa39f[_0xeabb('0xb2')]]){var _0xffbc80=_['some']([this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb4')]],this['channels'][_0x4aa39f[_0xeabb('0xb5')]],this['channels'][_0x4aa39f[_0xeabb('0xb2')]]],function(_0x8142f9){return _0x8142f9&&_0x8142f9[_0xeabb('0x80')]===_0xeabb('0xa8')&&_0x8142f9[_0xeabb('0xb6')];});if(_0xffbc80){if(this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb4')]])this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb4')]][_0xeabb('0x9b')]=_0xeabb('0xb7');if(this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb5')]])this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb5')]][_0xeabb('0x9b')]=_0xeabb('0xb7');this[_0xeabb('0x18')][_0x4aa39f[_0xeabb('0xb2')]][_0xeabb('0x9b')]=_0xeabb('0xb7');}}}}catch(_0x5244d4){logger[_0xeabb('0x2f')](_0xeabb('0xb8'),_0x4aa39f['uniqueid'],util['inspect'](_0x5244d4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xeabb('0x33')]['syncBlindTransfer']=function(_0x576160){try{if(this[_0xeabb('0x35')](_0x576160)){logger['info'](_0xeabb('0xb9'),_0x576160[_0xeabb('0x37')],_0x576160[_0xeabb('0xba')],_0x576160[_0xeabb('0xbb')]);logger['debug'](_0xeabb('0xbc'),_0x576160['uniqueid'],util[_0xeabb('0x31')](_0x576160,{'showHidden':![],'depth':null}));if(this['channels'][_0x576160[_0xeabb('0xae')]]){this['channels'][_0x576160['transfereeuniqueid']][_0xeabb('0xaf')]=_0x576160[_0xeabb('0xba')];this['channels'][_0x576160[_0xeabb('0xae')]][_0xeabb('0xb0')]=_0x576160[_0xeabb('0xbb')];this[_0xeabb('0x18')][_0x576160[_0xeabb('0xae')]][_0xeabb('0x9b')]=_0xeabb('0xbd');this[_0xeabb('0x23')]({'event':_0xeabb('0xa7'),'uniqueid':_0x576160['transfereeuniqueid'],'context':_0x576160['context'],'channel':_0x576160[_0xeabb('0xbe')]});}else{this[_0xeabb('0x18')][_0x576160[_0xeabb('0xbf')]][_0xeabb('0x9b')]='BLIND';}}}catch(_0x40bb2e){logger[_0xeabb('0x2f')](_0xeabb('0xc0'),_0x576160['uniqueid'],util['inspect'](_0x40bb2e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xeabb('0x33')][_0xeabb('0x2a')]=function(_0x74c151){try{if(this['isNotNull'](_0x74c151)){logger[_0xeabb('0x4f')](_0xeabb('0xc1'),_0x74c151[_0xeabb('0x37')],util[_0xeabb('0x31')](_0x74c151,{'showHidden':![],'depth':null}));if(this['channels'][_0x74c151[_0xeabb('0x37')]]){if(!_[_0xeabb('0x73')](this[_0xeabb('0x18')][_0x74c151['uniqueid']][_0xeabb('0x63')])){this[_0xeabb('0x18')][_0x74c151[_0xeabb('0x37')]][_0xeabb('0xc2')]=moment()[_0xeabb('0x45')](_0xeabb('0x46'));logger['info'](_0xeabb('0xc3'),_0x74c151[_0xeabb('0x37')],this[_0xeabb('0x18')][_0x74c151[_0xeabb('0x37')]][_0xeabb('0xc2')]);}}}}catch(_0x32f0f3){logger[_0xeabb('0x2f')](_0xeabb('0xc4'),_0x74c151[_0xeabb('0x37')],util['inspect'](_0x32f0f3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStop']=function(_0x3d3922){try{if(this[_0xeabb('0x35')](_0x3d3922)){logger['debug']('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x3d3922[_0xeabb('0x37')],util[_0xeabb('0x31')](_0x3d3922,{'showHidden':![],'depth':null}));if(this['channels'][_0x3d3922['uniqueid']]){if(!_['isNil'](this[_0xeabb('0x18')][_0x3d3922[_0xeabb('0x37')]]['mohstarttime'])){this[_0xeabb('0x18')][_0x3d3922[_0xeabb('0x37')]][_0xeabb('0xc5')]+=moment()[_0xeabb('0xc6')](0x0)[_0xeabb('0x65')](this[_0xeabb('0x18')][_0x3d3922[_0xeabb('0x37')]][_0xeabb('0xc2')],_0xeabb('0x94'));logger['info'](_0xeabb('0xc7'),_0x3d3922[_0xeabb('0x37')],this[_0xeabb('0x18')][_0x3d3922['uniqueid']][_0xeabb('0xc5')]);delete this[_0xeabb('0x18')][_0x3d3922[_0xeabb('0x37')]]['mohstarttime'];}}}}catch(_0x4602cf){logger[_0xeabb('0x2f')](_0xeabb('0xc8'),_0x3d3922[_0xeabb('0x37')],util['inspect'](_0x4602cf,{'showHidden':![],'depth':null}));}};module[_0xeabb('0xc9')]=VoiceCallReport; \ No newline at end of file +var _0x25a3=['replace','.WAV','find','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','destinationchannel','finally','webbar:stopmonitors','BlindTransfer','type','outbound','custom:voiceCallReport','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','path','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','unknown','busy','invalid','unavailable','ringing','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','pick','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','appdata','applicationdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49'];(function(_0x2f21c6,_0x51de35){var _0x32cbd5=function(_0x651591){while(--_0x651591){_0x2f21c6['push'](_0x2f21c6['shift']());}};_0x32cbd5(++_0x51de35);}(_0x25a3,0x121));var _0x325a=function(_0xc8cb25,_0x4468d2){_0xc8cb25=_0xc8cb25-0x0;var _0x3bb6cc=_0x25a3[_0xc8cb25];return _0x3bb6cc;};'use strict';var BPromise=require(_0x325a('0x0'));var _=require(_0x325a('0x1'));var moment=require(_0x325a('0x2'));var util=require('util');var path=require(_0x325a('0x3'));var Redis=require('ioredis');var config=require(_0x325a('0x4'));var logger=require(_0x325a('0x5'))(_0x325a('0x6'));var ami=require('../ami');var Channel=require(_0x325a('0x7'));var RpcSetting=require(_0x325a('0x8'));var statusDesc=[_0x325a('0x9'),'not_inuse','inuse',_0x325a('0xa'),_0x325a('0xb'),_0x325a('0xc'),_0x325a('0xd'),'ringinuse','onhold'];var applications=[_0x325a('0xe'),_0x325a('0xf'),_0x325a('0x10'),_0x325a('0x11'),_0x325a('0x12'),_0x325a('0x13')];var dispositions=['NO\x20ANSWER',_0x325a('0x14'),_0x325a('0x14'),'NO\x20ANSWER',_0x325a('0x15'),_0x325a('0x15'),_0x325a('0x16'),_0x325a('0x17'),'FAILED','FAILED',_0x325a('0x14')];var actions={};config['redis']=_[_0x325a('0x18')](config[_0x325a('0x19')],{'host':_0x325a('0x1a'),'port':0x18eb});var io=require(_0x325a('0x1b'))(new Redis(config[_0x325a('0x19')]));function VoiceCallReport(_0x3d198c){this[_0x325a('0x1c')]=_0x3d198c[_0x325a('0x1c')];this[_0x325a('0x1d')]=_0x3d198c[_0x325a('0x1d')];this[_0x325a('0x1e')]={};ami['on'](_0x325a('0x1f'),this[_0x325a('0x20')][_0x325a('0x21')](this));ami['on']('newexten',this[_0x325a('0x20')][_0x325a('0x21')](this));ami['on']('newchannel',this[_0x325a('0x22')][_0x325a('0x21')](this));ami['on'](_0x325a('0x23'),this[_0x325a('0x24')][_0x325a('0x21')](this));ami['on'](_0x325a('0x25'),this[_0x325a('0x26')][_0x325a('0x21')](this));ami['on'](_0x325a('0x27'),this[_0x325a('0x28')][_0x325a('0x21')](this));ami['on'](_0x325a('0x29'),this['syncNewCallerId'][_0x325a('0x21')](this));ami['on'](_0x325a('0x2a'),this[_0x325a('0x2b')][_0x325a('0x21')](this));ami['on'](_0x325a('0x2c'),this[_0x325a('0x2d')]['bind'](this));ami['on'](_0x325a('0x2e'),this['syncMusicOnHoldStart'][_0x325a('0x21')](this));ami['on'](_0x325a('0x2f'),this[_0x325a('0x30')][_0x325a('0x21')](this));try{logger[_0x325a('0x31')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x325a('0x32')]();}catch(_0x4b4155){logger[_0x325a('0x33')](_0x325a('0x34'),util[_0x325a('0x35')](_0x4b4155,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x325a('0x36')]=function(_0x33bfc0){return _0x33bfc0!==null&&!_[_0x325a('0x37')](_0x33bfc0);};VoiceCallReport[_0x325a('0x38')][_0x325a('0x39')]=function(_0x18a8d7,_0x19b002,_0x49d93b){io['to'](_0x18a8d7)[_0x325a('0x39')](_0x19b002,_0x49d93b);};VoiceCallReport['prototype'][_0x325a('0x3a')]=function(_0x3fa4f6){try{if(this[_0x325a('0x36')](_0x3fa4f6)){logger[_0x325a('0x31')](_0x325a('0x3b'),_0x3fa4f6['uniqueid'],_0x3fa4f6[_0x325a('0x3c')],_0x3fa4f6['calleridnum']);logger[_0x325a('0x3d')](_0x325a('0x3e'),_0x3fa4f6['uniqueid'],util[_0x325a('0x35')](_0x3fa4f6,{'showHidden':![],'depth':null}));if(_0x3fa4f6[_0x325a('0x3f')]===_0x3fa4f6[_0x325a('0x40')]){if(!_[_0x325a('0x37')](this['channels'][_0x3fa4f6[_0x325a('0x3f')]])){_[_0x325a('0x41')](this[_0x325a('0x1c')][_0x3fa4f6[_0x325a('0x3f')]],_['pick'](_0x3fa4f6,_[_0x325a('0x42')](this[_0x325a('0x1c')][_0x3fa4f6[_0x325a('0x3f')]])));}}}}catch(_0x2070a1){logger[_0x325a('0x33')](_0x325a('0x43'),_0x3fa4f6['uniqueid'],util[_0x325a('0x35')](_0x2070a1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x325a('0x38')]['syncNewChannel']=function(_0x3a283f){try{if(this[_0x325a('0x36')](_0x3a283f)){logger['debug'](_0x325a('0x44'),_0x3a283f['uniqueid'],util[_0x325a('0x35')](_0x3a283f,{'showHidden':![],'depth':null}));if(_0x3a283f[_0x325a('0x3f')]===_0x3a283f[_0x325a('0x40')]&&_0x3a283f[_0x325a('0x45')]!='OutgoingSpoolFailed'){if(_[_0x325a('0x37')](this['channels'][_0x3a283f[_0x325a('0x3f')]])){logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x3a283f[_0x325a('0x3f')],_0x3a283f[_0x325a('0x46')],_0x3a283f[_0x325a('0x47')]);this['channels'][_0x3a283f[_0x325a('0x3f')]]=new Channel();this['channels'][_0x3a283f[_0x325a('0x3f')]][_0x325a('0x48')]=moment()[_0x325a('0x49')](_0x325a('0x4a'));this[_0x325a('0x1c')][_0x3a283f[_0x325a('0x3f')]][_0x325a('0x4b')]=dispositions[_[_0x325a('0x4c')](_0x3a283f['channelstate'])];_[_0x325a('0x41')](this[_0x325a('0x1c')][_0x3a283f[_0x325a('0x3f')]],_[_0x325a('0x4d')](_0x3a283f,_[_0x325a('0x42')](this[_0x325a('0x1c')][_0x3a283f[_0x325a('0x3f')]])));if(_0x3a283f[_0x325a('0x46')]===_0x325a('0x4e')){if(this['agents'][_0x3a283f[_0x325a('0x45')][_0x325a('0x4f')]('-')[0x0]]){this[_0x325a('0x1d')][_0x3a283f[_0x325a('0x45')][_0x325a('0x4f')]('-')[0x0]][_0x325a('0x50')]=_0x3a283f[_0x325a('0x47')];logger[_0x325a('0x3d')](_0x325a('0x51'),_0x3a283f[_0x325a('0x3f')],util[_0x325a('0x35')]({'destaccountcode':this['agents'][_0x3a283f[_0x325a('0x45')][_0x325a('0x4f')]('-')[0x0]][_0x325a('0x52')],'destconnectedlinenum':_0x3a283f[_0x325a('0x47')]},{'showHidden':![],'depth':null}));this[_0x325a('0x39')](util[_0x325a('0x49')]('user:%s',this[_0x325a('0x1d')][_0x3a283f[_0x325a('0x45')][_0x325a('0x4f')]('-')[0x0]][_0x325a('0x53')]),_0x325a('0x54'),{'destaccountcode':this['agents'][_0x3a283f[_0x325a('0x45')][_0x325a('0x4f')]('-')[0x0]][_0x325a('0x52')],'destconnectedlinenum':_0x3a283f['exten']});}}}}}}catch(_0x3c0db5){logger[_0x325a('0x33')](_0x325a('0x55'),_0x3a283f['uniqueid'],util['inspect'](_0x3c0db5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x325a('0x38')][_0x325a('0x20')]=function(_0x3d1eee){try{if(this[_0x325a('0x36')](_0x3d1eee)){logger['debug'](_0x325a('0x56'),_0x3d1eee[_0x325a('0x3f')],util['inspect'](_0x3d1eee,{'showHidden':![],'depth':null}));if(_0x3d1eee[_0x325a('0x3f')]===_0x3d1eee[_0x325a('0x40')]&&_0x3d1eee['exten']!='h'&&_0x3d1eee[_0x325a('0x45')]!=_0x325a('0x57')){_0x3d1eee['application']=_0x3d1eee[_0x325a('0x58')]['toLowerCase']();_0x3d1eee['applicationdata']=(_0x3d1eee[_0x325a('0x59')]||_0x3d1eee[_0x325a('0x5a')])[_0x325a('0x5b')]();logger['info'](_0x325a('0x5c'),_0x3d1eee[_0x325a('0x3f')],_0x3d1eee['application'],_0x3d1eee['applicationdata']);if(_[_0x325a('0x37')](this[_0x325a('0x1c')][_0x3d1eee['uniqueid']])){this[_0x325a('0x1c')][_0x3d1eee['uniqueid']]=new Channel();this['channels'][_0x3d1eee['uniqueid']][_0x325a('0x48')]=_0x3d1eee[_0x325a('0x5d')]?moment()['subtract'](moment[_0x325a('0x5d')](_0x3d1eee[_0x325a('0x5d')])['seconds'](),_0x325a('0x5e'))[_0x325a('0x49')](_0x325a('0x4a')):moment()[_0x325a('0x49')](_0x325a('0x4a'));this[_0x325a('0x1c')][_0x3d1eee['uniqueid']][_0x325a('0x4b')]=_0x325a('0x15');}_['merge'](this[_0x325a('0x1c')][_0x3d1eee['uniqueid']],_[_0x325a('0x4d')](_0x3d1eee,_[_0x325a('0x42')](this[_0x325a('0x1c')][_0x3d1eee[_0x325a('0x3f')]])));if(_[_0x325a('0x5f')](applications,_0x3d1eee[_0x325a('0x58')])){this[_0x325a('0x1c')][_0x3d1eee[_0x325a('0x3f')]][_0x325a('0x60')]=_0x3d1eee[_0x325a('0x58')];this['channels'][_0x3d1eee[_0x325a('0x3f')]][_0x325a('0x61')]=_0x3d1eee['applicationdata'];if(_0x3d1eee[_0x325a('0x58')]===_0x325a('0xe')&&_[_0x325a('0x62')](_0x3d1eee[_0x325a('0x5a')],_0x325a('0x63'))){var _0x85bfcd=_0x3d1eee[_0x325a('0x5a')][_0x325a('0x4f')]('=');var _0x45d8a4=_0x85bfcd[0x0][_0x325a('0x64')](/cdr\((.*)\)/);if(_0x45d8a4){this[_0x325a('0x1c')][_0x3d1eee[_0x325a('0x3f')]][_0x45d8a4[0x1]]=_0x85bfcd[0x1];}}else if(_0x3d1eee[_0x325a('0x58')]===_0x325a('0xf')){this['channels'][_0x3d1eee[_0x325a('0x3f')]][_0x325a('0xf')]=_0x3d1eee[_0x325a('0x5a')][_0x325a('0x4f')](',')[0x0];}}}}}catch(_0x2b5ea1){logger[_0x325a('0x33')](_0x325a('0x65'),_0x3d1eee[_0x325a('0x3f')],util[_0x325a('0x35')](_0x2b5ea1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x325a('0x38')][_0x325a('0x24')]=function(_0x1f8fbd){try{if(this['isNotNull'](_0x1f8fbd)){logger[_0x325a('0x31')](_0x325a('0x66'),_0x1f8fbd['uniqueid'],_0x1f8fbd[_0x325a('0x40')],_0x1f8fbd[_0x325a('0x3c')],_0x1f8fbd[_0x325a('0x67')]);logger['debug'](_0x325a('0x68'),_0x1f8fbd[_0x325a('0x3f')],util[_0x325a('0x35')](_0x1f8fbd,{'showHidden':![],'depth':null}));if(_0x1f8fbd[_0x325a('0x3f')]!==_0x1f8fbd[_0x325a('0x40')]){if(this[_0x325a('0x1c')][_0x1f8fbd[_0x325a('0x40')]]){if(_0x1f8fbd[_0x325a('0x69')]==='6'){if(!this[_0x325a('0x1c')][_0x1f8fbd['linkedid']][_0x325a('0x6a')]){var _0x2e3c2d=moment();this[_0x325a('0x1c')][_0x1f8fbd[_0x325a('0x40')]][_0x325a('0x6a')]=!![];this[_0x325a('0x1c')][_0x1f8fbd[_0x325a('0x40')]][_0x325a('0x6b')]=_0x2e3c2d[_0x325a('0x49')](_0x325a('0x4a'));if(this[_0x325a('0x1c')][_0x1f8fbd[_0x325a('0x40')]][_0x325a('0x48')]){this[_0x325a('0x1c')][_0x1f8fbd['linkedid']][_0x325a('0x6c')]=_0x2e3c2d[_0x325a('0x6d')](this['channels'][_0x1f8fbd[_0x325a('0x40')]][_0x325a('0x48')],_0x325a('0x5e'));}}this[_0x325a('0x1c')][_0x1f8fbd[_0x325a('0x40')]][_0x325a('0x40')]=_0x1f8fbd['uniqueid'];if(_0x1f8fbd[_0x325a('0x67')]!==_0x325a('0x6e')){this[_0x325a('0x1c')][_0x1f8fbd[_0x325a('0x40')]][_0x325a('0x6f')]=_0x1f8fbd['calleridnum'];}this[_0x325a('0x1c')][_0x1f8fbd[_0x325a('0x40')]]['connectedlinename']=_0x1f8fbd['calleridname'];this[_0x325a('0x1c')][_0x1f8fbd['linkedid']]['destinationchannel']=_0x1f8fbd[_0x325a('0x45')];this[_0x325a('0x1c')][_0x1f8fbd['linkedid']][_0x325a('0x4b')]=dispositions[_[_0x325a('0x4c')](_0x1f8fbd['channelstate'])];if(this[_0x325a('0x1d')][_0x1f8fbd['channel'][_0x325a('0x4f')]('-')[0x0]]){this[_0x325a('0x1c')][_0x1f8fbd[_0x325a('0x40')]][_0x325a('0x70')]=this[_0x325a('0x1d')][_0x1f8fbd[_0x325a('0x45')]['split']('-')[0x0]]['id'];this[_0x325a('0x1c')][_0x1f8fbd[_0x325a('0x40')]][_0x325a('0x71')]=this['agents'][_0x1f8fbd['channel']['split']('-')[0x0]][_0x325a('0x53')];}}}}else{if(this[_0x325a('0x1c')][_0x1f8fbd['uniqueid']]){if(_0x1f8fbd[_0x325a('0x69')]==='6'){if(this[_0x325a('0x1d')][_0x1f8fbd['channel'][_0x325a('0x4f')]('-')[0x0]]){this['channels'][_0x1f8fbd[_0x325a('0x3f')]][_0x325a('0x70')]=this[_0x325a('0x1d')][_0x1f8fbd[_0x325a('0x45')][_0x325a('0x4f')]('-')[0x0]]['id'];this[_0x325a('0x1c')][_0x1f8fbd[_0x325a('0x3f')]][_0x325a('0x71')]=this[_0x325a('0x1d')][_0x1f8fbd[_0x325a('0x45')][_0x325a('0x4f')]('-')[0x0]][_0x325a('0x53')];}}}}}}catch(_0x37ce1a){logger['error'](_0x325a('0x72'),_0x1f8fbd[_0x325a('0x3f')],util['inspect'](_0x37ce1a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x325a('0x38')][_0x325a('0x73')]=function(_0x402ce5,_0x4e82f4){try{if(this['channels'][_0x402ce5]){logger[_0x325a('0x31')](_0x325a('0x74'),_0x402ce5,_0x4e82f4);this['channels'][_0x402ce5]['monitor']=!![];if(_[_0x325a('0x75')](_0x4e82f4,_0x325a('0x76'))){_0x4e82f4=_0x4e82f4[_0x325a('0x77')]('.wav49',_0x325a('0x78'));}this[_0x325a('0x1c')][_0x402ce5]['monitorFilename']=_0x4e82f4;var _0x41998f=_[_0x325a('0x79')](this[_0x325a('0x1c')][_0x402ce5][_0x325a('0x7a')],{'filename':_0x4e82f4});if(_['isNil'](_0x41998f)){this[_0x325a('0x1c')][_0x402ce5][_0x325a('0x7a')][_0x325a('0x7b')]({'filename':_0x4e82f4,'createdAt':moment()[_0x325a('0x49')](_0x325a('0x4a')),'mixmonitorid':'','status':_0x325a('0x7c')});}}}catch(_0x3a5808){logger[_0x325a('0x33')]('[%s][voiceCallReport][mixMonitorFilename]',_0x402ce5,util['inspect'](_0x3a5808,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x325a('0x38')]['syncVarSet']=function(_0x25af14){try{if(this[_0x325a('0x36')](_0x25af14)){logger[_0x325a('0x3d')](_0x325a('0x7d'),_0x25af14[_0x325a('0x3f')],util[_0x325a('0x35')](_0x25af14,{'showHidden':![],'depth':null}));if(this[_0x325a('0x1c')][_0x25af14[_0x325a('0x3f')]]&&_0x25af14[_0x325a('0x45')]!=_0x325a('0x57')){if(this[_0x325a('0x36')](_0x25af14[_0x325a('0x7e')])){if(this['isNotNull'](_0x25af14[_0x325a('0x7e')]['mixmonitor_filename'])){logger['info'](_0x325a('0x7f'),_0x25af14[_0x325a('0x3f')],_0x25af14[_0x325a('0x80')]);this[_0x325a('0x73')](_0x25af14[_0x325a('0x3f')],_0x25af14[_0x325a('0x80')]);}else if(this[_0x325a('0x36')](_0x25af14[_0x325a('0x7e')][_0x325a('0x81')])){logger[_0x325a('0x31')](_0x325a('0x82'),_0x25af14['uniqueid'],_0x25af14[_0x325a('0x80')]);this[_0x325a('0x1c')][_0x25af14['uniqueid']][_0x325a('0x67')]=_0x25af14['value'];}else if(this[_0x325a('0x36')](_0x25af14[_0x325a('0x7e')][_0x325a('0x83')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x25af14['uniqueid'],_0x25af14[_0x325a('0x80')]);this[_0x325a('0x1c')][_0x25af14[_0x325a('0x3f')]]['callerid']=_0x25af14[_0x325a('0x80')];}else if(this[_0x325a('0x36')](_0x25af14['variable']['xmd-cdrtype'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x25af14[_0x325a('0x3f')],_0x25af14[_0x325a('0x80')]);this[_0x325a('0x1c')][_0x25af14['uniqueid']]['type']=_0x25af14[_0x325a('0x80')];}else if(this[_0x325a('0x36')](_0x25af14[_0x325a('0x7e')][_0x325a('0x84')])){logger[_0x325a('0x31')](_0x325a('0x85'),_0x25af14['uniqueid'],_0x25af14[_0x325a('0x80')][_0x325a('0x4f')](',')[0x0]);this[_0x325a('0x1c')][_0x25af14['uniqueid']]['queue']=_0x25af14[_0x325a('0x80')][_0x325a('0x4f')](',')[0x0];}else if(this[_0x325a('0x36')](_0x25af14[_0x325a('0x7e')][_0x325a('0x86')])){logger['info'](_0x325a('0x87'),_0x25af14[_0x325a('0x3f')],_0x25af14[_0x325a('0x80')]);this['channels'][_0x25af14[_0x325a('0x3f')]]['originatecalleridnum']=_0x25af14[_0x325a('0x80')];}else if(this[_0x325a('0x36')](_0x25af14['variable'][_0x325a('0x88')])){logger[_0x325a('0x31')](_0x325a('0x89'),_0x25af14[_0x325a('0x3f')],_0x25af14[_0x325a('0x80')]);this[_0x325a('0x1c')][_0x25af14[_0x325a('0x3f')]][_0x325a('0x8a')]=_0x25af14[_0x325a('0x80')];}else if(this[_0x325a('0x36')](_0x25af14[_0x325a('0x7e')][_0x325a('0x8b')])){logger[_0x325a('0x31')](_0x325a('0x8c'),_0x25af14[_0x325a('0x3f')],_0x25af14[_0x325a('0x80')]);this[_0x325a('0x1c')][_0x25af14[_0x325a('0x3f')]][_0x325a('0x8d')]=_0x25af14[_0x325a('0x80')];}else if(this[_0x325a('0x36')](_0x25af14[_0x325a('0x7e')]['xmcs-queue'])){logger[_0x325a('0x31')](_0x325a('0x8e'),_0x25af14[_0x325a('0x3f')],_0x25af14[_0x325a('0x80')]);this[_0x325a('0x1c')][_0x25af14[_0x325a('0x3f')]][_0x325a('0xf')]=_0x25af14['value'];}else if(this[_0x325a('0x36')](_0x25af14[_0x325a('0x7e')][_0x325a('0x8f')])){logger[_0x325a('0x31')](_0x325a('0x90'),_0x25af14[_0x325a('0x3f')],_0x25af14[_0x325a('0x80')]);this[_0x325a('0x1c')][_0x25af14[_0x325a('0x3f')]][_0x325a('0x91')]=_0x25af14[_0x325a('0x80')];}}}else if(this[_0x325a('0x36')](_0x25af14[_0x325a('0x7e')][_0x325a('0x92')])){if(_0x25af14[_0x325a('0x80')]){var _0x47da34=path[_0x325a('0x93')](_0x25af14[_0x325a('0x80')])['name'];logger[_0x325a('0x31')](_0x325a('0x7f'),_0x47da34,_0x25af14['value']);this[_0x325a('0x73')](_0x47da34,_0x25af14[_0x325a('0x80')]);}}else if(this[_0x325a('0x1c')][_0x25af14[_0x325a('0x40')]]){if(this['isNotNull'](_0x25af14[_0x325a('0x7e')])){if(this[_0x325a('0x36')](_0x25af14[_0x325a('0x7e')]['sipcallid'])){logger[_0x325a('0x31')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x25af14[_0x325a('0x40')],_0x25af14['value']);this['channels'][_0x25af14[_0x325a('0x40')]][_0x325a('0x94')]=_0x25af14['value'];}}}}}catch(_0x47c3b7){logger[_0x325a('0x33')](_0x325a('0x95'),_0x25af14['uniqueid'],util[_0x325a('0x35')](_0x47c3b7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x325a('0x38')][_0x325a('0x28')]=function(_0x43c32e){try{if(this['isNotNull'](_0x43c32e)){logger[_0x325a('0x3d')](_0x325a('0x96'),_0x43c32e[_0x325a('0x3f')],util[_0x325a('0x35')](_0x43c32e,{'showHidden':![],'depth':null}));if(this['channels'][_0x43c32e[_0x325a('0x3f')]]){logger[_0x325a('0x31')](_0x325a('0x97'),_0x43c32e[_0x325a('0x3f')],_0x43c32e[_0x325a('0x98')]);var _0x430ebb=moment();this[_0x325a('0x1c')][_0x43c32e[_0x325a('0x3f')]][_0x325a('0x99')]=_0x430ebb[_0x325a('0x49')](_0x325a('0x4a'));this['channels'][_0x43c32e[_0x325a('0x3f')]]['duration']=_0x430ebb[_0x325a('0x6d')](this[_0x325a('0x1c')][_0x43c32e[_0x325a('0x3f')]][_0x325a('0x48')],_0x325a('0x5e'));if(this['channels'][_0x43c32e[_0x325a('0x3f')]]['answered']){this[_0x325a('0x1c')][_0x43c32e[_0x325a('0x3f')]]['billableseconds']=_0x430ebb[_0x325a('0x6d')](this['channels'][_0x43c32e[_0x325a('0x3f')]][_0x325a('0x6b')],_0x325a('0x5e'));this[_0x325a('0x1c')][_0x43c32e[_0x325a('0x3f')]]['holdtime']=this[_0x325a('0x1c')][_0x43c32e[_0x325a('0x3f')]][_0x325a('0x5d')]-this['channels'][_0x43c32e[_0x325a('0x3f')]][_0x325a('0x9a')];}if(_0x43c32e[_0x325a('0x46')]===_0x325a('0x4e')){if(this[_0x325a('0x1d')][_0x43c32e[_0x325a('0x45')][_0x325a('0x4f')]('-')[0x0]]){this[_0x325a('0x1d')][_0x43c32e['channel'][_0x325a('0x4f')]('-')[0x0]]=_[_0x325a('0x9b')](this[_0x325a('0x1d')][_0x43c32e['channel'][_0x325a('0x4f')]('-')[0x0]],[_0x325a('0x50')]);logger['debug'](_0x325a('0x9c'),_0x43c32e['uniqueid'],util['inspect']({'destaccountcode':this[_0x325a('0x1d')][_0x43c32e[_0x325a('0x45')][_0x325a('0x4f')]('-')[0x0]][_0x325a('0x52')]},{'showHidden':![],'depth':null}));this[_0x325a('0x39')](util[_0x325a('0x49')]('user:%s',this[_0x325a('0x1d')][_0x43c32e['channel']['split']('-')[0x0]][_0x325a('0x53')]),_0x325a('0x9d'),{'destaccountcode':this[_0x325a('0x1d')][_0x43c32e[_0x325a('0x45')][_0x325a('0x4f')]('-')[0x0]][_0x325a('0x52')]});}}var _0x32195d=this;Promise[_0x325a('0x9e')]()[_0x325a('0x9f')](function(){var _0x5202a2=_0x32195d[_0x325a('0x1c')][_0x43c32e[_0x325a('0x3f')]];if(typeof _0x5202a2[_0x325a('0xa0')]===_0x325a('0xa1'))return;if(_[_0x325a('0xa2')](_0x5202a2['monitors']))return;return RpcSetting[_0x325a('0xa3')]()['then'](function(_0x3cec75){if(!_0x3cec75[_0x325a('0xa4')])return;return Promise['resolve']()['then'](function(){return ami[_0x325a('0xa5')]({'action':_0x325a('0xa6'),'channel':_0x5202a2['channel']})[_0x325a('0xa7')](function(){});})[_0x325a('0x9f')](function(){return ami[_0x325a('0xa5')]({'action':_0x325a('0xa6'),'channel':_0x5202a2[_0x325a('0xa8')]})[_0x325a('0xa7')](function(){})[_0x325a('0xa9')](function(){var _0x46b760=_0x32195d[_0x325a('0x1d')][_0x5202a2['destinationchannel'][_0x325a('0x4f')]('-')[0x0]];if(!_0x46b760)return;io[_0x325a('0x39')](_0x325a('0xaa'),{'agentId':_0x46b760['id'],'uniqueid':_0x5202a2[_0x325a('0x3f')]});});});});})['then'](function(){if(_0x43c32e['event']===_0x325a('0xab')){_0x32195d[_0x325a('0x1e')][_0x43c32e[_0x325a('0x3f')]]=_0x32195d[_0x325a('0x1c')][_0x43c32e[_0x325a('0x3f')]];}else{if(_0x32195d[_0x325a('0x1c')][_0x43c32e[_0x325a('0x3f')]][_0x325a('0xac')]===_0x325a('0xad')&&_0x32195d['blindTransfers'][_0x43c32e[_0x325a('0x3f')]]){_0x32195d[_0x325a('0x1c')][_0x43c32e['uniqueid']][_0x325a('0x3f')]=[_0x32195d[_0x325a('0x1c')][_0x43c32e[_0x325a('0x3f')]]['linkedid'],_0x32195d[_0x325a('0x1c')][_0x43c32e[_0x325a('0x3f')]]['linkedid']=_0x32195d['channels'][_0x43c32e[_0x325a('0x3f')]][_0x325a('0x3f')]][0x0];delete _0x32195d[_0x325a('0x1e')][_0x43c32e[_0x325a('0x3f')]];}}logger[_0x325a('0x3d')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x43c32e['uniqueid'],util[_0x325a('0x35')](_0x32195d[_0x325a('0x1c')][_0x43c32e[_0x325a('0x3f')]],{'showHidden':![],'depth':null}));ami[_0x325a('0x39')](_0x325a('0xae'),_0x32195d['channels'][_0x43c32e['uniqueid']]);delete _0x32195d[_0x325a('0x1c')][_0x43c32e[_0x325a('0x3f')]];});}}}catch(_0xde31ab){logger[_0x325a('0x33')]('[%s][voiceCallReport][hangup]',_0x43c32e[_0x325a('0x3f')],util[_0x325a('0x35')](_0xde31ab,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x325a('0x38')][_0x325a('0x2b')]=function(_0xf5fd91){try{if(this[_0x325a('0x36')](_0xf5fd91)){logger[_0x325a('0x31')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0xf5fd91[_0x325a('0x3f')],_0xf5fd91[_0x325a('0xaf')],_0xf5fd91[_0x325a('0xb0')]);logger['debug'](_0x325a('0xb1'),_0xf5fd91[_0x325a('0x3f')],util[_0x325a('0x35')](_0xf5fd91,{'showHidden':![],'depth':null}));if(this[_0x325a('0x1c')][_0xf5fd91['transfereeuniqueid']]){this[_0x325a('0x1c')][_0xf5fd91[_0x325a('0xb2')]][_0x325a('0xb3')]=_0xf5fd91[_0x325a('0xaf')];this[_0x325a('0x1c')][_0xf5fd91[_0x325a('0xb2')]][_0x325a('0xb4')]=_0xf5fd91['transfertargetcalleridnum'];if(this[_0x325a('0x1c')][_0xf5fd91['secondtransfereruniqueid']]){var _0x11d4d0=this[_0x325a('0x1c')][_0xf5fd91['secondtransfereruniqueid']];this[_0x325a('0x1c')][_0xf5fd91['secondtransfereruniqueid']]=this['channels'][_0xf5fd91[_0x325a('0xb2')]];this[_0x325a('0x1c')][_0xf5fd91[_0x325a('0xb2')]]=_0x11d4d0;}}else if(this[_0x325a('0x1c')][_0xf5fd91[_0x325a('0xb5')]]){this[_0x325a('0x1c')][_0xf5fd91[_0x325a('0xb5')]][_0x325a('0xb3')]=_0xf5fd91[_0x325a('0xaf')];this[_0x325a('0x1c')][_0xf5fd91['transfertargetuniqueid']][_0x325a('0xb4')]=_0xf5fd91['transfertargetcalleridnum'];if(this[_0x325a('0x1c')][_0xf5fd91[_0x325a('0xb6')]]){var _0x11d4d0=this['channels'][_0xf5fd91[_0x325a('0xb6')]];this[_0x325a('0x1c')][_0xf5fd91[_0x325a('0xb6')]]=this[_0x325a('0x1c')][_0xf5fd91[_0x325a('0xb5')]];this['channels'][_0xf5fd91[_0x325a('0xb5')]]=_0x11d4d0;}}if((this[_0x325a('0x1c')][_0xf5fd91['origtransfereruniqueid']]||this[_0x325a('0x1c')][_0xf5fd91[_0x325a('0xb7')]])&&this[_0x325a('0x1c')][_0xf5fd91[_0x325a('0xb8')]]){var _0x3970a4=_['some']([this[_0x325a('0x1c')][_0xf5fd91[_0x325a('0xb6')]],this[_0x325a('0x1c')][_0xf5fd91['origtransfererlinkedid']],this['channels'][_0xf5fd91[_0x325a('0xb8')]]],function(_0x10b353){return _0x10b353&&_0x10b353['type']===_0x325a('0xad')&&_0x10b353[_0x325a('0xb9')];});if(_0x3970a4){if(this['channels'][_0xf5fd91[_0x325a('0xb6')]])this[_0x325a('0x1c')][_0xf5fd91[_0x325a('0xb6')]][_0x325a('0xa0')]=_0x325a('0xba');if(this[_0x325a('0x1c')][_0xf5fd91['origtransfererlinkedid']])this['channels'][_0xf5fd91[_0x325a('0xb7')]]['transferType']=_0x325a('0xba');this[_0x325a('0x1c')][_0xf5fd91[_0x325a('0xb8')]][_0x325a('0xa0')]=_0x325a('0xba');}}}}catch(_0x28849f){logger['error'](_0x325a('0xbb'),_0xf5fd91['uniqueid'],util[_0x325a('0x35')](_0x28849f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x325a('0x2d')]=function(_0x4f9027){try{if(this[_0x325a('0x36')](_0x4f9027)){logger[_0x325a('0x31')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x4f9027[_0x325a('0x3f')],_0x4f9027[_0x325a('0xbc')],_0x4f9027['extension']);logger[_0x325a('0x3d')](_0x325a('0xbd'),_0x4f9027[_0x325a('0x3f')],util['inspect'](_0x4f9027,{'showHidden':![],'depth':null}));if(this['channels'][_0x4f9027[_0x325a('0xb2')]]){this[_0x325a('0x1c')][_0x4f9027['transfereeuniqueid']][_0x325a('0xb3')]=_0x4f9027[_0x325a('0xbc')];this[_0x325a('0x1c')][_0x4f9027[_0x325a('0xb2')]]['transferconnectedlinenum']=_0x4f9027[_0x325a('0xbe')];this[_0x325a('0x1c')][_0x4f9027[_0x325a('0xb2')]][_0x325a('0xa0')]=_0x325a('0xbf');this['syncHangup']({'event':_0x325a('0xab'),'uniqueid':_0x4f9027['transfereeuniqueid'],'context':_0x4f9027['context'],'channel':_0x4f9027['transfererchannel']});}else{this[_0x325a('0x1c')][_0x4f9027[_0x325a('0xc0')]][_0x325a('0xa0')]=_0x325a('0xbf');}}}catch(_0x166780){logger[_0x325a('0x33')](_0x325a('0xc1'),_0x4f9027['uniqueid'],util['inspect'](_0x166780,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x14c80d){try{if(this[_0x325a('0x36')](_0x14c80d)){logger[_0x325a('0x3d')](_0x325a('0xc2'),_0x14c80d[_0x325a('0x3f')],util[_0x325a('0x35')](_0x14c80d,{'showHidden':![],'depth':null}));if(this[_0x325a('0x1c')][_0x14c80d[_0x325a('0x3f')]]){if(!_['isNil'](this['channels'][_0x14c80d[_0x325a('0x3f')]][_0x325a('0x6b')])){this[_0x325a('0x1c')][_0x14c80d[_0x325a('0x3f')]][_0x325a('0xc3')]=moment()[_0x325a('0x49')](_0x325a('0x4a'));logger[_0x325a('0x31')](_0x325a('0xc4'),_0x14c80d[_0x325a('0x3f')],this[_0x325a('0x1c')][_0x14c80d[_0x325a('0x3f')]][_0x325a('0xc3')]);}}}}catch(_0x1bdffc){logger['error'](_0x325a('0xc5'),_0x14c80d[_0x325a('0x3f')],util[_0x325a('0x35')](_0x1bdffc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x325a('0x38')][_0x325a('0x30')]=function(_0x5b9c59){try{if(this[_0x325a('0x36')](_0x5b9c59)){logger['debug'](_0x325a('0xc6'),_0x5b9c59[_0x325a('0x3f')],util[_0x325a('0x35')](_0x5b9c59,{'showHidden':![],'depth':null}));if(this[_0x325a('0x1c')][_0x5b9c59[_0x325a('0x3f')]]){if(!_['isNil'](this[_0x325a('0x1c')][_0x5b9c59[_0x325a('0x3f')]][_0x325a('0xc3')])){this['channels'][_0x5b9c59[_0x325a('0x3f')]]['mohtime']+=moment()[_0x325a('0xc7')](0x0)[_0x325a('0x6d')](this['channels'][_0x5b9c59[_0x325a('0x3f')]][_0x325a('0xc3')],_0x325a('0x5e'));logger['info'](_0x325a('0xc8'),_0x5b9c59[_0x325a('0x3f')],this[_0x325a('0x1c')][_0x5b9c59[_0x325a('0x3f')]][_0x325a('0xc9')]);delete this['channels'][_0x5b9c59['uniqueid']][_0x325a('0xc3')];}}}}catch(_0x2a70b2){logger[_0x325a('0x33')](_0x325a('0xca'),_0x5b9c59[_0x325a('0x3f')],util[_0x325a('0x35')](_0x2a70b2,{'showHidden':![],'depth':null}));}};module[_0x325a('0xcb')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 774cee0..43d7dc5 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c8b=['endtime','diff','starttime','seconds','complete','total','answered','sumHoldTime','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice:outbound','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','linkedid','destuniqueid','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','dialbegin','bind','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','called','channel','substring','lastIndexOf','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','isUndefined','variables','outboundrouteid','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','YYYY-MM-DD\x20HH:mm:ss','duration'];(function(_0x37a040,_0x156b07){var _0x16a4b5=function(_0x5c3352){while(--_0x5c3352){_0x37a040['push'](_0x37a040['shift']());}};_0x16a4b5(++_0x156b07);}(_0x0c8b,0x150));var _0xb0c8=function(_0x2731f0,_0x126b1b){_0x2731f0=_0x2731f0-0x0;var _0x36a180=_0x0c8b[_0x2731f0];return _0x36a180;};'use strict';var _=require(_0xb0c8('0x0'));var moment=require(_0xb0c8('0x1'));var util=require(_0xb0c8('0x2'));var Redis=require(_0xb0c8('0x3'));var config=require(_0xb0c8('0x4'));var logger=require(_0xb0c8('0x5'))(_0xb0c8('0x6'));var ami=require(_0xb0c8('0x7'));config[_0xb0c8('0x8')]=_[_0xb0c8('0x9')](config[_0xb0c8('0x8')],{'host':_0xb0c8('0xa'),'port':0x18eb});var io=require(_0xb0c8('0xb'))(new Redis(config[_0xb0c8('0x8')]));function VoiceDialReport(_0x5176b0){this[_0xb0c8('0xc')]=_0x5176b0[_0xb0c8('0xd')];this[_0xb0c8('0xe')]=_0x5176b0[_0xb0c8('0xe')];this['variables']={};ami['on'](_0xb0c8('0xf'),this['syncDialBegin']['bind'](this));ami['on']('dialend',this['syncDialEnd'][_0xb0c8('0x10')](this));ami['on'](_0xb0c8('0x11'),this[_0xb0c8('0x12')][_0xb0c8('0x10')](this));ami['on'](_0xb0c8('0x13'),this[_0xb0c8('0x14')][_0xb0c8('0x10')](this));}VoiceDialReport[_0xb0c8('0x15')][_0xb0c8('0x16')]=function(_0x43ab83){return _0x43ab83!==null&&!_['isUndefined'](_0x43ab83);};VoiceDialReport['prototype']['emit']=function(_0x11ed1b,_0x527906,_0x39c5ac){io['to'](_0x11ed1b)[_0xb0c8('0x17')](_0x527906,_0x39c5ac);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x2fa591){try{if(this[_0xb0c8('0x16')](_0x2fa591)){logger['debug'](_0xb0c8('0x18'),_0x2fa591[_0xb0c8('0x19')],util[_0xb0c8('0x1a')](_0x2fa591,{'showHidden':![],'depth':null}));if(this['channels'][_0x2fa591[_0xb0c8('0x19')]]){_['merge'](this['channels'][_0x2fa591[_0xb0c8('0x19')]],{'starttime':moment()[_0xb0c8('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xb0c8('0x1c'),'interface':_0x2fa591[_0xb0c8('0x1d')][_0xb0c8('0x1e')](0x0,_0x2fa591['channel'][_0xb0c8('0x1f')]('-')),'membername':_0x2fa591[_0xb0c8('0x1d')][_0xb0c8('0x1e')](_0x2fa591['channel'][_0xb0c8('0x1f')]('/')+0x1,_0x2fa591[_0xb0c8('0x1d')]['lastIndexOf']('-'))},_['omit'](_0x2fa591,['event','privilege']));logger['info'](_0xb0c8('0x20'),_0x2fa591['uniqueid'],this[_0xb0c8('0xc')][_0x2fa591['uniqueid']]['membername'],this[_0xb0c8('0xc')][_0x2fa591[_0xb0c8('0x19')]]['interface']);logger[_0xb0c8('0x21')](_0xb0c8('0x22'),_0x2fa591[_0xb0c8('0x19')],util[_0xb0c8('0x1a')](this[_0xb0c8('0xc')][_0x2fa591['uniqueid']],{'showHidden':![],'depth':null}));this[_0xb0c8('0x17')]('voice:outbound',_0xb0c8('0x23'),this[_0xb0c8('0xc')][_0x2fa591[_0xb0c8('0x19')]]);logger[_0xb0c8('0x21')](_0xb0c8('0x24'),_0x2fa591[_0xb0c8('0x19')],util[_0xb0c8('0x1a')](this['channels'][_0x2fa591[_0xb0c8('0x19')]],{'showHidden':![],'depth':null}));ami[_0xb0c8('0x17')](_0xb0c8('0x25'),this[_0xb0c8('0xc')][_0x2fa591[_0xb0c8('0x19')]]);}}}catch(_0x1d798f){logger[_0xb0c8('0x26')](_0xb0c8('0x27'),_0x2fa591['uniqueid'],util[_0xb0c8('0x1a')](_0x1d798f,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xb0c8('0x28')]=function(_0x3df4a6){try{if(this[_0xb0c8('0x16')](_0x3df4a6)){logger['debug'](_0xb0c8('0x29'),_0x3df4a6[_0xb0c8('0x19')],util[_0xb0c8('0x1a')](_0x3df4a6,{'showHidden':![],'depth':null}));if(this[_0xb0c8('0xc')][_0x3df4a6[_0xb0c8('0x19')]]){this[_0xb0c8('0xc')][_0x3df4a6[_0xb0c8('0x19')]][_0xb0c8('0x2a')]=_0x3df4a6[_0xb0c8('0x2a')];if(_0x3df4a6[_0xb0c8('0x2a')]===_0xb0c8('0x2b')){this[_0xb0c8('0xc')][_0x3df4a6[_0xb0c8('0x19')]]['connectedlinenum']=_0x3df4a6[_0xb0c8('0x2c')];this['channels'][_0x3df4a6[_0xb0c8('0x19')]][_0xb0c8('0x2d')]=_0x3df4a6['connectedlinename'];this[_0xb0c8('0xc')][_0x3df4a6['uniqueid']][_0xb0c8('0x2e')]=moment()[_0xb0c8('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3df4a6[_0xb0c8('0x19')]][_0xb0c8('0x2f')]=_0xb0c8('0x30');logger[_0xb0c8('0x31')](_0xb0c8('0x32'),_0x3df4a6[_0xb0c8('0x19')],_0x3df4a6[_0xb0c8('0x1d')][_0xb0c8('0x1e')](_0x3df4a6['channel']['lastIndexOf']('/')+0x1,_0x3df4a6[_0xb0c8('0x1d')][_0xb0c8('0x1f')]('-')));logger[_0xb0c8('0x21')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x3df4a6[_0xb0c8('0x19')],util[_0xb0c8('0x1a')](this['channels'][_0x3df4a6[_0xb0c8('0x19')]],{'showHidden':![],'depth':null}));ami[_0xb0c8('0x17')](_0xb0c8('0x33'),this[_0xb0c8('0xc')][_0x3df4a6[_0xb0c8('0x19')]]);}logger['debug'](_0xb0c8('0x34'),_0x3df4a6[_0xb0c8('0x19')],util[_0xb0c8('0x1a')](this[_0xb0c8('0xc')][_0x3df4a6[_0xb0c8('0x19')]],{'showHidden':![],'depth':null}));this[_0xb0c8('0x17')]('voice:outbound',_0xb0c8('0x23'),this['channels'][_0x3df4a6[_0xb0c8('0x19')]]);}}}catch(_0x3a54c6){logger[_0xb0c8('0x26')](_0xb0c8('0x35'),_0x3df4a6[_0xb0c8('0x19')],util['inspect'](_0x3a54c6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb0c8('0x15')]['syncVarSet']=function(_0x5c1812){try{if(this[_0xb0c8('0x16')](_0x5c1812)){logger[_0xb0c8('0x21')](_0xb0c8('0x36'),_0x5c1812[_0xb0c8('0x19')],util[_0xb0c8('0x1a')](_0x5c1812,{'showHidden':![],'depth':null}));this[_0xb0c8('0x37')](_0x5c1812[_0xb0c8('0x19')],_['keys'](_0x5c1812[_0xb0c8('0x38')])[0x0],_0x5c1812[_0xb0c8('0x39')]);if(this[_0xb0c8('0x16')](_0x5c1812['variable'])&&this[_0xb0c8('0x16')](_0x5c1812['variable']['outboundrouteid'])){if(_[_0xb0c8('0x3a')](this[_0xb0c8('0xc')][_0x5c1812[_0xb0c8('0x19')]])){this[_0xb0c8('0xc')][_0x5c1812['uniqueid']]={'routeId':_0x5c1812[_0xb0c8('0x39')],'variables':this[_0xb0c8('0x3b')][_0x5c1812['uniqueid']]};logger[_0xb0c8('0x31')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x5c1812[_0xb0c8('0x19')],_0x5c1812['variable'][_0xb0c8('0x3c')],_[_0xb0c8('0x3d')](_0x5c1812[_0xb0c8('0x38')])[0x0],_0x5c1812[_0xb0c8('0x39')]);logger['debug'](_0xb0c8('0x3e'),_0x5c1812[_0xb0c8('0x19')],util['inspect'](this[_0xb0c8('0xc')][_0x5c1812[_0xb0c8('0x19')]],{'showHidden':![],'depth':null}));this[_0xb0c8('0x17')]('voice:outbound','voice_outbound_channel:save',this[_0xb0c8('0xc')][_0x5c1812['uniqueid']]);}}}}catch(_0x2a83c8){logger['error'](_0xb0c8('0x3f'),_0x5c1812[_0xb0c8('0x19')],util[_0xb0c8('0x1a')](_0x2a83c8,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xb0c8('0x37')]=function(_0x502618,_0x5f1725,_0xb73ad0){var _0x4f9769=[_0xb0c8('0x40'),_0xb0c8('0x41'),_0xb0c8('0x42'),'rtpaudioqosjitterbridged',_0xb0c8('0x43'),_0xb0c8('0x44'),_0xb0c8('0x45'),'rtpaudioqosrttbridged',_0xb0c8('0x46'),_0xb0c8('0x47'),_0xb0c8('0x48'),_0xb0c8('0x49'),_0xb0c8('0x4a'),_0xb0c8('0x4b'),_0xb0c8('0x4c'),_0xb0c8('0x4d'),_0xb0c8('0x4e'),_0xb0c8('0x4f'),_0xb0c8('0x50')];if(!_[_0xb0c8('0x51')](_0x5f1725)&&!_[_0xb0c8('0x52')](_0x4f9769,_0x5f1725)){if(_[_0xb0c8('0x3a')](this['variables'][_0x502618])){this[_0xb0c8('0x3b')][_0x502618]={};}this['variables'][_0x502618][_0x5f1725]=_0xb73ad0;}};VoiceDialReport[_0xb0c8('0x15')][_0xb0c8('0x14')]=function(_0x47646){try{if(this[_0xb0c8('0x16')](_0x47646)){logger[_0xb0c8('0x21')](_0xb0c8('0x53'),_0x47646[_0xb0c8('0x19')],util[_0xb0c8('0x1a')](_0x47646,{'showHidden':![],'depth':null}));if(this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x19')]]){logger[_0xb0c8('0x31')](_0xb0c8('0x54'),_0x47646['uniqueid'],_0x47646[_0xb0c8('0x55')]);this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x19')]]['endtime']=moment()[_0xb0c8('0x1b')](_0xb0c8('0x56'));this[_0xb0c8('0xc')][_0x47646['uniqueid']][_0xb0c8('0x57')]=moment(this[_0xb0c8('0xc')][_0x47646['uniqueid']][_0xb0c8('0x58')])[_0xb0c8('0x59')](this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x19')]][_0xb0c8('0x5a')],_0xb0c8('0x5b'));this[_0xb0c8('0xc')][_0x47646['uniqueid']][_0xb0c8('0x2f')]=_0xb0c8('0x5c');this[_0xb0c8('0xe')][_0xb0c8('0x5d')]+=0x1;if(this['channels'][_0x47646[_0xb0c8('0x19')]][_0xb0c8('0x2e')]){this[_0xb0c8('0xe')][_0xb0c8('0x5e')]+=0x1;this['channels'][_0x47646['uniqueid']]['holdtime']=moment(this['channels'][_0x47646[_0xb0c8('0x19')]][_0xb0c8('0x2e')])[_0xb0c8('0x59')](this['channels'][_0x47646[_0xb0c8('0x19')]]['starttime'],_0xb0c8('0x5b'));this['channels'][_0x47646[_0xb0c8('0x19')]]['billableseconds']=moment(this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x19')]][_0xb0c8('0x58')])[_0xb0c8('0x59')](this['channels'][_0x47646[_0xb0c8('0x19')]][_0xb0c8('0x2e')],_0xb0c8('0x5b'));this['outbound'][_0xb0c8('0x5f')]+=this[_0xb0c8('0xc')][_0x47646['uniqueid']]['holdtime']||0x0;this['outbound']['sumBillable']+=this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x19')]][_0xb0c8('0x60')];}this[_0xb0c8('0xe')][_0xb0c8('0x61')]+=this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x19')]]['duration'];logger['debug'](_0xb0c8('0x62'),_0x47646[_0xb0c8('0x19')],util[_0xb0c8('0x1a')](this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x19')]],{'showHidden':![],'depth':null}));ami[_0xb0c8('0x17')](_0xb0c8('0x63'),this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x19')]]);logger[_0xb0c8('0x21')](_0xb0c8('0x64'),_0x47646[_0xb0c8('0x19')],util[_0xb0c8('0x1a')](this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x19')]],{'showHidden':![],'depth':null}));ami[_0xb0c8('0x17')]('custom:dialend',this[_0xb0c8('0xc')][_0x47646['uniqueid']]);logger[_0xb0c8('0x21')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x47646[_0xb0c8('0x19')],util[_0xb0c8('0x1a')](this['channels'][_0x47646[_0xb0c8('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0xb0c8('0x65'),_0xb0c8('0x66'),this[_0xb0c8('0xe')]);logger['info'](_0xb0c8('0x67'),JSON['stringify'](this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x19')]]));logger[_0xb0c8('0x21')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x47646[_0xb0c8('0x19')],util[_0xb0c8('0x1a')](this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x19')]],{'showHidden':![],'depth':null}));this[_0xb0c8('0x17')](_0xb0c8('0x65'),'voice_outbound_channel:remove',this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x19')]]);delete this[_0xb0c8('0xc')][_0x47646['uniqueid']];}else if(this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x68')]]){this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x68')]][_0xb0c8('0x19')]=this[_0xb0c8('0xc')][_0x47646[_0xb0c8('0x68')]][_0xb0c8('0x69')];}if(this['variables'][_0x47646[_0xb0c8('0x19')]]){delete this[_0xb0c8('0x3b')][_0x47646[_0xb0c8('0x19')]];}}}catch(_0x3a8559){logger[_0xb0c8('0x26')]('[%s][voiceDialReport][hangup]',_0x47646['uniqueid'],util[_0xb0c8('0x1a')](_0x3a8559,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x16f9=['../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','outboundChannels','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','inspect','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','value','variable','info','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','membercalls','memberdynamic','memberlastcall','memberpenalty','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','total','answertime','answered','outbound','sumHoldTime','holdtime','sumBillable','billableseconds','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice:outbound','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','ioredis','../../../config/environment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x16f9,0x1f4));var _0x916f=function(_0x45e0e2,_0x155314){_0x45e0e2=_0x45e0e2-0x0;var _0xa519a2=_0x16f9[_0x45e0e2];return _0xa519a2;};'use strict';var _=require(_0x916f('0x0'));var moment=require(_0x916f('0x1'));var util=require(_0x916f('0x2'));var Redis=require(_0x916f('0x3'));var config=require(_0x916f('0x4'));var logger=require(_0x916f('0x5'))(_0x916f('0x6'));var ami=require(_0x916f('0x7'));config['redis']=_[_0x916f('0x8')](config[_0x916f('0x9')],{'host':_0x916f('0xa'),'port':0x18eb});var io=require(_0x916f('0xb'))(new Redis(config['redis']));function VoiceDialReport(_0xb03aed){this[_0x916f('0xc')]=_0xb03aed[_0x916f('0xd')];this['outbound']=_0xb03aed['outbound'];this[_0x916f('0xe')]={};ami['on'](_0x916f('0xf'),this[_0x916f('0x10')][_0x916f('0x11')](this));ami['on'](_0x916f('0x12'),this[_0x916f('0x13')][_0x916f('0x11')](this));ami['on']('varset',this[_0x916f('0x14')][_0x916f('0x11')](this));ami['on']('hangup',this[_0x916f('0x15')][_0x916f('0x11')](this));}VoiceDialReport[_0x916f('0x16')][_0x916f('0x17')]=function(_0x25d67a){return _0x25d67a!==null&&!_[_0x916f('0x18')](_0x25d67a);};VoiceDialReport[_0x916f('0x16')][_0x916f('0x19')]=function(_0x306a0f,_0x584111,_0x98673e){io['to'](_0x306a0f)[_0x916f('0x19')](_0x584111,_0x98673e);};VoiceDialReport[_0x916f('0x16')][_0x916f('0x10')]=function(_0x5f1a35){try{if(this[_0x916f('0x17')](_0x5f1a35)){logger[_0x916f('0x1a')](_0x916f('0x1b'),_0x5f1a35[_0x916f('0x1c')],util['inspect'](_0x5f1a35,{'showHidden':![],'depth':null}));if(this['channels'][_0x5f1a35[_0x916f('0x1c')]]){_[_0x916f('0x1d')](this[_0x916f('0xc')][_0x5f1a35['uniqueid']],{'starttime':moment()[_0x916f('0x1e')](_0x916f('0x1f')),'lastevent':'called','interface':_0x5f1a35[_0x916f('0x20')][_0x916f('0x21')](0x0,_0x5f1a35[_0x916f('0x20')][_0x916f('0x22')]('-')),'membername':_0x5f1a35[_0x916f('0x20')][_0x916f('0x21')](_0x5f1a35['channel'][_0x916f('0x22')]('/')+0x1,_0x5f1a35[_0x916f('0x20')][_0x916f('0x22')]('-'))},_[_0x916f('0x23')](_0x5f1a35,[_0x916f('0x24'),_0x916f('0x25')]));logger['info'](_0x916f('0x26'),_0x5f1a35[_0x916f('0x1c')],this[_0x916f('0xc')][_0x5f1a35[_0x916f('0x1c')]][_0x916f('0x27')],this[_0x916f('0xc')][_0x5f1a35['uniqueid']]['interface']);logger[_0x916f('0x1a')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x5f1a35[_0x916f('0x1c')],util[_0x916f('0x28')](this['channels'][_0x5f1a35['uniqueid']],{'showHidden':![],'depth':null}));this[_0x916f('0x19')]('voice:outbound',_0x916f('0x29'),this[_0x916f('0xc')][_0x5f1a35[_0x916f('0x1c')]]);logger[_0x916f('0x1a')](_0x916f('0x2a'),_0x5f1a35['uniqueid'],util[_0x916f('0x28')](this[_0x916f('0xc')][_0x5f1a35[_0x916f('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x916f('0x19')](_0x916f('0x2b'),this[_0x916f('0xc')][_0x5f1a35[_0x916f('0x1c')]]);}}}catch(_0x209ce4){logger[_0x916f('0x2c')]('[%s][voiceDialReport][dialbegin]',_0x5f1a35[_0x916f('0x1c')],util[_0x916f('0x28')](_0x209ce4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x916f('0x16')]['syncDialEnd']=function(_0x1a57b6){try{if(this[_0x916f('0x17')](_0x1a57b6)){logger[_0x916f('0x1a')](_0x916f('0x2d'),_0x1a57b6['uniqueid'],util['inspect'](_0x1a57b6,{'showHidden':![],'depth':null}));if(this[_0x916f('0xc')][_0x1a57b6[_0x916f('0x1c')]]){this['channels'][_0x1a57b6['uniqueid']][_0x916f('0x2e')]=_0x1a57b6[_0x916f('0x2e')];if(_0x1a57b6[_0x916f('0x2e')]===_0x916f('0x2f')){this['channels'][_0x1a57b6[_0x916f('0x1c')]][_0x916f('0x30')]=_0x1a57b6[_0x916f('0x30')];this['channels'][_0x1a57b6['uniqueid']]['connectedlinename']=_0x1a57b6[_0x916f('0x31')];this[_0x916f('0xc')][_0x1a57b6['uniqueid']]['answertime']=moment()[_0x916f('0x1e')](_0x916f('0x1f'));this[_0x916f('0xc')][_0x1a57b6[_0x916f('0x1c')]][_0x916f('0x32')]='connect';logger['info'](_0x916f('0x33'),_0x1a57b6[_0x916f('0x1c')],_0x1a57b6[_0x916f('0x20')]['substring'](_0x1a57b6[_0x916f('0x20')][_0x916f('0x22')]('/')+0x1,_0x1a57b6[_0x916f('0x20')][_0x916f('0x22')]('-')));logger[_0x916f('0x1a')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x1a57b6[_0x916f('0x1c')],util[_0x916f('0x28')](this[_0x916f('0xc')][_0x1a57b6['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x916f('0x19')](_0x916f('0x34'),this[_0x916f('0xc')][_0x1a57b6[_0x916f('0x1c')]]);}logger[_0x916f('0x1a')](_0x916f('0x35'),_0x1a57b6[_0x916f('0x1c')],util['inspect'](this['channels'][_0x1a57b6[_0x916f('0x1c')]],{'showHidden':![],'depth':null}));this[_0x916f('0x19')]('voice:outbound','voice_outbound_channel:save',this['channels'][_0x1a57b6[_0x916f('0x1c')]]);}}}catch(_0x1cff42){logger[_0x916f('0x2c')](_0x916f('0x36'),_0x1a57b6[_0x916f('0x1c')],util['inspect'](_0x1cff42,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x916f('0x14')]=function(_0x1518ff){try{if(this[_0x916f('0x17')](_0x1518ff)){logger['debug'](_0x916f('0x37'),_0x1518ff[_0x916f('0x1c')],util[_0x916f('0x28')](_0x1518ff,{'showHidden':![],'depth':null}));this['addVariable'](_0x1518ff[_0x916f('0x1c')],_[_0x916f('0x38')](_0x1518ff['variable'])[0x0],_0x1518ff[_0x916f('0x39')]);if(this['isNotNull'](_0x1518ff[_0x916f('0x3a')])&&this[_0x916f('0x17')](_0x1518ff[_0x916f('0x3a')]['outboundrouteid'])){if(_[_0x916f('0x18')](this[_0x916f('0xc')][_0x1518ff[_0x916f('0x1c')]])){this[_0x916f('0xc')][_0x1518ff[_0x916f('0x1c')]]={'routeId':_0x1518ff[_0x916f('0x39')],'variables':this[_0x916f('0xe')][_0x1518ff[_0x916f('0x1c')]]};logger[_0x916f('0x3b')](_0x916f('0x3c'),_0x1518ff[_0x916f('0x1c')],_0x1518ff[_0x916f('0x3a')][_0x916f('0x3d')],_[_0x916f('0x38')](_0x1518ff[_0x916f('0x3a')])[0x0],_0x1518ff[_0x916f('0x39')]);logger[_0x916f('0x1a')](_0x916f('0x3e'),_0x1518ff[_0x916f('0x1c')],util[_0x916f('0x28')](this[_0x916f('0xc')][_0x1518ff[_0x916f('0x1c')]],{'showHidden':![],'depth':null}));this[_0x916f('0x19')]('voice:outbound',_0x916f('0x29'),this[_0x916f('0xc')][_0x1518ff[_0x916f('0x1c')]]);}}}}catch(_0x27eeb9){logger[_0x916f('0x2c')]('[%s][voiceDialReport][varset]',_0x1518ff[_0x916f('0x1c')],util['inspect'](_0x27eeb9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x916f('0x16')]['addVariable']=function(_0x5f10cf,_0x4b98eb,_0x4635dd){var _0x34a690=[_0x916f('0x3f'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x916f('0x40'),_0x916f('0x41'),_0x916f('0x42'),_0x916f('0x43'),_0x916f('0x44'),'sipcallid','sipuri',_0x916f('0x45'),'bridgepvtcallid',_0x916f('0x46'),_0x916f('0x47'),'memberinterface',_0x916f('0x48'),_0x916f('0x27'),_0x916f('0x49'),'memberrealtime'];if(!_[_0x916f('0x4a')](_0x4b98eb)&&!_[_0x916f('0x4b')](_0x34a690,_0x4b98eb)){if(_['isUndefined'](this[_0x916f('0xe')][_0x5f10cf])){this[_0x916f('0xe')][_0x5f10cf]={};}this[_0x916f('0xe')][_0x5f10cf][_0x4b98eb]=_0x4635dd;}};VoiceDialReport[_0x916f('0x16')][_0x916f('0x15')]=function(_0x10f861){try{if(this[_0x916f('0x17')](_0x10f861)){logger[_0x916f('0x1a')]('[%s][voiceDialReport][hangup]\x20event:',_0x10f861[_0x916f('0x1c')],util['inspect'](_0x10f861,{'showHidden':![],'depth':null}));if(this['channels'][_0x10f861[_0x916f('0x1c')]]){logger['info'](_0x916f('0x4c'),_0x10f861[_0x916f('0x1c')],_0x10f861[_0x916f('0x4d')]);this['channels'][_0x10f861['uniqueid']][_0x916f('0x4e')]=moment()['format'](_0x916f('0x1f'));this['channels'][_0x10f861['uniqueid']][_0x916f('0x4f')]=moment(this[_0x916f('0xc')][_0x10f861[_0x916f('0x1c')]][_0x916f('0x4e')])[_0x916f('0x50')](this[_0x916f('0xc')][_0x10f861['uniqueid']][_0x916f('0x51')],_0x916f('0x52'));this[_0x916f('0xc')][_0x10f861['uniqueid']]['lastevent']='complete';this['outbound'][_0x916f('0x53')]+=0x1;if(this[_0x916f('0xc')][_0x10f861[_0x916f('0x1c')]][_0x916f('0x54')]){this['outbound'][_0x916f('0x55')]+=0x1;this[_0x916f('0xc')][_0x10f861[_0x916f('0x1c')]]['holdtime']=moment(this['channels'][_0x10f861[_0x916f('0x1c')]][_0x916f('0x54')])[_0x916f('0x50')](this[_0x916f('0xc')][_0x10f861['uniqueid']][_0x916f('0x51')],'seconds');this[_0x916f('0xc')][_0x10f861['uniqueid']]['billableseconds']=moment(this[_0x916f('0xc')][_0x10f861[_0x916f('0x1c')]]['endtime'])[_0x916f('0x50')](this[_0x916f('0xc')][_0x10f861[_0x916f('0x1c')]]['answertime'],_0x916f('0x52'));this[_0x916f('0x56')][_0x916f('0x57')]+=this[_0x916f('0xc')][_0x10f861[_0x916f('0x1c')]][_0x916f('0x58')]||0x0;this['outbound'][_0x916f('0x59')]+=this[_0x916f('0xc')][_0x10f861[_0x916f('0x1c')]][_0x916f('0x5a')];}this['outbound']['sumDuration']+=this[_0x916f('0xc')][_0x10f861[_0x916f('0x1c')]][_0x916f('0x4f')];logger[_0x916f('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x10f861[_0x916f('0x1c')],util[_0x916f('0x28')](this['channels'][_0x10f861[_0x916f('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x916f('0x19')](_0x916f('0x5b'),this[_0x916f('0xc')][_0x10f861[_0x916f('0x1c')]]);logger[_0x916f('0x1a')](_0x916f('0x5c'),_0x10f861[_0x916f('0x1c')],util['inspect'](this['channels'][_0x10f861[_0x916f('0x1c')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this['channels'][_0x10f861[_0x916f('0x1c')]]);logger[_0x916f('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x10f861[_0x916f('0x1c')],util[_0x916f('0x28')](this[_0x916f('0xc')][_0x10f861['uniqueid']],{'showHidden':![],'depth':null}));this[_0x916f('0x19')](_0x916f('0x5d'),_0x916f('0x5e'),this[_0x916f('0x56')]);logger['info'](_0x916f('0x5f'),JSON['stringify'](this[_0x916f('0xc')][_0x10f861['uniqueid']]));logger[_0x916f('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x10f861[_0x916f('0x1c')],util[_0x916f('0x28')](this[_0x916f('0xc')][_0x10f861[_0x916f('0x1c')]],{'showHidden':![],'depth':null}));this[_0x916f('0x19')](_0x916f('0x5d'),_0x916f('0x60'),this[_0x916f('0xc')][_0x10f861['uniqueid']]);delete this[_0x916f('0xc')][_0x10f861[_0x916f('0x1c')]];}else if(this['channels'][_0x10f861[_0x916f('0x61')]]){this['channels'][_0x10f861[_0x916f('0x61')]][_0x916f('0x1c')]=this[_0x916f('0xc')][_0x10f861[_0x916f('0x61')]][_0x916f('0x62')];}if(this[_0x916f('0xe')][_0x10f861[_0x916f('0x1c')]]){delete this[_0x916f('0xe')][_0x10f861['uniqueid']];}}}catch(_0x2ca678){logger[_0x916f('0x2c')](_0x916f('0x63'),_0x10f861['uniqueid'],util['inspect'](_0x2ca678,{'showHidden':![],'depth':null}));}};module[_0x916f('0x64')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 6bdbfb2..60dbd86 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7117=['rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceQueueReport][hangup]','diff','length','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','lastevent','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','transfertype','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','util','md5','../../../config/environment','../../../config/logger','../ami','redis','defaults','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','prototype','clearZombieChannels','switch','Action','channel','catch','error','[%s][voiceQueueReport][checkQueueReport]','inspect','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','name','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','format','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','answered','available','sumBillable','sumDuration','total','unmanaged','abandoned','Trunk','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','queues','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','syncQueueSummary','[voiceQueueReport][queuesummary]\x20event:','queue','info','countBy','toNumber','loggedIn','loggedin','callers','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','emitVoiceQueueChannelSave','queuecallerjoin','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','syncAgentConnect','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerjoinAt','add','seconds','FORWARDTRANSFER','FORWARD','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','variable','value','TIMEOUT','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos'];(function(_0x5df076,_0x592792){var _0x4760e4=function(_0x40ff59){while(--_0x40ff59){_0x5df076['push'](_0x5df076['shift']());}};_0x4760e4(++_0x592792);}(_0x7117,0x1ec));var _0x7711=function(_0x56bdd8,_0x42f27e){_0x56bdd8=_0x56bdd8-0x0;var _0x100920=_0x7117[_0x56bdd8];return _0x100920;};'use strict';var _=require(_0x7711('0x0'));var moment=require(_0x7711('0x1'));var util=require(_0x7711('0x2'));var md5=require(_0x7711('0x3'));var Redis=require('ioredis');var config=require(_0x7711('0x4'));var logger=require(_0x7711('0x5'))('ami');var ami=require(_0x7711('0x6'));var QueueReport=require('../model/queueReport');config[_0x7711('0x7')]=_[_0x7711('0x8')](config[_0x7711('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0x7711('0x9')]=function(_0xb9cae4){this[_0x7711('0xa')]=this[_0x7711('0xa')]?this['tail'][_0x7711('0xb')](_0xb9cae4):_0xb9cae4();};function VoiceQueueReport(_0x33057b){this[_0x7711('0xc')]=new Sequence();this[_0x7711('0xd')]={};this[_0x7711('0xe')]=_0x33057b['agents'];this[_0x7711('0xf')]=_0x33057b[_0x7711('0x10')];this['voiceQueues']=_0x33057b[_0x7711('0x11')];this[_0x7711('0x12')]=!![];this[_0x7711('0x13')]=_0x33057b[_0x7711('0x13')];this[_0x7711('0x14')]={};ami['on'](_0x7711('0x15'),this['syncQueueSummary'][_0x7711('0x16')](this));ami['on'](_0x7711('0x17'),this[_0x7711('0x18')][_0x7711('0x16')](this));ami['on']('queuecallerjoin',this[_0x7711('0x19')][_0x7711('0x16')](this));ami['on'](_0x7711('0x1a'),this[_0x7711('0x1b')][_0x7711('0x16')](this));ami['on'](_0x7711('0x1c'),this[_0x7711('0x1d')][_0x7711('0x16')](this));ami['on'](_0x7711('0x1e'),this[_0x7711('0x1f')]['bind'](this));ami['on'](_0x7711('0x20'),this['syncAgentConnect'][_0x7711('0x16')](this));ami['on'](_0x7711('0x21'),this[_0x7711('0x22')][_0x7711('0x16')](this));ami['on'](_0x7711('0x23'),this[_0x7711('0x24')][_0x7711('0x16')](this));ami['on'](_0x7711('0x25'),this[_0x7711('0x26')][_0x7711('0x16')](this));ami['on'](_0x7711('0x27'),this[_0x7711('0x28')][_0x7711('0x16')](this));ami['on']('musiconholdstop',this[_0x7711('0x29')]['bind'](this));ami['on'](_0x7711('0x2a'),this[_0x7711('0x2b')][_0x7711('0x16')](this));ami['on'](_0x7711('0x2c'),this[_0x7711('0x2d')][_0x7711('0x16')](this));this[_0x7711('0x2e')]();this[_0x7711('0x2f')]();}function clearChannels(_0xabd84a){if(!_[_0x7711('0x30')](_0xabd84a)){for(var _0x2f9657 in _0xabd84a){if(_0xabd84a[_0x7711('0x31')](_0x2f9657)){delete _0xabd84a[_0x2f9657];}}}}function clearCampaigns(_0xb2a5aa){if(!_[_0x7711('0x30')](_0xb2a5aa)){for(var _0x460330 in _0xb2a5aa){if(_0xb2a5aa[_0x7711('0x31')](_0x460330)){_0xb2a5aa[_0x460330][_0x7711('0x32')]=0x0;}}}}function clearVoiceQueues(_0x2b1afe){if(!_[_0x7711('0x30')](_0x2b1afe)){for(var _0x447f33 in _0x2b1afe){if(_0x2b1afe[_0x7711('0x31')](_0x447f33)){_0x2b1afe[_0x447f33][_0x7711('0x32')]=0x0;_0x2b1afe[_0x447f33][_0x7711('0x33')]=0x0;_0x2b1afe[_0x447f33][_0x7711('0x34')]=0x0;_0x2b1afe[_0x447f33][_0x7711('0x35')]=0x0;_0x2b1afe[_0x447f33][_0x7711('0x36')]=!![];}}}}function clearAgentBooked(_0x4d1fd9){if(!_[_0x7711('0x30')](_0x4d1fd9)){for(var _0x2873e8 in _0x4d1fd9){if(_0x4d1fd9['hasOwnProperty'](_0x2873e8)){_0x4d1fd9[_0x2873e8]['unlockRR']=!![];}}}}VoiceQueueReport[_0x7711('0x37')][_0x7711('0x38')]=function(){var _0x5012cc=this;for(var _0x5ad2f0 in this[_0x7711('0xf')]){if(this['channels'][_0x7711('0x31')](_0x5ad2f0)&&!this[_0x7711('0xf')][_0x5ad2f0][_0x7711('0x39')]){this[_0x7711('0xc')][_0x7711('0x9')](function(){if(!_['isNil'](_0x5012cc['channels'][_0x5ad2f0])){return ami[_0x7711('0x3a')]({'action':'status','channel':_0x5012cc[_0x7711('0xf')][_0x5ad2f0][_0x7711('0x3b')]})[_0x7711('0x3c')](function(_0x2eb9fc){if(_0x2eb9fc['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x5012cc['channels'][_0x5ad2f0]){delete _0x5012cc[_0x7711('0xf')][_0x5ad2f0];logger[_0x7711('0x3d')]('[%s][voiceQueueReport][checkChannel]',_0x5ad2f0,util['inspect'](_0x2eb9fc,{'showHidden':![],'depth':null}));}if(_0x5012cc[_0x7711('0xd')][_0x5ad2f0]){delete _0x5012cc[_0x7711('0xd')][_0x5ad2f0];logger[_0x7711('0x3d')](_0x7711('0x3e'),_0x5ad2f0,util[_0x7711('0x3f')](_0x2eb9fc,{'showHidden':![],'depth':null}));}if(_0x5012cc[_0x7711('0x14')][_0x5ad2f0]){delete _0x5012cc[_0x7711('0x14')][_0x5ad2f0];logger['error']('[%s][voiceQueueReport][checkVariables]',_0x5ad2f0,util[_0x7711('0x3f')](_0x2eb9fc,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger['error'](_0x7711('0x40'));clearChannels(this[_0x7711('0xf')]);this[_0x7711('0x41')](this['queueReports']);clearAgentBooked(this[_0x7711('0xe')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x7711('0x13')]);};VoiceQueueReport['prototype'][_0x7711('0x41')]=function(_0x224537){var _0x12a5bf=this;if(!_[_0x7711('0x30')](_0x224537)){for(var _0x5294d9 in _0x224537){if(_0x224537[_0x7711('0x31')](_0x5294d9)){_0x12a5bf[_0x7711('0x42')](_0x224537[_0x5294d9],_0x7711('0x43'));delete _0x224537[_0x5294d9];}}}};VoiceQueueReport[_0x7711('0x37')]['emit']=function(_0x2bd389,_0x49c045,_0x26d736){io['to'](_0x2bd389)[_0x7711('0x44')](_0x49c045,_0x26d736);};VoiceQueueReport[_0x7711('0x37')]['emitVoiceQueueChannelSave']=function(_0x388522,_0x54883c){logger[_0x7711('0x45')](_0x7711('0x46')+_0x54883c+_0x7711('0x47'),_0x388522[_0x7711('0x48')],util[_0x7711('0x3f')](_0x388522,{'showHidden':![],'depth':null}));this[_0x7711('0x44')](util['format'](_0x7711('0x49'),_0x388522[_0x7711('0x4a')]),_0x7711('0x4b'),_0x388522);io['emit']('voice_queue_presence:save',_0x388522);};VoiceQueueReport[_0x7711('0x37')]['emitVoiceQueueChannelRemove']=function(_0x40a69e,_0x3ab92b){logger['debug'](_0x7711('0x46')+_0x3ab92b+_0x7711('0x4c'),_0x40a69e[_0x7711('0x48')],util['inspect'](_0x40a69e,{'showHidden':![],'depth':null}));this[_0x7711('0x44')](util[_0x7711('0x4d')](_0x7711('0x49'),_0x40a69e[_0x7711('0x4a')]),'voice_queue_channel:remove',_0x40a69e);io[_0x7711('0x44')](_0x7711('0x4e'),_0x40a69e);};VoiceQueueReport[_0x7711('0x37')][_0x7711('0x4f')]=function(_0x31aaf9,_0x5c38aa){if(_0x31aaf9[_0x7711('0x50')]===_0x7711('0x51')){var _0xf58b52={'id':_0x31aaf9['id'],'name':_0x31aaf9[_0x7711('0x4a')],'strategy':_0x31aaf9['strategy'],'answered':_0x31aaf9[_0x7711('0x52')],'available':_0x31aaf9[_0x7711('0x53')],'loggedIn':_0x31aaf9['loggedIn'],'pTalking':_0x31aaf9[_0x7711('0x34')],'sumBillable':_0x31aaf9[_0x7711('0x54')],'sumDuration':_0x31aaf9[_0x7711('0x55')],'sumHoldTime':_0x31aaf9['sumHoldTime']||0x0,'talking':_0x31aaf9[_0x7711('0x33')],'total':_0x31aaf9[_0x7711('0x56')],'type':_0x31aaf9[_0x7711('0x50')],'unmanaged':_0x31aaf9[_0x7711('0x57')],'abandoned':_0x31aaf9[_0x7711('0x58')],'waiting':_0x31aaf9['waiting']};if(_0x31aaf9[_0x7711('0x59')]){_0xf58b52[_0x7711('0x59')]={'id':_0x31aaf9[_0x7711('0x59')]['id'],'name':_0x31aaf9[_0x7711('0x59')]['name'],'active':_0x31aaf9[_0x7711('0x59')]['active'],'callerid':_0x31aaf9[_0x7711('0x59')][_0x7711('0x5a')]};}if(_0x31aaf9[_0x7711('0x5b')]){_0xf58b52[_0x7711('0x5b')]={'id':_0x31aaf9[_0x7711('0x5b')]['id'],'name':_0x31aaf9[_0x7711('0x5b')][_0x7711('0x4a')]};}var _0x226578=md5(JSON[_0x7711('0x5c')](_0xf58b52));if(_0x31aaf9['md5']!==_0x226578){_0x31aaf9[_0x7711('0x3')]=_0x226578;logger['debug'](_0x7711('0x5d')+_0x5c38aa+_0x7711('0x5e'),util['inspect'](_0xf58b52,{'showHidden':![],'depth':null}));this[_0x7711('0x44')](util[_0x7711('0x4d')](_0x7711('0x49'),_0xf58b52[_0x7711('0x4a')]),_0x7711('0x5f'),_0xf58b52);}}};VoiceQueueReport[_0x7711('0x37')][_0x7711('0x60')]=function(_0x2fa27d){return _0x2fa27d!==null&&!_[_0x7711('0x61')](_0x2fa27d);};VoiceQueueReport[_0x7711('0x37')][_0x7711('0x2f')]=function(){var _0x1df72f=this;setInterval(function(){_0x1df72f[_0x7711('0x38')]();ami[_0x7711('0x3a')]({'action':_0x7711('0x62')})['catch'](function(_0x3b7a0f){logger['error'](_0x7711('0x63'),util[_0x7711('0x3f')](_0x3b7a0f,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x7711('0x37')][_0x7711('0x2e')]=function(){var _0x43b4fb=this;setInterval(function(){if(_0x43b4fb[_0x7711('0x12')]){return ami['Action']({'action':_0x7711('0x15')})[_0x7711('0x64')](function(_0x2615fa){_0x43b4fb[_0x7711('0x12')]=![];})['catch'](function(_0x5173c6){logger[_0x7711('0x3d')](_0x7711('0x65'),util[_0x7711('0x3f')](_0x5173c6,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x7711('0x37')][_0x7711('0x66')]=function(_0xc27fe){try{if(this[_0x7711('0x60')](_0xc27fe)&&this[_0x7711('0x60')](_0xc27fe['queue'])){logger[_0x7711('0x45')](_0x7711('0x67'),util[_0x7711('0x3f')](_0xc27fe,{'showHidden':![],'depth':null}));if(this[_0x7711('0x11')][_0xc27fe[_0x7711('0x68')]]){logger[_0x7711('0x69')]('[voiceQueueReport][queuesummary]\x20name:%s',_0xc27fe[_0x7711('0x68')]);var _0x3e9bc2=_[_0x7711('0x6a')](this[_0x7711('0xf')],_0x7711('0x68'))[_0xc27fe['queue']]||0x0;var _0xf1d874=_0x3e9bc2-_0xc27fe['callers'];if(this[_0x7711('0x11')][_0xc27fe['queue']]['waiting']!==_[_0x7711('0x6b')](_0xc27fe['callers'])||this['voiceQueues'][_0xc27fe[_0x7711('0x68')]][_0x7711('0x6c')]!==_[_0x7711('0x6b')](_0xc27fe[_0x7711('0x6d')])||this[_0x7711('0x11')][_0xc27fe[_0x7711('0x68')]][_0x7711('0x53')]!==_[_0x7711('0x6b')](_0xc27fe[_0x7711('0x53')])||this[_0x7711('0x11')][_0xc27fe[_0x7711('0x68')]][_0x7711('0x33')]!==_0xf1d874){this[_0x7711('0x11')][_0xc27fe[_0x7711('0x68')]][_0x7711('0x35')]=_[_0x7711('0x6b')](_0xc27fe[_0x7711('0x6e')]);this[_0x7711('0x11')][_0xc27fe[_0x7711('0x68')]][_0x7711('0x6c')]=_[_0x7711('0x6b')](_0xc27fe[_0x7711('0x6d')]);this['voiceQueues'][_0xc27fe[_0x7711('0x68')]][_0x7711('0x53')]=_[_0x7711('0x6b')](_0xc27fe['available']);this[_0x7711('0x11')][_0xc27fe[_0x7711('0x68')]][_0x7711('0x33')]=_0xf1d874>0x0?_0xf1d874:0x0;this['voiceQueues'][_0xc27fe[_0x7711('0x68')]][_0x7711('0x33')]=this[_0x7711('0x11')][_0xc27fe[_0x7711('0x68')]][_0x7711('0x33')]>_[_0x7711('0x6b')](_0xc27fe[_0x7711('0x6d')])?_['toNumber'](_0xc27fe['loggedin']):this[_0x7711('0x11')][_0xc27fe['queue']]['talking'];this[_0x7711('0x4f')](this['voiceQueues'][_0xc27fe[_0x7711('0x68')]],_0x7711('0x15'));}logger[_0x7711('0x45')](_0x7711('0x6f'),util['inspect'](this[_0x7711('0x11')][_0xc27fe[_0x7711('0x68')]],{'showHidden':![],'depth':null}));ami['emit']('custom:queuesummary',this[_0x7711('0x11')][_0xc27fe[_0x7711('0x68')]]);}}}catch(_0x4cff22){logger[_0x7711('0x3d')](_0x7711('0x65'),util[_0x7711('0x3f')](_0x4cff22,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7711('0x37')]['syncQueueSummaryComplete']=function(_0x11fb8e){logger['debug'](_0x7711('0x70'),util['inspect'](_0x11fb8e,{'showHidden':![],'depth':null}));this[_0x7711('0x12')]=!![];};VoiceQueueReport['prototype'][_0x7711('0x19')]=function(_0x5c6801){try{if(this['isNotNull'](_0x5c6801)){logger[_0x7711('0x45')](_0x7711('0x71'),_0x5c6801[_0x7711('0x48')],util[_0x7711('0x3f')](_0x5c6801,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x5c6801['uniqueid']])){this[_0x7711('0xd')][_0x5c6801[_0x7711('0x48')]]=[];this['channels'][_0x5c6801[_0x7711('0x48')]]={};}var _0x1a6c7b=new QueueReport();_0x1a6c7b['name']=_0x5c6801['queue'];_0x1a6c7b['type']=this[_0x7711('0x11')][_0x1a6c7b[_0x7711('0x4a')]]&&this[_0x7711('0x11')][_0x1a6c7b[_0x7711('0x4a')]][_0x7711('0x50')]?this[_0x7711('0x11')][_0x1a6c7b['name']][_0x7711('0x50')]||_0x7711('0x51'):_0x7711('0x51');_0x1a6c7b[_0x7711('0x68')]=_0x5c6801[_0x7711('0x68')];_0x1a6c7b['queuecallerjoinAt']=moment()[_0x7711('0x4d')](_0x7711('0x72'));_0x1a6c7b[_0x7711('0x73')]=_0x5c6801[_0x7711('0x73')];_0x1a6c7b[_0x7711('0x74')]=_0x5c6801[_0x7711('0x74')];_0x1a6c7b[_0x7711('0x48')]=_0x5c6801[_0x7711('0x48')];logger['info'](_0x7711('0x75'),_0x1a6c7b[_0x7711('0x4a')],_0x1a6c7b[_0x7711('0x50')]);_['merge'](_0x1a6c7b,_[_0x7711('0x76')](_0x5c6801,_[_0x7711('0x77')](_0x1a6c7b)));this[_0x7711('0xd')][_0x5c6801['uniqueid']]['push'](_0x1a6c7b);this[_0x7711('0xf')][_0x5c6801[_0x7711('0x48')]]=_0x1a6c7b;this[_0x7711('0x78')](_0x1a6c7b,_0x7711('0x79'));}}catch(_0x57a6ba){logger['error'](_0x7711('0x71'),_0x5c6801[_0x7711('0x48')],util[_0x7711('0x3f')](_0x57a6ba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7711('0x37')]['syncQueueCallerAbandon']=function(_0x20151b){try{if(this['isNotNull'](_0x20151b)){logger[_0x7711('0x45')](_0x7711('0x7a'),_0x20151b[_0x7711('0x48')],util['inspect'](_0x20151b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x20151b[_0x7711('0x48')]]){var _0xe4251b=_[_0x7711('0x7b')](this[_0x7711('0xd')][_0x20151b[_0x7711('0x48')]]);_0xe4251b[_0x7711('0x7c')]=![];_0xe4251b[_0x7711('0x7d')]=null;_0xe4251b[_0x7711('0x7e')]=_0x20151b[_0x7711('0x7e')];_0xe4251b[_0x7711('0x7f')]=_0x20151b[_0x7711('0x7f')];_0xe4251b[_0x7711('0x1a')]=!![];_0xe4251b[_0x7711('0x80')]=moment()['format'](_0x7711('0x72'));_0xe4251b[_0x7711('0x81')]=_0x7711('0x82');_0xe4251b[_0x7711('0x83')]=null;logger[_0x7711('0x69')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0xe4251b[_0x7711('0x4a')],_0xe4251b[_0x7711('0x50')]);this[_0x7711('0xf')][_0x20151b['uniqueid']]=_0xe4251b;this['emitVoiceQueueChannelRemove'](_0xe4251b,_0x7711('0x1a'));}}}catch(_0x46b16d){logger[_0x7711('0x3d')](_0x7711('0x7a'),_0x20151b[_0x7711('0x48')],util[_0x7711('0x3f')](_0x46b16d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7711('0x37')][_0x7711('0x1d')]=function(_0x2e1ae7){try{if(this['isNotNull'](_0x2e1ae7)){logger[_0x7711('0x45')](_0x7711('0x84'),_0x2e1ae7[_0x7711('0x48')],util[_0x7711('0x3f')](_0x2e1ae7,{'showHidden':![],'depth':null}));if(this[_0x7711('0xd')][_0x2e1ae7[_0x7711('0x48')]]){var _0x49a5c2=_[_0x7711('0x7b')](this[_0x7711('0xd')][_0x2e1ae7[_0x7711('0x48')]]);_0x49a5c2[_0x7711('0x85')]=moment()[_0x7711('0x4d')](_0x7711('0x72'));_0x49a5c2[_0x7711('0x86')]=_0x2e1ae7[_0x7711('0x86')];_0x49a5c2[_0x7711('0x87')]=_0x2e1ae7[_0x7711('0x87')];logger[_0x7711('0x69')](_0x7711('0x88'),_0x49a5c2[_0x7711('0x4a')],_0x49a5c2['type'],_0x2e1ae7[_0x7711('0x86')],_0x2e1ae7[_0x7711('0x87')]);this['channels'][_0x2e1ae7[_0x7711('0x48')]]=_0x49a5c2;this['emitVoiceQueueChannelSave'](_0x49a5c2,'queuecallerleave');}}}catch(_0x3b5297){logger['error'](_0x7711('0x84'),_0x2e1ae7['uniqueid'],util[_0x7711('0x3f')](_0x3b5297,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7711('0x37')][_0x7711('0x89')]=function(_0x23706f){try{if(this[_0x7711('0x60')](_0x23706f)){logger[_0x7711('0x45')](_0x7711('0x8a'),_0x23706f['uniqueid'],util[_0x7711('0x3f')](_0x23706f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x23706f['uniqueid']]){var _0x2b1a21=_[_0x7711('0x7b')](this[_0x7711('0xd')][_0x23706f['uniqueid']]);_0x2b1a21['queuecallercomplete']=!![];_0x2b1a21[_0x7711('0x81')]=_0x7711('0x8b');logger[_0x7711('0x69')](_0x7711('0x8c'),_0x2b1a21[_0x7711('0x4a')],_0x2b1a21[_0x7711('0x50')]);}}}catch(_0x53fd68){logger[_0x7711('0x3d')](_0x7711('0x8a'),_0x23706f[_0x7711('0x48')],util['inspect'](_0x53fd68,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7711('0x37')]['syncAgentComplete']=function(_0x463f7a){try{if(this[_0x7711('0x60')](_0x463f7a)){logger['debug'](_0x7711('0x8d'),_0x463f7a['uniqueid'],util[_0x7711('0x3f')](_0x463f7a,{'showHidden':![],'depth':null}));if(this[_0x7711('0xd')][_0x463f7a[_0x7711('0x48')]]){var _0x57a4af=_[_0x7711('0x7b')](this[_0x7711('0xd')][_0x463f7a[_0x7711('0x48')]]);_0x57a4af[_0x7711('0x1a')]=![];_0x57a4af[_0x7711('0x80')]=null;_0x57a4af[_0x7711('0x8e')]=!![];_0x57a4af[_0x7711('0x83')]=_0x463f7a[_0x7711('0x8f')];_0x57a4af[_0x7711('0x7e')]=_0x463f7a[_0x7711('0x7e')];_0x57a4af['queuecallercomplete']=!![];_0x57a4af[_0x7711('0x90')]=![];_0x57a4af[_0x7711('0x91')]=null;if(!_0x57a4af[_0x7711('0x92')]){if(_0x463f7a[_0x7711('0x93')]==_0x7711('0x92')){_0x57a4af[_0x7711('0x81')]=_0x7711('0x94');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x57a4af[_0x7711('0x4a')],_0x57a4af[_0x7711('0x50')]);}else{if(_[_0x7711('0x95')](_0x463f7a['channel'][_0x7711('0x96')](),_0x7711('0x97'))){if(this['queueReports'][_0x463f7a[_0x7711('0x98')]]){var _0x4c9d7a=_[_0x7711('0x7b')](this['queueReports'][_0x463f7a[_0x7711('0x98')]]);_0x4c9d7a['queuecallercomplete']=![];_0x4c9d7a[_0x7711('0x90')]=!![];_0x4c9d7a[_0x7711('0x91')]=moment(_0x57a4af[_0x7711('0x99')])[_0x7711('0x9a')](_0x463f7a[_0x7711('0x7e')],_0x7711('0x9b'))['format'](_0x7711('0x72'));_0x4c9d7a[_0x7711('0x81')]=_0x7711('0x9c');_0x4c9d7a[_0x7711('0x92')]=!![];_0x4c9d7a['transfertype']=_0x7711('0x9d');_0x4c9d7a[_0x7711('0x9e')]=_0x463f7a['destexten'];_0x4c9d7a[_0x7711('0x9f')]=_0x463f7a[_0x7711('0x48')];logger[_0x7711('0x69')](_0x7711('0xa0'),_0x4c9d7a[_0x7711('0x4a')],_0x4c9d7a[_0x7711('0x50')]);var _0x453ef7=this[_0x7711('0xd')][_0x463f7a['linkedid']];this['queueReports'][_0x463f7a[_0x7711('0x98')]]=this[_0x7711('0xd')][_0x463f7a[_0x7711('0x48')]];this[_0x7711('0xd')][_0x463f7a[_0x7711('0x48')]]=_0x453ef7;}}else{_0x57a4af[_0x7711('0x81')]=_0x7711('0xa1')+_0x463f7a[_0x7711('0x93')][_0x7711('0xa2')]();logger[_0x7711('0x69')](_0x7711('0xa3'),_0x57a4af[_0x7711('0x4a')],_0x57a4af[_0x7711('0x50')],_0x57a4af['queuecallerexitreason']);}}}this['channels'][_0x463f7a[_0x7711('0x48')]]=_0x57a4af;this[_0x7711('0x42')](_0x57a4af,_0x7711('0x1e'));}}}catch(_0x371c5d){logger[_0x7711('0x3d')](_0x7711('0x8d'),_0x463f7a[_0x7711('0x48')],util[_0x7711('0x3f')](_0x371c5d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7711('0x37')][_0x7711('0x22')]=function(_0x5b697f){try{if(this['isNotNull'](_0x5b697f)){logger[_0x7711('0x45')](_0x7711('0xa4'),_0x5b697f['uniqueid'],util['inspect'](_0x5b697f,{'showHidden':![],'depth':null}));this['addVariable'](_0x5b697f['uniqueid'],_['keys'](_0x5b697f[_0x7711('0xa5')])[0x0],_0x5b697f[_0x7711('0xa6')]);if(this[_0x7711('0xd')][_0x5b697f[_0x7711('0x48')]]){var _0xacacb9=_[_0x7711('0x7b')](this[_0x7711('0xd')][_0x5b697f[_0x7711('0x48')]]);if(_0xacacb9){if(this[_0x7711('0x60')](_0x5b697f[_0x7711('0xa5')])&&this['isNotNull'](_0x5b697f['variable']['queuestatus'])){switch(_0x5b697f[_0x7711('0xa6')]){case'CONTINUE':_0xacacb9[_0x7711('0x90')]=![];_0xacacb9['queuecallerexitAt']=null;break;case _0x7711('0xa7'):_0xacacb9['lastevent']=_0x7711('0xa8');_0xacacb9['queuecallerexit']=!![];_0xacacb9[_0x7711('0x91')]=moment()[_0x7711('0x4d')](_0x7711('0x72'));_0xacacb9[_0x7711('0x85')]=moment()[_0x7711('0x4d')](_0x7711('0x72'));logger['debug'](_0x7711('0xa9'),_0x5b697f[_0x7711('0x48')],util[_0x7711('0x3f')](_0xacacb9,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0xacacb9);break;default:_0xacacb9[_0x7711('0x90')]=!![];_0xacacb9[_0x7711('0x91')]=moment()[_0x7711('0x4d')](_0x7711('0x72'));_0xacacb9[_0x7711('0x85')]=moment()[_0x7711('0x4d')](_0x7711('0x72'));}_0xacacb9['queuecallerabandon']=![];_0xacacb9[_0x7711('0x80')]=null;_0xacacb9['queuecallerexitreason']=_0x5b697f['value'];this[_0x7711('0xf')][_0x5b697f[_0x7711('0x48')]]=_0xacacb9;this[_0x7711('0x42')](_0xacacb9,'varset');}else if(this['isNotNull'](_0x5b697f[_0x7711('0xa5')])&&this[_0x7711('0x60')](_0x5b697f['variable']['queueposition'])){if(!_0xacacb9[_0x7711('0x1a')]){_0xacacb9[_0x7711('0x90')]=!![];_0xacacb9[_0x7711('0x91')]=moment()[_0x7711('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0xacacb9[_0x7711('0x81')]=_0x7711('0xaa');_0xacacb9[_0x7711('0x85')]=moment()['format'](_0x7711('0x72'));this[_0x7711('0xf')][_0x5b697f['uniqueid']]=_0xacacb9;}}logger[_0x7711('0x69')](_0x7711('0xab'),_0x5b697f[_0x7711('0x48')],_0xacacb9['name'],_0xacacb9[_0x7711('0x50')],_[_0x7711('0x77')](_0x5b697f[_0x7711('0xa5')])[0x0],_0x5b697f['value']);_0xacacb9['variables']=this[_0x7711('0x14')][_0x5b697f[_0x7711('0x48')]];}}}}catch(_0x438da0){logger[_0x7711('0x3d')](_0x7711('0xa4'),_0x5b697f[_0x7711('0x48')],util[_0x7711('0x3f')](_0x438da0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7711('0x37')][_0x7711('0xac')]=function(_0x32bd30,_0x5b7167,_0x26dd69){var _0x101a77=[_0x7711('0xad'),_0x7711('0xae'),_0x7711('0xaf'),_0x7711('0xb0'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0x7711('0xb1'),_0x7711('0xb2'),_0x7711('0xb3'),_0x7711('0xb4'),_0x7711('0xb5'),_0x7711('0xb6'),_0x7711('0xb7'),'memberinterface',_0x7711('0xb8'),'membername',_0x7711('0xb9'),_0x7711('0xba')];if(!_[_0x7711('0xbb')](_0x5b7167)&&!_[_0x7711('0xbc')](_0x101a77,_0x5b7167)){if(_[_0x7711('0x61')](this[_0x7711('0x14')][_0x32bd30])){this['variables'][_0x32bd30]={};}this['variables'][_0x32bd30][_0x5b7167]=_0x26dd69;}};VoiceQueueReport[_0x7711('0x37')]['syncHangup']=function(_0x46d940){try{if(this[_0x7711('0x60')](_0x46d940)){logger[_0x7711('0x45')](_0x7711('0xbd'),_0x46d940[_0x7711('0x48')],util[_0x7711('0x3f')](_0x46d940,{'showHidden':![],'depth':null}));if(this[_0x7711('0xd')][_0x46d940[_0x7711('0x48')]]){for(var _0x42d34c=0x0,_0x4e0653={};_0x42d34c0x0?_0x3899c3:0x0;this[_0xd12f('0x6e')][_0x3ef4c6[_0xd12f('0x68')]][_0xd12f('0x2e')]=this[_0xd12f('0x6e')][_0x3ef4c6['queue']][_0xd12f('0x2e')]>_[_0xd12f('0x6d')](_0x3ef4c6[_0xd12f('0x6f')])?_[_0xd12f('0x6d')](_0x3ef4c6['loggedin']):this['voiceQueues'][_0x3ef4c6[_0xd12f('0x68')]][_0xd12f('0x2e')];this[_0xd12f('0x4d')](this[_0xd12f('0x6e')][_0x3ef4c6[_0xd12f('0x68')]],_0xd12f('0x65'));}logger[_0xd12f('0x41')](_0xd12f('0x70'),util[_0xd12f('0x3a')](this[_0xd12f('0x6e')][_0x3ef4c6['queue']],{'showHidden':![],'depth':null}));ami['emit'](_0xd12f('0x71'),this[_0xd12f('0x6e')][_0x3ef4c6[_0xd12f('0x68')]]);}}}catch(_0x1bdf78){logger[_0xd12f('0x38')](_0xd12f('0x67'),util['inspect'](_0x1bdf78,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd12f('0xc')]['syncQueueSummaryComplete']=function(_0x10d2a8){logger[_0xd12f('0x41')](_0xd12f('0x72'),util[_0xd12f('0x3a')](_0x10d2a8,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xd12f('0xc')]['syncQueueCallerJoin']=function(_0x4fb72f){try{if(this['isNotNull'](_0x4fb72f)){logger[_0xd12f('0x41')](_0xd12f('0x73'),_0x4fb72f[_0xd12f('0x44')],util[_0xd12f('0x3a')](_0x4fb72f,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xd12f('0x3b')][_0x4fb72f[_0xd12f('0x44')]])){this[_0xd12f('0x3b')][_0x4fb72f[_0xd12f('0x44')]]=[];this[_0xd12f('0x32')][_0x4fb72f[_0xd12f('0x44')]]={};}var _0x461f29=new QueueReport();_0x461f29[_0xd12f('0x47')]=_0x4fb72f[_0xd12f('0x68')];_0x461f29[_0xd12f('0x4e')]=this['voiceQueues'][_0x461f29[_0xd12f('0x47')]]&&this[_0xd12f('0x6e')][_0x461f29[_0xd12f('0x47')]][_0xd12f('0x4e')]?this['voiceQueues'][_0x461f29[_0xd12f('0x47')]]['type']||_0xd12f('0x4f'):_0xd12f('0x4f');_0x461f29[_0xd12f('0x68')]=_0x4fb72f[_0xd12f('0x68')];_0x461f29[_0xd12f('0x74')]=moment()[_0xd12f('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x461f29[_0xd12f('0x75')]=_0x4fb72f[_0xd12f('0x75')];_0x461f29[_0xd12f('0x76')]=_0x4fb72f[_0xd12f('0x76')];_0x461f29[_0xd12f('0x44')]=_0x4fb72f[_0xd12f('0x44')];logger[_0xd12f('0x6a')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x461f29[_0xd12f('0x47')],_0x461f29['type']);_['merge'](_0x461f29,_[_0xd12f('0x77')](_0x4fb72f,_['keys'](_0x461f29)));this[_0xd12f('0x3b')][_0x4fb72f['uniqueid']][_0xd12f('0x78')](_0x461f29);this[_0xd12f('0x32')][_0x4fb72f[_0xd12f('0x44')]]=_0x461f29;this[_0xd12f('0x40')](_0x461f29,_0xd12f('0x16'));}}catch(_0xe07489){logger[_0xd12f('0x38')](_0xd12f('0x73'),_0x4fb72f['uniqueid'],util[_0xd12f('0x3a')](_0xe07489,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd12f('0xc')][_0xd12f('0x19')]=function(_0x371ede){try{if(this[_0xd12f('0x61')](_0x371ede)){logger[_0xd12f('0x41')](_0xd12f('0x79'),_0x371ede[_0xd12f('0x44')],util[_0xd12f('0x3a')](_0x371ede,{'showHidden':![],'depth':null}));if(this[_0xd12f('0x3b')][_0x371ede[_0xd12f('0x44')]]){var _0x4126fc=_['last'](this[_0xd12f('0x3b')][_0x371ede[_0xd12f('0x44')]]);_0x4126fc[_0xd12f('0x7a')]=![];_0x4126fc['queuecallercompleteAt']=null;_0x4126fc[_0xd12f('0x7b')]=_0x371ede[_0xd12f('0x7b')];_0x4126fc[_0xd12f('0x7c')]=_0x371ede[_0xd12f('0x7c')];_0x4126fc['queuecallerabandon']=!![];_0x4126fc[_0xd12f('0x7d')]=moment()[_0xd12f('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x4126fc[_0xd12f('0x7e')]=_0xd12f('0x7f');_0x4126fc[_0xd12f('0x80')]=null;logger[_0xd12f('0x6a')](_0xd12f('0x81'),_0x4126fc[_0xd12f('0x47')],_0x4126fc[_0xd12f('0x4e')]);this[_0xd12f('0x32')][_0x371ede['uniqueid']]=_0x4126fc;this[_0xd12f('0x3d')](_0x4126fc,'queuecallerabandon');}}}catch(_0x3016e5){logger['error'](_0xd12f('0x79'),_0x371ede[_0xd12f('0x44')],util['inspect'](_0x3016e5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd12f('0xc')][_0xd12f('0x1b')]=function(_0x24cec7){try{if(this['isNotNull'](_0x24cec7)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x24cec7['uniqueid'],util['inspect'](_0x24cec7,{'showHidden':![],'depth':null}));if(this[_0xd12f('0x3b')][_0x24cec7[_0xd12f('0x44')]]){var _0x3e1cc6=_['last'](this[_0xd12f('0x3b')][_0x24cec7[_0xd12f('0x44')]]);_0x3e1cc6[_0xd12f('0x82')]=moment()['format'](_0xd12f('0x83'));_0x3e1cc6[_0xd12f('0x84')]=_0x24cec7['connectedlinenum'];_0x3e1cc6[_0xd12f('0x85')]=_0x24cec7[_0xd12f('0x85')];logger[_0xd12f('0x6a')](_0xd12f('0x86'),_0x3e1cc6[_0xd12f('0x47')],_0x3e1cc6[_0xd12f('0x4e')],_0x24cec7[_0xd12f('0x84')],_0x24cec7[_0xd12f('0x85')]);this[_0xd12f('0x32')][_0x24cec7['uniqueid']]=_0x3e1cc6;this['emitVoiceQueueChannelSave'](_0x3e1cc6,'queuecallerleave');}}}catch(_0x4ab6e9){logger[_0xd12f('0x38')](_0xd12f('0x87'),_0x24cec7['uniqueid'],util[_0xd12f('0x3a')](_0x4ab6e9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd12f('0xc')][_0xd12f('0x88')]=function(_0x4cd562){try{if(this[_0xd12f('0x61')](_0x4cd562)){logger['debug'](_0xd12f('0x89'),_0x4cd562['uniqueid'],util[_0xd12f('0x3a')](_0x4cd562,{'showHidden':![],'depth':null}));if(this[_0xd12f('0x3b')][_0x4cd562['uniqueid']]){var _0x554210=_[_0xd12f('0x8a')](this['queueReports'][_0x4cd562[_0xd12f('0x44')]]);_0x554210['queuecallercomplete']=!![];_0x554210[_0xd12f('0x7e')]=_0xd12f('0x8b');logger[_0xd12f('0x6a')](_0xd12f('0x8c'),_0x554210[_0xd12f('0x47')],_0x554210[_0xd12f('0x4e')]);}}}catch(_0x4c165c){logger[_0xd12f('0x38')](_0xd12f('0x89'),_0x4cd562['uniqueid'],util[_0xd12f('0x3a')](_0x4c165c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd12f('0xc')][_0xd12f('0x8d')]=function(_0x487184){try{if(this[_0xd12f('0x61')](_0x487184)){logger[_0xd12f('0x41')](_0xd12f('0x8e'),_0x487184[_0xd12f('0x44')],util['inspect'](_0x487184,{'showHidden':![],'depth':null}));if(this[_0xd12f('0x3b')][_0x487184[_0xd12f('0x44')]]){var _0x3b0fd0=_[_0xd12f('0x8a')](this[_0xd12f('0x3b')][_0x487184[_0xd12f('0x44')]]);_0x3b0fd0[_0xd12f('0x18')]=![];_0x3b0fd0[_0xd12f('0x7d')]=null;_0x3b0fd0[_0xd12f('0x8f')]=!![];_0x3b0fd0[_0xd12f('0x80')]=_0x487184[_0xd12f('0x90')];_0x3b0fd0[_0xd12f('0x7b')]=_0x487184[_0xd12f('0x7b')];_0x3b0fd0['queuecallercomplete']=!![];_0x3b0fd0[_0xd12f('0x91')]=![];_0x3b0fd0['queuecallerexitAt']=null;if(!_0x3b0fd0[_0xd12f('0x92')]){if(_0x487184[_0xd12f('0x93')]==_0xd12f('0x92')){_0x3b0fd0[_0xd12f('0x7e')]=_0xd12f('0x94');logger[_0xd12f('0x6a')](_0xd12f('0x95'),_0x3b0fd0[_0xd12f('0x47')],_0x3b0fd0[_0xd12f('0x4e')]);}else{if(_['startsWith'](_0x487184[_0xd12f('0x96')][_0xd12f('0x97')](),_0xd12f('0x98'))){if(this[_0xd12f('0x3b')][_0x487184[_0xd12f('0x99')]]){var _0x146ac6=_[_0xd12f('0x8a')](this['queueReports'][_0x487184[_0xd12f('0x99')]]);_0x146ac6['queuecallercomplete']=![];_0x146ac6[_0xd12f('0x91')]=!![];_0x146ac6['queuecallerexitAt']=moment(_0x3b0fd0[_0xd12f('0x74')])['add'](_0x487184[_0xd12f('0x7b')],_0xd12f('0x9a'))['format'](_0xd12f('0x83'));_0x146ac6[_0xd12f('0x7e')]=_0xd12f('0x9b');_0x146ac6['transfer']=!![];_0x146ac6[_0xd12f('0x9c')]=_0xd12f('0x9d');_0x146ac6[_0xd12f('0x9e')]=_0x487184[_0xd12f('0x9f')];_0x146ac6[_0xd12f('0xa0')]=_0x487184[_0xd12f('0x44')];logger[_0xd12f('0x6a')](_0xd12f('0xa1'),_0x146ac6[_0xd12f('0x47')],_0x146ac6[_0xd12f('0x4e')]);var _0x39d737=this[_0xd12f('0x3b')][_0x487184[_0xd12f('0x99')]];this[_0xd12f('0x3b')][_0x487184['linkedid']]=this[_0xd12f('0x3b')][_0x487184[_0xd12f('0x44')]];this['queueReports'][_0x487184[_0xd12f('0x44')]]=_0x39d737;}}else{_0x3b0fd0[_0xd12f('0x7e')]=_0xd12f('0xa2')+_0x487184['reason'][_0xd12f('0xa3')]();logger[_0xd12f('0x6a')](_0xd12f('0xa4'),_0x3b0fd0[_0xd12f('0x47')],_0x3b0fd0[_0xd12f('0x4e')],_0x3b0fd0[_0xd12f('0x7e')]);}}}this[_0xd12f('0x32')][_0x487184[_0xd12f('0x44')]]=_0x3b0fd0;this['emitVoiceQueueChannelRemove'](_0x3b0fd0,_0xd12f('0xa5'));}}}catch(_0x352857){logger[_0xd12f('0x38')]('[%s][voiceQueueReport][agentcomplete]',_0x487184['uniqueid'],util[_0xd12f('0x3a')](_0x352857,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd12f('0xc')][_0xd12f('0x1e')]=function(_0x1ac59d){try{if(this['isNotNull'](_0x1ac59d)){logger[_0xd12f('0x41')](_0xd12f('0xa6'),_0x1ac59d[_0xd12f('0x44')],util[_0xd12f('0x3a')](_0x1ac59d,{'showHidden':![],'depth':null}));this[_0xd12f('0xa7')](_0x1ac59d[_0xd12f('0x44')],_[_0xd12f('0xa8')](_0x1ac59d[_0xd12f('0xa9')])[0x0],_0x1ac59d['value']);if(this[_0xd12f('0x3b')][_0x1ac59d[_0xd12f('0x44')]]){var _0x258b3b=_[_0xd12f('0x8a')](this[_0xd12f('0x3b')][_0x1ac59d['uniqueid']]);if(_0x258b3b){if(this['isNotNull'](_0x1ac59d[_0xd12f('0xa9')])&&this[_0xd12f('0x61')](_0x1ac59d[_0xd12f('0xa9')][_0xd12f('0xaa')])){switch(_0x1ac59d['value']){case _0xd12f('0xab'):_0x258b3b[_0xd12f('0x91')]=![];_0x258b3b[_0xd12f('0xac')]=null;break;case'TIMEOUT':_0x258b3b[_0xd12f('0xad')]=_0xd12f('0xae');_0x258b3b[_0xd12f('0x91')]=!![];_0x258b3b[_0xd12f('0xac')]=moment()['format'](_0xd12f('0x83'));_0x258b3b[_0xd12f('0x82')]=moment()[_0xd12f('0x45')](_0xd12f('0x83'));logger['debug'](_0xd12f('0xaf'),_0x1ac59d[_0xd12f('0x44')],util['inspect'](_0x258b3b,{'showHidden':![],'depth':null}));ami[_0xd12f('0x3f')]('custom:timeout',_0x258b3b);break;default:_0x258b3b[_0xd12f('0x91')]=!![];_0x258b3b[_0xd12f('0xac')]=moment()[_0xd12f('0x45')](_0xd12f('0x83'));_0x258b3b['queuecallerleaveAt']=moment()[_0xd12f('0x45')](_0xd12f('0x83'));}_0x258b3b[_0xd12f('0x18')]=![];_0x258b3b[_0xd12f('0x7d')]=null;_0x258b3b[_0xd12f('0x7e')]=_0x1ac59d[_0xd12f('0xb0')];this[_0xd12f('0x32')][_0x1ac59d['uniqueid']]=_0x258b3b;this[_0xd12f('0x3d')](_0x258b3b,_0xd12f('0x1d'));}else if(this[_0xd12f('0x61')](_0x1ac59d[_0xd12f('0xa9')])&&this['isNotNull'](_0x1ac59d[_0xd12f('0xa9')][_0xd12f('0xb1')])){if(!_0x258b3b[_0xd12f('0x18')]){_0x258b3b[_0xd12f('0x91')]=!![];_0x258b3b['queuecallerexitAt']=moment()[_0xd12f('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x258b3b[_0xd12f('0x7e')]='EXITWITHKEY';_0x258b3b['queuecallerleaveAt']=moment()['format'](_0xd12f('0x83'));this[_0xd12f('0x32')][_0x1ac59d[_0xd12f('0x44')]]=_0x258b3b;}}logger[_0xd12f('0x6a')](_0xd12f('0xb2'),_0x1ac59d['uniqueid'],_0x258b3b['name'],_0x258b3b['type'],_[_0xd12f('0xa8')](_0x1ac59d[_0xd12f('0xa9')])[0x0],_0x1ac59d[_0xd12f('0xb0')]);_0x258b3b[_0xd12f('0x13')]=this[_0xd12f('0x13')][_0x1ac59d['uniqueid']];}}}}catch(_0x49f3b8){logger[_0xd12f('0x38')]('[%s][voiceQueueReport][varset]',_0x1ac59d[_0xd12f('0x44')],util[_0xd12f('0x3a')](_0x49f3b8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd12f('0xc')][_0xd12f('0xa7')]=function(_0x2d77eb,_0xd6e6be,_0x1b5b04){var _0x2b0a7c=[_0xd12f('0xb3'),'rtpaudioqosbridged',_0xd12f('0xb4'),_0xd12f('0xb5'),_0xd12f('0xb6'),_0xd12f('0xb7'),_0xd12f('0xb8'),'rtpaudioqosrttbridged',_0xd12f('0xb9'),_0xd12f('0xba'),'bridgepeer',_0xd12f('0xbb'),_0xd12f('0xbc'),_0xd12f('0xbd'),_0xd12f('0xbe'),'memberlastcall',_0xd12f('0x90'),_0xd12f('0xbf'),_0xd12f('0xc0')];if(!_[_0xd12f('0x34')](_0xd6e6be)&&!_[_0xd12f('0xc1')](_0x2b0a7c,_0xd6e6be)){if(_['isUndefined'](this['variables'][_0x2d77eb])){this[_0xd12f('0x13')][_0x2d77eb]={};}this[_0xd12f('0x13')][_0x2d77eb][_0xd6e6be]=_0x1b5b04;}};VoiceQueueReport['prototype'][_0xd12f('0x1f')]=function(_0x104d21){try{if(this['isNotNull'](_0x104d21)){logger[_0xd12f('0x41')](_0xd12f('0xc2'),_0x104d21[_0xd12f('0x44')],util['inspect'](_0x104d21,{'showHidden':![],'depth':null}));if(this[_0xd12f('0x3b')][_0x104d21[_0xd12f('0x44')]]){for(var _0x4bb6fb=0x0,_0x4f0daa={};_0x4bb6fb=0x0?moment(_0xadebf8['endtime'])[_0xe102('0x10')](_0xadebf8[_0xe102('0x18')],_0xe102('0x19')):null,'data1':_0xe102('0x1a'),'data2':_0xadebf8[_0xe102('0x15')],'data3':_0xadebf8['exten'],'data4':_0xadebf8['dialstring']||null,'role':_0xe102('0x1b'),'internal':_0xadebf8[_0xe102('0x15')]?_[_0xe102('0x1c')](_0xadebf8[_0xe102('0x15')]):undefined,'uniqueid':_0xadebf8[_0xe102('0x16')]},'log':_0xe102('0x7')});}; \ No newline at end of file +var _0xf524=['uniqueid','CreateMemberReport','diff','endtime','starttime','outbound','toNumber','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','SIP/%s','interface','TALKING','queuecallerleaveAt','seconds','calleridnum','exten','queue','agent','accountcode'];(function(_0x481366,_0x41e46b){var _0x229649=function(_0x508ecc){while(--_0x508ecc){_0x481366['push'](_0x481366['shift']());}};_0x229649(++_0x41e46b);}(_0xf524,0x181));var _0x4f52=function(_0x2f2a0d,_0x5d1976){_0x2f2a0d=_0x2f2a0d-0x0;var _0x823f5e=_0xf524[_0x2f2a0d];return _0x823f5e;};'use strict';var moment=require(_0x4f52('0x0'));var _=require(_0x4f52('0x1'));var util=require(_0x4f52('0x2'));var client=require(_0x4f52('0x3'));exports[_0x4f52('0x4')]=function(_0x4ec627){var _0x5c3f53=_0x4ec627[_0x4f52('0x5')]||_0x4ec627[_0x4f52('0x6')];return client[_0x4f52('0x7')]('CreateMemberReport',{'body':{'channel':_0x4f52('0x8'),'membername':_0x4ec627[_0x4f52('0x9')],'interface':_['isNil'](_0x4ec627['interface'])?util['format'](_0x4f52('0xa'),_0x4ec627[_0x4f52('0x9')]):_0x4ec627[_0x4f52('0xb')],'type':_0x4f52('0xc'),'enterAt':_0x4ec627[_0x4f52('0xd')],'exitAt':_0x5c3f53,'duration':moment(_0x5c3f53)['diff'](_0x4ec627[_0x4f52('0xd')],_0x4f52('0xe')),'data1':'inbound','data2':_0x4ec627[_0x4f52('0xf')],'data3':_0x4ec627[_0x4f52('0x10')],'data4':null,'data5':_0x4ec627[_0x4f52('0x11')],'role':_0x4f52('0x12'),'internal':_0x4ec627[_0x4f52('0x13')]?_['toNumber'](_0x4ec627[_0x4f52('0x13')]):undefined,'uniqueid':_0x4ec627[_0x4f52('0x14')]},'log':_0x4f52('0x15')});};exports['voiceDialReport']=function(_0x35923a){return client[_0x4f52('0x7')](_0x4f52('0x15'),{'body':{'channel':'voice','membername':_0x35923a['membername'],'interface':_0x35923a[_0x4f52('0xb')],'type':'TALKING','enterAt':_0x35923a['starttime'],'exitAt':_0x35923a['endtime'],'duration':moment(_0x35923a['endtime'])[_0x4f52('0x16')](_0x35923a['starttime'],_0x4f52('0xe'))>=0x0?moment(_0x35923a[_0x4f52('0x17')])[_0x4f52('0x16')](_0x35923a[_0x4f52('0x18')],'seconds'):null,'data1':_0x4f52('0x19'),'data2':_0x35923a[_0x4f52('0x13')],'data3':_0x35923a[_0x4f52('0x10')],'data4':_0x35923a['dialstring']||null,'role':_0x4f52('0x12'),'internal':_0x35923a['accountcode']?_[_0x4f52('0x1a')](_0x35923a[_0x4f52('0x13')]):undefined,'uniqueid':_0x35923a[_0x4f52('0x14')]},'log':_0x4f52('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 397dab7..98cea87 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 _0xbb53=['GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x44627c,_0x1216e7){var _0x40a972=function(_0x2da538){while(--_0x2da538){_0x44627c['push'](_0x44627c['shift']());}};_0x40a972(++_0x1216e7);}(_0xbb53,0x121));var _0x3bb5=function(_0x1edbb6,_0x4f9e23){_0x1edbb6=_0x1edbb6-0x0;var _0x21fd12=_0xbb53[_0x1edbb6];return _0x21fd12;};'use strict';var client=require(_0x3bb5('0x0'));exports[_0x3bb5('0x1')]=function(){return client[_0x3bb5('0x2')](_0x3bb5('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3bb5('0x4')]},'log':_0x3bb5('0x5')});}; \ No newline at end of file +var _0xd8b0=['getSettings','GetSettings','../client'];(function(_0x1c223c,_0x3cef2f){var _0x141766=function(_0x5c09ed){while(--_0x5c09ed){_0x1c223c['push'](_0x1c223c['shift']());}};_0x141766(++_0x3cef2f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x0d8b('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index acc6f43..7f762eb 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 _0x536f=['../client','GetTemplate','name','html'];(function(_0x5e5c4c,_0x21abba){var _0x176148=function(_0x59522a){while(--_0x59522a){_0x5e5c4c['push'](_0x5e5c4c['shift']());}};_0x176148(++_0x21abba);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xf536('0x0'));exports['getTemplates']=function(_0x4e4212){return function(_0x4c2e7e){return client['Request'](_0xf536('0x1'),{'options':{'raw':!![],'attributes':['id',_0xf536('0x2'),_0xf536('0x3')]},'log':_0xf536('0x1')});};}; \ No newline at end of file +var _0xaaa2=['GetTemplate','html','../client','getTemplates','Request'];(function(_0xf87cd1,_0x430abd){var _0x36688b=function(_0x53735b){while(--_0x53735b){_0xf87cd1['push'](_0xf87cd1['shift']());}};_0x36688b(++_0x430abd);}(_0xaaa2,0xac));var _0x2aaa=function(_0x2b3590,_0x54a59a){_0x2b3590=_0x2b3590-0x0;var _0x26ddce=_0xaaa2[_0x2b3590];return _0x26ddce;};'use strict';var client=require(_0x2aaa('0x0'));exports[_0x2aaa('0x1')]=function(_0x21def1){return function(_0xf47434){return client[_0x2aaa('0x2')](_0x2aaa('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x2aaa('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 671bcad..83cdd12 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 _0xf116=['data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','GetTrigger','name','channel','status','Condition','field','operator','value','AnyConditions','Actions','action'];(function(_0x1903e9,_0x418cd3){var _0x3c063f=function(_0x503be4){while(--_0x503be4){_0x1903e9['push'](_0x1903e9['shift']());}};_0x3c063f(++_0x418cd3);}(_0xf116,0x93));var _0x6f11=function(_0x599d7f,_0xc586e8){_0x599d7f=_0x599d7f-0x0;var _0x3346d3=_0xf116[_0x599d7f];return _0x3346d3;};'use strict';var client=require(_0x6f11('0x0'));exports[_0x6f11('0x1')]=function(_0x35e3b8){return function(_0xdce9c0){return client['Request'](_0x6f11('0x2'),{'options':{'raw':![],'attributes':['id',_0x6f11('0x3'),_0x6f11('0x4'),_0x6f11('0x5')],'include':[{'model':_0x6f11('0x6'),'as':'AllConditions','attributes':['id',_0x6f11('0x7'),_0x6f11('0x8'),_0x6f11('0x9')]},{'model':_0x6f11('0x6'),'as':_0x6f11('0xa'),'attributes':['id',_0x6f11('0x7'),_0x6f11('0x8'),_0x6f11('0x9')]},{'model':'Action','as':_0x6f11('0xb'),'attributes':['id',_0x6f11('0xc'),_0x6f11('0xd'),_0x6f11('0xe'),_0x6f11('0xf'),_0x6f11('0x10'),_0x6f11('0x11'),_0x6f11('0x12'),_0x6f11('0x13')]}]},'log':_0x6f11('0x2')});};}; \ No newline at end of file +var _0x9883=['data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','value','AnyConditions','operator','Action','Actions','action','data1','data2','data3','data4'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x9883,0x100));var _0x3988=function(_0x894d11,_0xfc09c0){_0x894d11=_0x894d11-0x0;var _0x593f65=_0x9883[_0x894d11];return _0x593f65;};'use strict';var client=require(_0x3988('0x0'));exports[_0x3988('0x1')]=function(_0xd58641){return function(_0x35d7b6){return client[_0x3988('0x2')](_0x3988('0x3'),{'options':{'raw':![],'attributes':['id',_0x3988('0x4'),_0x3988('0x5'),_0x3988('0x6')],'include':[{'model':_0x3988('0x7'),'as':_0x3988('0x8'),'attributes':['id',_0x3988('0x9'),'operator',_0x3988('0xa')]},{'model':'Condition','as':_0x3988('0xb'),'attributes':['id',_0x3988('0x9'),_0x3988('0xc'),_0x3988('0xa')]},{'model':_0x3988('0xd'),'as':_0x3988('0xe'),'attributes':['id',_0x3988('0xf'),_0x3988('0x10'),_0x3988('0x11'),_0x3988('0x12'),_0x3988('0x13'),_0x3988('0x14'),_0x3988('0x15'),_0x3988('0x16')]}]},'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 d5aa72c..645a36f 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 _0x2d48=['../client','getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x569fef,_0x49c37a){var _0x11f20b=function(_0x3721d8){while(--_0x3721d8){_0x569fef['push'](_0x569fef['shift']());}};_0x11f20b(++_0x49c37a);}(_0x2d48,0x1ab));var _0x82d4=function(_0x5aef17,_0x592cd4){_0x5aef17=_0x5aef17-0x0;var _0x43f9d0=_0x2d48[_0x5aef17];return _0x43f9d0;};'use strict';var client=require(_0x82d4('0x0'));exports[_0x82d4('0x1')]=function(_0x404094){return function(_0xe5ec5e){return client[_0x82d4('0x2')](_0x82d4('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x82d4('0x4'),_0x82d4('0x5'),_0x82d4('0x6')]},'log':_0x82d4('0x3')});};}; \ No newline at end of file +var _0x35f0=['defaultuser','GetTrunk','../client','getTrunks','Request','name','registry'];(function(_0x5163a7,_0x2896e3){var _0x4fdc7e=function(_0x38e104){while(--_0x38e104){_0x5163a7['push'](_0x5163a7['shift']());}};_0x4fdc7e(++_0x2896e3);}(_0x35f0,0xc6));var _0x035f=function(_0x223fe1,_0x2f8117){_0x223fe1=_0x223fe1-0x0;var _0x7f355c=_0x35f0[_0x223fe1];return _0x7f355c;};'use strict';var client=require(_0x035f('0x0'));exports[_0x035f('0x1')]=function(_0x1b7883){return function(_0x1d6037){return client[_0x035f('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x035f('0x3'),_0x035f('0x4'),_0x035f('0x5')]},'log':_0x035f('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 9b7d0cd..6f91da4 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 _0x91f5=['name','email','accountcode','fullname','lastPauseAt','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','online','pauseType','getAgents','Request','GetUser','agent'];(function(_0x2c4d4a,_0x5c14c9){var _0x23d2eb=function(_0x405235){while(--_0x405235){_0x2c4d4a['push'](_0x2c4d4a['shift']());}};_0x23d2eb(++_0x5c14c9);}(_0x91f5,0xcb));var _0x591f=function(_0x10f1d3,_0x135a18){_0x10f1d3=_0x10f1d3-0x0;var _0x4c1bc8=_0x91f5[_0x10f1d3];return _0x4c1bc8;};'use strict';var client=require('../client');exports[_0x591f('0x0')]=function(){return function(){return client[_0x591f('0x1')](_0x591f('0x2'),{'options':{'raw':![],'where':{'role':_0x591f('0x3')},'attributes':['id',_0x591f('0x4'),_0x591f('0x5'),_0x591f('0x6'),_0x591f('0x7'),'online','lastLoginAt','pauseType',_0x591f('0x8'),_0x591f('0x9'),'phone',_0x591f('0xa'),_0x591f('0xb')]},'log':_0x591f('0x0')});};};exports[_0x591f('0xc')]=function(){return function(){return client[_0x591f('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x591f('0xd')},'attributes':['id',_0x591f('0x4'),_0x591f('0x6'),_0x591f('0xe')]},'log':'getTelephones'});};};exports[_0x591f('0xf')]=function(_0x2321ad,_0x5ad7cb,_0x2b2097){return client[_0x591f('0x1')](_0x591f('0x10'),{'body':{'type':_0x5ad7cb,'uniqueid':_0x2b2097},'options':{'where':{'id':_0x2321ad['id']}},'log':_0x591f('0xf')});};exports[_0x591f('0x11')]=function(_0x4bab44){return client[_0x591f('0x1')](_0x591f('0x12'),{'body':{},'options':{'where':{'id':_0x4bab44['id']}},'log':_0x591f('0xf')});};exports[_0x591f('0x13')]=function(_0x5eb85f){return client['Request'](_0x591f('0x14'),{'options':{'raw':![],'where':{'role':_0x591f('0x3'),'id':_0x5eb85f},'attributes':['id',_0x591f('0x4'),_0x591f('0x5'),_0x591f('0x6'),'fullname',_0x591f('0x15'),'lastLoginAt',_0x591f('0x16'),_0x591f('0x8'),'voicePause','interface']},'log':_0x591f('0x13')});}; \ No newline at end of file +var _0x1348=['lastLoginAt','pauseType','lastPauseAt','voicePause','mobile','interface','getAgents','getTelephones','internal','savePause','PauseUser','getAgent','agent','email','../client','Request','GetUser','name','accountcode','fullname','online'];(function(_0x28089e,_0x530f8a){var _0x46a73c=function(_0x461513){while(--_0x461513){_0x28089e['push'](_0x28089e['shift']());}};_0x46a73c(++_0x530f8a);}(_0x1348,0xe0));var _0x8134=function(_0xb978f3,_0x133e27){_0xb978f3=_0xb978f3-0x0;var _0x4dec50=_0x1348[_0xb978f3];return _0x4dec50;};'use strict';var client=require(_0x8134('0x0'));exports['getAgents']=function(){return function(){return client[_0x8134('0x1')](_0x8134('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x8134('0x3'),'email',_0x8134('0x4'),_0x8134('0x5'),_0x8134('0x6'),_0x8134('0x7'),_0x8134('0x8'),_0x8134('0x9'),_0x8134('0xa'),'phone',_0x8134('0xb'),_0x8134('0xc')]},'log':_0x8134('0xd')});};};exports[_0x8134('0xe')]=function(){return function(){return client[_0x8134('0x1')](_0x8134('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x8134('0x3'),_0x8134('0x4'),_0x8134('0xf')]},'log':_0x8134('0xe')});};};exports[_0x8134('0x10')]=function(_0x7d5915,_0x3ad5aa,_0x1f0364){return client['Request'](_0x8134('0x11'),{'body':{'type':_0x3ad5aa,'uniqueid':_0x1f0364},'options':{'where':{'id':_0x7d5915['id']}},'log':'savePause'});};exports['saveUnpause']=function(_0x25a1d3){return client[_0x8134('0x1')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x25a1d3['id']}},'log':_0x8134('0x10')});};exports[_0x8134('0x12')]=function(_0x1a8f17){return client[_0x8134('0x1')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x8134('0x13'),'id':_0x1a8f17},'attributes':['id','name',_0x8134('0x14'),'accountcode',_0x8134('0x5'),_0x8134('0x6'),_0x8134('0x7'),_0x8134('0x8'),_0x8134('0x9'),_0x8134('0xa'),_0x8134('0xc')]},'log':_0x8134('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 33567b9..f99418a 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 _0x6d4e=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x4fe01d,_0x5471e0){var _0x1669bd=function(_0x44e94a){while(--_0x44e94a){_0x4fe01d['push'](_0x4fe01d['shift']());}};_0x1669bd(++_0x5471e0);}(_0x6d4e,0x12e));var _0xe6d4=function(_0x33c603,_0x6d0ce4){_0x33c603=_0x33c603-0x0;var _0xae96f4=_0x6d4e[_0x33c603];return _0xae96f4;};'use strict';var client=require(_0xe6d4('0x0'));exports[_0xe6d4('0x1')]=function(_0x3d92a5){return client[_0xe6d4('0x2')](_0xe6d4('0x3'),{'body':_0x3d92a5,'log':_0xe6d4('0x3')});};exports[_0xe6d4('0x4')]=function(_0x1e00ed,_0x436716,_0x2d36f8){return client[_0xe6d4('0x2')]('UpdateVoiceAgentReport',{'body':_0x1e00ed,'options':{'where':{'uniqueid':_0x436716,'interface':_0x2d36f8,'agentcomplete':!![]}},'log':_0xe6d4('0x5')});}; \ No newline at end of file +var _0x380a=['create','CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','../client'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x380a,0x16c));var _0xa380=function(_0x40fcda,_0x2e8598){_0x40fcda=_0x40fcda-0x0;var _0x38e739=_0x380a[_0x40fcda];return _0x38e739;};'use strict';var client=require(_0xa380('0x0'));exports[_0xa380('0x1')]=function(_0x13f026){return client['Request'](_0xa380('0x2'),{'body':_0x13f026,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0xfb00ee,_0x54a96f,_0x57953d){return client[_0xa380('0x3')](_0xa380('0x4'),{'body':_0xfb00ee,'options':{'where':{'uniqueid':_0x54a96f,'interface':_0x57953d,'agentcomplete':!![]}},'log':_0xa380('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index eb42f0b..dc7740c 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 _0x6133=['startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound'];(function(_0x68c4d9,_0x419b3c){var _0x62da93=function(_0x51ae9a){while(--_0x51ae9a){_0x68c4d9['push'](_0x68c4d9['shift']());}};_0x62da93(++_0x419b3c);}(_0x6133,0x1d2));var _0x3613=function(_0x349574,_0x2f5cfe){_0x349574=_0x349574-0x0;var _0x43725e=_0x6133[_0x349574];return _0x43725e;};'use strict';var moment=require(_0x3613('0x0'));var util=require(_0x3613('0x1'));var _=require(_0x3613('0x2'));var client=require(_0x3613('0x3'));exports[_0x3613('0x4')]=function(_0x27168a){return client['Request'](_0x3613('0x5'),{'body':_[_0x3613('0x6')](_0x27168a,{'source':_0x27168a[_0x3613('0x7')],'destinationcontext':_0x27168a['context'],'callerid':_0x27168a[_0x3613('0x8')],'amaflags':_0x3613('0x9')}),'log':_0x3613('0x5')});};exports[_0x3613('0xa')]=function(){return function(){return client[_0x3613('0xb')](_0x3613('0xc'),{'options':{'where':{'type':[_0x3613('0xd')],'createdAt':{'$between':[moment()[_0x3613('0xe')]('day')[_0x3613('0xf')](_0x3613('0x10')),moment()[_0x3613('0x11')](_0x3613('0x12'))[_0x3613('0xf')](_0x3613('0x10'))]}},'attributes':[_0x3613('0x13'),_0x3613('0x14'),_0x3613('0x15'),_0x3613('0x16')]},'log':_0x3613('0x17')});};}; \ No newline at end of file +var _0xff70=['disposition','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','type'];(function(_0x2ef3ec,_0x5554ab){var _0x57a649=function(_0x17982d){while(--_0x17982d){_0x2ef3ec['push'](_0x2ef3ec['shift']());}};_0x57a649(++_0x5554ab);}(_0xff70,0xfe));var _0x0ff7=function(_0xc14df7,_0x163f90){_0xc14df7=_0xc14df7-0x0;var _0x34a445=_0xff70[_0xc14df7];return _0x34a445;};'use strict';var moment=require(_0x0ff7('0x0'));var util=require(_0x0ff7('0x1'));var _=require(_0x0ff7('0x2'));var client=require(_0x0ff7('0x3'));exports[_0x0ff7('0x4')]=function(_0x53238e){return client[_0x0ff7('0x5')](_0x0ff7('0x6'),{'body':_[_0x0ff7('0x7')](_0x53238e,{'source':_0x53238e[_0x0ff7('0x8')],'destinationcontext':_0x53238e['context'],'callerid':_0x53238e[_0x0ff7('0x9')],'amaflags':_0x0ff7('0xa')}),'log':_0x0ff7('0x6')});};exports[_0x0ff7('0xb')]=function(){return function(){return client['Request'](_0x0ff7('0xc'),{'options':{'where':{'type':[_0x0ff7('0xd')],'createdAt':{'$between':[moment()[_0x0ff7('0xe')](_0x0ff7('0xf'))['format'](_0x0ff7('0x10')),moment()[_0x0ff7('0x11')]('day')['format'](_0x0ff7('0x10'))]}},'attributes':[_0x0ff7('0x12'),_0x0ff7('0x13'),'duration','billableseconds']},'log':_0x0ff7('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index bd4e89e..3850bf1 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 _0x6a76=['CreateVoiceDialReport','../client','create'];(function(_0x27ecbb,_0x3b5239){var _0x1d4760=function(_0x5829cf){while(--_0x5829cf){_0x27ecbb['push'](_0x27ecbb['shift']());}};_0x1d4760(++_0x3b5239);}(_0x6a76,0x115));var _0x66a7=function(_0x3ef1b5,_0x4845b1){_0x3ef1b5=_0x3ef1b5-0x0;var _0x56bd5=_0x6a76[_0x3ef1b5];return _0x56bd5;};'use strict';var client=require(_0x66a7('0x0'));exports[_0x66a7('0x1')]=function(_0xd4e2b2){return client['Request'](_0x66a7('0x2'),{'body':_0xd4e2b2,'log':_0x66a7('0x2')});}; \ No newline at end of file +var _0x6ccc=['CreateVoiceDialReport','Request'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0x6ccc,0x1e7));var _0xc6cc=function(_0x5d2a5d,_0x55d114){_0x5d2a5d=_0x5d2a5d-0x0;var _0x66550d=_0x6ccc[_0x5d2a5d];return _0x66550d;};'use strict';var client=require('../client');exports['create']=function(_0x16a87a){return client[_0xc6cc('0x0')]('CreateVoiceDialReport',{'body':_0x16a87a,'log':_0xc6cc('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 3bc5d17..88e6684 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 _0xd485=['GetVoiceExtension','exten','getVoiceExtensions','Request'];(function(_0x41cb3c,_0x131418){var _0x1ad81a=function(_0x5bf20b){while(--_0x5bf20b){_0x41cb3c['push'](_0x41cb3c['shift']());}};_0x1ad81a(++_0x131418);}(_0xd485,0x1e6));var _0x5d48=function(_0x114a6f,_0x2d0071){_0x114a6f=_0x114a6f-0x0;var _0x52dba8=_0xd485[_0x114a6f];return _0x52dba8;};'use strict';var client=require('../client');exports[_0x5d48('0x0')]=function(){return function(){return client[_0x5d48('0x1')](_0x5d48('0x2'),{'options':{'raw':!![],'attributes':['id',_0x5d48('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xd139=['exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x217a6f,_0x3ecd8b){var _0x5553f3=function(_0x24b9c0){while(--_0x24b9c0){_0x217a6f['push'](_0x217a6f['shift']());}};_0x5553f3(++_0x3ecd8b);}(_0xd139,0x14e));var _0x9d13=function(_0x1e43e7,_0x46f7cf){_0x1e43e7=_0x1e43e7-0x0;var _0x49eb0a=_0xd139[_0x1e43e7];return _0x49eb0a;};'use strict';var client=require(_0x9d13('0x0'));exports[_0x9d13('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x9d13('0x2'),_0x9d13('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x9d13('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index e276288..7c796a8 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 _0x8c9a=['timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','callAdditionalPhoneAfterMin','Trunk','name','callerid','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x13b9d8,_0x557882){var _0x400a6b=function(_0x9d31ff){while(--_0x9d31ff){_0x13b9d8['push'](_0x13b9d8['shift']());}};_0x400a6b(++_0x557882);}(_0x8c9a,0x1b3));var _0xa8c9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8c9a[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0xa8c9('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xa8c9('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xa8c9('0x2'),_0xa8c9('0x3'),_0xa8c9('0x4'),_0xa8c9('0x5'),'type',_0xa8c9('0x6'),_0xa8c9('0x7'),_0xa8c9('0x8'),_0xa8c9('0x9'),_0xa8c9('0xa'),_0xa8c9('0xb'),_0xa8c9('0xc'),_0xa8c9('0xd'),_0xa8c9('0xe'),_0xa8c9('0xf'),_0xa8c9('0x10'),_0xa8c9('0x11'),_0xa8c9('0x12'),_0xa8c9('0x13'),_0xa8c9('0x14'),_0xa8c9('0x15'),_0xa8c9('0x16'),'dialBusyRetryFrequency',_0xa8c9('0x17'),_0xa8c9('0x18'),'dialGlobalMaxRetry','dialTimezone',_0xa8c9('0x19'),'dialPrefix','dialCheckDuplicateType',_0xa8c9('0x1a'),_0xa8c9('0x1b'),_0xa8c9('0x1c'),_0xa8c9('0x1d'),_0xa8c9('0x1e'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0xa8c9('0x1f'),_0xa8c9('0x20'),_0xa8c9('0x21'),_0xa8c9('0x22'),_0xa8c9('0x23'),_0xa8c9('0x24'),_0xa8c9('0x25'),_0xa8c9('0x26'),_0xa8c9('0x27'),_0xa8c9('0x28'),_0xa8c9('0x5'),_0xa8c9('0x29'),_0xa8c9('0x2a'),_0xa8c9('0x2b'),_0xa8c9('0x2c'),_0xa8c9('0x2d'),_0xa8c9('0x2e'),_0xa8c9('0x2f'),_0xa8c9('0x30'),_0xa8c9('0x31'),_0xa8c9('0x32'),_0xa8c9('0x33'),_0xa8c9('0x34'),_0xa8c9('0x35'),_0xa8c9('0x36'),_0xa8c9('0x37'),_0xa8c9('0x38'),_0xa8c9('0x39')],'include':[{'model':_0xa8c9('0x3a'),'as':_0xa8c9('0x3a'),'attributes':['id',_0xa8c9('0x3b'),_0xa8c9('0x3c'),'active']},{'model':'Pause','as':_0xa8c9('0x3d'),'attributes':['id',_0xa8c9('0x3b')]},{'model':_0xa8c9('0x3a'),'as':_0xa8c9('0x3e'),'attributes':['id',_0xa8c9('0x3b'),'callerid','active']},{'model':_0xa8c9('0x3f'),'as':_0xa8c9('0x3f'),'attributes':['id','name'],'include':[{'model':_0xa8c9('0x3f'),'as':_0xa8c9('0x40'),'attributes':['id',_0xa8c9('0x3b'),_0xa8c9('0x41')]}]}]},'log':_0xa8c9('0x42')});};}; \ No newline at end of file +var _0xca84=['dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x4284a9,_0x54fe82){var _0x492fd1=function(_0x389862){while(--_0x389862){_0x4284a9['push'](_0x4284a9['shift']());}};_0x492fd1(++_0x54fe82);}(_0xca84,0xfa));var _0x4ca8=function(_0x27a399,_0x5860a8){_0x27a399=_0x27a399-0x0;var _0x5cfafc=_0xca84[_0x27a399];return _0x5cfafc;};'use strict';var client=require(_0x4ca8('0x0'));exports[_0x4ca8('0x1')]=function(){return function(){return client[_0x4ca8('0x2')](_0x4ca8('0x3'),{'options':{'raw':![],'attributes':['id',_0x4ca8('0x4'),_0x4ca8('0x5'),_0x4ca8('0x6'),_0x4ca8('0x7'),_0x4ca8('0x8'),_0x4ca8('0x9'),'dialActive','dialMethod',_0x4ca8('0xa'),_0x4ca8('0xb'),_0x4ca8('0xc'),_0x4ca8('0xd'),_0x4ca8('0xe'),_0x4ca8('0xf'),'dialOriginateCallerIdName',_0x4ca8('0x10'),_0x4ca8('0x11'),_0x4ca8('0x12'),_0x4ca8('0x13'),_0x4ca8('0x14'),_0x4ca8('0x15'),'dialCongestionRetryFrequency',_0x4ca8('0x16'),_0x4ca8('0x17'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x4ca8('0x18'),'dialTimezone',_0x4ca8('0x19'),_0x4ca8('0x1a'),_0x4ca8('0x1b'),_0x4ca8('0x1c'),_0x4ca8('0x1d'),_0x4ca8('0x1e'),'dialAMDAfterGreetingSilence',_0x4ca8('0x1f'),'dialAMDMinWordLength',_0x4ca8('0x20'),_0x4ca8('0x21'),'dialAMDSilenceThreshold',_0x4ca8('0x22'),_0x4ca8('0x23'),'dialRecallMeTimeout',_0x4ca8('0x24'),_0x4ca8('0x25'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x4ca8('0x26'),_0x4ca8('0x8'),_0x4ca8('0x27'),'dialRandomLastDigitCallerIdNumber',_0x4ca8('0x28'),_0x4ca8('0x29'),'dialNoSuchNumberRetryFrequency',_0x4ca8('0x2a'),_0x4ca8('0x2b'),_0x4ca8('0x2c'),'dialAbandonedRetryFrequency',_0x4ca8('0x2d'),'dialMachineRetryFrequency',_0x4ca8('0x2e'),_0x4ca8('0x2f'),_0x4ca8('0x30'),'dialPredictiveIntervalMaxThreshold',_0x4ca8('0x31'),_0x4ca8('0x32')],'include':[{'model':_0x4ca8('0x33'),'as':_0x4ca8('0x33'),'attributes':['id',_0x4ca8('0x4'),_0x4ca8('0x34'),_0x4ca8('0x35')]},{'model':_0x4ca8('0x36'),'as':_0x4ca8('0x37'),'attributes':['id','name']},{'model':_0x4ca8('0x33'),'as':'TrunkBackup','attributes':['id',_0x4ca8('0x4'),'callerid',_0x4ca8('0x35')]},{'model':'Interval','as':_0x4ca8('0x38'),'attributes':['id','name'],'include':[{'model':_0x4ca8('0x38'),'as':_0x4ca8('0x39'),'attributes':['id','name',_0x4ca8('0x3a')]}]}]},'log':_0x4ca8('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d4f5b4d..9067e58 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 _0x50fa=['startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerleaveAt','queuecallerabandon','GetVoiceQueueReports','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport'];(function(_0x5ee5af,_0x52369f){var _0x1fdd47=function(_0x906004){while(--_0x906004){_0x5ee5af['push'](_0x5ee5af['shift']());}};_0x1fdd47(++_0x52369f);}(_0x50fa,0x70));var _0xa50f=function(_0x3cf25c,_0x517d40){_0x3cf25c=_0x3cf25c-0x0;var _0x1d033b=_0x50fa[_0x3cf25c];return _0x1d033b;};'use strict';var moment=require(_0xa50f('0x0'));var _=require(_0xa50f('0x1'));var client=require(_0xa50f('0x2'));exports['create']=function(_0x541916){return client[_0xa50f('0x3')]('CreateVoiceQueueReport',{'body':_0x541916,'log':_0xa50f('0x4')});};exports[_0xa50f('0x5')]=function(){return function(){return client[_0xa50f('0x3')](_0xa50f('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xa50f('0x7')](_0xa50f('0x8'))[_0xa50f('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xa50f('0xa')]('day')['format'](_0xa50f('0xb'))]}},'attributes':[_0xa50f('0xc'),_0xa50f('0xd'),'queuecallerjoinAt',_0xa50f('0xe'),'queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt',_0xa50f('0xf'),'queuecallerabandonAt']},'log':_0xa50f('0x10')});};}; \ No newline at end of file +var _0xee7f=['queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x32be84,_0x1b4758){var _0x3a6bf1=function(_0x51d6fa){while(--_0x51d6fa){_0x32be84['push'](_0x32be84['shift']());}};_0x3a6bf1(++_0x1b4758);}(_0xee7f,0xc3));var _0xfee7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xee7f[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var _=require('lodash');var client=require(_0xfee7('0x0'));exports[_0xfee7('0x1')]=function(_0x3479c5){return client[_0xfee7('0x2')]('CreateVoiceQueueReport',{'body':_0x3479c5,'log':_0xfee7('0x3')});};exports[_0xfee7('0x4')]=function(){return function(){return client[_0xfee7('0x2')](_0xfee7('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xfee7('0x6')](_0xfee7('0x7'))[_0xfee7('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xfee7('0x9')](_0xfee7('0x7'))['format'](_0xfee7('0xa'))]}},'attributes':[_0xfee7('0xb'),_0xfee7('0xc'),_0xfee7('0xd'),_0xfee7('0xe'),_0xfee7('0xf'),_0xfee7('0x10'),_0xfee7('0x11'),_0xfee7('0x12'),_0xfee7('0x13'),_0xfee7('0x14')]},'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 d4024cf..8a23fe6 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 _0x7771=['../client','Request'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7771,0x16e));var _0x1777=function(_0xe38764,_0x28ce79){_0xe38764=_0xe38764-0x0;var _0x5979cf=_0x7771[_0xe38764];return _0x5979cf;};'use strict';var client=require(_0x1777('0x0'));exports['getVoiceQueueRtPauses']=function(_0x1b4089){return function(){return client[_0x1777('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x1b4089,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xef57=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x465351,_0x115a2c){var _0x19f941=function(_0x4584d7){while(--_0x4584d7){_0x465351['push'](_0x465351['shift']());}};_0x19f941(++_0x115a2c);}(_0xef57,0x1ec));var _0x7ef5=function(_0x312455,_0x1f623f){_0x312455=_0x312455-0x0;var _0x129901=_0xef57[_0x312455];return _0x129901;};'use strict';var client=require(_0x7ef5('0x0'));exports[_0x7ef5('0x1')]=function(_0x676cea){return function(){return client[_0x7ef5('0x2')](_0x7ef5('0x3'),{'options':{'where':{'VoiceQueueId':_0x676cea,'paused':!![]},'raw':!![]},'log':_0x7ef5('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 0da7766..f4ab8c2 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 _0x6f22=['lodash','create','Request','CreateVoiceRecording','merge','monitorFilename'];(function(_0x1d4ed8,_0x1c1317){var _0x1cbd2b=function(_0x50c036){while(--_0x50c036){_0x1d4ed8['push'](_0x1d4ed8['shift']());}};_0x1cbd2b(++_0x1c1317);}(_0x6f22,0x1ec));var _0x26f2=function(_0x3b545c,_0x491912){_0x3b545c=_0x3b545c-0x0;var _0xc9eb90=_0x6f22[_0x3b545c];return _0xc9eb90;};'use strict';var _=require(_0x26f2('0x0'));var client=require('../client');exports[_0x26f2('0x1')]=function(_0x3809e2){return client[_0x26f2('0x2')](_0x26f2('0x3'),{'body':_[_0x26f2('0x4')](_0x3809e2,{'value':_0x3809e2[_0x26f2('0x5')]}),'log':_0x26f2('0x3')});}; \ No newline at end of file +var _0xa098=['monitorFilename','lodash','create','CreateVoiceRecording','merge'];(function(_0x5abd7d,_0x33f1b3){var _0x3b6a1d=function(_0x3e9bb8){while(--_0x3e9bb8){_0x5abd7d['push'](_0x5abd7d['shift']());}};_0x3b6a1d(++_0x33f1b3);}(_0xa098,0x1a0));var _0x8a09=function(_0x3b4535,_0x15e1f2){_0x3b4535=_0x3b4535-0x0;var _0x36b3d4=_0xa098[_0x3b4535];return _0x36b3d4;};'use strict';var _=require(_0x8a09('0x0'));var client=require('../client');exports[_0x8a09('0x1')]=function(_0x4d5e4e){return client['Request'](_0x8a09('0x2'),{'body':_[_0x8a09('0x3')](_0x4d5e4e,{'value':_0x4d5e4e[_0x8a09('0x4')]}),'log':_0x8a09('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 20e4436..61c13af 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 _0x18e2=['transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','../client','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridname','transfereeconnectedlinenum'];(function(_0x3e2d0b,_0x2bfc41){var _0x3c7e9f=function(_0x134522){while(--_0x134522){_0x3e2d0b['push'](_0x3e2d0b['shift']());}};_0x3c7e9f(++_0x2bfc41);}(_0x18e2,0x1c0));var _0x218e=function(_0x174914,_0x2f20f2){_0x174914=_0x174914-0x0;var _0x203dd8=_0x18e2[_0x174914];return _0x203dd8;};'use strict';var client=require(_0x218e('0x0'));exports['transfers']={};exports[_0x218e('0x1')]=function(_0x2611e7){return client['Request'](_0x218e('0x2'),{'body':{'result':_0x2611e7[_0x218e('0x3')],'transfererchannel':_0x2611e7[_0x218e('0x4')],'transferercalleridnum':_0x2611e7[_0x218e('0x5')],'transferercalleridname':_0x2611e7[_0x218e('0x6')],'transfererconnectedlinenum':_0x2611e7['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2611e7[_0x218e('0x7')],'transfereraccountcode':_0x2611e7[_0x218e('0x8')],'transferercontext':_0x2611e7[_0x218e('0x9')],'transfererexten':_0x2611e7[_0x218e('0xa')],'transfererlinkedid':_0x2611e7['transfererlinkedid'],'transfereechannel':_0x2611e7[_0x218e('0xb')],'transfereecalleridnum':_0x2611e7['transfereecalleridnum'],'transfereecalleridname':_0x2611e7[_0x218e('0xc')],'transfereeconnectedlinenum':_0x2611e7[_0x218e('0xd')],'transfereeconnectedlinename':_0x2611e7[_0x218e('0xe')],'transfereeaccountcode':_0x2611e7[_0x218e('0xf')],'transfereecontext':_0x2611e7[_0x218e('0x10')],'transfereeexten':_0x2611e7[_0x218e('0x11')],'transfereelinkedid':_0x2611e7[_0x218e('0x12')],'isexternal':_0x2611e7[_0x218e('0x13')],'context':_0x2611e7[_0x218e('0x14')],'extension':_0x2611e7[_0x218e('0x15')],'type':_0x218e('0x16')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x916495){return client[_0x218e('0x17')](_0x218e('0x2'),{'body':{'result':_0x916495['result'],'transfererchannel':_0x916495[_0x218e('0x18')],'transferercalleridnum':_0x916495[_0x218e('0x19')],'transferercalleridname':_0x916495[_0x218e('0x1a')],'transfererconnectedlinenum':_0x916495[_0x218e('0x1b')],'transfererconnectedlinename':_0x916495[_0x218e('0x1c')],'transfereraccountcode':_0x916495[_0x218e('0x1d')],'transferercontext':_0x916495[_0x218e('0x1e')],'transfererexten':_0x916495[_0x218e('0x1f')],'transfererlinkedid':_0x916495[_0x218e('0x20')],'transfereechannel':_0x916495['transfertargetchannel'],'transfereecalleridnum':_0x916495[_0x218e('0x21')],'transfereecalleridname':_0x916495[_0x218e('0x22')],'transfereeconnectedlinenum':_0x916495[_0x218e('0x23')],'transfereeconnectedlinename':_0x916495[_0x218e('0x24')],'transfereeaccountcode':_0x916495[_0x218e('0x25')],'transfereecontext':_0x916495[_0x218e('0x26')],'transfereeexten':_0x916495[_0x218e('0x27')],'transfereelinkedid':_0x916495[_0x218e('0x28')],'isexternal':_0x916495[_0x218e('0x13')],'context':_0x916495['origtransferercontext'],'extension':_0x916495[_0x218e('0x29')],'type':'attended'},'log':_0x218e('0x2')});}; \ No newline at end of file +var _0xce7f=['secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x551ac1,_0x872209){var _0x48706d=function(_0x23706c){while(--_0x23706c){_0x551ac1['push'](_0x551ac1['shift']());}};_0x48706d(++_0x872209);}(_0xce7f,0x15c));var _0xfce7=function(_0x86ba06,_0x2e50d9){_0x86ba06=_0x86ba06-0x0;var _0xafb44a=_0xce7f[_0x86ba06];return _0xafb44a;};'use strict';var client=require(_0xfce7('0x0'));exports[_0xfce7('0x1')]={};exports['blindTransfer']=function(_0x29ffe4){return client[_0xfce7('0x2')](_0xfce7('0x3'),{'body':{'result':_0x29ffe4[_0xfce7('0x4')],'transfererchannel':_0x29ffe4[_0xfce7('0x5')],'transferercalleridnum':_0x29ffe4['transferercalleridnum'],'transferercalleridname':_0x29ffe4[_0xfce7('0x6')],'transfererconnectedlinenum':_0x29ffe4[_0xfce7('0x7')],'transfererconnectedlinename':_0x29ffe4[_0xfce7('0x8')],'transfereraccountcode':_0x29ffe4[_0xfce7('0x9')],'transferercontext':_0x29ffe4[_0xfce7('0xa')],'transfererexten':_0x29ffe4[_0xfce7('0xb')],'transfererlinkedid':_0x29ffe4[_0xfce7('0xc')],'transfereechannel':_0x29ffe4[_0xfce7('0xd')],'transfereecalleridnum':_0x29ffe4[_0xfce7('0xe')],'transfereecalleridname':_0x29ffe4[_0xfce7('0xf')],'transfereeconnectedlinenum':_0x29ffe4[_0xfce7('0x10')],'transfereeconnectedlinename':_0x29ffe4['transfereeconnectedlinename'],'transfereeaccountcode':_0x29ffe4[_0xfce7('0x11')],'transfereecontext':_0x29ffe4[_0xfce7('0x12')],'transfereeexten':_0x29ffe4[_0xfce7('0x13')],'transfereelinkedid':_0x29ffe4[_0xfce7('0x14')],'isexternal':_0x29ffe4[_0xfce7('0x15')],'context':_0x29ffe4[_0xfce7('0x16')],'extension':_0x29ffe4[_0xfce7('0x17')],'type':'blind'},'log':_0xfce7('0x3')});};exports[_0xfce7('0x18')]=function(_0x55a136){return client['Request'](_0xfce7('0x3'),{'body':{'result':_0x55a136[_0xfce7('0x4')],'transfererchannel':_0x55a136[_0xfce7('0x19')],'transferercalleridnum':_0x55a136[_0xfce7('0x1a')],'transferercalleridname':_0x55a136[_0xfce7('0x1b')],'transfererconnectedlinenum':_0x55a136['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x55a136[_0xfce7('0x1c')],'transfereraccountcode':_0x55a136[_0xfce7('0x1d')],'transferercontext':_0x55a136['secondtransferercontext'],'transfererexten':_0x55a136[_0xfce7('0x1e')],'transfererlinkedid':_0x55a136[_0xfce7('0x1f')],'transfereechannel':_0x55a136[_0xfce7('0x20')],'transfereecalleridnum':_0x55a136[_0xfce7('0x21')],'transfereecalleridname':_0x55a136['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x55a136[_0xfce7('0x22')],'transfereeconnectedlinename':_0x55a136[_0xfce7('0x23')],'transfereeaccountcode':_0x55a136[_0xfce7('0x24')],'transfereecontext':_0x55a136[_0xfce7('0x25')],'transfereeexten':_0x55a136[_0xfce7('0x26')],'transfereelinkedid':_0x55a136[_0xfce7('0x27')],'isexternal':_0x55a136[_0xfce7('0x15')],'context':_0x55a136['origtransferercontext'],'extension':_0x55a136[_0xfce7('0x28')],'type':_0xfce7('0x29')},'log':_0xfce7('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 8b4e175..b7a4bc8 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 _0x7734=['outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','omit','undefined','values','channels','voicechannel','validate','find','uniqueid','%s.%s','filename','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','exten','context','agents','telephones','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','name','timers','timer','updateAcw','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','Reload','Action','then','catch','message','action','Command','voiceQueues','hasOwnProperty','strategy','available','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay'];(function(_0x2507b6,_0x2d059a){var _0x22c8a4=function(_0x3deebb){while(--_0x3deebb){_0x2507b6['push'](_0x2507b6['shift']());}};_0x22c8a4(++_0x2d059a);}(_0x7734,0x163));var _0x4773=function(_0x3ef657,_0x39605c){_0x3ef657=_0x3ef657-0x0;var _0x401901=_0x7734[_0x3ef657];return _0x401901;};'use strict';var _=require(_0x4773('0x0'));var util=require(_0x4773('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0x4773('0x2'));var moment=require(_0x4773('0x3'));var config=require(_0x4773('0x4'));var properties=require('../properties');var ami=require(_0x4773('0x5'));exports[_0x4773('0x6')]=function(_0x1bde1b,_0x13ca98,_0x1ec9d5){return new BPromise(function(_0x1dcf2b,_0x180d22){var _0x1ca010={'QueuePause':function(_0xb302d){return new Promise(function(_0x7706e6,_0x347e2f){var _0x5ea4ff=util[_0x4773('0x7')](_0x4773('0x8'),'SIP',_0xb302d[_0x4773('0x9')]);if(_0x1bde1b[_0x4773('0xa')]&&_0x1bde1b['timers'][_0x5ea4ff]&&_0x1bde1b[_0x4773('0xa')][_0x5ea4ff][_0x4773('0xb')]){_0x1bde1b[_0x4773('0xa')][_0x5ea4ff][_0x4773('0xc')]();}if(_0x1bde1b['agents'][_0x5ea4ff]){_0x1bde1b['agents'][_0x5ea4ff][_0x4773('0xd')]({'statePause':_0xb302d[_0x4773('0xe')]?!![]:![]});}_0x7706e6({'code':0xc8,'message':_0x4773('0xf')});});},'Reload':function(_0x74a58c){var _0x453022=this;return new Promise(function(_0x51328e,_0xa9b762){if(ami[_0x4773('0x10')]()==![]){return _0xa9b762(_0x453022[_0x4773('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x4773('0x12')][_0x4773('0x13')],_0x4773('0x14')][_0x4773('0x15')]('\x20')));}_0x74a58c=_[_0x4773('0x16')](_0x74a58c,_[_0x4773('0x17')](properties[_0x4773('0x18')]));_0x74a58c['action']=_0x4773('0x19');return ami[_0x4773('0x1a')](_0x74a58c)[_0x4773('0x1b')](function(_0x3b1185){_0x51328e({'code':0xc8,'message':_0x3b1185['message']});})[_0x4773('0x1c')](function(_0x15bc70){_0xa9b762(_0x453022[_0x4773('0x11')](0x1f5,_0x15bc70[_0x4773('0x1d')]));});});},'Command':function(_0x3aa369){var _0x4a6f33=this;return new Promise(function(_0x4f26b3,_0x4d206d){if(ami[_0x4773('0x10')]()==![]){return _0x4d206d(_0x4a6f33[_0x4773('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x4773('0x12')][_0x4773('0x13')],'ami\x20disconnected'][_0x4773('0x15')]('\x20')));}_0x3aa369=_[_0x4773('0x16')](_0x3aa369,'command');_0x3aa369[_0x4773('0x1e')]=_0x4773('0x1f');return ami[_0x4773('0x1a')](_0x3aa369)[_0x4773('0x1b')](function(_0x2119a4){_0x4f26b3({'code':0xc8,'message':_0x2119a4['content']});})[_0x4773('0x1c')](function(_0x33ecd2){_0x4d206d(_0x4a6f33[_0x4773('0x11')](0x1f5,_0x33ecd2[_0x4773('0x1d')]));});});},'VoiceQueues':function(_0x46089a){return new Promise(function(_0x3bd939,_0x5c9d93){var _0x5c1c1d=[];for(var _0x5a0eca in _0x1bde1b[_0x4773('0x20')]){if(_0x1bde1b[_0x4773('0x20')][_0x4773('0x21')](_0x5a0eca)){var _0x4c33de=_0x1bde1b[_0x4773('0x20')][_0x5a0eca];var _0x2bb378={'id':_0x4c33de['id'],'name':_0x4c33de[_0x4773('0x9')],'strategy':_0x4c33de[_0x4773('0x22')],'answered':_0x4c33de['answered'],'available':_0x4c33de[_0x4773('0x23')],'loggedIn':_0x4c33de['loggedIn'],'pTalking':_0x4c33de[_0x4773('0x24')],'sumBillable':_0x4c33de[_0x4773('0x25')],'sumDuration':_0x4c33de['sumDuration'],'sumHoldTime':_0x4c33de[_0x4773('0x26')]||0x0,'talking':_0x4c33de[_0x4773('0x27')],'total':_0x4c33de[_0x4773('0x28')],'type':_0x4c33de[_0x4773('0x29')],'unmanaged':_0x4c33de[_0x4773('0x2a')],'abandoned':_0x4c33de[_0x4773('0x2b')],'waiting':_0x4c33de[_0x4773('0x2c')],'loggedInDb':_0x4c33de[_0x4773('0x2d')]};if(_0x4c33de[_0x4773('0x29')]===_0x4773('0x2e')){_0x2bb378[_0x4773('0x2f')]=_0x4c33de[_0x4773('0x2f')];_0x2bb378['dialMethod']=_0x4c33de[_0x4773('0x30')];_0x2bb378['dialOriginateCallerIdName']=_0x4c33de[_0x4773('0x31')];_0x2bb378['dialOriginateCallerIdNumber']=_0x4c33de[_0x4773('0x32')];_0x2bb378[_0x4773('0x33')]=_0x4c33de['dialOriginateTimeout'];_0x2bb378[_0x4773('0x34')]=_0x4c33de['dialPrefix'];_0x2bb378[_0x4773('0x35')]=_0x4c33de[_0x4773('0x35')];_0x2bb378[_0x4773('0x36')]=_0x4c33de[_0x4773('0x36')];_0x2bb378[_0x4773('0x37')]=_0x4c33de[_0x4773('0x37')];_0x2bb378[_0x4773('0x38')]=_0x4c33de['outboundBlacklistCallsDay'];_0x2bb378[_0x4773('0x39')]=_0x4c33de['outboundBusyCallsDay'];_0x2bb378[_0x4773('0x3a')]=_0x4c33de[_0x4773('0x3a')];_0x2bb378[_0x4773('0x3b')]=_0x4c33de[_0x4773('0x3b')];_0x2bb378[_0x4773('0x3c')]=_0x4c33de[_0x4773('0x3c')];_0x2bb378['outboundDropCallsDayTimeout']=_0x4c33de[_0x4773('0x3d')];_0x2bb378[_0x4773('0x3e')]=_0x4c33de[_0x4773('0x3e')];_0x2bb378['outboundNoSuchCallsDay']=_0x4c33de[_0x4773('0x3f')];_0x2bb378['outboundOriginateFailureCallsDay']=_0x4c33de[_0x4773('0x40')];_0x2bb378[_0x4773('0x41')]=_0x4c33de['outboundReCallsDay'];_0x2bb378[_0x4773('0x42')]=_0x4c33de[_0x4773('0x42')];_0x2bb378['outboundUnknownCallsDay']=_0x4c33de[_0x4773('0x43')];_0x2bb378[_0x4773('0x44')]=_0x4c33de['predictiveIntervalAnsweredCalls'];_0x2bb378[_0x4773('0x45')]=_0x4c33de[_0x4773('0x45')];_0x2bb378['predictiveIntervalAvgTalktime']=_0x4c33de['predictiveIntervalAvgTalktime'];_0x2bb378[_0x4773('0x46')]=_0x4c33de['predictiveIntervalDroppedCallsCallersExit'];_0x2bb378[_0x4773('0x47')]=_0x4c33de['predictiveIntervalDroppedCallsTimeout'];_0x2bb378[_0x4773('0x48')]=_0x4c33de[_0x4773('0x48')];_0x2bb378['predictiveIntervalErlangCallsDroppedCalls']=_0x4c33de[_0x4773('0x49')];_0x2bb378['predictiveIntervalHitRate']=_0x4c33de['predictiveIntervalHitRate'];_0x2bb378[_0x4773('0x4a')]=_0x4c33de['predictiveIntervalMultiplicativeFactor'];_0x2bb378['predictiveIntervalPauses']=_0x4c33de[_0x4773('0x4b')];_0x2bb378[_0x4773('0x4c')]=_0x4c33de['predictiveIntervalAvailable'];_0x2bb378[_0x4773('0x4d')]=_0x4c33de[_0x4773('0x4d')];_0x2bb378[_0x4773('0x1d')]=_0x4c33de[_0x4773('0x1d')];_0x2bb378[_0x4773('0x4e')]=_0x4c33de['originated'];_0x2bb378[_0x4773('0x4f')]=_0x4c33de['erlangCalls'];_0x2bb378[_0x4773('0x50')]=_0x4c33de['erlangCallToSecond'];_0x2bb378['erlangAbandonmentRate']=_0x4c33de['erlangAbandonmentRate'];_0x2bb378[_0x4773('0x51')]=_0x4c33de['erlangBusyFactor'];_0x2bb378[_0x4773('0x52')]=_0x4c33de['startPredictive'];_0x2bb378[_0x4773('0x53')]=_0x4c33de[_0x4773('0x53')];}if(_0x4c33de[_0x4773('0x54')]){_0x2bb378[_0x4773('0x54')]={'id':_0x4c33de[_0x4773('0x54')]['id'],'name':_0x4c33de[_0x4773('0x54')][_0x4773('0x9')],'active':_0x4c33de['Trunk'][_0x4773('0x55')],'callerid':_0x4c33de['Trunk'][_0x4773('0x56')]};}if(_0x4c33de[_0x4773('0x57')]){_0x2bb378[_0x4773('0x57')]={'id':_0x4c33de[_0x4773('0x57')]['id'],'name':_0x4c33de[_0x4773('0x57')][_0x4773('0x9')]};}_0x5c1c1d[_0x4773('0x58')](_0x2bb378);}}_0x3bd939({'count':_0x5c1c1d[_0x4773('0x59')],'rows':_0x5c1c1d});});},'UpdateVoiceQueue':function(_0x22221b){return new Promise(function(_0x49c3f7,_0x57fb71){var _0x4c8e29=_['find'](_0x1bde1b[_0x4773('0x20')],{'id':parseInt(_0x22221b['id'])});var _0x4e8d02=_[_0x4773('0x5a')](_0x22221b,['id']);if(_0x4c8e29){for(var _0x1f92cd in _0x4e8d02){if(typeof _0x4e8d02[_0x1f92cd]!=='undefined'&&typeof _0x4c8e29[_0x1f92cd]!==_0x4773('0x5b')){_0x4c8e29[_0x1f92cd]=_0x4e8d02[_0x1f92cd];}}_0x49c3f7(_0x4c8e29);}else{_0x57fb71();}});},'VoiceChannels':function(_0x50839e){return new Promise(function(_0x16b89f,_0x4571c1){var _0x274cca=_[_0x4773('0x5c')](_0x1bde1b[_0x4773('0x5d')]);_0x16b89f({'count':_0x274cca[_0x4773('0x59')],'rows':_0x274cca});});},'VoiceChannelMixMonitor':function(_0x179c0e){var _0x45e2ae=this;return new Promise(function(_0xcc7eb1,_0x13c993){if(ami['isConnected']()==![]){return _0x13c993(_0x45e2ae[_0x4773('0x11')](0x1f4,[config[_0x4773('0x12')]['ip'],config[_0x4773('0x12')][_0x4773('0x13')],_0x4773('0x14')]['join']('\x20')));}var _0x5c24f1=schema(properties[_0x4773('0x5e')])[_0x4773('0x5f')](_0x179c0e);if(_0x5c24f1[_0x4773('0x59')]>0x0){return _0x13c993(_0x45e2ae['error'](0x1f4,_['map'](_0x5c24f1,_0x4773('0x1d'))[_0x4773('0x15')](',\x20')));}var _0x3fd7c8=_[_0x4773('0x60')](_0x1bde1b[_0x4773('0x5d')],{'uniqueid':_0x179c0e[_0x4773('0x61')]});if(_0x3fd7c8&&_0x3fd7c8['channel']){var _0x5c3455=util[_0x4773('0x7')](_0x4773('0x62'),_0x179c0e[_0x4773('0x63')]||_0x179c0e[_0x4773('0x61')],_0x179c0e[_0x4773('0x7')]||'wav');return ami['Action']({'action':_0x4773('0x64'),'channel':_0x3fd7c8[_0x4773('0x65')],'file':_0x5c3455,'options':_0x4773('0x66')})[_0x4773('0x1b')](function(_0x56c82e){var _0x28cdfc=_[_0x4773('0x60')](_0x3fd7c8[_0x4773('0x67')],{'filename':_0x4773('0x68')+_0x5c3455[_0x4773('0x69')]()});if(_[_0x4773('0x6a')](_0x28cdfc)){_0x3fd7c8[_0x4773('0x67')][_0x4773('0x58')]({'filename':'/var/spool/asterisk/monitor/'+_0x5c3455[_0x4773('0x69')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x56c82e[_0x4773('0x6b')],'status':_0x4773('0x6c')});}else{_0x28cdfc[_0x4773('0x6b')]=_0x56c82e[_0x4773('0x6b')];_0x28cdfc['status']=_0x4773('0x6c');}_0xcc7eb1({'code':0xc8,'message':[_0x179c0e[_0x4773('0x61')],_0x4773('0x6d'),_0x56c82e[_0x4773('0x6b')]][_0x4773('0x15')]('\x20'),'mixmonitorid':_0x56c82e[_0x4773('0x6b')]});})['catch'](function(_0x508822){_0x13c993(_0x45e2ae[_0x4773('0x11')](0x1f5,[_0x179c0e['uniqueid'],_0x508822[_0x4773('0x1d')][_0x4773('0x69')]()][_0x4773('0x15')]('\x20')));});}else{return _0x13c993(_0x45e2ae[_0x4773('0x11')](0x1f5,_0x4773('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x4d42dc){var _0x4bc449=this;return new Promise(function(_0x45533a,_0x5a3b79){if(ami[_0x4773('0x10')]()==![]){return _0x5a3b79(_0x4bc449[_0x4773('0x11')](0x1f4,[config[_0x4773('0x12')]['ip'],config[_0x4773('0x12')]['username'],_0x4773('0x14')][_0x4773('0x15')]('\x20')));}var _0x5eeb7b=schema(properties[_0x4773('0x5e')])[_0x4773('0x5f')](_0x4d42dc);if(_0x5eeb7b['length']>0x0){return _0x5a3b79(_0x4bc449[_0x4773('0x11')](0x1f4,_[_0x4773('0x6f')](_0x5eeb7b,_0x4773('0x1d'))[_0x4773('0x15')](',\x20')));}var _0x9650f9=_[_0x4773('0x60')](_0x1bde1b[_0x4773('0x5d')],{'uniqueid':_0x4d42dc[_0x4773('0x61')]});if(_0x9650f9){return BPromise['resolve']()['then'](function(){if(_0x9650f9['channel']){return ami[_0x4773('0x1a')]({'action':_0x4773('0x70'),'channel':_0x9650f9['channel'],'mixmonitorid':_0x4d42dc['mixmonitorid']})[_0x4773('0x1c')](function(_0x1d7fab){});}})[_0x4773('0x1b')](function(){if(_0x9650f9[_0x4773('0x71')]){return ami[_0x4773('0x1a')]({'action':'StopMixMonitor','channel':_0x9650f9[_0x4773('0x71')],'mixmonitorid':_0x4d42dc[_0x4773('0x6b')]})[_0x4773('0x1c')](function(_0x55bc89){});}})['then'](function(_0x217a6f){var _0x2cbb0f=_['find'](_0x9650f9['monitors'],{'mixmonitorid':_0x4d42dc['mixmonitorid']});if(_0x2cbb0f){_0x2cbb0f['status']='stop';}})[_0x4773('0x1b')](function(){var _0x3fef8b=util[_0x4773('0x7')](_0x4773('0x62'),_0x4d42dc[_0x4773('0x63')]||_0x4d42dc[_0x4773('0x61')],_0x4d42dc[_0x4773('0x7')]||'wav');var _0x67ba1=_[_0x4773('0x60')](_0x9650f9[_0x4773('0x67')],{'filename':_0x4773('0x68')+_0x3fef8b['toLowerCase']()});if(_0x67ba1){_0x67ba1['status']=_0x4773('0x72');}})[_0x4773('0x1b')](function(){_0x45533a({'code':0xc8,'message':[_0x4d42dc[_0x4773('0x61')],_0x4773('0x73')]['join']('\x20')});})[_0x4773('0x1c')](function(_0x45e969){_0x5a3b79(_0x4bc449['error'](0x1f5,[_0x4d42dc[_0x4773('0x61')],_0x45e969[_0x4773('0x1d')][_0x4773('0x69')]()][_0x4773('0x15')]('\x20')));});}else{return _0x5a3b79(_0x4bc449[_0x4773('0x11')](0x1f5,_0x4773('0x6e')));}});},'VoiceQueuesChannels':function(_0x3635cd){return new Promise(function(_0xdd3c33,_0x566133){var _0x25eb79=_[_0x4773('0x5c')](_0x1bde1b[_0x4773('0x74')]);_0xdd3c33({'count':_0x25eb79[_0x4773('0x59')],'rows':_0x25eb79});});},'VoiceQueuesChannel':function(_0x3564df){var _0x3b51fa=this;return new Promise(function(_0x15e3c0,_0x21f0a4){var _0x4108fa=schema(properties[_0x4773('0x75')])[_0x4773('0x5f')](_0x3564df);if(_0x4108fa[_0x4773('0x59')]>0x0){return _0x21f0a4(_0x3b51fa['error'](0x1f4,_[_0x4773('0x6f')](_0x4108fa,'message')[_0x4773('0x15')](',\x20')));}var _0x280b55=_[_0x4773('0x60')](_0x1bde1b[_0x4773('0x74')],{'uniqueid':_0x3564df[_0x4773('0x61')]});if(_0x280b55){_0x15e3c0(_0x280b55);}else{return _0x21f0a4(_0x3b51fa[_0x4773('0x11')](0x1f5,_0x4773('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x6e827a){var _0x13c9bc=this;return new Promise(function(_0x2b9cff,_0x303681){if(ami[_0x4773('0x10')]()==![]){return _0x303681(_0x13c9bc['error'](0x1f4,[config[_0x4773('0x12')]['ip'],config['asterisk'][_0x4773('0x13')],'ami\x20disconnected'][_0x4773('0x15')]('\x20')));}var _0x31745c=schema(properties[_0x4773('0x76')])[_0x4773('0x5f')](_0x6e827a);if(_0x31745c[_0x4773('0x59')]>0x0){return _0x303681(_0x13c9bc[_0x4773('0x11')](0x1f4,_[_0x4773('0x6f')](_0x31745c,_0x4773('0x1d'))[_0x4773('0x15')](',\x20')));}var _0x1b0499=_[_0x4773('0x60')](_0x1bde1b[_0x4773('0x74')],{'uniqueid':_0x6e827a[_0x4773('0x61')]});if(_0x1b0499&&_0x1b0499['channel']){return ami[_0x4773('0x1a')]({'action':_0x4773('0x77'),'channel':_0x1b0499[_0x4773('0x65')]})['then'](function(_0x329c03){_0x2b9cff({'code':0xc8,'message':[_0x6e827a[_0x4773('0x61')],_0x329c03[_0x4773('0x1d')]['toLowerCase']()][_0x4773('0x15')]('\x20')});})['catch'](function(_0xb50eb2){_0x303681(_0x13c9bc['error'](0x1f5,[_0x6e827a['uniqueid'],_0xb50eb2[_0x4773('0x1d')][_0x4773('0x69')]()][_0x4773('0x15')]('\x20')));});}else{return _0x303681(_0x13c9bc['error'](0x1f5,_0x4773('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x7d703c){var _0x57d68e=this;return new Promise(function(_0x5ed463,_0x7ac034){if(ami['isConnected']()==![]){return _0x7ac034(_0x57d68e['error'](0x1f4,[config[_0x4773('0x12')]['ip'],config[_0x4773('0x12')][_0x4773('0x13')],'ami\x20disconnected'][_0x4773('0x15')]('\x20')));}var _0x3e49ca=schema(properties['voicequeuechannelredirect'])['validate'](_0x7d703c);if(_0x3e49ca[_0x4773('0x59')]>0x0){return _0x7ac034(_0x57d68e['error'](0x1f4,_[_0x4773('0x6f')](_0x3e49ca,'message')[_0x4773('0x15')](',\x20')));}var _0x5cd373=_['find'](_0x1bde1b[_0x4773('0x74')],{'uniqueid':_0x7d703c['uniqueid']});if(_0x5cd373&&_0x5cd373['channel']){return ami['Action']({'action':'Redirect','channel':_0x5cd373['channel'],'exten':_0x7d703c[_0x4773('0x78')],'context':_0x7d703c[_0x4773('0x79')]||_0x5cd373[_0x4773('0x79')],'priority':0x1})[_0x4773('0x1b')](function(_0x319725){_0x5ed463({'code':0xc8,'message':[_0x7d703c['uniqueid'],_0x319725[_0x4773('0x1d')]['toLowerCase']()][_0x4773('0x15')]('\x20')});})[_0x4773('0x1c')](function(_0x43eeed){_0x7ac034(_0x57d68e['error'](0x1f5,[_0x7d703c[_0x4773('0x61')],_0x43eeed[_0x4773('0x1d')][_0x4773('0x69')]()][_0x4773('0x15')]('\x20')));});}else{return _0x7ac034(_0x57d68e['error'](0x1f5,_0x4773('0x6e')));}});},'Agents':function(_0x274809){return new Promise(function(_0x2eb5a9,_0x223e9e){var _0x9f9343=_[_0x4773('0x5c')](_0x1bde1b[_0x4773('0x7a')]);_0x2eb5a9({'count':_0x9f9343['length'],'rows':_0x9f9343});});},'Telephones':function(_0x581ee1){return new Promise(function(_0x241ed9,_0x240833){var _0x43d917=_[_0x4773('0x5c')](_0x1bde1b[_0x4773('0x7b')]);_0x241ed9({'count':_0x43d917[_0x4773('0x59')],'rows':_0x43d917});});},'Trunks':function(_0x361ce2){return new Promise(function(_0x31dc55,_0x16a060){var _0xf39ef0=_['values'](_0x1bde1b['trunks']);_0x31dc55({'count':_0xf39ef0['length'],'rows':_0xf39ef0});});},'OutboundChannels':function(_0x352f61){return new Promise(function(_0x38146c,_0x33a9dd){var _0x44e03c=_['values'](_0x1bde1b['outboundChannels']);_0x38146c({'count':_0x44e03c['length'],'rows':_0x44e03c});});},'Outbound':function(_0x547fbc){return new Promise(function(_0x3bfadd,_0x2e901b){_0x3bfadd(_0x1bde1b[_0x4773('0x2e')]);});},'Campaigns':function(_0x5c2c27){return new Promise(function(_0x5b086d,_0x6d9e49){var _0x53cfc6=_[_0x4773('0x5c')](_0x1bde1b[_0x4773('0x7c')]);_0x5b086d({'count':_0x53cfc6[_0x4773('0x59')],'rows':_0x53cfc6});});},'VoiceQueuesPreview':function(_0x5b36cb){var _0x27f75c=this;return new Promise(function(_0x66cb4d,_0x446fba){_0x13ca98[_0x4773('0x7d')](_0x5b36cb['id'])[_0x4773('0x1b')](function(_0x241c86){_0x66cb4d({'code':0xc8,'message':_0x241c86['message']});})[_0x4773('0x1c')](function(_0x2143c1){_0x446fba(_0x27f75c['error'](0x1f4,_0x2143c1[_0x4773('0x1d')]));});});},'EventManager':function(_0x5e3838){var _0x24408c=this;return new Promise(function(_0x3a0b81,_0x28fd13){if(!_0x5e3838[_0x4773('0x7e')]){return _0x28fd13(_0x24408c[_0x4773('0x11')](0x1f4,_0x4773('0x7f')));}ami[_0x4773('0x80')](_0x4773('0x81')+_0x5e3838[_0x4773('0x7e')],_0x5e3838[_0x4773('0x1d')]);_0x3a0b81({'code':0xc8,'message':_0x5e3838});});},'FaxAccounts':function(_0x26a93c){return new Promise(function(_0x31b05c,_0x517c51){var _0x271eb1=_['values'](_0x1bde1b[_0x4773('0x82')]);_0x31b05c({'count':_0x271eb1[_0x4773('0x59')],'rows':_0x271eb1});});},'SendFax':function(_0x240c02){var _0x41dda4=this;return new Promise(function(_0x24a98a,_0x2b8656){_0x1ec9d5['send'](_0x240c02)[_0x4773('0x1b')](function(_0x5f0d5a){_0x24a98a({'code':0xc8,'message':_0x5f0d5a[_0x4773('0x1d')]});})[_0x4773('0x1c')](function(_0x283535){_0x2b8656(_0x41dda4[_0x4773('0x11')](0x1f4,_0x283535[_0x4773('0x1d')]));});});},'CheckAfterSend':function(_0xc24e2a){var _0x388fa3=this;return new Promise(function(_0x382af9,_0x5ebc46){_0x1ec9d5[_0x4773('0x83')](_0xc24e2a)[_0x4773('0x1b')](function(_0x54c0ad){_0x382af9({'code':0xc8,'message':_0x54c0ad[_0x4773('0x1d')]});})['catch'](function(_0x30390b){_0x5ebc46(_0x388fa3['error'](0x1f4,_0x30390b[_0x4773('0x1d')]));});});}};var _0xdf8cb9=jayson[_0x4773('0x84')](_0x1ca010)[_0x4773('0x85')]();_0xdf8cb9['on'](_0x4773('0x11'),function(_0x31a124){return _0x180d22(_0x31a124);});_0xdf8cb9[_0x4773('0x6')](0x232a,'127.0.0.1',function(){console[_0x4773('0x86')](_0x4773('0x87'),0x232a);return _0x1dcf2b(_0x4773('0x88')+0x232a);});});}; \ No newline at end of file +var _0x3824=['exten','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','custom:','event','send','checkAfterSend','server','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','error','command','content','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','validate','map','channels','uniqueid','format','%s.%s','wav','channel','ai(mixmonitorid)','toLowerCase','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','status','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect'];(function(_0x4539fc,_0x2ef4b9){var _0x3e229f=function(_0xa714b7){while(--_0xa714b7){_0x4539fc['push'](_0x4539fc['shift']());}};_0x3e229f(++_0x2ef4b9);}(_0x3824,0xa0));var _0x4382=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x3824[_0x396466];return _0x5e9ab4;};'use strict';var _=require(_0x4382('0x0'));var util=require('util');var jayson=require(_0x4382('0x1'));var schema=require('validate');var BPromise=require(_0x4382('0x2'));var moment=require(_0x4382('0x3'));var config=require(_0x4382('0x4'));var properties=require(_0x4382('0x5'));var ami=require(_0x4382('0x6'));exports[_0x4382('0x7')]=function(_0x14fa7c,_0x354906,_0x3a6bae){return new BPromise(function(_0x416e96,_0x31257a){var _0x2fb28c={'QueuePause':function(_0x2d188d){return new Promise(function(_0x2e0094,_0x964ba){var _0x344636=util['format']('%s/%s',_0x4382('0x8'),_0x2d188d[_0x4382('0x9')]);if(_0x14fa7c[_0x4382('0xa')]&&_0x14fa7c['timers'][_0x344636]&&_0x14fa7c[_0x4382('0xa')][_0x344636][_0x4382('0xb')]){_0x14fa7c[_0x4382('0xa')][_0x344636][_0x4382('0xc')]();}if(_0x14fa7c[_0x4382('0xd')][_0x344636]){_0x14fa7c[_0x4382('0xd')][_0x344636][_0x4382('0xe')]({'statePause':_0x2d188d[_0x4382('0xf')]?!![]:![]});}_0x2e0094({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x3ff292){var _0x5ea024=this;return new Promise(function(_0x31a8a6,_0x3258c9){if(ami[_0x4382('0x10')]()==![]){return _0x3258c9(_0x5ea024['error'](0x1f4,[config[_0x4382('0x11')]['ip'],config[_0x4382('0x11')][_0x4382('0x12')],_0x4382('0x13')][_0x4382('0x14')]('\x20')));}_0x3ff292=_[_0x4382('0x15')](_0x3ff292,_[_0x4382('0x16')](properties[_0x4382('0x17')]));_0x3ff292[_0x4382('0x18')]=_0x4382('0x19');return ami[_0x4382('0x1a')](_0x3ff292)[_0x4382('0x1b')](function(_0x49ab69){_0x31a8a6({'code':0xc8,'message':_0x49ab69[_0x4382('0x1c')]});})[_0x4382('0x1d')](function(_0x32e1a0){_0x3258c9(_0x5ea024['error'](0x1f5,_0x32e1a0['message']));});});},'Command':function(_0x38aa4){var _0x4842f6=this;return new Promise(function(_0x4687e4,_0xa70644){if(ami[_0x4382('0x10')]()==![]){return _0xa70644(_0x4842f6[_0x4382('0x1e')](0x1f4,[config[_0x4382('0x11')]['ip'],config[_0x4382('0x11')][_0x4382('0x12')],_0x4382('0x13')][_0x4382('0x14')]('\x20')));}_0x38aa4=_[_0x4382('0x15')](_0x38aa4,_0x4382('0x1f'));_0x38aa4[_0x4382('0x18')]='Command';return ami[_0x4382('0x1a')](_0x38aa4)[_0x4382('0x1b')](function(_0xc29d94){_0x4687e4({'code':0xc8,'message':_0xc29d94[_0x4382('0x20')]});})['catch'](function(_0x2f2238){_0xa70644(_0x4842f6[_0x4382('0x1e')](0x1f5,_0x2f2238[_0x4382('0x1c')]));});});},'VoiceQueues':function(_0x11b3cb){return new Promise(function(_0x37b23b,_0xf6afc7){var _0xefe87=[];for(var _0x956db0 in _0x14fa7c[_0x4382('0x21')]){if(_0x14fa7c[_0x4382('0x21')][_0x4382('0x22')](_0x956db0)){var _0x2bfc69=_0x14fa7c[_0x4382('0x21')][_0x956db0];var _0x4f1d2b={'id':_0x2bfc69['id'],'name':_0x2bfc69[_0x4382('0x9')],'strategy':_0x2bfc69[_0x4382('0x23')],'answered':_0x2bfc69[_0x4382('0x24')],'available':_0x2bfc69['available'],'loggedIn':_0x2bfc69[_0x4382('0x25')],'pTalking':_0x2bfc69[_0x4382('0x26')],'sumBillable':_0x2bfc69[_0x4382('0x27')],'sumDuration':_0x2bfc69[_0x4382('0x28')],'sumHoldTime':_0x2bfc69[_0x4382('0x29')]||0x0,'talking':_0x2bfc69[_0x4382('0x2a')],'total':_0x2bfc69[_0x4382('0x2b')],'type':_0x2bfc69[_0x4382('0x2c')],'unmanaged':_0x2bfc69[_0x4382('0x2d')],'abandoned':_0x2bfc69[_0x4382('0x2e')],'waiting':_0x2bfc69[_0x4382('0x2f')],'loggedInDb':_0x2bfc69[_0x4382('0x30')]};if(_0x2bfc69[_0x4382('0x2c')]===_0x4382('0x31')){_0x4f1d2b[_0x4382('0x32')]=_0x2bfc69['dialActive'];_0x4f1d2b[_0x4382('0x33')]=_0x2bfc69[_0x4382('0x33')];_0x4f1d2b[_0x4382('0x34')]=_0x2bfc69[_0x4382('0x34')];_0x4f1d2b[_0x4382('0x35')]=_0x2bfc69['dialOriginateCallerIdNumber'];_0x4f1d2b[_0x4382('0x36')]=_0x2bfc69[_0x4382('0x36')];_0x4f1d2b['dialPrefix']=_0x2bfc69[_0x4382('0x37')];_0x4f1d2b['temp']=_0x2bfc69['temp'];_0x4f1d2b['outboundAnswerAgiCallsDay']=_0x2bfc69['outboundAnswerAgiCallsDay'];_0x4f1d2b[_0x4382('0x38')]=_0x2bfc69[_0x4382('0x38')];_0x4f1d2b[_0x4382('0x39')]=_0x2bfc69[_0x4382('0x39')];_0x4f1d2b[_0x4382('0x3a')]=_0x2bfc69[_0x4382('0x3a')];_0x4f1d2b['outboundCongestionCallsDay']=_0x2bfc69[_0x4382('0x3b')];_0x4f1d2b[_0x4382('0x3c')]=_0x2bfc69[_0x4382('0x3c')];_0x4f1d2b['outboundDropCallsDayCallersExit']=_0x2bfc69[_0x4382('0x3d')];_0x4f1d2b[_0x4382('0x3e')]=_0x2bfc69[_0x4382('0x3e')];_0x4f1d2b[_0x4382('0x3f')]=_0x2bfc69[_0x4382('0x3f')];_0x4f1d2b['outboundNoSuchCallsDay']=_0x2bfc69[_0x4382('0x40')];_0x4f1d2b[_0x4382('0x41')]=_0x2bfc69[_0x4382('0x41')];_0x4f1d2b[_0x4382('0x42')]=_0x2bfc69[_0x4382('0x42')];_0x4f1d2b['outboundRejectCallsDay']=_0x2bfc69[_0x4382('0x43')];_0x4f1d2b['outboundUnknownCallsDay']=_0x2bfc69[_0x4382('0x44')];_0x4f1d2b['predictiveIntervalAnsweredCalls']=_0x2bfc69[_0x4382('0x45')];_0x4f1d2b[_0x4382('0x46')]=_0x2bfc69[_0x4382('0x46')];_0x4f1d2b[_0x4382('0x47')]=_0x2bfc69['predictiveIntervalAvgTalktime'];_0x4f1d2b[_0x4382('0x48')]=_0x2bfc69[_0x4382('0x48')];_0x4f1d2b['predictiveIntervalDroppedCallsTimeout']=_0x2bfc69[_0x4382('0x49')];_0x4f1d2b[_0x4382('0x4a')]=_0x2bfc69[_0x4382('0x4a')];_0x4f1d2b[_0x4382('0x4b')]=_0x2bfc69['predictiveIntervalErlangCallsDroppedCalls'];_0x4f1d2b[_0x4382('0x4c')]=_0x2bfc69[_0x4382('0x4c')];_0x4f1d2b[_0x4382('0x4d')]=_0x2bfc69['predictiveIntervalMultiplicativeFactor'];_0x4f1d2b[_0x4382('0x4e')]=_0x2bfc69[_0x4382('0x4e')];_0x4f1d2b[_0x4382('0x4f')]=_0x2bfc69[_0x4382('0x4f')];_0x4f1d2b[_0x4382('0x50')]=_0x2bfc69['predictiveIntervalTotalCalls'];_0x4f1d2b[_0x4382('0x1c')]=_0x2bfc69['message'];_0x4f1d2b[_0x4382('0x51')]=_0x2bfc69[_0x4382('0x51')];_0x4f1d2b[_0x4382('0x52')]=_0x2bfc69[_0x4382('0x52')];_0x4f1d2b[_0x4382('0x53')]=_0x2bfc69[_0x4382('0x53')];_0x4f1d2b['erlangAbandonmentRate']=_0x2bfc69[_0x4382('0x54')];_0x4f1d2b[_0x4382('0x55')]=_0x2bfc69['erlangBusyFactor'];_0x4f1d2b[_0x4382('0x56')]=_0x2bfc69[_0x4382('0x56')];_0x4f1d2b[_0x4382('0x57')]=_0x2bfc69[_0x4382('0x57')];}if(_0x2bfc69[_0x4382('0x58')]){_0x4f1d2b[_0x4382('0x58')]={'id':_0x2bfc69[_0x4382('0x58')]['id'],'name':_0x2bfc69[_0x4382('0x58')][_0x4382('0x9')],'active':_0x2bfc69[_0x4382('0x58')][_0x4382('0x59')],'callerid':_0x2bfc69['Trunk'][_0x4382('0x5a')]};}if(_0x2bfc69['Interval']){_0x4f1d2b[_0x4382('0x5b')]={'id':_0x2bfc69['Interval']['id'],'name':_0x2bfc69[_0x4382('0x5b')][_0x4382('0x9')]};}_0xefe87[_0x4382('0x5c')](_0x4f1d2b);}}_0x37b23b({'count':_0xefe87[_0x4382('0x5d')],'rows':_0xefe87});});},'UpdateVoiceQueue':function(_0x256bf2){return new Promise(function(_0x19c305,_0x5dd366){var _0x3d6313=_[_0x4382('0x5e')](_0x14fa7c[_0x4382('0x21')],{'id':parseInt(_0x256bf2['id'])});var _0x5f0e08=_[_0x4382('0x5f')](_0x256bf2,['id']);if(_0x3d6313){for(var _0x126109 in _0x5f0e08){if(typeof _0x5f0e08[_0x126109]!==_0x4382('0x60')&&typeof _0x3d6313[_0x126109]!==_0x4382('0x60')){_0x3d6313[_0x126109]=_0x5f0e08[_0x126109];}}_0x19c305(_0x3d6313);}else{_0x5dd366();}});},'VoiceChannels':function(_0x44f266){return new Promise(function(_0x3b42cb,_0xdc426b){var _0x2b7e90=_[_0x4382('0x61')](_0x14fa7c['channels']);_0x3b42cb({'count':_0x2b7e90[_0x4382('0x5d')],'rows':_0x2b7e90});});},'VoiceChannelMixMonitor':function(_0x55fe55){var _0x286af8=this;return new Promise(function(_0x156fc3,_0x545b9d){if(ami['isConnected']()==![]){return _0x545b9d(_0x286af8[_0x4382('0x1e')](0x1f4,[config['asterisk']['ip'],config[_0x4382('0x11')][_0x4382('0x12')],_0x4382('0x13')][_0x4382('0x14')]('\x20')));}var _0x146390=schema(properties['voicechannel'])[_0x4382('0x62')](_0x55fe55);if(_0x146390[_0x4382('0x5d')]>0x0){return _0x545b9d(_0x286af8[_0x4382('0x1e')](0x1f4,_[_0x4382('0x63')](_0x146390,_0x4382('0x1c'))['join'](',\x20')));}var _0x1c77bb=_[_0x4382('0x5e')](_0x14fa7c[_0x4382('0x64')],{'uniqueid':_0x55fe55[_0x4382('0x65')]});if(_0x1c77bb&&_0x1c77bb['channel']){var _0x410522=util[_0x4382('0x66')](_0x4382('0x67'),_0x55fe55['filename']||_0x55fe55['uniqueid'],_0x55fe55[_0x4382('0x66')]||_0x4382('0x68'));return ami[_0x4382('0x1a')]({'action':'MixMonitor','channel':_0x1c77bb[_0x4382('0x69')],'file':_0x410522,'options':_0x4382('0x6a')})[_0x4382('0x1b')](function(_0xbd0062){var _0x388d0b=_['find'](_0x1c77bb['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x410522[_0x4382('0x6b')]()});if(_['isNil'](_0x388d0b)){_0x1c77bb[_0x4382('0x6c')][_0x4382('0x5c')]({'filename':_0x4382('0x6d')+_0x410522['toLowerCase'](),'createdAt':moment()[_0x4382('0x66')](_0x4382('0x6e')),'mixmonitorid':_0xbd0062[_0x4382('0x6f')],'status':_0x4382('0x70')});}else{_0x388d0b[_0x4382('0x6f')]=_0xbd0062[_0x4382('0x6f')];_0x388d0b['status']=_0x4382('0x70');}_0x156fc3({'code':0xc8,'message':[_0x55fe55[_0x4382('0x65')],_0x4382('0x71'),_0xbd0062['mixmonitorid']][_0x4382('0x14')]('\x20'),'mixmonitorid':_0xbd0062[_0x4382('0x6f')]});})['catch'](function(_0x208281){_0x545b9d(_0x286af8['error'](0x1f5,[_0x55fe55[_0x4382('0x65')],_0x208281[_0x4382('0x1c')][_0x4382('0x6b')]()][_0x4382('0x14')]('\x20')));});}else{return _0x545b9d(_0x286af8[_0x4382('0x1e')](0x1f5,_0x4382('0x72')));}});},'VoiceChannelStopMixMonitor':function(_0x2250ac){var _0x362b49=this;return new Promise(function(_0x59b822,_0x34e567){if(ami[_0x4382('0x10')]()==![]){return _0x34e567(_0x362b49['error'](0x1f4,[config[_0x4382('0x11')]['ip'],config['asterisk'][_0x4382('0x12')],_0x4382('0x13')][_0x4382('0x14')]('\x20')));}var _0x2573ff=schema(properties['voicechannel'])['validate'](_0x2250ac);if(_0x2573ff[_0x4382('0x5d')]>0x0){return _0x34e567(_0x362b49['error'](0x1f4,_[_0x4382('0x63')](_0x2573ff,_0x4382('0x1c'))['join'](',\x20')));}var _0x14974b=_[_0x4382('0x5e')](_0x14fa7c[_0x4382('0x64')],{'uniqueid':_0x2250ac['uniqueid']});if(_0x14974b){return BPromise[_0x4382('0x73')]()[_0x4382('0x1b')](function(){if(_0x14974b[_0x4382('0x69')]){return ami[_0x4382('0x1a')]({'action':_0x4382('0x74'),'channel':_0x14974b[_0x4382('0x69')],'mixmonitorid':_0x2250ac[_0x4382('0x6f')]})[_0x4382('0x1d')](function(_0x1c848e){});}})['then'](function(){if(_0x14974b[_0x4382('0x75')]){return ami[_0x4382('0x1a')]({'action':_0x4382('0x74'),'channel':_0x14974b[_0x4382('0x75')],'mixmonitorid':_0x2250ac[_0x4382('0x6f')]})[_0x4382('0x1d')](function(_0x4a875e){});}})[_0x4382('0x1b')](function(_0x50266b){var _0x5df65e=_[_0x4382('0x5e')](_0x14974b['monitors'],{'mixmonitorid':_0x2250ac[_0x4382('0x6f')]});if(_0x5df65e){_0x5df65e[_0x4382('0x76')]=_0x4382('0x77');}})[_0x4382('0x1b')](function(){var _0x558af0=util['format'](_0x4382('0x67'),_0x2250ac[_0x4382('0x78')]||_0x2250ac[_0x4382('0x65')],_0x2250ac[_0x4382('0x66')]||_0x4382('0x68'));var _0x276ebd=_['find'](_0x14974b[_0x4382('0x6c')],{'filename':'/var/spool/asterisk/monitor/'+_0x558af0['toLowerCase']()});if(_0x276ebd){_0x276ebd['status']='stop';}})[_0x4382('0x1b')](function(){_0x59b822({'code':0xc8,'message':[_0x2250ac['uniqueid'],_0x4382('0x79')][_0x4382('0x14')]('\x20')});})[_0x4382('0x1d')](function(_0xc7e77d){_0x34e567(_0x362b49['error'](0x1f5,[_0x2250ac[_0x4382('0x65')],_0xc7e77d['message'][_0x4382('0x6b')]()][_0x4382('0x14')]('\x20')));});}else{return _0x34e567(_0x362b49[_0x4382('0x1e')](0x1f5,_0x4382('0x72')));}});},'VoiceQueuesChannels':function(_0xb9ad61){return new Promise(function(_0x4c303f,_0x49796b){var _0x3c4fb1=_[_0x4382('0x61')](_0x14fa7c[_0x4382('0x7a')]);_0x4c303f({'count':_0x3c4fb1[_0x4382('0x5d')],'rows':_0x3c4fb1});});},'VoiceQueuesChannel':function(_0x2b4550){var _0x50b9d3=this;return new Promise(function(_0x2da7bc,_0x3b4cbc){var _0x41c5c2=schema(properties[_0x4382('0x7b')])[_0x4382('0x62')](_0x2b4550);if(_0x41c5c2[_0x4382('0x5d')]>0x0){return _0x3b4cbc(_0x50b9d3[_0x4382('0x1e')](0x1f4,_['map'](_0x41c5c2,_0x4382('0x1c'))[_0x4382('0x14')](',\x20')));}var _0x15ddc8=_[_0x4382('0x5e')](_0x14fa7c[_0x4382('0x7a')],{'uniqueid':_0x2b4550[_0x4382('0x65')]});if(_0x15ddc8){_0x2da7bc(_0x15ddc8);}else{return _0x3b4cbc(_0x50b9d3['error'](0x1f5,_0x4382('0x72')));}});},'VoiceQueuesChannelHangup':function(_0x2648ab){var _0x39e4df=this;return new Promise(function(_0x3cb4e9,_0x33b763){if(ami[_0x4382('0x10')]()==![]){return _0x33b763(_0x39e4df[_0x4382('0x1e')](0x1f4,[config['asterisk']['ip'],config[_0x4382('0x11')]['username'],_0x4382('0x13')][_0x4382('0x14')]('\x20')));}var _0x46a18c=schema(properties[_0x4382('0x7c')])[_0x4382('0x62')](_0x2648ab);if(_0x46a18c[_0x4382('0x5d')]>0x0){return _0x33b763(_0x39e4df['error'](0x1f4,_[_0x4382('0x63')](_0x46a18c,_0x4382('0x1c'))[_0x4382('0x14')](',\x20')));}var _0xa5614f=_[_0x4382('0x5e')](_0x14fa7c[_0x4382('0x7a')],{'uniqueid':_0x2648ab[_0x4382('0x65')]});if(_0xa5614f&&_0xa5614f[_0x4382('0x69')]){return ami[_0x4382('0x1a')]({'action':_0x4382('0x7d'),'channel':_0xa5614f[_0x4382('0x69')]})[_0x4382('0x1b')](function(_0x306c3c){_0x3cb4e9({'code':0xc8,'message':[_0x2648ab[_0x4382('0x65')],_0x306c3c[_0x4382('0x1c')][_0x4382('0x6b')]()][_0x4382('0x14')]('\x20')});})[_0x4382('0x1d')](function(_0x43774a){_0x33b763(_0x39e4df[_0x4382('0x1e')](0x1f5,[_0x2648ab['uniqueid'],_0x43774a[_0x4382('0x1c')][_0x4382('0x6b')]()][_0x4382('0x14')]('\x20')));});}else{return _0x33b763(_0x39e4df[_0x4382('0x1e')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x6fa0f0){var _0x1d8721=this;return new Promise(function(_0x36a312,_0x367bd5){if(ami[_0x4382('0x10')]()==![]){return _0x367bd5(_0x1d8721[_0x4382('0x1e')](0x1f4,[config[_0x4382('0x11')]['ip'],config[_0x4382('0x11')][_0x4382('0x12')],_0x4382('0x13')][_0x4382('0x14')]('\x20')));}var _0x5486ce=schema(properties[_0x4382('0x7e')])[_0x4382('0x62')](_0x6fa0f0);if(_0x5486ce[_0x4382('0x5d')]>0x0){return _0x367bd5(_0x1d8721[_0x4382('0x1e')](0x1f4,_[_0x4382('0x63')](_0x5486ce,_0x4382('0x1c'))[_0x4382('0x14')](',\x20')));}var _0x44208a=_[_0x4382('0x5e')](_0x14fa7c[_0x4382('0x7a')],{'uniqueid':_0x6fa0f0[_0x4382('0x65')]});if(_0x44208a&&_0x44208a[_0x4382('0x69')]){return ami['Action']({'action':_0x4382('0x7f'),'channel':_0x44208a[_0x4382('0x69')],'exten':_0x6fa0f0[_0x4382('0x80')],'context':_0x6fa0f0[_0x4382('0x81')]||_0x44208a[_0x4382('0x81')],'priority':0x1})['then'](function(_0x2b3a21){_0x36a312({'code':0xc8,'message':[_0x6fa0f0['uniqueid'],_0x2b3a21[_0x4382('0x1c')][_0x4382('0x6b')]()][_0x4382('0x14')]('\x20')});})[_0x4382('0x1d')](function(_0xe0bb79){_0x367bd5(_0x1d8721[_0x4382('0x1e')](0x1f5,[_0x6fa0f0['uniqueid'],_0xe0bb79[_0x4382('0x1c')]['toLowerCase']()][_0x4382('0x14')]('\x20')));});}else{return _0x367bd5(_0x1d8721[_0x4382('0x1e')](0x1f5,_0x4382('0x72')));}});},'Agents':function(_0x13ea68){return new Promise(function(_0x5ed6ff,_0x168bac){var _0x3ca960=_['values'](_0x14fa7c[_0x4382('0xd')]);_0x5ed6ff({'count':_0x3ca960[_0x4382('0x5d')],'rows':_0x3ca960});});},'Telephones':function(_0x35e8f6){return new Promise(function(_0x9df656,_0x1f3d7e){var _0x9b20a3=_[_0x4382('0x61')](_0x14fa7c[_0x4382('0x82')]);_0x9df656({'count':_0x9b20a3[_0x4382('0x5d')],'rows':_0x9b20a3});});},'Trunks':function(_0xb4b78f){return new Promise(function(_0x5a5010,_0x536af3){var _0xc8ac91=_[_0x4382('0x61')](_0x14fa7c[_0x4382('0x83')]);_0x5a5010({'count':_0xc8ac91[_0x4382('0x5d')],'rows':_0xc8ac91});});},'OutboundChannels':function(_0x175b2d){return new Promise(function(_0x5493b8,_0x2d60ad){var _0x1b3883=_[_0x4382('0x61')](_0x14fa7c[_0x4382('0x84')]);_0x5493b8({'count':_0x1b3883['length'],'rows':_0x1b3883});});},'Outbound':function(_0x531f46){return new Promise(function(_0x5bd3df,_0x563ec6){_0x5bd3df(_0x14fa7c[_0x4382('0x31')]);});},'Campaigns':function(_0x3ee7c8){return new Promise(function(_0x38968f,_0x293a53){var _0x25f07e=_[_0x4382('0x61')](_0x14fa7c[_0x4382('0x85')]);_0x38968f({'count':_0x25f07e[_0x4382('0x5d')],'rows':_0x25f07e});});},'VoiceQueuesPreview':function(_0x18a726){var _0x7d4114=this;return new Promise(function(_0x16895e,_0x42af87){_0x354906[_0x4382('0x86')](_0x18a726['id'])['then'](function(_0x5726b7){_0x16895e({'code':0xc8,'message':_0x5726b7[_0x4382('0x1c')]});})[_0x4382('0x1d')](function(_0x2f36a9){_0x42af87(_0x7d4114[_0x4382('0x1e')](0x1f4,_0x2f36a9[_0x4382('0x1c')]));});});},'EventManager':function(_0x547075){var _0x2be8bc=this;return new Promise(function(_0x30b62e,_0x6c9e31){if(!_0x547075['event']){return _0x6c9e31(_0x2be8bc[_0x4382('0x1e')](0x1f4,_0x4382('0x87')));}ami['emit'](_0x4382('0x88')+_0x547075[_0x4382('0x89')],_0x547075['message']);_0x30b62e({'code':0xc8,'message':_0x547075});});},'FaxAccounts':function(_0x159dbc){return new Promise(function(_0x58aca8,_0x24d294){var _0x492f74=_[_0x4382('0x61')](_0x14fa7c['faxAccounts']);_0x58aca8({'count':_0x492f74[_0x4382('0x5d')],'rows':_0x492f74});});},'SendFax':function(_0x68370d){var _0x4e4bf9=this;return new Promise(function(_0x12c6be,_0x840f9a){_0x3a6bae[_0x4382('0x8a')](_0x68370d)[_0x4382('0x1b')](function(_0x3c369c){_0x12c6be({'code':0xc8,'message':_0x3c369c[_0x4382('0x1c')]});})[_0x4382('0x1d')](function(_0x520405){_0x840f9a(_0x4e4bf9[_0x4382('0x1e')](0x1f4,_0x520405['message']));});});},'CheckAfterSend':function(_0x1be69d){var _0x3f9d1e=this;return new Promise(function(_0x26e889,_0x21c0ff){_0x3a6bae[_0x4382('0x8b')](_0x1be69d)[_0x4382('0x1b')](function(_0x2ac67a){_0x26e889({'code':0xc8,'message':_0x2ac67a[_0x4382('0x1c')]});})[_0x4382('0x1d')](function(_0x31a4b5){_0x21c0ff(_0x3f9d1e[_0x4382('0x1e')](0x1f4,_0x31a4b5[_0x4382('0x1c')]));});});}};var _0x2c8ac9=jayson[_0x4382('0x8c')](_0x2fb28c)['http']();_0x2c8ac9['on']('error',function(_0x21e5f6){return _0x31257a(_0x21e5f6);});_0x2c8ac9['listen'](0x232a,_0x4382('0x8d'),function(){console['log'](_0x4382('0x8e'),0x232a);return _0x416e96(_0x4382('0x8f')+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 e7b8969..2b23e1e 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 _0x1741=['data1','data2','xmd-contactid','ListId','data3','phone','$or','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','scheduledAt','updatedAt','then','getContacts','isEmpty','length','uniqueid','map','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec'];(function(_0x41934a,_0x25fb0a){var _0x2cc429=function(_0x450175){while(--_0x450175){_0x41934a['push'](_0x41934a['shift']());}};_0x2cc429(++_0x25fb0a);}(_0x1741,0x166));var _0x1174=function(_0x494299,_0x1b6f2a){_0x494299=_0x494299-0x0;var _0x5637a9=_0x1741[_0x494299];return _0x5637a9;};'use strict';var _=require(_0x1174('0x0'));var BPromise=require(_0x1174('0x1'));var Redis=require('ioredis');var util=require(_0x1174('0x2'));var config=require(_0x1174('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x1174('0x4'));config['redis']=_[_0x1174('0x5')](config[_0x1174('0x6')],{'host':_0x1174('0x7'),'port':0x18eb});var io=require(_0x1174('0x8'))(new Redis(config[_0x1174('0x6')]));function emit(_0x518962,_0x605f9e,_0x176a4e,_0x3775f3,_0x122aac){logger[_0x1174('0x9')](_0x1174('0xa'),_0x518962,_0x605f9e['id'],_0x176a4e,_0x3775f3,JSON[_0x1174('0xb')](_0x122aac));io['to'](_0x176a4e)['emit'](_0x3775f3,_0x122aac);}exports[_0x1174('0xc')]=function(_0x3f4755,_0x4458da,_0x3ba5c7,_0x532d23){var _0x497f45,_0x1ce5fd;var _0x46da60={};var _0x28fcac=Number(_0x3ba5c7[_0x1174('0xd')]);var _0x40766b=_0x3ba5c7[_0x1174('0xe')]?Boolean(Number(_0x3ba5c7[_0x1174('0xe')])):![];var _0x3b70d5;if(_0x532d23[_0x1174('0xf')]){_0x46da60['id']=_0x532d23['xmd-contactid'];}if(!_0x46da60['id']){_0x46da60[_0x1174('0x10')]=_0x28fcac;_0x3b70d5=_0x3ba5c7[_0x1174('0x11')]&&_0x3ba5c7['data3']!=='0'?_0x3ba5c7[_0x1174('0x11')]['split'](','):[_0x1174('0x12')];_0x46da60[_0x1174('0x13')]=_['map'](_0x3b70d5,function(_0x1cf165){var _0x34685f={};_0x34685f[_0x1cf165]=_0x532d23[_0x1174('0x14')]?_0x532d23[_0x1174('0x15')]:_0x532d23[_0x1174('0x16')];return _0x34685f;});}var _0x32f64b=['id',_0x1174('0x17'),'lastName','phone',_0x1174('0x18'),_0x1174('0x19'),_0x1174('0x10'),'createdAt',_0x1174('0x1a'),_0x1174('0x1b')];var _0x25a147=_['union'](_0x32f64b,_0x3b70d5);BPromise['resolve']()[_0x1174('0x1c')](cmContactRpc[_0x1174('0x1d')]({'attributes':_0x25a147,'where':_0x46da60}))[_0x1174('0x1c')](function(_0x524acf){_0x1ce5fd=_0x524acf;if(!_[_0x1174('0x1e')](_0x1ce5fd)){if(_0x1ce5fd[_0x1174('0x1f')]===0x1){_0x497f45=_0x1ce5fd[0x0];logger[_0x1174('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x532d23[_0x1174('0x20')],_0x4458da['id'],_0x497f45['id']);}else{logger[_0x1174('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x532d23['uniqueid'],_0x4458da['id'],_[_0x1174('0x21')](_0x1ce5fd,'id')[_0x1174('0x22')](','));}return;}else{logger[_0x1174('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x532d23[_0x1174('0x20')],_0x4458da['id']);var _0x23062d={'ListId':_0x28fcac};var _0x45d297=_0x3ba5c7[_0x1174('0x23')]&&_0x3ba5c7[_0x1174('0x23')]!=='0'?_0x3ba5c7[_0x1174('0x23')]:_0x1174('0x12');if(_0x40766b){logger[_0x1174('0x9')](_0x1174('0x24'),_0x532d23[_0x1174('0x20')],_0x4458da['id']);_0x23062d[_0x45d297]=_[_0x1174('0x25')](_0x532d23[_0x1174('0x14')])?_0x532d23[_0x1174('0x16')]:_0x532d23['destcalleridnum'];if(_[_0x1174('0x25')](_0x532d23[_0x1174('0x14')])){_0x23062d[_0x1174('0x17')]=_0x532d23[_0x1174('0x26')]&&_0x532d23[_0x1174('0x26')]!==_0x1174('0x27')?_0x532d23[_0x1174('0x26')]:_0x1174('0x28');}else{_0x23062d[_0x1174('0x17')]=_0x532d23[_0x1174('0x29')]&&_0x532d23[_0x1174('0x29')]!==_0x1174('0x27')?_0x532d23[_0x1174('0x29')]:_0x1174('0x28');}return BPromise[_0x1174('0x2a')]()[_0x1174('0x1c')](cmContactRpc[_0x1174('0x2b')](_0x23062d))[_0x1174('0x1c')](function(_0x472636){_0x497f45=_0x472636;_0x1ce5fd[_0x1174('0x2c')](_0x472636);if(_0x497f45){logger[_0x1174('0x9')](_0x1174('0x2d'),_0x532d23['uniqueid'],_0x4458da['id'],_0x497f45['id']);}return;});}else{logger[_0x1174('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x532d23[_0x1174('0x20')],_0x4458da['id']);_0x23062d[_0x45d297]=_[_0x1174('0x25')](_0x532d23[_0x1174('0x14')])?_0x532d23['calleridnum']:_0x532d23[_0x1174('0x15')];if(_['isNil'](_0x532d23[_0x1174('0x14')])){_0x23062d[_0x1174('0x17')]=_0x532d23[_0x1174('0x26')]&&_0x532d23[_0x1174('0x26')]!==''?_0x532d23[_0x1174('0x26')]:'Unknown';}else{_0x23062d['firstName']=_0x532d23['destcalleridname']&&_0x532d23['destcalleridname']!==''?_0x532d23[_0x1174('0x29')]:_0x1174('0x28');}_0x497f45=_0x23062d;_0x1ce5fd['push'](_0x23062d);return;}}})[_0x1174('0x1c')](function(){if(_0x3f4755){emit(_0x532d23[_0x1174('0x20')],_0x4458da,util[_0x1174('0x2e')](_0x1174('0x2f'),_0x3f4755[_0x1174('0x30')]),util[_0x1174('0x2e')](_0x1174('0x31'),_0x3ba5c7[_0x1174('0x32')][_0x1174('0x33')]()),{'evt':_[_0x1174('0x34')](_0x532d23,{'autoCreate':_0x40766b}),'contact':_0x497f45===undefined?{}:_0x497f45,'contacts':_0x1ce5fd[_0x1174('0x1f')]===0x0?undefined:_0x1ce5fd});}});}; \ No newline at end of file +var _0xe506=['[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','routeId','calleridnum','format','user:%s','trigger:%s','action','toLowerCase','merge','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','stringify','emit','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length'];(function(_0x409e59,_0x160228){var _0x4bbc8d=function(_0x13db2d){while(--_0x13db2d){_0x409e59['push'](_0x409e59['shift']());}};_0x4bbc8d(++_0x160228);}(_0xe506,0x8b));var _0x6e50=function(_0x319873,_0x17dc7b){_0x319873=_0x319873-0x0;var _0x18f933=_0xe506[_0x319873];return _0x18f933;};'use strict';var _=require('lodash');var BPromise=require(_0x6e50('0x0'));var Redis=require(_0x6e50('0x1'));var util=require(_0x6e50('0x2'));var config=require(_0x6e50('0x3'));var logger=require(_0x6e50('0x4'))(_0x6e50('0x5'));var cmContactRpc=require(_0x6e50('0x6'));config[_0x6e50('0x7')]=_[_0x6e50('0x8')](config[_0x6e50('0x7')],{'host':_0x6e50('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6e50('0x7')]));function emit(_0x352734,_0xaf6d33,_0x2654f6,_0x4f42f4,_0x54a2d5){logger[_0x6e50('0xa')]('[CM][%s][%s]',_0x352734,_0xaf6d33['id'],_0x2654f6,_0x4f42f4,JSON[_0x6e50('0xb')](_0x54a2d5));io['to'](_0x2654f6)[_0x6e50('0xc')](_0x4f42f4,_0x54a2d5);}exports['exec']=function(_0x551e45,_0x193da1,_0x370b83,_0x4b4146){var _0x32e7cf,_0x5a4f4e;var _0x4621bf={};var _0x108de3=Number(_0x370b83[_0x6e50('0xd')]);var _0x178c8e=_0x370b83[_0x6e50('0xe')]?Boolean(Number(_0x370b83[_0x6e50('0xe')])):![];var _0x6a51ba;if(_0x4b4146[_0x6e50('0xf')]){_0x4621bf['id']=_0x4b4146[_0x6e50('0xf')];}if(!_0x4621bf['id']){_0x4621bf[_0x6e50('0x10')]=_0x108de3;_0x6a51ba=_0x370b83[_0x6e50('0x11')]&&_0x370b83[_0x6e50('0x11')]!=='0'?_0x370b83[_0x6e50('0x11')][_0x6e50('0x12')](','):[_0x6e50('0x13')];_0x4621bf[_0x6e50('0x14')]=_[_0x6e50('0x15')](_0x6a51ba,function(_0x322b97){var _0x30afbc={};_0x30afbc[_0x322b97]=_0x4b4146['routeId']?_0x4b4146[_0x6e50('0x16')]:_0x4b4146['calleridnum'];return _0x30afbc;});}var _0x48e402=['id','firstName',_0x6e50('0x17'),'phone',_0x6e50('0x18'),_0x6e50('0x19'),_0x6e50('0x10'),_0x6e50('0x1a'),_0x6e50('0x1b'),_0x6e50('0x1c')];var _0x360af2=_[_0x6e50('0x1d')](_0x48e402,_0x6a51ba);BPromise[_0x6e50('0x1e')]()[_0x6e50('0x1f')](cmContactRpc[_0x6e50('0x20')]({'attributes':_0x360af2,'where':_0x4621bf}))[_0x6e50('0x1f')](function(_0x3468a7){_0x5a4f4e=_0x3468a7;if(!_[_0x6e50('0x21')](_0x5a4f4e)){if(_0x5a4f4e[_0x6e50('0x22')]===0x1){_0x32e7cf=_0x5a4f4e[0x0];logger[_0x6e50('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x4b4146['uniqueid'],_0x193da1['id'],_0x32e7cf['id']);}else{logger['info'](_0x6e50('0x23'),_0x4b4146[_0x6e50('0x24')],_0x193da1['id'],_[_0x6e50('0x15')](_0x5a4f4e,'id')[_0x6e50('0x25')](','));}return;}else{logger[_0x6e50('0xa')](_0x6e50('0x26'),_0x4b4146['uniqueid'],_0x193da1['id']);var _0x3e90c3={'ListId':_0x108de3};var _0x2183d8=_0x370b83['data4']&&_0x370b83[_0x6e50('0x27')]!=='0'?_0x370b83[_0x6e50('0x27')]:_0x6e50('0x13');if(_0x178c8e){logger[_0x6e50('0xa')](_0x6e50('0x28'),_0x4b4146['uniqueid'],_0x193da1['id']);_0x3e90c3[_0x2183d8]=_[_0x6e50('0x29')](_0x4b4146['routeId'])?_0x4b4146['calleridnum']:_0x4b4146[_0x6e50('0x16')];if(_['isNil'](_0x4b4146['routeId'])){_0x3e90c3[_0x6e50('0x2a')]=_0x4b4146['calleridname']&&_0x4b4146[_0x6e50('0x2b')]!==_0x6e50('0x2c')?_0x4b4146[_0x6e50('0x2b')]:_0x6e50('0x2d');}else{_0x3e90c3[_0x6e50('0x2a')]=_0x4b4146[_0x6e50('0x2e')]&&_0x4b4146['destcalleridname']!==_0x6e50('0x2c')?_0x4b4146[_0x6e50('0x2e')]:_0x6e50('0x2d');}return BPromise[_0x6e50('0x1e')]()[_0x6e50('0x1f')](cmContactRpc[_0x6e50('0x2f')](_0x3e90c3))[_0x6e50('0x1f')](function(_0x5f018d){_0x32e7cf=_0x5f018d;_0x5a4f4e[_0x6e50('0x30')](_0x5f018d);if(_0x32e7cf){logger[_0x6e50('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x4b4146['uniqueid'],_0x193da1['id'],_0x32e7cf['id']);}return;});}else{logger[_0x6e50('0xa')](_0x6e50('0x31'),_0x4b4146['uniqueid'],_0x193da1['id']);_0x3e90c3[_0x2183d8]=_[_0x6e50('0x29')](_0x4b4146[_0x6e50('0x32')])?_0x4b4146[_0x6e50('0x33')]:_0x4b4146['destcalleridnum'];if(_[_0x6e50('0x29')](_0x4b4146[_0x6e50('0x32')])){_0x3e90c3['firstName']=_0x4b4146[_0x6e50('0x2b')]&&_0x4b4146[_0x6e50('0x2b')]!==_0x6e50('0x2c')?_0x4b4146[_0x6e50('0x2b')]:'Unknown';}else{_0x3e90c3[_0x6e50('0x2a')]=_0x4b4146[_0x6e50('0x2e')]&&_0x4b4146[_0x6e50('0x2e')]!==_0x6e50('0x2c')?_0x4b4146[_0x6e50('0x2e')]:_0x6e50('0x2d');}_0x32e7cf=_0x3e90c3;_0x5a4f4e[_0x6e50('0x30')](_0x3e90c3);return;}}})['then'](function(){if(_0x551e45){emit(_0x4b4146['uniqueid'],_0x193da1,util[_0x6e50('0x34')](_0x6e50('0x35'),_0x551e45['name']),util[_0x6e50('0x34')](_0x6e50('0x36'),_0x370b83[_0x6e50('0x37')][_0x6e50('0x38')]()),{'evt':_[_0x6e50('0x39')](_0x4b4146,{'autoCreate':_0x178c8e}),'contact':_0x32e7cf===undefined?{}:_0x32e7cf,'contacts':_0x5a4f4e[_0x6e50('0x22')]===0x0?undefined:_0x5a4f4e});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 3d0bbd3..d8bdce4 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 _0x2f7a=['buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','600','winApplication','render','emit','user:%s','format','trigger:%s:%s','jscripty','trigger:%s','queue','urlforward','exec','script','parse','search','replace','length','every','AllConditions','checkConditions','channel','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','message','agent','membername','lastevent','routeId','exports','util','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/logger','../ami','defaults','redis','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','servicenowAccounts','custom:agentcalled','bind','custom:agentconnect','custom:agentringnoanswer','syncCustomEvent','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:rejectmessage','info','prototype','clone','interface','checkTriggers','hasOwnProperty','status','merge','variables','Actions','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','html','data2','template\x20not\x20found','url','uri'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x2f7a,0xa2));var _0xa2f7=function(_0x2dd70c,_0x7f20e7){_0x2dd70c=_0x2dd70c-0x0;var _0x44d66b=_0x2f7a[_0x2dd70c];return _0x44d66b;};'use strict';var util=require(_0xa2f7('0x0'));var _=require(_0xa2f7('0x1'));var url=require('url');var Mustache=require(_0xa2f7('0x2'));var Redis=require(_0xa2f7('0x3'));var urlforward=require(_0xa2f7('0x4'));var integration=require(_0xa2f7('0x5'));var cmContact=require(_0xa2f7('0x6'));var script=require(_0xa2f7('0x7'));var config=require('../../../config/environment');var logger=require(_0xa2f7('0x8'))('trigger');var ami=require(_0xa2f7('0x9'));config['redis']=_[_0xa2f7('0xa')](config[_0xa2f7('0xb')],{'host':_0xa2f7('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa2f7('0xb')]));var operators={'equals':function(_0x4691ec,_0x5c5262){return _0x4691ec==_0x5c5262;},'not_equals':function(_0x2eb957,_0x2902a6){return _0x2eb957!=_0x2902a6;}};var barAndWebActions=[_0xa2f7('0xd'),'url',_0xa2f7('0xe')];function Trigger(_0x13adf5){this['triggers']=_0x13adf5[_0xa2f7('0xf')];this[_0xa2f7('0x10')]=_0x13adf5['agents'];this[_0xa2f7('0x11')]=_0x13adf5[_0xa2f7('0x11')];this['templates']=_0x13adf5[_0xa2f7('0x12')];this[_0xa2f7('0x13')]=_0x13adf5['voiceExtensions'];this[_0xa2f7('0x14')]=_0x13adf5[_0xa2f7('0x14')];this['freshdeskAccounts']=_0x13adf5[_0xa2f7('0x15')];this[_0xa2f7('0x16')]=_0x13adf5[_0xa2f7('0x16')];this[_0xa2f7('0x17')]=_0x13adf5[_0xa2f7('0x17')];this[_0xa2f7('0x18')]=_0x13adf5[_0xa2f7('0x18')];this['deskAccounts']=_0x13adf5['deskAccounts'];this[_0xa2f7('0x19')]=_0x13adf5[_0xa2f7('0x19')];this['servicenowAccounts']=_0x13adf5['servicenowAccounts'];this[_0xa2f7('0x1a')]=_0x13adf5[_0xa2f7('0x1a')];this['freshsalesAccounts']=_0x13adf5[_0xa2f7('0x1b')];this[_0xa2f7('0x1c')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xa2f7('0x16')],'freshdesk':this[_0xa2f7('0x15')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xa2f7('0x18')],'desk':this['deskAccounts'],'vtiger':this[_0xa2f7('0x19')],'dynamics365':this[_0xa2f7('0x1a')],'freshsales':this[_0xa2f7('0x1b')],'servicenow':this[_0xa2f7('0x1d')]};ami['on'](_0xa2f7('0x1e'),this['syncCustomEvent'][_0xa2f7('0x1f')](this));ami['on'](_0xa2f7('0x20'),this['syncCustomEvent']['bind'](this));ami['on'](_0xa2f7('0x21'),this[_0xa2f7('0x22')][_0xa2f7('0x1f')](this));ami['on'](_0xa2f7('0x23'),this[_0xa2f7('0x22')]['bind'](this));ami['on'](_0xa2f7('0x24'),this[_0xa2f7('0x22')][_0xa2f7('0x1f')](this));ami['on'](_0xa2f7('0x25'),this[_0xa2f7('0x22')][_0xa2f7('0x1f')](this));ami['on']('custom:agentbusy',this[_0xa2f7('0x22')][_0xa2f7('0x1f')](this));ami['on'](_0xa2f7('0x26'),this[_0xa2f7('0x22')]['bind'](this));ami['on']('custom:agentreject',this['syncCustomEvent'][_0xa2f7('0x1f')](this));ami['on'](_0xa2f7('0x27'),this[_0xa2f7('0x22')][_0xa2f7('0x1f')](this));ami['on'](_0xa2f7('0x28'),this['syncCustomEvent'][_0xa2f7('0x1f')](this));ami['on'](_0xa2f7('0x29'),this[_0xa2f7('0x22')][_0xa2f7('0x1f')](this));ami['on'](_0xa2f7('0x2a'),this['syncAgentDial'][_0xa2f7('0x1f')](this));ami['on']('custom:dialconnect',this[_0xa2f7('0x2b')][_0xa2f7('0x1f')](this));ami['on'](_0xa2f7('0x2c'),this[_0xa2f7('0x2b')][_0xa2f7('0x1f')](this));ami['on']('custom:newinteraction',this[_0xa2f7('0x22')][_0xa2f7('0x1f')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent']['bind'](this));ami['on']('custom:incomingmessage',this[_0xa2f7('0x22')][_0xa2f7('0x1f')](this));ami['on']('custom:outgoingmessage',this[_0xa2f7('0x22')][_0xa2f7('0x1f')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0xa2f7('0x2d'),this[_0xa2f7('0x22')][_0xa2f7('0x1f')](this));}Trigger['prototype']['emit']=function(_0x366b50,_0x4805f4,_0x348220){logger[_0xa2f7('0x2e')](_0x366b50,_0x4805f4,JSON['stringify'](_0x348220));io['to'](_0x366b50)['emit'](_0x4805f4,_0x348220);};Trigger[_0xa2f7('0x2f')][_0xa2f7('0x22')]=function(_0x5d4c33){var _0x48d534=_[_0xa2f7('0x30')](_0x5d4c33);this['checkTriggers'](_0x48d534);};Trigger[_0xa2f7('0x2f')][_0xa2f7('0x2b')]=function(_0x5cd695){if(this['agents'][_0x5cd695[_0xa2f7('0x31')]]){this[_0xa2f7('0x22')](_0x5cd695);}};Trigger[_0xa2f7('0x2f')][_0xa2f7('0x32')]=function(_0x208da5){var _0x14b8f5;for(var _0x2b8380 in this['triggers']){if(this['triggers'][_0xa2f7('0x33')](_0x2b8380)){if(this['triggers'][_0x2b8380][_0xa2f7('0x34')]){_0x14b8f5=this['checkTrigger'](this[_0xa2f7('0xf')][_0x2b8380],_0x208da5);if(_0x14b8f5){_[_0xa2f7('0x35')](_0x208da5,_0x208da5[_0xa2f7('0x36')]);for(var _0x419cd0=0x0,_0x54bcd6,_0x4ebd9a,_0x4de9b4;_0x419cd00x0){_0x5b8e3a=_[_0x8281('0x2e')](_0x47dc50,_0xda5b84);}return _0x5b8e3a;}function getCustomFields(_0x170dbe,_0x5c5626){var _0x3fdff2=[];var _0x44d35c={'custom_fields':{}};if(_0x170dbe['length']>0x0){_['forEach'](_0x170dbe,function(_0x522ee3){if(_[_0x8281('0x2f')](['string',_0x8281('0x30')],_0x522ee3[_0x8281('0x31')])&&_0x522ee3['nameField']&&!_0x522ee3['customField']){_0x44d35c[_0x522ee3[_0x8281('0x32')][_0x8281('0x33')]()]=_0x522ee3[_0x8281('0x34')][_0x8281('0x24')]();}else if(_[_0x8281('0x2f')](['string',_0x8281('0x30')],_0x522ee3[_0x8281('0x31')])&&_0x522ee3[_0x8281('0x35')]&&_0x522ee3['customField']){_0x44d35c['custom_fields'][_0x522ee3[_0x8281('0x35')]]=_0x522ee3[_0x8281('0x34')][_0x8281('0x24')]();}else if(_0x522ee3['type']===_0x8281('0x36')&&_0x522ee3[_0x8281('0x37')]&&_0x522ee3['idField']&&_0x522ee3[_0x8281('0x38')]){_0x5c5626[_0x522ee3[_0x8281('0x37')]]&&(_0x44d35c[_0x8281('0x39')][_0x522ee3[_0x8281('0x35')]]=_0x5c5626[_0x522ee3[_0x8281('0x37')]][_0x8281('0x24')]());}else if(_0x522ee3[_0x8281('0x31')]===_0x8281('0x3a')&&_0x522ee3[_0x8281('0x3b')]&&_0x522ee3['Variable'][_0x8281('0x3c')]&&_0x522ee3[_0x8281('0x35')]&&_0x522ee3[_0x8281('0x38')]){_0x5c5626[_0x522ee3[_0x8281('0x3b')]['name'][_0x8281('0x33')]()]&&(_0x44d35c[_0x8281('0x39')][_0x522ee3[_0x8281('0x35')]]=_0x5c5626[_0x522ee3[_0x8281('0x3b')][_0x8281('0x3c')][_0x8281('0x33')]()]['toString']());}});}if(_0x44d35c['priority']){_0x44d35c[_0x8281('0x3d')]=Number(_0x44d35c['priority']);}return _0x44d35c;}function getTicket(_0x3025d4,_0x289644,_0x2e0815,_0x3d25fc,_0x107f98){logger[_0x8281('0xd')](_0x8281('0x3e'));var _0x3446bb=_['merge']({'subject':intUtil[_0x8281('0x3f')](_0x3d25fc['Subjects'],_0x107f98,'\x20'),'type':'phone','status':'new','labels':[_0x8281('0x40'),_0x8281('0x41'),_0x8281('0x42')][_0x8281('0x43')](getTags(_0x3d25fc[_0x8281('0x44')],_0x8281('0x3c'))),'description':intUtil[_0x8281('0x3f')](_0x3d25fc[_0x8281('0x45')],_0x107f98,'\x0a'),'_links':{'assigned_user':{'href':util[_0x8281('0xe')]('/api/v2/users/%d',_0x289644['id']),'class':_0x8281('0x46')}},'message':{'direction':'in','body':intUtil[_0x8281('0x3f')](_0x3d25fc[_0x8281('0x45')],_0x107f98,'\x0a')}},getCustomFields(_0x3d25fc[_0x8281('0x47')],_0x107f98));return request({'uri':util[_0x8281('0xe')]('%s/customers/%d/cases',_0x3025d4[_0x8281('0x10')],_0x2e0815['id']),'method':_0x8281('0x2b'),'body':_0x3446bb});}exports['queue']=function(_0x3f8abe,_0x2abc58,_0x1f221e,_0x40582d,_0x23c62d,_0x4a7687){var _0x3d0119,_0x35ce93;_0x4a7687[_0x8281('0x10')]=intUtil[_0x8281('0x48')](_0x4a7687['remoteUri']);_0x4a7687[_0x8281('0x49')]=intUtil[_0x8281('0x48')](_0x4a7687['serverUrl']);if(_0x23c62d&&_0x23c62d['monitor_format']){logger[_0x8281('0xd')](_0x8281('0x4a'),_0x8281('0x4b'));_0x2abc58['recordingURL']=util[_0x8281('0xe')](_0x8281('0x4c'),_0x4a7687[_0x8281('0x49')],_0x2abc58[_0x8281('0x4d')],md5(_0x2abc58['uniqueid']));}else{_0x2abc58['recordingURL']='';}headers[_0x8281('0x4e')]=getAuth(_0x4a7687);return getUser(_0x4a7687,_0x40582d[_0x8281('0x4f')])[_0x8281('0x15')](function(_0x245313){_0x3d0119=_0x245313;logger['info'](_0x8281('0x50'),_0x3d0119['id']);return getEndUser(_0x4a7687,_0x2abc58[_0x8281('0x51')],_0x2abc58['calleridnum']);})[_0x8281('0x15')](function(_0x4ab1c3){_0x35ce93=_0x4ab1c3;logger[_0x8281('0xd')](_0x8281('0x52'),_0x35ce93['id']);return getTicket(_0x4a7687,_0x3d0119,_0x35ce93,_0x1f221e,_0x2abc58);})[_0x8281('0x15')](function(_0x59df20){if(_0x59df20){logger[_0x8281('0xd')](_0x8281('0x53'));logger[_0x8281('0xd')](_0x8281('0x54'),_0x59df20['id']);switch(_0x4a7687[_0x8281('0x31')]){case'integrationTab':logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0x8281('0xe')]('user:%s',_0x40582d[_0x8281('0x3c')]),_0x8281('0x55'),{'recordId':_0x59df20['id']});break;case _0x8281('0x56'):logger[_0x8281('0xd')](_0x8281('0x4a'),_0x8281('0x57'));emit(util[_0x8281('0xe')](_0x8281('0x58'),_0x40582d[_0x8281('0x3c')]),'trigger:browser:url',{'uri':util[_0x8281('0xe')](_0x8281('0x59'),_0x59df20['id'])});break;default:logger['error']('[QUEUE]',_0x8281('0x5a'));}}})[_0x8281('0x5b')](function(_0x5d70f5){console['error'](_0x5d70f5);logger[_0x8281('0x5c')]('[QUEUE]',JSON[_0x8281('0x5d')](_0x5d70f5));});};exports[_0x8281('0x5e')]=function(_0x385271,_0x405dd4,_0x2c2cfe,_0x2d8a45,_0x483c41,_0x22c4b0,_0x5e11a4){var _0x1c29c8,_0x424275;_0x22c4b0[_0x8281('0x10')]=intUtil[_0x8281('0x48')](_0x22c4b0['remoteUri']);_0x22c4b0[_0x8281('0x49')]=intUtil[_0x8281('0x48')](_0x22c4b0[_0x8281('0x49')]);if(_0x5e11a4&&_0x5e11a4[_0x8281('0x5f')]&&_0x5e11a4['recordingFormat']!==_0x8281('0x60')){logger['info']('[OUTBOUND]',_0x8281('0x4b'));_0x405dd4[_0x8281('0x61')]=util[_0x8281('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x22c4b0[_0x8281('0x49')],_0x405dd4[_0x8281('0x4d')],md5(_0x405dd4[_0x8281('0x4d')]));}headers['Authorization']=getAuth(_0x22c4b0);return getUser(_0x22c4b0,_0x2d8a45[_0x8281('0x4f')])['then'](function(_0x45b657){_0x1c29c8=_0x45b657;logger[_0x8281('0xd')](_0x8281('0x50'),_0x1c29c8['id']);return getEndUser(_0x22c4b0,_0x405dd4[_0x8281('0x62')],_0x405dd4[_0x8281('0x63')]);})['then'](function(_0x26e4fe){_0x424275=_0x26e4fe;logger['info'](_0x8281('0x52'),_0x424275['id']);return getTicket(_0x22c4b0,_0x1c29c8,_0x424275,_0x2c2cfe,_0x405dd4);})['then'](function(_0x39d026){if(_0x39d026){logger[_0x8281('0xd')](_0x8281('0x53'));logger[_0x8281('0xd')](_0x8281('0x54'),_0x39d026['id']);switch(_0x22c4b0[_0x8281('0x31')]){case _0x8281('0x64'):logger[_0x8281('0xd')]('[QUEUE]',_0x8281('0x65'));emit(util[_0x8281('0xe')](_0x8281('0x58'),_0x2d8a45[_0x8281('0x3c')]),_0x8281('0x55'),{'recordId':_0x39d026['id']});break;case _0x8281('0x56'):logger[_0x8281('0xd')](_0x8281('0x4a'),_0x8281('0x57'));emit(util[_0x8281('0xe')]('user:%s',_0x2d8a45[_0x8281('0x3c')]),_0x8281('0x66'),{'uri':util[_0x8281('0xe')](_0x8281('0x67'),_0x22c4b0[_0x8281('0x10')],_0x39d026['id'])});break;default:logger[_0x8281('0x5c')](_0x8281('0x68'),_0x8281('0x5a'));}}})[_0x8281('0x5b')](function(_0x126bd1){logger[_0x8281('0x5c')](_0x8281('0x68'),JSON['stringify'](_0x126bd1));});};exports[_0x8281('0x69')]=function(_0x150681,_0x5e8d3c,_0x15c479,_0x3b8d,_0x224e47,_0x3ef7a1){var _0xaa8ca0,_0x222054;_0x3ef7a1[_0x8281('0x10')]=intUtil[_0x8281('0x48')](_0x3ef7a1[_0x8281('0x10')]);_0x3ef7a1[_0x8281('0x49')]=intUtil['stripTrailingSlash'](_0x3ef7a1[_0x8281('0x49')]);if(_0x224e47&&_0x224e47[_0x8281('0x6a')]){logger[_0x8281('0xd')]('['+_0x5e8d3c['lastevent'][_0x8281('0x6b')]()+']',_0x8281('0x4b'));_0x5e8d3c[_0x8281('0x61')]=util[_0x8281('0xe')](_0x8281('0x4c'),_0x3ef7a1['serverUrl'],_0x5e8d3c['uniqueid'],md5(_0x5e8d3c[_0x8281('0x4d')]));}else{_0x5e8d3c[_0x8281('0x61')]='';}headers[_0x8281('0x4e')]=getAuth(_0x3ef7a1);return getUser(_0x3ef7a1)[_0x8281('0x15')](function(_0x1047f9){_0xaa8ca0=_0x1047f9;logger[_0x8281('0xd')](_0x8281('0x50'),_0xaa8ca0['id']);return getEndUser(_0x3ef7a1,_0x5e8d3c['calleridname'],_0x5e8d3c[_0x8281('0x6c')]);})[_0x8281('0x15')](function(_0x1f41d7){_0x222054=_0x1f41d7;logger['info'](_0x8281('0x52'),_0x222054['id']);return getTicket(_0x3ef7a1,_0xaa8ca0,_0x222054,_0x15c479,_0x5e8d3c);})[_0x8281('0x15')](function(_0x6731a6){if(_0x6731a6){logger[_0x8281('0xd')](_0x8281('0x53'));logger[_0x8281('0xd')](_0x8281('0x54'),_0x6731a6['id']);}})[_0x8281('0x5b')](function(_0x253f08){logger[_0x8281('0x5c')]('['+_0x5e8d3c[_0x8281('0x6d')][_0x8281('0x6b')]()+']',JSON[_0x8281('0x5d')](_0x253f08));});}; \ No newline at end of file +var _0x3a0e=['%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','[HTTP]','stringify','GET','%s:%s','username','password','authType','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','length','map','forEach','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','Variable','name','toLowerCase','priority','getString','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','https://xcally.desk.com/web/agent/case/%d','error','catch','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3a0e,0x143));var _0xe3a0=function(_0x2da8d4,_0x33d08){_0x2da8d4=_0x2da8d4-0x0;var _0x464e23=_0x3a0e[_0x2da8d4];return _0x464e23;};'use strict';var _=require(_0xe3a0('0x0'));var rp=require('request-promise');var md5=require(_0xe3a0('0x1'));var util=require(_0xe3a0('0x2'));var Redis=require(_0xe3a0('0x3'));var intUtil=require(_0xe3a0('0x4'));var config=require(_0xe3a0('0x5'));var logger=require('../../../../config/logger')(_0xe3a0('0x6'));config[_0xe3a0('0x7')]=_[_0xe3a0('0x8')](config['redis'],{'host':_0xe3a0('0x9'),'port':0x18eb});var io=require(_0xe3a0('0xa'))(new Redis(config[_0xe3a0('0x7')]));function emit(_0x20c1e4,_0x12667d,_0x565aa6){io['to'](_0x20c1e4)['emit'](_0x12667d,_0x565aa6);}var headers={'Content-Type':_0xe3a0('0xb'),'Accept':_0xe3a0('0xb')};function getUser(_0x26e924,_0x503df5){if(intUtil[_0xe3a0('0xc')](_0x503df5)===!![]){logger['info'](_0xe3a0('0xd'),_0x503df5);return request({'uri':util[_0xe3a0('0xe')](_0xe3a0('0xf'),_0x26e924[_0xe3a0('0x10')])})[_0xe3a0('0x11')](function(_0x1f2ee4){if(_0x1f2ee4[_0xe3a0('0x12')]){return _[_0xe3a0('0x13')](_0x1f2ee4['_embedded'][_0xe3a0('0x14')],{'email':_0x503df5});}})[_0xe3a0('0x11')](function(_0x14c39b){if(_0x14c39b){logger[_0xe3a0('0x15')]('Agent\x20found!');return _0x14c39b;}else{logger[_0xe3a0('0x15')](_0xe3a0('0x16'));return request({'uri':util['format']('%s/users/me',_0x26e924[_0xe3a0('0x10')])});}});}else{logger[_0xe3a0('0x15')](_0xe3a0('0x17'));return request({'uri':util['format'](_0xe3a0('0x18'),_0x26e924[_0xe3a0('0x10')])});}}function request(_0x3ce6d4){logger['debug'](_0xe3a0('0x19'),JSON[_0xe3a0('0x1a')](_0x3ce6d4));return rp(_['defaults'](_0x3ce6d4,{'method':_0xe3a0('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0xf512c5){var _0x2c2d72;if(_0xf512c5['authType']==='basic'){_0x2c2d72=util['format'](_0xe3a0('0x1c'),_0xf512c5[_0xe3a0('0x1d')],_0xf512c5[_0xe3a0('0x1e')]);}else if(_0xf512c5[_0xe3a0('0x1f')]===_0xe3a0('0x20')){_0x2c2d72=util[_0xe3a0('0xe')](_0xe3a0('0x21'),_0xf512c5['username'],_0xf512c5[_0xe3a0('0x20')]);}return util[_0xe3a0('0xe')](_0xe3a0('0x22'),new Buffer(_0x2c2d72)[_0xe3a0('0x23')](_0xe3a0('0x24')));}function getEndUser(_0x55e3ab,_0x204acb,_0x1b7d4e){logger[_0xe3a0('0x15')](_0xe3a0('0x25'),_0x1b7d4e);return request({'uri':util[_0xe3a0('0xe')]('%s/customers/search',_0x55e3ab[_0xe3a0('0x10')]),'qs':{'phone':_0x1b7d4e}})[_0xe3a0('0x11')](function(_0x3dab82){if(_0x3dab82[_0xe3a0('0x12')]){logger[_0xe3a0('0x15')](_0xe3a0('0x26'));return _0x3dab82['_embedded'][_0xe3a0('0x14')][0x0];}else{logger['info'](_0xe3a0('0x27'));return request({'uri':util['format'](_0xe3a0('0x28'),_0x55e3ab[_0xe3a0('0x10')]),'method':_0xe3a0('0x29'),'body':{'first_name':_0x204acb,'title':_0x204acb,'phone_numbers':[{'type':_0xe3a0('0x2a'),'value':_0x1b7d4e}]}});}});}function getTags(_0x20319e,_0x39ac1a){var _0x45b7fd=[];if(_0x20319e&&_0x20319e[_0xe3a0('0x2b')]>0x0){_0x45b7fd=_[_0xe3a0('0x2c')](_0x20319e,_0x39ac1a);}return _0x45b7fd;}function getCustomFields(_0x3a68c7,_0x3548f0){var _0x588960=[];var _0x2653be={'custom_fields':{}};if(_0x3a68c7[_0xe3a0('0x2b')]>0x0){_[_0xe3a0('0x2d')](_0x3a68c7,function(_0x343684){if(_[_0xe3a0('0x2e')]([_0xe3a0('0x2f'),_0xe3a0('0x30')],_0x343684[_0xe3a0('0x31')])&&_0x343684[_0xe3a0('0x32')]&&!_0x343684[_0xe3a0('0x33')]){_0x2653be[_0x343684[_0xe3a0('0x32')]['toLowerCase']()]=_0x343684[_0xe3a0('0x34')]['toString']();}else if(_[_0xe3a0('0x2e')]([_0xe3a0('0x2f'),_0xe3a0('0x30')],_0x343684[_0xe3a0('0x31')])&&_0x343684[_0xe3a0('0x35')]&&_0x343684[_0xe3a0('0x33')]){_0x2653be[_0xe3a0('0x36')][_0x343684[_0xe3a0('0x35')]]=_0x343684['content']['toString']();}else if(_0x343684['type']===_0xe3a0('0x37')&&_0x343684['variableName']&&_0x343684['idField']&&_0x343684[_0xe3a0('0x33')]){_0x3548f0[_0x343684[_0xe3a0('0x38')]]&&(_0x2653be[_0xe3a0('0x36')][_0x343684[_0xe3a0('0x35')]]=_0x3548f0[_0x343684['variableName']]['toString']());}else if(_0x343684[_0xe3a0('0x31')]===_0xe3a0('0x39')&&_0x343684[_0xe3a0('0x3a')]&&_0x343684['Variable'][_0xe3a0('0x3b')]&&_0x343684[_0xe3a0('0x35')]&&_0x343684[_0xe3a0('0x33')]){_0x3548f0[_0x343684[_0xe3a0('0x3a')][_0xe3a0('0x3b')][_0xe3a0('0x3c')]()]&&(_0x2653be[_0xe3a0('0x36')][_0x343684[_0xe3a0('0x35')]]=_0x3548f0[_0x343684[_0xe3a0('0x3a')][_0xe3a0('0x3b')][_0xe3a0('0x3c')]()]['toString']());}});}if(_0x2653be['priority']){_0x2653be['priority']=Number(_0x2653be[_0xe3a0('0x3d')]);}return _0x2653be;}function getTicket(_0xa9c7bb,_0x4bd4a0,_0x1c2356,_0x1ebfd1,_0x2fc6ad){logger[_0xe3a0('0x15')]('Creating\x20new\x20ticket...');var _0x502c78=_['merge']({'subject':intUtil[_0xe3a0('0x3e')](_0x1ebfd1['Subjects'],_0x2fc6ad,'\x20'),'type':'phone','status':_0xe3a0('0x3f'),'labels':[_0xe3a0('0x40'),_0xe3a0('0x41'),_0xe3a0('0x42')][_0xe3a0('0x43')](getTags(_0x1ebfd1['Tags'],_0xe3a0('0x3b'))),'description':intUtil[_0xe3a0('0x3e')](_0x1ebfd1[_0xe3a0('0x44')],_0x2fc6ad,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xe3a0('0x45'),_0x4bd4a0['id']),'class':_0xe3a0('0x46')}},'message':{'direction':'in','body':intUtil[_0xe3a0('0x3e')](_0x1ebfd1[_0xe3a0('0x44')],_0x2fc6ad,'\x0a')}},getCustomFields(_0x1ebfd1['Fields'],_0x2fc6ad));return request({'uri':util['format'](_0xe3a0('0x47'),_0xa9c7bb['remoteUri'],_0x1c2356['id']),'method':'POST','body':_0x502c78});}exports['queue']=function(_0xd249e0,_0x1a1335,_0x13fa70,_0x568ce8,_0x520ff2,_0x2b2549){var _0x2955ad,_0x63c107;_0x2b2549['remoteUri']=intUtil[_0xe3a0('0x48')](_0x2b2549[_0xe3a0('0x10')]);_0x2b2549['serverUrl']=intUtil[_0xe3a0('0x48')](_0x2b2549['serverUrl']);if(_0x520ff2&&_0x520ff2[_0xe3a0('0x49')]){logger['info'](_0xe3a0('0x4a'),_0xe3a0('0x4b'));_0x1a1335[_0xe3a0('0x4c')]=util[_0xe3a0('0xe')](_0xe3a0('0x4d'),_0x2b2549[_0xe3a0('0x4e')],_0x1a1335[_0xe3a0('0x4f')],md5(_0x1a1335['uniqueid']));}else{_0x1a1335['recordingURL']='';}headers[_0xe3a0('0x50')]=getAuth(_0x2b2549);return getUser(_0x2b2549,_0x568ce8['email'])[_0xe3a0('0x11')](function(_0x4032b8){_0x2955ad=_0x4032b8;logger['info']('The\x20User\x20ID\x20is:',_0x2955ad['id']);return getEndUser(_0x2b2549,_0x1a1335[_0xe3a0('0x51')],_0x1a1335[_0xe3a0('0x52')]);})[_0xe3a0('0x11')](function(_0xd88b5f){_0x63c107=_0xd88b5f;logger['info'](_0xe3a0('0x53'),_0x63c107['id']);return getTicket(_0x2b2549,_0x2955ad,_0x63c107,_0x13fa70,_0x1a1335);})[_0xe3a0('0x11')](function(_0x89a3a6){if(_0x89a3a6){logger[_0xe3a0('0x15')](_0xe3a0('0x54'));logger[_0xe3a0('0x15')](_0xe3a0('0x55'),_0x89a3a6['id']);switch(_0x2b2549[_0xe3a0('0x31')]){case _0xe3a0('0x56'):logger[_0xe3a0('0x15')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xe3a0('0xe')](_0xe3a0('0x57'),_0x568ce8[_0xe3a0('0x3b')]),_0xe3a0('0x58'),{'recordId':_0x89a3a6['id']});break;case'newTab':logger[_0xe3a0('0x15')](_0xe3a0('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe3a0('0xe')]('user:%s',_0x568ce8[_0xe3a0('0x3b')]),'trigger:browser:url',{'uri':util[_0xe3a0('0xe')](_0xe3a0('0x59'),_0x89a3a6['id'])});break;default:logger[_0xe3a0('0x5a')](_0xe3a0('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xe3a0('0x5b')](function(_0x2ffcf3){console[_0xe3a0('0x5a')](_0x2ffcf3);logger[_0xe3a0('0x5a')]('[QUEUE]',JSON[_0xe3a0('0x1a')](_0x2ffcf3));});};exports['outbound']=function(_0xa8f0c7,_0x2b98a6,_0x4ddd35,_0x2e7eab,_0x2ba25b,_0x50c404,_0x51a01f){var _0x580efb,_0x3040b7;_0x50c404[_0xe3a0('0x10')]=intUtil[_0xe3a0('0x48')](_0x50c404[_0xe3a0('0x10')]);_0x50c404[_0xe3a0('0x4e')]=intUtil['stripTrailingSlash'](_0x50c404['serverUrl']);if(_0x51a01f&&_0x51a01f[_0xe3a0('0x5c')]&&_0x51a01f['recordingFormat']!==_0xe3a0('0x5d')){logger[_0xe3a0('0x15')](_0xe3a0('0x5e'),'Recording\x20is\x20enabled!');_0x2b98a6[_0xe3a0('0x4c')]=util[_0xe3a0('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50c404[_0xe3a0('0x4e')],_0x2b98a6[_0xe3a0('0x4f')],md5(_0x2b98a6['uniqueid']));}headers[_0xe3a0('0x50')]=getAuth(_0x50c404);return getUser(_0x50c404,_0x2e7eab[_0xe3a0('0x5f')])[_0xe3a0('0x11')](function(_0x36f588){_0x580efb=_0x36f588;logger[_0xe3a0('0x15')]('The\x20User\x20ID\x20is:',_0x580efb['id']);return getEndUser(_0x50c404,_0x2b98a6[_0xe3a0('0x60')],_0x2b98a6[_0xe3a0('0x61')]);})[_0xe3a0('0x11')](function(_0x5df3be){_0x3040b7=_0x5df3be;logger['info'](_0xe3a0('0x53'),_0x3040b7['id']);return getTicket(_0x50c404,_0x580efb,_0x3040b7,_0x4ddd35,_0x2b98a6);})[_0xe3a0('0x11')](function(_0x3d7af1){if(_0x3d7af1){logger[_0xe3a0('0x15')](_0xe3a0('0x54'));logger[_0xe3a0('0x15')](_0xe3a0('0x55'),_0x3d7af1['id']);switch(_0x50c404[_0xe3a0('0x31')]){case _0xe3a0('0x56'):logger['info'](_0xe3a0('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xe3a0('0xe')]('user:%s',_0x2e7eab['name']),_0xe3a0('0x58'),{'recordId':_0x3d7af1['id']});break;case _0xe3a0('0x62'):logger[_0xe3a0('0x15')](_0xe3a0('0x4a'),_0xe3a0('0x63'));emit(util[_0xe3a0('0xe')]('user:%s',_0x2e7eab['name']),_0xe3a0('0x64'),{'uri':util[_0xe3a0('0xe')](_0xe3a0('0x65'),_0x50c404['remoteUri'],_0x3d7af1['id'])});break;default:logger['error'](_0xe3a0('0x5e'),_0xe3a0('0x66'));}}})[_0xe3a0('0x5b')](function(_0x69543e){logger[_0xe3a0('0x5a')](_0xe3a0('0x5e'),JSON[_0xe3a0('0x1a')](_0x69543e));});};exports[_0xe3a0('0x67')]=function(_0x14c0f6,_0x562b84,_0x3aaa09,_0x2254ad,_0x78509b,_0x899232){var _0x3cab9b,_0x4c8df2;_0x899232[_0xe3a0('0x10')]=intUtil[_0xe3a0('0x48')](_0x899232['remoteUri']);_0x899232[_0xe3a0('0x4e')]=intUtil['stripTrailingSlash'](_0x899232[_0xe3a0('0x4e')]);if(_0x78509b&&_0x78509b['monitor_format']){logger['info']('['+_0x562b84[_0xe3a0('0x68')]['toUpperCase']()+']',_0xe3a0('0x4b'));_0x562b84[_0xe3a0('0x4c')]=util[_0xe3a0('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x899232[_0xe3a0('0x4e')],_0x562b84[_0xe3a0('0x4f')],md5(_0x562b84[_0xe3a0('0x4f')]));}else{_0x562b84[_0xe3a0('0x4c')]='';}headers[_0xe3a0('0x50')]=getAuth(_0x899232);return getUser(_0x899232)[_0xe3a0('0x11')](function(_0x296f10){_0x3cab9b=_0x296f10;logger[_0xe3a0('0x15')]('The\x20User\x20ID\x20is:',_0x3cab9b['id']);return getEndUser(_0x899232,_0x562b84[_0xe3a0('0x51')],_0x562b84[_0xe3a0('0x52')]);})[_0xe3a0('0x11')](function(_0x47a4e4){_0x4c8df2=_0x47a4e4;logger[_0xe3a0('0x15')](_0xe3a0('0x53'),_0x4c8df2['id']);return getTicket(_0x899232,_0x3cab9b,_0x4c8df2,_0x3aaa09,_0x562b84);})[_0xe3a0('0x11')](function(_0x29212b){if(_0x29212b){logger['info'](_0xe3a0('0x54'));logger[_0xe3a0('0x15')](_0xe3a0('0x55'),_0x29212b['id']);}})[_0xe3a0('0x5b')](function(_0x106167){logger[_0xe3a0('0x5a')]('['+_0x562b84['lastevent'][_0xe3a0('0x69')]()+']',JSON['stringify'](_0x106167));});}; \ 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 06e1ecc..09a6d85 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 _0x9fe7=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId','catch','toLowerCase','calleridnum','odata-entityid','substring','lastIndexOf','outbound','destcalleridnum','enduserId',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','picklist','type','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','/systemusers(','phonecall','phonecalls','Subjects','callDirection','queue','Fields','headers','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','uniqueid'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x9fe7,0x1df));var _0x79fe=function(_0x2cd657,_0x7943f6){_0x2cd657=_0x2cd657-0x0;var _0x5e1ac6=_0x9fe7[_0x2cd657];return _0x5e1ac6;};'use strict';var _=require(_0x79fe('0x0'));var BPromise=require(_0x79fe('0x1'));var rp=require('request-promise');var util=require(_0x79fe('0x2'));var intUtil=require('./util');var md5=require(_0x79fe('0x3'));var Redis=require(_0x79fe('0x4'));var logger=require(_0x79fe('0x5'))('dynamics365');var config=require(_0x79fe('0x6'));config[_0x79fe('0x7')]=_[_0x79fe('0x8')](config['redis'],{'host':_0x79fe('0x9'),'port':0x18eb});var io=require(_0x79fe('0xa'))(new Redis(config[_0x79fe('0x7')]));function getAuthToken(_0x4c8314,_0x24faa0,_0x264323){var _0x29b317={'method':_0x79fe('0xb'),'uri':_0x24faa0,'form':{'client_id':_0x4c8314[_0x79fe('0xc')],'resource':_0x4c8314['remoteUri'],'username':_0x4c8314[_0x79fe('0xd')],'password':_0x4c8314[_0x79fe('0xe')],'grant_type':'password','client_secret':_0x4c8314[_0x79fe('0xf')]},'json':!![]};return rp(_0x29b317)[_0x79fe('0x10')](function(_0x33351e){return _0x33351e[_0x79fe('0x11')];})['catch'](function(_0x3e6e31){logger[_0x79fe('0x12')]('['+[_0x264323[_0x79fe('0x13')]()]+_0x79fe('0x14'));return _0x3e6e31[_0x79fe('0x15')];});}function getUser(_0x260734,_0x42bbe4,_0x1abd7f,_0x4be1c4,_0x3bd14a,_0x238e60){return new BPromise(function(_0x3f2d8a,_0x536944){return getAuthToken(_0x42bbe4,_0x4be1c4,_0x238e60)[_0x79fe('0x10')](function(_0x25e91b){var _0x58124b={'method':_0x79fe('0x16'),'uri':_0x3bd14a+_0x79fe('0x17'),'headers':{'Authorization':_0x79fe('0x18')+_0x25e91b,'OData-Version':_0x79fe('0x19')},'json':!![]};return rp(_0x58124b);})['then'](function(_0x416b5b){var _0x16f93a=_0x416b5b[_0x79fe('0x1a')];var _0x40a549=![];var _0x536641=null;if(!_['isNil'](_0x1abd7f)){if(intUtil[_0x79fe('0x1b')](_0x1abd7f[_0x79fe('0x1c')])){_0x260734[_0x79fe('0x1d')]=_0x1abd7f['email'];for(_0x536641=0x0;_0x536641<_0x16f93a[_0x79fe('0x1e')];_0x536641++){if(_0x16f93a[_0x536641][_0x79fe('0x1f')]===_0x1abd7f[_0x79fe('0x1c')]&&!_0x16f93a[_0x536641]['isdisabled']){_0x40a549=!![];logger[_0x79fe('0x20')]('['+[_0x238e60['toUpperCase']()]+_0x79fe('0x21')+_0x16f93a[_0x536641][_0x79fe('0x22')]+'!');_0x260734[_0x79fe('0x23')]=_0x16f93a[_0x536641][_0x79fe('0x22')];}}}}if(!_0x40a549){logger[_0x79fe('0x20')]('['+[_0x238e60[_0x79fe('0x13')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x260734['userEmail']=_0x42bbe4[_0x79fe('0xd')];for(_0x536641=0x0;_0x536641<_0x16f93a['length'];_0x536641++){if(_0x16f93a[_0x536641][_0x79fe('0x1f')]===_0x42bbe4[_0x79fe('0xd')]){_0x260734['userId']=_0x16f93a[_0x536641]['systemuserid'];}}}_0x3f2d8a(_0x260734);})[_0x79fe('0x24')](function(_0x321778){_0x536944(_0x321778['message']);});});}function createEndUser(_0x46d93d,_0x1c1f74,_0x5c84e0,_0x4d60e8,_0x4ea368,_0x3720fa){return new BPromise(function(_0x2d890e,_0x36ead5){return getAuthToken(_0x1c1f74,_0x5c84e0,_0x3720fa)['then'](function(_0x47786f){var _0x43782e=_0x3720fa[_0x79fe('0x25')]()==='outbound'?_0x4ea368['destcalleridnum']:_0x4ea368[_0x79fe('0x26')];var _0x51200f={'method':_0x79fe('0xb'),'uri':_0x4d60e8+'contacts','body':{'telephone1':_0x43782e,'fullname':_0x43782e,'firstname':_0x43782e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x46d93d['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x47786f,'OData-Version':_0x79fe('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x51200f);})[_0x79fe('0x10')](function(_0x4dff5f){var _0x2b6975=_0x4dff5f['headers'][_0x79fe('0x27')];var _0x2d3324=_0x2b6975[_0x79fe('0x28')](_0x2b6975[_0x79fe('0x29')]('(')+0x1,_0x2b6975[_0x79fe('0x29')](')'));_0x46d93d['enduserId']=_0x2d3324;_0x2d890e(_0x46d93d);})[_0x79fe('0x24')](function(_0x2dbf62){_0x36ead5(_0x2dbf62[_0x79fe('0x15')]);});});}function getEndUser(_0x190202,_0x445db9,_0x4034b8,_0x57ab6b,_0x3b50e7,_0x125226){return new BPromise(function(_0x8ddef3,_0x9d93c1){return getAuthToken(_0x445db9,_0x4034b8,_0x125226)[_0x79fe('0x10')](function(_0x6a8a24){var _0x596040={'method':_0x79fe('0x16'),'uri':_0x57ab6b+'contacts?$select=telephone1','headers':{'Authorization':_0x79fe('0x18')+_0x6a8a24,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x596040);})[_0x79fe('0x10')](function(_0x5a4f73){var _0x1ee275=null;if(_0x5a4f73){var _0x16c7b8=_0x5a4f73[_0x79fe('0x1a')];var _0x4fb6f4=![];for(_0x1ee275=0x0;_0x1ee275<_0x16c7b8[_0x79fe('0x1e')];_0x1ee275++){var _0x2646d6=_0x125226[_0x79fe('0x25')]()===_0x79fe('0x2a')?_0x3b50e7[_0x79fe('0x2b')]:_0x3b50e7['calleridnum'];if(_0x16c7b8[_0x1ee275]['telephone1']===_0x2646d6){_0x4fb6f4=!![];_0x190202[_0x79fe('0x2c')]=_0x16c7b8[_0x1ee275]['contactid'];}}if(_0x4fb6f4){_0x8ddef3(_0x190202);}else{return createEndUser(_0x190202,_0x445db9,_0x4034b8,_0x57ab6b,_0x3b50e7,_0x125226)[_0x79fe('0x10')](function(_0x44d97e){logger['info']('['+[_0x125226[_0x79fe('0x13')]()]+_0x79fe('0x2d'),_0x44d97e[_0x79fe('0x2c')]);_0x8ddef3(_0x44d97e);});}}else{return createEndUser(_0x190202,_0x445db9,_0x4034b8,_0x57ab6b,_0x3b50e7,_0x125226)[_0x79fe('0x10')](function(_0x43d8b6){logger[_0x79fe('0x20')]('['+[_0x125226['toUpperCase']()]+_0x79fe('0x2e'),_0x43d8b6[_0x79fe('0x2c')]);_0x8ddef3(_0x43d8b6);});}});});}function getCustomFields(_0x35a5ec,_0x2d2908,_0x4eada4){var _0x237ee7={};if(_0x35a5ec['length']>0x0){_[_0x79fe('0x2f')](_0x35a5ec,function(_0x5e29b5){if(_[_0x79fe('0x30')](['string',_0x79fe('0x31')],_0x5e29b5[_0x79fe('0x32')])&&_0x5e29b5['nameField']&&!_0x5e29b5['customField']){var _0x4137a3=_0x5e29b5[_0x79fe('0x33')][_0x79fe('0x25')]();var _0xeb03e4=_0x4137a3['substring'](0x0,_0x4137a3['indexOf']('_'));var _0x37c37b=_0x4137a3[_0x79fe('0x28')](_0x4137a3[_0x79fe('0x34')]('_')+0x1);if(_0xeb03e4===_0x4eada4){_0x237ee7[_0x37c37b]=_0x5e29b5[_0x79fe('0x35')];}}});}return _0x237ee7;}function getTicket(_0x2e0a27,_0x3feb46,_0xc31ac6,_0x43c316,_0x48b1ac,_0x2d13fb,_0x1d1a88){return new BPromise(function(_0x1552aa,_0x18e8f9){var _0x461f38;return getAuthToken(_0x3feb46,_0xc31ac6,_0x1d1a88)[_0x79fe('0x10')](function(_0x5b0d66){if(_0x2d13fb[_0x79fe('0x36')]===_0x79fe('0x37')){_0x461f38={'method':_0x79fe('0xb'),'uri':_0x43c316+_0x79fe('0x38'),'body':Object[_0x79fe('0x39')]({},{'title':intUtil[_0x79fe('0x3a')](_0x2d13fb['Subjects'],_0x48b1ac,'\x20'),'description':intUtil[_0x79fe('0x3a')](_0x2d13fb[_0x79fe('0x3b')],_0x48b1ac,'\x0a'),'customerid_contact@odata.bind':_0x79fe('0x3c')+_0x2e0a27['enduserId']+')','ownerid@odata.bind':_0x79fe('0x3d')+_0x2e0a27['userId']+')','caseorigincode':'1'},getCustomFields(_0x2d13fb['Fields'],_0x48b1ac,_0x2d13fb[_0x79fe('0x36')])),'headers':{'Authorization':_0x79fe('0x18')+_0x5b0d66,'OData-Version':_0x79fe('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2d13fb['ticketType']===_0x79fe('0x3e')){_0x461f38={'method':_0x79fe('0xb'),'uri':_0x43c316+_0x79fe('0x3f'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x2d13fb[_0x79fe('0x40')],_0x48b1ac,'\x20'),'phonenumber':String(_0x48b1ac[_0x79fe('0x26')]),'description':intUtil[_0x79fe('0x3a')](_0x2d13fb[_0x79fe('0x3b')],_0x48b1ac,'\x0a'),'regardingobjectid_contact@odata.bind':_0x79fe('0x3c')+_0x2e0a27[_0x79fe('0x2c')]+')','ownerid@odata.bind':_0x79fe('0x3d')+_0x2e0a27[_0x79fe('0x23')]+')','directioncode':_0x2e0a27[_0x79fe('0x41')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x79fe('0x3d')+_0x2e0a27[_0x79fe('0x23')]+')','participationtypemask':_0x2e0a27['callDirection']===_0x79fe('0x42')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x2e0a27[_0x79fe('0x2c')]+')','participationtypemask':_0x2e0a27[_0x79fe('0x41')]===_0x79fe('0x42')?0x1:0x2}]},getCustomFields(_0x2d13fb[_0x79fe('0x43')],_0x48b1ac,_0x2d13fb['ticketType'])),'headers':{'Authorization':_0x79fe('0x18')+_0x5b0d66,'OData-Version':_0x79fe('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x461f38);})[_0x79fe('0x10')](function(_0x4df405){var _0x5cfd05=_0x4df405[_0x79fe('0x44')][_0x79fe('0x27')];var _0x5a00f5=_0x5cfd05[_0x79fe('0x28')](_0x5cfd05[_0x79fe('0x29')]('(')+0x1,_0x5cfd05[_0x79fe('0x29')](')'));_0x2e0a27[_0x79fe('0x45')]=_0x5a00f5;_0x1552aa(_0x2e0a27);})['catch'](function(_0x47520b){_0x18e8f9(_0x47520b[_0x79fe('0x15')]);});});}function emit(_0x1a9bb7,_0x573999,_0x5287eb,_0x4dc50e){var _0x4fb699={'uri':util['format'](_0x79fe('0x46'),_0x1a9bb7,_0x5287eb,_0x4dc50e)};io['to'](util[_0x79fe('0x47')]('user:%s',_0x573999))[_0x79fe('0x48')](_0x79fe('0x49'),_0x4fb699);}exports['cs']=function(_0x167ab6,_0x4a2a42,_0x582e17,_0x49e33b,_0x2ccdb8,_0x5764c5,_0x3c98d5,_0x3640ac){var _0x160dea={};_0x5764c5[_0x79fe('0x4a')]=intUtil[_0x79fe('0x4b')](_0x5764c5[_0x79fe('0x4a')]);_0x5764c5[_0x79fe('0x4c')]=intUtil[_0x79fe('0x4b')](_0x5764c5[_0x79fe('0x4c')]);_0x160dea[_0x79fe('0x41')]=_0x3640ac===_0x79fe('0x42')||_0x3640ac==='unmanaged'?_0x79fe('0x42'):_0x79fe('0x2a');var _0x4a5468=util[_0x79fe('0x47')]('%s/api/data/v9.0/',_0x5764c5[_0x79fe('0x4a')]);var _0x1fff51=util['format'](_0x79fe('0x4d'),_0x5764c5['tenantId']);var _0x5dd760=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5764c5['serverUrl'],_0x4a2a42[_0x79fe('0x4e')],md5(_0x4a2a42[_0x79fe('0x4e')]));if(_0x2ccdb8&&_0x2ccdb8[_0x79fe('0x4f')]){logger[_0x79fe('0x20')](_0x79fe('0x50'),_0x79fe('0x51'));_0x4a2a42[_0x79fe('0x52')]=_0x5dd760;}else if(_0x3c98d5&&_0x3c98d5[_0x79fe('0x53')]&&_0x3c98d5[_0x79fe('0x53')]!=='none'){logger[_0x79fe('0x20')](_0x79fe('0x54'),_0x79fe('0x51'));_0x4a2a42[_0x79fe('0x52')]=_0x5dd760;}else{_0x4a2a42['recordingURL']='';}return getUser(_0x160dea,_0x5764c5,_0x49e33b,_0x1fff51,_0x4a5468,_0x3640ac)[_0x79fe('0x10')](function(_0x4e7631){logger[_0x79fe('0x20')]('['+_0x3640ac['toUpperCase']()+_0x79fe('0x55'),_0x4e7631[_0x79fe('0x23')]);logger[_0x79fe('0x20')]('['+_0x3640ac[_0x79fe('0x13')]()+']\x20The\x20User\x20email\x20is:',_0x4e7631[_0x79fe('0x1d')]);return getEndUser(_0x4e7631,_0x5764c5,_0x1fff51,_0x4a5468,_0x4a2a42,_0x3640ac);})[_0x79fe('0x10')](function(_0x25eb0d){logger[_0x79fe('0x20')]('['+_0x3640ac['toUpperCase']()+_0x79fe('0x56'),_0x25eb0d[_0x79fe('0x2c')]);logger['info']('['+_0x3640ac[_0x79fe('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x4a2a42['calleridnum']);return getTicket(_0x25eb0d,_0x5764c5,_0x1fff51,_0x4a5468,_0x4a2a42,_0x582e17,_0x3640ac);})[_0x79fe('0x10')](function(_0xb50945){logger[_0x79fe('0x20')](util['format']('['+_0x3640ac['toUpperCase']()+_0x79fe('0x57'),_0x582e17['ticketType'],_0xb50945['ticketId']));logger[_0x79fe('0x20')](util[_0x79fe('0x47')]('['+_0x3640ac[_0x79fe('0x13')]()+_0x79fe('0x58'),_0x3640ac));if(_0x3640ac!==_0x79fe('0x59')){logger[_0x79fe('0x20')]('['+_0x3640ac[_0x79fe('0x13')]()+']',_0x79fe('0x5a'));emit(_0x5764c5[_0x79fe('0x4a')],_0x49e33b['name'],_0x582e17[_0x79fe('0x36')],_0xb50945[_0x79fe('0x45')]);}})['catch'](function(_0x229f2e){logger[_0x79fe('0x12')]('['+_0x3640ac[_0x79fe('0x13')]()+_0x79fe('0x5b'),util[_0x79fe('0x5c')](_0x229f2e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbd51=['callDirection','queue','odata-entityid','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','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]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','redis','defaults','socket.io-emitter','POST','remoteUri','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecalls'];(function(_0x3cc27e,_0xce6c26){var _0x50bac0=function(_0x1fdcef){while(--_0x1fdcef){_0x3cc27e['push'](_0x3cc27e['shift']());}};_0x50bac0(++_0xce6c26);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x55e2be,_0x3b42b6){_0x55e2be=_0x55e2be-0x0;var _0x3fd0ad=_0xbd51[_0x55e2be];return _0x3fd0ad;};'use strict';var _=require(_0x1bd5('0x0'));var BPromise=require('bluebird');var rp=require(_0x1bd5('0x1'));var util=require(_0x1bd5('0x2'));var intUtil=require(_0x1bd5('0x3'));var md5=require(_0x1bd5('0x4'));var Redis=require('ioredis');var logger=require('../../../../config/logger')('dynamics365');var config=require('../../../../config/environment');config[_0x1bd5('0x5')]=_[_0x1bd5('0x6')](config[_0x1bd5('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1bd5('0x7'))(new Redis(config[_0x1bd5('0x5')]));function getAuthToken(_0x19077c,_0x27d58f,_0xd8418f){var _0x4a7f90={'method':_0x1bd5('0x8'),'uri':_0x27d58f,'form':{'client_id':_0x19077c['clientId'],'resource':_0x19077c[_0x1bd5('0x9')],'username':_0x19077c[_0x1bd5('0xa')],'password':_0x19077c[_0x1bd5('0xb')],'grant_type':_0x1bd5('0xb'),'client_secret':_0x19077c[_0x1bd5('0xc')]},'json':!![]};return rp(_0x4a7f90)[_0x1bd5('0xd')](function(_0x4c9f06){return _0x4c9f06[_0x1bd5('0xe')];})['catch'](function(_0x26e916){logger[_0x1bd5('0xf')]('['+[_0xd8418f[_0x1bd5('0x10')]()]+_0x1bd5('0x11'));return _0x26e916[_0x1bd5('0x12')];});}function getUser(_0x81f02c,_0x1527c1,_0x4942df,_0x5650b5,_0x8b2390,_0x6d2c40){return new BPromise(function(_0x33f82a,_0x39c44b){return getAuthToken(_0x1527c1,_0x5650b5,_0x6d2c40)['then'](function(_0x5072c2){var _0xa63190={'method':_0x1bd5('0x13'),'uri':_0x8b2390+_0x1bd5('0x14'),'headers':{'Authorization':_0x1bd5('0x15')+_0x5072c2,'OData-Version':_0x1bd5('0x16')},'json':!![]};return rp(_0xa63190);})[_0x1bd5('0xd')](function(_0x13cf34){var _0x3afc4a=_0x13cf34[_0x1bd5('0x17')];var _0x4c1e84=![];var _0x53ad5e=null;if(!_[_0x1bd5('0x18')](_0x4942df)){if(intUtil[_0x1bd5('0x19')](_0x4942df[_0x1bd5('0x1a')])){_0x81f02c[_0x1bd5('0x1b')]=_0x4942df[_0x1bd5('0x1a')];for(_0x53ad5e=0x0;_0x53ad5e<_0x3afc4a[_0x1bd5('0x1c')];_0x53ad5e++){if(_0x3afc4a[_0x53ad5e][_0x1bd5('0x1d')]===_0x4942df[_0x1bd5('0x1a')]&&!_0x3afc4a[_0x53ad5e][_0x1bd5('0x1e')]){_0x4c1e84=!![];logger[_0x1bd5('0x1f')]('['+[_0x6d2c40[_0x1bd5('0x10')]()]+_0x1bd5('0x20')+_0x3afc4a[_0x53ad5e][_0x1bd5('0x21')]+'!');_0x81f02c[_0x1bd5('0x22')]=_0x3afc4a[_0x53ad5e][_0x1bd5('0x21')];}}}}if(!_0x4c1e84){logger[_0x1bd5('0x1f')]('['+[_0x6d2c40[_0x1bd5('0x10')]()]+_0x1bd5('0x23'));_0x81f02c['userEmail']=_0x1527c1[_0x1bd5('0xa')];for(_0x53ad5e=0x0;_0x53ad5e<_0x3afc4a['length'];_0x53ad5e++){if(_0x3afc4a[_0x53ad5e][_0x1bd5('0x1d')]===_0x1527c1[_0x1bd5('0xa')]){_0x81f02c[_0x1bd5('0x22')]=_0x3afc4a[_0x53ad5e]['systemuserid'];}}}_0x33f82a(_0x81f02c);})[_0x1bd5('0x24')](function(_0x4fa37c){_0x39c44b(_0x4fa37c[_0x1bd5('0x12')]);});});}function createEndUser(_0x30676d,_0x3dba4f,_0x430461,_0x47c84b,_0x202ed3,_0x69bb17){return new BPromise(function(_0x20245c,_0x3b1090){return getAuthToken(_0x3dba4f,_0x430461,_0x69bb17)['then'](function(_0xdba332){var _0x24d4d9=_0x69bb17[_0x1bd5('0x25')]()===_0x1bd5('0x26')?_0x202ed3[_0x1bd5('0x27')]:_0x202ed3[_0x1bd5('0x28')];var _0x4e72b2={'method':_0x1bd5('0x8'),'uri':_0x47c84b+_0x1bd5('0x29'),'body':{'telephone1':_0x24d4d9,'fullname':_0x24d4d9,'firstname':_0x24d4d9,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1bd5('0x2a')+_0x30676d['userId']+')'},'headers':{'Authorization':_0x1bd5('0x15')+_0xdba332,'OData-Version':_0x1bd5('0x16')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4e72b2);})[_0x1bd5('0xd')](function(_0x3430bf){var _0x1f4456=_0x3430bf[_0x1bd5('0x2b')]['odata-entityid'];var _0x49ea1e=_0x1f4456[_0x1bd5('0x2c')](_0x1f4456[_0x1bd5('0x2d')]('(')+0x1,_0x1f4456['lastIndexOf'](')'));_0x30676d[_0x1bd5('0x2e')]=_0x49ea1e;_0x20245c(_0x30676d);})[_0x1bd5('0x24')](function(_0x1efa8c){_0x3b1090(_0x1efa8c[_0x1bd5('0x12')]);});});}function getEndUser(_0x558452,_0x5d69bd,_0x21c7c8,_0x3ec22a,_0x233743,_0x209ce1){return new BPromise(function(_0x223161,_0x42fb08){return getAuthToken(_0x5d69bd,_0x21c7c8,_0x209ce1)[_0x1bd5('0xd')](function(_0x592255){var _0x473f1d={'method':_0x1bd5('0x13'),'uri':_0x3ec22a+_0x1bd5('0x2f'),'headers':{'Authorization':_0x1bd5('0x15')+_0x592255,'If-None-Match':null,'OData-Version':_0x1bd5('0x16')},'json':!![]};return rp(_0x473f1d);})[_0x1bd5('0xd')](function(_0x41ca8c){var _0x4de4b0=null;if(_0x41ca8c){var _0x448aad=_0x41ca8c[_0x1bd5('0x17')];var _0x44ab3a=![];for(_0x4de4b0=0x0;_0x4de4b0<_0x448aad[_0x1bd5('0x1c')];_0x4de4b0++){var _0x3cf898=_0x209ce1[_0x1bd5('0x25')]()===_0x1bd5('0x26')?_0x233743['destcalleridnum']:_0x233743['calleridnum'];if(_0x448aad[_0x4de4b0][_0x1bd5('0x30')]===_0x3cf898){_0x44ab3a=!![];_0x558452[_0x1bd5('0x2e')]=_0x448aad[_0x4de4b0][_0x1bd5('0x31')];}}if(_0x44ab3a){_0x223161(_0x558452);}else{return createEndUser(_0x558452,_0x5d69bd,_0x21c7c8,_0x3ec22a,_0x233743,_0x209ce1)['then'](function(_0x4595a0){logger['info']('['+[_0x209ce1[_0x1bd5('0x10')]()]+_0x1bd5('0x32'),_0x4595a0[_0x1bd5('0x2e')]);_0x223161(_0x4595a0);});}}else{return createEndUser(_0x558452,_0x5d69bd,_0x21c7c8,_0x3ec22a,_0x233743,_0x209ce1)[_0x1bd5('0xd')](function(_0x3b3eca){logger[_0x1bd5('0x1f')]('['+[_0x209ce1[_0x1bd5('0x10')]()]+_0x1bd5('0x33'),_0x3b3eca['enduserId']);_0x223161(_0x3b3eca);});}});});}function getCustomFields(_0x114a96,_0x2978d8,_0x502724){var _0x3b5a0d={};if(_0x114a96[_0x1bd5('0x1c')]>0x0){_[_0x1bd5('0x34')](_0x114a96,function(_0x5c3b08){if(_[_0x1bd5('0x35')]([_0x1bd5('0x36'),_0x1bd5('0x37')],_0x5c3b08[_0x1bd5('0x38')])&&_0x5c3b08['nameField']&&!_0x5c3b08[_0x1bd5('0x39')]){var _0x22f437=_0x5c3b08[_0x1bd5('0x3a')][_0x1bd5('0x25')]();var _0x4de69a=_0x22f437['substring'](0x0,_0x22f437[_0x1bd5('0x3b')]('_'));var _0x35afc7=_0x22f437[_0x1bd5('0x2c')](_0x22f437['indexOf']('_')+0x1);if(_0x4de69a===_0x502724){_0x3b5a0d[_0x35afc7]=_0x5c3b08[_0x1bd5('0x3c')];}}});}return _0x3b5a0d;}function getTicket(_0x3b1092,_0x574d95,_0x1eacac,_0x5761b8,_0x21aac6,_0x218efb,_0x53ad5c){return new BPromise(function(_0x1635f1,_0x178f18){var _0x617f97;return getAuthToken(_0x574d95,_0x1eacac,_0x53ad5c)[_0x1bd5('0xd')](function(_0x3323a2){if(_0x218efb[_0x1bd5('0x3d')]===_0x1bd5('0x3e')){_0x617f97={'method':_0x1bd5('0x8'),'uri':_0x5761b8+_0x1bd5('0x3f'),'body':Object[_0x1bd5('0x40')]({},{'title':intUtil[_0x1bd5('0x41')](_0x218efb[_0x1bd5('0x42')],_0x21aac6,'\x20'),'description':intUtil['getString'](_0x218efb[_0x1bd5('0x43')],_0x21aac6,'\x0a'),'customerid_contact@odata.bind':_0x1bd5('0x44')+_0x3b1092[_0x1bd5('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x3b1092[_0x1bd5('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x218efb[_0x1bd5('0x45')],_0x21aac6,_0x218efb['ticketType'])),'headers':{'Authorization':_0x1bd5('0x15')+_0x3323a2,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x218efb[_0x1bd5('0x3d')]==='phonecall'){_0x617f97={'method':_0x1bd5('0x8'),'uri':_0x5761b8+_0x1bd5('0x46'),'body':Object['assign']({},{'subject':intUtil[_0x1bd5('0x41')](_0x218efb['Subjects'],_0x21aac6,'\x20'),'phonenumber':String(_0x21aac6[_0x1bd5('0x28')]),'description':intUtil[_0x1bd5('0x41')](_0x218efb[_0x1bd5('0x43')],_0x21aac6,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1bd5('0x44')+_0x3b1092[_0x1bd5('0x2e')]+')','ownerid@odata.bind':_0x1bd5('0x2a')+_0x3b1092[_0x1bd5('0x22')]+')','directioncode':_0x3b1092[_0x1bd5('0x47')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x1bd5('0x2a')+_0x3b1092[_0x1bd5('0x22')]+')','participationtypemask':_0x3b1092[_0x1bd5('0x47')]===_0x1bd5('0x48')?0x2:0x1},{'partyid_contact@odata.bind':_0x1bd5('0x44')+_0x3b1092[_0x1bd5('0x2e')]+')','participationtypemask':_0x3b1092['callDirection']===_0x1bd5('0x48')?0x1:0x2}]},getCustomFields(_0x218efb[_0x1bd5('0x45')],_0x21aac6,_0x218efb[_0x1bd5('0x3d')])),'headers':{'Authorization':_0x1bd5('0x15')+_0x3323a2,'OData-Version':_0x1bd5('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x617f97);})[_0x1bd5('0xd')](function(_0x1ca2eb){var _0x539d0e=_0x1ca2eb['headers'][_0x1bd5('0x49')];var _0x2d713b=_0x539d0e[_0x1bd5('0x2c')](_0x539d0e['lastIndexOf']('(')+0x1,_0x539d0e[_0x1bd5('0x2d')](')'));_0x3b1092[_0x1bd5('0x4a')]=_0x2d713b;_0x1635f1(_0x3b1092);})[_0x1bd5('0x24')](function(_0x1f2d7e){_0x178f18(_0x1f2d7e[_0x1bd5('0x12')]);});});}function emit(_0x40de9a,_0x1d66bc,_0x4db78c,_0x316fbb){var _0x2bcd23={'uri':util['format'](_0x1bd5('0x4b'),_0x40de9a,_0x4db78c,_0x316fbb)};io['to'](util['format'](_0x1bd5('0x4c'),_0x1d66bc))['emit'](_0x1bd5('0x4d'),_0x2bcd23);}exports['cs']=function(_0x555ba1,_0x5a011e,_0x25308f,_0x1abfb6,_0x1b74c2,_0x363ba8,_0x41035d,_0x33f011){var _0x35c478={};_0x363ba8['remoteUri']=intUtil[_0x1bd5('0x4e')](_0x363ba8['remoteUri']);_0x363ba8[_0x1bd5('0x4f')]=intUtil[_0x1bd5('0x4e')](_0x363ba8[_0x1bd5('0x4f')]);_0x35c478['callDirection']=_0x33f011==='queue'||_0x33f011===_0x1bd5('0x50')?_0x1bd5('0x48'):_0x1bd5('0x26');var _0x19eb1e=util[_0x1bd5('0x51')](_0x1bd5('0x52'),_0x363ba8[_0x1bd5('0x9')]);var _0x383a68=util[_0x1bd5('0x51')](_0x1bd5('0x53'),_0x363ba8['tenantId']);var _0xa8980e=util['format'](_0x1bd5('0x54'),_0x363ba8[_0x1bd5('0x4f')],_0x5a011e[_0x1bd5('0x55')],md5(_0x5a011e['uniqueid']));if(_0x1b74c2&&_0x1b74c2[_0x1bd5('0x56')]){logger[_0x1bd5('0x1f')](_0x1bd5('0x57'),'Recording\x20is\x20enabled!');_0x5a011e[_0x1bd5('0x58')]=_0xa8980e;}else if(_0x41035d&&_0x41035d[_0x1bd5('0x59')]&&_0x41035d[_0x1bd5('0x59')]!==_0x1bd5('0x5a')){logger['info']('[OUTBOUND]',_0x1bd5('0x5b'));_0x5a011e[_0x1bd5('0x58')]=_0xa8980e;}else{_0x5a011e[_0x1bd5('0x58')]='';}return getUser(_0x35c478,_0x363ba8,_0x1abfb6,_0x383a68,_0x19eb1e,_0x33f011)['then'](function(_0x4cd94e){logger[_0x1bd5('0x1f')]('['+_0x33f011['toUpperCase']()+_0x1bd5('0x5c'),_0x4cd94e[_0x1bd5('0x22')]);logger['info']('['+_0x33f011[_0x1bd5('0x10')]()+']\x20The\x20User\x20email\x20is:',_0x4cd94e[_0x1bd5('0x1b')]);return getEndUser(_0x4cd94e,_0x363ba8,_0x383a68,_0x19eb1e,_0x5a011e,_0x33f011);})['then'](function(_0x26046f){logger[_0x1bd5('0x1f')]('['+_0x33f011['toUpperCase']()+_0x1bd5('0x5d'),_0x26046f[_0x1bd5('0x2e')]);logger['info']('['+_0x33f011['toUpperCase']()+_0x1bd5('0x5e'),_0x5a011e[_0x1bd5('0x28')]);return getTicket(_0x26046f,_0x363ba8,_0x383a68,_0x19eb1e,_0x5a011e,_0x25308f,_0x33f011);})['then'](function(_0x1a9ad2){logger[_0x1bd5('0x1f')](util['format']('['+_0x33f011['toUpperCase']()+_0x1bd5('0x5f'),_0x25308f[_0x1bd5('0x3d')],_0x1a9ad2[_0x1bd5('0x4a')]));logger['info'](util[_0x1bd5('0x51')]('['+_0x33f011[_0x1bd5('0x10')]()+']\x20Call\x20direction:\x20%s',_0x33f011));if(_0x33f011!=='unmanaged'){logger[_0x1bd5('0x1f')]('['+_0x33f011[_0x1bd5('0x10')]()+']',_0x1bd5('0x60'));emit(_0x363ba8[_0x1bd5('0x9')],_0x1abfb6[_0x1bd5('0x61')],_0x25308f['ticketType'],_0x1a9ad2[_0x1bd5('0x4a')]);}})['catch'](function(_0xb287d){logger[_0x1bd5('0xf')]('['+_0x33f011[_0x1bd5('0x10')]()+_0x1bd5('0x62'),util['inspect'](_0xb287d,{'showHidden':!![],'depth':null}));});}; \ 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 4704f68..c1e84b7 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 _0xe51a=['%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','toString','push','content','variable','variableName','idField','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Ticket\x20created!','[OUTBOUND]','trigger:browser:url','unmanaged','Recording\x20is\x20enabled!','catch','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone'];(function(_0x10c832,_0x575a8b){var _0x141b66=function(_0x3375d7){while(--_0x3375d7){_0x10c832['push'](_0x10c832['shift']());}};_0x141b66(++_0x575a8b);}(_0xe51a,0x1b4));var _0xae51=function(_0x5dc7d0,_0x5bd2d6){_0x5dc7d0=_0x5dc7d0-0x0;var _0x3a24c7=_0xe51a[_0x5dc7d0];return _0x3a24c7;};'use strict';var _=require(_0xae51('0x0'));var rp=require(_0xae51('0x1'));var md5=require(_0xae51('0x2'));var util=require(_0xae51('0x3'));var Redis=require(_0xae51('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xae51('0x5'));config[_0xae51('0x6')]=_[_0xae51('0x7')](config[_0xae51('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xae51('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0xae51('0x9'),'Accept':_0xae51('0x9')};function emit(_0x3e0471,_0x597083,_0x635d24){io['to'](_0x3e0471)[_0xae51('0xa')](_0x597083,_0x635d24);}function getTicket(_0x1f68cd,_0x3a609e,_0x59013e,_0x215232,_0x4905ef){logger[_0xae51('0xb')](_0xae51('0xc'));var _0x1c07fc=_[_0xae51('0xd')]({'responder_id':_0x3a609e['id'],'requester_id':_0x59013e['id'],'name':util[_0xae51('0xe')]('Caller\x20-\x20%s',_0x4905ef[_0xae51('0xf')]),'phone':_0x4905ef[_0xae51('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x215232[_0xae51('0x11')],_0x4905ef,'\x20'),'description':intUtil[_0xae51('0x12')](_0x215232[_0xae51('0x13')],_0x4905ef,_0xae51('0x14')),'tags':getTags(_0x215232[_0xae51('0x15')],_0xae51('0x16'))},getCustomFields(_0x215232[_0xae51('0x17')],_0x4905ef));_0x1c07fc[_0xae51('0x18')]=_[_0xae51('0x19')](_[_0xae51('0x1a')](_0x1c07fc[_0xae51('0x18')],'id'),_0xae51('0x1b'));return request({'uri':util['format'](_0xae51('0x1c'),_0x1f68cd[_0xae51('0x1d')]),'method':_0xae51('0x1e'),'body':_0x1c07fc})[_0xae51('0x1f')](function(_0x373415){logger[_0xae51('0xb')]('Ticket\x20created!');return _0x373415;});}function getUser(_0x398b7a,_0x5a225d){if(intUtil[_0xae51('0x20')](_0x5a225d)){return request({'uri':util[_0xae51('0xe')]('%s/api/v2/agents',_0x398b7a[_0xae51('0x1d')]),'qs':{'email':_0x5a225d}})[_0xae51('0x1f')](function(_0x4fc41b){if(_0x4fc41b['length']){logger[_0xae51('0xb')]('Agent\x20found!');return _[_0xae51('0x21')](_0x4fc41b,function(_0xe50207){return _0xe50207[_0xae51('0x22')][_0xae51('0x23')]===_0x5a225d;});}else{logger[_0xae51('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xae51('0xe')](_0xae51('0x24'),_0x398b7a[_0xae51('0x1d')])})[_0xae51('0x1f')](function(_0x51ed61){logger[_0xae51('0xb')]('Admin\x20account\x20selected.');return _0x51ed61;});}});}else{logger[_0xae51('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xae51('0xe')](_0xae51('0x24'),_0x398b7a[_0xae51('0x1d')])})[_0xae51('0x1f')](function(_0x48cbda){logger['info'](_0xae51('0x25'));return _0x48cbda;});}}function getEndUser(_0x1841e8,_0x520bf3,_0x4905c0){logger['info'](_0xae51('0x26'),_0x4905c0);return request({'uri':util[_0xae51('0xe')](_0xae51('0x27'),_0x1841e8[_0xae51('0x1d')]),'qs':{'phone':_0x4905c0}})[_0xae51('0x1f')](function(_0x54b613){if(_0x54b613['length']){logger[_0xae51('0xb')]('Enduser\x20found!');return _[_0xae51('0x21')](_0x54b613,{'phone':_0x4905c0});}else{logger['info'](_0xae51('0x28'));return request({'uri':util[_0xae51('0xe')](_0xae51('0x27'),_0x1841e8['remoteUri']),'method':_0xae51('0x1e'),'body':{'name':_0x520bf3,'phone':_0x4905c0}})[_0xae51('0x1f')](function(_0x1a1973){logger['info'](_0xae51('0x29'));return _0x1a1973;});}});}function getAuth(_0x431074){return util[_0xae51('0xe')](_0xae51('0x2a'),new Buffer(_0x431074[_0xae51('0x2b')]+':X')['toString'](_0xae51('0x2c')));}function request(_0x500a45){logger[_0xae51('0x2d')](_0xae51('0x2e'),JSON[_0xae51('0x2f')](_0x500a45));return rp(_[_0xae51('0x7')](_0x500a45,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3224ed,_0x18a583){var _0x55caba=[];if(_0x3224ed&&_0x3224ed[_0xae51('0x30')]>0x0){_0x55caba=_[_0xae51('0x31')](_0x3224ed,_0x18a583);}return _0x55caba;}function getCustomFields(_0x56f47a,_0x277d72){var _0x4cf279=[];var _0x39bb31={'custom_fields':[]};if(_0x56f47a['length']>0x0){_[_0xae51('0x32')](_0x56f47a,function(_0x58e3e9){if(_[_0xae51('0x33')]([_0xae51('0x34'),_0xae51('0x35')],_0x58e3e9[_0xae51('0x36')])&&_0x58e3e9[_0xae51('0x37')]&&!_0x58e3e9[_0xae51('0x38')]){_0x39bb31[_0x58e3e9[_0xae51('0x37')][_0xae51('0x39')]()]=_0x58e3e9['content'][_0xae51('0x3a')]();}else if(_['includes']([_0xae51('0x34'),_0xae51('0x35')],_0x58e3e9[_0xae51('0x36')])&&_0x58e3e9['idField']&&_0x58e3e9['customField']){_0x39bb31[_0xae51('0x18')][_0xae51('0x3b')]({'id':_0x58e3e9['idField'],'value':_0x58e3e9[_0xae51('0x3c')]['toString']()});}else if(_0x58e3e9[_0xae51('0x36')]===_0xae51('0x3d')&&_0x58e3e9[_0xae51('0x3e')]&&_0x58e3e9[_0xae51('0x3f')]&&_0x58e3e9[_0xae51('0x38')]){_0x277d72[_0x58e3e9[_0xae51('0x3e')]]&&_0x39bb31[_0xae51('0x18')][_0xae51('0x3b')]({'id':_0x58e3e9['idField'],'value':_0x277d72[_0x58e3e9['variableName']][_0xae51('0x3a')]()});}else if(_0x58e3e9['type']===_0xae51('0x40')&&_0x58e3e9['Variable']&&_0x58e3e9[_0xae51('0x41')][_0xae51('0x16')]&&_0x58e3e9[_0xae51('0x3f')]&&_0x58e3e9['customField']){_0x277d72[_0x58e3e9['Variable'][_0xae51('0x16')][_0xae51('0x39')]()]&&_0x39bb31[_0xae51('0x18')]['push']({'id':_0x58e3e9['idField'],'value':_0x277d72[_0x58e3e9[_0xae51('0x41')][_0xae51('0x16')][_0xae51('0x39')]()][_0xae51('0x3a')]()});}});}return _0x39bb31;}exports[_0xae51('0x42')]=function(_0x2aa0ff,_0x21b6f9,_0x262067,_0x27d72a,_0x3c917f,_0x30928b){var _0x21136e,_0x1702bb;_0x30928b[_0xae51('0x1d')]=intUtil[_0xae51('0x43')](_0x30928b[_0xae51('0x1d')]);_0x30928b['serverUrl']=intUtil[_0xae51('0x43')](_0x30928b[_0xae51('0x44')]);if(_0x3c917f&&_0x3c917f[_0xae51('0x45')]){logger[_0xae51('0xb')](_0xae51('0x46'),'Recording\x20is\x20enabled!');_0x21b6f9['recordingURL']=util[_0xae51('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30928b[_0xae51('0x44')],_0x21b6f9[_0xae51('0x47')],md5(_0x21b6f9[_0xae51('0x47')]));}else{_0x21b6f9[_0xae51('0x48')]='';}headers[_0xae51('0x49')]=getAuth(_0x30928b);return getUser(_0x30928b,_0x27d72a[_0xae51('0x23')])[_0xae51('0x1f')](function(_0x2a47eb){_0x21136e=_0x2a47eb;logger['info'](_0xae51('0x4a'),_0x21136e['id']);return getEndUser(_0x30928b,_0x21b6f9[_0xae51('0xf')],_0x21b6f9[_0xae51('0x10')]);})[_0xae51('0x1f')](function(_0xff570c){_0x1702bb=_0xff570c;logger[_0xae51('0xb')](_0xae51('0x4b'),_0x1702bb['id']);return getTicket(_0x30928b,_0x21136e,_0x1702bb,_0x262067,_0x21b6f9);})['then'](function(_0x1a2d4b){if(_0x1a2d4b&&_0x1a2d4b['id']){logger[_0xae51('0xb')]('Ticket\x20created!');logger[_0xae51('0xb')](_0xae51('0x4c'),_0x1a2d4b['id']);logger[_0xae51('0xb')](_0xae51('0x46'),_0xae51('0x4d'));emit(util[_0xae51('0xe')](_0xae51('0x4e'),_0x27d72a[_0xae51('0x16')]),'trigger:browser:url',{'uri':util[_0xae51('0xe')](_0xae51('0x4f'),_0x30928b[_0xae51('0x1d')],_0x1a2d4b['id'])});}})['catch'](function(_0x102f32){logger[_0xae51('0x50')]('[QUEUE]',JSON[_0xae51('0x2f')](_0x102f32));});};exports[_0xae51('0x51')]=function(_0x2eb59a,_0x3e603f,_0xd4ef04,_0x2bdb28,_0x48f4a5,_0x149de6,_0x55db0b){var _0x5b7ded,_0x27ad1e;_0x149de6[_0xae51('0x1d')]=intUtil[_0xae51('0x43')](_0x149de6[_0xae51('0x1d')]);_0x149de6[_0xae51('0x44')]=intUtil[_0xae51('0x43')](_0x149de6[_0xae51('0x44')]);if(_0x55db0b&&_0x55db0b[_0xae51('0x52')]&&_0x55db0b[_0xae51('0x52')]!==_0xae51('0x53')){logger[_0xae51('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3e603f['recordingURL']=util['format'](_0xae51('0x54'),_0x149de6[_0xae51('0x44')],_0x3e603f[_0xae51('0x47')],md5(_0x3e603f[_0xae51('0x47')]));}headers[_0xae51('0x49')]=getAuth(_0x149de6);return getUser(_0x149de6,_0x2bdb28['email'])[_0xae51('0x1f')](function(_0x37a3d3){_0x5b7ded=_0x37a3d3;logger[_0xae51('0xb')]('The\x20User\x20ID\x20is:',_0x5b7ded['id']);return getEndUser(_0x149de6,_0x3e603f[_0xae51('0x55')],_0x3e603f[_0xae51('0x56')]);})[_0xae51('0x1f')](function(_0x5c1fe3){_0x27ad1e=_0x5c1fe3;logger[_0xae51('0xb')](_0xae51('0x4b'),_0x27ad1e['id']);return getTicket(_0x149de6,_0x5b7ded,_0x27ad1e,_0xd4ef04,_0x3e603f);})[_0xae51('0x1f')](function(_0x2eb0af){if(_0x2eb0af&&_0x2eb0af['id']){logger[_0xae51('0xb')](_0xae51('0x57'));logger[_0xae51('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2eb0af['id']);logger[_0xae51('0xb')](_0xae51('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xae51('0xe')](_0xae51('0x4e'),_0x2bdb28['name']),_0xae51('0x59'),{'uri':util[_0xae51('0xe')](_0xae51('0x4f'),_0x149de6[_0xae51('0x1d')],_0x2eb0af['id'])});}})['catch'](function(_0x5bd17f){logger['error'](_0xae51('0x58'),JSON[_0xae51('0x2f')](_0x5bd17f));});};exports[_0xae51('0x5a')]=function(_0x46add4,_0x3913cd,_0x281b28,_0x59f7f9,_0x434ece,_0x19fdc6){var _0x3ba322,_0x5ee776;_0x19fdc6[_0xae51('0x1d')]=intUtil[_0xae51('0x43')](_0x19fdc6[_0xae51('0x1d')]);_0x19fdc6[_0xae51('0x44')]=intUtil[_0xae51('0x43')](_0x19fdc6[_0xae51('0x44')]);if(_0x434ece&&_0x434ece[_0xae51('0x45')]){logger[_0xae51('0xb')]('['+_0x3913cd['lastevent']['toUpperCase']()+']',_0xae51('0x5b'));_0x3913cd[_0xae51('0x48')]=util['format'](_0xae51('0x54'),_0x19fdc6[_0xae51('0x44')],_0x3913cd[_0xae51('0x47')],md5(_0x3913cd[_0xae51('0x47')]));}else{_0x3913cd[_0xae51('0x48')]='';}headers[_0xae51('0x49')]=getAuth(_0x19fdc6);return getUser(_0x19fdc6,'')['then'](function(_0x300f94){_0x3ba322=_0x300f94;logger[_0xae51('0xb')](_0xae51('0x4a'),_0x3ba322['id']);return getEndUser(_0x19fdc6,_0x3913cd[_0xae51('0xf')],_0x3913cd[_0xae51('0x10')]);})['then'](function(_0x2722df){_0x5ee776=_0x2722df;logger[_0xae51('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5ee776['id']);return getTicket(_0x19fdc6,_0x3ba322,_0x5ee776,_0x281b28,_0x3913cd);})[_0xae51('0x1f')](function(_0x58971f){if(_0x58971f){logger[_0xae51('0xb')](_0xae51('0x57'));logger[_0xae51('0xb')](_0xae51('0x4c'),_0x58971f['id']);}})[_0xae51('0x5c')](function(_0x1495f1){logger[_0xae51('0x50')]('['+_0x3913cd[_0xae51('0x5d')][_0xae51('0x5e')]()+']',JSON[_0xae51('0x2f')](_0x1495f1));});}; \ No newline at end of file +var _0x60c7=['recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','catch','unmanaged','lastevent','toUpperCase','lodash','request-promise','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','name','Fields','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','Agent\x20found!','find','contact','email','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x2a759a,_0x51c8df){var _0x150400=function(_0x2c44c9){while(--_0x2c44c9){_0x2a759a['push'](_0x2a759a['shift']());}};_0x150400(++_0x51c8df);}(_0x60c7,0xd0));var _0x760c=function(_0xed8f74,_0x456ced){_0xed8f74=_0xed8f74-0x0;var _0x104249=_0x60c7[_0xed8f74];return _0x104249;};'use strict';var _=require(_0x760c('0x0'));var rp=require(_0x760c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x760c('0x2'));var config=require(_0x760c('0x3'));var logger=require(_0x760c('0x4'))('freshdesk');config[_0x760c('0x5')]=_[_0x760c('0x6')](config[_0x760c('0x5')],{'host':_0x760c('0x7'),'port':0x18eb});var io=require(_0x760c('0x8'))(new Redis(config[_0x760c('0x5')]));var headers={'Content-Type':'application/json','Accept':_0x760c('0x9')};function emit(_0x23adb7,_0x332d1f,_0x4c618b){io['to'](_0x23adb7)[_0x760c('0xa')](_0x332d1f,_0x4c618b);}function getTicket(_0x6729a8,_0x174900,_0xd72c2a,_0x55fe61,_0xef0540){logger[_0x760c('0xb')](_0x760c('0xc'));var _0x287a0f=_['merge']({'responder_id':_0x174900['id'],'requester_id':_0xd72c2a['id'],'name':util[_0x760c('0xd')](_0x760c('0xe'),_0xef0540[_0x760c('0xf')]),'phone':_0xef0540['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x760c('0x10')](_0x55fe61[_0x760c('0x11')],_0xef0540,'\x20'),'description':intUtil[_0x760c('0x10')](_0x55fe61[_0x760c('0x12')],_0xef0540,_0x760c('0x13')),'tags':getTags(_0x55fe61['Tags'],_0x760c('0x14'))},getCustomFields(_0x55fe61[_0x760c('0x15')],_0xef0540));_0x287a0f['custom_fields']=_['mapValues'](_[_0x760c('0x16')](_0x287a0f[_0x760c('0x17')],'id'),_0x760c('0x18'));return request({'uri':util[_0x760c('0xd')](_0x760c('0x19'),_0x6729a8[_0x760c('0x1a')]),'method':'POST','body':_0x287a0f})[_0x760c('0x1b')](function(_0x19f6dd){logger[_0x760c('0xb')](_0x760c('0x1c'));return _0x19f6dd;});}function getUser(_0x549c8d,_0x34c637){if(intUtil[_0x760c('0x1d')](_0x34c637)){return request({'uri':util['format']('%s/api/v2/agents',_0x549c8d['remoteUri']),'qs':{'email':_0x34c637}})[_0x760c('0x1b')](function(_0x61165d){if(_0x61165d['length']){logger[_0x760c('0xb')](_0x760c('0x1e'));return _[_0x760c('0x1f')](_0x61165d,function(_0x3f680e){return _0x3f680e[_0x760c('0x20')][_0x760c('0x21')]===_0x34c637;});}else{logger[_0x760c('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x760c('0xd')]('%s/api/v2/agents/me',_0x549c8d['remoteUri'])})[_0x760c('0x1b')](function(_0x33dbac){logger[_0x760c('0xb')](_0x760c('0x22'));return _0x33dbac;});}});}else{logger[_0x760c('0xb')](_0x760c('0x23'));return request({'uri':util[_0x760c('0xd')](_0x760c('0x24'),_0x549c8d[_0x760c('0x1a')])})[_0x760c('0x1b')](function(_0x1a260a){logger[_0x760c('0xb')](_0x760c('0x22'));return _0x1a260a;});}}function getEndUser(_0x240688,_0x47676f,_0x242c90){logger['info']('Searching\x20enduser\x20with\x20phone',_0x242c90);return request({'uri':util[_0x760c('0xd')]('%s/api/v2/contacts',_0x240688[_0x760c('0x1a')]),'qs':{'phone':_0x242c90}})[_0x760c('0x1b')](function(_0x411dc3){if(_0x411dc3[_0x760c('0x25')]){logger[_0x760c('0xb')](_0x760c('0x26'));return _[_0x760c('0x1f')](_0x411dc3,{'phone':_0x242c90});}else{logger[_0x760c('0xb')](_0x760c('0x27'));return request({'uri':util[_0x760c('0xd')](_0x760c('0x28'),_0x240688[_0x760c('0x1a')]),'method':_0x760c('0x29'),'body':{'name':_0x47676f,'phone':_0x242c90}})[_0x760c('0x1b')](function(_0x4b643e){logger[_0x760c('0xb')]('Enduser\x20created.');return _0x4b643e;});}});}function getAuth(_0x563bfb){return util[_0x760c('0xd')](_0x760c('0x2a'),new Buffer(_0x563bfb[_0x760c('0x2b')]+':X')[_0x760c('0x2c')](_0x760c('0x2d')));}function request(_0x420725){logger[_0x760c('0x2e')](_0x760c('0x2f'),JSON[_0x760c('0x30')](_0x420725));return rp(_[_0x760c('0x6')](_0x420725,{'method':_0x760c('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x1cdbde,_0x5618c6){var _0x4910d9=[];if(_0x1cdbde&&_0x1cdbde[_0x760c('0x25')]>0x0){_0x4910d9=_[_0x760c('0x32')](_0x1cdbde,_0x5618c6);}return _0x4910d9;}function getCustomFields(_0x594af0,_0x1ea59a){var _0x40fac4=[];var _0x115f9d={'custom_fields':[]};if(_0x594af0['length']>0x0){_[_0x760c('0x33')](_0x594af0,function(_0x40ea6e){if(_[_0x760c('0x34')]([_0x760c('0x35'),_0x760c('0x36')],_0x40ea6e[_0x760c('0x37')])&&_0x40ea6e[_0x760c('0x38')]&&!_0x40ea6e['customField']){_0x115f9d[_0x40ea6e[_0x760c('0x38')][_0x760c('0x39')]()]=_0x40ea6e[_0x760c('0x3a')]['toString']();}else if(_['includes']([_0x760c('0x35'),'picklist'],_0x40ea6e[_0x760c('0x37')])&&_0x40ea6e[_0x760c('0x3b')]&&_0x40ea6e[_0x760c('0x3c')]){_0x115f9d[_0x760c('0x17')]['push']({'id':_0x40ea6e[_0x760c('0x3b')],'value':_0x40ea6e[_0x760c('0x3a')]['toString']()});}else if(_0x40ea6e[_0x760c('0x37')]==='variable'&&_0x40ea6e[_0x760c('0x3d')]&&_0x40ea6e[_0x760c('0x3b')]&&_0x40ea6e[_0x760c('0x3c')]){_0x1ea59a[_0x40ea6e['variableName']]&&_0x115f9d[_0x760c('0x17')][_0x760c('0x3e')]({'id':_0x40ea6e[_0x760c('0x3b')],'value':_0x1ea59a[_0x40ea6e[_0x760c('0x3d')]][_0x760c('0x2c')]()});}else if(_0x40ea6e[_0x760c('0x37')]===_0x760c('0x3f')&&_0x40ea6e[_0x760c('0x40')]&&_0x40ea6e[_0x760c('0x40')][_0x760c('0x14')]&&_0x40ea6e[_0x760c('0x3b')]&&_0x40ea6e[_0x760c('0x3c')]){_0x1ea59a[_0x40ea6e['Variable'][_0x760c('0x14')][_0x760c('0x39')]()]&&_0x115f9d['custom_fields'][_0x760c('0x3e')]({'id':_0x40ea6e[_0x760c('0x3b')],'value':_0x1ea59a[_0x40ea6e[_0x760c('0x40')][_0x760c('0x14')]['toLowerCase']()][_0x760c('0x2c')]()});}});}return _0x115f9d;}exports[_0x760c('0x41')]=function(_0x40acc2,_0x3463e1,_0x5c4a99,_0xfb502,_0x12f4ab,_0x52b759){var _0x41d39b,_0x497069;_0x52b759[_0x760c('0x1a')]=intUtil[_0x760c('0x42')](_0x52b759['remoteUri']);_0x52b759['serverUrl']=intUtil[_0x760c('0x42')](_0x52b759[_0x760c('0x43')]);if(_0x12f4ab&&_0x12f4ab[_0x760c('0x44')]){logger['info'](_0x760c('0x45'),_0x760c('0x46'));_0x3463e1[_0x760c('0x47')]=util[_0x760c('0xd')](_0x760c('0x48'),_0x52b759[_0x760c('0x43')],_0x3463e1[_0x760c('0x49')],md5(_0x3463e1[_0x760c('0x49')]));}else{_0x3463e1[_0x760c('0x47')]='';}headers[_0x760c('0x4a')]=getAuth(_0x52b759);return getUser(_0x52b759,_0xfb502[_0x760c('0x21')])[_0x760c('0x1b')](function(_0x311c15){_0x41d39b=_0x311c15;logger['info'](_0x760c('0x4b'),_0x41d39b['id']);return getEndUser(_0x52b759,_0x3463e1['calleridname'],_0x3463e1[_0x760c('0x4c')]);})['then'](function(_0x105f94){_0x497069=_0x105f94;logger[_0x760c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x497069['id']);return getTicket(_0x52b759,_0x41d39b,_0x497069,_0x5c4a99,_0x3463e1);})['then'](function(_0x4a7923){if(_0x4a7923&&_0x4a7923['id']){logger[_0x760c('0xb')](_0x760c('0x1c'));logger[_0x760c('0xb')]('The\x20Ticket\x20ID\x20is:',_0x4a7923['id']);logger['info'](_0x760c('0x45'),_0x760c('0x4d'));emit(util['format'](_0x760c('0x4e'),_0xfb502[_0x760c('0x14')]),_0x760c('0x4f'),{'uri':util[_0x760c('0xd')](_0x760c('0x50'),_0x52b759[_0x760c('0x1a')],_0x4a7923['id'])});}})['catch'](function(_0x481eb3){logger[_0x760c('0x51')]('[QUEUE]',JSON[_0x760c('0x30')](_0x481eb3));});};exports[_0x760c('0x52')]=function(_0x4be4b9,_0x2b012b,_0x462612,_0x37e122,_0x1c226d,_0x2fc16f,_0x1f8299){var _0x441ab4,_0x5d715c;_0x2fc16f[_0x760c('0x1a')]=intUtil[_0x760c('0x42')](_0x2fc16f['remoteUri']);_0x2fc16f['serverUrl']=intUtil['stripTrailingSlash'](_0x2fc16f[_0x760c('0x43')]);if(_0x1f8299&&_0x1f8299[_0x760c('0x53')]&&_0x1f8299[_0x760c('0x53')]!==_0x760c('0x54')){logger[_0x760c('0xb')](_0x760c('0x55'),_0x760c('0x46'));_0x2b012b['recordingURL']=util['format'](_0x760c('0x48'),_0x2fc16f['serverUrl'],_0x2b012b['uniqueid'],md5(_0x2b012b[_0x760c('0x49')]));}headers[_0x760c('0x4a')]=getAuth(_0x2fc16f);return getUser(_0x2fc16f,_0x37e122[_0x760c('0x21')])[_0x760c('0x1b')](function(_0x291ac){_0x441ab4=_0x291ac;logger[_0x760c('0xb')]('The\x20User\x20ID\x20is:',_0x441ab4['id']);return getEndUser(_0x2fc16f,_0x2b012b[_0x760c('0x56')],_0x2b012b['destcalleridnum']);})[_0x760c('0x1b')](function(_0x1c5316){_0x5d715c=_0x1c5316;logger[_0x760c('0xb')](_0x760c('0x57'),_0x5d715c['id']);return getTicket(_0x2fc16f,_0x441ab4,_0x5d715c,_0x462612,_0x2b012b);})[_0x760c('0x1b')](function(_0x1665ee){if(_0x1665ee&&_0x1665ee['id']){logger[_0x760c('0xb')]('Ticket\x20created!');logger[_0x760c('0xb')](_0x760c('0x58'),_0x1665ee['id']);logger[_0x760c('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x760c('0xd')](_0x760c('0x4e'),_0x37e122['name']),_0x760c('0x4f'),{'uri':util[_0x760c('0xd')](_0x760c('0x50'),_0x2fc16f[_0x760c('0x1a')],_0x1665ee['id'])});}})[_0x760c('0x59')](function(_0x127af7){logger['error'](_0x760c('0x55'),JSON[_0x760c('0x30')](_0x127af7));});};exports[_0x760c('0x5a')]=function(_0x346408,_0x14291f,_0x31e6c9,_0x12ed3b,_0x43a47b,_0x1a37cb){var _0x120046,_0xf013dd;_0x1a37cb['remoteUri']=intUtil[_0x760c('0x42')](_0x1a37cb[_0x760c('0x1a')]);_0x1a37cb[_0x760c('0x43')]=intUtil[_0x760c('0x42')](_0x1a37cb[_0x760c('0x43')]);if(_0x43a47b&&_0x43a47b[_0x760c('0x44')]){logger['info']('['+_0x14291f[_0x760c('0x5b')]['toUpperCase']()+']',_0x760c('0x46'));_0x14291f[_0x760c('0x47')]=util[_0x760c('0xd')](_0x760c('0x48'),_0x1a37cb['serverUrl'],_0x14291f[_0x760c('0x49')],md5(_0x14291f['uniqueid']));}else{_0x14291f['recordingURL']='';}headers[_0x760c('0x4a')]=getAuth(_0x1a37cb);return getUser(_0x1a37cb,'')[_0x760c('0x1b')](function(_0x4e448d){_0x120046=_0x4e448d;logger[_0x760c('0xb')](_0x760c('0x4b'),_0x120046['id']);return getEndUser(_0x1a37cb,_0x14291f['calleridname'],_0x14291f[_0x760c('0x4c')]);})[_0x760c('0x1b')](function(_0x1187c2){_0xf013dd=_0x1187c2;logger[_0x760c('0xb')](_0x760c('0x57'),_0xf013dd['id']);return getTicket(_0x1a37cb,_0x120046,_0xf013dd,_0x31e6c9,_0x14291f);})['then'](function(_0x265272){if(_0x265272){logger[_0x760c('0xb')](_0x760c('0x1c'));logger[_0x760c('0xb')](_0x760c('0x58'),_0x265272['id']);}})[_0x760c('0x59')](function(_0x723dd3){logger[_0x760c('0x51')]('['+_0x14291f[_0x760c('0x5b')][_0x760c('0x5c')]()+']',JSON[_0x760c('0x30')](_0x723dd3));});}; \ 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 95fca49..356ddf7 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 _0x9305=['bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','GET','headers','info','users','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','/api/selector/owners','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','userEmail','agentEmail','userId','User\x20found:','Admin\x20selected','catch','message','/api/lookup?q=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','/contacts/','emit','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util'];(function(_0x22115b,_0x48449d){var _0x1324ee=function(_0x2d7411){while(--_0x2d7411){_0x22115b['push'](_0x22115b['shift']());}};_0x1324ee(++_0x48449d);}(_0x9305,0x1e2));var _0x5930=function(_0x3aa97b,_0x56af66){_0x3aa97b=_0x3aa97b-0x0;var _0x36857f=_0x9305[_0x3aa97b];return _0x36857f;};'use strict';var _=require(_0x5930('0x0'));var rp=require(_0x5930('0x1'));var md5=require(_0x5930('0x2'));var util=require(_0x5930('0x3'));var moment=require('moment');var Promise=require(_0x5930('0x4'));var Redis=require(_0x5930('0x5'));var intUtil=require(_0x5930('0x6'));var config=require(_0x5930('0x7'));var logger=require('../../../../config/logger')(_0x5930('0x8'));config[_0x5930('0x9')]=_[_0x5930('0xa')](config[_0x5930('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5930('0x9')]));function getAdminId(_0x80c566,_0x7acada,_0x599350,_0x41cfec){return new Promise(function(_0x56f24d,_0x200519){var _0x5c5f3f=![];var _0x2a7f66={'method':_0x5930('0xb'),'uri':_0x41cfec+'/api/selector/owners','json':!![]};_0x2a7f66[_0x5930('0xc')]=_0x599350;logger[_0x5930('0xd')]('Getting\x20admin\x20information');return rp(_0x2a7f66)['then'](function(_0x4b814b){if(_0x4b814b){var _0x5434be=_0x4b814b[_0x5930('0xe')];var _0x2bd953=null;for(_0x2bd953=0x0;_0x2bd953<_0x5434be['length'];_0x2bd953++){if(_0x5434be[_0x2bd953][_0x5930('0xf')]===_0x80c566[_0x5930('0x10')]){_0x80c566['adminId']=_0x5434be[_0x2bd953]['id'];_0x5c5f3f=!![];}}if(_0x5c5f3f){logger[_0x5930('0xd')](_0x5930('0x11'),_0x80c566[_0x5930('0x12')]);_0x56f24d(_0x80c566);}else{_0x200519({'statusCode':0x194,'message':_0x5930('0x13')});}}else{_0x200519({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x3f5ed9){logger[_0x5930('0x14')]('['+[_0x7acada[_0x5930('0x15')]()]+']',_0x3f5ed9['message']);_0x200519(_0x3f5ed9);});});}function getUser(_0x28e42f,_0x1d3f69,_0x4eafc0){return function(_0x26f0f3){return new Promise(function(_0x47ef54,_0x103f6d){var _0x33af51={'method':_0x5930('0xb'),'uri':_0x4eafc0+_0x5930('0x16'),'json':!![]};_0x33af51[_0x5930('0xc')]=_0x1d3f69;logger[_0x5930('0xd')](_0x5930('0x17'));return rp(_0x33af51)[_0x5930('0x18')](function(_0x4c0fa4){if(_0x4c0fa4){var _0x3ff799=_0x4c0fa4[_0x5930('0xe')];var _0x319350=![];var _0x5234e1=null;if(_0x26f0f3['agentEmail']!==null){logger[_0x5930('0xd')](_0x5930('0x19'),_0x26f0f3['agentEmail']);_0x26f0f3[_0x5930('0x1a')]=_0x26f0f3[_0x5930('0x1b')];for(_0x5234e1=0x0;_0x5234e1<_0x3ff799['length'];_0x5234e1++){if(_0x3ff799[_0x5234e1][_0x5930('0xf')]===_0x26f0f3[_0x5930('0x1b')]){_0x319350=!![];_0x26f0f3[_0x5930('0x1c')]=_0x3ff799[_0x5234e1]['id'];logger[_0x5930('0xd')](_0x5930('0x1d'),_0x26f0f3[_0x5930('0x1c')]);}}}if(!_0x319350){logger[_0x5930('0xd')](_0x5930('0x1e'));_0x26f0f3['userEmail']=_0x26f0f3['adminEmail'];_0x26f0f3['userId']=_0x26f0f3[_0x5930('0x12')];_0x319350=!![];}if(_0x319350){_0x47ef54(_0x26f0f3);}else{_0x103f6d({'statusCode':0x194,'message':_0x5930('0x13')});}}else{_0x103f6d({'statusCode':0x194,'message':_0x5930('0x13')});}})[_0x5930('0x1f')](function(_0x4f7488){logger[_0x5930('0x14')]('['+[_0x28e42f['toUpperCase']()]+']',_0x4f7488[_0x5930('0x20')]);_0x103f6d(_0x4f7488);});});};}function searchContact(_0x596c23,_0x2a7c66,_0x1dce8f,_0x10fd1f){return new Promise(function(_0x250316,_0xc66ce5){var _0x220772={'method':_0x5930('0xb'),'headers':_0x2a7c66,'uri':_0x596c23+_0x5930('0x21')+_0x10fd1f+'&f='+_0x1dce8f+_0x5930('0x22'),'json':!![]};rp(_0x220772)[_0x5930('0x18')](function(_0x273519){var _0x55ae28=_['find'](_0x273519['contacts'][_0x5930('0x23')],[_0x1dce8f,_0x10fd1f]);_0x250316(_0x55ae28);})['catch'](function(_0x1874b9){_0xc66ce5(_0x1874b9);});});}function getEndUser(_0x4ae53f,_0x106da8,_0x3a4030){return function(_0x560139){return new Promise(function(_0x15aaa0,_0x36b472){logger['info'](util[_0x5930('0x24')](_0x5930('0x25'),_0x560139[_0x5930('0x26')]));searchContact(_0x3a4030,_0x106da8,_0x5930('0x27'),_0x560139[_0x5930('0x26')])['then'](function(_0x7927a6){if(_0x7927a6){_0x560139['endUserId']=_0x7927a6['id'];logger[_0x5930('0xd')](_0x5930('0x28'),_0x560139[_0x5930('0x29')]);return _0x15aaa0(_0x560139);}searchContact(_0x3a4030,_0x106da8,'work_number',_0x560139[_0x5930('0x26')])['then'](function(_0x465d34){if(_0x465d34){_0x560139[_0x5930('0x29')]=_0x465d34['id'];logger[_0x5930('0xd')](_0x5930('0x2a'),_0x560139['endUserId']);return _0x15aaa0(_0x560139);}createEndUser(_0x560139,_0x4ae53f,_0x106da8,_0x3a4030)['then'](function(_0x5363d8){logger[_0x5930('0xd')](_0x5930('0x2b'),_0x5363d8['endUserId']);return _0x15aaa0(_0x5363d8);});});})[_0x5930('0x1f')](function(_0x277015){_0x36b472(_0x277015);});});};}function createEndUser(_0x2b4a8a,_0x42d819,_0xc77841,_0x322eb7){return new Promise(function(_0x5e4dae,_0x5f2f18){var _0x2de9e7=moment();var _0x5317d3={'method':_0x5930('0x2c'),'uri':_0x322eb7+_0x5930('0x2d'),'body':{'contact':{'last_name':_0x2b4a8a['contactNumber'],'work_number':_0x2b4a8a[_0x5930('0x26')],'mobile_number':_0x2b4a8a[_0x5930('0x26')],'owner_id':_0x2b4a8a[_0x5930('0x1c')],'created_at':_0x2de9e7['format'](_0x5930('0x2e'))}},'json':!![]};_0x5317d3[_0x5930('0xc')]=_0xc77841;logger[_0x5930('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x5317d3)[_0x5930('0x18')](function(_0x2a6a11){_0x2b4a8a[_0x5930('0x29')]=_0x2a6a11['contact']['id'];_0x5e4dae(_0x2b4a8a);})['catch'](function(_0x1200bb){logger[_0x5930('0x14')]('['+[_0x42d819['toUpperCase']()]+']',_0x1200bb[_0x5930('0x20')]);_0x5f2f18(_0x1200bb[_0x5930('0x20')]);});});}function getTicket(_0x2c5979,_0x338148,_0x5dea2c,_0x3941d1,_0x396e94){return function(_0x4e2d26){logger[_0x5930('0xd')](_0x5930('0x2f'));return new Promise(function(_0x3d5e3f,_0x585ee9){var _0x522c89=moment();var _0x4134d9={'method':'POST','uri':_0x5dea2c+_0x5930('0x30'),'body':{'title':intUtil[_0x5930('0x31')](_0x3941d1[_0x5930('0x32')],_0x396e94,'\x20'),'description':intUtil['getString'](_0x3941d1[_0x5930('0x33')],_0x396e94,'\x0a'),'owner_id':_0x4e2d26[_0x5930('0x1c')],'creater_id':_0x4e2d26[_0x5930('0x12')],'targetable_id':_0x4e2d26[_0x5930('0x29')],'targetable_type':_0x5930('0x34'),'created_at':_0x522c89[_0x5930('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x522c89[_0x5930('0x35')](0x1e,'m')['format'](_0x5930('0x2e'))},'json':!![]};_0x4134d9[_0x5930('0xc')]=_0x338148;return rp(_0x4134d9)[_0x5930('0x18')](function(_0x4aaf3){_0x4e2d26[_0x5930('0x36')]=_0x4aaf3['task']['id'];logger[_0x5930('0xd')]('Task\x20created:',_0x4e2d26[_0x5930('0x36')]);_0x3d5e3f(_0x4e2d26);})[_0x5930('0x1f')](function(_0x23256c){logger['error']('['+[_0x2c5979[_0x5930('0x15')]()]+']',_0x23256c[_0x5930('0x20')]);_0x585ee9(_0x23256c[_0x5930('0x20')]);});});};}function emit(_0x55e51d,_0x5bd59e,_0x2c2e67){var _0x14ab06={'uri':_0x55e51d+_0x5930('0x37')+_0x2c2e67};io['to'](util['format']('user:%s',_0x5bd59e))[_0x5930('0x38')]('trigger:browser:url',_0x14ab06);}exports['cs']=function(_0x42366a,_0x44bdcb,_0x46108e,_0xb82d16,_0x1f71fc,_0x273628,_0x8b1441,_0x4dc5e5){var _0x15027d={};var _0x10f0f7={'Authorization':_0x5930('0x39')+_0x273628['apiKey']};_0x273628[_0x5930('0x3a')]=intUtil[_0x5930('0x3b')](_0x273628['remoteUri']);_0x273628[_0x5930('0x3c')]=intUtil['stripTrailingSlash'](_0x273628[_0x5930('0x3c')]);var _0x2a412f=_0x273628[_0x5930('0x3a')];_0x15027d[_0x5930('0x10')]=_0x273628[_0x5930('0x3d')];_0x15027d[_0x5930('0x26')]=_0x4dc5e5[_0x5930('0x3e')]()==='outbound'?_0x44bdcb[_0x5930('0x3f')]:_0x44bdcb[_0x5930('0x40')];_0x15027d[_0x5930('0x41')]=_0x4dc5e5===_0x5930('0x42')||_0x4dc5e5===_0x5930('0x43')?'queue':_0x5930('0x44');if(_0xb82d16){_0x15027d[_0x5930('0x1b')]=_0xb82d16[_0x5930('0xf')];}var _0xec9b14=util[_0x5930('0x24')](_0x5930('0x45'),_0x273628['serverUrl'],_0x44bdcb['uniqueid'],md5(_0x44bdcb[_0x5930('0x46')]));if(_0x1f71fc&&_0x1f71fc[_0x5930('0x47')]){logger['info'](_0x5930('0x48'),'Recording\x20is\x20enabled!');_0x44bdcb[_0x5930('0x49')]=_0xec9b14;}else if(_0x8b1441&&_0x8b1441[_0x5930('0x4a')]&&_0x8b1441['recordingFormat']!==_0x5930('0x4b')){logger['info'](_0x5930('0x4c'),'Recording\x20is\x20enabled!');_0x44bdcb[_0x5930('0x49')]=_0xec9b14;}else{_0x44bdcb[_0x5930('0x49')]='';}return getAdminId(_0x15027d,_0x4dc5e5,_0x10f0f7,_0x2a412f)[_0x5930('0x18')](getUser(_0x4dc5e5,_0x10f0f7,_0x2a412f))[_0x5930('0x18')](getEndUser(_0x4dc5e5,_0x10f0f7,_0x2a412f))[_0x5930('0x18')](getTicket(_0x4dc5e5,_0x10f0f7,_0x2a412f,_0x46108e,_0x44bdcb))['then'](function(_0x54b9f8){logger[_0x5930('0xd')](util[_0x5930('0x24')]('The\x20ticket\x20ID\x20is:\x20%s',_0x54b9f8[_0x5930('0x36')]));if(_0x4dc5e5!=='unmanaged'){logger[_0x5930('0xd')]('['+[_0x4dc5e5[_0x5930('0x15')]()]+']',_0x5930('0x4d'));emit(_0x2a412f,_0xb82d16[_0x5930('0x4e')],_0x54b9f8[_0x5930('0x29')]);}})[_0x5930('0x1f')](function(_0x578f45){logger[_0x5930('0x14')]('['+[_0x4dc5e5['toUpperCase']()]+_0x5930('0x4f'),util[_0x5930('0x50')](_0x578f45,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe7de=['callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','inspect','lodash','request-promise','md5','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','info','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','/api/selector/owners','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','message','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','format','add','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum'];(function(_0x415cfc,_0x4469d8){var _0x242411=function(_0x450b3f){while(--_0x450b3f){_0x415cfc['push'](_0x415cfc['shift']());}};_0x242411(++_0x4469d8);}(_0xe7de,0x165));var _0xee7d=function(_0x48239c,_0x4951d1){_0x48239c=_0x48239c-0x0;var _0x4cddb1=_0xe7de[_0x48239c];return _0x4cddb1;};'use strict';var _=require(_0xee7d('0x0'));var rp=require(_0xee7d('0x1'));var md5=require(_0xee7d('0x2'));var util=require('util');var moment=require('moment');var Promise=require(_0xee7d('0x3'));var Redis=require(_0xee7d('0x4'));var intUtil=require(_0xee7d('0x5'));var config=require(_0xee7d('0x6'));var logger=require(_0xee7d('0x7'))(_0xee7d('0x8'));config[_0xee7d('0x9')]=_[_0xee7d('0xa')](config[_0xee7d('0x9')],{'host':_0xee7d('0xb'),'port':0x18eb});var io=require(_0xee7d('0xc'))(new Redis(config[_0xee7d('0x9')]));function getAdminId(_0x1c0584,_0x941d94,_0x5b4739,_0x34265a){return new Promise(function(_0x32c4fa,_0x44e6ef){var _0x474c53=![];var _0x146172={'method':_0xee7d('0xd'),'uri':_0x34265a+'/api/selector/owners','json':!![]};_0x146172[_0xee7d('0xe')]=_0x5b4739;logger['info'](_0xee7d('0xf'));return rp(_0x146172)[_0xee7d('0x10')](function(_0x23bbf3){if(_0x23bbf3){var _0x17fb11=_0x23bbf3[_0xee7d('0x11')];var _0xb4c933=null;for(_0xb4c933=0x0;_0xb4c933<_0x17fb11[_0xee7d('0x12')];_0xb4c933++){if(_0x17fb11[_0xb4c933][_0xee7d('0x13')]===_0x1c0584[_0xee7d('0x14')]){_0x1c0584[_0xee7d('0x15')]=_0x17fb11[_0xb4c933]['id'];_0x474c53=!![];}}if(_0x474c53){logger[_0xee7d('0x16')]('Admin\x20found:',_0x1c0584['adminId']);_0x32c4fa(_0x1c0584);}else{_0x44e6ef({'statusCode':0x194,'message':_0xee7d('0x17')});}}else{_0x44e6ef({'statusCode':0x194,'message':_0xee7d('0x17')});}})[_0xee7d('0x18')](function(_0x1211a1){logger[_0xee7d('0x19')]('['+[_0x941d94[_0xee7d('0x1a')]()]+']',_0x1211a1['message']);_0x44e6ef(_0x1211a1);});});}function getUser(_0x3f76e6,_0x2bcd81,_0x59a308){return function(_0x62d1ec){return new Promise(function(_0x467eda,_0x25f3e0){var _0x5d42aa={'method':_0xee7d('0xd'),'uri':_0x59a308+_0xee7d('0x1b'),'json':!![]};_0x5d42aa[_0xee7d('0xe')]=_0x2bcd81;logger['info'](_0xee7d('0x1c'));return rp(_0x5d42aa)['then'](function(_0x1ef8ea){if(_0x1ef8ea){var _0x34209e=_0x1ef8ea[_0xee7d('0x11')];var _0x4f6445=![];var _0x113a05=null;if(_0x62d1ec['agentEmail']!==null){logger[_0xee7d('0x16')](_0xee7d('0x1d'),_0x62d1ec[_0xee7d('0x1e')]);_0x62d1ec[_0xee7d('0x1f')]=_0x62d1ec['agentEmail'];for(_0x113a05=0x0;_0x113a05<_0x34209e[_0xee7d('0x12')];_0x113a05++){if(_0x34209e[_0x113a05][_0xee7d('0x13')]===_0x62d1ec[_0xee7d('0x1e')]){_0x4f6445=!![];_0x62d1ec[_0xee7d('0x20')]=_0x34209e[_0x113a05]['id'];logger[_0xee7d('0x16')](_0xee7d('0x21'),_0x62d1ec[_0xee7d('0x20')]);}}}if(!_0x4f6445){logger[_0xee7d('0x16')](_0xee7d('0x22'));_0x62d1ec['userEmail']=_0x62d1ec[_0xee7d('0x14')];_0x62d1ec[_0xee7d('0x20')]=_0x62d1ec[_0xee7d('0x15')];_0x4f6445=!![];}if(_0x4f6445){_0x467eda(_0x62d1ec);}else{_0x25f3e0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x25f3e0({'statusCode':0x194,'message':_0xee7d('0x17')});}})[_0xee7d('0x18')](function(_0x4532cb){logger[_0xee7d('0x19')]('['+[_0x3f76e6[_0xee7d('0x1a')]()]+']',_0x4532cb[_0xee7d('0x23')]);_0x25f3e0(_0x4532cb);});});};}function searchContact(_0xb727c9,_0x17a950,_0x3dda5b,_0x589fc0){return new Promise(function(_0x440bc4,_0x4e1bf5){var _0x5ca947={'method':_0xee7d('0xd'),'headers':_0x17a950,'uri':_0xb727c9+'/api/lookup?q='+_0x589fc0+_0xee7d('0x24')+_0x3dda5b+_0xee7d('0x25'),'json':!![]};rp(_0x5ca947)['then'](function(_0x6b6174){var _0x1d1990=_[_0xee7d('0x26')](_0x6b6174[_0xee7d('0x27')][_0xee7d('0x27')],[_0x3dda5b,_0x589fc0]);_0x440bc4(_0x1d1990);})['catch'](function(_0x382630){_0x4e1bf5(_0x382630);});});}function getEndUser(_0x303e1c,_0x2b37f4,_0x30540c){return function(_0x3701b8){return new Promise(function(_0x6405b4,_0x14d60c){logger[_0xee7d('0x16')](util['format'](_0xee7d('0x28'),_0x3701b8[_0xee7d('0x29')]));searchContact(_0x30540c,_0x2b37f4,_0xee7d('0x2a'),_0x3701b8['contactNumber'])[_0xee7d('0x10')](function(_0x571cf4){if(_0x571cf4){_0x3701b8[_0xee7d('0x2b')]=_0x571cf4['id'];logger[_0xee7d('0x16')]('Contact\x20found\x20mobile_number:',_0x3701b8['endUserId']);return _0x6405b4(_0x3701b8);}searchContact(_0x30540c,_0x2b37f4,_0xee7d('0x2c'),_0x3701b8['contactNumber'])[_0xee7d('0x10')](function(_0x2564a8){if(_0x2564a8){_0x3701b8[_0xee7d('0x2b')]=_0x2564a8['id'];logger[_0xee7d('0x16')](_0xee7d('0x2d'),_0x3701b8['endUserId']);return _0x6405b4(_0x3701b8);}createEndUser(_0x3701b8,_0x303e1c,_0x2b37f4,_0x30540c)['then'](function(_0x389c08){logger['info'](_0xee7d('0x2e'),_0x389c08[_0xee7d('0x2b')]);return _0x6405b4(_0x389c08);});});})[_0xee7d('0x18')](function(_0x1decf2){_0x14d60c(_0x1decf2);});});};}function createEndUser(_0xf7ed45,_0x36a554,_0xa190f1,_0x3d0f1f){return new Promise(function(_0x3431b1,_0x3e3d58){var _0x3d016=moment();var _0x4095f7={'method':'POST','uri':_0x3d0f1f+_0xee7d('0x2f'),'body':{'contact':{'last_name':_0xf7ed45['contactNumber'],'work_number':_0xf7ed45[_0xee7d('0x29')],'mobile_number':_0xf7ed45[_0xee7d('0x29')],'owner_id':_0xf7ed45[_0xee7d('0x20')],'created_at':_0x3d016['format'](_0xee7d('0x30'))}},'json':!![]};_0x4095f7[_0xee7d('0xe')]=_0xa190f1;logger[_0xee7d('0x16')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4095f7)[_0xee7d('0x10')](function(_0x5c4f5d){_0xf7ed45[_0xee7d('0x2b')]=_0x5c4f5d['contact']['id'];_0x3431b1(_0xf7ed45);})['catch'](function(_0x428f9c){logger[_0xee7d('0x19')]('['+[_0x36a554[_0xee7d('0x1a')]()]+']',_0x428f9c[_0xee7d('0x23')]);_0x3e3d58(_0x428f9c['message']);});});}function getTicket(_0x2fe5d4,_0x49d0b8,_0x5ed8c5,_0xc3d85f,_0x4d7f8e){return function(_0x1fa17c){logger['info'](_0xee7d('0x31'));return new Promise(function(_0x27e613,_0x1f87ca){var _0xe0a2e=moment();var _0x55775d={'method':_0xee7d('0x32'),'uri':_0x5ed8c5+_0xee7d('0x33'),'body':{'title':intUtil[_0xee7d('0x34')](_0xc3d85f[_0xee7d('0x35')],_0x4d7f8e,'\x20'),'description':intUtil[_0xee7d('0x34')](_0xc3d85f[_0xee7d('0x36')],_0x4d7f8e,'\x0a'),'owner_id':_0x1fa17c['userId'],'creater_id':_0x1fa17c[_0xee7d('0x15')],'targetable_id':_0x1fa17c[_0xee7d('0x2b')],'targetable_type':_0xee7d('0x37'),'created_at':_0xe0a2e[_0xee7d('0x38')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0xe0a2e[_0xee7d('0x39')](0x1e,'m')['format'](_0xee7d('0x30'))},'json':!![]};_0x55775d['headers']=_0x49d0b8;return rp(_0x55775d)[_0xee7d('0x10')](function(_0x8da1bb){_0x1fa17c[_0xee7d('0x3a')]=_0x8da1bb['task']['id'];logger[_0xee7d('0x16')]('Task\x20created:',_0x1fa17c[_0xee7d('0x3a')]);_0x27e613(_0x1fa17c);})['catch'](function(_0x1ce951){logger[_0xee7d('0x19')]('['+[_0x2fe5d4[_0xee7d('0x1a')]()]+']',_0x1ce951['message']);_0x1f87ca(_0x1ce951[_0xee7d('0x23')]);});});};}function emit(_0x3a2d5e,_0x522048,_0x5895a6){var _0x2525a1={'uri':_0x3a2d5e+_0xee7d('0x3b')+_0x5895a6};io['to'](util['format'](_0xee7d('0x3c'),_0x522048))[_0xee7d('0x3d')](_0xee7d('0x3e'),_0x2525a1);}exports['cs']=function(_0x48470e,_0x58cbfe,_0x2746f3,_0x5a152c,_0x354eaa,_0x15cee7,_0x1920bb,_0xd13c3a){var _0x486cfc={};var _0x2306e9={'Authorization':_0xee7d('0x3f')+_0x15cee7[_0xee7d('0x40')]};_0x15cee7[_0xee7d('0x41')]=intUtil[_0xee7d('0x42')](_0x15cee7[_0xee7d('0x41')]);_0x15cee7[_0xee7d('0x43')]=intUtil[_0xee7d('0x42')](_0x15cee7[_0xee7d('0x43')]);var _0x290b65=_0x15cee7['remoteUri'];_0x486cfc['adminEmail']=_0x15cee7[_0xee7d('0x44')];_0x486cfc[_0xee7d('0x29')]=_0xd13c3a[_0xee7d('0x45')]()===_0xee7d('0x46')?_0x58cbfe[_0xee7d('0x47')]:_0x58cbfe[_0xee7d('0x48')];_0x486cfc[_0xee7d('0x49')]=_0xd13c3a==='queue'||_0xd13c3a===_0xee7d('0x4a')?'queue':_0xee7d('0x46');if(_0x5a152c){_0x486cfc[_0xee7d('0x1e')]=_0x5a152c['email'];}var _0x52c9f0=util['format'](_0xee7d('0x4b'),_0x15cee7[_0xee7d('0x43')],_0x58cbfe[_0xee7d('0x4c')],md5(_0x58cbfe[_0xee7d('0x4c')]));if(_0x354eaa&&_0x354eaa[_0xee7d('0x4d')]){logger['info'](_0xee7d('0x4e'),_0xee7d('0x4f'));_0x58cbfe[_0xee7d('0x50')]=_0x52c9f0;}else if(_0x1920bb&&_0x1920bb[_0xee7d('0x51')]&&_0x1920bb[_0xee7d('0x51')]!==_0xee7d('0x52')){logger[_0xee7d('0x16')](_0xee7d('0x53'),'Recording\x20is\x20enabled!');_0x58cbfe[_0xee7d('0x50')]=_0x52c9f0;}else{_0x58cbfe[_0xee7d('0x50')]='';}return getAdminId(_0x486cfc,_0xd13c3a,_0x2306e9,_0x290b65)[_0xee7d('0x10')](getUser(_0xd13c3a,_0x2306e9,_0x290b65))[_0xee7d('0x10')](getEndUser(_0xd13c3a,_0x2306e9,_0x290b65))[_0xee7d('0x10')](getTicket(_0xd13c3a,_0x2306e9,_0x290b65,_0x2746f3,_0x58cbfe))['then'](function(_0x1967e0){logger['info'](util['format'](_0xee7d('0x54'),_0x1967e0['ticketId']));if(_0xd13c3a!==_0xee7d('0x4a')){logger[_0xee7d('0x16')]('['+[_0xd13c3a['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x290b65,_0x5a152c['name'],_0x1967e0[_0xee7d('0x2b')]);}})[_0xee7d('0x18')](function(_0x352e29){logger[_0xee7d('0x19')]('['+[_0xd13c3a[_0xee7d('0x1a')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xee7d('0x55')](_0x352e29,{'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 7a2d86c..e722167 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 _0x8603=['zendesk','salesforce','sugarcrm','freshdesk','zoho','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./zoho','./desk','./vtiger','./dynamics365'];(function(_0x16d372,_0x193363){var _0x5c0f0e=function(_0x226da1){while(--_0x226da1){_0x16d372['push'](_0x16d372['shift']());}};_0x5c0f0e(++_0x193363);}(_0x8603,0x190));var _0x3860=function(_0x4e1d69,_0x543378){_0x4e1d69=_0x4e1d69-0x0;var _0x719b41=_0x8603[_0x4e1d69];return _0x719b41;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var zendesk=require(_0x3860('0x1'));var salesforce=require(_0x3860('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x3860('0x3'));var desk=require(_0x3860('0x4'));var vtiger=require(_0x3860('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0x3860('0x6'));var freshsales=require('./freshsales');var integrations=[_0x3860('0x7'),_0x3860('0x8'),_0x3860('0x9'),_0x3860('0xa'),_0x3860('0xb'),'desk','vtiger','dynamics365',_0x3860('0xc'),_0x3860('0xd')];exports['exec']=function(_0x2fb169,_0x38737e,_0x5909b8,_0x101263,_0x45ba50,_0x4cd35d){if(_0x5909b8){if(_[_0x3860('0xe')](integrations,_0x2fb169[_0x3860('0xf')]['toLowerCase']())){try{var _0x405510=null;var _0x8ad61d='';var _0x2428f6=_0x5909b8[_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]()];if(_0x2428f6){var _0x21ae4e=_0x2428f6[_0x2fb169[_0x3860('0x11')]];if(_0x21ae4e){var _0x12b23b=_[_0x3860('0x12')](_0x21ae4e[_0x3860('0x13')],{'id':parseInt(_0x2fb169['data3'],0xa)});if(_0x12b23b){if(_0x101263){if(_0x45ba50&&_0x38737e[_0x3860('0x14')]){_0x8ad61d=_0x3860('0x14');}else if(_0x38737e[_0x3860('0x15')]){_0x8ad61d=_0x3860('0x16');}else{console[_0x3860('0x17')](_0x3860('0x18'),_0x38737e);}}else{_0x8ad61d=_0x3860('0x19');}switch(_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]()){case _0x3860('0x7'):zendesk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x8'):salesforce[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x9'):sugarcrm[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case'freshdesk':freshdesk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case'zoho':zoho[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x1a'):desk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x1b'):vtiger[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0xc'):freshsales['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;case'servicenow':servicenow['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;case _0x3860('0x1c'):dynamics365['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;default:console[_0x3860('0x17')](_0x3860('0x1d'));}}else{_0x405510=require(_0x3860('0x1e'))(_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]());_0x405510[_0x3860('0x1f')](_0x3860('0x20'),util[_0x3860('0x21')](_0x3860('0x22'),_0x2fb169[_0x3860('0xf')][_0x3860('0x10')](),_0x2fb169[_0x3860('0x23')]));}}else{_0x405510=require(_0x3860('0x1e'))(_0x2fb169[_0x3860('0xf')]['toLowerCase']());_0x405510[_0x3860('0x1f')](_0x3860('0x20'),util[_0x3860('0x21')](_0x3860('0x24'),_0x2fb169[_0x3860('0xf')]['toLowerCase'](),_0x2fb169[_0x3860('0x11')]));}}else{}}catch(_0x568515){console['error'](_0x568515);}}}}; \ No newline at end of file +var _0x9348=['data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','freshsales','servicenow','dynamics365','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','includes','data1','toLowerCase'];(function(_0x1fd8e0,_0x4736b7){var _0x404c75=function(_0x1c64f9){while(--_0x1c64f9){_0x1fd8e0['push'](_0x1fd8e0['shift']());}};_0x404c75(++_0x4736b7);}(_0x9348,0x10d));var _0x8934=function(_0x5e5cd0,_0x540c4c){_0x5e5cd0=_0x5e5cd0-0x0;var _0x418a62=_0x9348[_0x5e5cd0];return _0x418a62;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var zendesk=require(_0x8934('0x2'));var salesforce=require(_0x8934('0x3'));var sugarcrm=require(_0x8934('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x8934('0x5'));var desk=require(_0x8934('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x8934('0x7'));var dynamics365=require(_0x8934('0x8'));var freshsales=require(_0x8934('0x9'));var integrations=[_0x8934('0xa'),_0x8934('0xb'),_0x8934('0xc'),'freshdesk',_0x8934('0xd'),_0x8934('0xe'),_0x8934('0xf'),'dynamics365','freshsales','servicenow'];exports['exec']=function(_0x2c722b,_0x554432,_0xe1adf4,_0x8a88c0,_0x1a7e91,_0x45b84b){if(_0xe1adf4){if(_[_0x8934('0x10')](integrations,_0x2c722b[_0x8934('0x11')][_0x8934('0x12')]())){try{var _0xbb421b=null;var _0x4a999c='';var _0x68427d=_0xe1adf4[_0x2c722b[_0x8934('0x11')][_0x8934('0x12')]()];if(_0x68427d){var _0x1906d0=_0x68427d[_0x2c722b[_0x8934('0x13')]];if(_0x1906d0){var _0xdf59f4=_['find'](_0x1906d0[_0x8934('0x14')],{'id':parseInt(_0x2c722b[_0x8934('0x15')],0xa)});if(_0xdf59f4){if(_0x8a88c0){if(_0x1a7e91&&_0x554432[_0x8934('0x16')]){_0x4a999c=_0x8934('0x16');}else if(_0x554432[_0x8934('0x17')]){_0x4a999c=_0x8934('0x18');}else{console[_0x8934('0x19')](_0x8934('0x1a'),_0x554432);}}else{_0x4a999c='unmanaged';}switch(_0x2c722b[_0x8934('0x11')][_0x8934('0x12')]()){case _0x8934('0xa'):zendesk[_0x4a999c](_0x2c722b,_0x554432,_0xdf59f4,_0x8a88c0,_0x1a7e91,_0x1906d0,_0x45b84b);break;case'salesforce':salesforce[_0x4a999c](_0x2c722b,_0x554432,_0xdf59f4,_0x8a88c0,_0x1a7e91,_0x1906d0,_0x45b84b);break;case'sugarcrm':sugarcrm[_0x4a999c](_0x2c722b,_0x554432,_0xdf59f4,_0x8a88c0,_0x1a7e91,_0x1906d0,_0x45b84b);break;case'freshdesk':freshdesk[_0x4a999c](_0x2c722b,_0x554432,_0xdf59f4,_0x8a88c0,_0x1a7e91,_0x1906d0,_0x45b84b);break;case _0x8934('0xd'):zoho[_0x4a999c](_0x2c722b,_0x554432,_0xdf59f4,_0x8a88c0,_0x1a7e91,_0x1906d0,_0x45b84b);break;case'desk':desk[_0x4a999c](_0x2c722b,_0x554432,_0xdf59f4,_0x8a88c0,_0x1a7e91,_0x1906d0,_0x45b84b);break;case _0x8934('0xf'):vtiger[_0x4a999c](_0x2c722b,_0x554432,_0xdf59f4,_0x8a88c0,_0x1a7e91,_0x1906d0,_0x45b84b);break;case _0x8934('0x1b'):freshsales['cs'](_0x2c722b,_0x554432,_0xdf59f4,_0x8a88c0,_0x1a7e91,_0x1906d0,_0x45b84b,_0x4a999c);break;case _0x8934('0x1c'):servicenow['cs'](_0x2c722b,_0x554432,_0xdf59f4,_0x8a88c0,_0x1a7e91,_0x1906d0,_0x45b84b,_0x4a999c);break;case _0x8934('0x1d'):dynamics365['cs'](_0x2c722b,_0x554432,_0xdf59f4,_0x8a88c0,_0x1a7e91,_0x1906d0,_0x45b84b,_0x4a999c);break;default:console[_0x8934('0x19')]('unknown\x20integration');}}else{_0xbb421b=require(_0x8934('0x1e'))(_0x2c722b['data1'][_0x8934('0x12')]());_0xbb421b[_0x8934('0x1f')](_0x8934('0x20'),util[_0x8934('0x21')](_0x8934('0x22'),_0x2c722b[_0x8934('0x11')][_0x8934('0x12')](),_0x2c722b['data3']));}}else{_0xbb421b=require(_0x8934('0x1e'))(_0x2c722b[_0x8934('0x11')][_0x8934('0x12')]());_0xbb421b[_0x8934('0x1f')](_0x8934('0x20'),util['format'](_0x8934('0x23'),_0x2c722b[_0x8934('0x11')][_0x8934('0x12')](),_0x2c722b['data2']));}}else{}}catch(_0x16cfc2){console['error'](_0x16cfc2);}}}}; \ 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 87f9595..e482be0 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 _0x6607=['merge','account_contact_lead','additionalSearchAccount','Account','Lead','first','Phone','attributes','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.','','Caller\x20-\x20%s','LastName','format','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','remoteUri','https://login.salesforce.com','clientId','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','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','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','assign','getString','Subjects','ticketType','Task','utc','IsRecurrence','lead','WhoId','endUserType','WhatId','Case','contact','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead'];(function(_0x148f0d,_0x2a9750){var _0x56a3b2=function(_0x502c1b){while(--_0x502c1b){_0x148f0d['push'](_0x148f0d['shift']());}};_0x56a3b2(++_0x2a9750);}(_0x6607,0x158));var _0x7660=function(_0x122929,_0x41c2f1){_0x122929=_0x122929-0x0;var _0x1879ac=_0x6607[_0x122929];return _0x1879ac;};'use strict';var _=require(_0x7660('0x0'));var rp=require(_0x7660('0x1'));var moment=require(_0x7660('0x2'));var BPromise=require(_0x7660('0x3'));var md5=require(_0x7660('0x4'));var jsforce=require(_0x7660('0x5'));var util=require(_0x7660('0x6'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x7660('0x7'));var logger=require(_0x7660('0x8'))(_0x7660('0x9'));config[_0x7660('0xa')]=_[_0x7660('0xb')](config[_0x7660('0xa')],{'host':_0x7660('0xc'),'port':0x18eb});var io=require(_0x7660('0xd'))(new Redis(config[_0x7660('0xa')]));function emit(_0x3564cf,_0x5ed3de,_0x516a9d){io['to'](_0x3564cf)['emit'](_0x5ed3de,_0x516a9d);}function getTicket(_0xc53ddb,_0x4dd285,_0x5e891e,_0x3bd1c8,_0x5c7f05,_0x47f503,_0x119910,_0x1afa81){var _0x4b9be7=Object[_0x7660('0xe')]({},{'OwnerId':_0x4dd285['id'],'Subject':intUtil[_0x7660('0xf')](_0x3bd1c8[_0x7660('0x10')],_0x5c7f05,'\x20'),'Description':intUtil[_0x7660('0xf')](_0x3bd1c8['Descriptions'],_0x5c7f05,'\x0a')},getCustomFields(_0x47f503,_0x5c7f05));if(_0x5e891e){if(_0x3bd1c8[_0x7660('0x11')]===_0x7660('0x12')){_0x4b9be7['ActivityDate']=moment[_0x7660('0x13')]();_0x4b9be7['IsReminderSet']=![];_0x4b9be7[_0x7660('0x14')]=![];if(_0x5e891e['endUserType']==='contact'||_0x5e891e['endUserType']===_0x7660('0x15')){_0x4b9be7[_0x7660('0x16')]=_0x5e891e['id'];}else if(_0x5e891e[_0x7660('0x17')]==='account'){_0x4b9be7[_0x7660('0x18')]=_0x5e891e['id'];}}else if(_0x3bd1c8[_0x7660('0x11')]===_0x7660('0x19')){if(_0x5e891e['endUserType']===_0x7660('0x1a')){_0x4b9be7[_0x7660('0x1b')]=_0x5e891e['id'];}else if(_0x5e891e['endUserType']===_0x7660('0x1c')){_0x4b9be7[_0x7660('0x1d')]=_0x5e891e['id'];}else if(_0x5e891e[_0x7660('0x17')]===_0x7660('0x15')&&_0x3bd1c8[_0x7660('0x1e')]){_0x4b9be7[_0x3bd1c8[_0x7660('0x1e')]]=_0x5e891e['id'];}else{logger[_0x7660('0x1f')](_0x7660('0x20'));}}}return _0x119910[_0x7660('0x21')](_0x3bd1c8[_0x7660('0x11')])[_0x7660('0x22')](_0x4b9be7);}function getUser(_0xf29bb5,_0x4a4f48,_0xffaea1){if(!_[_0x7660('0x23')](_0x4a4f48)&&intUtil[_0x7660('0x24')](_0x4a4f48)){var _0x19b63a={'Email':_0x4a4f48};var _0x10af95={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xffaea1[_0x7660('0x21')]('User')[_0x7660('0x25')](_0x19b63a,_0x10af95)[_0x7660('0x26')]()[_0x7660('0x27')](function(_0x130c73){if(_0x130c73[_0x7660('0x28')]){var _0x77f782=_[_0x7660('0x25')](_0x130c73,function(_0x503f50){return _0x503f50['Email']===_0x4a4f48;});if(_0x77f782){logger['info'](_0x7660('0x29'),_0x4a4f48);return BPromise[_0x7660('0x2a')]({'id':_0x77f782['Id'],'name':_0x77f782[_0x7660('0x2b')]});}}else{logger[_0x7660('0x1f')](_0x7660('0x2c'),_0x4a4f48);return _0xffaea1['identity']()[_0x7660('0x27')](function(_0x3c823d){return BPromise['resolve']({'id':_0x3c823d[_0x7660('0x2d')],'name':_0x3c823d[_0x7660('0x2e')]});});}});}else{logger[_0x7660('0x1f')](_0x7660('0x2c'),_0x4a4f48);return _0xffaea1['identity']()['then'](function(_0x4bda1f){return BPromise[_0x7660('0x2a')]({'id':_0x4bda1f['user_id'],'name':_0x4bda1f[_0x7660('0x2e')]});});}}function getEndUser(_0x403fcb,_0x1bea60,_0x32f022,_0x287fd0,_0x46296a){var _0x3e871b={'$or':{'Phone':_0x287fd0}};var _0x4c25fa={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7660('0x2a')]()['then'](function(){logger[_0x7660('0x1f')](_0x7660('0x2f'),_0x287fd0,_0x1bea60[_0x7660('0x30')]);switch(_0x1bea60[_0x7660('0x30')]){case _0x7660('0x31'):var _0x318ef2=_[_0x7660('0x32')](_0x3e871b);if(_0x1bea60[_0x7660('0x33')]){var _0x78af5d={};_0x78af5d[_0x1bea60[_0x7660('0x33')]]=_0x287fd0;_['merge'](_0x318ef2[_0x7660('0x34')],_0x78af5d);}return _0x46296a[_0x7660('0x21')](_0x7660('0x35'))[_0x7660('0x25')](_0x318ef2,_0x4c25fa)[_0x7660('0x26')]()[_0x7660('0x27')](function(_0x4517dd){if(_0x4517dd&&_0x4517dd[_0x7660('0x28')]){return _0x4517dd;}else{var _0x54ae63=_[_0x7660('0x32')](_0x3e871b);if(_0x1bea60[_0x7660('0x36')]){var _0x146eea={};_0x146eea[_0x1bea60[_0x7660('0x36')]]=_0x287fd0;_[_0x7660('0x37')](_0x54ae63[_0x7660('0x34')],_0x146eea);}return _0x46296a[_0x7660('0x21')]('Lead')['find'](_0x54ae63,_0x4c25fa);}});case _0x7660('0x38'):var _0x1c4eb6=_[_0x7660('0x32')](_0x3e871b);if(_0x1bea60[_0x7660('0x39')]){var _0x78af5d={};_0x78af5d[_0x1bea60[_0x7660('0x39')]]=_0x287fd0;_['merge'](_0x1c4eb6[_0x7660('0x34')],_0x78af5d);}return _0x46296a[_0x7660('0x21')](_0x7660('0x3a'))[_0x7660('0x25')](_0x1c4eb6,_0x4c25fa)[_0x7660('0x26')]()[_0x7660('0x27')](function(_0x498799){if(_0x498799&&_0x498799[_0x7660('0x28')]){return _0x498799;}else{var _0x5ec9df=_[_0x7660('0x32')](_0x3e871b);if(_0x1bea60[_0x7660('0x33')]){var _0x675e67={};_0x675e67[_0x1bea60[_0x7660('0x33')]]=_0x287fd0;_[_0x7660('0x37')](_0x5ec9df[_0x7660('0x34')],_0x675e67);}return _0x46296a[_0x7660('0x21')]('Contact')['find'](_0x5ec9df,_0x4c25fa)['then'](function(_0x3812e5){if(_0x3812e5&&_0x3812e5[_0x7660('0x28')]){return _0x3812e5;}else{var _0x181262=_['cloneDeep'](_0x3e871b);if(_0x1bea60[_0x7660('0x36')]){var _0x22732c={};_0x22732c[_0x1bea60['additionalSearchLead']]=_0x287fd0;_[_0x7660('0x37')](_0x181262[_0x7660('0x34')],_0x22732c);}return _0x46296a[_0x7660('0x21')](_0x7660('0x3b'))[_0x7660('0x25')](_0x181262,_0x4c25fa);}});}});case _0x7660('0x1a'):var _0x318ef2=_[_0x7660('0x32')](_0x3e871b);if(_0x1bea60[_0x7660('0x33')]){var _0x78af5d={};_0x78af5d[_0x1bea60[_0x7660('0x33')]]=_0x287fd0;_['merge'](_0x318ef2['$or'],_0x78af5d);}return _0x46296a[_0x7660('0x21')]('Contact')['find'](_0x318ef2,_0x4c25fa)[_0x7660('0x26')]();case _0x7660('0x15'):var _0x2e26d9=_['cloneDeep'](_0x3e871b);if(_0x1bea60['additionalSearchLead']){var _0x78af5d={};_0x78af5d[_0x1bea60[_0x7660('0x36')]]=_0x287fd0;_[_0x7660('0x37')](_0x2e26d9[_0x7660('0x34')],_0x78af5d);}return _0x46296a[_0x7660('0x21')](_0x7660('0x3b'))['find'](_0x2e26d9,_0x4c25fa);case _0x7660('0x1c'):var _0x1c4eb6=_[_0x7660('0x32')](_0x3e871b);if(_0x1bea60[_0x7660('0x39')]){var _0x78af5d={};_0x78af5d[_0x1bea60[_0x7660('0x39')]]=_0x287fd0;_[_0x7660('0x37')](_0x1c4eb6[_0x7660('0x34')],_0x78af5d);}return _0x46296a[_0x7660('0x21')]('Account')[_0x7660('0x25')](_0x1c4eb6,_0x4c25fa);default:return null;}})[_0x7660('0x27')](function(_0x35330d){if(_0x35330d&&_0x35330d[_0x7660('0x28')]){var _0x4ed4de=_[_0x7660('0x3c')](_0x35330d);if(_0x4ed4de){return BPromise[_0x7660('0x2a')]({'id':_0x4ed4de['Id'],'name':_0x4ed4de[_0x7660('0x2b')],'phone':_0x4ed4de[_0x7660('0x3d')],'endUserType':_0x4ed4de[_0x7660('0x3e')]['type']['toLowerCase']()});}}})[_0x7660('0x27')](function(_0x221f63){if(_0x221f63){logger[_0x7660('0x1f')](_0x7660('0x3f'),_0x221f63[_0x7660('0x17')],_0x287fd0);return BPromise['resolve'](_0x221f63);}else{logger[_0x7660('0x1f')](_0x7660('0x40'),_0x287fd0);var _0x4893f0={'Phone':_0x287fd0};if(_0x1bea60[_0x7660('0x41')]){if(_0x1bea60[_0x7660('0x41')]==='contact'){logger[_0x7660('0x1f')](_0x7660('0x42'),_0x287fd0,_0x1bea60[_0x7660('0x41')]);_0x4893f0['LastName']=_0x32f022!==_0x7660('0x43')?_0x32f022:util['format'](_0x7660('0x44'),_0x287fd0);}else if(_0x1bea60[_0x7660('0x41')]==='lead'){logger[_0x7660('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x287fd0,_0x1bea60[_0x7660('0x41')]);_0x4893f0[_0x7660('0x45')]=_0x32f022!==_0x7660('0x43')?_0x32f022:util[_0x7660('0x46')](_0x7660('0x44'),_0x287fd0);_0x4893f0[_0x7660('0x47')]=_0x7660('0x48');}else if(_0x1bea60[_0x7660('0x41')]===_0x7660('0x1c')){logger[_0x7660('0x1f')](_0x7660('0x42'),_0x287fd0,_0x1bea60[_0x7660('0x41')]);_0x4893f0[_0x7660('0x2b')]=_0x32f022!==_0x7660('0x43')?_0x32f022:util['format']('Caller\x20-\x20%s',_0x287fd0);}else{return null;}}return _0x46296a['sobject'](_[_0x7660('0x49')](_0x1bea60[_0x7660('0x41')]))['create'](_0x4893f0)[_0x7660('0x27')](function(_0x54b3dc){return BPromise[_0x7660('0x2a')]({'id':_0x54b3dc['id'],'endUserType':_0x1bea60[_0x7660('0x41')]});});}});}function getCustomFields(_0x57ea27,_0x46d9ec){var _0x2d239c={};if(_0x57ea27[_0x7660('0x28')]>0x0){_[_0x7660('0x4a')](_0x57ea27,function(_0x252b7e){if(_[_0x7660('0x4b')]([_0x7660('0x4c'),_0x7660('0x4d')],_0x252b7e[_0x7660('0x4e')])&&_0x252b7e[_0x7660('0x4f')]){_0x2d239c[_0x252b7e[_0x7660('0x4f')]]=_0x252b7e[_0x7660('0x50')][_0x7660('0x51')]();}else if(_0x252b7e['type']===_0x7660('0x52')&&_0x252b7e['variableName']&&_0x252b7e[_0x7660('0x4f')]){_0x46d9ec[_0x252b7e[_0x7660('0x53')]]&&(_0x2d239c[_0x252b7e[_0x7660('0x4f')]]=_0x46d9ec[_0x252b7e[_0x7660('0x53')]][_0x7660('0x51')]());}else if(_0x252b7e[_0x7660('0x4e')]===_0x7660('0x54')&&_0x252b7e[_0x7660('0x55')]&&_0x252b7e[_0x7660('0x55')][_0x7660('0x56')]&&_0x252b7e['idField']){_0x46d9ec[_0x252b7e[_0x7660('0x55')]['name'][_0x7660('0x57')]()]&&(_0x2d239c[_0x252b7e[_0x7660('0x4f')]]=_0x46d9ec[_0x252b7e['Variable'][_0x7660('0x56')][_0x7660('0x57')]()]['toString']());}});}return _0x2d239c;}function getConnection(_0x2645ec){var _0x200179=_0x2645ec[_0x7660('0x58')][_0x7660('0x59')](_0x2645ec['securityToken']);var _0x52513a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2645ec[_0x7660('0x5a')]||_0x7660('0x5b'),'clientId':_0x2645ec[_0x7660('0x5c')],'clientSecret':_0x2645ec['clientSecret']}});return _0x52513a[_0x7660('0x5d')](_0x2645ec['username'],_0x200179)[_0x7660('0x27')](function(){logger[_0x7660('0x1f')](_0x7660('0x5e'));return _0x52513a;});}exports[_0x7660('0x5f')]=function(_0x57a6db,_0x31a337,_0x5dc33f,_0x27b17d,_0x3b907d,_0x19de77){var _0x1bf482,_0x4cad32,_0x32418d,_0x3292f5;_0x19de77[_0x7660('0x60')]=intUtil[_0x7660('0x61')](_0x19de77[_0x7660('0x60')]);_0x19de77[_0x7660('0x5a')]=intUtil['stripTrailingSlash'](_0x19de77[_0x7660('0x5a')]);if(_0x3b907d&&_0x3b907d['monitor_format']){logger[_0x7660('0x1f')](_0x7660('0x62'),_0x7660('0x63'));_0x31a337['recordingURL']=util[_0x7660('0x46')](_0x7660('0x64'),_0x19de77[_0x7660('0x60')],_0x31a337['uniqueid'],md5(_0x31a337[_0x7660('0x65')]));}else{_0x31a337[_0x7660('0x66')]='';}return getConnection(_0x19de77)[_0x7660('0x27')](function(_0x4ea762){_0x3292f5=_0x4ea762;return getUser(_0x19de77,_0x27b17d[_0x7660('0x67')],_0x3292f5);})[_0x7660('0x27')](function(_0x4f4974){_0x1bf482=_0x4f4974;return getEndUser(_0x19de77,_0x5dc33f,_0x31a337[_0x7660('0x68')],_0x31a337[_0x7660('0x69')],_0x3292f5);})['then'](function(_0x117015){_0x4cad32=_0x117015;return getTicket(_0x19de77,_0x1bf482,_0x4cad32,_0x5dc33f,_0x31a337,_0x5dc33f[_0x7660('0x6a')],_0x3292f5,_0x7660('0x5f'));})[_0x7660('0x27')](function(_0x12efaf){_0x32418d=_0x12efaf;logger['info'](_0x7660('0x6b'),_0x32418d['id']);logger['info'](_0x7660('0x6c'),_0x32418d['id'],_0x27b17d[_0x7660('0x56')],_0x19de77[_0x7660('0x4e')]);switch(_0x19de77[_0x7660('0x4e')]){case _0x7660('0x6d'):emit(util[_0x7660('0x46')](_0x7660('0x6e'),_0x27b17d['name']),_0x7660('0x6f'),{'recordId':_0x32418d['id']});break;case'newTab':emit(util[_0x7660('0x46')](_0x7660('0x6e'),_0x27b17d[_0x7660('0x56')]),'trigger:browser:url',{'uri':util[_0x7660('0x46')](_0x7660('0x70'),_0x3292f5[_0x7660('0x71')],_0x32418d['id'])});break;default:logger[_0x7660('0x72')](_0x7660('0x73'));}})[_0x7660('0x74')](function(_0x222fa8){logger['error'](_0x7660('0x62'),_0x222fa8);});};exports[_0x7660('0x75')]=function(_0x4e6cfa,_0x1ecee8,_0x1a986a,_0xdb539a,_0x62260e,_0x10c4b8,_0x56ca17){var _0x2d1bd4,_0x9ff9c8,_0x3b607a,_0x1d5de4;_0x10c4b8[_0x7660('0x60')]=intUtil['stripTrailingSlash'](_0x10c4b8['serverUrl']);_0x10c4b8['remoteUri']=intUtil['stripTrailingSlash'](_0x10c4b8[_0x7660('0x5a')]);if(_0x56ca17&&_0x56ca17[_0x7660('0x76')]&&_0x56ca17[_0x7660('0x76')]!==_0x7660('0x77')){logger[_0x7660('0x1f')](_0x7660('0x78'),'Recording\x20is\x20enabled!');_0x1ecee8[_0x7660('0x66')]=util[_0x7660('0x46')](_0x7660('0x64'),_0x10c4b8[_0x7660('0x60')],_0x1ecee8[_0x7660('0x65')],md5(_0x1ecee8[_0x7660('0x65')]));}return getConnection(_0x10c4b8)['then'](function(_0x431587){_0x1d5de4=_0x431587;return getUser(_0x10c4b8,_0xdb539a[_0x7660('0x67')],_0x1d5de4);})['then'](function(_0x47cc3f){_0x2d1bd4=_0x47cc3f;return getEndUser(_0x10c4b8,_0x1a986a,_0x1ecee8[_0x7660('0x79')],_0x1ecee8[_0x7660('0x7a')],_0x1d5de4);})['then'](function(_0x4efc75){_0x9ff9c8=_0x4efc75;return getTicket(_0x10c4b8,_0x2d1bd4,_0x9ff9c8,_0x1a986a,_0x1ecee8,_0x1a986a[_0x7660('0x6a')],_0x1d5de4,_0x7660('0x75'));})[_0x7660('0x27')](function(_0x48b5bd){_0x3b607a=_0x48b5bd;logger[_0x7660('0x1f')](_0x7660('0x7b'),_0x3b607a['id']);logger[_0x7660('0x1f')](_0x7660('0x7c'),_0x3b607a['id'],_0xdb539a[_0x7660('0x56')],_0x10c4b8[_0x7660('0x4e')]);switch(_0x10c4b8[_0x7660('0x4e')]){case _0x7660('0x6d'):emit(util[_0x7660('0x46')](_0x7660('0x6e'),_0xdb539a[_0x7660('0x56')]),'trigger:salesforce:display',{'recordId':_0x3b607a['id']});break;case _0x7660('0x7d'):emit(util[_0x7660('0x46')](_0x7660('0x6e'),_0xdb539a[_0x7660('0x56')]),_0x7660('0x7e'),{'uri':util[_0x7660('0x46')]('%s/%s/e',_0x1d5de4[_0x7660('0x71')],_0x3b607a['id'])});break;default:logger[_0x7660('0x72')](_0x7660('0x78'),_0x7660('0x7f'));}})['catch'](function(_0x5d513b){logger[_0x7660('0x72')](_0x7660('0x78'),_0x5d513b);});};exports[_0x7660('0x80')]=function(_0x23b199,_0x152533,_0x215af2,_0x288aac,_0x285410,_0x531cae){var _0x143955,_0x22f2a2,_0x36c847,_0x5787c0;_0x531cae['serverUrl']=intUtil['stripTrailingSlash'](_0x531cae[_0x7660('0x60')]);_0x531cae[_0x7660('0x5a')]=intUtil['stripTrailingSlash'](_0x531cae['remoteUri']);if(_0x285410&&_0x285410[_0x7660('0x81')]){logger[_0x7660('0x1f')]('['+_0x152533[_0x7660('0x82')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x152533['recordingURL']=util['format'](_0x7660('0x64'),_0x531cae[_0x7660('0x60')],_0x152533[_0x7660('0x65')],md5(_0x152533[_0x7660('0x65')]));}else{_0x152533[_0x7660('0x66')]='';}return getConnection(_0x531cae)[_0x7660('0x27')](function(_0x76c708){_0x5787c0=_0x76c708;if(!_[_0x7660('0x23')](_0x288aac)){return getUser(_0x531cae,_0x288aac['name'],_0x5787c0);}else{return getUser(_0x531cae,null,_0x5787c0);}})[_0x7660('0x27')](function(_0x77fe5c){_0x143955=_0x77fe5c;return getEndUser(_0x531cae,_0x215af2,_0x152533[_0x7660('0x68')],_0x152533[_0x7660('0x69')],_0x5787c0);})[_0x7660('0x27')](function(_0x49bef9){_0x22f2a2=_0x49bef9;return getTicket(_0x531cae,_0x143955,_0x22f2a2,_0x215af2,_0x152533,_0x215af2[_0x7660('0x6a')],_0x5787c0);})[_0x7660('0x27')](function(_0x4c7374){_0x36c847=_0x4c7374;logger[_0x7660('0x1f')]('['+_0x152533[_0x7660('0x82')][_0x7660('0x83')]()+']\x20Ticket\x20%s\x20created.',_0x36c847['id']);logger['info']('['+_0x152533['lastevent'][_0x7660('0x83')]()+_0x7660('0x84'),_0x531cae[_0x7660('0x4e')]);})[_0x7660('0x74')](function(_0x345e6b){logger[_0x7660('0x72')]('['+_0x152533[_0x7660('0x82')][_0x7660('0x83')]()+']',_0x345e6b);});}; \ No newline at end of file +var _0xb3b9=['[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','md5','jsforce','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','assign','getString','Subjects','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','lead','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','string','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','format','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xb3b9,0x196));var _0x9b3b=function(_0x4182ec,_0x4db912){_0x4182ec=_0x4182ec-0x0;var _0x5c0635=_0xb3b9[_0x4182ec];return _0x5c0635;};'use strict';var _=require(_0x9b3b('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x9b3b('0x1'));var jsforce=require(_0x9b3b('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x9b3b('0x3'));var config=require(_0x9b3b('0x4'));var logger=require(_0x9b3b('0x5'))('salesforce');config[_0x9b3b('0x6')]=_[_0x9b3b('0x7')](config[_0x9b3b('0x6')],{'host':_0x9b3b('0x8'),'port':0x18eb});var io=require(_0x9b3b('0x9'))(new Redis(config[_0x9b3b('0x6')]));function emit(_0x4a9017,_0x5ac631,_0x1cf75a){io['to'](_0x4a9017)['emit'](_0x5ac631,_0x1cf75a);}function getTicket(_0x3980bd,_0x1d4b0e,_0x2de6ce,_0x34246c,_0x53c97c,_0xc2085,_0x3a1f38,_0x18ea15){var _0x4e5e96=Object[_0x9b3b('0xa')]({},{'OwnerId':_0x1d4b0e['id'],'Subject':intUtil[_0x9b3b('0xb')](_0x34246c[_0x9b3b('0xc')],_0x53c97c,'\x20'),'Description':intUtil[_0x9b3b('0xb')](_0x34246c[_0x9b3b('0xd')],_0x53c97c,'\x0a')},getCustomFields(_0xc2085,_0x53c97c));if(_0x2de6ce){if(_0x34246c['ticketType']===_0x9b3b('0xe')){_0x4e5e96[_0x9b3b('0xf')]=moment[_0x9b3b('0x10')]();_0x4e5e96[_0x9b3b('0x11')]=![];_0x4e5e96[_0x9b3b('0x12')]=![];if(_0x2de6ce['endUserType']===_0x9b3b('0x13')||_0x2de6ce[_0x9b3b('0x14')]===_0x9b3b('0x15')){_0x4e5e96[_0x9b3b('0x16')]=_0x2de6ce['id'];}else if(_0x2de6ce[_0x9b3b('0x14')]===_0x9b3b('0x17')){_0x4e5e96[_0x9b3b('0x18')]=_0x2de6ce['id'];}}else if(_0x34246c[_0x9b3b('0x19')]===_0x9b3b('0x1a')){if(_0x2de6ce['endUserType']===_0x9b3b('0x13')){_0x4e5e96[_0x9b3b('0x1b')]=_0x2de6ce['id'];}else if(_0x2de6ce[_0x9b3b('0x14')]===_0x9b3b('0x17')){_0x4e5e96[_0x9b3b('0x1c')]=_0x2de6ce['id'];}else if(_0x2de6ce[_0x9b3b('0x14')]===_0x9b3b('0x15')&&_0x34246c[_0x9b3b('0x1d')]){_0x4e5e96[_0x34246c[_0x9b3b('0x1d')]]=_0x2de6ce['id'];}else{logger[_0x9b3b('0x1e')](_0x9b3b('0x1f'));}}}return _0x3a1f38[_0x9b3b('0x20')](_0x34246c[_0x9b3b('0x19')])[_0x9b3b('0x21')](_0x4e5e96);}function getUser(_0x5bef2b,_0x38c8b9,_0x3bcb3a){if(!_['isNil'](_0x38c8b9)&&intUtil[_0x9b3b('0x22')](_0x38c8b9)){var _0x49f986={'Email':_0x38c8b9};var _0x4d907a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3bcb3a[_0x9b3b('0x20')](_0x9b3b('0x23'))[_0x9b3b('0x24')](_0x49f986,_0x4d907a)[_0x9b3b('0x25')]()[_0x9b3b('0x26')](function(_0xf176b1){if(_0xf176b1[_0x9b3b('0x27')]){var _0x39a62f=_[_0x9b3b('0x24')](_0xf176b1,function(_0x203bfc){return _0x203bfc['Email']===_0x38c8b9;});if(_0x39a62f){logger['info'](_0x9b3b('0x28'),_0x38c8b9);return BPromise[_0x9b3b('0x29')]({'id':_0x39a62f['Id'],'name':_0x39a62f[_0x9b3b('0x2a')]});}}else{logger[_0x9b3b('0x1e')](_0x9b3b('0x2b'),_0x38c8b9);return _0x3bcb3a[_0x9b3b('0x2c')]()[_0x9b3b('0x26')](function(_0x5cd60c){return BPromise[_0x9b3b('0x29')]({'id':_0x5cd60c[_0x9b3b('0x2d')],'name':_0x5cd60c[_0x9b3b('0x2e')]});});}});}else{logger['info'](_0x9b3b('0x2b'),_0x38c8b9);return _0x3bcb3a[_0x9b3b('0x2c')]()[_0x9b3b('0x26')](function(_0x25ca08){return BPromise[_0x9b3b('0x29')]({'id':_0x25ca08[_0x9b3b('0x2d')],'name':_0x25ca08[_0x9b3b('0x2e')]});});}}function getEndUser(_0x1d843f,_0x28731b,_0x487773,_0x58591d,_0xb82a95){var _0x300bf1={'$or':{'Phone':_0x58591d}};var _0xe7bbcc={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x9b3b('0x29')]()[_0x9b3b('0x26')](function(){logger[_0x9b3b('0x1e')](_0x9b3b('0x2f'),_0x58591d,_0x28731b['moduleSearch']);switch(_0x28731b[_0x9b3b('0x30')]){case _0x9b3b('0x31'):var _0x2ba669=_[_0x9b3b('0x32')](_0x300bf1);if(_0x28731b[_0x9b3b('0x33')]){var _0x354f38={};_0x354f38[_0x28731b[_0x9b3b('0x33')]]=_0x58591d;_[_0x9b3b('0x34')](_0x2ba669[_0x9b3b('0x35')],_0x354f38);}return _0xb82a95[_0x9b3b('0x20')](_0x9b3b('0x36'))[_0x9b3b('0x24')](_0x2ba669,_0xe7bbcc)[_0x9b3b('0x25')]()[_0x9b3b('0x26')](function(_0x6f557e){if(_0x6f557e&&_0x6f557e[_0x9b3b('0x27')]){return _0x6f557e;}else{var _0x1d67d4=_[_0x9b3b('0x32')](_0x300bf1);if(_0x28731b[_0x9b3b('0x37')]){var _0x10db25={};_0x10db25[_0x28731b[_0x9b3b('0x37')]]=_0x58591d;_[_0x9b3b('0x34')](_0x1d67d4[_0x9b3b('0x35')],_0x10db25);}return _0xb82a95[_0x9b3b('0x20')]('Lead')[_0x9b3b('0x24')](_0x1d67d4,_0xe7bbcc);}});case _0x9b3b('0x38'):var _0x211981=_[_0x9b3b('0x32')](_0x300bf1);if(_0x28731b[_0x9b3b('0x39')]){var _0x354f38={};_0x354f38[_0x28731b[_0x9b3b('0x39')]]=_0x58591d;_[_0x9b3b('0x34')](_0x211981[_0x9b3b('0x35')],_0x354f38);}return _0xb82a95[_0x9b3b('0x20')](_0x9b3b('0x3a'))['find'](_0x211981,_0xe7bbcc)[_0x9b3b('0x25')]()[_0x9b3b('0x26')](function(_0x185e71){if(_0x185e71&&_0x185e71['length']){return _0x185e71;}else{var _0x34d2c9=_[_0x9b3b('0x32')](_0x300bf1);if(_0x28731b[_0x9b3b('0x33')]){var _0x5636b4={};_0x5636b4[_0x28731b['additionalSearchContact']]=_0x58591d;_['merge'](_0x34d2c9[_0x9b3b('0x35')],_0x5636b4);}return _0xb82a95['sobject'](_0x9b3b('0x36'))['find'](_0x34d2c9,_0xe7bbcc)['then'](function(_0x596338){if(_0x596338&&_0x596338[_0x9b3b('0x27')]){return _0x596338;}else{var _0x355f9d=_[_0x9b3b('0x32')](_0x300bf1);if(_0x28731b[_0x9b3b('0x37')]){var _0x1c55e9={};_0x1c55e9[_0x28731b[_0x9b3b('0x37')]]=_0x58591d;_[_0x9b3b('0x34')](_0x355f9d[_0x9b3b('0x35')],_0x1c55e9);}return _0xb82a95['sobject'](_0x9b3b('0x3b'))['find'](_0x355f9d,_0xe7bbcc);}});}});case'contact':var _0x2ba669=_[_0x9b3b('0x32')](_0x300bf1);if(_0x28731b[_0x9b3b('0x33')]){var _0x354f38={};_0x354f38[_0x28731b[_0x9b3b('0x33')]]=_0x58591d;_[_0x9b3b('0x34')](_0x2ba669[_0x9b3b('0x35')],_0x354f38);}return _0xb82a95[_0x9b3b('0x20')](_0x9b3b('0x36'))[_0x9b3b('0x24')](_0x2ba669,_0xe7bbcc)[_0x9b3b('0x25')]();case'lead':var _0x3d430c=_[_0x9b3b('0x32')](_0x300bf1);if(_0x28731b[_0x9b3b('0x37')]){var _0x354f38={};_0x354f38[_0x28731b[_0x9b3b('0x37')]]=_0x58591d;_[_0x9b3b('0x34')](_0x3d430c['$or'],_0x354f38);}return _0xb82a95['sobject'](_0x9b3b('0x3b'))[_0x9b3b('0x24')](_0x3d430c,_0xe7bbcc);case _0x9b3b('0x17'):var _0x211981=_[_0x9b3b('0x32')](_0x300bf1);if(_0x28731b[_0x9b3b('0x39')]){var _0x354f38={};_0x354f38[_0x28731b[_0x9b3b('0x39')]]=_0x58591d;_[_0x9b3b('0x34')](_0x211981[_0x9b3b('0x35')],_0x354f38);}return _0xb82a95[_0x9b3b('0x20')](_0x9b3b('0x3a'))[_0x9b3b('0x24')](_0x211981,_0xe7bbcc);default:return null;}})[_0x9b3b('0x26')](function(_0x261cc0){if(_0x261cc0&&_0x261cc0[_0x9b3b('0x27')]){var _0x1b7797=_['first'](_0x261cc0);if(_0x1b7797){return BPromise[_0x9b3b('0x29')]({'id':_0x1b7797['Id'],'name':_0x1b7797[_0x9b3b('0x2a')],'phone':_0x1b7797[_0x9b3b('0x3c')],'endUserType':_0x1b7797[_0x9b3b('0x3d')][_0x9b3b('0x3e')][_0x9b3b('0x3f')]()});}}})[_0x9b3b('0x26')](function(_0x4c6b76){if(_0x4c6b76){logger['info'](_0x9b3b('0x40'),_0x4c6b76[_0x9b3b('0x14')],_0x58591d);return BPromise['resolve'](_0x4c6b76);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x58591d);var _0x14c035={'Phone':_0x58591d};if(_0x28731b[_0x9b3b('0x41')]){if(_0x28731b[_0x9b3b('0x41')]===_0x9b3b('0x13')){logger['info'](_0x9b3b('0x42'),_0x58591d,_0x28731b['moduleCreate']);_0x14c035[_0x9b3b('0x43')]=_0x487773!==_0x9b3b('0x44')?_0x487773:util['format']('Caller\x20-\x20%s',_0x58591d);}else if(_0x28731b[_0x9b3b('0x41')]===_0x9b3b('0x15')){logger[_0x9b3b('0x1e')](_0x9b3b('0x42'),_0x58591d,_0x28731b['moduleCreate']);_0x14c035[_0x9b3b('0x43')]=_0x487773!==_0x9b3b('0x44')?_0x487773:util['format'](_0x9b3b('0x45'),_0x58591d);_0x14c035[_0x9b3b('0x46')]=_0x9b3b('0x47');}else if(_0x28731b[_0x9b3b('0x41')]===_0x9b3b('0x17')){logger[_0x9b3b('0x1e')](_0x9b3b('0x42'),_0x58591d,_0x28731b['moduleCreate']);_0x14c035['Name']=_0x487773!==_0x9b3b('0x44')?_0x487773:util['format'](_0x9b3b('0x45'),_0x58591d);}else{return null;}}return _0xb82a95['sobject'](_[_0x9b3b('0x48')](_0x28731b[_0x9b3b('0x41')]))[_0x9b3b('0x21')](_0x14c035)['then'](function(_0x4bdae3){return BPromise[_0x9b3b('0x29')]({'id':_0x4bdae3['id'],'endUserType':_0x28731b[_0x9b3b('0x41')]});});}});}function getCustomFields(_0x5cca12,_0x121743){var _0x30c4fd={};if(_0x5cca12[_0x9b3b('0x27')]>0x0){_[_0x9b3b('0x49')](_0x5cca12,function(_0x324009){if(_['includes']([_0x9b3b('0x4a'),'picklist'],_0x324009['type'])&&_0x324009[_0x9b3b('0x4b')]){_0x30c4fd[_0x324009[_0x9b3b('0x4b')]]=_0x324009[_0x9b3b('0x4c')][_0x9b3b('0x4d')]();}else if(_0x324009['type']===_0x9b3b('0x4e')&&_0x324009[_0x9b3b('0x4f')]&&_0x324009[_0x9b3b('0x4b')]){_0x121743[_0x324009['variableName']]&&(_0x30c4fd[_0x324009[_0x9b3b('0x4b')]]=_0x121743[_0x324009[_0x9b3b('0x4f')]][_0x9b3b('0x4d')]());}else if(_0x324009[_0x9b3b('0x3e')]===_0x9b3b('0x50')&&_0x324009[_0x9b3b('0x51')]&&_0x324009[_0x9b3b('0x51')][_0x9b3b('0x52')]&&_0x324009[_0x9b3b('0x4b')]){_0x121743[_0x324009[_0x9b3b('0x51')][_0x9b3b('0x52')][_0x9b3b('0x3f')]()]&&(_0x30c4fd[_0x324009['idField']]=_0x121743[_0x324009[_0x9b3b('0x51')]['name'][_0x9b3b('0x3f')]()][_0x9b3b('0x4d')]());}});}return _0x30c4fd;}function getConnection(_0x27e027){var _0x1c9cbe=_0x27e027[_0x9b3b('0x53')][_0x9b3b('0x54')](_0x27e027['securityToken']);var _0x9b1376=new jsforce[(_0x9b3b('0x55'))]({'oauth2':{'loginUrl':_0x27e027[_0x9b3b('0x56')]||'https://login.salesforce.com','clientId':_0x27e027[_0x9b3b('0x57')],'clientSecret':_0x27e027[_0x9b3b('0x58')]}});return _0x9b1376[_0x9b3b('0x59')](_0x27e027[_0x9b3b('0x5a')],_0x1c9cbe)[_0x9b3b('0x26')](function(){logger['info'](_0x9b3b('0x5b'));return _0x9b1376;});}exports['queue']=function(_0x51e8b6,_0x45364e,_0x410705,_0x5b0c99,_0x22aaa0,_0x4de5fd){var _0x4b0750,_0x281acb,_0x2053c3,_0x1d50f8;_0x4de5fd[_0x9b3b('0x5c')]=intUtil[_0x9b3b('0x5d')](_0x4de5fd[_0x9b3b('0x5c')]);_0x4de5fd[_0x9b3b('0x56')]=intUtil[_0x9b3b('0x5d')](_0x4de5fd[_0x9b3b('0x56')]);if(_0x22aaa0&&_0x22aaa0[_0x9b3b('0x5e')]){logger[_0x9b3b('0x1e')](_0x9b3b('0x5f'),'Recording\x20is\x20enabled!');_0x45364e[_0x9b3b('0x60')]=util['format'](_0x9b3b('0x61'),_0x4de5fd[_0x9b3b('0x5c')],_0x45364e['uniqueid'],md5(_0x45364e[_0x9b3b('0x62')]));}else{_0x45364e[_0x9b3b('0x60')]='';}return getConnection(_0x4de5fd)[_0x9b3b('0x26')](function(_0x23f1a7){_0x1d50f8=_0x23f1a7;return getUser(_0x4de5fd,_0x5b0c99[_0x9b3b('0x63')],_0x1d50f8);})[_0x9b3b('0x26')](function(_0x716931){_0x4b0750=_0x716931;return getEndUser(_0x4de5fd,_0x410705,_0x45364e[_0x9b3b('0x64')],_0x45364e[_0x9b3b('0x65')],_0x1d50f8);})[_0x9b3b('0x26')](function(_0x10403d){_0x281acb=_0x10403d;return getTicket(_0x4de5fd,_0x4b0750,_0x281acb,_0x410705,_0x45364e,_0x410705[_0x9b3b('0x66')],_0x1d50f8,_0x9b3b('0x67'));})[_0x9b3b('0x26')](function(_0x3de051){_0x2053c3=_0x3de051;logger[_0x9b3b('0x1e')](_0x9b3b('0x68'),_0x2053c3['id']);logger[_0x9b3b('0x1e')](_0x9b3b('0x69'),_0x2053c3['id'],_0x5b0c99[_0x9b3b('0x52')],_0x4de5fd[_0x9b3b('0x3e')]);switch(_0x4de5fd['type']){case _0x9b3b('0x6a'):emit(util['format'](_0x9b3b('0x6b'),_0x5b0c99['name']),'trigger:salesforce:display',{'recordId':_0x2053c3['id']});break;case _0x9b3b('0x6c'):emit(util[_0x9b3b('0x6d')]('user:%s',_0x5b0c99[_0x9b3b('0x52')]),_0x9b3b('0x6e'),{'uri':util[_0x9b3b('0x6d')]('%s/%s/e',_0x1d50f8[_0x9b3b('0x6f')],_0x2053c3['id'])});break;default:logger[_0x9b3b('0x70')](_0x9b3b('0x71'));}})['catch'](function(_0x36b797){logger[_0x9b3b('0x70')]('[QUEUE]',_0x36b797);});};exports[_0x9b3b('0x72')]=function(_0x32ae16,_0x4467a0,_0x23f086,_0x30f4f7,_0x22c6ff,_0x1f7b76,_0x6a6292){var _0x511b91,_0x4249f3,_0x53578d,_0x5d1c61;_0x1f7b76[_0x9b3b('0x5c')]=intUtil[_0x9b3b('0x5d')](_0x1f7b76[_0x9b3b('0x5c')]);_0x1f7b76[_0x9b3b('0x56')]=intUtil['stripTrailingSlash'](_0x1f7b76[_0x9b3b('0x56')]);if(_0x6a6292&&_0x6a6292[_0x9b3b('0x73')]&&_0x6a6292[_0x9b3b('0x73')]!==_0x9b3b('0x74')){logger[_0x9b3b('0x1e')](_0x9b3b('0x75'),_0x9b3b('0x76'));_0x4467a0[_0x9b3b('0x60')]=util[_0x9b3b('0x6d')](_0x9b3b('0x61'),_0x1f7b76['serverUrl'],_0x4467a0['uniqueid'],md5(_0x4467a0[_0x9b3b('0x62')]));}return getConnection(_0x1f7b76)[_0x9b3b('0x26')](function(_0x2e74a5){_0x5d1c61=_0x2e74a5;return getUser(_0x1f7b76,_0x30f4f7[_0x9b3b('0x63')],_0x5d1c61);})[_0x9b3b('0x26')](function(_0xf574c8){_0x511b91=_0xf574c8;return getEndUser(_0x1f7b76,_0x23f086,_0x4467a0[_0x9b3b('0x77')],_0x4467a0[_0x9b3b('0x78')],_0x5d1c61);})[_0x9b3b('0x26')](function(_0x26ea9e){_0x4249f3=_0x26ea9e;return getTicket(_0x1f7b76,_0x511b91,_0x4249f3,_0x23f086,_0x4467a0,_0x23f086[_0x9b3b('0x66')],_0x5d1c61,_0x9b3b('0x72'));})[_0x9b3b('0x26')](function(_0x1924ff){_0x53578d=_0x1924ff;logger['info'](_0x9b3b('0x79'),_0x53578d['id']);logger['info'](_0x9b3b('0x7a'),_0x53578d['id'],_0x30f4f7['name'],_0x1f7b76[_0x9b3b('0x3e')]);switch(_0x1f7b76[_0x9b3b('0x3e')]){case'integrationTab':emit(util['format'](_0x9b3b('0x6b'),_0x30f4f7[_0x9b3b('0x52')]),_0x9b3b('0x7b'),{'recordId':_0x53578d['id']});break;case _0x9b3b('0x6c'):emit(util['format'](_0x9b3b('0x6b'),_0x30f4f7[_0x9b3b('0x52')]),_0x9b3b('0x6e'),{'uri':util[_0x9b3b('0x6d')]('%s/%s/e',_0x5d1c61[_0x9b3b('0x6f')],_0x53578d['id'])});break;default:logger[_0x9b3b('0x70')](_0x9b3b('0x75'),_0x9b3b('0x7c'));}})[_0x9b3b('0x7d')](function(_0x3b9a94){logger[_0x9b3b('0x70')](_0x9b3b('0x75'),_0x3b9a94);});};exports[_0x9b3b('0x7e')]=function(_0x488449,_0x4202ec,_0x2b46cf,_0xaf7c6f,_0xcaa2fc,_0x3c647b){var _0x1b245b,_0x3f6bfa,_0x46add6,_0x121bf8;_0x3c647b[_0x9b3b('0x5c')]=intUtil[_0x9b3b('0x5d')](_0x3c647b[_0x9b3b('0x5c')]);_0x3c647b[_0x9b3b('0x56')]=intUtil[_0x9b3b('0x5d')](_0x3c647b[_0x9b3b('0x56')]);if(_0xcaa2fc&&_0xcaa2fc[_0x9b3b('0x5e')]){logger[_0x9b3b('0x1e')]('['+_0x4202ec[_0x9b3b('0x7f')][_0x9b3b('0x80')]()+']',_0x9b3b('0x76'));_0x4202ec[_0x9b3b('0x60')]=util['format'](_0x9b3b('0x61'),_0x3c647b[_0x9b3b('0x5c')],_0x4202ec[_0x9b3b('0x62')],md5(_0x4202ec[_0x9b3b('0x62')]));}else{_0x4202ec[_0x9b3b('0x60')]='';}return getConnection(_0x3c647b)[_0x9b3b('0x26')](function(_0x249fea){_0x121bf8=_0x249fea;if(!_[_0x9b3b('0x81')](_0xaf7c6f)){return getUser(_0x3c647b,_0xaf7c6f[_0x9b3b('0x52')],_0x121bf8);}else{return getUser(_0x3c647b,null,_0x121bf8);}})['then'](function(_0x24e44f){_0x1b245b=_0x24e44f;return getEndUser(_0x3c647b,_0x2b46cf,_0x4202ec[_0x9b3b('0x64')],_0x4202ec[_0x9b3b('0x65')],_0x121bf8);})[_0x9b3b('0x26')](function(_0x3da66a){_0x3f6bfa=_0x3da66a;return getTicket(_0x3c647b,_0x1b245b,_0x3f6bfa,_0x2b46cf,_0x4202ec,_0x2b46cf['Fields'],_0x121bf8);})['then'](function(_0x69eece){_0x46add6=_0x69eece;logger[_0x9b3b('0x1e')]('['+_0x4202ec[_0x9b3b('0x7f')][_0x9b3b('0x80')]()+_0x9b3b('0x82'),_0x46add6['id']);logger[_0x9b3b('0x1e')]('['+_0x4202ec[_0x9b3b('0x7f')][_0x9b3b('0x80')]()+_0x9b3b('0x83'),_0x3c647b[_0x9b3b('0x3e')]);})[_0x9b3b('0x7d')](function(_0x58bd21){logger[_0x9b3b('0x70')]('['+_0x4202ec[_0x9b3b('0x7f')][_0x9b3b('0x80')]()+']',_0x58bd21);});}; \ 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 3c55ff2..260c256 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 _0x4137=['user:%s','emit','trigger:browser:url','password','sysparm_limit=1','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','sys_id','info','toUpperCase','error','message','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','result','active','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','nameField','customField','toLowerCase','content','includes','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','outbound','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','ticketId','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format'];(function(_0x1e896c,_0x3f9948){var _0xd149d9=function(_0x3281e5){while(--_0x3281e5){_0x1e896c['push'](_0x1e896c['shift']());}};_0xd149d9(++_0x3f9948);}(_0x4137,0xf8));var _0x7413=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4137[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x7413('0x0'));var Promise=require(_0x7413('0x1'));var rp=require(_0x7413('0x2'));var util=require(_0x7413('0x3'));var md5=require(_0x7413('0x4'));var Redis=require(_0x7413('0x5'));var intUtil=require(_0x7413('0x6'));var config=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));config[_0x7413('0xa')]=_[_0x7413('0xb')](config['redis'],{'host':_0x7413('0xc'),'port':0x18eb});var io=require(_0x7413('0xd'))(new Redis(config[_0x7413('0xa')]));function getAdminUser(_0x15af0d,_0x5f4cd0,_0x3236ec,_0x120dc2,_0x4e320b,_0x422bf5){return new Promise(function(_0x2f4b54,_0x50fde0){var _0x29f124={'method':_0x7413('0xe'),'uri':_0x120dc2+_0x7413('0xf')+'&'+_0x4e320b+'&'+_0x422bf5,'auth':_0x5f4cd0,'json':!![]};return rp(_0x29f124)[_0x7413('0x10')](function(_0x14212d){if(_0x14212d['result'][_0x7413('0x11')]>0x0){_0x3236ec[_0x7413('0x12')]=_0x14212d['result'][0x0][_0x7413('0x13')];}logger[_0x7413('0x14')]('['+[_0x15af0d[_0x7413('0x15')]()]+'],\x20getAdminUser\x20crm',_0x3236ec);_0x2f4b54(_0x3236ec);})['catch'](function(_0x55ef69){logger[_0x7413('0x16')]('['+[_0x15af0d[_0x7413('0x15')]()]+']',_0x55ef69['message']);_0x50fde0(_0x55ef69[_0x7413('0x17')]);});});}function getUser(_0x45bef0,_0x4955d3,_0x38b3d1,_0x50f301,_0x4b9a5b){return function(_0x26501b){logger['info']('['+[_0x45bef0[_0x7413('0x15')]()]+'],\x20getUser\x20input\x20crm',_0x26501b);return new Promise(function(_0x2036b6,_0x3230d8){if(intUtil[_0x7413('0x18')](_0x26501b[_0x7413('0x19')])){var _0x2a3417={'method':_0x7413('0xe'),'uri':_0x38b3d1+'sys_user?sysparm_query=email%3D'+_0x26501b[_0x7413('0x19')]+'&'+_0x50f301+'&'+_0x4b9a5b,'auth':_0x4955d3,'json':!![]};logger[_0x7413('0x14')]('['+[_0x45bef0[_0x7413('0x15')]()]+_0x7413('0x1a'),_0x2a3417);return rp(_0x2a3417)['then'](function(_0x239d0e){logger[_0x7413('0x14')]('['+[_0x45bef0[_0x7413('0x15')]()]+_0x7413('0x1b'),_0x239d0e);if(_0x239d0e[_0x7413('0x1c')][_0x7413('0x11')]>0x0&&String(_0x239d0e[_0x7413('0x1c')][0x0][_0x7413('0x1d')])==='true'){_0x26501b['userId']=_0x239d0e[_0x7413('0x1c')][0x0]['sys_id'];}else{_0x26501b[_0x7413('0x1e')]=_0x26501b[_0x7413('0x12')];_0x26501b[_0x7413('0x19')]=_0x26501b[_0x7413('0x1f')];}logger[_0x7413('0x14')]('['+[_0x45bef0[_0x7413('0x15')]()]+_0x7413('0x20'),_0x26501b);_0x2036b6(_0x26501b);})[_0x7413('0x21')](function(_0x1d455b){logger['error']('['+[_0x45bef0['toUpperCase']()]+']',_0x1d455b[_0x7413('0x17')]);_0x3230d8(_0x1d455b['message']);});}else{logger[_0x7413('0x14')]('['+[_0x45bef0[_0x7413('0x15')]()]+_0x7413('0x22'));_0x26501b['userId']=_0x26501b[_0x7413('0x12')];_0x26501b[_0x7413('0x19')]=_0x26501b[_0x7413('0x1f')];_0x2036b6(_0x26501b);}});};}function createEndUser(_0x4843fd,_0x19970c,_0x2e521f,_0x5eb4d9,_0x24dce7){logger['info']('['+[_0x4843fd[_0x7413('0x15')]()]+_0x7413('0x23'),_0x2e521f);return new Promise(function(_0xae2969,_0x13a836){var _0x25fa52={'method':_0x7413('0x24'),'uri':_0x5eb4d9+'sys_user?'+_0x24dce7,'body':{'user_name':_0x2e521f[_0x7413('0x25')],'roles':_0x7413('0x26'),'first_name':_0x2e521f[_0x7413('0x25')],'active':_0x7413('0x27'),'date_format':_0x7413('0x28'),'phone':_0x2e521f[_0x7413('0x25')]},'auth':_0x19970c,'json':!![]};return rp(_0x25fa52)[_0x7413('0x10')](function(_0x5b4426){logger[_0x7413('0x14')]('['+[_0x4843fd[_0x7413('0x15')]()]+_0x7413('0x29'),_0x5b4426[_0x7413('0x1c')]);_0x2e521f[_0x7413('0x2a')]=_0x5b4426['result'][_0x7413('0x13')];_0xae2969(_0x2e521f);})['catch'](function(_0x3cc6c8){logger[_0x7413('0x16')]('['+[_0x4843fd[_0x7413('0x15')]()]+']',_0x3cc6c8['message']);_0x13a836(_0x3cc6c8[_0x7413('0x17')]);});});}function getEndUser(_0x487dc8,_0x29e30a,_0x31c174,_0x591666,_0x499cfa){return function(_0x440bfe){logger[_0x7413('0x14')]('['+[_0x487dc8[_0x7413('0x15')]()]+'],\x20getEndUser\x20input\x20crm',_0x440bfe);return new Promise(function(_0x4dd1ce,_0x409f06){var _0x5a92ab={'method':'GET','uri':_0x31c174+_0x7413('0x2b')+_0x440bfe['endUserNumber']+'&'+_0x591666+'&'+_0x499cfa,'auth':_0x29e30a,'json':!![]};return rp(_0x5a92ab)[_0x7413('0x10')](function(_0x28090c){if(_0x28090c[_0x7413('0x1c')][_0x7413('0x11')]>0x0){_0x440bfe[_0x7413('0x2a')]=_0x28090c['result'][0x0][_0x7413('0x13')];logger[_0x7413('0x14')]('['+[_0x487dc8[_0x7413('0x15')]()]+_0x7413('0x2c'),_0x440bfe);_0x4dd1ce(_0x440bfe);}else{return createEndUser(_0x487dc8,_0x29e30a,_0x440bfe,_0x31c174,_0x591666)[_0x7413('0x10')](function(_0x1168cd){logger[_0x7413('0x14')]('['+[_0x487dc8[_0x7413('0x15')]()]+_0x7413('0x2d'),_0x1168cd);_0x4dd1ce(_0x1168cd);});}})[_0x7413('0x21')](function(_0x5c03eb){logger[_0x7413('0x16')]('['+[_0x487dc8['toUpperCase']()]+']',_0x5c03eb[_0x7413('0x17')]);_0x409f06(_0x5c03eb['message']);});});};}function getCustomFields(_0x56cb6f,_0x5b592c){var _0x53c47c={};if(_0x56cb6f['length']>0x0){_[_0x7413('0x2e')](_0x56cb6f,function(_0x4c1770){if(_['includes']([_0x7413('0x2f'),'picklist'],_0x4c1770['type'])&&_0x4c1770[_0x7413('0x30')]&&!_0x4c1770[_0x7413('0x31')]){_0x53c47c[_0x4c1770[_0x7413('0x30')][_0x7413('0x32')]()]=_0x4c1770[_0x7413('0x33')]['toString']();}else if(_[_0x7413('0x34')](['string',_0x7413('0x35')],_0x4c1770[_0x7413('0x36')])&&_0x4c1770[_0x7413('0x37')]&&_0x4c1770[_0x7413('0x31')]){_0x53c47c[_0x4c1770[_0x7413('0x37')][_0x7413('0x32')]()]=_0x4c1770[_0x7413('0x33')][_0x7413('0x38')]();}else if(_0x4c1770[_0x7413('0x36')]===_0x7413('0x39')&&_0x4c1770[_0x7413('0x3a')]&&_0x4c1770[_0x7413('0x37')]&&_0x4c1770[_0x7413('0x31')]){_0x53c47c[_0x4c1770['idField'][_0x7413('0x32')]()]=_0x5b592c[_0x4c1770[_0x7413('0x3a')]][_0x7413('0x38')]();}else if(_0x4c1770[_0x7413('0x36')]===_0x7413('0x3b')&&_0x4c1770[_0x7413('0x3c')]&&_0x4c1770[_0x7413('0x3c')][_0x7413('0x3d')]&&_0x4c1770[_0x7413('0x37')]&&_0x4c1770[_0x7413('0x31')]){_0x53c47c[_0x4c1770[_0x7413('0x37')]['toLowerCase']()]=_0x5b592c[_0x4c1770[_0x7413('0x3c')]['name'][_0x7413('0x32')]()][_0x7413('0x38')]();}});}return _0x53c47c;}function getTicket(_0xe50a7d,_0xb2d135,_0x479049,_0x148b69,_0x203729,_0x7de9d8){return function(_0xcb1f11){logger[_0x7413('0x14')]('['+[_0xe50a7d['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0xcb1f11);return new Promise(function(_0x3c1f1a,_0x520eb6){var _0x563fa8=_0xe50a7d[_0x7413('0x32')]()===_0x7413('0x3e')?_0xcb1f11['userId']:_0xcb1f11[_0x7413('0x2a')];var _0x586d25={'method':'POST','uri':_0x479049+_0x7413('0x3f')+'?'+_0x7de9d8,'body':Object['assign']({},{'active':_0x7413('0x27'),'caller_id':_0x563fa8,'assigned_to':_0xcb1f11[_0x7413('0x1e')],'short_description':intUtil[_0x7413('0x40')](_0x148b69[_0x7413('0x41')],_0x203729,'\x20'),'description':intUtil[_0x7413('0x40')](_0x148b69[_0x7413('0x42')],_0x203729,'\x0a')},getCustomFields(_0x148b69[_0x7413('0x43')],_0x203729)),'auth':_0xb2d135,'json':!![]};return rp(_0x586d25)[_0x7413('0x10')](function(_0x66795){logger[_0x7413('0x14')]('['+[_0xe50a7d['toUpperCase']()]+_0x7413('0x44'),_0x66795['result']);_0xcb1f11['ticketId']=_0x66795['result'][_0x7413('0x13')];_0xcb1f11[_0x7413('0x45')]=_0x66795[_0x7413('0x1c')][_0x7413('0x46')];logger['info']('['+[_0xe50a7d['toUpperCase']()]+_0x7413('0x47'),_0xcb1f11);_0x3c1f1a(_0xcb1f11);})['catch'](function(_0x33a3e8){logger['error']('['+[_0xe50a7d['toUpperCase']()]+']',_0x33a3e8['message']);_0x520eb6(_0x33a3e8['message']);});});};}function createRemoteTag(_0x53c9d0,_0x6734e4,_0x1533e5,_0x229573){return new Promise(function(_0x2ffec6,_0x606e03){var _0x5a3a60={'method':_0x7413('0x24'),'uri':_0x1533e5+_0x7413('0x48')+'?'+_0x229573,'body':{'short_description':_0x53c9d0,'global':!![],'active':!![],'name':_0x53c9d0},'auth':_0x6734e4,'json':!![]};return rp(_0x5a3a60)[_0x7413('0x10')](function(_0x5a8aa2){var _0x171fcc=_0x5a8aa2['result']['sys_id'];_0x2ffec6(_0x171fcc);});});}function getRemoteTag(_0x206e0a,_0x287c40,_0x1939a8,_0x287365,_0x45d8ad){return new Promise(function(_0x2e0c7e,_0x4f1d58){var _0xe4033c={'method':'GET','uri':_0x1939a8+_0x7413('0x48')+'?sysparm_query=name%3D'+_0x206e0a+'&'+_0x287365,'auth':_0x287c40,'json':!![]};return rp(_0xe4033c)[_0x7413('0x10')](function(_0x4d4faa){if(_0x4d4faa[_0x7413('0x1c')][_0x7413('0x11')]>0x0){var _0x5e6013=_0x4d4faa[_0x7413('0x1c')][0x0]['sys_id'];_0x2e0c7e(_0x5e6013);}else{return createRemoteTag(_0x206e0a,_0x287c40,_0x1939a8,_0x287365)[_0x7413('0x10')](function(_0x2a5db6){_0x2e0c7e(_0x2a5db6);});}});});}function assignTagToIncident(_0x5163ca,_0x3ea2d9,_0x12048c,_0x59d639,_0x3ce34c){return new Promise(function(_0x2bebea,_0x4d181c){var _0xf4641={'method':_0x7413('0x24'),'uri':_0x12048c+_0x7413('0x49')+'?'+_0x3ce34c,'body':{'label':_0x5163ca,'table':_0x7413('0x3f'),'id_type':_0x7413('0x4a'),'table_key':_0x59d639[_0x7413('0x4b')],'title':_0x7413('0x4c')+_0x59d639[_0x7413('0x45')],'id_display':_0x59d639['ticketNumber']},'auth':_0x3ea2d9,'json':!![]};return rp(_0xf4641)[_0x7413('0x10')](function(_0x4ca888){_0x2bebea();})[_0x7413('0x21')](function(){_0x2bebea();});});}function manageTags(_0x37a55c,_0x42f0a6,_0x3e7058,_0x4c8996,_0x5e6b7b,_0x559ce3,_0x56b090){return new Promise(function(_0x5b5e42,_0x3c8316){var _0x1c00e6=[];_0x42f0a6[_0x7413('0x2e')](function(_0x5de03e){_0x1c00e6[_0x7413('0x4d')](getRemoteTag(_0x5de03e,_0x3e7058,_0x4c8996,_0x559ce3,_0x56b090));});return Promise[_0x7413('0x4e')](_0x1c00e6)[_0x7413('0x10')](function(_0x36a3ff){if(_0x36a3ff[_0x7413('0x11')]){logger[_0x7413('0x14')]('['+[_0x37a55c[_0x7413('0x15')]()]+_0x7413('0x4f'),_0x36a3ff);var _0x1ec131=[];_0x36a3ff[_0x7413('0x2e')](function(_0x3f9cfd){_0x1ec131[_0x7413('0x4d')](assignTagToIncident(_0x3f9cfd,_0x3e7058,_0x4c8996,_0x5e6b7b,_0x559ce3));});return Promise[_0x7413('0x4e')](_0x1ec131)['then'](function(){_0x5b5e42();})[_0x7413('0x21')](function(){_0x5b5e42();});}else{_0x5b5e42();}});});}function getTags(_0x405ae4,_0x4cab22,_0x3d4d23,_0x1e76f1,_0x521682,_0x5e4aa1){return function(_0x102fd2){return new Promise(function(_0x2aaa57,_0x59aa6c){var _0x61e533=[];var _0x4563b0=_0x1e76f1['Tags'];if(_0x4563b0&&_0x4563b0[_0x7413('0x11')]>0x0){_0x61e533=_['map'](_0x4563b0,'name');}if(_0x61e533[_0x7413('0x11')]>0x0){return manageTags(_0x405ae4,_0x61e533,_0x4cab22,_0x3d4d23,_0x102fd2,_0x521682,_0x5e4aa1)[_0x7413('0x10')](function(){_0x2aaa57(_0x102fd2);});}else{_0x2aaa57(_0x102fd2);}});};}function emit(_0x167c6b,_0x3d2f93,_0x128419){var _0x10333e=_0x7413('0x50')+_0x7413('0x51')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x7413('0x52');var _0x595da6={'uri':_0x167c6b+_0x7413('0x53')+_0x128419+_0x10333e};io['to'](util[_0x7413('0x54')](_0x7413('0x55'),_0x3d2f93))[_0x7413('0x56')](_0x7413('0x57'),_0x595da6);}exports['cs']=function(_0x29d919,_0x1d4ef5,_0x46983f,_0x2c504e,_0x50910a,_0x5988bd,_0x41875d,_0x53354b){var _0x3ba8a8={};var _0x639d33={'user':_0x5988bd['username'],'pass':_0x5988bd[_0x7413('0x58')]};var _0x4b676a=_0x7413('0x59');var _0x3d4ce3='sysparm_display_value=true';_0x5988bd['remoteUri']=intUtil[_0x7413('0x5a')](_0x5988bd[_0x7413('0x5b')]);_0x5988bd[_0x7413('0x5c')]=intUtil['stripTrailingSlash'](_0x5988bd[_0x7413('0x5c')]);var _0x8563a9=util[_0x7413('0x54')](_0x7413('0x5d'),_0x5988bd[_0x7413('0x5b')]);_0x3ba8a8[_0x7413('0x19')]=!_['isNil'](_0x2c504e)?_0x2c504e[_0x7413('0x5e')]:null;_0x3ba8a8[_0x7413('0x1f')]=_0x5988bd[_0x7413('0x5e')];_0x3ba8a8['endUserNumber']=_0x53354b[_0x7413('0x32')]()===_0x7413('0x3e')?_0x1d4ef5[_0x7413('0x5f')]:_0x1d4ef5[_0x7413('0x60')];_0x3ba8a8[_0x7413('0x61')]=_0x53354b===_0x7413('0x62')||_0x53354b===_0x7413('0x63')?_0x7413('0x62'):_0x7413('0x3e');var _0x5c68de=util[_0x7413('0x54')](_0x7413('0x64'),_0x5988bd[_0x7413('0x5c')],_0x1d4ef5[_0x7413('0x65')],md5(_0x1d4ef5[_0x7413('0x65')]));if(_0x50910a&&_0x50910a[_0x7413('0x66')]){logger['info'](_0x7413('0x67'),'Recording\x20is\x20enabled!');_0x1d4ef5['recordingURL']=_0x5c68de;}else if(_0x41875d&&_0x41875d[_0x7413('0x68')]&&_0x41875d[_0x7413('0x68')]!=='none'){logger[_0x7413('0x14')](_0x7413('0x69'),_0x7413('0x6a'));_0x1d4ef5[_0x7413('0x6b')]=_0x5c68de;}else{_0x1d4ef5[_0x7413('0x6b')]='';}return getAdminUser(_0x53354b,_0x639d33,_0x3ba8a8,_0x8563a9,_0x3d4ce3,_0x4b676a)[_0x7413('0x10')](getUser(_0x53354b,_0x639d33,_0x8563a9,_0x3d4ce3,_0x4b676a))[_0x7413('0x10')](getEndUser(_0x53354b,_0x639d33,_0x8563a9,_0x3d4ce3,_0x4b676a))[_0x7413('0x10')](getTicket(_0x53354b,_0x639d33,_0x8563a9,_0x46983f,_0x1d4ef5,_0x3d4ce3))['then'](function(_0xe4b4a4){logger['info'](util[_0x7413('0x54')](_0x7413('0x6c'),_0xe4b4a4['ticketId']));logger[_0x7413('0x14')](util[_0x7413('0x54')](_0x7413('0x6d'),_0x53354b));if(_0x53354b!==_0x7413('0x63')){logger[_0x7413('0x14')]('['+[_0x53354b[_0x7413('0x15')]()]+']',_0x7413('0x6e'));emit(_0x5988bd[_0x7413('0x5b')],_0x2c504e[_0x7413('0x3d')],_0xe4b4a4[_0x7413('0x4b')]);}})['catch'](function(_0x2a3d1c){logger[_0x7413('0x16')]('['+[_0x53354b['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x2a3d1c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4213=['calleridnum','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/logger','redis','defaults','localhost','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','userId','sys_id','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','includes','picklist','nameField','toLowerCase','content','toString','string','type','idField','customField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Fields','ticketId','ticketNumber','number','label','label_entry','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','adminEmail','email','destcalleridnum'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x4213,0x77));var _0x3421=function(_0x55710a,_0x462a37){_0x55710a=_0x55710a-0x0;var _0x2232c8=_0x4213[_0x55710a];return _0x2232c8;};'use strict';var _=require(_0x3421('0x0'));var Promise=require(_0x3421('0x1'));var rp=require(_0x3421('0x2'));var util=require(_0x3421('0x3'));var md5=require(_0x3421('0x4'));var Redis=require(_0x3421('0x5'));var intUtil=require(_0x3421('0x6'));var config=require('../../../../config/environment');var logger=require(_0x3421('0x7'))('servicenow');config[_0x3421('0x8')]=_[_0x3421('0x9')](config[_0x3421('0x8')],{'host':_0x3421('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3421('0x8')]));function getAdminUser(_0x1b152f,_0x130625,_0x1cf6a0,_0x13b0dd,_0x4ddfce,_0x1f20cf){return new Promise(function(_0x58d511,_0x4ff986){var _0x12eee0={'method':'GET','uri':_0x13b0dd+_0x3421('0xb')+'&'+_0x4ddfce+'&'+_0x1f20cf,'auth':_0x130625,'json':!![]};return rp(_0x12eee0)[_0x3421('0xc')](function(_0x113554){if(_0x113554[_0x3421('0xd')][_0x3421('0xe')]>0x0){_0x1cf6a0[_0x3421('0xf')]=_0x113554[_0x3421('0xd')][0x0]['sys_id'];}logger[_0x3421('0x10')]('['+[_0x1b152f[_0x3421('0x11')]()]+_0x3421('0x12'),_0x1cf6a0);_0x58d511(_0x1cf6a0);})[_0x3421('0x13')](function(_0x3c56f9){logger[_0x3421('0x14')]('['+[_0x1b152f[_0x3421('0x11')]()]+']',_0x3c56f9['message']);_0x4ff986(_0x3c56f9[_0x3421('0x15')]);});});}function getUser(_0x4b5f43,_0x372d21,_0x5257ad,_0x59ae45,_0x1e33ab){return function(_0x4c6f7b){logger[_0x3421('0x10')]('['+[_0x4b5f43[_0x3421('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x4c6f7b);return new Promise(function(_0x3584d6,_0x3dec08){if(intUtil[_0x3421('0x16')](_0x4c6f7b[_0x3421('0x17')])){var _0x18acc1={'method':_0x3421('0x18'),'uri':_0x5257ad+_0x3421('0x19')+_0x4c6f7b[_0x3421('0x17')]+'&'+_0x59ae45+'&'+_0x1e33ab,'auth':_0x372d21,'json':!![]};logger[_0x3421('0x10')]('['+[_0x4b5f43[_0x3421('0x11')]()]+_0x3421('0x1a'),_0x18acc1);return rp(_0x18acc1)['then'](function(_0x420114){logger['info']('['+[_0x4b5f43['toUpperCase']()]+'],\x20getUser\x20entity',_0x420114);if(_0x420114[_0x3421('0xd')][_0x3421('0xe')]>0x0&&String(_0x420114[_0x3421('0xd')][0x0][_0x3421('0x1b')])===_0x3421('0x1c')){_0x4c6f7b[_0x3421('0x1d')]=_0x420114[_0x3421('0xd')][0x0][_0x3421('0x1e')];}else{_0x4c6f7b[_0x3421('0x1d')]=_0x4c6f7b[_0x3421('0xf')];_0x4c6f7b['userEmail']=_0x4c6f7b['adminEmail'];}logger['info']('['+[_0x4b5f43[_0x3421('0x11')]()]+_0x3421('0x1f'),_0x4c6f7b);_0x3584d6(_0x4c6f7b);})[_0x3421('0x13')](function(_0x5bc28a){logger['error']('['+[_0x4b5f43[_0x3421('0x11')]()]+']',_0x5bc28a['message']);_0x3dec08(_0x5bc28a[_0x3421('0x15')]);});}else{logger['info']('['+[_0x4b5f43[_0x3421('0x11')]()]+_0x3421('0x20'));_0x4c6f7b[_0x3421('0x1d')]=_0x4c6f7b[_0x3421('0xf')];_0x4c6f7b[_0x3421('0x17')]=_0x4c6f7b['adminEmail'];_0x3584d6(_0x4c6f7b);}});};}function createEndUser(_0x332017,_0x52fd41,_0x5efe73,_0x17f501,_0x5aa96b){logger['info']('['+[_0x332017[_0x3421('0x11')]()]+'],\x20createEndUser\x20input\x20crm',_0x5efe73);return new Promise(function(_0x20abc7,_0x5bcd19){var _0xc7f9fb={'method':_0x3421('0x21'),'uri':_0x17f501+'sys_user?'+_0x5aa96b,'body':{'user_name':_0x5efe73[_0x3421('0x22')],'roles':_0x3421('0x23'),'first_name':_0x5efe73[_0x3421('0x22')],'active':'true','date_format':_0x3421('0x24'),'phone':_0x5efe73['endUserNumber']},'auth':_0x52fd41,'json':!![]};return rp(_0xc7f9fb)[_0x3421('0xc')](function(_0xf0039){logger[_0x3421('0x10')]('['+[_0x332017[_0x3421('0x11')]()]+_0x3421('0x25'),_0xf0039[_0x3421('0xd')]);_0x5efe73[_0x3421('0x26')]=_0xf0039[_0x3421('0xd')][_0x3421('0x1e')];_0x20abc7(_0x5efe73);})[_0x3421('0x13')](function(_0x4e44b4){logger['error']('['+[_0x332017[_0x3421('0x11')]()]+']',_0x4e44b4[_0x3421('0x15')]);_0x5bcd19(_0x4e44b4['message']);});});}function getEndUser(_0xc22dab,_0x186d64,_0x3dbd29,_0x17292a,_0x287c60){return function(_0x4a33f8){logger[_0x3421('0x10')]('['+[_0xc22dab[_0x3421('0x11')]()]+_0x3421('0x27'),_0x4a33f8);return new Promise(function(_0x5df941,_0xb7a512){var _0x4ba1b9={'method':_0x3421('0x18'),'uri':_0x3dbd29+_0x3421('0x28')+_0x4a33f8[_0x3421('0x22')]+'&'+_0x17292a+'&'+_0x287c60,'auth':_0x186d64,'json':!![]};return rp(_0x4ba1b9)[_0x3421('0xc')](function(_0xe3aa89){if(_0xe3aa89[_0x3421('0xd')][_0x3421('0xe')]>0x0){_0x4a33f8['endUserId']=_0xe3aa89['result'][0x0]['sys_id'];logger[_0x3421('0x10')]('['+[_0xc22dab['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x4a33f8);_0x5df941(_0x4a33f8);}else{return createEndUser(_0xc22dab,_0x186d64,_0x4a33f8,_0x3dbd29,_0x17292a)[_0x3421('0xc')](function(_0x4e76e0){logger[_0x3421('0x10')]('['+[_0xc22dab[_0x3421('0x11')]()]+'],\x20createEndUser\x20crm',_0x4e76e0);_0x5df941(_0x4e76e0);});}})[_0x3421('0x13')](function(_0x3121aa){logger[_0x3421('0x14')]('['+[_0xc22dab[_0x3421('0x11')]()]+']',_0x3121aa['message']);_0xb7a512(_0x3121aa[_0x3421('0x15')]);});});};}function getCustomFields(_0x2745c9,_0x267e0b){var _0x442dad={};if(_0x2745c9[_0x3421('0xe')]>0x0){_['forEach'](_0x2745c9,function(_0x16dd0b){if(_[_0x3421('0x29')](['string',_0x3421('0x2a')],_0x16dd0b['type'])&&_0x16dd0b['nameField']&&!_0x16dd0b['customField']){_0x442dad[_0x16dd0b[_0x3421('0x2b')][_0x3421('0x2c')]()]=_0x16dd0b[_0x3421('0x2d')][_0x3421('0x2e')]();}else if(_[_0x3421('0x29')]([_0x3421('0x2f'),_0x3421('0x2a')],_0x16dd0b[_0x3421('0x30')])&&_0x16dd0b[_0x3421('0x31')]&&_0x16dd0b[_0x3421('0x32')]){_0x442dad[_0x16dd0b[_0x3421('0x31')][_0x3421('0x2c')]()]=_0x16dd0b[_0x3421('0x2d')][_0x3421('0x2e')]();}else if(_0x16dd0b['type']===_0x3421('0x33')&&_0x16dd0b[_0x3421('0x34')]&&_0x16dd0b[_0x3421('0x31')]&&_0x16dd0b[_0x3421('0x32')]){_0x442dad[_0x16dd0b['idField'][_0x3421('0x2c')]()]=_0x267e0b[_0x16dd0b['variableName']][_0x3421('0x2e')]();}else if(_0x16dd0b[_0x3421('0x30')]===_0x3421('0x35')&&_0x16dd0b[_0x3421('0x36')]&&_0x16dd0b[_0x3421('0x36')][_0x3421('0x37')]&&_0x16dd0b[_0x3421('0x31')]&&_0x16dd0b[_0x3421('0x32')]){_0x442dad[_0x16dd0b[_0x3421('0x31')][_0x3421('0x2c')]()]=_0x267e0b[_0x16dd0b[_0x3421('0x36')][_0x3421('0x37')][_0x3421('0x2c')]()]['toString']();}});}return _0x442dad;}function getTicket(_0x33394f,_0x4fe13e,_0x1a029b,_0x1a7661,_0x3e3cca,_0x29044d){return function(_0x1bd142){logger[_0x3421('0x10')]('['+[_0x33394f[_0x3421('0x11')]()]+_0x3421('0x38'),_0x1bd142);return new Promise(function(_0x406ea9,_0x3cd2a3){var _0x4c65b4=_0x33394f[_0x3421('0x2c')]()===_0x3421('0x39')?_0x1bd142[_0x3421('0x1d')]:_0x1bd142['endUserId'];var _0x566f95={'method':_0x3421('0x21'),'uri':_0x1a029b+_0x3421('0x3a')+'?'+_0x29044d,'body':Object[_0x3421('0x3b')]({},{'active':'true','caller_id':_0x4c65b4,'assigned_to':_0x1bd142[_0x3421('0x1d')],'short_description':intUtil[_0x3421('0x3c')](_0x1a7661[_0x3421('0x3d')],_0x3e3cca,'\x20'),'description':intUtil[_0x3421('0x3c')](_0x1a7661['Descriptions'],_0x3e3cca,'\x0a')},getCustomFields(_0x1a7661[_0x3421('0x3e')],_0x3e3cca)),'auth':_0x4fe13e,'json':!![]};return rp(_0x566f95)[_0x3421('0xc')](function(_0x3f7ff3){logger['info']('['+[_0x33394f['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x3f7ff3[_0x3421('0xd')]);_0x1bd142[_0x3421('0x3f')]=_0x3f7ff3['result']['sys_id'];_0x1bd142[_0x3421('0x40')]=_0x3f7ff3[_0x3421('0xd')][_0x3421('0x41')];logger[_0x3421('0x10')]('['+[_0x33394f[_0x3421('0x11')]()]+']\x20getTicket\x20crm',_0x1bd142);_0x406ea9(_0x1bd142);})[_0x3421('0x13')](function(_0x2a81fa){logger[_0x3421('0x14')]('['+[_0x33394f[_0x3421('0x11')]()]+']',_0x2a81fa['message']);_0x3cd2a3(_0x2a81fa[_0x3421('0x15')]);});});};}function createRemoteTag(_0x400a2c,_0x219e1d,_0x48a967,_0x5f97d5){return new Promise(function(_0x5c73ae,_0x598dfa){var _0x11d30f={'method':'POST','uri':_0x48a967+_0x3421('0x42')+'?'+_0x5f97d5,'body':{'short_description':_0x400a2c,'global':!![],'active':!![],'name':_0x400a2c},'auth':_0x219e1d,'json':!![]};return rp(_0x11d30f)[_0x3421('0xc')](function(_0x12bd9a){var _0x4cf96e=_0x12bd9a[_0x3421('0xd')][_0x3421('0x1e')];_0x5c73ae(_0x4cf96e);});});}function getRemoteTag(_0x2dc973,_0x3a398c,_0x1c73b9,_0x4738e7,_0x4e1103){return new Promise(function(_0x21e3d4,_0x337c75){var _0x484c92={'method':_0x3421('0x18'),'uri':_0x1c73b9+_0x3421('0x42')+'?sysparm_query=name%3D'+_0x2dc973+'&'+_0x4738e7,'auth':_0x3a398c,'json':!![]};return rp(_0x484c92)[_0x3421('0xc')](function(_0x11ad76){if(_0x11ad76[_0x3421('0xd')]['length']>0x0){var _0x3204a0=_0x11ad76[_0x3421('0xd')][0x0][_0x3421('0x1e')];_0x21e3d4(_0x3204a0);}else{return createRemoteTag(_0x2dc973,_0x3a398c,_0x1c73b9,_0x4738e7)[_0x3421('0xc')](function(_0x1bca2c){_0x21e3d4(_0x1bca2c);});}});});}function assignTagToIncident(_0x365626,_0x333b86,_0x3254aa,_0x31fd9b,_0x279b44){return new Promise(function(_0x26cda8,_0x19d48c){var _0x5ac16a={'method':_0x3421('0x21'),'uri':_0x3254aa+_0x3421('0x43')+'?'+_0x279b44,'body':{'label':_0x365626,'table':'incident','id_type':_0x3421('0x44'),'table_key':_0x31fd9b[_0x3421('0x3f')],'title':_0x3421('0x45')+_0x31fd9b[_0x3421('0x40')],'id_display':_0x31fd9b[_0x3421('0x40')]},'auth':_0x333b86,'json':!![]};return rp(_0x5ac16a)[_0x3421('0xc')](function(_0x32c9a7){_0x26cda8();})[_0x3421('0x13')](function(){_0x26cda8();});});}function manageTags(_0x5d6488,_0x379673,_0x5dc921,_0x2f14fe,_0xf61917,_0x108b43,_0x897cde){return new Promise(function(_0x526d71,_0x3f86a9){var _0x21e11b=[];_0x379673[_0x3421('0x46')](function(_0xba1f52){_0x21e11b[_0x3421('0x47')](getRemoteTag(_0xba1f52,_0x5dc921,_0x2f14fe,_0x108b43,_0x897cde));});return Promise[_0x3421('0x48')](_0x21e11b)['then'](function(_0x8a35b5){if(_0x8a35b5[_0x3421('0xe')]){logger[_0x3421('0x10')]('['+[_0x5d6488[_0x3421('0x11')]()]+_0x3421('0x49'),_0x8a35b5);var _0x1ba5e1=[];_0x8a35b5[_0x3421('0x46')](function(_0x3d7c9a){_0x1ba5e1['push'](assignTagToIncident(_0x3d7c9a,_0x5dc921,_0x2f14fe,_0xf61917,_0x108b43));});return Promise[_0x3421('0x48')](_0x1ba5e1)[_0x3421('0xc')](function(){_0x526d71();})[_0x3421('0x13')](function(){_0x526d71();});}else{_0x526d71();}});});}function getTags(_0x40ae83,_0x347299,_0x4b6a98,_0x5763c1,_0x44fde6,_0x103d84){return function(_0x230f65){return new Promise(function(_0x50fb9a,_0x3bf5de){var _0x4d6396=[];var _0x18260e=_0x5763c1['Tags'];if(_0x18260e&&_0x18260e['length']>0x0){_0x4d6396=_['map'](_0x18260e,'name');}if(_0x4d6396['length']>0x0){return manageTags(_0x40ae83,_0x4d6396,_0x347299,_0x4b6a98,_0x230f65,_0x44fde6,_0x103d84)[_0x3421('0xc')](function(){_0x50fb9a(_0x230f65);});}else{_0x50fb9a(_0x230f65);}});};}function emit(_0x2039b1,_0x2f64a4,_0x994444){var _0xa05828=_0x3421('0x4a')+_0x3421('0x4b')+_0x3421('0x4c')+_0x3421('0x4d');var _0x464226={'uri':_0x2039b1+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x994444+_0xa05828};io['to'](util[_0x3421('0x4e')]('user:%s',_0x2f64a4))[_0x3421('0x4f')](_0x3421('0x50'),_0x464226);}exports['cs']=function(_0x40e0a6,_0x31fb26,_0x4191a7,_0x1d5f5d,_0x44c47d,_0x46f03f,_0x475c8e,_0x5c74a8){var _0x2fe3b7={};var _0x14516b={'user':_0x46f03f[_0x3421('0x51')],'pass':_0x46f03f['password']};var _0x572e7d='sysparm_limit=1';var _0x5dba56=_0x3421('0x52');_0x46f03f['remoteUri']=intUtil[_0x3421('0x53')](_0x46f03f[_0x3421('0x54')]);_0x46f03f[_0x3421('0x55')]=intUtil[_0x3421('0x53')](_0x46f03f['serverUrl']);var _0x1e64c2=util[_0x3421('0x4e')](_0x3421('0x56'),_0x46f03f[_0x3421('0x54')]);_0x2fe3b7[_0x3421('0x17')]=!_[_0x3421('0x57')](_0x1d5f5d)?_0x1d5f5d['email']:null;_0x2fe3b7[_0x3421('0x58')]=_0x46f03f[_0x3421('0x59')];_0x2fe3b7[_0x3421('0x22')]=_0x5c74a8[_0x3421('0x2c')]()===_0x3421('0x39')?_0x31fb26[_0x3421('0x5a')]:_0x31fb26[_0x3421('0x5b')];_0x2fe3b7['callDirection']=_0x5c74a8==='queue'||_0x5c74a8===_0x3421('0x5c')?_0x3421('0x5d'):_0x3421('0x39');var _0x5d04c6=util[_0x3421('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x46f03f[_0x3421('0x55')],_0x31fb26['uniqueid'],md5(_0x31fb26[_0x3421('0x5e')]));if(_0x44c47d&&_0x44c47d[_0x3421('0x5f')]){logger[_0x3421('0x10')](_0x3421('0x60'),_0x3421('0x61'));_0x31fb26[_0x3421('0x62')]=_0x5d04c6;}else if(_0x475c8e&&_0x475c8e[_0x3421('0x63')]&&_0x475c8e[_0x3421('0x63')]!==_0x3421('0x64')){logger[_0x3421('0x10')](_0x3421('0x65'),_0x3421('0x61'));_0x31fb26['recordingURL']=_0x5d04c6;}else{_0x31fb26[_0x3421('0x62')]='';}return getAdminUser(_0x5c74a8,_0x14516b,_0x2fe3b7,_0x1e64c2,_0x5dba56,_0x572e7d)[_0x3421('0xc')](getUser(_0x5c74a8,_0x14516b,_0x1e64c2,_0x5dba56,_0x572e7d))[_0x3421('0xc')](getEndUser(_0x5c74a8,_0x14516b,_0x1e64c2,_0x5dba56,_0x572e7d))[_0x3421('0xc')](getTicket(_0x5c74a8,_0x14516b,_0x1e64c2,_0x4191a7,_0x31fb26,_0x5dba56))[_0x3421('0xc')](function(_0x35c97d){logger[_0x3421('0x10')](util[_0x3421('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x35c97d[_0x3421('0x3f')]));logger['info'](util['format']('call\x20direction:\x20%s',_0x5c74a8));if(_0x5c74a8!==_0x3421('0x5c')){logger[_0x3421('0x10')]('['+[_0x5c74a8[_0x3421('0x11')]()]+']',_0x3421('0x66'));emit(_0x46f03f['remoteUri'],_0x1d5f5d[_0x3421('0x37')],_0x35c97d[_0x3421('0x3f')]);}})[_0x3421('0x13')](function(_0x1e2abf){logger[_0x3421('0x14')]('['+[_0x5c74a8[_0x3421('0x11')]()]+_0x3421('0x67'),util[_0x3421('0x68')](_0x1e2abf,{'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 cc7d567..e79133b 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 _0x9651=['defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','POST','login','password','xCALLY\x20Motion\x20integration','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','users','trigger:browser:url','error','unmanaged','monitor_format','lastevent','toUpperCase','isNil','calleridname','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis'];(function(_0x32ebe4,_0x55d2e1){var _0xbe603f=function(_0x5dc3bb){while(--_0x5dc3bb){_0x32ebe4['push'](_0x32ebe4['shift']());}};_0xbe603f(++_0x55d2e1);}(_0x9651,0x166));var _0x1965=function(_0x3dce6b,_0x46ddd4){_0x3dce6b=_0x3dce6b-0x0;var _0x400659=_0x9651[_0x3dce6b];return _0x400659;};'use strict';var _=require('lodash');var rp=require(_0x1965('0x0'));var BPromise=require('bluebird');var md5=require(_0x1965('0x1'));var util=require(_0x1965('0x2'));var Redis=require('ioredis');var intUtil=require(_0x1965('0x3'));var config=require(_0x1965('0x4'));var logger=require(_0x1965('0x5'))(_0x1965('0x6'));config[_0x1965('0x7')]=_[_0x1965('0x8')](config['redis'],{'host':_0x1965('0x9'),'port':0x18eb});var io=require(_0x1965('0xa'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x39ef37,_0x32e3b6,_0x1a27ed){io['to'](_0x39ef37)[_0x1965('0xb')](_0x32e3b6,_0x1a27ed);}function getTicket(_0x18e833,_0x517f70,_0x5b0040,_0x5d45e2,_0x90b8c1,_0x35e0e7,_0x1ee31a,_0x3d0792){logger[_0x1965('0xc')](_0x1965('0xd'));var _0x3a27fc=new Date();var _0x5dbe88=[{'name':_0x1965('0xe'),'value':intUtil[_0x1965('0xf')](_0x5d45e2['Subjects'],_0x90b8c1,'\x20')},{'name':_0x1965('0x10'),'value':_0x517f70['id']},{'name':_0x1965('0x11'),'value':_0x517f70['id']},{'name':_0x1965('0x12'),'value':intUtil[_0x1965('0xf')](_0x5d45e2['Descriptions'],_0x90b8c1,'\x0a')},{'name':_0x1965('0x13'),'value':_0x3a27fc[_0x1965('0x14')]()[_0x1965('0x15')](0x0,0x13)[_0x1965('0x16')]('T','\x20')},{'name':_0x1965('0x17'),'value':'0'},{'name':_0x1965('0x18'),'value':'15'},{'name':_0x1965('0x19'),'value':_0x5b0040['id']},{'name':_0x1965('0x1a'),'value':_0x1965('0x1b')},{'name':_0x1965('0x1c'),'value':_0x5b0040[_0x1965('0xe')]},{'name':_0x1965('0x1d'),'value':_0x3d0792}];if(_0x35e0e7[_0x1965('0x1e')]){_[_0x1965('0x1f')](_0x35e0e7,function(_0x3c9a08){if(_0x90b8c1[_0x3c9a08[_0x1965('0x20')]]){_0x5dbe88[_0x1965('0x21')]({'name':_0x3c9a08[_0x1965('0x22')],'value':_0x90b8c1[_0x3c9a08[_0x1965('0x20')]]});}});}return request({'form':{'method':_0x1965('0x23'),'input_type':'JSON','response_type':_0x1965('0x24'),'rest_data':JSON[_0x1965('0x25')]({'session':_0x1ee31a['id'],'module_name':_0x1965('0x26'),'name_value_list':_0x5dbe88})}});}function getAuth(_0x31e0c0){return util[_0x1965('0x27')](_0x1965('0x28'),new Buffer(_0x31e0c0[_0x1965('0x29')]+':X')[_0x1965('0x2a')]('base64'));}function getServerInfo(_0x314d5d){return request({'form':{'method':_0x1965('0x2b'),'input_type':_0x1965('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x314d5d['id']})}});}function getUser(_0x5455fb,_0x5a9a58,_0x3029dc){if(!_['isNil'](_0x5a9a58)){logger[_0x1965('0xc')](_0x1965('0x2c'),_0x5a9a58);return request({'form':{'method':_0x1965('0x2d'),'input_type':_0x1965('0x24'),'response_type':_0x1965('0x24'),'rest_data':JSON[_0x1965('0x25')]({'session':_0x3029dc['id'],'module_name':_0x1965('0x2e'),'query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x5a9a58),'order_by':'','offset':'0','select_fields':['id',_0x1965('0xe'),_0x1965('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1965('0x30')](function(_0x41ff51){if(_0x41ff51[_0x1965('0x31')][_0x1965('0x1e')]){var _0x4eaf92=_[_0x1965('0x32')](_0x41ff51['entry_list'],function(_0x36000c){return _0x36000c['name_value_list']['user_name'][_0x1965('0x33')]===_0x5a9a58;});if(_0x4eaf92){logger['info'](_0x1965('0x34'));return BPromise[_0x1965('0x35')]({'id':_0x4eaf92['name_value_list']['id'][_0x1965('0x33')],'name':_0x4eaf92[_0x1965('0x36')][_0x1965('0xe')]['value']});}}logger[_0x1965('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x3029dc[_0x1965('0x36')][_0x1965('0x37')][_0x1965('0x33')],'name':_0x3029dc[_0x1965('0x36')][_0x1965('0x2f')]['value']});});}else{logger[_0x1965('0xc')](_0x1965('0x38'));return BPromise[_0x1965('0x35')]({'id':_0x3029dc['name_value_list'][_0x1965('0x37')][_0x1965('0x33')],'name':_0x3029dc[_0x1965('0x36')][_0x1965('0x2f')][_0x1965('0x33')]});}}function getEndUser(_0x4cf04b,_0x3de80e,_0x154ef2,_0x59ec3a){logger[_0x1965('0xc')](_0x1965('0x39'),_0x154ef2);return request({'form':{'method':_0x1965('0x2d'),'input_type':_0x1965('0x24'),'response_type':_0x1965('0x24'),'rest_data':JSON[_0x1965('0x25')]({'session':_0x59ec3a['id'],'module_name':_0x1965('0x1b'),'query':util[_0x1965('0x27')](_0x1965('0x3a'),_0x154ef2),'order_by':'','offset':'0','select_fields':['id',_0x1965('0xe'),_0x1965('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1965('0x30')](function(_0x29bbde){if(_0x29bbde['entry_list'][_0x1965('0x1e')]){var _0x130000=_[_0x1965('0x32')](_0x29bbde[_0x1965('0x31')],function(_0x306925){return _0x306925['name_value_list'][_0x1965('0x3b')]['value']===_0x154ef2;});if(_0x130000){logger[_0x1965('0xc')](_0x1965('0x3c'));return BPromise[_0x1965('0x35')]({'id':_0x130000[_0x1965('0x36')]['id'][_0x1965('0x33')],'name':_0x130000[_0x1965('0x36')][_0x1965('0xe')][_0x1965('0x33')],'phone':_0x130000[_0x1965('0x36')][_0x1965('0x3b')]['value']});}}else{logger[_0x1965('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x1965('0x24'),'response_type':_0x1965('0x24'),'rest_data':JSON[_0x1965('0x25')]({'session':_0x59ec3a['id'],'module_name':_0x1965('0x1b'),'name_value_list':[{'name':_0x1965('0x3d'),'value':_0x3de80e!==_0x1965('0x3e')?_0x3de80e:util[_0x1965('0x27')](_0x1965('0x3f'),_0x154ef2)},{'name':'phone_home','value':_0x154ef2}]})}})[_0x1965('0x30')](function(_0x5390c0){logger[_0x1965('0xc')]('Enduser\x20created.');return BPromise[_0x1965('0x35')]({'id':_0x5390c0['id'],'name':_0x5390c0['entry_list'][_0x1965('0x3d')][_0x1965('0x33')],'phone':_0x5390c0['entry_list']['phone_home'][_0x1965('0x33')]});});}});}function request(_0x551fe7){logger[_0x1965('0x40')](_0x1965('0x41'),JSON['stringify'](_0x551fe7));return rp(_[_0x1965('0x42')](def,_0x551fe7));}function getTags(_0x21de65,_0x483b91){var _0x27e92b=[];if(_0x21de65&&_0x21de65[_0x1965('0x1e')]>0x0){_0x27e92b=_[_0x1965('0x43')](_0x21de65,_0x483b91);}return _0x27e92b;}function getCustomFields(_0x5c7c14,_0x3164ef){var _0x568be2=[];var _0x544658={'custom_fields':[]};if(_0x5c7c14[_0x1965('0x1e')]>0x0){_['forEach'](_0x5c7c14,function(_0x2a8d36){if(_0x2a8d36[_0x1965('0x44')]===_0x1965('0x45')&&_0x2a8d36[_0x1965('0x46')]&&!_0x2a8d36[_0x1965('0x47')]){_0x544658[_0x2a8d36[_0x1965('0x46')][_0x1965('0x48')]()]=_0x2a8d36[_0x1965('0x49')][_0x1965('0x2a')]();}else if(_0x2a8d36[_0x1965('0x44')]===_0x1965('0x45')&&_0x2a8d36['idField']&&_0x2a8d36[_0x1965('0x47')]){_0x544658[_0x1965('0x4a')][_0x1965('0x21')]({'id':_0x2a8d36[_0x1965('0x22')],'value':_0x2a8d36['content'][_0x1965('0x2a')]()});}else if(_0x2a8d36[_0x1965('0x44')]===_0x1965('0x4b')&&_0x2a8d36[_0x1965('0x20')]&&_0x2a8d36[_0x1965('0x22')]&&_0x2a8d36[_0x1965('0x47')]){_0x3164ef[_0x2a8d36['variableName']]&&_0x544658[_0x1965('0x4a')][_0x1965('0x21')]({'id':_0x2a8d36[_0x1965('0x22')],'value':_0x3164ef[_0x2a8d36[_0x1965('0x20')]][_0x1965('0x2a')]()});}else if(_0x2a8d36[_0x1965('0x44')]===_0x1965('0x4c')&&_0x2a8d36[_0x1965('0x4d')]&&_0x2a8d36['Variable'][_0x1965('0xe')]&&_0x2a8d36[_0x1965('0x22')]&&_0x2a8d36[_0x1965('0x47')]){_0x3164ef[_0x2a8d36['Variable'][_0x1965('0xe')][_0x1965('0x48')]()]&&_0x544658[_0x1965('0x4a')]['push']({'id':_0x2a8d36[_0x1965('0x22')],'value':_0x3164ef[_0x2a8d36[_0x1965('0x4d')]['name'][_0x1965('0x48')]()][_0x1965('0x2a')]()});}});}return _0x544658;}function getConnection(_0x4d0065){return request({'method':_0x1965('0x4e'),'form':{'method':_0x1965('0x4f'),'input_type':'JSON','response_type':_0x1965('0x24'),'rest_data':JSON[_0x1965('0x25')]({'user_auth':{'user_name':_0x4d0065['username'],'password':_0x4d0065[_0x1965('0x50')],'encryption':'PLAIN'},'application':_0x1965('0x51')})}})[_0x1965('0x30')](function(_0x7f7beb){var _0x368337=_0x7f7beb;if(_0x368337['id']){def['sessionID']=_0x368337['id'];return BPromise[_0x1965('0x35')](_0x368337);}else{throw new Error(util[_0x1965('0x27')]('Account\x20%d\x20is\x20not\x20valid',_0x4d0065['id']));}});}function setRelationship(_0x1b3860,_0x167b3e,_0x14bc60,_0x13b50d){return request({'form':{'method':'set_relationship','input_type':_0x1965('0x24'),'response_type':_0x1965('0x24'),'rest_data':JSON['stringify']({'session':_0x1b3860['id'],'module_name':_0x1965('0x26'),'module_id':_0x14bc60['id'],'link_field_name':_0x13b50d,'related_ids':[_0x167b3e['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x1965('0x52')]=function(_0x53ed65,_0x2f08c8,_0x249ff0,_0x42fa4b,_0x4c1d28,_0x34138b){var _0x76d3b3,_0x846412,_0x4428c0,_0x4feaaf;_0x34138b[_0x1965('0x53')]=intUtil['stripTrailingSlash'](_0x34138b[_0x1965('0x53')]);_0x34138b[_0x1965('0x54')]=intUtil[_0x1965('0x55')](_0x34138b[_0x1965('0x54')]);def[_0x1965('0x56')]=util[_0x1965('0x27')](_0x1965('0x57'),_0x34138b['remoteUri']);if(_0x4c1d28&&_0x4c1d28['monitor_format']){logger['info'](_0x1965('0x58'),_0x1965('0x59'));_0x2f08c8[_0x1965('0x5a')]=util[_0x1965('0x27')](_0x1965('0x5b'),_0x34138b[_0x1965('0x54')],_0x2f08c8[_0x1965('0x5c')],md5(_0x2f08c8['uniqueid']));}else{_0x2f08c8[_0x1965('0x5a')]='';}return getConnection(_0x34138b)[_0x1965('0x30')](function(_0x58d86f){_0x4feaaf=_0x58d86f;return getUser(_0x34138b,_0x42fa4b[_0x1965('0xe')],_0x4feaaf);})[_0x1965('0x30')](function(_0x465c30){_0x76d3b3=_0x465c30;logger[_0x1965('0xc')]('The\x20User\x20ID\x20is:',_0x76d3b3['id']);return getEndUser(_0x34138b,_0x2f08c8['calleridname'],_0x2f08c8[_0x1965('0x5d')],_0x4feaaf);})['then'](function(_0x41ee64){_0x846412=_0x41ee64;logger[_0x1965('0xc')](_0x1965('0x5e'),_0x846412['id']);return getTicket(_0x34138b,_0x76d3b3,_0x846412,_0x249ff0,_0x2f08c8,_0x249ff0[_0x1965('0x5f')],_0x4feaaf,_0x1965('0x60'));})[_0x1965('0x30')](function(_0x3b7d50){_0x4428c0=_0x3b7d50;logger[_0x1965('0xc')](_0x1965('0x61'));logger['info'](_0x1965('0x62'),_0x4428c0['id']);return setRelationship(_0x4feaaf,_0x76d3b3,_0x4428c0,'users');})[_0x1965('0x30')](function(){return setRelationship(_0x4feaaf,_0x846412,_0x4428c0,_0x1965('0x63'));})[_0x1965('0x30')](function(){return getServerInfo(_0x4feaaf);})['then'](function(_0x37a86f){var _0xa9b880=parseInt(_0x37a86f[_0x1965('0x64')][_0x1965('0x65')](0x0));var _0x196134=util['format'](_0x1965('0x66'),_0x34138b[_0x1965('0x53')],_0x4428c0['id']);if(_0xa9b880>0x6){_0x196134=util[_0x1965('0x27')](_0x1965('0x67'),_0x34138b[_0x1965('0x53')],_0x4428c0['id']);}logger[_0x1965('0xc')](_0x1965('0x58'),_0x1965('0x68'));emit(util[_0x1965('0x27')](_0x1965('0x69'),_0x42fa4b['name']),'trigger:browser:url',{'uri':_0x196134});})[_0x1965('0x6a')](function(_0x4bba1b){logger['error']('[QUEUE]',JSON[_0x1965('0x25')](_0x4bba1b));});};exports[_0x1965('0x6b')]=function(_0x1e9c7a,_0x4540ed,_0x593143,_0x5aeebd,_0x32c2b0,_0x1c5559,_0x3b3a19){var _0x6dbaef,_0x27c9e9,_0xe801b1,_0x3263f8;_0x1c5559['remoteUri']=intUtil[_0x1965('0x55')](_0x1c5559[_0x1965('0x53')]);_0x1c5559[_0x1965('0x54')]=intUtil['stripTrailingSlash'](_0x1c5559[_0x1965('0x54')]);def[_0x1965('0x56')]=util[_0x1965('0x27')](_0x1965('0x57'),_0x1c5559[_0x1965('0x53')]);if(_0x3b3a19&&_0x3b3a19[_0x1965('0x6c')]&&_0x3b3a19[_0x1965('0x6c')]!=='none'){logger[_0x1965('0xc')](_0x1965('0x6d'),'Recording\x20is\x20enabled!');_0x4540ed[_0x1965('0x5a')]=util[_0x1965('0x27')](_0x1965('0x5b'),_0x1c5559['serverUrl'],_0x4540ed[_0x1965('0x5c')],md5(_0x4540ed['uniqueid']));}return getConnection(_0x1c5559)[_0x1965('0x30')](function(_0x5f2a02){_0x3263f8=_0x5f2a02;return getUser(_0x1c5559,_0x5aeebd[_0x1965('0xe')],_0x3263f8);})['then'](function(_0x562800){_0x6dbaef=_0x562800;logger[_0x1965('0xc')](_0x1965('0x6e'),_0x6dbaef['id']);return getEndUser(_0x1c5559,_0x4540ed[_0x1965('0x6f')],_0x4540ed[_0x1965('0x70')],_0x3263f8);})['then'](function(_0x152b8d){_0x27c9e9=_0x152b8d;logger[_0x1965('0xc')](_0x1965('0x5e'),_0x27c9e9['id']);return getTicket(_0x1c5559,_0x6dbaef,_0x27c9e9,_0x593143,_0x4540ed,_0x593143[_0x1965('0x5f')],_0x3263f8,'Outbound');})[_0x1965('0x30')](function(_0x5e4a51){_0xe801b1=_0x5e4a51;logger['info']('Ticket\x20created!');logger[_0x1965('0xc')]('The\x20Ticket\x20ID\x20is:',_0xe801b1['id']);return setRelationship(_0x3263f8,_0x6dbaef,_0xe801b1,_0x1965('0x71'));})[_0x1965('0x30')](function(){return setRelationship(_0x3263f8,_0x27c9e9,_0xe801b1,_0x1965('0x63'));})[_0x1965('0x30')](function(){return getServerInfo(_0x3263f8);})['then'](function(_0x56ab31){var _0x24544c=parseInt(_0x56ab31['version'][_0x1965('0x65')](0x0));var _0x3ef436=util[_0x1965('0x27')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1c5559[_0x1965('0x53')],_0xe801b1['id']);if(_0x24544c>0x6){_0x3ef436=util[_0x1965('0x27')](_0x1965('0x67'),_0x1c5559[_0x1965('0x53')],_0xe801b1['id']);}logger[_0x1965('0xc')]('[OUTBOUND]',_0x1965('0x68'));emit(util[_0x1965('0x27')](_0x1965('0x69'),_0x5aeebd[_0x1965('0xe')]),_0x1965('0x72'),{'uri':_0x3ef436});})[_0x1965('0x6a')](function(_0x586fcc){logger[_0x1965('0x73')](_0x1965('0x6d'),JSON[_0x1965('0x25')](_0x586fcc));});};exports[_0x1965('0x74')]=function(_0x2ef3f2,_0x28934c,_0x51e5ce,_0x4b4d99,_0x1cd302,_0x2d3168){var _0x25bec8,_0x4529f8,_0x174ea4,_0x5f17a1;_0x2d3168[_0x1965('0x53')]=intUtil[_0x1965('0x55')](_0x2d3168[_0x1965('0x53')]);_0x2d3168['serverUrl']=intUtil[_0x1965('0x55')](_0x2d3168[_0x1965('0x54')]);def[_0x1965('0x56')]=util[_0x1965('0x27')]('%s/service/v4_1/rest.php',_0x2d3168[_0x1965('0x53')]);if(_0x1cd302&&_0x1cd302[_0x1965('0x75')]){logger[_0x1965('0xc')]('['+_0x28934c[_0x1965('0x76')][_0x1965('0x77')]()+']',_0x1965('0x59'));_0x28934c[_0x1965('0x5a')]=util[_0x1965('0x27')](_0x1965('0x5b'),_0x2d3168[_0x1965('0x54')],_0x28934c['uniqueid'],md5(_0x28934c[_0x1965('0x5c')]));}else{_0x28934c[_0x1965('0x5a')]='';}return getConnection(_0x2d3168)['then'](function(_0xf5dc1){_0x5f17a1=_0xf5dc1;if(!_[_0x1965('0x78')](_0x4b4d99)){return getUser(_0x2d3168,_0x4b4d99[_0x1965('0xe')],_0x5f17a1);}else{return getUser(_0x2d3168,null,_0x5f17a1);}})[_0x1965('0x30')](function(_0x59fffb){_0x25bec8=_0x59fffb;logger[_0x1965('0xc')](_0x1965('0x6e'),_0x25bec8['id']);return getEndUser(_0x2d3168,_0x28934c[_0x1965('0x79')],_0x28934c['calleridnum'],_0x5f17a1);})[_0x1965('0x30')](function(_0x2f4126){_0x4529f8=_0x2f4126;logger[_0x1965('0xc')](_0x1965('0x5e'),_0x4529f8['id']);return getTicket(_0x2d3168,_0x25bec8,_0x4529f8,_0x51e5ce,_0x28934c,_0x51e5ce[_0x1965('0x5f')],_0x5f17a1,_0x1965('0x60'));})[_0x1965('0x30')](function(_0x1c402e){_0x174ea4=_0x1c402e;logger[_0x1965('0xc')]('Ticket\x20created!');logger[_0x1965('0xc')](_0x1965('0x62'),_0x174ea4['id']);return setRelationship(_0x5f17a1,_0x25bec8,_0x174ea4,_0x1965('0x71'));})[_0x1965('0x30')](function(){return setRelationship(_0x5f17a1,_0x4529f8,_0x174ea4,_0x1965('0x63'));})['then'](function(){return getServerInfo(_0x5f17a1);})[_0x1965('0x6a')](function(_0x5e407e){logger[_0x1965('0x73')]('['+_0x28934c['lastevent']['toUpperCase']()+']',JSON[_0x1965('0x25')](_0x5e407e));});}; \ No newline at end of file +var _0x2813=['emit','info','getString','description','Descriptions','toISOString','slice','replace','duration_hours','parent_type','Contacts','parent_name','name','length','push','idField','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','forEach','type','nameField','customField','content','string','custom_fields','variable','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','contacts','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','unmanaged','lastevent','isNil','calleridnum','request-promise','bluebird','md5','ioredis','./util','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0x2813,0x6e));var _0x3281=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2813[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0x3281('0x0'));var BPromise=require(_0x3281('0x1'));var md5=require(_0x3281('0x2'));var util=require('util');var Redis=require(_0x3281('0x3'));var intUtil=require(_0x3281('0x4'));var config=require('../../../../config/environment');var logger=require(_0x3281('0x5'))(_0x3281('0x6'));config[_0x3281('0x7')]=_['defaults'](config[_0x3281('0x7')],{'host':_0x3281('0x8'),'port':0x18eb});var io=require(_0x3281('0x9'))(new Redis(config[_0x3281('0x7')]));var def={'method':_0x3281('0xa'),'json':!![]};function emit(_0x5d594b,_0xdb7a3,_0x1859a1){io['to'](_0x5d594b)[_0x3281('0xb')](_0xdb7a3,_0x1859a1);}function getTicket(_0x33fbf7,_0x538d01,_0x5e1ffe,_0x10fb59,_0x3f5d1a,_0x5bb4af,_0x5d7fb3,_0x4e535a){logger[_0x3281('0xc')]('Creating\x20new\x20ticket...');var _0x5e2257=new Date();var _0x6543a6=[{'name':'name','value':intUtil[_0x3281('0xd')](_0x10fb59['Subjects'],_0x3f5d1a,'\x20')},{'name':'assigned_user_id','value':_0x538d01['id']},{'name':'created_by','value':_0x538d01['id']},{'name':_0x3281('0xe'),'value':intUtil['getString'](_0x10fb59[_0x3281('0xf')],_0x3f5d1a,'\x0a')},{'name':'date_start','value':_0x5e2257[_0x3281('0x10')]()[_0x3281('0x11')](0x0,0x13)[_0x3281('0x12')]('T','\x20')},{'name':_0x3281('0x13'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x5e1ffe['id']},{'name':_0x3281('0x14'),'value':_0x3281('0x15')},{'name':_0x3281('0x16'),'value':_0x5e1ffe[_0x3281('0x17')]},{'name':'direction','value':_0x4e535a}];if(_0x5bb4af[_0x3281('0x18')]){_['forEach'](_0x5bb4af,function(_0xb977f4){if(_0x3f5d1a[_0xb977f4['variableName']]){_0x6543a6[_0x3281('0x19')]({'name':_0xb977f4[_0x3281('0x1a')],'value':_0x3f5d1a[_0xb977f4[_0x3281('0x1b')]]});}});}return request({'form':{'method':_0x3281('0x1c'),'input_type':_0x3281('0x1d'),'response_type':_0x3281('0x1d'),'rest_data':JSON[_0x3281('0x1e')]({'session':_0x5d7fb3['id'],'module_name':_0x3281('0x1f'),'name_value_list':_0x6543a6})}});}function getAuth(_0x264c7c){return util[_0x3281('0x20')](_0x3281('0x21'),new Buffer(_0x264c7c[_0x3281('0x22')]+':X')[_0x3281('0x23')](_0x3281('0x24')));}function getServerInfo(_0x4f2866){return request({'form':{'method':_0x3281('0x25'),'input_type':_0x3281('0x1d'),'response_type':_0x3281('0x1d'),'rest_data':JSON[_0x3281('0x1e')]({'session':_0x4f2866['id']})}});}function getUser(_0x31143b,_0x1008c2,_0xb1026c){if(!_['isNil'](_0x1008c2)){logger[_0x3281('0xc')](_0x3281('0x26'),_0x1008c2);return request({'form':{'method':_0x3281('0x27'),'input_type':_0x3281('0x1d'),'response_type':'JSON','rest_data':JSON[_0x3281('0x1e')]({'session':_0xb1026c['id'],'module_name':_0x3281('0x28'),'query':util[_0x3281('0x20')](_0x3281('0x29'),_0x1008c2),'order_by':'','offset':'0','select_fields':['id',_0x3281('0x17'),_0x3281('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3281('0x2b')](function(_0x55383f){if(_0x55383f[_0x3281('0x2c')][_0x3281('0x18')]){var _0x480721=_[_0x3281('0x2d')](_0x55383f[_0x3281('0x2c')],function(_0x206542){return _0x206542[_0x3281('0x2e')][_0x3281('0x2a')]['value']===_0x1008c2;});if(_0x480721){logger['info'](_0x3281('0x2f'));return BPromise[_0x3281('0x30')]({'id':_0x480721[_0x3281('0x2e')]['id'][_0x3281('0x31')],'name':_0x480721[_0x3281('0x2e')]['name']['value']});}}logger[_0x3281('0xc')](_0x3281('0x32'));return BPromise[_0x3281('0x30')]({'id':_0xb1026c[_0x3281('0x2e')]['user_id'][_0x3281('0x31')],'name':_0xb1026c[_0x3281('0x2e')][_0x3281('0x2a')]['value']});});}else{logger[_0x3281('0xc')](_0x3281('0x33'));return BPromise[_0x3281('0x30')]({'id':_0xb1026c['name_value_list'][_0x3281('0x34')][_0x3281('0x31')],'name':_0xb1026c[_0x3281('0x2e')]['user_name'][_0x3281('0x31')]});}}function getEndUser(_0x2ec386,_0xa2d72d,_0x2dc953,_0x161b2a){logger[_0x3281('0xc')](_0x3281('0x35'),_0x2dc953);return request({'form':{'method':_0x3281('0x27'),'input_type':_0x3281('0x1d'),'response_type':_0x3281('0x1d'),'rest_data':JSON[_0x3281('0x1e')]({'session':_0x161b2a['id'],'module_name':_0x3281('0x15'),'query':util[_0x3281('0x20')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x2dc953),'order_by':'','offset':'0','select_fields':['id',_0x3281('0x17'),_0x3281('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3281('0x2b')](function(_0x19122a){if(_0x19122a[_0x3281('0x2c')]['length']){var _0x5961bf=_[_0x3281('0x2d')](_0x19122a['entry_list'],function(_0x5ca628){return _0x5ca628[_0x3281('0x2e')][_0x3281('0x36')]['value']===_0x2dc953;});if(_0x5961bf){logger[_0x3281('0xc')](_0x3281('0x37'));return BPromise[_0x3281('0x30')]({'id':_0x5961bf[_0x3281('0x2e')]['id'][_0x3281('0x31')],'name':_0x5961bf[_0x3281('0x2e')][_0x3281('0x17')][_0x3281('0x31')],'phone':_0x5961bf['name_value_list'][_0x3281('0x36')][_0x3281('0x31')]});}}else{logger[_0x3281('0xc')](_0x3281('0x38'));return request({'form':{'method':'set_entry','input_type':_0x3281('0x1d'),'response_type':_0x3281('0x1d'),'rest_data':JSON['stringify']({'session':_0x161b2a['id'],'module_name':'Contacts','name_value_list':[{'name':_0x3281('0x39'),'value':_0xa2d72d!==''?_0xa2d72d:util['format'](_0x3281('0x3a'),_0x2dc953)},{'name':'phone_home','value':_0x2dc953}]})}})['then'](function(_0x46477a){logger[_0x3281('0xc')](_0x3281('0x3b'));return BPromise[_0x3281('0x30')]({'id':_0x46477a['id'],'name':_0x46477a[_0x3281('0x2c')][_0x3281('0x39')][_0x3281('0x31')],'phone':_0x46477a[_0x3281('0x2c')][_0x3281('0x36')]['value']});});}});}function request(_0x26ca21){logger['debug'](_0x3281('0x3c'),JSON[_0x3281('0x1e')](_0x26ca21));return rp(_[_0x3281('0x3d')](def,_0x26ca21));}function getTags(_0xbf1ac4,_0x3ca24b){var _0xab69e9=[];if(_0xbf1ac4&&_0xbf1ac4[_0x3281('0x18')]>0x0){_0xab69e9=_[_0x3281('0x3e')](_0xbf1ac4,_0x3ca24b);}return _0xab69e9;}function getCustomFields(_0x1f1455,_0x1c7bd2){var _0x1a16c9=[];var _0x4a5770={'custom_fields':[]};if(_0x1f1455[_0x3281('0x18')]>0x0){_[_0x3281('0x3f')](_0x1f1455,function(_0x1f1802){if(_0x1f1802[_0x3281('0x40')]==='string'&&_0x1f1802[_0x3281('0x41')]&&!_0x1f1802[_0x3281('0x42')]){_0x4a5770[_0x1f1802[_0x3281('0x41')]['toLowerCase']()]=_0x1f1802[_0x3281('0x43')][_0x3281('0x23')]();}else if(_0x1f1802['type']===_0x3281('0x44')&&_0x1f1802['idField']&&_0x1f1802[_0x3281('0x42')]){_0x4a5770[_0x3281('0x45')]['push']({'id':_0x1f1802[_0x3281('0x1a')],'value':_0x1f1802[_0x3281('0x43')][_0x3281('0x23')]()});}else if(_0x1f1802[_0x3281('0x40')]===_0x3281('0x46')&&_0x1f1802[_0x3281('0x1b')]&&_0x1f1802[_0x3281('0x1a')]&&_0x1f1802[_0x3281('0x42')]){_0x1c7bd2[_0x1f1802['variableName']]&&_0x4a5770['custom_fields'][_0x3281('0x19')]({'id':_0x1f1802[_0x3281('0x1a')],'value':_0x1c7bd2[_0x1f1802[_0x3281('0x1b')]][_0x3281('0x23')]()});}else if(_0x1f1802[_0x3281('0x40')]===_0x3281('0x47')&&_0x1f1802[_0x3281('0x48')]&&_0x1f1802[_0x3281('0x48')][_0x3281('0x17')]&&_0x1f1802[_0x3281('0x1a')]&&_0x1f1802[_0x3281('0x42')]){_0x1c7bd2[_0x1f1802[_0x3281('0x48')][_0x3281('0x17')][_0x3281('0x49')]()]&&_0x4a5770['custom_fields']['push']({'id':_0x1f1802[_0x3281('0x1a')],'value':_0x1c7bd2[_0x1f1802[_0x3281('0x48')]['name'][_0x3281('0x49')]()][_0x3281('0x23')]()});}});}return _0x4a5770;}function getConnection(_0x524fe8){return request({'method':'POST','form':{'method':_0x3281('0x4a'),'input_type':_0x3281('0x1d'),'response_type':_0x3281('0x1d'),'rest_data':JSON[_0x3281('0x1e')]({'user_auth':{'user_name':_0x524fe8[_0x3281('0x4b')],'password':_0x524fe8[_0x3281('0x4c')],'encryption':_0x3281('0x4d')},'application':_0x3281('0x4e')})}})[_0x3281('0x2b')](function(_0x2234c3){var _0x922d56=_0x2234c3;if(_0x922d56['id']){def[_0x3281('0x4f')]=_0x922d56['id'];return BPromise[_0x3281('0x30')](_0x922d56);}else{throw new Error(util[_0x3281('0x20')](_0x3281('0x50'),_0x524fe8['id']));}});}function setRelationship(_0x5c7cc7,_0x1b96f8,_0x429972,_0x479a74){return request({'form':{'method':_0x3281('0x51'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5c7cc7['id'],'module_name':_0x3281('0x1f'),'module_id':_0x429972['id'],'link_field_name':_0x479a74,'related_ids':[_0x1b96f8['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x3281('0x52')]=function(_0x472707,_0x592931,_0x5d036c,_0x477219,_0x5b0e41,_0x244b8f){var _0x37604a,_0x49113b,_0x3f3f89,_0x6e77d5;_0x244b8f[_0x3281('0x53')]=intUtil[_0x3281('0x54')](_0x244b8f[_0x3281('0x53')]);_0x244b8f[_0x3281('0x55')]=intUtil['stripTrailingSlash'](_0x244b8f['serverUrl']);def[_0x3281('0x56')]=util[_0x3281('0x20')]('%s/service/v4_1/rest.php',_0x244b8f[_0x3281('0x53')]);if(_0x5b0e41&&_0x5b0e41[_0x3281('0x57')]){logger[_0x3281('0xc')]('[QUEUE]',_0x3281('0x58'));_0x592931[_0x3281('0x59')]=util['format'](_0x3281('0x5a'),_0x244b8f[_0x3281('0x55')],_0x592931[_0x3281('0x5b')],md5(_0x592931[_0x3281('0x5b')]));}else{_0x592931[_0x3281('0x59')]='';}return getConnection(_0x244b8f)['then'](function(_0x3d35a5){_0x6e77d5=_0x3d35a5;return getUser(_0x244b8f,_0x477219[_0x3281('0x17')],_0x6e77d5);})[_0x3281('0x2b')](function(_0x1fe2b6){_0x37604a=_0x1fe2b6;logger[_0x3281('0xc')](_0x3281('0x5c'),_0x37604a['id']);return getEndUser(_0x244b8f,_0x592931[_0x3281('0x5d')],_0x592931['calleridnum'],_0x6e77d5);})[_0x3281('0x2b')](function(_0x57ad0b){_0x49113b=_0x57ad0b;logger['info'](_0x3281('0x5e'),_0x49113b['id']);return getTicket(_0x244b8f,_0x37604a,_0x49113b,_0x5d036c,_0x592931,_0x5d036c[_0x3281('0x5f')],_0x6e77d5,_0x3281('0x60'));})[_0x3281('0x2b')](function(_0x33c86b){_0x3f3f89=_0x33c86b;logger[_0x3281('0xc')](_0x3281('0x61'));logger['info'](_0x3281('0x62'),_0x3f3f89['id']);return setRelationship(_0x6e77d5,_0x37604a,_0x3f3f89,_0x3281('0x63'));})[_0x3281('0x2b')](function(){return setRelationship(_0x6e77d5,_0x49113b,_0x3f3f89,'contacts');})['then'](function(){return getServerInfo(_0x6e77d5);})[_0x3281('0x2b')](function(_0x201e9f){var _0x9c7e0=parseInt(_0x201e9f[_0x3281('0x64')]['charAt'](0x0));var _0x23032f=util[_0x3281('0x20')](_0x3281('0x65'),_0x244b8f[_0x3281('0x53')],_0x3f3f89['id']);if(_0x9c7e0>0x6){_0x23032f=util[_0x3281('0x20')](_0x3281('0x66'),_0x244b8f[_0x3281('0x53')],_0x3f3f89['id']);}logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3281('0x20')](_0x3281('0x67'),_0x477219[_0x3281('0x17')]),'trigger:browser:url',{'uri':_0x23032f});})[_0x3281('0x68')](function(_0x78e0de){logger['error']('[QUEUE]',JSON[_0x3281('0x1e')](_0x78e0de));});};exports[_0x3281('0x69')]=function(_0x19f750,_0x587630,_0x34c6d9,_0x36f6b1,_0x3e08d8,_0x1a6b14,_0x943792){var _0x267997,_0x41e081,_0x150524,_0x3d8e97;_0x1a6b14['remoteUri']=intUtil[_0x3281('0x54')](_0x1a6b14[_0x3281('0x53')]);_0x1a6b14[_0x3281('0x55')]=intUtil[_0x3281('0x54')](_0x1a6b14[_0x3281('0x55')]);def[_0x3281('0x56')]=util[_0x3281('0x20')](_0x3281('0x6a'),_0x1a6b14['remoteUri']);if(_0x943792&&_0x943792[_0x3281('0x6b')]&&_0x943792['recordingFormat']!==_0x3281('0x6c')){logger[_0x3281('0xc')](_0x3281('0x6d'),'Recording\x20is\x20enabled!');_0x587630[_0x3281('0x59')]=util[_0x3281('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1a6b14[_0x3281('0x55')],_0x587630['uniqueid'],md5(_0x587630[_0x3281('0x5b')]));}return getConnection(_0x1a6b14)[_0x3281('0x2b')](function(_0x52b4b1){_0x3d8e97=_0x52b4b1;return getUser(_0x1a6b14,_0x36f6b1[_0x3281('0x17')],_0x3d8e97);})[_0x3281('0x2b')](function(_0x203623){_0x267997=_0x203623;logger[_0x3281('0xc')](_0x3281('0x5c'),_0x267997['id']);return getEndUser(_0x1a6b14,_0x587630[_0x3281('0x6e')],_0x587630[_0x3281('0x6f')],_0x3d8e97);})[_0x3281('0x2b')](function(_0xc24b1e){_0x41e081=_0xc24b1e;logger[_0x3281('0xc')](_0x3281('0x5e'),_0x41e081['id']);return getTicket(_0x1a6b14,_0x267997,_0x41e081,_0x34c6d9,_0x587630,_0x34c6d9[_0x3281('0x5f')],_0x3d8e97,'Outbound');})[_0x3281('0x2b')](function(_0x184ffa){_0x150524=_0x184ffa;logger['info'](_0x3281('0x61'));logger[_0x3281('0xc')](_0x3281('0x62'),_0x150524['id']);return setRelationship(_0x3d8e97,_0x267997,_0x150524,_0x3281('0x63'));})[_0x3281('0x2b')](function(){return setRelationship(_0x3d8e97,_0x41e081,_0x150524,_0x3281('0x70'));})['then'](function(){return getServerInfo(_0x3d8e97);})[_0x3281('0x2b')](function(_0x5a5ed6){var _0x2e4fe0=parseInt(_0x5a5ed6['version'][_0x3281('0x71')](0x0));var _0x408d4c=util[_0x3281('0x20')](_0x3281('0x65'),_0x1a6b14['remoteUri'],_0x150524['id']);if(_0x2e4fe0>0x6){_0x408d4c=util[_0x3281('0x20')](_0x3281('0x66'),_0x1a6b14[_0x3281('0x53')],_0x150524['id']);}logger[_0x3281('0xc')](_0x3281('0x6d'),_0x3281('0x72'));emit(util[_0x3281('0x20')](_0x3281('0x67'),_0x36f6b1[_0x3281('0x17')]),_0x3281('0x73'),{'uri':_0x408d4c});})[_0x3281('0x68')](function(_0x87e3e9){logger[_0x3281('0x74')](_0x3281('0x6d'),JSON['stringify'](_0x87e3e9));});};exports[_0x3281('0x75')]=function(_0x4475e3,_0x2b9bdc,_0x36c880,_0x55fda4,_0x2914c5,_0x5a52ca){var _0x30ee70,_0x3e58ad,_0x7a098d,_0x5bf98d;_0x5a52ca['remoteUri']=intUtil[_0x3281('0x54')](_0x5a52ca[_0x3281('0x53')]);_0x5a52ca['serverUrl']=intUtil[_0x3281('0x54')](_0x5a52ca['serverUrl']);def['uri']=util[_0x3281('0x20')](_0x3281('0x6a'),_0x5a52ca[_0x3281('0x53')]);if(_0x2914c5&&_0x2914c5[_0x3281('0x57')]){logger[_0x3281('0xc')]('['+_0x2b9bdc[_0x3281('0x76')]['toUpperCase']()+']',_0x3281('0x58'));_0x2b9bdc['recordingURL']=util[_0x3281('0x20')](_0x3281('0x5a'),_0x5a52ca['serverUrl'],_0x2b9bdc[_0x3281('0x5b')],md5(_0x2b9bdc[_0x3281('0x5b')]));}else{_0x2b9bdc['recordingURL']='';}return getConnection(_0x5a52ca)[_0x3281('0x2b')](function(_0x20b7c1){_0x5bf98d=_0x20b7c1;if(!_[_0x3281('0x77')](_0x55fda4)){return getUser(_0x5a52ca,_0x55fda4['name'],_0x5bf98d);}else{return getUser(_0x5a52ca,null,_0x5bf98d);}})['then'](function(_0x197e7a){_0x30ee70=_0x197e7a;logger[_0x3281('0xc')](_0x3281('0x5c'),_0x30ee70['id']);return getEndUser(_0x5a52ca,_0x2b9bdc['calleridname'],_0x2b9bdc[_0x3281('0x78')],_0x5bf98d);})[_0x3281('0x2b')](function(_0xd97e99){_0x3e58ad=_0xd97e99;logger['info'](_0x3281('0x5e'),_0x3e58ad['id']);return getTicket(_0x5a52ca,_0x30ee70,_0x3e58ad,_0x36c880,_0x2b9bdc,_0x36c880[_0x3281('0x5f')],_0x5bf98d,_0x3281('0x60'));})[_0x3281('0x2b')](function(_0x5f17e7){_0x7a098d=_0x5f17e7;logger['info'](_0x3281('0x61'));logger[_0x3281('0xc')]('The\x20Ticket\x20ID\x20is:',_0x7a098d['id']);return setRelationship(_0x5bf98d,_0x30ee70,_0x7a098d,'users');})[_0x3281('0x2b')](function(){return setRelationship(_0x5bf98d,_0x3e58ad,_0x7a098d,_0x3281('0x70'));})[_0x3281('0x2b')](function(){return getServerInfo(_0x5bf98d);})[_0x3281('0x68')](function(_0x4e954d){logger[_0x3281('0x74')]('['+_0x2b9bdc['lastevent']['toUpperCase']()+']',JSON[_0x3281('0x1e')](_0x4e954d));});}; \ 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 27de226..b2ff5cc 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 _0x49e8=['length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','util','getString'];(function(_0x2c1fc2,_0xcb962e){var _0x15b3b8=function(_0x1ca7b0){while(--_0x1ca7b0){_0x2c1fc2['push'](_0x2c1fc2['shift']());}};_0x15b3b8(++_0xcb962e);}(_0x49e8,0x193));var _0x849e=function(_0x3f3519,_0xd53cae){_0x3f3519=_0x3f3519-0x0;var _0x23b6bf=_0x49e8[_0x3f3519];return _0x23b6bf;};'use strict';var _=require('lodash');var util=require(_0x849e('0x0'));exports[_0x849e('0x1')]=function(_0x8f6e89,_0x4c8aac,_0x144932){var _0x25332e=[];if(_0x8f6e89[_0x849e('0x2')]>0x0){var _0x523242=_[_0x849e('0x3')](_0x8f6e89,['id']);for(var _0x36479f=0x0;_0x36479f<_0x523242['length'];_0x36479f++){var _0x3df2a8=_0x523242[_0x36479f];if(_0x3df2a8[_0x849e('0x4')]===_0x849e('0x5')){_0x25332e[_0x849e('0x6')](_0x3df2a8[_0x849e('0x7')]);}else if(_0x3df2a8[_0x849e('0x4')]===_0x849e('0x8')&&_0x3df2a8[_0x849e('0x9')]){_0x4c8aac[_0x3df2a8[_0x849e('0x9')]]&&_0x25332e[_0x849e('0x6')](_0x4c8aac[_0x3df2a8[_0x849e('0x9')]][_0x849e('0xa')]());}else if(_0x3df2a8['type']===_0x849e('0xb')&&_0x3df2a8[_0x849e('0xc')]&&_0x3df2a8['Variable'][_0x849e('0xd')]){_0x4c8aac[_0x3df2a8['Variable'][_0x849e('0xd')][_0x849e('0xe')]()]&&_0x25332e['push'](_0x4c8aac[_0x3df2a8['Variable'][_0x849e('0xd')][_0x849e('0xe')]()][_0x849e('0xa')]());}else if(_0x3df2a8[_0x849e('0x4')]==='keyValue'){if(_0x3df2a8[_0x849e('0xf')]===_0x849e('0x5')&&_0x3df2a8[_0x849e('0x10')]){_0x25332e[_0x849e('0x6')](util[_0x849e('0x11')](_0x849e('0x12'),_0x3df2a8[_0x849e('0x10')],_0x3df2a8[_0x849e('0x13')]));}else if(_0x3df2a8['keyType']===_0x849e('0x8')&&_0x3df2a8[_0x849e('0x9')]&&_0x3df2a8[_0x849e('0x10')]){_0x4c8aac[_0x3df2a8[_0x849e('0x9')]]&&_0x25332e['push'](util[_0x849e('0x11')](_0x849e('0x12'),_0x3df2a8[_0x849e('0x10')],_0x4c8aac[_0x3df2a8[_0x849e('0x9')]]));}else if(_0x3df2a8[_0x849e('0xf')]===_0x849e('0xb')&&_0x3df2a8['Variable']&&_0x3df2a8[_0x849e('0xc')][_0x849e('0xd')]&&_0x3df2a8[_0x849e('0x10')]){_0x4c8aac[_0x3df2a8['Variable'][_0x849e('0xd')][_0x849e('0xe')]()]&&_0x25332e['push'](util[_0x849e('0x11')](_0x849e('0x12'),_0x3df2a8['key'],_0x4c8aac[_0x3df2a8[_0x849e('0xc')]['name'][_0x849e('0xe')]()]));}}}}return _0x25332e[_0x849e('0x14')](_0x144932);};exports[_0x849e('0x15')]=function(_0x43c3fc){var _0x239d70=_0x43c3fc[_0x849e('0x16')](-0x1);if(_0x239d70==='/'){_0x43c3fc=_0x43c3fc['substring'](0x0,_0x43c3fc[_0x849e('0x17')](_0x239d70));}return _0x43c3fc;};exports[_0x849e('0x18')]=function(_0xd384d6){if(!_[_0x849e('0x19')](_0xd384d6)&&_0xd384d6!==''){var _0x1b3033=/^(([^<>()\[\]\\.,;:\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 _0x1b3033[_0x849e('0x1a')](String(_0xd384d6)[_0x849e('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x2b3d=['join','stripTrailingSlash','substring','lastIndexOf','isNil','getString','length','sortBy','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','format','keyContent','%s:\x20%s'];(function(_0x1c3b31,_0xc032a8){var _0x285716=function(_0x82b6e0){while(--_0x82b6e0){_0x1c3b31['push'](_0x1c3b31['shift']());}};_0x285716(++_0xc032a8);}(_0x2b3d,0xb4));var _0xd2b3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2b3d[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require('util');exports[_0xd2b3('0x0')]=function(_0x382d8c,_0x2a52ac,_0x2da766){var _0x563d69=[];if(_0x382d8c[_0xd2b3('0x1')]>0x0){var _0x5d153c=_[_0xd2b3('0x2')](_0x382d8c,['id']);for(var _0x4a2a40=0x0;_0x4a2a40<_0x5d153c[_0xd2b3('0x1')];_0x4a2a40++){var _0x5b49d7=_0x5d153c[_0x4a2a40];if(_0x5b49d7['type']==='string'){_0x563d69[_0xd2b3('0x3')](_0x5b49d7[_0xd2b3('0x4')]);}else if(_0x5b49d7[_0xd2b3('0x5')]===_0xd2b3('0x6')&&_0x5b49d7[_0xd2b3('0x7')]){_0x2a52ac[_0x5b49d7[_0xd2b3('0x7')]]&&_0x563d69[_0xd2b3('0x3')](_0x2a52ac[_0x5b49d7[_0xd2b3('0x7')]][_0xd2b3('0x8')]());}else if(_0x5b49d7['type']===_0xd2b3('0x9')&&_0x5b49d7[_0xd2b3('0xa')]&&_0x5b49d7[_0xd2b3('0xa')][_0xd2b3('0xb')]){_0x2a52ac[_0x5b49d7['Variable'][_0xd2b3('0xb')]['toLowerCase']()]&&_0x563d69[_0xd2b3('0x3')](_0x2a52ac[_0x5b49d7[_0xd2b3('0xa')]['name'][_0xd2b3('0xc')]()][_0xd2b3('0x8')]());}else if(_0x5b49d7[_0xd2b3('0x5')]===_0xd2b3('0xd')){if(_0x5b49d7[_0xd2b3('0xe')]===_0xd2b3('0xf')&&_0x5b49d7[_0xd2b3('0x10')]){_0x563d69[_0xd2b3('0x3')](util[_0xd2b3('0x11')]('%s:\x20%s',_0x5b49d7[_0xd2b3('0x10')],_0x5b49d7[_0xd2b3('0x12')]));}else if(_0x5b49d7[_0xd2b3('0xe')]===_0xd2b3('0x6')&&_0x5b49d7[_0xd2b3('0x7')]&&_0x5b49d7['key']){_0x2a52ac[_0x5b49d7['variableName']]&&_0x563d69['push'](util[_0xd2b3('0x11')](_0xd2b3('0x13'),_0x5b49d7[_0xd2b3('0x10')],_0x2a52ac[_0x5b49d7[_0xd2b3('0x7')]]));}else if(_0x5b49d7[_0xd2b3('0xe')]===_0xd2b3('0x9')&&_0x5b49d7[_0xd2b3('0xa')]&&_0x5b49d7[_0xd2b3('0xa')][_0xd2b3('0xb')]&&_0x5b49d7['key']){_0x2a52ac[_0x5b49d7[_0xd2b3('0xa')]['name']['toLowerCase']()]&&_0x563d69[_0xd2b3('0x3')](util[_0xd2b3('0x11')](_0xd2b3('0x13'),_0x5b49d7[_0xd2b3('0x10')],_0x2a52ac[_0x5b49d7[_0xd2b3('0xa')][_0xd2b3('0xb')]['toLowerCase']()]));}}}}return _0x563d69[_0xd2b3('0x14')](_0x2da766);};exports[_0xd2b3('0x15')]=function(_0x521154){var _0x377250=_0x521154['slice'](-0x1);if(_0x377250==='/'){_0x521154=_0x521154[_0xd2b3('0x16')](0x0,_0x521154[_0xd2b3('0x17')](_0x377250));}return _0x521154;};exports['validateEmail']=function(_0x1bae02){if(!_[_0xd2b3('0x18')](_0x1bae02)&&_0x1bae02!==''){var _0x101e69=/^(([^<>()\[\]\\.,;:\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 _0x101e69['test'](String(_0x1bae02)[_0xd2b3('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index d235e01..4a86061 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 _0xb1a6=['request-promise','bluebird','util','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','Descriptions','%s/webservice.php','remoteUri','username','sessionName','stringify','then','success','resolve','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','info','Getting\x20agent\x20with\x20email','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','GET','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','POST','create','Contacts','Enduser\x20created.','phone','getEndUser','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','monitor_format','[QUEUE]','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','unmanaged','stripTrailingSlash','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash'];(function(_0x5d9e8b,_0xaff70f){var _0x17974a=function(_0x5afd33){while(--_0x5afd33){_0x5d9e8b['push'](_0x5d9e8b['shift']());}};_0x17974a(++_0xaff70f);}(_0xb1a6,0x143));var _0x6b1a=function(_0x4bd62b,_0x36cd29){_0x4bd62b=_0x4bd62b-0x0;var _0x240e23=_0xb1a6[_0x4bd62b];return _0x240e23;};'use strict';var _=require(_0x6b1a('0x0'));var rp=require(_0x6b1a('0x1'));var BPromise=require(_0x6b1a('0x2'));var md5=require('md5');var util=require(_0x6b1a('0x3'));var Redis=require(_0x6b1a('0x4'));var intUtil=require('./util');var config=require(_0x6b1a('0x5'));var logger=require(_0x6b1a('0x6'))(_0x6b1a('0x7'));config[_0x6b1a('0x8')]=_['defaults'](config[_0x6b1a('0x8')],{'host':_0x6b1a('0x9'),'port':0x18eb});var io=require(_0x6b1a('0xa'))(new Redis(config['redis']));function emit(_0x268122,_0x1c89df,_0x652a97){io['to'](_0x268122)[_0x6b1a('0xb')](_0x1c89df,_0x652a97);}function getCustomFields(_0x5a3d70,_0x1f1312){var _0x2cb48e={};if(_0x5a3d70[_0x6b1a('0xc')]>0x0){_[_0x6b1a('0xd')](_0x5a3d70,function(_0x127625){if(_[_0x6b1a('0xe')]([_0x6b1a('0xf'),_0x6b1a('0x10')],_0x127625['type'])&&_0x127625[_0x6b1a('0x11')]){_0x2cb48e[_0x127625[_0x6b1a('0x11')]]=_0x127625[_0x6b1a('0x12')]['toString']();}else if(_0x127625[_0x6b1a('0x13')]===_0x6b1a('0x14')&&_0x127625[_0x6b1a('0x15')]&&_0x127625[_0x6b1a('0x11')]&&_0x1f1312[_0x127625[_0x6b1a('0x15')]]){_0x2cb48e[_0x127625[_0x6b1a('0x11')]]=_0x1f1312[_0x127625[_0x6b1a('0x15')]][_0x6b1a('0x16')]();}else if(_0x127625['type']===_0x6b1a('0x17')&&_0x127625['Variable']&&_0x127625[_0x6b1a('0x18')][_0x6b1a('0x19')]&&_0x127625[_0x6b1a('0x11')]&&_0x1f1312[_0x127625[_0x6b1a('0x18')][_0x6b1a('0x19')][_0x6b1a('0x1a')]()]){_0x2cb48e[_0x127625[_0x6b1a('0x11')]]=_0x1f1312[_0x127625[_0x6b1a('0x18')][_0x6b1a('0x19')][_0x6b1a('0x1a')]()][_0x6b1a('0x16')]();}});}return _0x2cb48e;}function createTicket(_0x59e799,_0x13abdd,_0x8b728f,_0x8cfd9,_0x7a0ad7,_0x55ee4b,_0x3fe6b5){logger['info'](_0x6b1a('0x1b'));var _0x4b3c77=_[_0x6b1a('0x1c')]({'parent_id':'','assigned_user_id':_0x13abdd['id'],'ticketpriorities':_0x6b1a('0x1d'),'ticketstatus':'Open','ticket_title':intUtil[_0x6b1a('0x1e')](_0x8cfd9[_0x6b1a('0x1f')],_0x7a0ad7,'\x20'),'description':intUtil[_0x6b1a('0x1e')](_0x8cfd9[_0x6b1a('0x20')],_0x7a0ad7,'\x0a'),'contact_id':_0x8b728f['id']},getCustomFields(_0x55ee4b,_0x7a0ad7));var _0x1e9d56={'method':'POST','uri':util['format'](_0x6b1a('0x21'),_0x59e799[_0x6b1a('0x22')]),'form':{'operation':'create','username':_0x59e799[_0x6b1a('0x23')],'sessionName':_0x3fe6b5[_0x6b1a('0x24')],'elementType':'HelpDesk','element':JSON[_0x6b1a('0x25')](_0x4b3c77)},'json':!![]};return request(_0x1e9d56)[_0x6b1a('0x26')](function(_0x5adcda){if(_0x5adcda[_0x6b1a('0x27')]){return BPromise[_0x6b1a('0x28')]({'id':_0x5adcda['result']['id']});}else{throw new Error(util[_0x6b1a('0x29')](_0x6b1a('0x2a'),JSON[_0x6b1a('0x25')](_0x5adcda[_0x6b1a('0x2b')])));}})[_0x6b1a('0x2c')](function(_0x26e167){var _0x3faffd=_0x26e167[_0x6b1a('0x2d')]||0x1f4;logger[_0x6b1a('0x2b')](_0x6b1a('0x2e'),_0x6b1a('0x2f'),_0x3faffd,JSON[_0x6b1a('0x25')](_0x26e167));});}function getUser(_0x54806d,_0x104f17,_0x2696f6){if(intUtil[_0x6b1a('0x30')](_0x104f17)){logger[_0x6b1a('0x31')](_0x6b1a('0x32'),_0x104f17);return request({'method':'GET','uri':util[_0x6b1a('0x29')]('%s/webservice.php',_0x54806d['remoteUri']),'qs':{'operation':_0x6b1a('0x33'),'username':_0x54806d[_0x6b1a('0x23')],'sessionName':_0x2696f6[_0x6b1a('0x24')],'query':util[_0x6b1a('0x29')](_0x6b1a('0x34'),_0x104f17)},'json':!![]})[_0x6b1a('0x26')](function(_0x1eab32){if(_0x1eab32[_0x6b1a('0x27')]&&_0x1eab32[_0x6b1a('0x35')][_0x6b1a('0xc')]){logger[_0x6b1a('0x31')](_0x6b1a('0x36'));return BPromise[_0x6b1a('0x28')]({'id':_0x1eab32['result'][0x0]['id'],'email':_0x1eab32[_0x6b1a('0x35')][0x0][_0x6b1a('0x37')],'name':_0x1eab32['result'][0x0][_0x6b1a('0x38')]+'\x20'+_0x1eab32['result'][_0x6b1a('0x39')]});}else{logger[_0x6b1a('0x31')](_0x6b1a('0x3a'));return BPromise[_0x6b1a('0x28')]({'id':_0x2696f6[_0x6b1a('0x3b')],'email':_0x54806d['username'],'name':_0x6b1a('0x3c')});}})['catch'](function(_0x3416f9){var _0x32c7d9=_0x3416f9[_0x6b1a('0x2d')]||0x1f4;logger[_0x6b1a('0x2b')](_0x6b1a('0x2e'),_0x6b1a('0x3d'),_0x32c7d9,JSON[_0x6b1a('0x25')](_0x3416f9));});}else{logger[_0x6b1a('0x31')](_0x6b1a('0x3a'));return BPromise[_0x6b1a('0x28')]({'id':_0x2696f6[_0x6b1a('0x3b')],'email':_0x54806d['username'],'name':_0x6b1a('0x3c')})[_0x6b1a('0x2c')](function(_0x4df3d3){var _0x2634d5=_0x4df3d3[_0x6b1a('0x2d')]||0x1f4;logger[_0x6b1a('0x2b')](_0x6b1a('0x2e'),_0x6b1a('0x3d'),_0x2634d5,JSON['stringify'](_0x4df3d3));});}}function getEndUser(_0x547863,_0x30a1df,_0x45f5f4,_0x4688f8){logger[_0x6b1a('0x31')](_0x6b1a('0x3e'),_0x45f5f4);return request({'method':_0x6b1a('0x3f'),'uri':util['format'](_0x6b1a('0x21'),_0x547863[_0x6b1a('0x22')]),'qs':{'operation':'query','username':_0x547863['username'],'sessionName':_0x4688f8['sessionName'],'query':util[_0x6b1a('0x29')](_0x6b1a('0x40'),_0x45f5f4,_0x45f5f4,_0x45f5f4,_0x45f5f4,_0x45f5f4)},'json':!![]})[_0x6b1a('0x26')](function(_0x480740){if(_0x480740[_0x6b1a('0x27')]&&_0x480740[_0x6b1a('0x35')]['length']){logger[_0x6b1a('0x31')](_0x6b1a('0x41'));return BPromise[_0x6b1a('0x28')]({'id':_0x480740[_0x6b1a('0x35')][0x0]['id'],'name':_0x480740[_0x6b1a('0x35')][0x0][_0x6b1a('0x42')]+'\x20'+_0x480740['result'][0x0][_0x6b1a('0x43')],'phone':_0x45f5f4});}else{logger[_0x6b1a('0x31')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x6b1a('0x44'),'uri':util[_0x6b1a('0x29')](_0x6b1a('0x21'),_0x547863[_0x6b1a('0x22')]),'form':{'operation':_0x6b1a('0x45'),'sessionName':_0x4688f8['sessionName'],'elementType':_0x6b1a('0x46'),'element':JSON['stringify']({'lastname':_0x30a1df,'phone':_0x45f5f4,'assigned_user_id':'\x20'})},'json':!![]})[_0x6b1a('0x26')](function(_0x15bc35){logger[_0x6b1a('0x31')](_0x6b1a('0x47'));return BPromise[_0x6b1a('0x28')]({'id':_0x15bc35[_0x6b1a('0x35')]['id'],'name':_0x15bc35[_0x6b1a('0x35')][_0x6b1a('0x43')],'phone':_0x15bc35['result'][_0x6b1a('0x48')]});})[_0x6b1a('0x2c')](function(_0xe9cec0){var _0x5f2b80=_0xe9cec0[_0x6b1a('0x2d')]||0x1f4;logger[_0x6b1a('0x2b')](_0x6b1a('0x2e'),_0x6b1a('0x49'),_0x5f2b80,JSON[_0x6b1a('0x25')](_0xe9cec0));});}});}function getConnection(_0x2609c7){var _0x5c850e=_0x2609c7[_0x6b1a('0x23')];var _0x29c28c=_0x2609c7['accessKey'];return request({'method':_0x6b1a('0x3f'),'uri':util[_0x6b1a('0x29')]('%s/webservice.php',_0x2609c7[_0x6b1a('0x22')]),'qs':{'operation':'getchallenge','username':_0x5c850e},'json':!![]})[_0x6b1a('0x26')](function(_0x38046a){if(_0x38046a[_0x6b1a('0x27')]){return request({'method':'POST','uri':util['format'](_0x6b1a('0x21'),_0x2609c7['remoteUri']),'form':{'operation':_0x6b1a('0x4a'),'username':_0x5c850e,'accessKey':md5(_0x38046a['result'][_0x6b1a('0x4b')]+_0x29c28c)},'json':!![]});}})[_0x6b1a('0x26')](function(_0x2d443c){if(_0x2d443c[_0x6b1a('0x27')]){return BPromise[_0x6b1a('0x28')](_0x2d443c[_0x6b1a('0x35')]);}else{throw new Error(util['format'](_0x6b1a('0x4c'),_0x2609c7['id']));}})[_0x6b1a('0x2c')](function(_0x440ae8){var _0xf92eb0=_0x440ae8['statusCode']||0x1f4;logger[_0x6b1a('0x2b')](_0x6b1a('0x2e'),_0x6b1a('0x4d'),_0xf92eb0,JSON[_0x6b1a('0x25')](_0x440ae8));});}function request(_0x3f5534){logger[_0x6b1a('0x31')]('[HTTP]',JSON[_0x6b1a('0x25')](_0x3f5534));return rp(_0x3f5534);}exports[_0x6b1a('0x4e')]=function(_0x8bba97,_0x41dc19,_0x1ae01e,_0x37eac3,_0x20e794,_0x1597c2){var _0x5f0fe7,_0x2a688b,_0x5c6b89,_0x2f9d3f;_0x1597c2['remoteUri']=intUtil['stripTrailingSlash'](_0x1597c2['remoteUri']);if(_0x20e794&&_0x20e794[_0x6b1a('0x4f')]){logger[_0x6b1a('0x31')](_0x6b1a('0x50'),'Recording\x20is\x20enabled!');_0x41dc19['recordingURL']=util[_0x6b1a('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1597c2[_0x6b1a('0x51')],_0x41dc19[_0x6b1a('0x52')],md5(_0x41dc19[_0x6b1a('0x52')]));}else{_0x41dc19['recordingURL']='';}return getConnection(_0x1597c2)[_0x6b1a('0x26')](function(_0x2908cc){_0x2f9d3f=_0x2908cc;return getUser(_0x1597c2,_0x37eac3['email'],_0x2f9d3f);})['then'](function(_0x364b39){_0x5f0fe7=_0x364b39;logger[_0x6b1a('0x31')](_0x6b1a('0x53'),_0x5f0fe7['id']);return getEndUser(_0x1597c2,_0x41dc19[_0x6b1a('0x54')],_0x41dc19[_0x6b1a('0x55')],_0x2f9d3f);})[_0x6b1a('0x26')](function(_0x1c8abd){_0x2a688b=_0x1c8abd;logger[_0x6b1a('0x31')](_0x6b1a('0x56'),_0x2a688b['id']);return createTicket(_0x1597c2,_0x5f0fe7,_0x2a688b,_0x1ae01e,_0x41dc19,_0x1ae01e[_0x6b1a('0x57')],_0x2f9d3f);})[_0x6b1a('0x26')](function(_0x3c6715){_0x5c6b89=_0x3c6715;logger[_0x6b1a('0x31')](_0x6b1a('0x58'));logger[_0x6b1a('0x31')](_0x6b1a('0x59'),_0x5c6b89['id']);var _0x3bd707=util[_0x6b1a('0x29')](_0x6b1a('0x5a'),_0x1597c2[_0x6b1a('0x22')],_[_0x6b1a('0x5b')](_0x5c6b89['id'],'x')[0x1]);logger[_0x6b1a('0x31')](_0x6b1a('0x50'),_0x6b1a('0x5c'));emit(util[_0x6b1a('0x29')](_0x6b1a('0x5d'),_0x37eac3[_0x6b1a('0x19')]),_0x6b1a('0x5e'),{'uri':_0x3bd707});})[_0x6b1a('0x2c')](function(_0x3a7020){logger[_0x6b1a('0x2b')]('[QUEUE]',JSON[_0x6b1a('0x25')](_0x3a7020));});};exports[_0x6b1a('0x5f')]=function(_0x2d8d06,_0x47ee79,_0x22dc51,_0xaf1878,_0x14a800,_0xb03330,_0x54fd84){var _0x3f381b,_0x1f56d5,_0x1e51de,_0x1039fd;_0xb03330[_0x6b1a('0x22')]=intUtil['stripTrailingSlash'](_0xb03330[_0x6b1a('0x22')]);_0xb03330[_0x6b1a('0x51')]=intUtil['stripTrailingSlash'](_0xb03330[_0x6b1a('0x51')]);if(_0x54fd84&&_0x54fd84[_0x6b1a('0x60')]&&_0x54fd84[_0x6b1a('0x60')]!==_0x6b1a('0x61')){logger['info'](_0x6b1a('0x62'),'Recording\x20is\x20enabled!');_0x47ee79[_0x6b1a('0x63')]=util[_0x6b1a('0x29')](_0x6b1a('0x64'),_0xb03330[_0x6b1a('0x51')],_0x47ee79['uniqueid'],md5(_0x47ee79[_0x6b1a('0x52')]));}return getConnection(_0xb03330)[_0x6b1a('0x26')](function(_0x435631){_0x1039fd=_0x435631;return getUser(_0xb03330,_0xaf1878[_0x6b1a('0x65')],_0x1039fd);})[_0x6b1a('0x26')](function(_0x4c8181){_0x3f381b=_0x4c8181;logger[_0x6b1a('0x31')](_0x6b1a('0x53'),_0x3f381b['id']);return getEndUser(_0xb03330,_0x47ee79[_0x6b1a('0x66')],_0x47ee79['destcalleridnum'],_0x1039fd);})[_0x6b1a('0x26')](function(_0x2b56c3){_0x1f56d5=_0x2b56c3;logger[_0x6b1a('0x31')](_0x6b1a('0x56'),_0x1f56d5['id']);return createTicket(_0xb03330,_0x3f381b,_0x1f56d5,_0x22dc51,_0x47ee79,_0x22dc51[_0x6b1a('0x57')],_0x1039fd);})['then'](function(_0xa20f98){_0x1e51de=_0xa20f98;logger['info']('Ticket\x20created!');logger[_0x6b1a('0x31')](_0x6b1a('0x59'),_0x1e51de['id']);var _0x25ceb0=util['format'](_0x6b1a('0x5a'),_0xb03330[_0x6b1a('0x22')],_[_0x6b1a('0x5b')](_0x1e51de['id'],'x')[0x1]);logger['info'](_0x6b1a('0x62'),_0x6b1a('0x5c'));emit(util[_0x6b1a('0x29')]('user:%s',_0xaf1878['name']),_0x6b1a('0x5e'),{'uri':_0x25ceb0});})[_0x6b1a('0x2c')](function(_0x3f0d3e){logger[_0x6b1a('0x2b')](_0x6b1a('0x62'),JSON['stringify'](_0x3f0d3e));});};exports[_0x6b1a('0x67')]=function(_0x4bb688,_0x39d5c0,_0x39231c,_0x17171a,_0x5f49c0,_0x549e40){var _0x43b140,_0x1083b9,_0x19b043,_0x3a21b7;_0x549e40['remoteUri']=intUtil['stripTrailingSlash'](_0x549e40['remoteUri']);_0x549e40[_0x6b1a('0x51')]=intUtil[_0x6b1a('0x68')](_0x549e40['serverUrl']);if(_0x5f49c0&&_0x5f49c0[_0x6b1a('0x4f')]){logger['info']('['+_0x39d5c0[_0x6b1a('0x69')][_0x6b1a('0x6a')]()+']',_0x6b1a('0x6b'));_0x39d5c0[_0x6b1a('0x63')]=util[_0x6b1a('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x549e40[_0x6b1a('0x51')],_0x39d5c0[_0x6b1a('0x52')],md5(_0x39d5c0[_0x6b1a('0x52')]));}else{_0x39d5c0['recordingURL']='';}return getConnection(_0x549e40)['then'](function(_0x145667){_0x3a21b7=_0x145667;return getUser(_0x549e40,'',_0x3a21b7);})['then'](function(_0x4d8f79){_0x43b140=_0x4d8f79;logger[_0x6b1a('0x31')](_0x6b1a('0x53'),_0x43b140['id']);return getEndUser(_0x549e40,_0x39d5c0[_0x6b1a('0x54')],_0x39d5c0['calleridnum'],_0x3a21b7);})[_0x6b1a('0x26')](function(_0x39487b){_0x1083b9=_0x39487b;logger['info'](_0x6b1a('0x56'),_0x1083b9['id']);return createTicket(_0x549e40,_0x43b140,_0x1083b9,_0x39231c,_0x39d5c0,_0x39231c[_0x6b1a('0x57')],_0x3a21b7);})[_0x6b1a('0x26')](function(_0x45c6fb){_0x19b043=_0x45c6fb;logger['info'](_0x6b1a('0x58'));logger[_0x6b1a('0x31')]('The\x20Ticket\x20ID\x20is:',_0x19b043['id']);})[_0x6b1a('0x2c')](function(_0x5e43b9){logger[_0x6b1a('0x2b')]('['+_0x39d5c0[_0x6b1a('0x69')][_0x6b1a('0x6a')]()+']',JSON['stringify'](_0x5e43b9));});}; \ No newline at end of file +var _0x8a30=['forEach','includes','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','create','username','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','info','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','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.','getEndUser','accessKey','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Ticket\x20created!','user:%s','lastevent','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Fields','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length'];(function(_0x378280,_0x3970bb){var _0x4048c0=function(_0x420420){while(--_0x420420){_0x378280['push'](_0x378280['shift']());}};_0x4048c0(++_0x3970bb);}(_0x8a30,0x1a1));var _0x08a3=function(_0x2e8601,_0x2ec0b7){_0x2e8601=_0x2e8601-0x0;var _0x412e50=_0x8a30[_0x2e8601];return _0x412e50;};'use strict';var _=require(_0x08a3('0x0'));var rp=require(_0x08a3('0x1'));var BPromise=require(_0x08a3('0x2'));var md5=require(_0x08a3('0x3'));var util=require(_0x08a3('0x4'));var Redis=require(_0x08a3('0x5'));var intUtil=require(_0x08a3('0x6'));var config=require(_0x08a3('0x7'));var logger=require('../../../../config/logger')(_0x08a3('0x8'));config[_0x08a3('0x9')]=_[_0x08a3('0xa')](config['redis'],{'host':_0x08a3('0xb'),'port':0x18eb});var io=require(_0x08a3('0xc'))(new Redis(config[_0x08a3('0x9')]));function emit(_0x5acc7c,_0x34a4d7,_0x2bc90d){io['to'](_0x5acc7c)[_0x08a3('0xd')](_0x34a4d7,_0x2bc90d);}function getCustomFields(_0xc69cf5,_0x1cfa0a){var _0x2a8267={};if(_0xc69cf5[_0x08a3('0xe')]>0x0){_[_0x08a3('0xf')](_0xc69cf5,function(_0x14a6bd){if(_[_0x08a3('0x10')]([_0x08a3('0x11'),_0x08a3('0x12')],_0x14a6bd[_0x08a3('0x13')])&&_0x14a6bd[_0x08a3('0x14')]){_0x2a8267[_0x14a6bd[_0x08a3('0x14')]]=_0x14a6bd['content'][_0x08a3('0x15')]();}else if(_0x14a6bd[_0x08a3('0x13')]===_0x08a3('0x16')&&_0x14a6bd[_0x08a3('0x17')]&&_0x14a6bd[_0x08a3('0x14')]&&_0x1cfa0a[_0x14a6bd[_0x08a3('0x17')]]){_0x2a8267[_0x14a6bd[_0x08a3('0x14')]]=_0x1cfa0a[_0x14a6bd[_0x08a3('0x17')]][_0x08a3('0x15')]();}else if(_0x14a6bd[_0x08a3('0x13')]===_0x08a3('0x18')&&_0x14a6bd[_0x08a3('0x19')]&&_0x14a6bd['Variable'][_0x08a3('0x1a')]&&_0x14a6bd['idField']&&_0x1cfa0a[_0x14a6bd[_0x08a3('0x19')][_0x08a3('0x1a')][_0x08a3('0x1b')]()]){_0x2a8267[_0x14a6bd[_0x08a3('0x14')]]=_0x1cfa0a[_0x14a6bd[_0x08a3('0x19')][_0x08a3('0x1a')][_0x08a3('0x1b')]()][_0x08a3('0x15')]();}});}return _0x2a8267;}function createTicket(_0x29bed9,_0x19e953,_0x1bb7be,_0x5283ed,_0x500a5b,_0x3a3634,_0x1a30c0){logger['info']('Creating\x20new\x20ticket...');var _0x5b788b=_[_0x08a3('0x1c')]({'parent_id':'','assigned_user_id':_0x19e953['id'],'ticketpriorities':_0x08a3('0x1d'),'ticketstatus':_0x08a3('0x1e'),'ticket_title':intUtil[_0x08a3('0x1f')](_0x5283ed[_0x08a3('0x20')],_0x500a5b,'\x20'),'description':intUtil[_0x08a3('0x1f')](_0x5283ed[_0x08a3('0x21')],_0x500a5b,'\x0a'),'contact_id':_0x1bb7be['id']},getCustomFields(_0x3a3634,_0x500a5b));var _0x509995={'method':_0x08a3('0x22'),'uri':util[_0x08a3('0x23')](_0x08a3('0x24'),_0x29bed9[_0x08a3('0x25')]),'form':{'operation':_0x08a3('0x26'),'username':_0x29bed9[_0x08a3('0x27')],'sessionName':_0x1a30c0['sessionName'],'elementType':_0x08a3('0x28'),'element':JSON[_0x08a3('0x29')](_0x5b788b)},'json':!![]};return request(_0x509995)[_0x08a3('0x2a')](function(_0x1466d6){if(_0x1466d6[_0x08a3('0x2b')]){return BPromise[_0x08a3('0x2c')]({'id':_0x1466d6[_0x08a3('0x2d')]['id']});}else{throw new Error(util[_0x08a3('0x23')](_0x08a3('0x2e'),JSON['stringify'](_0x1466d6[_0x08a3('0x2f')])));}})[_0x08a3('0x30')](function(_0x4aa9fe){var _0x279e0e=_0x4aa9fe[_0x08a3('0x31')]||0x1f4;logger[_0x08a3('0x2f')](_0x08a3('0x32'),'createTicket',_0x279e0e,JSON[_0x08a3('0x29')](_0x4aa9fe));});}function getUser(_0xf8a332,_0x5903eb,_0x4f6826){if(intUtil[_0x08a3('0x33')](_0x5903eb)){logger[_0x08a3('0x34')]('Getting\x20agent\x20with\x20email',_0x5903eb);return request({'method':_0x08a3('0x35'),'uri':util[_0x08a3('0x23')](_0x08a3('0x24'),_0xf8a332['remoteUri']),'qs':{'operation':_0x08a3('0x36'),'username':_0xf8a332[_0x08a3('0x27')],'sessionName':_0x4f6826[_0x08a3('0x37')],'query':util[_0x08a3('0x23')](_0x08a3('0x38'),_0x5903eb)},'json':!![]})[_0x08a3('0x2a')](function(_0x4125e2){if(_0x4125e2[_0x08a3('0x2b')]&&_0x4125e2[_0x08a3('0x2d')][_0x08a3('0xe')]){logger[_0x08a3('0x34')](_0x08a3('0x39'));return BPromise[_0x08a3('0x2c')]({'id':_0x4125e2['result'][0x0]['id'],'email':_0x4125e2[_0x08a3('0x2d')][0x0][_0x08a3('0x3a')],'name':_0x4125e2[_0x08a3('0x2d')][0x0][_0x08a3('0x3b')]+'\x20'+_0x4125e2[_0x08a3('0x2d')][_0x08a3('0x3c')]});}else{logger[_0x08a3('0x34')](_0x08a3('0x3d'));return BPromise[_0x08a3('0x2c')]({'id':_0x4f6826[_0x08a3('0x3e')],'email':_0xf8a332[_0x08a3('0x27')],'name':_0x08a3('0x3f')});}})[_0x08a3('0x30')](function(_0x2c26ba){var _0x37b4a0=_0x2c26ba[_0x08a3('0x31')]||0x1f4;logger[_0x08a3('0x2f')](_0x08a3('0x32'),_0x08a3('0x40'),_0x37b4a0,JSON['stringify'](_0x2c26ba));});}else{logger[_0x08a3('0x34')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x4f6826[_0x08a3('0x3e')],'email':_0xf8a332['username'],'name':_0x08a3('0x3f')})[_0x08a3('0x30')](function(_0x5e8dfb){var _0x59716c=_0x5e8dfb[_0x08a3('0x31')]||0x1f4;logger['error'](_0x08a3('0x32'),'getUser',_0x59716c,JSON[_0x08a3('0x29')](_0x5e8dfb));});}}function getEndUser(_0x37738a,_0xaf3881,_0x333a20,_0x3efb5e){logger[_0x08a3('0x34')](_0x08a3('0x41'),_0x333a20);return request({'method':_0x08a3('0x35'),'uri':util['format'](_0x08a3('0x24'),_0x37738a[_0x08a3('0x25')]),'qs':{'operation':_0x08a3('0x36'),'username':_0x37738a[_0x08a3('0x27')],'sessionName':_0x3efb5e['sessionName'],'query':util[_0x08a3('0x23')](_0x08a3('0x42'),_0x333a20,_0x333a20,_0x333a20,_0x333a20,_0x333a20)},'json':!![]})[_0x08a3('0x2a')](function(_0x5adaac){if(_0x5adaac['success']&&_0x5adaac[_0x08a3('0x2d')][_0x08a3('0xe')]){logger[_0x08a3('0x34')](_0x08a3('0x43'));return BPromise[_0x08a3('0x2c')]({'id':_0x5adaac[_0x08a3('0x2d')][0x0]['id'],'name':_0x5adaac[_0x08a3('0x2d')][0x0][_0x08a3('0x44')]+'\x20'+_0x5adaac[_0x08a3('0x2d')][0x0][_0x08a3('0x45')],'phone':_0x333a20});}else{logger[_0x08a3('0x34')](_0x08a3('0x46'));return request({'method':'POST','uri':util[_0x08a3('0x23')]('%s/webservice.php',_0x37738a[_0x08a3('0x25')]),'form':{'operation':_0x08a3('0x26'),'sessionName':_0x3efb5e[_0x08a3('0x37')],'elementType':_0x08a3('0x47'),'element':JSON[_0x08a3('0x29')]({'lastname':_0xaf3881,'phone':_0x333a20,'assigned_user_id':'\x20'})},'json':!![]})[_0x08a3('0x2a')](function(_0xfc48b6){logger[_0x08a3('0x34')](_0x08a3('0x48'));return BPromise['resolve']({'id':_0xfc48b6[_0x08a3('0x2d')]['id'],'name':_0xfc48b6[_0x08a3('0x2d')][_0x08a3('0x45')],'phone':_0xfc48b6[_0x08a3('0x2d')]['phone']});})[_0x08a3('0x30')](function(_0x2156d5){var _0x6a37d0=_0x2156d5[_0x08a3('0x31')]||0x1f4;logger[_0x08a3('0x2f')](_0x08a3('0x32'),_0x08a3('0x49'),_0x6a37d0,JSON[_0x08a3('0x29')](_0x2156d5));});}});}function getConnection(_0x1dee80){var _0x5bd8a5=_0x1dee80['username'];var _0xb8d239=_0x1dee80[_0x08a3('0x4a')];return request({'method':'GET','uri':util[_0x08a3('0x23')](_0x08a3('0x24'),_0x1dee80[_0x08a3('0x25')]),'qs':{'operation':'getchallenge','username':_0x5bd8a5},'json':!![]})['then'](function(_0x40c0a5){if(_0x40c0a5[_0x08a3('0x2b')]){return request({'method':_0x08a3('0x22'),'uri':util[_0x08a3('0x23')](_0x08a3('0x24'),_0x1dee80['remoteUri']),'form':{'operation':_0x08a3('0x4b'),'username':_0x5bd8a5,'accessKey':md5(_0x40c0a5[_0x08a3('0x2d')][_0x08a3('0x4c')]+_0xb8d239)},'json':!![]});}})[_0x08a3('0x2a')](function(_0x23103f){if(_0x23103f[_0x08a3('0x2b')]){return BPromise[_0x08a3('0x2c')](_0x23103f[_0x08a3('0x2d')]);}else{throw new Error(util[_0x08a3('0x23')](_0x08a3('0x4d'),_0x1dee80['id']));}})[_0x08a3('0x30')](function(_0x2cfede){var _0x586b76=_0x2cfede[_0x08a3('0x31')]||0x1f4;logger[_0x08a3('0x2f')](_0x08a3('0x32'),_0x08a3('0x4e'),_0x586b76,JSON['stringify'](_0x2cfede));});}function request(_0x3ab1a2){logger['info'](_0x08a3('0x4f'),JSON[_0x08a3('0x29')](_0x3ab1a2));return rp(_0x3ab1a2);}exports[_0x08a3('0x50')]=function(_0x4a394b,_0x55aae9,_0x18d052,_0x23cf92,_0x11bf38,_0x3617b6){var _0x185ad9,_0xc45f5b,_0x5cfe67,_0x39ab89;_0x3617b6[_0x08a3('0x25')]=intUtil['stripTrailingSlash'](_0x3617b6['remoteUri']);if(_0x11bf38&&_0x11bf38[_0x08a3('0x51')]){logger['info'](_0x08a3('0x52'),_0x08a3('0x53'));_0x55aae9[_0x08a3('0x54')]=util[_0x08a3('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3617b6[_0x08a3('0x55')],_0x55aae9['uniqueid'],md5(_0x55aae9[_0x08a3('0x56')]));}else{_0x55aae9[_0x08a3('0x54')]='';}return getConnection(_0x3617b6)[_0x08a3('0x2a')](function(_0x5f0db6){_0x39ab89=_0x5f0db6;return getUser(_0x3617b6,_0x23cf92[_0x08a3('0x57')],_0x39ab89);})[_0x08a3('0x2a')](function(_0x5f1bdf){_0x185ad9=_0x5f1bdf;logger[_0x08a3('0x34')](_0x08a3('0x58'),_0x185ad9['id']);return getEndUser(_0x3617b6,_0x55aae9[_0x08a3('0x59')],_0x55aae9[_0x08a3('0x5a')],_0x39ab89);})['then'](function(_0x13e1d9){_0xc45f5b=_0x13e1d9;logger[_0x08a3('0x34')](_0x08a3('0x5b'),_0xc45f5b['id']);return createTicket(_0x3617b6,_0x185ad9,_0xc45f5b,_0x18d052,_0x55aae9,_0x18d052['Fields'],_0x39ab89);})[_0x08a3('0x2a')](function(_0x5e0090){_0x5cfe67=_0x5e0090;logger[_0x08a3('0x34')]('Ticket\x20created!');logger[_0x08a3('0x34')](_0x08a3('0x5c'),_0x5cfe67['id']);var _0x4da83b=util['format'](_0x08a3('0x5d'),_0x3617b6['remoteUri'],_[_0x08a3('0x5e')](_0x5cfe67['id'],'x')[0x1]);logger[_0x08a3('0x34')](_0x08a3('0x52'),_0x08a3('0x5f'));emit(util[_0x08a3('0x23')]('user:%s',_0x23cf92['name']),_0x08a3('0x60'),{'uri':_0x4da83b});})[_0x08a3('0x30')](function(_0x45f73b){logger['error']('[QUEUE]',JSON[_0x08a3('0x29')](_0x45f73b));});};exports[_0x08a3('0x61')]=function(_0x4e1114,_0xe6c6ad,_0x5486e1,_0x3b8e95,_0xaaa81b,_0x32900a,_0x2b2d80){var _0x16d02a,_0x597c7f,_0xa2c46f,_0x8249b3;_0x32900a[_0x08a3('0x25')]=intUtil[_0x08a3('0x62')](_0x32900a[_0x08a3('0x25')]);_0x32900a[_0x08a3('0x55')]=intUtil['stripTrailingSlash'](_0x32900a[_0x08a3('0x55')]);if(_0x2b2d80&&_0x2b2d80[_0x08a3('0x63')]&&_0x2b2d80['recordingFormat']!=='none'){logger[_0x08a3('0x34')](_0x08a3('0x64'),'Recording\x20is\x20enabled!');_0xe6c6ad[_0x08a3('0x54')]=util[_0x08a3('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32900a[_0x08a3('0x55')],_0xe6c6ad[_0x08a3('0x56')],md5(_0xe6c6ad[_0x08a3('0x56')]));}return getConnection(_0x32900a)[_0x08a3('0x2a')](function(_0xe83b2f){_0x8249b3=_0xe83b2f;return getUser(_0x32900a,_0x3b8e95['email'],_0x8249b3);})[_0x08a3('0x2a')](function(_0x593ea3){_0x16d02a=_0x593ea3;logger[_0x08a3('0x34')](_0x08a3('0x58'),_0x16d02a['id']);return getEndUser(_0x32900a,_0xe6c6ad[_0x08a3('0x65')],_0xe6c6ad[_0x08a3('0x66')],_0x8249b3);})[_0x08a3('0x2a')](function(_0x23c746){_0x597c7f=_0x23c746;logger[_0x08a3('0x34')](_0x08a3('0x5b'),_0x597c7f['id']);return createTicket(_0x32900a,_0x16d02a,_0x597c7f,_0x5486e1,_0xe6c6ad,_0x5486e1['Fields'],_0x8249b3);})[_0x08a3('0x2a')](function(_0x474f5b){_0xa2c46f=_0x474f5b;logger[_0x08a3('0x34')](_0x08a3('0x67'));logger['info']('The\x20Ticket\x20ID\x20is:',_0xa2c46f['id']);var _0x30ee10=util[_0x08a3('0x23')](_0x08a3('0x5d'),_0x32900a[_0x08a3('0x25')],_[_0x08a3('0x5e')](_0xa2c46f['id'],'x')[0x1]);logger[_0x08a3('0x34')](_0x08a3('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x08a3('0x23')](_0x08a3('0x68'),_0x3b8e95[_0x08a3('0x1a')]),_0x08a3('0x60'),{'uri':_0x30ee10});})[_0x08a3('0x30')](function(_0x55fadc){logger[_0x08a3('0x2f')](_0x08a3('0x64'),JSON['stringify'](_0x55fadc));});};exports['unmanaged']=function(_0x40aec4,_0x69632d,_0xc30db3,_0x29f4ab,_0x571b39,_0x5ba5f7){var _0x54edb1,_0x3d6451,_0x288e96,_0x17e442;_0x5ba5f7['remoteUri']=intUtil[_0x08a3('0x62')](_0x5ba5f7[_0x08a3('0x25')]);_0x5ba5f7[_0x08a3('0x55')]=intUtil[_0x08a3('0x62')](_0x5ba5f7['serverUrl']);if(_0x571b39&&_0x571b39[_0x08a3('0x51')]){logger['info']('['+_0x69632d[_0x08a3('0x69')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x69632d[_0x08a3('0x54')]=util[_0x08a3('0x23')](_0x08a3('0x6a'),_0x5ba5f7[_0x08a3('0x55')],_0x69632d[_0x08a3('0x56')],md5(_0x69632d[_0x08a3('0x56')]));}else{_0x69632d[_0x08a3('0x54')]='';}return getConnection(_0x5ba5f7)['then'](function(_0x50f3b7){_0x17e442=_0x50f3b7;return getUser(_0x5ba5f7,'',_0x17e442);})[_0x08a3('0x2a')](function(_0x245407){_0x54edb1=_0x245407;logger[_0x08a3('0x34')]('The\x20User\x20ID\x20is:',_0x54edb1['id']);return getEndUser(_0x5ba5f7,_0x69632d[_0x08a3('0x59')],_0x69632d[_0x08a3('0x5a')],_0x17e442);})[_0x08a3('0x2a')](function(_0x2a3a6f){_0x3d6451=_0x2a3a6f;logger[_0x08a3('0x34')](_0x08a3('0x5b'),_0x3d6451['id']);return createTicket(_0x5ba5f7,_0x54edb1,_0x3d6451,_0xc30db3,_0x69632d,_0xc30db3[_0x08a3('0x6b')],_0x17e442);})[_0x08a3('0x2a')](function(_0x384b53){_0x288e96=_0x384b53;logger[_0x08a3('0x34')](_0x08a3('0x67'));logger[_0x08a3('0x34')]('The\x20Ticket\x20ID\x20is:',_0x288e96['id']);})[_0x08a3('0x30')](function(_0x7a2840){logger['error']('['+_0x69632d['lastevent']['toUpperCase']()+']',JSON[_0x08a3('0x29')](_0x7a2840));});}; \ 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 8b805ab..7679df9 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 _0x1a00=['POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','authType','%s:%s','username','password','%s/token:%s','token','Basic\x20%s','base64','stringify','GET','includes','string','type','customField','nameField','toLowerCase','content','toString','picklist','idField','custom_fields','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri'];(function(_0x5eb4a4,_0xa2039a){var _0x14113a=function(_0x235343){while(--_0x235343){_0x5eb4a4['push'](_0x5eb4a4['shift']());}};_0x14113a(++_0xa2039a);}(_0x1a00,0x13b));var _0x01a0=function(_0x35e426,_0xdbe77d){_0x35e426=_0x35e426-0x0;var _0x132b59=_0x1a00[_0x35e426];return _0x132b59;};'use strict';var _=require('lodash');var rp=require(_0x01a0('0x0'));var md5=require('md5');var util=require(_0x01a0('0x1'));var Redis=require(_0x01a0('0x2'));var intUtil=require(_0x01a0('0x3'));var config=require(_0x01a0('0x4'));var logger=require(_0x01a0('0x5'))(_0x01a0('0x6'));config[_0x01a0('0x7')]=_[_0x01a0('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x01a0('0x7')]));function emit(_0x14187b,_0xad75ef,_0x104ff2){io['to'](_0x14187b)[_0x01a0('0x9')](_0xad75ef,_0x104ff2);}var headers={'Content-Type':_0x01a0('0xa'),'Accept':'application/json'};function getTicket(_0x510236,_0x277814,_0x384581,_0x287422,_0x46d6c8){logger[_0x01a0('0xb')](_0x01a0('0xc'));return request({'uri':util[_0x01a0('0xd')]('%s/tickets.json',_0x510236[_0x01a0('0xe')]),'method':_0x01a0('0xf'),'body':{'ticket':_[_0x01a0('0x10')]({'requester_id':_0x384581['id'],'submitter_id':_0x277814?_0x277814['id']:undefined,'assignee_id':_0x277814?_0x277814['id']:undefined,'tags':getTags(_0x287422[_0x01a0('0x11')],_0x01a0('0x12')),'subject':intUtil[_0x01a0('0x13')](_0x287422[_0x01a0('0x14')],_0x46d6c8,'\x20'),'description':intUtil[_0x01a0('0x13')](_0x287422[_0x01a0('0x15')],_0x46d6c8,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x287422[_0x01a0('0x15')],_0x46d6c8,'\x0a')}},getCustomFields(_0x287422[_0x01a0('0x16')],_0x46d6c8))}})['then'](function(_0xae157d){logger['info']('Ticket\x20created!');return _0xae157d[_0x01a0('0x17')];});}function getUser(_0x5ac9d2,_0x2966eb){if(intUtil[_0x01a0('0x18')](_0x2966eb)){logger[_0x01a0('0xb')](_0x01a0('0x19'),_0x2966eb);return request({'uri':util[_0x01a0('0xd')](_0x01a0('0x1a'),_0x5ac9d2['remoteUri']),'qs':{'query':util[_0x01a0('0xd')]('type:user\x20role:agent\x20email:%s',_0x2966eb)}})['then'](function(_0x13cfea){if(_0x13cfea[_0x01a0('0x1b')]){logger[_0x01a0('0xb')](_0x01a0('0x1c'));return _[_0x01a0('0x1d')](_0x13cfea[_0x01a0('0x1e')],{'email':_0x2966eb,'role':_0x01a0('0x1f')});}else{logger[_0x01a0('0xb')](_0x01a0('0x20'));return request({'uri':util[_0x01a0('0xd')](_0x01a0('0x21'),_0x5ac9d2[_0x01a0('0xe')])})[_0x01a0('0x22')](function(_0x49f8a8){logger[_0x01a0('0xb')](_0x01a0('0x23'));return _0x49f8a8[_0x01a0('0x24')];});}});}else{logger[_0x01a0('0xb')](_0x01a0('0x20'));return request({'uri':util['format'](_0x01a0('0x21'),_0x5ac9d2[_0x01a0('0xe')])})[_0x01a0('0x22')](function(_0x3e47db){logger[_0x01a0('0xb')](_0x01a0('0x23'));return _0x3e47db[_0x01a0('0x24')];});}}function getEndUser(_0x4f0437,_0x581386,_0x10e60a){logger['info']('Searching\x20enduser\x20with\x20phone',_0x10e60a);return request({'uri':util[_0x01a0('0xd')](_0x01a0('0x1a'),_0x4f0437[_0x01a0('0xe')]),'qs':{'query':util[_0x01a0('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x10e60a)}})['then'](function(_0x1c3edb){var _0x3e2e7d;if(_0x1c3edb['results'][_0x01a0('0x25')]){_0x1c3edb[_0x01a0('0x1e')]=_[_0x01a0('0x26')](_0x1c3edb[_0x01a0('0x1e')],{'suspended':![],'role':'end-user'});if(_0x1c3edb[_0x01a0('0x1e')][_0x01a0('0x25')]){_0x3e2e7d=_[_0x01a0('0x27')](_0x1c3edb[_0x01a0('0x1e')]);}}if(_0x3e2e7d){logger['info'](_0x01a0('0x28'));return _0x3e2e7d;}else{logger[_0x01a0('0xb')](_0x01a0('0x29'));return request({'uri':util[_0x01a0('0xd')](_0x01a0('0x2a'),_0x4f0437['remoteUri']),'method':_0x01a0('0xf'),'body':{'user':{'role':_0x01a0('0x2b'),'name':util['format'](_0x01a0('0x2c'),_0x581386||_0x10e60a),'phone':_0x10e60a}}})[_0x01a0('0x22')](function(_0x31796e){logger[_0x01a0('0xb')]('Enduser\x20created.');return _0x31796e[_0x01a0('0x24')];});}});}function getAuth(_0x4f1f7b){var _0x196d8b;if(_0x4f1f7b[_0x01a0('0x2d')]==='password'){_0x196d8b=util[_0x01a0('0xd')](_0x01a0('0x2e'),_0x4f1f7b[_0x01a0('0x2f')],_0x4f1f7b[_0x01a0('0x30')]);}else if(_0x4f1f7b['authType']==='token'){_0x196d8b=util[_0x01a0('0xd')](_0x01a0('0x31'),_0x4f1f7b[_0x01a0('0x2f')],_0x4f1f7b[_0x01a0('0x32')]);}return util[_0x01a0('0xd')](_0x01a0('0x33'),new Buffer(_0x196d8b)['toString'](_0x01a0('0x34')));}function request(_0x5d1c1b){logger['debug']('[HTTP]',JSON[_0x01a0('0x35')](_0x5d1c1b));return rp(_['defaults'](_0x5d1c1b,{'method':_0x01a0('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x256638,_0x175c3b){var _0x404d2e=[];if(_0x256638&&_0x256638[_0x01a0('0x25')]>0x0){_0x404d2e=_['map'](_0x256638,_0x175c3b);}return _0x404d2e;}function getCustomFields(_0x1ca0ef,_0x356979){var _0x171341=[];var _0x1e03fa={'custom_fields':[]};if(_0x1ca0ef['length']>0x0){_['forEach'](_0x1ca0ef,function(_0x263f16){if(_[_0x01a0('0x37')]([_0x01a0('0x38'),'picklist'],_0x263f16[_0x01a0('0x39')])&&_0x263f16['nameField']&&!_0x263f16[_0x01a0('0x3a')]){_0x1e03fa[_0x263f16[_0x01a0('0x3b')][_0x01a0('0x3c')]()]=_0x263f16[_0x01a0('0x3d')][_0x01a0('0x3e')]();}else if(_[_0x01a0('0x37')]([_0x01a0('0x38'),_0x01a0('0x3f')],_0x263f16[_0x01a0('0x39')])&&_0x263f16[_0x01a0('0x40')]&&_0x263f16[_0x01a0('0x3a')]){_0x1e03fa[_0x01a0('0x41')]['push']({'id':_0x263f16[_0x01a0('0x40')],'value':_0x263f16[_0x01a0('0x3d')]['toString']()});}else if(_0x263f16[_0x01a0('0x39')]==='variable'&&_0x263f16['variableName']&&_0x263f16[_0x01a0('0x40')]&&_0x263f16[_0x01a0('0x3a')]){_0x356979[_0x263f16[_0x01a0('0x42')]]&&_0x1e03fa['custom_fields'][_0x01a0('0x43')]({'id':_0x263f16['idField'],'value':_0x356979[_0x263f16[_0x01a0('0x42')]][_0x01a0('0x3e')]()});}else if(_0x263f16[_0x01a0('0x39')]===_0x01a0('0x44')&&_0x263f16[_0x01a0('0x45')]&&_0x263f16['Variable'][_0x01a0('0x12')]&&_0x263f16[_0x01a0('0x40')]&&_0x263f16[_0x01a0('0x3a')]){_0x356979[_0x263f16[_0x01a0('0x45')]['name'][_0x01a0('0x3c')]()]&&_0x1e03fa[_0x01a0('0x41')][_0x01a0('0x43')]({'id':_0x263f16[_0x01a0('0x40')],'value':_0x356979[_0x263f16[_0x01a0('0x45')][_0x01a0('0x12')]['toLowerCase']()][_0x01a0('0x3e')]()});}});}return _0x1e03fa;}exports[_0x01a0('0x46')]=function(_0x4aedce,_0x2367db,_0x1406ff,_0x33ba0e,_0x340f50,_0x2db8f9){var _0x92c070,_0x4fb31f;_0x2db8f9[_0x01a0('0xe')]=intUtil[_0x01a0('0x47')](_0x2db8f9[_0x01a0('0xe')]);_0x2db8f9[_0x01a0('0x48')]=intUtil[_0x01a0('0x47')](_0x2db8f9[_0x01a0('0x48')]);if(_0x340f50&&_0x340f50[_0x01a0('0x49')]){logger['info'](_0x01a0('0x4a'),_0x01a0('0x4b'));_0x2367db[_0x01a0('0x4c')]=util['format'](_0x01a0('0x4d'),_0x2db8f9[_0x01a0('0x48')],_0x2367db[_0x01a0('0x4e')],md5(_0x2367db[_0x01a0('0x4e')]));}else{_0x2367db[_0x01a0('0x4c')]='';}headers['Authorization']=getAuth(_0x2db8f9);return getUser(_0x2db8f9,_0x33ba0e[_0x01a0('0x4f')])[_0x01a0('0x22')](function(_0x41b281){_0x92c070=_0x41b281;logger[_0x01a0('0xb')](_0x01a0('0x50'),_0x92c070['id']);return getEndUser(_0x2db8f9,_0x2367db[_0x01a0('0x51')],_0x2367db[_0x01a0('0x52')]);})[_0x01a0('0x22')](function(_0x194c58){_0x4fb31f=_0x194c58;logger[_0x01a0('0xb')](_0x01a0('0x53'),_0x4fb31f['id']);return getTicket(_0x2db8f9,_0x92c070,_0x4fb31f,_0x1406ff,_0x2367db);})[_0x01a0('0x22')](function(_0x523489){if(_0x523489){logger['info'](_0x01a0('0x54'),_0x523489['id']);switch(_0x2db8f9[_0x01a0('0x39')]){case'integrationTab':logger[_0x01a0('0xb')]('[QUEUE]',_0x01a0('0x55'));return request({'uri':util['format'](_0x01a0('0x56'),_0x2db8f9[_0x01a0('0xe')],_0x92c070['id'],_0x523489['id']),'method':_0x01a0('0xf')});case _0x01a0('0x57'):logger[_0x01a0('0xb')](_0x01a0('0x4a'),_0x01a0('0x58'));emit(util[_0x01a0('0xd')](_0x01a0('0x59'),_0x33ba0e[_0x01a0('0x12')]),_0x01a0('0x5a'),{'uri':util[_0x01a0('0xd')](_0x01a0('0x5b'),_0x2db8f9[_0x01a0('0xe')][_0x01a0('0x5c')](_0x01a0('0x5d'),''),_0x523489['id'])});break;default:logger['error']('[QUEUE]',_0x01a0('0x5e'));}}})[_0x01a0('0x5f')](function(_0x977bb0){logger[_0x01a0('0x60')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x01a0('0x61')](_0x977bb0,{'showHidden':!![],'depth':null}));});};exports[_0x01a0('0x62')]=function(_0x1be4e3,_0x43ab3e,_0x19bd47,_0x33bb34,_0x4ffedc,_0x508978,_0x272c6a){var _0x1297fd,_0x5b62f7;_0x508978[_0x01a0('0xe')]=intUtil[_0x01a0('0x47')](_0x508978[_0x01a0('0xe')]);_0x508978['serverUrl']=intUtil[_0x01a0('0x47')](_0x508978[_0x01a0('0x48')]);if(_0x272c6a&&_0x272c6a['recordingFormat']&&_0x272c6a[_0x01a0('0x63')]!==_0x01a0('0x64')){logger['info'](_0x01a0('0x65'),'Recording\x20is\x20enabled!');_0x43ab3e['recordingURL']=util[_0x01a0('0xd')](_0x01a0('0x4d'),_0x508978[_0x01a0('0x48')],_0x43ab3e['uniqueid'],md5(_0x43ab3e[_0x01a0('0x4e')]));}headers[_0x01a0('0x66')]=getAuth(_0x508978);return getUser(_0x508978,_0x33bb34['email'])[_0x01a0('0x22')](function(_0x407c7c){_0x1297fd=_0x407c7c;logger[_0x01a0('0xb')](_0x01a0('0x50'),_0x1297fd['id']);return getEndUser(_0x508978,_0x43ab3e[_0x01a0('0x67')],_0x43ab3e[_0x01a0('0x68')]);})[_0x01a0('0x22')](function(_0x4c6db9){_0x5b62f7=_0x4c6db9;logger[_0x01a0('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5b62f7['id']);return getTicket(_0x508978,_0x1297fd,_0x5b62f7,_0x19bd47,_0x43ab3e);})[_0x01a0('0x22')](function(_0x26ef07){if(_0x26ef07){logger['info'](_0x01a0('0x54'),_0x26ef07['id']);switch(_0x508978['type']){case _0x01a0('0x69'):logger[_0x01a0('0xb')](_0x01a0('0x65'),_0x01a0('0x55'));return request({'uri':util[_0x01a0('0xd')](_0x01a0('0x56'),_0x508978['remoteUri'],_0x1297fd['id'],_0x26ef07['id']),'method':_0x01a0('0xf')});case _0x01a0('0x57'):logger['info']('[OUTBOUND]',_0x01a0('0x58'));emit(util[_0x01a0('0xd')]('user:%s',_0x33bb34['name']),_0x01a0('0x5a'),{'uri':util[_0x01a0('0xd')](_0x01a0('0x5b'),_0x508978[_0x01a0('0xe')]['replace'](_0x01a0('0x5d'),''),_0x26ef07['id'])});break;default:logger[_0x01a0('0x60')](_0x01a0('0x65'),_0x01a0('0x5e'));}}})[_0x01a0('0x5f')](function(_0xaace89){logger['error'](_0x01a0('0x6a'),util[_0x01a0('0x61')](_0xaace89,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0xb498c6,_0x3cf9ef,_0x2c78d2,_0x32e6e9,_0x4c74ca,_0x36ed37){var _0x75148b,_0x3b59bc;_0x36ed37[_0x01a0('0xe')]=intUtil[_0x01a0('0x47')](_0x36ed37[_0x01a0('0xe')]);_0x36ed37[_0x01a0('0x48')]=intUtil[_0x01a0('0x47')](_0x36ed37[_0x01a0('0x48')]);if(_0x4c74ca&&_0x4c74ca[_0x01a0('0x49')]){logger[_0x01a0('0xb')]('['+_0x3cf9ef['lastevent'][_0x01a0('0x6b')]()+']',_0x01a0('0x4b'));_0x3cf9ef[_0x01a0('0x4c')]=util[_0x01a0('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x36ed37['serverUrl'],_0x3cf9ef[_0x01a0('0x4e')],md5(_0x3cf9ef[_0x01a0('0x4e')]));}else{_0x3cf9ef['recordingURL']='';}headers[_0x01a0('0x66')]=getAuth(_0x36ed37);return getUser(_0x36ed37)['then'](function(_0x1fcd94){_0x75148b=_0x1fcd94;logger[_0x01a0('0xb')](_0x01a0('0x50'),_0x75148b['id']);return getEndUser(_0x36ed37,_0x3cf9ef[_0x01a0('0x51')],_0x3cf9ef['calleridnum']);})[_0x01a0('0x22')](function(_0x5dbc67){_0x3b59bc=_0x5dbc67;logger[_0x01a0('0xb')](_0x01a0('0x53'),_0x3b59bc['id']);return getTicket(_0x36ed37,_0x75148b,_0x3b59bc,_0x2c78d2,_0x3cf9ef);})['then'](function(_0x474a57){if(_0x474a57){logger['info'](_0x01a0('0x54'),_0x474a57['id']);}})[_0x01a0('0x5f')](function(_0x47539e){logger[_0x01a0('0x60')]('['+_0x3cf9ef[_0x01a0('0x6c')][_0x01a0('0x6b')]()+']'+_0x01a0('0x6d'),util['inspect'](_0x47539e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe40c=['../../../../config/logger','zendesk','redis','emit','application/json','Creating\x20new\x20ticket...','format','POST','merge','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','info','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','Agent\x20found!','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','forEach','includes','string','picklist','nameField','customField','content','type','idField','variable','variableName','custom_fields','push','customVariable','Variable','toLowerCase','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:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','destcalleridname','newTab','trigger:browser:url','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','../../../../config/environment'];(function(_0x3b47eb,_0x1162e9){var _0x3073b4=function(_0x2118ee){while(--_0x2118ee){_0x3b47eb['push'](_0x3b47eb['shift']());}};_0x3073b4(++_0x1162e9);}(_0xe40c,0xd7));var _0xce40=function(_0x49e68f,_0x21fa6b){_0x49e68f=_0x49e68f-0x0;var _0x351589=_0xe40c[_0x49e68f];return _0x351589;};'use strict';var _=require('lodash');var rp=require(_0xce40('0x0'));var md5=require(_0xce40('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xce40('0x2'));var logger=require(_0xce40('0x3'))(_0xce40('0x4'));config[_0xce40('0x5')]=_['defaults'](config[_0xce40('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xce40('0x5')]));function emit(_0x99b432,_0x4a4e23,_0x2544fe){io['to'](_0x99b432)[_0xce40('0x6')](_0x4a4e23,_0x2544fe);}var headers={'Content-Type':_0xce40('0x7'),'Accept':_0xce40('0x7')};function getTicket(_0x421812,_0x2d7815,_0xd8afd,_0x21d29b,_0x572d28){logger['info'](_0xce40('0x8'));return request({'uri':util[_0xce40('0x9')]('%s/tickets.json',_0x421812['remoteUri']),'method':_0xce40('0xa'),'body':{'ticket':_[_0xce40('0xb')]({'requester_id':_0xd8afd['id'],'submitter_id':_0x2d7815?_0x2d7815['id']:undefined,'assignee_id':_0x2d7815?_0x2d7815['id']:undefined,'tags':getTags(_0x21d29b['Tags'],_0xce40('0xc')),'subject':intUtil[_0xce40('0xd')](_0x21d29b[_0xce40('0xe')],_0x572d28,'\x20'),'description':intUtil[_0xce40('0xd')](_0x21d29b[_0xce40('0xf')],_0x572d28,'\x0a'),'comment':{'public':![],'body':intUtil[_0xce40('0xd')](_0x21d29b[_0xce40('0xf')],_0x572d28,'\x0a')}},getCustomFields(_0x21d29b['Fields'],_0x572d28))}})[_0xce40('0x10')](function(_0x5677b2){logger['info'](_0xce40('0x11'));return _0x5677b2[_0xce40('0x12')];});}function getUser(_0x17a68b,_0x57be94){if(intUtil[_0xce40('0x13')](_0x57be94)){logger[_0xce40('0x14')]('Getting\x20agent\x20with\x20email',_0x57be94);return request({'uri':util[_0xce40('0x9')](_0xce40('0x15'),_0x17a68b[_0xce40('0x16')]),'qs':{'query':util[_0xce40('0x9')](_0xce40('0x17'),_0x57be94)}})['then'](function(_0x564322){if(_0x564322['count']){logger[_0xce40('0x14')](_0xce40('0x18'));return _['find'](_0x564322['results'],{'email':_0x57be94,'role':_0xce40('0x19')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xce40('0x9')](_0xce40('0x1a'),_0x17a68b[_0xce40('0x16')])})['then'](function(_0x437787){logger['info'](_0xce40('0x1b'));return _0x437787[_0xce40('0x1c')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xce40('0x9')](_0xce40('0x1a'),_0x17a68b[_0xce40('0x16')])})[_0xce40('0x10')](function(_0x238fd2){logger[_0xce40('0x14')]('Admin\x20account\x20selected.');return _0x238fd2[_0xce40('0x1c')];});}}function getEndUser(_0x5acc71,_0x57fc46,_0x5f182d){logger['info'](_0xce40('0x1d'),_0x5f182d);return request({'uri':util[_0xce40('0x9')]('%s/search.json',_0x5acc71[_0xce40('0x16')]),'qs':{'query':util[_0xce40('0x9')](_0xce40('0x1e'),_0x5f182d)}})[_0xce40('0x10')](function(_0x2e915f){var _0x4b709e;if(_0x2e915f[_0xce40('0x1f')][_0xce40('0x20')]){_0x2e915f[_0xce40('0x1f')]=_[_0xce40('0x21')](_0x2e915f[_0xce40('0x1f')],{'suspended':![],'role':_0xce40('0x22')});if(_0x2e915f['results'][_0xce40('0x20')]){_0x4b709e=_[_0xce40('0x23')](_0x2e915f['results']);}}if(_0x4b709e){logger[_0xce40('0x14')]('Enduser\x20found!');return _0x4b709e;}else{logger[_0xce40('0x14')](_0xce40('0x24'));return request({'uri':util['format'](_0xce40('0x25'),_0x5acc71['remoteUri']),'method':_0xce40('0xa'),'body':{'user':{'role':_0xce40('0x22'),'name':util[_0xce40('0x9')](_0xce40('0x26'),_0x57fc46||_0x5f182d),'phone':_0x5f182d}}})['then'](function(_0xca3fe6){logger[_0xce40('0x14')](_0xce40('0x27'));return _0xca3fe6['user'];});}});}function getAuth(_0x237e05){var _0x3b1697;if(_0x237e05['authType']===_0xce40('0x28')){_0x3b1697=util[_0xce40('0x9')](_0xce40('0x29'),_0x237e05[_0xce40('0x2a')],_0x237e05[_0xce40('0x28')]);}else if(_0x237e05[_0xce40('0x2b')]===_0xce40('0x2c')){_0x3b1697=util[_0xce40('0x9')](_0xce40('0x2d'),_0x237e05[_0xce40('0x2a')],_0x237e05[_0xce40('0x2c')]);}return util[_0xce40('0x9')](_0xce40('0x2e'),new Buffer(_0x3b1697)[_0xce40('0x2f')](_0xce40('0x30')));}function request(_0x3c26ce){logger[_0xce40('0x31')](_0xce40('0x32'),JSON[_0xce40('0x33')](_0x3c26ce));return rp(_[_0xce40('0x34')](_0x3c26ce,{'method':_0xce40('0x35'),'headers':headers,'json':!![]}));}function getTags(_0xb18af0,_0x5c8b80){var _0x212e79=[];if(_0xb18af0&&_0xb18af0[_0xce40('0x20')]>0x0){_0x212e79=_['map'](_0xb18af0,_0x5c8b80);}return _0x212e79;}function getCustomFields(_0x50f771,_0x5a6184){var _0x4a31e9=[];var _0x2cb365={'custom_fields':[]};if(_0x50f771[_0xce40('0x20')]>0x0){_[_0xce40('0x36')](_0x50f771,function(_0x5f08dd){if(_[_0xce40('0x37')]([_0xce40('0x38'),_0xce40('0x39')],_0x5f08dd['type'])&&_0x5f08dd[_0xce40('0x3a')]&&!_0x5f08dd[_0xce40('0x3b')]){_0x2cb365[_0x5f08dd[_0xce40('0x3a')]['toLowerCase']()]=_0x5f08dd[_0xce40('0x3c')][_0xce40('0x2f')]();}else if(_['includes']([_0xce40('0x38'),'picklist'],_0x5f08dd[_0xce40('0x3d')])&&_0x5f08dd[_0xce40('0x3e')]&&_0x5f08dd[_0xce40('0x3b')]){_0x2cb365['custom_fields']['push']({'id':_0x5f08dd['idField'],'value':_0x5f08dd[_0xce40('0x3c')][_0xce40('0x2f')]()});}else if(_0x5f08dd[_0xce40('0x3d')]===_0xce40('0x3f')&&_0x5f08dd[_0xce40('0x40')]&&_0x5f08dd[_0xce40('0x3e')]&&_0x5f08dd[_0xce40('0x3b')]){_0x5a6184[_0x5f08dd[_0xce40('0x40')]]&&_0x2cb365[_0xce40('0x41')][_0xce40('0x42')]({'id':_0x5f08dd[_0xce40('0x3e')],'value':_0x5a6184[_0x5f08dd['variableName']][_0xce40('0x2f')]()});}else if(_0x5f08dd[_0xce40('0x3d')]===_0xce40('0x43')&&_0x5f08dd[_0xce40('0x44')]&&_0x5f08dd[_0xce40('0x44')][_0xce40('0xc')]&&_0x5f08dd[_0xce40('0x3e')]&&_0x5f08dd['customField']){_0x5a6184[_0x5f08dd['Variable']['name'][_0xce40('0x45')]()]&&_0x2cb365[_0xce40('0x41')][_0xce40('0x42')]({'id':_0x5f08dd[_0xce40('0x3e')],'value':_0x5a6184[_0x5f08dd['Variable']['name'][_0xce40('0x45')]()]['toString']()});}});}return _0x2cb365;}exports[_0xce40('0x46')]=function(_0x34c66f,_0x94b3b5,_0x3bfac7,_0x2746bb,_0x16e263,_0x3d471e){var _0xf937e5,_0x462978;_0x3d471e['remoteUri']=intUtil[_0xce40('0x47')](_0x3d471e[_0xce40('0x16')]);_0x3d471e[_0xce40('0x48')]=intUtil[_0xce40('0x47')](_0x3d471e[_0xce40('0x48')]);if(_0x16e263&&_0x16e263[_0xce40('0x49')]){logger['info'](_0xce40('0x4a'),_0xce40('0x4b'));_0x94b3b5['recordingURL']=util[_0xce40('0x9')](_0xce40('0x4c'),_0x3d471e['serverUrl'],_0x94b3b5[_0xce40('0x4d')],md5(_0x94b3b5[_0xce40('0x4d')]));}else{_0x94b3b5[_0xce40('0x4e')]='';}headers[_0xce40('0x4f')]=getAuth(_0x3d471e);return getUser(_0x3d471e,_0x2746bb[_0xce40('0x50')])[_0xce40('0x10')](function(_0x45e1c4){_0xf937e5=_0x45e1c4;logger['info'](_0xce40('0x51'),_0xf937e5['id']);return getEndUser(_0x3d471e,_0x94b3b5[_0xce40('0x52')],_0x94b3b5[_0xce40('0x53')]);})[_0xce40('0x10')](function(_0x14e8df){_0x462978=_0x14e8df;logger['info'](_0xce40('0x54'),_0x462978['id']);return getTicket(_0x3d471e,_0xf937e5,_0x462978,_0x3bfac7,_0x94b3b5);})[_0xce40('0x10')](function(_0x3ce223){if(_0x3ce223){logger[_0xce40('0x14')]('The\x20Ticket\x20ID\x20is:',_0x3ce223['id']);switch(_0x3d471e[_0xce40('0x3d')]){case _0xce40('0x55'):logger[_0xce40('0x14')]('[QUEUE]',_0xce40('0x56'));return request({'uri':util[_0xce40('0x9')](_0xce40('0x57'),_0x3d471e[_0xce40('0x16')],_0xf937e5['id'],_0x3ce223['id']),'method':_0xce40('0xa')});case'newTab':logger[_0xce40('0x14')](_0xce40('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xce40('0x9')](_0xce40('0x58'),_0x2746bb['name']),'trigger:browser:url',{'uri':util[_0xce40('0x9')](_0xce40('0x59'),_0x3d471e[_0xce40('0x16')]['replace'](_0xce40('0x5a'),''),_0x3ce223['id'])});break;default:logger['error'](_0xce40('0x4a'),_0xce40('0x5b'));}}})[_0xce40('0x5c')](function(_0x815903){logger[_0xce40('0x5d')](_0xce40('0x5e'),util[_0xce40('0x5f')](_0x815903,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x500bcf,_0x1f9a62,_0x5bc133,_0x36d3e7,_0x17476b,_0x3aa87a,_0x312a38){var _0x2fba91,_0x50a207;_0x3aa87a[_0xce40('0x16')]=intUtil[_0xce40('0x47')](_0x3aa87a[_0xce40('0x16')]);_0x3aa87a['serverUrl']=intUtil[_0xce40('0x47')](_0x3aa87a[_0xce40('0x48')]);if(_0x312a38&&_0x312a38['recordingFormat']&&_0x312a38[_0xce40('0x60')]!==_0xce40('0x61')){logger[_0xce40('0x14')](_0xce40('0x62'),_0xce40('0x4b'));_0x1f9a62['recordingURL']=util['format'](_0xce40('0x4c'),_0x3aa87a[_0xce40('0x48')],_0x1f9a62['uniqueid'],md5(_0x1f9a62['uniqueid']));}headers[_0xce40('0x4f')]=getAuth(_0x3aa87a);return getUser(_0x3aa87a,_0x36d3e7[_0xce40('0x50')])['then'](function(_0x3f8749){_0x2fba91=_0x3f8749;logger[_0xce40('0x14')]('The\x20User\x20ID\x20is:',_0x2fba91['id']);return getEndUser(_0x3aa87a,_0x1f9a62[_0xce40('0x63')],_0x1f9a62['destcalleridnum']);})[_0xce40('0x10')](function(_0x4b5a78){_0x50a207=_0x4b5a78;logger[_0xce40('0x14')](_0xce40('0x54'),_0x50a207['id']);return getTicket(_0x3aa87a,_0x2fba91,_0x50a207,_0x5bc133,_0x1f9a62);})[_0xce40('0x10')](function(_0x1860f2){if(_0x1860f2){logger[_0xce40('0x14')]('The\x20Ticket\x20ID\x20is:',_0x1860f2['id']);switch(_0x3aa87a['type']){case'integrationTab':logger['info']('[OUTBOUND]',_0xce40('0x56'));return request({'uri':util['format'](_0xce40('0x57'),_0x3aa87a[_0xce40('0x16')],_0x2fba91['id'],_0x1860f2['id']),'method':_0xce40('0xa')});case _0xce40('0x64'):logger[_0xce40('0x14')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x36d3e7[_0xce40('0xc')]),_0xce40('0x65'),{'uri':util['format'](_0xce40('0x59'),_0x3aa87a[_0xce40('0x16')][_0xce40('0x66')](_0xce40('0x5a'),''),_0x1860f2['id'])});break;default:logger[_0xce40('0x5d')](_0xce40('0x62'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xce40('0x5c')](function(_0x20b4e0){logger['error'](_0xce40('0x67'),util[_0xce40('0x5f')](_0x20b4e0,{'showHidden':!![],'depth':null}));});};exports[_0xce40('0x68')]=function(_0xb78dc5,_0x1032a8,_0x47da06,_0x3410f9,_0x1f83ec,_0x34c42a){var _0x3c7b75,_0x101978;_0x34c42a['remoteUri']=intUtil['stripTrailingSlash'](_0x34c42a[_0xce40('0x16')]);_0x34c42a[_0xce40('0x48')]=intUtil[_0xce40('0x47')](_0x34c42a['serverUrl']);if(_0x1f83ec&&_0x1f83ec[_0xce40('0x49')]){logger['info']('['+_0x1032a8[_0xce40('0x69')]['toUpperCase']()+']',_0xce40('0x4b'));_0x1032a8[_0xce40('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34c42a[_0xce40('0x48')],_0x1032a8[_0xce40('0x4d')],md5(_0x1032a8[_0xce40('0x4d')]));}else{_0x1032a8[_0xce40('0x4e')]='';}headers[_0xce40('0x4f')]=getAuth(_0x34c42a);return getUser(_0x34c42a)['then'](function(_0x57f278){_0x3c7b75=_0x57f278;logger[_0xce40('0x14')](_0xce40('0x51'),_0x3c7b75['id']);return getEndUser(_0x34c42a,_0x1032a8[_0xce40('0x52')],_0x1032a8[_0xce40('0x53')]);})['then'](function(_0x14c0c5){_0x101978=_0x14c0c5;logger[_0xce40('0x14')](_0xce40('0x54'),_0x101978['id']);return getTicket(_0x34c42a,_0x3c7b75,_0x101978,_0x47da06,_0x1032a8);})[_0xce40('0x10')](function(_0x5ad64c){if(_0x5ad64c){logger[_0xce40('0x14')](_0xce40('0x6a'),_0x5ad64c['id']);}})[_0xce40('0x5c')](function(_0x5d9854){logger[_0xce40('0x5d')]('['+_0x1032a8[_0xce40('0x69')][_0xce40('0x6b')]()+']'+_0xce40('0x6c'),util[_0xce40('0x5f')](_0x5d9854,{'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 e8bc006..56453d6 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 _0x8ce3=['outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','zoho.eu','The\x20User\x20ID\x20is:','destcalleridname','Outbound','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','lodash','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','refresh_token','then','add','seconds','catch','error','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','info','Agent\x20found!','findIndex','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','details','enduserType','moduleCreate','Error:\x20','CREATE\x20ERROR','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Owner','administrator','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','Timeout'];(function(_0x1c1e1c,_0xd63caa){var _0x30bcb8=function(_0x5d848c){while(--_0x5d848c){_0x1c1e1c['push'](_0x1c1e1c['shift']());}};_0x30bcb8(++_0xd63caa);}(_0x8ce3,0xc3));var _0x38ce=function(_0x557a30,_0x433df5){_0x557a30=_0x557a30-0x0;var _0x2bf5f6=_0x8ce3[_0x557a30];return _0x2bf5f6;};'use strict';var _=require(_0x38ce('0x0'));var rp=require(_0x38ce('0x1'));var md5=require('md5');var util=require(_0x38ce('0x2'));var intUtil=require(_0x38ce('0x3'));var moment=require(_0x38ce('0x4'));var Redis=require(_0x38ce('0x5'));var BPromise=require(_0x38ce('0x6'));var config=require(_0x38ce('0x7'));var logger=require(_0x38ce('0x8'))(_0x38ce('0x9'));config['redis']=_[_0x38ce('0xa')](config[_0x38ce('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x38ce('0xc'))(new Redis(config[_0x38ce('0xb')]));function emit(_0x3f8011,_0x482955,_0x3c66e5){io['to'](_0x3f8011)['emit'](_0x482955,_0x3c66e5);}function request(_0x725d27){logger['debug'](_0x38ce('0xd'),JSON[_0x38ce('0xe')](_0x725d27));return rp(_0x725d27);}function getCustomFields(_0xa9931b,_0x2c0cab){var _0x564332={};if(_0xa9931b[_0x38ce('0xf')]>0x0){_[_0x38ce('0x10')](_0xa9931b,function(_0x171a02){if(_[_0x38ce('0x11')]([_0x38ce('0x12'),_0x38ce('0x13')],_0x171a02[_0x38ce('0x14')])&&_0x171a02[_0x38ce('0x15')]){_0x564332[_0x171a02[_0x38ce('0x15')]]=_0x171a02[_0x38ce('0x16')][_0x38ce('0x17')]();}else if(_0x171a02['type']==='variable'&&_0x171a02[_0x38ce('0x18')]&&_0x171a02[_0x38ce('0x15')]&&_0x2c0cab[_0x171a02[_0x38ce('0x18')]]){_0x564332[_0x171a02['idField']]=_0x2c0cab[_0x171a02[_0x38ce('0x18')]]['toString']();}else if(_0x171a02[_0x38ce('0x14')]===_0x38ce('0x19')&&_0x171a02['Variable']&&_0x171a02[_0x38ce('0x1a')][_0x38ce('0x1b')]&&_0x171a02[_0x38ce('0x15')]&&_0x2c0cab[_0x171a02['Variable'][_0x38ce('0x1b')][_0x38ce('0x1c')]()]){_0x564332[_0x171a02[_0x38ce('0x15')]]=_0x2c0cab[_0x171a02[_0x38ce('0x1a')][_0x38ce('0x1b')][_0x38ce('0x1c')]()][_0x38ce('0x17')]();}});}return _0x564332;}function getName(_0x518b04){if(_0x518b04[_0x38ce('0x1d')]('\x20')>0x0){var _0x34a8c7=_0x518b04[_0x38ce('0x1e')](/ (.+)/);if(_0x34a8c7[0x1]){return _0x34a8c7;}}return[_0x518b04,_0x518b04];}var accountsTokens={};function getAccessToken(_0x303391){return new Promise(function(_0x30b060,_0x434c31){if(!_[_0x38ce('0x1f')](accountsTokens[_0x303391['id']])&&!_[_0x38ce('0x1f')](accountsTokens[_0x303391['id']][_0x38ce('0x20')])){if(moment()[_0x38ce('0x21')](accountsTokens[_0x303391['id']][_0x38ce('0x22')])){_0x30b060(accountsTokens[_0x303391['id']]['access_token']);}}var _0x1cc10b;switch(_0x303391[_0x38ce('0x23')]){case'US':_0x1cc10b=_0x38ce('0x24');break;case'AU':_0x1cc10b=_0x38ce('0x25');break;case'EU':_0x1cc10b='https://accounts.zoho.eu';break;case'IN':_0x1cc10b=_0x38ce('0x26');break;case'CN':_0x1cc10b=_0x38ce('0x27');break;default:_0x1cc10b='https://accounts.zoho.eu';break;}var _0xe0af00={'method':_0x38ce('0x28'),'uri':_0x1cc10b+_0x38ce('0x29'),'qs':{'refresh_token':_0x303391['refreshToken'],'client_id':_0x303391['clientId'],'client_secret':_0x303391[_0x38ce('0x2a')],'grant_type':_0x38ce('0x2b')},'json':!![]};return rp(_0xe0af00)[_0x38ce('0x2c')](function(_0x21d4e7){accountsTokens[_0x303391['id']]={'access_token':_0x21d4e7[_0x38ce('0x20')],'expires_in':moment()[_0x38ce('0x2d')](_0x21d4e7[_0x38ce('0x22')],_0x38ce('0x2e'))};_0x30b060(_0x21d4e7[_0x38ce('0x20')]);})[_0x38ce('0x2f')](function(_0xfc590a){logger[_0x38ce('0x30')]('Failing\x20creating\x20the\x20access_token',_0xfc590a[_0x38ce('0x31')]);_0x434c31(_0xfc590a);});});}function getUser(_0x1538a0,_0x5b4a7a,_0x229ac2,_0x3cbead){logger['info'](_0x38ce('0x32'));return request({'method':_0x38ce('0x33'),'uri':util['format'](_0x38ce('0x34'),_0x5b4a7a),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x38ce('0x35')+_0x1538a0},'json':!![]})[_0x38ce('0x2c')](function(_0x27a9af){if(_0x27a9af[_0x38ce('0x36')]){var _0x444b93=-0x1;if(_[_0x38ce('0x37')](_0x27a9af[_0x38ce('0x36')])){if(!_[_0x38ce('0x1f')](_0x3cbead)){_0x444b93=_['findIndex'](_0x27a9af['users'],function(_0x469b65){return _0x469b65[_0x38ce('0x38')]===_0x3cbead;});}if(_0x444b93>=0x0){logger[_0x38ce('0x39')](_0x38ce('0x3a'));}else{logger[_0x38ce('0x39')]('Using\x20the\x20admin\x20account!');_0x444b93=_[_0x38ce('0x3b')](_0x27a9af[_0x38ce('0x36')],function(_0x37f696){return _0x37f696[_0x38ce('0x3c')][_0x38ce('0x1b')]===_0x38ce('0x3d');});}return _0x27a9af[_0x38ce('0x36')][_0x444b93];}else{if(_0x27a9af['user'][_0x38ce('0x3c')][_0x38ce('0x1b')]==='Administrator'){logger[_0x38ce('0x39')](_0x38ce('0x3e'));user=_0x27a9af[_0x38ce('0x3f')];return user;}else{logger[_0x38ce('0x30')](_0x38ce('0x40'),JSON[_0x38ce('0xe')](_0x27a9af));throw new Error(_0x38ce('0x41')+JSON[_0x38ce('0xe')](_0x27a9af));}}}else{logger['error'](_0x38ce('0x40'),JSON[_0x38ce('0xe')](_0x27a9af));throw new Error(_0x38ce('0x41')+JSON[_0x38ce('0xe')](_0x27a9af));}})['catch'](function(_0x1537c7){console['error'](_0x1537c7);});}function getZohoUser(_0x18cf70,_0x33bbc8){return new BPromise(function(_0x27ebe0,_0x17a5d7){request(_0x18cf70)[_0x38ce('0x2c')](function(_0x1b9601){var _0x4a6d2b=null;if(_0x1b9601){_0x4a6d2b=_0x1b9601[_0x38ce('0x42')][0x0];_0x4a6d2b['enduserType']=_0x33bbc8;}_0x27ebe0(_0x4a6d2b);})[_0x38ce('0x2f')](function(_0x986a18){_0x17a5d7(_0x986a18);});});}function createEndUser(_0x420367,_0x37b738,_0x277e94,_0x1476e9,_0x5209ee,_0x14fb63){var _0x277e94=getName(_0x277e94);return request({'method':_0x38ce('0x28'),'uri':_0x38ce('0x43')+_0x37b738+_0x38ce('0x44')+_[_0x38ce('0x45')](_0x14fb63['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x277e94[0x1],'First_Name':_0x277e94[0x0],'Phone':_0x1476e9,'Owner':{'name':!_['isNil'](_0x5209ee[_0x38ce('0x46')][_0x38ce('0x1b')])?_0x5209ee[_0x38ce('0x46')][_0x38ce('0x1b')]:!_[_0x38ce('0x1f')](_0x5209ee[_0x38ce('0x47')])?_0x5209ee[_0x38ce('0x47')]+'\x20'+_0x5209ee['last_name']:_0x5209ee[_0x38ce('0x48')],'id':_0x5209ee['id']}}]},'headers':{'Authorization':_0x38ce('0x35')+_0x420367},'json':!![]})['then'](function(_0x185b8b){if(_0x185b8b&&_0x185b8b[_0x38ce('0x42')][0x0][_0x38ce('0x49')]==='SUCCESS'){var _0xaf99ce=_0x185b8b[_0x38ce('0x42')][0x0][_0x38ce('0x4a')];_0xaf99ce[_0x38ce('0x4b')]=_[_0x38ce('0x45')](_0x14fb63[_0x38ce('0x4c')])+'s';return _0xaf99ce;}logger['error'](_0x38ce('0x40'),JSON[_0x38ce('0xe')](data));throw new Error(_0x38ce('0x4d')+JSON[_0x38ce('0xe')](data));})[_0x38ce('0x2f')](function(_0x6cf4d9){console['log'](_0x38ce('0x4e'),_0x6cf4d9);});}function getEndUser(_0x1847e5,_0x54e524,_0x502430,_0x5833a2,_0x407e3f,_0xdb1812,_0x58e80d){var _0x56b21e={'method':_0x38ce('0x33'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1847e5},'json':!![]};switch(_0x58e80d[_0x38ce('0x4f')]){case'contact_lead':_0x56b21e[_0x38ce('0x50')]=_0x38ce('0x43')+_0x54e524+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x407e3f+'))';return getZohoUser(_0x56b21e,_0x38ce('0x51'))[_0x38ce('0x2c')](function(_0x507d40){if(_0x507d40)return _0x507d40;_0x56b21e[_0x38ce('0x50')]=_0x38ce('0x43')+_0x54e524+_0x38ce('0x52')+_0x407e3f+'))';return getZohoUser(_0x56b21e,_0x38ce('0x53'))[_0x38ce('0x2c')](function(_0x25a299){if(_0x25a299)return _0x25a299;if(_0x58e80d['moduleCreate']!=_0x38ce('0x54')){return createEndUser(_0x1847e5,_0x54e524,_0x5833a2,_0x407e3f,_0xdb1812,_0x58e80d);}else{return{};}});});break;case _0x38ce('0x55'):_0x56b21e['uri']=_0x38ce('0x43')+_0x54e524+_0x38ce('0x56')+_0x407e3f+'))';return getZohoUser(_0x56b21e,_0x38ce('0x51'))[_0x38ce('0x2c')](function(_0x9c0a67){if(_0x9c0a67)return _0x9c0a67;if(_0x58e80d[_0x38ce('0x4c')]!=_0x38ce('0x54')){return createEndUser(_0x1847e5,_0x54e524,_0x5833a2,_0x407e3f,_0xdb1812,_0x58e80d);}else{return{};}});break;case'lead':_0x56b21e[_0x38ce('0x50')]=_0x38ce('0x43')+_0x54e524+_0x38ce('0x52')+_0x407e3f+'))';return getZohoUser(_0x56b21e,_0x38ce('0x53'))[_0x38ce('0x2c')](function(_0x212083){if(_0x212083)return _0x212083;if(_0x58e80d['moduleCreate']!='nothing'){return createEndUser(_0x1847e5,_0x54e524,_0x5833a2,_0x407e3f,_0xdb1812,_0x58e80d);}else{return{};}});break;}}function getCall(_0xc2c9d3,_0x13acb4,_0x2f935f,_0x12f46f,_0x3547b6,_0x1da744,_0x4dc83e,_0x522b38){logger[_0x38ce('0x39')]('Creating\x20new\x20call...');var _0x5a2348={};_0x5a2348[_0x38ce('0x57')]={'name':!_[_0x38ce('0x1f')](_0x12f46f[_0x38ce('0x46')][_0x38ce('0x1b')])&&!_[_0x38ce('0x1f')](_0x12f46f['profile'][_0x38ce('0x1b')])&&_0x12f46f[_0x38ce('0x3c')][_0x38ce('0x1b')]===_0x38ce('0x58')?_0x12f46f[_0x38ce('0x46')][_0x38ce('0x1b')]:!_[_0x38ce('0x1f')](_0x12f46f[_0x38ce('0x47')])?_0x12f46f[_0x38ce('0x47')]+'\x20'+_0x12f46f[_0x38ce('0x48')]:_0x12f46f[_0x38ce('0x48')],'id':_0x12f46f['id']};_0x5a2348['Subject']=intUtil['getString'](_0x1da744[_0x38ce('0x59')],_0x4dc83e,'\x20');_0x5a2348[_0x38ce('0x5a')]=intUtil[_0x38ce('0x5b')](_0x1da744[_0x38ce('0x5c')],_0x4dc83e,'\x0a');if(_0x3547b6['enduserType']===_0x38ce('0x51')){_0x5a2348[_0x38ce('0x5d')]={'name':!_[_0x38ce('0x1f')](_0x3547b6[_0x38ce('0x5e')])?_0x3547b6[_0x38ce('0x5e')]:!_[_0x38ce('0x1f')](_0x3547b6[_0x38ce('0x5f')])?_0x3547b6['First_Name']+'\x20'+_0x3547b6[_0x38ce('0x60')]:_0x3547b6[_0x38ce('0x60')],'id':_0x3547b6['id']};}if(_0x3547b6['enduserType']==='Leads'){_0x5a2348[_0x38ce('0x61')]={'name':!_[_0x38ce('0x1f')](_0x3547b6[_0x38ce('0x5e')])?_0x3547b6['Full_Name']:!_['isNil'](_0x3547b6[_0x38ce('0x5f')])?_0x3547b6['First_Name']+'\x20'+_0x3547b6[_0x38ce('0x60')]:_0x3547b6[_0x38ce('0x60')],'id':_0x3547b6['id']};_0x5a2348[_0x38ce('0x62')]=_[_0x38ce('0x45')](_0x3547b6['enduserType']);}if(_0x4dc83e[_0x38ce('0x63')]){_0x5a2348[_0x38ce('0x64')]=moment[_0x38ce('0x65')](parseInt(_0x4dc83e['talktime'])*0x3e8)[_0x38ce('0x66')](_0x38ce('0x67'));}else if(_0x4dc83e[_0x38ce('0x68')]&&_0x4dc83e['endtime']){_0x5a2348[_0x38ce('0x64')]=moment['utc'](moment(_0x4dc83e[_0x38ce('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0x38ce('0x6a')](moment(_0x4dc83e[_0x38ce('0x6b')],_0x38ce('0x6c'))))[_0x38ce('0x66')]('mm:ss');}switch(_0x4dc83e[_0x38ce('0x6d')]){case _0x38ce('0x6e'):_0x5a2348[_0x38ce('0x6f')]=_0x38ce('0x70');break;case _0x38ce('0x71'):case _0x38ce('0x72'):_0x5a2348['Call_Result']=_0x38ce('0x73');break;case'rejected':_0x5a2348[_0x38ce('0x6f')]=_0x38ce('0x74');break;case _0x38ce('0x75'):_0x5a2348[_0x38ce('0x6f')]=_0x38ce('0x76');break;case _0x38ce('0x77'):_0x5a2348[_0x38ce('0x6f')]=_0x38ce('0x78');default:}_0x5a2348['Call_Start_Time']=(_0x522b38===_0x38ce('0x79')?moment(_0x4dc83e[_0x38ce('0x6b')])[_0x38ce('0x66')](_0x38ce('0x6c')):moment(_0x4dc83e[_0x38ce('0x7a')])[_0x38ce('0x66')](_0x38ce('0x6c')))||moment()[_0x38ce('0x66')](_0x38ce('0x6c'));_0x5a2348[_0x38ce('0x7b')]=_0x522b38||_0x38ce('0x7c');_0x5a2348=_[_0x38ce('0x7d')](_0x5a2348,getCustomFields(_0x1da744[_0x38ce('0x7e')],_0x4dc83e));return request({'method':_0x38ce('0x28'),'uri':_0x38ce('0x43')+_0x13acb4+_0x38ce('0x7f'),'headers':{'Authorization':_0x38ce('0x35')+_0xc2c9d3},'body':{'data':[_0x5a2348]},'json':!![]})[_0x38ce('0x2c')](function(_0x2db3c5){if(_0x2db3c5&&_0x2db3c5[_0x38ce('0x42')][0x0]['code']===_0x38ce('0x80')){logger[_0x38ce('0x39')](_0x38ce('0x81'));return{'id':_0x2db3c5['data'][0x0]['details']['id']};}})[_0x38ce('0x2f')](function(_0x220036){logger['info'](_0x38ce('0x82'),_0x220036[_0x38ce('0x31')]);console['log']('err',_0x220036);});}exports[_0x38ce('0x83')]=function(_0x24ccfe,_0x59741c,_0x157b3b,_0x2732ac,_0x158ba7,_0x182d59){var _0x1e6e90,_0x163d35,_0xbf5f2b;_0x182d59[_0x38ce('0x84')]=intUtil['stripTrailingSlash'](_0x182d59[_0x38ce('0x84')]);_0x182d59[_0x38ce('0x85')]=intUtil[_0x38ce('0x86')](_0x182d59[_0x38ce('0x85')]);if(_0x158ba7&&_0x158ba7[_0x38ce('0x87')]){logger[_0x38ce('0x39')](_0x38ce('0x88'),'Recording\x20is\x20enabled!');_0x59741c['recordingURL']=_0x182d59['serverUrl']+_0x38ce('0x89')+_0x59741c[_0x38ce('0x8a')]+_0x38ce('0x8b')+md5(_0x59741c[_0x38ce('0x8a')]);}else{_0x59741c[_0x38ce('0x8c')]='';}var _0x26ca11=_0x182d59[_0x38ce('0x84')]==='zoho.eu'?'eu':_0x38ce('0x8d');return getAccessToken(_0x182d59)['then'](function(_0x5893c7){_0xbf5f2b=_0x5893c7;return getUser(_0xbf5f2b,_0x26ca11,_0x182d59,_0x2732ac['email']);})[_0x38ce('0x2c')](function(_0x1025c0){_0x1e6e90=_0x1025c0;logger[_0x38ce('0x39')]('The\x20User\x20ID\x20is:',_0x1e6e90['id']);return getEndUser(_0xbf5f2b,_0x26ca11,_0x182d59,_0x59741c[_0x38ce('0x8e')],_0x59741c[_0x38ce('0x8f')],_0x1e6e90,_0x157b3b);})[_0x38ce('0x2c')](function(_0x1b5793){_0x163d35=_0x1b5793;return getCall(_0xbf5f2b,_0x26ca11,_0x182d59,_0x1e6e90,_0x163d35,_0x157b3b,_0x59741c,_0x38ce('0x7c'));})['then'](function(_0x19b414){if(_0x19b414){logger['info'](_0x38ce('0x90'),_0x19b414['id']);logger[_0x38ce('0x39')]('[QUEUE]',_0x38ce('0x91'));emit(util[_0x38ce('0x66')](_0x38ce('0x92'),_0x2732ac[_0x38ce('0x1b')]),'trigger:browser:url',{'uri':'https://crm.'+_0x182d59['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x19b414['id']});}})['catch'](function(_0x50b70d){logger[_0x38ce('0x30')](_0x38ce('0x88'),JSON[_0x38ce('0xe')](_0x50b70d));});};exports[_0x38ce('0x79')]=function(_0x524a4b,_0x5be2e5,_0x42fc72,_0x49584f,_0x2b34b2,_0x2ead23,_0x3f34f2){var _0xe2569e,_0x169fff,_0x387528;_0x2ead23[_0x38ce('0x84')]=intUtil[_0x38ce('0x86')](_0x2ead23[_0x38ce('0x84')]);_0x2ead23['serverUrl']=intUtil[_0x38ce('0x86')](_0x2ead23[_0x38ce('0x85')]);if(_0x3f34f2&&_0x3f34f2[_0x38ce('0x93')]&&_0x3f34f2['recordingFormat']!=='none'){logger['info'](_0x38ce('0x94'),_0x38ce('0x95'));_0x5be2e5[_0x38ce('0x8c')]=_0x2ead23[_0x38ce('0x85')]+_0x38ce('0x89')+_0x5be2e5[_0x38ce('0x8a')]+_0x38ce('0x8b')+md5(_0x5be2e5[_0x38ce('0x8a')]);}var _0x19e0a8=_0x2ead23[_0x38ce('0x84')]===_0x38ce('0x96')?'eu':_0x38ce('0x8d');return getAccessToken(_0x2ead23)[_0x38ce('0x2c')](function(_0x3500e5){_0x387528=_0x3500e5;return getUser(_0x387528,_0x19e0a8,_0x2ead23,_0x49584f[_0x38ce('0x38')]);})[_0x38ce('0x2c')](function(_0x2d7263){_0xe2569e=_0x2d7263;logger[_0x38ce('0x39')](_0x38ce('0x97'),_0xe2569e['id']);return getEndUser(_0x387528,_0x19e0a8,_0x2ead23,_0x5be2e5[_0x38ce('0x98')],_0x5be2e5['destcalleridnum'],_0xe2569e,_0x42fc72);})[_0x38ce('0x2c')](function(_0xe96ede){_0x169fff=_0xe96ede;return getCall(_0x387528,_0x19e0a8,_0x2ead23,_0xe2569e,_0x169fff,_0x42fc72,_0x5be2e5,_0x38ce('0x99'));})['then'](function(_0x385dc8){if(_0x385dc8){logger[_0x38ce('0x39')](_0x38ce('0x90'),_0x385dc8['id']);logger[_0x38ce('0x39')]('[OUTBOUND]',_0x38ce('0x91'));emit(util[_0x38ce('0x66')](_0x38ce('0x92'),_0x49584f[_0x38ce('0x1b')]),'trigger:browser:url',{'uri':_0x38ce('0x9a')+_0x2ead23[_0x38ce('0x84')]+_0x38ce('0x9b')+_0x385dc8['id']});}})[_0x38ce('0x2f')](function(_0xdbd6bc){logger[_0x38ce('0x30')](_0x38ce('0x94'),JSON[_0x38ce('0xe')](_0xdbd6bc));});};exports[_0x38ce('0x9c')]=function(_0x360484,_0x260a14,_0x2dc4e1,_0x4f81fa,_0xcf038b,_0x17081d){var _0x2d2186,_0x2ec653,_0x35d8f0;_0x17081d['host']=intUtil['stripTrailingSlash'](_0x17081d[_0x38ce('0x84')]);_0x17081d['serverUrl']=intUtil[_0x38ce('0x86')](_0x17081d[_0x38ce('0x85')]);if(_0xcf038b&&_0xcf038b['monitor_format']){logger[_0x38ce('0x39')]('['+_0x260a14[_0x38ce('0x6d')]['toUpperCase']()+']',_0x38ce('0x95'));_0x260a14[_0x38ce('0x8c')]=_0x17081d[_0x38ce('0x85')]+_0x38ce('0x89')+_0x260a14[_0x38ce('0x8a')]+_0x38ce('0x8b')+md5(_0x260a14['uniqueid']);}else{_0x260a14[_0x38ce('0x8c')]='';}var _0x2077ca=_0x17081d['host']==='zoho.eu'?'eu':_0x38ce('0x8d');return getAccessToken(_0x17081d)['then'](function(_0x26b55e){_0x35d8f0=_0x26b55e;return getUser(_0x35d8f0,_0x2077ca,_0x17081d);})[_0x38ce('0x2c')](function(_0x384d74){_0x2d2186=_0x384d74;logger[_0x38ce('0x39')](_0x38ce('0x97'),_0x2d2186['id']);return getEndUser(_0x35d8f0,_0x2077ca,_0x17081d,_0x260a14[_0x38ce('0x8e')],_0x260a14[_0x38ce('0x8f')],_0x2d2186,_0x2dc4e1);})['then'](function(_0x43dee2){_0x2ec653=_0x43dee2;return getCall(_0x35d8f0,_0x2077ca,_0x17081d,_0x2d2186,_0x2ec653,_0x2dc4e1,_0x260a14,_0x38ce('0x7c'));})[_0x38ce('0x2c')](function(_0x484561){if(_0x484561){logger[_0x38ce('0x39')]('The\x20Call\x20ID\x20is:',_0x484561['id']);}})[_0x38ce('0x2f')](function(_0x1a60ad){logger['error']('['+_0x260a14['lastevent'][_0x38ce('0x9d')]()+']',JSON['stringify'](_0x1a60ad));});}; \ No newline at end of file +var _0x70e0=['/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Owner','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','startCase','talktime','mm:ss','answertime','endtime','Call_Duration','utc','YYYY-MM-DDTHH:mm:ss','starttime','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','Call_Type','Inbound','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','https://crm.','unmanaged','lastevent','toUpperCase','zoho.eu','lodash','request-promise','md5','moment','ioredis','bluebird','../../../../config/environment','zoho','defaults','redis','emit','debug','length','forEach','includes','string','picklist','type','idField','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','email','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','SUCCESS','details','Error:\x20','CREATE\x20ERROR','GET','Zoho-oauthtoken\x20','moduleSearch','contact_lead'];(function(_0x4b7e40,_0x5ee50b){var _0x5381c6=function(_0x10e786){while(--_0x10e786){_0x4b7e40['push'](_0x4b7e40['shift']());}};_0x5381c6(++_0x5ee50b);}(_0x70e0,0x17b));var _0x070e=function(_0x96f77e,_0x25a292){_0x96f77e=_0x96f77e-0x0;var _0x5d1bc1=_0x70e0[_0x96f77e];return _0x5d1bc1;};'use strict';var _=require(_0x070e('0x0'));var rp=require(_0x070e('0x1'));var md5=require(_0x070e('0x2'));var util=require('util');var intUtil=require('./util');var moment=require(_0x070e('0x3'));var Redis=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var logger=require('../../../../config/logger')(_0x070e('0x7'));config['redis']=_[_0x070e('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x070e('0x9')]));function emit(_0x1e11f0,_0x604664,_0x2611e6){io['to'](_0x1e11f0)[_0x070e('0xa')](_0x604664,_0x2611e6);}function request(_0x68a09e){logger[_0x070e('0xb')]('[HTTP]',JSON['stringify'](_0x68a09e));return rp(_0x68a09e);}function getCustomFields(_0x50f4eb,_0x2e3e5e){var _0x12bb37={};if(_0x50f4eb[_0x070e('0xc')]>0x0){_[_0x070e('0xd')](_0x50f4eb,function(_0xffcdd6){if(_[_0x070e('0xe')]([_0x070e('0xf'),_0x070e('0x10')],_0xffcdd6[_0x070e('0x11')])&&_0xffcdd6[_0x070e('0x12')]){_0x12bb37[_0xffcdd6['idField']]=_0xffcdd6['content'][_0x070e('0x13')]();}else if(_0xffcdd6['type']==='variable'&&_0xffcdd6['variableName']&&_0xffcdd6[_0x070e('0x12')]&&_0x2e3e5e[_0xffcdd6[_0x070e('0x14')]]){_0x12bb37[_0xffcdd6['idField']]=_0x2e3e5e[_0xffcdd6['variableName']][_0x070e('0x13')]();}else if(_0xffcdd6[_0x070e('0x11')]===_0x070e('0x15')&&_0xffcdd6[_0x070e('0x16')]&&_0xffcdd6['Variable']['name']&&_0xffcdd6[_0x070e('0x12')]&&_0x2e3e5e[_0xffcdd6[_0x070e('0x16')][_0x070e('0x17')][_0x070e('0x18')]()]){_0x12bb37[_0xffcdd6[_0x070e('0x12')]]=_0x2e3e5e[_0xffcdd6['Variable'][_0x070e('0x17')][_0x070e('0x18')]()][_0x070e('0x13')]();}});}return _0x12bb37;}function getName(_0x3ea105){if(_0x3ea105[_0x070e('0x19')]('\x20')>0x0){var _0x5c16fd=_0x3ea105['split'](/ (.+)/);if(_0x5c16fd[0x1]){return _0x5c16fd;}}return[_0x3ea105,_0x3ea105];}var accountsTokens={};function getAccessToken(_0x4e958f){return new Promise(function(_0x9907cf,_0x3004f0){if(!_[_0x070e('0x1a')](accountsTokens[_0x4e958f['id']])&&!_['isNil'](accountsTokens[_0x4e958f['id']][_0x070e('0x1b')])){if(moment()['isBefore'](accountsTokens[_0x4e958f['id']][_0x070e('0x1c')])){_0x9907cf(accountsTokens[_0x4e958f['id']][_0x070e('0x1b')]);}}var _0x27a01e;switch(_0x4e958f[_0x070e('0x1d')]){case'US':_0x27a01e=_0x070e('0x1e');break;case'AU':_0x27a01e=_0x070e('0x1f');break;case'EU':_0x27a01e=_0x070e('0x20');break;case'IN':_0x27a01e=_0x070e('0x21');break;case'CN':_0x27a01e='https://accounts.zoho.com.cn';break;default:_0x27a01e=_0x070e('0x20');break;}var _0x270061={'method':_0x070e('0x22'),'uri':_0x27a01e+'/oauth/v2/token','qs':{'refresh_token':_0x4e958f[_0x070e('0x23')],'client_id':_0x4e958f['clientId'],'client_secret':_0x4e958f['clientSecret'],'grant_type':_0x070e('0x24')},'json':!![]};return rp(_0x270061)[_0x070e('0x25')](function(_0x41deb1){accountsTokens[_0x4e958f['id']]={'access_token':_0x41deb1[_0x070e('0x1b')],'expires_in':moment()[_0x070e('0x26')](_0x41deb1['expires_in'],_0x070e('0x27'))};_0x9907cf(_0x41deb1[_0x070e('0x1b')]);})[_0x070e('0x28')](function(_0x1d2a34){logger[_0x070e('0x29')](_0x070e('0x2a'),_0x1d2a34[_0x070e('0x2b')]);_0x3004f0(_0x1d2a34);});});}function getUser(_0x26373b,_0x5e8326,_0x282344,_0x351641){logger[_0x070e('0x2c')]('Search\x20user');return request({'method':'GET','uri':util[_0x070e('0x2d')](_0x070e('0x2e'),_0x5e8326),'qs':{'type':_0x070e('0x2f')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x26373b},'json':!![]})[_0x070e('0x25')](function(_0x1741a1){if(_0x1741a1[_0x070e('0x30')]){var _0x5f2bee=-0x1;if(_['isArrayLikeObject'](_0x1741a1['users'])){if(!_['isNil'](_0x351641)){_0x5f2bee=_['findIndex'](_0x1741a1[_0x070e('0x30')],function(_0x4e0a7d){return _0x4e0a7d[_0x070e('0x31')]===_0x351641;});}if(_0x5f2bee>=0x0){logger[_0x070e('0x2c')]('Agent\x20found!');}else{logger['info'](_0x070e('0x32'));_0x5f2bee=_[_0x070e('0x33')](_0x1741a1['users'],function(_0x546a16){return _0x546a16[_0x070e('0x34')][_0x070e('0x17')]===_0x070e('0x35');});}return _0x1741a1[_0x070e('0x30')][_0x5f2bee];}else{if(_0x1741a1[_0x070e('0x36')]['profile']['name']===_0x070e('0x35')){logger[_0x070e('0x2c')](_0x070e('0x32'));user=_0x1741a1[_0x070e('0x36')];return user;}else{logger[_0x070e('0x29')]('The\x20failing\x20result\x20is',JSON[_0x070e('0x37')](_0x1741a1));throw new Error(_0x070e('0x38')+JSON['stringify'](_0x1741a1));}}}else{logger[_0x070e('0x29')](_0x070e('0x39'),JSON['stringify'](_0x1741a1));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x1741a1));}})[_0x070e('0x28')](function(_0x3dfbf7){console[_0x070e('0x29')](_0x3dfbf7);});}function getZohoUser(_0x334733,_0x33c5f8){return new BPromise(function(_0x5e3827,_0x104048){request(_0x334733)[_0x070e('0x25')](function(_0xb53332){var _0x487276=null;if(_0xb53332){_0x487276=_0xb53332[_0x070e('0x3a')][0x0];_0x487276[_0x070e('0x3b')]=_0x33c5f8;}_0x5e3827(_0x487276);})[_0x070e('0x28')](function(_0x54b72f){_0x104048(_0x54b72f);});});}function createEndUser(_0x13982f,_0x348092,_0x4800a9,_0x173602,_0x5d689b,_0x18dae9){var _0x4800a9=getName(_0x4800a9);return request({'method':_0x070e('0x22'),'uri':_0x070e('0x3c')+_0x348092+_0x070e('0x3d')+_['startCase'](_0x18dae9[_0x070e('0x3e')])+'s','body':{'data':[{'Last_Name':_0x4800a9[0x1],'First_Name':_0x4800a9[0x0],'Phone':_0x173602,'Owner':{'name':!_['isNil'](_0x5d689b['role'][_0x070e('0x17')])?_0x5d689b[_0x070e('0x3f')][_0x070e('0x17')]:!_['isNil'](_0x5d689b[_0x070e('0x40')])?_0x5d689b[_0x070e('0x40')]+'\x20'+_0x5d689b[_0x070e('0x41')]:_0x5d689b[_0x070e('0x41')],'id':_0x5d689b['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x13982f},'json':!![]})[_0x070e('0x25')](function(_0x5851ab){if(_0x5851ab&&_0x5851ab['data'][0x0]['code']===_0x070e('0x42')){var _0x926533=_0x5851ab[_0x070e('0x3a')][0x0][_0x070e('0x43')];_0x926533[_0x070e('0x3b')]=_['startCase'](_0x18dae9[_0x070e('0x3e')])+'s';return _0x926533;}logger['error'](_0x070e('0x39'),JSON[_0x070e('0x37')](data));throw new Error(_0x070e('0x44')+JSON['stringify'](data));})['catch'](function(_0x261a27){console['log'](_0x070e('0x45'),_0x261a27);});}function getEndUser(_0x3fdb75,_0x139820,_0x5f5675,_0x7c15f9,_0x20a1ee,_0x48d836,_0x589b97){var _0x35f302={'method':_0x070e('0x46'),'uri':'','headers':{'Authorization':_0x070e('0x47')+_0x3fdb75},'json':!![]};switch(_0x589b97[_0x070e('0x48')]){case _0x070e('0x49'):_0x35f302['uri']=_0x070e('0x3c')+_0x139820+_0x070e('0x4a')+_0x20a1ee+'))';return getZohoUser(_0x35f302,_0x070e('0x4b'))[_0x070e('0x25')](function(_0x79eaa0){if(_0x79eaa0)return _0x79eaa0;_0x35f302[_0x070e('0x4c')]=_0x070e('0x3c')+_0x139820+_0x070e('0x4d')+_0x20a1ee+'))';return getZohoUser(_0x35f302,_0x070e('0x4e'))[_0x070e('0x25')](function(_0x210c4d){if(_0x210c4d)return _0x210c4d;if(_0x589b97[_0x070e('0x3e')]!=_0x070e('0x4f')){return createEndUser(_0x3fdb75,_0x139820,_0x7c15f9,_0x20a1ee,_0x48d836,_0x589b97);}else{return{};}});});break;case _0x070e('0x50'):_0x35f302[_0x070e('0x4c')]='https://www.zohoapis.'+_0x139820+_0x070e('0x4a')+_0x20a1ee+'))';return getZohoUser(_0x35f302,_0x070e('0x4b'))[_0x070e('0x25')](function(_0x249e3f){if(_0x249e3f)return _0x249e3f;if(_0x589b97[_0x070e('0x3e')]!=_0x070e('0x4f')){return createEndUser(_0x3fdb75,_0x139820,_0x7c15f9,_0x20a1ee,_0x48d836,_0x589b97);}else{return{};}});break;case _0x070e('0x51'):_0x35f302[_0x070e('0x4c')]=_0x070e('0x3c')+_0x139820+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x20a1ee+'))';return getZohoUser(_0x35f302,_0x070e('0x4e'))['then'](function(_0x1acddb){if(_0x1acddb)return _0x1acddb;if(_0x589b97[_0x070e('0x3e')]!='nothing'){return createEndUser(_0x3fdb75,_0x139820,_0x7c15f9,_0x20a1ee,_0x48d836,_0x589b97);}else{return{};}});break;}}function getCall(_0x991d23,_0x130a50,_0x25466f,_0xa74805,_0x2b8e51,_0x1e8a4f,_0x83f21e,_0x5694fa){logger[_0x070e('0x2c')]('Creating\x20new\x20call...');var _0x516161={};_0x516161[_0x070e('0x52')]={'name':!_[_0x070e('0x1a')](_0xa74805[_0x070e('0x3f')][_0x070e('0x17')])&&!_[_0x070e('0x1a')](_0xa74805[_0x070e('0x34')][_0x070e('0x17')])&&_0xa74805[_0x070e('0x34')]['name']===_0x070e('0x53')?_0xa74805['role']['name']:!_[_0x070e('0x1a')](_0xa74805[_0x070e('0x40')])?_0xa74805['first_name']+'\x20'+_0xa74805[_0x070e('0x41')]:_0xa74805[_0x070e('0x41')],'id':_0xa74805['id']};_0x516161[_0x070e('0x54')]=intUtil[_0x070e('0x55')](_0x1e8a4f[_0x070e('0x56')],_0x83f21e,'\x20');_0x516161[_0x070e('0x57')]=intUtil[_0x070e('0x55')](_0x1e8a4f['Descriptions'],_0x83f21e,'\x0a');if(_0x2b8e51['enduserType']==='Contacts'){_0x516161[_0x070e('0x58')]={'name':!_[_0x070e('0x1a')](_0x2b8e51[_0x070e('0x59')])?_0x2b8e51[_0x070e('0x59')]:!_['isNil'](_0x2b8e51[_0x070e('0x5a')])?_0x2b8e51['First_Name']+'\x20'+_0x2b8e51[_0x070e('0x5b')]:_0x2b8e51[_0x070e('0x5b')],'id':_0x2b8e51['id']};}if(_0x2b8e51[_0x070e('0x3b')]===_0x070e('0x4e')){_0x516161[_0x070e('0x5c')]={'name':!_[_0x070e('0x1a')](_0x2b8e51['Full_Name'])?_0x2b8e51[_0x070e('0x59')]:!_[_0x070e('0x1a')](_0x2b8e51[_0x070e('0x5a')])?_0x2b8e51['First_Name']+'\x20'+_0x2b8e51[_0x070e('0x5b')]:_0x2b8e51[_0x070e('0x5b')],'id':_0x2b8e51['id']};_0x516161['$se_module']=_[_0x070e('0x5d')](_0x2b8e51['enduserType']);}if(_0x83f21e[_0x070e('0x5e')]){_0x516161['Call_Duration']=moment['utc'](parseInt(_0x83f21e['talktime'])*0x3e8)[_0x070e('0x2d')](_0x070e('0x5f'));}else if(_0x83f21e[_0x070e('0x60')]&&_0x83f21e[_0x070e('0x61')]){_0x516161[_0x070e('0x62')]=moment[_0x070e('0x63')](moment(_0x83f21e['endtime'],_0x070e('0x64'))['diff'](moment(_0x83f21e[_0x070e('0x65')],'YYYY-MM-DDTHH:mm:ss')))[_0x070e('0x2d')](_0x070e('0x5f'));}switch(_0x83f21e['lastevent']){case _0x070e('0x66'):_0x516161['Call_Result']=_0x070e('0x67');break;case _0x070e('0x68'):case _0x070e('0x69'):_0x516161[_0x070e('0x6a')]=_0x070e('0x6b');break;case _0x070e('0x6c'):_0x516161[_0x070e('0x6a')]=_0x070e('0x6d');break;case _0x070e('0x6e'):_0x516161[_0x070e('0x6a')]=_0x070e('0x6f');break;case _0x070e('0x70'):_0x516161[_0x070e('0x6a')]=_0x070e('0x71');default:}_0x516161['Call_Start_Time']=(_0x5694fa===_0x070e('0x72')?moment(_0x83f21e[_0x070e('0x65')])[_0x070e('0x2d')](_0x070e('0x64')):moment(_0x83f21e['agentcalledAt'])[_0x070e('0x2d')](_0x070e('0x64')))||moment()[_0x070e('0x2d')](_0x070e('0x64'));_0x516161[_0x070e('0x73')]=_0x5694fa||_0x070e('0x74');_0x516161=_['merge'](_0x516161,getCustomFields(_0x1e8a4f[_0x070e('0x75')],_0x83f21e));return request({'method':_0x070e('0x22'),'uri':_0x070e('0x3c')+_0x130a50+_0x070e('0x76'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x991d23},'body':{'data':[_0x516161]},'json':!![]})[_0x070e('0x25')](function(_0x52804d){if(_0x52804d&&_0x52804d[_0x070e('0x3a')][0x0][_0x070e('0x77')]===_0x070e('0x42')){logger[_0x070e('0x2c')](_0x070e('0x78'));return{'id':_0x52804d['data'][0x0][_0x070e('0x43')]['id']};}})[_0x070e('0x28')](function(_0x8cc913){logger[_0x070e('0x2c')]('err',_0x8cc913[_0x070e('0x2b')]);console['log'](_0x070e('0x79'),_0x8cc913);});}exports[_0x070e('0x7a')]=function(_0x1214d2,_0x57585e,_0x404c9b,_0x4d344c,_0x1e6e6a,_0x5ce157){var _0x381271,_0x17b28c,_0x5cb168;_0x5ce157[_0x070e('0x7b')]=intUtil['stripTrailingSlash'](_0x5ce157[_0x070e('0x7b')]);_0x5ce157[_0x070e('0x7c')]=intUtil['stripTrailingSlash'](_0x5ce157['serverUrl']);if(_0x1e6e6a&&_0x1e6e6a[_0x070e('0x7d')]){logger[_0x070e('0x2c')](_0x070e('0x7e'),_0x070e('0x7f'));_0x57585e[_0x070e('0x80')]=_0x5ce157[_0x070e('0x7c')]+_0x070e('0x81')+_0x57585e[_0x070e('0x82')]+_0x070e('0x83')+md5(_0x57585e[_0x070e('0x82')]);}else{_0x57585e[_0x070e('0x80')]='';}var _0x25670e=_0x5ce157[_0x070e('0x7b')]==='zoho.eu'?'eu':_0x070e('0x84');return getAccessToken(_0x5ce157)[_0x070e('0x25')](function(_0x5c057c){_0x5cb168=_0x5c057c;return getUser(_0x5cb168,_0x25670e,_0x5ce157,_0x4d344c['email']);})[_0x070e('0x25')](function(_0x2a4de5){_0x381271=_0x2a4de5;logger[_0x070e('0x2c')](_0x070e('0x85'),_0x381271['id']);return getEndUser(_0x5cb168,_0x25670e,_0x5ce157,_0x57585e[_0x070e('0x86')],_0x57585e[_0x070e('0x87')],_0x381271,_0x404c9b);})[_0x070e('0x25')](function(_0x110813){_0x17b28c=_0x110813;return getCall(_0x5cb168,_0x25670e,_0x5ce157,_0x381271,_0x17b28c,_0x404c9b,_0x57585e,_0x070e('0x74'));})[_0x070e('0x25')](function(_0x62800d){if(_0x62800d){logger[_0x070e('0x2c')](_0x070e('0x88'),_0x62800d['id']);logger['info']('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x070e('0x2d')](_0x070e('0x89'),_0x4d344c[_0x070e('0x17')]),_0x070e('0x8a'),{'uri':'https://crm.'+_0x5ce157[_0x070e('0x7b')]+_0x070e('0x8b')+_0x62800d['id']});}})[_0x070e('0x28')](function(_0xd74f9c){logger[_0x070e('0x29')](_0x070e('0x7e'),JSON['stringify'](_0xd74f9c));});};exports[_0x070e('0x72')]=function(_0x5c56bd,_0x2e5bca,_0x413df0,_0x2f704b,_0x3aa620,_0x117fe4,_0x4a5694){var _0x63e78b,_0x15450f,_0x5d3bd8;_0x117fe4[_0x070e('0x7b')]=intUtil[_0x070e('0x8c')](_0x117fe4['host']);_0x117fe4[_0x070e('0x7c')]=intUtil[_0x070e('0x8c')](_0x117fe4[_0x070e('0x7c')]);if(_0x4a5694&&_0x4a5694['recordingFormat']&&_0x4a5694[_0x070e('0x8d')]!==_0x070e('0x8e')){logger[_0x070e('0x2c')](_0x070e('0x8f'),_0x070e('0x7f'));_0x2e5bca[_0x070e('0x80')]=_0x117fe4[_0x070e('0x7c')]+_0x070e('0x81')+_0x2e5bca[_0x070e('0x82')]+_0x070e('0x83')+md5(_0x2e5bca[_0x070e('0x82')]);}var _0x46d2b7=_0x117fe4[_0x070e('0x7b')]==='zoho.eu'?'eu':_0x070e('0x84');return getAccessToken(_0x117fe4)[_0x070e('0x25')](function(_0x392c45){_0x5d3bd8=_0x392c45;return getUser(_0x5d3bd8,_0x46d2b7,_0x117fe4,_0x2f704b[_0x070e('0x31')]);})[_0x070e('0x25')](function(_0x1d1aa2){_0x63e78b=_0x1d1aa2;logger['info']('The\x20User\x20ID\x20is:',_0x63e78b['id']);return getEndUser(_0x5d3bd8,_0x46d2b7,_0x117fe4,_0x2e5bca['destcalleridname'],_0x2e5bca[_0x070e('0x90')],_0x63e78b,_0x413df0);})[_0x070e('0x25')](function(_0x39cd65){_0x15450f=_0x39cd65;return getCall(_0x5d3bd8,_0x46d2b7,_0x117fe4,_0x63e78b,_0x15450f,_0x413df0,_0x2e5bca,_0x070e('0x91'));})['then'](function(_0x7f3f5){if(_0x7f3f5){logger[_0x070e('0x2c')](_0x070e('0x88'),_0x7f3f5['id']);logger['info'](_0x070e('0x8f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x070e('0x2d')](_0x070e('0x89'),_0x2f704b['name']),'trigger:browser:url',{'uri':_0x070e('0x92')+_0x117fe4[_0x070e('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x7f3f5['id']});}})[_0x070e('0x28')](function(_0x596beb){logger['error']('[OUTBOUND]',JSON[_0x070e('0x37')](_0x596beb));});};exports[_0x070e('0x93')]=function(_0xc46619,_0x3aa652,_0x137dd8,_0x341756,_0x2a12a1,_0x1e0274){var _0x3bc925,_0xdcc60a,_0x4e0f6e;_0x1e0274[_0x070e('0x7b')]=intUtil[_0x070e('0x8c')](_0x1e0274[_0x070e('0x7b')]);_0x1e0274[_0x070e('0x7c')]=intUtil[_0x070e('0x8c')](_0x1e0274[_0x070e('0x7c')]);if(_0x2a12a1&&_0x2a12a1[_0x070e('0x7d')]){logger[_0x070e('0x2c')]('['+_0x3aa652[_0x070e('0x94')][_0x070e('0x95')]()+']',_0x070e('0x7f'));_0x3aa652['recordingURL']=_0x1e0274[_0x070e('0x7c')]+_0x070e('0x81')+_0x3aa652[_0x070e('0x82')]+_0x070e('0x83')+md5(_0x3aa652['uniqueid']);}else{_0x3aa652[_0x070e('0x80')]='';}var _0x32fa3b=_0x1e0274[_0x070e('0x7b')]===_0x070e('0x96')?'eu':_0x070e('0x84');return getAccessToken(_0x1e0274)[_0x070e('0x25')](function(_0x5e6444){_0x4e0f6e=_0x5e6444;return getUser(_0x4e0f6e,_0x32fa3b,_0x1e0274);})['then'](function(_0x524a81){_0x3bc925=_0x524a81;logger[_0x070e('0x2c')]('The\x20User\x20ID\x20is:',_0x3bc925['id']);return getEndUser(_0x4e0f6e,_0x32fa3b,_0x1e0274,_0x3aa652[_0x070e('0x86')],_0x3aa652[_0x070e('0x87')],_0x3bc925,_0x137dd8);})['then'](function(_0x912f24){_0xdcc60a=_0x912f24;return getCall(_0x4e0f6e,_0x32fa3b,_0x1e0274,_0x3bc925,_0xdcc60a,_0x137dd8,_0x3aa652,_0x070e('0x74'));})['then'](function(_0x56f389){if(_0x56f389){logger[_0x070e('0x2c')](_0x070e('0x88'),_0x56f389['id']);}})[_0x070e('0x28')](function(_0x38f600){logger[_0x070e('0x29')]('['+_0x3aa652['lastevent'][_0x070e('0x95')]()+']',JSON['stringify'](_0x38f600));});}; \ 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 1682cb9..74cec42 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 _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x563a61,_0x52aa6d){var _0x3093b6=function(_0x4e5ed9){while(--_0x4e5ed9){_0x563a61['push'](_0x563a61['shift']());}};_0x3093b6(++_0x52aa6d);}(_0x7a54,0x106));var _0x47a5=function(_0x51e7eb,_0x5d06a4){_0x51e7eb=_0x51e7eb-0x0;var _0x2e100c=_0x7a54[_0x51e7eb];return _0x2e100c;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0xe2e8a7,_0x2ba228){var _0x47752a=function(_0x435439){while(--_0x435439){_0xe2e8a7['push'](_0xe2e8a7['shift']());}};_0x47752a(++_0x2ba228);}(_0x7a54,0x106));var _0x47a5=function(_0x51220d,_0x17a045){_0x51220d=_0x51220d-0x0;var _0x41311c=_0x7a54[_0x51220d];return _0x41311c;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ 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 e9e9936..282c907 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 _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x172493,_0x5dfd01){var _0x27ad31=function(_0x15dfed){while(--_0x15dfed){_0x172493['push'](_0x172493['shift']());}};_0x27ad31(++_0x5dfd01);}(_0xb10b,0x12a));var _0xbb10=function(_0x412818,_0xe8171a){_0x412818=_0x412818-0x0;var _0x2d40d1=_0xb10b[_0x412818];return _0x2d40d1;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x4274e6,_0x31ac53){var _0x200c27=function(_0x5b02a2){while(--_0x5b02a2){_0x4274e6['push'](_0x4274e6['shift']());}};_0x200c27(++_0x31ac53);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1e22d6,_0x25605f){_0x1e22d6=_0x1e22d6-0x0;var _0x397cc4=_0x5f2f[_0x1e22d6];return _0x397cc4;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index c55dce5..aaa92b4 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 _0xfafd=['http','Request','request','then','debug','rpc','error','message','catch','bluebird','../../config/logger','routing','client'];(function(_0x4a9b1f,_0x247a1f){var _0x349bd7=function(_0x333c88){while(--_0x333c88){_0x4a9b1f['push'](_0x4a9b1f['shift']());}};_0x349bd7(++_0x247a1f);}(_0xfafd,0xcc));var _0xdfaf=function(_0x3c5be5,_0x558f9b){_0x3c5be5=_0x3c5be5-0x0;var _0x3a20f4=_0xfafd[_0x3c5be5];return _0x3a20f4;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xdfaf('0x0'));var logger=require(_0xdfaf('0x1'))(_0xdfaf('0x2'));var client=jayson[_0xdfaf('0x3')][_0xdfaf('0x4')]({'port':0x2329});client[_0xdfaf('0x5')]=function(_0x2fd070,_0x2ca36c){return new BPromise(function(_0x7e3bc7,_0x2a28e9){return client[_0xdfaf('0x6')](_0x2fd070,_0x2ca36c)[_0xdfaf('0x7')](function(_0x3b455a){logger[_0xdfaf('0x8')](_0xdfaf('0x9'),'routing',_0x2fd070,_0x2ca36c,_0x3b455a);if(_0x3b455a[_0xdfaf('0xa')]){logger[_0xdfaf('0xa')](_0xdfaf('0x9'),_0xdfaf('0x2'),_0x2fd070,_0x3b455a[_0xdfaf('0xa')][_0xdfaf('0xb')],_0x2ca36c);return _0x2a28e9(_0x3b455a[_0xdfaf('0xa')][_0xdfaf('0xb')]);}else{return _0x7e3bc7(_0x3b455a['result']);}})[_0xdfaf('0xc')](function(_0x447315){logger[_0xdfaf('0xa')](_0xdfaf('0x9'),_0xdfaf('0x2'),_0x2fd070,_0x447315,_0x2ca36c);return _0x2a28e9(_0x447315);});});};module['exports']=client; \ No newline at end of file +var _0x225c=['client','Request','request','then','debug','rpc','routing','error','message','catch','jayson/promise','bluebird'];(function(_0xa47941,_0x114321){var _0x2f07ed=function(_0x4b8b0b){while(--_0x4b8b0b){_0xa47941['push'](_0xa47941['shift']());}};_0x2f07ed(++_0x114321);}(_0x225c,0x106));var _0xc225=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x225c[_0x14add3];return _0x4a174f;};'use strict';var jayson=require(_0xc225('0x0'));var BPromise=require(_0xc225('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xc225('0x2')]['http']({'port':0x2329});client[_0xc225('0x3')]=function(_0xc96c33,_0x4778ea){return new BPromise(function(_0x41eccd,_0x7a87bf){return client[_0xc225('0x4')](_0xc96c33,_0x4778ea)[_0xc225('0x5')](function(_0x54be3a){logger[_0xc225('0x6')](_0xc225('0x7'),_0xc225('0x8'),_0xc96c33,_0x4778ea,_0x54be3a);if(_0x54be3a[_0xc225('0x9')]){logger[_0xc225('0x9')]('rpc',_0xc225('0x8'),_0xc96c33,_0x54be3a['error'][_0xc225('0xa')],_0x4778ea);return _0x7a87bf(_0x54be3a[_0xc225('0x9')][_0xc225('0xa')]);}else{return _0x41eccd(_0x54be3a['result']);}})[_0xc225('0xb')](function(_0x1f2f4f){logger[_0xc225('0x9')](_0xc225('0x7'),_0xc225('0x8'),_0xc96c33,_0x1f2f4f,_0x4778ea);return _0x7a87bf(_0x1f2f4f);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 197f265..b4519a5 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 _0xa0fa=['./rpc/mailAccount','./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','getSettings','log','bluebird','./server','./realtime','./lib/email'];(function(_0x959ee9,_0x1b5466){var _0x29c2ea=function(_0xc1b67e){while(--_0xc1b67e){_0x959ee9['push'](_0x959ee9['shift']());}};_0x29c2ea(++_0x1b5466);}(_0xa0fa,0x18f));var _0xaa0f=function(_0x2ac8fa,_0x2aa803){_0x2ac8fa=_0x2ac8fa-0x0;var _0x4f6ab6=_0xa0fa[_0x2ac8fa];return _0x4f6ab6;};'use strict';var BPromise=require(_0xaa0f('0x0'));var server=require(_0xaa0f('0x1'));var Realtime=require(_0xaa0f('0x2'));var EmailChannel=require(_0xaa0f('0x3'));var mailAccount=require(_0xaa0f('0x4'));var setting=require(_0xaa0f('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xaa0f('0x6')]()[_0xaa0f('0x7')](mailAccount[_0xaa0f('0x8')]())[_0xaa0f('0x7')](realtime[_0xaa0f('0x9')]())['then'](function(){email['refresh'](realtime[_0xaa0f('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xaa0f('0x7')](function(){return initRealtime();})[_0xaa0f('0x7')](function(){return setting[_0xaa0f('0xb')]();})[_0xaa0f('0x7')](function(_0x50146a){return setInterval(initRealtime,_0x50146a['loginMailFrequency']*0x3e8);})['catch'](function(_0x851995){console[_0xaa0f('0xc')](_0x851995);});}main(); \ No newline at end of file +var _0xfab1=['initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xfab1,0x76));var _0x1fab=function(_0x173e4b,_0xd3fca8){_0x173e4b=_0x173e4b-0x0;var _0x253e1b=_0xfab1[_0x173e4b];return _0x253e1b;};'use strict';var BPromise=require(_0x1fab('0x0'));var server=require(_0x1fab('0x1'));var Realtime=require(_0x1fab('0x2'));var EmailChannel=require(_0x1fab('0x3'));var mailAccount=require(_0x1fab('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x1fab('0x5')]()[_0x1fab('0x6')](mailAccount[_0x1fab('0x7')]())[_0x1fab('0x6')](realtime[_0x1fab('0x8')]())[_0x1fab('0x6')](function(){email[_0x1fab('0x9')](realtime[_0x1fab('0xa')]);return realtime;});}function main(){return server[_0x1fab('0xb')](realtime,email)[_0x1fab('0x6')](function(){return initRealtime();})[_0x1fab('0x6')](function(){return setting[_0x1fab('0xc')]();})['then'](function(_0x579202){return setInterval(initRealtime,_0x579202[_0x1fab('0xd')]*0x3e8);})['catch'](function(_0x196212){console['log'](_0x196212);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ff7d72e..4749bb8 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 _0x248d=['prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','handleImapBox','handleImapEmail','bind','end','error','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','sendMail','smtp','Smtp','lastSync','verify','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','email','defaults','redis','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0x248d,0xf0));var _0xd248=function(_0x827fcf,_0x2c7735){_0x827fcf=_0x827fcf-0x0;var _0x353cbc=_0x248d[_0x827fcf];return _0x353cbc;};'use strict';var _=require('lodash');var moment=require(_0xd248('0x0'));var BPromise=require(_0xd248('0x1'));var md5=require(_0xd248('0x2'));var Redis=require(_0xd248('0x3'));var config=require(_0xd248('0x4'));var logger=require('../../../config/logger')(_0xd248('0x5'));config['redis']=_[_0xd248('0x6')](config[_0xd248('0x7')],{'host':_0xd248('0x8'),'port':0x18eb});var io=require(_0xd248('0x9'))(new Redis(config[_0xd248('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xd248('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x38d105){logger[_0xd248('0xb')](_0xd248('0xc'));this[_0xd248('0xd')]=_0x38d105['mailAccounts'];this[_0xd248('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xd248('0xf')][_0xd248('0x10')]=function(_0x708180){var _0x416961=this[_0xd248('0xd')][_0x708180];var _0x175590={'id':_0x416961['id'],'name':_0x416961[_0xd248('0x11')],'key':_0x416961[_0xd248('0x12')],'active':_0x416961[_0xd248('0x13')],'Imap':{'status':_0x416961[_0xd248('0x14')][_0xd248('0x15')],'messageStatus':_0x416961['Imap'][_0xd248('0x16')],'total':_0x416961[_0xd248('0x14')][_0xd248('0x17')]}};if(_[_0xd248('0x18')](md5Accounts[_0x708180])){md5Accounts[_0x708180]={};}var _0x3e9eab=md5(JSON[_0xd248('0x19')](_0x175590));if(md5Accounts[_0x708180][_0xd248('0x2')]!==_0x3e9eab){md5Accounts[_0x708180][_0xd248('0x2')]=_0x3e9eab;io[_0xd248('0x10')](_0xd248('0x1a'),_0x175590);}};EmailChannel[_0xd248('0xf')][_0xd248('0x1b')]=function(_0x4689e5){for(var _0x338ccc in _0x4689e5){if(_0x4689e5[_0xd248('0x1c')](_0x338ccc)){if(_0x4689e5[_0x338ccc][_0xd248('0x14')]&&_0x4689e5[_0x338ccc][_0xd248('0x13')]){var _0x293b10=_0x4689e5[_0x338ccc]['Imap'];if(!this[_0xd248('0xe')]['hasOwnProperty'](_0x293b10['id'])){this[_0xd248('0xe')][_0x293b10['id']]=new EmailImap(_0x293b10,_0x4689e5[_0x338ccc]['email']);this['imapAccounts'][_0x293b10['id']]['on']('box',this[_0xd248('0x1d')]['bind'](this,_0x338ccc));this[_0xd248('0xe')][_0x293b10['id']]['on'](_0xd248('0x5'),this[_0xd248('0x1e')][_0xd248('0x1f')](this,_0x338ccc));this[_0xd248('0xe')][_0x293b10['id']]['on'](_0xd248('0x20'),this['handleImapEnd'][_0xd248('0x1f')](this,_0x338ccc));this[_0xd248('0xe')][_0x293b10['id']]['on'](_0xd248('0x21'),this['handleImapError'][_0xd248('0x1f')](this,_0x338ccc));}}else{if(_['isNil'](this[_0xd248('0xd')][_0x338ccc]['Imap'])){this[_0xd248('0xd')][_0x338ccc][_0xd248('0x14')]={};}this[_0xd248('0xd')][_0x338ccc][_0xd248('0x14')][_0xd248('0x15')]='disabled';this[_0xd248('0xd')][_0x338ccc]['Imap'][_0xd248('0x16')]='';this['emit'](_0x338ccc);}}}};EmailChannel['prototype'][_0xd248('0x1d')]=function(_0xe79247,_0x5b98e1){if(this['mailAccounts'][_0xe79247]){this[_0xd248('0xd')][_0xe79247][_0xd248('0x14')]['status']=_0xd248('0x22');this[_0xd248('0xd')][_0xe79247][_0xd248('0x14')][_0xd248('0x16')]=_0x5b98e1[_0xd248('0x11')];if(_0x5b98e1['messages']){this['mailAccounts'][_0xe79247][_0xd248('0x14')]['total']=_0x5b98e1[_0xd248('0x23')][_0xd248('0x17')];}return this[_0xd248('0x10')](_0xe79247);}};EmailChannel['prototype'][_0xd248('0x1e')]=function(_0x19baa7,_0xdeb04b){logger[_0xd248('0xb')](_0xd248('0x24'),_0xdeb04b[_0xd248('0x25')],_0xdeb04b[_0xd248('0x26')],_0xdeb04b[_0xd248('0x27')],_0x19baa7);if(this[_0xd248('0xd')][_0x19baa7]){return mailAccount['notify'](_0x19baa7,_0xdeb04b)[_0xd248('0x28')](function(_0x4ee74d){if(_0x4ee74d){logger[_0xd248('0xb')]('Mail\x20accepted\x20from\x20routing');}})[_0xd248('0x29')](function(_0x35b8b0){logger[_0xd248('0x21')](_0xd248('0x2a'),JSON[_0xd248('0x19')](_0x35b8b0));});}};EmailChannel[_0xd248('0xf')][_0xd248('0x2b')]=function(_0x5a9560){if(this[_0xd248('0xd')][_0x5a9560]&&this[_0xd248('0xd')][_0x5a9560][_0xd248('0x14')]){if(this[_0xd248('0xe')][this[_0xd248('0xd')][_0x5a9560]['Imap']['id']]){delete this[_0xd248('0xe')][this[_0xd248('0xd')][_0x5a9560]['Imap']['id']];}this[_0xd248('0xd')][_0x5a9560]['Imap']['lastSync']=moment();this[_0xd248('0x10')](_0x5a9560);}};EmailChannel[_0xd248('0xf')]['handleImapError']=function(_0x26b7ff,_0x789a49){if(this[_0xd248('0xd')][_0x26b7ff]){this[_0xd248('0xd')][_0x26b7ff][_0xd248('0x14')][_0xd248('0x15')]=_0xd248('0x21');this[_0xd248('0xd')][_0x26b7ff]['Imap'][_0xd248('0x16')]=_0x789a49;return this[_0xd248('0x10')](_0x26b7ff);}};EmailChannel[_0xd248('0xf')][_0xd248('0x2c')]=function(_0x2e0306,_0x267c0f){return this[_0xd248('0x2d')]['send'](_0x2e0306,_0x267c0f);};EmailChannel[_0xd248('0xf')]['verifySmtp']=function(_0x1012a4){var _0x2ac498=this;if(this[_0xd248('0xd')][_0x1012a4['id']]){if(_['isNil'](this['mailAccounts'][_0x1012a4['id']][_0xd248('0x2e')])){this[_0xd248('0xd')][_0x1012a4['id']][_0xd248('0x2e')]={};}this[_0xd248('0xd')][_0x1012a4['id']][_0xd248('0x2e')][_0xd248('0x2f')]=moment();return new BPromise(function(_0x4a705d,_0x468f83){return _0x2ac498[_0xd248('0x2d')][_0xd248('0x30')](_0x1012a4)[_0xd248('0x28')](function(_0x40b922){_0x2ac498[_0xd248('0xd')][_0x1012a4['id']][_0xd248('0x2e')]['status']=_0xd248('0x31');_0x2ac498[_0xd248('0xd')][_0x1012a4['id']][_0xd248('0x2e')]['messageStatus']='';_0x2ac498['emit'](_0x1012a4['id']);_0x4a705d(_0x40b922);})[_0xd248('0x29')](function(_0x89f560){_0x2ac498[_0xd248('0xd')][_0x1012a4['id']][_0xd248('0x2e')][_0xd248('0x15')]='error';_0x2ac498[_0xd248('0xd')][_0x1012a4['id']]['Smtp'][_0xd248('0x16')]=_0x89f560;_0x2ac498[_0xd248('0x10')](_0x1012a4['id']);_0x468f83(_0x89f560);});});}return this[_0xd248('0x2d')][_0xd248('0x30')](_0x1012a4);};module[_0xd248('0x32')]=EmailChannel; \ No newline at end of file +var _0xa23a=['status','messageStatus','total','isNil','stringify','md5','mailAccount:update','hasOwnProperty','imapAccounts','box','handleImapBox','bind','handleImapEnd','handleImapError','disabled','connected','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','verifySmtp','Smtp','verify','verified','exports','moment','ioredis','../../../config/environment','email','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','mailAccounts','prototype','emit','name','key','active','Imap'];(function(_0x3c268f,_0x358d2a){var _0x31fbd4=function(_0x13afdb){while(--_0x13afdb){_0x3c268f['push'](_0x3c268f['shift']());}};_0x31fbd4(++_0x358d2a);}(_0xa23a,0x190));var _0xaa23=function(_0x2d90cc,_0x45bb4e){_0x2d90cc=_0x2d90cc-0x0;var _0x227a99=_0xa23a[_0x2d90cc];return _0x227a99;};'use strict';var _=require('lodash');var moment=require(_0xaa23('0x0'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0xaa23('0x1'));var config=require(_0xaa23('0x2'));var logger=require('../../../config/logger')(_0xaa23('0x3'));config[_0xaa23('0x4')]=_['defaults'](config[_0xaa23('0x4')],{'host':_0xaa23('0x5'),'port':0x18eb});var io=require(_0xaa23('0x6'))(new Redis(config[_0xaa23('0x4')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xaa23('0x7'));var mailAccount=require(_0xaa23('0x8'));var md5Accounts={};function EmailChannel(_0x58c47a){logger['info']('start\x20email\x20channel');this[_0xaa23('0x9')]=_0x58c47a[_0xaa23('0x9')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0xaa23('0xa')][_0xaa23('0xb')]=function(_0x257e8f){var _0xbae5b=this[_0xaa23('0x9')][_0x257e8f];var _0x4e3df4={'id':_0xbae5b['id'],'name':_0xbae5b[_0xaa23('0xc')],'key':_0xbae5b[_0xaa23('0xd')],'active':_0xbae5b[_0xaa23('0xe')],'Imap':{'status':_0xbae5b[_0xaa23('0xf')][_0xaa23('0x10')],'messageStatus':_0xbae5b[_0xaa23('0xf')][_0xaa23('0x11')],'total':_0xbae5b[_0xaa23('0xf')][_0xaa23('0x12')]}};if(_[_0xaa23('0x13')](md5Accounts[_0x257e8f])){md5Accounts[_0x257e8f]={};}var _0x49dcd2=md5(JSON[_0xaa23('0x14')](_0x4e3df4));if(md5Accounts[_0x257e8f][_0xaa23('0x15')]!==_0x49dcd2){md5Accounts[_0x257e8f][_0xaa23('0x15')]=_0x49dcd2;io[_0xaa23('0xb')](_0xaa23('0x16'),_0x4e3df4);}};EmailChannel[_0xaa23('0xa')]['refresh']=function(_0x210519){for(var _0x224eb8 in _0x210519){if(_0x210519[_0xaa23('0x17')](_0x224eb8)){if(_0x210519[_0x224eb8][_0xaa23('0xf')]&&_0x210519[_0x224eb8][_0xaa23('0xe')]){var _0x37887f=_0x210519[_0x224eb8]['Imap'];if(!this[_0xaa23('0x18')]['hasOwnProperty'](_0x37887f['id'])){this[_0xaa23('0x18')][_0x37887f['id']]=new EmailImap(_0x37887f,_0x210519[_0x224eb8][_0xaa23('0x3')]);this[_0xaa23('0x18')][_0x37887f['id']]['on'](_0xaa23('0x19'),this[_0xaa23('0x1a')][_0xaa23('0x1b')](this,_0x224eb8));this['imapAccounts'][_0x37887f['id']]['on'](_0xaa23('0x3'),this['handleImapEmail'][_0xaa23('0x1b')](this,_0x224eb8));this[_0xaa23('0x18')][_0x37887f['id']]['on']('end',this[_0xaa23('0x1c')][_0xaa23('0x1b')](this,_0x224eb8));this[_0xaa23('0x18')][_0x37887f['id']]['on']('error',this[_0xaa23('0x1d')][_0xaa23('0x1b')](this,_0x224eb8));}}else{if(_['isNil'](this['mailAccounts'][_0x224eb8]['Imap'])){this[_0xaa23('0x9')][_0x224eb8][_0xaa23('0xf')]={};}this[_0xaa23('0x9')][_0x224eb8][_0xaa23('0xf')]['status']=_0xaa23('0x1e');this['mailAccounts'][_0x224eb8]['Imap'][_0xaa23('0x11')]='';this[_0xaa23('0xb')](_0x224eb8);}}}};EmailChannel[_0xaa23('0xa')][_0xaa23('0x1a')]=function(_0x4b8831,_0x3a36fe){if(this[_0xaa23('0x9')][_0x4b8831]){this[_0xaa23('0x9')][_0x4b8831][_0xaa23('0xf')][_0xaa23('0x10')]=_0xaa23('0x1f');this['mailAccounts'][_0x4b8831]['Imap'][_0xaa23('0x11')]=_0x3a36fe[_0xaa23('0xc')];if(_0x3a36fe['messages']){this[_0xaa23('0x9')][_0x4b8831]['Imap'][_0xaa23('0x12')]=_0x3a36fe[_0xaa23('0x20')][_0xaa23('0x12')];}return this[_0xaa23('0xb')](_0x4b8831);}};EmailChannel['prototype'][_0xaa23('0x21')]=function(_0x570ee2,_0x5ec774){logger[_0xaa23('0x22')](_0xaa23('0x23'),_0x5ec774[_0xaa23('0x24')],_0x5ec774[_0xaa23('0x25')],_0x5ec774['from'],_0x570ee2);if(this[_0xaa23('0x9')][_0x570ee2]){return mailAccount[_0xaa23('0x26')](_0x570ee2,_0x5ec774)[_0xaa23('0x27')](function(_0x4539e8){if(_0x4539e8){logger[_0xaa23('0x22')](_0xaa23('0x28'));}})[_0xaa23('0x29')](function(_0x274e76){logger[_0xaa23('0x2a')](_0xaa23('0x2b'),JSON['stringify'](_0x274e76));});}};EmailChannel[_0xaa23('0xa')][_0xaa23('0x1c')]=function(_0x313a79){if(this[_0xaa23('0x9')][_0x313a79]&&this[_0xaa23('0x9')][_0x313a79][_0xaa23('0xf')]){if(this[_0xaa23('0x18')][this[_0xaa23('0x9')][_0x313a79][_0xaa23('0xf')]['id']]){delete this[_0xaa23('0x18')][this[_0xaa23('0x9')][_0x313a79][_0xaa23('0xf')]['id']];}this[_0xaa23('0x9')][_0x313a79][_0xaa23('0xf')][_0xaa23('0x2c')]=moment();this['emit'](_0x313a79);}};EmailChannel[_0xaa23('0xa')][_0xaa23('0x1d')]=function(_0x2e4c78,_0x5833c4){if(this[_0xaa23('0x9')][_0x2e4c78]){this[_0xaa23('0x9')][_0x2e4c78][_0xaa23('0xf')][_0xaa23('0x10')]='error';this[_0xaa23('0x9')][_0x2e4c78][_0xaa23('0xf')][_0xaa23('0x11')]=_0x5833c4;return this[_0xaa23('0xb')](_0x2e4c78);}};EmailChannel[_0xaa23('0xa')][_0xaa23('0x2d')]=function(_0x4b6bb5,_0x2970a7){return this[_0xaa23('0x2e')]['send'](_0x4b6bb5,_0x2970a7);};EmailChannel['prototype'][_0xaa23('0x2f')]=function(_0x432546){var _0x33df82=this;if(this[_0xaa23('0x9')][_0x432546['id']]){if(_[_0xaa23('0x13')](this[_0xaa23('0x9')][_0x432546['id']][_0xaa23('0x30')])){this[_0xaa23('0x9')][_0x432546['id']][_0xaa23('0x30')]={};}this['mailAccounts'][_0x432546['id']][_0xaa23('0x30')]['lastSync']=moment();return new BPromise(function(_0x50c796,_0x39c588){return _0x33df82['smtp'][_0xaa23('0x31')](_0x432546)[_0xaa23('0x27')](function(_0xf6e423){_0x33df82[_0xaa23('0x9')][_0x432546['id']][_0xaa23('0x30')]['status']=_0xaa23('0x32');_0x33df82[_0xaa23('0x9')][_0x432546['id']][_0xaa23('0x30')][_0xaa23('0x11')]='';_0x33df82[_0xaa23('0xb')](_0x432546['id']);_0x50c796(_0xf6e423);})[_0xaa23('0x29')](function(_0xc32258){_0x33df82[_0xaa23('0x9')][_0x432546['id']][_0xaa23('0x30')][_0xaa23('0x10')]=_0xaa23('0x2a');_0x33df82['mailAccounts'][_0x432546['id']][_0xaa23('0x30')][_0xaa23('0x11')]=_0xc32258;_0x33df82[_0xaa23('0xb')](_0x432546['id']);_0x39c588(_0xc32258);});});}return this[_0xaa23('0x2e')][_0xaa23('0x31')](_0x432546);};module[_0xaa23('0x33')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 9727000..f146740 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 _0xbb6d=['connTimeout','authTimeout','service','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','once','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchError','stringify','textCode','upperFirst','exports','util','imap','randomstring','mailparser','simpleParser','iconv','Iconv','events','../../../config/logger','email','mailbox','account','getAccount','handleReady','bind','end','handleEnd','error','handleError','inherits','prototype'];(function(_0x258f5e,_0x443e2f){var _0x33c877=function(_0x453b25){while(--_0x453b25){_0x258f5e['push'](_0x258f5e['shift']());}};_0x33c877(++_0x443e2f);}(_0xbb6d,0x108));var _0xdbb6=function(_0x4bb23a,_0x3a28ce){_0x4bb23a=_0x4bb23a-0x0;var _0xe4d763=_0xbb6d[_0x4bb23a];return _0xe4d763;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xdbb6('0x0'));var Imap=require(_0xdbb6('0x1'));var _=require('lodash');var rs=require(_0xdbb6('0x2'));var simpleParser=require(_0xdbb6('0x3'))[_0xdbb6('0x4')];var Iconv=require(_0xdbb6('0x5'))[_0xdbb6('0x6')];var EventEmitter=require(_0xdbb6('0x7'))['EventEmitter'];var utils=require('./utils');var logger=require(_0xdbb6('0x8'))(_0xdbb6('0x9'));function EmailImap(_0x41586b,_0x1e5ba1){this[_0xdbb6('0xa')]='INBOX';this[_0xdbb6('0xb')]=this[_0xdbb6('0xc')](_0x41586b,_0x1e5ba1);this[_0xdbb6('0x1')]=new Imap(this['account']);this[_0xdbb6('0x1')]['once']('ready',this[_0xdbb6('0xd')][_0xdbb6('0xe')](this));this['imap']['once'](_0xdbb6('0xf'),this[_0xdbb6('0x10')]['bind'](this));this['imap']['on'](_0xdbb6('0x11'),this[_0xdbb6('0x12')][_0xdbb6('0xe')](this));this[_0xdbb6('0x1')]['connect']();}util[_0xdbb6('0x13')](EmailImap,EventEmitter);EmailImap[_0xdbb6('0x14')]['getAccount']=function(_0x537cb0,_0x4d0908){var _0x1bce6f={'connTimeout':_0x537cb0[_0xdbb6('0x15')]?_0x537cb0['connTimeout']*0x3e8:0x2710,'authTimeout':_0x537cb0[_0xdbb6('0x16')]?_0x537cb0['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x537cb0[_0xdbb6('0x17')])){if(_0x537cb0['authentication']){_0x1bce6f['user']=_0x537cb0[_0xdbb6('0x18')];_0x1bce6f[_0xdbb6('0x19')]=_0x537cb0[_0xdbb6('0x19')];}_0x1bce6f[_0xdbb6('0x1a')]=_0x537cb0[_0xdbb6('0x1a')];_0x1bce6f[_0xdbb6('0x1b')]=_0x537cb0[_0xdbb6('0x1b')]||0x3e1;if(_0x537cb0[_0xdbb6('0x1c')]){_0x1bce6f[_0xdbb6('0x1c')]=!![];}else{_0x1bce6f[_0xdbb6('0x1c')]=![];_0x1bce6f[_0xdbb6('0x1d')]=_0xdbb6('0x1e');}}else{_0x1bce6f[_0xdbb6('0x18')]=_0x537cb0[_0xdbb6('0x18')];_0x1bce6f[_0xdbb6('0x19')]=_0x537cb0[_0xdbb6('0x19')];_0x1bce6f[_0xdbb6('0x1a')]=utils[_0xdbb6('0x1f')](_0x537cb0[_0xdbb6('0x17')]);_0x1bce6f[_0xdbb6('0x1b')]=0x3e1;_0x1bce6f[_0xdbb6('0x1c')]=!![];}_0x1bce6f['email']=_0x4d0908||_0x537cb0[_0xdbb6('0x18')]||_0xdbb6('0x20');return _0x1bce6f;};EmailImap['prototype'][_0xdbb6('0xd')]=function(){this[_0xdbb6('0x1')][_0xdbb6('0x21')](this['mailbox'],![],this[_0xdbb6('0x22')][_0xdbb6('0xe')](this));};EmailImap[_0xdbb6('0x14')][_0xdbb6('0x22')]=function(_0x9a08aa,_0x33542c){if(_0x9a08aa){this[_0xdbb6('0x12')](_0x9a08aa,!![]);}else{this[_0xdbb6('0x23')]('box',_0x33542c);this[_0xdbb6('0x24')]();}};EmailImap[_0xdbb6('0x14')][_0xdbb6('0x25')]=function(_0x4c4a44){if(_0x4c4a44){this[_0xdbb6('0x12')](_0x4c4a44,!![]);}else{this['imap'][_0xdbb6('0xf')]();}};EmailImap[_0xdbb6('0x14')]['readUnseen']=function(){this['imap'][_0xdbb6('0x26')]([_0xdbb6('0x27')],this[_0xdbb6('0x28')]['bind'](this));};EmailImap[_0xdbb6('0x14')][_0xdbb6('0x28')]=function(_0x3547d1,_0x2a535e){if(_0x3547d1){this['handleError'](_0x3547d1,!![]);}else{if(_0x2a535e['length']){try{var _0x589f4c=this[_0xdbb6('0x1')][_0xdbb6('0x29')](_0x2a535e,{'bodies':'','markSeen':!![]});_0x589f4c['on']('message',this[_0xdbb6('0x2a')][_0xdbb6('0xe')](this));_0x589f4c['once'](_0xdbb6('0x11'),this['handleFetchError'][_0xdbb6('0xe')](this));_0x589f4c[_0xdbb6('0x2b')](_0xdbb6('0xf'),this[_0xdbb6('0x2c')][_0xdbb6('0xe')](this));}catch(_0x437a35){logger[_0xdbb6('0x11')](_0x437a35);}}else{this[_0xdbb6('0x1')][_0xdbb6('0x2d')](!![],this[_0xdbb6('0x25')][_0xdbb6('0xe')](this));}}};EmailImap[_0xdbb6('0x14')][_0xdbb6('0x2a')]=function(_0x4fb586,_0xd92818){_0x4fb586['on'](_0xdbb6('0x2e'),this[_0xdbb6('0x2f')][_0xdbb6('0xe')](this));_0x4fb586[_0xdbb6('0x2b')](_0xdbb6('0x30'),this[_0xdbb6('0x31')][_0xdbb6('0xe')](this));_0x4fb586[_0xdbb6('0x2b')]('end',this[_0xdbb6('0x32')][_0xdbb6('0xe')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x3c6306,_0x38697b){simpleParser(_0x3c6306,{'Iconv':Iconv},this[_0xdbb6('0x33')][_0xdbb6('0xe')](this));};EmailImap['prototype'][_0xdbb6('0x31')]=function(_0x40658e){};EmailImap[_0xdbb6('0x14')]['handleMessageEnd']=function(){};EmailImap[_0xdbb6('0x14')][_0xdbb6('0x33')]=function(_0x4f5fe0,_0x1dffb8){if(_0x4f5fe0){logger[_0xdbb6('0x11')](_0x4f5fe0);}else{var _0x5261b7=this;utils['parser'](this[_0xdbb6('0xb')],_0x1dffb8,function(_0x27850b){_0x5261b7['emit']('email',_0x27850b);});}};EmailImap['prototype'][_0xdbb6('0x2c')]=function(){this['imap'][_0xdbb6('0x2d')](!![],this['handleCloseBox'][_0xdbb6('0xe')](this));};EmailImap['prototype'][_0xdbb6('0x34')]=function(_0x511196){this[_0xdbb6('0x12')](_0x511196);this[_0xdbb6('0x1')]['closeBox'](!![],this['handleCloseBox'][_0xdbb6('0xe')](this));};EmailImap[_0xdbb6('0x14')][_0xdbb6('0x10')]=function(){this['emit']('end');};EmailImap['prototype'][_0xdbb6('0x12')]=function(_0x49e44d,_0x304b9d){logger[_0xdbb6('0x11')](_0xdbb6('0x12'),this[_0xdbb6('0xb')]['email'],JSON[_0xdbb6('0x35')](_0x49e44d));var _0x3f23ec='';if(_0x49e44d){if(_0x49e44d[_0xdbb6('0x36')]){_0x3f23ec=_0x49e44d['textCode'];}else{for(var _0x4feb85 in _0x49e44d){if(_0x49e44d['hasOwnProperty'](_0x4feb85)){_0x3f23ec+=_[_0xdbb6('0x37')](_0x4feb85)+':\x20'+_0x49e44d[_0x4feb85]+'\x0a';}}}}if(_0x304b9d){this[_0xdbb6('0x1')]['end']();}else{this['emit'](_0xdbb6('0x11'),_0x3f23ec);this[_0xdbb6('0x23')]('end');}};module[_0xdbb6('0x38')]=EmailImap; \ No newline at end of file +var _0xb7de=['handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','textCode','upperFirst','exports','path','util','imap','randomstring','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','once','ready','end','handleEnd','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','authentication','password','host','port','tls','autotls','required','user','getHost','anonymous@xcally.com','handleReady','openBox','mailbox','handleOpenBox','emit','box','handleCloseBox','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody'];(function(_0x1b6377,_0x2f4a2c){var _0x3073a0=function(_0x1b378b){while(--_0x1b378b){_0x1b6377['push'](_0x1b6377['shift']());}};_0x3073a0(++_0x2f4a2c);}(_0xb7de,0xc7));var _0xeb7d=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xb7de[_0x1d9aa0];return _0x226868;};'use strict';var fs=require('fs');var path=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var Imap=require(_0xeb7d('0x2'));var _=require('lodash');var rs=require(_0xeb7d('0x3'));var simpleParser=require(_0xeb7d('0x4'))[_0xeb7d('0x5')];var Iconv=require(_0xeb7d('0x6'))[_0xeb7d('0x7')];var EventEmitter=require('events')[_0xeb7d('0x8')];var utils=require(_0xeb7d('0x9'));var logger=require(_0xeb7d('0xa'))(_0xeb7d('0xb'));function EmailImap(_0xc8bd99,_0x593170){this['mailbox']=_0xeb7d('0xc');this[_0xeb7d('0xd')]=this[_0xeb7d('0xe')](_0xc8bd99,_0x593170);this[_0xeb7d('0x2')]=new Imap(this['account']);this[_0xeb7d('0x2')][_0xeb7d('0xf')](_0xeb7d('0x10'),this['handleReady']['bind'](this));this[_0xeb7d('0x2')]['once'](_0xeb7d('0x11'),this[_0xeb7d('0x12')][_0xeb7d('0x13')](this));this[_0xeb7d('0x2')]['on'](_0xeb7d('0x14'),this[_0xeb7d('0x15')]['bind'](this));this[_0xeb7d('0x2')][_0xeb7d('0x16')]();}util[_0xeb7d('0x17')](EmailImap,EventEmitter);EmailImap[_0xeb7d('0x18')][_0xeb7d('0xe')]=function(_0x5f29b0,_0xdc94e7){var _0x598da2={'connTimeout':_0x5f29b0[_0xeb7d('0x19')]?_0x5f29b0[_0xeb7d('0x19')]*0x3e8:0x2710,'authTimeout':_0x5f29b0[_0xeb7d('0x1a')]?_0x5f29b0['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x5f29b0[_0xeb7d('0x1b')])){if(_0x5f29b0[_0xeb7d('0x1c')]){_0x598da2['user']=_0x5f29b0['user'];_0x598da2[_0xeb7d('0x1d')]=_0x5f29b0[_0xeb7d('0x1d')];}_0x598da2['host']=_0x5f29b0[_0xeb7d('0x1e')];_0x598da2[_0xeb7d('0x1f')]=_0x5f29b0[_0xeb7d('0x1f')]||0x3e1;if(_0x5f29b0[_0xeb7d('0x20')]){_0x598da2[_0xeb7d('0x20')]=!![];}else{_0x598da2[_0xeb7d('0x20')]=![];_0x598da2[_0xeb7d('0x21')]=_0xeb7d('0x22');}}else{_0x598da2[_0xeb7d('0x23')]=_0x5f29b0['user'];_0x598da2[_0xeb7d('0x1d')]=_0x5f29b0['password'];_0x598da2[_0xeb7d('0x1e')]=utils[_0xeb7d('0x24')](_0x5f29b0[_0xeb7d('0x1b')]);_0x598da2['port']=0x3e1;_0x598da2[_0xeb7d('0x20')]=!![];}_0x598da2[_0xeb7d('0xb')]=_0xdc94e7||_0x5f29b0['user']||_0xeb7d('0x25');return _0x598da2;};EmailImap[_0xeb7d('0x18')][_0xeb7d('0x26')]=function(){this[_0xeb7d('0x2')][_0xeb7d('0x27')](this[_0xeb7d('0x28')],![],this[_0xeb7d('0x29')]['bind'](this));};EmailImap[_0xeb7d('0x18')][_0xeb7d('0x29')]=function(_0x1331ca,_0x10f02c){if(_0x1331ca){this[_0xeb7d('0x15')](_0x1331ca,!![]);}else{this[_0xeb7d('0x2a')](_0xeb7d('0x2b'),_0x10f02c);this['readUnseen']();}};EmailImap[_0xeb7d('0x18')][_0xeb7d('0x2c')]=function(_0x69b982){if(_0x69b982){this[_0xeb7d('0x15')](_0x69b982,!![]);}else{this[_0xeb7d('0x2')][_0xeb7d('0x11')]();}};EmailImap[_0xeb7d('0x18')][_0xeb7d('0x2d')]=function(){this[_0xeb7d('0x2')]['search']([_0xeb7d('0x2e')],this[_0xeb7d('0x2f')][_0xeb7d('0x13')](this));};EmailImap[_0xeb7d('0x18')][_0xeb7d('0x2f')]=function(_0xf9aa09,_0x26118c){if(_0xf9aa09){this[_0xeb7d('0x15')](_0xf9aa09,!![]);}else{if(_0x26118c[_0xeb7d('0x30')]){try{var _0x324d4a=this[_0xeb7d('0x2')][_0xeb7d('0x31')](_0x26118c,{'bodies':'','markSeen':!![]});_0x324d4a['on'](_0xeb7d('0x32'),this[_0xeb7d('0x33')][_0xeb7d('0x13')](this));_0x324d4a[_0xeb7d('0xf')](_0xeb7d('0x14'),this[_0xeb7d('0x34')][_0xeb7d('0x13')](this));_0x324d4a[_0xeb7d('0xf')](_0xeb7d('0x11'),this[_0xeb7d('0x35')][_0xeb7d('0x13')](this));}catch(_0x46881c){logger[_0xeb7d('0x14')](_0x46881c);}}else{this[_0xeb7d('0x2')][_0xeb7d('0x36')](!![],this[_0xeb7d('0x2c')][_0xeb7d('0x13')](this));}}};EmailImap[_0xeb7d('0x18')][_0xeb7d('0x33')]=function(_0x4ba8f3,_0x7eaa0e){_0x4ba8f3['on'](_0xeb7d('0x37'),this[_0xeb7d('0x38')][_0xeb7d('0x13')](this));_0x4ba8f3[_0xeb7d('0xf')]('attributes',this[_0xeb7d('0x39')][_0xeb7d('0x13')](this));_0x4ba8f3['once'](_0xeb7d('0x11'),this[_0xeb7d('0x3a')][_0xeb7d('0x13')](this));};EmailImap[_0xeb7d('0x18')][_0xeb7d('0x38')]=function(_0x2c7685,_0x25b968){simpleParser(_0x2c7685,{'Iconv':Iconv},this['handleSimpleParser'][_0xeb7d('0x13')](this));};EmailImap['prototype'][_0xeb7d('0x39')]=function(_0x472468){};EmailImap[_0xeb7d('0x18')][_0xeb7d('0x3a')]=function(){};EmailImap[_0xeb7d('0x18')][_0xeb7d('0x3b')]=function(_0x398527,_0x2b5ae0){if(_0x398527){logger[_0xeb7d('0x14')](_0x398527);}else{var _0x3db105=this;utils[_0xeb7d('0x3c')](this[_0xeb7d('0xd')],_0x2b5ae0,function(_0x150977){_0x3db105[_0xeb7d('0x2a')](_0xeb7d('0xb'),_0x150977);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0xeb7d('0x2')][_0xeb7d('0x36')](!![],this[_0xeb7d('0x2c')][_0xeb7d('0x13')](this));};EmailImap[_0xeb7d('0x18')][_0xeb7d('0x34')]=function(_0x4efb37){this[_0xeb7d('0x15')](_0x4efb37);this['imap'][_0xeb7d('0x36')](!![],this[_0xeb7d('0x2c')][_0xeb7d('0x13')](this));};EmailImap[_0xeb7d('0x18')][_0xeb7d('0x12')]=function(){this['emit'](_0xeb7d('0x11'));};EmailImap['prototype'][_0xeb7d('0x15')]=function(_0x46babd,_0x3152ba){logger[_0xeb7d('0x14')](_0xeb7d('0x15'),this[_0xeb7d('0xd')][_0xeb7d('0xb')],JSON['stringify'](_0x46babd));var _0x1210ed='';if(_0x46babd){if(_0x46babd[_0xeb7d('0x3d')]){_0x1210ed=_0x46babd['textCode'];}else{for(var _0x2b2426 in _0x46babd){if(_0x46babd['hasOwnProperty'](_0x2b2426)){_0x1210ed+=_[_0xeb7d('0x3e')](_0x2b2426)+':\x20'+_0x46babd[_0x2b2426]+'\x0a';}}}}if(_0x3152ba){this[_0xeb7d('0x2')]['end']();}else{this[_0xeb7d('0x2a')](_0xeb7d('0x14'),_0x1210ed);this[_0xeb7d('0x2a')]('end');}};module[_0xeb7d('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 0933efd..4c43361 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 _0xb4fa=['compile','sendMail','toString','prototype','verify','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','createTransport','use'];(function(_0x50dde6,_0xe9ebc0){var _0x4fe664=function(_0x3be79b){while(--_0x3be79b){_0x50dde6['push'](_0x50dde6['shift']());}};_0x4fe664(++_0xe9ebc0);}(_0xb4fa,0x1ea));var _0xab4f=function(_0x5707b7,_0x25a991){_0x5707b7=_0x5707b7-0x0;var _0x1c6b32=_0xb4fa[_0x5707b7];return _0x1c6b32;};'use strict';var nodemailer=require(_0xab4f('0x0'));var BPromise=require(_0xab4f('0x1'));var inlineBase64=require(_0xab4f('0x2'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x1d16a0,_0x4ceb6a){return new BPromise(function(_0x1a9399,_0x35c09c){var _0x12948f=nodemailer[_0xab4f('0x3')](_0x1d16a0);_0x12948f[_0xab4f('0x4')](_0xab4f('0x5'),inlineBase64());_0x12948f[_0xab4f('0x6')](_0x4ceb6a,function(_0x4b11cf,_0x22fb09){if(_0x4b11cf){_0x35c09c(_0x4b11cf[_0xab4f('0x7')]());}else{_0x1a9399(_0x22fb09);}});});};EmailSmtp[_0xab4f('0x8')]['verify']=function(_0x28be21){return new BPromise(function(_0xfd5ef,_0x1e04ae){var _0x29fd83=nodemailer[_0xab4f('0x3')](_0x28be21);_0x29fd83[_0xab4f('0x9')](function(_0x402622,_0x3d0118){if(_0x402622){_0x1e04ae(_0x402622['toString']());}else{if(_0x3d0118){_0xfd5ef(_0x3d0118);}else{_0x1e04ae('Not\x20verifired');}}});});};module[_0xab4f('0xa')]=EmailSmtp; \ No newline at end of file +var _0x41b9=['Not\x20verifired','exports','bluebird','prototype','send','sendMail','toString','verify','createTransport'];(function(_0x286237,_0x26f1f1){var _0x6a09fa=function(_0x3898d4){while(--_0x3898d4){_0x286237['push'](_0x286237['shift']());}};_0x6a09fa(++_0x26f1f1);}(_0x41b9,0xec));var _0x941b=function(_0x30b3b7,_0x573ba2){_0x30b3b7=_0x30b3b7-0x0;var _0x218101=_0x41b9[_0x30b3b7];return _0x218101;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x941b('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x941b('0x1')][_0x941b('0x2')]=function(_0x4c26bf,_0x437cb4){return new BPromise(function(_0x300b84,_0x5afc2f){var _0x20d377=nodemailer['createTransport'](_0x4c26bf);_0x20d377['use']('compile',inlineBase64());_0x20d377[_0x941b('0x3')](_0x437cb4,function(_0x41aec5,_0x1d9017){if(_0x41aec5){_0x5afc2f(_0x41aec5[_0x941b('0x4')]());}else{_0x300b84(_0x1d9017);}});});};EmailSmtp['prototype'][_0x941b('0x5')]=function(_0x249545){return new BPromise(function(_0x5822cd,_0xb116b3){var _0x1f9bfb=nodemailer[_0x941b('0x6')](_0x249545);_0x1f9bfb[_0x941b('0x5')](function(_0x2e45b9,_0x1c008e){if(_0x2e45b9){_0xb116b3(_0x2e45b9['toString']());}else{if(_0x1c008e){_0x5822cd(_0x1c008e);}else{_0xb116b3(_0x941b('0x7'));}}});});};module[_0x941b('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 d809b4d..708a48c 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 _0x6b86=['Empty\x20message

','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','@xcally.com','head','name','length','join','split','isEmpty','test','html','includes','push','replace','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body'];(function(_0x17eec6,_0x54a955){var _0x1e4d32=function(_0x3d2e36){while(--_0x3d2e36){_0x17eec6['push'](_0x17eec6['shift']());}};_0x1e4d32(++_0x54a955);}(_0x6b86,0x1a4));var _0x66b8=function(_0xa71f32,_0x2fbb11){_0xa71f32=_0xa71f32-0x0;var _0x3660e1=_0x6b86[_0xa71f32];return _0x3660e1;};'use strict';var _=require(_0x66b8('0x0'));var moment=require(_0x66b8('0x1'));var random=require(_0x66b8('0x2'));var fs=require('fs');var path=require(_0x66b8('0x3'));var util=require('util');var tnef=require(_0x66b8('0x4'));var logger=require(_0x66b8('0x5'))(_0x66b8('0x6'));var config=require(_0x66b8('0x7'));function getAddress(_0x16c3ef){var _0x4ddf6c=_['head'](_0x16c3ef[_0x66b8('0x8')]);return _0x4ddf6c&&_0x4ddf6c[_0x66b8('0x9')]?_0x4ddf6c[_0x66b8('0x9')]:_0x66b8('0xa')+random['generate'](0x6)+_0x66b8('0xb');}function getFirstName(_0x5f510b){var _0xf5e79e=_[_0x66b8('0xc')](_0x5f510b[_0x66b8('0x8')]);if(_0xf5e79e&&_0xf5e79e[_0x66b8('0xd')]){var _0x4d42d3=_0xf5e79e['name']['split'](/\s+/);return _0x4d42d3[_0x66b8('0xe')]?_0x4d42d3['slice'](0x0,-0x1)[_0x66b8('0xf')]('\x20'):_0xf5e79e[_0x66b8('0xd')];}return'Anonymous';}function getLastName(_0x495363){var _0x9a6fb9=_[_0x66b8('0xc')](_0x495363[_0x66b8('0x8')]);if(_0x9a6fb9&&_0x9a6fb9[_0x66b8('0xd')]){var _0x3ab880=_0x9a6fb9[_0x66b8('0xd')][_0x66b8('0x10')](/\s+/);return _0x3ab880[_0x66b8('0xe')]>0x1?_0x3ab880['pop']():'';}return'';}function getMails(_0xba9f56,_0x43c8d4){var _0x32fb9f='';for(var _0x357501=0x0;_0x357501<_0x43c8d4[_0x66b8('0x8')][_0x66b8('0xe')];_0x357501+=0x1){if(_0x43c8d4[_0x66b8('0x8')][_0x357501][_0x66b8('0x9')]!==_0xba9f56){if(!_[_0x66b8('0x11')](_0x32fb9f)){_0x32fb9f+=',';}_0x32fb9f+=_0x43c8d4[_0x66b8('0x8')][_0x357501][_0x66b8('0xd')]||_0x43c8d4[_0x66b8('0x8')][_0x357501][_0x66b8('0x9')]||'';_0x32fb9f+='\x20<';_0x32fb9f+=_0x43c8d4[_0x66b8('0x8')][_0x357501][_0x66b8('0x9')]?_0x43c8d4[_0x66b8('0x8')][_0x357501][_0x66b8('0x9')]:_0x66b8('0xa')+random['generate'](0x6)+_0x66b8('0xb');_0x32fb9f+='>';}}return _0x32fb9f;}function parseEmail(_0x5613bf,_0x4dba7e,_0x331cb4){if(_0x4dba7e['html']){var _0x183433=/)<[^<]*)*<\/script>/gi;while(_0x183433[_0x66b8('0x12')](_0x4dba7e[_0x66b8('0x13')])){_0x4dba7e[_0x66b8('0x13')]=_0x4dba7e['html']['replace'](_0x183433,'');}if(_0x4dba7e[_0x66b8('0x13')][_0x66b8('0x14')]('{_0x174f2b[_0x66b8('0x15')](_0x9b5d77['filename']);});var _0x4505c5=/]+>/g;var _0x94c3db=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x340327=_0x4dba7e[_0x66b8('0x13')][_0x66b8('0x16')](_0x94c3db,_0x66b8('0x17'));var _0x19834e=_0x340327[_0x66b8('0x16')](_0x4505c5,_0x66b8('0x18'));for(let _0x293e7d=0x0;_0x293e7d<_0x174f2b[_0x66b8('0xe')];_0x293e7d++){var _0x1dba0e=_0x19834e[_0x66b8('0x16')](_0x66b8('0x18'),_0x66b8('0x19')+_0x174f2b[_0x293e7d]+_0x66b8('0x1a'));_0x19834e=_0x1dba0e;}_0x4dba7e['html']=_0x19834e;}_0x331cb4['body']=_0x4dba7e[_0x66b8('0x13')];}else{_0x331cb4[_0x66b8('0x1b')]=_0x4dba7e['textAsHtml'];}if(_0x331cb4[_0x66b8('0x1b')]){_0x331cb4[_0x66b8('0x1b')]=_0x331cb4['body'][_0x66b8('0x16')](/Empty\x20message

';if(_0x15bbef[_0x66b8('0x34')]){for(var _0x35e963=0x0;_0x35e963<_0x15bbef[_0x66b8('0x34')]['length'];_0x35e963++){var _0x147561=_0x15bbef[_0x66b8('0x34')][_0x35e963];_0x5c507d['message']['attachments'][_0x66b8('0x15')]({'filename':_0x147561[_0x66b8('0x35')],'content':new Buffer(_0x147561['Data'])});}}}_0x263a77(parseEmail(_0x2179f3,_0x2f7197,_0x5c507d));});}else{_0x2f7197[_0x66b8('0x13')]=_0x66b8('0x36');_0x263a77(parseEmail(_0x2179f3,_0x2f7197,_0x5c507d));}}else{_0x263a77(parseEmail(_0x2179f3,_0x2f7197,_0x5c507d));}};exports[_0x66b8('0x37')]=function(_0x11fd43){switch(_0x11fd43){case _0x66b8('0x38'):return _0x66b8('0x39');case _0x66b8('0x3a'):return _0x66b8('0x3b');case _0x66b8('0x3c'):return _0x66b8('0x3d');case _0x66b8('0x3e'):return'outlook.office365.com';}return _0x66b8('0x3f');}; \ No newline at end of file +var _0x12c4=['

Empty\x20message

','Attachments','Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','path','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','name','split','length','slice','join','pop','isEmpty','html','replace','\x20[Attachment:\x20','\x20]','textAsHtml','body','originTo','message','includes','originCc','attachments','type','attachment','filename','attachment-','format','now','root','server/files/attachments/','writeFileSync','contentType','parser','from','messageId','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','parseBuffer','first','content','BodyHTML'];(function(_0x363421,_0x4adc67){var _0x25646f=function(_0x277ba4){while(--_0x277ba4){_0x363421['push'](_0x363421['shift']());}};_0x25646f(++_0x4adc67);}(_0x12c4,0x94));var _0x412c=function(_0x23c433,_0x9791ed){_0x23c433=_0x23c433-0x0;var _0x127121=_0x12c4[_0x23c433];return _0x127121;};'use strict';var _=require(_0x412c('0x0'));var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require(_0x412c('0x1'));var util=require('util');var tnef=require(_0x412c('0x2'));var logger=require('../../../config/logger')(_0x412c('0x3'));var config=require(_0x412c('0x4'));function getAddress(_0x302b98){var _0x38da5b=_[_0x412c('0x5')](_0x302b98[_0x412c('0x6')]);return _0x38da5b&&_0x38da5b[_0x412c('0x7')]?_0x38da5b[_0x412c('0x7')]:_0x412c('0x8')+random[_0x412c('0x9')](0x6)+'@xcally.com';}function getFirstName(_0x2b466e){var _0x5d611a=_[_0x412c('0x5')](_0x2b466e[_0x412c('0x6')]);if(_0x5d611a&&_0x5d611a[_0x412c('0xa')]){var _0x29d76d=_0x5d611a['name'][_0x412c('0xb')](/\s+/);return _0x29d76d[_0x412c('0xc')]?_0x29d76d[_0x412c('0xd')](0x0,-0x1)[_0x412c('0xe')]('\x20'):_0x5d611a[_0x412c('0xa')];}return'Anonymous';}function getLastName(_0x251b8f){var _0x4f987c=_[_0x412c('0x5')](_0x251b8f[_0x412c('0x6')]);if(_0x4f987c&&_0x4f987c[_0x412c('0xa')]){var _0x492085=_0x4f987c['name'][_0x412c('0xb')](/\s+/);return _0x492085[_0x412c('0xc')]>0x1?_0x492085[_0x412c('0xf')]():'';}return'';}function getMails(_0x24abb5,_0x2ce5d1){var _0x2632b3='';for(var _0x3d8205=0x0;_0x3d8205<_0x2ce5d1[_0x412c('0x6')][_0x412c('0xc')];_0x3d8205+=0x1){if(_0x2ce5d1[_0x412c('0x6')][_0x3d8205][_0x412c('0x7')]!==_0x24abb5){if(!_[_0x412c('0x10')](_0x2632b3)){_0x2632b3+=',';}_0x2632b3+=_0x2ce5d1['value'][_0x3d8205][_0x412c('0xa')]||_0x2ce5d1[_0x412c('0x6')][_0x3d8205][_0x412c('0x7')]||'';_0x2632b3+='\x20<';_0x2632b3+=_0x2ce5d1[_0x412c('0x6')][_0x3d8205][_0x412c('0x7')]?_0x2ce5d1['value'][_0x3d8205][_0x412c('0x7')]:'anonymous'+random[_0x412c('0x9')](0x6)+'@xcally.com';_0x2632b3+='>';}}return _0x2632b3;}function parseEmail(_0x2e55e3,_0x38c47b,_0x5d6beb){if(_0x38c47b['html']){var _0x2f4a91=/)<[^<]*)*<\/script>/gi;while(_0x2f4a91['test'](_0x38c47b[_0x412c('0x11')])){_0x38c47b[_0x412c('0x11')]=_0x38c47b[_0x412c('0x11')][_0x412c('0x12')](_0x2f4a91,'');}if(_0x38c47b[_0x412c('0x11')]['includes'](_0x412c('0x13'))){var _0x47e3bb=[];_0x38c47b['attachments'][_0x412c('0x14')](_0x1a9a7e=>{_0x47e3bb[_0x412c('0x15')](_0x1a9a7e['filename']);});var _0x46c2b8=/]+>/g;var _0x511da2=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x86bc22=_0x38c47b[_0x412c('0x11')][_0x412c('0x12')](_0x511da2,'_SRC');var _0x4c07c4=_0x86bc22[_0x412c('0x12')](_0x46c2b8,_0x412c('0x16'));for(let _0x18ce56=0x0;_0x18ce56<_0x47e3bb[_0x412c('0xc')];_0x18ce56++){var _0x4d97c4=_0x4c07c4[_0x412c('0x12')](_0x412c('0x16'),_0x412c('0x17')+_0x47e3bb[_0x18ce56]+_0x412c('0x18'));_0x4c07c4=_0x4d97c4;}_0x38c47b['html']=_0x4c07c4;}_0x5d6beb['body']=_0x38c47b[_0x412c('0x11')];}else{_0x5d6beb['body']=_0x38c47b[_0x412c('0x19')];}if(_0x5d6beb[_0x412c('0x1a')]){_0x5d6beb[_0x412c('0x1a')]=_0x5d6beb[_0x412c('0x1a')]['replace'](/0x0){if(this[_0x3cfd9a+_0x7601('0x29')]>0x0&&this[_0x3cfd9a+'CurrentCapacity']>=this[_0x3cfd9a+_0x7601('0x29')]){return _0x7601('0x2a');}else{return _0x7601('0x2b');}}else{return _0x7601('0x2c');}};Agent['prototype'][_0x7601('0x25')]=function(){var _0x53425f=[_0x7601('0x2d'),'chat','openchannel',_0x7601('0x2e'),_0x7601('0x2f'),'whatsapp'];for(var _0x4c3c24=0x0;_0x4c3c24<_0x53425f[_0x7601('0x30')];_0x4c3c24+=0x1){var _0x519e47=this['getChannelStatus'](_0x53425f[_0x4c3c24]);if(this[_0x53425f[_0x4c3c24]+_0x7601('0x31')]!==_0x519e47){this[_0x53425f[_0x4c3c24]+_0x7601('0x32')]=_[_0x7601('0x33')](moment()['format']('x'));}this[_0x53425f[_0x4c3c24]+_0x7601('0x31')]=_0x519e47;}var _0x4a2321={'id':this['id'],'name':this[_0x7601('0x6')],'online':this[_0x7601('0x7')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0x7601('0xa')],'smsPause':this[_0x7601('0xc')],'faxPause':this[_0x7601('0xb')],'openchannelPause':this[_0x7601('0xd')],'chatStatus':this[_0x7601('0xe')],'chatStatusTime':this[_0x7601('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x7601('0x13')],'mailStatusTime':this[_0x7601('0x14')],'mailCapacity':this[_0x7601('0x15')],'mailCurrentCapacity':this[_0x7601('0x34')],'faxStatus':this[_0x7601('0x16')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x7601('0x19')],'smsStatus':this[_0x7601('0x1a')],'smsStatusTime':this[_0x7601('0x1b')],'smsCapacity':this[_0x7601('0x1c')],'smsCurrentCapacity':this[_0x7601('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x7601('0x35')],'whatsappCapacity':this[_0x7601('0x1e')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x7601('0x20')],'openchannelStatusTime':this[_0x7601('0x21')],'openchannelCapacity':this[_0x7601('0x22')],'openchannelCurrentCapacity':this[_0x7601('0x36')],'busy':this[_0x7601('0x23')],'busyQueue':this['busyQueue']};var _0x3c5595=md5(JSON[_0x7601('0x37')](_0x4a2321));if(this[_0x7601('0x2')]!==_0x3c5595){this[_0x7601('0x2')]=_0x3c5595;io['emit'](_0x7601('0x38'),_0x4a2321);}};module['exports']=Agent; \ No newline at end of file +var _0xd070=['smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','busy','getChannelStatus','CurrentCapacity','working','idle','prototype','updateRealtime','chat','fax','sms','Status','StatusTime','toNumber','format','openchannelPause','chatStatusTime','faxStatusTime','faxCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busyQueue','stringify','emit','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus'];(function(_0x2ed260,_0x1a3687){var _0x223c99=function(_0x48aa4a){while(--_0x48aa4a){_0x2ed260['push'](_0x2ed260['shift']());}};_0x223c99(++_0x1a3687);}(_0xd070,0x8e));var _0x0d07=function(_0x42aa10,_0x268968){_0x42aa10=_0x42aa10-0x0;var _0x4ef288=_0xd070[_0x42aa10];return _0x4ef288;};'use strict';var _=require(_0x0d07('0x0'));var moment=require('moment');var md5=require(_0x0d07('0x1'));var Redis=require(_0x0d07('0x2'));var config=require(_0x0d07('0x3'));config[_0x0d07('0x4')]=_[_0x0d07('0x5')](config[_0x0d07('0x4')],{'host':_0x0d07('0x6'),'port':0x18eb});var io=require(_0x0d07('0x7'))(new Redis(config[_0x0d07('0x4')]));function Agent(_0x64ec6e){this['id']=_0x64ec6e['id']||0x0;this[_0x0d07('0x8')]=_0x64ec6e['name']||'';this[_0x0d07('0x9')]=_0x64ec6e['online']||!![];this[_0x0d07('0xa')]=_0x64ec6e[_0x0d07('0xa')]||![];this[_0x0d07('0xb')]=_0x64ec6e[_0x0d07('0xb')]||![];this[_0x0d07('0xc')]=_0x64ec6e[_0x0d07('0xc')]||![];this[_0x0d07('0xd')]=_0x64ec6e[_0x0d07('0xd')]||![];this[_0x0d07('0xe')]=_0x64ec6e[_0x0d07('0xe')]||![];this['openchannelPause']=_0x64ec6e['openchannelPause']||![];this[_0x0d07('0xf')]=_0x0d07('0x10');this['chatStatusTime']=0x0;this[_0x0d07('0x11')]=_0x64ec6e['chatCapacity']||0x0;this[_0x0d07('0x12')]=0x0;this[_0x0d07('0x13')]='unknown';this[_0x0d07('0x14')]=0x0;this[_0x0d07('0x15')]=_0x64ec6e[_0x0d07('0x15')]||0x0;this[_0x0d07('0x16')]=0x0;this[_0x0d07('0x17')]=_0x0d07('0x10');this['faxStatusTime']=0x0;this[_0x0d07('0x18')]=_0x64ec6e['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x0d07('0x19')]=_0x0d07('0x10');this[_0x0d07('0x1a')]=0x0;this[_0x0d07('0x1b')]=_0x64ec6e[_0x0d07('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']='unknown';this[_0x0d07('0x1c')]=0x0;this[_0x0d07('0x1d')]=_0x64ec6e['whatsappCapacity']||0x0;this[_0x0d07('0x1e')]=0x0;this['openchannelStatus']=_0x0d07('0x10');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x64ec6e[_0x0d07('0x1f')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x0d07('0x20')]=![];this['busyQueue']=undefined;this[_0x0d07('0x1')]='';this['updateRealtime']();}Agent['prototype'][_0x0d07('0x21')]=function(_0x411e4c){if(this[_0x411e4c+_0x0d07('0x22')]>0x0){if(this[_0x411e4c+'Capacity']>0x0&&this[_0x411e4c+_0x0d07('0x22')]>=this[_0x411e4c+'Capacity']){return'maxcapacity';}else{return _0x0d07('0x23');}}else{return _0x0d07('0x24');}};Agent[_0x0d07('0x25')][_0x0d07('0x26')]=function(){var _0x4e0c97=['mail',_0x0d07('0x27'),'openchannel',_0x0d07('0x28'),_0x0d07('0x29'),'whatsapp'];for(var _0x44a14c=0x0;_0x44a14c<_0x4e0c97['length'];_0x44a14c+=0x1){var _0x483cb7=this['getChannelStatus'](_0x4e0c97[_0x44a14c]);if(this[_0x4e0c97[_0x44a14c]+_0x0d07('0x2a')]!==_0x483cb7){this[_0x4e0c97[_0x44a14c]+_0x0d07('0x2b')]=_[_0x0d07('0x2c')](moment()[_0x0d07('0x2d')]('x'));}this[_0x4e0c97[_0x44a14c]+_0x0d07('0x2a')]=_0x483cb7;}var _0x3fdfa9={'id':this['id'],'name':this[_0x0d07('0x8')],'online':this[_0x0d07('0x9')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0x0d07('0xc')],'smsPause':this[_0x0d07('0xe')],'faxPause':this[_0x0d07('0xd')],'openchannelPause':this[_0x0d07('0x2e')],'chatStatus':this[_0x0d07('0xf')],'chatStatusTime':this[_0x0d07('0x2f')],'chatCapacity':this[_0x0d07('0x11')],'chatCurrentCapacity':this[_0x0d07('0x12')],'mailStatus':this[_0x0d07('0x13')],'mailStatusTime':this[_0x0d07('0x14')],'mailCapacity':this[_0x0d07('0x15')],'mailCurrentCapacity':this[_0x0d07('0x16')],'faxStatus':this[_0x0d07('0x17')],'faxStatusTime':this[_0x0d07('0x30')],'faxCapacity':this[_0x0d07('0x18')],'faxCurrentCapacity':this[_0x0d07('0x31')],'smsStatus':this[_0x0d07('0x19')],'smsStatusTime':this[_0x0d07('0x1a')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x0d07('0x1c')],'whatsappCapacity':this[_0x0d07('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x0d07('0x32')],'openchannelStatusTime':this[_0x0d07('0x33')],'openchannelCapacity':this[_0x0d07('0x1f')],'openchannelCurrentCapacity':this[_0x0d07('0x34')],'busy':this['busy'],'busyQueue':this[_0x0d07('0x35')]};var _0x577273=md5(JSON[_0x0d07('0x36')](_0x3fdfa9));if(this['md5']!==_0x577273){this['md5']=_0x577273;io[_0x0d07('0x37')]('user:save',_0x3fdfa9);}};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 3c58dd1..3a4802e 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 _0xfded=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','md5','emit','exports','lodash','util','ioredis','../../../config/environment'];(function(_0x52f97e,_0x1b5b9e){var _0xbf8ddc=function(_0x243058){while(--_0x243058){_0x52f97e['push'](_0x52f97e['shift']());}};_0xbf8ddc(++_0x1b5b9e);}(_0xfded,0x74));var _0xdfde=function(_0x3f4875,_0x1eee06){_0x3f4875=_0x3f4875-0x0;var _0x1727cf=_0xfded[_0x3f4875];return _0x1727cf;};'use strict';var _=require(_0xdfde('0x0'));var md5=require('md5');var util=require(_0xdfde('0x1'));var Redis=require(_0xdfde('0x2'));var config=require(_0xdfde('0x3'));config[_0xdfde('0x4')]=_[_0xdfde('0x5')](config[_0xdfde('0x4')],{'host':_0xdfde('0x6'),'port':0x18eb});var io=require(_0xdfde('0x7'))(new Redis(config[_0xdfde('0x4')]));function ChatQueue(_0x567ee0){this['id']=_0x567ee0['id']||0x0;this['name']=_0x567ee0[_0xdfde('0x8')]||'';this[_0xdfde('0x9')]=_0x567ee0[_0xdfde('0x9')]||0xa;this[_0xdfde('0xa')]=_0x567ee0[_0xdfde('0xa')]||_0xdfde('0xb');this[_0xdfde('0xc')]=_0x567ee0[_0xdfde('0xc')];this[_0xdfde('0xd')]={};this[_0xdfde('0xe')]=0x0;this['md5']='';this['updateRouting']();this[_0xdfde('0xf')]();}ChatQueue[_0xdfde('0x10')][_0xdfde('0x11')]=function(){var _0x9aba7a=this[_0xdfde('0xd')][_0xdfde('0x12')];this[_0xdfde('0xd')]=_[_0xdfde('0x13')](this[_0xdfde('0xc')],'id');this[_0xdfde('0xd')][_0xdfde('0x12')]=_0x9aba7a;};ChatQueue[_0xdfde('0x10')]['updateRealtime']=function(){this[_0xdfde('0x14')]=0x0;this[_0xdfde('0x15')]=0x0;for(var _0x4c1e4b=0x0;_0x4c1e4b=0x0?this[_0xdfde('0x19')]:0x0;var _0x323b45={'id':this['id'],'available':this[_0xdfde('0x19')],'loggedIn':this[_0xdfde('0x14')],'name':this[_0xdfde('0x8')],'paused':this[_0xdfde('0x15')],'waiting':this[_0xdfde('0xe')]};var _0x443a2e=md5(JSON[_0xdfde('0x1a')](_0x323b45));if(this[_0xdfde('0x1b')]!==_0x443a2e){this['md5']=_0x443a2e;io['to'](util['format']('chat:queue:%s',_0x323b45[_0xdfde('0x8')]))[_0xdfde('0x1c')]('chat_queue:save',_0x323b45);}};module[_0xdfde('0x1d')]=ChatQueue; \ No newline at end of file +var _0xd2f1=['lodash','md5','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','online','chatPause','available','stringify','chat:queue:%s','chat_queue:save','exports'];(function(_0x3b3f90,_0x388364){var _0x52522e=function(_0x86729e){while(--_0x86729e){_0x3b3f90['push'](_0x3b3f90['shift']());}};_0x52522e(++_0x388364);}(_0xd2f1,0x1a9));var _0x1d2f=function(_0x4d35db,_0x260f20){_0x4d35db=_0x4d35db-0x0;var _0x3e4c00=_0xd2f1[_0x4d35db];return _0x3e4c00;};'use strict';var _=require(_0x1d2f('0x0'));var md5=require(_0x1d2f('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x1d2f('0x2')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1d2f('0x3'))(new Redis(config[_0x1d2f('0x2')]));function ChatQueue(_0x3b0ae3){this['id']=_0x3b0ae3['id']||0x0;this[_0x1d2f('0x4')]=_0x3b0ae3[_0x1d2f('0x4')]||'';this[_0x1d2f('0x5')]=_0x3b0ae3[_0x1d2f('0x5')]||0xa;this[_0x1d2f('0x6')]=_0x3b0ae3[_0x1d2f('0x6')]||_0x1d2f('0x7');this[_0x1d2f('0x8')]=_0x3b0ae3[_0x1d2f('0x8')];this[_0x1d2f('0x9')]={};this[_0x1d2f('0xa')]=0x0;this['md5']='';this[_0x1d2f('0xb')]();this['updateRealtime']();}ChatQueue[_0x1d2f('0xc')]['updateRouting']=function(){var _0x2f744d=this[_0x1d2f('0x9')][_0x1d2f('0xd')];this[_0x1d2f('0x9')]=_['map'](this[_0x1d2f('0x8')],'id');this[_0x1d2f('0x9')]['_rr']=_0x2f744d;};ChatQueue[_0x1d2f('0xc')][_0x1d2f('0xe')]=function(){this[_0x1d2f('0xf')]=0x0;this[_0x1d2f('0x10')]=0x0;for(var _0x55c27e=0x0;_0x55c27e=0x0?this[_0x1d2f('0x14')]:0x0;var _0x3bf62e={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x1d2f('0x10')],'waiting':this[_0x1d2f('0xa')]};var _0x235f8f=md5(JSON[_0x1d2f('0x15')](_0x3bf62e));if(this[_0x1d2f('0x1')]!==_0x235f8f){this[_0x1d2f('0x1')]=_0x235f8f;io['to'](util['format'](_0x1d2f('0x16'),_0x3bf62e[_0x1d2f('0x4')]))['emit'](_0x1d2f('0x17'),_0x3bf62e);}};module[_0x1d2f('0x18')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 6fcd56d..9dd6c3f 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 _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x422d00,_0x304532){var _0x2656c4=function(_0x5519e3){while(--_0x5519e3){_0x422d00['push'](_0x422d00['shift']());}};_0x2656c4(++_0x304532);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x3a7609,_0x4c5192){var _0x4cdfa9=function(_0x5f234c){while(--_0x5f234c){_0x3a7609['push'](_0x3a7609['shift']());}};_0x4cdfa9(++_0x4c5192);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index f4d2723..85f6bff 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 _0x418b=['Intervals','exports','name'];(function(_0x11c26e,_0x358b9){var _0x425afb=function(_0xd0191){while(--_0xd0191){_0x11c26e['push'](_0x11c26e['shift']());}};_0x425afb(++_0x358b9);}(_0x418b,0x1e5));var _0xb418=function(_0x488aa6,_0x2eb715){_0x488aa6=_0x488aa6-0x0;var _0x2617a8=_0x418b[_0x488aa6];return _0x2617a8;};'use strict';function Interval(_0x3e2115){this['id']=_0x3e2115['id']||0x0;this[_0xb418('0x0')]=_0x3e2115[_0xb418('0x0')]||'';this[_0xb418('0x1')]=_0x3e2115[_0xb418('0x1')]||{};}module[_0xb418('0x2')]=Interval; \ No newline at end of file +var _0x03a0=['Intervals','exports'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x03a0,0x12a));var _0x003a=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0x03a0[_0x2d91c6];return _0x3a8d19;};'use strict';function Interval(_0x4da5a4){this['id']=_0x4da5a4['id']||0x0;this['name']=_0x4da5a4['name']||'';this[_0x003a('0x0')]=_0x4da5a4[_0x003a('0x0')]||{};}module[_0x003a('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 2f30e7c..b08c636 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 _0x1c01=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRealtime','prototype','updateRouting','mapAgentsId','map','loggedIn','paused','length','mailPause','available','stringify','format','mail:queue:%s','emit','exports','lodash','md5','util','ioredis','redis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1c01,0x190));var _0x11c0=function(_0x372bf8,_0x454209){_0x372bf8=_0x372bf8-0x0;var _0x45d6ea=_0x1c01[_0x372bf8];return _0x45d6ea;};'use strict';var _=require(_0x11c0('0x0'));var md5=require(_0x11c0('0x1'));var util=require(_0x11c0('0x2'));var Redis=require(_0x11c0('0x3'));var config=require('../../../config/environment');config[_0x11c0('0x4')]=_['defaults'](config['redis'],{'host':_0x11c0('0x5'),'port':0x18eb});var io=require(_0x11c0('0x6'))(new Redis(config[_0x11c0('0x4')]));function MailQueue(_0x430bdb){this['id']=_0x430bdb['id']||0x0;this[_0x11c0('0x7')]=_0x430bdb['name']||'';this[_0x11c0('0x8')]=_0x430bdb['timeout']||0xa;this[_0x11c0('0x9')]=_0x430bdb['strategy']||_0x11c0('0xa');this['Agents']=_0x430bdb[_0x11c0('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x11c0('0x1')]='';this['updateRouting']();this[_0x11c0('0xc')]();}MailQueue[_0x11c0('0xd')][_0x11c0('0xe')]=function(){var _0x10bd36=this[_0x11c0('0xf')]['_rr'];this[_0x11c0('0xf')]=_[_0x11c0('0x10')](this[_0x11c0('0xb')],'id');this[_0x11c0('0xf')]['_rr']=_0x10bd36;};MailQueue['prototype'][_0x11c0('0xc')]=function(){this[_0x11c0('0x11')]=0x0;this[_0x11c0('0x12')]=0x0;for(var _0x300286=0x0;_0x300286=0x0?this[_0x11c0('0x15')]:0x0;var _0x3a7c06={'id':this['id'],'available':this[_0x11c0('0x15')],'loggedIn':this[_0x11c0('0x11')],'name':this[_0x11c0('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x165860=md5(JSON[_0x11c0('0x16')](_0x3a7c06));if(this[_0x11c0('0x1')]!==_0x165860){this[_0x11c0('0x1')]=_0x165860;io['to'](util[_0x11c0('0x17')](_0x11c0('0x18'),_0x3a7c06[_0x11c0('0x7')]))[_0x11c0('0x19')]('mail_queue:save',_0x3a7c06);}};module[_0x11c0('0x1a')]=MailQueue; \ No newline at end of file +var _0xafdc=['util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','loggedIn','paused','length','mailPause','available','stringify','format','emit','exports','lodash','md5'];(function(_0x3063e7,_0x4960d5){var _0x1610f8=function(_0x4b542c){while(--_0x4b542c){_0x3063e7['push'](_0x3063e7['shift']());}};_0x1610f8(++_0x4960d5);}(_0xafdc,0xd6));var _0xcafd=function(_0x566a89,_0x569dbd){_0x566a89=_0x566a89-0x0;var _0x4613c0=_0xafdc[_0x566a89];return _0x4613c0;};'use strict';var _=require(_0xcafd('0x0'));var md5=require(_0xcafd('0x1'));var util=require(_0xcafd('0x2'));var Redis=require(_0xcafd('0x3'));var config=require(_0xcafd('0x4'));config['redis']=_[_0xcafd('0x5')](config[_0xcafd('0x6')],{'host':_0xcafd('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcafd('0x6')]));function MailQueue(_0x130d2e){this['id']=_0x130d2e['id']||0x0;this['name']=_0x130d2e[_0xcafd('0x8')]||'';this[_0xcafd('0x9')]=_0x130d2e[_0xcafd('0x9')]||0xa;this[_0xcafd('0xa')]=_0x130d2e['strategy']||'beepall';this[_0xcafd('0xb')]=_0x130d2e['Agents'];this['mapAgentsId']={};this[_0xcafd('0xc')]=0x0;this[_0xcafd('0x1')]='';this['updateRouting']();this[_0xcafd('0xd')]();}MailQueue[_0xcafd('0xe')][_0xcafd('0xf')]=function(){var _0x5d08ec=this[_0xcafd('0x10')][_0xcafd('0x11')];this[_0xcafd('0x10')]=_['map'](this['Agents'],'id');this[_0xcafd('0x10')][_0xcafd('0x11')]=_0x5d08ec;};MailQueue[_0xcafd('0xe')][_0xcafd('0xd')]=function(){this[_0xcafd('0x12')]=0x0;this[_0xcafd('0x13')]=0x0;for(var _0x52b742=0x0;_0x52b742=0x0?this['available']:0x0;var _0x1b3d90={'id':this['id'],'available':this['available'],'loggedIn':this[_0xcafd('0x12')],'name':this[_0xcafd('0x8')],'paused':this[_0xcafd('0x13')],'waiting':this[_0xcafd('0xc')]};var _0x335f64=md5(JSON[_0xcafd('0x17')](_0x1b3d90));if(this[_0xcafd('0x1')]!==_0x335f64){this[_0xcafd('0x1')]=_0x335f64;io['to'](util[_0xcafd('0x18')]('mail:queue:%s',_0x1b3d90['name']))[_0xcafd('0x19')]('mail_queue:save',_0x1b3d90);}};module[_0xcafd('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 73014ca..f8227f6 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 _0xa083=['openchannelPause','paused','available','waiting','stringify','format','openchannel:queue:%s','emit','exports','lodash','md5','util','defaults','redis','localhost','name','timeout','beepall','Agents','updateRouting','mapAgentsId','_rr','prototype','updateRealtime','length','loggedIn'];(function(_0xfa2867,_0x5e10bf){var _0x2ea85c=function(_0x4fb09a){while(--_0x4fb09a){_0xfa2867['push'](_0xfa2867['shift']());}};_0x2ea85c(++_0x5e10bf);}(_0xa083,0x141));var _0x3a08=function(_0x537831,_0x355bfe){_0x537831=_0x537831-0x0;var _0x4700cb=_0xa083[_0x537831];return _0x4700cb;};'use strict';var _=require(_0x3a08('0x0'));var md5=require(_0x3a08('0x1'));var util=require(_0x3a08('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x3a08('0x3')](config[_0x3a08('0x4')],{'host':_0x3a08('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3a08('0x4')]));function OpenchannelQueue(_0x2a9dc7){this['id']=_0x2a9dc7['id']||0x0;this['name']=_0x2a9dc7[_0x3a08('0x6')]||'';this[_0x3a08('0x7')]=_0x2a9dc7[_0x3a08('0x7')]||0xa;this['strategy']=_0x2a9dc7['strategy']||_0x3a08('0x8');this[_0x3a08('0x9')]=_0x2a9dc7[_0x3a08('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x3a08('0x1')]='';this[_0x3a08('0xa')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x3a08('0xa')]=function(){var _0x9271a9=this[_0x3a08('0xb')][_0x3a08('0xc')];this[_0x3a08('0xb')]=_['map'](this[_0x3a08('0x9')],'id');this[_0x3a08('0xb')][_0x3a08('0xc')]=_0x9271a9;};OpenchannelQueue[_0x3a08('0xd')][_0x3a08('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x159622=0x0;_0x159622=0x0?this[_0x3a08('0x13')]:0x0;var _0x57e9b8={'id':this['id'],'available':this[_0x3a08('0x13')],'loggedIn':this['loggedIn'],'name':this[_0x3a08('0x6')],'paused':this[_0x3a08('0x12')],'waiting':this[_0x3a08('0x14')]};var _0xfd0f27=md5(JSON[_0x3a08('0x15')](_0x57e9b8));if(this[_0x3a08('0x1')]!==_0xfd0f27){this['md5']=_0xfd0f27;io['to'](util[_0x3a08('0x16')](_0x3a08('0x17'),_0x57e9b8[_0x3a08('0x6')]))[_0x3a08('0x18')]('openchannel_queue:save',_0x57e9b8);}};module[_0x3a08('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x2887=['online','openchannelPause','paused','available','format','openchannel:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','waiting','updateRealtime','updateRouting','mapAgentsId','_rr','map','loggedIn'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x2887,0x1a7));var _0x7288=function(_0x5bd103,_0x3b8037){_0x5bd103=_0x5bd103-0x0;var _0xc33b64=_0x2887[_0x5bd103];return _0xc33b64;};'use strict';var _=require(_0x7288('0x0'));var md5=require(_0x7288('0x1'));var util=require(_0x7288('0x2'));var Redis=require(_0x7288('0x3'));var config=require(_0x7288('0x4'));config[_0x7288('0x5')]=_[_0x7288('0x6')](config[_0x7288('0x5')],{'host':_0x7288('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function OpenchannelQueue(_0x2c1480){this['id']=_0x2c1480['id']||0x0;this['name']=_0x2c1480[_0x7288('0x8')]||'';this[_0x7288('0x9')]=_0x2c1480[_0x7288('0x9')]||0xa;this['strategy']=_0x2c1480[_0x7288('0xa')]||'beepall';this[_0x7288('0xb')]=_0x2c1480[_0x7288('0xb')];this['mapAgentsId']={};this[_0x7288('0xc')]=0x0;this[_0x7288('0x1')]='';this['updateRouting']();this[_0x7288('0xd')]();}OpenchannelQueue['prototype'][_0x7288('0xe')]=function(){var _0x409b59=this[_0x7288('0xf')][_0x7288('0x10')];this[_0x7288('0xf')]=_[_0x7288('0x11')](this[_0x7288('0xb')],'id');this[_0x7288('0xf')][_0x7288('0x10')]=_0x409b59;};OpenchannelQueue['prototype'][_0x7288('0xd')]=function(){this[_0x7288('0x12')]=0x0;this['paused']=0x0;for(var _0x46466c=0x0;_0x46466c=0x0?this[_0x7288('0x16')]:0x0;var _0x5e7a6c={'id':this['id'],'available':this[_0x7288('0x16')],'loggedIn':this[_0x7288('0x12')],'name':this[_0x7288('0x8')],'paused':this[_0x7288('0x15')],'waiting':this['waiting']};var _0x28fed5=md5(JSON['stringify'](_0x5e7a6c));if(this[_0x7288('0x1')]!==_0x28fed5){this['md5']=_0x28fed5;io['to'](util[_0x7288('0x17')](_0x7288('0x18'),_0x5e7a6c['name']))['emit']('openchannel_queue:save',_0x5e7a6c);}};module[_0x7288('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index c32d29c..cd1f8d6 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 _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0xf57573,_0x3657b8){var _0xc0e1b0=function(_0xb9082){while(--_0xb9082){_0xf57573['push'](_0xf57573['shift']());}};_0xc0e1b0(++_0x3657b8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file +var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x10b0e2,_0x44ddf4){var _0x2c30bd=function(_0x31616e){while(--_0x31616e){_0x10b0e2['push'](_0x10b0e2['shift']());}};_0x2c30bd(++_0x44ddf4);}(_0xb7e7,0x121));var _0x7b7e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb7e7[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7d02207..457e9ff 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 _0xf2a3=['defaults','redis','localhost','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','online','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment'];(function(_0x6b5128,_0x1db588){var _0x1c5b79=function(_0x1e1b1f){while(--_0x1e1b1f){_0x6b5128['push'](_0x6b5128['shift']());}};_0x1c5b79(++_0x1db588);}(_0xf2a3,0xc7));var _0x3f2a=function(_0x2377e3,_0x2c0352){_0x2377e3=_0x2377e3-0x0;var _0x2a6d1b=_0xf2a3[_0x2377e3];return _0x2a6d1b;};'use strict';var _=require(_0x3f2a('0x0'));var md5=require('md5');var util=require(_0x3f2a('0x1'));var Redis=require(_0x3f2a('0x2'));var config=require(_0x3f2a('0x3'));config['redis']=_[_0x3f2a('0x4')](config[_0x3f2a('0x5')],{'host':_0x3f2a('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3f2a('0x5')]));function WhatsappQueue(_0x712b){this['id']=_0x712b['id']||0x0;this[_0x3f2a('0x7')]=_0x712b[_0x3f2a('0x7')]||'';this[_0x3f2a('0x8')]=_0x712b[_0x3f2a('0x8')]||0xa;this[_0x3f2a('0x9')]=_0x712b[_0x3f2a('0x9')]||'beepall';this['Agents']=_0x712b['Agents'];this[_0x3f2a('0xa')]={};this[_0x3f2a('0xb')]=0x0;this[_0x3f2a('0xc')]='';this[_0x3f2a('0xd')]();this[_0x3f2a('0xe')]();}WhatsappQueue[_0x3f2a('0xf')][_0x3f2a('0xd')]=function(){var _0x22a82d=this[_0x3f2a('0xa')]['_rr'];this['mapAgentsId']=_[_0x3f2a('0x10')](this[_0x3f2a('0x11')],'id');this[_0x3f2a('0xa')][_0x3f2a('0x12')]=_0x22a82d;};WhatsappQueue[_0x3f2a('0xf')][_0x3f2a('0xe')]=function(){this[_0x3f2a('0x13')]=0x0;this[_0x3f2a('0x14')]=0x0;for(var _0x52d7f3=0x0;_0x52d7f3=0x0?this['available']:0x0;var _0xe76f25={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x3f2a('0x7')],'paused':this[_0x3f2a('0x14')],'waiting':this[_0x3f2a('0xb')]};var _0x46a6a5=md5(JSON['stringify'](_0xe76f25));if(this[_0x3f2a('0xc')]!==_0x46a6a5){this['md5']=_0x46a6a5;io['to'](util[_0x3f2a('0x18')](_0x3f2a('0x19'),_0xe76f25[_0x3f2a('0x7')]))[_0x3f2a('0x1a')](_0x3f2a('0x1b'),_0xe76f25);}};module[_0x3f2a('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x6d9f=['md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','updateRealtime','paused','length','online','loggedIn','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6d9f,0x77));var _0xf6d9=function(_0xa0b8df,_0x52a5df){_0xa0b8df=_0xa0b8df-0x0;var _0x5cfe3c=_0x6d9f[_0xa0b8df];return _0x5cfe3c;};'use strict';var _=require(_0xf6d9('0x0'));var md5=require(_0xf6d9('0x1'));var util=require('util');var Redis=require(_0xf6d9('0x2'));var config=require(_0xf6d9('0x3'));config[_0xf6d9('0x4')]=_[_0xf6d9('0x5')](config[_0xf6d9('0x4')],{'host':_0xf6d9('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf6d9('0x4')]));function WhatsappQueue(_0x488fe6){this['id']=_0x488fe6['id']||0x0;this[_0xf6d9('0x7')]=_0x488fe6[_0xf6d9('0x7')]||'';this[_0xf6d9('0x8')]=_0x488fe6[_0xf6d9('0x8')]||0xa;this[_0xf6d9('0x9')]=_0x488fe6['strategy']||_0xf6d9('0xa');this['Agents']=_0x488fe6[_0xf6d9('0xb')];this[_0xf6d9('0xc')]={};this[_0xf6d9('0xd')]=0x0;this[_0xf6d9('0x1')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0xf6d9('0xe')][_0xf6d9('0xf')]=function(){var _0x2db435=this[_0xf6d9('0xc')][_0xf6d9('0x10')];this[_0xf6d9('0xc')]=_[_0xf6d9('0x11')](this[_0xf6d9('0xb')],'id');this['mapAgentsId'][_0xf6d9('0x10')]=_0x2db435;};WhatsappQueue['prototype'][_0xf6d9('0x12')]=function(){this['loggedIn']=0x0;this[_0xf6d9('0x13')]=0x0;for(var _0x2f55e6=0x0;_0x2f55e6=0x0?this[_0xf6d9('0x18')]:0x0;var _0xdd3b10={'id':this['id'],'available':this[_0xf6d9('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xf6d9('0x7')],'paused':this[_0xf6d9('0x13')],'waiting':this['waiting']};var _0x3284e0=md5(JSON['stringify'](_0xdd3b10));if(this['md5']!==_0x3284e0){this['md5']=_0x3284e0;io['to'](util[_0xf6d9('0x19')](_0xf6d9('0x1a'),_0xdd3b10[_0xf6d9('0x7')]))[_0xf6d9('0x1b')](_0xf6d9('0x1c'),_0xdd3b10);}};module[_0xf6d9('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 67cd1fb..4743b18 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 _0x55ca=['initAgents','length','isUndefined','mergeFromDatabase','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','chatQueues','initSmsQueues','initFaxQueues','faxQueues','exports','bluebird','util','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x55ca,0x126));var _0xa55c=function(_0x31c480,_0x13f64a){_0x31c480=_0x31c480-0x0;var _0x3687ce=_0x55ca[_0x31c480];return _0x3687ce;};'use strict';var BPromise=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0xa55c('0x2'));var OpenchannelQueue=require(_0xa55c('0x3'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0xa55c('0x4'));var MailQueue=require(_0xa55c('0x5'));var FaxQueue=require(_0xa55c('0x6'));var WhatsappQueue=require(_0xa55c('0x7'));var Realtime=function(){this[_0xa55c('0x8')]={};this[_0xa55c('0x9')]={};this[_0xa55c('0xa')]={};this['chatQueues']={};this[_0xa55c('0xb')]={};this[_0xa55c('0xc')]={};this['faxQueues']={};this[_0xa55c('0xd')]={};this[_0xa55c('0xe')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xa55c('0xf')]={};this[_0xa55c('0x10')]={};this[_0xa55c('0x11')]={};};function freeIsNotKey(_0x5d8e5a,_0x31646d,_0xe6d826){var _0x508342=_[_0xa55c('0x12')](_0x5d8e5a,function(_0x3998f7,_0x15eec8){return _0x3998f7[_0xe6d826];});for(var _0x5d47ff in _0x31646d){if(_0x31646d['hasOwnProperty'](_0x5d47ff)){if(!_0x508342[_0x5d47ff]){delete _0x31646d[_0x5d47ff];}}}}Realtime[_0xa55c('0x13')]['mergeFromDatabase']=function(_0x5a3672,_0x59ea8d){for(var _0x18ee85 in _0x59ea8d){if(_0x5a3672[_0xa55c('0x14')](_0x18ee85)){_0x5a3672[_0x18ee85]=_0x59ea8d[_0x18ee85];}}};Realtime[_0xa55c('0x13')][_0xa55c('0x15')]=function(){var _0x458480=this;return function(_0x247e77){if(_0x247e77){freeIsNotKey(_0x247e77,_0x458480['agents'],'id');for(var _0x3ccf65=0x0,_0x3dcf4f={},_0x25934f={};_0x3ccf65<_0x247e77[_0xa55c('0x16')];_0x3ccf65+=0x1){_0x3dcf4f=_0x247e77[_0x3ccf65];if(_[_0xa55c('0x17')](_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']])){_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']]=new Agent(_0x3dcf4f);}else{_0x458480[_0xa55c('0x18')](_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']],_0x3dcf4f);}}}return _0x458480['agents'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x19')]=function(){var _0x461284=this;return function(_0x358b61){if(_0x358b61){freeIsNotKey(_0x358b61,_0x461284[_0xa55c('0x9')],'id');for(var _0x5426e5=0x0,_0x4c0daf={},_0x5f5158={};_0x5426e5<_0x358b61[_0xa55c('0x16')];_0x5426e5+=0x1){_0x4c0daf=_0x358b61[_0x5426e5];if(_[_0xa55c('0x17')](_0x461284[_0xa55c('0x9')][_0x4c0daf['id']])){_0x461284['intervals'][_0x4c0daf['id']]=new Interval(_0x4c0daf);}else{_0x461284[_0xa55c('0x18')](_0x461284[_0xa55c('0x9')][_0x4c0daf['id']],_0x4c0daf);}}}return _0x461284['intervals'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1a')]=function(){var _0x940f28=this;return function(_0x1965f1){if(_0x1965f1){freeIsNotKey(_0x1965f1,_0x940f28[_0xa55c('0xa')],'id');for(var _0x49ed04=0x0,_0x1fc828={},_0x504c24={};_0x49ed04<_0x1965f1['length'];_0x49ed04+=0x1){_0x1fc828=_0x1965f1[_0x49ed04];if(_['isUndefined'](_0x940f28[_0xa55c('0xa')][_0x1fc828['id']])){_0x940f28['openchannelQueues'][_0x1fc828['id']]=new OpenchannelQueue(_0x1fc828);}else{_0x940f28[_0xa55c('0x18')](_0x940f28[_0xa55c('0xa')][_0x1fc828['id']],_0x1fc828);}_0x940f28[_0xa55c('0xa')][_0x1fc828['id']][_0xa55c('0x1b')]();_0x940f28[_0xa55c('0xa')][_0x1fc828['id']][_0xa55c('0x1c')]();}}return _0x940f28[_0xa55c('0xa')];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1d')]=function(){var _0x3cd152=this;return function(_0x1273d7){if(_0x1273d7){freeIsNotKey(_0x1273d7,_0x3cd152['chatQueues'],'id');for(var _0x430d55=0x0,_0x28814f={},_0x1c9f6b={};_0x430d55<_0x1273d7[_0xa55c('0x16')];_0x430d55+=0x1){_0x28814f=_0x1273d7[_0x430d55];if(_['isUndefined'](_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']])){_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']]=new ChatQueue(_0x28814f);}else{_0x3cd152[_0xa55c('0x18')](_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']],_0x28814f);}_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']][_0xa55c('0x1b')]();_0x3cd152['chatQueues'][_0x28814f['id']][_0xa55c('0x1c')]();}}return _0x3cd152['chatQueues'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1f')]=function(){var _0x1cc53e=this;return function(_0x223813){if(_0x223813){freeIsNotKey(_0x223813,_0x1cc53e['smsQueues'],'id');for(var _0x3d28fb=0x0,_0x2096ae={},_0x331e58={};_0x3d28fb<_0x223813[_0xa55c('0x16')];_0x3d28fb+=0x1){_0x2096ae=_0x223813[_0x3d28fb];if(_[_0xa55c('0x17')](_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']])){_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']]=new SmsQueue(_0x2096ae);}else{_0x1cc53e[_0xa55c('0x18')](_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']],_0x2096ae);}_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']][_0xa55c('0x1b')]();_0x1cc53e['smsQueues'][_0x2096ae['id']]['updateRealtime']();}}return _0x1cc53e[_0xa55c('0xb')];};};Realtime[_0xa55c('0x13')]['initMailQueues']=function(){var _0x30fadd=this;return function(_0x2f0110){if(_0x2f0110){freeIsNotKey(_0x2f0110,_0x30fadd[_0xa55c('0xc')],'id');for(var _0x1839ac=0x0,_0x30d4f8={},_0x38ff96={};_0x1839ac<_0x2f0110[_0xa55c('0x16')];_0x1839ac+=0x1){_0x30d4f8=_0x2f0110[_0x1839ac];if(_[_0xa55c('0x17')](_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']])){_0x30fadd['mailQueues'][_0x30d4f8['id']]=new MailQueue(_0x30d4f8);}else{_0x30fadd['mergeFromDatabase'](_0x30fadd['mailQueues'][_0x30d4f8['id']],_0x30d4f8);}_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']][_0xa55c('0x1b')]();_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']]['updateRealtime']();}}return _0x30fadd[_0xa55c('0xc')];};};Realtime['prototype'][_0xa55c('0x20')]=function(){var _0x4ad813=this;return function(_0x18c6f1){if(_0x18c6f1){freeIsNotKey(_0x18c6f1,_0x4ad813[_0xa55c('0x21')],'id');for(var _0x3c0ec1=0x0,_0x4d3eb5={},_0x7c4a47={};_0x3c0ec1<_0x18c6f1[_0xa55c('0x16')];_0x3c0ec1+=0x1){_0x4d3eb5=_0x18c6f1[_0x3c0ec1];if(_['isUndefined'](_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']])){_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']]=new FaxQueue(_0x4d3eb5);}else{_0x4ad813['mergeFromDatabase'](_0x4ad813['faxQueues'][_0x4d3eb5['id']],_0x4d3eb5);}_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']]['updateRouting']();_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']][_0xa55c('0x1c')]();}}return _0x4ad813['faxQueues'];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x4de781=this;return function(_0x3b3308){if(_0x3b3308){freeIsNotKey(_0x3b3308,_0x4de781[_0xa55c('0xd')],'id');for(var _0x429336=0x0,_0x99c4f8={},_0x2d8cbf={};_0x429336<_0x3b3308['length'];_0x429336+=0x1){_0x99c4f8=_0x3b3308[_0x429336];if(_[_0xa55c('0x17')](_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']])){_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]=new WhatsappQueue(_0x99c4f8);}else{_0x4de781[_0xa55c('0x18')](_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']],_0x99c4f8);}_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]['updateRouting']();_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]['updateRealtime']();}}return _0x4de781['whatsappQueues'];};};module[_0xa55c('0x22')]=Realtime; \ No newline at end of file +var _0x00bb=['openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','agents','intervals','updateRealtime','initSmsQueues','updateRouting','initMailQueues','initWhatsappQueues','exports','bluebird','util','lodash','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/mailQueue','../model/faxQueue'];(function(_0x4b4dd9,_0xc57d96){var _0x4713f6=function(_0x4a790b){while(--_0x4a790b){_0x4b4dd9['push'](_0x4b4dd9['shift']());}};_0x4713f6(++_0xc57d96);}(_0x00bb,0x1d8));var _0xb00b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x00bb[_0xbca1b1];return _0x4e1686;};'use strict';var BPromise=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var _=require(_0xb00b('0x2'));var moment=require('moment');var Agent=require(_0xb00b('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xb00b('0x4'));var ChatQueue=require(_0xb00b('0x5'));var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0xb00b('0x6'));var FaxQueue=require(_0xb00b('0x7'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this['agents']={};this['intervals']={};this[_0xb00b('0x8')]={};this[_0xb00b('0x9')]={};this[_0xb00b('0xa')]={};this[_0xb00b('0xb')]={};this[_0xb00b('0xc')]={};this[_0xb00b('0xd')]={};this['chatQueuesWaitingInteractions']={};this['mailQueuesWaitingInteractions']={};this[_0xb00b('0xe')]={};this[_0xb00b('0xf')]={};this[_0xb00b('0x10')]={};this[_0xb00b('0x11')]={};};function freeIsNotKey(_0x28d3cc,_0x48e125,_0x3182db){var _0x5a63ed=_['mapKeys'](_0x28d3cc,function(_0x594075,_0x4ff792){return _0x594075[_0x3182db];});for(var _0x2d8ddf in _0x48e125){if(_0x48e125[_0xb00b('0x12')](_0x2d8ddf)){if(!_0x5a63ed[_0x2d8ddf]){delete _0x48e125[_0x2d8ddf];}}}}Realtime[_0xb00b('0x13')][_0xb00b('0x14')]=function(_0x1f1c1d,_0x4ada81){for(var _0x218de2 in _0x4ada81){if(_0x1f1c1d[_0xb00b('0x12')](_0x218de2)){_0x1f1c1d[_0x218de2]=_0x4ada81[_0x218de2];}}};Realtime['prototype'][_0xb00b('0x15')]=function(){var _0x1084a6=this;return function(_0x540b79){if(_0x540b79){freeIsNotKey(_0x540b79,_0x1084a6['agents'],'id');for(var _0x9b471e=0x0,_0x4dcd45={},_0x51d136={};_0x9b471e<_0x540b79[_0xb00b('0x16')];_0x9b471e+=0x1){_0x4dcd45=_0x540b79[_0x9b471e];if(_[_0xb00b('0x17')](_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']])){_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']]=new Agent(_0x4dcd45);}else{_0x1084a6['mergeFromDatabase'](_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']],_0x4dcd45);}}}return _0x1084a6['agents'];};};Realtime[_0xb00b('0x13')]['initIntervals']=function(){var _0x25d7a0=this;return function(_0x5e8d7b){if(_0x5e8d7b){freeIsNotKey(_0x5e8d7b,_0x25d7a0[_0xb00b('0x19')],'id');for(var _0x3355a3=0x0,_0x53ee68={},_0x55770c={};_0x3355a3<_0x5e8d7b[_0xb00b('0x16')];_0x3355a3+=0x1){_0x53ee68=_0x5e8d7b[_0x3355a3];if(_['isUndefined'](_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']])){_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']]=new Interval(_0x53ee68);}else{_0x25d7a0[_0xb00b('0x14')](_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']],_0x53ee68);}}}return _0x25d7a0['intervals'];};};Realtime[_0xb00b('0x13')]['initOpenchannelQueues']=function(){var _0x25a973=this;return function(_0x121ec7){if(_0x121ec7){freeIsNotKey(_0x121ec7,_0x25a973['openchannelQueues'],'id');for(var _0x231293=0x0,_0x2896d1={},_0x520444={};_0x231293<_0x121ec7[_0xb00b('0x16')];_0x231293+=0x1){_0x2896d1=_0x121ec7[_0x231293];if(_[_0xb00b('0x17')](_0x25a973['openchannelQueues'][_0x2896d1['id']])){_0x25a973[_0xb00b('0x8')][_0x2896d1['id']]=new OpenchannelQueue(_0x2896d1);}else{_0x25a973[_0xb00b('0x14')](_0x25a973[_0xb00b('0x8')][_0x2896d1['id']],_0x2896d1);}_0x25a973[_0xb00b('0x8')][_0x2896d1['id']]['updateRouting']();_0x25a973['openchannelQueues'][_0x2896d1['id']][_0xb00b('0x1a')]();}}return _0x25a973['openchannelQueues'];};};Realtime['prototype']['initChatQueues']=function(){var _0x16ac55=this;return function(_0x73b6b0){if(_0x73b6b0){freeIsNotKey(_0x73b6b0,_0x16ac55[_0xb00b('0x9')],'id');for(var _0x3825af=0x0,_0x1f14fa={},_0x197379={};_0x3825af<_0x73b6b0[_0xb00b('0x16')];_0x3825af+=0x1){_0x1f14fa=_0x73b6b0[_0x3825af];if(_['isUndefined'](_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']])){_0x16ac55['chatQueues'][_0x1f14fa['id']]=new ChatQueue(_0x1f14fa);}else{_0x16ac55[_0xb00b('0x14')](_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']],_0x1f14fa);}_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']]['updateRouting']();_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']][_0xb00b('0x1a')]();}}return _0x16ac55[_0xb00b('0x9')];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1b')]=function(){var _0x2b9824=this;return function(_0x2e160a){if(_0x2e160a){freeIsNotKey(_0x2e160a,_0x2b9824[_0xb00b('0xa')],'id');for(var _0x149c1a=0x0,_0x54e247={},_0x2b5f41={};_0x149c1a<_0x2e160a[_0xb00b('0x16')];_0x149c1a+=0x1){_0x54e247=_0x2e160a[_0x149c1a];if(_['isUndefined'](_0x2b9824[_0xb00b('0xa')][_0x54e247['id']])){_0x2b9824[_0xb00b('0xa')][_0x54e247['id']]=new SmsQueue(_0x54e247);}else{_0x2b9824['mergeFromDatabase'](_0x2b9824[_0xb00b('0xa')][_0x54e247['id']],_0x54e247);}_0x2b9824['smsQueues'][_0x54e247['id']][_0xb00b('0x1c')]();_0x2b9824[_0xb00b('0xa')][_0x54e247['id']][_0xb00b('0x1a')]();}}return _0x2b9824[_0xb00b('0xa')];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1d')]=function(){var _0x17f613=this;return function(_0x594840){if(_0x594840){freeIsNotKey(_0x594840,_0x17f613['mailQueues'],'id');for(var _0x5b04c2=0x0,_0x347e73={},_0xc21102={};_0x5b04c2<_0x594840[_0xb00b('0x16')];_0x5b04c2+=0x1){_0x347e73=_0x594840[_0x5b04c2];if(_[_0xb00b('0x17')](_0x17f613['mailQueues'][_0x347e73['id']])){_0x17f613[_0xb00b('0xb')][_0x347e73['id']]=new MailQueue(_0x347e73);}else{_0x17f613[_0xb00b('0x14')](_0x17f613[_0xb00b('0xb')][_0x347e73['id']],_0x347e73);}_0x17f613[_0xb00b('0xb')][_0x347e73['id']][_0xb00b('0x1c')]();_0x17f613[_0xb00b('0xb')][_0x347e73['id']][_0xb00b('0x1a')]();}}return _0x17f613[_0xb00b('0xb')];};};Realtime['prototype']['initFaxQueues']=function(){var _0x2ea41d=this;return function(_0x56022e){if(_0x56022e){freeIsNotKey(_0x56022e,_0x2ea41d[_0xb00b('0xc')],'id');for(var _0x1c5400=0x0,_0x29579b={},_0x45ca74={};_0x1c5400<_0x56022e[_0xb00b('0x16')];_0x1c5400+=0x1){_0x29579b=_0x56022e[_0x1c5400];if(_[_0xb00b('0x17')](_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']])){_0x2ea41d['faxQueues'][_0x29579b['id']]=new FaxQueue(_0x29579b);}else{_0x2ea41d[_0xb00b('0x14')](_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']],_0x29579b);}_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']][_0xb00b('0x1c')]();_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']][_0xb00b('0x1a')]();}}return _0x2ea41d['faxQueues'];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1e')]=function(){var _0x4801e7=this;return function(_0x17ff34){if(_0x17ff34){freeIsNotKey(_0x17ff34,_0x4801e7[_0xb00b('0xd')],'id');for(var _0xa2ae04=0x0,_0x2d8620={},_0x2954e8={};_0xa2ae04<_0x17ff34['length'];_0xa2ae04+=0x1){_0x2d8620=_0x17ff34[_0xa2ae04];if(_[_0xb00b('0x17')](_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']])){_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']]=new WhatsappQueue(_0x2d8620);}else{_0x4801e7[_0xb00b('0x14')](_0x4801e7['whatsappQueues'][_0x2d8620['id']],_0x2d8620);}_0x4801e7['whatsappQueues'][_0x2d8620['id']][_0xb00b('0x1c')]();_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']][_0xb00b('0x1a')]();}}return _0x4801e7[_0xb00b('0xd')];};};module[_0xb00b('0x1f')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index f45b88c..2ed114f 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 _0x0d5a=['Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','updateChatInteraction','addTags'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x0d5a,0x11b));var _0xa0d5=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x0d5a[_0x2b10c6];return _0x3789d2;};'use strict';var client=require(_0xa0d5('0x0'));exports[_0xa0d5('0x1')]=function(_0x403740,_0xbedfea){return client['Request']('UpdateChatInteraction',{'body':_0xbedfea,'options':{'where':{'id':_0x403740}},'log':_0xa0d5('0x2')});};exports[_0xa0d5('0x3')]=function(_0x568a6e,_0x35c838){return client[_0xa0d5('0x4')](_0xa0d5('0x5'),{'body':_0x35c838,'options':{'where':{'id':_0x568a6e}},'log':_0xa0d5('0x6')});}; \ No newline at end of file +var _0xb691=['Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','../client','update'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xb691,0x64));var _0x1b69=function(_0x273f88,_0x5d4150){_0x273f88=_0x273f88-0x0;var _0x177ca1=_0xb691[_0x273f88];return _0x177ca1;};'use strict';var client=require(_0x1b69('0x0'));exports[_0x1b69('0x1')]=function(_0x5d3b7b,_0x24c13e){return client[_0x1b69('0x2')](_0x1b69('0x3'),{'body':_0x24c13e,'options':{'where':{'id':_0x5d3b7b}},'log':_0x1b69('0x4')});};exports['addTags']=function(_0x50574e,_0x1f0282){return client[_0x1b69('0x2')](_0x1b69('0x5'),{'body':_0x1f0282,'options':{'where':{'id':_0x50574e}},'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 5add74c..271d7a0 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 _0xc7d9=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x31e2f6,_0x4c3ea4){var _0x40e779=function(_0x168850){while(--_0x168850){_0x31e2f6['push'](_0x31e2f6['shift']());}};_0x40e779(++_0x4c3ea4);}(_0xc7d9,0x1a3));var _0x9c7d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xc7d9[_0x1035c1];return _0x308d67;};'use strict';var client=require(_0x9c7d('0x0'));exports[_0x9c7d('0x1')]=function(_0x450800){return client[_0x9c7d('0x2')](_0x9c7d('0x3'),{'body':_0x450800,'log':_0x9c7d('0x4')});}; \ No newline at end of file +var _0x262f=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x5cbd7b,_0x207439){var _0x3fdfb8=function(_0x4eb12e){while(--_0x4eb12e){_0x5cbd7b['push'](_0x5cbd7b['shift']());}};_0x3fdfb8(++_0x207439);}(_0x262f,0x87));var _0xf262=function(_0x338493,_0x455020){_0x338493=_0x338493-0x0;var _0x51cbc4=_0x262f[_0x338493];return _0x51cbc4;};'use strict';var client=require(_0xf262('0x0'));exports[_0xf262('0x1')]=function(_0x1e4b1d){return client[_0xf262('0x2')](_0xf262('0x3'),{'body':_0x1e4b1d,'log':_0xf262('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 2134161..9dcd278 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=['timeout','strategy','User','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x24ca,0x19d));var _0xa24c=function(_0x3da707,_0x30c36d){_0x3da707=_0x3da707-0x0;var _0x342ee7=_0x24ca[_0x3da707];return _0x342ee7;};'use strict';var client=require(_0xa24c('0x0'));exports[_0xa24c('0x1')]=function(){return function(){return client[_0xa24c('0x2')](_0xa24c('0x3'),{'options':{'raw':![],'attributes':['id',_0xa24c('0x4'),_0xa24c('0x5'),_0xa24c('0x6')],'include':[{'model':_0xa24c('0x7'),'as':_0xa24c('0x8'),'attributes':['id','name',_0xa24c('0x9'),_0xa24c('0xa')]}]},'log':_0xa24c('0x1')});};}; \ No newline at end of file +var _0x7e1f=['name','strategy','User','chatPause','getChatQueues','Request'];(function(_0x3caaaf,_0x4dfd5d){var _0x140e74=function(_0x1a76fb){while(--_0x1a76fb){_0x3caaaf['push'](_0x3caaaf['shift']());}};_0x140e74(++_0x4dfd5d);}(_0x7e1f,0x112));var _0xf7e1=function(_0x517dfe,_0x419b12){_0x517dfe=_0x517dfe-0x0;var _0x37816d=_0x7e1f[_0x517dfe];return _0x37816d;};'use strict';var client=require('../client');exports[_0xf7e1('0x0')]=function(){return function(){return client[_0xf7e1('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xf7e1('0x2'),'timeout',_0xf7e1('0x3')],'include':[{'model':_0xf7e1('0x4'),'as':'Agents','attributes':['id','name','online',_0xf7e1('0x5')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 54e34a9..3160f72 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 _0xb26e=['../client','CreateChatQueueReport','Request','UpdateChatQueueReport','DESC'];(function(_0x2f0057,_0x448b27){var _0x17f2c3=function(_0x12efc3){while(--_0x12efc3){_0x2f0057['push'](_0x2f0057['shift']());}};_0x17f2c3(++_0x448b27);}(_0xb26e,0x11d));var _0xeb26=function(_0x4c4abb,_0x39bae7){_0x4c4abb=_0x4c4abb-0x0;var _0x29ce07=_0xb26e[_0x4c4abb];return _0x29ce07;};'use strict';var client=require(_0xeb26('0x0'));exports['create']=function(_0x59dc2a){return client['Request'](_0xeb26('0x1'),{'body':_0x59dc2a,'log':_0xeb26('0x1')});};exports['update']=function(_0x3bdbef,_0x3b8a6f){return client[_0xeb26('0x2')](_0xeb26('0x3'),{'body':_0x3b8a6f,'options':{'where':{'uniqueid':_0x3bdbef},'order':[['id',_0xeb26('0x4')]],'limit':0x1},'log':_0xeb26('0x3')});}; \ No newline at end of file +var _0xea1a=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x46a30d,_0x34b9ad){var _0x3d1914=function(_0x363d20){while(--_0x363d20){_0x46a30d['push'](_0x46a30d['shift']());}};_0x3d1914(++_0x34b9ad);}(_0xea1a,0x158));var _0xaea1=function(_0x478dd2,_0x379a0e){_0x478dd2=_0x478dd2-0x0;var _0x299326=_0xea1a[_0x478dd2];return _0x299326;};'use strict';var client=require(_0xaea1('0x0'));exports[_0xaea1('0x1')]=function(_0xe7738c){return client[_0xaea1('0x2')]('CreateChatQueueReport',{'body':_0xe7738c,'log':_0xaea1('0x3')});};exports[_0xaea1('0x4')]=function(_0x21644a,_0x4584dd){return client[_0xaea1('0x2')](_0xaea1('0x5'),{'body':_0x4584dd,'options':{'where':{'uniqueid':_0x21644a},'order':[['id',_0xaea1('0x6')]],'limit':0x1},'log':_0xaea1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 73e00f0..79c8366 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 _0x0139=['updateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update','Request','UpdateFaxInteraction'];(function(_0x2d480c,_0x43fae9){var _0x167cbf=function(_0x44b0c5){while(--_0x44b0c5){_0x2d480c['push'](_0x2d480c['shift']());}};_0x167cbf(++_0x43fae9);}(_0x0139,0x18b));var _0x9013=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0139[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x9013('0x0'));exports[_0x9013('0x1')]=function(_0xe32de,_0x486023){return client[_0x9013('0x2')](_0x9013('0x3'),{'body':_0x486023,'options':{'where':{'id':_0xe32de}},'log':_0x9013('0x4')});};exports[_0x9013('0x5')]=function(_0x4670a5,_0x50b734){return client[_0x9013('0x2')](_0x9013('0x6'),{'body':_0x50b734,'options':{'where':{'id':_0x4670a5}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x62a3=['Request','updateFaxInteraction','addTagsToFaxInteraction','../client'];(function(_0x3bd5ce,_0x1175c1){var _0x1ec91e=function(_0x392e8e){while(--_0x392e8e){_0x3bd5ce['push'](_0x3bd5ce['shift']());}};_0x1ec91e(++_0x1175c1);}(_0x62a3,0x1bf));var _0x362a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x62a3[_0x126558];return _0x1f6d14;};'use strict';var client=require(_0x362a('0x0'));exports['update']=function(_0x28f8d0,_0x112c78){return client[_0x362a('0x1')]('UpdateFaxInteraction',{'body':_0x112c78,'options':{'where':{'id':_0x28f8d0}},'log':_0x362a('0x2')});};exports['addTags']=function(_0x5ceefb,_0x57160a){return client[_0x362a('0x1')]('AddTagsToFaxInteraction',{'body':_0x57160a,'options':{'where':{'id':_0x5ceefb}},'log':_0x362a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index feaedb5..85cd08f 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 _0x487b=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x1e1283,_0x5b87cc){var _0x1ba1c7=function(_0x2c1cb7){while(--_0x2c1cb7){_0x1e1283['push'](_0x1e1283['shift']());}};_0x1ba1c7(++_0x5b87cc);}(_0x487b,0x110));var _0xb487=function(_0x3dec3f,_0x1d249e){_0x3dec3f=_0x3dec3f-0x0;var _0x5f04b8=_0x487b[_0x3dec3f];return _0x5f04b8;};'use strict';var client=require(_0xb487('0x0'));exports[_0xb487('0x1')]=function(_0x239ee6){return client[_0xb487('0x2')](_0xb487('0x3'),{'body':_0x239ee6,'log':_0xb487('0x4')});}; \ No newline at end of file +var _0x0131=['CreateFaxMessage','createFaxMessage'];(function(_0x1c623e,_0x240789){var _0x1d6f5c=function(_0x47bee7){while(--_0x47bee7){_0x1c623e['push'](_0x1c623e['shift']());}};_0x1d6f5c(++_0x240789);}(_0x0131,0xd2));var _0x1013=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0x0131[_0x1b5a05];return _0x347931;};'use strict';var client=require('../client');exports['create']=function(_0x15cd58){return client['Request'](_0x1013('0x0'),{'body':_0x15cd58,'log':_0x1013('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 6becdec..68bc56e 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 _0xc438=['GetFaxQueue','name','timeout','strategy','online','faxPause','../client','getFaxQueues'];(function(_0x4222e4,_0x25096f){var _0x4bfa29=function(_0x1fd1c1){while(--_0x1fd1c1){_0x4222e4['push'](_0x4222e4['shift']());}};_0x4bfa29(++_0x25096f);}(_0xc438,0xde));var _0x8c43=function(_0x23fff3,_0x327e3a){_0x23fff3=_0x23fff3-0x0;var _0xbeb84f=_0xc438[_0x23fff3];return _0xbeb84f;};'use strict';var client=require(_0x8c43('0x0'));exports[_0x8c43('0x1')]=function(){return function(){return client['Request'](_0x8c43('0x2'),{'options':{'raw':![],'attributes':['id',_0x8c43('0x3'),_0x8c43('0x4'),_0x8c43('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x8c43('0x3'),_0x8c43('0x6'),_0x8c43('0x7')]}]},'log':_0x8c43('0x1')});};}; \ No newline at end of file +var _0xa4e7=['Agents','online','faxPause','../client','getFaxQueues','name','strategy','User'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa4e7,0xd3));var _0x7a4e=function(_0x120af1,_0x3b8ddd){_0x120af1=_0x120af1-0x0;var _0x232e07=_0xa4e7[_0x120af1];return _0x232e07;};'use strict';var client=require(_0x7a4e('0x0'));exports[_0x7a4e('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x7a4e('0x2'),'timeout',_0x7a4e('0x3')],'include':[{'model':_0x7a4e('0x4'),'as':_0x7a4e('0x5'),'attributes':['id',_0x7a4e('0x2'),_0x7a4e('0x6'),_0x7a4e('0x7')]}]},'log':_0x7a4e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 11badef..1aa589a 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 _0x090b=['update','UpdateFaxQueueReport','DESC','../client','CreateFaxQueueReport'];(function(_0x3bd143,_0x13f1ec){var _0x27ecbf=function(_0x312e16){while(--_0x312e16){_0x3bd143['push'](_0x3bd143['shift']());}};_0x27ecbf(++_0x13f1ec);}(_0x090b,0x13e));var _0xb090=function(_0x378e60,_0x267bdb){_0x378e60=_0x378e60-0x0;var _0x29bb12=_0x090b[_0x378e60];return _0x29bb12;};'use strict';var client=require(_0xb090('0x0'));exports['create']=function(_0x37beea){return client['Request']('CreateFaxQueueReport',{'body':_0x37beea,'log':_0xb090('0x1')});};exports[_0xb090('0x2')]=function(_0x38916d,_0x2016d6){return client['Request'](_0xb090('0x3'),{'body':_0x2016d6,'options':{'where':{'uniqueid':_0x38916d},'order':[['id',_0xb090('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x6422=['create','Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC'];(function(_0x5e848d,_0x1dbd20){var _0x3785e5=function(_0xc82b39){while(--_0xc82b39){_0x5e848d['push'](_0x5e848d['shift']());}};_0x3785e5(++_0x1dbd20);}(_0x6422,0x168));var _0x2642=function(_0x376b2e,_0x1faf50){_0x376b2e=_0x376b2e-0x0;var _0x19a279=_0x6422[_0x376b2e];return _0x19a279;};'use strict';var client=require('../client');exports[_0x2642('0x0')]=function(_0x5b4c8b){return client[_0x2642('0x1')](_0x2642('0x2'),{'body':_0x5b4c8b,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x43121f,_0x113c90){return client[_0x2642('0x1')](_0x2642('0x3'),{'body':_0x113c90,'options':{'where':{'uniqueid':_0x43121f},'order':[['id',_0x2642('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index df8d185..7ecc3c0 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 _0x02ce=['Intervals','interval','../client','getIntervals','Request','name'];(function(_0x43a8c4,_0x4a59f8){var _0x407678=function(_0xe2a072){while(--_0xe2a072){_0x43a8c4['push'](_0x43a8c4['shift']());}};_0x407678(++_0x4a59f8);}(_0x02ce,0x1ac));var _0xe02c=function(_0x5546c9,_0x47b903){_0x5546c9=_0x5546c9-0x0;var _0x38adc3=_0x02ce[_0x5546c9];return _0x38adc3;};'use strict';var client=require(_0xe02c('0x0'));exports[_0xe02c('0x1')]=function(){return function(){return client[_0xe02c('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xe02c('0x3')],'include':[{'model':'Interval','as':_0xe02c('0x4'),'attributes':['id',_0xe02c('0x3'),_0xe02c('0x5')]}]},'log':_0xe02c('0x1')});};}; \ No newline at end of file +var _0x0db9=['name','Interval','getIntervals','../client'];(function(_0x3243e7,_0x216859){var _0xa5b442=function(_0x8dfd1e){while(--_0x8dfd1e){_0x3243e7['push'](_0x3243e7['shift']());}};_0xa5b442(++_0x216859);}(_0x0db9,0xa3));var _0x90db=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0x0db9[_0x1778e1];return _0x2bc4c6;};'use strict';var client=require(_0x90db('0x0'));exports['getIntervals']=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x90db('0x1')],'include':[{'model':_0x90db('0x2'),'as':'Intervals','attributes':['id',_0x90db('0x1'),'interval']}]},'log':_0x90db('0x3')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 59384ca..b3c01d5 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 _0x3175=['updateMailInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0x5a001d,_0x591f45){var _0x3d0a81=function(_0x13ad2a){while(--_0x13ad2a){_0x5a001d['push'](_0x5a001d['shift']());}};_0x3d0a81(++_0x591f45);}(_0x3175,0x132));var _0x5317=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0x3175[_0x351b46];return _0x1515df;};'use strict';var client=require(_0x5317('0x0'));exports[_0x5317('0x1')]=function(_0x27081d,_0x46448e){return client[_0x5317('0x2')](_0x5317('0x3'),{'body':_0x46448e,'options':{'where':{'id':_0x27081d}},'log':_0x5317('0x4')});};exports['addTags']=function(_0x43e33f,_0xc50187){return client[_0x5317('0x2')]('AddTagsToMailInteraction',{'body':_0xc50187,'options':{'where':{'id':_0x43e33f}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x6008=['updateMailInteraction','addTags','AddTagsToMailInteraction','../client','Request','UpdateMailInteraction'];(function(_0x593889,_0x4a92d1){var _0x168e70=function(_0x5db035){while(--_0x5db035){_0x593889['push'](_0x593889['shift']());}};_0x168e70(++_0x4a92d1);}(_0x6008,0x10b));var _0x8600=function(_0x5a13d5,_0x57c5bf){_0x5a13d5=_0x5a13d5-0x0;var _0x2436d1=_0x6008[_0x5a13d5];return _0x2436d1;};'use strict';var client=require(_0x8600('0x0'));exports['update']=function(_0xa5e63b,_0x16b5f3){return client[_0x8600('0x1')](_0x8600('0x2'),{'body':_0x16b5f3,'options':{'where':{'id':_0xa5e63b}},'log':_0x8600('0x3')});};exports[_0x8600('0x4')]=function(_0x468182,_0x474ed2){return client[_0x8600('0x1')](_0x8600('0x5'),{'body':_0x474ed2,'options':{'where':{'id':_0x468182}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 91d3deb..8684e29 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 _0x548c=['../client','create','CreateMailMessage'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0x548c,0x114));var _0xc548=function(_0x4e4e46,_0x3b0e9d){_0x4e4e46=_0x4e4e46-0x0;var _0x1c587a=_0x548c[_0x4e4e46];return _0x1c587a;};'use strict';var client=require(_0xc548('0x0'));exports[_0xc548('0x1')]=function(_0x5973ec){return client['Request'](_0xc548('0x2'),{'body':_0x5973ec,'log':'createMailMessage'});}; \ No newline at end of file +var _0xc26c=['createMailMessage','create','Request'];(function(_0x49f777,_0x236a2f){var _0x54cb17=function(_0x4243dd){while(--_0x4243dd){_0x49f777['push'](_0x49f777['shift']());}};_0x54cb17(++_0x236a2f);}(_0xc26c,0x1d8));var _0xcc26=function(_0x3c53b2,_0x5a265e){_0x3c53b2=_0x3c53b2-0x0;var _0x12f66e=_0xc26c[_0x3c53b2];return _0x12f66e;};'use strict';var client=require('../client');exports[_0xcc26('0x0')]=function(_0x304576){return client[_0xcc26('0x1')]('CreateMailMessage',{'body':_0x304576,'log':_0xcc26('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 02bf2cd..a043c7e 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 _0x5c53=['online','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x430cb0,_0x860700){var _0x4e21d5=function(_0x1369fd){while(--_0x1369fd){_0x430cb0['push'](_0x430cb0['shift']());}};_0x4e21d5(++_0x860700);}(_0x5c53,0x17d));var _0x35c5=function(_0x4e8975,_0x8bed27){_0x4e8975=_0x4e8975-0x0;var _0x324bde=_0x5c53[_0x4e8975];return _0x324bde;};'use strict';var client=require(_0x35c5('0x0'));exports[_0x35c5('0x1')]=function(){return function(){return client[_0x35c5('0x2')](_0x35c5('0x3'),{'options':{'raw':![],'attributes':['id',_0x35c5('0x4'),_0x35c5('0x5'),_0x35c5('0x6')],'include':[{'model':_0x35c5('0x7'),'as':_0x35c5('0x8'),'attributes':['id',_0x35c5('0x4'),_0x35c5('0x9'),'mailPause']}]},'log':_0x35c5('0x1')});};}; \ No newline at end of file +var _0xa41a=['strategy','Agents','online','mailPause','getMailQueues','Request','GetMailQueue','name'];(function(_0xec32d8,_0x3b0a69){var _0x1f1ed0=function(_0x3ac17f){while(--_0x3ac17f){_0xec32d8['push'](_0xec32d8['shift']());}};_0x1f1ed0(++_0x3b0a69);}(_0xa41a,0x17c));var _0xaa41=function(_0x477f70,_0x4d78f3){_0x477f70=_0x477f70-0x0;var _0x486aa2=_0xa41a[_0x477f70];return _0x486aa2;};'use strict';var client=require('../client');exports[_0xaa41('0x0')]=function(){return function(){return client[_0xaa41('0x1')](_0xaa41('0x2'),{'options':{'raw':![],'attributes':['id',_0xaa41('0x3'),'timeout',_0xaa41('0x4')],'include':[{'model':'User','as':_0xaa41('0x5'),'attributes':['id',_0xaa41('0x3'),_0xaa41('0x6'),_0xaa41('0x7')]}]},'log':_0xaa41('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index ab7309b..fe323b3 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 _0x948f=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','create'];(function(_0x312193,_0x33da31){var _0x1b5736=function(_0x34fb0a){while(--_0x34fb0a){_0x312193['push'](_0x312193['shift']());}};_0x1b5736(++_0x33da31);}(_0x948f,0x126));var _0xf948=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x948f[_0x4fa291];return _0x506d9b;};'use strict';var client=require('../client');exports[_0xf948('0x0')]=function(_0x4b6f4b){return client[_0xf948('0x1')](_0xf948('0x2'),{'body':_0x4b6f4b,'log':_0xf948('0x2')});};exports[_0xf948('0x3')]=function(_0x4c9f39,_0x488682){return client[_0xf948('0x1')](_0xf948('0x4'),{'body':_0x488682,'options':{'where':{'uniqueid':_0x4c9f39},'order':[['id','DESC']],'limit':0x1},'log':_0xf948('0x4')});}; \ No newline at end of file +var _0xbc37=['DESC','../client','create','Request','CreateMailQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc37,0xf7));var _0x7bc3=function(_0xfc9103,_0x26c723){_0xfc9103=_0xfc9103-0x0;var _0x678ea4=_0xbc37[_0xfc9103];return _0x678ea4;};'use strict';var client=require(_0x7bc3('0x0'));exports[_0x7bc3('0x1')]=function(_0x1a81ad){return client[_0x7bc3('0x2')](_0x7bc3('0x3'),{'body':_0x1a81ad,'log':_0x7bc3('0x3')});};exports[_0x7bc3('0x4')]=function(_0x1e0860,_0x5a8f03){return client['Request']('UpdateMailQueueReport',{'body':_0x5a8f03,'options':{'where':{'uniqueid':_0x1e0860},'order':[['id',_0x7bc3('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 477eae5..429ef23 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 _0xa538=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','../client','update'];(function(_0x2510b1,_0x55a574){var _0x300985=function(_0x39e43c){while(--_0x39e43c){_0x2510b1['push'](_0x2510b1['shift']());}};_0x300985(++_0x55a574);}(_0xa538,0x106));var _0x8a53=function(_0x28c958,_0x35e547){_0x28c958=_0x28c958-0x0;var _0x32abdc=_0xa538[_0x28c958];return _0x32abdc;};'use strict';var client=require(_0x8a53('0x0'));exports[_0x8a53('0x1')]=function(_0xb666ec,_0x2da2b6){return client[_0x8a53('0x2')](_0x8a53('0x3'),{'body':_0x2da2b6,'options':{'where':{'id':_0xb666ec}},'log':_0x8a53('0x4')});};exports[_0x8a53('0x5')]=function(_0x42e0d4,_0x48b6cd){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x48b6cd,'options':{'where':{'id':_0x42e0d4}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xe164=['../client','update','Request','addTags','addTagsToChatInteraction'];(function(_0x4889b0,_0x39131f){var _0x27c240=function(_0x324af8){while(--_0x324af8){_0x4889b0['push'](_0x4889b0['shift']());}};_0x27c240(++_0x39131f);}(_0xe164,0xeb));var _0x4e16=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xe164[_0x263a74];return _0x2aa86c;};'use strict';var client=require(_0x4e16('0x0'));exports[_0x4e16('0x1')]=function(_0x55be84,_0x14c3ad){return client[_0x4e16('0x2')]('UpdateOpenchannelInteraction',{'body':_0x14c3ad,'options':{'where':{'id':_0x55be84}},'log':'updateOpenchannelInteraction'});};exports[_0x4e16('0x3')]=function(_0x2d4f3c,_0x55a346){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x55a346,'options':{'where':{'id':_0x2d4f3c}},'log':_0x4e16('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 0631221..ac82d50 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 _0x9c44=['createOpenchannelMessage','Request','CreateOpenchannelMessage'];(function(_0x50576b,_0x52ff88){var _0x2e81af=function(_0x5a6b39){while(--_0x5a6b39){_0x50576b['push'](_0x50576b['shift']());}};_0x2e81af(++_0x52ff88);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x2')});}; \ No newline at end of file +var _0xbec5=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x525030,_0x5b3a2c){var _0x4d4b5a=function(_0x3c3b9f){while(--_0x3c3b9f){_0x525030['push'](_0x525030['shift']());}};_0x4d4b5a(++_0x5b3a2c);}(_0xbec5,0xe5));var _0x5bec=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0xbec5[_0x38c652];return _0x218a37;};'use strict';var client=require(_0x5bec('0x0'));exports[_0x5bec('0x1')]=function(_0x4cfc3b){return client[_0x5bec('0x2')](_0x5bec('0x3'),{'body':_0x4cfc3b,'log':_0x5bec('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 17595af..d4d90ff 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 _0xbb4d=['openchannelPause','../client','getOpenchannelQueues','timeout','strategy','User','online'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xbb4d,0xfd));var _0xdbb4=function(_0x15771e,_0x10835a){_0x15771e=_0x15771e-0x0;var _0x5e95ec=_0xbb4d[_0x15771e];return _0x5e95ec;};'use strict';var client=require(_0xdbb4('0x0'));exports[_0xdbb4('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0xdbb4('0x2'),_0xdbb4('0x3')],'include':[{'model':_0xdbb4('0x4'),'as':'Agents','attributes':['id','name',_0xdbb4('0x5'),_0xdbb4('0x6')]}]},'log':_0xdbb4('0x1')});};}; \ No newline at end of file +var _0x0f01=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','Agents','online','openchannelPause'];(function(_0x33ea2d,_0x25da88){var _0x3727eb=function(_0xbf513f){while(--_0xbf513f){_0x33ea2d['push'](_0x33ea2d['shift']());}};_0x3727eb(++_0x25da88);}(_0x0f01,0x99));var _0x10f0=function(_0x4264bf,_0x39db0f){_0x4264bf=_0x4264bf-0x0;var _0x515e5f=_0x0f01[_0x4264bf];return _0x515e5f;};'use strict';var client=require('../client');exports[_0x10f0('0x0')]=function(){return function(){return client[_0x10f0('0x1')](_0x10f0('0x2'),{'options':{'raw':![],'attributes':['id',_0x10f0('0x3'),_0x10f0('0x4'),_0x10f0('0x5')],'include':[{'model':'User','as':_0x10f0('0x6'),'attributes':['id',_0x10f0('0x3'),_0x10f0('0x7'),_0x10f0('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index ae011d0..bd34c92 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 _0xb087=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','Request'];(function(_0x2d1529,_0x671d7e){var _0x317b0e=function(_0x5cf6a3){while(--_0x5cf6a3){_0x2d1529['push'](_0x2d1529['shift']());}};_0x317b0e(++_0x671d7e);}(_0xb087,0x12b));var _0x7b08=function(_0x2e2722,_0xfec16a){_0x2e2722=_0x2e2722-0x0;var _0x49a9e3=_0xb087[_0x2e2722];return _0x49a9e3;};'use strict';var client=require('../client');exports['create']=function(_0x30e299){return client[_0x7b08('0x0')](_0x7b08('0x1'),{'body':_0x30e299,'log':_0x7b08('0x1')});};exports['update']=function(_0x173c38,_0x37c33b){return client[_0x7b08('0x0')](_0x7b08('0x2'),{'body':_0x37c33b,'options':{'where':{'uniqueid':_0x173c38},'order':[['id',_0x7b08('0x3')]],'limit':0x1},'log':_0x7b08('0x2')});}; \ No newline at end of file +var _0x5c8a=['UpdateOpenchannelQueueReport','../client','create','CreateOpenchannelQueueReport','update','Request','DESC'];(function(_0xf9a5ad,_0x493ed0){var _0x228af8=function(_0xb47238){while(--_0xb47238){_0xf9a5ad['push'](_0xf9a5ad['shift']());}};_0x228af8(++_0x493ed0);}(_0x5c8a,0xa9));var _0xa5c8=function(_0x4841eb,_0x4ede52){_0x4841eb=_0x4841eb-0x0;var _0x362cfc=_0x5c8a[_0x4841eb];return _0x362cfc;};'use strict';var client=require(_0xa5c8('0x0'));exports[_0xa5c8('0x1')]=function(_0x506cba){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x506cba,'log':_0xa5c8('0x2')});};exports[_0xa5c8('0x3')]=function(_0x4e3989,_0x36a85b){return client[_0xa5c8('0x4')]('UpdateOpenchannelQueueReport',{'body':_0x36a85b,'options':{'where':{'uniqueid':_0x4e3989},'order':[['id',_0xa5c8('0x5')]],'limit':0x1},'log':_0xa5c8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 0990b5c..a3cac28 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 _0x7c43=['UpdateSmsInteraction','addTags','addTagsToSmsInteraction','Request'];(function(_0x44d869,_0x49425f){var _0x1ed521=function(_0x2c2968){while(--_0x2c2968){_0x44d869['push'](_0x44d869['shift']());}};_0x1ed521(++_0x49425f);}(_0x7c43,0xf3));var _0x37c4=function(_0x5d5a51,_0x21acc5){_0x5d5a51=_0x5d5a51-0x0;var _0x2f4c26=_0x7c43[_0x5d5a51];return _0x2f4c26;};'use strict';var client=require('../client');exports['update']=function(_0xd93fbd,_0x5b46a4){return client[_0x37c4('0x0')](_0x37c4('0x1'),{'body':_0x5b46a4,'options':{'where':{'id':_0xd93fbd}},'log':'updateSmsInteraction'});};exports[_0x37c4('0x2')]=function(_0x5aa83d,_0xf7ab63){return client[_0x37c4('0x0')]('AddTagsToSmsInteraction',{'body':_0xf7ab63,'options':{'where':{'id':_0x5aa83d}},'log':_0x37c4('0x3')});}; \ No newline at end of file +var _0xfcfb=['addTagsToSmsInteraction','../client','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x1b41e9,_0x1f868d){var _0x3a9407=function(_0x44ebdf){while(--_0x44ebdf){_0x1b41e9['push'](_0x1b41e9['shift']());}};_0x3a9407(++_0x1f868d);}(_0xfcfb,0x9d));var _0xbfcf=function(_0x3ab313,_0x4d6b91){_0x3ab313=_0x3ab313-0x0;var _0x52e13f=_0xfcfb[_0x3ab313];return _0x52e13f;};'use strict';var client=require(_0xbfcf('0x0'));exports['update']=function(_0xd3f460,_0x218c63){return client[_0xbfcf('0x1')]('UpdateSmsInteraction',{'body':_0x218c63,'options':{'where':{'id':_0xd3f460}},'log':_0xbfcf('0x2')});};exports[_0xbfcf('0x3')]=function(_0x463cf0,_0x52f0c8){return client[_0xbfcf('0x1')](_0xbfcf('0x4'),{'body':_0x52f0c8,'options':{'where':{'id':_0x463cf0}},'log':_0xbfcf('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index a99b21d..a9df015 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 _0x4a9c=['create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x6bef1e,_0xaecdff){var _0x4393bc=function(_0x124929){while(--_0x124929){_0x6bef1e['push'](_0x6bef1e['shift']());}};_0x4393bc(++_0xaecdff);}(_0x4a9c,0x1e4));var _0xc4a9=function(_0x50e846,_0x4205f7){_0x50e846=_0x50e846-0x0;var _0x495885=_0x4a9c[_0x50e846];return _0x495885;};'use strict';var client=require('../client');exports[_0xc4a9('0x0')]=function(_0x442fe2){return client[_0xc4a9('0x1')](_0xc4a9('0x2'),{'body':_0x442fe2,'log':_0xc4a9('0x3')});}; \ No newline at end of file +var _0xb105=['CreateSmsMessage','createSmsMessage','../client'];(function(_0x28ee74,_0x289441){var _0x6cc80c=function(_0x16ee15){while(--_0x16ee15){_0x28ee74['push'](_0x28ee74['shift']());}};_0x6cc80c(++_0x289441);}(_0xb105,0x1a3));var _0x5b10=function(_0x24c81b,_0x3be70a){_0x24c81b=_0x24c81b-0x0;var _0x416648=_0xb105[_0x24c81b];return _0x416648;};'use strict';var client=require(_0x5b10('0x0'));exports['create']=function(_0x274d8f){return client['Request'](_0x5b10('0x1'),{'body':_0x274d8f,'log':_0x5b10('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index d42ef52..987cf81 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 _0x42f0=['name','timeout','strategy','User','online','smsPause','../client','getSmsQueues','Request','GetSmsQueue'];(function(_0x394ea1,_0x1d71f6){var _0x211528=function(_0x14d1ce){while(--_0x14d1ce){_0x394ea1['push'](_0x394ea1['shift']());}};_0x211528(++_0x1d71f6);}(_0x42f0,0x1b4));var _0x042f=function(_0x15d2e7,_0x575e70){_0x15d2e7=_0x15d2e7-0x0;var _0x2341c8=_0x42f0[_0x15d2e7];return _0x2341c8;};'use strict';var client=require(_0x042f('0x0'));exports[_0x042f('0x1')]=function(){return function(){return client[_0x042f('0x2')](_0x042f('0x3'),{'options':{'raw':![],'attributes':['id',_0x042f('0x4'),_0x042f('0x5'),_0x042f('0x6')],'include':[{'model':_0x042f('0x7'),'as':'Agents','attributes':['id',_0x042f('0x4'),_0x042f('0x8'),_0x042f('0x9')]}]},'log':_0x042f('0x1')});};}; \ No newline at end of file +var _0xa8d5=['smsPause','../client','getSmsQueues','name','timeout','strategy','User'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa8d5,0x1b3));var _0x5a8d=function(_0xfca11e,_0x28c7b2){_0xfca11e=_0xfca11e-0x0;var _0x4c3e29=_0xa8d5[_0xfca11e];return _0x4c3e29;};'use strict';var client=require(_0x5a8d('0x0'));exports[_0x5a8d('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x5a8d('0x2'),_0x5a8d('0x3'),_0x5a8d('0x4')],'include':[{'model':_0x5a8d('0x5'),'as':'Agents','attributes':['id',_0x5a8d('0x2'),'online',_0x5a8d('0x6')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index c0457a6..c8a8732 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 _0x28b2=['UpdateSmsQueueReport','DESC','../client','create','CreateSmsQueueReport','update','Request'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0x28b2,0xb8));var _0x228b=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x28b2[_0x82129b];return _0x2ae5dc;};'use strict';var client=require(_0x228b('0x0'));exports[_0x228b('0x1')]=function(_0x32d2c2){return client['Request'](_0x228b('0x2'),{'body':_0x32d2c2,'log':_0x228b('0x2')});};exports[_0x228b('0x3')]=function(_0x245eee,_0xdddc98){return client[_0x228b('0x4')](_0x228b('0x5'),{'body':_0xdddc98,'options':{'where':{'uniqueid':_0x245eee},'order':[['id',_0x228b('0x6')]],'limit':0x1},'log':_0x228b('0x5')});}; \ No newline at end of file +var _0xf1c4=['UpdateSmsQueueReport','DESC','Request','CreateSmsQueueReport','update'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xf1c4,0x15b));var _0x4f1c=function(_0x1e4968,_0x4efc23){_0x1e4968=_0x1e4968-0x0;var _0x5d2e37=_0xf1c4[_0x1e4968];return _0x5d2e37;};'use strict';var client=require('../client');exports['create']=function(_0x471795){return client[_0x4f1c('0x0')](_0x4f1c('0x1'),{'body':_0x471795,'log':'CreateSmsQueueReport'});};exports[_0x4f1c('0x2')]=function(_0x4ba6ed,_0x38b455){return client[_0x4f1c('0x0')](_0x4f1c('0x3'),{'body':_0x38b455,'options':{'where':{'uniqueid':_0x4ba6ed},'order':[['id',_0x4f1c('0x4')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index b041b27..1ed6d94 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 _0x9a60=['getAgents','Request','GetUser','agent','name','online','pauseType','lastPauseAt','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','whatsappCapacity','openchannelCapacity','../client'];(function(_0x402124,_0x5b9480){var _0x26c545=function(_0x13bc26){while(--_0x13bc26){_0x402124['push'](_0x402124['shift']());}};_0x26c545(++_0x5b9480);}(_0x9a60,0xe3));var _0x09a6=function(_0x5699a0,_0x4410c2){_0x5699a0=_0x5699a0-0x0;var _0x3ab474=_0x9a60[_0x5699a0];return _0x3ab474;};'use strict';var client=require(_0x09a6('0x0'));exports[_0x09a6('0x1')]=function(){return function(){return client[_0x09a6('0x2')](_0x09a6('0x3'),{'options':{'raw':!![],'where':{'role':_0x09a6('0x4')},'attributes':['id',_0x09a6('0x5'),_0x09a6('0x6'),_0x09a6('0x7'),_0x09a6('0x8'),'voicePause','chatPause',_0x09a6('0x9'),_0x09a6('0xa'),_0x09a6('0xb'),_0x09a6('0xc'),_0x09a6('0xd'),_0x09a6('0xe'),_0x09a6('0xf'),_0x09a6('0x10'),'smsCapacity',_0x09a6('0x11'),_0x09a6('0x12')]},'log':_0x09a6('0x1')});};}; \ No newline at end of file +var _0xa7fa=['whatsappPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','online','lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa7fa,0x149));var _0xaa7f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa7fa[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xaa7f('0x0'));exports[_0xaa7f('0x1')]=function(){return function(){return client[_0xaa7f('0x2')](_0xaa7f('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name',_0xaa7f('0x4'),'pauseType',_0xaa7f('0x5'),_0xaa7f('0x6'),_0xaa7f('0x7'),_0xaa7f('0x8'),_0xaa7f('0x9'),_0xaa7f('0xa'),_0xaa7f('0xb'),'openchannelPause',_0xaa7f('0xc'),_0xaa7f('0xd'),_0xaa7f('0xe'),_0xaa7f('0xf'),'whatsappCapacity',_0xaa7f('0x10')]},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 7bb25d6..ea5d89d 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 _0x8ff9=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction'];(function(_0x5c1f2d,_0x1ebcac){var _0x1a30ab=function(_0x5534b6){while(--_0x5534b6){_0x5c1f2d['push'](_0x5c1f2d['shift']());}};_0x1a30ab(++_0x1ebcac);}(_0x8ff9,0x188));var _0x98ff=function(_0x218a40,_0x310055){_0x218a40=_0x218a40-0x0;var _0x283f5a=_0x8ff9[_0x218a40];return _0x283f5a;};'use strict';var client=require(_0x98ff('0x0'));exports[_0x98ff('0x1')]=function(_0x3dbe95,_0x51e89c){return client[_0x98ff('0x2')](_0x98ff('0x3'),{'body':_0x51e89c,'options':{'where':{'id':_0x3dbe95}},'log':_0x98ff('0x4')});};exports[_0x98ff('0x5')]=function(_0x1619f1,_0x1448fc){return client[_0x98ff('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x1448fc,'options':{'where':{'id':_0x1619f1}},'log':_0x98ff('0x6')});}; \ No newline at end of file +var _0x5af0=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0x5af0,0x1eb));var _0x05af=function(_0x27141c,_0x25ff8d){_0x27141c=_0x27141c-0x0;var _0x5a9b58=_0x5af0[_0x27141c];return _0x5a9b58;};'use strict';var client=require(_0x05af('0x0'));exports[_0x05af('0x1')]=function(_0x557b73,_0x39fc06){return client[_0x05af('0x2')](_0x05af('0x3'),{'body':_0x39fc06,'options':{'where':{'id':_0x557b73}},'log':_0x05af('0x4')});};exports[_0x05af('0x5')]=function(_0x518abd,_0x3b00d9){return client['Request'](_0x05af('0x6'),{'body':_0x3b00d9,'options':{'where':{'id':_0x518abd}},'log':_0x05af('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 6107e96..ebd1d0a 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 _0x3aa4=['create','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0xc18369,_0x3233c2){var _0x516330=function(_0x5cb87e){while(--_0x5cb87e){_0xc18369['push'](_0xc18369['shift']());}};_0x516330(++_0x3233c2);}(_0x3aa4,0x1a3));var _0x43aa=function(_0x17afd9,_0x31e25f){_0x17afd9=_0x17afd9-0x0;var _0x1b5699=_0x3aa4[_0x17afd9];return _0x1b5699;};'use strict';var client=require(_0x43aa('0x0'));exports[_0x43aa('0x1')]=function(_0x4a060a){return client['Request'](_0x43aa('0x2'),{'body':_0x4a060a,'log':_0x43aa('0x3')});}; \ No newline at end of file +var _0xd183=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x21ffea,_0x5618e2){var _0x371908=function(_0x5792ae){while(--_0x5792ae){_0x21ffea['push'](_0x21ffea['shift']());}};_0x371908(++_0x5618e2);}(_0xd183,0x82));var _0x3d18=function(_0x29217a,_0x57b248){_0x29217a=_0x29217a-0x0;var _0x46a07f=_0xd183[_0x29217a];return _0x46a07f;};'use strict';var client=require(_0x3d18('0x0'));exports[_0x3d18('0x1')]=function(_0x1e28a7){return client[_0x3d18('0x2')](_0x3d18('0x3'),{'body':_0x1e28a7,'log':_0x3d18('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 2599eb8..b0b6ba4 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 _0x9354=['name','timeout','strategy','User','online','whatsappPause','getWhatsappQueues','Request'];(function(_0x4fad0c,_0x4d76ea){var _0x31a96f=function(_0x1ebbed){while(--_0x1ebbed){_0x4fad0c['push'](_0x4fad0c['shift']());}};_0x31a96f(++_0x4d76ea);}(_0x9354,0x96));var _0x4935=function(_0x36f284,_0x24cbd1){_0x36f284=_0x36f284-0x0;var _0x4ea099=_0x9354[_0x36f284];return _0x4ea099;};'use strict';var client=require('../client');exports[_0x4935('0x0')]=function(){return function(){return client[_0x4935('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x4935('0x2'),_0x4935('0x3'),_0x4935('0x4')],'include':[{'model':_0x4935('0x5'),'as':'Agents','attributes':['id',_0x4935('0x2'),_0x4935('0x6'),_0x4935('0x7')]}]},'log':_0x4935('0x0')});};}; \ No newline at end of file +var _0x705f=['Request','name','timeout','strategy','User','Agents','online','whatsappPause','getWhatsappQueues'];(function(_0x3ffb6d,_0x3430d1){var _0x1ccdd0=function(_0x36af1d){while(--_0x36af1d){_0x3ffb6d['push'](_0x3ffb6d['shift']());}};_0x1ccdd0(++_0x3430d1);}(_0x705f,0x75));var _0xf705=function(_0x3c8d6c,_0x51ae3a){_0x3c8d6c=_0x3c8d6c-0x0;var _0x146521=_0x705f[_0x3c8d6c];return _0x146521;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0xf705('0x0')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xf705('0x1'),_0xf705('0x2'),_0xf705('0x3')],'include':[{'model':_0xf705('0x4'),'as':_0xf705('0x5'),'attributes':['id',_0xf705('0x1'),_0xf705('0x6'),_0xf705('0x7')]}]},'log':_0xf705('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 5583a0e..8d00109 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 _0x2a1c=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x10acb2,_0x3ca870){var _0x186379=function(_0x294bbd){while(--_0x294bbd){_0x10acb2['push'](_0x10acb2['shift']());}};_0x186379(++_0x3ca870);}(_0x2a1c,0x15e));var _0xc2a1=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x2a1c[_0x37c22c];return _0x119d79;};'use strict';var client=require(_0xc2a1('0x0'));exports[_0xc2a1('0x1')]=function(_0x5bf7b8){return client[_0xc2a1('0x2')]('CreateWhatsappQueueReport',{'body':_0x5bf7b8,'log':_0xc2a1('0x3')});};exports[_0xc2a1('0x4')]=function(_0x458bad,_0x55891e){return client['Request'](_0xc2a1('0x5'),{'body':_0x55891e,'options':{'where':{'uniqueid':_0x458bad},'order':[['id',_0xc2a1('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xe2f4=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xe2f4,0x12b));var _0x4e2f=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0xe2f4[_0x3df223];return _0x562d11;};'use strict';var client=require('../client');exports[_0x4e2f('0x0')]=function(_0x17b7f4){return client[_0x4e2f('0x1')](_0x4e2f('0x2'),{'body':_0x17b7f4,'log':_0x4e2f('0x2')});};exports[_0x4e2f('0x3')]=function(_0x4c6335,_0x52226c){return client[_0x4e2f('0x1')](_0x4e2f('0x4'),{'body':_0x52226c,'options':{'where':{'uniqueid':_0x4c6335},'order':[['id',_0x4e2f('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index a21d521..4ef7a7f 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 _0xed92=['log','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','length','error','[%s][AGENT]\x20%s','join','stop','find','timeout','createQueue','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next'];(function(_0x1325c6,_0x69d973){var _0x202425=function(_0x72077c){while(--_0x72077c){_0x1325c6['push'](_0x1325c6['shift']());}};_0x202425(++_0x69d973);}(_0xed92,0xac));var _0x2ed9=function(_0x242a39,_0x1a1fbb){_0x242a39=_0x242a39-0x0;var _0x5d93e8=_0xed92[_0x242a39];return _0x5d93e8;};'use strict';var schema=require(_0x2ed9('0x0'));var _=require(_0x2ed9('0x1'));var util=require(_0x2ed9('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x2ed9('0x3'))(_0x2ed9('0x4'));var strategy=require(_0x2ed9('0x5'));var queue=schema({'name':{'type':_0x2ed9('0x6'),'required':!![],'message':_0x2ed9('0x7')},'timeout':{'type':_0x2ed9('0x8'),'message':_0x2ed9('0x9')}});function writeLog(_0x4e1d91,_0x9e2bd2,_0x4b2579){return logger[_0x2ed9('0xa')](util[_0x2ed9('0xb')](_0x2ed9('0xc'),_0x4e1d91,_0x9e2bd2[_0x2ed9('0xd')],_0x4b2579));}function handleFindAgent(_0xc69a76){return function(_0x531ca3){return _0x531ca3[_0x2ed9('0xd')]['toLowerCase']()===_0xc69a76['toLowerCase']();};}exports['consequence']=function(_0x121aae,_0x4c31c8,_0x4790db,_0x2dade7){return function(_0x2260cc){try{var _0x59b11f={'name':_0x4c31c8[0x0],'timeout':_0x4c31c8[0x1]};var _0x524b71=queue[_0x2ed9('0x0')](_0x59b11f,{'typecast':!![]});if(_0x524b71[_0x2ed9('0xe')]){logger[_0x2ed9('0xf')](_0x2ed9('0x10'),_0x121aae,_['map'](_0x524b71,'message')[_0x2ed9('0x11')](',\x20'));_0x2260cc[_0x2ed9('0x12')]();}else{var _0x21ffe9=_[_0x2ed9('0x13')](_0x4790db['agents'],handleFindAgent(_0x59b11f[_0x2ed9('0xd')]));if(_0x21ffe9){var _0x3c9058=(_0x59b11f[_0x2ed9('0x14')]||0xa)*0x3e8;var _0x2eb7f9,_0x16e51f;var _0x2127fa=seqqueue[_0x2ed9('0x15')](_0x3c9058);_0x2127fa['id']=_0x121aae;_0x2127fa[_0x2ed9('0x16')]=_0x3c9058;_0x2127fa[_0x2ed9('0x17')]=_0x2dade7[_0x2ed9('0x17')];writeLog(_0x121aae,_0x21ffe9,util['format'](_0x2ed9('0x18'),_0x3c9058));_0x4790db['rules'][_0x121aae]['on'](_0x2ed9('0x19'),function(){logger[_0x2ed9('0xa')](_0x2ed9('0x1a'),_0x121aae);clearTimeout(_0x16e51f);_0x16e51f=undefined;_0x2127fa[_0x2ed9('0x1b')]();if(_0x4790db['rules'][_0x121aae]){delete _0x4790db[_0x2ed9('0x1c')][_0x121aae];}_0x2260cc['stop']();});_0x4790db['rules'][_0x121aae]['on'](_0x2ed9('0x1d'),function(){if(_0x4790db['rules'][_0x121aae]){delete _0x4790db[_0x2ed9('0x1c')][_0x121aae];}});_0x16e51f=setTimeout(function(){logger[_0x2ed9('0xa')](_0x2ed9('0x1e'),_0x121aae);clearTimeout(_0x16e51f);_0x2127fa[_0x2ed9('0x1b')]();_0x2260cc[_0x2ed9('0x1f')]();},_0x3c9058);strategy['agent'](_0x2127fa,_0x21ffe9,_0x4790db,_0x2dade7);}else{logger[_0x2ed9('0xf')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x121aae,_0x59b11f[_0x2ed9('0xd')]);_0x2260cc['stop']();}}}catch(_0x1aba64){console[_0x2ed9('0x20')](_0x1aba64);logger[_0x2ed9('0xf')]('[%s][QUEUE]\x20%s',_0x121aae,_0x1aba64[_0x2ed9('0x21')]);_0x2260cc[_0x2ed9('0x12')]();}};}; \ No newline at end of file +var _0x3e5d=['agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','message','join','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next'];(function(_0xb175e7,_0x558e67){var _0x4b2387=function(_0x155ba7){while(--_0x155ba7){_0xb175e7['push'](_0xb175e7['shift']());}};_0x4b2387(++_0x558e67);}(_0x3e5d,0x15b));var _0xd3e5=function(_0x2809e6,_0x4cd5a6){_0x2809e6=_0x2809e6-0x0;var _0x28d1ae=_0x3e5d[_0x2809e6];return _0x28d1ae;};'use strict';var schema=require(_0xd3e5('0x0'));var _=require(_0xd3e5('0x1'));var util=require(_0xd3e5('0x2'));var seqqueue=require(_0xd3e5('0x3'));var logger=require(_0xd3e5('0x4'))(_0xd3e5('0x5'));var strategy=require(_0xd3e5('0x6'));var queue=schema({'name':{'type':_0xd3e5('0x7'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xd3e5('0x8'),'message':_0xd3e5('0x9')}});function writeLog(_0x351b20,_0x253654,_0x555a85){return logger[_0xd3e5('0xa')](util[_0xd3e5('0xb')](_0xd3e5('0xc'),_0x351b20,_0x253654[_0xd3e5('0xd')],_0x555a85));}function handleFindAgent(_0x19c8e4){return function(_0x24e878){return _0x24e878[_0xd3e5('0xd')]['toLowerCase']()===_0x19c8e4[_0xd3e5('0xe')]();};}exports[_0xd3e5('0xf')]=function(_0x108d30,_0x40f56c,_0x1a84c9,_0x300d95){return function(_0x19d822){try{var _0x45f414={'name':_0x40f56c[0x0],'timeout':_0x40f56c[0x1]};var _0x1c293e=queue[_0xd3e5('0x0')](_0x45f414,{'typecast':!![]});if(_0x1c293e[_0xd3e5('0x10')]){logger[_0xd3e5('0x11')]('[%s][AGENT]\x20%s',_0x108d30,_['map'](_0x1c293e,_0xd3e5('0x12'))[_0xd3e5('0x13')](',\x20'));_0x19d822['stop']();}else{var _0x19ffc6=_['find'](_0x1a84c9[_0xd3e5('0x14')],handleFindAgent(_0x45f414[_0xd3e5('0xd')]));if(_0x19ffc6){var _0x46a6a8=(_0x45f414[_0xd3e5('0x15')]||0xa)*0x3e8;var _0x2ac628,_0x3b328f;var _0x538bac=seqqueue[_0xd3e5('0x16')](_0x46a6a8);_0x538bac['id']=_0x108d30;_0x538bac['atimeout']=_0x46a6a8;_0x538bac[_0xd3e5('0x17')]=_0x300d95[_0xd3e5('0x17')];writeLog(_0x108d30,_0x19ffc6,util['format'](_0xd3e5('0x18'),_0x46a6a8));_0x1a84c9[_0xd3e5('0x19')][_0x108d30]['on'](_0xd3e5('0x1a'),function(){logger['info'](_0xd3e5('0x1b'),_0x108d30);clearTimeout(_0x3b328f);_0x3b328f=undefined;_0x538bac[_0xd3e5('0x1c')]();if(_0x1a84c9['rules'][_0x108d30]){delete _0x1a84c9[_0xd3e5('0x19')][_0x108d30];}_0x19d822[_0xd3e5('0x1d')]();});_0x1a84c9[_0xd3e5('0x19')][_0x108d30]['on'](_0xd3e5('0x1e'),function(){if(_0x1a84c9[_0xd3e5('0x19')][_0x108d30]){delete _0x1a84c9['rules'][_0x108d30];}});_0x3b328f=setTimeout(function(){logger[_0xd3e5('0xa')](_0xd3e5('0x1f'),_0x108d30);clearTimeout(_0x3b328f);_0x538bac[_0xd3e5('0x1c')]();_0x19d822[_0xd3e5('0x20')]();},_0x46a6a8);strategy[_0xd3e5('0x21')](_0x538bac,_0x19ffc6,_0x1a84c9,_0x300d95);}else{logger[_0xd3e5('0x11')](_0xd3e5('0x22'),_0x108d30,_0x45f414[_0xd3e5('0xd')]);_0x19d822[_0xd3e5('0x1d')]();}}}catch(_0x2f7d7f){console[_0xd3e5('0x23')](_0x2f7d7f);logger[_0xd3e5('0x11')](_0xd3e5('0x24'),_0x108d30,_0x2f7d7f[_0xd3e5('0x25')]);_0x19d822[_0xd3e5('0x1d')]();}};}; \ 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 7e013dd..3cfee9d 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 _0xa92c=['lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','Message','create','body','catch','error','stringify','finally','stop','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','providerName','then','dialogState','Failed'];(function(_0x16f5ee,_0x236737){var _0x1ac7bd=function(_0xa53c91){while(--_0xa53c91){_0x16f5ee['push'](_0x16f5ee['shift']());}};_0x1ac7bd(++_0x236737);}(_0xa92c,0x149));var _0xca92=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xa92c[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0xca92('0x0'));var moment=require(_0xca92('0x1'));var AWS=require(_0xca92('0x2'));var utils=require(_0xca92('0x3'));var logger=require(_0xca92('0x4'))(_0xca92('0x5'));var rpc={'chatMessage':require(_0xca92('0x6')),'openchannelMessage':require(_0xca92('0x7')),'mailMessage':require(_0xca92('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xca92('0x9')),'whatsappMessage':require(_0xca92('0xa'))};exports[_0xca92('0xb')]=function(_0x3a8cfd,_0x314757){return function(_0x43fb2c){try{if(!_[_0xca92('0xc')](this[_0xca92('0xd')]['UserId'])){logger[_0xca92('0xe')](_0xca92('0xf'),_0x3a8cfd,_0xca92('0x10'));return _0x43fb2c['next']();}var _0x1c53ca={'ContactId':this['contact']['id'],'sentAt':moment()[_0xca92('0x11')](_0xca92('0x12')),'direction':'out'};if(this[_0xca92('0x13')]==='sms'||this[_0xca92('0x13')]===_0xca92('0x14')){_0x1c53ca[_0xca92('0x15')]=this[_0xca92('0xd')][_0xca92('0x15')];}var _0xfcb050=this[_0xca92('0x13')];if(_0xfcb050===_0xca92('0x16')){_0x1c53ca[_0xca92('0x17')]=this[_0xca92('0x18')]['id'];}else{_0x1c53ca[_[_0xca92('0x19')](_0xfcb050)+_0xca92('0x1a')]=this[_0xca92('0x18')]['id'];}_0x1c53ca[_['upperFirst'](_0xfcb050)+'InteractionId']=this[_0xca92('0xd')]['id'];if(this[_0xca92('0xd')]['created']){var _0x3f2eda=_0x314757[0x4];if(!_[_0xca92('0x1b')](_0x3f2eda)){_0x1c53ca['body']=utils['getMustacheRender'](_0x3f2eda,this);return rpc[_0xfcb050+_0xca92('0x1c')][_0xca92('0x1d')](_0x1c53ca)['then'](function(_0x4e672d){logger[_0xca92('0xe')]('[%s][AMAZONLEX]\x20%s',_0x3a8cfd,_0x1c53ca[_0xca92('0x1e')]);})[_0xca92('0x1f')](function(_0x5bdefe){logger[_0xca92('0x20')](_0xca92('0xf'),_0x3a8cfd,JSON[_0xca92('0x21')](_0x5bdefe));})[_0xca92('0x22')](function(){logger[_0xca92('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3a8cfd);_0x43fb2c[_0xca92('0x23')]();});}else{logger[_0xca92('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3a8cfd);_0x43fb2c[_0xca92('0x23')]();}}else{var _0x4bc825=this;var _0x35b1bd=new AWS[(_0xca92('0x24'))]({'accessKeyId':_0x314757[0x0],'secretAccessKey':_0x314757[0x1],'region':_0x314757[0x2]});var _0x18f0dd={'botAlias':_0xca92('0x25'),'botName':_0x314757[0x3],'inputText':this[_0xca92('0x26')][_0xca92('0x1e')],'userId':this[_0xca92('0x13')]+':'+this[_0xca92('0xd')]['id'][_0xca92('0x27')]()};_0x35b1bd[_0xca92('0x28')](_0x18f0dd,function(_0x23ae84,_0x5ae845){if(_0x23ae84){logger[_0xca92('0x20')](_0xca92('0xf'),_0x3a8cfd,_0x23ae84[_0xca92('0x26')]);_0x43fb2c[_0xca92('0x29')]();}else if(_0x5ae845&&_0x5ae845['message']){_0x4bc825[_0xca92('0x1e')][_0xca92('0x2a')]=_0x5ae845;_0x1c53ca[_0xca92('0x1e')]=_0x5ae845[_0xca92('0x26')];_0x1c53ca[_0xca92('0x2b')]=_0xca92('0x2a');_0x1c53ca['providerResponse']=JSON[_0xca92('0x21')](_0x5ae845);return rpc[_0xfcb050+_0xca92('0x1c')][_0xca92('0x1d')](_0x1c53ca)[_0xca92('0x2c')](function(_0x4756cf){logger['info'](_0xca92('0xf'),_0x3a8cfd,_0x1c53ca[_0xca92('0x1e')]);if(_0x5ae845[_0xca92('0x2d')]==_0xca92('0x2e')){_0x43fb2c[_0xca92('0x29')]();}else{_0x43fb2c[_0xca92('0x23')]();}})[_0xca92('0x1f')](function(_0xa51717){logger[_0xca92('0x20')](_0xca92('0xf'),_0x3a8cfd,JSON[_0xca92('0x21')](_0xa51717));_0x43fb2c['next']();});}else{_0x43fb2c[_0xca92('0x29')]();}});}}catch(_0x4b439e){logger[_0xca92('0x20')]('[%s][AMAZONLEX]\x20%s',_0x3a8cfd,JSON[_0xca92('0x21')](_0x4b439e));_0x43fb2c['stop']();}};}; \ No newline at end of file +var _0x2db7=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','create','then','body','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','LexRuntime','$LATEST','message','providerName','amazonlex','providerResponse','Message','dialogState','Failed','stop','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s'];(function(_0x1af26a,_0x108912){var _0x2025e5=function(_0x298992){while(--_0x298992){_0x1af26a['push'](_0x1af26a['shift']());}};_0x2025e5(++_0x108912);}(_0x2db7,0x1cf));var _0x72db=function(_0x5a1cbd,_0xb4ed72){_0x5a1cbd=_0x5a1cbd-0x0;var _0x2fb384=_0x2db7[_0x5a1cbd];return _0x2fb384;};'use strict';var _=require(_0x72db('0x0'));var moment=require(_0x72db('0x1'));var AWS=require(_0x72db('0x2'));var utils=require(_0x72db('0x3'));var logger=require(_0x72db('0x4'))(_0x72db('0x5'));var rpc={'chatMessage':require(_0x72db('0x6')),'openchannelMessage':require(_0x72db('0x7')),'mailMessage':require(_0x72db('0x8')),'smsMessage':require(_0x72db('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x72db('0xa'))};exports[_0x72db('0xb')]=function(_0x2bfca7,_0x37b915){return function(_0x2fe66f){try{if(!_[_0x72db('0xc')](this[_0x72db('0xd')][_0x72db('0xe')])){logger[_0x72db('0xf')](_0x72db('0x10'),_0x2bfca7,_0x72db('0x11'));return _0x2fe66f[_0x72db('0x12')]();}var _0x6ff0d7={'ContactId':this['contact']['id'],'sentAt':moment()[_0x72db('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x72db('0x14')};if(this['channel']==='sms'||this[_0x72db('0x15')]==='whatsapp'){_0x6ff0d7[_0x72db('0x16')]=this[_0x72db('0xd')][_0x72db('0x16')];}var _0x56de88=this[_0x72db('0x15')];if(_0x56de88===_0x72db('0x17')){_0x6ff0d7[_0x72db('0x18')]=this[_0x72db('0x19')]['id'];}else{_0x6ff0d7[_[_0x72db('0x1a')](_0x56de88)+_0x72db('0x1b')]=this['account']['id'];}_0x6ff0d7[_['upperFirst'](_0x56de88)+_0x72db('0x1c')]=this['interaction']['id'];if(this[_0x72db('0xd')][_0x72db('0x1d')]){var _0x532a68=_0x37b915[0x4];if(!_['isEmpty'](_0x532a68)){_0x6ff0d7['body']=utils[_0x72db('0x1e')](_0x532a68,this);return rpc[_0x56de88+'Message'][_0x72db('0x1f')](_0x6ff0d7)[_0x72db('0x20')](function(_0x1042c3){logger['info'](_0x72db('0x10'),_0x2bfca7,_0x6ff0d7[_0x72db('0x21')]);})['catch'](function(_0xd74319){logger[_0x72db('0x22')](_0x72db('0x10'),_0x2bfca7,JSON[_0x72db('0x23')](_0xd74319));})[_0x72db('0x24')](function(){logger[_0x72db('0xf')](_0x72db('0x25'),_0x2bfca7);_0x2fe66f['stop']();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2bfca7);_0x2fe66f['stop']();}}else{var _0x53d108=this;var _0x51417f=new AWS[(_0x72db('0x26'))]({'accessKeyId':_0x37b915[0x0],'secretAccessKey':_0x37b915[0x1],'region':_0x37b915[0x2]});var _0x4c090a={'botAlias':_0x72db('0x27'),'botName':_0x37b915[0x3],'inputText':this[_0x72db('0x28')][_0x72db('0x21')],'userId':this['channel']+':'+this[_0x72db('0xd')]['id']['toString']()};_0x51417f['postText'](_0x4c090a,function(_0x410748,_0x523891){if(_0x410748){logger['error'](_0x72db('0x10'),_0x2bfca7,_0x410748[_0x72db('0x28')]);_0x2fe66f[_0x72db('0x12')]();}else if(_0x523891&&_0x523891[_0x72db('0x28')]){_0x53d108[_0x72db('0x21')]['amazonlex']=_0x523891;_0x6ff0d7[_0x72db('0x21')]=_0x523891[_0x72db('0x28')];_0x6ff0d7[_0x72db('0x29')]=_0x72db('0x2a');_0x6ff0d7[_0x72db('0x2b')]=JSON[_0x72db('0x23')](_0x523891);return rpc[_0x56de88+_0x72db('0x2c')][_0x72db('0x1f')](_0x6ff0d7)[_0x72db('0x20')](function(_0x4501e3){logger[_0x72db('0xf')](_0x72db('0x10'),_0x2bfca7,_0x6ff0d7['body']);if(_0x523891[_0x72db('0x2d')]==_0x72db('0x2e')){_0x2fe66f['next']();}else{_0x2fe66f[_0x72db('0x2f')]();}})['catch'](function(_0x29bd07){logger[_0x72db('0x22')](_0x72db('0x10'),_0x2bfca7,JSON[_0x72db('0x23')](_0x29bd07));_0x2fe66f[_0x72db('0x12')]();});}else{_0x2fe66f[_0x72db('0x12')]();}});}}catch(_0x1c0f38){logger[_0x72db('0x22')]('[%s][AMAZONLEX]\x20%s',_0x2bfca7,JSON[_0x72db('0x23')](_0x1c0f38));_0x2fe66f[_0x72db('0x2f')]();}};}; \ 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 190f5f6..b9320d3 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 _0x86be=['','headers','auto-replied','auto_reply','sendMailMessage','then','info','catch','[RPC][%s][AUTOREPLY]\x20%s','stringify','create','error','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Smtp','service','host','port','secure','authentication','auth','user','pass','messageId','html',''];(function(_0x412124,_0x6965f){var _0x386ed4=function(_0x5e3077){while(--_0x5e3077){_0x412124['push'](_0x412124['shift']());}};_0x386ed4(++_0x6965f);}(_0x86be,0x176));var _0xe86b=function(_0x1b920b,_0x41bd1a){_0x1b920b=_0x1b920b-0x0;var _0x4d75f8=_0x86be[_0x1b920b];return _0x4d75f8;};'use strict';var _=require(_0xe86b('0x0'));var moment=require('moment');var utils=require(_0xe86b('0x1'));var logger=require(_0xe86b('0x2'))(_0xe86b('0x3'));var rpc={'chatMessage':require(_0xe86b('0x4')),'openchannelMessage':require(_0xe86b('0x5')),'mailMessage':require(_0xe86b('0x6')),'smsMessage':require(_0xe86b('0x7')),'faxMessage':require(_0xe86b('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x7ccd64,_0xa52177){return function(_0x40aac9){try{if(_0xa52177[0x0]==='1'&&(_[_0xe86b('0x9')](this['interaction'][_0xe86b('0xa')])||!this[_0xe86b('0xb')][_0xe86b('0xa')])){logger['info'](_0xe86b('0xc'),_0x7ccd64,_0xe86b('0xd'));return _0x40aac9[_0xe86b('0xe')]();}var _0x4a4355=this[_0xe86b('0xf')];var _0x431271={'ContactId':this[_0xe86b('0x10')]['id'],'sentAt':moment()[_0xe86b('0x11')](_0xe86b('0x12')),'direction':_0xe86b('0x13')};if(this[_0xe86b('0xf')]===_0xe86b('0x14')){_0x431271['body']=utils['getMustacheRender'](_0xa52177[0x2],this);}else{_0x431271[_0xe86b('0x15')]=utils[_0xe86b('0x16')](_0xa52177[0x1],this);}if(this[_0xe86b('0x17')]){_0x431271['to']=this[_0xe86b('0x17')][_0xe86b('0x18')]||'';if(this[_0xe86b('0xf')]===_0xe86b('0x14')&&_0xa52177[0x1]==='1'){_0x431271['cc']=this[_0xe86b('0x17')]['cc']||'';}_0x431271[_0xe86b('0x18')]=this[_0xe86b('0x17')]['to']||'';_0x431271[_0xe86b('0x19')]=this['message'][_0xe86b('0x19')]||'';_0x431271['read']=!![];if(this[_0xe86b('0x17')][_0xe86b('0x1a')]){_0x431271[_0xe86b('0x1a')]='';_0x431271[_0xe86b('0x1a')]+=_[_0xe86b('0x1b')](this[_0xe86b('0x17')][_0xe86b('0x1a')],'Re:')?'':_0xe86b('0x1c');_0x431271['subject']+=this[_0xe86b('0x17')]['subject'];}}if(this[_0xe86b('0xf')]===_0xe86b('0x1d')){_0x431271[_0xe86b('0x1e')]=this[_0xe86b('0x1f')]['id'];}else{_0x431271[_[_0xe86b('0x20')](this[_0xe86b('0xf')])+'AccountId']=this[_0xe86b('0x1f')]['id'];}_0x431271[_[_0xe86b('0x20')](this[_0xe86b('0xf')])+_0xe86b('0x21')]=this['interaction']['id'];if(rpc[this[_0xe86b('0xf')]+'Message']){if(this['channel']==='mail'){var _0x3ff3f7={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xe86b('0x22')][_0xe86b('0x23')]){_0x3ff3f7[_0xe86b('0x23')]=this[_0xe86b('0x1f')][_0xe86b('0x22')]['service'];}else{_0x3ff3f7[_0xe86b('0x24')]=this['account'][_0xe86b('0x22')][_0xe86b('0x24')];_0x3ff3f7['port']=this['account'][_0xe86b('0x22')][_0xe86b('0x25')];_0x3ff3f7[_0xe86b('0x26')]=this['account'][_0xe86b('0x22')][_0xe86b('0x26')];}if(this[_0xe86b('0x1f')][_0xe86b('0x22')][_0xe86b('0x27')]){_0x3ff3f7[_0xe86b('0x28')]={'user':this['account'][_0xe86b('0x22')][_0xe86b('0x29')],'pass':this['account'][_0xe86b('0x22')][_0xe86b('0x2a')]};}_0x431271['inReplyTo']=this[_0xe86b('0x17')][_0xe86b('0x2b')];_0x431271[_0xe86b('0x2c')]=_0xe86b('0x2d')+_['replace'](_0x431271['body'],_0xe86b('0x2e'),'','replace','','headers','auto-replied','auto_reply'];(function(_0x49cac,_0x269756){var _0xc7154e=function(_0x33affb){while(--_0x33affb){_0x49cac['push'](_0x49cac['shift']());}};_0xc7154e(++_0x269756);}(_0x639a,0x1e8));var _0xa639=function(_0xd2f771,_0x11e4c7){_0xd2f771=_0xd2f771-0x0;var _0x29550b=_0x639a[_0xd2f771];return _0x29550b;};'use strict';var _=require(_0xa639('0x0'));var moment=require(_0xa639('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xa639('0x2'));var rpc={'chatMessage':require(_0xa639('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa639('0x4')),'smsMessage':require(_0xa639('0x5')),'faxMessage':require(_0xa639('0x6')),'whatsappMessage':require(_0xa639('0x7'))};var mailRpc=require('../../mailRpc');exports[_0xa639('0x8')]=function(_0x4b8b5d,_0x276815){return function(_0x38b779){try{if(_0x276815[0x0]==='1'&&(_[_0xa639('0x9')](this[_0xa639('0xa')][_0xa639('0xb')])||!this['interaction'][_0xa639('0xb')])){logger[_0xa639('0xc')](_0xa639('0xd'),_0x4b8b5d,'Autoreply\x20already\x20sent');return _0x38b779[_0xa639('0xe')]();}var _0x19d8c6=this['channel'];var _0x34a5b1={'ContactId':this[_0xa639('0xf')]['id'],'sentAt':moment()['format'](_0xa639('0x10')),'direction':_0xa639('0x11')};if(this['channel']===_0xa639('0x12')){_0x34a5b1[_0xa639('0x13')]=utils[_0xa639('0x14')](_0x276815[0x2],this);}else{_0x34a5b1[_0xa639('0x13')]=utils[_0xa639('0x14')](_0x276815[0x1],this);}if(this[_0xa639('0x15')]){_0x34a5b1['to']=this[_0xa639('0x15')]['from']||'';if(this[_0xa639('0x16')]===_0xa639('0x12')&&_0x276815[0x1]==='1'){_0x34a5b1['cc']=this[_0xa639('0x15')]['cc']||'';}_0x34a5b1[_0xa639('0x17')]=this[_0xa639('0x15')]['to']||'';_0x34a5b1[_0xa639('0x18')]=this[_0xa639('0x15')][_0xa639('0x18')]||'';_0x34a5b1[_0xa639('0x19')]=!![];if(this['message'][_0xa639('0x1a')]){_0x34a5b1[_0xa639('0x1a')]='';_0x34a5b1['subject']+=_[_0xa639('0x1b')](this[_0xa639('0x15')][_0xa639('0x1a')],_0xa639('0x1c'))?'':'Re:\x20';_0x34a5b1[_0xa639('0x1a')]+=this[_0xa639('0x15')][_0xa639('0x1a')];}}if(this[_0xa639('0x16')]==='chat'){_0x34a5b1[_0xa639('0x1d')]=this[_0xa639('0x1e')]['id'];}else{_0x34a5b1[_[_0xa639('0x1f')](this[_0xa639('0x16')])+_0xa639('0x20')]=this['account']['id'];}_0x34a5b1[_[_0xa639('0x1f')](this[_0xa639('0x16')])+_0xa639('0x21')]=this[_0xa639('0xa')]['id'];if(rpc[this['channel']+_0xa639('0x22')]){if(this['channel']===_0xa639('0x12')){var _0x11299b={'tls':{'rejectUnauthorized':![]}};if(this[_0xa639('0x1e')]['Smtp'][_0xa639('0x23')]){_0x11299b['service']=this[_0xa639('0x1e')][_0xa639('0x24')][_0xa639('0x23')];}else{_0x11299b[_0xa639('0x25')]=this['account'][_0xa639('0x24')][_0xa639('0x25')];_0x11299b[_0xa639('0x26')]=this[_0xa639('0x1e')]['Smtp'][_0xa639('0x26')];_0x11299b[_0xa639('0x27')]=this[_0xa639('0x1e')][_0xa639('0x24')][_0xa639('0x27')];}if(this[_0xa639('0x1e')]['Smtp']['authentication']){_0x11299b[_0xa639('0x28')]={'user':this[_0xa639('0x1e')][_0xa639('0x24')][_0xa639('0x29')],'pass':this[_0xa639('0x1e')]['Smtp']['pass']};}_0x34a5b1[_0xa639('0x2a')]=this['message'][_0xa639('0x2b')];_0x34a5b1['html']=_0xa639('0x2c')+_[_0xa639('0x2d')](_0x34a5b1[_0xa639('0x13')],_0xa639('0x2e'),_0xa639('0x2f'))+_0xa639('0x30');_0x34a5b1[_0xa639('0x31')]={'Auto-Submitted':_0xa639('0x32'),'X-Auto-Response-Suppress':'All','Precedence':_0xa639('0x33')};return mailRpc['sendMailMessage'](_0x11299b,_0x34a5b1)[_0xa639('0x34')](function(_0x263a22){logger['info'](_0xa639('0x35'),_0x4b8b5d);_0x34a5b1[_0xa639('0x2b')]=_0x263a22['message']['messageId'];return rpc[_0x19d8c6+_0xa639('0x22')][_0xa639('0x36')](_0x34a5b1);})[_0xa639('0x34')](function(_0x443340){logger[_0xa639('0xc')](_0xa639('0xd'),_0x4b8b5d,JSON['stringify'](_0x443340));})['catch'](function(_0x440d13){logger[_0xa639('0x37')]('[RPC][%s][AUTOREPLY]\x20%s',_0x4b8b5d,JSON[_0xa639('0x38')](_0x440d13));})[_0xa639('0x39')](function(){_0x38b779[_0xa639('0xe')]();});}else{return rpc[this[_0xa639('0x16')]+'Message'][_0xa639('0x36')](_0x34a5b1)[_0xa639('0x34')](function(_0x341580){logger[_0xa639('0xc')]('[%s][AUTOREPLY]\x20%s',_0x4b8b5d,_0x34a5b1[_0xa639('0x13')]);})[_0xa639('0x3a')](function(_0xdfc5ab){logger[_0xa639('0x37')](_0xa639('0xd'),_0x4b8b5d,JSON[_0xa639('0x38')](_0xdfc5ab));})[_0xa639('0x39')](function(){_0x38b779[_0xa639('0xe')]();});}}}catch(_0xe249b3){logger[_0xa639('0x37')](_0xa639('0xd'),_0x4b8b5d,JSON[_0xa639('0x38')](_0xe249b3));_0x38b779[_0xa639('0x3b')]();}};}; \ 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 9a1ebc6..f1b0ef3 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 _0x8c46=['interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction'];(function(_0x5055f1,_0x3cbb87){var _0x28a9f0=function(_0x31433d){while(--_0x31433d){_0x5055f1['push'](_0x5055f1['shift']());}};_0x28a9f0(++_0x3cbb87);}(_0x8c46,0x171));var _0x68c4=function(_0x3dcc9d,_0x38ceb9){_0x3dcc9d=_0x3dcc9d-0x0;var _0x3b0d59=_0x8c46[_0x3dcc9d];return _0x3b0d59;};'use strict';var moment=require(_0x68c4('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0x68c4('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x68c4('0x2')),'faxInteraction':require(_0x68c4('0x3')),'whatsappInteraction':require(_0x68c4('0x4'))};exports[_0x68c4('0x5')]=function(_0x287adb,_0x1243c6,_0x40ce21,_0x1516cf){return function(_0x3da9c3){try{logger[_0x68c4('0x6')]('[%s][CLOSE]\x20reason\x20%s',_0x287adb,_0x1243c6[0x0]);var _0x1754d7={'closed':0x1,'closedAt':moment()[_0x68c4('0x7')](_0x68c4('0x8')),'closeReason':'system','disposition':_0x1243c6[0x0]};if(rpc[_0x1516cf[_0x68c4('0x9')]+_0x68c4('0xa')]){rpc[_0x1516cf[_0x68c4('0x9')]+'Interaction']['update'](_0x1516cf[_0x68c4('0xb')]['id'],_0x1754d7)[_0x68c4('0xc')](function(_0x50b161){logger['info'](_0x68c4('0xd'),_0x287adb,_0x1516cf[_0x68c4('0xb')]['id']);})[_0x68c4('0xe')](function(_0x48783b){logger[_0x68c4('0xf')](_0x68c4('0x10'),_0x287adb,JSON[_0x68c4('0x11')](_0x48783b));})['finally'](function(){_0x3da9c3[_0x68c4('0x12')]();});}}catch(_0x14919c){logger[_0x68c4('0xf')]('[%s][CLOSE]\x20%s',_0x287adb,JSON[_0x68c4('0x11')](_0x14919c));_0x3da9c3[_0x68c4('0x12')]();}};}; \ No newline at end of file +var _0x0f9f=['info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction','then','catch','error','stringify','finally','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence'];(function(_0x4f1a11,_0x225dfb){var _0x38bfe4=function(_0x4892f0){while(--_0x4892f0){_0x4f1a11['push'](_0x4f1a11['shift']());}};_0x38bfe4(++_0x225dfb);}(_0x0f9f,0xae));var _0xf0f9=function(_0x5ec25b,_0x1ff58e){_0x5ec25b=_0x5ec25b-0x0;var _0x4fe26f=_0x0f9f[_0x5ec25b];return _0x4fe26f;};'use strict';var moment=require(_0xf0f9('0x0'));var logger=require(_0xf0f9('0x1'))(_0xf0f9('0x2'));var rpc={'chatInteraction':require(_0xf0f9('0x3')),'openchannelInteraction':require(_0xf0f9('0x4')),'smsInteraction':require(_0xf0f9('0x5')),'mailInteraction':require(_0xf0f9('0x6')),'faxInteraction':require(_0xf0f9('0x7')),'whatsappInteraction':require(_0xf0f9('0x8'))};exports[_0xf0f9('0x9')]=function(_0x4ed571,_0x524fbd,_0xcc39d6,_0x4540a2){return function(_0x53d1e7){try{logger[_0xf0f9('0xa')](_0xf0f9('0xb'),_0x4ed571,_0x524fbd[0x0]);var _0x2ce622={'closed':0x1,'closedAt':moment()['format'](_0xf0f9('0xc')),'closeReason':_0xf0f9('0xd'),'disposition':_0x524fbd[0x0]};if(rpc[_0x4540a2['channel']+_0xf0f9('0xe')]){rpc[_0x4540a2[_0xf0f9('0xf')]+_0xf0f9('0xe')][_0xf0f9('0x10')](_0x4540a2[_0xf0f9('0x11')]['id'],_0x2ce622)[_0xf0f9('0x12')](function(_0x3ff1a9){logger[_0xf0f9('0xa')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x4ed571,_0x4540a2[_0xf0f9('0x11')]['id']);})[_0xf0f9('0x13')](function(_0xc23039){logger[_0xf0f9('0x14')]('[%s][CLOSE]\x20%s',_0x4ed571,JSON[_0xf0f9('0x15')](_0xc23039));})[_0xf0f9('0x16')](function(){_0x53d1e7['stop']();});}}catch(_0x334c39){logger['error']('[%s][CLOSE]\x20%s',_0x4ed571,JSON[_0xf0f9('0x15')](_0x334c39));_0x53d1e7['stop']();}};}; \ 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 827b5be..a8aa1c7 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 _0x0b21=['error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','body','result','fulfillment','speech','providerName','dialogflow','stringify','then','metadata','endConversation','catch','message','moment','apiai-promise','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','getMustacheRender','Message','create','info'];(function(_0x265855,_0x8d3ce9){var _0x5899e7=function(_0x3d4099){while(--_0x3d4099){_0x265855['push'](_0x265855['shift']());}};_0x5899e7(++_0x8d3ce9);}(_0x0b21,0x6d));var _0x10b2=function(_0x5d94c8,_0x714647){_0x5d94c8=_0x5d94c8-0x0;var _0x37f360=_0x0b21[_0x5d94c8];return _0x37f360;};'use strict';var _=require('lodash');var moment=require(_0x10b2('0x0'));var apiai=require(_0x10b2('0x1'));var md5=require('md5');var utils=require(_0x10b2('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x10b2('0x3')),'openchannelMessage':require(_0x10b2('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x10b2('0x5')),'faxMessage':require(_0x10b2('0x6')),'whatsappMessage':require(_0x10b2('0x7'))};exports[_0x10b2('0x8')]=function(_0x3137c4,_0x20ef71){return function(_0x6b19c9){try{if(!_['isNil'](this[_0x10b2('0x9')][_0x10b2('0xa')])){logger['info'](_0x10b2('0xb'),_0x3137c4,_0x10b2('0xc'));return _0x6b19c9[_0x10b2('0xd')]();}var _0xb91928={'ContactId':this['contact']['id'],'sentAt':moment()[_0x10b2('0xe')](_0x10b2('0xf')),'direction':'out'};if(this['channel']==='sms'||this[_0x10b2('0x10')]===_0x10b2('0x11')){_0xb91928[_0x10b2('0x12')]=this[_0x10b2('0x9')][_0x10b2('0x12')];}var _0x28758b=this[_0x10b2('0x10')];if(_0x28758b===_0x10b2('0x13')){_0xb91928[_0x10b2('0x14')]=this[_0x10b2('0x15')]['id'];}else{_0xb91928[_[_0x10b2('0x16')](_0x28758b)+'AccountId']=this[_0x10b2('0x15')]['id'];}_0xb91928[_[_0x10b2('0x16')](_0x28758b)+'InteractionId']=this[_0x10b2('0x9')]['id'];if(this['interaction'][_0x10b2('0x17')]){var _0x5990c0=_0x20ef71[0x2];if(!_[_0x10b2('0x18')](_0x5990c0)){_0xb91928['body']=utils[_0x10b2('0x19')](_0x5990c0,this);return rpc[_0x28758b+_0x10b2('0x1a')][_0x10b2('0x1b')](_0xb91928)['then'](function(_0x1a103a){logger[_0x10b2('0x1c')](_0x10b2('0xb'),_0x3137c4,_0xb91928['body']);})['catch'](function(_0x1185a2){logger[_0x10b2('0x1d')](_0x10b2('0xb'),_0x3137c4,JSON['stringify'](_0x1185a2));})[_0x10b2('0x1e')](function(){logger[_0x10b2('0x1c')](_0x10b2('0x1f'),_0x3137c4);_0x6b19c9[_0x10b2('0x20')]();});}else{logger[_0x10b2('0x1c')](_0x10b2('0x21'),_0x3137c4);_0x6b19c9[_0x10b2('0x20')]();}}else{var _0x4c4c1c=this;var _0x2cd7cd=apiai(_0x20ef71[0x0],{'language':_0x20ef71[0x1]||'en'});return _0x2cd7cd['textRequest'](this['message'][_0x10b2('0x22')],{'sessionId':md5(this[_0x10b2('0x9')]['id'])})['then'](function(_0x35035a){_0x4c4c1c[_0x10b2('0x22')]['dialogflow']=_0x35035a;_0xb91928[_0x10b2('0x22')]=_0x35035a[_0x10b2('0x23')][_0x10b2('0x24')][_0x10b2('0x25')];_0xb91928[_0x10b2('0x26')]=_0x10b2('0x27');_0xb91928['providerResponse']=JSON[_0x10b2('0x28')](_0x35035a);return rpc[_0x28758b+_0x10b2('0x1a')][_0x10b2('0x1b')](_0xb91928)[_0x10b2('0x29')](function(_0x2f65c2){logger['info'](_0x10b2('0xb'),_0x3137c4,_0xb91928[_0x10b2('0x22')]);if(_0x35035a[_0x10b2('0x23')][_0x10b2('0x2a')][_0x10b2('0x2b')]){_0x6b19c9[_0x10b2('0xd')]();}else{_0x6b19c9[_0x10b2('0x20')]();}})[_0x10b2('0x2c')](function(_0x38af78){logger[_0x10b2('0x1d')](_0x10b2('0xb'),_0x3137c4,JSON[_0x10b2('0x28')](_0x38af78));_0x6b19c9[_0x10b2('0xd')]();});})[_0x10b2('0x2c')](function(_0x4a146a){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x3137c4,_0x4a146a[_0x10b2('0x2d')]);_0x6b19c9[_0x10b2('0xd')]();});}}catch(_0x2d75e1){logger['error'](_0x10b2('0xb'),_0x3137c4,JSON[_0x10b2('0x28')](_0x2d75e1));_0x6b19c9['stop']();}};}; \ No newline at end of file +var _0x0077=['body','getMustacheRender','create','then','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','result','speech','providerName','dialogflow','providerResponse','Message','endConversation','message','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','phone','interaction','chat','upperFirst','account','created','isEmpty'];(function(_0x1c5b74,_0x40649c){var _0x3cb57b=function(_0x40994e){while(--_0x40994e){_0x1c5b74['push'](_0x1c5b74['shift']());}};_0x3cb57b(++_0x40649c);}(_0x0077,0x15d));var _0x7007=function(_0x4ef8de,_0x527106){_0x4ef8de=_0x4ef8de-0x0;var _0x2e4b36=_0x0077[_0x4ef8de];return _0x2e4b36;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require(_0x7007('0x0'));var md5=require(_0x7007('0x1'));var utils=require(_0x7007('0x2'));var logger=require(_0x7007('0x3'))(_0x7007('0x4'));var rpc={'chatMessage':require(_0x7007('0x5')),'openchannelMessage':require(_0x7007('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7007('0x7')),'faxMessage':require(_0x7007('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x7007('0x9')]=function(_0xca8a8f,_0x44ffe5){return function(_0x4b4591){try{if(!_[_0x7007('0xa')](this['interaction'][_0x7007('0xb')])){logger[_0x7007('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xca8a8f,_0x7007('0xd'));return _0x4b4591[_0x7007('0xe')]();}var _0x57e60b={'ContactId':this[_0x7007('0xf')]['id'],'sentAt':moment()[_0x7007('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7007('0x11')};if(this[_0x7007('0x12')]===_0x7007('0x13')||this[_0x7007('0x12')]==='whatsapp'){_0x57e60b[_0x7007('0x14')]=this[_0x7007('0x15')][_0x7007('0x14')];}var _0xd4e369=this['channel'];if(_0xd4e369===_0x7007('0x16')){_0x57e60b['ChatWebsiteId']=this['account']['id'];}else{_0x57e60b[_[_0x7007('0x17')](_0xd4e369)+'AccountId']=this[_0x7007('0x18')]['id'];}_0x57e60b[_[_0x7007('0x17')](_0xd4e369)+'InteractionId']=this[_0x7007('0x15')]['id'];if(this[_0x7007('0x15')][_0x7007('0x19')]){var _0x23f003=_0x44ffe5[0x2];if(!_[_0x7007('0x1a')](_0x23f003)){_0x57e60b[_0x7007('0x1b')]=utils[_0x7007('0x1c')](_0x23f003,this);return rpc[_0xd4e369+'Message'][_0x7007('0x1d')](_0x57e60b)[_0x7007('0x1e')](function(_0x1bda25){logger[_0x7007('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xca8a8f,_0x57e60b[_0x7007('0x1b')]);})[_0x7007('0x1f')](function(_0x240f84){logger[_0x7007('0x20')](_0x7007('0x21'),_0xca8a8f,JSON[_0x7007('0x22')](_0x240f84));})[_0x7007('0x23')](function(){logger['info'](_0x7007('0x24'),_0xca8a8f);_0x4b4591[_0x7007('0x25')]();});}else{logger[_0x7007('0xc')](_0x7007('0x26'),_0xca8a8f);_0x4b4591[_0x7007('0x25')]();}}else{var _0x13c220=this;var _0x3648b0=apiai(_0x44ffe5[0x0],{'language':_0x44ffe5[0x1]||'en'});return _0x3648b0['textRequest'](this['message'][_0x7007('0x1b')],{'sessionId':md5(this[_0x7007('0x15')]['id'])})[_0x7007('0x1e')](function(_0x8f035a){_0x13c220[_0x7007('0x1b')]['dialogflow']=_0x8f035a;_0x57e60b['body']=_0x8f035a[_0x7007('0x27')]['fulfillment'][_0x7007('0x28')];_0x57e60b[_0x7007('0x29')]=_0x7007('0x2a');_0x57e60b[_0x7007('0x2b')]=JSON[_0x7007('0x22')](_0x8f035a);return rpc[_0xd4e369+_0x7007('0x2c')][_0x7007('0x1d')](_0x57e60b)[_0x7007('0x1e')](function(_0x5735e8){logger[_0x7007('0xc')](_0x7007('0x21'),_0xca8a8f,_0x57e60b[_0x7007('0x1b')]);if(_0x8f035a[_0x7007('0x27')]['metadata'][_0x7007('0x2d')]){_0x4b4591['next']();}else{_0x4b4591[_0x7007('0x25')]();}})['catch'](function(_0x4847fc){logger[_0x7007('0x20')](_0x7007('0x21'),_0xca8a8f,JSON['stringify'](_0x4847fc));_0x4b4591[_0x7007('0xe')]();});})[_0x7007('0x1f')](function(_0x6a183e){logger['error']('[%s][DIALOGFLOW]\x20%s',_0xca8a8f,_0x6a183e[_0x7007('0x2e')]);_0x4b4591[_0x7007('0xe')]();});}}catch(_0x962839){logger[_0x7007('0x20')](_0x7007('0x21'),_0xca8a8f,JSON[_0x7007('0x22')](_0x962839));_0x4b4591[_0x7007('0x25')]();}};}; \ 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 d90524f..a28e5a1 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 _0xf100=['../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','body','error','consequence','interaction','UserId','info','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','detectIntent','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','intent','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','stringify','length','fulfillmentText','push','message','lodash','dialogflow','bluebird','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x236255,_0x14d612){var _0x43ac8f=function(_0x3e9472){while(--_0x3e9472){_0x236255['push'](_0x236255['shift']());}};_0x43ac8f(++_0x14d612);}(_0xf100,0x82));var _0x0f10=function(_0x6dc5f0,_0x43a476){_0x6dc5f0=_0x6dc5f0-0x0;var _0x5bd399=_0xf100[_0x6dc5f0];return _0x5bd399;};'use strict';var _=require(_0x0f10('0x0'));var dialogflow=require(_0x0f10('0x1'));var md5=require('md5');var moment=require('moment');var Promise=require(_0x0f10('0x2'));var logger=require('../../../../config/logger')(_0x0f10('0x3'));var utils=require(_0x0f10('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x0f10('0x5')),'mailMessage':require(_0x0f10('0x6')),'smsMessage':require(_0x0f10('0x7')),'faxMessage':require(_0x0f10('0x8')),'whatsappMessage':require(_0x0f10('0x9'))};function createMessage(_0x4907c6,_0x3c2c79,_0x3794b8,_0x2707a9){return new Promise(function(_0x29b602,_0x3dd5c6){var _0x443d4e=_[_0x0f10('0xa')](_0x3794b8);_0x443d4e['body']=_0x2707a9;return rpc[_0x3c2c79+_0x0f10('0xb')][_0x0f10('0xc')](_0x443d4e)[_0x0f10('0xd')](function(){logger['info'](_0x0f10('0xe'),_0x4907c6,_0x443d4e[_0x0f10('0xf')]);_0x29b602();})['catch'](function(_0x278578){logger[_0x0f10('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x4907c6,JSON['stringify'](_0x278578));_0x3dd5c6(_0x278578);});});}exports[_0x0f10('0x11')]=function(_0xd1aab0,_0x3aab58){return function(_0x278e3c){try{if(!_['isNil'](this[_0x0f10('0x12')][_0x0f10('0x13')])){logger[_0x0f10('0x14')](_0x0f10('0xe'),_0xd1aab0,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x278e3c[_0x0f10('0x15')]();}var _0x278500={'ContactId':this[_0x0f10('0x16')]['id'],'sentAt':moment()['format'](_0x0f10('0x17')),'direction':_0x0f10('0x18')};if(this['channel']===_0x0f10('0x19')||this[_0x0f10('0x1a')]===_0x0f10('0x1b')){_0x278500[_0x0f10('0x1c')]=this[_0x0f10('0x12')][_0x0f10('0x1c')];}var _0x32f864=this[_0x0f10('0x1a')];if(_0x32f864==='chat'){_0x278500[_0x0f10('0x1d')]=this['account']['id'];}else{_0x278500[_[_0x0f10('0x1e')](_0x32f864)+'AccountId']=this[_0x0f10('0x1f')]['id'];}_0x278500[_['upperFirst'](_0x32f864)+_0x0f10('0x20')]=this[_0x0f10('0x12')]['id'];if(this[_0x0f10('0x12')][_0x0f10('0x21')]){var _0x402471=_0x3aab58[0x4];if(!_[_0x0f10('0x22')](_0x402471)){_0x278500[_0x0f10('0xf')]=utils['getMustacheRender'](_0x402471,this);return rpc[_0x32f864+_0x0f10('0xb')]['create'](_0x278500)['then'](function(_0x1aeb1d){logger[_0x0f10('0x14')](_0x0f10('0xe'),_0xd1aab0,_0x278500[_0x0f10('0xf')]);})[_0x0f10('0x23')](function(_0x5528e8){logger[_0x0f10('0x10')](_0x0f10('0xe'),_0xd1aab0,JSON['stringify'](_0x5528e8));})[_0x0f10('0x24')](function(){logger[_0x0f10('0x14')](_0x0f10('0x25'),_0xd1aab0);_0x278e3c['stop']();});}else{logger[_0x0f10('0x14')](_0x0f10('0x26'),_0xd1aab0);_0x278e3c[_0x0f10('0x27')]();}}else{var _0x89c4a=this;var _0x13eeeb=_0x3aab58[0x2][_0x0f10('0x28')](/\\n/g,'\x0a');var _0x1ec399={'credentials':{'private_key':_0x13eeeb,'client_email':_0x3aab58[0x1]}};var _0x36779f=new dialogflow[(_0x0f10('0x29'))](_0x1ec399);var _0x550226=_0x36779f[_0x0f10('0x2a')](_0x3aab58[0x0],md5(_0x89c4a[_0x0f10('0x12')]['id']));var _0x2efb1d={'session':_0x550226,'queryInput':{'text':{'text':_0x89c4a['message'][_0x0f10('0xf')],'languageCode':_0x3aab58[0x3]||'en'}}};return _0x36779f[_0x0f10('0x2b')](_0x2efb1d)[_0x0f10('0xd')](function(_0x5aaab6){if(_0x5aaab6&&_0x5aaab6['length']){_0x89c4a[_0x0f10('0xf')][_0x0f10('0x2c')]=_0x5aaab6;var _0x4f8077=_0x5aaab6[0x0];var _0x3c88d0=_0x4f8077['queryResult'][_0x0f10('0x2d')]&&_0x4f8077[_0x0f10('0x2e')][_0x0f10('0x2d')][_0x0f10('0x2f')]?_0x4f8077[_0x0f10('0x2e')]['diagnosticInfo'][_0x0f10('0x2f')][_0x0f10('0x30')][_0x0f10('0x31')]:![];_0x89c4a[_0x0f10('0xf')][_0x0f10('0x32')]=_0x4f8077[_0x0f10('0x2e')][_0x0f10('0x33')];_0x89c4a[_0x0f10('0xf')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x4f8077['queryResult'][_0x0f10('0x34')];_0x89c4a['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x4f8077['queryResult'][_0x0f10('0x2d')]&&_0x4f8077[_0x0f10('0x2e')][_0x0f10('0x2d')][_0x0f10('0x2f')]?_0x4f8077[_0x0f10('0x2e')]['diagnosticInfo'][_0x0f10('0x2f')][_0x0f10('0x30')][_0x0f10('0x31')]:![];_0x89c4a[_0x0f10('0xf')][_0x0f10('0x35')]=_0x4f8077[_0x0f10('0x2e')]['intent'][_0x0f10('0x36')];_0x89c4a['body'][_0x0f10('0x37')]=_0x4f8077['queryResult']['intent']['displayName'];_0x89c4a[_0x0f10('0xf')][_0x0f10('0x38')]=_0x4f8077[_0x0f10('0x2e')][_0x0f10('0x39')]['isFallback'];_0x89c4a[_0x0f10('0xf')][_0x0f10('0x3a')]=_0x4f8077['queryResult']['languageCode'];_0x89c4a[_0x0f10('0xf')][_0x0f10('0x3b')]=_0x4f8077[_0x0f10('0x2e')]['queryText'];_0x89c4a['body'][_0x0f10('0x3c')]=_0x4f8077['queryResult'][_0x0f10('0x3d')];_0x278500[_0x0f10('0x3e')]='dialogflowV2';_0x278500[_0x0f10('0x3f')]=JSON[_0x0f10('0x40')](_0x5aaab6);var _0x5c5692=[];for(var _0x53ab32=0x0;_0x53ab32<_0x5aaab6[_0x0f10('0x41')];_0x53ab32++){var _0x2269d8=_0x5aaab6[_0x53ab32];if(_0x2269d8&&_0x2269d8[_0x0f10('0x2e')]&&_0x2269d8['queryResult'][_0x0f10('0x42')]){_0x5c5692[_0x0f10('0x43')](createMessage(_0xd1aab0,_0x32f864,_0x278500,_0x2269d8[_0x0f10('0x2e')][_0x0f10('0x42')]));}}return Promise['all'](_0x5c5692)[_0x0f10('0xd')](function(){if(_0x3c88d0){_0x278e3c[_0x0f10('0x15')]();}else{_0x278e3c[_0x0f10('0x27')]();}})[_0x0f10('0x23')](function(_0x692879){logger[_0x0f10('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0xd1aab0,JSON[_0x0f10('0x40')](_0x692879));_0x278e3c['next']();});}})['catch'](function(_0x51f3f5){logger[_0x0f10('0x10')](_0x0f10('0xe'),_0xd1aab0,_0x51f3f5[_0x0f10('0x44')]);_0x278e3c[_0x0f10('0x15')]();});}}catch(_0x240ba4){logger[_0x0f10('0x10')](_0x0f10('0xe'),_0xd1aab0,JSON['stringify'](_0x240ba4));_0x278e3c[_0x0f10('0x27')]();}};}; \ No newline at end of file +var _0x9be8=['dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length'];(function(_0x176949,_0x5db156){var _0xe9a2dc=function(_0x53e7d9){while(--_0x53e7d9){_0x176949['push'](_0x176949['shift']());}};_0xe9a2dc(++_0x5db156);}(_0x9be8,0xfb));var _0x89be=function(_0x180cd0,_0x386c6e){_0x180cd0=_0x180cd0-0x0;var _0x49fc32=_0x9be8[_0x180cd0];return _0x49fc32;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x89be('0x0'));var moment=require(_0x89be('0x1'));var Promise=require(_0x89be('0x2'));var logger=require(_0x89be('0x3'))(_0x89be('0x4'));var utils=require(_0x89be('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x89be('0x6')),'mailMessage':require(_0x89be('0x7')),'smsMessage':require(_0x89be('0x8')),'faxMessage':require(_0x89be('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x1d5d75,_0x4f150d,_0x4a9735,_0x404e5a){return new Promise(function(_0x121a4f,_0x291b9c){var _0x4f0d32=_[_0x89be('0xa')](_0x4a9735);_0x4f0d32[_0x89be('0xb')]=_0x404e5a;return rpc[_0x4f150d+_0x89be('0xc')][_0x89be('0xd')](_0x4f0d32)[_0x89be('0xe')](function(){logger['info'](_0x89be('0xf'),_0x1d5d75,_0x4f0d32['body']);_0x121a4f();})[_0x89be('0x10')](function(_0x63be83){logger[_0x89be('0x11')](_0x89be('0xf'),_0x1d5d75,JSON[_0x89be('0x12')](_0x63be83));_0x291b9c(_0x63be83);});});}exports[_0x89be('0x13')]=function(_0x326795,_0x2a13f7){return function(_0x580307){try{if(!_[_0x89be('0x14')](this[_0x89be('0x15')][_0x89be('0x16')])){logger[_0x89be('0x17')]('[%s][DIALOGFLOWV2]\x20%s',_0x326795,_0x89be('0x18'));return _0x580307[_0x89be('0x19')]();}var _0x144bba={'ContactId':this[_0x89be('0x1a')]['id'],'sentAt':moment()['format'](_0x89be('0x1b')),'direction':_0x89be('0x1c')};if(this[_0x89be('0x1d')]===_0x89be('0x1e')||this[_0x89be('0x1d')]==='whatsapp'){_0x144bba[_0x89be('0x1f')]=this[_0x89be('0x15')][_0x89be('0x1f')];}var _0x20707b=this[_0x89be('0x1d')];if(_0x20707b==='chat'){_0x144bba[_0x89be('0x20')]=this['account']['id'];}else{_0x144bba[_[_0x89be('0x21')](_0x20707b)+'AccountId']=this[_0x89be('0x22')]['id'];}_0x144bba[_[_0x89be('0x21')](_0x20707b)+_0x89be('0x23')]=this['interaction']['id'];if(this[_0x89be('0x15')][_0x89be('0x24')]){var _0x5089fc=_0x2a13f7[0x4];if(!_[_0x89be('0x25')](_0x5089fc)){_0x144bba['body']=utils[_0x89be('0x26')](_0x5089fc,this);return rpc[_0x20707b+_0x89be('0xc')][_0x89be('0xd')](_0x144bba)[_0x89be('0xe')](function(_0x3201bb){logger[_0x89be('0x17')](_0x89be('0xf'),_0x326795,_0x144bba[_0x89be('0xb')]);})[_0x89be('0x10')](function(_0x43e576){logger[_0x89be('0x11')](_0x89be('0xf'),_0x326795,JSON[_0x89be('0x12')](_0x43e576));})[_0x89be('0x27')](function(){logger[_0x89be('0x17')](_0x89be('0x28'),_0x326795);_0x580307[_0x89be('0x29')]();});}else{logger['info'](_0x89be('0x2a'),_0x326795);_0x580307[_0x89be('0x29')]();}}else{var _0x168752=this;var _0x322ac9=_0x2a13f7[0x2][_0x89be('0x2b')](/\\n/g,'\x0a');var _0x25c465={'credentials':{'private_key':_0x322ac9,'client_email':_0x2a13f7[0x1]}};var _0x21e822=new dialogflow[(_0x89be('0x2c'))](_0x25c465);var _0xfcc508=_0x21e822[_0x89be('0x2d')](_0x2a13f7[0x0],md5(_0x168752[_0x89be('0x15')]['id']));var _0x27105b={'session':_0xfcc508,'queryInput':{'text':{'text':_0x168752[_0x89be('0x2e')][_0x89be('0xb')],'languageCode':_0x2a13f7[0x3]||'en'}}};return _0x21e822[_0x89be('0x2f')](_0x27105b)[_0x89be('0xe')](function(_0x9c57c0){if(_0x9c57c0&&_0x9c57c0[_0x89be('0x30')]){_0x168752[_0x89be('0xb')][_0x89be('0x31')]=_0x9c57c0;var _0x1a764f=_0x9c57c0[0x0];var _0x1c5b60=_0x1a764f[_0x89be('0x32')][_0x89be('0x33')]&&_0x1a764f[_0x89be('0x32')][_0x89be('0x33')][_0x89be('0x34')]?_0x1a764f[_0x89be('0x32')][_0x89be('0x33')]['fields'][_0x89be('0x35')][_0x89be('0x36')]:![];_0x168752[_0x89be('0xb')][_0x89be('0x37')]=_0x1a764f[_0x89be('0x32')][_0x89be('0x38')];_0x168752['body'][_0x89be('0x39')]=_0x1a764f[_0x89be('0x32')][_0x89be('0x3a')];_0x168752[_0x89be('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x1a764f[_0x89be('0x32')][_0x89be('0x33')]&&_0x1a764f[_0x89be('0x32')]['diagnosticInfo'][_0x89be('0x34')]?_0x1a764f[_0x89be('0x32')][_0x89be('0x33')][_0x89be('0x34')]['end_conversation']['boolValue']:![];_0x168752[_0x89be('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0x1a764f['queryResult'][_0x89be('0x3b')][_0x89be('0x3c')];_0x168752[_0x89be('0xb')][_0x89be('0x3d')]=_0x1a764f['queryResult']['intent'][_0x89be('0x3e')];_0x168752[_0x89be('0xb')][_0x89be('0x3f')]=_0x1a764f['queryResult'][_0x89be('0x3b')][_0x89be('0x40')];_0x168752[_0x89be('0xb')][_0x89be('0x41')]=_0x1a764f[_0x89be('0x32')][_0x89be('0x42')];_0x168752[_0x89be('0xb')][_0x89be('0x43')]=_0x1a764f[_0x89be('0x32')][_0x89be('0x44')];_0x168752[_0x89be('0xb')][_0x89be('0x45')]=_0x1a764f['queryResult'][_0x89be('0x46')];_0x144bba[_0x89be('0x47')]=_0x89be('0x31');_0x144bba[_0x89be('0x48')]=JSON['stringify'](_0x9c57c0);var _0x578a5b=[];for(var _0x29c243=0x0;_0x29c243<_0x9c57c0[_0x89be('0x30')];_0x29c243++){var _0x4cf4ab=_0x9c57c0[_0x29c243];if(_0x4cf4ab&&_0x4cf4ab[_0x89be('0x32')]&&_0x4cf4ab[_0x89be('0x32')][_0x89be('0x49')]){_0x578a5b[_0x89be('0x4a')](createMessage(_0x326795,_0x20707b,_0x144bba,_0x4cf4ab['queryResult'][_0x89be('0x49')]));}}return Promise['all'](_0x578a5b)[_0x89be('0xe')](function(){if(_0x1c5b60){_0x580307['next']();}else{_0x580307[_0x89be('0x29')]();}})['catch'](function(_0x23fedb){logger['error'](_0x89be('0xf'),_0x326795,JSON[_0x89be('0x12')](_0x23fedb));_0x580307[_0x89be('0x19')]();});}})[_0x89be('0x10')](function(_0x465a42){logger[_0x89be('0x11')](_0x89be('0xf'),_0x326795,_0x465a42[_0x89be('0x2e')]);_0x580307['next']();});}}catch(_0x37ded5){logger[_0x89be('0x11')](_0x89be('0xf'),_0x326795,JSON[_0x89be('0x12')](_0x37ded5));_0x580307[_0x89be('0x29')]();}};}; \ 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 11daae1..e0332f8 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 _0xf47a=['stringify','validate','./utils','../../../../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','error','message','join','stop','condition','priorityTrue','priorityFalse','info','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','next','[%s][GOTOIF]\x20%s'];(function(_0x23fd01,_0x40491b){var _0x2e6a28=function(_0x123660){while(--_0x123660){_0x23fd01['push'](_0x23fd01['shift']());}};_0x2e6a28(++_0x40491b);}(_0xf47a,0xe1));var _0xaf47=function(_0x1cb7c3,_0x3758dd){_0x1cb7c3=_0x1cb7c3-0x0;var _0x3b87b5=_0xf47a[_0x1cb7c3];return _0x3b87b5;};'use strict';var schema=require(_0xaf47('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0xaf47('0x1'));var logger=require(_0xaf47('0x2'))(_0xaf47('0x3'));var gotoif=schema({'condition':{'type':_0xaf47('0x4'),'required':!![],'message':_0xaf47('0x5')},'priorityTrue':{'type':_0xaf47('0x6'),'message':_0xaf47('0x7')},'priorityFalse':{'type':'number','message':_0xaf47('0x8')}});exports[_0xaf47('0x9')]=function(_0x1098d3,_0x3415f9){return function(_0x334459){try{var _0x5a721b={'condition':htmlToText[_0xaf47('0xa')](utils[_0xaf47('0xb')](_0x3415f9[0x0],this),{'wordwrap':![]})[_0xaf47('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3415f9[0x1],'priorityFalse':_0x3415f9[0x2]};var _0x157e05=gotoif[_0xaf47('0x0')](_0x5a721b,{'typecast':!![]});if(_0x157e05[_0xaf47('0xd')]){logger[_0xaf47('0xe')]('[%s][GOTOIF]\x20%s',_0x1098d3,_['map'](_0x157e05,_0xaf47('0xf'))[_0xaf47('0x10')](',\x20'));_0x334459[_0xaf47('0x11')]();}else{try{var _0x127d1a=eval('('+_0x5a721b[_0xaf47('0x12')]+')');var _0x313017=_0x127d1a?_0x5a721b[_0xaf47('0x13')]:_0x5a721b[_0xaf47('0x14')];logger[_0xaf47('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1098d3,_0x5a721b['condition'],_0x127d1a,_0x313017||'next');if(_0x313017){var _0x249f3c=_[_0xaf47('0x16')](_0x334459[_0xaf47('0x17')](),{'p':_0x313017});if(_0x249f3c>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1098d3,_0x313017||'next',_0x249f3c);_0x334459['next'](_0x249f3c);}else{logger[_0xaf47('0x15')](_0xaf47('0x18'),_0x1098d3,_0x313017||_0xaf47('0x19'));_0x334459['stop']();}}else{_0x334459['next']();}}catch(_0x5794db){logger[_0xaf47('0xe')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x1098d3,_0x5794db[_0xaf47('0xf')]);_0x334459[_0xaf47('0x11')]();}}}catch(_0x1315ec){logger[_0xaf47('0xe')](_0xaf47('0x1a'),_0x1098d3,JSON[_0xaf47('0x1b')](_0x1315ec));_0x334459[_0xaf47('0x11')]();}};}; \ No newline at end of file +var _0x00d4=['consequence','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00d4,0x13c));var _0x400d=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x00d4[_0x87b0ff];return _0x3bc0b2;};'use strict';var schema=require(_0x400d('0x0'));var _=require(_0x400d('0x1'));var htmlToText=require(_0x400d('0x2'));var utils=require('./utils');var logger=require(_0x400d('0x3'))(_0x400d('0x4'));var gotoif=schema({'condition':{'type':_0x400d('0x5'),'required':!![],'message':_0x400d('0x6')},'priorityTrue':{'type':_0x400d('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x400d('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x400d('0x8')]=function(_0x38a1dd,_0x16f2ab){return function(_0x4351c4){try{var _0x337ddc={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x16f2ab[0x0],this),{'wordwrap':![]})[_0x400d('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x16f2ab[0x1],'priorityFalse':_0x16f2ab[0x2]};var _0x4e091c=gotoif['validate'](_0x337ddc,{'typecast':!![]});if(_0x4e091c[_0x400d('0xa')]){logger[_0x400d('0xb')](_0x400d('0xc'),_0x38a1dd,_[_0x400d('0xd')](_0x4e091c,_0x400d('0xe'))[_0x400d('0xf')](',\x20'));_0x4351c4[_0x400d('0x10')]();}else{try{var _0x5e2594=eval('('+_0x337ddc['condition']+')');var _0x2b03d1=_0x5e2594?_0x337ddc[_0x400d('0x11')]:_0x337ddc[_0x400d('0x12')];logger[_0x400d('0x13')](_0x400d('0x14'),_0x38a1dd,_0x337ddc[_0x400d('0x15')],_0x5e2594,_0x2b03d1||_0x400d('0x16'));if(_0x2b03d1){var _0x5a9acb=_[_0x400d('0x17')](_0x4351c4[_0x400d('0x18')](),{'p':_0x2b03d1});if(_0x5a9acb>=0x0){logger['info'](_0x400d('0x19'),_0x38a1dd,_0x2b03d1||_0x400d('0x16'),_0x5a9acb);_0x4351c4[_0x400d('0x16')](_0x5a9acb);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x38a1dd,_0x2b03d1||_0x400d('0x16'));_0x4351c4[_0x400d('0x10')]();}}else{_0x4351c4['next']();}}catch(_0x1d9dde){logger[_0x400d('0xb')](_0x400d('0x1a'),_0x38a1dd,_0x1d9dde[_0x400d('0xe')]);_0x4351c4[_0x400d('0x10')]();}}}catch(_0x331224){logger[_0x400d('0xb')](_0x400d('0xc'),_0x38a1dd,JSON['stringify'](_0x331224));_0x4351c4[_0x400d('0x10')]();}};}; \ 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 ec6a7b7..9b69ded 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 _0xbdc7=['routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','map','message','join','stop','info','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','error','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger'];(function(_0x442183,_0x5ec564){var _0x4b2e1e=function(_0x34c3ab){while(--_0x34c3ab){_0x442183['push'](_0x442183['shift']());}};_0x4b2e1e(++_0x5ec564);}(_0xbdc7,0x141));var _0x7bdc=function(_0x31b7d6,_0x15b416){_0x31b7d6=_0x31b7d6-0x0;var _0x17e79b=_0xbdc7[_0x31b7d6];return _0x17e79b;};'use strict';var schema=require(_0x7bdc('0x0'));var _=require(_0x7bdc('0x1'));var logger=require(_0x7bdc('0x2'))(_0x7bdc('0x3'));var gotop=schema({'priority':{'type':_0x7bdc('0x4'),'required':!![],'message':_0x7bdc('0x5')}});exports[_0x7bdc('0x6')]=function(_0x3487dc,_0x583cc3){return function(_0x5120c9){try{var _0x33c539={'priority':_0x583cc3[0x0]};var _0x3d9ab2=gotop[_0x7bdc('0x0')](_0x33c539,{'typecast':!![]});if(_0x3d9ab2['length']){logger['error']('[%s][GOTOP]\x20%s',_0x3487dc,_[_0x7bdc('0x7')](_0x3d9ab2,_0x7bdc('0x8'))[_0x7bdc('0x9')](',\x20'));_0x5120c9[_0x7bdc('0xa')]();}else{logger[_0x7bdc('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x3487dc,_0x33c539[_0x7bdc('0xc')]);if(_0x33c539[_0x7bdc('0xc')]){var _0x3f551e=_['findIndex'](_0x5120c9['rules'](),{'p':_0x33c539[_0x7bdc('0xc')]});if(_0x3f551e>=0x0){logger['info'](_0x7bdc('0xd'),_0x3487dc,_0x33c539['priority']||_0x7bdc('0xe'),_0x3f551e);_0x5120c9['next'](_0x3f551e);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x3487dc,_0x33c539[_0x7bdc('0xc')]||_0x7bdc('0xe'));_0x5120c9['stop']();}}else{_0x5120c9['next']();}}}catch(_0x7d2410){logger[_0x7bdc('0xf')](_0x7bdc('0x10'),_0x3487dc,JSON[_0x7bdc('0x11')](_0x7d2410));_0x5120c9[_0x7bdc('0xa')]();}};}; \ No newline at end of file +var _0x8366=['info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','validate','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','join','stop'];(function(_0x2009ec,_0x15fc89){var _0xf983df=function(_0x1540fd){while(--_0x1540fd){_0x2009ec['push'](_0x2009ec['shift']());}};_0xf983df(++_0x15fc89);}(_0x8366,0x86));var _0x6836=function(_0x1589c0,_0x3ff99f){_0x1589c0=_0x1589c0-0x0;var _0xc03c00=_0x8366[_0x1589c0];return _0xc03c00;};'use strict';var schema=require(_0x6836('0x0'));var _=require('lodash');var logger=require(_0x6836('0x1'))(_0x6836('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x6836('0x3')}});exports['consequence']=function(_0x323d95,_0x33faba){return function(_0x326404){try{var _0x5c3b2c={'priority':_0x33faba[0x0]};var _0x266a3e=gotop['validate'](_0x5c3b2c,{'typecast':!![]});if(_0x266a3e[_0x6836('0x4')]){logger[_0x6836('0x5')](_0x6836('0x6'),_0x323d95,_[_0x6836('0x7')](_0x266a3e,'message')[_0x6836('0x8')](',\x20'));_0x326404[_0x6836('0x9')]();}else{logger[_0x6836('0xa')](_0x6836('0xb'),_0x323d95,_0x5c3b2c[_0x6836('0xc')]);if(_0x5c3b2c[_0x6836('0xc')]){var _0x5057ee=_['findIndex'](_0x326404[_0x6836('0xd')](),{'p':_0x5c3b2c[_0x6836('0xc')]});if(_0x5057ee>=0x0){logger[_0x6836('0xa')](_0x6836('0xe'),_0x323d95,_0x5c3b2c[_0x6836('0xc')]||_0x6836('0xf'),_0x5057ee);_0x326404[_0x6836('0xf')](_0x5057ee);}else{logger[_0x6836('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x323d95,_0x5c3b2c['priority']||_0x6836('0xf'));_0x326404[_0x6836('0x9')]();}}else{_0x326404[_0x6836('0xf')]();}}}catch(_0x890e2e){logger['error'](_0x6836('0x6'),_0x323d95,JSON['stringify'](_0x890e2e));_0x326404[_0x6836('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 602e4cc..f56d247 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 _0x624d=['chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','then','info','body','next','catch','[%s][MESSAGE]\x20%s','stringify','error','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x624d,0x1ed));var _0xd624=function(_0x461886,_0x4fc171){_0x461886=_0x461886-0x0;var _0x295e0a=_0x624d[_0x461886];return _0x295e0a;};'use strict';var _=require(_0xd624('0x0'));var utils=require(_0xd624('0x1'));var logger=require(_0xd624('0x2'))(_0xd624('0x3'));var rpc={'chatMessage':require(_0xd624('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd624('0x5')),'whatsappMessage':require(_0xd624('0x6'))};exports[_0xd624('0x7')]=function(_0x954c4b,_0x4765c2){return function(_0x229e65){try{var _0x2d8b1e={'body':utils[_0xd624('0x8')](_0x4765c2[0x0],this),'ContactId':this[_0xd624('0x9')]['id']};if(this[_0xd624('0xa')]===_0xd624('0xb')){_0x2d8b1e[_0xd624('0xc')]=this[_0xd624('0xd')]['id'];}else{_0x2d8b1e[_[_0xd624('0xe')](this[_0xd624('0xa')])+_0xd624('0xf')]=this['account']['id'];}_0x2d8b1e[_['upperFirst'](this[_0xd624('0xa')])+_0xd624('0x10')]=this[_0xd624('0x11')]['id'];if(rpc[this[_0xd624('0xa')]+_0xd624('0x12')]){return rpc[this[_0xd624('0xa')]+_0xd624('0x12')]['create'](_0x2d8b1e)[_0xd624('0x13')](function(_0x4fdce1){logger[_0xd624('0x14')]('[%s][MESSAGE]\x20%s',_0x954c4b,_0x2d8b1e[_0xd624('0x15')]);_0x229e65[_0xd624('0x16')]();})[_0xd624('0x17')](function(_0xdb05f3){logger['error'](_0xd624('0x18'),_0x954c4b,JSON[_0xd624('0x19')](_0xdb05f3));_0x229e65['stop']();});}}catch(_0xbbd253){logger[_0xd624('0x1a')](_0xd624('0x18'),_0x954c4b,JSON[_0xd624('0x19')](_0xbbd253));_0x229e65[_0xd624('0x1b')]();}};}; \ No newline at end of file +var _0x5cff=['routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','./utils','../../../../config/logger'];(function(_0x58faf1,_0x50a8e9){var _0x18323d=function(_0x71014c){while(--_0x71014c){_0x58faf1['push'](_0x58faf1['shift']());}};_0x18323d(++_0x50a8e9);}(_0x5cff,0x1a1));var _0xf5cf=function(_0x110ce3,_0xd22d55){_0x110ce3=_0x110ce3-0x0;var _0x17e26e=_0x5cff[_0x110ce3];return _0x17e26e;};'use strict';var _=require(_0xf5cf('0x0'));var utils=require(_0xf5cf('0x1'));var logger=require(_0xf5cf('0x2'))(_0xf5cf('0x3'));var rpc={'chatMessage':require(_0xf5cf('0x4')),'openchannelMessage':require(_0xf5cf('0x5')),'mailMessage':require(_0xf5cf('0x6')),'smsMessage':require(_0xf5cf('0x7')),'faxMessage':require(_0xf5cf('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xf5cf('0x9')]=function(_0x2cc64c,_0x4681fa){return function(_0x15714b){try{var _0x2e5b3a={'body':utils[_0xf5cf('0xa')](_0x4681fa[0x0],this),'ContactId':this[_0xf5cf('0xb')]['id']};if(this[_0xf5cf('0xc')]===_0xf5cf('0xd')){_0x2e5b3a[_0xf5cf('0xe')]=this[_0xf5cf('0xf')]['id'];}else{_0x2e5b3a[_[_0xf5cf('0x10')](this[_0xf5cf('0xc')])+'AccountId']=this[_0xf5cf('0xf')]['id'];}_0x2e5b3a[_[_0xf5cf('0x10')](this[_0xf5cf('0xc')])+'InteractionId']=this[_0xf5cf('0x11')]['id'];if(rpc[this[_0xf5cf('0xc')]+_0xf5cf('0x12')]){return rpc[this['channel']+_0xf5cf('0x12')][_0xf5cf('0x13')](_0x2e5b3a)[_0xf5cf('0x14')](function(_0x504954){logger[_0xf5cf('0x15')](_0xf5cf('0x16'),_0x2cc64c,_0x2e5b3a[_0xf5cf('0x17')]);_0x15714b[_0xf5cf('0x18')]();})['catch'](function(_0x20f59b){logger[_0xf5cf('0x19')](_0xf5cf('0x16'),_0x2cc64c,JSON[_0xf5cf('0x1a')](_0x20f59b));_0x15714b[_0xf5cf('0x1b')]();});}}catch(_0x4cd5a5){logger['error'](_0xf5cf('0x16'),_0x2cc64c,JSON[_0xf5cf('0x1a')](_0x4cd5a5));_0x15714b[_0xf5cf('0x1b')]();}};}; \ 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 b19db82..7197d24 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 _0x4b36=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','./utils','../../../../config/logger','routing','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b36,0x1d9));var _0x64b3=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x4b36[_0x2112d4];return _0x434972;};'use strict';var utils=require(_0x64b3('0x0'));var logger=require(_0x64b3('0x1'))(_0x64b3('0x2'));exports['consequence']=function(_0xbbb497,_0x3b8521){return function(_0x58a3f4){try{logger[_0x64b3('0x3')](_0x64b3('0x4'),_0xbbb497,utils[_0x64b3('0x5')](_0x3b8521[0x0],this));_0x58a3f4[_0x64b3('0x6')]();}catch(_0x527cff){logger[_0x64b3('0x7')](_0x64b3('0x4'),_0xbbb497,JSON['stringify'](_0x527cff));_0x58a3f4[_0x64b3('0x8')]();}};}; \ No newline at end of file +var _0x107a=['next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x4fb9ed,_0x187ea0){var _0x263645=function(_0x11c604){while(--_0x11c604){_0x4fb9ed['push'](_0x4fb9ed['shift']());}};_0x263645(++_0x187ea0);}(_0x107a,0x1dd));var _0xa107=function(_0x8a8c6a,_0x1c4fdd){_0x8a8c6a=_0x8a8c6a-0x0;var _0x3a869d=_0x107a[_0x8a8c6a];return _0x3a869d;};'use strict';var utils=require(_0xa107('0x0'));var logger=require(_0xa107('0x1'))(_0xa107('0x2'));exports[_0xa107('0x3')]=function(_0x4f4e32,_0x541236){return function(_0x5edc4e){try{logger[_0xa107('0x4')](_0xa107('0x5'),_0x4f4e32,utils[_0xa107('0x6')](_0x541236[0x0],this));_0x5edc4e[_0xa107('0x7')]();}catch(_0x1649f0){logger[_0xa107('0x8')]('[%s][NOOP]\x20%s',_0x4f4e32,JSON[_0xa107('0x9')](_0x1649f0));_0x5edc4e[_0xa107('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index d36687a..8e4dc78 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 _0x7217=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId'];(function(_0x174c1c,_0x4fe986){var _0x431d4f=function(_0x7e1511){while(--_0x7e1511){_0x174c1c['push'](_0x174c1c['shift']());}};_0x431d4f(++_0x4fe986);}(_0x7217,0x19e));var _0x7721=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7217[_0x40ac5e];return _0x2839d6;};'use strict';var schema=require(_0x7721('0x0'));var _=require('lodash');var util=require(_0x7721('0x1'));var seqqueue=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7721('0x6'));config[_0x7721('0x7')]=_[_0x7721('0x8')](config[_0x7721('0x7')],{'host':_0x7721('0x9'),'port':0x18eb});var io=require(_0x7721('0xa'))(new Redis(config[_0x7721('0x7')]));var attributes=['id',_0x7721('0xb'),_0x7721('0xc'),_0x7721('0xd'),_0x7721('0xe'),_0x7721('0xf')];function emit(_0xfa8835,_0x138740,_0x2c3986){io['to'](_0xfa8835)['emit'](_0x138740,_0x2c3986);}function emitChannelQueueInteraction(_0x461d1a,_0x29bc8f,_0x8729a6,_0xf78099,_0xa8977c,_0x409b37,_0x1e7fd7,_0x27b36b){var _0x55b4ca=_[_0x7721('0x10')](_0x8729a6);_0x55b4ca[_0x7721('0xb')]=_0x27b36b;_0x55b4ca['queue']=_0x29bc8f;_0x55b4ca[_0x7721('0xc')]=_0xf78099;_0x55b4ca['id']=_0xa8977c;if(_0x409b37){_0x1e7fd7[util[_0x7721('0x11')](_0x7721('0x12'),_0x461d1a)][_0xa8977c]=_[_0x7721('0x13')](_0x55b4ca,attributes);}else{delete _0x1e7fd7[util['format'](_0x7721('0x12'),_0x461d1a)][_0xa8977c];}emit(util[_0x7721('0x11')]('%s:queue:%s',_0x461d1a,_0x29bc8f),util['format']('%s_queue_waiting_interaction:%s',_0x461d1a,_0x409b37?_0x7721('0x14'):_0x7721('0x15')),_[_0x7721('0x13')](_0x55b4ca,attributes));}var rpc={'openchannelQueueReport':require(_0x7721('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7721('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7721('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7721('0x19'),'required':!![],'message':_0x7721('0x1a')},'timeout':{'type':_0x7721('0x1b'),'message':_0x7721('0x1c')}});function startRouting(_0x2286e5,_0x40af90,_0x402820,_0x413263){if(_0x2286e5&&_0x40af90&&_0x402820){_0x40af90[_0x7721('0x1d')]+=0x1;var _0xaeccc4={'uniqueid':_0x2286e5,'from':_0x402820['body']?_0x402820[_0x7721('0x1e')][_0x7721('0xe')]:'','joinAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'ContactId':_0x402820['contact']?_0x402820[_0x7721('0x20')]['id']:null,'ListId':_0x402820['list']?_0x402820[_0x7721('0x21')]['id']:null};_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x24')]=_0x40af90['id']||null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x25')]=_0x402820['interaction']?_0x402820[_0x7721('0x26')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x27')]=_0x402820[_0x7721('0x28')]?_0x402820[_0x7721('0x28')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+(_0x402820[_0x7721('0x23')]!=='chat'?_0x7721('0x29'):'WebsiteId')]=_0x402820['account']?_0x402820[_0x7721('0xc')]['id']:null;logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x2b'),_0x2286e5,_0x40af90[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x402820[_0x7721('0x23')],_0x40af90[_0x7721('0x2c')],_0xaeccc4,_0x402820[_0x7721('0xc')]['name'],_0x402820[_0x7721('0x28')]['id'],!![],_0x413263,_0x40af90['id']);if(rpc[_0x402820[_0x7721('0x23')]+'QueueReport']){return rpc[_0x402820['channel']+_0x7721('0x2d')][_0x7721('0x2e')](_0xaeccc4)['catch'](function(_0x46f772){logger[_0x7721('0x2f')](_0x7721('0x30'));});}}}function stopRouting(_0x58d54b,_0x3d9a32,_0x1ff31b,_0x1492d4){if(_0x58d54b&&_0x3d9a32){_0x3d9a32[_0x7721('0x1d')]-=0x1;var _0xc0f3c4={'leaveAt':moment()['format'](_0x7721('0x1f')),'acceptAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'reason':'accepted'};logger[_0x7721('0x2a')](util[_0x7721('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x58d54b,_0x3d9a32[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x1ff31b['channel'],_0x3d9a32[_0x7721('0x2c')],_0x1ff31b[_0x7721('0x1e')],_0x1ff31b[_0x7721('0xc')][_0x7721('0x2c')],_0x1ff31b[_0x7721('0x28')]['id'],![],_0x1492d4,_0x3d9a32['id']);if(rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')]){return rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')][_0x7721('0x31')](_0x58d54b,_0xc0f3c4)[_0x7721('0x32')](function(_0x5c806d){logger[_0x7721('0x2f')]('update\x20queue\x20report');});}}}function endRouting(_0x212384,_0x35614c,_0x7942f7,_0x1d03de){if(_0x212384&&_0x35614c){_0x35614c[_0x7721('0x1d')]-=0x1;var _0x378ba5={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7721('0x33')};logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x34'),_0x212384,_0x35614c['name']));emitChannelQueueInteraction(_0x7942f7[_0x7721('0x23')],_0x35614c['name'],_0x7942f7[_0x7721('0x1e')],_0x7942f7[_0x7721('0xc')]['name'],_0x7942f7[_0x7721('0x28')]['id'],![],_0x1d03de);if(rpc[_0x7942f7[_0x7721('0x23')]+'QueueReport']){return rpc[_0x7942f7['channel']+_0x7721('0x2d')][_0x7721('0x31')](_0x212384,_0x378ba5)[_0x7721('0x32')](function(_0x15e34d){logger['error'](_0x7721('0x35'));});}}}function handleFindQueue(_0x120de9){return function(_0x40ce8c){return _0x40ce8c[_0x7721('0x2c')][_0x7721('0x36')]()===_0x120de9['toLowerCase']();};}exports[_0x7721('0x37')]=function(_0x4a2c28,_0xaa3216,_0x4a5b59,_0x2333b8){return function(_0x15fa2c){try{var _0x231dad={'name':_0xaa3216[0x0],'timeout':_0xaa3216[0x1]};var _0x49e0c5=queue[_0x7721('0x0')](_0x231dad,{'typecast':!![]});if(_0x49e0c5[_0x7721('0x38')]){logger[_0x7721('0x2f')]('[%s][QUEUE]\x20%s',_0x4a2c28,_[_0x7721('0x39')](_0x49e0c5,_0x7721('0x28'))[_0x7721('0x3a')](',\x20'));_0x15fa2c[_0x7721('0x3b')]();}else{var _0x135dbc=_[_0x7721('0x3c')](_0x4a5b59[_0x2333b8[_0x7721('0x23')]+'Queues'],handleFindQueue(_0x231dad['name']));if(_0x135dbc){startRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);var _0x1ac3af=(_0x135dbc[_0x7721('0x33')]||0xa)*0x3e8;var _0x421aae=(_0x231dad[_0x7721('0x33')]||0x14)*0x3e8;var _0x335145,_0x15181b;if(_0x1ac3af>_0x421aae){_0x421aae=_0x1ac3af;}var _0x1d2ea5=seqqueue[_0x7721('0x3d')](_0x1ac3af);_0x1d2ea5['id']=_0x4a2c28;_0x1d2ea5[_0x7721('0x3e')]=_0x1ac3af;_0x1d2ea5[_0x7721('0x3f')]=_0x421aae;_0x1d2ea5['channel']=_0x2333b8['channel'];_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on'](_0x7721('0x41'),function(){logger[_0x7721('0x2a')](_0x7721('0x42'),_0x4a2c28);stopRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x335145=undefined;_0x1d2ea5['close'](!![]);if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59[_0x7721('0x40')][_0x4a2c28];}_0x15fa2c['stop']();});_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on']('complete',function(){if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59['rules'][_0x4a2c28];}});_0x335145=setTimeout(function(){logger[_0x7721('0x2a')](_0x7721('0x43'),_0x4a2c28);endRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x1d2ea5[_0x7721('0x44')](!![]);_0x15fa2c['next']();},_0x421aae);switch(_0x135dbc[_0x7721('0x45')]){case _0x7721('0x46'):strategy['rrmemory'](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);break;default:strategy[_0x7721('0x47')](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);}}else{logger[_0x7721('0x2f')](_0x7721('0x48'),_0x4a2c28,_0x231dad['name']);_0x15fa2c[_0x7721('0x3b')]();}}}catch(_0x5a32b6){console[_0x7721('0x49')](_0x5a32b6);logger[_0x7721('0x2f')](_0x7721('0x4a'),_0x4a2c28,_0x5a32b6[_0x7721('0x4b')]);_0x15fa2c[_0x7721('0x3b')]();}};}; \ No newline at end of file +var _0xedd9=['[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','close','rules','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','info','name','message','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted'];(function(_0x4a6368,_0x3bd1ea){var _0x68050e=function(_0xf40bf0){while(--_0xf40bf0){_0x4a6368['push'](_0x4a6368['shift']());}};_0x68050e(++_0x3bd1ea);}(_0xedd9,0xfc));var _0x9edd=function(_0x1d94e7,_0x850770){_0x1d94e7=_0x1d94e7-0x0;var _0x28ff76=_0xedd9[_0x1d94e7];return _0x28ff76;};'use strict';var schema=require('validate');var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var seqqueue=require(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var Redis=require(_0x9edd('0x4'));var config=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))(_0x9edd('0x7'));var strategy=require('./strategy');config[_0x9edd('0x8')]=_[_0x9edd('0x9')](config[_0x9edd('0x8')],{'host':_0x9edd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0x8')]));var attributes=['id','queue_id',_0x9edd('0xb'),_0x9edd('0xc'),_0x9edd('0xd'),_0x9edd('0xe')];function emit(_0x49d5e3,_0x494a24,_0x5d2f90){io['to'](_0x49d5e3)[_0x9edd('0xf')](_0x494a24,_0x5d2f90);}function emitChannelQueueInteraction(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00,_0x30c0d7,_0x1b73d1,_0x25e64c){var _0xfd544a=_[_0x9edd('0x10')](_0xbf9da6);_0xfd544a[_0x9edd('0x11')]=_0x25e64c;_0xfd544a[_0x9edd('0xc')]=_0x523026;_0xfd544a[_0x9edd('0xb')]=_0x13dc4f;_0xfd544a['id']=_0x5b6c00;if(_0x30c0d7){_0x1b73d1[util['format'](_0x9edd('0x12'),_0x138767)][_0x5b6c00]=_[_0x9edd('0x13')](_0xfd544a,attributes);}else{delete _0x1b73d1[util[_0x9edd('0x14')](_0x9edd('0x12'),_0x138767)][_0x5b6c00];}emit(util[_0x9edd('0x14')](_0x9edd('0x15'),_0x138767,_0x523026),util[_0x9edd('0x14')](_0x9edd('0x16'),_0x138767,_0x30c0d7?'save':_0x9edd('0x17')),_[_0x9edd('0x13')](_0xfd544a,attributes));}var rpc={'openchannelQueueReport':require(_0x9edd('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x9edd('0x19')),'smsQueueReport':require(_0x9edd('0x1a')),'faxQueueReport':require(_0x9edd('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x9edd('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9edd('0x1d'),'message':_0x9edd('0x1e')}});function startRouting(_0x4bdb88,_0x498977,_0x45c3ab,_0x50338f){if(_0x4bdb88&&_0x498977&&_0x45c3ab){_0x498977[_0x9edd('0x1f')]+=0x1;var _0x54a03f={'uniqueid':_0x4bdb88,'from':_0x45c3ab['body']?_0x45c3ab[_0x9edd('0x20')][_0x9edd('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45c3ab[_0x9edd('0x21')]?_0x45c3ab[_0x9edd('0x21')]['id']:null,'ListId':_0x45c3ab[_0x9edd('0x22')]?_0x45c3ab['list']['id']:null};_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x25')]=_0x498977['id']||null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+'InteractionId']=_0x45c3ab[_0x9edd('0x26')]?_0x45c3ab[_0x9edd('0x26')]['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x27')]=_0x45c3ab['message']?_0x45c3ab['message']['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+(_0x45c3ab[_0x9edd('0x24')]!==_0x9edd('0x28')?_0x9edd('0x29'):'WebsiteId')]=_0x45c3ab['account']?_0x45c3ab[_0x9edd('0xb')]['id']:null;logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4bdb88,_0x498977[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x45c3ab[_0x9edd('0x24')],_0x498977[_0x9edd('0x2b')],_0x54a03f,_0x45c3ab[_0x9edd('0xb')]['name'],_0x45c3ab[_0x9edd('0x2c')]['id'],!![],_0x50338f,_0x498977['id']);if(rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')][_0x9edd('0x2e')](_0x54a03f)[_0x9edd('0x2f')](function(_0x1fba7b){logger[_0x9edd('0x30')](_0x9edd('0x31'));});}}}function stopRouting(_0x4fd03f,_0x138002,_0x6907a5,_0xa55906){if(_0x4fd03f&&_0x138002){_0x138002[_0x9edd('0x1f')]-=0x1;var _0x5af178={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'acceptAt':moment()[_0x9edd('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9edd('0x33')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')](_0x9edd('0x34'),_0x4fd03f,_0x138002[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x6907a5[_0x9edd('0x24')],_0x138002[_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x20')],_0x6907a5[_0x9edd('0xb')][_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x2c')]['id'],![],_0xa55906,_0x138002['id']);if(rpc[_0x6907a5[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x6907a5[_0x9edd('0x24')]+'QueueReport'][_0x9edd('0x35')](_0x4fd03f,_0x5af178)['catch'](function(_0x968303){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function endRouting(_0x434d26,_0x16770e,_0x4fa5ab,_0x6de835){if(_0x434d26&&_0x16770e){_0x16770e[_0x9edd('0x1f')]-=0x1;var _0x2b3469={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'exitAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'reason':_0x9edd('0x37')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x434d26,_0x16770e[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x4fa5ab['channel'],_0x16770e[_0x9edd('0x2b')],_0x4fa5ab['body'],_0x4fa5ab[_0x9edd('0xb')][_0x9edd('0x2b')],_0x4fa5ab[_0x9edd('0x2c')]['id'],![],_0x6de835);if(rpc[_0x4fa5ab['channel']+_0x9edd('0x2d')]){return rpc[_0x4fa5ab[_0x9edd('0x24')]+_0x9edd('0x2d')]['update'](_0x434d26,_0x2b3469)[_0x9edd('0x2f')](function(_0x51ad91){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function handleFindQueue(_0x50be2c){return function(_0x315f52){return _0x315f52[_0x9edd('0x2b')][_0x9edd('0x38')]()===_0x50be2c[_0x9edd('0x38')]();};}exports['consequence']=function(_0x449f01,_0x5bbdf8,_0x2bdb3f,_0xc1e657){return function(_0x587d74){try{var _0x318757={'name':_0x5bbdf8[0x0],'timeout':_0x5bbdf8[0x1]};var _0x49a128=queue['validate'](_0x318757,{'typecast':!![]});if(_0x49a128[_0x9edd('0x39')]){logger[_0x9edd('0x30')](_0x9edd('0x3a'),_0x449f01,_[_0x9edd('0x3b')](_0x49a128,_0x9edd('0x2c'))[_0x9edd('0x3c')](',\x20'));_0x587d74[_0x9edd('0x3d')]();}else{var _0x75efbe=_[_0x9edd('0x3e')](_0x2bdb3f[_0xc1e657[_0x9edd('0x24')]+_0x9edd('0x3f')],handleFindQueue(_0x318757[_0x9edd('0x2b')]));if(_0x75efbe){startRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);var _0x3d5eba=(_0x75efbe[_0x9edd('0x37')]||0xa)*0x3e8;var _0x46e9f4=(_0x318757['timeout']||0x14)*0x3e8;var _0x13197d,_0x2570e3;if(_0x3d5eba>_0x46e9f4){_0x46e9f4=_0x3d5eba;}var _0x2231c1=seqqueue[_0x9edd('0x40')](_0x3d5eba);_0x2231c1['id']=_0x449f01;_0x2231c1[_0x9edd('0x41')]=_0x3d5eba;_0x2231c1[_0x9edd('0x42')]=_0x46e9f4;_0x2231c1[_0x9edd('0x24')]=_0xc1e657['channel'];_0x2bdb3f['rules'][_0x449f01]['on']('end',function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x449f01);stopRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x13197d=undefined;_0x2231c1[_0x9edd('0x43')](!![]);if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}_0x587d74[_0x9edd('0x3d')]();});_0x2bdb3f[_0x9edd('0x44')][_0x449f01]['on']('complete',function(){if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}});_0x13197d=setTimeout(function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x449f01);endRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x2231c1[_0x9edd('0x43')](!![]);_0x587d74[_0x9edd('0x45')]();},_0x46e9f4);switch(_0x75efbe[_0x9edd('0x46')]){case _0x9edd('0x47'):strategy[_0x9edd('0x47')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);break;default:strategy[_0x9edd('0x48')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);}}else{logger['error'](_0x9edd('0x49'),_0x449f01,_0x318757[_0x9edd('0x2b')]);_0x587d74['stop']();}}}catch(_0xb93816){console[_0x9edd('0x4a')](_0xb93816);logger['error'](_0x9edd('0x3a'),_0x449f01,_0xb93816[_0x9edd('0x4b')]);_0x587d74[_0x9edd('0x3d')]();}};}; \ 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 c6598af..cec9a47 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 _0xa218=['[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','agents','busy','showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','writeLog','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','info'];(function(_0xaf1eac,_0xbcab4d){var _0x404215=function(_0x31d3b1){while(--_0x31d3b1){_0xaf1eac['push'](_0xaf1eac['shift']());}};_0x404215(++_0xbcab4d);}(_0xa218,0x17b));var _0x8a21=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xa218[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x8a21('0x0'));var uuid=require(_0x8a21('0x1'));var util=require(_0x8a21('0x2'));var logger=require(_0x8a21('0x3'))(_0x8a21('0x4'));var Agent=function(_0x4a6dd6,_0x3e0dec,_0x4fa703,_0x562826){this[_0x8a21('0x5')]=uuid['v4']();this[_0x8a21('0x6')]=_0x4a6dd6;this[_0x8a21('0x7')]=_0x3e0dec;this[_0x8a21('0x8')]=_0x4fa703;this['routing']=_0x562826;this[_0x8a21('0x6')][_0x8a21('0x9')](this[_0x8a21('0xa')][_0x8a21('0xb')](this),this[_0x8a21('0xc')][_0x8a21('0xb')](this));this[_0x8a21('0x6')]['on']('timeout',this[_0x8a21('0xc')][_0x8a21('0xb')](this));this[_0x8a21('0x6')]['on'](_0x8a21('0xd'),this[_0x8a21('0xe')][_0x8a21('0xb')](this));};Agent['prototype'][_0x8a21('0x9')]=function(){this[_0x8a21('0x6')][_0x8a21('0x9')](this['handleRun'][_0x8a21('0xb')](this),this[_0x8a21('0xc')]['bind'](this));};Agent[_0x8a21('0xf')][_0x8a21('0xe')]=function(){this[_0x8a21('0xc')](!![]);};Agent[_0x8a21('0xf')]['handleRun']=function(_0x36524a){logger[_0x8a21('0x10')](_0x8a21('0x11'),this[_0x8a21('0x6')]['id'],this[_0x8a21('0x7')]['id']);if(_[_0x8a21('0x12')](this[_0x8a21('0x8')]['agents'][this[_0x8a21('0x7')]['id']])){logger[_0x8a21('0x10')](_0x8a21('0x13'),this[_0x8a21('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x8a21('0x9')][_0x8a21('0xb')](this),0x3e8);}else{if(this[_0x8a21('0x4')][_0x8a21('0x14')]||util[_0x8a21('0x15')](this[_0x8a21('0x6')]['id'],this[_0x8a21('0x8')]['agents'][this[_0x8a21('0x7')]['id']],this[_0x8a21('0x6')][_0x8a21('0x16')],![])){this[_0x8a21('0x8')][_0x8a21('0x17')][this[_0x8a21('0x7')]['id']][_0x8a21('0x18')]=!![];this[_0x8a21('0x8')][_0x8a21('0x17')][this[_0x8a21('0x7')]['id']]['busyQueue']=undefined;util[_0x8a21('0x19')](this[_0x8a21('0x5')],this[_0x8a21('0x6')]['id'],this[_0x8a21('0x8')]['agents'][this[_0x8a21('0x7')]['id']],null,this['routing']);util['writeLog'](this['squeue']['id'],this[_0x8a21('0x8')][_0x8a21('0x17')][this['agent']['id']],_0x8a21('0x1a')+(this[_0x8a21('0x4')][_0x8a21('0x14')]?':FORCED':''));}else{logger[_0x8a21('0x10')](_0x8a21('0x1b'),this[_0x8a21('0x6')]['id'],this[_0x8a21('0x7')]['id']);setTimeout(this[_0x8a21('0x9')][_0x8a21('0xb')](this),0x3e8);}}};Agent[_0x8a21('0xf')][_0x8a21('0xc')]=function(_0x1e1267){if(_[_0x8a21('0x12')](this['realtime'][_0x8a21('0x17')][this[_0x8a21('0x7')]['id']])){return logger[_0x8a21('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8a21('0x6')]['id'],this[_0x8a21('0x7')]['id']);}else{logger[_0x8a21('0x10')](_0x8a21('0x1c'),this['squeue']['id'],this[_0x8a21('0x7')]['id']);util['hideNotification'](this[_0x8a21('0x5')],this[_0x8a21('0x6')]['id'],this[_0x8a21('0x8')]['agents'][this[_0x8a21('0x7')]['id']],null,this[_0x8a21('0x4')]);this['realtime']['agents'][this[_0x8a21('0x7')]['id']][_0x8a21('0x18')]=![];this[_0x8a21('0x8')][_0x8a21('0x17')][this[_0x8a21('0x7')]['id']][_0x8a21('0x1d')]=undefined;util[_0x8a21('0x1e')](this[_0x8a21('0x6')]['id'],this['realtime'][_0x8a21('0x17')][this['agent']['id']],_0x1e1267?_0x8a21('0x1f'):'TIMEOUT');}if(!_0x1e1267){setTimeout(this[_0x8a21('0x9')][_0x8a21('0xb')](this),0x3e8);}};function agent(_0x578d66,_0x59a0fa,_0x2dbbb1,_0x3e8e08){return new Agent(_0x578d66,_0x59a0fa,_0x2dbbb1,_0x3e8e08);}module[_0x8a21('0x20')]=agent; \ No newline at end of file +var _0x3fab=['./util','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports'];(function(_0x2382bb,_0x3f9ae7){var _0x229cd2=function(_0xc67192){while(--_0xc67192){_0x2382bb['push'](_0x2382bb['shift']());}};_0x229cd2(++_0x3f9ae7);}(_0x3fab,0xf8));var _0xb3fa=function(_0x5caef8,_0x115f74){_0x5caef8=_0x5caef8-0x0;var _0x35f218=_0x3fab[_0x5caef8];return _0x35f218;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xb3fa('0x0'));var logger=require('../../../../../config/logger')(_0xb3fa('0x1'));var Agent=function(_0x478c03,_0x104dd4,_0x57c87b,_0x4f7305){this[_0xb3fa('0x2')]=uuid['v4']();this[_0xb3fa('0x3')]=_0x478c03;this[_0xb3fa('0x4')]=_0x104dd4;this[_0xb3fa('0x5')]=_0x57c87b;this[_0xb3fa('0x1')]=_0x4f7305;this[_0xb3fa('0x3')][_0xb3fa('0x6')](this[_0xb3fa('0x7')][_0xb3fa('0x8')](this),this[_0xb3fa('0x9')][_0xb3fa('0x8')](this));this[_0xb3fa('0x3')]['on'](_0xb3fa('0xa'),this[_0xb3fa('0x9')][_0xb3fa('0x8')](this));this[_0xb3fa('0x3')]['on'](_0xb3fa('0xb'),this[_0xb3fa('0xc')]['bind'](this));};Agent[_0xb3fa('0xd')][_0xb3fa('0x6')]=function(){this[_0xb3fa('0x3')]['push'](this['handleRun'][_0xb3fa('0x8')](this),this[_0xb3fa('0x9')]['bind'](this));};Agent['prototype']['handleDrained']=function(){this[_0xb3fa('0x9')](!![]);};Agent[_0xb3fa('0xd')][_0xb3fa('0x7')]=function(_0x5e0234){logger[_0xb3fa('0xe')](_0xb3fa('0xf'),this[_0xb3fa('0x3')]['id'],this['agent']['id']);if(_[_0xb3fa('0x10')](this[_0xb3fa('0x5')][_0xb3fa('0x11')][this[_0xb3fa('0x4')]['id']])){logger['info'](_0xb3fa('0x12'),this[_0xb3fa('0x3')]['id'],this[_0xb3fa('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0xb3fa('0x1')][_0xb3fa('0x13')]||util[_0xb3fa('0x14')](this['squeue']['id'],this[_0xb3fa('0x5')][_0xb3fa('0x11')][this['agent']['id']],this[_0xb3fa('0x3')][_0xb3fa('0x15')],![])){this[_0xb3fa('0x5')][_0xb3fa('0x11')][this[_0xb3fa('0x4')]['id']][_0xb3fa('0x16')]=!![];this['realtime'][_0xb3fa('0x11')][this[_0xb3fa('0x4')]['id']][_0xb3fa('0x17')]=undefined;util['showNotification'](this[_0xb3fa('0x2')],this['squeue']['id'],this['realtime'][_0xb3fa('0x11')][this[_0xb3fa('0x4')]['id']],null,this[_0xb3fa('0x1')]);util[_0xb3fa('0x18')](this[_0xb3fa('0x3')]['id'],this[_0xb3fa('0x5')]['agents'][this[_0xb3fa('0x4')]['id']],'RINGING'+(this[_0xb3fa('0x1')][_0xb3fa('0x13')]?':FORCED':''));}else{logger[_0xb3fa('0xe')](_0xb3fa('0x19'),this[_0xb3fa('0x3')]['id'],this[_0xb3fa('0x4')]['id']);setTimeout(this[_0xb3fa('0x6')]['bind'](this),0x3e8);}}};Agent[_0xb3fa('0xd')]['handleTimeout']=function(_0x5a828e){if(_[_0xb3fa('0x10')](this[_0xb3fa('0x5')][_0xb3fa('0x11')][this[_0xb3fa('0x4')]['id']])){return logger[_0xb3fa('0xe')](_0xb3fa('0x12'),this[_0xb3fa('0x3')]['id'],this[_0xb3fa('0x4')]['id']);}else{logger['info'](_0xb3fa('0x1a'),this[_0xb3fa('0x3')]['id'],this['agent']['id']);util[_0xb3fa('0x1b')](this[_0xb3fa('0x2')],this[_0xb3fa('0x3')]['id'],this[_0xb3fa('0x5')]['agents'][this[_0xb3fa('0x4')]['id']],null,this['routing']);this['realtime']['agents'][this[_0xb3fa('0x4')]['id']]['busy']=![];this[_0xb3fa('0x5')]['agents'][this[_0xb3fa('0x4')]['id']][_0xb3fa('0x17')]=undefined;util[_0xb3fa('0x18')](this['squeue']['id'],this[_0xb3fa('0x5')][_0xb3fa('0x11')][this[_0xb3fa('0x4')]['id']],_0x5a828e?_0xb3fa('0x1c'):_0xb3fa('0x1d'));}if(!_0x5a828e){setTimeout(this[_0xb3fa('0x6')]['bind'](this),0x3e8);}};function agent(_0x323498,_0x2bc32b,_0x522ba2,_0x1aa86b){return new Agent(_0x323498,_0x2bc32b,_0x522ba2,_0x1aa86b);}module[_0xb3fa('0x1e')]=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 539aa77..72b709d 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 _0xe24a=['isAgentAvailable','writeLog','RINGING','busyQueue','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','busy','exports','uuid','routing','notificationId','squeue','queue','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','isNil','Agents','length','realtime','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x10e441,_0x22efdc){var _0x48dee8=function(_0x5500ea){while(--_0x5500ea){_0x10e441['push'](_0x10e441['shift']());}};_0x48dee8(++_0x22efdc);}(_0xe24a,0x137));var _0xae24=function(_0x51331f,_0x4cda4b){_0x51331f=_0x51331f-0x0;var _0x4b8a2e=_0xe24a[_0x51331f];return _0x4b8a2e;};'use strict';var _=require('lodash');var uuid=require(_0xae24('0x0'));var util=require('./util');var logger=require('../../../../../config/logger')(_0xae24('0x1'));var Beepall=function(_0x1e18fc,_0xbc45ca,_0x378208,_0x4dc113){this[_0xae24('0x2')]=uuid['v4']();this[_0xae24('0x3')]=_0x1e18fc;this[_0xae24('0x4')]=_0xbc45ca;this['realtime']=_0x378208;this[_0xae24('0x1')]=_0x4dc113;this[_0xae24('0x3')][_0xae24('0x5')](this[_0xae24('0x6')][_0xae24('0x7')](this),this[_0xae24('0x8')]['bind'](this));this[_0xae24('0x3')]['on'](_0xae24('0x9'),this[_0xae24('0x8')][_0xae24('0x7')](this));this[_0xae24('0x3')]['on']('drained',this[_0xae24('0xa')][_0xae24('0x7')](this));};Beepall[_0xae24('0xb')]['push']=function(){this['squeue'][_0xae24('0x5')](this[_0xae24('0x6')][_0xae24('0x7')](this),this['handleTimeout'][_0xae24('0x7')](this));};Beepall[_0xae24('0xb')]['handleDrained']=function(_0x154541){this[_0xae24('0x8')](!![]);};Beepall[_0xae24('0xb')]['handleRun']=function(_0x1d0e21){var _0x2344a4=!![];if(!_[_0xae24('0xc')](this[_0xae24('0x4')])&&!_[_0xae24('0xc')](this[_0xae24('0x4')][_0xae24('0xd')])&&this['queue'][_0xae24('0xd')]['length']>0x0){for(var _0x4c777c=0x0,_0x272cc1;_0x4c777c0x0){for(var _0x1a3386=0x0,_0x20ee09;_0x1a33860x0&&_0x502487[_0x1a007c+_0x06c0('0x25')]>=_0x502487[_0x1a007c+_0x06c0('0x26')]){writeLog(_0x1d6a8e,_0x502487,_0x1a007c[_0x06c0('0x27')]()+_0x06c0('0x28'));return![];}}return!![];};exports[_0x06c0('0x29')]=function(_0x4a6f3d,_0x104708,_0x1c2483,_0x418183,_0x46115a){return sendNotification(!![],_0x4a6f3d,_0x104708,_0x1c2483,_0x418183,_0x46115a);};exports[_0x06c0('0x2a')]=function(_0x1dddfa,_0x508311,_0x426792,_0x3e1e84,_0x4224b6){return sendNotification(![],_0x1dddfa,_0x508311,_0x426792,_0x3e1e84,_0x4224b6);};exports[_0x06c0('0x2b')]=writeLog; \ No newline at end of file +var _0xb04a=['msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','notification:%s','remove','info','isAgentAvailable','busy','online','OFFLINE','PAUSE','CurrentCapacity','Capacity','toUpperCase','hideNotification','lodash','util','../utils','mustache','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','format','user:%s','name','emit','user:save','\x20interaction','account','notificationSound','notificationShake','body','queue'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0xb04a,0xcf));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab04('0x0'));var util=require(_0xab04('0x1'));var utils=require(_0xab04('0x2'));var Mustache=require(_0xab04('0x3'));var Redis=require('ioredis');var config=require(_0xab04('0x4'));var logger=require(_0xab04('0x5'))(_0xab04('0x6'));config['redis']=_[_0xab04('0x7')](config[_0xab04('0x8')],{'host':_0xab04('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xab04('0x8')]));function emit(_0x46d9b2,_0x598d0f,_0x53a969){io['to'](_0x46d9b2)['emit'](_0x598d0f,_0x53a969);}function sendNotification(_0xb75c20,_0x4faba9,_0x4c1db9,_0x4b7ecc,_0x1d4a39,_0x183c53){io['to'](util[_0xab04('0xa')](_0xab04('0xb'),_0x4b7ecc[_0xab04('0xc')]))[_0xab04('0xd')](_0xab04('0xe'),_0x4b7ecc);var _0x332501=_0x183c53||{};var _0x43228b=_0x4c1db9['split']('.');var _0x5032bc={'uniqueid':_0x4faba9,'channel':_0x43228b[0x0],'id':_0x43228b[0x1],'title':_0x43228b[0x0]+_0xab04('0xf'),'interactionId':_0x43228b[0x2],'queue':_0x1d4a39?_0x1d4a39[_0xab04('0xc')]:null,'sound':_0x332501[_0xab04('0x10')][_0xab04('0x11')],'shake':_0x332501['account'][_0xab04('0x12')]};try{if(!_0x332501[_0xab04('0x13')]){_0x332501['body']={};}if(_0x1d4a39){_0x332501[_0xab04('0x13')][_0xab04('0x14')]=_0x1d4a39;}else if(_0x332501[_0xab04('0x13')][_0xab04('0x14')]){delete _0x332501[_0xab04('0x13')]['queue'];}_0x5032bc[_0xab04('0x15')]=utils[_0xab04('0x16')](_0x332501[_0xab04('0x10')][_0xab04('0x17')],_0x332501);}catch(_0x20ecfd){_0x5032bc['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0xab04('0x18')](util[_0xab04('0xa')](_0xab04('0x19'),_0x4faba9,_0x20ecfd['message']));}io['to'](util['format'](_0xab04('0xb'),_0x4b7ecc[_0xab04('0xc')]))[_0xab04('0xd')](util['format'](_0xab04('0x1a'),_0xb75c20?'save':_0xab04('0x1b')),_0x5032bc);}function writeLog(_0x2ac32c,_0x580a4f,_0x4808ba){return logger[_0xab04('0x1c')](util[_0xab04('0xa')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x2ac32c,_0x580a4f[_0xab04('0xc')],_0x4808ba));}exports[_0xab04('0x1d')]=function(_0x359c63,_0x3d2fdb,_0x3667fd,_0x4c7a19){if(_0x3d2fdb[_0xab04('0x1e')]){writeLog(_0x359c63,_0x3d2fdb,'BUSY');return![];}if(!_0x3d2fdb[_0xab04('0x1f')]){writeLog(_0x359c63,_0x3d2fdb,_0xab04('0x20'));return![];}if(_0x3d2fdb[_0x3667fd+'Pause']){writeLog(_0x359c63,_0x3d2fdb,_0xab04('0x21'));return![];}if(_0x4c7a19&&_0x3d2fdb['hasOwnProperty'](_0x3667fd+'Capacity')&&_0x3d2fdb['hasOwnProperty'](_0x3667fd+_0xab04('0x22'))){if(_0x3d2fdb[_0x3667fd+_0xab04('0x23')]>0x0&&_0x3d2fdb[_0x3667fd+_0xab04('0x22')]>=_0x3d2fdb[_0x3667fd+_0xab04('0x23')]){writeLog(_0x359c63,_0x3d2fdb,_0x3667fd[_0xab04('0x24')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x19f651,_0x4a4532,_0xb8e7b,_0xdf0b96,_0x15cae9){return sendNotification(!![],_0x19f651,_0x4a4532,_0xb8e7b,_0xdf0b96,_0x15cae9);};exports[_0xab04('0x25')]=function(_0x331aa9,_0x3c61bd,_0x5d2d94,_0xcd6008,_0x36afb6){return sendNotification(![],_0x331aa9,_0x3c61bd,_0x5d2d94,_0xcd6008,_0x36afb6);};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 0edab86..5236256 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 _0xe480=['error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','next','isObject','stringify','validate','shelljs','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xe480,0x165));var _0x0e48=function(_0x3a9086,_0x20c28e){_0x3a9086=_0x3a9086-0x0;var _0x1797ce=_0xe480[_0x3a9086];return _0x1797ce;};'use strict';var schema=require(_0x0e48('0x0'));var sh=require(_0x0e48('0x1'));var _=require('lodash');var utils=require(_0x0e48('0x2'));var logger=require(_0x0e48('0x3'))(_0x0e48('0x4'));var system=schema({'command':{'type':_0x0e48('0x5'),'required':!![],'message':_0x0e48('0x6')}});exports['consequence']=function(_0x2b67a7,_0x9321de){return function(_0x38d4fa){try{var _0x41b2d4={'command':_0x9321de[0x0]};var _0xc4f700=system[_0x0e48('0x0')](_0x41b2d4,{'typecast':!![]});if(_0xc4f700['length']){logger[_0x0e48('0x7')](_0x0e48('0x8'),_0x2b67a7,_[_0x0e48('0x9')](_0xc4f700,_0x0e48('0xa'))[_0x0e48('0xb')](',\x20'));logger[_0x0e48('0xc')](_0x0e48('0xd'),_0x2b67a7);_0x38d4fa['next']();}else{var _0x269583=this;var _0x540b5d=utils[_0x0e48('0xe')](_0x9321de[0x0],this);logger[_0x0e48('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x2b67a7,_0x540b5d);sh[_0x0e48('0xf')](_[_0x0e48('0x10')](_0x540b5d),function(_0x269cd1,_0x3a95d4){logger[_0x0e48('0xc')](_0x0e48('0x11'),_0x2b67a7,_0x269cd1);if(_0x269cd1==0x0){var _0x4ab48a=_0x3a95d4['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x0e48('0x12')](_0x9321de[0x1])||_[_0x0e48('0x13')](_0x9321de[0x1])){logger[_0x0e48('0xc')](_0x0e48('0x14'),_0x2b67a7);_0x269583['body'][_0x9321de[0x1]]=_0x4ab48a;}else{logger[_0x0e48('0xc')](_0x0e48('0x15'),_0x2b67a7,_0x9321de[0x1],_0x4ab48a);_0x269583[_0x0e48('0x16')][_0x9321de[0x1]]=_0x4ab48a;}}_0x38d4fa[_0x0e48('0x17')]();});}}catch(_0xdb908e){logger['error'](_0x0e48('0x8'),_0x2b67a7,_[_0x0e48('0x18')](_0xdb908e)?JSON[_0x0e48('0x19')](_0xdb908e):_0xdb908e);logger[_0x0e48('0xc')](_0x0e48('0xd'),_0x2b67a7);_0x38d4fa[_0x0e48('0x17')]();}};}; \ No newline at end of file +var _0xe0ff=['validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0xd8c937,_0x214236){var _0x54fff9=function(_0x3ee254){while(--_0x3ee254){_0xd8c937['push'](_0xd8c937['shift']());}};_0x54fff9(++_0x214236);}(_0xe0ff,0x1ee));var _0xfe0f=function(_0x48bbe2,_0x1f2743){_0x48bbe2=_0x48bbe2-0x0;var _0x2b5e41=_0xe0ff[_0x48bbe2];return _0x2b5e41;};'use strict';var schema=require(_0xfe0f('0x0'));var sh=require(_0xfe0f('0x1'));var _=require(_0xfe0f('0x2'));var utils=require(_0xfe0f('0x3'));var logger=require('../../../../config/logger')(_0xfe0f('0x4'));var system=schema({'command':{'type':_0xfe0f('0x5'),'required':!![],'message':_0xfe0f('0x6')}});exports[_0xfe0f('0x7')]=function(_0x385cdc,_0x3ba83b){return function(_0x3b800e){try{var _0x46b7c9={'command':_0x3ba83b[0x0]};var _0x342aea=system[_0xfe0f('0x0')](_0x46b7c9,{'typecast':!![]});if(_0x342aea[_0xfe0f('0x8')]){logger[_0xfe0f('0x9')](_0xfe0f('0xa'),_0x385cdc,_[_0xfe0f('0xb')](_0x342aea,_0xfe0f('0xc'))['join'](',\x20'));logger[_0xfe0f('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x385cdc);_0x3b800e[_0xfe0f('0xe')]();}else{var _0x5218fd=this;var _0x4b1aa2=utils[_0xfe0f('0xf')](_0x3ba83b[0x0],this);logger[_0xfe0f('0xd')](_0xfe0f('0x10'),_0x385cdc,_0x4b1aa2);sh[_0xfe0f('0x11')](_[_0xfe0f('0x12')](_0x4b1aa2),function(_0x47c8e1,_0x3352a8){logger[_0xfe0f('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x385cdc,_0x47c8e1);if(_0x47c8e1==0x0){var _0x1484d5=_0x3352a8['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xfe0f('0x13')](_0x3ba83b[0x1])||_[_0xfe0f('0x14')](_0x3ba83b[0x1])){logger[_0xfe0f('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x385cdc);_0x5218fd['body'][_0x3ba83b[0x1]]=_0x1484d5;}else{logger[_0xfe0f('0xd')](_0xfe0f('0x15'),_0x385cdc,_0x3ba83b[0x1],_0x1484d5);_0x5218fd[_0xfe0f('0x16')][_0x3ba83b[0x1]]=_0x1484d5;}}_0x3b800e['next']();});}}catch(_0x21e030){logger[_0xfe0f('0x9')]('[%s][SYSTEM]\x20%s',_0x385cdc,_[_0xfe0f('0x17')](_0x21e030)?JSON[_0xfe0f('0x18')](_0x21e030):_0x21e030);logger['info'](_0xfe0f('0x19'),_0x385cdc);_0x3b800e[_0xfe0f('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 072c6bf..df85392 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 _0x9e01=['../../rpc/faxInteraction','../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','map','join','channel','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction'];(function(_0x1e33fd,_0x12d3a5){var _0x4f4ea7=function(_0x3118e0){while(--_0x3118e0){_0x1e33fd['push'](_0x1e33fd['shift']());}};_0x4f4ea7(++_0x12d3a5);}(_0x9e01,0xd3));var _0x19e0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9e01[_0xa464c9];return _0x3d73c4;};'use strict';var schema=require(_0x19e0('0x0'));var _=require(_0x19e0('0x1'));var rpc={'chatInteraction':require(_0x19e0('0x2')),'openchannelInteraction':require(_0x19e0('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x19e0('0x4')),'faxInteraction':require(_0x19e0('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x19e0('0x6'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x19e0('0x7')}});exports[_0x19e0('0x8')]=function(_0x307217,_0x3b9ea8,_0x5d99c0,_0x393267){return function(_0x15142c){try{var _0xfb5cf5={'tag':_0x3b9ea8[0x0]};var _0x406bf9=tag[_0x19e0('0x0')](_0xfb5cf5,{'typecast':!![]});if(_0x406bf9['length']){logger[_0x19e0('0x9')]('[%s][TAG]\x20%s',_0x307217,_[_0x19e0('0xa')](_0x406bf9,'message')[_0x19e0('0xb')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x307217);_0x15142c['next']();}else{var _0xd7f269={'ids':[_0x3b9ea8[0x0]]};if(rpc[_0x393267[_0x19e0('0xc')]+_0x19e0('0xd')]){rpc[_0x393267[_0x19e0('0xc')]+_0x19e0('0xd')][_0x19e0('0xe')](_0x393267[_0x19e0('0xf')]['id'],_0xd7f269)[_0x19e0('0x10')](function(_0x199993){logger[_0x19e0('0x11')](_0x19e0('0x12'),_0x307217,_0x3b9ea8[0x1],_0x393267[_0x19e0('0xc')],_0x393267[_0x19e0('0xf')]['id']);})['catch'](function(_0x5f3c40){logger[_0x19e0('0x9')](_0x19e0('0x13'),_0x307217,JSON[_0x19e0('0x14')](_0x5f3c40));logger[_0x19e0('0x11')](_0x19e0('0x15'),_0x307217);})[_0x19e0('0x16')](function(){_0x15142c['next']();});}}}catch(_0x4f1a31){logger[_0x19e0('0x9')](_0x19e0('0x13'),_0x307217,_[_0x19e0('0x17')](_0x4f1a31)?JSON[_0x19e0('0x14')](_0x4f1a31):_0x4f1a31);logger[_0x19e0('0x11')](_0x19e0('0x15'),_0x307217);_0x15142c['next']();}};}; \ No newline at end of file +var _0x9900=['message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','validate','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x9900,0x93));var _0x0990=function(_0x46eb9e,_0x4a5dfe){_0x46eb9e=_0x46eb9e-0x0;var _0x2136ff=_0x9900[_0x46eb9e];return _0x2136ff;};'use strict';var schema=require(_0x0990('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0990('0x1')),'smsInteraction':require(_0x0990('0x2')),'mailInteraction':require(_0x0990('0x3')),'faxInteraction':require(_0x0990('0x4')),'whatsappInteraction':require(_0x0990('0x5'))};var logger=require(_0x0990('0x6'))(_0x0990('0x7'));var tag=schema({'tag':{'type':_0x0990('0x8'),'required':!![],'message':_0x0990('0x9')}});exports[_0x0990('0xa')]=function(_0x1b6d4f,_0xce3c0d,_0x4ae2a6,_0x4f63d8){return function(_0x59481f){try{var _0x315958={'tag':_0xce3c0d[0x0]};var _0x3bdf55=tag[_0x0990('0x0')](_0x315958,{'typecast':!![]});if(_0x3bdf55[_0x0990('0xb')]){logger[_0x0990('0xc')](_0x0990('0xd'),_0x1b6d4f,_[_0x0990('0xe')](_0x3bdf55,_0x0990('0xf'))['join'](',\x20'));logger[_0x0990('0x10')](_0x0990('0x11'),_0x1b6d4f);_0x59481f[_0x0990('0x12')]();}else{var _0x2af56c={'ids':[_0xce3c0d[0x0]]};if(rpc[_0x4f63d8[_0x0990('0x13')]+_0x0990('0x14')]){rpc[_0x4f63d8[_0x0990('0x13')]+_0x0990('0x14')][_0x0990('0x15')](_0x4f63d8[_0x0990('0x16')]['id'],_0x2af56c)[_0x0990('0x17')](function(_0x9f6b35){logger[_0x0990('0x10')](_0x0990('0x18'),_0x1b6d4f,_0xce3c0d[0x1],_0x4f63d8[_0x0990('0x13')],_0x4f63d8['interaction']['id']);})['catch'](function(_0x18a691){logger[_0x0990('0xc')](_0x0990('0xd'),_0x1b6d4f,JSON[_0x0990('0x19')](_0x18a691));logger[_0x0990('0x10')](_0x0990('0x11'),_0x1b6d4f);})[_0x0990('0x1a')](function(){_0x59481f[_0x0990('0x12')]();});}}}catch(_0x292051){logger[_0x0990('0xc')](_0x0990('0xd'),_0x1b6d4f,_['isObject'](_0x292051)?JSON[_0x0990('0x19')](_0x292051):_0x292051);logger['info'](_0x0990('0x11'),_0x1b6d4f);_0x59481f[_0x0990('0x12')]();}};}; \ 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 c2a35eb..26ceed8 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 _0xc874=['body','contact','account','interaction','mustache','exports','merge'];(function(_0x265312,_0x36648c){var _0x82583f=function(_0xdff448){while(--_0xdff448){_0x265312['push'](_0x265312['shift']());}};_0x82583f(++_0x36648c);}(_0xc874,0x154));var _0x4c87=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0xc874[_0x1d5400];return _0x21d9fe;};'use strict';var Mustache=require(_0x4c87('0x0'));var _=require('lodash');module[_0x4c87('0x1')]={'getMustacheRender':function(_0x271480,_0x505440){return Mustache['render'](_0x271480,_[_0x4c87('0x2')](_0x505440[_0x4c87('0x3')],{'contact':_0x505440[_0x4c87('0x4')],'message':_0x505440['message'],'account':_0x505440[_0x4c87('0x5')],'interaction':_0x505440[_0x4c87('0x6')],'list':_0x505440['list']}))||'';}}; \ No newline at end of file +var _0x8ccb=['merge','message','account','interaction','mustache','lodash','render'];(function(_0x396502,_0x278ac4){var _0x431979=function(_0x57b332){while(--_0x57b332){_0x396502['push'](_0x396502['shift']());}};_0x431979(++_0x278ac4);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x8ccb[_0x5951e8];return _0x20a1f5;};'use strict';var Mustache=require(_0xb8cc('0x0'));var _=require(_0xb8cc('0x1'));module['exports']={'getMustacheRender':function(_0x1fe9e0,_0x101ec1){return Mustache[_0xb8cc('0x2')](_0x1fe9e0,_[_0xb8cc('0x3')](_0x101ec1['body'],{'contact':_0x101ec1['contact'],'message':_0x101ec1[_0xb8cc('0x4')],'account':_0x101ec1[_0xb8cc('0x5')],'interaction':_0x101ec1[_0xb8cc('0x6')],'list':_0x101ec1['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index f2f2716..5fcc554 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 _0x6f7f=['whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','jayson/promise','bluebird','uuid','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','applications','isArray','length','existsSync','join','.js','toLowerCase','appdata','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','split','%s:%s:%s','app','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x6f7f,0x177));var _0xf6f7=function(_0x3e93ac,_0xce9896){_0x3e93ac=_0x3e93ac-0x0;var _0x30136e=_0x6f7f[_0x3e93ac];return _0x30136e;};'use strict';var _=require('lodash');var util=require(_0xf6f7('0x0'));var path=require(_0xf6f7('0x1'));var fs=require('fs');var jayson=require(_0xf6f7('0x2'));var BPromise=require(_0xf6f7('0x3'));var uuid=require(_0xf6f7('0x4'));var config=require('../../../config/environment');var logger=require(_0xf6f7('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0xf6f7('0x6')),'mailQueueReport':require(_0xf6f7('0x7')),'chatQueueReport':require(_0xf6f7('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xf6f7('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xf6f7('0xa'));function getId(_0x3c641f,_0xe86f3a,_0x279ed7){return util[_0xf6f7('0xb')](_0xf6f7('0xc'),_0x3c641f,_0xe86f3a||0x0,_0x279ed7||0x0);}function getIntervals(_0x506617,_0x13cf44){var _0x5299eb=[];if(!_['isNil'](_0x13cf44['IntervalId'])&&!_[_0xf6f7('0xd')](_0x506617[_0x13cf44[_0xf6f7('0xe')]])&&!_[_0xf6f7('0xd')](_0x506617[_0x13cf44[_0xf6f7('0xe')]][_0xf6f7('0xf')])){_0x5299eb=_[_0xf6f7('0x10')](_0x506617[_0x13cf44['IntervalId']]['Intervals'],_0xf6f7('0x11'));}else if(!_[_0xf6f7('0xd')](_0x13cf44[_0xf6f7('0x11')])){_0x5299eb=[_0x13cf44[_0xf6f7('0x11')]];}return _0x5299eb;}exports['listen']=function(_0x568242){_0x568242[_0xf6f7('0x12')]={};return new BPromise(function(_0x4f8d9b,_0x87ae1a){var _0x57c323={'Start':function(_0x3f9293){var _0x2ca201=this;return new Promise(function(_0x35958e,_0x2758c0){if(_0x3f9293){try{var _0x16cde1=[];var _0x4b8eb2=getId(_0x3f9293[_0xf6f7('0x13')],_0x3f9293[_0xf6f7('0x14')]?_0x3f9293['message']['id']:0x0,_0x3f9293[_0xf6f7('0x15')]?_0x3f9293[_0xf6f7('0x15')]['id']:0x0);if(_0x3f9293[_0xf6f7('0x16')]&&_[_0xf6f7('0x17')](_0x3f9293['applications'])&&_0x3f9293[_0xf6f7('0x16')][_0xf6f7('0x18')]){for(var _0x512b07=0x0;_0x512b07<_0x3f9293[_0xf6f7('0x16')][_0xf6f7('0x18')];_0x512b07+=0x1){var _0x12dbcc=_0x3f9293[_0xf6f7('0x16')][_0x512b07];if(fs[_0xf6f7('0x19')](path[_0xf6f7('0x1a')](__dirname,_0xf6f7('0x16'),_0x12dbcc['app']+_0xf6f7('0x1b')))){var _0x5b6d3f=[];switch(_0x12dbcc['app'][_0xf6f7('0x1c')]()){case'autoreply':var _0x42df64=_0x12dbcc[_0xf6f7('0x1d')]['split'](',');if(_0x3f9293[_0xf6f7('0x13')]==='mail'){_0x5b6d3f['push'](_0x42df64[0x0]);_0x5b6d3f[_0xf6f7('0x1e')](_0x42df64[0x1]);_0x5b6d3f[_0xf6f7('0x1e')](_0x42df64[_0xf6f7('0x1f')](0x2,_0x42df64[_0xf6f7('0x18')])[_0xf6f7('0x1a')](','));}else{_0x5b6d3f['push'](_0x42df64[0x0]);_0x5b6d3f['push'](_0x42df64[_0xf6f7('0x1f')](0x1,_0x42df64[_0xf6f7('0x18')])[_0xf6f7('0x1a')](','));}break;case _0xf6f7('0x20'):var _0x329c39=_0x12dbcc[_0xf6f7('0x1d')]['split'](',');_0x5b6d3f[_0xf6f7('0x1e')](_0x329c39[0x0]);_0x5b6d3f[_0xf6f7('0x1e')](_0x329c39[0x1]);_0x5b6d3f[_0xf6f7('0x1e')](_0x329c39[_0xf6f7('0x1f')](0x2,_0x329c39[_0xf6f7('0x18')])[_0xf6f7('0x1a')](','));break;case _0xf6f7('0x21'):var _0x4b3100=_0x12dbcc['appdata']['split'](',');_0x5b6d3f[_0xf6f7('0x1e')](_0x4b3100[0x0]);_0x5b6d3f['push'](_0x4b3100[0x1]);_0x5b6d3f[_0xf6f7('0x1e')](_0x4b3100[0x2]);_0x5b6d3f[_0xf6f7('0x1e')](_0x4b3100[0x3]);_0x5b6d3f['push'](_0x4b3100['slice'](0x4,_0x4b3100[_0xf6f7('0x18')])[_0xf6f7('0x1a')](','));break;case _0xf6f7('0x22'):var _0x547229=_0x12dbcc[_0xf6f7('0x1d')]['split'](',');_0x5b6d3f[_0xf6f7('0x1e')](_0x547229[0x0]);_0x5b6d3f[_0xf6f7('0x1e')](_0x547229[0x1]);_0x5b6d3f[_0xf6f7('0x1e')](_0x547229[0x2]);_0x5b6d3f[_0xf6f7('0x1e')](_0x547229[0x3]);_0x5b6d3f[_0xf6f7('0x1e')](_0x547229[_0xf6f7('0x1f')](0x4,_0x547229[_0xf6f7('0x18')])[_0xf6f7('0x1a')](','));break;case _0xf6f7('0x14'):_0x5b6d3f[_0xf6f7('0x1e')](_0x12dbcc[_0xf6f7('0x1d')]);break;case _0xf6f7('0x23'):_0x5b6d3f['push'](_0x12dbcc[_0xf6f7('0x24')]);_0x5b6d3f['push'](_0x12dbcc[_0xf6f7('0x1d')]);break;default:_0x5b6d3f=_[_0xf6f7('0xd')](_0x12dbcc[_0xf6f7('0x1d')])?[]:_0x12dbcc[_0xf6f7('0x1d')][_0xf6f7('0x25')](',');}var _0x2dee30={'id':util[_0xf6f7('0xb')](_0xf6f7('0x26'),_0x4b8eb2,_0x12dbcc['id'],_0x12dbcc[_0xf6f7('0x27')]),'condition':require('./interval')['condition'](_0x4b8eb2,getIntervals(_0x568242[_0xf6f7('0x28')],_0x12dbcc),_0x568242),'consequence':require(_0xf6f7('0x29')+_0x12dbcc[_0xf6f7('0x27')])[_0xf6f7('0x2a')](_0x4b8eb2,_0x5b6d3f,_0x568242,_0x3f9293),'p':_0x12dbcc[_0xf6f7('0x2b')]||0x0};logger[_0xf6f7('0x2c')](_0xf6f7('0x2d'),_0x2dee30['id'],_0xf6f7('0x2e'),getIntervals(_0x568242[_0xf6f7('0x28')],_0x12dbcc)[_0xf6f7('0x1a')](_0xf6f7('0x2f')));_0x16cde1[_0xf6f7('0x1e')](_0x2dee30);}else{logger[_0xf6f7('0x30')](_0xf6f7('0x31'),path[_0xf6f7('0x1a')](__dirname,_0xf6f7('0x16'),_0x12dbcc['app']+'.js'));}}_0x568242[_0xf6f7('0x12')][_0x4b8eb2]=new RuleEngine(_0x16cde1);_0x568242[_0xf6f7('0x12')][_0x4b8eb2][_0xf6f7('0x32')](_0x3f9293,function(_0x2656b6){logger[_0xf6f7('0x2c')](_0xf6f7('0x33'),JSON['stringify'](_0x2656b6[_0xf6f7('0x34')]));if(_0x568242[_0xf6f7('0x12')][_0x4b8eb2]){_0x568242[_0xf6f7('0x12')][_0x4b8eb2][_0xf6f7('0x35')]('complete');}});return _0x35958e({'code':0xc8,'message':_0x3f9293});}else{logger['info'](_0xf6f7('0x36'));return _0x35958e({'code':0xc8,'message':_0x3f9293});}}catch(_0x5c3a79){logger['error'](_0x5c3a79[_0xf6f7('0x37')]);return _0x2758c0(_0x2ca201[_0xf6f7('0x30')](0x1f4,_0x5c3a79));}}return _0x2758c0(_0xf6f7('0x38'));});},'AcceptMessage':function(_0x5b336f){var _0x1ecb03=this;return new Promise(function(_0x764d2e,_0x3717a0){if(_0x5b336f[_0xf6f7('0x39')]&&_0x5b336f['agent']['id']){if(_0x568242[_0xf6f7('0x3a')][_0x5b336f[_0xf6f7('0x39')]['id']]){_0x568242['agents'][_0x5b336f['agent']['id']][_0xf6f7('0x3b')]=![];_0x568242['agents'][_0x5b336f[_0xf6f7('0x39')]['id']]['busyQueue']=undefined;}}if(_0x5b336f['message']&&_0x5b336f['message']['id']){try{var _0x2ee09d=getId(_0x5b336f[_0xf6f7('0x13')],_0x5b336f[_0xf6f7('0x14')]?_0x5b336f[_0xf6f7('0x14')]['id']:0x0,_0x5b336f['interaction']?_0x5b336f[_0xf6f7('0x15')]['id']:0x0);if(_0x568242['rules'][_0x2ee09d]){_0x568242[_0xf6f7('0x12')][_0x2ee09d]['emit']('end');if(rpc[_0x5b336f[_0xf6f7('0x13')]+_0xf6f7('0x3c')]){rpc[_0x5b336f[_0xf6f7('0x13')]+'QueueReport'][_0xf6f7('0x3d')](_0x2ee09d,{'UserId':_0x5b336f[_0xf6f7('0x14')]['UserId']})['catch'](function(_0x1d687c){logger['error'](_0xf6f7('0x3e'));});}}return _0x764d2e({'code':0xc8,'message':_0x5b336f});}catch(_0x5618cf){logger['error'](_0x5618cf[_0xf6f7('0x37')]);return _0x3717a0(_0x1ecb03['error'](0x1f4,_0x5618cf));}}logger[_0xf6f7('0x30')]('message\x20is\x20empty');return _0x3717a0(_0x1ecb03[_0xf6f7('0x30')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x4afd83){var _0xc49fbd=this;return new Promise(function(_0x3bc10b,_0x2b1a0c){if(_0x4afd83[_0xf6f7('0x39')]&&_0x4afd83[_0xf6f7('0x39')]['id']){try{if(_0x568242[_0xf6f7('0x3a')][_0x4afd83[_0xf6f7('0x39')]['id']]){_0x568242[_0xf6f7('0x3a')][_0x4afd83[_0xf6f7('0x39')]['id']][_0xf6f7('0x3b')]=![];_0x568242[_0xf6f7('0x3a')][_0x4afd83[_0xf6f7('0x39')]['id']]['busyQueue']=undefined;}return _0x3bc10b({'code':0xc8,'message':_0x4afd83});}catch(_0x4003b7){logger['error'](_0x4003b7[_0xf6f7('0x37')]);return _0x2b1a0c(_0xc49fbd[_0xf6f7('0x30')](0x1f4,_0x4003b7));}}logger[_0xf6f7('0x30')]('message\x20is\x20empty');return _0x2b1a0c(_0xc49fbd[_0xf6f7('0x30')](0x1f4,_0xf6f7('0x3f')));});},'AbandonInteraction':function(_0xb32f1a){var _0x2f4955=this;return new Promise(function(_0xa856a9,_0x54228d){if(_0xb32f1a[_0xf6f7('0x13')]&&_0xb32f1a['interaction']&&_0xb32f1a[_0xf6f7('0x15')]['id']){try{var _0x1bfc9a=getId(_0xb32f1a[_0xf6f7('0x13')],_0xb32f1a['message']?_0xb32f1a['message']['id']:0x0,_0xb32f1a[_0xf6f7('0x15')]?_0xb32f1a[_0xf6f7('0x15')]['id']:0x0);if(_0x568242[_0xf6f7('0x12')][_0x1bfc9a]){_0x568242['rules'][_0x1bfc9a][_0xf6f7('0x35')](_0xf6f7('0x40'));}return _0xa856a9({'code':0xc8,'message':_0xb32f1a});}catch(_0x3d103c){logger[_0xf6f7('0x30')](_0x3d103c[_0xf6f7('0x37')]);return _0x54228d(_0x2f4955[_0xf6f7('0x30')](0x1f4,_0x3d103c));}}logger['error'](_0xf6f7('0x3f'));return _0x54228d(_0x2f4955[_0xf6f7('0x30')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x5739e6){var _0x1b3e04=this;return new Promise(function(_0x418098,_0x50bacc){if(_0x568242[_0xf6f7('0x3a')]['hasOwnProperty'](_0x5739e6['id'])){for(var _0x1ecbc4 in _0x5739e6[_0xf6f7('0x41')]){if(_0x5739e6[_0xf6f7('0x41')][_0xf6f7('0x42')](_0x1ecbc4)){if(_0x568242[_0xf6f7('0x3a')][_0x5739e6['id']][_0xf6f7('0x42')](_0x1ecbc4+_0xf6f7('0x43'))){_0x568242[_0xf6f7('0x3a')][_0x5739e6['id']][_0x1ecbc4+'CurrentCapacity']=parseInt(_0x5739e6['capacity'][_0x1ecbc4],0xa);}}}_0x568242['agents'][_0x5739e6['id']][_0xf6f7('0x44')]();return _0x418098({'code':0xc8,'message':_0x568242[_0xf6f7('0x3a')][_0x5739e6['id']]});}else{return _0x50bacc(_0x1b3e04[_0xf6f7('0x30')](0x1f4,_0xf6f7('0x45')));}});},'Agents':function(_0x552fa6){return new Promise(function(_0x30d9c2,_0x4e6415){var _0x117ec1=_[_0xf6f7('0x46')](_0x568242[_0xf6f7('0x3a')]);_0x30d9c2({'count':_0x117ec1[_0xf6f7('0x18')],'rows':_0x117ec1});});},'ChatQueues':function(_0x48b3d2){return new Promise(function(_0x1e43c4,_0x2dbddd){var _0x478192=[];for(var _0x114cd7 in _0x568242[_0xf6f7('0x47')]){if(_0x568242[_0xf6f7('0x47')][_0xf6f7('0x42')](_0x114cd7)){var _0x48d456=_0x568242['chatQueues'][_0x114cd7];var _0x4b95d7={'id':_0x48d456['id'],'available':_0x48d456[_0xf6f7('0x48')],'loggedIn':_0x48d456[_0xf6f7('0x49')],'name':_0x48d456[_0xf6f7('0x4a')],'paused':_0x48d456[_0xf6f7('0x4b')],'waiting':_0x48d456[_0xf6f7('0x4c')]};_0x478192[_0xf6f7('0x1e')](_0x4b95d7);}}_0x1e43c4({'count':_0x478192[_0xf6f7('0x18')],'rows':_0x478192});});},'MailQueues':function(_0x49f95e){return new Promise(function(_0x4a8602,_0x2a8a87){var _0x2cfbf2=[];for(var _0x590a81 in _0x568242[_0xf6f7('0x4d')]){if(_0x568242['mailQueues']['hasOwnProperty'](_0x590a81)){var _0x4ff721=_0x568242[_0xf6f7('0x4d')][_0x590a81];var _0xcc7bec={'id':_0x4ff721['id'],'available':_0x4ff721[_0xf6f7('0x48')],'loggedIn':_0x4ff721[_0xf6f7('0x49')],'name':_0x4ff721[_0xf6f7('0x4a')],'paused':_0x4ff721[_0xf6f7('0x4b')],'waiting':_0x4ff721[_0xf6f7('0x4c')]};_0x2cfbf2[_0xf6f7('0x1e')](_0xcc7bec);}}_0x4a8602({'count':_0x2cfbf2[_0xf6f7('0x18')],'rows':_0x2cfbf2});});},'OpenchannelQueues':function(_0x161bb2){return new Promise(function(_0x12a8e1,_0x63854b){var _0x50adff=[];for(var _0x504b0d in _0x568242[_0xf6f7('0x4e')]){if(_0x568242['openchannelQueues'][_0xf6f7('0x42')](_0x504b0d)){var _0x1de0ef=_0x568242[_0xf6f7('0x4e')][_0x504b0d];var _0x51bbdd={'id':_0x1de0ef['id'],'available':_0x1de0ef[_0xf6f7('0x48')],'loggedIn':_0x1de0ef[_0xf6f7('0x49')],'name':_0x1de0ef[_0xf6f7('0x4a')],'paused':_0x1de0ef[_0xf6f7('0x4b')],'waiting':_0x1de0ef['waiting']};_0x50adff[_0xf6f7('0x1e')](_0x51bbdd);}}_0x12a8e1({'count':_0x50adff[_0xf6f7('0x18')],'rows':_0x50adff});});},'SmsQueues':function(_0x4892f1){return new Promise(function(_0x584ac9,_0x1012dd){var _0x4a8a51=[];for(var _0x5c525d in _0x568242[_0xf6f7('0x4f')]){if(_0x568242['smsQueues'][_0xf6f7('0x42')](_0x5c525d)){var _0x3db0f6=_0x568242[_0xf6f7('0x4f')][_0x5c525d];var _0x4f208e={'id':_0x3db0f6['id'],'available':_0x3db0f6[_0xf6f7('0x48')],'loggedIn':_0x3db0f6[_0xf6f7('0x49')],'name':_0x3db0f6[_0xf6f7('0x4a')],'paused':_0x3db0f6['paused'],'waiting':_0x3db0f6[_0xf6f7('0x4c')]};_0x4a8a51['push'](_0x4f208e);}}_0x584ac9({'count':_0x4a8a51[_0xf6f7('0x18')],'rows':_0x4a8a51});});},'FaxQueues':function(_0x2c1ac8){return new Promise(function(_0x453fc6,_0x27c118){var _0x31ca78=[];for(var _0x34a616 in _0x568242['faxQueues']){if(_0x568242['faxQueues'][_0xf6f7('0x42')](_0x34a616)){var _0x29fb2b=_0x568242['faxQueues'][_0x34a616];var _0x538245={'id':_0x29fb2b['id'],'available':_0x29fb2b[_0xf6f7('0x48')],'loggedIn':_0x29fb2b[_0xf6f7('0x49')],'name':_0x29fb2b[_0xf6f7('0x4a')],'paused':_0x29fb2b[_0xf6f7('0x4b')],'waiting':_0x29fb2b[_0xf6f7('0x4c')]};_0x31ca78[_0xf6f7('0x1e')](_0x538245);}}_0x453fc6({'count':_0x31ca78['length'],'rows':_0x31ca78});});},'WhatsappQueues':function(_0x1fabcf){return new Promise(function(_0x3bba6c,_0xf5a3ae){var _0x139e10=[];for(var _0x6c3ced in _0x568242['whatsappQueues']){if(_0x568242[_0xf6f7('0x50')][_0xf6f7('0x42')](_0x6c3ced)){var _0x5add61=_0x568242[_0xf6f7('0x50')][_0x6c3ced];var _0x1eb0fc={'id':_0x5add61['id'],'available':_0x5add61[_0xf6f7('0x48')],'loggedIn':_0x5add61[_0xf6f7('0x49')],'name':_0x5add61[_0xf6f7('0x4a')],'paused':_0x5add61[_0xf6f7('0x4b')],'waiting':_0x5add61[_0xf6f7('0x4c')]};_0x139e10['push'](_0x1eb0fc);}}_0x3bba6c({'count':_0x139e10[_0xf6f7('0x18')],'rows':_0x139e10});});},'ChatQueuesWaitingInteractions':function(_0x4ae29b){return new Promise(function(_0x5c26ff,_0x19923d){var _0x240e0f=_[_0xf6f7('0x46')](_0x568242['chatQueuesWaitingInteractions']);_0x5c26ff({'count':_0x240e0f[_0xf6f7('0x18')],'rows':_0x240e0f});});},'MailQueuesWaitingInteractions':function(_0x2770da){return new Promise(function(_0x40c872,_0x422efb){var _0x338b1b=_[_0xf6f7('0x46')](_0x568242[_0xf6f7('0x51')]);_0x40c872({'count':_0x338b1b[_0xf6f7('0x18')],'rows':_0x338b1b});});},'OpenchannelQueuesWaitingInteractions':function(_0xe5b080){return new Promise(function(_0x5649d9,_0x488799){var _0x15d19a=_[_0xf6f7('0x46')](_0x568242[_0xf6f7('0x52')]);_0x5649d9({'count':_0x15d19a['length'],'rows':_0x15d19a});});},'SmsQueuesWaitingInteractions':function(_0x296223){return new Promise(function(_0x184511,_0x3ea4a8){var _0x2a24d8=_[_0xf6f7('0x46')](_0x568242[_0xf6f7('0x53')]);_0x184511({'count':_0x2a24d8[_0xf6f7('0x18')],'rows':_0x2a24d8});});},'FaxQueuesWaitingInteractions':function(_0x14a628){return new Promise(function(_0x4e93f5,_0x3c7c6d){var _0xbeeef1=_['values'](_0x568242['faxQueuesWaitingInteractions']);_0x4e93f5({'count':_0xbeeef1[_0xf6f7('0x18')],'rows':_0xbeeef1});});},'WhatsappQueuesWaitingInteractions':function(_0x5bd8f7){return new Promise(function(_0x5f3f1b,_0x527189){var _0x17e316=_[_0xf6f7('0x46')](_0x568242[_0xf6f7('0x54')]);_0x5f3f1b({'count':_0x17e316[_0xf6f7('0x18')],'rows':_0x17e316});});}};var _0x43fbb2=jayson[_0xf6f7('0x55')](_0x57c323)[_0xf6f7('0x56')]();_0x43fbb2['on'](_0xf6f7('0x30'),function(_0x103cfd){logger[_0xf6f7('0x30')](JSON[_0xf6f7('0x57')](_0x103cfd));return _0x87ae1a(_0x103cfd);});_0x43fbb2[_0xf6f7('0x58')](0x232c,'127.0.0.1',function(){console[_0xf6f7('0x59')](_0xf6f7('0x5a'),0x232c);return _0x4f8d9b('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xd58c=['faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','127.0.0.1','log','lodash','util','path','bluebird','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','.js','toLowerCase','autoreply','mail','push','slice','appdata','split','dialogflowv2','tag','TagId','%s:%s:%s','condition','intervals','./applications/','app','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','matchPath','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions'];(function(_0x19103c,_0x4c6c0d){var _0x371d15=function(_0x73c0f6){while(--_0x73c0f6){_0x19103c['push'](_0x19103c['shift']());}};_0x371d15(++_0x4c6c0d);}(_0xd58c,0xb6));var _0xcd58=function(_0x7490db,_0x474cd1){_0x7490db=_0x7490db-0x0;var _0x1e8589=_0xd58c[_0x7490db];return _0x1e8589;};'use strict';var _=require(_0xcd58('0x0'));var util=require(_0xcd58('0x1'));var path=require(_0xcd58('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xcd58('0x3'));var uuid=require('uuid');var config=require(_0xcd58('0x4'));var logger=require('../../../config/logger')(_0xcd58('0x5'));var rpc={'openchannelQueueReport':require(_0xcd58('0x6')),'mailQueueReport':require(_0xcd58('0x7')),'chatQueueReport':require(_0xcd58('0x8')),'smsQueueReport':require(_0xcd58('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xcd58('0xa'));function getId(_0x31bf4e,_0x43a501,_0x1ff4e9){return util[_0xcd58('0xb')]('%s.%s.%s',_0x31bf4e,_0x43a501||0x0,_0x1ff4e9||0x0);}function getIntervals(_0x1ad5a1,_0x43732a){var _0x5694e1=[];if(!_[_0xcd58('0xc')](_0x43732a['IntervalId'])&&!_[_0xcd58('0xc')](_0x1ad5a1[_0x43732a[_0xcd58('0xd')]])&&!_[_0xcd58('0xc')](_0x1ad5a1[_0x43732a['IntervalId']][_0xcd58('0xe')])){_0x5694e1=_['map'](_0x1ad5a1[_0x43732a[_0xcd58('0xd')]]['Intervals'],_0xcd58('0xf'));}else if(!_[_0xcd58('0xc')](_0x43732a[_0xcd58('0xf')])){_0x5694e1=[_0x43732a[_0xcd58('0xf')]];}return _0x5694e1;}exports[_0xcd58('0x10')]=function(_0x202412){_0x202412[_0xcd58('0x11')]={};return new BPromise(function(_0x3376f3,_0x4d9a56){var _0x5d0aa3={'Start':function(_0x3ce190){var _0xa225e3=this;return new Promise(function(_0x3d5e86,_0x51f5b6){if(_0x3ce190){try{var _0x515fc3=[];var _0xea2532=getId(_0x3ce190[_0xcd58('0x12')],_0x3ce190[_0xcd58('0x13')]?_0x3ce190['message']['id']:0x0,_0x3ce190['interaction']?_0x3ce190[_0xcd58('0x14')]['id']:0x0);if(_0x3ce190['applications']&&_[_0xcd58('0x15')](_0x3ce190[_0xcd58('0x16')])&&_0x3ce190[_0xcd58('0x16')][_0xcd58('0x17')]){for(var _0x491198=0x0;_0x491198<_0x3ce190[_0xcd58('0x16')]['length'];_0x491198+=0x1){var _0x4b106f=_0x3ce190['applications'][_0x491198];if(fs[_0xcd58('0x18')](path[_0xcd58('0x19')](__dirname,_0xcd58('0x16'),_0x4b106f['app']+_0xcd58('0x1a')))){var _0x2a8681=[];switch(_0x4b106f['app'][_0xcd58('0x1b')]()){case _0xcd58('0x1c'):var _0x3225a5=_0x4b106f['appdata']['split'](',');if(_0x3ce190[_0xcd58('0x12')]===_0xcd58('0x1d')){_0x2a8681[_0xcd58('0x1e')](_0x3225a5[0x0]);_0x2a8681[_0xcd58('0x1e')](_0x3225a5[0x1]);_0x2a8681[_0xcd58('0x1e')](_0x3225a5[_0xcd58('0x1f')](0x2,_0x3225a5[_0xcd58('0x17')])['join'](','));}else{_0x2a8681['push'](_0x3225a5[0x0]);_0x2a8681[_0xcd58('0x1e')](_0x3225a5[_0xcd58('0x1f')](0x1,_0x3225a5['length'])[_0xcd58('0x19')](','));}break;case'dialogflow':var _0x26bb62=_0x4b106f[_0xcd58('0x20')][_0xcd58('0x21')](',');_0x2a8681[_0xcd58('0x1e')](_0x26bb62[0x0]);_0x2a8681[_0xcd58('0x1e')](_0x26bb62[0x1]);_0x2a8681[_0xcd58('0x1e')](_0x26bb62['slice'](0x2,_0x26bb62[_0xcd58('0x17')])['join'](','));break;case _0xcd58('0x22'):var _0x5e1b62=_0x4b106f[_0xcd58('0x20')]['split'](',');_0x2a8681[_0xcd58('0x1e')](_0x5e1b62[0x0]);_0x2a8681['push'](_0x5e1b62[0x1]);_0x2a8681[_0xcd58('0x1e')](_0x5e1b62[0x2]);_0x2a8681[_0xcd58('0x1e')](_0x5e1b62[0x3]);_0x2a8681[_0xcd58('0x1e')](_0x5e1b62[_0xcd58('0x1f')](0x4,_0x5e1b62['length'])[_0xcd58('0x19')](','));break;case'amazonlex':var _0x1ce30b=_0x4b106f[_0xcd58('0x20')][_0xcd58('0x21')](',');_0x2a8681[_0xcd58('0x1e')](_0x1ce30b[0x0]);_0x2a8681[_0xcd58('0x1e')](_0x1ce30b[0x1]);_0x2a8681[_0xcd58('0x1e')](_0x1ce30b[0x2]);_0x2a8681['push'](_0x1ce30b[0x3]);_0x2a8681['push'](_0x1ce30b[_0xcd58('0x1f')](0x4,_0x1ce30b['length'])['join'](','));break;case _0xcd58('0x13'):_0x2a8681[_0xcd58('0x1e')](_0x4b106f[_0xcd58('0x20')]);break;case _0xcd58('0x23'):_0x2a8681[_0xcd58('0x1e')](_0x4b106f[_0xcd58('0x24')]);_0x2a8681['push'](_0x4b106f['appdata']);break;default:_0x2a8681=_[_0xcd58('0xc')](_0x4b106f[_0xcd58('0x20')])?[]:_0x4b106f[_0xcd58('0x20')]['split'](',');}var _0x127772={'id':util[_0xcd58('0xb')](_0xcd58('0x25'),_0xea2532,_0x4b106f['id'],_0x4b106f['app']),'condition':require('./interval')[_0xcd58('0x26')](_0xea2532,getIntervals(_0x202412[_0xcd58('0x27')],_0x4b106f),_0x202412),'consequence':require(_0xcd58('0x28')+_0x4b106f[_0xcd58('0x29')])[_0xcd58('0x2a')](_0xea2532,_0x2a8681,_0x202412,_0x3ce190),'p':_0x4b106f[_0xcd58('0x2b')]||0x0};logger[_0xcd58('0x2c')](_0xcd58('0x2d'),_0x127772['id'],_0xcd58('0x2e'),getIntervals(_0x202412[_0xcd58('0x27')],_0x4b106f)[_0xcd58('0x19')](_0xcd58('0x2f')));_0x515fc3[_0xcd58('0x1e')](_0x127772);}else{logger[_0xcd58('0x30')](_0xcd58('0x31'),path[_0xcd58('0x19')](__dirname,_0xcd58('0x16'),_0x4b106f[_0xcd58('0x29')]+_0xcd58('0x1a')));}}_0x202412[_0xcd58('0x11')][_0xea2532]=new RuleEngine(_0x515fc3);_0x202412[_0xcd58('0x11')][_0xea2532]['execute'](_0x3ce190,function(_0x2a8fe6){logger[_0xcd58('0x2c')](_0xcd58('0x32'),JSON['stringify'](_0x2a8fe6[_0xcd58('0x33')]));if(_0x202412[_0xcd58('0x11')][_0xea2532]){_0x202412['rules'][_0xea2532][_0xcd58('0x34')]('complete');}});return _0x3d5e86({'code':0xc8,'message':_0x3ce190});}else{logger['info'](_0xcd58('0x35'));return _0x3d5e86({'code':0xc8,'message':_0x3ce190});}}catch(_0x4ca4b6){logger['error'](_0x4ca4b6[_0xcd58('0x36')]);return _0x51f5b6(_0xa225e3[_0xcd58('0x30')](0x1f4,_0x4ca4b6));}}return _0x51f5b6(_0xcd58('0x37'));});},'AcceptMessage':function(_0x52e7b1){var _0x50520b=this;return new Promise(function(_0x257cee,_0x55fdf9){if(_0x52e7b1[_0xcd58('0x38')]&&_0x52e7b1[_0xcd58('0x38')]['id']){if(_0x202412['agents'][_0x52e7b1['agent']['id']]){_0x202412[_0xcd58('0x39')][_0x52e7b1[_0xcd58('0x38')]['id']][_0xcd58('0x3a')]=![];_0x202412[_0xcd58('0x39')][_0x52e7b1[_0xcd58('0x38')]['id']][_0xcd58('0x3b')]=undefined;}}if(_0x52e7b1[_0xcd58('0x13')]&&_0x52e7b1[_0xcd58('0x13')]['id']){try{var _0x39d6a5=getId(_0x52e7b1[_0xcd58('0x12')],_0x52e7b1[_0xcd58('0x13')]?_0x52e7b1[_0xcd58('0x13')]['id']:0x0,_0x52e7b1[_0xcd58('0x14')]?_0x52e7b1['interaction']['id']:0x0);if(_0x202412[_0xcd58('0x11')][_0x39d6a5]){_0x202412[_0xcd58('0x11')][_0x39d6a5][_0xcd58('0x34')]('end');if(rpc[_0x52e7b1[_0xcd58('0x12')]+_0xcd58('0x3c')]){rpc[_0x52e7b1[_0xcd58('0x12')]+_0xcd58('0x3c')]['update'](_0x39d6a5,{'UserId':_0x52e7b1[_0xcd58('0x13')][_0xcd58('0x3d')]})[_0xcd58('0x3e')](function(_0x13e0cb){logger[_0xcd58('0x30')](_0xcd58('0x3f'));});}}return _0x257cee({'code':0xc8,'message':_0x52e7b1});}catch(_0x339990){logger[_0xcd58('0x30')](_0x339990[_0xcd58('0x36')]);return _0x55fdf9(_0x50520b[_0xcd58('0x30')](0x1f4,_0x339990));}}logger['error'](_0xcd58('0x40'));return _0x55fdf9(_0x50520b[_0xcd58('0x30')](0x1f4,_0xcd58('0x40')));});},'RejectMessage':function(_0x1ead66){var _0x2bd4c9=this;return new Promise(function(_0x435e95,_0x11aa04){if(_0x1ead66[_0xcd58('0x38')]&&_0x1ead66[_0xcd58('0x38')]['id']){try{if(_0x202412[_0xcd58('0x39')][_0x1ead66[_0xcd58('0x38')]['id']]){_0x202412[_0xcd58('0x39')][_0x1ead66['agent']['id']][_0xcd58('0x3a')]=![];_0x202412[_0xcd58('0x39')][_0x1ead66['agent']['id']][_0xcd58('0x3b')]=undefined;}return _0x435e95({'code':0xc8,'message':_0x1ead66});}catch(_0x2cb2e4){logger[_0xcd58('0x30')](_0x2cb2e4[_0xcd58('0x36')]);return _0x11aa04(_0x2bd4c9[_0xcd58('0x30')](0x1f4,_0x2cb2e4));}}logger[_0xcd58('0x30')]('message\x20is\x20empty');return _0x11aa04(_0x2bd4c9['error'](0x1f4,_0xcd58('0x40')));});},'AbandonInteraction':function(_0x50aebc){var _0x3c8076=this;return new Promise(function(_0xfb3f8a,_0x3eb747){if(_0x50aebc[_0xcd58('0x12')]&&_0x50aebc['interaction']&&_0x50aebc['interaction']['id']){try{var _0xca188b=getId(_0x50aebc['channel'],_0x50aebc['message']?_0x50aebc[_0xcd58('0x13')]['id']:0x0,_0x50aebc[_0xcd58('0x14')]?_0x50aebc[_0xcd58('0x14')]['id']:0x0);if(_0x202412[_0xcd58('0x11')][_0xca188b]){_0x202412['rules'][_0xca188b][_0xcd58('0x34')]('end');}return _0xfb3f8a({'code':0xc8,'message':_0x50aebc});}catch(_0x597dbb){logger[_0xcd58('0x30')](_0x597dbb[_0xcd58('0x36')]);return _0x3eb747(_0x3c8076['error'](0x1f4,_0x597dbb));}}logger[_0xcd58('0x30')]('message\x20is\x20empty');return _0x3eb747(_0x3c8076[_0xcd58('0x30')](0x1f4,_0xcd58('0x40')));});},'AgentCapacity':function(_0x395bd3){var _0x37ac17=this;return new Promise(function(_0x396494,_0x35d542){if(_0x202412[_0xcd58('0x39')][_0xcd58('0x41')](_0x395bd3['id'])){for(var _0x28bbe2 in _0x395bd3[_0xcd58('0x42')]){if(_0x395bd3[_0xcd58('0x42')][_0xcd58('0x41')](_0x28bbe2)){if(_0x202412['agents'][_0x395bd3['id']][_0xcd58('0x41')](_0x28bbe2+'CurrentCapacity')){_0x202412[_0xcd58('0x39')][_0x395bd3['id']][_0x28bbe2+_0xcd58('0x43')]=parseInt(_0x395bd3[_0xcd58('0x42')][_0x28bbe2],0xa);}}}_0x202412[_0xcd58('0x39')][_0x395bd3['id']]['updateRealtime']();return _0x396494({'code':0xc8,'message':_0x202412[_0xcd58('0x39')][_0x395bd3['id']]});}else{return _0x35d542(_0x37ac17[_0xcd58('0x30')](0x1f4,_0xcd58('0x44')));}});},'Agents':function(_0x3a2b91){return new Promise(function(_0x4fa046,_0x5ab979){var _0x2bd97b=_[_0xcd58('0x45')](_0x202412[_0xcd58('0x39')]);_0x4fa046({'count':_0x2bd97b[_0xcd58('0x17')],'rows':_0x2bd97b});});},'ChatQueues':function(_0x1bc69c){return new Promise(function(_0x10cf46,_0x40fda7){var _0x545308=[];for(var _0x34a9ae in _0x202412[_0xcd58('0x46')]){if(_0x202412[_0xcd58('0x46')][_0xcd58('0x41')](_0x34a9ae)){var _0x3a4699=_0x202412[_0xcd58('0x46')][_0x34a9ae];var _0xade741={'id':_0x3a4699['id'],'available':_0x3a4699[_0xcd58('0x47')],'loggedIn':_0x3a4699[_0xcd58('0x48')],'name':_0x3a4699[_0xcd58('0x49')],'paused':_0x3a4699[_0xcd58('0x4a')],'waiting':_0x3a4699[_0xcd58('0x4b')]};_0x545308[_0xcd58('0x1e')](_0xade741);}}_0x10cf46({'count':_0x545308[_0xcd58('0x17')],'rows':_0x545308});});},'MailQueues':function(_0x109d75){return new Promise(function(_0x322466,_0x11a622){var _0x4b5a56=[];for(var _0x1fabb8 in _0x202412[_0xcd58('0x4c')]){if(_0x202412[_0xcd58('0x4c')][_0xcd58('0x41')](_0x1fabb8)){var _0x587aad=_0x202412[_0xcd58('0x4c')][_0x1fabb8];var _0x17ac6b={'id':_0x587aad['id'],'available':_0x587aad[_0xcd58('0x47')],'loggedIn':_0x587aad[_0xcd58('0x48')],'name':_0x587aad[_0xcd58('0x49')],'paused':_0x587aad['paused'],'waiting':_0x587aad[_0xcd58('0x4b')]};_0x4b5a56[_0xcd58('0x1e')](_0x17ac6b);}}_0x322466({'count':_0x4b5a56[_0xcd58('0x17')],'rows':_0x4b5a56});});},'OpenchannelQueues':function(_0x1cc739){return new Promise(function(_0x3a13ab,_0x408989){var _0x1bc688=[];for(var _0x2934e5 in _0x202412[_0xcd58('0x4d')]){if(_0x202412[_0xcd58('0x4d')]['hasOwnProperty'](_0x2934e5)){var _0x4d4853=_0x202412[_0xcd58('0x4d')][_0x2934e5];var _0x39c9c8={'id':_0x4d4853['id'],'available':_0x4d4853[_0xcd58('0x47')],'loggedIn':_0x4d4853['loggedIn'],'name':_0x4d4853[_0xcd58('0x49')],'paused':_0x4d4853[_0xcd58('0x4a')],'waiting':_0x4d4853['waiting']};_0x1bc688[_0xcd58('0x1e')](_0x39c9c8);}}_0x3a13ab({'count':_0x1bc688[_0xcd58('0x17')],'rows':_0x1bc688});});},'SmsQueues':function(_0x25144d){return new Promise(function(_0x2139ca,_0x3cbe05){var _0x3c3f38=[];for(var _0xab6ee in _0x202412[_0xcd58('0x4e')]){if(_0x202412['smsQueues']['hasOwnProperty'](_0xab6ee)){var _0x104aa2=_0x202412['smsQueues'][_0xab6ee];var _0x33807d={'id':_0x104aa2['id'],'available':_0x104aa2['available'],'loggedIn':_0x104aa2[_0xcd58('0x48')],'name':_0x104aa2[_0xcd58('0x49')],'paused':_0x104aa2[_0xcd58('0x4a')],'waiting':_0x104aa2[_0xcd58('0x4b')]};_0x3c3f38['push'](_0x33807d);}}_0x2139ca({'count':_0x3c3f38[_0xcd58('0x17')],'rows':_0x3c3f38});});},'FaxQueues':function(_0x22199f){return new Promise(function(_0x4e03b6,_0xa89f04){var _0x31881b=[];for(var _0x2d6180 in _0x202412[_0xcd58('0x4f')]){if(_0x202412['faxQueues'][_0xcd58('0x41')](_0x2d6180)){var _0x62b41b=_0x202412[_0xcd58('0x4f')][_0x2d6180];var _0xfa5d13={'id':_0x62b41b['id'],'available':_0x62b41b['available'],'loggedIn':_0x62b41b[_0xcd58('0x48')],'name':_0x62b41b['name'],'paused':_0x62b41b[_0xcd58('0x4a')],'waiting':_0x62b41b[_0xcd58('0x4b')]};_0x31881b[_0xcd58('0x1e')](_0xfa5d13);}}_0x4e03b6({'count':_0x31881b[_0xcd58('0x17')],'rows':_0x31881b});});},'WhatsappQueues':function(_0xcfc57a){return new Promise(function(_0x4ea78c,_0x4173f8){var _0x13922c=[];for(var _0x4dc0fe in _0x202412[_0xcd58('0x50')]){if(_0x202412['whatsappQueues'][_0xcd58('0x41')](_0x4dc0fe)){var _0xfe586=_0x202412[_0xcd58('0x50')][_0x4dc0fe];var _0x2711e3={'id':_0xfe586['id'],'available':_0xfe586[_0xcd58('0x47')],'loggedIn':_0xfe586[_0xcd58('0x48')],'name':_0xfe586[_0xcd58('0x49')],'paused':_0xfe586['paused'],'waiting':_0xfe586[_0xcd58('0x4b')]};_0x13922c[_0xcd58('0x1e')](_0x2711e3);}}_0x4ea78c({'count':_0x13922c[_0xcd58('0x17')],'rows':_0x13922c});});},'ChatQueuesWaitingInteractions':function(_0xf0ae68){return new Promise(function(_0x374f9a,_0x4047dd){var _0xf5e38d=_[_0xcd58('0x45')](_0x202412[_0xcd58('0x51')]);_0x374f9a({'count':_0xf5e38d[_0xcd58('0x17')],'rows':_0xf5e38d});});},'MailQueuesWaitingInteractions':function(_0x629625){return new Promise(function(_0x3560d0,_0x5543e1){var _0x4a8d06=_[_0xcd58('0x45')](_0x202412[_0xcd58('0x52')]);_0x3560d0({'count':_0x4a8d06[_0xcd58('0x17')],'rows':_0x4a8d06});});},'OpenchannelQueuesWaitingInteractions':function(_0x11bea2){return new Promise(function(_0x202d96,_0x46dfaa){var _0x316bec=_['values'](_0x202412[_0xcd58('0x53')]);_0x202d96({'count':_0x316bec[_0xcd58('0x17')],'rows':_0x316bec});});},'SmsQueuesWaitingInteractions':function(_0x4be5bf){return new Promise(function(_0x18baef,_0x1197f0){var _0x129eec=_[_0xcd58('0x45')](_0x202412[_0xcd58('0x54')]);_0x18baef({'count':_0x129eec[_0xcd58('0x17')],'rows':_0x129eec});});},'FaxQueuesWaitingInteractions':function(_0x1b22d0){return new Promise(function(_0x2e9b5b,_0x3e5efa){var _0x47dd06=_['values'](_0x202412[_0xcd58('0x55')]);_0x2e9b5b({'count':_0x47dd06['length'],'rows':_0x47dd06});});},'WhatsappQueuesWaitingInteractions':function(_0x4b81e1){return new Promise(function(_0x353d9e,_0x580637){var _0x4d4e4b=_[_0xcd58('0x45')](_0x202412[_0xcd58('0x56')]);_0x353d9e({'count':_0x4d4e4b[_0xcd58('0x17')],'rows':_0x4d4e4b});});}};var _0x400844=jayson['server'](_0x5d0aa3)['http']();_0x400844['on']('error',function(_0x11e950){logger[_0xcd58('0x30')](JSON['stringify'](_0x11e950));return _0x4d9a56(_0x11e950);});_0x400844[_0xcd58('0x10')](0x232c,_0xcd58('0x57'),function(){console[_0xcd58('0x58')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3376f3('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 9f4abc6..f1826ac 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 _0xc6cb=['request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http'];(function(_0x4d585f,_0x184101){var _0x537af8=function(_0x191c73){while(--_0x191c73){_0x4d585f['push'](_0x4d585f['shift']());}};_0x537af8(++_0x184101);}(_0xc6cb,0x79));var _0xbc6c=function(_0x2a8925,_0x7245af){_0x2a8925=_0x2a8925-0x0;var _0x38c067=_0xc6cb[_0x2a8925];return _0x38c067;};'use strict';var util=require('util');var BPromise=require(_0xbc6c('0x0'));var jayson=require(_0xbc6c('0x1'));var _=require(_0xbc6c('0x2'));var logger=require(_0xbc6c('0x3'))(_0xbc6c('0x4'));var client=jayson[_0xbc6c('0x5')][_0xbc6c('0x6')]({'port':0x232a});function request(_0x56bca0,_0x25276e){return new BPromise(function(_0x260cfd,_0x566722){return client[_0xbc6c('0x7')](_0x56bca0,_0x25276e)[_0xbc6c('0x8')](function(_0x35a147){if(_0x35a147[_0xbc6c('0x9')]){return _0x566722(_0x35a147['error']['message']);}else{return _0x260cfd(_0x35a147[_0xbc6c('0xa')]);}})[_0xbc6c('0xb')](function(_0x29f0f3){return _0x566722(_0x29f0f3);});});}exports[_0xbc6c('0xc')]=function(_0x3508aa,_0x19847c,_0x3b932c){return function(_0x3c1c65){if(_0x3b932c[_0xbc6c('0xd')]&&!_0x3b932c['rules'][_0x3508aa]){logger[_0xbc6c('0xe')](_0xbc6c('0xf'),_0x3508aa);return _0x3c1c65[_0xbc6c('0x10')]();}var _0x476c83=[];for(var _0x51cccd=0x0;_0x51cccd<_0x19847c[_0xbc6c('0x11')];_0x51cccd+=0x1){_0x476c83[_0xbc6c('0x12')](request(_0xbc6c('0x13'),{'command':util['format'](_0xbc6c('0x14'),_0x19847c[_0x51cccd])})[_0xbc6c('0x8')](function(_0x12e789){return _0x12e789&&_0x12e789[_0xbc6c('0x15')]&&_0x12e789[_0xbc6c('0x15')][_0xbc6c('0x16')](_0xbc6c('0x17'))>=0x0?!![]:![];})[_0xbc6c('0xb')](function(_0x1bbbbe){logger['error'](_0xbc6c('0x18'),_0x3508aa,_0x19847c[_0x51cccd]);}));}BPromise[_0xbc6c('0x19')](_0x476c83)[_0xbc6c('0x8')](function(_0x24d77f){var _0x42a5a7=_[_0xbc6c('0x1a')](_0x24d77f);logger[_0xbc6c('0xe')](_0xbc6c('0x1b'),_0x3508aa,_0x19847c[_0xbc6c('0x1c')](_0xbc6c('0x1d')),_0x42a5a7);_0x3c1c65['when'](_0x42a5a7);})[_0xbc6c('0xb')](function(_0x194520){console[_0xbc6c('0x1e')](_0x194520);logger[_0xbc6c('0x9')](_0xbc6c('0x1b'),_0x3508aa,_0x19847c[_0xbc6c('0x1c')](_0xbc6c('0x1d')),_0x194520[_0xbc6c('0x1f')]);_0x3c1c65[_0xbc6c('0x10')]();});};}; \ No newline at end of file +var _0x4710=['[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','join','util','../../../config/logger','routing','client','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','message','indexOf','true','[%s][INTERVAL]\x20%s','all'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x4710,0x1ad));var _0x0471=function(_0x43014a,_0x2ecd1e){_0x43014a=_0x43014a-0x0;var _0x5579fa=_0x4710[_0x43014a];return _0x5579fa;};'use strict';var util=require(_0x0471('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x0471('0x1'))(_0x0471('0x2'));var client=jayson[_0x0471('0x3')]['http']({'port':0x232a});function request(_0x30e8bf,_0x621fd6){return new BPromise(function(_0x325a58,_0x3a90af){return client['request'](_0x30e8bf,_0x621fd6)[_0x0471('0x4')](function(_0x36b3a8){if(_0x36b3a8[_0x0471('0x5')]){return _0x3a90af(_0x36b3a8['error']['message']);}else{return _0x325a58(_0x36b3a8[_0x0471('0x6')]);}})[_0x0471('0x7')](function(_0x4d2052){return _0x3a90af(_0x4d2052);});});}exports[_0x0471('0x8')]=function(_0x55eadc,_0x28aa26,_0x1bae5b){return function(_0x42590c){if(_0x1bae5b[_0x0471('0x9')]&&!_0x1bae5b['rules'][_0x55eadc]){logger[_0x0471('0xa')](_0x0471('0xb'),_0x55eadc);return _0x42590c[_0x0471('0xc')]();}var _0x7a5147=[];for(var _0xd0e608=0x0;_0xd0e608<_0x28aa26['length'];_0xd0e608+=0x1){_0x7a5147[_0x0471('0xd')](request(_0x0471('0xe'),{'command':util[_0x0471('0xf')]('iftime\x20%s',_0x28aa26[_0xd0e608])})['then'](function(_0x287b36){return _0x287b36&&_0x287b36[_0x0471('0x10')]&&_0x287b36[_0x0471('0x10')][_0x0471('0x11')](_0x0471('0x12'))>=0x0?!![]:![];})['catch'](function(_0x59220a){logger['error'](_0x0471('0x13'),_0x55eadc,_0x28aa26[_0xd0e608]);}));}BPromise[_0x0471('0x14')](_0x7a5147)[_0x0471('0x4')](function(_0x46a66c){var _0x4676fd=_['some'](_0x46a66c);logger[_0x0471('0xa')](_0x0471('0x15'),_0x55eadc,_0x28aa26['join'](_0x0471('0x16')),_0x4676fd);_0x42590c[_0x0471('0x17')](_0x4676fd);})[_0x0471('0x7')](function(_0x3e4dca){console['log'](_0x3e4dca);logger[_0x0471('0x5')](_0x0471('0x15'),_0x55eadc,_0x28aa26[_0x0471('0x18')](_0x0471('0x16')),_0x3e4dca['stack']);_0x42590c['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 8f17f33..2379951 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 _0xe589=['error','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','connectedlinenum','lastevent','type','agentacw','agentcomplete','acw','acwtime','CreateVoiceAgentReport','request','uniqueid','agentcalled','debug','format','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push'];(function(_0x4cda32,_0x27e02d){var _0x13eb96=function(_0x59359e){while(--_0x59359e){_0x4cda32['push'](_0x4cda32['shift']());}};_0x13eb96(++_0x27e02d);}(_0xe589,0x142));var _0x9e58=function(_0x5ee4c3,_0x43a703){_0x5ee4c3=_0x5ee4c3-0x0;var _0x20d5e3=_0xe589[_0x5ee4c3];return _0x20d5e3;};'use strict';var _=require(_0x9e58('0x0'));var util=require('util');var utils=require(_0x9e58('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1775f9,_0x43afe9){utils[_0x9e58('0x2')](util['format'](_0x9e58('0x3'),_0x1775f9['uniqueid'],_0x1775f9[_0x9e58('0x4')],_0x1775f9[_0x9e58('0x5')],_0x1775f9[_0x9e58('0x6')],_0x1775f9['interface'],_0x1775f9['calleridnum'],_0x1775f9[_0x9e58('0x7')],_0x1775f9[_0x9e58('0x8')]));if(_0x1775f9[_0x9e58('0x5')]){utils['getVoiceQueueByName'](_0x1775f9[_0x9e58('0x5')])['then'](function(_0x68f7ab){if(_0x68f7ab){_0x1775f9['type']=_0x68f7ab[_0x9e58('0x9')];_0x1775f9[_0x9e58('0xa')]=_0x1775f9[_0x9e58('0xb')]?_0x68f7ab[_0x9e58('0xc')]:![];_0x1775f9[_0x9e58('0xd')]=_0x1775f9[_0x9e58('0xa')]?_0x68f7ab['acwTimeout']:0x0;}utils['request'](_0x9e58('0xe'),_0x1775f9);});}else{utils[_0x9e58('0xf')](_0x9e58('0xe'),_0x1775f9);}if(_0x43afe9){delete transfers[_0x1775f9[_0x9e58('0x10')]];}else{delete agents[_0x1775f9['destuniqueid']];}}exports[_0x9e58('0x11')]=function(_0x10c7f3){try{utils[_0x9e58('0x12')](util[_0x9e58('0x13')](_0x9e58('0x14'),_0x10c7f3[_0x9e58('0x10')]),_0x10c7f3);agents[_0x10c7f3[_0x9e58('0x15')]]=_0x10c7f3;agents[_0x10c7f3[_0x9e58('0x15')]][_0x9e58('0x16')]=utils[_0x9e58('0x17')]();agents[_0x10c7f3[_0x9e58('0x15')]][_0x9e58('0x8')]=_0x9e58('0x18');agents[_0x10c7f3[_0x9e58('0x15')]][_0x9e58('0x7')]=null;agents[_0x10c7f3[_0x9e58('0x15')]]['connectedlinename']=null;utils['info'](util['format'](_0x9e58('0x19'),_0x10c7f3['uniqueid'],agents[_0x10c7f3[_0x9e58('0x15')]][_0x9e58('0x6')],_0x10c7f3[_0x9e58('0x15')]));}catch(_0x48dcb4){utils['error'](util[_0x9e58('0x13')](_0x9e58('0x14'),_0x10c7f3['uniqueid']),_0x48dcb4);}};exports[_0x9e58('0x1a')]=function(_0x52aedf){try{if(!_['isNil'](agents[_0x52aedf[_0x9e58('0x15')]])){utils[_0x9e58('0x12')](util[_0x9e58('0x13')]('[%s][agents][agentringnoanswer]',_0x52aedf[_0x9e58('0x10')]),_0x52aedf);utils['info'](util[_0x9e58('0x13')](_0x9e58('0x1b'),_0x52aedf[_0x9e58('0x10')],agents[_0x52aedf['destuniqueid']][_0x9e58('0x6')],_0x52aedf[_0x9e58('0x15')]));agents[_0x52aedf['destuniqueid']]['agentringnoanswer']=!![];agents[_0x52aedf[_0x9e58('0x15')]][_0x9e58('0x1c')]=utils[_0x9e58('0x17')]();agents[_0x52aedf[_0x9e58('0x15')]]['lastevent']=_0x9e58('0x1d');agents[_0x52aedf['destuniqueid']][_0x9e58('0x1e')]=_0x9e58('0x1d');agents[_0x52aedf['destuniqueid']]['holdtime']=_0x52aedf[_0x9e58('0x1f')]?parseInt(_0x52aedf[_0x9e58('0x1f')])/0x3e8:0x0;agents[_0x52aedf[_0x9e58('0x15')]][_0x9e58('0x20')]=0x0;unanswered[_0x9e58('0x21')](_0x52aedf[_0x9e58('0x15')]);}}catch(_0x236db5){utils[_0x9e58('0x22')](util[_0x9e58('0x13')](_0x9e58('0x23'),_0x52aedf[_0x9e58('0x10')]),_0x236db5);}};exports[_0x9e58('0x24')]=function(_0x48704b){try{_[_0x9e58('0x25')](agents,function(_0x568eac,_0x3da4d6){if(_0x568eac[_0x9e58('0x10')]==_0x48704b[_0x9e58('0x10')]&&!_[_0x9e58('0x26')](unanswered,_0x568eac[_0x9e58('0x15')])){utils[_0x9e58('0x12')](util[_0x9e58('0x13')](_0x9e58('0x27'),_0x48704b[_0x9e58('0x10')]),_0x48704b);utils[_0x9e58('0x2')](util['format'](_0x9e58('0x28'),_0x48704b['uniqueid'],_0x568eac[_0x9e58('0x6')],_0x568eac[_0x9e58('0x15')]));_0x568eac[_0x9e58('0x1a')]=!![];_0x568eac[_0x9e58('0x1c')]=utils[_0x9e58('0x17')]();_0x568eac['lastevent']=_0x9e58('0x29');_0x568eac[_0x9e58('0x1e')]=_0x9e58('0x29');_0x568eac[_0x9e58('0x2a')]=_0x48704b[_0x9e58('0x2a')];_0x568eac[_0x9e58('0x20')]=0x0;writeDB(_0x568eac);}});}catch(_0x369278){utils[_0x9e58('0x22')](util[_0x9e58('0x13')](_0x9e58('0x27'),_0x48704b['uniqueid']),_0x369278);}};exports[_0x9e58('0x2b')]=function(_0x42a20e){try{if(agents[_0x42a20e[_0x9e58('0x15')]]){utils[_0x9e58('0x12')](util['format'](_0x9e58('0x2c'),_0x42a20e['uniqueid']),_0x42a20e);utils[_0x9e58('0x2')](util[_0x9e58('0x13')](_0x9e58('0x2d'),_0x42a20e[_0x9e58('0x10')],agents[_0x42a20e['destuniqueid']][_0x9e58('0x6')],_0x42a20e[_0x9e58('0x15')]));agents[_0x42a20e[_0x9e58('0x15')]][_0x9e58('0x2e')]=utils[_0x9e58('0x17')]();agents[_0x42a20e[_0x9e58('0x15')]][_0x9e58('0x7')]=_0x42a20e[_0x9e58('0x7')];agents[_0x42a20e[_0x9e58('0x15')]][_0x9e58('0x2f')]=_0x42a20e['connectedlinename'];agents[_0x42a20e[_0x9e58('0x15')]][_0x9e58('0x2a')]=_0x42a20e['ringtime'];agents[_0x42a20e[_0x9e58('0x15')]]['lastevent']=_0x9e58('0x30');_[_0x9e58('0x25')](agents,function(_0x5df514,_0x40eeab){if(_0x5df514[_0x9e58('0x15')]!=_0x42a20e[_0x9e58('0x15')]&&_0x5df514[_0x9e58('0x10')]==_0x42a20e[_0x9e58('0x10')]){_0x5df514[_0x9e58('0x20')]=0x0;_0x5df514[_0x9e58('0x2a')]=_0x42a20e[_0x9e58('0x1f')];_0x5df514['agentringnoanswer']=!![];_0x5df514['agentringnoanswerAt']=utils[_0x9e58('0x17')]();_0x5df514['lastevent']=_0x9e58('0x31');_0x5df514[_0x9e58('0x1e')]=_0x9e58('0x31');_0x5df514[_0x9e58('0x32')]=_0x42a20e[_0x9e58('0x15')];_0x5df514[_0x9e58('0x33')]=_0x42a20e['membername'];writeDB(_0x5df514);}});}}catch(_0xff2d92){utils['error'](util[_0x9e58('0x13')](_0x9e58('0x2c'),_0x42a20e['uniqueid']),_0xff2d92);}};exports[_0x9e58('0xb')]=function(_0x17f22f){try{if(!_[_0x9e58('0x34')](agents[_0x17f22f[_0x9e58('0x15')]])){utils[_0x9e58('0x12')](util[_0x9e58('0x13')](_0x9e58('0x35'),_0x17f22f[_0x9e58('0x10')]),_0x17f22f);utils[_0x9e58('0x2')](util['format'](_0x9e58('0x36'),_0x17f22f['uniqueid'],agents[_0x17f22f[_0x9e58('0x15')]][_0x9e58('0x6')],_0x17f22f[_0x9e58('0x15')]));agents[_0x17f22f['destuniqueid']]['agentcomplete']=!![];agents[_0x17f22f[_0x9e58('0x15')]][_0x9e58('0x37')]=utils['now']();agents[_0x17f22f[_0x9e58('0x15')]][_0x9e58('0x20')]=utils[_0x9e58('0x38')](agents[_0x17f22f[_0x9e58('0x15')]][_0x9e58('0x37')],agents[_0x17f22f[_0x9e58('0x15')]][_0x9e58('0x2e')]);agents[_0x17f22f[_0x9e58('0x15')]][_0x9e58('0x1e')]=_0x17f22f[_0x9e58('0x1e')];agents[_0x17f22f[_0x9e58('0x15')]][_0x9e58('0x8')]=_0x9e58('0x39');writeDB(agents[_0x17f22f[_0x9e58('0x15')]]);}}catch(_0x13488e){utils['error'](util[_0x9e58('0x13')](_0x9e58('0x35'),_0x17f22f[_0x9e58('0x10')]),_0x13488e);}};exports[_0x9e58('0x3a')]=function(_0xde53d8){try{if(!_[_0x9e58('0x34')](agents[_0xde53d8[_0x9e58('0x3b')]])){utils[_0x9e58('0x12')](util['format'](_0x9e58('0x3c'),_0xde53d8[_0x9e58('0x10')]),_0xde53d8);utils[_0x9e58('0x2')](util[_0x9e58('0x13')](_0x9e58('0x3d'),_0xde53d8[_0x9e58('0x10')],agents[_0xde53d8[_0x9e58('0x3b')]]['membername'],agents[_0xde53d8[_0x9e58('0x3b')]][_0x9e58('0x10')]));agents[_0xde53d8[_0x9e58('0x3b')]][_0x9e58('0x3e')]=!![];agents[_0xde53d8[_0x9e58('0x3b')]][_0x9e58('0x3f')]=_0x9e58('0x40');agents[_0xde53d8[_0x9e58('0x3b')]]['transferexten']=_0xde53d8[_0x9e58('0x41')];agents[_0xde53d8['transfereruniqueid']][_0x9e58('0x42')]=agents[_0xde53d8[_0x9e58('0x3b')]]['uniqueid'];}}catch(_0x4fe07a){utils[_0x9e58('0x22')](util['format'](_0x9e58('0x3c'),_0xde53d8[_0x9e58('0x10')]),_0x4fe07a);}};exports[_0x9e58('0x43')]=function(_0x2be69b){try{utils[_0x9e58('0x12')](util[_0x9e58('0x13')](_0x9e58('0x44'),_0x2be69b[_0x9e58('0x45')]),_0x2be69b);if(_0x2be69b['origtransfereruniqueid']==_0x2be69b['origtransfererlinkedid']){if(!_[_0x9e58('0x34')](agents[_0x2be69b[_0x9e58('0x46')]])){utils[_0x9e58('0x2')](util[_0x9e58('0x13')](_0x9e58('0x47'),_0x2be69b[_0x9e58('0x45')],agents[_0x2be69b['secondtransfereruniqueid']]['membername']));agents[_0x2be69b['secondtransfereruniqueid']][_0x9e58('0x3e')]=!![];agents[_0x2be69b[_0x9e58('0x46')]][_0x9e58('0x3f')]=_0x9e58('0x48');agents[_0x2be69b[_0x9e58('0x46')]][_0x9e58('0x49')]=_0x2be69b['origtransfererexten'];agents[_0x2be69b[_0x9e58('0x46')]]['transferuniqueid']=_0x2be69b[_0x9e58('0x45')];}if(_0x2be69b['transfereeuniqueid']&&agents[_0x2be69b[_0x9e58('0x4a')]]){agents[_0x2be69b['transfereeuniqueid']][_0x9e58('0x4b')]=0x1;transfers[_0x2be69b['transfereeuniqueid']]=_[_0x9e58('0x4c')](agents[_0x2be69b[_0x9e58('0x4a')]]);transfers[_0x2be69b[_0x9e58('0x4a')]][_0x9e58('0x4d')]=agents[_0x2be69b[_0x9e58('0x46')]][_0x9e58('0x4d')];transfers[_0x2be69b[_0x9e58('0x4a')]][_0x9e58('0x4e')]=agents[_0x2be69b[_0x9e58('0x46')]][_0x9e58('0x4e')];transfers[_0x2be69b['transfereeuniqueid']][_0x9e58('0x16')]=utils[_0x9e58('0x17')]();transfers[_0x2be69b[_0x9e58('0x4a')]][_0x9e58('0x2e')]=utils[_0x9e58('0x17')]();transfers[_0x2be69b['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x2be69b[_0x9e58('0x4a')]][_0x9e58('0x4b')]=0x2;}}else if(_0x2be69b[_0x9e58('0x46')]==_0x2be69b[_0x9e58('0x4f')]){if(!_[_0x9e58('0x34')](agents[_0x2be69b[_0x9e58('0x45')]])){utils[_0x9e58('0x2')](util[_0x9e58('0x13')](_0x9e58('0x47'),_0x2be69b['origtransfereruniqueid'],agents[_0x2be69b[_0x9e58('0x45')]][_0x9e58('0x6')]));agents[_0x2be69b['origtransfereruniqueid']][_0x9e58('0x3e')]=!![];agents[_0x2be69b[_0x9e58('0x45')]][_0x9e58('0x3f')]=_0x9e58('0x48');agents[_0x2be69b[_0x9e58('0x45')]][_0x9e58('0x49')]=_0x2be69b['secondtransfererexten'];agents[_0x2be69b['origtransfereruniqueid']]['transferuniqueid']=_0x2be69b[_0x9e58('0x46')];}if(_0x2be69b[_0x9e58('0x50')]&&agents[_0x2be69b['transfertargetuniqueid']]){agents[_0x2be69b[_0x9e58('0x50')]][_0x9e58('0x4b')]=0x1;transfers[_0x2be69b[_0x9e58('0x50')]]=_[_0x9e58('0x4c')](agents[_0x2be69b[_0x9e58('0x50')]]);transfers[_0x2be69b[_0x9e58('0x50')]]['calleridnum']=agents[_0x2be69b['origtransfereruniqueid']][_0x9e58('0x4d')];transfers[_0x2be69b[_0x9e58('0x50')]][_0x9e58('0x4e')]=agents[_0x2be69b['origtransfereruniqueid']][_0x9e58('0x4e')];transfers[_0x2be69b[_0x9e58('0x50')]][_0x9e58('0x16')]=utils[_0x9e58('0x17')]();transfers[_0x2be69b['transfertargetuniqueid']][_0x9e58('0x2e')]=utils[_0x9e58('0x17')]();transfers[_0x2be69b[_0x9e58('0x50')]][_0x9e58('0x2a')]=0x0;transfers[_0x2be69b[_0x9e58('0x50')]][_0x9e58('0x4b')]=0x2;}}}catch(_0x5e8a2f){utils['error'](util[_0x9e58('0x13')](_0x9e58('0x44'),_0x2be69b[_0x9e58('0x45')]),_0x5e8a2f);}};exports[_0x9e58('0x51')]=function(_0x14f642){try{utils[_0x9e58('0x12')](util[_0x9e58('0x13')](_0x9e58('0x52'),_0x14f642[_0x9e58('0x10')]),_0x14f642);if(agents[_0x14f642['uniqueid']]&&agents[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x1e')]===_0x9e58('0x1d')){if(_0x14f642[_0x9e58('0x53')]==='21'){agents[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x1e')]='rejected';agents[_0x14f642['uniqueid']][_0x9e58('0x8')]=_0x9e58('0x54');}utils[_0x9e58('0x2')](util[_0x9e58('0x13')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x14f642[_0x9e58('0x10')],agents[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x6')],agents[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x1e')],agents[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x8')]));writeDB(agents[_0x14f642['uniqueid']]);var _0x4c5961=unanswered[_0x9e58('0x55')](_0x14f642[_0x9e58('0x10')]);if(_0x4c5961>-0x1){unanswered[_0x9e58('0x56')](_0x4c5961,0x1);}}if(transfers[_0x14f642['uniqueid']]){transfers[_0x14f642[_0x9e58('0x10')]][_0x9e58('0xb')]=!![];transfers[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x37')]=utils['now']();transfers[_0x14f642['uniqueid']][_0x9e58('0x20')]=utils[_0x9e58('0x38')](transfers[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x37')],transfers[_0x14f642[_0x9e58('0x10')]]['agentconnectAt']);transfers[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x1e')]=_0x9e58('0x57');transfers[_0x14f642['uniqueid']][_0x9e58('0x8')]=_0x9e58('0x39');utils[_0x9e58('0x2')](util[_0x9e58('0x13')](_0x9e58('0x58'),_0x14f642[_0x9e58('0x10')],transfers[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x6')],transfers[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x1e')],transfers[_0x14f642[_0x9e58('0x10')]]['lastevent']));writeDB(transfers[_0x14f642[_0x9e58('0x10')]],!![]);}if(agents[_0x14f642[_0x9e58('0x10')]]&&agents[_0x14f642['uniqueid']][_0x9e58('0x2e')]){agents[_0x14f642[_0x9e58('0x10')]]['agentcomplete']=!![];agents[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x37')]=utils[_0x9e58('0x17')]();agents[_0x14f642['uniqueid']][_0x9e58('0x20')]=utils['diffTime'](agents[_0x14f642['uniqueid']]['agentcompleteAt'],agents[_0x14f642['uniqueid']][_0x9e58('0x2e')]);agents[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x1e')]=agents[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x3e')]?_0x9e58('0x3e'):_0x9e58('0x57');agents[_0x14f642['uniqueid']][_0x9e58('0x8')]=_0x9e58('0x39');utils['info'](util['format'](_0x9e58('0x58'),_0x14f642['uniqueid'],agents[_0x14f642[_0x9e58('0x10')]][_0x9e58('0x6')],agents[_0x14f642['uniqueid']]['reason'],agents[_0x14f642[_0x9e58('0x10')]]['lastevent']));writeDB(agents[_0x14f642[_0x9e58('0x10')]]);}}catch(_0x5afe14){utils[_0x9e58('0x22')](util[_0x9e58('0x13')](_0x9e58('0x52'),_0x14f642[_0x9e58('0x10')]),_0x5afe14);}}; \ No newline at end of file +var _0x9209=['[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','util','./utils','info','format','uniqueid','queue','membername','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','push','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]'];(function(_0x268a2d,_0x14ca50){var _0x117d7=function(_0x36c43f){while(--_0x36c43f){_0x268a2d['push'](_0x268a2d['shift']());}};_0x117d7(++_0x14ca50);}(_0x9209,0x7c));var _0x9920=function(_0x144b33,_0x57f4af){_0x144b33=_0x144b33-0x0;var _0xb14764=_0x9209[_0x144b33];return _0xb14764;};'use strict';var _=require('lodash');var util=require(_0x9920('0x0'));var utils=require(_0x9920('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x8ae61,_0x3e9110){utils[_0x9920('0x2')](util[_0x9920('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x8ae61[_0x9920('0x4')],_0x8ae61['channel'],_0x8ae61[_0x9920('0x5')],_0x8ae61[_0x9920('0x6')],_0x8ae61['interface'],_0x8ae61['calleridnum'],_0x8ae61['connectedlinenum'],_0x8ae61['lastevent']));if(_0x8ae61[_0x9920('0x5')]){utils[_0x9920('0x7')](_0x8ae61[_0x9920('0x5')])['then'](function(_0x106839){if(_0x106839){_0x8ae61[_0x9920('0x8')]=_0x106839['type'];_0x8ae61[_0x9920('0x9')]=_0x8ae61[_0x9920('0xa')]?_0x106839[_0x9920('0xb')]:![];_0x8ae61[_0x9920('0xc')]=_0x8ae61[_0x9920('0x9')]?_0x106839[_0x9920('0xd')]:0x0;}utils[_0x9920('0xe')]('CreateVoiceAgentReport',_0x8ae61);});}else{utils[_0x9920('0xe')](_0x9920('0xf'),_0x8ae61);}if(_0x3e9110){delete transfers[_0x8ae61[_0x9920('0x4')]];}else{delete agents[_0x8ae61[_0x9920('0x10')]];}}exports[_0x9920('0x11')]=function(_0x4a9bd5){try{utils['debug'](util[_0x9920('0x3')](_0x9920('0x12'),_0x4a9bd5[_0x9920('0x4')]),_0x4a9bd5);agents[_0x4a9bd5[_0x9920('0x10')]]=_0x4a9bd5;agents[_0x4a9bd5[_0x9920('0x10')]][_0x9920('0x13')]=utils[_0x9920('0x14')]();agents[_0x4a9bd5[_0x9920('0x10')]][_0x9920('0x15')]=_0x9920('0x16');agents[_0x4a9bd5[_0x9920('0x10')]][_0x9920('0x17')]=null;agents[_0x4a9bd5['destuniqueid']][_0x9920('0x18')]=null;utils[_0x9920('0x2')](util[_0x9920('0x3')](_0x9920('0x19'),_0x4a9bd5[_0x9920('0x4')],agents[_0x4a9bd5[_0x9920('0x10')]]['membername'],_0x4a9bd5[_0x9920('0x10')]));}catch(_0x1a79a6){utils[_0x9920('0x1a')](util[_0x9920('0x3')](_0x9920('0x12'),_0x4a9bd5[_0x9920('0x4')]),_0x1a79a6);}};exports[_0x9920('0x1b')]=function(_0x253151){try{if(!_['isNil'](agents[_0x253151[_0x9920('0x10')]])){utils[_0x9920('0x1c')](util[_0x9920('0x3')](_0x9920('0x1d'),_0x253151[_0x9920('0x4')]),_0x253151);utils[_0x9920('0x2')](util[_0x9920('0x3')](_0x9920('0x1e'),_0x253151['uniqueid'],agents[_0x253151[_0x9920('0x10')]][_0x9920('0x6')],_0x253151[_0x9920('0x10')]));agents[_0x253151[_0x9920('0x10')]][_0x9920('0x1b')]=!![];agents[_0x253151[_0x9920('0x10')]][_0x9920('0x1f')]=utils[_0x9920('0x14')]();agents[_0x253151[_0x9920('0x10')]][_0x9920('0x15')]=_0x9920('0x20');agents[_0x253151[_0x9920('0x10')]][_0x9920('0x21')]=_0x9920('0x20');agents[_0x253151[_0x9920('0x10')]]['holdtime']=_0x253151[_0x9920('0x22')]?parseInt(_0x253151['ringtime'])/0x3e8:0x0;agents[_0x253151[_0x9920('0x10')]]['talktime']=0x0;unanswered[_0x9920('0x23')](_0x253151['destuniqueid']);}}catch(_0x1f9f25){utils[_0x9920('0x1a')](util[_0x9920('0x3')](_0x9920('0x1d'),_0x253151[_0x9920('0x4')]),_0x1f9f25);}};exports['queuecallerabandon']=function(_0x7e2e00){try{_[_0x9920('0x24')](agents,function(_0x49b08b,_0x409f80){if(_0x49b08b[_0x9920('0x4')]==_0x7e2e00[_0x9920('0x4')]&&!_[_0x9920('0x25')](unanswered,_0x49b08b['destuniqueid'])){utils[_0x9920('0x1c')](util[_0x9920('0x3')](_0x9920('0x26'),_0x7e2e00[_0x9920('0x4')]),_0x7e2e00);utils['info'](util[_0x9920('0x3')](_0x9920('0x27'),_0x7e2e00[_0x9920('0x4')],_0x49b08b['membername'],_0x49b08b[_0x9920('0x10')]));_0x49b08b['agentringnoanswer']=!![];_0x49b08b[_0x9920('0x1f')]=utils[_0x9920('0x14')]();_0x49b08b[_0x9920('0x15')]=_0x9920('0x28');_0x49b08b[_0x9920('0x21')]='abandoned';_0x49b08b[_0x9920('0x29')]=_0x7e2e00[_0x9920('0x29')];_0x49b08b[_0x9920('0x2a')]=0x0;writeDB(_0x49b08b);}});}catch(_0x50266e){utils['error'](util[_0x9920('0x3')]('[%s][agents][queuecallerabandon]',_0x7e2e00[_0x9920('0x4')]),_0x50266e);}};exports[_0x9920('0x2b')]=function(_0x21d9e6){try{if(agents[_0x21d9e6[_0x9920('0x10')]]){utils['debug'](util['format'](_0x9920('0x2c'),_0x21d9e6['uniqueid']),_0x21d9e6);utils['info'](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x21d9e6[_0x9920('0x4')],agents[_0x21d9e6[_0x9920('0x10')]][_0x9920('0x6')],_0x21d9e6[_0x9920('0x10')]));agents[_0x21d9e6[_0x9920('0x10')]][_0x9920('0x2d')]=utils[_0x9920('0x14')]();agents[_0x21d9e6[_0x9920('0x10')]][_0x9920('0x17')]=_0x21d9e6[_0x9920('0x17')];agents[_0x21d9e6['destuniqueid']][_0x9920('0x18')]=_0x21d9e6[_0x9920('0x18')];agents[_0x21d9e6[_0x9920('0x10')]][_0x9920('0x29')]=_0x21d9e6[_0x9920('0x22')];agents[_0x21d9e6['destuniqueid']][_0x9920('0x15')]=_0x9920('0x2e');_['forIn'](agents,function(_0x55b26f,_0x5bc231){if(_0x55b26f['destuniqueid']!=_0x21d9e6[_0x9920('0x10')]&&_0x55b26f[_0x9920('0x4')]==_0x21d9e6[_0x9920('0x4')]){_0x55b26f[_0x9920('0x2a')]=0x0;_0x55b26f[_0x9920('0x29')]=_0x21d9e6[_0x9920('0x22')];_0x55b26f[_0x9920('0x1b')]=!![];_0x55b26f['agentringnoanswerAt']=utils[_0x9920('0x14')]();_0x55b26f[_0x9920('0x15')]=_0x9920('0x2f');_0x55b26f['reason']='answered_elsewhere';_0x55b26f[_0x9920('0x30')]=_0x21d9e6[_0x9920('0x10')];_0x55b26f[_0x9920('0x31')]=_0x21d9e6[_0x9920('0x6')];writeDB(_0x55b26f);}});}}catch(_0x3e04d1){utils[_0x9920('0x1a')](util[_0x9920('0x3')](_0x9920('0x2c'),_0x21d9e6[_0x9920('0x4')]),_0x3e04d1);}};exports[_0x9920('0xa')]=function(_0x7f308d){try{if(!_[_0x9920('0x32')](agents[_0x7f308d['destuniqueid']])){utils[_0x9920('0x1c')](util[_0x9920('0x3')](_0x9920('0x33'),_0x7f308d[_0x9920('0x4')]),_0x7f308d);utils[_0x9920('0x2')](util['format'](_0x9920('0x34'),_0x7f308d[_0x9920('0x4')],agents[_0x7f308d[_0x9920('0x10')]][_0x9920('0x6')],_0x7f308d['destuniqueid']));agents[_0x7f308d[_0x9920('0x10')]][_0x9920('0xa')]=!![];agents[_0x7f308d[_0x9920('0x10')]][_0x9920('0x35')]=utils[_0x9920('0x14')]();agents[_0x7f308d[_0x9920('0x10')]]['talktime']=utils[_0x9920('0x36')](agents[_0x7f308d[_0x9920('0x10')]][_0x9920('0x35')],agents[_0x7f308d[_0x9920('0x10')]]['agentconnectAt']);agents[_0x7f308d['destuniqueid']][_0x9920('0x21')]=_0x7f308d[_0x9920('0x21')];agents[_0x7f308d[_0x9920('0x10')]][_0x9920('0x15')]=_0x9920('0x37');writeDB(agents[_0x7f308d['destuniqueid']]);}}catch(_0x17c41a){utils['error'](util['format'](_0x9920('0x33'),_0x7f308d[_0x9920('0x4')]),_0x17c41a);}};exports[_0x9920('0x38')]=function(_0xe56256){try{if(!_[_0x9920('0x32')](agents[_0xe56256[_0x9920('0x39')]])){utils[_0x9920('0x1c')](util[_0x9920('0x3')](_0x9920('0x3a'),_0xe56256[_0x9920('0x4')]),_0xe56256);utils[_0x9920('0x2')](util['format'](_0x9920('0x3b'),_0xe56256[_0x9920('0x4')],agents[_0xe56256[_0x9920('0x39')]][_0x9920('0x6')],agents[_0xe56256['transfereruniqueid']][_0x9920('0x4')]));agents[_0xe56256['transfereruniqueid']][_0x9920('0x3c')]=!![];agents[_0xe56256['transfereruniqueid']]['transfertype']=_0x9920('0x3d');agents[_0xe56256[_0x9920('0x39')]][_0x9920('0x3e')]=_0xe56256[_0x9920('0x3f')];agents[_0xe56256[_0x9920('0x39')]]['transferuniqueid']=agents[_0xe56256[_0x9920('0x39')]][_0x9920('0x4')];}}catch(_0x1e1f0f){utils[_0x9920('0x1a')](util[_0x9920('0x3')](_0x9920('0x3a'),_0xe56256[_0x9920('0x4')]),_0x1e1f0f);}};exports[_0x9920('0x40')]=function(_0x13b478){try{utils[_0x9920('0x1c')](util[_0x9920('0x3')]('[%s][agents][attendedtransfer]',_0x13b478[_0x9920('0x41')]),_0x13b478);if(_0x13b478[_0x9920('0x41')]==_0x13b478[_0x9920('0x42')]){if(!_['isNil'](agents[_0x13b478['secondtransfereruniqueid']])){utils[_0x9920('0x2')](util[_0x9920('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x13b478[_0x9920('0x41')],agents[_0x13b478[_0x9920('0x43')]][_0x9920('0x6')]));agents[_0x13b478[_0x9920('0x43')]][_0x9920('0x3c')]=!![];agents[_0x13b478['secondtransfereruniqueid']][_0x9920('0x44')]=_0x9920('0x45');agents[_0x13b478[_0x9920('0x43')]][_0x9920('0x3e')]=_0x13b478[_0x9920('0x46')];agents[_0x13b478[_0x9920('0x43')]][_0x9920('0x47')]=_0x13b478['origtransfereruniqueid'];}if(_0x13b478['transfereeuniqueid']&&agents[_0x13b478[_0x9920('0x48')]]){agents[_0x13b478[_0x9920('0x48')]][_0x9920('0x49')]=0x1;transfers[_0x13b478[_0x9920('0x48')]]=_[_0x9920('0x4a')](agents[_0x13b478['transfereeuniqueid']]);transfers[_0x13b478[_0x9920('0x48')]][_0x9920('0x4b')]=agents[_0x13b478[_0x9920('0x43')]][_0x9920('0x4b')];transfers[_0x13b478[_0x9920('0x48')]][_0x9920('0x4c')]=agents[_0x13b478['secondtransfereruniqueid']][_0x9920('0x4c')];transfers[_0x13b478[_0x9920('0x48')]]['agentcalledAt']=utils['now']();transfers[_0x13b478[_0x9920('0x48')]][_0x9920('0x2d')]=utils[_0x9920('0x14')]();transfers[_0x13b478['transfereeuniqueid']][_0x9920('0x29')]=0x0;transfers[_0x13b478['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x13b478['secondtransfereruniqueid']==_0x13b478[_0x9920('0x4d')]){if(!_[_0x9920('0x32')](agents[_0x13b478[_0x9920('0x41')]])){utils[_0x9920('0x2')](util[_0x9920('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x13b478['origtransfereruniqueid'],agents[_0x13b478[_0x9920('0x41')]][_0x9920('0x6')]));agents[_0x13b478['origtransfereruniqueid']]['transfer']=!![];agents[_0x13b478[_0x9920('0x41')]][_0x9920('0x44')]=_0x9920('0x45');agents[_0x13b478[_0x9920('0x41')]]['transferexten']=_0x13b478['secondtransfererexten'];agents[_0x13b478[_0x9920('0x41')]]['transferuniqueid']=_0x13b478[_0x9920('0x43')];}if(_0x13b478[_0x9920('0x4e')]&&agents[_0x13b478[_0x9920('0x4e')]]){agents[_0x13b478[_0x9920('0x4e')]][_0x9920('0x49')]=0x1;transfers[_0x13b478[_0x9920('0x4e')]]=_[_0x9920('0x4a')](agents[_0x13b478[_0x9920('0x4e')]]);transfers[_0x13b478[_0x9920('0x4e')]]['calleridnum']=agents[_0x13b478[_0x9920('0x41')]][_0x9920('0x4b')];transfers[_0x13b478[_0x9920('0x4e')]]['calleridname']=agents[_0x13b478[_0x9920('0x41')]][_0x9920('0x4c')];transfers[_0x13b478[_0x9920('0x4e')]]['agentcalledAt']=utils['now']();transfers[_0x13b478[_0x9920('0x4e')]]['agentconnectAt']=utils['now']();transfers[_0x13b478[_0x9920('0x4e')]]['holdtime']=0x0;transfers[_0x13b478[_0x9920('0x4e')]][_0x9920('0x49')]=0x2;}}}catch(_0x3ae0b3){utils['error'](util[_0x9920('0x3')](_0x9920('0x4f'),_0x13b478[_0x9920('0x41')]),_0x3ae0b3);}};exports[_0x9920('0x50')]=function(_0x55a6ad){try{utils[_0x9920('0x1c')](util[_0x9920('0x3')](_0x9920('0x51'),_0x55a6ad[_0x9920('0x4')]),_0x55a6ad);if(agents[_0x55a6ad[_0x9920('0x4')]]&&agents[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x21')]==='timeout'){if(_0x55a6ad[_0x9920('0x52')]==='21'){agents[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x21')]=_0x9920('0x53');agents[_0x55a6ad[_0x9920('0x4')]]['lastevent']=_0x9920('0x53');}utils[_0x9920('0x2')](util[_0x9920('0x3')](_0x9920('0x54'),_0x55a6ad['uniqueid'],agents[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x6')],agents[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x21')],agents[_0x55a6ad['uniqueid']][_0x9920('0x15')]));writeDB(agents[_0x55a6ad[_0x9920('0x4')]]);var _0x2e13eb=unanswered[_0x9920('0x55')](_0x55a6ad['uniqueid']);if(_0x2e13eb>-0x1){unanswered[_0x9920('0x56')](_0x2e13eb,0x1);}}if(transfers[_0x55a6ad['uniqueid']]){transfers[_0x55a6ad[_0x9920('0x4')]][_0x9920('0xa')]=!![];transfers[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x35')]=utils[_0x9920('0x14')]();transfers[_0x55a6ad[_0x9920('0x4')]]['talktime']=utils[_0x9920('0x36')](transfers[_0x55a6ad[_0x9920('0x4')]]['agentcompleteAt'],transfers[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x2d')]);transfers[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x21')]=_0x9920('0x57');transfers[_0x55a6ad['uniqueid']][_0x9920('0x15')]=_0x9920('0x37');utils['info'](util[_0x9920('0x3')](_0x9920('0x54'),_0x55a6ad['uniqueid'],transfers[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x6')],transfers[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x21')],transfers[_0x55a6ad['uniqueid']]['lastevent']));writeDB(transfers[_0x55a6ad[_0x9920('0x4')]],!![]);}if(agents[_0x55a6ad['uniqueid']]&&agents[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x2d')]){agents[_0x55a6ad[_0x9920('0x4')]][_0x9920('0xa')]=!![];agents[_0x55a6ad['uniqueid']][_0x9920('0x35')]=utils[_0x9920('0x14')]();agents[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x2a')]=utils[_0x9920('0x36')](agents[_0x55a6ad['uniqueid']][_0x9920('0x35')],agents[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x2d')]);agents[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x21')]=agents[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x3c')]?_0x9920('0x3c'):_0x9920('0x57');agents[_0x55a6ad['uniqueid']][_0x9920('0x15')]='complete';utils[_0x9920('0x2')](util[_0x9920('0x3')](_0x9920('0x54'),_0x55a6ad[_0x9920('0x4')],agents[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x6')],agents[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x21')],agents[_0x55a6ad[_0x9920('0x4')]][_0x9920('0x15')]));writeDB(agents[_0x55a6ad[_0x9920('0x4')]]);}}catch(_0x26e224){utils[_0x9920('0x1a')](util[_0x9920('0x3')](_0x9920('0x51'),_0x55a6ad['uniqueid']),_0x26e224);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index e8a9456..3fdab8d 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 _0x3415=['transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','now','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','includes','noop','execif','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','request','newchannel','debug','linkedid','OutgoingSpoolFailed','context','exten','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x3415,0xab));var _0x5341=function(_0x1d05f6,_0x5290f0){_0x1d05f6=_0x1d05f6-0x0;var _0x244543=_0x3415[_0x1d05f6];return _0x244543;};'use strict';var _=require(_0x5341('0x0'));var util=require('util');var utils=require(_0x5341('0x1'));var transfers=require(_0x5341('0x2'));var dispositions=[_0x5341('0x3'),_0x5341('0x4'),'FAILED',_0x5341('0x3'),'NO\x20ANSWER',_0x5341('0x3'),_0x5341('0x5'),_0x5341('0x6'),_0x5341('0x4'),_0x5341('0x4'),_0x5341('0x4')];var channels={};function writeDB(_0x1177c6){var _0x595e1f;if(transfers[_0x5341('0x7')][_0x1177c6[_0x5341('0x8')]]){_0x595e1f=_0x1177c6[_0x5341('0x8')];_0x1177c6[_0x5341('0x8')]=transfers[_0x5341('0x7')][_0x1177c6[_0x5341('0x8')]][_0x5341('0x9')];}utils[_0x5341('0xa')](util[_0x5341('0xb')](_0x5341('0xc'),_0x1177c6[_0x5341('0x8')],_0x1177c6[_0x5341('0xd')],_0x1177c6[_0x5341('0xe')],_0x1177c6['membername'],_0x1177c6[_0x5341('0xf')],_0x1177c6[_0x5341('0x10')],_0x1177c6[_0x5341('0x11')],_0x1177c6[_0x5341('0x12')]));if(_0x1177c6['accountcode']){utils['getUserByInternal'](_0x1177c6[_0x5341('0x13')])['then'](function(_0x3aafec){if(_0x3aafec){_0x1177c6['UserId']=_0x3aafec['id'];}utils[_0x5341('0x14')]('CreateVoiceCallReport',_0x1177c6);});}else{utils[_0x5341('0x14')]('CreateVoiceCallReport',_0x1177c6);}if(channels[_0x1177c6[_0x5341('0x8')]]){delete channels[_0x1177c6[_0x5341('0x8')]];}else if(_0x595e1f&&channels[_0x595e1f]){delete transfers[_0x5341('0x7')][_0x595e1f];delete channels[_0x595e1f];}}exports[_0x5341('0x15')]=function(_0x39fd14){try{utils[_0x5341('0x16')](util[_0x5341('0xb')]('[%s][calls][newchannel]',_0x39fd14[_0x5341('0x8')]),_0x39fd14);if(_0x39fd14[_0x5341('0x8')]==_0x39fd14[_0x5341('0x17')]&&_0x39fd14[_0x5341('0xd')]!=_0x5341('0x18')){utils[_0x5341('0xa')](util[_0x5341('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x39fd14[_0x5341('0x8')],_0x39fd14[_0x5341('0x19')],_0x39fd14[_0x5341('0x1a')]));channels[_0x39fd14[_0x5341('0x8')]]={'uniqueid':_0x39fd14[_0x5341('0x8')],'accountcode':_0x39fd14['accountcode'],'source':_0x39fd14[_0x5341('0x10')],'destination':_0x39fd14[_0x5341('0x1a')],'destinationcontext':_0x39fd14['context'],'channel':_0x39fd14['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x406fe2){utils[_0x5341('0x1b')](util['format'](_0x5341('0x1c'),_0x39fd14[_0x5341('0x8')]),_0x406fe2);}};exports[_0x5341('0x1d')]=function(_0x61a87d){try{utils[_0x5341('0x16')](util['format'](_0x5341('0x1e'),_0x61a87d[_0x5341('0x8')]),_0x61a87d);if(!_['isNil'](channels[_0x61a87d[_0x5341('0x8')]])&&_0x61a87d[_0x5341('0x1f')]==0x6){utils[_0x5341('0xa')](util[_0x5341('0xb')](_0x5341('0x20'),_0x61a87d['uniqueid'],_0x61a87d[_0x5341('0x19')],_0x61a87d[_0x5341('0xd')]));if(_[_0x5341('0x21')](channels[_0x61a87d[_0x5341('0x8')]]['systemanswertime'])){channels[_0x61a87d[_0x5341('0x8')]][_0x5341('0x22')]=utils['now']();}}else if(!_[_0x5341('0x21')](channels[_0x61a87d[_0x5341('0x17')]])&&_0x61a87d[_0x5341('0x1f')]==0x6&&_0x61a87d[_0x5341('0x19')]!=_0x5341('0x23')){utils[_0x5341('0xa')](util[_0x5341('0xb')](_0x5341('0x24'),_0x61a87d[_0x5341('0x8')],_0x61a87d['linkedid'],_0x61a87d[_0x5341('0x19')],_0x61a87d[_0x5341('0xd')]));channels[_0x61a87d[_0x5341('0x17')]][_0x5341('0x13')]=_0x61a87d['accountcode'];channels[_0x61a87d['linkedid']][_0x5341('0x25')]=_0x61a87d['channel'];if(_[_0x5341('0x21')](channels[_0x61a87d[_0x5341('0x17')]][_0x5341('0x26')])){channels[_0x61a87d['linkedid']][_0x5341('0x26')]=utils[_0x5341('0x27')]();}channels[_0x61a87d[_0x5341('0x17')]]['disposition']=dispositions[_['toNumber'](_0x61a87d[_0x5341('0x1f')])]||'ANSWERED';}}catch(_0x2e3b4d){utils[_0x5341('0x1b')](util['format'](_0x5341('0x1e'),_0x61a87d['uniqueid']),_0x2e3b4d);}};exports[_0x5341('0x28')]=function(_0xf3a201){try{if(!_[_0x5341('0x21')](channels[_0xf3a201[_0x5341('0x8')]])){utils[_0x5341('0x16')](util['format'](_0x5341('0x29'),_0xf3a201[_0x5341('0x8')]),_0xf3a201);if(_[_0x5341('0x21')](channels[_0xf3a201['uniqueid']][_0x5341('0x2a')])){channels[_0xf3a201[_0x5341('0x8')]]['callerid']=_0xf3a201[_0x5341('0x2b')]+'\x20<'+_0xf3a201[_0x5341('0x10')]+'>';}utils[_0x5341('0xa')](util[_0x5341('0xb')](_0x5341('0x2c'),_0xf3a201[_0x5341('0x8')],channels[_0xf3a201[_0x5341('0x8')]][_0x5341('0x2a')],_0xf3a201[_0x5341('0x2d')]));channels[_0xf3a201['uniqueid']][_0x5341('0x2e')]=utils['now']();channels[_0xf3a201['uniqueid']][_0x5341('0x2f')]=utils[_0x5341('0x30')](channels[_0xf3a201[_0x5341('0x8')]]['endtime'],channels[_0xf3a201[_0x5341('0x8')]][_0x5341('0x31')]);channels[_0xf3a201['uniqueid']][_0x5341('0x32')]=channels[_0xf3a201[_0x5341('0x8')]][_0x5341('0x26')]?utils[_0x5341('0x30')](channels[_0xf3a201['uniqueid']][_0x5341('0x2e')],channels[_0xf3a201[_0x5341('0x8')]]['answertime']):0x0;writeDB(channels[_0xf3a201[_0x5341('0x8')]]);}}catch(_0x5489ba){utils[_0x5341('0x1b')](util[_0x5341('0xb')](_0x5341('0x29'),_0xf3a201[_0x5341('0x8')]),_0x5489ba);}};exports[_0x5341('0x33')]=function(_0x520c28){try{if(!_['isNil'](channels[_0x520c28[_0x5341('0x34')]])){utils[_0x5341('0x16')](util['format'](_0x5341('0x35'),_0x520c28[_0x5341('0x36')]),_0x520c28);if(channels[_0x520c28[_0x5341('0x34')]]['channel']==_0x520c28['transfereechannel']){utils[_0x5341('0xa')](util[_0x5341('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x520c28['origtransfereruniqueid'],_0x520c28[_0x5341('0x34')],_0x520c28['secondtransfererchannel']));channels[_0x520c28[_0x5341('0x34')]][_0x5341('0x25')]=_0x520c28['secondtransfererchannel'];channels[_0x520c28[_0x5341('0x34')]]['userfield']='_attended';}else if(channels[_0x520c28['localtwolinkedid']][_0x5341('0xd')]=_0x520c28[_0x5341('0x37')]){utils[_0x5341('0xa')](util[_0x5341('0xb')](_0x5341('0x38'),_0x520c28[_0x5341('0x36')],_0x520c28[_0x5341('0x34')],_0x520c28['origtransfererchannel']));channels[_0x520c28[_0x5341('0x34')]][_0x5341('0x25')]=_0x520c28[_0x5341('0x39')];channels[_0x520c28[_0x5341('0x34')]]['userfield']=_0x5341('0x3a');}}}catch(_0x1dd552){utils[_0x5341('0x1b')](util['format'](_0x5341('0x35'),_0x520c28[_0x5341('0x36')]),_0x1dd552);}};exports['musiconholdstart']=function(_0x38b1f7){try{if(!_[_0x5341('0x21')](channels[_0x38b1f7[_0x5341('0x8')]])){utils[_0x5341('0x16')](util['format'](_0x5341('0x3b'),_0x38b1f7[_0x5341('0x8')]),_0x38b1f7);channels[_0x38b1f7['uniqueid']][_0x5341('0x3c')]=utils[_0x5341('0x27')]();utils[_0x5341('0xa')](util[_0x5341('0xb')](_0x5341('0x3d'),_0x38b1f7[_0x5341('0x8')],channels[_0x38b1f7[_0x5341('0x8')]][_0x5341('0x3c')]));}}catch(_0x3ad769){utils[_0x5341('0x1b')](util[_0x5341('0xb')](_0x5341('0x3b'),_0x38b1f7[_0x5341('0x8')]),_0x3ad769);}};exports[_0x5341('0x3e')]=function(_0x2d2bf9){try{if(!_[_0x5341('0x21')](channels[_0x2d2bf9['uniqueid']])){utils[_0x5341('0x16')](util['format'](_0x5341('0x3f'),_0x2d2bf9['uniqueid']),_0x2d2bf9);if(!_['isNil'](channels[_0x2d2bf9['uniqueid']]['musiconholdstartAt'])){channels[_0x2d2bf9[_0x5341('0x8')]]['mohtime']+=utils[_0x5341('0x30')](utils[_0x5341('0x27')](),channels[_0x2d2bf9[_0x5341('0x8')]][_0x5341('0x3c')]);utils[_0x5341('0xa')](util[_0x5341('0xb')](_0x5341('0x40'),_0x2d2bf9[_0x5341('0x8')],channels[_0x2d2bf9[_0x5341('0x8')]][_0x5341('0x41')]));delete channels[_0x2d2bf9['uniqueid']][_0x5341('0x3c')];}}}catch(_0x2bb50a){utils[_0x5341('0x1b')](util[_0x5341('0xb')]('[%s][calls][musiconholdstop]',_0x2d2bf9[_0x5341('0x8')]),_0x2bb50a);}};exports['varset']=function(_0x10a1d7){try{if(!_[_0x5341('0x21')](channels[_0x10a1d7[_0x5341('0x8')]])){utils[_0x5341('0x16')](util[_0x5341('0xb')](_0x5341('0x42'),_0x10a1d7[_0x5341('0x8')]),_0x10a1d7);if(!_[_0x5341('0x21')](_0x10a1d7[_0x5341('0x43')][_0x5341('0x44')])){utils[_0x5341('0xa')](util[_0x5341('0xb')](_0x5341('0x45'),_0x10a1d7[_0x5341('0x8')],_0x10a1d7['value']));channels[_0x10a1d7[_0x5341('0x8')]][_0x5341('0x46')]=_0x10a1d7[_0x5341('0x47')];}if(!_[_0x5341('0x21')](_0x10a1d7['variable'][_0x5341('0x48')])){utils[_0x5341('0xa')](util[_0x5341('0xb')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x10a1d7[_0x5341('0x8')],_0x10a1d7['value']));channels[_0x10a1d7[_0x5341('0x8')]][_0x5341('0x49')]=_0x10a1d7['value'];channels[_0x10a1d7[_0x5341('0x8')]][_0x5341('0x2a')]='\x22'+_0x10a1d7[_0x5341('0x47')]+_0x5341('0x4a')+_0x10a1d7[_0x5341('0x47')]+'>';}if(!_[_0x5341('0x21')](_0x10a1d7[_0x5341('0x43')][_0x5341('0x4b')])||!_['isNil'](_0x10a1d7[_0x5341('0x43')][_0x5341('0x4c')])){utils['info'](util[_0x5341('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x10a1d7[_0x5341('0x8')],!_[_0x5341('0x21')](_0x10a1d7[_0x5341('0x43')][_0x5341('0x4b')])?_0x5341('0x4b'):'xmd-callerid',_0x10a1d7[_0x5341('0x47')]));channels[_0x10a1d7['uniqueid']][_0x5341('0x2a')]=_0x10a1d7['value'];}if(!_[_0x5341('0x21')](_0x10a1d7[_0x5341('0x43')][_0x5341('0x4d')])||!_[_0x5341('0x21')](_0x10a1d7[_0x5341('0x43')][_0x5341('0x4e')])){utils[_0x5341('0xa')](util[_0x5341('0xb')](_0x5341('0x4f'),_0x10a1d7[_0x5341('0x8')],!_[_0x5341('0x21')](_0x10a1d7['variable'][_0x5341('0x4d')])?_0x5341('0x4d'):'xmcs-queue',_0x10a1d7[_0x5341('0x47')]));channels[_0x10a1d7[_0x5341('0x8')]]['lastapplication']='Queue';channels[_0x10a1d7[_0x5341('0x8')]][_0x5341('0x50')]=_0x10a1d7['value'];channels[_0x10a1d7[_0x5341('0x8')]][_0x5341('0xe')]=!![];}if(!_[_0x5341('0x21')](_0x10a1d7[_0x5341('0x43')][_0x5341('0x51')])){utils[_0x5341('0xa')](util[_0x5341('0xb')](_0x5341('0x52'),_0x10a1d7[_0x5341('0x8')],_0x10a1d7[_0x5341('0x47')]));channels[_0x10a1d7[_0x5341('0x8')]]['ContactId']=_0x10a1d7[_0x5341('0x47')];}if(!_[_0x5341('0x21')](_0x10a1d7[_0x5341('0x43')][_0x5341('0x53')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x10a1d7[_0x5341('0x8')],_0x10a1d7[_0x5341('0x47')]));channels[_0x10a1d7[_0x5341('0x8')]]['type']=_0x10a1d7['value'];}if(!_[_0x5341('0x21')](_0x10a1d7['variable'][_0x5341('0x54')])){utils[_0x5341('0xa')](util[_0x5341('0xb')](_0x5341('0x55'),_0x10a1d7[_0x5341('0x8')],_0x10a1d7[_0x5341('0x47')]));channels[_0x10a1d7[_0x5341('0x8')]][_0x5341('0x56')]=_0x10a1d7[_0x5341('0x47')];}if(!_['isNil'](_0x10a1d7[_0x5341('0x43')][_0x5341('0x57')])){utils['info'](util['format'](_0x5341('0x58'),_0x10a1d7[_0x5341('0x8')],_0x10a1d7['value']));channels[_0x10a1d7[_0x5341('0x8')]][_0x5341('0x57')]=_0x10a1d7['value'];}}}catch(_0x4ee8ae){utils['error'](util['format']('[%s][calls][varset]',_0x10a1d7['uniqueid']),_0x4ee8ae);}};exports[_0x5341('0x59')]=function(_0x33dc06){try{if(!_[_0x5341('0x21')](channels[_0x33dc06[_0x5341('0x8')]])){utils[_0x5341('0x16')](util['format'](_0x5341('0x5a'),_0x33dc06[_0x5341('0x8')]),_0x33dc06);utils[_0x5341('0xa')](util[_0x5341('0xb')](_0x5341('0x5b'),_0x33dc06[_0x5341('0x8')],_0x33dc06['application'],_0x33dc06['appdata']));if(_0x33dc06[_0x5341('0x5c')][_0x5341('0x5d')]()==_0x5341('0x5e')&&_[_0x5341('0x5f')](_0x33dc06[_0x5341('0x60')][_0x5341('0x5d')](),'cdr')){var _0x301366=_0x33dc06[_0x5341('0x60')][_0x5341('0x61')]('=');var _0x417736=_0x301366[0x0][_0x5341('0x62')](_0x301366[0x0][_0x5341('0x63')]('(')+0x1,_0x301366[0x0][_0x5341('0x63')](')'));var _0xf4cb1f=_0x301366[0x1];channels[_0x33dc06['uniqueid']][_0x417736]=_0xf4cb1f;}if(!_[_0x5341('0x64')]([_0x5341('0x28'),_0x5341('0x65'),_0x5341('0x66'),_0x5341('0x5e'),'gotoif'],_0x33dc06['application'][_0x5341('0x5d')]())){channels[_0x33dc06['uniqueid']]['lastapplication']=_0x33dc06[_0x5341('0x5c')];channels[_0x33dc06[_0x5341('0x8')]][_0x5341('0x50')]=_0x33dc06[_0x5341('0x60')];}}}catch(_0x37f0cf){utils[_0x5341('0x1b')](util['format'](_0x5341('0x5a'),_0x33dc06[_0x5341('0x8')]),_0x37f0cf);}}; \ No newline at end of file +var _0x664f=['userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','util','./transfers.controller','NO\x20ANSWER','ANSWERED','BUSY','FAILED','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','secondtransfererchannel'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x664f,0xa2));var _0xf664=function(_0x2862b1,_0x51a367){_0x2862b1=_0x2862b1-0x0;var _0x817ee6=_0x664f[_0x2862b1];return _0x817ee6;};'use strict';var _=require('lodash');var util=require(_0xf664('0x0'));var utils=require('./utils');var transfers=require(_0xf664('0x1'));var dispositions=[_0xf664('0x2'),'FAILED','FAILED',_0xf664('0x2'),_0xf664('0x2'),_0xf664('0x2'),_0xf664('0x3'),_0xf664('0x4'),_0xf664('0x5'),_0xf664('0x5'),'FAILED'];var channels={};function writeDB(_0x1513a3){var _0x3fed6a;if(transfers[_0xf664('0x6')][_0x1513a3[_0xf664('0x7')]]){_0x3fed6a=_0x1513a3[_0xf664('0x7')];_0x1513a3['uniqueid']=transfers[_0xf664('0x6')][_0x1513a3[_0xf664('0x7')]]['transfereeuniqueid'];}utils[_0xf664('0x8')](util[_0xf664('0x9')](_0xf664('0xa'),_0x1513a3['uniqueid'],_0x1513a3['channel'],_0x1513a3[_0xf664('0xb')],_0x1513a3['membername'],_0x1513a3['interface'],_0x1513a3[_0xf664('0xc')],_0x1513a3[_0xf664('0xd')],_0x1513a3[_0xf664('0xe')]));if(_0x1513a3[_0xf664('0xf')]){utils[_0xf664('0x10')](_0x1513a3[_0xf664('0xf')])[_0xf664('0x11')](function(_0x2aaf57){if(_0x2aaf57){_0x1513a3[_0xf664('0x12')]=_0x2aaf57['id'];}utils[_0xf664('0x13')](_0xf664('0x14'),_0x1513a3);});}else{utils['request'](_0xf664('0x14'),_0x1513a3);}if(channels[_0x1513a3[_0xf664('0x7')]]){delete channels[_0x1513a3[_0xf664('0x7')]];}else if(_0x3fed6a&&channels[_0x3fed6a]){delete transfers[_0xf664('0x6')][_0x3fed6a];delete channels[_0x3fed6a];}}exports[_0xf664('0x15')]=function(_0x1ca4e7){try{utils['debug'](util['format'](_0xf664('0x16'),_0x1ca4e7[_0xf664('0x7')]),_0x1ca4e7);if(_0x1ca4e7[_0xf664('0x7')]==_0x1ca4e7[_0xf664('0x17')]&&_0x1ca4e7['channel']!=_0xf664('0x18')){utils['info'](util[_0xf664('0x9')](_0xf664('0x19'),_0x1ca4e7[_0xf664('0x7')],_0x1ca4e7[_0xf664('0x1a')],_0x1ca4e7['exten']));channels[_0x1ca4e7['uniqueid']]={'uniqueid':_0x1ca4e7[_0xf664('0x7')],'accountcode':_0x1ca4e7[_0xf664('0xf')],'source':_0x1ca4e7[_0xf664('0xc')],'destination':_0x1ca4e7[_0xf664('0x1b')],'destinationcontext':_0x1ca4e7[_0xf664('0x1a')],'channel':_0x1ca4e7[_0xf664('0x1c')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xf664('0x2'),'amaflags':_0xf664('0x1d')};}}catch(_0x6191b9){utils[_0xf664('0x1e')](util[_0xf664('0x9')](_0xf664('0x16'),_0x1ca4e7['uniqueid']),_0x6191b9);}};exports[_0xf664('0x1f')]=function(_0x30832f){try{utils[_0xf664('0x20')](util[_0xf664('0x9')](_0xf664('0x21'),_0x30832f[_0xf664('0x7')]),_0x30832f);if(!_['isNil'](channels[_0x30832f[_0xf664('0x7')]])&&_0x30832f[_0xf664('0x22')]==0x6){utils[_0xf664('0x8')](util[_0xf664('0x9')](_0xf664('0x23'),_0x30832f[_0xf664('0x7')],_0x30832f[_0xf664('0x1a')],_0x30832f[_0xf664('0x1c')]));if(_[_0xf664('0x24')](channels[_0x30832f['uniqueid']][_0xf664('0x25')])){channels[_0x30832f[_0xf664('0x7')]][_0xf664('0x25')]=utils[_0xf664('0x26')]();}}else if(!_[_0xf664('0x24')](channels[_0x30832f[_0xf664('0x17')]])&&_0x30832f['channelstate']==0x6&&_0x30832f[_0xf664('0x1a')]!=_0xf664('0x27')){utils[_0xf664('0x8')](util[_0xf664('0x9')](_0xf664('0x28'),_0x30832f['uniqueid'],_0x30832f[_0xf664('0x17')],_0x30832f[_0xf664('0x1a')],_0x30832f[_0xf664('0x1c')]));channels[_0x30832f[_0xf664('0x17')]][_0xf664('0xf')]=_0x30832f['accountcode'];channels[_0x30832f[_0xf664('0x17')]]['destinationchannel']=_0x30832f[_0xf664('0x1c')];if(_[_0xf664('0x24')](channels[_0x30832f[_0xf664('0x17')]]['answertime'])){channels[_0x30832f[_0xf664('0x17')]][_0xf664('0x29')]=utils[_0xf664('0x26')]();}channels[_0x30832f['linkedid']][_0xf664('0x2a')]=dispositions[_['toNumber'](_0x30832f[_0xf664('0x22')])]||_0xf664('0x3');}}catch(_0x571b12){utils['error'](util[_0xf664('0x9')](_0xf664('0x21'),_0x30832f[_0xf664('0x7')]),_0x571b12);}};exports['hangup']=function(_0x44086c){try{if(!_[_0xf664('0x24')](channels[_0x44086c['uniqueid']])){utils[_0xf664('0x20')](util['format'](_0xf664('0x2b'),_0x44086c[_0xf664('0x7')]),_0x44086c);if(_[_0xf664('0x24')](channels[_0x44086c[_0xf664('0x7')]][_0xf664('0x2c')])){channels[_0x44086c[_0xf664('0x7')]][_0xf664('0x2c')]=_0x44086c[_0xf664('0x2d')]+'\x20<'+_0x44086c['calleridnum']+'>';}utils[_0xf664('0x8')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x44086c[_0xf664('0x7')],channels[_0x44086c[_0xf664('0x7')]][_0xf664('0x2c')],_0x44086c[_0xf664('0x2e')]));channels[_0x44086c[_0xf664('0x7')]][_0xf664('0x2f')]=utils[_0xf664('0x26')]();channels[_0x44086c[_0xf664('0x7')]][_0xf664('0x30')]=utils[_0xf664('0x31')](channels[_0x44086c[_0xf664('0x7')]]['endtime'],channels[_0x44086c[_0xf664('0x7')]][_0xf664('0x32')]);channels[_0x44086c[_0xf664('0x7')]][_0xf664('0x33')]=channels[_0x44086c[_0xf664('0x7')]][_0xf664('0x29')]?utils['diffTime'](channels[_0x44086c[_0xf664('0x7')]][_0xf664('0x2f')],channels[_0x44086c[_0xf664('0x7')]][_0xf664('0x29')]):0x0;writeDB(channels[_0x44086c['uniqueid']]);}}catch(_0x4f9e5e){utils['error'](util[_0xf664('0x9')](_0xf664('0x2b'),_0x44086c[_0xf664('0x7')]),_0x4f9e5e);}};exports[_0xf664('0x34')]=function(_0x3fedc2){try{if(!_[_0xf664('0x24')](channels[_0x3fedc2[_0xf664('0x35')]])){utils[_0xf664('0x20')](util[_0xf664('0x9')](_0xf664('0x36'),_0x3fedc2[_0xf664('0x37')]),_0x3fedc2);if(channels[_0x3fedc2[_0xf664('0x35')]]['channel']==_0x3fedc2[_0xf664('0x38')]){utils[_0xf664('0x8')](util['format'](_0xf664('0x39'),_0x3fedc2[_0xf664('0x37')],_0x3fedc2[_0xf664('0x35')],_0x3fedc2['secondtransfererchannel']));channels[_0x3fedc2['localtwolinkedid']][_0xf664('0x3a')]=_0x3fedc2[_0xf664('0x3b')];channels[_0x3fedc2['localtwolinkedid']][_0xf664('0x3c')]=_0xf664('0x3d');}else if(channels[_0x3fedc2[_0xf664('0x35')]][_0xf664('0x1c')]=_0x3fedc2[_0xf664('0x3e')]){utils[_0xf664('0x8')](util[_0xf664('0x9')](_0xf664('0x39'),_0x3fedc2['origtransfereruniqueid'],_0x3fedc2[_0xf664('0x35')],_0x3fedc2['origtransfererchannel']));channels[_0x3fedc2[_0xf664('0x35')]][_0xf664('0x3a')]=_0x3fedc2[_0xf664('0x3f')];channels[_0x3fedc2['localtwolinkedid']][_0xf664('0x3c')]=_0xf664('0x3d');}}}catch(_0x525b5a){utils[_0xf664('0x1e')](util[_0xf664('0x9')](_0xf664('0x36'),_0x3fedc2['origtransfereruniqueid']),_0x525b5a);}};exports[_0xf664('0x40')]=function(_0x2ca0d1){try{if(!_['isNil'](channels[_0x2ca0d1['uniqueid']])){utils[_0xf664('0x20')](util['format'](_0xf664('0x41'),_0x2ca0d1[_0xf664('0x7')]),_0x2ca0d1);channels[_0x2ca0d1[_0xf664('0x7')]][_0xf664('0x42')]=utils[_0xf664('0x26')]();utils[_0xf664('0x8')](util[_0xf664('0x9')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x2ca0d1[_0xf664('0x7')],channels[_0x2ca0d1[_0xf664('0x7')]]['musiconholdstartAt']));}}catch(_0xdab324){utils['error'](util[_0xf664('0x9')](_0xf664('0x41'),_0x2ca0d1[_0xf664('0x7')]),_0xdab324);}};exports[_0xf664('0x43')]=function(_0x4bfebf){try{if(!_['isNil'](channels[_0x4bfebf[_0xf664('0x7')]])){utils['debug'](util['format']('[%s][calls][musiconholdstop]',_0x4bfebf[_0xf664('0x7')]),_0x4bfebf);if(!_[_0xf664('0x24')](channels[_0x4bfebf[_0xf664('0x7')]]['musiconholdstartAt'])){channels[_0x4bfebf[_0xf664('0x7')]][_0xf664('0x44')]+=utils['diffTime'](utils[_0xf664('0x26')](),channels[_0x4bfebf[_0xf664('0x7')]][_0xf664('0x42')]);utils['info'](util[_0xf664('0x9')](_0xf664('0x45'),_0x4bfebf[_0xf664('0x7')],channels[_0x4bfebf[_0xf664('0x7')]][_0xf664('0x44')]));delete channels[_0x4bfebf[_0xf664('0x7')]][_0xf664('0x42')];}}}catch(_0x414e28){utils[_0xf664('0x1e')](util[_0xf664('0x9')](_0xf664('0x46'),_0x4bfebf['uniqueid']),_0x414e28);}};exports[_0xf664('0x47')]=function(_0x4a07db){try{if(!_[_0xf664('0x24')](channels[_0x4a07db[_0xf664('0x7')]])){utils[_0xf664('0x20')](util[_0xf664('0x9')](_0xf664('0x48'),_0x4a07db[_0xf664('0x7')]),_0x4a07db);if(!_[_0xf664('0x24')](_0x4a07db[_0xf664('0x49')]['xmd-originatecalleridnum'])){utils[_0xf664('0x8')](util[_0xf664('0x9')](_0xf664('0x4a'),_0x4a07db[_0xf664('0x7')],_0x4a07db[_0xf664('0x4b')]));channels[_0x4a07db[_0xf664('0x7')]]['source']=_0x4a07db['value'];}if(!_['isNil'](_0x4a07db['variable']['xmd-phone'])){utils[_0xf664('0x8')](util[_0xf664('0x9')](_0xf664('0x4c'),_0x4a07db[_0xf664('0x7')],_0x4a07db['value']));channels[_0x4a07db['uniqueid']][_0xf664('0x4d')]=_0x4a07db['value'];channels[_0x4a07db[_0xf664('0x7')]][_0xf664('0x2c')]='\x22'+_0x4a07db[_0xf664('0x4b')]+_0xf664('0x4e')+_0x4a07db[_0xf664('0x4b')]+'>';}if(!_['isNil'](_0x4a07db[_0xf664('0x49')][_0xf664('0x4f')])||!_[_0xf664('0x24')](_0x4a07db[_0xf664('0x49')][_0xf664('0x50')])){utils[_0xf664('0x8')](util[_0xf664('0x9')](_0xf664('0x51'),_0x4a07db[_0xf664('0x7')],!_['isNil'](_0x4a07db['variable']['xmd-callerid-preview'])?_0xf664('0x4f'):_0xf664('0x50'),_0x4a07db['value']));channels[_0x4a07db['uniqueid']][_0xf664('0x2c')]=_0x4a07db[_0xf664('0x4b')];}if(!_[_0xf664('0x24')](_0x4a07db[_0xf664('0x49')]['xmd-queue'])||!_[_0xf664('0x24')](_0x4a07db[_0xf664('0x49')][_0xf664('0x52')])){utils[_0xf664('0x8')](util[_0xf664('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4a07db['uniqueid'],!_['isNil'](_0x4a07db[_0xf664('0x49')]['xmd-queue'])?_0xf664('0x53'):_0xf664('0x52'),_0x4a07db['value']));channels[_0x4a07db[_0xf664('0x7')]][_0xf664('0x54')]='Queue';channels[_0x4a07db[_0xf664('0x7')]][_0xf664('0x55')]=_0x4a07db[_0xf664('0x4b')];channels[_0x4a07db[_0xf664('0x7')]][_0xf664('0xb')]=!![];}if(!_[_0xf664('0x24')](_0x4a07db[_0xf664('0x49')]['xmd-contactid'])){utils[_0xf664('0x8')](util[_0xf664('0x9')](_0xf664('0x56'),_0x4a07db[_0xf664('0x7')],_0x4a07db['value']));channels[_0x4a07db[_0xf664('0x7')]]['ContactId']=_0x4a07db[_0xf664('0x4b')];}if(!_[_0xf664('0x24')](_0x4a07db['variable'][_0xf664('0x57')])){utils[_0xf664('0x8')](util[_0xf664('0x9')](_0xf664('0x58'),_0x4a07db['uniqueid'],_0x4a07db[_0xf664('0x4b')]));channels[_0x4a07db[_0xf664('0x7')]][_0xf664('0x59')]=_0x4a07db[_0xf664('0x4b')];}if(!_[_0xf664('0x24')](_0x4a07db[_0xf664('0x49')][_0xf664('0x5a')])){utils[_0xf664('0x8')](util['format'](_0xf664('0x5b'),_0x4a07db['uniqueid'],_0x4a07db[_0xf664('0x4b')]));channels[_0x4a07db[_0xf664('0x7')]][_0xf664('0x5c')]=_0x4a07db['value'];}if(!_[_0xf664('0x24')](_0x4a07db[_0xf664('0x49')]['sipcallid'])){utils['info'](util['format'](_0xf664('0x5d'),_0x4a07db[_0xf664('0x7')],_0x4a07db[_0xf664('0x4b')]));channels[_0x4a07db[_0xf664('0x7')]][_0xf664('0x5e')]=_0x4a07db[_0xf664('0x4b')];}}}catch(_0x55b844){utils[_0xf664('0x1e')](util[_0xf664('0x9')](_0xf664('0x48'),_0x4a07db['uniqueid']),_0x55b844);}};exports[_0xf664('0x5f')]=function(_0x10a458){try{if(!_['isNil'](channels[_0x10a458[_0xf664('0x7')]])){utils['debug'](util['format'](_0xf664('0x60'),_0x10a458[_0xf664('0x7')]),_0x10a458);utils[_0xf664('0x8')](util[_0xf664('0x9')](_0xf664('0x61'),_0x10a458[_0xf664('0x7')],_0x10a458[_0xf664('0x62')],_0x10a458[_0xf664('0x63')]));if(_0x10a458[_0xf664('0x62')]['toLowerCase']()==_0xf664('0x64')&&_['startsWith'](_0x10a458[_0xf664('0x63')][_0xf664('0x65')](),_0xf664('0x66'))){var _0x41ff56=_0x10a458[_0xf664('0x63')][_0xf664('0x67')]('=');var _0x37483=_0x41ff56[0x0][_0xf664('0x68')](_0x41ff56[0x0][_0xf664('0x69')]('(')+0x1,_0x41ff56[0x0][_0xf664('0x69')](')'));var _0x732828=_0x41ff56[0x1];channels[_0x10a458[_0xf664('0x7')]][_0x37483]=_0x732828;}if(!_[_0xf664('0x6a')]([_0xf664('0x6b'),_0xf664('0x6c'),_0xf664('0x6d'),_0xf664('0x64'),_0xf664('0x6e')],_0x10a458[_0xf664('0x62')][_0xf664('0x65')]())){channels[_0x10a458['uniqueid']]['lastapplication']=_0x10a458[_0xf664('0x62')];channels[_0x10a458[_0xf664('0x7')]]['lastdata']=_0x10a458[_0xf664('0x63')];}}}catch(_0x3f5c94){utils[_0xf664('0x1e')](util['format'](_0xf664('0x60'),_0x10a458[_0xf664('0x7')]),_0x3f5c94);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 9b53078..793b298 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 _0x265c=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected','[core]\x20shutdown'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x265c,0x104));var _0xc265=function(_0x115784,_0x246386){_0x115784=_0x115784-0x0;var _0x4e4c29=_0x265c[_0x115784];return _0x4e4c29;};'use strict';var utils=require('./utils');exports[_0xc265('0x0')]=function(){utils[_0xc265('0x1')](_0xc265('0x2'));};exports['shutdown']=function(){utils[_0xc265('0x1')](_0xc265('0x3'));};exports[_0xc265('0x4')]=function(){utils[_0xc265('0x1')](_0xc265('0x5'));};exports[_0xc265('0x6')]=function(_0x2d4de4){utils[_0xc265('0x6')](_0xc265('0x7'),_0x2d4de4);};exports[_0xc265('0x8')]=function(){utils[_0xc265('0x1')](_0xc265('0x9'));};exports[_0xc265('0xa')]=function(_0x4a4e8d){}; \ No newline at end of file +var _0x72c6=['close','managerevent','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0x72c6,0xfc));var _0x672c=function(_0x458e37,_0x399446){_0x458e37=_0x458e37-0x0;var _0x4b5e3c=_0x72c6[_0x458e37];return _0x4b5e3c;};'use strict';var utils=require('./utils');exports[_0x672c('0x0')]=function(){utils[_0x672c('0x1')](_0x672c('0x2'));};exports['shutdown']=function(){utils[_0x672c('0x1')](_0x672c('0x3'));};exports[_0x672c('0x4')]=function(){utils['info'](_0x672c('0x5'));};exports[_0x672c('0x6')]=function(_0x262da9){utils[_0x672c('0x6')](_0x672c('0x7'),_0x262da9);};exports[_0x672c('0x8')]=function(){utils[_0x672c('0x1')]('[core]\x20close');};exports[_0x672c('0x9')]=function(_0x5bdc50){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 08ca39d..8acc265 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 _0xd58a=['application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','debug','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','[%s][dials][dialend]','ANSWER','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','diffTime','holdtime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]'];(function(_0x278a6f,_0x5b9cbd){var _0xbe039e=function(_0x29b16f){while(--_0x29b16f){_0x278a6f['push'](_0x278a6f['shift']());}};_0xbe039e(++_0x5b9cbd);}(_0xd58a,0xfa));var _0xad58=function(_0x4af2f0,_0x5e6205){_0x4af2f0=_0x4af2f0-0x0;var _0x208284=_0xd58a[_0x4af2f0];return _0x208284;};'use strict';var _=require(_0xad58('0x0'));var util=require(_0xad58('0x1'));var utils=require(_0xad58('0x2'));var dials={};function writeDB(_0xd8fb7b){utils[_0xad58('0x3')](util[_0xad58('0x4')](_0xad58('0x5'),_0xd8fb7b[_0xad58('0x6')],_0xd8fb7b['channel'],_0xd8fb7b[_0xad58('0x7')],_0xd8fb7b[_0xad58('0x8')],_0xd8fb7b[_0xad58('0x9')],_0xd8fb7b[_0xad58('0xa')]));utils[_0xad58('0xb')](_0xad58('0xc'),_0xd8fb7b);delete dials[_0xd8fb7b['uniqueid']];}exports[_0xad58('0xd')]=function(_0x54c28f){try{utils['debug'](util[_0xad58('0x4')](_0xad58('0xe'),_0x54c28f['uniqueid']),_0x54c28f);utils['info'](util[_0xad58('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x54c28f[_0xad58('0x6')],_0x54c28f[_0xad58('0xf')],_0x54c28f[_0xad58('0x10')]));if(_0x54c28f[_0xad58('0xf')][_0xad58('0x11')]()==_0xad58('0x12')&&_[_0xad58('0x13')](_0x54c28f[_0xad58('0x10')][_0xad58('0x11')](),_0xad58('0x14'))){var _0x21f144=_0x54c28f['appdata'][_0xad58('0x15')]('=');dials[_0x54c28f[_0xad58('0x6')]]={'routeId':_0x21f144[0x1]};}}catch(_0x504dd5){utils[_0xad58('0x16')](util[_0xad58('0x4')](_0xad58('0xe'),_0x54c28f['uniqueid']),_0x504dd5);}};exports['varset']=function(_0x2646a0){try{utils[_0xad58('0x17')](util[_0xad58('0x4')](_0xad58('0x18'),_0x2646a0[_0xad58('0x6')]),_0x2646a0);if(!_[_0xad58('0x19')](_0x2646a0[_0xad58('0x1a')][_0xad58('0x1b')])){utils['info'](util['format'](_0xad58('0x1c'),_0x2646a0[_0xad58('0x6')],_0x2646a0[_0xad58('0x1d')]));dials[_0x2646a0['uniqueid']]={'routeId':_0x2646a0[_0xad58('0x1d')]};}}catch(_0x1aead9){utils[_0xad58('0x16')](util[_0xad58('0x4')]('[%s][dials][varset]',_0x2646a0[_0xad58('0x6')]),_0x1aead9);}};exports[_0xad58('0x1e')]=function(_0x4ed25e){try{if(!_[_0xad58('0x19')](dials[_0x4ed25e['uniqueid']])){utils[_0xad58('0x17')](util[_0xad58('0x4')]('[%s][dials][dialbegin]',_0x4ed25e['uniqueid']),_0x4ed25e);dials[_0x4ed25e[_0xad58('0x6')]]=_[_0xad58('0x1f')](dials[_0x4ed25e[_0xad58('0x6')]],_0x4ed25e);dials[_0x4ed25e[_0xad58('0x6')]][_0xad58('0x20')]=utils[_0xad58('0x21')]();dials[_0x4ed25e['uniqueid']][_0xad58('0x22')]=_0xad58('0x23');utils[_0xad58('0x3')](util[_0xad58('0x4')](_0xad58('0x24'),_0x4ed25e[_0xad58('0x6')],dials[_0x4ed25e[_0xad58('0x6')]][_0xad58('0x20')]));}}catch(_0x158198){utils['error'](util[_0xad58('0x4')](_0xad58('0x25'),_0x4ed25e[_0xad58('0x6')]),_0x158198);}};exports['dialend']=function(_0x1a42dd){try{if(!_[_0xad58('0x19')](dials[_0x1a42dd[_0xad58('0x6')]])){utils['debug'](util[_0xad58('0x4')](_0xad58('0x26'),_0x1a42dd[_0xad58('0x6')]),_0x1a42dd);dials[_0x1a42dd[_0xad58('0x6')]][_0xad58('0xa')]=_0x1a42dd[_0xad58('0xa')];if(_0x1a42dd['dialstatus']==_0xad58('0x27')){dials[_0x1a42dd['uniqueid']]=_[_0xad58('0x1f')](dials[_0x1a42dd[_0xad58('0x6')]],_0x1a42dd);dials[_0x1a42dd[_0xad58('0x6')]]['answertime']=utils['now']();dials[_0x1a42dd[_0xad58('0x6')]][_0xad58('0x22')]=_0xad58('0x28');utils[_0xad58('0x3')](util[_0xad58('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x1a42dd[_0xad58('0x6')],_0x1a42dd[_0xad58('0xa')],dials[_0x1a42dd[_0xad58('0x6')]][_0xad58('0x29')]));}else{utils[_0xad58('0x3')](util[_0xad58('0x4')](_0xad58('0x2a'),_0x1a42dd[_0xad58('0x6')],_0x1a42dd[_0xad58('0xa')]));}}}catch(_0xfb3303){utils[_0xad58('0x16')](util[_0xad58('0x4')]('[%s][dials][dialend]',_0x1a42dd['uniqueid']),_0xfb3303);}};exports[_0xad58('0x2b')]=function(_0x5b396f){try{if(!_['isNil'](dials[_0x5b396f[_0xad58('0x6')]])){utils[_0xad58('0x17')](util[_0xad58('0x4')](_0xad58('0x2c'),_0x5b396f['uniqueid']),_0x5b396f);utils['info'](util[_0xad58('0x4')](_0xad58('0x2d'),_0x5b396f[_0xad58('0x6')],_0x5b396f['calleridnum'],_0x5b396f[_0xad58('0x2e')],_0x5b396f[_0xad58('0x2f')]));dials[_0x5b396f[_0xad58('0x6')]]=_['assign'](dials[_0x5b396f[_0xad58('0x6')]],{'endtime':utils[_0xad58('0x21')](),'lastevent':_0xad58('0x30')});dials[_0x5b396f[_0xad58('0x6')]]['duration']=utils[_0xad58('0x31')](dials[_0x5b396f[_0xad58('0x6')]]['endtime'],dials[_0x5b396f[_0xad58('0x6')]]['starttime']);dials[_0x5b396f[_0xad58('0x6')]][_0xad58('0x32')]=utils[_0xad58('0x31')](dials[_0x5b396f['uniqueid']][_0xad58('0x29')]||dials[_0x5b396f[_0xad58('0x6')]][_0xad58('0x33')],dials[_0x5b396f[_0xad58('0x6')]][_0xad58('0x20')]);dials[_0x5b396f[_0xad58('0x6')]][_0xad58('0x34')]=dials[_0x5b396f[_0xad58('0x6')]][_0xad58('0x29')]?utils[_0xad58('0x31')](dials[_0x5b396f[_0xad58('0x6')]][_0xad58('0x33')],dials[_0x5b396f[_0xad58('0x6')]]['answertime']):0x0;writeDB(dials[_0x5b396f[_0xad58('0x6')]]);}}catch(_0x3e8147){utils[_0xad58('0x16')](util[_0xad58('0x4')](_0xad58('0x2c'),_0x5b396f['uniqueid']),_0x3e8147);}}; \ No newline at end of file +var _0x128a=['diffTime','endtime','[%s][dials][hangup]','lodash','util','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','[%s][dials][dialbegin]','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','ANSWER','assign','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','duration','holdtime'];(function(_0x40fe3c,_0x51b4ab){var _0xe3fb01=function(_0x46452f){while(--_0x46452f){_0x40fe3c['push'](_0x40fe3c['shift']());}};_0xe3fb01(++_0x51b4ab);}(_0x128a,0xa2));var _0xa128=function(_0x11d95f,_0x34f442){_0x11d95f=_0x11d95f-0x0;var _0x2b1a14=_0x128a[_0x11d95f];return _0x2b1a14;};'use strict';var _=require(_0xa128('0x0'));var util=require(_0xa128('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x1d167a){utils[_0xa128('0x2')](util['format'](_0xa128('0x3'),_0x1d167a[_0xa128('0x4')],_0x1d167a[_0xa128('0x5')],_0x1d167a[_0xa128('0x6')],_0x1d167a['calleridnum'],_0x1d167a[_0xa128('0x7')],_0x1d167a[_0xa128('0x8')]));utils[_0xa128('0x9')](_0xa128('0xa'),_0x1d167a);delete dials[_0x1d167a[_0xa128('0x4')]];}exports[_0xa128('0xb')]=function(_0x396b3f){try{utils[_0xa128('0xc')](util[_0xa128('0xd')](_0xa128('0xe'),_0x396b3f['uniqueid']),_0x396b3f);utils['info'](util[_0xa128('0xd')](_0xa128('0xf'),_0x396b3f['uniqueid'],_0x396b3f[_0xa128('0x10')],_0x396b3f[_0xa128('0x11')]));if(_0x396b3f[_0xa128('0x10')][_0xa128('0x12')]()==_0xa128('0x13')&&_[_0xa128('0x14')](_0x396b3f[_0xa128('0x11')][_0xa128('0x12')](),'cdr(routeid)')){var _0x1cefaf=_0x396b3f['appdata'][_0xa128('0x15')]('=');dials[_0x396b3f['uniqueid']]={'routeId':_0x1cefaf[0x1]};}}catch(_0x5282d2){utils[_0xa128('0x16')](util[_0xa128('0xd')](_0xa128('0xe'),_0x396b3f[_0xa128('0x4')]),_0x5282d2);}};exports[_0xa128('0x17')]=function(_0x91a7fa){try{utils[_0xa128('0xc')](util[_0xa128('0xd')](_0xa128('0x18'),_0x91a7fa[_0xa128('0x4')]),_0x91a7fa);if(!_['isNil'](_0x91a7fa[_0xa128('0x19')][_0xa128('0x1a')])){utils['info'](util['format'](_0xa128('0x1b'),_0x91a7fa[_0xa128('0x4')],_0x91a7fa[_0xa128('0x1c')]));dials[_0x91a7fa[_0xa128('0x4')]]={'routeId':_0x91a7fa['value']};}}catch(_0x5d40be){utils[_0xa128('0x16')](util['format'](_0xa128('0x18'),_0x91a7fa[_0xa128('0x4')]),_0x5d40be);}};exports['dialbegin']=function(_0x16a312){try{if(!_[_0xa128('0x1d')](dials[_0x16a312['uniqueid']])){utils[_0xa128('0xc')](util[_0xa128('0xd')](_0xa128('0x1e'),_0x16a312[_0xa128('0x4')]),_0x16a312);dials[_0x16a312[_0xa128('0x4')]]=_['assign'](dials[_0x16a312[_0xa128('0x4')]],_0x16a312);dials[_0x16a312[_0xa128('0x4')]]['starttime']=utils['now']();dials[_0x16a312[_0xa128('0x4')]][_0xa128('0x1f')]=_0xa128('0x20');utils[_0xa128('0x2')](util[_0xa128('0xd')](_0xa128('0x21'),_0x16a312[_0xa128('0x4')],dials[_0x16a312[_0xa128('0x4')]][_0xa128('0x22')]));}}catch(_0x1c8a26){utils[_0xa128('0x16')](util['format']('[%s][dials][dialbegin]',_0x16a312[_0xa128('0x4')]),_0x1c8a26);}};exports['dialend']=function(_0x2576dd){try{if(!_[_0xa128('0x1d')](dials[_0x2576dd[_0xa128('0x4')]])){utils[_0xa128('0xc')](util['format']('[%s][dials][dialend]',_0x2576dd[_0xa128('0x4')]),_0x2576dd);dials[_0x2576dd[_0xa128('0x4')]][_0xa128('0x8')]=_0x2576dd[_0xa128('0x8')];if(_0x2576dd['dialstatus']==_0xa128('0x23')){dials[_0x2576dd[_0xa128('0x4')]]=_[_0xa128('0x24')](dials[_0x2576dd[_0xa128('0x4')]],_0x2576dd);dials[_0x2576dd[_0xa128('0x4')]][_0xa128('0x25')]=utils[_0xa128('0x26')]();dials[_0x2576dd[_0xa128('0x4')]][_0xa128('0x1f')]=_0xa128('0x27');utils['info'](util[_0xa128('0xd')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x2576dd['uniqueid'],_0x2576dd[_0xa128('0x8')],dials[_0x2576dd[_0xa128('0x4')]][_0xa128('0x25')]));}else{utils[_0xa128('0x2')](util[_0xa128('0xd')](_0xa128('0x28'),_0x2576dd[_0xa128('0x4')],_0x2576dd['dialstatus']));}}}catch(_0xe49b8d){utils['error'](util[_0xa128('0xd')](_0xa128('0x29'),_0x2576dd['uniqueid']),_0xe49b8d);}};exports[_0xa128('0x2a')]=function(_0x20ae7c){try{if(!_[_0xa128('0x1d')](dials[_0x20ae7c[_0xa128('0x4')]])){utils[_0xa128('0xc')](util[_0xa128('0xd')]('[%s][dials][hangup]',_0x20ae7c[_0xa128('0x4')]),_0x20ae7c);utils[_0xa128('0x2')](util[_0xa128('0xd')](_0xa128('0x2b'),_0x20ae7c[_0xa128('0x4')],_0x20ae7c[_0xa128('0x2c')],_0x20ae7c[_0xa128('0x2d')],_0x20ae7c[_0xa128('0x2e')]));dials[_0x20ae7c[_0xa128('0x4')]]=_[_0xa128('0x24')](dials[_0x20ae7c[_0xa128('0x4')]],{'endtime':utils[_0xa128('0x26')](),'lastevent':_0xa128('0x2f')});dials[_0x20ae7c[_0xa128('0x4')]][_0xa128('0x30')]=utils['diffTime'](dials[_0x20ae7c[_0xa128('0x4')]]['endtime'],dials[_0x20ae7c[_0xa128('0x4')]][_0xa128('0x22')]);dials[_0x20ae7c[_0xa128('0x4')]][_0xa128('0x31')]=utils[_0xa128('0x32')](dials[_0x20ae7c[_0xa128('0x4')]]['answertime']||dials[_0x20ae7c[_0xa128('0x4')]][_0xa128('0x33')],dials[_0x20ae7c[_0xa128('0x4')]]['starttime']);dials[_0x20ae7c[_0xa128('0x4')]]['billableseconds']=dials[_0x20ae7c[_0xa128('0x4')]][_0xa128('0x25')]?utils[_0xa128('0x32')](dials[_0x20ae7c[_0xa128('0x4')]][_0xa128('0x33')],dials[_0x20ae7c[_0xa128('0x4')]][_0xa128('0x25')]):0x0;writeDB(dials[_0x20ae7c['uniqueid']]);}}catch(_0x4cb23c){utils[_0xa128('0x16')](util[_0xa128('0xd')](_0xa128('0x34'),_0x20ae7c[_0xa128('0x4')]),_0x4cb23c);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 054cbdc..0aceae6 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 _0x05e6=['[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','port','asterisk','username','password','xdr','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]'];(function(_0x3af900,_0x44389d){var _0x3339ed=function(_0x1297ae){while(--_0x1297ae){_0x3af900['push'](_0x3af900['shift']());}};_0x3339ed(++_0x44389d);}(_0x05e6,0x19d));var _0x605e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x05e6[_0x30ae5e];return _0x1f2e93;};var AsteriskManager=require(_0x605e('0x0'));var config=require(_0x605e('0x1'));var utils=require(_0x605e('0x2'));var util=require(_0x605e('0x3'));var ami=new AsteriskManager(config['asterisk'][_0x605e('0x4')],config[_0x605e('0x5')]['ip'],config[_0x605e('0x5')][_0x605e('0x6')],config[_0x605e('0x5')][_0x605e('0x7')],!![]);ami['keepConnected']();if(config[_0x605e('0x8')]&&config['xdr']['disabled']){utils['info']('XDR\x20DISABLED');}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x605e('0x9'));var recordings=require('./recordings.controller');var members=require(_0x605e('0xa'));var dials=require(_0x605e('0xb'));var transfers=require(_0x605e('0xc'));var core=require(_0x605e('0xd'));ami['on'](_0x605e('0xe'),core[_0x605e('0xe')]);ami['on'](_0x605e('0xf'),core['shutdown']);ami['on']('fullybooted',core[_0x605e('0x10')]);ami['on'](_0x605e('0x11'),core[_0x605e('0x11')]);ami['on']('close',core['close']);ami['on'](_0x605e('0x12'),core[_0x605e('0x12')]);ami['on'](_0x605e('0x13'),function(_0xab2367){try{utils[_0x605e('0x14')](util[_0x605e('0x15')](_0x605e('0x16'),_0xab2367['device']),_0xab2367);members[_0x605e('0x13')](_0xab2367);}catch(_0x41a8d3){utils['error'](util[_0x605e('0x15')](_0x605e('0x16'),_0xab2367[_0x605e('0x17')]),_0x41a8d3);}});ami['on'](_0x605e('0x18'),function(_0x2a1f72){try{utils[_0x605e('0x14')](util[_0x605e('0x15')]('[%s][index][agentcalled]',_0x2a1f72['uniqueid']),_0x2a1f72);agents['agentcalled'](_0x2a1f72);}catch(_0x20ba78){utils[_0x605e('0x11')](util[_0x605e('0x15')]('[%s][index][agentcalled]',_0x2a1f72[_0x605e('0x19')]),_0x20ba78);}});ami['on'](_0x605e('0x1a'),function(_0x3c5781){try{utils[_0x605e('0x14')](util[_0x605e('0x15')]('[%s][index][agentringnoanswer]',_0x3c5781[_0x605e('0x19')]),_0x3c5781);agents[_0x605e('0x1a')](_0x3c5781);}catch(_0x2509da){utils[_0x605e('0x11')](util[_0x605e('0x15')](_0x605e('0x1b'),_0x3c5781['uniqueid']),_0x2509da);}});ami['on']('agentconnect',function(_0x5dbe65){try{utils[_0x605e('0x14')](util['format'](_0x605e('0x1c'),_0x5dbe65[_0x605e('0x19')]),_0x5dbe65);agents['agentconnect'](_0x5dbe65);queues['agentconnect'](_0x5dbe65);}catch(_0x367c04){utils['error'](util[_0x605e('0x15')]('[%s][index][agentconnect]',_0x5dbe65[_0x605e('0x19')]),_0x367c04);}});ami['on'](_0x605e('0x1d'),function(_0x4a588e){try{utils['debug'](util[_0x605e('0x15')](_0x605e('0x1e'),_0x4a588e[_0x605e('0x19')]),_0x4a588e);agents[_0x605e('0x1d')](_0x4a588e);queues[_0x605e('0x1d')](_0x4a588e);members[_0x605e('0x1d')](_0x4a588e);}catch(_0x2536ea){utils[_0x605e('0x11')](util[_0x605e('0x15')]('[%s][index][agentcomplete]',_0x4a588e['uniqueid']),_0x2536ea);}});ami['on'](_0x605e('0x1f'),function(_0x42a460){try{utils[_0x605e('0x14')](util['format'](_0x605e('0x20'),_0x42a460['uniqueid']),_0x42a460);agents[_0x605e('0x1f')](_0x42a460);queues[_0x605e('0x1f')](_0x42a460);}catch(_0x55ba83){utils[_0x605e('0x11')](util[_0x605e('0x15')](_0x605e('0x20'),_0x42a460[_0x605e('0x19')]),_0x55ba83);}});ami['on'](_0x605e('0x21'),function(_0x479eb1){try{utils['debug'](util[_0x605e('0x15')](_0x605e('0x22'),_0x479eb1[_0x605e('0x19')]),_0x479eb1);queues['queuecallerjoin'](_0x479eb1);recordings[_0x605e('0x21')](_0x479eb1);}catch(_0x525d03){utils[_0x605e('0x11')](util[_0x605e('0x15')]('[%s][index][queuecallerjoin]',_0x479eb1[_0x605e('0x19')]),_0x525d03);}});ami['on'](_0x605e('0x23'),function(_0x59f63c){try{utils[_0x605e('0x14')](util[_0x605e('0x15')](_0x605e('0x24'),_0x59f63c[_0x605e('0x19')]),_0x59f63c);queues[_0x605e('0x23')](_0x59f63c);}catch(_0x56c423){utils[_0x605e('0x11')](util[_0x605e('0x15')](_0x605e('0x24'),_0x59f63c['uniqueid']),_0x56c423);}});ami['on']('musiconholdstart',function(_0x341bbb){try{utils['debug'](util[_0x605e('0x15')](_0x605e('0x25'),_0x341bbb[_0x605e('0x19')]),_0x341bbb);queues['musiconholdstart'](_0x341bbb);calls[_0x605e('0x26')](_0x341bbb);}catch(_0x5a8ebb){utils[_0x605e('0x11')](util[_0x605e('0x15')](_0x605e('0x25'),_0x341bbb[_0x605e('0x19')]),_0x5a8ebb);}});ami['on'](_0x605e('0x27'),function(_0x215b55){try{utils[_0x605e('0x14')](util[_0x605e('0x15')](_0x605e('0x28'),_0x215b55[_0x605e('0x19')]),_0x215b55);queues[_0x605e('0x27')](_0x215b55);calls[_0x605e('0x27')](_0x215b55);}catch(_0x243c6d){utils[_0x605e('0x11')](util[_0x605e('0x15')](_0x605e('0x28'),_0x215b55[_0x605e('0x19')]),_0x243c6d);}});ami['on'](_0x605e('0x29'),function(_0x3f24af){try{utils[_0x605e('0x14')](util[_0x605e('0x15')]('[%s][index][newstate]',_0x3f24af['uniqueid']),_0x3f24af);calls['newstate'](_0x3f24af);recordings[_0x605e('0x29')](_0x3f24af);}catch(_0x1470a7){utils[_0x605e('0x11')](util[_0x605e('0x15')](_0x605e('0x2a'),_0x3f24af['uniqueid']),_0x1470a7);}});ami['on'](_0x605e('0x2b'),function(_0x1de5c8){try{utils[_0x605e('0x14')](util[_0x605e('0x15')](_0x605e('0x2c'),_0x1de5c8[_0x605e('0x19')]),_0x1de5c8);calls[_0x605e('0x2b')](_0x1de5c8);recordings[_0x605e('0x2b')](_0x1de5c8);dials['hangup'](_0x1de5c8);agents[_0x605e('0x2b')](_0x1de5c8);queues['hangup'](_0x1de5c8);}catch(_0x4bf7c2){utils[_0x605e('0x11')](util['format'](_0x605e('0x2c'),_0x1de5c8[_0x605e('0x19')]),_0x4bf7c2);}});ami['on'](_0x605e('0x2d'),function(_0x493851){try{utils[_0x605e('0x14')](util[_0x605e('0x15')](_0x605e('0x2e'),_0x493851['uniqueid']),_0x493851);members[_0x605e('0x2d')](_0x493851);}catch(_0x1bba71){utils['error'](util[_0x605e('0x15')](_0x605e('0x2e'),_0x493851[_0x605e('0x19')]),_0x1bba71);}});ami['on']('blindtransfer',function(_0x49aef7){try{utils[_0x605e('0x14')](util[_0x605e('0x15')](_0x605e('0x2f'),_0x49aef7[_0x605e('0x19')]),_0x49aef7);queues['blindtransfer'](_0x49aef7);agents[_0x605e('0x30')](_0x49aef7);transfers['blindtransfer'](_0x49aef7);}catch(_0x552a22){utils[_0x605e('0x11')](util[_0x605e('0x15')](_0x605e('0x2f'),_0x49aef7[_0x605e('0x19')]),_0x552a22);}});ami['on'](_0x605e('0x31'),function(_0x28a982){try{utils['debug'](util[_0x605e('0x15')](_0x605e('0x32'),_0x28a982[_0x605e('0x33')]),_0x28a982);queues[_0x605e('0x31')](_0x28a982);transfers[_0x605e('0x31')](_0x28a982);agents[_0x605e('0x31')](_0x28a982);calls[_0x605e('0x31')](_0x28a982);}catch(_0x3bf385){utils[_0x605e('0x11')](util[_0x605e('0x15')]('[%s][index][attendedtransfer]',_0x28a982[_0x605e('0x33')]),_0x3bf385);}});ami['on'](_0x605e('0x34'),function(_0x1a5e39){try{utils[_0x605e('0x14')](util[_0x605e('0x15')]('[%s][index][varset]',_0x1a5e39[_0x605e('0x19')]),_0x1a5e39);queues[_0x605e('0x34')](_0x1a5e39);recordings[_0x605e('0x34')](_0x1a5e39);calls['varset'](_0x1a5e39);dials[_0x605e('0x34')](_0x1a5e39);}catch(_0x203270){utils[_0x605e('0x11')](util[_0x605e('0x15')](_0x605e('0x35'),_0x1a5e39[_0x605e('0x19')]),_0x203270);}});ami['on'](_0x605e('0x36'),function(_0x398110){try{utils['debug'](util['format'](_0x605e('0x37'),_0x398110[_0x605e('0x19')]),_0x398110);calls['newexten'](_0x398110);recordings[_0x605e('0x36')](_0x398110);dials[_0x605e('0x36')](_0x398110);}catch(_0x45b799){utils['error'](util['format'](_0x605e('0x37'),_0x398110[_0x605e('0x19')]),_0x45b799);}});ami['on'](_0x605e('0x38'),function(_0x255816){try{utils[_0x605e('0x14')](util[_0x605e('0x15')](_0x605e('0x39'),_0x255816[_0x605e('0x19')]),_0x255816);calls[_0x605e('0x38')](_0x255816);recordings[_0x605e('0x38')](_0x255816);}catch(_0x1bba4f){utils[_0x605e('0x11')](util['format'](_0x605e('0x39'),_0x255816[_0x605e('0x19')]),_0x1bba4f);}});ami['on'](_0x605e('0x3a'),function(_0x9be2b9){try{utils[_0x605e('0x14')](util[_0x605e('0x15')](_0x605e('0x3b'),_0x9be2b9[_0x605e('0x19')]),_0x9be2b9);dials['dialbegin'](_0x9be2b9);}catch(_0x4fa3ed){utils[_0x605e('0x11')](util[_0x605e('0x15')](_0x605e('0x3c'),_0x9be2b9[_0x605e('0x19')]),_0x4fa3ed);}});ami['on']('dialend',function(_0x4a2c15){try{utils[_0x605e('0x14')](util[_0x605e('0x15')](_0x605e('0x3d'),_0x4a2c15[_0x605e('0x19')]),_0x4a2c15);dials[_0x605e('0x3e')](_0x4a2c15);}catch(_0xdb489e){utils['error'](util[_0x605e('0x15')](_0x605e('0x3d'),_0x4a2c15[_0x605e('0x19')]),_0xdb489e);}});} \ No newline at end of file +var _0x8ede=['fullybooted','error','close','managerevent','debug','format','device','devicestatechange','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','port','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x8ede,0xb4));var _0xe8ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ede[_0x321bb2];return _0x9c12ed;};var AsteriskManager=require(_0xe8ed('0x0'));var config=require('../../config/environment');var utils=require(_0xe8ed('0x1'));var util=require(_0xe8ed('0x2'));var ami=new AsteriskManager(config['asterisk'][_0xe8ed('0x3')],config[_0xe8ed('0x4')]['ip'],config[_0xe8ed('0x4')][_0xe8ed('0x5')],config['asterisk'][_0xe8ed('0x6')],!![]);ami[_0xe8ed('0x7')]();if(config[_0xe8ed('0x8')]&&config[_0xe8ed('0x8')][_0xe8ed('0x9')]){utils[_0xe8ed('0xa')](_0xe8ed('0xb'));}else{var agents=require(_0xe8ed('0xc'));var calls=require(_0xe8ed('0xd'));var queues=require(_0xe8ed('0xe'));var recordings=require(_0xe8ed('0xf'));var members=require('./members.controller');var dials=require(_0xe8ed('0x10'));var transfers=require(_0xe8ed('0x11'));var core=require(_0xe8ed('0x12'));ami['on']('connect',core[_0xe8ed('0x13')]);ami['on'](_0xe8ed('0x14'),core[_0xe8ed('0x14')]);ami['on']('fullybooted',core[_0xe8ed('0x15')]);ami['on'](_0xe8ed('0x16'),core[_0xe8ed('0x16')]);ami['on']('close',core[_0xe8ed('0x17')]);ami['on'](_0xe8ed('0x18'),core[_0xe8ed('0x18')]);ami['on']('devicestatechange',function(_0x46ccb8){try{utils[_0xe8ed('0x19')](util[_0xe8ed('0x1a')]('[%s][index][devicestatechange]',_0x46ccb8[_0xe8ed('0x1b')]),_0x46ccb8);members[_0xe8ed('0x1c')](_0x46ccb8);}catch(_0x496b1f){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')](_0xe8ed('0x1d'),_0x46ccb8['device']),_0x496b1f);}});ami['on'](_0xe8ed('0x1e'),function(_0xd5a278){try{utils[_0xe8ed('0x19')](util[_0xe8ed('0x1a')]('[%s][index][agentcalled]',_0xd5a278['uniqueid']),_0xd5a278);agents[_0xe8ed('0x1e')](_0xd5a278);}catch(_0x17540a){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')](_0xe8ed('0x1f'),_0xd5a278[_0xe8ed('0x20')]),_0x17540a);}});ami['on'](_0xe8ed('0x21'),function(_0x3df76d){try{utils['debug'](util[_0xe8ed('0x1a')](_0xe8ed('0x22'),_0x3df76d[_0xe8ed('0x20')]),_0x3df76d);agents['agentringnoanswer'](_0x3df76d);}catch(_0x175f33){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')](_0xe8ed('0x22'),_0x3df76d[_0xe8ed('0x20')]),_0x175f33);}});ami['on'](_0xe8ed('0x23'),function(_0x1bb359){try{utils[_0xe8ed('0x19')](util[_0xe8ed('0x1a')](_0xe8ed('0x24'),_0x1bb359['uniqueid']),_0x1bb359);agents['agentconnect'](_0x1bb359);queues[_0xe8ed('0x23')](_0x1bb359);}catch(_0xff135f){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')]('[%s][index][agentconnect]',_0x1bb359['uniqueid']),_0xff135f);}});ami['on']('agentcomplete',function(_0x2d12ff){try{utils['debug'](util['format'](_0xe8ed('0x25'),_0x2d12ff[_0xe8ed('0x20')]),_0x2d12ff);agents[_0xe8ed('0x26')](_0x2d12ff);queues[_0xe8ed('0x26')](_0x2d12ff);members[_0xe8ed('0x26')](_0x2d12ff);}catch(_0x3a97b0){utils['error'](util[_0xe8ed('0x1a')](_0xe8ed('0x25'),_0x2d12ff[_0xe8ed('0x20')]),_0x3a97b0);}});ami['on'](_0xe8ed('0x27'),function(_0x5c3a7f){try{utils[_0xe8ed('0x19')](util[_0xe8ed('0x1a')](_0xe8ed('0x28'),_0x5c3a7f['uniqueid']),_0x5c3a7f);agents['queuecallerabandon'](_0x5c3a7f);queues[_0xe8ed('0x27')](_0x5c3a7f);}catch(_0x159047){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')](_0xe8ed('0x28'),_0x5c3a7f[_0xe8ed('0x20')]),_0x159047);}});ami['on'](_0xe8ed('0x29'),function(_0x6cf3a3){try{utils[_0xe8ed('0x19')](util[_0xe8ed('0x1a')](_0xe8ed('0x2a'),_0x6cf3a3[_0xe8ed('0x20')]),_0x6cf3a3);queues[_0xe8ed('0x29')](_0x6cf3a3);recordings[_0xe8ed('0x29')](_0x6cf3a3);}catch(_0x4aa278){utils['error'](util[_0xe8ed('0x1a')](_0xe8ed('0x2a'),_0x6cf3a3[_0xe8ed('0x20')]),_0x4aa278);}});ami['on']('queuecallerleave',function(_0x2b298a){try{utils[_0xe8ed('0x19')](util[_0xe8ed('0x1a')](_0xe8ed('0x2b'),_0x2b298a[_0xe8ed('0x20')]),_0x2b298a);queues['queuecallerleave'](_0x2b298a);}catch(_0x2f72ef){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')](_0xe8ed('0x2b'),_0x2b298a[_0xe8ed('0x20')]),_0x2f72ef);}});ami['on'](_0xe8ed('0x2c'),function(_0x2a8913){try{utils[_0xe8ed('0x19')](util[_0xe8ed('0x1a')](_0xe8ed('0x2d'),_0x2a8913[_0xe8ed('0x20')]),_0x2a8913);queues['musiconholdstart'](_0x2a8913);calls['musiconholdstart'](_0x2a8913);}catch(_0xd3f18c){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')](_0xe8ed('0x2d'),_0x2a8913['uniqueid']),_0xd3f18c);}});ami['on'](_0xe8ed('0x2e'),function(_0x44086a){try{utils['debug'](util[_0xe8ed('0x1a')](_0xe8ed('0x2f'),_0x44086a[_0xe8ed('0x20')]),_0x44086a);queues[_0xe8ed('0x2e')](_0x44086a);calls[_0xe8ed('0x2e')](_0x44086a);}catch(_0x3a70f6){utils['error'](util[_0xe8ed('0x1a')](_0xe8ed('0x2f'),_0x44086a[_0xe8ed('0x20')]),_0x3a70f6);}});ami['on'](_0xe8ed('0x30'),function(_0x804967){try{utils[_0xe8ed('0x19')](util[_0xe8ed('0x1a')](_0xe8ed('0x31'),_0x804967[_0xe8ed('0x20')]),_0x804967);calls[_0xe8ed('0x30')](_0x804967);recordings['newstate'](_0x804967);}catch(_0x39c194){utils[_0xe8ed('0x16')](util['format']('[%s][index][newstate]',_0x804967[_0xe8ed('0x20')]),_0x39c194);}});ami['on'](_0xe8ed('0x32'),function(_0x25270e){try{utils[_0xe8ed('0x19')](util['format']('[%s][index][hangup]',_0x25270e[_0xe8ed('0x20')]),_0x25270e);calls[_0xe8ed('0x32')](_0x25270e);recordings['hangup'](_0x25270e);dials['hangup'](_0x25270e);agents[_0xe8ed('0x32')](_0x25270e);queues['hangup'](_0x25270e);}catch(_0x1aa3f3){utils[_0xe8ed('0x16')](util['format'](_0xe8ed('0x33'),_0x25270e[_0xe8ed('0x20')]),_0x1aa3f3);}});ami['on'](_0xe8ed('0x34'),function(_0x4f2852){try{utils['debug'](util[_0xe8ed('0x1a')](_0xe8ed('0x35'),_0x4f2852[_0xe8ed('0x20')]),_0x4f2852);members['cdr'](_0x4f2852);}catch(_0x337317){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')](_0xe8ed('0x35'),_0x4f2852[_0xe8ed('0x20')]),_0x337317);}});ami['on']('blindtransfer',function(_0x128e65){try{utils[_0xe8ed('0x19')](util[_0xe8ed('0x1a')]('[%s][index][blindtransfer]',_0x128e65[_0xe8ed('0x20')]),_0x128e65);queues[_0xe8ed('0x36')](_0x128e65);agents[_0xe8ed('0x36')](_0x128e65);transfers['blindtransfer'](_0x128e65);}catch(_0x87451a){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')]('[%s][index][blindtransfer]',_0x128e65[_0xe8ed('0x20')]),_0x87451a);}});ami['on'](_0xe8ed('0x37'),function(_0x420d38){try{utils[_0xe8ed('0x19')](util[_0xe8ed('0x1a')]('[%s][index][attendedtransfer]',_0x420d38[_0xe8ed('0x38')]),_0x420d38);queues[_0xe8ed('0x37')](_0x420d38);transfers[_0xe8ed('0x37')](_0x420d38);agents['attendedtransfer'](_0x420d38);calls['attendedtransfer'](_0x420d38);}catch(_0x25a133){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')]('[%s][index][attendedtransfer]',_0x420d38[_0xe8ed('0x38')]),_0x25a133);}});ami['on'](_0xe8ed('0x39'),function(_0x56d8a6){try{utils[_0xe8ed('0x19')](util['format'](_0xe8ed('0x3a'),_0x56d8a6[_0xe8ed('0x20')]),_0x56d8a6);queues['varset'](_0x56d8a6);recordings[_0xe8ed('0x39')](_0x56d8a6);calls['varset'](_0x56d8a6);dials[_0xe8ed('0x39')](_0x56d8a6);}catch(_0x43964c){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')]('[%s][index][varset]',_0x56d8a6[_0xe8ed('0x20')]),_0x43964c);}});ami['on'](_0xe8ed('0x3b'),function(_0x2db2b0){try{utils[_0xe8ed('0x19')](util[_0xe8ed('0x1a')](_0xe8ed('0x3c'),_0x2db2b0[_0xe8ed('0x20')]),_0x2db2b0);calls[_0xe8ed('0x3b')](_0x2db2b0);recordings[_0xe8ed('0x3b')](_0x2db2b0);dials[_0xe8ed('0x3b')](_0x2db2b0);}catch(_0x1116fa){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')](_0xe8ed('0x3c'),_0x2db2b0[_0xe8ed('0x20')]),_0x1116fa);}});ami['on'](_0xe8ed('0x3d'),function(_0x11b360){try{utils['debug'](util[_0xe8ed('0x1a')]('[%s][index][newchannel]',_0x11b360[_0xe8ed('0x20')]),_0x11b360);calls[_0xe8ed('0x3d')](_0x11b360);recordings[_0xe8ed('0x3d')](_0x11b360);}catch(_0x37998f){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')](_0xe8ed('0x3e'),_0x11b360['uniqueid']),_0x37998f);}});ami['on'](_0xe8ed('0x3f'),function(_0x4a17e2){try{utils[_0xe8ed('0x19')](util[_0xe8ed('0x1a')](_0xe8ed('0x40'),_0x4a17e2[_0xe8ed('0x20')]),_0x4a17e2);dials['dialbegin'](_0x4a17e2);}catch(_0x8ba440){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')]('[%s]dialbegin',_0x4a17e2['uniqueid']),_0x8ba440);}});ami['on'](_0xe8ed('0x41'),function(_0x3aeb36){try{utils[_0xe8ed('0x19')](util[_0xe8ed('0x1a')](_0xe8ed('0x42'),_0x3aeb36[_0xe8ed('0x20')]),_0x3aeb36);dials['dialend'](_0x3aeb36);}catch(_0x1fbc85){utils[_0xe8ed('0x16')](util[_0xe8ed('0x1a')]('[%s][index][dialend]',_0x3aeb36[_0xe8ed('0x20')]),_0x1fbc85);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ba6dff3..3fe7806 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 _0x5480=['startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','INUSE','voice','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','isNil','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','channel','split','data1','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','source','lodash','util','./utils','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','data2','membername','type','interface','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','catch','error','some'];(function(_0x28b2b2,_0xa000e5){var _0x198f61=function(_0x69647){while(--_0x69647){_0x28b2b2['push'](_0x28b2b2['shift']());}};_0x198f61(++_0xa000e5);}(_0x5480,0xb1));var _0x0548=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0x5480[_0x2b45b5];return _0x1d9c06;};'use strict';var _=require(_0x0548('0x0'));var util=require(_0x0548('0x1'));var utils=require(_0x0548('0x2'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x1889b8){utils['info'](util[_0x0548('0x3')](_0x0548('0x4'),_0x1889b8[_0x0548('0x5')],_0x1889b8['interface'],_0x1889b8['channel'],_0x1889b8[_0x0548('0x6')],_0x1889b8[_0x0548('0x7')],_0x1889b8[_0x0548('0x8')]));if(_0x1889b8[_0x0548('0x9')]){utils[_0x0548('0xa')](_0x1889b8['interface'])[_0x0548('0xb')](function(_0x4eff63){if(_0x4eff63){_0x1889b8[_0x0548('0x7')]=_0x4eff63['name'];_0x1889b8[_0x0548('0xc')]=_0x4eff63[_0x0548('0xc')];utils[_0x0548('0xd')](_0x0548('0xe'),_0x1889b8);}else{utils[_0x0548('0xf')](_0x1889b8[_0x0548('0x9')]['split']('/')[0x1])[_0x0548('0xb')](function(_0x4ad49b){if(_0x4ad49b){_0x1889b8['membername']=_0x4ad49b['name'];_0x1889b8[_0x0548('0xc')]=_0x4ad49b[_0x0548('0xc')];utils['request'](_0x0548('0xe'),_0x1889b8);}});}})[_0x0548('0x10')](function(_0x51b44e){utils[_0x0548('0x11')](util['format']('[%s][members][writeDB]',_0x1889b8['uniqueid']),_0x51b44e);});}delete members[_0x1889b8[_0x0548('0x9')]];}function startsWith(_0x58c176,_0x456cf4){return _[_0x0548('0x12')](_0x58c176,function(_0x2b52bc){return _[_0x0548('0x13')](_0x456cf4,_0x2b52bc);});}exports[_0x0548('0x14')]=function(_0x2a58ff){try{utils[_0x0548('0x15')](util['format'](_0x0548('0x16'),members[_0x2a58ff[_0x0548('0x17')]]?members[_0x2a58ff['device']]['uniqueid']:_0x2a58ff[_0x0548('0x17')]),_0x2a58ff);utils['info'](util[_0x0548('0x3')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x2a58ff[_0x0548('0x17')]]?members[_0x2a58ff[_0x0548('0x17')]][_0x0548('0x5')]:_0x2a58ff[_0x0548('0x17')],_0x2a58ff['state'],_0x2a58ff[_0x0548('0x17')]));switch(_0x2a58ff[_0x0548('0x18')]){case _0x0548('0x19'):case'BUSY':if(!startsWith(exclude,_0x2a58ff[_0x0548('0x17')])){members[_0x2a58ff[_0x0548('0x17')]]={'channel':_0x0548('0x1a'),'interface':_0x2a58ff[_0x0548('0x17')],'type':'TALKING','enterAt':utils[_0x0548('0x1b')](),'role':_0x0548('0x1c')};}break;case _0x0548('0x1d'):if(!_['isNil'](members[_0x2a58ff[_0x0548('0x17')]])){members[_0x2a58ff[_0x0548('0x17')]][_0x0548('0x1e')]=utils[_0x0548('0x1b')]();members[_0x2a58ff['device']][_0x0548('0x1f')]=utils[_0x0548('0x20')](members[_0x2a58ff[_0x0548('0x17')]][_0x0548('0x1e')],members[_0x2a58ff['device']][_0x0548('0x21')]);if(members[_0x2a58ff[_0x0548('0x17')]][_0x0548('0x5')]){writeDB(members[_0x2a58ff['device']]);}}break;default:break;}}catch(_0x161620){utils[_0x0548('0x11')](util[_0x0548('0x3')]('[%s][members][devicestatechange]',members[_0x2a58ff['device']]?members[_0x2a58ff[_0x0548('0x17')]]['uniqueid']:_0x2a58ff[_0x0548('0x17')]),_0x161620);}};exports['agentcomplete']=function(_0x2091b4){try{if(!_[_0x0548('0x22')](members[_0x2091b4[_0x0548('0x9')]])){utils['debug'](util['format'](_0x0548('0x23'),_0x2091b4['uniqueid']),_0x2091b4);utils[_0x0548('0x24')](util[_0x0548('0x3')](_0x0548('0x25'),_0x2091b4[_0x0548('0x5')],_0x2091b4[_0x0548('0x9')],_0x2091b4[_0x0548('0x26')]));members[_0x2091b4['interface']]=_[_0x0548('0x27')](members[_0x2091b4['interface']],{'data4':_0x2091b4['queue'],'uniqueid':_0x2091b4[_0x0548('0x5')]});}}catch(_0x5de5e3){utils[_0x0548('0x11')](util[_0x0548('0x3')](_0x0548('0x23'),_0x2091b4[_0x0548('0x5')]),_0x5de5e3);}};exports['cdr']=function(_0x536230){try{utils[_0x0548('0x15')](util[_0x0548('0x3')](_0x0548('0x28'),_0x536230[_0x0548('0x5')]),_0x536230);if(_0x536230[_0x0548('0x29')]){var _0xd66991=_0x536230[_0x0548('0x29')][_0x0548('0x2a')]('-')[0x0];if(!_[_0x0548('0x22')](members[_0xd66991])){members[_0xd66991]=_[_0x0548('0x27')](members[_0xd66991],{'data1':members[_0xd66991][_0x0548('0x2b')]||_0x536230[_0x0548('0x8')],'data2':members[_0xd66991][_0x0548('0x6')]||_0x536230['source'],'data3':members[_0xd66991]['data3']||_0x536230[_0x0548('0x2c')],'uniqueid':members[_0xd66991][_0x0548('0x5')]||_0x536230[_0x0548('0x5')]});utils[_0x0548('0x24')](util['format'](_0x0548('0x2d'),_0x536230[_0x0548('0x5')],members[_0xd66991][_0x0548('0x2b')],members[_0xd66991]['data2'],members[_0xd66991][_0x0548('0x2e')]));if(members[_0xd66991][_0x0548('0x1e')]){writeDB(members[_0xd66991]);}}}if(_0x536230['destinationchannel']){var _0x24c83f=_0x536230[_0x0548('0x2f')][_0x0548('0x2a')]('-')[0x0];if(!_[_0x0548('0x22')](members[_0x24c83f])){members[_0x24c83f]=_[_0x0548('0x27')](members[_0x24c83f],{'data1':members[_0x24c83f][_0x0548('0x2b')]||_0x536230[_0x0548('0x8')],'data2':members[_0x24c83f][_0x0548('0x6')]||_0x536230[_0x0548('0x30')],'data3':members[_0x24c83f]['data3']||_0x536230[_0x0548('0x2c')],'uniqueid':members[_0x24c83f]['uniqueid']||_0x536230[_0x0548('0x5')]});utils[_0x0548('0x24')](util[_0x0548('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x536230[_0x0548('0x5')],members[_0x24c83f]['data1'],members[_0x24c83f][_0x0548('0x6')],members[_0x24c83f][_0x0548('0x2e')]));if(members[_0x24c83f][_0x0548('0x1e')]){writeDB(members[_0x24c83f]);}}}}catch(_0x23d175){utils['error'](util[_0x0548('0x3')](_0x0548('0x28'),_0x536230[_0x0548('0x5')]),_0x23d175);}}; \ No newline at end of file +var _0xe144=['[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','type','interface','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','split','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','./utils','Queue:','format'];(function(_0x483f42,_0x3af164){var _0xe7deb0=function(_0x1ae433){while(--_0x1ae433){_0x483f42['push'](_0x483f42['shift']());}};_0xe7deb0(++_0x3af164);}(_0xe144,0xd1));var _0x4e14=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe144[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x4e14('0x0'));var members={};var exclude=['Local/_attended@transfer',_0x4e14('0x1')];function writeDB(_0x1597dd){utils['info'](util[_0x4e14('0x2')](_0x4e14('0x3'),_0x1597dd[_0x4e14('0x4')],_0x1597dd['interface'],_0x1597dd[_0x4e14('0x5')],_0x1597dd[_0x4e14('0x6')],_0x1597dd[_0x4e14('0x7')],_0x1597dd[_0x4e14('0x8')]));if(_0x1597dd[_0x4e14('0x9')]){utils[_0x4e14('0xa')](_0x1597dd['interface'])[_0x4e14('0xb')](function(_0x488d50){if(_0x488d50){_0x1597dd[_0x4e14('0x7')]=_0x488d50['name'];_0x1597dd[_0x4e14('0xc')]=_0x488d50[_0x4e14('0xc')];utils[_0x4e14('0xd')](_0x4e14('0xe'),_0x1597dd);}else{utils[_0x4e14('0xf')](_0x1597dd[_0x4e14('0x9')]['split']('/')[0x1])[_0x4e14('0xb')](function(_0x3eb2ce){if(_0x3eb2ce){_0x1597dd[_0x4e14('0x7')]=_0x3eb2ce['name'];_0x1597dd[_0x4e14('0xc')]=_0x3eb2ce[_0x4e14('0xc')];utils[_0x4e14('0xd')](_0x4e14('0xe'),_0x1597dd);}});}})[_0x4e14('0x10')](function(_0x1eb31a){utils[_0x4e14('0x11')](util['format'](_0x4e14('0x12'),_0x1597dd['uniqueid']),_0x1eb31a);});}delete members[_0x1597dd[_0x4e14('0x9')]];}function startsWith(_0x8da992,_0x2c7286){return _[_0x4e14('0x13')](_0x8da992,function(_0x1df094){return _[_0x4e14('0x14')](_0x2c7286,_0x1df094);});}exports[_0x4e14('0x15')]=function(_0x155d78){try{utils[_0x4e14('0x16')](util[_0x4e14('0x2')]('[%s][members][devicestatechange]',members[_0x155d78[_0x4e14('0x17')]]?members[_0x155d78[_0x4e14('0x17')]][_0x4e14('0x4')]:_0x155d78[_0x4e14('0x17')]),_0x155d78);utils[_0x4e14('0x18')](util['format'](_0x4e14('0x19'),members[_0x155d78[_0x4e14('0x17')]]?members[_0x155d78[_0x4e14('0x17')]]['uniqueid']:_0x155d78[_0x4e14('0x17')],_0x155d78[_0x4e14('0x1a')],_0x155d78[_0x4e14('0x17')]));switch(_0x155d78[_0x4e14('0x1a')]){case'INUSE':case _0x4e14('0x1b'):if(!startsWith(exclude,_0x155d78['device'])){members[_0x155d78[_0x4e14('0x17')]]={'channel':_0x4e14('0x1c'),'interface':_0x155d78['device'],'type':_0x4e14('0x1d'),'enterAt':utils[_0x4e14('0x1e')](),'role':_0x4e14('0x1f')};}break;case _0x4e14('0x20'):if(!_[_0x4e14('0x21')](members[_0x155d78[_0x4e14('0x17')]])){members[_0x155d78['device']][_0x4e14('0x22')]=utils['now']();members[_0x155d78[_0x4e14('0x17')]][_0x4e14('0x23')]=utils[_0x4e14('0x24')](members[_0x155d78[_0x4e14('0x17')]]['exitAt'],members[_0x155d78[_0x4e14('0x17')]][_0x4e14('0x25')]);if(members[_0x155d78[_0x4e14('0x17')]][_0x4e14('0x4')]){writeDB(members[_0x155d78[_0x4e14('0x17')]]);}}break;default:break;}}catch(_0x43034c){utils['error'](util['format'](_0x4e14('0x26'),members[_0x155d78[_0x4e14('0x17')]]?members[_0x155d78[_0x4e14('0x17')]][_0x4e14('0x4')]:_0x155d78[_0x4e14('0x17')]),_0x43034c);}};exports[_0x4e14('0x27')]=function(_0x7272c6){try{if(!_[_0x4e14('0x21')](members[_0x7272c6[_0x4e14('0x9')]])){utils['debug'](util['format'](_0x4e14('0x28'),_0x7272c6[_0x4e14('0x4')]),_0x7272c6);utils[_0x4e14('0x18')](util[_0x4e14('0x2')](_0x4e14('0x29'),_0x7272c6['uniqueid'],_0x7272c6[_0x4e14('0x9')],_0x7272c6[_0x4e14('0x2a')]));members[_0x7272c6[_0x4e14('0x9')]]=_[_0x4e14('0x2b')](members[_0x7272c6[_0x4e14('0x9')]],{'data4':_0x7272c6[_0x4e14('0x2a')],'uniqueid':_0x7272c6['uniqueid']});}}catch(_0x5ee124){utils['error'](util[_0x4e14('0x2')](_0x4e14('0x28'),_0x7272c6[_0x4e14('0x4')]),_0x5ee124);}};exports[_0x4e14('0x2c')]=function(_0x3ef272){try{utils[_0x4e14('0x16')](util['format'](_0x4e14('0x2d'),_0x3ef272[_0x4e14('0x4')]),_0x3ef272);if(_0x3ef272[_0x4e14('0x5')]){var _0x297e33=_0x3ef272[_0x4e14('0x5')][_0x4e14('0x2e')]('-')[0x0];if(!_[_0x4e14('0x21')](members[_0x297e33])){members[_0x297e33]=_['assign'](members[_0x297e33],{'data1':members[_0x297e33][_0x4e14('0x2f')]||_0x3ef272['type'],'data2':members[_0x297e33][_0x4e14('0x6')]||_0x3ef272['source'],'data3':members[_0x297e33][_0x4e14('0x30')]||_0x3ef272[_0x4e14('0x31')],'uniqueid':members[_0x297e33][_0x4e14('0x4')]||_0x3ef272['uniqueid']});utils[_0x4e14('0x18')](util[_0x4e14('0x2')](_0x4e14('0x32'),_0x3ef272[_0x4e14('0x4')],members[_0x297e33][_0x4e14('0x2f')],members[_0x297e33][_0x4e14('0x6')],members[_0x297e33][_0x4e14('0x30')]));if(members[_0x297e33]['exitAt']){writeDB(members[_0x297e33]);}}}if(_0x3ef272[_0x4e14('0x33')]){var _0x5822eb=_0x3ef272['destinationchannel'][_0x4e14('0x2e')]('-')[0x0];if(!_['isNil'](members[_0x5822eb])){members[_0x5822eb]=_[_0x4e14('0x2b')](members[_0x5822eb],{'data1':members[_0x5822eb]['data1']||_0x3ef272[_0x4e14('0x8')],'data2':members[_0x5822eb]['data2']||_0x3ef272[_0x4e14('0x34')],'data3':members[_0x5822eb][_0x4e14('0x30')]||_0x3ef272[_0x4e14('0x31')],'uniqueid':members[_0x5822eb][_0x4e14('0x4')]||_0x3ef272[_0x4e14('0x4')]});utils['info'](util[_0x4e14('0x2')](_0x4e14('0x32'),_0x3ef272[_0x4e14('0x4')],members[_0x5822eb][_0x4e14('0x2f')],members[_0x5822eb][_0x4e14('0x6')],members[_0x5822eb]['data3']));if(members[_0x5822eb]['exitAt']){writeDB(members[_0x5822eb]);}}}}catch(_0x3e693b){utils[_0x4e14('0x11')](util['format'](_0x4e14('0x2d'),_0x3ef272[_0x4e14('0x4')]),_0x3e693b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 05f287a..4f1aa24 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 _0x9e69=['attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','queuestatus','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','accountcode','membername','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','BLIND','transferexten','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]'];(function(_0x2d3ba4,_0x5761aa){var _0x3f1c24=function(_0x5a012d){while(--_0x5a012d){_0x2d3ba4['push'](_0x2d3ba4['shift']());}};_0x3f1c24(++_0x5761aa);}(_0x9e69,0x150));var _0x99e6=function(_0xa840fa,_0x49b284){_0xa840fa=_0xa840fa-0x0;var _0x97fd21=_0x9e69[_0xa840fa];return _0x97fd21;};'use strict';var _=require('lodash');var util=require(_0x99e6('0x0'));var utils=require(_0x99e6('0x1'));var queues={};function writeDB(_0x10387b){utils[_0x99e6('0x2')](util['format'](_0x99e6('0x3'),_0x10387b[_0x99e6('0x4')],_0x10387b['channel'],_0x10387b[_0x99e6('0x5')],_0x10387b[_0x99e6('0x6')],_0x10387b[_0x99e6('0x7')],_0x10387b['accountcode'],_0x10387b[_0x99e6('0x8')]));if(_0x10387b[_0x99e6('0x5')]){utils[_0x99e6('0x9')](_0x10387b['queue'])[_0x99e6('0xa')](function(_0x305140){if(_0x305140){_0x10387b['type']=_0x305140[_0x99e6('0xb')];}utils[_0x99e6('0xc')]('CreateVoiceQueueReport',_0x10387b);});}else{utils[_0x99e6('0xc')](_0x99e6('0xd'),_0x10387b);}if(_0x10387b['transfereduniqueid']){delete queues[_0x10387b['transfereduniqueid']];}else{delete queues[_0x10387b[_0x99e6('0x4')]];}}exports[_0x99e6('0xe')]=function(_0x45d416){try{utils[_0x99e6('0xf')](util[_0x99e6('0x10')](_0x99e6('0x11'),_0x45d416['uniqueid']),_0x45d416);utils[_0x99e6('0x2')](util[_0x99e6('0x10')](_0x99e6('0x12'),_0x45d416['uniqueid'],_0x45d416[_0x99e6('0x5')],_0x45d416[_0x99e6('0x13')]));queues[_0x45d416[_0x99e6('0x4')]]=_['assign'](_0x45d416,{'originalposition':_0x45d416['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x40fdb8){utils[_0x99e6('0x14')](util[_0x99e6('0x10')]('[%s][queues][queuecallerjoin]',_0x45d416[_0x99e6('0x4')]),_0x40fdb8);}};exports[_0x99e6('0x15')]=function(_0xebfd62){try{if(!_[_0x99e6('0x16')](queues[_0xebfd62[_0x99e6('0x4')]])){utils['debug'](util[_0x99e6('0x10')]('[%s][queues][hangup]',_0xebfd62[_0x99e6('0x4')]),_0xebfd62);if(queues[_0xebfd62[_0x99e6('0x4')]]['queuecallerleaveAt']){if(!queues[_0xebfd62[_0x99e6('0x4')]][_0x99e6('0x17')]&&!queues[_0xebfd62[_0x99e6('0x4')]][_0x99e6('0x18')]){queues[_0xebfd62[_0x99e6('0x4')]][_0x99e6('0x19')]=!![];queues[_0xebfd62[_0x99e6('0x4')]][_0x99e6('0x1a')]=utils[_0x99e6('0x1b')]();queues[_0xebfd62[_0x99e6('0x4')]]['queuecallerexitreason']=_0x99e6('0x1c');}utils[_0x99e6('0x2')](util[_0x99e6('0x10')](_0x99e6('0x1d'),_0xebfd62[_0x99e6('0x4')],queues[_0xebfd62[_0x99e6('0x4')]][_0x99e6('0x1e')],queues[_0xebfd62[_0x99e6('0x4')]][_0x99e6('0x8')]));writeDB(queues[_0xebfd62[_0x99e6('0x4')]]);}else if(queues[_0xebfd62[_0x99e6('0x4')]][_0x99e6('0x1f')]){utils[_0x99e6('0x2')](util[_0x99e6('0x10')](_0x99e6('0x20'),_0xebfd62[_0x99e6('0x4')],queues[_0xebfd62[_0x99e6('0x4')]]['name'],queues[_0xebfd62[_0x99e6('0x4')]]['transfereduniqueid']));queues[queues[_0xebfd62[_0x99e6('0x4')]][_0x99e6('0x1f')]]=queues[_0xebfd62[_0x99e6('0x4')]];queues[queues[_0xebfd62['uniqueid']][_0x99e6('0x1f')]]['queuecallerenterreason']=0x2;delete queues[_0xebfd62[_0x99e6('0x4')]];}}}catch(_0x5de36a){utils[_0x99e6('0x14')](util[_0x99e6('0x10')]('[%s][queues][hangup]',_0xebfd62['uniqueid']),_0x5de36a);}};exports[_0x99e6('0x21')]=function(_0x350fa0){try{utils[_0x99e6('0xf')](util[_0x99e6('0x10')](_0x99e6('0x22'),_0x350fa0['uniqueid']),_0x350fa0);if(!_[_0x99e6('0x16')](_0x350fa0[_0x99e6('0x23')][_0x99e6('0x24')])&&_0x350fa0['value']['toUpperCase']()!==_0x99e6('0x25')){if(!_['isNil'](queues[_0x350fa0['uniqueid']])){queues[_0x350fa0[_0x99e6('0x4')]]['queuecallerabandon']=![];queues[_0x350fa0[_0x99e6('0x4')]][_0x99e6('0x26')]=null;queues[_0x350fa0[_0x99e6('0x4')]]['queuecallerexit']=!![];queues[_0x350fa0[_0x99e6('0x4')]][_0x99e6('0x27')]=utils[_0x99e6('0x1b')]();queues[_0x350fa0[_0x99e6('0x4')]]['queuecallerexitreason']=_0x350fa0[_0x99e6('0x28')][_0x99e6('0x29')]();utils[_0x99e6('0x2')](util[_0x99e6('0x10')](_0x99e6('0x2a'),_0x350fa0[_0x99e6('0x4')],queues[_0x350fa0['uniqueid']][_0x99e6('0x1e')],_0x350fa0['value'],queues[_0x350fa0['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x350fa0[_0x99e6('0x4')]]);}}else if(!_[_0x99e6('0x16')](_0x350fa0['variable'][_0x99e6('0x2b')])){if(!_[_0x99e6('0x16')](queues[_0x350fa0[_0x99e6('0x4')]])&&!queues[_0x350fa0[_0x99e6('0x4')]][_0x99e6('0x17')]){queues[_0x350fa0[_0x99e6('0x4')]]['queuecallerabandon']=![];queues[_0x350fa0[_0x99e6('0x4')]][_0x99e6('0x26')]=null;queues[_0x350fa0[_0x99e6('0x4')]][_0x99e6('0x18')]=!![];queues[_0x350fa0['uniqueid']][_0x99e6('0x27')]=utils[_0x99e6('0x1b')]();queues[_0x350fa0[_0x99e6('0x4')]][_0x99e6('0x8')]=_0x99e6('0x2c');utils[_0x99e6('0x2')](util[_0x99e6('0x10')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x350fa0['uniqueid'],queues[_0x350fa0['uniqueid']][_0x99e6('0x1e')],_0x350fa0[_0x99e6('0x28')],queues[_0x350fa0['uniqueid']][_0x99e6('0x8')]));}}}catch(_0x2975d8){utils[_0x99e6('0x14')](util[_0x99e6('0x10')](_0x99e6('0x22'),_0x350fa0[_0x99e6('0x4')]),_0x2975d8);}};exports[_0x99e6('0x17')]=function(_0x25acc2){try{if(!_[_0x99e6('0x16')](queues[_0x25acc2[_0x99e6('0x4')]])){utils[_0x99e6('0xf')](util['format'](_0x99e6('0x2d'),_0x25acc2[_0x99e6('0x4')]),_0x25acc2);queues[_0x25acc2[_0x99e6('0x4')]][_0x99e6('0x18')]=![];queues[_0x25acc2[_0x99e6('0x4')]][_0x99e6('0x27')]=null;queues[_0x25acc2[_0x99e6('0x4')]][_0x99e6('0x17')]=!![];queues[_0x25acc2[_0x99e6('0x4')]]['queuecallerabandonAt']=utils['now']();queues[_0x25acc2['uniqueid']]['queuecallerexitreason']='ABANDONED';utils[_0x99e6('0x2')](util[_0x99e6('0x10')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x25acc2[_0x99e6('0x4')],queues[_0x25acc2[_0x99e6('0x4')]][_0x99e6('0x1e')],queues[_0x25acc2[_0x99e6('0x4')]][_0x99e6('0x8')]));}}catch(_0x6c3381){utils['error'](util[_0x99e6('0x10')](_0x99e6('0x2d'),_0x25acc2[_0x99e6('0x4')]),_0x6c3381);}};exports[_0x99e6('0x2e')]=function(_0xd20ab5){try{if(!_[_0x99e6('0x16')](queues[_0xd20ab5[_0x99e6('0x4')]])){utils[_0x99e6('0xf')](util[_0x99e6('0x10')](_0x99e6('0x2f'),_0xd20ab5[_0x99e6('0x4')]),_0xd20ab5);utils[_0x99e6('0x2')](util[_0x99e6('0x10')](_0x99e6('0x30'),_0xd20ab5['uniqueid'],queues[_0xd20ab5['uniqueid']]['name'],_0xd20ab5['connectedlinenum'],_0xd20ab5[_0x99e6('0x31')]));queues[_0xd20ab5[_0x99e6('0x4')]][_0x99e6('0x2e')]=!![];queues[_0xd20ab5[_0x99e6('0x4')]][_0x99e6('0x32')]=utils['now']();queues[_0xd20ab5['uniqueid']][_0x99e6('0x33')]=utils[_0x99e6('0x34')](queues[_0xd20ab5['uniqueid']]['queuecallerleaveAt'],queues[_0xd20ab5[_0x99e6('0x4')]][_0x99e6('0x35')]);queues[_0xd20ab5['uniqueid']][_0x99e6('0x13')]=_0xd20ab5['position'];queues[_0xd20ab5[_0x99e6('0x4')]][_0x99e6('0x36')]=_0xd20ab5[_0x99e6('0x36')];queues[_0xd20ab5['uniqueid']][_0x99e6('0x37')]=_0xd20ab5[_0x99e6('0x37')];queues[_0xd20ab5['uniqueid']][_0x99e6('0x31')]=_0xd20ab5[_0x99e6('0x31')];}}catch(_0x35973e){utils['error'](util['format'](_0x99e6('0x2f'),_0xd20ab5[_0x99e6('0x4')]),_0x35973e);}};exports['agentconnect']=function(_0xa930bd){try{if(!_[_0x99e6('0x16')](queues[_0xa930bd[_0x99e6('0x4')]])){utils[_0x99e6('0xf')](util[_0x99e6('0x10')](_0x99e6('0x38'),_0xa930bd[_0x99e6('0x4')]),_0xa930bd);utils['info'](util[_0x99e6('0x10')](_0x99e6('0x39'),_0xa930bd['uniqueid'],queues[_0xa930bd[_0x99e6('0x4')]][_0x99e6('0x1e')],_0xa930bd['membername'],_0xa930bd[_0x99e6('0x3a')]));queues[_0xa930bd[_0x99e6('0x4')]]['queuecallerabandon']=![];queues[_0xa930bd[_0x99e6('0x4')]]['queuecallerabandon']=![];queues[_0xa930bd[_0x99e6('0x4')]][_0x99e6('0x26')]=null;queues[_0xa930bd[_0x99e6('0x4')]][_0x99e6('0x18')]=![];queues[_0xa930bd[_0x99e6('0x4')]][_0x99e6('0x8')]=null;queues[_0xa930bd[_0x99e6('0x4')]][_0x99e6('0x27')]=null;queues[_0xa930bd[_0x99e6('0x4')]][_0x99e6('0x3b')]=!![];queues[_0xa930bd[_0x99e6('0x4')]][_0x99e6('0x3c')]=_0xa930bd[_0x99e6('0x3a')];queues[_0xa930bd['uniqueid']][_0x99e6('0x6')]=_0xa930bd[_0x99e6('0x3d')];}}catch(_0x303ca3){utils[_0x99e6('0x14')](util[_0x99e6('0x10')](_0x99e6('0x38'),_0xa930bd[_0x99e6('0x4')]),_0x303ca3);}};exports[_0x99e6('0x3e')]=function(_0xe33e28){try{if(!_[_0x99e6('0x16')](queues[_0xe33e28[_0x99e6('0x4')]])){if(queues[_0xe33e28[_0x99e6('0x4')]][_0x99e6('0x32')]){utils[_0x99e6('0xf')](util[_0x99e6('0x10')](_0x99e6('0x3f'),_0xe33e28[_0x99e6('0x4')]),_0xe33e28);queues[_0xe33e28[_0x99e6('0x4')]][_0x99e6('0x17')]=![];queues[_0xe33e28[_0x99e6('0x4')]]['queuecallerabandon']=![];queues[_0xe33e28[_0x99e6('0x4')]][_0x99e6('0x26')]=null;queues[_0xe33e28[_0x99e6('0x4')]][_0x99e6('0x18')]=![];queues[_0xe33e28['uniqueid']][_0x99e6('0x27')]=null;queues[_0xe33e28[_0x99e6('0x4')]][_0x99e6('0x3b')]=!![];queues[_0xe33e28['uniqueid']][_0x99e6('0x6')]=_0xe33e28[_0x99e6('0x3d')];queues[_0xe33e28[_0x99e6('0x4')]]['queuecallercomplete']=!![];queues[_0xe33e28[_0x99e6('0x4')]]['queuecallercompleteAt']=utils[_0x99e6('0x1b')]();if(_0xe33e28[_0x99e6('0x40')]==_0x99e6('0x41')){if(!queues[_0xe33e28['uniqueid']]['transfer']){queues[_0xe33e28[_0x99e6('0x4')]][_0x99e6('0x8')]=_0x99e6('0x42');}}else{queues[_0xe33e28[_0x99e6('0x4')]]['queuecallerexitreason']=_0x99e6('0x43')+_0xe33e28[_0x99e6('0x40')][_0x99e6('0x29')]();}utils[_0x99e6('0x2')](util['format'](_0x99e6('0x44'),_0xe33e28[_0x99e6('0x4')],queues[_0xe33e28[_0x99e6('0x4')]][_0x99e6('0x1e')],_0xe33e28[_0x99e6('0x3d')],queues[_0xe33e28['uniqueid']][_0x99e6('0x8')]));writeDB(queues[_0xe33e28[_0x99e6('0x4')]]);}}}catch(_0xb7949b){utils[_0x99e6('0x14')](util[_0x99e6('0x10')](_0x99e6('0x3f'),_0xe33e28[_0x99e6('0x4')]),_0xb7949b);}};exports['blindtransfer']=function(_0x53d233){try{if(!_[_0x99e6('0x16')](queues[_0x53d233['transfereeuniqueid']])){utils[_0x99e6('0xf')](util[_0x99e6('0x10')]('[%s][queues][blindtransfer]',_0x53d233['uniqueid']),_0x53d233);queues[_0x53d233[_0x99e6('0x45')]][_0x99e6('0x41')]=!![];queues[_0x53d233[_0x99e6('0x45')]][_0x99e6('0x46')]=_0x99e6('0x47');queues[_0x53d233[_0x99e6('0x45')]][_0x99e6('0x48')]=_0x53d233['extension'];queues[_0x53d233[_0x99e6('0x45')]]['transferuniqueid']=_0x53d233['transfereeuniqueid'];queues[_0x53d233[_0x99e6('0x45')]]['queuecallerexitreason']=_0x99e6('0x49');utils[_0x99e6('0x2')](util[_0x99e6('0x10')](_0x99e6('0x4a'),_0x53d233[_0x99e6('0x4')],queues[_0x53d233['transfereeuniqueid']][_0x99e6('0x1e')],_0x53d233[_0x99e6('0x45')],_0x53d233['extension']));}}catch(_0x17eba0){utils[_0x99e6('0x14')](util['format'](_0x99e6('0x4b'),_0x53d233[_0x99e6('0x4')]),_0x17eba0);}};exports[_0x99e6('0x4c')]=function(_0x270f75){try{utils[_0x99e6('0xf')](util[_0x99e6('0x10')](_0x99e6('0x4d'),_0x270f75[_0x99e6('0x4e')]),_0x270f75);if(_0x270f75[_0x99e6('0x4e')]==_0x270f75[_0x99e6('0x4f')]){if(!_[_0x99e6('0x16')](queues[_0x270f75[_0x99e6('0x50')]])){utils[_0x99e6('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x270f75[_0x99e6('0x4e')],queues[_0x270f75[_0x99e6('0x50')]][_0x99e6('0x1e')],_0x270f75[_0x99e6('0x51')]));queues[_0x270f75['secondtransfererlinkedid']][_0x99e6('0x41')]=!![];queues[_0x270f75[_0x99e6('0x50')]]['transfertype']=_0x99e6('0x52');queues[_0x270f75['secondtransfererlinkedid']]['transferexten']=_0x270f75[_0x99e6('0x51')];queues[_0x270f75[_0x99e6('0x50')]]['transferuniqueid']=_0x270f75[_0x99e6('0x4e')];queues[_0x270f75[_0x99e6('0x50')]][_0x99e6('0x8')]=_0x99e6('0x53');}if(!_[_0x99e6('0x16')](queues[_0x270f75[_0x99e6('0x4f')]])){if(_0x270f75[_0x99e6('0x54')]&&queues[_0x270f75[_0x99e6('0x54')]]){queues[_0x270f75[_0x99e6('0x54')]][_0x99e6('0x55')]=0x1;queues[_0x270f75[_0x99e6('0x45')]]=_[_0x99e6('0x56')](queues[_0x270f75['transfereelinkedid']]);queues[_0x270f75[_0x99e6('0x45')]][_0x99e6('0x1f')]=_0x270f75[_0x99e6('0x57')];queues[_0x270f75[_0x99e6('0x45')]][_0x99e6('0x55')]=0x2;queues[_0x270f75['transfereeuniqueid']][_0x99e6('0x7')]=queues[_0x270f75[_0x99e6('0x50')]][_0x99e6('0x7')];queues[_0x270f75[_0x99e6('0x45')]][_0x99e6('0x58')]=queues[_0x270f75[_0x99e6('0x50')]]['calleridname'];queues[_0x270f75[_0x99e6('0x45')]][_0x99e6('0x35')]=utils[_0x99e6('0x1b')]();queues[_0x270f75[_0x99e6('0x45')]][_0x99e6('0x32')]=utils[_0x99e6('0x1b')]();queues[_0x270f75[_0x99e6('0x45')]][_0x99e6('0x33')]=0x0;queues[_0x270f75['transfereeuniqueid']][_0x99e6('0x59')]=0x0;utils['info'](util[_0x99e6('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x270f75[_0x99e6('0x4e')],queues[_0x270f75[_0x99e6('0x45')]][_0x99e6('0x1e')],queues[_0x270f75[_0x99e6('0x45')]]['calleridnum'],queues[_0x270f75['transfereeuniqueid']][_0x99e6('0x58')]));}else{utils[_0x99e6('0x2')](util[_0x99e6('0x10')](_0x99e6('0x5a'),_0x270f75[_0x99e6('0x4e')],queues[_0x270f75[_0x99e6('0x4f')]][_0x99e6('0x1e')],_0x270f75[_0x99e6('0x50')]));queues[_0x270f75[_0x99e6('0x4f')]][_0x99e6('0x1f')]=_0x270f75[_0x99e6('0x50')];}}}else if(_0x270f75[_0x99e6('0x5b')]==_0x270f75[_0x99e6('0x50')]){if(!_['isNil'](queues[_0x270f75['origtransfererlinkedid']])){utils['info'](util[_0x99e6('0x10')](_0x99e6('0x5c'),_0x270f75[_0x99e6('0x4e')],queues[_0x270f75['origtransfererlinkedid']][_0x99e6('0x1e')],_0x270f75[_0x99e6('0x5b')],_0x270f75[_0x99e6('0x5d')]));queues[_0x270f75[_0x99e6('0x4f')]][_0x99e6('0x41')]=!![];queues[_0x270f75[_0x99e6('0x4f')]]['transfertype']=_0x99e6('0x52');queues[_0x270f75['origtransfererlinkedid']][_0x99e6('0x48')]=_0x270f75[_0x99e6('0x5d')];queues[_0x270f75[_0x99e6('0x4f')]]['transferuniqueid']=_0x270f75[_0x99e6('0x5b')];queues[_0x270f75[_0x99e6('0x4f')]][_0x99e6('0x8')]=_0x99e6('0x53');}if(!_[_0x99e6('0x16')](queues[_0x270f75['secondtransfererlinkedid']])){if(_0x270f75[_0x99e6('0x5e')]&&queues[_0x270f75[_0x99e6('0x5e')]]){queues[_0x270f75[_0x99e6('0x5e')]][_0x99e6('0x55')]=0x1;queues[_0x270f75['transfertargetuniqueid']]=_[_0x99e6('0x56')](queues[_0x270f75[_0x99e6('0x5e')]]);queues[_0x270f75[_0x99e6('0x57')]][_0x99e6('0x1f')]=_0x270f75[_0x99e6('0x57')];queues[_0x270f75[_0x99e6('0x57')]]['queuecallerenterreason']=0x2;queues[_0x270f75[_0x99e6('0x57')]][_0x99e6('0x7')]=queues[_0x270f75[_0x99e6('0x4f')]][_0x99e6('0x7')];queues[_0x270f75['transfertargetuniqueid']][_0x99e6('0x58')]=queues[_0x270f75[_0x99e6('0x4f')]][_0x99e6('0x58')];queues[_0x270f75[_0x99e6('0x57')]]['queuecallerjoinAt']=utils[_0x99e6('0x1b')]();queues[_0x270f75[_0x99e6('0x57')]]['queuecallerleaveAt']=utils[_0x99e6('0x1b')]();queues[_0x270f75['transfertargetuniqueid']][_0x99e6('0x33')]=0x0;queues[_0x270f75['transfertargetuniqueid']][_0x99e6('0x59')]=0x0;utils[_0x99e6('0x2')](util[_0x99e6('0x10')](_0x99e6('0x5f'),_0x270f75[_0x99e6('0x4e')],queues[_0x270f75[_0x99e6('0x57')]]['name'],queues[_0x270f75['transfertargetuniqueid']][_0x99e6('0x1f')],queues[_0x270f75[_0x99e6('0x57')]][_0x99e6('0x7')],queues[_0x270f75[_0x99e6('0x57')]][_0x99e6('0x58')]));}else{utils[_0x99e6('0x2')](util[_0x99e6('0x10')](_0x99e6('0x5a'),_0x270f75[_0x99e6('0x4e')],queues[_0x270f75['secondtransfererlinkedid']]['name'],_0x270f75[_0x99e6('0x4f')]));queues[_0x270f75[_0x99e6('0x50')]][_0x99e6('0x1f')]=_0x270f75[_0x99e6('0x4f')];}}}}catch(_0x397731){utils[_0x99e6('0x14')](util[_0x99e6('0x10')](_0x99e6('0x4d'),_0x270f75[_0x99e6('0x4e')]),_0x397731);}};exports[_0x99e6('0x60')]=function(_0xcec377){try{if(!_['isNil'](queues[_0xcec377['uniqueid']])){utils[_0x99e6('0xf')](util['format'](_0x99e6('0x61'),_0xcec377['uniqueid']),_0xcec377);queues[_0xcec377['uniqueid']][_0x99e6('0x62')]=utils['now']();utils[_0x99e6('0x2')](util[_0x99e6('0x10')](_0x99e6('0x63'),_0xcec377[_0x99e6('0x4')],queues[_0xcec377[_0x99e6('0x4')]][_0x99e6('0x1e')],queues[_0xcec377[_0x99e6('0x4')]]['musiconholdstartAt']));}}catch(_0x213981){utils[_0x99e6('0x14')](util[_0x99e6('0x10')]('[%s][queues][musiconholdstart]',_0xcec377['uniqueid']),_0x213981);}};exports[_0x99e6('0x64')]=function(_0x5de92b){try{if(!_[_0x99e6('0x16')](queues[_0x5de92b['uniqueid']])){if(!_['isNil'](queues[_0x5de92b[_0x99e6('0x4')]][_0x99e6('0x62')])){utils[_0x99e6('0xf')](util[_0x99e6('0x10')](_0x99e6('0x65'),_0x5de92b[_0x99e6('0x4')]),_0x5de92b);queues[_0x5de92b[_0x99e6('0x4')]][_0x99e6('0x59')]+=utils[_0x99e6('0x34')](utils[_0x99e6('0x1b')](),queues[_0x5de92b[_0x99e6('0x4')]][_0x99e6('0x62')]);utils['info'](util['format'](_0x99e6('0x66'),_0x5de92b[_0x99e6('0x4')],queues[_0x5de92b[_0x99e6('0x4')]][_0x99e6('0x1e')],queues[_0x5de92b[_0x99e6('0x4')]]['mohtime']));delete queues[_0x5de92b[_0x99e6('0x4')]][_0x99e6('0x62')];}}}catch(_0x1e1766){utils[_0x99e6('0x14')](util['format'](_0x99e6('0x65'),_0x5de92b['uniqueid']),_0x1e1766);}}; \ No newline at end of file +var _0xe2cf=['BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfertargetlinkedid','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','assign','position','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','name','info','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerexitAt','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercomplete','transfer','TRANSFER','COMPLETEDBY','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype'];(function(_0x2e53e1,_0x12aed1){var _0x3a23de=function(_0xd84699){while(--_0xd84699){_0x2e53e1['push'](_0x2e53e1['shift']());}};_0x3a23de(++_0x12aed1);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x2aefff,_0x26a24b){_0x2aefff=_0x2aefff-0x0;var _0x4e4534=_0xe2cf[_0x2aefff];return _0x4e4534;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x11c3a4){utils['info'](util[_0xfe2c('0x1')](_0xfe2c('0x2'),_0x11c3a4[_0xfe2c('0x3')],_0x11c3a4[_0xfe2c('0x4')],_0x11c3a4['queue'],_0x11c3a4[_0xfe2c('0x5')],_0x11c3a4[_0xfe2c('0x6')],_0x11c3a4['accountcode'],_0x11c3a4['queuecallerexitreason']));if(_0x11c3a4[_0xfe2c('0x7')]){utils[_0xfe2c('0x8')](_0x11c3a4['queue'])['then'](function(_0x30aafe){if(_0x30aafe){_0x11c3a4[_0xfe2c('0x9')]=_0x30aafe[_0xfe2c('0x9')];}utils['request']('CreateVoiceQueueReport',_0x11c3a4);});}else{utils[_0xfe2c('0xa')](_0xfe2c('0xb'),_0x11c3a4);}if(_0x11c3a4['transfereduniqueid']){delete queues[_0x11c3a4[_0xfe2c('0xc')]];}else{delete queues[_0x11c3a4[_0xfe2c('0x3')]];}}exports[_0xfe2c('0xd')]=function(_0xa176e9){try{utils[_0xfe2c('0xe')](util[_0xfe2c('0x1')](_0xfe2c('0xf'),_0xa176e9['uniqueid']),_0xa176e9);utils['info'](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0xa176e9[_0xfe2c('0x3')],_0xa176e9['queue'],_0xa176e9['position']));queues[_0xa176e9[_0xfe2c('0x3')]]=_[_0xfe2c('0x10')](_0xa176e9,{'originalposition':_0xa176e9[_0xfe2c('0x11')],'queuecallerjoinAt':utils[_0xfe2c('0x12')](),'mohtime':0x0});}catch(_0x522692){utils['error'](util[_0xfe2c('0x1')](_0xfe2c('0xf'),_0xa176e9[_0xfe2c('0x3')]),_0x522692);}};exports[_0xfe2c('0x13')]=function(_0x565f40){try{if(!_[_0xfe2c('0x14')](queues[_0x565f40[_0xfe2c('0x3')]])){utils[_0xfe2c('0xe')](util[_0xfe2c('0x1')](_0xfe2c('0x15'),_0x565f40[_0xfe2c('0x3')]),_0x565f40);if(queues[_0x565f40['uniqueid']][_0xfe2c('0x16')]){if(!queues[_0x565f40[_0xfe2c('0x3')]][_0xfe2c('0x17')]&&!queues[_0x565f40[_0xfe2c('0x3')]]['queuecallerexit']){queues[_0x565f40[_0xfe2c('0x3')]]['queuecallercomplete']=!![];queues[_0x565f40['uniqueid']][_0xfe2c('0x18')]=utils[_0xfe2c('0x12')]();queues[_0x565f40['uniqueid']][_0xfe2c('0x19')]=_0xfe2c('0x1a');}utils['info'](util[_0xfe2c('0x1')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x565f40[_0xfe2c('0x3')],queues[_0x565f40[_0xfe2c('0x3')]][_0xfe2c('0x1b')],queues[_0x565f40[_0xfe2c('0x3')]][_0xfe2c('0x19')]));writeDB(queues[_0x565f40[_0xfe2c('0x3')]]);}else if(queues[_0x565f40['uniqueid']][_0xfe2c('0xc')]){utils[_0xfe2c('0x1c')](util[_0xfe2c('0x1')](_0xfe2c('0x1d'),_0x565f40[_0xfe2c('0x3')],queues[_0x565f40[_0xfe2c('0x3')]]['name'],queues[_0x565f40[_0xfe2c('0x3')]]['transfereduniqueid']));queues[queues[_0x565f40[_0xfe2c('0x3')]][_0xfe2c('0xc')]]=queues[_0x565f40[_0xfe2c('0x3')]];queues[queues[_0x565f40['uniqueid']][_0xfe2c('0xc')]][_0xfe2c('0x1e')]=0x2;delete queues[_0x565f40['uniqueid']];}}}catch(_0x3d7e1f){utils[_0xfe2c('0x1f')](util[_0xfe2c('0x1')](_0xfe2c('0x15'),_0x565f40[_0xfe2c('0x3')]),_0x3d7e1f);}};exports[_0xfe2c('0x20')]=function(_0x55aed7){try{utils['debug'](util[_0xfe2c('0x1')](_0xfe2c('0x21'),_0x55aed7[_0xfe2c('0x3')]),_0x55aed7);if(!_[_0xfe2c('0x14')](_0x55aed7[_0xfe2c('0x22')]['queuestatus'])&&_0x55aed7[_0xfe2c('0x23')][_0xfe2c('0x24')]()!==_0xfe2c('0x25')){if(!_[_0xfe2c('0x14')](queues[_0x55aed7[_0xfe2c('0x3')]])){queues[_0x55aed7[_0xfe2c('0x3')]][_0xfe2c('0x17')]=![];queues[_0x55aed7[_0xfe2c('0x3')]][_0xfe2c('0x26')]=null;queues[_0x55aed7[_0xfe2c('0x3')]][_0xfe2c('0x27')]=!![];queues[_0x55aed7[_0xfe2c('0x3')]]['queuecallerexitAt']=utils[_0xfe2c('0x12')]();queues[_0x55aed7[_0xfe2c('0x3')]][_0xfe2c('0x19')]=_0x55aed7['value'][_0xfe2c('0x24')]();utils[_0xfe2c('0x1c')](util['format'](_0xfe2c('0x28'),_0x55aed7[_0xfe2c('0x3')],queues[_0x55aed7[_0xfe2c('0x3')]]['name'],_0x55aed7[_0xfe2c('0x23')],queues[_0x55aed7[_0xfe2c('0x3')]][_0xfe2c('0x19')]));writeDB(queues[_0x55aed7[_0xfe2c('0x3')]]);}}else if(!_[_0xfe2c('0x14')](_0x55aed7[_0xfe2c('0x22')][_0xfe2c('0x29')])){if(!_['isNil'](queues[_0x55aed7['uniqueid']])&&!queues[_0x55aed7[_0xfe2c('0x3')]][_0xfe2c('0x17')]){queues[_0x55aed7[_0xfe2c('0x3')]][_0xfe2c('0x17')]=![];queues[_0x55aed7['uniqueid']][_0xfe2c('0x26')]=null;queues[_0x55aed7['uniqueid']][_0xfe2c('0x27')]=!![];queues[_0x55aed7[_0xfe2c('0x3')]]['queuecallerexitAt']=utils[_0xfe2c('0x12')]();queues[_0x55aed7['uniqueid']]['queuecallerexitreason']=_0xfe2c('0x2a');utils[_0xfe2c('0x1c')](util[_0xfe2c('0x1')](_0xfe2c('0x2b'),_0x55aed7[_0xfe2c('0x3')],queues[_0x55aed7[_0xfe2c('0x3')]][_0xfe2c('0x1b')],_0x55aed7[_0xfe2c('0x23')],queues[_0x55aed7[_0xfe2c('0x3')]][_0xfe2c('0x19')]));}}}catch(_0x222335){utils['error'](util[_0xfe2c('0x1')](_0xfe2c('0x21'),_0x55aed7[_0xfe2c('0x3')]),_0x222335);}};exports['queuecallerabandon']=function(_0x4c1e95){try{if(!_['isNil'](queues[_0x4c1e95[_0xfe2c('0x3')]])){utils[_0xfe2c('0xe')](util[_0xfe2c('0x1')](_0xfe2c('0x2c'),_0x4c1e95['uniqueid']),_0x4c1e95);queues[_0x4c1e95[_0xfe2c('0x3')]][_0xfe2c('0x27')]=![];queues[_0x4c1e95[_0xfe2c('0x3')]][_0xfe2c('0x2d')]=null;queues[_0x4c1e95[_0xfe2c('0x3')]]['queuecallerabandon']=!![];queues[_0x4c1e95[_0xfe2c('0x3')]][_0xfe2c('0x26')]=utils[_0xfe2c('0x12')]();queues[_0x4c1e95[_0xfe2c('0x3')]]['queuecallerexitreason']='ABANDONED';utils[_0xfe2c('0x1c')](util[_0xfe2c('0x1')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x4c1e95[_0xfe2c('0x3')],queues[_0x4c1e95[_0xfe2c('0x3')]][_0xfe2c('0x1b')],queues[_0x4c1e95[_0xfe2c('0x3')]]['queuecallerexitreason']));}}catch(_0xcc5785){utils[_0xfe2c('0x1f')](util[_0xfe2c('0x1')](_0xfe2c('0x2c'),_0x4c1e95[_0xfe2c('0x3')]),_0xcc5785);}};exports[_0xfe2c('0x2e')]=function(_0xef878d){try{if(!_[_0xfe2c('0x14')](queues[_0xef878d['uniqueid']])){utils[_0xfe2c('0xe')](util['format'](_0xfe2c('0x2f'),_0xef878d[_0xfe2c('0x3')]),_0xef878d);utils[_0xfe2c('0x1c')](util[_0xfe2c('0x1')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xef878d['uniqueid'],queues[_0xef878d['uniqueid']]['name'],_0xef878d['connectedlinenum'],_0xef878d[_0xfe2c('0x30')]));queues[_0xef878d['uniqueid']]['queuecallerleave']=!![];queues[_0xef878d[_0xfe2c('0x3')]]['queuecallerleaveAt']=utils[_0xfe2c('0x12')]();queues[_0xef878d['uniqueid']][_0xfe2c('0x31')]=utils[_0xfe2c('0x32')](queues[_0xef878d[_0xfe2c('0x3')]][_0xfe2c('0x16')],queues[_0xef878d[_0xfe2c('0x3')]]['queuecallerjoinAt']);queues[_0xef878d[_0xfe2c('0x3')]][_0xfe2c('0x11')]=_0xef878d[_0xfe2c('0x11')];queues[_0xef878d['uniqueid']][_0xfe2c('0x33')]=_0xef878d[_0xfe2c('0x33')];queues[_0xef878d['uniqueid']]['connectedlinenum']=_0xef878d['connectedlinenum'];queues[_0xef878d[_0xfe2c('0x3')]][_0xfe2c('0x30')]=_0xef878d[_0xfe2c('0x30')];}}catch(_0x2e0012){utils[_0xfe2c('0x1f')](util['format'](_0xfe2c('0x2f'),_0xef878d[_0xfe2c('0x3')]),_0x2e0012);}};exports[_0xfe2c('0x34')]=function(_0x578060){try{if(!_['isNil'](queues[_0x578060[_0xfe2c('0x3')]])){utils[_0xfe2c('0xe')](util[_0xfe2c('0x1')](_0xfe2c('0x35'),_0x578060[_0xfe2c('0x3')]),_0x578060);utils[_0xfe2c('0x1c')](util[_0xfe2c('0x1')](_0xfe2c('0x36'),_0x578060[_0xfe2c('0x3')],queues[_0x578060[_0xfe2c('0x3')]]['name'],_0x578060[_0xfe2c('0x37')],_0x578060[_0xfe2c('0x38')]));queues[_0x578060[_0xfe2c('0x3')]][_0xfe2c('0x17')]=![];queues[_0x578060[_0xfe2c('0x3')]][_0xfe2c('0x17')]=![];queues[_0x578060[_0xfe2c('0x3')]][_0xfe2c('0x26')]=null;queues[_0x578060[_0xfe2c('0x3')]][_0xfe2c('0x27')]=![];queues[_0x578060[_0xfe2c('0x3')]]['queuecallerexitreason']=null;queues[_0x578060[_0xfe2c('0x3')]]['queuecallerexitAt']=null;queues[_0x578060[_0xfe2c('0x3')]]['assigned']=!![];queues[_0x578060['uniqueid']]['accountcode']=_0x578060[_0xfe2c('0x38')];queues[_0x578060['uniqueid']][_0xfe2c('0x5')]=_0x578060['membername'];}}catch(_0x20c81b){utils[_0xfe2c('0x1f')](util[_0xfe2c('0x1')](_0xfe2c('0x35'),_0x578060[_0xfe2c('0x3')]),_0x20c81b);}};exports[_0xfe2c('0x39')]=function(_0x8f807c){try{if(!_[_0xfe2c('0x14')](queues[_0x8f807c[_0xfe2c('0x3')]])){if(queues[_0x8f807c['uniqueid']][_0xfe2c('0x16')]){utils[_0xfe2c('0xe')](util[_0xfe2c('0x1')](_0xfe2c('0x3a'),_0x8f807c[_0xfe2c('0x3')]),_0x8f807c);queues[_0x8f807c['uniqueid']][_0xfe2c('0x17')]=![];queues[_0x8f807c[_0xfe2c('0x3')]]['queuecallerabandon']=![];queues[_0x8f807c['uniqueid']][_0xfe2c('0x26')]=null;queues[_0x8f807c[_0xfe2c('0x3')]][_0xfe2c('0x27')]=![];queues[_0x8f807c[_0xfe2c('0x3')]][_0xfe2c('0x2d')]=null;queues[_0x8f807c[_0xfe2c('0x3')]][_0xfe2c('0x3b')]=!![];queues[_0x8f807c['uniqueid']][_0xfe2c('0x5')]=_0x8f807c[_0xfe2c('0x37')];queues[_0x8f807c[_0xfe2c('0x3')]][_0xfe2c('0x3c')]=!![];queues[_0x8f807c[_0xfe2c('0x3')]][_0xfe2c('0x18')]=utils[_0xfe2c('0x12')]();if(_0x8f807c['reason']==_0xfe2c('0x3d')){if(!queues[_0x8f807c['uniqueid']][_0xfe2c('0x3d')]){queues[_0x8f807c[_0xfe2c('0x3')]]['queuecallerexitreason']=_0xfe2c('0x3e');}}else{queues[_0x8f807c['uniqueid']][_0xfe2c('0x19')]=_0xfe2c('0x3f')+_0x8f807c['reason'][_0xfe2c('0x24')]();}utils['info'](util[_0xfe2c('0x1')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x8f807c[_0xfe2c('0x3')],queues[_0x8f807c[_0xfe2c('0x3')]]['name'],_0x8f807c[_0xfe2c('0x37')],queues[_0x8f807c[_0xfe2c('0x3')]][_0xfe2c('0x19')]));writeDB(queues[_0x8f807c[_0xfe2c('0x3')]]);}}}catch(_0xa47aeb){utils['error'](util[_0xfe2c('0x1')](_0xfe2c('0x3a'),_0x8f807c[_0xfe2c('0x3')]),_0xa47aeb);}};exports[_0xfe2c('0x40')]=function(_0x516237){try{if(!_[_0xfe2c('0x14')](queues[_0x516237['transfereeuniqueid']])){utils[_0xfe2c('0xe')](util['format'](_0xfe2c('0x41'),_0x516237[_0xfe2c('0x3')]),_0x516237);queues[_0x516237[_0xfe2c('0x42')]][_0xfe2c('0x3d')]=!![];queues[_0x516237[_0xfe2c('0x42')]][_0xfe2c('0x43')]=_0xfe2c('0x44');queues[_0x516237[_0xfe2c('0x42')]][_0xfe2c('0x45')]=_0x516237[_0xfe2c('0x46')];queues[_0x516237[_0xfe2c('0x42')]][_0xfe2c('0x47')]=_0x516237[_0xfe2c('0x42')];queues[_0x516237[_0xfe2c('0x42')]][_0xfe2c('0x19')]=_0xfe2c('0x48');utils['info'](util[_0xfe2c('0x1')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x516237[_0xfe2c('0x3')],queues[_0x516237['transfereeuniqueid']][_0xfe2c('0x1b')],_0x516237['transfereeuniqueid'],_0x516237['extension']));}}catch(_0x3cc8bb){utils[_0xfe2c('0x1f')](util[_0xfe2c('0x1')](_0xfe2c('0x41'),_0x516237[_0xfe2c('0x3')]),_0x3cc8bb);}};exports['attendedtransfer']=function(_0x313d80){try{utils[_0xfe2c('0xe')](util['format'](_0xfe2c('0x49'),_0x313d80[_0xfe2c('0x4a')]),_0x313d80);if(_0x313d80['origtransfereruniqueid']==_0x313d80['origtransfererlinkedid']){if(!_['isNil'](queues[_0x313d80[_0xfe2c('0x4b')]])){utils[_0xfe2c('0x1c')](util[_0xfe2c('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x313d80['origtransfereruniqueid'],queues[_0x313d80[_0xfe2c('0x4b')]][_0xfe2c('0x1b')],_0x313d80['origtransfererexten']));queues[_0x313d80[_0xfe2c('0x4b')]][_0xfe2c('0x3d')]=!![];queues[_0x313d80[_0xfe2c('0x4b')]][_0xfe2c('0x43')]='ATTENDED';queues[_0x313d80['secondtransfererlinkedid']][_0xfe2c('0x45')]=_0x313d80[_0xfe2c('0x4c')];queues[_0x313d80['secondtransfererlinkedid']][_0xfe2c('0x47')]=_0x313d80[_0xfe2c('0x4a')];queues[_0x313d80['secondtransfererlinkedid']][_0xfe2c('0x19')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x313d80[_0xfe2c('0x4d')]])){if(_0x313d80[_0xfe2c('0x4e')]&&queues[_0x313d80['transfereelinkedid']]){queues[_0x313d80[_0xfe2c('0x4e')]][_0xfe2c('0x1e')]=0x1;queues[_0x313d80['transfereeuniqueid']]=_[_0xfe2c('0x4f')](queues[_0x313d80['transfereelinkedid']]);queues[_0x313d80[_0xfe2c('0x42')]][_0xfe2c('0xc')]=_0x313d80[_0xfe2c('0x50')];queues[_0x313d80[_0xfe2c('0x42')]]['queuecallerenterreason']=0x2;queues[_0x313d80[_0xfe2c('0x42')]][_0xfe2c('0x6')]=queues[_0x313d80['secondtransfererlinkedid']][_0xfe2c('0x6')];queues[_0x313d80['transfereeuniqueid']][_0xfe2c('0x51')]=queues[_0x313d80['secondtransfererlinkedid']][_0xfe2c('0x51')];queues[_0x313d80[_0xfe2c('0x42')]]['queuecallerjoinAt']=utils[_0xfe2c('0x12')]();queues[_0x313d80[_0xfe2c('0x42')]][_0xfe2c('0x16')]=utils[_0xfe2c('0x12')]();queues[_0x313d80[_0xfe2c('0x42')]][_0xfe2c('0x31')]=0x0;queues[_0x313d80['transfereeuniqueid']][_0xfe2c('0x52')]=0x0;utils['info'](util['format'](_0xfe2c('0x53'),_0x313d80[_0xfe2c('0x4a')],queues[_0x313d80[_0xfe2c('0x42')]][_0xfe2c('0x1b')],queues[_0x313d80[_0xfe2c('0x42')]][_0xfe2c('0x6')],queues[_0x313d80['transfereeuniqueid']][_0xfe2c('0x51')]));}else{utils[_0xfe2c('0x1c')](util[_0xfe2c('0x1')](_0xfe2c('0x54'),_0x313d80['origtransfereruniqueid'],queues[_0x313d80[_0xfe2c('0x4d')]][_0xfe2c('0x1b')],_0x313d80[_0xfe2c('0x4b')]));queues[_0x313d80[_0xfe2c('0x4d')]]['transfereduniqueid']=_0x313d80[_0xfe2c('0x4b')];}}}else if(_0x313d80['secondtransfereruniqueid']==_0x313d80['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x313d80[_0xfe2c('0x4d')]])){utils[_0xfe2c('0x1c')](util[_0xfe2c('0x1')](_0xfe2c('0x55'),_0x313d80[_0xfe2c('0x4a')],queues[_0x313d80[_0xfe2c('0x4d')]][_0xfe2c('0x1b')],_0x313d80[_0xfe2c('0x56')],_0x313d80[_0xfe2c('0x57')]));queues[_0x313d80['origtransfererlinkedid']]['transfer']=!![];queues[_0x313d80[_0xfe2c('0x4d')]][_0xfe2c('0x43')]=_0xfe2c('0x58');queues[_0x313d80[_0xfe2c('0x4d')]][_0xfe2c('0x45')]=_0x313d80[_0xfe2c('0x57')];queues[_0x313d80['origtransfererlinkedid']][_0xfe2c('0x47')]=_0x313d80[_0xfe2c('0x56')];queues[_0x313d80[_0xfe2c('0x4d')]][_0xfe2c('0x19')]=_0xfe2c('0x59');}if(!_[_0xfe2c('0x14')](queues[_0x313d80[_0xfe2c('0x4b')]])){if(_0x313d80[_0xfe2c('0x5a')]&&queues[_0x313d80[_0xfe2c('0x5a')]]){queues[_0x313d80['transfertargetlinkedid']][_0xfe2c('0x1e')]=0x1;queues[_0x313d80[_0xfe2c('0x50')]]=_[_0xfe2c('0x4f')](queues[_0x313d80[_0xfe2c('0x5a')]]);queues[_0x313d80[_0xfe2c('0x50')]][_0xfe2c('0xc')]=_0x313d80['transfertargetuniqueid'];queues[_0x313d80[_0xfe2c('0x50')]][_0xfe2c('0x1e')]=0x2;queues[_0x313d80[_0xfe2c('0x50')]][_0xfe2c('0x6')]=queues[_0x313d80['origtransfererlinkedid']]['calleridnum'];queues[_0x313d80[_0xfe2c('0x50')]][_0xfe2c('0x51')]=queues[_0x313d80[_0xfe2c('0x4d')]]['calleridname'];queues[_0x313d80[_0xfe2c('0x50')]][_0xfe2c('0x5b')]=utils[_0xfe2c('0x12')]();queues[_0x313d80['transfertargetuniqueid']][_0xfe2c('0x16')]=utils[_0xfe2c('0x12')]();queues[_0x313d80[_0xfe2c('0x50')]][_0xfe2c('0x31')]=0x0;queues[_0x313d80[_0xfe2c('0x50')]][_0xfe2c('0x52')]=0x0;utils[_0xfe2c('0x1c')](util[_0xfe2c('0x1')](_0xfe2c('0x5c'),_0x313d80['origtransfereruniqueid'],queues[_0x313d80[_0xfe2c('0x50')]]['name'],queues[_0x313d80[_0xfe2c('0x50')]][_0xfe2c('0xc')],queues[_0x313d80[_0xfe2c('0x50')]]['calleridnum'],queues[_0x313d80['transfertargetuniqueid']]['calleridname']));}else{utils[_0xfe2c('0x1c')](util[_0xfe2c('0x1')](_0xfe2c('0x54'),_0x313d80[_0xfe2c('0x4a')],queues[_0x313d80[_0xfe2c('0x4b')]][_0xfe2c('0x1b')],_0x313d80[_0xfe2c('0x4d')]));queues[_0x313d80[_0xfe2c('0x4b')]][_0xfe2c('0xc')]=_0x313d80[_0xfe2c('0x4d')];}}}}catch(_0x4017ce){utils[_0xfe2c('0x1f')](util[_0xfe2c('0x1')]('[%s][queues][attendedtransfer]',_0x313d80[_0xfe2c('0x4a')]),_0x4017ce);}};exports['musiconholdstart']=function(_0x3bb231){try{if(!_[_0xfe2c('0x14')](queues[_0x3bb231['uniqueid']])){utils['debug'](util['format'](_0xfe2c('0x5d'),_0x3bb231[_0xfe2c('0x3')]),_0x3bb231);queues[_0x3bb231[_0xfe2c('0x3')]][_0xfe2c('0x5e')]=utils[_0xfe2c('0x12')]();utils[_0xfe2c('0x1c')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3bb231[_0xfe2c('0x3')],queues[_0x3bb231[_0xfe2c('0x3')]][_0xfe2c('0x1b')],queues[_0x3bb231['uniqueid']][_0xfe2c('0x5e')]));}}catch(_0x5d36a7){utils[_0xfe2c('0x1f')](util[_0xfe2c('0x1')](_0xfe2c('0x5d'),_0x3bb231[_0xfe2c('0x3')]),_0x5d36a7);}};exports['musiconholdstop']=function(_0x433fd2){try{if(!_[_0xfe2c('0x14')](queues[_0x433fd2[_0xfe2c('0x3')]])){if(!_[_0xfe2c('0x14')](queues[_0x433fd2[_0xfe2c('0x3')]]['musiconholdstartAt'])){utils[_0xfe2c('0xe')](util[_0xfe2c('0x1')]('[%s][queues][musiconholdstop]',_0x433fd2[_0xfe2c('0x3')]),_0x433fd2);queues[_0x433fd2[_0xfe2c('0x3')]][_0xfe2c('0x52')]+=utils[_0xfe2c('0x32')](utils[_0xfe2c('0x12')](),queues[_0x433fd2['uniqueid']][_0xfe2c('0x5e')]);utils[_0xfe2c('0x1c')](util[_0xfe2c('0x1')](_0xfe2c('0x5f'),_0x433fd2[_0xfe2c('0x3')],queues[_0x433fd2[_0xfe2c('0x3')]][_0xfe2c('0x1b')],queues[_0x433fd2[_0xfe2c('0x3')]]['mohtime']));delete queues[_0x433fd2['uniqueid']][_0xfe2c('0x5e')];}}}catch(_0x2a4779){utils[_0xfe2c('0x1f')](util[_0xfe2c('0x1')](_0xfe2c('0x60'),_0x433fd2[_0xfe2c('0x3')]),_0x2a4779);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index e1f9266..a5a73e5 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 _0xb7f9=['channel','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','value','endsWith','.wav49','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','cdr','split','lastIndexOf','queuecallerjoin','queue','lodash','util','./utils','info','format','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','uniqueid','context','exten'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb7f9,0xab));var _0x9b7f=function(_0x2b22a6,_0x4194c8){_0x2b22a6=_0x2b22a6-0x0;var _0x359277=_0xb7f9[_0x2b22a6];return _0x359277;};'use strict';var _=require(_0x9b7f('0x0'));var util=require(_0x9b7f('0x1'));var utils=require(_0x9b7f('0x2'));var recordings={};function writeDB(_0x4cf13f){utils[_0x9b7f('0x3')](util[_0x9b7f('0x4')]('[%s][recordings][writeDB]',_0x4cf13f['uniqueid']));if(_0x4cf13f['accountcode']){utils[_0x9b7f('0x5')](_0x4cf13f[_0x9b7f('0x6')])[_0x9b7f('0x7')](function(_0x3af020){if(_0x3af020){_0x4cf13f[_0x9b7f('0x8')]=_0x3af020[_0x9b7f('0x9')];_0x4cf13f[_0x9b7f('0xa')]=_0x3af020['id'];}utils[_0x9b7f('0xb')](_0x9b7f('0xc'),_0x4cf13f);});}else{utils['request'](_0x9b7f('0xc'),_0x4cf13f);}}exports[_0x9b7f('0xd')]=function(_0x462385){try{utils[_0x9b7f('0xe')](util[_0x9b7f('0x4')](_0x9b7f('0xf'),_0x462385['uniqueid']),_0x462385);if(_0x462385['uniqueid']==_0x462385[_0x9b7f('0x10')]){utils[_0x9b7f('0x3')](util[_0x9b7f('0x4')](_0x9b7f('0x11'),_0x462385[_0x9b7f('0x12')],_0x462385[_0x9b7f('0x13')],_0x462385[_0x9b7f('0x14')]));recordings[_0x462385['uniqueid']]={'uniqueid':_0x462385[_0x9b7f('0x12')],'accountcode':_0x462385[_0x9b7f('0x6')],'exten':_0x462385[_0x9b7f('0x14')],'context':_0x462385[_0x9b7f('0x13')],'channel':_0x462385[_0x9b7f('0x15')],'monitors':[]};}}catch(_0xbcb942){utils[_0x9b7f('0x16')](util[_0x9b7f('0x4')](_0x9b7f('0xf'),_0x462385[_0x9b7f('0x12')]),_0xbcb942);}};exports[_0x9b7f('0x17')]=function(_0x5301b1){try{utils[_0x9b7f('0xe')](util[_0x9b7f('0x4')](_0x9b7f('0x18'),_0x5301b1['uniqueid']),_0x5301b1);if(!_['isNil'](recordings[_0x5301b1[_0x9b7f('0x12')]])&&_0x5301b1[_0x9b7f('0x19')]==0x6){utils[_0x9b7f('0x3')](util[_0x9b7f('0x4')](_0x9b7f('0x1a'),_0x5301b1[_0x9b7f('0x12')],_0x5301b1[_0x9b7f('0x13')],_0x5301b1['channel']));}else if(!_[_0x9b7f('0x1b')](recordings[_0x5301b1['linkedid']])&&_0x5301b1[_0x9b7f('0x19')]==0x6&&_0x5301b1['context']!=_0x9b7f('0x1c')){utils[_0x9b7f('0x3')](util[_0x9b7f('0x4')](_0x9b7f('0x1d'),_0x5301b1[_0x9b7f('0x12')],_0x5301b1[_0x9b7f('0x10')],_0x5301b1['context'],_0x5301b1[_0x9b7f('0x15')]));recordings[_0x5301b1[_0x9b7f('0x10')]][_0x9b7f('0x6')]=_0x5301b1[_0x9b7f('0x6')];}}catch(_0x37fdc0){utils[_0x9b7f('0x16')](util[_0x9b7f('0x4')](_0x9b7f('0x18'),_0x5301b1[_0x9b7f('0x12')]),_0x37fdc0);}};exports[_0x9b7f('0x1e')]=function(_0x1bf87d){try{if(!_[_0x9b7f('0x1b')](_0x1bf87d['variable'])&&!_[_0x9b7f('0x1b')](_0x1bf87d[_0x9b7f('0x1f')][_0x9b7f('0x20')])){utils['debug'](util[_0x9b7f('0x4')]('[%s][recordings][varset]',_0x1bf87d[_0x9b7f('0x12')]),_0x1bf87d);utils[_0x9b7f('0x3')](util[_0x9b7f('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x1bf87d[_0x9b7f('0x12')],_0x1bf87d[_0x9b7f('0x1f')],_0x1bf87d[_0x9b7f('0x21')]));if(_[_0x9b7f('0x22')](_0x1bf87d[_0x9b7f('0x21')],_0x9b7f('0x23'))){_0x1bf87d[_0x9b7f('0x21')]=_0x1bf87d['value']['replace']('.wav49','.WAV');}if(recordings[_0x1bf87d[_0x9b7f('0x10')]]){var _0x395f11=_[_0x9b7f('0x24')](recordings[_0x1bf87d[_0x9b7f('0x10')]][_0x9b7f('0x25')],{'value':_0x1bf87d['value']});if(_[_0x9b7f('0x1b')](_0x395f11)){recordings[_0x1bf87d[_0x9b7f('0x10')]][_0x9b7f('0x25')][_0x9b7f('0x26')]({'value':_0x1bf87d[_0x9b7f('0x21')]});}}}}catch(_0x22cd0e){utils[_0x9b7f('0x16')](util[_0x9b7f('0x4')](_0x9b7f('0x27'),_0x1bf87d[_0x9b7f('0x12')]),_0x22cd0e);}};exports[_0x9b7f('0x28')]=function(_0x139d5d){try{if(!_[_0x9b7f('0x1b')](recordings[_0x139d5d['uniqueid']])){utils[_0x9b7f('0xe')](util['format'](_0x9b7f('0x29'),_0x139d5d[_0x9b7f('0x12')]),_0x139d5d);utils[_0x9b7f('0x3')](util[_0x9b7f('0x4')](_0x9b7f('0x2a'),_0x139d5d[_0x9b7f('0x12')],_0x139d5d[_0x9b7f('0x2b')],_0x139d5d[_0x9b7f('0x2c')],_0x139d5d[_0x9b7f('0x2d')]));recordings[_0x139d5d['uniqueid']][_0x9b7f('0x2b')]=_0x139d5d['calleridnum'];recordings[_0x139d5d[_0x9b7f('0x12')]][_0x9b7f('0x2c')]=_0x139d5d[_0x9b7f('0x2c')];recordings[_0x139d5d[_0x9b7f('0x12')]]['connectedlinenum']=_0x139d5d[_0x9b7f('0x2e')];recordings[_0x139d5d[_0x9b7f('0x12')]][_0x9b7f('0x2f')]=_0x139d5d[_0x9b7f('0x2f')];if(recordings[_0x139d5d['uniqueid']][_0x9b7f('0x30')]==_0x9b7f('0x31')&&recordings[_0x139d5d['uniqueid']]['accountcode']){recordings[_0x139d5d['uniqueid']][_0x9b7f('0x2e')]=recordings[_0x139d5d[_0x9b7f('0x12')]][_0x9b7f('0x6')];recordings[_0x139d5d[_0x9b7f('0x12')]][_0x9b7f('0x2f')]='';}recordings[_0x139d5d['uniqueid']][_0x9b7f('0x25')][_0x9b7f('0x32')](function(_0xc791a8){var _0x4663d5=_[_0x9b7f('0x33')](recordings[_0x139d5d[_0x9b7f('0x12')]]);_0x4663d5[_0x9b7f('0x21')]=_0xc791a8[_0x9b7f('0x21')];writeDB(_0x4663d5);});delete recordings[_0x139d5d[_0x9b7f('0x12')]];}}catch(_0x291242){utils['error'](util[_0x9b7f('0x4')](_0x9b7f('0x29'),_0x139d5d[_0x9b7f('0x12')]),_0x291242);}};exports[_0x9b7f('0x34')]=function(_0x2db45d){try{if(!_['isNil'](recordings[_0x2db45d[_0x9b7f('0x12')]])){utils[_0x9b7f('0xe')](util[_0x9b7f('0x4')](_0x9b7f('0x35'),_0x2db45d['uniqueid']),_0x2db45d);utils[_0x9b7f('0x3')](util[_0x9b7f('0x4')](_0x9b7f('0x36'),_0x2db45d[_0x9b7f('0x12')],_0x2db45d['application'],_0x2db45d[_0x9b7f('0x37')]));if(_0x2db45d[_0x9b7f('0x38')]['toLowerCase']()==_0x9b7f('0x39')&&_[_0x9b7f('0x3a')](_0x2db45d[_0x9b7f('0x37')]['toLowerCase'](),_0x9b7f('0x3b'))){var _0x413a8f=_0x2db45d['appdata'][_0x9b7f('0x3c')]('=');var _0x17a2b2=_0x413a8f[0x0]['substring'](_0x413a8f[0x0][_0x9b7f('0x3d')]('(')+0x1,_0x413a8f[0x0][_0x9b7f('0x3d')](')'));var _0x5185e2=_0x413a8f[0x1];recordings[_0x2db45d[_0x9b7f('0x12')]][_0x17a2b2]=_0x5185e2;}}}catch(_0x3979ef){utils[_0x9b7f('0x16')](util[_0x9b7f('0x4')](_0x9b7f('0x35'),_0x2db45d[_0x9b7f('0x12')]),_0x3979ef);}};exports[_0x9b7f('0x3e')]=function(_0x528427){try{if(!_[_0x9b7f('0x1b')](recordings[_0x528427[_0x9b7f('0x12')]])){utils[_0x9b7f('0xe')](util['format']('[%s][recordings][queuecallerjoin]',_0x528427[_0x9b7f('0x12')]),_0x528427);utils[_0x9b7f('0x3')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x528427['uniqueid'],_0x528427[_0x9b7f('0x3f')]));recordings[_0x528427[_0x9b7f('0x12')]][_0x9b7f('0x3f')]=_0x528427[_0x9b7f('0x3f')];}}catch(_0x28e87b){utils['error'](util[_0x9b7f('0x4')]('[%s][recordings][queuecallerjoin]',_0x528427['uniqueid']),_0x28e87b);}}; \ No newline at end of file +var _0xfd83=['transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','forEach','newexten','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','exten','context','channel','error','newstate','[%s][recordings][newstate]','isNil','linkedid','channelstate'];(function(_0x21886e,_0x334f23){var _0x32b64e=function(_0x504009){while(--_0x504009){_0x21886e['push'](_0x21886e['shift']());}};_0x32b64e(++_0x334f23);}(_0xfd83,0xe0));var _0x3fd8=function(_0x219407,_0x36c620){_0x219407=_0x219407-0x0;var _0x240e77=_0xfd83[_0x219407];return _0x240e77;};'use strict';var _=require(_0x3fd8('0x0'));var util=require('util');var utils=require(_0x3fd8('0x1'));var recordings={};function writeDB(_0x4cc8d2){utils[_0x3fd8('0x2')](util[_0x3fd8('0x3')](_0x3fd8('0x4'),_0x4cc8d2[_0x3fd8('0x5')]));if(_0x4cc8d2[_0x3fd8('0x6')]){utils[_0x3fd8('0x7')](_0x4cc8d2[_0x3fd8('0x6')])['then'](function(_0x1b16d6){if(_0x1b16d6){_0x4cc8d2[_0x3fd8('0x8')]=_0x1b16d6[_0x3fd8('0x9')];_0x4cc8d2[_0x3fd8('0xa')]=_0x1b16d6['id'];}utils[_0x3fd8('0xb')]('CreateVoiceRecording',_0x4cc8d2);});}else{utils['request'](_0x3fd8('0xc'),_0x4cc8d2);}}exports['newchannel']=function(_0x3f0bfa){try{utils[_0x3fd8('0xd')](util['format'](_0x3fd8('0xe'),_0x3f0bfa[_0x3fd8('0x5')]),_0x3f0bfa);if(_0x3f0bfa[_0x3fd8('0x5')]==_0x3f0bfa['linkedid']){utils[_0x3fd8('0x2')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x3f0bfa[_0x3fd8('0x5')],_0x3f0bfa['context'],_0x3f0bfa[_0x3fd8('0xf')]));recordings[_0x3f0bfa[_0x3fd8('0x5')]]={'uniqueid':_0x3f0bfa['uniqueid'],'accountcode':_0x3f0bfa[_0x3fd8('0x6')],'exten':_0x3f0bfa['exten'],'context':_0x3f0bfa[_0x3fd8('0x10')],'channel':_0x3f0bfa[_0x3fd8('0x11')],'monitors':[]};}}catch(_0x51b9d0){utils[_0x3fd8('0x12')](util[_0x3fd8('0x3')](_0x3fd8('0xe'),_0x3f0bfa[_0x3fd8('0x5')]),_0x51b9d0);}};exports[_0x3fd8('0x13')]=function(_0xd5f2cb){try{utils[_0x3fd8('0xd')](util[_0x3fd8('0x3')](_0x3fd8('0x14'),_0xd5f2cb[_0x3fd8('0x5')]),_0xd5f2cb);if(!_['isNil'](recordings[_0xd5f2cb[_0x3fd8('0x5')]])&&_0xd5f2cb['channelstate']==0x6){utils[_0x3fd8('0x2')](util[_0x3fd8('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0xd5f2cb[_0x3fd8('0x5')],_0xd5f2cb[_0x3fd8('0x10')],_0xd5f2cb[_0x3fd8('0x11')]));}else if(!_[_0x3fd8('0x15')](recordings[_0xd5f2cb[_0x3fd8('0x16')]])&&_0xd5f2cb[_0x3fd8('0x17')]==0x6&&_0xd5f2cb[_0x3fd8('0x10')]!=_0x3fd8('0x18')){utils[_0x3fd8('0x2')](util[_0x3fd8('0x3')](_0x3fd8('0x19'),_0xd5f2cb[_0x3fd8('0x5')],_0xd5f2cb[_0x3fd8('0x16')],_0xd5f2cb[_0x3fd8('0x10')],_0xd5f2cb['channel']));recordings[_0xd5f2cb[_0x3fd8('0x16')]][_0x3fd8('0x6')]=_0xd5f2cb[_0x3fd8('0x6')];}}catch(_0x19675e){utils[_0x3fd8('0x12')](util['format'](_0x3fd8('0x14'),_0xd5f2cb['uniqueid']),_0x19675e);}};exports[_0x3fd8('0x1a')]=function(_0x40a8f6){try{if(!_[_0x3fd8('0x15')](_0x40a8f6['variable'])&&!_['isNil'](_0x40a8f6[_0x3fd8('0x1b')]['mixmonitor_filename'])){utils[_0x3fd8('0xd')](util[_0x3fd8('0x3')](_0x3fd8('0x1c'),_0x40a8f6[_0x3fd8('0x5')]),_0x40a8f6);utils['info'](util[_0x3fd8('0x3')](_0x3fd8('0x1d'),_0x40a8f6[_0x3fd8('0x5')],_0x40a8f6[_0x3fd8('0x1b')],_0x40a8f6['value']));if(_[_0x3fd8('0x1e')](_0x40a8f6[_0x3fd8('0x1f')],_0x3fd8('0x20'))){_0x40a8f6['value']=_0x40a8f6[_0x3fd8('0x1f')][_0x3fd8('0x21')](_0x3fd8('0x20'),_0x3fd8('0x22'));}if(recordings[_0x40a8f6[_0x3fd8('0x16')]]){var _0x16c662=_[_0x3fd8('0x23')](recordings[_0x40a8f6['linkedid']]['monitors'],{'value':_0x40a8f6[_0x3fd8('0x1f')]});if(_[_0x3fd8('0x15')](_0x16c662)){recordings[_0x40a8f6[_0x3fd8('0x16')]][_0x3fd8('0x24')][_0x3fd8('0x25')]({'value':_0x40a8f6[_0x3fd8('0x1f')]});}}}}catch(_0xd6827b){utils[_0x3fd8('0x12')](util[_0x3fd8('0x3')]('[%s][recordings][varset]',_0x40a8f6[_0x3fd8('0x5')]),_0xd6827b);}};exports[_0x3fd8('0x26')]=function(_0x2cc809){try{if(!_[_0x3fd8('0x15')](recordings[_0x2cc809[_0x3fd8('0x5')]])){utils[_0x3fd8('0xd')](util['format'](_0x3fd8('0x27'),_0x2cc809['uniqueid']),_0x2cc809);utils['info'](util[_0x3fd8('0x3')](_0x3fd8('0x28'),_0x2cc809[_0x3fd8('0x5')],_0x2cc809[_0x3fd8('0x29')],_0x2cc809[_0x3fd8('0x2a')],_0x2cc809[_0x3fd8('0x2b')]));recordings[_0x2cc809[_0x3fd8('0x5')]][_0x3fd8('0x29')]=_0x2cc809[_0x3fd8('0x29')];recordings[_0x2cc809['uniqueid']][_0x3fd8('0x2a')]=_0x2cc809[_0x3fd8('0x2a')];recordings[_0x2cc809[_0x3fd8('0x5')]][_0x3fd8('0x2c')]=_0x2cc809['connectedlinenum'];recordings[_0x2cc809[_0x3fd8('0x5')]][_0x3fd8('0x2d')]=_0x2cc809[_0x3fd8('0x2d')];if(recordings[_0x2cc809[_0x3fd8('0x5')]][_0x3fd8('0x2e')]=='outbound'&&recordings[_0x2cc809[_0x3fd8('0x5')]]['accountcode']){recordings[_0x2cc809[_0x3fd8('0x5')]]['connectedlinenum']=recordings[_0x2cc809[_0x3fd8('0x5')]][_0x3fd8('0x6')];recordings[_0x2cc809[_0x3fd8('0x5')]][_0x3fd8('0x2d')]='';}recordings[_0x2cc809[_0x3fd8('0x5')]][_0x3fd8('0x24')][_0x3fd8('0x2f')](function(_0x537cf7){var _0x464151=_['clone'](recordings[_0x2cc809['uniqueid']]);_0x464151[_0x3fd8('0x1f')]=_0x537cf7['value'];writeDB(_0x464151);});delete recordings[_0x2cc809[_0x3fd8('0x5')]];}}catch(_0x90aaa0){utils['error'](util[_0x3fd8('0x3')]('[%s][recordings][hangup]',_0x2cc809[_0x3fd8('0x5')]),_0x90aaa0);}};exports[_0x3fd8('0x30')]=function(_0x3880c0){try{if(!_['isNil'](recordings[_0x3880c0[_0x3fd8('0x5')]])){utils['debug'](util[_0x3fd8('0x3')](_0x3fd8('0x31'),_0x3880c0[_0x3fd8('0x5')]),_0x3880c0);utils['info'](util[_0x3fd8('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3880c0[_0x3fd8('0x5')],_0x3880c0[_0x3fd8('0x32')],_0x3880c0['appdata']));if(_0x3880c0['application'][_0x3fd8('0x33')]()==_0x3fd8('0x34')&&_[_0x3fd8('0x35')](_0x3880c0[_0x3fd8('0x36')][_0x3fd8('0x33')](),_0x3fd8('0x37'))){var _0x4bbcca=_0x3880c0['appdata'][_0x3fd8('0x38')]('=');var _0xf563d5=_0x4bbcca[0x0][_0x3fd8('0x39')](_0x4bbcca[0x0][_0x3fd8('0x3a')]('(')+0x1,_0x4bbcca[0x0]['lastIndexOf'](')'));var _0x3ff06d=_0x4bbcca[0x1];recordings[_0x3880c0[_0x3fd8('0x5')]][_0xf563d5]=_0x3ff06d;}}}catch(_0x5afcca){utils[_0x3fd8('0x12')](util[_0x3fd8('0x3')]('[%s][recordings][newexten]',_0x3880c0[_0x3fd8('0x5')]),_0x5afcca);}};exports[_0x3fd8('0x3b')]=function(_0x1dc31b){try{if(!_[_0x3fd8('0x15')](recordings[_0x1dc31b[_0x3fd8('0x5')]])){utils[_0x3fd8('0xd')](util[_0x3fd8('0x3')]('[%s][recordings][queuecallerjoin]',_0x1dc31b[_0x3fd8('0x5')]),_0x1dc31b);utils[_0x3fd8('0x2')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x1dc31b['uniqueid'],_0x1dc31b['queue']));recordings[_0x1dc31b['uniqueid']][_0x3fd8('0x3c')]=_0x1dc31b[_0x3fd8('0x3c')];}}catch(_0x133ae8){utils['error'](util[_0x3fd8('0x3')](_0x3fd8('0x3d'),_0x1dc31b[_0x3fd8('0x5')]),_0x133ae8);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 2517c28..745dab3 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 _0xc03f=['format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','assign','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info'];(function(_0x4e3840,_0x427c06){var _0x5868b3=function(_0x107150){while(--_0x107150){_0x4e3840['push'](_0x4e3840['shift']());}};_0x5868b3(++_0x427c06);}(_0xc03f,0xf2));var _0xfc03=function(_0x505dd9,_0x227339){_0x505dd9=_0x505dd9-0x0;var _0x4f2b64=_0xc03f[_0x505dd9];return _0x4f2b64;};'use strict';var _=require(_0xfc03('0x0'));var util=require(_0xfc03('0x1'));var utils=require(_0xfc03('0x2'));function writeDB(_0x3d7e9c){utils[_0xfc03('0x3')](util[_0xfc03('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x3d7e9c[_0xfc03('0x5')]===_0xfc03('0x6')?_0x3d7e9c[_0xfc03('0x7')]:_0x3d7e9c[_0xfc03('0x8')],_0x3d7e9c['type']));utils[_0xfc03('0x9')](_0xfc03('0xa'),_0x3d7e9c);}exports[_0xfc03('0xb')]={};exports[_0xfc03('0xc')]=function(_0x18cb7b){try{utils[_0xfc03('0xd')](util[_0xfc03('0x4')](_0xfc03('0xe'),_0x18cb7b[_0xfc03('0x8')]),_0x18cb7b);utils[_0xfc03('0x3')](util[_0xfc03('0x4')](_0xfc03('0xf'),_0x18cb7b[_0xfc03('0x8')],_0x18cb7b['transferercalleridnum'],_0x18cb7b['transferercalleridname'],_0x18cb7b[_0xfc03('0x10')],_0x18cb7b[_0xfc03('0x11')]));_0x18cb7b[_0xfc03('0x5')]=_0xfc03('0x12');exports[_0xfc03('0xb')][_0x18cb7b[_0xfc03('0x13')]]=_0x18cb7b;writeDB(_0x18cb7b);}catch(_0x13cce5){utils[_0xfc03('0x14')](util[_0xfc03('0x4')]('[%s][transfers][blindtransfer]',_0x18cb7b[_0xfc03('0x8')]),_0x13cce5);}};exports[_0xfc03('0x15')]=function(_0xbf79b2){try{utils[_0xfc03('0xd')](util['format']('[%s][transfers][attendedtransfer]',_0xbf79b2[_0xfc03('0x7')]),_0xbf79b2);utils[_0xfc03('0x3')](util[_0xfc03('0x4')](_0xfc03('0x16'),_0xbf79b2[_0xfc03('0x7')],_0xbf79b2[_0xfc03('0x17')],_0xbf79b2[_0xfc03('0x18')],_0xbf79b2['transfertargetcalleridnum'],_0xbf79b2['transfertargetcalleridname']));_0xbf79b2=_[_0xfc03('0x19')](_0xbf79b2,{'transfererchannel':_0xbf79b2['origtransfererchannel'],'transferercalleridnum':_0xbf79b2[_0xfc03('0x17')],'transferercalleridname':_0xbf79b2[_0xfc03('0x18')],'transfererconnectedlinenum':_0xbf79b2['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xbf79b2['secondtransfererconnectedlinename'],'transfereraccountcode':_0xbf79b2[_0xfc03('0x1a')],'transferercontext':_0xbf79b2[_0xfc03('0x1b')],'transfererexten':_0xbf79b2[_0xfc03('0x1c')],'transfererlinkedid':_0xbf79b2[_0xfc03('0x1d')],'context':_0xbf79b2['origtransferercontext'],'extension':_0xbf79b2[_0xfc03('0x1e')],'type':_0xfc03('0x6')});if(_[_0xfc03('0x1f')](_0xbf79b2[_0xfc03('0x20')])){_0xbf79b2=_['assign'](_0xbf79b2,{'transfereechannel':_0xbf79b2[_0xfc03('0x21')],'transfereecalleridnum':_0xbf79b2[_0xfc03('0x22')],'transfereecalleridname':_0xbf79b2[_0xfc03('0x23')],'transfereeconnectedlinenum':_0xbf79b2[_0xfc03('0x24')],'transfereeconnectedlinename':_0xbf79b2[_0xfc03('0x25')],'transfereeaccountcode':_0xbf79b2['transfertargetaccountcode'],'transfereecontext':_0xbf79b2['transfertargetcontext'],'transfereeexten':_0xbf79b2[_0xfc03('0x26')],'transfereelinkedid':_0xbf79b2[_0xfc03('0x27')]});}writeDB(_0xbf79b2);}catch(_0x3e5ce9){utils[_0xfc03('0x14')](util[_0xfc03('0x4')](_0xfc03('0x28'),_0xbf79b2[_0xfc03('0x7')]),_0x3e5ce9);}}; \ No newline at end of file +var _0xd87b=['origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','./utils','info','format','attended','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','type','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd87b,0x14f));var _0xbd87=function(_0x477ec2,_0x4bd9c7){_0x477ec2=_0x477ec2-0x0;var _0x4f464b=_0xd87b[_0x477ec2];return _0x4f464b;};'use strict';var _=require(_0xbd87('0x0'));var util=require('util');var utils=require(_0xbd87('0x1'));function writeDB(_0x54fa7c){utils[_0xbd87('0x2')](util[_0xbd87('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x54fa7c['type']===_0xbd87('0x4')?_0x54fa7c['origtransfereruniqueid']:_0x54fa7c[_0xbd87('0x5')],_0x54fa7c['type']));utils[_0xbd87('0x6')](_0xbd87('0x7'),_0x54fa7c);}exports[_0xbd87('0x8')]={};exports[_0xbd87('0x9')]=function(_0x202c9e){try{utils[_0xbd87('0xa')](util[_0xbd87('0x3')](_0xbd87('0xb'),_0x202c9e['uniqueid']),_0x202c9e);utils[_0xbd87('0x2')](util[_0xbd87('0x3')](_0xbd87('0xc'),_0x202c9e['uniqueid'],_0x202c9e[_0xbd87('0xd')],_0x202c9e[_0xbd87('0xe')],_0x202c9e['transfereecalleridnum'],_0x202c9e[_0xbd87('0xf')]));_0x202c9e[_0xbd87('0x10')]='blind';exports[_0xbd87('0x8')][_0x202c9e[_0xbd87('0x11')]]=_0x202c9e;writeDB(_0x202c9e);}catch(_0x39d781){utils[_0xbd87('0x12')](util[_0xbd87('0x3')](_0xbd87('0xb'),_0x202c9e[_0xbd87('0x5')]),_0x39d781);}};exports[_0xbd87('0x13')]=function(_0xfb2929){try{utils['debug'](util[_0xbd87('0x3')](_0xbd87('0x14'),_0xfb2929[_0xbd87('0x15')]),_0xfb2929);utils[_0xbd87('0x2')](util[_0xbd87('0x3')](_0xbd87('0x16'),_0xfb2929[_0xbd87('0x15')],_0xfb2929[_0xbd87('0x17')],_0xfb2929[_0xbd87('0x18')],_0xfb2929['transfertargetcalleridnum'],_0xfb2929[_0xbd87('0x19')]));_0xfb2929=_[_0xbd87('0x1a')](_0xfb2929,{'transfererchannel':_0xfb2929[_0xbd87('0x1b')],'transferercalleridnum':_0xfb2929[_0xbd87('0x17')],'transferercalleridname':_0xfb2929[_0xbd87('0x18')],'transfererconnectedlinenum':_0xfb2929[_0xbd87('0x1c')],'transfererconnectedlinename':_0xfb2929[_0xbd87('0x1d')],'transfereraccountcode':_0xfb2929[_0xbd87('0x1e')],'transferercontext':_0xfb2929[_0xbd87('0x1f')],'transfererexten':_0xfb2929[_0xbd87('0x20')],'transfererlinkedid':_0xfb2929[_0xbd87('0x21')],'context':_0xfb2929[_0xbd87('0x22')],'extension':_0xfb2929[_0xbd87('0x23')],'type':_0xbd87('0x4')});if(_[_0xbd87('0x24')](_0xfb2929[_0xbd87('0x25')])){_0xfb2929=_[_0xbd87('0x1a')](_0xfb2929,{'transfereechannel':_0xfb2929[_0xbd87('0x26')],'transfereecalleridnum':_0xfb2929[_0xbd87('0x27')],'transfereecalleridname':_0xfb2929[_0xbd87('0x19')],'transfereeconnectedlinenum':_0xfb2929[_0xbd87('0x28')],'transfereeconnectedlinename':_0xfb2929[_0xbd87('0x29')],'transfereeaccountcode':_0xfb2929[_0xbd87('0x2a')],'transfereecontext':_0xfb2929[_0xbd87('0x2b')],'transfereeexten':_0xfb2929[_0xbd87('0x2c')],'transfereelinkedid':_0xfb2929[_0xbd87('0x2d')]});}writeDB(_0xfb2929);}catch(_0x4e5d74){utils[_0xbd87('0x12')](util['format'](_0xbd87('0x14'),_0xfb2929[_0xbd87('0x15')]),_0x4e5d74);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e82b482..7afeb4b 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 _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb10b,0x12a));var _0xbb10=function(_0x343dfb,_0xed8587){_0x343dfb=_0x343dfb-0x0;var _0x297fe2=_0xb10b[_0x343dfb];return _0x297fe2;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb10b,0x12a));var _0xbb10=function(_0xee95aa,_0x56bc39){_0xee95aa=_0xee95aa-0x0;var _0x301db2=_0xb10b[_0xee95aa];return _0x301db2;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file